From be81c20bbf625539a324015d148c4d78dab6e736 Mon Sep 17 00:00:00 2001 From: markof Date: Mon, 23 Dec 2024 16:02:30 +0800 Subject: [PATCH 01/25] feat: release codatta-connect widget --- dist/api/account.api.d.ts | 39 +- dist/codatta-connect.d.ts | 26 +- dist/components/email-connect-widget.d.ts | 5 + dist/components/email-connect.d.ts | 4 + dist/components/email-login-widget.d.ts | 6 + dist/components/ton-wallet-connect.d.ts | 2 +- dist/components/ton-wallet-select.d.ts | 4 +- dist/components/wallet-connect-widget.d.ts | 3 +- dist/components/wallet-connect.d.ts | 15 +- dist/index.es.js | 11 +- dist/index.umd.js | 72 +- dist/{main-7Oj8aJZz.js => main-Dv8NlLmw.js} | 3671 +++++++++-------- dist/main.d.ts | 1 + ...56k1-BZeczIQv.js => secp256k1-CWJe94hK.js} | 2 +- lib/api/account.api.ts | 51 +- lib/api/request.ts | 3 +- lib/codatta-connect.tsx | 125 +- lib/codatta-signin.tsx | 7 +- lib/components/email-connect-widget.tsx | 21 + lib/components/email-connect.tsx | 101 + lib/components/email-login-widget.tsx | 40 + lib/components/ton-wallet-connect.tsx | 3 +- lib/components/ton-wallet-select.tsx | 6 +- lib/components/wallet-connect-widget.tsx | 8 +- lib/components/wallet-connect.tsx | 28 +- lib/main.ts | 3 +- .../codatta-signin-context-provider.tsx | 1 + package.json | 4 +- src/layout/app-layout.tsx | 2 +- src/views/login-view.tsx | 83 +- vite.config.dev.ts | 28 +- 31 files changed, 2418 insertions(+), 1957 deletions(-) create mode 100644 dist/components/email-connect-widget.d.ts create mode 100644 dist/components/email-connect.d.ts create mode 100644 dist/components/email-login-widget.d.ts rename dist/{main-7Oj8aJZz.js => main-Dv8NlLmw.js} (95%) rename dist/{secp256k1-BZeczIQv.js => secp256k1-CWJe94hK.js} (99%) create mode 100644 lib/components/email-connect-widget.tsx create mode 100644 lib/components/email-connect.tsx create mode 100644 lib/components/email-login-widget.tsx diff --git a/dist/api/account.api.d.ts b/dist/api/account.api.d.ts index 387bd84..7847582 100644 --- a/dist/api/account.api.d.ts +++ b/dist/api/account.api.d.ts @@ -1,4 +1,5 @@ import { AxiosInstance } from 'axios'; +import { TonProofItemReply } from '@tonconnect/sdk'; type TAccountType = 'email' | 'block_chain'; export type TAccountRole = 'B' | 'C'; export type TDeviceType = 'WEB' | 'TG' | 'PLUG'; @@ -23,12 +24,23 @@ interface ILoginParamsBase { [key: string]: any; }; } +interface IConnectParamsBase { + account_type: string; + connector: 'codatta_email' | 'codatta_wallet' | 'codatta_ton'; + account_enum: TAccountRole; +} interface IEmailLoginParams extends ILoginParamsBase { connector: 'codatta_email'; account_type: 'email'; email: string; email_code: string; } +interface IEmailConnectParams extends IConnectParamsBase { + connector: 'codatta_email'; + account_type: 'email'; + email: string; + email_code: string; +} interface IWalletLoginParams extends ILoginParamsBase { connector: 'codatta_wallet'; account_type: 'block_chain'; @@ -39,13 +51,35 @@ interface IWalletLoginParams extends ILoginParamsBase { signature: string; message: string; } +interface IWalletConnectParams extends IConnectParamsBase { + connector: 'codatta_wallet'; + account_type: 'block_chain'; + address: string; + wallet_name: string; + chain: string; + nonce: string; + signature: string; + message: string; +} interface ITonLoginParams extends ILoginParamsBase { connector: 'codatta_ton'; account_type: 'block_chain'; wallet_name: string; address: string; chain: string; - connect_info: object[]; + connect_info: [{ + [key: string]: string; + }, TonProofItemReply]; +} +interface ITonConnectParams extends IConnectParamsBase { + connector: 'codatta_ton'; + account_type: 'block_chain'; + wallet_name: string; + address: string; + chain: string; + connect_info: [{ + [key: string]: string; + }, TonProofItemReply]; } declare class AccountApi { private request; @@ -68,6 +102,9 @@ declare class AccountApi { tonLogin(props: ITonLoginParams): Promise<{ data: ILoginResponse; }>; + bindEmail(props: IEmailConnectParams): Promise; + bindTonWallet(props: ITonConnectParams): Promise; + bindEvmWallet(props: IWalletConnectParams): Promise; } declare const _default: AccountApi; export default _default; diff --git a/dist/codatta-connect.d.ts b/dist/codatta-connect.d.ts index 9b13953..b3c574e 100644 --- a/dist/codatta-connect.d.ts +++ b/dist/codatta-connect.d.ts @@ -1,6 +1,24 @@ -import { WalletItem } from './types/wallet-item.class'; +import { default as TonConnect, Wallet } from '@tonconnect/sdk'; +import { WalletSignInfo } from './components/wallet-connect'; +import { WalletClient } from 'viem'; +export interface EmvWalletConnectInfo { + chain_type: 'eip155'; + client: WalletClient; + connect_info: WalletSignInfo; +} +export interface TonWalletConnectInfo { + chain_type: 'ton'; + client: TonConnect; + connect_info: Wallet; +} export default function CodattaConnect(props: { - onSelectMoreWallets: () => void; - onSelectTonConnect?: () => void; - onConnect: (wallet: WalletItem) => Promise; + onEvmWalletConnect: (connectInfo: EmvWalletConnectInfo) => Promise; + onTonWalletConnect: (connectInfo: TonWalletConnectInfo) => Promise; + onEmailConnect: (email: string, code: string) => Promise; + config?: { + showEmailSignIn?: boolean; + showFeaturedWallets?: boolean; + showMoreWallets?: boolean; + showTonConnect?: boolean; + }; }): import("react/jsx-runtime").JSX.Element; diff --git a/dist/components/email-connect-widget.d.ts b/dist/components/email-connect-widget.d.ts new file mode 100644 index 0000000..018ef8b --- /dev/null +++ b/dist/components/email-connect-widget.d.ts @@ -0,0 +1,5 @@ +export default function EmailConnectWidget(props: { + email: string; + onInputCode: (email: string, code: string) => Promise; + onBack: () => void; +}): import("react/jsx-runtime").JSX.Element; diff --git a/dist/components/email-connect.d.ts b/dist/components/email-connect.d.ts new file mode 100644 index 0000000..60c53e9 --- /dev/null +++ b/dist/components/email-connect.d.ts @@ -0,0 +1,4 @@ +export default function EmailConnect(props: { + email: string; + onInputCode: (email: string, code: string) => Promise; +}): import("react/jsx-runtime").JSX.Element; diff --git a/dist/components/email-login-widget.d.ts b/dist/components/email-login-widget.d.ts new file mode 100644 index 0000000..0811c8f --- /dev/null +++ b/dist/components/email-login-widget.d.ts @@ -0,0 +1,6 @@ +import { ILoginResponse } from '../api/account.api'; +export default function EmailLoginWidget(props: { + email: string; + onLogin: (res: ILoginResponse) => Promise; + onBack: () => void; +}): import("react/jsx-runtime").JSX.Element; diff --git a/dist/components/ton-wallet-connect.d.ts b/dist/components/ton-wallet-connect.d.ts index 2affda6..1c0cfa5 100644 --- a/dist/components/ton-wallet-connect.d.ts +++ b/dist/components/ton-wallet-connect.d.ts @@ -3,5 +3,5 @@ export default function TonWalletConnect(props: { connector: TonConnect; wallet: WalletInfoRemote | WalletInfoInjectable; onBack: () => void; - loading: boolean; + loading?: boolean; }): import("react/jsx-runtime").JSX.Element; diff --git a/dist/components/ton-wallet-select.d.ts b/dist/components/ton-wallet-select.d.ts index 5cbf8c7..49e7950 100644 --- a/dist/components/ton-wallet-select.d.ts +++ b/dist/components/ton-wallet-select.d.ts @@ -1,6 +1,6 @@ -import { default as TonConnect, WalletInfo } from '@tonconnect/sdk'; +import { default as TonConnect, WalletInfoInjectable, WalletInfoRemote } from '@tonconnect/sdk'; export default function TonWalletSelect(props: { connector: TonConnect; - onSelect: (wallet: WalletInfo) => void; + onSelect: (wallet: WalletInfoRemote | WalletInfoInjectable) => void; onBack: () => void; }): import("react/jsx-runtime").JSX.Element; diff --git a/dist/components/wallet-connect-widget.d.ts b/dist/components/wallet-connect-widget.d.ts index e06433d..ccd8159 100644 --- a/dist/components/wallet-connect-widget.d.ts +++ b/dist/components/wallet-connect-widget.d.ts @@ -1,6 +1,7 @@ +import { WalletSignInfo } from './wallet-connect'; import { WalletItem } from '../types/wallet-item.class'; export default function WalletConnectWidget(props: { wallet: WalletItem; - onConnect: (wallet: WalletItem) => void; + onConnect: (wallet: WalletItem, signInfo: WalletSignInfo) => void; onBack: () => void; }): import("react/jsx-runtime").JSX.Element; diff --git a/dist/components/wallet-connect.d.ts b/dist/components/wallet-connect.d.ts index 1507a58..4319fcd 100644 --- a/dist/components/wallet-connect.d.ts +++ b/dist/components/wallet-connect.d.ts @@ -1,12 +1,13 @@ import { WalletItem } from '../types/wallet-item.class'; +export interface WalletSignInfo { + message: string; + nonce: string; + signature: string; + address: string; + wallet_name: string; +} export default function WalletConnect(props: { wallet: WalletItem; - onSignFinish: (wallet: WalletItem, params: { - message: string; - nonce: string; - signature: string; - address: string; - wallet_name: string; - }) => Promise; + onSignFinish: (wallet: WalletItem, params: WalletSignInfo) => Promise; onShowQrCode: () => void; }): import("react/jsx-runtime").JSX.Element; diff --git a/dist/index.es.js b/dist/index.es.js index cfe7710..ab3a888 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -1,7 +1,8 @@ -import { C as o, d as e, a as n, u as C } from "./main-7Oj8aJZz.js"; +import { C as e, d as n, a as C, u as s } from "./main-Dv8NlLmw.js"; +import "react"; export { - o as CodattaConnectContextProvider, - e as CodattaSignin, - n as coinbaseWallet, - C as useCodattaConnectContext + e as CodattaConnectContextProvider, + n as CodattaSignin, + C as coinbaseWallet, + s as useCodattaConnectContext }; diff --git a/dist/index.umd.js b/dist/index.umd.js index 8d8374d..65a4cd8 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -1,4 +1,4 @@ -(function(Vn,Pe){typeof exports=="object"&&typeof module<"u"?Pe(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],Pe):(Vn=typeof globalThis<"u"?globalThis:Vn||self,Pe(Vn["xny-connect"]={},Vn.React))})(this,function(Vn,Pe){"use strict";var noe=Object.defineProperty;var ioe=(Vn,Pe,Lc)=>Pe in Vn?noe(Vn,Pe,{enumerable:!0,configurable:!0,writable:!0,value:Lc}):Vn[Pe]=Lc;var so=(Vn,Pe,Lc)=>ioe(Vn,typeof Pe!="symbol"?Pe+"":Pe,Lc);function Lc(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const Yt=Lc(Pe);var nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ui(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Jp(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Xp={exports:{}},pf={};/** +(function(Vn,Pe){typeof exports=="object"&&typeof module<"u"?Pe(exports,require("react"),require("https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js")):typeof define=="function"&&define.amd?define(["exports","react","https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"],Pe):(Vn=typeof globalThis<"u"?globalThis:Vn||self,Pe(Vn["xny-connect"]={},Vn.React))})(this,function(Vn,Pe){"use strict";var noe=Object.defineProperty;var ioe=(Vn,Pe,Lc)=>Pe in Vn?noe(Vn,Pe,{enumerable:!0,configurable:!0,writable:!0,value:Lc}):Vn[Pe]=Lc;var so=(Vn,Pe,Lc)=>ioe(Vn,typeof Pe!="symbol"?Pe+"":Pe,Lc);function Lc(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const Yt=Lc(Pe);var nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ui(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Jp(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Xp={exports:{}},pf={};/** * @license React * react-jsx-runtime.production.min.js * @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Hy;function UA(){if(Hy)return pf;Hy=1;var t=Pe,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,u,l){var d,g={},y=null,A=null;l!==void 0&&(y=""+l),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(A=u.ref);for(d in u)n.call(u,d)&&!s.hasOwnProperty(d)&&(g[d]=u[d]);if(a&&a.defaultProps)for(d in u=a.defaultProps,u)g[d]===void 0&&(g[d]=u[d]);return{$$typeof:e,type:a,key:y,ref:A,props:g,_owner:i.current}}return pf.Fragment=r,pf.jsx=o,pf.jsxs=o,pf}var gf={};/** + */var Wy;function UA(){if(Wy)return pf;Wy=1;var t=Pe,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,u,l){var d,g={},y=null,A=null;l!==void 0&&(y=""+l),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(A=u.ref);for(d in u)n.call(u,d)&&!s.hasOwnProperty(d)&&(g[d]=u[d]);if(a&&a.defaultProps)for(d in u=a.defaultProps,u)g[d]===void 0&&(g[d]=u[d]);return{$$typeof:e,type:a,key:y,ref:A,props:g,_owner:i.current}}return pf.Fragment=r,pf.jsx=o,pf.jsxs=o,pf}var gf={};/** * @license React * react-jsx-runtime.development.js * @@ -14,7 +14,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Wy;function jA(){return Wy||(Wy=1,process.env.NODE_ENV!=="production"&&function(){var t=Pe,e=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),A=Symbol.for("react.offscreen"),P=Symbol.iterator,N="@@iterator";function D(j){if(j===null||typeof j!="object")return null;var oe=P&&j[P]||j[N];return typeof oe=="function"?oe:null}var k=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function $(j){{for(var oe=arguments.length,pe=new Array(oe>1?oe-1:0),xe=1;xe1?oe-1:0),xe=1;xe=1&&tt>=0&&je[st]!==gt[tt];)tt--;for(;st>=1&&tt>=0;st--,tt--)if(je[st]!==gt[tt]){if(st!==1||tt!==1)do if(st--,tt--,tt<0||je[st]!==gt[tt]){var At=` @@ -27,29 +27,29 @@ Check the top-level render call using <`+pe+">.")}return oe}}function bt(j,oe){{ <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; - <%s key={someKey} {...props} />`,dt,Mt,_t,Mt),Ft[Mt+dt]=!0}}return j===n?nt(tt):Ut(tt),tt}}function H(j,oe,pe){return B(j,oe,pe,!0)}function V(j,oe,pe){return B(j,oe,pe,!1)}var C=V,Y=H;gf.Fragment=n,gf.jsx=C,gf.jsxs=Y}()),gf}process.env.NODE_ENV==="production"?Xp.exports=UA():Xp.exports=jA();var me=Xp.exports;const Ts="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2",qA=[{featured:!0,name:"MetaMask",rdns:"io.metamask",image:`${Ts}#metamask`,getWallet:{chrome_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",brave_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",edge_addon_id:"ejbalbakoplchlghecdalmeeeajnimhm",firefox_addon_id:"ether-metamask",play_store_id:"io.metamask",app_store_id:"id1438144202"},deep_link:"metamask://wc",universal_link:"https://metamask.app.link/wc"},{featured:!0,name:"OKX Wallet",rdns:"com.okex.wallet",image:`${Ts}#okx`,getWallet:{chrome_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",brave_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",edge_addon_id:"pbpjkcldjiffchgbbndmhojiacbgflha",play_store_id:"com.okinc.okex.gp",app_store_id:"id1327268470"},deep_link:"okex://main/wc",universal_link:"okex://main/wc"},{featured:!0,name:"WalletConnect",image:`${Ts}#walletconnect`},{featured:!1,name:"Coinbase Wallet",image:`${Ts}#coinbase`},{featured:!1,name:"GateWallet",rdns:"io.gate.wallet",image:`${Ts}#6e528abf-7a7d-47bd-d84d-481f169b1200`,getWallet:{chrome_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",brave_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",play_store_id:"com.gateio.gateio",app_store_id:"id1294998195",mac_app_store_id:"id1609559473"},deep_link:"https://www.gate.io/mobileapp",universal_link:"https://www.gate.io/mobileapp"},{featured:!1,name:"Onekey",rdns:"so.onekey.app.wallet",image:`${Ts}#onekey`,getWallet:{chrome_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",brave_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",play_store_id:"so.onekey.app.wallet",app_store_id:"id1609559473"},deep_link:"onekey-wallet://",universal_link:"onekey://wc"},{featured:!1,name:"Infinity Wallet",image:`${Ts}#9f259366-0bcd-4817-0af9-f78773e41900`,desktop_link:"infinity://wc"},{name:"Rabby Wallet",rdns:"io.rabby",featured:!1,image:`${Ts}#rabby`,getWallet:{chrome_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",brave_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",play_store_id:"com.debank.rabbymobile",app_store_id:"id6474381673"}},{name:"Binance Web3 Wallet",featured:!1,image:`${Ts}#ebac7b39-688c-41e3-7912-a4fefba74600`,getWallet:{play_store_id:"com.binance.dev",app_store_id:"id1436799971"}},{name:"Rainbow Wallet",rdns:"me.rainbow",featured:!1,image:`${Ts}#rainbow`,getWallet:{chrome_store_id:"opfgelmcmbiajamepnmloijbpoleiama",edge_addon_id:"cpojfbodiccabbabgimdeohkkpjfpbnf",firefox_addon_id:"rainbow-extension",app_store_id:"id1457119021",play_store_id:"me.rainbow"}}];function zA(t,e){const r=t.exec(e);return r==null?void 0:r.groups}const Ky=/^tuple(?(\[(\d*)\])*)$/;function Zp(t){let e=t.type;if(Ky.test(t.type)&&"components"in t){e="(";const r=t.components.length;for(let i=0;ie(t,s)}function kc(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new rP(t.type);return`${t.name}(${Qp(t.inputs,{includeName:e})})`}function Qp(t,{includeName:e=!1}={}){return t?t.map(r=>WA(r,{includeName:e})).join(e?", ":","):""}function WA(t,{includeName:e}){return t.type.startsWith("tuple")?`(${Qp(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}function Yo(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function _n(t){return Yo(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const Vy="2.21.45";let vf={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${Vy}`};class yt extends Error{constructor(e,r={}){var a;const n=(()=>{var u;return r.cause instanceof yt?r.cause.details:(u=r.cause)!=null&&u.message?r.cause.message:r.details})(),i=r.cause instanceof yt&&r.cause.docsPath||r.docsPath,s=(a=vf.getDocsUrl)==null?void 0:a.call(vf,{...r,docsPath:i}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...vf.version?[`Version: ${vf.version}`]:[]].join(` -`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=Vy}walk(e){return Gy(this,e)}}function Gy(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?Gy(t.cause,e):e?null:t}class KA extends yt{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` -`),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class Yy extends yt{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` + <%s key={someKey} {...props} />`,dt,Mt,_t,Mt),Ft[Mt+dt]=!0}}return j===n?nt(tt):Ut(tt),tt}}function H(j,oe,pe){return B(j,oe,pe,!0)}function V(j,oe,pe){return B(j,oe,pe,!1)}var C=V,Y=H;gf.Fragment=n,gf.jsx=C,gf.jsxs=Y}()),gf}process.env.NODE_ENV==="production"?Xp.exports=UA():Xp.exports=jA();var me=Xp.exports;const Ts="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2",qA=[{featured:!0,name:"MetaMask",rdns:"io.metamask",image:`${Ts}#metamask`,getWallet:{chrome_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",brave_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",edge_addon_id:"ejbalbakoplchlghecdalmeeeajnimhm",firefox_addon_id:"ether-metamask",play_store_id:"io.metamask",app_store_id:"id1438144202"},deep_link:"metamask://wc",universal_link:"https://metamask.app.link/wc"},{featured:!0,name:"OKX Wallet",rdns:"com.okex.wallet",image:`${Ts}#okx`,getWallet:{chrome_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",brave_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",edge_addon_id:"pbpjkcldjiffchgbbndmhojiacbgflha",play_store_id:"com.okinc.okex.gp",app_store_id:"id1327268470"},deep_link:"okex://main/wc",universal_link:"okex://main/wc"},{featured:!0,name:"WalletConnect",image:`${Ts}#walletconnect`},{featured:!1,name:"Coinbase Wallet",image:`${Ts}#coinbase`},{featured:!1,name:"GateWallet",rdns:"io.gate.wallet",image:`${Ts}#6e528abf-7a7d-47bd-d84d-481f169b1200`,getWallet:{chrome_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",brave_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",play_store_id:"com.gateio.gateio",app_store_id:"id1294998195",mac_app_store_id:"id1609559473"},deep_link:"https://www.gate.io/mobileapp",universal_link:"https://www.gate.io/mobileapp"},{featured:!1,name:"Onekey",rdns:"so.onekey.app.wallet",image:`${Ts}#onekey`,getWallet:{chrome_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",brave_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",play_store_id:"so.onekey.app.wallet",app_store_id:"id1609559473"},deep_link:"onekey-wallet://",universal_link:"onekey://wc"},{featured:!1,name:"Infinity Wallet",image:`${Ts}#9f259366-0bcd-4817-0af9-f78773e41900`,desktop_link:"infinity://wc"},{name:"Rabby Wallet",rdns:"io.rabby",featured:!1,image:`${Ts}#rabby`,getWallet:{chrome_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",brave_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",play_store_id:"com.debank.rabbymobile",app_store_id:"id6474381673"}},{name:"Binance Web3 Wallet",featured:!1,image:`${Ts}#ebac7b39-688c-41e3-7912-a4fefba74600`,getWallet:{play_store_id:"com.binance.dev",app_store_id:"id1436799971"}},{name:"Rainbow Wallet",rdns:"me.rainbow",featured:!1,image:`${Ts}#rainbow`,getWallet:{chrome_store_id:"opfgelmcmbiajamepnmloijbpoleiama",edge_addon_id:"cpojfbodiccabbabgimdeohkkpjfpbnf",firefox_addon_id:"rainbow-extension",app_store_id:"id1457119021",play_store_id:"me.rainbow"}}];function zA(t,e){const r=t.exec(e);return r==null?void 0:r.groups}const Vy=/^tuple(?(\[(\d*)\])*)$/;function Zp(t){let e=t.type;if(Vy.test(t.type)&&"components"in t){e="(";const r=t.components.length;for(let i=0;ie(t,s)}function kc(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new rP(t.type);return`${t.name}(${Qp(t.inputs,{includeName:e})})`}function Qp(t,{includeName:e=!1}={}){return t?t.map(r=>WA(r,{includeName:e})).join(e?", ":","):""}function WA(t,{includeName:e}){return t.type.startsWith("tuple")?`(${Qp(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}function Yo(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function _n(t){return Yo(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const Gy="2.21.45";let vf={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${Gy}`};class yt extends Error{constructor(e,r={}){var a;const n=(()=>{var u;return r.cause instanceof yt?r.cause.details:(u=r.cause)!=null&&u.message?r.cause.message:r.details})(),i=r.cause instanceof yt&&r.cause.docsPath||r.docsPath,s=(a=vf.getDocsUrl)==null?void 0:a.call(vf,{...r,docsPath:i}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...vf.version?[`Version: ${vf.version}`]:[]].join(` +`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=Gy}walk(e){return Yy(this,e)}}function Yy(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?Yy(t.cause,e):e?null:t}class KA extends yt{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` +`),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class Jy extends yt{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` `),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class VA extends yt{constructor({data:e,params:r,size:n}){super([`Data size of ${n} bytes is too small for given parameters.`].join(` `),{metaMessages:[`Params: (${Qp(r,{includeName:!0})})`,`Data: ${e} (${n} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=r,this.size=n}}class eg extends yt{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class GA extends yt{constructor({expectedLength:e,givenLength:r,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${e}`,`Given length: ${r}`].join(` `),{name:"AbiEncodingArrayLengthMismatchError"})}}class YA extends yt{constructor({expectedSize:e,value:r}){super(`Size of bytes "${r}" (bytes${_n(r)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class JA extends yt{constructor({expectedLength:e,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${r}`].join(` -`),{name:"AbiEncodingLengthMismatchError"})}}class Jy extends yt{constructor(e,{docsPath:r}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(` -`),{docsPath:r,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class Xy extends yt{constructor(e,{docsPath:r}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` +`),{name:"AbiEncodingLengthMismatchError"})}}class Xy extends yt{constructor(e,{docsPath:r}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(` +`),{docsPath:r,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class Zy extends yt{constructor(e,{docsPath:r}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` `),{docsPath:r,name:"AbiFunctionNotFoundError"})}}class XA extends yt{constructor(e,r){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${kc(e.abiItem)}\`, and`,`\`${r.type}\` in \`${kc(r.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class ZA extends yt{constructor({expectedSize:e,givenSize:r}){super(`Expected bytes${e}, got bytes${r}.`,{name:"BytesSizeMismatchError"})}}class QA extends yt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(` `),{docsPath:r,name:"InvalidAbiEncodingType"})}}class eP extends yt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` `),{docsPath:r,name:"InvalidAbiDecodingType"})}}class tP extends yt{constructor(e){super([`Value "${e}" is not a valid array.`].join(` `),{name:"InvalidArrayError"})}}class rP extends yt{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` -`),{name:"InvalidDefinitionTypeError"})}}class Zy extends yt{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}class Qy extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}class ew extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function $c(t,{dir:e,size:r=32}={}){return typeof t=="string"?Jo(t,{dir:e,size:r}):nP(t,{dir:e,size:r})}function Jo(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new Qy({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function nP(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new Qy({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie)throw new oP({givenSize:_n(t),maxSize:e})}function bf(t,e={}){const{signed:r}=e;e.size&&Rs(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<e.toString(16).padStart(2,"0"));function Rh(t,e={}){return typeof t=="number"||typeof t=="bigint"?Pr(t,e):typeof t=="string"?Dh(t,e):typeof t=="boolean"?tw(t,e):li(t,e)}function tw(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(Rs(r,{size:e.size}),$c(r,{size:e.size})):r}function li(t,e={}){let r="";for(let i=0;is||i=oo.zero&&t<=oo.nine)return t-oo.zero;if(t>=oo.A&&t<=oo.F)return t-(oo.A-10);if(t>=oo.a&&t<=oo.f)return t-(oo.a-10)}function ao(t,e={}){let r=t;e.size&&(Rs(r,{size:e.size}),r=$c(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function dP(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Oh(t.outputLen),Oh(t.blockLen)}function Uc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function iw(t,e){Fc(t);const r=e.outputLen;if(t.length>sw&Nh)}:{h:Number(t>>sw&Nh)|0,l:Number(t&Nh)|0}}function gP(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;it<>>32-r,vP=(t,e,r)=>e<>>32-r,bP=(t,e,r)=>e<>>64-r,yP=(t,e,r)=>t<>>64-r,jc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const wP=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),ng=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Ds=(t,e)=>t<<32-e|t>>>e,ow=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,xP=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function aw(t){for(let e=0;ee.toString(16).padStart(2,"0"));function EP(t){Fc(t);let e="";for(let r=0;rt().update(yf(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function PP(t){const e=(n,i)=>t(i).update(yf(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function MP(t=32){if(jc&&typeof jc.getRandomValues=="function")return jc.getRandomValues(new Uint8Array(t));if(jc&&typeof jc.randomBytes=="function")return jc.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const uw=[],fw=[],lw=[],IP=BigInt(0),wf=BigInt(1),CP=BigInt(2),TP=BigInt(7),RP=BigInt(256),DP=BigInt(113);for(let t=0,e=wf,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],uw.push(2*(5*n+r)),fw.push((t+1)*(t+2)/2%64);let i=IP;for(let s=0;s<7;s++)e=(e<>TP)*DP)%RP,e&CP&&(i^=wf<<(wf<r>32?bP(t,e,r):mP(t,e,r),dw=(t,e,r)=>r>32?yP(t,e,r):vP(t,e,r);function pw(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,u=(o+2)%10,l=r[u],d=r[u+1],g=hw(l,d,1)^r[a],y=dw(l,d,1)^r[a+1];for(let A=0;A<50;A+=10)t[o+A]^=g,t[o+A+1]^=y}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=fw[o],u=hw(i,s,a),l=dw(i,s,a),d=uw[o];i=t[d],s=t[d+1],t[d]=u,t[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=OP[n],t[1]^=NP[n]}r.fill(0)}class xf extends ig{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Oh(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=wP(this.state)}keccak(){ow||aw(this.state32),pw(this.state32,this.rounds),ow||aw(this.state32),this.posOut=0,this.pos=0}update(e){Uc(this);const{blockLen:r,state:n}=this;e=yf(e);const i=e.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Oh(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(iw(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new xf(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Xo=(t,e,r)=>cw(()=>new xf(e,t,r)),LP=Xo(6,144,224/8),kP=Xo(6,136,256/8),$P=Xo(6,104,384/8),BP=Xo(6,72,512/8),FP=Xo(1,144,224/8),gw=Xo(1,136,256/8),UP=Xo(1,104,384/8),jP=Xo(1,72,512/8),mw=(t,e,r)=>PP((n={})=>new xf(e,t,n.dkLen===void 0?r:n.dkLen,!0)),qP=mw(31,168,128/8),zP=mw(31,136,256/8),HP=Object.freeze(Object.defineProperty({__proto__:null,Keccak:xf,keccakP:pw,keccak_224:FP,keccak_256:gw,keccak_384:UP,keccak_512:jP,sha3_224:LP,sha3_256:kP,sha3_384:$P,sha3_512:BP,shake128:qP,shake256:zP},Symbol.toStringTag,{value:"Module"}));function _f(t,e){const r=e||"hex",n=gw(Yo(t,{strict:!1})?rg(t):t);return r==="bytes"?n:Rh(n)}const WP=t=>_f(rg(t));function KP(t){return WP(t)}function VP(t){let e=!0,r="",n=0,i="",s=!1;for(let o=0;o{const e=typeof t=="string"?t:HA(t);return VP(e)};function vw(t){return KP(GP(t))}const YP=vw;class qc extends yt{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class Lh extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const sg=new Lh(8192);function Ef(t,e){if(sg.has(`${t}.${e}`))return sg.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=_f(nw(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return sg.set(`${t}.${e}`,s),s}function bw(t,e){if(!co(t,{strict:!1}))throw new qc({address:t});return Ef(t,e)}const JP=/^0x[a-fA-F0-9]{40}$/,og=new Lh(8192);function co(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(og.has(n))return og.get(n);const i=JP.test(t)?t.toLowerCase()===t?!0:r?Ef(t)===t:!0:!1;return og.set(n,i),i}function zc(t){return typeof t[0]=="string"?kh(t):XP(t)}function XP(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function kh(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}function $h(t,e,r,{strict:n}={}){return Yo(t,{strict:!1})?ZP(t,e,r,{strict:n}):xw(t,e,r,{strict:n})}function yw(t,e){if(typeof e=="number"&&e>0&&e>_n(t)-1)throw new Zy({offset:e,position:"start",size:_n(t)})}function ww(t,e,r){if(typeof e=="number"&&typeof r=="number"&&_n(t)!==r-e)throw new Zy({offset:r,position:"end",size:_n(t)})}function xw(t,e,r,{strict:n}={}){yw(t,e);const i=t.slice(e,r);return n&&ww(i,e,r),i}function ZP(t,e,r,{strict:n}={}){yw(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&ww(i,e,r),i}function _w(t,e){if(t.length!==e.length)throw new JA({expectedLength:t.length,givenLength:e.length});const r=QP({params:t,values:e}),n=cg(r);return n.length===0?"0x":n}function QP({params:t,values:e}){const r=[];for(let n=0;n0?zc([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:zc(s.map(({encoded:o})=>o))}}function rM(t,{param:e}){const[,r]=e.type.split("bytes"),n=_n(t);if(!r){let i=t;return n%32!==0&&(i=Jo(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:zc([Jo(Pr(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new YA({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:Jo(t,{dir:"right"})}}function nM(t){if(typeof t!="boolean")throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Jo(tw(t))}}function iM(t,{signed:e}){return{dynamic:!1,encoded:Pr(t,{size:32,signed:e})}}function sM(t){const e=Dh(t),r=Math.ceil(_n(e)/32),n=[];for(let i=0;ii))}}function ug(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const fg=t=>$h(vw(t),0,4);function Ew(t){const{abi:e,args:r=[],name:n}=t,i=Yo(n,{strict:!1}),s=e.filter(a=>i?a.type==="function"?fg(a)===n:a.type==="event"?YP(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((l,d)=>{const g="inputs"in a&&a.inputs[d];return g?lg(l,g):!1})){if(o&&"inputs"in o&&o.inputs){const l=Sw(a.inputs,o.inputs,r);if(l)throw new XA({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||s[0]}function lg(t,e){const r=typeof t,n=e.type;switch(n){case"address":return co(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>lg(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>lg(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Sw(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return Sw(i.components,s.components,r[n]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?co(r[n],{strict:!1}):o.includes("address")&&o.includes("bytes")?co(r[n],{strict:!1}):!1)return o}}function uo(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const Aw="/docs/contract/encodeFunctionData";function aM(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=Ew({abi:e,args:r,name:n});if(!s)throw new Xy(n,{docsPath:Aw});i=s}if(i.type!=="function")throw new Xy(void 0,{docsPath:Aw});return{abi:[i],functionName:fg(kc(i))}}function cM(t){const{args:e}=t,{abi:r,functionName:n}=(()=>{var a;return t.abi.length===1&&((a=t.functionName)!=null&&a.startsWith("0x"))?t:aM(t)})(),i=r[0],s=n,o="inputs"in i&&i.inputs?_w(i.inputs,e??[]):void 0;return kh([s,o??"0x"])}const uM={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},fM={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},lM={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Pw extends yt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class hM extends yt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class dM extends yt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const pM={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new dM({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new hM({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Pw({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Pw({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function hg(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(pM);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function gM(t,e={}){typeof e.size<"u"&&Rs(t,{size:e.size});const r=li(t,e);return bf(r,e)}function mM(t,e={}){let r=t;if(typeof e.size<"u"&&(Rs(r,{size:e.size}),r=tg(r)),r.length>1||r[0]>1)throw new sP(r);return!!r[0]}function fo(t,e={}){typeof e.size<"u"&&Rs(t,{size:e.size});const r=li(t,e);return Bc(r,e)}function vM(t,e={}){let r=t;return typeof e.size<"u"&&(Rs(r,{size:e.size}),r=tg(r,{dir:"right"})),new TextDecoder().decode(r)}function bM(t,e){const r=typeof e=="string"?ao(e):e,n=hg(r);if(_n(r)===0&&t.length>0)throw new eg;if(_n(e)&&_n(e)<32)throw new VA({data:typeof e=="string"?e:li(e),params:t,size:_n(e)});let i=0;const s=[];for(let o=0;o48?gM(i,{signed:r}):fo(i,{signed:r}),32]}function SM(t,e,{staticPosition:r}){const n=e.components.length===0||e.components.some(({name:o})=>!o),i=n?[]:{};let s=0;if(Sf(e)){const o=fo(t.readBytes(dg)),a=r+o;for(let u=0;uo.type==="error"&&n===fg(kc(o)));if(!s)throw new Jy(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?bM(s.inputs,$h(r,4)):void 0,errorName:s.name}}const Wc=(t,e,r)=>JSON.stringify(t,(n,i)=>typeof i=="bigint"?i.toString():i,r);function Iw({abiItem:t,args:e,includeFunctionName:r=!0,includeName:n=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${r?t.name:""}(${t.inputs.map((i,s)=>`${n&&i.name?`${i.name}: `:""}${typeof e[s]=="object"?Wc(e[s]):e[s]}`).join(", ")})`}const MM={gwei:9,wei:18},IM={ether:-9,wei:9};function Cw(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}function Tw(t,e="wei"){return Cw(t,MM[e])}function ls(t,e="wei"){return Cw(t,IM[e])}class CM extends yt{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class TM extends yt{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Bh(t){const e=Object.entries(t).map(([n,i])=>i===void 0||i===!1?null:[n,i]).filter(Boolean),r=e.reduce((n,[i])=>Math.max(n,i.length),0);return e.map(([n,i])=>` ${`${n}:`.padEnd(r+1)} ${i}`).join(` +`),{name:"InvalidDefinitionTypeError"})}}class Qy extends yt{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}class ew extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}class tw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function $c(t,{dir:e,size:r=32}={}){return typeof t=="string"?Jo(t,{dir:e,size:r}):nP(t,{dir:e,size:r})}function Jo(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new ew({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function nP(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new ew({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie)throw new oP({givenSize:_n(t),maxSize:e})}function bf(t,e={}){const{signed:r}=e;e.size&&Rs(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<e.toString(16).padStart(2,"0"));function Rh(t,e={}){return typeof t=="number"||typeof t=="bigint"?Pr(t,e):typeof t=="string"?Dh(t,e):typeof t=="boolean"?rw(t,e):li(t,e)}function rw(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(Rs(r,{size:e.size}),$c(r,{size:e.size})):r}function li(t,e={}){let r="";for(let i=0;is||i=oo.zero&&t<=oo.nine)return t-oo.zero;if(t>=oo.A&&t<=oo.F)return t-(oo.A-10);if(t>=oo.a&&t<=oo.f)return t-(oo.a-10)}function ao(t,e={}){let r=t;e.size&&(Rs(r,{size:e.size}),r=$c(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function dP(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Oh(t.outputLen),Oh(t.blockLen)}function Uc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function sw(t,e){Fc(t);const r=e.outputLen;if(t.length>ow&Nh)}:{h:Number(t>>ow&Nh)|0,l:Number(t&Nh)|0}}function gP(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;it<>>32-r,vP=(t,e,r)=>e<>>32-r,bP=(t,e,r)=>e<>>64-r,yP=(t,e,r)=>t<>>64-r,jc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const wP=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),ng=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Ds=(t,e)=>t<<32-e|t>>>e,aw=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,xP=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function cw(t){for(let e=0;ee.toString(16).padStart(2,"0"));function EP(t){Fc(t);let e="";for(let r=0;rt().update(yf(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function PP(t){const e=(n,i)=>t(i).update(yf(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function MP(t=32){if(jc&&typeof jc.getRandomValues=="function")return jc.getRandomValues(new Uint8Array(t));if(jc&&typeof jc.randomBytes=="function")return jc.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const fw=[],lw=[],hw=[],IP=BigInt(0),wf=BigInt(1),CP=BigInt(2),TP=BigInt(7),RP=BigInt(256),DP=BigInt(113);for(let t=0,e=wf,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],fw.push(2*(5*n+r)),lw.push((t+1)*(t+2)/2%64);let i=IP;for(let s=0;s<7;s++)e=(e<>TP)*DP)%RP,e&CP&&(i^=wf<<(wf<r>32?bP(t,e,r):mP(t,e,r),pw=(t,e,r)=>r>32?yP(t,e,r):vP(t,e,r);function gw(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,u=(o+2)%10,l=r[u],d=r[u+1],g=dw(l,d,1)^r[a],y=pw(l,d,1)^r[a+1];for(let A=0;A<50;A+=10)t[o+A]^=g,t[o+A+1]^=y}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=lw[o],u=dw(i,s,a),l=pw(i,s,a),d=fw[o];i=t[d],s=t[d+1],t[d]=u,t[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=OP[n],t[1]^=NP[n]}r.fill(0)}class xf extends ig{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Oh(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=wP(this.state)}keccak(){aw||cw(this.state32),gw(this.state32,this.rounds),aw||cw(this.state32),this.posOut=0,this.pos=0}update(e){Uc(this);const{blockLen:r,state:n}=this;e=yf(e);const i=e.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Oh(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(sw(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new xf(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Xo=(t,e,r)=>uw(()=>new xf(e,t,r)),LP=Xo(6,144,224/8),kP=Xo(6,136,256/8),$P=Xo(6,104,384/8),BP=Xo(6,72,512/8),FP=Xo(1,144,224/8),mw=Xo(1,136,256/8),UP=Xo(1,104,384/8),jP=Xo(1,72,512/8),vw=(t,e,r)=>PP((n={})=>new xf(e,t,n.dkLen===void 0?r:n.dkLen,!0)),qP=vw(31,168,128/8),zP=vw(31,136,256/8),HP=Object.freeze(Object.defineProperty({__proto__:null,Keccak:xf,keccakP:gw,keccak_224:FP,keccak_256:mw,keccak_384:UP,keccak_512:jP,sha3_224:LP,sha3_256:kP,sha3_384:$P,sha3_512:BP,shake128:qP,shake256:zP},Symbol.toStringTag,{value:"Module"}));function _f(t,e){const r=e||"hex",n=mw(Yo(t,{strict:!1})?rg(t):t);return r==="bytes"?n:Rh(n)}const WP=t=>_f(rg(t));function KP(t){return WP(t)}function VP(t){let e=!0,r="",n=0,i="",s=!1;for(let o=0;o{const e=typeof t=="string"?t:HA(t);return VP(e)};function bw(t){return KP(GP(t))}const YP=bw;class qc extends yt{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class Lh extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const sg=new Lh(8192);function Ef(t,e){if(sg.has(`${t}.${e}`))return sg.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=_f(iw(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return sg.set(`${t}.${e}`,s),s}function og(t,e){if(!co(t,{strict:!1}))throw new qc({address:t});return Ef(t,e)}const JP=/^0x[a-fA-F0-9]{40}$/,ag=new Lh(8192);function co(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(ag.has(n))return ag.get(n);const i=JP.test(t)?t.toLowerCase()===t?!0:r?Ef(t)===t:!0:!1;return ag.set(n,i),i}function zc(t){return typeof t[0]=="string"?kh(t):XP(t)}function XP(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function kh(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}function $h(t,e,r,{strict:n}={}){return Yo(t,{strict:!1})?ZP(t,e,r,{strict:n}):xw(t,e,r,{strict:n})}function yw(t,e){if(typeof e=="number"&&e>0&&e>_n(t)-1)throw new Qy({offset:e,position:"start",size:_n(t)})}function ww(t,e,r){if(typeof e=="number"&&typeof r=="number"&&_n(t)!==r-e)throw new Qy({offset:r,position:"end",size:_n(t)})}function xw(t,e,r,{strict:n}={}){yw(t,e);const i=t.slice(e,r);return n&&ww(i,e,r),i}function ZP(t,e,r,{strict:n}={}){yw(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&ww(i,e,r),i}function _w(t,e){if(t.length!==e.length)throw new JA({expectedLength:t.length,givenLength:e.length});const r=QP({params:t,values:e}),n=ug(r);return n.length===0?"0x":n}function QP({params:t,values:e}){const r=[];for(let n=0;n0?zc([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:zc(s.map(({encoded:o})=>o))}}function rM(t,{param:e}){const[,r]=e.type.split("bytes"),n=_n(t);if(!r){let i=t;return n%32!==0&&(i=Jo(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:zc([Jo(Pr(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new YA({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:Jo(t,{dir:"right"})}}function nM(t){if(typeof t!="boolean")throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Jo(rw(t))}}function iM(t,{signed:e}){return{dynamic:!1,encoded:Pr(t,{size:32,signed:e})}}function sM(t){const e=Dh(t),r=Math.ceil(_n(e)/32),n=[];for(let i=0;ii))}}function fg(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const lg=t=>$h(bw(t),0,4);function Ew(t){const{abi:e,args:r=[],name:n}=t,i=Yo(n,{strict:!1}),s=e.filter(a=>i?a.type==="function"?lg(a)===n:a.type==="event"?YP(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((l,d)=>{const g="inputs"in a&&a.inputs[d];return g?hg(l,g):!1})){if(o&&"inputs"in o&&o.inputs){const l=Sw(a.inputs,o.inputs,r);if(l)throw new XA({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||s[0]}function hg(t,e){const r=typeof t,n=e.type;switch(n){case"address":return co(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>hg(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>hg(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Sw(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return Sw(i.components,s.components,r[n]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?co(r[n],{strict:!1}):o.includes("address")&&o.includes("bytes")?co(r[n],{strict:!1}):!1)return o}}function uo(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const Aw="/docs/contract/encodeFunctionData";function aM(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=Ew({abi:e,args:r,name:n});if(!s)throw new Zy(n,{docsPath:Aw});i=s}if(i.type!=="function")throw new Zy(void 0,{docsPath:Aw});return{abi:[i],functionName:lg(kc(i))}}function cM(t){const{args:e}=t,{abi:r,functionName:n}=(()=>{var a;return t.abi.length===1&&((a=t.functionName)!=null&&a.startsWith("0x"))?t:aM(t)})(),i=r[0],s=n,o="inputs"in i&&i.inputs?_w(i.inputs,e??[]):void 0;return kh([s,o??"0x"])}const uM={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},fM={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},lM={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Pw extends yt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class hM extends yt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class dM extends yt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const pM={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new dM({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new hM({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Pw({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Pw({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function dg(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(pM);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function gM(t,e={}){typeof e.size<"u"&&Rs(t,{size:e.size});const r=li(t,e);return bf(r,e)}function mM(t,e={}){let r=t;if(typeof e.size<"u"&&(Rs(r,{size:e.size}),r=tg(r)),r.length>1||r[0]>1)throw new sP(r);return!!r[0]}function fo(t,e={}){typeof e.size<"u"&&Rs(t,{size:e.size});const r=li(t,e);return Bc(r,e)}function vM(t,e={}){let r=t;return typeof e.size<"u"&&(Rs(r,{size:e.size}),r=tg(r,{dir:"right"})),new TextDecoder().decode(r)}function bM(t,e){const r=typeof e=="string"?ao(e):e,n=dg(r);if(_n(r)===0&&t.length>0)throw new eg;if(_n(e)&&_n(e)<32)throw new VA({data:typeof e=="string"?e:li(e),params:t,size:_n(e)});let i=0;const s=[];for(let o=0;o48?gM(i,{signed:r}):fo(i,{signed:r}),32]}function SM(t,e,{staticPosition:r}){const n=e.components.length===0||e.components.some(({name:o})=>!o),i=n?[]:{};let s=0;if(Sf(e)){const o=fo(t.readBytes(pg)),a=r+o;for(let u=0;uo.type==="error"&&n===lg(kc(o)));if(!s)throw new Xy(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?bM(s.inputs,$h(r,4)):void 0,errorName:s.name}}const Wc=(t,e,r)=>JSON.stringify(t,(n,i)=>typeof i=="bigint"?i.toString():i,r);function Iw({abiItem:t,args:e,includeFunctionName:r=!0,includeName:n=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${r?t.name:""}(${t.inputs.map((i,s)=>`${n&&i.name?`${i.name}: `:""}${typeof e[s]=="object"?Wc(e[s]):e[s]}`).join(", ")})`}const MM={gwei:9,wei:18},IM={ether:-9,wei:9};function Cw(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}function Tw(t,e="wei"){return Cw(t,MM[e])}function ls(t,e="wei"){return Cw(t,IM[e])}class CM extends yt{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class TM extends yt{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Bh(t){const e=Object.entries(t).map(([n,i])=>i===void 0||i===!1?null:[n,i]).filter(Boolean),r=e.reduce((n,[i])=>Math.max(n,i.length),0);return e.map(([n,i])=>` ${`${n}:`.padEnd(r+1)} ${i}`).join(` `)}class RM extends yt{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(` -`),{name:"FeeConflictError"})}}class DM extends yt{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Bh(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class OM extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:g,value:y}){var P;const A=Bh({chain:i&&`${i==null?void 0:i.name} (id: ${i==null?void 0:i.id})`,from:r==null?void 0:r.address,to:g,value:typeof y<"u"&&`${Tw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${ls(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${ls(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ls(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",A].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const NM=t=>t,Rw=t=>t;class LM extends yt{constructor(e,{abi:r,args:n,contractAddress:i,docsPath:s,functionName:o,sender:a}){const u=Ew({abi:r,args:n,name:o}),l=u?Iw({abiItem:u,args:n,includeFunctionName:!1,includeName:!1}):void 0,d=u?kc(u,{includeName:!0}):void 0,g=Bh({address:i&&NM(i),function:d,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:s,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],g&&"Contract Call:",g].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=e,this.contractAddress=i,this.functionName=o,this.sender=a}}class kM extends yt{constructor({abi:e,data:r,functionName:n,message:i}){let s,o,a,u;if(r&&r!=="0x")try{o=PM({abi:e,data:r});const{abiItem:d,errorName:g,args:y}=o;if(g==="Error")u=y[0];else if(g==="Panic"){const[A]=y;u=uM[A]}else{const A=d?kc(d,{includeName:!0}):void 0,P=d&&y?Iw({abiItem:d,args:y,includeFunctionName:!1,includeName:!1}):void 0;a=[A?`Error: ${A}`:"",P&&P!=="()"?` ${[...Array((g==null?void 0:g.length)??0).keys()].map(()=>" ").join("")}${P}`:""]}}catch(d){s=d}else i&&(u=i);let l;s instanceof Jy&&(l=s.signature,a=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(u&&u!=="execution reverted"||l?[`The contract function "${n}" reverted with the following ${l?"signature":"reason"}:`,u||l].join(` +`),{name:"FeeConflictError"})}}class DM extends yt{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Bh(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class OM extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:g,value:y}){var P;const A=Bh({chain:i&&`${i==null?void 0:i.name} (id: ${i==null?void 0:i.id})`,from:r==null?void 0:r.address,to:g,value:typeof y<"u"&&`${Tw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${ls(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${ls(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ls(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",A].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const NM=t=>t,Rw=t=>t;class LM extends yt{constructor(e,{abi:r,args:n,contractAddress:i,docsPath:s,functionName:o,sender:a}){const u=Ew({abi:r,args:n,name:o}),l=u?Iw({abiItem:u,args:n,includeFunctionName:!1,includeName:!1}):void 0,d=u?kc(u,{includeName:!0}):void 0,g=Bh({address:i&&NM(i),function:d,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:s,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],g&&"Contract Call:",g].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=e,this.contractAddress=i,this.functionName=o,this.sender=a}}class kM extends yt{constructor({abi:e,data:r,functionName:n,message:i}){let s,o,a,u;if(r&&r!=="0x")try{o=PM({abi:e,data:r});const{abiItem:d,errorName:g,args:y}=o;if(g==="Error")u=y[0];else if(g==="Panic"){const[A]=y;u=uM[A]}else{const A=d?kc(d,{includeName:!0}):void 0,P=d&&y?Iw({abiItem:d,args:y,includeFunctionName:!1,includeName:!1}):void 0;a=[A?`Error: ${A}`:"",P&&P!=="()"?` ${[...Array((g==null?void 0:g.length)??0).keys()].map(()=>" ").join("")}${P}`:""]}}catch(d){s=d}else i&&(u=i);let l;s instanceof Xy&&(l=s.signature,a=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(u&&u!=="execution reverted"||l?[`The contract function "${n}" reverted with the following ${l?"signature":"reason"}:`,u||l].join(` `):`The contract function "${n}" reverted.`,{cause:s,metaMessages:a,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.reason=u,this.signature=l}}class $M extends yt{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class BM extends yt{constructor({data:e,message:r}){super(r||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}class Dw extends yt{constructor({body:e,cause:r,details:n,headers:i,status:s,url:o}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${Rw(o)}`,e&&`Request body: ${Wc(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=i,this.status=s,this.url=o}}class FM extends yt{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${Rw(n)}`,`Request body: ${Wc(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code}}const UM=-1;class hi extends yt{constructor(e,{code:r,docsPath:n,metaMessages:i,name:s,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:i||(e==null?void 0:e.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||e.name,this.code=e instanceof FM?e.code:r??UM}}class Kc extends hi{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class Af extends hi{constructor(e){super(e,{code:Af.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Af,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Pf extends hi{constructor(e){super(e,{code:Pf.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Pf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Mf extends hi{constructor(e,{method:r}={}){super(e,{code:Mf.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(Mf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class If extends hi{constructor(e){super(e,{code:If.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` `)})}}Object.defineProperty(If,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class ka extends hi{constructor(e){super(e,{code:ka.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(ka,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Cf extends hi{constructor(e){super(e,{code:Cf.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` -`)})}}Object.defineProperty(Cf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Tf extends hi{constructor(e){super(e,{code:Tf.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Tf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Rf extends hi{constructor(e){super(e,{code:Rf.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Rf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Df extends hi{constructor(e){super(e,{code:Df.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Df,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Of extends hi{constructor(e,{method:r}={}){super(e,{code:Of.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not implemented.`})}}Object.defineProperty(Of,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Vc extends hi{constructor(e){super(e,{code:Vc.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Vc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Nf extends hi{constructor(e){super(e,{code:Nf.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Nf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Gc extends Kc{constructor(e){super(e,{code:Gc.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Gc,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Lf extends Kc{constructor(e){super(e,{code:Lf.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Lf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class kf extends Kc{constructor(e,{method:r}={}){super(e,{code:kf.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(kf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class $f extends Kc{constructor(e){super(e,{code:$f.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty($f,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Bf extends Kc{constructor(e){super(e,{code:Bf.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Bf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Ff extends Kc{constructor(e){super(e,{code:Ff.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Ff,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class jM extends hi{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const qM=3;function zM(t,{abi:e,address:r,args:n,docsPath:i,functionName:s,sender:o}){const{code:a,data:u,message:l,shortMessage:d}=t instanceof BM?t:t instanceof yt?t.walk(y=>"data"in y)||t.walk():{},g=t instanceof eg?new $M({functionName:s}):[qM,ka.code].includes(a)&&(u||l||d)?new kM({abi:e,data:typeof u=="object"?u.data:u,functionName:s,message:d??l}):t;return new LM(g,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:o})}function HM(t){const e=_f(`0x${t.substring(4)}`).substring(26);return Ef(`0x${e}`)}async function WM({hash:t,signature:e}){const r=Yo(t)?t:Rh(t),{secp256k1:n}=await Promise.resolve().then(()=>TC);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:d,v:g,yParity:y}=e,A=Number(y??g),P=Ow(A);return new n.Signature(bf(l),bf(d)).addRecoveryBit(P)}const o=Yo(e)?e:Rh(e),a=Bc(`0x${o.slice(130)}`),u=Ow(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Ow(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function KM({hash:t,signature:e}){return HM(await WM({hash:t,signature:e}))}function VM(t,e="hex"){const r=Nw(t),n=hg(new Uint8Array(r.length));return r.encode(n),e==="hex"?li(n.bytes):n.bytes}function Nw(t){return Array.isArray(t)?GM(t.map(e=>Nw(e))):YM(t)}function GM(t){const e=t.reduce((i,s)=>i+s.length,0),r=Lw(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function YM(t){const e=typeof t=="string"?ao(t):t,r=Lw(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function Lw(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new yt("Length is too large.")}function JM(t){const{chainId:e,contractAddress:r,nonce:n,to:i}=t,s=_f(kh(["0x05",VM([e?Pr(e):"0x",r,n?Pr(n):"0x"])]));return i==="bytes"?ao(s):s}async function kw(t){const{authorization:e,signature:r}=t;return KM({hash:JM(e),signature:r??e})}class XM extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:g,value:y}){var P;const A=Bh({from:r==null?void 0:r.address,to:g,value:typeof y<"u"&&`${Tw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${ls(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${ls(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ls(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",A].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class Yc extends yt{constructor({cause:e,message:r}={}){var i;const n=(i=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(Yc,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Yc,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Fh extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${ls(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(Fh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class pg extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${ls(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(pg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class gg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(gg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class mg extends yt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` -`),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(mg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class vg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(vg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class bg extends yt{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` -`),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(bg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class yg extends yt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(yg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class wg extends yt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(wg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class xg extends yt{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(xg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Uh extends yt{constructor({cause:e,maxPriorityFeePerGas:r,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${r?` = ${ls(r)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${ls(n)} gwei`:""}).`].join(` -`),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(Uh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class _g extends yt{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function $w(t,e){const r=(t.details||"").toLowerCase(),n=t instanceof yt?t.walk(i=>(i==null?void 0:i.code)===Yc.code):t;return n instanceof yt?new Yc({cause:t,message:n.details}):Yc.nodeMessage.test(r)?new Yc({cause:t,message:t.details}):Fh.nodeMessage.test(r)?new Fh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):pg.nodeMessage.test(r)?new pg({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):gg.nodeMessage.test(r)?new gg({cause:t,nonce:e==null?void 0:e.nonce}):mg.nodeMessage.test(r)?new mg({cause:t,nonce:e==null?void 0:e.nonce}):vg.nodeMessage.test(r)?new vg({cause:t,nonce:e==null?void 0:e.nonce}):bg.nodeMessage.test(r)?new bg({cause:t}):yg.nodeMessage.test(r)?new yg({cause:t,gas:e==null?void 0:e.gas}):wg.nodeMessage.test(r)?new wg({cause:t,gas:e==null?void 0:e.gas}):xg.nodeMessage.test(r)?new xg({cause:t}):Uh.nodeMessage.test(r)?new Uh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new _g({cause:t})}function ZM(t,{docsPath:e,...r}){const n=(()=>{const i=$w(t,r);return i instanceof _g?t:i})();return new XM(n,{docsPath:e,...r})}function Bw(t,{format:e}){if(!e)return{};const r={};function n(s){const o=Object.keys(s);for(const a of o)a in t&&(r[a]=t[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}const i=e(t||{});return n(i),r}const QM={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Eg(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=eI(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(r=>li(r)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=Pr(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=Pr(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=Pr(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=Pr(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=Pr(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=Pr(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=QM[t.type]),typeof t.value<"u"&&(e.value=Pr(t.value)),e}function eI(t){return t.map(e=>({address:e.contractAddress,r:e.r,s:e.s,chainId:Pr(e.chainId),nonce:Pr(e.nonce),...typeof e.yParity<"u"?{yParity:Pr(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:Pr(e.v)}:{}}))}function Fw(t){if(!(!t||t.length===0))return t.reduce((e,{slot:r,value:n})=>{if(r.length!==66)throw new ew({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new ew({size:n.length,targetSize:66,type:"hex"});return e[r]=n,e},{})}function tI(t){const{balance:e,nonce:r,state:n,stateDiff:i,code:s}=t,o={};if(s!==void 0&&(o.code=s),e!==void 0&&(o.balance=Pr(e)),r!==void 0&&(o.nonce=Pr(r)),n!==void 0&&(o.state=Fw(n)),i!==void 0){if(o.state)throw new TM;o.stateDiff=Fw(i)}return o}function rI(t){if(!t)return;const e={};for(const{address:r,...n}of t){if(!co(r,{strict:!1}))throw new qc({address:r});if(e[r])throw new CM({address:r});e[r]=tI(n)}return e}const nI=2n**256n-1n;function jh(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?uo(e):void 0;if(o&&!co(o.address))throw new qc({address:o.address});if(s&&!co(s))throw new qc({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new RM;if(n&&n>nI)throw new Fh({maxFeePerGas:n});if(i&&n&&i>n)throw new Uh({maxFeePerGas:n,maxPriorityFeePerGas:i})}class iI extends yt{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Sg extends yt{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class sI extends yt{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${ls(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class oI extends yt{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}const aI={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function cI(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?Bc(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?Bc(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?aI[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=uI(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function uI(t){return t.map(e=>({contractAddress:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function fI(t){const e=(t.transactions??[]).map(r=>typeof r=="string"?r:cI(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function qh(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){var d,g,y;const s=n??"latest",o=i??!1,a=r!==void 0?Pr(r):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,o]},{dedupe:!0}):u=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]},{dedupe:!!a}),!u)throw new oI({blockHash:e,blockNumber:r});return(((y=(g=(d=t.chain)==null?void 0:d.formatters)==null?void 0:g.block)==null?void 0:y.format)||fI)(u)}async function Uw(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function lI(t,e){var s,o;const{block:r,chain:n=t.chain,request:i}=e||{};try{const a=((s=n==null?void 0:n.fees)==null?void 0:s.maxPriorityFeePerGas)??((o=n==null?void 0:n.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=r||await fi(t,qh,"getBlock")({}),d=await a({block:l,client:t,request:i});if(d===null)throw new Error;return d}if(typeof a<"u")return a;const u=await t.request({method:"eth_maxPriorityFeePerGas"});return bf(u)}catch{const[a,u]=await Promise.all([r?Promise.resolve(r):fi(t,qh,"getBlock")({}),fi(t,Uw,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new Sg;const l=u-a.baseFeePerGas;return l<0n?0n:l}}async function jw(t,e){var y,A;const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>{var P,N;return typeof((P=n==null?void 0:n.fees)==null?void 0:P.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):((N=n==null?void 0:n.fees)==null?void 0:N.baseFeeMultiplier)??1.2})();if(o<1)throw new iI;const u=10**(((y=o.toString().split(".")[1])==null?void 0:y.length)??0),l=P=>P*BigInt(Math.ceil(o*u))/BigInt(u),d=r||await fi(t,qh,"getBlock")({});if(typeof((A=n==null?void 0:n.fees)==null?void 0:A.estimateFeesPerGas)=="function"){const P=await n.fees.estimateFeesPerGas({block:r,client:t,multiply:l,request:i,type:s});if(P!==null)return P}if(s==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new Sg;const P=typeof(i==null?void 0:i.maxPriorityFeePerGas)=="bigint"?i.maxPriorityFeePerGas:await lI(t,{block:d,chain:n,request:i}),N=l(d.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??N+P,maxPriorityFeePerGas:P}}return{gasPrice:(i==null?void 0:i.gasPrice)??l(await fi(t,Uw,"getGasPrice")({}))}}async function hI(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,n?Pr(n):r]},{dedupe:!!n});return Bc(i)}function qw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(s=>ao(s)):t.blobs,i=[];for(const s of n)i.push(Uint8Array.from(e.blobToKzgCommitment(s)));return r==="bytes"?i:i.map(s=>li(s))}function zw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>ao(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>ao(o)):t.commitments,s=[];for(let o=0;oli(o))}function dI(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),u=n?4:0,l=n?0:4;t.setUint32(e+u,o,n),t.setUint32(e+l,a,n)}const pI=(t,e,r)=>t&e^~t&r,gI=(t,e,r)=>t&e^t&r^e&r;class mI extends ig{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ng(this.buffer)}update(e){Uc(this);const{view:r,buffer:n,blockLen:i}=this;e=yf(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let g=o;gd.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g>>3,N=Ds(A,17)^Ds(A,19)^A>>>10;Qo[g]=N+Qo[g-7]+P+Qo[g-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:u,G:l,H:d}=this;for(let g=0;g<64;g++){const y=Ds(a,6)^Ds(a,11)^Ds(a,25),A=d+y+pI(a,u,l)+vI[g]+Qo[g]|0,N=(Ds(n,2)^Ds(n,13)^Ds(n,22))+gI(n,i,s)|0;d=l,l=u,u=a,a=o+A|0,o=s,s=i,i=n,n=A+N|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(n,i,s,o,a,u,l,d)}roundClean(){Qo.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Ag=cw(()=>new bI);function yI(t,e){return Ag(Yo(t,{strict:!1})?rg(t):t)}function wI(t){const{commitment:e,version:r=1}=t,n=t.to??(typeof e=="string"?"hex":"bytes"),i=yI(e);return i.set([r],0),n==="bytes"?i:li(i)}function xI(t){const{commitments:e,version:r}=t,n=t.to??(typeof e[0]=="string"?"hex":"bytes"),i=[];for(const s of e)i.push(wI({commitment:s,to:n,version:r}));return i}const Hw=6,Ww=32,Pg=4096,Kw=Ww*Pg,Vw=Kw*Hw-1-1*Pg*Hw;class _I extends yt{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class EI extends yt{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function SI(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),r=typeof t.data=="string"?ao(t.data):t.data,n=_n(r);if(!n)throw new EI;if(n>Vw)throw new _I({maxSize:Vw,size:n});const i=[];let s=!0,o=0;for(;s;){const a=hg(new Uint8Array(Kw));let u=0;for(;ua.bytes):i.map(a=>li(a.bytes))}function AI(t){const{data:e,kzg:r,to:n}=t,i=t.blobs??SI({data:e,to:n}),s=t.commitments??qw({blobs:i,kzg:r,to:n}),o=t.proofs??zw({blobs:i,commitments:s,kzg:r,to:n}),a=[];for(let u=0;u"u"&&g)if(u){const k=await D();y.nonce=await u.consume({address:g.address,chainId:k,client:t})}else y.nonce=await fi(t,hI,"getTransactionCount")({address:g.address,blockTag:"pending"});if((l.includes("fees")||l.includes("type"))&&typeof d>"u")try{y.type=PI(y)}catch{const k=await P();y.type=typeof(k==null?void 0:k.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(l.includes("fees"))if(y.type!=="legacy"&&y.type!=="eip2930"){if(typeof y.maxFeePerGas>"u"||typeof y.maxPriorityFeePerGas>"u"){const k=await P(),{maxFeePerGas:$,maxPriorityFeePerGas:q}=await jw(t,{block:k,chain:i,request:y});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(y.gas=await fi(t,II,"estimateGas")({...y,account:g&&{address:g.address,type:"json-rpc"}})),jh(y),delete y.parameters,y}async function MI(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=r?Pr(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function II(t,e){var i,s,o;const{account:r=t.account}=e,n=r?uo(r):void 0;try{let f=function(v){const{block:x,request:_,rpcStateOverride:S}=v;return t.request({method:"eth_estimateGas",params:S?[_,x??"latest",S]:x?[_,x]:[_]})};const{accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,blockNumber:g,blockTag:y,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:$,nonce:q,value:U,stateOverride:K,...J}=await Mg(t,{...e,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),z=(g?Pr(g):void 0)||y,ue=rI(K),_e=await(async()=>{if(J.to)return J.to;if(u&&u.length>0)return await kw({authorization:u[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`")})})();jh(e);const G=(o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:o.format,m=(G||Eg)({...Bw(J,{format:G}),from:n==null?void 0:n.address,accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:$,nonce:q,to:_e,value:U});let p=BigInt(await f({block:z,request:m,rpcStateOverride:ue}));if(u){const v=await MI(t,{address:m.from}),x=await Promise.all(u.map(async _=>{const{contractAddress:S}=_,b=await f({block:z,request:{authorizationList:void 0,data:A,from:n==null?void 0:n.address,to:S,value:Pr(v)},rpcStateOverride:ue}).catch(()=>100000n);return 2n*BigInt(b)}));p+=x.reduce((_,S)=>_+S,0n)}return p}catch(a){throw ZM(a,{...e,account:n,chain:t.chain})}}class CI extends yt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class TI extends yt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` -`),{name:"ChainNotFoundError"})}}const Ig="/docs/contract/encodeDeployData";function RI(t){const{abi:e,args:r,bytecode:n}=t;if(!r||r.length===0)return n;const i=e.find(o=>"type"in o&&o.type==="constructor");if(!i)throw new KA({docsPath:Ig});if(!("inputs"in i))throw new Yy({docsPath:Ig});if(!i.inputs||i.inputs.length===0)throw new Yy({docsPath:Ig});const s=_w(i.inputs,r);return kh([n,s])}async function DI(t){return new Promise(e=>setTimeout(e,t))}class Uf extends yt{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` -`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class Cg extends yt{constructor({docsPath:e,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:e,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function Yw({chain:t,currentChainId:e}){if(!t)throw new TI;if(e!==t.id)throw new CI({chain:t,currentChainId:e})}function OI(t,{docsPath:e,...r}){const n=(()=>{const i=$w(t,r);return i instanceof _g?t:i})();return new OM(n,{docsPath:e,...r})}async function Jw(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const Tg=new Lh(128);async function Rg(t,e){var k,$,q,U;const{account:r=t.account,chain:n=t.chain,accessList:i,authorizationList:s,blobs:o,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,value:P,...N}=e;if(typeof r>"u")throw new Uf({docsPath:"/docs/actions/wallet/sendTransaction"});const D=r?uo(r):null;try{jh(e);const K=await(async()=>{if(e.to)return e.to;if(s&&s.length>0)return await kw({authorization:s[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`.")})})();if((D==null?void 0:D.type)==="json-rpc"||D===null){let J;n!==null&&(J=await fi(t,zh,"getChainId")({}),Yw({currentChainId:J,chain:n}));const T=(q=($=(k=t.chain)==null?void 0:k.formatters)==null?void 0:$.transactionRequest)==null?void 0:q.format,ue=(T||Eg)({...Bw(N,{format:T}),accessList:i,authorizationList:s,blobs:o,chainId:J,data:a,from:D==null?void 0:D.address,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,to:K,value:P}),_e=Tg.get(t.uid),G=_e?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:G,params:[ue]},{retryCount:0})}catch(E){if(_e===!1)throw E;const m=E;if(m.name==="InvalidInputRpcError"||m.name==="InvalidParamsRpcError"||m.name==="MethodNotFoundRpcError"||m.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[ue]},{retryCount:0}).then(f=>(Tg.set(t.uid,!0),f)).catch(f=>{const p=f;throw p.name==="MethodNotFoundRpcError"||p.name==="MethodNotSupportedRpcError"?(Tg.set(t.uid,!1),m):p});throw m}}if((D==null?void 0:D.type)==="local"){const J=await fi(t,Mg,"prepareTransactionRequest")({account:D,accessList:i,authorizationList:s,blobs:o,chain:n,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,nonceManager:D.nonceManager,parameters:[...Gw,"sidecars"],value:P,...N,to:K}),T=(U=n==null?void 0:n.serializers)==null?void 0:U.transaction,z=await D.signTransaction(J,{serializer:T});return await fi(t,Jw,"sendRawTransaction")({serializedTransaction:z})}throw(D==null?void 0:D.type)==="smart"?new Cg({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Cg({docsPath:"/docs/actions/wallet/sendTransaction",type:D==null?void 0:D.type})}catch(K){throw K instanceof Cg?K:OI(K,{...e,account:D,chain:e.chain||void 0})}}async function NI(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:o,functionName:a,...u}=e;if(typeof n>"u")throw new Uf({docsPath:"/docs/contract/writeContract"});const l=n?uo(n):null,d=cM({abi:r,args:s,functionName:a});try{return await fi(t,Rg,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:i,account:l,...u})}catch(g){throw zM(g,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:a,sender:l==null?void 0:l.address})}}async function LI(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:Pr(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}const Dg=256;let Hh=Dg,Wh;function Xw(t=11){if(!Wh||Hh+t>Dg*2){Wh="",Hh=0;for(let e=0;e{const $=k(D);for(const U in P)delete $[U];const q={...D,...$};return Object.assign(q,{extend:N(q)})}}return Object.assign(P,{extend:N(P)})}const Kh=new Lh(8192);function $I(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(Kh.get(r))return Kh.get(r);const n=t().finally(()=>Kh.delete(r));return Kh.set(r,n),n}function BI(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const u=async({error:l})=>{const d=typeof e=="function"?e({count:a,error:l}):e;d&&await DI(d),o({count:a+1})};try{const l=await t();i(l)}catch(l){if(a{const{dedupe:i=!1,retryDelay:s=150,retryCount:o=3,uid:a}={...e,...n},u=i?_f(Dh(`${a}.${Wc(r)}`)):void 0;return $I(()=>BI(async()=>{try{return await t(r)}catch(l){const d=l;switch(d.code){case Af.code:throw new Af(d);case Pf.code:throw new Pf(d);case Mf.code:throw new Mf(d,{method:r.method});case If.code:throw new If(d);case ka.code:throw new ka(d);case Cf.code:throw new Cf(d);case Tf.code:throw new Tf(d);case Rf.code:throw new Rf(d);case Df.code:throw new Df(d);case Of.code:throw new Of(d,{method:r.method});case Vc.code:throw new Vc(d);case Nf.code:throw new Nf(d);case Gc.code:throw new Gc(d);case Lf.code:throw new Lf(d);case kf.code:throw new kf(d);case $f.code:throw new $f(d);case Bf.code:throw new Bf(d);case Ff.code:throw new Ff(d);case 5e3:throw new Gc(d);default:throw l instanceof yt?l:new jM(d)}}},{delay:({count:l,error:d})=>{var g;if(d&&d instanceof Dw){const y=(g=d==null?void 0:d.headers)==null?void 0:g.get("Retry-After");if(y!=null&&y.match(/\d/))return Number.parseInt(y)*1e3}return~~(1<UI(l)}),{enabled:i,id:u})}}function UI(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Vc.code||t.code===ka.code:t instanceof Dw&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function jI({key:t,name:e,request:r,retryCount:n=3,retryDelay:i=150,timeout:s,type:o},a){const u=Xw();return{config:{key:t,name:e,request:r,retryCount:n,retryDelay:i,timeout:s,type:o},request:FI(r,{retryCount:n,retryDelay:i,uid:u}),value:a}}function qI(t,e={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=e;return({retryCount:s})=>jI({key:r,name:n,request:t.request.bind(t),retryCount:e.retryCount??s,retryDelay:i,type:"custom"})}const zI=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,HI=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;class WI extends yt{constructor({domain:e}){super(`Invalid domain "${Wc(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class KI extends yt{constructor({primaryType:e,types:r}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class VI extends yt{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function GI(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(u,l)=>{const d={...l};for(const g of u){const{name:y,type:A}=g;A==="address"&&(d[y]=d[y].toLowerCase())}return d},o=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return Wc({domain:o,message:a,primaryType:n,types:i})}function YI(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(o,a)=>{for(const u of o){const{name:l,type:d}=u,g=a[l],y=d.match(HI);if(y&&(typeof g=="number"||typeof g=="bigint")){const[N,D,k]=y;Pr(g,{signed:D==="int",size:Number.parseInt(k)/8})}if(d==="address"&&typeof g=="string"&&!co(g))throw new qc({address:g});const A=d.match(zI);if(A){const[N,D]=A;if(D&&_n(g)!==Number.parseInt(D))throw new ZA({expectedSize:Number.parseInt(D),givenSize:_n(g)})}const P=i[d];P&&(XI(d),s(P,g))}};if(i.EIP712Domain&&e){if(typeof e!="object")throw new WI({domain:e});s(i.EIP712Domain,e)}if(n!=="EIP712Domain")if(i[n])s(i[n],r);else throw new KI({primaryType:n,types:i})}function JI({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},typeof(t==null?void 0:t.chainId)=="number"&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function XI(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new VI({type:t})}let Zw=class extends ig{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,dP(e);const n=yf(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew Zw(t,e).update(r).digest();Qw.create=(t,e)=>new Zw(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Og=BigInt(0),Vh=BigInt(1),ZI=BigInt(2);function $a(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function jf(t){if(!$a(t))throw new Error("Uint8Array expected")}function Jc(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)}const QI=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Xc(t){jf(t);let e="";for(let r=0;r=lo._0&&t<=lo._9)return t-lo._0;if(t>=lo._A&&t<=lo._F)return t-(lo._A-10);if(t>=lo._a&&t<=lo._f)return t-(lo._a-10)}function Qc(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;itypeof t=="bigint"&&Og<=t;function Gh(t,e,r){return $g(t)&&$g(e)&&$g(r)&&e<=t&&tOg;t>>=Vh,e+=1);return e}function nC(t,e){return t>>BigInt(e)&Vh}function iC(t,e,r){return t|(r?Vh:Og)<(ZI<new Uint8Array(t),r2=t=>Uint8Array.from(t);function n2(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=Fg(t),i=Fg(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...g)=>r(i,n,...g),u=(g=Fg())=>{i=a(r2([0]),g),n=a(),g.length!==0&&(i=a(r2([1]),g),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let g=0;const y=[];for(;g{o(),u(g);let A;for(;!(A=y(l()));)u();return o(),A}}const sC={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||$a(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function zf(t,e,r={}){const n=(i,s,o)=>{const a=sC[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const u=t[i];if(!(o&&u===void 0)&&!a(u,t))throw new Error(`Invalid param ${String(i)}=${u} (${typeof u}), expected ${s}`)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const oC=()=>{throw new Error("not implemented")};function Ug(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}const aC=Object.freeze(Object.defineProperty({__proto__:null,aInRange:Fa,abool:Jc,abytes:jf,bitGet:nC,bitLen:t2,bitMask:Bg,bitSet:iC,bytesToHex:Xc,bytesToNumberBE:Ba,bytesToNumberLE:Lg,concatBytes:qf,createHmacDrbg:n2,ensureBytes:hs,equalBytes:tC,hexToBytes:Qc,hexToNumber:Ng,inRange:Gh,isBytes:$a,memoized:Ug,notImplemented:oC,numberToBytesBE:eu,numberToBytesLE:kg,numberToHexUnpadded:Zc,numberToVarBytesBE:eC,utf8ToBytes:rC,validateObject:zf},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mn=BigInt(0),sn=BigInt(1),Ua=BigInt(2),cC=BigInt(3),jg=BigInt(4),i2=BigInt(5),s2=BigInt(8);BigInt(9),BigInt(16);function di(t,e){const r=t%e;return r>=Mn?r:e+r}function uC(t,e,r){if(r<=Mn||e 0");if(r===sn)return Mn;let n=sn;for(;e>Mn;)e&sn&&(n=n*t%r),t=t*t%r,e>>=sn;return n}function ji(t,e,r){let n=t;for(;e-- >Mn;)n*=n,n%=r;return n}function qg(t,e){if(t===Mn||e<=Mn)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=di(t,e),n=e,i=Mn,s=sn;for(;r!==Mn;){const a=n/r,u=n%r,l=i-s*a;n=r,r=u,i=s,s=l}if(n!==sn)throw new Error("invert: does not exist");return di(i,e)}function fC(t){const e=(t-sn)/Ua;let r,n,i;for(r=t-sn,n=0;r%Ua===Mn;r/=Ua,n++);for(i=Ua;i(n[i]="function",n),e);return zf(t,r)}function pC(t,e,r){if(r 0");if(r===Mn)return t.ONE;if(r===sn)return e;let n=t.ONE,i=e;for(;r>Mn;)r&sn&&(n=t.mul(n,i)),i=t.sqr(i),r>>=sn;return n}function gC(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function o2(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function a2(t,e,r=!1,n={}){if(t<=Mn)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=o2(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=lC(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:Bg(i),ZERO:Mn,ONE:sn,create:u=>di(u,t),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return Mn<=u&&uu===Mn,isOdd:u=>(u&sn)===sn,neg:u=>di(-u,t),eql:(u,l)=>u===l,sqr:u=>di(u*u,t),add:(u,l)=>di(u+l,t),sub:(u,l)=>di(u-l,t),mul:(u,l)=>di(u*l,t),pow:(u,l)=>pC(a,u,l),div:(u,l)=>di(u*qg(l,t),t),sqrN:u=>u*u,addN:(u,l)=>u+l,subN:(u,l)=>u-l,mulN:(u,l)=>u*l,inv:u=>qg(u,t),sqrt:n.sqrt||(u=>o(a,u)),invertBatch:u=>gC(a,u),cmov:(u,l,d)=>d?l:u,toBytes:u=>r?kg(u,s):eu(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return r?Lg(u):Ba(u)}});return Object.freeze(a)}function c2(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function u2(t){const e=c2(t);return e+Math.ceil(e/2)}function mC(t,e,r=!1){const n=t.length,i=c2(e),s=u2(e);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?Ba(t):Lg(t),a=di(o,e-sn)+sn;return r?kg(a,i):eu(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const vC=BigInt(0),zg=BigInt(1),Hg=new WeakMap,f2=new WeakMap;function bC(t,e){const r=(s,o)=>{const a=o.negate();return s?a:o},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>e)throw new Error(`Wrong window size=${s}, should be [1..${e}]`)},i=s=>{n(s);const o=Math.ceil(e/s)+1,a=2**(s-1);return{windows:o,windowSize:a}};return{constTimeNegate:r,unsafeLadder(s,o){let a=t.ZERO,u=s;for(;o>vC;)o&zg&&(a=a.add(u)),u=u.double(),o>>=zg;return a},precomputeWindow(s,o){const{windows:a,windowSize:u}=i(o),l=[];let d=s,g=d;for(let y=0;y>=P,k>l&&(k-=A,a+=zg);const $=D,q=D+Math.abs(k)-1,U=N%2!==0,K=k<0;k===0?g=g.add(r(U,o[$])):d=d.add(r(K,o[q]))}return{p:d,f:g}},wNAFCached(s,o,a){const u=f2.get(s)||1;let l=Hg.get(s);return l||(l=this.precomputeWindow(s,u),u!==1&&Hg.set(s,a(l))),this.wNAF(u,l,o)},setWindowSize(s,o){n(o),f2.set(s,o),Hg.delete(s)}}}function yC(t,e,r,n){if(!Array.isArray(r)||!Array.isArray(n)||n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((d,g)=>{if(!e.isValid(d))throw new Error(`wrong scalar at index ${g}`)}),r.forEach((d,g)=>{if(!(d instanceof t))throw new Error(`wrong point at index ${g}`)});const i=t2(BigInt(r.length)),s=i>12?i-3:i>4?i-2:i?2:1,o=(1<=0;d-=s){a.fill(t.ZERO);for(let y=0;y>BigInt(d)&BigInt(o));a[P]=a[P].add(r[y])}let g=t.ZERO;for(let y=a.length-1,A=t.ZERO;y>0;y--)A=A.add(a[y]),g=g.add(A);if(l=l.add(g),d!==0)for(let y=0;y{const{Err:r}=ho;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=Zc(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?Zc(i.length/2|128):"";return`${Zc(t)}${s}${i}${e}`},decode(t,e){const{Err:r}=ho;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");const l=e.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const d of l)o=o<<8|d;if(n+=u,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=ho;if(t{const $=D.toAffine();return qf(Uint8Array.from([4]),r.toBytes($.x),r.toBytes($.y))}),s=e.fromBytes||(N=>{const D=N.subarray(1),k=r.fromBytes(D.subarray(0,r.BYTES)),$=r.fromBytes(D.subarray(r.BYTES,2*r.BYTES));return{x:k,y:$}});function o(N){const{a:D,b:k}=e,$=r.sqr(N),q=r.mul($,N);return r.add(r.add(q,r.mul(N,D)),k)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(N){return Gh(N,In,e.n)}function u(N){const{allowedPrivateKeyLengths:D,nByteLength:k,wrapPrivateKey:$,n:q}=e;if(D&&typeof N!="bigint"){if($a(N)&&(N=Xc(N)),typeof N!="string"||!D.includes(N.length))throw new Error("Invalid key");N=N.padStart(k*2,"0")}let U;try{U=typeof N=="bigint"?N:Ba(hs("private key",N,k))}catch{throw new Error(`private key must be ${k} bytes, hex or bigint, not ${typeof N}`)}return $&&(U=di(U,q)),Fa("private key",U,In,q),U}function l(N){if(!(N instanceof y))throw new Error("ProjectivePoint expected")}const d=Ug((N,D)=>{const{px:k,py:$,pz:q}=N;if(r.eql(q,r.ONE))return{x:k,y:$};const U=N.is0();D==null&&(D=U?r.ONE:r.inv(q));const K=r.mul(k,D),J=r.mul($,D),T=r.mul(q,D);if(U)return{x:r.ZERO,y:r.ZERO};if(!r.eql(T,r.ONE))throw new Error("invZ was invalid");return{x:K,y:J}}),g=Ug(N=>{if(N.is0()){if(e.allowInfinityPoint&&!r.is0(N.py))return;throw new Error("bad point: ZERO")}const{x:D,y:k}=N.toAffine();if(!r.isValid(D)||!r.isValid(k))throw new Error("bad point: x or y not FE");const $=r.sqr(k),q=o(D);if(!r.eql($,q))throw new Error("bad point: equation left != right");if(!N.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(D,k,$){if(this.px=D,this.py=k,this.pz=$,D==null||!r.isValid(D))throw new Error("x required");if(k==null||!r.isValid(k))throw new Error("y required");if($==null||!r.isValid($))throw new Error("z required");Object.freeze(this)}static fromAffine(D){const{x:k,y:$}=D||{};if(!D||!r.isValid(k)||!r.isValid($))throw new Error("invalid affine point");if(D instanceof y)throw new Error("projective point not allowed");const q=U=>r.eql(U,r.ZERO);return q(k)&&q($)?y.ZERO:new y(k,$,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(D){const k=r.invertBatch(D.map($=>$.pz));return D.map(($,q)=>$.toAffine(k[q])).map(y.fromAffine)}static fromHex(D){const k=y.fromAffine(s(hs("pointHex",D)));return k.assertValidity(),k}static fromPrivateKey(D){return y.BASE.multiply(u(D))}static msm(D,k){return yC(y,n,D,k)}_setWindowSize(D){P.setWindowSize(this,D)}assertValidity(){g(this)}hasEvenY(){const{y:D}=this.toAffine();if(r.isOdd)return!r.isOdd(D);throw new Error("Field doesn't support isOdd")}equals(D){l(D);const{px:k,py:$,pz:q}=this,{px:U,py:K,pz:J}=D,T=r.eql(r.mul(k,J),r.mul(U,q)),z=r.eql(r.mul($,J),r.mul(K,q));return T&&z}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){const{a:D,b:k}=e,$=r.mul(k,d2),{px:q,py:U,pz:K}=this;let J=r.ZERO,T=r.ZERO,z=r.ZERO,ue=r.mul(q,q),_e=r.mul(U,U),G=r.mul(K,K),E=r.mul(q,U);return E=r.add(E,E),z=r.mul(q,K),z=r.add(z,z),J=r.mul(D,z),T=r.mul($,G),T=r.add(J,T),J=r.sub(_e,T),T=r.add(_e,T),T=r.mul(J,T),J=r.mul(E,J),z=r.mul($,z),G=r.mul(D,G),E=r.sub(ue,G),E=r.mul(D,E),E=r.add(E,z),z=r.add(ue,ue),ue=r.add(z,ue),ue=r.add(ue,G),ue=r.mul(ue,E),T=r.add(T,ue),G=r.mul(U,K),G=r.add(G,G),ue=r.mul(G,E),J=r.sub(J,ue),z=r.mul(G,_e),z=r.add(z,z),z=r.add(z,z),new y(J,T,z)}add(D){l(D);const{px:k,py:$,pz:q}=this,{px:U,py:K,pz:J}=D;let T=r.ZERO,z=r.ZERO,ue=r.ZERO;const _e=e.a,G=r.mul(e.b,d2);let E=r.mul(k,U),m=r.mul($,K),f=r.mul(q,J),p=r.add(k,$),v=r.add(U,K);p=r.mul(p,v),v=r.add(E,m),p=r.sub(p,v),v=r.add(k,q);let x=r.add(U,J);return v=r.mul(v,x),x=r.add(E,f),v=r.sub(v,x),x=r.add($,q),T=r.add(K,J),x=r.mul(x,T),T=r.add(m,f),x=r.sub(x,T),ue=r.mul(_e,v),T=r.mul(G,f),ue=r.add(T,ue),T=r.sub(m,ue),ue=r.add(m,ue),z=r.mul(T,ue),m=r.add(E,E),m=r.add(m,E),f=r.mul(_e,f),v=r.mul(G,v),m=r.add(m,f),f=r.sub(E,f),f=r.mul(_e,f),v=r.add(v,f),E=r.mul(m,v),z=r.add(z,E),E=r.mul(x,v),T=r.mul(p,T),T=r.sub(T,E),E=r.mul(p,m),ue=r.mul(x,ue),ue=r.add(ue,E),new y(T,z,ue)}subtract(D){return this.add(D.negate())}is0(){return this.equals(y.ZERO)}wNAF(D){return P.wNAFCached(this,D,y.normalizeZ)}multiplyUnsafe(D){Fa("scalar",D,po,e.n);const k=y.ZERO;if(D===po)return k;if(D===In)return this;const{endo:$}=e;if(!$)return P.unsafeLadder(this,D);let{k1neg:q,k1:U,k2neg:K,k2:J}=$.splitScalar(D),T=k,z=k,ue=this;for(;U>po||J>po;)U&In&&(T=T.add(ue)),J&In&&(z=z.add(ue)),ue=ue.double(),U>>=In,J>>=In;return q&&(T=T.negate()),K&&(z=z.negate()),z=new y(r.mul(z.px,$.beta),z.py,z.pz),T.add(z)}multiply(D){const{endo:k,n:$}=e;Fa("scalar",D,In,$);let q,U;if(k){const{k1neg:K,k1:J,k2neg:T,k2:z}=k.splitScalar(D);let{p:ue,f:_e}=this.wNAF(J),{p:G,f:E}=this.wNAF(z);ue=P.constTimeNegate(K,ue),G=P.constTimeNegate(T,G),G=new y(r.mul(G.px,k.beta),G.py,G.pz),q=ue.add(G),U=_e.add(E)}else{const{p:K,f:J}=this.wNAF(D);q=K,U=J}return y.normalizeZ([q,U])[0]}multiplyAndAddUnsafe(D,k,$){const q=y.BASE,U=(J,T)=>T===po||T===In||!J.equals(q)?J.multiplyUnsafe(T):J.multiply(T),K=U(this,k).add(U(D,$));return K.is0()?void 0:K}toAffine(D){return d(this,D)}isTorsionFree(){const{h:D,isTorsionFree:k}=e;if(D===In)return!0;if(k)return k(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:D,clearCofactor:k}=e;return D===In?this:k?k(y,this):this.multiplyUnsafe(e.h)}toRawBytes(D=!0){return Jc("isCompressed",D),this.assertValidity(),i(y,this,D)}toHex(D=!0){return Jc("isCompressed",D),Xc(this.toRawBytes(D))}}y.BASE=new y(e.Gx,e.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);const A=e.nBitLength,P=bC(y,e.endo?Math.ceil(A/2):A);return{CURVE:e,ProjectivePoint:y,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:a}}function SC(t){const e=l2(t);return zf(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function AC(t){const e=SC(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(f){return di(f,n)}function a(f){return qg(f,n)}const{ProjectivePoint:u,normPrivateKeyToScalar:l,weierstrassEquation:d,isWithinCurveOrder:g}=EC({...e,toBytes(f,p,v){const x=p.toAffine(),_=r.toBytes(x.x),S=qf;return Jc("isCompressed",v),v?S(Uint8Array.from([p.hasEvenY()?2:3]),_):S(Uint8Array.from([4]),_,r.toBytes(x.y))},fromBytes(f){const p=f.length,v=f[0],x=f.subarray(1);if(p===i&&(v===2||v===3)){const _=Ba(x);if(!Gh(_,In,r.ORDER))throw new Error("Point is not on curve");const S=d(_);let b;try{b=r.sqrt(S)}catch(F){const ae=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+ae)}const M=(b&In)===In;return(v&1)===1!==M&&(b=r.neg(b)),{x:_,y:b}}else if(p===s&&v===4){const _=r.fromBytes(x.subarray(0,r.BYTES)),S=r.fromBytes(x.subarray(r.BYTES,2*r.BYTES));return{x:_,y:S}}else throw new Error(`Point of length ${p} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`)}}),y=f=>Xc(eu(f,e.nByteLength));function A(f){const p=n>>In;return f>p}function P(f){return A(f)?o(-f):f}const N=(f,p,v)=>Ba(f.slice(p,v));class D{constructor(p,v,x){this.r=p,this.s=v,this.recovery=x,this.assertValidity()}static fromCompact(p){const v=e.nByteLength;return p=hs("compactSignature",p,v*2),new D(N(p,0,v),N(p,v,2*v))}static fromDER(p){const{r:v,s:x}=ho.toSig(hs("DER",p));return new D(v,x)}assertValidity(){Fa("r",this.r,In,n),Fa("s",this.s,In,n)}addRecoveryBit(p){return new D(this.r,this.s,p)}recoverPublicKey(p){const{r:v,s:x,recovery:_}=this,S=J(hs("msgHash",p));if(_==null||![0,1,2,3].includes(_))throw new Error("recovery id invalid");const b=_===2||_===3?v+e.n:v;if(b>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const M=_&1?"03":"02",I=u.fromHex(M+y(b)),F=a(b),ae=o(-S*F),O=o(x*F),se=u.BASE.multiplyAndAddUnsafe(I,ae,O);if(!se)throw new Error("point at infinify");return se.assertValidity(),se}hasHighS(){return A(this.s)}normalizeS(){return this.hasHighS()?new D(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return Qc(this.toDERHex())}toDERHex(){return ho.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Qc(this.toCompactHex())}toCompactHex(){return y(this.r)+y(this.s)}}const k={isValidPrivateKey(f){try{return l(f),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const f=u2(e.n);return mC(e.randomBytes(f),e.n)},precompute(f=8,p=u.BASE){return p._setWindowSize(f),p.multiply(BigInt(3)),p}};function $(f,p=!0){return u.fromPrivateKey(f).toRawBytes(p)}function q(f){const p=$a(f),v=typeof f=="string",x=(p||v)&&f.length;return p?x===i||x===s:v?x===2*i||x===2*s:f instanceof u}function U(f,p,v=!0){if(q(f))throw new Error("first arg must be private key");if(!q(p))throw new Error("second arg must be public key");return u.fromHex(p).multiply(l(f)).toRawBytes(v)}const K=e.bits2int||function(f){const p=Ba(f),v=f.length*8-e.nBitLength;return v>0?p>>BigInt(v):p},J=e.bits2int_modN||function(f){return o(K(f))},T=Bg(e.nBitLength);function z(f){return Fa(`num < 2^${e.nBitLength}`,f,po,T),eu(f,e.nByteLength)}function ue(f,p,v=_e){if(["recovered","canonical"].some(X=>X in v))throw new Error("sign() legacy options not supported");const{hash:x,randomBytes:_}=e;let{lowS:S,prehash:b,extraEntropy:M}=v;S==null&&(S=!0),f=hs("msgHash",f),h2(v),b&&(f=hs("prehashed msgHash",x(f)));const I=J(f),F=l(p),ae=[z(F),z(I)];if(M!=null&&M!==!1){const X=M===!0?_(r.BYTES):M;ae.push(hs("extraEntropy",X))}const O=qf(...ae),se=I;function ee(X){const Q=K(X);if(!g(Q))return;const R=a(Q),Z=u.BASE.multiply(Q).toAffine(),te=o(Z.x);if(te===po)return;const le=o(R*o(se+te*F));if(le===po)return;let ie=(Z.x===te?0:2)|Number(Z.y&In),fe=le;return S&&A(le)&&(fe=P(le),ie^=1),new D(te,fe,ie)}return{seed:O,k2sig:ee}}const _e={lowS:e.lowS,prehash:!1},G={lowS:e.lowS,prehash:!1};function E(f,p,v=_e){const{seed:x,k2sig:_}=ue(f,p,v),S=e;return n2(S.hash.outputLen,S.nByteLength,S.hmac)(x,_)}u.BASE._setWindowSize(8);function m(f,p,v,x=G){var Z;const _=f;if(p=hs("msgHash",p),v=hs("publicKey",v),"strict"in x)throw new Error("options.strict was renamed to lowS");h2(x);const{lowS:S,prehash:b}=x;let M,I;try{if(typeof _=="string"||$a(_))try{M=D.fromDER(_)}catch(te){if(!(te instanceof ho.Err))throw te;M=D.fromCompact(_)}else if(typeof _=="object"&&typeof _.r=="bigint"&&typeof _.s=="bigint"){const{r:te,s:le}=_;M=new D(te,le)}else throw new Error("PARSE");I=u.fromHex(v)}catch(te){if(te.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(S&&M.hasHighS())return!1;b&&(p=e.hash(p));const{r:F,s:ae}=M,O=J(p),se=a(ae),ee=o(O*se),X=o(F*se),Q=(Z=u.BASE.multiplyAndAddUnsafe(I,ee,X))==null?void 0:Z.toAffine();return Q?o(Q.x)===F:!1}return{CURVE:e,getPublicKey:$,getSharedSecret:U,sign:E,verify:m,ProjectivePoint:u,Signature:D,utils:k}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function PC(t){return{hash:t,hmac:(e,...r)=>Qw(t,e,AP(...r)),randomBytes:MP}}function MC(t,e){const r=n=>AC({...t,...PC(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const p2=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),g2=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),IC=BigInt(1),Wg=BigInt(2),m2=(t,e)=>(t+e/Wg)/e;function CC(t){const e=p2,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),u=BigInt(88),l=t*t*t%e,d=l*l*t%e,g=ji(d,r,e)*d%e,y=ji(g,r,e)*d%e,A=ji(y,Wg,e)*l%e,P=ji(A,i,e)*A%e,N=ji(P,s,e)*P%e,D=ji(N,a,e)*N%e,k=ji(D,u,e)*D%e,$=ji(k,a,e)*N%e,q=ji($,r,e)*d%e,U=ji(q,o,e)*P%e,K=ji(U,n,e)*l%e,J=ji(K,Wg,e);if(!Kg.eql(Kg.sqr(J),t))throw new Error("Cannot find square root");return J}const Kg=a2(p2,void 0,void 0,{sqrt:CC}),v2=MC({a:BigInt(0),b:BigInt(7),Fp:Kg,n:g2,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=g2,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-IC*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=m2(s*t,e),u=m2(-n*t,e);let l=di(t-a*r-u*i,e),d=di(-a*n-u*s,e);const g=l>o,y=d>o;if(g&&(l=e-l),y&&(d=e-d),l>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:g,k1:l,k2neg:y,k2:d}}}},Ag);BigInt(0),v2.ProjectivePoint;const TC=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:v2},Symbol.toStringTag,{value:"Module"}));function RC(t,e){const{abi:r,args:n,bytecode:i,...s}=e,o=RI({abi:r,args:n,bytecode:i});return Rg(t,{...s,data:o})}async function DC(t){var r;return((r=t.account)==null?void 0:r.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(n=>Ef(n))}async function OC(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}async function NC(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>bw(r))}async function LC(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function kC(t,{account:e=t.account,message:r}){if(!e)throw new Uf({docsPath:"/docs/actions/wallet/signMessage"});const n=uo(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Dh(r):r.raw instanceof Uint8Array?Rh(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function $C(t,e){var l,d,g,y;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTransaction"});const s=uo(r);jh({account:s,...e});const o=await fi(t,zh,"getChainId")({});n!==null&&Yw({currentChainId:o,chain:n});const a=(n==null?void 0:n.formatters)||((l=t.chain)==null?void 0:l.formatters),u=((d=a==null?void 0:a.transactionRequest)==null?void 0:d.format)||Eg;return s.signTransaction?s.signTransaction({...i,chainId:o},{serializer:(y=(g=t.chain)==null?void 0:g.serializers)==null?void 0:y.transaction}):await t.request({method:"eth_signTransaction",params:[{...u(i),chainId:Pr(o),from:s.address}]},{retryCount:0})}async function BC(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTypedData"});const o=uo(r),a={EIP712Domain:JI({domain:n}),...e.types};if(YI({domain:n,message:i,primaryType:s,types:a}),o.signTypedData)return o.signTypedData({domain:n,message:i,primaryType:s,types:a});const u=GI({domain:n,message:i,primaryType:s,types:a});return t.request({method:"eth_signTypedData_v4",params:[o.address,u]},{retryCount:0})}async function FC(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:Pr(e)}]},{retryCount:0})}async function UC(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}function jC(t){return{addChain:e=>LI(t,e),deployContract:e=>RC(t,e),getAddresses:()=>DC(t),getChainId:()=>zh(t),getPermissions:()=>OC(t),prepareTransactionRequest:e=>Mg(t,e),requestAddresses:()=>NC(t),requestPermissions:e=>LC(t,e),sendRawTransaction:e=>Jw(t,e),sendTransaction:e=>Rg(t,e),signMessage:e=>kC(t,e),signTransaction:e=>$C(t,e),signTypedData:e=>BC(t,e),switchChain:e=>FC(t,e),watchAsset:e=>UC(t,e),writeContract:e=>NI(t,e)}}function qC(t){const{key:e="wallet",name:r="Wallet Client",transport:n}=t;return kI({...t,key:e,name:r,transport:n,type:"walletClient"}).extend(jC)}class Hf{constructor(e){so(this,"_key");so(this,"_config",null);so(this,"_provider",null);so(this,"_connected",!1);so(this,"_address",null);so(this,"_fatured",!1);so(this,"_installed",!1);so(this,"lastUsed",!1);var r;if("name"in e&&"image"in e)this._key=e.name,this._config=e,this._fatured=e.featured;else if("session"in e){if(!e.session)throw new Error("session is null");this._key=(r=e.session)==null?void 0:r.peer.metadata.name,this._provider=e,this._config={name:e.session.peer.metadata.name,image:e.session.peer.metadata.icons[0],featured:!1}}else if("info"in e)console.log(e.info,"installed"),this._key=e.info.name,this._provider=e.provider,this._installed=!0,this._config={name:e.info.name,image:e.info.icon,featured:!1},this.testConnect();else throw new Error("unknown params")}get address(){return this._address}get connected(){return this._connected}get featured(){return this._fatured}get key(){return this._key}get installed(){return this._installed}get client(){return this._provider?qC({transport:qI(this._provider)}):null}get config(){return this._config}static fromWalletConfig(e){return new Hf(e)}EIP6963Detected(e){this._provider=e.provider,this._installed=!0,this._provider.on("disconnect",this.disconnect),this._provider.on("accountsChanged",r=>{this._address=r[0],this._connected=!0}),this.testConnect()}setUniversalProvider(e){this._provider=e,this.testConnect()}async testConnect(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());e&&e.length>0?(this._address=e[0],this._connected=!0):(this._address=null,this._connected=!1)}async connect(){var r;const e=await((r=this.client)==null?void 0:r.request({method:"eth_requestAccounts",params:void 0}));if(!e)throw new Error("connect failed");return e}async getAddress(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());if(!e)throw new Error("get address failed");return e[0]}async getChain(){var r;const e=await((r=this.client)==null?void 0:r.getChainId());if(!e)throw new Error("get chain failed");return e}async signMessage(e,r){var i;return await((i=this.client)==null?void 0:i.signMessage({message:e,account:r}))}async disconnect(){this._provider&&"session"in this._provider&&await this._provider.disconnect(),this._connected=!1,this._address=null}}var Vg={exports:{}},tu=typeof Reflect=="object"?Reflect:null,b2=tu&&typeof tu.apply=="function"?tu.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Yh;tu&&typeof tu.ownKeys=="function"?Yh=tu.ownKeys:Object.getOwnPropertySymbols?Yh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Yh=function(e){return Object.getOwnPropertyNames(e)};function zC(t){console&&console.warn&&console.warn(t)}var y2=Number.isNaN||function(e){return e!==e};function Rr(){Rr.init.call(this)}Vg.exports=Rr,Vg.exports.once=VC,Rr.EventEmitter=Rr,Rr.prototype._events=void 0,Rr.prototype._eventsCount=0,Rr.prototype._maxListeners=void 0;var w2=10;function Jh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Rr,"defaultMaxListeners",{enumerable:!0,get:function(){return w2},set:function(t){if(typeof t!="number"||t<0||y2(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");w2=t}}),Rr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Rr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||y2(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function x2(t){return t._maxListeners===void 0?Rr.defaultMaxListeners:t._maxListeners}Rr.prototype.getMaxListeners=function(){return x2(this)},Rr.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")b2(u,this,r);else for(var l=u.length,d=P2(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,zC(a)}return t}Rr.prototype.addListener=function(e,r){return _2(this,e,r,!1)},Rr.prototype.on=Rr.prototype.addListener,Rr.prototype.prependListener=function(e,r){return _2(this,e,r,!0)};function HC(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function E2(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=HC.bind(n);return i.listener=r,n.wrapFn=i,i}Rr.prototype.once=function(e,r){return Jh(r),this.on(e,E2(this,e,r)),this},Rr.prototype.prependOnceListener=function(e,r){return Jh(r),this.prependListener(e,E2(this,e,r)),this},Rr.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Jh(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():WC(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Rr.prototype.off=Rr.prototype.removeListener,Rr.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function S2(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?KC(i):P2(i,i.length)}Rr.prototype.listeners=function(e){return S2(this,e,!0)},Rr.prototype.rawListeners=function(e){return S2(this,e,!1)},Rr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):A2.call(t,e)},Rr.prototype.listenerCount=A2;function A2(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Rr.prototype.eventNames=function(){return this._eventsCount>0?Yh(this._events):[]};function P2(t,e){for(var r=new Array(e),n=0;n"data"in y)||t.walk():{},g=t instanceof eg?new $M({functionName:s}):[qM,ka.code].includes(a)&&(u||l||d)?new kM({abi:e,data:typeof u=="object"?u.data:u,functionName:s,message:d??l}):t;return new LM(g,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:o})}function HM(t){const e=_f(`0x${t.substring(4)}`).substring(26);return Ef(`0x${e}`)}async function WM({hash:t,signature:e}){const r=Yo(t)?t:Rh(t),{secp256k1:n}=await Promise.resolve().then(()=>TC);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:d,v:g,yParity:y}=e,A=Number(y??g),P=Ow(A);return new n.Signature(bf(l),bf(d)).addRecoveryBit(P)}const o=Yo(e)?e:Rh(e),a=Bc(`0x${o.slice(130)}`),u=Ow(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Ow(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function KM({hash:t,signature:e}){return HM(await WM({hash:t,signature:e}))}function VM(t,e="hex"){const r=Nw(t),n=dg(new Uint8Array(r.length));return r.encode(n),e==="hex"?li(n.bytes):n.bytes}function Nw(t){return Array.isArray(t)?GM(t.map(e=>Nw(e))):YM(t)}function GM(t){const e=t.reduce((i,s)=>i+s.length,0),r=Lw(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function YM(t){const e=typeof t=="string"?ao(t):t,r=Lw(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function Lw(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new yt("Length is too large.")}function JM(t){const{chainId:e,contractAddress:r,nonce:n,to:i}=t,s=_f(kh(["0x05",VM([e?Pr(e):"0x",r,n?Pr(n):"0x"])]));return i==="bytes"?ao(s):s}async function kw(t){const{authorization:e,signature:r}=t;return KM({hash:JM(e),signature:r??e})}class XM extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:g,value:y}){var P;const A=Bh({from:r==null?void 0:r.address,to:g,value:typeof y<"u"&&`${Tw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${ls(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${ls(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ls(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",A].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class Yc extends yt{constructor({cause:e,message:r}={}){var i;const n=(i=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(Yc,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Yc,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Fh extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${ls(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(Fh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class gg extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${ls(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(gg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class mg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(mg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class vg extends yt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` +`),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(vg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class bg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(bg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class yg extends yt{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` +`),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(yg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class wg extends yt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(wg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class xg extends yt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(xg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class _g extends yt{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(_g,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Uh extends yt{constructor({cause:e,maxPriorityFeePerGas:r,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${r?` = ${ls(r)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${ls(n)} gwei`:""}).`].join(` +`),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(Uh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Eg extends yt{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function $w(t,e){const r=(t.details||"").toLowerCase(),n=t instanceof yt?t.walk(i=>(i==null?void 0:i.code)===Yc.code):t;return n instanceof yt?new Yc({cause:t,message:n.details}):Yc.nodeMessage.test(r)?new Yc({cause:t,message:t.details}):Fh.nodeMessage.test(r)?new Fh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):gg.nodeMessage.test(r)?new gg({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):mg.nodeMessage.test(r)?new mg({cause:t,nonce:e==null?void 0:e.nonce}):vg.nodeMessage.test(r)?new vg({cause:t,nonce:e==null?void 0:e.nonce}):bg.nodeMessage.test(r)?new bg({cause:t,nonce:e==null?void 0:e.nonce}):yg.nodeMessage.test(r)?new yg({cause:t}):wg.nodeMessage.test(r)?new wg({cause:t,gas:e==null?void 0:e.gas}):xg.nodeMessage.test(r)?new xg({cause:t,gas:e==null?void 0:e.gas}):_g.nodeMessage.test(r)?new _g({cause:t}):Uh.nodeMessage.test(r)?new Uh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new Eg({cause:t})}function ZM(t,{docsPath:e,...r}){const n=(()=>{const i=$w(t,r);return i instanceof Eg?t:i})();return new XM(n,{docsPath:e,...r})}function Bw(t,{format:e}){if(!e)return{};const r={};function n(s){const o=Object.keys(s);for(const a of o)a in t&&(r[a]=t[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}const i=e(t||{});return n(i),r}const QM={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Sg(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=eI(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(r=>li(r)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=Pr(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=Pr(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=Pr(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=Pr(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=Pr(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=Pr(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=QM[t.type]),typeof t.value<"u"&&(e.value=Pr(t.value)),e}function eI(t){return t.map(e=>({address:e.contractAddress,r:e.r,s:e.s,chainId:Pr(e.chainId),nonce:Pr(e.nonce),...typeof e.yParity<"u"?{yParity:Pr(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:Pr(e.v)}:{}}))}function Fw(t){if(!(!t||t.length===0))return t.reduce((e,{slot:r,value:n})=>{if(r.length!==66)throw new tw({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new tw({size:n.length,targetSize:66,type:"hex"});return e[r]=n,e},{})}function tI(t){const{balance:e,nonce:r,state:n,stateDiff:i,code:s}=t,o={};if(s!==void 0&&(o.code=s),e!==void 0&&(o.balance=Pr(e)),r!==void 0&&(o.nonce=Pr(r)),n!==void 0&&(o.state=Fw(n)),i!==void 0){if(o.state)throw new TM;o.stateDiff=Fw(i)}return o}function rI(t){if(!t)return;const e={};for(const{address:r,...n}of t){if(!co(r,{strict:!1}))throw new qc({address:r});if(e[r])throw new CM({address:r});e[r]=tI(n)}return e}const nI=2n**256n-1n;function jh(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?uo(e):void 0;if(o&&!co(o.address))throw new qc({address:o.address});if(s&&!co(s))throw new qc({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new RM;if(n&&n>nI)throw new Fh({maxFeePerGas:n});if(i&&n&&i>n)throw new Uh({maxFeePerGas:n,maxPriorityFeePerGas:i})}class iI extends yt{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Ag extends yt{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class sI extends yt{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${ls(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class oI extends yt{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}const aI={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function cI(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?Bc(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?Bc(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?aI[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=uI(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function uI(t){return t.map(e=>({contractAddress:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function fI(t){const e=(t.transactions??[]).map(r=>typeof r=="string"?r:cI(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function qh(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){var d,g,y;const s=n??"latest",o=i??!1,a=r!==void 0?Pr(r):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,o]},{dedupe:!0}):u=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]},{dedupe:!!a}),!u)throw new oI({blockHash:e,blockNumber:r});return(((y=(g=(d=t.chain)==null?void 0:d.formatters)==null?void 0:g.block)==null?void 0:y.format)||fI)(u)}async function Uw(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function lI(t,e){var s,o;const{block:r,chain:n=t.chain,request:i}=e||{};try{const a=((s=n==null?void 0:n.fees)==null?void 0:s.maxPriorityFeePerGas)??((o=n==null?void 0:n.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=r||await fi(t,qh,"getBlock")({}),d=await a({block:l,client:t,request:i});if(d===null)throw new Error;return d}if(typeof a<"u")return a;const u=await t.request({method:"eth_maxPriorityFeePerGas"});return bf(u)}catch{const[a,u]=await Promise.all([r?Promise.resolve(r):fi(t,qh,"getBlock")({}),fi(t,Uw,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new Ag;const l=u-a.baseFeePerGas;return l<0n?0n:l}}async function jw(t,e){var y,A;const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>{var P,N;return typeof((P=n==null?void 0:n.fees)==null?void 0:P.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):((N=n==null?void 0:n.fees)==null?void 0:N.baseFeeMultiplier)??1.2})();if(o<1)throw new iI;const u=10**(((y=o.toString().split(".")[1])==null?void 0:y.length)??0),l=P=>P*BigInt(Math.ceil(o*u))/BigInt(u),d=r||await fi(t,qh,"getBlock")({});if(typeof((A=n==null?void 0:n.fees)==null?void 0:A.estimateFeesPerGas)=="function"){const P=await n.fees.estimateFeesPerGas({block:r,client:t,multiply:l,request:i,type:s});if(P!==null)return P}if(s==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new Ag;const P=typeof(i==null?void 0:i.maxPriorityFeePerGas)=="bigint"?i.maxPriorityFeePerGas:await lI(t,{block:d,chain:n,request:i}),N=l(d.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??N+P,maxPriorityFeePerGas:P}}return{gasPrice:(i==null?void 0:i.gasPrice)??l(await fi(t,Uw,"getGasPrice")({}))}}async function hI(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,n?Pr(n):r]},{dedupe:!!n});return Bc(i)}function qw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(s=>ao(s)):t.blobs,i=[];for(const s of n)i.push(Uint8Array.from(e.blobToKzgCommitment(s)));return r==="bytes"?i:i.map(s=>li(s))}function zw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>ao(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>ao(o)):t.commitments,s=[];for(let o=0;oli(o))}function dI(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),u=n?4:0,l=n?0:4;t.setUint32(e+u,o,n),t.setUint32(e+l,a,n)}const pI=(t,e,r)=>t&e^~t&r,gI=(t,e,r)=>t&e^t&r^e&r;class mI extends ig{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ng(this.buffer)}update(e){Uc(this);const{view:r,buffer:n,blockLen:i}=this;e=yf(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let g=o;gd.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g>>3,N=Ds(A,17)^Ds(A,19)^A>>>10;Qo[g]=N+Qo[g-7]+P+Qo[g-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:u,G:l,H:d}=this;for(let g=0;g<64;g++){const y=Ds(a,6)^Ds(a,11)^Ds(a,25),A=d+y+pI(a,u,l)+vI[g]+Qo[g]|0,N=(Ds(n,2)^Ds(n,13)^Ds(n,22))+gI(n,i,s)|0;d=l,l=u,u=a,a=o+A|0,o=s,s=i,i=n,n=A+N|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(n,i,s,o,a,u,l,d)}roundClean(){Qo.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Pg=uw(()=>new bI);function yI(t,e){return Pg(Yo(t,{strict:!1})?rg(t):t)}function wI(t){const{commitment:e,version:r=1}=t,n=t.to??(typeof e=="string"?"hex":"bytes"),i=yI(e);return i.set([r],0),n==="bytes"?i:li(i)}function xI(t){const{commitments:e,version:r}=t,n=t.to??(typeof e[0]=="string"?"hex":"bytes"),i=[];for(const s of e)i.push(wI({commitment:s,to:n,version:r}));return i}const Hw=6,Ww=32,Mg=4096,Kw=Ww*Mg,Vw=Kw*Hw-1-1*Mg*Hw;class _I extends yt{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class EI extends yt{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function SI(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),r=typeof t.data=="string"?ao(t.data):t.data,n=_n(r);if(!n)throw new EI;if(n>Vw)throw new _I({maxSize:Vw,size:n});const i=[];let s=!0,o=0;for(;s;){const a=dg(new Uint8Array(Kw));let u=0;for(;ua.bytes):i.map(a=>li(a.bytes))}function AI(t){const{data:e,kzg:r,to:n}=t,i=t.blobs??SI({data:e,to:n}),s=t.commitments??qw({blobs:i,kzg:r,to:n}),o=t.proofs??zw({blobs:i,commitments:s,kzg:r,to:n}),a=[];for(let u=0;u"u"&&g)if(u){const k=await D();y.nonce=await u.consume({address:g.address,chainId:k,client:t})}else y.nonce=await fi(t,hI,"getTransactionCount")({address:g.address,blockTag:"pending"});if((l.includes("fees")||l.includes("type"))&&typeof d>"u")try{y.type=PI(y)}catch{const k=await P();y.type=typeof(k==null?void 0:k.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(l.includes("fees"))if(y.type!=="legacy"&&y.type!=="eip2930"){if(typeof y.maxFeePerGas>"u"||typeof y.maxPriorityFeePerGas>"u"){const k=await P(),{maxFeePerGas:$,maxPriorityFeePerGas:q}=await jw(t,{block:k,chain:i,request:y});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(y.gas=await fi(t,II,"estimateGas")({...y,account:g&&{address:g.address,type:"json-rpc"}})),jh(y),delete y.parameters,y}async function MI(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=r?Pr(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function II(t,e){var i,s,o;const{account:r=t.account}=e,n=r?uo(r):void 0;try{let f=function(v){const{block:x,request:_,rpcStateOverride:S}=v;return t.request({method:"eth_estimateGas",params:S?[_,x??"latest",S]:x?[_,x]:[_]})};const{accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,blockNumber:g,blockTag:y,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:$,nonce:q,value:U,stateOverride:K,...J}=await Ig(t,{...e,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),z=(g?Pr(g):void 0)||y,ue=rI(K),_e=await(async()=>{if(J.to)return J.to;if(u&&u.length>0)return await kw({authorization:u[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`")})})();jh(e);const G=(o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:o.format,m=(G||Sg)({...Bw(J,{format:G}),from:n==null?void 0:n.address,accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:$,nonce:q,to:_e,value:U});let p=BigInt(await f({block:z,request:m,rpcStateOverride:ue}));if(u){const v=await MI(t,{address:m.from}),x=await Promise.all(u.map(async _=>{const{contractAddress:S}=_,b=await f({block:z,request:{authorizationList:void 0,data:A,from:n==null?void 0:n.address,to:S,value:Pr(v)},rpcStateOverride:ue}).catch(()=>100000n);return 2n*BigInt(b)}));p+=x.reduce((_,S)=>_+S,0n)}return p}catch(a){throw ZM(a,{...e,account:n,chain:t.chain})}}class CI extends yt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class TI extends yt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` +`),{name:"ChainNotFoundError"})}}const Cg="/docs/contract/encodeDeployData";function RI(t){const{abi:e,args:r,bytecode:n}=t;if(!r||r.length===0)return n;const i=e.find(o=>"type"in o&&o.type==="constructor");if(!i)throw new KA({docsPath:Cg});if(!("inputs"in i))throw new Jy({docsPath:Cg});if(!i.inputs||i.inputs.length===0)throw new Jy({docsPath:Cg});const s=_w(i.inputs,r);return kh([n,s])}async function DI(t){return new Promise(e=>setTimeout(e,t))}class Uf extends yt{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` +`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class Tg extends yt{constructor({docsPath:e,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:e,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function Yw({chain:t,currentChainId:e}){if(!t)throw new TI;if(e!==t.id)throw new CI({chain:t,currentChainId:e})}function OI(t,{docsPath:e,...r}){const n=(()=>{const i=$w(t,r);return i instanceof Eg?t:i})();return new OM(n,{docsPath:e,...r})}async function Jw(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const Rg=new Lh(128);async function Dg(t,e){var k,$,q,U;const{account:r=t.account,chain:n=t.chain,accessList:i,authorizationList:s,blobs:o,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,value:P,...N}=e;if(typeof r>"u")throw new Uf({docsPath:"/docs/actions/wallet/sendTransaction"});const D=r?uo(r):null;try{jh(e);const K=await(async()=>{if(e.to)return e.to;if(s&&s.length>0)return await kw({authorization:s[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`.")})})();if((D==null?void 0:D.type)==="json-rpc"||D===null){let J;n!==null&&(J=await fi(t,zh,"getChainId")({}),Yw({currentChainId:J,chain:n}));const T=(q=($=(k=t.chain)==null?void 0:k.formatters)==null?void 0:$.transactionRequest)==null?void 0:q.format,ue=(T||Sg)({...Bw(N,{format:T}),accessList:i,authorizationList:s,blobs:o,chainId:J,data:a,from:D==null?void 0:D.address,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,to:K,value:P}),_e=Rg.get(t.uid),G=_e?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:G,params:[ue]},{retryCount:0})}catch(E){if(_e===!1)throw E;const m=E;if(m.name==="InvalidInputRpcError"||m.name==="InvalidParamsRpcError"||m.name==="MethodNotFoundRpcError"||m.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[ue]},{retryCount:0}).then(f=>(Rg.set(t.uid,!0),f)).catch(f=>{const p=f;throw p.name==="MethodNotFoundRpcError"||p.name==="MethodNotSupportedRpcError"?(Rg.set(t.uid,!1),m):p});throw m}}if((D==null?void 0:D.type)==="local"){const J=await fi(t,Ig,"prepareTransactionRequest")({account:D,accessList:i,authorizationList:s,blobs:o,chain:n,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,nonceManager:D.nonceManager,parameters:[...Gw,"sidecars"],value:P,...N,to:K}),T=(U=n==null?void 0:n.serializers)==null?void 0:U.transaction,z=await D.signTransaction(J,{serializer:T});return await fi(t,Jw,"sendRawTransaction")({serializedTransaction:z})}throw(D==null?void 0:D.type)==="smart"?new Tg({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Tg({docsPath:"/docs/actions/wallet/sendTransaction",type:D==null?void 0:D.type})}catch(K){throw K instanceof Tg?K:OI(K,{...e,account:D,chain:e.chain||void 0})}}async function NI(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:o,functionName:a,...u}=e;if(typeof n>"u")throw new Uf({docsPath:"/docs/contract/writeContract"});const l=n?uo(n):null,d=cM({abi:r,args:s,functionName:a});try{return await fi(t,Dg,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:i,account:l,...u})}catch(g){throw zM(g,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:a,sender:l==null?void 0:l.address})}}async function LI(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:Pr(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}const Og=256;let Hh=Og,Wh;function Xw(t=11){if(!Wh||Hh+t>Og*2){Wh="",Hh=0;for(let e=0;e{const $=k(D);for(const U in P)delete $[U];const q={...D,...$};return Object.assign(q,{extend:N(q)})}}return Object.assign(P,{extend:N(P)})}const Kh=new Lh(8192);function $I(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(Kh.get(r))return Kh.get(r);const n=t().finally(()=>Kh.delete(r));return Kh.set(r,n),n}function BI(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const u=async({error:l})=>{const d=typeof e=="function"?e({count:a,error:l}):e;d&&await DI(d),o({count:a+1})};try{const l=await t();i(l)}catch(l){if(a{const{dedupe:i=!1,retryDelay:s=150,retryCount:o=3,uid:a}={...e,...n},u=i?_f(Dh(`${a}.${Wc(r)}`)):void 0;return $I(()=>BI(async()=>{try{return await t(r)}catch(l){const d=l;switch(d.code){case Af.code:throw new Af(d);case Pf.code:throw new Pf(d);case Mf.code:throw new Mf(d,{method:r.method});case If.code:throw new If(d);case ka.code:throw new ka(d);case Cf.code:throw new Cf(d);case Tf.code:throw new Tf(d);case Rf.code:throw new Rf(d);case Df.code:throw new Df(d);case Of.code:throw new Of(d,{method:r.method});case Vc.code:throw new Vc(d);case Nf.code:throw new Nf(d);case Gc.code:throw new Gc(d);case Lf.code:throw new Lf(d);case kf.code:throw new kf(d);case $f.code:throw new $f(d);case Bf.code:throw new Bf(d);case Ff.code:throw new Ff(d);case 5e3:throw new Gc(d);default:throw l instanceof yt?l:new jM(d)}}},{delay:({count:l,error:d})=>{var g;if(d&&d instanceof Dw){const y=(g=d==null?void 0:d.headers)==null?void 0:g.get("Retry-After");if(y!=null&&y.match(/\d/))return Number.parseInt(y)*1e3}return~~(1<UI(l)}),{enabled:i,id:u})}}function UI(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Vc.code||t.code===ka.code:t instanceof Dw&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function jI({key:t,name:e,request:r,retryCount:n=3,retryDelay:i=150,timeout:s,type:o},a){const u=Xw();return{config:{key:t,name:e,request:r,retryCount:n,retryDelay:i,timeout:s,type:o},request:FI(r,{retryCount:n,retryDelay:i,uid:u}),value:a}}function qI(t,e={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=e;return({retryCount:s})=>jI({key:r,name:n,request:t.request.bind(t),retryCount:e.retryCount??s,retryDelay:i,type:"custom"})}const zI=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,HI=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;class WI extends yt{constructor({domain:e}){super(`Invalid domain "${Wc(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class KI extends yt{constructor({primaryType:e,types:r}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class VI extends yt{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function GI(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(u,l)=>{const d={...l};for(const g of u){const{name:y,type:A}=g;A==="address"&&(d[y]=d[y].toLowerCase())}return d},o=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return Wc({domain:o,message:a,primaryType:n,types:i})}function YI(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(o,a)=>{for(const u of o){const{name:l,type:d}=u,g=a[l],y=d.match(HI);if(y&&(typeof g=="number"||typeof g=="bigint")){const[N,D,k]=y;Pr(g,{signed:D==="int",size:Number.parseInt(k)/8})}if(d==="address"&&typeof g=="string"&&!co(g))throw new qc({address:g});const A=d.match(zI);if(A){const[N,D]=A;if(D&&_n(g)!==Number.parseInt(D))throw new ZA({expectedSize:Number.parseInt(D),givenSize:_n(g)})}const P=i[d];P&&(XI(d),s(P,g))}};if(i.EIP712Domain&&e){if(typeof e!="object")throw new WI({domain:e});s(i.EIP712Domain,e)}if(n!=="EIP712Domain")if(i[n])s(i[n],r);else throw new KI({primaryType:n,types:i})}function JI({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},typeof(t==null?void 0:t.chainId)=="number"&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function XI(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new VI({type:t})}let Zw=class extends ig{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,dP(e);const n=yf(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew Zw(t,e).update(r).digest();Qw.create=(t,e)=>new Zw(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ng=BigInt(0),Vh=BigInt(1),ZI=BigInt(2);function $a(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function jf(t){if(!$a(t))throw new Error("Uint8Array expected")}function Jc(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)}const QI=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Xc(t){jf(t);let e="";for(let r=0;r=lo._0&&t<=lo._9)return t-lo._0;if(t>=lo._A&&t<=lo._F)return t-(lo._A-10);if(t>=lo._a&&t<=lo._f)return t-(lo._a-10)}function Qc(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;itypeof t=="bigint"&&Ng<=t;function Gh(t,e,r){return Bg(t)&&Bg(e)&&Bg(r)&&e<=t&&tNg;t>>=Vh,e+=1);return e}function nC(t,e){return t>>BigInt(e)&Vh}function iC(t,e,r){return t|(r?Vh:Ng)<(ZI<new Uint8Array(t),r2=t=>Uint8Array.from(t);function n2(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=Ug(t),i=Ug(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...g)=>r(i,n,...g),u=(g=Ug())=>{i=a(r2([0]),g),n=a(),g.length!==0&&(i=a(r2([1]),g),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let g=0;const y=[];for(;g{o(),u(g);let A;for(;!(A=y(l()));)u();return o(),A}}const sC={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||$a(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function zf(t,e,r={}){const n=(i,s,o)=>{const a=sC[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const u=t[i];if(!(o&&u===void 0)&&!a(u,t))throw new Error(`Invalid param ${String(i)}=${u} (${typeof u}), expected ${s}`)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const oC=()=>{throw new Error("not implemented")};function jg(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}const aC=Object.freeze(Object.defineProperty({__proto__:null,aInRange:Fa,abool:Jc,abytes:jf,bitGet:nC,bitLen:t2,bitMask:Fg,bitSet:iC,bytesToHex:Xc,bytesToNumberBE:Ba,bytesToNumberLE:kg,concatBytes:qf,createHmacDrbg:n2,ensureBytes:hs,equalBytes:tC,hexToBytes:Qc,hexToNumber:Lg,inRange:Gh,isBytes:$a,memoized:jg,notImplemented:oC,numberToBytesBE:eu,numberToBytesLE:$g,numberToHexUnpadded:Zc,numberToVarBytesBE:eC,utf8ToBytes:rC,validateObject:zf},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mn=BigInt(0),sn=BigInt(1),Ua=BigInt(2),cC=BigInt(3),qg=BigInt(4),i2=BigInt(5),s2=BigInt(8);BigInt(9),BigInt(16);function di(t,e){const r=t%e;return r>=Mn?r:e+r}function uC(t,e,r){if(r<=Mn||e 0");if(r===sn)return Mn;let n=sn;for(;e>Mn;)e&sn&&(n=n*t%r),t=t*t%r,e>>=sn;return n}function ji(t,e,r){let n=t;for(;e-- >Mn;)n*=n,n%=r;return n}function zg(t,e){if(t===Mn||e<=Mn)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=di(t,e),n=e,i=Mn,s=sn;for(;r!==Mn;){const a=n/r,u=n%r,l=i-s*a;n=r,r=u,i=s,s=l}if(n!==sn)throw new Error("invert: does not exist");return di(i,e)}function fC(t){const e=(t-sn)/Ua;let r,n,i;for(r=t-sn,n=0;r%Ua===Mn;r/=Ua,n++);for(i=Ua;i(n[i]="function",n),e);return zf(t,r)}function pC(t,e,r){if(r 0");if(r===Mn)return t.ONE;if(r===sn)return e;let n=t.ONE,i=e;for(;r>Mn;)r&sn&&(n=t.mul(n,i)),i=t.sqr(i),r>>=sn;return n}function gC(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function o2(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function a2(t,e,r=!1,n={}){if(t<=Mn)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=o2(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=lC(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:Fg(i),ZERO:Mn,ONE:sn,create:u=>di(u,t),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return Mn<=u&&uu===Mn,isOdd:u=>(u&sn)===sn,neg:u=>di(-u,t),eql:(u,l)=>u===l,sqr:u=>di(u*u,t),add:(u,l)=>di(u+l,t),sub:(u,l)=>di(u-l,t),mul:(u,l)=>di(u*l,t),pow:(u,l)=>pC(a,u,l),div:(u,l)=>di(u*zg(l,t),t),sqrN:u=>u*u,addN:(u,l)=>u+l,subN:(u,l)=>u-l,mulN:(u,l)=>u*l,inv:u=>zg(u,t),sqrt:n.sqrt||(u=>o(a,u)),invertBatch:u=>gC(a,u),cmov:(u,l,d)=>d?l:u,toBytes:u=>r?$g(u,s):eu(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return r?kg(u):Ba(u)}});return Object.freeze(a)}function c2(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function u2(t){const e=c2(t);return e+Math.ceil(e/2)}function mC(t,e,r=!1){const n=t.length,i=c2(e),s=u2(e);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?Ba(t):kg(t),a=di(o,e-sn)+sn;return r?$g(a,i):eu(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const vC=BigInt(0),Hg=BigInt(1),Wg=new WeakMap,f2=new WeakMap;function bC(t,e){const r=(s,o)=>{const a=o.negate();return s?a:o},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>e)throw new Error(`Wrong window size=${s}, should be [1..${e}]`)},i=s=>{n(s);const o=Math.ceil(e/s)+1,a=2**(s-1);return{windows:o,windowSize:a}};return{constTimeNegate:r,unsafeLadder(s,o){let a=t.ZERO,u=s;for(;o>vC;)o&Hg&&(a=a.add(u)),u=u.double(),o>>=Hg;return a},precomputeWindow(s,o){const{windows:a,windowSize:u}=i(o),l=[];let d=s,g=d;for(let y=0;y>=P,k>l&&(k-=A,a+=Hg);const $=D,q=D+Math.abs(k)-1,U=N%2!==0,K=k<0;k===0?g=g.add(r(U,o[$])):d=d.add(r(K,o[q]))}return{p:d,f:g}},wNAFCached(s,o,a){const u=f2.get(s)||1;let l=Wg.get(s);return l||(l=this.precomputeWindow(s,u),u!==1&&Wg.set(s,a(l))),this.wNAF(u,l,o)},setWindowSize(s,o){n(o),f2.set(s,o),Wg.delete(s)}}}function yC(t,e,r,n){if(!Array.isArray(r)||!Array.isArray(n)||n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((d,g)=>{if(!e.isValid(d))throw new Error(`wrong scalar at index ${g}`)}),r.forEach((d,g)=>{if(!(d instanceof t))throw new Error(`wrong point at index ${g}`)});const i=t2(BigInt(r.length)),s=i>12?i-3:i>4?i-2:i?2:1,o=(1<=0;d-=s){a.fill(t.ZERO);for(let y=0;y>BigInt(d)&BigInt(o));a[P]=a[P].add(r[y])}let g=t.ZERO;for(let y=a.length-1,A=t.ZERO;y>0;y--)A=A.add(a[y]),g=g.add(A);if(l=l.add(g),d!==0)for(let y=0;y{const{Err:r}=ho;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=Zc(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?Zc(i.length/2|128):"";return`${Zc(t)}${s}${i}${e}`},decode(t,e){const{Err:r}=ho;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");const l=e.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const d of l)o=o<<8|d;if(n+=u,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=ho;if(t{const $=D.toAffine();return qf(Uint8Array.from([4]),r.toBytes($.x),r.toBytes($.y))}),s=e.fromBytes||(N=>{const D=N.subarray(1),k=r.fromBytes(D.subarray(0,r.BYTES)),$=r.fromBytes(D.subarray(r.BYTES,2*r.BYTES));return{x:k,y:$}});function o(N){const{a:D,b:k}=e,$=r.sqr(N),q=r.mul($,N);return r.add(r.add(q,r.mul(N,D)),k)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(N){return Gh(N,In,e.n)}function u(N){const{allowedPrivateKeyLengths:D,nByteLength:k,wrapPrivateKey:$,n:q}=e;if(D&&typeof N!="bigint"){if($a(N)&&(N=Xc(N)),typeof N!="string"||!D.includes(N.length))throw new Error("Invalid key");N=N.padStart(k*2,"0")}let U;try{U=typeof N=="bigint"?N:Ba(hs("private key",N,k))}catch{throw new Error(`private key must be ${k} bytes, hex or bigint, not ${typeof N}`)}return $&&(U=di(U,q)),Fa("private key",U,In,q),U}function l(N){if(!(N instanceof y))throw new Error("ProjectivePoint expected")}const d=jg((N,D)=>{const{px:k,py:$,pz:q}=N;if(r.eql(q,r.ONE))return{x:k,y:$};const U=N.is0();D==null&&(D=U?r.ONE:r.inv(q));const K=r.mul(k,D),J=r.mul($,D),T=r.mul(q,D);if(U)return{x:r.ZERO,y:r.ZERO};if(!r.eql(T,r.ONE))throw new Error("invZ was invalid");return{x:K,y:J}}),g=jg(N=>{if(N.is0()){if(e.allowInfinityPoint&&!r.is0(N.py))return;throw new Error("bad point: ZERO")}const{x:D,y:k}=N.toAffine();if(!r.isValid(D)||!r.isValid(k))throw new Error("bad point: x or y not FE");const $=r.sqr(k),q=o(D);if(!r.eql($,q))throw new Error("bad point: equation left != right");if(!N.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(D,k,$){if(this.px=D,this.py=k,this.pz=$,D==null||!r.isValid(D))throw new Error("x required");if(k==null||!r.isValid(k))throw new Error("y required");if($==null||!r.isValid($))throw new Error("z required");Object.freeze(this)}static fromAffine(D){const{x:k,y:$}=D||{};if(!D||!r.isValid(k)||!r.isValid($))throw new Error("invalid affine point");if(D instanceof y)throw new Error("projective point not allowed");const q=U=>r.eql(U,r.ZERO);return q(k)&&q($)?y.ZERO:new y(k,$,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(D){const k=r.invertBatch(D.map($=>$.pz));return D.map(($,q)=>$.toAffine(k[q])).map(y.fromAffine)}static fromHex(D){const k=y.fromAffine(s(hs("pointHex",D)));return k.assertValidity(),k}static fromPrivateKey(D){return y.BASE.multiply(u(D))}static msm(D,k){return yC(y,n,D,k)}_setWindowSize(D){P.setWindowSize(this,D)}assertValidity(){g(this)}hasEvenY(){const{y:D}=this.toAffine();if(r.isOdd)return!r.isOdd(D);throw new Error("Field doesn't support isOdd")}equals(D){l(D);const{px:k,py:$,pz:q}=this,{px:U,py:K,pz:J}=D,T=r.eql(r.mul(k,J),r.mul(U,q)),z=r.eql(r.mul($,J),r.mul(K,q));return T&&z}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){const{a:D,b:k}=e,$=r.mul(k,d2),{px:q,py:U,pz:K}=this;let J=r.ZERO,T=r.ZERO,z=r.ZERO,ue=r.mul(q,q),_e=r.mul(U,U),G=r.mul(K,K),E=r.mul(q,U);return E=r.add(E,E),z=r.mul(q,K),z=r.add(z,z),J=r.mul(D,z),T=r.mul($,G),T=r.add(J,T),J=r.sub(_e,T),T=r.add(_e,T),T=r.mul(J,T),J=r.mul(E,J),z=r.mul($,z),G=r.mul(D,G),E=r.sub(ue,G),E=r.mul(D,E),E=r.add(E,z),z=r.add(ue,ue),ue=r.add(z,ue),ue=r.add(ue,G),ue=r.mul(ue,E),T=r.add(T,ue),G=r.mul(U,K),G=r.add(G,G),ue=r.mul(G,E),J=r.sub(J,ue),z=r.mul(G,_e),z=r.add(z,z),z=r.add(z,z),new y(J,T,z)}add(D){l(D);const{px:k,py:$,pz:q}=this,{px:U,py:K,pz:J}=D;let T=r.ZERO,z=r.ZERO,ue=r.ZERO;const _e=e.a,G=r.mul(e.b,d2);let E=r.mul(k,U),m=r.mul($,K),f=r.mul(q,J),p=r.add(k,$),v=r.add(U,K);p=r.mul(p,v),v=r.add(E,m),p=r.sub(p,v),v=r.add(k,q);let x=r.add(U,J);return v=r.mul(v,x),x=r.add(E,f),v=r.sub(v,x),x=r.add($,q),T=r.add(K,J),x=r.mul(x,T),T=r.add(m,f),x=r.sub(x,T),ue=r.mul(_e,v),T=r.mul(G,f),ue=r.add(T,ue),T=r.sub(m,ue),ue=r.add(m,ue),z=r.mul(T,ue),m=r.add(E,E),m=r.add(m,E),f=r.mul(_e,f),v=r.mul(G,v),m=r.add(m,f),f=r.sub(E,f),f=r.mul(_e,f),v=r.add(v,f),E=r.mul(m,v),z=r.add(z,E),E=r.mul(x,v),T=r.mul(p,T),T=r.sub(T,E),E=r.mul(p,m),ue=r.mul(x,ue),ue=r.add(ue,E),new y(T,z,ue)}subtract(D){return this.add(D.negate())}is0(){return this.equals(y.ZERO)}wNAF(D){return P.wNAFCached(this,D,y.normalizeZ)}multiplyUnsafe(D){Fa("scalar",D,po,e.n);const k=y.ZERO;if(D===po)return k;if(D===In)return this;const{endo:$}=e;if(!$)return P.unsafeLadder(this,D);let{k1neg:q,k1:U,k2neg:K,k2:J}=$.splitScalar(D),T=k,z=k,ue=this;for(;U>po||J>po;)U&In&&(T=T.add(ue)),J&In&&(z=z.add(ue)),ue=ue.double(),U>>=In,J>>=In;return q&&(T=T.negate()),K&&(z=z.negate()),z=new y(r.mul(z.px,$.beta),z.py,z.pz),T.add(z)}multiply(D){const{endo:k,n:$}=e;Fa("scalar",D,In,$);let q,U;if(k){const{k1neg:K,k1:J,k2neg:T,k2:z}=k.splitScalar(D);let{p:ue,f:_e}=this.wNAF(J),{p:G,f:E}=this.wNAF(z);ue=P.constTimeNegate(K,ue),G=P.constTimeNegate(T,G),G=new y(r.mul(G.px,k.beta),G.py,G.pz),q=ue.add(G),U=_e.add(E)}else{const{p:K,f:J}=this.wNAF(D);q=K,U=J}return y.normalizeZ([q,U])[0]}multiplyAndAddUnsafe(D,k,$){const q=y.BASE,U=(J,T)=>T===po||T===In||!J.equals(q)?J.multiplyUnsafe(T):J.multiply(T),K=U(this,k).add(U(D,$));return K.is0()?void 0:K}toAffine(D){return d(this,D)}isTorsionFree(){const{h:D,isTorsionFree:k}=e;if(D===In)return!0;if(k)return k(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:D,clearCofactor:k}=e;return D===In?this:k?k(y,this):this.multiplyUnsafe(e.h)}toRawBytes(D=!0){return Jc("isCompressed",D),this.assertValidity(),i(y,this,D)}toHex(D=!0){return Jc("isCompressed",D),Xc(this.toRawBytes(D))}}y.BASE=new y(e.Gx,e.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);const A=e.nBitLength,P=bC(y,e.endo?Math.ceil(A/2):A);return{CURVE:e,ProjectivePoint:y,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:a}}function SC(t){const e=l2(t);return zf(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function AC(t){const e=SC(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(f){return di(f,n)}function a(f){return zg(f,n)}const{ProjectivePoint:u,normPrivateKeyToScalar:l,weierstrassEquation:d,isWithinCurveOrder:g}=EC({...e,toBytes(f,p,v){const x=p.toAffine(),_=r.toBytes(x.x),S=qf;return Jc("isCompressed",v),v?S(Uint8Array.from([p.hasEvenY()?2:3]),_):S(Uint8Array.from([4]),_,r.toBytes(x.y))},fromBytes(f){const p=f.length,v=f[0],x=f.subarray(1);if(p===i&&(v===2||v===3)){const _=Ba(x);if(!Gh(_,In,r.ORDER))throw new Error("Point is not on curve");const S=d(_);let b;try{b=r.sqrt(S)}catch(F){const ae=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+ae)}const M=(b&In)===In;return(v&1)===1!==M&&(b=r.neg(b)),{x:_,y:b}}else if(p===s&&v===4){const _=r.fromBytes(x.subarray(0,r.BYTES)),S=r.fromBytes(x.subarray(r.BYTES,2*r.BYTES));return{x:_,y:S}}else throw new Error(`Point of length ${p} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`)}}),y=f=>Xc(eu(f,e.nByteLength));function A(f){const p=n>>In;return f>p}function P(f){return A(f)?o(-f):f}const N=(f,p,v)=>Ba(f.slice(p,v));class D{constructor(p,v,x){this.r=p,this.s=v,this.recovery=x,this.assertValidity()}static fromCompact(p){const v=e.nByteLength;return p=hs("compactSignature",p,v*2),new D(N(p,0,v),N(p,v,2*v))}static fromDER(p){const{r:v,s:x}=ho.toSig(hs("DER",p));return new D(v,x)}assertValidity(){Fa("r",this.r,In,n),Fa("s",this.s,In,n)}addRecoveryBit(p){return new D(this.r,this.s,p)}recoverPublicKey(p){const{r:v,s:x,recovery:_}=this,S=J(hs("msgHash",p));if(_==null||![0,1,2,3].includes(_))throw new Error("recovery id invalid");const b=_===2||_===3?v+e.n:v;if(b>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const M=_&1?"03":"02",I=u.fromHex(M+y(b)),F=a(b),ae=o(-S*F),O=o(x*F),se=u.BASE.multiplyAndAddUnsafe(I,ae,O);if(!se)throw new Error("point at infinify");return se.assertValidity(),se}hasHighS(){return A(this.s)}normalizeS(){return this.hasHighS()?new D(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return Qc(this.toDERHex())}toDERHex(){return ho.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Qc(this.toCompactHex())}toCompactHex(){return y(this.r)+y(this.s)}}const k={isValidPrivateKey(f){try{return l(f),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const f=u2(e.n);return mC(e.randomBytes(f),e.n)},precompute(f=8,p=u.BASE){return p._setWindowSize(f),p.multiply(BigInt(3)),p}};function $(f,p=!0){return u.fromPrivateKey(f).toRawBytes(p)}function q(f){const p=$a(f),v=typeof f=="string",x=(p||v)&&f.length;return p?x===i||x===s:v?x===2*i||x===2*s:f instanceof u}function U(f,p,v=!0){if(q(f))throw new Error("first arg must be private key");if(!q(p))throw new Error("second arg must be public key");return u.fromHex(p).multiply(l(f)).toRawBytes(v)}const K=e.bits2int||function(f){const p=Ba(f),v=f.length*8-e.nBitLength;return v>0?p>>BigInt(v):p},J=e.bits2int_modN||function(f){return o(K(f))},T=Fg(e.nBitLength);function z(f){return Fa(`num < 2^${e.nBitLength}`,f,po,T),eu(f,e.nByteLength)}function ue(f,p,v=_e){if(["recovered","canonical"].some(X=>X in v))throw new Error("sign() legacy options not supported");const{hash:x,randomBytes:_}=e;let{lowS:S,prehash:b,extraEntropy:M}=v;S==null&&(S=!0),f=hs("msgHash",f),h2(v),b&&(f=hs("prehashed msgHash",x(f)));const I=J(f),F=l(p),ae=[z(F),z(I)];if(M!=null&&M!==!1){const X=M===!0?_(r.BYTES):M;ae.push(hs("extraEntropy",X))}const O=qf(...ae),se=I;function ee(X){const Q=K(X);if(!g(Q))return;const R=a(Q),Z=u.BASE.multiply(Q).toAffine(),te=o(Z.x);if(te===po)return;const le=o(R*o(se+te*F));if(le===po)return;let ie=(Z.x===te?0:2)|Number(Z.y&In),fe=le;return S&&A(le)&&(fe=P(le),ie^=1),new D(te,fe,ie)}return{seed:O,k2sig:ee}}const _e={lowS:e.lowS,prehash:!1},G={lowS:e.lowS,prehash:!1};function E(f,p,v=_e){const{seed:x,k2sig:_}=ue(f,p,v),S=e;return n2(S.hash.outputLen,S.nByteLength,S.hmac)(x,_)}u.BASE._setWindowSize(8);function m(f,p,v,x=G){var Z;const _=f;if(p=hs("msgHash",p),v=hs("publicKey",v),"strict"in x)throw new Error("options.strict was renamed to lowS");h2(x);const{lowS:S,prehash:b}=x;let M,I;try{if(typeof _=="string"||$a(_))try{M=D.fromDER(_)}catch(te){if(!(te instanceof ho.Err))throw te;M=D.fromCompact(_)}else if(typeof _=="object"&&typeof _.r=="bigint"&&typeof _.s=="bigint"){const{r:te,s:le}=_;M=new D(te,le)}else throw new Error("PARSE");I=u.fromHex(v)}catch(te){if(te.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(S&&M.hasHighS())return!1;b&&(p=e.hash(p));const{r:F,s:ae}=M,O=J(p),se=a(ae),ee=o(O*se),X=o(F*se),Q=(Z=u.BASE.multiplyAndAddUnsafe(I,ee,X))==null?void 0:Z.toAffine();return Q?o(Q.x)===F:!1}return{CURVE:e,getPublicKey:$,getSharedSecret:U,sign:E,verify:m,ProjectivePoint:u,Signature:D,utils:k}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function PC(t){return{hash:t,hmac:(e,...r)=>Qw(t,e,AP(...r)),randomBytes:MP}}function MC(t,e){const r=n=>AC({...t,...PC(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const p2=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),g2=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),IC=BigInt(1),Kg=BigInt(2),m2=(t,e)=>(t+e/Kg)/e;function CC(t){const e=p2,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),u=BigInt(88),l=t*t*t%e,d=l*l*t%e,g=ji(d,r,e)*d%e,y=ji(g,r,e)*d%e,A=ji(y,Kg,e)*l%e,P=ji(A,i,e)*A%e,N=ji(P,s,e)*P%e,D=ji(N,a,e)*N%e,k=ji(D,u,e)*D%e,$=ji(k,a,e)*N%e,q=ji($,r,e)*d%e,U=ji(q,o,e)*P%e,K=ji(U,n,e)*l%e,J=ji(K,Kg,e);if(!Vg.eql(Vg.sqr(J),t))throw new Error("Cannot find square root");return J}const Vg=a2(p2,void 0,void 0,{sqrt:CC}),v2=MC({a:BigInt(0),b:BigInt(7),Fp:Vg,n:g2,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=g2,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-IC*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=m2(s*t,e),u=m2(-n*t,e);let l=di(t-a*r-u*i,e),d=di(-a*n-u*s,e);const g=l>o,y=d>o;if(g&&(l=e-l),y&&(d=e-d),l>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:g,k1:l,k2neg:y,k2:d}}}},Pg);BigInt(0),v2.ProjectivePoint;const TC=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:v2},Symbol.toStringTag,{value:"Module"}));function RC(t,e){const{abi:r,args:n,bytecode:i,...s}=e,o=RI({abi:r,args:n,bytecode:i});return Dg(t,{...s,data:o})}async function DC(t){var r;return((r=t.account)==null?void 0:r.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(n=>Ef(n))}async function OC(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}async function NC(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>og(r))}async function LC(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function kC(t,{account:e=t.account,message:r}){if(!e)throw new Uf({docsPath:"/docs/actions/wallet/signMessage"});const n=uo(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Dh(r):r.raw instanceof Uint8Array?Rh(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function $C(t,e){var l,d,g,y;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTransaction"});const s=uo(r);jh({account:s,...e});const o=await fi(t,zh,"getChainId")({});n!==null&&Yw({currentChainId:o,chain:n});const a=(n==null?void 0:n.formatters)||((l=t.chain)==null?void 0:l.formatters),u=((d=a==null?void 0:a.transactionRequest)==null?void 0:d.format)||Sg;return s.signTransaction?s.signTransaction({...i,chainId:o},{serializer:(y=(g=t.chain)==null?void 0:g.serializers)==null?void 0:y.transaction}):await t.request({method:"eth_signTransaction",params:[{...u(i),chainId:Pr(o),from:s.address}]},{retryCount:0})}async function BC(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTypedData"});const o=uo(r),a={EIP712Domain:JI({domain:n}),...e.types};if(YI({domain:n,message:i,primaryType:s,types:a}),o.signTypedData)return o.signTypedData({domain:n,message:i,primaryType:s,types:a});const u=GI({domain:n,message:i,primaryType:s,types:a});return t.request({method:"eth_signTypedData_v4",params:[o.address,u]},{retryCount:0})}async function FC(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:Pr(e)}]},{retryCount:0})}async function UC(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}function jC(t){return{addChain:e=>LI(t,e),deployContract:e=>RC(t,e),getAddresses:()=>DC(t),getChainId:()=>zh(t),getPermissions:()=>OC(t),prepareTransactionRequest:e=>Ig(t,e),requestAddresses:()=>NC(t),requestPermissions:e=>LC(t,e),sendRawTransaction:e=>Jw(t,e),sendTransaction:e=>Dg(t,e),signMessage:e=>kC(t,e),signTransaction:e=>$C(t,e),signTypedData:e=>BC(t,e),switchChain:e=>FC(t,e),watchAsset:e=>UC(t,e),writeContract:e=>NI(t,e)}}function qC(t){const{key:e="wallet",name:r="Wallet Client",transport:n}=t;return kI({...t,key:e,name:r,transport:n,type:"walletClient"}).extend(jC)}class Hf{constructor(e){so(this,"_key");so(this,"_config",null);so(this,"_provider",null);so(this,"_connected",!1);so(this,"_address",null);so(this,"_fatured",!1);so(this,"_installed",!1);so(this,"lastUsed",!1);var r;if("name"in e&&"image"in e)this._key=e.name,this._config=e,this._fatured=e.featured;else if("session"in e){if(!e.session)throw new Error("session is null");this._key=(r=e.session)==null?void 0:r.peer.metadata.name,this._provider=e,this._config={name:e.session.peer.metadata.name,image:e.session.peer.metadata.icons[0],featured:!1}}else if("info"in e)console.log(e.info,"installed"),this._key=e.info.name,this._provider=e.provider,this._installed=!0,this._config={name:e.info.name,image:e.info.icon,featured:!1},this.testConnect();else throw new Error("unknown params")}get address(){return this._address}get connected(){return this._connected}get featured(){return this._fatured}get key(){return this._key}get installed(){return this._installed}get client(){return this._provider?qC({transport:qI(this._provider)}):null}get config(){return this._config}static fromWalletConfig(e){return new Hf(e)}EIP6963Detected(e){this._provider=e.provider,this._installed=!0,this._provider.on("disconnect",this.disconnect),this._provider.on("accountsChanged",r=>{this._address=r[0],this._connected=!0}),this.testConnect()}setUniversalProvider(e){this._provider=e,this.testConnect()}async testConnect(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());e&&e.length>0?(this._address=e[0],this._connected=!0):(this._address=null,this._connected=!1)}async connect(){var r;const e=await((r=this.client)==null?void 0:r.request({method:"eth_requestAccounts",params:void 0}));if(!e)throw new Error("connect failed");return e}async getAddress(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());if(!e)throw new Error("get address failed");return e[0]}async getChain(){var r;const e=await((r=this.client)==null?void 0:r.getChainId());if(!e)throw new Error("get chain failed");return e}async signMessage(e,r){var i;return await((i=this.client)==null?void 0:i.signMessage({message:e,account:r}))}async disconnect(){this._provider&&"session"in this._provider&&await this._provider.disconnect(),this._connected=!1,this._address=null}}var Gg={exports:{}},tu=typeof Reflect=="object"?Reflect:null,b2=tu&&typeof tu.apply=="function"?tu.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Yh;tu&&typeof tu.ownKeys=="function"?Yh=tu.ownKeys:Object.getOwnPropertySymbols?Yh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Yh=function(e){return Object.getOwnPropertyNames(e)};function zC(t){console&&console.warn&&console.warn(t)}var y2=Number.isNaN||function(e){return e!==e};function Rr(){Rr.init.call(this)}Gg.exports=Rr,Gg.exports.once=VC,Rr.EventEmitter=Rr,Rr.prototype._events=void 0,Rr.prototype._eventsCount=0,Rr.prototype._maxListeners=void 0;var w2=10;function Jh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Rr,"defaultMaxListeners",{enumerable:!0,get:function(){return w2},set:function(t){if(typeof t!="number"||t<0||y2(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");w2=t}}),Rr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Rr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||y2(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function x2(t){return t._maxListeners===void 0?Rr.defaultMaxListeners:t._maxListeners}Rr.prototype.getMaxListeners=function(){return x2(this)},Rr.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")b2(u,this,r);else for(var l=u.length,d=P2(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,zC(a)}return t}Rr.prototype.addListener=function(e,r){return _2(this,e,r,!1)},Rr.prototype.on=Rr.prototype.addListener,Rr.prototype.prependListener=function(e,r){return _2(this,e,r,!0)};function HC(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function E2(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=HC.bind(n);return i.listener=r,n.wrapFn=i,i}Rr.prototype.once=function(e,r){return Jh(r),this.on(e,E2(this,e,r)),this},Rr.prototype.prependOnceListener=function(e,r){return Jh(r),this.prependListener(e,E2(this,e,r)),this},Rr.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Jh(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():WC(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Rr.prototype.off=Rr.prototype.removeListener,Rr.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function S2(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?KC(i):P2(i,i.length)}Rr.prototype.listeners=function(e){return S2(this,e,!0)},Rr.prototype.rawListeners=function(e){return S2(this,e,!1)},Rr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):A2.call(t,e)},Rr.prototype.listenerCount=A2;function A2(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Rr.prototype.eventNames=function(){return this._eventsCount>0?Yh(this._events):[]};function P2(t,e){for(var r=new Array(e),n=0;n=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function ZC(t,e){return function(r,n){e(r,n,t)}}function QC(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function eT(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(d){try{l(n.next(d))}catch(g){o(g)}}function u(d){try{l(n.throw(d))}catch(g){o(g)}}function l(d){d.done?s(d.value):i(d.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function tT(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return u([l,d])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function I2(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function iT(){for(var t=[],e=0;e1||a(y,A)})})}function a(y,A){try{u(n[y](A))}catch(P){g(s[0][3],P)}}function u(y){y.value instanceof Wf?Promise.resolve(y.value.v).then(l,d):g(s[0][2],y)}function l(y){a("next",y)}function d(y){a("throw",y)}function g(y,A){y(A),s.shift(),s.length&&a(s[0][0],s[0][1])}}function aT(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Wf(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function cT(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Xg=="function"?Xg(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function uT(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function fT(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function lT(t){return t&&t.__esModule?t:{default:t}}function hT(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function dT(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const Kf=Jp(Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Jg},__asyncDelegator:aT,__asyncGenerator:oT,__asyncValues:cT,__await:Wf,__awaiter:eT,__classPrivateFieldGet:hT,__classPrivateFieldSet:dT,__createBinding:rT,__decorate:XC,__exportStar:nT,__extends:YC,__generator:tT,__importDefault:lT,__importStar:fT,__makeTemplateObject:uT,__metadata:QC,__param:ZC,__read:I2,__rest:JC,__spread:iT,__spreadArrays:sT,__values:Xg},Symbol.toStringTag,{value:"Module"})));var Zg={},Vf={},C2;function pT(){if(C2)return Vf;C2=1,Object.defineProperty(Vf,"__esModule",{value:!0}),Vf.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Vf.delay=t,Vf}var ja={},Qg={},qa={},T2;function gT(){return T2||(T2=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.ONE_THOUSAND=qa.ONE_HUNDRED=void 0,qa.ONE_HUNDRED=100,qa.ONE_THOUSAND=1e3),qa}var em={},R2;function mT(){return R2||(R2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(em)),em}var D2;function O2(){return D2||(D2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Kf;e.__exportStar(gT(),t),e.__exportStar(mT(),t)}(Qg)),Qg}var N2;function vT(){if(N2)return ja;N2=1,Object.defineProperty(ja,"__esModule",{value:!0}),ja.fromMiliseconds=ja.toMiliseconds=void 0;const t=O2();function e(n){return n*t.ONE_THOUSAND}ja.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return ja.fromMiliseconds=r,ja}var L2;function bT(){return L2||(L2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Kf;e.__exportStar(pT(),t),e.__exportStar(vT(),t)}(Zg)),Zg}var ru={},k2;function yT(){if(k2)return ru;k2=1,Object.defineProperty(ru,"__esModule",{value:!0}),ru.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return ru.Watch=t,ru.default=t,ru}var tm={},Gf={},$2;function wT(){if($2)return Gf;$2=1,Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.IWatch=void 0;class t{}return Gf.IWatch=t,Gf}var B2;function xT(){return B2||(B2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Kf.__exportStar(wT(),t)}(tm)),tm}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Kf;e.__exportStar(bT(),t),e.__exportStar(yT(),t),e.__exportStar(xT(),t),e.__exportStar(O2(),t)})(mt);class za{}let _T=class extends za{constructor(e){super()}};const F2=mt.FIVE_SECONDS,nu={pulse:"heartbeat_pulse"};let ET=class $A extends _T{constructor(e){super(e),this.events=new qi.EventEmitter,this.interval=F2,this.interval=(e==null?void 0:e.interval)||F2}static async init(e){const r=new $A(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),mt.toMiliseconds(this.interval))}pulse(){this.events.emit(nu.pulse)}};const ST=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,AT=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,PT=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function MT(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){IT(t);return}return e}function IT(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Xh(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!PT.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(ST.test(t)||AT.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,MT)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function CT(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Cn(t,...e){try{return CT(t(...e))}catch(r){return Promise.reject(r)}}function TT(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function RT(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Zh(t){if(TT(t))return String(t);if(RT(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Zh(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function U2(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const rm="base64:";function DT(t){if(typeof t=="string")return t;U2();const e=Buffer.from(t).toString("base64");return rm+e}function OT(t){return typeof t!="string"||!t.startsWith(rm)?t:(U2(),Buffer.from(t.slice(rm.length),"base64"))}function pi(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function NT(...t){return pi(t.join(":"))}function Qh(t){return t=pi(t),t?t+":":""}function ooe(t){return t}const LT="memory",kT=()=>{const t=new Map;return{name:LT,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function $T(t={}){const e={mounts:{"":t.driver||kT()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const d of e.mountpoints)if(l.startsWith(d))return{base:d,relativeKey:l.slice(d.length),driver:e.mounts[d]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,d)=>e.mountpoints.filter(g=>g.startsWith(l)||d&&l.startsWith(g)).map(g=>({relativeBase:l.length>g.length?l.slice(g.length):void 0,mountpoint:g,driver:e.mounts[g]})),i=(l,d)=>{if(e.watching){d=pi(d);for(const g of e.watchListeners)g(l,d)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await j2(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,d,g)=>{const y=new Map,A=P=>{let N=y.get(P.base);return N||(N={driver:P.driver,base:P.base,items:[]},y.set(P.base,N)),N};for(const P of l){const N=typeof P=="string",D=pi(N?P:P.key),k=N?void 0:P.value,$=N||!P.options?d:{...d,...P.options},q=r(D);A(q).items.push({key:D,value:k,relativeKey:q.relativeKey,options:$})}return Promise.all([...y.values()].map(P=>g(P))).then(P=>P.flat())},u={hasItem(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return Cn(y.hasItem,g,d)},getItem(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return Cn(y.getItem,g,d).then(A=>Xh(A))},getItems(l,d){return a(l,d,g=>g.driver.getItems?Cn(g.driver.getItems,g.items.map(y=>({key:y.relativeKey,options:y.options})),d).then(y=>y.map(A=>({key:NT(g.base,A.key),value:Xh(A.value)}))):Promise.all(g.items.map(y=>Cn(g.driver.getItem,y.relativeKey,y.options).then(A=>({key:y.key,value:Xh(A)})))))},getItemRaw(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return y.getItemRaw?Cn(y.getItemRaw,g,d):Cn(y.getItem,g,d).then(A=>OT(A))},async setItem(l,d,g={}){if(d===void 0)return u.removeItem(l);l=pi(l);const{relativeKey:y,driver:A}=r(l);A.setItem&&(await Cn(A.setItem,y,Zh(d),g),A.watch||i("update",l))},async setItems(l,d){await a(l,d,async g=>{if(g.driver.setItems)return Cn(g.driver.setItems,g.items.map(y=>({key:y.relativeKey,value:Zh(y.value),options:y.options})),d);g.driver.setItem&&await Promise.all(g.items.map(y=>Cn(g.driver.setItem,y.relativeKey,Zh(y.value),y.options)))})},async setItemRaw(l,d,g={}){if(d===void 0)return u.removeItem(l,g);l=pi(l);const{relativeKey:y,driver:A}=r(l);if(A.setItemRaw)await Cn(A.setItemRaw,y,d,g);else if(A.setItem)await Cn(A.setItem,y,DT(d),g);else return;A.watch||i("update",l)},async removeItem(l,d={}){typeof d=="boolean"&&(d={removeMeta:d}),l=pi(l);const{relativeKey:g,driver:y}=r(l);y.removeItem&&(await Cn(y.removeItem,g,d),(d.removeMeta||d.removeMata)&&await Cn(y.removeItem,g+"$",d),y.watch||i("remove",l))},async getMeta(l,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),l=pi(l);const{relativeKey:g,driver:y}=r(l),A=Object.create(null);if(y.getMeta&&Object.assign(A,await Cn(y.getMeta,g,d)),!d.nativeOnly){const P=await Cn(y.getItem,g+"$",d).then(N=>Xh(N));P&&typeof P=="object"&&(typeof P.atime=="string"&&(P.atime=new Date(P.atime)),typeof P.mtime=="string"&&(P.mtime=new Date(P.mtime)),Object.assign(A,P))}return A},setMeta(l,d,g={}){return this.setItem(l+"$",d,g)},removeMeta(l,d={}){return this.removeItem(l+"$",d)},async getKeys(l,d={}){l=Qh(l);const g=n(l,!0);let y=[];const A=[];for(const P of g){const N=await Cn(P.driver.getKeys,P.relativeBase,d);for(const D of N){const k=P.mountpoint+pi(D);y.some($=>k.startsWith($))||A.push(k)}y=[P.mountpoint,...y.filter(D=>!D.startsWith(P.mountpoint))]}return l?A.filter(P=>P.startsWith(l)&&P[P.length-1]!=="$"):A.filter(P=>P[P.length-1]!=="$")},async clear(l,d={}){l=Qh(l),await Promise.all(n(l,!1).map(async g=>{if(g.driver.clear)return Cn(g.driver.clear,g.relativeBase,d);if(g.driver.removeItem){const y=await g.driver.getKeys(g.relativeBase||"",d);return Promise.all(y.map(A=>g.driver.removeItem(A,d)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>q2(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(d=>d!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,d){if(l=Qh(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((g,y)=>y.length-g.length)),e.mounts[l]=d,e.watching&&Promise.resolve(j2(d,i,l)).then(g=>{e.unwatch[l]=g}).catch(console.error),u},async unmount(l,d=!0){l=Qh(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),d&&await q2(e.mounts[l]),e.mountpoints=e.mountpoints.filter(g=>g!==l),delete e.mounts[l])},getMount(l=""){l=pi(l)+":";const d=r(l);return{driver:d.driver,base:d.base}},getMounts(l="",d={}){return l=pi(l),n(l,d.parents).map(y=>({driver:y.driver,base:y.mountpoint}))},keys:(l,d={})=>u.getKeys(l,d),get:(l,d={})=>u.getItem(l,d),set:(l,d,g={})=>u.setItem(l,d,g),has:(l,d={})=>u.hasItem(l,d),del:(l,d={})=>u.removeItem(l,d),remove:(l,d={})=>u.removeItem(l,d)};return u}function j2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function q2(t){typeof t.dispose=="function"&&await Cn(t.dispose)}function Ha(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function z2(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Ha(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let nm;function Yf(){return nm||(nm=z2("keyval-store","keyval")),nm}function H2(t,e=Yf()){return e("readonly",r=>Ha(r.get(t)))}function BT(t,e,r=Yf()){return r("readwrite",n=>(n.put(e,t),Ha(n.transaction)))}function FT(t,e=Yf()){return e("readwrite",r=>(r.delete(t),Ha(r.transaction)))}function UT(t=Yf()){return t("readwrite",e=>(e.clear(),Ha(e.transaction)))}function jT(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Ha(t.transaction)}function qT(t=Yf()){return t("readonly",e=>{if(e.getAllKeys)return Ha(e.getAllKeys());const r=[];return jT(e,n=>r.push(n.key)).then(()=>r)})}const zT=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),HT=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Wa(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return HT(t)}catch{return t}}function go(t){return typeof t=="string"?t:zT(t)||""}const WT="idb-keyval";var KT=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=z2(t.dbName,t.storeName)),{name:WT,options:t,async hasItem(i){return!(typeof await H2(r(i),n)>"u")},async getItem(i){return await H2(r(i),n)??null},setItem(i,s){return BT(r(i),s,n)},removeItem(i){return FT(r(i),n)},getKeys(){return qT(n)},clear(){return UT(n)}}};const VT="WALLET_CONNECT_V2_INDEXED_DB",GT="keyvaluestorage";let YT=class{constructor(){this.indexedDb=$T({driver:KT({dbName:VT,storeName:GT})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,go(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var im=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ed={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof im<"u"&&im.localStorage?ed.exports=im.localStorage:typeof window<"u"&&window.localStorage?ed.exports=window.localStorage:ed.exports=new e})();function JT(t){var e;return[t[0],Wa((e=t[1])!=null?e:"")]}let XT=class{constructor(){this.localStorage=ed.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(JT)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Wa(r)}async setItem(e,r){this.localStorage.setItem(e,go(r))}async removeItem(e){this.localStorage.removeItem(e)}};const ZT="wc_storage_version",W2=1,QT=async(t,e,r)=>{const n=ZT,i=await e.getItem(n);if(i&&i>=W2){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,W2),r(e),eR(t,o)},eR=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let tR=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new XT;this.storage=e;try{const r=new YT;QT(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function rR(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var nR=iR;function iR(t,e,r){var n=r&&r.stringify||rR,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?g:0,t.charCodeAt(A+1)){case 100:case 102:if(d>=u||e[d]==null)break;g=u||e[d]==null)break;g=u||e[d]===void 0)break;g",g=A+2,A++;break}l+=n(e[d]),g=A+2,A++;break;case 115:if(d>=u)break;g-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",u=Object.create(r);u.log||(u.log=Xf),Object.defineProperty(u,"levelVal",{get:d}),Object.defineProperty(u,"level",{get:g,set:y});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:lR(t)};u.levels=mo.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Xf,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=A,e&&(u._logEvent=sm());function d(){return this.level==="silent"?1/0:this.levels.values[this.level]}function g(){return this._level}function y(P){if(P!=="silent"&&!this.levels.values[P])throw Error("unknown level "+P);this._level=P,su(l,u,"error","log"),su(l,u,"fatal","error"),su(l,u,"warn","error"),su(l,u,"info","log"),su(l,u,"debug","log"),su(l,u,"trace","log")}function A(P,N){if(!P)throw new Error("missing bindings for child Pino");N=N||{},i&&P.serializers&&(N.serializers=P.serializers);const D=N.serializers;if(i&&D){var k=Object.assign({},n,D),$=t.browser.serialize===!0?Object.keys(k):i;delete P.serializers,td([P],$,k,this._stdErrSerialize)}function q(U){this._childLevel=(U._childLevel|0)+1,this.error=ou(U,P,"error"),this.fatal=ou(U,P,"fatal"),this.warn=ou(U,P,"warn"),this.info=ou(U,P,"info"),this.debug=ou(U,P,"debug"),this.trace=ou(U,P,"trace"),k&&(this.serializers=k,this._serialize=$),e&&(this._logEvent=sm([].concat(U._logEvent.bindings,P)))}return q.prototype=this,new q(this)}return u}mo.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},mo.stdSerializers=sR,mo.stdTimeFunctions=Object.assign({},{nullTime:V2,epochTime:G2,unixTime:hR,isoTime:dR});function su(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Xf:i[r]?i[r]:Jf[r]||Jf[n]||Xf,aR(t,e,r)}function aR(t,e,r){!t.transmit&&e[r]===Xf||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Jf?Jf:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function ou(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},J2=class{constructor(e,r=am){this.level=e??"error",this.levelValue=iu.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Y2(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===iu.levels.values.error?console.error(e):r===iu.levels.values.warn?console.warn(e):r===iu.levels.values.debug?console.debug(e):r===iu.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(go({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new Y2(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(go({extraMetadata:e})),new Blob(r,{type:"application/json"})}},vR=class{constructor(e,r=am){this.baseChunkLogger=new J2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},bR=class{constructor(e,r=am){this.baseChunkLogger=new J2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var yR=Object.defineProperty,wR=Object.defineProperties,xR=Object.getOwnPropertyDescriptors,X2=Object.getOwnPropertySymbols,_R=Object.prototype.hasOwnProperty,ER=Object.prototype.propertyIsEnumerable,Z2=(t,e,r)=>e in t?yR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nd=(t,e)=>{for(var r in e||(e={}))_R.call(e,r)&&Z2(t,r,e[r]);if(X2)for(var r of X2(e))ER.call(e,r)&&Z2(t,r,e[r]);return t},id=(t,e)=>wR(t,xR(e));function sd(t){return id(nd({},t),{level:(t==null?void 0:t.level)||gR.level})}function SR(t,e=Qf){return t[e]||""}function AR(t,e,r=Qf){return t[r]=e,t}function gi(t,e=Qf){let r="";return typeof t.bindings>"u"?r=SR(t,e):r=t.bindings().context||"",r}function PR(t,e,r=Qf){const n=gi(t,r);return n.trim()?`${n}/${e}`:e}function ri(t,e,r=Qf){const n=PR(t,e,r),i=t.child({context:n});return AR(i,n,r)}function MR(t){var e,r;const n=new vR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Zf(id(nd({},t.opts),{level:"trace",browser:id(nd({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function IR(t){var e;const r=new bR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Zf(id(nd({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function CR(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?MR(t):IR(t)}let TR=class extends za{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},RR=class extends za{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},DR=class{constructor(e,r){this.logger=e,this.core=r}},OR=class extends za{constructor(e,r){super(),this.relayer=e,this.logger=r}},NR=class extends za{constructor(e){super()}},LR=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},kR=class extends za{constructor(e,r){super(),this.relayer=e,this.logger=r}},$R=class extends za{constructor(e,r){super(),this.core=e,this.logger=r}},BR=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},FR=class{constructor(e,r){this.projectId=e,this.logger=r}},UR=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},jR=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},qR=class{constructor(e){this.client=e}};var cm={},ea={},od={},ad={};Object.defineProperty(ad,"__esModule",{value:!0}),ad.BrowserRandomSource=void 0;const Q2=65536;class zR{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let n=0;n>>16&65535,d=a&65535,g=u>>>16&65535,y=u&65535;return d*y+(l*y+d*g<<16>>>0)|0}t.mul=Math.imul||e;function r(a,u){return a+u|0}t.add=r;function n(a,u){return a-u|0}t.sub=n;function i(a,u){return a<>>32-u}t.rotl=i;function s(a,u){return a<<32-u|a>>>u}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(tx),Object.defineProperty(or,"__esModule",{value:!0});var rx=tx;function JR(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}or.readInt16BE=JR;function XR(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}or.readUint16BE=XR;function ZR(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}or.readInt16LE=ZR;function QR(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}or.readUint16LE=QR;function nx(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}or.writeUint16BE=nx,or.writeInt16BE=nx;function ix(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}or.writeUint16LE=ix,or.writeInt16LE=ix;function um(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}or.readInt32BE=um;function fm(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}or.readUint32BE=fm;function lm(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}or.readInt32LE=lm;function hm(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}or.readUint32LE=hm;function ud(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}or.writeUint32BE=ud,or.writeInt32BE=ud;function fd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}or.writeUint32LE=fd,or.writeInt32LE=fd;function eD(t,e){e===void 0&&(e=0);var r=um(t,e),n=um(t,e+4);return r*4294967296+n-(n>>31)*4294967296}or.readInt64BE=eD;function tD(t,e){e===void 0&&(e=0);var r=fm(t,e),n=fm(t,e+4);return r*4294967296+n}or.readUint64BE=tD;function rD(t,e){e===void 0&&(e=0);var r=lm(t,e),n=lm(t,e+4);return n*4294967296+r-(r>>31)*4294967296}or.readInt64LE=rD;function nD(t,e){e===void 0&&(e=0);var r=hm(t,e),n=hm(t,e+4);return n*4294967296+r}or.readUint64LE=nD;function sx(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ud(t/4294967296>>>0,e,r),ud(t>>>0,e,r+4),e}or.writeUint64BE=sx,or.writeInt64BE=sx;function ox(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fd(t>>>0,e,r),fd(t/4294967296>>>0,e,r+4),e}or.writeUint64LE=ox,or.writeInt64LE=ox;function iD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}or.readUintBE=iD;function sD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}or.writeUintBE=oD;function aD(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!rx.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s256)throw new Error("randomString charset is too long");let y="";const A=d.length,P=256-256%A;for(;l>0;){const N=i(Math.ceil(l*256/P),g);for(let D=0;D0;D++){const k=N[D];k0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,g=l/536870912|0,y=l<<3,A=l%128<112?128:256;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._stateHi.set(u.stateHi),this._stateLo.set(u.stateLo),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.stateHi),r.wipe(u.stateLo),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,u,l,d,g,y,A){for(var P=l[0],N=l[1],D=l[2],k=l[3],$=l[4],q=l[5],U=l[6],K=l[7],J=d[0],T=d[1],z=d[2],ue=d[3],_e=d[4],G=d[5],E=d[6],m=d[7],f,p,v,x,_,S,b,M;A>=128;){for(var I=0;I<16;I++){var F=8*I+y;a[I]=e.readUint32BE(g,F),u[I]=e.readUint32BE(g,F+4)}for(var I=0;I<80;I++){var ae=P,O=N,se=D,ee=k,X=$,Q=q,R=U,Z=K,te=J,le=T,ie=z,fe=ue,ve=_e,Me=G,Ne=E,Te=m;if(f=K,p=m,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=($>>>14|_e<<18)^($>>>18|_e<<14)^(_e>>>9|$<<23),p=(_e>>>14|$<<18)^(_e>>>18|$<<14)^($>>>9|_e<<23),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=$&q^~$&U,p=_e&G^~_e&E,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=i[I*2],p=i[I*2+1],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=a[I%16],p=u[I%16],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,v=b&65535|M<<16,x=_&65535|S<<16,f=v,p=x,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=(P>>>28|J<<4)^(J>>>2|P<<30)^(J>>>7|P<<25),p=(J>>>28|P<<4)^(P>>>2|J<<30)^(P>>>7|J<<25),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=P&N^P&D^N&D,p=J&T^J&z^T&z,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,Z=b&65535|M<<16,Te=_&65535|S<<16,f=ee,p=fe,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=v,p=x,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,ee=b&65535|M<<16,fe=_&65535|S<<16,N=ae,D=O,k=se,$=ee,q=X,U=Q,K=R,P=Z,T=te,z=le,ue=ie,_e=fe,G=ve,E=Me,m=Ne,J=Te,I%16===15)for(var F=0;F<16;F++)f=a[F],p=u[F],_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=a[(F+9)%16],p=u[(F+9)%16],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,v=a[(F+1)%16],x=u[(F+1)%16],f=(v>>>1|x<<31)^(v>>>8|x<<24)^v>>>7,p=(x>>>1|v<<31)^(x>>>8|v<<24)^(x>>>7|v<<25),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,v=a[(F+14)%16],x=u[(F+14)%16],f=(v>>>19|x<<13)^(x>>>29|v<<3)^v>>>6,p=(x>>>19|v<<13)^(v>>>29|x<<3)^(x>>>6|v<<26),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,a[F]=b&65535|M<<16,u[F]=_&65535|S<<16}f=P,p=J,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[0],p=d[0],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[0]=P=b&65535|M<<16,d[0]=J=_&65535|S<<16,f=N,p=T,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[1],p=d[1],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[1]=N=b&65535|M<<16,d[1]=T=_&65535|S<<16,f=D,p=z,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[2],p=d[2],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[2]=D=b&65535|M<<16,d[2]=z=_&65535|S<<16,f=k,p=ue,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[3],p=d[3],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[3]=k=b&65535|M<<16,d[3]=ue=_&65535|S<<16,f=$,p=_e,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[4],p=d[4],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[4]=$=b&65535|M<<16,d[4]=_e=_&65535|S<<16,f=q,p=G,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[5],p=d[5],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[5]=q=b&65535|M<<16,d[5]=G=_&65535|S<<16,f=U,p=E,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[6],p=d[6],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[6]=U=b&65535|M<<16,d[6]=E=_&65535|S<<16,f=K,p=m,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[7],p=d[7],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[7]=K=b&65535|M<<16,d[7]=m=_&65535|S<<16,y+=128,A-=128}return y}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ax),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=ea,r=ax,n=Mi;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(ee){const X=new Float64Array(16);if(ee)for(let Q=0;Q>16&1),Q[le-1]&=65535;Q[15]=R[15]-32767-(Q[14]>>16&1);const te=Q[15]>>16&1;Q[14]&=65535,N(R,Q,1-te)}for(let Z=0;Z<16;Z++)ee[2*Z]=R[Z]&255,ee[2*Z+1]=R[Z]>>8}function k(ee,X){let Q=0;for(let R=0;R<32;R++)Q|=ee[R]^X[R];return(1&Q-1>>>8)-1}function $(ee,X){const Q=new Uint8Array(32),R=new Uint8Array(32);return D(Q,ee),D(R,X),k(Q,R)}function q(ee){const X=new Uint8Array(32);return D(X,ee),X[0]&1}function U(ee,X){for(let Q=0;Q<16;Q++)ee[Q]=X[2*Q]+(X[2*Q+1]<<8);ee[15]&=32767}function K(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]+Q[R]}function J(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]-Q[R]}function T(ee,X,Q){let R,Z,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,Be=0,Ie=0,Le=0,Ve=0,ke=0,ze=0,He=0,Ee=0,Qe=0,ct=0,$e=0,et=0,rt=0,Je=0,pt=0,ht=0,ft=0,Ht=0,Jt=0,St=0,er=0,Xt=0,Ot=0,$t=Q[0],Tt=Q[1],vt=Q[2],Dt=Q[3],Lt=Q[4],bt=Q[5],Bt=Q[6],Ut=Q[7],nt=Q[8],Ft=Q[9],B=Q[10],H=Q[11],V=Q[12],C=Q[13],Y=Q[14],j=Q[15];R=X[0],te+=R*$t,le+=R*Tt,ie+=R*vt,fe+=R*Dt,ve+=R*Lt,Me+=R*bt,Ne+=R*Bt,Te+=R*Ut,Be+=R*nt,Ie+=R*Ft,Le+=R*B,Ve+=R*H,ke+=R*V,ze+=R*C,He+=R*Y,Ee+=R*j,R=X[1],le+=R*$t,ie+=R*Tt,fe+=R*vt,ve+=R*Dt,Me+=R*Lt,Ne+=R*bt,Te+=R*Bt,Be+=R*Ut,Ie+=R*nt,Le+=R*Ft,Ve+=R*B,ke+=R*H,ze+=R*V,He+=R*C,Ee+=R*Y,Qe+=R*j,R=X[2],ie+=R*$t,fe+=R*Tt,ve+=R*vt,Me+=R*Dt,Ne+=R*Lt,Te+=R*bt,Be+=R*Bt,Ie+=R*Ut,Le+=R*nt,Ve+=R*Ft,ke+=R*B,ze+=R*H,He+=R*V,Ee+=R*C,Qe+=R*Y,ct+=R*j,R=X[3],fe+=R*$t,ve+=R*Tt,Me+=R*vt,Ne+=R*Dt,Te+=R*Lt,Be+=R*bt,Ie+=R*Bt,Le+=R*Ut,Ve+=R*nt,ke+=R*Ft,ze+=R*B,He+=R*H,Ee+=R*V,Qe+=R*C,ct+=R*Y,$e+=R*j,R=X[4],ve+=R*$t,Me+=R*Tt,Ne+=R*vt,Te+=R*Dt,Be+=R*Lt,Ie+=R*bt,Le+=R*Bt,Ve+=R*Ut,ke+=R*nt,ze+=R*Ft,He+=R*B,Ee+=R*H,Qe+=R*V,ct+=R*C,$e+=R*Y,et+=R*j,R=X[5],Me+=R*$t,Ne+=R*Tt,Te+=R*vt,Be+=R*Dt,Ie+=R*Lt,Le+=R*bt,Ve+=R*Bt,ke+=R*Ut,ze+=R*nt,He+=R*Ft,Ee+=R*B,Qe+=R*H,ct+=R*V,$e+=R*C,et+=R*Y,rt+=R*j,R=X[6],Ne+=R*$t,Te+=R*Tt,Be+=R*vt,Ie+=R*Dt,Le+=R*Lt,Ve+=R*bt,ke+=R*Bt,ze+=R*Ut,He+=R*nt,Ee+=R*Ft,Qe+=R*B,ct+=R*H,$e+=R*V,et+=R*C,rt+=R*Y,Je+=R*j,R=X[7],Te+=R*$t,Be+=R*Tt,Ie+=R*vt,Le+=R*Dt,Ve+=R*Lt,ke+=R*bt,ze+=R*Bt,He+=R*Ut,Ee+=R*nt,Qe+=R*Ft,ct+=R*B,$e+=R*H,et+=R*V,rt+=R*C,Je+=R*Y,pt+=R*j,R=X[8],Be+=R*$t,Ie+=R*Tt,Le+=R*vt,Ve+=R*Dt,ke+=R*Lt,ze+=R*bt,He+=R*Bt,Ee+=R*Ut,Qe+=R*nt,ct+=R*Ft,$e+=R*B,et+=R*H,rt+=R*V,Je+=R*C,pt+=R*Y,ht+=R*j,R=X[9],Ie+=R*$t,Le+=R*Tt,Ve+=R*vt,ke+=R*Dt,ze+=R*Lt,He+=R*bt,Ee+=R*Bt,Qe+=R*Ut,ct+=R*nt,$e+=R*Ft,et+=R*B,rt+=R*H,Je+=R*V,pt+=R*C,ht+=R*Y,ft+=R*j,R=X[10],Le+=R*$t,Ve+=R*Tt,ke+=R*vt,ze+=R*Dt,He+=R*Lt,Ee+=R*bt,Qe+=R*Bt,ct+=R*Ut,$e+=R*nt,et+=R*Ft,rt+=R*B,Je+=R*H,pt+=R*V,ht+=R*C,ft+=R*Y,Ht+=R*j,R=X[11],Ve+=R*$t,ke+=R*Tt,ze+=R*vt,He+=R*Dt,Ee+=R*Lt,Qe+=R*bt,ct+=R*Bt,$e+=R*Ut,et+=R*nt,rt+=R*Ft,Je+=R*B,pt+=R*H,ht+=R*V,ft+=R*C,Ht+=R*Y,Jt+=R*j,R=X[12],ke+=R*$t,ze+=R*Tt,He+=R*vt,Ee+=R*Dt,Qe+=R*Lt,ct+=R*bt,$e+=R*Bt,et+=R*Ut,rt+=R*nt,Je+=R*Ft,pt+=R*B,ht+=R*H,ft+=R*V,Ht+=R*C,Jt+=R*Y,St+=R*j,R=X[13],ze+=R*$t,He+=R*Tt,Ee+=R*vt,Qe+=R*Dt,ct+=R*Lt,$e+=R*bt,et+=R*Bt,rt+=R*Ut,Je+=R*nt,pt+=R*Ft,ht+=R*B,ft+=R*H,Ht+=R*V,Jt+=R*C,St+=R*Y,er+=R*j,R=X[14],He+=R*$t,Ee+=R*Tt,Qe+=R*vt,ct+=R*Dt,$e+=R*Lt,et+=R*bt,rt+=R*Bt,Je+=R*Ut,pt+=R*nt,ht+=R*Ft,ft+=R*B,Ht+=R*H,Jt+=R*V,St+=R*C,er+=R*Y,Xt+=R*j,R=X[15],Ee+=R*$t,Qe+=R*Tt,ct+=R*vt,$e+=R*Dt,et+=R*Lt,rt+=R*bt,Je+=R*Bt,pt+=R*Ut,ht+=R*nt,ft+=R*Ft,Ht+=R*B,Jt+=R*H,St+=R*V,er+=R*C,Xt+=R*Y,Ot+=R*j,te+=38*Qe,le+=38*ct,ie+=38*$e,fe+=38*et,ve+=38*rt,Me+=38*Je,Ne+=38*pt,Te+=38*ht,Be+=38*ft,Ie+=38*Ht,Le+=38*Jt,Ve+=38*St,ke+=38*er,ze+=38*Xt,He+=38*Ot,Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=Be+Z+65535,Z=Math.floor(R/65536),Be=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=Be+Z+65535,Z=Math.floor(R/65536),Be=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),ee[0]=te,ee[1]=le,ee[2]=ie,ee[3]=fe,ee[4]=ve,ee[5]=Me,ee[6]=Ne,ee[7]=Te,ee[8]=Be,ee[9]=Ie,ee[10]=Le,ee[11]=Ve,ee[12]=ke,ee[13]=ze,ee[14]=He,ee[15]=Ee}function z(ee,X){T(ee,X,X)}function ue(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=253;R>=0;R--)z(Q,Q),R!==2&&R!==4&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function _e(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=250;R>=0;R--)z(Q,Q),R!==1&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function G(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i(),ve=i(),Me=i();J(Q,ee[1],ee[0]),J(Me,X[1],X[0]),T(Q,Q,Me),K(R,ee[0],ee[1]),K(Me,X[0],X[1]),T(R,R,Me),T(Z,ee[3],X[3]),T(Z,Z,l),T(te,ee[2],X[2]),K(te,te,te),J(le,R,Q),J(ie,te,Z),K(fe,te,Z),K(ve,R,Q),T(ee[0],le,ie),T(ee[1],ve,fe),T(ee[2],fe,ie),T(ee[3],le,ve)}function E(ee,X,Q){for(let R=0;R<4;R++)N(ee[R],X[R],Q)}function m(ee,X){const Q=i(),R=i(),Z=i();ue(Z,X[2]),T(Q,X[0],Z),T(R,X[1],Z),D(ee,R),ee[31]^=q(Q)<<7}function f(ee,X,Q){A(ee[0],o),A(ee[1],a),A(ee[2],a),A(ee[3],o);for(let R=255;R>=0;--R){const Z=Q[R/8|0]>>(R&7)&1;E(ee,X,Z),G(X,ee),G(ee,ee),E(ee,X,Z)}}function p(ee,X){const Q=[i(),i(),i(),i()];A(Q[0],d),A(Q[1],g),A(Q[2],a),T(Q[3],d,g),f(ee,Q,X)}function v(ee){if(ee.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const X=(0,r.hash)(ee);X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(32),R=[i(),i(),i(),i()];p(R,X),m(Q,R);const Z=new Uint8Array(64);return Z.set(ee),Z.set(Q,32),{publicKey:Q,secretKey:Z}}t.generateKeyPairFromSeed=v;function x(ee){const X=(0,e.randomBytes)(32,ee),Q=v(X);return(0,n.wipe)(X),Q}t.generateKeyPair=x;function _(ee){if(ee.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(ee.subarray(32))}t.extractPublicKeyFromSecretKey=_;const S=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function b(ee,X){let Q,R,Z,te;for(R=63;R>=32;--R){for(Q=0,Z=R-32,te=R-12;Z>4)*S[Z],Q=X[Z]>>8,X[Z]&=255;for(Z=0;Z<32;Z++)X[Z]-=Q*S[Z];for(R=0;R<32;R++)X[R+1]+=X[R]>>8,ee[R]=X[R]&255}function M(ee){const X=new Float64Array(64);for(let Q=0;Q<64;Q++)X[Q]=ee[Q];for(let Q=0;Q<64;Q++)ee[Q]=0;b(ee,X)}function I(ee,X){const Q=new Float64Array(64),R=[i(),i(),i(),i()],Z=(0,r.hash)(ee.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(64);te.set(Z.subarray(32),32);const le=new r.SHA512;le.update(te.subarray(32)),le.update(X);const ie=le.digest();le.clean(),M(ie),p(R,ie),m(te,R),le.reset(),le.update(te.subarray(0,32)),le.update(ee.subarray(32)),le.update(X);const fe=le.digest();M(fe);for(let ve=0;ve<32;ve++)Q[ve]=ie[ve];for(let ve=0;ve<32;ve++)for(let Me=0;Me<32;Me++)Q[ve+Me]+=fe[ve]*Z[Me];return b(te.subarray(32),Q),te}t.sign=I;function F(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i();return A(ee[2],a),U(ee[1],X),z(Z,ee[1]),T(te,Z,u),J(Z,Z,ee[2]),K(te,ee[2],te),z(le,te),z(ie,le),T(fe,ie,le),T(Q,fe,Z),T(Q,Q,te),_e(Q,Q),T(Q,Q,Z),T(Q,Q,te),T(Q,Q,te),T(ee[0],Q,te),z(R,ee[0]),T(R,R,te),$(R,Z)&&T(ee[0],ee[0],y),z(R,ee[0]),T(R,R,te),$(R,Z)?-1:(q(ee[0])===X[31]>>7&&J(ee[0],o,ee[0]),T(ee[3],ee[0],ee[1]),0)}function ae(ee,X,Q){const R=new Uint8Array(32),Z=[i(),i(),i(),i()],te=[i(),i(),i(),i()];if(Q.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(F(te,ee))return!1;const le=new r.SHA512;le.update(Q.subarray(0,32)),le.update(ee),le.update(X);const ie=le.digest();return M(ie),f(Z,te,ie),p(te,Q.subarray(32)),G(Z,te),m(R,Z),!k(Q,R)}t.verify=ae;function O(ee){let X=[i(),i(),i(),i()];if(F(X,ee))throw new Error("Ed25519: invalid public key");let Q=i(),R=i(),Z=X[1];K(Q,a,Z),J(R,a,Z),ue(R,R),T(Q,Q,R);let te=new Uint8Array(32);return D(te,Q),te}t.convertPublicKeyToX25519=O;function se(ee){const X=(0,r.hash)(ee.subarray(0,32));X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(X.subarray(0,32));return(0,n.wipe)(X),Q}t.convertSecretKeyToX25519=se}(cm);const mD="EdDSA",vD="JWT",ld=".",hd="base64url",cx="utf8",ux="utf8",bD=":",yD="did",wD="key",fx="base58btc",xD="z",_D="K36",ED=32;function lx(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function dd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=lx(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function SD(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(q);k!==$;){for(var K=P[k],J=0,T=q-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=q-D;z!==q&&U[z]===0;)z++;for(var ue=u.repeat(N);z>>0,q=new Uint8Array($);P[N];){var U=r[P.charCodeAt(N)];if(U===255)return;for(var K=0,J=$-1;(U!==0||K>>0,q[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,N++}if(P[N]!==" "){for(var T=$-k;T!==$&&q[T]===0;)T++;for(var z=new Uint8Array(D+($-T)),ue=D;T!==$;)z[ue++]=q[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:g,decodeUnsafe:y,decode:A}}var AD=SD,PD=AD;const MD=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},ID=t=>new TextEncoder().encode(t),CD=t=>new TextDecoder().decode(t);class TD{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class RD{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return hx(this,e)}}class DD{constructor(e){this.decoders=e}or(e){return hx(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const hx=(t,e)=>new DD({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class OD{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new TD(e,r,n),this.decoder=new RD(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const pd=({name:t,prefix:e,encode:r,decode:n})=>new OD(t,e,r,n),tl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=PD(r,e);return pd({prefix:t,name:e,encode:n,decode:s=>MD(i(s))})},ND=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},LD=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<pd({prefix:e,name:t,encode(i){return LD(i,n,r)},decode(i){return ND(i,n,r,t)}}),kD=pd({prefix:"\0",name:"identity",encode:t=>CD(t),decode:t=>ID(t)}),$D=Object.freeze(Object.defineProperty({__proto__:null,identity:kD},Symbol.toStringTag,{value:"Module"})),BD=Fn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),FD=Object.freeze(Object.defineProperty({__proto__:null,base2:BD},Symbol.toStringTag,{value:"Module"})),UD=Fn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),jD=Object.freeze(Object.defineProperty({__proto__:null,base8:UD},Symbol.toStringTag,{value:"Module"})),qD=tl({prefix:"9",name:"base10",alphabet:"0123456789"}),zD=Object.freeze(Object.defineProperty({__proto__:null,base10:qD},Symbol.toStringTag,{value:"Module"})),HD=Fn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),WD=Fn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),KD=Object.freeze(Object.defineProperty({__proto__:null,base16:HD,base16upper:WD},Symbol.toStringTag,{value:"Module"})),VD=Fn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),GD=Fn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),YD=Fn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),JD=Fn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),XD=Fn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ZD=Fn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),QD=Fn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),eO=Fn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),tO=Fn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),rO=Object.freeze(Object.defineProperty({__proto__:null,base32:VD,base32hex:XD,base32hexpad:QD,base32hexpadupper:eO,base32hexupper:ZD,base32pad:YD,base32padupper:JD,base32upper:GD,base32z:tO},Symbol.toStringTag,{value:"Module"})),nO=tl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),iO=tl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),sO=Object.freeze(Object.defineProperty({__proto__:null,base36:nO,base36upper:iO},Symbol.toStringTag,{value:"Module"})),oO=tl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),aO=tl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),cO=Object.freeze(Object.defineProperty({__proto__:null,base58btc:oO,base58flickr:aO},Symbol.toStringTag,{value:"Module"})),uO=Fn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),fO=Fn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),lO=Fn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),hO=Fn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),dO=Object.freeze(Object.defineProperty({__proto__:null,base64:uO,base64pad:fO,base64url:lO,base64urlpad:hO},Symbol.toStringTag,{value:"Module"})),dx=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),pO=dx.reduce((t,e,r)=>(t[r]=e,t),[]),gO=dx.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function mO(t){return t.reduce((e,r)=>(e+=pO[r],e),"")}function vO(t){const e=[];for(const r of t){const n=gO[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const bO=pd({prefix:"🚀",name:"base256emoji",encode:mO,decode:vO}),yO=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:bO},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const px={...$D,...FD,...jD,...zD,...KD,...rO,...sO,...cO,...dO,...yO};function gx(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const mx=gx("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),dm=gx("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=lx(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new CO:typeof navigator<"u"?LO(navigator.userAgent):$O()}function NO(t){return t!==""&&DO.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function LO(t){var e=NO(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new IO;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<_x&&(i=xx(xx([],i,!0),BO(_x-i.length),!0)):i=[];var s=i.join("."),o=kO(t),a=RO.exec(t);return a&&a[1]?new MO(r,s,o,a[1]):new AO(r,s,o)}function kO(t){for(var e=0,r=Ex.length;e-1){const D=P.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let k=e.protocol+"//"+e.host;if(D.indexOf("/")===0)k+=D;else{const $=e.pathname.split("/");$.pop();const q=$.join("/");k+=q+"/"+D}y.push(k)}else if(D.indexOf("//")===0){const k=e.protocol+D;y.push(k)}else y.push(D)}}return y}function n(...g){const y=t.getElementsByTagName("meta");for(let A=0;AP.getAttribute(D)).filter(D=>D?g.includes(D):!1);if(N.length&&N){const D=P.getAttribute("content");if(D)return D}}return""}function i(){let g=n("name","og:site_name","og:title","twitter:title");return g||(g=t.title),g}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}Ax=mm.getWindowMetadata=YO;var nl={},JO=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Mx="%[a-f0-9]{2}",Ix=new RegExp("("+Mx+")|([^%]+?)","gi"),Cx=new RegExp("("+Mx+")+","gi");function vm(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],vm(r),vm(n))}function XO(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(Ix)||[],r=1;r{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},tN=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s$==null,o=Symbol("encodeFragmentIdentifier");function a($){switch($.arrayFormat){case"index":return q=>(U,K)=>{const J=U.length;return K===void 0||$.skipNull&&K===null||$.skipEmptyString&&K===""?U:K===null?[...U,[d(q,$),"[",J,"]"].join("")]:[...U,[d(q,$),"[",d(J,$),"]=",d(K,$)].join("")]};case"bracket":return q=>(U,K)=>K===void 0||$.skipNull&&K===null||$.skipEmptyString&&K===""?U:K===null?[...U,[d(q,$),"[]"].join("")]:[...U,[d(q,$),"[]=",d(K,$)].join("")];case"colon-list-separator":return q=>(U,K)=>K===void 0||$.skipNull&&K===null||$.skipEmptyString&&K===""?U:K===null?[...U,[d(q,$),":list="].join("")]:[...U,[d(q,$),":list=",d(K,$)].join("")];case"comma":case"separator":case"bracket-separator":{const q=$.arrayFormat==="bracket-separator"?"[]=":"=";return U=>(K,J)=>J===void 0||$.skipNull&&J===null||$.skipEmptyString&&J===""?K:(J=J===null?"":J,K.length===0?[[d(U,$),q,d(J,$)].join("")]:[[K,d(J,$)].join($.arrayFormatSeparator)])}default:return q=>(U,K)=>K===void 0||$.skipNull&&K===null||$.skipEmptyString&&K===""?U:K===null?[...U,d(q,$)]:[...U,[d(q,$),"=",d(K,$)].join("")]}}function u($){let q;switch($.arrayFormat){case"index":return(U,K,J)=>{if(q=/\[(\d*)\]$/.exec(U),U=U.replace(/\[\d*\]$/,""),!q){J[U]=K;return}J[U]===void 0&&(J[U]={}),J[U][q[1]]=K};case"bracket":return(U,K,J)=>{if(q=/(\[\])$/.exec(U),U=U.replace(/\[\]$/,""),!q){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"colon-list-separator":return(U,K,J)=>{if(q=/(:list)$/.exec(U),U=U.replace(/:list$/,""),!q){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"comma":case"separator":return(U,K,J)=>{const T=typeof K=="string"&&K.includes($.arrayFormatSeparator),z=typeof K=="string"&&!T&&g(K,$).includes($.arrayFormatSeparator);K=z?g(K,$):K;const ue=T||z?K.split($.arrayFormatSeparator).map(_e=>g(_e,$)):K===null?K:g(K,$);J[U]=ue};case"bracket-separator":return(U,K,J)=>{const T=/(\[\])$/.test(U);if(U=U.replace(/\[\]$/,""),!T){J[U]=K&&g(K,$);return}const z=K===null?[]:K.split($.arrayFormatSeparator).map(ue=>g(ue,$));if(J[U]===void 0){J[U]=z;return}J[U]=[].concat(J[U],z)};default:return(U,K,J)=>{if(J[U]===void 0){J[U]=K;return}J[U]=[].concat(J[U],K)}}}function l($){if(typeof $!="string"||$.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function d($,q){return q.encode?q.strict?e($):encodeURIComponent($):$}function g($,q){return q.decode?r($):$}function y($){return Array.isArray($)?$.sort():typeof $=="object"?y(Object.keys($)).sort((q,U)=>Number(q)-Number(U)).map(q=>$[q]):$}function A($){const q=$.indexOf("#");return q!==-1&&($=$.slice(0,q)),$}function P($){let q="";const U=$.indexOf("#");return U!==-1&&(q=$.slice(U)),q}function N($){$=A($);const q=$.indexOf("?");return q===-1?"":$.slice(q+1)}function D($,q){return q.parseNumbers&&!Number.isNaN(Number($))&&typeof $=="string"&&$.trim()!==""?$=Number($):q.parseBooleans&&$!==null&&($.toLowerCase()==="true"||$.toLowerCase()==="false")&&($=$.toLowerCase()==="true"),$}function k($,q){q=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},q),l(q.arrayFormatSeparator);const U=u(q),K=Object.create(null);if(typeof $!="string"||($=$.trim().replace(/^[?#&]/,""),!$))return K;for(const J of $.split("&")){if(J==="")continue;let[T,z]=n(q.decode?J.replace(/\+/g," "):J,"=");z=z===void 0?null:["comma","separator","bracket-separator"].includes(q.arrayFormat)?z:g(z,q),U(g(T,q),z,K)}for(const J of Object.keys(K)){const T=K[J];if(typeof T=="object"&&T!==null)for(const z of Object.keys(T))T[z]=D(T[z],q);else K[J]=D(T,q)}return q.sort===!1?K:(q.sort===!0?Object.keys(K).sort():Object.keys(K).sort(q.sort)).reduce((J,T)=>{const z=K[T];return z&&typeof z=="object"&&!Array.isArray(z)?J[T]=y(z):J[T]=z,J},Object.create(null))}t.extract=N,t.parse=k,t.stringify=($,q)=>{if(!$)return"";q=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},q),l(q.arrayFormatSeparator);const U=z=>q.skipNull&&s($[z])||q.skipEmptyString&&$[z]==="",K=a(q),J={};for(const z of Object.keys($))U(z)||(J[z]=$[z]);const T=Object.keys(J);return q.sort!==!1&&T.sort(q.sort),T.map(z=>{const ue=$[z];return ue===void 0?"":ue===null?d(z,q):Array.isArray(ue)?ue.length===0&&q.arrayFormat==="bracket-separator"?d(z,q)+"[]":ue.reduce(K(z),[]).join("&"):d(z,q)+"="+d(ue,q)}).filter(z=>z.length>0).join("&")},t.parseUrl=($,q)=>{q=Object.assign({decode:!0},q);const[U,K]=n($,"#");return Object.assign({url:U.split("?")[0]||"",query:k(N($),q)},q&&q.parseFragmentIdentifier&&K?{fragmentIdentifier:g(K,q)}:{})},t.stringifyUrl=($,q)=>{q=Object.assign({encode:!0,strict:!0,[o]:!0},q);const U=A($.url).split("?")[0]||"",K=t.extract($.url),J=t.parse(K,{sort:!1}),T=Object.assign(J,$.query);let z=t.stringify(T,q);z&&(z=`?${z}`);let ue=P($.url);return $.fragmentIdentifier&&(ue=`#${q[o]?d($.fragmentIdentifier,q):$.fragmentIdentifier}`),`${U}${z}${ue}`},t.pick=($,q,U)=>{U=Object.assign({parseFragmentIdentifier:!0,[o]:!1},U);const{url:K,query:J,fragmentIdentifier:T}=t.parseUrl($,U);return t.stringifyUrl({url:K,query:i(J,q),fragmentIdentifier:T},U)},t.exclude=($,q,U)=>{const K=Array.isArray(q)?J=>!q.includes(J):(J,T)=>!q(J,T);return t.pick($,K,U)}})(nl);var Tx={exports:{}};/** + ***************************************************************************** */var Jg=function(t,e){return Jg=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Jg(t,e)};function YC(t,e){Jg(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Xg=function(){return Xg=Object.assign||function(e){for(var r,n=1,i=arguments.length;n=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function ZC(t,e){return function(r,n){e(r,n,t)}}function QC(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function eT(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(d){try{l(n.next(d))}catch(g){o(g)}}function u(d){try{l(n.throw(d))}catch(g){o(g)}}function l(d){d.done?s(d.value):i(d.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function tT(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return u([l,d])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function I2(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function iT(){for(var t=[],e=0;e1||a(y,A)})})}function a(y,A){try{u(n[y](A))}catch(P){g(s[0][3],P)}}function u(y){y.value instanceof Wf?Promise.resolve(y.value.v).then(l,d):g(s[0][2],y)}function l(y){a("next",y)}function d(y){a("throw",y)}function g(y,A){y(A),s.shift(),s.length&&a(s[0][0],s[0][1])}}function aT(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Wf(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function cT(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Zg=="function"?Zg(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function uT(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function fT(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function lT(t){return t&&t.__esModule?t:{default:t}}function hT(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function dT(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const Kf=Jp(Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Xg},__asyncDelegator:aT,__asyncGenerator:oT,__asyncValues:cT,__await:Wf,__awaiter:eT,__classPrivateFieldGet:hT,__classPrivateFieldSet:dT,__createBinding:rT,__decorate:XC,__exportStar:nT,__extends:YC,__generator:tT,__importDefault:lT,__importStar:fT,__makeTemplateObject:uT,__metadata:QC,__param:ZC,__read:I2,__rest:JC,__spread:iT,__spreadArrays:sT,__values:Zg},Symbol.toStringTag,{value:"Module"})));var Qg={},Vf={},C2;function pT(){if(C2)return Vf;C2=1,Object.defineProperty(Vf,"__esModule",{value:!0}),Vf.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Vf.delay=t,Vf}var ja={},em={},qa={},T2;function gT(){return T2||(T2=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.ONE_THOUSAND=qa.ONE_HUNDRED=void 0,qa.ONE_HUNDRED=100,qa.ONE_THOUSAND=1e3),qa}var tm={},R2;function mT(){return R2||(R2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(tm)),tm}var D2;function O2(){return D2||(D2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Kf;e.__exportStar(gT(),t),e.__exportStar(mT(),t)}(em)),em}var N2;function vT(){if(N2)return ja;N2=1,Object.defineProperty(ja,"__esModule",{value:!0}),ja.fromMiliseconds=ja.toMiliseconds=void 0;const t=O2();function e(n){return n*t.ONE_THOUSAND}ja.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return ja.fromMiliseconds=r,ja}var L2;function bT(){return L2||(L2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Kf;e.__exportStar(pT(),t),e.__exportStar(vT(),t)}(Qg)),Qg}var ru={},k2;function yT(){if(k2)return ru;k2=1,Object.defineProperty(ru,"__esModule",{value:!0}),ru.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return ru.Watch=t,ru.default=t,ru}var rm={},Gf={},$2;function wT(){if($2)return Gf;$2=1,Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.IWatch=void 0;class t{}return Gf.IWatch=t,Gf}var B2;function xT(){return B2||(B2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Kf.__exportStar(wT(),t)}(rm)),rm}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Kf;e.__exportStar(bT(),t),e.__exportStar(yT(),t),e.__exportStar(xT(),t),e.__exportStar(O2(),t)})(mt);class za{}let _T=class extends za{constructor(e){super()}};const F2=mt.FIVE_SECONDS,nu={pulse:"heartbeat_pulse"};let ET=class $A extends _T{constructor(e){super(e),this.events=new qi.EventEmitter,this.interval=F2,this.interval=(e==null?void 0:e.interval)||F2}static async init(e){const r=new $A(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),mt.toMiliseconds(this.interval))}pulse(){this.events.emit(nu.pulse)}};const ST=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,AT=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,PT=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function MT(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){IT(t);return}return e}function IT(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Xh(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!PT.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(ST.test(t)||AT.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,MT)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function CT(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Cn(t,...e){try{return CT(t(...e))}catch(r){return Promise.reject(r)}}function TT(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function RT(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Zh(t){if(TT(t))return String(t);if(RT(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Zh(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function U2(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const nm="base64:";function DT(t){if(typeof t=="string")return t;U2();const e=Buffer.from(t).toString("base64");return nm+e}function OT(t){return typeof t!="string"||!t.startsWith(nm)?t:(U2(),Buffer.from(t.slice(nm.length),"base64"))}function pi(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function NT(...t){return pi(t.join(":"))}function Qh(t){return t=pi(t),t?t+":":""}function ooe(t){return t}const LT="memory",kT=()=>{const t=new Map;return{name:LT,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function $T(t={}){const e={mounts:{"":t.driver||kT()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const d of e.mountpoints)if(l.startsWith(d))return{base:d,relativeKey:l.slice(d.length),driver:e.mounts[d]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,d)=>e.mountpoints.filter(g=>g.startsWith(l)||d&&l.startsWith(g)).map(g=>({relativeBase:l.length>g.length?l.slice(g.length):void 0,mountpoint:g,driver:e.mounts[g]})),i=(l,d)=>{if(e.watching){d=pi(d);for(const g of e.watchListeners)g(l,d)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await j2(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,d,g)=>{const y=new Map,A=P=>{let N=y.get(P.base);return N||(N={driver:P.driver,base:P.base,items:[]},y.set(P.base,N)),N};for(const P of l){const N=typeof P=="string",D=pi(N?P:P.key),k=N?void 0:P.value,$=N||!P.options?d:{...d,...P.options},q=r(D);A(q).items.push({key:D,value:k,relativeKey:q.relativeKey,options:$})}return Promise.all([...y.values()].map(P=>g(P))).then(P=>P.flat())},u={hasItem(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return Cn(y.hasItem,g,d)},getItem(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return Cn(y.getItem,g,d).then(A=>Xh(A))},getItems(l,d){return a(l,d,g=>g.driver.getItems?Cn(g.driver.getItems,g.items.map(y=>({key:y.relativeKey,options:y.options})),d).then(y=>y.map(A=>({key:NT(g.base,A.key),value:Xh(A.value)}))):Promise.all(g.items.map(y=>Cn(g.driver.getItem,y.relativeKey,y.options).then(A=>({key:y.key,value:Xh(A)})))))},getItemRaw(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return y.getItemRaw?Cn(y.getItemRaw,g,d):Cn(y.getItem,g,d).then(A=>OT(A))},async setItem(l,d,g={}){if(d===void 0)return u.removeItem(l);l=pi(l);const{relativeKey:y,driver:A}=r(l);A.setItem&&(await Cn(A.setItem,y,Zh(d),g),A.watch||i("update",l))},async setItems(l,d){await a(l,d,async g=>{if(g.driver.setItems)return Cn(g.driver.setItems,g.items.map(y=>({key:y.relativeKey,value:Zh(y.value),options:y.options})),d);g.driver.setItem&&await Promise.all(g.items.map(y=>Cn(g.driver.setItem,y.relativeKey,Zh(y.value),y.options)))})},async setItemRaw(l,d,g={}){if(d===void 0)return u.removeItem(l,g);l=pi(l);const{relativeKey:y,driver:A}=r(l);if(A.setItemRaw)await Cn(A.setItemRaw,y,d,g);else if(A.setItem)await Cn(A.setItem,y,DT(d),g);else return;A.watch||i("update",l)},async removeItem(l,d={}){typeof d=="boolean"&&(d={removeMeta:d}),l=pi(l);const{relativeKey:g,driver:y}=r(l);y.removeItem&&(await Cn(y.removeItem,g,d),(d.removeMeta||d.removeMata)&&await Cn(y.removeItem,g+"$",d),y.watch||i("remove",l))},async getMeta(l,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),l=pi(l);const{relativeKey:g,driver:y}=r(l),A=Object.create(null);if(y.getMeta&&Object.assign(A,await Cn(y.getMeta,g,d)),!d.nativeOnly){const P=await Cn(y.getItem,g+"$",d).then(N=>Xh(N));P&&typeof P=="object"&&(typeof P.atime=="string"&&(P.atime=new Date(P.atime)),typeof P.mtime=="string"&&(P.mtime=new Date(P.mtime)),Object.assign(A,P))}return A},setMeta(l,d,g={}){return this.setItem(l+"$",d,g)},removeMeta(l,d={}){return this.removeItem(l+"$",d)},async getKeys(l,d={}){l=Qh(l);const g=n(l,!0);let y=[];const A=[];for(const P of g){const N=await Cn(P.driver.getKeys,P.relativeBase,d);for(const D of N){const k=P.mountpoint+pi(D);y.some($=>k.startsWith($))||A.push(k)}y=[P.mountpoint,...y.filter(D=>!D.startsWith(P.mountpoint))]}return l?A.filter(P=>P.startsWith(l)&&P[P.length-1]!=="$"):A.filter(P=>P[P.length-1]!=="$")},async clear(l,d={}){l=Qh(l),await Promise.all(n(l,!1).map(async g=>{if(g.driver.clear)return Cn(g.driver.clear,g.relativeBase,d);if(g.driver.removeItem){const y=await g.driver.getKeys(g.relativeBase||"",d);return Promise.all(y.map(A=>g.driver.removeItem(A,d)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>q2(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(d=>d!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,d){if(l=Qh(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((g,y)=>y.length-g.length)),e.mounts[l]=d,e.watching&&Promise.resolve(j2(d,i,l)).then(g=>{e.unwatch[l]=g}).catch(console.error),u},async unmount(l,d=!0){l=Qh(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),d&&await q2(e.mounts[l]),e.mountpoints=e.mountpoints.filter(g=>g!==l),delete e.mounts[l])},getMount(l=""){l=pi(l)+":";const d=r(l);return{driver:d.driver,base:d.base}},getMounts(l="",d={}){return l=pi(l),n(l,d.parents).map(y=>({driver:y.driver,base:y.mountpoint}))},keys:(l,d={})=>u.getKeys(l,d),get:(l,d={})=>u.getItem(l,d),set:(l,d,g={})=>u.setItem(l,d,g),has:(l,d={})=>u.hasItem(l,d),del:(l,d={})=>u.removeItem(l,d),remove:(l,d={})=>u.removeItem(l,d)};return u}function j2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function q2(t){typeof t.dispose=="function"&&await Cn(t.dispose)}function Ha(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function z2(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Ha(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let im;function Yf(){return im||(im=z2("keyval-store","keyval")),im}function H2(t,e=Yf()){return e("readonly",r=>Ha(r.get(t)))}function BT(t,e,r=Yf()){return r("readwrite",n=>(n.put(e,t),Ha(n.transaction)))}function FT(t,e=Yf()){return e("readwrite",r=>(r.delete(t),Ha(r.transaction)))}function UT(t=Yf()){return t("readwrite",e=>(e.clear(),Ha(e.transaction)))}function jT(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Ha(t.transaction)}function qT(t=Yf()){return t("readonly",e=>{if(e.getAllKeys)return Ha(e.getAllKeys());const r=[];return jT(e,n=>r.push(n.key)).then(()=>r)})}const zT=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),HT=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Wa(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return HT(t)}catch{return t}}function go(t){return typeof t=="string"?t:zT(t)||""}const WT="idb-keyval";var KT=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=z2(t.dbName,t.storeName)),{name:WT,options:t,async hasItem(i){return!(typeof await H2(r(i),n)>"u")},async getItem(i){return await H2(r(i),n)??null},setItem(i,s){return BT(r(i),s,n)},removeItem(i){return FT(r(i),n)},getKeys(){return qT(n)},clear(){return UT(n)}}};const VT="WALLET_CONNECT_V2_INDEXED_DB",GT="keyvaluestorage";let YT=class{constructor(){this.indexedDb=$T({driver:KT({dbName:VT,storeName:GT})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,go(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var sm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ed={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof sm<"u"&&sm.localStorage?ed.exports=sm.localStorage:typeof window<"u"&&window.localStorage?ed.exports=window.localStorage:ed.exports=new e})();function JT(t){var e;return[t[0],Wa((e=t[1])!=null?e:"")]}let XT=class{constructor(){this.localStorage=ed.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(JT)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Wa(r)}async setItem(e,r){this.localStorage.setItem(e,go(r))}async removeItem(e){this.localStorage.removeItem(e)}};const ZT="wc_storage_version",W2=1,QT=async(t,e,r)=>{const n=ZT,i=await e.getItem(n);if(i&&i>=W2){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,W2),r(e),eR(t,o)},eR=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let tR=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new XT;this.storage=e;try{const r=new YT;QT(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function rR(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var nR=iR;function iR(t,e,r){var n=r&&r.stringify||rR,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?g:0,t.charCodeAt(A+1)){case 100:case 102:if(d>=u||e[d]==null)break;g=u||e[d]==null)break;g=u||e[d]===void 0)break;g",g=A+2,A++;break}l+=n(e[d]),g=A+2,A++;break;case 115:if(d>=u)break;g-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",u=Object.create(r);u.log||(u.log=Xf),Object.defineProperty(u,"levelVal",{get:d}),Object.defineProperty(u,"level",{get:g,set:y});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:lR(t)};u.levels=mo.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Xf,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=A,e&&(u._logEvent=om());function d(){return this.level==="silent"?1/0:this.levels.values[this.level]}function g(){return this._level}function y(P){if(P!=="silent"&&!this.levels.values[P])throw Error("unknown level "+P);this._level=P,su(l,u,"error","log"),su(l,u,"fatal","error"),su(l,u,"warn","error"),su(l,u,"info","log"),su(l,u,"debug","log"),su(l,u,"trace","log")}function A(P,N){if(!P)throw new Error("missing bindings for child Pino");N=N||{},i&&P.serializers&&(N.serializers=P.serializers);const D=N.serializers;if(i&&D){var k=Object.assign({},n,D),$=t.browser.serialize===!0?Object.keys(k):i;delete P.serializers,td([P],$,k,this._stdErrSerialize)}function q(U){this._childLevel=(U._childLevel|0)+1,this.error=ou(U,P,"error"),this.fatal=ou(U,P,"fatal"),this.warn=ou(U,P,"warn"),this.info=ou(U,P,"info"),this.debug=ou(U,P,"debug"),this.trace=ou(U,P,"trace"),k&&(this.serializers=k,this._serialize=$),e&&(this._logEvent=om([].concat(U._logEvent.bindings,P)))}return q.prototype=this,new q(this)}return u}mo.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},mo.stdSerializers=sR,mo.stdTimeFunctions=Object.assign({},{nullTime:V2,epochTime:G2,unixTime:hR,isoTime:dR});function su(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Xf:i[r]?i[r]:Jf[r]||Jf[n]||Xf,aR(t,e,r)}function aR(t,e,r){!t.transmit&&e[r]===Xf||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Jf?Jf:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function ou(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},J2=class{constructor(e,r=cm){this.level=e??"error",this.levelValue=iu.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Y2(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===iu.levels.values.error?console.error(e):r===iu.levels.values.warn?console.warn(e):r===iu.levels.values.debug?console.debug(e):r===iu.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(go({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new Y2(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(go({extraMetadata:e})),new Blob(r,{type:"application/json"})}},vR=class{constructor(e,r=cm){this.baseChunkLogger=new J2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},bR=class{constructor(e,r=cm){this.baseChunkLogger=new J2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var yR=Object.defineProperty,wR=Object.defineProperties,xR=Object.getOwnPropertyDescriptors,X2=Object.getOwnPropertySymbols,_R=Object.prototype.hasOwnProperty,ER=Object.prototype.propertyIsEnumerable,Z2=(t,e,r)=>e in t?yR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nd=(t,e)=>{for(var r in e||(e={}))_R.call(e,r)&&Z2(t,r,e[r]);if(X2)for(var r of X2(e))ER.call(e,r)&&Z2(t,r,e[r]);return t},id=(t,e)=>wR(t,xR(e));function sd(t){return id(nd({},t),{level:(t==null?void 0:t.level)||gR.level})}function SR(t,e=Qf){return t[e]||""}function AR(t,e,r=Qf){return t[r]=e,t}function gi(t,e=Qf){let r="";return typeof t.bindings>"u"?r=SR(t,e):r=t.bindings().context||"",r}function PR(t,e,r=Qf){const n=gi(t,r);return n.trim()?`${n}/${e}`:e}function ri(t,e,r=Qf){const n=PR(t,e,r),i=t.child({context:n});return AR(i,n,r)}function MR(t){var e,r;const n=new vR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Zf(id(nd({},t.opts),{level:"trace",browser:id(nd({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function IR(t){var e;const r=new bR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Zf(id(nd({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function CR(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?MR(t):IR(t)}let TR=class extends za{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},RR=class extends za{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},DR=class{constructor(e,r){this.logger=e,this.core=r}},OR=class extends za{constructor(e,r){super(),this.relayer=e,this.logger=r}},NR=class extends za{constructor(e){super()}},LR=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},kR=class extends za{constructor(e,r){super(),this.relayer=e,this.logger=r}},$R=class extends za{constructor(e,r){super(),this.core=e,this.logger=r}},BR=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},FR=class{constructor(e,r){this.projectId=e,this.logger=r}},UR=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},jR=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},qR=class{constructor(e){this.client=e}};var um={},ea={},od={},ad={};Object.defineProperty(ad,"__esModule",{value:!0}),ad.BrowserRandomSource=void 0;const Q2=65536;class zR{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let n=0;n>>16&65535,d=a&65535,g=u>>>16&65535,y=u&65535;return d*y+(l*y+d*g<<16>>>0)|0}t.mul=Math.imul||e;function r(a,u){return a+u|0}t.add=r;function n(a,u){return a-u|0}t.sub=n;function i(a,u){return a<>>32-u}t.rotl=i;function s(a,u){return a<<32-u|a>>>u}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(tx),Object.defineProperty(or,"__esModule",{value:!0});var rx=tx;function JR(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}or.readInt16BE=JR;function XR(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}or.readUint16BE=XR;function ZR(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}or.readInt16LE=ZR;function QR(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}or.readUint16LE=QR;function nx(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}or.writeUint16BE=nx,or.writeInt16BE=nx;function ix(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}or.writeUint16LE=ix,or.writeInt16LE=ix;function fm(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}or.readInt32BE=fm;function lm(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}or.readUint32BE=lm;function hm(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}or.readInt32LE=hm;function dm(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}or.readUint32LE=dm;function ud(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}or.writeUint32BE=ud,or.writeInt32BE=ud;function fd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}or.writeUint32LE=fd,or.writeInt32LE=fd;function eD(t,e){e===void 0&&(e=0);var r=fm(t,e),n=fm(t,e+4);return r*4294967296+n-(n>>31)*4294967296}or.readInt64BE=eD;function tD(t,e){e===void 0&&(e=0);var r=lm(t,e),n=lm(t,e+4);return r*4294967296+n}or.readUint64BE=tD;function rD(t,e){e===void 0&&(e=0);var r=hm(t,e),n=hm(t,e+4);return n*4294967296+r-(r>>31)*4294967296}or.readInt64LE=rD;function nD(t,e){e===void 0&&(e=0);var r=dm(t,e),n=dm(t,e+4);return n*4294967296+r}or.readUint64LE=nD;function sx(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ud(t/4294967296>>>0,e,r),ud(t>>>0,e,r+4),e}or.writeUint64BE=sx,or.writeInt64BE=sx;function ox(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fd(t>>>0,e,r),fd(t/4294967296>>>0,e,r+4),e}or.writeUint64LE=ox,or.writeInt64LE=ox;function iD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}or.readUintBE=iD;function sD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}or.writeUintBE=oD;function aD(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!rx.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s256)throw new Error("randomString charset is too long");let y="";const A=d.length,P=256-256%A;for(;l>0;){const N=i(Math.ceil(l*256/P),g);for(let D=0;D0;D++){const k=N[D];k0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,g=l/536870912|0,y=l<<3,A=l%128<112?128:256;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._stateHi.set(u.stateHi),this._stateLo.set(u.stateLo),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.stateHi),r.wipe(u.stateLo),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,u,l,d,g,y,A){for(var P=l[0],N=l[1],D=l[2],k=l[3],$=l[4],q=l[5],U=l[6],K=l[7],J=d[0],T=d[1],z=d[2],ue=d[3],_e=d[4],G=d[5],E=d[6],m=d[7],f,p,v,x,_,S,b,M;A>=128;){for(var I=0;I<16;I++){var F=8*I+y;a[I]=e.readUint32BE(g,F),u[I]=e.readUint32BE(g,F+4)}for(var I=0;I<80;I++){var ae=P,O=N,se=D,ee=k,X=$,Q=q,R=U,Z=K,te=J,le=T,ie=z,fe=ue,ve=_e,Me=G,Ne=E,Te=m;if(f=K,p=m,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=($>>>14|_e<<18)^($>>>18|_e<<14)^(_e>>>9|$<<23),p=(_e>>>14|$<<18)^(_e>>>18|$<<14)^($>>>9|_e<<23),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=$&q^~$&U,p=_e&G^~_e&E,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=i[I*2],p=i[I*2+1],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=a[I%16],p=u[I%16],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,v=b&65535|M<<16,x=_&65535|S<<16,f=v,p=x,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=(P>>>28|J<<4)^(J>>>2|P<<30)^(J>>>7|P<<25),p=(J>>>28|P<<4)^(P>>>2|J<<30)^(P>>>7|J<<25),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=P&N^P&D^N&D,p=J&T^J&z^T&z,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,Z=b&65535|M<<16,Te=_&65535|S<<16,f=ee,p=fe,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=v,p=x,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,ee=b&65535|M<<16,fe=_&65535|S<<16,N=ae,D=O,k=se,$=ee,q=X,U=Q,K=R,P=Z,T=te,z=le,ue=ie,_e=fe,G=ve,E=Me,m=Ne,J=Te,I%16===15)for(var F=0;F<16;F++)f=a[F],p=u[F],_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=a[(F+9)%16],p=u[(F+9)%16],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,v=a[(F+1)%16],x=u[(F+1)%16],f=(v>>>1|x<<31)^(v>>>8|x<<24)^v>>>7,p=(x>>>1|v<<31)^(x>>>8|v<<24)^(x>>>7|v<<25),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,v=a[(F+14)%16],x=u[(F+14)%16],f=(v>>>19|x<<13)^(x>>>29|v<<3)^v>>>6,p=(x>>>19|v<<13)^(v>>>29|x<<3)^(x>>>6|v<<26),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,a[F]=b&65535|M<<16,u[F]=_&65535|S<<16}f=P,p=J,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[0],p=d[0],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[0]=P=b&65535|M<<16,d[0]=J=_&65535|S<<16,f=N,p=T,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[1],p=d[1],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[1]=N=b&65535|M<<16,d[1]=T=_&65535|S<<16,f=D,p=z,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[2],p=d[2],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[2]=D=b&65535|M<<16,d[2]=z=_&65535|S<<16,f=k,p=ue,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[3],p=d[3],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[3]=k=b&65535|M<<16,d[3]=ue=_&65535|S<<16,f=$,p=_e,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[4],p=d[4],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[4]=$=b&65535|M<<16,d[4]=_e=_&65535|S<<16,f=q,p=G,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[5],p=d[5],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[5]=q=b&65535|M<<16,d[5]=G=_&65535|S<<16,f=U,p=E,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[6],p=d[6],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[6]=U=b&65535|M<<16,d[6]=E=_&65535|S<<16,f=K,p=m,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[7],p=d[7],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[7]=K=b&65535|M<<16,d[7]=m=_&65535|S<<16,y+=128,A-=128}return y}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ax),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=ea,r=ax,n=Mi;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(ee){const X=new Float64Array(16);if(ee)for(let Q=0;Q>16&1),Q[le-1]&=65535;Q[15]=R[15]-32767-(Q[14]>>16&1);const te=Q[15]>>16&1;Q[14]&=65535,N(R,Q,1-te)}for(let Z=0;Z<16;Z++)ee[2*Z]=R[Z]&255,ee[2*Z+1]=R[Z]>>8}function k(ee,X){let Q=0;for(let R=0;R<32;R++)Q|=ee[R]^X[R];return(1&Q-1>>>8)-1}function $(ee,X){const Q=new Uint8Array(32),R=new Uint8Array(32);return D(Q,ee),D(R,X),k(Q,R)}function q(ee){const X=new Uint8Array(32);return D(X,ee),X[0]&1}function U(ee,X){for(let Q=0;Q<16;Q++)ee[Q]=X[2*Q]+(X[2*Q+1]<<8);ee[15]&=32767}function K(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]+Q[R]}function J(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]-Q[R]}function T(ee,X,Q){let R,Z,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,Be=0,Ie=0,Le=0,Ve=0,ke=0,ze=0,He=0,Ee=0,Qe=0,ct=0,$e=0,et=0,rt=0,Je=0,pt=0,ht=0,ft=0,Ht=0,Jt=0,St=0,er=0,Xt=0,Ot=0,$t=Q[0],Tt=Q[1],vt=Q[2],Dt=Q[3],Lt=Q[4],bt=Q[5],Bt=Q[6],Ut=Q[7],nt=Q[8],Ft=Q[9],B=Q[10],H=Q[11],V=Q[12],C=Q[13],Y=Q[14],j=Q[15];R=X[0],te+=R*$t,le+=R*Tt,ie+=R*vt,fe+=R*Dt,ve+=R*Lt,Me+=R*bt,Ne+=R*Bt,Te+=R*Ut,Be+=R*nt,Ie+=R*Ft,Le+=R*B,Ve+=R*H,ke+=R*V,ze+=R*C,He+=R*Y,Ee+=R*j,R=X[1],le+=R*$t,ie+=R*Tt,fe+=R*vt,ve+=R*Dt,Me+=R*Lt,Ne+=R*bt,Te+=R*Bt,Be+=R*Ut,Ie+=R*nt,Le+=R*Ft,Ve+=R*B,ke+=R*H,ze+=R*V,He+=R*C,Ee+=R*Y,Qe+=R*j,R=X[2],ie+=R*$t,fe+=R*Tt,ve+=R*vt,Me+=R*Dt,Ne+=R*Lt,Te+=R*bt,Be+=R*Bt,Ie+=R*Ut,Le+=R*nt,Ve+=R*Ft,ke+=R*B,ze+=R*H,He+=R*V,Ee+=R*C,Qe+=R*Y,ct+=R*j,R=X[3],fe+=R*$t,ve+=R*Tt,Me+=R*vt,Ne+=R*Dt,Te+=R*Lt,Be+=R*bt,Ie+=R*Bt,Le+=R*Ut,Ve+=R*nt,ke+=R*Ft,ze+=R*B,He+=R*H,Ee+=R*V,Qe+=R*C,ct+=R*Y,$e+=R*j,R=X[4],ve+=R*$t,Me+=R*Tt,Ne+=R*vt,Te+=R*Dt,Be+=R*Lt,Ie+=R*bt,Le+=R*Bt,Ve+=R*Ut,ke+=R*nt,ze+=R*Ft,He+=R*B,Ee+=R*H,Qe+=R*V,ct+=R*C,$e+=R*Y,et+=R*j,R=X[5],Me+=R*$t,Ne+=R*Tt,Te+=R*vt,Be+=R*Dt,Ie+=R*Lt,Le+=R*bt,Ve+=R*Bt,ke+=R*Ut,ze+=R*nt,He+=R*Ft,Ee+=R*B,Qe+=R*H,ct+=R*V,$e+=R*C,et+=R*Y,rt+=R*j,R=X[6],Ne+=R*$t,Te+=R*Tt,Be+=R*vt,Ie+=R*Dt,Le+=R*Lt,Ve+=R*bt,ke+=R*Bt,ze+=R*Ut,He+=R*nt,Ee+=R*Ft,Qe+=R*B,ct+=R*H,$e+=R*V,et+=R*C,rt+=R*Y,Je+=R*j,R=X[7],Te+=R*$t,Be+=R*Tt,Ie+=R*vt,Le+=R*Dt,Ve+=R*Lt,ke+=R*bt,ze+=R*Bt,He+=R*Ut,Ee+=R*nt,Qe+=R*Ft,ct+=R*B,$e+=R*H,et+=R*V,rt+=R*C,Je+=R*Y,pt+=R*j,R=X[8],Be+=R*$t,Ie+=R*Tt,Le+=R*vt,Ve+=R*Dt,ke+=R*Lt,ze+=R*bt,He+=R*Bt,Ee+=R*Ut,Qe+=R*nt,ct+=R*Ft,$e+=R*B,et+=R*H,rt+=R*V,Je+=R*C,pt+=R*Y,ht+=R*j,R=X[9],Ie+=R*$t,Le+=R*Tt,Ve+=R*vt,ke+=R*Dt,ze+=R*Lt,He+=R*bt,Ee+=R*Bt,Qe+=R*Ut,ct+=R*nt,$e+=R*Ft,et+=R*B,rt+=R*H,Je+=R*V,pt+=R*C,ht+=R*Y,ft+=R*j,R=X[10],Le+=R*$t,Ve+=R*Tt,ke+=R*vt,ze+=R*Dt,He+=R*Lt,Ee+=R*bt,Qe+=R*Bt,ct+=R*Ut,$e+=R*nt,et+=R*Ft,rt+=R*B,Je+=R*H,pt+=R*V,ht+=R*C,ft+=R*Y,Ht+=R*j,R=X[11],Ve+=R*$t,ke+=R*Tt,ze+=R*vt,He+=R*Dt,Ee+=R*Lt,Qe+=R*bt,ct+=R*Bt,$e+=R*Ut,et+=R*nt,rt+=R*Ft,Je+=R*B,pt+=R*H,ht+=R*V,ft+=R*C,Ht+=R*Y,Jt+=R*j,R=X[12],ke+=R*$t,ze+=R*Tt,He+=R*vt,Ee+=R*Dt,Qe+=R*Lt,ct+=R*bt,$e+=R*Bt,et+=R*Ut,rt+=R*nt,Je+=R*Ft,pt+=R*B,ht+=R*H,ft+=R*V,Ht+=R*C,Jt+=R*Y,St+=R*j,R=X[13],ze+=R*$t,He+=R*Tt,Ee+=R*vt,Qe+=R*Dt,ct+=R*Lt,$e+=R*bt,et+=R*Bt,rt+=R*Ut,Je+=R*nt,pt+=R*Ft,ht+=R*B,ft+=R*H,Ht+=R*V,Jt+=R*C,St+=R*Y,er+=R*j,R=X[14],He+=R*$t,Ee+=R*Tt,Qe+=R*vt,ct+=R*Dt,$e+=R*Lt,et+=R*bt,rt+=R*Bt,Je+=R*Ut,pt+=R*nt,ht+=R*Ft,ft+=R*B,Ht+=R*H,Jt+=R*V,St+=R*C,er+=R*Y,Xt+=R*j,R=X[15],Ee+=R*$t,Qe+=R*Tt,ct+=R*vt,$e+=R*Dt,et+=R*Lt,rt+=R*bt,Je+=R*Bt,pt+=R*Ut,ht+=R*nt,ft+=R*Ft,Ht+=R*B,Jt+=R*H,St+=R*V,er+=R*C,Xt+=R*Y,Ot+=R*j,te+=38*Qe,le+=38*ct,ie+=38*$e,fe+=38*et,ve+=38*rt,Me+=38*Je,Ne+=38*pt,Te+=38*ht,Be+=38*ft,Ie+=38*Ht,Le+=38*Jt,Ve+=38*St,ke+=38*er,ze+=38*Xt,He+=38*Ot,Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=Be+Z+65535,Z=Math.floor(R/65536),Be=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=Be+Z+65535,Z=Math.floor(R/65536),Be=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),ee[0]=te,ee[1]=le,ee[2]=ie,ee[3]=fe,ee[4]=ve,ee[5]=Me,ee[6]=Ne,ee[7]=Te,ee[8]=Be,ee[9]=Ie,ee[10]=Le,ee[11]=Ve,ee[12]=ke,ee[13]=ze,ee[14]=He,ee[15]=Ee}function z(ee,X){T(ee,X,X)}function ue(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=253;R>=0;R--)z(Q,Q),R!==2&&R!==4&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function _e(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=250;R>=0;R--)z(Q,Q),R!==1&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function G(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i(),ve=i(),Me=i();J(Q,ee[1],ee[0]),J(Me,X[1],X[0]),T(Q,Q,Me),K(R,ee[0],ee[1]),K(Me,X[0],X[1]),T(R,R,Me),T(Z,ee[3],X[3]),T(Z,Z,l),T(te,ee[2],X[2]),K(te,te,te),J(le,R,Q),J(ie,te,Z),K(fe,te,Z),K(ve,R,Q),T(ee[0],le,ie),T(ee[1],ve,fe),T(ee[2],fe,ie),T(ee[3],le,ve)}function E(ee,X,Q){for(let R=0;R<4;R++)N(ee[R],X[R],Q)}function m(ee,X){const Q=i(),R=i(),Z=i();ue(Z,X[2]),T(Q,X[0],Z),T(R,X[1],Z),D(ee,R),ee[31]^=q(Q)<<7}function f(ee,X,Q){A(ee[0],o),A(ee[1],a),A(ee[2],a),A(ee[3],o);for(let R=255;R>=0;--R){const Z=Q[R/8|0]>>(R&7)&1;E(ee,X,Z),G(X,ee),G(ee,ee),E(ee,X,Z)}}function p(ee,X){const Q=[i(),i(),i(),i()];A(Q[0],d),A(Q[1],g),A(Q[2],a),T(Q[3],d,g),f(ee,Q,X)}function v(ee){if(ee.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const X=(0,r.hash)(ee);X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(32),R=[i(),i(),i(),i()];p(R,X),m(Q,R);const Z=new Uint8Array(64);return Z.set(ee),Z.set(Q,32),{publicKey:Q,secretKey:Z}}t.generateKeyPairFromSeed=v;function x(ee){const X=(0,e.randomBytes)(32,ee),Q=v(X);return(0,n.wipe)(X),Q}t.generateKeyPair=x;function _(ee){if(ee.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(ee.subarray(32))}t.extractPublicKeyFromSecretKey=_;const S=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function b(ee,X){let Q,R,Z,te;for(R=63;R>=32;--R){for(Q=0,Z=R-32,te=R-12;Z>4)*S[Z],Q=X[Z]>>8,X[Z]&=255;for(Z=0;Z<32;Z++)X[Z]-=Q*S[Z];for(R=0;R<32;R++)X[R+1]+=X[R]>>8,ee[R]=X[R]&255}function M(ee){const X=new Float64Array(64);for(let Q=0;Q<64;Q++)X[Q]=ee[Q];for(let Q=0;Q<64;Q++)ee[Q]=0;b(ee,X)}function I(ee,X){const Q=new Float64Array(64),R=[i(),i(),i(),i()],Z=(0,r.hash)(ee.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(64);te.set(Z.subarray(32),32);const le=new r.SHA512;le.update(te.subarray(32)),le.update(X);const ie=le.digest();le.clean(),M(ie),p(R,ie),m(te,R),le.reset(),le.update(te.subarray(0,32)),le.update(ee.subarray(32)),le.update(X);const fe=le.digest();M(fe);for(let ve=0;ve<32;ve++)Q[ve]=ie[ve];for(let ve=0;ve<32;ve++)for(let Me=0;Me<32;Me++)Q[ve+Me]+=fe[ve]*Z[Me];return b(te.subarray(32),Q),te}t.sign=I;function F(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i();return A(ee[2],a),U(ee[1],X),z(Z,ee[1]),T(te,Z,u),J(Z,Z,ee[2]),K(te,ee[2],te),z(le,te),z(ie,le),T(fe,ie,le),T(Q,fe,Z),T(Q,Q,te),_e(Q,Q),T(Q,Q,Z),T(Q,Q,te),T(Q,Q,te),T(ee[0],Q,te),z(R,ee[0]),T(R,R,te),$(R,Z)&&T(ee[0],ee[0],y),z(R,ee[0]),T(R,R,te),$(R,Z)?-1:(q(ee[0])===X[31]>>7&&J(ee[0],o,ee[0]),T(ee[3],ee[0],ee[1]),0)}function ae(ee,X,Q){const R=new Uint8Array(32),Z=[i(),i(),i(),i()],te=[i(),i(),i(),i()];if(Q.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(F(te,ee))return!1;const le=new r.SHA512;le.update(Q.subarray(0,32)),le.update(ee),le.update(X);const ie=le.digest();return M(ie),f(Z,te,ie),p(te,Q.subarray(32)),G(Z,te),m(R,Z),!k(Q,R)}t.verify=ae;function O(ee){let X=[i(),i(),i(),i()];if(F(X,ee))throw new Error("Ed25519: invalid public key");let Q=i(),R=i(),Z=X[1];K(Q,a,Z),J(R,a,Z),ue(R,R),T(Q,Q,R);let te=new Uint8Array(32);return D(te,Q),te}t.convertPublicKeyToX25519=O;function se(ee){const X=(0,r.hash)(ee.subarray(0,32));X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(X.subarray(0,32));return(0,n.wipe)(X),Q}t.convertSecretKeyToX25519=se}(um);const mD="EdDSA",vD="JWT",ld=".",hd="base64url",cx="utf8",ux="utf8",bD=":",yD="did",wD="key",fx="base58btc",xD="z",_D="K36",ED=32;function lx(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function dd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=lx(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function SD(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(q);k!==$;){for(var K=P[k],J=0,T=q-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=q-D;z!==q&&U[z]===0;)z++;for(var ue=u.repeat(N);z>>0,q=new Uint8Array($);P[N];){var U=r[P.charCodeAt(N)];if(U===255)return;for(var K=0,J=$-1;(U!==0||K>>0,q[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,N++}if(P[N]!==" "){for(var T=$-k;T!==$&&q[T]===0;)T++;for(var z=new Uint8Array(D+($-T)),ue=D;T!==$;)z[ue++]=q[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:g,decodeUnsafe:y,decode:A}}var AD=SD,PD=AD;const MD=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},ID=t=>new TextEncoder().encode(t),CD=t=>new TextDecoder().decode(t);class TD{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class RD{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return hx(this,e)}}class DD{constructor(e){this.decoders=e}or(e){return hx(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const hx=(t,e)=>new DD({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class OD{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new TD(e,r,n),this.decoder=new RD(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const pd=({name:t,prefix:e,encode:r,decode:n})=>new OD(t,e,r,n),tl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=PD(r,e);return pd({prefix:t,name:e,encode:n,decode:s=>MD(i(s))})},ND=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},LD=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<pd({prefix:e,name:t,encode(i){return LD(i,n,r)},decode(i){return ND(i,n,r,t)}}),kD=pd({prefix:"\0",name:"identity",encode:t=>CD(t),decode:t=>ID(t)}),$D=Object.freeze(Object.defineProperty({__proto__:null,identity:kD},Symbol.toStringTag,{value:"Module"})),BD=Fn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),FD=Object.freeze(Object.defineProperty({__proto__:null,base2:BD},Symbol.toStringTag,{value:"Module"})),UD=Fn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),jD=Object.freeze(Object.defineProperty({__proto__:null,base8:UD},Symbol.toStringTag,{value:"Module"})),qD=tl({prefix:"9",name:"base10",alphabet:"0123456789"}),zD=Object.freeze(Object.defineProperty({__proto__:null,base10:qD},Symbol.toStringTag,{value:"Module"})),HD=Fn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),WD=Fn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),KD=Object.freeze(Object.defineProperty({__proto__:null,base16:HD,base16upper:WD},Symbol.toStringTag,{value:"Module"})),VD=Fn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),GD=Fn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),YD=Fn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),JD=Fn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),XD=Fn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ZD=Fn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),QD=Fn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),eO=Fn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),tO=Fn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),rO=Object.freeze(Object.defineProperty({__proto__:null,base32:VD,base32hex:XD,base32hexpad:QD,base32hexpadupper:eO,base32hexupper:ZD,base32pad:YD,base32padupper:JD,base32upper:GD,base32z:tO},Symbol.toStringTag,{value:"Module"})),nO=tl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),iO=tl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),sO=Object.freeze(Object.defineProperty({__proto__:null,base36:nO,base36upper:iO},Symbol.toStringTag,{value:"Module"})),oO=tl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),aO=tl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),cO=Object.freeze(Object.defineProperty({__proto__:null,base58btc:oO,base58flickr:aO},Symbol.toStringTag,{value:"Module"})),uO=Fn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),fO=Fn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),lO=Fn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),hO=Fn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),dO=Object.freeze(Object.defineProperty({__proto__:null,base64:uO,base64pad:fO,base64url:lO,base64urlpad:hO},Symbol.toStringTag,{value:"Module"})),dx=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),pO=dx.reduce((t,e,r)=>(t[r]=e,t),[]),gO=dx.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function mO(t){return t.reduce((e,r)=>(e+=pO[r],e),"")}function vO(t){const e=[];for(const r of t){const n=gO[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const bO=pd({prefix:"🚀",name:"base256emoji",encode:mO,decode:vO}),yO=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:bO},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const px={...$D,...FD,...jD,...zD,...KD,...rO,...sO,...cO,...dO,...yO};function gx(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const mx=gx("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),pm=gx("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=lx(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new CO:typeof navigator<"u"?LO(navigator.userAgent):$O()}function NO(t){return t!==""&&DO.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function LO(t){var e=NO(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new IO;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<_x&&(i=xx(xx([],i,!0),BO(_x-i.length),!0)):i=[];var s=i.join("."),o=kO(t),a=RO.exec(t);return a&&a[1]?new MO(r,s,o,a[1]):new AO(r,s,o)}function kO(t){for(var e=0,r=Ex.length;e-1){const D=P.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let k=e.protocol+"//"+e.host;if(D.indexOf("/")===0)k+=D;else{const $=e.pathname.split("/");$.pop();const q=$.join("/");k+=q+"/"+D}y.push(k)}else if(D.indexOf("//")===0){const k=e.protocol+D;y.push(k)}else y.push(D)}}return y}function n(...g){const y=t.getElementsByTagName("meta");for(let A=0;AP.getAttribute(D)).filter(D=>D?g.includes(D):!1);if(N.length&&N){const D=P.getAttribute("content");if(D)return D}}return""}function i(){let g=n("name","og:site_name","og:title","twitter:title");return g||(g=t.title),g}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}Ax=vm.getWindowMetadata=YO;var nl={},JO=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Mx="%[a-f0-9]{2}",Ix=new RegExp("("+Mx+")|([^%]+?)","gi"),Cx=new RegExp("("+Mx+")+","gi");function bm(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],bm(r),bm(n))}function XO(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(Ix)||[],r=1;r{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},tN=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s$==null,o=Symbol("encodeFragmentIdentifier");function a($){switch($.arrayFormat){case"index":return q=>(U,K)=>{const J=U.length;return K===void 0||$.skipNull&&K===null||$.skipEmptyString&&K===""?U:K===null?[...U,[d(q,$),"[",J,"]"].join("")]:[...U,[d(q,$),"[",d(J,$),"]=",d(K,$)].join("")]};case"bracket":return q=>(U,K)=>K===void 0||$.skipNull&&K===null||$.skipEmptyString&&K===""?U:K===null?[...U,[d(q,$),"[]"].join("")]:[...U,[d(q,$),"[]=",d(K,$)].join("")];case"colon-list-separator":return q=>(U,K)=>K===void 0||$.skipNull&&K===null||$.skipEmptyString&&K===""?U:K===null?[...U,[d(q,$),":list="].join("")]:[...U,[d(q,$),":list=",d(K,$)].join("")];case"comma":case"separator":case"bracket-separator":{const q=$.arrayFormat==="bracket-separator"?"[]=":"=";return U=>(K,J)=>J===void 0||$.skipNull&&J===null||$.skipEmptyString&&J===""?K:(J=J===null?"":J,K.length===0?[[d(U,$),q,d(J,$)].join("")]:[[K,d(J,$)].join($.arrayFormatSeparator)])}default:return q=>(U,K)=>K===void 0||$.skipNull&&K===null||$.skipEmptyString&&K===""?U:K===null?[...U,d(q,$)]:[...U,[d(q,$),"=",d(K,$)].join("")]}}function u($){let q;switch($.arrayFormat){case"index":return(U,K,J)=>{if(q=/\[(\d*)\]$/.exec(U),U=U.replace(/\[\d*\]$/,""),!q){J[U]=K;return}J[U]===void 0&&(J[U]={}),J[U][q[1]]=K};case"bracket":return(U,K,J)=>{if(q=/(\[\])$/.exec(U),U=U.replace(/\[\]$/,""),!q){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"colon-list-separator":return(U,K,J)=>{if(q=/(:list)$/.exec(U),U=U.replace(/:list$/,""),!q){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"comma":case"separator":return(U,K,J)=>{const T=typeof K=="string"&&K.includes($.arrayFormatSeparator),z=typeof K=="string"&&!T&&g(K,$).includes($.arrayFormatSeparator);K=z?g(K,$):K;const ue=T||z?K.split($.arrayFormatSeparator).map(_e=>g(_e,$)):K===null?K:g(K,$);J[U]=ue};case"bracket-separator":return(U,K,J)=>{const T=/(\[\])$/.test(U);if(U=U.replace(/\[\]$/,""),!T){J[U]=K&&g(K,$);return}const z=K===null?[]:K.split($.arrayFormatSeparator).map(ue=>g(ue,$));if(J[U]===void 0){J[U]=z;return}J[U]=[].concat(J[U],z)};default:return(U,K,J)=>{if(J[U]===void 0){J[U]=K;return}J[U]=[].concat(J[U],K)}}}function l($){if(typeof $!="string"||$.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function d($,q){return q.encode?q.strict?e($):encodeURIComponent($):$}function g($,q){return q.decode?r($):$}function y($){return Array.isArray($)?$.sort():typeof $=="object"?y(Object.keys($)).sort((q,U)=>Number(q)-Number(U)).map(q=>$[q]):$}function A($){const q=$.indexOf("#");return q!==-1&&($=$.slice(0,q)),$}function P($){let q="";const U=$.indexOf("#");return U!==-1&&(q=$.slice(U)),q}function N($){$=A($);const q=$.indexOf("?");return q===-1?"":$.slice(q+1)}function D($,q){return q.parseNumbers&&!Number.isNaN(Number($))&&typeof $=="string"&&$.trim()!==""?$=Number($):q.parseBooleans&&$!==null&&($.toLowerCase()==="true"||$.toLowerCase()==="false")&&($=$.toLowerCase()==="true"),$}function k($,q){q=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},q),l(q.arrayFormatSeparator);const U=u(q),K=Object.create(null);if(typeof $!="string"||($=$.trim().replace(/^[?#&]/,""),!$))return K;for(const J of $.split("&")){if(J==="")continue;let[T,z]=n(q.decode?J.replace(/\+/g," "):J,"=");z=z===void 0?null:["comma","separator","bracket-separator"].includes(q.arrayFormat)?z:g(z,q),U(g(T,q),z,K)}for(const J of Object.keys(K)){const T=K[J];if(typeof T=="object"&&T!==null)for(const z of Object.keys(T))T[z]=D(T[z],q);else K[J]=D(T,q)}return q.sort===!1?K:(q.sort===!0?Object.keys(K).sort():Object.keys(K).sort(q.sort)).reduce((J,T)=>{const z=K[T];return z&&typeof z=="object"&&!Array.isArray(z)?J[T]=y(z):J[T]=z,J},Object.create(null))}t.extract=N,t.parse=k,t.stringify=($,q)=>{if(!$)return"";q=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},q),l(q.arrayFormatSeparator);const U=z=>q.skipNull&&s($[z])||q.skipEmptyString&&$[z]==="",K=a(q),J={};for(const z of Object.keys($))U(z)||(J[z]=$[z]);const T=Object.keys(J);return q.sort!==!1&&T.sort(q.sort),T.map(z=>{const ue=$[z];return ue===void 0?"":ue===null?d(z,q):Array.isArray(ue)?ue.length===0&&q.arrayFormat==="bracket-separator"?d(z,q)+"[]":ue.reduce(K(z),[]).join("&"):d(z,q)+"="+d(ue,q)}).filter(z=>z.length>0).join("&")},t.parseUrl=($,q)=>{q=Object.assign({decode:!0},q);const[U,K]=n($,"#");return Object.assign({url:U.split("?")[0]||"",query:k(N($),q)},q&&q.parseFragmentIdentifier&&K?{fragmentIdentifier:g(K,q)}:{})},t.stringifyUrl=($,q)=>{q=Object.assign({encode:!0,strict:!0,[o]:!0},q);const U=A($.url).split("?")[0]||"",K=t.extract($.url),J=t.parse(K,{sort:!1}),T=Object.assign(J,$.query);let z=t.stringify(T,q);z&&(z=`?${z}`);let ue=P($.url);return $.fragmentIdentifier&&(ue=`#${q[o]?d($.fragmentIdentifier,q):$.fragmentIdentifier}`),`${U}${z}${ue}`},t.pick=($,q,U)=>{U=Object.assign({parseFragmentIdentifier:!0,[o]:!1},U);const{url:K,query:J,fragmentIdentifier:T}=t.parseUrl($,U);return t.stringifyUrl({url:K,query:i(J,q),fragmentIdentifier:T},U)},t.exclude=($,q,U)=>{const K=Array.isArray(q)?J=>!q.includes(J):(J,T)=>!q(J,T);return t.pick($,K,U)}})(nl);var Tx={exports:{}};/** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.8.0 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT - */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=nn:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],g=[4,1024,262144,67108864],y=[1,256,65536,16777216],A=[6,1536,393216,100663296],P=[0,8,16,24],N=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],D=[224,256,384,512],k=[128,256],$=["hex","buffer","arrayBuffer","array","digest"],q={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(O){return Object.prototype.toString.call(O)==="[object Array]"}),u&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(O){return typeof O=="object"&&O.buffer&&O.buffer.constructor===ArrayBuffer});for(var U=function(O,se,ee){return function(X){return new I(O,se,O).update(X)[ee]()}},K=function(O,se,ee){return function(X,Q){return new I(O,se,Q).update(X)[ee]()}},J=function(O,se,ee){return function(X,Q,R,Z){return f["cshake"+O].update(X,Q,R,Z)[ee]()}},T=function(O,se,ee){return function(X,Q,R,Z){return f["kmac"+O].update(X,Q,R,Z)[ee]()}},z=function(O,se,ee,X){for(var Q=0;Q<$.length;++Q){var R=$[Q];O[R]=se(ee,X,R)}return O},ue=function(O,se){var ee=U(O,se,"hex");return ee.create=function(){return new I(O,se,O)},ee.update=function(X){return ee.create().update(X)},z(ee,U,O,se)},_e=function(O,se){var ee=K(O,se,"hex");return ee.create=function(X){return new I(O,se,X)},ee.update=function(X,Q){return ee.create(Q).update(X)},z(ee,K,O,se)},G=function(O,se){var ee=q[O],X=J(O,se,"hex");return X.create=function(Q,R,Z){return!R&&!Z?f["shake"+O].create(Q):new I(O,se,Q).bytepad([R,Z],ee)},X.update=function(Q,R,Z,te){return X.create(R,Z,te).update(Q)},z(X,J,O,se)},E=function(O,se){var ee=q[O],X=T(O,se,"hex");return X.create=function(Q,R,Z){return new F(O,se,R).bytepad(["KMAC",Z],ee).bytepad([Q],ee)},X.update=function(Q,R,Z,te){return X.create(Q,Z,te).update(R)},z(X,T,O,se)},m=[{name:"keccak",padding:y,bits:D,createMethod:ue},{name:"sha3",padding:A,bits:D,createMethod:ue},{name:"shake",padding:d,bits:k,createMethod:_e},{name:"cshake",padding:g,bits:k,createMethod:G},{name:"kmac",padding:g,bits:k,createMethod:E}],f={},p=[],v=0;v>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ee>>5,this.extraBytes=(ee&31)>>3;for(var X=0;X<50;++X)this.s[X]=0}I.prototype.update=function(O){if(this.finalized)throw new Error(r);var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}for(var X=this.blocks,Q=this.byteCount,R=O.length,Z=this.blockCount,te=0,le=this.s,ie,fe;te>2]|=O[te]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(X[ie>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=Q){for(this.start=ie-Q,this.block=X[Z],ie=0;ie>8,ee=O&255;ee>0;)Q.unshift(ee),O=O>>8,ee=O&255,++X;return se?Q.push(X):Q.unshift(X),this.update(Q),Q.length},I.prototype.encodeString=function(O){var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}var X=0,Q=O.length;if(se)X=Q;else for(var R=0;R=57344?X+=3:(Z=65536+((Z&1023)<<10|O.charCodeAt(++R)&1023),X+=4)}return X+=this.encode(X*8),this.update(O),X},I.prototype.bytepad=function(O,se){for(var ee=this.encode(se),X=0;X>2]|=this.padding[se&3],this.lastByteIndex===this.byteCount)for(O[0]=O[ee],se=1;se>4&15]+l[te&15]+l[te>>12&15]+l[te>>8&15]+l[te>>20&15]+l[te>>16&15]+l[te>>28&15]+l[te>>24&15];R%O===0&&(ae(se),Q=0)}return X&&(te=se[Q],Z+=l[te>>4&15]+l[te&15],X>1&&(Z+=l[te>>12&15]+l[te>>8&15]),X>2&&(Z+=l[te>>20&15]+l[te>>16&15])),Z},I.prototype.arrayBuffer=function(){this.finalize();var O=this.blockCount,se=this.s,ee=this.outputBlocks,X=this.extraBytes,Q=0,R=0,Z=this.outputBits>>3,te;X?te=new ArrayBuffer(ee+1<<2):te=new ArrayBuffer(Z);for(var le=new Uint32Array(te);R>8&255,Z[te+2]=le>>16&255,Z[te+3]=le>>24&255;R%O===0&&ae(se)}return X&&(te=R<<2,le=se[Q],Z[te]=le&255,X>1&&(Z[te+1]=le>>8&255),X>2&&(Z[te+2]=le>>16&255)),Z};function F(O,se,ee){I.call(this,O,se,ee)}F.prototype=new I,F.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var ae=function(O){var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me,Ne,Te,Be,Ie,Le,Ve,ke,ze,He,Ee,Qe,ct,$e,et,rt,Je,pt,ht,ft,Ht,Jt,St,er,Xt,Ot,$t,Tt,vt,Dt,Lt,bt,Bt,Ut,nt,Ft,B,H,V,C,Y,j,oe,pe,xe,Re,De,it,je,gt,st,tt;for(X=0;X<48;X+=2)Q=O[0]^O[10]^O[20]^O[30]^O[40],R=O[1]^O[11]^O[21]^O[31]^O[41],Z=O[2]^O[12]^O[22]^O[32]^O[42],te=O[3]^O[13]^O[23]^O[33]^O[43],le=O[4]^O[14]^O[24]^O[34]^O[44],ie=O[5]^O[15]^O[25]^O[35]^O[45],fe=O[6]^O[16]^O[26]^O[36]^O[46],ve=O[7]^O[17]^O[27]^O[37]^O[47],Me=O[8]^O[18]^O[28]^O[38]^O[48],Ne=O[9]^O[19]^O[29]^O[39]^O[49],se=Me^(Z<<1|te>>>31),ee=Ne^(te<<1|Z>>>31),O[0]^=se,O[1]^=ee,O[10]^=se,O[11]^=ee,O[20]^=se,O[21]^=ee,O[30]^=se,O[31]^=ee,O[40]^=se,O[41]^=ee,se=Q^(le<<1|ie>>>31),ee=R^(ie<<1|le>>>31),O[2]^=se,O[3]^=ee,O[12]^=se,O[13]^=ee,O[22]^=se,O[23]^=ee,O[32]^=se,O[33]^=ee,O[42]^=se,O[43]^=ee,se=Z^(fe<<1|ve>>>31),ee=te^(ve<<1|fe>>>31),O[4]^=se,O[5]^=ee,O[14]^=se,O[15]^=ee,O[24]^=se,O[25]^=ee,O[34]^=se,O[35]^=ee,O[44]^=se,O[45]^=ee,se=le^(Me<<1|Ne>>>31),ee=ie^(Ne<<1|Me>>>31),O[6]^=se,O[7]^=ee,O[16]^=se,O[17]^=ee,O[26]^=se,O[27]^=ee,O[36]^=se,O[37]^=ee,O[46]^=se,O[47]^=ee,se=fe^(Q<<1|R>>>31),ee=ve^(R<<1|Q>>>31),O[8]^=se,O[9]^=ee,O[18]^=se,O[19]^=ee,O[28]^=se,O[29]^=ee,O[38]^=se,O[39]^=ee,O[48]^=se,O[49]^=ee,Te=O[0],Be=O[1],nt=O[11]<<4|O[10]>>>28,Ft=O[10]<<4|O[11]>>>28,Je=O[20]<<3|O[21]>>>29,pt=O[21]<<3|O[20]>>>29,je=O[31]<<9|O[30]>>>23,gt=O[30]<<9|O[31]>>>23,Lt=O[40]<<18|O[41]>>>14,bt=O[41]<<18|O[40]>>>14,St=O[2]<<1|O[3]>>>31,er=O[3]<<1|O[2]>>>31,Ie=O[13]<<12|O[12]>>>20,Le=O[12]<<12|O[13]>>>20,B=O[22]<<10|O[23]>>>22,H=O[23]<<10|O[22]>>>22,ht=O[33]<<13|O[32]>>>19,ft=O[32]<<13|O[33]>>>19,st=O[42]<<2|O[43]>>>30,tt=O[43]<<2|O[42]>>>30,oe=O[5]<<30|O[4]>>>2,pe=O[4]<<30|O[5]>>>2,Xt=O[14]<<6|O[15]>>>26,Ot=O[15]<<6|O[14]>>>26,Ve=O[25]<<11|O[24]>>>21,ke=O[24]<<11|O[25]>>>21,V=O[34]<<15|O[35]>>>17,C=O[35]<<15|O[34]>>>17,Ht=O[45]<<29|O[44]>>>3,Jt=O[44]<<29|O[45]>>>3,ct=O[6]<<28|O[7]>>>4,$e=O[7]<<28|O[6]>>>4,xe=O[17]<<23|O[16]>>>9,Re=O[16]<<23|O[17]>>>9,$t=O[26]<<25|O[27]>>>7,Tt=O[27]<<25|O[26]>>>7,ze=O[36]<<21|O[37]>>>11,He=O[37]<<21|O[36]>>>11,Y=O[47]<<24|O[46]>>>8,j=O[46]<<24|O[47]>>>8,Bt=O[8]<<27|O[9]>>>5,Ut=O[9]<<27|O[8]>>>5,et=O[18]<<20|O[19]>>>12,rt=O[19]<<20|O[18]>>>12,De=O[29]<<7|O[28]>>>25,it=O[28]<<7|O[29]>>>25,vt=O[38]<<8|O[39]>>>24,Dt=O[39]<<8|O[38]>>>24,Ee=O[48]<<14|O[49]>>>18,Qe=O[49]<<14|O[48]>>>18,O[0]=Te^~Ie&Ve,O[1]=Be^~Le&ke,O[10]=ct^~et&Je,O[11]=$e^~rt&pt,O[20]=St^~Xt&$t,O[21]=er^~Ot&Tt,O[30]=Bt^~nt&B,O[31]=Ut^~Ft&H,O[40]=oe^~xe&De,O[41]=pe^~Re&it,O[2]=Ie^~Ve&ze,O[3]=Le^~ke&He,O[12]=et^~Je&ht,O[13]=rt^~pt&ft,O[22]=Xt^~$t&vt,O[23]=Ot^~Tt&Dt,O[32]=nt^~B&V,O[33]=Ft^~H&C,O[42]=xe^~De&je,O[43]=Re^~it>,O[4]=Ve^~ze&Ee,O[5]=ke^~He&Qe,O[14]=Je^~ht&Ht,O[15]=pt^~ft&Jt,O[24]=$t^~vt&Lt,O[25]=Tt^~Dt&bt,O[34]=B^~V&Y,O[35]=H^~C&j,O[44]=De^~je&st,O[45]=it^~gt&tt,O[6]=ze^~Ee&Te,O[7]=He^~Qe&Be,O[16]=ht^~Ht&ct,O[17]=ft^~Jt&$e,O[26]=vt^~Lt&St,O[27]=Dt^~bt&er,O[36]=V^~Y&Bt,O[37]=C^~j&Ut,O[46]=je^~st&oe,O[47]=gt^~tt&pe,O[8]=Ee^~Te&Ie,O[9]=Qe^~Be&Le,O[18]=Ht^~ct&et,O[19]=Jt^~$e&rt,O[28]=Lt^~St&Xt,O[29]=bt^~er&Ot,O[38]=Y^~Bt&nt,O[39]=j^~Ut&Ft,O[48]=st^~oe&xe,O[49]=tt^~pe&Re,O[0]^=N[X],O[1]^=N[X+1]};if(a)t.exports=f;else for(v=0;v{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const Nx=sN();var ym;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(ym||(ym={}));var ds;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(ds||(ds={}));const Lx="0123456789abcdef";class Kr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();md[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Ox>md[n])&&console.log.apply(console,r)}debug(...e){this._log(Kr.levels.DEBUG,e)}info(...e){this._log(Kr.levels.INFO,e)}warn(...e){this._log(Kr.levels.WARNING,e)}makeError(e,r,n){if(Dx)return this.makeError("censored error",r,{});r||(r=Kr.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(u=>{const l=n[u];try{if(l instanceof Uint8Array){let d="";for(let g=0;g>4],d+=Lx[l[g]&15];i.push(u+"=Uint8Array(0x"+d+")")}else i.push(u+"="+JSON.stringify(l))}catch{i.push(u+"="+JSON.stringify(n[u].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case ds.NUMERIC_FAULT:{o="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case ds.CALL_EXCEPTION:case ds.INSUFFICIENT_FUNDS:case ds.MISSING_NEW:case ds.NONCE_EXPIRED:case ds.REPLACEMENT_UNDERPRICED:case ds.TRANSACTION_REPLACED:case ds.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(u){a[u]=n[u]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Kr.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){Nx&&this.throwError("platform missing String.prototype.normalize",Kr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Nx})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Kr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Kr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return bm||(bm=new Kr(iN)),bm}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Rx){if(!e)return;this.globalLogger().throwError("error censorship permanent",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Dx=!!e,Rx=!!r}static setLogLevel(e){const r=md[e.toLowerCase()];if(r==null){Kr.globalLogger().warn("invalid log level - "+e);return}Ox=r}static from(e){return new Kr(e)}}Kr.errors=ds,Kr.levels=ym;const oN="bytes/5.7.0",on=new Kr(oN);function kx(t){return!!t.toHexString}function cu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return cu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function aN(t){return Os(t)&&!(t.length%2)||wm(t)}function $x(t){return typeof t=="number"&&t==t&&t%1===0}function wm(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!$x(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function bn(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),cu(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t)&&(t=t.toHexString()),Os(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":on.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ibn(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),cu(n)}function uN(t,e){t=bn(t),t.length>e&&on.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),cu(r)}function Os(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const xm="0123456789abcdef";function Ii(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=xm[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t))return t.toHexString();if(Os(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":on.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(wm(t)){let r="0x";for(let n=0;n>4]+xm[i&15]}return r}return on.throwArgumentError("invalid hexlify value","value",t)}function fN(t){if(typeof t!="string")t=Ii(t);else if(!Os(t)||t.length%2)return null;return(t.length-2)/2}function Bx(t,e,r){return typeof t!="string"?t=Ii(t):(!Os(t)||t.length%2)&&on.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function uu(t,e){for(typeof t!="string"?t=Ii(t):Os(t)||on.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&on.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Fx(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(aN(t)){let r=bn(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64))):r.length===65?(e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64)),e.v=r[64]):on.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:on.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Ii(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=uN(bn(e._vs),32);e._vs=Ii(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&on.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=Ii(i);e.s==null?e.s=o:e.s!==o&&on.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?on.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&on.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Os(e.r)?on.throwArgumentError("signature missing or invalid r","signature",t):e.r=uu(e.r,32),e.s==null||!Os(e.s)?on.throwArgumentError("signature missing or invalid s","signature",t):e.s=uu(e.s,32);const r=bn(e.s);r[0]>=128&&on.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=Ii(r);e._vs&&(Os(e._vs)||on.throwArgumentError("signature invalid _vs","signature",t),e._vs=uu(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&on.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function _m(t){return"0x"+nN.keccak_256(bn(t))}var Em={exports:{}};Em.exports,function(t){(function(e,r){function n(m,f){if(!m)throw new Error(f||"Assertion failed")}function i(m,f){m.super_=f;var p=function(){};p.prototype=f.prototype,m.prototype=new p,m.prototype.constructor=m}function s(m,f,p){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((f==="le"||f==="be")&&(p=f,f=10),this._init(m||0,f||10,p||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=el.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,p){return f.cmp(p)>0?f:p},s.min=function(f,p){return f.cmp(p)<0?f:p},s.prototype._init=function(f,p,v){if(typeof f=="number")return this._initNumber(f,p,v);if(typeof f=="object")return this._initArray(f,p,v);p==="hex"&&(p=16),n(p===(p|0)&&p>=2&&p<=36),f=f.toString().replace(/\s+/g,"");var x=0;f[0]==="-"&&(x++,this.negative=1),x=0;x-=3)S=f[x]|f[x-1]<<8|f[x-2]<<16,this.words[_]|=S<>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);else if(v==="le")for(x=0,_=0;x>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);return this._strip()};function a(m,f){var p=m.charCodeAt(f);if(p>=48&&p<=57)return p-48;if(p>=65&&p<=70)return p-55;if(p>=97&&p<=102)return p-87;n(!1,"Invalid character in "+m)}function u(m,f,p){var v=a(m,p);return p-1>=f&&(v|=a(m,p-1)<<4),v}s.prototype._parseHex=function(f,p,v){this.length=Math.ceil((f.length-p)/6),this.words=new Array(this.length);for(var x=0;x=p;x-=2)b=u(f,p,x)<<_,this.words[S]|=b&67108863,_>=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8;else{var M=f.length-p;for(x=M%2===0?p+1:p;x=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8}this._strip()};function l(m,f,p,v){for(var x=0,_=0,S=Math.min(m.length,p),b=f;b=49?_=M-49+10:M>=17?_=M-17+10:_=M,n(M>=0&&_1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=g}catch{s.prototype.inspect=g}else s.prototype.inspect=g;function g(){return(this.red?""}var y=["","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"],A=[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,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(f,p){f=f||10,p=p|0||1;var v;if(f===16||f==="hex"){v="";for(var x=0,_=0,S=0;S>>24-x&16777215,x+=2,x>=26&&(x-=26,S--),_!==0||S!==this.length-1?v=y[6-M.length]+M+v:v=M+v}for(_!==0&&(v=_.toString(16)+v);v.length%p!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(f===(f|0)&&f>=2&&f<=36){var I=A[f],F=P[f];v="";var ae=this.clone();for(ae.negative=0;!ae.isZero();){var O=ae.modrn(F).toString(f);ae=ae.idivn(F),ae.isZero()?v=O+v:v=y[I-O.length]+O+v}for(this.isZero()&&(v="0"+v);v.length%p!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,p){return this.toArrayLike(o,f,p)}),s.prototype.toArray=function(f,p){return this.toArrayLike(Array,f,p)};var N=function(f,p){return f.allocUnsafe?f.allocUnsafe(p):new f(p)};s.prototype.toArrayLike=function(f,p,v){this._strip();var x=this.byteLength(),_=v||Math.max(1,x);n(x<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var S=N(f,_),b=p==="le"?"LE":"BE";return this["_toArrayLike"+b](S,x),S},s.prototype._toArrayLikeLE=function(f,p){for(var v=0,x=0,_=0,S=0;_>8&255),v>16&255),S===6?(v>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v=0&&(f[v--]=b>>8&255),v>=0&&(f[v--]=b>>16&255),S===6?(v>=0&&(f[v--]=b>>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v>=0)for(f[v--]=x;v>=0;)f[v--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var p=f,v=0;return p>=4096&&(v+=13,p>>>=13),p>=64&&(v+=7,p>>>=7),p>=8&&(v+=4,p>>>=4),p>=2&&(v+=2,p>>>=2),v+p},s.prototype._zeroBits=function(f){if(f===0)return 26;var p=f,v=0;return p&8191||(v+=13,p>>>=13),p&127||(v+=7,p>>>=7),p&15||(v+=4,p>>>=4),p&3||(v+=2,p>>>=2),p&1||v++,v},s.prototype.bitLength=function(){var f=this.words[this.length-1],p=this._countBits(f);return(this.length-1)*26+p};function D(m){for(var f=new Array(m.bitLength()),p=0;p>>x&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,p=0;pf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var p;this.length>f.length?p=f:p=this;for(var v=0;vf.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var p,v;this.length>f.length?(p=this,v=f):(p=f,v=this);for(var x=0;xf.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var p=Math.ceil(f/26)|0,v=f%26;this._expand(p),v>0&&p--;for(var x=0;x0&&(this.words[x]=~this.words[x]&67108863>>26-v),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,p){n(typeof f=="number"&&f>=0);var v=f/26|0,x=f%26;return this._expand(v+1),p?this.words[v]=this.words[v]|1<f.length?(v=this,x=f):(v=f,x=this);for(var _=0,S=0;S>>26;for(;_!==0&&S>>26;if(this.length=v.length,_!==0)this.words[this.length]=_,this.length++;else if(v!==this)for(;Sf.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var p=this.iadd(f);return f.negative=1,p._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var v=this.cmp(f);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,_;v>0?(x=this,_=f):(x=f,_=this);for(var S=0,b=0;b<_.length;b++)p=(x.words[b]|0)-(_.words[b]|0)+S,S=p>>26,this.words[b]=p&67108863;for(;S!==0&&b>26,this.words[b]=p&67108863;if(S===0&&b>>26,ae=M&67108863,O=Math.min(I,f.length-1),se=Math.max(0,I-m.length+1);se<=O;se++){var ee=I-se|0;x=m.words[ee]|0,_=f.words[se]|0,S=x*_+ae,F+=S/67108864|0,ae=S&67108863}p.words[I]=ae|0,M=F|0}return M!==0?p.words[I]=M|0:p.length--,p._strip()}var $=function(f,p,v){var x=f.words,_=p.words,S=v.words,b=0,M,I,F,ae=x[0]|0,O=ae&8191,se=ae>>>13,ee=x[1]|0,X=ee&8191,Q=ee>>>13,R=x[2]|0,Z=R&8191,te=R>>>13,le=x[3]|0,ie=le&8191,fe=le>>>13,ve=x[4]|0,Me=ve&8191,Ne=ve>>>13,Te=x[5]|0,Be=Te&8191,Ie=Te>>>13,Le=x[6]|0,Ve=Le&8191,ke=Le>>>13,ze=x[7]|0,He=ze&8191,Ee=ze>>>13,Qe=x[8]|0,ct=Qe&8191,$e=Qe>>>13,et=x[9]|0,rt=et&8191,Je=et>>>13,pt=_[0]|0,ht=pt&8191,ft=pt>>>13,Ht=_[1]|0,Jt=Ht&8191,St=Ht>>>13,er=_[2]|0,Xt=er&8191,Ot=er>>>13,$t=_[3]|0,Tt=$t&8191,vt=$t>>>13,Dt=_[4]|0,Lt=Dt&8191,bt=Dt>>>13,Bt=_[5]|0,Ut=Bt&8191,nt=Bt>>>13,Ft=_[6]|0,B=Ft&8191,H=Ft>>>13,V=_[7]|0,C=V&8191,Y=V>>>13,j=_[8]|0,oe=j&8191,pe=j>>>13,xe=_[9]|0,Re=xe&8191,De=xe>>>13;v.negative=f.negative^p.negative,v.length=19,M=Math.imul(O,ht),I=Math.imul(O,ft),I=I+Math.imul(se,ht)|0,F=Math.imul(se,ft);var it=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(it>>>26)|0,it&=67108863,M=Math.imul(X,ht),I=Math.imul(X,ft),I=I+Math.imul(Q,ht)|0,F=Math.imul(Q,ft),M=M+Math.imul(O,Jt)|0,I=I+Math.imul(O,St)|0,I=I+Math.imul(se,Jt)|0,F=F+Math.imul(se,St)|0;var je=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(je>>>26)|0,je&=67108863,M=Math.imul(Z,ht),I=Math.imul(Z,ft),I=I+Math.imul(te,ht)|0,F=Math.imul(te,ft),M=M+Math.imul(X,Jt)|0,I=I+Math.imul(X,St)|0,I=I+Math.imul(Q,Jt)|0,F=F+Math.imul(Q,St)|0,M=M+Math.imul(O,Xt)|0,I=I+Math.imul(O,Ot)|0,I=I+Math.imul(se,Xt)|0,F=F+Math.imul(se,Ot)|0;var gt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(gt>>>26)|0,gt&=67108863,M=Math.imul(ie,ht),I=Math.imul(ie,ft),I=I+Math.imul(fe,ht)|0,F=Math.imul(fe,ft),M=M+Math.imul(Z,Jt)|0,I=I+Math.imul(Z,St)|0,I=I+Math.imul(te,Jt)|0,F=F+Math.imul(te,St)|0,M=M+Math.imul(X,Xt)|0,I=I+Math.imul(X,Ot)|0,I=I+Math.imul(Q,Xt)|0,F=F+Math.imul(Q,Ot)|0,M=M+Math.imul(O,Tt)|0,I=I+Math.imul(O,vt)|0,I=I+Math.imul(se,Tt)|0,F=F+Math.imul(se,vt)|0;var st=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(st>>>26)|0,st&=67108863,M=Math.imul(Me,ht),I=Math.imul(Me,ft),I=I+Math.imul(Ne,ht)|0,F=Math.imul(Ne,ft),M=M+Math.imul(ie,Jt)|0,I=I+Math.imul(ie,St)|0,I=I+Math.imul(fe,Jt)|0,F=F+Math.imul(fe,St)|0,M=M+Math.imul(Z,Xt)|0,I=I+Math.imul(Z,Ot)|0,I=I+Math.imul(te,Xt)|0,F=F+Math.imul(te,Ot)|0,M=M+Math.imul(X,Tt)|0,I=I+Math.imul(X,vt)|0,I=I+Math.imul(Q,Tt)|0,F=F+Math.imul(Q,vt)|0,M=M+Math.imul(O,Lt)|0,I=I+Math.imul(O,bt)|0,I=I+Math.imul(se,Lt)|0,F=F+Math.imul(se,bt)|0;var tt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(tt>>>26)|0,tt&=67108863,M=Math.imul(Be,ht),I=Math.imul(Be,ft),I=I+Math.imul(Ie,ht)|0,F=Math.imul(Ie,ft),M=M+Math.imul(Me,Jt)|0,I=I+Math.imul(Me,St)|0,I=I+Math.imul(Ne,Jt)|0,F=F+Math.imul(Ne,St)|0,M=M+Math.imul(ie,Xt)|0,I=I+Math.imul(ie,Ot)|0,I=I+Math.imul(fe,Xt)|0,F=F+Math.imul(fe,Ot)|0,M=M+Math.imul(Z,Tt)|0,I=I+Math.imul(Z,vt)|0,I=I+Math.imul(te,Tt)|0,F=F+Math.imul(te,vt)|0,M=M+Math.imul(X,Lt)|0,I=I+Math.imul(X,bt)|0,I=I+Math.imul(Q,Lt)|0,F=F+Math.imul(Q,bt)|0,M=M+Math.imul(O,Ut)|0,I=I+Math.imul(O,nt)|0,I=I+Math.imul(se,Ut)|0,F=F+Math.imul(se,nt)|0;var At=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(At>>>26)|0,At&=67108863,M=Math.imul(Ve,ht),I=Math.imul(Ve,ft),I=I+Math.imul(ke,ht)|0,F=Math.imul(ke,ft),M=M+Math.imul(Be,Jt)|0,I=I+Math.imul(Be,St)|0,I=I+Math.imul(Ie,Jt)|0,F=F+Math.imul(Ie,St)|0,M=M+Math.imul(Me,Xt)|0,I=I+Math.imul(Me,Ot)|0,I=I+Math.imul(Ne,Xt)|0,F=F+Math.imul(Ne,Ot)|0,M=M+Math.imul(ie,Tt)|0,I=I+Math.imul(ie,vt)|0,I=I+Math.imul(fe,Tt)|0,F=F+Math.imul(fe,vt)|0,M=M+Math.imul(Z,Lt)|0,I=I+Math.imul(Z,bt)|0,I=I+Math.imul(te,Lt)|0,F=F+Math.imul(te,bt)|0,M=M+Math.imul(X,Ut)|0,I=I+Math.imul(X,nt)|0,I=I+Math.imul(Q,Ut)|0,F=F+Math.imul(Q,nt)|0,M=M+Math.imul(O,B)|0,I=I+Math.imul(O,H)|0,I=I+Math.imul(se,B)|0,F=F+Math.imul(se,H)|0;var Rt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,M=Math.imul(He,ht),I=Math.imul(He,ft),I=I+Math.imul(Ee,ht)|0,F=Math.imul(Ee,ft),M=M+Math.imul(Ve,Jt)|0,I=I+Math.imul(Ve,St)|0,I=I+Math.imul(ke,Jt)|0,F=F+Math.imul(ke,St)|0,M=M+Math.imul(Be,Xt)|0,I=I+Math.imul(Be,Ot)|0,I=I+Math.imul(Ie,Xt)|0,F=F+Math.imul(Ie,Ot)|0,M=M+Math.imul(Me,Tt)|0,I=I+Math.imul(Me,vt)|0,I=I+Math.imul(Ne,Tt)|0,F=F+Math.imul(Ne,vt)|0,M=M+Math.imul(ie,Lt)|0,I=I+Math.imul(ie,bt)|0,I=I+Math.imul(fe,Lt)|0,F=F+Math.imul(fe,bt)|0,M=M+Math.imul(Z,Ut)|0,I=I+Math.imul(Z,nt)|0,I=I+Math.imul(te,Ut)|0,F=F+Math.imul(te,nt)|0,M=M+Math.imul(X,B)|0,I=I+Math.imul(X,H)|0,I=I+Math.imul(Q,B)|0,F=F+Math.imul(Q,H)|0,M=M+Math.imul(O,C)|0,I=I+Math.imul(O,Y)|0,I=I+Math.imul(se,C)|0,F=F+Math.imul(se,Y)|0;var Mt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,M=Math.imul(ct,ht),I=Math.imul(ct,ft),I=I+Math.imul($e,ht)|0,F=Math.imul($e,ft),M=M+Math.imul(He,Jt)|0,I=I+Math.imul(He,St)|0,I=I+Math.imul(Ee,Jt)|0,F=F+Math.imul(Ee,St)|0,M=M+Math.imul(Ve,Xt)|0,I=I+Math.imul(Ve,Ot)|0,I=I+Math.imul(ke,Xt)|0,F=F+Math.imul(ke,Ot)|0,M=M+Math.imul(Be,Tt)|0,I=I+Math.imul(Be,vt)|0,I=I+Math.imul(Ie,Tt)|0,F=F+Math.imul(Ie,vt)|0,M=M+Math.imul(Me,Lt)|0,I=I+Math.imul(Me,bt)|0,I=I+Math.imul(Ne,Lt)|0,F=F+Math.imul(Ne,bt)|0,M=M+Math.imul(ie,Ut)|0,I=I+Math.imul(ie,nt)|0,I=I+Math.imul(fe,Ut)|0,F=F+Math.imul(fe,nt)|0,M=M+Math.imul(Z,B)|0,I=I+Math.imul(Z,H)|0,I=I+Math.imul(te,B)|0,F=F+Math.imul(te,H)|0,M=M+Math.imul(X,C)|0,I=I+Math.imul(X,Y)|0,I=I+Math.imul(Q,C)|0,F=F+Math.imul(Q,Y)|0,M=M+Math.imul(O,oe)|0,I=I+Math.imul(O,pe)|0,I=I+Math.imul(se,oe)|0,F=F+Math.imul(se,pe)|0;var Et=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Et>>>26)|0,Et&=67108863,M=Math.imul(rt,ht),I=Math.imul(rt,ft),I=I+Math.imul(Je,ht)|0,F=Math.imul(Je,ft),M=M+Math.imul(ct,Jt)|0,I=I+Math.imul(ct,St)|0,I=I+Math.imul($e,Jt)|0,F=F+Math.imul($e,St)|0,M=M+Math.imul(He,Xt)|0,I=I+Math.imul(He,Ot)|0,I=I+Math.imul(Ee,Xt)|0,F=F+Math.imul(Ee,Ot)|0,M=M+Math.imul(Ve,Tt)|0,I=I+Math.imul(Ve,vt)|0,I=I+Math.imul(ke,Tt)|0,F=F+Math.imul(ke,vt)|0,M=M+Math.imul(Be,Lt)|0,I=I+Math.imul(Be,bt)|0,I=I+Math.imul(Ie,Lt)|0,F=F+Math.imul(Ie,bt)|0,M=M+Math.imul(Me,Ut)|0,I=I+Math.imul(Me,nt)|0,I=I+Math.imul(Ne,Ut)|0,F=F+Math.imul(Ne,nt)|0,M=M+Math.imul(ie,B)|0,I=I+Math.imul(ie,H)|0,I=I+Math.imul(fe,B)|0,F=F+Math.imul(fe,H)|0,M=M+Math.imul(Z,C)|0,I=I+Math.imul(Z,Y)|0,I=I+Math.imul(te,C)|0,F=F+Math.imul(te,Y)|0,M=M+Math.imul(X,oe)|0,I=I+Math.imul(X,pe)|0,I=I+Math.imul(Q,oe)|0,F=F+Math.imul(Q,pe)|0,M=M+Math.imul(O,Re)|0,I=I+Math.imul(O,De)|0,I=I+Math.imul(se,Re)|0,F=F+Math.imul(se,De)|0;var dt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(dt>>>26)|0,dt&=67108863,M=Math.imul(rt,Jt),I=Math.imul(rt,St),I=I+Math.imul(Je,Jt)|0,F=Math.imul(Je,St),M=M+Math.imul(ct,Xt)|0,I=I+Math.imul(ct,Ot)|0,I=I+Math.imul($e,Xt)|0,F=F+Math.imul($e,Ot)|0,M=M+Math.imul(He,Tt)|0,I=I+Math.imul(He,vt)|0,I=I+Math.imul(Ee,Tt)|0,F=F+Math.imul(Ee,vt)|0,M=M+Math.imul(Ve,Lt)|0,I=I+Math.imul(Ve,bt)|0,I=I+Math.imul(ke,Lt)|0,F=F+Math.imul(ke,bt)|0,M=M+Math.imul(Be,Ut)|0,I=I+Math.imul(Be,nt)|0,I=I+Math.imul(Ie,Ut)|0,F=F+Math.imul(Ie,nt)|0,M=M+Math.imul(Me,B)|0,I=I+Math.imul(Me,H)|0,I=I+Math.imul(Ne,B)|0,F=F+Math.imul(Ne,H)|0,M=M+Math.imul(ie,C)|0,I=I+Math.imul(ie,Y)|0,I=I+Math.imul(fe,C)|0,F=F+Math.imul(fe,Y)|0,M=M+Math.imul(Z,oe)|0,I=I+Math.imul(Z,pe)|0,I=I+Math.imul(te,oe)|0,F=F+Math.imul(te,pe)|0,M=M+Math.imul(X,Re)|0,I=I+Math.imul(X,De)|0,I=I+Math.imul(Q,Re)|0,F=F+Math.imul(Q,De)|0;var _t=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(_t>>>26)|0,_t&=67108863,M=Math.imul(rt,Xt),I=Math.imul(rt,Ot),I=I+Math.imul(Je,Xt)|0,F=Math.imul(Je,Ot),M=M+Math.imul(ct,Tt)|0,I=I+Math.imul(ct,vt)|0,I=I+Math.imul($e,Tt)|0,F=F+Math.imul($e,vt)|0,M=M+Math.imul(He,Lt)|0,I=I+Math.imul(He,bt)|0,I=I+Math.imul(Ee,Lt)|0,F=F+Math.imul(Ee,bt)|0,M=M+Math.imul(Ve,Ut)|0,I=I+Math.imul(Ve,nt)|0,I=I+Math.imul(ke,Ut)|0,F=F+Math.imul(ke,nt)|0,M=M+Math.imul(Be,B)|0,I=I+Math.imul(Be,H)|0,I=I+Math.imul(Ie,B)|0,F=F+Math.imul(Ie,H)|0,M=M+Math.imul(Me,C)|0,I=I+Math.imul(Me,Y)|0,I=I+Math.imul(Ne,C)|0,F=F+Math.imul(Ne,Y)|0,M=M+Math.imul(ie,oe)|0,I=I+Math.imul(ie,pe)|0,I=I+Math.imul(fe,oe)|0,F=F+Math.imul(fe,pe)|0,M=M+Math.imul(Z,Re)|0,I=I+Math.imul(Z,De)|0,I=I+Math.imul(te,Re)|0,F=F+Math.imul(te,De)|0;var ot=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(ot>>>26)|0,ot&=67108863,M=Math.imul(rt,Tt),I=Math.imul(rt,vt),I=I+Math.imul(Je,Tt)|0,F=Math.imul(Je,vt),M=M+Math.imul(ct,Lt)|0,I=I+Math.imul(ct,bt)|0,I=I+Math.imul($e,Lt)|0,F=F+Math.imul($e,bt)|0,M=M+Math.imul(He,Ut)|0,I=I+Math.imul(He,nt)|0,I=I+Math.imul(Ee,Ut)|0,F=F+Math.imul(Ee,nt)|0,M=M+Math.imul(Ve,B)|0,I=I+Math.imul(Ve,H)|0,I=I+Math.imul(ke,B)|0,F=F+Math.imul(ke,H)|0,M=M+Math.imul(Be,C)|0,I=I+Math.imul(Be,Y)|0,I=I+Math.imul(Ie,C)|0,F=F+Math.imul(Ie,Y)|0,M=M+Math.imul(Me,oe)|0,I=I+Math.imul(Me,pe)|0,I=I+Math.imul(Ne,oe)|0,F=F+Math.imul(Ne,pe)|0,M=M+Math.imul(ie,Re)|0,I=I+Math.imul(ie,De)|0,I=I+Math.imul(fe,Re)|0,F=F+Math.imul(fe,De)|0;var wt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(wt>>>26)|0,wt&=67108863,M=Math.imul(rt,Lt),I=Math.imul(rt,bt),I=I+Math.imul(Je,Lt)|0,F=Math.imul(Je,bt),M=M+Math.imul(ct,Ut)|0,I=I+Math.imul(ct,nt)|0,I=I+Math.imul($e,Ut)|0,F=F+Math.imul($e,nt)|0,M=M+Math.imul(He,B)|0,I=I+Math.imul(He,H)|0,I=I+Math.imul(Ee,B)|0,F=F+Math.imul(Ee,H)|0,M=M+Math.imul(Ve,C)|0,I=I+Math.imul(Ve,Y)|0,I=I+Math.imul(ke,C)|0,F=F+Math.imul(ke,Y)|0,M=M+Math.imul(Be,oe)|0,I=I+Math.imul(Be,pe)|0,I=I+Math.imul(Ie,oe)|0,F=F+Math.imul(Ie,pe)|0,M=M+Math.imul(Me,Re)|0,I=I+Math.imul(Me,De)|0,I=I+Math.imul(Ne,Re)|0,F=F+Math.imul(Ne,De)|0;var lt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(lt>>>26)|0,lt&=67108863,M=Math.imul(rt,Ut),I=Math.imul(rt,nt),I=I+Math.imul(Je,Ut)|0,F=Math.imul(Je,nt),M=M+Math.imul(ct,B)|0,I=I+Math.imul(ct,H)|0,I=I+Math.imul($e,B)|0,F=F+Math.imul($e,H)|0,M=M+Math.imul(He,C)|0,I=I+Math.imul(He,Y)|0,I=I+Math.imul(Ee,C)|0,F=F+Math.imul(Ee,Y)|0,M=M+Math.imul(Ve,oe)|0,I=I+Math.imul(Ve,pe)|0,I=I+Math.imul(ke,oe)|0,F=F+Math.imul(ke,pe)|0,M=M+Math.imul(Be,Re)|0,I=I+Math.imul(Be,De)|0,I=I+Math.imul(Ie,Re)|0,F=F+Math.imul(Ie,De)|0;var at=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(at>>>26)|0,at&=67108863,M=Math.imul(rt,B),I=Math.imul(rt,H),I=I+Math.imul(Je,B)|0,F=Math.imul(Je,H),M=M+Math.imul(ct,C)|0,I=I+Math.imul(ct,Y)|0,I=I+Math.imul($e,C)|0,F=F+Math.imul($e,Y)|0,M=M+Math.imul(He,oe)|0,I=I+Math.imul(He,pe)|0,I=I+Math.imul(Ee,oe)|0,F=F+Math.imul(Ee,pe)|0,M=M+Math.imul(Ve,Re)|0,I=I+Math.imul(Ve,De)|0,I=I+Math.imul(ke,Re)|0,F=F+Math.imul(ke,De)|0;var Se=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Se>>>26)|0,Se&=67108863,M=Math.imul(rt,C),I=Math.imul(rt,Y),I=I+Math.imul(Je,C)|0,F=Math.imul(Je,Y),M=M+Math.imul(ct,oe)|0,I=I+Math.imul(ct,pe)|0,I=I+Math.imul($e,oe)|0,F=F+Math.imul($e,pe)|0,M=M+Math.imul(He,Re)|0,I=I+Math.imul(He,De)|0,I=I+Math.imul(Ee,Re)|0,F=F+Math.imul(Ee,De)|0;var Ae=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,M=Math.imul(rt,oe),I=Math.imul(rt,pe),I=I+Math.imul(Je,oe)|0,F=Math.imul(Je,pe),M=M+Math.imul(ct,Re)|0,I=I+Math.imul(ct,De)|0,I=I+Math.imul($e,Re)|0,F=F+Math.imul($e,De)|0;var Ge=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,M=Math.imul(rt,Re),I=Math.imul(rt,De),I=I+Math.imul(Je,Re)|0,F=Math.imul(Je,De);var Ue=(b+M|0)+((I&8191)<<13)|0;return b=(F+(I>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,S[0]=it,S[1]=je,S[2]=gt,S[3]=st,S[4]=tt,S[5]=At,S[6]=Rt,S[7]=Mt,S[8]=Et,S[9]=dt,S[10]=_t,S[11]=ot,S[12]=wt,S[13]=lt,S[14]=at,S[15]=Se,S[16]=Ae,S[17]=Ge,S[18]=Ue,b!==0&&(S[19]=b,v.length++),v};Math.imul||($=k);function q(m,f,p){p.negative=f.negative^m.negative,p.length=m.length+f.length;for(var v=0,x=0,_=0;_>>26)|0,x+=S>>>26,S&=67108863}p.words[_]=b,v=S,S=x}return v!==0?p.words[_]=v:p.length--,p._strip()}function U(m,f,p){return q(m,f,p)}s.prototype.mulTo=function(f,p){var v,x=this.length+f.length;return this.length===10&&f.length===10?v=$(this,f,p):x<63?v=k(this,f,p):x<1024?v=q(this,f,p):v=U(this,f,p),v},s.prototype.mul=function(f){var p=new s(null);return p.words=new Array(this.length+f.length),this.mulTo(f,p)},s.prototype.mulf=function(f){var p=new s(null);return p.words=new Array(this.length+f.length),U(this,f,p)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var p=f<0;p&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var v=0,x=0;x>=26,v+=_/67108864|0,v+=S>>>26,this.words[x]=S&67108863}return v!==0&&(this.words[x]=v,this.length++),p?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var p=D(f);if(p.length===0)return new s(1);for(var v=this,x=0;x=0);var p=f%26,v=(f-p)/26,x=67108863>>>26-p<<26-p,_;if(p!==0){var S=0;for(_=0;_>>26-p}S&&(this.words[_]=S,this.length++)}if(v!==0){for(_=this.length-1;_>=0;_--)this.words[_+v]=this.words[_];for(_=0;_=0);var x;p?x=(p-p%26)/26:x=0;var _=f%26,S=Math.min((f-_)/26,this.length),b=67108863^67108863>>>_<<_,M=v;if(x-=S,x=Math.max(0,x),M){for(var I=0;IS)for(this.length-=S,I=0;I=0&&(F!==0||I>=x);I--){var ae=this.words[I]|0;this.words[I]=F<<26-_|ae>>>_,F=ae&b}return M&&F!==0&&(M.words[M.length++]=F),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,p,v){return n(this.negative===0),this.iushrn(f,p,v)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var p=f%26,v=(f-p)/26,x=1<=0);var p=f%26,v=(f-p)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(p!==0&&v++,this.length=Math.min(v,this.length),p!==0){var x=67108863^67108863>>>p<=67108864;p++)this.words[p]-=67108864,p===this.length-1?this.words[p+1]=1:this.words[p+1]++;return this.length=Math.max(this.length,p+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var p=0;p>26)-(M/67108864|0),this.words[_+v]=S&67108863}for(;_>26,this.words[_+v]=S&67108863;if(b===0)return this._strip();for(n(b===-1),b=0,_=0;_>26,this.words[_]=S&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,p){var v=this.length-f.length,x=this.clone(),_=f,S=_.words[_.length-1]|0,b=this._countBits(S);v=26-b,v!==0&&(_=_.ushln(v),x.iushln(v),S=_.words[_.length-1]|0);var M=x.length-_.length,I;if(p!=="mod"){I=new s(null),I.length=M+1,I.words=new Array(I.length);for(var F=0;F=0;O--){var se=(x.words[_.length+O]|0)*67108864+(x.words[_.length+O-1]|0);for(se=Math.min(se/S|0,67108863),x._ishlnsubmul(_,se,O);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(_,1,O),x.isZero()||(x.negative^=1);I&&(I.words[O]=se)}return I&&I._strip(),x._strip(),p!=="div"&&v!==0&&x.iushrn(v),{div:I||null,mod:x}},s.prototype.divmod=function(f,p,v){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,_,S;return this.negative!==0&&f.negative===0?(S=this.neg().divmod(f,p),p!=="mod"&&(x=S.div.neg()),p!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.iadd(f)),{div:x,mod:_}):this.negative===0&&f.negative!==0?(S=this.divmod(f.neg(),p),p!=="mod"&&(x=S.div.neg()),{div:x,mod:S.mod}):this.negative&f.negative?(S=this.neg().divmod(f.neg(),p),p!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.isub(f)),{div:S.div,mod:_}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?p==="div"?{div:this.divn(f.words[0]),mod:null}:p==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,p)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var p=this.divmod(f);if(p.mod.isZero())return p.div;var v=p.div.negative!==0?p.mod.isub(f):p.mod,x=f.ushrn(1),_=f.andln(1),S=v.cmp(x);return S<0||_===1&&S===0?p.div:p.div.negative!==0?p.div.isubn(1):p.div.iaddn(1)},s.prototype.modrn=function(f){var p=f<0;p&&(f=-f),n(f<=67108863);for(var v=(1<<26)%f,x=0,_=this.length-1;_>=0;_--)x=(v*x+(this.words[_]|0))%f;return p?-x:x},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var p=f<0;p&&(f=-f),n(f<=67108863);for(var v=0,x=this.length-1;x>=0;x--){var _=(this.words[x]|0)+v*67108864;this.words[x]=_/f|0,v=_%f}return this._strip(),p?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var p=this,v=f.clone();p.negative!==0?p=p.umod(f):p=p.clone();for(var x=new s(1),_=new s(0),S=new s(0),b=new s(1),M=0;p.isEven()&&v.isEven();)p.iushrn(1),v.iushrn(1),++M;for(var I=v.clone(),F=p.clone();!p.isZero();){for(var ae=0,O=1;!(p.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(p.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(I),_.isub(F)),x.iushrn(1),_.iushrn(1);for(var se=0,ee=1;!(v.words[0]&ee)&&se<26;++se,ee<<=1);if(se>0)for(v.iushrn(se);se-- >0;)(S.isOdd()||b.isOdd())&&(S.iadd(I),b.isub(F)),S.iushrn(1),b.iushrn(1);p.cmp(v)>=0?(p.isub(v),x.isub(S),_.isub(b)):(v.isub(p),S.isub(x),b.isub(_))}return{a:S,b,gcd:v.iushln(M)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var p=this,v=f.clone();p.negative!==0?p=p.umod(f):p=p.clone();for(var x=new s(1),_=new s(0),S=v.clone();p.cmpn(1)>0&&v.cmpn(1)>0;){for(var b=0,M=1;!(p.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(p.iushrn(b);b-- >0;)x.isOdd()&&x.iadd(S),x.iushrn(1);for(var I=0,F=1;!(v.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(v.iushrn(I);I-- >0;)_.isOdd()&&_.iadd(S),_.iushrn(1);p.cmp(v)>=0?(p.isub(v),x.isub(_)):(v.isub(p),_.isub(x))}var ae;return p.cmpn(1)===0?ae=x:ae=_,ae.cmpn(0)<0&&ae.iadd(f),ae},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var p=this.clone(),v=f.clone();p.negative=0,v.negative=0;for(var x=0;p.isEven()&&v.isEven();x++)p.iushrn(1),v.iushrn(1);do{for(;p.isEven();)p.iushrn(1);for(;v.isEven();)v.iushrn(1);var _=p.cmp(v);if(_<0){var S=p;p=v,v=S}else if(_===0||v.cmpn(1)===0)break;p.isub(v)}while(!0);return v.iushln(x)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var p=f%26,v=(f-p)/26,x=1<>>26,b&=67108863,this.words[S]=b}return _!==0&&(this.words[S]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var p=f<0;if(this.negative!==0&&!p)return-1;if(this.negative===0&&p)return 1;this._strip();var v;if(this.length>1)v=1;else{p&&(f=-f),n(f<=67108863,"Number is too big");var x=this.words[0]|0;v=x===f?0:xf.length)return 1;if(this.length=0;v--){var x=this.words[v]|0,_=f.words[v]|0;if(x!==_){x<_?p=-1:x>_&&(p=1);break}}return p},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new G(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var K={k256:null,p224:null,p192:null,p25519:null};function J(m,f){this.name=m,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}J.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},J.prototype.ireduce=function(f){var p=f,v;do this.split(p,this.tmp),p=this.imulK(p),p=p.iadd(this.tmp),v=p.bitLength();while(v>this.n);var x=v0?p.isub(this.p):p.strip!==void 0?p.strip():p._strip(),p},J.prototype.split=function(f,p){f.iushrn(this.n,0,p)},J.prototype.imulK=function(f){return f.imul(this.k)};function T(){J.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(T,J),T.prototype.split=function(f,p){for(var v=4194303,x=Math.min(f.length,9),_=0;_>>22,S=b}S>>>=22,f.words[_-10]=S,S===0&&f.length>10?f.length-=10:f.length-=9},T.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var p=0,v=0;v>>=26,f.words[v]=_,p=x}return p!==0&&(f.words[f.length++]=p),f},s._prime=function(f){if(K[f])return K[f];var p;if(f==="k256")p=new T;else if(f==="p224")p=new z;else if(f==="p192")p=new ue;else if(f==="p25519")p=new _e;else throw new Error("Unknown prime "+f);return K[f]=p,p};function G(m){if(typeof m=="string"){var f=s._prime(m);this.m=f.p,this.prime=f}else n(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}G.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},G.prototype._verify2=function(f,p){n((f.negative|p.negative)===0,"red works only with positives"),n(f.red&&f.red===p.red,"red works only with red numbers")},G.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(d(f,f.umod(this.m)._forceRed(this)),f)},G.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},G.prototype.add=function(f,p){this._verify2(f,p);var v=f.add(p);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},G.prototype.iadd=function(f,p){this._verify2(f,p);var v=f.iadd(p);return v.cmp(this.m)>=0&&v.isub(this.m),v},G.prototype.sub=function(f,p){this._verify2(f,p);var v=f.sub(p);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},G.prototype.isub=function(f,p){this._verify2(f,p);var v=f.isub(p);return v.cmpn(0)<0&&v.iadd(this.m),v},G.prototype.shl=function(f,p){return this._verify1(f),this.imod(f.ushln(p))},G.prototype.imul=function(f,p){return this._verify2(f,p),this.imod(f.imul(p))},G.prototype.mul=function(f,p){return this._verify2(f,p),this.imod(f.mul(p))},G.prototype.isqr=function(f){return this.imul(f,f.clone())},G.prototype.sqr=function(f){return this.mul(f,f)},G.prototype.sqrt=function(f){if(f.isZero())return f.clone();var p=this.m.andln(3);if(n(p%2===1),p===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(f,v)}for(var x=this.m.subn(1),_=0;!x.isZero()&&x.andln(1)===0;)_++,x.iushrn(1);n(!x.isZero());var S=new s(1).toRed(this),b=S.redNeg(),M=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,M).cmp(b)!==0;)I.redIAdd(b);for(var F=this.pow(I,x),ae=this.pow(f,x.addn(1).iushrn(1)),O=this.pow(f,x),se=_;O.cmp(S)!==0;){for(var ee=O,X=0;ee.cmp(S)!==0;X++)ee=ee.redSqr();n(X=0;_--){for(var F=p.words[_],ae=I-1;ae>=0;ae--){var O=F>>ae&1;if(S!==x[0]&&(S=this.sqr(S)),O===0&&b===0){M=0;continue}b<<=1,b|=O,M++,!(M!==v&&(_!==0||ae!==0))&&(S=this.mul(S,x[b]),M=0,b=0)}I=26}return S},G.prototype.convertTo=function(f){var p=f.umod(this.m);return p===f?p.clone():p},G.prototype.convertFrom=function(f){var p=f.clone();return p.red=null,p},s.mont=function(f){return new E(f)};function E(m){G.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(E,G),E.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},E.prototype.convertFrom=function(f){var p=this.imod(f.mul(this.rinv));return p.red=null,p},E.prototype.imul=function(f,p){if(f.isZero()||p.isZero())return f.words[0]=0,f.length=1,f;var v=f.imul(p),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.mul=function(f,p){if(f.isZero()||p.isZero())return new s(0)._forceRed(this);var v=f.mul(p),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.invm=function(f){var p=this.imod(f._invmp(this.m).mul(this.r2));return p._forceRed(this)}})(t,nn)}(Em);var lN=Em.exports;const rr=Ui(lN);var hN=rr.BN;function dN(t){return new hN(t,36).toString(16)}const pN="strings/5.7.0",gN=new Kr(pN);var vd;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(vd||(vd={}));var Ux;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(Ux||(Ux={}));function Sm(t,e=vd.current){e!=vd.current&&(gN.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return bn(r)}const mN=`Ethereum Signed Message: -`;function jx(t){return typeof t=="string"&&(t=Sm(t)),_m(cN([Sm(mN),Sm(String(t.length)),t]))}const vN="address/5.7.0",il=new Kr(vN);function qx(t){Os(t,20)||il.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=bn(_m(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const bN=9007199254740991;function yN(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const Am={};for(let t=0;t<10;t++)Am[String(t)]=String(t);for(let t=0;t<26;t++)Am[String.fromCharCode(65+t)]=String(10+t);const zx=Math.floor(yN(bN));function wN(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Am[n]).join("");for(;e.length>=zx;){let n=e.substring(0,zx);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function xN(t){let e=null;if(typeof t!="string"&&il.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=qx(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&il.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==wN(t)&&il.throwArgumentError("bad icap checksum","address",t),e=dN(t.substring(4));e.length<40;)e="0"+e;e=qx("0x"+e)}else il.throwArgumentError("invalid address","address",t);return e}function sl(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var ol={},yr={},Va=Hx;function Hx(t,e){if(!t)throw new Error(e||"Assertion failed")}Hx.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var Pm={exports:{}};typeof Object.create=="function"?Pm.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Pm.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var bd=Pm.exports,_N=Va,EN=bd;yr.inherits=EN;function SN(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function AN(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):SN(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}yr.htonl=Wx;function MN(t,e){for(var r="",n=0;n>>0}return s}yr.join32=IN;function CN(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}yr.split32=CN;function TN(t,e){return t>>>e|t<<32-e}yr.rotr32=TN;function RN(t,e){return t<>>32-e}yr.rotl32=RN;function DN(t,e){return t+e>>>0}yr.sum32=DN;function ON(t,e,r){return t+e+r>>>0}yr.sum32_3=ON;function NN(t,e,r,n){return t+e+r+n>>>0}yr.sum32_4=NN;function LN(t,e,r,n,i){return t+e+r+n+i>>>0}yr.sum32_5=LN;function kN(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}yr.sum64=kN;function $N(t,e,r,n){var i=e+n>>>0,s=(i>>0}yr.sum64_hi=$N;function BN(t,e,r,n){var i=e+n;return i>>>0}yr.sum64_lo=BN;function FN(t,e,r,n,i,s,o,a){var u=0,l=e;l=l+n>>>0,u+=l>>0,u+=l>>0,u+=l>>0}yr.sum64_4_hi=FN;function UN(t,e,r,n,i,s,o,a){var u=e+n+s+a;return u>>>0}yr.sum64_4_lo=UN;function jN(t,e,r,n,i,s,o,a,u,l){var d=0,g=e;g=g+n>>>0,d+=g>>0,d+=g>>0,d+=g>>0,d+=g>>0}yr.sum64_5_hi=jN;function qN(t,e,r,n,i,s,o,a,u,l){var d=e+n+s+a+l;return d>>>0}yr.sum64_5_lo=qN;function zN(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}yr.rotr64_hi=zN;function HN(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.rotr64_lo=HN;function WN(t,e,r){return t>>>r}yr.shr64_hi=WN;function KN(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.shr64_lo=KN;var fu={},Gx=yr,VN=Va;function yd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}fu.BlockHash=yd,yd.prototype.update=function(e,r){if(e=Gx.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Gx.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}Ns.g0_256=ZN;function QN(t){return Ls(t,17)^Ls(t,19)^t>>>10}Ns.g1_256=QN;var hu=yr,eL=fu,tL=Ns,Mm=hu.rotl32,al=hu.sum32,rL=hu.sum32_5,nL=tL.ft_1,Zx=eL.BlockHash,iL=[1518500249,1859775393,2400959708,3395469782];function ks(){if(!(this instanceof ks))return new ks;Zx.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}hu.inherits(ks,Zx);var sL=ks;ks.blockSize=512,ks.outSize=160,ks.hmacStrength=80,ks.padLength=64,ks.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),KL(e.length<=this.blockSize);for(var r=e.length;r>8,y=d&255;g?u.push(g,y):u.push(y)}return u}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",u=0;u(y>>1)-1?N=(y>>1)-D:N=D,A.isubn(N)):N=0,g[P]=N,A.iushrn(1)}return g}r.getNAF=n;function i(u,l){var d=[[],[]];u=u.clone(),l=l.clone();for(var g=0,y=0,A;u.cmpn(-g)>0||l.cmpn(-y)>0;){var P=u.andln(3)+g&3,N=l.andln(3)+y&3;P===3&&(P=-1),N===3&&(N=-1);var D;P&1?(A=u.andln(7)+g&7,(A===3||A===5)&&N===2?D=-P:D=P):D=0,d[0].push(D);var k;N&1?(A=l.andln(7)+y&7,(A===3||A===5)&&P===2?k=-N:k=N):k=0,d[1].push(k),2*g===D+1&&(g=1-g),2*y===k+1&&(y=1-y),u.iushrn(1),l.iushrn(1)}return d}r.getJSF=i;function s(u,l,d){var g="_"+l;u.prototype[l]=function(){return this[g]!==void 0?this[g]:this[g]=d.call(this)}}r.cachedProperty=s;function o(u){return typeof u=="string"?r.toArray(u,"hex"):u}r.parseBytes=o;function a(u){return new rr(u,"hex","le")}r.intFromLE=a}),xd=Ci.getNAF,YL=Ci.getJSF,_d=Ci.assert;function ra(t,e){this.type=t,this.p=new rr(e.p,16),this.red=e.prime?rr.red(e.prime):rr.mont(this.p),this.zero=new rr(0).toRed(this.red),this.one=new rr(1).toRed(this.red),this.two=new rr(2).toRed(this.red),this.n=e.n&&new rr(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ya=ra;ra.prototype.point=function(){throw new Error("Not implemented")},ra.prototype.validate=function(){throw new Error("Not implemented")},ra.prototype._fixedNafMul=function(e,r){_d(e.precomputed);var n=e._getDoubles(),i=xd(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),g=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];_d(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},ra.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,g,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=xd(n[P],o[P],this._bitLength),u[N]=xd(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],$=YL(n[P],n[N]);for(l=Math.max($[0].length,l),u[P]=new Array(l),u[N]=new Array(l),g=0;g=0;d--){for(var T=0;d>=0;){var z=!0;for(g=0;g=0&&T++,K=K.dblp(T),d<0)break;for(g=0;g0?y=a[g][ue-1>>1]:ue<0&&(y=a[g][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},zi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),g.negative&&(g=g.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:g,b:y},{a:A,b:P}]},Hi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),g=e.sub(a).sub(u),y=l.add(d).neg();return{k1:g,k2:y}},Hi.prototype.pointFromX=function(e,r){e=new rr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Hi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Hi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Dn.prototype.isInfinity=function(){return this.inf},Dn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Dn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Dn.prototype.getX=function(){return this.x.fromRed()},Dn.prototype.getY=function(){return this.y.fromRed()},Dn.prototype.mul=function(e){return e=new rr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Dn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Dn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Dn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Dn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Dn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Un(t,e,r,n){Ya.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new rr(0)):(this.x=new rr(e,16),this.y=new rr(r,16),this.z=new rr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Om(Un,Ya.BasePoint),Hi.prototype.jpoint=function(e,r,n){return new Un(this,e,r,n)},Un.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},Un.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Un.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),g=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(g).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(g)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},Un.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),g=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(g).redISub(g),A=u.redMul(g.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},Un.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},Un.prototype.inspect=function(){return this.isInfinity()?"":""},Un.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Ed=mu(function(t,e){var r=e;r.base=Ya,r.short=XL,r.mont=null,r.edwards=null}),Sd=mu(function(t,e){var r=e,n=Ci.assert;function i(a){a.type==="short"?this.curve=new Ed.short(a):a.type==="edwards"?this.curve=new Ed.edwards(a):this.curve=new Ed.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,u){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(u);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:yo.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:yo.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:yo.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:yo.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:yo.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:yo.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:yo.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:yo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function na(t){if(!(this instanceof na))return new na(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ms.toArray(t.entropy,t.entropyEnc||"hex"),r=ms.toArray(t.nonce,t.nonceEnc||"hex"),n=ms.toArray(t.pers,t.persEnc||"hex");Dm(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var d3=na;na.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},na.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=ms.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var ZL=Ci.assert;function Ad(t,e){if(t instanceof Ad)return t;this._importDER(t,e)||(ZL(t.r&&t.s,"Signature without r or s"),this.r=new rr(t.r,16),this.s=new rr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Pd=Ad;function QL(){this.place=0}function km(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function p3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Ad.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=p3(r),n=p3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];$m(i,r.length),i=i.concat(r),i.push(2),$m(i,n.length);var s=i.concat(n),o=[48];return $m(o,s.length),o=o.concat(s),Ci.encode(o,e)};var ek=function(){throw new Error("unsupported")},g3=Ci.assert;function Wi(t){if(!(this instanceof Wi))return new Wi(t);typeof t=="string"&&(g3(Object.prototype.hasOwnProperty.call(Sd,t),"Unknown curve "+t),t=Sd[t]),t instanceof Sd.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var tk=Wi;Wi.prototype.keyPair=function(e){return new Lm(this,e)},Wi.prototype.keyFromPrivate=function(e,r){return Lm.fromPrivate(this,e,r)},Wi.prototype.keyFromPublic=function(e,r){return Lm.fromPublic(this,e,r)},Wi.prototype.genKeyPair=function(e){e||(e={});for(var r=new d3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||ek(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new rr(2));;){var s=new rr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Wi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Wi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new rr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new d3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new rr(1)),d=0;;d++){var g=i.k?i.k(d):new rr(u.generate(this.n.byteLength()));if(g=this._truncateToN(g,!0),!(g.cmpn(1)<=0||g.cmp(l)>=0)){var y=this.g.mul(g);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=g.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new Pd({r:P,s:N,recoveryParam:D})}}}}}},Wi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new rr(e,16)),n=this.keyFromPublic(n,i),r=new Pd(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),u=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.eqXToP(s)):(d=this.g.mulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.getX().umod(this.n).cmp(s)===0)},Wi.prototype.recoverPubKey=function(t,e,r,n){g3((3&r)===r,"The recovery param is more than two bits"),e=new Pd(e,n);var i=this.n,s=new rr(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),g=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(g,o,y)},Wi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Pd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var rk=mu(function(t,e){var r=e;r.version="6.5.4",r.utils=Ci,r.rand=function(){throw new Error("unsupported")},r.curve=Ed,r.curves=Sd,r.ec=tk,r.eddsa=null}),nk=rk.ec;const ik="signing-key/5.7.0",Bm=new Kr(ik);let Fm=null;function ia(){return Fm||(Fm=new nk("secp256k1")),Fm}class sk{constructor(e){sl(this,"curve","secp256k1"),sl(this,"privateKey",Ii(e)),fN(this.privateKey)!==32&&Bm.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=ia().keyFromPrivate(bn(this.privateKey));sl(this,"publicKey","0x"+r.getPublic(!1,"hex")),sl(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),sl(this,"_isSigningKey",!0)}_addPoint(e){const r=ia().keyFromPublic(bn(this.publicKey)),n=ia().keyFromPublic(bn(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=ia().keyFromPrivate(bn(this.privateKey)),n=bn(e);n.length!==32&&Bm.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Fx({recoveryParam:i.recoveryParam,r:uu("0x"+i.r.toString(16),32),s:uu("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=ia().keyFromPrivate(bn(this.privateKey)),n=ia().keyFromPublic(bn(m3(e)));return uu("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function ok(t,e){const r=Fx(e),n={r:bn(r.r),s:bn(r.s)};return"0x"+ia().recoverPubKey(bn(t),n,r.recoveryParam).encode("hex",!1)}function m3(t,e){const r=bn(t);return r.length===32?new sk(r).publicKey:r.length===33?"0x"+ia().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?Ii(r):Bm.throwArgumentError("invalid public or private key","key","[REDACTED]")}var v3;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(v3||(v3={}));function ak(t){const e=m3(t);return xN(Bx(_m(Bx(e,1)),12))}function ck(t,e){return ak(ok(bn(t),e))}var Um={},Md={};Object.defineProperty(Md,"__esModule",{value:!0});var Yn=or,jm=Mi,uk=20;function fk(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],g=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],P=r[31]<<24|r[30]<<16|r[29]<<8|r[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],k=e[11]<<24|e[10]<<16|e[9]<<8|e[8],$=e[15]<<24|e[14]<<16|e[13]<<8|e[12],q=n,U=i,K=s,J=o,T=a,z=u,ue=l,_e=d,G=g,E=y,m=A,f=P,p=N,v=D,x=k,_=$,S=0;S>>16|p<<16,G=G+p|0,T^=G,T=T>>>20|T<<12,U=U+z|0,v^=U,v=v>>>16|v<<16,E=E+v|0,z^=E,z=z>>>20|z<<12,K=K+ue|0,x^=K,x=x>>>16|x<<16,m=m+x|0,ue^=m,ue=ue>>>20|ue<<12,J=J+_e|0,_^=J,_=_>>>16|_<<16,f=f+_|0,_e^=f,_e=_e>>>20|_e<<12,K=K+ue|0,x^=K,x=x>>>24|x<<8,m=m+x|0,ue^=m,ue=ue>>>25|ue<<7,J=J+_e|0,_^=J,_=_>>>24|_<<8,f=f+_|0,_e^=f,_e=_e>>>25|_e<<7,U=U+z|0,v^=U,v=v>>>24|v<<8,E=E+v|0,z^=E,z=z>>>25|z<<7,q=q+T|0,p^=q,p=p>>>24|p<<8,G=G+p|0,T^=G,T=T>>>25|T<<7,q=q+z|0,_^=q,_=_>>>16|_<<16,m=m+_|0,z^=m,z=z>>>20|z<<12,U=U+ue|0,p^=U,p=p>>>16|p<<16,f=f+p|0,ue^=f,ue=ue>>>20|ue<<12,K=K+_e|0,v^=K,v=v>>>16|v<<16,G=G+v|0,_e^=G,_e=_e>>>20|_e<<12,J=J+T|0,x^=J,x=x>>>16|x<<16,E=E+x|0,T^=E,T=T>>>20|T<<12,K=K+_e|0,v^=K,v=v>>>24|v<<8,G=G+v|0,_e^=G,_e=_e>>>25|_e<<7,J=J+T|0,x^=J,x=x>>>24|x<<8,E=E+x|0,T^=E,T=T>>>25|T<<7,U=U+ue|0,p^=U,p=p>>>24|p<<8,f=f+p|0,ue^=f,ue=ue>>>25|ue<<7,q=q+z|0,_^=q,_=_>>>24|_<<8,m=m+_|0,z^=m,z=z>>>25|z<<7;Yn.writeUint32LE(q+n|0,t,0),Yn.writeUint32LE(U+i|0,t,4),Yn.writeUint32LE(K+s|0,t,8),Yn.writeUint32LE(J+o|0,t,12),Yn.writeUint32LE(T+a|0,t,16),Yn.writeUint32LE(z+u|0,t,20),Yn.writeUint32LE(ue+l|0,t,24),Yn.writeUint32LE(_e+d|0,t,28),Yn.writeUint32LE(G+g|0,t,32),Yn.writeUint32LE(E+y|0,t,36),Yn.writeUint32LE(m+A|0,t,40),Yn.writeUint32LE(f+P|0,t,44),Yn.writeUint32LE(p+N|0,t,48),Yn.writeUint32LE(v+D|0,t,52),Yn.writeUint32LE(x+k|0,t,56),Yn.writeUint32LE(_+$|0,t,60)}function b3(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var y3={},sa={};Object.defineProperty(sa,"__esModule",{value:!0});function dk(t,e,r){return~(t-1)&e|t-1&r}sa.select=dk;function pk(t,e){return(t|0)-(e|0)-1>>>31&1}sa.lessOrEqual=pk;function w3(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}sa.compare=w3;function gk(t,e){return t.length===0||e.length===0?!1:w3(t,e)!==0}sa.equal=gk,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=sa,r=Mi;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var u=a[0]|a[1]<<8;this._r[0]=u&8191;var l=a[2]|a[3]<<8;this._r[1]=(u>>>13|l<<3)&8191;var d=a[4]|a[5]<<8;this._r[2]=(l>>>10|d<<6)&7939;var g=a[6]|a[7]<<8;this._r[3]=(d>>>7|g<<9)&8191;var y=a[8]|a[9]<<8;this._r[4]=(g>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var A=a[10]|a[11]<<8;this._r[6]=(y>>>14|A<<2)&8191;var P=a[12]|a[13]<<8;this._r[7]=(A>>>11|P<<5)&8065;var N=a[14]|a[15]<<8;this._r[8]=(P>>>8|N<<8)&8191,this._r[9]=N>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,u,l){for(var d=this._fin?0:2048,g=this._h[0],y=this._h[1],A=this._h[2],P=this._h[3],N=this._h[4],D=this._h[5],k=this._h[6],$=this._h[7],q=this._h[8],U=this._h[9],K=this._r[0],J=this._r[1],T=this._r[2],z=this._r[3],ue=this._r[4],_e=this._r[5],G=this._r[6],E=this._r[7],m=this._r[8],f=this._r[9];l>=16;){var p=a[u+0]|a[u+1]<<8;g+=p&8191;var v=a[u+2]|a[u+3]<<8;y+=(p>>>13|v<<3)&8191;var x=a[u+4]|a[u+5]<<8;A+=(v>>>10|x<<6)&8191;var _=a[u+6]|a[u+7]<<8;P+=(x>>>7|_<<9)&8191;var S=a[u+8]|a[u+9]<<8;N+=(_>>>4|S<<12)&8191,D+=S>>>1&8191;var b=a[u+10]|a[u+11]<<8;k+=(S>>>14|b<<2)&8191;var M=a[u+12]|a[u+13]<<8;$+=(b>>>11|M<<5)&8191;var I=a[u+14]|a[u+15]<<8;q+=(M>>>8|I<<8)&8191,U+=I>>>5|d;var F=0,ae=F;ae+=g*K,ae+=y*(5*f),ae+=A*(5*m),ae+=P*(5*E),ae+=N*(5*G),F=ae>>>13,ae&=8191,ae+=D*(5*_e),ae+=k*(5*ue),ae+=$*(5*z),ae+=q*(5*T),ae+=U*(5*J),F+=ae>>>13,ae&=8191;var O=F;O+=g*J,O+=y*K,O+=A*(5*f),O+=P*(5*m),O+=N*(5*E),F=O>>>13,O&=8191,O+=D*(5*G),O+=k*(5*_e),O+=$*(5*ue),O+=q*(5*z),O+=U*(5*T),F+=O>>>13,O&=8191;var se=F;se+=g*T,se+=y*J,se+=A*K,se+=P*(5*f),se+=N*(5*m),F=se>>>13,se&=8191,se+=D*(5*E),se+=k*(5*G),se+=$*(5*_e),se+=q*(5*ue),se+=U*(5*z),F+=se>>>13,se&=8191;var ee=F;ee+=g*z,ee+=y*T,ee+=A*J,ee+=P*K,ee+=N*(5*f),F=ee>>>13,ee&=8191,ee+=D*(5*m),ee+=k*(5*E),ee+=$*(5*G),ee+=q*(5*_e),ee+=U*(5*ue),F+=ee>>>13,ee&=8191;var X=F;X+=g*ue,X+=y*z,X+=A*T,X+=P*J,X+=N*K,F=X>>>13,X&=8191,X+=D*(5*f),X+=k*(5*m),X+=$*(5*E),X+=q*(5*G),X+=U*(5*_e),F+=X>>>13,X&=8191;var Q=F;Q+=g*_e,Q+=y*ue,Q+=A*z,Q+=P*T,Q+=N*J,F=Q>>>13,Q&=8191,Q+=D*K,Q+=k*(5*f),Q+=$*(5*m),Q+=q*(5*E),Q+=U*(5*G),F+=Q>>>13,Q&=8191;var R=F;R+=g*G,R+=y*_e,R+=A*ue,R+=P*z,R+=N*T,F=R>>>13,R&=8191,R+=D*J,R+=k*K,R+=$*(5*f),R+=q*(5*m),R+=U*(5*E),F+=R>>>13,R&=8191;var Z=F;Z+=g*E,Z+=y*G,Z+=A*_e,Z+=P*ue,Z+=N*z,F=Z>>>13,Z&=8191,Z+=D*T,Z+=k*J,Z+=$*K,Z+=q*(5*f),Z+=U*(5*m),F+=Z>>>13,Z&=8191;var te=F;te+=g*m,te+=y*E,te+=A*G,te+=P*_e,te+=N*ue,F=te>>>13,te&=8191,te+=D*z,te+=k*T,te+=$*J,te+=q*K,te+=U*(5*f),F+=te>>>13,te&=8191;var le=F;le+=g*f,le+=y*m,le+=A*E,le+=P*G,le+=N*_e,F=le>>>13,le&=8191,le+=D*ue,le+=k*z,le+=$*T,le+=q*J,le+=U*K,F+=le>>>13,le&=8191,F=(F<<2)+F|0,F=F+ae|0,ae=F&8191,F=F>>>13,O+=F,g=ae,y=O,A=se,P=ee,N=X,D=Q,k=R,$=Z,q=te,U=le,u+=16,l-=16}this._h[0]=g,this._h[1]=y,this._h[2]=A,this._h[3]=P,this._h[4]=N,this._h[5]=D,this._h[6]=k,this._h[7]=$,this._h[8]=q,this._h[9]=U},o.prototype.finish=function(a,u){u===void 0&&(u=0);var l=new Uint16Array(10),d,g,y,A;if(this._leftover){for(A=this._leftover,this._buffer[A++]=1;A<16;A++)this._buffer[A]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(d=this._h[1]>>>13,this._h[1]&=8191,A=2;A<10;A++)this._h[A]+=d,d=this._h[A]>>>13,this._h[A]&=8191;for(this._h[0]+=d*5,d=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=d,d=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=d,l[0]=this._h[0]+5,d=l[0]>>>13,l[0]&=8191,A=1;A<10;A++)l[A]=this._h[A]+d,d=l[A]>>>13,l[A]&=8191;for(l[9]-=8192,g=(d^1)-1,A=0;A<10;A++)l[A]&=g;for(g=~g,A=0;A<10;A++)this._h[A]=this._h[A]&g|l[A];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,y=this._h[0]+this._pad[0],this._h[0]=y&65535,A=1;A<8;A++)y=(this._h[A]+this._pad[A]|0)+(y>>>16)|0,this._h[A]=y&65535;return a[u+0]=this._h[0]>>>0,a[u+1]=this._h[0]>>>8,a[u+2]=this._h[1]>>>0,a[u+3]=this._h[1]>>>8,a[u+4]=this._h[2]>>>0,a[u+5]=this._h[2]>>>8,a[u+6]=this._h[3]>>>0,a[u+7]=this._h[3]>>>8,a[u+8]=this._h[4]>>>0,a[u+9]=this._h[4]>>>8,a[u+10]=this._h[5]>>>0,a[u+11]=this._h[5]>>>8,a[u+12]=this._h[6]>>>0,a[u+13]=this._h[6]>>>8,a[u+14]=this._h[7]>>>0,a[u+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var u=0,l=a.length,d;if(this._leftover){d=16-this._leftover,d>l&&(d=l);for(var g=0;g=16&&(d=l-l%16,this._blocks(a,u,d),u+=d,l-=d),l){for(var g=0;g16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var A=new Uint8Array(16);A.set(l,A.length-l.length);var P=new Uint8Array(32);e.stream(this._key,A,P,4);var N=d.length+this.tagLength,D;if(y){if(y.length!==N)throw new Error("ChaCha20Poly1305: incorrect destination length");D=y}else D=new Uint8Array(N);return e.streamXOR(this._key,A,d,D,4),this._authenticate(D.subarray(D.length-this.tagLength,D.length),P,D.subarray(0,D.length-this.tagLength),g),n.wipe(A),D},u.prototype.open=function(l,d,g,y){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(d.length0&&A.update(o.subarray(y.length%16))),A.update(g),g.length%16>0&&A.update(o.subarray(g.length%16));var P=new Uint8Array(8);y&&i.writeUint64LE(y.length,P),A.update(P),i.writeUint64LE(g.length,P),A.update(P);for(var N=A.digest(),D=0;Dthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._temp,this._state,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,g=l/536870912|0,y=l<<3,A=l%64<56?64:128;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._state.set(u.state),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.state),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,u,l,d,g){for(;g>=64;){for(var y=u[0],A=u[1],P=u[2],N=u[3],D=u[4],k=u[5],$=u[6],q=u[7],U=0;U<16;U++){var K=d+U*4;a[U]=e.readUint32BE(l,K)}for(var U=16;U<64;U++){var J=a[U-2],T=(J>>>17|J<<15)^(J>>>19|J<<13)^J>>>10;J=a[U-15];var z=(J>>>7|J<<25)^(J>>>18|J<<14)^J>>>3;a[U]=(T+a[U-7]|0)+(z+a[U-16]|0)}for(var U=0;U<64;U++){var T=(((D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7))+(D&k^~D&$)|0)+(q+(i[U]+a[U]|0)|0)|0,z=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&A^y&P^A&P)|0;q=$,$=k,k=D,D=N+T|0,N=P,P=A,A=y,y=T+z|0}u[0]+=y,u[1]+=A,u[2]+=P,u[3]+=N,u[4]+=D,u[5]+=k,u[6]+=$,u[7]+=q,d+=64,g-=64}return d}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(fl);var zm={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=ea,r=Mi;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(U){const K=new Float64Array(16);if(U)for(let J=0;J>16&1),J[_e-1]&=65535;J[15]=T[15]-32767-(J[14]>>16&1);const ue=J[15]>>16&1;J[14]&=65535,a(T,J,1-ue)}for(let z=0;z<16;z++)U[2*z]=T[z]&255,U[2*z+1]=T[z]>>8}function l(U,K){for(let J=0;J<16;J++)U[J]=K[2*J]+(K[2*J+1]<<8);U[15]&=32767}function d(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]+J[T]}function g(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]-J[T]}function y(U,K,J){let T,z,ue=0,_e=0,G=0,E=0,m=0,f=0,p=0,v=0,x=0,_=0,S=0,b=0,M=0,I=0,F=0,ae=0,O=0,se=0,ee=0,X=0,Q=0,R=0,Z=0,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,Be=J[0],Ie=J[1],Le=J[2],Ve=J[3],ke=J[4],ze=J[5],He=J[6],Ee=J[7],Qe=J[8],ct=J[9],$e=J[10],et=J[11],rt=J[12],Je=J[13],pt=J[14],ht=J[15];T=K[0],ue+=T*Be,_e+=T*Ie,G+=T*Le,E+=T*Ve,m+=T*ke,f+=T*ze,p+=T*He,v+=T*Ee,x+=T*Qe,_+=T*ct,S+=T*$e,b+=T*et,M+=T*rt,I+=T*Je,F+=T*pt,ae+=T*ht,T=K[1],_e+=T*Be,G+=T*Ie,E+=T*Le,m+=T*Ve,f+=T*ke,p+=T*ze,v+=T*He,x+=T*Ee,_+=T*Qe,S+=T*ct,b+=T*$e,M+=T*et,I+=T*rt,F+=T*Je,ae+=T*pt,O+=T*ht,T=K[2],G+=T*Be,E+=T*Ie,m+=T*Le,f+=T*Ve,p+=T*ke,v+=T*ze,x+=T*He,_+=T*Ee,S+=T*Qe,b+=T*ct,M+=T*$e,I+=T*et,F+=T*rt,ae+=T*Je,O+=T*pt,se+=T*ht,T=K[3],E+=T*Be,m+=T*Ie,f+=T*Le,p+=T*Ve,v+=T*ke,x+=T*ze,_+=T*He,S+=T*Ee,b+=T*Qe,M+=T*ct,I+=T*$e,F+=T*et,ae+=T*rt,O+=T*Je,se+=T*pt,ee+=T*ht,T=K[4],m+=T*Be,f+=T*Ie,p+=T*Le,v+=T*Ve,x+=T*ke,_+=T*ze,S+=T*He,b+=T*Ee,M+=T*Qe,I+=T*ct,F+=T*$e,ae+=T*et,O+=T*rt,se+=T*Je,ee+=T*pt,X+=T*ht,T=K[5],f+=T*Be,p+=T*Ie,v+=T*Le,x+=T*Ve,_+=T*ke,S+=T*ze,b+=T*He,M+=T*Ee,I+=T*Qe,F+=T*ct,ae+=T*$e,O+=T*et,se+=T*rt,ee+=T*Je,X+=T*pt,Q+=T*ht,T=K[6],p+=T*Be,v+=T*Ie,x+=T*Le,_+=T*Ve,S+=T*ke,b+=T*ze,M+=T*He,I+=T*Ee,F+=T*Qe,ae+=T*ct,O+=T*$e,se+=T*et,ee+=T*rt,X+=T*Je,Q+=T*pt,R+=T*ht,T=K[7],v+=T*Be,x+=T*Ie,_+=T*Le,S+=T*Ve,b+=T*ke,M+=T*ze,I+=T*He,F+=T*Ee,ae+=T*Qe,O+=T*ct,se+=T*$e,ee+=T*et,X+=T*rt,Q+=T*Je,R+=T*pt,Z+=T*ht,T=K[8],x+=T*Be,_+=T*Ie,S+=T*Le,b+=T*Ve,M+=T*ke,I+=T*ze,F+=T*He,ae+=T*Ee,O+=T*Qe,se+=T*ct,ee+=T*$e,X+=T*et,Q+=T*rt,R+=T*Je,Z+=T*pt,te+=T*ht,T=K[9],_+=T*Be,S+=T*Ie,b+=T*Le,M+=T*Ve,I+=T*ke,F+=T*ze,ae+=T*He,O+=T*Ee,se+=T*Qe,ee+=T*ct,X+=T*$e,Q+=T*et,R+=T*rt,Z+=T*Je,te+=T*pt,le+=T*ht,T=K[10],S+=T*Be,b+=T*Ie,M+=T*Le,I+=T*Ve,F+=T*ke,ae+=T*ze,O+=T*He,se+=T*Ee,ee+=T*Qe,X+=T*ct,Q+=T*$e,R+=T*et,Z+=T*rt,te+=T*Je,le+=T*pt,ie+=T*ht,T=K[11],b+=T*Be,M+=T*Ie,I+=T*Le,F+=T*Ve,ae+=T*ke,O+=T*ze,se+=T*He,ee+=T*Ee,X+=T*Qe,Q+=T*ct,R+=T*$e,Z+=T*et,te+=T*rt,le+=T*Je,ie+=T*pt,fe+=T*ht,T=K[12],M+=T*Be,I+=T*Ie,F+=T*Le,ae+=T*Ve,O+=T*ke,se+=T*ze,ee+=T*He,X+=T*Ee,Q+=T*Qe,R+=T*ct,Z+=T*$e,te+=T*et,le+=T*rt,ie+=T*Je,fe+=T*pt,ve+=T*ht,T=K[13],I+=T*Be,F+=T*Ie,ae+=T*Le,O+=T*Ve,se+=T*ke,ee+=T*ze,X+=T*He,Q+=T*Ee,R+=T*Qe,Z+=T*ct,te+=T*$e,le+=T*et,ie+=T*rt,fe+=T*Je,ve+=T*pt,Me+=T*ht,T=K[14],F+=T*Be,ae+=T*Ie,O+=T*Le,se+=T*Ve,ee+=T*ke,X+=T*ze,Q+=T*He,R+=T*Ee,Z+=T*Qe,te+=T*ct,le+=T*$e,ie+=T*et,fe+=T*rt,ve+=T*Je,Me+=T*pt,Ne+=T*ht,T=K[15],ae+=T*Be,O+=T*Ie,se+=T*Le,ee+=T*Ve,X+=T*ke,Q+=T*ze,R+=T*He,Z+=T*Ee,te+=T*Qe,le+=T*ct,ie+=T*$e,fe+=T*et,ve+=T*rt,Me+=T*Je,Ne+=T*pt,Te+=T*ht,ue+=38*O,_e+=38*se,G+=38*ee,E+=38*X,m+=38*Q,f+=38*R,p+=38*Z,v+=38*te,x+=38*le,_+=38*ie,S+=38*fe,b+=38*ve,M+=38*Me,I+=38*Ne,F+=38*Te,z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=p+z+65535,z=Math.floor(T/65536),p=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=p+z+65535,z=Math.floor(T/65536),p=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),U[0]=ue,U[1]=_e,U[2]=G,U[3]=E,U[4]=m,U[5]=f,U[6]=p,U[7]=v,U[8]=x,U[9]=_,U[10]=S,U[11]=b,U[12]=M,U[13]=I,U[14]=F,U[15]=ae}function A(U,K){y(U,K,K)}function P(U,K){const J=n();for(let T=0;T<16;T++)J[T]=K[T];for(let T=253;T>=0;T--)A(J,J),T!==2&&T!==4&&y(J,J,K);for(let T=0;T<16;T++)U[T]=J[T]}function N(U,K){const J=new Uint8Array(32),T=new Float64Array(80),z=n(),ue=n(),_e=n(),G=n(),E=n(),m=n();for(let x=0;x<31;x++)J[x]=U[x];J[31]=U[31]&127|64,J[0]&=248,l(T,K);for(let x=0;x<16;x++)ue[x]=T[x];z[0]=G[0]=1;for(let x=254;x>=0;--x){const _=J[x>>>3]>>>(x&7)&1;a(z,ue,_),a(_e,G,_),d(E,z,_e),g(z,z,_e),d(_e,ue,G),g(ue,ue,G),A(G,E),A(m,z),y(z,_e,z),y(_e,ue,E),d(E,z,_e),g(z,z,_e),A(ue,z),g(_e,G,m),y(z,_e,s),d(z,z,G),y(_e,_e,z),y(z,G,m),y(G,ue,T),A(ue,E),a(z,ue,_),a(_e,G,_)}for(let x=0;x<16;x++)T[x+16]=z[x],T[x+32]=_e[x],T[x+48]=ue[x],T[x+64]=G[x];const f=T.subarray(32),p=T.subarray(16);P(f,f),y(p,p,f);const v=new Uint8Array(32);return u(v,p),v}t.scalarMult=N;function D(U){return N(U,i)}t.scalarMultBase=D;function k(U){if(U.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const K=new Uint8Array(U);return{publicKey:D(K),secretKey:K}}t.generateKeyPairFromSeed=k;function $(U){const K=(0,e.randomBytes)(32,U),J=k(K);return(0,r.wipe)(K),J}t.generateKeyPair=$;function q(U,K,J=!1){if(U.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(K.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const T=N(U,K);if(J){let z=0;for(let ue=0;ue",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}};var Ti={},Hm={exports:{}};Hm.exports,function(t){(function(e,r){function n(G,E){if(!G)throw new Error(E||"Assertion failed")}function i(G,E){G.super_=E;var m=function(){};m.prototype=E.prototype,G.prototype=new m,G.prototype.constructor=G}function s(G,E,m){if(s.isBN(G))return G;this.negative=0,this.words=null,this.length=0,this.red=null,G!==null&&((E==="le"||E==="be")&&(m=E,E=10),this._init(G||0,E||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=el.Buffer}catch{}s.isBN=function(E){return E instanceof s?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===s.wordSize&&Array.isArray(E.words)},s.max=function(E,m){return E.cmp(m)>0?E:m},s.min=function(E,m){return E.cmp(m)<0?E:m},s.prototype._init=function(E,m,f){if(typeof E=="number")return this._initNumber(E,m,f);if(typeof E=="object")return this._initArray(E,m,f);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),E=E.toString().replace(/\s+/g,"");var p=0;E[0]==="-"&&(p++,this.negative=1),p=0;p-=3)x=E[p]|E[p-1]<<8|E[p-2]<<16,this.words[v]|=x<<_&67108863,this.words[v+1]=x>>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);else if(f==="le")for(p=0,v=0;p>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);return this.strip()};function a(G,E){var m=G.charCodeAt(E);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function u(G,E,m){var f=a(G,m);return m-1>=E&&(f|=a(G,m-1)<<4),f}s.prototype._parseHex=function(E,m,f){this.length=Math.ceil((E.length-m)/6),this.words=new Array(this.length);for(var p=0;p=m;p-=2)_=u(E,m,p)<=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8;else{var S=E.length-m;for(p=S%2===0?m+1:m;p=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8}this.strip()};function l(G,E,m,f){for(var p=0,v=Math.min(G.length,m),x=E;x=49?p+=_-49+10:_>=17?p+=_-17+10:p+=_}return p}s.prototype._parseBase=function(E,m,f){this.words=[0],this.length=1;for(var p=0,v=1;v<=67108863;v*=m)p++;p--,v=v/m|0;for(var x=E.length-f,_=x%p,S=Math.min(x,x-_)+f,b=0,M=f;M1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var d=["","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"],g=[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],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(E,m){E=E||10,m=m|0||1;var f;if(E===16||E==="hex"){f="";for(var p=0,v=0,x=0;x>>24-p&16777215,p+=2,p>=26&&(p-=26,x--),v!==0||x!==this.length-1?f=d[6-S.length]+S+f:f=S+f}for(v!==0&&(f=v.toString(16)+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(E===(E|0)&&E>=2&&E<=36){var b=g[E],M=y[E];f="";var I=this.clone();for(I.negative=0;!I.isZero();){var F=I.modn(M).toString(E);I=I.idivn(M),I.isZero()?f=F+f:f=d[b-F.length]+F+f}for(this.isZero()&&(f="0"+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(E,m){return n(typeof o<"u"),this.toArrayLike(o,E,m)},s.prototype.toArray=function(E,m){return this.toArrayLike(Array,E,m)},s.prototype.toArrayLike=function(E,m,f){var p=this.byteLength(),v=f||Math.max(1,p);n(p<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var x=m==="le",_=new E(v),S,b,M=this.clone();if(x){for(b=0;!M.isZero();b++)S=M.andln(255),M.iushrn(8),_[b]=S;for(;b=4096&&(f+=13,m>>>=13),m>=64&&(f+=7,m>>>=7),m>=8&&(f+=4,m>>>=4),m>=2&&(f+=2,m>>>=2),f+m},s.prototype._zeroBits=function(E){if(E===0)return 26;var m=E,f=0;return m&8191||(f+=13,m>>>=13),m&127||(f+=7,m>>>=7),m&15||(f+=4,m>>>=4),m&3||(f+=2,m>>>=2),m&1||f++,f},s.prototype.bitLength=function(){var E=this.words[this.length-1],m=this._countBits(E);return(this.length-1)*26+m};function A(G){for(var E=new Array(G.bitLength()),m=0;m>>p}return E}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,m=0;mE.length?this.clone().ior(E):E.clone().ior(this)},s.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},s.prototype.iuand=function(E){var m;this.length>E.length?m=E:m=this;for(var f=0;fE.length?this.clone().iand(E):E.clone().iand(this)},s.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},s.prototype.iuxor=function(E){var m,f;this.length>E.length?(m=this,f=E):(m=E,f=this);for(var p=0;pE.length?this.clone().ixor(E):E.clone().ixor(this)},s.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},s.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var m=Math.ceil(E/26)|0,f=E%26;this._expand(m),f>0&&m--;for(var p=0;p0&&(this.words[p]=~this.words[p]&67108863>>26-f),this.strip()},s.prototype.notn=function(E){return this.clone().inotn(E)},s.prototype.setn=function(E,m){n(typeof E=="number"&&E>=0);var f=E/26|0,p=E%26;return this._expand(f+1),m?this.words[f]=this.words[f]|1<E.length?(f=this,p=E):(f=E,p=this);for(var v=0,x=0;x>>26;for(;v!==0&&x>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;xE.length?this.clone().iadd(E):E.clone().iadd(this)},s.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var m=this.iadd(E);return E.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var f=this.cmp(E);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,v;f>0?(p=this,v=E):(p=E,v=this);for(var x=0,_=0;_>26,this.words[_]=m&67108863;for(;x!==0&&_>26,this.words[_]=m&67108863;if(x===0&&_>>26,I=S&67108863,F=Math.min(b,E.length-1),ae=Math.max(0,b-G.length+1);ae<=F;ae++){var O=b-ae|0;p=G.words[O]|0,v=E.words[ae]|0,x=p*v+I,M+=x/67108864|0,I=x&67108863}m.words[b]=I|0,S=M|0}return S!==0?m.words[b]=S|0:m.length--,m.strip()}var N=function(E,m,f){var p=E.words,v=m.words,x=f.words,_=0,S,b,M,I=p[0]|0,F=I&8191,ae=I>>>13,O=p[1]|0,se=O&8191,ee=O>>>13,X=p[2]|0,Q=X&8191,R=X>>>13,Z=p[3]|0,te=Z&8191,le=Z>>>13,ie=p[4]|0,fe=ie&8191,ve=ie>>>13,Me=p[5]|0,Ne=Me&8191,Te=Me>>>13,Be=p[6]|0,Ie=Be&8191,Le=Be>>>13,Ve=p[7]|0,ke=Ve&8191,ze=Ve>>>13,He=p[8]|0,Ee=He&8191,Qe=He>>>13,ct=p[9]|0,$e=ct&8191,et=ct>>>13,rt=v[0]|0,Je=rt&8191,pt=rt>>>13,ht=v[1]|0,ft=ht&8191,Ht=ht>>>13,Jt=v[2]|0,St=Jt&8191,er=Jt>>>13,Xt=v[3]|0,Ot=Xt&8191,$t=Xt>>>13,Tt=v[4]|0,vt=Tt&8191,Dt=Tt>>>13,Lt=v[5]|0,bt=Lt&8191,Bt=Lt>>>13,Ut=v[6]|0,nt=Ut&8191,Ft=Ut>>>13,B=v[7]|0,H=B&8191,V=B>>>13,C=v[8]|0,Y=C&8191,j=C>>>13,oe=v[9]|0,pe=oe&8191,xe=oe>>>13;f.negative=E.negative^m.negative,f.length=19,S=Math.imul(F,Je),b=Math.imul(F,pt),b=b+Math.imul(ae,Je)|0,M=Math.imul(ae,pt);var Re=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Re>>>26)|0,Re&=67108863,S=Math.imul(se,Je),b=Math.imul(se,pt),b=b+Math.imul(ee,Je)|0,M=Math.imul(ee,pt),S=S+Math.imul(F,ft)|0,b=b+Math.imul(F,Ht)|0,b=b+Math.imul(ae,ft)|0,M=M+Math.imul(ae,Ht)|0;var De=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(De>>>26)|0,De&=67108863,S=Math.imul(Q,Je),b=Math.imul(Q,pt),b=b+Math.imul(R,Je)|0,M=Math.imul(R,pt),S=S+Math.imul(se,ft)|0,b=b+Math.imul(se,Ht)|0,b=b+Math.imul(ee,ft)|0,M=M+Math.imul(ee,Ht)|0,S=S+Math.imul(F,St)|0,b=b+Math.imul(F,er)|0,b=b+Math.imul(ae,St)|0,M=M+Math.imul(ae,er)|0;var it=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(it>>>26)|0,it&=67108863,S=Math.imul(te,Je),b=Math.imul(te,pt),b=b+Math.imul(le,Je)|0,M=Math.imul(le,pt),S=S+Math.imul(Q,ft)|0,b=b+Math.imul(Q,Ht)|0,b=b+Math.imul(R,ft)|0,M=M+Math.imul(R,Ht)|0,S=S+Math.imul(se,St)|0,b=b+Math.imul(se,er)|0,b=b+Math.imul(ee,St)|0,M=M+Math.imul(ee,er)|0,S=S+Math.imul(F,Ot)|0,b=b+Math.imul(F,$t)|0,b=b+Math.imul(ae,Ot)|0,M=M+Math.imul(ae,$t)|0;var je=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(je>>>26)|0,je&=67108863,S=Math.imul(fe,Je),b=Math.imul(fe,pt),b=b+Math.imul(ve,Je)|0,M=Math.imul(ve,pt),S=S+Math.imul(te,ft)|0,b=b+Math.imul(te,Ht)|0,b=b+Math.imul(le,ft)|0,M=M+Math.imul(le,Ht)|0,S=S+Math.imul(Q,St)|0,b=b+Math.imul(Q,er)|0,b=b+Math.imul(R,St)|0,M=M+Math.imul(R,er)|0,S=S+Math.imul(se,Ot)|0,b=b+Math.imul(se,$t)|0,b=b+Math.imul(ee,Ot)|0,M=M+Math.imul(ee,$t)|0,S=S+Math.imul(F,vt)|0,b=b+Math.imul(F,Dt)|0,b=b+Math.imul(ae,vt)|0,M=M+Math.imul(ae,Dt)|0;var gt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(gt>>>26)|0,gt&=67108863,S=Math.imul(Ne,Je),b=Math.imul(Ne,pt),b=b+Math.imul(Te,Je)|0,M=Math.imul(Te,pt),S=S+Math.imul(fe,ft)|0,b=b+Math.imul(fe,Ht)|0,b=b+Math.imul(ve,ft)|0,M=M+Math.imul(ve,Ht)|0,S=S+Math.imul(te,St)|0,b=b+Math.imul(te,er)|0,b=b+Math.imul(le,St)|0,M=M+Math.imul(le,er)|0,S=S+Math.imul(Q,Ot)|0,b=b+Math.imul(Q,$t)|0,b=b+Math.imul(R,Ot)|0,M=M+Math.imul(R,$t)|0,S=S+Math.imul(se,vt)|0,b=b+Math.imul(se,Dt)|0,b=b+Math.imul(ee,vt)|0,M=M+Math.imul(ee,Dt)|0,S=S+Math.imul(F,bt)|0,b=b+Math.imul(F,Bt)|0,b=b+Math.imul(ae,bt)|0,M=M+Math.imul(ae,Bt)|0;var st=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(st>>>26)|0,st&=67108863,S=Math.imul(Ie,Je),b=Math.imul(Ie,pt),b=b+Math.imul(Le,Je)|0,M=Math.imul(Le,pt),S=S+Math.imul(Ne,ft)|0,b=b+Math.imul(Ne,Ht)|0,b=b+Math.imul(Te,ft)|0,M=M+Math.imul(Te,Ht)|0,S=S+Math.imul(fe,St)|0,b=b+Math.imul(fe,er)|0,b=b+Math.imul(ve,St)|0,M=M+Math.imul(ve,er)|0,S=S+Math.imul(te,Ot)|0,b=b+Math.imul(te,$t)|0,b=b+Math.imul(le,Ot)|0,M=M+Math.imul(le,$t)|0,S=S+Math.imul(Q,vt)|0,b=b+Math.imul(Q,Dt)|0,b=b+Math.imul(R,vt)|0,M=M+Math.imul(R,Dt)|0,S=S+Math.imul(se,bt)|0,b=b+Math.imul(se,Bt)|0,b=b+Math.imul(ee,bt)|0,M=M+Math.imul(ee,Bt)|0,S=S+Math.imul(F,nt)|0,b=b+Math.imul(F,Ft)|0,b=b+Math.imul(ae,nt)|0,M=M+Math.imul(ae,Ft)|0;var tt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(tt>>>26)|0,tt&=67108863,S=Math.imul(ke,Je),b=Math.imul(ke,pt),b=b+Math.imul(ze,Je)|0,M=Math.imul(ze,pt),S=S+Math.imul(Ie,ft)|0,b=b+Math.imul(Ie,Ht)|0,b=b+Math.imul(Le,ft)|0,M=M+Math.imul(Le,Ht)|0,S=S+Math.imul(Ne,St)|0,b=b+Math.imul(Ne,er)|0,b=b+Math.imul(Te,St)|0,M=M+Math.imul(Te,er)|0,S=S+Math.imul(fe,Ot)|0,b=b+Math.imul(fe,$t)|0,b=b+Math.imul(ve,Ot)|0,M=M+Math.imul(ve,$t)|0,S=S+Math.imul(te,vt)|0,b=b+Math.imul(te,Dt)|0,b=b+Math.imul(le,vt)|0,M=M+Math.imul(le,Dt)|0,S=S+Math.imul(Q,bt)|0,b=b+Math.imul(Q,Bt)|0,b=b+Math.imul(R,bt)|0,M=M+Math.imul(R,Bt)|0,S=S+Math.imul(se,nt)|0,b=b+Math.imul(se,Ft)|0,b=b+Math.imul(ee,nt)|0,M=M+Math.imul(ee,Ft)|0,S=S+Math.imul(F,H)|0,b=b+Math.imul(F,V)|0,b=b+Math.imul(ae,H)|0,M=M+Math.imul(ae,V)|0;var At=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(At>>>26)|0,At&=67108863,S=Math.imul(Ee,Je),b=Math.imul(Ee,pt),b=b+Math.imul(Qe,Je)|0,M=Math.imul(Qe,pt),S=S+Math.imul(ke,ft)|0,b=b+Math.imul(ke,Ht)|0,b=b+Math.imul(ze,ft)|0,M=M+Math.imul(ze,Ht)|0,S=S+Math.imul(Ie,St)|0,b=b+Math.imul(Ie,er)|0,b=b+Math.imul(Le,St)|0,M=M+Math.imul(Le,er)|0,S=S+Math.imul(Ne,Ot)|0,b=b+Math.imul(Ne,$t)|0,b=b+Math.imul(Te,Ot)|0,M=M+Math.imul(Te,$t)|0,S=S+Math.imul(fe,vt)|0,b=b+Math.imul(fe,Dt)|0,b=b+Math.imul(ve,vt)|0,M=M+Math.imul(ve,Dt)|0,S=S+Math.imul(te,bt)|0,b=b+Math.imul(te,Bt)|0,b=b+Math.imul(le,bt)|0,M=M+Math.imul(le,Bt)|0,S=S+Math.imul(Q,nt)|0,b=b+Math.imul(Q,Ft)|0,b=b+Math.imul(R,nt)|0,M=M+Math.imul(R,Ft)|0,S=S+Math.imul(se,H)|0,b=b+Math.imul(se,V)|0,b=b+Math.imul(ee,H)|0,M=M+Math.imul(ee,V)|0,S=S+Math.imul(F,Y)|0,b=b+Math.imul(F,j)|0,b=b+Math.imul(ae,Y)|0,M=M+Math.imul(ae,j)|0;var Rt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,S=Math.imul($e,Je),b=Math.imul($e,pt),b=b+Math.imul(et,Je)|0,M=Math.imul(et,pt),S=S+Math.imul(Ee,ft)|0,b=b+Math.imul(Ee,Ht)|0,b=b+Math.imul(Qe,ft)|0,M=M+Math.imul(Qe,Ht)|0,S=S+Math.imul(ke,St)|0,b=b+Math.imul(ke,er)|0,b=b+Math.imul(ze,St)|0,M=M+Math.imul(ze,er)|0,S=S+Math.imul(Ie,Ot)|0,b=b+Math.imul(Ie,$t)|0,b=b+Math.imul(Le,Ot)|0,M=M+Math.imul(Le,$t)|0,S=S+Math.imul(Ne,vt)|0,b=b+Math.imul(Ne,Dt)|0,b=b+Math.imul(Te,vt)|0,M=M+Math.imul(Te,Dt)|0,S=S+Math.imul(fe,bt)|0,b=b+Math.imul(fe,Bt)|0,b=b+Math.imul(ve,bt)|0,M=M+Math.imul(ve,Bt)|0,S=S+Math.imul(te,nt)|0,b=b+Math.imul(te,Ft)|0,b=b+Math.imul(le,nt)|0,M=M+Math.imul(le,Ft)|0,S=S+Math.imul(Q,H)|0,b=b+Math.imul(Q,V)|0,b=b+Math.imul(R,H)|0,M=M+Math.imul(R,V)|0,S=S+Math.imul(se,Y)|0,b=b+Math.imul(se,j)|0,b=b+Math.imul(ee,Y)|0,M=M+Math.imul(ee,j)|0,S=S+Math.imul(F,pe)|0,b=b+Math.imul(F,xe)|0,b=b+Math.imul(ae,pe)|0,M=M+Math.imul(ae,xe)|0;var Mt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,S=Math.imul($e,ft),b=Math.imul($e,Ht),b=b+Math.imul(et,ft)|0,M=Math.imul(et,Ht),S=S+Math.imul(Ee,St)|0,b=b+Math.imul(Ee,er)|0,b=b+Math.imul(Qe,St)|0,M=M+Math.imul(Qe,er)|0,S=S+Math.imul(ke,Ot)|0,b=b+Math.imul(ke,$t)|0,b=b+Math.imul(ze,Ot)|0,M=M+Math.imul(ze,$t)|0,S=S+Math.imul(Ie,vt)|0,b=b+Math.imul(Ie,Dt)|0,b=b+Math.imul(Le,vt)|0,M=M+Math.imul(Le,Dt)|0,S=S+Math.imul(Ne,bt)|0,b=b+Math.imul(Ne,Bt)|0,b=b+Math.imul(Te,bt)|0,M=M+Math.imul(Te,Bt)|0,S=S+Math.imul(fe,nt)|0,b=b+Math.imul(fe,Ft)|0,b=b+Math.imul(ve,nt)|0,M=M+Math.imul(ve,Ft)|0,S=S+Math.imul(te,H)|0,b=b+Math.imul(te,V)|0,b=b+Math.imul(le,H)|0,M=M+Math.imul(le,V)|0,S=S+Math.imul(Q,Y)|0,b=b+Math.imul(Q,j)|0,b=b+Math.imul(R,Y)|0,M=M+Math.imul(R,j)|0,S=S+Math.imul(se,pe)|0,b=b+Math.imul(se,xe)|0,b=b+Math.imul(ee,pe)|0,M=M+Math.imul(ee,xe)|0;var Et=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Et>>>26)|0,Et&=67108863,S=Math.imul($e,St),b=Math.imul($e,er),b=b+Math.imul(et,St)|0,M=Math.imul(et,er),S=S+Math.imul(Ee,Ot)|0,b=b+Math.imul(Ee,$t)|0,b=b+Math.imul(Qe,Ot)|0,M=M+Math.imul(Qe,$t)|0,S=S+Math.imul(ke,vt)|0,b=b+Math.imul(ke,Dt)|0,b=b+Math.imul(ze,vt)|0,M=M+Math.imul(ze,Dt)|0,S=S+Math.imul(Ie,bt)|0,b=b+Math.imul(Ie,Bt)|0,b=b+Math.imul(Le,bt)|0,M=M+Math.imul(Le,Bt)|0,S=S+Math.imul(Ne,nt)|0,b=b+Math.imul(Ne,Ft)|0,b=b+Math.imul(Te,nt)|0,M=M+Math.imul(Te,Ft)|0,S=S+Math.imul(fe,H)|0,b=b+Math.imul(fe,V)|0,b=b+Math.imul(ve,H)|0,M=M+Math.imul(ve,V)|0,S=S+Math.imul(te,Y)|0,b=b+Math.imul(te,j)|0,b=b+Math.imul(le,Y)|0,M=M+Math.imul(le,j)|0,S=S+Math.imul(Q,pe)|0,b=b+Math.imul(Q,xe)|0,b=b+Math.imul(R,pe)|0,M=M+Math.imul(R,xe)|0;var dt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(dt>>>26)|0,dt&=67108863,S=Math.imul($e,Ot),b=Math.imul($e,$t),b=b+Math.imul(et,Ot)|0,M=Math.imul(et,$t),S=S+Math.imul(Ee,vt)|0,b=b+Math.imul(Ee,Dt)|0,b=b+Math.imul(Qe,vt)|0,M=M+Math.imul(Qe,Dt)|0,S=S+Math.imul(ke,bt)|0,b=b+Math.imul(ke,Bt)|0,b=b+Math.imul(ze,bt)|0,M=M+Math.imul(ze,Bt)|0,S=S+Math.imul(Ie,nt)|0,b=b+Math.imul(Ie,Ft)|0,b=b+Math.imul(Le,nt)|0,M=M+Math.imul(Le,Ft)|0,S=S+Math.imul(Ne,H)|0,b=b+Math.imul(Ne,V)|0,b=b+Math.imul(Te,H)|0,M=M+Math.imul(Te,V)|0,S=S+Math.imul(fe,Y)|0,b=b+Math.imul(fe,j)|0,b=b+Math.imul(ve,Y)|0,M=M+Math.imul(ve,j)|0,S=S+Math.imul(te,pe)|0,b=b+Math.imul(te,xe)|0,b=b+Math.imul(le,pe)|0,M=M+Math.imul(le,xe)|0;var _t=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(_t>>>26)|0,_t&=67108863,S=Math.imul($e,vt),b=Math.imul($e,Dt),b=b+Math.imul(et,vt)|0,M=Math.imul(et,Dt),S=S+Math.imul(Ee,bt)|0,b=b+Math.imul(Ee,Bt)|0,b=b+Math.imul(Qe,bt)|0,M=M+Math.imul(Qe,Bt)|0,S=S+Math.imul(ke,nt)|0,b=b+Math.imul(ke,Ft)|0,b=b+Math.imul(ze,nt)|0,M=M+Math.imul(ze,Ft)|0,S=S+Math.imul(Ie,H)|0,b=b+Math.imul(Ie,V)|0,b=b+Math.imul(Le,H)|0,M=M+Math.imul(Le,V)|0,S=S+Math.imul(Ne,Y)|0,b=b+Math.imul(Ne,j)|0,b=b+Math.imul(Te,Y)|0,M=M+Math.imul(Te,j)|0,S=S+Math.imul(fe,pe)|0,b=b+Math.imul(fe,xe)|0,b=b+Math.imul(ve,pe)|0,M=M+Math.imul(ve,xe)|0;var ot=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(ot>>>26)|0,ot&=67108863,S=Math.imul($e,bt),b=Math.imul($e,Bt),b=b+Math.imul(et,bt)|0,M=Math.imul(et,Bt),S=S+Math.imul(Ee,nt)|0,b=b+Math.imul(Ee,Ft)|0,b=b+Math.imul(Qe,nt)|0,M=M+Math.imul(Qe,Ft)|0,S=S+Math.imul(ke,H)|0,b=b+Math.imul(ke,V)|0,b=b+Math.imul(ze,H)|0,M=M+Math.imul(ze,V)|0,S=S+Math.imul(Ie,Y)|0,b=b+Math.imul(Ie,j)|0,b=b+Math.imul(Le,Y)|0,M=M+Math.imul(Le,j)|0,S=S+Math.imul(Ne,pe)|0,b=b+Math.imul(Ne,xe)|0,b=b+Math.imul(Te,pe)|0,M=M+Math.imul(Te,xe)|0;var wt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(wt>>>26)|0,wt&=67108863,S=Math.imul($e,nt),b=Math.imul($e,Ft),b=b+Math.imul(et,nt)|0,M=Math.imul(et,Ft),S=S+Math.imul(Ee,H)|0,b=b+Math.imul(Ee,V)|0,b=b+Math.imul(Qe,H)|0,M=M+Math.imul(Qe,V)|0,S=S+Math.imul(ke,Y)|0,b=b+Math.imul(ke,j)|0,b=b+Math.imul(ze,Y)|0,M=M+Math.imul(ze,j)|0,S=S+Math.imul(Ie,pe)|0,b=b+Math.imul(Ie,xe)|0,b=b+Math.imul(Le,pe)|0,M=M+Math.imul(Le,xe)|0;var lt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul($e,H),b=Math.imul($e,V),b=b+Math.imul(et,H)|0,M=Math.imul(et,V),S=S+Math.imul(Ee,Y)|0,b=b+Math.imul(Ee,j)|0,b=b+Math.imul(Qe,Y)|0,M=M+Math.imul(Qe,j)|0,S=S+Math.imul(ke,pe)|0,b=b+Math.imul(ke,xe)|0,b=b+Math.imul(ze,pe)|0,M=M+Math.imul(ze,xe)|0;var at=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(at>>>26)|0,at&=67108863,S=Math.imul($e,Y),b=Math.imul($e,j),b=b+Math.imul(et,Y)|0,M=Math.imul(et,j),S=S+Math.imul(Ee,pe)|0,b=b+Math.imul(Ee,xe)|0,b=b+Math.imul(Qe,pe)|0,M=M+Math.imul(Qe,xe)|0;var Se=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Se>>>26)|0,Se&=67108863,S=Math.imul($e,pe),b=Math.imul($e,xe),b=b+Math.imul(et,pe)|0,M=Math.imul(et,xe);var Ae=(_+S|0)+((b&8191)<<13)|0;return _=(M+(b>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,x[0]=Re,x[1]=De,x[2]=it,x[3]=je,x[4]=gt,x[5]=st,x[6]=tt,x[7]=At,x[8]=Rt,x[9]=Mt,x[10]=Et,x[11]=dt,x[12]=_t,x[13]=ot,x[14]=wt,x[15]=lt,x[16]=at,x[17]=Se,x[18]=Ae,_!==0&&(x[19]=_,f.length++),f};Math.imul||(N=P);function D(G,E,m){m.negative=E.negative^G.negative,m.length=G.length+E.length;for(var f=0,p=0,v=0;v>>26)|0,p+=x>>>26,x&=67108863}m.words[v]=_,f=x,x=p}return f!==0?m.words[v]=f:m.length--,m.strip()}function k(G,E,m){var f=new $;return f.mulp(G,E,m)}s.prototype.mulTo=function(E,m){var f,p=this.length+E.length;return this.length===10&&E.length===10?f=N(this,E,m):p<63?f=P(this,E,m):p<1024?f=D(this,E,m):f=k(this,E,m),f};function $(G,E){this.x=G,this.y=E}$.prototype.makeRBT=function(E){for(var m=new Array(E),f=s.prototype._countBits(E)-1,p=0;p>=1;return p},$.prototype.permute=function(E,m,f,p,v,x){for(var _=0;_>>1)v++;return 1<>>13,f[2*x+1]=v&8191,v=v>>>13;for(x=2*m;x>=26,m+=p/67108864|0,m+=v>>>26,this.words[f]=v&67108863}return m!==0&&(this.words[f]=m,this.length++),this},s.prototype.muln=function(E){return this.clone().imuln(E)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(E){var m=A(E);if(m.length===0)return new s(1);for(var f=this,p=0;p=0);var m=E%26,f=(E-m)/26,p=67108863>>>26-m<<26-m,v;if(m!==0){var x=0;for(v=0;v>>26-m}x&&(this.words[v]=x,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var p;m?p=(m-m%26)/26:p=0;var v=E%26,x=Math.min((E-v)/26,this.length),_=67108863^67108863>>>v<x)for(this.length-=x,b=0;b=0&&(M!==0||b>=p);b--){var I=this.words[b]|0;this.words[b]=M<<26-v|I>>>v,M=I&_}return S&&M!==0&&(S.words[S.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(E,m,f){return n(this.negative===0),this.iushrn(E,m,f)},s.prototype.shln=function(E){return this.clone().ishln(E)},s.prototype.ushln=function(E){return this.clone().iushln(E)},s.prototype.shrn=function(E){return this.clone().ishrn(E)},s.prototype.ushrn=function(E){return this.clone().iushrn(E)},s.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var m=E%26,f=(E-m)/26,p=1<=0);var m=E%26,f=(E-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(m!==0&&f++,this.length=Math.min(f,this.length),m!==0){var p=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(S/67108864|0),this.words[v+f]=x&67108863}for(;v>26,this.words[v+f]=x&67108863;if(_===0)return this.strip();for(n(_===-1),_=0,v=0;v>26,this.words[v]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(E,m){var f=this.length-E.length,p=this.clone(),v=E,x=v.words[v.length-1]|0,_=this._countBits(x);f=26-_,f!==0&&(v=v.ushln(f),p.iushln(f),x=v.words[v.length-1]|0);var S=p.length-v.length,b;if(m!=="mod"){b=new s(null),b.length=S+1,b.words=new Array(b.length);for(var M=0;M=0;F--){var ae=(p.words[v.length+F]|0)*67108864+(p.words[v.length+F-1]|0);for(ae=Math.min(ae/x|0,67108863),p._ishlnsubmul(v,ae,F);p.negative!==0;)ae--,p.negative=0,p._ishlnsubmul(v,1,F),p.isZero()||(p.negative^=1);b&&(b.words[F]=ae)}return b&&b.strip(),p.strip(),m!=="div"&&f!==0&&p.iushrn(f),{div:b||null,mod:p}},s.prototype.divmod=function(E,m,f){if(n(!E.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var p,v,x;return this.negative!==0&&E.negative===0?(x=this.neg().divmod(E,m),m!=="mod"&&(p=x.div.neg()),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.iadd(E)),{div:p,mod:v}):this.negative===0&&E.negative!==0?(x=this.divmod(E.neg(),m),m!=="mod"&&(p=x.div.neg()),{div:p,mod:x.mod}):this.negative&E.negative?(x=this.neg().divmod(E.neg(),m),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.isub(E)),{div:x.div,mod:v}):E.length>this.length||this.cmp(E)<0?{div:new s(0),mod:this}:E.length===1?m==="div"?{div:this.divn(E.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new s(this.modn(E.words[0]))}:this._wordDiv(E,m)},s.prototype.div=function(E){return this.divmod(E,"div",!1).div},s.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},s.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},s.prototype.divRound=function(E){var m=this.divmod(E);if(m.mod.isZero())return m.div;var f=m.div.negative!==0?m.mod.isub(E):m.mod,p=E.ushrn(1),v=E.andln(1),x=f.cmp(p);return x<0||v===1&&x===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(E){n(E<=67108863);for(var m=(1<<26)%E,f=0,p=this.length-1;p>=0;p--)f=(m*f+(this.words[p]|0))%E;return f},s.prototype.idivn=function(E){n(E<=67108863);for(var m=0,f=this.length-1;f>=0;f--){var p=(this.words[f]|0)+m*67108864;this.words[f]=p/E|0,m=p%E}return this.strip()},s.prototype.divn=function(E){return this.clone().idivn(E)},s.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var p=new s(1),v=new s(0),x=new s(0),_=new s(1),S=0;m.isEven()&&f.isEven();)m.iushrn(1),f.iushrn(1),++S;for(var b=f.clone(),M=m.clone();!m.isZero();){for(var I=0,F=1;!(m.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(m.iushrn(I);I-- >0;)(p.isOdd()||v.isOdd())&&(p.iadd(b),v.isub(M)),p.iushrn(1),v.iushrn(1);for(var ae=0,O=1;!(f.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(f.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(b),_.isub(M)),x.iushrn(1),_.iushrn(1);m.cmp(f)>=0?(m.isub(f),p.isub(x),v.isub(_)):(f.isub(m),x.isub(p),_.isub(v))}return{a:x,b:_,gcd:f.iushln(S)}},s.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var p=new s(1),v=new s(0),x=f.clone();m.cmpn(1)>0&&f.cmpn(1)>0;){for(var _=0,S=1;!(m.words[0]&S)&&_<26;++_,S<<=1);if(_>0)for(m.iushrn(_);_-- >0;)p.isOdd()&&p.iadd(x),p.iushrn(1);for(var b=0,M=1;!(f.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(f.iushrn(b);b-- >0;)v.isOdd()&&v.iadd(x),v.iushrn(1);m.cmp(f)>=0?(m.isub(f),p.isub(v)):(f.isub(m),v.isub(p))}var I;return m.cmpn(1)===0?I=p:I=v,I.cmpn(0)<0&&I.iadd(E),I},s.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var m=this.clone(),f=E.clone();m.negative=0,f.negative=0;for(var p=0;m.isEven()&&f.isEven();p++)m.iushrn(1),f.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=m.cmp(f);if(v<0){var x=m;m=f,f=x}else if(v===0||f.cmpn(1)===0)break;m.isub(f)}while(!0);return f.iushln(p)},s.prototype.invm=function(E){return this.egcd(E).a.umod(E)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(E){return this.words[0]&E},s.prototype.bincn=function(E){n(typeof E=="number");var m=E%26,f=(E-m)/26,p=1<>>26,_&=67108863,this.words[x]=_}return v!==0&&(this.words[x]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(E){var m=E<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var f;if(this.length>1)f=1;else{m&&(E=-E),n(E<=67108863,"Number is too big");var p=this.words[0]|0;f=p===E?0:pE.length)return 1;if(this.length=0;f--){var p=this.words[f]|0,v=E.words[f]|0;if(p!==v){pv&&(m=1);break}}return m},s.prototype.gtn=function(E){return this.cmpn(E)===1},s.prototype.gt=function(E){return this.cmp(E)===1},s.prototype.gten=function(E){return this.cmpn(E)>=0},s.prototype.gte=function(E){return this.cmp(E)>=0},s.prototype.ltn=function(E){return this.cmpn(E)===-1},s.prototype.lt=function(E){return this.cmp(E)===-1},s.prototype.lten=function(E){return this.cmpn(E)<=0},s.prototype.lte=function(E){return this.cmp(E)<=0},s.prototype.eqn=function(E){return this.cmpn(E)===0},s.prototype.eq=function(E){return this.cmp(E)===0},s.red=function(E){return new ue(E)},s.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(E){return this.red=E,this},s.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},s.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},s.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},s.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},s.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},s.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},s.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},s.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var q={k256:null,p224:null,p192:null,p25519:null};function U(G,E){this.name=G,this.p=new s(E,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var E=new s(null);return E.words=new Array(Math.ceil(this.n/13)),E},U.prototype.ireduce=function(E){var m=E,f;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),f=m.bitLength();while(f>this.n);var p=f0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},U.prototype.split=function(E,m){E.iushrn(this.n,0,m)},U.prototype.imulK=function(E){return E.imul(this.k)};function K(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(K,U),K.prototype.split=function(E,m){for(var f=4194303,p=Math.min(E.length,9),v=0;v>>22,x=_}x>>>=22,E.words[v-10]=x,x===0&&E.length>10?E.length-=10:E.length-=9},K.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var m=0,f=0;f>>=26,E.words[f]=v,m=p}return m!==0&&(E.words[E.length++]=m),E},s._prime=function(E){if(q[E])return q[E];var m;if(E==="k256")m=new K;else if(E==="p224")m=new J;else if(E==="p192")m=new T;else if(E==="p25519")m=new z;else throw new Error("Unknown prime "+E);return q[E]=m,m};function ue(G){if(typeof G=="string"){var E=s._prime(G);this.m=E.p,this.prime=E}else n(G.gtn(1),"modulus must be greater than 1"),this.m=G,this.prime=null}ue.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},ue.prototype._verify2=function(E,m){n((E.negative|m.negative)===0,"red works only with positives"),n(E.red&&E.red===m.red,"red works only with red numbers")},ue.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},ue.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},ue.prototype.add=function(E,m){this._verify2(E,m);var f=E.add(m);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},ue.prototype.iadd=function(E,m){this._verify2(E,m);var f=E.iadd(m);return f.cmp(this.m)>=0&&f.isub(this.m),f},ue.prototype.sub=function(E,m){this._verify2(E,m);var f=E.sub(m);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},ue.prototype.isub=function(E,m){this._verify2(E,m);var f=E.isub(m);return f.cmpn(0)<0&&f.iadd(this.m),f},ue.prototype.shl=function(E,m){return this._verify1(E),this.imod(E.ushln(m))},ue.prototype.imul=function(E,m){return this._verify2(E,m),this.imod(E.imul(m))},ue.prototype.mul=function(E,m){return this._verify2(E,m),this.imod(E.mul(m))},ue.prototype.isqr=function(E){return this.imul(E,E.clone())},ue.prototype.sqr=function(E){return this.mul(E,E)},ue.prototype.sqrt=function(E){if(E.isZero())return E.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(E,f)}for(var p=this.m.subn(1),v=0;!p.isZero()&&p.andln(1)===0;)v++,p.iushrn(1);n(!p.isZero());var x=new s(1).toRed(this),_=x.redNeg(),S=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new s(2*b*b).toRed(this);this.pow(b,S).cmp(_)!==0;)b.redIAdd(_);for(var M=this.pow(b,p),I=this.pow(E,p.addn(1).iushrn(1)),F=this.pow(E,p),ae=v;F.cmp(x)!==0;){for(var O=F,se=0;O.cmp(x)!==0;se++)O=O.redSqr();n(se=0;v--){for(var M=m.words[v],I=b-1;I>=0;I--){var F=M>>I&1;if(x!==p[0]&&(x=this.sqr(x)),F===0&&_===0){S=0;continue}_<<=1,_|=F,S++,!(S!==f&&(v!==0||I!==0))&&(x=this.mul(x,p[_]),S=0,_=0)}b=26}return x},ue.prototype.convertTo=function(E){var m=E.umod(this.m);return m===E?m.clone():m},ue.prototype.convertFrom=function(E){var m=E.clone();return m.red=null,m},s.mont=function(E){return new _e(E)};function _e(G){ue.call(this,G),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(_e,ue),_e.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},_e.prototype.convertFrom=function(E){var m=this.imod(E.mul(this.rinv));return m.red=null,m},_e.prototype.imul=function(E,m){if(E.isZero()||m.isZero())return E.words[0]=0,E.length=1,E;var f=E.imul(m),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.mul=function(E,m){if(E.isZero()||m.isZero())return new s(0)._forceRed(this);var f=E.mul(m),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.invm=function(E){var m=this.imod(E._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,nn)}(Hm);var wo=Hm.exports,Wm={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var u=0;u>8,g=l&255;d?a.push(d,g):a.push(g)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(N>>1)-1?k=(N>>1)-$:k=$,D.isubn(k)):k=0,A[P]=k,D.iushrn(1)}return A}e.getNAF=s;function o(d,g){var y=[[],[]];d=d.clone(),g=g.clone();for(var A=0,P=0,N;d.cmpn(-A)>0||g.cmpn(-P)>0;){var D=d.andln(3)+A&3,k=g.andln(3)+P&3;D===3&&(D=-1),k===3&&(k=-1);var $;D&1?(N=d.andln(7)+A&7,(N===3||N===5)&&k===2?$=-D:$=D):$=0,y[0].push($);var q;k&1?(N=g.andln(7)+P&7,(N===3||N===5)&&D===2?q=-k:q=k):q=0,y[1].push(q),2*A===$+1&&(A=1-A),2*P===q+1&&(P=1-P),d.iushrn(1),g.iushrn(1)}return y}e.getJSF=o;function a(d,g,y){var A="_"+g;d.prototype[g]=function(){return this[A]!==void 0?this[A]:this[A]=y.call(this)}}e.cachedProperty=a;function u(d){return typeof d=="string"?e.toArray(d,"hex"):d}e.parseBytes=u;function l(d){return new r(d,"hex","le")}e.intFromLE=l}(Ti);var Km={exports:{}},Vm;Km.exports=function(e){return Vm||(Vm=new oa(null)),Vm.generate(e)};function oa(t){this.rand=t}if(Km.exports.Rand=oa,oa.prototype.generate=function(e){return this._rand(e)},oa.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Td=aa;aa.prototype.point=function(){throw new Error("Not implemented")},aa.prototype.validate=function(){throw new Error("Not implemented")},aa.prototype._fixedNafMul=function(e,r){Cd(e.precomputed);var n=e._getDoubles(),i=Id(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),g=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Cd(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},aa.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,g,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=Id(n[P],o[P],this._bitLength),u[N]=Id(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],$=Ek(n[P],n[N]);for(l=Math.max($[0].length,l),u[P]=new Array(l),u[N]=new Array(l),g=0;g=0;d--){for(var T=0;d>=0;){var z=!0;for(g=0;g=0&&T++,K=K.dblp(T),d<0)break;for(g=0;g0?y=a[g][ue-1>>1]:ue<0&&(y=a[g][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Ki.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),g.negative&&(g=g.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:g,b:y},{a:A,b:P}]},Vi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),g=e.sub(a).sub(u),y=l.add(d).neg();return{k1:g,k2:y}},Vi.prototype.pointFromX=function(e,r){e=new en(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Vi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Vi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},On.prototype.isInfinity=function(){return this.inf},On.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},On.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},On.prototype.getX=function(){return this.x.fromRed()},On.prototype.getY=function(){return this.y.fromRed()},On.prototype.mul=function(e){return e=new en(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},On.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},On.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},On.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},On.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},On.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function jn(t,e,r,n){vu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new en(0)):(this.x=new en(e,16),this.y=new en(r,16),this.z=new en(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Ym(jn,vu.BasePoint),Vi.prototype.jpoint=function(e,r,n){return new jn(this,e,r,n)},jn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},jn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},jn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),g=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(g).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(g)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},jn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),g=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(g).redISub(g),A=u.redMul(g.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},jn.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},jn.prototype.inspect=function(){return this.isInfinity()?"":""},jn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var bu=wo,I3=bd,Rd=Td,Mk=Ti;function yu(t){Rd.call(this,"mont",t),this.a=new bu(t.a,16).toRed(this.red),this.b=new bu(t.b,16).toRed(this.red),this.i4=new bu(4).toRed(this.red).redInvm(),this.two=new bu(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}I3(yu,Rd);var Ik=yu;yu.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function Nn(t,e,r){Rd.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new bu(e,16),this.z=new bu(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}I3(Nn,Rd.BasePoint),yu.prototype.decodePoint=function(e,r){return this.point(Mk.toArray(e,r),1)},yu.prototype.point=function(e,r){return new Nn(this,e,r)},yu.prototype.pointFromJSON=function(e){return Nn.fromJSON(this,e)},Nn.prototype.precompute=function(){},Nn.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Nn.fromJSON=function(e,r){return new Nn(e,r[0],r[1]||e.one)},Nn.prototype.inspect=function(){return this.isInfinity()?"":""},Nn.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Nn.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)},Nn.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),u=s.redMul(i),l=r.z.redMul(a.redAdd(u).redSqr()),d=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(l,d)},Nn.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i},Nn.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Nn.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Nn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var Ck=Ti,xo=wo,C3=bd,Dd=Td,Tk=Ck.assert;function qs(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Dd.call(this,"edwards",t),this.a=new xo(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new xo(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new xo(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Tk(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}C3(qs,Dd);var Rk=qs;qs.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},qs.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},qs.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)},qs.prototype.pointFromX=function(e,r){e=new xo(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var u=a.fromRed().isOdd();return(r&&!u||!r&&u)&&(a=a.redNeg()),this.point(e,a)},qs.prototype.pointFromY=function(e,r){e=new xo(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)},qs.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function Hr(t,e,r,n,i){Dd.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new xo(e,16),this.y=new xo(r,16),this.z=n?new xo(n,16):this.curve.one,this.t=i&&new xo(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}C3(Hr,Dd.BasePoint),qs.prototype.pointFromJSON=function(e){return Hr.fromJSON(this,e)},qs.prototype.point=function(e,r,n,i){return new Hr(this,e,r,n,i)},Hr.fromJSON=function(e,r){return new Hr(e,r[0],r[1],r[2])},Hr.prototype.inspect=function(){return this.isInfinity()?"":""},Hr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Hr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),u=i.redSub(r),l=s.redMul(a),d=o.redMul(u),g=s.redMul(u),y=a.redMul(o);return this.curve.point(l,d,y,g)},Hr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,u,l;if(this.curve.twisted){a=this.curve._mulA(r);var d=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(d.redSub(this.curve.two)),s=d.redMul(a.redSub(n)),o=d.redSqr().redSub(d).redSub(d)):(u=this.z.redSqr(),l=d.redSub(u).redISub(u),i=e.redSub(r).redISub(n).redMul(l),s=d.redMul(a.redSub(n)),o=d.redMul(l))}else a=r.redAdd(n),u=this.curve._mulC(this.z).redSqr(),l=a.redSub(u).redSub(u),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)},Hr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Hr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),u=s.redAdd(i),l=n.redAdd(r),d=o.redMul(a),g=u.redMul(l),y=o.redMul(l),A=a.redMul(u);return this.curve.point(d,g,A,y)},Hr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),u=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),d=r.redMul(a).redMul(l),g,y;return this.curve.twisted?(g=r.redMul(u).redMul(s.redSub(this.curve._mulA(i))),y=a.redMul(u)):(g=r.redMul(u).redMul(s.redSub(i)),y=this.curve._mulC(a).redMul(u)),this.curve.point(d,g,y)},Hr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Hr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Hr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)},Hr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)},Hr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Hr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Hr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Hr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Hr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Hr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Hr.prototype.toP=Hr.prototype.normalize,Hr.prototype.mixedAdd=Hr.prototype.add,function(t){var e=t;e.base=Td,e.short=Pk,e.mont=Ik,e.edwards=Rk}(Gm);var Od={},Jm,T3;function Dk(){return T3||(T3=1,Jm={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Jm}(function(t){var e=t,r=ol,n=Gm,i=Ti,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,d){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var g=new o(d);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:g}),g}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=Dk()}catch{u=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})})(Od);var Ok=ol,Xa=Wm,R3=Va;function ca(t){if(!(this instanceof ca))return new ca(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Xa.toArray(t.entropy,t.entropyEnc||"hex"),r=Xa.toArray(t.nonce,t.nonceEnc||"hex"),n=Xa.toArray(t.pers,t.persEnc||"hex");R3(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Nk=ca;ca.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ca.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Xa.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var Nd=wo,Zm=Ti,Bk=Zm.assert;function Ld(t,e){if(t instanceof Ld)return t;this._importDER(t,e)||(Bk(t.r&&t.s,"Signature without r or s"),this.r=new Nd(t.r,16),this.s=new Nd(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Fk=Ld;function Uk(){this.place=0}function Qm(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function D3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Ld.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=D3(r),n=D3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];e1(i,r.length),i=i.concat(r),i.push(2),e1(i,n.length);var s=i.concat(n),o=[48];return e1(o,s.length),o=o.concat(s),Zm.encode(o,e)};var _o=wo,O3=Nk,jk=Ti,t1=Od,qk=M3,N3=jk.assert,r1=$k,kd=Fk;function Gi(t){if(!(this instanceof Gi))return new Gi(t);typeof t=="string"&&(N3(Object.prototype.hasOwnProperty.call(t1,t),"Unknown curve "+t),t=t1[t]),t instanceof t1.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var zk=Gi;Gi.prototype.keyPair=function(e){return new r1(this,e)},Gi.prototype.keyFromPrivate=function(e,r){return r1.fromPrivate(this,e,r)},Gi.prototype.keyFromPublic=function(e,r){return r1.fromPublic(this,e,r)},Gi.prototype.genKeyPair=function(e){e||(e={});for(var r=new O3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||qk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new _o(2));;){var s=new _o(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Gi.prototype._truncateToN=function(e,r,n){var i;if(_o.isBN(e)||typeof e=="number")e=new _o(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new _o(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new _o(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Gi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new O3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new _o(1)),d=0;;d++){var g=i.k?i.k(d):new _o(u.generate(this.n.byteLength()));if(g=this._truncateToN(g,!0),!(g.cmpn(1)<=0||g.cmp(l)>=0)){var y=this.g.mul(g);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=g.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new kd({r:P,s:N,recoveryParam:D})}}}}}},Gi.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new kd(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),l=u.mul(e).umod(this.n),d=u.mul(o).umod(this.n),g;return this.curve._maxwellTrick?(g=this.g.jmulAdd(l,n.getPublic(),d),g.isInfinity()?!1:g.eqXToP(o)):(g=this.g.mulAdd(l,n.getPublic(),d),g.isInfinity()?!1:g.getX().umod(this.n).cmp(o)===0)},Gi.prototype.recoverPubKey=function(t,e,r,n){N3((3&r)===r,"The recovery param is more than two bits"),e=new kd(e,n);var i=this.n,s=new _o(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),g=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(g,o,y)},Gi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new kd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var hl=Ti,L3=hl.assert,k3=hl.parseBytes,wu=hl.cachedProperty;function Ln(t,e){this.eddsa=t,this._secret=k3(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=k3(e.pub)}Ln.fromPublic=function(e,r){return r instanceof Ln?r:new Ln(e,{pub:r})},Ln.fromSecret=function(e,r){return r instanceof Ln?r:new Ln(e,{secret:r})},Ln.prototype.secret=function(){return this._secret},wu(Ln,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),wu(Ln,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),wu(Ln,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i}),wu(Ln,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),wu(Ln,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),wu(Ln,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Ln.prototype.sign=function(e){return L3(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Ln.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},Ln.prototype.getSecret=function(e){return L3(this._secret,"KeyPair is public only"),hl.encode(this.secret(),e)},Ln.prototype.getPublic=function(e){return hl.encode(this.pubBytes(),e)};var Hk=Ln,Wk=wo,$d=Ti,$3=$d.assert,Bd=$d.cachedProperty,Kk=$d.parseBytes;function Za(t,e){this.eddsa=t,typeof e!="object"&&(e=Kk(e)),Array.isArray(e)&&($3(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),$3(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof Wk&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Bd(Za,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Bd(Za,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Bd(Za,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Bd(Za,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Za.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Za.prototype.toHex=function(){return $d.encode(this.toBytes(),"hex").toUpperCase()};var Vk=Za,Gk=ol,Yk=Od,xu=Ti,Jk=xu.assert,B3=xu.parseBytes,F3=Hk,U3=Vk;function vi(t){if(Jk(t==="ed25519","only tested with ed25519 so far"),!(this instanceof vi))return new vi(t);t=Yk[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=Gk.sha512}var Xk=vi;vi.prototype.sign=function(e,r){e=B3(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),u=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:u,Rencoded:o})},vi.prototype.verify=function(e,r,n){if(e=B3(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)},vi.prototype.hashInt=function(){for(var e=this.hash(),r=0;re in t?e$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,H3=(t,e)=>{for(var r in e||(e={}))t$.call(e,r)&&z3(t,r,e[r]);if(q3)for(var r of q3(e))r$.call(e,r)&&z3(t,r,e[r]);return t};const n$="ReactNative",Ri={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},i$="js";function Fd(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Eu(){return!rl()&&!!gm()&&navigator.product===n$}function dl(){return!Fd()&&!!gm()&&!!rl()}function pl(){return Eu()?Ri.reactNative:Fd()?Ri.node:dl()?Ri.browser:Ri.unknown}function s$(){var t;try{return Eu()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function o$(t,e){let r=nl.parse(t);return r=H3(H3({},r),e),t=nl.stringify(r),t}function W3(){return Ax()||{name:"",description:"",url:"",icons:[""]}}function a$(){if(pl()===Ri.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=OO();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function c$(){var t;const e=pl();return e===Ri.browser?[e,((t=Sx())==null?void 0:t.host)||"unknown"].join(":"):e}function K3(t,e,r){const n=a$(),i=c$();return[[t,e].join("-"),[i$,r].join("-"),n,i].join("/")}function u$({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const u=r.split("?"),l=K3(t,e,n),d={auth:i,ua:l,projectId:s,useOnCloseEvent:o,origin:a||void 0},g=o$(u[1]||"",d);return u[0]+"?"+g}function Qa(t,e){return t.filter(r=>e.includes(r)).length===t.length}function V3(t){return Object.fromEntries(t.entries())}function G3(t){return new Map(Object.entries(t))}function ec(t=mt.FIVE_MINUTES,e){const r=mt.toMiliseconds(t||mt.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Su(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function Y3(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function f$(t){return Y3("topic",t)}function l$(t){return Y3("id",t)}function J3(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function En(t,e){return mt.fromMiliseconds(Date.now()+mt.toMiliseconds(t))}function ua(t){return Date.now()>=mt.toMiliseconds(t)}function vr(t,e){return`${t}${e?`:${e}`:""}`}function Ud(t=[],e=[]){return[...new Set([...t,...e])]}async function h$({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=d$(s,t,e),a=pl();if(a===Ri.browser){if(!((n=rl())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,g$()?"_blank":"_self","noreferrer noopener")}else a===Ri.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function d$(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${m$(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function p$(t,e){let r="";try{if(dl()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function X3(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function Z3(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function n1(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function g$(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function m$(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function Q3(t){return Buffer.from(t,"base64").toString("utf-8")}const v$="https://rpc.walletconnect.org/v1";async function b$(t,e,r,n,i,s){switch(r.t){case"eip191":return y$(t,e,r.s);case"eip1271":return await w$(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function y$(t,e,r){return ck(jx(e),r).toLowerCase()===t.toLowerCase()}async function w$(t,e,r,n,i,s){const o=_u(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",d=r.substring(2),g=jx(e).substring(2),y=a+g+u+l+d,A=await fetch(`${s||v$}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:x$(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:y},"latest"]})}),{result:P}=await A.json();return P?P.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function x$(){return Date.now()+Math.floor(Math.random()*1e3)}var _$=Object.defineProperty,E$=Object.defineProperties,S$=Object.getOwnPropertyDescriptors,e_=Object.getOwnPropertySymbols,A$=Object.prototype.hasOwnProperty,P$=Object.prototype.propertyIsEnumerable,t_=(t,e,r)=>e in t?_$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,M$=(t,e)=>{for(var r in e||(e={}))A$.call(e,r)&&t_(t,r,e[r]);if(e_)for(var r of e_(e))P$.call(e,r)&&t_(t,r,e[r]);return t},I$=(t,e)=>E$(t,S$(e));const C$="did:pkh:",i1=t=>t==null?void 0:t.split(":"),T$=t=>{const e=t&&i1(t);if(e)return t.includes(C$)?e[3]:e[1]},s1=t=>{const e=t&&i1(t);if(e)return e[2]+":"+e[3]},jd=t=>{const e=t&&i1(t);if(e)return e.pop()};async function r_(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=n_(i,i.iss),o=jd(i.iss);return await b$(o,s,n,s1(i.iss),r)}const n_=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=jd(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${T$(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,d=t.exp?`Expiration Time: ${t.exp}`:void 0,g=t.nbf?`Not Before: ${t.nbf}`:void 0,y=t.requestId?`Request ID: ${t.requestId}`:void 0,A=t.resources?`Resources:${t.resources.map(N=>` + */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=nn:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],g=[4,1024,262144,67108864],y=[1,256,65536,16777216],A=[6,1536,393216,100663296],P=[0,8,16,24],N=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],D=[224,256,384,512],k=[128,256],$=["hex","buffer","arrayBuffer","array","digest"],q={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(O){return Object.prototype.toString.call(O)==="[object Array]"}),u&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(O){return typeof O=="object"&&O.buffer&&O.buffer.constructor===ArrayBuffer});for(var U=function(O,se,ee){return function(X){return new I(O,se,O).update(X)[ee]()}},K=function(O,se,ee){return function(X,Q){return new I(O,se,Q).update(X)[ee]()}},J=function(O,se,ee){return function(X,Q,R,Z){return f["cshake"+O].update(X,Q,R,Z)[ee]()}},T=function(O,se,ee){return function(X,Q,R,Z){return f["kmac"+O].update(X,Q,R,Z)[ee]()}},z=function(O,se,ee,X){for(var Q=0;Q<$.length;++Q){var R=$[Q];O[R]=se(ee,X,R)}return O},ue=function(O,se){var ee=U(O,se,"hex");return ee.create=function(){return new I(O,se,O)},ee.update=function(X){return ee.create().update(X)},z(ee,U,O,se)},_e=function(O,se){var ee=K(O,se,"hex");return ee.create=function(X){return new I(O,se,X)},ee.update=function(X,Q){return ee.create(Q).update(X)},z(ee,K,O,se)},G=function(O,se){var ee=q[O],X=J(O,se,"hex");return X.create=function(Q,R,Z){return!R&&!Z?f["shake"+O].create(Q):new I(O,se,Q).bytepad([R,Z],ee)},X.update=function(Q,R,Z,te){return X.create(R,Z,te).update(Q)},z(X,J,O,se)},E=function(O,se){var ee=q[O],X=T(O,se,"hex");return X.create=function(Q,R,Z){return new F(O,se,R).bytepad(["KMAC",Z],ee).bytepad([Q],ee)},X.update=function(Q,R,Z,te){return X.create(Q,Z,te).update(R)},z(X,T,O,se)},m=[{name:"keccak",padding:y,bits:D,createMethod:ue},{name:"sha3",padding:A,bits:D,createMethod:ue},{name:"shake",padding:d,bits:k,createMethod:_e},{name:"cshake",padding:g,bits:k,createMethod:G},{name:"kmac",padding:g,bits:k,createMethod:E}],f={},p=[],v=0;v>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ee>>5,this.extraBytes=(ee&31)>>3;for(var X=0;X<50;++X)this.s[X]=0}I.prototype.update=function(O){if(this.finalized)throw new Error(r);var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}for(var X=this.blocks,Q=this.byteCount,R=O.length,Z=this.blockCount,te=0,le=this.s,ie,fe;te>2]|=O[te]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(X[ie>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=Q){for(this.start=ie-Q,this.block=X[Z],ie=0;ie>8,ee=O&255;ee>0;)Q.unshift(ee),O=O>>8,ee=O&255,++X;return se?Q.push(X):Q.unshift(X),this.update(Q),Q.length},I.prototype.encodeString=function(O){var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}var X=0,Q=O.length;if(se)X=Q;else for(var R=0;R=57344?X+=3:(Z=65536+((Z&1023)<<10|O.charCodeAt(++R)&1023),X+=4)}return X+=this.encode(X*8),this.update(O),X},I.prototype.bytepad=function(O,se){for(var ee=this.encode(se),X=0;X>2]|=this.padding[se&3],this.lastByteIndex===this.byteCount)for(O[0]=O[ee],se=1;se>4&15]+l[te&15]+l[te>>12&15]+l[te>>8&15]+l[te>>20&15]+l[te>>16&15]+l[te>>28&15]+l[te>>24&15];R%O===0&&(ae(se),Q=0)}return X&&(te=se[Q],Z+=l[te>>4&15]+l[te&15],X>1&&(Z+=l[te>>12&15]+l[te>>8&15]),X>2&&(Z+=l[te>>20&15]+l[te>>16&15])),Z},I.prototype.arrayBuffer=function(){this.finalize();var O=this.blockCount,se=this.s,ee=this.outputBlocks,X=this.extraBytes,Q=0,R=0,Z=this.outputBits>>3,te;X?te=new ArrayBuffer(ee+1<<2):te=new ArrayBuffer(Z);for(var le=new Uint32Array(te);R>8&255,Z[te+2]=le>>16&255,Z[te+3]=le>>24&255;R%O===0&&ae(se)}return X&&(te=R<<2,le=se[Q],Z[te]=le&255,X>1&&(Z[te+1]=le>>8&255),X>2&&(Z[te+2]=le>>16&255)),Z};function F(O,se,ee){I.call(this,O,se,ee)}F.prototype=new I,F.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var ae=function(O){var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me,Ne,Te,Be,Ie,Le,Ve,ke,ze,He,Ee,Qe,ct,$e,et,rt,Je,pt,ht,ft,Ht,Jt,St,er,Xt,Ot,$t,Tt,vt,Dt,Lt,bt,Bt,Ut,nt,Ft,B,H,V,C,Y,j,oe,pe,xe,Re,De,it,je,gt,st,tt;for(X=0;X<48;X+=2)Q=O[0]^O[10]^O[20]^O[30]^O[40],R=O[1]^O[11]^O[21]^O[31]^O[41],Z=O[2]^O[12]^O[22]^O[32]^O[42],te=O[3]^O[13]^O[23]^O[33]^O[43],le=O[4]^O[14]^O[24]^O[34]^O[44],ie=O[5]^O[15]^O[25]^O[35]^O[45],fe=O[6]^O[16]^O[26]^O[36]^O[46],ve=O[7]^O[17]^O[27]^O[37]^O[47],Me=O[8]^O[18]^O[28]^O[38]^O[48],Ne=O[9]^O[19]^O[29]^O[39]^O[49],se=Me^(Z<<1|te>>>31),ee=Ne^(te<<1|Z>>>31),O[0]^=se,O[1]^=ee,O[10]^=se,O[11]^=ee,O[20]^=se,O[21]^=ee,O[30]^=se,O[31]^=ee,O[40]^=se,O[41]^=ee,se=Q^(le<<1|ie>>>31),ee=R^(ie<<1|le>>>31),O[2]^=se,O[3]^=ee,O[12]^=se,O[13]^=ee,O[22]^=se,O[23]^=ee,O[32]^=se,O[33]^=ee,O[42]^=se,O[43]^=ee,se=Z^(fe<<1|ve>>>31),ee=te^(ve<<1|fe>>>31),O[4]^=se,O[5]^=ee,O[14]^=se,O[15]^=ee,O[24]^=se,O[25]^=ee,O[34]^=se,O[35]^=ee,O[44]^=se,O[45]^=ee,se=le^(Me<<1|Ne>>>31),ee=ie^(Ne<<1|Me>>>31),O[6]^=se,O[7]^=ee,O[16]^=se,O[17]^=ee,O[26]^=se,O[27]^=ee,O[36]^=se,O[37]^=ee,O[46]^=se,O[47]^=ee,se=fe^(Q<<1|R>>>31),ee=ve^(R<<1|Q>>>31),O[8]^=se,O[9]^=ee,O[18]^=se,O[19]^=ee,O[28]^=se,O[29]^=ee,O[38]^=se,O[39]^=ee,O[48]^=se,O[49]^=ee,Te=O[0],Be=O[1],nt=O[11]<<4|O[10]>>>28,Ft=O[10]<<4|O[11]>>>28,Je=O[20]<<3|O[21]>>>29,pt=O[21]<<3|O[20]>>>29,je=O[31]<<9|O[30]>>>23,gt=O[30]<<9|O[31]>>>23,Lt=O[40]<<18|O[41]>>>14,bt=O[41]<<18|O[40]>>>14,St=O[2]<<1|O[3]>>>31,er=O[3]<<1|O[2]>>>31,Ie=O[13]<<12|O[12]>>>20,Le=O[12]<<12|O[13]>>>20,B=O[22]<<10|O[23]>>>22,H=O[23]<<10|O[22]>>>22,ht=O[33]<<13|O[32]>>>19,ft=O[32]<<13|O[33]>>>19,st=O[42]<<2|O[43]>>>30,tt=O[43]<<2|O[42]>>>30,oe=O[5]<<30|O[4]>>>2,pe=O[4]<<30|O[5]>>>2,Xt=O[14]<<6|O[15]>>>26,Ot=O[15]<<6|O[14]>>>26,Ve=O[25]<<11|O[24]>>>21,ke=O[24]<<11|O[25]>>>21,V=O[34]<<15|O[35]>>>17,C=O[35]<<15|O[34]>>>17,Ht=O[45]<<29|O[44]>>>3,Jt=O[44]<<29|O[45]>>>3,ct=O[6]<<28|O[7]>>>4,$e=O[7]<<28|O[6]>>>4,xe=O[17]<<23|O[16]>>>9,Re=O[16]<<23|O[17]>>>9,$t=O[26]<<25|O[27]>>>7,Tt=O[27]<<25|O[26]>>>7,ze=O[36]<<21|O[37]>>>11,He=O[37]<<21|O[36]>>>11,Y=O[47]<<24|O[46]>>>8,j=O[46]<<24|O[47]>>>8,Bt=O[8]<<27|O[9]>>>5,Ut=O[9]<<27|O[8]>>>5,et=O[18]<<20|O[19]>>>12,rt=O[19]<<20|O[18]>>>12,De=O[29]<<7|O[28]>>>25,it=O[28]<<7|O[29]>>>25,vt=O[38]<<8|O[39]>>>24,Dt=O[39]<<8|O[38]>>>24,Ee=O[48]<<14|O[49]>>>18,Qe=O[49]<<14|O[48]>>>18,O[0]=Te^~Ie&Ve,O[1]=Be^~Le&ke,O[10]=ct^~et&Je,O[11]=$e^~rt&pt,O[20]=St^~Xt&$t,O[21]=er^~Ot&Tt,O[30]=Bt^~nt&B,O[31]=Ut^~Ft&H,O[40]=oe^~xe&De,O[41]=pe^~Re&it,O[2]=Ie^~Ve&ze,O[3]=Le^~ke&He,O[12]=et^~Je&ht,O[13]=rt^~pt&ft,O[22]=Xt^~$t&vt,O[23]=Ot^~Tt&Dt,O[32]=nt^~B&V,O[33]=Ft^~H&C,O[42]=xe^~De&je,O[43]=Re^~it>,O[4]=Ve^~ze&Ee,O[5]=ke^~He&Qe,O[14]=Je^~ht&Ht,O[15]=pt^~ft&Jt,O[24]=$t^~vt&Lt,O[25]=Tt^~Dt&bt,O[34]=B^~V&Y,O[35]=H^~C&j,O[44]=De^~je&st,O[45]=it^~gt&tt,O[6]=ze^~Ee&Te,O[7]=He^~Qe&Be,O[16]=ht^~Ht&ct,O[17]=ft^~Jt&$e,O[26]=vt^~Lt&St,O[27]=Dt^~bt&er,O[36]=V^~Y&Bt,O[37]=C^~j&Ut,O[46]=je^~st&oe,O[47]=gt^~tt&pe,O[8]=Ee^~Te&Ie,O[9]=Qe^~Be&Le,O[18]=Ht^~ct&et,O[19]=Jt^~$e&rt,O[28]=Lt^~St&Xt,O[29]=bt^~er&Ot,O[38]=Y^~Bt&nt,O[39]=j^~Ut&Ft,O[48]=st^~oe&xe,O[49]=tt^~pe&Re,O[0]^=N[X],O[1]^=N[X+1]};if(a)t.exports=f;else for(v=0;v{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const Nx=sN();var wm;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(wm||(wm={}));var ds;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(ds||(ds={}));const Lx="0123456789abcdef";class Kr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();md[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Ox>md[n])&&console.log.apply(console,r)}debug(...e){this._log(Kr.levels.DEBUG,e)}info(...e){this._log(Kr.levels.INFO,e)}warn(...e){this._log(Kr.levels.WARNING,e)}makeError(e,r,n){if(Dx)return this.makeError("censored error",r,{});r||(r=Kr.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(u=>{const l=n[u];try{if(l instanceof Uint8Array){let d="";for(let g=0;g>4],d+=Lx[l[g]&15];i.push(u+"=Uint8Array(0x"+d+")")}else i.push(u+"="+JSON.stringify(l))}catch{i.push(u+"="+JSON.stringify(n[u].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case ds.NUMERIC_FAULT:{o="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case ds.CALL_EXCEPTION:case ds.INSUFFICIENT_FUNDS:case ds.MISSING_NEW:case ds.NONCE_EXPIRED:case ds.REPLACEMENT_UNDERPRICED:case ds.TRANSACTION_REPLACED:case ds.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(u){a[u]=n[u]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Kr.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){Nx&&this.throwError("platform missing String.prototype.normalize",Kr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Nx})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Kr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Kr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return ym||(ym=new Kr(iN)),ym}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Rx){if(!e)return;this.globalLogger().throwError("error censorship permanent",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Dx=!!e,Rx=!!r}static setLogLevel(e){const r=md[e.toLowerCase()];if(r==null){Kr.globalLogger().warn("invalid log level - "+e);return}Ox=r}static from(e){return new Kr(e)}}Kr.errors=ds,Kr.levels=wm;const oN="bytes/5.7.0",on=new Kr(oN);function kx(t){return!!t.toHexString}function cu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return cu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function aN(t){return Os(t)&&!(t.length%2)||xm(t)}function $x(t){return typeof t=="number"&&t==t&&t%1===0}function xm(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!$x(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function bn(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),cu(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t)&&(t=t.toHexString()),Os(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":on.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ibn(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),cu(n)}function uN(t,e){t=bn(t),t.length>e&&on.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),cu(r)}function Os(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const _m="0123456789abcdef";function Ii(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=_m[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t))return t.toHexString();if(Os(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":on.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(xm(t)){let r="0x";for(let n=0;n>4]+_m[i&15]}return r}return on.throwArgumentError("invalid hexlify value","value",t)}function fN(t){if(typeof t!="string")t=Ii(t);else if(!Os(t)||t.length%2)return null;return(t.length-2)/2}function Bx(t,e,r){return typeof t!="string"?t=Ii(t):(!Os(t)||t.length%2)&&on.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function uu(t,e){for(typeof t!="string"?t=Ii(t):Os(t)||on.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&on.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Fx(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(aN(t)){let r=bn(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64))):r.length===65?(e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64)),e.v=r[64]):on.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:on.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Ii(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=uN(bn(e._vs),32);e._vs=Ii(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&on.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=Ii(i);e.s==null?e.s=o:e.s!==o&&on.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?on.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&on.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Os(e.r)?on.throwArgumentError("signature missing or invalid r","signature",t):e.r=uu(e.r,32),e.s==null||!Os(e.s)?on.throwArgumentError("signature missing or invalid s","signature",t):e.s=uu(e.s,32);const r=bn(e.s);r[0]>=128&&on.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=Ii(r);e._vs&&(Os(e._vs)||on.throwArgumentError("signature invalid _vs","signature",t),e._vs=uu(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&on.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Em(t){return"0x"+nN.keccak_256(bn(t))}var Sm={exports:{}};Sm.exports,function(t){(function(e,r){function n(m,f){if(!m)throw new Error(f||"Assertion failed")}function i(m,f){m.super_=f;var p=function(){};p.prototype=f.prototype,m.prototype=new p,m.prototype.constructor=m}function s(m,f,p){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((f==="le"||f==="be")&&(p=f,f=10),this._init(m||0,f||10,p||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=el.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,p){return f.cmp(p)>0?f:p},s.min=function(f,p){return f.cmp(p)<0?f:p},s.prototype._init=function(f,p,v){if(typeof f=="number")return this._initNumber(f,p,v);if(typeof f=="object")return this._initArray(f,p,v);p==="hex"&&(p=16),n(p===(p|0)&&p>=2&&p<=36),f=f.toString().replace(/\s+/g,"");var x=0;f[0]==="-"&&(x++,this.negative=1),x=0;x-=3)S=f[x]|f[x-1]<<8|f[x-2]<<16,this.words[_]|=S<>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);else if(v==="le")for(x=0,_=0;x>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);return this._strip()};function a(m,f){var p=m.charCodeAt(f);if(p>=48&&p<=57)return p-48;if(p>=65&&p<=70)return p-55;if(p>=97&&p<=102)return p-87;n(!1,"Invalid character in "+m)}function u(m,f,p){var v=a(m,p);return p-1>=f&&(v|=a(m,p-1)<<4),v}s.prototype._parseHex=function(f,p,v){this.length=Math.ceil((f.length-p)/6),this.words=new Array(this.length);for(var x=0;x=p;x-=2)b=u(f,p,x)<<_,this.words[S]|=b&67108863,_>=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8;else{var M=f.length-p;for(x=M%2===0?p+1:p;x=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8}this._strip()};function l(m,f,p,v){for(var x=0,_=0,S=Math.min(m.length,p),b=f;b=49?_=M-49+10:M>=17?_=M-17+10:_=M,n(M>=0&&_1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=g}catch{s.prototype.inspect=g}else s.prototype.inspect=g;function g(){return(this.red?""}var y=["","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"],A=[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,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(f,p){f=f||10,p=p|0||1;var v;if(f===16||f==="hex"){v="";for(var x=0,_=0,S=0;S>>24-x&16777215,x+=2,x>=26&&(x-=26,S--),_!==0||S!==this.length-1?v=y[6-M.length]+M+v:v=M+v}for(_!==0&&(v=_.toString(16)+v);v.length%p!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(f===(f|0)&&f>=2&&f<=36){var I=A[f],F=P[f];v="";var ae=this.clone();for(ae.negative=0;!ae.isZero();){var O=ae.modrn(F).toString(f);ae=ae.idivn(F),ae.isZero()?v=O+v:v=y[I-O.length]+O+v}for(this.isZero()&&(v="0"+v);v.length%p!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,p){return this.toArrayLike(o,f,p)}),s.prototype.toArray=function(f,p){return this.toArrayLike(Array,f,p)};var N=function(f,p){return f.allocUnsafe?f.allocUnsafe(p):new f(p)};s.prototype.toArrayLike=function(f,p,v){this._strip();var x=this.byteLength(),_=v||Math.max(1,x);n(x<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var S=N(f,_),b=p==="le"?"LE":"BE";return this["_toArrayLike"+b](S,x),S},s.prototype._toArrayLikeLE=function(f,p){for(var v=0,x=0,_=0,S=0;_>8&255),v>16&255),S===6?(v>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v=0&&(f[v--]=b>>8&255),v>=0&&(f[v--]=b>>16&255),S===6?(v>=0&&(f[v--]=b>>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v>=0)for(f[v--]=x;v>=0;)f[v--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var p=f,v=0;return p>=4096&&(v+=13,p>>>=13),p>=64&&(v+=7,p>>>=7),p>=8&&(v+=4,p>>>=4),p>=2&&(v+=2,p>>>=2),v+p},s.prototype._zeroBits=function(f){if(f===0)return 26;var p=f,v=0;return p&8191||(v+=13,p>>>=13),p&127||(v+=7,p>>>=7),p&15||(v+=4,p>>>=4),p&3||(v+=2,p>>>=2),p&1||v++,v},s.prototype.bitLength=function(){var f=this.words[this.length-1],p=this._countBits(f);return(this.length-1)*26+p};function D(m){for(var f=new Array(m.bitLength()),p=0;p>>x&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,p=0;pf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var p;this.length>f.length?p=f:p=this;for(var v=0;vf.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var p,v;this.length>f.length?(p=this,v=f):(p=f,v=this);for(var x=0;xf.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var p=Math.ceil(f/26)|0,v=f%26;this._expand(p),v>0&&p--;for(var x=0;x0&&(this.words[x]=~this.words[x]&67108863>>26-v),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,p){n(typeof f=="number"&&f>=0);var v=f/26|0,x=f%26;return this._expand(v+1),p?this.words[v]=this.words[v]|1<f.length?(v=this,x=f):(v=f,x=this);for(var _=0,S=0;S>>26;for(;_!==0&&S>>26;if(this.length=v.length,_!==0)this.words[this.length]=_,this.length++;else if(v!==this)for(;Sf.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var p=this.iadd(f);return f.negative=1,p._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var v=this.cmp(f);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,_;v>0?(x=this,_=f):(x=f,_=this);for(var S=0,b=0;b<_.length;b++)p=(x.words[b]|0)-(_.words[b]|0)+S,S=p>>26,this.words[b]=p&67108863;for(;S!==0&&b>26,this.words[b]=p&67108863;if(S===0&&b>>26,ae=M&67108863,O=Math.min(I,f.length-1),se=Math.max(0,I-m.length+1);se<=O;se++){var ee=I-se|0;x=m.words[ee]|0,_=f.words[se]|0,S=x*_+ae,F+=S/67108864|0,ae=S&67108863}p.words[I]=ae|0,M=F|0}return M!==0?p.words[I]=M|0:p.length--,p._strip()}var $=function(f,p,v){var x=f.words,_=p.words,S=v.words,b=0,M,I,F,ae=x[0]|0,O=ae&8191,se=ae>>>13,ee=x[1]|0,X=ee&8191,Q=ee>>>13,R=x[2]|0,Z=R&8191,te=R>>>13,le=x[3]|0,ie=le&8191,fe=le>>>13,ve=x[4]|0,Me=ve&8191,Ne=ve>>>13,Te=x[5]|0,Be=Te&8191,Ie=Te>>>13,Le=x[6]|0,Ve=Le&8191,ke=Le>>>13,ze=x[7]|0,He=ze&8191,Ee=ze>>>13,Qe=x[8]|0,ct=Qe&8191,$e=Qe>>>13,et=x[9]|0,rt=et&8191,Je=et>>>13,pt=_[0]|0,ht=pt&8191,ft=pt>>>13,Ht=_[1]|0,Jt=Ht&8191,St=Ht>>>13,er=_[2]|0,Xt=er&8191,Ot=er>>>13,$t=_[3]|0,Tt=$t&8191,vt=$t>>>13,Dt=_[4]|0,Lt=Dt&8191,bt=Dt>>>13,Bt=_[5]|0,Ut=Bt&8191,nt=Bt>>>13,Ft=_[6]|0,B=Ft&8191,H=Ft>>>13,V=_[7]|0,C=V&8191,Y=V>>>13,j=_[8]|0,oe=j&8191,pe=j>>>13,xe=_[9]|0,Re=xe&8191,De=xe>>>13;v.negative=f.negative^p.negative,v.length=19,M=Math.imul(O,ht),I=Math.imul(O,ft),I=I+Math.imul(se,ht)|0,F=Math.imul(se,ft);var it=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(it>>>26)|0,it&=67108863,M=Math.imul(X,ht),I=Math.imul(X,ft),I=I+Math.imul(Q,ht)|0,F=Math.imul(Q,ft),M=M+Math.imul(O,Jt)|0,I=I+Math.imul(O,St)|0,I=I+Math.imul(se,Jt)|0,F=F+Math.imul(se,St)|0;var je=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(je>>>26)|0,je&=67108863,M=Math.imul(Z,ht),I=Math.imul(Z,ft),I=I+Math.imul(te,ht)|0,F=Math.imul(te,ft),M=M+Math.imul(X,Jt)|0,I=I+Math.imul(X,St)|0,I=I+Math.imul(Q,Jt)|0,F=F+Math.imul(Q,St)|0,M=M+Math.imul(O,Xt)|0,I=I+Math.imul(O,Ot)|0,I=I+Math.imul(se,Xt)|0,F=F+Math.imul(se,Ot)|0;var gt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(gt>>>26)|0,gt&=67108863,M=Math.imul(ie,ht),I=Math.imul(ie,ft),I=I+Math.imul(fe,ht)|0,F=Math.imul(fe,ft),M=M+Math.imul(Z,Jt)|0,I=I+Math.imul(Z,St)|0,I=I+Math.imul(te,Jt)|0,F=F+Math.imul(te,St)|0,M=M+Math.imul(X,Xt)|0,I=I+Math.imul(X,Ot)|0,I=I+Math.imul(Q,Xt)|0,F=F+Math.imul(Q,Ot)|0,M=M+Math.imul(O,Tt)|0,I=I+Math.imul(O,vt)|0,I=I+Math.imul(se,Tt)|0,F=F+Math.imul(se,vt)|0;var st=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(st>>>26)|0,st&=67108863,M=Math.imul(Me,ht),I=Math.imul(Me,ft),I=I+Math.imul(Ne,ht)|0,F=Math.imul(Ne,ft),M=M+Math.imul(ie,Jt)|0,I=I+Math.imul(ie,St)|0,I=I+Math.imul(fe,Jt)|0,F=F+Math.imul(fe,St)|0,M=M+Math.imul(Z,Xt)|0,I=I+Math.imul(Z,Ot)|0,I=I+Math.imul(te,Xt)|0,F=F+Math.imul(te,Ot)|0,M=M+Math.imul(X,Tt)|0,I=I+Math.imul(X,vt)|0,I=I+Math.imul(Q,Tt)|0,F=F+Math.imul(Q,vt)|0,M=M+Math.imul(O,Lt)|0,I=I+Math.imul(O,bt)|0,I=I+Math.imul(se,Lt)|0,F=F+Math.imul(se,bt)|0;var tt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(tt>>>26)|0,tt&=67108863,M=Math.imul(Be,ht),I=Math.imul(Be,ft),I=I+Math.imul(Ie,ht)|0,F=Math.imul(Ie,ft),M=M+Math.imul(Me,Jt)|0,I=I+Math.imul(Me,St)|0,I=I+Math.imul(Ne,Jt)|0,F=F+Math.imul(Ne,St)|0,M=M+Math.imul(ie,Xt)|0,I=I+Math.imul(ie,Ot)|0,I=I+Math.imul(fe,Xt)|0,F=F+Math.imul(fe,Ot)|0,M=M+Math.imul(Z,Tt)|0,I=I+Math.imul(Z,vt)|0,I=I+Math.imul(te,Tt)|0,F=F+Math.imul(te,vt)|0,M=M+Math.imul(X,Lt)|0,I=I+Math.imul(X,bt)|0,I=I+Math.imul(Q,Lt)|0,F=F+Math.imul(Q,bt)|0,M=M+Math.imul(O,Ut)|0,I=I+Math.imul(O,nt)|0,I=I+Math.imul(se,Ut)|0,F=F+Math.imul(se,nt)|0;var At=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(At>>>26)|0,At&=67108863,M=Math.imul(Ve,ht),I=Math.imul(Ve,ft),I=I+Math.imul(ke,ht)|0,F=Math.imul(ke,ft),M=M+Math.imul(Be,Jt)|0,I=I+Math.imul(Be,St)|0,I=I+Math.imul(Ie,Jt)|0,F=F+Math.imul(Ie,St)|0,M=M+Math.imul(Me,Xt)|0,I=I+Math.imul(Me,Ot)|0,I=I+Math.imul(Ne,Xt)|0,F=F+Math.imul(Ne,Ot)|0,M=M+Math.imul(ie,Tt)|0,I=I+Math.imul(ie,vt)|0,I=I+Math.imul(fe,Tt)|0,F=F+Math.imul(fe,vt)|0,M=M+Math.imul(Z,Lt)|0,I=I+Math.imul(Z,bt)|0,I=I+Math.imul(te,Lt)|0,F=F+Math.imul(te,bt)|0,M=M+Math.imul(X,Ut)|0,I=I+Math.imul(X,nt)|0,I=I+Math.imul(Q,Ut)|0,F=F+Math.imul(Q,nt)|0,M=M+Math.imul(O,B)|0,I=I+Math.imul(O,H)|0,I=I+Math.imul(se,B)|0,F=F+Math.imul(se,H)|0;var Rt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,M=Math.imul(He,ht),I=Math.imul(He,ft),I=I+Math.imul(Ee,ht)|0,F=Math.imul(Ee,ft),M=M+Math.imul(Ve,Jt)|0,I=I+Math.imul(Ve,St)|0,I=I+Math.imul(ke,Jt)|0,F=F+Math.imul(ke,St)|0,M=M+Math.imul(Be,Xt)|0,I=I+Math.imul(Be,Ot)|0,I=I+Math.imul(Ie,Xt)|0,F=F+Math.imul(Ie,Ot)|0,M=M+Math.imul(Me,Tt)|0,I=I+Math.imul(Me,vt)|0,I=I+Math.imul(Ne,Tt)|0,F=F+Math.imul(Ne,vt)|0,M=M+Math.imul(ie,Lt)|0,I=I+Math.imul(ie,bt)|0,I=I+Math.imul(fe,Lt)|0,F=F+Math.imul(fe,bt)|0,M=M+Math.imul(Z,Ut)|0,I=I+Math.imul(Z,nt)|0,I=I+Math.imul(te,Ut)|0,F=F+Math.imul(te,nt)|0,M=M+Math.imul(X,B)|0,I=I+Math.imul(X,H)|0,I=I+Math.imul(Q,B)|0,F=F+Math.imul(Q,H)|0,M=M+Math.imul(O,C)|0,I=I+Math.imul(O,Y)|0,I=I+Math.imul(se,C)|0,F=F+Math.imul(se,Y)|0;var Mt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,M=Math.imul(ct,ht),I=Math.imul(ct,ft),I=I+Math.imul($e,ht)|0,F=Math.imul($e,ft),M=M+Math.imul(He,Jt)|0,I=I+Math.imul(He,St)|0,I=I+Math.imul(Ee,Jt)|0,F=F+Math.imul(Ee,St)|0,M=M+Math.imul(Ve,Xt)|0,I=I+Math.imul(Ve,Ot)|0,I=I+Math.imul(ke,Xt)|0,F=F+Math.imul(ke,Ot)|0,M=M+Math.imul(Be,Tt)|0,I=I+Math.imul(Be,vt)|0,I=I+Math.imul(Ie,Tt)|0,F=F+Math.imul(Ie,vt)|0,M=M+Math.imul(Me,Lt)|0,I=I+Math.imul(Me,bt)|0,I=I+Math.imul(Ne,Lt)|0,F=F+Math.imul(Ne,bt)|0,M=M+Math.imul(ie,Ut)|0,I=I+Math.imul(ie,nt)|0,I=I+Math.imul(fe,Ut)|0,F=F+Math.imul(fe,nt)|0,M=M+Math.imul(Z,B)|0,I=I+Math.imul(Z,H)|0,I=I+Math.imul(te,B)|0,F=F+Math.imul(te,H)|0,M=M+Math.imul(X,C)|0,I=I+Math.imul(X,Y)|0,I=I+Math.imul(Q,C)|0,F=F+Math.imul(Q,Y)|0,M=M+Math.imul(O,oe)|0,I=I+Math.imul(O,pe)|0,I=I+Math.imul(se,oe)|0,F=F+Math.imul(se,pe)|0;var Et=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Et>>>26)|0,Et&=67108863,M=Math.imul(rt,ht),I=Math.imul(rt,ft),I=I+Math.imul(Je,ht)|0,F=Math.imul(Je,ft),M=M+Math.imul(ct,Jt)|0,I=I+Math.imul(ct,St)|0,I=I+Math.imul($e,Jt)|0,F=F+Math.imul($e,St)|0,M=M+Math.imul(He,Xt)|0,I=I+Math.imul(He,Ot)|0,I=I+Math.imul(Ee,Xt)|0,F=F+Math.imul(Ee,Ot)|0,M=M+Math.imul(Ve,Tt)|0,I=I+Math.imul(Ve,vt)|0,I=I+Math.imul(ke,Tt)|0,F=F+Math.imul(ke,vt)|0,M=M+Math.imul(Be,Lt)|0,I=I+Math.imul(Be,bt)|0,I=I+Math.imul(Ie,Lt)|0,F=F+Math.imul(Ie,bt)|0,M=M+Math.imul(Me,Ut)|0,I=I+Math.imul(Me,nt)|0,I=I+Math.imul(Ne,Ut)|0,F=F+Math.imul(Ne,nt)|0,M=M+Math.imul(ie,B)|0,I=I+Math.imul(ie,H)|0,I=I+Math.imul(fe,B)|0,F=F+Math.imul(fe,H)|0,M=M+Math.imul(Z,C)|0,I=I+Math.imul(Z,Y)|0,I=I+Math.imul(te,C)|0,F=F+Math.imul(te,Y)|0,M=M+Math.imul(X,oe)|0,I=I+Math.imul(X,pe)|0,I=I+Math.imul(Q,oe)|0,F=F+Math.imul(Q,pe)|0,M=M+Math.imul(O,Re)|0,I=I+Math.imul(O,De)|0,I=I+Math.imul(se,Re)|0,F=F+Math.imul(se,De)|0;var dt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(dt>>>26)|0,dt&=67108863,M=Math.imul(rt,Jt),I=Math.imul(rt,St),I=I+Math.imul(Je,Jt)|0,F=Math.imul(Je,St),M=M+Math.imul(ct,Xt)|0,I=I+Math.imul(ct,Ot)|0,I=I+Math.imul($e,Xt)|0,F=F+Math.imul($e,Ot)|0,M=M+Math.imul(He,Tt)|0,I=I+Math.imul(He,vt)|0,I=I+Math.imul(Ee,Tt)|0,F=F+Math.imul(Ee,vt)|0,M=M+Math.imul(Ve,Lt)|0,I=I+Math.imul(Ve,bt)|0,I=I+Math.imul(ke,Lt)|0,F=F+Math.imul(ke,bt)|0,M=M+Math.imul(Be,Ut)|0,I=I+Math.imul(Be,nt)|0,I=I+Math.imul(Ie,Ut)|0,F=F+Math.imul(Ie,nt)|0,M=M+Math.imul(Me,B)|0,I=I+Math.imul(Me,H)|0,I=I+Math.imul(Ne,B)|0,F=F+Math.imul(Ne,H)|0,M=M+Math.imul(ie,C)|0,I=I+Math.imul(ie,Y)|0,I=I+Math.imul(fe,C)|0,F=F+Math.imul(fe,Y)|0,M=M+Math.imul(Z,oe)|0,I=I+Math.imul(Z,pe)|0,I=I+Math.imul(te,oe)|0,F=F+Math.imul(te,pe)|0,M=M+Math.imul(X,Re)|0,I=I+Math.imul(X,De)|0,I=I+Math.imul(Q,Re)|0,F=F+Math.imul(Q,De)|0;var _t=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(_t>>>26)|0,_t&=67108863,M=Math.imul(rt,Xt),I=Math.imul(rt,Ot),I=I+Math.imul(Je,Xt)|0,F=Math.imul(Je,Ot),M=M+Math.imul(ct,Tt)|0,I=I+Math.imul(ct,vt)|0,I=I+Math.imul($e,Tt)|0,F=F+Math.imul($e,vt)|0,M=M+Math.imul(He,Lt)|0,I=I+Math.imul(He,bt)|0,I=I+Math.imul(Ee,Lt)|0,F=F+Math.imul(Ee,bt)|0,M=M+Math.imul(Ve,Ut)|0,I=I+Math.imul(Ve,nt)|0,I=I+Math.imul(ke,Ut)|0,F=F+Math.imul(ke,nt)|0,M=M+Math.imul(Be,B)|0,I=I+Math.imul(Be,H)|0,I=I+Math.imul(Ie,B)|0,F=F+Math.imul(Ie,H)|0,M=M+Math.imul(Me,C)|0,I=I+Math.imul(Me,Y)|0,I=I+Math.imul(Ne,C)|0,F=F+Math.imul(Ne,Y)|0,M=M+Math.imul(ie,oe)|0,I=I+Math.imul(ie,pe)|0,I=I+Math.imul(fe,oe)|0,F=F+Math.imul(fe,pe)|0,M=M+Math.imul(Z,Re)|0,I=I+Math.imul(Z,De)|0,I=I+Math.imul(te,Re)|0,F=F+Math.imul(te,De)|0;var ot=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(ot>>>26)|0,ot&=67108863,M=Math.imul(rt,Tt),I=Math.imul(rt,vt),I=I+Math.imul(Je,Tt)|0,F=Math.imul(Je,vt),M=M+Math.imul(ct,Lt)|0,I=I+Math.imul(ct,bt)|0,I=I+Math.imul($e,Lt)|0,F=F+Math.imul($e,bt)|0,M=M+Math.imul(He,Ut)|0,I=I+Math.imul(He,nt)|0,I=I+Math.imul(Ee,Ut)|0,F=F+Math.imul(Ee,nt)|0,M=M+Math.imul(Ve,B)|0,I=I+Math.imul(Ve,H)|0,I=I+Math.imul(ke,B)|0,F=F+Math.imul(ke,H)|0,M=M+Math.imul(Be,C)|0,I=I+Math.imul(Be,Y)|0,I=I+Math.imul(Ie,C)|0,F=F+Math.imul(Ie,Y)|0,M=M+Math.imul(Me,oe)|0,I=I+Math.imul(Me,pe)|0,I=I+Math.imul(Ne,oe)|0,F=F+Math.imul(Ne,pe)|0,M=M+Math.imul(ie,Re)|0,I=I+Math.imul(ie,De)|0,I=I+Math.imul(fe,Re)|0,F=F+Math.imul(fe,De)|0;var wt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(wt>>>26)|0,wt&=67108863,M=Math.imul(rt,Lt),I=Math.imul(rt,bt),I=I+Math.imul(Je,Lt)|0,F=Math.imul(Je,bt),M=M+Math.imul(ct,Ut)|0,I=I+Math.imul(ct,nt)|0,I=I+Math.imul($e,Ut)|0,F=F+Math.imul($e,nt)|0,M=M+Math.imul(He,B)|0,I=I+Math.imul(He,H)|0,I=I+Math.imul(Ee,B)|0,F=F+Math.imul(Ee,H)|0,M=M+Math.imul(Ve,C)|0,I=I+Math.imul(Ve,Y)|0,I=I+Math.imul(ke,C)|0,F=F+Math.imul(ke,Y)|0,M=M+Math.imul(Be,oe)|0,I=I+Math.imul(Be,pe)|0,I=I+Math.imul(Ie,oe)|0,F=F+Math.imul(Ie,pe)|0,M=M+Math.imul(Me,Re)|0,I=I+Math.imul(Me,De)|0,I=I+Math.imul(Ne,Re)|0,F=F+Math.imul(Ne,De)|0;var lt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(lt>>>26)|0,lt&=67108863,M=Math.imul(rt,Ut),I=Math.imul(rt,nt),I=I+Math.imul(Je,Ut)|0,F=Math.imul(Je,nt),M=M+Math.imul(ct,B)|0,I=I+Math.imul(ct,H)|0,I=I+Math.imul($e,B)|0,F=F+Math.imul($e,H)|0,M=M+Math.imul(He,C)|0,I=I+Math.imul(He,Y)|0,I=I+Math.imul(Ee,C)|0,F=F+Math.imul(Ee,Y)|0,M=M+Math.imul(Ve,oe)|0,I=I+Math.imul(Ve,pe)|0,I=I+Math.imul(ke,oe)|0,F=F+Math.imul(ke,pe)|0,M=M+Math.imul(Be,Re)|0,I=I+Math.imul(Be,De)|0,I=I+Math.imul(Ie,Re)|0,F=F+Math.imul(Ie,De)|0;var at=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(at>>>26)|0,at&=67108863,M=Math.imul(rt,B),I=Math.imul(rt,H),I=I+Math.imul(Je,B)|0,F=Math.imul(Je,H),M=M+Math.imul(ct,C)|0,I=I+Math.imul(ct,Y)|0,I=I+Math.imul($e,C)|0,F=F+Math.imul($e,Y)|0,M=M+Math.imul(He,oe)|0,I=I+Math.imul(He,pe)|0,I=I+Math.imul(Ee,oe)|0,F=F+Math.imul(Ee,pe)|0,M=M+Math.imul(Ve,Re)|0,I=I+Math.imul(Ve,De)|0,I=I+Math.imul(ke,Re)|0,F=F+Math.imul(ke,De)|0;var Se=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Se>>>26)|0,Se&=67108863,M=Math.imul(rt,C),I=Math.imul(rt,Y),I=I+Math.imul(Je,C)|0,F=Math.imul(Je,Y),M=M+Math.imul(ct,oe)|0,I=I+Math.imul(ct,pe)|0,I=I+Math.imul($e,oe)|0,F=F+Math.imul($e,pe)|0,M=M+Math.imul(He,Re)|0,I=I+Math.imul(He,De)|0,I=I+Math.imul(Ee,Re)|0,F=F+Math.imul(Ee,De)|0;var Ae=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,M=Math.imul(rt,oe),I=Math.imul(rt,pe),I=I+Math.imul(Je,oe)|0,F=Math.imul(Je,pe),M=M+Math.imul(ct,Re)|0,I=I+Math.imul(ct,De)|0,I=I+Math.imul($e,Re)|0,F=F+Math.imul($e,De)|0;var Ge=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,M=Math.imul(rt,Re),I=Math.imul(rt,De),I=I+Math.imul(Je,Re)|0,F=Math.imul(Je,De);var Ue=(b+M|0)+((I&8191)<<13)|0;return b=(F+(I>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,S[0]=it,S[1]=je,S[2]=gt,S[3]=st,S[4]=tt,S[5]=At,S[6]=Rt,S[7]=Mt,S[8]=Et,S[9]=dt,S[10]=_t,S[11]=ot,S[12]=wt,S[13]=lt,S[14]=at,S[15]=Se,S[16]=Ae,S[17]=Ge,S[18]=Ue,b!==0&&(S[19]=b,v.length++),v};Math.imul||($=k);function q(m,f,p){p.negative=f.negative^m.negative,p.length=m.length+f.length;for(var v=0,x=0,_=0;_>>26)|0,x+=S>>>26,S&=67108863}p.words[_]=b,v=S,S=x}return v!==0?p.words[_]=v:p.length--,p._strip()}function U(m,f,p){return q(m,f,p)}s.prototype.mulTo=function(f,p){var v,x=this.length+f.length;return this.length===10&&f.length===10?v=$(this,f,p):x<63?v=k(this,f,p):x<1024?v=q(this,f,p):v=U(this,f,p),v},s.prototype.mul=function(f){var p=new s(null);return p.words=new Array(this.length+f.length),this.mulTo(f,p)},s.prototype.mulf=function(f){var p=new s(null);return p.words=new Array(this.length+f.length),U(this,f,p)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var p=f<0;p&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var v=0,x=0;x>=26,v+=_/67108864|0,v+=S>>>26,this.words[x]=S&67108863}return v!==0&&(this.words[x]=v,this.length++),p?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var p=D(f);if(p.length===0)return new s(1);for(var v=this,x=0;x=0);var p=f%26,v=(f-p)/26,x=67108863>>>26-p<<26-p,_;if(p!==0){var S=0;for(_=0;_>>26-p}S&&(this.words[_]=S,this.length++)}if(v!==0){for(_=this.length-1;_>=0;_--)this.words[_+v]=this.words[_];for(_=0;_=0);var x;p?x=(p-p%26)/26:x=0;var _=f%26,S=Math.min((f-_)/26,this.length),b=67108863^67108863>>>_<<_,M=v;if(x-=S,x=Math.max(0,x),M){for(var I=0;IS)for(this.length-=S,I=0;I=0&&(F!==0||I>=x);I--){var ae=this.words[I]|0;this.words[I]=F<<26-_|ae>>>_,F=ae&b}return M&&F!==0&&(M.words[M.length++]=F),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,p,v){return n(this.negative===0),this.iushrn(f,p,v)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var p=f%26,v=(f-p)/26,x=1<=0);var p=f%26,v=(f-p)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(p!==0&&v++,this.length=Math.min(v,this.length),p!==0){var x=67108863^67108863>>>p<=67108864;p++)this.words[p]-=67108864,p===this.length-1?this.words[p+1]=1:this.words[p+1]++;return this.length=Math.max(this.length,p+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var p=0;p>26)-(M/67108864|0),this.words[_+v]=S&67108863}for(;_>26,this.words[_+v]=S&67108863;if(b===0)return this._strip();for(n(b===-1),b=0,_=0;_>26,this.words[_]=S&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,p){var v=this.length-f.length,x=this.clone(),_=f,S=_.words[_.length-1]|0,b=this._countBits(S);v=26-b,v!==0&&(_=_.ushln(v),x.iushln(v),S=_.words[_.length-1]|0);var M=x.length-_.length,I;if(p!=="mod"){I=new s(null),I.length=M+1,I.words=new Array(I.length);for(var F=0;F=0;O--){var se=(x.words[_.length+O]|0)*67108864+(x.words[_.length+O-1]|0);for(se=Math.min(se/S|0,67108863),x._ishlnsubmul(_,se,O);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(_,1,O),x.isZero()||(x.negative^=1);I&&(I.words[O]=se)}return I&&I._strip(),x._strip(),p!=="div"&&v!==0&&x.iushrn(v),{div:I||null,mod:x}},s.prototype.divmod=function(f,p,v){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,_,S;return this.negative!==0&&f.negative===0?(S=this.neg().divmod(f,p),p!=="mod"&&(x=S.div.neg()),p!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.iadd(f)),{div:x,mod:_}):this.negative===0&&f.negative!==0?(S=this.divmod(f.neg(),p),p!=="mod"&&(x=S.div.neg()),{div:x,mod:S.mod}):this.negative&f.negative?(S=this.neg().divmod(f.neg(),p),p!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.isub(f)),{div:S.div,mod:_}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?p==="div"?{div:this.divn(f.words[0]),mod:null}:p==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,p)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var p=this.divmod(f);if(p.mod.isZero())return p.div;var v=p.div.negative!==0?p.mod.isub(f):p.mod,x=f.ushrn(1),_=f.andln(1),S=v.cmp(x);return S<0||_===1&&S===0?p.div:p.div.negative!==0?p.div.isubn(1):p.div.iaddn(1)},s.prototype.modrn=function(f){var p=f<0;p&&(f=-f),n(f<=67108863);for(var v=(1<<26)%f,x=0,_=this.length-1;_>=0;_--)x=(v*x+(this.words[_]|0))%f;return p?-x:x},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var p=f<0;p&&(f=-f),n(f<=67108863);for(var v=0,x=this.length-1;x>=0;x--){var _=(this.words[x]|0)+v*67108864;this.words[x]=_/f|0,v=_%f}return this._strip(),p?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var p=this,v=f.clone();p.negative!==0?p=p.umod(f):p=p.clone();for(var x=new s(1),_=new s(0),S=new s(0),b=new s(1),M=0;p.isEven()&&v.isEven();)p.iushrn(1),v.iushrn(1),++M;for(var I=v.clone(),F=p.clone();!p.isZero();){for(var ae=0,O=1;!(p.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(p.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(I),_.isub(F)),x.iushrn(1),_.iushrn(1);for(var se=0,ee=1;!(v.words[0]&ee)&&se<26;++se,ee<<=1);if(se>0)for(v.iushrn(se);se-- >0;)(S.isOdd()||b.isOdd())&&(S.iadd(I),b.isub(F)),S.iushrn(1),b.iushrn(1);p.cmp(v)>=0?(p.isub(v),x.isub(S),_.isub(b)):(v.isub(p),S.isub(x),b.isub(_))}return{a:S,b,gcd:v.iushln(M)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var p=this,v=f.clone();p.negative!==0?p=p.umod(f):p=p.clone();for(var x=new s(1),_=new s(0),S=v.clone();p.cmpn(1)>0&&v.cmpn(1)>0;){for(var b=0,M=1;!(p.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(p.iushrn(b);b-- >0;)x.isOdd()&&x.iadd(S),x.iushrn(1);for(var I=0,F=1;!(v.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(v.iushrn(I);I-- >0;)_.isOdd()&&_.iadd(S),_.iushrn(1);p.cmp(v)>=0?(p.isub(v),x.isub(_)):(v.isub(p),_.isub(x))}var ae;return p.cmpn(1)===0?ae=x:ae=_,ae.cmpn(0)<0&&ae.iadd(f),ae},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var p=this.clone(),v=f.clone();p.negative=0,v.negative=0;for(var x=0;p.isEven()&&v.isEven();x++)p.iushrn(1),v.iushrn(1);do{for(;p.isEven();)p.iushrn(1);for(;v.isEven();)v.iushrn(1);var _=p.cmp(v);if(_<0){var S=p;p=v,v=S}else if(_===0||v.cmpn(1)===0)break;p.isub(v)}while(!0);return v.iushln(x)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var p=f%26,v=(f-p)/26,x=1<>>26,b&=67108863,this.words[S]=b}return _!==0&&(this.words[S]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var p=f<0;if(this.negative!==0&&!p)return-1;if(this.negative===0&&p)return 1;this._strip();var v;if(this.length>1)v=1;else{p&&(f=-f),n(f<=67108863,"Number is too big");var x=this.words[0]|0;v=x===f?0:xf.length)return 1;if(this.length=0;v--){var x=this.words[v]|0,_=f.words[v]|0;if(x!==_){x<_?p=-1:x>_&&(p=1);break}}return p},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new G(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var K={k256:null,p224:null,p192:null,p25519:null};function J(m,f){this.name=m,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}J.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},J.prototype.ireduce=function(f){var p=f,v;do this.split(p,this.tmp),p=this.imulK(p),p=p.iadd(this.tmp),v=p.bitLength();while(v>this.n);var x=v0?p.isub(this.p):p.strip!==void 0?p.strip():p._strip(),p},J.prototype.split=function(f,p){f.iushrn(this.n,0,p)},J.prototype.imulK=function(f){return f.imul(this.k)};function T(){J.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(T,J),T.prototype.split=function(f,p){for(var v=4194303,x=Math.min(f.length,9),_=0;_>>22,S=b}S>>>=22,f.words[_-10]=S,S===0&&f.length>10?f.length-=10:f.length-=9},T.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var p=0,v=0;v>>=26,f.words[v]=_,p=x}return p!==0&&(f.words[f.length++]=p),f},s._prime=function(f){if(K[f])return K[f];var p;if(f==="k256")p=new T;else if(f==="p224")p=new z;else if(f==="p192")p=new ue;else if(f==="p25519")p=new _e;else throw new Error("Unknown prime "+f);return K[f]=p,p};function G(m){if(typeof m=="string"){var f=s._prime(m);this.m=f.p,this.prime=f}else n(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}G.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},G.prototype._verify2=function(f,p){n((f.negative|p.negative)===0,"red works only with positives"),n(f.red&&f.red===p.red,"red works only with red numbers")},G.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(d(f,f.umod(this.m)._forceRed(this)),f)},G.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},G.prototype.add=function(f,p){this._verify2(f,p);var v=f.add(p);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},G.prototype.iadd=function(f,p){this._verify2(f,p);var v=f.iadd(p);return v.cmp(this.m)>=0&&v.isub(this.m),v},G.prototype.sub=function(f,p){this._verify2(f,p);var v=f.sub(p);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},G.prototype.isub=function(f,p){this._verify2(f,p);var v=f.isub(p);return v.cmpn(0)<0&&v.iadd(this.m),v},G.prototype.shl=function(f,p){return this._verify1(f),this.imod(f.ushln(p))},G.prototype.imul=function(f,p){return this._verify2(f,p),this.imod(f.imul(p))},G.prototype.mul=function(f,p){return this._verify2(f,p),this.imod(f.mul(p))},G.prototype.isqr=function(f){return this.imul(f,f.clone())},G.prototype.sqr=function(f){return this.mul(f,f)},G.prototype.sqrt=function(f){if(f.isZero())return f.clone();var p=this.m.andln(3);if(n(p%2===1),p===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(f,v)}for(var x=this.m.subn(1),_=0;!x.isZero()&&x.andln(1)===0;)_++,x.iushrn(1);n(!x.isZero());var S=new s(1).toRed(this),b=S.redNeg(),M=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,M).cmp(b)!==0;)I.redIAdd(b);for(var F=this.pow(I,x),ae=this.pow(f,x.addn(1).iushrn(1)),O=this.pow(f,x),se=_;O.cmp(S)!==0;){for(var ee=O,X=0;ee.cmp(S)!==0;X++)ee=ee.redSqr();n(X=0;_--){for(var F=p.words[_],ae=I-1;ae>=0;ae--){var O=F>>ae&1;if(S!==x[0]&&(S=this.sqr(S)),O===0&&b===0){M=0;continue}b<<=1,b|=O,M++,!(M!==v&&(_!==0||ae!==0))&&(S=this.mul(S,x[b]),M=0,b=0)}I=26}return S},G.prototype.convertTo=function(f){var p=f.umod(this.m);return p===f?p.clone():p},G.prototype.convertFrom=function(f){var p=f.clone();return p.red=null,p},s.mont=function(f){return new E(f)};function E(m){G.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(E,G),E.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},E.prototype.convertFrom=function(f){var p=this.imod(f.mul(this.rinv));return p.red=null,p},E.prototype.imul=function(f,p){if(f.isZero()||p.isZero())return f.words[0]=0,f.length=1,f;var v=f.imul(p),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.mul=function(f,p){if(f.isZero()||p.isZero())return new s(0)._forceRed(this);var v=f.mul(p),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.invm=function(f){var p=this.imod(f._invmp(this.m).mul(this.r2));return p._forceRed(this)}})(t,nn)}(Sm);var lN=Sm.exports;const rr=Ui(lN);var hN=rr.BN;function dN(t){return new hN(t,36).toString(16)}const pN="strings/5.7.0",gN=new Kr(pN);var vd;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(vd||(vd={}));var Ux;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(Ux||(Ux={}));function Am(t,e=vd.current){e!=vd.current&&(gN.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return bn(r)}const mN=`Ethereum Signed Message: +`;function jx(t){return typeof t=="string"&&(t=Am(t)),Em(cN([Am(mN),Am(String(t.length)),t]))}const vN="address/5.7.0",il=new Kr(vN);function qx(t){Os(t,20)||il.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=bn(Em(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const bN=9007199254740991;function yN(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const Pm={};for(let t=0;t<10;t++)Pm[String(t)]=String(t);for(let t=0;t<26;t++)Pm[String.fromCharCode(65+t)]=String(10+t);const zx=Math.floor(yN(bN));function wN(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Pm[n]).join("");for(;e.length>=zx;){let n=e.substring(0,zx);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function xN(t){let e=null;if(typeof t!="string"&&il.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=qx(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&il.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==wN(t)&&il.throwArgumentError("bad icap checksum","address",t),e=dN(t.substring(4));e.length<40;)e="0"+e;e=qx("0x"+e)}else il.throwArgumentError("invalid address","address",t);return e}function sl(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var ol={},yr={},Va=Hx;function Hx(t,e){if(!t)throw new Error(e||"Assertion failed")}Hx.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var Mm={exports:{}};typeof Object.create=="function"?Mm.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Mm.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var bd=Mm.exports,_N=Va,EN=bd;yr.inherits=EN;function SN(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function AN(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):SN(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}yr.htonl=Wx;function MN(t,e){for(var r="",n=0;n>>0}return s}yr.join32=IN;function CN(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}yr.split32=CN;function TN(t,e){return t>>>e|t<<32-e}yr.rotr32=TN;function RN(t,e){return t<>>32-e}yr.rotl32=RN;function DN(t,e){return t+e>>>0}yr.sum32=DN;function ON(t,e,r){return t+e+r>>>0}yr.sum32_3=ON;function NN(t,e,r,n){return t+e+r+n>>>0}yr.sum32_4=NN;function LN(t,e,r,n,i){return t+e+r+n+i>>>0}yr.sum32_5=LN;function kN(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}yr.sum64=kN;function $N(t,e,r,n){var i=e+n>>>0,s=(i>>0}yr.sum64_hi=$N;function BN(t,e,r,n){var i=e+n;return i>>>0}yr.sum64_lo=BN;function FN(t,e,r,n,i,s,o,a){var u=0,l=e;l=l+n>>>0,u+=l>>0,u+=l>>0,u+=l>>0}yr.sum64_4_hi=FN;function UN(t,e,r,n,i,s,o,a){var u=e+n+s+a;return u>>>0}yr.sum64_4_lo=UN;function jN(t,e,r,n,i,s,o,a,u,l){var d=0,g=e;g=g+n>>>0,d+=g>>0,d+=g>>0,d+=g>>0,d+=g>>0}yr.sum64_5_hi=jN;function qN(t,e,r,n,i,s,o,a,u,l){var d=e+n+s+a+l;return d>>>0}yr.sum64_5_lo=qN;function zN(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}yr.rotr64_hi=zN;function HN(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.rotr64_lo=HN;function WN(t,e,r){return t>>>r}yr.shr64_hi=WN;function KN(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.shr64_lo=KN;var fu={},Gx=yr,VN=Va;function yd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}fu.BlockHash=yd,yd.prototype.update=function(e,r){if(e=Gx.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Gx.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}Ns.g0_256=ZN;function QN(t){return Ls(t,17)^Ls(t,19)^t>>>10}Ns.g1_256=QN;var hu=yr,eL=fu,tL=Ns,Im=hu.rotl32,al=hu.sum32,rL=hu.sum32_5,nL=tL.ft_1,Zx=eL.BlockHash,iL=[1518500249,1859775393,2400959708,3395469782];function ks(){if(!(this instanceof ks))return new ks;Zx.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}hu.inherits(ks,Zx);var sL=ks;ks.blockSize=512,ks.outSize=160,ks.hmacStrength=80,ks.padLength=64,ks.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),KL(e.length<=this.blockSize);for(var r=e.length;r>8,y=d&255;g?u.push(g,y):u.push(y)}return u}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",u=0;u(y>>1)-1?N=(y>>1)-D:N=D,A.isubn(N)):N=0,g[P]=N,A.iushrn(1)}return g}r.getNAF=n;function i(u,l){var d=[[],[]];u=u.clone(),l=l.clone();for(var g=0,y=0,A;u.cmpn(-g)>0||l.cmpn(-y)>0;){var P=u.andln(3)+g&3,N=l.andln(3)+y&3;P===3&&(P=-1),N===3&&(N=-1);var D;P&1?(A=u.andln(7)+g&7,(A===3||A===5)&&N===2?D=-P:D=P):D=0,d[0].push(D);var k;N&1?(A=l.andln(7)+y&7,(A===3||A===5)&&P===2?k=-N:k=N):k=0,d[1].push(k),2*g===D+1&&(g=1-g),2*y===k+1&&(y=1-y),u.iushrn(1),l.iushrn(1)}return d}r.getJSF=i;function s(u,l,d){var g="_"+l;u.prototype[l]=function(){return this[g]!==void 0?this[g]:this[g]=d.call(this)}}r.cachedProperty=s;function o(u){return typeof u=="string"?r.toArray(u,"hex"):u}r.parseBytes=o;function a(u){return new rr(u,"hex","le")}r.intFromLE=a}),xd=Ci.getNAF,YL=Ci.getJSF,_d=Ci.assert;function ra(t,e){this.type=t,this.p=new rr(e.p,16),this.red=e.prime?rr.red(e.prime):rr.mont(this.p),this.zero=new rr(0).toRed(this.red),this.one=new rr(1).toRed(this.red),this.two=new rr(2).toRed(this.red),this.n=e.n&&new rr(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ya=ra;ra.prototype.point=function(){throw new Error("Not implemented")},ra.prototype.validate=function(){throw new Error("Not implemented")},ra.prototype._fixedNafMul=function(e,r){_d(e.precomputed);var n=e._getDoubles(),i=xd(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),g=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];_d(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},ra.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,g,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=xd(n[P],o[P],this._bitLength),u[N]=xd(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],$=YL(n[P],n[N]);for(l=Math.max($[0].length,l),u[P]=new Array(l),u[N]=new Array(l),g=0;g=0;d--){for(var T=0;d>=0;){var z=!0;for(g=0;g=0&&T++,K=K.dblp(T),d<0)break;for(g=0;g0?y=a[g][ue-1>>1]:ue<0&&(y=a[g][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},zi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),g.negative&&(g=g.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:g,b:y},{a:A,b:P}]},Hi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),g=e.sub(a).sub(u),y=l.add(d).neg();return{k1:g,k2:y}},Hi.prototype.pointFromX=function(e,r){e=new rr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Hi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Hi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Dn.prototype.isInfinity=function(){return this.inf},Dn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Dn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Dn.prototype.getX=function(){return this.x.fromRed()},Dn.prototype.getY=function(){return this.y.fromRed()},Dn.prototype.mul=function(e){return e=new rr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Dn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Dn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Dn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Dn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Dn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Un(t,e,r,n){Ya.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new rr(0)):(this.x=new rr(e,16),this.y=new rr(r,16),this.z=new rr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Nm(Un,Ya.BasePoint),Hi.prototype.jpoint=function(e,r,n){return new Un(this,e,r,n)},Un.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},Un.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Un.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),g=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(g).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(g)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},Un.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),g=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(g).redISub(g),A=u.redMul(g.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},Un.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},Un.prototype.inspect=function(){return this.isInfinity()?"":""},Un.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Ed=mu(function(t,e){var r=e;r.base=Ya,r.short=XL,r.mont=null,r.edwards=null}),Sd=mu(function(t,e){var r=e,n=Ci.assert;function i(a){a.type==="short"?this.curve=new Ed.short(a):a.type==="edwards"?this.curve=new Ed.edwards(a):this.curve=new Ed.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,u){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(u);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:yo.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:yo.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:yo.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:yo.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:yo.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:yo.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:yo.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:yo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function na(t){if(!(this instanceof na))return new na(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ms.toArray(t.entropy,t.entropyEnc||"hex"),r=ms.toArray(t.nonce,t.nonceEnc||"hex"),n=ms.toArray(t.pers,t.persEnc||"hex");Om(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var d3=na;na.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},na.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=ms.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var ZL=Ci.assert;function Ad(t,e){if(t instanceof Ad)return t;this._importDER(t,e)||(ZL(t.r&&t.s,"Signature without r or s"),this.r=new rr(t.r,16),this.s=new rr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Pd=Ad;function QL(){this.place=0}function $m(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function p3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Ad.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=p3(r),n=p3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Bm(i,r.length),i=i.concat(r),i.push(2),Bm(i,n.length);var s=i.concat(n),o=[48];return Bm(o,s.length),o=o.concat(s),Ci.encode(o,e)};var ek=function(){throw new Error("unsupported")},g3=Ci.assert;function Wi(t){if(!(this instanceof Wi))return new Wi(t);typeof t=="string"&&(g3(Object.prototype.hasOwnProperty.call(Sd,t),"Unknown curve "+t),t=Sd[t]),t instanceof Sd.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var tk=Wi;Wi.prototype.keyPair=function(e){return new km(this,e)},Wi.prototype.keyFromPrivate=function(e,r){return km.fromPrivate(this,e,r)},Wi.prototype.keyFromPublic=function(e,r){return km.fromPublic(this,e,r)},Wi.prototype.genKeyPair=function(e){e||(e={});for(var r=new d3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||ek(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new rr(2));;){var s=new rr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Wi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Wi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new rr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new d3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new rr(1)),d=0;;d++){var g=i.k?i.k(d):new rr(u.generate(this.n.byteLength()));if(g=this._truncateToN(g,!0),!(g.cmpn(1)<=0||g.cmp(l)>=0)){var y=this.g.mul(g);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=g.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new Pd({r:P,s:N,recoveryParam:D})}}}}}},Wi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new rr(e,16)),n=this.keyFromPublic(n,i),r=new Pd(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),u=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.eqXToP(s)):(d=this.g.mulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.getX().umod(this.n).cmp(s)===0)},Wi.prototype.recoverPubKey=function(t,e,r,n){g3((3&r)===r,"The recovery param is more than two bits"),e=new Pd(e,n);var i=this.n,s=new rr(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),g=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(g,o,y)},Wi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Pd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var rk=mu(function(t,e){var r=e;r.version="6.5.4",r.utils=Ci,r.rand=function(){throw new Error("unsupported")},r.curve=Ed,r.curves=Sd,r.ec=tk,r.eddsa=null}),nk=rk.ec;const ik="signing-key/5.7.0",Fm=new Kr(ik);let Um=null;function ia(){return Um||(Um=new nk("secp256k1")),Um}class sk{constructor(e){sl(this,"curve","secp256k1"),sl(this,"privateKey",Ii(e)),fN(this.privateKey)!==32&&Fm.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=ia().keyFromPrivate(bn(this.privateKey));sl(this,"publicKey","0x"+r.getPublic(!1,"hex")),sl(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),sl(this,"_isSigningKey",!0)}_addPoint(e){const r=ia().keyFromPublic(bn(this.publicKey)),n=ia().keyFromPublic(bn(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=ia().keyFromPrivate(bn(this.privateKey)),n=bn(e);n.length!==32&&Fm.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Fx({recoveryParam:i.recoveryParam,r:uu("0x"+i.r.toString(16),32),s:uu("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=ia().keyFromPrivate(bn(this.privateKey)),n=ia().keyFromPublic(bn(m3(e)));return uu("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function ok(t,e){const r=Fx(e),n={r:bn(r.r),s:bn(r.s)};return"0x"+ia().recoverPubKey(bn(t),n,r.recoveryParam).encode("hex",!1)}function m3(t,e){const r=bn(t);return r.length===32?new sk(r).publicKey:r.length===33?"0x"+ia().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?Ii(r):Fm.throwArgumentError("invalid public or private key","key","[REDACTED]")}var v3;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(v3||(v3={}));function ak(t){const e=m3(t);return xN(Bx(Em(Bx(e,1)),12))}function ck(t,e){return ak(ok(bn(t),e))}var jm={},Md={};Object.defineProperty(Md,"__esModule",{value:!0});var Yn=or,qm=Mi,uk=20;function fk(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],g=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],P=r[31]<<24|r[30]<<16|r[29]<<8|r[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],k=e[11]<<24|e[10]<<16|e[9]<<8|e[8],$=e[15]<<24|e[14]<<16|e[13]<<8|e[12],q=n,U=i,K=s,J=o,T=a,z=u,ue=l,_e=d,G=g,E=y,m=A,f=P,p=N,v=D,x=k,_=$,S=0;S>>16|p<<16,G=G+p|0,T^=G,T=T>>>20|T<<12,U=U+z|0,v^=U,v=v>>>16|v<<16,E=E+v|0,z^=E,z=z>>>20|z<<12,K=K+ue|0,x^=K,x=x>>>16|x<<16,m=m+x|0,ue^=m,ue=ue>>>20|ue<<12,J=J+_e|0,_^=J,_=_>>>16|_<<16,f=f+_|0,_e^=f,_e=_e>>>20|_e<<12,K=K+ue|0,x^=K,x=x>>>24|x<<8,m=m+x|0,ue^=m,ue=ue>>>25|ue<<7,J=J+_e|0,_^=J,_=_>>>24|_<<8,f=f+_|0,_e^=f,_e=_e>>>25|_e<<7,U=U+z|0,v^=U,v=v>>>24|v<<8,E=E+v|0,z^=E,z=z>>>25|z<<7,q=q+T|0,p^=q,p=p>>>24|p<<8,G=G+p|0,T^=G,T=T>>>25|T<<7,q=q+z|0,_^=q,_=_>>>16|_<<16,m=m+_|0,z^=m,z=z>>>20|z<<12,U=U+ue|0,p^=U,p=p>>>16|p<<16,f=f+p|0,ue^=f,ue=ue>>>20|ue<<12,K=K+_e|0,v^=K,v=v>>>16|v<<16,G=G+v|0,_e^=G,_e=_e>>>20|_e<<12,J=J+T|0,x^=J,x=x>>>16|x<<16,E=E+x|0,T^=E,T=T>>>20|T<<12,K=K+_e|0,v^=K,v=v>>>24|v<<8,G=G+v|0,_e^=G,_e=_e>>>25|_e<<7,J=J+T|0,x^=J,x=x>>>24|x<<8,E=E+x|0,T^=E,T=T>>>25|T<<7,U=U+ue|0,p^=U,p=p>>>24|p<<8,f=f+p|0,ue^=f,ue=ue>>>25|ue<<7,q=q+z|0,_^=q,_=_>>>24|_<<8,m=m+_|0,z^=m,z=z>>>25|z<<7;Yn.writeUint32LE(q+n|0,t,0),Yn.writeUint32LE(U+i|0,t,4),Yn.writeUint32LE(K+s|0,t,8),Yn.writeUint32LE(J+o|0,t,12),Yn.writeUint32LE(T+a|0,t,16),Yn.writeUint32LE(z+u|0,t,20),Yn.writeUint32LE(ue+l|0,t,24),Yn.writeUint32LE(_e+d|0,t,28),Yn.writeUint32LE(G+g|0,t,32),Yn.writeUint32LE(E+y|0,t,36),Yn.writeUint32LE(m+A|0,t,40),Yn.writeUint32LE(f+P|0,t,44),Yn.writeUint32LE(p+N|0,t,48),Yn.writeUint32LE(v+D|0,t,52),Yn.writeUint32LE(x+k|0,t,56),Yn.writeUint32LE(_+$|0,t,60)}function b3(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var y3={},sa={};Object.defineProperty(sa,"__esModule",{value:!0});function dk(t,e,r){return~(t-1)&e|t-1&r}sa.select=dk;function pk(t,e){return(t|0)-(e|0)-1>>>31&1}sa.lessOrEqual=pk;function w3(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}sa.compare=w3;function gk(t,e){return t.length===0||e.length===0?!1:w3(t,e)!==0}sa.equal=gk,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=sa,r=Mi;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var u=a[0]|a[1]<<8;this._r[0]=u&8191;var l=a[2]|a[3]<<8;this._r[1]=(u>>>13|l<<3)&8191;var d=a[4]|a[5]<<8;this._r[2]=(l>>>10|d<<6)&7939;var g=a[6]|a[7]<<8;this._r[3]=(d>>>7|g<<9)&8191;var y=a[8]|a[9]<<8;this._r[4]=(g>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var A=a[10]|a[11]<<8;this._r[6]=(y>>>14|A<<2)&8191;var P=a[12]|a[13]<<8;this._r[7]=(A>>>11|P<<5)&8065;var N=a[14]|a[15]<<8;this._r[8]=(P>>>8|N<<8)&8191,this._r[9]=N>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,u,l){for(var d=this._fin?0:2048,g=this._h[0],y=this._h[1],A=this._h[2],P=this._h[3],N=this._h[4],D=this._h[5],k=this._h[6],$=this._h[7],q=this._h[8],U=this._h[9],K=this._r[0],J=this._r[1],T=this._r[2],z=this._r[3],ue=this._r[4],_e=this._r[5],G=this._r[6],E=this._r[7],m=this._r[8],f=this._r[9];l>=16;){var p=a[u+0]|a[u+1]<<8;g+=p&8191;var v=a[u+2]|a[u+3]<<8;y+=(p>>>13|v<<3)&8191;var x=a[u+4]|a[u+5]<<8;A+=(v>>>10|x<<6)&8191;var _=a[u+6]|a[u+7]<<8;P+=(x>>>7|_<<9)&8191;var S=a[u+8]|a[u+9]<<8;N+=(_>>>4|S<<12)&8191,D+=S>>>1&8191;var b=a[u+10]|a[u+11]<<8;k+=(S>>>14|b<<2)&8191;var M=a[u+12]|a[u+13]<<8;$+=(b>>>11|M<<5)&8191;var I=a[u+14]|a[u+15]<<8;q+=(M>>>8|I<<8)&8191,U+=I>>>5|d;var F=0,ae=F;ae+=g*K,ae+=y*(5*f),ae+=A*(5*m),ae+=P*(5*E),ae+=N*(5*G),F=ae>>>13,ae&=8191,ae+=D*(5*_e),ae+=k*(5*ue),ae+=$*(5*z),ae+=q*(5*T),ae+=U*(5*J),F+=ae>>>13,ae&=8191;var O=F;O+=g*J,O+=y*K,O+=A*(5*f),O+=P*(5*m),O+=N*(5*E),F=O>>>13,O&=8191,O+=D*(5*G),O+=k*(5*_e),O+=$*(5*ue),O+=q*(5*z),O+=U*(5*T),F+=O>>>13,O&=8191;var se=F;se+=g*T,se+=y*J,se+=A*K,se+=P*(5*f),se+=N*(5*m),F=se>>>13,se&=8191,se+=D*(5*E),se+=k*(5*G),se+=$*(5*_e),se+=q*(5*ue),se+=U*(5*z),F+=se>>>13,se&=8191;var ee=F;ee+=g*z,ee+=y*T,ee+=A*J,ee+=P*K,ee+=N*(5*f),F=ee>>>13,ee&=8191,ee+=D*(5*m),ee+=k*(5*E),ee+=$*(5*G),ee+=q*(5*_e),ee+=U*(5*ue),F+=ee>>>13,ee&=8191;var X=F;X+=g*ue,X+=y*z,X+=A*T,X+=P*J,X+=N*K,F=X>>>13,X&=8191,X+=D*(5*f),X+=k*(5*m),X+=$*(5*E),X+=q*(5*G),X+=U*(5*_e),F+=X>>>13,X&=8191;var Q=F;Q+=g*_e,Q+=y*ue,Q+=A*z,Q+=P*T,Q+=N*J,F=Q>>>13,Q&=8191,Q+=D*K,Q+=k*(5*f),Q+=$*(5*m),Q+=q*(5*E),Q+=U*(5*G),F+=Q>>>13,Q&=8191;var R=F;R+=g*G,R+=y*_e,R+=A*ue,R+=P*z,R+=N*T,F=R>>>13,R&=8191,R+=D*J,R+=k*K,R+=$*(5*f),R+=q*(5*m),R+=U*(5*E),F+=R>>>13,R&=8191;var Z=F;Z+=g*E,Z+=y*G,Z+=A*_e,Z+=P*ue,Z+=N*z,F=Z>>>13,Z&=8191,Z+=D*T,Z+=k*J,Z+=$*K,Z+=q*(5*f),Z+=U*(5*m),F+=Z>>>13,Z&=8191;var te=F;te+=g*m,te+=y*E,te+=A*G,te+=P*_e,te+=N*ue,F=te>>>13,te&=8191,te+=D*z,te+=k*T,te+=$*J,te+=q*K,te+=U*(5*f),F+=te>>>13,te&=8191;var le=F;le+=g*f,le+=y*m,le+=A*E,le+=P*G,le+=N*_e,F=le>>>13,le&=8191,le+=D*ue,le+=k*z,le+=$*T,le+=q*J,le+=U*K,F+=le>>>13,le&=8191,F=(F<<2)+F|0,F=F+ae|0,ae=F&8191,F=F>>>13,O+=F,g=ae,y=O,A=se,P=ee,N=X,D=Q,k=R,$=Z,q=te,U=le,u+=16,l-=16}this._h[0]=g,this._h[1]=y,this._h[2]=A,this._h[3]=P,this._h[4]=N,this._h[5]=D,this._h[6]=k,this._h[7]=$,this._h[8]=q,this._h[9]=U},o.prototype.finish=function(a,u){u===void 0&&(u=0);var l=new Uint16Array(10),d,g,y,A;if(this._leftover){for(A=this._leftover,this._buffer[A++]=1;A<16;A++)this._buffer[A]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(d=this._h[1]>>>13,this._h[1]&=8191,A=2;A<10;A++)this._h[A]+=d,d=this._h[A]>>>13,this._h[A]&=8191;for(this._h[0]+=d*5,d=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=d,d=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=d,l[0]=this._h[0]+5,d=l[0]>>>13,l[0]&=8191,A=1;A<10;A++)l[A]=this._h[A]+d,d=l[A]>>>13,l[A]&=8191;for(l[9]-=8192,g=(d^1)-1,A=0;A<10;A++)l[A]&=g;for(g=~g,A=0;A<10;A++)this._h[A]=this._h[A]&g|l[A];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,y=this._h[0]+this._pad[0],this._h[0]=y&65535,A=1;A<8;A++)y=(this._h[A]+this._pad[A]|0)+(y>>>16)|0,this._h[A]=y&65535;return a[u+0]=this._h[0]>>>0,a[u+1]=this._h[0]>>>8,a[u+2]=this._h[1]>>>0,a[u+3]=this._h[1]>>>8,a[u+4]=this._h[2]>>>0,a[u+5]=this._h[2]>>>8,a[u+6]=this._h[3]>>>0,a[u+7]=this._h[3]>>>8,a[u+8]=this._h[4]>>>0,a[u+9]=this._h[4]>>>8,a[u+10]=this._h[5]>>>0,a[u+11]=this._h[5]>>>8,a[u+12]=this._h[6]>>>0,a[u+13]=this._h[6]>>>8,a[u+14]=this._h[7]>>>0,a[u+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var u=0,l=a.length,d;if(this._leftover){d=16-this._leftover,d>l&&(d=l);for(var g=0;g=16&&(d=l-l%16,this._blocks(a,u,d),u+=d,l-=d),l){for(var g=0;g16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var A=new Uint8Array(16);A.set(l,A.length-l.length);var P=new Uint8Array(32);e.stream(this._key,A,P,4);var N=d.length+this.tagLength,D;if(y){if(y.length!==N)throw new Error("ChaCha20Poly1305: incorrect destination length");D=y}else D=new Uint8Array(N);return e.streamXOR(this._key,A,d,D,4),this._authenticate(D.subarray(D.length-this.tagLength,D.length),P,D.subarray(0,D.length-this.tagLength),g),n.wipe(A),D},u.prototype.open=function(l,d,g,y){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(d.length0&&A.update(o.subarray(y.length%16))),A.update(g),g.length%16>0&&A.update(o.subarray(g.length%16));var P=new Uint8Array(8);y&&i.writeUint64LE(y.length,P),A.update(P),i.writeUint64LE(g.length,P),A.update(P);for(var N=A.digest(),D=0;Dthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._temp,this._state,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,g=l/536870912|0,y=l<<3,A=l%64<56?64:128;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._state.set(u.state),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.state),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,u,l,d,g){for(;g>=64;){for(var y=u[0],A=u[1],P=u[2],N=u[3],D=u[4],k=u[5],$=u[6],q=u[7],U=0;U<16;U++){var K=d+U*4;a[U]=e.readUint32BE(l,K)}for(var U=16;U<64;U++){var J=a[U-2],T=(J>>>17|J<<15)^(J>>>19|J<<13)^J>>>10;J=a[U-15];var z=(J>>>7|J<<25)^(J>>>18|J<<14)^J>>>3;a[U]=(T+a[U-7]|0)+(z+a[U-16]|0)}for(var U=0;U<64;U++){var T=(((D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7))+(D&k^~D&$)|0)+(q+(i[U]+a[U]|0)|0)|0,z=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&A^y&P^A&P)|0;q=$,$=k,k=D,D=N+T|0,N=P,P=A,A=y,y=T+z|0}u[0]+=y,u[1]+=A,u[2]+=P,u[3]+=N,u[4]+=D,u[5]+=k,u[6]+=$,u[7]+=q,d+=64,g-=64}return d}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(fl);var Hm={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=ea,r=Mi;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(U){const K=new Float64Array(16);if(U)for(let J=0;J>16&1),J[_e-1]&=65535;J[15]=T[15]-32767-(J[14]>>16&1);const ue=J[15]>>16&1;J[14]&=65535,a(T,J,1-ue)}for(let z=0;z<16;z++)U[2*z]=T[z]&255,U[2*z+1]=T[z]>>8}function l(U,K){for(let J=0;J<16;J++)U[J]=K[2*J]+(K[2*J+1]<<8);U[15]&=32767}function d(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]+J[T]}function g(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]-J[T]}function y(U,K,J){let T,z,ue=0,_e=0,G=0,E=0,m=0,f=0,p=0,v=0,x=0,_=0,S=0,b=0,M=0,I=0,F=0,ae=0,O=0,se=0,ee=0,X=0,Q=0,R=0,Z=0,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,Be=J[0],Ie=J[1],Le=J[2],Ve=J[3],ke=J[4],ze=J[5],He=J[6],Ee=J[7],Qe=J[8],ct=J[9],$e=J[10],et=J[11],rt=J[12],Je=J[13],pt=J[14],ht=J[15];T=K[0],ue+=T*Be,_e+=T*Ie,G+=T*Le,E+=T*Ve,m+=T*ke,f+=T*ze,p+=T*He,v+=T*Ee,x+=T*Qe,_+=T*ct,S+=T*$e,b+=T*et,M+=T*rt,I+=T*Je,F+=T*pt,ae+=T*ht,T=K[1],_e+=T*Be,G+=T*Ie,E+=T*Le,m+=T*Ve,f+=T*ke,p+=T*ze,v+=T*He,x+=T*Ee,_+=T*Qe,S+=T*ct,b+=T*$e,M+=T*et,I+=T*rt,F+=T*Je,ae+=T*pt,O+=T*ht,T=K[2],G+=T*Be,E+=T*Ie,m+=T*Le,f+=T*Ve,p+=T*ke,v+=T*ze,x+=T*He,_+=T*Ee,S+=T*Qe,b+=T*ct,M+=T*$e,I+=T*et,F+=T*rt,ae+=T*Je,O+=T*pt,se+=T*ht,T=K[3],E+=T*Be,m+=T*Ie,f+=T*Le,p+=T*Ve,v+=T*ke,x+=T*ze,_+=T*He,S+=T*Ee,b+=T*Qe,M+=T*ct,I+=T*$e,F+=T*et,ae+=T*rt,O+=T*Je,se+=T*pt,ee+=T*ht,T=K[4],m+=T*Be,f+=T*Ie,p+=T*Le,v+=T*Ve,x+=T*ke,_+=T*ze,S+=T*He,b+=T*Ee,M+=T*Qe,I+=T*ct,F+=T*$e,ae+=T*et,O+=T*rt,se+=T*Je,ee+=T*pt,X+=T*ht,T=K[5],f+=T*Be,p+=T*Ie,v+=T*Le,x+=T*Ve,_+=T*ke,S+=T*ze,b+=T*He,M+=T*Ee,I+=T*Qe,F+=T*ct,ae+=T*$e,O+=T*et,se+=T*rt,ee+=T*Je,X+=T*pt,Q+=T*ht,T=K[6],p+=T*Be,v+=T*Ie,x+=T*Le,_+=T*Ve,S+=T*ke,b+=T*ze,M+=T*He,I+=T*Ee,F+=T*Qe,ae+=T*ct,O+=T*$e,se+=T*et,ee+=T*rt,X+=T*Je,Q+=T*pt,R+=T*ht,T=K[7],v+=T*Be,x+=T*Ie,_+=T*Le,S+=T*Ve,b+=T*ke,M+=T*ze,I+=T*He,F+=T*Ee,ae+=T*Qe,O+=T*ct,se+=T*$e,ee+=T*et,X+=T*rt,Q+=T*Je,R+=T*pt,Z+=T*ht,T=K[8],x+=T*Be,_+=T*Ie,S+=T*Le,b+=T*Ve,M+=T*ke,I+=T*ze,F+=T*He,ae+=T*Ee,O+=T*Qe,se+=T*ct,ee+=T*$e,X+=T*et,Q+=T*rt,R+=T*Je,Z+=T*pt,te+=T*ht,T=K[9],_+=T*Be,S+=T*Ie,b+=T*Le,M+=T*Ve,I+=T*ke,F+=T*ze,ae+=T*He,O+=T*Ee,se+=T*Qe,ee+=T*ct,X+=T*$e,Q+=T*et,R+=T*rt,Z+=T*Je,te+=T*pt,le+=T*ht,T=K[10],S+=T*Be,b+=T*Ie,M+=T*Le,I+=T*Ve,F+=T*ke,ae+=T*ze,O+=T*He,se+=T*Ee,ee+=T*Qe,X+=T*ct,Q+=T*$e,R+=T*et,Z+=T*rt,te+=T*Je,le+=T*pt,ie+=T*ht,T=K[11],b+=T*Be,M+=T*Ie,I+=T*Le,F+=T*Ve,ae+=T*ke,O+=T*ze,se+=T*He,ee+=T*Ee,X+=T*Qe,Q+=T*ct,R+=T*$e,Z+=T*et,te+=T*rt,le+=T*Je,ie+=T*pt,fe+=T*ht,T=K[12],M+=T*Be,I+=T*Ie,F+=T*Le,ae+=T*Ve,O+=T*ke,se+=T*ze,ee+=T*He,X+=T*Ee,Q+=T*Qe,R+=T*ct,Z+=T*$e,te+=T*et,le+=T*rt,ie+=T*Je,fe+=T*pt,ve+=T*ht,T=K[13],I+=T*Be,F+=T*Ie,ae+=T*Le,O+=T*Ve,se+=T*ke,ee+=T*ze,X+=T*He,Q+=T*Ee,R+=T*Qe,Z+=T*ct,te+=T*$e,le+=T*et,ie+=T*rt,fe+=T*Je,ve+=T*pt,Me+=T*ht,T=K[14],F+=T*Be,ae+=T*Ie,O+=T*Le,se+=T*Ve,ee+=T*ke,X+=T*ze,Q+=T*He,R+=T*Ee,Z+=T*Qe,te+=T*ct,le+=T*$e,ie+=T*et,fe+=T*rt,ve+=T*Je,Me+=T*pt,Ne+=T*ht,T=K[15],ae+=T*Be,O+=T*Ie,se+=T*Le,ee+=T*Ve,X+=T*ke,Q+=T*ze,R+=T*He,Z+=T*Ee,te+=T*Qe,le+=T*ct,ie+=T*$e,fe+=T*et,ve+=T*rt,Me+=T*Je,Ne+=T*pt,Te+=T*ht,ue+=38*O,_e+=38*se,G+=38*ee,E+=38*X,m+=38*Q,f+=38*R,p+=38*Z,v+=38*te,x+=38*le,_+=38*ie,S+=38*fe,b+=38*ve,M+=38*Me,I+=38*Ne,F+=38*Te,z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=p+z+65535,z=Math.floor(T/65536),p=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=p+z+65535,z=Math.floor(T/65536),p=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),U[0]=ue,U[1]=_e,U[2]=G,U[3]=E,U[4]=m,U[5]=f,U[6]=p,U[7]=v,U[8]=x,U[9]=_,U[10]=S,U[11]=b,U[12]=M,U[13]=I,U[14]=F,U[15]=ae}function A(U,K){y(U,K,K)}function P(U,K){const J=n();for(let T=0;T<16;T++)J[T]=K[T];for(let T=253;T>=0;T--)A(J,J),T!==2&&T!==4&&y(J,J,K);for(let T=0;T<16;T++)U[T]=J[T]}function N(U,K){const J=new Uint8Array(32),T=new Float64Array(80),z=n(),ue=n(),_e=n(),G=n(),E=n(),m=n();for(let x=0;x<31;x++)J[x]=U[x];J[31]=U[31]&127|64,J[0]&=248,l(T,K);for(let x=0;x<16;x++)ue[x]=T[x];z[0]=G[0]=1;for(let x=254;x>=0;--x){const _=J[x>>>3]>>>(x&7)&1;a(z,ue,_),a(_e,G,_),d(E,z,_e),g(z,z,_e),d(_e,ue,G),g(ue,ue,G),A(G,E),A(m,z),y(z,_e,z),y(_e,ue,E),d(E,z,_e),g(z,z,_e),A(ue,z),g(_e,G,m),y(z,_e,s),d(z,z,G),y(_e,_e,z),y(z,G,m),y(G,ue,T),A(ue,E),a(z,ue,_),a(_e,G,_)}for(let x=0;x<16;x++)T[x+16]=z[x],T[x+32]=_e[x],T[x+48]=ue[x],T[x+64]=G[x];const f=T.subarray(32),p=T.subarray(16);P(f,f),y(p,p,f);const v=new Uint8Array(32);return u(v,p),v}t.scalarMult=N;function D(U){return N(U,i)}t.scalarMultBase=D;function k(U){if(U.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const K=new Uint8Array(U);return{publicKey:D(K),secretKey:K}}t.generateKeyPairFromSeed=k;function $(U){const K=(0,e.randomBytes)(32,U),J=k(K);return(0,r.wipe)(K),J}t.generateKeyPair=$;function q(U,K,J=!1){if(U.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(K.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const T=N(U,K);if(J){let z=0;for(let ue=0;ue",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}};var Ti={},Wm={exports:{}};Wm.exports,function(t){(function(e,r){function n(G,E){if(!G)throw new Error(E||"Assertion failed")}function i(G,E){G.super_=E;var m=function(){};m.prototype=E.prototype,G.prototype=new m,G.prototype.constructor=G}function s(G,E,m){if(s.isBN(G))return G;this.negative=0,this.words=null,this.length=0,this.red=null,G!==null&&((E==="le"||E==="be")&&(m=E,E=10),this._init(G||0,E||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=el.Buffer}catch{}s.isBN=function(E){return E instanceof s?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===s.wordSize&&Array.isArray(E.words)},s.max=function(E,m){return E.cmp(m)>0?E:m},s.min=function(E,m){return E.cmp(m)<0?E:m},s.prototype._init=function(E,m,f){if(typeof E=="number")return this._initNumber(E,m,f);if(typeof E=="object")return this._initArray(E,m,f);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),E=E.toString().replace(/\s+/g,"");var p=0;E[0]==="-"&&(p++,this.negative=1),p=0;p-=3)x=E[p]|E[p-1]<<8|E[p-2]<<16,this.words[v]|=x<<_&67108863,this.words[v+1]=x>>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);else if(f==="le")for(p=0,v=0;p>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);return this.strip()};function a(G,E){var m=G.charCodeAt(E);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function u(G,E,m){var f=a(G,m);return m-1>=E&&(f|=a(G,m-1)<<4),f}s.prototype._parseHex=function(E,m,f){this.length=Math.ceil((E.length-m)/6),this.words=new Array(this.length);for(var p=0;p=m;p-=2)_=u(E,m,p)<=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8;else{var S=E.length-m;for(p=S%2===0?m+1:m;p=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8}this.strip()};function l(G,E,m,f){for(var p=0,v=Math.min(G.length,m),x=E;x=49?p+=_-49+10:_>=17?p+=_-17+10:p+=_}return p}s.prototype._parseBase=function(E,m,f){this.words=[0],this.length=1;for(var p=0,v=1;v<=67108863;v*=m)p++;p--,v=v/m|0;for(var x=E.length-f,_=x%p,S=Math.min(x,x-_)+f,b=0,M=f;M1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var d=["","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"],g=[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],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(E,m){E=E||10,m=m|0||1;var f;if(E===16||E==="hex"){f="";for(var p=0,v=0,x=0;x>>24-p&16777215,p+=2,p>=26&&(p-=26,x--),v!==0||x!==this.length-1?f=d[6-S.length]+S+f:f=S+f}for(v!==0&&(f=v.toString(16)+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(E===(E|0)&&E>=2&&E<=36){var b=g[E],M=y[E];f="";var I=this.clone();for(I.negative=0;!I.isZero();){var F=I.modn(M).toString(E);I=I.idivn(M),I.isZero()?f=F+f:f=d[b-F.length]+F+f}for(this.isZero()&&(f="0"+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(E,m){return n(typeof o<"u"),this.toArrayLike(o,E,m)},s.prototype.toArray=function(E,m){return this.toArrayLike(Array,E,m)},s.prototype.toArrayLike=function(E,m,f){var p=this.byteLength(),v=f||Math.max(1,p);n(p<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var x=m==="le",_=new E(v),S,b,M=this.clone();if(x){for(b=0;!M.isZero();b++)S=M.andln(255),M.iushrn(8),_[b]=S;for(;b=4096&&(f+=13,m>>>=13),m>=64&&(f+=7,m>>>=7),m>=8&&(f+=4,m>>>=4),m>=2&&(f+=2,m>>>=2),f+m},s.prototype._zeroBits=function(E){if(E===0)return 26;var m=E,f=0;return m&8191||(f+=13,m>>>=13),m&127||(f+=7,m>>>=7),m&15||(f+=4,m>>>=4),m&3||(f+=2,m>>>=2),m&1||f++,f},s.prototype.bitLength=function(){var E=this.words[this.length-1],m=this._countBits(E);return(this.length-1)*26+m};function A(G){for(var E=new Array(G.bitLength()),m=0;m>>p}return E}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,m=0;mE.length?this.clone().ior(E):E.clone().ior(this)},s.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},s.prototype.iuand=function(E){var m;this.length>E.length?m=E:m=this;for(var f=0;fE.length?this.clone().iand(E):E.clone().iand(this)},s.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},s.prototype.iuxor=function(E){var m,f;this.length>E.length?(m=this,f=E):(m=E,f=this);for(var p=0;pE.length?this.clone().ixor(E):E.clone().ixor(this)},s.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},s.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var m=Math.ceil(E/26)|0,f=E%26;this._expand(m),f>0&&m--;for(var p=0;p0&&(this.words[p]=~this.words[p]&67108863>>26-f),this.strip()},s.prototype.notn=function(E){return this.clone().inotn(E)},s.prototype.setn=function(E,m){n(typeof E=="number"&&E>=0);var f=E/26|0,p=E%26;return this._expand(f+1),m?this.words[f]=this.words[f]|1<E.length?(f=this,p=E):(f=E,p=this);for(var v=0,x=0;x>>26;for(;v!==0&&x>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;xE.length?this.clone().iadd(E):E.clone().iadd(this)},s.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var m=this.iadd(E);return E.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var f=this.cmp(E);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,v;f>0?(p=this,v=E):(p=E,v=this);for(var x=0,_=0;_>26,this.words[_]=m&67108863;for(;x!==0&&_>26,this.words[_]=m&67108863;if(x===0&&_>>26,I=S&67108863,F=Math.min(b,E.length-1),ae=Math.max(0,b-G.length+1);ae<=F;ae++){var O=b-ae|0;p=G.words[O]|0,v=E.words[ae]|0,x=p*v+I,M+=x/67108864|0,I=x&67108863}m.words[b]=I|0,S=M|0}return S!==0?m.words[b]=S|0:m.length--,m.strip()}var N=function(E,m,f){var p=E.words,v=m.words,x=f.words,_=0,S,b,M,I=p[0]|0,F=I&8191,ae=I>>>13,O=p[1]|0,se=O&8191,ee=O>>>13,X=p[2]|0,Q=X&8191,R=X>>>13,Z=p[3]|0,te=Z&8191,le=Z>>>13,ie=p[4]|0,fe=ie&8191,ve=ie>>>13,Me=p[5]|0,Ne=Me&8191,Te=Me>>>13,Be=p[6]|0,Ie=Be&8191,Le=Be>>>13,Ve=p[7]|0,ke=Ve&8191,ze=Ve>>>13,He=p[8]|0,Ee=He&8191,Qe=He>>>13,ct=p[9]|0,$e=ct&8191,et=ct>>>13,rt=v[0]|0,Je=rt&8191,pt=rt>>>13,ht=v[1]|0,ft=ht&8191,Ht=ht>>>13,Jt=v[2]|0,St=Jt&8191,er=Jt>>>13,Xt=v[3]|0,Ot=Xt&8191,$t=Xt>>>13,Tt=v[4]|0,vt=Tt&8191,Dt=Tt>>>13,Lt=v[5]|0,bt=Lt&8191,Bt=Lt>>>13,Ut=v[6]|0,nt=Ut&8191,Ft=Ut>>>13,B=v[7]|0,H=B&8191,V=B>>>13,C=v[8]|0,Y=C&8191,j=C>>>13,oe=v[9]|0,pe=oe&8191,xe=oe>>>13;f.negative=E.negative^m.negative,f.length=19,S=Math.imul(F,Je),b=Math.imul(F,pt),b=b+Math.imul(ae,Je)|0,M=Math.imul(ae,pt);var Re=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Re>>>26)|0,Re&=67108863,S=Math.imul(se,Je),b=Math.imul(se,pt),b=b+Math.imul(ee,Je)|0,M=Math.imul(ee,pt),S=S+Math.imul(F,ft)|0,b=b+Math.imul(F,Ht)|0,b=b+Math.imul(ae,ft)|0,M=M+Math.imul(ae,Ht)|0;var De=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(De>>>26)|0,De&=67108863,S=Math.imul(Q,Je),b=Math.imul(Q,pt),b=b+Math.imul(R,Je)|0,M=Math.imul(R,pt),S=S+Math.imul(se,ft)|0,b=b+Math.imul(se,Ht)|0,b=b+Math.imul(ee,ft)|0,M=M+Math.imul(ee,Ht)|0,S=S+Math.imul(F,St)|0,b=b+Math.imul(F,er)|0,b=b+Math.imul(ae,St)|0,M=M+Math.imul(ae,er)|0;var it=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(it>>>26)|0,it&=67108863,S=Math.imul(te,Je),b=Math.imul(te,pt),b=b+Math.imul(le,Je)|0,M=Math.imul(le,pt),S=S+Math.imul(Q,ft)|0,b=b+Math.imul(Q,Ht)|0,b=b+Math.imul(R,ft)|0,M=M+Math.imul(R,Ht)|0,S=S+Math.imul(se,St)|0,b=b+Math.imul(se,er)|0,b=b+Math.imul(ee,St)|0,M=M+Math.imul(ee,er)|0,S=S+Math.imul(F,Ot)|0,b=b+Math.imul(F,$t)|0,b=b+Math.imul(ae,Ot)|0,M=M+Math.imul(ae,$t)|0;var je=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(je>>>26)|0,je&=67108863,S=Math.imul(fe,Je),b=Math.imul(fe,pt),b=b+Math.imul(ve,Je)|0,M=Math.imul(ve,pt),S=S+Math.imul(te,ft)|0,b=b+Math.imul(te,Ht)|0,b=b+Math.imul(le,ft)|0,M=M+Math.imul(le,Ht)|0,S=S+Math.imul(Q,St)|0,b=b+Math.imul(Q,er)|0,b=b+Math.imul(R,St)|0,M=M+Math.imul(R,er)|0,S=S+Math.imul(se,Ot)|0,b=b+Math.imul(se,$t)|0,b=b+Math.imul(ee,Ot)|0,M=M+Math.imul(ee,$t)|0,S=S+Math.imul(F,vt)|0,b=b+Math.imul(F,Dt)|0,b=b+Math.imul(ae,vt)|0,M=M+Math.imul(ae,Dt)|0;var gt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(gt>>>26)|0,gt&=67108863,S=Math.imul(Ne,Je),b=Math.imul(Ne,pt),b=b+Math.imul(Te,Je)|0,M=Math.imul(Te,pt),S=S+Math.imul(fe,ft)|0,b=b+Math.imul(fe,Ht)|0,b=b+Math.imul(ve,ft)|0,M=M+Math.imul(ve,Ht)|0,S=S+Math.imul(te,St)|0,b=b+Math.imul(te,er)|0,b=b+Math.imul(le,St)|0,M=M+Math.imul(le,er)|0,S=S+Math.imul(Q,Ot)|0,b=b+Math.imul(Q,$t)|0,b=b+Math.imul(R,Ot)|0,M=M+Math.imul(R,$t)|0,S=S+Math.imul(se,vt)|0,b=b+Math.imul(se,Dt)|0,b=b+Math.imul(ee,vt)|0,M=M+Math.imul(ee,Dt)|0,S=S+Math.imul(F,bt)|0,b=b+Math.imul(F,Bt)|0,b=b+Math.imul(ae,bt)|0,M=M+Math.imul(ae,Bt)|0;var st=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(st>>>26)|0,st&=67108863,S=Math.imul(Ie,Je),b=Math.imul(Ie,pt),b=b+Math.imul(Le,Je)|0,M=Math.imul(Le,pt),S=S+Math.imul(Ne,ft)|0,b=b+Math.imul(Ne,Ht)|0,b=b+Math.imul(Te,ft)|0,M=M+Math.imul(Te,Ht)|0,S=S+Math.imul(fe,St)|0,b=b+Math.imul(fe,er)|0,b=b+Math.imul(ve,St)|0,M=M+Math.imul(ve,er)|0,S=S+Math.imul(te,Ot)|0,b=b+Math.imul(te,$t)|0,b=b+Math.imul(le,Ot)|0,M=M+Math.imul(le,$t)|0,S=S+Math.imul(Q,vt)|0,b=b+Math.imul(Q,Dt)|0,b=b+Math.imul(R,vt)|0,M=M+Math.imul(R,Dt)|0,S=S+Math.imul(se,bt)|0,b=b+Math.imul(se,Bt)|0,b=b+Math.imul(ee,bt)|0,M=M+Math.imul(ee,Bt)|0,S=S+Math.imul(F,nt)|0,b=b+Math.imul(F,Ft)|0,b=b+Math.imul(ae,nt)|0,M=M+Math.imul(ae,Ft)|0;var tt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(tt>>>26)|0,tt&=67108863,S=Math.imul(ke,Je),b=Math.imul(ke,pt),b=b+Math.imul(ze,Je)|0,M=Math.imul(ze,pt),S=S+Math.imul(Ie,ft)|0,b=b+Math.imul(Ie,Ht)|0,b=b+Math.imul(Le,ft)|0,M=M+Math.imul(Le,Ht)|0,S=S+Math.imul(Ne,St)|0,b=b+Math.imul(Ne,er)|0,b=b+Math.imul(Te,St)|0,M=M+Math.imul(Te,er)|0,S=S+Math.imul(fe,Ot)|0,b=b+Math.imul(fe,$t)|0,b=b+Math.imul(ve,Ot)|0,M=M+Math.imul(ve,$t)|0,S=S+Math.imul(te,vt)|0,b=b+Math.imul(te,Dt)|0,b=b+Math.imul(le,vt)|0,M=M+Math.imul(le,Dt)|0,S=S+Math.imul(Q,bt)|0,b=b+Math.imul(Q,Bt)|0,b=b+Math.imul(R,bt)|0,M=M+Math.imul(R,Bt)|0,S=S+Math.imul(se,nt)|0,b=b+Math.imul(se,Ft)|0,b=b+Math.imul(ee,nt)|0,M=M+Math.imul(ee,Ft)|0,S=S+Math.imul(F,H)|0,b=b+Math.imul(F,V)|0,b=b+Math.imul(ae,H)|0,M=M+Math.imul(ae,V)|0;var At=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(At>>>26)|0,At&=67108863,S=Math.imul(Ee,Je),b=Math.imul(Ee,pt),b=b+Math.imul(Qe,Je)|0,M=Math.imul(Qe,pt),S=S+Math.imul(ke,ft)|0,b=b+Math.imul(ke,Ht)|0,b=b+Math.imul(ze,ft)|0,M=M+Math.imul(ze,Ht)|0,S=S+Math.imul(Ie,St)|0,b=b+Math.imul(Ie,er)|0,b=b+Math.imul(Le,St)|0,M=M+Math.imul(Le,er)|0,S=S+Math.imul(Ne,Ot)|0,b=b+Math.imul(Ne,$t)|0,b=b+Math.imul(Te,Ot)|0,M=M+Math.imul(Te,$t)|0,S=S+Math.imul(fe,vt)|0,b=b+Math.imul(fe,Dt)|0,b=b+Math.imul(ve,vt)|0,M=M+Math.imul(ve,Dt)|0,S=S+Math.imul(te,bt)|0,b=b+Math.imul(te,Bt)|0,b=b+Math.imul(le,bt)|0,M=M+Math.imul(le,Bt)|0,S=S+Math.imul(Q,nt)|0,b=b+Math.imul(Q,Ft)|0,b=b+Math.imul(R,nt)|0,M=M+Math.imul(R,Ft)|0,S=S+Math.imul(se,H)|0,b=b+Math.imul(se,V)|0,b=b+Math.imul(ee,H)|0,M=M+Math.imul(ee,V)|0,S=S+Math.imul(F,Y)|0,b=b+Math.imul(F,j)|0,b=b+Math.imul(ae,Y)|0,M=M+Math.imul(ae,j)|0;var Rt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,S=Math.imul($e,Je),b=Math.imul($e,pt),b=b+Math.imul(et,Je)|0,M=Math.imul(et,pt),S=S+Math.imul(Ee,ft)|0,b=b+Math.imul(Ee,Ht)|0,b=b+Math.imul(Qe,ft)|0,M=M+Math.imul(Qe,Ht)|0,S=S+Math.imul(ke,St)|0,b=b+Math.imul(ke,er)|0,b=b+Math.imul(ze,St)|0,M=M+Math.imul(ze,er)|0,S=S+Math.imul(Ie,Ot)|0,b=b+Math.imul(Ie,$t)|0,b=b+Math.imul(Le,Ot)|0,M=M+Math.imul(Le,$t)|0,S=S+Math.imul(Ne,vt)|0,b=b+Math.imul(Ne,Dt)|0,b=b+Math.imul(Te,vt)|0,M=M+Math.imul(Te,Dt)|0,S=S+Math.imul(fe,bt)|0,b=b+Math.imul(fe,Bt)|0,b=b+Math.imul(ve,bt)|0,M=M+Math.imul(ve,Bt)|0,S=S+Math.imul(te,nt)|0,b=b+Math.imul(te,Ft)|0,b=b+Math.imul(le,nt)|0,M=M+Math.imul(le,Ft)|0,S=S+Math.imul(Q,H)|0,b=b+Math.imul(Q,V)|0,b=b+Math.imul(R,H)|0,M=M+Math.imul(R,V)|0,S=S+Math.imul(se,Y)|0,b=b+Math.imul(se,j)|0,b=b+Math.imul(ee,Y)|0,M=M+Math.imul(ee,j)|0,S=S+Math.imul(F,pe)|0,b=b+Math.imul(F,xe)|0,b=b+Math.imul(ae,pe)|0,M=M+Math.imul(ae,xe)|0;var Mt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,S=Math.imul($e,ft),b=Math.imul($e,Ht),b=b+Math.imul(et,ft)|0,M=Math.imul(et,Ht),S=S+Math.imul(Ee,St)|0,b=b+Math.imul(Ee,er)|0,b=b+Math.imul(Qe,St)|0,M=M+Math.imul(Qe,er)|0,S=S+Math.imul(ke,Ot)|0,b=b+Math.imul(ke,$t)|0,b=b+Math.imul(ze,Ot)|0,M=M+Math.imul(ze,$t)|0,S=S+Math.imul(Ie,vt)|0,b=b+Math.imul(Ie,Dt)|0,b=b+Math.imul(Le,vt)|0,M=M+Math.imul(Le,Dt)|0,S=S+Math.imul(Ne,bt)|0,b=b+Math.imul(Ne,Bt)|0,b=b+Math.imul(Te,bt)|0,M=M+Math.imul(Te,Bt)|0,S=S+Math.imul(fe,nt)|0,b=b+Math.imul(fe,Ft)|0,b=b+Math.imul(ve,nt)|0,M=M+Math.imul(ve,Ft)|0,S=S+Math.imul(te,H)|0,b=b+Math.imul(te,V)|0,b=b+Math.imul(le,H)|0,M=M+Math.imul(le,V)|0,S=S+Math.imul(Q,Y)|0,b=b+Math.imul(Q,j)|0,b=b+Math.imul(R,Y)|0,M=M+Math.imul(R,j)|0,S=S+Math.imul(se,pe)|0,b=b+Math.imul(se,xe)|0,b=b+Math.imul(ee,pe)|0,M=M+Math.imul(ee,xe)|0;var Et=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Et>>>26)|0,Et&=67108863,S=Math.imul($e,St),b=Math.imul($e,er),b=b+Math.imul(et,St)|0,M=Math.imul(et,er),S=S+Math.imul(Ee,Ot)|0,b=b+Math.imul(Ee,$t)|0,b=b+Math.imul(Qe,Ot)|0,M=M+Math.imul(Qe,$t)|0,S=S+Math.imul(ke,vt)|0,b=b+Math.imul(ke,Dt)|0,b=b+Math.imul(ze,vt)|0,M=M+Math.imul(ze,Dt)|0,S=S+Math.imul(Ie,bt)|0,b=b+Math.imul(Ie,Bt)|0,b=b+Math.imul(Le,bt)|0,M=M+Math.imul(Le,Bt)|0,S=S+Math.imul(Ne,nt)|0,b=b+Math.imul(Ne,Ft)|0,b=b+Math.imul(Te,nt)|0,M=M+Math.imul(Te,Ft)|0,S=S+Math.imul(fe,H)|0,b=b+Math.imul(fe,V)|0,b=b+Math.imul(ve,H)|0,M=M+Math.imul(ve,V)|0,S=S+Math.imul(te,Y)|0,b=b+Math.imul(te,j)|0,b=b+Math.imul(le,Y)|0,M=M+Math.imul(le,j)|0,S=S+Math.imul(Q,pe)|0,b=b+Math.imul(Q,xe)|0,b=b+Math.imul(R,pe)|0,M=M+Math.imul(R,xe)|0;var dt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(dt>>>26)|0,dt&=67108863,S=Math.imul($e,Ot),b=Math.imul($e,$t),b=b+Math.imul(et,Ot)|0,M=Math.imul(et,$t),S=S+Math.imul(Ee,vt)|0,b=b+Math.imul(Ee,Dt)|0,b=b+Math.imul(Qe,vt)|0,M=M+Math.imul(Qe,Dt)|0,S=S+Math.imul(ke,bt)|0,b=b+Math.imul(ke,Bt)|0,b=b+Math.imul(ze,bt)|0,M=M+Math.imul(ze,Bt)|0,S=S+Math.imul(Ie,nt)|0,b=b+Math.imul(Ie,Ft)|0,b=b+Math.imul(Le,nt)|0,M=M+Math.imul(Le,Ft)|0,S=S+Math.imul(Ne,H)|0,b=b+Math.imul(Ne,V)|0,b=b+Math.imul(Te,H)|0,M=M+Math.imul(Te,V)|0,S=S+Math.imul(fe,Y)|0,b=b+Math.imul(fe,j)|0,b=b+Math.imul(ve,Y)|0,M=M+Math.imul(ve,j)|0,S=S+Math.imul(te,pe)|0,b=b+Math.imul(te,xe)|0,b=b+Math.imul(le,pe)|0,M=M+Math.imul(le,xe)|0;var _t=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(_t>>>26)|0,_t&=67108863,S=Math.imul($e,vt),b=Math.imul($e,Dt),b=b+Math.imul(et,vt)|0,M=Math.imul(et,Dt),S=S+Math.imul(Ee,bt)|0,b=b+Math.imul(Ee,Bt)|0,b=b+Math.imul(Qe,bt)|0,M=M+Math.imul(Qe,Bt)|0,S=S+Math.imul(ke,nt)|0,b=b+Math.imul(ke,Ft)|0,b=b+Math.imul(ze,nt)|0,M=M+Math.imul(ze,Ft)|0,S=S+Math.imul(Ie,H)|0,b=b+Math.imul(Ie,V)|0,b=b+Math.imul(Le,H)|0,M=M+Math.imul(Le,V)|0,S=S+Math.imul(Ne,Y)|0,b=b+Math.imul(Ne,j)|0,b=b+Math.imul(Te,Y)|0,M=M+Math.imul(Te,j)|0,S=S+Math.imul(fe,pe)|0,b=b+Math.imul(fe,xe)|0,b=b+Math.imul(ve,pe)|0,M=M+Math.imul(ve,xe)|0;var ot=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(ot>>>26)|0,ot&=67108863,S=Math.imul($e,bt),b=Math.imul($e,Bt),b=b+Math.imul(et,bt)|0,M=Math.imul(et,Bt),S=S+Math.imul(Ee,nt)|0,b=b+Math.imul(Ee,Ft)|0,b=b+Math.imul(Qe,nt)|0,M=M+Math.imul(Qe,Ft)|0,S=S+Math.imul(ke,H)|0,b=b+Math.imul(ke,V)|0,b=b+Math.imul(ze,H)|0,M=M+Math.imul(ze,V)|0,S=S+Math.imul(Ie,Y)|0,b=b+Math.imul(Ie,j)|0,b=b+Math.imul(Le,Y)|0,M=M+Math.imul(Le,j)|0,S=S+Math.imul(Ne,pe)|0,b=b+Math.imul(Ne,xe)|0,b=b+Math.imul(Te,pe)|0,M=M+Math.imul(Te,xe)|0;var wt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(wt>>>26)|0,wt&=67108863,S=Math.imul($e,nt),b=Math.imul($e,Ft),b=b+Math.imul(et,nt)|0,M=Math.imul(et,Ft),S=S+Math.imul(Ee,H)|0,b=b+Math.imul(Ee,V)|0,b=b+Math.imul(Qe,H)|0,M=M+Math.imul(Qe,V)|0,S=S+Math.imul(ke,Y)|0,b=b+Math.imul(ke,j)|0,b=b+Math.imul(ze,Y)|0,M=M+Math.imul(ze,j)|0,S=S+Math.imul(Ie,pe)|0,b=b+Math.imul(Ie,xe)|0,b=b+Math.imul(Le,pe)|0,M=M+Math.imul(Le,xe)|0;var lt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul($e,H),b=Math.imul($e,V),b=b+Math.imul(et,H)|0,M=Math.imul(et,V),S=S+Math.imul(Ee,Y)|0,b=b+Math.imul(Ee,j)|0,b=b+Math.imul(Qe,Y)|0,M=M+Math.imul(Qe,j)|0,S=S+Math.imul(ke,pe)|0,b=b+Math.imul(ke,xe)|0,b=b+Math.imul(ze,pe)|0,M=M+Math.imul(ze,xe)|0;var at=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(at>>>26)|0,at&=67108863,S=Math.imul($e,Y),b=Math.imul($e,j),b=b+Math.imul(et,Y)|0,M=Math.imul(et,j),S=S+Math.imul(Ee,pe)|0,b=b+Math.imul(Ee,xe)|0,b=b+Math.imul(Qe,pe)|0,M=M+Math.imul(Qe,xe)|0;var Se=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Se>>>26)|0,Se&=67108863,S=Math.imul($e,pe),b=Math.imul($e,xe),b=b+Math.imul(et,pe)|0,M=Math.imul(et,xe);var Ae=(_+S|0)+((b&8191)<<13)|0;return _=(M+(b>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,x[0]=Re,x[1]=De,x[2]=it,x[3]=je,x[4]=gt,x[5]=st,x[6]=tt,x[7]=At,x[8]=Rt,x[9]=Mt,x[10]=Et,x[11]=dt,x[12]=_t,x[13]=ot,x[14]=wt,x[15]=lt,x[16]=at,x[17]=Se,x[18]=Ae,_!==0&&(x[19]=_,f.length++),f};Math.imul||(N=P);function D(G,E,m){m.negative=E.negative^G.negative,m.length=G.length+E.length;for(var f=0,p=0,v=0;v>>26)|0,p+=x>>>26,x&=67108863}m.words[v]=_,f=x,x=p}return f!==0?m.words[v]=f:m.length--,m.strip()}function k(G,E,m){var f=new $;return f.mulp(G,E,m)}s.prototype.mulTo=function(E,m){var f,p=this.length+E.length;return this.length===10&&E.length===10?f=N(this,E,m):p<63?f=P(this,E,m):p<1024?f=D(this,E,m):f=k(this,E,m),f};function $(G,E){this.x=G,this.y=E}$.prototype.makeRBT=function(E){for(var m=new Array(E),f=s.prototype._countBits(E)-1,p=0;p>=1;return p},$.prototype.permute=function(E,m,f,p,v,x){for(var _=0;_>>1)v++;return 1<>>13,f[2*x+1]=v&8191,v=v>>>13;for(x=2*m;x>=26,m+=p/67108864|0,m+=v>>>26,this.words[f]=v&67108863}return m!==0&&(this.words[f]=m,this.length++),this},s.prototype.muln=function(E){return this.clone().imuln(E)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(E){var m=A(E);if(m.length===0)return new s(1);for(var f=this,p=0;p=0);var m=E%26,f=(E-m)/26,p=67108863>>>26-m<<26-m,v;if(m!==0){var x=0;for(v=0;v>>26-m}x&&(this.words[v]=x,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var p;m?p=(m-m%26)/26:p=0;var v=E%26,x=Math.min((E-v)/26,this.length),_=67108863^67108863>>>v<x)for(this.length-=x,b=0;b=0&&(M!==0||b>=p);b--){var I=this.words[b]|0;this.words[b]=M<<26-v|I>>>v,M=I&_}return S&&M!==0&&(S.words[S.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(E,m,f){return n(this.negative===0),this.iushrn(E,m,f)},s.prototype.shln=function(E){return this.clone().ishln(E)},s.prototype.ushln=function(E){return this.clone().iushln(E)},s.prototype.shrn=function(E){return this.clone().ishrn(E)},s.prototype.ushrn=function(E){return this.clone().iushrn(E)},s.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var m=E%26,f=(E-m)/26,p=1<=0);var m=E%26,f=(E-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(m!==0&&f++,this.length=Math.min(f,this.length),m!==0){var p=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(S/67108864|0),this.words[v+f]=x&67108863}for(;v>26,this.words[v+f]=x&67108863;if(_===0)return this.strip();for(n(_===-1),_=0,v=0;v>26,this.words[v]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(E,m){var f=this.length-E.length,p=this.clone(),v=E,x=v.words[v.length-1]|0,_=this._countBits(x);f=26-_,f!==0&&(v=v.ushln(f),p.iushln(f),x=v.words[v.length-1]|0);var S=p.length-v.length,b;if(m!=="mod"){b=new s(null),b.length=S+1,b.words=new Array(b.length);for(var M=0;M=0;F--){var ae=(p.words[v.length+F]|0)*67108864+(p.words[v.length+F-1]|0);for(ae=Math.min(ae/x|0,67108863),p._ishlnsubmul(v,ae,F);p.negative!==0;)ae--,p.negative=0,p._ishlnsubmul(v,1,F),p.isZero()||(p.negative^=1);b&&(b.words[F]=ae)}return b&&b.strip(),p.strip(),m!=="div"&&f!==0&&p.iushrn(f),{div:b||null,mod:p}},s.prototype.divmod=function(E,m,f){if(n(!E.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var p,v,x;return this.negative!==0&&E.negative===0?(x=this.neg().divmod(E,m),m!=="mod"&&(p=x.div.neg()),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.iadd(E)),{div:p,mod:v}):this.negative===0&&E.negative!==0?(x=this.divmod(E.neg(),m),m!=="mod"&&(p=x.div.neg()),{div:p,mod:x.mod}):this.negative&E.negative?(x=this.neg().divmod(E.neg(),m),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.isub(E)),{div:x.div,mod:v}):E.length>this.length||this.cmp(E)<0?{div:new s(0),mod:this}:E.length===1?m==="div"?{div:this.divn(E.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new s(this.modn(E.words[0]))}:this._wordDiv(E,m)},s.prototype.div=function(E){return this.divmod(E,"div",!1).div},s.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},s.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},s.prototype.divRound=function(E){var m=this.divmod(E);if(m.mod.isZero())return m.div;var f=m.div.negative!==0?m.mod.isub(E):m.mod,p=E.ushrn(1),v=E.andln(1),x=f.cmp(p);return x<0||v===1&&x===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(E){n(E<=67108863);for(var m=(1<<26)%E,f=0,p=this.length-1;p>=0;p--)f=(m*f+(this.words[p]|0))%E;return f},s.prototype.idivn=function(E){n(E<=67108863);for(var m=0,f=this.length-1;f>=0;f--){var p=(this.words[f]|0)+m*67108864;this.words[f]=p/E|0,m=p%E}return this.strip()},s.prototype.divn=function(E){return this.clone().idivn(E)},s.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var p=new s(1),v=new s(0),x=new s(0),_=new s(1),S=0;m.isEven()&&f.isEven();)m.iushrn(1),f.iushrn(1),++S;for(var b=f.clone(),M=m.clone();!m.isZero();){for(var I=0,F=1;!(m.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(m.iushrn(I);I-- >0;)(p.isOdd()||v.isOdd())&&(p.iadd(b),v.isub(M)),p.iushrn(1),v.iushrn(1);for(var ae=0,O=1;!(f.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(f.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(b),_.isub(M)),x.iushrn(1),_.iushrn(1);m.cmp(f)>=0?(m.isub(f),p.isub(x),v.isub(_)):(f.isub(m),x.isub(p),_.isub(v))}return{a:x,b:_,gcd:f.iushln(S)}},s.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var p=new s(1),v=new s(0),x=f.clone();m.cmpn(1)>0&&f.cmpn(1)>0;){for(var _=0,S=1;!(m.words[0]&S)&&_<26;++_,S<<=1);if(_>0)for(m.iushrn(_);_-- >0;)p.isOdd()&&p.iadd(x),p.iushrn(1);for(var b=0,M=1;!(f.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(f.iushrn(b);b-- >0;)v.isOdd()&&v.iadd(x),v.iushrn(1);m.cmp(f)>=0?(m.isub(f),p.isub(v)):(f.isub(m),v.isub(p))}var I;return m.cmpn(1)===0?I=p:I=v,I.cmpn(0)<0&&I.iadd(E),I},s.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var m=this.clone(),f=E.clone();m.negative=0,f.negative=0;for(var p=0;m.isEven()&&f.isEven();p++)m.iushrn(1),f.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=m.cmp(f);if(v<0){var x=m;m=f,f=x}else if(v===0||f.cmpn(1)===0)break;m.isub(f)}while(!0);return f.iushln(p)},s.prototype.invm=function(E){return this.egcd(E).a.umod(E)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(E){return this.words[0]&E},s.prototype.bincn=function(E){n(typeof E=="number");var m=E%26,f=(E-m)/26,p=1<>>26,_&=67108863,this.words[x]=_}return v!==0&&(this.words[x]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(E){var m=E<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var f;if(this.length>1)f=1;else{m&&(E=-E),n(E<=67108863,"Number is too big");var p=this.words[0]|0;f=p===E?0:pE.length)return 1;if(this.length=0;f--){var p=this.words[f]|0,v=E.words[f]|0;if(p!==v){pv&&(m=1);break}}return m},s.prototype.gtn=function(E){return this.cmpn(E)===1},s.prototype.gt=function(E){return this.cmp(E)===1},s.prototype.gten=function(E){return this.cmpn(E)>=0},s.prototype.gte=function(E){return this.cmp(E)>=0},s.prototype.ltn=function(E){return this.cmpn(E)===-1},s.prototype.lt=function(E){return this.cmp(E)===-1},s.prototype.lten=function(E){return this.cmpn(E)<=0},s.prototype.lte=function(E){return this.cmp(E)<=0},s.prototype.eqn=function(E){return this.cmpn(E)===0},s.prototype.eq=function(E){return this.cmp(E)===0},s.red=function(E){return new ue(E)},s.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(E){return this.red=E,this},s.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},s.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},s.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},s.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},s.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},s.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},s.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},s.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var q={k256:null,p224:null,p192:null,p25519:null};function U(G,E){this.name=G,this.p=new s(E,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var E=new s(null);return E.words=new Array(Math.ceil(this.n/13)),E},U.prototype.ireduce=function(E){var m=E,f;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),f=m.bitLength();while(f>this.n);var p=f0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},U.prototype.split=function(E,m){E.iushrn(this.n,0,m)},U.prototype.imulK=function(E){return E.imul(this.k)};function K(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(K,U),K.prototype.split=function(E,m){for(var f=4194303,p=Math.min(E.length,9),v=0;v>>22,x=_}x>>>=22,E.words[v-10]=x,x===0&&E.length>10?E.length-=10:E.length-=9},K.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var m=0,f=0;f>>=26,E.words[f]=v,m=p}return m!==0&&(E.words[E.length++]=m),E},s._prime=function(E){if(q[E])return q[E];var m;if(E==="k256")m=new K;else if(E==="p224")m=new J;else if(E==="p192")m=new T;else if(E==="p25519")m=new z;else throw new Error("Unknown prime "+E);return q[E]=m,m};function ue(G){if(typeof G=="string"){var E=s._prime(G);this.m=E.p,this.prime=E}else n(G.gtn(1),"modulus must be greater than 1"),this.m=G,this.prime=null}ue.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},ue.prototype._verify2=function(E,m){n((E.negative|m.negative)===0,"red works only with positives"),n(E.red&&E.red===m.red,"red works only with red numbers")},ue.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},ue.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},ue.prototype.add=function(E,m){this._verify2(E,m);var f=E.add(m);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},ue.prototype.iadd=function(E,m){this._verify2(E,m);var f=E.iadd(m);return f.cmp(this.m)>=0&&f.isub(this.m),f},ue.prototype.sub=function(E,m){this._verify2(E,m);var f=E.sub(m);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},ue.prototype.isub=function(E,m){this._verify2(E,m);var f=E.isub(m);return f.cmpn(0)<0&&f.iadd(this.m),f},ue.prototype.shl=function(E,m){return this._verify1(E),this.imod(E.ushln(m))},ue.prototype.imul=function(E,m){return this._verify2(E,m),this.imod(E.imul(m))},ue.prototype.mul=function(E,m){return this._verify2(E,m),this.imod(E.mul(m))},ue.prototype.isqr=function(E){return this.imul(E,E.clone())},ue.prototype.sqr=function(E){return this.mul(E,E)},ue.prototype.sqrt=function(E){if(E.isZero())return E.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(E,f)}for(var p=this.m.subn(1),v=0;!p.isZero()&&p.andln(1)===0;)v++,p.iushrn(1);n(!p.isZero());var x=new s(1).toRed(this),_=x.redNeg(),S=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new s(2*b*b).toRed(this);this.pow(b,S).cmp(_)!==0;)b.redIAdd(_);for(var M=this.pow(b,p),I=this.pow(E,p.addn(1).iushrn(1)),F=this.pow(E,p),ae=v;F.cmp(x)!==0;){for(var O=F,se=0;O.cmp(x)!==0;se++)O=O.redSqr();n(se=0;v--){for(var M=m.words[v],I=b-1;I>=0;I--){var F=M>>I&1;if(x!==p[0]&&(x=this.sqr(x)),F===0&&_===0){S=0;continue}_<<=1,_|=F,S++,!(S!==f&&(v!==0||I!==0))&&(x=this.mul(x,p[_]),S=0,_=0)}b=26}return x},ue.prototype.convertTo=function(E){var m=E.umod(this.m);return m===E?m.clone():m},ue.prototype.convertFrom=function(E){var m=E.clone();return m.red=null,m},s.mont=function(E){return new _e(E)};function _e(G){ue.call(this,G),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(_e,ue),_e.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},_e.prototype.convertFrom=function(E){var m=this.imod(E.mul(this.rinv));return m.red=null,m},_e.prototype.imul=function(E,m){if(E.isZero()||m.isZero())return E.words[0]=0,E.length=1,E;var f=E.imul(m),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.mul=function(E,m){if(E.isZero()||m.isZero())return new s(0)._forceRed(this);var f=E.mul(m),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.invm=function(E){var m=this.imod(E._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,nn)}(Wm);var wo=Wm.exports,Km={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var u=0;u>8,g=l&255;d?a.push(d,g):a.push(g)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(N>>1)-1?k=(N>>1)-$:k=$,D.isubn(k)):k=0,A[P]=k,D.iushrn(1)}return A}e.getNAF=s;function o(d,g){var y=[[],[]];d=d.clone(),g=g.clone();for(var A=0,P=0,N;d.cmpn(-A)>0||g.cmpn(-P)>0;){var D=d.andln(3)+A&3,k=g.andln(3)+P&3;D===3&&(D=-1),k===3&&(k=-1);var $;D&1?(N=d.andln(7)+A&7,(N===3||N===5)&&k===2?$=-D:$=D):$=0,y[0].push($);var q;k&1?(N=g.andln(7)+P&7,(N===3||N===5)&&D===2?q=-k:q=k):q=0,y[1].push(q),2*A===$+1&&(A=1-A),2*P===q+1&&(P=1-P),d.iushrn(1),g.iushrn(1)}return y}e.getJSF=o;function a(d,g,y){var A="_"+g;d.prototype[g]=function(){return this[A]!==void 0?this[A]:this[A]=y.call(this)}}e.cachedProperty=a;function u(d){return typeof d=="string"?e.toArray(d,"hex"):d}e.parseBytes=u;function l(d){return new r(d,"hex","le")}e.intFromLE=l}(Ti);var Vm={exports:{}},Gm;Vm.exports=function(e){return Gm||(Gm=new oa(null)),Gm.generate(e)};function oa(t){this.rand=t}if(Vm.exports.Rand=oa,oa.prototype.generate=function(e){return this._rand(e)},oa.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Td=aa;aa.prototype.point=function(){throw new Error("Not implemented")},aa.prototype.validate=function(){throw new Error("Not implemented")},aa.prototype._fixedNafMul=function(e,r){Cd(e.precomputed);var n=e._getDoubles(),i=Id(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),g=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Cd(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},aa.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,g,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=Id(n[P],o[P],this._bitLength),u[N]=Id(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],$=Ek(n[P],n[N]);for(l=Math.max($[0].length,l),u[P]=new Array(l),u[N]=new Array(l),g=0;g=0;d--){for(var T=0;d>=0;){var z=!0;for(g=0;g=0&&T++,K=K.dblp(T),d<0)break;for(g=0;g0?y=a[g][ue-1>>1]:ue<0&&(y=a[g][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Ki.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),g.negative&&(g=g.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:g,b:y},{a:A,b:P}]},Vi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),g=e.sub(a).sub(u),y=l.add(d).neg();return{k1:g,k2:y}},Vi.prototype.pointFromX=function(e,r){e=new en(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Vi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Vi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},On.prototype.isInfinity=function(){return this.inf},On.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},On.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},On.prototype.getX=function(){return this.x.fromRed()},On.prototype.getY=function(){return this.y.fromRed()},On.prototype.mul=function(e){return e=new en(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},On.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},On.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},On.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},On.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},On.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function jn(t,e,r,n){vu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new en(0)):(this.x=new en(e,16),this.y=new en(r,16),this.z=new en(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Jm(jn,vu.BasePoint),Vi.prototype.jpoint=function(e,r,n){return new jn(this,e,r,n)},jn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},jn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},jn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),g=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(g).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(g)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},jn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),g=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(g).redISub(g),A=u.redMul(g.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},jn.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},jn.prototype.inspect=function(){return this.isInfinity()?"":""},jn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var bu=wo,I3=bd,Rd=Td,Mk=Ti;function yu(t){Rd.call(this,"mont",t),this.a=new bu(t.a,16).toRed(this.red),this.b=new bu(t.b,16).toRed(this.red),this.i4=new bu(4).toRed(this.red).redInvm(),this.two=new bu(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}I3(yu,Rd);var Ik=yu;yu.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function Nn(t,e,r){Rd.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new bu(e,16),this.z=new bu(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}I3(Nn,Rd.BasePoint),yu.prototype.decodePoint=function(e,r){return this.point(Mk.toArray(e,r),1)},yu.prototype.point=function(e,r){return new Nn(this,e,r)},yu.prototype.pointFromJSON=function(e){return Nn.fromJSON(this,e)},Nn.prototype.precompute=function(){},Nn.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Nn.fromJSON=function(e,r){return new Nn(e,r[0],r[1]||e.one)},Nn.prototype.inspect=function(){return this.isInfinity()?"":""},Nn.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Nn.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)},Nn.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),u=s.redMul(i),l=r.z.redMul(a.redAdd(u).redSqr()),d=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(l,d)},Nn.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i},Nn.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Nn.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Nn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var Ck=Ti,xo=wo,C3=bd,Dd=Td,Tk=Ck.assert;function qs(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Dd.call(this,"edwards",t),this.a=new xo(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new xo(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new xo(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Tk(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}C3(qs,Dd);var Rk=qs;qs.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},qs.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},qs.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)},qs.prototype.pointFromX=function(e,r){e=new xo(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var u=a.fromRed().isOdd();return(r&&!u||!r&&u)&&(a=a.redNeg()),this.point(e,a)},qs.prototype.pointFromY=function(e,r){e=new xo(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)},qs.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function Hr(t,e,r,n,i){Dd.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new xo(e,16),this.y=new xo(r,16),this.z=n?new xo(n,16):this.curve.one,this.t=i&&new xo(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}C3(Hr,Dd.BasePoint),qs.prototype.pointFromJSON=function(e){return Hr.fromJSON(this,e)},qs.prototype.point=function(e,r,n,i){return new Hr(this,e,r,n,i)},Hr.fromJSON=function(e,r){return new Hr(e,r[0],r[1],r[2])},Hr.prototype.inspect=function(){return this.isInfinity()?"":""},Hr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Hr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),u=i.redSub(r),l=s.redMul(a),d=o.redMul(u),g=s.redMul(u),y=a.redMul(o);return this.curve.point(l,d,y,g)},Hr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,u,l;if(this.curve.twisted){a=this.curve._mulA(r);var d=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(d.redSub(this.curve.two)),s=d.redMul(a.redSub(n)),o=d.redSqr().redSub(d).redSub(d)):(u=this.z.redSqr(),l=d.redSub(u).redISub(u),i=e.redSub(r).redISub(n).redMul(l),s=d.redMul(a.redSub(n)),o=d.redMul(l))}else a=r.redAdd(n),u=this.curve._mulC(this.z).redSqr(),l=a.redSub(u).redSub(u),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)},Hr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Hr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),u=s.redAdd(i),l=n.redAdd(r),d=o.redMul(a),g=u.redMul(l),y=o.redMul(l),A=a.redMul(u);return this.curve.point(d,g,A,y)},Hr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),u=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),d=r.redMul(a).redMul(l),g,y;return this.curve.twisted?(g=r.redMul(u).redMul(s.redSub(this.curve._mulA(i))),y=a.redMul(u)):(g=r.redMul(u).redMul(s.redSub(i)),y=this.curve._mulC(a).redMul(u)),this.curve.point(d,g,y)},Hr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Hr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Hr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)},Hr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)},Hr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Hr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Hr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Hr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Hr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Hr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Hr.prototype.toP=Hr.prototype.normalize,Hr.prototype.mixedAdd=Hr.prototype.add,function(t){var e=t;e.base=Td,e.short=Pk,e.mont=Ik,e.edwards=Rk}(Ym);var Od={},Xm,T3;function Dk(){return T3||(T3=1,Xm={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Xm}(function(t){var e=t,r=ol,n=Ym,i=Ti,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,d){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var g=new o(d);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:g}),g}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=Dk()}catch{u=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})})(Od);var Ok=ol,Xa=Km,R3=Va;function ca(t){if(!(this instanceof ca))return new ca(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Xa.toArray(t.entropy,t.entropyEnc||"hex"),r=Xa.toArray(t.nonce,t.nonceEnc||"hex"),n=Xa.toArray(t.pers,t.persEnc||"hex");R3(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Nk=ca;ca.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ca.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Xa.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var Nd=wo,Qm=Ti,Bk=Qm.assert;function Ld(t,e){if(t instanceof Ld)return t;this._importDER(t,e)||(Bk(t.r&&t.s,"Signature without r or s"),this.r=new Nd(t.r,16),this.s=new Nd(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Fk=Ld;function Uk(){this.place=0}function e1(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function D3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Ld.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=D3(r),n=D3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];t1(i,r.length),i=i.concat(r),i.push(2),t1(i,n.length);var s=i.concat(n),o=[48];return t1(o,s.length),o=o.concat(s),Qm.encode(o,e)};var _o=wo,O3=Nk,jk=Ti,r1=Od,qk=M3,N3=jk.assert,n1=$k,kd=Fk;function Gi(t){if(!(this instanceof Gi))return new Gi(t);typeof t=="string"&&(N3(Object.prototype.hasOwnProperty.call(r1,t),"Unknown curve "+t),t=r1[t]),t instanceof r1.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var zk=Gi;Gi.prototype.keyPair=function(e){return new n1(this,e)},Gi.prototype.keyFromPrivate=function(e,r){return n1.fromPrivate(this,e,r)},Gi.prototype.keyFromPublic=function(e,r){return n1.fromPublic(this,e,r)},Gi.prototype.genKeyPair=function(e){e||(e={});for(var r=new O3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||qk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new _o(2));;){var s=new _o(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Gi.prototype._truncateToN=function(e,r,n){var i;if(_o.isBN(e)||typeof e=="number")e=new _o(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new _o(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new _o(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Gi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new O3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new _o(1)),d=0;;d++){var g=i.k?i.k(d):new _o(u.generate(this.n.byteLength()));if(g=this._truncateToN(g,!0),!(g.cmpn(1)<=0||g.cmp(l)>=0)){var y=this.g.mul(g);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=g.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new kd({r:P,s:N,recoveryParam:D})}}}}}},Gi.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new kd(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),l=u.mul(e).umod(this.n),d=u.mul(o).umod(this.n),g;return this.curve._maxwellTrick?(g=this.g.jmulAdd(l,n.getPublic(),d),g.isInfinity()?!1:g.eqXToP(o)):(g=this.g.mulAdd(l,n.getPublic(),d),g.isInfinity()?!1:g.getX().umod(this.n).cmp(o)===0)},Gi.prototype.recoverPubKey=function(t,e,r,n){N3((3&r)===r,"The recovery param is more than two bits"),e=new kd(e,n);var i=this.n,s=new _o(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),g=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(g,o,y)},Gi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new kd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var hl=Ti,L3=hl.assert,k3=hl.parseBytes,wu=hl.cachedProperty;function Ln(t,e){this.eddsa=t,this._secret=k3(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=k3(e.pub)}Ln.fromPublic=function(e,r){return r instanceof Ln?r:new Ln(e,{pub:r})},Ln.fromSecret=function(e,r){return r instanceof Ln?r:new Ln(e,{secret:r})},Ln.prototype.secret=function(){return this._secret},wu(Ln,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),wu(Ln,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),wu(Ln,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i}),wu(Ln,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),wu(Ln,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),wu(Ln,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Ln.prototype.sign=function(e){return L3(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Ln.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},Ln.prototype.getSecret=function(e){return L3(this._secret,"KeyPair is public only"),hl.encode(this.secret(),e)},Ln.prototype.getPublic=function(e){return hl.encode(this.pubBytes(),e)};var Hk=Ln,Wk=wo,$d=Ti,$3=$d.assert,Bd=$d.cachedProperty,Kk=$d.parseBytes;function Za(t,e){this.eddsa=t,typeof e!="object"&&(e=Kk(e)),Array.isArray(e)&&($3(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),$3(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof Wk&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Bd(Za,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Bd(Za,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Bd(Za,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Bd(Za,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Za.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Za.prototype.toHex=function(){return $d.encode(this.toBytes(),"hex").toUpperCase()};var Vk=Za,Gk=ol,Yk=Od,xu=Ti,Jk=xu.assert,B3=xu.parseBytes,F3=Hk,U3=Vk;function vi(t){if(Jk(t==="ed25519","only tested with ed25519 so far"),!(this instanceof vi))return new vi(t);t=Yk[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=Gk.sha512}var Xk=vi;vi.prototype.sign=function(e,r){e=B3(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),u=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:u,Rencoded:o})},vi.prototype.verify=function(e,r,n){if(e=B3(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)},vi.prototype.hashInt=function(){for(var e=this.hash(),r=0;re in t?e$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,H3=(t,e)=>{for(var r in e||(e={}))t$.call(e,r)&&z3(t,r,e[r]);if(q3)for(var r of q3(e))r$.call(e,r)&&z3(t,r,e[r]);return t};const n$="ReactNative",Ri={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},i$="js";function Fd(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Eu(){return!rl()&&!!mm()&&navigator.product===n$}function dl(){return!Fd()&&!!mm()&&!!rl()}function pl(){return Eu()?Ri.reactNative:Fd()?Ri.node:dl()?Ri.browser:Ri.unknown}function s$(){var t;try{return Eu()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function o$(t,e){let r=nl.parse(t);return r=H3(H3({},r),e),t=nl.stringify(r),t}function W3(){return Ax()||{name:"",description:"",url:"",icons:[""]}}function a$(){if(pl()===Ri.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=OO();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function c$(){var t;const e=pl();return e===Ri.browser?[e,((t=Sx())==null?void 0:t.host)||"unknown"].join(":"):e}function K3(t,e,r){const n=a$(),i=c$();return[[t,e].join("-"),[i$,r].join("-"),n,i].join("/")}function u$({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const u=r.split("?"),l=K3(t,e,n),d={auth:i,ua:l,projectId:s,useOnCloseEvent:o,origin:a||void 0},g=o$(u[1]||"",d);return u[0]+"?"+g}function Qa(t,e){return t.filter(r=>e.includes(r)).length===t.length}function V3(t){return Object.fromEntries(t.entries())}function G3(t){return new Map(Object.entries(t))}function ec(t=mt.FIVE_MINUTES,e){const r=mt.toMiliseconds(t||mt.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Su(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function Y3(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function f$(t){return Y3("topic",t)}function l$(t){return Y3("id",t)}function J3(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function En(t,e){return mt.fromMiliseconds(Date.now()+mt.toMiliseconds(t))}function ua(t){return Date.now()>=mt.toMiliseconds(t)}function vr(t,e){return`${t}${e?`:${e}`:""}`}function Ud(t=[],e=[]){return[...new Set([...t,...e])]}async function h$({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=d$(s,t,e),a=pl();if(a===Ri.browser){if(!((n=rl())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,g$()?"_blank":"_self","noreferrer noopener")}else a===Ri.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function d$(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${m$(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function p$(t,e){let r="";try{if(dl()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function X3(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function Z3(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function i1(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function g$(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function m$(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function Q3(t){return Buffer.from(t,"base64").toString("utf-8")}const v$="https://rpc.walletconnect.org/v1";async function b$(t,e,r,n,i,s){switch(r.t){case"eip191":return y$(t,e,r.s);case"eip1271":return await w$(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function y$(t,e,r){return ck(jx(e),r).toLowerCase()===t.toLowerCase()}async function w$(t,e,r,n,i,s){const o=_u(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",d=r.substring(2),g=jx(e).substring(2),y=a+g+u+l+d,A=await fetch(`${s||v$}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:x$(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:y},"latest"]})}),{result:P}=await A.json();return P?P.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function x$(){return Date.now()+Math.floor(Math.random()*1e3)}var _$=Object.defineProperty,E$=Object.defineProperties,S$=Object.getOwnPropertyDescriptors,e_=Object.getOwnPropertySymbols,A$=Object.prototype.hasOwnProperty,P$=Object.prototype.propertyIsEnumerable,t_=(t,e,r)=>e in t?_$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,M$=(t,e)=>{for(var r in e||(e={}))A$.call(e,r)&&t_(t,r,e[r]);if(e_)for(var r of e_(e))P$.call(e,r)&&t_(t,r,e[r]);return t},I$=(t,e)=>E$(t,S$(e));const C$="did:pkh:",s1=t=>t==null?void 0:t.split(":"),T$=t=>{const e=t&&s1(t);if(e)return t.includes(C$)?e[3]:e[1]},o1=t=>{const e=t&&s1(t);if(e)return e[2]+":"+e[3]},jd=t=>{const e=t&&s1(t);if(e)return e.pop()};async function r_(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=n_(i,i.iss),o=jd(i.iss);return await b$(o,s,n,o1(i.iss),r)}const n_=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=jd(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${T$(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,d=t.exp?`Expiration Time: ${t.exp}`:void 0,g=t.nbf?`Not Before: ${t.nbf}`:void 0,y=t.requestId?`Request ID: ${t.requestId}`:void 0,A=t.resources?`Resources:${t.resources.map(N=>` - ${N}`).join("")}`:void 0,P=qd(t.resources);if(P){const N=gl(P);i=F$(i,N)}return[r,n,"",i,"",s,o,a,u,l,d,g,y,A].filter(N=>N!=null).join(` -`)};function R$(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function D$(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function tc(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function O$(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:N$(e,r,n)}}}function N$(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function i_(t){return tc(t),`urn:recap:${R$(t).replace(/=/g,"")}`}function gl(t){const e=D$(t.replace("urn:recap:",""));return tc(e),e}function L$(t,e,r){const n=O$(t,e,r);return i_(n)}function k$(t){return t&&t.includes("urn:recap:")}function $$(t,e){const r=gl(t),n=gl(e),i=B$(r,n);return i_(i)}function B$(t,e){tc(t),tc(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,u)=>a.localeCompare(u)).forEach(a=>{var u,l;n.att[i]=I$(M$({},n.att[i]),{[a]:((u=t.att[i])==null?void 0:u[a])||((l=e.att[i])==null?void 0:l[a])})})}),n}function F$(t="",e){tc(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const u=Object.keys(e.att[a]).map(g=>({ability:g.split("/")[0],action:g.split("/")[1]}));u.sort((g,y)=>g.action.localeCompare(y.action));const l={};u.forEach(g=>{l[g.ability]||(l[g.ability]=[]),l[g.ability].push(g.action)});const d=Object.keys(l).map(g=>(i++,`(${i}) '${g}': '${l[g].join("', '")}' for '${a}'.`));n.push(d.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function s_(t){var e;const r=gl(t);tc(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function o_(t){const e=gl(t);tc(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function qd(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return k$(e)?e:void 0}const a_="base10",ni="base16",fa="base64pad",ml="base64url",vl="utf8",c_=0,Eo=1,bl=2,U$=0,u_=1,yl=12,o1=32;function j$(){const t=zm.generateKeyPair();return{privateKey:Tn(t.secretKey,ni),publicKey:Tn(t.publicKey,ni)}}function a1(){const t=ea.randomBytes(o1);return Tn(t,ni)}function q$(t,e){const r=zm.sharedKey(Rn(t,ni),Rn(e,ni),!0),n=new xk(fl.SHA256,r).expand(o1);return Tn(n,ni)}function zd(t){const e=fl.hash(Rn(t,ni));return Tn(e,ni)}function So(t){const e=fl.hash(Rn(t,vl));return Tn(e,ni)}function f_(t){return Rn(`${t}`,a_)}function rc(t){return Number(Tn(t,a_))}function z$(t){const e=f_(typeof t.type<"u"?t.type:c_);if(rc(e)===Eo&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Rn(t.senderPublicKey,ni):void 0,n=typeof t.iv<"u"?Rn(t.iv,ni):ea.randomBytes(yl),i=new Um.ChaCha20Poly1305(Rn(t.symKey,ni)).seal(n,Rn(t.message,vl));return l_({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function H$(t,e){const r=f_(bl),n=ea.randomBytes(yl),i=Rn(t,vl);return l_({type:r,sealed:i,iv:n,encoding:e})}function W$(t){const e=new Um.ChaCha20Poly1305(Rn(t.symKey,ni)),{sealed:r,iv:n}=wl({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Tn(i,vl)}function K$(t,e){const{sealed:r}=wl({encoded:t,encoding:e});return Tn(r,vl)}function l_(t){const{encoding:e=fa}=t;if(rc(t.type)===bl)return Tn(dd([t.type,t.sealed]),e);if(rc(t.type)===Eo){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Tn(dd([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return Tn(dd([t.type,t.iv,t.sealed]),e)}function wl(t){const{encoded:e,encoding:r=fa}=t,n=Rn(e,r),i=n.slice(U$,u_),s=u_;if(rc(i)===Eo){const l=s+o1,d=l+yl,g=n.slice(s,l),y=n.slice(l,d),A=n.slice(d);return{type:i,sealed:A,iv:y,senderPublicKey:g}}if(rc(i)===bl){const l=n.slice(s),d=ea.randomBytes(yl);return{type:i,sealed:l,iv:d}}const o=s+yl,a=n.slice(s,o),u=n.slice(o);return{type:i,sealed:u,iv:a}}function V$(t,e){const r=wl({encoded:t,encoding:e==null?void 0:e.encoding});return h_({type:rc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Tn(r.senderPublicKey,ni):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function h_(t){const e=(t==null?void 0:t.type)||c_;if(e===Eo){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function d_(t){return t.type===Eo&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function p_(t){return t.type===bl}function G$(t){return new A3.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function Y$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function J$(t){return Buffer.from(Y$(t),"base64")}function X$(t,e){const[r,n,i]=t.split("."),s=J$(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),u=`${r}.${n}`,l=new fl.SHA256().update(Buffer.from(u)).digest(),d=G$(e),g=Buffer.from(l).toString("hex");if(!d.verify(g,{r:o,s:a}))throw new Error("Invalid signature");return pm(t).payload}const Z$="irn";function c1(t){return(t==null?void 0:t.relay)||{protocol:Z$}}function xl(t){const e=Zk[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var Q$=Object.defineProperty,eB=Object.defineProperties,tB=Object.getOwnPropertyDescriptors,g_=Object.getOwnPropertySymbols,rB=Object.prototype.hasOwnProperty,nB=Object.prototype.propertyIsEnumerable,m_=(t,e,r)=>e in t?Q$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v_=(t,e)=>{for(var r in e||(e={}))rB.call(e,r)&&m_(t,r,e[r]);if(g_)for(var r of g_(e))nB.call(e,r)&&m_(t,r,e[r]);return t},iB=(t,e)=>eB(t,tB(e));function sB(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function b_(t){if(!t.includes("wc:")){const u=Q3(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=nl.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:oB(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:sB(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function oB(t){return t.startsWith("//")?t.substring(2):t}function aB(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function y_(t){return`${t.protocol}:${t.topic}@${t.version}?`+nl.stringify(v_(iB(v_({symKey:t.symKey},aB(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Hd(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Au(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function cB(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Au(r.accounts))}),e}function uB(t,e){const r=[];return Object.values(t).forEach(n=>{Au(n.accounts).includes(e)&&r.push(...n.methods)}),r}function fB(t,e){const r=[];return Object.values(t).forEach(n=>{Au(n.accounts).includes(e)&&r.push(...n.events)}),r}function u1(t){return t.includes(":")}function _l(t){return u1(t)?t.split(":")[0]:t}function lB(t){const e={};return t==null||t.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function w_(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=lB(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=Ud(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const hB={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},dB={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ut(t,e){const{message:r,code:n}=dB[t];return{message:e?`${r} ${e}`:r,code:n}}function Dr(t,e){const{message:r,code:n}=hB[t];return{message:e?`${r} ${e}`:r,code:n}}function nc(t,e){return!!Array.isArray(t)}function El(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function bi(t){return typeof t>"u"}function an(t,e){return e&&bi(t)?!0:typeof t=="string"&&!!t.trim().length}function f1(t,e){return typeof t=="number"&&!isNaN(t)}function pB(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return Qa(i,n)?(n.forEach(o=>{const{accounts:a,methods:u,events:l}=t.namespaces[o],d=Au(a),g=r[o];(!Qa(j3(o,g),d)||!Qa(g.methods,u)||!Qa(g.events,l))&&(s=!1)}),s):!1}function Wd(t){return an(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function gB(t){if(an(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Wd(r)}}return!1}function mB(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(an(t,!1)){if(e(t))return!0;const r=Q3(t);return e(r)}}catch{}return!1}function vB(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function bB(t){return t==null?void 0:t.topic}function yB(t,e){let r=null;return an(t==null?void 0:t.publicKey,!1)||(r=ut("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function x_(t){let e=!0;return nc(t)?t.length&&(e=t.every(r=>an(r,!1))):e=!1,e}function wB(t,e,r){let n=null;return nc(e)&&e.length?e.forEach(i=>{n||Wd(i)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Wd(t)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function xB(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=wB(i,j3(i,s),`${e} ${r}`);o&&(n=o)}),n}function _B(t,e){let r=null;return nc(t)?t.forEach(n=>{r||gB(n)||(r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function EB(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=_B(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function SB(t,e){let r=null;return x_(t==null?void 0:t.methods)?x_(t==null?void 0:t.events)||(r=Dr("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Dr("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function __(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=SB(n,`${e}, namespace`);i&&(r=i)}),r}function AB(t,e,r){let n=null;if(t&&El(t)){const i=__(t,e);i&&(n=i);const s=xB(t,e,r);s&&(n=s)}else n=ut("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function l1(t,e){let r=null;if(t&&El(t)){const n=__(t,e);n&&(r=n);const i=EB(t,e);i&&(r=i)}else r=ut("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function E_(t){return an(t.protocol,!0)}function PB(t,e){let r=!1;return t?t&&nc(t)&&t.length&&t.forEach(n=>{r=E_(n)}):r=!0,r}function MB(t){return typeof t=="number"}function yi(t){return typeof t<"u"&&typeof t!==null}function IB(t){return!(!t||typeof t!="object"||!t.code||!f1(t.code)||!t.message||!an(t.message,!1))}function CB(t){return!(bi(t)||!an(t.method,!1))}function TB(t){return!(bi(t)||bi(t.result)&&bi(t.error)||!f1(t.id)||!an(t.jsonrpc,!1))}function RB(t){return!(bi(t)||!an(t.name,!1))}function S_(t,e){return!(!Wd(e)||!cB(t).includes(e))}function DB(t,e,r){return an(r,!1)?uB(t,e).includes(r):!1}function OB(t,e,r){return an(r,!1)?fB(t,e).includes(r):!1}function A_(t,e,r){let n=null;const i=NB(t),s=LB(e),o=Object.keys(i),a=Object.keys(s),u=P_(Object.keys(t)),l=P_(Object.keys(e)),d=u.filter(g=>!l.includes(g));return d.length&&(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. +`)};function R$(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function D$(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function tc(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function O$(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:N$(e,r,n)}}}function N$(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function i_(t){return tc(t),`urn:recap:${R$(t).replace(/=/g,"")}`}function gl(t){const e=D$(t.replace("urn:recap:",""));return tc(e),e}function L$(t,e,r){const n=O$(t,e,r);return i_(n)}function k$(t){return t&&t.includes("urn:recap:")}function $$(t,e){const r=gl(t),n=gl(e),i=B$(r,n);return i_(i)}function B$(t,e){tc(t),tc(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,u)=>a.localeCompare(u)).forEach(a=>{var u,l;n.att[i]=I$(M$({},n.att[i]),{[a]:((u=t.att[i])==null?void 0:u[a])||((l=e.att[i])==null?void 0:l[a])})})}),n}function F$(t="",e){tc(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const u=Object.keys(e.att[a]).map(g=>({ability:g.split("/")[0],action:g.split("/")[1]}));u.sort((g,y)=>g.action.localeCompare(y.action));const l={};u.forEach(g=>{l[g.ability]||(l[g.ability]=[]),l[g.ability].push(g.action)});const d=Object.keys(l).map(g=>(i++,`(${i}) '${g}': '${l[g].join("', '")}' for '${a}'.`));n.push(d.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function s_(t){var e;const r=gl(t);tc(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function o_(t){const e=gl(t);tc(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function qd(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return k$(e)?e:void 0}const a_="base10",ni="base16",fa="base64pad",ml="base64url",vl="utf8",c_=0,Eo=1,bl=2,U$=0,u_=1,yl=12,a1=32;function j$(){const t=Hm.generateKeyPair();return{privateKey:Tn(t.secretKey,ni),publicKey:Tn(t.publicKey,ni)}}function c1(){const t=ea.randomBytes(a1);return Tn(t,ni)}function q$(t,e){const r=Hm.sharedKey(Rn(t,ni),Rn(e,ni),!0),n=new xk(fl.SHA256,r).expand(a1);return Tn(n,ni)}function zd(t){const e=fl.hash(Rn(t,ni));return Tn(e,ni)}function So(t){const e=fl.hash(Rn(t,vl));return Tn(e,ni)}function f_(t){return Rn(`${t}`,a_)}function rc(t){return Number(Tn(t,a_))}function z$(t){const e=f_(typeof t.type<"u"?t.type:c_);if(rc(e)===Eo&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Rn(t.senderPublicKey,ni):void 0,n=typeof t.iv<"u"?Rn(t.iv,ni):ea.randomBytes(yl),i=new jm.ChaCha20Poly1305(Rn(t.symKey,ni)).seal(n,Rn(t.message,vl));return l_({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function H$(t,e){const r=f_(bl),n=ea.randomBytes(yl),i=Rn(t,vl);return l_({type:r,sealed:i,iv:n,encoding:e})}function W$(t){const e=new jm.ChaCha20Poly1305(Rn(t.symKey,ni)),{sealed:r,iv:n}=wl({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Tn(i,vl)}function K$(t,e){const{sealed:r}=wl({encoded:t,encoding:e});return Tn(r,vl)}function l_(t){const{encoding:e=fa}=t;if(rc(t.type)===bl)return Tn(dd([t.type,t.sealed]),e);if(rc(t.type)===Eo){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Tn(dd([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return Tn(dd([t.type,t.iv,t.sealed]),e)}function wl(t){const{encoded:e,encoding:r=fa}=t,n=Rn(e,r),i=n.slice(U$,u_),s=u_;if(rc(i)===Eo){const l=s+a1,d=l+yl,g=n.slice(s,l),y=n.slice(l,d),A=n.slice(d);return{type:i,sealed:A,iv:y,senderPublicKey:g}}if(rc(i)===bl){const l=n.slice(s),d=ea.randomBytes(yl);return{type:i,sealed:l,iv:d}}const o=s+yl,a=n.slice(s,o),u=n.slice(o);return{type:i,sealed:u,iv:a}}function V$(t,e){const r=wl({encoded:t,encoding:e==null?void 0:e.encoding});return h_({type:rc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Tn(r.senderPublicKey,ni):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function h_(t){const e=(t==null?void 0:t.type)||c_;if(e===Eo){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function d_(t){return t.type===Eo&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function p_(t){return t.type===bl}function G$(t){return new A3.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function Y$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function J$(t){return Buffer.from(Y$(t),"base64")}function X$(t,e){const[r,n,i]=t.split("."),s=J$(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),u=`${r}.${n}`,l=new fl.SHA256().update(Buffer.from(u)).digest(),d=G$(e),g=Buffer.from(l).toString("hex");if(!d.verify(g,{r:o,s:a}))throw new Error("Invalid signature");return gm(t).payload}const Z$="irn";function u1(t){return(t==null?void 0:t.relay)||{protocol:Z$}}function xl(t){const e=Zk[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var Q$=Object.defineProperty,eB=Object.defineProperties,tB=Object.getOwnPropertyDescriptors,g_=Object.getOwnPropertySymbols,rB=Object.prototype.hasOwnProperty,nB=Object.prototype.propertyIsEnumerable,m_=(t,e,r)=>e in t?Q$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v_=(t,e)=>{for(var r in e||(e={}))rB.call(e,r)&&m_(t,r,e[r]);if(g_)for(var r of g_(e))nB.call(e,r)&&m_(t,r,e[r]);return t},iB=(t,e)=>eB(t,tB(e));function sB(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function b_(t){if(!t.includes("wc:")){const u=Q3(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=nl.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:oB(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:sB(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function oB(t){return t.startsWith("//")?t.substring(2):t}function aB(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function y_(t){return`${t.protocol}:${t.topic}@${t.version}?`+nl.stringify(v_(iB(v_({symKey:t.symKey},aB(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Hd(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Au(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function cB(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Au(r.accounts))}),e}function uB(t,e){const r=[];return Object.values(t).forEach(n=>{Au(n.accounts).includes(e)&&r.push(...n.methods)}),r}function fB(t,e){const r=[];return Object.values(t).forEach(n=>{Au(n.accounts).includes(e)&&r.push(...n.events)}),r}function f1(t){return t.includes(":")}function _l(t){return f1(t)?t.split(":")[0]:t}function lB(t){const e={};return t==null||t.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function w_(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=lB(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=Ud(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const hB={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},dB={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ut(t,e){const{message:r,code:n}=dB[t];return{message:e?`${r} ${e}`:r,code:n}}function Dr(t,e){const{message:r,code:n}=hB[t];return{message:e?`${r} ${e}`:r,code:n}}function nc(t,e){return!!Array.isArray(t)}function El(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function bi(t){return typeof t>"u"}function an(t,e){return e&&bi(t)?!0:typeof t=="string"&&!!t.trim().length}function l1(t,e){return typeof t=="number"&&!isNaN(t)}function pB(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return Qa(i,n)?(n.forEach(o=>{const{accounts:a,methods:u,events:l}=t.namespaces[o],d=Au(a),g=r[o];(!Qa(j3(o,g),d)||!Qa(g.methods,u)||!Qa(g.events,l))&&(s=!1)}),s):!1}function Wd(t){return an(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function gB(t){if(an(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Wd(r)}}return!1}function mB(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(an(t,!1)){if(e(t))return!0;const r=Q3(t);return e(r)}}catch{}return!1}function vB(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function bB(t){return t==null?void 0:t.topic}function yB(t,e){let r=null;return an(t==null?void 0:t.publicKey,!1)||(r=ut("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function x_(t){let e=!0;return nc(t)?t.length&&(e=t.every(r=>an(r,!1))):e=!1,e}function wB(t,e,r){let n=null;return nc(e)&&e.length?e.forEach(i=>{n||Wd(i)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Wd(t)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function xB(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=wB(i,j3(i,s),`${e} ${r}`);o&&(n=o)}),n}function _B(t,e){let r=null;return nc(t)?t.forEach(n=>{r||gB(n)||(r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function EB(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=_B(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function SB(t,e){let r=null;return x_(t==null?void 0:t.methods)?x_(t==null?void 0:t.events)||(r=Dr("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Dr("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function __(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=SB(n,`${e}, namespace`);i&&(r=i)}),r}function AB(t,e,r){let n=null;if(t&&El(t)){const i=__(t,e);i&&(n=i);const s=xB(t,e,r);s&&(n=s)}else n=ut("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function h1(t,e){let r=null;if(t&&El(t)){const n=__(t,e);n&&(r=n);const i=EB(t,e);i&&(r=i)}else r=ut("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function E_(t){return an(t.protocol,!0)}function PB(t,e){let r=!1;return t?t&&nc(t)&&t.length&&t.forEach(n=>{r=E_(n)}):r=!0,r}function MB(t){return typeof t=="number"}function yi(t){return typeof t<"u"&&typeof t!==null}function IB(t){return!(!t||typeof t!="object"||!t.code||!l1(t.code)||!t.message||!an(t.message,!1))}function CB(t){return!(bi(t)||!an(t.method,!1))}function TB(t){return!(bi(t)||bi(t.result)&&bi(t.error)||!l1(t.id)||!an(t.jsonrpc,!1))}function RB(t){return!(bi(t)||!an(t.name,!1))}function S_(t,e){return!(!Wd(e)||!cB(t).includes(e))}function DB(t,e,r){return an(r,!1)?uB(t,e).includes(r):!1}function OB(t,e,r){return an(r,!1)?fB(t,e).includes(r):!1}function A_(t,e,r){let n=null;const i=NB(t),s=LB(e),o=Object.keys(i),a=Object.keys(s),u=P_(Object.keys(t)),l=P_(Object.keys(e)),d=u.filter(g=>!l.includes(g));return d.length&&(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${d.toString()} Received: ${Object.keys(e).toString()}`)),Qa(o,a)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} Approved: ${a.toString()}`)),Object.keys(e).forEach(g=>{if(!g.includes(":")||n)return;const y=Au(e[g].accounts);y.includes(g)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${g} Required: ${g} - Approved: ${y.toString()}`))}),o.forEach(g=>{n||(Qa(i[g].methods,s[g].methods)?Qa(i[g].events,s[g].events)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${g}`)):n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${g}`))}),n}function NB(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function P_(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function LB(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Au(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function kB(t,e){return f1(t)&&t<=e.max&&t>=e.min}function M_(){const t=pl();return new Promise(e=>{switch(t){case Ri.browser:e($B());break;case Ri.reactNative:e(BB());break;case Ri.node:e(FB());break;default:e(!0)}})}function $B(){return dl()&&(navigator==null?void 0:navigator.onLine)}async function BB(){if(Eu()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function FB(){return!0}function UB(t){switch(pl()){case Ri.browser:jB(t);break;case Ri.reactNative:qB(t);break}}function jB(t){!Eu()&&dl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function qB(t){Eu()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const h1={};class Sl{static get(e){return h1[e]}static set(e,r){h1[e]=r}static delete(e){delete h1[e]}}const zB="PARSE_ERROR",HB="INVALID_REQUEST",WB="METHOD_NOT_FOUND",KB="INVALID_PARAMS",I_="INTERNAL_ERROR",d1="SERVER_ERROR",VB=[-32700,-32600,-32601,-32602,-32603],Al={[zB]:{code:-32700,message:"Parse error"},[HB]:{code:-32600,message:"Invalid Request"},[WB]:{code:-32601,message:"Method not found"},[KB]:{code:-32602,message:"Invalid params"},[I_]:{code:-32603,message:"Internal error"},[d1]:{code:-32e3,message:"Server error"}},C_=d1;function GB(t){return VB.includes(t)}function T_(t){return Object.keys(Al).includes(t)?Al[t]:Al[C_]}function YB(t){const e=Object.values(Al).find(r=>r.code===t);return e||Al[C_]}function R_(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var D_={},Ao={},O_;function JB(){if(O_)return Ao;O_=1,Object.defineProperty(Ao,"__esModule",{value:!0}),Ao.isBrowserCryptoAvailable=Ao.getSubtleCrypto=Ao.getBrowerCrypto=void 0;function t(){return(nn==null?void 0:nn.crypto)||(nn==null?void 0:nn.msCrypto)||{}}Ao.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Ao.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Ao.isBrowserCryptoAvailable=r,Ao}var Po={},N_;function XB(){if(N_)return Po;N_=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.isBrowser=Po.isNode=Po.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Po.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Po.isNode=e;function r(){return!t()&&!e()}return Po.isBrowser=r,Po}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Kf;e.__exportStar(JB(),t),e.__exportStar(XB(),t)})(D_);function la(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function ic(t=6){return BigInt(la(t))}function ha(t,e,r){return{id:r||la(),jsonrpc:"2.0",method:t,params:e}}function Kd(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Vd(t,e,r){return{id:t,jsonrpc:"2.0",error:ZB(e)}}function ZB(t,e){return typeof t>"u"?T_(I_):(typeof t=="string"&&(t=Object.assign(Object.assign({},T_(d1)),{message:t})),GB(t.code)&&(t=YB(t.code)),t)}let QB=class{},eF=class extends QB{constructor(){super()}},tF=class extends eF{constructor(e){super()}};const rF="^https?:",nF="^wss?:";function iF(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function L_(t,e){const r=iF(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function k_(t){return L_(t,rF)}function $_(t){return L_(t,nF)}function sF(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function B_(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function p1(t){return B_(t)&&"method"in t}function Gd(t){return B_(t)&&(zs(t)||Yi(t))}function zs(t){return"result"in t}function Yi(t){return"error"in t}let Ji=class extends tF{constructor(e){super(e),this.events=new qi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(ha(e.method,e.params||[],e.id||ic().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Yi(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Gd(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const oF=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),aF=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",F_=t=>t.split("?")[0],U_=10,cF=oF();let uF=class{constructor(e){if(this.url=e,this.events=new qi.EventEmitter,this.registering=!1,!$_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(go(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!$_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=D_.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!sF(e)},o=new cF(e,[],s);aF()?o.onerror=a=>{const u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Wa(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Vd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return R_(e,F_(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>U_&&this.events.setMaxListeners(U_)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${F_(this.url)}`));return this.events.emit("register_error",r),r}};var Yd={exports:{}};Yd.exports,function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",u="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",g="[object Date]",y="[object Error]",A="[object Function]",P="[object GeneratorFunction]",N="[object Map]",D="[object Number]",k="[object Null]",$="[object Object]",q="[object Promise]",U="[object Proxy]",K="[object RegExp]",J="[object Set]",T="[object String]",z="[object Symbol]",ue="[object Undefined]",_e="[object WeakMap]",G="[object ArrayBuffer]",E="[object DataView]",m="[object Float32Array]",f="[object Float64Array]",p="[object Int8Array]",v="[object Int16Array]",x="[object Int32Array]",_="[object Uint8Array]",S="[object Uint8ClampedArray]",b="[object Uint16Array]",M="[object Uint32Array]",I=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,O={};O[m]=O[f]=O[p]=O[v]=O[x]=O[_]=O[S]=O[b]=O[M]=!0,O[a]=O[u]=O[G]=O[d]=O[E]=O[g]=O[y]=O[A]=O[N]=O[D]=O[$]=O[K]=O[J]=O[T]=O[_e]=!1;var se=typeof nn=="object"&&nn&&nn.Object===Object&&nn,ee=typeof self=="object"&&self&&self.Object===Object&&self,X=se||ee||Function("return this")(),Q=e&&!e.nodeType&&e,R=Q&&!0&&t&&!t.nodeType&&t,Z=R&&R.exports===Q,te=Z&&se.process,le=function(){try{return te&&te.binding&&te.binding("util")}catch{}}(),ie=le&&le.isTypedArray;function fe(ce,ye){for(var Ye=-1,It=ce==null?0:ce.length,Ur=0,ir=[];++Ye-1}function st(ce,ye){var Ye=this.__data__,It=Xe(Ye,ce);return It<0?(++this.size,Ye.push([ce,ye])):Ye[It][1]=ye,this}Re.prototype.clear=De,Re.prototype.delete=it,Re.prototype.get=je,Re.prototype.has=gt,Re.prototype.set=st;function tt(ce){var ye=-1,Ye=ce==null?0:ce.length;for(this.clear();++yewn))return!1;var jr=ir.get(ce);if(jr&&ir.get(ye))return jr==ye;var gn=-1,_i=!0,xn=Ye&s?new _t:void 0;for(ir.set(ce,ye),ir.set(ye,ce);++gn-1&&ce%1==0&&ce-1&&ce%1==0&&ce<=o}function up(ce){var ye=typeof ce;return ce!=null&&(ye=="object"||ye=="function")}function Ac(ce){return ce!=null&&typeof ce=="object"}var fp=ie?Te(ie):dr;function Ub(ce){return Bb(ce)?qe(ce):pr(ce)}function Fr(){return[]}function kr(){return!1}t.exports=Fb}(Yd,Yd.exports);var fF=Yd.exports;const lF=Ui(fF),j_="wc",q_=2,z_="core",Hs=`${j_}@2:${z_}:`,hF={logger:"error"},dF={database:":memory:"},pF="crypto",H_="client_ed25519_seed",gF=mt.ONE_DAY,mF="keychain",vF="0.3",bF="messages",yF="0.3",wF=mt.SIX_HOURS,xF="publisher",W_="irn",_F="error",K_="wss://relay.walletconnect.org",EF="relayer",ii={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},SF="_subscription",Xi={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},AF=.1,g1="2.17.2",Wr={link_mode:"link_mode",relay:"relay"},PF="0.3",MF="WALLETCONNECT_CLIENT_ID",V_="WALLETCONNECT_LINK_MODE_APPS",Ws={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},IF="subscription",CF="0.3",TF=mt.FIVE_SECONDS*1e3,RF="pairing",DF="0.3",Pl={wc_pairingDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:0},res:{ttl:mt.ONE_DAY,prompt:!1,tag:0}}},sc={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},vs={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},OF="history",NF="0.3",LF="expirer",Zi={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},kF="0.3",$F="verify-api",BF="https://verify.walletconnect.com",G_="https://verify.walletconnect.org",Ml=G_,FF=`${Ml}/v3`,UF=[BF,G_],jF="echo",qF="https://echo.walletconnect.com",Ks={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},Mo={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},bs={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},oc={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},ac={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Il={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},zF=.1,HF="event-client",WF=86400,KF="https://pulse.walletconnect.org/batch";function VF(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(q);k!==$;){for(var K=P[k],J=0,T=q-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=q-D;z!==q&&U[z]===0;)z++;for(var ue=u.repeat(N);z>>0,q=new Uint8Array($);P[N];){var U=r[P.charCodeAt(N)];if(U===255)return;for(var K=0,J=$-1;(U!==0||K>>0,q[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,N++}if(P[N]!==" "){for(var T=$-k;T!==$&&q[T]===0;)T++;for(var z=new Uint8Array(D+($-T)),ue=D;T!==$;)z[ue++]=q[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:g,decodeUnsafe:y,decode:A}}var GF=VF,YF=GF;const Y_=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},JF=t=>new TextEncoder().encode(t),XF=t=>new TextDecoder().decode(t);class ZF{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class QF{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return J_(this,e)}}class eU{constructor(e){this.decoders=e}or(e){return J_(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const J_=(t,e)=>new eU({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class tU{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new ZF(e,r,n),this.decoder=new QF(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Jd=({name:t,prefix:e,encode:r,decode:n})=>new tU(t,e,r,n),Cl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=YF(r,e);return Jd({prefix:t,name:e,encode:n,decode:s=>Y_(i(s))})},rU=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},nU=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Jd({prefix:e,name:t,encode(i){return nU(i,n,r)},decode(i){return rU(i,n,r,t)}}),iU=Jd({prefix:"\0",name:"identity",encode:t=>XF(t),decode:t=>JF(t)});var sU=Object.freeze({__proto__:null,identity:iU});const oU=qn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var aU=Object.freeze({__proto__:null,base2:oU});const cU=qn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var uU=Object.freeze({__proto__:null,base8:cU});const fU=Cl({prefix:"9",name:"base10",alphabet:"0123456789"});var lU=Object.freeze({__proto__:null,base10:fU});const hU=qn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),dU=qn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var pU=Object.freeze({__proto__:null,base16:hU,base16upper:dU});const gU=qn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),mU=qn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),vU=qn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),bU=qn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),yU=qn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),wU=qn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),xU=qn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),_U=qn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),EU=qn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var SU=Object.freeze({__proto__:null,base32:gU,base32upper:mU,base32pad:vU,base32padupper:bU,base32hex:yU,base32hexupper:wU,base32hexpad:xU,base32hexpadupper:_U,base32z:EU});const AU=Cl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),PU=Cl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var MU=Object.freeze({__proto__:null,base36:AU,base36upper:PU});const IU=Cl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),CU=Cl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var TU=Object.freeze({__proto__:null,base58btc:IU,base58flickr:CU});const RU=qn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),DU=qn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),OU=qn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),NU=qn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var LU=Object.freeze({__proto__:null,base64:RU,base64pad:DU,base64url:OU,base64urlpad:NU});const X_=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),kU=X_.reduce((t,e,r)=>(t[r]=e,t),[]),$U=X_.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function BU(t){return t.reduce((e,r)=>(e+=kU[r],e),"")}function FU(t){const e=[];for(const r of t){const n=$U[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const UU=Jd({prefix:"🚀",name:"base256emoji",encode:BU,decode:FU});var jU=Object.freeze({__proto__:null,base256emoji:UU}),qU=Q_,Z_=128,zU=127,HU=~zU,WU=Math.pow(2,31);function Q_(t,e,r){e=e||[],r=r||0;for(var n=r;t>=WU;)e[r++]=t&255|Z_,t/=128;for(;t&HU;)e[r++]=t&255|Z_,t>>>=7;return e[r]=t|0,Q_.bytes=r-n+1,e}var KU=m1,VU=128,e6=127;function m1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw m1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&e6)<=VU);return m1.bytes=s-n,r}var GU=Math.pow(2,7),YU=Math.pow(2,14),JU=Math.pow(2,21),XU=Math.pow(2,28),ZU=Math.pow(2,35),QU=Math.pow(2,42),ej=Math.pow(2,49),tj=Math.pow(2,56),rj=Math.pow(2,63),nj=function(t){return t(t6.encode(t,e,r),e),n6=t=>t6.encodingLength(t),v1=(t,e)=>{const r=e.byteLength,n=n6(t),i=n+n6(r),s=new Uint8Array(i+r);return r6(t,s,0),r6(r,s,n),s.set(e,i),new sj(t,r,e,s)};class sj{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const i6=({name:t,code:e,encode:r})=>new oj(t,e,r);class oj{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?v1(this.code,r):r.then(n=>v1(this.code,n))}else throw Error("Unknown type, must be binary type")}}const s6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),aj=i6({name:"sha2-256",code:18,encode:s6("SHA-256")}),cj=i6({name:"sha2-512",code:19,encode:s6("SHA-512")});var uj=Object.freeze({__proto__:null,sha256:aj,sha512:cj});const o6=0,fj="identity",a6=Y_;var lj=Object.freeze({__proto__:null,identity:{code:o6,name:fj,encode:a6,digest:t=>v1(o6,a6(t))}});new TextEncoder,new TextDecoder;const c6={...sU,...aU,...uU,...lU,...pU,...SU,...MU,...TU,...LU,...jU};({...uj,...lj});function hj(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function u6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const f6=u6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),b1=u6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=hj(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=ut("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,V3(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?G3(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}},mj=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=pF,this.randomSessionIdentifier=a1(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=wx(i);return yx(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=j$();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=wx(s),a=this.randomSessionIdentifier;return await SO(a,i,gF,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),u=q$(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||zd(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=h_(o),u=go(s);if(p_(a))return H$(u,o==null?void 0:o.encoding);if(d_(a)){const y=a.senderPublicKey,A=a.receiverPublicKey;i=await this.generateSharedKey(y,A)}const l=this.getSymKey(i),{type:d,senderPublicKey:g}=a;return z$({type:d,symKey:l,message:u,senderPublicKey:g,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=V$(s,o);if(p_(a)){const u=K$(s,o==null?void 0:o.encoding);return Wa(u)}if(d_(a)){const u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{const u=this.getSymKey(i),l=W$({symKey:u,encoded:s,encoding:o==null?void 0:o.encoding});return Wa(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=(i,s=fa)=>{const o=wl({encoded:i,encoding:s});return rc(o.type)},this.getPayloadSenderPublicKey=(i,s=fa)=>{const o=wl({encoded:i,encoding:s});return o.senderPublicKey?Tn(o.senderPublicKey,ni):void 0},this.core=e,this.logger=ri(r,this.name),this.keychain=n||new gj(this.core,this.logger)}get context(){return gi(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(H_)}catch{e=a1(),await this.keychain.set(H_,e)}return pj(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}};class vj extends DR{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=bF,this.version=yF,this.initialized=!1,this.storagePrefix=Hs,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=So(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=So(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=ri(e,this.name),this.core=r}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,V3(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?G3(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class bj extends OR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new qi.EventEmitter,this.name=xF,this.queue=new Map,this.publishTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.failedPublishTimeout=mt.toMiliseconds(mt.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||wF,u=c1(s),l=(s==null?void 0:s.prompt)||!1,d=(s==null?void 0:s.tag)||0,g=(s==null?void 0:s.id)||ic().toString(),y={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:d,id:g,attestation:s==null?void 0:s.attestation}},A=`Failed to publish payload, please try again. id:${g} tag:${d}`,P=Date.now();let N,D=1;try{for(;N===void 0;){if(Date.now()-P>this.publishTimeout)throw new Error(A);this.logger.trace({id:g,attempts:D},`publisher.publish - attempt ${D}`),N=await await Su(this.rpcPublish(n,i,a,u,l,d,g,s==null?void 0:s.attestation).catch(k=>this.logger.warn(k)),this.publishTimeout,A),D++,N||await new Promise(k=>setTimeout(k,this.failedPublishTimeout))}this.relayer.events.emit(ii.publish,y),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:g,topic:n,message:i,opts:s}})}catch(k){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(k),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw k;this.queue.set(g,y)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=ri(r,this.name),this.registerEventListeners()}get context(){return gi(this.logger)}rpcPublish(e,r,n,i,s,o,a,u){var l,d,g,y;const A={method:xl(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:u},id:a};return bi((l=A.params)==null?void 0:l.prompt)&&((d=A.params)==null||delete d.prompt),bi((g=A.params)==null?void 0:g.tag)&&((y=A.params)==null||delete y.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:A}),this.relayer.request(A)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(nu.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ii.connection_stalled);return}this.checkQueue()}),this.relayer.on(ii.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class yj{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var wj=Object.defineProperty,xj=Object.defineProperties,_j=Object.getOwnPropertyDescriptors,l6=Object.getOwnPropertySymbols,Ej=Object.prototype.hasOwnProperty,Sj=Object.prototype.propertyIsEnumerable,h6=(t,e,r)=>e in t?wj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Tl=(t,e)=>{for(var r in e||(e={}))Ej.call(e,r)&&h6(t,r,e[r]);if(l6)for(var r of l6(e))Sj.call(e,r)&&h6(t,r,e[r]);return t},y1=(t,e)=>xj(t,_j(e));class Aj extends kR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new yj,this.events=new qi.EventEmitter,this.name=IF,this.version=CF,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Hs,this.subscribeTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=c1(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new mt.Watch;a.start(i);const u=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(u),a.stop(i),s(!0)),a.elapsed(i)>=TF&&(clearInterval(u),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ri(r,this.name),this.clientId=""}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=c1(n);await this.rpcUnsubscribe(e,r,i);const s=Dr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===Wr.relay&&await this.restartToComplete();const s={method:xl(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=So(e+this.clientId);if((n==null?void 0:n.transportType)===Wr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},mt.toMiliseconds(mt.ONE_SECOND)),a;const u=await Su(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return u?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ii.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:xl(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Su(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:xl(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Su(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:xl(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,y1(Tl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Tl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Tl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Ws.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Ws.deleted,y1(Tl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Ws.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);nc(r)&&this.onBatchSubscribe(r.map((n,i)=>y1(Tl({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(nu.pulse,async()=>{await this.checkPending()}),this.events.on(Ws.created,async e=>{const r=Ws.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Ws.deleted,async e=>{const r=Ws.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var Pj=Object.defineProperty,d6=Object.getOwnPropertySymbols,Mj=Object.prototype.hasOwnProperty,Ij=Object.prototype.propertyIsEnumerable,p6=(t,e,r)=>e in t?Pj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,g6=(t,e)=>{for(var r in e||(e={}))Mj.call(e,r)&&p6(t,r,e[r]);if(d6)for(var r of d6(e))Ij.call(e,r)&&p6(t,r,e[r]);return t};class Cj extends NR{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new qi.EventEmitter,this.name=EF,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=mt.toMiliseconds(mt.THIRTY_SECONDS+mt.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||ic().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(u,l)=>{const d=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Xi.disconnect,d);const g=await o;this.provider.off(Xi.disconnect,d),u(g)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(Fd())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(ii.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ii.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Xi.payload,this.onPayloadHandler),this.provider.on(Xi.connect,this.onConnectHandler),this.provider.on(Xi.disconnect,this.onDisconnectHandler),this.provider.on(Xi.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ri(e.logger,this.name):Zf(sd({level:e.logger||_F})),this.messages=new vj(this.logger,e.core),this.subscriber=new Aj(this,this.logger),this.publisher=new bj(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||K_,this.projectId=e.projectId,this.bundleId=s$(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return gi(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Wr.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",u;const l=d=>{d.topic===e&&(this.subscriber.off(Ws.created,l),u())};return await Promise.all([new Promise(d=>{u=d,this.subscriber.on(Ws.created,l)}),new Promise(async(d,g)=>{a=await this.subscriber.subscribe(e,g6({internal:{throwOnFailedPublish:o}},r)).catch(y=>{o&&g(y)})||a,d()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Su(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Xi.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Xi.disconnect,i),await Su(this.provider.connect(),mt.toMiliseconds(mt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await M_())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=En(mt.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(ii.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(Fd())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Ji(new uF(u$({sdkVersion:g1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),p1(e)){if(!e.method.endsWith(SF))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:Wr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(g6({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else Gd(e)&&this.events.emit(ii.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ii.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Kd(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Xi.payload,this.onPayloadHandler),this.provider.off(Xi.connect,this.onConnectHandler),this.provider.off(Xi.disconnect,this.onDisconnectHandler),this.provider.off(Xi.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await M_();UB(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(ii.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},mt.toMiliseconds(AF))))}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var Tj=Object.defineProperty,m6=Object.getOwnPropertySymbols,Rj=Object.prototype.hasOwnProperty,Dj=Object.prototype.propertyIsEnumerable,v6=(t,e,r)=>e in t?Tj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b6=(t,e)=>{for(var r in e||(e={}))Rj.call(e,r)&&v6(t,r,e[r]);if(m6)for(var r of m6(e))Dj.call(e,r)&&v6(t,r,e[r]);return t};class cc extends LR{constructor(e,r,n,i=Hs,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=PF,this.cached=[],this.initialized=!1,this.storagePrefix=Hs,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!bi(o)?this.map.set(this.getKey(o),o):vB(o)?this.map.set(o.id,o):bB(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>lF(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const u=b6(b6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=ri(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Oj{constructor(e,r){this.core=e,this.logger=r,this.name=RF,this.version=DF,this.events=new Gg,this.initialized=!1,this.storagePrefix=Hs,this.ignoredPayloadTypes=[Eo],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=a1(),s=await this.core.crypto.setSymKey(i),o=En(mt.FIVE_MINUTES),a={protocol:W_},u={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=y_({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(sc.create,u),this.core.expirer.set(s,o),await this.pairings.set(s,u),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Ks.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:u,methods:l}=b_(n.uri);i.props.properties.topic=s,i.addTrace(Ks.pairing_uri_validation_success),i.addTrace(Ks.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(Ks.existing_pairing),d.active)throw i.setError(Mo.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Ks.pairing_not_expired)}const g=u||En(mt.FIVE_MINUTES),y={topic:s,relay:a,expiry:g,active:!1,methods:l};this.core.expirer.set(s,g),await this.pairings.set(s,y),i.addTrace(Ks.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(sc.create,y),i.addTrace(Ks.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Ks.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Mo.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(A){throw i.setError(Mo.subscribe_pairing_topic_failure),A}return i.addTrace(Ks.subscribe_pairing_topic_success),y},this.activate=async({topic:n})=>{this.isInitialized();const i=En(mt.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=ec();this.events.once(vr("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Dr("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,u=this.core.crypto.keychain.get(i);return y_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:u,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=ha(i,s),a=await this.core.crypto.encode(n,o),u=Pl[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{const o=Kd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Pl[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=Vd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Pl[u.request.method]?Pl[u.request.method].res:Pl.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Dr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>ua(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(sc.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{zs(i)?this.events.emit(vr("pairing_ping",s),{}):Yi(i)&&this.events.emit(vr("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(sc.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Dr("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Dr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!yi(n)){const{message:a}=ut("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Mo.malformed_pairing_uri),new Error(a)}if(!mB(n.uri)){const{message:a}=ut("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Mo.malformed_pairing_uri),new Error(a)}const o=b_(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Mo.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Mo.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&mt.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!an(n,!1)){const{message:i}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ua(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ut("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=ri(r,this.name),this.pairings=new cc(this.core,this.logger,this.name,this.storagePrefix)}get context(){return gi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ii.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===Wr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{p1(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):Gd(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Zi.expired,async e=>{const{topic:r}=J3(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(sc.expire,{topic:r}))})}}class Nj extends RR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new qi.EventEmitter,this.name=OF,this.version=NF,this.cached=[],this.initialized=!1,this.storagePrefix=Hs,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:En(mt.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(vs.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Yi(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(vs.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(vs.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:ha(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(vs.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(vs.created,e=>{const r=vs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(vs.updated,e=>{const r=vs.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(vs.deleted,e=>{const r=vs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(nu.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{mt.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(vs.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Lj extends $R{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new qi.EventEmitter,this.name=LF,this.version=kF,this.cached=[],this.initialized=!1,this.storagePrefix=Hs,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Zi.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Zi.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return f$(e);if(typeof e=="number")return l$(e);const{message:r}=ut("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Zi.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;mt.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Zi.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(nu.pulse,()=>this.checkExpirations()),this.events.on(Zi.created,e=>{const r=Zi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.expired,e=>{const r=Zi.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.deleted,e=>{const r=Zi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class kj extends BR{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=$F,this.verifyUrlV3=FF,this.storagePrefix=Hs,this.version=q_,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&mt.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!dl()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,u=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=rl(),d=this.startAbortTimer(mt.ONE_SECOND*5),g=await new Promise((y,A)=>{const P=()=>{window.removeEventListener("message",D),l.body.removeChild(N),A("attestation aborted")};this.abortController.signal.addEventListener("abort",P);const N=l.createElement("iframe");N.src=u,N.style.display="none",N.addEventListener("error",P,{signal:this.abortController.signal});const D=k=>{if(k.data&&typeof k.data=="string")try{const $=JSON.parse(k.data);if($.type==="verify_attestation"){if(pm($.attestation).payload.id!==o)return;clearInterval(d),l.body.removeChild(N),this.abortController.signal.removeEventListener("abort",P),window.removeEventListener("message",D),y($.attestation===null?"":$.attestation)}}catch($){this.logger.warn($)}};l.body.appendChild(N),window.addEventListener("message",D,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",g),g}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(pm(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const u=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,u)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(mt.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Ml;return UF.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Ml}`),s=Ml),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(mt.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=X$(i,s.publicKey),a={hasExpired:mt.toMiliseconds(o.exp)this.abortController.abort(),mt.toMiliseconds(e))}}class $j extends FR{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=jF,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${qF}/${this.projectId}/clients`;await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=ri(r,this.context)}}var Bj=Object.defineProperty,y6=Object.getOwnPropertySymbols,Fj=Object.prototype.hasOwnProperty,Uj=Object.prototype.propertyIsEnumerable,w6=(t,e,r)=>e in t?Bj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rl=(t,e)=>{for(var r in e||(e={}))Fj.call(e,r)&&w6(t,r,e[r]);if(y6)for(var r of y6(e))Uj.call(e,r)&&w6(t,r,e[r]);return t};class jj extends UR{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=HF,this.storagePrefix=Hs,this.storageVersion=zF,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!n1())try{const i={eventId:Z3(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:K3(this.core.relayer.protocol,this.core.relayer.version,g1)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:u}}=i,l=Z3(),d=this.core.projectId||"",g=Date.now(),y=Rl({eventId:l,timestamp:g,props:{event:s,type:o,properties:{topic:a,trace:u}},bundleId:d,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,y),this.shouldPersist=!0),y},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(u=>u.props.properties.topic===o);if(a)return Rl(Rl({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(nu.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{mt.fromMiliseconds(Date.now())-mt.fromMiliseconds(i.timestamp)>WF&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Rl(Rl({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${KF}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${g1}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>W3().url,this.logger=ri(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var qj=Object.defineProperty,x6=Object.getOwnPropertySymbols,zj=Object.prototype.hasOwnProperty,Hj=Object.prototype.propertyIsEnumerable,_6=(t,e,r)=>e in t?qj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,E6=(t,e)=>{for(var r in e||(e={}))zj.call(e,r)&&_6(t,r,e[r]);if(x6)for(var r of x6(e))Hj.call(e,r)&&_6(t,r,e[r]);return t};class w1 extends TR{constructor(e){var r;super(e),this.protocol=j_,this.version=q_,this.name=z_,this.events=new qi.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:u})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:Wr.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||K_,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=sd({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:hF.logger}),{logger:i,chunkLoggerController:s}=CR({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ri(i,this.name),this.heartbeat=new ET,this.crypto=new mj(this,this.logger,e==null?void 0:e.keychain),this.history=new Nj(this,this.logger),this.expirer=new Lj(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new tR(E6(E6({},dF),e==null?void 0:e.storageOptions)),this.relayer=new Cj({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Oj(this,this.logger),this.verify=new kj(this,this.logger,this.storage),this.echoClient=new $j(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new jj(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new w1(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(MF,n),r}get context(){return gi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(V_,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(V_)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const Wj=w1,S6="wc",A6=2,P6="client",x1=`${S6}@${A6}:${P6}:`,_1={name:P6,logger:"error"},M6="WALLETCONNECT_DEEPLINK_CHOICE",Kj="proposal",I6="Proposal expired",Vj="session",Pu=mt.SEVEN_DAYS,Gj="engine",kn={wc_sessionPropose:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:mt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:mt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1119}}},E1={min:mt.FIVE_MINUTES,max:mt.SEVEN_DAYS},Vs={idle:"IDLE",active:"ACTIVE"},Yj="request",Jj=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],Xj="wc",Zj="auth",Qj="authKeys",eq="pairingTopics",tq="requests",Xd=`${Xj}@${1.5}:${Zj}:`,Zd=`${Xd}:PUB_KEY`;var rq=Object.defineProperty,nq=Object.defineProperties,iq=Object.getOwnPropertyDescriptors,C6=Object.getOwnPropertySymbols,sq=Object.prototype.hasOwnProperty,oq=Object.prototype.propertyIsEnumerable,T6=(t,e,r)=>e in t?rq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))sq.call(e,r)&&T6(t,r,e[r]);if(C6)for(var r of C6(e))oq.call(e,r)&&T6(t,r,e[r]);return t},ys=(t,e)=>nq(t,iq(e));class aq extends qR{constructor(e){super(e),this.name=Gj,this.events=new Gg,this.initialized=!1,this.requestQueue={state:Vs.idle,queue:[]},this.sessionRequestQueue={state:Vs.idle,queue:[]},this.requestQueueDelay=mt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(kn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=ys(tn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n;let l=i,d,g=!1;try{l&&(g=this.client.core.pairing.pairings.get(l).active)}catch(U){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),U}if(!l||!g){const{topic:U,uri:K}=await this.client.core.pairing.create();l=U,d=K}if(!l){const{message:U}=ut("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(U)}const y=await this.client.core.crypto.generateKeyPair(),A=kn.wc_sessionPropose.req.ttl||mt.FIVE_MINUTES,P=En(A),N=tn({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:W_}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:P,pairingTopic:l},a&&{sessionProperties:a}),{reject:D,resolve:k,done:$}=ec(A,I6);this.events.once(vr("session_connect"),async({error:U,session:K})=>{if(U)D(U);else if(K){K.self.publicKey=y;const J=ys(tn({},K),{pairingTopic:N.pairingTopic,requiredNamespaces:N.requiredNamespaces,optionalNamespaces:N.optionalNamespaces,transportType:Wr.relay});await this.client.session.set(K.topic,J),await this.setExpiry(K.topic,K.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:K.peer.metadata}),this.cleanupDuplicatePairings(J),k(J)}});const q=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:N,throwOnFailedPublish:!0});return await this.setProposal(q,tn({id:q},N)),{uri:d,approval:$}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[bs.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(z){throw o.setError(oc.no_internet_connection),z}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(z){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(oc.proposal_not_found),z}try{await this.isValidApprove(r)}catch(z){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(oc.session_approve_namespace_validation_failure),z}const{id:a,relayProtocol:u,namespaces:l,sessionProperties:d,sessionConfig:g}=r,y=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:A,proposer:P,requiredNamespaces:N,optionalNamespaces:D}=y;let k=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:A});k||(k=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:bs.session_approve_started,properties:{topic:A,trace:[bs.session_approve_started,bs.session_namespaces_validation_success]}}));const $=await this.client.core.crypto.generateKeyPair(),q=P.publicKey,U=await this.client.core.crypto.generateSharedKey($,q),K=tn(tn({relay:{protocol:u??"irn"},namespaces:l,controller:{publicKey:$,metadata:this.client.metadata},expiry:En(Pu)},d&&{sessionProperties:d}),g&&{sessionConfig:g}),J=Wr.relay;k.addTrace(bs.subscribing_session_topic);try{await this.client.core.relayer.subscribe(U,{transportType:J})}catch(z){throw k.setError(oc.subscribe_session_topic_failure),z}k.addTrace(bs.subscribe_session_topic_success);const T=ys(tn({},K),{topic:U,requiredNamespaces:N,optionalNamespaces:D,pairingTopic:A,acknowledged:!1,self:K.controller,peer:{publicKey:P.publicKey,metadata:P.metadata},controller:$,transportType:Wr.relay});await this.client.session.set(U,T),k.addTrace(bs.store_session);try{k.addTrace(bs.publishing_session_settle),await this.sendRequest({topic:U,method:"wc_sessionSettle",params:K,throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(oc.session_settle_publish_failure),z}),k.addTrace(bs.session_settle_publish_success),k.addTrace(bs.publishing_session_approve),await this.sendResult({id:a,topic:A,result:{relay:{protocol:u??"irn"},responderPublicKey:$},throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(oc.session_approve_publish_failure),z}),k.addTrace(bs.session_approve_publish_success)}catch(z){throw this.client.logger.error(z),this.client.session.delete(U,Dr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(U),z}return this.client.core.eventClient.deleteEvent({eventId:k.eventId}),await this.client.core.pairing.updateMetadata({topic:A,metadata:P.metadata}),await this.client.proposal.delete(a,Dr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:A}),await this.setExpiry(U,En(Pu)),{topic:U,acknowledged:()=>Promise.resolve(this.client.session.get(U))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:kn.wc_sessionPropose.reject}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(g){throw this.client.logger.error("update() -> isValidUpdate() failed"),g}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=ec(),u=la(),l=ic().toString(),d=this.client.session.get(n).namespaces;return this.events.once(vr("session_update",u),({error:g})=>{g?a(g):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:u,relayRpcId:l}).catch(g=>{this.client.logger.error(g),this.client.session.update(n,{namespaces:d}),a(g)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(u){throw this.client.logger.error("extend() -> isValidExtend() failed"),u}const{topic:n}=r,i=la(),{done:s,resolve:o,reject:a}=ec();return this.events.once(vr("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,En(Pu)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(u=>{a(u)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(P){throw this.client.logger.error("request() -> isValidRequest() failed"),P}const{chainId:n,request:i,topic:s,expiry:o=kn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=la(),l=ic().toString(),{done:d,resolve:g,reject:y}=ec(o,"Request expired. Please try again.");this.events.once(vr("session_request",u),({error:P,result:N})=>{P?y(P):g(N)});const A=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return A?(await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ys(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:A}).catch(P=>y(P)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),await d()):await Promise.all([new Promise(async P=>{await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ys(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(N=>y(N)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),P()}),new Promise(async P=>{var N;if(!((N=a.sessionConfig)!=null&&N.disableDeepLink)){const D=await p$(this.client.core.storage,M6);await h$({id:u,topic:s,wcDeepLink:D})}P()}),d()]).then(P=>P[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);zs(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Yi(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=la(),s=ic().toString(),{done:o,resolve:a,reject:u}=ec();this.events.once(vr("session_ping",i),({error:l})=>{l?u(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=ic().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Dr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ut("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>pB(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?Wr.link_mode:Wr.relay;o===Wr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:u="",uri:l,domain:d,nonce:g,type:y,exp:A,nbf:P,methods:N=[],expiry:D}=r,k=[...r.resources||[]],{topic:$,uri:q}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:$,uri:q}});const U=await this.client.core.crypto.generateKeyPair(),K=zd(U);if(await Promise.all([this.client.auth.authKeys.set(Zd,{responseTopic:K,publicKey:U}),this.client.auth.pairingTopics.set(K,{topic:K,pairingTopic:$})]),await this.client.core.relayer.subscribe(K,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${$}`),N.length>0){const{namespace:_}=_u(a[0]);let S=L$(_,"request",N);qd(k)&&(S=$$(S,k.pop())),k.push(S)}const J=D&&D>kn.wc_sessionAuthenticate.req.ttl?D:kn.wc_sessionAuthenticate.req.ttl,T={authPayload:{type:y??"caip122",chains:a,statement:u,aud:l,domain:d,version:"1",nonce:g,iat:new Date().toISOString(),exp:A,nbf:P,resources:k},requester:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(J)},z={eip155:{chains:a,methods:[...new Set(["personal_sign",...N])],events:["chainChanged","accountsChanged"]}},ue={requiredNamespaces:{},optionalNamespaces:z,relays:[{protocol:"irn"}],pairingTopic:$,proposer:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(kn.wc_sessionPropose.req.ttl)},{done:_e,resolve:G,reject:E}=ec(J,"Request expired"),m=async({error:_,session:S})=>{if(this.events.off(vr("session_request",p),f),_)E(_);else if(S){S.self.publicKey=U,await this.client.session.set(S.topic,S),await this.setExpiry(S.topic,S.expiry),$&&await this.client.core.pairing.updateMetadata({topic:$,metadata:S.peer.metadata});const b=this.client.session.get(S.topic);await this.deleteProposal(v),G({session:b})}},f=async _=>{var S,b,M;if(await this.deletePendingAuthRequest(p,{message:"fulfilled",code:0}),_.error){const X=Dr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return _.error.code===X.code?void 0:(this.events.off(vr("session_connect"),m),E(_.error.message))}await this.deleteProposal(v),this.events.off(vr("session_connect"),m);const{cacaos:I,responder:F}=_.result,ae=[],O=[];for(const X of I){await r_({cacao:X,projectId:this.client.core.projectId})||(this.client.logger.error(X,"Signature verification failed"),E(Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Q}=X,R=qd(Q.resources),Z=[s1(Q.iss)],te=jd(Q.iss);if(R){const le=s_(R),ie=o_(R);ae.push(...le),Z.push(...ie)}for(const le of Z)O.push(`${le}:${te}`)}const se=await this.client.core.crypto.generateSharedKey(U,F.publicKey);let ee;ae.length>0&&(ee={topic:se,acknowledged:!0,self:{publicKey:U,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:En(Pu),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:$,namespaces:w_([...new Set(ae)],[...new Set(O)]),transportType:o},await this.client.core.relayer.subscribe(se,{transportType:o}),await this.client.session.set(se,ee),$&&await this.client.core.pairing.updateMetadata({topic:$,metadata:F.metadata}),ee=this.client.session.get(se)),(S=this.client.metadata.redirect)!=null&&S.linkMode&&(b=F.metadata.redirect)!=null&&b.linkMode&&(M=F.metadata.redirect)!=null&&M.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(se,{transportType:Wr.link_mode})),G({auths:I,session:ee})},p=la(),v=la();this.events.once(vr("session_connect"),m),this.events.once(vr("session_request",p),f);let x;try{if(s){const _=ha("wc_sessionAuthenticate",T,p);this.client.core.history.set($,_);const S=await this.client.core.crypto.encode("",_,{type:bl,encoding:ml});x=Hd(n,$,S)}else await Promise.all([this.sendRequest({topic:$,method:"wc_sessionAuthenticate",params:T,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:p}),this.sendRequest({topic:$,method:"wc_sessionPropose",params:ue,expiry:kn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:v})])}catch(_){throw this.events.off(vr("session_connect"),m),this.events.off(vr("session_request",p),f),_}return await this.setProposal(v,tn({id:v},ue)),await this.setAuthRequest(p,{request:ys(tn({},T),{verifyContext:{}}),pairingTopic:$,transportType:o}),{uri:x??q,response:_e}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[ac.authenticated_session_approve_started]}});try{this.isInitialized()}catch(D){throw s.setError(Il.no_internet_connection),D}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Il.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||Wr.relay;a===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=zd(u),g={type:Eo,receiverPublicKey:u,senderPublicKey:l},y=[],A=[];for(const D of i){if(!await r_({cacao:D,projectId:this.client.core.projectId})){s.setError(Il.invalid_cacao);const K=Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:K,encodeOpts:g}),new Error(K.message)}s.addTrace(ac.cacaos_verified);const{p:k}=D,$=qd(k.resources),q=[s1(k.iss)],U=jd(k.iss);if($){const K=s_($),J=o_($);y.push(...K),q.push(...J)}for(const K of q)A.push(`${K}:${U}`)}const P=await this.client.core.crypto.generateSharedKey(l,u);s.addTrace(ac.create_authenticated_session_topic);let N;if((y==null?void 0:y.length)>0){N={topic:P,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:u,metadata:o.requester.metadata},controller:u,expiry:En(Pu),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:w_([...new Set(y)],[...new Set(A)]),transportType:a},s.addTrace(ac.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(P,{transportType:a})}catch(D){throw s.setError(Il.subscribe_authenticated_session_topic_failure),D}s.addTrace(ac.subscribe_authenticated_session_topic_success),await this.client.session.set(P,N),s.addTrace(ac.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(ac.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:g,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(D){throw s.setError(Il.authenticated_session_approve_publish_failure),D}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:N}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),u=zd(o),l={type:Eo,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:u,error:i,encodeOpts:l,rpcOpts:kn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return n_(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:u}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Dr("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(M6).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,Dr("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Vs.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(oc.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Dr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Vs.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,En(kn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=Wr.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||En(kn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l,appLink:d}=r,g=ha(i,s,u);let y;const A=!!d;try{const D=A?ml:fa;y=await this.client.core.crypto.encode(n,g,{encoding:D})}catch(D){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),D}let P;if(Jj.includes(i)){const D=So(JSON.stringify(g)),k=So(y);P=await this.client.core.verify.register({id:k,decryptedId:D})}const N=kn[i].req;if(N.attestation=P,o&&(N.ttl=o),a&&(N.id=a),this.client.core.history.set(n,g),A){const D=Hd(d,n,y);await global.Linking.openURL(D,this.client.name)}else{const D=kn[i].req;o&&(D.ttl=o),a&&(D.id=a),l?(D.internal=ys(tn({},D.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,y,D)):this.client.core.relayer.publish(n,y,D).catch(k=>this.client.logger.error(k))}return g.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:u}=r,l=Kd(n,s);let d;const g=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=g?ml:fa;d=await this.client.core.crypto.encode(i,l,ys(tn({},a||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),A}if(g){const A=Hd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=kn[y.request.method].res;o?(A.internal=ys(tn({},A.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,A)):this.client.core.relayer.publish(i,d,A).catch(P=>this.client.logger.error(P))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:u}=r,l=Vd(n,s);let d;const g=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=g?ml:fa;d=await this.client.core.crypto.encode(i,l,ys(tn({},o||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),A}if(g){const A=Hd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=a||kn[y.request.method].res;this.client.core.relayer.publish(i,d,A)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;ua(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{ua(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Vs.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Vs.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Vs.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,u=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:u}))switch(u){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=ut("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:u}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(tn({},i.params));const d=a.expiryTimestamp||En(kn.wc_sessionPropose.req.ttl),g=tn({id:u,pairingTopic:n,expiryTimestamp:d},a);await this.setProposal(u,g);const y=await this.getVerifyContext({attestationId:s,hash:So(JSON.stringify(i)),encryptedId:o,metadata:g.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(Mo.proposal_listener_not_found)),l==null||l.addTrace(Ks.emit_session_proposal),this.client.events.emit("session_proposal",{id:u,params:g,verifyContext:y})}catch(l){await this.sendError({id:u,topic:n,error:l,rpcOpts:kn.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(zs(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const u=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const d=await this.client.core.crypto.generateSharedKey(u,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:d});const g=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:g}),await this.client.core.pairing.activate({topic:r})}else if(Yi(n)){await this.client.proposal.delete(s,Dr("USER_DISCONNECTED"));const o=vr("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(vr("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:u,namespaces:l,sessionProperties:d,sessionConfig:g}=n.params,y=ys(tn(tn({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},d&&{sessionProperties:d}),g&&{sessionConfig:g}),{transportType:Wr.relay}),A=vr("session_connect");if(this.events.listenerCount(A)===0)throw new Error(`emitting ${A} without any listeners 997`);this.events.emit(vr("session_connect"),{session:y}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;zs(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(vr("session_approve",i),{})):Yi(n)&&(await this.client.session.delete(r,Dr("USER_DISCONNECTED")),this.events.emit(vr("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Sl.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Dr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(tn({topic:r},i));try{Sl.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(u){throw Sl.delete(o),u}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=vr("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);zs(n)?this.events.emit(vr("session_update",i),{}):Yi(n)&&this.events.emit(vr("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,En(Pu)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=vr("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);zs(n)?this.events.emit(vr("session_extend",i),{}):Yi(n)&&this.events.emit(vr("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=vr("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{zs(n)?this.events.emit(vr("session_ping",i),{}):Yi(n)&&this.events.emit(vr("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(ii.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Dr("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:u,encryptedId:l,transportType:d}=r,{id:g,params:y}=a;try{await this.isValidRequest(tn({topic:o},y));const A=this.client.session.get(o),P=await this.getVerifyContext({attestationId:u,hash:So(JSON.stringify(ha("wc_sessionRequest",y,g))),encryptedId:l,metadata:A.peer.metadata,transportType:d}),N={id:g,topic:o,params:y,verifyContext:P};await this.setPendingSessionRequest(N),d===Wr.link_mode&&(n=A.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=A.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(N):(this.addSessionRequestToSessionRequestQueue(N),this.processSessionRequestQueue())}catch(A){await this.sendError({id:g,topic:o,error:A}),this.client.logger.error(A)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=vr("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);zs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Sl.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(tn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Sl.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),zs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:u}=r;try{const{requester:l,authPayload:d,expiryTimestamp:g}=s.params,y=await this.getVerifyContext({attestationId:o,hash:So(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:u}),A={requester:l,pairingTopic:i,id:s.id,authPayload:d,verifyContext:y,expiryTimestamp:g};await this.setAuthRequest(s.id,{request:A,pairingTopic:i,transportType:u}),u===Wr.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:y})}catch(l){this.client.logger.error(l);const d=s.params.requester.publicKey,g=await this.client.core.crypto.generateKeyPair(),y=this.getAppLinkIfEnabled(s.params.requester.metadata,u),A={type:Eo,receiverPublicKey:d,senderPublicKey:g};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:A,rpcOpts:kn.wc_sessionAuthenticate.autoReject,appLink:y})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Vs.idle,this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=vr("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(vr("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Vs.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Vs.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:ha("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(bi(n)||await this.isValidPairingTopic(n),!PB(a)){const{message:u}=ut("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!bi(i)&&El(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!bi(s)&&El(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),bi(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=AB(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!yi(r))throw new Error(ut("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),u=l1(i,"approve()");if(u)throw new Error(u.message);const l=A_(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!an(s,!0)){const{message:d}=ut("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}bi(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!yi(r)){const{message:s}=ut("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!IB(i)){const{message:s}=ut("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!yi(r)){const{message:l}=ut("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!E_(n)){const{message:l}=ut("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=yB(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const u=l1(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(ua(o)){const{message:l}=ut("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=l1(i,"update()");if(o)throw new Error(o.message);const a=A_(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!S_(a,s)){const{message:u}=ut("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!CB(i)){const{message:u}=ut("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!DB(a,s,i.method)){const{message:u}=ut("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!kB(o,E1)){const{message:u}=ut("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${E1.min} and ${E1.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!yi(r)){const{message:o}=ut("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!TB(s)){const{message:o}=ut("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!yi(r)){const{message:a}=ut("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!S_(o,s)){const{message:a}=ut("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!RB(i)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!OB(o,s,i.name)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!an(i,!1))throw new Error("uri is required parameter");if(!an(s,!1))throw new Error("domain is required parameter");if(!an(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(u=>_u(u).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=_u(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,u={verified:{verifyUrl:o.verifyUrl||Ml,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Wr.link_mode){const d=this.getAppLinkIfEnabled(o,a);return u.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",u}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(u.verified.origin=l.origin,u.verified.isScam=l.isScam,u.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(u)}`),u},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!an(i,!1)){const{message:s}=ut("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,u,l,d,g,y;return!r||n!==Wr.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(u=this.client.metadata)==null?void 0:u.redirect)==null?void 0:l.universal)!==""&&((d=r==null?void 0:r.redirect)==null?void 0:d.universal)!==void 0&&((g=r==null?void 0:r.redirect)==null?void 0:g.universal)!==""&&((y=r==null?void 0:r.redirect)==null?void 0:y.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=X3(r,"topic")||"",i=decodeURIComponent(X3(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:Wr.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(n1()||Eu()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ii.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(Zd)?this.client.auth.authKeys.get(Zd):{publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===Wr.link_mode?ml:fa});try{p1(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:So(n)})):Gd(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(u){this.client.logger.error(u)}}registerExpirerEvents(){this.client.core.expirer.on(Zi.expired,async e=>{const{topic:r,id:n}=J3(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ut("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,ut("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(sc.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(sc.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(ua(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=ut("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(ua(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=ut("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=ut("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(an(e,!1)){const{message:r}=ut("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=ut("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!MB(e)){const{message:r}=ut("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(ua(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=ut("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class cq extends cc{constructor(e,r){super(e,r,Kj,x1),this.core=e,this.logger=r}}let uq=class extends cc{constructor(e,r){super(e,r,Vj,x1),this.core=e,this.logger=r}};class fq extends cc{constructor(e,r){super(e,r,Yj,x1,n=>n.id),this.core=e,this.logger=r}}class lq extends cc{constructor(e,r){super(e,r,Qj,Xd,()=>Zd),this.core=e,this.logger=r}}class hq extends cc{constructor(e,r){super(e,r,eq,Xd),this.core=e,this.logger=r}}class dq extends cc{constructor(e,r){super(e,r,tq,Xd,n=>n.id),this.core=e,this.logger=r}}class pq{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new lq(this.core,this.logger),this.pairingTopics=new hq(this.core,this.logger),this.requests=new dq(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class S1 extends jR{constructor(e){super(e),this.protocol=S6,this.version=A6,this.name=_1.name,this.events=new qi.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||_1.name,this.metadata=(e==null?void 0:e.metadata)||W3(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Zf(sd({level:(e==null?void 0:e.logger)||_1.logger}));this.core=(e==null?void 0:e.core)||new Wj(e),this.logger=ri(r,this.name),this.session=new uq(this.core,this.logger),this.proposal=new cq(this.core,this.logger),this.pendingRequest=new fq(this.core,this.logger),this.engine=new aq(this),this.auth=new pq(this.core,this.logger)}static async init(e){const r=new S1(e);return await r.initialize(),r}get context(){return gi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var Qd={exports:{}};/** + Approved: ${y.toString()}`))}),o.forEach(g=>{n||(Qa(i[g].methods,s[g].methods)?Qa(i[g].events,s[g].events)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${g}`)):n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${g}`))}),n}function NB(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function P_(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function LB(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Au(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function kB(t,e){return l1(t)&&t<=e.max&&t>=e.min}function M_(){const t=pl();return new Promise(e=>{switch(t){case Ri.browser:e($B());break;case Ri.reactNative:e(BB());break;case Ri.node:e(FB());break;default:e(!0)}})}function $B(){return dl()&&(navigator==null?void 0:navigator.onLine)}async function BB(){if(Eu()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function FB(){return!0}function UB(t){switch(pl()){case Ri.browser:jB(t);break;case Ri.reactNative:qB(t);break}}function jB(t){!Eu()&&dl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function qB(t){Eu()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const d1={};class Sl{static get(e){return d1[e]}static set(e,r){d1[e]=r}static delete(e){delete d1[e]}}const zB="PARSE_ERROR",HB="INVALID_REQUEST",WB="METHOD_NOT_FOUND",KB="INVALID_PARAMS",I_="INTERNAL_ERROR",p1="SERVER_ERROR",VB=[-32700,-32600,-32601,-32602,-32603],Al={[zB]:{code:-32700,message:"Parse error"},[HB]:{code:-32600,message:"Invalid Request"},[WB]:{code:-32601,message:"Method not found"},[KB]:{code:-32602,message:"Invalid params"},[I_]:{code:-32603,message:"Internal error"},[p1]:{code:-32e3,message:"Server error"}},C_=p1;function GB(t){return VB.includes(t)}function T_(t){return Object.keys(Al).includes(t)?Al[t]:Al[C_]}function YB(t){const e=Object.values(Al).find(r=>r.code===t);return e||Al[C_]}function R_(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var D_={},Ao={},O_;function JB(){if(O_)return Ao;O_=1,Object.defineProperty(Ao,"__esModule",{value:!0}),Ao.isBrowserCryptoAvailable=Ao.getSubtleCrypto=Ao.getBrowerCrypto=void 0;function t(){return(nn==null?void 0:nn.crypto)||(nn==null?void 0:nn.msCrypto)||{}}Ao.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Ao.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Ao.isBrowserCryptoAvailable=r,Ao}var Po={},N_;function XB(){if(N_)return Po;N_=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.isBrowser=Po.isNode=Po.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Po.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Po.isNode=e;function r(){return!t()&&!e()}return Po.isBrowser=r,Po}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Kf;e.__exportStar(JB(),t),e.__exportStar(XB(),t)})(D_);function la(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function ic(t=6){return BigInt(la(t))}function ha(t,e,r){return{id:r||la(),jsonrpc:"2.0",method:t,params:e}}function Kd(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Vd(t,e,r){return{id:t,jsonrpc:"2.0",error:ZB(e)}}function ZB(t,e){return typeof t>"u"?T_(I_):(typeof t=="string"&&(t=Object.assign(Object.assign({},T_(p1)),{message:t})),GB(t.code)&&(t=YB(t.code)),t)}let QB=class{},eF=class extends QB{constructor(){super()}},tF=class extends eF{constructor(e){super()}};const rF="^https?:",nF="^wss?:";function iF(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function L_(t,e){const r=iF(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function k_(t){return L_(t,rF)}function $_(t){return L_(t,nF)}function sF(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function B_(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function g1(t){return B_(t)&&"method"in t}function Gd(t){return B_(t)&&(zs(t)||Yi(t))}function zs(t){return"result"in t}function Yi(t){return"error"in t}let Ji=class extends tF{constructor(e){super(e),this.events=new qi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(ha(e.method,e.params||[],e.id||ic().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Yi(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Gd(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const oF=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),aF=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",F_=t=>t.split("?")[0],U_=10,cF=oF();let uF=class{constructor(e){if(this.url=e,this.events=new qi.EventEmitter,this.registering=!1,!$_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(go(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!$_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=D_.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!sF(e)},o=new cF(e,[],s);aF()?o.onerror=a=>{const u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Wa(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Vd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return R_(e,F_(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>U_&&this.events.setMaxListeners(U_)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${F_(this.url)}`));return this.events.emit("register_error",r),r}};var Yd={exports:{}};Yd.exports,function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",u="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",g="[object Date]",y="[object Error]",A="[object Function]",P="[object GeneratorFunction]",N="[object Map]",D="[object Number]",k="[object Null]",$="[object Object]",q="[object Promise]",U="[object Proxy]",K="[object RegExp]",J="[object Set]",T="[object String]",z="[object Symbol]",ue="[object Undefined]",_e="[object WeakMap]",G="[object ArrayBuffer]",E="[object DataView]",m="[object Float32Array]",f="[object Float64Array]",p="[object Int8Array]",v="[object Int16Array]",x="[object Int32Array]",_="[object Uint8Array]",S="[object Uint8ClampedArray]",b="[object Uint16Array]",M="[object Uint32Array]",I=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,O={};O[m]=O[f]=O[p]=O[v]=O[x]=O[_]=O[S]=O[b]=O[M]=!0,O[a]=O[u]=O[G]=O[d]=O[E]=O[g]=O[y]=O[A]=O[N]=O[D]=O[$]=O[K]=O[J]=O[T]=O[_e]=!1;var se=typeof nn=="object"&&nn&&nn.Object===Object&&nn,ee=typeof self=="object"&&self&&self.Object===Object&&self,X=se||ee||Function("return this")(),Q=e&&!e.nodeType&&e,R=Q&&!0&&t&&!t.nodeType&&t,Z=R&&R.exports===Q,te=Z&&se.process,le=function(){try{return te&&te.binding&&te.binding("util")}catch{}}(),ie=le&&le.isTypedArray;function fe(ce,ye){for(var Ye=-1,It=ce==null?0:ce.length,Ur=0,ir=[];++Ye-1}function st(ce,ye){var Ye=this.__data__,It=Xe(Ye,ce);return It<0?(++this.size,Ye.push([ce,ye])):Ye[It][1]=ye,this}Re.prototype.clear=De,Re.prototype.delete=it,Re.prototype.get=je,Re.prototype.has=gt,Re.prototype.set=st;function tt(ce){var ye=-1,Ye=ce==null?0:ce.length;for(this.clear();++yewn))return!1;var jr=ir.get(ce);if(jr&&ir.get(ye))return jr==ye;var gn=-1,_i=!0,xn=Ye&s?new _t:void 0;for(ir.set(ce,ye),ir.set(ye,ce);++gn-1&&ce%1==0&&ce-1&&ce%1==0&&ce<=o}function up(ce){var ye=typeof ce;return ce!=null&&(ye=="object"||ye=="function")}function Ac(ce){return ce!=null&&typeof ce=="object"}var fp=ie?Te(ie):dr;function jb(ce){return Fb(ce)?qe(ce):pr(ce)}function Fr(){return[]}function kr(){return!1}t.exports=Ub}(Yd,Yd.exports);var fF=Yd.exports;const lF=Ui(fF),j_="wc",q_=2,z_="core",Hs=`${j_}@2:${z_}:`,hF={logger:"error"},dF={database:":memory:"},pF="crypto",H_="client_ed25519_seed",gF=mt.ONE_DAY,mF="keychain",vF="0.3",bF="messages",yF="0.3",wF=mt.SIX_HOURS,xF="publisher",W_="irn",_F="error",K_="wss://relay.walletconnect.org",EF="relayer",ii={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},SF="_subscription",Xi={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},AF=.1,m1="2.17.2",Wr={link_mode:"link_mode",relay:"relay"},PF="0.3",MF="WALLETCONNECT_CLIENT_ID",V_="WALLETCONNECT_LINK_MODE_APPS",Ws={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},IF="subscription",CF="0.3",TF=mt.FIVE_SECONDS*1e3,RF="pairing",DF="0.3",Pl={wc_pairingDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:0},res:{ttl:mt.ONE_DAY,prompt:!1,tag:0}}},sc={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},vs={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},OF="history",NF="0.3",LF="expirer",Zi={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},kF="0.3",$F="verify-api",BF="https://verify.walletconnect.com",G_="https://verify.walletconnect.org",Ml=G_,FF=`${Ml}/v3`,UF=[BF,G_],jF="echo",qF="https://echo.walletconnect.com",Ks={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},Mo={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},bs={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},oc={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},ac={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Il={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},zF=.1,HF="event-client",WF=86400,KF="https://pulse.walletconnect.org/batch";function VF(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(q);k!==$;){for(var K=P[k],J=0,T=q-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=q-D;z!==q&&U[z]===0;)z++;for(var ue=u.repeat(N);z>>0,q=new Uint8Array($);P[N];){var U=r[P.charCodeAt(N)];if(U===255)return;for(var K=0,J=$-1;(U!==0||K>>0,q[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,N++}if(P[N]!==" "){for(var T=$-k;T!==$&&q[T]===0;)T++;for(var z=new Uint8Array(D+($-T)),ue=D;T!==$;)z[ue++]=q[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:g,decodeUnsafe:y,decode:A}}var GF=VF,YF=GF;const Y_=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},JF=t=>new TextEncoder().encode(t),XF=t=>new TextDecoder().decode(t);class ZF{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class QF{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return J_(this,e)}}class eU{constructor(e){this.decoders=e}or(e){return J_(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const J_=(t,e)=>new eU({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class tU{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new ZF(e,r,n),this.decoder=new QF(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Jd=({name:t,prefix:e,encode:r,decode:n})=>new tU(t,e,r,n),Cl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=YF(r,e);return Jd({prefix:t,name:e,encode:n,decode:s=>Y_(i(s))})},rU=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},nU=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Jd({prefix:e,name:t,encode(i){return nU(i,n,r)},decode(i){return rU(i,n,r,t)}}),iU=Jd({prefix:"\0",name:"identity",encode:t=>XF(t),decode:t=>JF(t)});var sU=Object.freeze({__proto__:null,identity:iU});const oU=qn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var aU=Object.freeze({__proto__:null,base2:oU});const cU=qn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var uU=Object.freeze({__proto__:null,base8:cU});const fU=Cl({prefix:"9",name:"base10",alphabet:"0123456789"});var lU=Object.freeze({__proto__:null,base10:fU});const hU=qn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),dU=qn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var pU=Object.freeze({__proto__:null,base16:hU,base16upper:dU});const gU=qn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),mU=qn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),vU=qn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),bU=qn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),yU=qn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),wU=qn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),xU=qn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),_U=qn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),EU=qn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var SU=Object.freeze({__proto__:null,base32:gU,base32upper:mU,base32pad:vU,base32padupper:bU,base32hex:yU,base32hexupper:wU,base32hexpad:xU,base32hexpadupper:_U,base32z:EU});const AU=Cl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),PU=Cl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var MU=Object.freeze({__proto__:null,base36:AU,base36upper:PU});const IU=Cl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),CU=Cl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var TU=Object.freeze({__proto__:null,base58btc:IU,base58flickr:CU});const RU=qn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),DU=qn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),OU=qn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),NU=qn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var LU=Object.freeze({__proto__:null,base64:RU,base64pad:DU,base64url:OU,base64urlpad:NU});const X_=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),kU=X_.reduce((t,e,r)=>(t[r]=e,t),[]),$U=X_.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function BU(t){return t.reduce((e,r)=>(e+=kU[r],e),"")}function FU(t){const e=[];for(const r of t){const n=$U[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const UU=Jd({prefix:"🚀",name:"base256emoji",encode:BU,decode:FU});var jU=Object.freeze({__proto__:null,base256emoji:UU}),qU=Q_,Z_=128,zU=127,HU=~zU,WU=Math.pow(2,31);function Q_(t,e,r){e=e||[],r=r||0;for(var n=r;t>=WU;)e[r++]=t&255|Z_,t/=128;for(;t&HU;)e[r++]=t&255|Z_,t>>>=7;return e[r]=t|0,Q_.bytes=r-n+1,e}var KU=v1,VU=128,e6=127;function v1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw v1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&e6)<=VU);return v1.bytes=s-n,r}var GU=Math.pow(2,7),YU=Math.pow(2,14),JU=Math.pow(2,21),XU=Math.pow(2,28),ZU=Math.pow(2,35),QU=Math.pow(2,42),ej=Math.pow(2,49),tj=Math.pow(2,56),rj=Math.pow(2,63),nj=function(t){return t(t6.encode(t,e,r),e),n6=t=>t6.encodingLength(t),b1=(t,e)=>{const r=e.byteLength,n=n6(t),i=n+n6(r),s=new Uint8Array(i+r);return r6(t,s,0),r6(r,s,n),s.set(e,i),new sj(t,r,e,s)};class sj{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const i6=({name:t,code:e,encode:r})=>new oj(t,e,r);class oj{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?b1(this.code,r):r.then(n=>b1(this.code,n))}else throw Error("Unknown type, must be binary type")}}const s6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),aj=i6({name:"sha2-256",code:18,encode:s6("SHA-256")}),cj=i6({name:"sha2-512",code:19,encode:s6("SHA-512")});var uj=Object.freeze({__proto__:null,sha256:aj,sha512:cj});const o6=0,fj="identity",a6=Y_;var lj=Object.freeze({__proto__:null,identity:{code:o6,name:fj,encode:a6,digest:t=>b1(o6,a6(t))}});new TextEncoder,new TextDecoder;const c6={...sU,...aU,...uU,...lU,...pU,...SU,...MU,...TU,...LU,...jU};({...uj,...lj});function hj(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function u6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const f6=u6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),y1=u6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=hj(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=ut("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,V3(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?G3(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}},mj=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=pF,this.randomSessionIdentifier=c1(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=wx(i);return yx(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=j$();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=wx(s),a=this.randomSessionIdentifier;return await SO(a,i,gF,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),u=q$(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||zd(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=h_(o),u=go(s);if(p_(a))return H$(u,o==null?void 0:o.encoding);if(d_(a)){const y=a.senderPublicKey,A=a.receiverPublicKey;i=await this.generateSharedKey(y,A)}const l=this.getSymKey(i),{type:d,senderPublicKey:g}=a;return z$({type:d,symKey:l,message:u,senderPublicKey:g,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=V$(s,o);if(p_(a)){const u=K$(s,o==null?void 0:o.encoding);return Wa(u)}if(d_(a)){const u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{const u=this.getSymKey(i),l=W$({symKey:u,encoded:s,encoding:o==null?void 0:o.encoding});return Wa(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=(i,s=fa)=>{const o=wl({encoded:i,encoding:s});return rc(o.type)},this.getPayloadSenderPublicKey=(i,s=fa)=>{const o=wl({encoded:i,encoding:s});return o.senderPublicKey?Tn(o.senderPublicKey,ni):void 0},this.core=e,this.logger=ri(r,this.name),this.keychain=n||new gj(this.core,this.logger)}get context(){return gi(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(H_)}catch{e=c1(),await this.keychain.set(H_,e)}return pj(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}};class vj extends DR{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=bF,this.version=yF,this.initialized=!1,this.storagePrefix=Hs,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=So(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=So(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=ri(e,this.name),this.core=r}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,V3(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?G3(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class bj extends OR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new qi.EventEmitter,this.name=xF,this.queue=new Map,this.publishTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.failedPublishTimeout=mt.toMiliseconds(mt.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||wF,u=u1(s),l=(s==null?void 0:s.prompt)||!1,d=(s==null?void 0:s.tag)||0,g=(s==null?void 0:s.id)||ic().toString(),y={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:d,id:g,attestation:s==null?void 0:s.attestation}},A=`Failed to publish payload, please try again. id:${g} tag:${d}`,P=Date.now();let N,D=1;try{for(;N===void 0;){if(Date.now()-P>this.publishTimeout)throw new Error(A);this.logger.trace({id:g,attempts:D},`publisher.publish - attempt ${D}`),N=await await Su(this.rpcPublish(n,i,a,u,l,d,g,s==null?void 0:s.attestation).catch(k=>this.logger.warn(k)),this.publishTimeout,A),D++,N||await new Promise(k=>setTimeout(k,this.failedPublishTimeout))}this.relayer.events.emit(ii.publish,y),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:g,topic:n,message:i,opts:s}})}catch(k){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(k),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw k;this.queue.set(g,y)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=ri(r,this.name),this.registerEventListeners()}get context(){return gi(this.logger)}rpcPublish(e,r,n,i,s,o,a,u){var l,d,g,y;const A={method:xl(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:u},id:a};return bi((l=A.params)==null?void 0:l.prompt)&&((d=A.params)==null||delete d.prompt),bi((g=A.params)==null?void 0:g.tag)&&((y=A.params)==null||delete y.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:A}),this.relayer.request(A)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(nu.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ii.connection_stalled);return}this.checkQueue()}),this.relayer.on(ii.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class yj{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var wj=Object.defineProperty,xj=Object.defineProperties,_j=Object.getOwnPropertyDescriptors,l6=Object.getOwnPropertySymbols,Ej=Object.prototype.hasOwnProperty,Sj=Object.prototype.propertyIsEnumerable,h6=(t,e,r)=>e in t?wj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Tl=(t,e)=>{for(var r in e||(e={}))Ej.call(e,r)&&h6(t,r,e[r]);if(l6)for(var r of l6(e))Sj.call(e,r)&&h6(t,r,e[r]);return t},w1=(t,e)=>xj(t,_j(e));class Aj extends kR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new yj,this.events=new qi.EventEmitter,this.name=IF,this.version=CF,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Hs,this.subscribeTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=u1(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new mt.Watch;a.start(i);const u=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(u),a.stop(i),s(!0)),a.elapsed(i)>=TF&&(clearInterval(u),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ri(r,this.name),this.clientId=""}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=u1(n);await this.rpcUnsubscribe(e,r,i);const s=Dr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===Wr.relay&&await this.restartToComplete();const s={method:xl(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=So(e+this.clientId);if((n==null?void 0:n.transportType)===Wr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},mt.toMiliseconds(mt.ONE_SECOND)),a;const u=await Su(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return u?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ii.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:xl(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Su(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:xl(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Su(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:xl(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,w1(Tl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Tl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Tl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Ws.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Ws.deleted,w1(Tl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Ws.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);nc(r)&&this.onBatchSubscribe(r.map((n,i)=>w1(Tl({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(nu.pulse,async()=>{await this.checkPending()}),this.events.on(Ws.created,async e=>{const r=Ws.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Ws.deleted,async e=>{const r=Ws.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var Pj=Object.defineProperty,d6=Object.getOwnPropertySymbols,Mj=Object.prototype.hasOwnProperty,Ij=Object.prototype.propertyIsEnumerable,p6=(t,e,r)=>e in t?Pj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,g6=(t,e)=>{for(var r in e||(e={}))Mj.call(e,r)&&p6(t,r,e[r]);if(d6)for(var r of d6(e))Ij.call(e,r)&&p6(t,r,e[r]);return t};class Cj extends NR{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new qi.EventEmitter,this.name=EF,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=mt.toMiliseconds(mt.THIRTY_SECONDS+mt.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||ic().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(u,l)=>{const d=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Xi.disconnect,d);const g=await o;this.provider.off(Xi.disconnect,d),u(g)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(Fd())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(ii.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ii.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Xi.payload,this.onPayloadHandler),this.provider.on(Xi.connect,this.onConnectHandler),this.provider.on(Xi.disconnect,this.onDisconnectHandler),this.provider.on(Xi.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ri(e.logger,this.name):Zf(sd({level:e.logger||_F})),this.messages=new vj(this.logger,e.core),this.subscriber=new Aj(this,this.logger),this.publisher=new bj(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||K_,this.projectId=e.projectId,this.bundleId=s$(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return gi(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Wr.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",u;const l=d=>{d.topic===e&&(this.subscriber.off(Ws.created,l),u())};return await Promise.all([new Promise(d=>{u=d,this.subscriber.on(Ws.created,l)}),new Promise(async(d,g)=>{a=await this.subscriber.subscribe(e,g6({internal:{throwOnFailedPublish:o}},r)).catch(y=>{o&&g(y)})||a,d()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Su(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Xi.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Xi.disconnect,i),await Su(this.provider.connect(),mt.toMiliseconds(mt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await M_())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=En(mt.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(ii.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(Fd())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Ji(new uF(u$({sdkVersion:m1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),g1(e)){if(!e.method.endsWith(SF))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:Wr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(g6({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else Gd(e)&&this.events.emit(ii.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ii.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Kd(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Xi.payload,this.onPayloadHandler),this.provider.off(Xi.connect,this.onConnectHandler),this.provider.off(Xi.disconnect,this.onDisconnectHandler),this.provider.off(Xi.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await M_();UB(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(ii.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},mt.toMiliseconds(AF))))}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var Tj=Object.defineProperty,m6=Object.getOwnPropertySymbols,Rj=Object.prototype.hasOwnProperty,Dj=Object.prototype.propertyIsEnumerable,v6=(t,e,r)=>e in t?Tj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b6=(t,e)=>{for(var r in e||(e={}))Rj.call(e,r)&&v6(t,r,e[r]);if(m6)for(var r of m6(e))Dj.call(e,r)&&v6(t,r,e[r]);return t};class cc extends LR{constructor(e,r,n,i=Hs,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=PF,this.cached=[],this.initialized=!1,this.storagePrefix=Hs,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!bi(o)?this.map.set(this.getKey(o),o):vB(o)?this.map.set(o.id,o):bB(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>lF(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const u=b6(b6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=ri(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Oj{constructor(e,r){this.core=e,this.logger=r,this.name=RF,this.version=DF,this.events=new Yg,this.initialized=!1,this.storagePrefix=Hs,this.ignoredPayloadTypes=[Eo],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=c1(),s=await this.core.crypto.setSymKey(i),o=En(mt.FIVE_MINUTES),a={protocol:W_},u={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=y_({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(sc.create,u),this.core.expirer.set(s,o),await this.pairings.set(s,u),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Ks.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:u,methods:l}=b_(n.uri);i.props.properties.topic=s,i.addTrace(Ks.pairing_uri_validation_success),i.addTrace(Ks.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(Ks.existing_pairing),d.active)throw i.setError(Mo.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Ks.pairing_not_expired)}const g=u||En(mt.FIVE_MINUTES),y={topic:s,relay:a,expiry:g,active:!1,methods:l};this.core.expirer.set(s,g),await this.pairings.set(s,y),i.addTrace(Ks.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(sc.create,y),i.addTrace(Ks.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Ks.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Mo.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(A){throw i.setError(Mo.subscribe_pairing_topic_failure),A}return i.addTrace(Ks.subscribe_pairing_topic_success),y},this.activate=async({topic:n})=>{this.isInitialized();const i=En(mt.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=ec();this.events.once(vr("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Dr("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,u=this.core.crypto.keychain.get(i);return y_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:u,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=ha(i,s),a=await this.core.crypto.encode(n,o),u=Pl[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{const o=Kd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Pl[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=Vd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Pl[u.request.method]?Pl[u.request.method].res:Pl.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Dr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>ua(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(sc.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{zs(i)?this.events.emit(vr("pairing_ping",s),{}):Yi(i)&&this.events.emit(vr("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(sc.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Dr("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Dr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!yi(n)){const{message:a}=ut("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Mo.malformed_pairing_uri),new Error(a)}if(!mB(n.uri)){const{message:a}=ut("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Mo.malformed_pairing_uri),new Error(a)}const o=b_(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Mo.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Mo.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&mt.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!an(n,!1)){const{message:i}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ua(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ut("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=ri(r,this.name),this.pairings=new cc(this.core,this.logger,this.name,this.storagePrefix)}get context(){return gi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ii.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===Wr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{g1(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):Gd(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Zi.expired,async e=>{const{topic:r}=J3(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(sc.expire,{topic:r}))})}}class Nj extends RR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new qi.EventEmitter,this.name=OF,this.version=NF,this.cached=[],this.initialized=!1,this.storagePrefix=Hs,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:En(mt.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(vs.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Yi(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(vs.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(vs.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:ha(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(vs.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(vs.created,e=>{const r=vs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(vs.updated,e=>{const r=vs.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(vs.deleted,e=>{const r=vs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(nu.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{mt.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(vs.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Lj extends $R{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new qi.EventEmitter,this.name=LF,this.version=kF,this.cached=[],this.initialized=!1,this.storagePrefix=Hs,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Zi.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Zi.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return f$(e);if(typeof e=="number")return l$(e);const{message:r}=ut("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Zi.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;mt.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Zi.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(nu.pulse,()=>this.checkExpirations()),this.events.on(Zi.created,e=>{const r=Zi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.expired,e=>{const r=Zi.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.deleted,e=>{const r=Zi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class kj extends BR{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=$F,this.verifyUrlV3=FF,this.storagePrefix=Hs,this.version=q_,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&mt.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!dl()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,u=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=rl(),d=this.startAbortTimer(mt.ONE_SECOND*5),g=await new Promise((y,A)=>{const P=()=>{window.removeEventListener("message",D),l.body.removeChild(N),A("attestation aborted")};this.abortController.signal.addEventListener("abort",P);const N=l.createElement("iframe");N.src=u,N.style.display="none",N.addEventListener("error",P,{signal:this.abortController.signal});const D=k=>{if(k.data&&typeof k.data=="string")try{const $=JSON.parse(k.data);if($.type==="verify_attestation"){if(gm($.attestation).payload.id!==o)return;clearInterval(d),l.body.removeChild(N),this.abortController.signal.removeEventListener("abort",P),window.removeEventListener("message",D),y($.attestation===null?"":$.attestation)}}catch($){this.logger.warn($)}};l.body.appendChild(N),window.addEventListener("message",D,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",g),g}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(gm(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const u=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,u)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(mt.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Ml;return UF.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Ml}`),s=Ml),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(mt.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=X$(i,s.publicKey),a={hasExpired:mt.toMiliseconds(o.exp)this.abortController.abort(),mt.toMiliseconds(e))}}class $j extends FR{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=jF,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${qF}/${this.projectId}/clients`;await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=ri(r,this.context)}}var Bj=Object.defineProperty,y6=Object.getOwnPropertySymbols,Fj=Object.prototype.hasOwnProperty,Uj=Object.prototype.propertyIsEnumerable,w6=(t,e,r)=>e in t?Bj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rl=(t,e)=>{for(var r in e||(e={}))Fj.call(e,r)&&w6(t,r,e[r]);if(y6)for(var r of y6(e))Uj.call(e,r)&&w6(t,r,e[r]);return t};class jj extends UR{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=HF,this.storagePrefix=Hs,this.storageVersion=zF,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!i1())try{const i={eventId:Z3(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:K3(this.core.relayer.protocol,this.core.relayer.version,m1)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:u}}=i,l=Z3(),d=this.core.projectId||"",g=Date.now(),y=Rl({eventId:l,timestamp:g,props:{event:s,type:o,properties:{topic:a,trace:u}},bundleId:d,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,y),this.shouldPersist=!0),y},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(u=>u.props.properties.topic===o);if(a)return Rl(Rl({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(nu.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{mt.fromMiliseconds(Date.now())-mt.fromMiliseconds(i.timestamp)>WF&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Rl(Rl({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${KF}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${m1}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>W3().url,this.logger=ri(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var qj=Object.defineProperty,x6=Object.getOwnPropertySymbols,zj=Object.prototype.hasOwnProperty,Hj=Object.prototype.propertyIsEnumerable,_6=(t,e,r)=>e in t?qj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,E6=(t,e)=>{for(var r in e||(e={}))zj.call(e,r)&&_6(t,r,e[r]);if(x6)for(var r of x6(e))Hj.call(e,r)&&_6(t,r,e[r]);return t};class x1 extends TR{constructor(e){var r;super(e),this.protocol=j_,this.version=q_,this.name=z_,this.events=new qi.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:u})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:Wr.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||K_,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=sd({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:hF.logger}),{logger:i,chunkLoggerController:s}=CR({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ri(i,this.name),this.heartbeat=new ET,this.crypto=new mj(this,this.logger,e==null?void 0:e.keychain),this.history=new Nj(this,this.logger),this.expirer=new Lj(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new tR(E6(E6({},dF),e==null?void 0:e.storageOptions)),this.relayer=new Cj({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Oj(this,this.logger),this.verify=new kj(this,this.logger,this.storage),this.echoClient=new $j(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new jj(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new x1(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(MF,n),r}get context(){return gi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(V_,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(V_)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const Wj=x1,S6="wc",A6=2,P6="client",_1=`${S6}@${A6}:${P6}:`,E1={name:P6,logger:"error"},M6="WALLETCONNECT_DEEPLINK_CHOICE",Kj="proposal",I6="Proposal expired",Vj="session",Pu=mt.SEVEN_DAYS,Gj="engine",kn={wc_sessionPropose:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:mt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:mt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1119}}},S1={min:mt.FIVE_MINUTES,max:mt.SEVEN_DAYS},Vs={idle:"IDLE",active:"ACTIVE"},Yj="request",Jj=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],Xj="wc",Zj="auth",Qj="authKeys",eq="pairingTopics",tq="requests",Xd=`${Xj}@${1.5}:${Zj}:`,Zd=`${Xd}:PUB_KEY`;var rq=Object.defineProperty,nq=Object.defineProperties,iq=Object.getOwnPropertyDescriptors,C6=Object.getOwnPropertySymbols,sq=Object.prototype.hasOwnProperty,oq=Object.prototype.propertyIsEnumerable,T6=(t,e,r)=>e in t?rq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))sq.call(e,r)&&T6(t,r,e[r]);if(C6)for(var r of C6(e))oq.call(e,r)&&T6(t,r,e[r]);return t},ys=(t,e)=>nq(t,iq(e));class aq extends qR{constructor(e){super(e),this.name=Gj,this.events=new Yg,this.initialized=!1,this.requestQueue={state:Vs.idle,queue:[]},this.sessionRequestQueue={state:Vs.idle,queue:[]},this.requestQueueDelay=mt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(kn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=ys(tn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n;let l=i,d,g=!1;try{l&&(g=this.client.core.pairing.pairings.get(l).active)}catch(U){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),U}if(!l||!g){const{topic:U,uri:K}=await this.client.core.pairing.create();l=U,d=K}if(!l){const{message:U}=ut("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(U)}const y=await this.client.core.crypto.generateKeyPair(),A=kn.wc_sessionPropose.req.ttl||mt.FIVE_MINUTES,P=En(A),N=tn({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:W_}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:P,pairingTopic:l},a&&{sessionProperties:a}),{reject:D,resolve:k,done:$}=ec(A,I6);this.events.once(vr("session_connect"),async({error:U,session:K})=>{if(U)D(U);else if(K){K.self.publicKey=y;const J=ys(tn({},K),{pairingTopic:N.pairingTopic,requiredNamespaces:N.requiredNamespaces,optionalNamespaces:N.optionalNamespaces,transportType:Wr.relay});await this.client.session.set(K.topic,J),await this.setExpiry(K.topic,K.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:K.peer.metadata}),this.cleanupDuplicatePairings(J),k(J)}});const q=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:N,throwOnFailedPublish:!0});return await this.setProposal(q,tn({id:q},N)),{uri:d,approval:$}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[bs.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(z){throw o.setError(oc.no_internet_connection),z}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(z){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(oc.proposal_not_found),z}try{await this.isValidApprove(r)}catch(z){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(oc.session_approve_namespace_validation_failure),z}const{id:a,relayProtocol:u,namespaces:l,sessionProperties:d,sessionConfig:g}=r,y=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:A,proposer:P,requiredNamespaces:N,optionalNamespaces:D}=y;let k=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:A});k||(k=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:bs.session_approve_started,properties:{topic:A,trace:[bs.session_approve_started,bs.session_namespaces_validation_success]}}));const $=await this.client.core.crypto.generateKeyPair(),q=P.publicKey,U=await this.client.core.crypto.generateSharedKey($,q),K=tn(tn({relay:{protocol:u??"irn"},namespaces:l,controller:{publicKey:$,metadata:this.client.metadata},expiry:En(Pu)},d&&{sessionProperties:d}),g&&{sessionConfig:g}),J=Wr.relay;k.addTrace(bs.subscribing_session_topic);try{await this.client.core.relayer.subscribe(U,{transportType:J})}catch(z){throw k.setError(oc.subscribe_session_topic_failure),z}k.addTrace(bs.subscribe_session_topic_success);const T=ys(tn({},K),{topic:U,requiredNamespaces:N,optionalNamespaces:D,pairingTopic:A,acknowledged:!1,self:K.controller,peer:{publicKey:P.publicKey,metadata:P.metadata},controller:$,transportType:Wr.relay});await this.client.session.set(U,T),k.addTrace(bs.store_session);try{k.addTrace(bs.publishing_session_settle),await this.sendRequest({topic:U,method:"wc_sessionSettle",params:K,throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(oc.session_settle_publish_failure),z}),k.addTrace(bs.session_settle_publish_success),k.addTrace(bs.publishing_session_approve),await this.sendResult({id:a,topic:A,result:{relay:{protocol:u??"irn"},responderPublicKey:$},throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(oc.session_approve_publish_failure),z}),k.addTrace(bs.session_approve_publish_success)}catch(z){throw this.client.logger.error(z),this.client.session.delete(U,Dr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(U),z}return this.client.core.eventClient.deleteEvent({eventId:k.eventId}),await this.client.core.pairing.updateMetadata({topic:A,metadata:P.metadata}),await this.client.proposal.delete(a,Dr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:A}),await this.setExpiry(U,En(Pu)),{topic:U,acknowledged:()=>Promise.resolve(this.client.session.get(U))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:kn.wc_sessionPropose.reject}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(g){throw this.client.logger.error("update() -> isValidUpdate() failed"),g}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=ec(),u=la(),l=ic().toString(),d=this.client.session.get(n).namespaces;return this.events.once(vr("session_update",u),({error:g})=>{g?a(g):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:u,relayRpcId:l}).catch(g=>{this.client.logger.error(g),this.client.session.update(n,{namespaces:d}),a(g)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(u){throw this.client.logger.error("extend() -> isValidExtend() failed"),u}const{topic:n}=r,i=la(),{done:s,resolve:o,reject:a}=ec();return this.events.once(vr("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,En(Pu)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(u=>{a(u)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(P){throw this.client.logger.error("request() -> isValidRequest() failed"),P}const{chainId:n,request:i,topic:s,expiry:o=kn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=la(),l=ic().toString(),{done:d,resolve:g,reject:y}=ec(o,"Request expired. Please try again.");this.events.once(vr("session_request",u),({error:P,result:N})=>{P?y(P):g(N)});const A=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return A?(await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ys(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:A}).catch(P=>y(P)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),await d()):await Promise.all([new Promise(async P=>{await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ys(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(N=>y(N)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),P()}),new Promise(async P=>{var N;if(!((N=a.sessionConfig)!=null&&N.disableDeepLink)){const D=await p$(this.client.core.storage,M6);await h$({id:u,topic:s,wcDeepLink:D})}P()}),d()]).then(P=>P[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);zs(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Yi(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=la(),s=ic().toString(),{done:o,resolve:a,reject:u}=ec();this.events.once(vr("session_ping",i),({error:l})=>{l?u(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=ic().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Dr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ut("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>pB(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?Wr.link_mode:Wr.relay;o===Wr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:u="",uri:l,domain:d,nonce:g,type:y,exp:A,nbf:P,methods:N=[],expiry:D}=r,k=[...r.resources||[]],{topic:$,uri:q}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:$,uri:q}});const U=await this.client.core.crypto.generateKeyPair(),K=zd(U);if(await Promise.all([this.client.auth.authKeys.set(Zd,{responseTopic:K,publicKey:U}),this.client.auth.pairingTopics.set(K,{topic:K,pairingTopic:$})]),await this.client.core.relayer.subscribe(K,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${$}`),N.length>0){const{namespace:_}=_u(a[0]);let S=L$(_,"request",N);qd(k)&&(S=$$(S,k.pop())),k.push(S)}const J=D&&D>kn.wc_sessionAuthenticate.req.ttl?D:kn.wc_sessionAuthenticate.req.ttl,T={authPayload:{type:y??"caip122",chains:a,statement:u,aud:l,domain:d,version:"1",nonce:g,iat:new Date().toISOString(),exp:A,nbf:P,resources:k},requester:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(J)},z={eip155:{chains:a,methods:[...new Set(["personal_sign",...N])],events:["chainChanged","accountsChanged"]}},ue={requiredNamespaces:{},optionalNamespaces:z,relays:[{protocol:"irn"}],pairingTopic:$,proposer:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(kn.wc_sessionPropose.req.ttl)},{done:_e,resolve:G,reject:E}=ec(J,"Request expired"),m=async({error:_,session:S})=>{if(this.events.off(vr("session_request",p),f),_)E(_);else if(S){S.self.publicKey=U,await this.client.session.set(S.topic,S),await this.setExpiry(S.topic,S.expiry),$&&await this.client.core.pairing.updateMetadata({topic:$,metadata:S.peer.metadata});const b=this.client.session.get(S.topic);await this.deleteProposal(v),G({session:b})}},f=async _=>{var S,b,M;if(await this.deletePendingAuthRequest(p,{message:"fulfilled",code:0}),_.error){const X=Dr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return _.error.code===X.code?void 0:(this.events.off(vr("session_connect"),m),E(_.error.message))}await this.deleteProposal(v),this.events.off(vr("session_connect"),m);const{cacaos:I,responder:F}=_.result,ae=[],O=[];for(const X of I){await r_({cacao:X,projectId:this.client.core.projectId})||(this.client.logger.error(X,"Signature verification failed"),E(Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Q}=X,R=qd(Q.resources),Z=[o1(Q.iss)],te=jd(Q.iss);if(R){const le=s_(R),ie=o_(R);ae.push(...le),Z.push(...ie)}for(const le of Z)O.push(`${le}:${te}`)}const se=await this.client.core.crypto.generateSharedKey(U,F.publicKey);let ee;ae.length>0&&(ee={topic:se,acknowledged:!0,self:{publicKey:U,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:En(Pu),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:$,namespaces:w_([...new Set(ae)],[...new Set(O)]),transportType:o},await this.client.core.relayer.subscribe(se,{transportType:o}),await this.client.session.set(se,ee),$&&await this.client.core.pairing.updateMetadata({topic:$,metadata:F.metadata}),ee=this.client.session.get(se)),(S=this.client.metadata.redirect)!=null&&S.linkMode&&(b=F.metadata.redirect)!=null&&b.linkMode&&(M=F.metadata.redirect)!=null&&M.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(se,{transportType:Wr.link_mode})),G({auths:I,session:ee})},p=la(),v=la();this.events.once(vr("session_connect"),m),this.events.once(vr("session_request",p),f);let x;try{if(s){const _=ha("wc_sessionAuthenticate",T,p);this.client.core.history.set($,_);const S=await this.client.core.crypto.encode("",_,{type:bl,encoding:ml});x=Hd(n,$,S)}else await Promise.all([this.sendRequest({topic:$,method:"wc_sessionAuthenticate",params:T,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:p}),this.sendRequest({topic:$,method:"wc_sessionPropose",params:ue,expiry:kn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:v})])}catch(_){throw this.events.off(vr("session_connect"),m),this.events.off(vr("session_request",p),f),_}return await this.setProposal(v,tn({id:v},ue)),await this.setAuthRequest(p,{request:ys(tn({},T),{verifyContext:{}}),pairingTopic:$,transportType:o}),{uri:x??q,response:_e}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[ac.authenticated_session_approve_started]}});try{this.isInitialized()}catch(D){throw s.setError(Il.no_internet_connection),D}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Il.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||Wr.relay;a===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=zd(u),g={type:Eo,receiverPublicKey:u,senderPublicKey:l},y=[],A=[];for(const D of i){if(!await r_({cacao:D,projectId:this.client.core.projectId})){s.setError(Il.invalid_cacao);const K=Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:K,encodeOpts:g}),new Error(K.message)}s.addTrace(ac.cacaos_verified);const{p:k}=D,$=qd(k.resources),q=[o1(k.iss)],U=jd(k.iss);if($){const K=s_($),J=o_($);y.push(...K),q.push(...J)}for(const K of q)A.push(`${K}:${U}`)}const P=await this.client.core.crypto.generateSharedKey(l,u);s.addTrace(ac.create_authenticated_session_topic);let N;if((y==null?void 0:y.length)>0){N={topic:P,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:u,metadata:o.requester.metadata},controller:u,expiry:En(Pu),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:w_([...new Set(y)],[...new Set(A)]),transportType:a},s.addTrace(ac.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(P,{transportType:a})}catch(D){throw s.setError(Il.subscribe_authenticated_session_topic_failure),D}s.addTrace(ac.subscribe_authenticated_session_topic_success),await this.client.session.set(P,N),s.addTrace(ac.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(ac.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:g,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(D){throw s.setError(Il.authenticated_session_approve_publish_failure),D}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:N}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),u=zd(o),l={type:Eo,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:u,error:i,encodeOpts:l,rpcOpts:kn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return n_(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:u}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Dr("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(M6).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,Dr("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Vs.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(oc.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Dr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Vs.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,En(kn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=Wr.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||En(kn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l,appLink:d}=r,g=ha(i,s,u);let y;const A=!!d;try{const D=A?ml:fa;y=await this.client.core.crypto.encode(n,g,{encoding:D})}catch(D){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),D}let P;if(Jj.includes(i)){const D=So(JSON.stringify(g)),k=So(y);P=await this.client.core.verify.register({id:k,decryptedId:D})}const N=kn[i].req;if(N.attestation=P,o&&(N.ttl=o),a&&(N.id=a),this.client.core.history.set(n,g),A){const D=Hd(d,n,y);await global.Linking.openURL(D,this.client.name)}else{const D=kn[i].req;o&&(D.ttl=o),a&&(D.id=a),l?(D.internal=ys(tn({},D.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,y,D)):this.client.core.relayer.publish(n,y,D).catch(k=>this.client.logger.error(k))}return g.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:u}=r,l=Kd(n,s);let d;const g=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=g?ml:fa;d=await this.client.core.crypto.encode(i,l,ys(tn({},a||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),A}if(g){const A=Hd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=kn[y.request.method].res;o?(A.internal=ys(tn({},A.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,A)):this.client.core.relayer.publish(i,d,A).catch(P=>this.client.logger.error(P))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:u}=r,l=Vd(n,s);let d;const g=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=g?ml:fa;d=await this.client.core.crypto.encode(i,l,ys(tn({},o||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),A}if(g){const A=Hd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=a||kn[y.request.method].res;this.client.core.relayer.publish(i,d,A)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;ua(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{ua(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Vs.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Vs.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Vs.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,u=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:u}))switch(u){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=ut("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:u}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(tn({},i.params));const d=a.expiryTimestamp||En(kn.wc_sessionPropose.req.ttl),g=tn({id:u,pairingTopic:n,expiryTimestamp:d},a);await this.setProposal(u,g);const y=await this.getVerifyContext({attestationId:s,hash:So(JSON.stringify(i)),encryptedId:o,metadata:g.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(Mo.proposal_listener_not_found)),l==null||l.addTrace(Ks.emit_session_proposal),this.client.events.emit("session_proposal",{id:u,params:g,verifyContext:y})}catch(l){await this.sendError({id:u,topic:n,error:l,rpcOpts:kn.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(zs(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const u=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const d=await this.client.core.crypto.generateSharedKey(u,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:d});const g=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:g}),await this.client.core.pairing.activate({topic:r})}else if(Yi(n)){await this.client.proposal.delete(s,Dr("USER_DISCONNECTED"));const o=vr("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(vr("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:u,namespaces:l,sessionProperties:d,sessionConfig:g}=n.params,y=ys(tn(tn({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},d&&{sessionProperties:d}),g&&{sessionConfig:g}),{transportType:Wr.relay}),A=vr("session_connect");if(this.events.listenerCount(A)===0)throw new Error(`emitting ${A} without any listeners 997`);this.events.emit(vr("session_connect"),{session:y}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;zs(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(vr("session_approve",i),{})):Yi(n)&&(await this.client.session.delete(r,Dr("USER_DISCONNECTED")),this.events.emit(vr("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Sl.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Dr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(tn({topic:r},i));try{Sl.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(u){throw Sl.delete(o),u}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=vr("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);zs(n)?this.events.emit(vr("session_update",i),{}):Yi(n)&&this.events.emit(vr("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,En(Pu)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=vr("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);zs(n)?this.events.emit(vr("session_extend",i),{}):Yi(n)&&this.events.emit(vr("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=vr("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{zs(n)?this.events.emit(vr("session_ping",i),{}):Yi(n)&&this.events.emit(vr("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(ii.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Dr("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:u,encryptedId:l,transportType:d}=r,{id:g,params:y}=a;try{await this.isValidRequest(tn({topic:o},y));const A=this.client.session.get(o),P=await this.getVerifyContext({attestationId:u,hash:So(JSON.stringify(ha("wc_sessionRequest",y,g))),encryptedId:l,metadata:A.peer.metadata,transportType:d}),N={id:g,topic:o,params:y,verifyContext:P};await this.setPendingSessionRequest(N),d===Wr.link_mode&&(n=A.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=A.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(N):(this.addSessionRequestToSessionRequestQueue(N),this.processSessionRequestQueue())}catch(A){await this.sendError({id:g,topic:o,error:A}),this.client.logger.error(A)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=vr("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);zs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Sl.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(tn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Sl.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),zs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:u}=r;try{const{requester:l,authPayload:d,expiryTimestamp:g}=s.params,y=await this.getVerifyContext({attestationId:o,hash:So(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:u}),A={requester:l,pairingTopic:i,id:s.id,authPayload:d,verifyContext:y,expiryTimestamp:g};await this.setAuthRequest(s.id,{request:A,pairingTopic:i,transportType:u}),u===Wr.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:y})}catch(l){this.client.logger.error(l);const d=s.params.requester.publicKey,g=await this.client.core.crypto.generateKeyPair(),y=this.getAppLinkIfEnabled(s.params.requester.metadata,u),A={type:Eo,receiverPublicKey:d,senderPublicKey:g};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:A,rpcOpts:kn.wc_sessionAuthenticate.autoReject,appLink:y})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Vs.idle,this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=vr("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(vr("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Vs.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Vs.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:ha("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(bi(n)||await this.isValidPairingTopic(n),!PB(a)){const{message:u}=ut("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!bi(i)&&El(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!bi(s)&&El(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),bi(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=AB(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!yi(r))throw new Error(ut("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),u=h1(i,"approve()");if(u)throw new Error(u.message);const l=A_(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!an(s,!0)){const{message:d}=ut("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}bi(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!yi(r)){const{message:s}=ut("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!IB(i)){const{message:s}=ut("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!yi(r)){const{message:l}=ut("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!E_(n)){const{message:l}=ut("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=yB(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const u=h1(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(ua(o)){const{message:l}=ut("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=h1(i,"update()");if(o)throw new Error(o.message);const a=A_(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!S_(a,s)){const{message:u}=ut("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!CB(i)){const{message:u}=ut("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!DB(a,s,i.method)){const{message:u}=ut("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!kB(o,S1)){const{message:u}=ut("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${S1.min} and ${S1.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!yi(r)){const{message:o}=ut("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!TB(s)){const{message:o}=ut("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!yi(r)){const{message:a}=ut("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!S_(o,s)){const{message:a}=ut("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!RB(i)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!OB(o,s,i.name)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!an(i,!1))throw new Error("uri is required parameter");if(!an(s,!1))throw new Error("domain is required parameter");if(!an(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(u=>_u(u).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=_u(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,u={verified:{verifyUrl:o.verifyUrl||Ml,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Wr.link_mode){const d=this.getAppLinkIfEnabled(o,a);return u.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",u}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(u.verified.origin=l.origin,u.verified.isScam=l.isScam,u.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(u)}`),u},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!an(i,!1)){const{message:s}=ut("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,u,l,d,g,y;return!r||n!==Wr.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(u=this.client.metadata)==null?void 0:u.redirect)==null?void 0:l.universal)!==""&&((d=r==null?void 0:r.redirect)==null?void 0:d.universal)!==void 0&&((g=r==null?void 0:r.redirect)==null?void 0:g.universal)!==""&&((y=r==null?void 0:r.redirect)==null?void 0:y.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=X3(r,"topic")||"",i=decodeURIComponent(X3(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:Wr.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(i1()||Eu()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ii.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(Zd)?this.client.auth.authKeys.get(Zd):{publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===Wr.link_mode?ml:fa});try{g1(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:So(n)})):Gd(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(u){this.client.logger.error(u)}}registerExpirerEvents(){this.client.core.expirer.on(Zi.expired,async e=>{const{topic:r,id:n}=J3(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ut("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,ut("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(sc.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(sc.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(ua(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=ut("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(ua(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=ut("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=ut("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(an(e,!1)){const{message:r}=ut("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=ut("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!MB(e)){const{message:r}=ut("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(ua(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=ut("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class cq extends cc{constructor(e,r){super(e,r,Kj,_1),this.core=e,this.logger=r}}let uq=class extends cc{constructor(e,r){super(e,r,Vj,_1),this.core=e,this.logger=r}};class fq extends cc{constructor(e,r){super(e,r,Yj,_1,n=>n.id),this.core=e,this.logger=r}}class lq extends cc{constructor(e,r){super(e,r,Qj,Xd,()=>Zd),this.core=e,this.logger=r}}class hq extends cc{constructor(e,r){super(e,r,eq,Xd),this.core=e,this.logger=r}}class dq extends cc{constructor(e,r){super(e,r,tq,Xd,n=>n.id),this.core=e,this.logger=r}}class pq{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new lq(this.core,this.logger),this.pairingTopics=new hq(this.core,this.logger),this.requests=new dq(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class A1 extends jR{constructor(e){super(e),this.protocol=S6,this.version=A6,this.name=E1.name,this.events=new qi.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||E1.name,this.metadata=(e==null?void 0:e.metadata)||W3(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Zf(sd({level:(e==null?void 0:e.logger)||E1.logger}));this.core=(e==null?void 0:e.core)||new Wj(e),this.logger=ri(r,this.name),this.session=new uq(this.core,this.logger),this.proposal=new cq(this.core,this.logger),this.pendingRequest=new fq(this.core,this.logger),this.engine=new aq(this),this.auth=new pq(this.core,this.logger)}static async init(e){const r=new A1(e);return await r.initialize(),r}get context(){return gi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var Qd={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */Qd.exports,function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",l=500,d="__lodash_placeholder__",g=1,y=2,A=4,P=1,N=2,D=1,k=2,$=4,q=8,U=16,K=32,J=64,T=128,z=256,ue=512,_e=30,G="...",E=800,m=16,f=1,p=2,v=3,x=1/0,_=9007199254740991,S=17976931348623157e292,b=NaN,M=4294967295,I=M-1,F=M>>>1,ae=[["ary",T],["bind",D],["bindKey",k],["curry",q],["curryRight",U],["flip",ue],["partial",K],["partialRight",J],["rearg",z]],O="[object Arguments]",se="[object Array]",ee="[object AsyncFunction]",X="[object Boolean]",Q="[object Date]",R="[object DOMException]",Z="[object Error]",te="[object Function]",le="[object GeneratorFunction]",ie="[object Map]",fe="[object Number]",ve="[object Null]",Me="[object Object]",Ne="[object Promise]",Te="[object Proxy]",Be="[object RegExp]",Ie="[object Set]",Le="[object String]",Ve="[object Symbol]",ke="[object Undefined]",ze="[object WeakMap]",He="[object WeakSet]",Ee="[object ArrayBuffer]",Qe="[object DataView]",ct="[object Float32Array]",$e="[object Float64Array]",et="[object Int8Array]",rt="[object Int16Array]",Je="[object Int32Array]",pt="[object Uint8Array]",ht="[object Uint8ClampedArray]",ft="[object Uint16Array]",Ht="[object Uint32Array]",Jt=/\b__p \+= '';/g,St=/\b(__p \+=) '' \+/g,er=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Xt=/&(?:amp|lt|gt|quot|#39);/g,Ot=/[&<>"']/g,$t=RegExp(Xt.source),Tt=RegExp(Ot.source),vt=/<%-([\s\S]+?)%>/g,Dt=/<%([\s\S]+?)%>/g,Lt=/<%=([\s\S]+?)%>/g,bt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Bt=/^\w*$/,Ut=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(nt.source),B=/^\s+/,H=/\s/,V=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C=/\{\n\/\* \[wrapped with (.+)\] \*/,Y=/,? & /,j=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,oe=/[()=,{}\[\]\/\s]/,pe=/\\(\\)?/g,xe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Re=/\w*$/,De=/^[-+]0x[0-9a-f]+$/i,it=/^0b[01]+$/i,je=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,st=/^(?:0|[1-9]\d*)$/,tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,Rt=/['\n\r\u2028\u2029\\]/g,Mt="\\ud800-\\udfff",Et="\\u0300-\\u036f",dt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",ot=Et+dt+_t,wt="\\u2700-\\u27bf",lt="a-z\\xdf-\\xf6\\xf8-\\xff",at="\\xac\\xb1\\xd7\\xf7",Se="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ae="\\u2000-\\u206f",Ge=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ue="A-Z\\xc0-\\xd6\\xd8-\\xde",qe="\\ufe0e\\ufe0f",Xe=at+Se+Ae+Ge,kt="['’]",Wt="["+Mt+"]",Zt="["+Xe+"]",Kt="["+ot+"]",de="\\d+",nr="["+wt+"]",dr="["+lt+"]",pr="[^"+Mt+Xe+de+wt+lt+Ue+"]",Qt="\\ud83c[\\udffb-\\udfff]",gr="(?:"+Kt+"|"+Qt+")",lr="[^"+Mt+"]",Lr="(?:\\ud83c[\\udde6-\\uddff]){2}",mr="[\\ud800-\\udbff][\\udc00-\\udfff]",wr="["+Ue+"]",$r="\\u200d",Br="(?:"+dr+"|"+pr+")",Ir="(?:"+wr+"|"+pr+")",hn="(?:"+kt+"(?:d|ll|m|re|s|t|ve))?",dn="(?:"+kt+"(?:D|LL|M|RE|S|T|VE))?",pn=gr+"?",sp="["+qe+"]?",$b="(?:"+$r+"(?:"+[lr,Lr,mr].join("|")+")"+sp+pn+")*",Fo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",op="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ap=sp+pn+$b,Zu="(?:"+[nr,Lr,mr].join("|")+")"+ap,Bb="(?:"+[lr+Kt+"?",Kt,Lr,mr,Wt].join("|")+")",ph=RegExp(kt,"g"),Fb=RegExp(Kt,"g"),Qu=RegExp(Qt+"(?="+Qt+")|"+Bb+ap,"g"),cp=RegExp([wr+"?"+dr+"+"+hn+"(?="+[Zt,wr,"$"].join("|")+")",Ir+"+"+dn+"(?="+[Zt,wr+Br,"$"].join("|")+")",wr+"?"+Br+"+"+hn,wr+"+"+dn,op,Fo,de,Zu].join("|"),"g"),up=RegExp("["+$r+Mt+ot+qe+"]"),Ac=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ub=-1,Fr={};Fr[ct]=Fr[$e]=Fr[et]=Fr[rt]=Fr[Je]=Fr[pt]=Fr[ht]=Fr[ft]=Fr[Ht]=!0,Fr[O]=Fr[se]=Fr[Ee]=Fr[X]=Fr[Qe]=Fr[Q]=Fr[Z]=Fr[te]=Fr[ie]=Fr[fe]=Fr[Me]=Fr[Be]=Fr[Ie]=Fr[Le]=Fr[ze]=!1;var kr={};kr[O]=kr[se]=kr[Ee]=kr[Qe]=kr[X]=kr[Q]=kr[ct]=kr[$e]=kr[et]=kr[rt]=kr[Je]=kr[ie]=kr[fe]=kr[Me]=kr[Be]=kr[Ie]=kr[Le]=kr[Ve]=kr[pt]=kr[ht]=kr[ft]=kr[Ht]=!0,kr[Z]=kr[te]=kr[ze]=!1;var ce={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ye={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye={"&":"&","<":"<",">":">",""":'"',"'":"'"},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ur=parseFloat,ir=parseInt,Yr=typeof nn=="object"&&nn&&nn.Object===Object&&nn,wn=typeof self=="object"&&self&&self.Object===Object&&self,_r=Yr||wn||Function("return this")(),jr=e&&!e.nodeType&&e,gn=jr&&!0&&t&&!t.nodeType&&t,_i=gn&&gn.exports===jr,xn=_i&&Yr.process,Jr=function(){try{var be=gn&&gn.require&&gn.require("util").types;return be||xn&&xn.binding&&xn.binding("util")}catch{}}(),oi=Jr&&Jr.isArrayBuffer,As=Jr&&Jr.isDate,ns=Jr&&Jr.isMap,to=Jr&&Jr.isRegExp,gh=Jr&&Jr.isSet,Pc=Jr&&Jr.isTypedArray;function $n(be,Fe,Ce){switch(Ce.length){case 0:return be.call(Fe);case 1:return be.call(Fe,Ce[0]);case 2:return be.call(Fe,Ce[0],Ce[1]);case 3:return be.call(Fe,Ce[0],Ce[1],Ce[2])}return be.apply(Fe,Ce)}function PQ(be,Fe,Ce,Ct){for(var tr=-1,Mr=be==null?0:be.length;++tr-1}function jb(be,Fe,Ce){for(var Ct=-1,tr=be==null?0:be.length;++Ct-1;);return Ce}function W7(be,Fe){for(var Ce=be.length;Ce--&&ef(Fe,be[Ce],0)>-1;);return Ce}function LQ(be,Fe){for(var Ce=be.length,Ct=0;Ce--;)be[Ce]===Fe&&++Ct;return Ct}var kQ=Wb(ce),$Q=Wb(ye);function BQ(be){return"\\"+It[be]}function FQ(be,Fe){return be==null?r:be[Fe]}function tf(be){return up.test(be)}function UQ(be){return Ac.test(be)}function jQ(be){for(var Fe,Ce=[];!(Fe=be.next()).done;)Ce.push(Fe.value);return Ce}function Yb(be){var Fe=-1,Ce=Array(be.size);return be.forEach(function(Ct,tr){Ce[++Fe]=[tr,Ct]}),Ce}function K7(be,Fe){return function(Ce){return be(Fe(Ce))}}function Ca(be,Fe){for(var Ce=-1,Ct=be.length,tr=0,Mr=[];++Ce-1}function Iee(c,h){var w=this.__data__,L=Ip(w,c);return L<0?(++this.size,w.push([c,h])):w[L][1]=h,this}Uo.prototype.clear=See,Uo.prototype.delete=Aee,Uo.prototype.get=Pee,Uo.prototype.has=Mee,Uo.prototype.set=Iee;function jo(c){var h=-1,w=c==null?0:c.length;for(this.clear();++h=h?c:h)),c}function as(c,h,w,L,W,ne){var he,ge=h&g,we=h&y,We=h&A;if(w&&(he=W?w(c,L,W,ne):w(c)),he!==r)return he;if(!Qr(c))return c;var Ke=sr(c);if(Ke){if(he=Dte(c),!ge)return Ei(c,he)}else{var Ze=ti(c),xt=Ze==te||Ze==le;if(La(c))return I9(c,ge);if(Ze==Me||Ze==O||xt&&!W){if(he=we||xt?{}:V9(c),!ge)return we?xte(c,Hee(he,c)):wte(c,i9(he,c))}else{if(!kr[Ze])return W?c:{};he=Ote(c,Ze,ge)}}ne||(ne=new Ms);var Nt=ne.get(c);if(Nt)return Nt;ne.set(c,he),_A(c)?c.forEach(function(Gt){he.add(as(Gt,h,w,Gt,c,ne))}):wA(c)&&c.forEach(function(Gt,br){he.set(br,as(Gt,h,w,br,c,ne))});var Vt=We?we?xy:wy:we?Ai:Bn,fr=Ke?r:Vt(c);return is(fr||c,function(Gt,br){fr&&(br=Gt,Gt=c[br]),_h(he,br,as(Gt,h,w,br,c,ne))}),he}function Wee(c){var h=Bn(c);return function(w){return s9(w,c,h)}}function s9(c,h,w){var L=w.length;if(c==null)return!L;for(c=qr(c);L--;){var W=w[L],ne=h[W],he=c[W];if(he===r&&!(W in c)||!ne(he))return!1}return!0}function o9(c,h,w){if(typeof c!="function")throw new ss(o);return Ch(function(){c.apply(r,w)},h)}function Eh(c,h,w,L){var W=-1,ne=lp,he=!0,ge=c.length,we=[],We=h.length;if(!ge)return we;w&&(h=Xr(h,Li(w))),L?(ne=jb,he=!1):h.length>=i&&(ne=mh,he=!1,h=new Cc(h));e:for(;++WW?0:W+w),L=L===r||L>W?W:ur(L),L<0&&(L+=W),L=w>L?0:SA(L);w0&&w(ge)?h>1?Kn(ge,h-1,w,L,W):Ia(W,ge):L||(W[W.length]=ge)}return W}var ry=N9(),u9=N9(!0);function ro(c,h){return c&&ry(c,h,Bn)}function ny(c,h){return c&&u9(c,h,Bn)}function Tp(c,h){return Ma(h,function(w){return Ko(c[w])})}function Rc(c,h){h=Oa(h,c);for(var w=0,L=h.length;c!=null&&wh}function Gee(c,h){return c!=null&&Tr.call(c,h)}function Yee(c,h){return c!=null&&h in qr(c)}function Jee(c,h,w){return c>=ei(h,w)&&c=120&&Ke.length>=120)?new Cc(he&&Ke):r}Ke=c[0];var Ze=-1,xt=ge[0];e:for(;++Ze-1;)ge!==c&&xp.call(ge,we,1),xp.call(c,we,1);return c}function w9(c,h){for(var w=c?h.length:0,L=w-1;w--;){var W=h[w];if(w==L||W!==ne){var ne=W;Wo(W)?xp.call(c,W,1):dy(c,W)}}return c}function fy(c,h){return c+Sp(e9()*(h-c+1))}function ute(c,h,w,L){for(var W=-1,ne=Pn(Ep((h-c)/(w||1)),0),he=Ce(ne);ne--;)he[L?ne:++W]=c,c+=w;return he}function ly(c,h){var w="";if(!c||h<1||h>_)return w;do h%2&&(w+=c),h=Sp(h/2),h&&(c+=c);while(h);return w}function hr(c,h){return Iy(J9(c,h,Pi),c+"")}function fte(c){return n9(df(c))}function lte(c,h){var w=df(c);return jp(w,Tc(h,0,w.length))}function Ph(c,h,w,L){if(!Qr(c))return c;h=Oa(h,c);for(var W=-1,ne=h.length,he=ne-1,ge=c;ge!=null&&++WW?0:W+h),w=w>W?W:w,w<0&&(w+=W),W=h>w?0:w-h>>>0,h>>>=0;for(var ne=Ce(W);++L>>1,he=c[ne];he!==null&&!$i(he)&&(w?he<=h:he=i){var We=h?null:Ate(c);if(We)return dp(We);he=!1,W=mh,we=new Cc}else we=h?[]:ge;e:for(;++L=L?c:cs(c,h,w)}var M9=ree||function(c){return _r.clearTimeout(c)};function I9(c,h){if(h)return c.slice();var w=c.length,L=Y7?Y7(w):new c.constructor(w);return c.copy(L),L}function vy(c){var h=new c.constructor(c.byteLength);return new yp(h).set(new yp(c)),h}function mte(c,h){var w=h?vy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.byteLength)}function vte(c){var h=new c.constructor(c.source,Re.exec(c));return h.lastIndex=c.lastIndex,h}function bte(c){return xh?qr(xh.call(c)):{}}function C9(c,h){var w=h?vy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.length)}function T9(c,h){if(c!==h){var w=c!==r,L=c===null,W=c===c,ne=$i(c),he=h!==r,ge=h===null,we=h===h,We=$i(h);if(!ge&&!We&&!ne&&c>h||ne&&he&&we&&!ge&&!We||L&&he&&we||!w&&we||!W)return 1;if(!L&&!ne&&!We&&c=ge)return we;var We=w[L];return we*(We=="desc"?-1:1)}}return c.index-h.index}function R9(c,h,w,L){for(var W=-1,ne=c.length,he=w.length,ge=-1,we=h.length,We=Pn(ne-he,0),Ke=Ce(we+We),Ze=!L;++ge1?w[W-1]:r,he=W>2?w[2]:r;for(ne=c.length>3&&typeof ne=="function"?(W--,ne):r,he&&ci(w[0],w[1],he)&&(ne=W<3?r:ne,W=1),h=qr(h);++L-1?W[ne?h[he]:he]:r}}function $9(c){return Ho(function(h){var w=h.length,L=w,W=os.prototype.thru;for(c&&h.reverse();L--;){var ne=h[L];if(typeof ne!="function")throw new ss(o);if(W&&!he&&Fp(ne)=="wrapper")var he=new os([],!0)}for(L=he?L:w;++L1&&Er.reverse(),Ke&&wege))return!1;var We=ne.get(c),Ke=ne.get(h);if(We&&Ke)return We==h&&Ke==c;var Ze=-1,xt=!0,Nt=w&N?new Cc:r;for(ne.set(c,h),ne.set(h,c);++Ze1?"& ":"")+h[L],h=h.join(w>2?", ":" "),c.replace(V,`{ + */Qd.exports,function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",l=500,d="__lodash_placeholder__",g=1,y=2,A=4,P=1,N=2,D=1,k=2,$=4,q=8,U=16,K=32,J=64,T=128,z=256,ue=512,_e=30,G="...",E=800,m=16,f=1,p=2,v=3,x=1/0,_=9007199254740991,S=17976931348623157e292,b=NaN,M=4294967295,I=M-1,F=M>>>1,ae=[["ary",T],["bind",D],["bindKey",k],["curry",q],["curryRight",U],["flip",ue],["partial",K],["partialRight",J],["rearg",z]],O="[object Arguments]",se="[object Array]",ee="[object AsyncFunction]",X="[object Boolean]",Q="[object Date]",R="[object DOMException]",Z="[object Error]",te="[object Function]",le="[object GeneratorFunction]",ie="[object Map]",fe="[object Number]",ve="[object Null]",Me="[object Object]",Ne="[object Promise]",Te="[object Proxy]",Be="[object RegExp]",Ie="[object Set]",Le="[object String]",Ve="[object Symbol]",ke="[object Undefined]",ze="[object WeakMap]",He="[object WeakSet]",Ee="[object ArrayBuffer]",Qe="[object DataView]",ct="[object Float32Array]",$e="[object Float64Array]",et="[object Int8Array]",rt="[object Int16Array]",Je="[object Int32Array]",pt="[object Uint8Array]",ht="[object Uint8ClampedArray]",ft="[object Uint16Array]",Ht="[object Uint32Array]",Jt=/\b__p \+= '';/g,St=/\b(__p \+=) '' \+/g,er=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Xt=/&(?:amp|lt|gt|quot|#39);/g,Ot=/[&<>"']/g,$t=RegExp(Xt.source),Tt=RegExp(Ot.source),vt=/<%-([\s\S]+?)%>/g,Dt=/<%([\s\S]+?)%>/g,Lt=/<%=([\s\S]+?)%>/g,bt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Bt=/^\w*$/,Ut=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(nt.source),B=/^\s+/,H=/\s/,V=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C=/\{\n\/\* \[wrapped with (.+)\] \*/,Y=/,? & /,j=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,oe=/[()=,{}\[\]\/\s]/,pe=/\\(\\)?/g,xe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Re=/\w*$/,De=/^[-+]0x[0-9a-f]+$/i,it=/^0b[01]+$/i,je=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,st=/^(?:0|[1-9]\d*)$/,tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,Rt=/['\n\r\u2028\u2029\\]/g,Mt="\\ud800-\\udfff",Et="\\u0300-\\u036f",dt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",ot=Et+dt+_t,wt="\\u2700-\\u27bf",lt="a-z\\xdf-\\xf6\\xf8-\\xff",at="\\xac\\xb1\\xd7\\xf7",Se="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ae="\\u2000-\\u206f",Ge=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ue="A-Z\\xc0-\\xd6\\xd8-\\xde",qe="\\ufe0e\\ufe0f",Xe=at+Se+Ae+Ge,kt="['’]",Wt="["+Mt+"]",Zt="["+Xe+"]",Kt="["+ot+"]",de="\\d+",nr="["+wt+"]",dr="["+lt+"]",pr="[^"+Mt+Xe+de+wt+lt+Ue+"]",Qt="\\ud83c[\\udffb-\\udfff]",gr="(?:"+Kt+"|"+Qt+")",lr="[^"+Mt+"]",Lr="(?:\\ud83c[\\udde6-\\uddff]){2}",mr="[\\ud800-\\udbff][\\udc00-\\udfff]",wr="["+Ue+"]",$r="\\u200d",Br="(?:"+dr+"|"+pr+")",Ir="(?:"+wr+"|"+pr+")",hn="(?:"+kt+"(?:d|ll|m|re|s|t|ve))?",dn="(?:"+kt+"(?:D|LL|M|RE|S|T|VE))?",pn=gr+"?",sp="["+qe+"]?",Bb="(?:"+$r+"(?:"+[lr,Lr,mr].join("|")+")"+sp+pn+")*",Fo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",op="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ap=sp+pn+Bb,Zu="(?:"+[nr,Lr,mr].join("|")+")"+ap,Fb="(?:"+[lr+Kt+"?",Kt,Lr,mr,Wt].join("|")+")",ph=RegExp(kt,"g"),Ub=RegExp(Kt,"g"),Qu=RegExp(Qt+"(?="+Qt+")|"+Fb+ap,"g"),cp=RegExp([wr+"?"+dr+"+"+hn+"(?="+[Zt,wr,"$"].join("|")+")",Ir+"+"+dn+"(?="+[Zt,wr+Br,"$"].join("|")+")",wr+"?"+Br+"+"+hn,wr+"+"+dn,op,Fo,de,Zu].join("|"),"g"),up=RegExp("["+$r+Mt+ot+qe+"]"),Ac=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],jb=-1,Fr={};Fr[ct]=Fr[$e]=Fr[et]=Fr[rt]=Fr[Je]=Fr[pt]=Fr[ht]=Fr[ft]=Fr[Ht]=!0,Fr[O]=Fr[se]=Fr[Ee]=Fr[X]=Fr[Qe]=Fr[Q]=Fr[Z]=Fr[te]=Fr[ie]=Fr[fe]=Fr[Me]=Fr[Be]=Fr[Ie]=Fr[Le]=Fr[ze]=!1;var kr={};kr[O]=kr[se]=kr[Ee]=kr[Qe]=kr[X]=kr[Q]=kr[ct]=kr[$e]=kr[et]=kr[rt]=kr[Je]=kr[ie]=kr[fe]=kr[Me]=kr[Be]=kr[Ie]=kr[Le]=kr[Ve]=kr[pt]=kr[ht]=kr[ft]=kr[Ht]=!0,kr[Z]=kr[te]=kr[ze]=!1;var ce={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ye={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye={"&":"&","<":"<",">":">",""":'"',"'":"'"},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ur=parseFloat,ir=parseInt,Yr=typeof nn=="object"&&nn&&nn.Object===Object&&nn,wn=typeof self=="object"&&self&&self.Object===Object&&self,_r=Yr||wn||Function("return this")(),jr=e&&!e.nodeType&&e,gn=jr&&!0&&t&&!t.nodeType&&t,_i=gn&&gn.exports===jr,xn=_i&&Yr.process,Jr=function(){try{var be=gn&&gn.require&&gn.require("util").types;return be||xn&&xn.binding&&xn.binding("util")}catch{}}(),oi=Jr&&Jr.isArrayBuffer,As=Jr&&Jr.isDate,ns=Jr&&Jr.isMap,to=Jr&&Jr.isRegExp,gh=Jr&&Jr.isSet,Pc=Jr&&Jr.isTypedArray;function $n(be,Fe,Ce){switch(Ce.length){case 0:return be.call(Fe);case 1:return be.call(Fe,Ce[0]);case 2:return be.call(Fe,Ce[0],Ce[1]);case 3:return be.call(Fe,Ce[0],Ce[1],Ce[2])}return be.apply(Fe,Ce)}function PQ(be,Fe,Ce,Ct){for(var tr=-1,Mr=be==null?0:be.length;++tr-1}function qb(be,Fe,Ce){for(var Ct=-1,tr=be==null?0:be.length;++Ct-1;);return Ce}function W7(be,Fe){for(var Ce=be.length;Ce--&&ef(Fe,be[Ce],0)>-1;);return Ce}function LQ(be,Fe){for(var Ce=be.length,Ct=0;Ce--;)be[Ce]===Fe&&++Ct;return Ct}var kQ=Kb(ce),$Q=Kb(ye);function BQ(be){return"\\"+It[be]}function FQ(be,Fe){return be==null?r:be[Fe]}function tf(be){return up.test(be)}function UQ(be){return Ac.test(be)}function jQ(be){for(var Fe,Ce=[];!(Fe=be.next()).done;)Ce.push(Fe.value);return Ce}function Jb(be){var Fe=-1,Ce=Array(be.size);return be.forEach(function(Ct,tr){Ce[++Fe]=[tr,Ct]}),Ce}function K7(be,Fe){return function(Ce){return be(Fe(Ce))}}function Ca(be,Fe){for(var Ce=-1,Ct=be.length,tr=0,Mr=[];++Ce-1}function Iee(c,h){var w=this.__data__,L=Ip(w,c);return L<0?(++this.size,w.push([c,h])):w[L][1]=h,this}Uo.prototype.clear=See,Uo.prototype.delete=Aee,Uo.prototype.get=Pee,Uo.prototype.has=Mee,Uo.prototype.set=Iee;function jo(c){var h=-1,w=c==null?0:c.length;for(this.clear();++h=h?c:h)),c}function as(c,h,w,L,W,ne){var he,ge=h&g,we=h&y,We=h&A;if(w&&(he=W?w(c,L,W,ne):w(c)),he!==r)return he;if(!Qr(c))return c;var Ke=sr(c);if(Ke){if(he=Dte(c),!ge)return Ei(c,he)}else{var Ze=ti(c),xt=Ze==te||Ze==le;if(La(c))return I9(c,ge);if(Ze==Me||Ze==O||xt&&!W){if(he=we||xt?{}:V9(c),!ge)return we?xte(c,Hee(he,c)):wte(c,i9(he,c))}else{if(!kr[Ze])return W?c:{};he=Ote(c,Ze,ge)}}ne||(ne=new Ms);var Nt=ne.get(c);if(Nt)return Nt;ne.set(c,he),_A(c)?c.forEach(function(Gt){he.add(as(Gt,h,w,Gt,c,ne))}):wA(c)&&c.forEach(function(Gt,br){he.set(br,as(Gt,h,w,br,c,ne))});var Vt=We?we?_y:xy:we?Ai:Bn,fr=Ke?r:Vt(c);return is(fr||c,function(Gt,br){fr&&(br=Gt,Gt=c[br]),_h(he,br,as(Gt,h,w,br,c,ne))}),he}function Wee(c){var h=Bn(c);return function(w){return s9(w,c,h)}}function s9(c,h,w){var L=w.length;if(c==null)return!L;for(c=qr(c);L--;){var W=w[L],ne=h[W],he=c[W];if(he===r&&!(W in c)||!ne(he))return!1}return!0}function o9(c,h,w){if(typeof c!="function")throw new ss(o);return Ch(function(){c.apply(r,w)},h)}function Eh(c,h,w,L){var W=-1,ne=lp,he=!0,ge=c.length,we=[],We=h.length;if(!ge)return we;w&&(h=Xr(h,Li(w))),L?(ne=qb,he=!1):h.length>=i&&(ne=mh,he=!1,h=new Cc(h));e:for(;++WW?0:W+w),L=L===r||L>W?W:ur(L),L<0&&(L+=W),L=w>L?0:SA(L);w0&&w(ge)?h>1?Kn(ge,h-1,w,L,W):Ia(W,ge):L||(W[W.length]=ge)}return W}var ny=N9(),u9=N9(!0);function ro(c,h){return c&&ny(c,h,Bn)}function iy(c,h){return c&&u9(c,h,Bn)}function Tp(c,h){return Ma(h,function(w){return Ko(c[w])})}function Rc(c,h){h=Oa(h,c);for(var w=0,L=h.length;c!=null&&wh}function Gee(c,h){return c!=null&&Tr.call(c,h)}function Yee(c,h){return c!=null&&h in qr(c)}function Jee(c,h,w){return c>=ei(h,w)&&c=120&&Ke.length>=120)?new Cc(he&&Ke):r}Ke=c[0];var Ze=-1,xt=ge[0];e:for(;++Ze-1;)ge!==c&&xp.call(ge,we,1),xp.call(c,we,1);return c}function w9(c,h){for(var w=c?h.length:0,L=w-1;w--;){var W=h[w];if(w==L||W!==ne){var ne=W;Wo(W)?xp.call(c,W,1):py(c,W)}}return c}function ly(c,h){return c+Sp(e9()*(h-c+1))}function ute(c,h,w,L){for(var W=-1,ne=Pn(Ep((h-c)/(w||1)),0),he=Ce(ne);ne--;)he[L?ne:++W]=c,c+=w;return he}function hy(c,h){var w="";if(!c||h<1||h>_)return w;do h%2&&(w+=c),h=Sp(h/2),h&&(c+=c);while(h);return w}function hr(c,h){return Cy(J9(c,h,Pi),c+"")}function fte(c){return n9(df(c))}function lte(c,h){var w=df(c);return jp(w,Tc(h,0,w.length))}function Ph(c,h,w,L){if(!Qr(c))return c;h=Oa(h,c);for(var W=-1,ne=h.length,he=ne-1,ge=c;ge!=null&&++WW?0:W+h),w=w>W?W:w,w<0&&(w+=W),W=h>w?0:w-h>>>0,h>>>=0;for(var ne=Ce(W);++L>>1,he=c[ne];he!==null&&!$i(he)&&(w?he<=h:he=i){var We=h?null:Ate(c);if(We)return dp(We);he=!1,W=mh,we=new Cc}else we=h?[]:ge;e:for(;++L=L?c:cs(c,h,w)}var M9=ree||function(c){return _r.clearTimeout(c)};function I9(c,h){if(h)return c.slice();var w=c.length,L=Y7?Y7(w):new c.constructor(w);return c.copy(L),L}function by(c){var h=new c.constructor(c.byteLength);return new yp(h).set(new yp(c)),h}function mte(c,h){var w=h?by(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.byteLength)}function vte(c){var h=new c.constructor(c.source,Re.exec(c));return h.lastIndex=c.lastIndex,h}function bte(c){return xh?qr(xh.call(c)):{}}function C9(c,h){var w=h?by(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.length)}function T9(c,h){if(c!==h){var w=c!==r,L=c===null,W=c===c,ne=$i(c),he=h!==r,ge=h===null,we=h===h,We=$i(h);if(!ge&&!We&&!ne&&c>h||ne&&he&&we&&!ge&&!We||L&&he&&we||!w&&we||!W)return 1;if(!L&&!ne&&!We&&c=ge)return we;var We=w[L];return we*(We=="desc"?-1:1)}}return c.index-h.index}function R9(c,h,w,L){for(var W=-1,ne=c.length,he=w.length,ge=-1,we=h.length,We=Pn(ne-he,0),Ke=Ce(we+We),Ze=!L;++ge1?w[W-1]:r,he=W>2?w[2]:r;for(ne=c.length>3&&typeof ne=="function"?(W--,ne):r,he&&ci(w[0],w[1],he)&&(ne=W<3?r:ne,W=1),h=qr(h);++L-1?W[ne?h[he]:he]:r}}function $9(c){return Ho(function(h){var w=h.length,L=w,W=os.prototype.thru;for(c&&h.reverse();L--;){var ne=h[L];if(typeof ne!="function")throw new ss(o);if(W&&!he&&Fp(ne)=="wrapper")var he=new os([],!0)}for(L=he?L:w;++L1&&Er.reverse(),Ke&&wege))return!1;var We=ne.get(c),Ke=ne.get(h);if(We&&Ke)return We==h&&Ke==c;var Ze=-1,xt=!0,Nt=w&N?new Cc:r;for(ne.set(c,h),ne.set(h,c);++Ze1?"& ":"")+h[L],h=h.join(w>2?", ":" "),c.replace(V,`{ /* [wrapped with `+h+`] */ -`)}function Lte(c){return sr(c)||Nc(c)||!!(Z7&&c&&c[Z7])}function Wo(c,h){var w=typeof c;return h=h??_,!!h&&(w=="number"||w!="symbol"&&st.test(c))&&c>-1&&c%1==0&&c0){if(++h>=E)return arguments[0]}else h=0;return c.apply(r,arguments)}}function jp(c,h){var w=-1,L=c.length,W=L-1;for(h=h===r?L:h;++w1?c[h-1]:r;return w=typeof w=="function"?(c.pop(),w):r,cA(c,w)});function uA(c){var h=re(c);return h.__chain__=!0,h}function Kre(c,h){return h(c),c}function qp(c,h){return h(c)}var Vre=Ho(function(c){var h=c.length,w=h?c[0]:0,L=this.__wrapped__,W=function(ne){return ty(ne,c)};return h>1||this.__actions__.length||!(L instanceof xr)||!Wo(w)?this.thru(W):(L=L.slice(w,+w+(h?1:0)),L.__actions__.push({func:qp,args:[W],thisArg:r}),new os(L,this.__chain__).thru(function(ne){return h&&!ne.length&&ne.push(r),ne}))});function Gre(){return uA(this)}function Yre(){return new os(this.value(),this.__chain__)}function Jre(){this.__values__===r&&(this.__values__=EA(this.value()));var c=this.__index__>=this.__values__.length,h=c?r:this.__values__[this.__index__++];return{done:c,value:h}}function Xre(){return this}function Zre(c){for(var h,w=this;w instanceof Mp;){var L=rA(w);L.__index__=0,L.__values__=r,h?W.__wrapped__=L:h=L;var W=L;w=w.__wrapped__}return W.__wrapped__=c,h}function Qre(){var c=this.__wrapped__;if(c instanceof xr){var h=c;return this.__actions__.length&&(h=new xr(this)),h=h.reverse(),h.__actions__.push({func:qp,args:[Cy],thisArg:r}),new os(h,this.__chain__)}return this.thru(Cy)}function ene(){return A9(this.__wrapped__,this.__actions__)}var tne=Np(function(c,h,w){Tr.call(c,w)?++c[w]:qo(c,w,1)});function rne(c,h,w){var L=sr(c)?B7:Kee;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}function nne(c,h){var w=sr(c)?Ma:c9;return w(c,qt(h,3))}var ine=k9(nA),sne=k9(iA);function one(c,h){return Kn(zp(c,h),1)}function ane(c,h){return Kn(zp(c,h),x)}function cne(c,h,w){return w=w===r?1:ur(w),Kn(zp(c,h),w)}function fA(c,h){var w=sr(c)?is:Ra;return w(c,qt(h,3))}function lA(c,h){var w=sr(c)?MQ:a9;return w(c,qt(h,3))}var une=Np(function(c,h,w){Tr.call(c,w)?c[w].push(h):qo(c,w,[h])});function fne(c,h,w,L){c=Si(c)?c:df(c),w=w&&!L?ur(w):0;var W=c.length;return w<0&&(w=Pn(W+w,0)),Gp(c)?w<=W&&c.indexOf(h,w)>-1:!!W&&ef(c,h,w)>-1}var lne=hr(function(c,h,w){var L=-1,W=typeof h=="function",ne=Si(c)?Ce(c.length):[];return Ra(c,function(he){ne[++L]=W?$n(h,he,w):Sh(he,h,w)}),ne}),hne=Np(function(c,h,w){qo(c,w,h)});function zp(c,h){var w=sr(c)?Xr:p9;return w(c,qt(h,3))}function dne(c,h,w,L){return c==null?[]:(sr(h)||(h=h==null?[]:[h]),w=L?r:w,sr(w)||(w=w==null?[]:[w]),b9(c,h,w))}var pne=Np(function(c,h,w){c[w?0:1].push(h)},function(){return[[],[]]});function gne(c,h,w){var L=sr(c)?qb:q7,W=arguments.length<3;return L(c,qt(h,4),w,W,Ra)}function mne(c,h,w){var L=sr(c)?IQ:q7,W=arguments.length<3;return L(c,qt(h,4),w,W,a9)}function vne(c,h){var w=sr(c)?Ma:c9;return w(c,Kp(qt(h,3)))}function bne(c){var h=sr(c)?n9:fte;return h(c)}function yne(c,h,w){(w?ci(c,h,w):h===r)?h=1:h=ur(h);var L=sr(c)?jee:lte;return L(c,h)}function wne(c){var h=sr(c)?qee:dte;return h(c)}function xne(c){if(c==null)return 0;if(Si(c))return Gp(c)?rf(c):c.length;var h=ti(c);return h==ie||h==Ie?c.size:ay(c).length}function _ne(c,h,w){var L=sr(c)?zb:pte;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}var Ene=hr(function(c,h){if(c==null)return[];var w=h.length;return w>1&&ci(c,h[0],h[1])?h=[]:w>2&&ci(h[0],h[1],h[2])&&(h=[h[0]]),b9(c,Kn(h,1),[])}),Hp=nee||function(){return _r.Date.now()};function Sne(c,h){if(typeof h!="function")throw new ss(o);return c=ur(c),function(){if(--c<1)return h.apply(this,arguments)}}function hA(c,h,w){return h=w?r:h,h=c&&h==null?c.length:h,zo(c,T,r,r,r,r,h)}function dA(c,h){var w;if(typeof h!="function")throw new ss(o);return c=ur(c),function(){return--c>0&&(w=h.apply(this,arguments)),c<=1&&(h=r),w}}var Ry=hr(function(c,h,w){var L=D;if(w.length){var W=Ca(w,lf(Ry));L|=K}return zo(c,L,h,w,W)}),pA=hr(function(c,h,w){var L=D|k;if(w.length){var W=Ca(w,lf(pA));L|=K}return zo(h,L,c,w,W)});function gA(c,h,w){h=w?r:h;var L=zo(c,q,r,r,r,r,r,h);return L.placeholder=gA.placeholder,L}function mA(c,h,w){h=w?r:h;var L=zo(c,U,r,r,r,r,r,h);return L.placeholder=mA.placeholder,L}function vA(c,h,w){var L,W,ne,he,ge,we,We=0,Ke=!1,Ze=!1,xt=!0;if(typeof c!="function")throw new ss(o);h=fs(h)||0,Qr(w)&&(Ke=!!w.leading,Ze="maxWait"in w,ne=Ze?Pn(fs(w.maxWait)||0,h):ne,xt="trailing"in w?!!w.trailing:xt);function Nt(vn){var Cs=L,Go=W;return L=W=r,We=vn,he=c.apply(Go,Cs),he}function Vt(vn){return We=vn,ge=Ch(br,h),Ke?Nt(vn):he}function fr(vn){var Cs=vn-we,Go=vn-We,kA=h-Cs;return Ze?ei(kA,ne-Go):kA}function Gt(vn){var Cs=vn-we,Go=vn-We;return we===r||Cs>=h||Cs<0||Ze&&Go>=ne}function br(){var vn=Hp();if(Gt(vn))return Er(vn);ge=Ch(br,fr(vn))}function Er(vn){return ge=r,xt&&L?Nt(vn):(L=W=r,he)}function Bi(){ge!==r&&M9(ge),We=0,L=we=W=ge=r}function ui(){return ge===r?he:Er(Hp())}function Fi(){var vn=Hp(),Cs=Gt(vn);if(L=arguments,W=this,we=vn,Cs){if(ge===r)return Vt(we);if(Ze)return M9(ge),ge=Ch(br,h),Nt(we)}return ge===r&&(ge=Ch(br,h)),he}return Fi.cancel=Bi,Fi.flush=ui,Fi}var Ane=hr(function(c,h){return o9(c,1,h)}),Pne=hr(function(c,h,w){return o9(c,fs(h)||0,w)});function Mne(c){return zo(c,ue)}function Wp(c,h){if(typeof c!="function"||h!=null&&typeof h!="function")throw new ss(o);var w=function(){var L=arguments,W=h?h.apply(this,L):L[0],ne=w.cache;if(ne.has(W))return ne.get(W);var he=c.apply(this,L);return w.cache=ne.set(W,he)||ne,he};return w.cache=new(Wp.Cache||jo),w}Wp.Cache=jo;function Kp(c){if(typeof c!="function")throw new ss(o);return function(){var h=arguments;switch(h.length){case 0:return!c.call(this);case 1:return!c.call(this,h[0]);case 2:return!c.call(this,h[0],h[1]);case 3:return!c.call(this,h[0],h[1],h[2])}return!c.apply(this,h)}}function Ine(c){return dA(2,c)}var Cne=gte(function(c,h){h=h.length==1&&sr(h[0])?Xr(h[0],Li(qt())):Xr(Kn(h,1),Li(qt()));var w=h.length;return hr(function(L){for(var W=-1,ne=ei(L.length,w);++W=h}),Nc=l9(function(){return arguments}())?l9:function(c){return rn(c)&&Tr.call(c,"callee")&&!X7.call(c,"callee")},sr=Ce.isArray,Hne=oi?Li(oi):Zee;function Si(c){return c!=null&&Vp(c.length)&&!Ko(c)}function mn(c){return rn(c)&&Si(c)}function Wne(c){return c===!0||c===!1||rn(c)&&ai(c)==X}var La=see||zy,Kne=As?Li(As):Qee;function Vne(c){return rn(c)&&c.nodeType===1&&!Th(c)}function Gne(c){if(c==null)return!0;if(Si(c)&&(sr(c)||typeof c=="string"||typeof c.splice=="function"||La(c)||hf(c)||Nc(c)))return!c.length;var h=ti(c);if(h==ie||h==Ie)return!c.size;if(Ih(c))return!ay(c).length;for(var w in c)if(Tr.call(c,w))return!1;return!0}function Yne(c,h){return Ah(c,h)}function Jne(c,h,w){w=typeof w=="function"?w:r;var L=w?w(c,h):r;return L===r?Ah(c,h,r,w):!!L}function Oy(c){if(!rn(c))return!1;var h=ai(c);return h==Z||h==R||typeof c.message=="string"&&typeof c.name=="string"&&!Th(c)}function Xne(c){return typeof c=="number"&&Q7(c)}function Ko(c){if(!Qr(c))return!1;var h=ai(c);return h==te||h==le||h==ee||h==Te}function yA(c){return typeof c=="number"&&c==ur(c)}function Vp(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=_}function Qr(c){var h=typeof c;return c!=null&&(h=="object"||h=="function")}function rn(c){return c!=null&&typeof c=="object"}var wA=ns?Li(ns):tte;function Zne(c,h){return c===h||oy(c,h,Ey(h))}function Qne(c,h,w){return w=typeof w=="function"?w:r,oy(c,h,Ey(h),w)}function eie(c){return xA(c)&&c!=+c}function tie(c){if(Bte(c))throw new tr(s);return h9(c)}function rie(c){return c===null}function nie(c){return c==null}function xA(c){return typeof c=="number"||rn(c)&&ai(c)==fe}function Th(c){if(!rn(c)||ai(c)!=Me)return!1;var h=wp(c);if(h===null)return!0;var w=Tr.call(h,"constructor")&&h.constructor;return typeof w=="function"&&w instanceof w&&mp.call(w)==QQ}var Ny=to?Li(to):rte;function iie(c){return yA(c)&&c>=-_&&c<=_}var _A=gh?Li(gh):nte;function Gp(c){return typeof c=="string"||!sr(c)&&rn(c)&&ai(c)==Le}function $i(c){return typeof c=="symbol"||rn(c)&&ai(c)==Ve}var hf=Pc?Li(Pc):ite;function sie(c){return c===r}function oie(c){return rn(c)&&ti(c)==ze}function aie(c){return rn(c)&&ai(c)==He}var cie=Bp(cy),uie=Bp(function(c,h){return c<=h});function EA(c){if(!c)return[];if(Si(c))return Gp(c)?Ps(c):Ei(c);if(vh&&c[vh])return jQ(c[vh]());var h=ti(c),w=h==ie?Yb:h==Ie?dp:df;return w(c)}function Vo(c){if(!c)return c===0?c:0;if(c=fs(c),c===x||c===-x){var h=c<0?-1:1;return h*S}return c===c?c:0}function ur(c){var h=Vo(c),w=h%1;return h===h?w?h-w:h:0}function SA(c){return c?Tc(ur(c),0,M):0}function fs(c){if(typeof c=="number")return c;if($i(c))return b;if(Qr(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=Qr(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=z7(c);var w=it.test(c);return w||gt.test(c)?ir(c.slice(2),w?2:8):De.test(c)?b:+c}function AA(c){return no(c,Ai(c))}function fie(c){return c?Tc(ur(c),-_,_):c===0?c:0}function Cr(c){return c==null?"":ki(c)}var lie=uf(function(c,h){if(Ih(h)||Si(h)){no(h,Bn(h),c);return}for(var w in h)Tr.call(h,w)&&_h(c,w,h[w])}),PA=uf(function(c,h){no(h,Ai(h),c)}),Yp=uf(function(c,h,w,L){no(h,Ai(h),c,L)}),hie=uf(function(c,h,w,L){no(h,Bn(h),c,L)}),die=Ho(ty);function pie(c,h){var w=cf(c);return h==null?w:i9(w,h)}var gie=hr(function(c,h){c=qr(c);var w=-1,L=h.length,W=L>2?h[2]:r;for(W&&ci(h[0],h[1],W)&&(L=1);++w1),ne}),no(c,xy(c),w),L&&(w=as(w,g|y|A,Pte));for(var W=h.length;W--;)dy(w,h[W]);return w});function Oie(c,h){return IA(c,Kp(qt(h)))}var Nie=Ho(function(c,h){return c==null?{}:ate(c,h)});function IA(c,h){if(c==null)return{};var w=Xr(xy(c),function(L){return[L]});return h=qt(h),y9(c,w,function(L,W){return h(L,W[0])})}function Lie(c,h,w){h=Oa(h,c);var L=-1,W=h.length;for(W||(W=1,c=r);++Lh){var L=c;c=h,h=L}if(w||c%1||h%1){var W=e9();return ei(c+W*(h-c+Ur("1e-"+((W+"").length-1))),h)}return fy(c,h)}var Kie=ff(function(c,h,w){return h=h.toLowerCase(),c+(w?RA(h):h)});function RA(c){return $y(Cr(c).toLowerCase())}function DA(c){return c=Cr(c),c&&c.replace(tt,kQ).replace(Fb,"")}function Vie(c,h,w){c=Cr(c),h=ki(h);var L=c.length;w=w===r?L:Tc(ur(w),0,L);var W=w;return w-=h.length,w>=0&&c.slice(w,W)==h}function Gie(c){return c=Cr(c),c&&Tt.test(c)?c.replace(Ot,$Q):c}function Yie(c){return c=Cr(c),c&&Ft.test(c)?c.replace(nt,"\\$&"):c}var Jie=ff(function(c,h,w){return c+(w?"-":"")+h.toLowerCase()}),Xie=ff(function(c,h,w){return c+(w?" ":"")+h.toLowerCase()}),Zie=L9("toLowerCase");function Qie(c,h,w){c=Cr(c),h=ur(h);var L=h?rf(c):0;if(!h||L>=h)return c;var W=(h-L)/2;return $p(Sp(W),w)+c+$p(Ep(W),w)}function ese(c,h,w){c=Cr(c),h=ur(h);var L=h?rf(c):0;return h&&L>>0,w?(c=Cr(c),c&&(typeof h=="string"||h!=null&&!Ny(h))&&(h=ki(h),!h&&tf(c))?Na(Ps(c),0,w):c.split(h,w)):[]}var ase=ff(function(c,h,w){return c+(w?" ":"")+$y(h)});function cse(c,h,w){return c=Cr(c),w=w==null?0:Tc(ur(w),0,c.length),h=ki(h),c.slice(w,w+h.length)==h}function use(c,h,w){var L=re.templateSettings;w&&ci(c,h,w)&&(h=r),c=Cr(c),h=Yp({},h,L,q9);var W=Yp({},h.imports,L.imports,q9),ne=Bn(W),he=Gb(W,ne),ge,we,We=0,Ke=h.interpolate||At,Ze="__p += '",xt=Jb((h.escape||At).source+"|"+Ke.source+"|"+(Ke===Lt?xe:At).source+"|"+(h.evaluate||At).source+"|$","g"),Nt="//# sourceURL="+(Tr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ub+"]")+` +`)}function Lte(c){return sr(c)||Nc(c)||!!(Z7&&c&&c[Z7])}function Wo(c,h){var w=typeof c;return h=h??_,!!h&&(w=="number"||w!="symbol"&&st.test(c))&&c>-1&&c%1==0&&c0){if(++h>=E)return arguments[0]}else h=0;return c.apply(r,arguments)}}function jp(c,h){var w=-1,L=c.length,W=L-1;for(h=h===r?L:h;++w1?c[h-1]:r;return w=typeof w=="function"?(c.pop(),w):r,cA(c,w)});function uA(c){var h=re(c);return h.__chain__=!0,h}function Kre(c,h){return h(c),c}function qp(c,h){return h(c)}var Vre=Ho(function(c){var h=c.length,w=h?c[0]:0,L=this.__wrapped__,W=function(ne){return ry(ne,c)};return h>1||this.__actions__.length||!(L instanceof xr)||!Wo(w)?this.thru(W):(L=L.slice(w,+w+(h?1:0)),L.__actions__.push({func:qp,args:[W],thisArg:r}),new os(L,this.__chain__).thru(function(ne){return h&&!ne.length&&ne.push(r),ne}))});function Gre(){return uA(this)}function Yre(){return new os(this.value(),this.__chain__)}function Jre(){this.__values__===r&&(this.__values__=EA(this.value()));var c=this.__index__>=this.__values__.length,h=c?r:this.__values__[this.__index__++];return{done:c,value:h}}function Xre(){return this}function Zre(c){for(var h,w=this;w instanceof Mp;){var L=rA(w);L.__index__=0,L.__values__=r,h?W.__wrapped__=L:h=L;var W=L;w=w.__wrapped__}return W.__wrapped__=c,h}function Qre(){var c=this.__wrapped__;if(c instanceof xr){var h=c;return this.__actions__.length&&(h=new xr(this)),h=h.reverse(),h.__actions__.push({func:qp,args:[Ty],thisArg:r}),new os(h,this.__chain__)}return this.thru(Ty)}function ene(){return A9(this.__wrapped__,this.__actions__)}var tne=Np(function(c,h,w){Tr.call(c,w)?++c[w]:qo(c,w,1)});function rne(c,h,w){var L=sr(c)?B7:Kee;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}function nne(c,h){var w=sr(c)?Ma:c9;return w(c,qt(h,3))}var ine=k9(nA),sne=k9(iA);function one(c,h){return Kn(zp(c,h),1)}function ane(c,h){return Kn(zp(c,h),x)}function cne(c,h,w){return w=w===r?1:ur(w),Kn(zp(c,h),w)}function fA(c,h){var w=sr(c)?is:Ra;return w(c,qt(h,3))}function lA(c,h){var w=sr(c)?MQ:a9;return w(c,qt(h,3))}var une=Np(function(c,h,w){Tr.call(c,w)?c[w].push(h):qo(c,w,[h])});function fne(c,h,w,L){c=Si(c)?c:df(c),w=w&&!L?ur(w):0;var W=c.length;return w<0&&(w=Pn(W+w,0)),Gp(c)?w<=W&&c.indexOf(h,w)>-1:!!W&&ef(c,h,w)>-1}var lne=hr(function(c,h,w){var L=-1,W=typeof h=="function",ne=Si(c)?Ce(c.length):[];return Ra(c,function(he){ne[++L]=W?$n(h,he,w):Sh(he,h,w)}),ne}),hne=Np(function(c,h,w){qo(c,w,h)});function zp(c,h){var w=sr(c)?Xr:p9;return w(c,qt(h,3))}function dne(c,h,w,L){return c==null?[]:(sr(h)||(h=h==null?[]:[h]),w=L?r:w,sr(w)||(w=w==null?[]:[w]),b9(c,h,w))}var pne=Np(function(c,h,w){c[w?0:1].push(h)},function(){return[[],[]]});function gne(c,h,w){var L=sr(c)?zb:q7,W=arguments.length<3;return L(c,qt(h,4),w,W,Ra)}function mne(c,h,w){var L=sr(c)?IQ:q7,W=arguments.length<3;return L(c,qt(h,4),w,W,a9)}function vne(c,h){var w=sr(c)?Ma:c9;return w(c,Kp(qt(h,3)))}function bne(c){var h=sr(c)?n9:fte;return h(c)}function yne(c,h,w){(w?ci(c,h,w):h===r)?h=1:h=ur(h);var L=sr(c)?jee:lte;return L(c,h)}function wne(c){var h=sr(c)?qee:dte;return h(c)}function xne(c){if(c==null)return 0;if(Si(c))return Gp(c)?rf(c):c.length;var h=ti(c);return h==ie||h==Ie?c.size:cy(c).length}function _ne(c,h,w){var L=sr(c)?Hb:pte;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}var Ene=hr(function(c,h){if(c==null)return[];var w=h.length;return w>1&&ci(c,h[0],h[1])?h=[]:w>2&&ci(h[0],h[1],h[2])&&(h=[h[0]]),b9(c,Kn(h,1),[])}),Hp=nee||function(){return _r.Date.now()};function Sne(c,h){if(typeof h!="function")throw new ss(o);return c=ur(c),function(){if(--c<1)return h.apply(this,arguments)}}function hA(c,h,w){return h=w?r:h,h=c&&h==null?c.length:h,zo(c,T,r,r,r,r,h)}function dA(c,h){var w;if(typeof h!="function")throw new ss(o);return c=ur(c),function(){return--c>0&&(w=h.apply(this,arguments)),c<=1&&(h=r),w}}var Dy=hr(function(c,h,w){var L=D;if(w.length){var W=Ca(w,lf(Dy));L|=K}return zo(c,L,h,w,W)}),pA=hr(function(c,h,w){var L=D|k;if(w.length){var W=Ca(w,lf(pA));L|=K}return zo(h,L,c,w,W)});function gA(c,h,w){h=w?r:h;var L=zo(c,q,r,r,r,r,r,h);return L.placeholder=gA.placeholder,L}function mA(c,h,w){h=w?r:h;var L=zo(c,U,r,r,r,r,r,h);return L.placeholder=mA.placeholder,L}function vA(c,h,w){var L,W,ne,he,ge,we,We=0,Ke=!1,Ze=!1,xt=!0;if(typeof c!="function")throw new ss(o);h=fs(h)||0,Qr(w)&&(Ke=!!w.leading,Ze="maxWait"in w,ne=Ze?Pn(fs(w.maxWait)||0,h):ne,xt="trailing"in w?!!w.trailing:xt);function Nt(vn){var Cs=L,Go=W;return L=W=r,We=vn,he=c.apply(Go,Cs),he}function Vt(vn){return We=vn,ge=Ch(br,h),Ke?Nt(vn):he}function fr(vn){var Cs=vn-we,Go=vn-We,kA=h-Cs;return Ze?ei(kA,ne-Go):kA}function Gt(vn){var Cs=vn-we,Go=vn-We;return we===r||Cs>=h||Cs<0||Ze&&Go>=ne}function br(){var vn=Hp();if(Gt(vn))return Er(vn);ge=Ch(br,fr(vn))}function Er(vn){return ge=r,xt&&L?Nt(vn):(L=W=r,he)}function Bi(){ge!==r&&M9(ge),We=0,L=we=W=ge=r}function ui(){return ge===r?he:Er(Hp())}function Fi(){var vn=Hp(),Cs=Gt(vn);if(L=arguments,W=this,we=vn,Cs){if(ge===r)return Vt(we);if(Ze)return M9(ge),ge=Ch(br,h),Nt(we)}return ge===r&&(ge=Ch(br,h)),he}return Fi.cancel=Bi,Fi.flush=ui,Fi}var Ane=hr(function(c,h){return o9(c,1,h)}),Pne=hr(function(c,h,w){return o9(c,fs(h)||0,w)});function Mne(c){return zo(c,ue)}function Wp(c,h){if(typeof c!="function"||h!=null&&typeof h!="function")throw new ss(o);var w=function(){var L=arguments,W=h?h.apply(this,L):L[0],ne=w.cache;if(ne.has(W))return ne.get(W);var he=c.apply(this,L);return w.cache=ne.set(W,he)||ne,he};return w.cache=new(Wp.Cache||jo),w}Wp.Cache=jo;function Kp(c){if(typeof c!="function")throw new ss(o);return function(){var h=arguments;switch(h.length){case 0:return!c.call(this);case 1:return!c.call(this,h[0]);case 2:return!c.call(this,h[0],h[1]);case 3:return!c.call(this,h[0],h[1],h[2])}return!c.apply(this,h)}}function Ine(c){return dA(2,c)}var Cne=gte(function(c,h){h=h.length==1&&sr(h[0])?Xr(h[0],Li(qt())):Xr(Kn(h,1),Li(qt()));var w=h.length;return hr(function(L){for(var W=-1,ne=ei(L.length,w);++W=h}),Nc=l9(function(){return arguments}())?l9:function(c){return rn(c)&&Tr.call(c,"callee")&&!X7.call(c,"callee")},sr=Ce.isArray,Hne=oi?Li(oi):Zee;function Si(c){return c!=null&&Vp(c.length)&&!Ko(c)}function mn(c){return rn(c)&&Si(c)}function Wne(c){return c===!0||c===!1||rn(c)&&ai(c)==X}var La=see||Hy,Kne=As?Li(As):Qee;function Vne(c){return rn(c)&&c.nodeType===1&&!Th(c)}function Gne(c){if(c==null)return!0;if(Si(c)&&(sr(c)||typeof c=="string"||typeof c.splice=="function"||La(c)||hf(c)||Nc(c)))return!c.length;var h=ti(c);if(h==ie||h==Ie)return!c.size;if(Ih(c))return!cy(c).length;for(var w in c)if(Tr.call(c,w))return!1;return!0}function Yne(c,h){return Ah(c,h)}function Jne(c,h,w){w=typeof w=="function"?w:r;var L=w?w(c,h):r;return L===r?Ah(c,h,r,w):!!L}function Ny(c){if(!rn(c))return!1;var h=ai(c);return h==Z||h==R||typeof c.message=="string"&&typeof c.name=="string"&&!Th(c)}function Xne(c){return typeof c=="number"&&Q7(c)}function Ko(c){if(!Qr(c))return!1;var h=ai(c);return h==te||h==le||h==ee||h==Te}function yA(c){return typeof c=="number"&&c==ur(c)}function Vp(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=_}function Qr(c){var h=typeof c;return c!=null&&(h=="object"||h=="function")}function rn(c){return c!=null&&typeof c=="object"}var wA=ns?Li(ns):tte;function Zne(c,h){return c===h||ay(c,h,Sy(h))}function Qne(c,h,w){return w=typeof w=="function"?w:r,ay(c,h,Sy(h),w)}function eie(c){return xA(c)&&c!=+c}function tie(c){if(Bte(c))throw new tr(s);return h9(c)}function rie(c){return c===null}function nie(c){return c==null}function xA(c){return typeof c=="number"||rn(c)&&ai(c)==fe}function Th(c){if(!rn(c)||ai(c)!=Me)return!1;var h=wp(c);if(h===null)return!0;var w=Tr.call(h,"constructor")&&h.constructor;return typeof w=="function"&&w instanceof w&&mp.call(w)==QQ}var Ly=to?Li(to):rte;function iie(c){return yA(c)&&c>=-_&&c<=_}var _A=gh?Li(gh):nte;function Gp(c){return typeof c=="string"||!sr(c)&&rn(c)&&ai(c)==Le}function $i(c){return typeof c=="symbol"||rn(c)&&ai(c)==Ve}var hf=Pc?Li(Pc):ite;function sie(c){return c===r}function oie(c){return rn(c)&&ti(c)==ze}function aie(c){return rn(c)&&ai(c)==He}var cie=Bp(uy),uie=Bp(function(c,h){return c<=h});function EA(c){if(!c)return[];if(Si(c))return Gp(c)?Ps(c):Ei(c);if(vh&&c[vh])return jQ(c[vh]());var h=ti(c),w=h==ie?Jb:h==Ie?dp:df;return w(c)}function Vo(c){if(!c)return c===0?c:0;if(c=fs(c),c===x||c===-x){var h=c<0?-1:1;return h*S}return c===c?c:0}function ur(c){var h=Vo(c),w=h%1;return h===h?w?h-w:h:0}function SA(c){return c?Tc(ur(c),0,M):0}function fs(c){if(typeof c=="number")return c;if($i(c))return b;if(Qr(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=Qr(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=z7(c);var w=it.test(c);return w||gt.test(c)?ir(c.slice(2),w?2:8):De.test(c)?b:+c}function AA(c){return no(c,Ai(c))}function fie(c){return c?Tc(ur(c),-_,_):c===0?c:0}function Cr(c){return c==null?"":ki(c)}var lie=uf(function(c,h){if(Ih(h)||Si(h)){no(h,Bn(h),c);return}for(var w in h)Tr.call(h,w)&&_h(c,w,h[w])}),PA=uf(function(c,h){no(h,Ai(h),c)}),Yp=uf(function(c,h,w,L){no(h,Ai(h),c,L)}),hie=uf(function(c,h,w,L){no(h,Bn(h),c,L)}),die=Ho(ry);function pie(c,h){var w=cf(c);return h==null?w:i9(w,h)}var gie=hr(function(c,h){c=qr(c);var w=-1,L=h.length,W=L>2?h[2]:r;for(W&&ci(h[0],h[1],W)&&(L=1);++w1),ne}),no(c,_y(c),w),L&&(w=as(w,g|y|A,Pte));for(var W=h.length;W--;)py(w,h[W]);return w});function Oie(c,h){return IA(c,Kp(qt(h)))}var Nie=Ho(function(c,h){return c==null?{}:ate(c,h)});function IA(c,h){if(c==null)return{};var w=Xr(_y(c),function(L){return[L]});return h=qt(h),y9(c,w,function(L,W){return h(L,W[0])})}function Lie(c,h,w){h=Oa(h,c);var L=-1,W=h.length;for(W||(W=1,c=r);++Lh){var L=c;c=h,h=L}if(w||c%1||h%1){var W=e9();return ei(c+W*(h-c+Ur("1e-"+((W+"").length-1))),h)}return ly(c,h)}var Kie=ff(function(c,h,w){return h=h.toLowerCase(),c+(w?RA(h):h)});function RA(c){return By(Cr(c).toLowerCase())}function DA(c){return c=Cr(c),c&&c.replace(tt,kQ).replace(Ub,"")}function Vie(c,h,w){c=Cr(c),h=ki(h);var L=c.length;w=w===r?L:Tc(ur(w),0,L);var W=w;return w-=h.length,w>=0&&c.slice(w,W)==h}function Gie(c){return c=Cr(c),c&&Tt.test(c)?c.replace(Ot,$Q):c}function Yie(c){return c=Cr(c),c&&Ft.test(c)?c.replace(nt,"\\$&"):c}var Jie=ff(function(c,h,w){return c+(w?"-":"")+h.toLowerCase()}),Xie=ff(function(c,h,w){return c+(w?" ":"")+h.toLowerCase()}),Zie=L9("toLowerCase");function Qie(c,h,w){c=Cr(c),h=ur(h);var L=h?rf(c):0;if(!h||L>=h)return c;var W=(h-L)/2;return $p(Sp(W),w)+c+$p(Ep(W),w)}function ese(c,h,w){c=Cr(c),h=ur(h);var L=h?rf(c):0;return h&&L>>0,w?(c=Cr(c),c&&(typeof h=="string"||h!=null&&!Ly(h))&&(h=ki(h),!h&&tf(c))?Na(Ps(c),0,w):c.split(h,w)):[]}var ase=ff(function(c,h,w){return c+(w?" ":"")+By(h)});function cse(c,h,w){return c=Cr(c),w=w==null?0:Tc(ur(w),0,c.length),h=ki(h),c.slice(w,w+h.length)==h}function use(c,h,w){var L=re.templateSettings;w&&ci(c,h,w)&&(h=r),c=Cr(c),h=Yp({},h,L,q9);var W=Yp({},h.imports,L.imports,q9),ne=Bn(W),he=Yb(W,ne),ge,we,We=0,Ke=h.interpolate||At,Ze="__p += '",xt=Xb((h.escape||At).source+"|"+Ke.source+"|"+(Ke===Lt?xe:At).source+"|"+(h.evaluate||At).source+"|$","g"),Nt="//# sourceURL="+(Tr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++jb+"]")+` `;c.replace(xt,function(Gt,br,Er,Bi,ui,Fi){return Er||(Er=Bi),Ze+=c.slice(We,Fi).replace(Rt,BQ),br&&(ge=!0,Ze+=`' + __e(`+br+`) + '`),ui&&(we=!0,Ze+=`'; @@ -104,14 +104,14 @@ __p += '`),Er&&(Ze+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+Ze+`return __p -}`;var fr=NA(function(){return Mr(ne,Nt+"return "+Ze).apply(r,he)});if(fr.source=Ze,Oy(fr))throw fr;return fr}function fse(c){return Cr(c).toLowerCase()}function lse(c){return Cr(c).toUpperCase()}function hse(c,h,w){if(c=Cr(c),c&&(w||h===r))return z7(c);if(!c||!(h=ki(h)))return c;var L=Ps(c),W=Ps(h),ne=H7(L,W),he=W7(L,W)+1;return Na(L,ne,he).join("")}function dse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.slice(0,V7(c)+1);if(!c||!(h=ki(h)))return c;var L=Ps(c),W=W7(L,Ps(h))+1;return Na(L,0,W).join("")}function pse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.replace(B,"");if(!c||!(h=ki(h)))return c;var L=Ps(c),W=H7(L,Ps(h));return Na(L,W).join("")}function gse(c,h){var w=_e,L=G;if(Qr(h)){var W="separator"in h?h.separator:W;w="length"in h?ur(h.length):w,L="omission"in h?ki(h.omission):L}c=Cr(c);var ne=c.length;if(tf(c)){var he=Ps(c);ne=he.length}if(w>=ne)return c;var ge=w-rf(L);if(ge<1)return L;var we=he?Na(he,0,ge).join(""):c.slice(0,ge);if(W===r)return we+L;if(he&&(ge+=we.length-ge),Ny(W)){if(c.slice(ge).search(W)){var We,Ke=we;for(W.global||(W=Jb(W.source,Cr(Re.exec(W))+"g")),W.lastIndex=0;We=W.exec(Ke);)var Ze=We.index;we=we.slice(0,Ze===r?ge:Ze)}}else if(c.indexOf(ki(W),ge)!=ge){var xt=we.lastIndexOf(W);xt>-1&&(we=we.slice(0,xt))}return we+L}function mse(c){return c=Cr(c),c&&$t.test(c)?c.replace(Xt,WQ):c}var vse=ff(function(c,h,w){return c+(w?" ":"")+h.toUpperCase()}),$y=L9("toUpperCase");function OA(c,h,w){return c=Cr(c),h=w?r:h,h===r?UQ(c)?GQ(c):RQ(c):c.match(h)||[]}var NA=hr(function(c,h){try{return $n(c,r,h)}catch(w){return Oy(w)?w:new tr(w)}}),bse=Ho(function(c,h){return is(h,function(w){w=io(w),qo(c,w,Ry(c[w],c))}),c});function yse(c){var h=c==null?0:c.length,w=qt();return c=h?Xr(c,function(L){if(typeof L[1]!="function")throw new ss(o);return[w(L[0]),L[1]]}):[],hr(function(L){for(var W=-1;++W_)return[];var w=M,L=ei(c,M);h=qt(h),c-=M;for(var W=Vb(L,h);++w0||h<0)?new xr(w):(c<0?w=w.takeRight(-c):c&&(w=w.drop(c)),h!==r&&(h=ur(h),w=h<0?w.dropRight(-h):w.take(h-c)),w)},xr.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},xr.prototype.toArray=function(){return this.take(M)},ro(xr.prototype,function(c,h){var w=/^(?:filter|find|map|reject)|While$/.test(h),L=/^(?:head|last)$/.test(h),W=re[L?"take"+(h=="last"?"Right":""):h],ne=L||/^find/.test(h);W&&(re.prototype[h]=function(){var he=this.__wrapped__,ge=L?[1]:arguments,we=he instanceof xr,We=ge[0],Ke=we||sr(he),Ze=function(br){var Er=W.apply(re,Ia([br],ge));return L&&xt?Er[0]:Er};Ke&&w&&typeof We=="function"&&We.length!=1&&(we=Ke=!1);var xt=this.__chain__,Nt=!!this.__actions__.length,Vt=ne&&!xt,fr=we&&!Nt;if(!ne&&Ke){he=fr?he:new xr(this);var Gt=c.apply(he,ge);return Gt.__actions__.push({func:qp,args:[Ze],thisArg:r}),new os(Gt,xt)}return Vt&&fr?c.apply(this,ge):(Gt=this.thru(Ze),Vt?L?Gt.value()[0]:Gt.value():Gt)})}),is(["pop","push","shift","sort","splice","unshift"],function(c){var h=pp[c],w=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",L=/^(?:pop|shift)$/.test(c);re.prototype[c]=function(){var W=arguments;if(L&&!this.__chain__){var ne=this.value();return h.apply(sr(ne)?ne:[],W)}return this[w](function(he){return h.apply(sr(he)?he:[],W)})}}),ro(xr.prototype,function(c,h){var w=re[h];if(w){var L=w.name+"";Tr.call(af,L)||(af[L]=[]),af[L].push({name:h,func:w})}}),af[Lp(r,k).name]=[{name:"wrapper",func:r}],xr.prototype.clone=mee,xr.prototype.reverse=vee,xr.prototype.value=bee,re.prototype.at=Vre,re.prototype.chain=Gre,re.prototype.commit=Yre,re.prototype.next=Jre,re.prototype.plant=Zre,re.prototype.reverse=Qre,re.prototype.toJSON=re.prototype.valueOf=re.prototype.value=ene,re.prototype.first=re.prototype.head,vh&&(re.prototype[vh]=Xre),re},nf=YQ();gn?((gn.exports=nf)._=nf,jr._=nf):_r._=nf}).call(nn)}(Qd,Qd.exports);var gq=Qd.exports,A1={exports:{}};(function(t,e){var r=typeof self<"u"?self:nn,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function u(f){return f&&DataView.prototype.isPrototypeOf(f)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(f){return f&&l.indexOf(Object.prototype.toString.call(f))>-1};function g(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function y(f){return typeof f!="string"&&(f=String(f)),f}function A(f){var p={next:function(){var v=f.shift();return{done:v===void 0,value:v}}};return a.iterable&&(p[Symbol.iterator]=function(){return p}),p}function P(f){this.map={},f instanceof P?f.forEach(function(p,v){this.append(v,p)},this):Array.isArray(f)?f.forEach(function(p){this.append(p[0],p[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(p){this.append(p,f[p])},this)}P.prototype.append=function(f,p){f=g(f),p=y(p);var v=this.map[f];this.map[f]=v?v+", "+p:p},P.prototype.delete=function(f){delete this.map[g(f)]},P.prototype.get=function(f){return f=g(f),this.has(f)?this.map[f]:null},P.prototype.has=function(f){return this.map.hasOwnProperty(g(f))},P.prototype.set=function(f,p){this.map[g(f)]=y(p)},P.prototype.forEach=function(f,p){for(var v in this.map)this.map.hasOwnProperty(v)&&f.call(p,this.map[v],v,this)},P.prototype.keys=function(){var f=[];return this.forEach(function(p,v){f.push(v)}),A(f)},P.prototype.values=function(){var f=[];return this.forEach(function(p){f.push(p)}),A(f)},P.prototype.entries=function(){var f=[];return this.forEach(function(p,v){f.push([v,p])}),A(f)},a.iterable&&(P.prototype[Symbol.iterator]=P.prototype.entries);function N(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function D(f){return new Promise(function(p,v){f.onload=function(){p(f.result)},f.onerror=function(){v(f.error)}})}function k(f){var p=new FileReader,v=D(p);return p.readAsArrayBuffer(f),v}function $(f){var p=new FileReader,v=D(p);return p.readAsText(f),v}function q(f){for(var p=new Uint8Array(f),v=new Array(p.length),x=0;x-1?p:f}function z(f,p){p=p||{};var v=p.body;if(f instanceof z){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,p.headers||(this.headers=new P(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!v&&f._bodyInit!=null&&(v=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=p.credentials||this.credentials||"same-origin",(p.headers||!this.headers)&&(this.headers=new P(p.headers)),this.method=T(p.method||this.method||"GET"),this.mode=p.mode||this.mode||null,this.signal=p.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(v)}z.prototype.clone=function(){return new z(this,{body:this._bodyInit})};function ue(f){var p=new FormData;return f.trim().split("&").forEach(function(v){if(v){var x=v.split("="),_=x.shift().replace(/\+/g," "),S=x.join("=").replace(/\+/g," ");p.append(decodeURIComponent(_),decodeURIComponent(S))}}),p}function _e(f){var p=new P,v=f.replace(/\r?\n[\t ]+/g," ");return v.split(/\r?\n/).forEach(function(x){var _=x.split(":"),S=_.shift().trim();if(S){var b=_.join(":").trim();p.append(S,b)}}),p}K.call(z.prototype);function G(f,p){p||(p={}),this.type="default",this.status=p.status===void 0?200:p.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in p?p.statusText:"OK",this.headers=new P(p.headers),this.url=p.url||"",this._initBody(f)}K.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new P(this.headers),url:this.url})},G.error=function(){var f=new G(null,{status:0,statusText:""});return f.type="error",f};var E=[301,302,303,307,308];G.redirect=function(f,p){if(E.indexOf(p)===-1)throw new RangeError("Invalid status code");return new G(null,{status:p,headers:{location:f}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(p,v){this.message=p,this.name=v;var x=Error(p);this.stack=x.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function m(f,p){return new Promise(function(v,x){var _=new z(f,p);if(_.signal&&_.signal.aborted)return x(new o.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function b(){S.abort()}S.onload=function(){var M={status:S.status,statusText:S.statusText,headers:_e(S.getAllResponseHeaders()||"")};M.url="responseURL"in S?S.responseURL:M.headers.get("X-Request-URL");var I="response"in S?S.response:S.responseText;v(new G(I,M))},S.onerror=function(){x(new TypeError("Network request failed"))},S.ontimeout=function(){x(new TypeError("Network request failed"))},S.onabort=function(){x(new o.DOMException("Aborted","AbortError"))},S.open(_.method,_.url,!0),_.credentials==="include"?S.withCredentials=!0:_.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&a.blob&&(S.responseType="blob"),_.headers.forEach(function(M,I){S.setRequestHeader(I,M)}),_.signal&&(_.signal.addEventListener("abort",b),S.onreadystatechange=function(){S.readyState===4&&_.signal.removeEventListener("abort",b)}),S.send(typeof _._bodyInit>"u"?null:_._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=P,s.Request=z,s.Response=G),o.Headers=P,o.Request=z,o.Response=G,o.fetch=m,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(A1,A1.exports);var mq=A1.exports;const R6=Ui(mq);var vq=Object.defineProperty,bq=Object.defineProperties,yq=Object.getOwnPropertyDescriptors,D6=Object.getOwnPropertySymbols,wq=Object.prototype.hasOwnProperty,xq=Object.prototype.propertyIsEnumerable,O6=(t,e,r)=>e in t?vq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,N6=(t,e)=>{for(var r in e||(e={}))wq.call(e,r)&&O6(t,r,e[r]);if(D6)for(var r of D6(e))xq.call(e,r)&&O6(t,r,e[r]);return t},L6=(t,e)=>bq(t,yq(e));const _q={Accept:"application/json","Content-Type":"application/json"},Eq="POST",k6={headers:_q,method:Eq},$6=10;let ws=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new qi.EventEmitter,this.isAvailable=!1,this.registering=!1,!k_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=go(e),n=await(await R6(this.url,L6(N6({},k6),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!k_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=go({id:1,jsonrpc:"2.0",method:"test",params:[]});await R6(e,L6(N6({},k6),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Wa(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Vd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return R_(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>$6&&this.events.setMaxListeners($6)}};const B6="error",Sq="wss://relay.walletconnect.org",Aq="wc",Pq="universal_provider",F6=`${Aq}@2:${Pq}:`,U6="https://rpc.walletconnect.org/v1/",Mu="generic",Mq=`${U6}bundler`,Qi={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Iq=Object.defineProperty,Cq=Object.defineProperties,Tq=Object.getOwnPropertyDescriptors,j6=Object.getOwnPropertySymbols,Rq=Object.prototype.hasOwnProperty,Dq=Object.prototype.propertyIsEnumerable,q6=(t,e,r)=>e in t?Iq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,e0=(t,e)=>{for(var r in e||(e={}))Rq.call(e,r)&&q6(t,r,e[r]);if(j6)for(var r of j6(e))Dq.call(e,r)&&q6(t,r,e[r]);return t},Oq=(t,e)=>Cq(t,Tq(e));function Di(t,e,r){var n;const i=_u(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${U6}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function uc(t){return t.includes(":")?t.split(":")[1]:t}function z6(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Nq(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function P1(t={},e={}){const r=H6(t),n=H6(e);return gq.merge(r,n)}function H6(t){var e,r,n,i;const s={};if(!El(t))return s;for(const[o,a]of Object.entries(t)){const u=u1(o)?[o]:a.chains,l=a.methods||[],d=a.events||[],g=a.rpcMap||{},y=_l(o);s[y]=Oq(e0(e0({},s[y]),a),{chains:Ud(u,(e=s[y])==null?void 0:e.chains),methods:Ud(l,(r=s[y])==null?void 0:r.methods),events:Ud(d,(n=s[y])==null?void 0:n.events),rpcMap:e0(e0({},g),(i=s[y])==null?void 0:i.rpcMap)})}return s}function Lq(t){return t.includes(":")?t.split(":")[2]:t}function W6(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=u1(r)?[r]:n.chains?n.chains:z6(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function M1(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const K6={},Ar=t=>K6[t],I1=(t,e)=>{K6[t]=e};class kq{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=uc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}}var $q=Object.defineProperty,Bq=Object.defineProperties,Fq=Object.getOwnPropertyDescriptors,V6=Object.getOwnPropertySymbols,Uq=Object.prototype.hasOwnProperty,jq=Object.prototype.propertyIsEnumerable,G6=(t,e,r)=>e in t?$q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Y6=(t,e)=>{for(var r in e||(e={}))Uq.call(e,r)&&G6(t,r,e[r]);if(V6)for(var r of V6(e))jq.call(e,r)&&G6(t,r,e[r]);return t},J6=(t,e)=>Bq(t,Fq(e));class qq{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(uc(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const u=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:J6(Y6({},o.sessionProperties||{}),{capabilities:J6(Y6({},a||{}),{[s]:u})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return u}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ha("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${Mq}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class zq{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=uc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}}let Hq=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=uc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}},Wq=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ji(new ws(n,Ar("disableProviderPing")))}},Kq=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=uc(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}},Vq=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=uc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}};class Gq{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=uc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}}let Yq=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new ws(n,Ar("disableProviderPing")))}};class Jq{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new ws(n))}}class Xq{constructor(e){this.name=Mu,this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=_u(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}}var Zq=Object.defineProperty,Qq=Object.defineProperties,ez=Object.getOwnPropertyDescriptors,X6=Object.getOwnPropertySymbols,tz=Object.prototype.hasOwnProperty,rz=Object.prototype.propertyIsEnumerable,Z6=(t,e,r)=>e in t?Zq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,t0=(t,e)=>{for(var r in e||(e={}))tz.call(e,r)&&Z6(t,r,e[r]);if(X6)for(var r of X6(e))rz.call(e,r)&&Z6(t,r,e[r]);return t},C1=(t,e)=>Qq(t,ez(e));let Q6=class BA{constructor(e){this.events=new Gg,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Zf(sd({level:(e==null?void 0:e.logger)||B6})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new BA(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:t0({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,Kd(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Dr("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=W6(this.session.namespaces);this.namespaces=P1(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=W6(s.namespaces);this.namespaces=P1(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==I6)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Mu?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(nc(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await S1.init({core:this.providerOpts.core,logger:this.providerOpts.logger||B6,relayUrl:this.providerOpts.relayUrl||Sq,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>_l(r)))];I1("client",this.client),I1("events",this.events),I1("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Nq(r,this.session),i=z6(n),s=P1(this.namespaces,this.optionalNamespaces),o=C1(t0({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new qq({namespace:o});break;case"algorand":this.rpcProviders[r]=new Wq({namespace:o});break;case"solana":this.rpcProviders[r]=new zq({namespace:o});break;case"cosmos":this.rpcProviders[r]=new Hq({namespace:o});break;case"polkadot":this.rpcProviders[r]=new kq({namespace:o});break;case"cip34":this.rpcProviders[r]=new Kq({namespace:o});break;case"elrond":this.rpcProviders[r]=new Vq({namespace:o});break;case"multiversx":this.rpcProviders[r]=new Gq({namespace:o});break;case"near":this.rpcProviders[r]=new Yq({namespace:o});break;case"tezos":this.rpcProviders[r]=new Jq({namespace:o});break;default:this.rpcProviders[Mu]?this.rpcProviders[Mu].updateNamespace(o):this.rpcProviders[Mu]=new Xq({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&nc(i)&&this.events.emit("accountsChanged",i.map(Lq))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=_l(i),a=M1(i)!==M1(s)?`${o}:${M1(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=C1(t0({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",C1(t0({},Dr("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Qi.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Mu]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>_l(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=_l(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${F6}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${F6}/${e}`)}};const nz=Q6;function iz(){return new Promise(t=>{const e=[];let r;window.addEventListener("eip6963:announceProvider",n=>{const{detail:i}=n;r&&clearTimeout(r),e.push(i),r=setTimeout(()=>t(e),200)}),r=setTimeout(()=>t(e),200),window.dispatchEvent(new Event("eip6963:requestProvider"))})}class Gs{constructor(e,r){this.scope=e,this.module=r}storeObject(e,r){this.setItem(e,JSON.stringify(r))}loadObject(e){const r=this.getItem(e);return r?JSON.parse(r):void 0}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new Gs("CBWSDK").clear(),new Gs("walletlink").clear()}}const cn={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},T1={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},e5="Unspecified error message.",sz="Unspecified server error.";function R1(t,e=e5){if(t&&Number.isInteger(t)){const r=t.toString();if(D1(T1,r))return T1[r].message;if(t5(t))return sz}return e}function oz(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(T1[e]||t5(t))}function az(t,{shouldIncludeStack:e=!1}={}){const r={};if(t&&typeof t=="object"&&!Array.isArray(t)&&D1(t,"code")&&oz(t.code)){const n=t;r.code=n.code,n.message&&typeof n.message=="string"?(r.message=n.message,D1(n,"data")&&(r.data=n.data)):(r.message=R1(r.code),r.data={originalError:r5(t)})}else r.code=cn.rpc.internal,r.message=n5(t,"message")?t.message:e5,r.data={originalError:r5(t)};return e&&(r.stack=n5(t,"stack")?t.stack:void 0),r}function t5(t){return t>=-32099&&t<=-32e3}function r5(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function D1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function n5(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const Sr={rpc:{parse:t=>es(cn.rpc.parse,t),invalidRequest:t=>es(cn.rpc.invalidRequest,t),invalidParams:t=>es(cn.rpc.invalidParams,t),methodNotFound:t=>es(cn.rpc.methodNotFound,t),internal:t=>es(cn.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return es(e,t)},invalidInput:t=>es(cn.rpc.invalidInput,t),resourceNotFound:t=>es(cn.rpc.resourceNotFound,t),resourceUnavailable:t=>es(cn.rpc.resourceUnavailable,t),transactionRejected:t=>es(cn.rpc.transactionRejected,t),methodNotSupported:t=>es(cn.rpc.methodNotSupported,t),limitExceeded:t=>es(cn.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Iu(cn.provider.userRejectedRequest,t),unauthorized:t=>Iu(cn.provider.unauthorized,t),unsupportedMethod:t=>Iu(cn.provider.unsupportedMethod,t),disconnected:t=>Iu(cn.provider.disconnected,t),chainDisconnected:t=>Iu(cn.provider.chainDisconnected,t),unsupportedChain:t=>Iu(cn.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new o5(e,r,n)}}};function es(t,e){const[r,n]=i5(e);return new s5(t,r||R1(t),n)}function Iu(t,e){const[r,n]=i5(e);return new o5(t,r||R1(t),n)}function i5(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}class s5 extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}}class o5 extends s5{constructor(e,r,n){if(!cz(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}function cz(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function O1(){return t=>t}const Dl=O1(),uz=O1(),fz=O1();function Io(t){return Math.floor(t)}const a5=/^[0-9]*$/,c5=/^[a-f0-9]*$/;function fc(t){return N1(crypto.getRandomValues(new Uint8Array(t)))}function N1(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function r0(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function Ol(t,e=!1){const r=t.toString("hex");return Dl(e?`0x${r}`:r)}function L1(t){return Ol(B1(t),!0)}function Ys(t){return fz(t.toString(10))}function da(t){return Dl(`0x${BigInt(t).toString(16)}`)}function u5(t){return t.startsWith("0x")||t.startsWith("0X")}function k1(t){return u5(t)?t.slice(2):t}function f5(t){return u5(t)?`0x${t.slice(2)}`:`0x${t}`}function n0(t){if(typeof t!="string")return!1;const e=k1(t).toLowerCase();return c5.test(e)}function lz(t,e=!1){if(typeof t=="string"){const r=k1(t).toLowerCase();if(c5.test(r))return Dl(e?`0x${r}`:r)}throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function $1(t,e=!1){let r=lz(t,!1);return r.length%2===1&&(r=Dl(`0${r}`)),e?Dl(`0x${r}`):r}function pa(t){if(typeof t=="string"){const e=k1(t).toLowerCase();if(n0(e)&&e.length===40)return uz(f5(e))}throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function B1(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(n0(t)){const e=$1(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Sr.rpc.invalidParams(`Not binary data: ${String(t)}`)}function Nl(t){if(typeof t=="number"&&Number.isInteger(t))return Io(t);if(typeof t=="string"){if(a5.test(t))return Io(Number(t));if(n0(t))return Io(Number(BigInt($1(t,!0))))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function Ll(t){if(t!==null&&(typeof t=="bigint"||dz(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(Nl(t));if(typeof t=="string"){if(a5.test(t))return BigInt(t);if(n0(t))return BigInt($1(t,!0))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function hz(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Sr.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function dz(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function pz(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function gz(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function mz(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,new TextEncoder().encode(e));return{iv:r,cipherText:n}}async function vz(t,{iv:e,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return new TextDecoder().decode(n)}function l5(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function h5(t,e){const r=l5(t),n=await crypto.subtle.exportKey(r,e);return N1(new Uint8Array(n))}async function d5(t,e){const r=l5(t),n=r0(e).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function bz(t,e){const r=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return mz(e,r)}async function yz(t,e){return JSON.parse(await vz(e,t))}const F1={storageKey:"ownPrivateKey",keyType:"private"},U1={storageKey:"ownPublicKey",keyType:"public"},j1={storageKey:"peerPublicKey",keyType:"public"};class wz{constructor(){this.storage=new Gs("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(j1,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(U1.storageKey),this.storage.removeItem(F1.storageKey),this.storage.removeItem(j1.storageKey)}async generateKeyPair(){const e=await pz();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(F1,e.privateKey),await this.storeKey(U1,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(F1)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(U1)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(j1)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await gz(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const r=this.storage.getItem(e.storageKey);return r?d5(e.keyType,r):null}async storeKey(e,r){const n=await h5(e.keyType,r);this.storage.setItem(e.storageKey,n)}}const kl="4.2.4",p5="@coinbase/wallet-sdk";async function g5(t,e){const r=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":kl,"X-Cbw-Sdk-Platform":p5}}),{result:i,error:s}=await n.json();if(s)throw s;return i}function xz(){return globalThis.coinbaseWalletExtension}function _z(){var t,e;try{const r=globalThis;return(t=r.ethereum)!==null&&t!==void 0?t:(e=r.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Ez({metadata:t,preference:e}){var r,n;const{appName:i,appLogoUrl:s,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const u=xz();if(u)return(r=u.setAppInfo)===null||r===void 0||r.call(u,i,s,o,e),u}const a=_z();if(a!=null&&a.isCoinbaseBrowser)return(n=a.setAppInfo)===null||n===void 0||n.call(a,i,s,o,e),a}function Sz(t){if(!t||typeof t!="object"||Array.isArray(t))throw Sr.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:r}=t;if(typeof e!="string"||e.length===0)throw Sr.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Sr.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw Sr.provider.unsupportedMethod()}}const m5="accounts",v5="activeChain",b5="availableChains",y5="walletCapabilities";class Az{constructor(e){var r,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new wz,this.storage=new Gs("CBWSDK","SCWStateManager"),this.accounts=(r=this.storage.loadObject(m5))!==null&&r!==void 0?r:[],this.chain=this.storage.loadObject(v5)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var r,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(r=e.params)!==null&&r!==void 0?r:{})}}),s=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in s.content)throw s.content.failure;const o=await d5("public",s.sender);await this.keyManager.setPeerPublicKey(o);const u=(await this.decryptResponseMessage(s)).result;if("error"in u)throw u.error;const l=u.value;this.accounts=l,this.storage.storeObject(m5,l),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",l)}async request(e){var r;if(this.accounts.length===0)throw Sr.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:da(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return da(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(y5);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var r,n;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const i=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(i)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,r;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(r=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&r!==void 0?r:1}}async handleSwitchChainRequest(e){var r;const n=e.params;if(!n||!(!((r=n[0])===null||r===void 0)&&r.chainId))throw Sr.rpc.invalidParams();const i=Nl(n[0].chainId);if(this.updateChain(i))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(i),o}async sendEncryptedRequest(e){const r=await this.keyManager.getSharedSecret();if(!r)throw Sr.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await bz({action:e,chainId:this.chain.id},r),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const r=await h5("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:r,content:e,timestamp:new Date}}async decryptResponseMessage(e){var r,n;const i=e.content;if("failure"in i)throw i.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw Sr.provider.unauthorized("Invalid session");const o=await yz(i.encrypted,s),a=(r=o.data)===null||r===void 0?void 0:r.chains;if(a){const l=Object.entries(a).map(([d,g])=>({id:Number(d),rpcUrl:g}));this.storage.storeObject(b5,l),this.updateChain(this.chain.id,l)}const u=(n=o.data)===null||n===void 0?void 0:n.capabilities;return u&&this.storage.storeObject(y5,u),o}updateChain(e,r){var n;const i=r??this.storage.loadObject(b5),s=i==null?void 0:i.find(o=>o.id===e);return s?(s!==this.chain&&(this.chain=s,this.storage.storeObject(v5,s),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",da(s.id))),!0):!1}}const Pz=Jp(HP),{keccak_256:Mz}=Pz;function w5(t){return Buffer.allocUnsafe(t).fill(0)}function Iz(t){return t.toString(2).length}function x5(t,e){let r=t.toString(16);r.length%2!==0&&(r="0"+r);const n=r.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(r=I5(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(Js(t,e[s]));if(r==="dynamic"){var o=Js("uint256",e.length);i.unshift(o)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([Js("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,si.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Cu(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return si.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Cu(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=lc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+a);if(n<0)throw new Error("Supplied uint is negative");return si.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(r=Cu(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=lc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied int exceeds width: "+r+" vs "+a);const u=si.twosFromBigInt(n,256);return si.bufferBEFromBigInt(u,32)}else if(t.startsWith("ufixed")){if(r=M5(t),n=lc(e),n<0)throw new Error("Supplied ufixed is negative");return Js("uint256",n*BigInt(2)**BigInt(r[1]))}else if(t.startsWith("fixed"))return r=M5(t),Js("int256",lc(e)*BigInt(2)**BigInt(r[1]))}throw new Error("Unsupported or invalid type: "+t)}function Nz(t){return t==="string"||t==="bytes"||I5(t)==="dynamic"}function Lz(t){return t.lastIndexOf("]")===t.length-1}function kz(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var o=P5(t[s]),a=e[s],u=Js(o,a);Nz(o)?(r.push(Js("uint256",i)),n.push(u),i+=u.length):r.push(u)}return Buffer.concat(r.concat(n))}function C5(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(si.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=Cu(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=lc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+u);i.push(si.bufferBEFromBigInt(n,r/8))}else if(o.startsWith("int")){if(r=Cu(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=lc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied int exceeds width: "+r+" vs "+u);const l=si.twosFromBigInt(n,r);i.push(si.bufferBEFromBigInt(l,r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function $z(t,e){return si.keccak(C5(t,e))}var Bz={rawEncode:kz,solidityPack:C5,soliditySHA3:$z};const xs=A5,$l=Bz,T5={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},q1={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const o=(a,u,l)=>{if(r[u]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":xs.keccak(this.encodeData(u,l,r,n))];if(l===void 0)throw new Error(`missing value for field ${a} of type ${u}`);if(u==="bytes")return["bytes32",xs.keccak(l)];if(u==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",xs.keccak(l)];if(u.lastIndexOf("]")===u.length-1){const d=u.slice(0,u.lastIndexOf("[")),g=l.map(y=>o(a,d,y));return["bytes32",xs.keccak($l.rawEncode(g.map(([y])=>y),g.map(([,y])=>y)))]}return[u,l]};for(const a of r[t]){const[u,l]=o(a.name,a.type,e[a.name]);i.push(u),s.push(l)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=xs.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=xs.keccak(a),s.push(a);else if(r[o.type]!==void 0)i.push("bytes32"),a=xs.keccak(this.encodeData(o.type,a,r,n)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return $l.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return xs.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return xs.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in T5.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),xs.keccak(Buffer.concat(n))}};var Fz={TYPED_MESSAGE_SCHEMA:T5,TypedDataUtils:q1,hashForSignTypedDataLegacy:function(t){return Uz(t.data)},hashForSignTypedData_v3:function(t){return q1.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return q1.hash(t.data)}};function Uz(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?xs.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return $l.soliditySHA3(["bytes32","bytes32"],[$l.soliditySHA3(new Array(t.length).fill("string"),i),$l.soliditySHA3(n,r)])}const s0=Ui(Fz),jz="walletUsername",z1="Addresses",qz="AppVersion";function zn(t){return t.errorMessage!==void 0}class zz{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",r0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),a=16,u=o.slice(o.byteLength-a),l=o.slice(0,o.byteLength-a),d=new Uint8Array(u),g=new Uint8Array(l),y=new Uint8Array([...n,...d,...g]);return N1(y)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",r0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=r0(e),a=o.slice(0,12),u=o.slice(12,28),l=o.slice(28),d=new Uint8Array([...l,...u]),g={name:"AES-GCM",iv:new Uint8Array(a)};try{const y=await window.crypto.subtle.decrypt(g,s,d),A=new TextDecoder;n(A.decode(y))}catch(y){i(y)}})()})}}class Hz{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}var Co;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(Co||(Co={}));class Wz{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,Co.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,Co.DISCONNECTED)},i.onopen=s=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,Co.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(u=>this.sendData(u)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const u=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,u)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,Co.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const R5=1e4,Kz=6e4;class Vz{constructor({session:e,linkAPIUrl:r,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Io(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,u)=>{const l=s[u];l!==void 0&&a(l)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,u)},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(jz,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(qz,s)},this.handleChainUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(s),l=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(u,l)},this.session=e,this.cipher=new zz(e.secret),this.listener=n;const i=new Wz(`${r}/rpc`,WebSocket);i.setConnectionStateListener(async s=>{let o=!1;switch(s){case Co.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(u=>setTimeout(u,5e3)),this.destroyed||i.connect().catch(()=>{a()})};a()}break;case Co.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},R5),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case Co.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(s=>{var o;switch(s.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=s.type==="IsLinkedOK"?s.linked:void 0;this.linked=a||s.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(s.metadata);break}case"Event":{this.handleIncomingEvent(s);break}}s.id!==void 0&&((o=this.requestResolutions.get(s.id))===null||o===void 0||o(s))}),this.ws=i,this.http=new Hz(r,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Io(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:s,response:o}=i;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s,o)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Io(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>R5*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r={timeout:Kz}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r.timeout)}),new Promise(s=>{this.requestResolutions.set(n,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Io(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Io(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Io(this.nextReqId++),sessionId:this.session.id}),!0)}}class Gz{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=f5(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}const D5="session:id",O5="session:secret",N5="session:linked";class Tu{constructor(e,r,n,i=!1){this.storage=e,this.id=r,this.secret=n,this.key=EP(Ag(`${r}, ${n} WalletLink`)),this._linked=!!i}static create(e){const r=fc(16),n=fc(32);return new Tu(e,r,n).save()}static load(e){const r=e.getItem(D5),n=e.getItem(N5),i=e.getItem(O5);return r&&i?new Tu(e,r,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(D5,this.id),this.storage.setItem(O5,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(N5,this._linked?"1":"0")}}function Yz(){try{return window.frameElement!==null}catch{return!1}}function Jz(){try{return Yz()&&window.top?window.top.location:window.location}catch{return window.location}}function Xz(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function L5(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const Zz='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function k5(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(Zz)),document.documentElement.appendChild(t)}function $5(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e2&&(o.children=arguments.length>3?o0.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return a0(t,o,n,i,null)}function a0(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++B5,__i:-1,__u:0};return i==null&&Vr.vnode!=null&&Vr.vnode(s),s}function Ul(t){return t.children}function c0(t,e){this.props=t,this.context=e}function Ru(t,e){if(e==null)return t.__?Ru(t.__,t.__i+1):null;for(var r;ee&&hc.sort(H1));u0.__r=0}function W5(t,e,r,n,i,s,o,a,u,l,d){var g,y,A,P,N,D,k=n&&n.__k||q5,$=e.length;for(u=eH(r,e,k,u),g=0;g<$;g++)(A=r.__k[g])!=null&&(y=A.__i===-1?Fl:k[A.__i]||Fl,A.__i=g,D=J1(t,A,y,i,s,o,a,u,l,d),P=A.__e,A.ref&&y.ref!=A.ref&&(y.ref&&X1(y.ref,null,A),d.push(A.ref,A.__c||P,A)),N==null&&P!=null&&(N=P),4&A.__u||y.__k===A.__k?u=K5(A,u,t):typeof A.type=="function"&&D!==void 0?u=D:P&&(u=P.nextSibling),A.__u&=-7);return r.__e=N,u}function eH(t,e,r,n){var i,s,o,a,u,l=e.length,d=r.length,g=d,y=0;for(t.__k=[],i=0;i0?a0(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,(u=s.__i=tH(s,r,a,g))!==-1&&(g--,(o=r[u])&&(o.__u|=2)),o==null||o.__v===null?(u==-1&&y--,typeof s.type!="function"&&(s.__u|=4)):u!==a&&(u==a-1?y--:u==a+1?y++:(u>a?y--:y++,s.__u|=4))):s=t.__k[i]=null;if(g)for(i=0;i(u!=null&&!(2&u.__u)?1:0))for(;o>=0||a=0){if((u=e[o])&&!(2&u.__u)&&i==u.key&&s===u.type)return o;o--}if(a=r.__.length&&r.__.push({}),r.__[t]}function o4(t){return ev=1,iH(c4,t)}function iH(t,e,r){var n=s4(l0++,2);if(n.t=t,!n.__c&&(n.__=[c4(void 0,e),function(a){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,a);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=un,!un.u)){var i=function(a,u,l){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(y){return!!y.__c});if(d.every(function(y){return!y.__N}))return!s||s.call(this,a,u,l);var g=n.__c.props!==a;return d.forEach(function(y){if(y.__N){var A=y.__[0];y.__=y.__N,y.__N=void 0,A!==y.__[0]&&(g=!0)}}),s&&s.call(this,a,u,l)||g};un.u=!0;var s=un.shouldComponentUpdate,o=un.componentWillUpdate;un.componentWillUpdate=function(a,u,l){if(this.__e){var d=s;s=void 0,i(a,u,l),s=d}o&&o.call(this,a,u,l)},un.shouldComponentUpdate=i}return n.__N||n.__}function sH(t,e){var r=s4(l0++,3);!yn.__s&&cH(r.__H,e)&&(r.__=t,r.i=e,un.__H.__h.push(r))}function oH(){for(var t;t=Z5.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(h0),t.__H.__h.forEach(tv),t.__H.__h=[]}catch(e){t.__H.__h=[],yn.__e(e,t.__v)}}yn.__b=function(t){un=null,Q5&&Q5(t)},yn.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),i4&&i4(t,e)},yn.__r=function(t){e4&&e4(t),l0=0;var e=(un=t.__c).__H;e&&(Q1===un?(e.__h=[],un.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(h0),e.__h.forEach(tv),e.__h=[],l0=0)),Q1=un},yn.diffed=function(t){t4&&t4(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Z5.push(e)!==1&&X5===yn.requestAnimationFrame||((X5=yn.requestAnimationFrame)||aH)(oH)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),Q1=un=null},yn.__c=function(t,e){e.some(function(r){try{r.__h.forEach(h0),r.__h=r.__h.filter(function(n){return!n.__||tv(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],yn.__e(n,r.__v)}}),r4&&r4(t,e)},yn.unmount=function(t){n4&&n4(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{h0(n)}catch(i){e=i}}),r.__H=void 0,e&&yn.__e(e,r.__v))};var a4=typeof requestAnimationFrame=="function";function aH(t){var e,r=function(){clearTimeout(n),a4&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);a4&&(e=requestAnimationFrame(r))}function h0(t){var e=un,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),un=e}function tv(t){var e=un;t.__c=t.__(),un=e}function cH(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function c4(t,e){return typeof e=="function"?e(t):e}const uH=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",fH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",lH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class hH{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=L5()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const r=this.nextItemKey++;return this.items.set(r,e),this.render(),()=>{this.items.delete(r),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&Z1(Or("div",null,Or(u4,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,r])=>Or(dH,Object.assign({},r,{key:e}))))),this.root)}}const u4=t=>Or("div",{class:Bl("-cbwsdk-snackbar-container")},Or("style",null,uH),Or("div",{class:"-cbwsdk-snackbar"},t.children)),dH=({autoExpand:t,message:e,menuItems:r})=>{const[n,i]=o4(!0),[s,o]=o4(t??!1);sH(()=>{const u=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{u.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return Or("div",{class:Bl("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},Or("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},Or("img",{src:fH,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",Or("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),Or("div",{class:"-gear-container"},!s&&Or("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),Or("img",{src:lH,class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&Or("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((u,l)=>Or("div",{class:Bl("-cbwsdk-snackbar-instance-menu-item",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:u.onClick,key:l},Or("svg",{width:u.svgWidth,height:u.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("path",{"fill-rule":u.defaultFillRule,"clip-rule":u.defaultClipRule,d:u.path,fill:"#AAAAAA"})),Or("span",{class:Bl("-cbwsdk-snackbar-instance-menu-item-info",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},u.info)))))};class pH{constructor(){this.attached=!1,this.snackbar=new hH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.snackbar.attach(r),this.attached=!0,k5()}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}}const gH=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class mH{constructor(){this.root=null,this.darkMode=L5()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),k5()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(Z1(null,this.root),e&&Z1(Or(vH,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const vH=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return Or(u4,{darkMode:r},Or("div",{class:"-cbwsdk-redirect-dialog"},Or("style",null,gH),Or("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),Or("div",{class:Bl("-cbwsdk-redirect-dialog-box",s)},Or("p",null,t),Or("button",{onClick:n},e))))},bH="https://keys.coinbase.com/connect",f4="https://www.walletlink.org",yH="https://go.cb-w.com/walletlink";class l4{constructor(){this.attached=!1,this.redirectDialog=new mH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const r=new URL(yH);r.searchParams.append("redirect_url",Jz().href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class To{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=Xz(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(z1);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!u&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),To.accountRequestCallbackIds.size>0&&(Array.from(To.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),To.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new Gz,this.ui=n,this.ui.attach()}subscribe(){const e=Tu.load(this.storage)||Tu.create(this.storage),{linkAPIUrl:r}=this,n=new Vz({session:e,linkAPIUrl:r,listener:this}),i=this.isMobileWeb?new l4:new pH;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=Tu.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Gs.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Ys(e.weiValue),data:Ol(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Ys(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?Ys(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?Ys(e.gasPriceInWei):null,gasLimit:e.gasLimit?Ys(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Ys(e.weiValue),data:Ol(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Ys(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?Ys(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?Ys(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?Ys(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Ol(e,!0),chainId:r}})}getWalletLinkSession(){return this._session}sendRequest(e){let r=null;const n=fc(8),i=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,s),r==null||r()};return new Promise((s,o)=>{r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,a=>{if(r==null||r(),zn(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,r){const n={type:"WEB3_REQUEST",id:e,request:r};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:r.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(r.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof l4)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e,r){if(r.method==="requestEthereumAccounts"){To.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,r)),To.accountRequestCallbackIds.clear();return}this.invokeCallback(e,r)}handleErrorResponse(e,r,n){var i;const s=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:r,errorMessage:s})}invokeCallback(e,r){const n=this.relayEventManager.callbacks.get(e);n&&(n(r),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:r}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:r}},i=fc(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(zn(a))return o(new Error(a.errorMessage));s(a)}),To.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,r,n,i,s,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:o}};let u=null;const l=fc(8),d=g=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,g),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((g,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),zn(A))return y(new Error(A.errorMessage));g(A)}),this.publishWeb3RequestEvent(l,a)})}addEthereumChain(e,r,n,i,s,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:o}};let u=null;const l=fc(8),d=g=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,g),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((g,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),zn(A))return y(new Error(A.errorMessage));g(A)}),this.publishWeb3RequestEvent(l,a)})}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})};let i=null;const s=fc(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,u)=>{this.relayEventManager.callbacks.set(s,l=>{if(i==null||i(),zn(l)&&l.errorCode)return u(Sr.provider.custom({code:l.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(zn(l))return u(new Error(l.errorMessage));a(l)}),this.publishWeb3RequestEvent(s,n)})}}To.accountRequestCallbackIds=new Set;const h4="DefaultChainId",d4="DefaultJsonRpcUrl";class p4{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new Gs("walletlink",f4),this.callback=e.callback||null;const r=this._storage.getItem(z1);if(r){const n=r.split(" ");n[0]!==""&&(this._addresses=n.map(i=>pa(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:r,secret:n}=e.getWalletLinkSession();return{id:r,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(d4))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(d4,e)}updateProviderInfo(e,r){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(h4,r.toString(10)),Nl(r)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",da(r)))}async watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw Sr.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw Sr.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw Sr.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw Sr.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=r.options,l=await this.initializeRelay().watchAsset(r.type,i,s,a,o,n==null?void 0:n.toString());return zn(l)?!1:!!l.result}async addEthereumChain(e){var r,n;const i=e[0];if(((r=i.rpcUrls)===null||r===void 0?void 0:r.length)===0)throw Sr.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw Sr.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw Sr.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:u=[],chainName:l,iconUrls:d=[],nativeCurrency:g}=i,y=await o.addEthereumChain(s.toString(),a,d,u,l,g);if(zn(y))return!1;if(((n=y.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw Sr.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const r=e[0],n=Number.parseInt(r.chainId,16),s=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(zn(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,r){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(s=>pa(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(z1,i.join(" ")))}async request(e){const r=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return da(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(r);case"wallet_switchEthereumChain":return this.switchEthereumChain(r);case"wallet_watchAsset":return this.watchAsset(r);default:if(!this.jsonRpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const r=pa(e);if(!this._addresses.map(i=>pa(i)).includes(r))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?pa(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?pa(e.to):null,i=e.value!=null?Ll(e.value):BigInt(0),s=e.data?B1(e.data):Buffer.alloc(0),o=e.nonce!=null?Nl(e.nonce):null,a=e.gasPrice!=null?Ll(e.gasPrice):null,u=e.maxFeePerGas!=null?Ll(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?Ll(e.maxPriorityFeePerGas):null,d=e.gas!=null?Ll(e.gas):null,g=e.chainId?Nl(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:u,maxPriorityFeePerGas:l,gasLimit:d,chainId:g}}async ecRecover(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:L1(n[0]),signature:L1(n[1]),addPrefix:r==="personal_ecRecover"}});if(zn(s))throw s;return s.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(h4))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,r;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:da(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(zn(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:da(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw Sr.rpc.invalidParams();const r=e[1],n=e[0];this._ensureKnownAddress(r);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:pa(r),message:L1(n),addPrefix:!0,typedDataJson:null}});if(zn(s))throw s;return s.result}async _eth_signTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(r);if(zn(i))throw i;return i.result}async _eth_sendRawTransaction(e){const r=B1(e[0]),i=await this.initializeRelay().submitEthereumTransaction(r,this.getChainId());if(zn(i))throw i;return i.result}async _eth_sendTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(r);if(zn(i))throw i;return i.result}async signTypedData(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const i=l=>{const d={eth_signTypedData_v1:s0.hashForSignTypedDataLegacy,eth_signTypedData_v3:s0.hashForSignTypedData_v3,eth_signTypedData_v4:s0.hashForSignTypedData_v4,eth_signTypedData:s0.hashForSignTypedData_v4};return Ol(d[r]({data:hz(l)}),!0)},s=n[r==="eth_signTypedData_v1"?1:0],o=n[r==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const u=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:pa(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(zn(u))throw u;return u.result}initializeRelay(){return this._relay||(this._relay=new To({linkAPIUrl:f4,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const g4="SignerType",m4=new Gs("CBWSDK","SignerConfigurator");function wH(){return m4.getItem(g4)}function xH(t){m4.setItem(g4,t)}async function _H(t){const{communicator:e,metadata:r,handshakeRequest:n,callback:i}=t;SH(e,r,i).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:o}=await e.postRequestAndWaitForResponse(s);return o}function EH(t){const{signerType:e,metadata:r,communicator:n,callback:i}=t;switch(e){case"scw":return new Az({metadata:r,callback:i,communicator:n});case"walletlink":return new p4({metadata:r,callback:i})}}async function SH(t,e,r){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new p4({metadata:e,callback:r});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const AH=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. +}`;var fr=NA(function(){return Mr(ne,Nt+"return "+Ze).apply(r,he)});if(fr.source=Ze,Ny(fr))throw fr;return fr}function fse(c){return Cr(c).toLowerCase()}function lse(c){return Cr(c).toUpperCase()}function hse(c,h,w){if(c=Cr(c),c&&(w||h===r))return z7(c);if(!c||!(h=ki(h)))return c;var L=Ps(c),W=Ps(h),ne=H7(L,W),he=W7(L,W)+1;return Na(L,ne,he).join("")}function dse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.slice(0,V7(c)+1);if(!c||!(h=ki(h)))return c;var L=Ps(c),W=W7(L,Ps(h))+1;return Na(L,0,W).join("")}function pse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.replace(B,"");if(!c||!(h=ki(h)))return c;var L=Ps(c),W=H7(L,Ps(h));return Na(L,W).join("")}function gse(c,h){var w=_e,L=G;if(Qr(h)){var W="separator"in h?h.separator:W;w="length"in h?ur(h.length):w,L="omission"in h?ki(h.omission):L}c=Cr(c);var ne=c.length;if(tf(c)){var he=Ps(c);ne=he.length}if(w>=ne)return c;var ge=w-rf(L);if(ge<1)return L;var we=he?Na(he,0,ge).join(""):c.slice(0,ge);if(W===r)return we+L;if(he&&(ge+=we.length-ge),Ly(W)){if(c.slice(ge).search(W)){var We,Ke=we;for(W.global||(W=Xb(W.source,Cr(Re.exec(W))+"g")),W.lastIndex=0;We=W.exec(Ke);)var Ze=We.index;we=we.slice(0,Ze===r?ge:Ze)}}else if(c.indexOf(ki(W),ge)!=ge){var xt=we.lastIndexOf(W);xt>-1&&(we=we.slice(0,xt))}return we+L}function mse(c){return c=Cr(c),c&&$t.test(c)?c.replace(Xt,WQ):c}var vse=ff(function(c,h,w){return c+(w?" ":"")+h.toUpperCase()}),By=L9("toUpperCase");function OA(c,h,w){return c=Cr(c),h=w?r:h,h===r?UQ(c)?GQ(c):RQ(c):c.match(h)||[]}var NA=hr(function(c,h){try{return $n(c,r,h)}catch(w){return Ny(w)?w:new tr(w)}}),bse=Ho(function(c,h){return is(h,function(w){w=io(w),qo(c,w,Dy(c[w],c))}),c});function yse(c){var h=c==null?0:c.length,w=qt();return c=h?Xr(c,function(L){if(typeof L[1]!="function")throw new ss(o);return[w(L[0]),L[1]]}):[],hr(function(L){for(var W=-1;++W_)return[];var w=M,L=ei(c,M);h=qt(h),c-=M;for(var W=Gb(L,h);++w0||h<0)?new xr(w):(c<0?w=w.takeRight(-c):c&&(w=w.drop(c)),h!==r&&(h=ur(h),w=h<0?w.dropRight(-h):w.take(h-c)),w)},xr.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},xr.prototype.toArray=function(){return this.take(M)},ro(xr.prototype,function(c,h){var w=/^(?:filter|find|map|reject)|While$/.test(h),L=/^(?:head|last)$/.test(h),W=re[L?"take"+(h=="last"?"Right":""):h],ne=L||/^find/.test(h);W&&(re.prototype[h]=function(){var he=this.__wrapped__,ge=L?[1]:arguments,we=he instanceof xr,We=ge[0],Ke=we||sr(he),Ze=function(br){var Er=W.apply(re,Ia([br],ge));return L&&xt?Er[0]:Er};Ke&&w&&typeof We=="function"&&We.length!=1&&(we=Ke=!1);var xt=this.__chain__,Nt=!!this.__actions__.length,Vt=ne&&!xt,fr=we&&!Nt;if(!ne&&Ke){he=fr?he:new xr(this);var Gt=c.apply(he,ge);return Gt.__actions__.push({func:qp,args:[Ze],thisArg:r}),new os(Gt,xt)}return Vt&&fr?c.apply(this,ge):(Gt=this.thru(Ze),Vt?L?Gt.value()[0]:Gt.value():Gt)})}),is(["pop","push","shift","sort","splice","unshift"],function(c){var h=pp[c],w=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",L=/^(?:pop|shift)$/.test(c);re.prototype[c]=function(){var W=arguments;if(L&&!this.__chain__){var ne=this.value();return h.apply(sr(ne)?ne:[],W)}return this[w](function(he){return h.apply(sr(he)?he:[],W)})}}),ro(xr.prototype,function(c,h){var w=re[h];if(w){var L=w.name+"";Tr.call(af,L)||(af[L]=[]),af[L].push({name:h,func:w})}}),af[Lp(r,k).name]=[{name:"wrapper",func:r}],xr.prototype.clone=mee,xr.prototype.reverse=vee,xr.prototype.value=bee,re.prototype.at=Vre,re.prototype.chain=Gre,re.prototype.commit=Yre,re.prototype.next=Jre,re.prototype.plant=Zre,re.prototype.reverse=Qre,re.prototype.toJSON=re.prototype.valueOf=re.prototype.value=ene,re.prototype.first=re.prototype.head,vh&&(re.prototype[vh]=Xre),re},nf=YQ();gn?((gn.exports=nf)._=nf,jr._=nf):_r._=nf}).call(nn)}(Qd,Qd.exports);var gq=Qd.exports,P1={exports:{}};(function(t,e){var r=typeof self<"u"?self:nn,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function u(f){return f&&DataView.prototype.isPrototypeOf(f)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(f){return f&&l.indexOf(Object.prototype.toString.call(f))>-1};function g(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function y(f){return typeof f!="string"&&(f=String(f)),f}function A(f){var p={next:function(){var v=f.shift();return{done:v===void 0,value:v}}};return a.iterable&&(p[Symbol.iterator]=function(){return p}),p}function P(f){this.map={},f instanceof P?f.forEach(function(p,v){this.append(v,p)},this):Array.isArray(f)?f.forEach(function(p){this.append(p[0],p[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(p){this.append(p,f[p])},this)}P.prototype.append=function(f,p){f=g(f),p=y(p);var v=this.map[f];this.map[f]=v?v+", "+p:p},P.prototype.delete=function(f){delete this.map[g(f)]},P.prototype.get=function(f){return f=g(f),this.has(f)?this.map[f]:null},P.prototype.has=function(f){return this.map.hasOwnProperty(g(f))},P.prototype.set=function(f,p){this.map[g(f)]=y(p)},P.prototype.forEach=function(f,p){for(var v in this.map)this.map.hasOwnProperty(v)&&f.call(p,this.map[v],v,this)},P.prototype.keys=function(){var f=[];return this.forEach(function(p,v){f.push(v)}),A(f)},P.prototype.values=function(){var f=[];return this.forEach(function(p){f.push(p)}),A(f)},P.prototype.entries=function(){var f=[];return this.forEach(function(p,v){f.push([v,p])}),A(f)},a.iterable&&(P.prototype[Symbol.iterator]=P.prototype.entries);function N(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function D(f){return new Promise(function(p,v){f.onload=function(){p(f.result)},f.onerror=function(){v(f.error)}})}function k(f){var p=new FileReader,v=D(p);return p.readAsArrayBuffer(f),v}function $(f){var p=new FileReader,v=D(p);return p.readAsText(f),v}function q(f){for(var p=new Uint8Array(f),v=new Array(p.length),x=0;x-1?p:f}function z(f,p){p=p||{};var v=p.body;if(f instanceof z){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,p.headers||(this.headers=new P(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!v&&f._bodyInit!=null&&(v=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=p.credentials||this.credentials||"same-origin",(p.headers||!this.headers)&&(this.headers=new P(p.headers)),this.method=T(p.method||this.method||"GET"),this.mode=p.mode||this.mode||null,this.signal=p.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(v)}z.prototype.clone=function(){return new z(this,{body:this._bodyInit})};function ue(f){var p=new FormData;return f.trim().split("&").forEach(function(v){if(v){var x=v.split("="),_=x.shift().replace(/\+/g," "),S=x.join("=").replace(/\+/g," ");p.append(decodeURIComponent(_),decodeURIComponent(S))}}),p}function _e(f){var p=new P,v=f.replace(/\r?\n[\t ]+/g," ");return v.split(/\r?\n/).forEach(function(x){var _=x.split(":"),S=_.shift().trim();if(S){var b=_.join(":").trim();p.append(S,b)}}),p}K.call(z.prototype);function G(f,p){p||(p={}),this.type="default",this.status=p.status===void 0?200:p.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in p?p.statusText:"OK",this.headers=new P(p.headers),this.url=p.url||"",this._initBody(f)}K.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new P(this.headers),url:this.url})},G.error=function(){var f=new G(null,{status:0,statusText:""});return f.type="error",f};var E=[301,302,303,307,308];G.redirect=function(f,p){if(E.indexOf(p)===-1)throw new RangeError("Invalid status code");return new G(null,{status:p,headers:{location:f}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(p,v){this.message=p,this.name=v;var x=Error(p);this.stack=x.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function m(f,p){return new Promise(function(v,x){var _=new z(f,p);if(_.signal&&_.signal.aborted)return x(new o.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function b(){S.abort()}S.onload=function(){var M={status:S.status,statusText:S.statusText,headers:_e(S.getAllResponseHeaders()||"")};M.url="responseURL"in S?S.responseURL:M.headers.get("X-Request-URL");var I="response"in S?S.response:S.responseText;v(new G(I,M))},S.onerror=function(){x(new TypeError("Network request failed"))},S.ontimeout=function(){x(new TypeError("Network request failed"))},S.onabort=function(){x(new o.DOMException("Aborted","AbortError"))},S.open(_.method,_.url,!0),_.credentials==="include"?S.withCredentials=!0:_.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&a.blob&&(S.responseType="blob"),_.headers.forEach(function(M,I){S.setRequestHeader(I,M)}),_.signal&&(_.signal.addEventListener("abort",b),S.onreadystatechange=function(){S.readyState===4&&_.signal.removeEventListener("abort",b)}),S.send(typeof _._bodyInit>"u"?null:_._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=P,s.Request=z,s.Response=G),o.Headers=P,o.Request=z,o.Response=G,o.fetch=m,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(P1,P1.exports);var mq=P1.exports;const R6=Ui(mq);var vq=Object.defineProperty,bq=Object.defineProperties,yq=Object.getOwnPropertyDescriptors,D6=Object.getOwnPropertySymbols,wq=Object.prototype.hasOwnProperty,xq=Object.prototype.propertyIsEnumerable,O6=(t,e,r)=>e in t?vq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,N6=(t,e)=>{for(var r in e||(e={}))wq.call(e,r)&&O6(t,r,e[r]);if(D6)for(var r of D6(e))xq.call(e,r)&&O6(t,r,e[r]);return t},L6=(t,e)=>bq(t,yq(e));const _q={Accept:"application/json","Content-Type":"application/json"},Eq="POST",k6={headers:_q,method:Eq},$6=10;let ws=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new qi.EventEmitter,this.isAvailable=!1,this.registering=!1,!k_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=go(e),n=await(await R6(this.url,L6(N6({},k6),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!k_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=go({id:1,jsonrpc:"2.0",method:"test",params:[]});await R6(e,L6(N6({},k6),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Wa(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Vd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return R_(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>$6&&this.events.setMaxListeners($6)}};const B6="error",Sq="wss://relay.walletconnect.org",Aq="wc",Pq="universal_provider",F6=`${Aq}@2:${Pq}:`,U6="https://rpc.walletconnect.org/v1/",Mu="generic",Mq=`${U6}bundler`,Qi={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Iq=Object.defineProperty,Cq=Object.defineProperties,Tq=Object.getOwnPropertyDescriptors,j6=Object.getOwnPropertySymbols,Rq=Object.prototype.hasOwnProperty,Dq=Object.prototype.propertyIsEnumerable,q6=(t,e,r)=>e in t?Iq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,e0=(t,e)=>{for(var r in e||(e={}))Rq.call(e,r)&&q6(t,r,e[r]);if(j6)for(var r of j6(e))Dq.call(e,r)&&q6(t,r,e[r]);return t},Oq=(t,e)=>Cq(t,Tq(e));function Di(t,e,r){var n;const i=_u(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${U6}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function uc(t){return t.includes(":")?t.split(":")[1]:t}function z6(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Nq(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function M1(t={},e={}){const r=H6(t),n=H6(e);return gq.merge(r,n)}function H6(t){var e,r,n,i;const s={};if(!El(t))return s;for(const[o,a]of Object.entries(t)){const u=f1(o)?[o]:a.chains,l=a.methods||[],d=a.events||[],g=a.rpcMap||{},y=_l(o);s[y]=Oq(e0(e0({},s[y]),a),{chains:Ud(u,(e=s[y])==null?void 0:e.chains),methods:Ud(l,(r=s[y])==null?void 0:r.methods),events:Ud(d,(n=s[y])==null?void 0:n.events),rpcMap:e0(e0({},g),(i=s[y])==null?void 0:i.rpcMap)})}return s}function Lq(t){return t.includes(":")?t.split(":")[2]:t}function W6(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=f1(r)?[r]:n.chains?n.chains:z6(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function I1(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const K6={},Ar=t=>K6[t],C1=(t,e)=>{K6[t]=e};class kq{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=uc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}}var $q=Object.defineProperty,Bq=Object.defineProperties,Fq=Object.getOwnPropertyDescriptors,V6=Object.getOwnPropertySymbols,Uq=Object.prototype.hasOwnProperty,jq=Object.prototype.propertyIsEnumerable,G6=(t,e,r)=>e in t?$q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Y6=(t,e)=>{for(var r in e||(e={}))Uq.call(e,r)&&G6(t,r,e[r]);if(V6)for(var r of V6(e))jq.call(e,r)&&G6(t,r,e[r]);return t},J6=(t,e)=>Bq(t,Fq(e));class qq{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(uc(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const u=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:J6(Y6({},o.sessionProperties||{}),{capabilities:J6(Y6({},a||{}),{[s]:u})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return u}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ha("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${Mq}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class zq{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=uc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}}let Hq=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=uc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}},Wq=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ji(new ws(n,Ar("disableProviderPing")))}},Kq=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=uc(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}},Vq=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=uc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}};class Gq{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=uc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}}let Yq=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new ws(n,Ar("disableProviderPing")))}};class Jq{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new ws(n))}}class Xq{constructor(e){this.name=Mu,this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=_u(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}}var Zq=Object.defineProperty,Qq=Object.defineProperties,ez=Object.getOwnPropertyDescriptors,X6=Object.getOwnPropertySymbols,tz=Object.prototype.hasOwnProperty,rz=Object.prototype.propertyIsEnumerable,Z6=(t,e,r)=>e in t?Zq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,t0=(t,e)=>{for(var r in e||(e={}))tz.call(e,r)&&Z6(t,r,e[r]);if(X6)for(var r of X6(e))rz.call(e,r)&&Z6(t,r,e[r]);return t},T1=(t,e)=>Qq(t,ez(e));let Q6=class BA{constructor(e){this.events=new Yg,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Zf(sd({level:(e==null?void 0:e.logger)||B6})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new BA(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:t0({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,Kd(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Dr("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=W6(this.session.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=W6(s.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==I6)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Mu?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(nc(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await A1.init({core:this.providerOpts.core,logger:this.providerOpts.logger||B6,relayUrl:this.providerOpts.relayUrl||Sq,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>_l(r)))];C1("client",this.client),C1("events",this.events),C1("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Nq(r,this.session),i=z6(n),s=M1(this.namespaces,this.optionalNamespaces),o=T1(t0({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new qq({namespace:o});break;case"algorand":this.rpcProviders[r]=new Wq({namespace:o});break;case"solana":this.rpcProviders[r]=new zq({namespace:o});break;case"cosmos":this.rpcProviders[r]=new Hq({namespace:o});break;case"polkadot":this.rpcProviders[r]=new kq({namespace:o});break;case"cip34":this.rpcProviders[r]=new Kq({namespace:o});break;case"elrond":this.rpcProviders[r]=new Vq({namespace:o});break;case"multiversx":this.rpcProviders[r]=new Gq({namespace:o});break;case"near":this.rpcProviders[r]=new Yq({namespace:o});break;case"tezos":this.rpcProviders[r]=new Jq({namespace:o});break;default:this.rpcProviders[Mu]?this.rpcProviders[Mu].updateNamespace(o):this.rpcProviders[Mu]=new Xq({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&nc(i)&&this.events.emit("accountsChanged",i.map(Lq))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=_l(i),a=I1(i)!==I1(s)?`${o}:${I1(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=T1(t0({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",T1(t0({},Dr("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Qi.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Mu]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>_l(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=_l(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${F6}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${F6}/${e}`)}};const nz=Q6;function iz(){return new Promise(t=>{const e=[];let r;window.addEventListener("eip6963:announceProvider",n=>{const{detail:i}=n;r&&clearTimeout(r),e.push(i),r=setTimeout(()=>t(e),200)}),r=setTimeout(()=>t(e),200),window.dispatchEvent(new Event("eip6963:requestProvider"))})}class Gs{constructor(e,r){this.scope=e,this.module=r}storeObject(e,r){this.setItem(e,JSON.stringify(r))}loadObject(e){const r=this.getItem(e);return r?JSON.parse(r):void 0}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new Gs("CBWSDK").clear(),new Gs("walletlink").clear()}}const cn={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},R1={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},e5="Unspecified error message.",sz="Unspecified server error.";function D1(t,e=e5){if(t&&Number.isInteger(t)){const r=t.toString();if(O1(R1,r))return R1[r].message;if(t5(t))return sz}return e}function oz(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(R1[e]||t5(t))}function az(t,{shouldIncludeStack:e=!1}={}){const r={};if(t&&typeof t=="object"&&!Array.isArray(t)&&O1(t,"code")&&oz(t.code)){const n=t;r.code=n.code,n.message&&typeof n.message=="string"?(r.message=n.message,O1(n,"data")&&(r.data=n.data)):(r.message=D1(r.code),r.data={originalError:r5(t)})}else r.code=cn.rpc.internal,r.message=n5(t,"message")?t.message:e5,r.data={originalError:r5(t)};return e&&(r.stack=n5(t,"stack")?t.stack:void 0),r}function t5(t){return t>=-32099&&t<=-32e3}function r5(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function O1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function n5(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const Sr={rpc:{parse:t=>es(cn.rpc.parse,t),invalidRequest:t=>es(cn.rpc.invalidRequest,t),invalidParams:t=>es(cn.rpc.invalidParams,t),methodNotFound:t=>es(cn.rpc.methodNotFound,t),internal:t=>es(cn.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return es(e,t)},invalidInput:t=>es(cn.rpc.invalidInput,t),resourceNotFound:t=>es(cn.rpc.resourceNotFound,t),resourceUnavailable:t=>es(cn.rpc.resourceUnavailable,t),transactionRejected:t=>es(cn.rpc.transactionRejected,t),methodNotSupported:t=>es(cn.rpc.methodNotSupported,t),limitExceeded:t=>es(cn.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Iu(cn.provider.userRejectedRequest,t),unauthorized:t=>Iu(cn.provider.unauthorized,t),unsupportedMethod:t=>Iu(cn.provider.unsupportedMethod,t),disconnected:t=>Iu(cn.provider.disconnected,t),chainDisconnected:t=>Iu(cn.provider.chainDisconnected,t),unsupportedChain:t=>Iu(cn.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new o5(e,r,n)}}};function es(t,e){const[r,n]=i5(e);return new s5(t,r||D1(t),n)}function Iu(t,e){const[r,n]=i5(e);return new o5(t,r||D1(t),n)}function i5(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}class s5 extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}}class o5 extends s5{constructor(e,r,n){if(!cz(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}function cz(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function N1(){return t=>t}const Dl=N1(),uz=N1(),fz=N1();function Io(t){return Math.floor(t)}const a5=/^[0-9]*$/,c5=/^[a-f0-9]*$/;function fc(t){return L1(crypto.getRandomValues(new Uint8Array(t)))}function L1(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function r0(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function Ol(t,e=!1){const r=t.toString("hex");return Dl(e?`0x${r}`:r)}function k1(t){return Ol(F1(t),!0)}function Ys(t){return fz(t.toString(10))}function da(t){return Dl(`0x${BigInt(t).toString(16)}`)}function u5(t){return t.startsWith("0x")||t.startsWith("0X")}function $1(t){return u5(t)?t.slice(2):t}function f5(t){return u5(t)?`0x${t.slice(2)}`:`0x${t}`}function n0(t){if(typeof t!="string")return!1;const e=$1(t).toLowerCase();return c5.test(e)}function lz(t,e=!1){if(typeof t=="string"){const r=$1(t).toLowerCase();if(c5.test(r))return Dl(e?`0x${r}`:r)}throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function B1(t,e=!1){let r=lz(t,!1);return r.length%2===1&&(r=Dl(`0${r}`)),e?Dl(`0x${r}`):r}function pa(t){if(typeof t=="string"){const e=$1(t).toLowerCase();if(n0(e)&&e.length===40)return uz(f5(e))}throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function F1(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(n0(t)){const e=B1(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Sr.rpc.invalidParams(`Not binary data: ${String(t)}`)}function Nl(t){if(typeof t=="number"&&Number.isInteger(t))return Io(t);if(typeof t=="string"){if(a5.test(t))return Io(Number(t));if(n0(t))return Io(Number(BigInt(B1(t,!0))))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function Ll(t){if(t!==null&&(typeof t=="bigint"||dz(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(Nl(t));if(typeof t=="string"){if(a5.test(t))return BigInt(t);if(n0(t))return BigInt(B1(t,!0))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function hz(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Sr.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function dz(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function pz(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function gz(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function mz(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,new TextEncoder().encode(e));return{iv:r,cipherText:n}}async function vz(t,{iv:e,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return new TextDecoder().decode(n)}function l5(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function h5(t,e){const r=l5(t),n=await crypto.subtle.exportKey(r,e);return L1(new Uint8Array(n))}async function d5(t,e){const r=l5(t),n=r0(e).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function bz(t,e){const r=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return mz(e,r)}async function yz(t,e){return JSON.parse(await vz(e,t))}const U1={storageKey:"ownPrivateKey",keyType:"private"},j1={storageKey:"ownPublicKey",keyType:"public"},q1={storageKey:"peerPublicKey",keyType:"public"};class wz{constructor(){this.storage=new Gs("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(q1,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(j1.storageKey),this.storage.removeItem(U1.storageKey),this.storage.removeItem(q1.storageKey)}async generateKeyPair(){const e=await pz();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(U1,e.privateKey),await this.storeKey(j1,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(U1)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(j1)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(q1)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await gz(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const r=this.storage.getItem(e.storageKey);return r?d5(e.keyType,r):null}async storeKey(e,r){const n=await h5(e.keyType,r);this.storage.setItem(e.storageKey,n)}}const kl="4.2.4",p5="@coinbase/wallet-sdk";async function g5(t,e){const r=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":kl,"X-Cbw-Sdk-Platform":p5}}),{result:i,error:s}=await n.json();if(s)throw s;return i}function xz(){return globalThis.coinbaseWalletExtension}function _z(){var t,e;try{const r=globalThis;return(t=r.ethereum)!==null&&t!==void 0?t:(e=r.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Ez({metadata:t,preference:e}){var r,n;const{appName:i,appLogoUrl:s,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const u=xz();if(u)return(r=u.setAppInfo)===null||r===void 0||r.call(u,i,s,o,e),u}const a=_z();if(a!=null&&a.isCoinbaseBrowser)return(n=a.setAppInfo)===null||n===void 0||n.call(a,i,s,o,e),a}function Sz(t){if(!t||typeof t!="object"||Array.isArray(t))throw Sr.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:r}=t;if(typeof e!="string"||e.length===0)throw Sr.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Sr.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw Sr.provider.unsupportedMethod()}}const m5="accounts",v5="activeChain",b5="availableChains",y5="walletCapabilities";class Az{constructor(e){var r,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new wz,this.storage=new Gs("CBWSDK","SCWStateManager"),this.accounts=(r=this.storage.loadObject(m5))!==null&&r!==void 0?r:[],this.chain=this.storage.loadObject(v5)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var r,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(r=e.params)!==null&&r!==void 0?r:{})}}),s=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in s.content)throw s.content.failure;const o=await d5("public",s.sender);await this.keyManager.setPeerPublicKey(o);const u=(await this.decryptResponseMessage(s)).result;if("error"in u)throw u.error;const l=u.value;this.accounts=l,this.storage.storeObject(m5,l),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",l)}async request(e){var r;if(this.accounts.length===0)throw Sr.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:da(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return da(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(y5);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var r,n;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const i=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(i)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,r;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(r=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&r!==void 0?r:1}}async handleSwitchChainRequest(e){var r;const n=e.params;if(!n||!(!((r=n[0])===null||r===void 0)&&r.chainId))throw Sr.rpc.invalidParams();const i=Nl(n[0].chainId);if(this.updateChain(i))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(i),o}async sendEncryptedRequest(e){const r=await this.keyManager.getSharedSecret();if(!r)throw Sr.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await bz({action:e,chainId:this.chain.id},r),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const r=await h5("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:r,content:e,timestamp:new Date}}async decryptResponseMessage(e){var r,n;const i=e.content;if("failure"in i)throw i.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw Sr.provider.unauthorized("Invalid session");const o=await yz(i.encrypted,s),a=(r=o.data)===null||r===void 0?void 0:r.chains;if(a){const l=Object.entries(a).map(([d,g])=>({id:Number(d),rpcUrl:g}));this.storage.storeObject(b5,l),this.updateChain(this.chain.id,l)}const u=(n=o.data)===null||n===void 0?void 0:n.capabilities;return u&&this.storage.storeObject(y5,u),o}updateChain(e,r){var n;const i=r??this.storage.loadObject(b5),s=i==null?void 0:i.find(o=>o.id===e);return s?(s!==this.chain&&(this.chain=s,this.storage.storeObject(v5,s),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",da(s.id))),!0):!1}}const Pz=Jp(HP),{keccak_256:Mz}=Pz;function w5(t){return Buffer.allocUnsafe(t).fill(0)}function Iz(t){return t.toString(2).length}function x5(t,e){let r=t.toString(16);r.length%2!==0&&(r="0"+r);const n=r.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(r=I5(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(Js(t,e[s]));if(r==="dynamic"){var o=Js("uint256",e.length);i.unshift(o)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([Js("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,si.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Cu(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return si.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Cu(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=lc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+a);if(n<0)throw new Error("Supplied uint is negative");return si.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(r=Cu(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=lc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied int exceeds width: "+r+" vs "+a);const u=si.twosFromBigInt(n,256);return si.bufferBEFromBigInt(u,32)}else if(t.startsWith("ufixed")){if(r=M5(t),n=lc(e),n<0)throw new Error("Supplied ufixed is negative");return Js("uint256",n*BigInt(2)**BigInt(r[1]))}else if(t.startsWith("fixed"))return r=M5(t),Js("int256",lc(e)*BigInt(2)**BigInt(r[1]))}throw new Error("Unsupported or invalid type: "+t)}function Nz(t){return t==="string"||t==="bytes"||I5(t)==="dynamic"}function Lz(t){return t.lastIndexOf("]")===t.length-1}function kz(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var o=P5(t[s]),a=e[s],u=Js(o,a);Nz(o)?(r.push(Js("uint256",i)),n.push(u),i+=u.length):r.push(u)}return Buffer.concat(r.concat(n))}function C5(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(si.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=Cu(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=lc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+u);i.push(si.bufferBEFromBigInt(n,r/8))}else if(o.startsWith("int")){if(r=Cu(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=lc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied int exceeds width: "+r+" vs "+u);const l=si.twosFromBigInt(n,r);i.push(si.bufferBEFromBigInt(l,r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function $z(t,e){return si.keccak(C5(t,e))}var Bz={rawEncode:kz,solidityPack:C5,soliditySHA3:$z};const xs=A5,$l=Bz,T5={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},z1={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const o=(a,u,l)=>{if(r[u]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":xs.keccak(this.encodeData(u,l,r,n))];if(l===void 0)throw new Error(`missing value for field ${a} of type ${u}`);if(u==="bytes")return["bytes32",xs.keccak(l)];if(u==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",xs.keccak(l)];if(u.lastIndexOf("]")===u.length-1){const d=u.slice(0,u.lastIndexOf("[")),g=l.map(y=>o(a,d,y));return["bytes32",xs.keccak($l.rawEncode(g.map(([y])=>y),g.map(([,y])=>y)))]}return[u,l]};for(const a of r[t]){const[u,l]=o(a.name,a.type,e[a.name]);i.push(u),s.push(l)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=xs.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=xs.keccak(a),s.push(a);else if(r[o.type]!==void 0)i.push("bytes32"),a=xs.keccak(this.encodeData(o.type,a,r,n)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return $l.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return xs.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return xs.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in T5.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),xs.keccak(Buffer.concat(n))}};var Fz={TYPED_MESSAGE_SCHEMA:T5,TypedDataUtils:z1,hashForSignTypedDataLegacy:function(t){return Uz(t.data)},hashForSignTypedData_v3:function(t){return z1.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return z1.hash(t.data)}};function Uz(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?xs.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return $l.soliditySHA3(["bytes32","bytes32"],[$l.soliditySHA3(new Array(t.length).fill("string"),i),$l.soliditySHA3(n,r)])}const s0=Ui(Fz),jz="walletUsername",H1="Addresses",qz="AppVersion";function zn(t){return t.errorMessage!==void 0}class zz{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",r0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),a=16,u=o.slice(o.byteLength-a),l=o.slice(0,o.byteLength-a),d=new Uint8Array(u),g=new Uint8Array(l),y=new Uint8Array([...n,...d,...g]);return L1(y)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",r0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=r0(e),a=o.slice(0,12),u=o.slice(12,28),l=o.slice(28),d=new Uint8Array([...l,...u]),g={name:"AES-GCM",iv:new Uint8Array(a)};try{const y=await window.crypto.subtle.decrypt(g,s,d),A=new TextDecoder;n(A.decode(y))}catch(y){i(y)}})()})}}class Hz{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}var Co;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(Co||(Co={}));class Wz{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,Co.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,Co.DISCONNECTED)},i.onopen=s=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,Co.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(u=>this.sendData(u)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const u=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,u)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,Co.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const R5=1e4,Kz=6e4;class Vz{constructor({session:e,linkAPIUrl:r,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Io(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,u)=>{const l=s[u];l!==void 0&&a(l)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,u)},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(jz,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(qz,s)},this.handleChainUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(s),l=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(u,l)},this.session=e,this.cipher=new zz(e.secret),this.listener=n;const i=new Wz(`${r}/rpc`,WebSocket);i.setConnectionStateListener(async s=>{let o=!1;switch(s){case Co.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(u=>setTimeout(u,5e3)),this.destroyed||i.connect().catch(()=>{a()})};a()}break;case Co.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},R5),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case Co.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(s=>{var o;switch(s.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=s.type==="IsLinkedOK"?s.linked:void 0;this.linked=a||s.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(s.metadata);break}case"Event":{this.handleIncomingEvent(s);break}}s.id!==void 0&&((o=this.requestResolutions.get(s.id))===null||o===void 0||o(s))}),this.ws=i,this.http=new Hz(r,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Io(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:s,response:o}=i;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s,o)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Io(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>R5*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r={timeout:Kz}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r.timeout)}),new Promise(s=>{this.requestResolutions.set(n,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Io(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Io(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Io(this.nextReqId++),sessionId:this.session.id}),!0)}}class Gz{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=f5(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}const D5="session:id",O5="session:secret",N5="session:linked";class Tu{constructor(e,r,n,i=!1){this.storage=e,this.id=r,this.secret=n,this.key=EP(Pg(`${r}, ${n} WalletLink`)),this._linked=!!i}static create(e){const r=fc(16),n=fc(32);return new Tu(e,r,n).save()}static load(e){const r=e.getItem(D5),n=e.getItem(N5),i=e.getItem(O5);return r&&i?new Tu(e,r,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(D5,this.id),this.storage.setItem(O5,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(N5,this._linked?"1":"0")}}function Yz(){try{return window.frameElement!==null}catch{return!1}}function Jz(){try{return Yz()&&window.top?window.top.location:window.location}catch{return window.location}}function Xz(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function L5(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const Zz='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function k5(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(Zz)),document.documentElement.appendChild(t)}function $5(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e2&&(o.children=arguments.length>3?o0.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return a0(t,o,n,i,null)}function a0(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++B5,__i:-1,__u:0};return i==null&&Vr.vnode!=null&&Vr.vnode(s),s}function Ul(t){return t.children}function c0(t,e){this.props=t,this.context=e}function Ru(t,e){if(e==null)return t.__?Ru(t.__,t.__i+1):null;for(var r;ee&&hc.sort(W1));u0.__r=0}function W5(t,e,r,n,i,s,o,a,u,l,d){var g,y,A,P,N,D,k=n&&n.__k||q5,$=e.length;for(u=eH(r,e,k,u),g=0;g<$;g++)(A=r.__k[g])!=null&&(y=A.__i===-1?Fl:k[A.__i]||Fl,A.__i=g,D=X1(t,A,y,i,s,o,a,u,l,d),P=A.__e,A.ref&&y.ref!=A.ref&&(y.ref&&Z1(y.ref,null,A),d.push(A.ref,A.__c||P,A)),N==null&&P!=null&&(N=P),4&A.__u||y.__k===A.__k?u=K5(A,u,t):typeof A.type=="function"&&D!==void 0?u=D:P&&(u=P.nextSibling),A.__u&=-7);return r.__e=N,u}function eH(t,e,r,n){var i,s,o,a,u,l=e.length,d=r.length,g=d,y=0;for(t.__k=[],i=0;i0?a0(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,(u=s.__i=tH(s,r,a,g))!==-1&&(g--,(o=r[u])&&(o.__u|=2)),o==null||o.__v===null?(u==-1&&y--,typeof s.type!="function"&&(s.__u|=4)):u!==a&&(u==a-1?y--:u==a+1?y++:(u>a?y--:y++,s.__u|=4))):s=t.__k[i]=null;if(g)for(i=0;i(u!=null&&!(2&u.__u)?1:0))for(;o>=0||a=0){if((u=e[o])&&!(2&u.__u)&&i==u.key&&s===u.type)return o;o--}if(a=r.__.length&&r.__.push({}),r.__[t]}function o4(t){return tv=1,iH(c4,t)}function iH(t,e,r){var n=s4(l0++,2);if(n.t=t,!n.__c&&(n.__=[c4(void 0,e),function(a){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,a);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=un,!un.u)){var i=function(a,u,l){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(y){return!!y.__c});if(d.every(function(y){return!y.__N}))return!s||s.call(this,a,u,l);var g=n.__c.props!==a;return d.forEach(function(y){if(y.__N){var A=y.__[0];y.__=y.__N,y.__N=void 0,A!==y.__[0]&&(g=!0)}}),s&&s.call(this,a,u,l)||g};un.u=!0;var s=un.shouldComponentUpdate,o=un.componentWillUpdate;un.componentWillUpdate=function(a,u,l){if(this.__e){var d=s;s=void 0,i(a,u,l),s=d}o&&o.call(this,a,u,l)},un.shouldComponentUpdate=i}return n.__N||n.__}function sH(t,e){var r=s4(l0++,3);!yn.__s&&cH(r.__H,e)&&(r.__=t,r.i=e,un.__H.__h.push(r))}function oH(){for(var t;t=Z5.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(h0),t.__H.__h.forEach(rv),t.__H.__h=[]}catch(e){t.__H.__h=[],yn.__e(e,t.__v)}}yn.__b=function(t){un=null,Q5&&Q5(t)},yn.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),i4&&i4(t,e)},yn.__r=function(t){e4&&e4(t),l0=0;var e=(un=t.__c).__H;e&&(ev===un?(e.__h=[],un.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(h0),e.__h.forEach(rv),e.__h=[],l0=0)),ev=un},yn.diffed=function(t){t4&&t4(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Z5.push(e)!==1&&X5===yn.requestAnimationFrame||((X5=yn.requestAnimationFrame)||aH)(oH)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),ev=un=null},yn.__c=function(t,e){e.some(function(r){try{r.__h.forEach(h0),r.__h=r.__h.filter(function(n){return!n.__||rv(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],yn.__e(n,r.__v)}}),r4&&r4(t,e)},yn.unmount=function(t){n4&&n4(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{h0(n)}catch(i){e=i}}),r.__H=void 0,e&&yn.__e(e,r.__v))};var a4=typeof requestAnimationFrame=="function";function aH(t){var e,r=function(){clearTimeout(n),a4&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);a4&&(e=requestAnimationFrame(r))}function h0(t){var e=un,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),un=e}function rv(t){var e=un;t.__c=t.__(),un=e}function cH(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function c4(t,e){return typeof e=="function"?e(t):e}const uH=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",fH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",lH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class hH{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=L5()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const r=this.nextItemKey++;return this.items.set(r,e),this.render(),()=>{this.items.delete(r),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&Q1(Or("div",null,Or(u4,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,r])=>Or(dH,Object.assign({},r,{key:e}))))),this.root)}}const u4=t=>Or("div",{class:Bl("-cbwsdk-snackbar-container")},Or("style",null,uH),Or("div",{class:"-cbwsdk-snackbar"},t.children)),dH=({autoExpand:t,message:e,menuItems:r})=>{const[n,i]=o4(!0),[s,o]=o4(t??!1);sH(()=>{const u=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{u.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return Or("div",{class:Bl("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},Or("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},Or("img",{src:fH,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",Or("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),Or("div",{class:"-gear-container"},!s&&Or("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),Or("img",{src:lH,class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&Or("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((u,l)=>Or("div",{class:Bl("-cbwsdk-snackbar-instance-menu-item",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:u.onClick,key:l},Or("svg",{width:u.svgWidth,height:u.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("path",{"fill-rule":u.defaultFillRule,"clip-rule":u.defaultClipRule,d:u.path,fill:"#AAAAAA"})),Or("span",{class:Bl("-cbwsdk-snackbar-instance-menu-item-info",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},u.info)))))};class pH{constructor(){this.attached=!1,this.snackbar=new hH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.snackbar.attach(r),this.attached=!0,k5()}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}}const gH=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class mH{constructor(){this.root=null,this.darkMode=L5()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),k5()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(Q1(null,this.root),e&&Q1(Or(vH,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const vH=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return Or(u4,{darkMode:r},Or("div",{class:"-cbwsdk-redirect-dialog"},Or("style",null,gH),Or("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),Or("div",{class:Bl("-cbwsdk-redirect-dialog-box",s)},Or("p",null,t),Or("button",{onClick:n},e))))},bH="https://keys.coinbase.com/connect",f4="https://www.walletlink.org",yH="https://go.cb-w.com/walletlink";class l4{constructor(){this.attached=!1,this.redirectDialog=new mH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const r=new URL(yH);r.searchParams.append("redirect_url",Jz().href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class To{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=Xz(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(H1);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!u&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),To.accountRequestCallbackIds.size>0&&(Array.from(To.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),To.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new Gz,this.ui=n,this.ui.attach()}subscribe(){const e=Tu.load(this.storage)||Tu.create(this.storage),{linkAPIUrl:r}=this,n=new Vz({session:e,linkAPIUrl:r,listener:this}),i=this.isMobileWeb?new l4:new pH;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=Tu.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Gs.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Ys(e.weiValue),data:Ol(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Ys(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?Ys(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?Ys(e.gasPriceInWei):null,gasLimit:e.gasLimit?Ys(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Ys(e.weiValue),data:Ol(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Ys(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?Ys(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?Ys(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?Ys(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Ol(e,!0),chainId:r}})}getWalletLinkSession(){return this._session}sendRequest(e){let r=null;const n=fc(8),i=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,s),r==null||r()};return new Promise((s,o)=>{r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,a=>{if(r==null||r(),zn(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,r){const n={type:"WEB3_REQUEST",id:e,request:r};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:r.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(r.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof l4)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e,r){if(r.method==="requestEthereumAccounts"){To.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,r)),To.accountRequestCallbackIds.clear();return}this.invokeCallback(e,r)}handleErrorResponse(e,r,n){var i;const s=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:r,errorMessage:s})}invokeCallback(e,r){const n=this.relayEventManager.callbacks.get(e);n&&(n(r),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:r}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:r}},i=fc(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(zn(a))return o(new Error(a.errorMessage));s(a)}),To.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,r,n,i,s,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:o}};let u=null;const l=fc(8),d=g=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,g),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((g,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),zn(A))return y(new Error(A.errorMessage));g(A)}),this.publishWeb3RequestEvent(l,a)})}addEthereumChain(e,r,n,i,s,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:o}};let u=null;const l=fc(8),d=g=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,g),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((g,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),zn(A))return y(new Error(A.errorMessage));g(A)}),this.publishWeb3RequestEvent(l,a)})}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})};let i=null;const s=fc(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,u)=>{this.relayEventManager.callbacks.set(s,l=>{if(i==null||i(),zn(l)&&l.errorCode)return u(Sr.provider.custom({code:l.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(zn(l))return u(new Error(l.errorMessage));a(l)}),this.publishWeb3RequestEvent(s,n)})}}To.accountRequestCallbackIds=new Set;const h4="DefaultChainId",d4="DefaultJsonRpcUrl";class p4{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new Gs("walletlink",f4),this.callback=e.callback||null;const r=this._storage.getItem(H1);if(r){const n=r.split(" ");n[0]!==""&&(this._addresses=n.map(i=>pa(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:r,secret:n}=e.getWalletLinkSession();return{id:r,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(d4))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(d4,e)}updateProviderInfo(e,r){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(h4,r.toString(10)),Nl(r)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",da(r)))}async watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw Sr.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw Sr.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw Sr.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw Sr.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=r.options,l=await this.initializeRelay().watchAsset(r.type,i,s,a,o,n==null?void 0:n.toString());return zn(l)?!1:!!l.result}async addEthereumChain(e){var r,n;const i=e[0];if(((r=i.rpcUrls)===null||r===void 0?void 0:r.length)===0)throw Sr.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw Sr.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw Sr.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:u=[],chainName:l,iconUrls:d=[],nativeCurrency:g}=i,y=await o.addEthereumChain(s.toString(),a,d,u,l,g);if(zn(y))return!1;if(((n=y.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw Sr.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const r=e[0],n=Number.parseInt(r.chainId,16),s=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(zn(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,r){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(s=>pa(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(H1,i.join(" ")))}async request(e){const r=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return da(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(r);case"wallet_switchEthereumChain":return this.switchEthereumChain(r);case"wallet_watchAsset":return this.watchAsset(r);default:if(!this.jsonRpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const r=pa(e);if(!this._addresses.map(i=>pa(i)).includes(r))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?pa(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?pa(e.to):null,i=e.value!=null?Ll(e.value):BigInt(0),s=e.data?F1(e.data):Buffer.alloc(0),o=e.nonce!=null?Nl(e.nonce):null,a=e.gasPrice!=null?Ll(e.gasPrice):null,u=e.maxFeePerGas!=null?Ll(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?Ll(e.maxPriorityFeePerGas):null,d=e.gas!=null?Ll(e.gas):null,g=e.chainId?Nl(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:u,maxPriorityFeePerGas:l,gasLimit:d,chainId:g}}async ecRecover(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:k1(n[0]),signature:k1(n[1]),addPrefix:r==="personal_ecRecover"}});if(zn(s))throw s;return s.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(h4))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,r;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:da(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(zn(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:da(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw Sr.rpc.invalidParams();const r=e[1],n=e[0];this._ensureKnownAddress(r);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:pa(r),message:k1(n),addPrefix:!0,typedDataJson:null}});if(zn(s))throw s;return s.result}async _eth_signTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(r);if(zn(i))throw i;return i.result}async _eth_sendRawTransaction(e){const r=F1(e[0]),i=await this.initializeRelay().submitEthereumTransaction(r,this.getChainId());if(zn(i))throw i;return i.result}async _eth_sendTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(r);if(zn(i))throw i;return i.result}async signTypedData(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const i=l=>{const d={eth_signTypedData_v1:s0.hashForSignTypedDataLegacy,eth_signTypedData_v3:s0.hashForSignTypedData_v3,eth_signTypedData_v4:s0.hashForSignTypedData_v4,eth_signTypedData:s0.hashForSignTypedData_v4};return Ol(d[r]({data:hz(l)}),!0)},s=n[r==="eth_signTypedData_v1"?1:0],o=n[r==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const u=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:pa(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(zn(u))throw u;return u.result}initializeRelay(){return this._relay||(this._relay=new To({linkAPIUrl:f4,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const g4="SignerType",m4=new Gs("CBWSDK","SignerConfigurator");function wH(){return m4.getItem(g4)}function xH(t){m4.setItem(g4,t)}async function _H(t){const{communicator:e,metadata:r,handshakeRequest:n,callback:i}=t;SH(e,r,i).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:o}=await e.postRequestAndWaitForResponse(s);return o}function EH(t){const{signerType:e,metadata:r,communicator:n,callback:i}=t;switch(e){case"scw":return new Az({metadata:r,callback:i,communicator:n});case"walletlink":return new p4({metadata:r,callback:i})}}async function SH(t,e,r){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new p4({metadata:e,callback:r});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const AH=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. -Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,PH=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,r=await fetch(e,{method:"HEAD"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const n=r.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(AH)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:MH,getCrossOriginOpenerPolicy:IH}=PH(),v4=420,b4=540;function CH(t){const e=(window.innerWidth-v4)/2+window.screenX,r=(window.innerHeight-b4)/2+window.screenY;RH(t);const n=window.open(t,"Smart Wallet",`width=${v4}, height=${b4}, left=${e}, top=${r}`);if(n==null||n.focus(),!n)throw Sr.rpc.internal("Pop up window failed to open");return n}function TH(t){t&&!t.closed&&t.close()}function RH(t){const e={sdkName:p5,sdkVersion:kl,origin:window.location.origin,coop:IH()};for(const[r,n]of Object.entries(e))t.searchParams.append(r,n.toString())}class DH{constructor({url:e=bH,metadata:r,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=u=>{if(u.origin!==this.url.origin)return;const l=u.data;i(l)&&(s(l),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{TH(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(Sr.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=CH(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:kl,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw Sr.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=r,this.preference=n}}function OH(t){const e=az(NH(t),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",kl),r.searchParams.set("code",e.code.toString()),r.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:r.href})}function NH(t){var e;if(typeof t=="string")return{message:t,code:cn.rpc.internal};if(zn(t)){const r=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:r.match(/(denied|rejected)/i)?cn.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:r,code:n,data:{method:t.method}})}return t}var y4={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,l,d){this.fn=u,this.context=l,this.once=d||!1}function s(u,l,d,g,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var A=new i(d,g||u,y),P=r?r+l:l;return u._events[P]?u._events[P].fn?u._events[P]=[u._events[P],A]:u._events[P].push(A):(u._events[P]=A,u._eventsCount++),u}function o(u,l){--u._eventsCount===0?u._events=new n:delete u._events[l]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,g;if(this._eventsCount===0)return l;for(g in d=this._events)e.call(d,g)&&l.push(r?g.slice(1):g);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=r?r+l:l,g=this._events[d];if(!g)return[];if(g.fn)return[g.fn];for(var y=0,A=g.length,P=new Array(A);y(i||(i=jH(n)),i)}}function w4(t,e){return function(){return t.apply(e,arguments)}}const{toString:HH}=Object.prototype,{getPrototypeOf:rv}=Object,d0=(t=>e=>{const r=HH.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),_s=t=>(t=t.toLowerCase(),e=>d0(e)===t),p0=t=>e=>typeof e===t,{isArray:Du}=Array,jl=p0("undefined");function WH(t){return t!==null&&!jl(t)&&t.constructor!==null&&!jl(t.constructor)&&Oi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const x4=_s("ArrayBuffer");function KH(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&x4(t.buffer),e}const VH=p0("string"),Oi=p0("function"),_4=p0("number"),g0=t=>t!==null&&typeof t=="object",GH=t=>t===!0||t===!1,m0=t=>{if(d0(t)!=="object")return!1;const e=rv(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},YH=_s("Date"),JH=_s("File"),XH=_s("Blob"),ZH=_s("FileList"),QH=t=>g0(t)&&Oi(t.pipe),eW=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Oi(t.append)&&((e=d0(t))==="formdata"||e==="object"&&Oi(t.toString)&&t.toString()==="[object FormData]"))},tW=_s("URLSearchParams"),[rW,nW,iW,sW]=["ReadableStream","Request","Response","Headers"].map(_s),oW=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ql(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Du(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const dc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,S4=t=>!jl(t)&&t!==dc;function nv(){const{caseless:t}=S4(this)&&this||{},e={},r=(n,i)=>{const s=t&&E4(e,i)||i;m0(e[s])&&m0(n)?e[s]=nv(e[s],n):m0(n)?e[s]=nv({},n):Du(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(ql(e,(i,s)=>{r&&Oi(i)?t[s]=w4(i,r):t[s]=i},{allOwnKeys:n}),t),cW=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),uW=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},fW=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&rv(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},lW=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},hW=t=>{if(!t)return null;if(Du(t))return t;let e=t.length;if(!_4(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},dW=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&rv(Uint8Array)),pW=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},gW=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},mW=_s("HTMLFormElement"),vW=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),A4=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),bW=_s("RegExp"),P4=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};ql(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},yW=t=>{P4(t,(e,r)=>{if(Oi(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Oi(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},wW=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Du(t)?n(t):n(String(t).split(e)),r},xW=()=>{},_W=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,iv="abcdefghijklmnopqrstuvwxyz",M4="0123456789",I4={DIGIT:M4,ALPHA:iv,ALPHA_DIGIT:iv+iv.toUpperCase()+M4},EW=(t=16,e=I4.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function SW(t){return!!(t&&Oi(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const AW=t=>{const e=new Array(10),r=(n,i)=>{if(g0(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Du(n)?[]:{};return ql(n,(o,a)=>{const u=r(o,i+1);!jl(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},PW=_s("AsyncFunction"),MW=t=>t&&(g0(t)||Oi(t))&&Oi(t.then)&&Oi(t.catch),C4=((t,e)=>t?setImmediate:e?((r,n)=>(dc.addEventListener("message",({source:i,data:s})=>{i===dc&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),dc.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Oi(dc.postMessage)),IW=typeof queueMicrotask<"u"?queueMicrotask.bind(dc):typeof process<"u"&&process.nextTick||C4,Oe={isArray:Du,isArrayBuffer:x4,isBuffer:WH,isFormData:eW,isArrayBufferView:KH,isString:VH,isNumber:_4,isBoolean:GH,isObject:g0,isPlainObject:m0,isReadableStream:rW,isRequest:nW,isResponse:iW,isHeaders:sW,isUndefined:jl,isDate:YH,isFile:JH,isBlob:XH,isRegExp:bW,isFunction:Oi,isStream:QH,isURLSearchParams:tW,isTypedArray:dW,isFileList:ZH,forEach:ql,merge:nv,extend:aW,trim:oW,stripBOM:cW,inherits:uW,toFlatObject:fW,kindOf:d0,kindOfTest:_s,endsWith:lW,toArray:hW,forEachEntry:pW,matchAll:gW,isHTMLForm:mW,hasOwnProperty:A4,hasOwnProp:A4,reduceDescriptors:P4,freezeMethods:yW,toObjectSet:wW,toCamelCase:vW,noop:xW,toFiniteNumber:_W,findKey:E4,global:dc,isContextDefined:S4,ALPHABET:I4,generateString:EW,isSpecCompliantForm:SW,toJSONObject:AW,isAsyncFn:PW,isThenable:MW,setImmediate:C4,asap:IW};function ar(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Oe.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const T4=ar.prototype,R4={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{R4[t]={value:t}}),Object.defineProperties(ar,R4),Object.defineProperty(T4,"isAxiosError",{value:!0}),ar.from=(t,e,r,n,i,s)=>{const o=Object.create(T4);return Oe.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),ar.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const CW=null;function sv(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function D4(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function O4(t,e,r){return t?t.concat(e).map(function(i,s){return i=D4(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function TW(t){return Oe.isArray(t)&&!t.some(sv)}const RW=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function v0(t,e,r){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Oe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(N,D){return!Oe.isUndefined(D[N])});const n=r.metaTokens,i=r.visitor||d,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(i))throw new TypeError("visitor must be a function");function l(P){if(P===null)return"";if(Oe.isDate(P))return P.toISOString();if(!u&&Oe.isBlob(P))throw new ar("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(P)||Oe.isTypedArray(P)?u&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function d(P,N,D){let k=P;if(P&&!D&&typeof P=="object"){if(Oe.endsWith(N,"{}"))N=n?N:N.slice(0,-2),P=JSON.stringify(P);else if(Oe.isArray(P)&&TW(P)||(Oe.isFileList(P)||Oe.endsWith(N,"[]"))&&(k=Oe.toArray(P)))return N=D4(N),k.forEach(function(q,U){!(Oe.isUndefined(q)||q===null)&&e.append(o===!0?O4([N],U,s):o===null?N:N+"[]",l(q))}),!1}return sv(P)?!0:(e.append(O4(D,N,s),l(P)),!1)}const g=[],y=Object.assign(RW,{defaultVisitor:d,convertValue:l,isVisitable:sv});function A(P,N){if(!Oe.isUndefined(P)){if(g.indexOf(P)!==-1)throw Error("Circular reference detected in "+N.join("."));g.push(P),Oe.forEach(P,function(k,$){(!(Oe.isUndefined(k)||k===null)&&i.call(e,k,Oe.isString($)?$.trim():$,N,y))===!0&&A(k,N?N.concat($):[$])}),g.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return A(t),e}function N4(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function ov(t,e){this._pairs=[],t&&v0(t,this,e)}const L4=ov.prototype;L4.append=function(e,r){this._pairs.push([e,r])},L4.toString=function(e){const r=e?function(n){return e.call(this,n,N4)}:N4;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function DW(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function k4(t,e,r){if(!e)return t;const n=r&&r.encode||DW;Oe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(e,r):s=Oe.isURLSearchParams(e)?e.toString():new ov(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class $4{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(n){n!==null&&e(n)})}}const B4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},OW={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ov,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},av=typeof window<"u"&&typeof document<"u",cv=typeof navigator=="object"&&navigator||void 0,NW=av&&(!cv||["ReactNative","NativeScript","NS"].indexOf(cv.product)<0),LW=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",kW=av&&window.location.href||"http://localhost",Xn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:av,hasStandardBrowserEnv:NW,hasStandardBrowserWebWorkerEnv:LW,navigator:cv,origin:kW},Symbol.toStringTag,{value:"Module"})),...OW};function $W(t,e){return v0(t,new Xn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Xn.isNode&&Oe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function BW(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function FW(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&Oe.isArray(i)?i.length:o,u?(Oe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Oe.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Oe.isArray(i[o])&&(i[o]=FW(i[o])),!a)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const r={};return Oe.forEachEntry(t,(n,i)=>{e(BW(n),i,r,0)}),r}return null}function UW(t,e,r){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const zl={transitional:B4,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Oe.isObject(e);if(s&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return i?JSON.stringify(F4(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return $W(e,this.formSerializer).toString();if((a=Oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return v0(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),UW(e)):e}],transformResponse:[function(e){const r=this.transitional||zl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ar.from(a,ar.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xn.classes.FormData,Blob:Xn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{zl.headers[t]={}});const jW=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),qW=t=>{const e={};let r,n,i;return t&&t.split(` -`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&jW[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},U4=Symbol("internals");function Hl(t){return t&&String(t).trim().toLowerCase()}function b0(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(b0):String(t)}function zW(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const HW=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function uv(t,e,r,n,i){if(Oe.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Oe.isString(e)){if(Oe.isString(n))return e.indexOf(n)!==-1;if(Oe.isRegExp(n))return n.test(e)}}function WW(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function KW(t,e){const r=Oe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}let wi=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,u,l){const d=Hl(u);if(!d)throw new Error("header name must be a non-empty string");const g=Oe.findKey(i,d);(!g||i[g]===void 0||l===!0||l===void 0&&i[g]!==!1)&&(i[g||u]=b0(a))}const o=(a,u)=>Oe.forEach(a,(l,d)=>s(l,d,u));if(Oe.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(Oe.isString(e)&&(e=e.trim())&&!HW(e))o(qW(e),r);else if(Oe.isHeaders(e))for(const[a,u]of e.entries())s(u,a,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=Hl(e),e){const n=Oe.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return zW(i);if(Oe.isFunction(r))return r.call(this,i,n);if(Oe.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Hl(e),e){const n=Oe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||uv(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=Hl(o),o){const a=Oe.findKey(n,o);a&&(!r||uv(n,n[a],a,r))&&(delete n[a],i=!0)}}return Oe.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||uv(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Oe.forEach(this,(i,s)=>{const o=Oe.findKey(n,s);if(o){r[o]=b0(i),delete r[s];return}const a=e?WW(s):String(s).trim();a!==s&&delete r[s],r[a]=b0(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Oe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Oe.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[U4]=this[U4]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Hl(o);n[a]||(KW(i,o),n[a]=!0)}return Oe.isArray(e)?e.forEach(s):s(e),this}};wi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Oe.reduceDescriptors(wi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),Oe.freezeMethods(wi);function fv(t,e){const r=this||zl,n=e||r,i=wi.from(n.headers);let s=n.data;return Oe.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function j4(t){return!!(t&&t.__CANCEL__)}function Ou(t,e,r){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,r),this.name="CanceledError"}Oe.inherits(Ou,ar,{__CANCEL__:!0});function q4(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new ar("Request failed with status code "+r.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function VW(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function GW(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),d=n[s];o||(o=l),r[i]=u,n[i]=l;let g=s,y=0;for(;g!==i;)y+=r[g++],g=g%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),l-o{r=d,i=null,s&&(clearTimeout(s),s=null),t.apply(null,l)};return[(...l)=>{const d=Date.now(),g=d-r;g>=n?o(l,d):(i=l,s||(s=setTimeout(()=>{s=null,o(i)},n-g)))},()=>i&&o(i)]}const y0=(t,e,r=3)=>{let n=0;const i=GW(50,250);return YW(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,u=o-n,l=i(u),d=o<=a;n=o;const g={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:l||void 0,estimated:l&&a&&d?(a-o)/l:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(g)},r)},z4=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},H4=t=>(...e)=>Oe.asap(()=>t(...e)),JW=Xn.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Xn.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Xn.origin),Xn.navigator&&/(msie|trident)/i.test(Xn.navigator.userAgent)):()=>!0,XW=Xn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];Oe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Oe.isString(n)&&o.push("path="+n),Oe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function ZW(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function QW(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function W4(t,e){return t&&!ZW(e)?QW(t,e):e}const K4=t=>t instanceof wi?{...t}:t;function pc(t,e){e=e||{};const r={};function n(l,d,g,y){return Oe.isPlainObject(l)&&Oe.isPlainObject(d)?Oe.merge.call({caseless:y},l,d):Oe.isPlainObject(d)?Oe.merge({},d):Oe.isArray(d)?d.slice():d}function i(l,d,g,y){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l,g,y)}else return n(l,d,g,y)}function s(l,d){if(!Oe.isUndefined(d))return n(void 0,d)}function o(l,d){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l)}else return n(void 0,d)}function a(l,d,g){if(g in e)return n(l,d);if(g in t)return n(void 0,l)}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,d,g)=>i(K4(l),K4(d),g,!0)};return Oe.forEach(Object.keys(Object.assign({},t,e)),function(d){const g=u[d]||i,y=g(t[d],e[d],d);Oe.isUndefined(y)&&g!==a||(r[d]=y)}),r}const V4=t=>{const e=pc({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=wi.from(o),e.url=k4(W4(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(Oe.isFormData(r)){if(Xn.hasStandardBrowserEnv||Xn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[l,...d]=u?u.split(";").map(g=>g.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...d].join("; "))}}if(Xn.hasStandardBrowserEnv&&(n&&Oe.isFunction(n)&&(n=n(e)),n||n!==!1&&JW(e.url))){const l=i&&s&&XW.read(s);l&&o.set(i,l)}return e},eK=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=V4(t);let s=i.data;const o=wi.from(i.headers).normalize();let{responseType:a,onUploadProgress:u,onDownloadProgress:l}=i,d,g,y,A,P;function N(){A&&A(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let D=new XMLHttpRequest;D.open(i.method.toUpperCase(),i.url,!0),D.timeout=i.timeout;function k(){if(!D)return;const q=wi.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),K={data:!a||a==="text"||a==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:q,config:t,request:D};q4(function(T){r(T),N()},function(T){n(T),N()},K),D=null}"onloadend"in D?D.onloadend=k:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(k)},D.onabort=function(){D&&(n(new ar("Request aborted",ar.ECONNABORTED,t,D)),D=null)},D.onerror=function(){n(new ar("Network Error",ar.ERR_NETWORK,t,D)),D=null},D.ontimeout=function(){let U=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const K=i.transitional||B4;i.timeoutErrorMessage&&(U=i.timeoutErrorMessage),n(new ar(U,K.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,D)),D=null},s===void 0&&o.setContentType(null),"setRequestHeader"in D&&Oe.forEach(o.toJSON(),function(U,K){D.setRequestHeader(K,U)}),Oe.isUndefined(i.withCredentials)||(D.withCredentials=!!i.withCredentials),a&&a!=="json"&&(D.responseType=i.responseType),l&&([y,P]=y0(l,!0),D.addEventListener("progress",y)),u&&D.upload&&([g,A]=y0(u),D.upload.addEventListener("progress",g),D.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(d=q=>{D&&(n(!q||q.type?new Ou(null,t,D):q),D.abort(),D=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const $=VW(i.url);if($&&Xn.protocols.indexOf($)===-1){n(new ar("Unsupported protocol "+$+":",ar.ERR_BAD_REQUEST,t));return}D.send(s||null)})},tK=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i;const s=function(l){if(!i){i=!0,a();const d=l instanceof Error?l:this.reason;n.abort(d instanceof ar?d:new Ou(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,s(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),t=null)};t.forEach(l=>l.addEventListener("abort",s));const{signal:u}=n;return u.unsubscribe=()=>Oe.asap(a),u}},rK=function*(t,e){let r=t.byteLength;if(r{const i=nK(t,e);let s=0,o,a=u=>{o||(o=!0,n&&n(u))};return new ReadableStream({async pull(u){try{const{done:l,value:d}=await i.next();if(l){a(),u.close();return}let g=d.byteLength;if(r){let y=s+=g;r(y)}u.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(u){return a(u),i.return()}},{highWaterMark:2})},w0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Y4=w0&&typeof ReadableStream=="function",sK=w0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),J4=(t,...e)=>{try{return!!t(...e)}catch{return!1}},oK=Y4&&J4(()=>{let t=!1;const e=new Request(Xn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),X4=64*1024,lv=Y4&&J4(()=>Oe.isReadableStream(new Response("").body)),x0={stream:lv&&(t=>t.body)};w0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!x0[e]&&(x0[e]=Oe.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,n)})})})(new Response);const aK=async t=>{if(t==null)return 0;if(Oe.isBlob(t))return t.size;if(Oe.isSpecCompliantForm(t))return(await new Request(Xn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(t)||Oe.isArrayBuffer(t))return t.byteLength;if(Oe.isURLSearchParams(t)&&(t=t+""),Oe.isString(t))return(await sK(t)).byteLength},cK=async(t,e)=>{const r=Oe.toFiniteNumber(t.getContentLength());return r??aK(e)},hv={http:CW,xhr:eK,fetch:w0&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:l,headers:d,withCredentials:g="same-origin",fetchOptions:y}=V4(t);l=l?(l+"").toLowerCase():"text";let A=tK([i,s&&s.toAbortSignal()],o),P;const N=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let D;try{if(u&&oK&&r!=="get"&&r!=="head"&&(D=await cK(d,n))!==0){let K=new Request(e,{method:"POST",body:n,duplex:"half"}),J;if(Oe.isFormData(n)&&(J=K.headers.get("content-type"))&&d.setContentType(J),K.body){const[T,z]=z4(D,y0(H4(u)));n=G4(K.body,X4,T,z)}}Oe.isString(g)||(g=g?"include":"omit");const k="credentials"in Request.prototype;P=new Request(e,{...y,signal:A,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:k?g:void 0});let $=await fetch(P);const q=lv&&(l==="stream"||l==="response");if(lv&&(a||q&&N)){const K={};["status","statusText","headers"].forEach(ue=>{K[ue]=$[ue]});const J=Oe.toFiniteNumber($.headers.get("content-length")),[T,z]=a&&z4(J,y0(H4(a),!0))||[];$=new Response(G4($.body,X4,T,()=>{z&&z(),N&&N()}),K)}l=l||"text";let U=await x0[Oe.findKey(x0,l)||"text"]($,t);return!q&&N&&N(),await new Promise((K,J)=>{q4(K,J,{data:U,headers:wi.from($.headers),status:$.status,statusText:$.statusText,config:t,request:P})})}catch(k){throw N&&N(),k&&k.name==="TypeError"&&/fetch/i.test(k.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,P),{cause:k.cause||k}):ar.from(k,k&&k.code,t,P)}})};Oe.forEach(hv,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Z4=t=>`- ${t}`,uK=t=>Oe.isFunction(t)||t===null||t===!1,Q4={getAdapter:t=>{t=Oe.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : +Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,PH=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,r=await fetch(e,{method:"HEAD"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const n=r.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(AH)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:MH,getCrossOriginOpenerPolicy:IH}=PH(),v4=420,b4=540;function CH(t){const e=(window.innerWidth-v4)/2+window.screenX,r=(window.innerHeight-b4)/2+window.screenY;RH(t);const n=window.open(t,"Smart Wallet",`width=${v4}, height=${b4}, left=${e}, top=${r}`);if(n==null||n.focus(),!n)throw Sr.rpc.internal("Pop up window failed to open");return n}function TH(t){t&&!t.closed&&t.close()}function RH(t){const e={sdkName:p5,sdkVersion:kl,origin:window.location.origin,coop:IH()};for(const[r,n]of Object.entries(e))t.searchParams.append(r,n.toString())}class DH{constructor({url:e=bH,metadata:r,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=u=>{if(u.origin!==this.url.origin)return;const l=u.data;i(l)&&(s(l),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{TH(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(Sr.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=CH(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:kl,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw Sr.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=r,this.preference=n}}function OH(t){const e=az(NH(t),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",kl),r.searchParams.set("code",e.code.toString()),r.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:r.href})}function NH(t){var e;if(typeof t=="string")return{message:t,code:cn.rpc.internal};if(zn(t)){const r=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:r.match(/(denied|rejected)/i)?cn.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:r,code:n,data:{method:t.method}})}return t}var y4={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,l,d){this.fn=u,this.context=l,this.once=d||!1}function s(u,l,d,g,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var A=new i(d,g||u,y),P=r?r+l:l;return u._events[P]?u._events[P].fn?u._events[P]=[u._events[P],A]:u._events[P].push(A):(u._events[P]=A,u._eventsCount++),u}function o(u,l){--u._eventsCount===0?u._events=new n:delete u._events[l]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,g;if(this._eventsCount===0)return l;for(g in d=this._events)e.call(d,g)&&l.push(r?g.slice(1):g);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=r?r+l:l,g=this._events[d];if(!g)return[];if(g.fn)return[g.fn];for(var y=0,A=g.length,P=new Array(A);y(i||(i=jH(n)),i)}}function w4(t,e){return function(){return t.apply(e,arguments)}}const{toString:HH}=Object.prototype,{getPrototypeOf:nv}=Object,d0=(t=>e=>{const r=HH.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),_s=t=>(t=t.toLowerCase(),e=>d0(e)===t),p0=t=>e=>typeof e===t,{isArray:Du}=Array,jl=p0("undefined");function WH(t){return t!==null&&!jl(t)&&t.constructor!==null&&!jl(t.constructor)&&Oi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const x4=_s("ArrayBuffer");function KH(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&x4(t.buffer),e}const VH=p0("string"),Oi=p0("function"),_4=p0("number"),g0=t=>t!==null&&typeof t=="object",GH=t=>t===!0||t===!1,m0=t=>{if(d0(t)!=="object")return!1;const e=nv(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},YH=_s("Date"),JH=_s("File"),XH=_s("Blob"),ZH=_s("FileList"),QH=t=>g0(t)&&Oi(t.pipe),eW=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Oi(t.append)&&((e=d0(t))==="formdata"||e==="object"&&Oi(t.toString)&&t.toString()==="[object FormData]"))},tW=_s("URLSearchParams"),[rW,nW,iW,sW]=["ReadableStream","Request","Response","Headers"].map(_s),oW=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ql(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Du(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const dc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,S4=t=>!jl(t)&&t!==dc;function iv(){const{caseless:t}=S4(this)&&this||{},e={},r=(n,i)=>{const s=t&&E4(e,i)||i;m0(e[s])&&m0(n)?e[s]=iv(e[s],n):m0(n)?e[s]=iv({},n):Du(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(ql(e,(i,s)=>{r&&Oi(i)?t[s]=w4(i,r):t[s]=i},{allOwnKeys:n}),t),cW=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),uW=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},fW=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&nv(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},lW=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},hW=t=>{if(!t)return null;if(Du(t))return t;let e=t.length;if(!_4(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},dW=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&nv(Uint8Array)),pW=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},gW=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},mW=_s("HTMLFormElement"),vW=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),A4=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),bW=_s("RegExp"),P4=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};ql(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},yW=t=>{P4(t,(e,r)=>{if(Oi(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Oi(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},wW=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Du(t)?n(t):n(String(t).split(e)),r},xW=()=>{},_W=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,sv="abcdefghijklmnopqrstuvwxyz",M4="0123456789",I4={DIGIT:M4,ALPHA:sv,ALPHA_DIGIT:sv+sv.toUpperCase()+M4},EW=(t=16,e=I4.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function SW(t){return!!(t&&Oi(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const AW=t=>{const e=new Array(10),r=(n,i)=>{if(g0(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Du(n)?[]:{};return ql(n,(o,a)=>{const u=r(o,i+1);!jl(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},PW=_s("AsyncFunction"),MW=t=>t&&(g0(t)||Oi(t))&&Oi(t.then)&&Oi(t.catch),C4=((t,e)=>t?setImmediate:e?((r,n)=>(dc.addEventListener("message",({source:i,data:s})=>{i===dc&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),dc.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Oi(dc.postMessage)),IW=typeof queueMicrotask<"u"?queueMicrotask.bind(dc):typeof process<"u"&&process.nextTick||C4,Oe={isArray:Du,isArrayBuffer:x4,isBuffer:WH,isFormData:eW,isArrayBufferView:KH,isString:VH,isNumber:_4,isBoolean:GH,isObject:g0,isPlainObject:m0,isReadableStream:rW,isRequest:nW,isResponse:iW,isHeaders:sW,isUndefined:jl,isDate:YH,isFile:JH,isBlob:XH,isRegExp:bW,isFunction:Oi,isStream:QH,isURLSearchParams:tW,isTypedArray:dW,isFileList:ZH,forEach:ql,merge:iv,extend:aW,trim:oW,stripBOM:cW,inherits:uW,toFlatObject:fW,kindOf:d0,kindOfTest:_s,endsWith:lW,toArray:hW,forEachEntry:pW,matchAll:gW,isHTMLForm:mW,hasOwnProperty:A4,hasOwnProp:A4,reduceDescriptors:P4,freezeMethods:yW,toObjectSet:wW,toCamelCase:vW,noop:xW,toFiniteNumber:_W,findKey:E4,global:dc,isContextDefined:S4,ALPHABET:I4,generateString:EW,isSpecCompliantForm:SW,toJSONObject:AW,isAsyncFn:PW,isThenable:MW,setImmediate:C4,asap:IW};function ar(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Oe.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const T4=ar.prototype,R4={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{R4[t]={value:t}}),Object.defineProperties(ar,R4),Object.defineProperty(T4,"isAxiosError",{value:!0}),ar.from=(t,e,r,n,i,s)=>{const o=Object.create(T4);return Oe.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),ar.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const CW=null;function ov(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function D4(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function O4(t,e,r){return t?t.concat(e).map(function(i,s){return i=D4(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function TW(t){return Oe.isArray(t)&&!t.some(ov)}const RW=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function v0(t,e,r){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Oe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(N,D){return!Oe.isUndefined(D[N])});const n=r.metaTokens,i=r.visitor||d,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(i))throw new TypeError("visitor must be a function");function l(P){if(P===null)return"";if(Oe.isDate(P))return P.toISOString();if(!u&&Oe.isBlob(P))throw new ar("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(P)||Oe.isTypedArray(P)?u&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function d(P,N,D){let k=P;if(P&&!D&&typeof P=="object"){if(Oe.endsWith(N,"{}"))N=n?N:N.slice(0,-2),P=JSON.stringify(P);else if(Oe.isArray(P)&&TW(P)||(Oe.isFileList(P)||Oe.endsWith(N,"[]"))&&(k=Oe.toArray(P)))return N=D4(N),k.forEach(function(q,U){!(Oe.isUndefined(q)||q===null)&&e.append(o===!0?O4([N],U,s):o===null?N:N+"[]",l(q))}),!1}return ov(P)?!0:(e.append(O4(D,N,s),l(P)),!1)}const g=[],y=Object.assign(RW,{defaultVisitor:d,convertValue:l,isVisitable:ov});function A(P,N){if(!Oe.isUndefined(P)){if(g.indexOf(P)!==-1)throw Error("Circular reference detected in "+N.join("."));g.push(P),Oe.forEach(P,function(k,$){(!(Oe.isUndefined(k)||k===null)&&i.call(e,k,Oe.isString($)?$.trim():$,N,y))===!0&&A(k,N?N.concat($):[$])}),g.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return A(t),e}function N4(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function av(t,e){this._pairs=[],t&&v0(t,this,e)}const L4=av.prototype;L4.append=function(e,r){this._pairs.push([e,r])},L4.toString=function(e){const r=e?function(n){return e.call(this,n,N4)}:N4;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function DW(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function k4(t,e,r){if(!e)return t;const n=r&&r.encode||DW;Oe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(e,r):s=Oe.isURLSearchParams(e)?e.toString():new av(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class $4{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(n){n!==null&&e(n)})}}const B4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},OW={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:av,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},cv=typeof window<"u"&&typeof document<"u",uv=typeof navigator=="object"&&navigator||void 0,NW=cv&&(!uv||["ReactNative","NativeScript","NS"].indexOf(uv.product)<0),LW=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",kW=cv&&window.location.href||"http://localhost",Xn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:cv,hasStandardBrowserEnv:NW,hasStandardBrowserWebWorkerEnv:LW,navigator:uv,origin:kW},Symbol.toStringTag,{value:"Module"})),...OW};function $W(t,e){return v0(t,new Xn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Xn.isNode&&Oe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function BW(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function FW(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&Oe.isArray(i)?i.length:o,u?(Oe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Oe.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Oe.isArray(i[o])&&(i[o]=FW(i[o])),!a)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const r={};return Oe.forEachEntry(t,(n,i)=>{e(BW(n),i,r,0)}),r}return null}function UW(t,e,r){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const zl={transitional:B4,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Oe.isObject(e);if(s&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return i?JSON.stringify(F4(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return $W(e,this.formSerializer).toString();if((a=Oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return v0(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),UW(e)):e}],transformResponse:[function(e){const r=this.transitional||zl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ar.from(a,ar.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xn.classes.FormData,Blob:Xn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{zl.headers[t]={}});const jW=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),qW=t=>{const e={};let r,n,i;return t&&t.split(` +`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&jW[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},U4=Symbol("internals");function Hl(t){return t&&String(t).trim().toLowerCase()}function b0(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(b0):String(t)}function zW(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const HW=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function fv(t,e,r,n,i){if(Oe.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Oe.isString(e)){if(Oe.isString(n))return e.indexOf(n)!==-1;if(Oe.isRegExp(n))return n.test(e)}}function WW(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function KW(t,e){const r=Oe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}let wi=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,u,l){const d=Hl(u);if(!d)throw new Error("header name must be a non-empty string");const g=Oe.findKey(i,d);(!g||i[g]===void 0||l===!0||l===void 0&&i[g]!==!1)&&(i[g||u]=b0(a))}const o=(a,u)=>Oe.forEach(a,(l,d)=>s(l,d,u));if(Oe.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(Oe.isString(e)&&(e=e.trim())&&!HW(e))o(qW(e),r);else if(Oe.isHeaders(e))for(const[a,u]of e.entries())s(u,a,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=Hl(e),e){const n=Oe.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return zW(i);if(Oe.isFunction(r))return r.call(this,i,n);if(Oe.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Hl(e),e){const n=Oe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||fv(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=Hl(o),o){const a=Oe.findKey(n,o);a&&(!r||fv(n,n[a],a,r))&&(delete n[a],i=!0)}}return Oe.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||fv(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Oe.forEach(this,(i,s)=>{const o=Oe.findKey(n,s);if(o){r[o]=b0(i),delete r[s];return}const a=e?WW(s):String(s).trim();a!==s&&delete r[s],r[a]=b0(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Oe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Oe.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[U4]=this[U4]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Hl(o);n[a]||(KW(i,o),n[a]=!0)}return Oe.isArray(e)?e.forEach(s):s(e),this}};wi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Oe.reduceDescriptors(wi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),Oe.freezeMethods(wi);function lv(t,e){const r=this||zl,n=e||r,i=wi.from(n.headers);let s=n.data;return Oe.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function j4(t){return!!(t&&t.__CANCEL__)}function Ou(t,e,r){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,r),this.name="CanceledError"}Oe.inherits(Ou,ar,{__CANCEL__:!0});function q4(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new ar("Request failed with status code "+r.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function VW(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function GW(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),d=n[s];o||(o=l),r[i]=u,n[i]=l;let g=s,y=0;for(;g!==i;)y+=r[g++],g=g%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),l-o{r=d,i=null,s&&(clearTimeout(s),s=null),t.apply(null,l)};return[(...l)=>{const d=Date.now(),g=d-r;g>=n?o(l,d):(i=l,s||(s=setTimeout(()=>{s=null,o(i)},n-g)))},()=>i&&o(i)]}const y0=(t,e,r=3)=>{let n=0;const i=GW(50,250);return YW(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,u=o-n,l=i(u),d=o<=a;n=o;const g={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:l||void 0,estimated:l&&a&&d?(a-o)/l:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(g)},r)},z4=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},H4=t=>(...e)=>Oe.asap(()=>t(...e)),JW=Xn.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Xn.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Xn.origin),Xn.navigator&&/(msie|trident)/i.test(Xn.navigator.userAgent)):()=>!0,XW=Xn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];Oe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Oe.isString(n)&&o.push("path="+n),Oe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function ZW(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function QW(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function W4(t,e){return t&&!ZW(e)?QW(t,e):e}const K4=t=>t instanceof wi?{...t}:t;function pc(t,e){e=e||{};const r={};function n(l,d,g,y){return Oe.isPlainObject(l)&&Oe.isPlainObject(d)?Oe.merge.call({caseless:y},l,d):Oe.isPlainObject(d)?Oe.merge({},d):Oe.isArray(d)?d.slice():d}function i(l,d,g,y){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l,g,y)}else return n(l,d,g,y)}function s(l,d){if(!Oe.isUndefined(d))return n(void 0,d)}function o(l,d){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l)}else return n(void 0,d)}function a(l,d,g){if(g in e)return n(l,d);if(g in t)return n(void 0,l)}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,d,g)=>i(K4(l),K4(d),g,!0)};return Oe.forEach(Object.keys(Object.assign({},t,e)),function(d){const g=u[d]||i,y=g(t[d],e[d],d);Oe.isUndefined(y)&&g!==a||(r[d]=y)}),r}const V4=t=>{const e=pc({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=wi.from(o),e.url=k4(W4(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(Oe.isFormData(r)){if(Xn.hasStandardBrowserEnv||Xn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[l,...d]=u?u.split(";").map(g=>g.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...d].join("; "))}}if(Xn.hasStandardBrowserEnv&&(n&&Oe.isFunction(n)&&(n=n(e)),n||n!==!1&&JW(e.url))){const l=i&&s&&XW.read(s);l&&o.set(i,l)}return e},eK=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=V4(t);let s=i.data;const o=wi.from(i.headers).normalize();let{responseType:a,onUploadProgress:u,onDownloadProgress:l}=i,d,g,y,A,P;function N(){A&&A(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let D=new XMLHttpRequest;D.open(i.method.toUpperCase(),i.url,!0),D.timeout=i.timeout;function k(){if(!D)return;const q=wi.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),K={data:!a||a==="text"||a==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:q,config:t,request:D};q4(function(T){r(T),N()},function(T){n(T),N()},K),D=null}"onloadend"in D?D.onloadend=k:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(k)},D.onabort=function(){D&&(n(new ar("Request aborted",ar.ECONNABORTED,t,D)),D=null)},D.onerror=function(){n(new ar("Network Error",ar.ERR_NETWORK,t,D)),D=null},D.ontimeout=function(){let U=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const K=i.transitional||B4;i.timeoutErrorMessage&&(U=i.timeoutErrorMessage),n(new ar(U,K.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,D)),D=null},s===void 0&&o.setContentType(null),"setRequestHeader"in D&&Oe.forEach(o.toJSON(),function(U,K){D.setRequestHeader(K,U)}),Oe.isUndefined(i.withCredentials)||(D.withCredentials=!!i.withCredentials),a&&a!=="json"&&(D.responseType=i.responseType),l&&([y,P]=y0(l,!0),D.addEventListener("progress",y)),u&&D.upload&&([g,A]=y0(u),D.upload.addEventListener("progress",g),D.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(d=q=>{D&&(n(!q||q.type?new Ou(null,t,D):q),D.abort(),D=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const $=VW(i.url);if($&&Xn.protocols.indexOf($)===-1){n(new ar("Unsupported protocol "+$+":",ar.ERR_BAD_REQUEST,t));return}D.send(s||null)})},tK=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i;const s=function(l){if(!i){i=!0,a();const d=l instanceof Error?l:this.reason;n.abort(d instanceof ar?d:new Ou(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,s(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),t=null)};t.forEach(l=>l.addEventListener("abort",s));const{signal:u}=n;return u.unsubscribe=()=>Oe.asap(a),u}},rK=function*(t,e){let r=t.byteLength;if(r{const i=nK(t,e);let s=0,o,a=u=>{o||(o=!0,n&&n(u))};return new ReadableStream({async pull(u){try{const{done:l,value:d}=await i.next();if(l){a(),u.close();return}let g=d.byteLength;if(r){let y=s+=g;r(y)}u.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(u){return a(u),i.return()}},{highWaterMark:2})},w0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Y4=w0&&typeof ReadableStream=="function",sK=w0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),J4=(t,...e)=>{try{return!!t(...e)}catch{return!1}},oK=Y4&&J4(()=>{let t=!1;const e=new Request(Xn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),X4=64*1024,hv=Y4&&J4(()=>Oe.isReadableStream(new Response("").body)),x0={stream:hv&&(t=>t.body)};w0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!x0[e]&&(x0[e]=Oe.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,n)})})})(new Response);const aK=async t=>{if(t==null)return 0;if(Oe.isBlob(t))return t.size;if(Oe.isSpecCompliantForm(t))return(await new Request(Xn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(t)||Oe.isArrayBuffer(t))return t.byteLength;if(Oe.isURLSearchParams(t)&&(t=t+""),Oe.isString(t))return(await sK(t)).byteLength},cK=async(t,e)=>{const r=Oe.toFiniteNumber(t.getContentLength());return r??aK(e)},dv={http:CW,xhr:eK,fetch:w0&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:l,headers:d,withCredentials:g="same-origin",fetchOptions:y}=V4(t);l=l?(l+"").toLowerCase():"text";let A=tK([i,s&&s.toAbortSignal()],o),P;const N=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let D;try{if(u&&oK&&r!=="get"&&r!=="head"&&(D=await cK(d,n))!==0){let K=new Request(e,{method:"POST",body:n,duplex:"half"}),J;if(Oe.isFormData(n)&&(J=K.headers.get("content-type"))&&d.setContentType(J),K.body){const[T,z]=z4(D,y0(H4(u)));n=G4(K.body,X4,T,z)}}Oe.isString(g)||(g=g?"include":"omit");const k="credentials"in Request.prototype;P=new Request(e,{...y,signal:A,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:k?g:void 0});let $=await fetch(P);const q=hv&&(l==="stream"||l==="response");if(hv&&(a||q&&N)){const K={};["status","statusText","headers"].forEach(ue=>{K[ue]=$[ue]});const J=Oe.toFiniteNumber($.headers.get("content-length")),[T,z]=a&&z4(J,y0(H4(a),!0))||[];$=new Response(G4($.body,X4,T,()=>{z&&z(),N&&N()}),K)}l=l||"text";let U=await x0[Oe.findKey(x0,l)||"text"]($,t);return!q&&N&&N(),await new Promise((K,J)=>{q4(K,J,{data:U,headers:wi.from($.headers),status:$.status,statusText:$.statusText,config:t,request:P})})}catch(k){throw N&&N(),k&&k.name==="TypeError"&&/fetch/i.test(k.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,P),{cause:k.cause||k}):ar.from(k,k&&k.code,t,P)}})};Oe.forEach(dv,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Z4=t=>`- ${t}`,uK=t=>Oe.isFunction(t)||t===null||t===!1,Q4={getAdapter:t=>{t=Oe.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : `+s.map(Z4).join(` -`):" "+Z4(s[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:hv};function dv(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Ou(null,t)}function e8(t){return dv(t),t.headers=wi.from(t.headers),t.data=fv.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Q4.getAdapter(t.adapter||zl.adapter)(t).then(function(n){return dv(t),n.data=fv.call(t,t.transformResponse,n),n.headers=wi.from(n.headers),n},function(n){return j4(n)||(dv(t),n&&n.response&&(n.response.data=fv.call(t,t.transformResponse,n.response),n.response.headers=wi.from(n.response.headers))),Promise.reject(n)})}const t8="1.7.8",_0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{_0[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const r8={};_0.transitional=function(e,r,n){function i(s,o){return"[Axios v"+t8+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new ar(i(o," has been removed"+(r?" in "+r:"")),ar.ERR_DEPRECATED);return r&&!r8[o]&&(r8[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}},_0.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function fK(t,e,r){if(typeof t!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new ar("option "+s+" must be "+u,ar.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ar("Unknown option "+s,ar.ERR_BAD_OPTION)}}const E0={assertOptions:fK,validators:_0},Xs=E0.validators;let gc=class{constructor(e){this.defaults=e,this.interceptors={request:new $4,response:new $4}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` -`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=pc(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&E0.assertOptions(n,{silentJSONParsing:Xs.transitional(Xs.boolean),forcedJSONParsing:Xs.transitional(Xs.boolean),clarifyTimeoutError:Xs.transitional(Xs.boolean)},!1),i!=null&&(Oe.isFunction(i)?r.paramsSerializer={serialize:i}:E0.assertOptions(i,{encode:Xs.function,serialize:Xs.function},!0)),E0.assertOptions(r,{baseUrl:Xs.spelling("baseURL"),withXsrfToken:Xs.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Oe.merge(s.common,s[r.method]);s&&Oe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete s[P]}),r.headers=wi.concat(o,s);const a=[];let u=!0;this.interceptors.request.forEach(function(N){typeof N.runWhen=="function"&&N.runWhen(r)===!1||(u=u&&N.synchronous,a.unshift(N.fulfilled,N.rejected))});const l=[];this.interceptors.response.forEach(function(N){l.push(N.fulfilled,N.rejected)});let d,g=0,y;if(!u){const P=[e8.bind(this),void 0];for(P.unshift.apply(P,a),P.push.apply(P,l),y=P.length,d=Promise.resolve(r);g{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new Ou(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new FA(function(i){e=i}),cancel:e}}};function hK(t){return function(r){return t.apply(null,r)}}function dK(t){return Oe.isObject(t)&&t.isAxiosError===!0}const pv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(pv).forEach(([t,e])=>{pv[e]=t});function n8(t){const e=new gc(t),r=w4(gc.prototype.request,e);return Oe.extend(r,gc.prototype,e,{allOwnKeys:!0}),Oe.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return n8(pc(t,i))},r}const fn=n8(zl);fn.Axios=gc,fn.CanceledError=Ou,fn.CancelToken=lK,fn.isCancel=j4,fn.VERSION=t8,fn.toFormData=v0,fn.AxiosError=ar,fn.Cancel=fn.CanceledError,fn.all=function(e){return Promise.all(e)},fn.spread=hK,fn.isAxiosError=dK,fn.mergeConfig=pc,fn.AxiosHeaders=wi,fn.formToJSON=t=>F4(Oe.isHTMLForm(t)?new FormData(t):t),fn.getAdapter=Q4.getAdapter,fn.HttpStatusCode=pv,fn.default=fn;const{Axios:Roe,AxiosError:pK,CanceledError:Doe,isCancel:Ooe,CancelToken:Noe,VERSION:Loe,all:koe,Cancel:$oe,isAxiosError:Boe,spread:Foe,toFormData:Uoe,AxiosHeaders:joe,HttpStatusCode:qoe,formToJSON:zoe,getAdapter:Hoe,mergeConfig:Woe}=fn,i8=fn.create({timeout:6e4,headers:{"Content-Type":"application/json"}});function gK(t){var e,r,n;if(((e=t.data)==null?void 0:e.success)!==!0){const i=new pK((r=t.data)==null?void 0:r.errorMessage,(n=t.data)==null?void 0:n.errorCode,t.config,t.request,t);return Promise.reject(i)}else return t}i8.interceptors.response.use(gK);class mK{constructor(e){so(this,"_apiBase","");this.request=e}setApiBase(e){this._apiBase=e||""}async getNonce(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/nonce`,e);return r.data}async getEmailCode(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/get_code`,e);return r.data}async emailLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async walletLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async tonLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}}const ma=new mK(i8),vK={projectId:"7a4434fefbcc9af474fb5c995e47d286",metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},s8=zH({appName:"codatta",appLogoUrl:"https://avatars.githubusercontent.com/u/171659315"}),o8=Pe.createContext({saveLastUsedWallet:()=>{},lastUsedWallet:null,wallets:[],initialized:!1,featuredWallets:[]});function Wl(){return Pe.useContext(o8)}function bK(t){const{apiBaseUrl:e}=t,[r,n]=Pe.useState([]),[i,s]=Pe.useState([]),[o,a]=Pe.useState(null),[u,l]=Pe.useState(!1),d=A=>{console.log("saveLastUsedWallet",A)};function g(A){const P=A.filter(k=>k.featured||k.installed),N=A.filter(k=>!k.featured&&!k.installed),D=[...P,...N];n(D),s(P)}async function y(){const A=[],P=new Map;qA.forEach(D=>{const k=new Hf(D);D.name==="Coinbase Wallet"&&k.EIP6963Detected({info:{name:"Coinbase Wallet",uuid:"coinbase",icon:D.image,rdns:"coinbase"},provider:s8.getProvider()}),P.set(k.key,k),A.push(k)}),(await iz()).forEach(D=>{const k=P.get(D.info.name);if(k)k.EIP6963Detected(D);else{const $=new Hf(D);P.set($.key,$),A.push($)}});try{const D=JSON.parse(localStorage.getItem("xn-last-used-info")||"{}"),k=P.get(D.key);if(k){if(k.lastUsed=!0,D.provider==="UniversalProvider"){const $=await Q6.init(vK);$.session&&k.setUniversalProvider($)}a(k)}}catch(D){console.log(D)}g(A),l(!0)}return Pe.useEffect(()=>{y(),ma.setApiBase(e)},[]),me.jsx(o8.Provider,{value:{saveLastUsedWallet:d,wallets:r,initialized:u,lastUsedWallet:o,featuredWallets:i},children:t.children})}/** +`):" "+Z4(s[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:dv};function pv(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Ou(null,t)}function e8(t){return pv(t),t.headers=wi.from(t.headers),t.data=lv.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Q4.getAdapter(t.adapter||zl.adapter)(t).then(function(n){return pv(t),n.data=lv.call(t,t.transformResponse,n),n.headers=wi.from(n.headers),n},function(n){return j4(n)||(pv(t),n&&n.response&&(n.response.data=lv.call(t,t.transformResponse,n.response),n.response.headers=wi.from(n.response.headers))),Promise.reject(n)})}const t8="1.7.8",_0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{_0[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const r8={};_0.transitional=function(e,r,n){function i(s,o){return"[Axios v"+t8+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new ar(i(o," has been removed"+(r?" in "+r:"")),ar.ERR_DEPRECATED);return r&&!r8[o]&&(r8[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}},_0.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function fK(t,e,r){if(typeof t!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new ar("option "+s+" must be "+u,ar.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ar("Unknown option "+s,ar.ERR_BAD_OPTION)}}const E0={assertOptions:fK,validators:_0},Xs=E0.validators;let gc=class{constructor(e){this.defaults=e,this.interceptors={request:new $4,response:new $4}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` +`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=pc(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&E0.assertOptions(n,{silentJSONParsing:Xs.transitional(Xs.boolean),forcedJSONParsing:Xs.transitional(Xs.boolean),clarifyTimeoutError:Xs.transitional(Xs.boolean)},!1),i!=null&&(Oe.isFunction(i)?r.paramsSerializer={serialize:i}:E0.assertOptions(i,{encode:Xs.function,serialize:Xs.function},!0)),E0.assertOptions(r,{baseUrl:Xs.spelling("baseURL"),withXsrfToken:Xs.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Oe.merge(s.common,s[r.method]);s&&Oe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete s[P]}),r.headers=wi.concat(o,s);const a=[];let u=!0;this.interceptors.request.forEach(function(N){typeof N.runWhen=="function"&&N.runWhen(r)===!1||(u=u&&N.synchronous,a.unshift(N.fulfilled,N.rejected))});const l=[];this.interceptors.response.forEach(function(N){l.push(N.fulfilled,N.rejected)});let d,g=0,y;if(!u){const P=[e8.bind(this),void 0];for(P.unshift.apply(P,a),P.push.apply(P,l),y=P.length,d=Promise.resolve(r);g{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new Ou(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new FA(function(i){e=i}),cancel:e}}};function hK(t){return function(r){return t.apply(null,r)}}function dK(t){return Oe.isObject(t)&&t.isAxiosError===!0}const gv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(gv).forEach(([t,e])=>{gv[e]=t});function n8(t){const e=new gc(t),r=w4(gc.prototype.request,e);return Oe.extend(r,gc.prototype,e,{allOwnKeys:!0}),Oe.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return n8(pc(t,i))},r}const fn=n8(zl);fn.Axios=gc,fn.CanceledError=Ou,fn.CancelToken=lK,fn.isCancel=j4,fn.VERSION=t8,fn.toFormData=v0,fn.AxiosError=ar,fn.Cancel=fn.CanceledError,fn.all=function(e){return Promise.all(e)},fn.spread=hK,fn.isAxiosError=dK,fn.mergeConfig=pc,fn.AxiosHeaders=wi,fn.formToJSON=t=>F4(Oe.isHTMLForm(t)?new FormData(t):t),fn.getAdapter=Q4.getAdapter,fn.HttpStatusCode=gv,fn.default=fn;const{Axios:Roe,AxiosError:pK,CanceledError:Doe,isCancel:Ooe,CancelToken:Noe,VERSION:Loe,all:koe,Cancel:$oe,isAxiosError:Boe,spread:Foe,toFormData:Uoe,AxiosHeaders:joe,HttpStatusCode:qoe,formToJSON:zoe,getAdapter:Hoe,mergeConfig:Woe}=fn,i8=fn.create({timeout:6e4,headers:{"Content-Type":"application/json",token:localStorage.getItem("auth")}});function gK(t){var e,r,n;if(((e=t.data)==null?void 0:e.success)!==!0){const i=new pK((r=t.data)==null?void 0:r.errorMessage,(n=t.data)==null?void 0:n.errorCode,t.config,t.request,t);return Promise.reject(i)}else return t}i8.interceptors.response.use(gK);class mK{constructor(e){so(this,"_apiBase","");this.request=e}setApiBase(e){this._apiBase=e||""}async getNonce(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/nonce`,e);return r.data}async getEmailCode(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/get_code`,e);return r.data}async emailLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async walletLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async tonLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async bindEmail(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindTonWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindEvmWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}}const ma=new mK(i8),vK={projectId:"7a4434fefbcc9af474fb5c995e47d286",metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},s8=zH({appName:"codatta",appLogoUrl:"https://avatars.githubusercontent.com/u/171659315"}),o8=Pe.createContext({saveLastUsedWallet:()=>{},lastUsedWallet:null,wallets:[],initialized:!1,featuredWallets:[]});function Wl(){return Pe.useContext(o8)}function bK(t){const{apiBaseUrl:e}=t,[r,n]=Pe.useState([]),[i,s]=Pe.useState([]),[o,a]=Pe.useState(null),[u,l]=Pe.useState(!1),d=A=>{console.log("saveLastUsedWallet",A)};function g(A){const P=A.filter(k=>k.featured||k.installed),N=A.filter(k=>!k.featured&&!k.installed),D=[...P,...N];n(D),s(P)}async function y(){const A=[],P=new Map;qA.forEach(D=>{const k=new Hf(D);D.name==="Coinbase Wallet"&&k.EIP6963Detected({info:{name:"Coinbase Wallet",uuid:"coinbase",icon:D.image,rdns:"coinbase"},provider:s8.getProvider()}),P.set(k.key,k),A.push(k)}),(await iz()).forEach(D=>{const k=P.get(D.info.name);if(k)k.EIP6963Detected(D);else{const $=new Hf(D);P.set($.key,$),A.push($)}});try{const D=JSON.parse(localStorage.getItem("xn-last-used-info")||"{}"),k=P.get(D.key);if(k){if(k.lastUsed=!0,D.provider==="UniversalProvider"){const $=await Q6.init(vK);$.session&&k.setUniversalProvider($)}a(k)}}catch(D){console.log(D)}g(A),l(!0)}return Pe.useEffect(()=>{y(),ma.setApiBase(e)},[]),me.jsx(o8.Provider,{value:{saveLastUsedWallet:d,wallets:r,initialized:u,lastUsedWallet:o,featuredWallets:i},children:t.children})}/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -186,7 +186,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const f8=Es("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),l8=new Set;function S0(t,e,r){t||l8.has(e)||(console.warn(e),l8.add(e))}function CK(t){if(typeof Proxy>"u")return t;const e=new Map,r=(...n)=>(process.env.NODE_ENV!=="production"&&S0(!1,"motion() is deprecated. Use motion.create() instead."),t(...n));return new Proxy(r,{get:(n,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}function A0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const gv=t=>Array.isArray(t);function h8(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function mv(t,e,r,n){if(typeof e=="function"){const[i,s]=d8(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=d8(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function P0(t,e,r){const n=t.getProps();return mv(n,e,r!==void 0?r:n.custom,t)}const vv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],bv=["initial",...vv],Vl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],vc=new Set(Vl),Zs=t=>t*1e3,Ro=t=>t/1e3,TK={type:"spring",stiffness:500,damping:25,restSpeed:10},RK=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),DK={type:"keyframes",duration:.8},OK={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},NK=(t,{keyframes:e})=>e.length>2?DK:vc.has(t)?t.startsWith("scale")?RK(e[1]):TK:OK;function yv(t,e){return t?t[e]||t.default||t:void 0}const LK={useManualTiming:!1},kK=t=>t!==null;function M0(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(kK),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const Hn=t=>t;function $K(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){s.has(l)&&(u.schedule(l),t()),l(o)}const u={schedule:(l,d=!1,g=!1)=>{const A=g&&n?e:r;return d&&s.add(l),A.has(l)||A.add(l),l},cancel:l=>{r.delete(l),s.delete(l)},process:l=>{if(o=l,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,u.process(l))}};return u}const I0=["read","resolveKeyframes","update","preRender","render","postRender"],BK=40;function p8(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=I0.reduce((k,$)=>(k[$]=$K(s),k),{}),{read:a,resolveKeyframes:u,update:l,preRender:d,render:g,postRender:y}=o,A=()=>{const k=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(k-i.timestamp,BK),1),i.timestamp=k,i.isProcessing=!0,a.process(i),u.process(i),l.process(i),d.process(i),g.process(i),y.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(A))},P=()=>{r=!0,n=!0,i.isProcessing||t(A)};return{schedule:I0.reduce((k,$)=>{const q=o[$];return k[$]=(U,K=!1,J=!1)=>(r||P(),q.schedule(U,K,J)),k},{}),cancel:k=>{for(let $=0;$(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,FK=1e-7,UK=12;function jK(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=g8(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>FK&&++ajK(s,0,1,t,r);return s=>s===0||s===1?s:g8(i(s),e,n)}const m8=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,v8=t=>e=>1-t(1-e),b8=Gl(.33,1.53,.69,.99),xv=v8(b8),y8=m8(xv),w8=t=>(t*=2)<1?.5*xv(t):.5*(2-Math.pow(2,-10*(t-1))),_v=t=>1-Math.sin(Math.acos(t)),x8=v8(_v),_8=m8(_v),E8=t=>/^0[^.\s]+$/u.test(t);function qK(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||E8(t):!0}let Nu=Hn,Do=Hn;process.env.NODE_ENV!=="production"&&(Nu=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},Do=(t,e)=>{if(!t)throw new Error(e)});const S8=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),A8=t=>e=>typeof e=="string"&&e.startsWith(t),P8=A8("--"),zK=A8("var(--"),Ev=t=>zK(t)?HK.test(t.split("/*")[0].trim()):!1,HK=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,WK=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function KK(t){const e=WK.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}const VK=4;function M8(t,e,r=1){Do(r<=VK,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[n,i]=KK(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return S8(o)?parseFloat(o):o}return Ev(i)?M8(i,e,r+1):i}const ba=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},Yl={...Lu,transform:t=>ba(0,1,t)},C0={...Lu,default:1},Jl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),ya=Jl("deg"),Qs=Jl("%"),zt=Jl("px"),GK=Jl("vh"),YK=Jl("vw"),I8={...Qs,parse:t=>Qs.parse(t)/100,transform:t=>Qs.transform(t*100)},JK=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),C8=t=>t===Lu||t===zt,T8=(t,e)=>parseFloat(t.split(", ")[e]),R8=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return T8(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?T8(s[1],t):0}},XK=new Set(["x","y","z"]),ZK=Vl.filter(t=>!XK.has(t));function QK(t){const e=[];return ZK.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const ku={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:R8(4,13),y:R8(5,14)};ku.translateX=ku.x,ku.translateY=ku.y;const D8=t=>e=>e.test(t),O8=[Lu,zt,Qs,ya,YK,GK,{test:t=>t==="auto",parse:t=>t}],N8=t=>O8.find(D8(t)),bc=new Set;let Sv=!1,Av=!1;function L8(){if(Av){const t=Array.from(bc).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=QK(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}Av=!1,Sv=!1,bc.forEach(t=>t.complete()),bc.clear()}function k8(){bc.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Av=!0)})}function eV(){k8(),L8()}class Pv{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(bc.add(this),Sv||(Sv=!0,Nr.read(k8),Nr.resolveKeyframes(L8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sMath.round(t*1e5)/1e5,Mv=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function tV(t){return t==null}const rV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Iv=(t,e)=>r=>!!(typeof r=="string"&&rV.test(r)&&r.startsWith(t)||e&&!tV(r)&&Object.prototype.hasOwnProperty.call(r,e)),$8=(t,e,r)=>n=>{if(typeof n!="string")return n;const[i,s,o,a]=n.match(Mv);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},nV=t=>ba(0,255,t),Cv={...Lu,transform:t=>Math.round(nV(t))},yc={test:Iv("rgb","red"),parse:$8("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+Cv.transform(t)+", "+Cv.transform(e)+", "+Cv.transform(r)+", "+Xl(Yl.transform(n))+")"};function iV(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const Tv={test:Iv("#"),parse:iV,transform:yc.transform},$u={test:Iv("hsl","hue"),parse:$8("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+Qs.transform(Xl(e))+", "+Qs.transform(Xl(r))+", "+Xl(Yl.transform(n))+")"},Zn={test:t=>yc.test(t)||Tv.test(t)||$u.test(t),parse:t=>yc.test(t)?yc.parse(t):$u.test(t)?$u.parse(t):Tv.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?yc.transform(t):$u.transform(t)},sV=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function oV(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Mv))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(sV))===null||r===void 0?void 0:r.length)||0)>0}const B8="number",F8="color",aV="var",cV="var(",U8="${}",uV=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Zl(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(uV,u=>(Zn.test(u)?(n.color.push(s),i.push(F8),r.push(Zn.parse(u))):u.startsWith(cV)?(n.var.push(s),i.push(aV),r.push(u)):(n.number.push(s),i.push(B8),r.push(parseFloat(u))),++s,U8)).split(U8);return{values:r,split:a,indexes:n,types:i}}function j8(t){return Zl(t).values}function q8(t){const{split:e,types:r}=Zl(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function lV(t){const e=j8(t);return q8(t)(e.map(fV))}const wa={test:oV,parse:j8,createTransformer:q8,getAnimatableNone:lV},hV=new Set(["brightness","contrast","saturate","opacity"]);function dV(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(Mv)||[];if(!n)return t;const i=r.replace(n,"");let s=hV.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const pV=/\b([a-z-]*)\(.*?\)/gu,Rv={...wa,getAnimatableNone:t=>{const e=t.match(pV);return e?e.map(dV).join(" "):t}},gV={borderWidth:zt,borderTopWidth:zt,borderRightWidth:zt,borderBottomWidth:zt,borderLeftWidth:zt,borderRadius:zt,radius:zt,borderTopLeftRadius:zt,borderTopRightRadius:zt,borderBottomRightRadius:zt,borderBottomLeftRadius:zt,width:zt,maxWidth:zt,height:zt,maxHeight:zt,top:zt,right:zt,bottom:zt,left:zt,padding:zt,paddingTop:zt,paddingRight:zt,paddingBottom:zt,paddingLeft:zt,margin:zt,marginTop:zt,marginRight:zt,marginBottom:zt,marginLeft:zt,backgroundPositionX:zt,backgroundPositionY:zt},mV={rotate:ya,rotateX:ya,rotateY:ya,rotateZ:ya,scale:C0,scaleX:C0,scaleY:C0,scaleZ:C0,skew:ya,skewX:ya,skewY:ya,distance:zt,translateX:zt,translateY:zt,translateZ:zt,x:zt,y:zt,z:zt,perspective:zt,transformPerspective:zt,opacity:Yl,originX:I8,originY:I8,originZ:zt},z8={...Lu,transform:Math.round},Dv={...gV,...mV,zIndex:z8,size:zt,fillOpacity:Yl,strokeOpacity:Yl,numOctaves:z8},vV={...Dv,color:Zn,backgroundColor:Zn,outlineColor:Zn,fill:Zn,stroke:Zn,borderColor:Zn,borderTopColor:Zn,borderRightColor:Zn,borderBottomColor:Zn,borderLeftColor:Zn,filter:Rv,WebkitFilter:Rv},Ov=t=>vV[t];function H8(t,e){let r=Ov(t);return r!==Rv&&(r=wa),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const bV=new Set(["auto","none","0"]);function yV(t,e,r){let n=0,i;for(;n{r.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function Nv(t){return typeof t=="function"}let T0;function wV(){T0=void 0}const eo={now:()=>(T0===void 0&&eo.set(Wn.isProcessing||LK.useManualTiming?Wn.timestamp:performance.now()),T0),set:t=>{T0=t,queueMicrotask(wV)}},K8=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(wa.test(t)||t==="0")&&!t.startsWith("url("));function xV(t){const e=t[0];if(t.length===1)return!0;for(let r=0;rEV?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&eV(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=eo.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:u,isGenerator:l}=this.options;if(!l&&!_V(e,n,i,s))if(o)this.options.duration=0;else{u==null||u(M0(e,this.options,r)),a==null||a(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,r);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...d},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function G8(t,e){return e?t*(1e3/e):0}const SV=5;function Y8(t,e,r){const n=Math.max(e-SV,0);return G8(r-t(n),e-n)}const Lv=.001,AV=.01,J8=10,PV=.05,MV=1;function IV({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;Nu(t<=Zs(J8),"Spring duration must be 10 seconds or less");let o=1-e;o=ba(PV,MV,o),t=ba(AV,J8,Ro(t)),o<1?(i=l=>{const d=l*o,g=d*t,y=d-r,A=kv(l,o),P=Math.exp(-g);return Lv-y/A*P},s=l=>{const g=l*o*t,y=g*r+r,A=Math.pow(o,2)*Math.pow(l,2)*t,P=Math.exp(-g),N=kv(Math.pow(l,2),o);return(-i(l)+Lv>0?-1:1)*((y-A)*P)/N}):(i=l=>{const d=Math.exp(-l*t),g=(l-r)*t+1;return-Lv+d*g},s=l=>{const d=Math.exp(-l*t),g=(r-l)*(t*t);return d*g});const a=5/t,u=TV(i,s,a);if(t=Zs(t),isNaN(u))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(u,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:t}}}const CV=12;function TV(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function OV(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!X8(t,DV)&&X8(t,RV)){const r=IV(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function Z8({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:u,mass:l,duration:d,velocity:g,isResolvedFromDuration:y}=OV({...n,velocity:-Ro(n.velocity||0)}),A=g||0,P=u/(2*Math.sqrt(a*l)),N=s-i,D=Ro(Math.sqrt(a/l)),k=Math.abs(N)<5;r||(r=k?.01:2),e||(e=k?.005:.5);let $;if(P<1){const q=kv(D,P);$=U=>{const K=Math.exp(-P*D*U);return s-K*((A+P*D*N)/q*Math.sin(q*U)+N*Math.cos(q*U))}}else if(P===1)$=q=>s-Math.exp(-D*q)*(N+(A+D*N)*q);else{const q=D*Math.sqrt(P*P-1);$=U=>{const K=Math.exp(-P*D*U),J=Math.min(q*U,300);return s-K*((A+P*D*N)*Math.sinh(J)+q*N*Math.cosh(J))/q}}return{calculatedDuration:y&&d||null,next:q=>{const U=$(q);if(y)o.done=q>=d;else{let K=0;P<1&&(K=q===0?Zs(A):Y8($,q,U));const J=Math.abs(K)<=r,T=Math.abs(s-U)<=e;o.done=J&&T}return o.value=o.done?s:U,o}}}function Q8({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:d}){const g=t[0],y={done:!1,value:g},A=z=>a!==void 0&&zu,P=z=>a===void 0?u:u===void 0||Math.abs(a-z)-N*Math.exp(-z/n),q=z=>k+$(z),U=z=>{const ue=$(z),_e=q(z);y.done=Math.abs(ue)<=l,y.value=y.done?k:_e};let K,J;const T=z=>{A(y.value)&&(K=z,J=Z8({keyframes:[y.value,P(y.value)],velocity:Y8(q,z,y.value),damping:i,stiffness:s,restDelta:l,restSpeed:d}))};return T(0),{calculatedDuration:null,next:z=>{let ue=!1;return!J&&K===void 0&&(ue=!0,U(z),T(z)),K!==void 0&&z>=K?J.next(z-K):(!ue&&U(z),y)}}}const NV=Gl(.42,0,1,1),LV=Gl(0,0,.58,1),eE=Gl(.42,0,.58,1),kV=t=>Array.isArray(t)&&typeof t[0]!="number",$v=t=>Array.isArray(t)&&typeof t[0]=="number",tE={linear:Hn,easeIn:NV,easeInOut:eE,easeOut:LV,circIn:_v,circInOut:_8,circOut:x8,backIn:xv,backInOut:y8,backOut:b8,anticipate:w8},rE=t=>{if($v(t)){Do(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,r,n,i]=t;return Gl(e,r,n,i)}else if(typeof t=="string")return Do(tE[t]!==void 0,`Invalid easing type '${t}'`),tE[t];return t},$V=(t,e)=>r=>e(t(r)),Oo=(...t)=>t.reduce($V),Bu=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},Zr=(t,e,r)=>t+(e-t)*r;function Bv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function BV({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,u=2*r-a;i=Bv(u,a,t+1/3),s=Bv(u,a,t),o=Bv(u,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function R0(t,e){return r=>r>0?e:t}const Fv=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},FV=[Tv,yc,$u],UV=t=>FV.find(e=>e.test(t));function nE(t){const e=UV(t);if(Nu(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let r=e.parse(t);return e===$u&&(r=BV(r)),r}const iE=(t,e)=>{const r=nE(t),n=nE(e);if(!r||!n)return R0(t,e);const i={...r};return s=>(i.red=Fv(r.red,n.red,s),i.green=Fv(r.green,n.green,s),i.blue=Fv(r.blue,n.blue,s),i.alpha=Zr(r.alpha,n.alpha,s),yc.transform(i))},Uv=new Set(["none","hidden"]);function jV(t,e){return Uv.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function qV(t,e){return r=>Zr(t,e,r)}function jv(t){return typeof t=="number"?qV:typeof t=="string"?Ev(t)?R0:Zn.test(t)?iE:WV:Array.isArray(t)?sE:typeof t=="object"?Zn.test(t)?iE:zV:R0}function sE(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>jv(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function HV(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=wa.createTransformer(e),n=Zl(t),i=Zl(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?Uv.has(t)&&!i.values.length||Uv.has(e)&&!n.values.length?jV(t,e):Oo(sE(HV(n,i),i.values),r):(Nu(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),R0(t,e))};function oE(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Zr(t,e,r):jv(t)(t,e)}function KV(t,e,r){const n=[],i=r||oE,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=KV(e,n,i),a=o.length,u=l=>{let d=0;if(a>1)for(;du(ba(t[0],t[s-1],l)):u}function GV(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=Bu(0,e,n);t.push(Zr(r,1,i))}}function YV(t){const e=[0];return GV(e,t.length-1),e}function JV(t,e){return t.map(r=>r*e)}function XV(t,e){return t.map(()=>e||eE).splice(0,t.length-1)}function D0({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=kV(n)?n.map(rE):rE(n),s={done:!1,value:e[0]},o=JV(r&&r.length===e.length?r:YV(e),t),a=VV(o,e,{ease:Array.isArray(i)?i:XV(e,i)});return{calculatedDuration:t,next:u=>(s.value=a(u),s.done=u>=t,s)}}const aE=2e4;function ZV(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=aE?1/0:e}const QV=t=>{const e=({timestamp:r})=>t(r);return{start:()=>Nr.update(e,!0),stop:()=>va(e),now:()=>Wn.isProcessing?Wn.timestamp:eo.now()}},eG={decay:Q8,inertia:Q8,tween:D0,keyframes:D0,spring:Z8},tG=t=>t/100;class qv extends V8{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:u}=this.options;u&&u()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Pv,a=(u,l)=>this.onKeyframesResolved(u,l);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=Nv(r)?r:eG[r]||D0;let u,l;a!==D0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&Do(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),u=Oo(tG,oE(e[0],e[1])),e=[0,100]);const d=a({...this.options,keyframes:e});s==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=ZV(d));const{calculatedDuration:g}=d,y=g+i,A=y*(n+1)-i;return{generator:d,mirroredGenerator:l,mapPercentToKeyframes:u,calculatedDuration:g,resolvedDuration:y,totalDuration:A}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:z}=this.options;return{done:!0,value:z[z.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:u,calculatedDuration:l,totalDuration:d,resolvedDuration:g}=n;if(this.startTime===null)return s.next(0);const{delay:y,repeat:A,repeatType:P,repeatDelay:N,onUpdate:D}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const k=this.currentTime-y*(this.speed>=0?1:-1),$=this.speed>=0?k<0:k>d;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let q=this.currentTime,U=s;if(A){const z=Math.min(this.currentTime,d)/g;let ue=Math.floor(z),_e=z%1;!_e&&z>=1&&(_e=1),_e===1&&ue--,ue=Math.min(ue,A+1),!!(ue%2)&&(P==="reverse"?(_e=1-_e,N&&(_e-=N/g)):P==="mirror"&&(U=o)),q=ba(0,1,_e)*g}const K=$?{done:!1,value:u[0]}:U.next(q);a&&(K.value=a(K.value));let{done:J}=K;!$&&l!==null&&(J=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&J);return T&&i!==void 0&&(K.value=M0(u,this.options,i)),D&&D(K.value),T&&this.finish(),K}get duration(){const{resolved:e}=this;return e?Ro(e.calculatedDuration):0}get time(){return Ro(this.currentTime)}set time(e){e=Zs(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=Ro(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=QV,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const rG=new Set(["opacity","clipPath","filter","transform"]),nG=10,iG=(t,e)=>{let r="";const n=Math.max(Math.round(e/nG),2);for(let i=0;i(e===void 0&&(e=t()),e)}const sG={linearEasing:void 0};function oG(t,e){const r=zv(t);return()=>{var n;return(n=sG[e])!==null&&n!==void 0?n:r()}}const O0=oG(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function cE(t){return!!(typeof t=="function"&&O0()||!t||typeof t=="string"&&(t in Hv||O0())||$v(t)||Array.isArray(t)&&t.every(cE))}const Ql=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,Hv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ql([0,.65,.55,1]),circOut:Ql([.55,0,1,.45]),backIn:Ql([.31,.01,.66,-.59]),backOut:Ql([.33,1.53,.69,.99])};function uE(t,e){if(t)return typeof t=="function"&&O0()?iG(t,e):$v(t)?Ql(t):Array.isArray(t)?t.map(r=>uE(r,e)||Hv.easeOut):Hv[t]}function aG(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:u}={}){const l={[e]:r};u&&(l.offset=u);const d=uE(a,i);return Array.isArray(d)&&(l.easing=d),t.animate(l,{delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function fE(t,e){t.timeline=e,t.onfinish=null}const cG=zv(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),N0=10,uG=2e4;function fG(t){return Nv(t.type)||t.type==="spring"||!cE(t.ease)}function lG(t,e){const r=new qv({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&sthis.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:u,name:l,startTime:d}=this.options;if(!(!((n=u.owner)===null||n===void 0)&&n.current))return!1;if(typeof o=="string"&&O0()&&hG(o)&&(o=lE[o]),fG(this.options)){const{onComplete:y,onUpdate:A,motionValue:P,element:N,...D}=this.options,k=lG(e,D);e=k.keyframes,e.length===1&&(e[1]=e[0]),i=k.duration,s=k.times,o=k.ease,a="keyframes"}const g=aG(u.owner.current,l,e,{...this.options,duration:i,times:s,ease:o});return g.startTime=d??this.calcStartTime(),this.pendingTimeline?(fE(g,this.pendingTimeline),this.pendingTimeline=void 0):g.onfinish=()=>{const{onComplete:y}=this.options;u.set(M0(e,this.options,r)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:g,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return Ro(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return Ro(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=Zs(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return Hn;const{animation:n}=r;fE(n,e)}return Hn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:d,onComplete:g,element:y,...A}=this.options,P=new qv({...A,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),N=Zs(this.time);l.setWithVelocity(P.sample(N-N0).value,P.sample(N).value,N0)}const{onStop:u}=this.options;u&&u(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return cG()&&n&&rG.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}const dG=zv(()=>window.ScrollTimeline!==void 0);class pG{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;ndG()&&i.attachTimeline?i.attachTimeline(e):r(i));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function gG({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:u,elapsed:l,...d}){return!!Object.keys(d).length}const Wv=(t,e,r,n={},i,s)=>o=>{const a=yv(n,t)||{},u=a.delay||n.delay||0;let{elapsed:l=0}=n;l=l-Zs(u);let d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:y=>{e.set(y),a.onUpdate&&a.onUpdate(y)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:i};gG(a)||(d={...d,...NK(t,d)}),d.duration&&(d.duration=Zs(d.duration)),d.repeatDelay&&(d.repeatDelay=Zs(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let g=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(g=!0)),g&&!s&&e.get()!==void 0){const y=M0(d.keyframes,a);if(y!==void 0)return Nr.update(()=>{d.onUpdate(y),d.onComplete()}),new pG([])}return!s&&hE.supports(d)?new hE(d):new qv(d)},mG=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),vG=t=>gv(t)?t[t.length-1]||0:t;function Kv(t,e){t.indexOf(e)===-1&&t.push(e)}function Vv(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class Gv{constructor(){this.subscriptions=[]}add(e){return Kv(this.subscriptions,e),()=>Vv(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class yG{constructor(e,r={}){this.version="11.11.17",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=eo.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=eo.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=bG(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&S0(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new Gv);const n=this.events[e].add(r);return e==="change"?()=>{n(),Nr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=eo.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>dE)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,dE);return G8(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function eh(t,e){return new yG(t,e)}function wG(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,eh(r))}function xG(t,e){const r=P0(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=vG(s[o]);wG(t,o,a)}}const Yv=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),pE="data-"+Yv("framerAppearId");function gE(t){return t.props[pE]}const Qn=t=>!!(t&&t.getVelocity);function _G(t){return!!(Qn(t)&&t.add)}function Jv(t,e){const r=t.getValue("willChange");if(_G(r))return r.add(e)}function EG({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function mE(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...u}=e;n&&(o=n);const l=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const g in u){const y=t.getValue(g,(s=t.latestValues[g])!==null&&s!==void 0?s:null),A=u[g];if(A===void 0||d&&EG(d,g))continue;const P={delay:r,...yv(o||{},g)};let N=!1;if(window.MotionHandoffAnimation){const k=gE(t);if(k){const $=window.MotionHandoffAnimation(k,g,Nr);$!==null&&(P.startTime=$,N=!0)}}Jv(t,g),y.start(Wv(g,y,A,t.shouldReduceMotion&&vc.has(g)?{type:!1}:P,t,N));const D=y.animation;D&&l.push(D)}return a&&Promise.all(l).then(()=>{Nr.update(()=>{a&&xG(t,a)})}),l}function Xv(t,e,r={}){var n;const i=P0(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(mE(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:g,staggerDirection:y}=s;return SG(t,e,d+l,g,y,r)}:()=>Promise.resolve(),{when:u}=s;if(u){const[l,d]=u==="beforeChildren"?[o,a]:[a,o];return l().then(()=>d())}else return Promise.all([o(),a(r.delay)])}function SG(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,u=i===1?(l=0)=>l*n:(l=0)=>a-l*n;return Array.from(t.variantChildren).sort(AG).forEach((l,d)=>{l.notify("AnimationStart",e),o.push(Xv(l,e,{...s,delay:r+u(d)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function AG(t,e){return t.sortNodePosition(e)}function PG(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>Xv(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=Xv(t,e,r);else{const i=typeof e=="function"?P0(t,e,r.custom):e;n=Promise.all(mE(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const MG=bv.length;function vE(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?vE(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;rPromise.all(e.map(({animation:r,options:n})=>PG(t,r,n)))}function RG(t){let e=TG(t),r=bE(),n=!0;const i=u=>(l,d)=>{var g;const y=P0(t,d,u==="exit"?(g=t.presenceContext)===null||g===void 0?void 0:g.custom:void 0);if(y){const{transition:A,transitionEnd:P,...N}=y;l={...l,...N,...P}}return l};function s(u){e=u(t)}function o(u){const{props:l}=t,d=vE(t.parent)||{},g=[],y=new Set;let A={},P=1/0;for(let D=0;DP&&U,ue=!1;const _e=Array.isArray(q)?q:[q];let G=_e.reduce(i(k),{});K===!1&&(G={});const{prevResolvedValues:E={}}=$,m={...E,...G},f=x=>{z=!0,y.has(x)&&(ue=!0,y.delete(x)),$.needsAnimating[x]=!0;const _=t.getValue(x);_&&(_.liveStyle=!1)};for(const x in m){const _=G[x],S=E[x];if(A.hasOwnProperty(x))continue;let b=!1;gv(_)&&gv(S)?b=!h8(_,S):b=_!==S,b?_!=null?f(x):y.add(x):_!==void 0&&y.has(x)?f(x):$.protectedKeys[x]=!0}$.prevProp=q,$.prevResolvedValues=G,$.isActive&&(A={...A,...G}),n&&t.blockInitialAnimation&&(z=!1),z&&(!(J&&T)||ue)&&g.push(..._e.map(x=>({animation:x,options:{type:k}})))}if(y.size){const D={};y.forEach(k=>{const $=t.getBaseTarget(k),q=t.getValue(k);q&&(q.liveStyle=!0),D[k]=$??null}),g.push({animation:D})}let N=!!g.length;return n&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(N=!1),n=!1,N?e(g):Promise.resolve()}function a(u,l){var d;if(r[u].isActive===l)return Promise.resolve();(d=t.variantChildren)===null||d===void 0||d.forEach(y=>{var A;return(A=y.animationState)===null||A===void 0?void 0:A.setActive(u,l)}),r[u].isActive=l;const g=o(u);for(const y in r)r[y].protectedKeys={};return g}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=bE(),n=!0}}}function DG(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!h8(e,t):!1}function wc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function bE(){return{animate:wc(!0),whileInView:wc(),whileHover:wc(),whileTap:wc(),whileDrag:wc(),whileFocus:wc(),exit:wc()}}class xa{constructor(e){this.isMounted=!1,this.node=e}update(){}}class OG extends xa{constructor(e){super(e),e.animationState||(e.animationState=RG(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();A0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let NG=0;class LG extends xa{constructor(){super(...arguments),this.id=NG++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const kG={animation:{Feature:OG},exit:{Feature:LG}},yE=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function L0(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const $G=t=>e=>yE(e)&&t(e,L0(e));function No(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function Lo(t,e,r,n){return No(t,e,$G(r),n)}const wE=(t,e)=>Math.abs(t-e);function BG(t,e){const r=wE(t.x,e.x),n=wE(t.y,e.y);return Math.sqrt(r**2+n**2)}class xE{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=Qv(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,A=BG(g.offset,{x:0,y:0})>=3;if(!y&&!A)return;const{point:P}=g,{timestamp:N}=Wn;this.history.push({...P,timestamp:N});const{onStart:D,onMove:k}=this.handlers;y||(D&&D(this.lastMoveEvent,g),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,g)},this.handlePointerMove=(g,y)=>{this.lastMoveEvent=g,this.lastMoveEventInfo=Zv(y,this.transformPagePoint),Nr.update(this.updatePoint,!0)},this.handlePointerUp=(g,y)=>{this.end();const{onEnd:A,onSessionEnd:P,resumeAnimation:N}=this.handlers;if(this.dragSnapToOrigin&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=Qv(g.type==="pointercancel"?this.lastMoveEventInfo:Zv(y,this.transformPagePoint),this.history);this.startEvent&&A&&A(g,D),P&&P(g,D)},!yE(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=L0(e),a=Zv(o,this.transformPagePoint),{point:u}=a,{timestamp:l}=Wn;this.history=[{...u,timestamp:l}];const{onSessionStart:d}=r;d&&d(e,Qv(a,this.history)),this.removeListeners=Oo(Lo(this.contextWindow,"pointermove",this.handlePointerMove),Lo(this.contextWindow,"pointerup",this.handlePointerUp),Lo(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),va(this.updatePoint)}}function Zv(t,e){return e?{point:e(t.point)}:t}function _E(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Qv({point:t},e){return{point:t,delta:_E(t,EE(e)),offset:_E(t,FG(e)),velocity:UG(e,.1)}}function FG(t){return t[0]}function EE(t){return t[t.length-1]}function UG(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=EE(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>Zs(e)));)r--;if(!n)return{x:0,y:0};const s=Ro(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function SE(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const AE=SE("dragHorizontal"),PE=SE("dragVertical");function ME(t){let e=!1;if(t==="y")e=PE();else if(t==="x")e=AE();else{const r=AE(),n=PE();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function IE(){const t=ME(!0);return t?(t(),!1):!0}function Fu(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const CE=1e-4,jG=1-CE,qG=1+CE,TE=.01,zG=0-TE,HG=0+TE;function Ni(t){return t.max-t.min}function WG(t,e,r){return Math.abs(t-e)<=r}function RE(t,e,r,n=.5){t.origin=n,t.originPoint=Zr(e.min,e.max,t.origin),t.scale=Ni(r)/Ni(e),t.translate=Zr(r.min,r.max,t.origin)-t.originPoint,(t.scale>=jG&&t.scale<=qG||isNaN(t.scale))&&(t.scale=1),(t.translate>=zG&&t.translate<=HG||isNaN(t.translate))&&(t.translate=0)}function th(t,e,r,n){RE(t.x,e.x,r.x,n?n.originX:void 0),RE(t.y,e.y,r.y,n?n.originY:void 0)}function DE(t,e,r){t.min=r.min+e.min,t.max=t.min+Ni(e)}function KG(t,e,r){DE(t.x,e.x,r.x),DE(t.y,e.y,r.y)}function OE(t,e,r){t.min=e.min-r.min,t.max=t.min+Ni(e)}function rh(t,e,r){OE(t.x,e.x,r.x),OE(t.y,e.y,r.y)}function VG(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?Zr(r,t,n.max):Math.min(t,r)),t}function NE(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function GG(t,{top:e,left:r,bottom:n,right:i}){return{x:NE(t.x,r,i),y:NE(t.y,e,n)}}function LE(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=Bu(e.min,e.max-n,t.min):n>i&&(r=Bu(t.min,t.max-i,e.min)),ba(0,1,r)}function XG(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const eb=.35;function ZG(t=eb){return t===!1?t=0:t===!0&&(t=eb),{x:kE(t,"left","right"),y:kE(t,"top","bottom")}}function kE(t,e,r){return{min:$E(t,e),max:$E(t,r)}}function $E(t,e){return typeof t=="number"?t:t[e]||0}const BE=()=>({translate:0,scale:1,origin:0,originPoint:0}),Uu=()=>({x:BE(),y:BE()}),FE=()=>({min:0,max:0}),ln=()=>({x:FE(),y:FE()});function ts(t){return[t("x"),t("y")]}function UE({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function QG({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function eY(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function tb(t){return t===void 0||t===1}function rb({scale:t,scaleX:e,scaleY:r}){return!tb(t)||!tb(e)||!tb(r)}function xc(t){return rb(t)||jE(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function jE(t){return qE(t.x)||qE(t.y)}function qE(t){return t&&t!=="0%"}function k0(t,e,r){const n=t-r,i=e*n;return r+i}function zE(t,e,r,n,i){return i!==void 0&&(t=k0(t,i,n)),k0(t,r,n)+e}function nb(t,e=0,r=1,n,i){t.min=zE(t.min,e,r,n,i),t.max=zE(t.max,e,r,n,i)}function HE(t,{x:e,y:r}){nb(t.x,e.translate,e.scale,e.originPoint),nb(t.y,r.translate,r.scale,r.originPoint)}const WE=.999999999999,KE=1.0000000000001;function tY(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;aWE&&(e.x=1),e.yWE&&(e.y=1)}function ju(t,e){t.min=t.min+e,t.max=t.max+e}function VE(t,e,r,n,i=.5){const s=Zr(t.min,t.max,i);nb(t,e,r,s,n)}function qu(t,e){VE(t.x,e.x,e.scaleX,e.scale,e.originX),VE(t.y,e.y,e.scaleY,e.scale,e.originY)}function GE(t,e){return UE(eY(t.getBoundingClientRect(),e))}function rY(t,e,r){const n=GE(t,r),{scroll:i}=e;return i&&(ju(n.x,i.offset.x),ju(n.y,i.offset.y)),n}const YE=({current:t})=>t?t.ownerDocument.defaultView:null,nY=new WeakMap;class iY{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ln(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:g}=this.getProps();g?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(L0(d,"page").point)},s=(d,g)=>{const{drag:y,dragPropagation:A,onDragStart:P}=this.getProps();if(y&&!A&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=ME(y),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ts(D=>{let k=this.getAxisMotionValue(D).get()||0;if(Qs.test(k)){const{projection:$}=this.visualElement;if($&&$.layout){const q=$.layout.layoutBox[D];q&&(k=Ni(q)*(parseFloat(k)/100))}}this.originPoint[D]=k}),P&&Nr.postRender(()=>P(d,g)),Jv(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},o=(d,g)=>{const{dragPropagation:y,dragDirectionLock:A,onDirectionLock:P,onDrag:N}=this.getProps();if(!y&&!this.openGlobalLock)return;const{offset:D}=g;if(A&&this.currentDirection===null){this.currentDirection=sY(D),this.currentDirection!==null&&P&&P(this.currentDirection);return}this.updateAxis("x",g.point,D),this.updateAxis("y",g.point,D),this.visualElement.render(),N&&N(d,g)},a=(d,g)=>this.stop(d,g),u=()=>ts(d=>{var g;return this.getAnimationState(d)==="paused"&&((g=this.getAxisMotionValue(d).animation)===null||g===void 0?void 0:g.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new xE(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:YE(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Nr.postRender(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!$0(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=VG(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&Fu(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=GG(i.layoutBox,r):this.constraints=!1,this.elastic=ZG(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&ts(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=XG(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!Fu(e))return!1;const n=e.current;Do(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=rY(n,i.root,this.visualElement.getTransformPagePoint());let o=YG(i.layout.layoutBox,s);if(r){const a=r(QG(o));this.hasMutatedConstraints=!!a,a&&(o=UE(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),u=this.constraints||{},l=ts(d=>{if(!$0(d,r,this.currentDirection))return;let g=u&&u[d]||{};o&&(g={min:0,max:0});const y=i?200:1e6,A=i?40:1e7,P={type:"inertia",velocity:n?e[d]:0,bounceStiffness:y,bounceDamping:A,timeConstant:750,restDelta:1,restSpeed:10,...s,...g};return this.startAxisValueAnimation(d,P)});return Promise.all(l).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return Jv(this.visualElement,e),n.start(Wv(e,n,0,r,this.visualElement,!1))}stopAnimation(){ts(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){ts(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){ts(r=>{const{drag:n}=this.getProps();if(!$0(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-Zr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!Fu(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};ts(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const u=a.get();i[o]=JG({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),ts(o=>{if(!$0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:u,max:l}=this.constraints[o];a.set(Zr(u,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;nY.set(this.visualElement,this);const e=this.visualElement.current,r=Lo(e,"pointerdown",u=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();Fu(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Nr.read(n);const o=No(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(ts(d=>{const g=this.getAxisMotionValue(d);g&&(this.originPoint[d]+=u[d].translate,g.set(g.get()+u[d].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=eb,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function $0(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function sY(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class oY extends xa{constructor(e){super(e),this.removeGroupControls=Hn,this.removeListeners=Hn,this.controls=new iY(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Hn}unmount(){this.removeGroupControls(),this.removeListeners()}}const JE=t=>(e,r)=>{t&&Nr.postRender(()=>t(e,r))};class aY extends xa{constructor(){super(...arguments),this.removePointerDownListener=Hn}onPointerDown(e){this.session=new xE(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:YE(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:JE(e),onStart:JE(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&Nr.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=Lo(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const B0=Pe.createContext(null);function cY(){const t=Pe.useContext(B0);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=Pe.useId();Pe.useEffect(()=>n(i),[]);const s=Pe.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const ib=Pe.createContext({}),XE=Pe.createContext({}),F0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function ZE(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const nh={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(zt.test(t))t=parseFloat(t);else return t;const r=ZE(t,e.target.x),n=ZE(t,e.target.y);return`${r}% ${n}%`}},uY={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=wa.parse(t);if(i.length>5)return n;const s=wa.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,u=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=u;const l=Zr(a,u,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),s(i)}},U0={};function fY(t){Object.assign(U0,t)}const{schedule:sb}=p8(queueMicrotask,!1);class lY extends Pe.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;fY(hY),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),F0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Nr.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),sb.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function QE(t){const[e,r]=cY(),n=Pe.useContext(ib);return me.jsx(lY,{...t,layoutGroup:n,switchLayoutGroup:Pe.useContext(XE),isPresent:e,safeToRemove:r})}const hY={borderRadius:{...nh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:nh,borderTopRightRadius:nh,borderBottomLeftRadius:nh,borderBottomRightRadius:nh,boxShadow:uY},eS=["TopLeft","TopRight","BottomLeft","BottomRight"],dY=eS.length,tS=t=>typeof t=="string"?parseFloat(t):t,rS=t=>typeof t=="number"||zt.test(t);function pY(t,e,r,n,i,s){i?(t.opacity=Zr(0,r.opacity!==void 0?r.opacity:1,gY(n)),t.opacityExit=Zr(e.opacity!==void 0?e.opacity:1,0,mY(n))):s&&(t.opacity=Zr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(Bu(t,e,n))}function sS(t,e){t.min=e.min,t.max=e.max}function rs(t,e){sS(t.x,e.x),sS(t.y,e.y)}function oS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function aS(t,e,r,n,i){return t-=e,t=k0(t,1/r,n),i!==void 0&&(t=k0(t,1/i,n)),t}function vY(t,e=0,r=1,n=.5,i,s=t,o=t){if(Qs.test(e)&&(e=parseFloat(e),e=Zr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Zr(s.min,s.max,n);t===s&&(a-=e),t.min=aS(t.min,e,r,a,i),t.max=aS(t.max,e,r,a,i)}function cS(t,e,[r,n,i],s,o){vY(t,e[r],e[n],e[i],e.scale,s,o)}const bY=["x","scaleX","originX"],yY=["y","scaleY","originY"];function uS(t,e,r,n){cS(t.x,e,bY,r?r.x:void 0,n?n.x:void 0),cS(t.y,e,yY,r?r.y:void 0,n?n.y:void 0)}function fS(t){return t.translate===0&&t.scale===1}function lS(t){return fS(t.x)&&fS(t.y)}function hS(t,e){return t.min===e.min&&t.max===e.max}function wY(t,e){return hS(t.x,e.x)&&hS(t.y,e.y)}function dS(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function pS(t,e){return dS(t.x,e.x)&&dS(t.y,e.y)}function gS(t){return Ni(t.x)/Ni(t.y)}function mS(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class xY{constructor(){this.members=[]}add(e){Kv(this.members,e),e.scheduleRender()}remove(e){if(Vv(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function _Y(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:l,rotate:d,rotateX:g,rotateY:y,skewX:A,skewY:P}=r;l&&(n=`perspective(${l}px) ${n}`),d&&(n+=`rotate(${d}deg) `),g&&(n+=`rotateX(${g}deg) `),y&&(n+=`rotateY(${y}deg) `),A&&(n+=`skewX(${A}deg) `),P&&(n+=`skewY(${P}deg) `)}const a=t.x.scale*e.x,u=t.y.scale*e.y;return(a!==1||u!==1)&&(n+=`scale(${a}, ${u})`),n||"none"}const EY=(t,e)=>t.depth-e.depth;class SY{constructor(){this.children=[],this.isDirty=!1}add(e){Kv(this.children,e),this.isDirty=!0}remove(e){Vv(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(EY),this.isDirty=!1,this.children.forEach(e)}}function j0(t){const e=Qn(t)?t.get():t;return mG(e)?e.toValue():e}function AY(t,e){const r=eo.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(va(n),t(s-e))};return Nr.read(n,!0),()=>va(n)}function PY(t){return t instanceof SVGElement&&t.tagName!=="svg"}function MY(t,e,r){const n=Qn(t)?t:eh(t);return n.start(Wv("",n,e,r)),n.animation}const _c={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},ih=typeof window<"u"&&window.MotionDebug!==void 0,ob=["","X","Y","Z"],IY={visibility:"hidden"},vS=1e3;let CY=0;function ab(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function bS(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=gE(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Nr,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&bS(n)}function yS({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=CY++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,ih&&(_c.totalNodes=_c.resolvedTargetDeltas=_c.recalculatedProjection=0),this.nodes.forEach(DY),this.nodes.forEach($Y),this.nodes.forEach(BY),this.nodes.forEach(OY),ih&&window.MotionDebug.record(_c)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let u=0;uthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,g&&g(),g=AY(y,250),F0.hasAnimatedSinceResize&&(F0.hasAnimatedSinceResize=!1,this.nodes.forEach(xS))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&d&&(u||l)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:y,hasRelativeTargetChanged:A,layout:P})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const N=this.options.transition||d.getDefaultTransition()||zY,{onLayoutAnimationStart:D,onLayoutAnimationComplete:k}=d.getProps(),$=!this.targetLayout||!pS(this.targetLayout,P)||A,q=!y&&A;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||q||y&&($||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(g,q);const U={...yv(N,"layout"),onPlay:D,onComplete:k};(d.shouldReduceMotion||this.options.layoutRoot)&&(U.delay=0,U.type=!1),this.startAnimation(U)}else y||xS(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=P})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,va(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(FY),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&bS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u{const K=U/1e3;_S(g.x,o.x,K),_S(g.y,o.y,K),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(rh(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),jY(this.relativeTarget,this.relativeTargetOrigin,y,K),q&&wY(this.relativeTarget,q)&&(this.isProjectionDirty=!1),q||(q=ln()),rs(q,this.relativeTarget)),N&&(this.animationValues=d,pY(d,l,this.latestValues,K,$,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=K},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(va(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nr.update(()=>{F0.hasAnimatedSinceResize=!0,this.currentAnimation=MY(0,vS,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(vS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:u,layout:l,latestValues:d}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&MS(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||ln();const g=Ni(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+g;const y=Ni(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+y}rs(a,u),qu(a,d),th(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new xY),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(a=!0),!a)return;const l={};u.z&&ab("z",o,l,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(wS),this.root.sharedNodes.clear()}}}function TY(t){t.updateLayout()}function RY(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?ts(g=>{const y=o?r.measuredBox[g]:r.layoutBox[g],A=Ni(y);y.min=n[g].min,y.max=y.min+A}):MS(s,r.layoutBox,n)&&ts(g=>{const y=o?r.measuredBox[g]:r.layoutBox[g],A=Ni(n[g]);y.max=y.min+A,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[g].max=t.relativeTarget[g].min+A)});const a=Uu();th(a,n,r.layoutBox);const u=Uu();o?th(u,t.applyTransform(i,!0),r.measuredBox):th(u,n,r.layoutBox);const l=!lS(a);let d=!1;if(!t.resumeFrom){const g=t.getClosestProjectingParent();if(g&&!g.resumeFrom){const{snapshot:y,layout:A}=g;if(y&&A){const P=ln();rh(P,r.layoutBox,y.layoutBox);const N=ln();rh(N,n,A.layoutBox),pS(P,N)||(d=!0),g.options.layoutRoot&&(t.relativeTarget=N,t.relativeTargetOrigin=P,t.relativeParent=g)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:u,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function DY(t){ih&&_c.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function OY(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function NY(t){t.clearSnapshot()}function wS(t){t.clearMeasurements()}function LY(t){t.isLayoutDirty=!1}function kY(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function xS(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function $Y(t){t.resolveTargetDelta()}function BY(t){t.calcProjection()}function FY(t){t.resetSkewAndRotation()}function UY(t){t.removeLeadSnapshot()}function _S(t,e,r){t.translate=Zr(e.translate,0,r),t.scale=Zr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function ES(t,e,r,n){t.min=Zr(e.min,r.min,n),t.max=Zr(e.max,r.max,n)}function jY(t,e,r,n){ES(t.x,e.x,r.x,n),ES(t.y,e.y,r.y,n)}function qY(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const zY={duration:.45,ease:[.4,0,.1,1]},SS=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),AS=SS("applewebkit/")&&!SS("chrome/")?Math.round:Hn;function PS(t){t.min=AS(t.min),t.max=AS(t.max)}function HY(t){PS(t.x),PS(t.y)}function MS(t,e,r){return t==="position"||t==="preserve-aspect"&&!WG(gS(e),gS(r),.2)}function WY(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const KY=yS({attachResizeListener:(t,e)=>No(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),cb={current:void 0},IS=yS({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!cb.current){const t=new KY({});t.mount(window),t.setOptions({layoutScroll:!0}),cb.current=t}return cb.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),VY={pan:{Feature:aY},drag:{Feature:oY,ProjectionNode:IS,MeasureLayout:QE}};function CS(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||IE())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const u=a[n];u&&Nr.postRender(()=>u(s,o))};return Lo(t.current,r,i,{passive:!t.getProps()[n]})}class GY extends xa{mount(){this.unmount=Oo(CS(this.node,!0),CS(this.node,!1))}unmount(){}}class YY extends xa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Oo(No(this.node.current,"focus",()=>this.onFocus()),No(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const TS=(t,e)=>e?t===e?!0:TS(t,e.parentElement):!1;function ub(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,L0(r))}class JY extends xa{constructor(){super(...arguments),this.removeStartListeners=Hn,this.removeEndListeners=Hn,this.removeAccessibleListeners=Hn,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=Lo(window,"pointerup",(a,u)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:d,globalTapTarget:g}=this.node.getProps(),y=!g&&!TS(this.node.current,a.target)?d:l;y&&Nr.update(()=>y(a,u))},{passive:!(n.onTap||n.onPointerUp)}),o=Lo(window,"pointercancel",(a,u)=>this.cancelPress(a,u),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=Oo(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||ub("up",(u,l)=>{const{onTap:d}=this.node.getProps();d&&Nr.postRender(()=>d(u,l))})};this.removeEndListeners(),this.removeEndListeners=No(this.node.current,"keyup",o),ub("down",(a,u)=>{this.startPress(a,u)})},r=No(this.node.current,"keydown",e),n=()=>{this.isPressing&&ub("cancel",(s,o)=>this.cancelPress(s,o))},i=No(this.node.current,"blur",n);this.removeAccessibleListeners=Oo(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Nr.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!IE()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Nr.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=Lo(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=No(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Oo(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const fb=new WeakMap,lb=new WeakMap,XY=t=>{const e=fb.get(t.target);e&&e(t)},ZY=t=>{t.forEach(XY)};function QY({root:t,...e}){const r=t||document;lb.has(r)||lb.set(r,{});const n=lb.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(ZY,{root:t,...e})),n[i]}function eJ(t,e,r){const n=QY(e);return fb.set(t,r),n.observe(t),()=>{fb.delete(t),n.unobserve(t)}}const tJ={some:0,all:1};class rJ extends xa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:tJ[i]},a=u=>{const{isIntersecting:l}=u;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:g}=this.node.getProps(),y=l?d:g;y&&y(u)};return eJ(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(nJ(e,r))&&this.startObserver()}unmount(){}}function nJ({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const iJ={inView:{Feature:rJ},tap:{Feature:JY},focus:{Feature:YY},hover:{Feature:GY}},sJ={layout:{ProjectionNode:IS,MeasureLayout:QE}},hb=Pe.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),q0=Pe.createContext({}),db=typeof window<"u",RS=db?Pe.useLayoutEffect:Pe.useEffect,DS=Pe.createContext({strict:!1});function oJ(t,e,r,n,i){var s,o;const{visualElement:a}=Pe.useContext(q0),u=Pe.useContext(DS),l=Pe.useContext(B0),d=Pe.useContext(hb).reducedMotion,g=Pe.useRef();n=n||u.renderer,!g.current&&n&&(g.current=n(t,{visualState:e,parent:a,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d}));const y=g.current,A=Pe.useContext(XE);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&aJ(g.current,r,i,A);const P=Pe.useRef(!1);Pe.useInsertionEffect(()=>{y&&P.current&&y.update(r,l)});const N=r[pE],D=Pe.useRef(!!N&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,N))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,N)));return RS(()=>{y&&(P.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),sb.render(y.render),D.current&&y.animationState&&y.animationState.animateChanges())}),Pe.useEffect(()=>{y&&(!D.current&&y.animationState&&y.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{var k;(k=window.MotionHandoffMarkAsComplete)===null||k===void 0||k.call(window,N)}),D.current=!1))}),y}function aJ(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:u,layoutRoot:l}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:OS(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&Fu(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:u,layoutRoot:l})}function OS(t){if(t)return t.options.allowProjection!==!1?t.projection:OS(t.parent)}function cJ(t,e,r){return Pe.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):Fu(r)&&(r.current=n))},[e])}function z0(t){return A0(t.animate)||bv.some(e=>Kl(t[e]))}function NS(t){return!!(z0(t)||t.variants)}function uJ(t,e){if(z0(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Kl(r)?r:void 0,animate:Kl(n)?n:void 0}}return t.inherit!==!1?e:{}}function fJ(t){const{initial:e,animate:r}=uJ(t,Pe.useContext(q0));return Pe.useMemo(()=>({initial:e,animate:r}),[LS(e),LS(r)])}function LS(t){return Array.isArray(t)?t.join(" "):t}const kS={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},zu={};for(const t in kS)zu[t]={isEnabled:e=>kS[t].some(r=>!!e[r])};function lJ(t){for(const e in t)zu[e]={...zu[e],...t[e]}}const hJ=Symbol.for("motionComponentSymbol");function dJ({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&lJ(t);function s(a,u){let l;const d={...Pe.useContext(hb),...a,layoutId:pJ(a)},{isStatic:g}=d,y=fJ(a),A=n(a,g);if(!g&&db){gJ(d,t);const P=mJ(d);l=P.MeasureLayout,y.visualElement=oJ(i,A,d,e,P.ProjectionNode)}return me.jsxs(q0.Provider,{value:y,children:[l&&y.visualElement?me.jsx(l,{visualElement:y.visualElement,...d}):null,r(i,a,cJ(A,y.visualElement,u),A,g,y.visualElement)]})}const o=Pe.forwardRef(s);return o[hJ]=i,o}function pJ({layoutId:t}){const e=Pe.useContext(ib).id;return e&&t!==void 0?e+"-"+t:t}function gJ(t,e){const r=Pe.useContext(DS).strict;if(process.env.NODE_ENV!=="production"&&e&&r){const n="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?Nu(!1,n):Do(!1,n)}}function mJ(t){const{drag:e,layout:r}=zu;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const vJ=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function pb(t){return typeof t!="string"||t.includes("-")?!1:!!(vJ.indexOf(t)>-1||/[A-Z]/u.test(t))}function $S(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const BS=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function FS(t,e,r,n){$S(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(BS.has(i)?i:Yv(i),e.attrs[i])}function US(t,{layout:e,layoutId:r}){return vc.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!U0[t]||t==="opacity")}function gb(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(Qn(i[o])||e.style&&Qn(e.style[o])||US(o,t)||((n=r==null?void 0:r.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function jS(t,e,r){const n=gb(t,e,r);for(const i in t)if(Qn(t[i])||Qn(e[i])){const s=Vl.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function mb(t){const e=Pe.useRef(null);return e.current===null&&(e.current=t()),e.current}function bJ({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:yJ(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const qS=t=>(e,r)=>{const n=Pe.useContext(q0),i=Pe.useContext(B0),s=()=>bJ(t,e,n,i);return r?s():mb(s)};function yJ(t,e,r,n){const i={},s=n(t,{});for(const y in s)i[y]=j0(s[y]);let{initial:o,animate:a}=t;const u=z0(t),l=NS(t);e&&l&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const g=d?a:o;if(g&&typeof g!="boolean"&&!A0(g)){const y=Array.isArray(g)?g:[g];for(let A=0;A({style:{},transform:{},transformOrigin:{},vars:{}}),zS=()=>({...vb(),attrs:{}}),HS=(t,e)=>e&&typeof t=="number"?e.transform(t):t,wJ={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},xJ=Vl.length;function _J(t,e,r){let n="",i=!0;for(let s=0;stypeof t=="string"&&t.toLowerCase()==="svg",MJ={useVisualState:qS({scrapeMotionValuesFromProps:jS,createRenderState:zS,onMount:(t,e,{renderState:r,latestValues:n})=>{Nr.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),Nr.render(()=>{yb(r,n,wb(e.tagName),t.transformTemplate),FS(e,r)})}})},IJ={useVisualState:qS({scrapeMotionValuesFromProps:gb,createRenderState:vb})};function KS(t,e,r){for(const n in e)!Qn(e[n])&&!US(n,r)&&(t[n]=e[n])}function CJ({transformTemplate:t},e){return Pe.useMemo(()=>{const r=vb();return bb(r,e,t),Object.assign({},r.vars,r.style)},[e])}function TJ(t,e){const r=t.style||{},n={};return KS(n,r,t),Object.assign(n,CJ(t,e)),n}function RJ(t,e){const r={},n=TJ(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const DJ=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function H0(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||DJ.has(t)}let VS=t=>!H0(t);function OJ(t){t&&(VS=e=>e.startsWith("on")?!H0(e):t(e))}try{OJ(require("@emotion/is-prop-valid").default)}catch{}function NJ(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(VS(i)||r===!0&&H0(i)||!e&&!H0(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function LJ(t,e,r,n){const i=Pe.useMemo(()=>{const s=zS();return yb(s,e,wb(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};KS(s,t.style,t),i.style={...s,...i.style}}return i}function kJ(t=!1){return(r,n,i,{latestValues:s},o)=>{const u=(pb(r)?LJ:RJ)(n,s,o,r),l=NJ(n,typeof r=="string",t),d=r!==Pe.Fragment?{...l,...u,ref:i}:{},{children:g}=n,y=Pe.useMemo(()=>Qn(g)?g.get():g,[g]);return Pe.createElement(r,{...d,children:y})}}function $J(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...pb(n)?MJ:IJ,preloadedFeatures:t,useRender:kJ(i),createVisualElement:e,Component:n};return dJ(o)}}const xb={current:null},GS={current:!1};function BJ(){if(GS.current=!0,!!db)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>xb.current=t.matches;t.addListener(e),e()}else xb.current=!1}function FJ(t,e,r){for(const n in e){const i=e[n],s=r[n];if(Qn(i))t.addValue(n,i),process.env.NODE_ENV==="development"&&S0(i.version==="11.11.17",`Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`);else if(Qn(s))t.addValue(n,eh(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,eh(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const YS=new WeakMap,UJ=[...O8,Zn,wa],jJ=t=>UJ.find(D8(t)),JS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class qJ{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Pv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=eo.now();this.renderScheduledAtthis.bindToMotionValue(n,r)),GS.current||BJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:xb.current,process.env.NODE_ENV!=="production"&&S0(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){YS.delete(this.current),this.projection&&this.projection.unmount(),va(this.notifyUpdate),va(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=vc.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Nr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in zu){const r=zu[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ln()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=eh(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(S8(i)||E8(i))?i=parseFloat(i):!jJ(i)&&wa.test(r)&&(i=H8(e,r)),this.setBaseTarget(e,Qn(i)?i.get():i)),Qn(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=mv(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Qn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new Gv),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class XS extends qJ{constructor(){super(...arguments),this.KeyframeResolver=W8}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function zJ(t){return window.getComputedStyle(t)}class HJ extends XS{constructor(){super(...arguments),this.type="html",this.renderInstance=$S}readValueFromInstance(e,r){if(vc.has(r)){const n=Ov(r);return n&&n.default||0}else{const n=zJ(e),i=(P8(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return GE(e,r)}build(e,r,n){bb(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return gb(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Qn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class WJ extends XS{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ln}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(vc.has(r)){const n=Ov(r);return n&&n.default||0}return r=BS.has(r)?r:Yv(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return jS(e,r,n)}build(e,r,n){yb(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){FS(e,r,n,i)}mount(e){this.isSVGTag=wb(e.tagName),super.mount(e)}}const KJ=(t,e)=>pb(t)?new WJ(e):new HJ(e,{allowProjection:t!==Pe.Fragment}),VJ=$J({...kG,...iJ,...VY,...sJ},KJ),GJ=CK(VJ);class YJ extends Yt.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function JJ({children:t,isPresent:e}){const r=Pe.useId(),n=Pe.useRef(null),i=Pe.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=Pe.useContext(hb);return Pe.useInsertionEffect(()=>{const{width:o,height:a,top:u,left:l}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` + */const f8=Es("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),l8=new Set;function S0(t,e,r){t||l8.has(e)||(console.warn(e),l8.add(e))}function CK(t){if(typeof Proxy>"u")return t;const e=new Map,r=(...n)=>(process.env.NODE_ENV!=="production"&&S0(!1,"motion() is deprecated. Use motion.create() instead."),t(...n));return new Proxy(r,{get:(n,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}function A0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const mv=t=>Array.isArray(t);function h8(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function vv(t,e,r,n){if(typeof e=="function"){const[i,s]=d8(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=d8(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function P0(t,e,r){const n=t.getProps();return vv(n,e,r!==void 0?r:n.custom,t)}const bv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],yv=["initial",...bv],Vl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],vc=new Set(Vl),Zs=t=>t*1e3,Ro=t=>t/1e3,TK={type:"spring",stiffness:500,damping:25,restSpeed:10},RK=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),DK={type:"keyframes",duration:.8},OK={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},NK=(t,{keyframes:e})=>e.length>2?DK:vc.has(t)?t.startsWith("scale")?RK(e[1]):TK:OK;function wv(t,e){return t?t[e]||t.default||t:void 0}const LK={useManualTiming:!1},kK=t=>t!==null;function M0(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(kK),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const Hn=t=>t;function $K(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){s.has(l)&&(u.schedule(l),t()),l(o)}const u={schedule:(l,d=!1,g=!1)=>{const A=g&&n?e:r;return d&&s.add(l),A.has(l)||A.add(l),l},cancel:l=>{r.delete(l),s.delete(l)},process:l=>{if(o=l,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,u.process(l))}};return u}const I0=["read","resolveKeyframes","update","preRender","render","postRender"],BK=40;function p8(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=I0.reduce((k,$)=>(k[$]=$K(s),k),{}),{read:a,resolveKeyframes:u,update:l,preRender:d,render:g,postRender:y}=o,A=()=>{const k=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(k-i.timestamp,BK),1),i.timestamp=k,i.isProcessing=!0,a.process(i),u.process(i),l.process(i),d.process(i),g.process(i),y.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(A))},P=()=>{r=!0,n=!0,i.isProcessing||t(A)};return{schedule:I0.reduce((k,$)=>{const q=o[$];return k[$]=(U,K=!1,J=!1)=>(r||P(),q.schedule(U,K,J)),k},{}),cancel:k=>{for(let $=0;$(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,FK=1e-7,UK=12;function jK(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=g8(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>FK&&++ajK(s,0,1,t,r);return s=>s===0||s===1?s:g8(i(s),e,n)}const m8=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,v8=t=>e=>1-t(1-e),b8=Gl(.33,1.53,.69,.99),_v=v8(b8),y8=m8(_v),w8=t=>(t*=2)<1?.5*_v(t):.5*(2-Math.pow(2,-10*(t-1))),Ev=t=>1-Math.sin(Math.acos(t)),x8=v8(Ev),_8=m8(Ev),E8=t=>/^0[^.\s]+$/u.test(t);function qK(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||E8(t):!0}let Nu=Hn,Do=Hn;process.env.NODE_ENV!=="production"&&(Nu=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},Do=(t,e)=>{if(!t)throw new Error(e)});const S8=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),A8=t=>e=>typeof e=="string"&&e.startsWith(t),P8=A8("--"),zK=A8("var(--"),Sv=t=>zK(t)?HK.test(t.split("/*")[0].trim()):!1,HK=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,WK=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function KK(t){const e=WK.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}const VK=4;function M8(t,e,r=1){Do(r<=VK,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[n,i]=KK(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return S8(o)?parseFloat(o):o}return Sv(i)?M8(i,e,r+1):i}const ba=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},Yl={...Lu,transform:t=>ba(0,1,t)},C0={...Lu,default:1},Jl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),ya=Jl("deg"),Qs=Jl("%"),zt=Jl("px"),GK=Jl("vh"),YK=Jl("vw"),I8={...Qs,parse:t=>Qs.parse(t)/100,transform:t=>Qs.transform(t*100)},JK=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),C8=t=>t===Lu||t===zt,T8=(t,e)=>parseFloat(t.split(", ")[e]),R8=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return T8(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?T8(s[1],t):0}},XK=new Set(["x","y","z"]),ZK=Vl.filter(t=>!XK.has(t));function QK(t){const e=[];return ZK.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const ku={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:R8(4,13),y:R8(5,14)};ku.translateX=ku.x,ku.translateY=ku.y;const D8=t=>e=>e.test(t),O8=[Lu,zt,Qs,ya,YK,GK,{test:t=>t==="auto",parse:t=>t}],N8=t=>O8.find(D8(t)),bc=new Set;let Av=!1,Pv=!1;function L8(){if(Pv){const t=Array.from(bc).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=QK(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}Pv=!1,Av=!1,bc.forEach(t=>t.complete()),bc.clear()}function k8(){bc.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Pv=!0)})}function eV(){k8(),L8()}class Mv{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(bc.add(this),Av||(Av=!0,Nr.read(k8),Nr.resolveKeyframes(L8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sMath.round(t*1e5)/1e5,Iv=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function tV(t){return t==null}const rV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Cv=(t,e)=>r=>!!(typeof r=="string"&&rV.test(r)&&r.startsWith(t)||e&&!tV(r)&&Object.prototype.hasOwnProperty.call(r,e)),$8=(t,e,r)=>n=>{if(typeof n!="string")return n;const[i,s,o,a]=n.match(Iv);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},nV=t=>ba(0,255,t),Tv={...Lu,transform:t=>Math.round(nV(t))},yc={test:Cv("rgb","red"),parse:$8("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+Tv.transform(t)+", "+Tv.transform(e)+", "+Tv.transform(r)+", "+Xl(Yl.transform(n))+")"};function iV(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const Rv={test:Cv("#"),parse:iV,transform:yc.transform},$u={test:Cv("hsl","hue"),parse:$8("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+Qs.transform(Xl(e))+", "+Qs.transform(Xl(r))+", "+Xl(Yl.transform(n))+")"},Zn={test:t=>yc.test(t)||Rv.test(t)||$u.test(t),parse:t=>yc.test(t)?yc.parse(t):$u.test(t)?$u.parse(t):Rv.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?yc.transform(t):$u.transform(t)},sV=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function oV(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Iv))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(sV))===null||r===void 0?void 0:r.length)||0)>0}const B8="number",F8="color",aV="var",cV="var(",U8="${}",uV=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Zl(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(uV,u=>(Zn.test(u)?(n.color.push(s),i.push(F8),r.push(Zn.parse(u))):u.startsWith(cV)?(n.var.push(s),i.push(aV),r.push(u)):(n.number.push(s),i.push(B8),r.push(parseFloat(u))),++s,U8)).split(U8);return{values:r,split:a,indexes:n,types:i}}function j8(t){return Zl(t).values}function q8(t){const{split:e,types:r}=Zl(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function lV(t){const e=j8(t);return q8(t)(e.map(fV))}const wa={test:oV,parse:j8,createTransformer:q8,getAnimatableNone:lV},hV=new Set(["brightness","contrast","saturate","opacity"]);function dV(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(Iv)||[];if(!n)return t;const i=r.replace(n,"");let s=hV.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const pV=/\b([a-z-]*)\(.*?\)/gu,Dv={...wa,getAnimatableNone:t=>{const e=t.match(pV);return e?e.map(dV).join(" "):t}},gV={borderWidth:zt,borderTopWidth:zt,borderRightWidth:zt,borderBottomWidth:zt,borderLeftWidth:zt,borderRadius:zt,radius:zt,borderTopLeftRadius:zt,borderTopRightRadius:zt,borderBottomRightRadius:zt,borderBottomLeftRadius:zt,width:zt,maxWidth:zt,height:zt,maxHeight:zt,top:zt,right:zt,bottom:zt,left:zt,padding:zt,paddingTop:zt,paddingRight:zt,paddingBottom:zt,paddingLeft:zt,margin:zt,marginTop:zt,marginRight:zt,marginBottom:zt,marginLeft:zt,backgroundPositionX:zt,backgroundPositionY:zt},mV={rotate:ya,rotateX:ya,rotateY:ya,rotateZ:ya,scale:C0,scaleX:C0,scaleY:C0,scaleZ:C0,skew:ya,skewX:ya,skewY:ya,distance:zt,translateX:zt,translateY:zt,translateZ:zt,x:zt,y:zt,z:zt,perspective:zt,transformPerspective:zt,opacity:Yl,originX:I8,originY:I8,originZ:zt},z8={...Lu,transform:Math.round},Ov={...gV,...mV,zIndex:z8,size:zt,fillOpacity:Yl,strokeOpacity:Yl,numOctaves:z8},vV={...Ov,color:Zn,backgroundColor:Zn,outlineColor:Zn,fill:Zn,stroke:Zn,borderColor:Zn,borderTopColor:Zn,borderRightColor:Zn,borderBottomColor:Zn,borderLeftColor:Zn,filter:Dv,WebkitFilter:Dv},Nv=t=>vV[t];function H8(t,e){let r=Nv(t);return r!==Dv&&(r=wa),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const bV=new Set(["auto","none","0"]);function yV(t,e,r){let n=0,i;for(;n{r.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function Lv(t){return typeof t=="function"}let T0;function wV(){T0=void 0}const eo={now:()=>(T0===void 0&&eo.set(Wn.isProcessing||LK.useManualTiming?Wn.timestamp:performance.now()),T0),set:t=>{T0=t,queueMicrotask(wV)}},K8=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(wa.test(t)||t==="0")&&!t.startsWith("url("));function xV(t){const e=t[0];if(t.length===1)return!0;for(let r=0;rEV?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&eV(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=eo.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:u,isGenerator:l}=this.options;if(!l&&!_V(e,n,i,s))if(o)this.options.duration=0;else{u==null||u(M0(e,this.options,r)),a==null||a(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,r);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...d},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function G8(t,e){return e?t*(1e3/e):0}const SV=5;function Y8(t,e,r){const n=Math.max(e-SV,0);return G8(r-t(n),e-n)}const kv=.001,AV=.01,J8=10,PV=.05,MV=1;function IV({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;Nu(t<=Zs(J8),"Spring duration must be 10 seconds or less");let o=1-e;o=ba(PV,MV,o),t=ba(AV,J8,Ro(t)),o<1?(i=l=>{const d=l*o,g=d*t,y=d-r,A=$v(l,o),P=Math.exp(-g);return kv-y/A*P},s=l=>{const g=l*o*t,y=g*r+r,A=Math.pow(o,2)*Math.pow(l,2)*t,P=Math.exp(-g),N=$v(Math.pow(l,2),o);return(-i(l)+kv>0?-1:1)*((y-A)*P)/N}):(i=l=>{const d=Math.exp(-l*t),g=(l-r)*t+1;return-kv+d*g},s=l=>{const d=Math.exp(-l*t),g=(r-l)*(t*t);return d*g});const a=5/t,u=TV(i,s,a);if(t=Zs(t),isNaN(u))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(u,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:t}}}const CV=12;function TV(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function OV(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!X8(t,DV)&&X8(t,RV)){const r=IV(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function Z8({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:u,mass:l,duration:d,velocity:g,isResolvedFromDuration:y}=OV({...n,velocity:-Ro(n.velocity||0)}),A=g||0,P=u/(2*Math.sqrt(a*l)),N=s-i,D=Ro(Math.sqrt(a/l)),k=Math.abs(N)<5;r||(r=k?.01:2),e||(e=k?.005:.5);let $;if(P<1){const q=$v(D,P);$=U=>{const K=Math.exp(-P*D*U);return s-K*((A+P*D*N)/q*Math.sin(q*U)+N*Math.cos(q*U))}}else if(P===1)$=q=>s-Math.exp(-D*q)*(N+(A+D*N)*q);else{const q=D*Math.sqrt(P*P-1);$=U=>{const K=Math.exp(-P*D*U),J=Math.min(q*U,300);return s-K*((A+P*D*N)*Math.sinh(J)+q*N*Math.cosh(J))/q}}return{calculatedDuration:y&&d||null,next:q=>{const U=$(q);if(y)o.done=q>=d;else{let K=0;P<1&&(K=q===0?Zs(A):Y8($,q,U));const J=Math.abs(K)<=r,T=Math.abs(s-U)<=e;o.done=J&&T}return o.value=o.done?s:U,o}}}function Q8({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:d}){const g=t[0],y={done:!1,value:g},A=z=>a!==void 0&&zu,P=z=>a===void 0?u:u===void 0||Math.abs(a-z)-N*Math.exp(-z/n),q=z=>k+$(z),U=z=>{const ue=$(z),_e=q(z);y.done=Math.abs(ue)<=l,y.value=y.done?k:_e};let K,J;const T=z=>{A(y.value)&&(K=z,J=Z8({keyframes:[y.value,P(y.value)],velocity:Y8(q,z,y.value),damping:i,stiffness:s,restDelta:l,restSpeed:d}))};return T(0),{calculatedDuration:null,next:z=>{let ue=!1;return!J&&K===void 0&&(ue=!0,U(z),T(z)),K!==void 0&&z>=K?J.next(z-K):(!ue&&U(z),y)}}}const NV=Gl(.42,0,1,1),LV=Gl(0,0,.58,1),eE=Gl(.42,0,.58,1),kV=t=>Array.isArray(t)&&typeof t[0]!="number",Bv=t=>Array.isArray(t)&&typeof t[0]=="number",tE={linear:Hn,easeIn:NV,easeInOut:eE,easeOut:LV,circIn:Ev,circInOut:_8,circOut:x8,backIn:_v,backInOut:y8,backOut:b8,anticipate:w8},rE=t=>{if(Bv(t)){Do(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,r,n,i]=t;return Gl(e,r,n,i)}else if(typeof t=="string")return Do(tE[t]!==void 0,`Invalid easing type '${t}'`),tE[t];return t},$V=(t,e)=>r=>e(t(r)),Oo=(...t)=>t.reduce($V),Bu=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},Zr=(t,e,r)=>t+(e-t)*r;function Fv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function BV({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,u=2*r-a;i=Fv(u,a,t+1/3),s=Fv(u,a,t),o=Fv(u,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function R0(t,e){return r=>r>0?e:t}const Uv=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},FV=[Rv,yc,$u],UV=t=>FV.find(e=>e.test(t));function nE(t){const e=UV(t);if(Nu(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let r=e.parse(t);return e===$u&&(r=BV(r)),r}const iE=(t,e)=>{const r=nE(t),n=nE(e);if(!r||!n)return R0(t,e);const i={...r};return s=>(i.red=Uv(r.red,n.red,s),i.green=Uv(r.green,n.green,s),i.blue=Uv(r.blue,n.blue,s),i.alpha=Zr(r.alpha,n.alpha,s),yc.transform(i))},jv=new Set(["none","hidden"]);function jV(t,e){return jv.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function qV(t,e){return r=>Zr(t,e,r)}function qv(t){return typeof t=="number"?qV:typeof t=="string"?Sv(t)?R0:Zn.test(t)?iE:WV:Array.isArray(t)?sE:typeof t=="object"?Zn.test(t)?iE:zV:R0}function sE(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>qv(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function HV(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=wa.createTransformer(e),n=Zl(t),i=Zl(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?jv.has(t)&&!i.values.length||jv.has(e)&&!n.values.length?jV(t,e):Oo(sE(HV(n,i),i.values),r):(Nu(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),R0(t,e))};function oE(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Zr(t,e,r):qv(t)(t,e)}function KV(t,e,r){const n=[],i=r||oE,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=KV(e,n,i),a=o.length,u=l=>{let d=0;if(a>1)for(;du(ba(t[0],t[s-1],l)):u}function GV(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=Bu(0,e,n);t.push(Zr(r,1,i))}}function YV(t){const e=[0];return GV(e,t.length-1),e}function JV(t,e){return t.map(r=>r*e)}function XV(t,e){return t.map(()=>e||eE).splice(0,t.length-1)}function D0({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=kV(n)?n.map(rE):rE(n),s={done:!1,value:e[0]},o=JV(r&&r.length===e.length?r:YV(e),t),a=VV(o,e,{ease:Array.isArray(i)?i:XV(e,i)});return{calculatedDuration:t,next:u=>(s.value=a(u),s.done=u>=t,s)}}const aE=2e4;function ZV(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=aE?1/0:e}const QV=t=>{const e=({timestamp:r})=>t(r);return{start:()=>Nr.update(e,!0),stop:()=>va(e),now:()=>Wn.isProcessing?Wn.timestamp:eo.now()}},eG={decay:Q8,inertia:Q8,tween:D0,keyframes:D0,spring:Z8},tG=t=>t/100;class zv extends V8{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:u}=this.options;u&&u()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Mv,a=(u,l)=>this.onKeyframesResolved(u,l);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=Lv(r)?r:eG[r]||D0;let u,l;a!==D0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&Do(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),u=Oo(tG,oE(e[0],e[1])),e=[0,100]);const d=a({...this.options,keyframes:e});s==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=ZV(d));const{calculatedDuration:g}=d,y=g+i,A=y*(n+1)-i;return{generator:d,mirroredGenerator:l,mapPercentToKeyframes:u,calculatedDuration:g,resolvedDuration:y,totalDuration:A}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:z}=this.options;return{done:!0,value:z[z.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:u,calculatedDuration:l,totalDuration:d,resolvedDuration:g}=n;if(this.startTime===null)return s.next(0);const{delay:y,repeat:A,repeatType:P,repeatDelay:N,onUpdate:D}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const k=this.currentTime-y*(this.speed>=0?1:-1),$=this.speed>=0?k<0:k>d;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let q=this.currentTime,U=s;if(A){const z=Math.min(this.currentTime,d)/g;let ue=Math.floor(z),_e=z%1;!_e&&z>=1&&(_e=1),_e===1&&ue--,ue=Math.min(ue,A+1),!!(ue%2)&&(P==="reverse"?(_e=1-_e,N&&(_e-=N/g)):P==="mirror"&&(U=o)),q=ba(0,1,_e)*g}const K=$?{done:!1,value:u[0]}:U.next(q);a&&(K.value=a(K.value));let{done:J}=K;!$&&l!==null&&(J=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&J);return T&&i!==void 0&&(K.value=M0(u,this.options,i)),D&&D(K.value),T&&this.finish(),K}get duration(){const{resolved:e}=this;return e?Ro(e.calculatedDuration):0}get time(){return Ro(this.currentTime)}set time(e){e=Zs(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=Ro(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=QV,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const rG=new Set(["opacity","clipPath","filter","transform"]),nG=10,iG=(t,e)=>{let r="";const n=Math.max(Math.round(e/nG),2);for(let i=0;i(e===void 0&&(e=t()),e)}const sG={linearEasing:void 0};function oG(t,e){const r=Hv(t);return()=>{var n;return(n=sG[e])!==null&&n!==void 0?n:r()}}const O0=oG(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function cE(t){return!!(typeof t=="function"&&O0()||!t||typeof t=="string"&&(t in Wv||O0())||Bv(t)||Array.isArray(t)&&t.every(cE))}const Ql=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,Wv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ql([0,.65,.55,1]),circOut:Ql([.55,0,1,.45]),backIn:Ql([.31,.01,.66,-.59]),backOut:Ql([.33,1.53,.69,.99])};function uE(t,e){if(t)return typeof t=="function"&&O0()?iG(t,e):Bv(t)?Ql(t):Array.isArray(t)?t.map(r=>uE(r,e)||Wv.easeOut):Wv[t]}function aG(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:u}={}){const l={[e]:r};u&&(l.offset=u);const d=uE(a,i);return Array.isArray(d)&&(l.easing=d),t.animate(l,{delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function fE(t,e){t.timeline=e,t.onfinish=null}const cG=Hv(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),N0=10,uG=2e4;function fG(t){return Lv(t.type)||t.type==="spring"||!cE(t.ease)}function lG(t,e){const r=new zv({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&sthis.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:u,name:l,startTime:d}=this.options;if(!(!((n=u.owner)===null||n===void 0)&&n.current))return!1;if(typeof o=="string"&&O0()&&hG(o)&&(o=lE[o]),fG(this.options)){const{onComplete:y,onUpdate:A,motionValue:P,element:N,...D}=this.options,k=lG(e,D);e=k.keyframes,e.length===1&&(e[1]=e[0]),i=k.duration,s=k.times,o=k.ease,a="keyframes"}const g=aG(u.owner.current,l,e,{...this.options,duration:i,times:s,ease:o});return g.startTime=d??this.calcStartTime(),this.pendingTimeline?(fE(g,this.pendingTimeline),this.pendingTimeline=void 0):g.onfinish=()=>{const{onComplete:y}=this.options;u.set(M0(e,this.options,r)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:g,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return Ro(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return Ro(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=Zs(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return Hn;const{animation:n}=r;fE(n,e)}return Hn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:d,onComplete:g,element:y,...A}=this.options,P=new zv({...A,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),N=Zs(this.time);l.setWithVelocity(P.sample(N-N0).value,P.sample(N).value,N0)}const{onStop:u}=this.options;u&&u(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return cG()&&n&&rG.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}const dG=Hv(()=>window.ScrollTimeline!==void 0);class pG{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;ndG()&&i.attachTimeline?i.attachTimeline(e):r(i));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function gG({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:u,elapsed:l,...d}){return!!Object.keys(d).length}const Kv=(t,e,r,n={},i,s)=>o=>{const a=wv(n,t)||{},u=a.delay||n.delay||0;let{elapsed:l=0}=n;l=l-Zs(u);let d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:y=>{e.set(y),a.onUpdate&&a.onUpdate(y)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:i};gG(a)||(d={...d,...NK(t,d)}),d.duration&&(d.duration=Zs(d.duration)),d.repeatDelay&&(d.repeatDelay=Zs(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let g=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(g=!0)),g&&!s&&e.get()!==void 0){const y=M0(d.keyframes,a);if(y!==void 0)return Nr.update(()=>{d.onUpdate(y),d.onComplete()}),new pG([])}return!s&&hE.supports(d)?new hE(d):new zv(d)},mG=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),vG=t=>mv(t)?t[t.length-1]||0:t;function Vv(t,e){t.indexOf(e)===-1&&t.push(e)}function Gv(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class Yv{constructor(){this.subscriptions=[]}add(e){return Vv(this.subscriptions,e),()=>Gv(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class yG{constructor(e,r={}){this.version="11.11.17",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=eo.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=eo.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=bG(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&S0(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new Yv);const n=this.events[e].add(r);return e==="change"?()=>{n(),Nr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=eo.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>dE)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,dE);return G8(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function eh(t,e){return new yG(t,e)}function wG(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,eh(r))}function xG(t,e){const r=P0(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=vG(s[o]);wG(t,o,a)}}const Jv=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),pE="data-"+Jv("framerAppearId");function gE(t){return t.props[pE]}const Qn=t=>!!(t&&t.getVelocity);function _G(t){return!!(Qn(t)&&t.add)}function Xv(t,e){const r=t.getValue("willChange");if(_G(r))return r.add(e)}function EG({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function mE(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...u}=e;n&&(o=n);const l=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const g in u){const y=t.getValue(g,(s=t.latestValues[g])!==null&&s!==void 0?s:null),A=u[g];if(A===void 0||d&&EG(d,g))continue;const P={delay:r,...wv(o||{},g)};let N=!1;if(window.MotionHandoffAnimation){const k=gE(t);if(k){const $=window.MotionHandoffAnimation(k,g,Nr);$!==null&&(P.startTime=$,N=!0)}}Xv(t,g),y.start(Kv(g,y,A,t.shouldReduceMotion&&vc.has(g)?{type:!1}:P,t,N));const D=y.animation;D&&l.push(D)}return a&&Promise.all(l).then(()=>{Nr.update(()=>{a&&xG(t,a)})}),l}function Zv(t,e,r={}){var n;const i=P0(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(mE(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:g,staggerDirection:y}=s;return SG(t,e,d+l,g,y,r)}:()=>Promise.resolve(),{when:u}=s;if(u){const[l,d]=u==="beforeChildren"?[o,a]:[a,o];return l().then(()=>d())}else return Promise.all([o(),a(r.delay)])}function SG(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,u=i===1?(l=0)=>l*n:(l=0)=>a-l*n;return Array.from(t.variantChildren).sort(AG).forEach((l,d)=>{l.notify("AnimationStart",e),o.push(Zv(l,e,{...s,delay:r+u(d)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function AG(t,e){return t.sortNodePosition(e)}function PG(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>Zv(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=Zv(t,e,r);else{const i=typeof e=="function"?P0(t,e,r.custom):e;n=Promise.all(mE(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const MG=yv.length;function vE(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?vE(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;rPromise.all(e.map(({animation:r,options:n})=>PG(t,r,n)))}function RG(t){let e=TG(t),r=bE(),n=!0;const i=u=>(l,d)=>{var g;const y=P0(t,d,u==="exit"?(g=t.presenceContext)===null||g===void 0?void 0:g.custom:void 0);if(y){const{transition:A,transitionEnd:P,...N}=y;l={...l,...N,...P}}return l};function s(u){e=u(t)}function o(u){const{props:l}=t,d=vE(t.parent)||{},g=[],y=new Set;let A={},P=1/0;for(let D=0;DP&&U,ue=!1;const _e=Array.isArray(q)?q:[q];let G=_e.reduce(i(k),{});K===!1&&(G={});const{prevResolvedValues:E={}}=$,m={...E,...G},f=x=>{z=!0,y.has(x)&&(ue=!0,y.delete(x)),$.needsAnimating[x]=!0;const _=t.getValue(x);_&&(_.liveStyle=!1)};for(const x in m){const _=G[x],S=E[x];if(A.hasOwnProperty(x))continue;let b=!1;mv(_)&&mv(S)?b=!h8(_,S):b=_!==S,b?_!=null?f(x):y.add(x):_!==void 0&&y.has(x)?f(x):$.protectedKeys[x]=!0}$.prevProp=q,$.prevResolvedValues=G,$.isActive&&(A={...A,...G}),n&&t.blockInitialAnimation&&(z=!1),z&&(!(J&&T)||ue)&&g.push(..._e.map(x=>({animation:x,options:{type:k}})))}if(y.size){const D={};y.forEach(k=>{const $=t.getBaseTarget(k),q=t.getValue(k);q&&(q.liveStyle=!0),D[k]=$??null}),g.push({animation:D})}let N=!!g.length;return n&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(N=!1),n=!1,N?e(g):Promise.resolve()}function a(u,l){var d;if(r[u].isActive===l)return Promise.resolve();(d=t.variantChildren)===null||d===void 0||d.forEach(y=>{var A;return(A=y.animationState)===null||A===void 0?void 0:A.setActive(u,l)}),r[u].isActive=l;const g=o(u);for(const y in r)r[y].protectedKeys={};return g}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=bE(),n=!0}}}function DG(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!h8(e,t):!1}function wc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function bE(){return{animate:wc(!0),whileInView:wc(),whileHover:wc(),whileTap:wc(),whileDrag:wc(),whileFocus:wc(),exit:wc()}}class xa{constructor(e){this.isMounted=!1,this.node=e}update(){}}class OG extends xa{constructor(e){super(e),e.animationState||(e.animationState=RG(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();A0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let NG=0;class LG extends xa{constructor(){super(...arguments),this.id=NG++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const kG={animation:{Feature:OG},exit:{Feature:LG}},yE=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function L0(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const $G=t=>e=>yE(e)&&t(e,L0(e));function No(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function Lo(t,e,r,n){return No(t,e,$G(r),n)}const wE=(t,e)=>Math.abs(t-e);function BG(t,e){const r=wE(t.x,e.x),n=wE(t.y,e.y);return Math.sqrt(r**2+n**2)}class xE{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=eb(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,A=BG(g.offset,{x:0,y:0})>=3;if(!y&&!A)return;const{point:P}=g,{timestamp:N}=Wn;this.history.push({...P,timestamp:N});const{onStart:D,onMove:k}=this.handlers;y||(D&&D(this.lastMoveEvent,g),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,g)},this.handlePointerMove=(g,y)=>{this.lastMoveEvent=g,this.lastMoveEventInfo=Qv(y,this.transformPagePoint),Nr.update(this.updatePoint,!0)},this.handlePointerUp=(g,y)=>{this.end();const{onEnd:A,onSessionEnd:P,resumeAnimation:N}=this.handlers;if(this.dragSnapToOrigin&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=eb(g.type==="pointercancel"?this.lastMoveEventInfo:Qv(y,this.transformPagePoint),this.history);this.startEvent&&A&&A(g,D),P&&P(g,D)},!yE(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=L0(e),a=Qv(o,this.transformPagePoint),{point:u}=a,{timestamp:l}=Wn;this.history=[{...u,timestamp:l}];const{onSessionStart:d}=r;d&&d(e,eb(a,this.history)),this.removeListeners=Oo(Lo(this.contextWindow,"pointermove",this.handlePointerMove),Lo(this.contextWindow,"pointerup",this.handlePointerUp),Lo(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),va(this.updatePoint)}}function Qv(t,e){return e?{point:e(t.point)}:t}function _E(t,e){return{x:t.x-e.x,y:t.y-e.y}}function eb({point:t},e){return{point:t,delta:_E(t,EE(e)),offset:_E(t,FG(e)),velocity:UG(e,.1)}}function FG(t){return t[0]}function EE(t){return t[t.length-1]}function UG(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=EE(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>Zs(e)));)r--;if(!n)return{x:0,y:0};const s=Ro(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function SE(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const AE=SE("dragHorizontal"),PE=SE("dragVertical");function ME(t){let e=!1;if(t==="y")e=PE();else if(t==="x")e=AE();else{const r=AE(),n=PE();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function IE(){const t=ME(!0);return t?(t(),!1):!0}function Fu(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const CE=1e-4,jG=1-CE,qG=1+CE,TE=.01,zG=0-TE,HG=0+TE;function Ni(t){return t.max-t.min}function WG(t,e,r){return Math.abs(t-e)<=r}function RE(t,e,r,n=.5){t.origin=n,t.originPoint=Zr(e.min,e.max,t.origin),t.scale=Ni(r)/Ni(e),t.translate=Zr(r.min,r.max,t.origin)-t.originPoint,(t.scale>=jG&&t.scale<=qG||isNaN(t.scale))&&(t.scale=1),(t.translate>=zG&&t.translate<=HG||isNaN(t.translate))&&(t.translate=0)}function th(t,e,r,n){RE(t.x,e.x,r.x,n?n.originX:void 0),RE(t.y,e.y,r.y,n?n.originY:void 0)}function DE(t,e,r){t.min=r.min+e.min,t.max=t.min+Ni(e)}function KG(t,e,r){DE(t.x,e.x,r.x),DE(t.y,e.y,r.y)}function OE(t,e,r){t.min=e.min-r.min,t.max=t.min+Ni(e)}function rh(t,e,r){OE(t.x,e.x,r.x),OE(t.y,e.y,r.y)}function VG(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?Zr(r,t,n.max):Math.min(t,r)),t}function NE(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function GG(t,{top:e,left:r,bottom:n,right:i}){return{x:NE(t.x,r,i),y:NE(t.y,e,n)}}function LE(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=Bu(e.min,e.max-n,t.min):n>i&&(r=Bu(t.min,t.max-i,e.min)),ba(0,1,r)}function XG(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const tb=.35;function ZG(t=tb){return t===!1?t=0:t===!0&&(t=tb),{x:kE(t,"left","right"),y:kE(t,"top","bottom")}}function kE(t,e,r){return{min:$E(t,e),max:$E(t,r)}}function $E(t,e){return typeof t=="number"?t:t[e]||0}const BE=()=>({translate:0,scale:1,origin:0,originPoint:0}),Uu=()=>({x:BE(),y:BE()}),FE=()=>({min:0,max:0}),ln=()=>({x:FE(),y:FE()});function ts(t){return[t("x"),t("y")]}function UE({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function QG({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function eY(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function rb(t){return t===void 0||t===1}function nb({scale:t,scaleX:e,scaleY:r}){return!rb(t)||!rb(e)||!rb(r)}function xc(t){return nb(t)||jE(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function jE(t){return qE(t.x)||qE(t.y)}function qE(t){return t&&t!=="0%"}function k0(t,e,r){const n=t-r,i=e*n;return r+i}function zE(t,e,r,n,i){return i!==void 0&&(t=k0(t,i,n)),k0(t,r,n)+e}function ib(t,e=0,r=1,n,i){t.min=zE(t.min,e,r,n,i),t.max=zE(t.max,e,r,n,i)}function HE(t,{x:e,y:r}){ib(t.x,e.translate,e.scale,e.originPoint),ib(t.y,r.translate,r.scale,r.originPoint)}const WE=.999999999999,KE=1.0000000000001;function tY(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;aWE&&(e.x=1),e.yWE&&(e.y=1)}function ju(t,e){t.min=t.min+e,t.max=t.max+e}function VE(t,e,r,n,i=.5){const s=Zr(t.min,t.max,i);ib(t,e,r,s,n)}function qu(t,e){VE(t.x,e.x,e.scaleX,e.scale,e.originX),VE(t.y,e.y,e.scaleY,e.scale,e.originY)}function GE(t,e){return UE(eY(t.getBoundingClientRect(),e))}function rY(t,e,r){const n=GE(t,r),{scroll:i}=e;return i&&(ju(n.x,i.offset.x),ju(n.y,i.offset.y)),n}const YE=({current:t})=>t?t.ownerDocument.defaultView:null,nY=new WeakMap;class iY{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ln(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:g}=this.getProps();g?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(L0(d,"page").point)},s=(d,g)=>{const{drag:y,dragPropagation:A,onDragStart:P}=this.getProps();if(y&&!A&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=ME(y),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ts(D=>{let k=this.getAxisMotionValue(D).get()||0;if(Qs.test(k)){const{projection:$}=this.visualElement;if($&&$.layout){const q=$.layout.layoutBox[D];q&&(k=Ni(q)*(parseFloat(k)/100))}}this.originPoint[D]=k}),P&&Nr.postRender(()=>P(d,g)),Xv(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},o=(d,g)=>{const{dragPropagation:y,dragDirectionLock:A,onDirectionLock:P,onDrag:N}=this.getProps();if(!y&&!this.openGlobalLock)return;const{offset:D}=g;if(A&&this.currentDirection===null){this.currentDirection=sY(D),this.currentDirection!==null&&P&&P(this.currentDirection);return}this.updateAxis("x",g.point,D),this.updateAxis("y",g.point,D),this.visualElement.render(),N&&N(d,g)},a=(d,g)=>this.stop(d,g),u=()=>ts(d=>{var g;return this.getAnimationState(d)==="paused"&&((g=this.getAxisMotionValue(d).animation)===null||g===void 0?void 0:g.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new xE(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:YE(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Nr.postRender(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!$0(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=VG(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&Fu(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=GG(i.layoutBox,r):this.constraints=!1,this.elastic=ZG(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&ts(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=XG(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!Fu(e))return!1;const n=e.current;Do(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=rY(n,i.root,this.visualElement.getTransformPagePoint());let o=YG(i.layout.layoutBox,s);if(r){const a=r(QG(o));this.hasMutatedConstraints=!!a,a&&(o=UE(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),u=this.constraints||{},l=ts(d=>{if(!$0(d,r,this.currentDirection))return;let g=u&&u[d]||{};o&&(g={min:0,max:0});const y=i?200:1e6,A=i?40:1e7,P={type:"inertia",velocity:n?e[d]:0,bounceStiffness:y,bounceDamping:A,timeConstant:750,restDelta:1,restSpeed:10,...s,...g};return this.startAxisValueAnimation(d,P)});return Promise.all(l).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return Xv(this.visualElement,e),n.start(Kv(e,n,0,r,this.visualElement,!1))}stopAnimation(){ts(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){ts(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){ts(r=>{const{drag:n}=this.getProps();if(!$0(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-Zr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!Fu(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};ts(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const u=a.get();i[o]=JG({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),ts(o=>{if(!$0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:u,max:l}=this.constraints[o];a.set(Zr(u,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;nY.set(this.visualElement,this);const e=this.visualElement.current,r=Lo(e,"pointerdown",u=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();Fu(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Nr.read(n);const o=No(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(ts(d=>{const g=this.getAxisMotionValue(d);g&&(this.originPoint[d]+=u[d].translate,g.set(g.get()+u[d].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=tb,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function $0(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function sY(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class oY extends xa{constructor(e){super(e),this.removeGroupControls=Hn,this.removeListeners=Hn,this.controls=new iY(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Hn}unmount(){this.removeGroupControls(),this.removeListeners()}}const JE=t=>(e,r)=>{t&&Nr.postRender(()=>t(e,r))};class aY extends xa{constructor(){super(...arguments),this.removePointerDownListener=Hn}onPointerDown(e){this.session=new xE(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:YE(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:JE(e),onStart:JE(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&Nr.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=Lo(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const B0=Pe.createContext(null);function cY(){const t=Pe.useContext(B0);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=Pe.useId();Pe.useEffect(()=>n(i),[]);const s=Pe.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const sb=Pe.createContext({}),XE=Pe.createContext({}),F0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function ZE(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const nh={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(zt.test(t))t=parseFloat(t);else return t;const r=ZE(t,e.target.x),n=ZE(t,e.target.y);return`${r}% ${n}%`}},uY={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=wa.parse(t);if(i.length>5)return n;const s=wa.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,u=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=u;const l=Zr(a,u,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),s(i)}},U0={};function fY(t){Object.assign(U0,t)}const{schedule:ob}=p8(queueMicrotask,!1);class lY extends Pe.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;fY(hY),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),F0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Nr.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ob.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function QE(t){const[e,r]=cY(),n=Pe.useContext(sb);return me.jsx(lY,{...t,layoutGroup:n,switchLayoutGroup:Pe.useContext(XE),isPresent:e,safeToRemove:r})}const hY={borderRadius:{...nh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:nh,borderTopRightRadius:nh,borderBottomLeftRadius:nh,borderBottomRightRadius:nh,boxShadow:uY},eS=["TopLeft","TopRight","BottomLeft","BottomRight"],dY=eS.length,tS=t=>typeof t=="string"?parseFloat(t):t,rS=t=>typeof t=="number"||zt.test(t);function pY(t,e,r,n,i,s){i?(t.opacity=Zr(0,r.opacity!==void 0?r.opacity:1,gY(n)),t.opacityExit=Zr(e.opacity!==void 0?e.opacity:1,0,mY(n))):s&&(t.opacity=Zr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(Bu(t,e,n))}function sS(t,e){t.min=e.min,t.max=e.max}function rs(t,e){sS(t.x,e.x),sS(t.y,e.y)}function oS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function aS(t,e,r,n,i){return t-=e,t=k0(t,1/r,n),i!==void 0&&(t=k0(t,1/i,n)),t}function vY(t,e=0,r=1,n=.5,i,s=t,o=t){if(Qs.test(e)&&(e=parseFloat(e),e=Zr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Zr(s.min,s.max,n);t===s&&(a-=e),t.min=aS(t.min,e,r,a,i),t.max=aS(t.max,e,r,a,i)}function cS(t,e,[r,n,i],s,o){vY(t,e[r],e[n],e[i],e.scale,s,o)}const bY=["x","scaleX","originX"],yY=["y","scaleY","originY"];function uS(t,e,r,n){cS(t.x,e,bY,r?r.x:void 0,n?n.x:void 0),cS(t.y,e,yY,r?r.y:void 0,n?n.y:void 0)}function fS(t){return t.translate===0&&t.scale===1}function lS(t){return fS(t.x)&&fS(t.y)}function hS(t,e){return t.min===e.min&&t.max===e.max}function wY(t,e){return hS(t.x,e.x)&&hS(t.y,e.y)}function dS(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function pS(t,e){return dS(t.x,e.x)&&dS(t.y,e.y)}function gS(t){return Ni(t.x)/Ni(t.y)}function mS(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class xY{constructor(){this.members=[]}add(e){Vv(this.members,e),e.scheduleRender()}remove(e){if(Gv(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function _Y(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:l,rotate:d,rotateX:g,rotateY:y,skewX:A,skewY:P}=r;l&&(n=`perspective(${l}px) ${n}`),d&&(n+=`rotate(${d}deg) `),g&&(n+=`rotateX(${g}deg) `),y&&(n+=`rotateY(${y}deg) `),A&&(n+=`skewX(${A}deg) `),P&&(n+=`skewY(${P}deg) `)}const a=t.x.scale*e.x,u=t.y.scale*e.y;return(a!==1||u!==1)&&(n+=`scale(${a}, ${u})`),n||"none"}const EY=(t,e)=>t.depth-e.depth;class SY{constructor(){this.children=[],this.isDirty=!1}add(e){Vv(this.children,e),this.isDirty=!0}remove(e){Gv(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(EY),this.isDirty=!1,this.children.forEach(e)}}function j0(t){const e=Qn(t)?t.get():t;return mG(e)?e.toValue():e}function AY(t,e){const r=eo.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(va(n),t(s-e))};return Nr.read(n,!0),()=>va(n)}function PY(t){return t instanceof SVGElement&&t.tagName!=="svg"}function MY(t,e,r){const n=Qn(t)?t:eh(t);return n.start(Kv("",n,e,r)),n.animation}const _c={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},ih=typeof window<"u"&&window.MotionDebug!==void 0,ab=["","X","Y","Z"],IY={visibility:"hidden"},vS=1e3;let CY=0;function cb(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function bS(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=gE(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Nr,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&bS(n)}function yS({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=CY++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,ih&&(_c.totalNodes=_c.resolvedTargetDeltas=_c.recalculatedProjection=0),this.nodes.forEach(DY),this.nodes.forEach($Y),this.nodes.forEach(BY),this.nodes.forEach(OY),ih&&window.MotionDebug.record(_c)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let u=0;uthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,g&&g(),g=AY(y,250),F0.hasAnimatedSinceResize&&(F0.hasAnimatedSinceResize=!1,this.nodes.forEach(xS))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&d&&(u||l)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:y,hasRelativeTargetChanged:A,layout:P})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const N=this.options.transition||d.getDefaultTransition()||zY,{onLayoutAnimationStart:D,onLayoutAnimationComplete:k}=d.getProps(),$=!this.targetLayout||!pS(this.targetLayout,P)||A,q=!y&&A;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||q||y&&($||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(g,q);const U={...wv(N,"layout"),onPlay:D,onComplete:k};(d.shouldReduceMotion||this.options.layoutRoot)&&(U.delay=0,U.type=!1),this.startAnimation(U)}else y||xS(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=P})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,va(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(FY),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&bS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u{const K=U/1e3;_S(g.x,o.x,K),_S(g.y,o.y,K),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(rh(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),jY(this.relativeTarget,this.relativeTargetOrigin,y,K),q&&wY(this.relativeTarget,q)&&(this.isProjectionDirty=!1),q||(q=ln()),rs(q,this.relativeTarget)),N&&(this.animationValues=d,pY(d,l,this.latestValues,K,$,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=K},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(va(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nr.update(()=>{F0.hasAnimatedSinceResize=!0,this.currentAnimation=MY(0,vS,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(vS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:u,layout:l,latestValues:d}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&MS(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||ln();const g=Ni(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+g;const y=Ni(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+y}rs(a,u),qu(a,d),th(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new xY),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(a=!0),!a)return;const l={};u.z&&cb("z",o,l,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(wS),this.root.sharedNodes.clear()}}}function TY(t){t.updateLayout()}function RY(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?ts(g=>{const y=o?r.measuredBox[g]:r.layoutBox[g],A=Ni(y);y.min=n[g].min,y.max=y.min+A}):MS(s,r.layoutBox,n)&&ts(g=>{const y=o?r.measuredBox[g]:r.layoutBox[g],A=Ni(n[g]);y.max=y.min+A,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[g].max=t.relativeTarget[g].min+A)});const a=Uu();th(a,n,r.layoutBox);const u=Uu();o?th(u,t.applyTransform(i,!0),r.measuredBox):th(u,n,r.layoutBox);const l=!lS(a);let d=!1;if(!t.resumeFrom){const g=t.getClosestProjectingParent();if(g&&!g.resumeFrom){const{snapshot:y,layout:A}=g;if(y&&A){const P=ln();rh(P,r.layoutBox,y.layoutBox);const N=ln();rh(N,n,A.layoutBox),pS(P,N)||(d=!0),g.options.layoutRoot&&(t.relativeTarget=N,t.relativeTargetOrigin=P,t.relativeParent=g)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:u,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function DY(t){ih&&_c.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function OY(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function NY(t){t.clearSnapshot()}function wS(t){t.clearMeasurements()}function LY(t){t.isLayoutDirty=!1}function kY(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function xS(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function $Y(t){t.resolveTargetDelta()}function BY(t){t.calcProjection()}function FY(t){t.resetSkewAndRotation()}function UY(t){t.removeLeadSnapshot()}function _S(t,e,r){t.translate=Zr(e.translate,0,r),t.scale=Zr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function ES(t,e,r,n){t.min=Zr(e.min,r.min,n),t.max=Zr(e.max,r.max,n)}function jY(t,e,r,n){ES(t.x,e.x,r.x,n),ES(t.y,e.y,r.y,n)}function qY(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const zY={duration:.45,ease:[.4,0,.1,1]},SS=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),AS=SS("applewebkit/")&&!SS("chrome/")?Math.round:Hn;function PS(t){t.min=AS(t.min),t.max=AS(t.max)}function HY(t){PS(t.x),PS(t.y)}function MS(t,e,r){return t==="position"||t==="preserve-aspect"&&!WG(gS(e),gS(r),.2)}function WY(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const KY=yS({attachResizeListener:(t,e)=>No(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ub={current:void 0},IS=yS({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!ub.current){const t=new KY({});t.mount(window),t.setOptions({layoutScroll:!0}),ub.current=t}return ub.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),VY={pan:{Feature:aY},drag:{Feature:oY,ProjectionNode:IS,MeasureLayout:QE}};function CS(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||IE())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const u=a[n];u&&Nr.postRender(()=>u(s,o))};return Lo(t.current,r,i,{passive:!t.getProps()[n]})}class GY extends xa{mount(){this.unmount=Oo(CS(this.node,!0),CS(this.node,!1))}unmount(){}}class YY extends xa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Oo(No(this.node.current,"focus",()=>this.onFocus()),No(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const TS=(t,e)=>e?t===e?!0:TS(t,e.parentElement):!1;function fb(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,L0(r))}class JY extends xa{constructor(){super(...arguments),this.removeStartListeners=Hn,this.removeEndListeners=Hn,this.removeAccessibleListeners=Hn,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=Lo(window,"pointerup",(a,u)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:d,globalTapTarget:g}=this.node.getProps(),y=!g&&!TS(this.node.current,a.target)?d:l;y&&Nr.update(()=>y(a,u))},{passive:!(n.onTap||n.onPointerUp)}),o=Lo(window,"pointercancel",(a,u)=>this.cancelPress(a,u),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=Oo(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||fb("up",(u,l)=>{const{onTap:d}=this.node.getProps();d&&Nr.postRender(()=>d(u,l))})};this.removeEndListeners(),this.removeEndListeners=No(this.node.current,"keyup",o),fb("down",(a,u)=>{this.startPress(a,u)})},r=No(this.node.current,"keydown",e),n=()=>{this.isPressing&&fb("cancel",(s,o)=>this.cancelPress(s,o))},i=No(this.node.current,"blur",n);this.removeAccessibleListeners=Oo(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Nr.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!IE()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Nr.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=Lo(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=No(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Oo(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const lb=new WeakMap,hb=new WeakMap,XY=t=>{const e=lb.get(t.target);e&&e(t)},ZY=t=>{t.forEach(XY)};function QY({root:t,...e}){const r=t||document;hb.has(r)||hb.set(r,{});const n=hb.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(ZY,{root:t,...e})),n[i]}function eJ(t,e,r){const n=QY(e);return lb.set(t,r),n.observe(t),()=>{lb.delete(t),n.unobserve(t)}}const tJ={some:0,all:1};class rJ extends xa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:tJ[i]},a=u=>{const{isIntersecting:l}=u;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:g}=this.node.getProps(),y=l?d:g;y&&y(u)};return eJ(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(nJ(e,r))&&this.startObserver()}unmount(){}}function nJ({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const iJ={inView:{Feature:rJ},tap:{Feature:JY},focus:{Feature:YY},hover:{Feature:GY}},sJ={layout:{ProjectionNode:IS,MeasureLayout:QE}},db=Pe.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),q0=Pe.createContext({}),pb=typeof window<"u",RS=pb?Pe.useLayoutEffect:Pe.useEffect,DS=Pe.createContext({strict:!1});function oJ(t,e,r,n,i){var s,o;const{visualElement:a}=Pe.useContext(q0),u=Pe.useContext(DS),l=Pe.useContext(B0),d=Pe.useContext(db).reducedMotion,g=Pe.useRef();n=n||u.renderer,!g.current&&n&&(g.current=n(t,{visualState:e,parent:a,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d}));const y=g.current,A=Pe.useContext(XE);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&aJ(g.current,r,i,A);const P=Pe.useRef(!1);Pe.useInsertionEffect(()=>{y&&P.current&&y.update(r,l)});const N=r[pE],D=Pe.useRef(!!N&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,N))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,N)));return RS(()=>{y&&(P.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),ob.render(y.render),D.current&&y.animationState&&y.animationState.animateChanges())}),Pe.useEffect(()=>{y&&(!D.current&&y.animationState&&y.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{var k;(k=window.MotionHandoffMarkAsComplete)===null||k===void 0||k.call(window,N)}),D.current=!1))}),y}function aJ(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:u,layoutRoot:l}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:OS(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&Fu(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:u,layoutRoot:l})}function OS(t){if(t)return t.options.allowProjection!==!1?t.projection:OS(t.parent)}function cJ(t,e,r){return Pe.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):Fu(r)&&(r.current=n))},[e])}function z0(t){return A0(t.animate)||yv.some(e=>Kl(t[e]))}function NS(t){return!!(z0(t)||t.variants)}function uJ(t,e){if(z0(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Kl(r)?r:void 0,animate:Kl(n)?n:void 0}}return t.inherit!==!1?e:{}}function fJ(t){const{initial:e,animate:r}=uJ(t,Pe.useContext(q0));return Pe.useMemo(()=>({initial:e,animate:r}),[LS(e),LS(r)])}function LS(t){return Array.isArray(t)?t.join(" "):t}const kS={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},zu={};for(const t in kS)zu[t]={isEnabled:e=>kS[t].some(r=>!!e[r])};function lJ(t){for(const e in t)zu[e]={...zu[e],...t[e]}}const hJ=Symbol.for("motionComponentSymbol");function dJ({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&lJ(t);function s(a,u){let l;const d={...Pe.useContext(db),...a,layoutId:pJ(a)},{isStatic:g}=d,y=fJ(a),A=n(a,g);if(!g&&pb){gJ(d,t);const P=mJ(d);l=P.MeasureLayout,y.visualElement=oJ(i,A,d,e,P.ProjectionNode)}return me.jsxs(q0.Provider,{value:y,children:[l&&y.visualElement?me.jsx(l,{visualElement:y.visualElement,...d}):null,r(i,a,cJ(A,y.visualElement,u),A,g,y.visualElement)]})}const o=Pe.forwardRef(s);return o[hJ]=i,o}function pJ({layoutId:t}){const e=Pe.useContext(sb).id;return e&&t!==void 0?e+"-"+t:t}function gJ(t,e){const r=Pe.useContext(DS).strict;if(process.env.NODE_ENV!=="production"&&e&&r){const n="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?Nu(!1,n):Do(!1,n)}}function mJ(t){const{drag:e,layout:r}=zu;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const vJ=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function gb(t){return typeof t!="string"||t.includes("-")?!1:!!(vJ.indexOf(t)>-1||/[A-Z]/u.test(t))}function $S(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const BS=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function FS(t,e,r,n){$S(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(BS.has(i)?i:Jv(i),e.attrs[i])}function US(t,{layout:e,layoutId:r}){return vc.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!U0[t]||t==="opacity")}function mb(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(Qn(i[o])||e.style&&Qn(e.style[o])||US(o,t)||((n=r==null?void 0:r.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function jS(t,e,r){const n=mb(t,e,r);for(const i in t)if(Qn(t[i])||Qn(e[i])){const s=Vl.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function vb(t){const e=Pe.useRef(null);return e.current===null&&(e.current=t()),e.current}function bJ({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:yJ(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const qS=t=>(e,r)=>{const n=Pe.useContext(q0),i=Pe.useContext(B0),s=()=>bJ(t,e,n,i);return r?s():vb(s)};function yJ(t,e,r,n){const i={},s=n(t,{});for(const y in s)i[y]=j0(s[y]);let{initial:o,animate:a}=t;const u=z0(t),l=NS(t);e&&l&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const g=d?a:o;if(g&&typeof g!="boolean"&&!A0(g)){const y=Array.isArray(g)?g:[g];for(let A=0;A({style:{},transform:{},transformOrigin:{},vars:{}}),zS=()=>({...bb(),attrs:{}}),HS=(t,e)=>e&&typeof t=="number"?e.transform(t):t,wJ={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},xJ=Vl.length;function _J(t,e,r){let n="",i=!0;for(let s=0;stypeof t=="string"&&t.toLowerCase()==="svg",MJ={useVisualState:qS({scrapeMotionValuesFromProps:jS,createRenderState:zS,onMount:(t,e,{renderState:r,latestValues:n})=>{Nr.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),Nr.render(()=>{wb(r,n,xb(e.tagName),t.transformTemplate),FS(e,r)})}})},IJ={useVisualState:qS({scrapeMotionValuesFromProps:mb,createRenderState:bb})};function KS(t,e,r){for(const n in e)!Qn(e[n])&&!US(n,r)&&(t[n]=e[n])}function CJ({transformTemplate:t},e){return Pe.useMemo(()=>{const r=bb();return yb(r,e,t),Object.assign({},r.vars,r.style)},[e])}function TJ(t,e){const r=t.style||{},n={};return KS(n,r,t),Object.assign(n,CJ(t,e)),n}function RJ(t,e){const r={},n=TJ(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const DJ=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function H0(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||DJ.has(t)}let VS=t=>!H0(t);function OJ(t){t&&(VS=e=>e.startsWith("on")?!H0(e):t(e))}try{OJ(require("@emotion/is-prop-valid").default)}catch{}function NJ(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(VS(i)||r===!0&&H0(i)||!e&&!H0(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function LJ(t,e,r,n){const i=Pe.useMemo(()=>{const s=zS();return wb(s,e,xb(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};KS(s,t.style,t),i.style={...s,...i.style}}return i}function kJ(t=!1){return(r,n,i,{latestValues:s},o)=>{const u=(gb(r)?LJ:RJ)(n,s,o,r),l=NJ(n,typeof r=="string",t),d=r!==Pe.Fragment?{...l,...u,ref:i}:{},{children:g}=n,y=Pe.useMemo(()=>Qn(g)?g.get():g,[g]);return Pe.createElement(r,{...d,children:y})}}function $J(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...gb(n)?MJ:IJ,preloadedFeatures:t,useRender:kJ(i),createVisualElement:e,Component:n};return dJ(o)}}const _b={current:null},GS={current:!1};function BJ(){if(GS.current=!0,!!pb)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>_b.current=t.matches;t.addListener(e),e()}else _b.current=!1}function FJ(t,e,r){for(const n in e){const i=e[n],s=r[n];if(Qn(i))t.addValue(n,i),process.env.NODE_ENV==="development"&&S0(i.version==="11.11.17",`Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`);else if(Qn(s))t.addValue(n,eh(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,eh(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const YS=new WeakMap,UJ=[...O8,Zn,wa],jJ=t=>UJ.find(D8(t)),JS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class qJ{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Mv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=eo.now();this.renderScheduledAtthis.bindToMotionValue(n,r)),GS.current||BJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:_b.current,process.env.NODE_ENV!=="production"&&S0(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){YS.delete(this.current),this.projection&&this.projection.unmount(),va(this.notifyUpdate),va(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=vc.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Nr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in zu){const r=zu[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ln()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=eh(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(S8(i)||E8(i))?i=parseFloat(i):!jJ(i)&&wa.test(r)&&(i=H8(e,r)),this.setBaseTarget(e,Qn(i)?i.get():i)),Qn(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=vv(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Qn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new Yv),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class XS extends qJ{constructor(){super(...arguments),this.KeyframeResolver=W8}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function zJ(t){return window.getComputedStyle(t)}class HJ extends XS{constructor(){super(...arguments),this.type="html",this.renderInstance=$S}readValueFromInstance(e,r){if(vc.has(r)){const n=Nv(r);return n&&n.default||0}else{const n=zJ(e),i=(P8(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return GE(e,r)}build(e,r,n){yb(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return mb(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Qn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class WJ extends XS{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ln}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(vc.has(r)){const n=Nv(r);return n&&n.default||0}return r=BS.has(r)?r:Jv(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return jS(e,r,n)}build(e,r,n){wb(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){FS(e,r,n,i)}mount(e){this.isSVGTag=xb(e.tagName),super.mount(e)}}const KJ=(t,e)=>gb(t)?new WJ(e):new HJ(e,{allowProjection:t!==Pe.Fragment}),VJ=$J({...kG,...iJ,...VY,...sJ},KJ),GJ=CK(VJ);class YJ extends Yt.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function JJ({children:t,isPresent:e}){const r=Pe.useId(),n=Pe.useRef(null),i=Pe.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=Pe.useContext(db);return Pe.useInsertionEffect(()=>{const{width:o,height:a,top:u,left:l}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` [data-motion-pop-id="${r}"] { position: absolute !important; width: ${o}px !important; @@ -194,7 +194,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene top: ${u}px !important; left: ${l}px !important; } - `),()=>{document.head.removeChild(d)}},[e]),me.jsx(YJ,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const XJ=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=mb(ZJ),u=Pe.useId(),l=Pe.useCallback(g=>{a.set(g,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Pe.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:g=>(a.set(g,!1),()=>a.delete(g))}),s?[Math.random(),l]:[r,l]);return Pe.useMemo(()=>{a.forEach((g,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=me.jsx(JJ,{isPresent:r,children:t})),me.jsx(B0.Provider,{value:d,children:t})};function ZJ(){return new Map}const W0=t=>t.key||"";function ZS(t){const e=[];return Pe.Children.forEach(t,r=>{Pe.isValidElement(r)&&e.push(r)}),e}const QJ=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Do(!e,"Replace exitBeforeEnter with mode='wait'");const a=Pe.useMemo(()=>ZS(t),[t]),u=a.map(W0),l=Pe.useRef(!0),d=Pe.useRef(a),g=mb(()=>new Map),[y,A]=Pe.useState(a),[P,N]=Pe.useState(a);RS(()=>{l.current=!1,d.current=a;for(let $=0;$1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=Pe.useContext(ib);return me.jsx(me.Fragment,{children:P.map($=>{const q=W0($),U=a===P||u.includes(q),K=()=>{if(g.has(q))g.set(q,!0);else return;let J=!0;g.forEach(T=>{T||(J=!1)}),J&&(k==null||k(),N(d.current),i&&i())};return me.jsx(XJ,{isPresent:U,initial:!l.current||n?void 0:!1,custom:U?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:U?void 0:K,children:$},q)})})},Ec=t=>me.jsx(QJ,{children:me.jsx(GJ.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function _b(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return me.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,me.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[me.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),me.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:me.jsx(EK,{})})]})]})}function eX(t){return t.lastUsed?me.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[me.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?me.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[me.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function QS(t){var o,a;const{wallet:e,onClick:r}=t,n=me.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Pe.useMemo(()=>eX(e),[e]);return me.jsx(_b,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function e7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=sX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Eb);return a[0]===""&&a.length!==1&&a.shift(),t7(a,e)||iX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},t7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?t7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Eb);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},r7=/^\[(.+)\]$/,iX=t=>{if(r7.test(t)){const e=r7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},sX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return aX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Sb(o,n,s,e)}),n},Sb=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:n7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(oX(i)){Sb(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Sb(o,n7(e,s),r,n)})})},n7=(t,e)=>{let r=t;return e.split(Eb).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},oX=t=>t.isThemeGetter,aX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,cX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},i7="!",uX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,g;for(let D=0;Dd?g-d:void 0;return{modifiers:u,hasImportantModifier:A,baseClassName:P,maybePostfixModifierPosition:N}};return r?a=>r({className:a,parseClassName:o}):o},fX=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},lX=t=>({cache:cX(t.cacheSize),parseClassName:uX(t),...nX(t)}),hX=/\s+/,dX=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(hX);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:A}=r(l);let P=!!A,N=n(P?y.substring(0,A):y);if(!N){if(!P){a=l+(a.length>0?" "+a:a);continue}if(N=n(y),!N){a=l+(a.length>0?" "+a:a);continue}P=!1}const D=fX(d).join(":"),k=g?D+i7:D,$=k+N;if(s.includes($))continue;s.push($);const q=i(N,P);for(let U=0;U0?" "+a:a)}return a};function pX(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;ng(d),t());return r=lX(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=dX(u,r);return i(u,d),d}return function(){return s(pX.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},o7=/^\[(?:([a-z-]+):)?(.+)\]$/i,mX=/^\d+\/\d+$/,vX=new Set(["px","full","screen"]),bX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,yX=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,wX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,xX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_X=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ko=t=>Hu(t)||vX.has(t)||mX.test(t),_a=t=>Wu(t,"length",TX),Hu=t=>!!t&&!Number.isNaN(Number(t)),Ab=t=>Wu(t,"number",Hu),sh=t=>!!t&&Number.isInteger(Number(t)),EX=t=>t.endsWith("%")&&Hu(t.slice(0,-1)),cr=t=>o7.test(t),Ea=t=>bX.test(t),SX=new Set(["length","size","percentage"]),AX=t=>Wu(t,SX,a7),PX=t=>Wu(t,"position",a7),MX=new Set(["image","url"]),IX=t=>Wu(t,MX,DX),CX=t=>Wu(t,"",RX),oh=()=>!0,Wu=(t,e,r)=>{const n=o7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},TX=t=>yX.test(t)&&!wX.test(t),a7=()=>!1,RX=t=>xX.test(t),DX=t=>_X.test(t),OX=gX(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),g=Gr("invert"),y=Gr("gap"),A=Gr("gradientColorStops"),P=Gr("gradientColorStopPositions"),N=Gr("inset"),D=Gr("margin"),k=Gr("opacity"),$=Gr("padding"),q=Gr("saturate"),U=Gr("scale"),K=Gr("sepia"),J=Gr("skew"),T=Gr("space"),z=Gr("translate"),ue=()=>["auto","contain","none"],_e=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",ko,_a],f=()=>["auto",Hu,cr],p=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],S=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Hu,cr];return{cacheSize:500,separator:":",theme:{colors:[oh],spacing:[ko,_a],blur:["none","",Ea,cr],brightness:M(),borderColor:[t],borderRadius:["none","","full",Ea,cr],borderSpacing:E(),borderWidth:m(),contrast:M(),grayscale:S(),hueRotate:M(),invert:S(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[EX,_a],inset:G(),margin:G(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:S(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Ea]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...p(),cr]}],overflow:[{overflow:_e()}],"overflow-x":[{"overflow-x":_e()}],"overflow-y":[{"overflow-y":_e()}],overscroll:[{overscroll:ue()}],"overscroll-x":[{"overscroll-x":ue()}],"overscroll-y":[{"overscroll-y":ue()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",sh,cr]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",sh,cr]}],"grid-cols":[{"grid-cols":[oh]}],"col-start-end":[{col:["auto",{span:["full",sh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[oh]}],"row-start-end":[{row:["auto",{span:[sh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[$]}],px:[{px:[$]}],py:[{py:[$]}],ps:[{ps:[$]}],pe:[{pe:[$]}],pt:[{pt:[$]}],pr:[{pr:[$]}],pb:[{pb:[$]}],pl:[{pl:[$]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Ea]},Ea]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Ea,_a]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ab]}],"font-family":[{font:[oh]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Hu,Ab]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ko,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ko,_a]}],"underline-offset":[{"underline-offset":["auto",ko,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...p(),PX]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",AX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},IX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[A]}],"gradient-via":[{via:[A]}],"gradient-to":[{to:[A]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[ko,cr]}],"outline-w":[{outline:[ko,_a]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[ko,_a]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Ea,CX]}],"shadow-color":[{shadow:[oh]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Ea,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[g]}],saturate:[{saturate:[q]}],sepia:[{sepia:[K]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[q]}],"backdrop-sepia":[{"backdrop-sepia":[K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[U]}],"scale-x":[{"scale-x":[U]}],"scale-y":[{"scale-y":[U]}],rotate:[{rotate:[sh,cr]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[J]}],"skew-y":[{"skew-y":[J]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[ko,_a,Ab]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function $o(...t){return OX(rX(t))}function c7(t){const{className:e}=t;return me.jsxs("div",{className:$o("xc-flex xc-items-center xc-gap-2"),children:[me.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)}),me.jsx("div",{className:"xc-shrink-0",children:t.children}),me.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)})]})}const NX="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function LX(t){const{onClick:e}=t;function r(){e&&e()}return me.jsx(c7,{className:"xc-opacity-20",children:me.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[me.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),me.jsx(c8,{size:16})]})})}function kX(t){const[e,r]=Pe.useState(""),{featuredWallets:n,initialized:i}=Wl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Pe.useMemo(()=>{const N=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!N.test(e)&&D.test(e)},[e]);function g(N){o(N)}function y(N){r(N.target.value)}async function A(){s(e)}function P(N){N.key==="Enter"&&d&&A()}return me.jsx(Ec,{children:i&&me.jsxs(me.Fragment,{children:[t.header||me.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),l.showEmailSignIn&&me.jsxs("div",{className:"xc-mb-4",children:[me.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:y,onKeyDown:P}),me.jsx("button",{disabled:!d,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:A,children:"Continue"})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&me.jsx("div",{className:"xc-mb-4",children:me.jsxs(c7,{className:"xc-opacity-20",children:[" ",me.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),me.jsxs("div",{children:[me.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(N=>me.jsx(QS,{wallet:N,onClick:g},`feature-${N.key}`)),l.showTonConnect&&me.jsx(_b,{icon:me.jsx("img",{className:"xc-h-5 xc-w-5",src:NX}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&me.jsx(LX,{onClick:a})]})]})})}function ah(t){const{title:e}=t;return me.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[me.jsx(_K,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),me.jsx("span",{children:e})]})}var $X=Object.defineProperty,BX=Object.defineProperties,FX=Object.getOwnPropertyDescriptors,K0=Object.getOwnPropertySymbols,u7=Object.prototype.hasOwnProperty,f7=Object.prototype.propertyIsEnumerable,l7=(t,e,r)=>e in t?$X(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,UX=(t,e)=>{for(var r in e||(e={}))u7.call(e,r)&&l7(t,r,e[r]);if(K0)for(var r of K0(e))f7.call(e,r)&&l7(t,r,e[r]);return t},jX=(t,e)=>BX(t,FX(e)),qX=(t,e)=>{var r={};for(var n in t)u7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&K0)for(var n of K0(t))e.indexOf(n)<0&&f7.call(t,n)&&(r[n]=t[n]);return r};function zX(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function HX(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var WX=18,h7=40,KX=`${h7}px`,VX=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function GX({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),g=Yt.useCallback(()=>{let y=t.current,A=e.current;if(!y||!A||u||r==="none")return;let P=y,N=P.getBoundingClientRect().left+P.offsetWidth,D=P.getBoundingClientRect().top+P.offsetHeight/2,k=N-WX,$=D;document.querySelectorAll(VX).length===0&&document.elementFromPoint(k,$)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function A(){let N=window.innerWidth-y.getBoundingClientRect().right;a(N>=h7)}A();let P=setInterval(A,1e3);return()=>{clearInterval(P)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let A=setTimeout(g,0),P=setTimeout(g,2e3),N=setTimeout(g,5e3),D=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(A),clearTimeout(P),clearTimeout(N),clearTimeout(D)}},[e,n,r,g]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:KX}}var d7=Yt.createContext({}),p7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:g="increase-width",pasteTransformer:y,containerClassName:A,noScriptCSSFallback:P=YX,render:N,children:D}=r,k=qX(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),$,q,U,K,J;let[T,z]=Yt.useState(typeof k.defaultValue=="string"?k.defaultValue:""),ue=n??T,_e=HX(ue),G=Yt.useCallback(ie=>{i==null||i(ie),z(ie)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),p=Yt.useRef({value:ue,onChange:G,isIOS:typeof window<"u"&&((q=($=window==null?void 0:window.CSS)==null?void 0:$.supports)==null?void 0:q.call($,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(U=m.current)==null?void 0:U.selectionStart,(K=m.current)==null?void 0:K.selectionEnd,(J=m.current)==null?void 0:J.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let ie=m.current,fe=f.current;if(!ie||!fe)return;p.current.value!==ie.value&&p.current.onChange(ie.value),v.current.prev=[ie.selectionStart,ie.selectionEnd,ie.selectionDirection];function ve(){if(document.activeElement!==ie){I(null),ae(null);return}let Te=ie.selectionStart,Be=ie.selectionEnd,Ie=ie.selectionDirection,Le=ie.maxLength,Ve=ie.value,ke=v.current.prev,ze=-1,He=-1,Ee;if(Ve.length!==0&&Te!==null&&Be!==null){let et=Te===Be,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let pt=0;if(ke[0]!==null&&ke[1]!==null){Ee=Je{fe&&fe.style.setProperty("--root-height",`${ie.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(ie),()=>{document.removeEventListener("selectionchange",ve,{capture:!0}),Ne.disconnect()}},[]);let[x,_]=Yt.useState(!1),[S,b]=Yt.useState(!1),[M,I]=Yt.useState(null),[F,ae]=Yt.useState(null);Yt.useEffect(()=>{zX(()=>{var ie,fe,ve,Me;(ie=m.current)==null||ie.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(ve=m.current)==null?void 0:ve.selectionEnd,Be=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ae(Te),v.current.prev=[Ne,Te,Be])})},[ue,S]),Yt.useEffect(()=>{_e!==void 0&&ue!==_e&&_e.length{let fe=ie.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){ie.preventDefault();return}typeof _e=="string"&&fe.length<_e.length&&document.dispatchEvent(new Event("selectionchange")),G(fe)},[s,G,_e,E]),ee=Yt.useCallback(()=>{var ie;if(m.current){let fe=Math.min(m.current.value.length,s-1),ve=m.current.value.length;(ie=m.current)==null||ie.setSelectionRange(fe,ve),I(fe),ae(ve)}b(!0)},[s]),X=Yt.useCallback(ie=>{var fe,ve;let Me=m.current;if(!y&&(!p.current.isIOS||!ie.clipboardData||!Me))return;let Ne=ie.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),ie.preventDefault();let Be=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(ve=m.current)==null?void 0:ve.selectionEnd,Le=(Be!==Ie?ue.slice(0,Be)+Te+ue.slice(Ie):ue.slice(0,Be)+Te+ue.slice(Be)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,G(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ae(ke)},[s,G,E,ue]),Q=Yt.useMemo(()=>({position:"relative",cursor:k.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[k.disabled]),R=Yt.useMemo(()=>({position:"absolute",inset:0,width:O.willPushPWMBadge?`calc(100% + ${O.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:O.willPushPWMBadge?`inset(0 ${O.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[O.PWM_BADGE_SPACE_WIDTH,O.willPushPWMBadge,o]),Z=Yt.useMemo(()=>Yt.createElement("input",jX(UX({autoComplete:k.autoComplete||"one-time-code"},k),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ue.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:R,maxLength:s,value:ue,ref:m,onPaste:ie=>{var fe;X(ie),(fe=k.onPaste)==null||fe.call(k,ie)},onChange:se,onMouseOver:ie=>{var fe;_(!0),(fe=k.onMouseOver)==null||fe.call(k,ie)},onMouseLeave:ie=>{var fe;_(!1),(fe=k.onMouseLeave)==null||fe.call(k,ie)},onFocus:ie=>{var fe;ee(),(fe=k.onFocus)==null||fe.call(k,ie)},onBlur:ie=>{var fe;b(!1),(fe=k.onBlur)==null||fe.call(k,ie)}})),[se,ee,X,l,R,s,F,M,k,E==null?void 0:E.source,ue]),te=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ie,fe)=>{var ve;let Me=S&&M!==null&&F!==null&&(M===F&&fe===M||fe>=M&&feN?N(te):Yt.createElement(d7.Provider,{value:te},D),[D,te,N]);return Yt.createElement(Yt.Fragment,null,P!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,P)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:A},le,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Z)))});p7.displayName="Input";function ch(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var YX=` + `),()=>{document.head.removeChild(d)}},[e]),me.jsx(YJ,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const XJ=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=vb(ZJ),u=Pe.useId(),l=Pe.useCallback(g=>{a.set(g,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Pe.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:g=>(a.set(g,!1),()=>a.delete(g))}),s?[Math.random(),l]:[r,l]);return Pe.useMemo(()=>{a.forEach((g,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=me.jsx(JJ,{isPresent:r,children:t})),me.jsx(B0.Provider,{value:d,children:t})};function ZJ(){return new Map}const W0=t=>t.key||"";function ZS(t){const e=[];return Pe.Children.forEach(t,r=>{Pe.isValidElement(r)&&e.push(r)}),e}const QJ=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Do(!e,"Replace exitBeforeEnter with mode='wait'");const a=Pe.useMemo(()=>ZS(t),[t]),u=a.map(W0),l=Pe.useRef(!0),d=Pe.useRef(a),g=vb(()=>new Map),[y,A]=Pe.useState(a),[P,N]=Pe.useState(a);RS(()=>{l.current=!1,d.current=a;for(let $=0;$1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=Pe.useContext(sb);return me.jsx(me.Fragment,{children:P.map($=>{const q=W0($),U=a===P||u.includes(q),K=()=>{if(g.has(q))g.set(q,!0);else return;let J=!0;g.forEach(T=>{T||(J=!1)}),J&&(k==null||k(),N(d.current),i&&i())};return me.jsx(XJ,{isPresent:U,initial:!l.current||n?void 0:!1,custom:U?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:U?void 0:K,children:$},q)})})},Ec=t=>me.jsx(QJ,{children:me.jsx(GJ.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Eb(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return me.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,me.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[me.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),me.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:me.jsx(EK,{})})]})]})}function eX(t){return t.lastUsed?me.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[me.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?me.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[me.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function QS(t){var o,a;const{wallet:e,onClick:r}=t,n=me.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Pe.useMemo(()=>eX(e),[e]);return me.jsx(Eb,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function e7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=sX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Sb);return a[0]===""&&a.length!==1&&a.shift(),t7(a,e)||iX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},t7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?t7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Sb);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},r7=/^\[(.+)\]$/,iX=t=>{if(r7.test(t)){const e=r7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},sX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return aX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Ab(o,n,s,e)}),n},Ab=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:n7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(oX(i)){Ab(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Ab(o,n7(e,s),r,n)})})},n7=(t,e)=>{let r=t;return e.split(Sb).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},oX=t=>t.isThemeGetter,aX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,cX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},i7="!",uX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,g;for(let D=0;Dd?g-d:void 0;return{modifiers:u,hasImportantModifier:A,baseClassName:P,maybePostfixModifierPosition:N}};return r?a=>r({className:a,parseClassName:o}):o},fX=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},lX=t=>({cache:cX(t.cacheSize),parseClassName:uX(t),...nX(t)}),hX=/\s+/,dX=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(hX);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:A}=r(l);let P=!!A,N=n(P?y.substring(0,A):y);if(!N){if(!P){a=l+(a.length>0?" "+a:a);continue}if(N=n(y),!N){a=l+(a.length>0?" "+a:a);continue}P=!1}const D=fX(d).join(":"),k=g?D+i7:D,$=k+N;if(s.includes($))continue;s.push($);const q=i(N,P);for(let U=0;U0?" "+a:a)}return a};function pX(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;ng(d),t());return r=lX(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=dX(u,r);return i(u,d),d}return function(){return s(pX.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},o7=/^\[(?:([a-z-]+):)?(.+)\]$/i,mX=/^\d+\/\d+$/,vX=new Set(["px","full","screen"]),bX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,yX=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,wX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,xX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_X=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ko=t=>Hu(t)||vX.has(t)||mX.test(t),_a=t=>Wu(t,"length",TX),Hu=t=>!!t&&!Number.isNaN(Number(t)),Pb=t=>Wu(t,"number",Hu),sh=t=>!!t&&Number.isInteger(Number(t)),EX=t=>t.endsWith("%")&&Hu(t.slice(0,-1)),cr=t=>o7.test(t),Ea=t=>bX.test(t),SX=new Set(["length","size","percentage"]),AX=t=>Wu(t,SX,a7),PX=t=>Wu(t,"position",a7),MX=new Set(["image","url"]),IX=t=>Wu(t,MX,DX),CX=t=>Wu(t,"",RX),oh=()=>!0,Wu=(t,e,r)=>{const n=o7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},TX=t=>yX.test(t)&&!wX.test(t),a7=()=>!1,RX=t=>xX.test(t),DX=t=>_X.test(t),OX=gX(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),g=Gr("invert"),y=Gr("gap"),A=Gr("gradientColorStops"),P=Gr("gradientColorStopPositions"),N=Gr("inset"),D=Gr("margin"),k=Gr("opacity"),$=Gr("padding"),q=Gr("saturate"),U=Gr("scale"),K=Gr("sepia"),J=Gr("skew"),T=Gr("space"),z=Gr("translate"),ue=()=>["auto","contain","none"],_e=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",ko,_a],f=()=>["auto",Hu,cr],p=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],S=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Hu,cr];return{cacheSize:500,separator:":",theme:{colors:[oh],spacing:[ko,_a],blur:["none","",Ea,cr],brightness:M(),borderColor:[t],borderRadius:["none","","full",Ea,cr],borderSpacing:E(),borderWidth:m(),contrast:M(),grayscale:S(),hueRotate:M(),invert:S(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[EX,_a],inset:G(),margin:G(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:S(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Ea]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...p(),cr]}],overflow:[{overflow:_e()}],"overflow-x":[{"overflow-x":_e()}],"overflow-y":[{"overflow-y":_e()}],overscroll:[{overscroll:ue()}],"overscroll-x":[{"overscroll-x":ue()}],"overscroll-y":[{"overscroll-y":ue()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",sh,cr]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",sh,cr]}],"grid-cols":[{"grid-cols":[oh]}],"col-start-end":[{col:["auto",{span:["full",sh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[oh]}],"row-start-end":[{row:["auto",{span:[sh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[$]}],px:[{px:[$]}],py:[{py:[$]}],ps:[{ps:[$]}],pe:[{pe:[$]}],pt:[{pt:[$]}],pr:[{pr:[$]}],pb:[{pb:[$]}],pl:[{pl:[$]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Ea]},Ea]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Ea,_a]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Pb]}],"font-family":[{font:[oh]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Hu,Pb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ko,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ko,_a]}],"underline-offset":[{"underline-offset":["auto",ko,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...p(),PX]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",AX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},IX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[A]}],"gradient-via":[{via:[A]}],"gradient-to":[{to:[A]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[ko,cr]}],"outline-w":[{outline:[ko,_a]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[ko,_a]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Ea,CX]}],"shadow-color":[{shadow:[oh]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Ea,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[g]}],saturate:[{saturate:[q]}],sepia:[{sepia:[K]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[q]}],"backdrop-sepia":[{"backdrop-sepia":[K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[U]}],"scale-x":[{"scale-x":[U]}],"scale-y":[{"scale-y":[U]}],rotate:[{rotate:[sh,cr]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[J]}],"skew-y":[{"skew-y":[J]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[ko,_a,Pb]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function $o(...t){return OX(rX(t))}function c7(t){const{className:e}=t;return me.jsxs("div",{className:$o("xc-flex xc-items-center xc-gap-2"),children:[me.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)}),me.jsx("div",{className:"xc-shrink-0",children:t.children}),me.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)})]})}const NX="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function LX(t){const{onClick:e}=t;function r(){e&&e()}return me.jsx(c7,{className:"xc-opacity-20",children:me.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[me.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),me.jsx(c8,{size:16})]})})}function kX(t){const[e,r]=Pe.useState(""),{featuredWallets:n,initialized:i}=Wl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Pe.useMemo(()=>{const N=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!N.test(e)&&D.test(e)},[e]);function g(N){o(N)}function y(N){r(N.target.value)}async function A(){s(e)}function P(N){N.key==="Enter"&&d&&A()}return me.jsx(Ec,{children:i&&me.jsxs(me.Fragment,{children:[t.header||me.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),l.showEmailSignIn&&me.jsxs("div",{className:"xc-mb-4",children:[me.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:y,onKeyDown:P}),me.jsx("button",{disabled:!d,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:A,children:"Continue"})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&me.jsx("div",{className:"xc-mb-4",children:me.jsxs(c7,{className:"xc-opacity-20",children:[" ",me.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),me.jsxs("div",{children:[me.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(N=>me.jsx(QS,{wallet:N,onClick:g},`feature-${N.key}`)),l.showTonConnect&&me.jsx(Eb,{icon:me.jsx("img",{className:"xc-h-5 xc-w-5",src:NX}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&me.jsx(LX,{onClick:a})]})]})})}function ah(t){const{title:e}=t;return me.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[me.jsx(_K,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),me.jsx("span",{children:e})]})}var $X=Object.defineProperty,BX=Object.defineProperties,FX=Object.getOwnPropertyDescriptors,K0=Object.getOwnPropertySymbols,u7=Object.prototype.hasOwnProperty,f7=Object.prototype.propertyIsEnumerable,l7=(t,e,r)=>e in t?$X(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,UX=(t,e)=>{for(var r in e||(e={}))u7.call(e,r)&&l7(t,r,e[r]);if(K0)for(var r of K0(e))f7.call(e,r)&&l7(t,r,e[r]);return t},jX=(t,e)=>BX(t,FX(e)),qX=(t,e)=>{var r={};for(var n in t)u7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&K0)for(var n of K0(t))e.indexOf(n)<0&&f7.call(t,n)&&(r[n]=t[n]);return r};function zX(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function HX(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var WX=18,h7=40,KX=`${h7}px`,VX=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function GX({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),g=Yt.useCallback(()=>{let y=t.current,A=e.current;if(!y||!A||u||r==="none")return;let P=y,N=P.getBoundingClientRect().left+P.offsetWidth,D=P.getBoundingClientRect().top+P.offsetHeight/2,k=N-WX,$=D;document.querySelectorAll(VX).length===0&&document.elementFromPoint(k,$)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function A(){let N=window.innerWidth-y.getBoundingClientRect().right;a(N>=h7)}A();let P=setInterval(A,1e3);return()=>{clearInterval(P)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let A=setTimeout(g,0),P=setTimeout(g,2e3),N=setTimeout(g,5e3),D=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(A),clearTimeout(P),clearTimeout(N),clearTimeout(D)}},[e,n,r,g]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:KX}}var d7=Yt.createContext({}),p7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:g="increase-width",pasteTransformer:y,containerClassName:A,noScriptCSSFallback:P=YX,render:N,children:D}=r,k=qX(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),$,q,U,K,J;let[T,z]=Yt.useState(typeof k.defaultValue=="string"?k.defaultValue:""),ue=n??T,_e=HX(ue),G=Yt.useCallback(ie=>{i==null||i(ie),z(ie)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),p=Yt.useRef({value:ue,onChange:G,isIOS:typeof window<"u"&&((q=($=window==null?void 0:window.CSS)==null?void 0:$.supports)==null?void 0:q.call($,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(U=m.current)==null?void 0:U.selectionStart,(K=m.current)==null?void 0:K.selectionEnd,(J=m.current)==null?void 0:J.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let ie=m.current,fe=f.current;if(!ie||!fe)return;p.current.value!==ie.value&&p.current.onChange(ie.value),v.current.prev=[ie.selectionStart,ie.selectionEnd,ie.selectionDirection];function ve(){if(document.activeElement!==ie){I(null),ae(null);return}let Te=ie.selectionStart,Be=ie.selectionEnd,Ie=ie.selectionDirection,Le=ie.maxLength,Ve=ie.value,ke=v.current.prev,ze=-1,He=-1,Ee;if(Ve.length!==0&&Te!==null&&Be!==null){let et=Te===Be,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let pt=0;if(ke[0]!==null&&ke[1]!==null){Ee=Je{fe&&fe.style.setProperty("--root-height",`${ie.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(ie),()=>{document.removeEventListener("selectionchange",ve,{capture:!0}),Ne.disconnect()}},[]);let[x,_]=Yt.useState(!1),[S,b]=Yt.useState(!1),[M,I]=Yt.useState(null),[F,ae]=Yt.useState(null);Yt.useEffect(()=>{zX(()=>{var ie,fe,ve,Me;(ie=m.current)==null||ie.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(ve=m.current)==null?void 0:ve.selectionEnd,Be=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ae(Te),v.current.prev=[Ne,Te,Be])})},[ue,S]),Yt.useEffect(()=>{_e!==void 0&&ue!==_e&&_e.length{let fe=ie.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){ie.preventDefault();return}typeof _e=="string"&&fe.length<_e.length&&document.dispatchEvent(new Event("selectionchange")),G(fe)},[s,G,_e,E]),ee=Yt.useCallback(()=>{var ie;if(m.current){let fe=Math.min(m.current.value.length,s-1),ve=m.current.value.length;(ie=m.current)==null||ie.setSelectionRange(fe,ve),I(fe),ae(ve)}b(!0)},[s]),X=Yt.useCallback(ie=>{var fe,ve;let Me=m.current;if(!y&&(!p.current.isIOS||!ie.clipboardData||!Me))return;let Ne=ie.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),ie.preventDefault();let Be=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(ve=m.current)==null?void 0:ve.selectionEnd,Le=(Be!==Ie?ue.slice(0,Be)+Te+ue.slice(Ie):ue.slice(0,Be)+Te+ue.slice(Be)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,G(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ae(ke)},[s,G,E,ue]),Q=Yt.useMemo(()=>({position:"relative",cursor:k.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[k.disabled]),R=Yt.useMemo(()=>({position:"absolute",inset:0,width:O.willPushPWMBadge?`calc(100% + ${O.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:O.willPushPWMBadge?`inset(0 ${O.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[O.PWM_BADGE_SPACE_WIDTH,O.willPushPWMBadge,o]),Z=Yt.useMemo(()=>Yt.createElement("input",jX(UX({autoComplete:k.autoComplete||"one-time-code"},k),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ue.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:R,maxLength:s,value:ue,ref:m,onPaste:ie=>{var fe;X(ie),(fe=k.onPaste)==null||fe.call(k,ie)},onChange:se,onMouseOver:ie=>{var fe;_(!0),(fe=k.onMouseOver)==null||fe.call(k,ie)},onMouseLeave:ie=>{var fe;_(!1),(fe=k.onMouseLeave)==null||fe.call(k,ie)},onFocus:ie=>{var fe;ee(),(fe=k.onFocus)==null||fe.call(k,ie)},onBlur:ie=>{var fe;b(!1),(fe=k.onBlur)==null||fe.call(k,ie)}})),[se,ee,X,l,R,s,F,M,k,E==null?void 0:E.source,ue]),te=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ie,fe)=>{var ve;let Me=S&&M!==null&&F!==null&&(M===F&&fe===M||fe>=M&&feN?N(te):Yt.createElement(d7.Provider,{value:te},D),[D,te,N]);return Yt.createElement(Yt.Fragment,null,P!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,P)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:A},le,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Z)))});p7.displayName="Input";function ch(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var YX=` [data-input-otp] { --nojs-bg: white !important; --nojs-fg: black !important; @@ -213,12 +213,12 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene --nojs-bg: black !important; --nojs-fg: white !important; } -}`;const g7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>me.jsx(p7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));g7.displayName="InputOTP";const m7=Yt.forwardRef(({className:t,...e},r)=>me.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));m7.displayName="InputOTPGroup";const Sc=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(d7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return me.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&me.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:me.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Sc.displayName="InputOTPSlot";function JX(t){const{spinning:e,children:r,className:n}=t;return me.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&me.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:me.jsx(mc,{className:"xc-animate-spin"})})]})}const v7=Pe.createContext({channel:"",device:"WEB",app:"",inviterCode:""});function Pb(){return Pe.useContext(v7)}function XX(t){const{config:e}=t,[r,n]=Pe.useState(e.channel),[i,s]=Pe.useState(e.device),[o,a]=Pe.useState(e.app),[u,l]=Pe.useState(e.inviterCode);return Pe.useEffect(()=>{n(e.channel),s(e.device),a(e.app),l(e.inviterCode)},[e]),me.jsx(v7.Provider,{value:{channel:r,device:i,app:o,inviterCode:u},children:t.children})}function ZX(t){const{email:e}=t,[r,n]=Pe.useState(0),[i,s]=Pe.useState(!1),[o,a]=Pe.useState(!1),[u,l]=Pe.useState(""),[d,g]=Pe.useState(""),y=Pb();async function A(){n(60);const D=setInterval(()=>{n(k=>k===0?(clearInterval(D),0):k-1)},1e3)}async function P(D){a(!0);try{l(""),await ma.getEmailCode({account_type:"email",email:D}),A()}catch(k){l(k.message)}a(!1)}Pe.useEffect(()=>{e&&P(e)},[e]);async function N(D){if(g(""),!(D.length<6)){s(!0);try{const k=await ma.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:D,email:e,inviter_code:y.inviterCode,source:{device:y.device,channel:y.channel,app:y.app}});t.onLogin(k.data)}catch(k){g(k.message)}s(!1)}}return me.jsxs(Ec,{children:[me.jsx("div",{className:"xc-mb-12",children:me.jsx(ah,{title:"Sign in with email",onBack:t.onBack})}),me.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[me.jsx(IK,{className:"xc-mb-4",size:60}),me.jsx("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:u?me.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:me.jsx("p",{className:"xc-px-8",children:u})}):o?me.jsx(mc,{className:"xc-animate-spin"}):me.jsxs(me.Fragment,{children:[me.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),me.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]})}),me.jsx("div",{className:"xc-mb-2 xc-h-12",children:me.jsx(JX,{spinning:i,className:"xc-rounded-xl",children:me.jsx(g7,{maxLength:6,onChange:N,disabled:i,className:"disabled:xc-opacity-20",children:me.jsx(m7,{children:me.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[me.jsx(Sc,{index:0}),me.jsx(Sc,{index:1}),me.jsx(Sc,{index:2}),me.jsx(Sc,{index:3}),me.jsx(Sc,{index:4}),me.jsx(Sc,{index:5})]})})})})}),d&&me.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:me.jsx("p",{children:d})})]}),me.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Recend in ${r}s`:me.jsx("button",{onClick:()=>P(e),children:"Send again"})]})]})}var b7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var g=function(f,p){var v=f,x=k[p],_=null,S=0,b=null,M=[],I={},F=function(te,le){_=function(ie){for(var fe=new Array(ie),ve=0;ve=7&&ee(te),b==null&&(b=R(v,x,M)),Q(b,le)},ae=function(te,le){for(var ie=-1;ie<=7;ie+=1)if(!(te+ie<=-1||S<=te+ie))for(var fe=-1;fe<=7;fe+=1)le+fe<=-1||S<=le+fe||(_[te+ie][le+fe]=0<=ie&&ie<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(ie==0||ie==6)||2<=ie&&ie<=4&&2<=fe&&fe<=4)},O=function(){for(var te=8;te>ie&1)==1;_[Math.floor(ie/3)][ie%3+S-8-3]=fe}for(ie=0;ie<18;ie+=1)fe=!te&&(le>>ie&1)==1,_[ie%3+S-8-3][Math.floor(ie/3)]=fe},X=function(te,le){for(var ie=x<<3|le,fe=$.getBCHTypeInfo(ie),ve=0;ve<15;ve+=1){var Me=!te&&(fe>>ve&1)==1;ve<6?_[ve][8]=Me:ve<8?_[ve+1][8]=Me:_[S-15+ve][8]=Me}for(ve=0;ve<15;ve+=1)Me=!te&&(fe>>ve&1)==1,ve<8?_[8][S-ve-1]=Me:ve<9?_[8][15-ve-1+1]=Me:_[8][15-ve-1]=Me;_[S-8][8]=!te},Q=function(te,le){for(var ie=-1,fe=S-1,ve=7,Me=0,Ne=$.getMaskFunction(le),Te=S-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var Be=0;Be<2;Be+=1)if(_[fe][Te-Be]==null){var Ie=!1;Me>>ve&1)==1),Ne(fe,Te-Be)&&(Ie=!Ie),_[fe][Te-Be]=Ie,(ve-=1)==-1&&(Me+=1,ve=7)}if((fe+=ie)<0||S<=fe){fe-=ie,ie=-ie;break}}},R=function(te,le,ie){for(var fe=K.getRSBlocks(te,le),ve=J(),Me=0;Me8*Te)throw"code length overflow. ("+ve.getLengthInBits()+">"+8*Te+")";for(ve.getLengthInBits()+4<=8*Te&&ve.put(0,4);ve.getLengthInBits()%8!=0;)ve.putBit(!1);for(;!(ve.getLengthInBits()>=8*Te||(ve.put(236,8),ve.getLengthInBits()>=8*Te));)ve.put(17,8);return function(Be,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Ee=0;Ee=0?rt.getAt(Je):0}}var pt=0;for($e=0;$eIe)&&(Ne=Ie,Te=Be)}return Te}())},I.createTableTag=function(te,le){te=te||2;var ie="";ie+='";for(var ve=0;ve';ie+=""}return(ie+="")+"
"},I.createSvgTag=function(te,le,ie,fe){var ve={};typeof arguments[0]=="object"&&(te=(ve=arguments[0]).cellSize,le=ve.margin,ie=ve.alt,fe=ve.title),te=te||2,le=le===void 0?4*te:le,(ie=typeof ie=="string"?{text:ie}:ie||{}).text=ie.text||null,ie.id=ie.text?ie.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,Be,Ie=I.getModuleCount()*te+2*le,Le="";for(Be="l"+te+",0 0,"+te+" -"+te+",0 0,-"+te+"z ",Le+=''+Z(fe.text)+"":"",Le+=ie.text?''+Z(ie.text)+"":"",Le+='',Le+='"},I.createDataURL=function(te,le){te=te||2,le=le===void 0?4*te:le;var ie=I.getModuleCount()*te+2*le,fe=le,ve=ie-le;return m(ie,ie,function(Me,Ne){if(fe<=Me&&Me"};var Z=function(te){for(var le="",ie=0;ie":le+=">";break;case"&":le+="&";break;case'"':le+=""";break;default:le+=fe}}return le};return I.createASCII=function(te,le){if((te=te||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Ee,Qe,ct,$e,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[$e]:pt[$e];ft+=` +}`;const g7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>me.jsx(p7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));g7.displayName="InputOTP";const m7=Yt.forwardRef(({className:t,...e},r)=>me.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));m7.displayName="InputOTPGroup";const Sc=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(d7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return me.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&me.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:me.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Sc.displayName="InputOTPSlot";function JX(t){const{spinning:e,children:r,className:n}=t;return me.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&me.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:me.jsx(mc,{className:"xc-animate-spin"})})]})}const v7=Pe.createContext({channel:"",device:"WEB",app:"",inviterCode:""});function Mb(){return Pe.useContext(v7)}function XX(t){const{config:e}=t,[r,n]=Pe.useState(e.channel),[i,s]=Pe.useState(e.device),[o,a]=Pe.useState(e.app),[u,l]=Pe.useState(e.inviterCode);return Pe.useEffect(()=>{n(e.channel),s(e.device),a(e.app),l(e.inviterCode)},[e]),me.jsx(v7.Provider,{value:{channel:r,device:i,app:o,inviterCode:u},children:t.children})}function ZX(t){const{email:e}=t,[r,n]=Pe.useState(0),[i,s]=Pe.useState(!1),[o,a]=Pe.useState(!1),[u,l]=Pe.useState(""),[d,g]=Pe.useState(""),y=Mb();async function A(){n(60);const D=setInterval(()=>{n(k=>k===0?(clearInterval(D),0):k-1)},1e3)}async function P(D){a(!0);try{l(""),await ma.getEmailCode({account_type:"email",email:D}),A()}catch(k){l(k.message)}a(!1)}Pe.useEffect(()=>{e&&P(e)},[e]);async function N(D){if(g(""),!(D.length<6)){s(!0);try{const k=await ma.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:D,email:e,inviter_code:y.inviterCode,source:{device:y.device,channel:y.channel,app:y.app}});t.onLogin(k.data)}catch(k){g(k.message)}s(!1)}}return me.jsxs(Ec,{children:[me.jsx("div",{className:"xc-mb-12",children:me.jsx(ah,{title:"Sign in with email",onBack:t.onBack})}),me.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[me.jsx(IK,{className:"xc-mb-4",size:60}),me.jsx("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:u?me.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:me.jsx("p",{className:"xc-px-8",children:u})}):o?me.jsx(mc,{className:"xc-animate-spin"}):me.jsxs(me.Fragment,{children:[me.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),me.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]})}),me.jsx("div",{className:"xc-mb-2 xc-h-12",children:me.jsx(JX,{spinning:i,className:"xc-rounded-xl",children:me.jsx(g7,{maxLength:6,onChange:N,disabled:i,className:"disabled:xc-opacity-20",children:me.jsx(m7,{children:me.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[me.jsx(Sc,{index:0}),me.jsx(Sc,{index:1}),me.jsx(Sc,{index:2}),me.jsx(Sc,{index:3}),me.jsx(Sc,{index:4}),me.jsx(Sc,{index:5})]})})})})}),d&&me.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:me.jsx("p",{children:d})})]}),me.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Recend in ${r}s`:me.jsx("button",{onClick:()=>P(e),children:"Send again"})]})]})}var b7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var g=function(f,p){var v=f,x=k[p],_=null,S=0,b=null,M=[],I={},F=function(te,le){_=function(ie){for(var fe=new Array(ie),ve=0;ve=7&&ee(te),b==null&&(b=R(v,x,M)),Q(b,le)},ae=function(te,le){for(var ie=-1;ie<=7;ie+=1)if(!(te+ie<=-1||S<=te+ie))for(var fe=-1;fe<=7;fe+=1)le+fe<=-1||S<=le+fe||(_[te+ie][le+fe]=0<=ie&&ie<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(ie==0||ie==6)||2<=ie&&ie<=4&&2<=fe&&fe<=4)},O=function(){for(var te=8;te>ie&1)==1;_[Math.floor(ie/3)][ie%3+S-8-3]=fe}for(ie=0;ie<18;ie+=1)fe=!te&&(le>>ie&1)==1,_[ie%3+S-8-3][Math.floor(ie/3)]=fe},X=function(te,le){for(var ie=x<<3|le,fe=$.getBCHTypeInfo(ie),ve=0;ve<15;ve+=1){var Me=!te&&(fe>>ve&1)==1;ve<6?_[ve][8]=Me:ve<8?_[ve+1][8]=Me:_[S-15+ve][8]=Me}for(ve=0;ve<15;ve+=1)Me=!te&&(fe>>ve&1)==1,ve<8?_[8][S-ve-1]=Me:ve<9?_[8][15-ve-1+1]=Me:_[8][15-ve-1]=Me;_[S-8][8]=!te},Q=function(te,le){for(var ie=-1,fe=S-1,ve=7,Me=0,Ne=$.getMaskFunction(le),Te=S-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var Be=0;Be<2;Be+=1)if(_[fe][Te-Be]==null){var Ie=!1;Me>>ve&1)==1),Ne(fe,Te-Be)&&(Ie=!Ie),_[fe][Te-Be]=Ie,(ve-=1)==-1&&(Me+=1,ve=7)}if((fe+=ie)<0||S<=fe){fe-=ie,ie=-ie;break}}},R=function(te,le,ie){for(var fe=K.getRSBlocks(te,le),ve=J(),Me=0;Me8*Te)throw"code length overflow. ("+ve.getLengthInBits()+">"+8*Te+")";for(ve.getLengthInBits()+4<=8*Te&&ve.put(0,4);ve.getLengthInBits()%8!=0;)ve.putBit(!1);for(;!(ve.getLengthInBits()>=8*Te||(ve.put(236,8),ve.getLengthInBits()>=8*Te));)ve.put(17,8);return function(Be,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Ee=0;Ee=0?rt.getAt(Je):0}}var pt=0;for($e=0;$eIe)&&(Ne=Ie,Te=Be)}return Te}())},I.createTableTag=function(te,le){te=te||2;var ie="";ie+='";for(var ve=0;ve';ie+=""}return(ie+="")+"
"},I.createSvgTag=function(te,le,ie,fe){var ve={};typeof arguments[0]=="object"&&(te=(ve=arguments[0]).cellSize,le=ve.margin,ie=ve.alt,fe=ve.title),te=te||2,le=le===void 0?4*te:le,(ie=typeof ie=="string"?{text:ie}:ie||{}).text=ie.text||null,ie.id=ie.text?ie.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,Be,Ie=I.getModuleCount()*te+2*le,Le="";for(Be="l"+te+",0 0,"+te+" -"+te+",0 0,-"+te+"z ",Le+=''+Z(fe.text)+"":"",Le+=ie.text?''+Z(ie.text)+"":"",Le+='',Le+='"},I.createDataURL=function(te,le){te=te||2,le=le===void 0?4*te:le;var ie=I.getModuleCount()*te+2*le,fe=le,ve=ie-le;return m(ie,ie,function(Me,Ne){if(fe<=Me&&Me"};var Z=function(te){for(var le="",ie=0;ie":le+=">";break;case"&":le+="&";break;case'"':le+=""";break;default:le+=fe}}return le};return I.createASCII=function(te,le){if((te=te||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Ee,Qe,ct,$e,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[$e]:pt[$e];ft+=` `}return et%2&&ze>0?ft.substring(0,ft.length-et-1)+Array(et+1).join("▀"):ft.substring(0,ft.length-1)}(le);te-=1,le=le===void 0?2*te:le;var ie,fe,ve,Me,Ne=I.getModuleCount()*te+2*le,Te=le,Be=Ne-le,Ie=Array(te+1).join("██"),Le=Array(te+1).join(" "),Ve="",ke="";for(ie=0;ie>>8),S.push(255&I)):S.push(x)}}return S}};var y,A,P,N,D,k={L:1,M:0,Q:3,H:2},$=(y=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],A=1335,P=7973,D=function(f){for(var p=0;f!=0;)p+=1,f>>>=1;return p},(N={}).getBCHTypeInfo=function(f){for(var p=f<<10;D(p)-D(A)>=0;)p^=A<=0;)p^=P<5&&(v+=3+S-5)}for(x=0;x=256;)x-=255;return f[x]}}}();function U(f,p){if(f.length===void 0)throw f.length+"/"+p;var v=function(){for(var _=0;_>>7-x%8&1)==1},put:function(x,_){for(var S=0;S<_;S+=1)v.putBit((x>>>_-S-1&1)==1)},getLengthInBits:function(){return p},putBit:function(x){var _=Math.floor(p/8);f.length<=_&&f.push(0),x&&(f[_]|=128>>>p%8),p+=1}};return v},T=function(f){var p=f,v={getMode:function(){return 1},getLength:function(S){return p.length},write:function(S){for(var b=p,M=0;M+2>>8&255)+(255&M),_.put(M,13),b+=2}if(b>>8)},writeBytes:function(v,x,_){x=x||0,_=_||v.length;for(var S=0;S<_;S+=1)p.writeByte(v[S+x])},writeString:function(v){for(var x=0;x0&&(v+=","),v+=f[x];return v+"]"}};return p},E=function(f){var p=f,v=0,x=0,_=0,S={read:function(){for(;_<8;){if(v>=p.length){if(_==0)return-1;throw"unexpected end of file./"+_}var M=p.charAt(v);if(v+=1,M=="=")return _=0,-1;M.match(/^\s$/)||(x=x<<6|b(M.charCodeAt(0)),_+=6)}var I=x>>>_-8&255;return _-=8,I}},b=function(M){if(65<=M&&M<=90)return M-65;if(97<=M&&M<=122)return M-97+26;if(48<=M&&M<=57)return M-48+52;if(M==43)return 62;if(M==47)return 63;throw"c:"+M};return S},m=function(f,p,v){for(var x=function(ae,O){var se=ae,ee=O,X=new Array(ae*O),Q={setPixel:function(te,le,ie){X[le*se+te]=ie},write:function(te){te.writeString("GIF87a"),te.writeShort(se),te.writeShort(ee),te.writeByte(128),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(255),te.writeByte(255),te.writeByte(255),te.writeString(","),te.writeShort(0),te.writeShort(0),te.writeShort(se),te.writeShort(ee),te.writeByte(0);var le=R(2);te.writeByte(2);for(var ie=0;le.length-ie>255;)te.writeByte(255),te.writeBytes(le,ie,255),ie+=255;te.writeByte(le.length-ie),te.writeBytes(le,ie,le.length-ie),te.writeByte(0),te.writeString(";")}},R=function(te){for(var le=1<>>Ee)throw"length over";for(;Te+Ee>=8;)Ne.writeByte(255&(He<>>=8-Te,Be=0,Te=0;Be|=He<0&&Ne.writeByte(Be)}});Le.write(le,fe);var Ve=0,ke=String.fromCharCode(X[Ve]);for(Ve+=1;Ve=6;)Q(ae>>>O-6),O-=6},X.flush=function(){if(O>0&&(Q(ae<<6-O),ae=0,O=0),se%3!=0)for(var Z=3-se%3,te=0;te>6,128|63&N):N<55296||N>=57344?A.push(224|N>>12,128|N>>6&63,128|63&N):(P++,N=65536+((1023&N)<<10|1023&y.charCodeAt(P)),A.push(240|N>>18,128|N>>12&63,128|N>>6&63,128|63&N))}return A}(g)},(l=typeof(u=function(){return d})=="function"?u.apply(a,[]):u)===void 0||(o.exports=l)}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var u=n[o]={exports:{}};return r[o](u,u.exports,i),u.exports}i.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return i.d(a,{a}),a},i.d=(o,a)=>{for(var u in a)i.o(a,u)&&!i.o(o,u)&&Object.defineProperty(o,u,{enumerable:!0,get:a[u]})},i.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a);var s={};return(()=>{i.d(s,{default:()=>G});const o=E=>!!E&&typeof E=="object"&&!Array.isArray(E);function a(E,...m){if(!m.length)return E;const f=m.shift();return f!==void 0&&o(E)&&o(f)?(E=Object.assign({},E),Object.keys(f).forEach(p=>{const v=E[p],x=f[p];Array.isArray(v)&&Array.isArray(x)?E[p]=x:o(v)&&o(x)?E[p]=a(Object.assign({},v),x):E[p]=x}),a(E,...m)):E}function u(E,m){const f=document.createElement("a");f.download=m,f.href=E,document.body.appendChild(f),f.click(),document.body.removeChild(f)}const l={L:.07,M:.15,Q:.25,H:.3};class d{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;switch(this._type){case"dots":x=this._drawDot;break;case"classy":x=this._drawClassy;break;case"classy-rounded":x=this._drawClassyRounded;break;case"rounded":x=this._drawRounded;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawSquare}x.call(this,{x:m,y:f,size:p,getNeighbor:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(p+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(p)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_basicSideRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, 0 ${-f}`)}}))}_basicCornerRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}v `+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_basicCornerExtraRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`)}}))}_basicCornersRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${f/2} ${f/2}h `+f/2+"v "+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_drawDot({x:m,y:f,size:p}){this._basicDot({x:m,y:f,size:p,rotation:0})}_drawSquare({x:m,y:f,size:p}){this._basicSquare({x:m,y:f,size:p,rotation:0})}_drawRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:p,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerRounded({x:m,y:f,size:p,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:p,rotation:I})}}else this._basicDot({x:m,y:f,size:p,rotation:0})}_drawExtraRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:p,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:p,rotation:I})}}else this._basicDot({x:m,y:f,size:p,rotation:0})}_drawClassy({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:p,rotation:0}):this._basicCornerRounded({x:m,y:f,size:p,rotation:Math.PI/2}):this._basicCornerRounded({x:m,y:f,size:p,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:p,rotation:Math.PI/2})}_drawClassyRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:p,rotation:0}):this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:p,rotation:Math.PI/2})}}class g{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;switch(this._type){case"square":x=this._drawSquare;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawDot}x.call(this,{x:m,y:f,size:p,rotation:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p+f/2} ${v}a ${f/2} ${f/2} 0 1 0 0.1 0zm 0 ${x}a ${f/2-x} ${f/2-x} 0 1 1 -0.1 0Z`)}}))}_basicSquare(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}v `+-f+`zM ${p+x} ${v+x}h `+(f-2*x)+"v "+(f-2*x)+"h "+(2*x-f)+"z")}}))}_basicExtraRounded(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p} ${v+2.5*x}v `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*x}h `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*-x}v `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*-x}h `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*x}M ${p+2.5*x} ${v+x}h `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*x}v `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*x}h `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*-x}v `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*-x}`)}}))}_drawDot({x:m,y:f,size:p,rotation:v}){this._basicDot({x:m,y:f,size:p,rotation:v})}_drawSquare({x:m,y:f,size:p,rotation:v}){this._basicSquare({x:m,y:f,size:p,rotation:v})}_drawExtraRounded({x:m,y:f,size:p,rotation:v}){this._basicExtraRounded({x:m,y:f,size:p,rotation:v})}}class y{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;x=this._type==="square"?this._drawSquare:this._drawDot,x.call(this,{x:m,y:f,size:p,rotation:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(p+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(p)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_drawDot({x:m,y:f,size:p,rotation:v}){this._basicDot({x:m,y:f,size:p,rotation:v})}_drawSquare({x:m,y:f,size:p,rotation:v}){this._basicSquare({x:m,y:f,size:p,rotation:v})}}const A="circle",P=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],N=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class D{constructor(m,f){this._roundSize=p=>this._options.dotsOptions.roundSize?Math.floor(p):p,this._window=f,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(m.width)),this._element.setAttribute("height",String(m.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),m.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=m.image,this._instanceId=D.instanceCount++,this._options=m}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(m){const f=m.getModuleCount(),p=Math.min(this._options.width,this._options.height)-2*this._options.margin,v=this._options.shape===A?p/Math.sqrt(2):p,x=this._roundSize(v/f);let _={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=m,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:S,qrOptions:b}=this._options,M=S.imageSize*l[b.errorCorrectionLevel],I=Math.floor(M*f*f);_=function({originalHeight:F,originalWidth:ae,maxHiddenDots:O,maxHiddenAxisDots:se,dotSize:ee}){const X={x:0,y:0},Q={x:0,y:0};if(F<=0||ae<=0||O<=0||ee<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const R=F/ae;return X.x=Math.floor(Math.sqrt(O/R)),X.x<=0&&(X.x=1),se&&seO||se&&se{var M,I,F,ae,O,se;return!(this._options.imageOptions.hideBackgroundDots&&S>=(f-_.hideYDots)/2&&S<(f+_.hideYDots)/2&&b>=(f-_.hideXDots)/2&&b<(f+_.hideXDots)/2||!((M=P[S])===null||M===void 0)&&M[b]||!((I=P[S-f+7])===null||I===void 0)&&I[b]||!((F=P[S])===null||F===void 0)&&F[b-f+7]||!((ae=N[S])===null||ae===void 0)&&ae[b]||!((O=N[S-f+7])===null||O===void 0)&&O[b]||!((se=N[S])===null||se===void 0)&&se[b-f+7])}),this.drawCorners(),this._options.image&&await this.drawImage({width:_.width,height:_.height,count:f,dotSize:x})}drawBackground(){var m,f,p;const v=this._element,x=this._options;if(v){const _=(m=x.backgroundOptions)===null||m===void 0?void 0:m.gradient,S=(f=x.backgroundOptions)===null||f===void 0?void 0:f.color;let b=x.height,M=x.width;if(_||S){const I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((p=x.backgroundOptions)===null||p===void 0)&&p.round&&(b=M=Math.min(x.width,x.height),I.setAttribute("rx",String(b/2*x.backgroundOptions.round))),I.setAttribute("x",String(this._roundSize((x.width-M)/2))),I.setAttribute("y",String(this._roundSize((x.height-b)/2))),I.setAttribute("width",String(M)),I.setAttribute("height",String(b)),this._backgroundClipPath.appendChild(I),this._createColor({options:_,color:S,additionalRotation:0,x:0,y:0,height:x.height,width:x.width,name:`background-color-${this._instanceId}`})}}}drawDots(m){var f,p;if(!this._qr)throw"QR code is not defined";const v=this._options,x=this._qr.getModuleCount();if(x>v.width||x>v.height)throw"The canvas is too small.";const _=Math.min(v.width,v.height)-2*v.margin,S=v.shape===A?_/Math.sqrt(2):_,b=this._roundSize(S/x),M=this._roundSize((v.width-x*b)/2),I=this._roundSize((v.height-x*b)/2),F=new d({svg:this._element,type:v.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(f=v.dotsOptions)===null||f===void 0?void 0:f.gradient,color:v.dotsOptions.color,additionalRotation:0,x:0,y:0,height:v.height,width:v.width,name:`dot-color-${this._instanceId}`});for(let ae=0;ae!(O+se<0||ae+ee<0||O+se>=x||ae+ee>=x)&&!(m&&!m(ae+ee,O+se))&&!!this._qr&&this._qr.isDark(ae+ee,O+se)),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element));if(v.shape===A){const ae=this._roundSize((_/b-x)/2),O=x+2*ae,se=M-ae*b,ee=I-ae*b,X=[],Q=this._roundSize(O/2);for(let R=0;R=ae-1&&R<=O-ae&&Z>=ae-1&&Z<=O-ae||Math.sqrt((R-Q)*(R-Q)+(Z-Q)*(Z-Q))>Q?X[R][Z]=0:X[R][Z]=this._qr.isDark(Z-2*ae<0?Z:Z>=x?Z-2*ae:Z-ae,R-2*ae<0?R:R>=x?R-2*ae:R-ae)?1:0}for(let R=0;R{var ie;return!!(!((ie=X[R+le])===null||ie===void 0)&&ie[Z+te])}),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const m=this._element,f=this._options;if(!m)throw"Element code is not defined";const p=this._qr.getModuleCount(),v=Math.min(f.width,f.height)-2*f.margin,x=f.shape===A?v/Math.sqrt(2):v,_=this._roundSize(x/p),S=7*_,b=3*_,M=this._roundSize((f.width-p*_)/2),I=this._roundSize((f.height-p*_)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([F,ae,O])=>{var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me;const Ne=M+F*_*(p-7),Te=I+ae*_*(p-7);let Be=this._dotsClipPath,Ie=this._dotsClipPath;if((!((se=f.cornersSquareOptions)===null||se===void 0)&&se.gradient||!((ee=f.cornersSquareOptions)===null||ee===void 0)&&ee.color)&&(Be=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Be.setAttribute("id",`clip-path-corners-square-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild(Be),this._cornersSquareClipPath=this._cornersDotClipPath=Ie=Be,this._createColor({options:(X=f.cornersSquareOptions)===null||X===void 0?void 0:X.gradient,color:(Q=f.cornersSquareOptions)===null||Q===void 0?void 0:Q.color,additionalRotation:O,x:Ne,y:Te,height:S,width:S,name:`corners-square-color-${F}-${ae}-${this._instanceId}`})),(R=f.cornersSquareOptions)===null||R===void 0?void 0:R.type){const Le=new g({svg:this._element,type:f.cornersSquareOptions.type,window:this._window});Le.draw(Ne,Te,S,O),Le._element&&Be&&Be.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=P[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&Be&&Be.appendChild(Le._element))}if((!((te=f.cornersDotOptions)===null||te===void 0)&&te.gradient||!((le=f.cornersDotOptions)===null||le===void 0)&&le.color)&&(Ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Ie.setAttribute("id",`clip-path-corners-dot-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild(Ie),this._cornersDotClipPath=Ie,this._createColor({options:(ie=f.cornersDotOptions)===null||ie===void 0?void 0:ie.gradient,color:(fe=f.cornersDotOptions)===null||fe===void 0?void 0:fe.color,additionalRotation:O,x:Ne+2*_,y:Te+2*_,height:b,width:b,name:`corners-dot-color-${F}-${ae}-${this._instanceId}`})),(ve=f.cornersDotOptions)===null||ve===void 0?void 0:ve.type){const Le=new y({svg:this._element,type:f.cornersDotOptions.type,window:this._window});Le.draw(Ne+2*_,Te+2*_,b,O),Le._element&&Ie&&Ie.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=N[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&Ie&&Ie.appendChild(Le._element))}})}loadImage(){return new Promise((m,f)=>{var p;const v=this._options;if(!v.image)return f("Image is not defined");if(!((p=v.nodeCanvas)===null||p===void 0)&&p.loadImage)v.nodeCanvas.loadImage(v.image).then(x=>{var _,S;if(this._image=x,this._options.imageOptions.saveAsBlob){const b=(_=v.nodeCanvas)===null||_===void 0?void 0:_.createCanvas(this._image.width,this._image.height);(S=b==null?void 0:b.getContext("2d"))===null||S===void 0||S.drawImage(x,0,0),this._imageUri=b==null?void 0:b.toDataURL()}m()}).catch(f);else{const x=new this._window.Image;typeof v.imageOptions.crossOrigin=="string"&&(x.crossOrigin=v.imageOptions.crossOrigin),this._image=x,x.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await async function(_,S){return new Promise(b=>{const M=new S.XMLHttpRequest;M.onload=function(){const I=new S.FileReader;I.onloadend=function(){b(I.result)},I.readAsDataURL(M.response)},M.open("GET",_),M.responseType="blob",M.send()})}(v.image||"",this._window)),m()},x.src=v.image}})}async drawImage({width:m,height:f,count:p,dotSize:v}){const x=this._options,_=this._roundSize((x.width-p*v)/2),S=this._roundSize((x.height-p*v)/2),b=_+this._roundSize(x.imageOptions.margin+(p*v-m)/2),M=S+this._roundSize(x.imageOptions.margin+(p*v-f)/2),I=m-2*x.imageOptions.margin,F=f-2*x.imageOptions.margin,ae=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");ae.setAttribute("href",this._imageUri||""),ae.setAttribute("x",String(b)),ae.setAttribute("y",String(M)),ae.setAttribute("width",`${I}px`),ae.setAttribute("height",`${F}px`),this._element.appendChild(ae)}_createColor({options:m,color:f,additionalRotation:p,x:v,y:x,height:_,width:S,name:b}){const M=S>_?S:_,I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(I.setAttribute("x",String(v)),I.setAttribute("y",String(x)),I.setAttribute("height",String(_)),I.setAttribute("width",String(S)),I.setAttribute("clip-path",`url('#clip-path-${b}')`),m){let F;if(m.type==="radial")F=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("fx",String(v+S/2)),F.setAttribute("fy",String(x+_/2)),F.setAttribute("cx",String(v+S/2)),F.setAttribute("cy",String(x+_/2)),F.setAttribute("r",String(M/2));else{const ae=((m.rotation||0)+p)%(2*Math.PI),O=(ae+2*Math.PI)%(2*Math.PI);let se=v+S/2,ee=x+_/2,X=v+S/2,Q=x+_/2;O>=0&&O<=.25*Math.PI||O>1.75*Math.PI&&O<=2*Math.PI?(se-=S/2,ee-=_/2*Math.tan(ae),X+=S/2,Q+=_/2*Math.tan(ae)):O>.25*Math.PI&&O<=.75*Math.PI?(ee-=_/2,se-=S/2/Math.tan(ae),Q+=_/2,X+=S/2/Math.tan(ae)):O>.75*Math.PI&&O<=1.25*Math.PI?(se+=S/2,ee+=_/2*Math.tan(ae),X-=S/2,Q-=_/2*Math.tan(ae)):O>1.25*Math.PI&&O<=1.75*Math.PI&&(ee+=_/2,se+=S/2/Math.tan(ae),Q-=_/2,X-=S/2/Math.tan(ae)),F=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("x1",String(Math.round(se))),F.setAttribute("y1",String(Math.round(ee))),F.setAttribute("x2",String(Math.round(X))),F.setAttribute("y2",String(Math.round(Q)))}m.colorStops.forEach(({offset:ae,color:O})=>{const se=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");se.setAttribute("offset",100*ae+"%"),se.setAttribute("stop-color",O),F.appendChild(se)}),I.setAttribute("fill",`url('#${b}')`),this._defs.appendChild(F)}else f&&I.setAttribute("fill",f);this._element.appendChild(I)}}D.instanceCount=0;const k=D,$="canvas",q={};for(let E=0;E<=40;E++)q[E]=E;const U={type:$,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:q[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function K(E){const m=Object.assign({},E);if(!m.colorStops||!m.colorStops.length)throw"Field 'colorStops' is required in gradient";return m.rotation?m.rotation=Number(m.rotation):m.rotation=0,m.colorStops=m.colorStops.map(f=>Object.assign(Object.assign({},f),{offset:Number(f.offset)})),m}function J(E){const m=Object.assign({},E);return m.width=Number(m.width),m.height=Number(m.height),m.margin=Number(m.margin),m.imageOptions=Object.assign(Object.assign({},m.imageOptions),{hideBackgroundDots:!!m.imageOptions.hideBackgroundDots,imageSize:Number(m.imageOptions.imageSize),margin:Number(m.imageOptions.margin)}),m.margin>Math.min(m.width,m.height)&&(m.margin=Math.min(m.width,m.height)),m.dotsOptions=Object.assign({},m.dotsOptions),m.dotsOptions.gradient&&(m.dotsOptions.gradient=K(m.dotsOptions.gradient)),m.cornersSquareOptions&&(m.cornersSquareOptions=Object.assign({},m.cornersSquareOptions),m.cornersSquareOptions.gradient&&(m.cornersSquareOptions.gradient=K(m.cornersSquareOptions.gradient))),m.cornersDotOptions&&(m.cornersDotOptions=Object.assign({},m.cornersDotOptions),m.cornersDotOptions.gradient&&(m.cornersDotOptions.gradient=K(m.cornersDotOptions.gradient))),m.backgroundOptions&&(m.backgroundOptions=Object.assign({},m.backgroundOptions),m.backgroundOptions.gradient&&(m.backgroundOptions.gradient=K(m.backgroundOptions.gradient))),m}var T=i(873),z=i.n(T);function ue(E){if(!E)throw new Error("Extension must be defined");E[0]==="."&&(E=E.substring(1));const m={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[E.toLowerCase()];if(!m)throw new Error(`Extension "${E}" is not supported`);return m}class _e{constructor(m){m!=null&&m.jsdom?this._window=new m.jsdom("",{resources:"usable"}).window:this._window=window,this._options=m?J(a(U,m)):U,this.update()}static _clearContainer(m){m&&(m.innerHTML="")}_setupSvg(){if(!this._qr)return;const m=new k(this._options,this._window);this._svg=m.getElement(),this._svgDrawingPromise=m.drawQR(this._qr).then(()=>{var f;this._svg&&((f=this._extension)===null||f===void 0||f.call(this,m.getElement(),this._options))})}_setupCanvas(){var m,f;this._qr&&(!((m=this._options.nodeCanvas)===null||m===void 0)&&m.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(f=this._svgDrawingPromise)===null||f===void 0?void 0:f.then(()=>{var p;if(!this._svg)return;const v=this._svg,x=new this._window.XMLSerializer().serializeToString(v),_=btoa(x),S=`data:${ue("svg")};base64,${_}`;if(!((p=this._options.nodeCanvas)===null||p===void 0)&&p.loadImage)return this._options.nodeCanvas.loadImage(S).then(b=>{var M,I;b.width=this._options.width,b.height=this._options.height,(I=(M=this._nodeCanvas)===null||M===void 0?void 0:M.getContext("2d"))===null||I===void 0||I.drawImage(b,0,0)});{const b=new this._window.Image;return new Promise(M=>{b.onload=()=>{var I,F;(F=(I=this._domCanvas)===null||I===void 0?void 0:I.getContext("2d"))===null||F===void 0||F.drawImage(b,0,0),M()},b.src=S})}}))}async _getElement(m="png"){if(!this._qr)throw"QR code is empty";return m.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(m){_e._clearContainer(this._container),this._options=m?J(a(this._options,m)):this._options,this._options.data&&(this._qr=z()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(f){switch(!0){case/^[0-9]*$/.test(f):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(f):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===$?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(m){if(m){if(typeof m.appendChild!="function")throw"Container should be a single DOM node";this._options.type===$?this._domCanvas&&m.appendChild(this._domCanvas):this._svg&&m.appendChild(this._svg),this._container=m}}applyExtension(m){if(!m)throw"Extension function should be defined.";this._extension=m,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(m="png"){if(!this._qr)throw"QR code is empty";const f=await this._getElement(m),p=ue(m);if(!f)return null;if(m.toLowerCase()==="svg"){const v=`\r ${new this._window.XMLSerializer().serializeToString(f)}`;return typeof Blob>"u"||this._options.jsdom?Buffer.from(v):new Blob([v],{type:p})}return new Promise(v=>{const x=f;if("toBuffer"in x)if(p==="image/png")v(x.toBuffer(p));else if(p==="image/jpeg")v(x.toBuffer(p));else{if(p!=="application/pdf")throw Error("Unsupported extension");v(x.toBuffer(p))}else"toBlob"in x&&x.toBlob(v,p,1)})}async download(m){if(!this._qr)throw"QR code is empty";if(typeof Blob>"u")throw"Cannot download in Node.js, call getRawData instead.";let f="png",p="qr";typeof m=="string"?(f=m,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):typeof m=="object"&&m!==null&&(m.name&&(p=m.name),m.extension&&(f=m.extension));const v=await this._getElement(f);if(v)if(f.toLowerCase()==="svg"){let x=new XMLSerializer().serializeToString(v);x=`\r `+x,u(`data:${ue(f)};charset=utf-8,${encodeURIComponent(x)}`,`${p}.svg`)}else u(v.toDataURL(ue(f)),`${p}.${f}`)}}const G=_e})(),s.default})())})(b7);var QX=b7.exports;const y7=Ui(QX);class Sa extends yt{constructor(e){const{docsPath:r,field:n,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${n}".`,{docsPath:r,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}function w7(t){if(/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t)||/%[^0-9a-f]/i.test(t)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(t))return!1;const e=eZ(t),r=e[1],n=e[2],i=e[3],s=e[4],o=e[5];if(!(r!=null&&r.length&&i.length>=0))return!1;if(n!=null&&n.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9\+\-\.]*$/.test(r.toLowerCase()))return!1;let a="";return a+=`${r}:`,n!=null&&n.length&&(a+=`//${n}`),a+=i,s!=null&&s.length&&(a+=`?${s}`),o!=null&&o.length&&(a+=`#${o}`),a}function eZ(t){return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}function x7(t){const{chainId:e,domain:r,expirationTime:n,issuedAt:i=new Date,nonce:s,notBefore:o,requestId:a,resources:u,scheme:l,uri:d,version:g}=t;{if(e!==Math.floor(e))throw new Sa({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${e}`]});if(!(tZ.test(r)||rZ.test(r)||nZ.test(r)))throw new Sa({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${r}`]});if(!iZ.test(s))throw new Sa({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${s}`]});if(!w7(d))throw new Sa({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${d}`]});if(g!=="1")throw new Sa({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${g}`]});if(l&&!sZ.test(l))throw new Sa({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${l}`]});const k=t.statement;if(k!=null&&k.includes(` -`))throw new Sa({field:"statement",metaMessages:["- Statement must not include '\\n'.","",`Provided value: ${k}`]})}const y=bw(t.address),A=l?`${l}://${r}`:r,P=t.statement?`${t.statement} +`))throw new Sa({field:"statement",metaMessages:["- Statement must not include '\\n'.","",`Provided value: ${k}`]})}const y=og(t.address),A=l?`${l}://${r}`:r,P=t.statement?`${t.statement} `:"",N=`${A} wants you to sign in with your Ethereum account: ${y} @@ -232,11 +232,11 @@ Not Before: ${o.toISOString()}`),a&&(D+=` Request ID: ${a}`),u){let k=` Resources:`;for(const $ of u){if(!w7($))throw new Sa({field:"resources",metaMessages:["- Every resource must be a RFC 3986 URI.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${$}`]});k+=` - ${$}`}D+=k}return`${N} -${D}`}const tZ=/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/,rZ=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/,nZ=/^localhost(:[0-9]{1,5})?$/,iZ=/^[a-zA-Z0-9]{8,}$/,sZ=/^([a-zA-Z][a-zA-Z0-9+-.]*)$/,_7="7a4434fefbcc9af474fb5c995e47d286",oZ={projectId:_7,metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},aZ={namespaces:{eip155:{methods:["eth_sendTransaction","eth_signTransaction","eth_sign","personal_sign","eth_signTypedData"],chains:["eip155:1"],events:["chainChanged","accountsChanged","disconnect"],rpcMap:{1:`https://rpc.walletconnect.com?chainId=eip155:1&projectId=${_7}`}}},skipPairing:!1};function cZ(t,e){const r=window.location.host,n=window.location.href;return x7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function uZ(t){var ue,_e,G;const e=Pe.useRef(null),{wallet:r,onGetExtension:n,onSignFinish:i}=t,[s,o]=Pe.useState(""),[a,u]=Pe.useState(!1),[l,d]=Pe.useState(""),[g,y]=Pe.useState("scan"),A=Pe.useRef(),[P,N]=Pe.useState((ue=r.config)==null?void 0:ue.image),[D,k]=Pe.useState(!1),{saveLastUsedWallet:$}=Wl();async function q(E){var f,p,v,x;u(!0);const m=await nz.init(oZ);m.session&&await m.disconnect();try{if(y("scan"),m.on("display_uri",ae=>{console.log("display_uri",ae),o(ae),u(!1),y("scan")}),m.on("error",ae=>{console.log(ae)}),m.on("session_update",ae=>{console.log("session_update",ae)}),!await m.connect(aZ))throw new Error("Walletconnect init failed");const S=new Hf(m);N(((f=S.config)==null?void 0:f.image)||((p=E.config)==null?void 0:p.image));const b=await S.getAddress(),M=await ma.getNonce({account_type:"block_chain"});console.log("get nonce",M);const I=cZ(b,M);y("sign");const F=await S.signMessage(I,b);y("waiting"),await i(S,{message:I,nonce:M,signature:F,address:b,wallet_name:((v=S.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),$(S)}catch(_){console.log("err",_),d(_.details||_.message)}}function U(){A.current=new y7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),A.current.append(e.current)}function K(E){var m;console.log(A.current),(m=A.current)==null||m.update({data:E})}Pe.useEffect(()=>{s&&K(s)},[s]),Pe.useEffect(()=>{q(r)},[r]),Pe.useEffect(()=>{U()},[]);function J(){d(""),K(""),q(r)}function T(){k(!0),navigator.clipboard.writeText(s),setTimeout(()=>{k(!1)},2500)}function z(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return me.jsxs("div",{children:[me.jsx("div",{className:"xc-text-center",children:me.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[me.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),me.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?me.jsx(mc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):me.jsx("img",{className:"xc-h-10 xc-w-10",src:P})})]})}),me.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[me.jsx("button",{disabled:!s,onClick:T,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:D?me.jsxs(me.Fragment,{children:[" ",me.jsx(SK,{})," Copied!"]}):me.jsxs(me.Fragment,{children:[me.jsx(MK,{}),"Copy QR URL"]})}),((_e=r.config)==null?void 0:_e.getWallet)&&me.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[me.jsx(AK,{}),"Get Extension"]}),((G=r.config)==null?void 0:G.desktop_link)&&me.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:z,children:[me.jsx(u8,{}),"Desktop"]})]}),me.jsx("div",{className:"xc-text-center",children:l?me.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[me.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),me.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:J,children:"Retry"})]}):me.jsxs(me.Fragment,{children:[g==="scan"&&me.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),g==="connect"&&me.jsx("p",{children:"Click connect in your wallet app"}),g==="sign"&&me.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),g==="waiting"&&me.jsx("div",{className:"xc-text-center",children:me.jsx(mc,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const fZ="Accept connection request in the wallet",lZ="Accept sign-in request in your wallet";function hZ(t,e){const r=window.location.host,n=window.location.href;return x7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function dZ(t){var g;const[e,r]=Pe.useState(),{wallet:n,onSignFinish:i}=t,s=Pe.useRef(),[o,a]=Pe.useState("connect"),{saveLastUsedWallet:u}=Wl();async function l(y){var A;try{a("connect");const P=await n.connect();if(!P||P.length===0)throw new Error("Wallet connect error");const N=hZ(P[0],y);a("sign");const D=await n.signMessage(N,P[0]);if(!D||D.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:P[0],signature:D,message:N,nonce:y,wallet_name:((A=n.config)==null?void 0:A.name)||""}),u(n)}catch(P){console.log(P.details),r(P.details||P.message)}}async function d(){try{r("");const y=await ma.getNonce({account_type:"block_chain"});s.current=y,l(s.current)}catch(y){console.log(y.details),r(y.message)}}return Pe.useEffect(()=>{d()},[]),me.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[me.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(g=n.config)==null?void 0:g.image,alt:""}),e&&me.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[me.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),me.jsx("div",{className:"xc-flex xc-gap-2",children:me.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:d,children:"Retry"})})]}),!e&&me.jsxs(me.Fragment,{children:[o==="connect"&&me.jsx("span",{className:"xc-text-center",children:fZ}),o==="sign"&&me.jsx("span",{className:"xc-text-center",children:lZ}),o==="waiting"&&me.jsx("span",{className:"xc-text-center",children:me.jsx(mc,{className:"xc-animate-spin"})})]})]})}const Ku="https://static.codatta.io/codatta-connect/wallet-icons.svg",pZ="https://itunes.apple.com/app/",gZ="https://play.google.com/store/apps/details?id=",mZ="https://chromewebstore.google.com/detail/",vZ="https://chromewebstore.google.com/detail/",bZ="https://addons.mozilla.org/en-US/firefox/addon/",yZ="https://microsoftedge.microsoft.com/addons/detail/";function Vu(t){const{icon:e,title:r,link:n}=t;return me.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[me.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,me.jsx(c8,{className:"xc-ml-auto xc-text-gray-400"})]})}function wZ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${pZ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${gZ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${mZ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${vZ}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${bZ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${yZ}${t.edge_addon_id}`),e}function xZ(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=wZ(r);return me.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[me.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),me.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),me.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),me.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&me.jsx(Vu,{link:n.chromeStoreLink,icon:`${Ku}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&me.jsx(Vu,{link:n.appStoreLink,icon:`${Ku}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&me.jsx(Vu,{link:n.playStoreLink,icon:`${Ku}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&me.jsx(Vu,{link:n.edgeStoreLink,icon:`${Ku}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&me.jsx(Vu,{link:n.braveStoreLink,icon:`${Ku}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&me.jsx(Vu,{link:n.firefoxStoreLink,icon:`${Ku}#firefox`,title:"Mozilla Firefox"})]})]})}function _Z(t){const{wallet:e}=t,[r,n]=Pe.useState(e.installed?"connect":"qr"),i=Pb();async function s(o,a){var l;const u=await ma.walletLogin({account_type:"block_chain",account_enum:"C",connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return me.jsxs(Ec,{children:[me.jsx("div",{className:"xc-mb-6",children:me.jsx(ah,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&me.jsx(uZ,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&me.jsx(dZ,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&me.jsx(xZ,{wallet:e})]})}function EZ(t){const{wallet:e,onClick:r}=t,n=me.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return me.jsx(_b,{icon:n,title:i,onClick:()=>r(e)})}function SZ(t){const{connector:e}=t,[r,n]=Pe.useState(),[i,s]=Pe.useState([]),o=Pe.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d),console.log(d)}Pe.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return me.jsxs(Ec,{children:[me.jsx("div",{className:"xc-mb-6",children:me.jsx(ah,{title:"Select wallet",onBack:t.onBack})}),me.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[me.jsx(f8,{className:"xc-shrink-0 xc-opacity-50"}),me.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),me.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>me.jsx(EZ,{wallet:d,onClick:l},d.name))})]})}var E7={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,B[H+1]=V>>16&255,B[H+2]=V>>8&255,B[H+3]=V&255,B[H+4]=C>>24&255,B[H+5]=C>>16&255,B[H+6]=C>>8&255,B[H+7]=C&255}function N(B,H,V,C,Y){var j,oe=0;for(j=0;j>>8)-1}function D(B,H,V,C){return N(B,H,V,C,16)}function k(B,H,V,C){return N(B,H,V,C,32)}function $(B,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,j=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,je=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=j,ot=oe,wt=pe,lt=xe,at=Re,Se=De,Ae=it,Ge=je,Ue=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,Ue^=de<<7|de>>>25,de=Ue+at|0,Wt^=de<<9|de>>>23,de=Wt+Ue|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Se|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Se^=de<<13|de>>>19,de=Se+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Ae^=de<<9|de>>>23,de=Ae+wt|0,Xe^=de<<13|de>>>19,de=Xe+Ae|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Se^=de<<7|de>>>25,de=Se+at|0,Ae^=de<<9|de>>>23,de=Ae+Se|0,lt^=de<<13|de>>>19,de=lt+Ae|0,at^=de<<18|de>>>14,de=qe+Ue|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,Ue^=de<<13|de>>>19,de=Ue+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;dt=dt+Y|0,_t=_t+j|0,ot=ot+oe|0,wt=wt+pe|0,lt=lt+xe|0,at=at+Re|0,Se=Se+De|0,Ae=Ae+it|0,Ge=Ge+je|0,Ue=Ue+gt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,B[0]=dt>>>0&255,B[1]=dt>>>8&255,B[2]=dt>>>16&255,B[3]=dt>>>24&255,B[4]=_t>>>0&255,B[5]=_t>>>8&255,B[6]=_t>>>16&255,B[7]=_t>>>24&255,B[8]=ot>>>0&255,B[9]=ot>>>8&255,B[10]=ot>>>16&255,B[11]=ot>>>24&255,B[12]=wt>>>0&255,B[13]=wt>>>8&255,B[14]=wt>>>16&255,B[15]=wt>>>24&255,B[16]=lt>>>0&255,B[17]=lt>>>8&255,B[18]=lt>>>16&255,B[19]=lt>>>24&255,B[20]=at>>>0&255,B[21]=at>>>8&255,B[22]=at>>>16&255,B[23]=at>>>24&255,B[24]=Se>>>0&255,B[25]=Se>>>8&255,B[26]=Se>>>16&255,B[27]=Se>>>24&255,B[28]=Ae>>>0&255,B[29]=Ae>>>8&255,B[30]=Ae>>>16&255,B[31]=Ae>>>24&255,B[32]=Ge>>>0&255,B[33]=Ge>>>8&255,B[34]=Ge>>>16&255,B[35]=Ge>>>24&255,B[36]=Ue>>>0&255,B[37]=Ue>>>8&255,B[38]=Ue>>>16&255,B[39]=Ue>>>24&255,B[40]=qe>>>0&255,B[41]=qe>>>8&255,B[42]=qe>>>16&255,B[43]=qe>>>24&255,B[44]=Xe>>>0&255,B[45]=Xe>>>8&255,B[46]=Xe>>>16&255,B[47]=Xe>>>24&255,B[48]=kt>>>0&255,B[49]=kt>>>8&255,B[50]=kt>>>16&255,B[51]=kt>>>24&255,B[52]=Wt>>>0&255,B[53]=Wt>>>8&255,B[54]=Wt>>>16&255,B[55]=Wt>>>24&255,B[56]=Zt>>>0&255,B[57]=Zt>>>8&255,B[58]=Zt>>>16&255,B[59]=Zt>>>24&255,B[60]=Kt>>>0&255,B[61]=Kt>>>8&255,B[62]=Kt>>>16&255,B[63]=Kt>>>24&255}function q(B,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,j=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,je=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=j,ot=oe,wt=pe,lt=xe,at=Re,Se=De,Ae=it,Ge=je,Ue=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,Ue^=de<<7|de>>>25,de=Ue+at|0,Wt^=de<<9|de>>>23,de=Wt+Ue|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Se|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Se^=de<<13|de>>>19,de=Se+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Ae^=de<<9|de>>>23,de=Ae+wt|0,Xe^=de<<13|de>>>19,de=Xe+Ae|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Se^=de<<7|de>>>25,de=Se+at|0,Ae^=de<<9|de>>>23,de=Ae+Se|0,lt^=de<<13|de>>>19,de=lt+Ae|0,at^=de<<18|de>>>14,de=qe+Ue|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,Ue^=de<<13|de>>>19,de=Ue+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;B[0]=dt>>>0&255,B[1]=dt>>>8&255,B[2]=dt>>>16&255,B[3]=dt>>>24&255,B[4]=at>>>0&255,B[5]=at>>>8&255,B[6]=at>>>16&255,B[7]=at>>>24&255,B[8]=qe>>>0&255,B[9]=qe>>>8&255,B[10]=qe>>>16&255,B[11]=qe>>>24&255,B[12]=Kt>>>0&255,B[13]=Kt>>>8&255,B[14]=Kt>>>16&255,B[15]=Kt>>>24&255,B[16]=Se>>>0&255,B[17]=Se>>>8&255,B[18]=Se>>>16&255,B[19]=Se>>>24&255,B[20]=Ae>>>0&255,B[21]=Ae>>>8&255,B[22]=Ae>>>16&255,B[23]=Ae>>>24&255,B[24]=Ge>>>0&255,B[25]=Ge>>>8&255,B[26]=Ge>>>16&255,B[27]=Ge>>>24&255,B[28]=Ue>>>0&255,B[29]=Ue>>>8&255,B[30]=Ue>>>16&255,B[31]=Ue>>>24&255}function U(B,H,V,C){$(B,H,V,C)}function K(B,H,V,C){q(B,H,V,C)}var J=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T(B,H,V,C,Y,j,oe){var pe=new Uint8Array(16),xe=new Uint8Array(64),Re,De;for(De=0;De<16;De++)pe[De]=0;for(De=0;De<8;De++)pe[De]=j[De];for(;Y>=64;){for(U(xe,pe,oe,J),De=0;De<64;De++)B[H+De]=V[C+De]^xe[De];for(Re=1,De=8;De<16;De++)Re=Re+(pe[De]&255)|0,pe[De]=Re&255,Re>>>=8;Y-=64,H+=64,C+=64}if(Y>0)for(U(xe,pe,oe,J),De=0;De=64;){for(U(oe,j,Y,J),xe=0;xe<64;xe++)B[H+xe]=oe[xe];for(pe=1,xe=8;xe<16;xe++)pe=pe+(j[xe]&255)|0,j[xe]=pe&255,pe>>>=8;V-=64,H+=64}if(V>0)for(U(oe,j,Y,J),xe=0;xe>>13|V<<3)&8191,C=B[4]&255|(B[5]&255)<<8,this.r[2]=(V>>>10|C<<6)&7939,Y=B[6]&255|(B[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,j=B[8]&255|(B[9]&255)<<8,this.r[4]=(Y>>>4|j<<12)&255,this.r[5]=j>>>1&8190,oe=B[10]&255|(B[11]&255)<<8,this.r[6]=(j>>>14|oe<<2)&8191,pe=B[12]&255|(B[13]&255)<<8,this.r[7]=(oe>>>11|pe<<5)&8065,xe=B[14]&255|(B[15]&255)<<8,this.r[8]=(pe>>>8|xe<<8)&8191,this.r[9]=xe>>>5&127,this.pad[0]=B[16]&255|(B[17]&255)<<8,this.pad[1]=B[18]&255|(B[19]&255)<<8,this.pad[2]=B[20]&255|(B[21]&255)<<8,this.pad[3]=B[22]&255|(B[23]&255)<<8,this.pad[4]=B[24]&255|(B[25]&255)<<8,this.pad[5]=B[26]&255|(B[27]&255)<<8,this.pad[6]=B[28]&255|(B[29]&255)<<8,this.pad[7]=B[30]&255|(B[31]&255)<<8};G.prototype.blocks=function(B,H,V){for(var C=this.fin?0:2048,Y,j,oe,pe,xe,Re,De,it,je,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Se=this.h[3],Ae=this.h[4],Ge=this.h[5],Ue=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],de=this.r[3],nr=this.r[4],dr=this.r[5],pr=this.r[6],Qt=this.r[7],gr=this.r[8],lr=this.r[9];V>=16;)Y=B[H+0]&255|(B[H+1]&255)<<8,wt+=Y&8191,j=B[H+2]&255|(B[H+3]&255)<<8,lt+=(Y>>>13|j<<3)&8191,oe=B[H+4]&255|(B[H+5]&255)<<8,at+=(j>>>10|oe<<6)&8191,pe=B[H+6]&255|(B[H+7]&255)<<8,Se+=(oe>>>7|pe<<9)&8191,xe=B[H+8]&255|(B[H+9]&255)<<8,Ae+=(pe>>>4|xe<<12)&8191,Ge+=xe>>>1&8191,Re=B[H+10]&255|(B[H+11]&255)<<8,Ue+=(xe>>>14|Re<<2)&8191,De=B[H+12]&255|(B[H+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=B[H+14]&255|(B[H+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,je=0,gt=je,gt+=wt*Wt,gt+=lt*(5*lr),gt+=at*(5*gr),gt+=Se*(5*Qt),gt+=Ae*(5*pr),je=gt>>>13,gt&=8191,gt+=Ge*(5*dr),gt+=Ue*(5*nr),gt+=qe*(5*de),gt+=Xe*(5*Kt),gt+=kt*(5*Zt),je+=gt>>>13,gt&=8191,st=je,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Se*(5*gr),st+=Ae*(5*Qt),je=st>>>13,st&=8191,st+=Ge*(5*pr),st+=Ue*(5*dr),st+=qe*(5*nr),st+=Xe*(5*de),st+=kt*(5*Kt),je+=st>>>13,st&=8191,tt=je,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Se*(5*lr),tt+=Ae*(5*gr),je=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=Ue*(5*pr),tt+=qe*(5*dr),tt+=Xe*(5*nr),tt+=kt*(5*de),je+=tt>>>13,tt&=8191,At=je,At+=wt*de,At+=lt*Kt,At+=at*Zt,At+=Se*Wt,At+=Ae*(5*lr),je=At>>>13,At&=8191,At+=Ge*(5*gr),At+=Ue*(5*Qt),At+=qe*(5*pr),At+=Xe*(5*dr),At+=kt*(5*nr),je+=At>>>13,At&=8191,Rt=je,Rt+=wt*nr,Rt+=lt*de,Rt+=at*Kt,Rt+=Se*Zt,Rt+=Ae*Wt,je=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=Ue*(5*gr),Rt+=qe*(5*Qt),Rt+=Xe*(5*pr),Rt+=kt*(5*dr),je+=Rt>>>13,Rt&=8191,Mt=je,Mt+=wt*dr,Mt+=lt*nr,Mt+=at*de,Mt+=Se*Kt,Mt+=Ae*Zt,je=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=Ue*(5*lr),Mt+=qe*(5*gr),Mt+=Xe*(5*Qt),Mt+=kt*(5*pr),je+=Mt>>>13,Mt&=8191,Et=je,Et+=wt*pr,Et+=lt*dr,Et+=at*nr,Et+=Se*de,Et+=Ae*Kt,je=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=Ue*Wt,Et+=qe*(5*lr),Et+=Xe*(5*gr),Et+=kt*(5*Qt),je+=Et>>>13,Et&=8191,dt=je,dt+=wt*Qt,dt+=lt*pr,dt+=at*dr,dt+=Se*nr,dt+=Ae*de,je=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=Ue*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*gr),je+=dt>>>13,dt&=8191,_t=je,_t+=wt*gr,_t+=lt*Qt,_t+=at*pr,_t+=Se*dr,_t+=Ae*nr,je=_t>>>13,_t&=8191,_t+=Ge*de,_t+=Ue*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),je+=_t>>>13,_t&=8191,ot=je,ot+=wt*lr,ot+=lt*gr,ot+=at*Qt,ot+=Se*pr,ot+=Ae*dr,je=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=Ue*de,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,je+=ot>>>13,ot&=8191,je=(je<<2)+je|0,je=je+gt|0,gt=je&8191,je=je>>>13,st+=je,wt=gt,lt=st,at=tt,Se=At,Ae=Rt,Ge=Mt,Ue=Et,qe=dt,Xe=_t,kt=ot,H+=16,V-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Se,this.h[4]=Ae,this.h[5]=Ge,this.h[6]=Ue,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},G.prototype.finish=function(B,H){var V=new Uint16Array(10),C,Y,j,oe;if(this.leftover){for(oe=this.leftover,this.buffer[oe++]=1;oe<16;oe++)this.buffer[oe]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,oe=2;oe<10;oe++)this.h[oe]+=C,C=this.h[oe]>>>13,this.h[oe]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,V[0]=this.h[0]+5,C=V[0]>>>13,V[0]&=8191,oe=1;oe<10;oe++)V[oe]=this.h[oe]+C,C=V[oe]>>>13,V[oe]&=8191;for(V[9]-=8192,Y=(C^1)-1,oe=0;oe<10;oe++)V[oe]&=Y;for(Y=~Y,oe=0;oe<10;oe++)this.h[oe]=this.h[oe]&Y|V[oe];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,j=this.h[0]+this.pad[0],this.h[0]=j&65535,oe=1;oe<8;oe++)j=(this.h[oe]+this.pad[oe]|0)+(j>>>16)|0,this.h[oe]=j&65535;B[H+0]=this.h[0]>>>0&255,B[H+1]=this.h[0]>>>8&255,B[H+2]=this.h[1]>>>0&255,B[H+3]=this.h[1]>>>8&255,B[H+4]=this.h[2]>>>0&255,B[H+5]=this.h[2]>>>8&255,B[H+6]=this.h[3]>>>0&255,B[H+7]=this.h[3]>>>8&255,B[H+8]=this.h[4]>>>0&255,B[H+9]=this.h[4]>>>8&255,B[H+10]=this.h[5]>>>0&255,B[H+11]=this.h[5]>>>8&255,B[H+12]=this.h[6]>>>0&255,B[H+13]=this.h[6]>>>8&255,B[H+14]=this.h[7]>>>0&255,B[H+15]=this.h[7]>>>8&255},G.prototype.update=function(B,H,V){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>V&&(Y=V),C=0;C=16&&(Y=V-V%16,this.blocks(B,H,Y),H+=Y,V-=Y),V){for(C=0;C>16&1),j[V-1]&=65535;j[15]=oe[15]-32767-(j[14]>>16&1),Y=j[15]>>16&1,j[14]&=65535,_(oe,j,1-Y)}for(V=0;V<16;V++)B[2*V]=oe[V]&255,B[2*V+1]=oe[V]>>8}function b(B,H){var V=new Uint8Array(32),C=new Uint8Array(32);return S(V,B),S(C,H),k(V,0,C,0)}function M(B){var H=new Uint8Array(32);return S(H,B),H[0]&1}function I(B,H){var V;for(V=0;V<16;V++)B[V]=H[2*V]+(H[2*V+1]<<8);B[15]&=32767}function F(B,H,V){for(var C=0;C<16;C++)B[C]=H[C]+V[C]}function ae(B,H,V){for(var C=0;C<16;C++)B[C]=H[C]-V[C]}function O(B,H,V){var C,Y,j=0,oe=0,pe=0,xe=0,Re=0,De=0,it=0,je=0,gt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Se=0,Ae=0,Ge=0,Ue=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,de=V[0],nr=V[1],dr=V[2],pr=V[3],Qt=V[4],gr=V[5],lr=V[6],Lr=V[7],mr=V[8],wr=V[9],$r=V[10],Br=V[11],Ir=V[12],hn=V[13],dn=V[14],pn=V[15];C=H[0],j+=C*de,oe+=C*nr,pe+=C*dr,xe+=C*pr,Re+=C*Qt,De+=C*gr,it+=C*lr,je+=C*Lr,gt+=C*mr,st+=C*wr,tt+=C*$r,At+=C*Br,Rt+=C*Ir,Mt+=C*hn,Et+=C*dn,dt+=C*pn,C=H[1],oe+=C*de,pe+=C*nr,xe+=C*dr,Re+=C*pr,De+=C*Qt,it+=C*gr,je+=C*lr,gt+=C*Lr,st+=C*mr,tt+=C*wr,At+=C*$r,Rt+=C*Br,Mt+=C*Ir,Et+=C*hn,dt+=C*dn,_t+=C*pn,C=H[2],pe+=C*de,xe+=C*nr,Re+=C*dr,De+=C*pr,it+=C*Qt,je+=C*gr,gt+=C*lr,st+=C*Lr,tt+=C*mr,At+=C*wr,Rt+=C*$r,Mt+=C*Br,Et+=C*Ir,dt+=C*hn,_t+=C*dn,ot+=C*pn,C=H[3],xe+=C*de,Re+=C*nr,De+=C*dr,it+=C*pr,je+=C*Qt,gt+=C*gr,st+=C*lr,tt+=C*Lr,At+=C*mr,Rt+=C*wr,Mt+=C*$r,Et+=C*Br,dt+=C*Ir,_t+=C*hn,ot+=C*dn,wt+=C*pn,C=H[4],Re+=C*de,De+=C*nr,it+=C*dr,je+=C*pr,gt+=C*Qt,st+=C*gr,tt+=C*lr,At+=C*Lr,Rt+=C*mr,Mt+=C*wr,Et+=C*$r,dt+=C*Br,_t+=C*Ir,ot+=C*hn,wt+=C*dn,lt+=C*pn,C=H[5],De+=C*de,it+=C*nr,je+=C*dr,gt+=C*pr,st+=C*Qt,tt+=C*gr,At+=C*lr,Rt+=C*Lr,Mt+=C*mr,Et+=C*wr,dt+=C*$r,_t+=C*Br,ot+=C*Ir,wt+=C*hn,lt+=C*dn,at+=C*pn,C=H[6],it+=C*de,je+=C*nr,gt+=C*dr,st+=C*pr,tt+=C*Qt,At+=C*gr,Rt+=C*lr,Mt+=C*Lr,Et+=C*mr,dt+=C*wr,_t+=C*$r,ot+=C*Br,wt+=C*Ir,lt+=C*hn,at+=C*dn,Se+=C*pn,C=H[7],je+=C*de,gt+=C*nr,st+=C*dr,tt+=C*pr,At+=C*Qt,Rt+=C*gr,Mt+=C*lr,Et+=C*Lr,dt+=C*mr,_t+=C*wr,ot+=C*$r,wt+=C*Br,lt+=C*Ir,at+=C*hn,Se+=C*dn,Ae+=C*pn,C=H[8],gt+=C*de,st+=C*nr,tt+=C*dr,At+=C*pr,Rt+=C*Qt,Mt+=C*gr,Et+=C*lr,dt+=C*Lr,_t+=C*mr,ot+=C*wr,wt+=C*$r,lt+=C*Br,at+=C*Ir,Se+=C*hn,Ae+=C*dn,Ge+=C*pn,C=H[9],st+=C*de,tt+=C*nr,At+=C*dr,Rt+=C*pr,Mt+=C*Qt,Et+=C*gr,dt+=C*lr,_t+=C*Lr,ot+=C*mr,wt+=C*wr,lt+=C*$r,at+=C*Br,Se+=C*Ir,Ae+=C*hn,Ge+=C*dn,Ue+=C*pn,C=H[10],tt+=C*de,At+=C*nr,Rt+=C*dr,Mt+=C*pr,Et+=C*Qt,dt+=C*gr,_t+=C*lr,ot+=C*Lr,wt+=C*mr,lt+=C*wr,at+=C*$r,Se+=C*Br,Ae+=C*Ir,Ge+=C*hn,Ue+=C*dn,qe+=C*pn,C=H[11],At+=C*de,Rt+=C*nr,Mt+=C*dr,Et+=C*pr,dt+=C*Qt,_t+=C*gr,ot+=C*lr,wt+=C*Lr,lt+=C*mr,at+=C*wr,Se+=C*$r,Ae+=C*Br,Ge+=C*Ir,Ue+=C*hn,qe+=C*dn,Xe+=C*pn,C=H[12],Rt+=C*de,Mt+=C*nr,Et+=C*dr,dt+=C*pr,_t+=C*Qt,ot+=C*gr,wt+=C*lr,lt+=C*Lr,at+=C*mr,Se+=C*wr,Ae+=C*$r,Ge+=C*Br,Ue+=C*Ir,qe+=C*hn,Xe+=C*dn,kt+=C*pn,C=H[13],Mt+=C*de,Et+=C*nr,dt+=C*dr,_t+=C*pr,ot+=C*Qt,wt+=C*gr,lt+=C*lr,at+=C*Lr,Se+=C*mr,Ae+=C*wr,Ge+=C*$r,Ue+=C*Br,qe+=C*Ir,Xe+=C*hn,kt+=C*dn,Wt+=C*pn,C=H[14],Et+=C*de,dt+=C*nr,_t+=C*dr,ot+=C*pr,wt+=C*Qt,lt+=C*gr,at+=C*lr,Se+=C*Lr,Ae+=C*mr,Ge+=C*wr,Ue+=C*$r,qe+=C*Br,Xe+=C*Ir,kt+=C*hn,Wt+=C*dn,Zt+=C*pn,C=H[15],dt+=C*de,_t+=C*nr,ot+=C*dr,wt+=C*pr,lt+=C*Qt,at+=C*gr,Se+=C*lr,Ae+=C*Lr,Ge+=C*mr,Ue+=C*wr,qe+=C*$r,Xe+=C*Br,kt+=C*Ir,Wt+=C*hn,Zt+=C*dn,Kt+=C*pn,j+=38*_t,oe+=38*ot,pe+=38*wt,xe+=38*lt,Re+=38*at,De+=38*Se,it+=38*Ae,je+=38*Ge,gt+=38*Ue,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=j+Y+65535,Y=Math.floor(C/65536),j=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=je+Y+65535,Y=Math.floor(C/65536),je=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,j+=Y-1+37*(Y-1),Y=1,C=j+Y+65535,Y=Math.floor(C/65536),j=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=je+Y+65535,Y=Math.floor(C/65536),je=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,j+=Y-1+37*(Y-1),B[0]=j,B[1]=oe,B[2]=pe,B[3]=xe,B[4]=Re,B[5]=De,B[6]=it,B[7]=je,B[8]=gt,B[9]=st,B[10]=tt,B[11]=At,B[12]=Rt,B[13]=Mt,B[14]=Et,B[15]=dt}function se(B,H){O(B,H,H)}function ee(B,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=253;C>=0;C--)se(V,V),C!==2&&C!==4&&O(V,V,H);for(C=0;C<16;C++)B[C]=V[C]}function X(B,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=250;C>=0;C--)se(V,V),C!==1&&O(V,V,H);for(C=0;C<16;C++)B[C]=V[C]}function Q(B,H,V){var C=new Uint8Array(32),Y=new Float64Array(80),j,oe,pe=r(),xe=r(),Re=r(),De=r(),it=r(),je=r();for(oe=0;oe<31;oe++)C[oe]=H[oe];for(C[31]=H[31]&127|64,C[0]&=248,I(Y,V),oe=0;oe<16;oe++)xe[oe]=Y[oe],De[oe]=pe[oe]=Re[oe]=0;for(pe[0]=De[0]=1,oe=254;oe>=0;--oe)j=C[oe>>>3]>>>(oe&7)&1,_(pe,xe,j),_(Re,De,j),F(it,pe,Re),ae(pe,pe,Re),F(Re,xe,De),ae(xe,xe,De),se(De,it),se(je,pe),O(pe,Re,pe),O(Re,xe,it),F(it,pe,Re),ae(pe,pe,Re),se(xe,pe),ae(Re,De,je),O(pe,Re,u),F(pe,pe,De),O(Re,Re,pe),O(pe,De,je),O(De,xe,Y),se(xe,it),_(pe,xe,j),_(Re,De,j);for(oe=0;oe<16;oe++)Y[oe+16]=pe[oe],Y[oe+32]=Re[oe],Y[oe+48]=xe[oe],Y[oe+64]=De[oe];var gt=Y.subarray(32),st=Y.subarray(16);return ee(gt,gt),O(st,st,gt),S(B,st),0}function R(B,H){return Q(B,H,s)}function Z(B,H){return n(H,32),R(B,H)}function te(B,H,V){var C=new Uint8Array(32);return Q(C,V,H),K(B,i,C,J)}var le=f,ie=p;function fe(B,H,V,C,Y,j){var oe=new Uint8Array(32);return te(oe,Y,j),le(B,H,V,C,oe)}function ve(B,H,V,C,Y,j){var oe=new Uint8Array(32);return te(oe,Y,j),ie(B,H,V,C,oe)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne(B,H,V,C){for(var Y=new Int32Array(16),j=new Int32Array(16),oe,pe,xe,Re,De,it,je,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Se,Ae,Ge,Ue,qe,Xe,kt=B[0],Wt=B[1],Zt=B[2],Kt=B[3],de=B[4],nr=B[5],dr=B[6],pr=B[7],Qt=H[0],gr=H[1],lr=H[2],Lr=H[3],mr=H[4],wr=H[5],$r=H[6],Br=H[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=V[at+0]<<24|V[at+1]<<16|V[at+2]<<8|V[at+3],j[lt]=V[at+4]<<24|V[at+5]<<16|V[at+6]<<8|V[at+7];for(lt=0;lt<80;lt++)if(oe=kt,pe=Wt,xe=Zt,Re=Kt,De=de,it=nr,je=dr,gt=pr,st=Qt,tt=gr,At=lr,Rt=Lr,Mt=mr,Et=wr,dt=$r,_t=Br,Se=pr,Ae=Br,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=(de>>>14|mr<<18)^(de>>>18|mr<<14)^(mr>>>9|de<<23),Ae=(mr>>>14|de<<18)^(mr>>>18|de<<14)^(de>>>9|mr<<23),Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Se=de&nr^~de&dr,Ae=mr&wr^~mr&$r,Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Se=Me[lt*2],Ae=Me[lt*2+1],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Se=Y[lt%16],Ae=j[lt%16],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|Ue<<16,Se=ot,Ae=wt,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Ae=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Se=kt&Wt^kt&Zt^Wt&Zt,Ae=Qt&gr^Qt&lr^gr&lr,Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,gt=qe&65535|Xe<<16,_t=Ge&65535|Ue<<16,Se=Re,Ae=Rt,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=ot,Ae=wt,Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|Ue<<16,Wt=oe,Zt=pe,Kt=xe,de=Re,nr=De,dr=it,pr=je,kt=gt,gr=st,lr=tt,Lr=At,mr=Rt,wr=Mt,$r=Et,Br=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Se=Y[at],Ae=j[at],Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=Y[(at+9)%16],Ae=j[(at+9)%16],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,ot=Y[(at+1)%16],wt=j[(at+1)%16],Se=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Ae=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,ot=Y[(at+14)%16],wt=j[(at+14)%16],Se=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Ae=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,j[at]=Ge&65535|Ue<<16;Se=kt,Ae=Qt,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[0],Ae=H[0],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[0]=kt=qe&65535|Xe<<16,H[0]=Qt=Ge&65535|Ue<<16,Se=Wt,Ae=gr,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[1],Ae=H[1],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[1]=Wt=qe&65535|Xe<<16,H[1]=gr=Ge&65535|Ue<<16,Se=Zt,Ae=lr,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[2],Ae=H[2],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[2]=Zt=qe&65535|Xe<<16,H[2]=lr=Ge&65535|Ue<<16,Se=Kt,Ae=Lr,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[3],Ae=H[3],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[3]=Kt=qe&65535|Xe<<16,H[3]=Lr=Ge&65535|Ue<<16,Se=de,Ae=mr,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[4],Ae=H[4],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[4]=de=qe&65535|Xe<<16,H[4]=mr=Ge&65535|Ue<<16,Se=nr,Ae=wr,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[5],Ae=H[5],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[5]=nr=qe&65535|Xe<<16,H[5]=wr=Ge&65535|Ue<<16,Se=dr,Ae=$r,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[6],Ae=H[6],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[6]=dr=qe&65535|Xe<<16,H[6]=$r=Ge&65535|Ue<<16,Se=pr,Ae=Br,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[7],Ae=H[7],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[7]=pr=qe&65535|Xe<<16,H[7]=Br=Ge&65535|Ue<<16,Ir+=128,C-=128}return C}function Te(B,H,V){var C=new Int32Array(8),Y=new Int32Array(8),j=new Uint8Array(256),oe,pe=V;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,H,V),V%=128,oe=0;oe=0;--Y)C=V[Y/8|0]>>(Y&7)&1,Ie(B,H,C),Be(H,B),Be(B,B),Ie(B,H,C)}function ke(B,H){var V=[r(),r(),r(),r()];v(V[0],g),v(V[1],y),v(V[2],a),O(V[3],g,y),Ve(B,V,H)}function ze(B,H,V){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],j;for(V||n(H,32),Te(C,H,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le(B,Y),j=0;j<32;j++)H[j+32]=B[j];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Ee(B,H){var V,C,Y,j;for(C=63;C>=32;--C){for(V=0,Y=C-32,j=C-12;Y>4)*He[Y],V=H[Y]>>8,H[Y]&=255;for(Y=0;Y<32;Y++)H[Y]-=V*He[Y];for(C=0;C<32;C++)H[C+1]+=H[C]>>8,B[C]=H[C]&255}function Qe(B){var H=new Float64Array(64),V;for(V=0;V<64;V++)H[V]=B[V];for(V=0;V<64;V++)B[V]=0;Ee(B,H)}function ct(B,H,V,C){var Y=new Uint8Array(64),j=new Uint8Array(64),oe=new Uint8Array(64),pe,xe,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=V+64;for(pe=0;pe>7&&ae(B[0],o,B[0]),O(B[3],B[0],B[1]),0)}function et(B,H,V,C){var Y,j=new Uint8Array(32),oe=new Uint8Array(64),pe=[r(),r(),r(),r()],xe=[r(),r(),r(),r()];if(V<64||$e(xe,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var B=new Uint8Array(vt),H=new Uint8Array(Dt);return ze(B,H),{publicKey:B,secretKey:H}},e.sign.keyPair.fromSecretKey=function(B){if(nt(B),B.length!==Dt)throw new Error("bad secret key size");for(var H=new Uint8Array(vt),V=0;V=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function Mb(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function G0(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{console.log("display_uri",ae),o(ae),u(!1),y("scan")}),m.on("error",ae=>{console.log(ae)}),m.on("session_update",ae=>{console.log("session_update",ae)}),!await m.connect(aZ))throw new Error("Walletconnect init failed");const S=new Hf(m);N(((f=S.config)==null?void 0:f.image)||((p=E.config)==null?void 0:p.image));const b=await S.getAddress(),M=await ma.getNonce({account_type:"block_chain"});console.log("get nonce",M);const I=cZ(b,M);y("sign");const F=await S.signMessage(I,b);y("waiting"),await i(S,{message:I,nonce:M,signature:F,address:b,wallet_name:((v=S.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),$(S)}catch(_){console.log("err",_),d(_.details||_.message)}}function U(){A.current=new y7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),A.current.append(e.current)}function K(E){var m;console.log(A.current),(m=A.current)==null||m.update({data:E})}Pe.useEffect(()=>{s&&K(s)},[s]),Pe.useEffect(()=>{q(r)},[r]),Pe.useEffect(()=>{U()},[]);function J(){d(""),K(""),q(r)}function T(){k(!0),navigator.clipboard.writeText(s),setTimeout(()=>{k(!1)},2500)}function z(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return me.jsxs("div",{children:[me.jsx("div",{className:"xc-text-center",children:me.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[me.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),me.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?me.jsx(mc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):me.jsx("img",{className:"xc-h-10 xc-w-10",src:P})})]})}),me.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[me.jsx("button",{disabled:!s,onClick:T,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:D?me.jsxs(me.Fragment,{children:[" ",me.jsx(SK,{})," Copied!"]}):me.jsxs(me.Fragment,{children:[me.jsx(MK,{}),"Copy QR URL"]})}),((_e=r.config)==null?void 0:_e.getWallet)&&me.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[me.jsx(AK,{}),"Get Extension"]}),((G=r.config)==null?void 0:G.desktop_link)&&me.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:z,children:[me.jsx(u8,{}),"Desktop"]})]}),me.jsx("div",{className:"xc-text-center",children:l?me.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[me.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),me.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:J,children:"Retry"})]}):me.jsxs(me.Fragment,{children:[g==="scan"&&me.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),g==="connect"&&me.jsx("p",{children:"Click connect in your wallet app"}),g==="sign"&&me.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),g==="waiting"&&me.jsx("div",{className:"xc-text-center",children:me.jsx(mc,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const fZ="Accept connection request in the wallet",lZ="Accept sign-in request in your wallet";function hZ(t,e){const r=window.location.host,n=window.location.href;return x7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function dZ(t){var g;const[e,r]=Pe.useState(),{wallet:n,onSignFinish:i}=t,s=Pe.useRef(),[o,a]=Pe.useState("connect"),{saveLastUsedWallet:u}=Wl();async function l(y){var A;try{a("connect");const P=await n.connect();if(!P||P.length===0)throw new Error("Wallet connect error");const N=og(P[0]),D=hZ(N,y);a("sign");const k=await n.signMessage(D,N);if(!k||k.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:N,signature:k,message:D,nonce:y,wallet_name:((A=n.config)==null?void 0:A.name)||""}),u(n)}catch(P){console.log(P.details),r(P.details||P.message)}}async function d(){try{r("");const y=await ma.getNonce({account_type:"block_chain"});s.current=y,l(s.current)}catch(y){console.log(y.details),r(y.message)}}return Pe.useEffect(()=>{d()},[]),me.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[me.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(g=n.config)==null?void 0:g.image,alt:""}),e&&me.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[me.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),me.jsx("div",{className:"xc-flex xc-gap-2",children:me.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:d,children:"Retry"})})]}),!e&&me.jsxs(me.Fragment,{children:[o==="connect"&&me.jsx("span",{className:"xc-text-center",children:fZ}),o==="sign"&&me.jsx("span",{className:"xc-text-center",children:lZ}),o==="waiting"&&me.jsx("span",{className:"xc-text-center",children:me.jsx(mc,{className:"xc-animate-spin"})})]})]})}const Ku="https://static.codatta.io/codatta-connect/wallet-icons.svg",pZ="https://itunes.apple.com/app/",gZ="https://play.google.com/store/apps/details?id=",mZ="https://chromewebstore.google.com/detail/",vZ="https://chromewebstore.google.com/detail/",bZ="https://addons.mozilla.org/en-US/firefox/addon/",yZ="https://microsoftedge.microsoft.com/addons/detail/";function Vu(t){const{icon:e,title:r,link:n}=t;return me.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[me.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,me.jsx(c8,{className:"xc-ml-auto xc-text-gray-400"})]})}function wZ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${pZ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${gZ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${mZ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${vZ}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${bZ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${yZ}${t.edge_addon_id}`),e}function xZ(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=wZ(r);return me.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[me.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),me.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),me.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),me.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&me.jsx(Vu,{link:n.chromeStoreLink,icon:`${Ku}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&me.jsx(Vu,{link:n.appStoreLink,icon:`${Ku}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&me.jsx(Vu,{link:n.playStoreLink,icon:`${Ku}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&me.jsx(Vu,{link:n.edgeStoreLink,icon:`${Ku}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&me.jsx(Vu,{link:n.braveStoreLink,icon:`${Ku}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&me.jsx(Vu,{link:n.firefoxStoreLink,icon:`${Ku}#firefox`,title:"Mozilla Firefox"})]})]})}function _Z(t){const{wallet:e}=t,[r,n]=Pe.useState(e.installed?"connect":"qr"),i=Mb();async function s(o,a){var l;const u=await ma.walletLogin({account_type:"block_chain",account_enum:"C",connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return me.jsxs(Ec,{children:[me.jsx("div",{className:"xc-mb-6",children:me.jsx(ah,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&me.jsx(uZ,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&me.jsx(dZ,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&me.jsx(xZ,{wallet:e})]})}function EZ(t){const{wallet:e,onClick:r}=t,n=me.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return me.jsx(Eb,{icon:n,title:i,onClick:()=>r(e)})}function SZ(t){const{connector:e}=t,[r,n]=Pe.useState(),[i,s]=Pe.useState([]),o=Pe.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d),console.log(d)}Pe.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return me.jsxs(Ec,{children:[me.jsx("div",{className:"xc-mb-6",children:me.jsx(ah,{title:"Select wallet",onBack:t.onBack})}),me.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[me.jsx(f8,{className:"xc-shrink-0 xc-opacity-50"}),me.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),me.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>me.jsx(EZ,{wallet:d,onClick:l},d.name))})]})}var E7={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,B[H+1]=V>>16&255,B[H+2]=V>>8&255,B[H+3]=V&255,B[H+4]=C>>24&255,B[H+5]=C>>16&255,B[H+6]=C>>8&255,B[H+7]=C&255}function N(B,H,V,C,Y){var j,oe=0;for(j=0;j>>8)-1}function D(B,H,V,C){return N(B,H,V,C,16)}function k(B,H,V,C){return N(B,H,V,C,32)}function $(B,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,j=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,je=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=j,ot=oe,wt=pe,lt=xe,at=Re,Se=De,Ae=it,Ge=je,Ue=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,Ue^=de<<7|de>>>25,de=Ue+at|0,Wt^=de<<9|de>>>23,de=Wt+Ue|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Se|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Se^=de<<13|de>>>19,de=Se+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Ae^=de<<9|de>>>23,de=Ae+wt|0,Xe^=de<<13|de>>>19,de=Xe+Ae|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Se^=de<<7|de>>>25,de=Se+at|0,Ae^=de<<9|de>>>23,de=Ae+Se|0,lt^=de<<13|de>>>19,de=lt+Ae|0,at^=de<<18|de>>>14,de=qe+Ue|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,Ue^=de<<13|de>>>19,de=Ue+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;dt=dt+Y|0,_t=_t+j|0,ot=ot+oe|0,wt=wt+pe|0,lt=lt+xe|0,at=at+Re|0,Se=Se+De|0,Ae=Ae+it|0,Ge=Ge+je|0,Ue=Ue+gt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,B[0]=dt>>>0&255,B[1]=dt>>>8&255,B[2]=dt>>>16&255,B[3]=dt>>>24&255,B[4]=_t>>>0&255,B[5]=_t>>>8&255,B[6]=_t>>>16&255,B[7]=_t>>>24&255,B[8]=ot>>>0&255,B[9]=ot>>>8&255,B[10]=ot>>>16&255,B[11]=ot>>>24&255,B[12]=wt>>>0&255,B[13]=wt>>>8&255,B[14]=wt>>>16&255,B[15]=wt>>>24&255,B[16]=lt>>>0&255,B[17]=lt>>>8&255,B[18]=lt>>>16&255,B[19]=lt>>>24&255,B[20]=at>>>0&255,B[21]=at>>>8&255,B[22]=at>>>16&255,B[23]=at>>>24&255,B[24]=Se>>>0&255,B[25]=Se>>>8&255,B[26]=Se>>>16&255,B[27]=Se>>>24&255,B[28]=Ae>>>0&255,B[29]=Ae>>>8&255,B[30]=Ae>>>16&255,B[31]=Ae>>>24&255,B[32]=Ge>>>0&255,B[33]=Ge>>>8&255,B[34]=Ge>>>16&255,B[35]=Ge>>>24&255,B[36]=Ue>>>0&255,B[37]=Ue>>>8&255,B[38]=Ue>>>16&255,B[39]=Ue>>>24&255,B[40]=qe>>>0&255,B[41]=qe>>>8&255,B[42]=qe>>>16&255,B[43]=qe>>>24&255,B[44]=Xe>>>0&255,B[45]=Xe>>>8&255,B[46]=Xe>>>16&255,B[47]=Xe>>>24&255,B[48]=kt>>>0&255,B[49]=kt>>>8&255,B[50]=kt>>>16&255,B[51]=kt>>>24&255,B[52]=Wt>>>0&255,B[53]=Wt>>>8&255,B[54]=Wt>>>16&255,B[55]=Wt>>>24&255,B[56]=Zt>>>0&255,B[57]=Zt>>>8&255,B[58]=Zt>>>16&255,B[59]=Zt>>>24&255,B[60]=Kt>>>0&255,B[61]=Kt>>>8&255,B[62]=Kt>>>16&255,B[63]=Kt>>>24&255}function q(B,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,j=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,je=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=j,ot=oe,wt=pe,lt=xe,at=Re,Se=De,Ae=it,Ge=je,Ue=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,Ue^=de<<7|de>>>25,de=Ue+at|0,Wt^=de<<9|de>>>23,de=Wt+Ue|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Se|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Se^=de<<13|de>>>19,de=Se+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Ae^=de<<9|de>>>23,de=Ae+wt|0,Xe^=de<<13|de>>>19,de=Xe+Ae|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Se^=de<<7|de>>>25,de=Se+at|0,Ae^=de<<9|de>>>23,de=Ae+Se|0,lt^=de<<13|de>>>19,de=lt+Ae|0,at^=de<<18|de>>>14,de=qe+Ue|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,Ue^=de<<13|de>>>19,de=Ue+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;B[0]=dt>>>0&255,B[1]=dt>>>8&255,B[2]=dt>>>16&255,B[3]=dt>>>24&255,B[4]=at>>>0&255,B[5]=at>>>8&255,B[6]=at>>>16&255,B[7]=at>>>24&255,B[8]=qe>>>0&255,B[9]=qe>>>8&255,B[10]=qe>>>16&255,B[11]=qe>>>24&255,B[12]=Kt>>>0&255,B[13]=Kt>>>8&255,B[14]=Kt>>>16&255,B[15]=Kt>>>24&255,B[16]=Se>>>0&255,B[17]=Se>>>8&255,B[18]=Se>>>16&255,B[19]=Se>>>24&255,B[20]=Ae>>>0&255,B[21]=Ae>>>8&255,B[22]=Ae>>>16&255,B[23]=Ae>>>24&255,B[24]=Ge>>>0&255,B[25]=Ge>>>8&255,B[26]=Ge>>>16&255,B[27]=Ge>>>24&255,B[28]=Ue>>>0&255,B[29]=Ue>>>8&255,B[30]=Ue>>>16&255,B[31]=Ue>>>24&255}function U(B,H,V,C){$(B,H,V,C)}function K(B,H,V,C){q(B,H,V,C)}var J=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T(B,H,V,C,Y,j,oe){var pe=new Uint8Array(16),xe=new Uint8Array(64),Re,De;for(De=0;De<16;De++)pe[De]=0;for(De=0;De<8;De++)pe[De]=j[De];for(;Y>=64;){for(U(xe,pe,oe,J),De=0;De<64;De++)B[H+De]=V[C+De]^xe[De];for(Re=1,De=8;De<16;De++)Re=Re+(pe[De]&255)|0,pe[De]=Re&255,Re>>>=8;Y-=64,H+=64,C+=64}if(Y>0)for(U(xe,pe,oe,J),De=0;De=64;){for(U(oe,j,Y,J),xe=0;xe<64;xe++)B[H+xe]=oe[xe];for(pe=1,xe=8;xe<16;xe++)pe=pe+(j[xe]&255)|0,j[xe]=pe&255,pe>>>=8;V-=64,H+=64}if(V>0)for(U(oe,j,Y,J),xe=0;xe>>13|V<<3)&8191,C=B[4]&255|(B[5]&255)<<8,this.r[2]=(V>>>10|C<<6)&7939,Y=B[6]&255|(B[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,j=B[8]&255|(B[9]&255)<<8,this.r[4]=(Y>>>4|j<<12)&255,this.r[5]=j>>>1&8190,oe=B[10]&255|(B[11]&255)<<8,this.r[6]=(j>>>14|oe<<2)&8191,pe=B[12]&255|(B[13]&255)<<8,this.r[7]=(oe>>>11|pe<<5)&8065,xe=B[14]&255|(B[15]&255)<<8,this.r[8]=(pe>>>8|xe<<8)&8191,this.r[9]=xe>>>5&127,this.pad[0]=B[16]&255|(B[17]&255)<<8,this.pad[1]=B[18]&255|(B[19]&255)<<8,this.pad[2]=B[20]&255|(B[21]&255)<<8,this.pad[3]=B[22]&255|(B[23]&255)<<8,this.pad[4]=B[24]&255|(B[25]&255)<<8,this.pad[5]=B[26]&255|(B[27]&255)<<8,this.pad[6]=B[28]&255|(B[29]&255)<<8,this.pad[7]=B[30]&255|(B[31]&255)<<8};G.prototype.blocks=function(B,H,V){for(var C=this.fin?0:2048,Y,j,oe,pe,xe,Re,De,it,je,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Se=this.h[3],Ae=this.h[4],Ge=this.h[5],Ue=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],de=this.r[3],nr=this.r[4],dr=this.r[5],pr=this.r[6],Qt=this.r[7],gr=this.r[8],lr=this.r[9];V>=16;)Y=B[H+0]&255|(B[H+1]&255)<<8,wt+=Y&8191,j=B[H+2]&255|(B[H+3]&255)<<8,lt+=(Y>>>13|j<<3)&8191,oe=B[H+4]&255|(B[H+5]&255)<<8,at+=(j>>>10|oe<<6)&8191,pe=B[H+6]&255|(B[H+7]&255)<<8,Se+=(oe>>>7|pe<<9)&8191,xe=B[H+8]&255|(B[H+9]&255)<<8,Ae+=(pe>>>4|xe<<12)&8191,Ge+=xe>>>1&8191,Re=B[H+10]&255|(B[H+11]&255)<<8,Ue+=(xe>>>14|Re<<2)&8191,De=B[H+12]&255|(B[H+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=B[H+14]&255|(B[H+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,je=0,gt=je,gt+=wt*Wt,gt+=lt*(5*lr),gt+=at*(5*gr),gt+=Se*(5*Qt),gt+=Ae*(5*pr),je=gt>>>13,gt&=8191,gt+=Ge*(5*dr),gt+=Ue*(5*nr),gt+=qe*(5*de),gt+=Xe*(5*Kt),gt+=kt*(5*Zt),je+=gt>>>13,gt&=8191,st=je,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Se*(5*gr),st+=Ae*(5*Qt),je=st>>>13,st&=8191,st+=Ge*(5*pr),st+=Ue*(5*dr),st+=qe*(5*nr),st+=Xe*(5*de),st+=kt*(5*Kt),je+=st>>>13,st&=8191,tt=je,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Se*(5*lr),tt+=Ae*(5*gr),je=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=Ue*(5*pr),tt+=qe*(5*dr),tt+=Xe*(5*nr),tt+=kt*(5*de),je+=tt>>>13,tt&=8191,At=je,At+=wt*de,At+=lt*Kt,At+=at*Zt,At+=Se*Wt,At+=Ae*(5*lr),je=At>>>13,At&=8191,At+=Ge*(5*gr),At+=Ue*(5*Qt),At+=qe*(5*pr),At+=Xe*(5*dr),At+=kt*(5*nr),je+=At>>>13,At&=8191,Rt=je,Rt+=wt*nr,Rt+=lt*de,Rt+=at*Kt,Rt+=Se*Zt,Rt+=Ae*Wt,je=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=Ue*(5*gr),Rt+=qe*(5*Qt),Rt+=Xe*(5*pr),Rt+=kt*(5*dr),je+=Rt>>>13,Rt&=8191,Mt=je,Mt+=wt*dr,Mt+=lt*nr,Mt+=at*de,Mt+=Se*Kt,Mt+=Ae*Zt,je=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=Ue*(5*lr),Mt+=qe*(5*gr),Mt+=Xe*(5*Qt),Mt+=kt*(5*pr),je+=Mt>>>13,Mt&=8191,Et=je,Et+=wt*pr,Et+=lt*dr,Et+=at*nr,Et+=Se*de,Et+=Ae*Kt,je=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=Ue*Wt,Et+=qe*(5*lr),Et+=Xe*(5*gr),Et+=kt*(5*Qt),je+=Et>>>13,Et&=8191,dt=je,dt+=wt*Qt,dt+=lt*pr,dt+=at*dr,dt+=Se*nr,dt+=Ae*de,je=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=Ue*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*gr),je+=dt>>>13,dt&=8191,_t=je,_t+=wt*gr,_t+=lt*Qt,_t+=at*pr,_t+=Se*dr,_t+=Ae*nr,je=_t>>>13,_t&=8191,_t+=Ge*de,_t+=Ue*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),je+=_t>>>13,_t&=8191,ot=je,ot+=wt*lr,ot+=lt*gr,ot+=at*Qt,ot+=Se*pr,ot+=Ae*dr,je=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=Ue*de,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,je+=ot>>>13,ot&=8191,je=(je<<2)+je|0,je=je+gt|0,gt=je&8191,je=je>>>13,st+=je,wt=gt,lt=st,at=tt,Se=At,Ae=Rt,Ge=Mt,Ue=Et,qe=dt,Xe=_t,kt=ot,H+=16,V-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Se,this.h[4]=Ae,this.h[5]=Ge,this.h[6]=Ue,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},G.prototype.finish=function(B,H){var V=new Uint16Array(10),C,Y,j,oe;if(this.leftover){for(oe=this.leftover,this.buffer[oe++]=1;oe<16;oe++)this.buffer[oe]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,oe=2;oe<10;oe++)this.h[oe]+=C,C=this.h[oe]>>>13,this.h[oe]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,V[0]=this.h[0]+5,C=V[0]>>>13,V[0]&=8191,oe=1;oe<10;oe++)V[oe]=this.h[oe]+C,C=V[oe]>>>13,V[oe]&=8191;for(V[9]-=8192,Y=(C^1)-1,oe=0;oe<10;oe++)V[oe]&=Y;for(Y=~Y,oe=0;oe<10;oe++)this.h[oe]=this.h[oe]&Y|V[oe];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,j=this.h[0]+this.pad[0],this.h[0]=j&65535,oe=1;oe<8;oe++)j=(this.h[oe]+this.pad[oe]|0)+(j>>>16)|0,this.h[oe]=j&65535;B[H+0]=this.h[0]>>>0&255,B[H+1]=this.h[0]>>>8&255,B[H+2]=this.h[1]>>>0&255,B[H+3]=this.h[1]>>>8&255,B[H+4]=this.h[2]>>>0&255,B[H+5]=this.h[2]>>>8&255,B[H+6]=this.h[3]>>>0&255,B[H+7]=this.h[3]>>>8&255,B[H+8]=this.h[4]>>>0&255,B[H+9]=this.h[4]>>>8&255,B[H+10]=this.h[5]>>>0&255,B[H+11]=this.h[5]>>>8&255,B[H+12]=this.h[6]>>>0&255,B[H+13]=this.h[6]>>>8&255,B[H+14]=this.h[7]>>>0&255,B[H+15]=this.h[7]>>>8&255},G.prototype.update=function(B,H,V){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>V&&(Y=V),C=0;C=16&&(Y=V-V%16,this.blocks(B,H,Y),H+=Y,V-=Y),V){for(C=0;C>16&1),j[V-1]&=65535;j[15]=oe[15]-32767-(j[14]>>16&1),Y=j[15]>>16&1,j[14]&=65535,_(oe,j,1-Y)}for(V=0;V<16;V++)B[2*V]=oe[V]&255,B[2*V+1]=oe[V]>>8}function b(B,H){var V=new Uint8Array(32),C=new Uint8Array(32);return S(V,B),S(C,H),k(V,0,C,0)}function M(B){var H=new Uint8Array(32);return S(H,B),H[0]&1}function I(B,H){var V;for(V=0;V<16;V++)B[V]=H[2*V]+(H[2*V+1]<<8);B[15]&=32767}function F(B,H,V){for(var C=0;C<16;C++)B[C]=H[C]+V[C]}function ae(B,H,V){for(var C=0;C<16;C++)B[C]=H[C]-V[C]}function O(B,H,V){var C,Y,j=0,oe=0,pe=0,xe=0,Re=0,De=0,it=0,je=0,gt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Se=0,Ae=0,Ge=0,Ue=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,de=V[0],nr=V[1],dr=V[2],pr=V[3],Qt=V[4],gr=V[5],lr=V[6],Lr=V[7],mr=V[8],wr=V[9],$r=V[10],Br=V[11],Ir=V[12],hn=V[13],dn=V[14],pn=V[15];C=H[0],j+=C*de,oe+=C*nr,pe+=C*dr,xe+=C*pr,Re+=C*Qt,De+=C*gr,it+=C*lr,je+=C*Lr,gt+=C*mr,st+=C*wr,tt+=C*$r,At+=C*Br,Rt+=C*Ir,Mt+=C*hn,Et+=C*dn,dt+=C*pn,C=H[1],oe+=C*de,pe+=C*nr,xe+=C*dr,Re+=C*pr,De+=C*Qt,it+=C*gr,je+=C*lr,gt+=C*Lr,st+=C*mr,tt+=C*wr,At+=C*$r,Rt+=C*Br,Mt+=C*Ir,Et+=C*hn,dt+=C*dn,_t+=C*pn,C=H[2],pe+=C*de,xe+=C*nr,Re+=C*dr,De+=C*pr,it+=C*Qt,je+=C*gr,gt+=C*lr,st+=C*Lr,tt+=C*mr,At+=C*wr,Rt+=C*$r,Mt+=C*Br,Et+=C*Ir,dt+=C*hn,_t+=C*dn,ot+=C*pn,C=H[3],xe+=C*de,Re+=C*nr,De+=C*dr,it+=C*pr,je+=C*Qt,gt+=C*gr,st+=C*lr,tt+=C*Lr,At+=C*mr,Rt+=C*wr,Mt+=C*$r,Et+=C*Br,dt+=C*Ir,_t+=C*hn,ot+=C*dn,wt+=C*pn,C=H[4],Re+=C*de,De+=C*nr,it+=C*dr,je+=C*pr,gt+=C*Qt,st+=C*gr,tt+=C*lr,At+=C*Lr,Rt+=C*mr,Mt+=C*wr,Et+=C*$r,dt+=C*Br,_t+=C*Ir,ot+=C*hn,wt+=C*dn,lt+=C*pn,C=H[5],De+=C*de,it+=C*nr,je+=C*dr,gt+=C*pr,st+=C*Qt,tt+=C*gr,At+=C*lr,Rt+=C*Lr,Mt+=C*mr,Et+=C*wr,dt+=C*$r,_t+=C*Br,ot+=C*Ir,wt+=C*hn,lt+=C*dn,at+=C*pn,C=H[6],it+=C*de,je+=C*nr,gt+=C*dr,st+=C*pr,tt+=C*Qt,At+=C*gr,Rt+=C*lr,Mt+=C*Lr,Et+=C*mr,dt+=C*wr,_t+=C*$r,ot+=C*Br,wt+=C*Ir,lt+=C*hn,at+=C*dn,Se+=C*pn,C=H[7],je+=C*de,gt+=C*nr,st+=C*dr,tt+=C*pr,At+=C*Qt,Rt+=C*gr,Mt+=C*lr,Et+=C*Lr,dt+=C*mr,_t+=C*wr,ot+=C*$r,wt+=C*Br,lt+=C*Ir,at+=C*hn,Se+=C*dn,Ae+=C*pn,C=H[8],gt+=C*de,st+=C*nr,tt+=C*dr,At+=C*pr,Rt+=C*Qt,Mt+=C*gr,Et+=C*lr,dt+=C*Lr,_t+=C*mr,ot+=C*wr,wt+=C*$r,lt+=C*Br,at+=C*Ir,Se+=C*hn,Ae+=C*dn,Ge+=C*pn,C=H[9],st+=C*de,tt+=C*nr,At+=C*dr,Rt+=C*pr,Mt+=C*Qt,Et+=C*gr,dt+=C*lr,_t+=C*Lr,ot+=C*mr,wt+=C*wr,lt+=C*$r,at+=C*Br,Se+=C*Ir,Ae+=C*hn,Ge+=C*dn,Ue+=C*pn,C=H[10],tt+=C*de,At+=C*nr,Rt+=C*dr,Mt+=C*pr,Et+=C*Qt,dt+=C*gr,_t+=C*lr,ot+=C*Lr,wt+=C*mr,lt+=C*wr,at+=C*$r,Se+=C*Br,Ae+=C*Ir,Ge+=C*hn,Ue+=C*dn,qe+=C*pn,C=H[11],At+=C*de,Rt+=C*nr,Mt+=C*dr,Et+=C*pr,dt+=C*Qt,_t+=C*gr,ot+=C*lr,wt+=C*Lr,lt+=C*mr,at+=C*wr,Se+=C*$r,Ae+=C*Br,Ge+=C*Ir,Ue+=C*hn,qe+=C*dn,Xe+=C*pn,C=H[12],Rt+=C*de,Mt+=C*nr,Et+=C*dr,dt+=C*pr,_t+=C*Qt,ot+=C*gr,wt+=C*lr,lt+=C*Lr,at+=C*mr,Se+=C*wr,Ae+=C*$r,Ge+=C*Br,Ue+=C*Ir,qe+=C*hn,Xe+=C*dn,kt+=C*pn,C=H[13],Mt+=C*de,Et+=C*nr,dt+=C*dr,_t+=C*pr,ot+=C*Qt,wt+=C*gr,lt+=C*lr,at+=C*Lr,Se+=C*mr,Ae+=C*wr,Ge+=C*$r,Ue+=C*Br,qe+=C*Ir,Xe+=C*hn,kt+=C*dn,Wt+=C*pn,C=H[14],Et+=C*de,dt+=C*nr,_t+=C*dr,ot+=C*pr,wt+=C*Qt,lt+=C*gr,at+=C*lr,Se+=C*Lr,Ae+=C*mr,Ge+=C*wr,Ue+=C*$r,qe+=C*Br,Xe+=C*Ir,kt+=C*hn,Wt+=C*dn,Zt+=C*pn,C=H[15],dt+=C*de,_t+=C*nr,ot+=C*dr,wt+=C*pr,lt+=C*Qt,at+=C*gr,Se+=C*lr,Ae+=C*Lr,Ge+=C*mr,Ue+=C*wr,qe+=C*$r,Xe+=C*Br,kt+=C*Ir,Wt+=C*hn,Zt+=C*dn,Kt+=C*pn,j+=38*_t,oe+=38*ot,pe+=38*wt,xe+=38*lt,Re+=38*at,De+=38*Se,it+=38*Ae,je+=38*Ge,gt+=38*Ue,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=j+Y+65535,Y=Math.floor(C/65536),j=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=je+Y+65535,Y=Math.floor(C/65536),je=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,j+=Y-1+37*(Y-1),Y=1,C=j+Y+65535,Y=Math.floor(C/65536),j=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=je+Y+65535,Y=Math.floor(C/65536),je=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,j+=Y-1+37*(Y-1),B[0]=j,B[1]=oe,B[2]=pe,B[3]=xe,B[4]=Re,B[5]=De,B[6]=it,B[7]=je,B[8]=gt,B[9]=st,B[10]=tt,B[11]=At,B[12]=Rt,B[13]=Mt,B[14]=Et,B[15]=dt}function se(B,H){O(B,H,H)}function ee(B,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=253;C>=0;C--)se(V,V),C!==2&&C!==4&&O(V,V,H);for(C=0;C<16;C++)B[C]=V[C]}function X(B,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=250;C>=0;C--)se(V,V),C!==1&&O(V,V,H);for(C=0;C<16;C++)B[C]=V[C]}function Q(B,H,V){var C=new Uint8Array(32),Y=new Float64Array(80),j,oe,pe=r(),xe=r(),Re=r(),De=r(),it=r(),je=r();for(oe=0;oe<31;oe++)C[oe]=H[oe];for(C[31]=H[31]&127|64,C[0]&=248,I(Y,V),oe=0;oe<16;oe++)xe[oe]=Y[oe],De[oe]=pe[oe]=Re[oe]=0;for(pe[0]=De[0]=1,oe=254;oe>=0;--oe)j=C[oe>>>3]>>>(oe&7)&1,_(pe,xe,j),_(Re,De,j),F(it,pe,Re),ae(pe,pe,Re),F(Re,xe,De),ae(xe,xe,De),se(De,it),se(je,pe),O(pe,Re,pe),O(Re,xe,it),F(it,pe,Re),ae(pe,pe,Re),se(xe,pe),ae(Re,De,je),O(pe,Re,u),F(pe,pe,De),O(Re,Re,pe),O(pe,De,je),O(De,xe,Y),se(xe,it),_(pe,xe,j),_(Re,De,j);for(oe=0;oe<16;oe++)Y[oe+16]=pe[oe],Y[oe+32]=Re[oe],Y[oe+48]=xe[oe],Y[oe+64]=De[oe];var gt=Y.subarray(32),st=Y.subarray(16);return ee(gt,gt),O(st,st,gt),S(B,st),0}function R(B,H){return Q(B,H,s)}function Z(B,H){return n(H,32),R(B,H)}function te(B,H,V){var C=new Uint8Array(32);return Q(C,V,H),K(B,i,C,J)}var le=f,ie=p;function fe(B,H,V,C,Y,j){var oe=new Uint8Array(32);return te(oe,Y,j),le(B,H,V,C,oe)}function ve(B,H,V,C,Y,j){var oe=new Uint8Array(32);return te(oe,Y,j),ie(B,H,V,C,oe)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne(B,H,V,C){for(var Y=new Int32Array(16),j=new Int32Array(16),oe,pe,xe,Re,De,it,je,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Se,Ae,Ge,Ue,qe,Xe,kt=B[0],Wt=B[1],Zt=B[2],Kt=B[3],de=B[4],nr=B[5],dr=B[6],pr=B[7],Qt=H[0],gr=H[1],lr=H[2],Lr=H[3],mr=H[4],wr=H[5],$r=H[6],Br=H[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=V[at+0]<<24|V[at+1]<<16|V[at+2]<<8|V[at+3],j[lt]=V[at+4]<<24|V[at+5]<<16|V[at+6]<<8|V[at+7];for(lt=0;lt<80;lt++)if(oe=kt,pe=Wt,xe=Zt,Re=Kt,De=de,it=nr,je=dr,gt=pr,st=Qt,tt=gr,At=lr,Rt=Lr,Mt=mr,Et=wr,dt=$r,_t=Br,Se=pr,Ae=Br,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=(de>>>14|mr<<18)^(de>>>18|mr<<14)^(mr>>>9|de<<23),Ae=(mr>>>14|de<<18)^(mr>>>18|de<<14)^(de>>>9|mr<<23),Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Se=de&nr^~de&dr,Ae=mr&wr^~mr&$r,Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Se=Me[lt*2],Ae=Me[lt*2+1],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Se=Y[lt%16],Ae=j[lt%16],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|Ue<<16,Se=ot,Ae=wt,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Ae=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Se=kt&Wt^kt&Zt^Wt&Zt,Ae=Qt&gr^Qt&lr^gr&lr,Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,gt=qe&65535|Xe<<16,_t=Ge&65535|Ue<<16,Se=Re,Ae=Rt,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=ot,Ae=wt,Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|Ue<<16,Wt=oe,Zt=pe,Kt=xe,de=Re,nr=De,dr=it,pr=je,kt=gt,gr=st,lr=tt,Lr=At,mr=Rt,wr=Mt,$r=Et,Br=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Se=Y[at],Ae=j[at],Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=Y[(at+9)%16],Ae=j[(at+9)%16],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,ot=Y[(at+1)%16],wt=j[(at+1)%16],Se=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Ae=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,ot=Y[(at+14)%16],wt=j[(at+14)%16],Se=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Ae=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,j[at]=Ge&65535|Ue<<16;Se=kt,Ae=Qt,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[0],Ae=H[0],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[0]=kt=qe&65535|Xe<<16,H[0]=Qt=Ge&65535|Ue<<16,Se=Wt,Ae=gr,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[1],Ae=H[1],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[1]=Wt=qe&65535|Xe<<16,H[1]=gr=Ge&65535|Ue<<16,Se=Zt,Ae=lr,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[2],Ae=H[2],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[2]=Zt=qe&65535|Xe<<16,H[2]=lr=Ge&65535|Ue<<16,Se=Kt,Ae=Lr,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[3],Ae=H[3],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[3]=Kt=qe&65535|Xe<<16,H[3]=Lr=Ge&65535|Ue<<16,Se=de,Ae=mr,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[4],Ae=H[4],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[4]=de=qe&65535|Xe<<16,H[4]=mr=Ge&65535|Ue<<16,Se=nr,Ae=wr,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[5],Ae=H[5],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[5]=nr=qe&65535|Xe<<16,H[5]=wr=Ge&65535|Ue<<16,Se=dr,Ae=$r,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[6],Ae=H[6],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[6]=dr=qe&65535|Xe<<16,H[6]=$r=Ge&65535|Ue<<16,Se=pr,Ae=Br,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[7],Ae=H[7],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[7]=pr=qe&65535|Xe<<16,H[7]=Br=Ge&65535|Ue<<16,Ir+=128,C-=128}return C}function Te(B,H,V){var C=new Int32Array(8),Y=new Int32Array(8),j=new Uint8Array(256),oe,pe=V;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,H,V),V%=128,oe=0;oe=0;--Y)C=V[Y/8|0]>>(Y&7)&1,Ie(B,H,C),Be(H,B),Be(B,B),Ie(B,H,C)}function ke(B,H){var V=[r(),r(),r(),r()];v(V[0],g),v(V[1],y),v(V[2],a),O(V[3],g,y),Ve(B,V,H)}function ze(B,H,V){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],j;for(V||n(H,32),Te(C,H,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le(B,Y),j=0;j<32;j++)H[j+32]=B[j];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Ee(B,H){var V,C,Y,j;for(C=63;C>=32;--C){for(V=0,Y=C-32,j=C-12;Y>4)*He[Y],V=H[Y]>>8,H[Y]&=255;for(Y=0;Y<32;Y++)H[Y]-=V*He[Y];for(C=0;C<32;C++)H[C+1]+=H[C]>>8,B[C]=H[C]&255}function Qe(B){var H=new Float64Array(64),V;for(V=0;V<64;V++)H[V]=B[V];for(V=0;V<64;V++)B[V]=0;Ee(B,H)}function ct(B,H,V,C){var Y=new Uint8Array(64),j=new Uint8Array(64),oe=new Uint8Array(64),pe,xe,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=V+64;for(pe=0;pe>7&&ae(B[0],o,B[0]),O(B[3],B[0],B[1]),0)}function et(B,H,V,C){var Y,j=new Uint8Array(32),oe=new Uint8Array(64),pe=[r(),r(),r(),r()],xe=[r(),r(),r(),r()];if(V<64||$e(xe,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var B=new Uint8Array(vt),H=new Uint8Array(Dt);return ze(B,H),{publicKey:B,secretKey:H}},e.sign.keyPair.fromSecretKey=function(B){if(nt(B),B.length!==Dt)throw new Error("bad secret key size");for(var H=new Uint8Array(vt),V=0;V=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function Ib(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function G0(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new jt("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new jt("Delay aborted"))})})})}function Ss(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function fh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=Ss(e==null?void 0:e.signal);if(typeof t!="function")throw new jt(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=g??null,o==null||o.abort(),o=Ss(g),o.signal.aborted)throw new jt("Resource creation was aborted");n=y??null;const A=t(o.signal,...y);i=A;const P=yield A;if(i!==A&&P!==r)throw yield e(P),new jt("Resource creation was aborted by a new resource creation");return r=P,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const g=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([g?e(g):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:g=>Pt(this,void 0,void 0,function*(){const y=r,A=i,P=n,N=s;if(yield O7(g),y===r&&A===i&&P===n&&N===s)return yield a(s,...P??[]);throw new jt("Resource recreation was aborted by a new resource creation")})}}function WZ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=Ss(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new jt("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new jt(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new jt("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class Ob{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=HZ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield KZ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new FZ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(D7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=C7.encode(e);yield fh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new jt(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Bo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Bo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new jt(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new jt("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),Sn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new jt("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new jt(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function KZ(t){return Pt(this,void 0,void 0,function*(){return yield WZ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=Ss(n.signal).signal;if(o.aborted){r(new jt("Bridge connection aborted"));return}const a=new URL(D7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new jt("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new jt("Bridge connection aborted"));return}try{const g=yield t.errorHandler(l,d);g!==l&&l.close(),g&&g!==l&&e(g)}catch(g){l.close(),r(g)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new jt("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new jt("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new jt("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function lh(t){return!("connectEvent"in t)}class hh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!lh(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Ib(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Ib(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new jt("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new jt("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new jt("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new jt("Trying to read HTTP connection source while injected connection is stored");if(!lh(e))throw new jt("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new jt("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new jt("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!lh(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const N7=2;class dh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new hh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getHttpConnection();return lh(n)?new dh(e,n.connectionSource):new dh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=Ss(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Ib;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield fh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=Ss(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(lh(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new jt("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Ob(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield fh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new jt("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),G0(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=Ss(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){Sn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(C7.decode(e.message).toUint8Array(),G0(e.from)));if(Sn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){Sn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Bo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(Sn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new jt(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return jZ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",N7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+qZ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new Ob(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>fh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Ob(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function L7(t,e){return k7(t,[e])}function k7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function VZ(t){try{return!L7(t,"tonconnect")||!L7(t.tonconnect,"walletInfo")?!1:k7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Yu{constructor(){this.storage={}}static getInstance(){return Yu.instance||(Yu.instance=new Yu),Yu.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function rp(){if(!(typeof window>"u"))return window}function GZ(){const t=rp();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function YZ(){if(!(typeof document>"u"))return document}function JZ(){var t;const e=(t=rp())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function XZ(){if(ZZ())return localStorage;if(QZ())throw new jt("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Yu.getInstance()}function ZZ(){try{return typeof localStorage<"u"}catch{return!1}}function QZ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class xi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=xi.window;if(!xi.isWindowContainsWallet(n,r))throw new Rb;this.connectionStorage=new hh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getInjectedConnection();return new xi(e,n.jsBridgeKey)})}static isWalletInjected(e){return xi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return xi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?GZ().filter(([n,i])=>VZ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(N7,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{Sn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();Sn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){Sn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>Sn("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{Sn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);Sn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){Sn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{Sn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}xi.window=rp();class eQ{constructor(){this.localStorage=XZ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function $7(t){return rQ(t)&&t.injected}function tQ(t){return $7(t)&&t.embedded}function rQ(t){return"jsBridgeKey"in t}const nQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class Nb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(tQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new Db("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Bo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Bo(n),e=nQ}let r=[];try{r=xi.getCurrentlyInjectedWallets()}catch(n){Bo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=xi.isWalletInjected(o),i.embedded=xi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class np extends jt{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,np.prototype)}}function iQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new np("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function dQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Xu(t,e)),Lb(e,r))}function pQ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Xu(t,e)),Lb(e,r))}function gQ(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Xu(t,e)),Lb(e,r))}function mQ(t,e,r){return Object.assign({type:"disconnection",scope:r},Xu(t,e))}class vQ{constructor(){this.window=rp()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class bQ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new vQ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Ju({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",oQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",sQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=aQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=cQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=uQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=fQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=lQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=hQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=mQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=dQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=pQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=gQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const yQ="3.0.5";class ip{constructor(e){if(this.walletsList=new Nb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||JZ(),storage:(e==null?void 0:e.storage)||new eQ},this.walletsList=new Nb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new bQ({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:yQ}),!this.dappSettings.manifestUrl)throw new Cb("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new hh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Tb;const o=Ss(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new jt("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=Ss(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield dh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield xi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Bo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=fh(g=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:g.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(g=>setTimeout(()=>g(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=Ss(n==null?void 0:n.signal);if(i.signal.aborted)throw new jt("Transaction sending was aborted");this.checkConnection(),iQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=OZ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(tp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(tp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),tp.parseAndThrowError(l);const d=tp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new X0;const n=Ss(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new jt("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=YZ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Bo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&NZ(e)?r=new xi(this.dappSettings.storage,e.jsBridgeKey):r=new dh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new jt("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=kZ.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),Sn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof J0||r instanceof Y0)throw Bo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new X0}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}ip.walletsList=new Nb,ip.isWalletInjected=t=>xi.isWalletInjected(t),ip.isInsideWalletBrowser=t=>xi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function kb(t){const{children:e,onClick:r}=t;return me.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function wQ(t){const{wallet:e,connector:r,loading:n}=t,i=Pe.useRef(null),s=Pe.useRef(),[o,a]=Pe.useState(),[u,l]=Pe.useState(),[d,g]=Pe.useState("connect"),[y,A]=Pe.useState(!1),[P,N]=Pe.useState();function D(z){var ue;(ue=s.current)==null||ue.update({data:z})}async function k(){A(!0);try{a("");const z=await ma.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ue=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:z}});if(!ue)return;N(ue),D(ue),l(z)}}catch(z){a(z.message)}A(!1)}function $(){s.current=new y7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function q(){r.connect(e,{request:{tonProof:u}})}function U(){if("deepLink"in e){if(!e.deepLink||!P)return;const z=new URL(P),ue=`${e.deepLink}${z.search}`;window.open(ue)}}function K(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(P)}const J=Pe.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),T=Pe.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Pe.useEffect(()=>{$(),k()},[]),me.jsxs(Ec,{children:[me.jsx("div",{className:"xc-mb-6",children:me.jsx(ah,{title:"Connect wallet",onBack:t.onBack})}),me.jsxs("div",{className:"xc-text-center xc-mb-6",children:[me.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[me.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),me.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?me.jsx(mc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):me.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),me.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),me.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&me.jsx(mc,{className:"xc-animate-spin"}),!y&&!n&&me.jsxs(me.Fragment,{children:[$7(e)&&me.jsxs(kb,{onClick:q,children:[me.jsx(PK,{className:"xc-opacity-80"}),"Extension"]}),J&&me.jsxs(kb,{onClick:U,children:[me.jsx(u8,{className:"xc-opacity-80"}),"Desktop"]}),T&&me.jsx(kb,{onClick:K,children:"Telegram Mini App"})]})]})]})}function xQ(t){const[e,r]=Pe.useState(""),[n,i]=Pe.useState(),[s,o]=Pe.useState(),a=Pb(),[u,l]=Pe.useState(!1);async function d(y){var P,N;if(!y||!((P=y.connectItems)!=null&&P.tonProof))return;l(!0);const A=await ma.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(N=y.connectItems)==null?void 0:N.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(A.data),l(!1)}Pe.useEffect(()=>{const y=new ip({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),A=y.onStatusChange(d);return o(y),r("select"),A},[]);function g(y){r("connect"),i(y)}return me.jsxs(Ec,{children:[e==="select"&&me.jsx(SZ,{connector:s,onSelect:g,onBack:t.onBack}),e==="connect"&&me.jsx(wQ,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function _Q(t){const{children:e,className:r}=t,n=Pe.useRef(null),[i,s]=Pe.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Pe.useEffect(()=>{console.log("maxHeight",i)},[i]),me.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function EQ(){return me.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[me.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),me.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),me.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),me.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),me.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),me.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function SQ(t){const{wallets:e}=Wl(),[r,n]=Pe.useState(),i=Pe.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return me.jsxs(Ec,{children:[me.jsx("div",{className:"xc-mb-6",children:me.jsx(ah,{title:"Select wallet",onBack:t.onBack})}),me.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[me.jsx(f8,{className:"xc-shrink-0 xc-opacity-50"}),me.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),me.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>me.jsx(QS,{wallet:a,onClick:s},`feature-${a.key}`)):me.jsx(EQ,{})})]})}function AQ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Pe.useState(""),[l,d]=Pe.useState(null),[g,y]=Pe.useState("");function A(k){d(k),u("evm-wallet")}function P(k){u("email"),y(k)}async function N(k){await e(k)}function D(){u("ton-wallet")}return Pe.useEffect(()=>{u("index")},[]),me.jsx(XX,{config:t.config,children:me.jsxs(_Q,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&me.jsx(_Z,{onBack:()=>u("index"),onLogin:N,wallet:l}),a==="ton-wallet"&&me.jsx(xQ,{onBack:()=>u("index"),onLogin:N}),a==="email"&&me.jsx(ZX,{email:g,onBack:()=>u("index"),onLogin:N}),a==="index"&&me.jsx(kX,{header:r,onEmailConfirm:P,onSelectWallet:A,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&me.jsx(SQ,{onBack:()=>u("index"),onSelectWallet:A})]})})}Vn.CodattaConnectContextProvider=bK,Vn.CodattaSignin=AQ,Vn.coinbaseWallet=s8,Vn.useCodattaConnectContext=Wl,Object.defineProperty(Vn,Symbol.toStringTag,{value:"Module"})}); +`+e:""}`,Object.setPrototypeOf(this,jt.prototype)}get info(){return""}}jt.prefix="[TON_CONNECT_SDK_ERROR]";class Tb extends jt{get info(){return"Passed DappMetadata is in incorrect format."}constructor(...e){super(...e),Object.setPrototypeOf(this,Tb.prototype)}}class Y0 extends jt{get info(){return"Passed `tonconnect-manifest.json` contains errors. Check format of your manifest. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,Y0.prototype)}}class J0 extends jt{get info(){return"Manifest not found. Make sure you added `tonconnect-manifest.json` to the root of your app or passed correct manifestUrl. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,J0.prototype)}}class Rb extends jt{get info(){return"Wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection."}constructor(...e){super(...e),Object.setPrototypeOf(this,Rb.prototype)}}class X0 extends jt{get info(){return"Send transaction or other protocol methods called while wallet is not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,X0.prototype)}}function NZ(t){return"jsBridgeKey"in t}class Z0 extends jt{get info(){return"User rejects the action in the wallet."}constructor(...e){super(...e),Object.setPrototypeOf(this,Z0.prototype)}}class Q0 extends jt{get info(){return"Request to the wallet contains errors."}constructor(...e){super(...e),Object.setPrototypeOf(this,Q0.prototype)}}class ep extends jt{get info(){return"App tries to send rpc request to the injected wallet while not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,ep.prototype)}}class Db extends jt{get info(){return"There is an attempt to connect to the injected wallet while it is not exists in the webpage."}constructor(...e){super(...e),Object.setPrototypeOf(this,Db.prototype)}}class Ob extends jt{get info(){return"An error occurred while fetching the wallets list."}constructor(...e){super(...e),Object.setPrototypeOf(this,Ob.prototype)}}class Pa extends jt{constructor(...e){super(...e),Object.setPrototypeOf(this,Pa.prototype)}}const T7={[Aa.UNKNOWN_ERROR]:Pa,[Aa.USER_REJECTS_ERROR]:Z0,[Aa.BAD_REQUEST_ERROR]:Q0,[Aa.UNKNOWN_APP_ERROR]:ep,[Aa.MANIFEST_NOT_FOUND_ERROR]:J0,[Aa.MANIFEST_CONTENT_ERROR]:Y0};class LZ{parseError(e){let r=Pa;return e.code in T7&&(r=T7[e.code]||Pa),new r(e.message)}}const kZ=new LZ;class $Z{isError(e){return"error"in e}}const R7={[Gu.UNKNOWN_ERROR]:Pa,[Gu.USER_REJECTS_ERROR]:Z0,[Gu.BAD_REQUEST_ERROR]:Q0,[Gu.UNKNOWN_APP_ERROR]:ep};class BZ extends $Z{convertToRpcRequest(e){return{method:"sendTransaction",params:[JSON.stringify(e)]}}parseAndThrowError(e){let r=Pa;throw e.error.code in R7&&(r=R7[e.error.code]||Pa),new r(e.error.message)}convertFromRpcResponse(e){return{boc:e.result}}}const tp=new BZ;class FZ{constructor(e,r){this.storage=e,this.storeKey="ton-connect-storage_http-bridge-gateway::"+r}storeLastEventId(e){return Pt(this,void 0,void 0,function*(){return this.storage.setItem(this.storeKey,e)})}removeLastEventId(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getLastEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e||null})}}function UZ(t){return t.slice(-1)==="/"?t.slice(0,-1):t}function D7(t,e){return UZ(t)+"/"+e}function jZ(t){if(!t)return!1;const e=new URL(t);return e.protocol==="tg:"||e.hostname==="t.me"}function qZ(t){return t.replaceAll(".","%2E").replaceAll("-","%2D").replaceAll("_","%5F").replaceAll("&","-").replaceAll("=","__").replaceAll("%","--")}function O7(t,e){return Pt(this,void 0,void 0,function*(){return new Promise((r,n)=>{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new jt("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new jt("Delay aborted"))})})})}function Ss(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function fh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=Ss(e==null?void 0:e.signal);if(typeof t!="function")throw new jt(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=g??null,o==null||o.abort(),o=Ss(g),o.signal.aborted)throw new jt("Resource creation was aborted");n=y??null;const A=t(o.signal,...y);i=A;const P=yield A;if(i!==A&&P!==r)throw yield e(P),new jt("Resource creation was aborted by a new resource creation");return r=P,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const g=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([g?e(g):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:g=>Pt(this,void 0,void 0,function*(){const y=r,A=i,P=n,N=s;if(yield O7(g),y===r&&A===i&&P===n&&N===s)return yield a(s,...P??[]);throw new jt("Resource recreation was aborted by a new resource creation")})}}function WZ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=Ss(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new jt("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new jt(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new jt("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class Nb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=HZ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield KZ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new FZ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(D7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=C7.encode(e);yield fh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new jt(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Bo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Bo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new jt(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new jt("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),Sn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new jt("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new jt(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function KZ(t){return Pt(this,void 0,void 0,function*(){return yield WZ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=Ss(n.signal).signal;if(o.aborted){r(new jt("Bridge connection aborted"));return}const a=new URL(D7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new jt("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new jt("Bridge connection aborted"));return}try{const g=yield t.errorHandler(l,d);g!==l&&l.close(),g&&g!==l&&e(g)}catch(g){l.close(),r(g)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new jt("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new jt("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new jt("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function lh(t){return!("connectEvent"in t)}class hh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!lh(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Cb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Cb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new jt("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new jt("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new jt("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new jt("Trying to read HTTP connection source while injected connection is stored");if(!lh(e))throw new jt("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new jt("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new jt("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!lh(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const N7=2;class dh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new hh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getHttpConnection();return lh(n)?new dh(e,n.connectionSource):new dh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=Ss(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Cb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield fh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=Ss(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(lh(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new jt("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Nb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield fh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new jt("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),G0(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=Ss(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){Sn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(C7.decode(e.message).toUint8Array(),G0(e.from)));if(Sn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){Sn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Bo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(Sn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new jt(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return jZ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",N7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+qZ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new Nb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>fh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Nb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function L7(t,e){return k7(t,[e])}function k7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function VZ(t){try{return!L7(t,"tonconnect")||!L7(t.tonconnect,"walletInfo")?!1:k7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Yu{constructor(){this.storage={}}static getInstance(){return Yu.instance||(Yu.instance=new Yu),Yu.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function rp(){if(!(typeof window>"u"))return window}function GZ(){const t=rp();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function YZ(){if(!(typeof document>"u"))return document}function JZ(){var t;const e=(t=rp())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function XZ(){if(ZZ())return localStorage;if(QZ())throw new jt("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Yu.getInstance()}function ZZ(){try{return typeof localStorage<"u"}catch{return!1}}function QZ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class xi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=xi.window;if(!xi.isWindowContainsWallet(n,r))throw new Db;this.connectionStorage=new hh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getInjectedConnection();return new xi(e,n.jsBridgeKey)})}static isWalletInjected(e){return xi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return xi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?GZ().filter(([n,i])=>VZ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(N7,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{Sn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();Sn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){Sn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>Sn("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{Sn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);Sn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){Sn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{Sn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}xi.window=rp();class eQ{constructor(){this.localStorage=XZ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function $7(t){return rQ(t)&&t.injected}function tQ(t){return $7(t)&&t.embedded}function rQ(t){return"jsBridgeKey"in t}const nQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class Lb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(tQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new Ob("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Bo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Bo(n),e=nQ}let r=[];try{r=xi.getCurrentlyInjectedWallets()}catch(n){Bo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=xi.isWalletInjected(o),i.embedded=xi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class np extends jt{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,np.prototype)}}function iQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new np("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function dQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Xu(t,e)),kb(e,r))}function pQ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Xu(t,e)),kb(e,r))}function gQ(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Xu(t,e)),kb(e,r))}function mQ(t,e,r){return Object.assign({type:"disconnection",scope:r},Xu(t,e))}class vQ{constructor(){this.window=rp()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class bQ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new vQ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Ju({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",oQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",sQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=aQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=cQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=uQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=fQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=lQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=hQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=mQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=dQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=pQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=gQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const yQ="3.0.5";class ip{constructor(e){if(this.walletsList=new Lb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||JZ(),storage:(e==null?void 0:e.storage)||new eQ},this.walletsList=new Lb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new bQ({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:yQ}),!this.dappSettings.manifestUrl)throw new Tb("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new hh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Rb;const o=Ss(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new jt("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=Ss(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield dh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield xi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Bo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=fh(g=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:g.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(g=>setTimeout(()=>g(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=Ss(n==null?void 0:n.signal);if(i.signal.aborted)throw new jt("Transaction sending was aborted");this.checkConnection(),iQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=OZ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(tp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(tp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),tp.parseAndThrowError(l);const d=tp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new X0;const n=Ss(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new jt("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=YZ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Bo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&NZ(e)?r=new xi(this.dappSettings.storage,e.jsBridgeKey):r=new dh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new jt("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=kZ.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),Sn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof J0||r instanceof Y0)throw Bo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new X0}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}ip.walletsList=new Lb,ip.isWalletInjected=t=>xi.isWalletInjected(t),ip.isInsideWalletBrowser=t=>xi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function $b(t){const{children:e,onClick:r}=t;return me.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function wQ(t){const{wallet:e,connector:r,loading:n}=t,i=Pe.useRef(null),s=Pe.useRef(),[o,a]=Pe.useState(),[u,l]=Pe.useState(),[d,g]=Pe.useState("connect"),[y,A]=Pe.useState(!1),[P,N]=Pe.useState();function D(z){var ue;(ue=s.current)==null||ue.update({data:z})}async function k(){A(!0);try{a("");const z=await ma.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ue=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:z}});if(!ue)return;N(ue),D(ue),l(z)}}catch(z){a(z.message)}A(!1)}function $(){s.current=new y7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function q(){r.connect(e,{request:{tonProof:u}})}function U(){if("deepLink"in e){if(!e.deepLink||!P)return;const z=new URL(P),ue=`${e.deepLink}${z.search}`;window.open(ue)}}function K(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(P)}const J=Pe.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),T=Pe.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Pe.useEffect(()=>{$(),k()},[]),me.jsxs(Ec,{children:[me.jsx("div",{className:"xc-mb-6",children:me.jsx(ah,{title:"Connect wallet",onBack:t.onBack})}),me.jsxs("div",{className:"xc-text-center xc-mb-6",children:[me.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[me.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),me.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?me.jsx(mc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):me.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),me.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),me.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&me.jsx(mc,{className:"xc-animate-spin"}),!y&&!n&&me.jsxs(me.Fragment,{children:[$7(e)&&me.jsxs($b,{onClick:q,children:[me.jsx(PK,{className:"xc-opacity-80"}),"Extension"]}),J&&me.jsxs($b,{onClick:U,children:[me.jsx(u8,{className:"xc-opacity-80"}),"Desktop"]}),T&&me.jsx($b,{onClick:K,children:"Telegram Mini App"})]})]})]})}function xQ(t){const[e,r]=Pe.useState(""),[n,i]=Pe.useState(),[s,o]=Pe.useState(),a=Mb(),[u,l]=Pe.useState(!1);async function d(y){var P,N;if(!y||!((P=y.connectItems)!=null&&P.tonProof))return;l(!0);const A=await ma.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(N=y.connectItems)==null?void 0:N.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(A.data),l(!1)}Pe.useEffect(()=>{const y=new ip({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),A=y.onStatusChange(d);return o(y),r("select"),A},[]);function g(y){r("connect"),i(y)}return me.jsxs(Ec,{children:[e==="select"&&me.jsx(SZ,{connector:s,onSelect:g,onBack:t.onBack}),e==="connect"&&me.jsx(wQ,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function _Q(t){const{children:e,className:r}=t,n=Pe.useRef(null),[i,s]=Pe.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Pe.useEffect(()=>{console.log("maxHeight",i)},[i]),me.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function EQ(){return me.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[me.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),me.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),me.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),me.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),me.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),me.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function SQ(t){const{wallets:e}=Wl(),[r,n]=Pe.useState(),i=Pe.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return me.jsxs(Ec,{children:[me.jsx("div",{className:"xc-mb-6",children:me.jsx(ah,{title:"Select wallet",onBack:t.onBack})}),me.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[me.jsx(f8,{className:"xc-shrink-0 xc-opacity-50"}),me.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),me.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>me.jsx(QS,{wallet:a,onClick:s},`feature-${a.key}`)):me.jsx(EQ,{})})]})}function AQ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Pe.useState(""),[l,d]=Pe.useState(null),[g,y]=Pe.useState("");function A(k){d(k),u("evm-wallet")}function P(k){u("email"),y(k)}async function N(k){await e(k)}function D(){u("ton-wallet")}return Pe.useEffect(()=>{u("index")},[]),me.jsx(XX,{config:t.config,children:me.jsxs(_Q,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&me.jsx(_Z,{onBack:()=>u("index"),onLogin:N,wallet:l}),a==="ton-wallet"&&me.jsx(xQ,{onBack:()=>u("index"),onLogin:N}),a==="email"&&me.jsx(ZX,{email:g,onBack:()=>u("index"),onLogin:N}),a==="index"&&me.jsx(kX,{header:r,onEmailConfirm:P,onSelectWallet:A,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&me.jsx(SQ,{onBack:()=>u("index"),onSelectWallet:A})]})})}Vn.CodattaConnectContextProvider=bK,Vn.CodattaSignin=AQ,Vn.coinbaseWallet=s8,Vn.useCodattaConnectContext=Wl,Object.defineProperty(Vn,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/main-7Oj8aJZz.js b/dist/main-Dv8NlLmw.js similarity index 95% rename from dist/main-7Oj8aJZz.js rename to dist/main-Dv8NlLmw.js index cb18d9f..d73e777 100644 --- a/dist/main-7Oj8aJZz.js +++ b/dist/main-Dv8NlLmw.js @@ -2,7 +2,8 @@ var ER = Object.defineProperty; var SR = (t, e, r) => e in t ? ER(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; var Rs = (t, e, r) => SR(t, typeof e != "symbol" ? e + "" : e, r); import * as Gt from "react"; -import pv, { createContext as Sa, useContext as Tn, useState as fr, useEffect as Xn, forwardRef as gv, createElement as jd, useId as mv, useCallback as vv, Component as AR, useLayoutEffect as PR, useRef as bi, useInsertionEffect as v5, useMemo as Oi, Fragment as b5, Children as MR, isValidElement as IR } from "react"; +import pv, { createContext as Sa, useContext as Tn, useState as fr, useEffect as Xn, forwardRef as gv, createElement as jd, useId as mv, useCallback as vv, Component as AR, useLayoutEffect as PR, useRef as bi, useInsertionEffect as b5, useMemo as Oi, Fragment as y5, Children as MR, isValidElement as IR } from "react"; +import "https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"; var gn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function ts(t) { return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; @@ -36,10 +37,10 @@ var Ym = { exports: {} }, pf = {}; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -var h2; +var d2; function CR() { - if (h2) return pf; - h2 = 1; + if (d2) return pf; + d2 = 1; var t = pv, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 }; function o(a, u, l) { var d, g = {}, w = null, A = null; @@ -60,9 +61,9 @@ var gf = {}; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -var d2; +var p2; function TR() { - return d2 || (d2 = 1, process.env.NODE_ENV !== "production" && function() { + return p2 || (p2 = 1, process.env.NODE_ENV !== "production" && function() { var t = pv, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), a = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), g = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), M = Symbol.iterator, N = "@@iterator"; function L(U) { if (U === null || typeof U != "object") @@ -70,8 +71,8 @@ function TR() { var se = M && U[M] || U[N]; return typeof se == "function" ? se : null; } - var F = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - function $(U) { + var $ = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + function F(U) { { for (var se = arguments.length, he = new Array(se > 1 ? se - 1 : 0), xe = 1; xe < se; xe++) he[xe - 1] = arguments[xe]; @@ -80,7 +81,7 @@ function TR() { } function K(U, se, he) { { - var xe = F.ReactDebugCurrentFrame, Te = xe.getStackAddendum(); + var xe = $.ReactDebugCurrentFrame, Te = xe.getStackAddendum(); Te !== "" && (se += "%s", he = he.concat([Te])); var Re = he.map(function(nt) { return String(nt); @@ -110,7 +111,7 @@ function TR() { function m(U) { if (U == null) return null; - if (typeof U.tag == "number" && $("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof U == "function") + if (typeof U.tag == "number" && F("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof U == "function") return U.displayName || U.name || null; if (typeof U == "string") return U; @@ -211,10 +212,10 @@ function TR() { }) }); } - p < 0 && $("disabledDepth fell below zero. This is a bug in React. Please file an issue."); + p < 0 && F("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } - var oe = F.ReactCurrentDispatcher, Z; + var oe = $.ReactCurrentDispatcher, Z; function J(U, se, he) { { if (Z === void 0) @@ -340,7 +341,7 @@ function TR() { } return ""; } - var ve = Object.prototype.hasOwnProperty, Pe = {}, De = F.ReactDebugCurrentFrame; + var ve = Object.prototype.hasOwnProperty, Pe = {}, De = $.ReactDebugCurrentFrame; function Ce(U) { if (U) { var se = U._owner, he = ue(U.type, U._source, se ? se.type : null); @@ -363,7 +364,7 @@ function TR() { } catch (it) { Ue = it; } - Ue && !(Ue instanceof Error) && (Ce(Te), $("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", xe || "React class", he, nt, typeof Ue), Ce(null)), Ue instanceof Error && !(Ue.message in Pe) && (Pe[Ue.message] = !0, Ce(Te), $("Failed %s type: %s", he, Ue.message), Ce(null)); + Ue && !(Ue instanceof Error) && (Ce(Te), F("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", xe || "React class", he, nt, typeof Ue), Ce(null)), Ue instanceof Error && !(Ue.message in Pe) && (Pe[Ue.message] = !0, Ce(Te), F("Failed %s type: %s", he, Ue.message), Ce(null)); } } } @@ -389,9 +390,9 @@ function TR() { } function ze(U) { if (Le(U)) - return $("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(U)), qe(U); + return F("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(U)), qe(U); } - var _e = F.ReactCurrentOwner, Ze = { + var _e = $.ReactCurrentOwner, Ze = { key: !0, ref: !0, __self: !0, @@ -417,13 +418,13 @@ function TR() { function dt(U, se) { if (typeof U.ref == "string" && _e.current && se && _e.current.stateNode !== se) { var he = m(_e.current.type); - Qe[he] || ($('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', m(_e.current.type), U.ref), Qe[he] = !0); + Qe[he] || (F('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', m(_e.current.type), U.ref), Qe[he] = !0); } } function lt(U, se) { { var he = function() { - at || (at = !0, $("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); + at || (at = !0, F("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); }; he.isReactWarning = !0, Object.defineProperty(U, "key", { get: he, @@ -434,7 +435,7 @@ function TR() { function ct(U, se) { { var he = function() { - ke || (ke = !0, $("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); + ke || (ke = !0, F("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); }; he.isReactWarning = !0, Object.defineProperty(U, "ref", { get: he, @@ -489,7 +490,7 @@ function TR() { return qt(U, Ue, pt, Te, xe, _e.current, nt); } } - var Et = F.ReactCurrentOwner, Qt = F.ReactDebugCurrentFrame; + var Et = $.ReactCurrentOwner, Qt = $.ReactDebugCurrentFrame; function Jt(U) { if (U) { var se = U._owner, he = ue(U.type, U._source, se ? se.type : null); @@ -540,7 +541,7 @@ Check the top-level render call using <` + he + ">."); return; Rt[he] = !0; var xe = ""; - U && U._owner && U._owner !== Et.current && (xe = " It was passed a child from " + m(U._owner.type) + "."), Jt(U), $('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', he, xe), Jt(null); + U && U._owner && U._owner !== Et.current && (xe = " It was passed a child from " + m(U._owner.type) + "."), Jt(U), F('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', he, xe), Jt(null); } } function $t(U, se) { @@ -582,9 +583,9 @@ Check the top-level render call using <` + he + ">."); } else if (se.PropTypes !== void 0 && !Dt) { Dt = !0; var Te = m(se); - $("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Te || "Unknown"); + F("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Te || "Unknown"); } - typeof se.getDefaultProps == "function" && !se.getDefaultProps.isReactClassApproved && $("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); + typeof se.getDefaultProps == "function" && !se.getDefaultProps.isReactClassApproved && F("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function rt(U) { @@ -592,11 +593,11 @@ Check the top-level render call using <` + he + ">."); for (var se = Object.keys(U.props), he = 0; he < se.length; he++) { var xe = se[he]; if (xe !== "children" && xe !== "key") { - Jt(U), $("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", xe), Jt(null); + Jt(U), F("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", xe), Jt(null); break; } } - U.ref !== null && (Jt(U), $("Invalid attribute `ref` supplied to `React.Fragment`."), Jt(null)); + U.ref !== null && (Jt(U), F("Invalid attribute `ref` supplied to `React.Fragment`."), Jt(null)); } } var Ft = {}; @@ -609,7 +610,7 @@ Check the top-level render call using <` + he + ">."); var pt = gt(); pt ? Ue += pt : Ue += Ct(); var it; - U === null ? it = "null" : Ne(U) ? it = "array" : U !== void 0 && U.$$typeof === e ? (it = "<" + (m(U.type) || "Unknown") + " />", Ue = " Did you accidentally export a JSX literal instead of a component?") : it = typeof U, $("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", it, Ue); + U === null ? it = "null" : Ne(U) ? it = "array" : U !== void 0 && U.$$typeof === e ? (it = "<" + (m(U.type) || "Unknown") + " />", Ue = " Did you accidentally export a JSX literal instead of a component?") : it = typeof U, F("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", it, Ue); } var et = Yt(U, se, he, Te, Re); if (et == null) @@ -623,7 +624,7 @@ Check the top-level render call using <` + he + ">."); $t(St[Tt], U); Object.freeze && Object.freeze(St); } else - $("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); + F("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else $t(St, U); } @@ -633,7 +634,7 @@ Check the top-level render call using <` + he + ">."); }), ht = _t.length > 0 ? "{key: someKey, " + _t.join(": ..., ") + ": ...}" : "{key: someKey}"; if (!Ft[At + ht]) { var xt = _t.length > 0 ? "{" + _t.join(": ..., ") + ": ...}" : "{}"; - $(`A props object containing a "key" prop is being spread into JSX: + F(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: @@ -772,17 +773,17 @@ function DR(t, e) { const r = t.exec(e); return r == null ? void 0 : r.groups; } -const p2 = /^tuple(?(\[(\d*)\])*)$/; +const g2 = /^tuple(?(\[(\d*)\])*)$/; function Jm(t) { let e = t.type; - if (p2.test(t.type) && "components" in t) { + if (g2.test(t.type) && "components" in t) { e = "("; const r = t.components.length; for (let i = 0; i < r; i++) { const s = t.components[i]; e += Jm(s), i < r - 1 && (e += ", "); } - const n = DR(p2, t.type); + const n = DR(g2, t.type); return e += `)${(n == null ? void 0 : n.array) ?? ""}`, Jm({ ...t, type: e @@ -826,10 +827,10 @@ function ma(t, { strict: e = !0 } = {}) { function An(t) { return ma(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length; } -const y5 = "2.21.45"; +const w5 = "2.21.45"; let vf = { getDocsUrl: ({ docsBaseUrl: t, docsPath: e = "", docsSlug: r }) => e ? `${t ?? "https://viem.sh"}${e}${r ? `#${r}` : ""}` : void 0, - version: `viem@${y5}` + version: `viem@${w5}` }; class yt extends Error { constructor(e, r = {}) { @@ -876,14 +877,14 @@ class yt extends Error { configurable: !0, writable: !0, value: "BaseError" - }), this.details = n, this.docsPath = i, this.metaMessages = r.metaMessages, this.name = r.name ?? this.name, this.shortMessage = e, this.version = y5; + }), this.details = n, this.docsPath = i, this.metaMessages = r.metaMessages, this.name = r.name ?? this.name, this.shortMessage = e, this.version = w5; } walk(e) { - return w5(this, e); + return x5(this, e); } } -function w5(t, e) { - return e != null && e(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ? w5(t.cause, e) : e ? null : t; +function x5(t, e) { + return e != null && e(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ? x5(t.cause, e) : e ? null : t; } class LR extends yt { constructor({ docsPath: e }) { @@ -897,7 +898,7 @@ class LR extends yt { }); } } -class g2 extends yt { +class m2 extends yt { constructor({ docsPath: e }) { super([ "Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.", @@ -968,7 +969,7 @@ class BR extends yt { `), { name: "AbiEncodingLengthMismatchError" }); } } -class x5 extends yt { +class _5 extends yt { constructor(e, { docsPath: r }) { super([ `Encoded error signature "${e}" not found on ABI.`, @@ -986,7 +987,7 @@ class x5 extends yt { }), this.signature = e; } } -class m2 extends yt { +class v2 extends yt { constructor(e, { docsPath: r } = {}) { super([ `Function ${e ? `"${e}" ` : ""}not found on ABI.`, @@ -1054,17 +1055,17 @@ class WR extends yt { `), { name: "InvalidDefinitionTypeError" }); } } -class _5 extends yt { +class E5 extends yt { constructor({ offset: e, position: r, size: n }) { super(`Slice ${r === "start" ? "starting" : "ending"} at offset "${e}" is out-of-bounds (size: ${n}).`, { name: "SliceOffsetOutOfBoundsError" }); } } -class E5 extends yt { +class S5 extends yt { constructor({ size: e, targetSize: r, type: n }) { super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`, { name: "SizeExceedsPaddingSizeError" }); } } -class v2 extends yt { +class b2 extends yt { constructor({ size: e, targetSize: r, type: n }) { super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`, { name: "InvalidBytesLengthError" }); } @@ -1077,7 +1078,7 @@ function ga(t, { dir: e, size: r = 32 } = {}) { return t; const n = t.replace("0x", ""); if (n.length > r * 2) - throw new E5({ + throw new S5({ size: Math.ceil(n.length / 2), targetSize: r, type: "hex" @@ -1088,7 +1089,7 @@ function KR(t, { dir: e, size: r = 32 } = {}) { if (r === null) return t; if (t.length > r) - throw new E5({ + throw new S5({ size: t.length, targetSize: r, type: "bytes" @@ -1144,9 +1145,9 @@ function vu(t, e = {}) { } const JR = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); function qd(t, e = {}) { - return typeof t == "number" || typeof t == "bigint" ? Mr(t, e) : typeof t == "string" ? M0(t, e) : typeof t == "boolean" ? S5(t, e) : wi(t, e); + return typeof t == "number" || typeof t == "bigint" ? Mr(t, e) : typeof t == "string" ? M0(t, e) : typeof t == "boolean" ? A5(t, e) : wi(t, e); } -function S5(t, e = {}) { +function A5(t, e = {}) { const r = `0x${Number(t)}`; return typeof e.size == "number" ? (eo(r, { size: e.size }), Cu(r, { size: e.size })) : r; } @@ -1182,7 +1183,7 @@ function M0(t, e = {}) { } const ZR = /* @__PURE__ */ new TextEncoder(); function _v(t, e = {}) { - return typeof t == "number" || typeof t == "bigint" ? eD(t, e) : typeof t == "boolean" ? QR(t, e) : ma(t) ? No(t, e) : A5(t, e); + return typeof t == "number" || typeof t == "bigint" ? eD(t, e) : typeof t == "boolean" ? QR(t, e) : ma(t) ? No(t, e) : P5(t, e); } function QR(t, e = {}) { const r = new Uint8Array(1); @@ -1196,7 +1197,7 @@ const po = { a: 97, f: 102 }; -function b2(t) { +function y2(t) { if (t >= po.zero && t <= po.nine) return t - po.zero; if (t >= po.A && t <= po.F) @@ -1211,7 +1212,7 @@ function No(t, e = {}) { n.length % 2 && (n = `0${n}`); const i = n.length / 2, s = new Uint8Array(i); for (let o = 0, a = 0; o < i; o++) { - const u = b2(n.charCodeAt(a++)), l = b2(n.charCodeAt(a++)); + const u = y2(n.charCodeAt(a++)), l = y2(n.charCodeAt(a++)); if (u === void 0 || l === void 0) throw new yt(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`); s[o] = u * 16 + l; @@ -1222,7 +1223,7 @@ function eD(t, e) { const r = Mr(t, e); return No(r); } -function A5(t, e = {}) { +function P5(t, e = {}) { const r = ZR.encode(t); return typeof e.size == "number" ? (eo(r, { size: e.size }), Cu(r, { dir: "right", size: e.size })) : r; } @@ -1239,7 +1240,7 @@ function Nl(t, ...e) { if (e.length > 0 && !e.includes(t.length)) throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`); } -function cse(t) { +function use(t) { if (typeof t != "function" || typeof t.create != "function") throw new Error("Hash should be wrapped by utils.wrapConstructor"); zd(t.outputLen), zd(t.blockLen); @@ -1250,15 +1251,15 @@ function Hd(t, e = !0) { if (e && t.finished) throw new Error("Hash#digest() has already been called"); } -function P5(t, e) { +function M5(t, e) { Nl(t); const r = e.outputLen; if (t.length < r) throw new Error(`digestInto() expects output buffer of length at least ${r}`); } -const td = /* @__PURE__ */ BigInt(2 ** 32 - 1), y2 = /* @__PURE__ */ BigInt(32); +const td = /* @__PURE__ */ BigInt(2 ** 32 - 1), w2 = /* @__PURE__ */ BigInt(32); function rD(t, e = !1) { - return e ? { h: Number(t & td), l: Number(t >> y2 & td) } : { h: Number(t >> y2 & td) | 0, l: Number(t & td) | 0 }; + return e ? { h: Number(t & td), l: Number(t >> w2 & td) } : { h: Number(t >> w2 & td) | 0, l: Number(t & td) | 0 }; } function nD(t, e = !1) { let r = new Uint32Array(t.length), n = new Uint32Array(t.length); @@ -1270,8 +1271,8 @@ function nD(t, e = !1) { } const iD = (t, e, r) => t << r | e >>> 32 - r, sD = (t, e, r) => e << r | t >>> 32 - r, oD = (t, e, r) => e << r - 32 | t >>> 64 - r, aD = (t, e, r) => t << r - 32 | e >>> 64 - r, jc = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0; /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -const cD = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), Fg = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), Os = (t, e) => t << 32 - e | t >>> e, w2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, uD = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255; -function x2(t) { +const cD = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), Fg = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), Os = (t, e) => t << 32 - e | t >>> e, x2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, uD = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255; +function _2(t) { for (let e = 0; e < t.length; e++) t[e] = uD(t[e]); } @@ -1291,7 +1292,7 @@ function hD(t) { function I0(t) { return typeof t == "string" && (t = hD(t)), Nl(t), t; } -function use(...t) { +function fse(...t) { let e = 0; for (let n = 0; n < t.length; n++) { const i = t[n]; @@ -1304,13 +1305,13 @@ function use(...t) { } return r; } -class M5 { +class I5 { // Safe version that clones internal state clone() { return this._cloneInto(); } } -function I5(t) { +function C5(t) { const e = (n) => t().update(I0(n)).digest(), r = t(); return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = () => t(), e; } @@ -1318,35 +1319,35 @@ function dD(t) { const e = (n, i) => t(i).update(I0(n)).digest(), r = t({}); return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = (n) => t(n), e; } -function fse(t = 32) { +function lse(t = 32) { if (jc && typeof jc.getRandomValues == "function") return jc.getRandomValues(new Uint8Array(t)); if (jc && typeof jc.randomBytes == "function") return jc.randomBytes(t); throw new Error("crypto.getRandomValues must be defined"); } -const C5 = [], T5 = [], R5 = [], pD = /* @__PURE__ */ BigInt(0), bf = /* @__PURE__ */ BigInt(1), gD = /* @__PURE__ */ BigInt(2), mD = /* @__PURE__ */ BigInt(7), vD = /* @__PURE__ */ BigInt(256), bD = /* @__PURE__ */ BigInt(113); +const T5 = [], R5 = [], D5 = [], pD = /* @__PURE__ */ BigInt(0), bf = /* @__PURE__ */ BigInt(1), gD = /* @__PURE__ */ BigInt(2), mD = /* @__PURE__ */ BigInt(7), vD = /* @__PURE__ */ BigInt(256), bD = /* @__PURE__ */ BigInt(113); for (let t = 0, e = bf, r = 1, n = 0; t < 24; t++) { - [r, n] = [n, (2 * r + 3 * n) % 5], C5.push(2 * (5 * n + r)), T5.push((t + 1) * (t + 2) / 2 % 64); + [r, n] = [n, (2 * r + 3 * n) % 5], T5.push(2 * (5 * n + r)), R5.push((t + 1) * (t + 2) / 2 % 64); let i = pD; for (let s = 0; s < 7; s++) e = (e << bf ^ (e >> mD) * bD) % vD, e & gD && (i ^= bf << (bf << /* @__PURE__ */ BigInt(s)) - bf); - R5.push(i); + D5.push(i); } -const [yD, wD] = /* @__PURE__ */ nD(R5, !0), _2 = (t, e, r) => r > 32 ? oD(t, e, r) : iD(t, e, r), E2 = (t, e, r) => r > 32 ? aD(t, e, r) : sD(t, e, r); -function D5(t, e = 24) { +const [yD, wD] = /* @__PURE__ */ nD(D5, !0), E2 = (t, e, r) => r > 32 ? oD(t, e, r) : iD(t, e, r), S2 = (t, e, r) => r > 32 ? aD(t, e, r) : sD(t, e, r); +function O5(t, e = 24) { const r = new Uint32Array(10); for (let n = 24 - e; n < 24; n++) { for (let o = 0; o < 10; o++) r[o] = t[o] ^ t[o + 10] ^ t[o + 20] ^ t[o + 30] ^ t[o + 40]; for (let o = 0; o < 10; o += 2) { - const a = (o + 8) % 10, u = (o + 2) % 10, l = r[u], d = r[u + 1], g = _2(l, d, 1) ^ r[a], w = E2(l, d, 1) ^ r[a + 1]; + const a = (o + 8) % 10, u = (o + 2) % 10, l = r[u], d = r[u + 1], g = E2(l, d, 1) ^ r[a], w = S2(l, d, 1) ^ r[a + 1]; for (let A = 0; A < 50; A += 10) t[o + A] ^= g, t[o + A + 1] ^= w; } let i = t[2], s = t[3]; for (let o = 0; o < 24; o++) { - const a = T5[o], u = _2(i, s, a), l = E2(i, s, a), d = C5[o]; + const a = R5[o], u = E2(i, s, a), l = S2(i, s, a), d = T5[o]; i = t[d], s = t[d + 1], t[d] = u, t[d + 1] = l; } for (let o = 0; o < 50; o += 10) { @@ -1359,7 +1360,7 @@ function D5(t, e = 24) { } r.fill(0); } -class Ll extends M5 { +class Ll extends I5 { // NOTE: we accept arguments in bytes instead of bits here. constructor(e, r, n, i = !1, s = 24) { if (super(), this.blockLen = e, this.suffix = r, this.outputLen = n, this.enableXOF = i, this.rounds = s, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, zd(n), 0 >= this.blockLen || this.blockLen >= 200) @@ -1367,7 +1368,7 @@ class Ll extends M5 { this.state = new Uint8Array(200), this.state32 = cD(this.state); } keccak() { - w2 || x2(this.state32), D5(this.state32, this.rounds), w2 || x2(this.state32), this.posOut = 0, this.pos = 0; + x2 || _2(this.state32), O5(this.state32, this.rounds), x2 || _2(this.state32), this.posOut = 0, this.pos = 0; } update(e) { Hd(this); @@ -1408,7 +1409,7 @@ class Ll extends M5 { return zd(e), this.xofInto(new Uint8Array(e)); } digestInto(e) { - if (P5(e, this), this.finished) + if (M5(e, this), this.finished) throw new Error("digest() was already called"); return this.writeInto(e), this.destroy(), e; } @@ -1423,12 +1424,12 @@ class Ll extends M5 { return e || (e = new Ll(r, n, i, o, s)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = s, e.suffix = n, e.outputLen = i, e.enableXOF = o, e.destroyed = this.destroyed, e; } } -const Aa = (t, e, r) => I5(() => new Ll(e, t, r)), xD = /* @__PURE__ */ Aa(6, 144, 224 / 8), _D = /* @__PURE__ */ Aa(6, 136, 256 / 8), ED = /* @__PURE__ */ Aa(6, 104, 384 / 8), SD = /* @__PURE__ */ Aa(6, 72, 512 / 8), AD = /* @__PURE__ */ Aa(1, 144, 224 / 8), O5 = /* @__PURE__ */ Aa(1, 136, 256 / 8), PD = /* @__PURE__ */ Aa(1, 104, 384 / 8), MD = /* @__PURE__ */ Aa(1, 72, 512 / 8), N5 = (t, e, r) => dD((n = {}) => new Ll(e, t, n.dkLen === void 0 ? r : n.dkLen, !0)), ID = /* @__PURE__ */ N5(31, 168, 128 / 8), CD = /* @__PURE__ */ N5(31, 136, 256 / 8), TD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +const Aa = (t, e, r) => C5(() => new Ll(e, t, r)), xD = /* @__PURE__ */ Aa(6, 144, 224 / 8), _D = /* @__PURE__ */ Aa(6, 136, 256 / 8), ED = /* @__PURE__ */ Aa(6, 104, 384 / 8), SD = /* @__PURE__ */ Aa(6, 72, 512 / 8), AD = /* @__PURE__ */ Aa(1, 144, 224 / 8), N5 = /* @__PURE__ */ Aa(1, 136, 256 / 8), PD = /* @__PURE__ */ Aa(1, 104, 384 / 8), MD = /* @__PURE__ */ Aa(1, 72, 512 / 8), L5 = (t, e, r) => dD((n = {}) => new Ll(e, t, n.dkLen === void 0 ? r : n.dkLen, !0)), ID = /* @__PURE__ */ L5(31, 168, 128 / 8), CD = /* @__PURE__ */ L5(31, 136, 256 / 8), TD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, Keccak: Ll, - keccakP: D5, + keccakP: O5, keccak_224: AD, - keccak_256: O5, + keccak_256: N5, keccak_384: PD, keccak_512: MD, sha3_224: xD, @@ -1439,7 +1440,7 @@ const Aa = (t, e, r) => I5(() => new Ll(e, t, r)), xD = /* @__PURE__ */ Aa(6, 14 shake256: CD }, Symbol.toStringTag, { value: "Module" })); function kl(t, e) { - const r = e || "hex", n = O5(ma(t, { strict: !1 }) ? _v(t) : t); + const r = e || "hex", n = N5(ma(t, { strict: !1 }) ? _v(t) : t); return r === "bytes" ? n : qd(n); } const RD = (t) => kl(_v(t)); @@ -1475,10 +1476,10 @@ const ND = (t) => { const e = typeof t == "string" ? t : OR(t); return OD(e); }; -function L5(t) { +function k5(t) { return DD(ND(t)); } -const LD = L5; +const LD = k5; class bu extends yt { constructor({ address: e }) { super(`Address "${e}" is invalid.`, { @@ -1515,13 +1516,13 @@ const Bg = /* @__PURE__ */ new C0(8192); function $l(t, e) { if (Bg.has(`${t}.${e}`)) return Bg.get(`${t}.${e}`); - const r = t.substring(2).toLowerCase(), n = kl(A5(r), "bytes"), i = r.split(""); + const r = t.substring(2).toLowerCase(), n = kl(P5(r), "bytes"), i = r.split(""); for (let o = 0; o < 40; o += 2) n[o >> 1] >> 4 >= 8 && i[o] && (i[o] = i[o].toUpperCase()), (n[o >> 1] & 15) >= 8 && i[o + 1] && (i[o + 1] = i[o + 1].toUpperCase()); const s = `0x${i.join("")}`; return Bg.set(`${t}.${e}`, s), s; } -function k5(t, e) { +function Ev(t, e) { if (!Lo(t, { strict: !1 })) throw new bu({ address: t }); return $l(t, e); @@ -1559,7 +1560,7 @@ function Wd(t, e, r, { strict: n } = {}) { } function $5(t, e) { if (typeof e == "number" && e > 0 && e > An(t) - 1) - throw new _5({ + throw new E5({ offset: e, position: "start", size: An(t) @@ -1567,7 +1568,7 @@ function $5(t, e) { } function F5(t, e, r) { if (typeof e == "number" && typeof r == "number" && An(t) !== r - e) - throw new _5({ + throw new E5({ offset: r, position: "end", size: An(t) @@ -1592,17 +1593,17 @@ function U5(t, e) { const r = BD({ params: t, values: e - }), n = Sv(r); + }), n = Av(r); return n.length === 0 ? "0x" : n; } function BD({ params: t, values: e }) { const r = []; for (let n = 0; n < t.length; n++) - r.push(Ev({ param: t[n], value: e[n] })); + r.push(Sv({ param: t[n], value: e[n] })); return r; } -function Ev({ param: t, value: e }) { - const r = Av(t.type); +function Sv({ param: t, value: e }) { + const r = Pv(t.type); if (r) { const [n, i] = r; return jD(e, { length: n, param: { ...t, type: i } }); @@ -1627,7 +1628,7 @@ function Ev({ param: t, value: e }) { docsPath: "/docs/contract/encodeAbiParameters" }); } -function Sv(t) { +function Av(t) { let e = 0; for (let s = 0; s < t.length; s++) { const { dynamic: o, encoded: a } = t[s]; @@ -1659,11 +1660,11 @@ function jD(t, { length: e, param: r }) { let i = !1; const s = []; for (let o = 0; o < t.length; o++) { - const a = Ev({ param: r, value: t[o] }); + const a = Sv({ param: r, value: t[o] }); a.dynamic && (i = !0), s.push(a); } if (n || i) { - const o = Sv(s); + const o = Av(s); if (n) { const a = Mr(s.length, { size: 32 }); return { @@ -1701,7 +1702,7 @@ function qD(t, { param: e }) { function zD(t) { if (typeof t != "boolean") throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`); - return { dynamic: !1, encoded: ga(S5(t)) }; + return { dynamic: !1, encoded: ga(A5(t)) }; } function HD(t, { signed: e }) { return { @@ -1730,7 +1731,7 @@ function KD(t, { param: e }) { let r = !1; const n = []; for (let i = 0; i < e.components.length; i++) { - const s = e.components[i], o = Array.isArray(t) ? i : s.name, a = Ev({ + const s = e.components[i], o = Array.isArray(t) ? i : s.name, a = Sv({ param: s, value: t[o] }); @@ -1738,19 +1739,19 @@ function KD(t, { param: e }) { } return { dynamic: r, - encoded: r ? Sv(n) : yu(n.map(({ encoded: i }) => i)) + encoded: r ? Av(n) : yu(n.map(({ encoded: i }) => i)) }; } -function Av(t) { +function Pv(t) { const e = t.match(/^(.*)\[(\d+)?\]$/); return e ? ( // Return `null` if the array is dynamic. [e[2] ? Number(e[2]) : null, e[1]] ) : void 0; } -const Pv = (t) => Wd(L5(t), 0, 4); +const Mv = (t) => Wd(k5(t), 0, 4); function j5(t) { - const { abi: e, args: r = [], name: n } = t, i = ma(n, { strict: !1 }), s = e.filter((a) => i ? a.type === "function" ? Pv(a) === n : a.type === "event" ? LD(a) === n : !1 : "name" in a && a.name === n); + const { abi: e, args: r = [], name: n } = t, i = ma(n, { strict: !1 }), s = e.filter((a) => i ? a.type === "function" ? Mv(a) === n : a.type === "event" ? LD(a) === n : !1 : "name" in a && a.name === n); if (s.length === 0) return; if (s.length === 1) @@ -1818,7 +1819,7 @@ function q5(t, e, r) { function jo(t) { return typeof t == "string" ? { address: t, type: "json-rpc" } : t; } -const S2 = "/docs/contract/encodeFunctionData"; +const A2 = "/docs/contract/encodeFunctionData"; function VD(t) { const { abi: e, args: r, functionName: n } = t; let i = e[0]; @@ -1829,14 +1830,14 @@ function VD(t) { name: n }); if (!s) - throw new m2(n, { docsPath: S2 }); + throw new v2(n, { docsPath: A2 }); i = s; } if (i.type !== "function") - throw new m2(void 0, { docsPath: S2 }); + throw new v2(void 0, { docsPath: A2 }); return { abi: [i], - functionName: Pv(mu(i)) + functionName: Mv(mu(i)) }; } function GD(t) { @@ -1875,7 +1876,7 @@ const YD = { name: "Panic", type: "error" }; -class A2 extends yt { +class P2 extends yt { constructor({ offset: e }) { super(`Offset \`${e}\` cannot be negative.`, { name: "NegativeOffsetError" @@ -1915,7 +1916,7 @@ const eO = { }, decrementPosition(t) { if (t < 0) - throw new A2({ offset: t }); + throw new P2({ offset: t }); const e = this.position - t; this.assertPosition(e), this.position = e; }, @@ -1924,7 +1925,7 @@ const eO = { }, incrementPosition(t) { if (t < 0) - throw new A2({ offset: t }); + throw new P2({ offset: t }); const e = this.position + t; this.assertPosition(e), this.position = e; }, @@ -2014,7 +2015,7 @@ const eO = { this.positionReadCount.set(this.position, t + 1), t > 0 && this.recursiveReadCount++; } }; -function Mv(t, { recursiveReadLimit: e = 8192 } = {}) { +function Iv(t, { recursiveReadLimit: e = 8192 } = {}) { const r = Object.create(eO); return r.bytes = t, r.dataView = new DataView(t.buffer, t.byteOffset, t.byteLength), r.positionReadCount = /* @__PURE__ */ new Map(), r.recursiveReadLimit = e, r; } @@ -2039,7 +2040,7 @@ function nO(t, e = {}) { return typeof e.size < "u" && (eo(r, { size: e.size }), r = xv(r, { dir: "right" })), new TextDecoder().decode(r); } function iO(t, e) { - const r = typeof e == "string" ? No(e) : e, n = Mv(r); + const r = typeof e == "string" ? No(e) : e, n = Iv(r); if (An(r) === 0 && t.length > 0) throw new wv(); if (An(e) && An(e) < 32) @@ -2061,7 +2062,7 @@ function iO(t, e) { return s; } function ou(t, e, { staticPosition: r }) { - const n = Av(e.type); + const n = Pv(e.type); if (n) { const [i, s] = n; return oO(t, { ...e, type: s }, { length: i, staticPosition: r }); @@ -2082,16 +2083,16 @@ function ou(t, e, { staticPosition: r }) { docsPath: "/docs/contract/decodeAbiParameters" }); } -const P2 = 32, Zm = 32; +const M2 = 32, Zm = 32; function sO(t) { const e = t.readBytes(32); return [$l(wi(B5(e, -20))), 32]; } function oO(t, e, { length: r, staticPosition: n }) { if (!r) { - const o = Mo(t.readBytes(Zm)), a = n + o, u = a + P2; + const o = Mo(t.readBytes(Zm)), a = n + o, u = a + M2; t.setPosition(a); - const l = Mo(t.readBytes(P2)), d = el(e); + const l = Mo(t.readBytes(M2)), d = el(e); let g = 0; const w = []; for (let A = 0; A < l; ++A) { @@ -2186,16 +2187,16 @@ function el(t) { return !0; if (e === "tuple") return (n = t.components) == null ? void 0 : n.some(el); - const r = Av(t.type); + const r = Pv(t.type); return !!(r && el({ ...t, type: r[1] })); } function hO(t) { const { abi: e, data: r } = t, n = Wd(r, 0, 4); if (n === "0x") throw new wv(); - const s = [...e || [], JD, XD].find((o) => o.type === "error" && n === Pv(mu(o))); + const s = [...e || [], JD, XD].find((o) => o.type === "error" && n === Mv(mu(o))); if (!s) - throw new x5(n, { + throw new _5(n, { docsPath: "/docs/contract/decodeErrorResult" }); return { @@ -2403,7 +2404,7 @@ class _O extends yt { } else i && (u = i); let l; - s instanceof x5 && (l = s.signature, a = [ + s instanceof _5 && (l = s.signature, a = [ `Unable to decode signature "${l}" as it was not found on the provided ABI.`, "Make sure you are using the correct ABI and that the error exists on it.", `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.` @@ -2849,17 +2850,17 @@ function TO(t) { return $l(`0x${e}`); } async function RO({ hash: t, signature: e }) { - const r = ma(t) ? t : qd(t), { secp256k1: n } = await import("./secp256k1-BZeczIQv.js"); + const r = ma(t) ? t : qd(t), { secp256k1: n } = await import("./secp256k1-CWJe94hK.js"); return `0x${(() => { if (typeof e == "object" && "r" in e && "s" in e) { - const { r: l, s: d, v: g, yParity: w } = e, A = Number(w ?? g), M = M2(A); + const { r: l, s: d, v: g, yParity: w } = e, A = Number(w ?? g), M = I2(A); return new n.Signature(Qf(l), Qf(d)).addRecoveryBit(M); } - const o = ma(e) ? e : qd(e), a = vu(`0x${o.slice(130)}`), u = M2(a); + const o = ma(e) ? e : qd(e), a = vu(`0x${o.slice(130)}`), u = I2(a); return n.Signature.fromCompact(o.substring(2, 130)).addRecoveryBit(u); })().recoverPublicKey(r.substring(2)).toHex(!1)}`; } -function M2(t) { +function I2(t) { if (t === 0 || t === 1) return t; if (t === 27) @@ -2872,7 +2873,7 @@ async function DO({ hash: t, signature: e }) { return TO(await RO({ hash: t, signature: e })); } function OO(t, e = "hex") { - const r = G5(t), n = Mv(new Uint8Array(r.length)); + const r = G5(t), n = Iv(new Uint8Array(r.length)); return r.encode(n), e === "hex" ? wi(n.bytes) : n.bytes; } function G5(t) { @@ -3131,7 +3132,7 @@ Object.defineProperty(Vd, "nodeMessage", { writable: !0, value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/ }); -class Iv extends yt { +class Cv extends yt { constructor({ cause: e }) { super(`An error occurred while executing: ${e == null ? void 0 : e.shortMessage}`, { cause: e, @@ -3157,14 +3158,14 @@ function X5(t, e) { cause: t, maxFeePerGas: e == null ? void 0 : e.maxFeePerGas, maxPriorityFeePerGas: e == null ? void 0 : e.maxPriorityFeePerGas - }) : new Iv({ + }) : new Cv({ cause: t }); } function FO(t, { docsPath: e, ...r }) { const n = (() => { const i = X5(t, r); - return i instanceof Iv ? t : i; + return i instanceof Cv ? t : i; })(); return new $O(n, { docsPath: e, @@ -3190,7 +3191,7 @@ const BO = { eip4844: "0x3", eip7702: "0x4" }; -function Cv(t) { +function Tv(t) { const e = {}; return typeof t.authorizationList < "u" && (e.authorizationList = UO(t.authorizationList)), typeof t.accessList < "u" && (e.accessList = t.accessList), typeof t.blobVersionedHashes < "u" && (e.blobVersionedHashes = t.blobVersionedHashes), typeof t.blobs < "u" && (typeof t.blobs[0] != "string" ? e.blobs = t.blobs.map((r) => wi(r)) : e.blobs = t.blobs), typeof t.data < "u" && (e.data = t.data), typeof t.from < "u" && (e.from = t.from), typeof t.gas < "u" && (e.gas = Mr(t.gas)), typeof t.gasPrice < "u" && (e.gasPrice = Mr(t.gasPrice)), typeof t.maxFeePerBlobGas < "u" && (e.maxFeePerBlobGas = Mr(t.maxFeePerBlobGas)), typeof t.maxFeePerGas < "u" && (e.maxFeePerGas = Mr(t.maxFeePerGas)), typeof t.maxPriorityFeePerGas < "u" && (e.maxPriorityFeePerGas = Mr(t.maxPriorityFeePerGas)), typeof t.nonce < "u" && (e.nonce = Mr(t.nonce)), typeof t.to < "u" && (e.to = t.to), typeof t.type < "u" && (e.type = BO[t.type]), typeof t.value < "u" && (e.value = Mr(t.value)), e; } @@ -3205,17 +3206,17 @@ function UO(t) { ...typeof e.v < "u" && typeof e.yParity > "u" ? { v: Mr(e.v) } : {} })); } -function I2(t) { +function C2(t) { if (!(!t || t.length === 0)) return t.reduce((e, { slot: r, value: n }) => { if (r.length !== 66) - throw new v2({ + throw new b2({ size: r.length, targetSize: 66, type: "hex" }); if (n.length !== 66) - throw new v2({ + throw new b2({ size: n.length, targetSize: 66, type: "hex" @@ -3225,10 +3226,10 @@ function I2(t) { } function jO(t) { const { balance: e, nonce: r, state: n, stateDiff: i, code: s } = t, o = {}; - if (s !== void 0 && (o.code = s), e !== void 0 && (o.balance = Mr(e)), r !== void 0 && (o.nonce = Mr(r)), n !== void 0 && (o.state = I2(n)), i !== void 0) { + if (s !== void 0 && (o.code = s), e !== void 0 && (o.balance = Mr(e)), r !== void 0 && (o.nonce = Mr(r)), n !== void 0 && (o.state = C2(n)), i !== void 0) { if (o.state) throw new mO(); - o.stateDiff = I2(i); + o.stateDiff = C2(i); } return o; } @@ -3266,7 +3267,7 @@ class HO extends yt { }); } } -class Tv extends yt { +class Rv extends yt { constructor() { super("Chain does not support EIP-1559 fees.", { name: "Eip1559FeesNotSupportedError" @@ -3400,12 +3401,12 @@ async function XO(t, e) { vi(t, Q5, "getGasPrice")({}) ]); if (typeof a.baseFeePerGas != "bigint") - throw new Tv(); + throw new Rv(); const l = u - a.baseFeePerGas; return l < 0n ? 0n : l; } } -async function C2(t, e) { +async function T2(t, e) { var w, A; const { block: r, chain: n = t.chain, request: i, type: s = "eip1559" } = e || {}, o = await (async () => { var M, N; @@ -3431,7 +3432,7 @@ async function C2(t, e) { } if (s === "eip1559") { if (typeof d.baseFeePerGas != "bigint") - throw new Tv(); + throw new Rv(); const M = typeof (i == null ? void 0 : i.maxPriorityFeePerGas) == "bigint" ? i.maxPriorityFeePerGas : await XO(t, { block: d, chain: n, @@ -3474,7 +3475,7 @@ function QO(t, e, r, n) { t.setUint32(e + u, o, n), t.setUint32(e + l, a, n); } const eN = (t, e, r) => t & e ^ ~t & r, tN = (t, e, r) => t & e ^ t & r ^ e & r; -class rN extends M5 { +class rN extends I5 { constructor(e, r, n, i) { super(), this.blockLen = e, this.outputLen = r, this.padOffset = n, this.isLE = i, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(e), this.view = Fg(this.buffer); } @@ -3496,7 +3497,7 @@ class rN extends M5 { return this.length += e.length, this.roundClean(), this; } digestInto(e) { - Hd(this), P5(e, this), this.finished = !0; + Hd(this), M5(e, this), this.finished = !0; const { buffer: r, view: n, blockLen: i, isLE: s } = this; let { pos: o } = this; r[o++] = 128, this.buffer.subarray(o).fill(0), this.padOffset > i - o && (this.process(n, 0), o = 0); @@ -3632,7 +3633,7 @@ let iN = class extends rN { this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0); } }; -const r4 = /* @__PURE__ */ I5(() => new iN()); +const r4 = /* @__PURE__ */ C5(() => new iN()); function sN(t, e) { return r4(ma(t, { strict: !1 }) ? _v(t) : t); } @@ -3650,9 +3651,9 @@ function aN(t) { })); return i; } -const T2 = 6, n4 = 32, Rv = 4096, i4 = n4 * Rv, R2 = i4 * T2 - // terminator byte (0x80). +const R2 = 6, n4 = 32, Dv = 4096, i4 = n4 * Dv, D2 = i4 * R2 - // terminator byte (0x80). 1 - // zero byte (0x00) appended to each field element. -1 * Rv * T2; +1 * Dv * R2; class cN extends yt { constructor({ maxSize: e, size: r }) { super("Blob size is too large.", { @@ -3670,17 +3671,17 @@ function fN(t) { const e = t.to ?? (typeof t.data == "string" ? "hex" : "bytes"), r = typeof t.data == "string" ? No(t.data) : t.data, n = An(r); if (!n) throw new uN(); - if (n > R2) + if (n > D2) throw new cN({ - maxSize: R2, + maxSize: D2, size: n }); const i = []; let s = !0, o = 0; for (; s; ) { - const a = Mv(new Uint8Array(i4)); + const a = Iv(new Uint8Array(i4)); let u = 0; - for (; u < Rv; ) { + for (; u < Dv; ) { const l = r.slice(o, o + (n4 - 1)); if (a.pushByte(0), a.pushBytes(l), l.length < 31) { a.pushByte(128), s = !1; @@ -3729,7 +3730,7 @@ const s4 = [ "nonce", "type" ]; -async function Dv(t, e) { +async function Ov(t, e) { const { account: r = t.account, blobs: n, chain: i, gas: s, kzg: o, nonce: a, nonceManager: u, parameters: l = s4, type: d } = e, g = r && jo(r), w = { ...e, ...g ? { from: g == null ? void 0 : g.address } : {} }; let A; async function M() { @@ -3740,19 +3741,19 @@ async function Dv(t, e) { return N || (i ? i.id : typeof e.chainId < "u" ? e.chainId : (N = await vi(t, O0, "getChainId")({}), N)); } if ((l.includes("blobVersionedHashes") || l.includes("sidecars")) && n && o) { - const F = e4({ blobs: n, kzg: o }); + const $ = e4({ blobs: n, kzg: o }); if (l.includes("blobVersionedHashes")) { - const $ = aN({ - commitments: F, + const F = aN({ + commitments: $, to: "hex" }); - w.blobVersionedHashes = $; + w.blobVersionedHashes = F; } if (l.includes("sidecars")) { - const $ = t4({ blobs: n, commitments: F, kzg: o }), K = lN({ + const F = t4({ blobs: n, commitments: $, kzg: o }), K = lN({ blobs: n, - commitments: F, - proofs: $, + commitments: $, + proofs: F, to: "hex" }); w.sidecars = K; @@ -3760,10 +3761,10 @@ async function Dv(t, e) { } if (l.includes("chainId") && (w.chainId = await L()), l.includes("nonce") && typeof a > "u" && g) if (u) { - const F = await L(); + const $ = await L(); w.nonce = await u.consume({ address: g.address, - chainId: F, + chainId: $, client: t }); } else @@ -3775,14 +3776,14 @@ async function Dv(t, e) { try { w.type = hN(w); } catch { - const F = await M(); - w.type = typeof (F == null ? void 0 : F.baseFeePerGas) == "bigint" ? "eip1559" : "legacy"; + const $ = await M(); + w.type = typeof ($ == null ? void 0 : $.baseFeePerGas) == "bigint" ? "eip1559" : "legacy"; } if (l.includes("fees")) if (w.type !== "legacy" && w.type !== "eip2930") { if (typeof w.maxFeePerGas > "u" || typeof w.maxPriorityFeePerGas > "u") { - const F = await M(), { maxFeePerGas: $, maxPriorityFeePerGas: K } = await C2(t, { - block: F, + const $ = await M(), { maxFeePerGas: F, maxPriorityFeePerGas: K } = await T2(t, { + block: $, chain: i, request: w }); @@ -3790,18 +3791,18 @@ async function Dv(t, e) { throw new WO({ maxPriorityFeePerGas: K }); - w.maxPriorityFeePerGas = K, w.maxFeePerGas = $; + w.maxPriorityFeePerGas = K, w.maxFeePerGas = F; } } else { if (typeof e.maxFeePerGas < "u" || typeof e.maxPriorityFeePerGas < "u") - throw new Tv(); - const F = await M(), { gasPrice: $ } = await C2(t, { - block: F, + throw new Rv(); + const $ = await M(), { gasPrice: F } = await T2(t, { + block: $, chain: i, request: w, type: "legacy" }); - w.gasPrice = $; + w.gasPrice = F; } return l.includes("gas") && typeof s > "u" && (w.gas = await vi(t, pN, "estimateGas")({ ...w, @@ -3826,7 +3827,7 @@ async function pN(t, e) { params: E ? [_, x ?? "latest", E] : x ? [_, x] : [_] }); }; - const { accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, blockNumber: g, blockTag: w, data: A, gas: M, gasPrice: N, maxFeePerBlobGas: L, maxFeePerGas: F, maxPriorityFeePerGas: $, nonce: K, value: H, stateOverride: V, ...te } = await Dv(t, { + const { accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, blockNumber: g, blockTag: w, data: A, gas: M, gasPrice: N, maxFeePerBlobGas: L, maxFeePerGas: $, maxPriorityFeePerGas: F, nonce: K, value: H, stateOverride: V, ...te } = await Ov(t, { ...e, parameters: ( // Some RPC Providers do not compute versioned hashes from blobs. We will need @@ -3844,7 +3845,7 @@ async function pN(t, e) { }); })(); D0(e); - const Y = (o = (s = (i = t.chain) == null ? void 0 : i.formatters) == null ? void 0 : s.transactionRequest) == null ? void 0 : o.format, m = (Y || Cv)({ + const Y = (o = (s = (i = t.chain) == null ? void 0 : i.formatters) == null ? void 0 : s.transactionRequest) == null ? void 0 : o.format, m = (Y || Tv)({ // Pick out extra data that might exist on the chain's transaction request type. ...Z5(te, { format: Y }), from: n == null ? void 0 : n.address, @@ -3856,8 +3857,8 @@ async function pN(t, e) { gas: M, gasPrice: N, maxFeePerBlobGas: L, - maxFeePerGas: F, - maxPriorityFeePerGas: $, + maxFeePerGas: $, + maxPriorityFeePerGas: F, nonce: K, to: Ee, value: H @@ -3920,9 +3921,9 @@ function vN(t) { if (!i) throw new LR({ docsPath: jg }); if (!("inputs" in i)) - throw new g2({ docsPath: jg }); + throw new m2({ docsPath: jg }); if (!i.inputs || i.inputs.length === 0) - throw new g2({ docsPath: jg }); + throw new m2({ docsPath: jg }); const s = U5(i.inputs, r); return T0([n, s]); } @@ -3960,7 +3961,7 @@ function o4({ chain: t, currentChainId: e }) { function yN(t, { docsPath: e, ...r }) { const n = (() => { const i = X5(t, r); - return i instanceof Iv ? t : i; + return i instanceof Cv ? t : i; })(); return new yO(n, { docsPath: e, @@ -3974,8 +3975,8 @@ async function a4(t, { serializedTransaction: e }) { }, { retryCount: 0 }); } const zg = new C0(128); -async function Ov(t, e) { - var F, $, K, H; +async function Nv(t, e) { + var $, F, K, H; const { account: r = t.account, chain: n = t.chain, accessList: i, authorizationList: s, blobs: o, data: a, gas: u, gasPrice: l, maxFeePerBlobGas: d, maxFeePerGas: g, maxPriorityFeePerGas: w, nonce: A, value: M, ...N } = e; if (typeof r > "u") throw new Fl({ @@ -4000,7 +4001,7 @@ async function Ov(t, e) { currentChainId: te, chain: n })); - const R = (K = ($ = (F = t.chain) == null ? void 0 : F.formatters) == null ? void 0 : $.transactionRequest) == null ? void 0 : K.format, pe = (R || Cv)({ + const R = (K = (F = ($ = t.chain) == null ? void 0 : $.formatters) == null ? void 0 : F.transactionRequest) == null ? void 0 : K.format, pe = (R || Tv)({ // Pick out extra data that might exist on the chain's transaction request type. ...Z5(N, { format: R }), accessList: i, @@ -4039,7 +4040,7 @@ async function Ov(t, e) { } } if ((L == null ? void 0 : L.type) === "local") { - const te = await vi(t, Dv, "prepareTransactionRequest")({ + const te = await vi(t, Ov, "prepareTransactionRequest")({ account: L, accessList: i, authorizationList: s, @@ -4094,7 +4095,7 @@ async function wN(t, e) { functionName: a }); try { - return await vi(t, Ov, "sendTransaction")({ + return await vi(t, Nv, "sendTransaction")({ data: `${d}${o ? o.replace("0x", "") : ""}`, to: i, account: l, @@ -4155,11 +4156,11 @@ function _N(t) { uid: c4() }; function N(L) { - return (F) => { - const $ = F(L); + return ($) => { + const F = $(L); for (const H in M) - delete $[H]; - const K = { ...L, ...$ }; + delete F[H]; + const K = { ...L, ...F }; return Object.assign(K, { extend: N(K) }); }; } @@ -4337,10 +4338,10 @@ function LN(t) { for (const u of o) { const { name: l, type: d } = u, g = a[l], w = d.match(TN); if (w && (typeof g == "number" || typeof g == "bigint")) { - const [N, L, F] = w; + const [N, L, $] = w; Mr(g, { signed: L === "int", - size: Number.parseInt(F) / 8 + size: Number.parseInt($) / 8 }); } if (d === "address" && typeof g == "string" && !Lo(g)) @@ -4390,7 +4391,7 @@ function $N(t) { } function FN(t, e) { const { abi: r, args: n, bytecode: i, ...s } = e, o = vN({ abi: r, args: n, bytecode: i }); - return Ov(t, { + return Nv(t, { ...s, data: o }); @@ -4403,7 +4404,7 @@ async function UN(t) { return await t.request({ method: "wallet_getPermissions" }, { dedupe: !0 }); } async function jN(t) { - return (await t.request({ method: "eth_requestAccounts" }, { dedupe: !0, retryCount: 0 })).map((r) => k5(r)); + return (await t.request({ method: "eth_requestAccounts" }, { dedupe: !0, retryCount: 0 })).map((r) => Ev(r)); } async function qN(t, e) { return t.request({ @@ -4442,7 +4443,7 @@ async function HN(t, e) { currentChainId: o, chain: n }); - const a = (n == null ? void 0 : n.formatters) || ((l = t.chain) == null ? void 0 : l.formatters), u = ((d = a == null ? void 0 : a.transactionRequest) == null ? void 0 : d.format) || Cv; + const a = (n == null ? void 0 : n.formatters) || ((l = t.chain) == null ? void 0 : l.formatters), u = ((d = a == null ? void 0 : a.transactionRequest) == null ? void 0 : d.format) || Tv; return s.signTransaction ? s.signTransaction({ ...i, chainId: o @@ -4498,11 +4499,11 @@ function GN(t) { getAddresses: () => BN(t), getChainId: () => O0(t), getPermissions: () => UN(t), - prepareTransactionRequest: (e) => Dv(t, e), + prepareTransactionRequest: (e) => Ov(t, e), requestAddresses: () => jN(t), requestPermissions: (e) => qN(t, e), sendRawTransaction: (e) => a4(t, e), - sendTransaction: (e) => Ov(t, e), + sendTransaction: (e) => Nv(t, e), signMessage: (e) => zN(t, e), signTransaction: (e) => HN(t, e), signTypedData: (e) => WN(t, e), @@ -4613,7 +4614,7 @@ class ml { this._provider && "session" in this._provider && await this._provider.disconnect(), this._connected = !1, this._address = null; } } -var Nv = { exports: {} }, cu = typeof Reflect == "object" ? Reflect : null, D2 = cu && typeof cu.apply == "function" ? cu.apply : function(e, r, n) { +var Lv = { exports: {} }, cu = typeof Reflect == "object" ? Reflect : null, O2 = cu && typeof cu.apply == "function" ? cu.apply : function(e, r, n) { return Function.prototype.apply.call(e, r, n); }, wd; cu && typeof cu.ownKeys == "function" ? wd = cu.ownKeys : Object.getOwnPropertySymbols ? wd = function(e) { @@ -4630,13 +4631,13 @@ var u4 = Number.isNaN || function(e) { function kr() { kr.init.call(this); } -Nv.exports = kr; -Nv.exports.once = eL; +Lv.exports = kr; +Lv.exports.once = eL; kr.EventEmitter = kr; kr.prototype._events = void 0; kr.prototype._eventsCount = 0; kr.prototype._maxListeners = void 0; -var O2 = 10; +var N2 = 10; function N0(t) { if (typeof t != "function") throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof t); @@ -4644,12 +4645,12 @@ function N0(t) { Object.defineProperty(kr, "defaultMaxListeners", { enumerable: !0, get: function() { - return O2; + return N2; }, set: function(t) { if (typeof t != "number" || t < 0 || u4(t)) throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + t + "."); - O2 = t; + N2 = t; } }); kr.init = function() { @@ -4684,10 +4685,10 @@ kr.prototype.emit = function(e) { if (u === void 0) return !1; if (typeof u == "function") - D2(u, this, r); + O2(u, this, r); else for (var l = u.length, d = g4(u, l), n = 0; n < l; ++n) - D2(d[n], this, r); + O2(d[n], this, r); return !0; }; function l4(t, e, r, n) { @@ -4836,8 +4837,8 @@ function m4(t, e, r, n) { else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof t); } -var rs = Nv.exports; -const Lv = /* @__PURE__ */ ts(rs); +var rs = Lv.exports; +const kv = /* @__PURE__ */ ts(rs); var mt = {}; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. @@ -5148,10 +5149,10 @@ const xL = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __spreadArrays: hL, __values: f1 }, Symbol.toStringTag, { value: "Module" })), Bl = /* @__PURE__ */ bv(xL); -var Hg = {}, yf = {}, N2; +var Hg = {}, yf = {}, L2; function _L() { - if (N2) return yf; - N2 = 1, Object.defineProperty(yf, "__esModule", { value: !0 }), yf.delay = void 0; + if (L2) return yf; + L2 = 1, Object.defineProperty(yf, "__esModule", { value: !0 }), yf.delay = void 0; function t(e) { return new Promise((r) => { setTimeout(() => { @@ -5161,28 +5162,28 @@ function _L() { } return yf.delay = t, yf; } -var ja = {}, Wg = {}, qa = {}, L2; +var ja = {}, Wg = {}, qa = {}, k2; function EL() { - return L2 || (L2 = 1, Object.defineProperty(qa, "__esModule", { value: !0 }), qa.ONE_THOUSAND = qa.ONE_HUNDRED = void 0, qa.ONE_HUNDRED = 100, qa.ONE_THOUSAND = 1e3), qa; + return k2 || (k2 = 1, Object.defineProperty(qa, "__esModule", { value: !0 }), qa.ONE_THOUSAND = qa.ONE_HUNDRED = void 0, qa.ONE_HUNDRED = 100, qa.ONE_THOUSAND = 1e3), qa; } -var Kg = {}, k2; +var Kg = {}, $2; function SL() { - return k2 || (k2 = 1, function(t) { + return $2 || ($2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.ONE_YEAR = t.FOUR_WEEKS = t.THREE_WEEKS = t.TWO_WEEKS = t.ONE_WEEK = t.THIRTY_DAYS = t.SEVEN_DAYS = t.FIVE_DAYS = t.THREE_DAYS = t.ONE_DAY = t.TWENTY_FOUR_HOURS = t.TWELVE_HOURS = t.SIX_HOURS = t.THREE_HOURS = t.ONE_HOUR = t.SIXTY_MINUTES = t.THIRTY_MINUTES = t.TEN_MINUTES = t.FIVE_MINUTES = t.ONE_MINUTE = t.SIXTY_SECONDS = t.THIRTY_SECONDS = t.TEN_SECONDS = t.FIVE_SECONDS = t.ONE_SECOND = void 0, t.ONE_SECOND = 1, t.FIVE_SECONDS = 5, t.TEN_SECONDS = 10, t.THIRTY_SECONDS = 30, t.SIXTY_SECONDS = 60, t.ONE_MINUTE = t.SIXTY_SECONDS, t.FIVE_MINUTES = t.ONE_MINUTE * 5, t.TEN_MINUTES = t.ONE_MINUTE * 10, t.THIRTY_MINUTES = t.ONE_MINUTE * 30, t.SIXTY_MINUTES = t.ONE_MINUTE * 60, t.ONE_HOUR = t.SIXTY_MINUTES, t.THREE_HOURS = t.ONE_HOUR * 3, t.SIX_HOURS = t.ONE_HOUR * 6, t.TWELVE_HOURS = t.ONE_HOUR * 12, t.TWENTY_FOUR_HOURS = t.ONE_HOUR * 24, t.ONE_DAY = t.TWENTY_FOUR_HOURS, t.THREE_DAYS = t.ONE_DAY * 3, t.FIVE_DAYS = t.ONE_DAY * 5, t.SEVEN_DAYS = t.ONE_DAY * 7, t.THIRTY_DAYS = t.ONE_DAY * 30, t.ONE_WEEK = t.SEVEN_DAYS, t.TWO_WEEKS = t.ONE_WEEK * 2, t.THREE_WEEKS = t.ONE_WEEK * 3, t.FOUR_WEEKS = t.ONE_WEEK * 4, t.ONE_YEAR = t.ONE_DAY * 365; }(Kg)), Kg; } -var $2; +var F2; function b4() { - return $2 || ($2 = 1, function(t) { + return F2 || (F2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); const e = Bl; e.__exportStar(EL(), t), e.__exportStar(SL(), t); }(Wg)), Wg; } -var F2; +var B2; function AL() { - if (F2) return ja; - F2 = 1, Object.defineProperty(ja, "__esModule", { value: !0 }), ja.fromMiliseconds = ja.toMiliseconds = void 0; + if (B2) return ja; + B2 = 1, Object.defineProperty(ja, "__esModule", { value: !0 }), ja.fromMiliseconds = ja.toMiliseconds = void 0; const t = b4(); function e(n) { return n * t.ONE_THOUSAND; @@ -5193,18 +5194,18 @@ function AL() { } return ja.fromMiliseconds = r, ja; } -var B2; +var U2; function PL() { - return B2 || (B2 = 1, function(t) { + return U2 || (U2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); const e = Bl; e.__exportStar(_L(), t), e.__exportStar(AL(), t); }(Hg)), Hg; } -var qc = {}, U2; +var qc = {}, j2; function ML() { - if (U2) return qc; - U2 = 1, Object.defineProperty(qc, "__esModule", { value: !0 }), qc.Watch = void 0; + if (j2) return qc; + j2 = 1, Object.defineProperty(qc, "__esModule", { value: !0 }), qc.Watch = void 0; class t { constructor() { this.timestamps = /* @__PURE__ */ new Map(); @@ -5234,17 +5235,17 @@ function ML() { } return qc.Watch = t, qc.default = t, qc; } -var Vg = {}, wf = {}, j2; +var Vg = {}, wf = {}, q2; function IL() { - if (j2) return wf; - j2 = 1, Object.defineProperty(wf, "__esModule", { value: !0 }), wf.IWatch = void 0; + if (q2) return wf; + q2 = 1, Object.defineProperty(wf, "__esModule", { value: !0 }), wf.IWatch = void 0; class t { } return wf.IWatch = t, wf; } -var q2; +var z2; function CL() { - return q2 || (q2 = 1, function(t) { + return z2 || (z2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), Bl.__exportStar(IL(), t); }(Vg)), Vg; } @@ -5260,10 +5261,10 @@ let TL = class extends mc { super(); } }; -const z2 = mt.FIVE_SECONDS, Du = { pulse: "heartbeat_pulse" }; +const H2 = mt.FIVE_SECONDS, Du = { pulse: "heartbeat_pulse" }; let RL = class y4 extends TL { constructor(e) { - super(e), this.events = new rs.EventEmitter(), this.interval = z2, this.interval = (e == null ? void 0 : e.interval) || z2; + super(e), this.events = new rs.EventEmitter(), this.interval = H2, this.interval = (e == null ? void 0 : e.interval) || H2; } static async init(e) { const r = new y4(e); @@ -5470,7 +5471,7 @@ function WL(t = {}) { if (!e.watching) { e.watching = !0; for (const l in e.mounts) - e.unwatch[l] = await H2( + e.unwatch[l] = await W2( e.mounts[l], i, l @@ -5492,12 +5493,12 @@ function WL(t = {}) { }, w.set(M.base, N)), N; }; for (const M of l) { - const N = typeof M == "string", L = di(N ? M : M.key), F = N ? void 0 : M.value, $ = N || !M.options ? d : { ...d, ...M.options }, K = r(L); + const N = typeof M == "string", L = di(N ? M : M.key), $ = N ? void 0 : M.value, F = N || !M.options ? d : { ...d, ...M.options }, K = r(L); A(K).items.push({ key: L, - value: F, + value: $, relativeKey: K.relativeKey, - options: $ + options: F }); } return Promise.all([...w.values()].map((M) => g(M))).then( @@ -5628,8 +5629,8 @@ function WL(t = {}) { d ); for (const L of N) { - const F = M.mountpoint + di(L); - w.some(($) => F.startsWith($)) || A.push(F); + const $ = M.mountpoint + di(L); + w.some((F) => $.startsWith(F)) || A.push($); } w = [ M.mountpoint, @@ -5657,7 +5658,7 @@ function WL(t = {}) { }, async dispose() { await Promise.all( - Object.values(e.mounts).map((l) => W2(l)) + Object.values(e.mounts).map((l) => K2(l)) ); }, async watch(l) { @@ -5674,12 +5675,12 @@ function WL(t = {}) { mount(l, d) { if (l = od(l), l && e.mounts[l]) throw new Error(`already mounted at ${l}`); - return l && (e.mountpoints.push(l), e.mountpoints.sort((g, w) => w.length - g.length)), e.mounts[l] = d, e.watching && Promise.resolve(H2(d, i, l)).then((g) => { + return l && (e.mountpoints.push(l), e.mountpoints.sort((g, w) => w.length - g.length)), e.mounts[l] = d, e.watching && Promise.resolve(W2(d, i, l)).then((g) => { e.unwatch[l] = g; }).catch(console.error), u; }, async unmount(l, d = !0) { - l = od(l), !(!l || !e.mounts[l]) && (e.watching && l in e.unwatch && (e.unwatch[l](), delete e.unwatch[l]), d && await W2(e.mounts[l]), e.mountpoints = e.mountpoints.filter((g) => g !== l), delete e.mounts[l]); + l = od(l), !(!l || !e.mounts[l]) && (e.watching && l in e.unwatch && (e.unwatch[l](), delete e.unwatch[l]), d && await K2(e.mounts[l]), e.mountpoints = e.mountpoints.filter((g) => g !== l), delete e.mounts[l]); }, getMount(l = "") { l = di(l) + ":"; @@ -5705,11 +5706,11 @@ function WL(t = {}) { }; return u; } -function H2(t, e, r) { +function W2(t, e, r) { return t.watch ? t.watch((n, i) => e(n, r + i)) : () => { }; } -async function W2(t) { +async function K2(t) { typeof t.dispose == "function" && await Cn(t.dispose); } function vc(t) { @@ -5727,7 +5728,7 @@ let Gg; function Ul() { return Gg || (Gg = x4("keyval-store", "keyval")), Gg; } -function K2(t, e = Ul()) { +function V2(t, e = Ul()) { return e("readonly", (r) => vc(r.get(t))); } function KL(t, e, r = Ul()) { @@ -5773,9 +5774,9 @@ var ek = (t = {}) => { const e = t.base && t.base.length > 0 ? `${t.base}:` : "", r = (i) => e + i; let n; return t.dbName && t.storeName && (n = x4(t.dbName, t.storeName)), { name: QL, options: t, async hasItem(i) { - return !(typeof await K2(r(i), n) > "u"); + return !(typeof await V2(r(i), n) > "u"); }, async getItem(i) { - return await K2(r(i), n) ?? null; + return await V2(r(i), n) ?? null; }, setItem(i, s) { return KL(r(i), s, n); }, removeItem(i) { @@ -5855,9 +5856,9 @@ let sk = class { this.localStorage.removeItem(e); } }; -const ok = "wc_storage_version", V2 = 1, ak = async (t, e, r) => { +const ok = "wc_storage_version", G2 = 1, ak = async (t, e, r) => { const n = ok, i = await e.getItem(n); - if (i && i >= V2) { + if (i && i >= G2) { r(e); return; } @@ -5876,7 +5877,7 @@ const ok = "wc_storage_version", V2 = 1, ak = async (t, e, r) => { await e.setItem(a, l), o.push(a); } } - await e.setItem(n, V2), r(e), ck(t, o); + await e.setItem(n, G2), r(e), ck(t, o); }, ck = async (t, e) => { e.length && e.forEach(async (r) => { await t.removeItem(r); @@ -5985,7 +5986,7 @@ function hk(t, e, r) { } return g === -1 ? t : (g < w && (l += t.slice(g)), l); } -const G2 = lk; +const Y2 = lk; var Yc = $o; const bl = _k().console || {}, dk = { mapHttpRequest: ad, @@ -6046,11 +6047,11 @@ function $o(t) { N = N || {}, i && M.serializers && (N.serializers = M.serializers); const L = N.serializers; if (i && L) { - var F = Object.assign({}, n, L), $ = t.browser.serialize === !0 ? Object.keys(F) : i; - delete M.serializers, L0([M], $, F, this._stdErrSerialize); + var $ = Object.assign({}, n, L), F = t.browser.serialize === !0 ? Object.keys($) : i; + delete M.serializers, L0([M], F, $, this._stdErrSerialize); } function K(H) { - this._childLevel = (H._childLevel | 0) + 1, this.error = Hc(H, M, "error"), this.fatal = Hc(H, M, "fatal"), this.warn = Hc(H, M, "warn"), this.info = Hc(H, M, "info"), this.debug = Hc(H, M, "debug"), this.trace = Hc(H, M, "trace"), F && (this.serializers = F, this._serialize = $), e && (this._logEvent = h1( + this._childLevel = (H._childLevel | 0) + 1, this.error = Hc(H, M, "error"), this.fatal = Hc(H, M, "fatal"), this.warn = Hc(H, M, "warn"), this.info = Hc(H, M, "info"), this.debug = Hc(H, M, "debug"), this.trace = Hc(H, M, "trace"), $ && (this.serializers = $, this._serialize = F), e && (this._logEvent = h1( [].concat(H._logEvent.bindings, M) )); } @@ -6111,8 +6112,8 @@ function mk(t, e, r, n) { if (a < 1 && (a = 1), s !== null && typeof s == "object") { for (; a-- && typeof i[0] == "object"; ) Object.assign(o, i.shift()); - s = i.length ? G2(i.shift(), i) : void 0; - } else typeof s == "string" && (s = G2(i.shift(), i)); + s = i.length ? Y2(i.shift(), i) : void 0; + } else typeof s == "string" && (s = Y2(i.shift(), i)); return s !== void 0 && (o.msg = s), o; } function L0(t, e, r, n) { @@ -6199,7 +6200,7 @@ function _k() { return t(self) || t(window) || t(this) || {}; } } -const jl = /* @__PURE__ */ ts(Yc), Ek = { level: "info" }, ql = "custom_context", kv = 1e3 * 1024; +const jl = /* @__PURE__ */ ts(Yc), Ek = { level: "info" }, ql = "custom_context", $v = 1e3 * 1024; let Sk = class { constructor(e) { this.nodeValue = e, this.sizeInBytes = new TextEncoder().encode(this.nodeValue).length, this.next = null; @@ -6210,7 +6211,7 @@ let Sk = class { get size() { return this.sizeInBytes; } -}, Y2 = class { +}, J2 = class { constructor(e) { this.head = null, this.tail = null, this.lengthInNodes = 0, this.maxSizeInBytes = e, this.sizeInBytes = 0; } @@ -6249,8 +6250,8 @@ let Sk = class { } }; } }, S4 = class { - constructor(e, r = kv) { - this.level = e ?? "error", this.levelValue = Yc.levels.values[this.level], this.MAX_LOG_SIZE_IN_BYTES = r, this.logs = new Y2(this.MAX_LOG_SIZE_IN_BYTES); + constructor(e, r = $v) { + this.level = e ?? "error", this.levelValue = Yc.levels.values[this.level], this.MAX_LOG_SIZE_IN_BYTES = r, this.logs = new J2(this.MAX_LOG_SIZE_IN_BYTES); } forwardToConsole(e, r) { r === Yc.levels.values.error ? console.error(e) : r === Yc.levels.values.warn ? console.warn(e) : r === Yc.levels.values.debug ? console.debug(e) : r === Yc.levels.values.trace ? console.trace(e) : console.log(e); @@ -6264,7 +6265,7 @@ let Sk = class { return this.logs; } clearLogs() { - this.logs = new Y2(this.MAX_LOG_SIZE_IN_BYTES); + this.logs = new J2(this.MAX_LOG_SIZE_IN_BYTES); } getLogArray() { return Array.from(this.logs); @@ -6274,7 +6275,7 @@ let Sk = class { return r.push(ko({ extraMetadata: e })), new Blob(r, { type: "application/json" }); } }, Ak = class { - constructor(e, r = kv) { + constructor(e, r = $v) { this.baseChunkLogger = new S4(e, r); } write(e) { @@ -6297,7 +6298,7 @@ let Sk = class { n.href = r, n.download = `walletconnect-logs-${(/* @__PURE__ */ new Date()).toISOString()}.txt`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(r); } }, Pk = class { - constructor(e, r = kv) { + constructor(e, r = $v) { this.baseChunkLogger = new S4(e, r); } write(e) { @@ -6316,9 +6317,9 @@ let Sk = class { return this.baseChunkLogger.logsToBlob(e); } }; -var Mk = Object.defineProperty, Ik = Object.defineProperties, Ck = Object.getOwnPropertyDescriptors, J2 = Object.getOwnPropertySymbols, Tk = Object.prototype.hasOwnProperty, Rk = Object.prototype.propertyIsEnumerable, X2 = (t, e, r) => e in t ? Mk(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Yd = (t, e) => { - for (var r in e || (e = {})) Tk.call(e, r) && X2(t, r, e[r]); - if (J2) for (var r of J2(e)) Rk.call(e, r) && X2(t, r, e[r]); +var Mk = Object.defineProperty, Ik = Object.defineProperties, Ck = Object.getOwnPropertyDescriptors, X2 = Object.getOwnPropertySymbols, Tk = Object.prototype.hasOwnProperty, Rk = Object.prototype.propertyIsEnumerable, Z2 = (t, e, r) => e in t ? Mk(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Yd = (t, e) => { + for (var r in e || (e = {})) Tk.call(e, r) && Z2(t, r, e[r]); + if (X2) for (var r of X2(e)) Rk.call(e, r) && Z2(t, r, e[r]); return t; }, Jd = (t, e) => Ik(t, Ck(e)); function k0(t) { @@ -6408,10 +6409,10 @@ let Fk = class extends mc { this.client = e; } }; -var $v = {}, Pa = {}, $0 = {}, F0 = {}; +var Fv = {}, Pa = {}, $0 = {}, F0 = {}; Object.defineProperty(F0, "__esModule", { value: !0 }); F0.BrowserRandomSource = void 0; -const Z2 = 65536; +const Q2 = 65536; class Xk { constructor() { this.isAvailable = !1, this.isInstantiated = !1; @@ -6422,8 +6423,8 @@ class Xk { if (!this.isAvailable || !this._crypto) throw new Error("Browser random byte generator is not available."); const r = new Uint8Array(e); - for (let n = 0; n < r.length; n += Z2) - this._crypto.getRandomValues(r.subarray(n, n + Math.min(r.length - n, Z2))); + for (let n = 0; n < r.length; n += Q2) + this._crypto.getRandomValues(r.subarray(n, n + Math.min(r.length - n, Q2))); return r; } } @@ -6718,8 +6719,8 @@ or.writeFloat64LE = A$; for (; l > 0; ) { const N = i(Math.ceil(l * 256 / M), g); for (let L = 0; L < N.length && l > 0; L++) { - const F = N[L]; - F < M && (w += d.charAt(F % A), l--); + const $ = N[L]; + $ < M && (w += d.charAt($ % A), l--); } (0, n.wipe)(N); } @@ -6956,18 +6957,18 @@ var D4 = {}; 1246189591 ]); function s(a, u, l, d, g, w, A) { - for (var M = l[0], N = l[1], L = l[2], F = l[3], $ = l[4], K = l[5], H = l[6], V = l[7], te = d[0], R = d[1], W = d[2], pe = d[3], Ee = d[4], Y = d[5], S = d[6], m = d[7], f, p, b, x, _, E, v, P; A >= 128; ) { + for (var M = l[0], N = l[1], L = l[2], $ = l[3], F = l[4], K = l[5], H = l[6], V = l[7], te = d[0], R = d[1], W = d[2], pe = d[3], Ee = d[4], Y = d[5], S = d[6], m = d[7], f, p, b, x, _, E, v, P; A >= 128; ) { for (var I = 0; I < 16; I++) { var B = 8 * I + w; a[I] = e.readUint32BE(g, B), u[I] = e.readUint32BE(g, B + 4); } for (var I = 0; I < 80; I++) { - var ce = M, D = N, oe = L, Z = F, J = $, Q = K, T = H, X = V, re = te, de = R, ie = W, ue = pe, ve = Ee, Pe = Y, De = S, Ce = m; - if (f = V, p = m, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = ($ >>> 14 | Ee << 18) ^ ($ >>> 18 | Ee << 14) ^ (Ee >>> 9 | $ << 23), p = (Ee >>> 14 | $ << 18) ^ (Ee >>> 18 | $ << 14) ^ ($ >>> 9 | Ee << 23), _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, f = $ & K ^ ~$ & H, p = Ee & Y ^ ~Ee & S, _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, f = i[I * 2], p = i[I * 2 + 1], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, f = a[I % 16], p = u[I % 16], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, b = v & 65535 | P << 16, x = _ & 65535 | E << 16, f = b, p = x, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = (M >>> 28 | te << 4) ^ (te >>> 2 | M << 30) ^ (te >>> 7 | M << 25), p = (te >>> 28 | M << 4) ^ (M >>> 2 | te << 30) ^ (M >>> 7 | te << 25), _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, f = M & N ^ M & L ^ N & L, p = te & R ^ te & W ^ R & W, _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, X = v & 65535 | P << 16, Ce = _ & 65535 | E << 16, f = Z, p = ue, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = b, p = x, _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, Z = v & 65535 | P << 16, ue = _ & 65535 | E << 16, N = ce, L = D, F = oe, $ = Z, K = J, H = Q, V = T, M = X, R = re, W = de, pe = ie, Ee = ue, Y = ve, S = Pe, m = De, te = Ce, I % 16 === 15) + var ce = M, D = N, oe = L, Z = $, J = F, Q = K, T = H, X = V, re = te, de = R, ie = W, ue = pe, ve = Ee, Pe = Y, De = S, Ce = m; + if (f = V, p = m, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = (F >>> 14 | Ee << 18) ^ (F >>> 18 | Ee << 14) ^ (Ee >>> 9 | F << 23), p = (Ee >>> 14 | F << 18) ^ (Ee >>> 18 | F << 14) ^ (F >>> 9 | Ee << 23), _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, f = F & K ^ ~F & H, p = Ee & Y ^ ~Ee & S, _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, f = i[I * 2], p = i[I * 2 + 1], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, f = a[I % 16], p = u[I % 16], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, b = v & 65535 | P << 16, x = _ & 65535 | E << 16, f = b, p = x, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = (M >>> 28 | te << 4) ^ (te >>> 2 | M << 30) ^ (te >>> 7 | M << 25), p = (te >>> 28 | M << 4) ^ (M >>> 2 | te << 30) ^ (M >>> 7 | te << 25), _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, f = M & N ^ M & L ^ N & L, p = te & R ^ te & W ^ R & W, _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, X = v & 65535 | P << 16, Ce = _ & 65535 | E << 16, f = Z, p = ue, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = b, p = x, _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, Z = v & 65535 | P << 16, ue = _ & 65535 | E << 16, N = ce, L = D, $ = oe, F = Z, K = J, H = Q, V = T, M = X, R = re, W = de, pe = ie, Ee = ue, Y = ve, S = Pe, m = De, te = Ce, I % 16 === 15) for (var B = 0; B < 16; B++) f = a[B], p = u[B], _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = a[(B + 9) % 16], p = u[(B + 9) % 16], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, b = a[(B + 1) % 16], x = u[(B + 1) % 16], f = (b >>> 1 | x << 31) ^ (b >>> 8 | x << 24) ^ b >>> 7, p = (x >>> 1 | b << 31) ^ (x >>> 8 | b << 24) ^ (x >>> 7 | b << 25), _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, b = a[(B + 14) % 16], x = u[(B + 14) % 16], f = (b >>> 19 | x << 13) ^ (x >>> 29 | b << 3) ^ b >>> 6, p = (x >>> 19 | b << 13) ^ (b >>> 29 | x << 3) ^ (x >>> 6 | b << 26), _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, a[B] = v & 65535 | P << 16, u[B] = _ & 65535 | E << 16; } - f = M, p = te, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[0], p = d[0], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[0] = M = v & 65535 | P << 16, d[0] = te = _ & 65535 | E << 16, f = N, p = R, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[1], p = d[1], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[1] = N = v & 65535 | P << 16, d[1] = R = _ & 65535 | E << 16, f = L, p = W, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[2], p = d[2], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[2] = L = v & 65535 | P << 16, d[2] = W = _ & 65535 | E << 16, f = F, p = pe, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[3], p = d[3], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[3] = F = v & 65535 | P << 16, d[3] = pe = _ & 65535 | E << 16, f = $, p = Ee, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[4], p = d[4], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[4] = $ = v & 65535 | P << 16, d[4] = Ee = _ & 65535 | E << 16, f = K, p = Y, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[5], p = d[5], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[5] = K = v & 65535 | P << 16, d[5] = Y = _ & 65535 | E << 16, f = H, p = S, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[6], p = d[6], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[6] = H = v & 65535 | P << 16, d[6] = S = _ & 65535 | E << 16, f = V, p = m, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[7], p = d[7], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[7] = V = v & 65535 | P << 16, d[7] = m = _ & 65535 | E << 16, w += 128, A -= 128; + f = M, p = te, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[0], p = d[0], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[0] = M = v & 65535 | P << 16, d[0] = te = _ & 65535 | E << 16, f = N, p = R, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[1], p = d[1], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[1] = N = v & 65535 | P << 16, d[1] = R = _ & 65535 | E << 16, f = L, p = W, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[2], p = d[2], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[2] = L = v & 65535 | P << 16, d[2] = W = _ & 65535 | E << 16, f = $, p = pe, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[3], p = d[3], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[3] = $ = v & 65535 | P << 16, d[3] = pe = _ & 65535 | E << 16, f = F, p = Ee, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[4], p = d[4], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[4] = F = v & 65535 | P << 16, d[4] = Ee = _ & 65535 | E << 16, f = K, p = Y, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[5], p = d[5], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[5] = K = v & 65535 | P << 16, d[5] = Y = _ & 65535 | E << 16, f = H, p = S, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[6], p = d[6], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[6] = H = v & 65535 | P << 16, d[6] = S = _ & 65535 | E << 16, f = V, p = m, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[7], p = d[7], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[7] = V = v & 65535 | P << 16, d[7] = m = _ & 65535 | E << 16, w += 128, A -= 128; } return w; } @@ -7113,15 +7114,15 @@ var D4 = {}; for (let X = 0; X < 16; X++) Z[2 * X] = T[X] & 255, Z[2 * X + 1] = T[X] >> 8; } - function F(Z, J) { + function $(Z, J) { let Q = 0; for (let T = 0; T < 32; T++) Q |= Z[T] ^ J[T]; return (1 & Q - 1 >>> 8) - 1; } - function $(Z, J) { + function F(Z, J) { const Q = new Uint8Array(32), T = new Uint8Array(32); - return L(Q, Z), L(T, J), F(Q, T); + return L(Q, Z), L(T, J), $(Q, T); } function K(Z) { const J = new Uint8Array(32); @@ -7292,7 +7293,7 @@ var D4 = {}; t.sign = I; function B(Z, J) { const Q = i(), T = i(), X = i(), re = i(), de = i(), ie = i(), ue = i(); - return A(Z[2], a), H(Z[1], J), W(X, Z[1]), R(re, X, u), te(X, X, Z[2]), V(re, Z[2], re), W(de, re), W(ie, de), R(ue, ie, de), R(Q, ue, X), R(Q, Q, re), Ee(Q, Q), R(Q, Q, X), R(Q, Q, re), R(Q, Q, re), R(Z[0], Q, re), W(T, Z[0]), R(T, T, re), $(T, X) && R(Z[0], Z[0], w), W(T, Z[0]), R(T, T, re), $(T, X) ? -1 : (K(Z[0]) === J[31] >> 7 && te(Z[0], o, Z[0]), R(Z[3], Z[0], Z[1]), 0); + return A(Z[2], a), H(Z[1], J), W(X, Z[1]), R(re, X, u), te(X, X, Z[2]), V(re, Z[2], re), W(de, re), W(ie, de), R(ue, ie, de), R(Q, ue, X), R(Q, Q, re), Ee(Q, Q), R(Q, Q, X), R(Q, Q, re), R(Q, Q, re), R(Z[0], Q, re), W(T, Z[0]), R(T, T, re), F(T, X) && R(Z[0], Z[0], w), W(T, Z[0]), R(T, T, re), F(T, X) ? -1 : (K(Z[0]) === J[31] >> 7 && te(Z[0], o, Z[0]), R(Z[3], Z[0], Z[1]), 0); } function ce(Z, J, Q) { const T = new Uint8Array(32), X = [i(), i(), i(), i()], re = [i(), i(), i(), i()]; @@ -7303,7 +7304,7 @@ var D4 = {}; const de = new r.SHA512(); de.update(Q.subarray(0, 32)), de.update(Z), de.update(J); const ie = de.digest(); - return P(ie), f(X, re, ie), p(re, Q.subarray(32)), Y(X, re), m(T, X), !F(Q, T); + return P(ie), f(X, re, ie), p(re, Q.subarray(32)), Y(X, re), m(T, X), !$(Q, T); } t.verify = ce; function D(Z) { @@ -7323,8 +7324,8 @@ var D4 = {}; return (0, n.wipe)(J), Q; } t.convertSecretKeyToX25519 = oe; -})($v); -const P$ = "EdDSA", M$ = "JWT", Qd = ".", U0 = "base64url", O4 = "utf8", N4 = "utf8", I$ = ":", C$ = "did", T$ = "key", Q2 = "base58btc", R$ = "z", D$ = "K36", O$ = 32; +})(Fv); +const P$ = "EdDSA", M$ = "JWT", Qd = ".", U0 = "base64url", O4 = "utf8", N4 = "utf8", I$ = ":", C$ = "did", T$ = "key", ex = "base58btc", R$ = "z", D$ = "K36", O$ = 32; function L4(t = 0) { return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); } @@ -7353,14 +7354,14 @@ function N$(t, e) { throw new TypeError("Expected Uint8Array"); if (M.length === 0) return ""; - for (var N = 0, L = 0, F = 0, $ = M.length; F !== $ && M[F] === 0; ) - F++, N++; - for (var K = ($ - F) * d + 1 >>> 0, H = new Uint8Array(K); F !== $; ) { - for (var V = M[F], te = 0, R = K - 1; (V !== 0 || te < L) && R !== -1; R--, te++) + for (var N = 0, L = 0, $ = 0, F = M.length; $ !== F && M[$] === 0; ) + $++, N++; + for (var K = (F - $) * d + 1 >>> 0, H = new Uint8Array(K); $ !== F; ) { + for (var V = M[$], te = 0, R = K - 1; (V !== 0 || te < L) && R !== -1; R--, te++) V += 256 * H[R] >>> 0, H[R] = V % a >>> 0, V = V / a >>> 0; if (V !== 0) throw new Error("Non-zero carry"); - L = te, F++; + L = te, $++; } for (var W = K - L; W !== K && H[W] === 0; ) W++; @@ -7375,22 +7376,22 @@ function N$(t, e) { return new Uint8Array(); var N = 0; if (M[N] !== " ") { - for (var L = 0, F = 0; M[N] === u; ) + for (var L = 0, $ = 0; M[N] === u; ) L++, N++; - for (var $ = (M.length - N) * l + 1 >>> 0, K = new Uint8Array($); M[N]; ) { + for (var F = (M.length - N) * l + 1 >>> 0, K = new Uint8Array(F); M[N]; ) { var H = r[M.charCodeAt(N)]; if (H === 255) return; - for (var V = 0, te = $ - 1; (H !== 0 || V < F) && te !== -1; te--, V++) + for (var V = 0, te = F - 1; (H !== 0 || V < $) && te !== -1; te--, V++) H += a * K[te] >>> 0, K[te] = H % 256 >>> 0, H = H / 256 >>> 0; if (H !== 0) throw new Error("Non-zero carry"); - F = V, N++; + $ = V, N++; } if (M[N] !== " ") { - for (var R = $ - F; R !== $ && K[R] === 0; ) + for (var R = F - $; R !== F && K[R] === 0; ) R++; - for (var W = new Uint8Array(L + ($ - R)), pe = L; R !== $; ) + for (var W = new Uint8Array(L + (F - R)), pe = L; R !== F; ) W[pe++] = K[R++]; return W; } @@ -7696,7 +7697,7 @@ const IF = j0({ }, Symbol.toStringTag, { value: "Module" })); new TextEncoder(); new TextDecoder(); -const ex = { +const tx = { ...V$, ...Y$, ...X$, @@ -7720,7 +7721,7 @@ function F4(t, e, r, n) { decoder: { decode: n } }; } -const tx = F4("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), Xg = F4("ascii", "a", (t) => { +const rx = F4("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), Xg = F4("ascii", "a", (t) => { let e = "a"; for (let r = 0; r < t.length; r++) e += String.fromCharCode(t[r]); @@ -7732,13 +7733,13 @@ const tx = F4("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) = e[r] = t.charCodeAt(r); return e; }), B4 = { - utf8: tx, - "utf-8": tx, - hex: ex.base16, + utf8: rx, + "utf-8": rx, + hex: tx.base16, latin1: Xg, ascii: Xg, binary: Xg, - ...ex + ...tx }; function Dn(t, e = "utf8") { const r = B4[e]; @@ -7752,14 +7753,14 @@ function Rn(t, e = "utf8") { throw new Error(`Unsupported encoding "${e}"`); return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t, "utf8") : r.decoder.decode(`${r.prefix}${t}`); } -function rx(t) { +function nx(t) { return uc(Dn(Rn(t, U0), O4)); } function e0(t) { return Dn(Rn(ko(t), O4), U0); } function U4(t) { - const e = Rn(D$, Q2), r = R$ + Dn(Ed([e, t]), Q2); + const e = Rn(D$, ex), r = R$ + Dn(Ed([e, t]), ex); return [C$, T$, r].join(I$); } function TF(t) { @@ -7779,17 +7780,17 @@ function OF(t) { ].join(Qd); } function v1(t) { - const e = t.split(Qd), r = rx(e[0]), n = rx(e[1]), i = RF(e[2]), s = Rn(e.slice(0, 2).join(Qd), N4); + const e = t.split(Qd), r = nx(e[0]), n = nx(e[1]), i = RF(e[2]), s = Rn(e.slice(0, 2).join(Qd), N4); return { header: r, payload: n, signature: i, data: s }; } -function nx(t = Pa.randomBytes(O$)) { - return $v.generateKeyPairFromSeed(t); +function ix(t = Pa.randomBytes(O$)) { + return Fv.generateKeyPairFromSeed(t); } async function NF(t, e, r, n, i = mt.fromMiliseconds(Date.now())) { - const s = { alg: P$, typ: M$ }, o = U4(n.publicKey), a = i + r, u = { iss: o, sub: t, aud: e, iat: i, exp: a }, l = DF({ header: s, payload: u }), d = $v.sign(n.secretKey, l); + const s = { alg: P$, typ: M$ }, o = U4(n.publicKey), a = i + r, u = { iss: o, sub: t, aud: e, iat: i, exp: a }, l = DF({ header: s, payload: u }), d = Fv.sign(n.secretKey, l); return OF({ header: s, payload: u, signature: d }); } -var ix = function(t, e, r) { +var sx = function(t, e, r) { if (r || arguments.length === 2) for (var n = 0, i = e.length, s; n < i; n++) (s || !(n in e)) && (s || (s = Array.prototype.slice.call(e, 0, n)), s[n] = e[n]); return t.concat(s || Array.prototype.slice.call(e)); @@ -7833,7 +7834,7 @@ var ix = function(t, e, r) { } return t; }() -), UF = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/, jF = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, sx = 3, qF = [ +), UF = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/, jF = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, ox = 3, qF = [ ["aol", /AOLShield\/([0-9\._]+)/], ["edge", /Edge\/([0-9\._]+)/], ["edge-ios", /EdgiOS\/([0-9\._]+)/], @@ -7872,7 +7873,7 @@ var ix = function(t, e, r) { ["ios-webview", /AppleWebKit\/([0-9\.]+).*Gecko\)$/], ["curl", /^curl\/([0-9\.]+)$/], ["searchbot", UF] -], ox = [ +], ax = [ ["iOS", /iP(hone|od|ad)/], ["Android OS", /Android/], ["BlackBerry OS", /BlackBerry|BB10/], @@ -7920,13 +7921,13 @@ function WF(t) { if (r === "searchbot") return new FF(); var i = n[1] && n[1].split(".").join("_").split("_").slice(0, 3); - i ? i.length < sx && (i = ix(ix([], i, !0), GF(sx - i.length), !0)) : i = []; + i ? i.length < ox && (i = sx(sx([], i, !0), GF(ox - i.length), !0)) : i = []; var s = i.join("."), o = KF(t), a = jF.exec(t); return a && a[1] ? new $F(r, s, o, a[1]) : new LF(r, s, o); } function KF(t) { - for (var e = 0, r = ox.length; e < r; e++) { - var n = ox[e], i = n[0], s = n[1], o = s.exec(t); + for (var e = 0, r = ax.length; e < r; e++) { + var n = ax[e], i = n[0], s = n[1], o = s.exec(t); if (o) return i; } @@ -7943,7 +7944,7 @@ function GF(t) { } var Hr = {}; Object.defineProperty(Hr, "__esModule", { value: !0 }); -Hr.getLocalStorage = Hr.getLocalStorageOrThrow = Hr.getCrypto = Hr.getCryptoOrThrow = j4 = Hr.getLocation = Hr.getLocationOrThrow = Fv = Hr.getNavigator = Hr.getNavigatorOrThrow = Wl = Hr.getDocument = Hr.getDocumentOrThrow = Hr.getFromWindowOrThrow = Hr.getFromWindow = void 0; +Hr.getLocalStorage = Hr.getLocalStorageOrThrow = Hr.getCrypto = Hr.getCryptoOrThrow = j4 = Hr.getLocation = Hr.getLocationOrThrow = Bv = Hr.getNavigator = Hr.getNavigatorOrThrow = Wl = Hr.getDocument = Hr.getDocumentOrThrow = Hr.getFromWindowOrThrow = Hr.getFromWindow = void 0; function bc(t) { let e; return typeof window < "u" && typeof window[t] < "u" && (e = window[t]), e; @@ -7971,7 +7972,7 @@ Hr.getNavigatorOrThrow = XF; function ZF() { return bc("navigator"); } -var Fv = Hr.getNavigator = ZF; +var Bv = Hr.getNavigator = ZF; function QF() { return Ou("location"); } @@ -7996,14 +7997,14 @@ function iB() { return bc("localStorage"); } Hr.getLocalStorage = iB; -var Bv = {}; -Object.defineProperty(Bv, "__esModule", { value: !0 }); -var q4 = Bv.getWindowMetadata = void 0; -const ax = Hr; +var Uv = {}; +Object.defineProperty(Uv, "__esModule", { value: !0 }); +var q4 = Uv.getWindowMetadata = void 0; +const cx = Hr; function sB() { let t, e; try { - t = ax.getDocumentOrThrow(), e = ax.getLocationOrThrow(); + t = cx.getDocumentOrThrow(), e = cx.getLocationOrThrow(); } catch { return null; } @@ -8015,19 +8016,19 @@ function sB() { const L = M.getAttribute("href"); if (L) if (L.toLowerCase().indexOf("https:") === -1 && L.toLowerCase().indexOf("http:") === -1 && L.indexOf("//") !== 0) { - let F = e.protocol + "//" + e.host; + let $ = e.protocol + "//" + e.host; if (L.indexOf("/") === 0) - F += L; + $ += L; else { - const $ = e.pathname.split("/"); - $.pop(); - const K = $.join("/"); - F += K + "/" + L; + const F = e.pathname.split("/"); + F.pop(); + const K = F.join("/"); + $ += K + "/" + L; } - w.push(F); + w.push($); } else if (L.indexOf("//") === 0) { - const F = e.protocol + L; - w.push(F); + const $ = e.protocol + L; + w.push($); } else w.push(L); } @@ -8061,8 +8062,8 @@ function sB() { name: o }; } -q4 = Bv.getWindowMetadata = sB; -var wl = {}, oB = (t) => encodeURIComponent(t).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), z4 = "%[a-f0-9]{2}", cx = new RegExp("(" + z4 + ")|([^%]+?)", "gi"), ux = new RegExp("(" + z4 + ")+", "gi"); +q4 = Uv.getWindowMetadata = sB; +var wl = {}, oB = (t) => encodeURIComponent(t).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), z4 = "%[a-f0-9]{2}", ux = new RegExp("(" + z4 + ")|([^%]+?)", "gi"), fx = new RegExp("(" + z4 + ")+", "gi"); function b1(t, e) { try { return [decodeURIComponent(t.join(""))]; @@ -8078,8 +8079,8 @@ function aB(t) { try { return decodeURIComponent(t); } catch { - for (var e = t.match(cx) || [], r = 1; r < e.length; r++) - t = b1(e, r).join(""), e = t.match(cx) || []; + for (var e = t.match(ux) || [], r = 1; r < e.length; r++) + t = b1(e, r).join(""), e = t.match(ux) || []; return t; } } @@ -8087,14 +8088,14 @@ function cB(t) { for (var e = { "%FE%FF": "��", "%FF%FE": "��" - }, r = ux.exec(t); r; ) { + }, r = fx.exec(t); r; ) { try { e[r[0]] = decodeURIComponent(r[0]); } catch { var n = aB(r[0]); n !== r[0] && (e[r[0]] = n); } - r = ux.exec(t); + r = fx.exec(t); } e["%C2"] = "�"; for (var i = Object.keys(e), s = 0; s < i.length; s++) { @@ -8129,34 +8130,34 @@ var uB = function(t) { return r; }; (function(t) { - const e = oB, r = uB, n = fB, i = lB, s = ($) => $ == null, o = Symbol("encodeFragmentIdentifier"); - function a($) { - switch ($.arrayFormat) { + const e = oB, r = uB, n = fB, i = lB, s = (F) => F == null, o = Symbol("encodeFragmentIdentifier"); + function a(F) { + switch (F.arrayFormat) { case "index": return (K) => (H, V) => { const te = H.length; - return V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? H : V === null ? [...H, [d(K, $), "[", te, "]"].join("")] : [ + return V === void 0 || F.skipNull && V === null || F.skipEmptyString && V === "" ? H : V === null ? [...H, [d(K, F), "[", te, "]"].join("")] : [ ...H, - [d(K, $), "[", d(te, $), "]=", d(V, $)].join("") + [d(K, F), "[", d(te, F), "]=", d(V, F)].join("") ]; }; case "bracket": - return (K) => (H, V) => V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? H : V === null ? [...H, [d(K, $), "[]"].join("")] : [...H, [d(K, $), "[]=", d(V, $)].join("")]; + return (K) => (H, V) => V === void 0 || F.skipNull && V === null || F.skipEmptyString && V === "" ? H : V === null ? [...H, [d(K, F), "[]"].join("")] : [...H, [d(K, F), "[]=", d(V, F)].join("")]; case "colon-list-separator": - return (K) => (H, V) => V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? H : V === null ? [...H, [d(K, $), ":list="].join("")] : [...H, [d(K, $), ":list=", d(V, $)].join("")]; + return (K) => (H, V) => V === void 0 || F.skipNull && V === null || F.skipEmptyString && V === "" ? H : V === null ? [...H, [d(K, F), ":list="].join("")] : [...H, [d(K, F), ":list=", d(V, F)].join("")]; case "comma": case "separator": case "bracket-separator": { - const K = $.arrayFormat === "bracket-separator" ? "[]=" : "="; - return (H) => (V, te) => te === void 0 || $.skipNull && te === null || $.skipEmptyString && te === "" ? V : (te = te === null ? "" : te, V.length === 0 ? [[d(H, $), K, d(te, $)].join("")] : [[V, d(te, $)].join($.arrayFormatSeparator)]); + const K = F.arrayFormat === "bracket-separator" ? "[]=" : "="; + return (H) => (V, te) => te === void 0 || F.skipNull && te === null || F.skipEmptyString && te === "" ? V : (te = te === null ? "" : te, V.length === 0 ? [[d(H, F), K, d(te, F)].join("")] : [[V, d(te, F)].join(F.arrayFormatSeparator)]); } default: - return (K) => (H, V) => V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? H : V === null ? [...H, d(K, $)] : [...H, [d(K, $), "=", d(V, $)].join("")]; + return (K) => (H, V) => V === void 0 || F.skipNull && V === null || F.skipEmptyString && V === "" ? H : V === null ? [...H, d(K, F)] : [...H, [d(K, F), "=", d(V, F)].join("")]; } } - function u($) { + function u(F) { let K; - switch ($.arrayFormat) { + switch (F.arrayFormat) { case "index": return (H, V, te) => { if (K = /\[(\d*)\]$/.exec(H), H = H.replace(/\[\d*\]$/, ""), !K) { @@ -8192,19 +8193,19 @@ var uB = function(t) { case "comma": case "separator": return (H, V, te) => { - const R = typeof V == "string" && V.includes($.arrayFormatSeparator), W = typeof V == "string" && !R && g(V, $).includes($.arrayFormatSeparator); - V = W ? g(V, $) : V; - const pe = R || W ? V.split($.arrayFormatSeparator).map((Ee) => g(Ee, $)) : V === null ? V : g(V, $); + const R = typeof V == "string" && V.includes(F.arrayFormatSeparator), W = typeof V == "string" && !R && g(V, F).includes(F.arrayFormatSeparator); + V = W ? g(V, F) : V; + const pe = R || W ? V.split(F.arrayFormatSeparator).map((Ee) => g(Ee, F)) : V === null ? V : g(V, F); te[H] = pe; }; case "bracket-separator": return (H, V, te) => { const R = /(\[\])$/.test(H); if (H = H.replace(/\[\]$/, ""), !R) { - te[H] = V && g(V, $); + te[H] = V && g(V, F); return; } - const W = V === null ? [] : V.split($.arrayFormatSeparator).map((pe) => g(pe, $)); + const W = V === null ? [] : V.split(F.arrayFormatSeparator).map((pe) => g(pe, F)); if (te[H] === void 0) { te[H] = W; return; @@ -8221,37 +8222,37 @@ var uB = function(t) { }; } } - function l($) { - if (typeof $ != "string" || $.length !== 1) + function l(F) { + if (typeof F != "string" || F.length !== 1) throw new TypeError("arrayFormatSeparator must be single character string"); } - function d($, K) { - return K.encode ? K.strict ? e($) : encodeURIComponent($) : $; + function d(F, K) { + return K.encode ? K.strict ? e(F) : encodeURIComponent(F) : F; } - function g($, K) { - return K.decode ? r($) : $; + function g(F, K) { + return K.decode ? r(F) : F; } - function w($) { - return Array.isArray($) ? $.sort() : typeof $ == "object" ? w(Object.keys($)).sort((K, H) => Number(K) - Number(H)).map((K) => $[K]) : $; + function w(F) { + return Array.isArray(F) ? F.sort() : typeof F == "object" ? w(Object.keys(F)).sort((K, H) => Number(K) - Number(H)).map((K) => F[K]) : F; } - function A($) { - const K = $.indexOf("#"); - return K !== -1 && ($ = $.slice(0, K)), $; + function A(F) { + const K = F.indexOf("#"); + return K !== -1 && (F = F.slice(0, K)), F; } - function M($) { + function M(F) { let K = ""; - const H = $.indexOf("#"); - return H !== -1 && (K = $.slice(H)), K; + const H = F.indexOf("#"); + return H !== -1 && (K = F.slice(H)), K; } - function N($) { - $ = A($); - const K = $.indexOf("?"); - return K === -1 ? "" : $.slice(K + 1); + function N(F) { + F = A(F); + const K = F.indexOf("?"); + return K === -1 ? "" : F.slice(K + 1); } - function L($, K) { - return K.parseNumbers && !Number.isNaN(Number($)) && typeof $ == "string" && $.trim() !== "" ? $ = Number($) : K.parseBooleans && $ !== null && ($.toLowerCase() === "true" || $.toLowerCase() === "false") && ($ = $.toLowerCase() === "true"), $; + function L(F, K) { + return K.parseNumbers && !Number.isNaN(Number(F)) && typeof F == "string" && F.trim() !== "" ? F = Number(F) : K.parseBooleans && F !== null && (F.toLowerCase() === "true" || F.toLowerCase() === "false") && (F = F.toLowerCase() === "true"), F; } - function F($, K) { + function $(F, K) { K = Object.assign({ decode: !0, sort: !0, @@ -8261,9 +8262,9 @@ var uB = function(t) { parseBooleans: !1 }, K), l(K.arrayFormatSeparator); const H = u(K), V = /* @__PURE__ */ Object.create(null); - if (typeof $ != "string" || ($ = $.trim().replace(/^[?#&]/, ""), !$)) + if (typeof F != "string" || (F = F.trim().replace(/^[?#&]/, ""), !F)) return V; - for (const te of $.split("&")) { + for (const te of F.split("&")) { if (te === "") continue; let [R, W] = n(K.decode ? te.replace(/\+/g, " ") : te, "="); @@ -8282,8 +8283,8 @@ var uB = function(t) { return W && typeof W == "object" && !Array.isArray(W) ? te[R] = w(W) : te[R] = W, te; }, /* @__PURE__ */ Object.create(null)); } - t.extract = N, t.parse = F, t.stringify = ($, K) => { - if (!$) + t.extract = N, t.parse = $, t.stringify = (F, K) => { + if (!F) return ""; K = Object.assign({ encode: !0, @@ -8291,51 +8292,51 @@ var uB = function(t) { arrayFormat: "none", arrayFormatSeparator: "," }, K), l(K.arrayFormatSeparator); - const H = (W) => K.skipNull && s($[W]) || K.skipEmptyString && $[W] === "", V = a(K), te = {}; - for (const W of Object.keys($)) - H(W) || (te[W] = $[W]); + const H = (W) => K.skipNull && s(F[W]) || K.skipEmptyString && F[W] === "", V = a(K), te = {}; + for (const W of Object.keys(F)) + H(W) || (te[W] = F[W]); const R = Object.keys(te); return K.sort !== !1 && R.sort(K.sort), R.map((W) => { - const pe = $[W]; + const pe = F[W]; return pe === void 0 ? "" : pe === null ? d(W, K) : Array.isArray(pe) ? pe.length === 0 && K.arrayFormat === "bracket-separator" ? d(W, K) + "[]" : pe.reduce(V(W), []).join("&") : d(W, K) + "=" + d(pe, K); }).filter((W) => W.length > 0).join("&"); - }, t.parseUrl = ($, K) => { + }, t.parseUrl = (F, K) => { K = Object.assign({ decode: !0 }, K); - const [H, V] = n($, "#"); + const [H, V] = n(F, "#"); return Object.assign( { url: H.split("?")[0] || "", - query: F(N($), K) + query: $(N(F), K) }, K && K.parseFragmentIdentifier && V ? { fragmentIdentifier: g(V, K) } : {} ); - }, t.stringifyUrl = ($, K) => { + }, t.stringifyUrl = (F, K) => { K = Object.assign({ encode: !0, strict: !0, [o]: !0 }, K); - const H = A($.url).split("?")[0] || "", V = t.extract($.url), te = t.parse(V, { sort: !1 }), R = Object.assign(te, $.query); + const H = A(F.url).split("?")[0] || "", V = t.extract(F.url), te = t.parse(V, { sort: !1 }), R = Object.assign(te, F.query); let W = t.stringify(R, K); W && (W = `?${W}`); - let pe = M($.url); - return $.fragmentIdentifier && (pe = `#${K[o] ? d($.fragmentIdentifier, K) : $.fragmentIdentifier}`), `${H}${W}${pe}`; - }, t.pick = ($, K, H) => { + let pe = M(F.url); + return F.fragmentIdentifier && (pe = `#${K[o] ? d(F.fragmentIdentifier, K) : F.fragmentIdentifier}`), `${H}${W}${pe}`; + }, t.pick = (F, K, H) => { H = Object.assign({ parseFragmentIdentifier: !0, [o]: !1 }, H); - const { url: V, query: te, fragmentIdentifier: R } = t.parseUrl($, H); + const { url: V, query: te, fragmentIdentifier: R } = t.parseUrl(F, H); return t.stringifyUrl({ url: V, query: i(te, K), fragmentIdentifier: R }, H); - }, t.exclude = ($, K, H) => { + }, t.exclude = (F, K, H) => { const V = Array.isArray(K) ? (te) => !K.includes(te) : (te, R) => !K(te, R); - return t.pick($, V, H); + return t.pick(F, V, H); }; })(wl); var H4 = { exports: {} }; @@ -8402,7 +8403,7 @@ var H4 = { exports: {} }; 0, 2147516424, 2147483648 - ], L = [224, 256, 384, 512], F = [128, 256], $ = ["hex", "buffer", "arrayBuffer", "array", "digest"], K = { + ], L = [224, 256, 384, 512], $ = [128, 256], F = ["hex", "buffer", "arrayBuffer", "array", "digest"], K = { 128: 168, 256: 136 }; @@ -8428,8 +8429,8 @@ var H4 = { exports: {} }; return f["kmac" + D].update(J, Q, T, X)[Z](); }; }, W = function(D, oe, Z, J) { - for (var Q = 0; Q < $.length; ++Q) { - var T = $[Q]; + for (var Q = 0; Q < F.length; ++Q) { + var T = F[Q]; D[T] = oe(Z, J, T); } return D; @@ -8464,9 +8465,9 @@ var H4 = { exports: {} }; }, m = [ { name: "keccak", padding: w, bits: L, createMethod: pe }, { name: "sha3", padding: A, bits: L, createMethod: pe }, - { name: "shake", padding: d, bits: F, createMethod: Ee }, - { name: "cshake", padding: g, bits: F, createMethod: Y }, - { name: "kmac", padding: g, bits: F, createMethod: S } + { name: "shake", padding: d, bits: $, createMethod: Ee }, + { name: "cshake", padding: g, bits: $, createMethod: Y }, + { name: "kmac", padding: g, bits: $, createMethod: S } ], f = {}, p = [], b = 0; b < m.length; ++b) for (var x = m[b], _ = x.bits, E = 0; E < _.length; ++E) { var v = x.name + "_" + _[E]; @@ -8605,9 +8606,9 @@ var H4 = { exports: {} }; })(H4); var hB = H4.exports; const dB = /* @__PURE__ */ ts(hB), pB = "logger/5.7.0"; -let fx = !1, lx = !1; +let lx = !1, hx = !1; const Sd = { debug: 1, default: 2, info: 2, warning: 3, error: 4, off: 5 }; -let hx = Sd.default, Zg = null; +let dx = Sd.default, Zg = null; function gB() { try { const t = []; @@ -8627,7 +8628,7 @@ function gB() { } return null; } -const dx = gB(); +const px = gB(); var y1; (function(t) { t.DEBUG = "DEBUG", t.INFO = "INFO", t.WARNING = "WARNING", t.ERROR = "ERROR", t.OFF = "OFF"; @@ -8636,7 +8637,7 @@ var ys; (function(t) { t.UNKNOWN_ERROR = "UNKNOWN_ERROR", t.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", t.UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION", t.NETWORK_ERROR = "NETWORK_ERROR", t.SERVER_ERROR = "SERVER_ERROR", t.TIMEOUT = "TIMEOUT", t.BUFFER_OVERRUN = "BUFFER_OVERRUN", t.NUMERIC_FAULT = "NUMERIC_FAULT", t.MISSING_NEW = "MISSING_NEW", t.INVALID_ARGUMENT = "INVALID_ARGUMENT", t.MISSING_ARGUMENT = "MISSING_ARGUMENT", t.UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT", t.CALL_EXCEPTION = "CALL_EXCEPTION", t.INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS", t.NONCE_EXPIRED = "NONCE_EXPIRED", t.REPLACEMENT_UNDERPRICED = "REPLACEMENT_UNDERPRICED", t.UNPREDICTABLE_GAS_LIMIT = "UNPREDICTABLE_GAS_LIMIT", t.TRANSACTION_REPLACED = "TRANSACTION_REPLACED", t.ACTION_REJECTED = "ACTION_REJECTED"; })(ys || (ys = {})); -const px = "0123456789abcdef"; +const gx = "0123456789abcdef"; class Yr { constructor(e) { Object.defineProperty(this, "version", { @@ -8647,7 +8648,7 @@ class Yr { } _log(e, r) { const n = e.toLowerCase(); - Sd[n] == null && this.throwArgumentError("invalid log level name", "logLevel", e), !(hx > Sd[n]) && console.log.apply(console, r); + Sd[n] == null && this.throwArgumentError("invalid log level name", "logLevel", e), !(dx > Sd[n]) && console.log.apply(console, r); } debug(...e) { this._log(Yr.levels.DEBUG, e); @@ -8659,7 +8660,7 @@ class Yr { this._log(Yr.levels.WARNING, e); } makeError(e, r, n) { - if (lx) + if (hx) return this.makeError("censored error", r, {}); r || (r = Yr.errors.UNKNOWN_ERROR), n || (n = {}); const i = []; @@ -8669,7 +8670,7 @@ class Yr { if (l instanceof Uint8Array) { let d = ""; for (let g = 0; g < l.length; g++) - d += px[l[g] >> 4], d += px[l[g] & 15]; + d += gx[l[g] >> 4], d += gx[l[g] & 15]; i.push(u + "=Uint8Array(0x" + d + ")"); } else i.push(u + "=" + JSON.stringify(l)); @@ -8731,9 +8732,9 @@ class Yr { e || this.throwArgumentError(r, n, i); } checkNormalize(e) { - dx && this.throwError("platform missing String.prototype.normalize", Yr.errors.UNSUPPORTED_OPERATION, { + px && this.throwError("platform missing String.prototype.normalize", Yr.errors.UNSUPPORTED_OPERATION, { operation: "String.prototype.normalize", - form: dx + form: px }); } checkSafeUint53(e, r) { @@ -8768,14 +8769,14 @@ class Yr { static setCensorship(e, r) { if (!e && r && this.globalLogger().throwError("cannot permanently disable censorship", Yr.errors.UNSUPPORTED_OPERATION, { operation: "setCensorship" - }), fx) { + }), lx) { if (!e) return; this.globalLogger().throwError("error censorship permanent", Yr.errors.UNSUPPORTED_OPERATION, { operation: "setCensorship" }); } - lx = !!e, fx = !!r; + hx = !!e, lx = !!r; } static setLogLevel(e) { const r = Sd[e.toLowerCase()]; @@ -8783,7 +8784,7 @@ class Yr { Yr.globalLogger().warn("invalid log level - " + e); return; } - hx = r; + dx = r; } static from(e) { return new Yr(e); @@ -8802,21 +8803,21 @@ function uu(t) { }), t; } function vB(t) { - return qs(t) && !(t.length % 2) || Uv(t); + return qs(t) && !(t.length % 2) || jv(t); } -function gx(t) { +function mx(t) { return typeof t == "number" && t == t && t % 1 === 0; } -function Uv(t) { +function jv(t) { if (t == null) return !1; if (t.constructor === Uint8Array) return !0; - if (typeof t == "string" || !gx(t.length) || t.length < 0) + if (typeof t == "string" || !mx(t.length) || t.length < 0) return !1; for (let e = 0; e < t.length; e++) { const r = t[e]; - if (!gx(r) || r < 0 || r >= 256) + if (!mx(r) || r < 0 || r >= 256) return !1; } return !0; @@ -8837,7 +8838,7 @@ function wn(t, e) { n.push(parseInt(r.substring(i, i + 2), 16)); return uu(new Uint8Array(n)); } - return Uv(t) ? uu(new Uint8Array(t)) : hn.throwArgumentError("invalid arrayify value", "value", t); + return jv(t) ? uu(new Uint8Array(t)) : hn.throwArgumentError("invalid arrayify value", "value", t); } function bB(t) { const e = t.map((i) => wn(i)), r = e.reduce((i, s) => i + s.length, 0), n = new Uint8Array(r); @@ -8866,7 +8867,7 @@ function Ti(t, e) { return t.toHexString(); if (qs(t)) return t.length % 2 && (e.hexPad === "left" ? t = "0x0" + t.substring(2) : e.hexPad === "right" ? t += "0" : hn.throwArgumentError("hex data is odd-length", "value", t)), t.toLowerCase(); - if (Uv(t)) { + if (jv(t)) { let r = "0x"; for (let n = 0; n < t.length; n++) { let i = t[n]; @@ -8883,7 +8884,7 @@ function wB(t) { return null; return (t.length - 2) / 2; } -function mx(t, e, r) { +function vx(t, e, r) { return typeof t != "string" ? t = Ti(t) : (!qs(t) || t.length % 2) && hn.throwArgumentError("invalid hexData", "value", t), e = 2 + 2 * e, "0x" + t.substring(e); } function fu(t, e) { @@ -8929,11 +8930,11 @@ function K4(t) { } return e.yParityAndS = e._vs, e.compact = e.r + e.yParityAndS.substring(2), e; } -function jv(t) { +function qv(t) { return "0x" + dB.keccak_256(wn(t)); } -var qv = { exports: {} }; -qv.exports; +var zv = { exports: {} }; +zv.exports; (function(t) { (function(e, r) { function n(m, f) { @@ -9379,7 +9380,7 @@ qv.exports; }, s.prototype.sub = function(f) { return this.clone().isub(f); }; - function F(m, f, p) { + function $(m, f, p) { p.negative = f.negative ^ m.negative; var b = m.length + f.length | 0; p.length = b, b = b - 1 | 0; @@ -9394,7 +9395,7 @@ qv.exports; } return P !== 0 ? p.words[I] = P | 0 : p.length--, p._strip(); } - var $ = function(f, p, b) { + var F = function(f, p, b) { var x = f.words, _ = p.words, E = b.words, v = 0, P, I, B, ce = x[0] | 0, D = ce & 8191, oe = ce >>> 13, Z = x[1] | 0, J = Z & 8191, Q = Z >>> 13, T = x[2] | 0, X = T & 8191, re = T >>> 13, de = x[3] | 0, ie = de & 8191, ue = de >>> 13, ve = x[4] | 0, Pe = ve & 8191, De = ve >>> 13, Ce = x[5] | 0, $e = Ce & 8191, Me = Ce >>> 13, Ne = x[6] | 0, Ke = Ne & 8191, Le = Ne >>> 13, qe = x[7] | 0, ze = qe & 8191, _e = qe >>> 13, Ze = x[8] | 0, at = Ze & 8191, ke = Ze >>> 13, Qe = x[9] | 0, tt = Qe & 8191, Ye = Qe >>> 13, dt = _[0] | 0, lt = dt & 8191, ct = dt >>> 13, qt = _[1] | 0, Yt = qt & 8191, Et = qt >>> 13, Qt = _[2] | 0, Jt = Qt & 8191, Dt = Qt >>> 13, kt = _[3] | 0, Ct = kt & 8191, gt = kt >>> 13, Rt = _[4] | 0, Nt = Rt & 8191, vt = Rt >>> 13, $t = _[5] | 0, Bt = $t & 8191, rt = $t >>> 13, Ft = _[6] | 0, k = Ft & 8191, j = Ft >>> 13, z = _[7] | 0, C = z & 8191, G = z >>> 13, U = _[8] | 0, se = U & 8191, he = U >>> 13, xe = _[9] | 0, Te = xe & 8191, Re = xe >>> 13; b.negative = f.negative ^ p.negative, b.length = 19, P = Math.imul(D, lt), I = Math.imul(D, ct), I = I + Math.imul(oe, lt) | 0, B = Math.imul(oe, ct); var nt = (v + P | 0) + ((I & 8191) << 13) | 0; @@ -9436,7 +9437,7 @@ qv.exports; var Be = (v + P | 0) + ((I & 8191) << 13) | 0; return v = (B + (I >>> 13) | 0) + (Be >>> 26) | 0, Be &= 67108863, E[0] = nt, E[1] = Ue, E[2] = pt, E[3] = it, E[4] = et, E[5] = St, E[6] = Tt, E[7] = At, E[8] = _t, E[9] = ht, E[10] = xt, E[11] = st, E[12] = bt, E[13] = ut, E[14] = ot, E[15] = Se, E[16] = Ae, E[17] = Ve, E[18] = Be, v !== 0 && (E[19] = v, b.length++), b; }; - Math.imul || ($ = F); + Math.imul || (F = $); function K(m, f, p) { p.negative = f.negative ^ m.negative, p.length = m.length + f.length; for (var b = 0, x = 0, _ = 0; _ < p.length - 1; _++) { @@ -9455,7 +9456,7 @@ qv.exports; } s.prototype.mulTo = function(f, p) { var b, x = this.length + f.length; - return this.length === 10 && f.length === 10 ? b = $(this, f, p) : x < 63 ? b = F(this, f, p) : x < 1024 ? b = K(this, f, p) : b = H(this, f, p), b; + return this.length === 10 && f.length === 10 ? b = F(this, f, p) : x < 63 ? b = $(this, f, p) : x < 1024 ? b = K(this, f, p) : b = H(this, f, p), b; }, s.prototype.mul = function(f) { var p = new s(null); return p.words = new Array(this.length + f.length), this.mulTo(f, p); @@ -10058,8 +10059,8 @@ qv.exports; return p._forceRed(this); }; })(t, gn); -})(qv); -var xB = qv.exports; +})(zv); +var xB = zv.exports; const ir = /* @__PURE__ */ ts(xB); var _B = ir.BN; function EB(t) { @@ -10070,10 +10071,10 @@ var t0; (function(t) { t.current = "", t.NFC = "NFC", t.NFD = "NFD", t.NFKC = "NFKC", t.NFKD = "NFKD"; })(t0 || (t0 = {})); -var vx; +var bx; (function(t) { t.UNEXPECTED_CONTINUE = "unexpected continuation byte", t.BAD_PREFIX = "bad codepoint prefix", t.OVERRUN = "string overrun", t.MISSING_CONTINUE = "missing continuation byte", t.OUT_OF_RANGE = "out of UTF-8 range", t.UTF16_SURROGATE = "UTF-16 surrogate", t.OVERLONG = "overlong representation"; -})(vx || (vx = {})); +})(bx || (bx = {})); function em(t, e = t0.current) { e != t0.current && (AB.checkNormalize(), t = t.normalize(e)); let r = []; @@ -10098,19 +10099,19 @@ function em(t, e = t0.current) { const PB = `Ethereum Signed Message: `; function V4(t) { - return typeof t == "string" && (t = em(t)), jv(bB([ + return typeof t == "string" && (t = em(t)), qv(bB([ em(PB), em(String(t.length)), t ])); } const MB = "address/5.7.0", kf = new Yr(MB); -function bx(t) { +function yx(t) { qs(t, 20) || kf.throwArgumentError("invalid address", "address", t), t = t.toLowerCase(); const e = t.substring(2).split(""), r = new Uint8Array(40); for (let i = 0; i < 40; i++) r[i] = e[i].charCodeAt(0); - const n = wn(jv(r)); + const n = wn(qv(r)); for (let i = 0; i < 40; i += 2) n[i >> 1] >> 4 >= 8 && (e[i] = e[i].toUpperCase()), (n[i >> 1] & 15) >= 8 && (e[i + 1] = e[i + 1].toUpperCase()); return "0x" + e.join(""); @@ -10119,17 +10120,17 @@ const IB = 9007199254740991; function CB(t) { return Math.log10 ? Math.log10(t) : Math.log(t) / Math.LN10; } -const zv = {}; +const Hv = {}; for (let t = 0; t < 10; t++) - zv[String(t)] = String(t); + Hv[String(t)] = String(t); for (let t = 0; t < 26; t++) - zv[String.fromCharCode(65 + t)] = String(10 + t); -const yx = Math.floor(CB(IB)); + Hv[String.fromCharCode(65 + t)] = String(10 + t); +const wx = Math.floor(CB(IB)); function TB(t) { t = t.toUpperCase(), t = t.substring(4) + t.substring(0, 2) + "00"; - let e = t.split("").map((n) => zv[n]).join(""); - for (; e.length >= yx; ) { - let n = e.substring(0, yx); + let e = t.split("").map((n) => Hv[n]).join(""); + for (; e.length >= wx; ) { + let n = e.substring(0, wx); e = parseInt(n, 10) % 97 + e.substring(n.length); } let r = String(98 - parseInt(e, 10) % 97); @@ -10140,11 +10141,11 @@ function TB(t) { function RB(t) { let e = null; if (typeof t != "string" && kf.throwArgumentError("invalid address", "address", t), t.match(/^(0x)?[0-9a-fA-F]{40}$/)) - t.substring(0, 2) !== "0x" && (t = "0x" + t), e = bx(t), t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && e !== t && kf.throwArgumentError("bad address checksum", "address", t); + t.substring(0, 2) !== "0x" && (t = "0x" + t), e = yx(t), t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && e !== t && kf.throwArgumentError("bad address checksum", "address", t); else if (t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { for (t.substring(2, 4) !== TB(t) && kf.throwArgumentError("bad icap checksum", "address", t), e = EB(t.substring(4)); e.length < 40; ) e = "0" + e; - e = bx("0x" + e); + e = yx("0x" + e); } else kf.throwArgumentError("invalid address", "address", t); return e; @@ -10336,16 +10337,16 @@ function rU(t, e, r) { return n >>> 0; } xr.shr64_lo = rU; -var Nu = {}, wx = xr, nU = yc; +var Nu = {}, xx = xr, nU = yc; function z0() { this.pending = null, this.pendingTotal = 0, this.blockSize = this.constructor.blockSize, this.outSize = this.constructor.outSize, this.hmacStrength = this.constructor.hmacStrength, this.padLength = this.constructor.padLength / 8, this.endian = "big", this._delta8 = this.blockSize / 8, this._delta32 = this.blockSize / 32; } Nu.BlockHash = z0; z0.prototype.update = function(e, r) { - if (e = wx.toArray(e, r), this.pending ? this.pending = this.pending.concat(e) : this.pending = e, this.pendingTotal += e.length, this.pending.length >= this._delta8) { + if (e = xx.toArray(e, r), this.pending ? this.pending = this.pending.concat(e) : this.pending = e, this.pendingTotal += e.length, this.pending.length >= this._delta8) { e = this.pending; var n = e.length % this._delta8; - this.pending = e.slice(e.length - n, e.length), this.pending.length === 0 && (this.pending = null), e = wx.join32(e, 0, e.length - n, this.endian); + this.pending = e.slice(e.length - n, e.length), this.pending.length === 0 && (this.pending = null), e = xx.join32(e, 0, e.length - n, this.endian); for (var i = 0; i < e.length; i += this._delta32) this._update(e, i, i + this._delta32); } @@ -10787,10 +10788,10 @@ Es.prototype._prepareBlock = function(e, r) { }; Es.prototype._update = function(e, r) { this._prepareBlock(e, r); - var n = this.W, i = this.h[0], s = this.h[1], o = this.h[2], a = this.h[3], u = this.h[4], l = this.h[5], d = this.h[6], g = this.h[7], w = this.h[8], A = this.h[9], M = this.h[10], N = this.h[11], L = this.h[12], F = this.h[13], $ = this.h[14], K = this.h[15]; + var n = this.W, i = this.h[0], s = this.h[1], o = this.h[2], a = this.h[3], u = this.h[4], l = this.h[5], d = this.h[6], g = this.h[7], w = this.h[8], A = this.h[9], M = this.h[10], N = this.h[11], L = this.h[12], $ = this.h[13], F = this.h[14], K = this.h[15]; CU(this.k.length === n.length); for (var H = 0; H < n.length; H += 2) { - var V = $, te = K, R = jU(w, A), W = qU(w, A), pe = LU(w, A, M, N, L), Ee = kU(w, A, M, N, L, F), Y = this.k[H], S = this.k[H + 1], m = n[H], f = n[H + 1], p = DU( + var V = F, te = K, R = jU(w, A), W = qU(w, A), pe = LU(w, A, M, N, L), Ee = kU(w, A, M, N, L, $), Y = this.k[H], S = this.k[H + 1], m = n[H], f = n[H + 1], p = DU( V, te, R, @@ -10815,9 +10816,9 @@ Es.prototype._update = function(e, r) { ); V = BU(i, s), te = UU(i, s), R = $U(i, s, o, a, u), W = FU(i, s, o, a, u, l); var x = rm(V, te, R, W), _ = nm(V, te, R, W); - $ = L, K = F, L = M, F = N, M = w, N = A, w = rm(d, g, p, b), A = nm(g, g, p, b), d = u, g = l, u = o, l = a, o = i, a = s, i = rm(p, b, x, _), s = nm(p, b, x, _); + F = L, K = $, L = M, $ = N, M = w, N = A, w = rm(d, g, p, b), A = nm(g, g, p, b), d = u, g = l, u = o, l = a, o = i, a = s, i = rm(p, b, x, _), s = nm(p, b, x, _); } - ea(this.h, 0, i, s), ea(this.h, 2, o, a), ea(this.h, 4, u, l), ea(this.h, 6, d, g), ea(this.h, 8, w, A), ea(this.h, 10, M, N), ea(this.h, 12, L, F), ea(this.h, 14, $, K); + ea(this.h, 0, i, s), ea(this.h, 2, o, a), ea(this.h, 4, u, l), ea(this.h, 6, d, g), ea(this.h, 8, w, A), ea(this.h, 10, M, N), ea(this.h, 12, L, $), ea(this.h, 14, F, K); }; Es.prototype._digest = function(e) { return e === "hex" ? xi.toHex32(this.h, "big") : xi.split32(this.h, "big"); @@ -10907,7 +10908,7 @@ Lu.sha224 = MU; Lu.sha256 = n8; Lu.sha384 = VU; Lu.sha512 = c8; -var f8 = {}, fc = xr, GU = Nu, cd = fc.rotl32, xx = fc.sum32, Ef = fc.sum32_3, _x = fc.sum32_4, l8 = GU.BlockHash; +var f8 = {}, fc = xr, GU = Nu, cd = fc.rotl32, _x = fc.sum32, Ef = fc.sum32_3, Ex = fc.sum32_4, l8 = GU.BlockHash; function Xs() { if (!(this instanceof Xs)) return new Xs(); @@ -10921,16 +10922,16 @@ Xs.hmacStrength = 192; Xs.padLength = 64; Xs.prototype._update = function(e, r) { for (var n = this.h[0], i = this.h[1], s = this.h[2], o = this.h[3], a = this.h[4], u = n, l = i, d = s, g = o, w = a, A = 0; A < 80; A++) { - var M = xx( + var M = _x( cd( - _x(n, Ex(A, i, s, o), e[XU[A] + r], YU(A)), + Ex(n, Sx(A, i, s, o), e[XU[A] + r], YU(A)), QU[A] ), a ); - n = a, a = o, o = cd(s, 10), s = i, i = M, M = xx( + n = a, a = o, o = cd(s, 10), s = i, i = M, M = _x( cd( - _x(u, Ex(79 - A, l, d, g), e[ZU[A] + r], JU(A)), + Ex(u, Sx(79 - A, l, d, g), e[ZU[A] + r], JU(A)), ej[A] ), w @@ -10941,7 +10942,7 @@ Xs.prototype._update = function(e, r) { Xs.prototype._digest = function(e) { return e === "hex" ? fc.toHex32(this.h, "little") : fc.split32(this.h, "little"); }; -function Ex(t, e, r, n) { +function Sx(t, e, r, n) { return t <= 15 ? e ^ r ^ n : t <= 31 ? e & r | ~e & n : t <= 47 ? (e | ~r) ^ n : t <= 63 ? e & n | r & ~n : e ^ (r | ~n); } function YU(t) { @@ -11314,7 +11315,7 @@ function $u(t, e, r) { function ij() { throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs"); } -var Hv = h8; +var Wv = h8; function h8(t, e) { if (!t) throw new Error(e || "Assertion failed"); @@ -11362,7 +11363,7 @@ var ws = $u(function(t, e) { }; }), $i = $u(function(t, e) { var r = e; - r.assert = Hv, r.toArray = ws.toArray, r.zero2 = ws.zero2, r.toHex = ws.toHex, r.encode = ws.encode; + r.assert = Wv, r.toArray = ws.toArray, r.zero2 = ws.zero2, r.toHex = ws.toHex, r.encode = ws.encode; function n(u, l, d) { var g = new Array(Math.max(u.bitLength(), d) + 1); g.fill(0); @@ -11384,8 +11385,8 @@ var ws = $u(function(t, e) { M === 3 && (M = -1), N === 3 && (N = -1); var L; M & 1 ? (A = u.andln(7) + g & 7, (A === 3 || A === 5) && N === 2 ? L = -M : L = M) : L = 0, d[0].push(L); - var F; - N & 1 ? (A = l.andln(7) + w & 7, (A === 3 || A === 5) && M === 2 ? F = -N : F = N) : F = 0, d[1].push(F), 2 * g === L + 1 && (g = 1 - g), 2 * w === F + 1 && (w = 1 - w), u.iushrn(1), l.iushrn(1); + var $; + N & 1 ? (A = l.andln(7) + w & 7, (A === 3 || A === 5) && M === 2 ? $ = -N : $ = N) : $ = 0, d[1].push($), 2 * g === L + 1 && (g = 1 - g), 2 * w === $ + 1 && (w = 1 - w), u.iushrn(1), l.iushrn(1); } return d; } @@ -11473,7 +11474,7 @@ Ma.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 7 */ ]; r[M].y.cmp(r[N].y) === 0 ? (L[1] = r[M].add(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())) : r[M].y.cmp(r[N].y.redNeg()) === 0 ? (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].add(r[N].neg())) : (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())); - var F = [ + var $ = [ -3, /* -1 -1 */ -1, @@ -11492,10 +11493,10 @@ Ma.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 1 0 */ 3 /* 1 1 */ - ], $ = sj(n[M], n[N]); - for (l = Math.max($[0].length, l), u[M] = new Array(l), u[N] = new Array(l), g = 0; g < l; g++) { - var K = $[0][g] | 0, H = $[1][g] | 0; - u[M][g] = F[(K + 1) * 3 + (H + 1)], u[N][g] = 0, a[M] = L; + ], F = sj(n[M], n[N]); + for (l = Math.max(F[0].length, l), u[M] = new Array(l), u[N] = new Array(l), g = 0; g < l; g++) { + var K = F[0][g] | 0, H = F[1][g] | 0; + u[M][g] = $[(K + 1) * 3 + (H + 1)], u[N][g] = 0, a[M] = L; } } var V = this.jpoint(null, null, null), te = this._wnafT4; @@ -11600,7 +11601,7 @@ ns.prototype.dblp = function(e) { r = r.dbl(); return r; }; -var Wv = $u(function(t) { +var Kv = $u(function(t) { typeof Object.create == "function" ? t.exports = function(r, n) { n && (r.super_ = n, r.prototype = Object.create(n.prototype, { constructor: { @@ -11622,7 +11623,7 @@ var Wv = $u(function(t) { function is(t) { wc.call(this, "short", t), this.a = new ir(t.a, 16).toRed(this.red), this.b = new ir(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); } -Wv(is, wc); +Kv(is, wc); var aj = is; is.prototype._getEndomorphism = function(e) { if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { @@ -11657,17 +11658,17 @@ is.prototype._getEndoRoots = function(e) { return [o, a]; }; is.prototype._getEndoBasis = function(e) { - for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new ir(1), o = new ir(0), a = new ir(0), u = new ir(1), l, d, g, w, A, M, N, L = 0, F, $; n.cmpn(0) !== 0; ) { + for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new ir(1), o = new ir(0), a = new ir(0), u = new ir(1), l, d, g, w, A, M, N, L = 0, $, F; n.cmpn(0) !== 0; ) { var K = i.div(n); - F = i.sub(K.mul(n)), $ = a.sub(K.mul(s)); + $ = i.sub(K.mul(n)), F = a.sub(K.mul(s)); var H = u.sub(K.mul(o)); - if (!g && F.cmp(r) < 0) - l = N.neg(), d = s, g = F.neg(), w = $; + if (!g && $.cmp(r) < 0) + l = N.neg(), d = s, g = $.neg(), w = F; else if (g && ++L === 2) break; - N = F, i = n, n = F, a = s, s = $, u = o, o = H; + N = $, i = n, n = $, a = s, s = F, u = o, o = H; } - A = F.neg(), M = $; + A = $.neg(), M = F; var V = g.sqr().add(w.sqr()), te = A.sqr().add(M.sqr()); return te.cmp(V) >= 0 && (A = l, M = d), g.negative && (g = g.neg(), w = w.neg()), A.negative && (A = A.neg(), M = M.neg()), [ { a: g, b: w }, @@ -11704,7 +11705,7 @@ is.prototype._endoWnafMulAdd = function(e, r, n) { function Ln(t, e, r, n) { wc.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new ir(e, 16), this.y = new ir(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); } -Wv(Ln, wc.BasePoint); +Kv(Ln, wc.BasePoint); is.prototype.point = function(e, r, n) { return new Ln(this, e, r, n); }; @@ -11850,7 +11851,7 @@ Ln.prototype.toJ = function() { function qn(t, e, r, n) { wc.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new ir(0)) : (this.x = new ir(e, 16), this.y = new ir(r, 16), this.z = new ir(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; } -Wv(qn, wc.BasePoint); +Kv(qn, wc.BasePoint); is.prototype.jpoint = function(e, r, n) { return new qn(this, e, r, n); }; @@ -11901,10 +11902,10 @@ qn.prototype.dblp = function(e) { } var i = this.curve.a, s = this.curve.tinv, o = this.x, a = this.y, u = this.z, l = u.redSqr().redSqr(), d = a.redAdd(a); for (r = 0; r < e; r++) { - var g = o.redSqr(), w = d.redSqr(), A = w.redSqr(), M = g.redAdd(g).redIAdd(g).redIAdd(i.redMul(l)), N = o.redMul(w), L = M.redSqr().redISub(N.redAdd(N)), F = N.redISub(L), $ = M.redMul(F); - $ = $.redIAdd($).redISub(A); + var g = o.redSqr(), w = d.redSqr(), A = w.redSqr(), M = g.redAdd(g).redIAdd(g).redIAdd(i.redMul(l)), N = o.redMul(w), L = M.redSqr().redISub(N.redAdd(N)), $ = N.redISub(L), F = M.redMul($); + F = F.redIAdd(F).redISub(A); var K = d.redMul(u); - r + 1 < e && (l = l.redMul(A)), o = L, u = K, d = $; + r + 1 < e && (l = l.redMul(A)), o = L, u = K, d = F; } return this.curve.jpoint(o, d.redMul(s), u); }; @@ -11921,8 +11922,8 @@ qn.prototype._zeroDbl = function() { } else { var g = this.x.redSqr(), w = this.y.redSqr(), A = w.redSqr(), M = this.x.redAdd(w).redSqr().redISub(g).redISub(A); M = M.redIAdd(M); - var N = g.redAdd(g).redIAdd(g), L = N.redSqr(), F = A.redIAdd(A); - F = F.redIAdd(F), F = F.redIAdd(F), e = L.redISub(M).redISub(M), r = N.redMul(M.redISub(e)).redISub(F), n = this.y.redMul(this.z), n = n.redIAdd(n); + var N = g.redAdd(g).redIAdd(g), L = N.redSqr(), $ = A.redIAdd(A); + $ = $.redIAdd($), $ = $.redIAdd($), e = L.redISub(M).redISub(M), r = N.redMul(M.redISub(e)).redISub($), n = this.y.redMul(this.z), n = n.redIAdd(n); } return this.curve.jpoint(e, r, n); }; @@ -11942,8 +11943,8 @@ qn.prototype._threeDbl = function() { N = N.redIAdd(N); var L = N.redAdd(N); e = M.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(g); - var F = w.redSqr(); - F = F.redIAdd(F), F = F.redIAdd(F), F = F.redIAdd(F), r = M.redMul(N.redISub(e)).redISub(F); + var $ = w.redSqr(); + $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($), r = M.redMul(N.redISub(e)).redISub($); } return this.curve.jpoint(e, r, n); }; @@ -12163,7 +12164,7 @@ function va(t) { return new va(t); this.hash = t.hash, this.predResist = !!t.predResist, this.outLen = this.hash.outSize, this.minEntropy = t.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null; var e = ws.toArray(t.entropy, t.entropyEnc || "hex"), r = ws.toArray(t.nonce, t.nonceEnc || "hex"), n = ws.toArray(t.pers, t.persEnc || "hex"); - Hv( + Wv( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._init(e, r, n); @@ -12184,7 +12185,7 @@ va.prototype._update = function(e) { e && (r = r.update(e)), this.K = r.digest(), this.V = this._hmac().update(this.V).digest(), e && (this.K = this._hmac().update(this.V).update([1]).update(e).digest(), this.V = this._hmac().update(this.V).digest()); }; va.prototype.reseed = function(e, r, n, i) { - typeof r != "string" && (i = n, n = r, r = null), e = ws.toArray(e, r), n = ws.toArray(n, i), Hv( + typeof r != "string" && (i = n, n = r, r = null), e = ws.toArray(e, r), n = ws.toArray(n, i), Wv( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._update(e.concat(n || [])), this._reseed = 1; @@ -12202,7 +12203,7 @@ var E1 = $i.assert; function Zn(t, e) { this.ec = t, this.priv = null, this.pub = null, e.priv && this._importPrivate(e.priv, e.privEnc), e.pub && this._importPublic(e.pub, e.pubEnc); } -var Kv = Zn; +var Vv = Zn; Zn.fromPublic = function(e, r, n) { return r instanceof Zn ? r : new Zn(e, { pub: r, @@ -12268,7 +12269,7 @@ function im(t, e) { i <<= 8, i |= t[o], i >>>= 0; return i <= 127 ? !1 : (e.place = o, i); } -function Sx(t) { +function Ax(t) { for (var e = 0, r = t.length - 1; !t[e] && !(t[e + 1] & 128) && e < r; ) e++; return e === 0 ? t : t.slice(e); @@ -12315,7 +12316,7 @@ function sm(t, e) { } H0.prototype.toDER = function(e) { var r = this.r.toArray(), n = this.s.toArray(); - for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Sx(r), n = Sx(n); !n[0] && !(n[1] & 128); ) + for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Ax(r), n = Ax(n); !n[0] && !(n[1] & 128); ) n = n.slice(1); var i = [2]; sm(i, r.length), i = i.concat(r), i.push(2), sm(i, n.length); @@ -12338,13 +12339,13 @@ function Qi(t) { } var lj = Qi; Qi.prototype.keyPair = function(e) { - return new Kv(this, e); + return new Vv(this, e); }; Qi.prototype.keyFromPrivate = function(e, r) { - return Kv.fromPrivate(this, e, r); + return Vv.fromPrivate(this, e, r); }; Qi.prototype.keyFromPublic = function(e, r) { - return Kv.fromPublic(this, e, r); + return Vv.fromPublic(this, e, r); }; Qi.prototype.genKeyPair = function(e) { e || (e = {}); @@ -12471,24 +12472,24 @@ function g8(t, e) { const r = wn(t); return r.length === 32 ? new gj(r).publicKey : r.length === 33 ? "0x" + oa().keyFromPublic(r).getPublic(!1, "hex") : r.length === 65 ? Ti(r) : S1.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); } -var Ax; +var Px; (function(t) { t[t.legacy = 0] = "legacy", t[t.eip2930 = 1] = "eip2930", t[t.eip1559 = 2] = "eip1559"; -})(Ax || (Ax = {})); +})(Px || (Px = {})); function vj(t) { const e = g8(t); - return RB(mx(jv(mx(e, 1)), 12)); + return RB(vx(qv(vx(e, 1)), 12)); } function bj(t, e) { return vj(mj(wn(t), e)); } -var Vv = {}, K0 = {}; +var Gv = {}, K0 = {}; Object.defineProperty(K0, "__esModule", { value: !0 }); var Vn = or, A1 = ki, yj = 20; function wj(t, e, r) { - for (var n = 1634760805, i = 857760878, s = 2036477234, o = 1797285236, a = r[3] << 24 | r[2] << 16 | r[1] << 8 | r[0], u = r[7] << 24 | r[6] << 16 | r[5] << 8 | r[4], l = r[11] << 24 | r[10] << 16 | r[9] << 8 | r[8], d = r[15] << 24 | r[14] << 16 | r[13] << 8 | r[12], g = r[19] << 24 | r[18] << 16 | r[17] << 8 | r[16], w = r[23] << 24 | r[22] << 16 | r[21] << 8 | r[20], A = r[27] << 24 | r[26] << 16 | r[25] << 8 | r[24], M = r[31] << 24 | r[30] << 16 | r[29] << 8 | r[28], N = e[3] << 24 | e[2] << 16 | e[1] << 8 | e[0], L = e[7] << 24 | e[6] << 16 | e[5] << 8 | e[4], F = e[11] << 24 | e[10] << 16 | e[9] << 8 | e[8], $ = e[15] << 24 | e[14] << 16 | e[13] << 8 | e[12], K = n, H = i, V = s, te = o, R = a, W = u, pe = l, Ee = d, Y = g, S = w, m = A, f = M, p = N, b = L, x = F, _ = $, E = 0; E < yj; E += 2) + for (var n = 1634760805, i = 857760878, s = 2036477234, o = 1797285236, a = r[3] << 24 | r[2] << 16 | r[1] << 8 | r[0], u = r[7] << 24 | r[6] << 16 | r[5] << 8 | r[4], l = r[11] << 24 | r[10] << 16 | r[9] << 8 | r[8], d = r[15] << 24 | r[14] << 16 | r[13] << 8 | r[12], g = r[19] << 24 | r[18] << 16 | r[17] << 8 | r[16], w = r[23] << 24 | r[22] << 16 | r[21] << 8 | r[20], A = r[27] << 24 | r[26] << 16 | r[25] << 8 | r[24], M = r[31] << 24 | r[30] << 16 | r[29] << 8 | r[28], N = e[3] << 24 | e[2] << 16 | e[1] << 8 | e[0], L = e[7] << 24 | e[6] << 16 | e[5] << 8 | e[4], $ = e[11] << 24 | e[10] << 16 | e[9] << 8 | e[8], F = e[15] << 24 | e[14] << 16 | e[13] << 8 | e[12], K = n, H = i, V = s, te = o, R = a, W = u, pe = l, Ee = d, Y = g, S = w, m = A, f = M, p = N, b = L, x = $, _ = F, E = 0; E < yj; E += 2) K = K + R | 0, p ^= K, p = p >>> 16 | p << 16, Y = Y + p | 0, R ^= Y, R = R >>> 20 | R << 12, H = H + W | 0, b ^= H, b = b >>> 16 | b << 16, S = S + b | 0, W ^= S, W = W >>> 20 | W << 12, V = V + pe | 0, x ^= V, x = x >>> 16 | x << 16, m = m + x | 0, pe ^= m, pe = pe >>> 20 | pe << 12, te = te + Ee | 0, _ ^= te, _ = _ >>> 16 | _ << 16, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 20 | Ee << 12, V = V + pe | 0, x ^= V, x = x >>> 24 | x << 8, m = m + x | 0, pe ^= m, pe = pe >>> 25 | pe << 7, te = te + Ee | 0, _ ^= te, _ = _ >>> 24 | _ << 8, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 25 | Ee << 7, H = H + W | 0, b ^= H, b = b >>> 24 | b << 8, S = S + b | 0, W ^= S, W = W >>> 25 | W << 7, K = K + R | 0, p ^= K, p = p >>> 24 | p << 8, Y = Y + p | 0, R ^= Y, R = R >>> 25 | R << 7, K = K + W | 0, _ ^= K, _ = _ >>> 16 | _ << 16, m = m + _ | 0, W ^= m, W = W >>> 20 | W << 12, H = H + pe | 0, p ^= H, p = p >>> 16 | p << 16, f = f + p | 0, pe ^= f, pe = pe >>> 20 | pe << 12, V = V + Ee | 0, b ^= V, b = b >>> 16 | b << 16, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 20 | Ee << 12, te = te + R | 0, x ^= te, x = x >>> 16 | x << 16, S = S + x | 0, R ^= S, R = R >>> 20 | R << 12, V = V + Ee | 0, b ^= V, b = b >>> 24 | b << 8, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 25 | Ee << 7, te = te + R | 0, x ^= te, x = x >>> 24 | x << 8, S = S + x | 0, R ^= S, R = R >>> 25 | R << 7, H = H + pe | 0, p ^= H, p = p >>> 24 | p << 8, f = f + p | 0, pe ^= f, pe = pe >>> 25 | pe << 7, K = K + W | 0, _ ^= K, _ = _ >>> 24 | _ << 8, m = m + _ | 0, W ^= m, W = W >>> 25 | W << 7; - Vn.writeUint32LE(K + n | 0, t, 0), Vn.writeUint32LE(H + i | 0, t, 4), Vn.writeUint32LE(V + s | 0, t, 8), Vn.writeUint32LE(te + o | 0, t, 12), Vn.writeUint32LE(R + a | 0, t, 16), Vn.writeUint32LE(W + u | 0, t, 20), Vn.writeUint32LE(pe + l | 0, t, 24), Vn.writeUint32LE(Ee + d | 0, t, 28), Vn.writeUint32LE(Y + g | 0, t, 32), Vn.writeUint32LE(S + w | 0, t, 36), Vn.writeUint32LE(m + A | 0, t, 40), Vn.writeUint32LE(f + M | 0, t, 44), Vn.writeUint32LE(p + N | 0, t, 48), Vn.writeUint32LE(b + L | 0, t, 52), Vn.writeUint32LE(x + F | 0, t, 56), Vn.writeUint32LE(_ + $ | 0, t, 60); + Vn.writeUint32LE(K + n | 0, t, 0), Vn.writeUint32LE(H + i | 0, t, 4), Vn.writeUint32LE(V + s | 0, t, 8), Vn.writeUint32LE(te + o | 0, t, 12), Vn.writeUint32LE(R + a | 0, t, 16), Vn.writeUint32LE(W + u | 0, t, 20), Vn.writeUint32LE(pe + l | 0, t, 24), Vn.writeUint32LE(Ee + d | 0, t, 28), Vn.writeUint32LE(Y + g | 0, t, 32), Vn.writeUint32LE(S + w | 0, t, 36), Vn.writeUint32LE(m + A | 0, t, 40), Vn.writeUint32LE(f + M | 0, t, 44), Vn.writeUint32LE(p + N | 0, t, 48), Vn.writeUint32LE(b + L | 0, t, 52), Vn.writeUint32LE(x + $ | 0, t, 56), Vn.writeUint32LE(_ + F | 0, t, 60); } function m8(t, e, r, n, i) { if (i === void 0 && (i = 0), t.length !== 32) @@ -12573,7 +12574,7 @@ Ia.equal = Aj; this._r[8] = (M >>> 8 | N << 8) & 8191, this._r[9] = N >>> 5 & 127, this._pad[0] = a[16] | a[17] << 8, this._pad[1] = a[18] | a[19] << 8, this._pad[2] = a[20] | a[21] << 8, this._pad[3] = a[22] | a[23] << 8, this._pad[4] = a[24] | a[25] << 8, this._pad[5] = a[26] | a[27] << 8, this._pad[6] = a[28] | a[29] << 8, this._pad[7] = a[30] | a[31] << 8; } return o.prototype._blocks = function(a, u, l) { - for (var d = this._fin ? 0 : 2048, g = this._h[0], w = this._h[1], A = this._h[2], M = this._h[3], N = this._h[4], L = this._h[5], F = this._h[6], $ = this._h[7], K = this._h[8], H = this._h[9], V = this._r[0], te = this._r[1], R = this._r[2], W = this._r[3], pe = this._r[4], Ee = this._r[5], Y = this._r[6], S = this._r[7], m = this._r[8], f = this._r[9]; l >= 16; ) { + for (var d = this._fin ? 0 : 2048, g = this._h[0], w = this._h[1], A = this._h[2], M = this._h[3], N = this._h[4], L = this._h[5], $ = this._h[6], F = this._h[7], K = this._h[8], H = this._h[9], V = this._r[0], te = this._r[1], R = this._r[2], W = this._r[3], pe = this._r[4], Ee = this._r[5], Y = this._r[6], S = this._r[7], m = this._r[8], f = this._r[9]; l >= 16; ) { var p = a[u + 0] | a[u + 1] << 8; g += p & 8191; var b = a[u + 2] | a[u + 3] << 8; @@ -12585,33 +12586,33 @@ Ia.equal = Aj; var E = a[u + 8] | a[u + 9] << 8; N += (_ >>> 4 | E << 12) & 8191, L += E >>> 1 & 8191; var v = a[u + 10] | a[u + 11] << 8; - F += (E >>> 14 | v << 2) & 8191; + $ += (E >>> 14 | v << 2) & 8191; var P = a[u + 12] | a[u + 13] << 8; - $ += (v >>> 11 | P << 5) & 8191; + F += (v >>> 11 | P << 5) & 8191; var I = a[u + 14] | a[u + 15] << 8; K += (P >>> 8 | I << 8) & 8191, H += I >>> 5 | d; var B = 0, ce = B; - ce += g * V, ce += w * (5 * f), ce += A * (5 * m), ce += M * (5 * S), ce += N * (5 * Y), B = ce >>> 13, ce &= 8191, ce += L * (5 * Ee), ce += F * (5 * pe), ce += $ * (5 * W), ce += K * (5 * R), ce += H * (5 * te), B += ce >>> 13, ce &= 8191; + ce += g * V, ce += w * (5 * f), ce += A * (5 * m), ce += M * (5 * S), ce += N * (5 * Y), B = ce >>> 13, ce &= 8191, ce += L * (5 * Ee), ce += $ * (5 * pe), ce += F * (5 * W), ce += K * (5 * R), ce += H * (5 * te), B += ce >>> 13, ce &= 8191; var D = B; - D += g * te, D += w * V, D += A * (5 * f), D += M * (5 * m), D += N * (5 * S), B = D >>> 13, D &= 8191, D += L * (5 * Y), D += F * (5 * Ee), D += $ * (5 * pe), D += K * (5 * W), D += H * (5 * R), B += D >>> 13, D &= 8191; + D += g * te, D += w * V, D += A * (5 * f), D += M * (5 * m), D += N * (5 * S), B = D >>> 13, D &= 8191, D += L * (5 * Y), D += $ * (5 * Ee), D += F * (5 * pe), D += K * (5 * W), D += H * (5 * R), B += D >>> 13, D &= 8191; var oe = B; - oe += g * R, oe += w * te, oe += A * V, oe += M * (5 * f), oe += N * (5 * m), B = oe >>> 13, oe &= 8191, oe += L * (5 * S), oe += F * (5 * Y), oe += $ * (5 * Ee), oe += K * (5 * pe), oe += H * (5 * W), B += oe >>> 13, oe &= 8191; + oe += g * R, oe += w * te, oe += A * V, oe += M * (5 * f), oe += N * (5 * m), B = oe >>> 13, oe &= 8191, oe += L * (5 * S), oe += $ * (5 * Y), oe += F * (5 * Ee), oe += K * (5 * pe), oe += H * (5 * W), B += oe >>> 13, oe &= 8191; var Z = B; - Z += g * W, Z += w * R, Z += A * te, Z += M * V, Z += N * (5 * f), B = Z >>> 13, Z &= 8191, Z += L * (5 * m), Z += F * (5 * S), Z += $ * (5 * Y), Z += K * (5 * Ee), Z += H * (5 * pe), B += Z >>> 13, Z &= 8191; + Z += g * W, Z += w * R, Z += A * te, Z += M * V, Z += N * (5 * f), B = Z >>> 13, Z &= 8191, Z += L * (5 * m), Z += $ * (5 * S), Z += F * (5 * Y), Z += K * (5 * Ee), Z += H * (5 * pe), B += Z >>> 13, Z &= 8191; var J = B; - J += g * pe, J += w * W, J += A * R, J += M * te, J += N * V, B = J >>> 13, J &= 8191, J += L * (5 * f), J += F * (5 * m), J += $ * (5 * S), J += K * (5 * Y), J += H * (5 * Ee), B += J >>> 13, J &= 8191; + J += g * pe, J += w * W, J += A * R, J += M * te, J += N * V, B = J >>> 13, J &= 8191, J += L * (5 * f), J += $ * (5 * m), J += F * (5 * S), J += K * (5 * Y), J += H * (5 * Ee), B += J >>> 13, J &= 8191; var Q = B; - Q += g * Ee, Q += w * pe, Q += A * W, Q += M * R, Q += N * te, B = Q >>> 13, Q &= 8191, Q += L * V, Q += F * (5 * f), Q += $ * (5 * m), Q += K * (5 * S), Q += H * (5 * Y), B += Q >>> 13, Q &= 8191; + Q += g * Ee, Q += w * pe, Q += A * W, Q += M * R, Q += N * te, B = Q >>> 13, Q &= 8191, Q += L * V, Q += $ * (5 * f), Q += F * (5 * m), Q += K * (5 * S), Q += H * (5 * Y), B += Q >>> 13, Q &= 8191; var T = B; - T += g * Y, T += w * Ee, T += A * pe, T += M * W, T += N * R, B = T >>> 13, T &= 8191, T += L * te, T += F * V, T += $ * (5 * f), T += K * (5 * m), T += H * (5 * S), B += T >>> 13, T &= 8191; + T += g * Y, T += w * Ee, T += A * pe, T += M * W, T += N * R, B = T >>> 13, T &= 8191, T += L * te, T += $ * V, T += F * (5 * f), T += K * (5 * m), T += H * (5 * S), B += T >>> 13, T &= 8191; var X = B; - X += g * S, X += w * Y, X += A * Ee, X += M * pe, X += N * W, B = X >>> 13, X &= 8191, X += L * R, X += F * te, X += $ * V, X += K * (5 * f), X += H * (5 * m), B += X >>> 13, X &= 8191; + X += g * S, X += w * Y, X += A * Ee, X += M * pe, X += N * W, B = X >>> 13, X &= 8191, X += L * R, X += $ * te, X += F * V, X += K * (5 * f), X += H * (5 * m), B += X >>> 13, X &= 8191; var re = B; - re += g * m, re += w * S, re += A * Y, re += M * Ee, re += N * pe, B = re >>> 13, re &= 8191, re += L * W, re += F * R, re += $ * te, re += K * V, re += H * (5 * f), B += re >>> 13, re &= 8191; + re += g * m, re += w * S, re += A * Y, re += M * Ee, re += N * pe, B = re >>> 13, re &= 8191, re += L * W, re += $ * R, re += F * te, re += K * V, re += H * (5 * f), B += re >>> 13, re &= 8191; var de = B; - de += g * f, de += w * m, de += A * S, de += M * Y, de += N * Ee, B = de >>> 13, de &= 8191, de += L * pe, de += F * W, de += $ * R, de += K * te, de += H * V, B += de >>> 13, de &= 8191, B = (B << 2) + B | 0, B = B + ce | 0, ce = B & 8191, B = B >>> 13, D += B, g = ce, w = D, A = oe, M = Z, N = J, L = Q, F = T, $ = X, K = re, H = de, u += 16, l -= 16; + de += g * f, de += w * m, de += A * S, de += M * Y, de += N * Ee, B = de >>> 13, de &= 8191, de += L * pe, de += $ * W, de += F * R, de += K * te, de += H * V, B += de >>> 13, de &= 8191, B = (B << 2) + B | 0, B = B + ce | 0, ce = B & 8191, B = B >>> 13, D += B, g = ce, w = D, A = oe, M = Z, N = J, L = Q, $ = T, F = X, K = re, H = de, u += 16, l -= 16; } - this._h[0] = g, this._h[1] = w, this._h[2] = A, this._h[3] = M, this._h[4] = N, this._h[5] = L, this._h[6] = F, this._h[7] = $, this._h[8] = K, this._h[9] = H; + this._h[0] = g, this._h[1] = w, this._h[2] = A, this._h[3] = M, this._h[4] = N, this._h[5] = L, this._h[6] = $, this._h[7] = F, this._h[8] = K, this._h[9] = H; }, o.prototype.finish = function(a, u) { u === void 0 && (u = 0); var l = new Uint16Array(10), d, g, w, A; @@ -12709,14 +12710,14 @@ Ia.equal = Aj; var N = new Uint8Array(this.tagLength); if (this._authenticate(N, M, d.subarray(0, d.length - this.tagLength), g), !s.equal(N, d.subarray(d.length - this.tagLength, d.length))) return null; - var L = d.length - this.tagLength, F; + var L = d.length - this.tagLength, $; if (w) { if (w.length !== L) throw new Error("ChaCha20Poly1305: incorrect destination length"); - F = w; + $ = w; } else - F = new Uint8Array(L); - return e.streamXOR(this._key, A, d.subarray(0, d.length - this.tagLength), F, 4), n.wipe(A), F; + $ = new Uint8Array(L); + return e.streamXOR(this._key, A, d.subarray(0, d.length - this.tagLength), $, 4), n.wipe(A), $; }, u.prototype.clean = function() { return n.wipe(this._key), this; }, u.prototype._authenticate = function(l, d, g, w) { @@ -12731,15 +12732,15 @@ Ia.equal = Aj; }() ); t.ChaCha20Poly1305 = a; -})(Vv); -var y8 = {}, Vl = {}, Gv = {}; -Object.defineProperty(Gv, "__esModule", { value: !0 }); +})(Gv); +var y8 = {}, Vl = {}, Yv = {}; +Object.defineProperty(Yv, "__esModule", { value: !0 }); function Pj(t) { return typeof t.saveState < "u" && typeof t.restoreState < "u" && typeof t.cleanSavedState < "u"; } -Gv.isSerializableHash = Pj; +Yv.isSerializableHash = Pj; Object.defineProperty(Vl, "__esModule", { value: !0 }); -var Ns = Gv, Mj = Ia, Ij = ki, w8 = ( +var Ns = Yv, Mj = Ia, Ij = ki, w8 = ( /** @class */ function() { function t(e, r) { @@ -12791,13 +12792,13 @@ function Cj(t, e, r) { Vl.hmac = Cj; Vl.equal = Mj.equal; Object.defineProperty(y8, "__esModule", { value: !0 }); -var Px = Vl, Mx = ki, Tj = ( +var Mx = Vl, Ix = ki, Tj = ( /** @class */ function() { function t(e, r, n, i) { n === void 0 && (n = new Uint8Array(0)), this._counter = new Uint8Array(1), this._hash = e, this._info = i; - var s = Px.hmac(this._hash, n, r); - this._hmac = new Px.HMAC(e, s), this._buffer = new Uint8Array(this._hmac.digestLength), this._bufpos = this._buffer.length; + var s = Mx.hmac(this._hash, n, r); + this._hmac = new Mx.HMAC(e, s), this._buffer = new Uint8Array(this._hmac.digestLength), this._bufpos = this._buffer.length; } return t.prototype._fillBuffer = function() { this._counter[0]++; @@ -12810,7 +12811,7 @@ var Px = Vl, Mx = ki, Tj = ( this._bufpos === this._buffer.length && this._fillBuffer(), r[n] = this._buffer[this._bufpos++]; return r; }, t.prototype.clean = function() { - this._hmac.clean(), Mx.wipe(this._buffer), Mx.wipe(this._counter), this._bufpos = 0; + this._hmac.clean(), Ix.wipe(this._buffer), Ix.wipe(this._counter), this._bufpos = 0; }, t; }() ), Rj = y8.HKDF = Tj, Gl = {}; @@ -12941,7 +12942,7 @@ var Px = Vl, Mx = ki, Tj = ( ]); function s(a, u, l, d, g) { for (; g >= 64; ) { - for (var w = u[0], A = u[1], M = u[2], N = u[3], L = u[4], F = u[5], $ = u[6], K = u[7], H = 0; H < 16; H++) { + for (var w = u[0], A = u[1], M = u[2], N = u[3], L = u[4], $ = u[5], F = u[6], K = u[7], H = 0; H < 16; H++) { var V = d + H * 4; a[H] = e.readUint32BE(l, V); } @@ -12952,10 +12953,10 @@ var Px = Vl, Mx = ki, Tj = ( a[H] = (R + a[H - 7] | 0) + (W + a[H - 16] | 0); } for (var H = 0; H < 64; H++) { - var R = (((L >>> 6 | L << 26) ^ (L >>> 11 | L << 21) ^ (L >>> 25 | L << 7)) + (L & F ^ ~L & $) | 0) + (K + (i[H] + a[H] | 0) | 0) | 0, W = ((w >>> 2 | w << 30) ^ (w >>> 13 | w << 19) ^ (w >>> 22 | w << 10)) + (w & A ^ w & M ^ A & M) | 0; - K = $, $ = F, F = L, L = N + R | 0, N = M, M = A, A = w, w = R + W | 0; + var R = (((L >>> 6 | L << 26) ^ (L >>> 11 | L << 21) ^ (L >>> 25 | L << 7)) + (L & $ ^ ~L & F) | 0) + (K + (i[H] + a[H] | 0) | 0) | 0, W = ((w >>> 2 | w << 30) ^ (w >>> 13 | w << 19) ^ (w >>> 22 | w << 10)) + (w & A ^ w & M ^ A & M) | 0; + K = F, F = $, $ = L, L = N + R | 0, N = M, M = A, A = w, w = R + W | 0; } - u[0] += w, u[1] += A, u[2] += M, u[3] += N, u[4] += L, u[5] += F, u[6] += $, u[7] += K, d += 64, g -= 64; + u[0] += w, u[1] += A, u[2] += M, u[3] += N, u[4] += L, u[5] += $, u[6] += F, u[7] += K, d += 64, g -= 64; } return d; } @@ -12967,7 +12968,7 @@ var Px = Vl, Mx = ki, Tj = ( } t.hash = o; })(Gl); -var Yv = {}; +var Jv = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.sharedKey = t.generateKeyPair = t.generateKeyPairFromSeed = t.scalarMultBase = t.scalarMult = t.SHARED_KEY_LENGTH = t.SECRET_KEY_LENGTH = t.PUBLIC_KEY_LENGTH = void 0; const e = Pa, r = ki; @@ -13066,7 +13067,7 @@ var Yv = {}; return N(H, i); } t.scalarMultBase = L; - function F(H) { + function $(H) { if (H.length !== t.SECRET_KEY_LENGTH) throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`); const V = new Uint8Array(H); @@ -13075,12 +13076,12 @@ var Yv = {}; secretKey: V }; } - t.generateKeyPairFromSeed = F; - function $(H) { - const V = (0, e.randomBytes)(32, H), te = F(V); + t.generateKeyPairFromSeed = $; + function F(H) { + const V = (0, e.randomBytes)(32, H), te = $(V); return (0, r.wipe)(V), te; } - t.generateKeyPair = $; + t.generateKeyPair = F; function K(H, V, te = !1) { if (H.length !== t.PUBLIC_KEY_LENGTH) throw new Error("X25519: incorrect secret key length"); @@ -13097,7 +13098,7 @@ var Yv = {}; return R; } t.sharedKey = K; -})(Yv); +})(Jv); var x8 = {}; const Dj = "elliptic", Oj = "6.6.0", Nj = "EC cryptography", Lj = "lib/elliptic.js", kj = [ "lib" @@ -13155,8 +13156,8 @@ const Dj = "elliptic", Oj = "6.6.0", Nj = "EC cryptography", Lj = "lib/elliptic. devDependencies: Hj, dependencies: Wj }; -var Fi = {}, Jv = { exports: {} }; -Jv.exports; +var Fi = {}, Xv = { exports: {} }; +Xv.exports; (function(t) { (function(e, r) { function n(Y, S) { @@ -13643,30 +13644,30 @@ Jv.exports; } return f !== 0 ? m.words[b] = f : m.length--, m.strip(); } - function F(Y, S, m) { - var f = new $(); + function $(Y, S, m) { + var f = new F(); return f.mulp(Y, S, m); } s.prototype.mulTo = function(S, m) { var f, p = this.length + S.length; - return this.length === 10 && S.length === 10 ? f = N(this, S, m) : p < 63 ? f = M(this, S, m) : p < 1024 ? f = L(this, S, m) : f = F(this, S, m), f; + return this.length === 10 && S.length === 10 ? f = N(this, S, m) : p < 63 ? f = M(this, S, m) : p < 1024 ? f = L(this, S, m) : f = $(this, S, m), f; }; - function $(Y, S) { + function F(Y, S) { this.x = Y, this.y = S; } - $.prototype.makeRBT = function(S) { + F.prototype.makeRBT = function(S) { for (var m = new Array(S), f = s.prototype._countBits(S) - 1, p = 0; p < S; p++) m[p] = this.revBin(p, f, S); return m; - }, $.prototype.revBin = function(S, m, f) { + }, F.prototype.revBin = function(S, m, f) { if (S === 0 || S === f - 1) return S; for (var p = 0, b = 0; b < m; b++) p |= (S & 1) << m - b - 1, S >>= 1; return p; - }, $.prototype.permute = function(S, m, f, p, b, x) { + }, F.prototype.permute = function(S, m, f, p, b, x) { for (var _ = 0; _ < x; _++) p[_] = m[S[_]], b[_] = f[S[_]]; - }, $.prototype.transform = function(S, m, f, p, b, x) { + }, F.prototype.transform = function(S, m, f, p, b, x) { this.permute(x, S, m, f, p, b); for (var _ = 1; _ < b; _ <<= 1) for (var E = _ << 1, v = Math.cos(2 * Math.PI / E), P = Math.sin(2 * Math.PI / E), I = 0; I < b; I += E) @@ -13674,34 +13675,34 @@ Jv.exports; var oe = f[I + D], Z = p[I + D], J = f[I + D + _], Q = p[I + D + _], T = B * J - ce * Q; Q = B * Q + ce * J, J = T, f[I + D] = oe + J, p[I + D] = Z + Q, f[I + D + _] = oe - J, p[I + D + _] = Z - Q, D !== E && (T = v * B - P * ce, ce = v * ce + P * B, B = T); } - }, $.prototype.guessLen13b = function(S, m) { + }, F.prototype.guessLen13b = function(S, m) { var f = Math.max(m, S) | 1, p = f & 1, b = 0; for (f = f / 2 | 0; f; f = f >>> 1) b++; return 1 << b + 1 + p; - }, $.prototype.conjugate = function(S, m, f) { + }, F.prototype.conjugate = function(S, m, f) { if (!(f <= 1)) for (var p = 0; p < f / 2; p++) { var b = S[p]; S[p] = S[f - p - 1], S[f - p - 1] = b, b = m[p], m[p] = -m[f - p - 1], m[f - p - 1] = -b; } - }, $.prototype.normalize13b = function(S, m) { + }, F.prototype.normalize13b = function(S, m) { for (var f = 0, p = 0; p < m / 2; p++) { var b = Math.round(S[2 * p + 1] / m) * 8192 + Math.round(S[2 * p] / m) + f; S[p] = b & 67108863, b < 67108864 ? f = 0 : f = b / 67108864 | 0; } return S; - }, $.prototype.convert13b = function(S, m, f, p) { + }, F.prototype.convert13b = function(S, m, f, p) { for (var b = 0, x = 0; x < m; x++) b = b + (S[x] | 0), f[2 * x] = b & 8191, b = b >>> 13, f[2 * x + 1] = b & 8191, b = b >>> 13; for (x = 2 * m; x < p; ++x) f[x] = 0; n(b === 0), n((b & -8192) === 0); - }, $.prototype.stub = function(S) { + }, F.prototype.stub = function(S) { for (var m = new Array(S), f = 0; f < S; f++) m[f] = 0; return m; - }, $.prototype.mulp = function(S, m, f) { + }, F.prototype.mulp = function(S, m, f) { var p = 2 * this.guessLen13b(S.length, m.length), b = this.makeRBT(p), x = this.stub(p), _ = new Array(p), E = new Array(p), v = new Array(p), P = new Array(p), I = new Array(p), B = new Array(p), ce = f.words; ce.length = p, this.convert13b(S.words, S.length, _, p), this.convert13b(m.words, m.length, P, p), this.transform(_, x, E, v, p, b), this.transform(P, x, I, B, p, b); for (var D = 0; D < p; D++) { @@ -13714,7 +13715,7 @@ Jv.exports; return m.words = new Array(this.length + S.length), this.mulTo(S, m); }, s.prototype.mulf = function(S) { var m = new s(null); - return m.words = new Array(this.length + S.length), F(this, S, m); + return m.words = new Array(this.length + S.length), $(this, S, m); }, s.prototype.imul = function(S) { return this.clone().mulTo(S, this); }, s.prototype.imuln = function(S) { @@ -14306,8 +14307,8 @@ Jv.exports; return m._forceRed(this); }; })(t, gn); -})(Jv); -var qo = Jv.exports, Xv = {}; +})(Xv); +var qo = Xv.exports, Zv = {}; (function(t) { var e = t; function r(s, o) { @@ -14345,9 +14346,9 @@ var qo = Jv.exports, Xv = {}; e.toHex = i, e.encode = function(o, a) { return a === "hex" ? i(o) : o; }; -})(Xv); +})(Zv); (function(t) { - var e = t, r = qo, n = yc, i = Xv; + var e = t, r = qo, n = yc, i = Zv; e.assert = n, e.toArray = i.toArray, e.zero2 = i.zero2, e.toHex = i.toHex, e.encode = i.encode; function s(d, g, w) { var A = new Array(Math.max(d.bitLength(), w) + 1), M; @@ -14355,8 +14356,8 @@ var qo = Jv.exports, Xv = {}; A[M] = 0; var N = 1 << g + 1, L = d.clone(); for (M = 0; M < A.length; M++) { - var F, $ = L.andln(N - 1); - L.isOdd() ? ($ > (N >> 1) - 1 ? F = (N >> 1) - $ : F = $, L.isubn(F)) : F = 0, A[M] = F, L.iushrn(1); + var $, F = L.andln(N - 1); + L.isOdd() ? (F > (N >> 1) - 1 ? $ = (N >> 1) - F : $ = F, L.isubn($)) : $ = 0, A[M] = $, L.iushrn(1); } return A; } @@ -14368,12 +14369,12 @@ var qo = Jv.exports, Xv = {}; ]; d = d.clone(), g = g.clone(); for (var A = 0, M = 0, N; d.cmpn(-A) > 0 || g.cmpn(-M) > 0; ) { - var L = d.andln(3) + A & 3, F = g.andln(3) + M & 3; - L === 3 && (L = -1), F === 3 && (F = -1); - var $; - L & 1 ? (N = d.andln(7) + A & 7, (N === 3 || N === 5) && F === 2 ? $ = -L : $ = L) : $ = 0, w[0].push($); + var L = d.andln(3) + A & 3, $ = g.andln(3) + M & 3; + L === 3 && (L = -1), $ === 3 && ($ = -1); + var F; + L & 1 ? (N = d.andln(7) + A & 7, (N === 3 || N === 5) && $ === 2 ? F = -L : F = L) : F = 0, w[0].push(F); var K; - F & 1 ? (N = g.andln(7) + M & 7, (N === 3 || N === 5) && L === 2 ? K = -F : K = F) : K = 0, w[1].push(K), 2 * A === $ + 1 && (A = 1 - A), 2 * M === K + 1 && (M = 1 - M), d.iushrn(1), g.iushrn(1); + $ & 1 ? (N = g.andln(7) + M & 7, (N === 3 || N === 5) && L === 2 ? K = -$ : K = $) : K = 0, w[1].push(K), 2 * A === F + 1 && (A = 1 - A), 2 * M === K + 1 && (M = 1 - M), d.iushrn(1), g.iushrn(1); } return w; } @@ -14394,14 +14395,14 @@ var qo = Jv.exports, Xv = {}; } e.intFromLE = l; })(Fi); -var Zv = { exports: {} }, am; -Zv.exports = function(e) { +var Qv = { exports: {} }, am; +Qv.exports = function(e) { return am || (am = new fa(null)), am.generate(e); }; function fa(t) { this.rand = t; } -Zv.exports.Rand = fa; +Qv.exports.Rand = fa; fa.prototype.generate = function(e) { return this._rand(e); }; @@ -14424,15 +14425,15 @@ if (typeof self == "object") }); else try { - var Ix = zl; - if (typeof Ix.randomBytes != "function") + var Cx = zl; + if (typeof Cx.randomBytes != "function") throw new Error("Not supported"); fa.prototype._rand = function(e) { - return Ix.randomBytes(e); + return Cx.randomBytes(e); }; } catch { } -var _8 = Zv.exports, Qv = {}, za = qo, Yl = Fi, i0 = Yl.getNAF, Vj = Yl.getJSF, s0 = Yl.assert; +var _8 = Qv.exports, eb = {}, za = qo, Yl = Fi, i0 = Yl.getNAF, Vj = Yl.getJSF, s0 = Yl.assert; function Ca(t, e) { this.type = t, this.p = new za(e.p, 16), this.red = e.prime ? za.red(e.prime) : za.mont(this.p), this.zero = new za(0).toRed(this.red), this.one = new za(1).toRed(this.red), this.two = new za(2).toRed(this.red), this.n = e.n && new za(e.n, 16), this.g = e.g && this.pointFromJSON(e.g, e.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; var r = this.n && this.p.div(this.n); @@ -14500,7 +14501,7 @@ Ca.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 7 */ ]; r[M].y.cmp(r[N].y) === 0 ? (L[1] = r[M].add(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())) : r[M].y.cmp(r[N].y.redNeg()) === 0 ? (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].add(r[N].neg())) : (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())); - var F = [ + var $ = [ -3, /* -1 -1 */ -1, @@ -14519,10 +14520,10 @@ Ca.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 1 0 */ 3 /* 1 1 */ - ], $ = Vj(n[M], n[N]); - for (l = Math.max($[0].length, l), u[M] = new Array(l), u[N] = new Array(l), g = 0; g < l; g++) { - var K = $[0][g] | 0, H = $[1][g] | 0; - u[M][g] = F[(K + 1) * 3 + (H + 1)], u[N][g] = 0, a[M] = L; + ], F = Vj(n[M], n[N]); + for (l = Math.max(F[0].length, l), u[M] = new Array(l), u[N] = new Array(l), g = 0; g < l; g++) { + var K = F[0][g] | 0, H = F[1][g] | 0; + u[M][g] = $[(K + 1) * 3 + (H + 1)], u[N][g] = 0, a[M] = L; } } var V = this.jpoint(null, null, null), te = this._wnafT4; @@ -14627,11 +14628,11 @@ ss.prototype.dblp = function(e) { r = r.dbl(); return r; }; -var Gj = Fi, rn = qo, eb = q0, Fu = V0, Yj = Gj.assert; +var Gj = Fi, rn = qo, tb = q0, Fu = V0, Yj = Gj.assert; function os(t) { Fu.call(this, "short", t), this.a = new rn(t.a, 16).toRed(this.red), this.b = new rn(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); } -eb(os, Fu); +tb(os, Fu); var Jj = os; os.prototype._getEndomorphism = function(e) { if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { @@ -14666,17 +14667,17 @@ os.prototype._getEndoRoots = function(e) { return [o, a]; }; os.prototype._getEndoBasis = function(e) { - for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new rn(1), o = new rn(0), a = new rn(0), u = new rn(1), l, d, g, w, A, M, N, L = 0, F, $; n.cmpn(0) !== 0; ) { + for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new rn(1), o = new rn(0), a = new rn(0), u = new rn(1), l, d, g, w, A, M, N, L = 0, $, F; n.cmpn(0) !== 0; ) { var K = i.div(n); - F = i.sub(K.mul(n)), $ = a.sub(K.mul(s)); + $ = i.sub(K.mul(n)), F = a.sub(K.mul(s)); var H = u.sub(K.mul(o)); - if (!g && F.cmp(r) < 0) - l = N.neg(), d = s, g = F.neg(), w = $; + if (!g && $.cmp(r) < 0) + l = N.neg(), d = s, g = $.neg(), w = F; else if (g && ++L === 2) break; - N = F, i = n, n = F, a = s, s = $, u = o, o = H; + N = $, i = n, n = $, a = s, s = F, u = o, o = H; } - A = F.neg(), M = $; + A = $.neg(), M = F; var V = g.sqr().add(w.sqr()), te = A.sqr().add(M.sqr()); return te.cmp(V) >= 0 && (A = l, M = d), g.negative && (g = g.neg(), w = w.neg()), A.negative && (A = A.neg(), M = M.neg()), [ { a: g, b: w }, @@ -14713,7 +14714,7 @@ os.prototype._endoWnafMulAdd = function(e, r, n) { function kn(t, e, r, n) { Fu.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new rn(e, 16), this.y = new rn(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); } -eb(kn, Fu.BasePoint); +tb(kn, Fu.BasePoint); os.prototype.point = function(e, r, n) { return new kn(this, e, r, n); }; @@ -14859,7 +14860,7 @@ kn.prototype.toJ = function() { function zn(t, e, r, n) { Fu.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new rn(0)) : (this.x = new rn(e, 16), this.y = new rn(r, 16), this.z = new rn(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; } -eb(zn, Fu.BasePoint); +tb(zn, Fu.BasePoint); os.prototype.jpoint = function(e, r, n) { return new zn(this, e, r, n); }; @@ -14910,10 +14911,10 @@ zn.prototype.dblp = function(e) { } var i = this.curve.a, s = this.curve.tinv, o = this.x, a = this.y, u = this.z, l = u.redSqr().redSqr(), d = a.redAdd(a); for (r = 0; r < e; r++) { - var g = o.redSqr(), w = d.redSqr(), A = w.redSqr(), M = g.redAdd(g).redIAdd(g).redIAdd(i.redMul(l)), N = o.redMul(w), L = M.redSqr().redISub(N.redAdd(N)), F = N.redISub(L), $ = M.redMul(F); - $ = $.redIAdd($).redISub(A); + var g = o.redSqr(), w = d.redSqr(), A = w.redSqr(), M = g.redAdd(g).redIAdd(g).redIAdd(i.redMul(l)), N = o.redMul(w), L = M.redSqr().redISub(N.redAdd(N)), $ = N.redISub(L), F = M.redMul($); + F = F.redIAdd(F).redISub(A); var K = d.redMul(u); - r + 1 < e && (l = l.redMul(A)), o = L, u = K, d = $; + r + 1 < e && (l = l.redMul(A)), o = L, u = K, d = F; } return this.curve.jpoint(o, d.redMul(s), u); }; @@ -14930,8 +14931,8 @@ zn.prototype._zeroDbl = function() { } else { var g = this.x.redSqr(), w = this.y.redSqr(), A = w.redSqr(), M = this.x.redAdd(w).redSqr().redISub(g).redISub(A); M = M.redIAdd(M); - var N = g.redAdd(g).redIAdd(g), L = N.redSqr(), F = A.redIAdd(A); - F = F.redIAdd(F), F = F.redIAdd(F), e = L.redISub(M).redISub(M), r = N.redMul(M.redISub(e)).redISub(F), n = this.y.redMul(this.z), n = n.redIAdd(n); + var N = g.redAdd(g).redIAdd(g), L = N.redSqr(), $ = A.redIAdd(A); + $ = $.redIAdd($), $ = $.redIAdd($), e = L.redISub(M).redISub(M), r = N.redMul(M.redISub(e)).redISub($), n = this.y.redMul(this.z), n = n.redIAdd(n); } return this.curve.jpoint(e, r, n); }; @@ -14951,8 +14952,8 @@ zn.prototype._threeDbl = function() { N = N.redIAdd(N); var L = N.redAdd(N); e = M.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(g); - var F = w.redSqr(); - F = F.redIAdd(F), F = F.redIAdd(F), F = F.redIAdd(F), r = M.redMul(N.redISub(e)).redISub(F); + var $ = w.redSqr(); + $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($), r = M.redMul(N.redISub(e)).redISub($); } return this.curve.jpoint(e, r, n); }; @@ -15221,10 +15222,10 @@ Wr.prototype.mixedAdd = Wr.prototype.add; (function(t) { var e = t; e.base = V0, e.short = Jj, e.mont = Zj, e.edwards = tq; -})(Qv); -var J0 = {}, cm, Cx; +})(eb); +var J0 = {}, cm, Tx; function rq() { - return Cx || (Cx = 1, cm = { + return Tx || (Tx = 1, cm = { doubles: { step: 4, points: [ @@ -16006,7 +16007,7 @@ function rq() { }), cm; } (function(t) { - var e = t, r = Kl, n = Qv, i = Fi, s = i.assert; + var e = t, r = Kl, n = eb, i = Fi, s = i.assert; function o(l) { l.type === "short" ? this.curve = new n.short(l) : l.type === "edwards" ? this.curve = new n.edwards(l) : this.curve = new n.mont(l), this.g = this.curve.g, this.n = this.curve.n, this.hash = l.hash, s(this.g.validate(), "Invalid curve"), s(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); } @@ -16155,7 +16156,7 @@ function rq() { ] }); })(J0); -var nq = Kl, sc = Xv, A8 = yc; +var nq = Kl, sc = Zv, A8 = yc; function ba(t) { if (!(this instanceof ba)) return new ba(t); @@ -16245,7 +16246,7 @@ Qn.prototype.verify = function(e, r, n) { Qn.prototype.inspect = function() { return ""; }; -var o0 = qo, tb = Fi, cq = tb.assert; +var o0 = qo, rb = Fi, cq = rb.assert; function X0(t, e) { if (t instanceof X0) return t; @@ -16266,13 +16267,13 @@ function um(t, e) { i <<= 8, i |= t[o], i >>>= 0; return i <= 127 ? !1 : (e.place = o, i); } -function Tx(t) { +function Rx(t) { for (var e = 0, r = t.length - 1; !t[e] && !(t[e + 1] & 128) && e < r; ) e++; return e === 0 ? t : t.slice(e); } X0.prototype._importDER = function(e, r) { - e = tb.toArray(e, r); + e = rb.toArray(e, r); var n = new fq(); if (e[n.place++] !== 48) return !1; @@ -16313,14 +16314,14 @@ function fm(t, e) { } X0.prototype.toDER = function(e) { var r = this.r.toArray(), n = this.s.toArray(); - for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Tx(r), n = Tx(n); !n[0] && !(n[1] & 128); ) + for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Rx(r), n = Rx(n); !n[0] && !(n[1] & 128); ) n = n.slice(1); var i = [2]; fm(i, r.length), i = i.concat(r), i.push(2), fm(i, n.length); var s = i.concat(n), o = [48]; - return fm(o, s.length), o = o.concat(s), tb.encode(o, e); + return fm(o, s.length), o = o.concat(s), rb.encode(o, e); }; -var So = qo, P8 = iq, lq = Fi, lm = J0, hq = _8, M8 = lq.assert, rb = aq, Z0 = uq; +var So = qo, P8 = iq, lq = Fi, lm = J0, hq = _8, M8 = lq.assert, nb = aq, Z0 = uq; function es(t) { if (!(this instanceof es)) return new es(t); @@ -16331,13 +16332,13 @@ function es(t) { } var dq = es; es.prototype.keyPair = function(e) { - return new rb(this, e); + return new nb(this, e); }; es.prototype.keyFromPrivate = function(e, r) { - return rb.fromPrivate(this, e, r); + return nb.fromPrivate(this, e, r); }; es.prototype.keyFromPublic = function(e, r) { - return rb.fromPublic(this, e, r); + return nb.fromPublic(this, e, r); }; es.prototype.genKeyPair = function(e) { e || (e = {}); @@ -16425,9 +16426,9 @@ es.prototype.getKeyRecoveryParam = function(t, e, r, n) { } throw new Error("Unable to find valid recovery factor"); }; -var Jl = Fi, I8 = Jl.assert, Rx = Jl.parseBytes, Uu = Jl.cachedProperty; +var Jl = Fi, I8 = Jl.assert, Dx = Jl.parseBytes, Uu = Jl.cachedProperty; function On(t, e) { - this.eddsa = t, this._secret = Rx(e.secret), t.isPoint(e.pub) ? this._pub = e.pub : this._pubBytes = Rx(e.pub); + this.eddsa = t, this._secret = Dx(e.secret), t.isPoint(e.pub) ? this._pub = e.pub : this._pubBytes = Dx(e.pub); } On.fromPublic = function(e, r) { return r instanceof On ? r : new On(e, { pub: r }); @@ -16469,12 +16470,12 @@ On.prototype.getSecret = function(e) { On.prototype.getPublic = function(e) { return Jl.encode(this.pubBytes(), e); }; -var pq = On, gq = qo, Q0 = Fi, Dx = Q0.assert, ep = Q0.cachedProperty, mq = Q0.parseBytes; +var pq = On, gq = qo, Q0 = Fi, Ox = Q0.assert, ep = Q0.cachedProperty, mq = Q0.parseBytes; function xc(t, e) { - this.eddsa = t, typeof e != "object" && (e = mq(e)), Array.isArray(e) && (Dx(e.length === t.encodingLength * 2, "Signature has invalid size"), e = { + this.eddsa = t, typeof e != "object" && (e = mq(e)), Array.isArray(e) && (Ox(e.length === t.encodingLength * 2, "Signature has invalid size"), e = { R: e.slice(0, t.encodingLength), S: e.slice(t.encodingLength) - }), Dx(e.R && e.S, "Signature without R or S"), t.isPoint(e.R) && (this._R = e.R), e.S instanceof gq && (this._S = e.S), this._Rencoded = Array.isArray(e.R) ? e.R : e.Rencoded, this._Sencoded = Array.isArray(e.S) ? e.S : e.Sencoded; + }), Ox(e.R && e.S, "Signature without R or S"), t.isPoint(e.R) && (this._R = e.R), e.S instanceof gq && (this._S = e.S), this._Rencoded = Array.isArray(e.R) ? e.R : e.Rencoded, this._Sencoded = Array.isArray(e.S) ? e.S : e.Sencoded; } ep(xc, "S", function() { return this.eddsa.decodeInt(this.Sencoded()); @@ -16494,7 +16495,7 @@ xc.prototype.toBytes = function() { xc.prototype.toHex = function() { return Q0.encode(this.toBytes(), "hex").toUpperCase(); }; -var vq = xc, bq = Kl, yq = J0, Su = Fi, wq = Su.assert, C8 = Su.parseBytes, T8 = pq, Ox = vq; +var vq = xc, bq = Kl, yq = J0, Su = Fi, wq = Su.assert, C8 = Su.parseBytes, T8 = pq, Nx = vq; function _i(t) { if (wq(t === "ed25519", "only tested with ed25519 so far"), !(this instanceof _i)) return new _i(t); @@ -16524,7 +16525,7 @@ _i.prototype.keyFromSecret = function(e) { return T8.fromSecret(this, e); }; _i.prototype.makeSignature = function(e) { - return e instanceof Ox ? e : new Ox(this, e); + return e instanceof Nx ? e : new Nx(this, e); }; _i.prototype.encodePoint = function(e) { var r = e.getY().toArray("le", this.encodingLength); @@ -16546,7 +16547,7 @@ _i.prototype.isPoint = function(e) { }; (function(t) { var e = t; - e.version = Kj.version, e.utils = Fi, e.rand = _8, e.curve = Qv, e.curves = J0, e.ec = dq, e.eddsa = xq; + e.version = Kj.version, e.utils = Fi, e.rand = _8, e.curve = eb, e.curves = J0, e.ec = dq, e.eddsa = xq; })(x8); const _q = { waku: { publish: "waku_publish", batchPublish: "waku_batchPublish", subscribe: "waku_subscribe", batchSubscribe: "waku_batchSubscribe", subscription: "waku_subscription", unsubscribe: "waku_unsubscribe", batchUnsubscribe: "waku_batchUnsubscribe", batchFetchMessages: "waku_batchFetchMessages" }, irn: { publish: "irn_publish", batchPublish: "irn_batchPublish", subscribe: "irn_subscribe", batchSubscribe: "irn_batchSubscribe", subscription: "irn_subscription", unsubscribe: "irn_unsubscribe", batchUnsubscribe: "irn_batchUnsubscribe", batchFetchMessages: "irn_batchFetchMessages" }, iridium: { publish: "iridium_publish", batchPublish: "iridium_batchPublish", subscribe: "iridium_subscribe", batchSubscribe: "iridium_batchSubscribe", subscription: "iridium_subscription", unsubscribe: "iridium_unsubscribe", batchUnsubscribe: "iridium_batchUnsubscribe", batchFetchMessages: "iridium_batchFetchMessages" } }, Eq = ":"; function lu(t) { @@ -16556,9 +16557,9 @@ function lu(t) { function R8(t, e) { return t.includes(":") ? [t] : e.chains || []; } -var Sq = Object.defineProperty, Nx = Object.getOwnPropertySymbols, Aq = Object.prototype.hasOwnProperty, Pq = Object.prototype.propertyIsEnumerable, Lx = (t, e, r) => e in t ? Sq(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, kx = (t, e) => { - for (var r in e || (e = {})) Aq.call(e, r) && Lx(t, r, e[r]); - if (Nx) for (var r of Nx(e)) Pq.call(e, r) && Lx(t, r, e[r]); +var Sq = Object.defineProperty, Lx = Object.getOwnPropertySymbols, Aq = Object.prototype.hasOwnProperty, Pq = Object.prototype.propertyIsEnumerable, kx = (t, e, r) => e in t ? Sq(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, $x = (t, e) => { + for (var r in e || (e = {})) Aq.call(e, r) && kx(t, r, e[r]); + if (Lx) for (var r of Lx(e)) Pq.call(e, r) && kx(t, r, e[r]); return t; }; const Mq = "ReactNative", Ri = { reactNative: "react-native", node: "node", browser: "browser", unknown: "unknown" }, Iq = "js"; @@ -16566,10 +16567,10 @@ function a0() { return typeof process < "u" && typeof process.versions < "u" && typeof process.versions.node < "u"; } function ju() { - return !Wl() && !!Fv() && navigator.product === Mq; + return !Wl() && !!Bv() && navigator.product === Mq; } function Xl() { - return !a0() && !!Fv() && !!Wl(); + return !a0() && !!Bv() && !!Wl(); } function Zl() { return ju() ? Ri.reactNative : a0() ? Ri.node : Xl() ? Ri.browser : Ri.unknown; @@ -16584,7 +16585,7 @@ function Cq() { } function Tq(t, e) { let r = wl.parse(t); - return r = kx(kx({}, r), e), t = wl.stringify(r), t; + return r = $x($x({}, r), e), t = wl.stringify(r), t; } function D8() { return q4() || { name: "", description: "", url: "", icons: [""] }; @@ -16720,18 +16721,18 @@ async function Fq(t, e) { } return r; } -function $x(t, e) { +function Fx(t, e) { if (!t.includes(e)) return null; const r = t.split(/([&,?,=])/), n = r.indexOf(e); return r[n + 2]; } -function Fx() { +function Bx() { return typeof crypto < "u" && crypto != null && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu, (t) => { const e = Math.random() * 16 | 0; return (t === "x" ? e : e & 3 | 8).toString(16); }); } -function nb() { +function ib() { return typeof process < "u" && process.env.IS_VITEST === "true"; } function Bq() { @@ -16771,22 +16772,22 @@ async function Hq(t, e, r, n, i, s) { function Wq() { return Date.now() + Math.floor(Math.random() * 1e3); } -var Kq = Object.defineProperty, Vq = Object.defineProperties, Gq = Object.getOwnPropertyDescriptors, Bx = Object.getOwnPropertySymbols, Yq = Object.prototype.hasOwnProperty, Jq = Object.prototype.propertyIsEnumerable, Ux = (t, e, r) => e in t ? Kq(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Xq = (t, e) => { - for (var r in e || (e = {})) Yq.call(e, r) && Ux(t, r, e[r]); - if (Bx) for (var r of Bx(e)) Jq.call(e, r) && Ux(t, r, e[r]); +var Kq = Object.defineProperty, Vq = Object.defineProperties, Gq = Object.getOwnPropertyDescriptors, Ux = Object.getOwnPropertySymbols, Yq = Object.prototype.hasOwnProperty, Jq = Object.prototype.propertyIsEnumerable, jx = (t, e, r) => e in t ? Kq(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Xq = (t, e) => { + for (var r in e || (e = {})) Yq.call(e, r) && jx(t, r, e[r]); + if (Ux) for (var r of Ux(e)) Jq.call(e, r) && jx(t, r, e[r]); return t; }, Zq = (t, e) => Vq(t, Gq(e)); -const Qq = "did:pkh:", ib = (t) => t == null ? void 0 : t.split(":"), ez = (t) => { - const e = t && ib(t); +const Qq = "did:pkh:", sb = (t) => t == null ? void 0 : t.split(":"), ez = (t) => { + const e = t && sb(t); if (e) return t.includes(Qq) ? e[3] : e[1]; }, M1 = (t) => { - const e = t && ib(t); + const e = t && sb(t); if (e) return e[2] + ":" + e[3]; }, c0 = (t) => { - const e = t && ib(t); + const e = t && sb(t); if (e) return e.pop(); }; -async function jx(t) { +async function qx(t) { const { cacao: e, projectId: r } = t, { s: n, p: i } = e, s = B8(i, i.iss), o = c0(i.iss); return await qq(o, s, n, M1(i.iss), r); } @@ -16885,14 +16886,14 @@ function uz(t = "", e) { const s = n.join(" "), o = `${r}${s}`; return `${t ? t + " " : ""}${o}`; } -function qx(t) { +function zx(t) { var e; const r = xl(t); lc(r); const n = (e = r.att) == null ? void 0 : e.eip155; return n ? Object.keys(n).map((i) => i.split("/")[1]) : []; } -function zx(t) { +function Hx(t) { const e = xl(t); lc(e); const r = []; @@ -16908,17 +16909,17 @@ function Id(t) { const e = t == null ? void 0 : t[t.length - 1]; return oz(e) ? e : void 0; } -const j8 = "base10", oi = "base16", la = "base64pad", Sf = "base64url", Ql = "utf8", q8 = 0, Io = 1, eh = 2, fz = 0, Hx = 1, jf = 12, sb = 32; +const j8 = "base10", oi = "base16", la = "base64pad", Sf = "base64url", Ql = "utf8", q8 = 0, Io = 1, eh = 2, fz = 0, Wx = 1, jf = 12, ob = 32; function lz() { - const t = Yv.generateKeyPair(); + const t = Jv.generateKeyPair(); return { privateKey: Dn(t.secretKey, oi), publicKey: Dn(t.publicKey, oi) }; } function I1() { - const t = Pa.randomBytes(sb); + const t = Pa.randomBytes(ob); return Dn(t, oi); } function hz(t, e) { - const r = Yv.sharedKey(Rn(t, oi), Rn(e, oi), !0), n = new Rj(Gl.SHA256, r).expand(sb); + const r = Jv.sharedKey(Rn(t, oi), Rn(e, oi), !0), n = new Rj(Gl.SHA256, r).expand(ob); return Dn(n, oi); } function Cd(t) { @@ -16938,7 +16939,7 @@ function hc(t) { function dz(t) { const e = z8(typeof t.type < "u" ? t.type : q8); if (hc(e) === Io && typeof t.senderPublicKey > "u") throw new Error("Missing sender public key for type 1 envelope"); - const r = typeof t.senderPublicKey < "u" ? Rn(t.senderPublicKey, oi) : void 0, n = typeof t.iv < "u" ? Rn(t.iv, oi) : Pa.randomBytes(jf), i = new Vv.ChaCha20Poly1305(Rn(t.symKey, oi)).seal(n, Rn(t.message, Ql)); + const r = typeof t.senderPublicKey < "u" ? Rn(t.senderPublicKey, oi) : void 0, n = typeof t.iv < "u" ? Rn(t.iv, oi) : Pa.randomBytes(jf), i = new Gv.ChaCha20Poly1305(Rn(t.symKey, oi)).seal(n, Rn(t.message, Ql)); return H8({ type: e, sealed: i, iv: n, senderPublicKey: r, encoding: t.encoding }); } function pz(t, e) { @@ -16946,7 +16947,7 @@ function pz(t, e) { return H8({ type: r, sealed: i, iv: n, encoding: e }); } function gz(t) { - const e = new Vv.ChaCha20Poly1305(Rn(t.symKey, oi)), { sealed: r, iv: n } = _l({ encoded: t.encoded, encoding: t == null ? void 0 : t.encoding }), i = e.open(n, r); + const e = new Gv.ChaCha20Poly1305(Rn(t.symKey, oi)), { sealed: r, iv: n } = _l({ encoded: t.encoded, encoding: t == null ? void 0 : t.encoding }), i = e.open(n, r); if (i === null) throw new Error("Failed to decrypt"); return Dn(i, Ql); } @@ -16964,9 +16965,9 @@ function H8(t) { return Dn(Ed([t.type, t.iv, t.sealed]), e); } function _l(t) { - const { encoded: e, encoding: r = la } = t, n = Rn(e, r), i = n.slice(fz, Hx), s = Hx; + const { encoded: e, encoding: r = la } = t, n = Rn(e, r), i = n.slice(fz, Wx), s = Wx; if (hc(i) === Io) { - const l = s + sb, d = l + jf, g = n.slice(s, l), w = n.slice(l, d), A = n.slice(d); + const l = s + ob, d = l + jf, g = n.slice(s, l), w = n.slice(l, d), A = n.slice(d); return { type: i, sealed: A, iv: w, senderPublicKey: g }; } if (hc(i) === eh) { @@ -16988,10 +16989,10 @@ function W8(t) { } return { type: e, senderPublicKey: t == null ? void 0 : t.senderPublicKey, receiverPublicKey: t == null ? void 0 : t.receiverPublicKey }; } -function Wx(t) { +function Kx(t) { return t.type === Io && typeof t.senderPublicKey == "string" && typeof t.receiverPublicKey == "string"; } -function Kx(t) { +function Vx(t) { return t.type === eh; } function bz(t) { @@ -17021,9 +17022,9 @@ function $f(t) { if (typeof e > "u") throw new Error(`Relay Protocol not supported: ${t}`); return e; } -var Ez = Object.defineProperty, Sz = Object.defineProperties, Az = Object.getOwnPropertyDescriptors, Vx = Object.getOwnPropertySymbols, Pz = Object.prototype.hasOwnProperty, Mz = Object.prototype.propertyIsEnumerable, Gx = (t, e, r) => e in t ? Ez(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Yx = (t, e) => { - for (var r in e || (e = {})) Pz.call(e, r) && Gx(t, r, e[r]); - if (Vx) for (var r of Vx(e)) Mz.call(e, r) && Gx(t, r, e[r]); +var Ez = Object.defineProperty, Sz = Object.defineProperties, Az = Object.getOwnPropertyDescriptors, Gx = Object.getOwnPropertySymbols, Pz = Object.prototype.hasOwnProperty, Mz = Object.prototype.propertyIsEnumerable, Yx = (t, e, r) => e in t ? Ez(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Jx = (t, e) => { + for (var r in e || (e = {})) Pz.call(e, r) && Yx(t, r, e[r]); + if (Gx) for (var r of Gx(e)) Mz.call(e, r) && Yx(t, r, e[r]); return t; }, Iz = (t, e) => Sz(t, Az(e)); function Cz(t, e = "-") { @@ -17035,7 +17036,7 @@ function Cz(t, e = "-") { } }), r; } -function Jx(t) { +function Xx(t) { if (!t.includes("wc:")) { const u = F8(t); u != null && u.includes("wc:") && (t = u); @@ -17054,8 +17055,8 @@ function Rz(t, e = "-") { t[i] && (n[s] = t[i]); }), n; } -function Xx(t) { - return `${t.protocol}:${t.topic}@${t.version}?` + wl.stringify(Yx(Iz(Yx({ symKey: t.symKey }, Rz(t.relay)), { expiryTimestamp: t.expiryTimestamp }), t.methods ? { methods: t.methods.join(",") } : {})); +function Zx(t) { + return `${t.protocol}:${t.topic}@${t.version}?` + wl.stringify(Jx(Iz(Jx({ symKey: t.symKey }, Rz(t.relay)), { expiryTimestamp: t.expiryTimestamp }), t.methods ? { methods: t.methods.join(",") } : {})); } function ud(t, e, r) { return `${t}?wc_ev=${r}&topic=${e}`; @@ -17085,11 +17086,11 @@ function Nz(t, e) { qu(n.accounts).includes(e) && r.push(...n.events); }), r; } -function ob(t) { +function ab(t) { return t.includes(":"); } function Ff(t) { - return ob(t) ? t.split(":")[0] : t; + return ab(t) ? t.split(":")[0] : t; } function Lz(t) { const e = {}; @@ -17098,7 +17099,7 @@ function Lz(t) { e[n] || (e[n] = { accounts: [], chains: [], events: [] }), e[n].accounts.push(r), e[n].chains.push(`${n}:${i}`); }), e; } -function Zx(t, e) { +function Qx(t, e) { e = e.map((n) => n.replace("did:pkh:", "")); const r = Lz(e); for (const [n, i] of Object.entries(r)) i.methods ? i.methods = Md(i.methods, t) : i.methods = t, i.events = ["chainChanged", "accountsChanged"]; @@ -17125,7 +17126,7 @@ function gi(t) { function dn(t, e) { return e && gi(t) ? !0 : typeof t == "string" && !!t.trim().length; } -function ab(t, e) { +function cb(t, e) { return typeof t == "number" && !isNaN(t); } function Fz(t, e) { @@ -17178,7 +17179,7 @@ function zz(t, e) { let r = null; return dn(t == null ? void 0 : t.publicKey, !1) || (r = ft("MISSING_OR_INVALID", `${e} controller public key should be a string`)), r; } -function Qx(t) { +function e3(t) { let e = !0; return dc(t) ? t.length && (e = t.every((r) => dn(r, !1))) : e = !1, e; } @@ -17212,7 +17213,7 @@ function Vz(t, e) { } function Gz(t, e) { let r = null; - return Qx(t == null ? void 0 : t.methods) ? Qx(t == null ? void 0 : t.events) || (r = Or("UNSUPPORTED_EVENTS", `${e}, events should be an array of strings or empty array for no events`)) : r = Or("UNSUPPORTED_METHODS", `${e}, methods should be an array of strings or empty array for no methods`), r; + return e3(t == null ? void 0 : t.methods) ? e3(t == null ? void 0 : t.events) || (r = Or("UNSUPPORTED_EVENTS", `${e}, events should be an array of strings or empty array for no events`)) : r = Or("UNSUPPORTED_METHODS", `${e}, methods should be an array of strings or empty array for no methods`), r; } function K8(t, e) { let r = null; @@ -17258,18 +17259,18 @@ function pi(t) { return typeof t < "u" && typeof t !== null; } function Zz(t) { - return !(!t || typeof t != "object" || !t.code || !ab(t.code) || !t.message || !dn(t.message, !1)); + return !(!t || typeof t != "object" || !t.code || !cb(t.code) || !t.message || !dn(t.message, !1)); } function Qz(t) { return !(gi(t) || !dn(t.method, !1)); } function eH(t) { - return !(gi(t) || gi(t.result) && gi(t.error) || !ab(t.id) || !dn(t.jsonrpc, !1)); + return !(gi(t) || gi(t.result) && gi(t.error) || !cb(t.id) || !dn(t.jsonrpc, !1)); } function tH(t) { return !(gi(t) || !dn(t.name, !1)); } -function e3(t, e) { +function t3(t, e) { return !(!u0(e) || !Dz(t).includes(e)); } function rH(t, e, r) { @@ -17278,9 +17279,9 @@ function rH(t, e, r) { function nH(t, e, r) { return dn(r, !1) ? Nz(t, e).includes(r) : !1; } -function t3(t, e, r) { +function r3(t, e, r) { let n = null; - const i = iH(t), s = sH(e), o = Object.keys(i), a = Object.keys(s), u = r3(Object.keys(t)), l = r3(Object.keys(e)), d = u.filter((g) => !l.includes(g)); + const i = iH(t), s = sH(e), o = Object.keys(i), a = Object.keys(s), u = n3(Object.keys(t)), l = n3(Object.keys(e)), d = u.filter((g) => !l.includes(g)); return d.length && (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces keys don't satisfy requiredNamespaces. Required: ${d.toString()} Received: ${Object.keys(e).toString()}`)), tc(o, a) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces chains don't satisfy required namespaces. @@ -17304,7 +17305,7 @@ function iH(t) { }); }), e; } -function r3(t) { +function n3(t) { return [...new Set(t.map((e) => e.includes(":") ? e.split(":")[0] : e))]; } function sH(t) { @@ -17320,9 +17321,9 @@ function sH(t) { }), e; } function oH(t, e) { - return ab(t) && t <= e.max && t >= e.min; + return cb(t) && t <= e.max && t >= e.min; } -function n3() { +function i3() { const t = Zl(); return new Promise((e) => { switch (t) { @@ -17381,18 +17382,18 @@ class Af { delete dm[e]; } } -const dH = "PARSE_ERROR", pH = "INVALID_REQUEST", gH = "METHOD_NOT_FOUND", mH = "INVALID_PARAMS", G8 = "INTERNAL_ERROR", cb = "SERVER_ERROR", vH = [-32700, -32600, -32601, -32602, -32603], qf = { +const dH = "PARSE_ERROR", pH = "INVALID_REQUEST", gH = "METHOD_NOT_FOUND", mH = "INVALID_PARAMS", G8 = "INTERNAL_ERROR", ub = "SERVER_ERROR", vH = [-32700, -32600, -32601, -32602, -32603], qf = { [dH]: { code: -32700, message: "Parse error" }, [pH]: { code: -32600, message: "Invalid Request" }, [gH]: { code: -32601, message: "Method not found" }, [mH]: { code: -32602, message: "Invalid params" }, [G8]: { code: -32603, message: "Internal error" }, - [cb]: { code: -32e3, message: "Server error" } -}, Y8 = cb; + [ub]: { code: -32e3, message: "Server error" } +}, Y8 = ub; function bH(t) { return vH.includes(t); } -function i3(t) { +function s3(t) { return Object.keys(qf).includes(t) ? qf[t] : qf[Y8]; } function yH(t) { @@ -17402,10 +17403,10 @@ function yH(t) { function J8(t, e, r) { return t.message.includes("getaddrinfo ENOTFOUND") || t.message.includes("connect ECONNREFUSED") ? new Error(`Unavailable ${r} RPC url at ${e}`) : t; } -var X8 = {}, go = {}, s3; +var X8 = {}, go = {}, o3; function wH() { - if (s3) return go; - s3 = 1, Object.defineProperty(go, "__esModule", { value: !0 }), go.isBrowserCryptoAvailable = go.getSubtleCrypto = go.getBrowerCrypto = void 0; + if (o3) return go; + o3 = 1, Object.defineProperty(go, "__esModule", { value: !0 }), go.isBrowserCryptoAvailable = go.getSubtleCrypto = go.getBrowerCrypto = void 0; function t() { return (gn == null ? void 0 : gn.crypto) || (gn == null ? void 0 : gn.msCrypto) || {}; } @@ -17420,10 +17421,10 @@ function wH() { } return go.isBrowserCryptoAvailable = r, go; } -var mo = {}, o3; +var mo = {}, a3; function xH() { - if (o3) return mo; - o3 = 1, Object.defineProperty(mo, "__esModule", { value: !0 }), mo.isBrowser = mo.isNode = mo.isReactNative = void 0; + if (a3) return mo; + a3 = 1, Object.defineProperty(mo, "__esModule", { value: !0 }), mo.isBrowser = mo.isNode = mo.isReactNative = void 0; function t() { return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative"; } @@ -17472,7 +17473,7 @@ function rp(t, e, r) { }; } function _H(t, e) { - return typeof t > "u" ? i3(G8) : (typeof t == "string" && (t = Object.assign(Object.assign({}, i3(cb)), { message: t })), bH(t.code) && (t = yH(t.code)), t); + return typeof t > "u" ? s3(G8) : (typeof t == "string" && (t = Object.assign(Object.assign({}, s3(ub)), { message: t })), bH(t.code) && (t = yH(t.code)), t); } let EH = class { }, SH = class extends EH { @@ -17494,10 +17495,10 @@ function Z8(t, e) { const r = IH(t); return typeof r > "u" ? !1 : new RegExp(e).test(r); } -function a3(t) { +function c3(t) { return Z8(t, PH); } -function c3(t) { +function u3(t) { return Z8(t, MH); } function CH(t) { @@ -17506,7 +17507,7 @@ function CH(t) { function Q8(t) { return typeof t == "object" && "id" in t && "jsonrpc" in t && t.jsonrpc === "2.0"; } -function ub(t) { +function fb(t) { return Q8(t) && "method" in t; } function np(t) { @@ -17579,10 +17580,10 @@ let as = class extends AH { this.hasRegisteredEventListeners || (this.connection.on("payload", (e) => this.onPayload(e)), this.connection.on("close", (e) => this.onClose(e)), this.connection.on("error", (e) => this.events.emit("error", e)), this.connection.on("register_error", (e) => this.onClose()), this.hasRegisteredEventListeners = !0); } }; -const TH = () => typeof WebSocket < "u" ? WebSocket : typeof global < "u" && typeof global.WebSocket < "u" ? global.WebSocket : typeof window < "u" && typeof window.WebSocket < "u" ? window.WebSocket : typeof self < "u" && typeof self.WebSocket < "u" ? self.WebSocket : require("ws"), RH = () => typeof WebSocket < "u" || typeof global < "u" && typeof global.WebSocket < "u" || typeof window < "u" && typeof window.WebSocket < "u" || typeof self < "u" && typeof self.WebSocket < "u", u3 = (t) => t.split("?")[0], f3 = 10, DH = TH(); +const TH = () => typeof WebSocket < "u" ? WebSocket : typeof global < "u" && typeof global.WebSocket < "u" ? global.WebSocket : typeof window < "u" && typeof window.WebSocket < "u" ? window.WebSocket : typeof self < "u" && typeof self.WebSocket < "u" ? self.WebSocket : require("ws"), RH = () => typeof WebSocket < "u" || typeof global < "u" && typeof global.WebSocket < "u" || typeof window < "u" && typeof window.WebSocket < "u" || typeof self < "u" && typeof self.WebSocket < "u", f3 = (t) => t.split("?")[0], l3 = 10, DH = TH(); let OH = class { constructor(e) { - if (this.url = e, this.events = new rs.EventEmitter(), this.registering = !1, !c3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); + if (this.url = e, this.events = new rs.EventEmitter(), this.registering = !1, !u3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); this.url = e; } get connected() { @@ -17626,7 +17627,7 @@ let OH = class { } } register(e = this.url) { - if (!c3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); + if (!u3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); if (this.registering) { const r = this.events.getMaxListeners(); return (this.events.listenerCount("register_error") >= r || this.events.listenerCount("open") >= r) && this.events.setMaxListeners(r + 1), new Promise((n, i) => { @@ -17666,21 +17667,21 @@ let OH = class { this.events.emit("payload", s); } parseError(e, r = this.url) { - return J8(e, u3(r), "WS"); + return J8(e, f3(r), "WS"); } resetMaxListeners() { - this.events.getMaxListeners() > f3 && this.events.setMaxListeners(f3); + this.events.getMaxListeners() > l3 && this.events.setMaxListeners(l3); } emitError(e) { - const r = this.parseError(new Error((e == null ? void 0 : e.message) || `WebSocket connection failed for host: ${u3(this.url)}`)); + const r = this.parseError(new Error((e == null ? void 0 : e.message) || `WebSocket connection failed for host: ${f3(this.url)}`)); return this.events.emit("register_error", r), r; } }; var f0 = { exports: {} }; f0.exports; (function(t, e) { - var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", u = "[object Array]", l = "[object AsyncFunction]", d = "[object Boolean]", g = "[object Date]", w = "[object Error]", A = "[object Function]", M = "[object GeneratorFunction]", N = "[object Map]", L = "[object Number]", F = "[object Null]", $ = "[object Object]", K = "[object Promise]", H = "[object Proxy]", V = "[object RegExp]", te = "[object Set]", R = "[object String]", W = "[object Symbol]", pe = "[object Undefined]", Ee = "[object WeakMap]", Y = "[object ArrayBuffer]", S = "[object DataView]", m = "[object Float32Array]", f = "[object Float64Array]", p = "[object Int8Array]", b = "[object Int16Array]", x = "[object Int32Array]", _ = "[object Uint8Array]", E = "[object Uint8ClampedArray]", v = "[object Uint16Array]", P = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, B = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, D = {}; - D[m] = D[f] = D[p] = D[b] = D[x] = D[_] = D[E] = D[v] = D[P] = !0, D[a] = D[u] = D[Y] = D[d] = D[S] = D[g] = D[w] = D[A] = D[N] = D[L] = D[$] = D[V] = D[te] = D[R] = D[Ee] = !1; + var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", u = "[object Array]", l = "[object AsyncFunction]", d = "[object Boolean]", g = "[object Date]", w = "[object Error]", A = "[object Function]", M = "[object GeneratorFunction]", N = "[object Map]", L = "[object Number]", $ = "[object Null]", F = "[object Object]", K = "[object Promise]", H = "[object Proxy]", V = "[object RegExp]", te = "[object Set]", R = "[object String]", W = "[object Symbol]", pe = "[object Undefined]", Ee = "[object WeakMap]", Y = "[object ArrayBuffer]", S = "[object DataView]", m = "[object Float32Array]", f = "[object Float64Array]", p = "[object Int8Array]", b = "[object Int16Array]", x = "[object Int32Array]", _ = "[object Uint8Array]", E = "[object Uint8ClampedArray]", v = "[object Uint16Array]", P = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, B = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, D = {}; + D[m] = D[f] = D[p] = D[b] = D[x] = D[_] = D[E] = D[v] = D[P] = !0, D[a] = D[u] = D[Y] = D[d] = D[S] = D[g] = D[w] = D[A] = D[N] = D[L] = D[F] = D[V] = D[te] = D[R] = D[Ee] = !1; var oe = typeof gn == "object" && gn && gn.Object === Object && gn, Z = typeof self == "object" && self && self.Object === Object && self, J = oe || Z || Function("return this")(), Q = e && !e.nodeType && e, T = Q && !0 && t && !t.nodeType && t, X = T && T.exports === Q, re = X && oe.process, de = function() { try { return re && re.binding && re.binding("util"); @@ -17894,7 +17895,7 @@ f0.exports; return Pc(ae) ? Pt : ve(Pt, Ge(ae)); } function zt(ae) { - return ae == null ? ae === void 0 ? pe : F : Et && Et in Object(ae) ? $r(ae) : Rp(ae); + return ae == null ? ae === void 0 ? pe : $ : Et && Et in Object(ae) ? $r(ae) : Rp(ae); } function Xt(ae) { return Ra(ae) && zt(ae) == a; @@ -17904,8 +17905,8 @@ f0.exports; } function le(ae, ye, Ge, Pt, Ur, rr) { var Kr = Pc(ae), vn = Pc(ye), _r = Kr ? u : Ir(ae), jr = vn ? u : Ir(ye); - _r = _r == a ? $ : _r, jr = jr == a ? $ : jr; - var an = _r == $, ci = jr == $, bn = _r == jr; + _r = _r == a ? F : _r, jr = jr == a ? F : jr; + var an = _r == F, ci = jr == F, bn = _r == jr; if (bn && Ju(ae)) { if (!Ju(ye)) return !1; @@ -18065,7 +18066,7 @@ f0.exports; })); } : Br, Ir = zt; (kt && Ir(new kt(new ArrayBuffer(1))) != S || Ct && Ir(new Ct()) != N || gt && Ir(gt.resolve()) != K || Rt && Ir(new Rt()) != te || Nt && Ir(new Nt()) != Ee) && (Ir = function(ae) { - var ye = zt(ae), Ge = ye == $ ? ae.constructor : void 0, Pt = Ge ? no(Ge) : ""; + var ye = zt(ae), Ge = ye == F ? ae.constructor : void 0, Pt = Ge ? no(Ge) : ""; if (Pt) switch (Pt) { case $t: @@ -18155,7 +18156,7 @@ f0.exports; t.exports = Op; })(f0, f0.exports); var NH = f0.exports; -const LH = /* @__PURE__ */ ts(NH), eE = "wc", tE = 2, rE = "core", Zs = `${eE}@2:${rE}:`, kH = { logger: "error" }, $H = { database: ":memory:" }, FH = "crypto", l3 = "client_ed25519_seed", BH = mt.ONE_DAY, UH = "keychain", jH = "0.3", qH = "messages", zH = "0.3", HH = mt.SIX_HOURS, WH = "publisher", nE = "irn", KH = "error", iE = "wss://relay.walletconnect.org", VH = "relayer", si = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", publish: "relayer_publish" }, GH = "_subscription", Vi = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, YH = 0.1, T1 = "2.17.2", zr = { link_mode: "link_mode", relay: "relay" }, JH = "0.3", XH = "WALLETCONNECT_CLIENT_ID", h3 = "WALLETCONNECT_LINK_MODE_APPS", Us = { created: "subscription_created", deleted: "subscription_deleted", sync: "subscription_sync", resubscribed: "subscription_resubscribed" }, ZH = "subscription", QH = "0.3", eW = mt.FIVE_SECONDS * 1e3, tW = "pairing", rW = "0.3", Pf = { wc_pairingDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1e3 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1001 } }, wc_pairingPing: { req: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1002 }, res: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1003 } }, unregistered_method: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 } } }, Xa = { create: "pairing_create", expire: "pairing_expire", delete: "pairing_delete", ping: "pairing_ping" }, gs = { created: "history_created", updated: "history_updated", deleted: "history_deleted", sync: "history_sync" }, nW = "history", iW = "0.3", sW = "expirer", Ji = { created: "expirer_created", deleted: "expirer_deleted", expired: "expirer_expired", sync: "expirer_sync" }, oW = "0.3", aW = "verify-api", cW = "https://verify.walletconnect.com", sE = "https://verify.walletconnect.org", zf = sE, uW = `${zf}/v3`, fW = [cW, sE], lW = "echo", hW = "https://echo.walletconnect.com", Fs = { pairing_started: "pairing_started", pairing_uri_validation_success: "pairing_uri_validation_success", pairing_uri_not_expired: "pairing_uri_not_expired", store_new_pairing: "store_new_pairing", subscribing_pairing_topic: "subscribing_pairing_topic", subscribe_pairing_topic_success: "subscribe_pairing_topic_success", existing_pairing: "existing_pairing", pairing_not_expired: "pairing_not_expired", emit_inactive_pairing: "emit_inactive_pairing", emit_session_proposal: "emit_session_proposal" }, yo = { no_internet_connection: "no_internet_connection", malformed_pairing_uri: "malformed_pairing_uri", active_pairing_already_exists: "active_pairing_already_exists", subscribe_pairing_topic_failure: "subscribe_pairing_topic_failure", pairing_expired: "pairing_expired", proposal_listener_not_found: "proposal_listener_not_found" }, ms = { session_approve_started: "session_approve_started", session_namespaces_validation_success: "session_namespaces_validation_success", subscribing_session_topic: "subscribing_session_topic", subscribe_session_topic_success: "subscribe_session_topic_success", publishing_session_approve: "publishing_session_approve", session_approve_publish_success: "session_approve_publish_success", store_session: "store_session", publishing_session_settle: "publishing_session_settle", session_settle_publish_success: "session_settle_publish_success" }, Ha = { no_internet_connection: "no_internet_connection", proposal_expired: "proposal_expired", subscribe_session_topic_failure: "subscribe_session_topic_failure", session_approve_publish_failure: "session_approve_publish_failure", session_settle_publish_failure: "session_settle_publish_failure", session_approve_namespace_validation_failure: "session_approve_namespace_validation_failure", proposal_not_found: "proposal_not_found" }, Wa = { authenticated_session_approve_started: "authenticated_session_approve_started", create_authenticated_session_topic: "create_authenticated_session_topic", cacaos_verified: "cacaos_verified", store_authenticated_session: "store_authenticated_session", subscribing_authenticated_session_topic: "subscribing_authenticated_session_topic", subscribe_authenticated_session_topic_success: "subscribe_authenticated_session_topic_success", publishing_authenticated_session_approve: "publishing_authenticated_session_approve" }, Mf = { no_internet_connection: "no_internet_connection", invalid_cacao: "invalid_cacao", subscribe_authenticated_session_topic_failure: "subscribe_authenticated_session_topic_failure", authenticated_session_approve_publish_failure: "authenticated_session_approve_publish_failure", authenticated_session_pending_request_not_found: "authenticated_session_pending_request_not_found" }, dW = 0.1, pW = "event-client", gW = 86400, mW = "https://pulse.walletconnect.org/batch"; +const LH = /* @__PURE__ */ ts(NH), eE = "wc", tE = 2, rE = "core", Zs = `${eE}@2:${rE}:`, kH = { logger: "error" }, $H = { database: ":memory:" }, FH = "crypto", h3 = "client_ed25519_seed", BH = mt.ONE_DAY, UH = "keychain", jH = "0.3", qH = "messages", zH = "0.3", HH = mt.SIX_HOURS, WH = "publisher", nE = "irn", KH = "error", iE = "wss://relay.walletconnect.org", VH = "relayer", si = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", publish: "relayer_publish" }, GH = "_subscription", Vi = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, YH = 0.1, T1 = "2.17.2", zr = { link_mode: "link_mode", relay: "relay" }, JH = "0.3", XH = "WALLETCONNECT_CLIENT_ID", d3 = "WALLETCONNECT_LINK_MODE_APPS", Us = { created: "subscription_created", deleted: "subscription_deleted", sync: "subscription_sync", resubscribed: "subscription_resubscribed" }, ZH = "subscription", QH = "0.3", eW = mt.FIVE_SECONDS * 1e3, tW = "pairing", rW = "0.3", Pf = { wc_pairingDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1e3 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1001 } }, wc_pairingPing: { req: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1002 }, res: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1003 } }, unregistered_method: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 } } }, Xa = { create: "pairing_create", expire: "pairing_expire", delete: "pairing_delete", ping: "pairing_ping" }, gs = { created: "history_created", updated: "history_updated", deleted: "history_deleted", sync: "history_sync" }, nW = "history", iW = "0.3", sW = "expirer", Ji = { created: "expirer_created", deleted: "expirer_deleted", expired: "expirer_expired", sync: "expirer_sync" }, oW = "0.3", aW = "verify-api", cW = "https://verify.walletconnect.com", sE = "https://verify.walletconnect.org", zf = sE, uW = `${zf}/v3`, fW = [cW, sE], lW = "echo", hW = "https://echo.walletconnect.com", Fs = { pairing_started: "pairing_started", pairing_uri_validation_success: "pairing_uri_validation_success", pairing_uri_not_expired: "pairing_uri_not_expired", store_new_pairing: "store_new_pairing", subscribing_pairing_topic: "subscribing_pairing_topic", subscribe_pairing_topic_success: "subscribe_pairing_topic_success", existing_pairing: "existing_pairing", pairing_not_expired: "pairing_not_expired", emit_inactive_pairing: "emit_inactive_pairing", emit_session_proposal: "emit_session_proposal" }, yo = { no_internet_connection: "no_internet_connection", malformed_pairing_uri: "malformed_pairing_uri", active_pairing_already_exists: "active_pairing_already_exists", subscribe_pairing_topic_failure: "subscribe_pairing_topic_failure", pairing_expired: "pairing_expired", proposal_listener_not_found: "proposal_listener_not_found" }, ms = { session_approve_started: "session_approve_started", session_namespaces_validation_success: "session_namespaces_validation_success", subscribing_session_topic: "subscribing_session_topic", subscribe_session_topic_success: "subscribe_session_topic_success", publishing_session_approve: "publishing_session_approve", session_approve_publish_success: "session_approve_publish_success", store_session: "store_session", publishing_session_settle: "publishing_session_settle", session_settle_publish_success: "session_settle_publish_success" }, Ha = { no_internet_connection: "no_internet_connection", proposal_expired: "proposal_expired", subscribe_session_topic_failure: "subscribe_session_topic_failure", session_approve_publish_failure: "session_approve_publish_failure", session_settle_publish_failure: "session_settle_publish_failure", session_approve_namespace_validation_failure: "session_approve_namespace_validation_failure", proposal_not_found: "proposal_not_found" }, Wa = { authenticated_session_approve_started: "authenticated_session_approve_started", create_authenticated_session_topic: "create_authenticated_session_topic", cacaos_verified: "cacaos_verified", store_authenticated_session: "store_authenticated_session", subscribing_authenticated_session_topic: "subscribing_authenticated_session_topic", subscribe_authenticated_session_topic_success: "subscribe_authenticated_session_topic_success", publishing_authenticated_session_approve: "publishing_authenticated_session_approve" }, Mf = { no_internet_connection: "no_internet_connection", invalid_cacao: "invalid_cacao", subscribe_authenticated_session_topic_failure: "subscribe_authenticated_session_topic_failure", authenticated_session_approve_publish_failure: "authenticated_session_approve_publish_failure", authenticated_session_pending_request_not_found: "authenticated_session_pending_request_not_found" }, dW = 0.1, pW = "event-client", gW = 86400, mW = "https://pulse.walletconnect.org/batch"; function vW(t, e) { if (t.length >= 255) throw new TypeError("Alphabet too long"); for (var r = new Uint8Array(256), n = 0; n < r.length; n++) r[n] = 255; @@ -18168,11 +18169,11 @@ function vW(t, e) { function g(M) { if (M instanceof Uint8Array || (ArrayBuffer.isView(M) ? M = new Uint8Array(M.buffer, M.byteOffset, M.byteLength) : Array.isArray(M) && (M = Uint8Array.from(M))), !(M instanceof Uint8Array)) throw new TypeError("Expected Uint8Array"); if (M.length === 0) return ""; - for (var N = 0, L = 0, F = 0, $ = M.length; F !== $ && M[F] === 0; ) F++, N++; - for (var K = ($ - F) * d + 1 >>> 0, H = new Uint8Array(K); F !== $; ) { - for (var V = M[F], te = 0, R = K - 1; (V !== 0 || te < L) && R !== -1; R--, te++) V += 256 * H[R] >>> 0, H[R] = V % a >>> 0, V = V / a >>> 0; + for (var N = 0, L = 0, $ = 0, F = M.length; $ !== F && M[$] === 0; ) $++, N++; + for (var K = (F - $) * d + 1 >>> 0, H = new Uint8Array(K); $ !== F; ) { + for (var V = M[$], te = 0, R = K - 1; (V !== 0 || te < L) && R !== -1; R--, te++) V += 256 * H[R] >>> 0, H[R] = V % a >>> 0, V = V / a >>> 0; if (V !== 0) throw new Error("Non-zero carry"); - L = te, F++; + L = te, $++; } for (var W = K - L; W !== K && H[W] === 0; ) W++; for (var pe = u.repeat(N); W < K; ++W) pe += t.charAt(H[W]); @@ -18183,17 +18184,17 @@ function vW(t, e) { if (M.length === 0) return new Uint8Array(); var N = 0; if (M[N] !== " ") { - for (var L = 0, F = 0; M[N] === u; ) L++, N++; - for (var $ = (M.length - N) * l + 1 >>> 0, K = new Uint8Array($); M[N]; ) { + for (var L = 0, $ = 0; M[N] === u; ) L++, N++; + for (var F = (M.length - N) * l + 1 >>> 0, K = new Uint8Array(F); M[N]; ) { var H = r[M.charCodeAt(N)]; if (H === 255) return; - for (var V = 0, te = $ - 1; (H !== 0 || V < F) && te !== -1; te--, V++) H += a * K[te] >>> 0, K[te] = H % 256 >>> 0, H = H / 256 >>> 0; + for (var V = 0, te = F - 1; (H !== 0 || V < $) && te !== -1; te--, V++) H += a * K[te] >>> 0, K[te] = H % 256 >>> 0, H = H / 256 >>> 0; if (H !== 0) throw new Error("Non-zero carry"); - F = V, N++; + $ = V, N++; } if (M[N] !== " ") { - for (var R = $ - F; R !== $ && K[R] === 0; ) R++; - for (var W = new Uint8Array(L + ($ - R)), pe = L; R !== $; ) W[pe++] = K[R++]; + for (var R = F - $; R !== F && K[R] === 0; ) R++; + for (var W = new Uint8Array(L + (F - R)), pe = L; R !== F; ) W[pe++] = K[R++]; return W; } } @@ -18320,28 +18321,28 @@ function uK(t) { return new Uint8Array(e); } const fK = ip({ prefix: "🚀", name: "base256emoji", encode: cK, decode: uK }); -var lK = Object.freeze({ __proto__: null, base256emoji: fK }), hK = uE, d3 = 128, dK = 127, pK = ~dK, gK = Math.pow(2, 31); +var lK = Object.freeze({ __proto__: null, base256emoji: fK }), hK = uE, p3 = 128, dK = 127, pK = ~dK, gK = Math.pow(2, 31); function uE(t, e, r) { e = e || [], r = r || 0; - for (var n = r; t >= gK; ) e[r++] = t & 255 | d3, t /= 128; - for (; t & pK; ) e[r++] = t & 255 | d3, t >>>= 7; + for (var n = r; t >= gK; ) e[r++] = t & 255 | p3, t /= 128; + for (; t & pK; ) e[r++] = t & 255 | p3, t >>>= 7; return e[r] = t | 0, uE.bytes = r - n + 1, e; } -var mK = R1, vK = 128, p3 = 127; +var mK = R1, vK = 128, g3 = 127; function R1(t, n) { var r = 0, n = n || 0, i = 0, s = n, o, a = t.length; do { if (s >= a) throw R1.bytes = 0, new RangeError("Could not decode varint"); - o = t[s++], r += i < 28 ? (o & p3) << i : (o & p3) * Math.pow(2, i), i += 7; + o = t[s++], r += i < 28 ? (o & g3) << i : (o & g3) * Math.pow(2, i), i += 7; } while (o >= vK); return R1.bytes = s - n, r; } var bK = Math.pow(2, 7), yK = Math.pow(2, 14), wK = Math.pow(2, 21), xK = Math.pow(2, 28), _K = Math.pow(2, 35), EK = Math.pow(2, 42), SK = Math.pow(2, 49), AK = Math.pow(2, 56), PK = Math.pow(2, 63), MK = function(t) { return t < bK ? 1 : t < yK ? 2 : t < wK ? 3 : t < xK ? 4 : t < _K ? 5 : t < EK ? 6 : t < SK ? 7 : t < AK ? 8 : t < PK ? 9 : 10; }, IK = { encode: hK, decode: mK, encodingLength: MK }, fE = IK; -const g3 = (t, e, r = 0) => (fE.encode(t, e, r), e), m3 = (t) => fE.encodingLength(t), D1 = (t, e) => { - const r = e.byteLength, n = m3(t), i = n + m3(r), s = new Uint8Array(i + r); - return g3(t, s, 0), g3(r, s, n), s.set(e, i), new CK(t, r, e, s); +const m3 = (t, e, r = 0) => (fE.encode(t, e, r), e), v3 = (t) => fE.encodingLength(t), D1 = (t, e) => { + const r = e.byteLength, n = v3(t), i = n + v3(r), s = new Uint8Array(i + r); + return m3(t, s, 0), m3(r, s, n), s.set(e, i), new CK(t, r, e, s); }; class CK { constructor(e, r, n, i) { @@ -18365,7 +18366,7 @@ var OK = Object.freeze({ __proto__: null, sha256: RK, sha512: DK }); const dE = 0, NK = "identity", pE = oE, LK = (t) => D1(dE, pE(t)), kK = { code: dE, name: NK, encode: pE, digest: LK }; var $K = Object.freeze({ __proto__: null, identity: kK }); new TextEncoder(), new TextDecoder(); -const v3 = { ...CW, ...RW, ...OW, ...LW, ...FW, ...GW, ...XW, ...eK, ...sK, ...lK }; +const b3 = { ...CW, ...RW, ...OW, ...LW, ...FW, ...GW, ...XW, ...eK, ...sK, ...lK }; ({ ...OK, ...$K }); function FK(t = 0) { return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); @@ -18373,7 +18374,7 @@ function FK(t = 0) { function gE(t, e, r, n) { return { name: t, prefix: e, encoder: { name: t, prefix: e, encode: r }, decoder: { decode: n } }; } -const b3 = gE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), pm = gE("ascii", "a", (t) => { +const y3 = gE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), pm = gE("ascii", "a", (t) => { let e = "a"; for (let r = 0; r < t.length; r++) e += String.fromCharCode(t[r]); return e; @@ -18382,7 +18383,7 @@ const b3 = gE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) = const e = FK(t.length); for (let r = 0; r < t.length; r++) e[r] = t.charCodeAt(r); return e; -}), BK = { utf8: b3, "utf-8": b3, hex: v3.base16, latin1: pm, ascii: pm, binary: pm, ...v3 }; +}), BK = { utf8: y3, "utf-8": y3, hex: b3.base16, latin1: pm, ascii: pm, binary: pm, ...b3 }; function UK(t, e = "utf8") { const r = BK[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); @@ -18437,7 +18438,7 @@ let jK = class { this.initialized || (await this.keychain.init(), this.initialized = !0); }, this.hasKeys = (i) => (this.isInitialized(), this.keychain.has(i)), this.getClientId = async () => { this.isInitialized(); - const i = await this.getClientSeed(), s = nx(i); + const i = await this.getClientSeed(), s = ix(i); return U4(s.publicKey); }, this.generateKeyPair = () => { this.isInitialized(); @@ -18445,7 +18446,7 @@ let jK = class { return this.setPrivateKey(i.publicKey, i.privateKey); }, this.signJWT = async (i) => { this.isInitialized(); - const s = await this.getClientSeed(), o = nx(s), a = this.randomSessionIdentifier; + const s = await this.getClientSeed(), o = ix(s), a = this.randomSessionIdentifier; return await NF(a, i, BH, o); }, this.generateSharedKey = (i, s, o) => { this.isInitialized(); @@ -18462,8 +18463,8 @@ let jK = class { }, this.encode = async (i, s, o) => { this.isInitialized(); const a = W8(o), u = ko(s); - if (Kx(a)) return pz(u, o == null ? void 0 : o.encoding); - if (Wx(a)) { + if (Vx(a)) return pz(u, o == null ? void 0 : o.encoding); + if (Kx(a)) { const w = a.senderPublicKey, A = a.receiverPublicKey; i = await this.generateSharedKey(w, A); } @@ -18472,11 +18473,11 @@ let jK = class { }, this.decode = async (i, s, o) => { this.isInitialized(); const a = vz(s, o); - if (Kx(a)) { + if (Vx(a)) { const u = mz(s, o == null ? void 0 : o.encoding); return uc(u); } - if (Wx(a)) { + if (Kx(a)) { const u = a.receiverPublicKey, l = a.senderPublicKey; i = await this.generateSharedKey(u, l); } @@ -18506,9 +18507,9 @@ let jK = class { async getClientSeed() { let e = ""; try { - e = this.keychain.get(l3); + e = this.keychain.get(h3); } catch { - e = I1(), await this.keychain.set(l3, e); + e = I1(), await this.keychain.set(h3, e); } return UK(e, "base16"); } @@ -18586,11 +18587,11 @@ class HK extends jk { try { for (; N === void 0; ) { if (Date.now() - M > this.publishTimeout) throw new Error(A); - this.logger.trace({ id: g, attempts: L }, `publisher.publish - attempt ${L}`), N = await await hu(this.rpcPublish(n, i, a, u, l, d, g, s == null ? void 0 : s.attestation).catch((F) => this.logger.warn(F)), this.publishTimeout, A), L++, N || await new Promise((F) => setTimeout(F, this.failedPublishTimeout)); + this.logger.trace({ id: g, attempts: L }, `publisher.publish - attempt ${L}`), N = await await hu(this.rpcPublish(n, i, a, u, l, d, g, s == null ? void 0 : s.attestation).catch(($) => this.logger.warn($)), this.publishTimeout, A), L++, N || await new Promise(($) => setTimeout($, this.failedPublishTimeout)); } this.relayer.events.emit(si.publish, w), this.logger.debug("Successfully Published Payload"), this.logger.trace({ type: "method", method: "publish", params: { id: g, topic: n, message: i, opts: s } }); - } catch (F) { - if (this.logger.debug("Failed to Publish Payload"), this.logger.error(F), (o = s == null ? void 0 : s.internal) != null && o.throwOnFailedPublish) throw F; + } catch ($) { + if (this.logger.debug("Failed to Publish Payload"), this.logger.error($), (o = s == null ? void 0 : s.internal) != null && o.throwOnFailedPublish) throw $; this.queue.set(g, w); } }, this.on = (n, i) => { @@ -18659,9 +18660,9 @@ class WK { return Array.from(this.map.keys()); } } -var KK = Object.defineProperty, VK = Object.defineProperties, GK = Object.getOwnPropertyDescriptors, y3 = Object.getOwnPropertySymbols, YK = Object.prototype.hasOwnProperty, JK = Object.prototype.propertyIsEnumerable, w3 = (t, e, r) => e in t ? KK(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, If = (t, e) => { - for (var r in e || (e = {})) YK.call(e, r) && w3(t, r, e[r]); - if (y3) for (var r of y3(e)) JK.call(e, r) && w3(t, r, e[r]); +var KK = Object.defineProperty, VK = Object.defineProperties, GK = Object.getOwnPropertyDescriptors, w3 = Object.getOwnPropertySymbols, YK = Object.prototype.hasOwnProperty, JK = Object.prototype.propertyIsEnumerable, x3 = (t, e, r) => e in t ? KK(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, If = (t, e) => { + for (var r in e || (e = {})) YK.call(e, r) && x3(t, r, e[r]); + if (w3) for (var r of w3(e)) JK.call(e, r) && x3(t, r, e[r]); return t; }, gm = (t, e) => VK(t, GK(e)); class XK extends Hk { @@ -18910,9 +18911,9 @@ class XK extends Hk { }); } } -var ZK = Object.defineProperty, x3 = Object.getOwnPropertySymbols, QK = Object.prototype.hasOwnProperty, eV = Object.prototype.propertyIsEnumerable, _3 = (t, e, r) => e in t ? ZK(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, E3 = (t, e) => { - for (var r in e || (e = {})) QK.call(e, r) && _3(t, r, e[r]); - if (x3) for (var r of x3(e)) eV.call(e, r) && _3(t, r, e[r]); +var ZK = Object.defineProperty, _3 = Object.getOwnPropertySymbols, QK = Object.prototype.hasOwnProperty, eV = Object.prototype.propertyIsEnumerable, E3 = (t, e, r) => e in t ? ZK(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, S3 = (t, e) => { + for (var r in e || (e = {})) QK.call(e, r) && E3(t, r, e[r]); + if (_3) for (var r of _3(e)) eV.call(e, r) && E3(t, r, e[r]); return t; }; class tV extends qk { @@ -18992,7 +18993,7 @@ class tV extends qk { return await Promise.all([new Promise((d) => { u = d, this.subscriber.on(Us.created, l); }), new Promise(async (d, g) => { - a = await this.subscriber.subscribe(e, E3({ internal: { throwOnFailedPublish: o } }, r)).catch((w) => { + a = await this.subscriber.subscribe(e, S3({ internal: { throwOnFailedPublish: o } }, r)).catch((w) => { o && g(w); }) || a, d(); })]), a; @@ -19050,7 +19051,7 @@ class tV extends qk { this.connectionAttemptInProgress || (this.relayUrl = e || this.relayUrl, await this.confirmOnlineStateOrThrow(), await this.transportClose(), await this.transportOpen()); } async confirmOnlineStateOrThrow() { - if (!await n3()) throw new Error("No internet connection detected. Please restart your network and try again."); + if (!await i3()) throw new Error("No internet connection detected. Please restart your network and try again."); } async handleBatchMessageEvents(e) { if ((e == null ? void 0 : e.length) === 0) { @@ -19104,10 +19105,10 @@ class tV extends qk { return i && this.logger.debug(`Ignoring duplicate message: ${n}`), i; } async onProviderPayload(e) { - if (this.logger.debug("Incoming Relay Payload"), this.logger.trace({ type: "payload", direction: "incoming", payload: e }), ub(e)) { + if (this.logger.debug("Incoming Relay Payload"), this.logger.trace({ type: "payload", direction: "incoming", payload: e }), fb(e)) { if (!e.method.endsWith(GH)) return; const r = e.params, { topic: n, message: i, publishedAt: s, attestation: o } = r.data, a = { topic: n, message: i, publishedAt: s, transportType: zr.relay, attestation: o }; - this.logger.debug("Emitting Relayer Payload"), this.logger.trace(E3({ type: "event", event: r.id }, a)), this.events.emit(r.id, a), await this.acknowledgePayload(e), await this.onMessageEvent(a); + this.logger.debug("Emitting Relayer Payload"), this.logger.trace(S3({ type: "event", event: r.id }, a)), this.events.emit(r.id, a), await this.acknowledgePayload(e), await this.onMessageEvent(a); } else np(e) && this.events.emit(si.message_ack, e); } async onMessageEvent(e) { @@ -19121,7 +19122,7 @@ class tV extends qk { this.provider.off(Vi.payload, this.onPayloadHandler), this.provider.off(Vi.connect, this.onConnectHandler), this.provider.off(Vi.disconnect, this.onDisconnectHandler), this.provider.off(Vi.error, this.onProviderErrorHandler), clearTimeout(this.pingTimeout); } async registerEventListeners() { - let e = await n3(); + let e = await i3(); fH(async (r) => { e !== r && (e = r, r ? await this.restartTransport().catch((n) => this.logger.error(n)) : (this.hasExperiencedNetworkDisruption = !0, await this.transportDisconnect(), this.transportExplicitlyClosed = !1)); }); @@ -19145,9 +19146,9 @@ class tV extends qk { }), await this.transportOpen()); } } -var rV = Object.defineProperty, S3 = Object.getOwnPropertySymbols, nV = Object.prototype.hasOwnProperty, iV = Object.prototype.propertyIsEnumerable, A3 = (t, e, r) => e in t ? rV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, P3 = (t, e) => { - for (var r in e || (e = {})) nV.call(e, r) && A3(t, r, e[r]); - if (S3) for (var r of S3(e)) iV.call(e, r) && A3(t, r, e[r]); +var rV = Object.defineProperty, A3 = Object.getOwnPropertySymbols, nV = Object.prototype.hasOwnProperty, iV = Object.prototype.propertyIsEnumerable, P3 = (t, e, r) => e in t ? rV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, M3 = (t, e) => { + for (var r in e || (e = {})) nV.call(e, r) && P3(t, r, e[r]); + if (A3) for (var r of A3(e)) iV.call(e, r) && P3(t, r, e[r]); return t; }; class _c extends zk { @@ -19160,7 +19161,7 @@ class _c extends zk { this.isInitialized(), this.map.has(o) ? await this.update(o, a) : (this.logger.debug("Setting value"), this.logger.trace({ type: "method", method: "set", key: o, value: a }), this.map.set(o, a), await this.persist()); }, this.get = (o) => (this.isInitialized(), this.logger.debug("Getting value"), this.logger.trace({ type: "method", method: "get", key: o }), this.getData(o)), this.getAll = (o) => (this.isInitialized(), o ? this.values.filter((a) => Object.keys(o).every((u) => LH(a[u], o[u]))) : this.values), this.update = async (o, a) => { this.isInitialized(), this.logger.debug("Updating value"), this.logger.trace({ type: "method", method: "update", key: o, update: a }); - const u = P3(P3({}, this.getData(o)), a); + const u = M3(M3({}, this.getData(o)), a); this.map.set(o, u), await this.persist(); }, this.delete = async (o, a) => { this.isInitialized(), this.map.has(o) && (this.logger.debug("Deleting value"), this.logger.trace({ type: "method", method: "delete", key: o, reason: a }), this.map.delete(o), this.addToRecentlyDeleted(o), await this.persist()); @@ -19227,19 +19228,19 @@ class _c extends zk { } class sV { constructor(e, r) { - this.core = e, this.logger = r, this.name = tW, this.version = rW, this.events = new Lv(), this.initialized = !1, this.storagePrefix = Zs, this.ignoredPayloadTypes = [Io], this.registeredMethods = [], this.init = async () => { + this.core = e, this.logger = r, this.name = tW, this.version = rW, this.events = new kv(), this.initialized = !1, this.storagePrefix = Zs, this.ignoredPayloadTypes = [Io], this.registeredMethods = [], this.init = async () => { this.initialized || (await this.pairings.init(), await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.initialized = !0, this.logger.trace("Initialized")); }, this.register = ({ methods: n }) => { this.isInitialized(), this.registeredMethods = [.../* @__PURE__ */ new Set([...this.registeredMethods, ...n])]; }, this.create = async (n) => { this.isInitialized(); - const i = I1(), s = await this.core.crypto.setSymKey(i), o = En(mt.FIVE_MINUTES), a = { protocol: nE }, u = { topic: s, expiry: o, relay: a, active: !1, methods: n == null ? void 0 : n.methods }, l = Xx({ protocol: this.core.protocol, version: this.core.version, topic: s, symKey: i, relay: a, expiryTimestamp: o, methods: n == null ? void 0 : n.methods }); + const i = I1(), s = await this.core.crypto.setSymKey(i), o = En(mt.FIVE_MINUTES), a = { protocol: nE }, u = { topic: s, expiry: o, relay: a, active: !1, methods: n == null ? void 0 : n.methods }, l = Zx({ protocol: this.core.protocol, version: this.core.version, topic: s, symKey: i, relay: a, expiryTimestamp: o, methods: n == null ? void 0 : n.methods }); return this.events.emit(Xa.create, u), this.core.expirer.set(s, o), await this.pairings.set(s, u), await this.core.relayer.subscribe(s, { transportType: n == null ? void 0 : n.transportType }), { topic: s, uri: l }; }, this.pair = async (n) => { this.isInitialized(); const i = this.core.eventClient.createEvent({ properties: { topic: n == null ? void 0 : n.uri, trace: [Fs.pairing_started] } }); this.isValidPair(n, i); - const { topic: s, symKey: o, relay: a, expiryTimestamp: u, methods: l } = Jx(n.uri); + const { topic: s, symKey: o, relay: a, expiryTimestamp: u, methods: l } = Xx(n.uri); i.props.properties.topic = s, i.addTrace(Fs.pairing_uri_validation_success), i.addTrace(Fs.pairing_uri_not_expired); let d; if (this.pairings.keys.includes(s)) { @@ -19283,7 +19284,7 @@ class sV { }, this.formatUriFromPairing = (n) => { this.isInitialized(); const { topic: i, relay: s, expiry: o, methods: a } = n, u = this.core.crypto.keychain.get(i); - return Xx({ protocol: this.core.protocol, version: this.core.version, topic: i, symKey: u, relay: s, expiryTimestamp: o, methods: a }); + return Zx({ protocol: this.core.protocol, version: this.core.version, topic: i, symKey: u, relay: s, expiryTimestamp: o, methods: a }); }, this.sendRequest = async (n, i, s) => { const o = ha(i, s), a = await this.core.crypto.encode(n, o), u = Pf[i].req; return this.core.history.set(n, o), this.core.relayer.publish(n, a, u), o.id; @@ -19356,7 +19357,7 @@ class sV { const { message: a } = ft("MISSING_OR_INVALID", `pair() uri: ${n.uri}`); throw i.setError(yo.malformed_pairing_uri), new Error(a); } - const o = Jx(n == null ? void 0 : n.uri); + const o = Xx(n == null ? void 0 : n.uri); if (!((s = o == null ? void 0 : o.relay) != null && s.protocol)) { const { message: a } = ft("MISSING_OR_INVALID", "pair() uri#relay-protocol"); throw i.setError(yo.malformed_pairing_uri), new Error(a); @@ -19415,7 +19416,7 @@ class sV { if (!this.pairings.keys.includes(r) || i === zr.link_mode || this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n))) return; const s = await this.core.crypto.decode(r, n); try { - ub(s) ? (this.core.history.set(r, s), this.onRelayEventRequest({ topic: r, payload: s })) : np(s) && (await this.core.history.resolve(s), await this.onRelayEventResponse({ topic: r, payload: s }), this.core.history.delete(r, s.id)); + fb(s) ? (this.core.history.set(r, s), this.onRelayEventRequest({ topic: r, payload: s })) : np(s) && (await this.core.history.resolve(s), await this.onRelayEventResponse({ topic: r, payload: s }), this.core.history.delete(r, s.id)); } catch (o) { this.logger.error(o); } @@ -19673,15 +19674,15 @@ class cV extends Kk { this.abortController.signal.addEventListener("abort", M); const N = l.createElement("iframe"); N.src = u, N.style.display = "none", N.addEventListener("error", M, { signal: this.abortController.signal }); - const L = (F) => { - if (F.data && typeof F.data == "string") try { - const $ = JSON.parse(F.data); - if ($.type === "verify_attestation") { - if (v1($.attestation).payload.id !== o) return; - clearInterval(d), l.body.removeChild(N), this.abortController.signal.removeEventListener("abort", M), window.removeEventListener("message", L), w($.attestation === null ? "" : $.attestation); + const L = ($) => { + if ($.data && typeof $.data == "string") try { + const F = JSON.parse($.data); + if (F.type === "verify_attestation") { + if (v1(F.attestation).payload.id !== o) return; + clearInterval(d), l.body.removeChild(N), this.abortController.signal.removeEventListener("abort", M), window.removeEventListener("message", L), w(F.attestation === null ? "" : F.attestation); } - } catch ($) { - this.logger.warn($); + } catch (F) { + this.logger.warn(F); } }; l.body.appendChild(N), window.addEventListener("message", L, { signal: this.abortController.signal }); @@ -19756,7 +19757,7 @@ class cV extends Kk { const o = xz(i, s.publicKey), a = { hasExpired: mt.toMiliseconds(o.exp) < Date.now(), payload: o }; if (a.hasExpired) throw this.logger.warn("resolve: jwt attestation expired"), new Error("JWT attestation expired"); return { origin: a.payload.origin, isScam: a.payload.isScam, isVerified: a.payload.isVerified }; - }, this.logger = ai(r, this.name), this.abortController = new AbortController(), this.isDevEnv = nb(), this.init(); + }, this.logger = ai(r, this.name), this.abortController = new AbortController(), this.isDevEnv = ib(), this.init(); } get storeKey() { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//verify:public:key"; @@ -19776,22 +19777,22 @@ class uV extends Vk { }, this.logger = ai(r, this.context); } } -var fV = Object.defineProperty, M3 = Object.getOwnPropertySymbols, lV = Object.prototype.hasOwnProperty, hV = Object.prototype.propertyIsEnumerable, I3 = (t, e, r) => e in t ? fV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Cf = (t, e) => { - for (var r in e || (e = {})) lV.call(e, r) && I3(t, r, e[r]); - if (M3) for (var r of M3(e)) hV.call(e, r) && I3(t, r, e[r]); +var fV = Object.defineProperty, I3 = Object.getOwnPropertySymbols, lV = Object.prototype.hasOwnProperty, hV = Object.prototype.propertyIsEnumerable, C3 = (t, e, r) => e in t ? fV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Cf = (t, e) => { + for (var r in e || (e = {})) lV.call(e, r) && C3(t, r, e[r]); + if (I3) for (var r of I3(e)) hV.call(e, r) && C3(t, r, e[r]); return t; }; class dV extends Gk { constructor(e, r, n = !0) { super(e, r, n), this.core = e, this.logger = r, this.context = pW, this.storagePrefix = Zs, this.storageVersion = dW, this.events = /* @__PURE__ */ new Map(), this.shouldPersist = !1, this.init = async () => { - if (!nb()) try { - const i = { eventId: Fx(), timestamp: Date.now(), domain: this.getAppDomain(), props: { event: "INIT", type: "", properties: { client_id: await this.core.crypto.getClientId(), user_agent: O8(this.core.relayer.protocol, this.core.relayer.version, T1) } } }; + if (!ib()) try { + const i = { eventId: Bx(), timestamp: Date.now(), domain: this.getAppDomain(), props: { event: "INIT", type: "", properties: { client_id: await this.core.crypto.getClientId(), user_agent: O8(this.core.relayer.protocol, this.core.relayer.version, T1) } } }; await this.sendEvent([i]); } catch (i) { this.logger.warn(i); } }, this.createEvent = (i) => { - const { event: s = "ERROR", type: o = "", properties: { topic: a, trace: u } } = i, l = Fx(), d = this.core.projectId || "", g = Date.now(), w = Cf({ eventId: l, timestamp: g, props: { event: s, type: o, properties: { topic: a, trace: u } }, bundleId: d, domain: this.getAppDomain() }, this.setMethods(l)); + const { event: s = "ERROR", type: o = "", properties: { topic: a, trace: u } } = i, l = Bx(), d = this.core.projectId || "", g = Date.now(), w = Cf({ eventId: l, timestamp: g, props: { event: s, type: o, properties: { topic: a, trace: u } }, bundleId: d, domain: this.getAppDomain() }, this.setMethods(l)); return this.telemetryEnabled && (this.events.set(l, w), this.shouldPersist = !0), w; }, this.getEvent = (i) => { const { eventId: s, topic: o } = i; @@ -19845,12 +19846,12 @@ class dV extends Gk { return this.storagePrefix + this.storageVersion + this.core.customStoragePrefix + "//" + this.context; } } -var pV = Object.defineProperty, C3 = Object.getOwnPropertySymbols, gV = Object.prototype.hasOwnProperty, mV = Object.prototype.propertyIsEnumerable, T3 = (t, e, r) => e in t ? pV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, R3 = (t, e) => { - for (var r in e || (e = {})) gV.call(e, r) && T3(t, r, e[r]); - if (C3) for (var r of C3(e)) mV.call(e, r) && T3(t, r, e[r]); +var pV = Object.defineProperty, T3 = Object.getOwnPropertySymbols, gV = Object.prototype.hasOwnProperty, mV = Object.prototype.propertyIsEnumerable, R3 = (t, e, r) => e in t ? pV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, D3 = (t, e) => { + for (var r in e || (e = {})) gV.call(e, r) && R3(t, r, e[r]); + if (T3) for (var r of T3(e)) mV.call(e, r) && R3(t, r, e[r]); return t; }; -class fb extends Fk { +class lb extends Fk { constructor(e) { var r; super(e), this.protocol = eE, this.version = tE, this.name = rE, this.events = new rs.EventEmitter(), this.initialized = !1, this.on = (o, a) => this.events.on(o, a), this.once = (o, a) => this.events.once(o, a), this.off = (o, a) => this.events.off(o, a), this.removeListener = (o, a) => this.events.removeListener(o, a), this.dispatchEnvelope = ({ topic: o, message: a, sessionExists: u }) => { @@ -19862,10 +19863,10 @@ class fb extends Fk { this.logChunkController = s, (r = this.logChunkController) != null && r.downloadLogsBlobInBrowser && (window.downloadLogsBlobInBrowser = async () => { var o, a; (o = this.logChunkController) != null && o.downloadLogsBlobInBrowser && ((a = this.logChunkController) == null || a.downloadLogsBlobInBrowser({ clientId: await this.crypto.getClientId() })); - }), this.logger = ai(i, this.name), this.heartbeat = new RL(), this.crypto = new qK(this, this.logger, e == null ? void 0 : e.keychain), this.history = new oV(this, this.logger), this.expirer = new aV(this, this.logger), this.storage = e != null && e.storage ? e.storage : new uk(R3(R3({}, $H), e == null ? void 0 : e.storageOptions)), this.relayer = new tV({ core: this, logger: this.logger, relayUrl: this.relayUrl, projectId: this.projectId }), this.pairing = new sV(this, this.logger), this.verify = new cV(this, this.logger, this.storage), this.echoClient = new uV(this.projectId || "", this.logger), this.linkModeSupportedApps = [], this.eventClient = new dV(this, this.logger, e == null ? void 0 : e.telemetryEnabled); + }), this.logger = ai(i, this.name), this.heartbeat = new RL(), this.crypto = new qK(this, this.logger, e == null ? void 0 : e.keychain), this.history = new oV(this, this.logger), this.expirer = new aV(this, this.logger), this.storage = e != null && e.storage ? e.storage : new uk(D3(D3({}, $H), e == null ? void 0 : e.storageOptions)), this.relayer = new tV({ core: this, logger: this.logger, relayUrl: this.relayUrl, projectId: this.projectId }), this.pairing = new sV(this, this.logger), this.verify = new cV(this, this.logger, this.storage), this.echoClient = new uV(this.projectId || "", this.logger), this.linkModeSupportedApps = [], this.eventClient = new dV(this, this.logger, e == null ? void 0 : e.telemetryEnabled); } static async init(e) { - const r = new fb(e); + const r = new lb(e); await r.initialize(); const n = await r.crypto.getClientId(); return await r.storage.setItem(XH, n), r; @@ -19881,26 +19882,26 @@ class fb extends Fk { return (e = this.logChunkController) == null ? void 0 : e.logsToBlob({ clientId: await this.crypto.getClientId() }); } async addLinkModeSupportedApp(e) { - this.linkModeSupportedApps.includes(e) || (this.linkModeSupportedApps.push(e), await this.storage.setItem(h3, this.linkModeSupportedApps)); + this.linkModeSupportedApps.includes(e) || (this.linkModeSupportedApps.push(e), await this.storage.setItem(d3, this.linkModeSupportedApps)); } async initialize() { this.logger.trace("Initialized"); try { - await this.crypto.init(), await this.history.init(), await this.expirer.init(), await this.relayer.init(), await this.heartbeat.init(), await this.pairing.init(), this.eventClient.init(), this.linkModeSupportedApps = await this.storage.getItem(h3) || [], this.initialized = !0, this.logger.info("Core Initialization Success"); + await this.crypto.init(), await this.history.init(), await this.expirer.init(), await this.relayer.init(), await this.heartbeat.init(), await this.pairing.init(), this.eventClient.init(), this.linkModeSupportedApps = await this.storage.getItem(d3) || [], this.initialized = !0, this.logger.info("Core Initialization Success"); } catch (e) { throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`, e), this.logger.error(e.message), e; } } } -const vV = fb, mE = "wc", vE = 2, bE = "client", lb = `${mE}@${vE}:${bE}:`, mm = { name: bE, logger: "error" }, D3 = "WALLETCONNECT_DEEPLINK_CHOICE", bV = "proposal", yE = "Proposal expired", yV = "session", Wc = mt.SEVEN_DAYS, wV = "engine", In = { wc_sessionPropose: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1100 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1101 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1120 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1121 } }, wc_sessionSettle: { req: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1102 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1103 } }, wc_sessionUpdate: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1104 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1105 } }, wc_sessionExtend: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1106 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1107 } }, wc_sessionRequest: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1108 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1109 } }, wc_sessionEvent: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1110 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1111 } }, wc_sessionDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1112 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1113 } }, wc_sessionPing: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1114 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1115 } }, wc_sessionAuthenticate: { req: { ttl: mt.ONE_HOUR, prompt: !0, tag: 1116 }, res: { ttl: mt.ONE_HOUR, prompt: !1, tag: 1117 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1118 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1119 } } }, vm = { min: mt.FIVE_MINUTES, max: mt.SEVEN_DAYS }, Ls = { idle: "IDLE", active: "ACTIVE" }, xV = "request", _V = ["wc_sessionPropose", "wc_sessionRequest", "wc_authRequest", "wc_sessionAuthenticate"], EV = "wc", SV = "auth", AV = "authKeys", PV = "pairingTopics", MV = "requests", sp = `${EV}@${1.5}:${SV}:`, Td = `${sp}:PUB_KEY`; -var IV = Object.defineProperty, CV = Object.defineProperties, TV = Object.getOwnPropertyDescriptors, O3 = Object.getOwnPropertySymbols, RV = Object.prototype.hasOwnProperty, DV = Object.prototype.propertyIsEnumerable, N3 = (t, e, r) => e in t ? IV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, tn = (t, e) => { - for (var r in e || (e = {})) RV.call(e, r) && N3(t, r, e[r]); - if (O3) for (var r of O3(e)) DV.call(e, r) && N3(t, r, e[r]); +const vV = lb, mE = "wc", vE = 2, bE = "client", hb = `${mE}@${vE}:${bE}:`, mm = { name: bE, logger: "error" }, O3 = "WALLETCONNECT_DEEPLINK_CHOICE", bV = "proposal", yE = "Proposal expired", yV = "session", Wc = mt.SEVEN_DAYS, wV = "engine", In = { wc_sessionPropose: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1100 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1101 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1120 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1121 } }, wc_sessionSettle: { req: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1102 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1103 } }, wc_sessionUpdate: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1104 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1105 } }, wc_sessionExtend: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1106 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1107 } }, wc_sessionRequest: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1108 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1109 } }, wc_sessionEvent: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1110 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1111 } }, wc_sessionDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1112 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1113 } }, wc_sessionPing: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1114 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1115 } }, wc_sessionAuthenticate: { req: { ttl: mt.ONE_HOUR, prompt: !0, tag: 1116 }, res: { ttl: mt.ONE_HOUR, prompt: !1, tag: 1117 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1118 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1119 } } }, vm = { min: mt.FIVE_MINUTES, max: mt.SEVEN_DAYS }, Ls = { idle: "IDLE", active: "ACTIVE" }, xV = "request", _V = ["wc_sessionPropose", "wc_sessionRequest", "wc_authRequest", "wc_sessionAuthenticate"], EV = "wc", SV = "auth", AV = "authKeys", PV = "pairingTopics", MV = "requests", sp = `${EV}@${1.5}:${SV}:`, Td = `${sp}:PUB_KEY`; +var IV = Object.defineProperty, CV = Object.defineProperties, TV = Object.getOwnPropertyDescriptors, N3 = Object.getOwnPropertySymbols, RV = Object.prototype.hasOwnProperty, DV = Object.prototype.propertyIsEnumerable, L3 = (t, e, r) => e in t ? IV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, tn = (t, e) => { + for (var r in e || (e = {})) RV.call(e, r) && L3(t, r, e[r]); + if (N3) for (var r of N3(e)) DV.call(e, r) && L3(t, r, e[r]); return t; }, vs = (t, e) => CV(t, TV(e)); class OV extends Jk { constructor(e) { - super(e), this.name = wV, this.events = new Lv(), this.initialized = !1, this.requestQueue = { state: Ls.idle, queue: [] }, this.sessionRequestQueue = { state: Ls.idle, queue: [] }, this.requestQueueDelay = mt.ONE_SECOND, this.expectedPairingMethodMap = /* @__PURE__ */ new Map(), this.recentlyDeletedMap = /* @__PURE__ */ new Map(), this.recentlyDeletedLimit = 200, this.relayMessageCache = [], this.init = async () => { + super(e), this.name = wV, this.events = new kv(), this.initialized = !1, this.requestQueue = { state: Ls.idle, queue: [] }, this.sessionRequestQueue = { state: Ls.idle, queue: [] }, this.requestQueueDelay = mt.ONE_SECOND, this.expectedPairingMethodMap = /* @__PURE__ */ new Map(), this.recentlyDeletedMap = /* @__PURE__ */ new Map(), this.recentlyDeletedLimit = 200, this.relayMessageCache = [], this.init = async () => { this.initialized || (await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.registerPairingEvents(), await this.registerLinkModeListeners(), this.client.core.pairing.register({ methods: Object.keys(In) }), this.initialized = !0, setTimeout(() => { this.sessionRequestQueue.queue = this.getPendingSessionRequests(), this.processSessionRequestQueue(); }, mt.toMiliseconds(this.requestQueueDelay))); @@ -19923,17 +19924,17 @@ class OV extends Jk { const { message: H } = ft("NO_MATCHING_KEY", `connect() pairing topic: ${l}`); throw new Error(H); } - const w = await this.client.core.crypto.generateKeyPair(), A = In.wc_sessionPropose.req.ttl || mt.FIVE_MINUTES, M = En(A), N = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: u ?? [{ protocol: nE }], proposer: { publicKey: w, metadata: this.client.metadata }, expiryTimestamp: M, pairingTopic: l }, a && { sessionProperties: a }), { reject: L, resolve: F, done: $ } = Va(A, yE); + const w = await this.client.core.crypto.generateKeyPair(), A = In.wc_sessionPropose.req.ttl || mt.FIVE_MINUTES, M = En(A), N = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: u ?? [{ protocol: nE }], proposer: { publicKey: w, metadata: this.client.metadata }, expiryTimestamp: M, pairingTopic: l }, a && { sessionProperties: a }), { reject: L, resolve: $, done: F } = Va(A, yE); this.events.once(br("session_connect"), async ({ error: H, session: V }) => { if (H) L(H); else if (V) { V.self.publicKey = w; const te = vs(tn({}, V), { pairingTopic: N.pairingTopic, requiredNamespaces: N.requiredNamespaces, optionalNamespaces: N.optionalNamespaces, transportType: zr.relay }); - await this.client.session.set(V.topic, te), await this.setExpiry(V.topic, V.expiry), l && await this.client.core.pairing.updateMetadata({ topic: l, metadata: V.peer.metadata }), this.cleanupDuplicatePairings(te), F(te); + await this.client.session.set(V.topic, te), await this.setExpiry(V.topic, V.expiry), l && await this.client.core.pairing.updateMetadata({ topic: l, metadata: V.peer.metadata }), this.cleanupDuplicatePairings(te), $(te); } }); const K = await this.sendRequest({ topic: l, method: "wc_sessionPropose", params: N, throwOnFailedPublish: !0 }); - return await this.setProposal(K, tn({ id: K }, N)), { uri: d, approval: $ }; + return await this.setProposal(K, tn({ id: K }, N)), { uri: d, approval: F }; }, this.pair = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); try { @@ -19962,28 +19963,28 @@ class OV extends Jk { const { id: a, relayProtocol: u, namespaces: l, sessionProperties: d, sessionConfig: g } = r, w = this.client.proposal.get(a); this.client.core.eventClient.deleteEvent({ eventId: o.eventId }); const { pairingTopic: A, proposer: M, requiredNamespaces: N, optionalNamespaces: L } = w; - let F = (i = this.client.core.eventClient) == null ? void 0 : i.getEvent({ topic: A }); - F || (F = (s = this.client.core.eventClient) == null ? void 0 : s.createEvent({ type: ms.session_approve_started, properties: { topic: A, trace: [ms.session_approve_started, ms.session_namespaces_validation_success] } })); - const $ = await this.client.core.crypto.generateKeyPair(), K = M.publicKey, H = await this.client.core.crypto.generateSharedKey($, K), V = tn(tn({ relay: { protocol: u ?? "irn" }, namespaces: l, controller: { publicKey: $, metadata: this.client.metadata }, expiry: En(Wc) }, d && { sessionProperties: d }), g && { sessionConfig: g }), te = zr.relay; - F.addTrace(ms.subscribing_session_topic); + let $ = (i = this.client.core.eventClient) == null ? void 0 : i.getEvent({ topic: A }); + $ || ($ = (s = this.client.core.eventClient) == null ? void 0 : s.createEvent({ type: ms.session_approve_started, properties: { topic: A, trace: [ms.session_approve_started, ms.session_namespaces_validation_success] } })); + const F = await this.client.core.crypto.generateKeyPair(), K = M.publicKey, H = await this.client.core.crypto.generateSharedKey(F, K), V = tn(tn({ relay: { protocol: u ?? "irn" }, namespaces: l, controller: { publicKey: F, metadata: this.client.metadata }, expiry: En(Wc) }, d && { sessionProperties: d }), g && { sessionConfig: g }), te = zr.relay; + $.addTrace(ms.subscribing_session_topic); try { await this.client.core.relayer.subscribe(H, { transportType: te }); } catch (W) { - throw F.setError(Ha.subscribe_session_topic_failure), W; + throw $.setError(Ha.subscribe_session_topic_failure), W; } - F.addTrace(ms.subscribe_session_topic_success); - const R = vs(tn({}, V), { topic: H, requiredNamespaces: N, optionalNamespaces: L, pairingTopic: A, acknowledged: !1, self: V.controller, peer: { publicKey: M.publicKey, metadata: M.metadata }, controller: $, transportType: zr.relay }); - await this.client.session.set(H, R), F.addTrace(ms.store_session); + $.addTrace(ms.subscribe_session_topic_success); + const R = vs(tn({}, V), { topic: H, requiredNamespaces: N, optionalNamespaces: L, pairingTopic: A, acknowledged: !1, self: V.controller, peer: { publicKey: M.publicKey, metadata: M.metadata }, controller: F, transportType: zr.relay }); + await this.client.session.set(H, R), $.addTrace(ms.store_session); try { - F.addTrace(ms.publishing_session_settle), await this.sendRequest({ topic: H, method: "wc_sessionSettle", params: V, throwOnFailedPublish: !0 }).catch((W) => { - throw F == null || F.setError(Ha.session_settle_publish_failure), W; - }), F.addTrace(ms.session_settle_publish_success), F.addTrace(ms.publishing_session_approve), await this.sendResult({ id: a, topic: A, result: { relay: { protocol: u ?? "irn" }, responderPublicKey: $ }, throwOnFailedPublish: !0 }).catch((W) => { - throw F == null || F.setError(Ha.session_approve_publish_failure), W; - }), F.addTrace(ms.session_approve_publish_success); + $.addTrace(ms.publishing_session_settle), await this.sendRequest({ topic: H, method: "wc_sessionSettle", params: V, throwOnFailedPublish: !0 }).catch((W) => { + throw $ == null || $.setError(Ha.session_settle_publish_failure), W; + }), $.addTrace(ms.session_settle_publish_success), $.addTrace(ms.publishing_session_approve), await this.sendResult({ id: a, topic: A, result: { relay: { protocol: u ?? "irn" }, responderPublicKey: F }, throwOnFailedPublish: !0 }).catch((W) => { + throw $ == null || $.setError(Ha.session_approve_publish_failure), W; + }), $.addTrace(ms.session_approve_publish_success); } catch (W) { throw this.client.logger.error(W), this.client.session.delete(H, Or("USER_DISCONNECTED")), await this.client.core.relayer.unsubscribe(H), W; } - return this.client.core.eventClient.deleteEvent({ eventId: F.eventId }), await this.client.core.pairing.updateMetadata({ topic: A, metadata: M.metadata }), await this.client.proposal.delete(a, Or("USER_DISCONNECTED")), await this.client.core.pairing.activate({ topic: A }), await this.setExpiry(H, En(Wc)), { topic: H, acknowledged: () => Promise.resolve(this.client.session.get(H)) }; + return this.client.core.eventClient.deleteEvent({ eventId: $.eventId }), await this.client.core.pairing.updateMetadata({ topic: A, metadata: M.metadata }), await this.client.proposal.delete(a, Or("USER_DISCONNECTED")), await this.client.core.pairing.activate({ topic: A }), await this.setExpiry(H, En(Wc)), { topic: H, acknowledged: () => Promise.resolve(this.client.session.get(H)) }; }, this.reject = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); try { @@ -20044,7 +20045,7 @@ class OV extends Jk { }), new Promise(async (M) => { var N; if (!((N = a.sessionConfig) != null && N.disableDeepLink)) { - const L = await Fq(this.client.core.storage, D3); + const L = await Fq(this.client.core.storage, O3); await kq({ id: u, topic: s, wcDeepLink: L }); } M(); @@ -20087,18 +20088,18 @@ class OV extends Jk { this.isInitialized(), this.isValidAuthenticate(r); const s = n && this.client.core.linkModeSupportedApps.includes(n) && ((i = this.client.metadata.redirect) == null ? void 0 : i.linkMode), o = s ? zr.link_mode : zr.relay; o === zr.relay && await this.confirmOnlineStateOrThrow(); - const { chains: a, statement: u = "", uri: l, domain: d, nonce: g, type: w, exp: A, nbf: M, methods: N = [], expiry: L } = r, F = [...r.resources || []], { topic: $, uri: K } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); - this.client.logger.info({ message: "Generated new pairing", pairing: { topic: $, uri: K } }); + const { chains: a, statement: u = "", uri: l, domain: d, nonce: g, type: w, exp: A, nbf: M, methods: N = [], expiry: L } = r, $ = [...r.resources || []], { topic: F, uri: K } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); + this.client.logger.info({ message: "Generated new pairing", pairing: { topic: F, uri: K } }); const H = await this.client.core.crypto.generateKeyPair(), V = Cd(H); - if (await Promise.all([this.client.auth.authKeys.set(Td, { responseTopic: V, publicKey: H }), this.client.auth.pairingTopics.set(V, { topic: V, pairingTopic: $ })]), await this.client.core.relayer.subscribe(V, { transportType: o }), this.client.logger.info(`sending request to new pairing topic: ${$}`), N.length > 0) { + if (await Promise.all([this.client.auth.authKeys.set(Td, { responseTopic: V, publicKey: H }), this.client.auth.pairingTopics.set(V, { topic: V, pairingTopic: F })]), await this.client.core.relayer.subscribe(V, { transportType: o }), this.client.logger.info(`sending request to new pairing topic: ${F}`), N.length > 0) { const { namespace: _ } = lu(a[0]); let E = sz(_, "request", N); - Id(F) && (E = az(E, F.pop())), F.push(E); + Id($) && (E = az(E, $.pop())), $.push(E); } - const te = L && L > In.wc_sessionAuthenticate.req.ttl ? L : In.wc_sessionAuthenticate.req.ttl, R = { authPayload: { type: w ?? "caip122", chains: a, statement: u, aud: l, domain: d, version: "1", nonce: g, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: A, nbf: M, resources: F }, requester: { publicKey: H, metadata: this.client.metadata }, expiryTimestamp: En(te) }, W = { eip155: { chains: a, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...N])], events: ["chainChanged", "accountsChanged"] } }, pe = { requiredNamespaces: {}, optionalNamespaces: W, relays: [{ protocol: "irn" }], pairingTopic: $, proposer: { publicKey: H, metadata: this.client.metadata }, expiryTimestamp: En(In.wc_sessionPropose.req.ttl) }, { done: Ee, resolve: Y, reject: S } = Va(te, "Request expired"), m = async ({ error: _, session: E }) => { + const te = L && L > In.wc_sessionAuthenticate.req.ttl ? L : In.wc_sessionAuthenticate.req.ttl, R = { authPayload: { type: w ?? "caip122", chains: a, statement: u, aud: l, domain: d, version: "1", nonce: g, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: A, nbf: M, resources: $ }, requester: { publicKey: H, metadata: this.client.metadata }, expiryTimestamp: En(te) }, W = { eip155: { chains: a, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...N])], events: ["chainChanged", "accountsChanged"] } }, pe = { requiredNamespaces: {}, optionalNamespaces: W, relays: [{ protocol: "irn" }], pairingTopic: F, proposer: { publicKey: H, metadata: this.client.metadata }, expiryTimestamp: En(In.wc_sessionPropose.req.ttl) }, { done: Ee, resolve: Y, reject: S } = Va(te, "Request expired"), m = async ({ error: _, session: E }) => { if (this.events.off(br("session_request", p), f), _) S(_); else if (E) { - E.self.publicKey = H, await this.client.session.set(E.topic, E), await this.setExpiry(E.topic, E.expiry), $ && await this.client.core.pairing.updateMetadata({ topic: $, metadata: E.peer.metadata }); + E.self.publicKey = H, await this.client.session.set(E.topic, E), await this.setExpiry(E.topic, E.expiry), F && await this.client.core.pairing.updateMetadata({ topic: F, metadata: E.peer.metadata }); const v = this.client.session.get(E.topic); await this.deleteProposal(b), Y({ session: v }); } @@ -20111,31 +20112,31 @@ class OV extends Jk { await this.deleteProposal(b), this.events.off(br("session_connect"), m); const { cacaos: I, responder: B } = _.result, ce = [], D = []; for (const J of I) { - await jx({ cacao: J, projectId: this.client.core.projectId }) || (this.client.logger.error(J, "Signature verification failed"), S(Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"))); + await qx({ cacao: J, projectId: this.client.core.projectId }) || (this.client.logger.error(J, "Signature verification failed"), S(Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"))); const { p: Q } = J, T = Id(Q.resources), X = [M1(Q.iss)], re = c0(Q.iss); if (T) { - const de = qx(T), ie = zx(T); + const de = zx(T), ie = Hx(T); ce.push(...de), X.push(...ie); } for (const de of X) D.push(`${de}:${re}`); } const oe = await this.client.core.crypto.generateSharedKey(H, B.publicKey); let Z; - ce.length > 0 && (Z = { topic: oe, acknowledged: !0, self: { publicKey: H, metadata: this.client.metadata }, peer: B, controller: B.publicKey, expiry: En(Wc), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: $, namespaces: Zx([...new Set(ce)], [...new Set(D)]), transportType: o }, await this.client.core.relayer.subscribe(oe, { transportType: o }), await this.client.session.set(oe, Z), $ && await this.client.core.pairing.updateMetadata({ topic: $, metadata: B.metadata }), Z = this.client.session.get(oe)), (E = this.client.metadata.redirect) != null && E.linkMode && (v = B.metadata.redirect) != null && v.linkMode && (P = B.metadata.redirect) != null && P.universal && n && (this.client.core.addLinkModeSupportedApp(B.metadata.redirect.universal), this.client.session.update(oe, { transportType: zr.link_mode })), Y({ auths: I, session: Z }); + ce.length > 0 && (Z = { topic: oe, acknowledged: !0, self: { publicKey: H, metadata: this.client.metadata }, peer: B, controller: B.publicKey, expiry: En(Wc), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: F, namespaces: Qx([...new Set(ce)], [...new Set(D)]), transportType: o }, await this.client.core.relayer.subscribe(oe, { transportType: o }), await this.client.session.set(oe, Z), F && await this.client.core.pairing.updateMetadata({ topic: F, metadata: B.metadata }), Z = this.client.session.get(oe)), (E = this.client.metadata.redirect) != null && E.linkMode && (v = B.metadata.redirect) != null && v.linkMode && (P = B.metadata.redirect) != null && P.universal && n && (this.client.core.addLinkModeSupportedApp(B.metadata.redirect.universal), this.client.session.update(oe, { transportType: zr.link_mode })), Y({ auths: I, session: Z }); }, p = ca(), b = ca(); this.events.once(br("session_connect"), m), this.events.once(br("session_request", p), f); let x; try { if (s) { const _ = ha("wc_sessionAuthenticate", R, p); - this.client.core.history.set($, _); + this.client.core.history.set(F, _); const E = await this.client.core.crypto.encode("", _, { type: eh, encoding: Sf }); - x = ud(n, $, E); - } else await Promise.all([this.sendRequest({ topic: $, method: "wc_sessionAuthenticate", params: R, expiry: r.expiry, throwOnFailedPublish: !0, clientRpcId: p }), this.sendRequest({ topic: $, method: "wc_sessionPropose", params: pe, expiry: In.wc_sessionPropose.req.ttl, throwOnFailedPublish: !0, clientRpcId: b })]); + x = ud(n, F, E); + } else await Promise.all([this.sendRequest({ topic: F, method: "wc_sessionAuthenticate", params: R, expiry: r.expiry, throwOnFailedPublish: !0, clientRpcId: p }), this.sendRequest({ topic: F, method: "wc_sessionPropose", params: pe, expiry: In.wc_sessionPropose.req.ttl, throwOnFailedPublish: !0, clientRpcId: b })]); } catch (_) { throw this.events.off(br("session_connect"), m), this.events.off(br("session_request", p), f), _; } - return await this.setProposal(b, tn({ id: b }, pe)), await this.setAuthRequest(p, { request: vs(tn({}, R), { verifyContext: {} }), pairingTopic: $, transportType: o }), { uri: x ?? K, response: Ee }; + return await this.setProposal(b, tn({ id: b }, pe)), await this.setAuthRequest(p, { request: vs(tn({}, R), { verifyContext: {} }), pairingTopic: F, transportType: o }), { uri: x ?? K, response: Ee }; }, this.approveSessionAuthenticate = async (r) => { const { id: n, auths: i } = r, s = this.client.core.eventClient.createEvent({ properties: { topic: n.toString(), trace: [Wa.authenticated_session_approve_started] } }); try { @@ -20149,15 +20150,15 @@ class OV extends Jk { a === zr.relay && await this.confirmOnlineStateOrThrow(); const u = o.requester.publicKey, l = await this.client.core.crypto.generateKeyPair(), d = Cd(u), g = { type: Io, receiverPublicKey: u, senderPublicKey: l }, w = [], A = []; for (const L of i) { - if (!await jx({ cacao: L, projectId: this.client.core.projectId })) { + if (!await qx({ cacao: L, projectId: this.client.core.projectId })) { s.setError(Mf.invalid_cacao); const V = Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"); throw await this.sendError({ id: n, topic: d, error: V, encodeOpts: g }), new Error(V.message); } s.addTrace(Wa.cacaos_verified); - const { p: F } = L, $ = Id(F.resources), K = [M1(F.iss)], H = c0(F.iss); - if ($) { - const V = qx($), te = zx($); + const { p: $ } = L, F = Id($.resources), K = [M1($.iss)], H = c0($.iss); + if (F) { + const V = zx(F), te = Hx(F); w.push(...V), K.push(...te); } for (const V of K) A.push(`${V}:${H}`); @@ -20166,7 +20167,7 @@ class OV extends Jk { s.addTrace(Wa.create_authenticated_session_topic); let N; if ((w == null ? void 0 : w.length) > 0) { - N = { topic: M, acknowledged: !0, self: { publicKey: l, metadata: this.client.metadata }, peer: { publicKey: u, metadata: o.requester.metadata }, controller: u, expiry: En(Wc), authentication: i, requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: o.pairingTopic, namespaces: Zx([...new Set(w)], [...new Set(A)]), transportType: a }, s.addTrace(Wa.subscribing_authenticated_session_topic); + N = { topic: M, acknowledged: !0, self: { publicKey: l, metadata: this.client.metadata }, peer: { publicKey: u, metadata: o.requester.metadata }, controller: u, expiry: En(Wc), authentication: i, requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: o.pairingTopic, namespaces: Qx([...new Set(w)], [...new Set(A)]), transportType: a }, s.addTrace(Wa.subscribing_authenticated_session_topic); try { await this.client.core.relayer.subscribe(M, { transportType: a }); } catch (L) { @@ -20215,7 +20216,7 @@ class OV extends Jk { }, this.deleteSession = async (r) => { var n; const { topic: i, expirerHasDeleted: s = !1, emitEvent: o = !0, id: a = 0 } = r, { self: u } = this.client.session.get(i); - await this.client.core.relayer.unsubscribe(i), await this.client.session.delete(i, Or("USER_DISCONNECTED")), this.addToRecentlyDeleted(i, "session"), this.client.core.crypto.keychain.has(u.publicKey) && await this.client.core.crypto.deleteKeyPair(u.publicKey), this.client.core.crypto.keychain.has(i) && await this.client.core.crypto.deleteSymKey(i), s || this.client.core.expirer.del(i), this.client.core.storage.removeItem(D3).catch((l) => this.client.logger.warn(l)), this.getPendingSessionRequests().forEach((l) => { + await this.client.core.relayer.unsubscribe(i), await this.client.session.delete(i, Or("USER_DISCONNECTED")), this.addToRecentlyDeleted(i, "session"), this.client.core.crypto.keychain.has(u.publicKey) && await this.client.core.crypto.deleteKeyPair(u.publicKey), this.client.core.crypto.keychain.has(i) && await this.client.core.crypto.deleteSymKey(i), s || this.client.core.expirer.del(i), this.client.core.storage.removeItem(O3).catch((l) => this.client.logger.warn(l)), this.getPendingSessionRequests().forEach((l) => { l.topic === i && this.deletePendingSessionRequest(l.id, Or("USER_DISCONNECTED")); }), i === ((n = this.sessionRequestQueue.queue[0]) == null ? void 0 : n.topic) && (this.sessionRequestQueue.state = Ls.idle), o && this.client.events.emit("session_delete", { id: a, topic: i }); }, this.deleteProposal = async (r, n) => { @@ -20251,8 +20252,8 @@ class OV extends Jk { } let M; if (_V.includes(i)) { - const L = wo(JSON.stringify(g)), F = wo(w); - M = await this.client.core.verify.register({ id: F, decryptedId: L }); + const L = wo(JSON.stringify(g)), $ = wo(w); + M = await this.client.core.verify.register({ id: $, decryptedId: L }); } const N = In[i].req; if (N.attestation = M, o && (N.ttl = o), a && (N.id = a), this.client.core.history.set(n, g), A) { @@ -20260,7 +20261,7 @@ class OV extends Jk { await global.Linking.openURL(L, this.client.name); } else { const L = In[i].req; - o && (L.ttl = o), a && (L.id = a), l ? (L.internal = vs(tn({}, L.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(n, w, L)) : this.client.core.relayer.publish(n, w, L).catch((F) => this.client.logger.error(F)); + o && (L.ttl = o), a && (L.id = a), l ? (L.internal = vs(tn({}, L.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(n, w, L)) : this.client.core.relayer.publish(n, w, L).catch(($) => this.client.logger.error($)); } return g.id; }, this.sendResult = async (r) => { @@ -20583,7 +20584,7 @@ class OV extends Jk { this.checkRecentlyDeleted(n), await this.isValidProposalId(n); const a = this.client.proposal.get(n), u = hm(i, "approve()"); if (u) throw new Error(u.message); - const l = t3(a.requiredNamespaces, i, "approve()"); + const l = r3(a.requiredNamespaces, i, "approve()"); if (l) throw new Error(l.message); if (!dn(s, !0)) { const { message: d } = ft("MISSING_OR_INVALID", `approve() relayProtocol: ${s}`); @@ -20627,7 +20628,7 @@ class OV extends Jk { this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); const s = this.client.session.get(n), o = hm(i, "update()"); if (o) throw new Error(o.message); - const a = t3(s.requiredNamespaces, i, "update()"); + const a = r3(s.requiredNamespaces, i, "update()"); if (a) throw new Error(a.message); }, this.isValidExtend = async (r) => { if (!pi(r)) { @@ -20644,7 +20645,7 @@ class OV extends Jk { const { topic: n, request: i, chainId: s, expiry: o } = r; this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); const { namespaces: a } = this.client.session.get(n); - if (!e3(a, s)) { + if (!t3(a, s)) { const { message: u } = ft("MISSING_OR_INVALID", `request() chainId: ${s}`); throw new Error(u); } @@ -20691,7 +20692,7 @@ class OV extends Jk { const { topic: n, event: i, chainId: s } = r; await this.isValidSessionTopic(n); const { namespaces: o } = this.client.session.get(n); - if (!e3(o, s)) { + if (!t3(o, s)) { const { message: a } = ft("MISSING_OR_INVALID", `emit() chainId: ${s}`); throw new Error(a); } @@ -20765,11 +20766,11 @@ class OV extends Jk { return this.isLinkModeEnabled(r, n) ? (i = r == null ? void 0 : r.redirect) == null ? void 0 : i.universal : void 0; }, this.handleLinkModeMessage = ({ url: r }) => { if (!r || !r.includes("wc_ev") || !r.includes("topic")) return; - const n = $x(r, "topic") || "", i = decodeURIComponent($x(r, "wc_ev") || ""), s = this.client.session.keys.includes(n); + const n = Fx(r, "topic") || "", i = decodeURIComponent(Fx(r, "wc_ev") || ""), s = this.client.session.keys.includes(n); s && this.client.session.update(n, { transportType: zr.link_mode }), this.client.core.dispatchEnvelope({ topic: n, message: i, sessionExists: s }); }, this.registerLinkModeListeners = async () => { var r; - if (nb() || ju() && (r = this.client.metadata.redirect) != null && r.linkMode) { + if (ib() || ju() && (r = this.client.metadata.redirect) != null && r.linkMode) { const n = global == null ? void 0 : global.Linking; if (typeof n < "u") { n.addEventListener("url", this.handleLinkModeMessage, this.client.name); @@ -20798,7 +20799,7 @@ class OV extends Jk { async onRelayMessage(e) { const { topic: r, message: n, attestation: i, transportType: s } = e, { publicKey: o } = this.client.auth.authKeys.keys.includes(Td) ? this.client.auth.authKeys.get(Td) : { publicKey: void 0 }, a = await this.client.core.crypto.decode(r, n, { receiverPublicKey: o, encoding: s === zr.link_mode ? Sf : la }); try { - ub(a) ? (this.client.core.history.set(r, a), this.onRelayEventRequest({ topic: r, payload: a, attestation: i, transportType: s, encryptedId: wo(n) })) : np(a) ? (await this.client.core.history.resolve(a), await this.onRelayEventResponse({ topic: r, payload: a, transportType: s }), this.client.core.history.delete(r, a.id)) : this.onRelayEventUnknownPayload({ topic: r, payload: a, transportType: s }); + fb(a) ? (this.client.core.history.set(r, a), this.onRelayEventRequest({ topic: r, payload: a, attestation: i, transportType: s, encryptedId: wo(n) })) : np(a) ? (await this.client.core.history.resolve(a), await this.onRelayEventResponse({ topic: r, payload: a, transportType: s }), this.client.core.history.delete(r, a.id)) : this.onRelayEventUnknownPayload({ topic: r, payload: a, transportType: s }); } catch (u) { this.client.logger.error(u); } @@ -20878,17 +20879,17 @@ class OV extends Jk { } class NV extends _c { constructor(e, r) { - super(e, r, bV, lb), this.core = e, this.logger = r; + super(e, r, bV, hb), this.core = e, this.logger = r; } } let LV = class extends _c { constructor(e, r) { - super(e, r, yV, lb), this.core = e, this.logger = r; + super(e, r, yV, hb), this.core = e, this.logger = r; } }; class kV extends _c { constructor(e, r) { - super(e, r, xV, lb, (n) => n.id), this.core = e, this.logger = r; + super(e, r, xV, hb, (n) => n.id), this.core = e, this.logger = r; } } class $V extends _c { @@ -20914,7 +20915,7 @@ class UV { await this.authKeys.init(), await this.pairingTopics.init(), await this.requests.init(); } } -class hb extends Yk { +class db extends Yk { constructor(e) { super(e), this.protocol = mE, this.version = vE, this.name = mm.name, this.events = new rs.EventEmitter(), this.on = (n, i) => this.events.on(n, i), this.once = (n, i) => this.events.once(n, i), this.off = (n, i) => this.events.off(n, i), this.removeListener = (n, i) => this.events.removeListener(n, i), this.removeAllListeners = (n) => this.events.removeAllListeners(n), this.connect = async (n) => { try { @@ -21023,7 +21024,7 @@ class hb extends Yk { this.core = (e == null ? void 0 : e.core) || new vV(e), this.logger = ai(r, this.name), this.session = new LV(this.core, this.logger), this.proposal = new NV(this.core, this.logger), this.pendingRequest = new kV(this.core, this.logger), this.engine = new OV(this), this.auth = new UV(this.core, this.logger); } static async init(e) { - const r = new hb(e); + const r = new db(e); return await r.initialize(), r; } get context() { @@ -21053,10 +21054,10 @@ var l0 = { exports: {} }; l0.exports; (function(t, e) { (function() { - var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", u = "__lodash_hash_undefined__", l = 500, d = "__lodash_placeholder__", g = 1, w = 2, A = 4, M = 1, N = 2, L = 1, F = 2, $ = 4, K = 8, H = 16, V = 32, te = 64, R = 128, W = 256, pe = 512, Ee = 30, Y = "...", S = 800, m = 16, f = 1, p = 2, b = 3, x = 1 / 0, _ = 9007199254740991, E = 17976931348623157e292, v = NaN, P = 4294967295, I = P - 1, B = P >>> 1, ce = [ + var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", u = "__lodash_hash_undefined__", l = 500, d = "__lodash_placeholder__", g = 1, w = 2, A = 4, M = 1, N = 2, L = 1, $ = 2, F = 4, K = 8, H = 16, V = 32, te = 64, R = 128, W = 256, pe = 512, Ee = 30, Y = "...", S = 800, m = 16, f = 1, p = 2, b = 3, x = 1 / 0, _ = 9007199254740991, E = 17976931348623157e292, v = NaN, P = 4294967295, I = P - 1, B = P >>> 1, ce = [ ["ary", R], ["bind", L], - ["bindKey", F], + ["bindKey", $], ["curry", K], ["curryRight", H], ["flip", pe], @@ -21356,7 +21357,7 @@ l0.exports; ; return be; } - function dy(be, Fe) { + function py(be, Fe) { for (var Ie = -1, It = be == null ? 0 : be.length; ++Ie < It; ) if (!Fe(be[Ie], Ie, be)) return !1; @@ -21414,7 +21415,7 @@ l0.exports; function X9(be) { return be.match(U) || []; } - function py(be, Fe, Ie) { + function gy(be, Fe, Ie) { var It; return Ie(be, function(er, Pr, xn) { if (Fe(er, Pr, xn)) @@ -21428,7 +21429,7 @@ l0.exports; return -1; } function Ic(be, Fe, Ie) { - return Fe === Fe ? uA(be, Fe, Ie) : vh(be, gy, Ie); + return Fe === Fe ? uA(be, Fe, Ie) : vh(be, my, Ie); } function Z9(be, Fe, Ie, It) { for (var er = Ie - 1, Pr = be.length; ++er < Pr; ) @@ -21436,10 +21437,10 @@ l0.exports; return er; return -1; } - function gy(be) { + function my(be) { return be !== be; } - function my(be, Fe) { + function vy(be, Fe) { var Ie = be == null ? 0 : be.length; return Ie ? Up(be, Fe) / Ie : v; } @@ -21453,7 +21454,7 @@ l0.exports; return be == null ? r : be[Fe]; }; } - function vy(be, Fe, Ie, It, er) { + function by(be, Fe, Ie, It, er) { return er(be, function(Pr, xn, qr) { Ie = It ? (It = !1, Pr) : Fe(Ie, Pr, xn, qr); }), Ie; @@ -21481,8 +21482,8 @@ l0.exports; return [Ie, be[Ie]]; }); } - function by(be) { - return be && be.slice(0, _y(be) + 1).replace(k, ""); + function yy(be) { + return be && be.slice(0, Ey(be) + 1).replace(k, ""); } function Ai(be) { return function(Fe) { @@ -21497,12 +21498,12 @@ l0.exports; function Zu(be, Fe) { return be.has(Fe); } - function yy(be, Fe) { + function wy(be, Fe) { for (var Ie = -1, It = be.length; ++Ie < It && Ic(Fe, be[Ie], 0) > -1; ) ; return Ie; } - function wy(be, Fe) { + function xy(be, Fe) { for (var Ie = be.length; Ie-- && Ic(Fe, be[Ie], 0) > -1; ) ; return Ie; @@ -21536,7 +21537,7 @@ l0.exports; Ie[++Fe] = [er, It]; }), Ie; } - function xy(be, Fe) { + function _y(be, Fe) { return function(Ie) { return be(Fe(Ie)); }; @@ -21578,7 +21579,7 @@ l0.exports; function fs(be) { return Cc(be) ? dA(be) : J9(be); } - function _y(be) { + function Ey(be) { for (var Fe = be.length; Fe-- && j.test(be.charAt(Fe)); ) ; return Fe; @@ -21597,24 +21598,24 @@ l0.exports; } var gA = function be(Fe) { Fe = Fe == null ? _r : Rc.defaults(_r.Object(), Fe, Rc.pick(_r, gh)); - var Ie = Fe.Array, It = Fe.Date, er = Fe.Error, Pr = Fe.Function, xn = Fe.Math, qr = Fe.Object, Hp = Fe.RegExp, mA = Fe.String, ji = Fe.TypeError, yh = Ie.prototype, vA = Pr.prototype, Dc = qr.prototype, wh = Fe["__core-js_shared__"], xh = vA.toString, Tr = Dc.hasOwnProperty, bA = 0, Ey = function() { + var Ie = Fe.Array, It = Fe.Date, er = Fe.Error, Pr = Fe.Function, xn = Fe.Math, qr = Fe.Object, Hp = Fe.RegExp, mA = Fe.String, ji = Fe.TypeError, yh = Ie.prototype, vA = Pr.prototype, Dc = qr.prototype, wh = Fe["__core-js_shared__"], xh = vA.toString, Tr = Dc.hasOwnProperty, bA = 0, Sy = function() { var c = /[^.]+$/.exec(wh && wh.keys && wh.keys.IE_PROTO || ""); return c ? "Symbol(src)_1." + c : ""; }(), _h = Dc.toString, yA = xh.call(qr), wA = _r._, xA = Hp( "^" + xh.call(Tr).replace(rt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" - ), Eh = ci ? Fe.Buffer : r, Ko = Fe.Symbol, Sh = Fe.Uint8Array, Sy = Eh ? Eh.allocUnsafe : r, Ah = xy(qr.getPrototypeOf, qr), Ay = qr.create, Py = Dc.propertyIsEnumerable, Ph = yh.splice, My = Ko ? Ko.isConcatSpreadable : r, Qu = Ko ? Ko.iterator : r, Oa = Ko ? Ko.toStringTag : r, Mh = function() { + ), Eh = ci ? Fe.Buffer : r, Ko = Fe.Symbol, Sh = Fe.Uint8Array, Ay = Eh ? Eh.allocUnsafe : r, Ah = _y(qr.getPrototypeOf, qr), Py = qr.create, My = Dc.propertyIsEnumerable, Ph = yh.splice, Iy = Ko ? Ko.isConcatSpreadable : r, Qu = Ko ? Ko.iterator : r, Oa = Ko ? Ko.toStringTag : r, Mh = function() { try { var c = Fa(qr, "defineProperty"); return c({}, "", {}), c; } catch { } - }(), _A = Fe.clearTimeout !== _r.clearTimeout && Fe.clearTimeout, EA = It && It.now !== _r.Date.now && It.now, SA = Fe.setTimeout !== _r.setTimeout && Fe.setTimeout, Ih = xn.ceil, Ch = xn.floor, Wp = qr.getOwnPropertySymbols, AA = Eh ? Eh.isBuffer : r, Iy = Fe.isFinite, PA = yh.join, MA = xy(qr.keys, qr), _n = xn.max, Wn = xn.min, IA = It.now, CA = Fe.parseInt, Cy = xn.random, TA = yh.reverse, Kp = Fa(Fe, "DataView"), ef = Fa(Fe, "Map"), Vp = Fa(Fe, "Promise"), Oc = Fa(Fe, "Set"), tf = Fa(Fe, "WeakMap"), rf = Fa(qr, "create"), Th = tf && new tf(), Nc = {}, RA = Ba(Kp), DA = Ba(ef), OA = Ba(Vp), NA = Ba(Oc), LA = Ba(tf), Rh = Ko ? Ko.prototype : r, nf = Rh ? Rh.valueOf : r, Ty = Rh ? Rh.toString : r; + }(), _A = Fe.clearTimeout !== _r.clearTimeout && Fe.clearTimeout, EA = It && It.now !== _r.Date.now && It.now, SA = Fe.setTimeout !== _r.setTimeout && Fe.setTimeout, Ih = xn.ceil, Ch = xn.floor, Wp = qr.getOwnPropertySymbols, AA = Eh ? Eh.isBuffer : r, Cy = Fe.isFinite, PA = yh.join, MA = _y(qr.keys, qr), _n = xn.max, Wn = xn.min, IA = It.now, CA = Fe.parseInt, Ty = xn.random, TA = yh.reverse, Kp = Fa(Fe, "DataView"), ef = Fa(Fe, "Map"), Vp = Fa(Fe, "Promise"), Oc = Fa(Fe, "Set"), tf = Fa(Fe, "WeakMap"), rf = Fa(qr, "create"), Th = tf && new tf(), Nc = {}, RA = Ba(Kp), DA = Ba(ef), OA = Ba(Vp), NA = Ba(Oc), LA = Ba(tf), Rh = Ko ? Ko.prototype : r, nf = Rh ? Rh.valueOf : r, Ry = Rh ? Rh.toString : r; function ee(c) { if (en(c) && !nr(c) && !(c instanceof wr)) { if (c instanceof qi) return c; if (Tr.call(c, "__wrapped__")) - return Rw(c); + return Dw(c); } return new qi(c); } @@ -21624,8 +21625,8 @@ l0.exports; return function(h) { if (!Zr(h)) return {}; - if (Ay) - return Ay(h); + if (Py) + return Py(h); c.prototype = h; var y = new c(); return c.prototype = r, y; @@ -21699,7 +21700,7 @@ l0.exports; function FA() { var c = this.__wrapped__.value(), h = this.__dir__, y = nr(c), O = h < 0, q = y ? c.length : 0, ne = JP(0, q, this.__views__), fe = ne.start, ge = ne.end, we = ge - fe, He = O ? ge : fe - 1, We = this.__iteratees__, Xe = We.length, wt = 0, Ot = Wn(we, this.__takeCount__); if (!y || !O && q == we && Ot == we) - return ew(c, this.__actions__); + return tw(c, this.__actions__); var Wt = []; e: for (; we-- && wt < Ot; ) { @@ -21848,7 +21849,7 @@ l0.exports; return y.set(c, h), this.size = y.size, this; } ls.prototype.clear = rP, ls.prototype.delete = nP, ls.prototype.get = iP, ls.prototype.has = sP, ls.prototype.set = oP; - function Ry(c, h) { + function Dy(c, h) { var y = nr(c), O = !y && Ua(c), q = !y && !O && Xo(c), ne = !y && !O && !q && Bc(c), fe = y || O || q || ne, ge = fe ? jp(c.length, mA) : [], we = ge.length; for (var He in c) (h || Tr.call(c, He)) && !(fe && // Safari 9 has enumerable `arguments.length` in strict mode. @@ -21858,7 +21859,7 @@ l0.exports; uo(He, we))) && ge.push(He); return ge; } - function Dy(c) { + function Oy(c) { var h = c.length; return h ? c[ig(0, h - 1)] : r; } @@ -21886,7 +21887,7 @@ l0.exports; h(O, q, y(q), fe); }), O; } - function Oy(c, h) { + function Ny(c, h) { return c && Cs(h, Mn(h), c); } function fP(c, h) { @@ -21921,10 +21922,10 @@ l0.exports; } else { var Xe = Kn(c), wt = Xe == re || Xe == de; if (Xo(c)) - return nw(c, ge); + return iw(c, ge); if (Xe == Pe || Xe == D || wt && !q) { - if (fe = we || wt ? {} : _w(c), !ge) - return we ? jP(c, fP(fe, c)) : UP(c, Oy(fe, c)); + if (fe = we || wt ? {} : Ew(c), !ge) + return we ? jP(c, fP(fe, c)) : UP(c, Ny(fe, c)); } else { if (!Dr[Xe]) return q ? c : {}; @@ -21935,9 +21936,9 @@ l0.exports; var Ot = ne.get(c); if (Ot) return Ot; - ne.set(c, fe), Xw(c) ? c.forEach(function(Kt) { + ne.set(c, fe), Zw(c) ? c.forEach(function(Kt) { fe.add(zi(Kt, h, y, Kt, c, ne)); - }) : Yw(c) && c.forEach(function(Kt, vr) { + }) : Jw(c) && c.forEach(function(Kt, vr) { fe.set(vr, zi(Kt, h, y, vr, c, ne)); }); var Wt = He ? we ? gg : pg : we ? li : Mn, ur = We ? r : Wt(c); @@ -21948,10 +21949,10 @@ l0.exports; function lP(c) { var h = Mn(c); return function(y) { - return Ny(y, c, h); + return Ly(y, c, h); }; } - function Ny(c, h, y) { + function Ly(c, h, y) { var O = y.length; if (c == null) return !O; @@ -21962,7 +21963,7 @@ l0.exports; } return !0; } - function Ly(c, h, y) { + function ky(c, h, y) { if (typeof c != "function") throw new ji(o); return hf(function() { @@ -21986,7 +21987,7 @@ l0.exports; } return we; } - var Vo = cw(Is), ky = cw(Xp, !0); + var Vo = uw(Is), $y = uw(Xp, !0); function hP(c, h) { var y = !0; return Vo(c, function(O, q, ne) { @@ -22003,11 +22004,11 @@ l0.exports; } function dP(c, h, y, O) { var q = c.length; - for (y = ar(y), y < 0 && (y = -y > q ? 0 : q + y), O = O === r || O > q ? q : ar(O), O < 0 && (O += q), O = y > O ? 0 : Qw(O); y < O; ) + for (y = ar(y), y < 0 && (y = -y > q ? 0 : q + y), O = O === r || O > q ? q : ar(O), O < 0 && (O += q), O = y > O ? 0 : e2(O); y < O; ) c[y++] = h; return c; } - function $y(c, h) { + function Fy(c, h) { var y = []; return Vo(c, function(O, q, ne) { h(O, q, ne) && y.push(O); @@ -22021,12 +22022,12 @@ l0.exports; } return q; } - var Jp = uw(), Fy = uw(!0); + var Jp = fw(), By = fw(!0); function Is(c, h) { return c && Jp(c, h, Mn); } function Xp(c, h) { - return c && Fy(c, h, Mn); + return c && By(c, h, Mn); } function Lh(c, h) { return zo(h, function(y) { @@ -22039,7 +22040,7 @@ l0.exports; c = c[Ts(h[y++])]; return y && y == O ? c : r; } - function By(c, h, y) { + function Uy(c, h, y) { var O = h(c); return nr(c) ? O : Ho(O, y(c)); } @@ -22085,11 +22086,11 @@ l0.exports; }), O; } function af(c, h, y) { - h = Yo(h, c), c = Pw(c, h); + h = Yo(h, c), c = Mw(c, h); var O = c == null ? c : c[Ts(Wi(h))]; return O == null ? r : Pn(O, c, y); } - function Uy(c) { + function jy(c) { return en(c) && ti(c) == D; } function bP(c) { @@ -22111,7 +22112,7 @@ l0.exports; fe = !0, We = !1; } if (wt && !We) - return ne || (ne = new ls()), fe || Bc(c) ? yw(c, h, y, O, q, ne) : VP(c, h, we, y, O, q, ne); + return ne || (ne = new ls()), fe || Bc(c) ? ww(c, h, y, O, q, ne) : VP(c, h, we, y, O, q, ne); if (!(y & M)) { var Ot = We && Tr.call(c, "__wrapped__"), Wt = Xe && Tr.call(h, "__wrapped__"); if (Ot || Wt) { @@ -22149,7 +22150,7 @@ l0.exports; } return !0; } - function jy(c) { + function qy(c) { if (!Zr(c) || nM(c)) return !1; var h = fo(c) ? xA : Ue; @@ -22164,8 +22165,8 @@ l0.exports; function SP(c) { return en(c) && Zh(c.length) && !!Br[ti(c)]; } - function qy(c) { - return typeof c == "function" ? c : c == null ? hi : typeof c == "object" ? nr(c) ? Wy(c[0], c[1]) : Hy(c) : f2(c); + function zy(c) { + return typeof c == "function" ? c : c == null ? hi : typeof c == "object" ? nr(c) ? Ky(c[0], c[1]) : Wy(c) : l2(c); } function tg(c) { if (!lf(c)) @@ -22186,20 +22187,20 @@ l0.exports; function rg(c, h) { return c < h; } - function zy(c, h) { + function Hy(c, h) { var y = -1, O = fi(c) ? Ie(c.length) : []; return Vo(c, function(q, ne, fe) { O[++y] = h(q, ne, fe); }), O; } - function Hy(c) { + function Wy(c) { var h = vg(c); - return h.length == 1 && h[0][2] ? Sw(h[0][0], h[0][1]) : function(y) { + return h.length == 1 && h[0][2] ? Aw(h[0][0], h[0][1]) : function(y) { return y === c || eg(y, c, h); }; } - function Wy(c, h) { - return yg(c) && Ew(h) ? Sw(Ts(c), h) : function(y) { + function Ky(c, h) { + return yg(c) && Sw(h) ? Aw(Ts(c), h) : function(y) { var O = Cg(y, c); return O === r && O === h ? Tg(y, c) : cf(h, O, M | N); }; @@ -22223,16 +22224,16 @@ l0.exports; var We = ne ? ne(ge, we, y + "", c, h, fe) : r, Xe = We === r; if (Xe) { var wt = nr(we), Ot = !wt && Xo(we), Wt = !wt && !Ot && Bc(we); - We = we, wt || Ot || Wt ? nr(ge) ? We = ge : cn(ge) ? We = ui(ge) : Ot ? (Xe = !1, We = nw(we, !0)) : Wt ? (Xe = !1, We = iw(we, !0)) : We = [] : df(we) || Ua(we) ? (We = ge, Ua(ge) ? We = e2(ge) : (!Zr(ge) || fo(ge)) && (We = _w(we))) : Xe = !1; + We = we, wt || Ot || Wt ? nr(ge) ? We = ge : cn(ge) ? We = ui(ge) : Ot ? (Xe = !1, We = iw(we, !0)) : Wt ? (Xe = !1, We = sw(we, !0)) : We = [] : df(we) || Ua(we) ? (We = ge, Ua(ge) ? We = t2(ge) : (!Zr(ge) || fo(ge)) && (We = Ew(we))) : Xe = !1; } Xe && (fe.set(we, We), q(We, we, O, ne, fe), fe.delete(we)), Gp(c, y, We); } - function Ky(c, h) { + function Vy(c, h) { var y = c.length; if (y) return h += h < 0 ? y : 0, uo(h, y) ? c[h] : r; } - function Vy(c, h, y) { + function Gy(c, h, y) { h.length ? h = Xr(h, function(ne) { return nr(ne) ? function(fe) { return $a(fe, ne.length === 1 ? ne[0] : ne); @@ -22240,7 +22241,7 @@ l0.exports; }) : h = [hi]; var O = -1; h = Xr(h, Ai(jt())); - var q = zy(c, function(ne, fe, ge) { + var q = Hy(c, function(ne, fe, ge) { var we = Xr(h, function(He) { return He(ne); }); @@ -22251,11 +22252,11 @@ l0.exports; }); } function MP(c, h) { - return Gy(c, h, function(y, O) { + return Yy(c, h, function(y, O) { return Tg(c, O); }); } - function Gy(c, h, y) { + function Yy(c, h, y) { for (var O = -1, q = h.length, ne = {}; ++O < q; ) { var fe = h[O], ge = $a(c, fe); y(ge, fe) && uf(ne, Yo(fe, c), ge); @@ -22274,7 +22275,7 @@ l0.exports; ge !== c && Ph.call(ge, we, 1), Ph.call(c, we, 1); return c; } - function Yy(c, h) { + function Jy(c, h) { for (var y = c ? h.length : 0, O = y - 1; y--; ) { var q = h[y]; if (y == O || q !== ne) { @@ -22285,7 +22286,7 @@ l0.exports; return c; } function ig(c, h) { - return c + Ch(Cy() * (h - c + 1)); + return c + Ch(Ty() * (h - c + 1)); } function CP(c, h, y, O) { for (var q = -1, ne = _n(Ih((h - c) / (y || 1)), 0), fe = Ie(ne); ne--; ) @@ -22302,10 +22303,10 @@ l0.exports; return y; } function hr(c, h) { - return _g(Aw(c, h, hi), c + ""); + return _g(Pw(c, h, hi), c + ""); } function TP(c) { - return Dy(Uc(c)); + return Oy(Uc(c)); } function RP(c, h) { var y = Uc(c); @@ -22327,7 +22328,7 @@ l0.exports; } return c; } - var Jy = Th ? function(c, h) { + var Xy = Th ? function(c, h) { return Th.set(c, h), c; } : hi, DP = Mh ? function(c, h) { return Mh(c, "toString", { @@ -22378,7 +22379,7 @@ l0.exports; } return Wn(ne, I); } - function Xy(c, h) { + function Zy(c, h) { for (var y = -1, O = c.length, q = 0, ne = []; ++y < O; ) { var fe = c[y], ge = h ? h(fe) : fe; if (!y || !hs(ge, we)) { @@ -22388,7 +22389,7 @@ l0.exports; } return ne; } - function Zy(c) { + function Qy(c) { return typeof c == "number" ? c : Mi(c) ? v : +c; } function Pi(c) { @@ -22397,7 +22398,7 @@ l0.exports; if (nr(c)) return Xr(c, Pi) + ""; if (Mi(c)) - return Ty ? Ty.call(c) : ""; + return Ry ? Ry.call(c) : ""; var h = c + ""; return h == "0" && 1 / c == -x ? "-0" : h; } @@ -22425,9 +22426,9 @@ l0.exports; return ge; } function ag(c, h) { - return h = Yo(h, c), c = Pw(c, h), c == null || delete c[Ts(Wi(h))]; + return h = Yo(h, c), c = Mw(c, h), c == null || delete c[Ts(Wi(h))]; } - function Qy(c, h, y, O) { + function ew(c, h, y, O) { return uf(c, h, y($a(c, h)), O); } function Fh(c, h, y, O) { @@ -22435,7 +22436,7 @@ l0.exports; ; return y ? Hi(c, O ? 0 : ne, O ? ne + 1 : q) : Hi(c, O ? ne + 1 : 0, O ? q : ne); } - function ew(c, h) { + function tw(c, h) { var y = c; return y instanceof wr && (y = y.value()), kp(h, function(O, q) { return q.func.apply(q.thisArg, Ho([O], q.args)); @@ -22450,7 +22451,7 @@ l0.exports; ge != q && (ne[q] = of(ne[q] || fe, c[ge], h, y)); return Go($n(ne, 1), h, y); } - function tw(c, h, y) { + function rw(c, h, y) { for (var O = -1, q = c.length, ne = h.length, fe = {}; ++O < q; ) { var ge = O < ne ? h[O] : r; y(fe, c[O], ge); @@ -22464,20 +22465,20 @@ l0.exports; return typeof c == "function" ? c : hi; } function Yo(c, h) { - return nr(c) ? c : yg(c, h) ? [c] : Tw(Cr(c)); + return nr(c) ? c : yg(c, h) ? [c] : Rw(Cr(c)); } var LP = hr; function Jo(c, h, y) { var O = c.length; return y = y === r ? O : y, !h && y >= O ? c : Hi(c, h, y); } - var rw = _A || function(c) { + var nw = _A || function(c) { return _r.clearTimeout(c); }; - function nw(c, h) { + function iw(c, h) { if (h) return c.slice(); - var y = c.length, O = Sy ? Sy(y) : new c.constructor(y); + var y = c.length, O = Ay ? Ay(y) : new c.constructor(y); return c.copy(O), O; } function lg(c) { @@ -22495,11 +22496,11 @@ l0.exports; function FP(c) { return nf ? qr(nf.call(c)) : {}; } - function iw(c, h) { + function sw(c, h) { var y = h ? lg(c.buffer) : c.buffer; return new c.constructor(y, c.byteOffset, c.length); } - function sw(c, h) { + function ow(c, h) { if (c !== h) { var y = c !== r, O = c === null, q = c === c, ne = Mi(c), fe = h !== r, ge = h === null, we = h === h, He = Mi(h); if (!ge && !He && !ne && c > h || ne && fe && we && !ge && !He || O && fe && we || !y && we || !q) @@ -22511,7 +22512,7 @@ l0.exports; } function BP(c, h, y) { for (var O = -1, q = c.criteria, ne = h.criteria, fe = q.length, ge = y.length; ++O < fe; ) { - var we = sw(q[O], ne[O]); + var we = ow(q[O], ne[O]); if (we) { if (O >= ge) return we; @@ -22521,7 +22522,7 @@ l0.exports; } return c.index - h.index; } - function ow(c, h, y, O) { + function aw(c, h, y, O) { for (var q = -1, ne = c.length, fe = y.length, ge = -1, we = h.length, He = _n(ne - fe, 0), We = Ie(we + He), Xe = !O; ++ge < we; ) We[ge] = h[ge]; for (; ++q < fe; ) @@ -22530,7 +22531,7 @@ l0.exports; We[ge++] = c[q++]; return We; } - function aw(c, h, y, O) { + function cw(c, h, y, O) { for (var q = -1, ne = c.length, fe = -1, ge = y.length, we = -1, He = h.length, We = _n(ne - ge, 0), Xe = Ie(We + He), wt = !O; ++q < We; ) Xe[q] = c[q]; for (var Ot = q; ++we < He; ) @@ -22558,7 +22559,7 @@ l0.exports; return Cs(c, bg(c), h); } function jP(c, h) { - return Cs(c, ww(c), h); + return Cs(c, xw(c), h); } function Bh(c, h) { return function(y, O) { @@ -22576,7 +22577,7 @@ l0.exports; return h; }); } - function cw(c, h) { + function uw(c, h) { return function(y, O) { if (y == null) return y; @@ -22587,7 +22588,7 @@ l0.exports; return y; }; } - function uw(c) { + function fw(c) { return function(h, y, O) { for (var q = -1, ne = qr(h), fe = O(h), ge = fe.length; ge--; ) { var we = fe[c ? ge : ++q]; @@ -22605,7 +22606,7 @@ l0.exports; } return ne; } - function fw(c) { + function lw(c) { return function(h) { h = Cr(h); var y = Cc(h) ? fs(h) : r, O = y ? y[0] : h.charAt(0), q = y ? Jo(y, 1).join("") : h.slice(1); @@ -22614,7 +22615,7 @@ l0.exports; } function $c(c) { return function(h) { - return kp(c2(a2(h).replace(Ju, "")), c, ""); + return kp(u2(c2(h).replace(Ju, "")), c, ""); }; } function ff(c) { @@ -22649,7 +22650,7 @@ l0.exports; fe[ge] = arguments[ge]; var He = ne < 3 && fe[0] !== we && fe[ne - 1] !== we ? [] : Wo(fe, we); if (ne -= He.length, ne < y) - return gw( + return mw( c, h, Uh, @@ -22666,7 +22667,7 @@ l0.exports; } return q; } - function lw(c) { + function hw(c) { return function(h, y, O) { var q = qr(h); if (!fi(h)) { @@ -22679,7 +22680,7 @@ l0.exports; return fe > -1 ? q[ne ? h[fe] : fe] : r; }; } - function hw(c) { + function dw(c) { return co(function(h) { var y = h.length, O = y, q = qi.prototype.thru; for (c && h.reverse(); O--; ) { @@ -22705,15 +22706,15 @@ l0.exports; }); } function Uh(c, h, y, O, q, ne, fe, ge, we, He) { - var We = h & R, Xe = h & L, wt = h & F, Ot = h & (K | H), Wt = h & pe, ur = wt ? r : ff(c); + var We = h & R, Xe = h & L, wt = h & $, Ot = h & (K | H), Wt = h & pe, ur = wt ? r : ff(c); function Kt() { for (var vr = arguments.length, Er = Ie(vr), Ii = vr; Ii--; ) Er[Ii] = arguments[Ii]; if (Ot) var ni = Fc(Kt), Ci = tA(Er, ni); - if (O && (Er = ow(Er, O, q, Ot)), ne && (Er = aw(Er, ne, fe, Ot)), vr -= Ci, Ot && vr < He) { + if (O && (Er = aw(Er, O, q, Ot)), ne && (Er = cw(Er, ne, fe, Ot)), vr -= Ci, Ot && vr < He) { var un = Wo(Er, ni); - return gw( + return mw( c, h, Uh, @@ -22731,7 +22732,7 @@ l0.exports; } return Kt; } - function dw(c, h) { + function pw(c, h) { return function(y, O) { return vP(y, c, h(O), {}); }; @@ -22744,7 +22745,7 @@ l0.exports; if (y !== r && (q = y), O !== r) { if (q === r) return O; - typeof y == "string" || typeof O == "string" ? (y = Pi(y), O = Pi(O)) : (y = Zy(y), O = Zy(O)), q = c(y, O); + typeof y == "string" || typeof O == "string" ? (y = Pi(y), O = Pi(O)) : (y = Qy(y), O = Qy(O)), q = c(y, O); } return q; }; @@ -22778,7 +22779,7 @@ l0.exports; } return fe; } - function pw(c) { + function gw(c) { return function(h, y, O) { return O && typeof O != "number" && ri(h, y, O) && (y = O = r), h = lo(h), y === r ? (y = h, h = 0) : y = lo(y), O = O === r ? h < y ? 1 : -1 : lo(O), CP(h, y, O, c); }; @@ -22788,9 +22789,9 @@ l0.exports; return typeof h == "string" && typeof y == "string" || (h = Ki(h), y = Ki(y)), c(h, y); }; } - function gw(c, h, y, O, q, ne, fe, ge, we, He) { + function mw(c, h, y, O, q, ne, fe, ge, we, He) { var We = h & K, Xe = We ? fe : r, wt = We ? r : fe, Ot = We ? ne : r, Wt = We ? r : ne; - h |= We ? V : te, h &= ~(We ? te : V), h & $ || (h &= ~(L | F)); + h |= We ? V : te, h &= ~(We ? te : V), h & F || (h &= ~(L | $)); var ur = [ c, h, @@ -22803,12 +22804,12 @@ l0.exports; we, He ], Kt = y.apply(r, ur); - return wg(c) && Mw(Kt, ur), Kt.placeholder = O, Iw(Kt, c, h); + return wg(c) && Iw(Kt, ur), Kt.placeholder = O, Cw(Kt, c, h); } function dg(c) { var h = xn[c]; return function(y, O) { - if (y = Ki(y), O = O == null ? 0 : Wn(ar(O), 292), O && Iy(y)) { + if (y = Ki(y), O = O == null ? 0 : Wn(ar(O), 292), O && Cy(y)) { var q = (Cr(y) + "e").split("e"), ne = h(q[0] + "e" + (+q[1] + O)); return q = (Cr(ne) + "e").split("e"), +(q[0] + "e" + (+q[1] - O)); } @@ -22818,14 +22819,14 @@ l0.exports; var WP = Oc && 1 / bh(new Oc([, -0]))[1] == x ? function(c) { return new Oc(c); } : Lg; - function mw(c) { + function vw(c) { return function(h) { var y = Kn(h); return y == ie ? zp(h) : y == Me ? cA(h) : eA(h, c(h)); }; } function ao(c, h, y, O, q, ne, fe, ge) { - var we = h & F; + var we = h & $; if (!we && typeof c != "function") throw new ji(o); var He = O ? O.length : 0; @@ -22848,19 +22849,19 @@ l0.exports; if (wt && oM(Ot, wt), c = Ot[0], h = Ot[1], y = Ot[2], O = Ot[3], q = Ot[4], ge = Ot[9] = Ot[9] === r ? we ? 0 : c.length : _n(Ot[9] - He, 0), !ge && h & (K | H) && (h &= ~(K | H)), !h || h == L) var Wt = qP(c, h, y); else h == K || h == H ? Wt = zP(c, h, ge) : (h == V || h == (L | V)) && !q.length ? Wt = HP(c, h, y, O) : Wt = Uh.apply(r, Ot); - var ur = wt ? Jy : Mw; - return Iw(ur(Wt, Ot), c, h); + var ur = wt ? Xy : Iw; + return Cw(ur(Wt, Ot), c, h); } - function vw(c, h, y, O) { + function bw(c, h, y, O) { return c === r || hs(c, Dc[y]) && !Tr.call(O, y) ? h : c; } - function bw(c, h, y, O, q, ne) { - return Zr(c) && Zr(h) && (ne.set(h, c), kh(c, h, r, bw, ne), ne.delete(h)), c; + function yw(c, h, y, O, q, ne) { + return Zr(c) && Zr(h) && (ne.set(h, c), kh(c, h, r, yw, ne), ne.delete(h)), c; } function KP(c) { return df(c) ? r : c; } - function yw(c, h, y, O, q, ne) { + function ww(c, h, y, O, q, ne) { var fe = y & M, ge = c.length, we = h.length; if (ge != we && !(fe && we > ge)) return !1; @@ -22920,7 +22921,7 @@ l0.exports; if (He) return He == h; O |= N, fe.set(c, h); - var We = yw(ge(c), ge(h), O, q, ne, fe); + var We = ww(ge(c), ge(h), O, q, ne, fe); return fe.delete(c), We; case Ke: if (nf) @@ -22960,13 +22961,13 @@ l0.exports; return ne.delete(c), ne.delete(h), ur; } function co(c) { - return _g(Aw(c, r, Nw), c + ""); + return _g(Pw(c, r, Lw), c + ""); } function pg(c) { - return By(c, Mn, bg); + return Uy(c, Mn, bg); } function gg(c) { - return By(c, li, ww); + return Uy(c, li, xw); } var mg = Th ? function(c) { return Th.get(c); @@ -22985,7 +22986,7 @@ l0.exports; } function jt() { var c = ee.iteratee || Og; - return c = c === Og ? qy : c, arguments.length ? c(arguments[0], arguments[1]) : c; + return c = c === Og ? zy : c, arguments.length ? c(arguments[0], arguments[1]) : c; } function Wh(c, h) { var y = c.__data__; @@ -22994,13 +22995,13 @@ l0.exports; function vg(c) { for (var h = Mn(c), y = h.length; y--; ) { var O = h[y], q = c[O]; - h[y] = [O, q, Ew(q)]; + h[y] = [O, q, Sw(q)]; } return h; } function Fa(c, h) { var y = sA(c, h); - return jy(y) ? y : r; + return qy(y) ? y : r; } function YP(c) { var h = Tr.call(c, Oa), y = c[Oa]; @@ -23014,9 +23015,9 @@ l0.exports; } var bg = Wp ? function(c) { return c == null ? [] : (c = qr(c), zo(Wp(c), function(h) { - return Py.call(c, h); + return My.call(c, h); })); - } : kg, ww = Wp ? function(c) { + } : kg, xw = Wp ? function(c) { for (var h = []; c; ) Ho(h, bg(c)), c = Ah(c); return h; @@ -23062,7 +23063,7 @@ l0.exports; var h = c.match(C); return h ? h[1].split(G) : []; } - function xw(c, h, y) { + function _w(c, h, y) { h = Yo(h, c); for (var O = -1, q = h.length, ne = !1; ++O < q; ) { var fe = Ts(h[O]); @@ -23076,7 +23077,7 @@ l0.exports; var h = c.length, y = new c.constructor(h); return h && typeof c[0] == "string" && Tr.call(c, "index") && (y.index = c.index, y.input = c.input), y; } - function _w(c) { + function Ew(c) { return typeof c.constructor == "function" && !lf(c) ? Lc(Ah(c)) : {}; } function QP(c, h, y) { @@ -23098,7 +23099,7 @@ l0.exports; case lt: case ct: case qt: - return iw(c, y); + return sw(c, y); case ie: return new O(); case ue: @@ -23122,7 +23123,7 @@ l0.exports; `); } function tM(c) { - return nr(c) || Ua(c) || !!(My && c && c[My]); + return nr(c) || Ua(c) || !!(Iy && c && c[Iy]); } function uo(c, h) { var y = typeof c; @@ -23154,17 +23155,17 @@ l0.exports; return !!O && c === O[0]; } function nM(c) { - return !!Ey && Ey in c; + return !!Sy && Sy in c; } var iM = wh ? fo : $g; function lf(c) { var h = c && c.constructor, y = typeof h == "function" && h.prototype || Dc; return c === y; } - function Ew(c) { + function Sw(c) { return c === c && !Zr(c); } - function Sw(c, h) { + function Aw(c, h) { return function(y) { return y == null ? !1 : y[c] === h && (h !== r || c in qr(y)); }; @@ -23176,16 +23177,16 @@ l0.exports; return h; } function oM(c, h) { - var y = c[1], O = h[1], q = y | O, ne = q < (L | F | R), fe = O == R && y == K || O == R && y == W && c[7].length <= h[8] || O == (R | W) && h[7].length <= h[8] && y == K; + var y = c[1], O = h[1], q = y | O, ne = q < (L | $ | R), fe = O == R && y == K || O == R && y == W && c[7].length <= h[8] || O == (R | W) && h[7].length <= h[8] && y == K; if (!(ne || fe)) return c; - O & L && (c[2] = h[2], q |= y & L ? 0 : $); + O & L && (c[2] = h[2], q |= y & L ? 0 : F); var ge = h[3]; if (ge) { var we = c[3]; - c[3] = we ? ow(we, ge, h[4]) : ge, c[4] = we ? Wo(c[3], d) : h[4]; + c[3] = we ? aw(we, ge, h[4]) : ge, c[4] = we ? Wo(c[3], d) : h[4]; } - return ge = h[5], ge && (we = c[5], c[5] = we ? aw(we, ge, h[6]) : ge, c[6] = we ? Wo(c[5], d) : h[6]), ge = h[7], ge && (c[7] = ge), O & R && (c[8] = c[8] == null ? h[8] : Wn(c[8], h[8])), c[9] == null && (c[9] = h[9]), c[0] = h[0], c[1] = q, c; + return ge = h[5], ge && (we = c[5], c[5] = we ? cw(we, ge, h[6]) : ge, c[6] = we ? Wo(c[5], d) : h[6]), ge = h[7], ge && (c[7] = ge), O & R && (c[8] = c[8] == null ? h[8] : Wn(c[8], h[8])), c[9] == null && (c[9] = h[9]), c[0] = h[0], c[1] = q, c; } function aM(c) { var h = []; @@ -23197,7 +23198,7 @@ l0.exports; function cM(c) { return _h.call(c); } - function Aw(c, h, y) { + function Pw(c, h, y) { return h = _n(h === r ? c.length - 1 : h, 0), function() { for (var O = arguments, q = -1, ne = _n(O.length - h, 0), fe = Ie(ne); ++q < ne; ) fe[q] = O[h + q]; @@ -23207,7 +23208,7 @@ l0.exports; return ge[h] = y(fe), Pn(c, this, ge); }; } - function Pw(c, h) { + function Mw(c, h) { return h.length < 2 ? c : $a(c, Hi(h, 0, -1)); } function uM(c, h) { @@ -23221,14 +23222,14 @@ l0.exports; if (!(h === "constructor" && typeof c[h] == "function") && h != "__proto__") return c[h]; } - var Mw = Cw(Jy), hf = SA || function(c, h) { + var Iw = Tw(Xy), hf = SA || function(c, h) { return _r.setTimeout(c, h); - }, _g = Cw(DP); - function Iw(c, h, y) { + }, _g = Tw(DP); + function Cw(c, h, y) { var O = h + ""; return _g(c, eM(O, fM(XP(O), y))); } - function Cw(c) { + function Tw(c) { var h = 0, y = 0; return function() { var O = IA(), q = m - (O - y); @@ -23248,7 +23249,7 @@ l0.exports; } return c.length = h, c; } - var Tw = sM(function(c) { + var Rw = sM(function(c) { var h = []; return c.charCodeAt(0) === 46 && h.push(""), c.replace(Bt, function(y, O, q, ne) { h.push(q ? ne.replace(he, "$1") : O || y); @@ -23279,7 +23280,7 @@ l0.exports; h & y[1] && !mh(c, O) && c.push(O); }), c.sort(); } - function Rw(c) { + function Dw(c) { if (c instanceof wr) return c.clone(); var h = new qi(c.__wrapped__, c.__chain__); @@ -23336,21 +23337,21 @@ l0.exports; var q = c == null ? 0 : c.length; return q ? (y && typeof y != "number" && ri(c, h, y) && (y = 0, O = q), dP(c, h, y, O)) : []; } - function Dw(c, h, y) { + function Ow(c, h, y) { var O = c == null ? 0 : c.length; if (!O) return -1; var q = y == null ? 0 : ar(y); return q < 0 && (q = _n(O + q, 0)), vh(c, jt(h, 3), q); } - function Ow(c, h, y) { + function Nw(c, h, y) { var O = c == null ? 0 : c.length; if (!O) return -1; var q = O - 1; return y !== r && (q = ar(y), q = y < 0 ? _n(O + q, 0) : Wn(q, O - 1)), vh(c, jt(h, 3), q, !0); } - function Nw(c) { + function Lw(c) { var h = c == null ? 0 : c.length; return h ? $n(c, 1) : []; } @@ -23369,7 +23370,7 @@ l0.exports; } return O; } - function Lw(c) { + function kw(c) { return c && c.length ? c[0] : r; } function AM(c, h, y) { @@ -23405,13 +23406,13 @@ l0.exports; if (!O) return -1; var q = O; - return y !== r && (q = ar(y), q = q < 0 ? _n(O + q, 0) : Wn(q, O - 1)), h === h ? fA(c, h, q) : vh(c, gy, q, !0); + return y !== r && (q = ar(y), q = q < 0 ? _n(O + q, 0) : Wn(q, O - 1)), h === h ? fA(c, h, q) : vh(c, my, q, !0); } function DM(c, h) { - return c && c.length ? Ky(c, ar(h)) : r; + return c && c.length ? Vy(c, ar(h)) : r; } - var OM = hr(kw); - function kw(c, h) { + var OM = hr($w); + function $w(c, h) { return c && c.length && h && h.length ? ng(c, h) : c; } function NM(c, h, y) { @@ -23422,9 +23423,9 @@ l0.exports; } var kM = co(function(c, h) { var y = c == null ? 0 : c.length, O = Yp(c, h); - return Yy(c, Xr(h, function(q) { + return Jy(c, Xr(h, function(q) { return uo(q, y) ? +q : q; - }).sort(sw)), O; + }).sort(ow)), O; }); function $M(c, h) { var y = []; @@ -23435,7 +23436,7 @@ l0.exports; var fe = c[O]; h(fe, O, c) && (y.push(fe), q.push(O)); } - return Yy(c, q), y; + return Jy(c, q), y; } function Eg(c) { return c == null ? c : TA.call(c); @@ -23475,10 +23476,10 @@ l0.exports; return -1; } function WM(c) { - return c && c.length ? Xy(c) : []; + return c && c.length ? Zy(c) : []; } function KM(c, h) { - return c && c.length ? Xy(c, jt(h, 2)) : []; + return c && c.length ? Zy(c, jt(h, 2)) : []; } function VM(c) { var h = c == null ? 0 : c.length; @@ -23526,7 +23527,7 @@ l0.exports; return Xr(c, Fp(y)); }); } - function $w(c, h) { + function Fw(c, h) { if (!(c && c.length)) return []; var y = Sg(c); @@ -23546,16 +23547,16 @@ l0.exports; return h = typeof h == "function" ? h : r, cg(zo(c, cn), r, h); }), cI = hr(Sg); function uI(c, h) { - return tw(c || [], h || [], sf); + return rw(c || [], h || [], sf); } function fI(c, h) { - return tw(c || [], h || [], uf); + return rw(c || [], h || [], uf); } var lI = hr(function(c) { var h = c.length, y = h > 1 ? c[h - 1] : r; - return y = typeof y == "function" ? (c.pop(), y) : r, $w(c, y); + return y = typeof y == "function" ? (c.pop(), y) : r, Fw(c, y); }); - function Fw(c) { + function Bw(c) { var h = ee(c); return h.__chain__ = !0, h; } @@ -23578,13 +23579,13 @@ l0.exports; })); }); function pI() { - return Fw(this); + return Bw(this); } function gI() { return new qi(this.value(), this.__chain__); } function mI() { - this.__values__ === r && (this.__values__ = Zw(this.value())); + this.__values__ === r && (this.__values__ = Qw(this.value())); var c = this.__index__ >= this.__values__.length, h = c ? r : this.__values__[this.__index__++]; return { done: c, value: h }; } @@ -23593,7 +23594,7 @@ l0.exports; } function bI(c) { for (var h, y = this; y instanceof Dh; ) { - var O = Rw(y); + var O = Dw(y); O.__index__ = 0, O.__values__ = r, h ? q.__wrapped__ = O : h = O; var q = O; y = y.__wrapped__; @@ -23613,20 +23614,20 @@ l0.exports; return this.thru(Eg); } function wI() { - return ew(this.__wrapped__, this.__actions__); + return tw(this.__wrapped__, this.__actions__); } var xI = Bh(function(c, h, y) { Tr.call(c, y) ? ++c[y] : oo(c, y, 1); }); function _I(c, h, y) { - var O = nr(c) ? dy : hP; + var O = nr(c) ? py : hP; return y && ri(c, h, y) && (h = r), O(c, jt(h, 3)); } function EI(c, h) { - var y = nr(c) ? zo : $y; + var y = nr(c) ? zo : Fy; return y(c, jt(h, 3)); } - var SI = lw(Dw), AI = lw(Ow); + var SI = hw(Ow), AI = hw(Nw); function PI(c, h) { return $n(Gh(c, h), 1); } @@ -23636,12 +23637,12 @@ l0.exports; function II(c, h, y) { return y = y === r ? 1 : ar(y), $n(Gh(c, h), y); } - function Bw(c, h) { + function Uw(c, h) { var y = nr(c) ? Ui : Vo; return y(c, jt(h, 3)); } - function Uw(c, h) { - var y = nr(c) ? V9 : ky; + function jw(c, h) { + var y = nr(c) ? V9 : $y; return y(c, jt(h, 3)); } var CI = Bh(function(c, h, y) { @@ -23661,11 +23662,11 @@ l0.exports; oo(c, y, h); }); function Gh(c, h) { - var y = nr(c) ? Xr : zy; + var y = nr(c) ? Xr : Hy; return y(c, jt(h, 3)); } function OI(c, h, y, O) { - return c == null ? [] : (nr(h) || (h = h == null ? [] : [h]), y = O ? r : y, nr(y) || (y = y == null ? [] : [y]), Vy(c, h, y)); + return c == null ? [] : (nr(h) || (h = h == null ? [] : [h]), y = O ? r : y, nr(y) || (y = y == null ? [] : [y]), Gy(c, h, y)); } var NI = Bh(function(c, h, y) { c[y ? 0 : 1].push(h); @@ -23673,19 +23674,19 @@ l0.exports; return [[], []]; }); function LI(c, h, y) { - var O = nr(c) ? kp : vy, q = arguments.length < 3; + var O = nr(c) ? kp : by, q = arguments.length < 3; return O(c, jt(h, 4), y, q, Vo); } function kI(c, h, y) { - var O = nr(c) ? G9 : vy, q = arguments.length < 3; - return O(c, jt(h, 4), y, q, ky); + var O = nr(c) ? G9 : by, q = arguments.length < 3; + return O(c, jt(h, 4), y, q, $y); } function $I(c, h) { - var y = nr(c) ? zo : $y; + var y = nr(c) ? zo : Fy; return y(c, Xh(jt(h, 3))); } function FI(c) { - var h = nr(c) ? Dy : TP; + var h = nr(c) ? Oy : TP; return h(c); } function BI(c, h, y) { @@ -23713,7 +23714,7 @@ l0.exports; if (c == null) return []; var y = h.length; - return y > 1 && ri(c, h[0], h[1]) ? h = [] : y > 2 && ri(h[0], h[1], h[2]) && (h = [h[0]]), Vy(c, $n(h, 1), []); + return y > 1 && ri(c, h[0], h[1]) ? h = [] : y > 2 && ri(h[0], h[1], h[2]) && (h = [h[0]]), Gy(c, $n(h, 1), []); }), Yh = EA || function() { return _r.Date.now(); }; @@ -23725,10 +23726,10 @@ l0.exports; return h.apply(this, arguments); }; } - function jw(c, h, y) { + function qw(c, h, y) { return h = y ? r : h, h = c && h == null ? c.length : h, ao(c, R, r, r, r, r, h); } - function qw(c, h) { + function zw(c, h) { var y; if (typeof h != "function") throw new ji(o); @@ -23743,25 +23744,25 @@ l0.exports; O |= V; } return ao(c, O, h, y, q); - }), zw = hr(function(c, h, y) { - var O = L | F; + }), Hw = hr(function(c, h, y) { + var O = L | $; if (y.length) { - var q = Wo(y, Fc(zw)); + var q = Wo(y, Fc(Hw)); O |= V; } return ao(h, O, c, y, q); }); - function Hw(c, h, y) { + function Ww(c, h, y) { h = y ? r : h; var O = ao(c, K, r, r, r, r, r, h); - return O.placeholder = Hw.placeholder, O; + return O.placeholder = Ww.placeholder, O; } - function Ww(c, h, y) { + function Kw(c, h, y) { h = y ? r : h; var O = ao(c, H, r, r, r, r, r, h); - return O.placeholder = Ww.placeholder, O; + return O.placeholder = Kw.placeholder, O; } - function Kw(c, h, y) { + function Vw(c, h, y) { var O, q, ne, fe, ge, we, He = 0, We = !1, Xe = !1, wt = !0; if (typeof c != "function") throw new ji(o); @@ -23774,8 +23775,8 @@ l0.exports; return He = un, ge = hf(vr, h), We ? Ot(un) : fe; } function ur(un) { - var ds = un - we, ho = un - He, l2 = h - ds; - return Xe ? Wn(l2, ne - ho) : l2; + var ds = un - we, ho = un - He, h2 = h - ds; + return Xe ? Wn(h2, ne - ho) : h2; } function Kt(un) { var ds = un - we, ho = un - He; @@ -23791,7 +23792,7 @@ l0.exports; return ge = r, wt && O ? Ot(un) : (O = q = r, fe); } function Ii() { - ge !== r && rw(ge), He = 0, O = we = q = ge = r; + ge !== r && nw(ge), He = 0, O = we = q = ge = r; } function ni() { return ge === r ? fe : Er(Yh()); @@ -23802,16 +23803,16 @@ l0.exports; if (ge === r) return Wt(we); if (Xe) - return rw(ge), ge = hf(vr, h), Ot(we); + return nw(ge), ge = hf(vr, h), Ot(we); } return ge === r && (ge = hf(vr, h)), fe; } return Ci.cancel = Ii, Ci.flush = ni, Ci; } var WI = hr(function(c, h) { - return Ly(c, 1, h); + return ky(c, 1, h); }), KI = hr(function(c, h, y) { - return Ly(c, Ki(h) || 0, y); + return ky(c, Ki(h) || 0, y); }); function VI(c) { return ao(c, pe); @@ -23848,7 +23849,7 @@ l0.exports; }; } function GI(c) { - return qw(2, c); + return zw(2, c); } var YI = LP(function(c, h) { h = h.length == 1 && nr(h[0]) ? Xr(h[0], Ai(jt())) : Xr($n(h, 1), Ai(jt())); @@ -23861,8 +23862,8 @@ l0.exports; }), Pg = hr(function(c, h) { var y = Wo(h, Fc(Pg)); return ao(c, V, r, h, y); - }), Vw = hr(function(c, h) { - var y = Wo(h, Fc(Vw)); + }), Gw = hr(function(c, h) { + var y = Wo(h, Fc(Gw)); return ao(c, te, r, h, y); }), JI = co(function(c, h) { return ao(c, W, r, r, r, h); @@ -23884,14 +23885,14 @@ l0.exports; var O = !0, q = !0; if (typeof c != "function") throw new ji(o); - return Zr(y) && (O = "leading" in y ? !!y.leading : O, q = "trailing" in y ? !!y.trailing : q), Kw(c, h, { + return Zr(y) && (O = "leading" in y ? !!y.leading : O, q = "trailing" in y ? !!y.trailing : q), Vw(c, h, { leading: O, maxWait: h, trailing: q }); } function eC(c) { - return jw(c, 1); + return qw(c, 1); } function tC(c, h) { return Pg(fg(h), c); @@ -23915,17 +23916,17 @@ l0.exports; return h = typeof h == "function" ? h : r, zi(c, g | A, h); } function aC(c, h) { - return h == null || Ny(c, h, Mn(h)); + return h == null || Ly(c, h, Mn(h)); } function hs(c, h) { return c === h || c !== c && h !== h; } var cC = zh(Zp), uC = zh(function(c, h) { return c >= h; - }), Ua = Uy(/* @__PURE__ */ function() { + }), Ua = jy(/* @__PURE__ */ function() { return arguments; - }()) ? Uy : function(c) { - return en(c) && Tr.call(c, "callee") && !Py.call(c, "callee"); + }()) ? jy : function(c) { + return en(c) && Tr.call(c, "callee") && !My.call(c, "callee"); }, nr = Ie.isArray, fC = ei ? Ai(ei) : bP; function fi(c) { return c != null && Zh(c.length) && !fo(c); @@ -23970,7 +23971,7 @@ l0.exports; return h == X || h == T || typeof c.message == "string" && typeof c.name == "string" && !df(c); } function vC(c) { - return typeof c == "number" && Iy(c); + return typeof c == "number" && Cy(c); } function fo(c) { if (!Zr(c)) @@ -23978,7 +23979,7 @@ l0.exports; var h = ti(c); return h == re || h == de || h == Z || h == Ce; } - function Gw(c) { + function Yw(c) { return typeof c == "number" && c == ar(c); } function Zh(c) { @@ -23991,7 +23992,7 @@ l0.exports; function en(c) { return c != null && typeof c == "object"; } - var Yw = Bi ? Ai(Bi) : xP; + var Jw = Bi ? Ai(Bi) : xP; function bC(c, h) { return c === h || eg(c, h, vg(h)); } @@ -23999,12 +24000,12 @@ l0.exports; return y = typeof y == "function" ? y : r, eg(c, h, vg(h), y); } function wC(c) { - return Jw(c) && c != +c; + return Xw(c) && c != +c; } function xC(c) { if (iM(c)) throw new er(s); - return jy(c); + return qy(c); } function _C(c) { return c === null; @@ -24012,7 +24013,7 @@ l0.exports; function EC(c) { return c == null; } - function Jw(c) { + function Xw(c) { return typeof c == "number" || en(c) && ti(c) == ue; } function df(c) { @@ -24026,9 +24027,9 @@ l0.exports; } var Ig = Ms ? Ai(Ms) : _P; function SC(c) { - return Gw(c) && c >= -_ && c <= _; + return Yw(c) && c >= -_ && c <= _; } - var Xw = Xu ? Ai(Xu) : EP; + var Zw = Xu ? Ai(Xu) : EP; function Qh(c) { return typeof c == "string" || !nr(c) && en(c) && ti(c) == Ne; } @@ -24048,7 +24049,7 @@ l0.exports; var IC = zh(rg), CC = zh(function(c, h) { return c <= h; }); - function Zw(c) { + function Qw(c) { if (!c) return []; if (fi(c)) @@ -24071,7 +24072,7 @@ l0.exports; var h = lo(c), y = h % 1; return h === h ? y ? h - y : h : 0; } - function Qw(c) { + function e2(c) { return c ? ka(ar(c), 0, P) : 0; } function Ki(c) { @@ -24085,11 +24086,11 @@ l0.exports; } if (typeof c != "string") return c === 0 ? c : +c; - c = by(c); + c = yy(c); var y = nt.test(c); return y || pt.test(c) ? rr(c.slice(2), y ? 2 : 8) : Re.test(c) ? v : +c; } - function e2(c) { + function t2(c) { return Cs(c, li(c)); } function TC(c) { @@ -24105,7 +24106,7 @@ l0.exports; } for (var y in h) Tr.call(h, y) && sf(c, y, h[y]); - }), t2 = kc(function(c, h) { + }), r2 = kc(function(c, h) { Cs(h, li(h), c); }), ed = kc(function(c, h, y, O) { Cs(h, li(h), c, O); @@ -24114,7 +24115,7 @@ l0.exports; }), OC = co(Yp); function NC(c, h) { var y = Lc(c); - return h == null ? y : Oy(y, h); + return h == null ? y : Ny(y, h); } var LC = hr(function(c, h) { c = qr(c); @@ -24126,19 +24127,19 @@ l0.exports; } return c; }), kC = hr(function(c) { - return c.push(r, bw), Pn(r2, r, c); + return c.push(r, yw), Pn(n2, r, c); }); function $C(c, h) { - return py(c, jt(h, 3), Is); + return gy(c, jt(h, 3), Is); } function FC(c, h) { - return py(c, jt(h, 3), Xp); + return gy(c, jt(h, 3), Xp); } function BC(c, h) { return c == null ? c : Jp(c, jt(h, 3), li); } function UC(c, h) { - return c == null ? c : Fy(c, jt(h, 3), li); + return c == null ? c : By(c, jt(h, 3), li); } function jC(c, h) { return c && Is(c, jt(h, 3)); @@ -24157,21 +24158,21 @@ l0.exports; return O === r ? y : O; } function WC(c, h) { - return c != null && xw(c, h, pP); + return c != null && _w(c, h, pP); } function Tg(c, h) { - return c != null && xw(c, h, gP); + return c != null && _w(c, h, gP); } - var KC = dw(function(c, h, y) { + var KC = pw(function(c, h, y) { h != null && typeof h.toString != "function" && (h = _h.call(h)), c[h] = y; - }, Dg(hi)), VC = dw(function(c, h, y) { + }, Dg(hi)), VC = pw(function(c, h, y) { h != null && typeof h.toString != "function" && (h = _h.call(h)), Tr.call(c, h) ? c[h].push(y) : c[h] = [y]; }, jt), GC = hr(af); function Mn(c) { - return fi(c) ? Ry(c) : tg(c); + return fi(c) ? Dy(c) : tg(c); } function li(c) { - return fi(c) ? Ry(c, !0) : AP(c); + return fi(c) ? Dy(c, !0) : AP(c); } function YC(c, h) { var y = {}; @@ -24187,7 +24188,7 @@ l0.exports; } var XC = kc(function(c, h, y) { kh(c, h, y); - }), r2 = kc(function(c, h, y, O) { + }), n2 = kc(function(c, h, y, O) { kh(c, h, y, O); }), ZC = co(function(c, h) { var y = {}; @@ -24202,18 +24203,18 @@ l0.exports; return y; }); function QC(c, h) { - return n2(c, Xh(jt(h))); + return i2(c, Xh(jt(h))); } var eT = co(function(c, h) { return c == null ? {} : MP(c, h); }); - function n2(c, h) { + function i2(c, h) { if (c == null) return {}; var y = Xr(gg(c), function(O) { return [O]; }); - return h = jt(h), Gy(c, y, function(O, q) { + return h = jt(h), Yy(c, y, function(O, q) { return h(O, q[0]); }); } @@ -24232,7 +24233,7 @@ l0.exports; function nT(c, h, y, O) { return O = typeof O == "function" ? O : r, c == null ? c : uf(c, h, y, O); } - var i2 = mw(Mn), s2 = mw(li); + var s2 = vw(Mn), o2 = vw(li); function iT(c, h, y) { var O = nr(c), q = O || Xo(c) || Bc(c); if (h = jt(h, 4), y == null) { @@ -24247,10 +24248,10 @@ l0.exports; return c == null ? !0 : ag(c, h); } function oT(c, h, y) { - return c == null ? c : Qy(c, h, fg(y)); + return c == null ? c : ew(c, h, fg(y)); } function aT(c, h, y, O) { - return O = typeof O == "function" ? O : r, c == null ? c : Qy(c, h, fg(y), O); + return O = typeof O == "function" ? O : r, c == null ? c : ew(c, h, fg(y), O); } function Uc(c) { return c == null ? [] : qp(c, Mn(c)); @@ -24270,18 +24271,18 @@ l0.exports; c = h, h = O; } if (y || c % 1 || h % 1) { - var q = Cy(); + var q = Ty(); return Wn(c + q * (h - c + Ur("1e-" + ((q + "").length - 1))), h); } return ig(c, h); } var hT = $c(function(c, h, y) { - return h = h.toLowerCase(), c + (y ? o2(h) : h); + return h = h.toLowerCase(), c + (y ? a2(h) : h); }); - function o2(c) { + function a2(c) { return Rg(Cr(c).toLowerCase()); } - function a2(c) { + function c2(c) { return c = Cr(c), c && c.replace(et, rA).replace(Op, ""); } function dT(c, h, y) { @@ -24301,7 +24302,7 @@ l0.exports; return c + (y ? "-" : "") + h.toLowerCase(); }), vT = $c(function(c, h, y) { return c + (y ? " " : "") + h.toLowerCase(); - }), bT = fw("toLowerCase"); + }), bT = lw("toLowerCase"); function yT(c, h, y) { c = Cr(c), h = ar(h); var O = h ? Tc(c) : 0; @@ -24344,8 +24345,8 @@ l0.exports; } function CT(c, h, y) { var O = ee.templateSettings; - y && ri(c, h, y) && (h = r), c = Cr(c), h = ed({}, h, O, vw); - var q = ed({}, h.imports, O.imports, vw), ne = Mn(q), fe = qp(q, ne), ge, we, He = 0, We = h.interpolate || St, Xe = "__p += '", wt = Hp( + y && ri(c, h, y) && (h = r), c = Cr(c), h = ed({}, h, O, bw); + var q = ed({}, h.imports, O.imports, bw), ne = Mn(q), fe = qp(q, ne), ge, we, He = 0, We = h.interpolate || St, Xe = "__p += '", wt = Hp( (h.escape || St).source + "|" + We.source + "|" + (We === Nt ? xe : St).source + "|" + (h.evaluate || St).source + "|$", "g" ), Ot = "//# sourceURL=" + (Tr.call(h, "sourceURL") ? (h.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++Np + "]") + ` @@ -24375,7 +24376,7 @@ function print() { __p += __j.call(arguments, '') } ` : `; `) + Xe + `return __p }`; - var ur = u2(function() { + var ur = f2(function() { return Pr(ne, Ot + "return " + Xe).apply(r, fe); }); if (ur.source = Xe, Mg(ur)) @@ -24390,18 +24391,18 @@ function print() { __p += __j.call(arguments, '') } } function DT(c, h, y) { if (c = Cr(c), c && (y || h === r)) - return by(c); + return yy(c); if (!c || !(h = Pi(h))) return c; - var O = fs(c), q = fs(h), ne = yy(O, q), fe = wy(O, q) + 1; + var O = fs(c), q = fs(h), ne = wy(O, q), fe = xy(O, q) + 1; return Jo(O, ne, fe).join(""); } function OT(c, h, y) { if (c = Cr(c), c && (y || h === r)) - return c.slice(0, _y(c) + 1); + return c.slice(0, Ey(c) + 1); if (!c || !(h = Pi(h))) return c; - var O = fs(c), q = wy(O, fs(h)) + 1; + var O = fs(c), q = xy(O, fs(h)) + 1; return Jo(O, 0, q).join(""); } function NT(c, h, y) { @@ -24409,7 +24410,7 @@ function print() { __p += __j.call(arguments, '') } return c.replace(k, ""); if (!c || !(h = Pi(h))) return c; - var O = fs(c), q = yy(O, fs(h)); + var O = fs(c), q = wy(O, fs(h)); return Jo(O, q).join(""); } function LT(c, h) { @@ -24450,11 +24451,11 @@ function print() { __p += __j.call(arguments, '') } } var $T = $c(function(c, h, y) { return c + (y ? " " : "") + h.toUpperCase(); - }), Rg = fw("toUpperCase"); - function c2(c, h, y) { + }), Rg = lw("toUpperCase"); + function u2(c, h, y) { return c = Cr(c), h = y ? r : h, h === r ? oA(c) ? pA(c) : X9(c) : c.match(h) || []; } - var u2 = hr(function(c, h) { + var f2 = hr(function(c, h) { try { return Pn(c, r, h); } catch (y) { @@ -24490,18 +24491,18 @@ function print() { __p += __j.call(arguments, '') } function jT(c, h) { return c == null || c !== c ? h : c; } - var qT = hw(), zT = hw(!0); + var qT = dw(), zT = dw(!0); function hi(c) { return c; } function Og(c) { - return qy(typeof c == "function" ? c : zi(c, g)); + return zy(typeof c == "function" ? c : zi(c, g)); } function HT(c) { - return Hy(zi(c, g)); + return Wy(zi(c, g)); } function WT(c, h) { - return Wy(c, zi(h, g)); + return Ky(c, zi(h, g)); } var KT = hr(function(c, h) { return function(y) { @@ -24535,11 +24536,11 @@ function print() { __p += __j.call(arguments, '') } } function YT(c) { return c = ar(c), hr(function(h) { - return Ky(h, c); + return Vy(h, c); }); } - var JT = hg(Xr), XT = hg(dy), ZT = hg($p); - function f2(c) { + var JT = hg(Xr), XT = hg(py), ZT = hg($p); + function l2(c) { return yg(c) ? Fp(Ts(c)) : IP(c); } function QT(c) { @@ -24547,7 +24548,7 @@ function print() { __p += __j.call(arguments, '') } return c == null ? r : $a(c, h); }; } - var eR = pw(), tR = pw(!0); + var eR = gw(), tR = gw(!0); function kg() { return []; } @@ -24573,7 +24574,7 @@ function print() { __p += __j.call(arguments, '') } return q; } function oR(c) { - return nr(c) ? Xr(c, Ts) : Mi(c) ? [c] : ui(Tw(Cr(c))); + return nr(c) ? Xr(c, Ts) : Mi(c) ? [c] : ui(Rw(Cr(c))); } function aR(c) { var h = ++bA; @@ -24591,10 +24592,10 @@ function print() { __p += __j.call(arguments, '') } return c && c.length ? Nh(c, jt(h, 2), Zp) : r; } function pR(c) { - return my(c, hi); + return vy(c, hi); } function gR(c, h) { - return my(c, jt(h, 2)); + return vy(c, jt(h, 2)); } function mR(c) { return c && c.length ? Nh(c, hi, rg) : r; @@ -24613,7 +24614,7 @@ function print() { __p += __j.call(arguments, '') } function _R(c, h) { return c && c.length ? Up(c, jt(h, 2)) : 0; } - return ee.after = HI, ee.ary = jw, ee.assign = RC, ee.assignIn = t2, ee.assignInWith = ed, ee.assignWith = DC, ee.at = OC, ee.before = qw, ee.bind = Ag, ee.bindAll = FT, ee.bindKey = zw, ee.castArray = rC, ee.chain = Fw, ee.chunk = lM, ee.compact = hM, ee.concat = dM, ee.cond = BT, ee.conforms = UT, ee.constant = Dg, ee.countBy = xI, ee.create = NC, ee.curry = Hw, ee.curryRight = Ww, ee.debounce = Kw, ee.defaults = LC, ee.defaultsDeep = kC, ee.defer = WI, ee.delay = KI, ee.difference = pM, ee.differenceBy = gM, ee.differenceWith = mM, ee.drop = vM, ee.dropRight = bM, ee.dropRightWhile = yM, ee.dropWhile = wM, ee.fill = xM, ee.filter = EI, ee.flatMap = PI, ee.flatMapDeep = MI, ee.flatMapDepth = II, ee.flatten = Nw, ee.flattenDeep = _M, ee.flattenDepth = EM, ee.flip = VI, ee.flow = qT, ee.flowRight = zT, ee.fromPairs = SM, ee.functions = zC, ee.functionsIn = HC, ee.groupBy = CI, ee.initial = PM, ee.intersection = MM, ee.intersectionBy = IM, ee.intersectionWith = CM, ee.invert = KC, ee.invertBy = VC, ee.invokeMap = RI, ee.iteratee = Og, ee.keyBy = DI, ee.keys = Mn, ee.keysIn = li, ee.map = Gh, ee.mapKeys = YC, ee.mapValues = JC, ee.matches = HT, ee.matchesProperty = WT, ee.memoize = Jh, ee.merge = XC, ee.mergeWith = r2, ee.method = KT, ee.methodOf = VT, ee.mixin = Ng, ee.negate = Xh, ee.nthArg = YT, ee.omit = ZC, ee.omitBy = QC, ee.once = GI, ee.orderBy = OI, ee.over = JT, ee.overArgs = YI, ee.overEvery = XT, ee.overSome = ZT, ee.partial = Pg, ee.partialRight = Vw, ee.partition = NI, ee.pick = eT, ee.pickBy = n2, ee.property = f2, ee.propertyOf = QT, ee.pull = OM, ee.pullAll = kw, ee.pullAllBy = NM, ee.pullAllWith = LM, ee.pullAt = kM, ee.range = eR, ee.rangeRight = tR, ee.rearg = JI, ee.reject = $I, ee.remove = $M, ee.rest = XI, ee.reverse = Eg, ee.sampleSize = BI, ee.set = rT, ee.setWith = nT, ee.shuffle = UI, ee.slice = FM, ee.sortBy = zI, ee.sortedUniq = WM, ee.sortedUniqBy = KM, ee.split = PT, ee.spread = ZI, ee.tail = VM, ee.take = GM, ee.takeRight = YM, ee.takeRightWhile = JM, ee.takeWhile = XM, ee.tap = hI, ee.throttle = QI, ee.thru = Vh, ee.toArray = Zw, ee.toPairs = i2, ee.toPairsIn = s2, ee.toPath = oR, ee.toPlainObject = e2, ee.transform = iT, ee.unary = eC, ee.union = ZM, ee.unionBy = QM, ee.unionWith = eI, ee.uniq = tI, ee.uniqBy = rI, ee.uniqWith = nI, ee.unset = sT, ee.unzip = Sg, ee.unzipWith = $w, ee.update = oT, ee.updateWith = aT, ee.values = Uc, ee.valuesIn = cT, ee.without = iI, ee.words = c2, ee.wrap = tC, ee.xor = sI, ee.xorBy = oI, ee.xorWith = aI, ee.zip = cI, ee.zipObject = uI, ee.zipObjectDeep = fI, ee.zipWith = lI, ee.entries = i2, ee.entriesIn = s2, ee.extend = t2, ee.extendWith = ed, Ng(ee, ee), ee.add = cR, ee.attempt = u2, ee.camelCase = hT, ee.capitalize = o2, ee.ceil = uR, ee.clamp = uT, ee.clone = nC, ee.cloneDeep = sC, ee.cloneDeepWith = oC, ee.cloneWith = iC, ee.conformsTo = aC, ee.deburr = a2, ee.defaultTo = jT, ee.divide = fR, ee.endsWith = dT, ee.eq = hs, ee.escape = pT, ee.escapeRegExp = gT, ee.every = _I, ee.find = SI, ee.findIndex = Dw, ee.findKey = $C, ee.findLast = AI, ee.findLastIndex = Ow, ee.findLastKey = FC, ee.floor = lR, ee.forEach = Bw, ee.forEachRight = Uw, ee.forIn = BC, ee.forInRight = UC, ee.forOwn = jC, ee.forOwnRight = qC, ee.get = Cg, ee.gt = cC, ee.gte = uC, ee.has = WC, ee.hasIn = Tg, ee.head = Lw, ee.identity = hi, ee.includes = TI, ee.indexOf = AM, ee.inRange = fT, ee.invoke = GC, ee.isArguments = Ua, ee.isArray = nr, ee.isArrayBuffer = fC, ee.isArrayLike = fi, ee.isArrayLikeObject = cn, ee.isBoolean = lC, ee.isBuffer = Xo, ee.isDate = hC, ee.isElement = dC, ee.isEmpty = pC, ee.isEqual = gC, ee.isEqualWith = mC, ee.isError = Mg, ee.isFinite = vC, ee.isFunction = fo, ee.isInteger = Gw, ee.isLength = Zh, ee.isMap = Yw, ee.isMatch = bC, ee.isMatchWith = yC, ee.isNaN = wC, ee.isNative = xC, ee.isNil = EC, ee.isNull = _C, ee.isNumber = Jw, ee.isObject = Zr, ee.isObjectLike = en, ee.isPlainObject = df, ee.isRegExp = Ig, ee.isSafeInteger = SC, ee.isSet = Xw, ee.isString = Qh, ee.isSymbol = Mi, ee.isTypedArray = Bc, ee.isUndefined = AC, ee.isWeakMap = PC, ee.isWeakSet = MC, ee.join = TM, ee.kebabCase = mT, ee.last = Wi, ee.lastIndexOf = RM, ee.lowerCase = vT, ee.lowerFirst = bT, ee.lt = IC, ee.lte = CC, ee.max = hR, ee.maxBy = dR, ee.mean = pR, ee.meanBy = gR, ee.min = mR, ee.minBy = vR, ee.stubArray = kg, ee.stubFalse = $g, ee.stubObject = rR, ee.stubString = nR, ee.stubTrue = iR, ee.multiply = bR, ee.nth = DM, ee.noConflict = GT, ee.noop = Lg, ee.now = Yh, ee.pad = yT, ee.padEnd = wT, ee.padStart = xT, ee.parseInt = _T, ee.random = lT, ee.reduce = LI, ee.reduceRight = kI, ee.repeat = ET, ee.replace = ST, ee.result = tT, ee.round = yR, ee.runInContext = be, ee.sample = FI, ee.size = jI, ee.snakeCase = AT, ee.some = qI, ee.sortedIndex = BM, ee.sortedIndexBy = UM, ee.sortedIndexOf = jM, ee.sortedLastIndex = qM, ee.sortedLastIndexBy = zM, ee.sortedLastIndexOf = HM, ee.startCase = MT, ee.startsWith = IT, ee.subtract = wR, ee.sum = xR, ee.sumBy = _R, ee.template = CT, ee.times = sR, ee.toFinite = lo, ee.toInteger = ar, ee.toLength = Qw, ee.toLower = TT, ee.toNumber = Ki, ee.toSafeInteger = TC, ee.toString = Cr, ee.toUpper = RT, ee.trim = DT, ee.trimEnd = OT, ee.trimStart = NT, ee.truncate = LT, ee.unescape = kT, ee.uniqueId = aR, ee.upperCase = $T, ee.upperFirst = Rg, ee.each = Bw, ee.eachRight = Uw, ee.first = Lw, Ng(ee, function() { + return ee.after = HI, ee.ary = qw, ee.assign = RC, ee.assignIn = r2, ee.assignInWith = ed, ee.assignWith = DC, ee.at = OC, ee.before = zw, ee.bind = Ag, ee.bindAll = FT, ee.bindKey = Hw, ee.castArray = rC, ee.chain = Bw, ee.chunk = lM, ee.compact = hM, ee.concat = dM, ee.cond = BT, ee.conforms = UT, ee.constant = Dg, ee.countBy = xI, ee.create = NC, ee.curry = Ww, ee.curryRight = Kw, ee.debounce = Vw, ee.defaults = LC, ee.defaultsDeep = kC, ee.defer = WI, ee.delay = KI, ee.difference = pM, ee.differenceBy = gM, ee.differenceWith = mM, ee.drop = vM, ee.dropRight = bM, ee.dropRightWhile = yM, ee.dropWhile = wM, ee.fill = xM, ee.filter = EI, ee.flatMap = PI, ee.flatMapDeep = MI, ee.flatMapDepth = II, ee.flatten = Lw, ee.flattenDeep = _M, ee.flattenDepth = EM, ee.flip = VI, ee.flow = qT, ee.flowRight = zT, ee.fromPairs = SM, ee.functions = zC, ee.functionsIn = HC, ee.groupBy = CI, ee.initial = PM, ee.intersection = MM, ee.intersectionBy = IM, ee.intersectionWith = CM, ee.invert = KC, ee.invertBy = VC, ee.invokeMap = RI, ee.iteratee = Og, ee.keyBy = DI, ee.keys = Mn, ee.keysIn = li, ee.map = Gh, ee.mapKeys = YC, ee.mapValues = JC, ee.matches = HT, ee.matchesProperty = WT, ee.memoize = Jh, ee.merge = XC, ee.mergeWith = n2, ee.method = KT, ee.methodOf = VT, ee.mixin = Ng, ee.negate = Xh, ee.nthArg = YT, ee.omit = ZC, ee.omitBy = QC, ee.once = GI, ee.orderBy = OI, ee.over = JT, ee.overArgs = YI, ee.overEvery = XT, ee.overSome = ZT, ee.partial = Pg, ee.partialRight = Gw, ee.partition = NI, ee.pick = eT, ee.pickBy = i2, ee.property = l2, ee.propertyOf = QT, ee.pull = OM, ee.pullAll = $w, ee.pullAllBy = NM, ee.pullAllWith = LM, ee.pullAt = kM, ee.range = eR, ee.rangeRight = tR, ee.rearg = JI, ee.reject = $I, ee.remove = $M, ee.rest = XI, ee.reverse = Eg, ee.sampleSize = BI, ee.set = rT, ee.setWith = nT, ee.shuffle = UI, ee.slice = FM, ee.sortBy = zI, ee.sortedUniq = WM, ee.sortedUniqBy = KM, ee.split = PT, ee.spread = ZI, ee.tail = VM, ee.take = GM, ee.takeRight = YM, ee.takeRightWhile = JM, ee.takeWhile = XM, ee.tap = hI, ee.throttle = QI, ee.thru = Vh, ee.toArray = Qw, ee.toPairs = s2, ee.toPairsIn = o2, ee.toPath = oR, ee.toPlainObject = t2, ee.transform = iT, ee.unary = eC, ee.union = ZM, ee.unionBy = QM, ee.unionWith = eI, ee.uniq = tI, ee.uniqBy = rI, ee.uniqWith = nI, ee.unset = sT, ee.unzip = Sg, ee.unzipWith = Fw, ee.update = oT, ee.updateWith = aT, ee.values = Uc, ee.valuesIn = cT, ee.without = iI, ee.words = u2, ee.wrap = tC, ee.xor = sI, ee.xorBy = oI, ee.xorWith = aI, ee.zip = cI, ee.zipObject = uI, ee.zipObjectDeep = fI, ee.zipWith = lI, ee.entries = s2, ee.entriesIn = o2, ee.extend = r2, ee.extendWith = ed, Ng(ee, ee), ee.add = cR, ee.attempt = f2, ee.camelCase = hT, ee.capitalize = a2, ee.ceil = uR, ee.clamp = uT, ee.clone = nC, ee.cloneDeep = sC, ee.cloneDeepWith = oC, ee.cloneWith = iC, ee.conformsTo = aC, ee.deburr = c2, ee.defaultTo = jT, ee.divide = fR, ee.endsWith = dT, ee.eq = hs, ee.escape = pT, ee.escapeRegExp = gT, ee.every = _I, ee.find = SI, ee.findIndex = Ow, ee.findKey = $C, ee.findLast = AI, ee.findLastIndex = Nw, ee.findLastKey = FC, ee.floor = lR, ee.forEach = Uw, ee.forEachRight = jw, ee.forIn = BC, ee.forInRight = UC, ee.forOwn = jC, ee.forOwnRight = qC, ee.get = Cg, ee.gt = cC, ee.gte = uC, ee.has = WC, ee.hasIn = Tg, ee.head = kw, ee.identity = hi, ee.includes = TI, ee.indexOf = AM, ee.inRange = fT, ee.invoke = GC, ee.isArguments = Ua, ee.isArray = nr, ee.isArrayBuffer = fC, ee.isArrayLike = fi, ee.isArrayLikeObject = cn, ee.isBoolean = lC, ee.isBuffer = Xo, ee.isDate = hC, ee.isElement = dC, ee.isEmpty = pC, ee.isEqual = gC, ee.isEqualWith = mC, ee.isError = Mg, ee.isFinite = vC, ee.isFunction = fo, ee.isInteger = Yw, ee.isLength = Zh, ee.isMap = Jw, ee.isMatch = bC, ee.isMatchWith = yC, ee.isNaN = wC, ee.isNative = xC, ee.isNil = EC, ee.isNull = _C, ee.isNumber = Xw, ee.isObject = Zr, ee.isObjectLike = en, ee.isPlainObject = df, ee.isRegExp = Ig, ee.isSafeInteger = SC, ee.isSet = Zw, ee.isString = Qh, ee.isSymbol = Mi, ee.isTypedArray = Bc, ee.isUndefined = AC, ee.isWeakMap = PC, ee.isWeakSet = MC, ee.join = TM, ee.kebabCase = mT, ee.last = Wi, ee.lastIndexOf = RM, ee.lowerCase = vT, ee.lowerFirst = bT, ee.lt = IC, ee.lte = CC, ee.max = hR, ee.maxBy = dR, ee.mean = pR, ee.meanBy = gR, ee.min = mR, ee.minBy = vR, ee.stubArray = kg, ee.stubFalse = $g, ee.stubObject = rR, ee.stubString = nR, ee.stubTrue = iR, ee.multiply = bR, ee.nth = DM, ee.noConflict = GT, ee.noop = Lg, ee.now = Yh, ee.pad = yT, ee.padEnd = wT, ee.padStart = xT, ee.parseInt = _T, ee.random = lT, ee.reduce = LI, ee.reduceRight = kI, ee.repeat = ET, ee.replace = ST, ee.result = tT, ee.round = yR, ee.runInContext = be, ee.sample = FI, ee.size = jI, ee.snakeCase = AT, ee.some = qI, ee.sortedIndex = BM, ee.sortedIndexBy = UM, ee.sortedIndexOf = jM, ee.sortedLastIndex = qM, ee.sortedLastIndexBy = zM, ee.sortedLastIndexOf = HM, ee.startCase = MT, ee.startsWith = IT, ee.subtract = wR, ee.sum = xR, ee.sumBy = _R, ee.template = CT, ee.times = sR, ee.toFinite = lo, ee.toInteger = ar, ee.toLength = e2, ee.toLower = TT, ee.toNumber = Ki, ee.toSafeInteger = TC, ee.toString = Cr, ee.toUpper = RT, ee.trim = DT, ee.trimEnd = OT, ee.trimStart = NT, ee.truncate = LT, ee.unescape = kT, ee.uniqueId = aR, ee.upperCase = $T, ee.upperFirst = Rg, ee.each = Uw, ee.eachRight = jw, ee.first = kw, Ng(ee, function() { var c = {}; return Is(ee, function(h, y) { Tr.call(ee.prototype, y) || (c[y] = h); @@ -24704,7 +24705,7 @@ function print() { __p += __j.call(arguments, '') } var O = y.name + ""; Tr.call(Nc, O) || (Nc[O] = []), Nc[O].push({ name: h, func: y }); } - }), Nc[Uh(r, F).name] = [{ + }), Nc[Uh(r, $).name] = [{ name: "wrapper", func: r }], wr.prototype.clone = kA, wr.prototype.reverse = $A, wr.prototype.value = FA, ee.prototype.at = dI, ee.prototype.chain = pI, ee.prototype.commit = gI, ee.prototype.next = mI, ee.prototype.plant = bI, ee.prototype.reverse = yI, ee.prototype.toJSON = ee.prototype.valueOf = ee.prototype.value = wI, ee.prototype.first = ee.prototype.head, Qu && (ee.prototype[Qu] = vI), ee; @@ -24825,11 +24826,11 @@ var jV = l0.exports, O1 = { exports: {} }; }; }); } - function F(f) { + function $(f) { var p = new FileReader(), b = L(p); return p.readAsArrayBuffer(f), b; } - function $(f) { + function F(f) { var p = new FileReader(), b = L(p); return p.readAsText(f), b; } @@ -24859,13 +24860,13 @@ var jV = l0.exports, O1 = { exports: {} }; throw new Error("could not read FormData body as blob"); return Promise.resolve(new Blob([this._bodyText])); }, this.arrayBuffer = function() { - return this._bodyArrayBuffer ? N(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(F); + return this._bodyArrayBuffer ? N(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then($); }), this.text = function() { var f = N(this); if (f) return f; if (this._bodyBlob) - return $(this._bodyBlob); + return F(this._bodyBlob); if (this._bodyArrayBuffer) return Promise.resolve(K(this._bodyArrayBuffer)); if (this._bodyFormData) @@ -24985,16 +24986,16 @@ var jV = l0.exports, O1 = { exports: {} }; e = i.fetch, e.default = i.fetch, e.fetch = i.fetch, e.Headers = i.Headers, e.Request = i.Request, e.Response = i.Response, t.exports = e; })(O1, O1.exports); var qV = O1.exports; -const L3 = /* @__PURE__ */ ts(qV); -var zV = Object.defineProperty, HV = Object.defineProperties, WV = Object.getOwnPropertyDescriptors, k3 = Object.getOwnPropertySymbols, KV = Object.prototype.hasOwnProperty, VV = Object.prototype.propertyIsEnumerable, $3 = (t, e, r) => e in t ? zV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, F3 = (t, e) => { - for (var r in e || (e = {})) KV.call(e, r) && $3(t, r, e[r]); - if (k3) for (var r of k3(e)) VV.call(e, r) && $3(t, r, e[r]); +const k3 = /* @__PURE__ */ ts(qV); +var zV = Object.defineProperty, HV = Object.defineProperties, WV = Object.getOwnPropertyDescriptors, $3 = Object.getOwnPropertySymbols, KV = Object.prototype.hasOwnProperty, VV = Object.prototype.propertyIsEnumerable, F3 = (t, e, r) => e in t ? zV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, B3 = (t, e) => { + for (var r in e || (e = {})) KV.call(e, r) && F3(t, r, e[r]); + if ($3) for (var r of $3(e)) VV.call(e, r) && F3(t, r, e[r]); return t; -}, B3 = (t, e) => HV(t, WV(e)); -const GV = { Accept: "application/json", "Content-Type": "application/json" }, YV = "POST", U3 = { headers: GV, method: YV }, j3 = 10; +}, U3 = (t, e) => HV(t, WV(e)); +const GV = { Accept: "application/json", "Content-Type": "application/json" }, YV = "POST", j3 = { headers: GV, method: YV }, q3 = 10; let Ss = class { constructor(e, r = !1) { - if (this.url = e, this.disableProviderPing = r, this.events = new rs.EventEmitter(), this.isAvailable = !1, this.registering = !1, !a3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); + if (this.url = e, this.disableProviderPing = r, this.events = new rs.EventEmitter(), this.isAvailable = !1, this.registering = !1, !c3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); this.url = e, this.disableProviderPing = r; } get connected() { @@ -25025,14 +25026,14 @@ let Ss = class { async send(e) { this.isAvailable || await this.register(); try { - const r = ko(e), n = await (await L3(this.url, B3(F3({}, U3), { body: r }))).json(); + const r = ko(e), n = await (await k3(this.url, U3(B3({}, j3), { body: r }))).json(); this.onPayload({ data: n }); } catch (r) { this.onError(e.id, r); } } async register(e = this.url) { - if (!a3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); + if (!c3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); if (this.registering) { const r = this.events.getMaxListeners(); return (this.events.listenerCount("register_error") >= r || this.events.listenerCount("open") >= r) && this.events.setMaxListeners(r + 1), new Promise((n, i) => { @@ -25048,7 +25049,7 @@ let Ss = class { try { if (!this.disableProviderPing) { const r = ko({ id: 1, jsonrpc: "2.0", method: "test", params: [] }); - await L3(e, B3(F3({}, U3), { body: r })); + await k3(e, U3(B3({}, j3), { body: r })); } this.onOpen(); } catch (r) { @@ -25075,13 +25076,13 @@ let Ss = class { return J8(e, r, "HTTP"); } resetMaxListeners() { - this.events.getMaxListeners() > j3 && this.events.setMaxListeners(j3); + this.events.getMaxListeners() > q3 && this.events.setMaxListeners(q3); } }; -const q3 = "error", JV = "wss://relay.walletconnect.org", XV = "wc", ZV = "universal_provider", z3 = `${XV}@2:${ZV}:`, wE = "https://rpc.walletconnect.org/v1/", Jc = "generic", QV = `${wE}bundler`, cs = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; -var eG = Object.defineProperty, tG = Object.defineProperties, rG = Object.getOwnPropertyDescriptors, H3 = Object.getOwnPropertySymbols, nG = Object.prototype.hasOwnProperty, iG = Object.prototype.propertyIsEnumerable, W3 = (t, e, r) => e in t ? eG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, fd = (t, e) => { - for (var r in e || (e = {})) nG.call(e, r) && W3(t, r, e[r]); - if (H3) for (var r of H3(e)) iG.call(e, r) && W3(t, r, e[r]); +const z3 = "error", JV = "wss://relay.walletconnect.org", XV = "wc", ZV = "universal_provider", H3 = `${XV}@2:${ZV}:`, wE = "https://rpc.walletconnect.org/v1/", Jc = "generic", QV = `${wE}bundler`, cs = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; +var eG = Object.defineProperty, tG = Object.defineProperties, rG = Object.getOwnPropertyDescriptors, W3 = Object.getOwnPropertySymbols, nG = Object.prototype.hasOwnProperty, iG = Object.prototype.propertyIsEnumerable, K3 = (t, e, r) => e in t ? eG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, fd = (t, e) => { + for (var r in e || (e = {})) nG.call(e, r) && K3(t, r, e[r]); + if (W3) for (var r of W3(e)) iG.call(e, r) && K3(t, r, e[r]); return t; }, sG = (t, e) => tG(t, rG(e)); function Ni(t, e, r) { @@ -25105,15 +25106,15 @@ function oG(t, e) { }), n; } function bm(t = {}, e = {}) { - const r = K3(t), n = K3(e); + const r = V3(t), n = V3(e); return jV.merge(r, n); } -function K3(t) { +function V3(t) { var e, r, n, i; const s = {}; if (!El(t)) return s; for (const [o, a] of Object.entries(t)) { - const u = ob(o) ? [o] : a.chains, l = a.methods || [], d = a.events || [], g = a.rpcMap || {}, w = Ff(o); + const u = ab(o) ? [o] : a.chains, l = a.methods || [], d = a.events || [], g = a.rpcMap || {}, w = Ff(o); s[w] = sG(fd(fd({}, s[w]), a), { chains: Md(u, (e = s[w]) == null ? void 0 : e.chains), methods: Md(l, (r = s[w]) == null ? void 0 : r.methods), events: Md(d, (n = s[w]) == null ? void 0 : n.events), rpcMap: fd(fd({}, g), (i = s[w]) == null ? void 0 : i.rpcMap) }); } return s; @@ -25121,10 +25122,10 @@ function K3(t) { function aG(t) { return t.includes(":") ? t.split(":")[2] : t; } -function V3(t) { +function G3(t) { const e = {}; for (const [r, n] of Object.entries(t)) { - const i = n.methods || [], s = n.events || [], o = n.accounts || [], a = ob(r) ? [r] : n.chains ? n.chains : xE(n.accounts); + const i = n.methods || [], s = n.events || [], o = n.accounts || [], a = ab(r) ? [r] : n.chains ? n.chains : xE(n.accounts); e[r] = { chains: a, methods: i, events: s, accounts: o }; } return e; @@ -25185,11 +25186,11 @@ class cG { return new as(new Ss(n, Ar("disableProviderPing"))); } } -var uG = Object.defineProperty, fG = Object.defineProperties, lG = Object.getOwnPropertyDescriptors, G3 = Object.getOwnPropertySymbols, hG = Object.prototype.hasOwnProperty, dG = Object.prototype.propertyIsEnumerable, Y3 = (t, e, r) => e in t ? uG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, J3 = (t, e) => { - for (var r in e || (e = {})) hG.call(e, r) && Y3(t, r, e[r]); - if (G3) for (var r of G3(e)) dG.call(e, r) && Y3(t, r, e[r]); +var uG = Object.defineProperty, fG = Object.defineProperties, lG = Object.getOwnPropertyDescriptors, Y3 = Object.getOwnPropertySymbols, hG = Object.prototype.hasOwnProperty, dG = Object.prototype.propertyIsEnumerable, J3 = (t, e, r) => e in t ? uG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, X3 = (t, e) => { + for (var r in e || (e = {})) hG.call(e, r) && J3(t, r, e[r]); + if (Y3) for (var r of Y3(e)) dG.call(e, r) && J3(t, r, e[r]); return t; -}, X3 = (t, e) => fG(t, lG(e)); +}, Z3 = (t, e) => fG(t, lG(e)); class pG { constructor(e) { this.name = "eip155", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.httpProviders = this.createHttpProviders(), this.chainId = parseInt(this.getDefaultChain()); @@ -25274,7 +25275,7 @@ class pG { if (a != null && a[s]) return a == null ? void 0 : a[s]; const u = await this.client.request(e); try { - await this.client.session.update(e.topic, { sessionProperties: X3(J3({}, o.sessionProperties || {}), { capabilities: X3(J3({}, a || {}), { [s]: u }) }) }); + await this.client.session.update(e.topic, { sessionProperties: Z3(X3({}, o.sessionProperties || {}), { capabilities: Z3(X3({}, a || {}), { [s]: u }) }) }); } catch (l) { console.warn("Failed to update session with capabilities", l); } @@ -25768,14 +25769,14 @@ class EG { return new as(new Ss(n, Ar("disableProviderPing"))); } } -var SG = Object.defineProperty, AG = Object.defineProperties, PG = Object.getOwnPropertyDescriptors, Z3 = Object.getOwnPropertySymbols, MG = Object.prototype.hasOwnProperty, IG = Object.prototype.propertyIsEnumerable, Q3 = (t, e, r) => e in t ? SG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ld = (t, e) => { - for (var r in e || (e = {})) MG.call(e, r) && Q3(t, r, e[r]); - if (Z3) for (var r of Z3(e)) IG.call(e, r) && Q3(t, r, e[r]); +var SG = Object.defineProperty, AG = Object.defineProperties, PG = Object.getOwnPropertyDescriptors, Q3 = Object.getOwnPropertySymbols, MG = Object.prototype.hasOwnProperty, IG = Object.prototype.propertyIsEnumerable, e_ = (t, e, r) => e in t ? SG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ld = (t, e) => { + for (var r in e || (e = {})) MG.call(e, r) && e_(t, r, e[r]); + if (Q3) for (var r of Q3(e)) IG.call(e, r) && e_(t, r, e[r]); return t; }, xm = (t, e) => AG(t, PG(e)); let EE = class SE { constructor(e) { - this.events = new Lv(), this.rpcProviders = {}, this.shouldAbortPairingAttempt = !1, this.maxPairingAttempts = 10, this.disableProviderPing = !1, this.providerOpts = e, this.logger = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : jl(k0({ level: (e == null ? void 0 : e.logger) || q3 })), this.disableProviderPing = (e == null ? void 0 : e.disableProviderPing) || !1; + this.events = new kv(), this.rpcProviders = {}, this.shouldAbortPairingAttempt = !1, this.maxPairingAttempts = 10, this.disableProviderPing = !1, this.providerOpts = e, this.logger = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : jl(k0({ level: (e == null ? void 0 : e.logger) || z3 })), this.disableProviderPing = (e == null ? void 0 : e.disableProviderPing) || !1; } static async init(e) { const r = new SE(e); @@ -25810,7 +25811,7 @@ let EE = class SE { n && (this.uri = n, this.events.emit("display_uri", n)); const s = await i(); if (this.session = s.session, this.session) { - const o = V3(this.session.namespaces); + const o = G3(this.session.namespaces); this.namespaces = bm(this.namespaces, o), this.persist("namespaces", this.namespaces), this.onConnect(); } return s; @@ -25839,7 +25840,7 @@ let EE = class SE { const { uri: n, approval: i } = await this.client.connect({ pairingTopic: e, requiredNamespaces: this.namespaces, optionalNamespaces: this.optionalNamespaces, sessionProperties: this.sessionProperties }); n && (this.uri = n, this.events.emit("display_uri", n)), await i().then((s) => { this.session = s; - const o = V3(s.namespaces); + const o = G3(s.namespaces); this.namespaces = bm(this.namespaces, o), this.persist("namespaces", this.namespaces); }).catch((s) => { if (s.message !== yE) throw s; @@ -25878,7 +25879,7 @@ let EE = class SE { this.logger.trace("Initialized"), await this.createClient(), await this.checkStorage(), this.registerEventListeners(); } async createClient() { - this.client = this.providerOpts.client || await hb.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || q3, relayUrl: this.providerOpts.relayUrl || JV, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); + this.client = this.providerOpts.client || await db.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || z3, relayUrl: this.providerOpts.relayUrl || JV, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); } createProviders() { if (!this.client) throw new Error("Sign Client not initialized"); @@ -25984,10 +25985,10 @@ let EE = class SE { this.session = void 0, this.namespaces = void 0, this.optionalNamespaces = void 0, this.sessionProperties = void 0, this.persist("namespaces", void 0), this.persist("optionalNamespaces", void 0), this.persist("sessionProperties", void 0), await this.cleanupPendingPairings({ deletePairings: !0 }); } persist(e, r) { - this.client.core.storage.setItem(`${z3}/${e}`, r); + this.client.core.storage.setItem(`${H3}/${e}`, r); } async getFromStore(e) { - return await this.client.core.storage.getItem(`${z3}/${e}`); + return await this.client.core.storage.getItem(`${H3}/${e}`); } }; const CG = EE; @@ -26128,7 +26129,7 @@ const fn = { message: "Unrecognized chain ID." } }, AE = "Unspecified error message.", RG = "Unspecified server error."; -function db(t, e = AE) { +function pb(t, e = AE) { if (t && Number.isInteger(t)) { const r = t.toString(); if (L1(N1, r)) @@ -26148,21 +26149,21 @@ function OG(t, { shouldIncludeStack: e = !1 } = {}) { const r = {}; if (t && typeof t == "object" && !Array.isArray(t) && L1(t, "code") && DG(t.code)) { const n = t; - r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, L1(n, "data") && (r.data = n.data)) : (r.message = db(r.code), r.data = { originalError: e_(t) }); + r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, L1(n, "data") && (r.data = n.data)) : (r.message = pb(r.code), r.data = { originalError: t_(t) }); } else - r.code = fn.rpc.internal, r.message = t_(t, "message") ? t.message : AE, r.data = { originalError: e_(t) }; - return e && (r.stack = t_(t, "stack") ? t.stack : void 0), r; + r.code = fn.rpc.internal, r.message = r_(t, "message") ? t.message : AE, r.data = { originalError: t_(t) }; + return e && (r.stack = r_(t, "stack") ? t.stack : void 0), r; } function PE(t) { return t >= -32099 && t <= -32e3; } -function e_(t) { +function t_(t) { return t && typeof t == "object" && !Array.isArray(t) ? Object.assign({}, t) : t; } function L1(t, e) { return Object.prototype.hasOwnProperty.call(t, e); } -function t_(t, e) { +function r_(t, e) { return typeof t == "object" && t !== null && e in t && typeof t[e] == "string"; } const Sr = { @@ -26206,11 +26207,11 @@ const Sr = { }; function Gi(t, e) { const [r, n] = ME(e); - return new IE(t, r || db(t), n); + return new IE(t, r || pb(t), n); } function Kc(t, e) { const [r, n] = ME(e); - return new CE(t, r || db(t), n); + return new CE(t, r || pb(t), n); } function ME(t) { if (t) { @@ -26248,18 +26249,18 @@ class CE extends IE { function NG(t) { return Number.isInteger(t) && t >= 1e3 && t <= 4999; } -function pb() { +function gb() { return (t) => t; } -const Sl = pb(), LG = pb(), kG = pb(); +const Sl = gb(), LG = gb(), kG = gb(); function xo(t) { return Math.floor(t); } const TE = /^[0-9]*$/, RE = /^[a-f0-9]*$/; function Za(t) { - return gb(crypto.getRandomValues(new Uint8Array(t))); + return mb(crypto.getRandomValues(new Uint8Array(t))); } -function gb(t) { +function mb(t) { return [...t].map((e) => e.toString(16).padStart(2, "0")).join(""); } function Rd(t) { @@ -26281,7 +26282,7 @@ function da(t) { function DE(t) { return t.startsWith("0x") || t.startsWith("0X"); } -function mb(t) { +function vb(t) { return DE(t) ? t.slice(2) : t; } function OE(t) { @@ -26290,24 +26291,24 @@ function OE(t) { function op(t) { if (typeof t != "string") return !1; - const e = mb(t).toLowerCase(); + const e = vb(t).toLowerCase(); return RE.test(e); } function $G(t, e = !1) { if (typeof t == "string") { - const r = mb(t).toLowerCase(); + const r = vb(t).toLowerCase(); if (RE.test(r)) return Sl(e ? `0x${r}` : r); } throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`); } -function vb(t, e = !1) { +function bb(t, e = !1) { let r = $G(t, !1); return r.length % 2 === 1 && (r = Sl(`0${r}`)), e ? Sl(`0x${r}`) : r; } function ta(t) { if (typeof t == "string") { - const e = mb(t).toLowerCase(); + const e = vb(t).toLowerCase(); if (op(e) && e.length === 40) return LG(OE(e)); } @@ -26318,7 +26319,7 @@ function k1(t) { return t; if (typeof t == "string") { if (op(t)) { - const e = vb(t, !1); + const e = bb(t, !1); return Buffer.from(e, "hex"); } return Buffer.from(t, "utf8"); @@ -26332,7 +26333,7 @@ function Wf(t) { if (TE.test(t)) return xo(Number(t)); if (op(t)) - return xo(Number(BigInt(vb(t, !0)))); + return xo(Number(BigInt(bb(t, !0)))); } throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`); } @@ -26345,7 +26346,7 @@ function Tf(t) { if (TE.test(t)) return BigInt(t); if (op(t)) - return BigInt(vb(t, !0)); + return BigInt(bb(t, !0)); } throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`); } @@ -26401,7 +26402,7 @@ function NE(t) { } async function LE(t, e) { const r = NE(t), n = await crypto.subtle.exportKey(r, e); - return gb(new Uint8Array(n)); + return mb(new Uint8Array(n)); } async function kE(t, e) { const r = NE(t), n = Rd(e).buffer; @@ -26535,11 +26536,11 @@ function JG(t) { throw Sr.provider.unsupportedMethod(); } } -const r_ = "accounts", n_ = "activeChain", i_ = "availableChains", s_ = "walletCapabilities"; +const n_ = "accounts", i_ = "activeChain", s_ = "availableChains", o_ = "walletCapabilities"; class XG { constructor(e) { var r, n, i; - this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new KG(), this.storage = new Qs("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(r_)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(n_) || { + this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new KG(), this.storage = new Qs("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(n_)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(i_) || { id: (i = (n = e.metadata.appChainIds) === null || n === void 0 ? void 0 : n[0]) !== null && i !== void 0 ? i : 1 }, this.handshake = this.handshake.bind(this), this.request = this.request.bind(this), this.createRequestMessage = this.createRequestMessage.bind(this), this.decryptResponseMessage = this.decryptResponseMessage.bind(this); } @@ -26559,7 +26560,7 @@ class XG { if ("error" in u) throw u.error; const l = u.value; - this.accounts = l, this.storage.storeObject(r_, l), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", l); + this.accounts = l, this.storage.storeObject(n_, l), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", l); } async request(e) { var r; @@ -26577,7 +26578,7 @@ class XG { case "eth_chainId": return da(this.chain.id); case "wallet_getCapabilities": - return this.storage.loadObject(s_); + return this.storage.loadObject(o_); case "wallet_switchEthereumChain": return this.handleSwitchChainRequest(e); case "eth_ecRecover": @@ -26663,15 +26664,15 @@ class XG { id: Number(d), rpcUrl: g })); - this.storage.storeObject(i_, l), this.updateChain(this.chain.id, l); + this.storage.storeObject(s_, l), this.updateChain(this.chain.id, l); } const u = (n = o.data) === null || n === void 0 ? void 0 : n.capabilities; - return u && this.storage.storeObject(s_, u), o; + return u && this.storage.storeObject(o_, u), o; } updateChain(e, r) { var n; - const i = r ?? this.storage.loadObject(i_), s = i == null ? void 0 : i.find((o) => o.id === e); - return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(n_, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", da(s.id))), !0) : !1; + const i = r ?? this.storage.loadObject(s_), s = i == null ? void 0 : i.find((o) => o.id === e); + return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(i_, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", da(s.id))), !0) : !1; } } const ZG = /* @__PURE__ */ bv(TD), { keccak_256: QG } = ZG; @@ -26761,7 +26762,7 @@ function WE(t) { function du(t) { return Number.parseInt(/^\D+(\d+)$/.exec(t)[1], 10); } -function o_(t) { +function a_(t) { var e = /^\D+(\d+)x(\d+)$/.exec(t); return [Number.parseInt(e[1], 10), Number.parseInt(e[2], 10)]; } @@ -26825,11 +26826,11 @@ function js(t, e) { const u = ii.twosFromBigInt(n, 256); return ii.bufferBEFromBigInt(u, 32); } else if (t.startsWith("ufixed")) { - if (r = o_(t), n = Qa(e), n < 0) + if (r = a_(t), n = Qa(e), n < 0) throw new Error("Supplied ufixed is negative"); return js("uint256", n * BigInt(2) ** BigInt(r[1])); } else if (t.startsWith("fixed")) - return r = o_(t), js("int256", Qa(e) * BigInt(2) ** BigInt(r[1])); + return r = a_(t), js("int256", Qa(e) * BigInt(2) ** BigInt(r[1])); } throw new Error("Unsupported or invalid type: " + t); } @@ -27102,7 +27103,7 @@ class gY { name: "AES-GCM", iv: n }, i, s.encode(e)), a = 16, u = o.slice(o.byteLength - a), l = o.slice(0, o.byteLength - a), d = new Uint8Array(u), g = new Uint8Array(l), w = new Uint8Array([...n, ...d, ...g]); - return gb(w); + return mb(w); } /** * @@ -27254,7 +27255,7 @@ class vY { e && (this.webSocket = null, e.onclose = null, e.onerror = null, e.onmessage = null, e.onopen = null); } } -const a_ = 1e4, bY = 6e4; +const c_ = 1e4, bY = 6e4; class yY { /** * Constructor @@ -27318,7 +27319,7 @@ class yY { case Ao.CONNECTED: o = await this.handleConnected(), this.updateLastHeartbeat(), setInterval(() => { this.heartbeat(); - }, a_), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); + }, c_), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); break; case Ao.CONNECTING: break; @@ -27444,7 +27445,7 @@ class yY { this.lastHeartbeatResponse = Date.now(); } heartbeat() { - if (Date.now() - this.lastHeartbeatResponse > a_ * 2) { + if (Date.now() - this.lastHeartbeatResponse > c_ * 2) { this.ws.disconnect(); return; } @@ -27497,7 +27498,7 @@ class wY { return this.callbacks.get(r) && this.callbacks.delete(r), e; } } -const c_ = "session:id", u_ = "session:secret", f_ = "session:linked"; +const u_ = "session:id", f_ = "session:secret", l_ = "session:linked"; class pu { constructor(e, r, n, i = !1) { this.storage = e, this.id = r, this.secret = n, this.key = lD(r4(`${r}, ${n} WalletLink`)), this._linked = !!i; @@ -27507,7 +27508,7 @@ class pu { return new pu(e, r, n).save(); } static load(e) { - const r = e.getItem(c_), n = e.getItem(f_), i = e.getItem(u_); + const r = e.getItem(u_), n = e.getItem(l_), i = e.getItem(f_); return r && i ? new pu(e, r, i, n === "1") : null; } get linked() { @@ -27517,10 +27518,10 @@ class pu { this._linked = e, this.persistLinked(); } save() { - return this.storage.setItem(c_, this.id), this.storage.setItem(u_, this.secret), this.persistLinked(), this; + return this.storage.setItem(u_, this.id), this.storage.setItem(f_, this.secret), this.persistLinked(), this; } persistLinked() { - this.storage.setItem(f_, this._linked ? "1" : "0"); + this.storage.setItem(l_, this._linked ? "1" : "0"); } } function xY() { @@ -27561,12 +27562,12 @@ function Vf() { for (var t, e, r = 0, n = ""; r < arguments.length; ) (t = arguments[r++]) && (e = XE(t)) && (n && (n += " "), n += e); return n; } -var cp, Jr, ZE, ec, l_, QE, F1, eS, bb, B1, U1, Al = {}, tS = [], AY = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, yb = Array.isArray; +var cp, Jr, ZE, ec, h_, QE, F1, eS, yb, B1, U1, Al = {}, tS = [], AY = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, wb = Array.isArray; function pa(t, e) { for (var r in e) t[r] = e[r]; return t; } -function wb(t) { +function xb(t) { t && t.parentNode && t.parentNode.removeChild(t); } function Nr(t, e, r) { @@ -27600,22 +27601,22 @@ function rS(t) { return rS(t); } } -function h_(t) { - (!t.__d && (t.__d = !0) && ec.push(t) && !h0.__r++ || l_ !== Jr.debounceRendering) && ((l_ = Jr.debounceRendering) || QE)(h0); +function d_(t) { + (!t.__d && (t.__d = !0) && ec.push(t) && !h0.__r++ || h_ !== Jr.debounceRendering) && ((h_ = Jr.debounceRendering) || QE)(h0); } function h0() { var t, e, r, n, i, s, o, a; - for (ec.sort(F1); t = ec.shift(); ) t.__d && (e = ec.length, n = void 0, s = (i = (r = t).__v).__e, o = [], a = [], r.__P && ((n = pa({}, i)).__v = i.__v + 1, Jr.vnode && Jr.vnode(n), xb(r.__P, n, i, r.__n, r.__P.namespaceURI, 32 & i.__u ? [s] : null, o, s ?? Au(i), !!(32 & i.__u), a), n.__v = i.__v, n.__.__k[n.__i] = n, sS(o, n, a), n.__e != s && rS(n)), ec.length > e && ec.sort(F1)); + for (ec.sort(F1); t = ec.shift(); ) t.__d && (e = ec.length, n = void 0, s = (i = (r = t).__v).__e, o = [], a = [], r.__P && ((n = pa({}, i)).__v = i.__v + 1, Jr.vnode && Jr.vnode(n), _b(r.__P, n, i, r.__n, r.__P.namespaceURI, 32 & i.__u ? [s] : null, o, s ?? Au(i), !!(32 & i.__u), a), n.__v = i.__v, n.__.__k[n.__i] = n, sS(o, n, a), n.__e != s && rS(n)), ec.length > e && ec.sort(F1)); h0.__r = 0; } function nS(t, e, r, n, i, s, o, a, u, l, d) { - var g, w, A, M, N, L, F = n && n.__k || tS, $ = e.length; - for (u = PY(r, e, F, u), g = 0; g < $; g++) (A = r.__k[g]) != null && (w = A.__i === -1 ? Al : F[A.__i] || Al, A.__i = g, L = xb(t, A, w, i, s, o, a, u, l, d), M = A.__e, A.ref && w.ref != A.ref && (w.ref && _b(w.ref, null, A), d.push(A.ref, A.__c || M, A)), N == null && M != null && (N = M), 4 & A.__u || w.__k === A.__k ? u = iS(A, u, t) : typeof A.type == "function" && L !== void 0 ? u = L : M && (u = M.nextSibling), A.__u &= -7); + var g, w, A, M, N, L, $ = n && n.__k || tS, F = e.length; + for (u = PY(r, e, $, u), g = 0; g < F; g++) (A = r.__k[g]) != null && (w = A.__i === -1 ? Al : $[A.__i] || Al, A.__i = g, L = _b(t, A, w, i, s, o, a, u, l, d), M = A.__e, A.ref && w.ref != A.ref && (w.ref && Eb(w.ref, null, A), d.push(A.ref, A.__c || M, A)), N == null && M != null && (N = M), 4 & A.__u || w.__k === A.__k ? u = iS(A, u, t) : typeof A.type == "function" && L !== void 0 ? u = L : M && (u = M.nextSibling), A.__u &= -7); return r.__e = N, u; } function PY(t, e, r, n) { var i, s, o, a, u, l = e.length, d = r.length, g = d, w = 0; - for (t.__k = [], i = 0; i < l; i++) (s = e[i]) != null && typeof s != "boolean" && typeof s != "function" ? (a = i + w, (s = t.__k[i] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Dd(null, s, null, null, null) : yb(s) ? Dd(nh, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? Dd(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, o = null, (u = s.__i = MY(s, r, a, g)) !== -1 && (g--, (o = r[u]) && (o.__u |= 2)), o == null || o.__v === null ? (u == -1 && w--, typeof s.type != "function" && (s.__u |= 4)) : u !== a && (u == a - 1 ? w-- : u == a + 1 ? w++ : (u > a ? w-- : w++, s.__u |= 4))) : s = t.__k[i] = null; + for (t.__k = [], i = 0; i < l; i++) (s = e[i]) != null && typeof s != "boolean" && typeof s != "function" ? (a = i + w, (s = t.__k[i] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Dd(null, s, null, null, null) : wb(s) ? Dd(nh, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? Dd(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, o = null, (u = s.__i = MY(s, r, a, g)) !== -1 && (g--, (o = r[u]) && (o.__u |= 2)), o == null || o.__v === null ? (u == -1 && w--, typeof s.type != "function" && (s.__u |= 4)) : u !== a && (u == a - 1 ? w-- : u == a + 1 ? w++ : (u > a ? w-- : w++, s.__u |= 4))) : s = t.__k[i] = null; if (g) for (i = 0; i < d; i++) (o = r[i]) != null && !(2 & o.__u) && (o.__e == n && (n = Au(o)), oS(o, o)); return n; } @@ -27646,17 +27647,17 @@ function MY(t, e, r, n) { } return -1; } -function d_(t, e, r) { +function p_(t, e, r) { e[0] === "-" ? t.setProperty(e, r ?? "") : t[e] = r == null ? "" : typeof r != "number" || AY.test(e) ? r : r + "px"; } function dd(t, e, r, n, i) { var s; e: if (e === "style") if (typeof r == "string") t.style.cssText = r; else { - if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || d_(t.style, e, ""); - if (r) for (e in r) n && r[e] === n[e] || d_(t.style, e, r[e]); + if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || p_(t.style, e, ""); + if (r) for (e in r) n && r[e] === n[e] || p_(t.style, e, r[e]); } - else if (e[0] === "o" && e[1] === "n") s = e !== (e = e.replace(eS, "$1")), e = e.toLowerCase() in t || e === "onFocusOut" || e === "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = bb, t.addEventListener(e, s ? U1 : B1, s)) : t.removeEventListener(e, s ? U1 : B1, s); + else if (e[0] === "o" && e[1] === "n") s = e !== (e = e.replace(eS, "$1")), e = e.toLowerCase() in t || e === "onFocusOut" || e === "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = yb, t.addEventListener(e, s ? U1 : B1, s)) : t.removeEventListener(e, s ? U1 : B1, s); else { if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try { @@ -27667,46 +27668,46 @@ function dd(t, e, r, n, i) { typeof r == "function" || (r == null || r === !1 && e[4] !== "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && r == 1 ? "" : r)); } } -function p_(t) { +function g_(t) { return function(e) { if (this.l) { var r = this.l[e.type + t]; - if (e.t == null) e.t = bb++; + if (e.t == null) e.t = yb++; else if (e.t < r.u) return; return r(Jr.event ? Jr.event(e) : e); } }; } -function xb(t, e, r, n, i, s, o, a, u, l) { - var d, g, w, A, M, N, L, F, $, K, H, V, te, R, W, pe, Ee, Y = e.type; +function _b(t, e, r, n, i, s, o, a, u, l) { + var d, g, w, A, M, N, L, $, F, K, H, V, te, R, W, pe, Ee, Y = e.type; if (e.constructor !== void 0) return null; 128 & r.__u && (u = !!(32 & r.__u), s = [a = e.__e = r.__e]), (d = Jr.__b) && d(e); e: if (typeof Y == "function") try { - if (F = e.props, $ = "prototype" in Y && Y.prototype.render, K = (d = Y.contextType) && n[d.__c], H = d ? K ? K.props.value : d.__ : n, r.__c ? L = (g = e.__c = r.__c).__ = g.__E : ($ ? e.__c = g = new Y(F, H) : (e.__c = g = new Od(F, H), g.constructor = Y, g.render = CY), K && K.sub(g), g.props = F, g.state || (g.state = {}), g.context = H, g.__n = n, w = g.__d = !0, g.__h = [], g._sb = []), $ && g.__s == null && (g.__s = g.state), $ && Y.getDerivedStateFromProps != null && (g.__s == g.state && (g.__s = pa({}, g.__s)), pa(g.__s, Y.getDerivedStateFromProps(F, g.__s))), A = g.props, M = g.state, g.__v = e, w) $ && Y.getDerivedStateFromProps == null && g.componentWillMount != null && g.componentWillMount(), $ && g.componentDidMount != null && g.__h.push(g.componentDidMount); + if ($ = e.props, F = "prototype" in Y && Y.prototype.render, K = (d = Y.contextType) && n[d.__c], H = d ? K ? K.props.value : d.__ : n, r.__c ? L = (g = e.__c = r.__c).__ = g.__E : (F ? e.__c = g = new Y($, H) : (e.__c = g = new Od($, H), g.constructor = Y, g.render = CY), K && K.sub(g), g.props = $, g.state || (g.state = {}), g.context = H, g.__n = n, w = g.__d = !0, g.__h = [], g._sb = []), F && g.__s == null && (g.__s = g.state), F && Y.getDerivedStateFromProps != null && (g.__s == g.state && (g.__s = pa({}, g.__s)), pa(g.__s, Y.getDerivedStateFromProps($, g.__s))), A = g.props, M = g.state, g.__v = e, w) F && Y.getDerivedStateFromProps == null && g.componentWillMount != null && g.componentWillMount(), F && g.componentDidMount != null && g.__h.push(g.componentDidMount); else { - if ($ && Y.getDerivedStateFromProps == null && F !== A && g.componentWillReceiveProps != null && g.componentWillReceiveProps(F, H), !g.__e && (g.shouldComponentUpdate != null && g.shouldComponentUpdate(F, g.__s, H) === !1 || e.__v === r.__v)) { - for (e.__v !== r.__v && (g.props = F, g.state = g.__s, g.__d = !1), e.__e = r.__e, e.__k = r.__k, e.__k.some(function(S) { + if (F && Y.getDerivedStateFromProps == null && $ !== A && g.componentWillReceiveProps != null && g.componentWillReceiveProps($, H), !g.__e && (g.shouldComponentUpdate != null && g.shouldComponentUpdate($, g.__s, H) === !1 || e.__v === r.__v)) { + for (e.__v !== r.__v && (g.props = $, g.state = g.__s, g.__d = !1), e.__e = r.__e, e.__k = r.__k, e.__k.some(function(S) { S && (S.__ = e); }), V = 0; V < g._sb.length; V++) g.__h.push(g._sb[V]); g._sb = [], g.__h.length && o.push(g); break e; } - g.componentWillUpdate != null && g.componentWillUpdate(F, g.__s, H), $ && g.componentDidUpdate != null && g.__h.push(function() { + g.componentWillUpdate != null && g.componentWillUpdate($, g.__s, H), F && g.componentDidUpdate != null && g.__h.push(function() { g.componentDidUpdate(A, M, N); }); } - if (g.context = H, g.props = F, g.__P = t, g.__e = !1, te = Jr.__r, R = 0, $) { + if (g.context = H, g.props = $, g.__P = t, g.__e = !1, te = Jr.__r, R = 0, F) { for (g.state = g.__s, g.__d = !1, te && te(e), d = g.render(g.props, g.state, g.context), W = 0; W < g._sb.length; W++) g.__h.push(g._sb[W]); g._sb = []; } else do g.__d = !1, te && te(e), d = g.render(g.props, g.state, g.context), g.state = g.__s; while (g.__d && ++R < 25); - g.state = g.__s, g.getChildContext != null && (n = pa(pa({}, n), g.getChildContext())), $ && !w && g.getSnapshotBeforeUpdate != null && (N = g.getSnapshotBeforeUpdate(A, M)), a = nS(t, yb(pe = d != null && d.type === nh && d.key == null ? d.props.children : d) ? pe : [pe], e, r, n, i, s, o, a, u, l), g.base = e.__e, e.__u &= -161, g.__h.length && o.push(g), L && (g.__E = g.__ = null); + g.state = g.__s, g.getChildContext != null && (n = pa(pa({}, n), g.getChildContext())), F && !w && g.getSnapshotBeforeUpdate != null && (N = g.getSnapshotBeforeUpdate(A, M)), a = nS(t, wb(pe = d != null && d.type === nh && d.key == null ? d.props.children : d) ? pe : [pe], e, r, n, i, s, o, a, u, l), g.base = e.__e, e.__u &= -161, g.__h.length && o.push(g), L && (g.__E = g.__ = null); } catch (S) { if (e.__v = null, u || s != null) if (S.then) { for (e.__u |= u ? 160 : 128; a && a.nodeType === 8 && a.nextSibling; ) a = a.nextSibling; s[s.indexOf(a)] = null, e.__e = a; - } else for (Ee = s.length; Ee--; ) wb(s[Ee]); + } else for (Ee = s.length; Ee--; ) xb(s[Ee]); else e.__e = r.__e, e.__k = r.__k; Jr.__e(S, e, r); } @@ -27714,7 +27715,7 @@ function xb(t, e, r, n, i, s, o, a, u, l) { return (d = Jr.diffed) && d(e), 128 & e.__u ? void 0 : a; } function sS(t, e, r) { - for (var n = 0; n < r.length; n++) _b(r[n], r[++n], r[++n]); + for (var n = 0; n < r.length; n++) Eb(r[n], r[++n], r[++n]); Jr.__c && Jr.__c(e, t), t.some(function(i) { try { t = i.__h, i.__h = [], t.some(function(s) { @@ -27726,35 +27727,35 @@ function sS(t, e, r) { }); } function IY(t, e, r, n, i, s, o, a, u) { - var l, d, g, w, A, M, N, L = r.props, F = e.props, $ = e.type; - if ($ === "svg" ? i = "http://www.w3.org/2000/svg" : $ === "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) { - for (l = 0; l < s.length; l++) if ((A = s[l]) && "setAttribute" in A == !!$ && ($ ? A.localName === $ : A.nodeType === 3)) { + var l, d, g, w, A, M, N, L = r.props, $ = e.props, F = e.type; + if (F === "svg" ? i = "http://www.w3.org/2000/svg" : F === "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) { + for (l = 0; l < s.length; l++) if ((A = s[l]) && "setAttribute" in A == !!F && (F ? A.localName === F : A.nodeType === 3)) { t = A, s[l] = null; break; } } if (t == null) { - if ($ === null) return document.createTextNode(F); - t = document.createElementNS(i, $, F.is && F), a && (Jr.__m && Jr.__m(e, s), a = !1), s = null; + if (F === null) return document.createTextNode($); + t = document.createElementNS(i, F, $.is && $), a && (Jr.__m && Jr.__m(e, s), a = !1), s = null; } - if ($ === null) L === F || a && t.data === F || (t.data = F); + if (F === null) L === $ || a && t.data === $ || (t.data = $); else { if (s = s && cp.call(t.childNodes), L = r.props || Al, !a && s != null) for (L = {}, l = 0; l < t.attributes.length; l++) L[(A = t.attributes[l]).name] = A.value; for (l in L) if (A = L[l], l != "children") { if (l == "dangerouslySetInnerHTML") g = A; - else if (!(l in F)) { - if (l == "value" && "defaultValue" in F || l == "checked" && "defaultChecked" in F) continue; + else if (!(l in $)) { + if (l == "value" && "defaultValue" in $ || l == "checked" && "defaultChecked" in $) continue; dd(t, l, null, A, i); } } - for (l in F) A = F[l], l == "children" ? w = A : l == "dangerouslySetInnerHTML" ? d = A : l == "value" ? M = A : l == "checked" ? N = A : a && typeof A != "function" || L[l] === A || dd(t, l, A, L[l], i); + for (l in $) A = $[l], l == "children" ? w = A : l == "dangerouslySetInnerHTML" ? d = A : l == "value" ? M = A : l == "checked" ? N = A : a && typeof A != "function" || L[l] === A || dd(t, l, A, L[l], i); if (d) a || g && (d.__html === g.__html || d.__html === t.innerHTML) || (t.innerHTML = d.__html), e.__k = []; - else if (g && (t.innerHTML = ""), nS(t, yb(w) ? w : [w], e, r, n, $ === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && Au(r, 0), a, u), s != null) for (l = s.length; l--; ) wb(s[l]); - a || (l = "value", $ === "progress" && M == null ? t.removeAttribute("value") : M !== void 0 && (M !== t[l] || $ === "progress" && !M || $ === "option" && M !== L[l]) && dd(t, l, M, L[l], i), l = "checked", N !== void 0 && N !== t[l] && dd(t, l, N, L[l], i)); + else if (g && (t.innerHTML = ""), nS(t, wb(w) ? w : [w], e, r, n, F === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && Au(r, 0), a, u), s != null) for (l = s.length; l--; ) xb(s[l]); + a || (l = "value", F === "progress" && M == null ? t.removeAttribute("value") : M !== void 0 && (M !== t[l] || F === "progress" && !M || F === "option" && M !== L[l]) && dd(t, l, M, L[l], i), l = "checked", N !== void 0 && N !== t[l] && dd(t, l, N, L[l], i)); } return t; } -function _b(t, e, r) { +function Eb(t, e, r) { try { if (typeof t == "function") { var n = typeof t.__u == "function"; @@ -27766,7 +27767,7 @@ function _b(t, e, r) { } function oS(t, e, r) { var n, i; - if (Jr.unmount && Jr.unmount(t), (n = t.ref) && (n.current && n.current !== t.__e || _b(n, null, e)), (n = t.__c) != null) { + if (Jr.unmount && Jr.unmount(t), (n = t.ref) && (n.current && n.current !== t.__e || Eb(n, null, e)), (n = t.__c) != null) { if (n.componentWillUnmount) try { n.componentWillUnmount(); } catch (s) { @@ -27775,14 +27776,14 @@ function oS(t, e, r) { n.base = n.__P = null; } if (n = t.__k) for (i = 0; i < n.length; i++) n[i] && oS(n[i], e, r || typeof t.type != "function"); - r || wb(t.__e), t.__c = t.__ = t.__e = void 0; + r || xb(t.__e), t.__c = t.__ = t.__e = void 0; } function CY(t, e, r) { return this.constructor(t, r); } function j1(t, e, r) { var n, i, s, o; - e === document && (e = document.documentElement), Jr.__ && Jr.__(t, e), i = (n = typeof r == "function") ? null : e.__k, s = [], o = [], xb(e, t = (!n && r || e).__k = Nr(nh, null, [t]), i || Al, Al, e.namespaceURI, !n && r ? [r] : i ? null : e.firstChild ? cp.call(e.childNodes) : null, s, !n && r ? r : i ? i.__e : e.firstChild, n, o), sS(s, t, o); + e === document && (e = document.documentElement), Jr.__ && Jr.__(t, e), i = (n = typeof r == "function") ? null : e.__k, s = [], o = [], _b(e, t = (!n && r || e).__k = Nr(nh, null, [t]), i || Al, Al, e.namespaceURI, !n && r ? [r] : i ? null : e.firstChild ? cp.call(e.childNodes) : null, s, !n && r ? r : i ? i.__e : e.firstChild, n, o), sS(s, t, o); } cp = tS.slice, Jr = { __e: function(t, e, r, n) { for (var i, s, o; e = e.__; ) if ((i = e.__c) && !i.__) try { @@ -27793,19 +27794,19 @@ cp = tS.slice, Jr = { __e: function(t, e, r, n) { throw t; } }, ZE = 0, Od.prototype.setState = function(t, e) { var r; - r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = pa({}, this.state), typeof t == "function" && (t = t(pa({}, r), this.props)), t && pa(r, t), t != null && this.__v && (e && this._sb.push(e), h_(this)); + r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = pa({}, this.state), typeof t == "function" && (t = t(pa({}, r), this.props)), t && pa(r, t), t != null && this.__v && (e && this._sb.push(e), d_(this)); }, Od.prototype.forceUpdate = function(t) { - this.__v && (this.__e = !0, t && this.__h.push(t), h_(this)); + this.__v && (this.__e = !0, t && this.__h.push(t), d_(this)); }, Od.prototype.render = nh, ec = [], QE = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, F1 = function(t, e) { return t.__v.__b - e.__v.__b; -}, h0.__r = 0, eS = /(PointerCapture)$|Capture$/i, bb = 0, B1 = p_(!1), U1 = p_(!0); -var d0, pn, Mm, g_, q1 = 0, aS = [], yn = Jr, m_ = yn.__b, v_ = yn.__r, b_ = yn.diffed, y_ = yn.__c, w_ = yn.unmount, x_ = yn.__; +}, h0.__r = 0, eS = /(PointerCapture)$|Capture$/i, yb = 0, B1 = g_(!1), U1 = g_(!0); +var d0, pn, Mm, m_, q1 = 0, aS = [], yn = Jr, v_ = yn.__b, b_ = yn.__r, y_ = yn.diffed, w_ = yn.__c, x_ = yn.unmount, __ = yn.__; function cS(t, e) { yn.__h && yn.__h(pn, t, q1 || e), q1 = 0; var r = pn.__H || (pn.__H = { __: [], __h: [] }); return t >= r.__.length && r.__.push({}), r.__[t]; } -function __(t) { +function E_(t) { return q1 = 1, TY(uS, t); } function TY(t, e, r) { @@ -27854,19 +27855,19 @@ function DY() { } } yn.__b = function(t) { - pn = null, m_ && m_(t); + pn = null, v_ && v_(t); }, yn.__ = function(t, e) { - t && e.__k && e.__k.__m && (t.__m = e.__k.__m), x_ && x_(t, e); + t && e.__k && e.__k.__m && (t.__m = e.__k.__m), __ && __(t, e); }, yn.__r = function(t) { - v_ && v_(t), d0 = 0; + b_ && b_(t), d0 = 0; var e = (pn = t.__c).__H; e && (Mm === pn ? (e.__h = [], pn.__h = [], e.__.forEach(function(r) { r.__N && (r.__ = r.__N), r.i = r.__N = void 0; })) : (e.__h.forEach(Nd), e.__h.forEach(z1), e.__h = [], d0 = 0)), Mm = pn; }, yn.diffed = function(t) { - b_ && b_(t); + y_ && y_(t); var e = t.__c; - e && e.__H && (e.__H.__h.length && (aS.push(e) !== 1 && g_ === yn.requestAnimationFrame || ((g_ = yn.requestAnimationFrame) || OY)(DY)), e.__H.__.forEach(function(r) { + e && e.__H && (e.__H.__h.length && (aS.push(e) !== 1 && m_ === yn.requestAnimationFrame || ((m_ = yn.requestAnimationFrame) || OY)(DY)), e.__H.__.forEach(function(r) { r.i && (r.__H = r.i), r.i = void 0; })), Mm = pn = null; }, yn.__c = function(t, e) { @@ -27880,9 +27881,9 @@ yn.__b = function(t) { i.__h && (i.__h = []); }), e = [], yn.__e(n, r.__v); } - }), y_ && y_(t, e); + }), w_ && w_(t, e); }, yn.unmount = function(t) { - w_ && w_(t); + x_ && x_(t); var e, r = t.__c; r && r.__H && (r.__H.__.forEach(function(n) { try { @@ -27892,12 +27893,12 @@ yn.__b = function(t) { } }), r.__H = void 0, e && yn.__e(e, r.__v)); }; -var E_ = typeof requestAnimationFrame == "function"; +var S_ = typeof requestAnimationFrame == "function"; function OY(t) { var e, r = function() { - clearTimeout(n), E_ && cancelAnimationFrame(e), setTimeout(t); + clearTimeout(n), S_ && cancelAnimationFrame(e), setTimeout(t); }, n = setTimeout(r, 100); - E_ && (e = requestAnimationFrame(r)); + S_ && (e = requestAnimationFrame(r)); } function Nd(t) { var e = pn, r = t.__c; @@ -27946,7 +27947,7 @@ const fS = (t) => Nr( Nr("style", null, LY), Nr("div", { class: "-cbwsdk-snackbar" }, t.children) ), BY = ({ autoExpand: t, message: e, menuItems: r }) => { - const [n, i] = __(!0), [s, o] = __(t ?? !1); + const [n, i] = E_(!0), [s, o] = E_(t ?? !1); RY(() => { const u = [ window.setTimeout(() => { @@ -28088,8 +28089,8 @@ const zY = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: ) ) ); -}, HY = "https://keys.coinbase.com/connect", S_ = "https://www.walletlink.org", WY = "https://go.cb-w.com/walletlink"; -class A_ { +}, HY = "https://keys.coinbase.com/connect", A_ = "https://www.walletlink.org", WY = "https://go.cb-w.com/walletlink"; +class P_ { constructor() { this.attached = !1, this.redirectDialog = new qY(); } @@ -28153,7 +28154,7 @@ class _o { session: e, linkAPIUrl: r, listener: this - }), i = this.isMobileWeb ? new A_() : new UY(); + }), i = this.isMobileWeb ? new P_() : new UY(); return n.connect(), { session: e, ui: i, connection: n }; } resetAndReload() { @@ -28241,7 +28242,7 @@ class _o { } // copied from MobileRelay openCoinbaseWalletDeeplink(e) { - if (this.ui instanceof A_) + if (this.ui instanceof P_) switch (e) { case "requestEthereumAccounts": case "switchEthereumChain": @@ -28389,10 +28390,10 @@ class _o { } } _o.accountRequestCallbackIds = /* @__PURE__ */ new Set(); -const P_ = "DefaultChainId", M_ = "DefaultJsonRpcUrl"; +const M_ = "DefaultChainId", I_ = "DefaultJsonRpcUrl"; class lS { constructor(e) { - this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new Qs("walletlink", S_), this.callback = e.callback || null; + this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new Qs("walletlink", A_), this.callback = e.callback || null; const r = this._storage.getItem($1); if (r) { const n = r.split(" "); @@ -28412,16 +28413,16 @@ class lS { } get jsonRpcUrl() { var e; - return (e = this._storage.getItem(M_)) !== null && e !== void 0 ? e : void 0; + return (e = this._storage.getItem(I_)) !== null && e !== void 0 ? e : void 0; } set jsonRpcUrl(e) { - this._storage.setItem(M_, e); + this._storage.setItem(I_, e); } updateProviderInfo(e, r) { var n; this.jsonRpcUrl = e; const i = this.getChainId(); - this._storage.setItem(P_, r.toString(10)), Wf(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", da(r))); + this._storage.setItem(M_, r.toString(10)), Wf(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", da(r))); } async watchAsset(e) { const r = Array.isArray(e) ? e[0] : e; @@ -28555,7 +28556,7 @@ class lS { } getChainId() { var e; - return Number.parseInt((e = this._storage.getItem(P_)) !== null && e !== void 0 ? e : "1", 10); + return Number.parseInt((e = this._storage.getItem(M_)) !== null && e !== void 0 ? e : "1", 10); } async _eth_requestAccounts() { var e, r; @@ -28635,7 +28636,7 @@ class lS { } initializeRelay() { return this._relay || (this._relay = new _o({ - linkAPIUrl: S_, + linkAPIUrl: A_, storage: this._storage, metadata: this.metadata, accountsCallback: this._setAddresses.bind(this), @@ -28715,11 +28716,11 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene } } }; -}, { checkCrossOriginOpenerPolicy: QY, getCrossOriginOpenerPolicy: eJ } = ZY(), I_ = 420, C_ = 540; +}, { checkCrossOriginOpenerPolicy: QY, getCrossOriginOpenerPolicy: eJ } = ZY(), C_ = 420, T_ = 540; function tJ(t) { - const e = (window.innerWidth - I_) / 2 + window.screenX, r = (window.innerHeight - C_) / 2 + window.screenY; + const e = (window.innerWidth - C_) / 2 + window.screenX, r = (window.innerHeight - T_) / 2 + window.screenY; nJ(t); - const n = window.open(t, "Smart Wallet", `width=${I_}, height=${C_}, left=${e}, top=${r}`); + const n = window.open(t, "Smart Wallet", `width=${C_}, height=${T_}, left=${e}, top=${r}`); if (n == null || n.focus(), !n) throw Sr.rpc.internal("Pop up window failed to open"); return n; @@ -28837,9 +28838,9 @@ var pS = { exports: {} }; }, a.prototype.emit = function(l, d, g, w, A, M) { var N = r ? r + l : l; if (!this._events[N]) return !1; - var L = this._events[N], F = arguments.length, $, K; + var L = this._events[N], $ = arguments.length, F, K; if (L.fn) { - switch (L.once && this.removeListener(l, L.fn, void 0, !0), F) { + switch (L.once && this.removeListener(l, L.fn, void 0, !0), $) { case 1: return L.fn.call(L.context), !0; case 2: @@ -28853,13 +28854,13 @@ var pS = { exports: {} }; case 6: return L.fn.call(L.context, d, g, w, A, M), !0; } - for (K = 1, $ = new Array(F - 1); K < F; K++) - $[K - 1] = arguments[K]; - L.fn.apply(L.context, $); + for (K = 1, F = new Array($ - 1); K < $; K++) + F[K - 1] = arguments[K]; + L.fn.apply(L.context, F); } else { var H = L.length, V; for (K = 0; K < H; K++) - switch (L[K].once && this.removeListener(l, L[K].fn, void 0, !0), F) { + switch (L[K].once && this.removeListener(l, L[K].fn, void 0, !0), $) { case 1: L[K].fn.call(L[K].context); break; @@ -28873,9 +28874,9 @@ var pS = { exports: {} }; L[K].fn.call(L[K].context, d, g, w); break; default: - if (!$) for (V = 1, $ = new Array(F - 1); V < F; V++) - $[V - 1] = arguments[V]; - L[K].fn.apply(L[K].context, $); + if (!F) for (V = 1, F = new Array($ - 1); V < $; V++) + F[V - 1] = arguments[V]; + L[K].fn.apply(L[K].context, F); } } return !0; @@ -28892,7 +28893,7 @@ var pS = { exports: {} }; if (M.fn) M.fn === d && (!w || M.once) && (!g || M.context === g) && o(this, A); else { - for (var N = 0, L = [], F = M.length; N < F; N++) + for (var N = 0, L = [], $ = M.length; N < $; N++) (M[N].fn !== d || w && !M[N].once || g && M[N].context !== g) && L.push(M[N]); L.length ? this._events[A] = L.length === 1 ? L[0] : L : o(this, A); } @@ -29016,7 +29017,7 @@ function gS(t, e) { return t.apply(e, arguments); }; } -const { toString: mJ } = Object.prototype, { getPrototypeOf: Eb } = Object, up = /* @__PURE__ */ ((t) => (e) => { +const { toString: mJ } = Object.prototype, { getPrototypeOf: Sb } = Object, up = /* @__PURE__ */ ((t) => (e) => { const r = mJ.call(e); return t[r] || (t[r] = r.slice(8, -1).toLowerCase()); })(/* @__PURE__ */ Object.create(null)), As = (t) => (t = t.toLowerCase(), (e) => up(e) === t), fp = (t) => (e) => typeof e === t, { isArray: zu } = Array, Pl = fp("undefined"); @@ -29031,7 +29032,7 @@ function bJ(t) { const yJ = fp("string"), Di = fp("function"), vS = fp("number"), lp = (t) => t !== null && typeof t == "object", wJ = (t) => t === !0 || t === !1, Ld = (t) => { if (up(t) !== "object") return !1; - const e = Eb(t); + const e = Sb(t); return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in t) && !(Symbol.iterator in t); }, xJ = As("Date"), _J = As("File"), EJ = As("Blob"), SJ = As("FileList"), AJ = (t) => lp(t) && Di(t.pipe), PJ = (t) => { let e; @@ -29084,7 +29085,7 @@ const OJ = (t, e, r, { allOwnKeys: n } = {}) => (ih(e, (i, s) => { do { for (i = Object.getOwnPropertyNames(t), s = i.length; s-- > 0; ) o = i[s], (!n || n(o, t, e)) && !a[o] && (e[o] = t[o], a[o] = !0); - t = r !== !1 && Eb(t); + t = r !== !1 && Sb(t); } while (t && (!r || r(t, e)) && t !== Object.prototype); return e; }, $J = (t, e, r) => { @@ -29100,7 +29101,7 @@ const OJ = (t, e, r, { allOwnKeys: n } = {}) => (ih(e, (i, s) => { for (; e-- > 0; ) r[e] = t[e]; return r; -}, BJ = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Eb(Uint8Array)), UJ = (t, e) => { +}, BJ = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Sb(Uint8Array)), UJ = (t, e) => { const n = (t && t[Symbol.iterator]).call(t); let i; for (; (i = n.next()) && !i.done; ) { @@ -29118,7 +29119,7 @@ const OJ = (t, e, r, { allOwnKeys: n } = {}) => (ih(e, (i, s) => { function(r, n, i) { return n.toUpperCase() + i; } -), T_ = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), HJ = As("RegExp"), wS = (t, e) => { +), R_ = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), HJ = As("RegExp"), wS = (t, e) => { const r = Object.getOwnPropertyDescriptors(t), n = {}; ih(r, (i, s) => { let o; @@ -29147,10 +29148,10 @@ const OJ = (t, e, r, { allOwnKeys: n } = {}) => (ih(e, (i, s) => { }; return zu(t) ? n(t) : n(String(t).split(e)), r; }, VJ = () => { -}, GJ = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, Im = "abcdefghijklmnopqrstuvwxyz", R_ = "0123456789", xS = { - DIGIT: R_, +}, GJ = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, Im = "abcdefghijklmnopqrstuvwxyz", D_ = "0123456789", xS = { + DIGIT: D_, ALPHA: Im, - ALPHA_DIGIT: Im + Im.toUpperCase() + R_ + ALPHA_DIGIT: Im + Im.toUpperCase() + D_ }, YJ = (t = 16, e = xS.ALPHA_DIGIT) => { let r = ""; const { length: n } = e; @@ -29224,8 +29225,8 @@ const XJ = (t) => { forEachEntry: UJ, matchAll: jJ, isHTMLForm: qJ, - hasOwnProperty: T_, - hasOwnProp: T_, + hasOwnProperty: R_, + hasOwnProp: R_, // an alias to avoid ESLint no-prototype-builtins detection reduceDescriptors: wS, freezeMethods: WJ, @@ -29302,7 +29303,7 @@ function W1(t) { function AS(t) { return Oe.endsWith(t, "[]") ? t.slice(0, -2) : t; } -function D_(t, e, r) { +function O_(t, e, r) { return t ? t.concat(e).map(function(i, s) { return i = AS(i), !r && s ? "[" + i + "]" : i; }).join(r ? "." : "") : e; @@ -29335,20 +29336,20 @@ function hp(t, e, r) { return Oe.isArrayBuffer(M) || Oe.isTypedArray(M) ? u && typeof Blob == "function" ? new Blob([M]) : Buffer.from(M) : M; } function d(M, N, L) { - let F = M; + let $ = M; if (M && !L && typeof M == "object") { if (Oe.endsWith(N, "{}")) N = n ? N : N.slice(0, -2), M = JSON.stringify(M); - else if (Oe.isArray(M) && rX(M) || (Oe.isFileList(M) || Oe.endsWith(N, "[]")) && (F = Oe.toArray(M))) - return N = AS(N), F.forEach(function(K, H) { + else if (Oe.isArray(M) && rX(M) || (Oe.isFileList(M) || Oe.endsWith(N, "[]")) && ($ = Oe.toArray(M))) + return N = AS(N), $.forEach(function(K, H) { !(Oe.isUndefined(K) || K === null) && e.append( // eslint-disable-next-line no-nested-ternary - o === !0 ? D_([N], H, s) : o === null ? N : N + "[]", + o === !0 ? O_([N], H, s) : o === null ? N : N + "[]", l(K) ); }), !1; } - return W1(M) ? !0 : (e.append(D_(L, N, s), l(M)), !1); + return W1(M) ? !0 : (e.append(O_(L, N, s), l(M)), !1); } const g = [], w = Object.assign(nX, { defaultVisitor: d, @@ -29359,14 +29360,14 @@ function hp(t, e, r) { if (!Oe.isUndefined(M)) { if (g.indexOf(M) !== -1) throw Error("Circular reference detected in " + N.join(".")); - g.push(M), Oe.forEach(M, function(F, $) { - (!(Oe.isUndefined(F) || F === null) && i.call( + g.push(M), Oe.forEach(M, function($, F) { + (!(Oe.isUndefined($) || $ === null) && i.call( e, - F, - Oe.isString($) ? $.trim() : $, + $, + Oe.isString(F) ? F.trim() : F, N, w - )) === !0 && A(F, N ? N.concat($) : [$]); + )) === !0 && A($, N ? N.concat(F) : [F]); }), g.pop(); } } @@ -29374,7 +29375,7 @@ function hp(t, e, r) { throw new TypeError("data must be an object"); return A(t), e; } -function O_(t) { +function N_(t) { const e = { "!": "%21", "'": "%27", @@ -29388,17 +29389,17 @@ function O_(t) { return e[n]; }); } -function Sb(t, e) { +function Ab(t, e) { this._pairs = [], t && hp(t, this, e); } -const PS = Sb.prototype; +const PS = Ab.prototype; PS.append = function(e, r) { this._pairs.push([e, r]); }; PS.toString = function(e) { const r = e ? function(n) { - return e.call(this, n, O_); - } : O_; + return e.call(this, n, N_); + } : N_; return this._pairs.map(function(i) { return r(i[0]) + "=" + r(i[1]); }, "").join("&"); @@ -29415,13 +29416,13 @@ function MS(t, e, r) { }); const i = r && r.serialize; let s; - if (i ? s = i(e, r) : s = Oe.isURLSearchParams(e) ? e.toString() : new Sb(e, r).toString(n), s) { + if (i ? s = i(e, r) : s = Oe.isURLSearchParams(e) ? e.toString() : new Ab(e, r).toString(n), s) { const o = t.indexOf("#"); o !== -1 && (t = t.slice(0, o)), t += (t.indexOf("?") === -1 ? "?" : "&") + s; } return t; } -class N_ { +class L_ { constructor() { this.handlers = []; } @@ -29479,7 +29480,7 @@ const IS = { silentJSONParsing: !0, forcedJSONParsing: !0, clarifyTimeoutError: !1 -}, sX = typeof URLSearchParams < "u" ? URLSearchParams : Sb, oX = typeof FormData < "u" ? FormData : null, aX = typeof Blob < "u" ? Blob : null, cX = { +}, sX = typeof URLSearchParams < "u" ? URLSearchParams : Ab, oX = typeof FormData < "u" ? FormData : null, aX = typeof Blob < "u" ? Blob : null, cX = { isBrowser: !0, classes: { URLSearchParams: sX, @@ -29487,10 +29488,10 @@ const IS = { Blob: aX }, protocols: ["http", "https", "file", "blob", "url", "data"] -}, Ab = typeof window < "u" && typeof document < "u", K1 = typeof navigator == "object" && navigator || void 0, uX = Ab && (!K1 || ["ReactNative", "NativeScript", "NS"].indexOf(K1.product) < 0), fX = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef -self instanceof WorkerGlobalScope && typeof self.importScripts == "function", lX = Ab && window.location.href || "http://localhost", hX = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}, Pb = typeof window < "u" && typeof document < "u", K1 = typeof navigator == "object" && navigator || void 0, uX = Pb && (!K1 || ["ReactNative", "NativeScript", "NS"].indexOf(K1.product) < 0), fX = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef +self instanceof WorkerGlobalScope && typeof self.importScripts == "function", lX = Pb && window.location.href || "http://localhost", hX = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - hasBrowserEnv: Ab, + hasBrowserEnv: Pb, hasStandardBrowserEnv: uX, hasStandardBrowserWebWorkerEnv: fX, navigator: K1, @@ -29637,7 +29638,7 @@ const vX = Oe.toObjectSet([ `).forEach(function(o) { i = o.indexOf(":"), r = o.substring(0, i).trim().toLowerCase(), n = o.substring(i + 1).trim(), !(!r || e[r] && vX[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n); }), e; -}, L_ = Symbol("internals"); +}, k_ = Symbol("internals"); function Rf(t) { return t && String(t).trim().toLowerCase(); } @@ -29784,7 +29785,7 @@ let yi = class { return r.forEach((i) => n.set(i)), n; } static accessor(e) { - const n = (this[L_] = this[L_] = { + const n = (this[k_] = this[k_] = { accessors: {} }).accessors, i = this.prototype; function s(o) { @@ -29882,14 +29883,14 @@ const p0 = (t, e, r = 3) => { }; t(g); }, r); -}, k_ = (t, e) => { +}, $_ = (t, e) => { const r = t != null; return [(n) => e[0]({ lengthComputable: r, total: t, loaded: n }), e[1]]; -}, $_ = (t) => (...e) => Oe.asap(() => t(...e)), PX = Yn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Yn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( +}, F_ = (t) => (...e) => Oe.asap(() => t(...e)), PX = Yn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Yn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( new URL(Yn.origin), Yn.navigator && /(msie|trident)/i.test(Yn.navigator.userAgent) ) : () => !0, MX = Yn.hasStandardBrowserEnv ? ( @@ -29928,7 +29929,7 @@ function CX(t, e) { function DS(t, e) { return t && !IX(e) ? CX(t, e) : e; } -const F_ = (t) => t instanceof yi ? { ...t } : t; +const B_ = (t) => t instanceof yi ? { ...t } : t; function pc(t, e) { e = e || {}; const r = {}; @@ -29986,7 +29987,7 @@ function pc(t, e) { socketPath: o, responseEncoding: o, validateStatus: a, - headers: (l, d, g) => i(F_(l), F_(d), g, !0) + headers: (l, d, g) => i(B_(l), B_(d), g, !0) }; return Oe.forEach(Object.keys(Object.assign({}, t, e)), function(d) { const g = u[d] || i, w = g(t[d], e[d], d); @@ -30025,7 +30026,7 @@ const OS = (t) => { } let L = new XMLHttpRequest(); L.open(i.method.toUpperCase(), i.url, !0), L.timeout = i.timeout; - function F() { + function $() { if (!L) return; const K = yi.from( @@ -30044,8 +30045,8 @@ const OS = (t) => { n(R), N(); }, V), L = null; } - "onloadend" in L ? L.onloadend = F : L.onreadystatechange = function() { - !L || L.readyState !== 4 || L.status === 0 && !(L.responseURL && L.responseURL.indexOf("file:") === 0) || setTimeout(F); + "onloadend" in L ? L.onloadend = $ : L.onreadystatechange = function() { + !L || L.readyState !== 4 || L.status === 0 && !(L.responseURL && L.responseURL.indexOf("file:") === 0) || setTimeout($); }, L.onabort = function() { L && (n(new sr("Request aborted", sr.ECONNABORTED, t, L)), L = null); }, L.onerror = function() { @@ -30064,9 +30065,9 @@ const OS = (t) => { }), Oe.isUndefined(i.withCredentials) || (L.withCredentials = !!i.withCredentials), a && a !== "json" && (L.responseType = i.responseType), l && ([w, M] = p0(l, !0), L.addEventListener("progress", w)), u && L.upload && ([g, A] = p0(u), L.upload.addEventListener("progress", g), L.upload.addEventListener("loadend", A)), (i.cancelToken || i.signal) && (d = (K) => { L && (n(!K || K.type ? new Hu(null, t, L) : K), L.abort(), L = null); }, i.cancelToken && i.cancelToken.subscribe(d), i.signal && (i.signal.aborted ? d() : i.signal.addEventListener("abort", d))); - const $ = EX(i.url); - if ($ && Yn.protocols.indexOf($) === -1) { - n(new sr("Unsupported protocol " + $ + ":", sr.ERR_BAD_REQUEST, t)); + const F = EX(i.url); + if (F && Yn.protocols.indexOf(F) === -1) { + n(new sr("Unsupported protocol " + F + ":", sr.ERR_BAD_REQUEST, t)); return; } L.send(s || null); @@ -30122,7 +30123,7 @@ const OS = (t) => { } finally { await e.cancel(); } -}, B_ = (t, e, r, n) => { +}, U_ = (t, e, r, n) => { const i = NX(t, e); let s = 0, o, a = (u) => { o || (o = !0, n && n(u)); @@ -30167,7 +30168,7 @@ const OS = (t) => { } }).headers.has("Content-Type"); return t && !e; -}), U_ = 64 * 1024, V1 = NS && LS(() => Oe.isReadableStream(new Response("").body)), g0 = { +}), j_ = 64 * 1024, V1 = NS && LS(() => Oe.isReadableStream(new Response("").body)), g0 = { stream: V1 && ((t) => t.body) }; dp && ((t) => { @@ -30223,15 +30224,15 @@ const FX = async (t) => { duplex: "half" }), te; if (Oe.isFormData(n) && (te = V.headers.get("content-type")) && d.setContentType(te), V.body) { - const [R, W] = k_( + const [R, W] = $_( L, - p0($_(u)) + p0(F_(u)) ); - n = B_(V.body, U_, R, W); + n = U_(V.body, j_, R, W); } } Oe.isString(g) || (g = g ? "include" : "omit"); - const F = "credentials" in Request.prototype; + const $ = "credentials" in Request.prototype; M = new Request(e, { ...w, signal: A, @@ -30239,45 +30240,45 @@ const FX = async (t) => { headers: d.normalize().toJSON(), body: n, duplex: "half", - credentials: F ? g : void 0 + credentials: $ ? g : void 0 }); - let $ = await fetch(M); + let F = await fetch(M); const K = V1 && (l === "stream" || l === "response"); if (V1 && (a || K && N)) { const V = {}; ["status", "statusText", "headers"].forEach((pe) => { - V[pe] = $[pe]; + V[pe] = F[pe]; }); - const te = Oe.toFiniteNumber($.headers.get("content-length")), [R, W] = a && k_( + const te = Oe.toFiniteNumber(F.headers.get("content-length")), [R, W] = a && $_( te, - p0($_(a), !0) + p0(F_(a), !0) ) || []; - $ = new Response( - B_($.body, U_, R, () => { + F = new Response( + U_(F.body, j_, R, () => { W && W(), N && N(); }), V ); } l = l || "text"; - let H = await g0[Oe.findKey(g0, l) || "text"]($, t); + let H = await g0[Oe.findKey(g0, l) || "text"](F, t); return !K && N && N(), await new Promise((V, te) => { RS(V, te, { data: H, - headers: yi.from($.headers), - status: $.status, - statusText: $.statusText, + headers: yi.from(F.headers), + status: F.status, + statusText: F.statusText, config: t, request: M }); }); - } catch (F) { - throw N && N(), F && F.name === "TypeError" && /fetch/i.test(F.message) ? Object.assign( + } catch ($) { + throw N && N(), $ && $.name === "TypeError" && /fetch/i.test($.message) ? Object.assign( new sr("Network Error", sr.ERR_NETWORK, t, M), { - cause: F.cause || F + cause: $.cause || $ } - ) : sr.from(F, F && F.code, t, M); + ) : sr.from($, $ && $.code, t, M); } }), G1 = { http: tX, @@ -30293,7 +30294,7 @@ Oe.forEach(G1, (t, e) => { Object.defineProperty(t, "adapterName", { value: e }); } }); -const j_ = (t) => `- ${t}`, jX = (t) => Oe.isFunction(t) || t === null || t === !1, kS = { +const q_ = (t) => `- ${t}`, jX = (t) => Oe.isFunction(t) || t === null || t === !1, kS = { getAdapter: (t) => { t = Oe.isArray(t) ? t : [t]; const { length: e } = t; @@ -30313,8 +30314,8 @@ const j_ = (t) => `- ${t}`, jX = (t) => Oe.isFunction(t) || t === null || t === ([a, u]) => `adapter ${a} ` + (u === !1 ? "is not supported by the environment" : "is not available in the build") ); let o = e ? s.length > 1 ? `since : -` + s.map(j_).join(` -`) : " " + j_(s[0]) : "as no adapter specified"; +` + s.map(q_).join(` +`) : " " + q_(s[0]) : "as no adapter specified"; throw new sr( "There is no suitable adapter to dispatch the request " + o, "ERR_NOT_SUPPORT" @@ -30328,7 +30329,7 @@ function Rm(t) { if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted) throw new Hu(null, t); } -function q_(t) { +function z_(t) { return Rm(t), t.headers = yi.from(t.headers), t.data = Tm.call( t, t.transformRequest @@ -30352,7 +30353,7 @@ const $S = "1.7.8", pp = {}; return typeof n === t || "a" + (e < 1 ? "n " : " ") + t; }; }); -const z_ = {}; +const H_ = {}; pp.transitional = function(e, r, n) { function i(s, o) { return "[Axios v" + $S + "] Transitional option '" + s + "'" + o + (n ? ". " + n : ""); @@ -30363,7 +30364,7 @@ pp.transitional = function(e, r, n) { i(o, " has been removed" + (r ? " in " + r : "")), sr.ERR_DEPRECATED ); - return r && !z_[o] && (z_[o] = !0, console.warn( + return r && !H_[o] && (H_[o] = !0, console.warn( i( o, " has been deprecated since v" + r + " and will be removed in the near future" @@ -30398,8 +30399,8 @@ const $d = { let oc = class { constructor(e) { this.defaults = e, this.interceptors = { - request: new N_(), - response: new N_() + request: new L_(), + response: new L_() }; } /** @@ -30464,7 +30465,7 @@ let oc = class { }); let d, g = 0, w; if (!u) { - const M = [q_.bind(this), void 0]; + const M = [z_.bind(this), void 0]; for (M.unshift.apply(M, a), M.push.apply(M, l), w = M.length, d = Promise.resolve(r); g < w; ) d = d.then(M[g++], M[g++]); return d; @@ -30481,7 +30482,7 @@ let oc = class { } } try { - d = q_.call(this, A); + d = z_.call(this, A); } catch (M) { return Promise.reject(M); } @@ -30695,26 +30696,27 @@ mn.getAdapter = kS.getAdapter; mn.HttpStatusCode = Y1; mn.default = mn; const { - Axios: Jse, + Axios: Xse, AxiosError: KX, - CanceledError: Xse, - isCancel: Zse, - CancelToken: Qse, - VERSION: eoe, - all: toe, - Cancel: roe, - isAxiosError: noe, - spread: ioe, - toFormData: soe, - AxiosHeaders: ooe, - HttpStatusCode: aoe, - formToJSON: coe, - getAdapter: uoe, - mergeConfig: foe + CanceledError: Zse, + isCancel: Qse, + CancelToken: eoe, + VERSION: toe, + all: roe, + Cancel: noe, + isAxiosError: ioe, + spread: soe, + toFormData: ooe, + AxiosHeaders: aoe, + HttpStatusCode: coe, + formToJSON: uoe, + getAdapter: foe, + mergeConfig: loe } = mn, US = mn.create({ timeout: 6e4, headers: { - "Content-Type": "application/json" + "Content-Type": "application/json", + token: localStorage.getItem("auth") } }); function VX(t) { @@ -30759,6 +30761,15 @@ class GX { async tonLogin(e) { return (await this.request.post(`${this._apiBase}/api/v2/user/login`, e)).data; } + async bindEmail(e) { + return (await this.request.post("/api/v2/user/account/bind", e)).data; + } + async bindTonWallet(e) { + return (await this.request.post("/api/v2/user/account/bind", e)).data; + } + async bindEvmWallet(e) { + return (await this.request.post("/api/v2/user/account/bind", e)).data; + } } const ya = new GX(US), YX = { projectId: "7a4434fefbcc9af474fb5c995e47d286", @@ -30782,39 +30793,39 @@ const ya = new GX(US), YX = { function gp() { return Tn(jS); } -function loe(t) { +function hoe(t) { const { apiBaseUrl: e } = t, [r, n] = fr([]), [i, s] = fr([]), [o, a] = fr(null), [u, l] = fr(!1), d = (A) => { console.log("saveLastUsedWallet", A); }; function g(A) { - const M = A.filter((F) => F.featured || F.installed), N = A.filter((F) => !F.featured && !F.installed), L = [...M, ...N]; + const M = A.filter(($) => $.featured || $.installed), N = A.filter(($) => !$.featured && !$.installed), L = [...M, ...N]; n(L), s(M); } async function w() { const A = [], M = /* @__PURE__ */ new Map(); RR.forEach((L) => { - const F = new ml(L); - L.name === "Coinbase Wallet" && F.EIP6963Detected({ + const $ = new ml(L); + L.name === "Coinbase Wallet" && $.EIP6963Detected({ info: { name: "Coinbase Wallet", uuid: "coinbase", icon: L.image, rdns: "coinbase" }, provider: JX.getProvider() - }), M.set(F.key, F), A.push(F); + }), M.set($.key, $), A.push($); }), (await TG()).forEach((L) => { - const F = M.get(L.info.name); - if (F) - F.EIP6963Detected(L); + const $ = M.get(L.info.name); + if ($) + $.EIP6963Detected(L); else { - const $ = new ml(L); - M.set($.key, $), A.push($); + const F = new ml(L); + M.set(F.key, F), A.push(F); } }); try { - const L = JSON.parse(localStorage.getItem("xn-last-used-info") || "{}"), F = M.get(L.key); - if (F) { - if (F.lastUsed = !0, L.provider === "UniversalProvider") { - const $ = await EE.init(YX); - $.session && F.setUniversalProvider($); + const L = JSON.parse(localStorage.getItem("xn-last-used-info") || "{}"), $ = M.get(L.key); + if ($) { + if ($.lastUsed = !0, L.provider === "UniversalProvider") { + const F = await EE.init(YX); + F.session && $.setUniversalProvider(F); } - a(F); + a($); } } catch (L) { console.log(L); @@ -31027,9 +31038,9 @@ const oZ = Ps("Mail", [ const WS = Ps("Search", [ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }], ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }] -]), H_ = /* @__PURE__ */ new Set(); +]), W_ = /* @__PURE__ */ new Set(); function mp(t, e, r) { - t || H_.has(e) || (console.warn(e), H_.add(e)); + t || W_.has(e) || (console.warn(e), W_.add(e)); } function aZ(t) { if (typeof Proxy > "u") @@ -31062,28 +31073,28 @@ function KS(t, e) { function Ml(t) { return typeof t == "string" || Array.isArray(t); } -function W_(t) { +function K_(t) { const e = [{}, {}]; return t == null || t.values.forEach((r, n) => { e[0][n] = r.get(), e[1][n] = r.getVelocity(); }), e; } -function Pb(t, e, r, n) { +function Mb(t, e, r, n) { if (typeof e == "function") { - const [i, s] = W_(n); + const [i, s] = K_(n); e = e(r !== void 0 ? r : t.custom, i, s); } if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") { - const [i, s] = W_(n); + const [i, s] = K_(n); e = e(r !== void 0 ? r : t.custom, i, s); } return e; } function bp(t, e, r) { const n = t.getProps(); - return Pb(n, e, r !== void 0 ? r : n.custom, t); + return Mb(n, e, r !== void 0 ? r : n.custom, t); } -const Mb = [ +const Ib = [ "animate", "whileInView", "whileFocus", @@ -31091,7 +31102,7 @@ const Mb = [ "whileTap", "whileDrag", "exit" -], Ib = ["initial", ...Mb], oh = [ +], Cb = ["initial", ...Ib], oh = [ "transformPerspective", "x", "y", @@ -31127,7 +31138,7 @@ const Mb = [ ease: [0.25, 0.1, 0.35, 1], duration: 0.3 }, hZ = (t, { keyframes: e }) => e.length > 2 ? fZ : Sc.has(t) ? t.startsWith("scale") ? uZ(e[1]) : cZ : lZ; -function Cb(t, e) { +function Tb(t, e) { return t ? t[e] || t.default || t : void 0; } const dZ = { @@ -31196,18 +31207,18 @@ function VS(t, e) { delta: 0, timestamp: 0, isProcessing: !1 - }, s = () => r = !0, o = pd.reduce((F, $) => (F[$] = gZ(s), F), {}), { read: a, resolveKeyframes: u, update: l, preRender: d, render: g, postRender: w } = o, A = () => { - const F = performance.now(); - r = !1, i.delta = n ? 1e3 / 60 : Math.max(Math.min(F - i.timestamp, mZ), 1), i.timestamp = F, i.isProcessing = !0, a.process(i), u.process(i), l.process(i), d.process(i), g.process(i), w.process(i), i.isProcessing = !1, r && e && (n = !1, t(A)); + }, s = () => r = !0, o = pd.reduce(($, F) => ($[F] = gZ(s), $), {}), { read: a, resolveKeyframes: u, update: l, preRender: d, render: g, postRender: w } = o, A = () => { + const $ = performance.now(); + r = !1, i.delta = n ? 1e3 / 60 : Math.max(Math.min($ - i.timestamp, mZ), 1), i.timestamp = $, i.isProcessing = !0, a.process(i), u.process(i), l.process(i), d.process(i), g.process(i), w.process(i), i.isProcessing = !1, r && e && (n = !1, t(A)); }, M = () => { r = !0, n = !0, i.isProcessing || t(A); }; - return { schedule: pd.reduce((F, $) => { - const K = o[$]; - return F[$] = (H, V = !1, te = !1) => (r || M(), K.schedule(H, V, te)), F; - }, {}), cancel: (F) => { - for (let $ = 0; $ < pd.length; $++) - o[pd[$]].cancel(F); + return { schedule: pd.reduce(($, F) => { + const K = o[F]; + return $[F] = (H, V = !1, te = !1) => (r || M(), K.schedule(H, V, te)), $; + }, {}), cancel: ($) => { + for (let F = 0; F < pd.length; F++) + o[pd[F]].cancel($); }, state: i, steps: o }; } const { schedule: Lr, cancel: wa, state: Fn, steps: Dm } = VS(typeof requestAnimationFrame < "u" ? requestAnimationFrame : Un, !0), GS = (t, e, r) => (((1 - 3 * r + 3 * e) * t + (3 * r - 6 * e)) * t + 3 * e) * t, vZ = 1e-7, bZ = 12; @@ -31224,7 +31235,7 @@ function ah(t, e, r, n) { const i = (s) => yZ(s, 0, 1, t, r); return (s) => s === 0 || s === 1 ? s : GS(i(s), e, n); } -const YS = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, JS = (t) => (e) => 1 - t(1 - e), XS = /* @__PURE__ */ ah(0.33, 1.53, 0.69, 0.99), Tb = /* @__PURE__ */ JS(XS), ZS = /* @__PURE__ */ YS(Tb), QS = (t) => (t *= 2) < 1 ? 0.5 * Tb(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Rb = (t) => 1 - Math.sin(Math.acos(t)), e7 = JS(Rb), t7 = YS(Rb), r7 = (t) => /^0[^.\s]+$/u.test(t); +const YS = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, JS = (t) => (e) => 1 - t(1 - e), XS = /* @__PURE__ */ ah(0.33, 1.53, 0.69, 0.99), Rb = /* @__PURE__ */ JS(XS), ZS = /* @__PURE__ */ YS(Rb), QS = (t) => (t *= 2) < 1 ? 0.5 * Rb(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Db = (t) => 1 - Math.sin(Math.acos(t)), e7 = JS(Db), t7 = YS(Db), r7 = (t) => /^0[^.\s]+$/u.test(t); function wZ(t) { return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || r7(t) : !0; } @@ -31235,7 +31246,7 @@ process.env.NODE_ENV !== "production" && (Wu = (t, e) => { if (!t) throw new Error(e); }); -const n7 = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), i7 = (t) => (e) => typeof e == "string" && e.startsWith(t), s7 = /* @__PURE__ */ i7("--"), xZ = /* @__PURE__ */ i7("var(--"), Db = (t) => xZ(t) ? _Z.test(t.split("/*")[0].trim()) : !1, _Z = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, EZ = ( +const n7 = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), i7 = (t) => (e) => typeof e == "string" && e.startsWith(t), s7 = /* @__PURE__ */ i7("--"), xZ = /* @__PURE__ */ i7("var(--"), Ob = (t) => xZ(t) ? _Z.test(t.split("/*")[0].trim()) : !1, _Z = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, EZ = ( // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u ); @@ -31257,7 +31268,7 @@ function o7(t, e, r = 1) { const o = s.trim(); return n7(o) ? parseFloat(o) : o; } - return Db(i) ? o7(i, e, r + 1) : i; + return Ob(i) ? o7(i, e, r + 1) : i; } const xa = (t, e, r) => r > e ? e : r < t ? t : r, Ku = { test: (t) => typeof t == "number", @@ -31273,7 +31284,7 @@ const xa = (t, e, r) => r > e ? e : r < t ? t : r, Ku = { test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1, parse: parseFloat, transform: (e) => `${e}${t}` -}), sa = /* @__PURE__ */ ch("deg"), Vs = /* @__PURE__ */ ch("%"), Vt = /* @__PURE__ */ ch("px"), PZ = /* @__PURE__ */ ch("vh"), MZ = /* @__PURE__ */ ch("vw"), K_ = { +}), sa = /* @__PURE__ */ ch("deg"), Vs = /* @__PURE__ */ ch("%"), Vt = /* @__PURE__ */ ch("px"), PZ = /* @__PURE__ */ ch("vh"), MZ = /* @__PURE__ */ ch("vw"), V_ = { ...Vs, parse: (t) => Vs.parse(t) / 100, transform: (t) => Vs.transform(t * 100) @@ -31288,15 +31299,15 @@ const xa = (t, e, r) => r > e ? e : r < t ? t : r, Ku = { "y", "translateX", "translateY" -]), V_ = (t) => t === Ku || t === Vt, G_ = (t, e) => parseFloat(t.split(", ")[e]), Y_ = (t, e) => (r, { transform: n }) => { +]), G_ = (t) => t === Ku || t === Vt, Y_ = (t, e) => parseFloat(t.split(", ")[e]), J_ = (t, e) => (r, { transform: n }) => { if (n === "none" || !n) return 0; const i = n.match(/^matrix3d\((.+)\)$/u); if (i) - return G_(i[1], e); + return Y_(i[1], e); { const s = n.match(/^matrix\((.+)\)$/u); - return s ? G_(s[1], t) : 0; + return s ? Y_(s[1], t) : 0; } }, CZ = /* @__PURE__ */ new Set(["x", "y", "z"]), TZ = oh.filter((t) => !CZ.has(t)); function RZ(t) { @@ -31315,15 +31326,15 @@ const Pu = { bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min), right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min), // Transform - x: Y_(4, 13), - y: Y_(5, 14) + x: J_(4, 13), + y: J_(5, 14) }; Pu.translateX = Pu.x; Pu.translateY = Pu.y; const a7 = (t) => (e) => e.test(t), DZ = { test: (t) => t === "auto", parse: (t) => t -}, c7 = [Ku, Vt, Vs, sa, MZ, PZ, DZ], J_ = (t) => c7.find(a7(t)), ac = /* @__PURE__ */ new Set(); +}, c7 = [Ku, Vt, Vs, sa, MZ, PZ, DZ], X_ = (t) => c7.find(a7(t)), ac = /* @__PURE__ */ new Set(); let X1 = !1, Z1 = !1; function u7() { if (Z1) { @@ -31352,7 +31363,7 @@ function f7() { function OZ() { f7(), u7(); } -class Ob { +class Nb { constructor(e, r, n, i, s, o = !1) { this.isComplete = !1, this.isAsync = !1, this.needsMeasurement = !1, this.isScheduled = !1, this.unresolvedKeyframes = [...e], this.onComplete = r, this.name = n, this.motionValue = i, this.element = s, this.isAsync = o; } @@ -31393,14 +31404,14 @@ class Ob { this.isComplete || this.scheduleResolve(); } } -const Gf = (t) => Math.round(t * 1e5) / 1e5, Nb = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; +const Gf = (t) => Math.round(t * 1e5) / 1e5, Lb = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; function NZ(t) { return t == null; } -const LZ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, Lb = (t, e) => (r) => !!(typeof r == "string" && LZ.test(r) && r.startsWith(t) || e && !NZ(r) && Object.prototype.hasOwnProperty.call(r, e)), l7 = (t, e, r) => (n) => { +const LZ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, kb = (t, e) => (r) => !!(typeof r == "string" && LZ.test(r) && r.startsWith(t) || e && !NZ(r) && Object.prototype.hasOwnProperty.call(r, e)), l7 = (t, e, r) => (n) => { if (typeof n != "string") return n; - const [i, s, o, a] = n.match(Nb); + const [i, s, o, a] = n.match(Lb); return { [t]: parseFloat(i), [e]: parseFloat(s), @@ -31411,7 +31422,7 @@ const LZ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s ...Ku, transform: (t) => Math.round(kZ(t)) }, ic = { - test: /* @__PURE__ */ Lb("rgb", "red"), + test: /* @__PURE__ */ kb("rgb", "red"), parse: /* @__PURE__ */ l7("red", "green", "blue"), transform: ({ red: t, green: e, blue: r, alpha: n = 1 }) => "rgba(" + Om.transform(t) + ", " + Om.transform(e) + ", " + Om.transform(r) + ", " + Gf(Il.transform(n)) + ")" }; @@ -31425,11 +31436,11 @@ function $Z(t) { }; } const Q1 = { - test: /* @__PURE__ */ Lb("#"), + test: /* @__PURE__ */ kb("#"), parse: $Z, transform: ic.transform }, Qc = { - test: /* @__PURE__ */ Lb("hsl", "hue"), + test: /* @__PURE__ */ kb("hsl", "hue"), parse: /* @__PURE__ */ l7("hue", "saturation", "lightness"), transform: ({ hue: t, saturation: e, lightness: r, alpha: n = 1 }) => "hsla(" + Math.round(t) + ", " + Vs.transform(Gf(e)) + ", " + Vs.transform(Gf(r)) + ", " + Gf(Il.transform(n)) + ")" }, Gn = { @@ -31439,9 +31450,9 @@ const Q1 = { }, FZ = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu; function BZ(t) { var e, r; - return isNaN(t) && typeof t == "string" && (((e = t.match(Nb)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match(FZ)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; + return isNaN(t) && typeof t == "string" && (((e = t.match(Lb)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match(FZ)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; } -const h7 = "number", d7 = "color", UZ = "var", jZ = "var(", X_ = "${}", qZ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; +const h7 = "number", d7 = "color", UZ = "var", jZ = "var(", Z_ = "${}", qZ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; function Cl(t) { const e = t.toString(), r = [], n = { color: [], @@ -31449,7 +31460,7 @@ function Cl(t) { var: [] }, i = []; let s = 0; - const a = e.replace(qZ, (u) => (Gn.test(u) ? (n.color.push(s), i.push(d7), r.push(Gn.parse(u))) : u.startsWith(jZ) ? (n.var.push(s), i.push(UZ), r.push(u)) : (n.number.push(s), i.push(h7), r.push(parseFloat(u))), ++s, X_)).split(X_); + const a = e.replace(qZ, (u) => (Gn.test(u) ? (n.color.push(s), i.push(d7), r.push(Gn.parse(u))) : u.startsWith(jZ) ? (n.var.push(s), i.push(UZ), r.push(u)) : (n.number.push(s), i.push(h7), r.push(parseFloat(u))), ++s, Z_)).split(Z_); return { values: r, split: a, indexes: n, types: i }; } function p7(t) { @@ -31482,7 +31493,7 @@ function KZ(t) { const [e, r] = t.slice(0, -1).split("("); if (e === "drop-shadow") return t; - const [n] = r.match(Nb) || []; + const [n] = r.match(Lb) || []; if (!n) return t; const i = r.replace(n, ""); @@ -31553,23 +31564,23 @@ const VZ = /\b([a-z-]*)\(.*?\)/gu, ev = { perspective: Vt, transformPerspective: Vt, opacity: Il, - originX: K_, - originY: K_, + originX: V_, + originY: V_, originZ: Vt -}, Z_ = { +}, Q_ = { ...Ku, transform: Math.round -}, kb = { +}, $b = { ...GZ, ...YZ, - zIndex: Z_, + zIndex: Q_, size: Vt, // SVG fillOpacity: Il, strokeOpacity: Il, - numOctaves: Z_ + numOctaves: Q_ }, JZ = { - ...kb, + ...$b, // Color props color: Gn, backgroundColor: Gn, @@ -31584,9 +31595,9 @@ const VZ = /\b([a-z-]*)\(.*?\)/gu, ev = { borderLeftColor: Gn, filter: ev, WebkitFilter: ev -}, $b = (t) => JZ[t]; +}, Fb = (t) => JZ[t]; function m7(t, e) { - let r = $b(t); + let r = Fb(t); return r !== ev && (r = _a), r.getAnimatableNone ? r.getAnimatableNone(e) : void 0; } const XZ = /* @__PURE__ */ new Set(["auto", "none", "0"]); @@ -31600,7 +31611,7 @@ function ZZ(t, e, r) { for (const s of e) t[s] = m7(r, i); } -class v7 extends Ob { +class v7 extends Nb { constructor(e, r, n, i, s) { super(e, r, n, i, s, !0); } @@ -31611,16 +31622,16 @@ class v7 extends Ob { super.readKeyframes(); for (let u = 0; u < e.length; u++) { let l = e[u]; - if (typeof l == "string" && (l = l.trim(), Db(l))) { + if (typeof l == "string" && (l = l.trim(), Ob(l))) { const d = o7(l, r.current); d !== void 0 && (e[u] = d), u === e.length - 1 && (this.finalKeyframe = l); } } if (this.resolveNoneKeyframes(), !IZ.has(n) || e.length !== 2) return; - const [i, s] = e, o = J_(i), a = J_(s); + const [i, s] = e, o = X_(i), a = X_(s); if (o !== a) - if (V_(o) && V_(a)) + if (G_(o) && G_(a)) for (let u = 0; u < e.length; u++) { const l = e[u]; typeof l == "string" && (e[u] = parseFloat(l)); @@ -31655,7 +31666,7 @@ class v7 extends Ob { }), this.resolveNoneKeyframes(); } } -function Fb(t) { +function Bb(t) { return typeof t == "function"; } let Fd; @@ -31667,7 +31678,7 @@ const Gs = { set: (t) => { Fd = t, queueMicrotask(QZ); } -}, Q_ = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string +}, e6 = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string (_a.test(t) || t === "0") && // And it contains numbers and/or colors !t.startsWith("url(")); function eQ(t) { @@ -31684,8 +31695,8 @@ function tQ(t, e, r, n) { return !1; if (e === "display" || e === "visibility") return !0; - const s = t[t.length - 1], o = Q_(i, e), a = Q_(s, e); - return Wu(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : eQ(t) || (r === "spring" || Fb(r)) && n; + const s = t[t.length - 1], o = e6(i, e), a = e6(s, e); + return Wu(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : eQ(t) || (r === "spring" || Bb(r)) && n; } const rQ = 40; class b7 { @@ -31770,12 +31781,12 @@ function w7(t, e, r) { const n = Math.max(e - nQ, 0); return y7(r - t(n), e - n); } -const Nm = 1e-3, iQ = 0.01, e6 = 10, sQ = 0.05, oQ = 1; +const Nm = 1e-3, iQ = 0.01, t6 = 10, sQ = 0.05, oQ = 1; function aQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }) { let i, s; - Wu(t <= Ks(e6), "Spring duration must be 10 seconds or less"); + Wu(t <= Ks(t6), "Spring duration must be 10 seconds or less"); let o = 1 - e; - o = xa(sQ, oQ, o), t = xa(iQ, e6, Co(t)), o < 1 ? (i = (l) => { + o = xa(sQ, oQ, o), t = xa(iQ, t6, Co(t)), o < 1 ? (i = (l) => { const d = l * o, g = d * t, w = d - r, A = tv(l, o), M = Math.exp(-g); return Nm - w / A * M; }, s = (l) => { @@ -31815,7 +31826,7 @@ function tv(t, e) { return t * Math.sqrt(1 - e * e); } const fQ = ["duration", "bounce"], lQ = ["stiffness", "damping", "mass"]; -function t6(t, e) { +function r6(t, e) { return e.some((r) => t[r] !== void 0); } function hQ(t) { @@ -31827,7 +31838,7 @@ function hQ(t) { isResolvedFromDuration: !1, ...t }; - if (!t6(t, lQ) && t6(t, fQ)) { + if (!r6(t, lQ) && r6(t, fQ)) { const r = aQ(t); e = { ...e, @@ -31841,20 +31852,20 @@ function x7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { const i = t[0], s = t[t.length - 1], o = { done: !1, value: i }, { stiffness: a, damping: u, mass: l, duration: d, velocity: g, isResolvedFromDuration: w } = hQ({ ...n, velocity: -Co(n.velocity || 0) - }), A = g || 0, M = u / (2 * Math.sqrt(a * l)), N = s - i, L = Co(Math.sqrt(a / l)), F = Math.abs(N) < 5; - r || (r = F ? 0.01 : 2), e || (e = F ? 5e-3 : 0.5); - let $; + }), A = g || 0, M = u / (2 * Math.sqrt(a * l)), N = s - i, L = Co(Math.sqrt(a / l)), $ = Math.abs(N) < 5; + r || (r = $ ? 0.01 : 2), e || (e = $ ? 5e-3 : 0.5); + let F; if (M < 1) { const K = tv(L, M); - $ = (H) => { + F = (H) => { const V = Math.exp(-M * L * H); return s - V * ((A + M * L * N) / K * Math.sin(K * H) + N * Math.cos(K * H)); }; } else if (M === 1) - $ = (K) => s - Math.exp(-L * K) * (N + (A + L * N) * K); + F = (K) => s - Math.exp(-L * K) * (N + (A + L * N) * K); else { const K = L * Math.sqrt(M * M - 1); - $ = (H) => { + F = (H) => { const V = Math.exp(-M * L * H), te = Math.min(K * H, 300); return s - V * ((A + M * L * N) * Math.sinh(te) + K * N * Math.cosh(te)) / K; }; @@ -31862,12 +31873,12 @@ function x7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { return { calculatedDuration: w && d || null, next: (K) => { - const H = $(K); + const H = F(K); if (w) o.done = K >= d; else { let V = 0; - M < 1 && (V = K === 0 ? Ks(A) : w7($, K, H)); + M < 1 && (V = K === 0 ? Ks(A) : w7(F, K, H)); const te = Math.abs(V) <= r, R = Math.abs(s - H) <= e; o.done = te && R; } @@ -31875,17 +31886,17 @@ function x7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { } }; } -function r6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: u, restDelta: l = 0.5, restSpeed: d }) { +function n6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: u, restDelta: l = 0.5, restSpeed: d }) { const g = t[0], w = { done: !1, value: g }, A = (W) => a !== void 0 && W < a || u !== void 0 && W > u, M = (W) => a === void 0 ? u : u === void 0 || Math.abs(a - W) < Math.abs(u - W) ? a : u; let N = r * e; - const L = g + N, F = o === void 0 ? L : o(L); - F !== L && (N = F - g); - const $ = (W) => -N * Math.exp(-W / n), K = (W) => F + $(W), H = (W) => { - const pe = $(W), Ee = K(W); - w.done = Math.abs(pe) <= l, w.value = w.done ? F : Ee; + const L = g + N, $ = o === void 0 ? L : o(L); + $ !== L && (N = $ - g); + const F = (W) => -N * Math.exp(-W / n), K = (W) => $ + F(W), H = (W) => { + const pe = F(W), Ee = K(W); + w.done = Math.abs(pe) <= l, w.value = w.done ? $ : Ee; }; let V, te; const R = (W) => { @@ -31907,25 +31918,25 @@ function r6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 3 } }; } -const dQ = /* @__PURE__ */ ah(0.42, 0, 1, 1), pQ = /* @__PURE__ */ ah(0, 0, 0.58, 1), _7 = /* @__PURE__ */ ah(0.42, 0, 0.58, 1), gQ = (t) => Array.isArray(t) && typeof t[0] != "number", Bb = (t) => Array.isArray(t) && typeof t[0] == "number", n6 = { +const dQ = /* @__PURE__ */ ah(0.42, 0, 1, 1), pQ = /* @__PURE__ */ ah(0, 0, 0.58, 1), _7 = /* @__PURE__ */ ah(0.42, 0, 0.58, 1), gQ = (t) => Array.isArray(t) && typeof t[0] != "number", Ub = (t) => Array.isArray(t) && typeof t[0] == "number", i6 = { linear: Un, easeIn: dQ, easeInOut: _7, easeOut: pQ, - circIn: Rb, + circIn: Db, circInOut: t7, circOut: e7, - backIn: Tb, + backIn: Rb, backInOut: ZS, backOut: XS, anticipate: QS -}, i6 = (t) => { - if (Bb(t)) { +}, s6 = (t) => { + if (Ub(t)) { Uo(t.length === 4, "Cubic bezier arrays must contain four numerical values."); const [e, r, n, i] = t; return ah(e, r, n, i); } else if (typeof t == "string") - return Uo(n6[t] !== void 0, `Invalid easing type '${t}'`), n6[t]; + return Uo(i6[t] !== void 0, `Invalid easing type '${t}'`), i6[t]; return t; }, mQ = (t, e) => (r) => e(t(r)), To = (...t) => t.reduce(mQ), Mu = (t, e, r) => { const n = e - t; @@ -31957,15 +31968,15 @@ const km = (t, e, r) => { const n = t * t, i = r * (e * e - n) + n; return i < 0 ? 0 : Math.sqrt(i); }, bQ = [Q1, ic, Qc], yQ = (t) => bQ.find((e) => e.test(t)); -function s6(t) { +function o6(t) { const e = yQ(t); if (Wu(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e) return !1; let r = e.parse(t); return e === Qc && (r = vQ(r)), r; } -const o6 = (t, e) => { - const r = s6(t), n = s6(e); +const a6 = (t, e) => { + const r = o6(t), n = o6(e); if (!r || !n) return m0(t, e); const i = { ...r }; @@ -31977,11 +31988,11 @@ function wQ(t, e) { function xQ(t, e) { return (r) => Qr(t, e, r); } -function Ub(t) { - return typeof t == "number" ? xQ : typeof t == "string" ? Db(t) ? m0 : Gn.test(t) ? o6 : SQ : Array.isArray(t) ? E7 : typeof t == "object" ? Gn.test(t) ? o6 : _Q : m0; +function jb(t) { + return typeof t == "number" ? xQ : typeof t == "string" ? Ob(t) ? m0 : Gn.test(t) ? a6 : SQ : Array.isArray(t) ? E7 : typeof t == "object" ? Gn.test(t) ? a6 : _Q : m0; } function E7(t, e) { - const r = [...t], n = r.length, i = t.map((s, o) => Ub(s)(s, e[o])); + const r = [...t], n = r.length, i = t.map((s, o) => jb(s)(s, e[o])); return (s) => { for (let o = 0; o < n; o++) r[o] = i[o](s); @@ -31991,7 +32002,7 @@ function E7(t, e) { function _Q(t, e) { const r = { ...t, ...e }, n = {}; for (const i in r) - t[i] !== void 0 && e[i] !== void 0 && (n[i] = Ub(t[i])(t[i], e[i])); + t[i] !== void 0 && e[i] !== void 0 && (n[i] = jb(t[i])(t[i], e[i])); return (i) => { for (const s in n) r[s] = n[s](i); @@ -32012,7 +32023,7 @@ const SQ = (t, e) => { return n.indexes.var.length === i.indexes.var.length && n.indexes.color.length === i.indexes.color.length && n.indexes.number.length >= i.indexes.number.length ? rv.has(t) && !i.values.length || rv.has(e) && !n.values.length ? wQ(t, e) : To(E7(EQ(n, i), i.values), r) : (Wu(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), m0(t, e)); }; function S7(t, e, r) { - return typeof t == "number" && typeof e == "number" && typeof r == "number" ? Qr(t, e, r) : Ub(t)(t, e); + return typeof t == "number" && typeof e == "number" && typeof r == "number" ? Qr(t, e, r) : jb(t)(t, e); } function AQ(t, e, r) { const n = [], i = r || S7, s = t.length - 1; @@ -32061,7 +32072,7 @@ function TQ(t, e) { return t.map(() => e || _7).splice(0, t.length - 1); } function v0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" }) { - const i = gQ(n) ? n.map(i6) : i6(n), s = { + const i = gQ(n) ? n.map(s6) : s6(n), s = { done: !1, value: e[0] }, o = CQ( @@ -32077,14 +32088,14 @@ function v0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" } next: (u) => (s.value = a(u), s.done = u >= t, s) }; } -const a6 = 2e4; +const c6 = 2e4; function RQ(t) { let e = 0; const r = 50; let n = t.next(e); - for (; !n.done && e < a6; ) + for (; !n.done && e < c6; ) e += r, n = t.next(e); - return e >= a6 ? 1 / 0 : e; + return e >= c6 ? 1 / 0 : e; } const DQ = (t) => { const e = ({ timestamp: r }) => t(r); @@ -32098,13 +32109,13 @@ const DQ = (t) => { now: () => Fn.isProcessing ? Fn.timestamp : Gs.now() }; }, OQ = { - decay: r6, - inertia: r6, + decay: n6, + inertia: n6, tween: v0, keyframes: v0, spring: x7 }, NQ = (t) => t / 100; -class jb extends b7 { +class qb extends b7 { constructor(e) { super(e), this.holdTime = null, this.cancelTime = null, this.currentTime = 0, this.playbackSpeed = 1, this.pendingPlayState = "running", this.startTime = null, this.state = "idle", this.stop = () => { if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle") @@ -32113,14 +32124,14 @@ class jb extends b7 { const { onStop: u } = this.options; u && u(); }; - const { name: r, motionValue: n, element: i, keyframes: s } = this.options, o = (i == null ? void 0 : i.KeyframeResolver) || Ob, a = (u, l) => this.onKeyframesResolved(u, l); + const { name: r, motionValue: n, element: i, keyframes: s } = this.options, o = (i == null ? void 0 : i.KeyframeResolver) || Nb, a = (u, l) => this.onKeyframesResolved(u, l); this.resolver = new o(s, a, r, n, i), this.resolver.scheduleResolve(); } flatten() { super.flatten(), this._resolved && Object.assign(this._resolved, this.initPlayback(this._resolved.keyframes)); } initPlayback(e) { - const { type: r = "keyframes", repeat: n = 0, repeatDelay: i = 0, repeatType: s, velocity: o = 0 } = this.options, a = Fb(r) ? r : OQ[r] || v0; + const { type: r = "keyframes", repeat: n = 0, repeatDelay: i = 0, repeatType: s, velocity: o = 0 } = this.options, a = Bb(r) ? r : OQ[r] || v0; let u, l; a !== v0 && typeof e[0] != "number" && (process.env.NODE_ENV !== "production" && Uo(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), u = To(NQ, S7(e[0], e[1])), e = [0, 100]); const d = a({ ...this.options, keyframes: e }); @@ -32154,18 +32165,18 @@ class jb extends b7 { return s.next(0); const { delay: w, repeat: A, repeatType: M, repeatDelay: N, onUpdate: L } = this.options; this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - d / this.speed, this.startTime)), r ? this.currentTime = e : this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = Math.round(e - this.startTime) * this.speed; - const F = this.currentTime - w * (this.speed >= 0 ? 1 : -1), $ = this.speed >= 0 ? F < 0 : F > d; - this.currentTime = Math.max(F, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = d); + const $ = this.currentTime - w * (this.speed >= 0 ? 1 : -1), F = this.speed >= 0 ? $ < 0 : $ > d; + this.currentTime = Math.max($, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = d); let K = this.currentTime, H = s; if (A) { const W = Math.min(this.currentTime, d) / g; let pe = Math.floor(W), Ee = W % 1; !Ee && W >= 1 && (Ee = 1), Ee === 1 && pe--, pe = Math.min(pe, A + 1), !!(pe % 2) && (M === "reverse" ? (Ee = 1 - Ee, N && (Ee -= N / g)) : M === "mirror" && (H = o)), K = xa(0, 1, Ee) * g; } - const V = $ ? { done: !1, value: u[0] } : H.next(K); + const V = F ? { done: !1, value: u[0] } : H.next(K); a && (V.value = a(V.value)); let { done: te } = V; - !$ && l !== null && (te = this.speed >= 0 ? this.currentTime >= d : this.currentTime <= 0); + !F && l !== null && (te = this.speed >= 0 ? this.currentTime >= d : this.currentTime <= 0); const R = this.holdTime === null && (this.state === "finished" || this.state === "running" && te); return R && i !== void 0 && (V.value = yp(u, this.options, i)), L && L(V.value), R && this.finish(), V; } @@ -32242,7 +32253,7 @@ const LQ = /* @__PURE__ */ new Set([ r += t(Mu(0, n - 1, i)) + ", "; return `linear(${r.substring(0, r.length - 2)})`; }; -function qb(t) { +function zb(t) { let e; return () => (e === void 0 && (e = t()), e); } @@ -32250,7 +32261,7 @@ const FQ = { linearEasing: void 0 }; function BQ(t, e) { - const r = qb(t); + const r = zb(t); return () => { var n; return (n = FQ[e]) !== null && n !== void 0 ? n : r(); @@ -32265,7 +32276,7 @@ const b0 = /* @__PURE__ */ BQ(() => { return !0; }, "linearEasing"); function A7(t) { - return !!(typeof t == "function" && b0() || !t || typeof t == "string" && (t in nv || b0()) || Bb(t) || Array.isArray(t) && t.every(A7)); + return !!(typeof t == "function" && b0() || !t || typeof t == "string" && (t in nv || b0()) || Ub(t) || Array.isArray(t) && t.every(A7)); } const Bf = ([t, e, r, n]) => `cubic-bezier(${t}, ${e}, ${r}, ${n})`, nv = { linear: "linear", @@ -32280,7 +32291,7 @@ const Bf = ([t, e, r, n]) => `cubic-bezier(${t}, ${e}, ${r}, ${n})`, nv = { }; function P7(t, e) { if (t) - return typeof t == "function" && b0() ? $Q(t, e) : Bb(t) ? Bf(t) : Array.isArray(t) ? t.map((r) => P7(r, e) || nv.easeOut) : nv[t]; + return typeof t == "function" && b0() ? $Q(t, e) : Ub(t) ? Bf(t) : Array.isArray(t) ? t.map((r) => P7(r, e) || nv.easeOut) : nv[t]; } function UQ(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatType: o = "loop", ease: a = "easeInOut", times: u } = {}) { const l = { [e]: r }; @@ -32295,15 +32306,15 @@ function UQ(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatTyp direction: o === "reverse" ? "alternate" : "normal" }); } -function c6(t, e) { +function u6(t, e) { t.timeline = e, t.onfinish = null; } -const jQ = /* @__PURE__ */ qb(() => Object.hasOwnProperty.call(Element.prototype, "animate")), y0 = 10, qQ = 2e4; +const jQ = /* @__PURE__ */ zb(() => Object.hasOwnProperty.call(Element.prototype, "animate")), y0 = 10, qQ = 2e4; function zQ(t) { - return Fb(t.type) || t.type === "spring" || !A7(t.ease); + return Bb(t.type) || t.type === "spring" || !A7(t.ease); } function HQ(t, e) { - const r = new jb({ + const r = new qb({ ...e, keyframes: t, repeat: 0, @@ -32330,7 +32341,7 @@ const M7 = { function WQ(t) { return t in M7; } -class u6 extends b7 { +class f6 extends b7 { constructor(e) { super(e); const { name: r, motionValue: n, element: i, keyframes: s } = this.options; @@ -32342,11 +32353,11 @@ class u6 extends b7 { if (!(!((n = u.owner) === null || n === void 0) && n.current)) return !1; if (typeof o == "string" && b0() && WQ(o) && (o = M7[o]), zQ(this.options)) { - const { onComplete: w, onUpdate: A, motionValue: M, element: N, ...L } = this.options, F = HQ(e, L); - e = F.keyframes, e.length === 1 && (e[1] = e[0]), i = F.duration, s = F.times, o = F.ease, a = "keyframes"; + const { onComplete: w, onUpdate: A, motionValue: M, element: N, ...L } = this.options, $ = HQ(e, L); + e = $.keyframes, e.length === 1 && (e[1] = e[0]), i = $.duration, s = $.times, o = $.ease, a = "keyframes"; } const g = UQ(u.owner.current, l, e, { ...this.options, duration: i, times: s, ease: o }); - return g.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (c6(g, this.pendingTimeline), this.pendingTimeline = void 0) : g.onfinish = () => { + return g.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (u6(g, this.pendingTimeline), this.pendingTimeline = void 0) : g.onfinish = () => { const { onComplete: w } = this.options; u.set(yp(e, this.options, r)), w && w(), this.cancel(), this.resolveFinishedPromise(); }, { @@ -32419,7 +32430,7 @@ class u6 extends b7 { if (!r) return Un; const { animation: n } = r; - c6(n, e); + u6(n, e); } return Un; } @@ -32450,7 +32461,7 @@ class u6 extends b7 { if (r.playState === "idle" || r.playState === "finished") return; if (this.time) { - const { motionValue: l, onUpdate: d, onComplete: g, element: w, ...A } = this.options, M = new jb({ + const { motionValue: l, onUpdate: d, onComplete: g, element: w, ...A } = this.options, M = new qb({ ...A, keyframes: n, duration: i, @@ -32481,7 +32492,7 @@ class u6 extends b7 { !r.owner.getProps().onUpdate && !i && s !== "mirror" && o !== 0 && a !== "inertia"; } } -const KQ = qb(() => window.ScrollTimeline !== void 0); +const KQ = zb(() => window.ScrollTimeline !== void 0); class VQ { constructor(e) { this.stop = () => this.runAll("stop"), this.animations = e.filter(Boolean); @@ -32550,8 +32561,8 @@ class VQ { function GQ({ when: t, delay: e, delayChildren: r, staggerChildren: n, staggerDirection: i, repeat: s, repeatType: o, repeatDelay: a, from: u, elapsed: l, ...d }) { return !!Object.keys(d).length; } -const zb = (t, e, r, n = {}, i, s) => (o) => { - const a = Cb(n, t) || {}, u = a.delay || n.delay || 0; +const Hb = (t, e, r, n = {}, i, s) => (o) => { + const a = Tb(n, t) || {}, u = a.delay || n.delay || 0; let { elapsed: l = 0 } = n; l = l - Ks(u); let d = { @@ -32582,21 +32593,21 @@ const zb = (t, e, r, n = {}, i, s) => (o) => { d.onUpdate(w), d.onComplete(); }), new VQ([]); } - return !s && u6.supports(d) ? new u6(d) : new jb(d); + return !s && f6.supports(d) ? new f6(d) : new qb(d); }, YQ = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), JQ = (t) => J1(t) ? t[t.length - 1] || 0 : t; -function Hb(t, e) { +function Wb(t, e) { t.indexOf(e) === -1 && t.push(e); } -function Wb(t, e) { +function Kb(t, e) { const r = t.indexOf(e); r > -1 && t.splice(r, 1); } -class Kb { +class Vb { constructor() { this.subscriptions = []; } add(e) { - return Hb(this.subscriptions, e), () => Wb(this.subscriptions, e); + return Wb(this.subscriptions, e), () => Kb(this.subscriptions, e); } notify(e, r, n) { const i = this.subscriptions.length; @@ -32616,7 +32627,7 @@ class Kb { this.subscriptions.length = 0; } } -const f6 = 30, XQ = (t) => !isNaN(parseFloat(t)); +const l6 = 30, XQ = (t) => !isNaN(parseFloat(t)); class ZQ { /** * @param init - The initiating value @@ -32682,7 +32693,7 @@ class ZQ { return process.env.NODE_ENV !== "production" && mp(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e); } on(e, r) { - this.events[e] || (this.events[e] = new Kb()); + this.events[e] || (this.events[e] = new Vb()); const n = this.events[e].add(r); return e === "change" ? () => { n(), Lr.read(() => { @@ -32755,9 +32766,9 @@ class ZQ { */ getVelocity() { const e = Gs.now(); - if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > f6) + if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > l6) return 0; - const r = Math.min(this.updatedAt - this.prevUpdatedAt, f6); + const r = Math.min(this.updatedAt - this.prevUpdatedAt, l6); return y7(parseFloat(this.current) - parseFloat(this.prevFrameValue), r); } /** @@ -32826,7 +32837,7 @@ function eee(t, e) { QQ(t, o, a); } } -const Vb = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), tee = "framerAppearId", I7 = "data-" + Vb(tee); +const Gb = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), tee = "framerAppearId", I7 = "data-" + Gb(tee); function C7(t) { return t.props[I7]; } @@ -32854,17 +32865,17 @@ function T7(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { continue; const M = { delay: r, - ...Cb(o || {}, g) + ...Tb(o || {}, g) }; let N = !1; if (window.MotionHandoffAnimation) { - const F = C7(t); - if (F) { - const $ = window.MotionHandoffAnimation(F, g, Lr); - $ !== null && (M.startTime = $, N = !0); + const $ = C7(t); + if ($) { + const F = window.MotionHandoffAnimation($, g, Lr); + F !== null && (M.startTime = F, N = !0); } } - iv(t, g), w.start(zb(g, w, A, t.shouldReduceMotion && Sc.has(g) ? { type: !1 } : M, t, N)); + iv(t, g), w.start(Hb(g, w, A, t.shouldReduceMotion && Sc.has(g) ? { type: !1 } : M, t, N)); const L = w.animation; L && l.push(L); } @@ -32917,7 +32928,7 @@ function oee(t, e, r = {}) { t.notify("AnimationComplete", e); }); } -const aee = Ib.length; +const aee = Cb.length; function R7(t) { if (!t) return; @@ -32927,17 +32938,17 @@ function R7(t) { } const e = {}; for (let r = 0; r < aee; r++) { - const n = Ib[r], i = t.props[n]; + const n = Cb[r], i = t.props[n]; (Ml(i) || i === !1) && (e[n] = i); } return e; } -const cee = [...Mb].reverse(), uee = Mb.length; +const cee = [...Ib].reverse(), uee = Ib.length; function fee(t) { return (e) => Promise.all(e.map(({ animation: r, options: n }) => oee(t, r, n))); } function lee(t) { - let e = fee(t), r = l6(), n = !0; + let e = fee(t), r = h6(), n = !0; const i = (u) => (l, d) => { var g; const w = bp(t, d, u === "exit" ? (g = t.presenceContext) === null || g === void 0 ? void 0 : g.custom : void 0); @@ -32954,26 +32965,26 @@ function lee(t) { const { props: l } = t, d = R7(t.parent) || {}, g = [], w = /* @__PURE__ */ new Set(); let A = {}, M = 1 / 0; for (let L = 0; L < uee; L++) { - const F = cee[L], $ = r[F], K = l[F] !== void 0 ? l[F] : d[F], H = Ml(K), V = F === u ? $.isActive : null; + const $ = cee[L], F = r[$], K = l[$] !== void 0 ? l[$] : d[$], H = Ml(K), V = $ === u ? F.isActive : null; V === !1 && (M = L); - let te = K === d[F] && K !== l[F] && H; - if (te && n && t.manuallyAnimateOnMount && (te = !1), $.protectedKeys = { ...A }, // If it isn't active and hasn't *just* been set as inactive - !$.isActive && V === null || // If we didn't and don't have any defined prop for this animation type - !K && !$.prevProp || // Or if the prop doesn't define an animation + let te = K === d[$] && K !== l[$] && H; + if (te && n && t.manuallyAnimateOnMount && (te = !1), F.protectedKeys = { ...A }, // If it isn't active and hasn't *just* been set as inactive + !F.isActive && V === null || // If we didn't and don't have any defined prop for this animation type + !K && !F.prevProp || // Or if the prop doesn't define an animation vp(K) || typeof K == "boolean") continue; - const R = hee($.prevProp, K); + const R = hee(F.prevProp, K); let W = R || // If we're making this variant active, we want to always make it active - F === u && $.isActive && !te && H || // If we removed a higher-priority variant (i is in reverse order) + $ === u && F.isActive && !te && H || // If we removed a higher-priority variant (i is in reverse order) L > M && H, pe = !1; const Ee = Array.isArray(K) ? K : [K]; - let Y = Ee.reduce(i(F), {}); + let Y = Ee.reduce(i($), {}); V === !1 && (Y = {}); - const { prevResolvedValues: S = {} } = $, m = { + const { prevResolvedValues: S = {} } = F, m = { ...S, ...Y }, f = (x) => { - W = !0, w.has(x) && (pe = !0, w.delete(x)), $.needsAnimating[x] = !0; + W = !0, w.has(x) && (pe = !0, w.delete(x)), F.needsAnimating[x] = !0; const _ = t.getValue(x); _ && (_.liveStyle = !1); }; @@ -32982,18 +32993,18 @@ function lee(t) { if (A.hasOwnProperty(x)) continue; let v = !1; - J1(_) && J1(E) ? v = !KS(_, E) : v = _ !== E, v ? _ != null ? f(x) : w.add(x) : _ !== void 0 && w.has(x) ? f(x) : $.protectedKeys[x] = !0; + J1(_) && J1(E) ? v = !KS(_, E) : v = _ !== E, v ? _ != null ? f(x) : w.add(x) : _ !== void 0 && w.has(x) ? f(x) : F.protectedKeys[x] = !0; } - $.prevProp = K, $.prevResolvedValues = Y, $.isActive && (A = { ...A, ...Y }), n && t.blockInitialAnimation && (W = !1), W && (!(te && R) || pe) && g.push(...Ee.map((x) => ({ + F.prevProp = K, F.prevResolvedValues = Y, F.isActive && (A = { ...A, ...Y }), n && t.blockInitialAnimation && (W = !1), W && (!(te && R) || pe) && g.push(...Ee.map((x) => ({ animation: x, - options: { type: F } + options: { type: $ } }))); } if (w.size) { const L = {}; - w.forEach((F) => { - const $ = t.getBaseTarget(F), K = t.getValue(F); - K && (K.liveStyle = !0), L[F] = $ ?? null; + w.forEach(($) => { + const F = t.getBaseTarget($), K = t.getValue($); + K && (K.liveStyle = !0), L[$] = F ?? null; }), g.push({ animation: L }); } let N = !!g.length; @@ -33018,7 +33029,7 @@ function lee(t) { setAnimateFunction: s, getState: () => r, reset: () => { - r = l6(), n = !0; + r = h6(), n = !0; } }; } @@ -33033,7 +33044,7 @@ function Ka(t = !1) { prevResolvedValues: {} }; } -function l6() { +function h6() { return { animate: Ka(!0), whileInView: Ka(), @@ -33123,9 +33134,9 @@ function Po(t, e, r, n = { passive: !0 }) { function Ro(t, e, r, n) { return Po(t, e, vee(r), n); } -const h6 = (t, e) => Math.abs(t - e); +const d6 = (t, e) => Math.abs(t - e); function bee(t, e) { - const r = h6(t.x, e.x), n = h6(t.y, e.y); + const r = d6(t.x, e.x), n = d6(t.y, e.y); return Math.sqrt(r ** 2 + n ** 2); } class O7 { @@ -33138,8 +33149,8 @@ class O7 { return; const { point: M } = g, { timestamp: N } = Fn; this.history.push({ ...M, timestamp: N }); - const { onStart: L, onMove: F } = this.handlers; - w || (L && L(this.lastMoveEvent, g), this.startEvent = this.lastMoveEvent), F && F(this.lastMoveEvent, g); + const { onStart: L, onMove: $ } = this.handlers; + w || (L && L(this.lastMoveEvent, g), this.startEvent = this.lastMoveEvent), $ && $(this.lastMoveEvent, g); }, this.handlePointerMove = (g, w) => { this.lastMoveEvent = g, this.lastMoveEventInfo = $m(w, this.transformPagePoint), Lr.update(this.updatePoint, !0); }, this.handlePointerUp = (g, w) => { @@ -33167,14 +33178,14 @@ class O7 { function $m(t, e) { return e ? { point: e(t.point) } : t; } -function d6(t, e) { +function p6(t, e) { return { x: t.x - e.x, y: t.y - e.y }; } function Fm({ point: t }, e) { return { point: t, - delta: d6(t, N7(e)), - offset: d6(t, yee(e)), + delta: p6(t, N7(e)), + offset: p6(t, yee(e)), velocity: wee(e, 0.1) }; } @@ -33211,15 +33222,15 @@ function L7(t) { return e === null ? (e = t, r) : !1; }; } -const p6 = L7("dragHorizontal"), g6 = L7("dragVertical"); +const g6 = L7("dragHorizontal"), m6 = L7("dragVertical"); function k7(t) { let e = !1; if (t === "y") - e = g6(); + e = m6(); else if (t === "x") - e = p6(); + e = g6(); else { - const r = p6(), n = g6(); + const r = g6(), n = m6(); r && n ? e = () => { r(), n(); } : (r && r(), n && n()); @@ -33240,28 +33251,28 @@ function Li(t) { function Aee(t, e, r) { return Math.abs(t - e) <= r; } -function m6(t, e, r, n = 0.5) { +function v6(t, e, r, n = 0.5) { t.origin = n, t.originPoint = Qr(e.min, e.max, t.origin), t.scale = Li(r) / Li(e), t.translate = Qr(r.min, r.max, t.origin) - t.originPoint, (t.scale >= xee && t.scale <= _ee || isNaN(t.scale)) && (t.scale = 1), (t.translate >= Eee && t.translate <= See || isNaN(t.translate)) && (t.translate = 0); } function Yf(t, e, r, n) { - m6(t.x, e.x, r.x, n ? n.originX : void 0), m6(t.y, e.y, r.y, n ? n.originY : void 0); + v6(t.x, e.x, r.x, n ? n.originX : void 0), v6(t.y, e.y, r.y, n ? n.originY : void 0); } -function v6(t, e, r) { +function b6(t, e, r) { t.min = r.min + e.min, t.max = t.min + Li(e); } function Pee(t, e, r) { - v6(t.x, e.x, r.x), v6(t.y, e.y, r.y); + b6(t.x, e.x, r.x), b6(t.y, e.y, r.y); } -function b6(t, e, r) { +function y6(t, e, r) { t.min = e.min - r.min, t.max = t.min + Li(e); } function Jf(t, e, r) { - b6(t.x, e.x, r.x), b6(t.y, e.y, r.y); + y6(t.x, e.x, r.x), y6(t.y, e.y, r.y); } function Mee(t, { min: e, max: r }, n) { return e !== void 0 && t < e ? t = n ? Qr(e, t, n.min) : Math.max(t, e) : r !== void 0 && t > r && (t = n ? Qr(r, t, n.max) : Math.min(t, r)), t; } -function y6(t, e, r) { +function w6(t, e, r) { return { min: e !== void 0 ? t.min + e : void 0, max: r !== void 0 ? t.max + r - (t.max - t.min) : void 0 @@ -33269,18 +33280,18 @@ function y6(t, e, r) { } function Iee(t, { top: e, left: r, bottom: n, right: i }) { return { - x: y6(t.x, r, i), - y: y6(t.y, e, n) + x: w6(t.x, r, i), + y: w6(t.y, e, n) }; } -function w6(t, e) { +function x6(t, e) { let r = e.min - t.min, n = e.max - t.max; return e.max - e.min < t.max - t.min && ([r, n] = [n, r]), { min: r, max: n }; } function Cee(t, e) { return { - x: w6(t.x, e.x), - y: w6(t.y, e.y) + x: x6(t.x, e.x), + y: x6(t.y, e.y) }; } function Tee(t, e) { @@ -33295,30 +33306,30 @@ function Ree(t, e) { const ov = 0.35; function Dee(t = ov) { return t === !1 ? t = 0 : t === !0 && (t = ov), { - x: x6(t, "left", "right"), - y: x6(t, "top", "bottom") + x: _6(t, "left", "right"), + y: _6(t, "top", "bottom") }; } -function x6(t, e, r) { +function _6(t, e, r) { return { - min: _6(t, e), - max: _6(t, r) + min: E6(t, e), + max: E6(t, r) }; } -function _6(t, e) { +function E6(t, e) { return typeof t == "number" ? t : t[e] || 0; } -const E6 = () => ({ +const S6 = () => ({ translate: 0, scale: 1, origin: 0, originPoint: 0 }), tu = () => ({ - x: E6(), - y: E6() -}), S6 = () => ({ min: 0, max: 0 }), ln = () => ({ x: S6(), y: S6() +}), A6 = () => ({ min: 0, max: 0 }), ln = () => ({ + x: A6(), + y: A6() }); function Xi(t) { return [t("x"), t("y")]; @@ -33353,25 +33364,25 @@ function Ga(t) { return av(t) || j7(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY; } function j7(t) { - return A6(t.x) || A6(t.y); + return P6(t.x) || P6(t.y); } -function A6(t) { +function P6(t) { return t && t !== "0%"; } function w0(t, e, r) { const n = t - r, i = e * n; return r + i; } -function P6(t, e, r, n, i) { +function M6(t, e, r, n, i) { return i !== void 0 && (t = w0(t, i, n)), w0(t, r, n) + e; } function cv(t, e = 0, r = 1, n, i) { - t.min = P6(t.min, e, r, n, i), t.max = P6(t.max, e, r, n, i); + t.min = M6(t.min, e, r, n, i), t.max = M6(t.max, e, r, n, i); } function q7(t, { x: e, y: r }) { cv(t.x, e.translate, e.scale, e.originPoint), cv(t.y, r.translate, r.scale, r.originPoint); } -const M6 = 0.999999999999, I6 = 1.0000000000001; +const I6 = 0.999999999999, C6 = 1.0000000000001; function Lee(t, e, r, n = !1) { const i = r.length; if (!i) @@ -33386,17 +33397,17 @@ function Lee(t, e, r, n = !1) { y: -s.scroll.offset.y }), o && (e.x *= o.x.scale, e.y *= o.y.scale, q7(t, o)), n && Ga(s.latestValues) && nu(t, s.latestValues)); } - e.x < I6 && e.x > M6 && (e.x = 1), e.y < I6 && e.y > M6 && (e.y = 1); + e.x < C6 && e.x > I6 && (e.x = 1), e.y < C6 && e.y > I6 && (e.y = 1); } function ru(t, e) { t.min = t.min + e, t.max = t.max + e; } -function C6(t, e, r, n, i = 0.5) { +function T6(t, e, r, n, i = 0.5) { const s = Qr(t.min, t.max, i); cv(t, e, r, s, n); } function nu(t, e) { - C6(t.x, e.x, e.scaleX, e.scale, e.originX), C6(t.y, e.y, e.scaleY, e.scale, e.originY); + T6(t.x, e.x, e.scaleX, e.scale, e.originX), T6(t.y, e.y, e.scaleY, e.scale, e.originY); } function z7(t, e) { return U7(Nee(t.getBoundingClientRect(), e)); @@ -33422,15 +33433,15 @@ class Fee { if (w && !A && (this.openGlobalLock && this.openGlobalLock(), this.openGlobalLock = k7(w), !this.openGlobalLock)) return; this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), Xi((L) => { - let F = this.getAxisMotionValue(L).get() || 0; - if (Vs.test(F)) { - const { projection: $ } = this.visualElement; - if ($ && $.layout) { - const K = $.layout.layoutBox[L]; - K && (F = Li(K) * (parseFloat(F) / 100)); + let $ = this.getAxisMotionValue(L).get() || 0; + if (Vs.test($)) { + const { projection: F } = this.visualElement; + if (F && F.layout) { + const K = F.layout.layoutBox[L]; + K && ($ = Li(K) * (parseFloat($) / 100)); } } - this.originPoint[L] = F; + this.originPoint[L] = $; }), M && Lr.postRender(() => M(d, g)), iv(this.visualElement, "transform"); const { animationState: N } = this.visualElement; N && N.setActive("whileDrag", !0); @@ -33531,7 +33542,7 @@ class Fee { } startAxisValueAnimation(e, r) { const n = this.getAxisMotionValue(e); - return iv(this.visualElement, e), n.start(zb(e, n, 0, r, this.visualElement, !1)); + return iv(this.visualElement, e), n.start(Hb(e, n, 0, r, this.visualElement, !1)); } stopAnimation() { Xi((e) => this.getAxisMotionValue(e).stop()); @@ -33650,7 +33661,7 @@ class Uee extends Ta { this.removeGroupControls(), this.removeListeners(); } } -const T6 = (t) => (e, r) => { +const R6 = (t) => (e, r) => { t && Lr.postRender(() => t(e, r)); }; class jee extends Ta { @@ -33666,8 +33677,8 @@ class jee extends Ta { createPanHandlers() { const { onPanSessionStart: e, onPanStart: r, onPan: n, onPanEnd: i } = this.node.getProps(); return { - onSessionStart: T6(e), - onStart: T6(r), + onSessionStart: R6(e), + onStart: R6(r), onMove: n, onEnd: (s, o) => { delete this.session, i && Lr.postRender(() => i(s, o)); @@ -33694,7 +33705,7 @@ function qee() { const s = vv(() => r && r(i), [i, r]); return !e && r ? [!1, s] : [!0]; } -const Gb = Sa({}), W7 = Sa({}), Bd = { +const Yb = Sa({}), W7 = Sa({}), Bd = { /** * Global flag as to whether the tree has animated since the last time * we resized the window @@ -33706,7 +33717,7 @@ const Gb = Sa({}), W7 = Sa({}), Bd = { */ hasEverUpdated: !1 }; -function R6(t, e) { +function D6(t, e) { return e.max === e.min ? 0 : t / (e.max - e.min) * 100; } const Df = { @@ -33718,7 +33729,7 @@ const Df = { t = parseFloat(t); else return t; - const r = R6(t, e.target.x), n = R6(t, e.target.y); + const r = D6(t, e.target.x), n = D6(t, e.target.y); return `${r}% ${n}%`; } }, zee = { @@ -33735,7 +33746,7 @@ const Df = { function Hee(t) { Object.assign(x0, t); } -const { schedule: Yb } = VS(queueMicrotask, !1); +const { schedule: Jb } = VS(queueMicrotask, !1); class Wee extends AR { /** * This only mounts projection nodes for components that @@ -33760,7 +33771,7 @@ class Wee extends AR { } componentDidUpdate() { const { projection: e } = this.props.visualElement; - e && (e.root.didUpdate(), Yb.postRender(() => { + e && (e.root.didUpdate(), Jb.postRender(() => { !e.currentAnimation && e.isLead() && this.safeToRemove(); })); } @@ -33777,7 +33788,7 @@ class Wee extends AR { } } function K7(t) { - const [e, r] = qee(), n = Tn(Gb); + const [e, r] = qee(), n = Tn(Yb); return me.jsx(Wee, { ...t, layoutGroup: n, switchLayoutGroup: Tn(W7), isPresent: e, safeToRemove: r }); } const Kee = { @@ -33795,7 +33806,7 @@ const Kee = { borderBottomLeftRadius: Df, borderBottomRightRadius: Df, boxShadow: zee -}, V7 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], Vee = V7.length, D6 = (t) => typeof t == "string" ? parseFloat(t) : t, O6 = (t) => typeof t == "number" || Vt.test(t); +}, V7 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], Vee = V7.length, O6 = (t) => typeof t == "string" ? parseFloat(t) : t, N6 = (t) => typeof t == "number" || Vt.test(t); function Gee(t, e, r, n, i, s) { i ? (t.opacity = Qr( 0, @@ -33805,67 +33816,67 @@ function Gee(t, e, r, n, i, s) { ), t.opacityExit = Qr(e.opacity !== void 0 ? e.opacity : 1, 0, Jee(n))) : s && (t.opacity = Qr(e.opacity !== void 0 ? e.opacity : 1, r.opacity !== void 0 ? r.opacity : 1, n)); for (let o = 0; o < Vee; o++) { const a = `border${V7[o]}Radius`; - let u = N6(e, a), l = N6(r, a); + let u = L6(e, a), l = L6(r, a); if (u === void 0 && l === void 0) continue; - u || (u = 0), l || (l = 0), u === 0 || l === 0 || O6(u) === O6(l) ? (t[a] = Math.max(Qr(D6(u), D6(l), n), 0), (Vs.test(l) || Vs.test(u)) && (t[a] += "%")) : t[a] = l; + u || (u = 0), l || (l = 0), u === 0 || l === 0 || N6(u) === N6(l) ? (t[a] = Math.max(Qr(O6(u), O6(l), n), 0), (Vs.test(l) || Vs.test(u)) && (t[a] += "%")) : t[a] = l; } (e.rotate || r.rotate) && (t.rotate = Qr(e.rotate || 0, r.rotate || 0, n)); } -function N6(t, e) { +function L6(t, e) { return t[e] !== void 0 ? t[e] : t.borderRadius; } const Yee = /* @__PURE__ */ G7(0, 0.5, e7), Jee = /* @__PURE__ */ G7(0.5, 0.95, Un); function G7(t, e, r) { return (n) => n < t ? 0 : n > e ? 1 : r(Mu(t, e, n)); } -function L6(t, e) { +function k6(t, e) { t.min = e.min, t.max = e.max; } function Yi(t, e) { - L6(t.x, e.x), L6(t.y, e.y); + k6(t.x, e.x), k6(t.y, e.y); } -function k6(t, e) { +function $6(t, e) { t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin; } -function $6(t, e, r, n, i) { +function F6(t, e, r, n, i) { return t -= e, t = w0(t, 1 / r, n), i !== void 0 && (t = w0(t, 1 / i, n)), t; } function Xee(t, e = 0, r = 1, n = 0.5, i, s = t, o = t) { if (Vs.test(e) && (e = parseFloat(e), e = Qr(o.min, o.max, e / 100) - o.min), typeof e != "number") return; let a = Qr(s.min, s.max, n); - t === s && (a -= e), t.min = $6(t.min, e, r, a, i), t.max = $6(t.max, e, r, a, i); + t === s && (a -= e), t.min = F6(t.min, e, r, a, i), t.max = F6(t.max, e, r, a, i); } -function F6(t, e, [r, n, i], s, o) { +function B6(t, e, [r, n, i], s, o) { Xee(t, e[r], e[n], e[i], e.scale, s, o); } const Zee = ["x", "scaleX", "originX"], Qee = ["y", "scaleY", "originY"]; -function B6(t, e, r, n) { - F6(t.x, e, Zee, r ? r.x : void 0, n ? n.x : void 0), F6(t.y, e, Qee, r ? r.y : void 0, n ? n.y : void 0); +function U6(t, e, r, n) { + B6(t.x, e, Zee, r ? r.x : void 0, n ? n.x : void 0), B6(t.y, e, Qee, r ? r.y : void 0, n ? n.y : void 0); } -function U6(t) { +function j6(t) { return t.translate === 0 && t.scale === 1; } function Y7(t) { - return U6(t.x) && U6(t.y); + return j6(t.x) && j6(t.y); } -function j6(t, e) { +function q6(t, e) { return t.min === e.min && t.max === e.max; } function ete(t, e) { - return j6(t.x, e.x) && j6(t.y, e.y); + return q6(t.x, e.x) && q6(t.y, e.y); } -function q6(t, e) { +function z6(t, e) { return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max); } function J7(t, e) { - return q6(t.x, e.x) && q6(t.y, e.y); + return z6(t.x, e.x) && z6(t.y, e.y); } -function z6(t) { +function H6(t) { return Li(t.x) / Li(t.y); } -function H6(t, e) { +function W6(t, e) { return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint; } class tte { @@ -33873,10 +33884,10 @@ class tte { this.members = []; } add(e) { - Hb(this.members, e), e.scheduleRender(); + Wb(this.members, e), e.scheduleRender(); } remove(e) { - if (Wb(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) { + if (Kb(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) { const r = this.members[this.members.length - 1]; r && this.promote(r); } @@ -33938,10 +33949,10 @@ class ite { this.children = [], this.isDirty = !1; } add(e) { - Hb(this.children, e), this.isDirty = !0; + Wb(this.children, e), this.isDirty = !0; } remove(e) { - Wb(this.children, e), this.isDirty = !0; + Kb(this.children, e), this.isDirty = !0; } forEach(e) { this.isDirty && this.children.sort(nte), this.isDirty = !1, this.children.forEach(e); @@ -33963,14 +33974,14 @@ function ote(t) { } function ate(t, e, r) { const n = Jn(t) ? t : Tl(t); - return n.start(zb("", n, e, r)), n.animation; + return n.start(Hb("", n, e, r)), n.animation; } const Ya = { type: "projectionFrame", totalNodes: 0, resolvedTargetDeltas: 0, recalculatedProjection: 0 -}, Uf = typeof window < "u" && window.MotionDebug !== void 0, Um = ["", "X", "Y", "Z"], cte = { visibility: "hidden" }, W6 = 1e3; +}, Uf = typeof window < "u" && window.MotionDebug !== void 0, Um = ["", "X", "Y", "Z"], cte = { visibility: "hidden" }, K6 = 1e3; let ute = 0; function jm(t, e, r, n) { const { latestValues: i } = e; @@ -34003,7 +34014,7 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.root === this && (this.nodes = new ite()); } addEventListener(o, a) { - return this.eventHandlers.has(o) || this.eventHandlers.set(o, new Kb()), this.eventHandlers.get(o).add(a); + return this.eventHandlers.has(o) || this.eventHandlers.set(o, new Vb()), this.eventHandlers.get(o).add(a); } notifyListeners(o, ...a) { const u = this.eventHandlers.get(o); @@ -34024,7 +34035,7 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check let g; const w = () => this.root.updateBlockedByResize = !1; t(o, () => { - this.root.updateBlockedByResize = !0, g && g(), g = ste(w, 250), Bd.hasAnimatedSinceResize && (Bd.hasAnimatedSinceResize = !1, this.nodes.forEach(V6)); + this.root.updateBlockedByResize = !0, g && g(), g = ste(w, 250), Bd.hasAnimatedSinceResize && (Bd.hasAnimatedSinceResize = !1, this.nodes.forEach(G6)); }); } u && this.root.registerSharedNode(u, this), this.options.animate !== !1 && d && (u || l) && this.addEventListener("didUpdate", ({ delta: g, hasLayoutChanged: w, hasRelativeTargetChanged: A, layout: M }) => { @@ -34032,17 +34043,17 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.target = void 0, this.relativeTarget = void 0; return; } - const N = this.options.transition || d.getDefaultTransition() || Ete, { onLayoutAnimationStart: L, onLayoutAnimationComplete: F } = d.getProps(), $ = !this.targetLayout || !J7(this.targetLayout, M) || A, K = !w && A; - if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || K || w && ($ || !this.currentAnimation)) { + const N = this.options.transition || d.getDefaultTransition() || Ete, { onLayoutAnimationStart: L, onLayoutAnimationComplete: $ } = d.getProps(), F = !this.targetLayout || !J7(this.targetLayout, M) || A, K = !w && A; + if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || K || w && (F || !this.currentAnimation)) { this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0), this.setAnimationOrigin(g, K); const H = { - ...Cb(N, "layout"), + ...Tb(N, "layout"), onPlay: L, - onComplete: F + onComplete: $ }; (d.shouldReduceMotion || this.options.layoutRoot) && (H.delay = 0, H.type = !1), this.startAnimation(H); } else - w || V6(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete(); + w || G6(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete(); this.targetLayout = M; }); } @@ -34092,7 +34103,7 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check } update() { if (this.updateScheduled = !1, this.isUpdateBlocked()) { - this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(K6); + this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(V6); return; } this.isUpdating || this.nodes.forEach(gte), this.isUpdating = !1, this.nodes.forEach(mte), this.nodes.forEach(fte), this.nodes.forEach(lte), this.clearAllSnapshots(); @@ -34100,7 +34111,7 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check Fn.delta = xa(0, 1e3 / 60, a - Fn.timestamp), Fn.timestamp = a, Fn.isProcessing = !0, Dm.update.process(Fn), Dm.preRender.process(Fn), Dm.render.process(Fn), Fn.isProcessing = !1; } didUpdate() { - this.updateScheduled || (this.updateScheduled = !0, Yb.read(this.scheduleUpdate)); + this.updateScheduled || (this.updateScheduled = !0, Jb.read(this.scheduleUpdate)); } clearAllSnapshots() { this.nodes.forEach(pte), this.sharedNodes.forEach(wte); @@ -34204,9 +34215,9 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check continue; av(l.latestValues) && l.updateSnapshot(); const d = ln(), g = l.measurePageBox(); - Yi(d, g), B6(a, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, d); + Yi(d, g), U6(a, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, d); } - return Ga(this.latestValues) && B6(a, this.latestValues), a; + return Ga(this.latestValues) && U6(a, this.latestValues), a; } setTargetDelta(o) { this.targetDelta = o, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0; @@ -34271,7 +34282,7 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender()); return; } - !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (k6(this.prevProjectionDelta.x, this.projectionDelta.x), k6(this.prevProjectionDelta.y, this.projectionDelta.y)), Yf(this.projectionDelta, this.layoutCorrected, M, this.latestValues), (this.treeScale.x !== w || this.treeScale.y !== A || !H6(this.projectionDelta.x, this.prevProjectionDelta.x) || !H6(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", M)), Uf && Ya.recalculatedProjection++; + !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : ($6(this.prevProjectionDelta.x, this.projectionDelta.x), $6(this.prevProjectionDelta.y, this.projectionDelta.y)), Yf(this.projectionDelta, this.layoutCorrected, M, this.latestValues), (this.treeScale.x !== w || this.treeScale.y !== A || !W6(this.projectionDelta.x, this.prevProjectionDelta.x) || !W6(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", M)), Uf && Ya.recalculatedProjection++; } hide() { this.isVisible = !1; @@ -34293,17 +34304,17 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check setAnimationOrigin(o, a = !1) { const u = this.snapshot, l = u ? u.latestValues : {}, d = { ...this.latestValues }, g = tu(); (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !a; - const w = ln(), A = u ? u.source : void 0, M = this.layout ? this.layout.source : void 0, N = A !== M, L = this.getStack(), F = !L || L.members.length <= 1, $ = !!(N && !F && this.options.crossfade === !0 && !this.path.some(_te)); + const w = ln(), A = u ? u.source : void 0, M = this.layout ? this.layout.source : void 0, N = A !== M, L = this.getStack(), $ = !L || L.members.length <= 1, F = !!(N && !$ && this.options.crossfade === !0 && !this.path.some(_te)); this.animationProgress = 0; let K; this.mixTargetDelta = (H) => { const V = H / 1e3; - G6(g.x, o.x, V), G6(g.y, o.y, V), this.setTargetDelta(g), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Jf(w, this.layout.layoutBox, this.relativeParent.layout.layoutBox), xte(this.relativeTarget, this.relativeTargetOrigin, w, V), K && ete(this.relativeTarget, K) && (this.isProjectionDirty = !1), K || (K = ln()), Yi(K, this.relativeTarget)), N && (this.animationValues = d, Gee(d, l, this.latestValues, V, $, F)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V; + Y6(g.x, o.x, V), Y6(g.y, o.y, V), this.setTargetDelta(g), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Jf(w, this.layout.layoutBox, this.relativeParent.layout.layoutBox), xte(this.relativeTarget, this.relativeTargetOrigin, w, V), K && ete(this.relativeTarget, K) && (this.isProjectionDirty = !1), K || (K = ln()), Yi(K, this.relativeTarget)), N && (this.animationValues = d, Gee(d, l, this.latestValues, V, F, $)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V; }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0); } startAnimation(o) { this.notifyListeners("animationStart"), this.currentAnimation && this.currentAnimation.stop(), this.resumingFrom && this.resumingFrom.currentAnimation && this.resumingFrom.currentAnimation.stop(), this.pendingAnimation && (wa(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = Lr.update(() => { - Bd.hasAnimatedSinceResize = !0, this.currentAnimation = ate(0, W6, { + Bd.hasAnimatedSinceResize = !0, this.currentAnimation = ate(0, K6, { ...o, onUpdate: (a) => { this.mixTargetDelta(a), o.onUpdate && o.onUpdate(a); @@ -34320,7 +34331,7 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check o && o.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete"); } finishAnimation() { - this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(W6), this.currentAnimation.stop()), this.completeAnimation(); + this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(K6), this.currentAnimation.stop()), this.completeAnimation(); } applyTransformsToTarget() { const o = this.getLead(); @@ -34411,13 +34422,13 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check for (const N in x0) { if (w[N] === void 0) continue; - const { correct: L, applyTo: F } = x0[N], $ = l.transform === "none" ? w[N] : L(w[N], g); - if (F) { - const K = F.length; + const { correct: L, applyTo: $ } = x0[N], F = l.transform === "none" ? w[N] : L(w[N], g); + if ($) { + const K = $.length; for (let H = 0; H < K; H++) - l[F[H]] = $; + l[$[H]] = F; } else - l[N] = $; + l[N] = F; } return this.options.layoutId && (l.pointerEvents = g === this ? Ud(o == null ? void 0 : o.pointerEvents) || "" : "none"), l; } @@ -34429,7 +34440,7 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.root.nodes.forEach((o) => { var a; return (a = o.currentAnimation) === null || a === void 0 ? void 0 : a.stop(); - }), this.root.nodes.forEach(K6), this.root.sharedNodes.clear(); + }), this.root.nodes.forEach(V6), this.root.sharedNodes.clear(); } }; } @@ -34489,7 +34500,7 @@ function dte(t) { function pte(t) { t.clearSnapshot(); } -function K6(t) { +function V6(t) { t.clearMeasurements(); } function gte(t) { @@ -34499,7 +34510,7 @@ function mte(t) { const { visualElement: e } = t.options; e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform(); } -function V6(t) { +function G6(t) { t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0; } function vte(t) { @@ -34514,14 +34525,14 @@ function yte(t) { function wte(t) { t.removeLeadSnapshot(); } -function G6(t, e, r) { +function Y6(t, e, r) { t.translate = Qr(e.translate, 0, r), t.scale = Qr(e.scale, 1, r), t.origin = e.origin, t.originPoint = e.originPoint; } -function Y6(t, e, r, n) { +function J6(t, e, r, n) { t.min = Qr(e.min, r.min, n), t.max = Qr(e.max, r.max, n); } function xte(t, e, r, n) { - Y6(t.x, e.x, r.x, n), Y6(t.y, e.y, r.y, n); + J6(t.x, e.x, r.x, n), J6(t.y, e.y, r.y, n); } function _te(t) { return t.animationValues && t.animationValues.opacityExit !== void 0; @@ -34529,15 +34540,15 @@ function _te(t) { const Ete = { duration: 0.45, ease: [0.4, 0, 0.1, 1] -}, J6 = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), X6 = J6("applewebkit/") && !J6("chrome/") ? Math.round : Un; -function Z6(t) { - t.min = X6(t.min), t.max = X6(t.max); +}, X6 = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Z6 = X6("applewebkit/") && !X6("chrome/") ? Math.round : Un; +function Q6(t) { + t.min = Z6(t.min), t.max = Z6(t.max); } function Ste(t) { - Z6(t.x), Z6(t.y); + Q6(t.x), Q6(t.y); } function Q7(t, e, r) { - return t === "position" || t === "preserve-aspect" && !Aee(z6(e), z6(r), 0.2); + return t === "position" || t === "preserve-aspect" && !Aee(H6(e), H6(r), 0.2); } function Ate(t) { var e; @@ -34578,7 +34589,7 @@ const Pte = Z7({ MeasureLayout: K7 } }; -function Q6(t, e) { +function e5(t, e) { const r = e ? "pointerenter" : "pointerleave", n = e ? "onHoverStart" : "onHoverEnd", i = (s, o) => { if (s.pointerType === "touch" || $7()) return; @@ -34593,7 +34604,7 @@ function Q6(t, e) { } class Ite extends Ta { mount() { - this.unmount = To(Q6(this.node, !0), Q6(this.node, !1)); + this.unmount = To(e5(this.node, !0), e5(this.node, !1)); } unmount() { } @@ -34762,14 +34773,14 @@ const Fte = { ProjectionNode: e9, MeasureLayout: K7 } -}, Jb = Sa({ +}, Xb = Sa({ transformPagePoint: (t) => t, isStatic: !1, reducedMotion: "never" -}), _p = Sa({}), Xb = typeof window < "u", r9 = Xb ? PR : Xn, n9 = Sa({ strict: !1 }); +}), _p = Sa({}), Zb = typeof window < "u", r9 = Zb ? PR : Xn, n9 = Sa({ strict: !1 }); function Ute(t, e, r, n, i) { var s, o; - const { visualElement: a } = Tn(_p), u = Tn(n9), l = Tn(xp), d = Tn(Jb).reducedMotion, g = bi(); + const { visualElement: a } = Tn(_p), u = Tn(n9), l = Tn(xp), d = Tn(Xb).reducedMotion, g = bi(); n = n || u.renderer, !g.current && n && (g.current = n(t, { visualState: e, parent: a, @@ -34781,16 +34792,16 @@ function Ute(t, e, r, n, i) { const w = g.current, A = Tn(W7); w && !w.projection && i && (w.type === "html" || w.type === "svg") && jte(g.current, r, i, A); const M = bi(!1); - v5(() => { + b5(() => { w && M.current && w.update(r, l); }); const N = r[I7], L = bi(!!N && !(!((s = window.MotionHandoffIsComplete) === null || s === void 0) && s.call(window, N)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, N))); return r9(() => { - w && (M.current = !0, window.MotionIsMounted = !0, w.updateFeatures(), Yb.render(w.render), L.current && w.animationState && w.animationState.animateChanges()); + w && (M.current = !0, window.MotionIsMounted = !0, w.updateFeatures(), Jb.render(w.render), L.current && w.animationState && w.animationState.animateChanges()); }), Xn(() => { w && (!L.current && w.animationState && w.animationState.animateChanges(), L.current && (queueMicrotask(() => { - var F; - (F = window.MotionHandoffMarkAsComplete) === null || F === void 0 || F.call(window, N); + var $; + ($ = window.MotionHandoffMarkAsComplete) === null || $ === void 0 || $.call(window, N); }), L.current = !1)); }), w; } @@ -34832,7 +34843,7 @@ function qte(t, e, r) { ); } function Ep(t) { - return vp(t.animate) || Ib.some((e) => Ml(t[e])); + return vp(t.animate) || Cb.some((e) => Ml(t[e])); } function s9(t) { return !!(Ep(t) || t.variants); @@ -34849,12 +34860,12 @@ function zte(t, e) { } function Hte(t) { const { initial: e, animate: r } = zte(t, Tn(_p)); - return Oi(() => ({ initial: e, animate: r }), [e5(e), e5(r)]); + return Oi(() => ({ initial: e, animate: r }), [t5(e), t5(r)]); } -function e5(t) { +function t5(t) { return Array.isArray(t) ? t.join(" ") : t; } -const t5 = { +const r5 = { animation: [ "animate", "variants", @@ -34874,9 +34885,9 @@ const t5 = { inView: ["whileInView", "onViewportEnter", "onViewportLeave"], layout: ["layout", "layoutId"] }, Iu = {}; -for (const t in t5) +for (const t in r5) Iu[t] = { - isEnabled: (e) => t5[t].some((r) => !!e[r]) + isEnabled: (e) => r5[t].some((r) => !!e[r]) }; function Wte(t) { for (const e in t) @@ -34891,11 +34902,11 @@ function Vte({ preloadedFeatures: t, createVisualElement: e, useRender: r, useVi function s(a, u) { let l; const d = { - ...Tn(Jb), + ...Tn(Xb), ...a, layoutId: Gte(a) }, { isStatic: g } = d, w = Hte(a), A = n(a, g); - if (!g && Xb) { + if (!g && Zb) { Yte(d, t); const M = Jte(d); l = M.MeasureLayout, w.visualElement = Ute(i, A, d, e, M.ProjectionNode); @@ -34906,7 +34917,7 @@ function Vte({ preloadedFeatures: t, createVisualElement: e, useRender: r, useVi return o[Kte] = i, o; } function Gte({ layoutId: t }) { - const e = Tn(Gb).id; + const e = Tn(Yb).id; return e && t !== void 0 ? e + "-" + t : t; } function Yte(t, e) { @@ -34953,7 +34964,7 @@ const Xte = [ "use", "view" ]; -function Zb(t) { +function Qb(t) { return ( /** * If it's not a string, it's a custom React component. Currently we only support @@ -35006,12 +35017,12 @@ const a9 = /* @__PURE__ */ new Set([ function c9(t, e, r, n) { o9(t, e, void 0, n); for (const i in e.attrs) - t.setAttribute(a9.has(i) ? i : Vb(i), e.attrs[i]); + t.setAttribute(a9.has(i) ? i : Gb(i), e.attrs[i]); } function u9(t, { layout: e, layoutId: r }) { return Sc.has(t) || t.startsWith("origin") || (e || r !== void 0) && (!!x0[t] || t === "opacity"); } -function Qb(t, e, r) { +function ey(t, e, r) { var n; const { style: i } = t, s = {}; for (const o in i) @@ -35019,7 +35030,7 @@ function Qb(t, e, r) { return s; } function f9(t, e, r) { - const n = Qb(t, e, r); + const n = ey(t, e, r); for (const i in t) if (Jn(t[i]) || Jn(e[i])) { const s = oh.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i; @@ -35027,7 +35038,7 @@ function f9(t, e, r) { } return n; } -function ey(t) { +function ty(t) { const e = bi(null); return e.current === null && (e.current = t()), e.current; } @@ -35040,7 +35051,7 @@ function Zte({ scrapeMotionValuesFromProps: t, createRenderState: e, onMount: r } const l9 = (t) => (e, r) => { const n = Tn(_p), i = Tn(xp), s = () => Zte(t, e, n, i); - return r ? s() : ey(s); + return r ? s() : ty(s); }; function Qte(t, e, r, n) { const i = {}, s = n(t, {}); @@ -35055,31 +35066,31 @@ function Qte(t, e, r, n) { if (g && typeof g != "boolean" && !vp(g)) { const w = Array.isArray(g) ? g : [g]; for (let A = 0; A < w.length; A++) { - const M = Pb(t, w[A]); + const M = Mb(t, w[A]); if (M) { - const { transitionEnd: N, transition: L, ...F } = M; - for (const $ in F) { - let K = F[$]; + const { transitionEnd: N, transition: L, ...$ } = M; + for (const F in $) { + let K = $[F]; if (Array.isArray(K)) { const H = d ? K.length - 1 : 0; K = K[H]; } - K !== null && (i[$] = K); + K !== null && (i[F] = K); } - for (const $ in N) - i[$] = N[$]; + for (const F in N) + i[F] = N[F]; } } } return i; } -const ty = () => ({ +const ry = () => ({ style: {}, transform: {}, transformOrigin: {}, vars: {} }), h9 = () => ({ - ...ty(), + ...ry(), attrs: {} }), d9 = (t, e) => e && typeof t == "number" ? e.transform(t) : t, ere = { x: "translateX", @@ -35095,7 +35106,7 @@ function rre(t, e, r) { continue; let u = !0; if (typeof a == "number" ? u = a === (o.startsWith("scale") ? 1 : 0) : u = parseFloat(a) === 0, !u || r) { - const l = d9(a, kb[o]); + const l = d9(a, $b[o]); if (!u) { i = !1; const d = ere[o] || o; @@ -35106,7 +35117,7 @@ function rre(t, e, r) { } return n = n.trim(), r ? n = r(e, i ? "" : n) : i && (n = "none"), n; } -function ry(t, e, r) { +function ny(t, e, r) { const { style: n, vars: i, transformOrigin: s } = t; let o = !1, a = !1; for (const u in e) { @@ -35118,7 +35129,7 @@ function ry(t, e, r) { i[u] = l; continue; } else { - const d = d9(l, kb[u]); + const d = d9(l, $b[u]); u.startsWith("origin") ? (a = !0, s[u] = d) : n[u] = d; } } @@ -35127,11 +35138,11 @@ function ry(t, e, r) { n.transformOrigin = `${u} ${l} ${d}`; } } -function r5(t, e, r) { +function n5(t, e, r) { return typeof t == "string" ? t : Vt.transform(e + r * t); } function nre(t, e, r) { - const n = r5(e, t.x, t.width), i = r5(r, t.y, t.height); + const n = n5(e, t.x, t.width), i = n5(r, t.y, t.height); return `${n} ${i}`; } const ire = { @@ -35148,7 +35159,7 @@ function ore(t, e, r = 1, n = 0, i = !0) { const o = Vt.transform(e), a = Vt.transform(r); t[s.array] = `${o} ${a}`; } -function ny(t, { +function iy(t, { attrX: e, attrY: r, attrScale: n, @@ -35160,7 +35171,7 @@ function ny(t, { // This is object creation, which we try to avoid per-frame. ...l }, d, g) { - if (ry(t, l, g), d) { + if (ny(t, l, g), d) { t.style.viewBox && (t.attrs.viewBox = t.style.viewBox); return; } @@ -35168,7 +35179,7 @@ function ny(t, { const { attrs: w, style: A, dimensions: M } = t; w.transform && (M && (A.transform = w.transform), delete w.transform), M && (i !== void 0 || s !== void 0 || A.transform) && (A.transformOrigin = nre(M, i !== void 0 ? i : 0.5, s !== void 0 ? s : 0.5)), e !== void 0 && (w.x = e), r !== void 0 && (w.y = r), n !== void 0 && (w.scale = n), o !== void 0 && ore(w, o, a, u, !1); } -const iy = (t) => typeof t == "string" && t.toLowerCase() === "svg", are = { +const sy = (t) => typeof t == "string" && t.toLowerCase() === "svg", are = { useVisualState: l9({ scrapeMotionValuesFromProps: f9, createRenderState: h9, @@ -35185,14 +35196,14 @@ const iy = (t) => typeof t == "string" && t.toLowerCase() === "svg", are = { }; } }), Lr.render(() => { - ny(r, n, iy(e.tagName), t.transformTemplate), c9(e, r); + iy(r, n, sy(e.tagName), t.transformTemplate), c9(e, r); }); } }) }, cre = { useVisualState: l9({ - scrapeMotionValuesFromProps: Qb, - createRenderState: ty + scrapeMotionValuesFromProps: ey, + createRenderState: ry }) }; function p9(t, e, r) { @@ -35201,8 +35212,8 @@ function p9(t, e, r) { } function ure({ transformTemplate: t }, e) { return Oi(() => { - const r = ty(); - return ry(r, e, t), Object.assign({}, r.vars, r.style); + const r = ry(); + return ny(r, e, t), Object.assign({}, r.vars, r.style); }, [e]); } function fre(t, e) { @@ -35266,7 +35277,7 @@ function pre(t, e, r) { function gre(t, e, r, n) { const i = Oi(() => { const s = h9(); - return ny(s, e, iy(n), t.transformTemplate), { + return iy(s, e, sy(n), t.transformTemplate), { ...s.attrs, style: { ...s.style } }; @@ -35279,7 +35290,7 @@ function gre(t, e, r, n) { } function mre(t = !1) { return (r, n, i, { latestValues: s }, o) => { - const u = (Zb(r) ? gre : lre)(n, s, o, r), l = pre(n, typeof r == "string", t), d = r !== b5 ? { ...l, ...u, ref: i } : {}, { children: g } = n, w = Oi(() => Jn(g) ? g.get() : g, [g]); + const u = (Qb(r) ? gre : lre)(n, s, o, r), l = pre(n, typeof r == "string", t), d = r !== y5 ? { ...l, ...u, ref: i } : {}, { children: g } = n, w = Oi(() => Jn(g) ? g.get() : g, [g]); return jd(r, { ...d, children: w @@ -35289,7 +35300,7 @@ function mre(t = !1) { function vre(t, e) { return function(n, { forwardMotionProps: i } = { forwardMotionProps: !1 }) { const o = { - ...Zb(n) ? are : cre, + ...Qb(n) ? are : cre, preloadedFeatures: t, useRender: mre(i), createVisualElement: e, @@ -35300,7 +35311,7 @@ function vre(t, e) { } const fv = { current: null }, m9 = { current: !1 }; function bre() { - if (m9.current = !0, !!Xb) + if (m9.current = !0, !!Zb) if (window.matchMedia) { const t = window.matchMedia("(prefers-reduced-motion)"), e = () => fv.current = t.matches; t.addListener(e), e(); @@ -35327,7 +35338,7 @@ function yre(t, e, r) { e[n] === void 0 && t.removeValue(n); return e; } -const n5 = /* @__PURE__ */ new WeakMap(), wre = [...c7, Gn, _a], xre = (t) => wre.find(a7(t)), i5 = [ +const i5 = /* @__PURE__ */ new WeakMap(), wre = [...c7, Gn, _a], xre = (t) => wre.find(a7(t)), s5 = [ "AnimationStart", "AnimationComplete", "Update", @@ -35348,7 +35359,7 @@ class _re { return {}; } constructor({ parent: e, props: r, presenceContext: n, reducedMotionConfig: i, blockInitialAnimation: s, visualState: o }, a = {}) { - this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = Ob, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => { + this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = Nb, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => { this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection)); }, this.renderScheduledAt = 0, this.scheduleRender = () => { const w = Gs.now(); @@ -35363,10 +35374,10 @@ class _re { } } mount(e) { - this.current = e, n5.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((r, n) => this.bindToMotionValue(n, r)), m9.current || bre(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : fv.current, process.env.NODE_ENV !== "production" && mp(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext); + this.current = e, i5.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((r, n) => this.bindToMotionValue(n, r)), m9.current || bre(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : fv.current, process.env.NODE_ENV !== "production" && mp(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext); } unmount() { - n5.delete(this.current), this.projection && this.projection.unmount(), wa(this.notifyUpdate), wa(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this); + i5.delete(this.current), this.projection && this.projection.unmount(), wa(this.notifyUpdate), wa(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this); for (const e in this.events) this.events[e].clear(); for (const e in this.features) { @@ -35424,8 +35435,8 @@ class _re { */ update(e, r) { (e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = r; - for (let n = 0; n < i5.length; n++) { - const i = i5[n]; + for (let n = 0; n < s5.length; n++) { + const i = s5[n]; this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]); const s = "on" + i, o = e[s]; o && (this.propEventSubscriptions[i] = this.on(i, o)); @@ -35514,7 +35525,7 @@ class _re { const { initial: n } = this.props; let i; if (typeof n == "string" || typeof n == "object") { - const o = Pb(this.props, n, (r = this.presenceContext) === null || r === void 0 ? void 0 : r.custom); + const o = Mb(this.props, n, (r = this.presenceContext) === null || r === void 0 ? void 0 : r.custom); o && (i = o[e]); } if (n && i !== void 0) @@ -35523,7 +35534,7 @@ class _re { return s !== void 0 && !Jn(s) ? s : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e]; } on(e, r) { - return this.events[e] || (this.events[e] = new Kb()), this.events[e].add(r); + return this.events[e] || (this.events[e] = new Vb()), this.events[e].add(r); } notify(e, ...r) { this.events[e] && this.events[e].notify(...r); @@ -35552,7 +35563,7 @@ class Sre extends v9 { } readValueFromInstance(e, r) { if (Sc.has(r)) { - const n = $b(r); + const n = Fb(r); return n && n.default || 0; } else { const n = Ere(e), i = (s7(r) ? n.getPropertyValue(r) : n[r]) || 0; @@ -35563,10 +35574,10 @@ class Sre extends v9 { return z7(e, r); } build(e, r, n) { - ry(e, r, n.transformTemplate); + ny(e, r, n.transformTemplate); } scrapeMotionValuesFromProps(e, r, n) { - return Qb(e, r, n); + return ey(e, r, n); } handleChildMotionValue() { this.childSubscription && (this.childSubscription(), delete this.childSubscription); @@ -35585,26 +35596,26 @@ class Are extends v9 { } readValueFromInstance(e, r) { if (Sc.has(r)) { - const n = $b(r); + const n = Fb(r); return n && n.default || 0; } - return r = a9.has(r) ? r : Vb(r), e.getAttribute(r); + return r = a9.has(r) ? r : Gb(r), e.getAttribute(r); } scrapeMotionValuesFromProps(e, r, n) { return f9(e, r, n); } build(e, r, n) { - ny(e, r, this.isSVGTag, n.transformTemplate); + iy(e, r, this.isSVGTag, n.transformTemplate); } renderInstance(e, r, n, i) { c9(e, r, n, i); } mount(e) { - this.isSVGTag = iy(e.tagName), super.mount(e); + this.isSVGTag = sy(e.tagName), super.mount(e); } } -const Pre = (t, e) => Zb(t) ? new Are(e) : new Sre(e, { - allowProjection: t !== b5 +const Pre = (t, e) => Qb(t) ? new Are(e) : new Sre(e, { + allowProjection: t !== y5 }), Mre = /* @__PURE__ */ vre({ ...mee, ...Fte, @@ -35635,8 +35646,8 @@ function Tre({ children: t, isPresent: e }) { height: 0, top: 0, left: 0 - }), { nonce: s } = Tn(Jb); - return v5(() => { + }), { nonce: s } = Tn(Xb); + return b5(() => { const { width: o, height: a, top: u, left: l } = i.current; if (e || !n.current || !o || !a) return; @@ -35656,7 +35667,7 @@ function Tre({ children: t, isPresent: e }) { }, [e]), me.jsx(Cre, { isPresent: e, childRef: n, sizeRef: i, children: Gt.cloneElement(t, { ref: n }) }); } const Rre = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: i, presenceAffectsLayout: s, mode: o }) => { - const a = ey(Dre), u = mv(), l = vv((g) => { + const a = ty(Dre), u = mv(), l = vv((g) => { a.set(g, !0); for (const w of a.values()) if (!w) @@ -35688,7 +35699,7 @@ function Dre() { return /* @__PURE__ */ new Map(); } const vd = (t) => t.key || ""; -function s5(t) { +function o5(t) { const e = []; return MR.forEach(t, (r) => { IR(r) && e.push(r); @@ -35696,28 +35707,28 @@ function s5(t) { } const Ore = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExitComplete: i, presenceAffectsLayout: s = !0, mode: o = "sync" }) => { Uo(!e, "Replace exitBeforeEnter with mode='wait'"); - const a = Oi(() => s5(t), [t]), u = a.map(vd), l = bi(!0), d = bi(a), g = ey(() => /* @__PURE__ */ new Map()), [w, A] = fr(a), [M, N] = fr(a); + const a = Oi(() => o5(t), [t]), u = a.map(vd), l = bi(!0), d = bi(a), g = ty(() => /* @__PURE__ */ new Map()), [w, A] = fr(a), [M, N] = fr(a); r9(() => { l.current = !1, d.current = a; - for (let $ = 0; $ < M.length; $++) { - const K = vd(M[$]); + for (let F = 0; F < M.length; F++) { + const K = vd(M[F]); u.includes(K) ? g.delete(K) : g.get(K) !== !0 && g.set(K, !1); } }, [M, u.length, u.join("-")]); const L = []; if (a !== w) { - let $ = [...a]; + let F = [...a]; for (let K = 0; K < M.length; K++) { const H = M[K], V = vd(H); - u.includes(V) || ($.splice(K, 0, H), L.push(H)); + u.includes(V) || (F.splice(K, 0, H), L.push(H)); } - o === "wait" && L.length && ($ = L), N(s5($)), A(a); + o === "wait" && L.length && (F = L), N(o5(F)), A(a); return; } process.env.NODE_ENV !== "production" && o === "wait" && M.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`); - const { forceRender: F } = Tn(Gb); - return me.jsx(me.Fragment, { children: M.map(($) => { - const K = vd($), H = a === M || u.includes(K), V = () => { + const { forceRender: $ } = Tn(Yb); + return me.jsx(me.Fragment, { children: M.map((F) => { + const K = vd(F), H = a === M || u.includes(K), V = () => { if (g.has(K)) g.set(K, !0); else @@ -35725,9 +35736,9 @@ const Ore = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onEx let te = !0; g.forEach((R) => { R || (te = !1); - }), te && (F == null || F(), N(d.current), i && i()); + }), te && ($ == null || $(), N(d.current), i && i()); }; - return me.jsx(Rre, { isPresent: H, initial: !l.current || n ? void 0 : !1, custom: H ? void 0 : r, presenceAffectsLayout: s, mode: o, onExitComplete: H ? void 0 : V, children: $ }, K); + return me.jsx(Rre, { isPresent: H, initial: !l.current || n ? void 0 : !1, custom: H ? void 0 : r, presenceAffectsLayout: s, mode: o, onExitComplete: H ? void 0 : V, children: F }, K); }) }); }, Ac = (t) => /* @__PURE__ */ me.jsx(Ore, { children: /* @__PURE__ */ me.jsx( Ire.div, @@ -35740,7 +35751,7 @@ const Ore = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onEx children: t.children } ) }); -function sy(t) { +function oy(t) { const { icon: e, title: r, extra: n, onClick: i } = t; function s() { i && i(); @@ -35773,7 +35784,7 @@ function Nre(t) { function b9(t) { var o, a; const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ me.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: (o = e.config) == null ? void 0 : o.image }), i = ((a = e.config) == null ? void 0 : a.name) || "", s = Oi(() => Nre(e), [e]); - return /* @__PURE__ */ me.jsx(sy, { icon: n, title: i, extra: s, onClick: () => r(e) }); + return /* @__PURE__ */ me.jsx(oy, { icon: n, title: i, extra: s, onClick: () => r(e) }); } function y9(t) { var e, r, n = ""; @@ -35788,14 +35799,14 @@ function Lre() { for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++) (t = arguments[r]) && (e = y9(t)) && (n && (n += " "), n += e); return n; } -const kre = Lre, oy = "-", $re = (t) => { +const kre = Lre, ay = "-", $re = (t) => { const e = Bre(t), { conflictingClassGroups: r, conflictingClassGroupModifiers: n } = t; return { getClassGroupId: (o) => { - const a = o.split(oy); + const a = o.split(ay); return a[0] === "" && a.length !== 1 && a.shift(), w9(a, e) || Fre(o); }, getConflictingClassGroupIds: (o, a) => { @@ -35812,13 +35823,13 @@ const kre = Lre, oy = "-", $re = (t) => { return i; if (e.validators.length === 0) return; - const s = t.join(oy); + const s = t.join(ay); return (o = e.validators.find(({ validator: a }) => a(s))) == null ? void 0 : o.classGroupId; -}, o5 = /^\[(.+)\]$/, Fre = (t) => { - if (o5.test(t)) { - const e = o5.exec(t)[1], r = e == null ? void 0 : e.substring(0, e.indexOf(":")); +}, a5 = /^\[(.+)\]$/, Fre = (t) => { + if (a5.test(t)) { + const e = a5.exec(t)[1], r = e == null ? void 0 : e.substring(0, e.indexOf(":")); if (r) return "arbitrary.." + r; } @@ -35836,7 +35847,7 @@ const kre = Lre, oy = "-", $re = (t) => { }, lv = (t, e, r, n) => { t.forEach((i) => { if (typeof i == "string") { - const s = i === "" ? e : a5(e, i); + const s = i === "" ? e : c5(e, i); s.classGroupId = r; return; } @@ -35852,12 +35863,12 @@ const kre = Lre, oy = "-", $re = (t) => { return; } Object.entries(i).forEach(([s, o]) => { - lv(o, a5(e, s), r, n); + lv(o, c5(e, s), r, n); }); }); -}, a5 = (t, e) => { +}, c5 = (t, e) => { let r = t; - return e.split(oy).forEach((n) => { + return e.split(ay).forEach((n) => { r.nextPart.has(n) || r.nextPart.set(n, { nextPart: /* @__PURE__ */ new Map(), validators: [] @@ -35898,18 +35909,18 @@ const kre = Lre, oy = "-", $re = (t) => { const u = []; let l = 0, d = 0, g; for (let L = 0; L < a.length; L++) { - let F = a[L]; + let $ = a[L]; if (l === 0) { - if (F === i && (n || a.slice(L, L + s) === e)) { + if ($ === i && (n || a.slice(L, L + s) === e)) { u.push(a.slice(d, L)), d = L + s; continue; } - if (F === "/") { + if ($ === "/") { g = L; continue; } } - F === "[" ? l++ : F === "]" && l--; + $ === "[" ? l++ : $ === "]" && l--; } const w = u.length === 0 ? a : a.substring(d), A = w.startsWith(x9), M = A ? w.substring(1) : w, N = g && g > d ? g - d : void 0; return { @@ -35961,14 +35972,14 @@ const kre = Lre, oy = "-", $re = (t) => { } M = !1; } - const L = Hre(d).join(":"), F = g ? L + x9 : L, $ = F + N; - if (s.includes($)) + const L = Hre(d).join(":"), $ = g ? L + x9 : L, F = $ + N; + if (s.includes(F)) continue; - s.push($); + s.push(F); const K = i(N, M); for (let H = 0; H < K.length; ++H) { const V = K[H]; - s.push(F + V); + s.push($ + V); } a = l + (a.length > 0 ? " " + a : a); } @@ -36017,7 +36028,7 @@ const Gr = (t) => { // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough. Qre.test(t) && !ene.test(t) ), S9 = () => !1, lne = (t) => tne.test(t), hne = (t) => rne.test(t), dne = () => { - const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), u = Gr("contrast"), l = Gr("grayscale"), d = Gr("hueRotate"), g = Gr("invert"), w = Gr("gap"), A = Gr("gradientColorStops"), M = Gr("gradientColorStopPositions"), N = Gr("inset"), L = Gr("margin"), F = Gr("opacity"), $ = Gr("padding"), K = Gr("saturate"), H = Gr("scale"), V = Gr("sepia"), te = Gr("skew"), R = Gr("space"), W = Gr("translate"), pe = () => ["auto", "contain", "none"], Ee = () => ["auto", "hidden", "clip", "visible", "scroll"], Y = () => ["auto", cr, e], S = () => [cr, e], m = () => ["", vo, ra], f = () => ["auto", gu, cr], p = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], b = () => ["solid", "dashed", "dotted", "double", "none"], x = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], _ = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], E = () => ["", "0", cr], v = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], P = () => [gu, cr]; + const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), u = Gr("contrast"), l = Gr("grayscale"), d = Gr("hueRotate"), g = Gr("invert"), w = Gr("gap"), A = Gr("gradientColorStops"), M = Gr("gradientColorStopPositions"), N = Gr("inset"), L = Gr("margin"), $ = Gr("opacity"), F = Gr("padding"), K = Gr("saturate"), H = Gr("scale"), V = Gr("sepia"), te = Gr("skew"), R = Gr("space"), W = Gr("translate"), pe = () => ["auto", "contain", "none"], Ee = () => ["auto", "hidden", "clip", "visible", "scroll"], Y = () => ["auto", cr, e], S = () => [cr, e], m = () => ["", vo, ra], f = () => ["auto", gu, cr], p = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], b = () => ["solid", "dashed", "dotted", "double", "none"], x = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], _ = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], E = () => ["", "0", cr], v = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], P = () => [gu, cr]; return { cacheSize: 500, separator: ":", @@ -36485,63 +36496,63 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/padding */ p: [{ - p: [$] + p: [F] }], /** * Padding X * @see https://tailwindcss.com/docs/padding */ px: [{ - px: [$] + px: [F] }], /** * Padding Y * @see https://tailwindcss.com/docs/padding */ py: [{ - py: [$] + py: [F] }], /** * Padding Start * @see https://tailwindcss.com/docs/padding */ ps: [{ - ps: [$] + ps: [F] }], /** * Padding End * @see https://tailwindcss.com/docs/padding */ pe: [{ - pe: [$] + pe: [F] }], /** * Padding Top * @see https://tailwindcss.com/docs/padding */ pt: [{ - pt: [$] + pt: [F] }], /** * Padding Right * @see https://tailwindcss.com/docs/padding */ pr: [{ - pr: [$] + pr: [F] }], /** * Padding Bottom * @see https://tailwindcss.com/docs/padding */ pb: [{ - pb: [$] + pb: [F] }], /** * Padding Left * @see https://tailwindcss.com/docs/padding */ pl: [{ - pl: [$] + pl: [F] }], /** * Margin @@ -36799,7 +36810,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/placeholder-opacity */ "placeholder-opacity": [{ - "placeholder-opacity": [F] + "placeholder-opacity": [$] }], /** * Text Alignment @@ -36820,7 +36831,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/text-opacity */ "text-opacity": [{ - "text-opacity": [F] + "text-opacity": [$] }], /** * Text Decoration @@ -36935,7 +36946,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/background-opacity */ "bg-opacity": [{ - "bg-opacity": [F] + "bg-opacity": [$] }], /** * Background Origin @@ -37199,7 +37210,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/border-opacity */ "border-opacity": [{ - "border-opacity": [F] + "border-opacity": [$] }], /** * Border Style @@ -37237,7 +37248,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/divide-opacity */ "divide-opacity": [{ - "divide-opacity": [F] + "divide-opacity": [$] }], /** * Divide Style @@ -37368,7 +37379,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/ring-opacity */ "ring-opacity": [{ - "ring-opacity": [F] + "ring-opacity": [$] }], /** * Ring Offset Width @@ -37404,7 +37415,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/opacity */ opacity: [{ - opacity: [F] + opacity: [$] }], /** * Mix Blend Mode @@ -37547,7 +37558,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/backdrop-opacity */ "backdrop-opacity": [{ - "backdrop-opacity": [F] + "backdrop-opacity": [$] }], /** * Backdrop Saturate @@ -38106,7 +38117,7 @@ function vne(t) { `feature-${N.key}` )), l.showTonConnect && /* @__PURE__ */ me.jsx( - sy, + oy, { icon: /* @__PURE__ */ me.jsx("img", { className: "xc-h-5 xc-w-5", src: gne }), title: "TON Connect", @@ -38125,9 +38136,9 @@ function uh(t) { /* @__PURE__ */ me.jsx("span", { children: e }) ] }); } -var bne = Object.defineProperty, yne = Object.defineProperties, wne = Object.getOwnPropertyDescriptors, E0 = Object.getOwnPropertySymbols, P9 = Object.prototype.hasOwnProperty, M9 = Object.prototype.propertyIsEnumerable, c5 = (t, e, r) => e in t ? bne(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, xne = (t, e) => { - for (var r in e || (e = {})) P9.call(e, r) && c5(t, r, e[r]); - if (E0) for (var r of E0(e)) M9.call(e, r) && c5(t, r, e[r]); +var bne = Object.defineProperty, yne = Object.defineProperties, wne = Object.getOwnPropertyDescriptors, E0 = Object.getOwnPropertySymbols, P9 = Object.prototype.hasOwnProperty, M9 = Object.prototype.propertyIsEnumerable, u5 = (t, e, r) => e in t ? bne(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, xne = (t, e) => { + for (var r in e || (e = {})) P9.call(e, r) && u5(t, r, e[r]); + if (E0) for (var r of E0(e)) M9.call(e, r) && u5(t, r, e[r]); return t; }, _ne = (t, e) => yne(t, wne(e)), Ene = (t, e) => { var r = {}; @@ -38150,8 +38161,8 @@ function Cne({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isF let [i, s] = Gt.useState(!1), [o, a] = Gt.useState(!1), [u, l] = Gt.useState(!1), d = Gt.useMemo(() => r === "none" ? !1 : (r === "increase-width" || r === "experimental-no-flickering") && i && o, [i, o, r]), g = Gt.useCallback(() => { let w = t.current, A = e.current; if (!w || !A || u || r === "none") return; - let M = w, N = M.getBoundingClientRect().left + M.offsetWidth, L = M.getBoundingClientRect().top + M.offsetHeight / 2, F = N - Pne, $ = L; - document.querySelectorAll(Ine).length === 0 && document.elementFromPoint(F, $) === w || (s(!0), l(!0)); + let M = w, N = M.getBoundingClientRect().left + M.offsetWidth, L = M.getBoundingClientRect().top + M.offsetHeight / 2, $ = N - Pne, F = L; + document.querySelectorAll(Ine).length === 0 && document.elementFromPoint($, F) === w || (s(!0), l(!0)); }, [t, e, u, r]); return Gt.useEffect(() => { let w = t.current; @@ -38177,10 +38188,10 @@ function Cne({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isF }, [e, n, r, g]), { hasPWMBadge: i, willPushPWMBadge: d, PWM_BADGE_SPACE_WIDTH: Mne }; } var C9 = Gt.createContext({}), T9 = Gt.forwardRef((t, e) => { - var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: u, inputMode: l = "numeric", onComplete: d, pushPasswordManagerStrategy: g = "increase-width", pasteTransformer: w, containerClassName: A, noScriptCSSFallback: M = Tne, render: N, children: L } = r, F = Ene(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), $, K, H, V, te; - let [R, W] = Gt.useState(typeof F.defaultValue == "string" ? F.defaultValue : ""), pe = n ?? R, Ee = Ane(pe), Y = Gt.useCallback((ie) => { + var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: u, inputMode: l = "numeric", onComplete: d, pushPasswordManagerStrategy: g = "increase-width", pasteTransformer: w, containerClassName: A, noScriptCSSFallback: M = Tne, render: N, children: L } = r, $ = Ene(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), F, K, H, V, te; + let [R, W] = Gt.useState(typeof $.defaultValue == "string" ? $.defaultValue : ""), pe = n ?? R, Ee = Ane(pe), Y = Gt.useCallback((ie) => { i == null || i(ie), W(ie); - }, [i]), S = Gt.useMemo(() => a ? typeof a == "string" ? new RegExp(a) : a : null, [a]), m = Gt.useRef(null), f = Gt.useRef(null), p = Gt.useRef({ value: pe, onChange: Y, isIOS: typeof window < "u" && ((K = ($ = window == null ? void 0 : window.CSS) == null ? void 0 : $.supports) == null ? void 0 : K.call($, "-webkit-touch-callout", "none")) }), b = Gt.useRef({ prev: [(H = m.current) == null ? void 0 : H.selectionStart, (V = m.current) == null ? void 0 : V.selectionEnd, (te = m.current) == null ? void 0 : te.selectionDirection] }); + }, [i]), S = Gt.useMemo(() => a ? typeof a == "string" ? new RegExp(a) : a : null, [a]), m = Gt.useRef(null), f = Gt.useRef(null), p = Gt.useRef({ value: pe, onChange: Y, isIOS: typeof window < "u" && ((K = (F = window == null ? void 0 : window.CSS) == null ? void 0 : F.supports) == null ? void 0 : K.call(F, "-webkit-touch-callout", "none")) }), b = Gt.useRef({ prev: [(H = m.current) == null ? void 0 : H.selectionStart, (V = m.current) == null ? void 0 : V.selectionEnd, (te = m.current) == null ? void 0 : te.selectionDirection] }); Gt.useImperativeHandle(e, () => m.current, []), Gt.useEffect(() => { let ie = m.current, ue = f.current; if (!ie || !ue) return; @@ -38264,26 +38275,26 @@ var C9 = Gt.createContext({}), T9 = Gt.forwardRef((t, e) => { Pe.value = Ne, Y(Ne); let Ke = Math.min(Ne.length, s - 1), Le = Ne.length; Pe.setSelectionRange(Ke, Le), I(Ke), ce(Le); - }, [s, Y, S, pe]), Q = Gt.useMemo(() => ({ position: "relative", cursor: F.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [F.disabled]), T = Gt.useMemo(() => ({ position: "absolute", inset: 0, width: D.willPushPWMBadge ? `calc(100% + ${D.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: D.willPushPWMBadge ? `inset(0 ${D.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: o, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [D.PWM_BADGE_SPACE_WIDTH, D.willPushPWMBadge, o]), X = Gt.useMemo(() => Gt.createElement("input", _ne(xne({ autoComplete: F.autoComplete || "one-time-code" }, F), { "data-input-otp": !0, "data-input-otp-placeholder-shown": pe.length === 0 || void 0, "data-input-otp-mss": P, "data-input-otp-mse": B, inputMode: l, pattern: S == null ? void 0 : S.source, "aria-placeholder": u, style: T, maxLength: s, value: pe, ref: m, onPaste: (ie) => { + }, [s, Y, S, pe]), Q = Gt.useMemo(() => ({ position: "relative", cursor: $.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [$.disabled]), T = Gt.useMemo(() => ({ position: "absolute", inset: 0, width: D.willPushPWMBadge ? `calc(100% + ${D.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: D.willPushPWMBadge ? `inset(0 ${D.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: o, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [D.PWM_BADGE_SPACE_WIDTH, D.willPushPWMBadge, o]), X = Gt.useMemo(() => Gt.createElement("input", _ne(xne({ autoComplete: $.autoComplete || "one-time-code" }, $), { "data-input-otp": !0, "data-input-otp-placeholder-shown": pe.length === 0 || void 0, "data-input-otp-mss": P, "data-input-otp-mse": B, inputMode: l, pattern: S == null ? void 0 : S.source, "aria-placeholder": u, style: T, maxLength: s, value: pe, ref: m, onPaste: (ie) => { var ue; - J(ie), (ue = F.onPaste) == null || ue.call(F, ie); + J(ie), (ue = $.onPaste) == null || ue.call($, ie); }, onChange: oe, onMouseOver: (ie) => { var ue; - _(!0), (ue = F.onMouseOver) == null || ue.call(F, ie); + _(!0), (ue = $.onMouseOver) == null || ue.call($, ie); }, onMouseLeave: (ie) => { var ue; - _(!1), (ue = F.onMouseLeave) == null || ue.call(F, ie); + _(!1), (ue = $.onMouseLeave) == null || ue.call($, ie); }, onFocus: (ie) => { var ue; - Z(), (ue = F.onFocus) == null || ue.call(F, ie); + Z(), (ue = $.onFocus) == null || ue.call($, ie); }, onBlur: (ie) => { var ue; - v(!1), (ue = F.onBlur) == null || ue.call(F, ie); - } })), [oe, Z, J, l, T, s, B, P, F, S == null ? void 0 : S.source, pe]), re = Gt.useMemo(() => ({ slots: Array.from({ length: s }).map((ie, ue) => { + v(!1), (ue = $.onBlur) == null || ue.call($, ie); + } })), [oe, Z, J, l, T, s, B, P, $, S == null ? void 0 : S.source, pe]), re = Gt.useMemo(() => ({ slots: Array.from({ length: s }).map((ie, ue) => { var ve; let Pe = E && P !== null && B !== null && (P === B && ue === P || ue >= P && ue < B), De = pe[ue] !== void 0 ? pe[ue] : null, Ce = pe[0] !== void 0 ? null : (ve = u == null ? void 0 : u[ue]) != null ? ve : null; return { char: De, placeholderChar: Ce, isActive: Pe, hasFakeCaret: Pe && De === null }; - }), isFocused: E, isHovering: !F.disabled && x }), [E, x, s, B, P, F.disabled, pe]), de = Gt.useMemo(() => N ? N(re) : Gt.createElement(C9.Provider, { value: re }, L), [L, re, N]); + }), isFocused: E, isHovering: !$.disabled && x }), [E, x, s, B, P, $.disabled, pe]), de = Gt.useMemo(() => N ? N(re) : Gt.createElement(C9.Provider, { value: re }, L), [L, re, N]); return Gt.createElement(Gt.Fragment, null, M !== null && Gt.createElement("noscript", null, Gt.createElement("style", null, M)), Gt.createElement("div", { ref: f, "data-input-otp-container": !0, style: Q, className: A }, de, Gt.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, X))); }); T9.displayName = "Input"; @@ -38362,7 +38373,7 @@ const O9 = Sa({ app: "", inviterCode: "" }); -function ay() { +function cy() { return Tn(O9); } function Dne(t) { @@ -38383,19 +38394,19 @@ function Dne(t) { ); } function One(t) { - const { email: e } = t, [r, n] = fr(0), [i, s] = fr(!1), [o, a] = fr(!1), [u, l] = fr(""), [d, g] = fr(""), w = ay(); + const { email: e } = t, [r, n] = fr(0), [i, s] = fr(!1), [o, a] = fr(!1), [u, l] = fr(""), [d, g] = fr(""), w = cy(); async function A() { n(60); const L = setInterval(() => { - n((F) => F === 0 ? (clearInterval(L), 0) : F - 1); + n(($) => $ === 0 ? (clearInterval(L), 0) : $ - 1); }, 1e3); } async function M(L) { a(!0); try { l(""), await ya.getEmailCode({ account_type: "email", email: L }), A(); - } catch (F) { - l(F.message); + } catch ($) { + l($.message); } a(!1); } @@ -38406,7 +38417,7 @@ function One(t) { if (g(""), !(L.length < 6)) { s(!0); try { - const F = await ya.emailLogin({ + const $ = await ya.emailLogin({ account_type: "email", connector: "codatta_email", account_enum: "C", @@ -38419,9 +38430,9 @@ function One(t) { app: w.app } }); - t.onLogin(F.data); - } catch (F) { - g(F.message); + t.onLogin($.data); + } catch ($) { + g($.message); } s(!1); } @@ -38458,7 +38469,7 @@ var N9 = { exports: {} }; var r = { 873: (o, a) => { var u, l, d = function() { var g = function(f, p) { - var b = f, x = F[p], _ = null, E = 0, v = null, P = [], I = {}, B = function(re, de) { + var b = f, x = $[p], _ = null, E = 0, v = null, P = [], I = {}, B = function(re, de) { _ = function(ie) { for (var ue = new Array(ie), ve = 0; ve < ie; ve += 1) { ue[ve] = new Array(ie); @@ -38472,25 +38483,25 @@ var N9 = { exports: {} }; for (var re = 8; re < E - 8; re += 1) _[re][6] == null && (_[re][6] = re % 2 == 0); for (var de = 8; de < E - 8; de += 1) _[6][de] == null && (_[6][de] = de % 2 == 0); }, oe = function() { - for (var re = $.getPatternPosition(b), de = 0; de < re.length; de += 1) for (var ie = 0; ie < re.length; ie += 1) { + for (var re = F.getPatternPosition(b), de = 0; de < re.length; de += 1) for (var ie = 0; ie < re.length; ie += 1) { var ue = re[de], ve = re[ie]; if (_[ue][ve] == null) for (var Pe = -2; Pe <= 2; Pe += 1) for (var De = -2; De <= 2; De += 1) _[ue + Pe][ve + De] = Pe == -2 || Pe == 2 || De == -2 || De == 2 || Pe == 0 && De == 0; } }, Z = function(re) { - for (var de = $.getBCHTypeNumber(b), ie = 0; ie < 18; ie += 1) { + for (var de = F.getBCHTypeNumber(b), ie = 0; ie < 18; ie += 1) { var ue = !re && (de >> ie & 1) == 1; _[Math.floor(ie / 3)][ie % 3 + E - 8 - 3] = ue; } for (ie = 0; ie < 18; ie += 1) ue = !re && (de >> ie & 1) == 1, _[ie % 3 + E - 8 - 3][Math.floor(ie / 3)] = ue; }, J = function(re, de) { - for (var ie = x << 3 | de, ue = $.getBCHTypeInfo(ie), ve = 0; ve < 15; ve += 1) { + for (var ie = x << 3 | de, ue = F.getBCHTypeInfo(ie), ve = 0; ve < 15; ve += 1) { var Pe = !re && (ue >> ve & 1) == 1; ve < 6 ? _[ve][8] = Pe : ve < 8 ? _[ve + 1][8] = Pe : _[E - 15 + ve][8] = Pe; } for (ve = 0; ve < 15; ve += 1) Pe = !re && (ue >> ve & 1) == 1, ve < 8 ? _[8][E - ve - 1] = Pe : ve < 9 ? _[8][15 - ve - 1 + 1] = Pe : _[8][15 - ve - 1] = Pe; _[E - 8][8] = !re; }, Q = function(re, de) { - for (var ie = -1, ue = E - 1, ve = 7, Pe = 0, De = $.getMaskFunction(de), Ce = E - 1; Ce > 0; Ce -= 2) for (Ce == 6 && (Ce -= 1); ; ) { + for (var ie = -1, ue = E - 1, ve = 7, Pe = 0, De = F.getMaskFunction(de), Ce = E - 1; Ce > 0; Ce -= 2) for (Ce == 6 && (Ce -= 1); ; ) { for (var $e = 0; $e < 2; $e += 1) if (_[ue][Ce - $e] == null) { var Me = !1; Pe < re.length && (Me = (re[Pe] >>> ve & 1) == 1), De(ue, Ce - $e) && (Me = !Me), _[ue][Ce - $e] = Me, (ve -= 1) == -1 && (Pe += 1, ve = 7); @@ -38503,7 +38514,7 @@ var N9 = { exports: {} }; }, T = function(re, de, ie) { for (var ue = V.getRSBlocks(re, de), ve = te(), Pe = 0; Pe < ie.length; Pe += 1) { var De = ie[Pe]; - ve.put(De.getMode(), 4), ve.put(De.getLength(), $.getLengthInBits(De.getMode(), re)), De.write(ve); + ve.put(De.getMode(), 4), ve.put(De.getLength(), F.getLengthInBits(De.getMode(), re)), De.write(ve); } var Ce = 0; for (Pe = 0; Pe < ue.length; Pe += 1) Ce += ue[Pe].dataCount; @@ -38516,7 +38527,7 @@ var N9 = { exports: {} }; Ke = Math.max(Ke, Ze), Le = Math.max(Le, at), qe[_e] = new Array(Ze); for (var ke = 0; ke < qe[_e].length; ke += 1) qe[_e][ke] = 255 & $e.getBuffer()[ke + Ne]; Ne += Ze; - var Qe = $.getErrorCorrectPolynomial(at), tt = H(qe[_e], Qe.getLength() - 1).mod(Qe); + var Qe = F.getErrorCorrectPolynomial(at), tt = H(qe[_e], Qe.getLength() - 1).mod(Qe); for (ze[_e] = new Array(Qe.getLength() - 1), ke = 0; ke < ze[_e].length; ke += 1) { var Ye = ke + tt.getLength() - ze[_e].length; ze[_e][ke] = Ye >= 0 ? tt.getAt(Ye) : 0; @@ -38559,7 +38570,7 @@ var N9 = { exports: {} }; for (var re = 1; re < 40; re++) { for (var de = V.getRSBlocks(re, x), ie = te(), ue = 0; ue < P.length; ue++) { var ve = P[ue]; - ie.put(ve.getMode(), 4), ie.put(ve.getLength(), $.getLengthInBits(ve.getMode(), re)), ve.write(ie); + ie.put(ve.getMode(), 4), ie.put(ve.getLength(), F.getLengthInBits(ve.getMode(), re)), ve.write(ie); } var Pe = 0; for (ue = 0; ue < de.length; ue++) Pe += de[ue].dataCount; @@ -38570,7 +38581,7 @@ var N9 = { exports: {} }; B(!1, function() { for (var De = 0, Ce = 0, $e = 0; $e < 8; $e += 1) { B(!0, $e); - var Me = $.getLostPoint(I); + var Me = F.getLostPoint(I); ($e == 0 || De > Me) && (De = Me, Ce = $e); } return Ce; @@ -38685,7 +38696,7 @@ var N9 = { exports: {} }; return E; }; }; - var w, A, M, N, L, F = { L: 1, M: 0, Q: 3, H: 2 }, $ = (w = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], A = 1335, M = 7973, L = function(f) { + var w, A, M, N, L, $ = { L: 1, M: 0, Q: 3, H: 2 }, F = (w = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], A = 1335, M = 7973, L = function(f) { for (var p = 0; f != 0; ) p += 1, f >>>= 1; return p; }, (N = {}).getBCHTypeInfo = function(f) { @@ -38830,13 +38841,13 @@ var N9 = { exports: {} }; }, b = { getRSBlocks: function(x, _) { var E = function(Z, J) { switch (J) { - case F.L: + case $.L: return f[4 * (Z - 1) + 0]; - case F.M: + case $.M: return f[4 * (Z - 1) + 1]; - case F.Q: + case $.Q: return f[4 * (Z - 1) + 2]; - case F.H: + case $.H: return f[4 * (Z - 1) + 3]; default: return; @@ -39442,9 +39453,9 @@ var N9 = { exports: {} }; } } L.instanceCount = 0; - const F = L, $ = "canvas", K = {}; + const $ = L, F = "canvas", K = {}; for (let S = 0; S <= 40; S++) K[S] = S; - const H = { type: $, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: K[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: !0, hideBackgroundDots: !0, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: !0 }, backgroundOptions: { round: 0, color: "#fff" } }; + const H = { type: F, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: K[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: !0, hideBackgroundDots: !0, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: !0 }, backgroundOptions: { round: 0, color: "#fff" } }; function V(S) { const m = Object.assign({}, S); if (!m.colorStops || !m.colorStops.length) throw "Field 'colorStops' is required in gradient"; @@ -39471,7 +39482,7 @@ var N9 = { exports: {} }; } _setupSvg() { if (!this._qr) return; - const m = new F(this._options, this._window); + const m = new $(this._options, this._window); this._svg = m.getElement(), this._svgDrawingPromise = m.drawQR(this._qr).then(() => { var f; this._svg && ((f = this._extension) === null || f === void 0 || f.call(this, m.getElement(), this._options)); @@ -39512,12 +39523,12 @@ var N9 = { exports: {} }; default: return "Byte"; } - }(this._options.data)), this._qr.make(), this._options.type === $ ? this._setupCanvas() : this._setupSvg(), this.append(this._container)); + }(this._options.data)), this._qr.make(), this._options.type === F ? this._setupCanvas() : this._setupSvg(), this.append(this._container)); } append(m) { if (m) { if (typeof m.appendChild != "function") throw "Container should be a single DOM node"; - this._options.type === $ ? this._domCanvas && m.appendChild(this._domCanvas) : this._svg && m.appendChild(this._svg), this._container = m; + this._options.type === F ? this._domCanvas && m.appendChild(this._domCanvas) : this._svg && m.appendChild(this._svg), this._container = m; } } applyExtension(m) { @@ -39576,7 +39587,7 @@ class ia extends yt { }); } } -function u5(t) { +function f5(t) { if (/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t) || /%[^0-9a-f]/i.test(t) || /%[0-9a-f](:?[^0-9a-f]|$)/i.test(t)) return !1; const e = Lne(t), r = e[1], n = e[2], i = e[3], s = e[4], o = e[5]; @@ -39628,7 +39639,7 @@ function k9(t) { `Provided value: ${s}` ] }); - if (!u5(d)) + if (!f5(d)) throw new ia({ field: "uri", metaMessages: [ @@ -39657,19 +39668,19 @@ function k9(t) { `Provided value: ${l}` ] }); - const F = t.statement; - if (F != null && F.includes(` + const $ = t.statement; + if ($ != null && $.includes(` `)) throw new ia({ field: "statement", metaMessages: [ "- Statement must not include '\\n'.", "", - `Provided value: ${F}` + `Provided value: ${$}` ] }); } - const w = k5(t.address), A = l ? `${l}://${r}` : r, M = t.statement ? `${t.statement} + const w = Ev(t.address), A = l ? `${l}://${r}` : r, M = t.statement ? `${t.statement} ` : "", N = `${A} wants you to sign in with your Ethereum account: ${w} @@ -39683,23 +39694,23 @@ Issued At: ${i.toISOString()}`; Expiration Time: ${n.toISOString()}`), o && (L += ` Not Before: ${o.toISOString()}`), a && (L += ` Request ID: ${a}`), u) { - let F = ` + let $ = ` Resources:`; - for (const $ of u) { - if (!u5($)) + for (const F of u) { + if (!f5(F)) throw new ia({ field: "resources", metaMessages: [ "- Every resource must be a RFC 3986 URI.", "- See https://www.rfc-editor.org/rfc/rfc3986", "", - `Provided value: ${$}` + `Provided value: ${F}` ] }); - F += ` -- ${$}`; + $ += ` +- ${F}`; } - L += F; + L += $; } return `${N} ${L}`; @@ -39744,7 +39755,7 @@ function zne(t, e) { } function Hne(t) { var pe, Ee, Y; - const e = bi(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = fr(""), [a, u] = fr(!1), [l, d] = fr(""), [g, w] = fr("scan"), A = bi(), [M, N] = fr((pe = r.config) == null ? void 0 : pe.image), [L, F] = fr(!1), { saveLastUsedWallet: $ } = gp(); + const e = bi(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = fr(""), [a, u] = fr(!1), [l, d] = fr(""), [g, w] = fr("scan"), A = bi(), [M, N] = fr((pe = r.config) == null ? void 0 : pe.image), [L, $] = fr(!1), { saveLastUsedWallet: F } = gp(); async function K(S) { var f, p, b, x; u(!0); @@ -39771,7 +39782,7 @@ function Hne(t) { signature: B, address: v, wallet_name: ((b = E.config) == null ? void 0 : b.name) || ((x = S.config) == null ? void 0 : x.name) || "" - }), $(E); + }), F(E); } catch (_) { console.log("err", _), d(_.details || _.message); } @@ -39812,8 +39823,8 @@ function Hne(t) { d(""), V(""), K(r); } function R() { - F(!0), navigator.clipboard.writeText(s), setTimeout(() => { - F(!1); + $(!0), navigator.clipboard.writeText(s), setTimeout(() => { + $(!1); }, 2500); } function W() { @@ -39902,12 +39913,12 @@ function Gne(t) { const M = await n.connect(); if (!M || M.length === 0) throw new Error("Wallet connect error"); - const N = Vne(M[0], w); + const N = Ev(M[0]), L = Vne(N, w); a("sign"); - const L = await n.signMessage(N, M[0]); - if (!L || L.length === 0) + const $ = await n.signMessage(L, N); + if (!$ || $.length === 0) throw new Error("user sign error"); - a("waiting"), await i(n, { address: M[0], signature: L, message: N, nonce: w, wallet_name: ((A = n.config) == null ? void 0 : A.name) || "" }), u(n); + a("waiting"), await i(n, { address: N, signature: $, message: L, nonce: w, wallet_name: ((A = n.config) == null ? void 0 : A.name) || "" }), u(n); } catch (M) { console.log(M.details), r(M.details || M.message); } @@ -40028,7 +40039,7 @@ function rie(t) { ] }); } function nie(t) { - const { wallet: e } = t, [r, n] = fr(e.installed ? "connect" : "qr"), i = ay(); + const { wallet: e } = t, [r, n] = fr(e.installed ? "connect" : "qr"), i = cy(); async function s(o, a) { var l; const u = await ya.walletLogin({ @@ -40073,7 +40084,7 @@ function nie(t) { } function iie(t) { const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ me.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: e.imageUrl }), i = e.name || ""; - return /* @__PURE__ */ me.jsx(sy, { icon: n, title: i, onClick: () => r(e) }); + return /* @__PURE__ */ me.jsx(oy, { icon: n, title: i, onClick: () => r(e) }); } function sie(t) { const { connector: e } = t, [r, n] = fr(), [i, s] = fr([]), o = Oi(() => r ? i.filter((d) => d.name.toLowerCase().includes(r.toLowerCase())) : i, [r, i]); @@ -40163,10 +40174,10 @@ var B9 = { exports: {} }; function L(k, j, z, C) { return N(k, j, z, C, 16); } - function F(k, j, z, C) { + function $(k, j, z, C) { return N(k, j, z, C, 32); } - function $(k, j, z, C) { + function F(k, j, z, C) { for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, U = z[0] & 255 | (z[1] & 255) << 8 | (z[2] & 255) << 16 | (z[3] & 255) << 24, se = z[4] & 255 | (z[5] & 255) << 8 | (z[6] & 255) << 16 | (z[7] & 255) << 24, he = z[8] & 255 | (z[9] & 255) << 8 | (z[10] & 255) << 16 | (z[11] & 255) << 24, xe = z[12] & 255 | (z[13] & 255) << 8 | (z[14] & 255) << 16 | (z[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = j[0] & 255 | (j[1] & 255) << 8 | (j[2] & 255) << 16 | (j[3] & 255) << 24, nt = j[4] & 255 | (j[5] & 255) << 8 | (j[6] & 255) << 16 | (j[7] & 255) << 24, Ue = j[8] & 255 | (j[9] & 255) << 8 | (j[10] & 255) << 16 | (j[11] & 255) << 24, pt = j[12] & 255 | (j[13] & 255) << 8 | (j[14] & 255) << 16 | (j[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = z[16] & 255 | (z[17] & 255) << 8 | (z[18] & 255) << 16 | (z[19] & 255) << 24, St = z[20] & 255 | (z[21] & 255) << 8 | (z[22] & 255) << 16 | (z[23] & 255) << 24, Tt = z[24] & 255 | (z[25] & 255) << 8 | (z[26] & 255) << 16 | (z[27] & 255) << 24, At = z[28] & 255 | (z[29] & 255) << 8 | (z[30] & 255) << 16 | (z[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = U, st = se, bt = he, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = Ue, Be = pt, je = it, Je = et, Lt = St, zt = Tt, Xt = At, Ht = _t, le, tr = 0; tr < 20; tr += 2) le = ht + Lt | 0, ut ^= le << 7 | le >>> 25, le = ut + ht | 0, Ve ^= le << 9 | le >>> 23, le = Ve + ut | 0, Lt ^= le << 13 | le >>> 19, le = Lt + Ve | 0, ht ^= le << 18 | le >>> 14, le = ot + xt | 0, Be ^= le << 7 | le >>> 25, le = Be + ot | 0, zt ^= le << 9 | le >>> 23, le = zt + Be | 0, xt ^= le << 13 | le >>> 19, le = xt + zt | 0, ot ^= le << 18 | le >>> 14, le = je + Se | 0, Xt ^= le << 7 | le >>> 25, le = Xt + je | 0, st ^= le << 9 | le >>> 23, le = st + Xt | 0, Se ^= le << 13 | le >>> 19, le = Se + st | 0, je ^= le << 18 | le >>> 14, le = Ht + Je | 0, bt ^= le << 7 | le >>> 25, le = bt + Ht | 0, Ae ^= le << 9 | le >>> 23, le = Ae + bt | 0, Je ^= le << 13 | le >>> 19, le = Je + Ae | 0, Ht ^= le << 18 | le >>> 14, le = ht + bt | 0, xt ^= le << 7 | le >>> 25, le = xt + ht | 0, st ^= le << 9 | le >>> 23, le = st + xt | 0, bt ^= le << 13 | le >>> 19, le = bt + st | 0, ht ^= le << 18 | le >>> 14, le = ot + ut | 0, Se ^= le << 7 | le >>> 25, le = Se + ot | 0, Ae ^= le << 9 | le >>> 23, le = Ae + Se | 0, ut ^= le << 13 | le >>> 19, le = ut + Ae | 0, ot ^= le << 18 | le >>> 14, le = je + Be | 0, Je ^= le << 7 | le >>> 25, le = Je + je | 0, Ve ^= le << 9 | le >>> 23, le = Ve + Je | 0, Be ^= le << 13 | le >>> 19, le = Be + Ve | 0, je ^= le << 18 | le >>> 14, le = Ht + Xt | 0, Lt ^= le << 7 | le >>> 25, le = Lt + Ht | 0, zt ^= le << 9 | le >>> 23, le = zt + Lt | 0, Xt ^= le << 13 | le >>> 19, le = Xt + zt | 0, Ht ^= le << 18 | le >>> 14; ht = ht + G | 0, xt = xt + U | 0, st = st + se | 0, bt = bt + he | 0, ut = ut + xe | 0, ot = ot + Te | 0, Se = Se + Re | 0, Ae = Ae + nt | 0, Ve = Ve + Ue | 0, Be = Be + pt | 0, je = je + it | 0, Je = Je + et | 0, Lt = Lt + St | 0, zt = zt + Tt | 0, Xt = Xt + At | 0, Ht = Ht + _t | 0, k[0] = ht >>> 0 & 255, k[1] = ht >>> 8 & 255, k[2] = ht >>> 16 & 255, k[3] = ht >>> 24 & 255, k[4] = xt >>> 0 & 255, k[5] = xt >>> 8 & 255, k[6] = xt >>> 16 & 255, k[7] = xt >>> 24 & 255, k[8] = st >>> 0 & 255, k[9] = st >>> 8 & 255, k[10] = st >>> 16 & 255, k[11] = st >>> 24 & 255, k[12] = bt >>> 0 & 255, k[13] = bt >>> 8 & 255, k[14] = bt >>> 16 & 255, k[15] = bt >>> 24 & 255, k[16] = ut >>> 0 & 255, k[17] = ut >>> 8 & 255, k[18] = ut >>> 16 & 255, k[19] = ut >>> 24 & 255, k[20] = ot >>> 0 & 255, k[21] = ot >>> 8 & 255, k[22] = ot >>> 16 & 255, k[23] = ot >>> 24 & 255, k[24] = Se >>> 0 & 255, k[25] = Se >>> 8 & 255, k[26] = Se >>> 16 & 255, k[27] = Se >>> 24 & 255, k[28] = Ae >>> 0 & 255, k[29] = Ae >>> 8 & 255, k[30] = Ae >>> 16 & 255, k[31] = Ae >>> 24 & 255, k[32] = Ve >>> 0 & 255, k[33] = Ve >>> 8 & 255, k[34] = Ve >>> 16 & 255, k[35] = Ve >>> 24 & 255, k[36] = Be >>> 0 & 255, k[37] = Be >>> 8 & 255, k[38] = Be >>> 16 & 255, k[39] = Be >>> 24 & 255, k[40] = je >>> 0 & 255, k[41] = je >>> 8 & 255, k[42] = je >>> 16 & 255, k[43] = je >>> 24 & 255, k[44] = Je >>> 0 & 255, k[45] = Je >>> 8 & 255, k[46] = Je >>> 16 & 255, k[47] = Je >>> 24 & 255, k[48] = Lt >>> 0 & 255, k[49] = Lt >>> 8 & 255, k[50] = Lt >>> 16 & 255, k[51] = Lt >>> 24 & 255, k[52] = zt >>> 0 & 255, k[53] = zt >>> 8 & 255, k[54] = zt >>> 16 & 255, k[55] = zt >>> 24 & 255, k[56] = Xt >>> 0 & 255, k[57] = Xt >>> 8 & 255, k[58] = Xt >>> 16 & 255, k[59] = Xt >>> 24 & 255, k[60] = Ht >>> 0 & 255, k[61] = Ht >>> 8 & 255, k[62] = Ht >>> 16 & 255, k[63] = Ht >>> 24 & 255; @@ -40177,7 +40188,7 @@ var B9 = { exports: {} }; k[0] = ht >>> 0 & 255, k[1] = ht >>> 8 & 255, k[2] = ht >>> 16 & 255, k[3] = ht >>> 24 & 255, k[4] = ot >>> 0 & 255, k[5] = ot >>> 8 & 255, k[6] = ot >>> 16 & 255, k[7] = ot >>> 24 & 255, k[8] = je >>> 0 & 255, k[9] = je >>> 8 & 255, k[10] = je >>> 16 & 255, k[11] = je >>> 24 & 255, k[12] = Ht >>> 0 & 255, k[13] = Ht >>> 8 & 255, k[14] = Ht >>> 16 & 255, k[15] = Ht >>> 24 & 255, k[16] = Se >>> 0 & 255, k[17] = Se >>> 8 & 255, k[18] = Se >>> 16 & 255, k[19] = Se >>> 24 & 255, k[20] = Ae >>> 0 & 255, k[21] = Ae >>> 8 & 255, k[22] = Ae >>> 16 & 255, k[23] = Ae >>> 24 & 255, k[24] = Ve >>> 0 & 255, k[25] = Ve >>> 8 & 255, k[26] = Ve >>> 16 & 255, k[27] = Ve >>> 24 & 255, k[28] = Be >>> 0 & 255, k[29] = Be >>> 8 & 255, k[30] = Be >>> 16 & 255, k[31] = Be >>> 24 & 255; } function H(k, j, z, C) { - $(k, j, z, C); + F(k, j, z, C); } function V(k, j, z, C) { K(k, j, z, C); @@ -40309,7 +40320,7 @@ var B9 = { exports: {} }; } function v(k, j) { var z = new Uint8Array(32), C = new Uint8Array(32); - return E(z, k), E(C, j), F(z, 0, C, 0); + return E(z, k), E(C, j), $(z, 0, C, 0); } function P(k) { var j = new Uint8Array(32); @@ -40628,7 +40639,7 @@ var B9 = { exports: {} }; if (z < 64 || ke(xe, C)) return -1; for (G = 0; G < z; G++) k[G] = j[G]; for (G = 0; G < 32; G++) k[G + 32] = C[G]; - if (Ce(se, k, z), Ze(se), Ke(he, xe, se), Le(xe, j.subarray(32)), $e(he, xe), Ne(U, he), z -= 64, F(j, 0, U, 0)) { + if (Ce(se, k, z), Ze(se), Ke(he, xe, se), Le(xe, j.subarray(32)), $e(he, xe), Ne(U, he), z -= 64, $(j, 0, U, 0)) { for (G = 0; G < z; G++) k[G] = 0; return -1; } @@ -40645,7 +40656,7 @@ var B9 = { exports: {} }; crypto_onetimeauth: S, crypto_onetimeauth_verify: m, crypto_verify_16: L, - crypto_verify_32: F, + crypto_verify_32: $, crypto_secretbox: f, crypto_secretbox_open: p, crypto_scalarmult: Q, @@ -40816,26 +40827,26 @@ var ua; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.MANIFEST_NOT_FOUND_ERROR = 2] = "MANIFEST_NOT_FOUND_ERROR", t[t.MANIFEST_CONTENT_ERROR = 3] = "MANIFEST_CONTENT_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; })(ua || (ua = {})); -var f5; +var l5; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(f5 || (f5 = {})); +})(l5 || (l5 = {})); var iu; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; })(iu || (iu = {})); -var l5; -(function(t) { - t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(l5 || (l5 = {})); var h5; (function(t) { - t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; + t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; })(h5 || (h5 = {})); var d5; (function(t) { - t.MAINNET = "-239", t.TESTNET = "-3"; + t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; })(d5 || (d5 = {})); +var p5; +(function(t) { + t.MAINNET = "-239", t.TESTNET = "-3"; +})(p5 || (p5 = {})); function cie(t, e) { const r = Rl.encodeBase64(t); return e ? encodeURIComponent(r) : r; @@ -40989,12 +41000,12 @@ class Ut extends Error { } } Ut.prefix = "[TON_CONNECT_SDK_ERROR]"; -class cy extends Ut { +class uy extends Ut { get info() { return "Passed DappMetadata is in incorrect format."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, cy.prototype); + super(...e), Object.setPrototypeOf(this, uy.prototype); } } class Sp extends Ut { @@ -41013,12 +41024,12 @@ class Ap extends Ut { super(...e), Object.setPrototypeOf(this, Ap.prototype); } } -class uy extends Ut { +class fy extends Ut { get info() { return "Wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, uy.prototype); + super(...e), Object.setPrototypeOf(this, fy.prototype); } } class A0 extends Ut { @@ -41056,20 +41067,20 @@ class Ip extends Ut { super(...e), Object.setPrototypeOf(this, Ip.prototype); } } -class fy extends Ut { +class ly extends Ut { get info() { return "There is an attempt to connect to the injected wallet while it is not exists in the webpage."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, fy.prototype); + super(...e), Object.setPrototypeOf(this, ly.prototype); } } -class ly extends Ut { +class hy extends Ut { get info() { return "An error occurred while fetching the wallets list."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, ly.prototype); + super(...e), Object.setPrototypeOf(this, hy.prototype); } } class Ea extends Ut { @@ -41077,7 +41088,7 @@ class Ea extends Ut { super(...e), Object.setPrototypeOf(this, Ea.prototype); } } -const p5 = { +const g5 = { [ua.UNKNOWN_ERROR]: Ea, [ua.USER_REJECTS_ERROR]: Pp, [ua.BAD_REQUEST_ERROR]: Mp, @@ -41088,7 +41099,7 @@ const p5 = { class mie { parseError(e) { let r = Ea; - return e.code in p5 && (r = p5[e.code] || Ea), new r(e.message); + return e.code in g5 && (r = g5[e.code] || Ea), new r(e.message); } } const vie = new mie(); @@ -41097,7 +41108,7 @@ class bie { return "error" in e; } } -const g5 = { +const m5 = { [iu.UNKNOWN_ERROR]: Ea, [iu.USER_REJECTS_ERROR]: Pp, [iu.BAD_REQUEST_ERROR]: Mp, @@ -41112,7 +41123,7 @@ class yie extends bie { } parseAndThrowError(e) { let r = Ea; - throw e.error.code in g5 && (r = g5[e.error.code] || Ea), new r(e.error.message); + throw e.error.code in m5 && (r = m5[e.error.code] || Ea), new r(e.error.message); } convertFromRpcResponse(e) { return { @@ -41810,7 +41821,7 @@ class Ol { (r = this.gateway) === null || r === void 0 || r.close(), this.pendingGateways.filter((n) => n !== (e == null ? void 0 : e.except)).forEach((n) => n.close()), this.pendingGateways = []; } } -function m5(t, e) { +function v5(t, e) { return H9(t, [e]); } function H9(t, e) { @@ -41818,7 +41829,7 @@ function H9(t, e) { } function Iie(t) { try { - return !m5(t, "tonconnect") || !m5(t.tonconnect, "walletInfo") ? !1 : H9(t.tonconnect.walletInfo, [ + return !v5(t, "tonconnect") || !v5(t.tonconnect, "walletInfo") ? !1 : H9(t.tonconnect.walletInfo, [ "name", "app_name", "image", @@ -41903,7 +41914,7 @@ class mi { this.injectedWalletKey = r, this.type = "injected", this.unsubscribeCallback = null, this.listenSubscriptions = !1, this.listeners = []; const n = mi.window; if (!mi.isWindowContainsWallet(n, r)) - throw new fy(); + throw new ly(); this.connectionStorage = new Dl(e), this.injectedWallet = n[r].tonconnect; } static fromStorage(e) { @@ -42272,7 +42283,7 @@ class dv { let e = []; try { if (e = yield (yield fetch(this.walletsListSource)).json(), !Array.isArray(e)) - throw new ly("Wrong wallets list format, wallets list must be an array."); + throw new hy("Wrong wallets list format, wallets list must be an array."); const i = e.filter((s) => !this.isCorrectWalletConfigDTO(s)); i.length && (Oo(`Wallet(s) ${i.map((s) => s.name).join(", ")} config format is wrong. They were removed from the wallets list.`), e = e.filter((s) => this.isCorrectWalletConfigDTO(s))); } catch (n) { @@ -42410,7 +42421,7 @@ function Vie(t, e) { custom_data: Gu(t) }; } -function hy(t, e) { +function dy(t, e) { var r, n, i, s; return { valid_until: (r = String(e.validUntil)) !== null && r !== void 0 ? r : null, @@ -42425,13 +42436,13 @@ function hy(t, e) { }; } function Gie(t, e, r) { - return Object.assign(Object.assign({ type: "transaction-sent-for-signature" }, Yu(t, e)), hy(e, r)); + return Object.assign(Object.assign({ type: "transaction-sent-for-signature" }, Yu(t, e)), dy(e, r)); } function Yie(t, e, r, n) { - return Object.assign(Object.assign({ type: "transaction-signed", is_success: !0, signed_transaction: n.boc }, Yu(t, e)), hy(e, r)); + return Object.assign(Object.assign({ type: "transaction-signed", is_success: !0, signed_transaction: n.boc }, Yu(t, e)), dy(e, r)); } function Jie(t, e, r, n, i) { - return Object.assign(Object.assign({ type: "transaction-signing-failed", is_success: !1, error_message: n, error_code: i ?? null }, Yu(t, e)), hy(e, r)); + return Object.assign(Object.assign({ type: "transaction-signing-failed", is_success: !1, error_message: n, error_code: i ?? null }, Yu(t, e)), dy(e, r)); } function Xie(t, e, r) { return Object.assign({ type: "disconnection", scope: r }, Yu(t, e)); @@ -42658,7 +42669,7 @@ class Tp { eventDispatcher: e == null ? void 0 : e.eventDispatcher, tonConnectSdkVersion: ese }), !this.dappSettings.manifestUrl) - throw new cy("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"); + throw new uy("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"); this.bridgeConnectionStorage = new Dl(this.dappSettings.storage), e != null && e.disableAutoPauseConnection || this.addWindowFocusAndBlurSubscriptions(); } /** @@ -42710,7 +42721,7 @@ class Tp { var n, i; const s = {}; if (typeof r == "object" && "tonProof" in r && (s.request = r), typeof r == "object" && ("openingDeadlineMS" in r || "signal" in r || "request" in r) && (s.request = r == null ? void 0 : r.request, s.openingDeadlineMS = r == null ? void 0 : r.openingDeadlineMS, s.signal = r == null ? void 0 : r.signal), this.connected) - throw new uy(); + throw new fy(); const o = xs(s == null ? void 0 : s.signal); if ((n = this.abortController) === null || n === void 0 || n.abort(), this.abortController = o, o.signal.aborted) throw new Ut("Connection was aborted"); @@ -42933,7 +42944,7 @@ function tse(t) { data: W }); } - async function F() { + async function $() { A(!0); try { a(""); @@ -42953,7 +42964,7 @@ function tse(t) { } A(!1); } - function $() { + function F() { s.current = new L9({ width: 264, height: 264, @@ -42988,7 +42999,7 @@ function tse(t) { } const te = Oi(() => !!("deepLink" in e && e.deepLink), [e]), R = Oi(() => !!("universalLink" in e && e.universalLink && /t.me/.test(e.universalLink)), [e]); return Xn(() => { - $(), F(); + F(), $(); }, []), /* @__PURE__ */ me.jsxs(Ac, { children: [ /* @__PURE__ */ me.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ me.jsx(uh, { title: "Connect wallet", onBack: t.onBack }) }), /* @__PURE__ */ me.jsxs("div", { className: "xc-text-center xc-mb-6", children: [ @@ -43015,7 +43026,7 @@ function tse(t) { ] }); } function rse(t) { - const [e, r] = fr(""), [n, i] = fr(), [s, o] = fr(), a = ay(), [u, l] = fr(!1); + const [e, r] = fr(""), [n, i] = fr(), [s, o] = fr(), a = cy(), [u, l] = fr(!1); async function d(w) { var M, N; if (!w || !((M = w.connectItems) != null && M.tonProof)) return; @@ -43136,16 +43147,16 @@ function sse(t) { )) : /* @__PURE__ */ me.jsx(ise, {}) }) ] }); } -function doe(t) { +function poe(t) { const { onLogin: e, header: r, showEmailSignIn: n = !0, showMoreWallets: i = !0, showTonConnect: s = !0, showFeaturedWallets: o = !0 } = t, [a, u] = fr(""), [l, d] = fr(null), [g, w] = fr(""); - function A(F) { - d(F), u("evm-wallet"); + function A($) { + d($), u("evm-wallet"); } - function M(F) { - u("email"), w(F); + function M($) { + u("email"), w($); } - async function N(F) { - await e(F); + async function N($) { + await e($); } function L() { u("ton-wallet"); @@ -43197,15 +43208,15 @@ function doe(t) { ] }) }); } export { - loe as C, - M5 as H, + hoe as C, + I5 as H, JX as a, Nl as b, - use as c, - doe as d, + fse as c, + poe as d, Hd as e, - cse as h, - fse as r, + use as h, + lse as r, r4 as s, I0 as t, gp as u diff --git a/dist/main.d.ts b/dist/main.d.ts index 7393bcf..8d36622 100644 --- a/dist/main.d.ts +++ b/dist/main.d.ts @@ -1,2 +1,3 @@ export * from './codatta-connect-context-provider'; export * from './codatta-signin'; +export * from './codatta-connect'; diff --git a/dist/secp256k1-BZeczIQv.js b/dist/secp256k1-CWJe94hK.js similarity index 99% rename from dist/secp256k1-BZeczIQv.js rename to dist/secp256k1-CWJe94hK.js index 6a90324..9b6dbfb 100644 --- a/dist/secp256k1-BZeczIQv.js +++ b/dist/secp256k1-CWJe94hK.js @@ -1,4 +1,4 @@ -import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-7Oj8aJZz.js"; +import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-Dv8NlLmw.js"; class Kt extends ee { constructor(n, t) { super(), this.finished = !1, this.destroyed = !1, ne(n); diff --git a/lib/api/account.api.ts b/lib/api/account.api.ts index c8597bf..0c52357 100644 --- a/lib/api/account.api.ts +++ b/lib/api/account.api.ts @@ -1,5 +1,6 @@ import { AxiosInstance } from 'axios' import request from './request' +import { TonProofItemReply } from '@tonconnect/sdk' type TAccountType = 'email' | 'block_chain' export type TAccountRole = 'B' | 'C' @@ -28,6 +29,12 @@ interface ILoginParamsBase { } } +interface IConnectParamsBase { + account_type: string + connector: 'codatta_email' | 'codatta_wallet' | 'codatta_ton' + account_enum: TAccountRole, +} + interface IEmailLoginParams extends ILoginParamsBase { connector: 'codatta_email' account_type: 'email' @@ -35,6 +42,13 @@ interface IEmailLoginParams extends ILoginParamsBase { email_code: string } +interface IEmailConnectParams extends IConnectParamsBase { + connector: 'codatta_email' + account_type: 'email' + email:string, + email_code: string +} + interface IWalletLoginParams extends ILoginParamsBase { connector: 'codatta_wallet' account_type: 'block_chain' @@ -46,13 +60,33 @@ interface IWalletLoginParams extends ILoginParamsBase { message: string } +interface IWalletConnectParams extends IConnectParamsBase { + connector: 'codatta_wallet' + account_type: 'block_chain' + address: string + wallet_name: string + chain: string + nonce: string + signature: string + message: string +} + interface ITonLoginParams extends ILoginParamsBase { connector: 'codatta_ton' account_type: 'block_chain' wallet_name: string, address: string, chain: string, - connect_info: object[] + connect_info: [{[key:string]:string}, TonProofItemReply] +} + +interface ITonConnectParams extends IConnectParamsBase { + connector: 'codatta_ton' + account_type: 'block_chain' + wallet_name: string, + address: string, + chain: string, + connect_info: [{[key:string]:string}, TonProofItemReply] } class AccountApi { @@ -89,6 +123,21 @@ class AccountApi { const res = await this.request.post<{ data: ILoginResponse }>(`${this._apiBase}/api/v2/user/login`, props) return res.data } + + public async bindEmail(props: IEmailConnectParams) { + const res = await this.request.post('/api/v2/user/account/bind', props) + return res.data + } + + public async bindTonWallet(props: ITonConnectParams) { + const res = await this.request.post('/api/v2/user/account/bind', props) + return res.data + } + + public async bindEvmWallet(props: IWalletConnectParams) { + const res = await this.request.post('/api/v2/user/account/bind', props) + return res.data + } } export default new AccountApi(request) diff --git a/lib/api/request.ts b/lib/api/request.ts index 4d32dc7..7f35196 100644 --- a/lib/api/request.ts +++ b/lib/api/request.ts @@ -3,7 +3,8 @@ import axios, { AxiosError, AxiosResponse } from 'axios' const request = axios.create({ timeout: 60000, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': localStorage.getItem('auth') } }) diff --git a/lib/codatta-connect.tsx b/lib/codatta-connect.tsx index 04badbc..fc128ef 100644 --- a/lib/codatta-connect.tsx +++ b/lib/codatta-connect.tsx @@ -1,59 +1,134 @@ -import { useEffect, useState } from 'react' +import { useEffect, useRef, useState } from 'react' import SigninIndex from './components/signin-index' import AnimateContainer from './components/animate-container' import { WalletItem } from './types/wallet-item.class' import WalletConnectWidget from './components/wallet-connect-widget' +import TonWalletSelect from './components/ton-wallet-select' +import TonConnect, { Wallet, WalletInfoInjectable, WalletInfoRemote } from '@tonconnect/sdk' +import EvmWalletSelect from './components/evm-wallet-select' +import TonWalletConnect from './components/ton-wallet-connect' +import EmailConnectWidget from './components/email-connect-widget' +import { WalletSignInfo } from './components/wallet-connect' +import { WalletClient } from 'viem' + +export interface EmvWalletConnectInfo { + chain_type: 'eip155' + client: WalletClient, + connect_info: WalletSignInfo +} + +export interface TonWalletConnectInfo { + chain_type: 'ton' + client: TonConnect, + connect_info: Wallet +} export default function CodattaConnect(props: { - onSelectMoreWallets: () => void - onSelectTonConnect?: () => void - onConnect: (wallet: WalletItem) => Promise + onEvmWalletConnect: (connectInfo:EmvWalletConnectInfo) => Promise + onTonWalletConnect: (connectInfo:TonWalletConnectInfo) => Promise + onEmailConnect: (email:string, code:string) => Promise + config?: { + showEmailSignIn?: boolean + showFeaturedWallets?: boolean + showMoreWallets?: boolean + showTonConnect?: boolean + } }) { - const { onSelectMoreWallets, onSelectTonConnect, onConnect } = props + const { onEvmWalletConnect, onTonWalletConnect, onEmailConnect, config = { + showEmailSignIn: false, + showFeaturedWallets: true, + showMoreWallets: true, + showTonConnect: true + } } = props const [step, setStep] = useState('') - const [wallet, setWallet] = useState(null) + const [evmWallet, setEvmWallet] = useState() + const [tonWallet, setTonWallet] = useState() + const connector = useRef() + const [email, setEmail] = useState('') function handleSelectWallet(wallet: WalletItem) { - setWallet(wallet) - setStep('wallet') + setEvmWallet(wallet) + setStep('evm-wallet-connect') } - function handleSelectEmail(email:string) { - console.log('handleSelectEmail', email) - setStep('email') + function handleSelectEmail(email: string) { + setEmail(email) + setStep('email-connect') } - async function handleConnect(wallet: WalletItem) { - await onConnect(wallet) - setWallet(null) + async function handleConnect(wallet: WalletItem, signInfo: WalletSignInfo) { + await onEvmWalletConnect({ + chain_type: 'eip155', + client: wallet.client!, + connect_info: signInfo, + }) setStep('index') } + function handleSelectTonWallet(wallet: WalletInfoRemote | WalletInfoInjectable) { + setTonWallet(wallet) + setStep('ton-wallet-connect') + } + + async function handleStatusChange(wallet: Wallet | null) { + if (!wallet) return + await onTonWalletConnect({ + chain_type: 'ton', + client: connector.current!, + connect_info: wallet + }) + } + useEffect(() => { + connector.current = new TonConnect({ + manifestUrl: 'https://static.codatta.io/static/tonconnect-manifest.json?v=2' + }) + + const unsubscribe = connector.current.onStatusChange(handleStatusChange) setStep('index') + return unsubscribe }, []) return ( - - {step === 'wallet' && ( + + + {step === 'evm-wallet-select' && ( + setStep('index')} + onSelectWallet={handleSelectWallet} + > + )} + {step === 'evm-wallet-connect' && ( setStep('index')} onConnect={handleConnect} - wallet={wallet!} + wallet={evmWallet!} > )} + {step === 'ton-wallet-select' && ( + setStep('index')} + > + )} + {step === 'ton-wallet-connect' && ( + setStep('index')} + > + )} + {step === 'email-connect' && ( + setStep('index')} onInputCode={onEmailConnect} /> + )} {step === 'index' && ( setStep('evm-wallet-select')} + onSelectTonConnect={() => setStep('ton-wallet-select')} + config={config} > )} diff --git a/lib/codatta-signin.tsx b/lib/codatta-signin.tsx index 3c3cf1f..67d22af 100644 --- a/lib/codatta-signin.tsx +++ b/lib/codatta-signin.tsx @@ -81,9 +81,10 @@ export function CodattaSignin(props: { }} > )} - {step === 'all-wallet' && ( setStep('index')} - onSelectWallet={handleSelectWallet} - > + {step === 'all-wallet' && ( + setStep('index')} + onSelectWallet={handleSelectWallet} + > )} diff --git a/lib/components/email-connect-widget.tsx b/lib/components/email-connect-widget.tsx new file mode 100644 index 0000000..b15ceac --- /dev/null +++ b/lib/components/email-connect-widget.tsx @@ -0,0 +1,21 @@ + +import TransitionEffect from './transition-effect' +import ControlHead from './control-head' +import EmailConnect from './email-connect' + +export default function EmailConnectWidget(props: { + email: string + onInputCode: (email: string, code: string) => Promise + onBack: () => void +}) { + const { email } = props + + return ( + +
+ +
+ + + ) +} diff --git a/lib/components/email-connect.tsx b/lib/components/email-connect.tsx new file mode 100644 index 0000000..e0040b4 --- /dev/null +++ b/lib/components/email-connect.tsx @@ -0,0 +1,101 @@ + +import TransitionEffect from './transition-effect' +import { useEffect, useState } from 'react' +import { InputOTP, InputOTPGroup, InputOTPSlot } from './ui/input-otp' +import accountApi from '@/api/account.api' +import { Loader2, Mail } from 'lucide-react' +import Spin from './ui/spin' +import { cn } from '@udecode/cn' + +export default function EmailConnect(props: { + email: string + onInputCode: (email:string, code:string) => Promise +}) { + const { email } = props + const [count, setCount] = useState(0) + const [loading, setLoading] = useState(false) + const [sendingCode, setSendingCode] = useState(false) + const [getCodeError, setGetCodeError] = useState('') + const [connectError, setConnectError] = useState('') + + async function startCountDown() { + setCount(60) + const timer = setInterval(() => { + setCount((prev) => { + if (prev === 0) { + clearInterval(timer) + return 0 + } + return prev - 1 + }) + }, 1000) + } + + async function sendEmailCode(email: string) { + setSendingCode(true) + try { + setGetCodeError('') + await accountApi.getEmailCode({ account_type: 'email', email }) + startCountDown() + } catch (err: any) { + setGetCodeError(err.message) + } + setSendingCode(false) + } + + useEffect(() => { + if (!email) return + sendEmailCode(email) + }, [email]) + + async function handleOTPChange(value: string) { + setConnectError('') + if (value.length < 6) return + setLoading(true) + try { + await props.onInputCode(email, value) + } catch (err: any) { + setConnectError(err.message) + } + setLoading(false) + } + + return ( + +
+ +
+ {getCodeError ?

{getCodeError}

: + sendingCode ? : <> +

We’ve sent a verification code to

+

{email}

+ + } +
+ +
+ + + +
+ + + + + + +
+
+
+
+
+ {connectError &&

{connectError}

} +
+ +
+ Not get it? {count ? `Recend in ${count}s` : } +
+ +
+ ) +} diff --git a/lib/components/email-login-widget.tsx b/lib/components/email-login-widget.tsx new file mode 100644 index 0000000..5745746 --- /dev/null +++ b/lib/components/email-login-widget.tsx @@ -0,0 +1,40 @@ +import ControlHead from './control-head' +import TransitionEffect from './transition-effect' +import accountApi, { ILoginResponse } from '@/api/account.api' +import { useCodattaSigninContext } from '@/providers/codatta-signin-context-provider' +import EmailConnect from './email-connect' + +export default function EmailLoginWidget(props: { + email: string + onLogin: (res: ILoginResponse) => Promise + onBack: () => void +}) { + const { email } = props + const config = useCodattaSigninContext() + + async function handleOTPChange(email: string, value: string) { + const res = await accountApi.emailLogin({ + account_type: 'email', + connector: 'codatta_email', + account_enum: 'C', + email_code: value, + email: email, + inviter_code: config.inviterCode, + source: { + device: config.device, + channel: config.channel, + app: config.app + } + }) + props.onLogin(res.data) + } + + return ( + +
+ +
+ +
+ ) +} diff --git a/lib/components/ton-wallet-connect.tsx b/lib/components/ton-wallet-connect.tsx index 0b2afe6..4e0c139 100644 --- a/lib/components/ton-wallet-connect.tsx +++ b/lib/components/ton-wallet-connect.tsx @@ -15,7 +15,7 @@ export default function TonWalletConnect(props: { connector: TonConnect wallet: WalletInfoRemote | WalletInfoInjectable onBack: () => void - loading: boolean + loading?: boolean }) { const { wallet, connector, loading } = props const qrCodeContainer = useRef(null) @@ -24,7 +24,6 @@ export default function TonWalletConnect(props: { const [nonce, setNonce] = useState() const [_guideType, _setGuideType] = useState<'connect' | 'sign' | 'waiting'>('connect') const [qrLoading, setQrLoading] = useState(false) - // const { saveLastUsedWallet } = useCodattaConnectContext() const [link, setLink] = useState() diff --git a/lib/components/ton-wallet-select.tsx b/lib/components/ton-wallet-select.tsx index 1299e35..6f91483 100644 --- a/lib/components/ton-wallet-select.tsx +++ b/lib/components/ton-wallet-select.tsx @@ -1,6 +1,6 @@ import { useEffect, useMemo, useState } from 'react' import { SignInOptionItem } from './wallet-option' -import TonConnect, { WalletInfo } from '@tonconnect/sdk' +import TonConnect, { WalletInfo, WalletInfoInjectable, WalletInfoRemote } from '@tonconnect/sdk' import TransitionEffect from './transition-effect' import ControlHead from './control-head' import { Search } from 'lucide-react' @@ -16,7 +16,7 @@ function TonWalletOption(props: { wallet: WalletInfo, onClick: (wallet: WalletIn export default function TonWalletSelect(props: { connector: TonConnect - onSelect: (wallet: WalletInfo) => void + onSelect: (wallet: WalletInfoRemote | WalletInfoInjectable) => void onBack: () => void }) { const { connector } = props @@ -44,7 +44,7 @@ export default function TonWalletSelect(props: { init() }, []) - function handleSelectWallet(wallet: WalletInfo) { + function handleSelectWallet(wallet: WalletInfoRemote | WalletInfoInjectable) { props.onSelect(wallet) } diff --git a/lib/components/wallet-connect-widget.tsx b/lib/components/wallet-connect-widget.tsx index 518a24c..48b1178 100644 --- a/lib/components/wallet-connect-widget.tsx +++ b/lib/components/wallet-connect-widget.tsx @@ -2,20 +2,20 @@ import { useState } from 'react' import ControlHead from './control-head' import TransitionEffect from './transition-effect' import WalletQr from './wallet-qr' -import WalletConnect from './wallet-connect' +import WalletConnect, { WalletSignInfo } from './wallet-connect' import GetWallet from './get-wallet' import { WalletItem } from '../types/wallet-item.class' export default function WalletConnectWidget(props: { wallet: WalletItem - onConnect: (wallet: WalletItem) => void + onConnect: (wallet: WalletItem, signInfo:WalletSignInfo) => void onBack: () => void }) { const { wallet, onConnect } = props const [step, setStep] = useState(wallet.installed ? 'connect' : 'qr') - async function handleSignFinish() { - onConnect(wallet) + async function handleSignFinish(wallet: WalletItem, signInfo: WalletSignInfo) { + onConnect(wallet, signInfo) } return ( diff --git a/lib/components/wallet-connect.tsx b/lib/components/wallet-connect.tsx index 892d5ea..3427e50 100644 --- a/lib/components/wallet-connect.tsx +++ b/lib/components/wallet-connect.tsx @@ -4,10 +4,19 @@ import accountApi from '../api/account.api' import { Loader2 } from 'lucide-react' import { WalletItem } from '../types/wallet-item.class' import { useCodattaConnectContext } from '../codatta-connect-context-provider' +import { getAddress } from 'viem' const CONNECT_GUIDE_MESSAGE = 'Accept connection request in the wallet' const MESSAGE_SIGN_GUIDE_MESSAGE = 'Accept sign-in request in your wallet' +export interface WalletSignInfo { + message: string + nonce: string + signature: string + address: string + wallet_name: string +} + function getSiweMessage(address: `0x${string}`, nonce: string) { const domain = window.location.host const uri = window.location.href @@ -24,13 +33,7 @@ function getSiweMessage(address: `0x${string}`, nonce: string) { export default function WalletConnect(props: { wallet: WalletItem - onSignFinish: (wallet:WalletItem , params: { - message: string - nonce: string - signature: string - address: string - wallet_name: string - }) => Promise + onSignFinish: (wallet:WalletItem , params: WalletSignInfo) => Promise onShowQrCode: () => void }) { const [error, setError] = useState() @@ -42,18 +45,19 @@ export default function WalletConnect(props: { async function walletSignin(nonce: string) { try { setGuideType('connect') - const address = await wallet.connect() - if (!address || address.length === 0) { + const addresses = await wallet.connect() + if (!addresses || addresses.length === 0) { throw new Error('Wallet connect error') } - const message = getSiweMessage(address[0], nonce) + const address = getAddress(addresses[0]) + const message = getSiweMessage(address, nonce) setGuideType('sign') - const signature = await wallet.signMessage(message, address[0]) + const signature = await wallet.signMessage(message, address) if (!signature || signature.length === 0) { throw new Error('user sign error') } setGuideType('waiting') - await onSignFinish(wallet, { address: address[0], signature, message, nonce, wallet_name: wallet.config?.name || '' }) + await onSignFinish(wallet, { address, signature, message, nonce, wallet_name: wallet.config?.name || '' }) saveLastUsedWallet(wallet) } catch (err: any) { console.log(err.details) diff --git a/lib/main.ts b/lib/main.ts index 0891ace..040f608 100644 --- a/lib/main.ts +++ b/lib/main.ts @@ -1,3 +1,4 @@ import './index.css' export * from './codatta-connect-context-provider' -export * from './codatta-signin' \ No newline at end of file +export * from './codatta-signin' +export * from './codatta-connect' \ No newline at end of file diff --git a/lib/providers/codatta-signin-context-provider.tsx b/lib/providers/codatta-signin-context-provider.tsx index 4f26e36..ed235bc 100644 --- a/lib/providers/codatta-signin-context-provider.tsx +++ b/lib/providers/codatta-signin-context-provider.tsx @@ -1,5 +1,6 @@ import { TDeviceType } from '@/api/account.api' import { createContext, useContext, useEffect, useState } from 'react' +import 'https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js' export interface CodattaSigninConfig { channel: string, diff --git a/package.json b/package.json index 6103958..6de82fa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codatta-connect", - "version": "2.1.6", + "version": "2.1.8", "type": "module", "main": "./dist/index.umd.js", "module": "./dist/index.es.js", @@ -10,7 +10,7 @@ "url": "git+https://github.com/codatta/codatta-connect.git" }, "scripts": { - "dev": "vite dev -c vite.config.dev.ts", + "dev": "vite dev -c vite.config.dev.ts --host", "build": "vite build -c vite.config.build.ts" }, "dependencies": { diff --git a/src/layout/app-layout.tsx b/src/layout/app-layout.tsx index ed264c0..4117c30 100644 --- a/src/layout/app-layout.tsx +++ b/src/layout/app-layout.tsx @@ -2,7 +2,7 @@ import React from 'react' import { CodattaConnectContextProvider } from '../../lib/main' export default function AppLayout(props: { children: React.ReactNode }) { - return + return
{props.children}
diff --git a/src/views/login-view.tsx b/src/views/login-view.tsx index 61a53d7..fe632b9 100644 --- a/src/views/login-view.tsx +++ b/src/views/login-view.tsx @@ -1,21 +1,80 @@ -import { ILoginResponse } from '../../lib/api/account.api' -import { CodattaSignin} from '../../lib/main' +import accountApi, { ILoginResponse } from '../../lib/api/account.api' +import CodattaConnect, { EmvWalletConnectInfo, TonWalletConnectInfo } from '../../lib/codatta-connect' +import { CodattaSignin } from '../../lib/main' import React from 'react' export default function LoginView() { + async function handleLogin(res: ILoginResponse) { + localStorage.setItem('auth', res.token) + } + + async function handleEmailConnect(email: string, code: string) { + const data = await accountApi.bindEmail({ + account_type: 'email', + connector: 'codatta_email', + account_enum: 'C', + email_code: code, + email: email, + }) + } + + async function handleTonWalletConnect(info: TonWalletConnectInfo) { + + const account = info.connect_info.account + const connectItems = info.connect_info.connectItems + + if (!connectItems?.tonProof) return + + const data = await accountApi.bindTonWallet({ + account_type: 'block_chain', + connector: 'codatta_ton', + account_enum: 'C', + chain: info.connect_info.account.chain, + wallet_name: info.connect_info.device.appName, + address: info.connect_info.account.address, + connect_info: [ + { name: 'ton_addr', network: account.chain, ...account }, + connectItems.tonProof + ], + }) - async function handleLogin(res:ILoginResponse) { - console.log('this is out component') - console.log(res) } - return ( - + async function handleEvmWalletConnect(info: EmvWalletConnectInfo) { + const data = await accountApi.bindEvmWallet({ + account_type: 'block_chain', + connector: 'codatta_wallet', + account_enum: 'C', + chain: (await info.client.getChainId()).toString(), + address: (await info.client.getAddresses())[0], + signature: info.connect_info.signature, + nonce: info.connect_info.nonce, + wallet_name: info.connect_info.wallet_name, + message: info.connect_info.message, + }) + console.log(data) + } + + + return (<> + + + + ) } \ No newline at end of file diff --git a/vite.config.dev.ts b/vite.config.dev.ts index ea18308..e5bb5f2 100644 --- a/vite.config.dev.ts +++ b/vite.config.dev.ts @@ -1,7 +1,30 @@ -import { defineConfig } from 'vite' +import { defineConfig, HttpProxy, ProxyOptions } from 'vite' import react from '@vitejs/plugin-react' import tailwindcss from "tailwindcss" import path from 'path' +import { ClientRequest, IncomingMessage, ServerResponse } from 'http' +import { debug } from 'console' + +function proxyDebug(proxy: HttpProxy.Server, _options: ProxyOptions) { + proxy.on( + 'error', + (err: Error, _req: IncomingMessage, _res: ServerResponse, _target?: HttpProxy.ProxyTargetUrl) => { + console.log('proxy error', err) + } + ) + proxy.on('proxyReq', (proxyReq: ClientRequest, req: IncomingMessage, _res: ServerResponse) => { + console.log( + '[Request]:', + req.method, + req.url, + ' => ', + `${proxyReq.method} ${proxyReq.protocol}//${proxyReq.host}${proxyReq.path}` + ) + }) + proxy.on('proxyRes', (proxyRes: IncomingMessage, req: IncomingMessage, _res: ServerResponse) => { + console.log('[Response]:', proxyRes.statusCode, req.url) + }) +} export default defineConfig({ resolve: { @@ -16,8 +39,9 @@ export default defineConfig({ server: { proxy: { '/api': { - target: 'http://app-test.b18a.io', + target: 'https://app-test.b18a.io', changeOrigin: true, + configure: proxyDebug, }, } }, From 904db4823432f3db7af4014719d4f2081c34fc84 Mon Sep 17 00:00:00 2001 From: markof Date: Mon, 23 Dec 2024 16:36:39 +0800 Subject: [PATCH 02/25] fix: export codatta connect --- dist/codatta-connect.d.ts | 2 +- dist/index.es.js | 8 +- dist/index.umd.js | 156 +- dist/{main-Dv8NlLmw.js => main-DfEBGh6l.js} | 21895 ++++++++-------- ...56k1-CWJe94hK.js => secp256k1-S2RhtMGq.js} | 2 +- lib/codatta-connect.tsx | 2 +- package.json | 2 +- 7 files changed, 11118 insertions(+), 10949 deletions(-) rename dist/{main-Dv8NlLmw.js => main-DfEBGh6l.js} (69%) rename dist/{secp256k1-CWJe94hK.js => secp256k1-S2RhtMGq.js} (99%) diff --git a/dist/codatta-connect.d.ts b/dist/codatta-connect.d.ts index b3c574e..3a5f7d6 100644 --- a/dist/codatta-connect.d.ts +++ b/dist/codatta-connect.d.ts @@ -11,7 +11,7 @@ export interface TonWalletConnectInfo { client: TonConnect; connect_info: Wallet; } -export default function CodattaConnect(props: { +export declare function CodattaConnect(props: { onEvmWalletConnect: (connectInfo: EmvWalletConnectInfo) => Promise; onTonWalletConnect: (connectInfo: TonWalletConnectInfo) => Promise; onEmailConnect: (email: string, code: string) => Promise; diff --git a/dist/index.es.js b/dist/index.es.js index ab3a888..6e44290 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -1,8 +1,8 @@ -import { C as e, d as n, a as C, u as s } from "./main-Dv8NlLmw.js"; -import "react"; +import { f as o, C as n, d as e, a as C, u as s } from "./main-DfEBGh6l.js"; export { - e as CodattaConnectContextProvider, - n as CodattaSignin, + o as CodattaConnect, + n as CodattaConnectContextProvider, + e as CodattaSignin, C as coinbaseWallet, s as useCodattaConnectContext }; diff --git a/dist/index.umd.js b/dist/index.umd.js index 65a4cd8..f45b274 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -1,4 +1,4 @@ -(function(Vn,Pe){typeof exports=="object"&&typeof module<"u"?Pe(exports,require("react"),require("https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js")):typeof define=="function"&&define.amd?define(["exports","react","https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"],Pe):(Vn=typeof globalThis<"u"?globalThis:Vn||self,Pe(Vn["xny-connect"]={},Vn.React))})(this,function(Vn,Pe){"use strict";var noe=Object.defineProperty;var ioe=(Vn,Pe,Lc)=>Pe in Vn?noe(Vn,Pe,{enumerable:!0,configurable:!0,writable:!0,value:Lc}):Vn[Pe]=Lc;var so=(Vn,Pe,Lc)=>ioe(Vn,typeof Pe!="symbol"?Pe+"":Pe,Lc);function Lc(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const Yt=Lc(Pe);var nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ui(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Jp(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Xp={exports:{}},pf={};/** +(function(Fn,Se){typeof exports=="object"&&typeof module<"u"?Se(exports,require("react"),require("https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js")):typeof define=="function"&&define.amd?define(["exports","react","https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"],Se):(Fn=typeof globalThis<"u"?globalThis:Fn||self,Se(Fn["xny-connect"]={},Fn.React))})(this,function(Fn,Se){"use strict";var aoe=Object.defineProperty;var coe=(Fn,Se,kc)=>Se in Fn?aoe(Fn,Se,{enumerable:!0,configurable:!0,writable:!0,value:kc}):Fn[Se]=kc;var co=(Fn,Se,kc)=>coe(Fn,typeof Se!="symbol"?Se+"":Se,kc);function kc(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const Yt=kc(Se);var nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ui(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Jp(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Xp={exports:{}},gf={};/** * @license React * react-jsx-runtime.production.min.js * @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Wy;function UA(){if(Wy)return pf;Wy=1;var t=Pe,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,u,l){var d,g={},y=null,A=null;l!==void 0&&(y=""+l),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(A=u.ref);for(d in u)n.call(u,d)&&!s.hasOwnProperty(d)&&(g[d]=u[d]);if(a&&a.defaultProps)for(d in u=a.defaultProps,u)g[d]===void 0&&(g[d]=u[d]);return{$$typeof:e,type:a,key:y,ref:A,props:g,_owner:i.current}}return pf.Fragment=r,pf.jsx=o,pf.jsxs=o,pf}var gf={};/** + */var Vy;function JA(){if(Vy)return gf;Vy=1;var t=Se,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,u,l){var d,g={},y=null,A=null;l!==void 0&&(y=""+l),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(A=u.ref);for(d in u)n.call(u,d)&&!s.hasOwnProperty(d)&&(g[d]=u[d]);if(a&&a.defaultProps)for(d in u=a.defaultProps,u)g[d]===void 0&&(g[d]=u[d]);return{$$typeof:e,type:a,key:y,ref:A,props:g,_owner:i.current}}return gf.Fragment=r,gf.jsx=o,gf.jsxs=o,gf}var mf={};/** * @license React * react-jsx-runtime.development.js * @@ -14,42 +14,42 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ky;function jA(){return Ky||(Ky=1,process.env.NODE_ENV!=="production"&&function(){var t=Pe,e=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),A=Symbol.for("react.offscreen"),P=Symbol.iterator,N="@@iterator";function D(j){if(j===null||typeof j!="object")return null;var oe=P&&j[P]||j[N];return typeof oe=="function"?oe:null}var k=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function $(j){{for(var oe=arguments.length,pe=new Array(oe>1?oe-1:0),xe=1;xe1?oe-1:0),xe=1;xe=1&&tt>=0&&je[st]!==gt[tt];)tt--;for(;st>=1&&tt>=0;st--,tt--)if(je[st]!==gt[tt]){if(st!==1||tt!==1)do if(st--,tt--,tt<0||je[st]!==gt[tt]){var At=` -`+je[st].replace(" at new "," at ");return j.displayName&&At.includes("")&&(At=At.replace("",j.displayName)),typeof j=="function"&&R.set(j,At),At}while(st>=1&&tt>=0);break}}}finally{Q=!1,se.current=De,O(),Error.prepareStackTrace=Re}var Rt=j?j.displayName||j.name:"",Mt=Rt?X(Rt):"";return typeof j=="function"&&R.set(j,Mt),Mt}function le(j,oe,pe){return te(j,!1)}function ie(j){var oe=j.prototype;return!!(oe&&oe.isReactComponent)}function fe(j,oe,pe){if(j==null)return"";if(typeof j=="function")return te(j,ie(j));if(typeof j=="string")return X(j);switch(j){case l:return X("Suspense");case d:return X("SuspenseList")}if(typeof j=="object")switch(j.$$typeof){case u:return le(j.render);case g:return fe(j.type,oe,pe);case y:{var xe=j,Re=xe._payload,De=xe._init;try{return fe(De(Re),oe,pe)}catch{}}}return""}var ve=Object.prototype.hasOwnProperty,Me={},Ne=k.ReactDebugCurrentFrame;function Te(j){if(j){var oe=j._owner,pe=fe(j.type,j._source,oe?oe.type:null);Ne.setExtraStackFrame(pe)}else Ne.setExtraStackFrame(null)}function Be(j,oe,pe,xe,Re){{var De=Function.call.bind(ve);for(var it in j)if(De(j,it)){var je=void 0;try{if(typeof j[it]!="function"){var gt=Error((xe||"React class")+": "+pe+" type `"+it+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof j[it]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw gt.name="Invariant Violation",gt}je=j[it](oe,it,xe,pe,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(st){je=st}je&&!(je instanceof Error)&&(Te(Re),$("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",xe||"React class",pe,it,typeof je),Te(null)),je instanceof Error&&!(je.message in Me)&&(Me[je.message]=!0,Te(Re),$("Failed %s type: %s",pe,je.message),Te(null))}}}var Ie=Array.isArray;function Le(j){return Ie(j)}function Ve(j){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,pe=oe&&j[Symbol.toStringTag]||j.constructor.name||"Object";return pe}}function ke(j){try{return ze(j),!1}catch{return!0}}function ze(j){return""+j}function He(j){if(ke(j))return $("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ve(j)),ze(j)}var Ee=k.ReactCurrentOwner,Qe={key:!0,ref:!0,__self:!0,__source:!0},ct,$e,et;et={};function rt(j){if(ve.call(j,"ref")){var oe=Object.getOwnPropertyDescriptor(j,"ref").get;if(oe&&oe.isReactWarning)return!1}return j.ref!==void 0}function Je(j){if(ve.call(j,"key")){var oe=Object.getOwnPropertyDescriptor(j,"key").get;if(oe&&oe.isReactWarning)return!1}return j.key!==void 0}function pt(j,oe){if(typeof j.ref=="string"&&Ee.current&&oe&&Ee.current.stateNode!==oe){var pe=m(Ee.current.type);et[pe]||($('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',m(Ee.current.type),j.ref),et[pe]=!0)}}function ht(j,oe){{var pe=function(){ct||(ct=!0,$("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};pe.isReactWarning=!0,Object.defineProperty(j,"key",{get:pe,configurable:!0})}}function ft(j,oe){{var pe=function(){$e||($e=!0,$("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};pe.isReactWarning=!0,Object.defineProperty(j,"ref",{get:pe,configurable:!0})}}var Ht=function(j,oe,pe,xe,Re,De,it){var je={$$typeof:e,type:j,key:oe,ref:pe,props:it,_owner:De};return je._store={},Object.defineProperty(je._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(je,"_self",{configurable:!1,enumerable:!1,writable:!1,value:xe}),Object.defineProperty(je,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Re}),Object.freeze&&(Object.freeze(je.props),Object.freeze(je)),je};function Jt(j,oe,pe,xe,Re){{var De,it={},je=null,gt=null;pe!==void 0&&(He(pe),je=""+pe),Je(oe)&&(He(oe.key),je=""+oe.key),rt(oe)&&(gt=oe.ref,pt(oe,Re));for(De in oe)ve.call(oe,De)&&!Qe.hasOwnProperty(De)&&(it[De]=oe[De]);if(j&&j.defaultProps){var st=j.defaultProps;for(De in st)it[De]===void 0&&(it[De]=st[De])}if(je||gt){var tt=typeof j=="function"?j.displayName||j.name||"Unknown":j;je&&ht(it,tt),gt&&ft(it,tt)}return Ht(j,je,gt,Re,xe,Ee.current,it)}}var St=k.ReactCurrentOwner,er=k.ReactDebugCurrentFrame;function Xt(j){if(j){var oe=j._owner,pe=fe(j.type,j._source,oe?oe.type:null);er.setExtraStackFrame(pe)}else er.setExtraStackFrame(null)}var Ot;Ot=!1;function $t(j){return typeof j=="object"&&j!==null&&j.$$typeof===e}function Tt(){{if(St.current){var j=m(St.current.type);if(j)return` +`),st=Ue.length-1,tt=gt.length-1;st>=1&&tt>=0&&Ue[st]!==gt[tt];)tt--;for(;st>=1&&tt>=0;st--,tt--)if(Ue[st]!==gt[tt]){if(st!==1||tt!==1)do if(st--,tt--,tt<0||Ue[st]!==gt[tt]){var At=` +`+Ue[st].replace(" at new "," at ");return q.displayName&&At.includes("")&&(At=At.replace("",q.displayName)),typeof q=="function"&&R.set(q,At),At}while(st>=1&&tt>=0);break}}}finally{Q=!1,se.current=De,N(),Error.prepareStackTrace=Re}var Rt=q?q.displayName||q.name:"",Mt=Rt?X(Rt):"";return typeof q=="function"&&R.set(q,Mt),Mt}function he(q,oe,ge){return te(q,!1)}function ie(q){var oe=q.prototype;return!!(oe&&oe.isReactComponent)}function fe(q,oe,ge){if(q==null)return"";if(typeof q=="function")return te(q,ie(q));if(typeof q=="string")return X(q);switch(q){case l:return X("Suspense");case d:return X("SuspenseList")}if(typeof q=="object")switch(q.$$typeof){case u:return he(q.render);case g:return fe(q.type,oe,ge);case y:{var xe=q,Re=xe._payload,De=xe._init;try{return fe(De(Re),oe,ge)}catch{}}}return""}var ve=Object.prototype.hasOwnProperty,Me={},Ne=k.ReactDebugCurrentFrame;function Te(q){if(q){var oe=q._owner,ge=fe(q.type,q._source,oe?oe.type:null);Ne.setExtraStackFrame(ge)}else Ne.setExtraStackFrame(null)}function $e(q,oe,ge,xe,Re){{var De=Function.call.bind(ve);for(var it in q)if(De(q,it)){var Ue=void 0;try{if(typeof q[it]!="function"){var gt=Error((xe||"React class")+": "+ge+" type `"+it+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof q[it]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw gt.name="Invariant Violation",gt}Ue=q[it](oe,it,xe,ge,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(st){Ue=st}Ue&&!(Ue instanceof Error)&&(Te(Re),B("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",xe||"React class",ge,it,typeof Ue),Te(null)),Ue instanceof Error&&!(Ue.message in Me)&&(Me[Ue.message]=!0,Te(Re),B("Failed %s type: %s",ge,Ue.message),Te(null))}}}var Ie=Array.isArray;function Le(q){return Ie(q)}function Ve(q){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,ge=oe&&q[Symbol.toStringTag]||q.constructor.name||"Object";return ge}}function ke(q){try{return ze(q),!1}catch{return!0}}function ze(q){return""+q}function He(q){if(ke(q))return B("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ve(q)),ze(q)}var Ee=k.ReactCurrentOwner,Qe={key:!0,ref:!0,__self:!0,__source:!0},ct,Be,et;et={};function rt(q){if(ve.call(q,"ref")){var oe=Object.getOwnPropertyDescriptor(q,"ref").get;if(oe&&oe.isReactWarning)return!1}return q.ref!==void 0}function Je(q){if(ve.call(q,"key")){var oe=Object.getOwnPropertyDescriptor(q,"key").get;if(oe&&oe.isReactWarning)return!1}return q.key!==void 0}function pt(q,oe){if(typeof q.ref=="string"&&Ee.current&&oe&&Ee.current.stateNode!==oe){var ge=m(Ee.current.type);et[ge]||(B('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',m(Ee.current.type),q.ref),et[ge]=!0)}}function ht(q,oe){{var ge=function(){ct||(ct=!0,B("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};ge.isReactWarning=!0,Object.defineProperty(q,"key",{get:ge,configurable:!0})}}function ft(q,oe){{var ge=function(){Be||(Be=!0,B("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};ge.isReactWarning=!0,Object.defineProperty(q,"ref",{get:ge,configurable:!0})}}var Ht=function(q,oe,ge,xe,Re,De,it){var Ue={$$typeof:e,type:q,key:oe,ref:ge,props:it,_owner:De};return Ue._store={},Object.defineProperty(Ue._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ue,"_self",{configurable:!1,enumerable:!1,writable:!1,value:xe}),Object.defineProperty(Ue,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Re}),Object.freeze&&(Object.freeze(Ue.props),Object.freeze(Ue)),Ue};function Jt(q,oe,ge,xe,Re){{var De,it={},Ue=null,gt=null;ge!==void 0&&(He(ge),Ue=""+ge),Je(oe)&&(He(oe.key),Ue=""+oe.key),rt(oe)&&(gt=oe.ref,pt(oe,Re));for(De in oe)ve.call(oe,De)&&!Qe.hasOwnProperty(De)&&(it[De]=oe[De]);if(q&&q.defaultProps){var st=q.defaultProps;for(De in st)it[De]===void 0&&(it[De]=st[De])}if(Ue||gt){var tt=typeof q=="function"?q.displayName||q.name||"Unknown":q;Ue&&ht(it,tt),gt&&ft(it,tt)}return Ht(q,Ue,gt,Re,xe,Ee.current,it)}}var St=k.ReactCurrentOwner,er=k.ReactDebugCurrentFrame;function Xt(q){if(q){var oe=q._owner,ge=fe(q.type,q._source,oe?oe.type:null);er.setExtraStackFrame(ge)}else er.setExtraStackFrame(null)}var Ot;Ot=!1;function Bt(q){return typeof q=="object"&&q!==null&&q.$$typeof===e}function Tt(){{if(St.current){var q=m(St.current.type);if(q)return` -Check the render method of \``+j+"`."}return""}}function vt(j){return""}var Dt={};function Lt(j){{var oe=Tt();if(!oe){var pe=typeof j=="string"?j:j.displayName||j.name;pe&&(oe=` +Check the render method of \``+q+"`."}return""}}function vt(q){return""}var Dt={};function Lt(q){{var oe=Tt();if(!oe){var ge=typeof q=="string"?q:q.displayName||q.name;ge&&(oe=` -Check the top-level render call using <`+pe+">.")}return oe}}function bt(j,oe){{if(!j._store||j._store.validated||j.key!=null)return;j._store.validated=!0;var pe=Lt(oe);if(Dt[pe])return;Dt[pe]=!0;var xe="";j&&j._owner&&j._owner!==St.current&&(xe=" It was passed a child from "+m(j._owner.type)+"."),Xt(j),$('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',pe,xe),Xt(null)}}function Bt(j,oe){{if(typeof j!="object")return;if(Le(j))for(var pe=0;pe",je=" Did you accidentally export a JSX literal instead of a component?"):st=typeof j,$("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",st,je)}var tt=Jt(j,oe,pe,Re,De);if(tt==null)return tt;if(it){var At=oe.children;if(At!==void 0)if(xe)if(Le(At)){for(var Rt=0;Rt0?"{key: someKey, "+Et.join(": ..., ")+": ...}":"{key: someKey}";if(!Ft[Mt+dt]){var _t=Et.length>0?"{"+Et.join(": ..., ")+": ...}":"{}";$(`A props object containing a "key" prop is being spread into JSX: +Check the top-level render call using <`+ge+">.")}return oe}}function bt(q,oe){{if(!q._store||q._store.validated||q.key!=null)return;q._store.validated=!0;var ge=Lt(oe);if(Dt[ge])return;Dt[ge]=!0;var xe="";q&&q._owner&&q._owner!==St.current&&(xe=" It was passed a child from "+m(q._owner.type)+"."),Xt(q),B('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ge,xe),Xt(null)}}function $t(q,oe){{if(typeof q!="object")return;if(Le(q))for(var ge=0;ge",Ue=" Did you accidentally export a JSX literal instead of a component?"):st=typeof q,B("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",st,Ue)}var tt=Jt(q,oe,ge,Re,De);if(tt==null)return tt;if(it){var At=oe.children;if(At!==void 0)if(xe)if(Le(At)){for(var Rt=0;Rt0?"{key: someKey, "+Et.join(": ..., ")+": ...}":"{key: someKey}";if(!Ft[Mt+dt]){var _t=Et.length>0?"{"+Et.join(": ..., ")+": ...}":"{}";B(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; - <%s key={someKey} {...props} />`,dt,Mt,_t,Mt),Ft[Mt+dt]=!0}}return j===n?nt(tt):Ut(tt),tt}}function H(j,oe,pe){return B(j,oe,pe,!0)}function V(j,oe,pe){return B(j,oe,pe,!1)}var C=V,Y=H;gf.Fragment=n,gf.jsx=C,gf.jsxs=Y}()),gf}process.env.NODE_ENV==="production"?Xp.exports=UA():Xp.exports=jA();var me=Xp.exports;const Ts="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2",qA=[{featured:!0,name:"MetaMask",rdns:"io.metamask",image:`${Ts}#metamask`,getWallet:{chrome_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",brave_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",edge_addon_id:"ejbalbakoplchlghecdalmeeeajnimhm",firefox_addon_id:"ether-metamask",play_store_id:"io.metamask",app_store_id:"id1438144202"},deep_link:"metamask://wc",universal_link:"https://metamask.app.link/wc"},{featured:!0,name:"OKX Wallet",rdns:"com.okex.wallet",image:`${Ts}#okx`,getWallet:{chrome_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",brave_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",edge_addon_id:"pbpjkcldjiffchgbbndmhojiacbgflha",play_store_id:"com.okinc.okex.gp",app_store_id:"id1327268470"},deep_link:"okex://main/wc",universal_link:"okex://main/wc"},{featured:!0,name:"WalletConnect",image:`${Ts}#walletconnect`},{featured:!1,name:"Coinbase Wallet",image:`${Ts}#coinbase`},{featured:!1,name:"GateWallet",rdns:"io.gate.wallet",image:`${Ts}#6e528abf-7a7d-47bd-d84d-481f169b1200`,getWallet:{chrome_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",brave_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",play_store_id:"com.gateio.gateio",app_store_id:"id1294998195",mac_app_store_id:"id1609559473"},deep_link:"https://www.gate.io/mobileapp",universal_link:"https://www.gate.io/mobileapp"},{featured:!1,name:"Onekey",rdns:"so.onekey.app.wallet",image:`${Ts}#onekey`,getWallet:{chrome_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",brave_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",play_store_id:"so.onekey.app.wallet",app_store_id:"id1609559473"},deep_link:"onekey-wallet://",universal_link:"onekey://wc"},{featured:!1,name:"Infinity Wallet",image:`${Ts}#9f259366-0bcd-4817-0af9-f78773e41900`,desktop_link:"infinity://wc"},{name:"Rabby Wallet",rdns:"io.rabby",featured:!1,image:`${Ts}#rabby`,getWallet:{chrome_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",brave_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",play_store_id:"com.debank.rabbymobile",app_store_id:"id6474381673"}},{name:"Binance Web3 Wallet",featured:!1,image:`${Ts}#ebac7b39-688c-41e3-7912-a4fefba74600`,getWallet:{play_store_id:"com.binance.dev",app_store_id:"id1436799971"}},{name:"Rainbow Wallet",rdns:"me.rainbow",featured:!1,image:`${Ts}#rainbow`,getWallet:{chrome_store_id:"opfgelmcmbiajamepnmloijbpoleiama",edge_addon_id:"cpojfbodiccabbabgimdeohkkpjfpbnf",firefox_addon_id:"rainbow-extension",app_store_id:"id1457119021",play_store_id:"me.rainbow"}}];function zA(t,e){const r=t.exec(e);return r==null?void 0:r.groups}const Vy=/^tuple(?(\[(\d*)\])*)$/;function Zp(t){let e=t.type;if(Vy.test(t.type)&&"components"in t){e="(";const r=t.components.length;for(let i=0;ie(t,s)}function kc(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new rP(t.type);return`${t.name}(${Qp(t.inputs,{includeName:e})})`}function Qp(t,{includeName:e=!1}={}){return t?t.map(r=>WA(r,{includeName:e})).join(e?", ":","):""}function WA(t,{includeName:e}){return t.type.startsWith("tuple")?`(${Qp(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}function Yo(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function _n(t){return Yo(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const Gy="2.21.45";let vf={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${Gy}`};class yt extends Error{constructor(e,r={}){var a;const n=(()=>{var u;return r.cause instanceof yt?r.cause.details:(u=r.cause)!=null&&u.message?r.cause.message:r.details})(),i=r.cause instanceof yt&&r.cause.docsPath||r.docsPath,s=(a=vf.getDocsUrl)==null?void 0:a.call(vf,{...r,docsPath:i}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...vf.version?[`Version: ${vf.version}`]:[]].join(` -`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=Gy}walk(e){return Yy(this,e)}}function Yy(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?Yy(t.cause,e):e?null:t}class KA extends yt{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` -`),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class Jy extends yt{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` -`),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class VA extends yt{constructor({data:e,params:r,size:n}){super([`Data size of ${n} bytes is too small for given parameters.`].join(` -`),{metaMessages:[`Params: (${Qp(r,{includeName:!0})})`,`Data: ${e} (${n} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=r,this.size=n}}class eg extends yt{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class GA extends yt{constructor({expectedLength:e,givenLength:r,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${e}`,`Given length: ${r}`].join(` -`),{name:"AbiEncodingArrayLengthMismatchError"})}}class YA extends yt{constructor({expectedSize:e,value:r}){super(`Size of bytes "${r}" (bytes${_n(r)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class JA extends yt{constructor({expectedLength:e,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${r}`].join(` -`),{name:"AbiEncodingLengthMismatchError"})}}class Xy extends yt{constructor(e,{docsPath:r}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(` -`),{docsPath:r,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class Zy extends yt{constructor(e,{docsPath:r}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` -`),{docsPath:r,name:"AbiFunctionNotFoundError"})}}class XA extends yt{constructor(e,r){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${kc(e.abiItem)}\`, and`,`\`${r.type}\` in \`${kc(r.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class ZA extends yt{constructor({expectedSize:e,givenSize:r}){super(`Expected bytes${e}, got bytes${r}.`,{name:"BytesSizeMismatchError"})}}class QA extends yt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(` -`),{docsPath:r,name:"InvalidAbiEncodingType"})}}class eP extends yt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` -`),{docsPath:r,name:"InvalidAbiDecodingType"})}}class tP extends yt{constructor(e){super([`Value "${e}" is not a valid array.`].join(` -`),{name:"InvalidArrayError"})}}class rP extends yt{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` -`),{name:"InvalidDefinitionTypeError"})}}class Qy extends yt{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}class ew extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}class tw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function $c(t,{dir:e,size:r=32}={}){return typeof t=="string"?Jo(t,{dir:e,size:r}):nP(t,{dir:e,size:r})}function Jo(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new ew({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function nP(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new ew({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie)throw new oP({givenSize:_n(t),maxSize:e})}function bf(t,e={}){const{signed:r}=e;e.size&&Rs(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<e.toString(16).padStart(2,"0"));function Rh(t,e={}){return typeof t=="number"||typeof t=="bigint"?Pr(t,e):typeof t=="string"?Dh(t,e):typeof t=="boolean"?rw(t,e):li(t,e)}function rw(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(Rs(r,{size:e.size}),$c(r,{size:e.size})):r}function li(t,e={}){let r="";for(let i=0;is||i=oo.zero&&t<=oo.nine)return t-oo.zero;if(t>=oo.A&&t<=oo.F)return t-(oo.A-10);if(t>=oo.a&&t<=oo.f)return t-(oo.a-10)}function ao(t,e={}){let r=t;e.size&&(Rs(r,{size:e.size}),r=$c(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function dP(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Oh(t.outputLen),Oh(t.blockLen)}function Uc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function sw(t,e){Fc(t);const r=e.outputLen;if(t.length>ow&Nh)}:{h:Number(t>>ow&Nh)|0,l:Number(t&Nh)|0}}function gP(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;it<>>32-r,vP=(t,e,r)=>e<>>32-r,bP=(t,e,r)=>e<>>64-r,yP=(t,e,r)=>t<>>64-r,jc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const wP=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),ng=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Ds=(t,e)=>t<<32-e|t>>>e,aw=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,xP=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function cw(t){for(let e=0;ee.toString(16).padStart(2,"0"));function EP(t){Fc(t);let e="";for(let r=0;rt().update(yf(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function PP(t){const e=(n,i)=>t(i).update(yf(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function MP(t=32){if(jc&&typeof jc.getRandomValues=="function")return jc.getRandomValues(new Uint8Array(t));if(jc&&typeof jc.randomBytes=="function")return jc.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const fw=[],lw=[],hw=[],IP=BigInt(0),wf=BigInt(1),CP=BigInt(2),TP=BigInt(7),RP=BigInt(256),DP=BigInt(113);for(let t=0,e=wf,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],fw.push(2*(5*n+r)),lw.push((t+1)*(t+2)/2%64);let i=IP;for(let s=0;s<7;s++)e=(e<>TP)*DP)%RP,e&CP&&(i^=wf<<(wf<r>32?bP(t,e,r):mP(t,e,r),pw=(t,e,r)=>r>32?yP(t,e,r):vP(t,e,r);function gw(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,u=(o+2)%10,l=r[u],d=r[u+1],g=dw(l,d,1)^r[a],y=pw(l,d,1)^r[a+1];for(let A=0;A<50;A+=10)t[o+A]^=g,t[o+A+1]^=y}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=lw[o],u=dw(i,s,a),l=pw(i,s,a),d=fw[o];i=t[d],s=t[d+1],t[d]=u,t[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=OP[n],t[1]^=NP[n]}r.fill(0)}class xf extends ig{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Oh(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=wP(this.state)}keccak(){aw||cw(this.state32),gw(this.state32,this.rounds),aw||cw(this.state32),this.posOut=0,this.pos=0}update(e){Uc(this);const{blockLen:r,state:n}=this;e=yf(e);const i=e.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Oh(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(sw(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new xf(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Xo=(t,e,r)=>uw(()=>new xf(e,t,r)),LP=Xo(6,144,224/8),kP=Xo(6,136,256/8),$P=Xo(6,104,384/8),BP=Xo(6,72,512/8),FP=Xo(1,144,224/8),mw=Xo(1,136,256/8),UP=Xo(1,104,384/8),jP=Xo(1,72,512/8),vw=(t,e,r)=>PP((n={})=>new xf(e,t,n.dkLen===void 0?r:n.dkLen,!0)),qP=vw(31,168,128/8),zP=vw(31,136,256/8),HP=Object.freeze(Object.defineProperty({__proto__:null,Keccak:xf,keccakP:gw,keccak_224:FP,keccak_256:mw,keccak_384:UP,keccak_512:jP,sha3_224:LP,sha3_256:kP,sha3_384:$P,sha3_512:BP,shake128:qP,shake256:zP},Symbol.toStringTag,{value:"Module"}));function _f(t,e){const r=e||"hex",n=mw(Yo(t,{strict:!1})?rg(t):t);return r==="bytes"?n:Rh(n)}const WP=t=>_f(rg(t));function KP(t){return WP(t)}function VP(t){let e=!0,r="",n=0,i="",s=!1;for(let o=0;o{const e=typeof t=="string"?t:HA(t);return VP(e)};function bw(t){return KP(GP(t))}const YP=bw;class qc extends yt{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class Lh extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const sg=new Lh(8192);function Ef(t,e){if(sg.has(`${t}.${e}`))return sg.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=_f(iw(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return sg.set(`${t}.${e}`,s),s}function og(t,e){if(!co(t,{strict:!1}))throw new qc({address:t});return Ef(t,e)}const JP=/^0x[a-fA-F0-9]{40}$/,ag=new Lh(8192);function co(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(ag.has(n))return ag.get(n);const i=JP.test(t)?t.toLowerCase()===t?!0:r?Ef(t)===t:!0:!1;return ag.set(n,i),i}function zc(t){return typeof t[0]=="string"?kh(t):XP(t)}function XP(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function kh(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}function $h(t,e,r,{strict:n}={}){return Yo(t,{strict:!1})?ZP(t,e,r,{strict:n}):xw(t,e,r,{strict:n})}function yw(t,e){if(typeof e=="number"&&e>0&&e>_n(t)-1)throw new Qy({offset:e,position:"start",size:_n(t)})}function ww(t,e,r){if(typeof e=="number"&&typeof r=="number"&&_n(t)!==r-e)throw new Qy({offset:r,position:"end",size:_n(t)})}function xw(t,e,r,{strict:n}={}){yw(t,e);const i=t.slice(e,r);return n&&ww(i,e,r),i}function ZP(t,e,r,{strict:n}={}){yw(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&ww(i,e,r),i}function _w(t,e){if(t.length!==e.length)throw new JA({expectedLength:t.length,givenLength:e.length});const r=QP({params:t,values:e}),n=ug(r);return n.length===0?"0x":n}function QP({params:t,values:e}){const r=[];for(let n=0;n0?zc([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:zc(s.map(({encoded:o})=>o))}}function rM(t,{param:e}){const[,r]=e.type.split("bytes"),n=_n(t);if(!r){let i=t;return n%32!==0&&(i=Jo(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:zc([Jo(Pr(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new YA({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:Jo(t,{dir:"right"})}}function nM(t){if(typeof t!="boolean")throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Jo(rw(t))}}function iM(t,{signed:e}){return{dynamic:!1,encoded:Pr(t,{size:32,signed:e})}}function sM(t){const e=Dh(t),r=Math.ceil(_n(e)/32),n=[];for(let i=0;ii))}}function fg(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const lg=t=>$h(bw(t),0,4);function Ew(t){const{abi:e,args:r=[],name:n}=t,i=Yo(n,{strict:!1}),s=e.filter(a=>i?a.type==="function"?lg(a)===n:a.type==="event"?YP(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((l,d)=>{const g="inputs"in a&&a.inputs[d];return g?hg(l,g):!1})){if(o&&"inputs"in o&&o.inputs){const l=Sw(a.inputs,o.inputs,r);if(l)throw new XA({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||s[0]}function hg(t,e){const r=typeof t,n=e.type;switch(n){case"address":return co(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>hg(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>hg(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Sw(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return Sw(i.components,s.components,r[n]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?co(r[n],{strict:!1}):o.includes("address")&&o.includes("bytes")?co(r[n],{strict:!1}):!1)return o}}function uo(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const Aw="/docs/contract/encodeFunctionData";function aM(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=Ew({abi:e,args:r,name:n});if(!s)throw new Zy(n,{docsPath:Aw});i=s}if(i.type!=="function")throw new Zy(void 0,{docsPath:Aw});return{abi:[i],functionName:lg(kc(i))}}function cM(t){const{args:e}=t,{abi:r,functionName:n}=(()=>{var a;return t.abi.length===1&&((a=t.functionName)!=null&&a.startsWith("0x"))?t:aM(t)})(),i=r[0],s=n,o="inputs"in i&&i.inputs?_w(i.inputs,e??[]):void 0;return kh([s,o??"0x"])}const uM={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},fM={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},lM={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Pw extends yt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class hM extends yt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class dM extends yt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const pM={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new dM({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new hM({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Pw({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Pw({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function dg(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(pM);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function gM(t,e={}){typeof e.size<"u"&&Rs(t,{size:e.size});const r=li(t,e);return bf(r,e)}function mM(t,e={}){let r=t;if(typeof e.size<"u"&&(Rs(r,{size:e.size}),r=tg(r)),r.length>1||r[0]>1)throw new sP(r);return!!r[0]}function fo(t,e={}){typeof e.size<"u"&&Rs(t,{size:e.size});const r=li(t,e);return Bc(r,e)}function vM(t,e={}){let r=t;return typeof e.size<"u"&&(Rs(r,{size:e.size}),r=tg(r,{dir:"right"})),new TextDecoder().decode(r)}function bM(t,e){const r=typeof e=="string"?ao(e):e,n=dg(r);if(_n(r)===0&&t.length>0)throw new eg;if(_n(e)&&_n(e)<32)throw new VA({data:typeof e=="string"?e:li(e),params:t,size:_n(e)});let i=0;const s=[];for(let o=0;o48?gM(i,{signed:r}):fo(i,{signed:r}),32]}function SM(t,e,{staticPosition:r}){const n=e.components.length===0||e.components.some(({name:o})=>!o),i=n?[]:{};let s=0;if(Sf(e)){const o=fo(t.readBytes(pg)),a=r+o;for(let u=0;uo.type==="error"&&n===lg(kc(o)));if(!s)throw new Xy(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?bM(s.inputs,$h(r,4)):void 0,errorName:s.name}}const Wc=(t,e,r)=>JSON.stringify(t,(n,i)=>typeof i=="bigint"?i.toString():i,r);function Iw({abiItem:t,args:e,includeFunctionName:r=!0,includeName:n=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${r?t.name:""}(${t.inputs.map((i,s)=>`${n&&i.name?`${i.name}: `:""}${typeof e[s]=="object"?Wc(e[s]):e[s]}`).join(", ")})`}const MM={gwei:9,wei:18},IM={ether:-9,wei:9};function Cw(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}function Tw(t,e="wei"){return Cw(t,MM[e])}function ls(t,e="wei"){return Cw(t,IM[e])}class CM extends yt{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class TM extends yt{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Bh(t){const e=Object.entries(t).map(([n,i])=>i===void 0||i===!1?null:[n,i]).filter(Boolean),r=e.reduce((n,[i])=>Math.max(n,i.length),0);return e.map(([n,i])=>` ${`${n}:`.padEnd(r+1)} ${i}`).join(` -`)}class RM extends yt{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(` -`),{name:"FeeConflictError"})}}class DM extends yt{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Bh(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class OM extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:g,value:y}){var P;const A=Bh({chain:i&&`${i==null?void 0:i.name} (id: ${i==null?void 0:i.id})`,from:r==null?void 0:r.address,to:g,value:typeof y<"u"&&`${Tw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${ls(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${ls(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ls(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",A].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const NM=t=>t,Rw=t=>t;class LM extends yt{constructor(e,{abi:r,args:n,contractAddress:i,docsPath:s,functionName:o,sender:a}){const u=Ew({abi:r,args:n,name:o}),l=u?Iw({abiItem:u,args:n,includeFunctionName:!1,includeName:!1}):void 0,d=u?kc(u,{includeName:!0}):void 0,g=Bh({address:i&&NM(i),function:d,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:s,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],g&&"Contract Call:",g].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=e,this.contractAddress=i,this.functionName=o,this.sender=a}}class kM extends yt{constructor({abi:e,data:r,functionName:n,message:i}){let s,o,a,u;if(r&&r!=="0x")try{o=PM({abi:e,data:r});const{abiItem:d,errorName:g,args:y}=o;if(g==="Error")u=y[0];else if(g==="Panic"){const[A]=y;u=uM[A]}else{const A=d?kc(d,{includeName:!0}):void 0,P=d&&y?Iw({abiItem:d,args:y,includeFunctionName:!1,includeName:!1}):void 0;a=[A?`Error: ${A}`:"",P&&P!=="()"?` ${[...Array((g==null?void 0:g.length)??0).keys()].map(()=>" ").join("")}${P}`:""]}}catch(d){s=d}else i&&(u=i);let l;s instanceof Xy&&(l=s.signature,a=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(u&&u!=="execution reverted"||l?[`The contract function "${n}" reverted with the following ${l?"signature":"reason"}:`,u||l].join(` -`):`The contract function "${n}" reverted.`,{cause:s,metaMessages:a,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.reason=u,this.signature=l}}class $M extends yt{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class BM extends yt{constructor({data:e,message:r}){super(r||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}class Dw extends yt{constructor({body:e,cause:r,details:n,headers:i,status:s,url:o}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${Rw(o)}`,e&&`Request body: ${Wc(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=i,this.status=s,this.url=o}}class FM extends yt{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${Rw(n)}`,`Request body: ${Wc(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code}}const UM=-1;class hi extends yt{constructor(e,{code:r,docsPath:n,metaMessages:i,name:s,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:i||(e==null?void 0:e.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||e.name,this.code=e instanceof FM?e.code:r??UM}}class Kc extends hi{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class Af extends hi{constructor(e){super(e,{code:Af.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Af,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Pf extends hi{constructor(e){super(e,{code:Pf.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Pf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Mf extends hi{constructor(e,{method:r}={}){super(e,{code:Mf.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(Mf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class If extends hi{constructor(e){super(e,{code:If.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` -`)})}}Object.defineProperty(If,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class ka extends hi{constructor(e){super(e,{code:ka.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(ka,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Cf extends hi{constructor(e){super(e,{code:Cf.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` -`)})}}Object.defineProperty(Cf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Tf extends hi{constructor(e){super(e,{code:Tf.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Tf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Rf extends hi{constructor(e){super(e,{code:Rf.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Rf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Df extends hi{constructor(e){super(e,{code:Df.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Df,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Of extends hi{constructor(e,{method:r}={}){super(e,{code:Of.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not implemented.`})}}Object.defineProperty(Of,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Vc extends hi{constructor(e){super(e,{code:Vc.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Vc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Nf extends hi{constructor(e){super(e,{code:Nf.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Nf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Gc extends Kc{constructor(e){super(e,{code:Gc.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Gc,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Lf extends Kc{constructor(e){super(e,{code:Lf.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Lf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class kf extends Kc{constructor(e,{method:r}={}){super(e,{code:kf.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(kf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class $f extends Kc{constructor(e){super(e,{code:$f.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty($f,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Bf extends Kc{constructor(e){super(e,{code:Bf.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Bf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Ff extends Kc{constructor(e){super(e,{code:Ff.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Ff,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class jM extends hi{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const qM=3;function zM(t,{abi:e,address:r,args:n,docsPath:i,functionName:s,sender:o}){const{code:a,data:u,message:l,shortMessage:d}=t instanceof BM?t:t instanceof yt?t.walk(y=>"data"in y)||t.walk():{},g=t instanceof eg?new $M({functionName:s}):[qM,ka.code].includes(a)&&(u||l||d)?new kM({abi:e,data:typeof u=="object"?u.data:u,functionName:s,message:d??l}):t;return new LM(g,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:o})}function HM(t){const e=_f(`0x${t.substring(4)}`).substring(26);return Ef(`0x${e}`)}async function WM({hash:t,signature:e}){const r=Yo(t)?t:Rh(t),{secp256k1:n}=await Promise.resolve().then(()=>TC);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:d,v:g,yParity:y}=e,A=Number(y??g),P=Ow(A);return new n.Signature(bf(l),bf(d)).addRecoveryBit(P)}const o=Yo(e)?e:Rh(e),a=Bc(`0x${o.slice(130)}`),u=Ow(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Ow(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function KM({hash:t,signature:e}){return HM(await WM({hash:t,signature:e}))}function VM(t,e="hex"){const r=Nw(t),n=dg(new Uint8Array(r.length));return r.encode(n),e==="hex"?li(n.bytes):n.bytes}function Nw(t){return Array.isArray(t)?GM(t.map(e=>Nw(e))):YM(t)}function GM(t){const e=t.reduce((i,s)=>i+s.length,0),r=Lw(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function YM(t){const e=typeof t=="string"?ao(t):t,r=Lw(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function Lw(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new yt("Length is too large.")}function JM(t){const{chainId:e,contractAddress:r,nonce:n,to:i}=t,s=_f(kh(["0x05",VM([e?Pr(e):"0x",r,n?Pr(n):"0x"])]));return i==="bytes"?ao(s):s}async function kw(t){const{authorization:e,signature:r}=t;return KM({hash:JM(e),signature:r??e})}class XM extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:g,value:y}){var P;const A=Bh({from:r==null?void 0:r.address,to:g,value:typeof y<"u"&&`${Tw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${ls(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${ls(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ls(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",A].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class Yc extends yt{constructor({cause:e,message:r}={}){var i;const n=(i=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(Yc,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Yc,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Fh extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${ls(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(Fh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class gg extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${ls(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(gg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class mg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(mg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class vg extends yt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` + <%s key={someKey} {...props} />`,dt,Mt,_t,Mt),Ft[Mt+dt]=!0}}return q===n?nt(tt):jt(tt),tt}}function H(q,oe,ge){return $(q,oe,ge,!0)}function V(q,oe,ge){return $(q,oe,ge,!1)}var C=V,Y=H;mf.Fragment=n,mf.jsx=C,mf.jsxs=Y}()),mf}process.env.NODE_ENV==="production"?Xp.exports=JA():Xp.exports=XA();var le=Xp.exports;const Rs="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2",ZA=[{featured:!0,name:"MetaMask",rdns:"io.metamask",image:`${Rs}#metamask`,getWallet:{chrome_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",brave_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",edge_addon_id:"ejbalbakoplchlghecdalmeeeajnimhm",firefox_addon_id:"ether-metamask",play_store_id:"io.metamask",app_store_id:"id1438144202"},deep_link:"metamask://wc",universal_link:"https://metamask.app.link/wc"},{featured:!0,name:"OKX Wallet",rdns:"com.okex.wallet",image:`${Rs}#okx`,getWallet:{chrome_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",brave_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",edge_addon_id:"pbpjkcldjiffchgbbndmhojiacbgflha",play_store_id:"com.okinc.okex.gp",app_store_id:"id1327268470"},deep_link:"okex://main/wc",universal_link:"okex://main/wc"},{featured:!0,name:"WalletConnect",image:`${Rs}#walletconnect`},{featured:!1,name:"Coinbase Wallet",image:`${Rs}#coinbase`},{featured:!1,name:"GateWallet",rdns:"io.gate.wallet",image:`${Rs}#6e528abf-7a7d-47bd-d84d-481f169b1200`,getWallet:{chrome_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",brave_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",play_store_id:"com.gateio.gateio",app_store_id:"id1294998195",mac_app_store_id:"id1609559473"},deep_link:"https://www.gate.io/mobileapp",universal_link:"https://www.gate.io/mobileapp"},{featured:!1,name:"Onekey",rdns:"so.onekey.app.wallet",image:`${Rs}#onekey`,getWallet:{chrome_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",brave_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",play_store_id:"so.onekey.app.wallet",app_store_id:"id1609559473"},deep_link:"onekey-wallet://",universal_link:"onekey://wc"},{featured:!1,name:"Infinity Wallet",image:`${Rs}#9f259366-0bcd-4817-0af9-f78773e41900`,desktop_link:"infinity://wc"},{name:"Rabby Wallet",rdns:"io.rabby",featured:!1,image:`${Rs}#rabby`,getWallet:{chrome_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",brave_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",play_store_id:"com.debank.rabbymobile",app_store_id:"id6474381673"}},{name:"Binance Web3 Wallet",featured:!1,image:`${Rs}#ebac7b39-688c-41e3-7912-a4fefba74600`,getWallet:{play_store_id:"com.binance.dev",app_store_id:"id1436799971"}},{name:"Rainbow Wallet",rdns:"me.rainbow",featured:!1,image:`${Rs}#rainbow`,getWallet:{chrome_store_id:"opfgelmcmbiajamepnmloijbpoleiama",edge_addon_id:"cpojfbodiccabbabgimdeohkkpjfpbnf",firefox_addon_id:"rainbow-extension",app_store_id:"id1457119021",play_store_id:"me.rainbow"}}];function QA(t,e){const r=t.exec(e);return r==null?void 0:r.groups}const Yy=/^tuple(?(\[(\d*)\])*)$/;function Zp(t){let e=t.type;if(Yy.test(t.type)&&"components"in t){e="(";const r=t.components.length;for(let i=0;ie(t,s)}function Bc(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new hP(t.type);return`${t.name}(${Qp(t.inputs,{includeName:e})})`}function Qp(t,{includeName:e=!1}={}){return t?t.map(r=>tP(r,{includeName:e})).join(e?", ":","):""}function tP(t,{includeName:e}){return t.type.startsWith("tuple")?`(${Qp(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}function Zo(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function _n(t){return Zo(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const Jy="2.21.45";let bf={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${Jy}`};class yt extends Error{constructor(e,r={}){var a;const n=(()=>{var u;return r.cause instanceof yt?r.cause.details:(u=r.cause)!=null&&u.message?r.cause.message:r.details})(),i=r.cause instanceof yt&&r.cause.docsPath||r.docsPath,s=(a=bf.getDocsUrl)==null?void 0:a.call(bf,{...r,docsPath:i}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...bf.version?[`Version: ${bf.version}`]:[]].join(` +`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=Jy}walk(e){return Xy(this,e)}}function Xy(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?Xy(t.cause,e):e?null:t}class rP extends yt{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` +`),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class Zy extends yt{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` +`),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class nP extends yt{constructor({data:e,params:r,size:n}){super([`Data size of ${n} bytes is too small for given parameters.`].join(` +`),{metaMessages:[`Params: (${Qp(r,{includeName:!0})})`,`Data: ${e} (${n} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=r,this.size=n}}class eg extends yt{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class iP extends yt{constructor({expectedLength:e,givenLength:r,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${e}`,`Given length: ${r}`].join(` +`),{name:"AbiEncodingArrayLengthMismatchError"})}}class sP extends yt{constructor({expectedSize:e,value:r}){super(`Size of bytes "${r}" (bytes${_n(r)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class oP extends yt{constructor({expectedLength:e,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${r}`].join(` +`),{name:"AbiEncodingLengthMismatchError"})}}class Qy extends yt{constructor(e,{docsPath:r}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(` +`),{docsPath:r,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class ew extends yt{constructor(e,{docsPath:r}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` +`),{docsPath:r,name:"AbiFunctionNotFoundError"})}}class aP extends yt{constructor(e,r){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${Bc(e.abiItem)}\`, and`,`\`${r.type}\` in \`${Bc(r.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class cP extends yt{constructor({expectedSize:e,givenSize:r}){super(`Expected bytes${e}, got bytes${r}.`,{name:"BytesSizeMismatchError"})}}class uP extends yt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(` +`),{docsPath:r,name:"InvalidAbiEncodingType"})}}class fP extends yt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` +`),{docsPath:r,name:"InvalidAbiDecodingType"})}}class lP extends yt{constructor(e){super([`Value "${e}" is not a valid array.`].join(` +`),{name:"InvalidArrayError"})}}class hP extends yt{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` +`),{name:"InvalidDefinitionTypeError"})}}class tw extends yt{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}class rw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}class nw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function $c(t,{dir:e,size:r=32}={}){return typeof t=="string"?Qo(t,{dir:e,size:r}):dP(t,{dir:e,size:r})}function Qo(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new rw({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function dP(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new rw({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie)throw new mP({givenSize:_n(t),maxSize:e})}function yf(t,e={}){const{signed:r}=e;e.size&&Ds(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<e.toString(16).padStart(2,"0"));function Dh(t,e={}){return typeof t=="number"||typeof t=="bigint"?Pr(t,e):typeof t=="string"?Oh(t,e):typeof t=="boolean"?iw(t,e):li(t,e)}function iw(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(Ds(r,{size:e.size}),$c(r,{size:e.size})):r}function li(t,e={}){let r="";for(let i=0;is||i=uo.zero&&t<=uo.nine)return t-uo.zero;if(t>=uo.A&&t<=uo.F)return t-(uo.A-10);if(t>=uo.a&&t<=uo.f)return t-(uo.a-10)}function fo(t,e={}){let r=t;e.size&&(Ds(r,{size:e.size}),r=$c(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function EP(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Nh(t.outputLen),Nh(t.blockLen)}function Uc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function aw(t,e){jc(t);const r=e.outputLen;if(t.length>cw&Lh)}:{h:Number(t>>cw&Lh)|0,l:Number(t&Lh)|0}}function AP(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;it<>>32-r,MP=(t,e,r)=>e<>>32-r,IP=(t,e,r)=>e<>>64-r,CP=(t,e,r)=>t<>>64-r,qc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const TP=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),ng=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Os=(t,e)=>t<<32-e|t>>>e,uw=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,RP=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function fw(t){for(let e=0;ee.toString(16).padStart(2,"0"));function OP(t){jc(t);let e="";for(let r=0;rt().update(wf(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function kP(t){const e=(n,i)=>t(i).update(wf(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function BP(t=32){if(qc&&typeof qc.getRandomValues=="function")return qc.getRandomValues(new Uint8Array(t));if(qc&&typeof qc.randomBytes=="function")return qc.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const hw=[],dw=[],pw=[],$P=BigInt(0),xf=BigInt(1),FP=BigInt(2),jP=BigInt(7),UP=BigInt(256),qP=BigInt(113);for(let t=0,e=xf,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],hw.push(2*(5*n+r)),dw.push((t+1)*(t+2)/2%64);let i=$P;for(let s=0;s<7;s++)e=(e<>jP)*qP)%UP,e&FP&&(i^=xf<<(xf<r>32?IP(t,e,r):PP(t,e,r),mw=(t,e,r)=>r>32?CP(t,e,r):MP(t,e,r);function vw(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,u=(o+2)%10,l=r[u],d=r[u+1],g=gw(l,d,1)^r[a],y=mw(l,d,1)^r[a+1];for(let A=0;A<50;A+=10)t[o+A]^=g,t[o+A+1]^=y}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=dw[o],u=gw(i,s,a),l=mw(i,s,a),d=hw[o];i=t[d],s=t[d+1],t[d]=u,t[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=zP[n],t[1]^=HP[n]}r.fill(0)}class _f extends ig{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Nh(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=TP(this.state)}keccak(){uw||fw(this.state32),vw(this.state32,this.rounds),uw||fw(this.state32),this.posOut=0,this.pos=0}update(e){Uc(this);const{blockLen:r,state:n}=this;e=wf(e);const i=e.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Nh(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(aw(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new _f(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const ea=(t,e,r)=>lw(()=>new _f(e,t,r)),WP=ea(6,144,224/8),KP=ea(6,136,256/8),VP=ea(6,104,384/8),GP=ea(6,72,512/8),YP=ea(1,144,224/8),bw=ea(1,136,256/8),JP=ea(1,104,384/8),XP=ea(1,72,512/8),yw=(t,e,r)=>kP((n={})=>new _f(e,t,n.dkLen===void 0?r:n.dkLen,!0)),ZP=yw(31,168,128/8),QP=yw(31,136,256/8),eM=Object.freeze(Object.defineProperty({__proto__:null,Keccak:_f,keccakP:vw,keccak_224:YP,keccak_256:bw,keccak_384:JP,keccak_512:XP,sha3_224:WP,sha3_256:KP,sha3_384:VP,sha3_512:GP,shake128:ZP,shake256:QP},Symbol.toStringTag,{value:"Module"}));function Ef(t,e){const r=e||"hex",n=bw(Zo(t,{strict:!1})?rg(t):t);return r==="bytes"?n:Dh(n)}const tM=t=>Ef(rg(t));function rM(t){return tM(t)}function nM(t){let e=!0,r="",n=0,i="",s=!1;for(let o=0;o{const e=typeof t=="string"?t:eP(t);return nM(e)};function ww(t){return rM(iM(t))}const sM=ww;class zc extends yt{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class kh extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const sg=new kh(8192);function Sf(t,e){if(sg.has(`${t}.${e}`))return sg.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=Ef(ow(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return sg.set(`${t}.${e}`,s),s}function og(t,e){if(!lo(t,{strict:!1}))throw new zc({address:t});return Sf(t,e)}const oM=/^0x[a-fA-F0-9]{40}$/,ag=new kh(8192);function lo(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(ag.has(n))return ag.get(n);const i=oM.test(t)?t.toLowerCase()===t?!0:r?Sf(t)===t:!0:!1;return ag.set(n,i),i}function Hc(t){return typeof t[0]=="string"?Bh(t):aM(t)}function aM(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function Bh(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}function $h(t,e,r,{strict:n}={}){return Zo(t,{strict:!1})?cM(t,e,r,{strict:n}):Ew(t,e,r,{strict:n})}function xw(t,e){if(typeof e=="number"&&e>0&&e>_n(t)-1)throw new tw({offset:e,position:"start",size:_n(t)})}function _w(t,e,r){if(typeof e=="number"&&typeof r=="number"&&_n(t)!==r-e)throw new tw({offset:r,position:"end",size:_n(t)})}function Ew(t,e,r,{strict:n}={}){xw(t,e);const i=t.slice(e,r);return n&&_w(i,e,r),i}function cM(t,e,r,{strict:n}={}){xw(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&_w(i,e,r),i}function Sw(t,e){if(t.length!==e.length)throw new oP({expectedLength:t.length,givenLength:e.length});const r=uM({params:t,values:e}),n=ug(r);return n.length===0?"0x":n}function uM({params:t,values:e}){const r=[];for(let n=0;n0?Hc([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:Hc(s.map(({encoded:o})=>o))}}function hM(t,{param:e}){const[,r]=e.type.split("bytes"),n=_n(t);if(!r){let i=t;return n%32!==0&&(i=Qo(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:Hc([Qo(Pr(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new sP({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:Qo(t,{dir:"right"})}}function dM(t){if(typeof t!="boolean")throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Qo(iw(t))}}function pM(t,{signed:e}){return{dynamic:!1,encoded:Pr(t,{size:32,signed:e})}}function gM(t){const e=Oh(t),r=Math.ceil(_n(e)/32),n=[];for(let i=0;ii))}}function fg(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const lg=t=>$h(ww(t),0,4);function Aw(t){const{abi:e,args:r=[],name:n}=t,i=Zo(n,{strict:!1}),s=e.filter(a=>i?a.type==="function"?lg(a)===n:a.type==="event"?sM(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((l,d)=>{const g="inputs"in a&&a.inputs[d];return g?hg(l,g):!1})){if(o&&"inputs"in o&&o.inputs){const l=Pw(a.inputs,o.inputs,r);if(l)throw new aP({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||s[0]}function hg(t,e){const r=typeof t,n=e.type;switch(n){case"address":return lo(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>hg(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>hg(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Pw(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return Pw(i.components,s.components,r[n]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?lo(r[n],{strict:!1}):o.includes("address")&&o.includes("bytes")?lo(r[n],{strict:!1}):!1)return o}}function ho(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const Mw="/docs/contract/encodeFunctionData";function vM(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=Aw({abi:e,args:r,name:n});if(!s)throw new ew(n,{docsPath:Mw});i=s}if(i.type!=="function")throw new ew(void 0,{docsPath:Mw});return{abi:[i],functionName:lg(Bc(i))}}function bM(t){const{args:e}=t,{abi:r,functionName:n}=(()=>{var a;return t.abi.length===1&&((a=t.functionName)!=null&&a.startsWith("0x"))?t:vM(t)})(),i=r[0],s=n,o="inputs"in i&&i.inputs?Sw(i.inputs,e??[]):void 0;return Bh([s,o??"0x"])}const yM={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},wM={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},xM={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Iw extends yt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class _M extends yt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class EM extends yt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const SM={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new EM({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new _M({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Iw({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Iw({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function dg(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(SM);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function AM(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return yf(r,e)}function PM(t,e={}){let r=t;if(typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r)),r.length>1||r[0]>1)throw new gP(r);return!!r[0]}function po(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return Fc(r,e)}function MM(t,e={}){let r=t;return typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r,{dir:"right"})),new TextDecoder().decode(r)}function IM(t,e){const r=typeof e=="string"?fo(e):e,n=dg(r);if(_n(r)===0&&t.length>0)throw new eg;if(_n(e)&&_n(e)<32)throw new nP({data:typeof e=="string"?e:li(e),params:t,size:_n(e)});let i=0;const s=[];for(let o=0;o48?AM(i,{signed:r}):po(i,{signed:r}),32]}function NM(t,e,{staticPosition:r}){const n=e.components.length===0||e.components.some(({name:o})=>!o),i=n?[]:{};let s=0;if(Af(e)){const o=po(t.readBytes(pg)),a=r+o;for(let u=0;uo.type==="error"&&n===lg(Bc(o)));if(!s)throw new Qy(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?IM(s.inputs,$h(r,4)):void 0,errorName:s.name}}const Kc=(t,e,r)=>JSON.stringify(t,(n,i)=>typeof i=="bigint"?i.toString():i,r);function Tw({abiItem:t,args:e,includeFunctionName:r=!0,includeName:n=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${r?t.name:""}(${t.inputs.map((i,s)=>`${n&&i.name?`${i.name}: `:""}${typeof e[s]=="object"?Kc(e[s]):e[s]}`).join(", ")})`}const BM={gwei:9,wei:18},$M={ether:-9,wei:9};function Rw(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}function Dw(t,e="wei"){return Rw(t,BM[e])}function hs(t,e="wei"){return Rw(t,$M[e])}class FM extends yt{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class jM extends yt{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Fh(t){const e=Object.entries(t).map(([n,i])=>i===void 0||i===!1?null:[n,i]).filter(Boolean),r=e.reduce((n,[i])=>Math.max(n,i.length),0);return e.map(([n,i])=>` ${`${n}:`.padEnd(r+1)} ${i}`).join(` +`)}class UM extends yt{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(` +`),{name:"FeeConflictError"})}}class qM extends yt{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Fh(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class zM extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:g,value:y}){var P;const A=Fh({chain:i&&`${i==null?void 0:i.name} (id: ${i==null?void 0:i.id})`,from:r==null?void 0:r.address,to:g,value:typeof y<"u"&&`${Dw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",A].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const HM=t=>t,Ow=t=>t;class WM extends yt{constructor(e,{abi:r,args:n,contractAddress:i,docsPath:s,functionName:o,sender:a}){const u=Aw({abi:r,args:n,name:o}),l=u?Tw({abiItem:u,args:n,includeFunctionName:!1,includeName:!1}):void 0,d=u?Bc(u,{includeName:!0}):void 0,g=Fh({address:i&&HM(i),function:d,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:s,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],g&&"Contract Call:",g].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=e,this.contractAddress=i,this.functionName=o,this.sender=a}}class KM extends yt{constructor({abi:e,data:r,functionName:n,message:i}){let s,o,a,u;if(r&&r!=="0x")try{o=kM({abi:e,data:r});const{abiItem:d,errorName:g,args:y}=o;if(g==="Error")u=y[0];else if(g==="Panic"){const[A]=y;u=yM[A]}else{const A=d?Bc(d,{includeName:!0}):void 0,P=d&&y?Tw({abiItem:d,args:y,includeFunctionName:!1,includeName:!1}):void 0;a=[A?`Error: ${A}`:"",P&&P!=="()"?` ${[...Array((g==null?void 0:g.length)??0).keys()].map(()=>" ").join("")}${P}`:""]}}catch(d){s=d}else i&&(u=i);let l;s instanceof Qy&&(l=s.signature,a=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(u&&u!=="execution reverted"||l?[`The contract function "${n}" reverted with the following ${l?"signature":"reason"}:`,u||l].join(` +`):`The contract function "${n}" reverted.`,{cause:s,metaMessages:a,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.reason=u,this.signature=l}}class VM extends yt{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class GM extends yt{constructor({data:e,message:r}){super(r||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}class Nw extends yt{constructor({body:e,cause:r,details:n,headers:i,status:s,url:o}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${Ow(o)}`,e&&`Request body: ${Kc(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=i,this.status=s,this.url=o}}class YM extends yt{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${Ow(n)}`,`Request body: ${Kc(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code}}const JM=-1;class hi extends yt{constructor(e,{code:r,docsPath:n,metaMessages:i,name:s,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:i||(e==null?void 0:e.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||e.name,this.code=e instanceof YM?e.code:r??JM}}class Vc extends hi{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class Pf extends hi{constructor(e){super(e,{code:Pf.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Pf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Mf extends hi{constructor(e){super(e,{code:Mf.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Mf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class If extends hi{constructor(e,{method:r}={}){super(e,{code:If.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(If,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Cf extends hi{constructor(e){super(e,{code:Cf.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` +`)})}}Object.defineProperty(Cf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Fa extends hi{constructor(e){super(e,{code:Fa.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Fa,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Tf extends hi{constructor(e){super(e,{code:Tf.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` +`)})}}Object.defineProperty(Tf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Rf extends hi{constructor(e){super(e,{code:Rf.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Rf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Df extends hi{constructor(e){super(e,{code:Df.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Df,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Of extends hi{constructor(e){super(e,{code:Of.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Of,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Nf extends hi{constructor(e,{method:r}={}){super(e,{code:Nf.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not implemented.`})}}Object.defineProperty(Nf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Gc extends hi{constructor(e){super(e,{code:Gc.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Gc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Lf extends hi{constructor(e){super(e,{code:Lf.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Lf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Yc extends Vc{constructor(e){super(e,{code:Yc.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Yc,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class kf extends Vc{constructor(e){super(e,{code:kf.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(kf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Bf extends Vc{constructor(e,{method:r}={}){super(e,{code:Bf.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(Bf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class $f extends Vc{constructor(e){super(e,{code:$f.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty($f,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Ff extends Vc{constructor(e){super(e,{code:Ff.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Ff,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class jf extends Vc{constructor(e){super(e,{code:jf.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(jf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class XM extends hi{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const ZM=3;function QM(t,{abi:e,address:r,args:n,docsPath:i,functionName:s,sender:o}){const{code:a,data:u,message:l,shortMessage:d}=t instanceof GM?t:t instanceof yt?t.walk(y=>"data"in y)||t.walk():{},g=t instanceof eg?new VM({functionName:s}):[ZM,Fa.code].includes(a)&&(u||l||d)?new KM({abi:e,data:typeof u=="object"?u.data:u,functionName:s,message:d??l}):t;return new WM(g,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:o})}function eI(t){const e=Ef(`0x${t.substring(4)}`).substring(26);return Sf(`0x${e}`)}async function tI({hash:t,signature:e}){const r=Zo(t)?t:Dh(t),{secp256k1:n}=await Promise.resolve().then(()=>jC);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:d,v:g,yParity:y}=e,A=Number(y??g),P=Lw(A);return new n.Signature(yf(l),yf(d)).addRecoveryBit(P)}const o=Zo(e)?e:Dh(e),a=Fc(`0x${o.slice(130)}`),u=Lw(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Lw(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function rI({hash:t,signature:e}){return eI(await tI({hash:t,signature:e}))}function nI(t,e="hex"){const r=kw(t),n=dg(new Uint8Array(r.length));return r.encode(n),e==="hex"?li(n.bytes):n.bytes}function kw(t){return Array.isArray(t)?iI(t.map(e=>kw(e))):sI(t)}function iI(t){const e=t.reduce((i,s)=>i+s.length,0),r=Bw(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function sI(t){const e=typeof t=="string"?fo(t):t,r=Bw(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function Bw(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new yt("Length is too large.")}function oI(t){const{chainId:e,contractAddress:r,nonce:n,to:i}=t,s=Ef(Bh(["0x05",nI([e?Pr(e):"0x",r,n?Pr(n):"0x"])]));return i==="bytes"?fo(s):s}async function $w(t){const{authorization:e,signature:r}=t;return rI({hash:oI(e),signature:r??e})}class aI extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:g,value:y}){var P;const A=Fh({from:r==null?void 0:r.address,to:g,value:typeof y<"u"&&`${Dw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",A].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class Jc extends yt{constructor({cause:e,message:r}={}){var i;const n=(i=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(Jc,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Jc,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class jh extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(jh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class gg extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(gg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class mg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(mg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class vg extends yt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` `),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(vg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class bg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(bg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class yg extends yt{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` -`),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(yg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class wg extends yt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(wg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class xg extends yt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(xg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class _g extends yt{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(_g,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Uh extends yt{constructor({cause:e,maxPriorityFeePerGas:r,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${r?` = ${ls(r)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${ls(n)} gwei`:""}).`].join(` -`),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(Uh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Eg extends yt{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function $w(t,e){const r=(t.details||"").toLowerCase(),n=t instanceof yt?t.walk(i=>(i==null?void 0:i.code)===Yc.code):t;return n instanceof yt?new Yc({cause:t,message:n.details}):Yc.nodeMessage.test(r)?new Yc({cause:t,message:t.details}):Fh.nodeMessage.test(r)?new Fh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):gg.nodeMessage.test(r)?new gg({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):mg.nodeMessage.test(r)?new mg({cause:t,nonce:e==null?void 0:e.nonce}):vg.nodeMessage.test(r)?new vg({cause:t,nonce:e==null?void 0:e.nonce}):bg.nodeMessage.test(r)?new bg({cause:t,nonce:e==null?void 0:e.nonce}):yg.nodeMessage.test(r)?new yg({cause:t}):wg.nodeMessage.test(r)?new wg({cause:t,gas:e==null?void 0:e.gas}):xg.nodeMessage.test(r)?new xg({cause:t,gas:e==null?void 0:e.gas}):_g.nodeMessage.test(r)?new _g({cause:t}):Uh.nodeMessage.test(r)?new Uh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new Eg({cause:t})}function ZM(t,{docsPath:e,...r}){const n=(()=>{const i=$w(t,r);return i instanceof Eg?t:i})();return new XM(n,{docsPath:e,...r})}function Bw(t,{format:e}){if(!e)return{};const r={};function n(s){const o=Object.keys(s);for(const a of o)a in t&&(r[a]=t[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}const i=e(t||{});return n(i),r}const QM={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Sg(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=eI(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(r=>li(r)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=Pr(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=Pr(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=Pr(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=Pr(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=Pr(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=Pr(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=QM[t.type]),typeof t.value<"u"&&(e.value=Pr(t.value)),e}function eI(t){return t.map(e=>({address:e.contractAddress,r:e.r,s:e.s,chainId:Pr(e.chainId),nonce:Pr(e.nonce),...typeof e.yParity<"u"?{yParity:Pr(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:Pr(e.v)}:{}}))}function Fw(t){if(!(!t||t.length===0))return t.reduce((e,{slot:r,value:n})=>{if(r.length!==66)throw new tw({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new tw({size:n.length,targetSize:66,type:"hex"});return e[r]=n,e},{})}function tI(t){const{balance:e,nonce:r,state:n,stateDiff:i,code:s}=t,o={};if(s!==void 0&&(o.code=s),e!==void 0&&(o.balance=Pr(e)),r!==void 0&&(o.nonce=Pr(r)),n!==void 0&&(o.state=Fw(n)),i!==void 0){if(o.state)throw new TM;o.stateDiff=Fw(i)}return o}function rI(t){if(!t)return;const e={};for(const{address:r,...n}of t){if(!co(r,{strict:!1}))throw new qc({address:r});if(e[r])throw new CM({address:r});e[r]=tI(n)}return e}const nI=2n**256n-1n;function jh(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?uo(e):void 0;if(o&&!co(o.address))throw new qc({address:o.address});if(s&&!co(s))throw new qc({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new RM;if(n&&n>nI)throw new Fh({maxFeePerGas:n});if(i&&n&&i>n)throw new Uh({maxFeePerGas:n,maxPriorityFeePerGas:i})}class iI extends yt{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Ag extends yt{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class sI extends yt{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${ls(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class oI extends yt{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}const aI={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function cI(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?Bc(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?Bc(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?aI[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=uI(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function uI(t){return t.map(e=>({contractAddress:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function fI(t){const e=(t.transactions??[]).map(r=>typeof r=="string"?r:cI(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function qh(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){var d,g,y;const s=n??"latest",o=i??!1,a=r!==void 0?Pr(r):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,o]},{dedupe:!0}):u=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]},{dedupe:!!a}),!u)throw new oI({blockHash:e,blockNumber:r});return(((y=(g=(d=t.chain)==null?void 0:d.formatters)==null?void 0:g.block)==null?void 0:y.format)||fI)(u)}async function Uw(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function lI(t,e){var s,o;const{block:r,chain:n=t.chain,request:i}=e||{};try{const a=((s=n==null?void 0:n.fees)==null?void 0:s.maxPriorityFeePerGas)??((o=n==null?void 0:n.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=r||await fi(t,qh,"getBlock")({}),d=await a({block:l,client:t,request:i});if(d===null)throw new Error;return d}if(typeof a<"u")return a;const u=await t.request({method:"eth_maxPriorityFeePerGas"});return bf(u)}catch{const[a,u]=await Promise.all([r?Promise.resolve(r):fi(t,qh,"getBlock")({}),fi(t,Uw,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new Ag;const l=u-a.baseFeePerGas;return l<0n?0n:l}}async function jw(t,e){var y,A;const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>{var P,N;return typeof((P=n==null?void 0:n.fees)==null?void 0:P.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):((N=n==null?void 0:n.fees)==null?void 0:N.baseFeeMultiplier)??1.2})();if(o<1)throw new iI;const u=10**(((y=o.toString().split(".")[1])==null?void 0:y.length)??0),l=P=>P*BigInt(Math.ceil(o*u))/BigInt(u),d=r||await fi(t,qh,"getBlock")({});if(typeof((A=n==null?void 0:n.fees)==null?void 0:A.estimateFeesPerGas)=="function"){const P=await n.fees.estimateFeesPerGas({block:r,client:t,multiply:l,request:i,type:s});if(P!==null)return P}if(s==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new Ag;const P=typeof(i==null?void 0:i.maxPriorityFeePerGas)=="bigint"?i.maxPriorityFeePerGas:await lI(t,{block:d,chain:n,request:i}),N=l(d.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??N+P,maxPriorityFeePerGas:P}}return{gasPrice:(i==null?void 0:i.gasPrice)??l(await fi(t,Uw,"getGasPrice")({}))}}async function hI(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,n?Pr(n):r]},{dedupe:!!n});return Bc(i)}function qw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(s=>ao(s)):t.blobs,i=[];for(const s of n)i.push(Uint8Array.from(e.blobToKzgCommitment(s)));return r==="bytes"?i:i.map(s=>li(s))}function zw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>ao(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>ao(o)):t.commitments,s=[];for(let o=0;oli(o))}function dI(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),u=n?4:0,l=n?0:4;t.setUint32(e+u,o,n),t.setUint32(e+l,a,n)}const pI=(t,e,r)=>t&e^~t&r,gI=(t,e,r)=>t&e^t&r^e&r;class mI extends ig{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ng(this.buffer)}update(e){Uc(this);const{view:r,buffer:n,blockLen:i}=this;e=yf(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let g=o;gd.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g>>3,N=Ds(A,17)^Ds(A,19)^A>>>10;Qo[g]=N+Qo[g-7]+P+Qo[g-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:u,G:l,H:d}=this;for(let g=0;g<64;g++){const y=Ds(a,6)^Ds(a,11)^Ds(a,25),A=d+y+pI(a,u,l)+vI[g]+Qo[g]|0,N=(Ds(n,2)^Ds(n,13)^Ds(n,22))+gI(n,i,s)|0;d=l,l=u,u=a,a=o+A|0,o=s,s=i,i=n,n=A+N|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(n,i,s,o,a,u,l,d)}roundClean(){Qo.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Pg=uw(()=>new bI);function yI(t,e){return Pg(Yo(t,{strict:!1})?rg(t):t)}function wI(t){const{commitment:e,version:r=1}=t,n=t.to??(typeof e=="string"?"hex":"bytes"),i=yI(e);return i.set([r],0),n==="bytes"?i:li(i)}function xI(t){const{commitments:e,version:r}=t,n=t.to??(typeof e[0]=="string"?"hex":"bytes"),i=[];for(const s of e)i.push(wI({commitment:s,to:n,version:r}));return i}const Hw=6,Ww=32,Mg=4096,Kw=Ww*Mg,Vw=Kw*Hw-1-1*Mg*Hw;class _I extends yt{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class EI extends yt{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function SI(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),r=typeof t.data=="string"?ao(t.data):t.data,n=_n(r);if(!n)throw new EI;if(n>Vw)throw new _I({maxSize:Vw,size:n});const i=[];let s=!0,o=0;for(;s;){const a=dg(new Uint8Array(Kw));let u=0;for(;ua.bytes):i.map(a=>li(a.bytes))}function AI(t){const{data:e,kzg:r,to:n}=t,i=t.blobs??SI({data:e,to:n}),s=t.commitments??qw({blobs:i,kzg:r,to:n}),o=t.proofs??zw({blobs:i,commitments:s,kzg:r,to:n}),a=[];for(let u=0;u"u"&&g)if(u){const k=await D();y.nonce=await u.consume({address:g.address,chainId:k,client:t})}else y.nonce=await fi(t,hI,"getTransactionCount")({address:g.address,blockTag:"pending"});if((l.includes("fees")||l.includes("type"))&&typeof d>"u")try{y.type=PI(y)}catch{const k=await P();y.type=typeof(k==null?void 0:k.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(l.includes("fees"))if(y.type!=="legacy"&&y.type!=="eip2930"){if(typeof y.maxFeePerGas>"u"||typeof y.maxPriorityFeePerGas>"u"){const k=await P(),{maxFeePerGas:$,maxPriorityFeePerGas:q}=await jw(t,{block:k,chain:i,request:y});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(y.gas=await fi(t,II,"estimateGas")({...y,account:g&&{address:g.address,type:"json-rpc"}})),jh(y),delete y.parameters,y}async function MI(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=r?Pr(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function II(t,e){var i,s,o;const{account:r=t.account}=e,n=r?uo(r):void 0;try{let f=function(v){const{block:x,request:_,rpcStateOverride:S}=v;return t.request({method:"eth_estimateGas",params:S?[_,x??"latest",S]:x?[_,x]:[_]})};const{accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,blockNumber:g,blockTag:y,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:$,nonce:q,value:U,stateOverride:K,...J}=await Ig(t,{...e,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),z=(g?Pr(g):void 0)||y,ue=rI(K),_e=await(async()=>{if(J.to)return J.to;if(u&&u.length>0)return await kw({authorization:u[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`")})})();jh(e);const G=(o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:o.format,m=(G||Sg)({...Bw(J,{format:G}),from:n==null?void 0:n.address,accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:$,nonce:q,to:_e,value:U});let p=BigInt(await f({block:z,request:m,rpcStateOverride:ue}));if(u){const v=await MI(t,{address:m.from}),x=await Promise.all(u.map(async _=>{const{contractAddress:S}=_,b=await f({block:z,request:{authorizationList:void 0,data:A,from:n==null?void 0:n.address,to:S,value:Pr(v)},rpcStateOverride:ue}).catch(()=>100000n);return 2n*BigInt(b)}));p+=x.reduce((_,S)=>_+S,0n)}return p}catch(a){throw ZM(a,{...e,account:n,chain:t.chain})}}class CI extends yt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class TI extends yt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` -`),{name:"ChainNotFoundError"})}}const Cg="/docs/contract/encodeDeployData";function RI(t){const{abi:e,args:r,bytecode:n}=t;if(!r||r.length===0)return n;const i=e.find(o=>"type"in o&&o.type==="constructor");if(!i)throw new KA({docsPath:Cg});if(!("inputs"in i))throw new Jy({docsPath:Cg});if(!i.inputs||i.inputs.length===0)throw new Jy({docsPath:Cg});const s=_w(i.inputs,r);return kh([n,s])}async function DI(t){return new Promise(e=>setTimeout(e,t))}class Uf extends yt{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` -`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class Tg extends yt{constructor({docsPath:e,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:e,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function Yw({chain:t,currentChainId:e}){if(!t)throw new TI;if(e!==t.id)throw new CI({chain:t,currentChainId:e})}function OI(t,{docsPath:e,...r}){const n=(()=>{const i=$w(t,r);return i instanceof Eg?t:i})();return new OM(n,{docsPath:e,...r})}async function Jw(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const Rg=new Lh(128);async function Dg(t,e){var k,$,q,U;const{account:r=t.account,chain:n=t.chain,accessList:i,authorizationList:s,blobs:o,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,value:P,...N}=e;if(typeof r>"u")throw new Uf({docsPath:"/docs/actions/wallet/sendTransaction"});const D=r?uo(r):null;try{jh(e);const K=await(async()=>{if(e.to)return e.to;if(s&&s.length>0)return await kw({authorization:s[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`.")})})();if((D==null?void 0:D.type)==="json-rpc"||D===null){let J;n!==null&&(J=await fi(t,zh,"getChainId")({}),Yw({currentChainId:J,chain:n}));const T=(q=($=(k=t.chain)==null?void 0:k.formatters)==null?void 0:$.transactionRequest)==null?void 0:q.format,ue=(T||Sg)({...Bw(N,{format:T}),accessList:i,authorizationList:s,blobs:o,chainId:J,data:a,from:D==null?void 0:D.address,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,to:K,value:P}),_e=Rg.get(t.uid),G=_e?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:G,params:[ue]},{retryCount:0})}catch(E){if(_e===!1)throw E;const m=E;if(m.name==="InvalidInputRpcError"||m.name==="InvalidParamsRpcError"||m.name==="MethodNotFoundRpcError"||m.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[ue]},{retryCount:0}).then(f=>(Rg.set(t.uid,!0),f)).catch(f=>{const p=f;throw p.name==="MethodNotFoundRpcError"||p.name==="MethodNotSupportedRpcError"?(Rg.set(t.uid,!1),m):p});throw m}}if((D==null?void 0:D.type)==="local"){const J=await fi(t,Ig,"prepareTransactionRequest")({account:D,accessList:i,authorizationList:s,blobs:o,chain:n,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,nonceManager:D.nonceManager,parameters:[...Gw,"sidecars"],value:P,...N,to:K}),T=(U=n==null?void 0:n.serializers)==null?void 0:U.transaction,z=await D.signTransaction(J,{serializer:T});return await fi(t,Jw,"sendRawTransaction")({serializedTransaction:z})}throw(D==null?void 0:D.type)==="smart"?new Tg({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Tg({docsPath:"/docs/actions/wallet/sendTransaction",type:D==null?void 0:D.type})}catch(K){throw K instanceof Tg?K:OI(K,{...e,account:D,chain:e.chain||void 0})}}async function NI(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:o,functionName:a,...u}=e;if(typeof n>"u")throw new Uf({docsPath:"/docs/contract/writeContract"});const l=n?uo(n):null,d=cM({abi:r,args:s,functionName:a});try{return await fi(t,Dg,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:i,account:l,...u})}catch(g){throw zM(g,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:a,sender:l==null?void 0:l.address})}}async function LI(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:Pr(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}const Og=256;let Hh=Og,Wh;function Xw(t=11){if(!Wh||Hh+t>Og*2){Wh="",Hh=0;for(let e=0;e{const $=k(D);for(const U in P)delete $[U];const q={...D,...$};return Object.assign(q,{extend:N(q)})}}return Object.assign(P,{extend:N(P)})}const Kh=new Lh(8192);function $I(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(Kh.get(r))return Kh.get(r);const n=t().finally(()=>Kh.delete(r));return Kh.set(r,n),n}function BI(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const u=async({error:l})=>{const d=typeof e=="function"?e({count:a,error:l}):e;d&&await DI(d),o({count:a+1})};try{const l=await t();i(l)}catch(l){if(a{const{dedupe:i=!1,retryDelay:s=150,retryCount:o=3,uid:a}={...e,...n},u=i?_f(Dh(`${a}.${Wc(r)}`)):void 0;return $I(()=>BI(async()=>{try{return await t(r)}catch(l){const d=l;switch(d.code){case Af.code:throw new Af(d);case Pf.code:throw new Pf(d);case Mf.code:throw new Mf(d,{method:r.method});case If.code:throw new If(d);case ka.code:throw new ka(d);case Cf.code:throw new Cf(d);case Tf.code:throw new Tf(d);case Rf.code:throw new Rf(d);case Df.code:throw new Df(d);case Of.code:throw new Of(d,{method:r.method});case Vc.code:throw new Vc(d);case Nf.code:throw new Nf(d);case Gc.code:throw new Gc(d);case Lf.code:throw new Lf(d);case kf.code:throw new kf(d);case $f.code:throw new $f(d);case Bf.code:throw new Bf(d);case Ff.code:throw new Ff(d);case 5e3:throw new Gc(d);default:throw l instanceof yt?l:new jM(d)}}},{delay:({count:l,error:d})=>{var g;if(d&&d instanceof Dw){const y=(g=d==null?void 0:d.headers)==null?void 0:g.get("Retry-After");if(y!=null&&y.match(/\d/))return Number.parseInt(y)*1e3}return~~(1<UI(l)}),{enabled:i,id:u})}}function UI(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Vc.code||t.code===ka.code:t instanceof Dw&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function jI({key:t,name:e,request:r,retryCount:n=3,retryDelay:i=150,timeout:s,type:o},a){const u=Xw();return{config:{key:t,name:e,request:r,retryCount:n,retryDelay:i,timeout:s,type:o},request:FI(r,{retryCount:n,retryDelay:i,uid:u}),value:a}}function qI(t,e={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=e;return({retryCount:s})=>jI({key:r,name:n,request:t.request.bind(t),retryCount:e.retryCount??s,retryDelay:i,type:"custom"})}const zI=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,HI=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;class WI extends yt{constructor({domain:e}){super(`Invalid domain "${Wc(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class KI extends yt{constructor({primaryType:e,types:r}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class VI extends yt{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function GI(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(u,l)=>{const d={...l};for(const g of u){const{name:y,type:A}=g;A==="address"&&(d[y]=d[y].toLowerCase())}return d},o=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return Wc({domain:o,message:a,primaryType:n,types:i})}function YI(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(o,a)=>{for(const u of o){const{name:l,type:d}=u,g=a[l],y=d.match(HI);if(y&&(typeof g=="number"||typeof g=="bigint")){const[N,D,k]=y;Pr(g,{signed:D==="int",size:Number.parseInt(k)/8})}if(d==="address"&&typeof g=="string"&&!co(g))throw new qc({address:g});const A=d.match(zI);if(A){const[N,D]=A;if(D&&_n(g)!==Number.parseInt(D))throw new ZA({expectedSize:Number.parseInt(D),givenSize:_n(g)})}const P=i[d];P&&(XI(d),s(P,g))}};if(i.EIP712Domain&&e){if(typeof e!="object")throw new WI({domain:e});s(i.EIP712Domain,e)}if(n!=="EIP712Domain")if(i[n])s(i[n],r);else throw new KI({primaryType:n,types:i})}function JI({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},typeof(t==null?void 0:t.chainId)=="number"&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function XI(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new VI({type:t})}let Zw=class extends ig{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,dP(e);const n=yf(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew Zw(t,e).update(r).digest();Qw.create=(t,e)=>new Zw(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ng=BigInt(0),Vh=BigInt(1),ZI=BigInt(2);function $a(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function jf(t){if(!$a(t))throw new Error("Uint8Array expected")}function Jc(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)}const QI=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Xc(t){jf(t);let e="";for(let r=0;r=lo._0&&t<=lo._9)return t-lo._0;if(t>=lo._A&&t<=lo._F)return t-(lo._A-10);if(t>=lo._a&&t<=lo._f)return t-(lo._a-10)}function Qc(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;itypeof t=="bigint"&&Ng<=t;function Gh(t,e,r){return Bg(t)&&Bg(e)&&Bg(r)&&e<=t&&tNg;t>>=Vh,e+=1);return e}function nC(t,e){return t>>BigInt(e)&Vh}function iC(t,e,r){return t|(r?Vh:Ng)<(ZI<new Uint8Array(t),r2=t=>Uint8Array.from(t);function n2(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=Ug(t),i=Ug(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...g)=>r(i,n,...g),u=(g=Ug())=>{i=a(r2([0]),g),n=a(),g.length!==0&&(i=a(r2([1]),g),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let g=0;const y=[];for(;g{o(),u(g);let A;for(;!(A=y(l()));)u();return o(),A}}const sC={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||$a(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function zf(t,e,r={}){const n=(i,s,o)=>{const a=sC[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const u=t[i];if(!(o&&u===void 0)&&!a(u,t))throw new Error(`Invalid param ${String(i)}=${u} (${typeof u}), expected ${s}`)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const oC=()=>{throw new Error("not implemented")};function jg(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}const aC=Object.freeze(Object.defineProperty({__proto__:null,aInRange:Fa,abool:Jc,abytes:jf,bitGet:nC,bitLen:t2,bitMask:Fg,bitSet:iC,bytesToHex:Xc,bytesToNumberBE:Ba,bytesToNumberLE:kg,concatBytes:qf,createHmacDrbg:n2,ensureBytes:hs,equalBytes:tC,hexToBytes:Qc,hexToNumber:Lg,inRange:Gh,isBytes:$a,memoized:jg,notImplemented:oC,numberToBytesBE:eu,numberToBytesLE:$g,numberToHexUnpadded:Zc,numberToVarBytesBE:eC,utf8ToBytes:rC,validateObject:zf},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mn=BigInt(0),sn=BigInt(1),Ua=BigInt(2),cC=BigInt(3),qg=BigInt(4),i2=BigInt(5),s2=BigInt(8);BigInt(9),BigInt(16);function di(t,e){const r=t%e;return r>=Mn?r:e+r}function uC(t,e,r){if(r<=Mn||e 0");if(r===sn)return Mn;let n=sn;for(;e>Mn;)e&sn&&(n=n*t%r),t=t*t%r,e>>=sn;return n}function ji(t,e,r){let n=t;for(;e-- >Mn;)n*=n,n%=r;return n}function zg(t,e){if(t===Mn||e<=Mn)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=di(t,e),n=e,i=Mn,s=sn;for(;r!==Mn;){const a=n/r,u=n%r,l=i-s*a;n=r,r=u,i=s,s=l}if(n!==sn)throw new Error("invert: does not exist");return di(i,e)}function fC(t){const e=(t-sn)/Ua;let r,n,i;for(r=t-sn,n=0;r%Ua===Mn;r/=Ua,n++);for(i=Ua;i(n[i]="function",n),e);return zf(t,r)}function pC(t,e,r){if(r 0");if(r===Mn)return t.ONE;if(r===sn)return e;let n=t.ONE,i=e;for(;r>Mn;)r&sn&&(n=t.mul(n,i)),i=t.sqr(i),r>>=sn;return n}function gC(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function o2(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function a2(t,e,r=!1,n={}){if(t<=Mn)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=o2(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=lC(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:Fg(i),ZERO:Mn,ONE:sn,create:u=>di(u,t),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return Mn<=u&&uu===Mn,isOdd:u=>(u&sn)===sn,neg:u=>di(-u,t),eql:(u,l)=>u===l,sqr:u=>di(u*u,t),add:(u,l)=>di(u+l,t),sub:(u,l)=>di(u-l,t),mul:(u,l)=>di(u*l,t),pow:(u,l)=>pC(a,u,l),div:(u,l)=>di(u*zg(l,t),t),sqrN:u=>u*u,addN:(u,l)=>u+l,subN:(u,l)=>u-l,mulN:(u,l)=>u*l,inv:u=>zg(u,t),sqrt:n.sqrt||(u=>o(a,u)),invertBatch:u=>gC(a,u),cmov:(u,l,d)=>d?l:u,toBytes:u=>r?$g(u,s):eu(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return r?kg(u):Ba(u)}});return Object.freeze(a)}function c2(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function u2(t){const e=c2(t);return e+Math.ceil(e/2)}function mC(t,e,r=!1){const n=t.length,i=c2(e),s=u2(e);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?Ba(t):kg(t),a=di(o,e-sn)+sn;return r?$g(a,i):eu(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const vC=BigInt(0),Hg=BigInt(1),Wg=new WeakMap,f2=new WeakMap;function bC(t,e){const r=(s,o)=>{const a=o.negate();return s?a:o},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>e)throw new Error(`Wrong window size=${s}, should be [1..${e}]`)},i=s=>{n(s);const o=Math.ceil(e/s)+1,a=2**(s-1);return{windows:o,windowSize:a}};return{constTimeNegate:r,unsafeLadder(s,o){let a=t.ZERO,u=s;for(;o>vC;)o&Hg&&(a=a.add(u)),u=u.double(),o>>=Hg;return a},precomputeWindow(s,o){const{windows:a,windowSize:u}=i(o),l=[];let d=s,g=d;for(let y=0;y>=P,k>l&&(k-=A,a+=Hg);const $=D,q=D+Math.abs(k)-1,U=N%2!==0,K=k<0;k===0?g=g.add(r(U,o[$])):d=d.add(r(K,o[q]))}return{p:d,f:g}},wNAFCached(s,o,a){const u=f2.get(s)||1;let l=Wg.get(s);return l||(l=this.precomputeWindow(s,u),u!==1&&Wg.set(s,a(l))),this.wNAF(u,l,o)},setWindowSize(s,o){n(o),f2.set(s,o),Wg.delete(s)}}}function yC(t,e,r,n){if(!Array.isArray(r)||!Array.isArray(n)||n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((d,g)=>{if(!e.isValid(d))throw new Error(`wrong scalar at index ${g}`)}),r.forEach((d,g)=>{if(!(d instanceof t))throw new Error(`wrong point at index ${g}`)});const i=t2(BigInt(r.length)),s=i>12?i-3:i>4?i-2:i?2:1,o=(1<=0;d-=s){a.fill(t.ZERO);for(let y=0;y>BigInt(d)&BigInt(o));a[P]=a[P].add(r[y])}let g=t.ZERO;for(let y=a.length-1,A=t.ZERO;y>0;y--)A=A.add(a[y]),g=g.add(A);if(l=l.add(g),d!==0)for(let y=0;y{const{Err:r}=ho;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=Zc(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?Zc(i.length/2|128):"";return`${Zc(t)}${s}${i}${e}`},decode(t,e){const{Err:r}=ho;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");const l=e.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const d of l)o=o<<8|d;if(n+=u,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=ho;if(t{const $=D.toAffine();return qf(Uint8Array.from([4]),r.toBytes($.x),r.toBytes($.y))}),s=e.fromBytes||(N=>{const D=N.subarray(1),k=r.fromBytes(D.subarray(0,r.BYTES)),$=r.fromBytes(D.subarray(r.BYTES,2*r.BYTES));return{x:k,y:$}});function o(N){const{a:D,b:k}=e,$=r.sqr(N),q=r.mul($,N);return r.add(r.add(q,r.mul(N,D)),k)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(N){return Gh(N,In,e.n)}function u(N){const{allowedPrivateKeyLengths:D,nByteLength:k,wrapPrivateKey:$,n:q}=e;if(D&&typeof N!="bigint"){if($a(N)&&(N=Xc(N)),typeof N!="string"||!D.includes(N.length))throw new Error("Invalid key");N=N.padStart(k*2,"0")}let U;try{U=typeof N=="bigint"?N:Ba(hs("private key",N,k))}catch{throw new Error(`private key must be ${k} bytes, hex or bigint, not ${typeof N}`)}return $&&(U=di(U,q)),Fa("private key",U,In,q),U}function l(N){if(!(N instanceof y))throw new Error("ProjectivePoint expected")}const d=jg((N,D)=>{const{px:k,py:$,pz:q}=N;if(r.eql(q,r.ONE))return{x:k,y:$};const U=N.is0();D==null&&(D=U?r.ONE:r.inv(q));const K=r.mul(k,D),J=r.mul($,D),T=r.mul(q,D);if(U)return{x:r.ZERO,y:r.ZERO};if(!r.eql(T,r.ONE))throw new Error("invZ was invalid");return{x:K,y:J}}),g=jg(N=>{if(N.is0()){if(e.allowInfinityPoint&&!r.is0(N.py))return;throw new Error("bad point: ZERO")}const{x:D,y:k}=N.toAffine();if(!r.isValid(D)||!r.isValid(k))throw new Error("bad point: x or y not FE");const $=r.sqr(k),q=o(D);if(!r.eql($,q))throw new Error("bad point: equation left != right");if(!N.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(D,k,$){if(this.px=D,this.py=k,this.pz=$,D==null||!r.isValid(D))throw new Error("x required");if(k==null||!r.isValid(k))throw new Error("y required");if($==null||!r.isValid($))throw new Error("z required");Object.freeze(this)}static fromAffine(D){const{x:k,y:$}=D||{};if(!D||!r.isValid(k)||!r.isValid($))throw new Error("invalid affine point");if(D instanceof y)throw new Error("projective point not allowed");const q=U=>r.eql(U,r.ZERO);return q(k)&&q($)?y.ZERO:new y(k,$,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(D){const k=r.invertBatch(D.map($=>$.pz));return D.map(($,q)=>$.toAffine(k[q])).map(y.fromAffine)}static fromHex(D){const k=y.fromAffine(s(hs("pointHex",D)));return k.assertValidity(),k}static fromPrivateKey(D){return y.BASE.multiply(u(D))}static msm(D,k){return yC(y,n,D,k)}_setWindowSize(D){P.setWindowSize(this,D)}assertValidity(){g(this)}hasEvenY(){const{y:D}=this.toAffine();if(r.isOdd)return!r.isOdd(D);throw new Error("Field doesn't support isOdd")}equals(D){l(D);const{px:k,py:$,pz:q}=this,{px:U,py:K,pz:J}=D,T=r.eql(r.mul(k,J),r.mul(U,q)),z=r.eql(r.mul($,J),r.mul(K,q));return T&&z}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){const{a:D,b:k}=e,$=r.mul(k,d2),{px:q,py:U,pz:K}=this;let J=r.ZERO,T=r.ZERO,z=r.ZERO,ue=r.mul(q,q),_e=r.mul(U,U),G=r.mul(K,K),E=r.mul(q,U);return E=r.add(E,E),z=r.mul(q,K),z=r.add(z,z),J=r.mul(D,z),T=r.mul($,G),T=r.add(J,T),J=r.sub(_e,T),T=r.add(_e,T),T=r.mul(J,T),J=r.mul(E,J),z=r.mul($,z),G=r.mul(D,G),E=r.sub(ue,G),E=r.mul(D,E),E=r.add(E,z),z=r.add(ue,ue),ue=r.add(z,ue),ue=r.add(ue,G),ue=r.mul(ue,E),T=r.add(T,ue),G=r.mul(U,K),G=r.add(G,G),ue=r.mul(G,E),J=r.sub(J,ue),z=r.mul(G,_e),z=r.add(z,z),z=r.add(z,z),new y(J,T,z)}add(D){l(D);const{px:k,py:$,pz:q}=this,{px:U,py:K,pz:J}=D;let T=r.ZERO,z=r.ZERO,ue=r.ZERO;const _e=e.a,G=r.mul(e.b,d2);let E=r.mul(k,U),m=r.mul($,K),f=r.mul(q,J),p=r.add(k,$),v=r.add(U,K);p=r.mul(p,v),v=r.add(E,m),p=r.sub(p,v),v=r.add(k,q);let x=r.add(U,J);return v=r.mul(v,x),x=r.add(E,f),v=r.sub(v,x),x=r.add($,q),T=r.add(K,J),x=r.mul(x,T),T=r.add(m,f),x=r.sub(x,T),ue=r.mul(_e,v),T=r.mul(G,f),ue=r.add(T,ue),T=r.sub(m,ue),ue=r.add(m,ue),z=r.mul(T,ue),m=r.add(E,E),m=r.add(m,E),f=r.mul(_e,f),v=r.mul(G,v),m=r.add(m,f),f=r.sub(E,f),f=r.mul(_e,f),v=r.add(v,f),E=r.mul(m,v),z=r.add(z,E),E=r.mul(x,v),T=r.mul(p,T),T=r.sub(T,E),E=r.mul(p,m),ue=r.mul(x,ue),ue=r.add(ue,E),new y(T,z,ue)}subtract(D){return this.add(D.negate())}is0(){return this.equals(y.ZERO)}wNAF(D){return P.wNAFCached(this,D,y.normalizeZ)}multiplyUnsafe(D){Fa("scalar",D,po,e.n);const k=y.ZERO;if(D===po)return k;if(D===In)return this;const{endo:$}=e;if(!$)return P.unsafeLadder(this,D);let{k1neg:q,k1:U,k2neg:K,k2:J}=$.splitScalar(D),T=k,z=k,ue=this;for(;U>po||J>po;)U&In&&(T=T.add(ue)),J&In&&(z=z.add(ue)),ue=ue.double(),U>>=In,J>>=In;return q&&(T=T.negate()),K&&(z=z.negate()),z=new y(r.mul(z.px,$.beta),z.py,z.pz),T.add(z)}multiply(D){const{endo:k,n:$}=e;Fa("scalar",D,In,$);let q,U;if(k){const{k1neg:K,k1:J,k2neg:T,k2:z}=k.splitScalar(D);let{p:ue,f:_e}=this.wNAF(J),{p:G,f:E}=this.wNAF(z);ue=P.constTimeNegate(K,ue),G=P.constTimeNegate(T,G),G=new y(r.mul(G.px,k.beta),G.py,G.pz),q=ue.add(G),U=_e.add(E)}else{const{p:K,f:J}=this.wNAF(D);q=K,U=J}return y.normalizeZ([q,U])[0]}multiplyAndAddUnsafe(D,k,$){const q=y.BASE,U=(J,T)=>T===po||T===In||!J.equals(q)?J.multiplyUnsafe(T):J.multiply(T),K=U(this,k).add(U(D,$));return K.is0()?void 0:K}toAffine(D){return d(this,D)}isTorsionFree(){const{h:D,isTorsionFree:k}=e;if(D===In)return!0;if(k)return k(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:D,clearCofactor:k}=e;return D===In?this:k?k(y,this):this.multiplyUnsafe(e.h)}toRawBytes(D=!0){return Jc("isCompressed",D),this.assertValidity(),i(y,this,D)}toHex(D=!0){return Jc("isCompressed",D),Xc(this.toRawBytes(D))}}y.BASE=new y(e.Gx,e.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);const A=e.nBitLength,P=bC(y,e.endo?Math.ceil(A/2):A);return{CURVE:e,ProjectivePoint:y,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:a}}function SC(t){const e=l2(t);return zf(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function AC(t){const e=SC(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(f){return di(f,n)}function a(f){return zg(f,n)}const{ProjectivePoint:u,normPrivateKeyToScalar:l,weierstrassEquation:d,isWithinCurveOrder:g}=EC({...e,toBytes(f,p,v){const x=p.toAffine(),_=r.toBytes(x.x),S=qf;return Jc("isCompressed",v),v?S(Uint8Array.from([p.hasEvenY()?2:3]),_):S(Uint8Array.from([4]),_,r.toBytes(x.y))},fromBytes(f){const p=f.length,v=f[0],x=f.subarray(1);if(p===i&&(v===2||v===3)){const _=Ba(x);if(!Gh(_,In,r.ORDER))throw new Error("Point is not on curve");const S=d(_);let b;try{b=r.sqrt(S)}catch(F){const ae=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+ae)}const M=(b&In)===In;return(v&1)===1!==M&&(b=r.neg(b)),{x:_,y:b}}else if(p===s&&v===4){const _=r.fromBytes(x.subarray(0,r.BYTES)),S=r.fromBytes(x.subarray(r.BYTES,2*r.BYTES));return{x:_,y:S}}else throw new Error(`Point of length ${p} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`)}}),y=f=>Xc(eu(f,e.nByteLength));function A(f){const p=n>>In;return f>p}function P(f){return A(f)?o(-f):f}const N=(f,p,v)=>Ba(f.slice(p,v));class D{constructor(p,v,x){this.r=p,this.s=v,this.recovery=x,this.assertValidity()}static fromCompact(p){const v=e.nByteLength;return p=hs("compactSignature",p,v*2),new D(N(p,0,v),N(p,v,2*v))}static fromDER(p){const{r:v,s:x}=ho.toSig(hs("DER",p));return new D(v,x)}assertValidity(){Fa("r",this.r,In,n),Fa("s",this.s,In,n)}addRecoveryBit(p){return new D(this.r,this.s,p)}recoverPublicKey(p){const{r:v,s:x,recovery:_}=this,S=J(hs("msgHash",p));if(_==null||![0,1,2,3].includes(_))throw new Error("recovery id invalid");const b=_===2||_===3?v+e.n:v;if(b>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const M=_&1?"03":"02",I=u.fromHex(M+y(b)),F=a(b),ae=o(-S*F),O=o(x*F),se=u.BASE.multiplyAndAddUnsafe(I,ae,O);if(!se)throw new Error("point at infinify");return se.assertValidity(),se}hasHighS(){return A(this.s)}normalizeS(){return this.hasHighS()?new D(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return Qc(this.toDERHex())}toDERHex(){return ho.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Qc(this.toCompactHex())}toCompactHex(){return y(this.r)+y(this.s)}}const k={isValidPrivateKey(f){try{return l(f),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const f=u2(e.n);return mC(e.randomBytes(f),e.n)},precompute(f=8,p=u.BASE){return p._setWindowSize(f),p.multiply(BigInt(3)),p}};function $(f,p=!0){return u.fromPrivateKey(f).toRawBytes(p)}function q(f){const p=$a(f),v=typeof f=="string",x=(p||v)&&f.length;return p?x===i||x===s:v?x===2*i||x===2*s:f instanceof u}function U(f,p,v=!0){if(q(f))throw new Error("first arg must be private key");if(!q(p))throw new Error("second arg must be public key");return u.fromHex(p).multiply(l(f)).toRawBytes(v)}const K=e.bits2int||function(f){const p=Ba(f),v=f.length*8-e.nBitLength;return v>0?p>>BigInt(v):p},J=e.bits2int_modN||function(f){return o(K(f))},T=Fg(e.nBitLength);function z(f){return Fa(`num < 2^${e.nBitLength}`,f,po,T),eu(f,e.nByteLength)}function ue(f,p,v=_e){if(["recovered","canonical"].some(X=>X in v))throw new Error("sign() legacy options not supported");const{hash:x,randomBytes:_}=e;let{lowS:S,prehash:b,extraEntropy:M}=v;S==null&&(S=!0),f=hs("msgHash",f),h2(v),b&&(f=hs("prehashed msgHash",x(f)));const I=J(f),F=l(p),ae=[z(F),z(I)];if(M!=null&&M!==!1){const X=M===!0?_(r.BYTES):M;ae.push(hs("extraEntropy",X))}const O=qf(...ae),se=I;function ee(X){const Q=K(X);if(!g(Q))return;const R=a(Q),Z=u.BASE.multiply(Q).toAffine(),te=o(Z.x);if(te===po)return;const le=o(R*o(se+te*F));if(le===po)return;let ie=(Z.x===te?0:2)|Number(Z.y&In),fe=le;return S&&A(le)&&(fe=P(le),ie^=1),new D(te,fe,ie)}return{seed:O,k2sig:ee}}const _e={lowS:e.lowS,prehash:!1},G={lowS:e.lowS,prehash:!1};function E(f,p,v=_e){const{seed:x,k2sig:_}=ue(f,p,v),S=e;return n2(S.hash.outputLen,S.nByteLength,S.hmac)(x,_)}u.BASE._setWindowSize(8);function m(f,p,v,x=G){var Z;const _=f;if(p=hs("msgHash",p),v=hs("publicKey",v),"strict"in x)throw new Error("options.strict was renamed to lowS");h2(x);const{lowS:S,prehash:b}=x;let M,I;try{if(typeof _=="string"||$a(_))try{M=D.fromDER(_)}catch(te){if(!(te instanceof ho.Err))throw te;M=D.fromCompact(_)}else if(typeof _=="object"&&typeof _.r=="bigint"&&typeof _.s=="bigint"){const{r:te,s:le}=_;M=new D(te,le)}else throw new Error("PARSE");I=u.fromHex(v)}catch(te){if(te.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(S&&M.hasHighS())return!1;b&&(p=e.hash(p));const{r:F,s:ae}=M,O=J(p),se=a(ae),ee=o(O*se),X=o(F*se),Q=(Z=u.BASE.multiplyAndAddUnsafe(I,ee,X))==null?void 0:Z.toAffine();return Q?o(Q.x)===F:!1}return{CURVE:e,getPublicKey:$,getSharedSecret:U,sign:E,verify:m,ProjectivePoint:u,Signature:D,utils:k}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function PC(t){return{hash:t,hmac:(e,...r)=>Qw(t,e,AP(...r)),randomBytes:MP}}function MC(t,e){const r=n=>AC({...t,...PC(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const p2=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),g2=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),IC=BigInt(1),Kg=BigInt(2),m2=(t,e)=>(t+e/Kg)/e;function CC(t){const e=p2,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),u=BigInt(88),l=t*t*t%e,d=l*l*t%e,g=ji(d,r,e)*d%e,y=ji(g,r,e)*d%e,A=ji(y,Kg,e)*l%e,P=ji(A,i,e)*A%e,N=ji(P,s,e)*P%e,D=ji(N,a,e)*N%e,k=ji(D,u,e)*D%e,$=ji(k,a,e)*N%e,q=ji($,r,e)*d%e,U=ji(q,o,e)*P%e,K=ji(U,n,e)*l%e,J=ji(K,Kg,e);if(!Vg.eql(Vg.sqr(J),t))throw new Error("Cannot find square root");return J}const Vg=a2(p2,void 0,void 0,{sqrt:CC}),v2=MC({a:BigInt(0),b:BigInt(7),Fp:Vg,n:g2,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=g2,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-IC*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=m2(s*t,e),u=m2(-n*t,e);let l=di(t-a*r-u*i,e),d=di(-a*n-u*s,e);const g=l>o,y=d>o;if(g&&(l=e-l),y&&(d=e-d),l>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:g,k1:l,k2neg:y,k2:d}}}},Pg);BigInt(0),v2.ProjectivePoint;const TC=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:v2},Symbol.toStringTag,{value:"Module"}));function RC(t,e){const{abi:r,args:n,bytecode:i,...s}=e,o=RI({abi:r,args:n,bytecode:i});return Dg(t,{...s,data:o})}async function DC(t){var r;return((r=t.account)==null?void 0:r.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(n=>Ef(n))}async function OC(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}async function NC(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>og(r))}async function LC(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function kC(t,{account:e=t.account,message:r}){if(!e)throw new Uf({docsPath:"/docs/actions/wallet/signMessage"});const n=uo(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Dh(r):r.raw instanceof Uint8Array?Rh(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function $C(t,e){var l,d,g,y;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTransaction"});const s=uo(r);jh({account:s,...e});const o=await fi(t,zh,"getChainId")({});n!==null&&Yw({currentChainId:o,chain:n});const a=(n==null?void 0:n.formatters)||((l=t.chain)==null?void 0:l.formatters),u=((d=a==null?void 0:a.transactionRequest)==null?void 0:d.format)||Sg;return s.signTransaction?s.signTransaction({...i,chainId:o},{serializer:(y=(g=t.chain)==null?void 0:g.serializers)==null?void 0:y.transaction}):await t.request({method:"eth_signTransaction",params:[{...u(i),chainId:Pr(o),from:s.address}]},{retryCount:0})}async function BC(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTypedData"});const o=uo(r),a={EIP712Domain:JI({domain:n}),...e.types};if(YI({domain:n,message:i,primaryType:s,types:a}),o.signTypedData)return o.signTypedData({domain:n,message:i,primaryType:s,types:a});const u=GI({domain:n,message:i,primaryType:s,types:a});return t.request({method:"eth_signTypedData_v4",params:[o.address,u]},{retryCount:0})}async function FC(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:Pr(e)}]},{retryCount:0})}async function UC(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}function jC(t){return{addChain:e=>LI(t,e),deployContract:e=>RC(t,e),getAddresses:()=>DC(t),getChainId:()=>zh(t),getPermissions:()=>OC(t),prepareTransactionRequest:e=>Ig(t,e),requestAddresses:()=>NC(t),requestPermissions:e=>LC(t,e),sendRawTransaction:e=>Jw(t,e),sendTransaction:e=>Dg(t,e),signMessage:e=>kC(t,e),signTransaction:e=>$C(t,e),signTypedData:e=>BC(t,e),switchChain:e=>FC(t,e),watchAsset:e=>UC(t,e),writeContract:e=>NI(t,e)}}function qC(t){const{key:e="wallet",name:r="Wallet Client",transport:n}=t;return kI({...t,key:e,name:r,transport:n,type:"walletClient"}).extend(jC)}class Hf{constructor(e){so(this,"_key");so(this,"_config",null);so(this,"_provider",null);so(this,"_connected",!1);so(this,"_address",null);so(this,"_fatured",!1);so(this,"_installed",!1);so(this,"lastUsed",!1);var r;if("name"in e&&"image"in e)this._key=e.name,this._config=e,this._fatured=e.featured;else if("session"in e){if(!e.session)throw new Error("session is null");this._key=(r=e.session)==null?void 0:r.peer.metadata.name,this._provider=e,this._config={name:e.session.peer.metadata.name,image:e.session.peer.metadata.icons[0],featured:!1}}else if("info"in e)console.log(e.info,"installed"),this._key=e.info.name,this._provider=e.provider,this._installed=!0,this._config={name:e.info.name,image:e.info.icon,featured:!1},this.testConnect();else throw new Error("unknown params")}get address(){return this._address}get connected(){return this._connected}get featured(){return this._fatured}get key(){return this._key}get installed(){return this._installed}get client(){return this._provider?qC({transport:qI(this._provider)}):null}get config(){return this._config}static fromWalletConfig(e){return new Hf(e)}EIP6963Detected(e){this._provider=e.provider,this._installed=!0,this._provider.on("disconnect",this.disconnect),this._provider.on("accountsChanged",r=>{this._address=r[0],this._connected=!0}),this.testConnect()}setUniversalProvider(e){this._provider=e,this.testConnect()}async testConnect(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());e&&e.length>0?(this._address=e[0],this._connected=!0):(this._address=null,this._connected=!1)}async connect(){var r;const e=await((r=this.client)==null?void 0:r.request({method:"eth_requestAccounts",params:void 0}));if(!e)throw new Error("connect failed");return e}async getAddress(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());if(!e)throw new Error("get address failed");return e[0]}async getChain(){var r;const e=await((r=this.client)==null?void 0:r.getChainId());if(!e)throw new Error("get chain failed");return e}async signMessage(e,r){var i;return await((i=this.client)==null?void 0:i.signMessage({message:e,account:r}))}async disconnect(){this._provider&&"session"in this._provider&&await this._provider.disconnect(),this._connected=!1,this._address=null}}var Gg={exports:{}},tu=typeof Reflect=="object"?Reflect:null,b2=tu&&typeof tu.apply=="function"?tu.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Yh;tu&&typeof tu.ownKeys=="function"?Yh=tu.ownKeys:Object.getOwnPropertySymbols?Yh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Yh=function(e){return Object.getOwnPropertyNames(e)};function zC(t){console&&console.warn&&console.warn(t)}var y2=Number.isNaN||function(e){return e!==e};function Rr(){Rr.init.call(this)}Gg.exports=Rr,Gg.exports.once=VC,Rr.EventEmitter=Rr,Rr.prototype._events=void 0,Rr.prototype._eventsCount=0,Rr.prototype._maxListeners=void 0;var w2=10;function Jh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Rr,"defaultMaxListeners",{enumerable:!0,get:function(){return w2},set:function(t){if(typeof t!="number"||t<0||y2(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");w2=t}}),Rr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Rr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||y2(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function x2(t){return t._maxListeners===void 0?Rr.defaultMaxListeners:t._maxListeners}Rr.prototype.getMaxListeners=function(){return x2(this)},Rr.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")b2(u,this,r);else for(var l=u.length,d=P2(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,zC(a)}return t}Rr.prototype.addListener=function(e,r){return _2(this,e,r,!1)},Rr.prototype.on=Rr.prototype.addListener,Rr.prototype.prependListener=function(e,r){return _2(this,e,r,!0)};function HC(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function E2(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=HC.bind(n);return i.listener=r,n.wrapFn=i,i}Rr.prototype.once=function(e,r){return Jh(r),this.on(e,E2(this,e,r)),this},Rr.prototype.prependOnceListener=function(e,r){return Jh(r),this.prependListener(e,E2(this,e,r)),this},Rr.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Jh(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():WC(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Rr.prototype.off=Rr.prototype.removeListener,Rr.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function S2(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?KC(i):P2(i,i.length)}Rr.prototype.listeners=function(e){return S2(this,e,!0)},Rr.prototype.rawListeners=function(e){return S2(this,e,!1)},Rr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):A2.call(t,e)},Rr.prototype.listenerCount=A2;function A2(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Rr.prototype.eventNames=function(){return this._eventsCount>0?Yh(this._events):[]};function P2(t,e){for(var r=new Array(e),n=0;n(i==null?void 0:i.code)===Jc.code):t;return n instanceof yt?new Jc({cause:t,message:n.details}):Jc.nodeMessage.test(r)?new Jc({cause:t,message:t.details}):jh.nodeMessage.test(r)?new jh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):gg.nodeMessage.test(r)?new gg({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):mg.nodeMessage.test(r)?new mg({cause:t,nonce:e==null?void 0:e.nonce}):vg.nodeMessage.test(r)?new vg({cause:t,nonce:e==null?void 0:e.nonce}):bg.nodeMessage.test(r)?new bg({cause:t,nonce:e==null?void 0:e.nonce}):yg.nodeMessage.test(r)?new yg({cause:t}):wg.nodeMessage.test(r)?new wg({cause:t,gas:e==null?void 0:e.gas}):xg.nodeMessage.test(r)?new xg({cause:t,gas:e==null?void 0:e.gas}):_g.nodeMessage.test(r)?new _g({cause:t}):Uh.nodeMessage.test(r)?new Uh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new Eg({cause:t})}function cI(t,{docsPath:e,...r}){const n=(()=>{const i=Fw(t,r);return i instanceof Eg?t:i})();return new aI(n,{docsPath:e,...r})}function jw(t,{format:e}){if(!e)return{};const r={};function n(s){const o=Object.keys(s);for(const a of o)a in t&&(r[a]=t[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}const i=e(t||{});return n(i),r}const uI={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Sg(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=fI(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(r=>li(r)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=Pr(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=Pr(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=Pr(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=Pr(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=Pr(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=Pr(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=uI[t.type]),typeof t.value<"u"&&(e.value=Pr(t.value)),e}function fI(t){return t.map(e=>({address:e.contractAddress,r:e.r,s:e.s,chainId:Pr(e.chainId),nonce:Pr(e.nonce),...typeof e.yParity<"u"?{yParity:Pr(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:Pr(e.v)}:{}}))}function Uw(t){if(!(!t||t.length===0))return t.reduce((e,{slot:r,value:n})=>{if(r.length!==66)throw new nw({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new nw({size:n.length,targetSize:66,type:"hex"});return e[r]=n,e},{})}function lI(t){const{balance:e,nonce:r,state:n,stateDiff:i,code:s}=t,o={};if(s!==void 0&&(o.code=s),e!==void 0&&(o.balance=Pr(e)),r!==void 0&&(o.nonce=Pr(r)),n!==void 0&&(o.state=Uw(n)),i!==void 0){if(o.state)throw new jM;o.stateDiff=Uw(i)}return o}function hI(t){if(!t)return;const e={};for(const{address:r,...n}of t){if(!lo(r,{strict:!1}))throw new zc({address:r});if(e[r])throw new FM({address:r});e[r]=lI(n)}return e}const dI=2n**256n-1n;function qh(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?ho(e):void 0;if(o&&!lo(o.address))throw new zc({address:o.address});if(s&&!lo(s))throw new zc({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new UM;if(n&&n>dI)throw new jh({maxFeePerGas:n});if(i&&n&&i>n)throw new Uh({maxFeePerGas:n,maxPriorityFeePerGas:i})}class pI extends yt{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Ag extends yt{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class gI extends yt{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${hs(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class mI extends yt{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}const vI={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function bI(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?Fc(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?Fc(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?vI[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=yI(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function yI(t){return t.map(e=>({contractAddress:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function wI(t){const e=(t.transactions??[]).map(r=>typeof r=="string"?r:bI(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function zh(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){var d,g,y;const s=n??"latest",o=i??!1,a=r!==void 0?Pr(r):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,o]},{dedupe:!0}):u=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]},{dedupe:!!a}),!u)throw new mI({blockHash:e,blockNumber:r});return(((y=(g=(d=t.chain)==null?void 0:d.formatters)==null?void 0:g.block)==null?void 0:y.format)||wI)(u)}async function qw(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function xI(t,e){var s,o;const{block:r,chain:n=t.chain,request:i}=e||{};try{const a=((s=n==null?void 0:n.fees)==null?void 0:s.maxPriorityFeePerGas)??((o=n==null?void 0:n.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=r||await fi(t,zh,"getBlock")({}),d=await a({block:l,client:t,request:i});if(d===null)throw new Error;return d}if(typeof a<"u")return a;const u=await t.request({method:"eth_maxPriorityFeePerGas"});return yf(u)}catch{const[a,u]=await Promise.all([r?Promise.resolve(r):fi(t,zh,"getBlock")({}),fi(t,qw,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new Ag;const l=u-a.baseFeePerGas;return l<0n?0n:l}}async function zw(t,e){var y,A;const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>{var P,O;return typeof((P=n==null?void 0:n.fees)==null?void 0:P.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):((O=n==null?void 0:n.fees)==null?void 0:O.baseFeeMultiplier)??1.2})();if(o<1)throw new pI;const u=10**(((y=o.toString().split(".")[1])==null?void 0:y.length)??0),l=P=>P*BigInt(Math.ceil(o*u))/BigInt(u),d=r||await fi(t,zh,"getBlock")({});if(typeof((A=n==null?void 0:n.fees)==null?void 0:A.estimateFeesPerGas)=="function"){const P=await n.fees.estimateFeesPerGas({block:r,client:t,multiply:l,request:i,type:s});if(P!==null)return P}if(s==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new Ag;const P=typeof(i==null?void 0:i.maxPriorityFeePerGas)=="bigint"?i.maxPriorityFeePerGas:await xI(t,{block:d,chain:n,request:i}),O=l(d.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??O+P,maxPriorityFeePerGas:P}}return{gasPrice:(i==null?void 0:i.gasPrice)??l(await fi(t,qw,"getGasPrice")({}))}}async function _I(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,n?Pr(n):r]},{dedupe:!!n});return Fc(i)}function Hw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(s=>fo(s)):t.blobs,i=[];for(const s of n)i.push(Uint8Array.from(e.blobToKzgCommitment(s)));return r==="bytes"?i:i.map(s=>li(s))}function Ww(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>fo(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>fo(o)):t.commitments,s=[];for(let o=0;oli(o))}function EI(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),u=n?4:0,l=n?0:4;t.setUint32(e+u,o,n),t.setUint32(e+l,a,n)}const SI=(t,e,r)=>t&e^~t&r,AI=(t,e,r)=>t&e^t&r^e&r;class PI extends ig{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ng(this.buffer)}update(e){Uc(this);const{view:r,buffer:n,blockLen:i}=this;e=wf(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let g=o;gd.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g>>3,O=Os(A,17)^Os(A,19)^A>>>10;ra[g]=O+ra[g-7]+P+ra[g-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:u,G:l,H:d}=this;for(let g=0;g<64;g++){const y=Os(a,6)^Os(a,11)^Os(a,25),A=d+y+SI(a,u,l)+MI[g]+ra[g]|0,O=(Os(n,2)^Os(n,13)^Os(n,22))+AI(n,i,s)|0;d=l,l=u,u=a,a=o+A|0,o=s,s=i,i=n,n=A+O|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(n,i,s,o,a,u,l,d)}roundClean(){ra.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Pg=lw(()=>new II);function CI(t,e){return Pg(Zo(t,{strict:!1})?rg(t):t)}function TI(t){const{commitment:e,version:r=1}=t,n=t.to??(typeof e=="string"?"hex":"bytes"),i=CI(e);return i.set([r],0),n==="bytes"?i:li(i)}function RI(t){const{commitments:e,version:r}=t,n=t.to??(typeof e[0]=="string"?"hex":"bytes"),i=[];for(const s of e)i.push(TI({commitment:s,to:n,version:r}));return i}const Kw=6,Vw=32,Mg=4096,Gw=Vw*Mg,Yw=Gw*Kw-1-1*Mg*Kw;class DI extends yt{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class OI extends yt{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function NI(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),r=typeof t.data=="string"?fo(t.data):t.data,n=_n(r);if(!n)throw new OI;if(n>Yw)throw new DI({maxSize:Yw,size:n});const i=[];let s=!0,o=0;for(;s;){const a=dg(new Uint8Array(Gw));let u=0;for(;ua.bytes):i.map(a=>li(a.bytes))}function LI(t){const{data:e,kzg:r,to:n}=t,i=t.blobs??NI({data:e,to:n}),s=t.commitments??Hw({blobs:i,kzg:r,to:n}),o=t.proofs??Ww({blobs:i,commitments:s,kzg:r,to:n}),a=[];for(let u=0;u"u"&&g)if(u){const k=await D();y.nonce=await u.consume({address:g.address,chainId:k,client:t})}else y.nonce=await fi(t,_I,"getTransactionCount")({address:g.address,blockTag:"pending"});if((l.includes("fees")||l.includes("type"))&&typeof d>"u")try{y.type=kI(y)}catch{const k=await P();y.type=typeof(k==null?void 0:k.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(l.includes("fees"))if(y.type!=="legacy"&&y.type!=="eip2930"){if(typeof y.maxFeePerGas>"u"||typeof y.maxPriorityFeePerGas>"u"){const k=await P(),{maxFeePerGas:B,maxPriorityFeePerGas:j}=await zw(t,{block:k,chain:i,request:y});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(y.gas=await fi(t,$I,"estimateGas")({...y,account:g&&{address:g.address,type:"json-rpc"}})),qh(y),delete y.parameters,y}async function BI(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=r?Pr(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function $I(t,e){var i,s,o;const{account:r=t.account}=e,n=r?ho(r):void 0;try{let f=function(v){const{block:x,request:_,rpcStateOverride:S}=v;return t.request({method:"eth_estimateGas",params:S?[_,x??"latest",S]:x?[_,x]:[_]})};const{accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,blockNumber:g,blockTag:y,data:A,gas:P,gasPrice:O,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:j,value:U,stateOverride:K,...J}=await Ig(t,{...e,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),z=(g?Pr(g):void 0)||y,ue=hI(K),_e=await(async()=>{if(J.to)return J.to;if(u&&u.length>0)return await $w({authorization:u[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`")})})();qh(e);const G=(o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:o.format,m=(G||Sg)({...jw(J,{format:G}),from:n==null?void 0:n.address,accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,data:A,gas:P,gasPrice:O,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:j,to:_e,value:U});let p=BigInt(await f({block:z,request:m,rpcStateOverride:ue}));if(u){const v=await BI(t,{address:m.from}),x=await Promise.all(u.map(async _=>{const{contractAddress:S}=_,b=await f({block:z,request:{authorizationList:void 0,data:A,from:n==null?void 0:n.address,to:S,value:Pr(v)},rpcStateOverride:ue}).catch(()=>100000n);return 2n*BigInt(b)}));p+=x.reduce((_,S)=>_+S,0n)}return p}catch(a){throw cI(a,{...e,account:n,chain:t.chain})}}class FI extends yt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class jI extends yt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` +`),{name:"ChainNotFoundError"})}}const Cg="/docs/contract/encodeDeployData";function UI(t){const{abi:e,args:r,bytecode:n}=t;if(!r||r.length===0)return n;const i=e.find(o=>"type"in o&&o.type==="constructor");if(!i)throw new rP({docsPath:Cg});if(!("inputs"in i))throw new Zy({docsPath:Cg});if(!i.inputs||i.inputs.length===0)throw new Zy({docsPath:Cg});const s=Sw(i.inputs,r);return Bh([n,s])}async function qI(t){return new Promise(e=>setTimeout(e,t))}class Uf extends yt{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` +`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class Tg extends yt{constructor({docsPath:e,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:e,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function Xw({chain:t,currentChainId:e}){if(!t)throw new jI;if(e!==t.id)throw new FI({chain:t,currentChainId:e})}function zI(t,{docsPath:e,...r}){const n=(()=>{const i=Fw(t,r);return i instanceof Eg?t:i})();return new zM(n,{docsPath:e,...r})}async function Zw(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const Rg=new kh(128);async function Dg(t,e){var k,B,j,U;const{account:r=t.account,chain:n=t.chain,accessList:i,authorizationList:s,blobs:o,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,value:P,...O}=e;if(typeof r>"u")throw new Uf({docsPath:"/docs/actions/wallet/sendTransaction"});const D=r?ho(r):null;try{qh(e);const K=await(async()=>{if(e.to)return e.to;if(s&&s.length>0)return await $w({authorization:s[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`.")})})();if((D==null?void 0:D.type)==="json-rpc"||D===null){let J;n!==null&&(J=await fi(t,Hh,"getChainId")({}),Xw({currentChainId:J,chain:n}));const T=(j=(B=(k=t.chain)==null?void 0:k.formatters)==null?void 0:B.transactionRequest)==null?void 0:j.format,ue=(T||Sg)({...jw(O,{format:T}),accessList:i,authorizationList:s,blobs:o,chainId:J,data:a,from:D==null?void 0:D.address,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,to:K,value:P}),_e=Rg.get(t.uid),G=_e?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:G,params:[ue]},{retryCount:0})}catch(E){if(_e===!1)throw E;const m=E;if(m.name==="InvalidInputRpcError"||m.name==="InvalidParamsRpcError"||m.name==="MethodNotFoundRpcError"||m.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[ue]},{retryCount:0}).then(f=>(Rg.set(t.uid,!0),f)).catch(f=>{const p=f;throw p.name==="MethodNotFoundRpcError"||p.name==="MethodNotSupportedRpcError"?(Rg.set(t.uid,!1),m):p});throw m}}if((D==null?void 0:D.type)==="local"){const J=await fi(t,Ig,"prepareTransactionRequest")({account:D,accessList:i,authorizationList:s,blobs:o,chain:n,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,nonceManager:D.nonceManager,parameters:[...Jw,"sidecars"],value:P,...O,to:K}),T=(U=n==null?void 0:n.serializers)==null?void 0:U.transaction,z=await D.signTransaction(J,{serializer:T});return await fi(t,Zw,"sendRawTransaction")({serializedTransaction:z})}throw(D==null?void 0:D.type)==="smart"?new Tg({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Tg({docsPath:"/docs/actions/wallet/sendTransaction",type:D==null?void 0:D.type})}catch(K){throw K instanceof Tg?K:zI(K,{...e,account:D,chain:e.chain||void 0})}}async function HI(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:o,functionName:a,...u}=e;if(typeof n>"u")throw new Uf({docsPath:"/docs/contract/writeContract"});const l=n?ho(n):null,d=bM({abi:r,args:s,functionName:a});try{return await fi(t,Dg,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:i,account:l,...u})}catch(g){throw QM(g,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:a,sender:l==null?void 0:l.address})}}async function WI(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:Pr(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}const Og=256;let Wh=Og,Kh;function Qw(t=11){if(!Kh||Wh+t>Og*2){Kh="",Wh=0;for(let e=0;e{const B=k(D);for(const U in P)delete B[U];const j={...D,...B};return Object.assign(j,{extend:O(j)})}}return Object.assign(P,{extend:O(P)})}const Vh=new kh(8192);function VI(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(Vh.get(r))return Vh.get(r);const n=t().finally(()=>Vh.delete(r));return Vh.set(r,n),n}function GI(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const u=async({error:l})=>{const d=typeof e=="function"?e({count:a,error:l}):e;d&&await qI(d),o({count:a+1})};try{const l=await t();i(l)}catch(l){if(a{const{dedupe:i=!1,retryDelay:s=150,retryCount:o=3,uid:a}={...e,...n},u=i?Ef(Oh(`${a}.${Kc(r)}`)):void 0;return VI(()=>GI(async()=>{try{return await t(r)}catch(l){const d=l;switch(d.code){case Pf.code:throw new Pf(d);case Mf.code:throw new Mf(d);case If.code:throw new If(d,{method:r.method});case Cf.code:throw new Cf(d);case Fa.code:throw new Fa(d);case Tf.code:throw new Tf(d);case Rf.code:throw new Rf(d);case Df.code:throw new Df(d);case Of.code:throw new Of(d);case Nf.code:throw new Nf(d,{method:r.method});case Gc.code:throw new Gc(d);case Lf.code:throw new Lf(d);case Yc.code:throw new Yc(d);case kf.code:throw new kf(d);case Bf.code:throw new Bf(d);case $f.code:throw new $f(d);case Ff.code:throw new Ff(d);case jf.code:throw new jf(d);case 5e3:throw new Yc(d);default:throw l instanceof yt?l:new XM(d)}}},{delay:({count:l,error:d})=>{var g;if(d&&d instanceof Nw){const y=(g=d==null?void 0:d.headers)==null?void 0:g.get("Retry-After");if(y!=null&&y.match(/\d/))return Number.parseInt(y)*1e3}return~~(1<JI(l)}),{enabled:i,id:u})}}function JI(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Gc.code||t.code===Fa.code:t instanceof Nw&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function XI({key:t,name:e,request:r,retryCount:n=3,retryDelay:i=150,timeout:s,type:o},a){const u=Qw();return{config:{key:t,name:e,request:r,retryCount:n,retryDelay:i,timeout:s,type:o},request:YI(r,{retryCount:n,retryDelay:i,uid:u}),value:a}}function ZI(t,e={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=e;return({retryCount:s})=>XI({key:r,name:n,request:t.request.bind(t),retryCount:e.retryCount??s,retryDelay:i,type:"custom"})}const QI=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,eC=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;class tC extends yt{constructor({domain:e}){super(`Invalid domain "${Kc(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class rC extends yt{constructor({primaryType:e,types:r}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class nC extends yt{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function iC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(u,l)=>{const d={...l};for(const g of u){const{name:y,type:A}=g;A==="address"&&(d[y]=d[y].toLowerCase())}return d},o=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return Kc({domain:o,message:a,primaryType:n,types:i})}function sC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(o,a)=>{for(const u of o){const{name:l,type:d}=u,g=a[l],y=d.match(eC);if(y&&(typeof g=="number"||typeof g=="bigint")){const[O,D,k]=y;Pr(g,{signed:D==="int",size:Number.parseInt(k)/8})}if(d==="address"&&typeof g=="string"&&!lo(g))throw new zc({address:g});const A=d.match(QI);if(A){const[O,D]=A;if(D&&_n(g)!==Number.parseInt(D))throw new cP({expectedSize:Number.parseInt(D),givenSize:_n(g)})}const P=i[d];P&&(aC(d),s(P,g))}};if(i.EIP712Domain&&e){if(typeof e!="object")throw new tC({domain:e});s(i.EIP712Domain,e)}if(n!=="EIP712Domain")if(i[n])s(i[n],r);else throw new rC({primaryType:n,types:i})}function oC({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},typeof(t==null?void 0:t.chainId)=="number"&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function aC(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new nC({type:t})}let e2=class extends ig{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,EP(e);const n=wf(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew e2(t,e).update(r).digest();t2.create=(t,e)=>new e2(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ng=BigInt(0),Gh=BigInt(1),cC=BigInt(2);function ja(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function qf(t){if(!ja(t))throw new Error("Uint8Array expected")}function Xc(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)}const uC=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Zc(t){qf(t);let e="";for(let r=0;r=go._0&&t<=go._9)return t-go._0;if(t>=go._A&&t<=go._F)return t-(go._A-10);if(t>=go._a&&t<=go._f)return t-(go._a-10)}function eu(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;itypeof t=="bigint"&&Ng<=t;function Yh(t,e,r){return $g(t)&&$g(e)&&$g(r)&&e<=t&&tNg;t>>=Gh,e+=1);return e}function dC(t,e){return t>>BigInt(e)&Gh}function pC(t,e,r){return t|(r?Gh:Ng)<(cC<new Uint8Array(t),i2=t=>Uint8Array.from(t);function s2(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=jg(t),i=jg(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...g)=>r(i,n,...g),u=(g=jg())=>{i=a(i2([0]),g),n=a(),g.length!==0&&(i=a(i2([1]),g),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let g=0;const y=[];for(;g{o(),u(g);let A;for(;!(A=y(l()));)u();return o(),A}}const gC={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||ja(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Hf(t,e,r={}){const n=(i,s,o)=>{const a=gC[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const u=t[i];if(!(o&&u===void 0)&&!a(u,t))throw new Error(`Invalid param ${String(i)}=${u} (${typeof u}), expected ${s}`)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const mC=()=>{throw new Error("not implemented")};function Ug(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}const vC=Object.freeze(Object.defineProperty({__proto__:null,aInRange:qa,abool:Xc,abytes:qf,bitGet:dC,bitLen:n2,bitMask:Fg,bitSet:pC,bytesToHex:Zc,bytesToNumberBE:Ua,bytesToNumberLE:kg,concatBytes:zf,createHmacDrbg:s2,ensureBytes:ds,equalBytes:lC,hexToBytes:eu,hexToNumber:Lg,inRange:Yh,isBytes:ja,memoized:Ug,notImplemented:mC,numberToBytesBE:tu,numberToBytesLE:Bg,numberToHexUnpadded:Qc,numberToVarBytesBE:fC,utf8ToBytes:hC,validateObject:Hf},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mn=BigInt(0),sn=BigInt(1),za=BigInt(2),bC=BigInt(3),qg=BigInt(4),o2=BigInt(5),a2=BigInt(8);BigInt(9),BigInt(16);function di(t,e){const r=t%e;return r>=Mn?r:e+r}function yC(t,e,r){if(r<=Mn||e 0");if(r===sn)return Mn;let n=sn;for(;e>Mn;)e&sn&&(n=n*t%r),t=t*t%r,e>>=sn;return n}function qi(t,e,r){let n=t;for(;e-- >Mn;)n*=n,n%=r;return n}function zg(t,e){if(t===Mn||e<=Mn)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=di(t,e),n=e,i=Mn,s=sn;for(;r!==Mn;){const a=n/r,u=n%r,l=i-s*a;n=r,r=u,i=s,s=l}if(n!==sn)throw new Error("invert: does not exist");return di(i,e)}function wC(t){const e=(t-sn)/za;let r,n,i;for(r=t-sn,n=0;r%za===Mn;r/=za,n++);for(i=za;i(n[i]="function",n),e);return Hf(t,r)}function SC(t,e,r){if(r 0");if(r===Mn)return t.ONE;if(r===sn)return e;let n=t.ONE,i=e;for(;r>Mn;)r&sn&&(n=t.mul(n,i)),i=t.sqr(i),r>>=sn;return n}function AC(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function c2(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function u2(t,e,r=!1,n={}){if(t<=Mn)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=c2(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=xC(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:Fg(i),ZERO:Mn,ONE:sn,create:u=>di(u,t),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return Mn<=u&&uu===Mn,isOdd:u=>(u&sn)===sn,neg:u=>di(-u,t),eql:(u,l)=>u===l,sqr:u=>di(u*u,t),add:(u,l)=>di(u+l,t),sub:(u,l)=>di(u-l,t),mul:(u,l)=>di(u*l,t),pow:(u,l)=>SC(a,u,l),div:(u,l)=>di(u*zg(l,t),t),sqrN:u=>u*u,addN:(u,l)=>u+l,subN:(u,l)=>u-l,mulN:(u,l)=>u*l,inv:u=>zg(u,t),sqrt:n.sqrt||(u=>o(a,u)),invertBatch:u=>AC(a,u),cmov:(u,l,d)=>d?l:u,toBytes:u=>r?Bg(u,s):tu(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return r?kg(u):Ua(u)}});return Object.freeze(a)}function f2(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function l2(t){const e=f2(t);return e+Math.ceil(e/2)}function PC(t,e,r=!1){const n=t.length,i=f2(e),s=l2(e);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?Ua(t):kg(t),a=di(o,e-sn)+sn;return r?Bg(a,i):tu(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const MC=BigInt(0),Hg=BigInt(1),Wg=new WeakMap,h2=new WeakMap;function IC(t,e){const r=(s,o)=>{const a=o.negate();return s?a:o},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>e)throw new Error(`Wrong window size=${s}, should be [1..${e}]`)},i=s=>{n(s);const o=Math.ceil(e/s)+1,a=2**(s-1);return{windows:o,windowSize:a}};return{constTimeNegate:r,unsafeLadder(s,o){let a=t.ZERO,u=s;for(;o>MC;)o&Hg&&(a=a.add(u)),u=u.double(),o>>=Hg;return a},precomputeWindow(s,o){const{windows:a,windowSize:u}=i(o),l=[];let d=s,g=d;for(let y=0;y>=P,k>l&&(k-=A,a+=Hg);const B=D,j=D+Math.abs(k)-1,U=O%2!==0,K=k<0;k===0?g=g.add(r(U,o[B])):d=d.add(r(K,o[j]))}return{p:d,f:g}},wNAFCached(s,o,a){const u=h2.get(s)||1;let l=Wg.get(s);return l||(l=this.precomputeWindow(s,u),u!==1&&Wg.set(s,a(l))),this.wNAF(u,l,o)},setWindowSize(s,o){n(o),h2.set(s,o),Wg.delete(s)}}}function CC(t,e,r,n){if(!Array.isArray(r)||!Array.isArray(n)||n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((d,g)=>{if(!e.isValid(d))throw new Error(`wrong scalar at index ${g}`)}),r.forEach((d,g)=>{if(!(d instanceof t))throw new Error(`wrong point at index ${g}`)});const i=n2(BigInt(r.length)),s=i>12?i-3:i>4?i-2:i?2:1,o=(1<=0;d-=s){a.fill(t.ZERO);for(let y=0;y>BigInt(d)&BigInt(o));a[P]=a[P].add(r[y])}let g=t.ZERO;for(let y=a.length-1,A=t.ZERO;y>0;y--)A=A.add(a[y]),g=g.add(A);if(l=l.add(g),d!==0)for(let y=0;y{const{Err:r}=mo;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=Qc(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?Qc(i.length/2|128):"";return`${Qc(t)}${s}${i}${e}`},decode(t,e){const{Err:r}=mo;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");const l=e.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const d of l)o=o<<8|d;if(n+=u,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=mo;if(t{const B=D.toAffine();return zf(Uint8Array.from([4]),r.toBytes(B.x),r.toBytes(B.y))}),s=e.fromBytes||(O=>{const D=O.subarray(1),k=r.fromBytes(D.subarray(0,r.BYTES)),B=r.fromBytes(D.subarray(r.BYTES,2*r.BYTES));return{x:k,y:B}});function o(O){const{a:D,b:k}=e,B=r.sqr(O),j=r.mul(B,O);return r.add(r.add(j,r.mul(O,D)),k)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(O){return Yh(O,In,e.n)}function u(O){const{allowedPrivateKeyLengths:D,nByteLength:k,wrapPrivateKey:B,n:j}=e;if(D&&typeof O!="bigint"){if(ja(O)&&(O=Zc(O)),typeof O!="string"||!D.includes(O.length))throw new Error("Invalid key");O=O.padStart(k*2,"0")}let U;try{U=typeof O=="bigint"?O:Ua(ds("private key",O,k))}catch{throw new Error(`private key must be ${k} bytes, hex or bigint, not ${typeof O}`)}return B&&(U=di(U,j)),qa("private key",U,In,j),U}function l(O){if(!(O instanceof y))throw new Error("ProjectivePoint expected")}const d=Ug((O,D)=>{const{px:k,py:B,pz:j}=O;if(r.eql(j,r.ONE))return{x:k,y:B};const U=O.is0();D==null&&(D=U?r.ONE:r.inv(j));const K=r.mul(k,D),J=r.mul(B,D),T=r.mul(j,D);if(U)return{x:r.ZERO,y:r.ZERO};if(!r.eql(T,r.ONE))throw new Error("invZ was invalid");return{x:K,y:J}}),g=Ug(O=>{if(O.is0()){if(e.allowInfinityPoint&&!r.is0(O.py))return;throw new Error("bad point: ZERO")}const{x:D,y:k}=O.toAffine();if(!r.isValid(D)||!r.isValid(k))throw new Error("bad point: x or y not FE");const B=r.sqr(k),j=o(D);if(!r.eql(B,j))throw new Error("bad point: equation left != right");if(!O.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(D,k,B){if(this.px=D,this.py=k,this.pz=B,D==null||!r.isValid(D))throw new Error("x required");if(k==null||!r.isValid(k))throw new Error("y required");if(B==null||!r.isValid(B))throw new Error("z required");Object.freeze(this)}static fromAffine(D){const{x:k,y:B}=D||{};if(!D||!r.isValid(k)||!r.isValid(B))throw new Error("invalid affine point");if(D instanceof y)throw new Error("projective point not allowed");const j=U=>r.eql(U,r.ZERO);return j(k)&&j(B)?y.ZERO:new y(k,B,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(D){const k=r.invertBatch(D.map(B=>B.pz));return D.map((B,j)=>B.toAffine(k[j])).map(y.fromAffine)}static fromHex(D){const k=y.fromAffine(s(ds("pointHex",D)));return k.assertValidity(),k}static fromPrivateKey(D){return y.BASE.multiply(u(D))}static msm(D,k){return CC(y,n,D,k)}_setWindowSize(D){P.setWindowSize(this,D)}assertValidity(){g(this)}hasEvenY(){const{y:D}=this.toAffine();if(r.isOdd)return!r.isOdd(D);throw new Error("Field doesn't support isOdd")}equals(D){l(D);const{px:k,py:B,pz:j}=this,{px:U,py:K,pz:J}=D,T=r.eql(r.mul(k,J),r.mul(U,j)),z=r.eql(r.mul(B,J),r.mul(K,j));return T&&z}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){const{a:D,b:k}=e,B=r.mul(k,g2),{px:j,py:U,pz:K}=this;let J=r.ZERO,T=r.ZERO,z=r.ZERO,ue=r.mul(j,j),_e=r.mul(U,U),G=r.mul(K,K),E=r.mul(j,U);return E=r.add(E,E),z=r.mul(j,K),z=r.add(z,z),J=r.mul(D,z),T=r.mul(B,G),T=r.add(J,T),J=r.sub(_e,T),T=r.add(_e,T),T=r.mul(J,T),J=r.mul(E,J),z=r.mul(B,z),G=r.mul(D,G),E=r.sub(ue,G),E=r.mul(D,E),E=r.add(E,z),z=r.add(ue,ue),ue=r.add(z,ue),ue=r.add(ue,G),ue=r.mul(ue,E),T=r.add(T,ue),G=r.mul(U,K),G=r.add(G,G),ue=r.mul(G,E),J=r.sub(J,ue),z=r.mul(G,_e),z=r.add(z,z),z=r.add(z,z),new y(J,T,z)}add(D){l(D);const{px:k,py:B,pz:j}=this,{px:U,py:K,pz:J}=D;let T=r.ZERO,z=r.ZERO,ue=r.ZERO;const _e=e.a,G=r.mul(e.b,g2);let E=r.mul(k,U),m=r.mul(B,K),f=r.mul(j,J),p=r.add(k,B),v=r.add(U,K);p=r.mul(p,v),v=r.add(E,m),p=r.sub(p,v),v=r.add(k,j);let x=r.add(U,J);return v=r.mul(v,x),x=r.add(E,f),v=r.sub(v,x),x=r.add(B,j),T=r.add(K,J),x=r.mul(x,T),T=r.add(m,f),x=r.sub(x,T),ue=r.mul(_e,v),T=r.mul(G,f),ue=r.add(T,ue),T=r.sub(m,ue),ue=r.add(m,ue),z=r.mul(T,ue),m=r.add(E,E),m=r.add(m,E),f=r.mul(_e,f),v=r.mul(G,v),m=r.add(m,f),f=r.sub(E,f),f=r.mul(_e,f),v=r.add(v,f),E=r.mul(m,v),z=r.add(z,E),E=r.mul(x,v),T=r.mul(p,T),T=r.sub(T,E),E=r.mul(p,m),ue=r.mul(x,ue),ue=r.add(ue,E),new y(T,z,ue)}subtract(D){return this.add(D.negate())}is0(){return this.equals(y.ZERO)}wNAF(D){return P.wNAFCached(this,D,y.normalizeZ)}multiplyUnsafe(D){qa("scalar",D,vo,e.n);const k=y.ZERO;if(D===vo)return k;if(D===In)return this;const{endo:B}=e;if(!B)return P.unsafeLadder(this,D);let{k1neg:j,k1:U,k2neg:K,k2:J}=B.splitScalar(D),T=k,z=k,ue=this;for(;U>vo||J>vo;)U&In&&(T=T.add(ue)),J&In&&(z=z.add(ue)),ue=ue.double(),U>>=In,J>>=In;return j&&(T=T.negate()),K&&(z=z.negate()),z=new y(r.mul(z.px,B.beta),z.py,z.pz),T.add(z)}multiply(D){const{endo:k,n:B}=e;qa("scalar",D,In,B);let j,U;if(k){const{k1neg:K,k1:J,k2neg:T,k2:z}=k.splitScalar(D);let{p:ue,f:_e}=this.wNAF(J),{p:G,f:E}=this.wNAF(z);ue=P.constTimeNegate(K,ue),G=P.constTimeNegate(T,G),G=new y(r.mul(G.px,k.beta),G.py,G.pz),j=ue.add(G),U=_e.add(E)}else{const{p:K,f:J}=this.wNAF(D);j=K,U=J}return y.normalizeZ([j,U])[0]}multiplyAndAddUnsafe(D,k,B){const j=y.BASE,U=(J,T)=>T===vo||T===In||!J.equals(j)?J.multiplyUnsafe(T):J.multiply(T),K=U(this,k).add(U(D,B));return K.is0()?void 0:K}toAffine(D){return d(this,D)}isTorsionFree(){const{h:D,isTorsionFree:k}=e;if(D===In)return!0;if(k)return k(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:D,clearCofactor:k}=e;return D===In?this:k?k(y,this):this.multiplyUnsafe(e.h)}toRawBytes(D=!0){return Xc("isCompressed",D),this.assertValidity(),i(y,this,D)}toHex(D=!0){return Xc("isCompressed",D),Zc(this.toRawBytes(D))}}y.BASE=new y(e.Gx,e.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);const A=e.nBitLength,P=IC(y,e.endo?Math.ceil(A/2):A);return{CURVE:e,ProjectivePoint:y,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:a}}function NC(t){const e=d2(t);return Hf(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function LC(t){const e=NC(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(f){return di(f,n)}function a(f){return zg(f,n)}const{ProjectivePoint:u,normPrivateKeyToScalar:l,weierstrassEquation:d,isWithinCurveOrder:g}=OC({...e,toBytes(f,p,v){const x=p.toAffine(),_=r.toBytes(x.x),S=zf;return Xc("isCompressed",v),v?S(Uint8Array.from([p.hasEvenY()?2:3]),_):S(Uint8Array.from([4]),_,r.toBytes(x.y))},fromBytes(f){const p=f.length,v=f[0],x=f.subarray(1);if(p===i&&(v===2||v===3)){const _=Ua(x);if(!Yh(_,In,r.ORDER))throw new Error("Point is not on curve");const S=d(_);let b;try{b=r.sqrt(S)}catch(F){const ae=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+ae)}const M=(b&In)===In;return(v&1)===1!==M&&(b=r.neg(b)),{x:_,y:b}}else if(p===s&&v===4){const _=r.fromBytes(x.subarray(0,r.BYTES)),S=r.fromBytes(x.subarray(r.BYTES,2*r.BYTES));return{x:_,y:S}}else throw new Error(`Point of length ${p} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`)}}),y=f=>Zc(tu(f,e.nByteLength));function A(f){const p=n>>In;return f>p}function P(f){return A(f)?o(-f):f}const O=(f,p,v)=>Ua(f.slice(p,v));class D{constructor(p,v,x){this.r=p,this.s=v,this.recovery=x,this.assertValidity()}static fromCompact(p){const v=e.nByteLength;return p=ds("compactSignature",p,v*2),new D(O(p,0,v),O(p,v,2*v))}static fromDER(p){const{r:v,s:x}=mo.toSig(ds("DER",p));return new D(v,x)}assertValidity(){qa("r",this.r,In,n),qa("s",this.s,In,n)}addRecoveryBit(p){return new D(this.r,this.s,p)}recoverPublicKey(p){const{r:v,s:x,recovery:_}=this,S=J(ds("msgHash",p));if(_==null||![0,1,2,3].includes(_))throw new Error("recovery id invalid");const b=_===2||_===3?v+e.n:v;if(b>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const M=_&1?"03":"02",I=u.fromHex(M+y(b)),F=a(b),ae=o(-S*F),N=o(x*F),se=u.BASE.multiplyAndAddUnsafe(I,ae,N);if(!se)throw new Error("point at infinify");return se.assertValidity(),se}hasHighS(){return A(this.s)}normalizeS(){return this.hasHighS()?new D(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return eu(this.toDERHex())}toDERHex(){return mo.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return eu(this.toCompactHex())}toCompactHex(){return y(this.r)+y(this.s)}}const k={isValidPrivateKey(f){try{return l(f),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const f=l2(e.n);return PC(e.randomBytes(f),e.n)},precompute(f=8,p=u.BASE){return p._setWindowSize(f),p.multiply(BigInt(3)),p}};function B(f,p=!0){return u.fromPrivateKey(f).toRawBytes(p)}function j(f){const p=ja(f),v=typeof f=="string",x=(p||v)&&f.length;return p?x===i||x===s:v?x===2*i||x===2*s:f instanceof u}function U(f,p,v=!0){if(j(f))throw new Error("first arg must be private key");if(!j(p))throw new Error("second arg must be public key");return u.fromHex(p).multiply(l(f)).toRawBytes(v)}const K=e.bits2int||function(f){const p=Ua(f),v=f.length*8-e.nBitLength;return v>0?p>>BigInt(v):p},J=e.bits2int_modN||function(f){return o(K(f))},T=Fg(e.nBitLength);function z(f){return qa(`num < 2^${e.nBitLength}`,f,vo,T),tu(f,e.nByteLength)}function ue(f,p,v=_e){if(["recovered","canonical"].some(X=>X in v))throw new Error("sign() legacy options not supported");const{hash:x,randomBytes:_}=e;let{lowS:S,prehash:b,extraEntropy:M}=v;S==null&&(S=!0),f=ds("msgHash",f),p2(v),b&&(f=ds("prehashed msgHash",x(f)));const I=J(f),F=l(p),ae=[z(F),z(I)];if(M!=null&&M!==!1){const X=M===!0?_(r.BYTES):M;ae.push(ds("extraEntropy",X))}const N=zf(...ae),se=I;function ee(X){const Q=K(X);if(!g(Q))return;const R=a(Q),Z=u.BASE.multiply(Q).toAffine(),te=o(Z.x);if(te===vo)return;const he=o(R*o(se+te*F));if(he===vo)return;let ie=(Z.x===te?0:2)|Number(Z.y&In),fe=he;return S&&A(he)&&(fe=P(he),ie^=1),new D(te,fe,ie)}return{seed:N,k2sig:ee}}const _e={lowS:e.lowS,prehash:!1},G={lowS:e.lowS,prehash:!1};function E(f,p,v=_e){const{seed:x,k2sig:_}=ue(f,p,v),S=e;return s2(S.hash.outputLen,S.nByteLength,S.hmac)(x,_)}u.BASE._setWindowSize(8);function m(f,p,v,x=G){var Z;const _=f;if(p=ds("msgHash",p),v=ds("publicKey",v),"strict"in x)throw new Error("options.strict was renamed to lowS");p2(x);const{lowS:S,prehash:b}=x;let M,I;try{if(typeof _=="string"||ja(_))try{M=D.fromDER(_)}catch(te){if(!(te instanceof mo.Err))throw te;M=D.fromCompact(_)}else if(typeof _=="object"&&typeof _.r=="bigint"&&typeof _.s=="bigint"){const{r:te,s:he}=_;M=new D(te,he)}else throw new Error("PARSE");I=u.fromHex(v)}catch(te){if(te.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(S&&M.hasHighS())return!1;b&&(p=e.hash(p));const{r:F,s:ae}=M,N=J(p),se=a(ae),ee=o(N*se),X=o(F*se),Q=(Z=u.BASE.multiplyAndAddUnsafe(I,ee,X))==null?void 0:Z.toAffine();return Q?o(Q.x)===F:!1}return{CURVE:e,getPublicKey:B,getSharedSecret:U,sign:E,verify:m,ProjectivePoint:u,Signature:D,utils:k}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function kC(t){return{hash:t,hmac:(e,...r)=>t2(t,e,LP(...r)),randomBytes:BP}}function BC(t,e){const r=n=>LC({...t,...kC(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const m2=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),v2=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),$C=BigInt(1),Kg=BigInt(2),b2=(t,e)=>(t+e/Kg)/e;function FC(t){const e=m2,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),u=BigInt(88),l=t*t*t%e,d=l*l*t%e,g=qi(d,r,e)*d%e,y=qi(g,r,e)*d%e,A=qi(y,Kg,e)*l%e,P=qi(A,i,e)*A%e,O=qi(P,s,e)*P%e,D=qi(O,a,e)*O%e,k=qi(D,u,e)*D%e,B=qi(k,a,e)*O%e,j=qi(B,r,e)*d%e,U=qi(j,o,e)*P%e,K=qi(U,n,e)*l%e,J=qi(K,Kg,e);if(!Vg.eql(Vg.sqr(J),t))throw new Error("Cannot find square root");return J}const Vg=u2(m2,void 0,void 0,{sqrt:FC}),y2=BC({a:BigInt(0),b:BigInt(7),Fp:Vg,n:v2,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=v2,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-$C*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=b2(s*t,e),u=b2(-n*t,e);let l=di(t-a*r-u*i,e),d=di(-a*n-u*s,e);const g=l>o,y=d>o;if(g&&(l=e-l),y&&(d=e-d),l>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:g,k1:l,k2neg:y,k2:d}}}},Pg);BigInt(0),y2.ProjectivePoint;const jC=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:y2},Symbol.toStringTag,{value:"Module"}));function UC(t,e){const{abi:r,args:n,bytecode:i,...s}=e,o=UI({abi:r,args:n,bytecode:i});return Dg(t,{...s,data:o})}async function qC(t){var r;return((r=t.account)==null?void 0:r.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(n=>Sf(n))}async function zC(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}async function HC(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>og(r))}async function WC(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function KC(t,{account:e=t.account,message:r}){if(!e)throw new Uf({docsPath:"/docs/actions/wallet/signMessage"});const n=ho(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Oh(r):r.raw instanceof Uint8Array?Dh(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function VC(t,e){var l,d,g,y;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTransaction"});const s=ho(r);qh({account:s,...e});const o=await fi(t,Hh,"getChainId")({});n!==null&&Xw({currentChainId:o,chain:n});const a=(n==null?void 0:n.formatters)||((l=t.chain)==null?void 0:l.formatters),u=((d=a==null?void 0:a.transactionRequest)==null?void 0:d.format)||Sg;return s.signTransaction?s.signTransaction({...i,chainId:o},{serializer:(y=(g=t.chain)==null?void 0:g.serializers)==null?void 0:y.transaction}):await t.request({method:"eth_signTransaction",params:[{...u(i),chainId:Pr(o),from:s.address}]},{retryCount:0})}async function GC(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTypedData"});const o=ho(r),a={EIP712Domain:oC({domain:n}),...e.types};if(sC({domain:n,message:i,primaryType:s,types:a}),o.signTypedData)return o.signTypedData({domain:n,message:i,primaryType:s,types:a});const u=iC({domain:n,message:i,primaryType:s,types:a});return t.request({method:"eth_signTypedData_v4",params:[o.address,u]},{retryCount:0})}async function YC(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:Pr(e)}]},{retryCount:0})}async function JC(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}function XC(t){return{addChain:e=>WI(t,e),deployContract:e=>UC(t,e),getAddresses:()=>qC(t),getChainId:()=>Hh(t),getPermissions:()=>zC(t),prepareTransactionRequest:e=>Ig(t,e),requestAddresses:()=>HC(t),requestPermissions:e=>WC(t,e),sendRawTransaction:e=>Zw(t,e),sendTransaction:e=>Dg(t,e),signMessage:e=>KC(t,e),signTransaction:e=>VC(t,e),signTypedData:e=>GC(t,e),switchChain:e=>YC(t,e),watchAsset:e=>JC(t,e),writeContract:e=>HI(t,e)}}function ZC(t){const{key:e="wallet",name:r="Wallet Client",transport:n}=t;return KI({...t,key:e,name:r,transport:n,type:"walletClient"}).extend(XC)}class Wf{constructor(e){co(this,"_key");co(this,"_config",null);co(this,"_provider",null);co(this,"_connected",!1);co(this,"_address",null);co(this,"_fatured",!1);co(this,"_installed",!1);co(this,"lastUsed",!1);var r;if("name"in e&&"image"in e)this._key=e.name,this._config=e,this._fatured=e.featured;else if("session"in e){if(!e.session)throw new Error("session is null");this._key=(r=e.session)==null?void 0:r.peer.metadata.name,this._provider=e,this._config={name:e.session.peer.metadata.name,image:e.session.peer.metadata.icons[0],featured:!1}}else if("info"in e)console.log(e.info,"installed"),this._key=e.info.name,this._provider=e.provider,this._installed=!0,this._config={name:e.info.name,image:e.info.icon,featured:!1},this.testConnect();else throw new Error("unknown params")}get address(){return this._address}get connected(){return this._connected}get featured(){return this._fatured}get key(){return this._key}get installed(){return this._installed}get client(){return this._provider?ZC({transport:ZI(this._provider)}):null}get config(){return this._config}static fromWalletConfig(e){return new Wf(e)}EIP6963Detected(e){this._provider=e.provider,this._installed=!0,this._provider.on("disconnect",this.disconnect),this._provider.on("accountsChanged",r=>{this._address=r[0],this._connected=!0}),this.testConnect()}setUniversalProvider(e){this._provider=e,this.testConnect()}async testConnect(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());e&&e.length>0?(this._address=e[0],this._connected=!0):(this._address=null,this._connected=!1)}async connect(){var r;const e=await((r=this.client)==null?void 0:r.request({method:"eth_requestAccounts",params:void 0}));if(!e)throw new Error("connect failed");return e}async getAddress(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());if(!e)throw new Error("get address failed");return e[0]}async getChain(){var r;const e=await((r=this.client)==null?void 0:r.getChainId());if(!e)throw new Error("get chain failed");return e}async signMessage(e,r){var i;return await((i=this.client)==null?void 0:i.signMessage({message:e,account:r}))}async disconnect(){this._provider&&"session"in this._provider&&await this._provider.disconnect(),this._connected=!1,this._address=null}}var Gg={exports:{}},ru=typeof Reflect=="object"?Reflect:null,w2=ru&&typeof ru.apply=="function"?ru.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Jh;ru&&typeof ru.ownKeys=="function"?Jh=ru.ownKeys:Object.getOwnPropertySymbols?Jh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Jh=function(e){return Object.getOwnPropertyNames(e)};function QC(t){console&&console.warn&&console.warn(t)}var x2=Number.isNaN||function(e){return e!==e};function Rr(){Rr.init.call(this)}Gg.exports=Rr,Gg.exports.once=nT,Rr.EventEmitter=Rr,Rr.prototype._events=void 0,Rr.prototype._eventsCount=0,Rr.prototype._maxListeners=void 0;var _2=10;function Xh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Rr,"defaultMaxListeners",{enumerable:!0,get:function(){return _2},set:function(t){if(typeof t!="number"||t<0||x2(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");_2=t}}),Rr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Rr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||x2(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function E2(t){return t._maxListeners===void 0?Rr.defaultMaxListeners:t._maxListeners}Rr.prototype.getMaxListeners=function(){return E2(this)},Rr.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")w2(u,this,r);else for(var l=u.length,d=I2(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,QC(a)}return t}Rr.prototype.addListener=function(e,r){return S2(this,e,r,!1)},Rr.prototype.on=Rr.prototype.addListener,Rr.prototype.prependListener=function(e,r){return S2(this,e,r,!0)};function eT(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function A2(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=eT.bind(n);return i.listener=r,n.wrapFn=i,i}Rr.prototype.once=function(e,r){return Xh(r),this.on(e,A2(this,e,r)),this},Rr.prototype.prependOnceListener=function(e,r){return Xh(r),this.prependListener(e,A2(this,e,r)),this},Rr.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Xh(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():tT(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Rr.prototype.off=Rr.prototype.removeListener,Rr.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function P2(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?rT(i):I2(i,i.length)}Rr.prototype.listeners=function(e){return P2(this,e,!0)},Rr.prototype.rawListeners=function(e){return P2(this,e,!1)},Rr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):M2.call(t,e)},Rr.prototype.listenerCount=M2;function M2(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Rr.prototype.eventNames=function(){return this._eventsCount>0?Jh(this._events):[]};function I2(t,e){for(var r=new Array(e),n=0;n=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function ZC(t,e){return function(r,n){e(r,n,t)}}function QC(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function eT(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(d){try{l(n.next(d))}catch(g){o(g)}}function u(d){try{l(n.throw(d))}catch(g){o(g)}}function l(d){d.done?s(d.value):i(d.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function tT(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return u([l,d])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function I2(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function iT(){for(var t=[],e=0;e1||a(y,A)})})}function a(y,A){try{u(n[y](A))}catch(P){g(s[0][3],P)}}function u(y){y.value instanceof Wf?Promise.resolve(y.value.v).then(l,d):g(s[0][2],y)}function l(y){a("next",y)}function d(y){a("throw",y)}function g(y,A){y(A),s.shift(),s.length&&a(s[0][0],s[0][1])}}function aT(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Wf(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function cT(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Zg=="function"?Zg(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function uT(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function fT(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function lT(t){return t&&t.__esModule?t:{default:t}}function hT(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function dT(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const Kf=Jp(Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Xg},__asyncDelegator:aT,__asyncGenerator:oT,__asyncValues:cT,__await:Wf,__awaiter:eT,__classPrivateFieldGet:hT,__classPrivateFieldSet:dT,__createBinding:rT,__decorate:XC,__exportStar:nT,__extends:YC,__generator:tT,__importDefault:lT,__importStar:fT,__makeTemplateObject:uT,__metadata:QC,__param:ZC,__read:I2,__rest:JC,__spread:iT,__spreadArrays:sT,__values:Zg},Symbol.toStringTag,{value:"Module"})));var Qg={},Vf={},C2;function pT(){if(C2)return Vf;C2=1,Object.defineProperty(Vf,"__esModule",{value:!0}),Vf.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Vf.delay=t,Vf}var ja={},em={},qa={},T2;function gT(){return T2||(T2=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.ONE_THOUSAND=qa.ONE_HUNDRED=void 0,qa.ONE_HUNDRED=100,qa.ONE_THOUSAND=1e3),qa}var tm={},R2;function mT(){return R2||(R2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(tm)),tm}var D2;function O2(){return D2||(D2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Kf;e.__exportStar(gT(),t),e.__exportStar(mT(),t)}(em)),em}var N2;function vT(){if(N2)return ja;N2=1,Object.defineProperty(ja,"__esModule",{value:!0}),ja.fromMiliseconds=ja.toMiliseconds=void 0;const t=O2();function e(n){return n*t.ONE_THOUSAND}ja.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return ja.fromMiliseconds=r,ja}var L2;function bT(){return L2||(L2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Kf;e.__exportStar(pT(),t),e.__exportStar(vT(),t)}(Qg)),Qg}var ru={},k2;function yT(){if(k2)return ru;k2=1,Object.defineProperty(ru,"__esModule",{value:!0}),ru.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return ru.Watch=t,ru.default=t,ru}var rm={},Gf={},$2;function wT(){if($2)return Gf;$2=1,Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.IWatch=void 0;class t{}return Gf.IWatch=t,Gf}var B2;function xT(){return B2||(B2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Kf.__exportStar(wT(),t)}(rm)),rm}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Kf;e.__exportStar(bT(),t),e.__exportStar(yT(),t),e.__exportStar(xT(),t),e.__exportStar(O2(),t)})(mt);class za{}let _T=class extends za{constructor(e){super()}};const F2=mt.FIVE_SECONDS,nu={pulse:"heartbeat_pulse"};let ET=class $A extends _T{constructor(e){super(e),this.events=new qi.EventEmitter,this.interval=F2,this.interval=(e==null?void 0:e.interval)||F2}static async init(e){const r=new $A(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),mt.toMiliseconds(this.interval))}pulse(){this.events.emit(nu.pulse)}};const ST=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,AT=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,PT=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function MT(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){IT(t);return}return e}function IT(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Xh(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!PT.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(ST.test(t)||AT.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,MT)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function CT(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Cn(t,...e){try{return CT(t(...e))}catch(r){return Promise.reject(r)}}function TT(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function RT(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Zh(t){if(TT(t))return String(t);if(RT(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Zh(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function U2(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const nm="base64:";function DT(t){if(typeof t=="string")return t;U2();const e=Buffer.from(t).toString("base64");return nm+e}function OT(t){return typeof t!="string"||!t.startsWith(nm)?t:(U2(),Buffer.from(t.slice(nm.length),"base64"))}function pi(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function NT(...t){return pi(t.join(":"))}function Qh(t){return t=pi(t),t?t+":":""}function ooe(t){return t}const LT="memory",kT=()=>{const t=new Map;return{name:LT,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function $T(t={}){const e={mounts:{"":t.driver||kT()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const d of e.mountpoints)if(l.startsWith(d))return{base:d,relativeKey:l.slice(d.length),driver:e.mounts[d]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,d)=>e.mountpoints.filter(g=>g.startsWith(l)||d&&l.startsWith(g)).map(g=>({relativeBase:l.length>g.length?l.slice(g.length):void 0,mountpoint:g,driver:e.mounts[g]})),i=(l,d)=>{if(e.watching){d=pi(d);for(const g of e.watchListeners)g(l,d)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await j2(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,d,g)=>{const y=new Map,A=P=>{let N=y.get(P.base);return N||(N={driver:P.driver,base:P.base,items:[]},y.set(P.base,N)),N};for(const P of l){const N=typeof P=="string",D=pi(N?P:P.key),k=N?void 0:P.value,$=N||!P.options?d:{...d,...P.options},q=r(D);A(q).items.push({key:D,value:k,relativeKey:q.relativeKey,options:$})}return Promise.all([...y.values()].map(P=>g(P))).then(P=>P.flat())},u={hasItem(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return Cn(y.hasItem,g,d)},getItem(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return Cn(y.getItem,g,d).then(A=>Xh(A))},getItems(l,d){return a(l,d,g=>g.driver.getItems?Cn(g.driver.getItems,g.items.map(y=>({key:y.relativeKey,options:y.options})),d).then(y=>y.map(A=>({key:NT(g.base,A.key),value:Xh(A.value)}))):Promise.all(g.items.map(y=>Cn(g.driver.getItem,y.relativeKey,y.options).then(A=>({key:y.key,value:Xh(A)})))))},getItemRaw(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return y.getItemRaw?Cn(y.getItemRaw,g,d):Cn(y.getItem,g,d).then(A=>OT(A))},async setItem(l,d,g={}){if(d===void 0)return u.removeItem(l);l=pi(l);const{relativeKey:y,driver:A}=r(l);A.setItem&&(await Cn(A.setItem,y,Zh(d),g),A.watch||i("update",l))},async setItems(l,d){await a(l,d,async g=>{if(g.driver.setItems)return Cn(g.driver.setItems,g.items.map(y=>({key:y.relativeKey,value:Zh(y.value),options:y.options})),d);g.driver.setItem&&await Promise.all(g.items.map(y=>Cn(g.driver.setItem,y.relativeKey,Zh(y.value),y.options)))})},async setItemRaw(l,d,g={}){if(d===void 0)return u.removeItem(l,g);l=pi(l);const{relativeKey:y,driver:A}=r(l);if(A.setItemRaw)await Cn(A.setItemRaw,y,d,g);else if(A.setItem)await Cn(A.setItem,y,DT(d),g);else return;A.watch||i("update",l)},async removeItem(l,d={}){typeof d=="boolean"&&(d={removeMeta:d}),l=pi(l);const{relativeKey:g,driver:y}=r(l);y.removeItem&&(await Cn(y.removeItem,g,d),(d.removeMeta||d.removeMata)&&await Cn(y.removeItem,g+"$",d),y.watch||i("remove",l))},async getMeta(l,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),l=pi(l);const{relativeKey:g,driver:y}=r(l),A=Object.create(null);if(y.getMeta&&Object.assign(A,await Cn(y.getMeta,g,d)),!d.nativeOnly){const P=await Cn(y.getItem,g+"$",d).then(N=>Xh(N));P&&typeof P=="object"&&(typeof P.atime=="string"&&(P.atime=new Date(P.atime)),typeof P.mtime=="string"&&(P.mtime=new Date(P.mtime)),Object.assign(A,P))}return A},setMeta(l,d,g={}){return this.setItem(l+"$",d,g)},removeMeta(l,d={}){return this.removeItem(l+"$",d)},async getKeys(l,d={}){l=Qh(l);const g=n(l,!0);let y=[];const A=[];for(const P of g){const N=await Cn(P.driver.getKeys,P.relativeBase,d);for(const D of N){const k=P.mountpoint+pi(D);y.some($=>k.startsWith($))||A.push(k)}y=[P.mountpoint,...y.filter(D=>!D.startsWith(P.mountpoint))]}return l?A.filter(P=>P.startsWith(l)&&P[P.length-1]!=="$"):A.filter(P=>P[P.length-1]!=="$")},async clear(l,d={}){l=Qh(l),await Promise.all(n(l,!1).map(async g=>{if(g.driver.clear)return Cn(g.driver.clear,g.relativeBase,d);if(g.driver.removeItem){const y=await g.driver.getKeys(g.relativeBase||"",d);return Promise.all(y.map(A=>g.driver.removeItem(A,d)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>q2(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(d=>d!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,d){if(l=Qh(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((g,y)=>y.length-g.length)),e.mounts[l]=d,e.watching&&Promise.resolve(j2(d,i,l)).then(g=>{e.unwatch[l]=g}).catch(console.error),u},async unmount(l,d=!0){l=Qh(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),d&&await q2(e.mounts[l]),e.mountpoints=e.mountpoints.filter(g=>g!==l),delete e.mounts[l])},getMount(l=""){l=pi(l)+":";const d=r(l);return{driver:d.driver,base:d.base}},getMounts(l="",d={}){return l=pi(l),n(l,d.parents).map(y=>({driver:y.driver,base:y.mountpoint}))},keys:(l,d={})=>u.getKeys(l,d),get:(l,d={})=>u.getItem(l,d),set:(l,d,g={})=>u.setItem(l,d,g),has:(l,d={})=>u.hasItem(l,d),del:(l,d={})=>u.removeItem(l,d),remove:(l,d={})=>u.removeItem(l,d)};return u}function j2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function q2(t){typeof t.dispose=="function"&&await Cn(t.dispose)}function Ha(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function z2(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Ha(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let im;function Yf(){return im||(im=z2("keyval-store","keyval")),im}function H2(t,e=Yf()){return e("readonly",r=>Ha(r.get(t)))}function BT(t,e,r=Yf()){return r("readwrite",n=>(n.put(e,t),Ha(n.transaction)))}function FT(t,e=Yf()){return e("readwrite",r=>(r.delete(t),Ha(r.transaction)))}function UT(t=Yf()){return t("readwrite",e=>(e.clear(),Ha(e.transaction)))}function jT(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Ha(t.transaction)}function qT(t=Yf()){return t("readonly",e=>{if(e.getAllKeys)return Ha(e.getAllKeys());const r=[];return jT(e,n=>r.push(n.key)).then(()=>r)})}const zT=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),HT=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Wa(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return HT(t)}catch{return t}}function go(t){return typeof t=="string"?t:zT(t)||""}const WT="idb-keyval";var KT=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=z2(t.dbName,t.storeName)),{name:WT,options:t,async hasItem(i){return!(typeof await H2(r(i),n)>"u")},async getItem(i){return await H2(r(i),n)??null},setItem(i,s){return BT(r(i),s,n)},removeItem(i){return FT(r(i),n)},getKeys(){return qT(n)},clear(){return UT(n)}}};const VT="WALLET_CONNECT_V2_INDEXED_DB",GT="keyvaluestorage";let YT=class{constructor(){this.indexedDb=$T({driver:KT({dbName:VT,storeName:GT})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,go(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var sm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ed={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof sm<"u"&&sm.localStorage?ed.exports=sm.localStorage:typeof window<"u"&&window.localStorage?ed.exports=window.localStorage:ed.exports=new e})();function JT(t){var e;return[t[0],Wa((e=t[1])!=null?e:"")]}let XT=class{constructor(){this.localStorage=ed.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(JT)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Wa(r)}async setItem(e,r){this.localStorage.setItem(e,go(r))}async removeItem(e){this.localStorage.removeItem(e)}};const ZT="wc_storage_version",W2=1,QT=async(t,e,r)=>{const n=ZT,i=await e.getItem(n);if(i&&i>=W2){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,W2),r(e),eR(t,o)},eR=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let tR=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new XT;this.storage=e;try{const r=new YT;QT(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function rR(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var nR=iR;function iR(t,e,r){var n=r&&r.stringify||rR,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?g:0,t.charCodeAt(A+1)){case 100:case 102:if(d>=u||e[d]==null)break;g=u||e[d]==null)break;g=u||e[d]===void 0)break;g",g=A+2,A++;break}l+=n(e[d]),g=A+2,A++;break;case 115:if(d>=u)break;g-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",u=Object.create(r);u.log||(u.log=Xf),Object.defineProperty(u,"levelVal",{get:d}),Object.defineProperty(u,"level",{get:g,set:y});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:lR(t)};u.levels=mo.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Xf,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=A,e&&(u._logEvent=om());function d(){return this.level==="silent"?1/0:this.levels.values[this.level]}function g(){return this._level}function y(P){if(P!=="silent"&&!this.levels.values[P])throw Error("unknown level "+P);this._level=P,su(l,u,"error","log"),su(l,u,"fatal","error"),su(l,u,"warn","error"),su(l,u,"info","log"),su(l,u,"debug","log"),su(l,u,"trace","log")}function A(P,N){if(!P)throw new Error("missing bindings for child Pino");N=N||{},i&&P.serializers&&(N.serializers=P.serializers);const D=N.serializers;if(i&&D){var k=Object.assign({},n,D),$=t.browser.serialize===!0?Object.keys(k):i;delete P.serializers,td([P],$,k,this._stdErrSerialize)}function q(U){this._childLevel=(U._childLevel|0)+1,this.error=ou(U,P,"error"),this.fatal=ou(U,P,"fatal"),this.warn=ou(U,P,"warn"),this.info=ou(U,P,"info"),this.debug=ou(U,P,"debug"),this.trace=ou(U,P,"trace"),k&&(this.serializers=k,this._serialize=$),e&&(this._logEvent=om([].concat(U._logEvent.bindings,P)))}return q.prototype=this,new q(this)}return u}mo.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},mo.stdSerializers=sR,mo.stdTimeFunctions=Object.assign({},{nullTime:V2,epochTime:G2,unixTime:hR,isoTime:dR});function su(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Xf:i[r]?i[r]:Jf[r]||Jf[n]||Xf,aR(t,e,r)}function aR(t,e,r){!t.transmit&&e[r]===Xf||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Jf?Jf:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function ou(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},J2=class{constructor(e,r=cm){this.level=e??"error",this.levelValue=iu.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Y2(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===iu.levels.values.error?console.error(e):r===iu.levels.values.warn?console.warn(e):r===iu.levels.values.debug?console.debug(e):r===iu.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(go({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new Y2(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(go({extraMetadata:e})),new Blob(r,{type:"application/json"})}},vR=class{constructor(e,r=cm){this.baseChunkLogger=new J2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},bR=class{constructor(e,r=cm){this.baseChunkLogger=new J2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var yR=Object.defineProperty,wR=Object.defineProperties,xR=Object.getOwnPropertyDescriptors,X2=Object.getOwnPropertySymbols,_R=Object.prototype.hasOwnProperty,ER=Object.prototype.propertyIsEnumerable,Z2=(t,e,r)=>e in t?yR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nd=(t,e)=>{for(var r in e||(e={}))_R.call(e,r)&&Z2(t,r,e[r]);if(X2)for(var r of X2(e))ER.call(e,r)&&Z2(t,r,e[r]);return t},id=(t,e)=>wR(t,xR(e));function sd(t){return id(nd({},t),{level:(t==null?void 0:t.level)||gR.level})}function SR(t,e=Qf){return t[e]||""}function AR(t,e,r=Qf){return t[r]=e,t}function gi(t,e=Qf){let r="";return typeof t.bindings>"u"?r=SR(t,e):r=t.bindings().context||"",r}function PR(t,e,r=Qf){const n=gi(t,r);return n.trim()?`${n}/${e}`:e}function ri(t,e,r=Qf){const n=PR(t,e,r),i=t.child({context:n});return AR(i,n,r)}function MR(t){var e,r;const n=new vR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Zf(id(nd({},t.opts),{level:"trace",browser:id(nd({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function IR(t){var e;const r=new bR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Zf(id(nd({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function CR(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?MR(t):IR(t)}let TR=class extends za{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},RR=class extends za{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},DR=class{constructor(e,r){this.logger=e,this.core=r}},OR=class extends za{constructor(e,r){super(),this.relayer=e,this.logger=r}},NR=class extends za{constructor(e){super()}},LR=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},kR=class extends za{constructor(e,r){super(),this.relayer=e,this.logger=r}},$R=class extends za{constructor(e,r){super(),this.core=e,this.logger=r}},BR=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},FR=class{constructor(e,r){this.projectId=e,this.logger=r}},UR=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},jR=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},qR=class{constructor(e){this.client=e}};var um={},ea={},od={},ad={};Object.defineProperty(ad,"__esModule",{value:!0}),ad.BrowserRandomSource=void 0;const Q2=65536;class zR{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let n=0;n>>16&65535,d=a&65535,g=u>>>16&65535,y=u&65535;return d*y+(l*y+d*g<<16>>>0)|0}t.mul=Math.imul||e;function r(a,u){return a+u|0}t.add=r;function n(a,u){return a-u|0}t.sub=n;function i(a,u){return a<>>32-u}t.rotl=i;function s(a,u){return a<<32-u|a>>>u}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(tx),Object.defineProperty(or,"__esModule",{value:!0});var rx=tx;function JR(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}or.readInt16BE=JR;function XR(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}or.readUint16BE=XR;function ZR(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}or.readInt16LE=ZR;function QR(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}or.readUint16LE=QR;function nx(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}or.writeUint16BE=nx,or.writeInt16BE=nx;function ix(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}or.writeUint16LE=ix,or.writeInt16LE=ix;function fm(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}or.readInt32BE=fm;function lm(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}or.readUint32BE=lm;function hm(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}or.readInt32LE=hm;function dm(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}or.readUint32LE=dm;function ud(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}or.writeUint32BE=ud,or.writeInt32BE=ud;function fd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}or.writeUint32LE=fd,or.writeInt32LE=fd;function eD(t,e){e===void 0&&(e=0);var r=fm(t,e),n=fm(t,e+4);return r*4294967296+n-(n>>31)*4294967296}or.readInt64BE=eD;function tD(t,e){e===void 0&&(e=0);var r=lm(t,e),n=lm(t,e+4);return r*4294967296+n}or.readUint64BE=tD;function rD(t,e){e===void 0&&(e=0);var r=hm(t,e),n=hm(t,e+4);return n*4294967296+r-(r>>31)*4294967296}or.readInt64LE=rD;function nD(t,e){e===void 0&&(e=0);var r=dm(t,e),n=dm(t,e+4);return n*4294967296+r}or.readUint64LE=nD;function sx(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ud(t/4294967296>>>0,e,r),ud(t>>>0,e,r+4),e}or.writeUint64BE=sx,or.writeInt64BE=sx;function ox(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fd(t>>>0,e,r),fd(t/4294967296>>>0,e,r+4),e}or.writeUint64LE=ox,or.writeInt64LE=ox;function iD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}or.readUintBE=iD;function sD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}or.writeUintBE=oD;function aD(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!rx.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s256)throw new Error("randomString charset is too long");let y="";const A=d.length,P=256-256%A;for(;l>0;){const N=i(Math.ceil(l*256/P),g);for(let D=0;D0;D++){const k=N[D];k0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,g=l/536870912|0,y=l<<3,A=l%128<112?128:256;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._stateHi.set(u.stateHi),this._stateLo.set(u.stateLo),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.stateHi),r.wipe(u.stateLo),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,u,l,d,g,y,A){for(var P=l[0],N=l[1],D=l[2],k=l[3],$=l[4],q=l[5],U=l[6],K=l[7],J=d[0],T=d[1],z=d[2],ue=d[3],_e=d[4],G=d[5],E=d[6],m=d[7],f,p,v,x,_,S,b,M;A>=128;){for(var I=0;I<16;I++){var F=8*I+y;a[I]=e.readUint32BE(g,F),u[I]=e.readUint32BE(g,F+4)}for(var I=0;I<80;I++){var ae=P,O=N,se=D,ee=k,X=$,Q=q,R=U,Z=K,te=J,le=T,ie=z,fe=ue,ve=_e,Me=G,Ne=E,Te=m;if(f=K,p=m,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=($>>>14|_e<<18)^($>>>18|_e<<14)^(_e>>>9|$<<23),p=(_e>>>14|$<<18)^(_e>>>18|$<<14)^($>>>9|_e<<23),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=$&q^~$&U,p=_e&G^~_e&E,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=i[I*2],p=i[I*2+1],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=a[I%16],p=u[I%16],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,v=b&65535|M<<16,x=_&65535|S<<16,f=v,p=x,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=(P>>>28|J<<4)^(J>>>2|P<<30)^(J>>>7|P<<25),p=(J>>>28|P<<4)^(P>>>2|J<<30)^(P>>>7|J<<25),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=P&N^P&D^N&D,p=J&T^J&z^T&z,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,Z=b&65535|M<<16,Te=_&65535|S<<16,f=ee,p=fe,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=v,p=x,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,ee=b&65535|M<<16,fe=_&65535|S<<16,N=ae,D=O,k=se,$=ee,q=X,U=Q,K=R,P=Z,T=te,z=le,ue=ie,_e=fe,G=ve,E=Me,m=Ne,J=Te,I%16===15)for(var F=0;F<16;F++)f=a[F],p=u[F],_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=a[(F+9)%16],p=u[(F+9)%16],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,v=a[(F+1)%16],x=u[(F+1)%16],f=(v>>>1|x<<31)^(v>>>8|x<<24)^v>>>7,p=(x>>>1|v<<31)^(x>>>8|v<<24)^(x>>>7|v<<25),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,v=a[(F+14)%16],x=u[(F+14)%16],f=(v>>>19|x<<13)^(x>>>29|v<<3)^v>>>6,p=(x>>>19|v<<13)^(v>>>29|x<<3)^(x>>>6|v<<26),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,a[F]=b&65535|M<<16,u[F]=_&65535|S<<16}f=P,p=J,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[0],p=d[0],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[0]=P=b&65535|M<<16,d[0]=J=_&65535|S<<16,f=N,p=T,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[1],p=d[1],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[1]=N=b&65535|M<<16,d[1]=T=_&65535|S<<16,f=D,p=z,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[2],p=d[2],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[2]=D=b&65535|M<<16,d[2]=z=_&65535|S<<16,f=k,p=ue,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[3],p=d[3],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[3]=k=b&65535|M<<16,d[3]=ue=_&65535|S<<16,f=$,p=_e,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[4],p=d[4],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[4]=$=b&65535|M<<16,d[4]=_e=_&65535|S<<16,f=q,p=G,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[5],p=d[5],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[5]=q=b&65535|M<<16,d[5]=G=_&65535|S<<16,f=U,p=E,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[6],p=d[6],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[6]=U=b&65535|M<<16,d[6]=E=_&65535|S<<16,f=K,p=m,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[7],p=d[7],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[7]=K=b&65535|M<<16,d[7]=m=_&65535|S<<16,y+=128,A-=128}return y}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ax),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=ea,r=ax,n=Mi;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(ee){const X=new Float64Array(16);if(ee)for(let Q=0;Q>16&1),Q[le-1]&=65535;Q[15]=R[15]-32767-(Q[14]>>16&1);const te=Q[15]>>16&1;Q[14]&=65535,N(R,Q,1-te)}for(let Z=0;Z<16;Z++)ee[2*Z]=R[Z]&255,ee[2*Z+1]=R[Z]>>8}function k(ee,X){let Q=0;for(let R=0;R<32;R++)Q|=ee[R]^X[R];return(1&Q-1>>>8)-1}function $(ee,X){const Q=new Uint8Array(32),R=new Uint8Array(32);return D(Q,ee),D(R,X),k(Q,R)}function q(ee){const X=new Uint8Array(32);return D(X,ee),X[0]&1}function U(ee,X){for(let Q=0;Q<16;Q++)ee[Q]=X[2*Q]+(X[2*Q+1]<<8);ee[15]&=32767}function K(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]+Q[R]}function J(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]-Q[R]}function T(ee,X,Q){let R,Z,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,Be=0,Ie=0,Le=0,Ve=0,ke=0,ze=0,He=0,Ee=0,Qe=0,ct=0,$e=0,et=0,rt=0,Je=0,pt=0,ht=0,ft=0,Ht=0,Jt=0,St=0,er=0,Xt=0,Ot=0,$t=Q[0],Tt=Q[1],vt=Q[2],Dt=Q[3],Lt=Q[4],bt=Q[5],Bt=Q[6],Ut=Q[7],nt=Q[8],Ft=Q[9],B=Q[10],H=Q[11],V=Q[12],C=Q[13],Y=Q[14],j=Q[15];R=X[0],te+=R*$t,le+=R*Tt,ie+=R*vt,fe+=R*Dt,ve+=R*Lt,Me+=R*bt,Ne+=R*Bt,Te+=R*Ut,Be+=R*nt,Ie+=R*Ft,Le+=R*B,Ve+=R*H,ke+=R*V,ze+=R*C,He+=R*Y,Ee+=R*j,R=X[1],le+=R*$t,ie+=R*Tt,fe+=R*vt,ve+=R*Dt,Me+=R*Lt,Ne+=R*bt,Te+=R*Bt,Be+=R*Ut,Ie+=R*nt,Le+=R*Ft,Ve+=R*B,ke+=R*H,ze+=R*V,He+=R*C,Ee+=R*Y,Qe+=R*j,R=X[2],ie+=R*$t,fe+=R*Tt,ve+=R*vt,Me+=R*Dt,Ne+=R*Lt,Te+=R*bt,Be+=R*Bt,Ie+=R*Ut,Le+=R*nt,Ve+=R*Ft,ke+=R*B,ze+=R*H,He+=R*V,Ee+=R*C,Qe+=R*Y,ct+=R*j,R=X[3],fe+=R*$t,ve+=R*Tt,Me+=R*vt,Ne+=R*Dt,Te+=R*Lt,Be+=R*bt,Ie+=R*Bt,Le+=R*Ut,Ve+=R*nt,ke+=R*Ft,ze+=R*B,He+=R*H,Ee+=R*V,Qe+=R*C,ct+=R*Y,$e+=R*j,R=X[4],ve+=R*$t,Me+=R*Tt,Ne+=R*vt,Te+=R*Dt,Be+=R*Lt,Ie+=R*bt,Le+=R*Bt,Ve+=R*Ut,ke+=R*nt,ze+=R*Ft,He+=R*B,Ee+=R*H,Qe+=R*V,ct+=R*C,$e+=R*Y,et+=R*j,R=X[5],Me+=R*$t,Ne+=R*Tt,Te+=R*vt,Be+=R*Dt,Ie+=R*Lt,Le+=R*bt,Ve+=R*Bt,ke+=R*Ut,ze+=R*nt,He+=R*Ft,Ee+=R*B,Qe+=R*H,ct+=R*V,$e+=R*C,et+=R*Y,rt+=R*j,R=X[6],Ne+=R*$t,Te+=R*Tt,Be+=R*vt,Ie+=R*Dt,Le+=R*Lt,Ve+=R*bt,ke+=R*Bt,ze+=R*Ut,He+=R*nt,Ee+=R*Ft,Qe+=R*B,ct+=R*H,$e+=R*V,et+=R*C,rt+=R*Y,Je+=R*j,R=X[7],Te+=R*$t,Be+=R*Tt,Ie+=R*vt,Le+=R*Dt,Ve+=R*Lt,ke+=R*bt,ze+=R*Bt,He+=R*Ut,Ee+=R*nt,Qe+=R*Ft,ct+=R*B,$e+=R*H,et+=R*V,rt+=R*C,Je+=R*Y,pt+=R*j,R=X[8],Be+=R*$t,Ie+=R*Tt,Le+=R*vt,Ve+=R*Dt,ke+=R*Lt,ze+=R*bt,He+=R*Bt,Ee+=R*Ut,Qe+=R*nt,ct+=R*Ft,$e+=R*B,et+=R*H,rt+=R*V,Je+=R*C,pt+=R*Y,ht+=R*j,R=X[9],Ie+=R*$t,Le+=R*Tt,Ve+=R*vt,ke+=R*Dt,ze+=R*Lt,He+=R*bt,Ee+=R*Bt,Qe+=R*Ut,ct+=R*nt,$e+=R*Ft,et+=R*B,rt+=R*H,Je+=R*V,pt+=R*C,ht+=R*Y,ft+=R*j,R=X[10],Le+=R*$t,Ve+=R*Tt,ke+=R*vt,ze+=R*Dt,He+=R*Lt,Ee+=R*bt,Qe+=R*Bt,ct+=R*Ut,$e+=R*nt,et+=R*Ft,rt+=R*B,Je+=R*H,pt+=R*V,ht+=R*C,ft+=R*Y,Ht+=R*j,R=X[11],Ve+=R*$t,ke+=R*Tt,ze+=R*vt,He+=R*Dt,Ee+=R*Lt,Qe+=R*bt,ct+=R*Bt,$e+=R*Ut,et+=R*nt,rt+=R*Ft,Je+=R*B,pt+=R*H,ht+=R*V,ft+=R*C,Ht+=R*Y,Jt+=R*j,R=X[12],ke+=R*$t,ze+=R*Tt,He+=R*vt,Ee+=R*Dt,Qe+=R*Lt,ct+=R*bt,$e+=R*Bt,et+=R*Ut,rt+=R*nt,Je+=R*Ft,pt+=R*B,ht+=R*H,ft+=R*V,Ht+=R*C,Jt+=R*Y,St+=R*j,R=X[13],ze+=R*$t,He+=R*Tt,Ee+=R*vt,Qe+=R*Dt,ct+=R*Lt,$e+=R*bt,et+=R*Bt,rt+=R*Ut,Je+=R*nt,pt+=R*Ft,ht+=R*B,ft+=R*H,Ht+=R*V,Jt+=R*C,St+=R*Y,er+=R*j,R=X[14],He+=R*$t,Ee+=R*Tt,Qe+=R*vt,ct+=R*Dt,$e+=R*Lt,et+=R*bt,rt+=R*Bt,Je+=R*Ut,pt+=R*nt,ht+=R*Ft,ft+=R*B,Ht+=R*H,Jt+=R*V,St+=R*C,er+=R*Y,Xt+=R*j,R=X[15],Ee+=R*$t,Qe+=R*Tt,ct+=R*vt,$e+=R*Dt,et+=R*Lt,rt+=R*bt,Je+=R*Bt,pt+=R*Ut,ht+=R*nt,ft+=R*Ft,Ht+=R*B,Jt+=R*H,St+=R*V,er+=R*C,Xt+=R*Y,Ot+=R*j,te+=38*Qe,le+=38*ct,ie+=38*$e,fe+=38*et,ve+=38*rt,Me+=38*Je,Ne+=38*pt,Te+=38*ht,Be+=38*ft,Ie+=38*Ht,Le+=38*Jt,Ve+=38*St,ke+=38*er,ze+=38*Xt,He+=38*Ot,Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=Be+Z+65535,Z=Math.floor(R/65536),Be=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=Be+Z+65535,Z=Math.floor(R/65536),Be=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),ee[0]=te,ee[1]=le,ee[2]=ie,ee[3]=fe,ee[4]=ve,ee[5]=Me,ee[6]=Ne,ee[7]=Te,ee[8]=Be,ee[9]=Ie,ee[10]=Le,ee[11]=Ve,ee[12]=ke,ee[13]=ze,ee[14]=He,ee[15]=Ee}function z(ee,X){T(ee,X,X)}function ue(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=253;R>=0;R--)z(Q,Q),R!==2&&R!==4&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function _e(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=250;R>=0;R--)z(Q,Q),R!==1&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function G(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i(),ve=i(),Me=i();J(Q,ee[1],ee[0]),J(Me,X[1],X[0]),T(Q,Q,Me),K(R,ee[0],ee[1]),K(Me,X[0],X[1]),T(R,R,Me),T(Z,ee[3],X[3]),T(Z,Z,l),T(te,ee[2],X[2]),K(te,te,te),J(le,R,Q),J(ie,te,Z),K(fe,te,Z),K(ve,R,Q),T(ee[0],le,ie),T(ee[1],ve,fe),T(ee[2],fe,ie),T(ee[3],le,ve)}function E(ee,X,Q){for(let R=0;R<4;R++)N(ee[R],X[R],Q)}function m(ee,X){const Q=i(),R=i(),Z=i();ue(Z,X[2]),T(Q,X[0],Z),T(R,X[1],Z),D(ee,R),ee[31]^=q(Q)<<7}function f(ee,X,Q){A(ee[0],o),A(ee[1],a),A(ee[2],a),A(ee[3],o);for(let R=255;R>=0;--R){const Z=Q[R/8|0]>>(R&7)&1;E(ee,X,Z),G(X,ee),G(ee,ee),E(ee,X,Z)}}function p(ee,X){const Q=[i(),i(),i(),i()];A(Q[0],d),A(Q[1],g),A(Q[2],a),T(Q[3],d,g),f(ee,Q,X)}function v(ee){if(ee.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const X=(0,r.hash)(ee);X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(32),R=[i(),i(),i(),i()];p(R,X),m(Q,R);const Z=new Uint8Array(64);return Z.set(ee),Z.set(Q,32),{publicKey:Q,secretKey:Z}}t.generateKeyPairFromSeed=v;function x(ee){const X=(0,e.randomBytes)(32,ee),Q=v(X);return(0,n.wipe)(X),Q}t.generateKeyPair=x;function _(ee){if(ee.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(ee.subarray(32))}t.extractPublicKeyFromSecretKey=_;const S=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function b(ee,X){let Q,R,Z,te;for(R=63;R>=32;--R){for(Q=0,Z=R-32,te=R-12;Z>4)*S[Z],Q=X[Z]>>8,X[Z]&=255;for(Z=0;Z<32;Z++)X[Z]-=Q*S[Z];for(R=0;R<32;R++)X[R+1]+=X[R]>>8,ee[R]=X[R]&255}function M(ee){const X=new Float64Array(64);for(let Q=0;Q<64;Q++)X[Q]=ee[Q];for(let Q=0;Q<64;Q++)ee[Q]=0;b(ee,X)}function I(ee,X){const Q=new Float64Array(64),R=[i(),i(),i(),i()],Z=(0,r.hash)(ee.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(64);te.set(Z.subarray(32),32);const le=new r.SHA512;le.update(te.subarray(32)),le.update(X);const ie=le.digest();le.clean(),M(ie),p(R,ie),m(te,R),le.reset(),le.update(te.subarray(0,32)),le.update(ee.subarray(32)),le.update(X);const fe=le.digest();M(fe);for(let ve=0;ve<32;ve++)Q[ve]=ie[ve];for(let ve=0;ve<32;ve++)for(let Me=0;Me<32;Me++)Q[ve+Me]+=fe[ve]*Z[Me];return b(te.subarray(32),Q),te}t.sign=I;function F(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i();return A(ee[2],a),U(ee[1],X),z(Z,ee[1]),T(te,Z,u),J(Z,Z,ee[2]),K(te,ee[2],te),z(le,te),z(ie,le),T(fe,ie,le),T(Q,fe,Z),T(Q,Q,te),_e(Q,Q),T(Q,Q,Z),T(Q,Q,te),T(Q,Q,te),T(ee[0],Q,te),z(R,ee[0]),T(R,R,te),$(R,Z)&&T(ee[0],ee[0],y),z(R,ee[0]),T(R,R,te),$(R,Z)?-1:(q(ee[0])===X[31]>>7&&J(ee[0],o,ee[0]),T(ee[3],ee[0],ee[1]),0)}function ae(ee,X,Q){const R=new Uint8Array(32),Z=[i(),i(),i(),i()],te=[i(),i(),i(),i()];if(Q.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(F(te,ee))return!1;const le=new r.SHA512;le.update(Q.subarray(0,32)),le.update(ee),le.update(X);const ie=le.digest();return M(ie),f(Z,te,ie),p(te,Q.subarray(32)),G(Z,te),m(R,Z),!k(Q,R)}t.verify=ae;function O(ee){let X=[i(),i(),i(),i()];if(F(X,ee))throw new Error("Ed25519: invalid public key");let Q=i(),R=i(),Z=X[1];K(Q,a,Z),J(R,a,Z),ue(R,R),T(Q,Q,R);let te=new Uint8Array(32);return D(te,Q),te}t.convertPublicKeyToX25519=O;function se(ee){const X=(0,r.hash)(ee.subarray(0,32));X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(X.subarray(0,32));return(0,n.wipe)(X),Q}t.convertSecretKeyToX25519=se}(um);const mD="EdDSA",vD="JWT",ld=".",hd="base64url",cx="utf8",ux="utf8",bD=":",yD="did",wD="key",fx="base58btc",xD="z",_D="K36",ED=32;function lx(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function dd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=lx(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function SD(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(q);k!==$;){for(var K=P[k],J=0,T=q-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=q-D;z!==q&&U[z]===0;)z++;for(var ue=u.repeat(N);z>>0,q=new Uint8Array($);P[N];){var U=r[P.charCodeAt(N)];if(U===255)return;for(var K=0,J=$-1;(U!==0||K>>0,q[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,N++}if(P[N]!==" "){for(var T=$-k;T!==$&&q[T]===0;)T++;for(var z=new Uint8Array(D+($-T)),ue=D;T!==$;)z[ue++]=q[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:g,decodeUnsafe:y,decode:A}}var AD=SD,PD=AD;const MD=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},ID=t=>new TextEncoder().encode(t),CD=t=>new TextDecoder().decode(t);class TD{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class RD{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return hx(this,e)}}class DD{constructor(e){this.decoders=e}or(e){return hx(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const hx=(t,e)=>new DD({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class OD{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new TD(e,r,n),this.decoder=new RD(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const pd=({name:t,prefix:e,encode:r,decode:n})=>new OD(t,e,r,n),tl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=PD(r,e);return pd({prefix:t,name:e,encode:n,decode:s=>MD(i(s))})},ND=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},LD=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<pd({prefix:e,name:t,encode(i){return LD(i,n,r)},decode(i){return ND(i,n,r,t)}}),kD=pd({prefix:"\0",name:"identity",encode:t=>CD(t),decode:t=>ID(t)}),$D=Object.freeze(Object.defineProperty({__proto__:null,identity:kD},Symbol.toStringTag,{value:"Module"})),BD=Fn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),FD=Object.freeze(Object.defineProperty({__proto__:null,base2:BD},Symbol.toStringTag,{value:"Module"})),UD=Fn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),jD=Object.freeze(Object.defineProperty({__proto__:null,base8:UD},Symbol.toStringTag,{value:"Module"})),qD=tl({prefix:"9",name:"base10",alphabet:"0123456789"}),zD=Object.freeze(Object.defineProperty({__proto__:null,base10:qD},Symbol.toStringTag,{value:"Module"})),HD=Fn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),WD=Fn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),KD=Object.freeze(Object.defineProperty({__proto__:null,base16:HD,base16upper:WD},Symbol.toStringTag,{value:"Module"})),VD=Fn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),GD=Fn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),YD=Fn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),JD=Fn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),XD=Fn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ZD=Fn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),QD=Fn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),eO=Fn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),tO=Fn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),rO=Object.freeze(Object.defineProperty({__proto__:null,base32:VD,base32hex:XD,base32hexpad:QD,base32hexpadupper:eO,base32hexupper:ZD,base32pad:YD,base32padupper:JD,base32upper:GD,base32z:tO},Symbol.toStringTag,{value:"Module"})),nO=tl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),iO=tl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),sO=Object.freeze(Object.defineProperty({__proto__:null,base36:nO,base36upper:iO},Symbol.toStringTag,{value:"Module"})),oO=tl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),aO=tl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),cO=Object.freeze(Object.defineProperty({__proto__:null,base58btc:oO,base58flickr:aO},Symbol.toStringTag,{value:"Module"})),uO=Fn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),fO=Fn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),lO=Fn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),hO=Fn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),dO=Object.freeze(Object.defineProperty({__proto__:null,base64:uO,base64pad:fO,base64url:lO,base64urlpad:hO},Symbol.toStringTag,{value:"Module"})),dx=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),pO=dx.reduce((t,e,r)=>(t[r]=e,t),[]),gO=dx.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function mO(t){return t.reduce((e,r)=>(e+=pO[r],e),"")}function vO(t){const e=[];for(const r of t){const n=gO[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const bO=pd({prefix:"🚀",name:"base256emoji",encode:mO,decode:vO}),yO=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:bO},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const px={...$D,...FD,...jD,...zD,...KD,...rO,...sO,...cO,...dO,...yO};function gx(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const mx=gx("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),pm=gx("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=lx(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new CO:typeof navigator<"u"?LO(navigator.userAgent):$O()}function NO(t){return t!==""&&DO.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function LO(t){var e=NO(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new IO;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<_x&&(i=xx(xx([],i,!0),BO(_x-i.length),!0)):i=[];var s=i.join("."),o=kO(t),a=RO.exec(t);return a&&a[1]?new MO(r,s,o,a[1]):new AO(r,s,o)}function kO(t){for(var e=0,r=Ex.length;e-1){const D=P.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let k=e.protocol+"//"+e.host;if(D.indexOf("/")===0)k+=D;else{const $=e.pathname.split("/");$.pop();const q=$.join("/");k+=q+"/"+D}y.push(k)}else if(D.indexOf("//")===0){const k=e.protocol+D;y.push(k)}else y.push(D)}}return y}function n(...g){const y=t.getElementsByTagName("meta");for(let A=0;AP.getAttribute(D)).filter(D=>D?g.includes(D):!1);if(N.length&&N){const D=P.getAttribute("content");if(D)return D}}return""}function i(){let g=n("name","og:site_name","og:title","twitter:title");return g||(g=t.title),g}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}Ax=vm.getWindowMetadata=YO;var nl={},JO=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Mx="%[a-f0-9]{2}",Ix=new RegExp("("+Mx+")|([^%]+?)","gi"),Cx=new RegExp("("+Mx+")+","gi");function bm(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],bm(r),bm(n))}function XO(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(Ix)||[],r=1;r{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},tN=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s$==null,o=Symbol("encodeFragmentIdentifier");function a($){switch($.arrayFormat){case"index":return q=>(U,K)=>{const J=U.length;return K===void 0||$.skipNull&&K===null||$.skipEmptyString&&K===""?U:K===null?[...U,[d(q,$),"[",J,"]"].join("")]:[...U,[d(q,$),"[",d(J,$),"]=",d(K,$)].join("")]};case"bracket":return q=>(U,K)=>K===void 0||$.skipNull&&K===null||$.skipEmptyString&&K===""?U:K===null?[...U,[d(q,$),"[]"].join("")]:[...U,[d(q,$),"[]=",d(K,$)].join("")];case"colon-list-separator":return q=>(U,K)=>K===void 0||$.skipNull&&K===null||$.skipEmptyString&&K===""?U:K===null?[...U,[d(q,$),":list="].join("")]:[...U,[d(q,$),":list=",d(K,$)].join("")];case"comma":case"separator":case"bracket-separator":{const q=$.arrayFormat==="bracket-separator"?"[]=":"=";return U=>(K,J)=>J===void 0||$.skipNull&&J===null||$.skipEmptyString&&J===""?K:(J=J===null?"":J,K.length===0?[[d(U,$),q,d(J,$)].join("")]:[[K,d(J,$)].join($.arrayFormatSeparator)])}default:return q=>(U,K)=>K===void 0||$.skipNull&&K===null||$.skipEmptyString&&K===""?U:K===null?[...U,d(q,$)]:[...U,[d(q,$),"=",d(K,$)].join("")]}}function u($){let q;switch($.arrayFormat){case"index":return(U,K,J)=>{if(q=/\[(\d*)\]$/.exec(U),U=U.replace(/\[\d*\]$/,""),!q){J[U]=K;return}J[U]===void 0&&(J[U]={}),J[U][q[1]]=K};case"bracket":return(U,K,J)=>{if(q=/(\[\])$/.exec(U),U=U.replace(/\[\]$/,""),!q){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"colon-list-separator":return(U,K,J)=>{if(q=/(:list)$/.exec(U),U=U.replace(/:list$/,""),!q){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"comma":case"separator":return(U,K,J)=>{const T=typeof K=="string"&&K.includes($.arrayFormatSeparator),z=typeof K=="string"&&!T&&g(K,$).includes($.arrayFormatSeparator);K=z?g(K,$):K;const ue=T||z?K.split($.arrayFormatSeparator).map(_e=>g(_e,$)):K===null?K:g(K,$);J[U]=ue};case"bracket-separator":return(U,K,J)=>{const T=/(\[\])$/.test(U);if(U=U.replace(/\[\]$/,""),!T){J[U]=K&&g(K,$);return}const z=K===null?[]:K.split($.arrayFormatSeparator).map(ue=>g(ue,$));if(J[U]===void 0){J[U]=z;return}J[U]=[].concat(J[U],z)};default:return(U,K,J)=>{if(J[U]===void 0){J[U]=K;return}J[U]=[].concat(J[U],K)}}}function l($){if(typeof $!="string"||$.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function d($,q){return q.encode?q.strict?e($):encodeURIComponent($):$}function g($,q){return q.decode?r($):$}function y($){return Array.isArray($)?$.sort():typeof $=="object"?y(Object.keys($)).sort((q,U)=>Number(q)-Number(U)).map(q=>$[q]):$}function A($){const q=$.indexOf("#");return q!==-1&&($=$.slice(0,q)),$}function P($){let q="";const U=$.indexOf("#");return U!==-1&&(q=$.slice(U)),q}function N($){$=A($);const q=$.indexOf("?");return q===-1?"":$.slice(q+1)}function D($,q){return q.parseNumbers&&!Number.isNaN(Number($))&&typeof $=="string"&&$.trim()!==""?$=Number($):q.parseBooleans&&$!==null&&($.toLowerCase()==="true"||$.toLowerCase()==="false")&&($=$.toLowerCase()==="true"),$}function k($,q){q=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},q),l(q.arrayFormatSeparator);const U=u(q),K=Object.create(null);if(typeof $!="string"||($=$.trim().replace(/^[?#&]/,""),!$))return K;for(const J of $.split("&")){if(J==="")continue;let[T,z]=n(q.decode?J.replace(/\+/g," "):J,"=");z=z===void 0?null:["comma","separator","bracket-separator"].includes(q.arrayFormat)?z:g(z,q),U(g(T,q),z,K)}for(const J of Object.keys(K)){const T=K[J];if(typeof T=="object"&&T!==null)for(const z of Object.keys(T))T[z]=D(T[z],q);else K[J]=D(T,q)}return q.sort===!1?K:(q.sort===!0?Object.keys(K).sort():Object.keys(K).sort(q.sort)).reduce((J,T)=>{const z=K[T];return z&&typeof z=="object"&&!Array.isArray(z)?J[T]=y(z):J[T]=z,J},Object.create(null))}t.extract=N,t.parse=k,t.stringify=($,q)=>{if(!$)return"";q=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},q),l(q.arrayFormatSeparator);const U=z=>q.skipNull&&s($[z])||q.skipEmptyString&&$[z]==="",K=a(q),J={};for(const z of Object.keys($))U(z)||(J[z]=$[z]);const T=Object.keys(J);return q.sort!==!1&&T.sort(q.sort),T.map(z=>{const ue=$[z];return ue===void 0?"":ue===null?d(z,q):Array.isArray(ue)?ue.length===0&&q.arrayFormat==="bracket-separator"?d(z,q)+"[]":ue.reduce(K(z),[]).join("&"):d(z,q)+"="+d(ue,q)}).filter(z=>z.length>0).join("&")},t.parseUrl=($,q)=>{q=Object.assign({decode:!0},q);const[U,K]=n($,"#");return Object.assign({url:U.split("?")[0]||"",query:k(N($),q)},q&&q.parseFragmentIdentifier&&K?{fragmentIdentifier:g(K,q)}:{})},t.stringifyUrl=($,q)=>{q=Object.assign({encode:!0,strict:!0,[o]:!0},q);const U=A($.url).split("?")[0]||"",K=t.extract($.url),J=t.parse(K,{sort:!1}),T=Object.assign(J,$.query);let z=t.stringify(T,q);z&&(z=`?${z}`);let ue=P($.url);return $.fragmentIdentifier&&(ue=`#${q[o]?d($.fragmentIdentifier,q):$.fragmentIdentifier}`),`${U}${z}${ue}`},t.pick=($,q,U)=>{U=Object.assign({parseFragmentIdentifier:!0,[o]:!1},U);const{url:K,query:J,fragmentIdentifier:T}=t.parseUrl($,U);return t.stringifyUrl({url:K,query:i(J,q),fragmentIdentifier:T},U)},t.exclude=($,q,U)=>{const K=Array.isArray(q)?J=>!q.includes(J):(J,T)=>!q(J,T);return t.pick($,K,U)}})(nl);var Tx={exports:{}};/** + ***************************************************************************** */var Jg=function(t,e){return Jg=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Jg(t,e)};function sT(t,e){Jg(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Xg=function(){return Xg=Object.assign||function(e){for(var r,n=1,i=arguments.length;n=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function cT(t,e){return function(r,n){e(r,n,t)}}function uT(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function fT(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(d){try{l(n.next(d))}catch(g){o(g)}}function u(d){try{l(n.throw(d))}catch(g){o(g)}}function l(d){d.done?s(d.value):i(d.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function lT(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return u([l,d])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function T2(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function pT(){for(var t=[],e=0;e1||a(y,A)})})}function a(y,A){try{u(n[y](A))}catch(P){g(s[0][3],P)}}function u(y){y.value instanceof Kf?Promise.resolve(y.value.v).then(l,d):g(s[0][2],y)}function l(y){a("next",y)}function d(y){a("throw",y)}function g(y,A){y(A),s.shift(),s.length&&a(s[0][0],s[0][1])}}function vT(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Kf(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function bT(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Zg=="function"?Zg(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function yT(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function wT(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function xT(t){return t&&t.__esModule?t:{default:t}}function _T(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function ET(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const Vf=Jp(Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Xg},__asyncDelegator:vT,__asyncGenerator:mT,__asyncValues:bT,__await:Kf,__awaiter:fT,__classPrivateFieldGet:_T,__classPrivateFieldSet:ET,__createBinding:hT,__decorate:aT,__exportStar:dT,__extends:sT,__generator:lT,__importDefault:xT,__importStar:wT,__makeTemplateObject:yT,__metadata:uT,__param:cT,__read:T2,__rest:oT,__spread:pT,__spreadArrays:gT,__values:Zg},Symbol.toStringTag,{value:"Module"})));var Qg={},Gf={},R2;function ST(){if(R2)return Gf;R2=1,Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Gf.delay=t,Gf}var Ha={},em={},Wa={},D2;function AT(){return D2||(D2=1,Object.defineProperty(Wa,"__esModule",{value:!0}),Wa.ONE_THOUSAND=Wa.ONE_HUNDRED=void 0,Wa.ONE_HUNDRED=100,Wa.ONE_THOUSAND=1e3),Wa}var tm={},O2;function PT(){return O2||(O2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(tm)),tm}var N2;function L2(){return N2||(N2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(AT(),t),e.__exportStar(PT(),t)}(em)),em}var k2;function MT(){if(k2)return Ha;k2=1,Object.defineProperty(Ha,"__esModule",{value:!0}),Ha.fromMiliseconds=Ha.toMiliseconds=void 0;const t=L2();function e(n){return n*t.ONE_THOUSAND}Ha.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return Ha.fromMiliseconds=r,Ha}var B2;function IT(){return B2||(B2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(ST(),t),e.__exportStar(MT(),t)}(Qg)),Qg}var nu={},$2;function CT(){if($2)return nu;$2=1,Object.defineProperty(nu,"__esModule",{value:!0}),nu.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return nu.Watch=t,nu.default=t,nu}var rm={},Yf={},F2;function TT(){if(F2)return Yf;F2=1,Object.defineProperty(Yf,"__esModule",{value:!0}),Yf.IWatch=void 0;class t{}return Yf.IWatch=t,Yf}var j2;function RT(){return j2||(j2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Vf.__exportStar(TT(),t)}(rm)),rm}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(IT(),t),e.__exportStar(CT(),t),e.__exportStar(RT(),t),e.__exportStar(L2(),t)})(mt);class Ka{}let DT=class extends Ka{constructor(e){super()}};const U2=mt.FIVE_SECONDS,iu={pulse:"heartbeat_pulse"};let OT=class VA extends DT{constructor(e){super(e),this.events=new zi.EventEmitter,this.interval=U2,this.interval=(e==null?void 0:e.interval)||U2}static async init(e){const r=new VA(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),mt.toMiliseconds(this.interval))}pulse(){this.events.emit(iu.pulse)}};const NT=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,LT=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,kT=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function BT(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){$T(t);return}return e}function $T(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Zh(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!kT.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(NT.test(t)||LT.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,BT)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function FT(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Cn(t,...e){try{return FT(t(...e))}catch(r){return Promise.reject(r)}}function jT(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function UT(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Qh(t){if(jT(t))return String(t);if(UT(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Qh(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function q2(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const nm="base64:";function qT(t){if(typeof t=="string")return t;q2();const e=Buffer.from(t).toString("base64");return nm+e}function zT(t){return typeof t!="string"||!t.startsWith(nm)?t:(q2(),Buffer.from(t.slice(nm.length),"base64"))}function pi(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function HT(...t){return pi(t.join(":"))}function ed(t){return t=pi(t),t?t+":":""}function foe(t){return t}const WT="memory",KT=()=>{const t=new Map;return{name:WT,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function VT(t={}){const e={mounts:{"":t.driver||KT()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const d of e.mountpoints)if(l.startsWith(d))return{base:d,relativeKey:l.slice(d.length),driver:e.mounts[d]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,d)=>e.mountpoints.filter(g=>g.startsWith(l)||d&&l.startsWith(g)).map(g=>({relativeBase:l.length>g.length?l.slice(g.length):void 0,mountpoint:g,driver:e.mounts[g]})),i=(l,d)=>{if(e.watching){d=pi(d);for(const g of e.watchListeners)g(l,d)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await z2(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,d,g)=>{const y=new Map,A=P=>{let O=y.get(P.base);return O||(O={driver:P.driver,base:P.base,items:[]},y.set(P.base,O)),O};for(const P of l){const O=typeof P=="string",D=pi(O?P:P.key),k=O?void 0:P.value,B=O||!P.options?d:{...d,...P.options},j=r(D);A(j).items.push({key:D,value:k,relativeKey:j.relativeKey,options:B})}return Promise.all([...y.values()].map(P=>g(P))).then(P=>P.flat())},u={hasItem(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return Cn(y.hasItem,g,d)},getItem(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return Cn(y.getItem,g,d).then(A=>Zh(A))},getItems(l,d){return a(l,d,g=>g.driver.getItems?Cn(g.driver.getItems,g.items.map(y=>({key:y.relativeKey,options:y.options})),d).then(y=>y.map(A=>({key:HT(g.base,A.key),value:Zh(A.value)}))):Promise.all(g.items.map(y=>Cn(g.driver.getItem,y.relativeKey,y.options).then(A=>({key:y.key,value:Zh(A)})))))},getItemRaw(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return y.getItemRaw?Cn(y.getItemRaw,g,d):Cn(y.getItem,g,d).then(A=>zT(A))},async setItem(l,d,g={}){if(d===void 0)return u.removeItem(l);l=pi(l);const{relativeKey:y,driver:A}=r(l);A.setItem&&(await Cn(A.setItem,y,Qh(d),g),A.watch||i("update",l))},async setItems(l,d){await a(l,d,async g=>{if(g.driver.setItems)return Cn(g.driver.setItems,g.items.map(y=>({key:y.relativeKey,value:Qh(y.value),options:y.options})),d);g.driver.setItem&&await Promise.all(g.items.map(y=>Cn(g.driver.setItem,y.relativeKey,Qh(y.value),y.options)))})},async setItemRaw(l,d,g={}){if(d===void 0)return u.removeItem(l,g);l=pi(l);const{relativeKey:y,driver:A}=r(l);if(A.setItemRaw)await Cn(A.setItemRaw,y,d,g);else if(A.setItem)await Cn(A.setItem,y,qT(d),g);else return;A.watch||i("update",l)},async removeItem(l,d={}){typeof d=="boolean"&&(d={removeMeta:d}),l=pi(l);const{relativeKey:g,driver:y}=r(l);y.removeItem&&(await Cn(y.removeItem,g,d),(d.removeMeta||d.removeMata)&&await Cn(y.removeItem,g+"$",d),y.watch||i("remove",l))},async getMeta(l,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),l=pi(l);const{relativeKey:g,driver:y}=r(l),A=Object.create(null);if(y.getMeta&&Object.assign(A,await Cn(y.getMeta,g,d)),!d.nativeOnly){const P=await Cn(y.getItem,g+"$",d).then(O=>Zh(O));P&&typeof P=="object"&&(typeof P.atime=="string"&&(P.atime=new Date(P.atime)),typeof P.mtime=="string"&&(P.mtime=new Date(P.mtime)),Object.assign(A,P))}return A},setMeta(l,d,g={}){return this.setItem(l+"$",d,g)},removeMeta(l,d={}){return this.removeItem(l+"$",d)},async getKeys(l,d={}){l=ed(l);const g=n(l,!0);let y=[];const A=[];for(const P of g){const O=await Cn(P.driver.getKeys,P.relativeBase,d);for(const D of O){const k=P.mountpoint+pi(D);y.some(B=>k.startsWith(B))||A.push(k)}y=[P.mountpoint,...y.filter(D=>!D.startsWith(P.mountpoint))]}return l?A.filter(P=>P.startsWith(l)&&P[P.length-1]!=="$"):A.filter(P=>P[P.length-1]!=="$")},async clear(l,d={}){l=ed(l),await Promise.all(n(l,!1).map(async g=>{if(g.driver.clear)return Cn(g.driver.clear,g.relativeBase,d);if(g.driver.removeItem){const y=await g.driver.getKeys(g.relativeBase||"",d);return Promise.all(y.map(A=>g.driver.removeItem(A,d)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>H2(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(d=>d!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,d){if(l=ed(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((g,y)=>y.length-g.length)),e.mounts[l]=d,e.watching&&Promise.resolve(z2(d,i,l)).then(g=>{e.unwatch[l]=g}).catch(console.error),u},async unmount(l,d=!0){l=ed(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),d&&await H2(e.mounts[l]),e.mountpoints=e.mountpoints.filter(g=>g!==l),delete e.mounts[l])},getMount(l=""){l=pi(l)+":";const d=r(l);return{driver:d.driver,base:d.base}},getMounts(l="",d={}){return l=pi(l),n(l,d.parents).map(y=>({driver:y.driver,base:y.mountpoint}))},keys:(l,d={})=>u.getKeys(l,d),get:(l,d={})=>u.getItem(l,d),set:(l,d,g={})=>u.setItem(l,d,g),has:(l,d={})=>u.hasItem(l,d),del:(l,d={})=>u.removeItem(l,d),remove:(l,d={})=>u.removeItem(l,d)};return u}function z2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function H2(t){typeof t.dispose=="function"&&await Cn(t.dispose)}function Va(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function W2(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Va(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let im;function Jf(){return im||(im=W2("keyval-store","keyval")),im}function K2(t,e=Jf()){return e("readonly",r=>Va(r.get(t)))}function GT(t,e,r=Jf()){return r("readwrite",n=>(n.put(e,t),Va(n.transaction)))}function YT(t,e=Jf()){return e("readwrite",r=>(r.delete(t),Va(r.transaction)))}function JT(t=Jf()){return t("readwrite",e=>(e.clear(),Va(e.transaction)))}function XT(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Va(t.transaction)}function ZT(t=Jf()){return t("readonly",e=>{if(e.getAllKeys)return Va(e.getAllKeys());const r=[];return XT(e,n=>r.push(n.key)).then(()=>r)})}const QT=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),eR=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Ga(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return eR(t)}catch{return t}}function bo(t){return typeof t=="string"?t:QT(t)||""}const tR="idb-keyval";var rR=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=W2(t.dbName,t.storeName)),{name:tR,options:t,async hasItem(i){return!(typeof await K2(r(i),n)>"u")},async getItem(i){return await K2(r(i),n)??null},setItem(i,s){return GT(r(i),s,n)},removeItem(i){return YT(r(i),n)},getKeys(){return ZT(n)},clear(){return JT(n)}}};const nR="WALLET_CONNECT_V2_INDEXED_DB",iR="keyvaluestorage";let sR=class{constructor(){this.indexedDb=VT({driver:rR({dbName:nR,storeName:iR})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,bo(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var sm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},td={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof sm<"u"&&sm.localStorage?td.exports=sm.localStorage:typeof window<"u"&&window.localStorage?td.exports=window.localStorage:td.exports=new e})();function oR(t){var e;return[t[0],Ga((e=t[1])!=null?e:"")]}let aR=class{constructor(){this.localStorage=td.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(oR)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Ga(r)}async setItem(e,r){this.localStorage.setItem(e,bo(r))}async removeItem(e){this.localStorage.removeItem(e)}};const cR="wc_storage_version",V2=1,uR=async(t,e,r)=>{const n=cR,i=await e.getItem(n);if(i&&i>=V2){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,V2),r(e),fR(t,o)},fR=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let lR=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new aR;this.storage=e;try{const r=new sR;uR(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function hR(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var dR=pR;function pR(t,e,r){var n=r&&r.stringify||hR,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?g:0,t.charCodeAt(A+1)){case 100:case 102:if(d>=u||e[d]==null)break;g=u||e[d]==null)break;g=u||e[d]===void 0)break;g",g=A+2,A++;break}l+=n(e[d]),g=A+2,A++;break;case 115:if(d>=u)break;g-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",u=Object.create(r);u.log||(u.log=Zf),Object.defineProperty(u,"levelVal",{get:d}),Object.defineProperty(u,"level",{get:g,set:y});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:xR(t)};u.levels=yo.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Zf,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=A,e&&(u._logEvent=om());function d(){return this.level==="silent"?1/0:this.levels.values[this.level]}function g(){return this._level}function y(P){if(P!=="silent"&&!this.levels.values[P])throw Error("unknown level "+P);this._level=P,ou(l,u,"error","log"),ou(l,u,"fatal","error"),ou(l,u,"warn","error"),ou(l,u,"info","log"),ou(l,u,"debug","log"),ou(l,u,"trace","log")}function A(P,O){if(!P)throw new Error("missing bindings for child Pino");O=O||{},i&&P.serializers&&(O.serializers=P.serializers);const D=O.serializers;if(i&&D){var k=Object.assign({},n,D),B=t.browser.serialize===!0?Object.keys(k):i;delete P.serializers,rd([P],B,k,this._stdErrSerialize)}function j(U){this._childLevel=(U._childLevel|0)+1,this.error=au(U,P,"error"),this.fatal=au(U,P,"fatal"),this.warn=au(U,P,"warn"),this.info=au(U,P,"info"),this.debug=au(U,P,"debug"),this.trace=au(U,P,"trace"),k&&(this.serializers=k,this._serialize=B),e&&(this._logEvent=om([].concat(U._logEvent.bindings,P)))}return j.prototype=this,new j(this)}return u}yo.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},yo.stdSerializers=gR,yo.stdTimeFunctions=Object.assign({},{nullTime:Y2,epochTime:J2,unixTime:_R,isoTime:ER});function ou(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Zf:i[r]?i[r]:Xf[r]||Xf[n]||Zf,vR(t,e,r)}function vR(t,e,r){!t.transmit&&e[r]===Zf||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Xf?Xf:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function au(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},Z2=class{constructor(e,r=cm){this.level=e??"error",this.levelValue=su.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new X2(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===su.levels.values.error?console.error(e):r===su.levels.values.warn?console.warn(e):r===su.levels.values.debug?console.debug(e):r===su.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(bo({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new X2(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(bo({extraMetadata:e})),new Blob(r,{type:"application/json"})}},MR=class{constructor(e,r=cm){this.baseChunkLogger=new Z2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},IR=class{constructor(e,r=cm){this.baseChunkLogger=new Z2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var CR=Object.defineProperty,TR=Object.defineProperties,RR=Object.getOwnPropertyDescriptors,Q2=Object.getOwnPropertySymbols,DR=Object.prototype.hasOwnProperty,OR=Object.prototype.propertyIsEnumerable,ex=(t,e,r)=>e in t?CR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,id=(t,e)=>{for(var r in e||(e={}))DR.call(e,r)&&ex(t,r,e[r]);if(Q2)for(var r of Q2(e))OR.call(e,r)&&ex(t,r,e[r]);return t},sd=(t,e)=>TR(t,RR(e));function od(t){return sd(id({},t),{level:(t==null?void 0:t.level)||AR.level})}function NR(t,e=el){return t[e]||""}function LR(t,e,r=el){return t[r]=e,t}function gi(t,e=el){let r="";return typeof t.bindings>"u"?r=NR(t,e):r=t.bindings().context||"",r}function kR(t,e,r=el){const n=gi(t,r);return n.trim()?`${n}/${e}`:e}function ri(t,e,r=el){const n=kR(t,e,r),i=t.child({context:n});return LR(i,n,r)}function BR(t){var e,r;const n=new MR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace",browser:sd(id({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function $R(t){var e;const r=new IR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function FR(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?BR(t):$R(t)}let jR=class extends Ka{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},UR=class extends Ka{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},qR=class{constructor(e,r){this.logger=e,this.core=r}},zR=class extends Ka{constructor(e,r){super(),this.relayer=e,this.logger=r}},HR=class extends Ka{constructor(e){super()}},WR=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},KR=class extends Ka{constructor(e,r){super(),this.relayer=e,this.logger=r}},VR=class extends Ka{constructor(e,r){super(),this.core=e,this.logger=r}},GR=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},YR=class{constructor(e,r){this.projectId=e,this.logger=r}},JR=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},XR=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},ZR=class{constructor(e){this.client=e}};var um={},na={},ad={},cd={};Object.defineProperty(cd,"__esModule",{value:!0}),cd.BrowserRandomSource=void 0;const tx=65536;class QR{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let n=0;n>>16&65535,d=a&65535,g=u>>>16&65535,y=u&65535;return d*y+(l*y+d*g<<16>>>0)|0}t.mul=Math.imul||e;function r(a,u){return a+u|0}t.add=r;function n(a,u){return a-u|0}t.sub=n;function i(a,u){return a<>>32-u}t.rotl=i;function s(a,u){return a<<32-u|a>>>u}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(nx),Object.defineProperty(or,"__esModule",{value:!0});var ix=nx;function oD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}or.readInt16BE=oD;function aD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}or.readUint16BE=aD;function cD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}or.readInt16LE=cD;function uD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}or.readUint16LE=uD;function sx(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}or.writeUint16BE=sx,or.writeInt16BE=sx;function ox(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}or.writeUint16LE=ox,or.writeInt16LE=ox;function fm(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}or.readInt32BE=fm;function lm(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}or.readUint32BE=lm;function hm(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}or.readInt32LE=hm;function dm(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}or.readUint32LE=dm;function fd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}or.writeUint32BE=fd,or.writeInt32BE=fd;function ld(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}or.writeUint32LE=ld,or.writeInt32LE=ld;function fD(t,e){e===void 0&&(e=0);var r=fm(t,e),n=fm(t,e+4);return r*4294967296+n-(n>>31)*4294967296}or.readInt64BE=fD;function lD(t,e){e===void 0&&(e=0);var r=lm(t,e),n=lm(t,e+4);return r*4294967296+n}or.readUint64BE=lD;function hD(t,e){e===void 0&&(e=0);var r=hm(t,e),n=hm(t,e+4);return n*4294967296+r-(r>>31)*4294967296}or.readInt64LE=hD;function dD(t,e){e===void 0&&(e=0);var r=dm(t,e),n=dm(t,e+4);return n*4294967296+r}or.readUint64LE=dD;function ax(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fd(t/4294967296>>>0,e,r),fd(t>>>0,e,r+4),e}or.writeUint64BE=ax,or.writeInt64BE=ax;function cx(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ld(t>>>0,e,r),ld(t/4294967296>>>0,e,r+4),e}or.writeUint64LE=cx,or.writeInt64LE=cx;function pD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}or.readUintBE=pD;function gD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}or.writeUintBE=mD;function vD(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!ix.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s256)throw new Error("randomString charset is too long");let y="";const A=d.length,P=256-256%A;for(;l>0;){const O=i(Math.ceil(l*256/P),g);for(let D=0;D0;D++){const k=O[D];k0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,g=l/536870912|0,y=l<<3,A=l%128<112?128:256;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._stateHi.set(u.stateHi),this._stateLo.set(u.stateLo),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.stateHi),r.wipe(u.stateLo),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,u,l,d,g,y,A){for(var P=l[0],O=l[1],D=l[2],k=l[3],B=l[4],j=l[5],U=l[6],K=l[7],J=d[0],T=d[1],z=d[2],ue=d[3],_e=d[4],G=d[5],E=d[6],m=d[7],f,p,v,x,_,S,b,M;A>=128;){for(var I=0;I<16;I++){var F=8*I+y;a[I]=e.readUint32BE(g,F),u[I]=e.readUint32BE(g,F+4)}for(var I=0;I<80;I++){var ae=P,N=O,se=D,ee=k,X=B,Q=j,R=U,Z=K,te=J,he=T,ie=z,fe=ue,ve=_e,Me=G,Ne=E,Te=m;if(f=K,p=m,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=(B>>>14|_e<<18)^(B>>>18|_e<<14)^(_e>>>9|B<<23),p=(_e>>>14|B<<18)^(_e>>>18|B<<14)^(B>>>9|_e<<23),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=B&j^~B&U,p=_e&G^~_e&E,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=i[I*2],p=i[I*2+1],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=a[I%16],p=u[I%16],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,v=b&65535|M<<16,x=_&65535|S<<16,f=v,p=x,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=(P>>>28|J<<4)^(J>>>2|P<<30)^(J>>>7|P<<25),p=(J>>>28|P<<4)^(P>>>2|J<<30)^(P>>>7|J<<25),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=P&O^P&D^O&D,p=J&T^J&z^T&z,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,Z=b&65535|M<<16,Te=_&65535|S<<16,f=ee,p=fe,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=v,p=x,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,ee=b&65535|M<<16,fe=_&65535|S<<16,O=ae,D=N,k=se,B=ee,j=X,U=Q,K=R,P=Z,T=te,z=he,ue=ie,_e=fe,G=ve,E=Me,m=Ne,J=Te,I%16===15)for(var F=0;F<16;F++)f=a[F],p=u[F],_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=a[(F+9)%16],p=u[(F+9)%16],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,v=a[(F+1)%16],x=u[(F+1)%16],f=(v>>>1|x<<31)^(v>>>8|x<<24)^v>>>7,p=(x>>>1|v<<31)^(x>>>8|v<<24)^(x>>>7|v<<25),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,v=a[(F+14)%16],x=u[(F+14)%16],f=(v>>>19|x<<13)^(x>>>29|v<<3)^v>>>6,p=(x>>>19|v<<13)^(v>>>29|x<<3)^(x>>>6|v<<26),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,a[F]=b&65535|M<<16,u[F]=_&65535|S<<16}f=P,p=J,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[0],p=d[0],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[0]=P=b&65535|M<<16,d[0]=J=_&65535|S<<16,f=O,p=T,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[1],p=d[1],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[1]=O=b&65535|M<<16,d[1]=T=_&65535|S<<16,f=D,p=z,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[2],p=d[2],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[2]=D=b&65535|M<<16,d[2]=z=_&65535|S<<16,f=k,p=ue,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[3],p=d[3],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[3]=k=b&65535|M<<16,d[3]=ue=_&65535|S<<16,f=B,p=_e,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[4],p=d[4],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[4]=B=b&65535|M<<16,d[4]=_e=_&65535|S<<16,f=j,p=G,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[5],p=d[5],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[5]=j=b&65535|M<<16,d[5]=G=_&65535|S<<16,f=U,p=E,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[6],p=d[6],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[6]=U=b&65535|M<<16,d[6]=E=_&65535|S<<16,f=K,p=m,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[7],p=d[7],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[7]=K=b&65535|M<<16,d[7]=m=_&65535|S<<16,y+=128,A-=128}return y}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ux),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=na,r=ux,n=Mi;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(ee){const X=new Float64Array(16);if(ee)for(let Q=0;Q>16&1),Q[he-1]&=65535;Q[15]=R[15]-32767-(Q[14]>>16&1);const te=Q[15]>>16&1;Q[14]&=65535,O(R,Q,1-te)}for(let Z=0;Z<16;Z++)ee[2*Z]=R[Z]&255,ee[2*Z+1]=R[Z]>>8}function k(ee,X){let Q=0;for(let R=0;R<32;R++)Q|=ee[R]^X[R];return(1&Q-1>>>8)-1}function B(ee,X){const Q=new Uint8Array(32),R=new Uint8Array(32);return D(Q,ee),D(R,X),k(Q,R)}function j(ee){const X=new Uint8Array(32);return D(X,ee),X[0]&1}function U(ee,X){for(let Q=0;Q<16;Q++)ee[Q]=X[2*Q]+(X[2*Q+1]<<8);ee[15]&=32767}function K(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]+Q[R]}function J(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]-Q[R]}function T(ee,X,Q){let R,Z,te=0,he=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=0,Ie=0,Le=0,Ve=0,ke=0,ze=0,He=0,Ee=0,Qe=0,ct=0,Be=0,et=0,rt=0,Je=0,pt=0,ht=0,ft=0,Ht=0,Jt=0,St=0,er=0,Xt=0,Ot=0,Bt=Q[0],Tt=Q[1],vt=Q[2],Dt=Q[3],Lt=Q[4],bt=Q[5],$t=Q[6],jt=Q[7],nt=Q[8],Ft=Q[9],$=Q[10],H=Q[11],V=Q[12],C=Q[13],Y=Q[14],q=Q[15];R=X[0],te+=R*Bt,he+=R*Tt,ie+=R*vt,fe+=R*Dt,ve+=R*Lt,Me+=R*bt,Ne+=R*$t,Te+=R*jt,$e+=R*nt,Ie+=R*Ft,Le+=R*$,Ve+=R*H,ke+=R*V,ze+=R*C,He+=R*Y,Ee+=R*q,R=X[1],he+=R*Bt,ie+=R*Tt,fe+=R*vt,ve+=R*Dt,Me+=R*Lt,Ne+=R*bt,Te+=R*$t,$e+=R*jt,Ie+=R*nt,Le+=R*Ft,Ve+=R*$,ke+=R*H,ze+=R*V,He+=R*C,Ee+=R*Y,Qe+=R*q,R=X[2],ie+=R*Bt,fe+=R*Tt,ve+=R*vt,Me+=R*Dt,Ne+=R*Lt,Te+=R*bt,$e+=R*$t,Ie+=R*jt,Le+=R*nt,Ve+=R*Ft,ke+=R*$,ze+=R*H,He+=R*V,Ee+=R*C,Qe+=R*Y,ct+=R*q,R=X[3],fe+=R*Bt,ve+=R*Tt,Me+=R*vt,Ne+=R*Dt,Te+=R*Lt,$e+=R*bt,Ie+=R*$t,Le+=R*jt,Ve+=R*nt,ke+=R*Ft,ze+=R*$,He+=R*H,Ee+=R*V,Qe+=R*C,ct+=R*Y,Be+=R*q,R=X[4],ve+=R*Bt,Me+=R*Tt,Ne+=R*vt,Te+=R*Dt,$e+=R*Lt,Ie+=R*bt,Le+=R*$t,Ve+=R*jt,ke+=R*nt,ze+=R*Ft,He+=R*$,Ee+=R*H,Qe+=R*V,ct+=R*C,Be+=R*Y,et+=R*q,R=X[5],Me+=R*Bt,Ne+=R*Tt,Te+=R*vt,$e+=R*Dt,Ie+=R*Lt,Le+=R*bt,Ve+=R*$t,ke+=R*jt,ze+=R*nt,He+=R*Ft,Ee+=R*$,Qe+=R*H,ct+=R*V,Be+=R*C,et+=R*Y,rt+=R*q,R=X[6],Ne+=R*Bt,Te+=R*Tt,$e+=R*vt,Ie+=R*Dt,Le+=R*Lt,Ve+=R*bt,ke+=R*$t,ze+=R*jt,He+=R*nt,Ee+=R*Ft,Qe+=R*$,ct+=R*H,Be+=R*V,et+=R*C,rt+=R*Y,Je+=R*q,R=X[7],Te+=R*Bt,$e+=R*Tt,Ie+=R*vt,Le+=R*Dt,Ve+=R*Lt,ke+=R*bt,ze+=R*$t,He+=R*jt,Ee+=R*nt,Qe+=R*Ft,ct+=R*$,Be+=R*H,et+=R*V,rt+=R*C,Je+=R*Y,pt+=R*q,R=X[8],$e+=R*Bt,Ie+=R*Tt,Le+=R*vt,Ve+=R*Dt,ke+=R*Lt,ze+=R*bt,He+=R*$t,Ee+=R*jt,Qe+=R*nt,ct+=R*Ft,Be+=R*$,et+=R*H,rt+=R*V,Je+=R*C,pt+=R*Y,ht+=R*q,R=X[9],Ie+=R*Bt,Le+=R*Tt,Ve+=R*vt,ke+=R*Dt,ze+=R*Lt,He+=R*bt,Ee+=R*$t,Qe+=R*jt,ct+=R*nt,Be+=R*Ft,et+=R*$,rt+=R*H,Je+=R*V,pt+=R*C,ht+=R*Y,ft+=R*q,R=X[10],Le+=R*Bt,Ve+=R*Tt,ke+=R*vt,ze+=R*Dt,He+=R*Lt,Ee+=R*bt,Qe+=R*$t,ct+=R*jt,Be+=R*nt,et+=R*Ft,rt+=R*$,Je+=R*H,pt+=R*V,ht+=R*C,ft+=R*Y,Ht+=R*q,R=X[11],Ve+=R*Bt,ke+=R*Tt,ze+=R*vt,He+=R*Dt,Ee+=R*Lt,Qe+=R*bt,ct+=R*$t,Be+=R*jt,et+=R*nt,rt+=R*Ft,Je+=R*$,pt+=R*H,ht+=R*V,ft+=R*C,Ht+=R*Y,Jt+=R*q,R=X[12],ke+=R*Bt,ze+=R*Tt,He+=R*vt,Ee+=R*Dt,Qe+=R*Lt,ct+=R*bt,Be+=R*$t,et+=R*jt,rt+=R*nt,Je+=R*Ft,pt+=R*$,ht+=R*H,ft+=R*V,Ht+=R*C,Jt+=R*Y,St+=R*q,R=X[13],ze+=R*Bt,He+=R*Tt,Ee+=R*vt,Qe+=R*Dt,ct+=R*Lt,Be+=R*bt,et+=R*$t,rt+=R*jt,Je+=R*nt,pt+=R*Ft,ht+=R*$,ft+=R*H,Ht+=R*V,Jt+=R*C,St+=R*Y,er+=R*q,R=X[14],He+=R*Bt,Ee+=R*Tt,Qe+=R*vt,ct+=R*Dt,Be+=R*Lt,et+=R*bt,rt+=R*$t,Je+=R*jt,pt+=R*nt,ht+=R*Ft,ft+=R*$,Ht+=R*H,Jt+=R*V,St+=R*C,er+=R*Y,Xt+=R*q,R=X[15],Ee+=R*Bt,Qe+=R*Tt,ct+=R*vt,Be+=R*Dt,et+=R*Lt,rt+=R*bt,Je+=R*$t,pt+=R*jt,ht+=R*nt,ft+=R*Ft,Ht+=R*$,Jt+=R*H,St+=R*V,er+=R*C,Xt+=R*Y,Ot+=R*q,te+=38*Qe,he+=38*ct,ie+=38*Be,fe+=38*et,ve+=38*rt,Me+=38*Je,Ne+=38*pt,Te+=38*ht,$e+=38*ft,Ie+=38*Ht,Le+=38*Jt,Ve+=38*St,ke+=38*er,ze+=38*Xt,He+=38*Ot,Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=he+Z+65535,Z=Math.floor(R/65536),he=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=he+Z+65535,Z=Math.floor(R/65536),he=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),ee[0]=te,ee[1]=he,ee[2]=ie,ee[3]=fe,ee[4]=ve,ee[5]=Me,ee[6]=Ne,ee[7]=Te,ee[8]=$e,ee[9]=Ie,ee[10]=Le,ee[11]=Ve,ee[12]=ke,ee[13]=ze,ee[14]=He,ee[15]=Ee}function z(ee,X){T(ee,X,X)}function ue(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=253;R>=0;R--)z(Q,Q),R!==2&&R!==4&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function _e(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=250;R>=0;R--)z(Q,Q),R!==1&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function G(ee,X){const Q=i(),R=i(),Z=i(),te=i(),he=i(),ie=i(),fe=i(),ve=i(),Me=i();J(Q,ee[1],ee[0]),J(Me,X[1],X[0]),T(Q,Q,Me),K(R,ee[0],ee[1]),K(Me,X[0],X[1]),T(R,R,Me),T(Z,ee[3],X[3]),T(Z,Z,l),T(te,ee[2],X[2]),K(te,te,te),J(he,R,Q),J(ie,te,Z),K(fe,te,Z),K(ve,R,Q),T(ee[0],he,ie),T(ee[1],ve,fe),T(ee[2],fe,ie),T(ee[3],he,ve)}function E(ee,X,Q){for(let R=0;R<4;R++)O(ee[R],X[R],Q)}function m(ee,X){const Q=i(),R=i(),Z=i();ue(Z,X[2]),T(Q,X[0],Z),T(R,X[1],Z),D(ee,R),ee[31]^=j(Q)<<7}function f(ee,X,Q){A(ee[0],o),A(ee[1],a),A(ee[2],a),A(ee[3],o);for(let R=255;R>=0;--R){const Z=Q[R/8|0]>>(R&7)&1;E(ee,X,Z),G(X,ee),G(ee,ee),E(ee,X,Z)}}function p(ee,X){const Q=[i(),i(),i(),i()];A(Q[0],d),A(Q[1],g),A(Q[2],a),T(Q[3],d,g),f(ee,Q,X)}function v(ee){if(ee.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const X=(0,r.hash)(ee);X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(32),R=[i(),i(),i(),i()];p(R,X),m(Q,R);const Z=new Uint8Array(64);return Z.set(ee),Z.set(Q,32),{publicKey:Q,secretKey:Z}}t.generateKeyPairFromSeed=v;function x(ee){const X=(0,e.randomBytes)(32,ee),Q=v(X);return(0,n.wipe)(X),Q}t.generateKeyPair=x;function _(ee){if(ee.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(ee.subarray(32))}t.extractPublicKeyFromSecretKey=_;const S=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function b(ee,X){let Q,R,Z,te;for(R=63;R>=32;--R){for(Q=0,Z=R-32,te=R-12;Z>4)*S[Z],Q=X[Z]>>8,X[Z]&=255;for(Z=0;Z<32;Z++)X[Z]-=Q*S[Z];for(R=0;R<32;R++)X[R+1]+=X[R]>>8,ee[R]=X[R]&255}function M(ee){const X=new Float64Array(64);for(let Q=0;Q<64;Q++)X[Q]=ee[Q];for(let Q=0;Q<64;Q++)ee[Q]=0;b(ee,X)}function I(ee,X){const Q=new Float64Array(64),R=[i(),i(),i(),i()],Z=(0,r.hash)(ee.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(64);te.set(Z.subarray(32),32);const he=new r.SHA512;he.update(te.subarray(32)),he.update(X);const ie=he.digest();he.clean(),M(ie),p(R,ie),m(te,R),he.reset(),he.update(te.subarray(0,32)),he.update(ee.subarray(32)),he.update(X);const fe=he.digest();M(fe);for(let ve=0;ve<32;ve++)Q[ve]=ie[ve];for(let ve=0;ve<32;ve++)for(let Me=0;Me<32;Me++)Q[ve+Me]+=fe[ve]*Z[Me];return b(te.subarray(32),Q),te}t.sign=I;function F(ee,X){const Q=i(),R=i(),Z=i(),te=i(),he=i(),ie=i(),fe=i();return A(ee[2],a),U(ee[1],X),z(Z,ee[1]),T(te,Z,u),J(Z,Z,ee[2]),K(te,ee[2],te),z(he,te),z(ie,he),T(fe,ie,he),T(Q,fe,Z),T(Q,Q,te),_e(Q,Q),T(Q,Q,Z),T(Q,Q,te),T(Q,Q,te),T(ee[0],Q,te),z(R,ee[0]),T(R,R,te),B(R,Z)&&T(ee[0],ee[0],y),z(R,ee[0]),T(R,R,te),B(R,Z)?-1:(j(ee[0])===X[31]>>7&&J(ee[0],o,ee[0]),T(ee[3],ee[0],ee[1]),0)}function ae(ee,X,Q){const R=new Uint8Array(32),Z=[i(),i(),i(),i()],te=[i(),i(),i(),i()];if(Q.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(F(te,ee))return!1;const he=new r.SHA512;he.update(Q.subarray(0,32)),he.update(ee),he.update(X);const ie=he.digest();return M(ie),f(Z,te,ie),p(te,Q.subarray(32)),G(Z,te),m(R,Z),!k(Q,R)}t.verify=ae;function N(ee){let X=[i(),i(),i(),i()];if(F(X,ee))throw new Error("Ed25519: invalid public key");let Q=i(),R=i(),Z=X[1];K(Q,a,Z),J(R,a,Z),ue(R,R),T(Q,Q,R);let te=new Uint8Array(32);return D(te,Q),te}t.convertPublicKeyToX25519=N;function se(ee){const X=(0,r.hash)(ee.subarray(0,32));X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(X.subarray(0,32));return(0,n.wipe)(X),Q}t.convertSecretKeyToX25519=se}(um);const PD="EdDSA",MD="JWT",hd=".",dd="base64url",fx="utf8",lx="utf8",ID=":",CD="did",TD="key",hx="base58btc",RD="z",DD="K36",OD=32;function dx(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function pd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=dx(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function ND(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(j);k!==B;){for(var K=P[k],J=0,T=j-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=j-D;z!==j&&U[z]===0;)z++;for(var ue=u.repeat(O);z>>0,j=new Uint8Array(B);P[O];){var U=r[P.charCodeAt(O)];if(U===255)return;for(var K=0,J=B-1;(U!==0||K>>0,j[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,O++}if(P[O]!==" "){for(var T=B-k;T!==B&&j[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=j[T++];return z}}}function A(P){var O=y(P);if(O)return O;throw new Error(`Non-${e} character`)}return{encode:g,decodeUnsafe:y,decode:A}}var LD=ND,kD=LD;const BD=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},$D=t=>new TextEncoder().encode(t),FD=t=>new TextDecoder().decode(t);class jD{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class UD{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return px(this,e)}}class qD{constructor(e){this.decoders=e}or(e){return px(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const px=(t,e)=>new qD({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class zD{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new jD(e,r,n),this.decoder=new UD(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const gd=({name:t,prefix:e,encode:r,decode:n})=>new zD(t,e,r,n),rl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=kD(r,e);return gd({prefix:t,name:e,encode:n,decode:s=>BD(i(s))})},HD=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},WD=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<gd({prefix:e,name:t,encode(i){return WD(i,n,r)},decode(i){return HD(i,n,r,t)}}),KD=gd({prefix:"\0",name:"identity",encode:t=>FD(t),decode:t=>$D(t)}),VD=Object.freeze(Object.defineProperty({__proto__:null,identity:KD},Symbol.toStringTag,{value:"Module"})),GD=jn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),YD=Object.freeze(Object.defineProperty({__proto__:null,base2:GD},Symbol.toStringTag,{value:"Module"})),JD=jn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),XD=Object.freeze(Object.defineProperty({__proto__:null,base8:JD},Symbol.toStringTag,{value:"Module"})),ZD=rl({prefix:"9",name:"base10",alphabet:"0123456789"}),QD=Object.freeze(Object.defineProperty({__proto__:null,base10:ZD},Symbol.toStringTag,{value:"Module"})),eO=jn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),tO=jn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),rO=Object.freeze(Object.defineProperty({__proto__:null,base16:eO,base16upper:tO},Symbol.toStringTag,{value:"Module"})),nO=jn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),iO=jn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),sO=jn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),oO=jn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),aO=jn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),cO=jn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),uO=jn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),fO=jn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),lO=jn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),hO=Object.freeze(Object.defineProperty({__proto__:null,base32:nO,base32hex:aO,base32hexpad:uO,base32hexpadupper:fO,base32hexupper:cO,base32pad:sO,base32padupper:oO,base32upper:iO,base32z:lO},Symbol.toStringTag,{value:"Module"})),dO=rl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),pO=rl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),gO=Object.freeze(Object.defineProperty({__proto__:null,base36:dO,base36upper:pO},Symbol.toStringTag,{value:"Module"})),mO=rl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),vO=rl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),bO=Object.freeze(Object.defineProperty({__proto__:null,base58btc:mO,base58flickr:vO},Symbol.toStringTag,{value:"Module"})),yO=jn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),wO=jn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),xO=jn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),_O=jn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),EO=Object.freeze(Object.defineProperty({__proto__:null,base64:yO,base64pad:wO,base64url:xO,base64urlpad:_O},Symbol.toStringTag,{value:"Module"})),gx=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),SO=gx.reduce((t,e,r)=>(t[r]=e,t),[]),AO=gx.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function PO(t){return t.reduce((e,r)=>(e+=SO[r],e),"")}function MO(t){const e=[];for(const r of t){const n=AO[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const IO=gd({prefix:"🚀",name:"base256emoji",encode:PO,decode:MO}),CO=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:IO},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const mx={...VD,...YD,...XD,...QD,...rO,...hO,...gO,...bO,...EO,...CO};function vx(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const bx=vx("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),pm=vx("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=dx(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new FO:typeof navigator<"u"?WO(navigator.userAgent):VO()}function HO(t){return t!==""&&qO.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function WO(t){var e=HO(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new $O;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length-1){const D=P.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let k=e.protocol+"//"+e.host;if(D.indexOf("/")===0)k+=D;else{const B=e.pathname.split("/");B.pop();const j=B.join("/");k+=j+"/"+D}y.push(k)}else if(D.indexOf("//")===0){const k=e.protocol+D;y.push(k)}else y.push(D)}}return y}function n(...g){const y=t.getElementsByTagName("meta");for(let A=0;AP.getAttribute(D)).filter(D=>D?g.includes(D):!1);if(O.length&&O){const D=P.getAttribute("content");if(D)return D}}return""}function i(){let g=n("name","og:site_name","og:title","twitter:title");return g||(g=t.title),g}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}Mx=vm.getWindowMetadata=sN;var il={},oN=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Cx="%[a-f0-9]{2}",Tx=new RegExp("("+Cx+")|([^%]+?)","gi"),Rx=new RegExp("("+Cx+")+","gi");function bm(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],bm(r),bm(n))}function aN(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(Tx)||[],r=1;r{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},lN=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;sB==null,o=Symbol("encodeFragmentIdentifier");function a(B){switch(B.arrayFormat){case"index":return j=>(U,K)=>{const J=U.length;return K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),"[",J,"]"].join("")]:[...U,[d(j,B),"[",d(J,B),"]=",d(K,B)].join("")]};case"bracket":return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),"[]"].join("")]:[...U,[d(j,B),"[]=",d(K,B)].join("")];case"colon-list-separator":return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),":list="].join("")]:[...U,[d(j,B),":list=",d(K,B)].join("")];case"comma":case"separator":case"bracket-separator":{const j=B.arrayFormat==="bracket-separator"?"[]=":"=";return U=>(K,J)=>J===void 0||B.skipNull&&J===null||B.skipEmptyString&&J===""?K:(J=J===null?"":J,K.length===0?[[d(U,B),j,d(J,B)].join("")]:[[K,d(J,B)].join(B.arrayFormatSeparator)])}default:return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,d(j,B)]:[...U,[d(j,B),"=",d(K,B)].join("")]}}function u(B){let j;switch(B.arrayFormat){case"index":return(U,K,J)=>{if(j=/\[(\d*)\]$/.exec(U),U=U.replace(/\[\d*\]$/,""),!j){J[U]=K;return}J[U]===void 0&&(J[U]={}),J[U][j[1]]=K};case"bracket":return(U,K,J)=>{if(j=/(\[\])$/.exec(U),U=U.replace(/\[\]$/,""),!j){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"colon-list-separator":return(U,K,J)=>{if(j=/(:list)$/.exec(U),U=U.replace(/:list$/,""),!j){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"comma":case"separator":return(U,K,J)=>{const T=typeof K=="string"&&K.includes(B.arrayFormatSeparator),z=typeof K=="string"&&!T&&g(K,B).includes(B.arrayFormatSeparator);K=z?g(K,B):K;const ue=T||z?K.split(B.arrayFormatSeparator).map(_e=>g(_e,B)):K===null?K:g(K,B);J[U]=ue};case"bracket-separator":return(U,K,J)=>{const T=/(\[\])$/.test(U);if(U=U.replace(/\[\]$/,""),!T){J[U]=K&&g(K,B);return}const z=K===null?[]:K.split(B.arrayFormatSeparator).map(ue=>g(ue,B));if(J[U]===void 0){J[U]=z;return}J[U]=[].concat(J[U],z)};default:return(U,K,J)=>{if(J[U]===void 0){J[U]=K;return}J[U]=[].concat(J[U],K)}}}function l(B){if(typeof B!="string"||B.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function d(B,j){return j.encode?j.strict?e(B):encodeURIComponent(B):B}function g(B,j){return j.decode?r(B):B}function y(B){return Array.isArray(B)?B.sort():typeof B=="object"?y(Object.keys(B)).sort((j,U)=>Number(j)-Number(U)).map(j=>B[j]):B}function A(B){const j=B.indexOf("#");return j!==-1&&(B=B.slice(0,j)),B}function P(B){let j="";const U=B.indexOf("#");return U!==-1&&(j=B.slice(U)),j}function O(B){B=A(B);const j=B.indexOf("?");return j===-1?"":B.slice(j+1)}function D(B,j){return j.parseNumbers&&!Number.isNaN(Number(B))&&typeof B=="string"&&B.trim()!==""?B=Number(B):j.parseBooleans&&B!==null&&(B.toLowerCase()==="true"||B.toLowerCase()==="false")&&(B=B.toLowerCase()==="true"),B}function k(B,j){j=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},j),l(j.arrayFormatSeparator);const U=u(j),K=Object.create(null);if(typeof B!="string"||(B=B.trim().replace(/^[?#&]/,""),!B))return K;for(const J of B.split("&")){if(J==="")continue;let[T,z]=n(j.decode?J.replace(/\+/g," "):J,"=");z=z===void 0?null:["comma","separator","bracket-separator"].includes(j.arrayFormat)?z:g(z,j),U(g(T,j),z,K)}for(const J of Object.keys(K)){const T=K[J];if(typeof T=="object"&&T!==null)for(const z of Object.keys(T))T[z]=D(T[z],j);else K[J]=D(T,j)}return j.sort===!1?K:(j.sort===!0?Object.keys(K).sort():Object.keys(K).sort(j.sort)).reduce((J,T)=>{const z=K[T];return z&&typeof z=="object"&&!Array.isArray(z)?J[T]=y(z):J[T]=z,J},Object.create(null))}t.extract=O,t.parse=k,t.stringify=(B,j)=>{if(!B)return"";j=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},j),l(j.arrayFormatSeparator);const U=z=>j.skipNull&&s(B[z])||j.skipEmptyString&&B[z]==="",K=a(j),J={};for(const z of Object.keys(B))U(z)||(J[z]=B[z]);const T=Object.keys(J);return j.sort!==!1&&T.sort(j.sort),T.map(z=>{const ue=B[z];return ue===void 0?"":ue===null?d(z,j):Array.isArray(ue)?ue.length===0&&j.arrayFormat==="bracket-separator"?d(z,j)+"[]":ue.reduce(K(z),[]).join("&"):d(z,j)+"="+d(ue,j)}).filter(z=>z.length>0).join("&")},t.parseUrl=(B,j)=>{j=Object.assign({decode:!0},j);const[U,K]=n(B,"#");return Object.assign({url:U.split("?")[0]||"",query:k(O(B),j)},j&&j.parseFragmentIdentifier&&K?{fragmentIdentifier:g(K,j)}:{})},t.stringifyUrl=(B,j)=>{j=Object.assign({encode:!0,strict:!0,[o]:!0},j);const U=A(B.url).split("?")[0]||"",K=t.extract(B.url),J=t.parse(K,{sort:!1}),T=Object.assign(J,B.query);let z=t.stringify(T,j);z&&(z=`?${z}`);let ue=P(B.url);return B.fragmentIdentifier&&(ue=`#${j[o]?d(B.fragmentIdentifier,j):B.fragmentIdentifier}`),`${U}${z}${ue}`},t.pick=(B,j,U)=>{U=Object.assign({parseFragmentIdentifier:!0,[o]:!1},U);const{url:K,query:J,fragmentIdentifier:T}=t.parseUrl(B,U);return t.stringifyUrl({url:K,query:i(J,j),fragmentIdentifier:T},U)},t.exclude=(B,j,U)=>{const K=Array.isArray(j)?J=>!j.includes(J):(J,T)=>!j(J,T);return t.pick(B,K,U)}})(il);var Dx={exports:{}};/** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.8.0 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT - */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=nn:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],g=[4,1024,262144,67108864],y=[1,256,65536,16777216],A=[6,1536,393216,100663296],P=[0,8,16,24],N=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],D=[224,256,384,512],k=[128,256],$=["hex","buffer","arrayBuffer","array","digest"],q={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(O){return Object.prototype.toString.call(O)==="[object Array]"}),u&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(O){return typeof O=="object"&&O.buffer&&O.buffer.constructor===ArrayBuffer});for(var U=function(O,se,ee){return function(X){return new I(O,se,O).update(X)[ee]()}},K=function(O,se,ee){return function(X,Q){return new I(O,se,Q).update(X)[ee]()}},J=function(O,se,ee){return function(X,Q,R,Z){return f["cshake"+O].update(X,Q,R,Z)[ee]()}},T=function(O,se,ee){return function(X,Q,R,Z){return f["kmac"+O].update(X,Q,R,Z)[ee]()}},z=function(O,se,ee,X){for(var Q=0;Q<$.length;++Q){var R=$[Q];O[R]=se(ee,X,R)}return O},ue=function(O,se){var ee=U(O,se,"hex");return ee.create=function(){return new I(O,se,O)},ee.update=function(X){return ee.create().update(X)},z(ee,U,O,se)},_e=function(O,se){var ee=K(O,se,"hex");return ee.create=function(X){return new I(O,se,X)},ee.update=function(X,Q){return ee.create(Q).update(X)},z(ee,K,O,se)},G=function(O,se){var ee=q[O],X=J(O,se,"hex");return X.create=function(Q,R,Z){return!R&&!Z?f["shake"+O].create(Q):new I(O,se,Q).bytepad([R,Z],ee)},X.update=function(Q,R,Z,te){return X.create(R,Z,te).update(Q)},z(X,J,O,se)},E=function(O,se){var ee=q[O],X=T(O,se,"hex");return X.create=function(Q,R,Z){return new F(O,se,R).bytepad(["KMAC",Z],ee).bytepad([Q],ee)},X.update=function(Q,R,Z,te){return X.create(Q,Z,te).update(R)},z(X,T,O,se)},m=[{name:"keccak",padding:y,bits:D,createMethod:ue},{name:"sha3",padding:A,bits:D,createMethod:ue},{name:"shake",padding:d,bits:k,createMethod:_e},{name:"cshake",padding:g,bits:k,createMethod:G},{name:"kmac",padding:g,bits:k,createMethod:E}],f={},p=[],v=0;v>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ee>>5,this.extraBytes=(ee&31)>>3;for(var X=0;X<50;++X)this.s[X]=0}I.prototype.update=function(O){if(this.finalized)throw new Error(r);var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}for(var X=this.blocks,Q=this.byteCount,R=O.length,Z=this.blockCount,te=0,le=this.s,ie,fe;te>2]|=O[te]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(X[ie>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=Q){for(this.start=ie-Q,this.block=X[Z],ie=0;ie>8,ee=O&255;ee>0;)Q.unshift(ee),O=O>>8,ee=O&255,++X;return se?Q.push(X):Q.unshift(X),this.update(Q),Q.length},I.prototype.encodeString=function(O){var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}var X=0,Q=O.length;if(se)X=Q;else for(var R=0;R=57344?X+=3:(Z=65536+((Z&1023)<<10|O.charCodeAt(++R)&1023),X+=4)}return X+=this.encode(X*8),this.update(O),X},I.prototype.bytepad=function(O,se){for(var ee=this.encode(se),X=0;X>2]|=this.padding[se&3],this.lastByteIndex===this.byteCount)for(O[0]=O[ee],se=1;se>4&15]+l[te&15]+l[te>>12&15]+l[te>>8&15]+l[te>>20&15]+l[te>>16&15]+l[te>>28&15]+l[te>>24&15];R%O===0&&(ae(se),Q=0)}return X&&(te=se[Q],Z+=l[te>>4&15]+l[te&15],X>1&&(Z+=l[te>>12&15]+l[te>>8&15]),X>2&&(Z+=l[te>>20&15]+l[te>>16&15])),Z},I.prototype.arrayBuffer=function(){this.finalize();var O=this.blockCount,se=this.s,ee=this.outputBlocks,X=this.extraBytes,Q=0,R=0,Z=this.outputBits>>3,te;X?te=new ArrayBuffer(ee+1<<2):te=new ArrayBuffer(Z);for(var le=new Uint32Array(te);R>8&255,Z[te+2]=le>>16&255,Z[te+3]=le>>24&255;R%O===0&&ae(se)}return X&&(te=R<<2,le=se[Q],Z[te]=le&255,X>1&&(Z[te+1]=le>>8&255),X>2&&(Z[te+2]=le>>16&255)),Z};function F(O,se,ee){I.call(this,O,se,ee)}F.prototype=new I,F.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var ae=function(O){var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me,Ne,Te,Be,Ie,Le,Ve,ke,ze,He,Ee,Qe,ct,$e,et,rt,Je,pt,ht,ft,Ht,Jt,St,er,Xt,Ot,$t,Tt,vt,Dt,Lt,bt,Bt,Ut,nt,Ft,B,H,V,C,Y,j,oe,pe,xe,Re,De,it,je,gt,st,tt;for(X=0;X<48;X+=2)Q=O[0]^O[10]^O[20]^O[30]^O[40],R=O[1]^O[11]^O[21]^O[31]^O[41],Z=O[2]^O[12]^O[22]^O[32]^O[42],te=O[3]^O[13]^O[23]^O[33]^O[43],le=O[4]^O[14]^O[24]^O[34]^O[44],ie=O[5]^O[15]^O[25]^O[35]^O[45],fe=O[6]^O[16]^O[26]^O[36]^O[46],ve=O[7]^O[17]^O[27]^O[37]^O[47],Me=O[8]^O[18]^O[28]^O[38]^O[48],Ne=O[9]^O[19]^O[29]^O[39]^O[49],se=Me^(Z<<1|te>>>31),ee=Ne^(te<<1|Z>>>31),O[0]^=se,O[1]^=ee,O[10]^=se,O[11]^=ee,O[20]^=se,O[21]^=ee,O[30]^=se,O[31]^=ee,O[40]^=se,O[41]^=ee,se=Q^(le<<1|ie>>>31),ee=R^(ie<<1|le>>>31),O[2]^=se,O[3]^=ee,O[12]^=se,O[13]^=ee,O[22]^=se,O[23]^=ee,O[32]^=se,O[33]^=ee,O[42]^=se,O[43]^=ee,se=Z^(fe<<1|ve>>>31),ee=te^(ve<<1|fe>>>31),O[4]^=se,O[5]^=ee,O[14]^=se,O[15]^=ee,O[24]^=se,O[25]^=ee,O[34]^=se,O[35]^=ee,O[44]^=se,O[45]^=ee,se=le^(Me<<1|Ne>>>31),ee=ie^(Ne<<1|Me>>>31),O[6]^=se,O[7]^=ee,O[16]^=se,O[17]^=ee,O[26]^=se,O[27]^=ee,O[36]^=se,O[37]^=ee,O[46]^=se,O[47]^=ee,se=fe^(Q<<1|R>>>31),ee=ve^(R<<1|Q>>>31),O[8]^=se,O[9]^=ee,O[18]^=se,O[19]^=ee,O[28]^=se,O[29]^=ee,O[38]^=se,O[39]^=ee,O[48]^=se,O[49]^=ee,Te=O[0],Be=O[1],nt=O[11]<<4|O[10]>>>28,Ft=O[10]<<4|O[11]>>>28,Je=O[20]<<3|O[21]>>>29,pt=O[21]<<3|O[20]>>>29,je=O[31]<<9|O[30]>>>23,gt=O[30]<<9|O[31]>>>23,Lt=O[40]<<18|O[41]>>>14,bt=O[41]<<18|O[40]>>>14,St=O[2]<<1|O[3]>>>31,er=O[3]<<1|O[2]>>>31,Ie=O[13]<<12|O[12]>>>20,Le=O[12]<<12|O[13]>>>20,B=O[22]<<10|O[23]>>>22,H=O[23]<<10|O[22]>>>22,ht=O[33]<<13|O[32]>>>19,ft=O[32]<<13|O[33]>>>19,st=O[42]<<2|O[43]>>>30,tt=O[43]<<2|O[42]>>>30,oe=O[5]<<30|O[4]>>>2,pe=O[4]<<30|O[5]>>>2,Xt=O[14]<<6|O[15]>>>26,Ot=O[15]<<6|O[14]>>>26,Ve=O[25]<<11|O[24]>>>21,ke=O[24]<<11|O[25]>>>21,V=O[34]<<15|O[35]>>>17,C=O[35]<<15|O[34]>>>17,Ht=O[45]<<29|O[44]>>>3,Jt=O[44]<<29|O[45]>>>3,ct=O[6]<<28|O[7]>>>4,$e=O[7]<<28|O[6]>>>4,xe=O[17]<<23|O[16]>>>9,Re=O[16]<<23|O[17]>>>9,$t=O[26]<<25|O[27]>>>7,Tt=O[27]<<25|O[26]>>>7,ze=O[36]<<21|O[37]>>>11,He=O[37]<<21|O[36]>>>11,Y=O[47]<<24|O[46]>>>8,j=O[46]<<24|O[47]>>>8,Bt=O[8]<<27|O[9]>>>5,Ut=O[9]<<27|O[8]>>>5,et=O[18]<<20|O[19]>>>12,rt=O[19]<<20|O[18]>>>12,De=O[29]<<7|O[28]>>>25,it=O[28]<<7|O[29]>>>25,vt=O[38]<<8|O[39]>>>24,Dt=O[39]<<8|O[38]>>>24,Ee=O[48]<<14|O[49]>>>18,Qe=O[49]<<14|O[48]>>>18,O[0]=Te^~Ie&Ve,O[1]=Be^~Le&ke,O[10]=ct^~et&Je,O[11]=$e^~rt&pt,O[20]=St^~Xt&$t,O[21]=er^~Ot&Tt,O[30]=Bt^~nt&B,O[31]=Ut^~Ft&H,O[40]=oe^~xe&De,O[41]=pe^~Re&it,O[2]=Ie^~Ve&ze,O[3]=Le^~ke&He,O[12]=et^~Je&ht,O[13]=rt^~pt&ft,O[22]=Xt^~$t&vt,O[23]=Ot^~Tt&Dt,O[32]=nt^~B&V,O[33]=Ft^~H&C,O[42]=xe^~De&je,O[43]=Re^~it>,O[4]=Ve^~ze&Ee,O[5]=ke^~He&Qe,O[14]=Je^~ht&Ht,O[15]=pt^~ft&Jt,O[24]=$t^~vt&Lt,O[25]=Tt^~Dt&bt,O[34]=B^~V&Y,O[35]=H^~C&j,O[44]=De^~je&st,O[45]=it^~gt&tt,O[6]=ze^~Ee&Te,O[7]=He^~Qe&Be,O[16]=ht^~Ht&ct,O[17]=ft^~Jt&$e,O[26]=vt^~Lt&St,O[27]=Dt^~bt&er,O[36]=V^~Y&Bt,O[37]=C^~j&Ut,O[46]=je^~st&oe,O[47]=gt^~tt&pe,O[8]=Ee^~Te&Ie,O[9]=Qe^~Be&Le,O[18]=Ht^~ct&et,O[19]=Jt^~$e&rt,O[28]=Lt^~St&Xt,O[29]=bt^~er&Ot,O[38]=Y^~Bt&nt,O[39]=j^~Ut&Ft,O[48]=st^~oe&xe,O[49]=tt^~pe&Re,O[0]^=N[X],O[1]^=N[X+1]};if(a)t.exports=f;else for(v=0;v{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const Nx=sN();var wm;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(wm||(wm={}));var ds;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(ds||(ds={}));const Lx="0123456789abcdef";class Kr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();md[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Ox>md[n])&&console.log.apply(console,r)}debug(...e){this._log(Kr.levels.DEBUG,e)}info(...e){this._log(Kr.levels.INFO,e)}warn(...e){this._log(Kr.levels.WARNING,e)}makeError(e,r,n){if(Dx)return this.makeError("censored error",r,{});r||(r=Kr.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(u=>{const l=n[u];try{if(l instanceof Uint8Array){let d="";for(let g=0;g>4],d+=Lx[l[g]&15];i.push(u+"=Uint8Array(0x"+d+")")}else i.push(u+"="+JSON.stringify(l))}catch{i.push(u+"="+JSON.stringify(n[u].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case ds.NUMERIC_FAULT:{o="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case ds.CALL_EXCEPTION:case ds.INSUFFICIENT_FUNDS:case ds.MISSING_NEW:case ds.NONCE_EXPIRED:case ds.REPLACEMENT_UNDERPRICED:case ds.TRANSACTION_REPLACED:case ds.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(u){a[u]=n[u]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Kr.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){Nx&&this.throwError("platform missing String.prototype.normalize",Kr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Nx})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Kr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Kr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return ym||(ym=new Kr(iN)),ym}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Rx){if(!e)return;this.globalLogger().throwError("error censorship permanent",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Dx=!!e,Rx=!!r}static setLogLevel(e){const r=md[e.toLowerCase()];if(r==null){Kr.globalLogger().warn("invalid log level - "+e);return}Ox=r}static from(e){return new Kr(e)}}Kr.errors=ds,Kr.levels=wm;const oN="bytes/5.7.0",on=new Kr(oN);function kx(t){return!!t.toHexString}function cu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return cu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function aN(t){return Os(t)&&!(t.length%2)||xm(t)}function $x(t){return typeof t=="number"&&t==t&&t%1===0}function xm(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!$x(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function bn(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),cu(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t)&&(t=t.toHexString()),Os(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":on.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ibn(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),cu(n)}function uN(t,e){t=bn(t),t.length>e&&on.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),cu(r)}function Os(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const _m="0123456789abcdef";function Ii(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=_m[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t))return t.toHexString();if(Os(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":on.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(xm(t)){let r="0x";for(let n=0;n>4]+_m[i&15]}return r}return on.throwArgumentError("invalid hexlify value","value",t)}function fN(t){if(typeof t!="string")t=Ii(t);else if(!Os(t)||t.length%2)return null;return(t.length-2)/2}function Bx(t,e,r){return typeof t!="string"?t=Ii(t):(!Os(t)||t.length%2)&&on.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function uu(t,e){for(typeof t!="string"?t=Ii(t):Os(t)||on.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&on.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Fx(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(aN(t)){let r=bn(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64))):r.length===65?(e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64)),e.v=r[64]):on.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:on.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Ii(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=uN(bn(e._vs),32);e._vs=Ii(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&on.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=Ii(i);e.s==null?e.s=o:e.s!==o&&on.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?on.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&on.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Os(e.r)?on.throwArgumentError("signature missing or invalid r","signature",t):e.r=uu(e.r,32),e.s==null||!Os(e.s)?on.throwArgumentError("signature missing or invalid s","signature",t):e.s=uu(e.s,32);const r=bn(e.s);r[0]>=128&&on.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=Ii(r);e._vs&&(Os(e._vs)||on.throwArgumentError("signature invalid _vs","signature",t),e._vs=uu(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&on.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Em(t){return"0x"+nN.keccak_256(bn(t))}var Sm={exports:{}};Sm.exports,function(t){(function(e,r){function n(m,f){if(!m)throw new Error(f||"Assertion failed")}function i(m,f){m.super_=f;var p=function(){};p.prototype=f.prototype,m.prototype=new p,m.prototype.constructor=m}function s(m,f,p){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((f==="le"||f==="be")&&(p=f,f=10),this._init(m||0,f||10,p||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=el.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,p){return f.cmp(p)>0?f:p},s.min=function(f,p){return f.cmp(p)<0?f:p},s.prototype._init=function(f,p,v){if(typeof f=="number")return this._initNumber(f,p,v);if(typeof f=="object")return this._initArray(f,p,v);p==="hex"&&(p=16),n(p===(p|0)&&p>=2&&p<=36),f=f.toString().replace(/\s+/g,"");var x=0;f[0]==="-"&&(x++,this.negative=1),x=0;x-=3)S=f[x]|f[x-1]<<8|f[x-2]<<16,this.words[_]|=S<>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);else if(v==="le")for(x=0,_=0;x>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);return this._strip()};function a(m,f){var p=m.charCodeAt(f);if(p>=48&&p<=57)return p-48;if(p>=65&&p<=70)return p-55;if(p>=97&&p<=102)return p-87;n(!1,"Invalid character in "+m)}function u(m,f,p){var v=a(m,p);return p-1>=f&&(v|=a(m,p-1)<<4),v}s.prototype._parseHex=function(f,p,v){this.length=Math.ceil((f.length-p)/6),this.words=new Array(this.length);for(var x=0;x=p;x-=2)b=u(f,p,x)<<_,this.words[S]|=b&67108863,_>=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8;else{var M=f.length-p;for(x=M%2===0?p+1:p;x=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8}this._strip()};function l(m,f,p,v){for(var x=0,_=0,S=Math.min(m.length,p),b=f;b=49?_=M-49+10:M>=17?_=M-17+10:_=M,n(M>=0&&_1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=g}catch{s.prototype.inspect=g}else s.prototype.inspect=g;function g(){return(this.red?""}var y=["","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"],A=[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,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(f,p){f=f||10,p=p|0||1;var v;if(f===16||f==="hex"){v="";for(var x=0,_=0,S=0;S>>24-x&16777215,x+=2,x>=26&&(x-=26,S--),_!==0||S!==this.length-1?v=y[6-M.length]+M+v:v=M+v}for(_!==0&&(v=_.toString(16)+v);v.length%p!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(f===(f|0)&&f>=2&&f<=36){var I=A[f],F=P[f];v="";var ae=this.clone();for(ae.negative=0;!ae.isZero();){var O=ae.modrn(F).toString(f);ae=ae.idivn(F),ae.isZero()?v=O+v:v=y[I-O.length]+O+v}for(this.isZero()&&(v="0"+v);v.length%p!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,p){return this.toArrayLike(o,f,p)}),s.prototype.toArray=function(f,p){return this.toArrayLike(Array,f,p)};var N=function(f,p){return f.allocUnsafe?f.allocUnsafe(p):new f(p)};s.prototype.toArrayLike=function(f,p,v){this._strip();var x=this.byteLength(),_=v||Math.max(1,x);n(x<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var S=N(f,_),b=p==="le"?"LE":"BE";return this["_toArrayLike"+b](S,x),S},s.prototype._toArrayLikeLE=function(f,p){for(var v=0,x=0,_=0,S=0;_>8&255),v>16&255),S===6?(v>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v=0&&(f[v--]=b>>8&255),v>=0&&(f[v--]=b>>16&255),S===6?(v>=0&&(f[v--]=b>>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v>=0)for(f[v--]=x;v>=0;)f[v--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var p=f,v=0;return p>=4096&&(v+=13,p>>>=13),p>=64&&(v+=7,p>>>=7),p>=8&&(v+=4,p>>>=4),p>=2&&(v+=2,p>>>=2),v+p},s.prototype._zeroBits=function(f){if(f===0)return 26;var p=f,v=0;return p&8191||(v+=13,p>>>=13),p&127||(v+=7,p>>>=7),p&15||(v+=4,p>>>=4),p&3||(v+=2,p>>>=2),p&1||v++,v},s.prototype.bitLength=function(){var f=this.words[this.length-1],p=this._countBits(f);return(this.length-1)*26+p};function D(m){for(var f=new Array(m.bitLength()),p=0;p>>x&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,p=0;pf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var p;this.length>f.length?p=f:p=this;for(var v=0;vf.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var p,v;this.length>f.length?(p=this,v=f):(p=f,v=this);for(var x=0;xf.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var p=Math.ceil(f/26)|0,v=f%26;this._expand(p),v>0&&p--;for(var x=0;x0&&(this.words[x]=~this.words[x]&67108863>>26-v),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,p){n(typeof f=="number"&&f>=0);var v=f/26|0,x=f%26;return this._expand(v+1),p?this.words[v]=this.words[v]|1<f.length?(v=this,x=f):(v=f,x=this);for(var _=0,S=0;S>>26;for(;_!==0&&S>>26;if(this.length=v.length,_!==0)this.words[this.length]=_,this.length++;else if(v!==this)for(;Sf.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var p=this.iadd(f);return f.negative=1,p._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var v=this.cmp(f);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,_;v>0?(x=this,_=f):(x=f,_=this);for(var S=0,b=0;b<_.length;b++)p=(x.words[b]|0)-(_.words[b]|0)+S,S=p>>26,this.words[b]=p&67108863;for(;S!==0&&b>26,this.words[b]=p&67108863;if(S===0&&b>>26,ae=M&67108863,O=Math.min(I,f.length-1),se=Math.max(0,I-m.length+1);se<=O;se++){var ee=I-se|0;x=m.words[ee]|0,_=f.words[se]|0,S=x*_+ae,F+=S/67108864|0,ae=S&67108863}p.words[I]=ae|0,M=F|0}return M!==0?p.words[I]=M|0:p.length--,p._strip()}var $=function(f,p,v){var x=f.words,_=p.words,S=v.words,b=0,M,I,F,ae=x[0]|0,O=ae&8191,se=ae>>>13,ee=x[1]|0,X=ee&8191,Q=ee>>>13,R=x[2]|0,Z=R&8191,te=R>>>13,le=x[3]|0,ie=le&8191,fe=le>>>13,ve=x[4]|0,Me=ve&8191,Ne=ve>>>13,Te=x[5]|0,Be=Te&8191,Ie=Te>>>13,Le=x[6]|0,Ve=Le&8191,ke=Le>>>13,ze=x[7]|0,He=ze&8191,Ee=ze>>>13,Qe=x[8]|0,ct=Qe&8191,$e=Qe>>>13,et=x[9]|0,rt=et&8191,Je=et>>>13,pt=_[0]|0,ht=pt&8191,ft=pt>>>13,Ht=_[1]|0,Jt=Ht&8191,St=Ht>>>13,er=_[2]|0,Xt=er&8191,Ot=er>>>13,$t=_[3]|0,Tt=$t&8191,vt=$t>>>13,Dt=_[4]|0,Lt=Dt&8191,bt=Dt>>>13,Bt=_[5]|0,Ut=Bt&8191,nt=Bt>>>13,Ft=_[6]|0,B=Ft&8191,H=Ft>>>13,V=_[7]|0,C=V&8191,Y=V>>>13,j=_[8]|0,oe=j&8191,pe=j>>>13,xe=_[9]|0,Re=xe&8191,De=xe>>>13;v.negative=f.negative^p.negative,v.length=19,M=Math.imul(O,ht),I=Math.imul(O,ft),I=I+Math.imul(se,ht)|0,F=Math.imul(se,ft);var it=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(it>>>26)|0,it&=67108863,M=Math.imul(X,ht),I=Math.imul(X,ft),I=I+Math.imul(Q,ht)|0,F=Math.imul(Q,ft),M=M+Math.imul(O,Jt)|0,I=I+Math.imul(O,St)|0,I=I+Math.imul(se,Jt)|0,F=F+Math.imul(se,St)|0;var je=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(je>>>26)|0,je&=67108863,M=Math.imul(Z,ht),I=Math.imul(Z,ft),I=I+Math.imul(te,ht)|0,F=Math.imul(te,ft),M=M+Math.imul(X,Jt)|0,I=I+Math.imul(X,St)|0,I=I+Math.imul(Q,Jt)|0,F=F+Math.imul(Q,St)|0,M=M+Math.imul(O,Xt)|0,I=I+Math.imul(O,Ot)|0,I=I+Math.imul(se,Xt)|0,F=F+Math.imul(se,Ot)|0;var gt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(gt>>>26)|0,gt&=67108863,M=Math.imul(ie,ht),I=Math.imul(ie,ft),I=I+Math.imul(fe,ht)|0,F=Math.imul(fe,ft),M=M+Math.imul(Z,Jt)|0,I=I+Math.imul(Z,St)|0,I=I+Math.imul(te,Jt)|0,F=F+Math.imul(te,St)|0,M=M+Math.imul(X,Xt)|0,I=I+Math.imul(X,Ot)|0,I=I+Math.imul(Q,Xt)|0,F=F+Math.imul(Q,Ot)|0,M=M+Math.imul(O,Tt)|0,I=I+Math.imul(O,vt)|0,I=I+Math.imul(se,Tt)|0,F=F+Math.imul(se,vt)|0;var st=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(st>>>26)|0,st&=67108863,M=Math.imul(Me,ht),I=Math.imul(Me,ft),I=I+Math.imul(Ne,ht)|0,F=Math.imul(Ne,ft),M=M+Math.imul(ie,Jt)|0,I=I+Math.imul(ie,St)|0,I=I+Math.imul(fe,Jt)|0,F=F+Math.imul(fe,St)|0,M=M+Math.imul(Z,Xt)|0,I=I+Math.imul(Z,Ot)|0,I=I+Math.imul(te,Xt)|0,F=F+Math.imul(te,Ot)|0,M=M+Math.imul(X,Tt)|0,I=I+Math.imul(X,vt)|0,I=I+Math.imul(Q,Tt)|0,F=F+Math.imul(Q,vt)|0,M=M+Math.imul(O,Lt)|0,I=I+Math.imul(O,bt)|0,I=I+Math.imul(se,Lt)|0,F=F+Math.imul(se,bt)|0;var tt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(tt>>>26)|0,tt&=67108863,M=Math.imul(Be,ht),I=Math.imul(Be,ft),I=I+Math.imul(Ie,ht)|0,F=Math.imul(Ie,ft),M=M+Math.imul(Me,Jt)|0,I=I+Math.imul(Me,St)|0,I=I+Math.imul(Ne,Jt)|0,F=F+Math.imul(Ne,St)|0,M=M+Math.imul(ie,Xt)|0,I=I+Math.imul(ie,Ot)|0,I=I+Math.imul(fe,Xt)|0,F=F+Math.imul(fe,Ot)|0,M=M+Math.imul(Z,Tt)|0,I=I+Math.imul(Z,vt)|0,I=I+Math.imul(te,Tt)|0,F=F+Math.imul(te,vt)|0,M=M+Math.imul(X,Lt)|0,I=I+Math.imul(X,bt)|0,I=I+Math.imul(Q,Lt)|0,F=F+Math.imul(Q,bt)|0,M=M+Math.imul(O,Ut)|0,I=I+Math.imul(O,nt)|0,I=I+Math.imul(se,Ut)|0,F=F+Math.imul(se,nt)|0;var At=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(At>>>26)|0,At&=67108863,M=Math.imul(Ve,ht),I=Math.imul(Ve,ft),I=I+Math.imul(ke,ht)|0,F=Math.imul(ke,ft),M=M+Math.imul(Be,Jt)|0,I=I+Math.imul(Be,St)|0,I=I+Math.imul(Ie,Jt)|0,F=F+Math.imul(Ie,St)|0,M=M+Math.imul(Me,Xt)|0,I=I+Math.imul(Me,Ot)|0,I=I+Math.imul(Ne,Xt)|0,F=F+Math.imul(Ne,Ot)|0,M=M+Math.imul(ie,Tt)|0,I=I+Math.imul(ie,vt)|0,I=I+Math.imul(fe,Tt)|0,F=F+Math.imul(fe,vt)|0,M=M+Math.imul(Z,Lt)|0,I=I+Math.imul(Z,bt)|0,I=I+Math.imul(te,Lt)|0,F=F+Math.imul(te,bt)|0,M=M+Math.imul(X,Ut)|0,I=I+Math.imul(X,nt)|0,I=I+Math.imul(Q,Ut)|0,F=F+Math.imul(Q,nt)|0,M=M+Math.imul(O,B)|0,I=I+Math.imul(O,H)|0,I=I+Math.imul(se,B)|0,F=F+Math.imul(se,H)|0;var Rt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,M=Math.imul(He,ht),I=Math.imul(He,ft),I=I+Math.imul(Ee,ht)|0,F=Math.imul(Ee,ft),M=M+Math.imul(Ve,Jt)|0,I=I+Math.imul(Ve,St)|0,I=I+Math.imul(ke,Jt)|0,F=F+Math.imul(ke,St)|0,M=M+Math.imul(Be,Xt)|0,I=I+Math.imul(Be,Ot)|0,I=I+Math.imul(Ie,Xt)|0,F=F+Math.imul(Ie,Ot)|0,M=M+Math.imul(Me,Tt)|0,I=I+Math.imul(Me,vt)|0,I=I+Math.imul(Ne,Tt)|0,F=F+Math.imul(Ne,vt)|0,M=M+Math.imul(ie,Lt)|0,I=I+Math.imul(ie,bt)|0,I=I+Math.imul(fe,Lt)|0,F=F+Math.imul(fe,bt)|0,M=M+Math.imul(Z,Ut)|0,I=I+Math.imul(Z,nt)|0,I=I+Math.imul(te,Ut)|0,F=F+Math.imul(te,nt)|0,M=M+Math.imul(X,B)|0,I=I+Math.imul(X,H)|0,I=I+Math.imul(Q,B)|0,F=F+Math.imul(Q,H)|0,M=M+Math.imul(O,C)|0,I=I+Math.imul(O,Y)|0,I=I+Math.imul(se,C)|0,F=F+Math.imul(se,Y)|0;var Mt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,M=Math.imul(ct,ht),I=Math.imul(ct,ft),I=I+Math.imul($e,ht)|0,F=Math.imul($e,ft),M=M+Math.imul(He,Jt)|0,I=I+Math.imul(He,St)|0,I=I+Math.imul(Ee,Jt)|0,F=F+Math.imul(Ee,St)|0,M=M+Math.imul(Ve,Xt)|0,I=I+Math.imul(Ve,Ot)|0,I=I+Math.imul(ke,Xt)|0,F=F+Math.imul(ke,Ot)|0,M=M+Math.imul(Be,Tt)|0,I=I+Math.imul(Be,vt)|0,I=I+Math.imul(Ie,Tt)|0,F=F+Math.imul(Ie,vt)|0,M=M+Math.imul(Me,Lt)|0,I=I+Math.imul(Me,bt)|0,I=I+Math.imul(Ne,Lt)|0,F=F+Math.imul(Ne,bt)|0,M=M+Math.imul(ie,Ut)|0,I=I+Math.imul(ie,nt)|0,I=I+Math.imul(fe,Ut)|0,F=F+Math.imul(fe,nt)|0,M=M+Math.imul(Z,B)|0,I=I+Math.imul(Z,H)|0,I=I+Math.imul(te,B)|0,F=F+Math.imul(te,H)|0,M=M+Math.imul(X,C)|0,I=I+Math.imul(X,Y)|0,I=I+Math.imul(Q,C)|0,F=F+Math.imul(Q,Y)|0,M=M+Math.imul(O,oe)|0,I=I+Math.imul(O,pe)|0,I=I+Math.imul(se,oe)|0,F=F+Math.imul(se,pe)|0;var Et=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Et>>>26)|0,Et&=67108863,M=Math.imul(rt,ht),I=Math.imul(rt,ft),I=I+Math.imul(Je,ht)|0,F=Math.imul(Je,ft),M=M+Math.imul(ct,Jt)|0,I=I+Math.imul(ct,St)|0,I=I+Math.imul($e,Jt)|0,F=F+Math.imul($e,St)|0,M=M+Math.imul(He,Xt)|0,I=I+Math.imul(He,Ot)|0,I=I+Math.imul(Ee,Xt)|0,F=F+Math.imul(Ee,Ot)|0,M=M+Math.imul(Ve,Tt)|0,I=I+Math.imul(Ve,vt)|0,I=I+Math.imul(ke,Tt)|0,F=F+Math.imul(ke,vt)|0,M=M+Math.imul(Be,Lt)|0,I=I+Math.imul(Be,bt)|0,I=I+Math.imul(Ie,Lt)|0,F=F+Math.imul(Ie,bt)|0,M=M+Math.imul(Me,Ut)|0,I=I+Math.imul(Me,nt)|0,I=I+Math.imul(Ne,Ut)|0,F=F+Math.imul(Ne,nt)|0,M=M+Math.imul(ie,B)|0,I=I+Math.imul(ie,H)|0,I=I+Math.imul(fe,B)|0,F=F+Math.imul(fe,H)|0,M=M+Math.imul(Z,C)|0,I=I+Math.imul(Z,Y)|0,I=I+Math.imul(te,C)|0,F=F+Math.imul(te,Y)|0,M=M+Math.imul(X,oe)|0,I=I+Math.imul(X,pe)|0,I=I+Math.imul(Q,oe)|0,F=F+Math.imul(Q,pe)|0,M=M+Math.imul(O,Re)|0,I=I+Math.imul(O,De)|0,I=I+Math.imul(se,Re)|0,F=F+Math.imul(se,De)|0;var dt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(dt>>>26)|0,dt&=67108863,M=Math.imul(rt,Jt),I=Math.imul(rt,St),I=I+Math.imul(Je,Jt)|0,F=Math.imul(Je,St),M=M+Math.imul(ct,Xt)|0,I=I+Math.imul(ct,Ot)|0,I=I+Math.imul($e,Xt)|0,F=F+Math.imul($e,Ot)|0,M=M+Math.imul(He,Tt)|0,I=I+Math.imul(He,vt)|0,I=I+Math.imul(Ee,Tt)|0,F=F+Math.imul(Ee,vt)|0,M=M+Math.imul(Ve,Lt)|0,I=I+Math.imul(Ve,bt)|0,I=I+Math.imul(ke,Lt)|0,F=F+Math.imul(ke,bt)|0,M=M+Math.imul(Be,Ut)|0,I=I+Math.imul(Be,nt)|0,I=I+Math.imul(Ie,Ut)|0,F=F+Math.imul(Ie,nt)|0,M=M+Math.imul(Me,B)|0,I=I+Math.imul(Me,H)|0,I=I+Math.imul(Ne,B)|0,F=F+Math.imul(Ne,H)|0,M=M+Math.imul(ie,C)|0,I=I+Math.imul(ie,Y)|0,I=I+Math.imul(fe,C)|0,F=F+Math.imul(fe,Y)|0,M=M+Math.imul(Z,oe)|0,I=I+Math.imul(Z,pe)|0,I=I+Math.imul(te,oe)|0,F=F+Math.imul(te,pe)|0,M=M+Math.imul(X,Re)|0,I=I+Math.imul(X,De)|0,I=I+Math.imul(Q,Re)|0,F=F+Math.imul(Q,De)|0;var _t=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(_t>>>26)|0,_t&=67108863,M=Math.imul(rt,Xt),I=Math.imul(rt,Ot),I=I+Math.imul(Je,Xt)|0,F=Math.imul(Je,Ot),M=M+Math.imul(ct,Tt)|0,I=I+Math.imul(ct,vt)|0,I=I+Math.imul($e,Tt)|0,F=F+Math.imul($e,vt)|0,M=M+Math.imul(He,Lt)|0,I=I+Math.imul(He,bt)|0,I=I+Math.imul(Ee,Lt)|0,F=F+Math.imul(Ee,bt)|0,M=M+Math.imul(Ve,Ut)|0,I=I+Math.imul(Ve,nt)|0,I=I+Math.imul(ke,Ut)|0,F=F+Math.imul(ke,nt)|0,M=M+Math.imul(Be,B)|0,I=I+Math.imul(Be,H)|0,I=I+Math.imul(Ie,B)|0,F=F+Math.imul(Ie,H)|0,M=M+Math.imul(Me,C)|0,I=I+Math.imul(Me,Y)|0,I=I+Math.imul(Ne,C)|0,F=F+Math.imul(Ne,Y)|0,M=M+Math.imul(ie,oe)|0,I=I+Math.imul(ie,pe)|0,I=I+Math.imul(fe,oe)|0,F=F+Math.imul(fe,pe)|0,M=M+Math.imul(Z,Re)|0,I=I+Math.imul(Z,De)|0,I=I+Math.imul(te,Re)|0,F=F+Math.imul(te,De)|0;var ot=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(ot>>>26)|0,ot&=67108863,M=Math.imul(rt,Tt),I=Math.imul(rt,vt),I=I+Math.imul(Je,Tt)|0,F=Math.imul(Je,vt),M=M+Math.imul(ct,Lt)|0,I=I+Math.imul(ct,bt)|0,I=I+Math.imul($e,Lt)|0,F=F+Math.imul($e,bt)|0,M=M+Math.imul(He,Ut)|0,I=I+Math.imul(He,nt)|0,I=I+Math.imul(Ee,Ut)|0,F=F+Math.imul(Ee,nt)|0,M=M+Math.imul(Ve,B)|0,I=I+Math.imul(Ve,H)|0,I=I+Math.imul(ke,B)|0,F=F+Math.imul(ke,H)|0,M=M+Math.imul(Be,C)|0,I=I+Math.imul(Be,Y)|0,I=I+Math.imul(Ie,C)|0,F=F+Math.imul(Ie,Y)|0,M=M+Math.imul(Me,oe)|0,I=I+Math.imul(Me,pe)|0,I=I+Math.imul(Ne,oe)|0,F=F+Math.imul(Ne,pe)|0,M=M+Math.imul(ie,Re)|0,I=I+Math.imul(ie,De)|0,I=I+Math.imul(fe,Re)|0,F=F+Math.imul(fe,De)|0;var wt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(wt>>>26)|0,wt&=67108863,M=Math.imul(rt,Lt),I=Math.imul(rt,bt),I=I+Math.imul(Je,Lt)|0,F=Math.imul(Je,bt),M=M+Math.imul(ct,Ut)|0,I=I+Math.imul(ct,nt)|0,I=I+Math.imul($e,Ut)|0,F=F+Math.imul($e,nt)|0,M=M+Math.imul(He,B)|0,I=I+Math.imul(He,H)|0,I=I+Math.imul(Ee,B)|0,F=F+Math.imul(Ee,H)|0,M=M+Math.imul(Ve,C)|0,I=I+Math.imul(Ve,Y)|0,I=I+Math.imul(ke,C)|0,F=F+Math.imul(ke,Y)|0,M=M+Math.imul(Be,oe)|0,I=I+Math.imul(Be,pe)|0,I=I+Math.imul(Ie,oe)|0,F=F+Math.imul(Ie,pe)|0,M=M+Math.imul(Me,Re)|0,I=I+Math.imul(Me,De)|0,I=I+Math.imul(Ne,Re)|0,F=F+Math.imul(Ne,De)|0;var lt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(lt>>>26)|0,lt&=67108863,M=Math.imul(rt,Ut),I=Math.imul(rt,nt),I=I+Math.imul(Je,Ut)|0,F=Math.imul(Je,nt),M=M+Math.imul(ct,B)|0,I=I+Math.imul(ct,H)|0,I=I+Math.imul($e,B)|0,F=F+Math.imul($e,H)|0,M=M+Math.imul(He,C)|0,I=I+Math.imul(He,Y)|0,I=I+Math.imul(Ee,C)|0,F=F+Math.imul(Ee,Y)|0,M=M+Math.imul(Ve,oe)|0,I=I+Math.imul(Ve,pe)|0,I=I+Math.imul(ke,oe)|0,F=F+Math.imul(ke,pe)|0,M=M+Math.imul(Be,Re)|0,I=I+Math.imul(Be,De)|0,I=I+Math.imul(Ie,Re)|0,F=F+Math.imul(Ie,De)|0;var at=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(at>>>26)|0,at&=67108863,M=Math.imul(rt,B),I=Math.imul(rt,H),I=I+Math.imul(Je,B)|0,F=Math.imul(Je,H),M=M+Math.imul(ct,C)|0,I=I+Math.imul(ct,Y)|0,I=I+Math.imul($e,C)|0,F=F+Math.imul($e,Y)|0,M=M+Math.imul(He,oe)|0,I=I+Math.imul(He,pe)|0,I=I+Math.imul(Ee,oe)|0,F=F+Math.imul(Ee,pe)|0,M=M+Math.imul(Ve,Re)|0,I=I+Math.imul(Ve,De)|0,I=I+Math.imul(ke,Re)|0,F=F+Math.imul(ke,De)|0;var Se=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Se>>>26)|0,Se&=67108863,M=Math.imul(rt,C),I=Math.imul(rt,Y),I=I+Math.imul(Je,C)|0,F=Math.imul(Je,Y),M=M+Math.imul(ct,oe)|0,I=I+Math.imul(ct,pe)|0,I=I+Math.imul($e,oe)|0,F=F+Math.imul($e,pe)|0,M=M+Math.imul(He,Re)|0,I=I+Math.imul(He,De)|0,I=I+Math.imul(Ee,Re)|0,F=F+Math.imul(Ee,De)|0;var Ae=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,M=Math.imul(rt,oe),I=Math.imul(rt,pe),I=I+Math.imul(Je,oe)|0,F=Math.imul(Je,pe),M=M+Math.imul(ct,Re)|0,I=I+Math.imul(ct,De)|0,I=I+Math.imul($e,Re)|0,F=F+Math.imul($e,De)|0;var Ge=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,M=Math.imul(rt,Re),I=Math.imul(rt,De),I=I+Math.imul(Je,Re)|0,F=Math.imul(Je,De);var Ue=(b+M|0)+((I&8191)<<13)|0;return b=(F+(I>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,S[0]=it,S[1]=je,S[2]=gt,S[3]=st,S[4]=tt,S[5]=At,S[6]=Rt,S[7]=Mt,S[8]=Et,S[9]=dt,S[10]=_t,S[11]=ot,S[12]=wt,S[13]=lt,S[14]=at,S[15]=Se,S[16]=Ae,S[17]=Ge,S[18]=Ue,b!==0&&(S[19]=b,v.length++),v};Math.imul||($=k);function q(m,f,p){p.negative=f.negative^m.negative,p.length=m.length+f.length;for(var v=0,x=0,_=0;_>>26)|0,x+=S>>>26,S&=67108863}p.words[_]=b,v=S,S=x}return v!==0?p.words[_]=v:p.length--,p._strip()}function U(m,f,p){return q(m,f,p)}s.prototype.mulTo=function(f,p){var v,x=this.length+f.length;return this.length===10&&f.length===10?v=$(this,f,p):x<63?v=k(this,f,p):x<1024?v=q(this,f,p):v=U(this,f,p),v},s.prototype.mul=function(f){var p=new s(null);return p.words=new Array(this.length+f.length),this.mulTo(f,p)},s.prototype.mulf=function(f){var p=new s(null);return p.words=new Array(this.length+f.length),U(this,f,p)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var p=f<0;p&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var v=0,x=0;x>=26,v+=_/67108864|0,v+=S>>>26,this.words[x]=S&67108863}return v!==0&&(this.words[x]=v,this.length++),p?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var p=D(f);if(p.length===0)return new s(1);for(var v=this,x=0;x=0);var p=f%26,v=(f-p)/26,x=67108863>>>26-p<<26-p,_;if(p!==0){var S=0;for(_=0;_>>26-p}S&&(this.words[_]=S,this.length++)}if(v!==0){for(_=this.length-1;_>=0;_--)this.words[_+v]=this.words[_];for(_=0;_=0);var x;p?x=(p-p%26)/26:x=0;var _=f%26,S=Math.min((f-_)/26,this.length),b=67108863^67108863>>>_<<_,M=v;if(x-=S,x=Math.max(0,x),M){for(var I=0;IS)for(this.length-=S,I=0;I=0&&(F!==0||I>=x);I--){var ae=this.words[I]|0;this.words[I]=F<<26-_|ae>>>_,F=ae&b}return M&&F!==0&&(M.words[M.length++]=F),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,p,v){return n(this.negative===0),this.iushrn(f,p,v)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var p=f%26,v=(f-p)/26,x=1<=0);var p=f%26,v=(f-p)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(p!==0&&v++,this.length=Math.min(v,this.length),p!==0){var x=67108863^67108863>>>p<=67108864;p++)this.words[p]-=67108864,p===this.length-1?this.words[p+1]=1:this.words[p+1]++;return this.length=Math.max(this.length,p+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var p=0;p>26)-(M/67108864|0),this.words[_+v]=S&67108863}for(;_>26,this.words[_+v]=S&67108863;if(b===0)return this._strip();for(n(b===-1),b=0,_=0;_>26,this.words[_]=S&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,p){var v=this.length-f.length,x=this.clone(),_=f,S=_.words[_.length-1]|0,b=this._countBits(S);v=26-b,v!==0&&(_=_.ushln(v),x.iushln(v),S=_.words[_.length-1]|0);var M=x.length-_.length,I;if(p!=="mod"){I=new s(null),I.length=M+1,I.words=new Array(I.length);for(var F=0;F=0;O--){var se=(x.words[_.length+O]|0)*67108864+(x.words[_.length+O-1]|0);for(se=Math.min(se/S|0,67108863),x._ishlnsubmul(_,se,O);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(_,1,O),x.isZero()||(x.negative^=1);I&&(I.words[O]=se)}return I&&I._strip(),x._strip(),p!=="div"&&v!==0&&x.iushrn(v),{div:I||null,mod:x}},s.prototype.divmod=function(f,p,v){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,_,S;return this.negative!==0&&f.negative===0?(S=this.neg().divmod(f,p),p!=="mod"&&(x=S.div.neg()),p!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.iadd(f)),{div:x,mod:_}):this.negative===0&&f.negative!==0?(S=this.divmod(f.neg(),p),p!=="mod"&&(x=S.div.neg()),{div:x,mod:S.mod}):this.negative&f.negative?(S=this.neg().divmod(f.neg(),p),p!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.isub(f)),{div:S.div,mod:_}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?p==="div"?{div:this.divn(f.words[0]),mod:null}:p==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,p)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var p=this.divmod(f);if(p.mod.isZero())return p.div;var v=p.div.negative!==0?p.mod.isub(f):p.mod,x=f.ushrn(1),_=f.andln(1),S=v.cmp(x);return S<0||_===1&&S===0?p.div:p.div.negative!==0?p.div.isubn(1):p.div.iaddn(1)},s.prototype.modrn=function(f){var p=f<0;p&&(f=-f),n(f<=67108863);for(var v=(1<<26)%f,x=0,_=this.length-1;_>=0;_--)x=(v*x+(this.words[_]|0))%f;return p?-x:x},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var p=f<0;p&&(f=-f),n(f<=67108863);for(var v=0,x=this.length-1;x>=0;x--){var _=(this.words[x]|0)+v*67108864;this.words[x]=_/f|0,v=_%f}return this._strip(),p?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var p=this,v=f.clone();p.negative!==0?p=p.umod(f):p=p.clone();for(var x=new s(1),_=new s(0),S=new s(0),b=new s(1),M=0;p.isEven()&&v.isEven();)p.iushrn(1),v.iushrn(1),++M;for(var I=v.clone(),F=p.clone();!p.isZero();){for(var ae=0,O=1;!(p.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(p.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(I),_.isub(F)),x.iushrn(1),_.iushrn(1);for(var se=0,ee=1;!(v.words[0]&ee)&&se<26;++se,ee<<=1);if(se>0)for(v.iushrn(se);se-- >0;)(S.isOdd()||b.isOdd())&&(S.iadd(I),b.isub(F)),S.iushrn(1),b.iushrn(1);p.cmp(v)>=0?(p.isub(v),x.isub(S),_.isub(b)):(v.isub(p),S.isub(x),b.isub(_))}return{a:S,b,gcd:v.iushln(M)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var p=this,v=f.clone();p.negative!==0?p=p.umod(f):p=p.clone();for(var x=new s(1),_=new s(0),S=v.clone();p.cmpn(1)>0&&v.cmpn(1)>0;){for(var b=0,M=1;!(p.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(p.iushrn(b);b-- >0;)x.isOdd()&&x.iadd(S),x.iushrn(1);for(var I=0,F=1;!(v.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(v.iushrn(I);I-- >0;)_.isOdd()&&_.iadd(S),_.iushrn(1);p.cmp(v)>=0?(p.isub(v),x.isub(_)):(v.isub(p),_.isub(x))}var ae;return p.cmpn(1)===0?ae=x:ae=_,ae.cmpn(0)<0&&ae.iadd(f),ae},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var p=this.clone(),v=f.clone();p.negative=0,v.negative=0;for(var x=0;p.isEven()&&v.isEven();x++)p.iushrn(1),v.iushrn(1);do{for(;p.isEven();)p.iushrn(1);for(;v.isEven();)v.iushrn(1);var _=p.cmp(v);if(_<0){var S=p;p=v,v=S}else if(_===0||v.cmpn(1)===0)break;p.isub(v)}while(!0);return v.iushln(x)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var p=f%26,v=(f-p)/26,x=1<>>26,b&=67108863,this.words[S]=b}return _!==0&&(this.words[S]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var p=f<0;if(this.negative!==0&&!p)return-1;if(this.negative===0&&p)return 1;this._strip();var v;if(this.length>1)v=1;else{p&&(f=-f),n(f<=67108863,"Number is too big");var x=this.words[0]|0;v=x===f?0:xf.length)return 1;if(this.length=0;v--){var x=this.words[v]|0,_=f.words[v]|0;if(x!==_){x<_?p=-1:x>_&&(p=1);break}}return p},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new G(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var K={k256:null,p224:null,p192:null,p25519:null};function J(m,f){this.name=m,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}J.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},J.prototype.ireduce=function(f){var p=f,v;do this.split(p,this.tmp),p=this.imulK(p),p=p.iadd(this.tmp),v=p.bitLength();while(v>this.n);var x=v0?p.isub(this.p):p.strip!==void 0?p.strip():p._strip(),p},J.prototype.split=function(f,p){f.iushrn(this.n,0,p)},J.prototype.imulK=function(f){return f.imul(this.k)};function T(){J.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(T,J),T.prototype.split=function(f,p){for(var v=4194303,x=Math.min(f.length,9),_=0;_>>22,S=b}S>>>=22,f.words[_-10]=S,S===0&&f.length>10?f.length-=10:f.length-=9},T.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var p=0,v=0;v>>=26,f.words[v]=_,p=x}return p!==0&&(f.words[f.length++]=p),f},s._prime=function(f){if(K[f])return K[f];var p;if(f==="k256")p=new T;else if(f==="p224")p=new z;else if(f==="p192")p=new ue;else if(f==="p25519")p=new _e;else throw new Error("Unknown prime "+f);return K[f]=p,p};function G(m){if(typeof m=="string"){var f=s._prime(m);this.m=f.p,this.prime=f}else n(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}G.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},G.prototype._verify2=function(f,p){n((f.negative|p.negative)===0,"red works only with positives"),n(f.red&&f.red===p.red,"red works only with red numbers")},G.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(d(f,f.umod(this.m)._forceRed(this)),f)},G.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},G.prototype.add=function(f,p){this._verify2(f,p);var v=f.add(p);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},G.prototype.iadd=function(f,p){this._verify2(f,p);var v=f.iadd(p);return v.cmp(this.m)>=0&&v.isub(this.m),v},G.prototype.sub=function(f,p){this._verify2(f,p);var v=f.sub(p);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},G.prototype.isub=function(f,p){this._verify2(f,p);var v=f.isub(p);return v.cmpn(0)<0&&v.iadd(this.m),v},G.prototype.shl=function(f,p){return this._verify1(f),this.imod(f.ushln(p))},G.prototype.imul=function(f,p){return this._verify2(f,p),this.imod(f.imul(p))},G.prototype.mul=function(f,p){return this._verify2(f,p),this.imod(f.mul(p))},G.prototype.isqr=function(f){return this.imul(f,f.clone())},G.prototype.sqr=function(f){return this.mul(f,f)},G.prototype.sqrt=function(f){if(f.isZero())return f.clone();var p=this.m.andln(3);if(n(p%2===1),p===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(f,v)}for(var x=this.m.subn(1),_=0;!x.isZero()&&x.andln(1)===0;)_++,x.iushrn(1);n(!x.isZero());var S=new s(1).toRed(this),b=S.redNeg(),M=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,M).cmp(b)!==0;)I.redIAdd(b);for(var F=this.pow(I,x),ae=this.pow(f,x.addn(1).iushrn(1)),O=this.pow(f,x),se=_;O.cmp(S)!==0;){for(var ee=O,X=0;ee.cmp(S)!==0;X++)ee=ee.redSqr();n(X=0;_--){for(var F=p.words[_],ae=I-1;ae>=0;ae--){var O=F>>ae&1;if(S!==x[0]&&(S=this.sqr(S)),O===0&&b===0){M=0;continue}b<<=1,b|=O,M++,!(M!==v&&(_!==0||ae!==0))&&(S=this.mul(S,x[b]),M=0,b=0)}I=26}return S},G.prototype.convertTo=function(f){var p=f.umod(this.m);return p===f?p.clone():p},G.prototype.convertFrom=function(f){var p=f.clone();return p.red=null,p},s.mont=function(f){return new E(f)};function E(m){G.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(E,G),E.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},E.prototype.convertFrom=function(f){var p=this.imod(f.mul(this.rinv));return p.red=null,p},E.prototype.imul=function(f,p){if(f.isZero()||p.isZero())return f.words[0]=0,f.length=1,f;var v=f.imul(p),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.mul=function(f,p){if(f.isZero()||p.isZero())return new s(0)._forceRed(this);var v=f.mul(p),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.invm=function(f){var p=this.imod(f._invmp(this.m).mul(this.r2));return p._forceRed(this)}})(t,nn)}(Sm);var lN=Sm.exports;const rr=Ui(lN);var hN=rr.BN;function dN(t){return new hN(t,36).toString(16)}const pN="strings/5.7.0",gN=new Kr(pN);var vd;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(vd||(vd={}));var Ux;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(Ux||(Ux={}));function Am(t,e=vd.current){e!=vd.current&&(gN.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return bn(r)}const mN=`Ethereum Signed Message: -`;function jx(t){return typeof t=="string"&&(t=Am(t)),Em(cN([Am(mN),Am(String(t.length)),t]))}const vN="address/5.7.0",il=new Kr(vN);function qx(t){Os(t,20)||il.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=bn(Em(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const bN=9007199254740991;function yN(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const Pm={};for(let t=0;t<10;t++)Pm[String(t)]=String(t);for(let t=0;t<26;t++)Pm[String.fromCharCode(65+t)]=String(10+t);const zx=Math.floor(yN(bN));function wN(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Pm[n]).join("");for(;e.length>=zx;){let n=e.substring(0,zx);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function xN(t){let e=null;if(typeof t!="string"&&il.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=qx(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&il.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==wN(t)&&il.throwArgumentError("bad icap checksum","address",t),e=dN(t.substring(4));e.length<40;)e="0"+e;e=qx("0x"+e)}else il.throwArgumentError("invalid address","address",t);return e}function sl(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var ol={},yr={},Va=Hx;function Hx(t,e){if(!t)throw new Error(e||"Assertion failed")}Hx.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var Mm={exports:{}};typeof Object.create=="function"?Mm.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Mm.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var bd=Mm.exports,_N=Va,EN=bd;yr.inherits=EN;function SN(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function AN(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):SN(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}yr.htonl=Wx;function MN(t,e){for(var r="",n=0;n>>0}return s}yr.join32=IN;function CN(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}yr.split32=CN;function TN(t,e){return t>>>e|t<<32-e}yr.rotr32=TN;function RN(t,e){return t<>>32-e}yr.rotl32=RN;function DN(t,e){return t+e>>>0}yr.sum32=DN;function ON(t,e,r){return t+e+r>>>0}yr.sum32_3=ON;function NN(t,e,r,n){return t+e+r+n>>>0}yr.sum32_4=NN;function LN(t,e,r,n,i){return t+e+r+n+i>>>0}yr.sum32_5=LN;function kN(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}yr.sum64=kN;function $N(t,e,r,n){var i=e+n>>>0,s=(i>>0}yr.sum64_hi=$N;function BN(t,e,r,n){var i=e+n;return i>>>0}yr.sum64_lo=BN;function FN(t,e,r,n,i,s,o,a){var u=0,l=e;l=l+n>>>0,u+=l>>0,u+=l>>0,u+=l>>0}yr.sum64_4_hi=FN;function UN(t,e,r,n,i,s,o,a){var u=e+n+s+a;return u>>>0}yr.sum64_4_lo=UN;function jN(t,e,r,n,i,s,o,a,u,l){var d=0,g=e;g=g+n>>>0,d+=g>>0,d+=g>>0,d+=g>>0,d+=g>>0}yr.sum64_5_hi=jN;function qN(t,e,r,n,i,s,o,a,u,l){var d=e+n+s+a+l;return d>>>0}yr.sum64_5_lo=qN;function zN(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}yr.rotr64_hi=zN;function HN(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.rotr64_lo=HN;function WN(t,e,r){return t>>>r}yr.shr64_hi=WN;function KN(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.shr64_lo=KN;var fu={},Gx=yr,VN=Va;function yd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}fu.BlockHash=yd,yd.prototype.update=function(e,r){if(e=Gx.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Gx.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}Ns.g0_256=ZN;function QN(t){return Ls(t,17)^Ls(t,19)^t>>>10}Ns.g1_256=QN;var hu=yr,eL=fu,tL=Ns,Im=hu.rotl32,al=hu.sum32,rL=hu.sum32_5,nL=tL.ft_1,Zx=eL.BlockHash,iL=[1518500249,1859775393,2400959708,3395469782];function ks(){if(!(this instanceof ks))return new ks;Zx.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}hu.inherits(ks,Zx);var sL=ks;ks.blockSize=512,ks.outSize=160,ks.hmacStrength=80,ks.padLength=64,ks.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),KL(e.length<=this.blockSize);for(var r=e.length;r>8,y=d&255;g?u.push(g,y):u.push(y)}return u}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",u=0;u(y>>1)-1?N=(y>>1)-D:N=D,A.isubn(N)):N=0,g[P]=N,A.iushrn(1)}return g}r.getNAF=n;function i(u,l){var d=[[],[]];u=u.clone(),l=l.clone();for(var g=0,y=0,A;u.cmpn(-g)>0||l.cmpn(-y)>0;){var P=u.andln(3)+g&3,N=l.andln(3)+y&3;P===3&&(P=-1),N===3&&(N=-1);var D;P&1?(A=u.andln(7)+g&7,(A===3||A===5)&&N===2?D=-P:D=P):D=0,d[0].push(D);var k;N&1?(A=l.andln(7)+y&7,(A===3||A===5)&&P===2?k=-N:k=N):k=0,d[1].push(k),2*g===D+1&&(g=1-g),2*y===k+1&&(y=1-y),u.iushrn(1),l.iushrn(1)}return d}r.getJSF=i;function s(u,l,d){var g="_"+l;u.prototype[l]=function(){return this[g]!==void 0?this[g]:this[g]=d.call(this)}}r.cachedProperty=s;function o(u){return typeof u=="string"?r.toArray(u,"hex"):u}r.parseBytes=o;function a(u){return new rr(u,"hex","le")}r.intFromLE=a}),xd=Ci.getNAF,YL=Ci.getJSF,_d=Ci.assert;function ra(t,e){this.type=t,this.p=new rr(e.p,16),this.red=e.prime?rr.red(e.prime):rr.mont(this.p),this.zero=new rr(0).toRed(this.red),this.one=new rr(1).toRed(this.red),this.two=new rr(2).toRed(this.red),this.n=e.n&&new rr(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ya=ra;ra.prototype.point=function(){throw new Error("Not implemented")},ra.prototype.validate=function(){throw new Error("Not implemented")},ra.prototype._fixedNafMul=function(e,r){_d(e.precomputed);var n=e._getDoubles(),i=xd(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),g=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];_d(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},ra.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,g,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=xd(n[P],o[P],this._bitLength),u[N]=xd(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],$=YL(n[P],n[N]);for(l=Math.max($[0].length,l),u[P]=new Array(l),u[N]=new Array(l),g=0;g=0;d--){for(var T=0;d>=0;){var z=!0;for(g=0;g=0&&T++,K=K.dblp(T),d<0)break;for(g=0;g0?y=a[g][ue-1>>1]:ue<0&&(y=a[g][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},zi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),g.negative&&(g=g.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:g,b:y},{a:A,b:P}]},Hi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),g=e.sub(a).sub(u),y=l.add(d).neg();return{k1:g,k2:y}},Hi.prototype.pointFromX=function(e,r){e=new rr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Hi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Hi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Dn.prototype.isInfinity=function(){return this.inf},Dn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Dn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Dn.prototype.getX=function(){return this.x.fromRed()},Dn.prototype.getY=function(){return this.y.fromRed()},Dn.prototype.mul=function(e){return e=new rr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Dn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Dn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Dn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Dn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Dn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Un(t,e,r,n){Ya.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new rr(0)):(this.x=new rr(e,16),this.y=new rr(r,16),this.z=new rr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Nm(Un,Ya.BasePoint),Hi.prototype.jpoint=function(e,r,n){return new Un(this,e,r,n)},Un.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},Un.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Un.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),g=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(g).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(g)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},Un.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),g=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(g).redISub(g),A=u.redMul(g.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},Un.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},Un.prototype.inspect=function(){return this.isInfinity()?"":""},Un.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Ed=mu(function(t,e){var r=e;r.base=Ya,r.short=XL,r.mont=null,r.edwards=null}),Sd=mu(function(t,e){var r=e,n=Ci.assert;function i(a){a.type==="short"?this.curve=new Ed.short(a):a.type==="edwards"?this.curve=new Ed.edwards(a):this.curve=new Ed.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,u){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(u);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:yo.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:yo.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:yo.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:yo.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:yo.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:yo.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:yo.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:yo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function na(t){if(!(this instanceof na))return new na(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ms.toArray(t.entropy,t.entropyEnc||"hex"),r=ms.toArray(t.nonce,t.nonceEnc||"hex"),n=ms.toArray(t.pers,t.persEnc||"hex");Om(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var d3=na;na.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},na.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=ms.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var ZL=Ci.assert;function Ad(t,e){if(t instanceof Ad)return t;this._importDER(t,e)||(ZL(t.r&&t.s,"Signature without r or s"),this.r=new rr(t.r,16),this.s=new rr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Pd=Ad;function QL(){this.place=0}function $m(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function p3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Ad.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=p3(r),n=p3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Bm(i,r.length),i=i.concat(r),i.push(2),Bm(i,n.length);var s=i.concat(n),o=[48];return Bm(o,s.length),o=o.concat(s),Ci.encode(o,e)};var ek=function(){throw new Error("unsupported")},g3=Ci.assert;function Wi(t){if(!(this instanceof Wi))return new Wi(t);typeof t=="string"&&(g3(Object.prototype.hasOwnProperty.call(Sd,t),"Unknown curve "+t),t=Sd[t]),t instanceof Sd.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var tk=Wi;Wi.prototype.keyPair=function(e){return new km(this,e)},Wi.prototype.keyFromPrivate=function(e,r){return km.fromPrivate(this,e,r)},Wi.prototype.keyFromPublic=function(e,r){return km.fromPublic(this,e,r)},Wi.prototype.genKeyPair=function(e){e||(e={});for(var r=new d3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||ek(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new rr(2));;){var s=new rr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Wi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Wi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new rr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new d3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new rr(1)),d=0;;d++){var g=i.k?i.k(d):new rr(u.generate(this.n.byteLength()));if(g=this._truncateToN(g,!0),!(g.cmpn(1)<=0||g.cmp(l)>=0)){var y=this.g.mul(g);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=g.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new Pd({r:P,s:N,recoveryParam:D})}}}}}},Wi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new rr(e,16)),n=this.keyFromPublic(n,i),r=new Pd(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),u=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.eqXToP(s)):(d=this.g.mulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.getX().umod(this.n).cmp(s)===0)},Wi.prototype.recoverPubKey=function(t,e,r,n){g3((3&r)===r,"The recovery param is more than two bits"),e=new Pd(e,n);var i=this.n,s=new rr(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),g=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(g,o,y)},Wi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Pd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var rk=mu(function(t,e){var r=e;r.version="6.5.4",r.utils=Ci,r.rand=function(){throw new Error("unsupported")},r.curve=Ed,r.curves=Sd,r.ec=tk,r.eddsa=null}),nk=rk.ec;const ik="signing-key/5.7.0",Fm=new Kr(ik);let Um=null;function ia(){return Um||(Um=new nk("secp256k1")),Um}class sk{constructor(e){sl(this,"curve","secp256k1"),sl(this,"privateKey",Ii(e)),fN(this.privateKey)!==32&&Fm.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=ia().keyFromPrivate(bn(this.privateKey));sl(this,"publicKey","0x"+r.getPublic(!1,"hex")),sl(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),sl(this,"_isSigningKey",!0)}_addPoint(e){const r=ia().keyFromPublic(bn(this.publicKey)),n=ia().keyFromPublic(bn(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=ia().keyFromPrivate(bn(this.privateKey)),n=bn(e);n.length!==32&&Fm.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Fx({recoveryParam:i.recoveryParam,r:uu("0x"+i.r.toString(16),32),s:uu("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=ia().keyFromPrivate(bn(this.privateKey)),n=ia().keyFromPublic(bn(m3(e)));return uu("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function ok(t,e){const r=Fx(e),n={r:bn(r.r),s:bn(r.s)};return"0x"+ia().recoverPubKey(bn(t),n,r.recoveryParam).encode("hex",!1)}function m3(t,e){const r=bn(t);return r.length===32?new sk(r).publicKey:r.length===33?"0x"+ia().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?Ii(r):Fm.throwArgumentError("invalid public or private key","key","[REDACTED]")}var v3;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(v3||(v3={}));function ak(t){const e=m3(t);return xN(Bx(Em(Bx(e,1)),12))}function ck(t,e){return ak(ok(bn(t),e))}var jm={},Md={};Object.defineProperty(Md,"__esModule",{value:!0});var Yn=or,qm=Mi,uk=20;function fk(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],g=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],P=r[31]<<24|r[30]<<16|r[29]<<8|r[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],k=e[11]<<24|e[10]<<16|e[9]<<8|e[8],$=e[15]<<24|e[14]<<16|e[13]<<8|e[12],q=n,U=i,K=s,J=o,T=a,z=u,ue=l,_e=d,G=g,E=y,m=A,f=P,p=N,v=D,x=k,_=$,S=0;S>>16|p<<16,G=G+p|0,T^=G,T=T>>>20|T<<12,U=U+z|0,v^=U,v=v>>>16|v<<16,E=E+v|0,z^=E,z=z>>>20|z<<12,K=K+ue|0,x^=K,x=x>>>16|x<<16,m=m+x|0,ue^=m,ue=ue>>>20|ue<<12,J=J+_e|0,_^=J,_=_>>>16|_<<16,f=f+_|0,_e^=f,_e=_e>>>20|_e<<12,K=K+ue|0,x^=K,x=x>>>24|x<<8,m=m+x|0,ue^=m,ue=ue>>>25|ue<<7,J=J+_e|0,_^=J,_=_>>>24|_<<8,f=f+_|0,_e^=f,_e=_e>>>25|_e<<7,U=U+z|0,v^=U,v=v>>>24|v<<8,E=E+v|0,z^=E,z=z>>>25|z<<7,q=q+T|0,p^=q,p=p>>>24|p<<8,G=G+p|0,T^=G,T=T>>>25|T<<7,q=q+z|0,_^=q,_=_>>>16|_<<16,m=m+_|0,z^=m,z=z>>>20|z<<12,U=U+ue|0,p^=U,p=p>>>16|p<<16,f=f+p|0,ue^=f,ue=ue>>>20|ue<<12,K=K+_e|0,v^=K,v=v>>>16|v<<16,G=G+v|0,_e^=G,_e=_e>>>20|_e<<12,J=J+T|0,x^=J,x=x>>>16|x<<16,E=E+x|0,T^=E,T=T>>>20|T<<12,K=K+_e|0,v^=K,v=v>>>24|v<<8,G=G+v|0,_e^=G,_e=_e>>>25|_e<<7,J=J+T|0,x^=J,x=x>>>24|x<<8,E=E+x|0,T^=E,T=T>>>25|T<<7,U=U+ue|0,p^=U,p=p>>>24|p<<8,f=f+p|0,ue^=f,ue=ue>>>25|ue<<7,q=q+z|0,_^=q,_=_>>>24|_<<8,m=m+_|0,z^=m,z=z>>>25|z<<7;Yn.writeUint32LE(q+n|0,t,0),Yn.writeUint32LE(U+i|0,t,4),Yn.writeUint32LE(K+s|0,t,8),Yn.writeUint32LE(J+o|0,t,12),Yn.writeUint32LE(T+a|0,t,16),Yn.writeUint32LE(z+u|0,t,20),Yn.writeUint32LE(ue+l|0,t,24),Yn.writeUint32LE(_e+d|0,t,28),Yn.writeUint32LE(G+g|0,t,32),Yn.writeUint32LE(E+y|0,t,36),Yn.writeUint32LE(m+A|0,t,40),Yn.writeUint32LE(f+P|0,t,44),Yn.writeUint32LE(p+N|0,t,48),Yn.writeUint32LE(v+D|0,t,52),Yn.writeUint32LE(x+k|0,t,56),Yn.writeUint32LE(_+$|0,t,60)}function b3(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var y3={},sa={};Object.defineProperty(sa,"__esModule",{value:!0});function dk(t,e,r){return~(t-1)&e|t-1&r}sa.select=dk;function pk(t,e){return(t|0)-(e|0)-1>>>31&1}sa.lessOrEqual=pk;function w3(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}sa.compare=w3;function gk(t,e){return t.length===0||e.length===0?!1:w3(t,e)!==0}sa.equal=gk,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=sa,r=Mi;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var u=a[0]|a[1]<<8;this._r[0]=u&8191;var l=a[2]|a[3]<<8;this._r[1]=(u>>>13|l<<3)&8191;var d=a[4]|a[5]<<8;this._r[2]=(l>>>10|d<<6)&7939;var g=a[6]|a[7]<<8;this._r[3]=(d>>>7|g<<9)&8191;var y=a[8]|a[9]<<8;this._r[4]=(g>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var A=a[10]|a[11]<<8;this._r[6]=(y>>>14|A<<2)&8191;var P=a[12]|a[13]<<8;this._r[7]=(A>>>11|P<<5)&8065;var N=a[14]|a[15]<<8;this._r[8]=(P>>>8|N<<8)&8191,this._r[9]=N>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,u,l){for(var d=this._fin?0:2048,g=this._h[0],y=this._h[1],A=this._h[2],P=this._h[3],N=this._h[4],D=this._h[5],k=this._h[6],$=this._h[7],q=this._h[8],U=this._h[9],K=this._r[0],J=this._r[1],T=this._r[2],z=this._r[3],ue=this._r[4],_e=this._r[5],G=this._r[6],E=this._r[7],m=this._r[8],f=this._r[9];l>=16;){var p=a[u+0]|a[u+1]<<8;g+=p&8191;var v=a[u+2]|a[u+3]<<8;y+=(p>>>13|v<<3)&8191;var x=a[u+4]|a[u+5]<<8;A+=(v>>>10|x<<6)&8191;var _=a[u+6]|a[u+7]<<8;P+=(x>>>7|_<<9)&8191;var S=a[u+8]|a[u+9]<<8;N+=(_>>>4|S<<12)&8191,D+=S>>>1&8191;var b=a[u+10]|a[u+11]<<8;k+=(S>>>14|b<<2)&8191;var M=a[u+12]|a[u+13]<<8;$+=(b>>>11|M<<5)&8191;var I=a[u+14]|a[u+15]<<8;q+=(M>>>8|I<<8)&8191,U+=I>>>5|d;var F=0,ae=F;ae+=g*K,ae+=y*(5*f),ae+=A*(5*m),ae+=P*(5*E),ae+=N*(5*G),F=ae>>>13,ae&=8191,ae+=D*(5*_e),ae+=k*(5*ue),ae+=$*(5*z),ae+=q*(5*T),ae+=U*(5*J),F+=ae>>>13,ae&=8191;var O=F;O+=g*J,O+=y*K,O+=A*(5*f),O+=P*(5*m),O+=N*(5*E),F=O>>>13,O&=8191,O+=D*(5*G),O+=k*(5*_e),O+=$*(5*ue),O+=q*(5*z),O+=U*(5*T),F+=O>>>13,O&=8191;var se=F;se+=g*T,se+=y*J,se+=A*K,se+=P*(5*f),se+=N*(5*m),F=se>>>13,se&=8191,se+=D*(5*E),se+=k*(5*G),se+=$*(5*_e),se+=q*(5*ue),se+=U*(5*z),F+=se>>>13,se&=8191;var ee=F;ee+=g*z,ee+=y*T,ee+=A*J,ee+=P*K,ee+=N*(5*f),F=ee>>>13,ee&=8191,ee+=D*(5*m),ee+=k*(5*E),ee+=$*(5*G),ee+=q*(5*_e),ee+=U*(5*ue),F+=ee>>>13,ee&=8191;var X=F;X+=g*ue,X+=y*z,X+=A*T,X+=P*J,X+=N*K,F=X>>>13,X&=8191,X+=D*(5*f),X+=k*(5*m),X+=$*(5*E),X+=q*(5*G),X+=U*(5*_e),F+=X>>>13,X&=8191;var Q=F;Q+=g*_e,Q+=y*ue,Q+=A*z,Q+=P*T,Q+=N*J,F=Q>>>13,Q&=8191,Q+=D*K,Q+=k*(5*f),Q+=$*(5*m),Q+=q*(5*E),Q+=U*(5*G),F+=Q>>>13,Q&=8191;var R=F;R+=g*G,R+=y*_e,R+=A*ue,R+=P*z,R+=N*T,F=R>>>13,R&=8191,R+=D*J,R+=k*K,R+=$*(5*f),R+=q*(5*m),R+=U*(5*E),F+=R>>>13,R&=8191;var Z=F;Z+=g*E,Z+=y*G,Z+=A*_e,Z+=P*ue,Z+=N*z,F=Z>>>13,Z&=8191,Z+=D*T,Z+=k*J,Z+=$*K,Z+=q*(5*f),Z+=U*(5*m),F+=Z>>>13,Z&=8191;var te=F;te+=g*m,te+=y*E,te+=A*G,te+=P*_e,te+=N*ue,F=te>>>13,te&=8191,te+=D*z,te+=k*T,te+=$*J,te+=q*K,te+=U*(5*f),F+=te>>>13,te&=8191;var le=F;le+=g*f,le+=y*m,le+=A*E,le+=P*G,le+=N*_e,F=le>>>13,le&=8191,le+=D*ue,le+=k*z,le+=$*T,le+=q*J,le+=U*K,F+=le>>>13,le&=8191,F=(F<<2)+F|0,F=F+ae|0,ae=F&8191,F=F>>>13,O+=F,g=ae,y=O,A=se,P=ee,N=X,D=Q,k=R,$=Z,q=te,U=le,u+=16,l-=16}this._h[0]=g,this._h[1]=y,this._h[2]=A,this._h[3]=P,this._h[4]=N,this._h[5]=D,this._h[6]=k,this._h[7]=$,this._h[8]=q,this._h[9]=U},o.prototype.finish=function(a,u){u===void 0&&(u=0);var l=new Uint16Array(10),d,g,y,A;if(this._leftover){for(A=this._leftover,this._buffer[A++]=1;A<16;A++)this._buffer[A]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(d=this._h[1]>>>13,this._h[1]&=8191,A=2;A<10;A++)this._h[A]+=d,d=this._h[A]>>>13,this._h[A]&=8191;for(this._h[0]+=d*5,d=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=d,d=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=d,l[0]=this._h[0]+5,d=l[0]>>>13,l[0]&=8191,A=1;A<10;A++)l[A]=this._h[A]+d,d=l[A]>>>13,l[A]&=8191;for(l[9]-=8192,g=(d^1)-1,A=0;A<10;A++)l[A]&=g;for(g=~g,A=0;A<10;A++)this._h[A]=this._h[A]&g|l[A];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,y=this._h[0]+this._pad[0],this._h[0]=y&65535,A=1;A<8;A++)y=(this._h[A]+this._pad[A]|0)+(y>>>16)|0,this._h[A]=y&65535;return a[u+0]=this._h[0]>>>0,a[u+1]=this._h[0]>>>8,a[u+2]=this._h[1]>>>0,a[u+3]=this._h[1]>>>8,a[u+4]=this._h[2]>>>0,a[u+5]=this._h[2]>>>8,a[u+6]=this._h[3]>>>0,a[u+7]=this._h[3]>>>8,a[u+8]=this._h[4]>>>0,a[u+9]=this._h[4]>>>8,a[u+10]=this._h[5]>>>0,a[u+11]=this._h[5]>>>8,a[u+12]=this._h[6]>>>0,a[u+13]=this._h[6]>>>8,a[u+14]=this._h[7]>>>0,a[u+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var u=0,l=a.length,d;if(this._leftover){d=16-this._leftover,d>l&&(d=l);for(var g=0;g=16&&(d=l-l%16,this._blocks(a,u,d),u+=d,l-=d),l){for(var g=0;g16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var A=new Uint8Array(16);A.set(l,A.length-l.length);var P=new Uint8Array(32);e.stream(this._key,A,P,4);var N=d.length+this.tagLength,D;if(y){if(y.length!==N)throw new Error("ChaCha20Poly1305: incorrect destination length");D=y}else D=new Uint8Array(N);return e.streamXOR(this._key,A,d,D,4),this._authenticate(D.subarray(D.length-this.tagLength,D.length),P,D.subarray(0,D.length-this.tagLength),g),n.wipe(A),D},u.prototype.open=function(l,d,g,y){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(d.length0&&A.update(o.subarray(y.length%16))),A.update(g),g.length%16>0&&A.update(o.subarray(g.length%16));var P=new Uint8Array(8);y&&i.writeUint64LE(y.length,P),A.update(P),i.writeUint64LE(g.length,P),A.update(P);for(var N=A.digest(),D=0;Dthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._temp,this._state,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,g=l/536870912|0,y=l<<3,A=l%64<56?64:128;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._state.set(u.state),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.state),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,u,l,d,g){for(;g>=64;){for(var y=u[0],A=u[1],P=u[2],N=u[3],D=u[4],k=u[5],$=u[6],q=u[7],U=0;U<16;U++){var K=d+U*4;a[U]=e.readUint32BE(l,K)}for(var U=16;U<64;U++){var J=a[U-2],T=(J>>>17|J<<15)^(J>>>19|J<<13)^J>>>10;J=a[U-15];var z=(J>>>7|J<<25)^(J>>>18|J<<14)^J>>>3;a[U]=(T+a[U-7]|0)+(z+a[U-16]|0)}for(var U=0;U<64;U++){var T=(((D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7))+(D&k^~D&$)|0)+(q+(i[U]+a[U]|0)|0)|0,z=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&A^y&P^A&P)|0;q=$,$=k,k=D,D=N+T|0,N=P,P=A,A=y,y=T+z|0}u[0]+=y,u[1]+=A,u[2]+=P,u[3]+=N,u[4]+=D,u[5]+=k,u[6]+=$,u[7]+=q,d+=64,g-=64}return d}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(fl);var Hm={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=ea,r=Mi;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(U){const K=new Float64Array(16);if(U)for(let J=0;J>16&1),J[_e-1]&=65535;J[15]=T[15]-32767-(J[14]>>16&1);const ue=J[15]>>16&1;J[14]&=65535,a(T,J,1-ue)}for(let z=0;z<16;z++)U[2*z]=T[z]&255,U[2*z+1]=T[z]>>8}function l(U,K){for(let J=0;J<16;J++)U[J]=K[2*J]+(K[2*J+1]<<8);U[15]&=32767}function d(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]+J[T]}function g(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]-J[T]}function y(U,K,J){let T,z,ue=0,_e=0,G=0,E=0,m=0,f=0,p=0,v=0,x=0,_=0,S=0,b=0,M=0,I=0,F=0,ae=0,O=0,se=0,ee=0,X=0,Q=0,R=0,Z=0,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,Be=J[0],Ie=J[1],Le=J[2],Ve=J[3],ke=J[4],ze=J[5],He=J[6],Ee=J[7],Qe=J[8],ct=J[9],$e=J[10],et=J[11],rt=J[12],Je=J[13],pt=J[14],ht=J[15];T=K[0],ue+=T*Be,_e+=T*Ie,G+=T*Le,E+=T*Ve,m+=T*ke,f+=T*ze,p+=T*He,v+=T*Ee,x+=T*Qe,_+=T*ct,S+=T*$e,b+=T*et,M+=T*rt,I+=T*Je,F+=T*pt,ae+=T*ht,T=K[1],_e+=T*Be,G+=T*Ie,E+=T*Le,m+=T*Ve,f+=T*ke,p+=T*ze,v+=T*He,x+=T*Ee,_+=T*Qe,S+=T*ct,b+=T*$e,M+=T*et,I+=T*rt,F+=T*Je,ae+=T*pt,O+=T*ht,T=K[2],G+=T*Be,E+=T*Ie,m+=T*Le,f+=T*Ve,p+=T*ke,v+=T*ze,x+=T*He,_+=T*Ee,S+=T*Qe,b+=T*ct,M+=T*$e,I+=T*et,F+=T*rt,ae+=T*Je,O+=T*pt,se+=T*ht,T=K[3],E+=T*Be,m+=T*Ie,f+=T*Le,p+=T*Ve,v+=T*ke,x+=T*ze,_+=T*He,S+=T*Ee,b+=T*Qe,M+=T*ct,I+=T*$e,F+=T*et,ae+=T*rt,O+=T*Je,se+=T*pt,ee+=T*ht,T=K[4],m+=T*Be,f+=T*Ie,p+=T*Le,v+=T*Ve,x+=T*ke,_+=T*ze,S+=T*He,b+=T*Ee,M+=T*Qe,I+=T*ct,F+=T*$e,ae+=T*et,O+=T*rt,se+=T*Je,ee+=T*pt,X+=T*ht,T=K[5],f+=T*Be,p+=T*Ie,v+=T*Le,x+=T*Ve,_+=T*ke,S+=T*ze,b+=T*He,M+=T*Ee,I+=T*Qe,F+=T*ct,ae+=T*$e,O+=T*et,se+=T*rt,ee+=T*Je,X+=T*pt,Q+=T*ht,T=K[6],p+=T*Be,v+=T*Ie,x+=T*Le,_+=T*Ve,S+=T*ke,b+=T*ze,M+=T*He,I+=T*Ee,F+=T*Qe,ae+=T*ct,O+=T*$e,se+=T*et,ee+=T*rt,X+=T*Je,Q+=T*pt,R+=T*ht,T=K[7],v+=T*Be,x+=T*Ie,_+=T*Le,S+=T*Ve,b+=T*ke,M+=T*ze,I+=T*He,F+=T*Ee,ae+=T*Qe,O+=T*ct,se+=T*$e,ee+=T*et,X+=T*rt,Q+=T*Je,R+=T*pt,Z+=T*ht,T=K[8],x+=T*Be,_+=T*Ie,S+=T*Le,b+=T*Ve,M+=T*ke,I+=T*ze,F+=T*He,ae+=T*Ee,O+=T*Qe,se+=T*ct,ee+=T*$e,X+=T*et,Q+=T*rt,R+=T*Je,Z+=T*pt,te+=T*ht,T=K[9],_+=T*Be,S+=T*Ie,b+=T*Le,M+=T*Ve,I+=T*ke,F+=T*ze,ae+=T*He,O+=T*Ee,se+=T*Qe,ee+=T*ct,X+=T*$e,Q+=T*et,R+=T*rt,Z+=T*Je,te+=T*pt,le+=T*ht,T=K[10],S+=T*Be,b+=T*Ie,M+=T*Le,I+=T*Ve,F+=T*ke,ae+=T*ze,O+=T*He,se+=T*Ee,ee+=T*Qe,X+=T*ct,Q+=T*$e,R+=T*et,Z+=T*rt,te+=T*Je,le+=T*pt,ie+=T*ht,T=K[11],b+=T*Be,M+=T*Ie,I+=T*Le,F+=T*Ve,ae+=T*ke,O+=T*ze,se+=T*He,ee+=T*Ee,X+=T*Qe,Q+=T*ct,R+=T*$e,Z+=T*et,te+=T*rt,le+=T*Je,ie+=T*pt,fe+=T*ht,T=K[12],M+=T*Be,I+=T*Ie,F+=T*Le,ae+=T*Ve,O+=T*ke,se+=T*ze,ee+=T*He,X+=T*Ee,Q+=T*Qe,R+=T*ct,Z+=T*$e,te+=T*et,le+=T*rt,ie+=T*Je,fe+=T*pt,ve+=T*ht,T=K[13],I+=T*Be,F+=T*Ie,ae+=T*Le,O+=T*Ve,se+=T*ke,ee+=T*ze,X+=T*He,Q+=T*Ee,R+=T*Qe,Z+=T*ct,te+=T*$e,le+=T*et,ie+=T*rt,fe+=T*Je,ve+=T*pt,Me+=T*ht,T=K[14],F+=T*Be,ae+=T*Ie,O+=T*Le,se+=T*Ve,ee+=T*ke,X+=T*ze,Q+=T*He,R+=T*Ee,Z+=T*Qe,te+=T*ct,le+=T*$e,ie+=T*et,fe+=T*rt,ve+=T*Je,Me+=T*pt,Ne+=T*ht,T=K[15],ae+=T*Be,O+=T*Ie,se+=T*Le,ee+=T*Ve,X+=T*ke,Q+=T*ze,R+=T*He,Z+=T*Ee,te+=T*Qe,le+=T*ct,ie+=T*$e,fe+=T*et,ve+=T*rt,Me+=T*Je,Ne+=T*pt,Te+=T*ht,ue+=38*O,_e+=38*se,G+=38*ee,E+=38*X,m+=38*Q,f+=38*R,p+=38*Z,v+=38*te,x+=38*le,_+=38*ie,S+=38*fe,b+=38*ve,M+=38*Me,I+=38*Ne,F+=38*Te,z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=p+z+65535,z=Math.floor(T/65536),p=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=p+z+65535,z=Math.floor(T/65536),p=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),U[0]=ue,U[1]=_e,U[2]=G,U[3]=E,U[4]=m,U[5]=f,U[6]=p,U[7]=v,U[8]=x,U[9]=_,U[10]=S,U[11]=b,U[12]=M,U[13]=I,U[14]=F,U[15]=ae}function A(U,K){y(U,K,K)}function P(U,K){const J=n();for(let T=0;T<16;T++)J[T]=K[T];for(let T=253;T>=0;T--)A(J,J),T!==2&&T!==4&&y(J,J,K);for(let T=0;T<16;T++)U[T]=J[T]}function N(U,K){const J=new Uint8Array(32),T=new Float64Array(80),z=n(),ue=n(),_e=n(),G=n(),E=n(),m=n();for(let x=0;x<31;x++)J[x]=U[x];J[31]=U[31]&127|64,J[0]&=248,l(T,K);for(let x=0;x<16;x++)ue[x]=T[x];z[0]=G[0]=1;for(let x=254;x>=0;--x){const _=J[x>>>3]>>>(x&7)&1;a(z,ue,_),a(_e,G,_),d(E,z,_e),g(z,z,_e),d(_e,ue,G),g(ue,ue,G),A(G,E),A(m,z),y(z,_e,z),y(_e,ue,E),d(E,z,_e),g(z,z,_e),A(ue,z),g(_e,G,m),y(z,_e,s),d(z,z,G),y(_e,_e,z),y(z,G,m),y(G,ue,T),A(ue,E),a(z,ue,_),a(_e,G,_)}for(let x=0;x<16;x++)T[x+16]=z[x],T[x+32]=_e[x],T[x+48]=ue[x],T[x+64]=G[x];const f=T.subarray(32),p=T.subarray(16);P(f,f),y(p,p,f);const v=new Uint8Array(32);return u(v,p),v}t.scalarMult=N;function D(U){return N(U,i)}t.scalarMultBase=D;function k(U){if(U.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const K=new Uint8Array(U);return{publicKey:D(K),secretKey:K}}t.generateKeyPairFromSeed=k;function $(U){const K=(0,e.randomBytes)(32,U),J=k(K);return(0,r.wipe)(K),J}t.generateKeyPair=$;function q(U,K,J=!1){if(U.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(K.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const T=N(U,K);if(J){let z=0;for(let ue=0;ue",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}};var Ti={},Wm={exports:{}};Wm.exports,function(t){(function(e,r){function n(G,E){if(!G)throw new Error(E||"Assertion failed")}function i(G,E){G.super_=E;var m=function(){};m.prototype=E.prototype,G.prototype=new m,G.prototype.constructor=G}function s(G,E,m){if(s.isBN(G))return G;this.negative=0,this.words=null,this.length=0,this.red=null,G!==null&&((E==="le"||E==="be")&&(m=E,E=10),this._init(G||0,E||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=el.Buffer}catch{}s.isBN=function(E){return E instanceof s?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===s.wordSize&&Array.isArray(E.words)},s.max=function(E,m){return E.cmp(m)>0?E:m},s.min=function(E,m){return E.cmp(m)<0?E:m},s.prototype._init=function(E,m,f){if(typeof E=="number")return this._initNumber(E,m,f);if(typeof E=="object")return this._initArray(E,m,f);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),E=E.toString().replace(/\s+/g,"");var p=0;E[0]==="-"&&(p++,this.negative=1),p=0;p-=3)x=E[p]|E[p-1]<<8|E[p-2]<<16,this.words[v]|=x<<_&67108863,this.words[v+1]=x>>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);else if(f==="le")for(p=0,v=0;p>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);return this.strip()};function a(G,E){var m=G.charCodeAt(E);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function u(G,E,m){var f=a(G,m);return m-1>=E&&(f|=a(G,m-1)<<4),f}s.prototype._parseHex=function(E,m,f){this.length=Math.ceil((E.length-m)/6),this.words=new Array(this.length);for(var p=0;p=m;p-=2)_=u(E,m,p)<=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8;else{var S=E.length-m;for(p=S%2===0?m+1:m;p=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8}this.strip()};function l(G,E,m,f){for(var p=0,v=Math.min(G.length,m),x=E;x=49?p+=_-49+10:_>=17?p+=_-17+10:p+=_}return p}s.prototype._parseBase=function(E,m,f){this.words=[0],this.length=1;for(var p=0,v=1;v<=67108863;v*=m)p++;p--,v=v/m|0;for(var x=E.length-f,_=x%p,S=Math.min(x,x-_)+f,b=0,M=f;M1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var d=["","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"],g=[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],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(E,m){E=E||10,m=m|0||1;var f;if(E===16||E==="hex"){f="";for(var p=0,v=0,x=0;x>>24-p&16777215,p+=2,p>=26&&(p-=26,x--),v!==0||x!==this.length-1?f=d[6-S.length]+S+f:f=S+f}for(v!==0&&(f=v.toString(16)+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(E===(E|0)&&E>=2&&E<=36){var b=g[E],M=y[E];f="";var I=this.clone();for(I.negative=0;!I.isZero();){var F=I.modn(M).toString(E);I=I.idivn(M),I.isZero()?f=F+f:f=d[b-F.length]+F+f}for(this.isZero()&&(f="0"+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(E,m){return n(typeof o<"u"),this.toArrayLike(o,E,m)},s.prototype.toArray=function(E,m){return this.toArrayLike(Array,E,m)},s.prototype.toArrayLike=function(E,m,f){var p=this.byteLength(),v=f||Math.max(1,p);n(p<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var x=m==="le",_=new E(v),S,b,M=this.clone();if(x){for(b=0;!M.isZero();b++)S=M.andln(255),M.iushrn(8),_[b]=S;for(;b=4096&&(f+=13,m>>>=13),m>=64&&(f+=7,m>>>=7),m>=8&&(f+=4,m>>>=4),m>=2&&(f+=2,m>>>=2),f+m},s.prototype._zeroBits=function(E){if(E===0)return 26;var m=E,f=0;return m&8191||(f+=13,m>>>=13),m&127||(f+=7,m>>>=7),m&15||(f+=4,m>>>=4),m&3||(f+=2,m>>>=2),m&1||f++,f},s.prototype.bitLength=function(){var E=this.words[this.length-1],m=this._countBits(E);return(this.length-1)*26+m};function A(G){for(var E=new Array(G.bitLength()),m=0;m>>p}return E}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,m=0;mE.length?this.clone().ior(E):E.clone().ior(this)},s.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},s.prototype.iuand=function(E){var m;this.length>E.length?m=E:m=this;for(var f=0;fE.length?this.clone().iand(E):E.clone().iand(this)},s.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},s.prototype.iuxor=function(E){var m,f;this.length>E.length?(m=this,f=E):(m=E,f=this);for(var p=0;pE.length?this.clone().ixor(E):E.clone().ixor(this)},s.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},s.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var m=Math.ceil(E/26)|0,f=E%26;this._expand(m),f>0&&m--;for(var p=0;p0&&(this.words[p]=~this.words[p]&67108863>>26-f),this.strip()},s.prototype.notn=function(E){return this.clone().inotn(E)},s.prototype.setn=function(E,m){n(typeof E=="number"&&E>=0);var f=E/26|0,p=E%26;return this._expand(f+1),m?this.words[f]=this.words[f]|1<E.length?(f=this,p=E):(f=E,p=this);for(var v=0,x=0;x>>26;for(;v!==0&&x>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;xE.length?this.clone().iadd(E):E.clone().iadd(this)},s.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var m=this.iadd(E);return E.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var f=this.cmp(E);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,v;f>0?(p=this,v=E):(p=E,v=this);for(var x=0,_=0;_>26,this.words[_]=m&67108863;for(;x!==0&&_>26,this.words[_]=m&67108863;if(x===0&&_>>26,I=S&67108863,F=Math.min(b,E.length-1),ae=Math.max(0,b-G.length+1);ae<=F;ae++){var O=b-ae|0;p=G.words[O]|0,v=E.words[ae]|0,x=p*v+I,M+=x/67108864|0,I=x&67108863}m.words[b]=I|0,S=M|0}return S!==0?m.words[b]=S|0:m.length--,m.strip()}var N=function(E,m,f){var p=E.words,v=m.words,x=f.words,_=0,S,b,M,I=p[0]|0,F=I&8191,ae=I>>>13,O=p[1]|0,se=O&8191,ee=O>>>13,X=p[2]|0,Q=X&8191,R=X>>>13,Z=p[3]|0,te=Z&8191,le=Z>>>13,ie=p[4]|0,fe=ie&8191,ve=ie>>>13,Me=p[5]|0,Ne=Me&8191,Te=Me>>>13,Be=p[6]|0,Ie=Be&8191,Le=Be>>>13,Ve=p[7]|0,ke=Ve&8191,ze=Ve>>>13,He=p[8]|0,Ee=He&8191,Qe=He>>>13,ct=p[9]|0,$e=ct&8191,et=ct>>>13,rt=v[0]|0,Je=rt&8191,pt=rt>>>13,ht=v[1]|0,ft=ht&8191,Ht=ht>>>13,Jt=v[2]|0,St=Jt&8191,er=Jt>>>13,Xt=v[3]|0,Ot=Xt&8191,$t=Xt>>>13,Tt=v[4]|0,vt=Tt&8191,Dt=Tt>>>13,Lt=v[5]|0,bt=Lt&8191,Bt=Lt>>>13,Ut=v[6]|0,nt=Ut&8191,Ft=Ut>>>13,B=v[7]|0,H=B&8191,V=B>>>13,C=v[8]|0,Y=C&8191,j=C>>>13,oe=v[9]|0,pe=oe&8191,xe=oe>>>13;f.negative=E.negative^m.negative,f.length=19,S=Math.imul(F,Je),b=Math.imul(F,pt),b=b+Math.imul(ae,Je)|0,M=Math.imul(ae,pt);var Re=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Re>>>26)|0,Re&=67108863,S=Math.imul(se,Je),b=Math.imul(se,pt),b=b+Math.imul(ee,Je)|0,M=Math.imul(ee,pt),S=S+Math.imul(F,ft)|0,b=b+Math.imul(F,Ht)|0,b=b+Math.imul(ae,ft)|0,M=M+Math.imul(ae,Ht)|0;var De=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(De>>>26)|0,De&=67108863,S=Math.imul(Q,Je),b=Math.imul(Q,pt),b=b+Math.imul(R,Je)|0,M=Math.imul(R,pt),S=S+Math.imul(se,ft)|0,b=b+Math.imul(se,Ht)|0,b=b+Math.imul(ee,ft)|0,M=M+Math.imul(ee,Ht)|0,S=S+Math.imul(F,St)|0,b=b+Math.imul(F,er)|0,b=b+Math.imul(ae,St)|0,M=M+Math.imul(ae,er)|0;var it=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(it>>>26)|0,it&=67108863,S=Math.imul(te,Je),b=Math.imul(te,pt),b=b+Math.imul(le,Je)|0,M=Math.imul(le,pt),S=S+Math.imul(Q,ft)|0,b=b+Math.imul(Q,Ht)|0,b=b+Math.imul(R,ft)|0,M=M+Math.imul(R,Ht)|0,S=S+Math.imul(se,St)|0,b=b+Math.imul(se,er)|0,b=b+Math.imul(ee,St)|0,M=M+Math.imul(ee,er)|0,S=S+Math.imul(F,Ot)|0,b=b+Math.imul(F,$t)|0,b=b+Math.imul(ae,Ot)|0,M=M+Math.imul(ae,$t)|0;var je=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(je>>>26)|0,je&=67108863,S=Math.imul(fe,Je),b=Math.imul(fe,pt),b=b+Math.imul(ve,Je)|0,M=Math.imul(ve,pt),S=S+Math.imul(te,ft)|0,b=b+Math.imul(te,Ht)|0,b=b+Math.imul(le,ft)|0,M=M+Math.imul(le,Ht)|0,S=S+Math.imul(Q,St)|0,b=b+Math.imul(Q,er)|0,b=b+Math.imul(R,St)|0,M=M+Math.imul(R,er)|0,S=S+Math.imul(se,Ot)|0,b=b+Math.imul(se,$t)|0,b=b+Math.imul(ee,Ot)|0,M=M+Math.imul(ee,$t)|0,S=S+Math.imul(F,vt)|0,b=b+Math.imul(F,Dt)|0,b=b+Math.imul(ae,vt)|0,M=M+Math.imul(ae,Dt)|0;var gt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(gt>>>26)|0,gt&=67108863,S=Math.imul(Ne,Je),b=Math.imul(Ne,pt),b=b+Math.imul(Te,Je)|0,M=Math.imul(Te,pt),S=S+Math.imul(fe,ft)|0,b=b+Math.imul(fe,Ht)|0,b=b+Math.imul(ve,ft)|0,M=M+Math.imul(ve,Ht)|0,S=S+Math.imul(te,St)|0,b=b+Math.imul(te,er)|0,b=b+Math.imul(le,St)|0,M=M+Math.imul(le,er)|0,S=S+Math.imul(Q,Ot)|0,b=b+Math.imul(Q,$t)|0,b=b+Math.imul(R,Ot)|0,M=M+Math.imul(R,$t)|0,S=S+Math.imul(se,vt)|0,b=b+Math.imul(se,Dt)|0,b=b+Math.imul(ee,vt)|0,M=M+Math.imul(ee,Dt)|0,S=S+Math.imul(F,bt)|0,b=b+Math.imul(F,Bt)|0,b=b+Math.imul(ae,bt)|0,M=M+Math.imul(ae,Bt)|0;var st=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(st>>>26)|0,st&=67108863,S=Math.imul(Ie,Je),b=Math.imul(Ie,pt),b=b+Math.imul(Le,Je)|0,M=Math.imul(Le,pt),S=S+Math.imul(Ne,ft)|0,b=b+Math.imul(Ne,Ht)|0,b=b+Math.imul(Te,ft)|0,M=M+Math.imul(Te,Ht)|0,S=S+Math.imul(fe,St)|0,b=b+Math.imul(fe,er)|0,b=b+Math.imul(ve,St)|0,M=M+Math.imul(ve,er)|0,S=S+Math.imul(te,Ot)|0,b=b+Math.imul(te,$t)|0,b=b+Math.imul(le,Ot)|0,M=M+Math.imul(le,$t)|0,S=S+Math.imul(Q,vt)|0,b=b+Math.imul(Q,Dt)|0,b=b+Math.imul(R,vt)|0,M=M+Math.imul(R,Dt)|0,S=S+Math.imul(se,bt)|0,b=b+Math.imul(se,Bt)|0,b=b+Math.imul(ee,bt)|0,M=M+Math.imul(ee,Bt)|0,S=S+Math.imul(F,nt)|0,b=b+Math.imul(F,Ft)|0,b=b+Math.imul(ae,nt)|0,M=M+Math.imul(ae,Ft)|0;var tt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(tt>>>26)|0,tt&=67108863,S=Math.imul(ke,Je),b=Math.imul(ke,pt),b=b+Math.imul(ze,Je)|0,M=Math.imul(ze,pt),S=S+Math.imul(Ie,ft)|0,b=b+Math.imul(Ie,Ht)|0,b=b+Math.imul(Le,ft)|0,M=M+Math.imul(Le,Ht)|0,S=S+Math.imul(Ne,St)|0,b=b+Math.imul(Ne,er)|0,b=b+Math.imul(Te,St)|0,M=M+Math.imul(Te,er)|0,S=S+Math.imul(fe,Ot)|0,b=b+Math.imul(fe,$t)|0,b=b+Math.imul(ve,Ot)|0,M=M+Math.imul(ve,$t)|0,S=S+Math.imul(te,vt)|0,b=b+Math.imul(te,Dt)|0,b=b+Math.imul(le,vt)|0,M=M+Math.imul(le,Dt)|0,S=S+Math.imul(Q,bt)|0,b=b+Math.imul(Q,Bt)|0,b=b+Math.imul(R,bt)|0,M=M+Math.imul(R,Bt)|0,S=S+Math.imul(se,nt)|0,b=b+Math.imul(se,Ft)|0,b=b+Math.imul(ee,nt)|0,M=M+Math.imul(ee,Ft)|0,S=S+Math.imul(F,H)|0,b=b+Math.imul(F,V)|0,b=b+Math.imul(ae,H)|0,M=M+Math.imul(ae,V)|0;var At=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(At>>>26)|0,At&=67108863,S=Math.imul(Ee,Je),b=Math.imul(Ee,pt),b=b+Math.imul(Qe,Je)|0,M=Math.imul(Qe,pt),S=S+Math.imul(ke,ft)|0,b=b+Math.imul(ke,Ht)|0,b=b+Math.imul(ze,ft)|0,M=M+Math.imul(ze,Ht)|0,S=S+Math.imul(Ie,St)|0,b=b+Math.imul(Ie,er)|0,b=b+Math.imul(Le,St)|0,M=M+Math.imul(Le,er)|0,S=S+Math.imul(Ne,Ot)|0,b=b+Math.imul(Ne,$t)|0,b=b+Math.imul(Te,Ot)|0,M=M+Math.imul(Te,$t)|0,S=S+Math.imul(fe,vt)|0,b=b+Math.imul(fe,Dt)|0,b=b+Math.imul(ve,vt)|0,M=M+Math.imul(ve,Dt)|0,S=S+Math.imul(te,bt)|0,b=b+Math.imul(te,Bt)|0,b=b+Math.imul(le,bt)|0,M=M+Math.imul(le,Bt)|0,S=S+Math.imul(Q,nt)|0,b=b+Math.imul(Q,Ft)|0,b=b+Math.imul(R,nt)|0,M=M+Math.imul(R,Ft)|0,S=S+Math.imul(se,H)|0,b=b+Math.imul(se,V)|0,b=b+Math.imul(ee,H)|0,M=M+Math.imul(ee,V)|0,S=S+Math.imul(F,Y)|0,b=b+Math.imul(F,j)|0,b=b+Math.imul(ae,Y)|0,M=M+Math.imul(ae,j)|0;var Rt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,S=Math.imul($e,Je),b=Math.imul($e,pt),b=b+Math.imul(et,Je)|0,M=Math.imul(et,pt),S=S+Math.imul(Ee,ft)|0,b=b+Math.imul(Ee,Ht)|0,b=b+Math.imul(Qe,ft)|0,M=M+Math.imul(Qe,Ht)|0,S=S+Math.imul(ke,St)|0,b=b+Math.imul(ke,er)|0,b=b+Math.imul(ze,St)|0,M=M+Math.imul(ze,er)|0,S=S+Math.imul(Ie,Ot)|0,b=b+Math.imul(Ie,$t)|0,b=b+Math.imul(Le,Ot)|0,M=M+Math.imul(Le,$t)|0,S=S+Math.imul(Ne,vt)|0,b=b+Math.imul(Ne,Dt)|0,b=b+Math.imul(Te,vt)|0,M=M+Math.imul(Te,Dt)|0,S=S+Math.imul(fe,bt)|0,b=b+Math.imul(fe,Bt)|0,b=b+Math.imul(ve,bt)|0,M=M+Math.imul(ve,Bt)|0,S=S+Math.imul(te,nt)|0,b=b+Math.imul(te,Ft)|0,b=b+Math.imul(le,nt)|0,M=M+Math.imul(le,Ft)|0,S=S+Math.imul(Q,H)|0,b=b+Math.imul(Q,V)|0,b=b+Math.imul(R,H)|0,M=M+Math.imul(R,V)|0,S=S+Math.imul(se,Y)|0,b=b+Math.imul(se,j)|0,b=b+Math.imul(ee,Y)|0,M=M+Math.imul(ee,j)|0,S=S+Math.imul(F,pe)|0,b=b+Math.imul(F,xe)|0,b=b+Math.imul(ae,pe)|0,M=M+Math.imul(ae,xe)|0;var Mt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,S=Math.imul($e,ft),b=Math.imul($e,Ht),b=b+Math.imul(et,ft)|0,M=Math.imul(et,Ht),S=S+Math.imul(Ee,St)|0,b=b+Math.imul(Ee,er)|0,b=b+Math.imul(Qe,St)|0,M=M+Math.imul(Qe,er)|0,S=S+Math.imul(ke,Ot)|0,b=b+Math.imul(ke,$t)|0,b=b+Math.imul(ze,Ot)|0,M=M+Math.imul(ze,$t)|0,S=S+Math.imul(Ie,vt)|0,b=b+Math.imul(Ie,Dt)|0,b=b+Math.imul(Le,vt)|0,M=M+Math.imul(Le,Dt)|0,S=S+Math.imul(Ne,bt)|0,b=b+Math.imul(Ne,Bt)|0,b=b+Math.imul(Te,bt)|0,M=M+Math.imul(Te,Bt)|0,S=S+Math.imul(fe,nt)|0,b=b+Math.imul(fe,Ft)|0,b=b+Math.imul(ve,nt)|0,M=M+Math.imul(ve,Ft)|0,S=S+Math.imul(te,H)|0,b=b+Math.imul(te,V)|0,b=b+Math.imul(le,H)|0,M=M+Math.imul(le,V)|0,S=S+Math.imul(Q,Y)|0,b=b+Math.imul(Q,j)|0,b=b+Math.imul(R,Y)|0,M=M+Math.imul(R,j)|0,S=S+Math.imul(se,pe)|0,b=b+Math.imul(se,xe)|0,b=b+Math.imul(ee,pe)|0,M=M+Math.imul(ee,xe)|0;var Et=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Et>>>26)|0,Et&=67108863,S=Math.imul($e,St),b=Math.imul($e,er),b=b+Math.imul(et,St)|0,M=Math.imul(et,er),S=S+Math.imul(Ee,Ot)|0,b=b+Math.imul(Ee,$t)|0,b=b+Math.imul(Qe,Ot)|0,M=M+Math.imul(Qe,$t)|0,S=S+Math.imul(ke,vt)|0,b=b+Math.imul(ke,Dt)|0,b=b+Math.imul(ze,vt)|0,M=M+Math.imul(ze,Dt)|0,S=S+Math.imul(Ie,bt)|0,b=b+Math.imul(Ie,Bt)|0,b=b+Math.imul(Le,bt)|0,M=M+Math.imul(Le,Bt)|0,S=S+Math.imul(Ne,nt)|0,b=b+Math.imul(Ne,Ft)|0,b=b+Math.imul(Te,nt)|0,M=M+Math.imul(Te,Ft)|0,S=S+Math.imul(fe,H)|0,b=b+Math.imul(fe,V)|0,b=b+Math.imul(ve,H)|0,M=M+Math.imul(ve,V)|0,S=S+Math.imul(te,Y)|0,b=b+Math.imul(te,j)|0,b=b+Math.imul(le,Y)|0,M=M+Math.imul(le,j)|0,S=S+Math.imul(Q,pe)|0,b=b+Math.imul(Q,xe)|0,b=b+Math.imul(R,pe)|0,M=M+Math.imul(R,xe)|0;var dt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(dt>>>26)|0,dt&=67108863,S=Math.imul($e,Ot),b=Math.imul($e,$t),b=b+Math.imul(et,Ot)|0,M=Math.imul(et,$t),S=S+Math.imul(Ee,vt)|0,b=b+Math.imul(Ee,Dt)|0,b=b+Math.imul(Qe,vt)|0,M=M+Math.imul(Qe,Dt)|0,S=S+Math.imul(ke,bt)|0,b=b+Math.imul(ke,Bt)|0,b=b+Math.imul(ze,bt)|0,M=M+Math.imul(ze,Bt)|0,S=S+Math.imul(Ie,nt)|0,b=b+Math.imul(Ie,Ft)|0,b=b+Math.imul(Le,nt)|0,M=M+Math.imul(Le,Ft)|0,S=S+Math.imul(Ne,H)|0,b=b+Math.imul(Ne,V)|0,b=b+Math.imul(Te,H)|0,M=M+Math.imul(Te,V)|0,S=S+Math.imul(fe,Y)|0,b=b+Math.imul(fe,j)|0,b=b+Math.imul(ve,Y)|0,M=M+Math.imul(ve,j)|0,S=S+Math.imul(te,pe)|0,b=b+Math.imul(te,xe)|0,b=b+Math.imul(le,pe)|0,M=M+Math.imul(le,xe)|0;var _t=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(_t>>>26)|0,_t&=67108863,S=Math.imul($e,vt),b=Math.imul($e,Dt),b=b+Math.imul(et,vt)|0,M=Math.imul(et,Dt),S=S+Math.imul(Ee,bt)|0,b=b+Math.imul(Ee,Bt)|0,b=b+Math.imul(Qe,bt)|0,M=M+Math.imul(Qe,Bt)|0,S=S+Math.imul(ke,nt)|0,b=b+Math.imul(ke,Ft)|0,b=b+Math.imul(ze,nt)|0,M=M+Math.imul(ze,Ft)|0,S=S+Math.imul(Ie,H)|0,b=b+Math.imul(Ie,V)|0,b=b+Math.imul(Le,H)|0,M=M+Math.imul(Le,V)|0,S=S+Math.imul(Ne,Y)|0,b=b+Math.imul(Ne,j)|0,b=b+Math.imul(Te,Y)|0,M=M+Math.imul(Te,j)|0,S=S+Math.imul(fe,pe)|0,b=b+Math.imul(fe,xe)|0,b=b+Math.imul(ve,pe)|0,M=M+Math.imul(ve,xe)|0;var ot=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(ot>>>26)|0,ot&=67108863,S=Math.imul($e,bt),b=Math.imul($e,Bt),b=b+Math.imul(et,bt)|0,M=Math.imul(et,Bt),S=S+Math.imul(Ee,nt)|0,b=b+Math.imul(Ee,Ft)|0,b=b+Math.imul(Qe,nt)|0,M=M+Math.imul(Qe,Ft)|0,S=S+Math.imul(ke,H)|0,b=b+Math.imul(ke,V)|0,b=b+Math.imul(ze,H)|0,M=M+Math.imul(ze,V)|0,S=S+Math.imul(Ie,Y)|0,b=b+Math.imul(Ie,j)|0,b=b+Math.imul(Le,Y)|0,M=M+Math.imul(Le,j)|0,S=S+Math.imul(Ne,pe)|0,b=b+Math.imul(Ne,xe)|0,b=b+Math.imul(Te,pe)|0,M=M+Math.imul(Te,xe)|0;var wt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(wt>>>26)|0,wt&=67108863,S=Math.imul($e,nt),b=Math.imul($e,Ft),b=b+Math.imul(et,nt)|0,M=Math.imul(et,Ft),S=S+Math.imul(Ee,H)|0,b=b+Math.imul(Ee,V)|0,b=b+Math.imul(Qe,H)|0,M=M+Math.imul(Qe,V)|0,S=S+Math.imul(ke,Y)|0,b=b+Math.imul(ke,j)|0,b=b+Math.imul(ze,Y)|0,M=M+Math.imul(ze,j)|0,S=S+Math.imul(Ie,pe)|0,b=b+Math.imul(Ie,xe)|0,b=b+Math.imul(Le,pe)|0,M=M+Math.imul(Le,xe)|0;var lt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul($e,H),b=Math.imul($e,V),b=b+Math.imul(et,H)|0,M=Math.imul(et,V),S=S+Math.imul(Ee,Y)|0,b=b+Math.imul(Ee,j)|0,b=b+Math.imul(Qe,Y)|0,M=M+Math.imul(Qe,j)|0,S=S+Math.imul(ke,pe)|0,b=b+Math.imul(ke,xe)|0,b=b+Math.imul(ze,pe)|0,M=M+Math.imul(ze,xe)|0;var at=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(at>>>26)|0,at&=67108863,S=Math.imul($e,Y),b=Math.imul($e,j),b=b+Math.imul(et,Y)|0,M=Math.imul(et,j),S=S+Math.imul(Ee,pe)|0,b=b+Math.imul(Ee,xe)|0,b=b+Math.imul(Qe,pe)|0,M=M+Math.imul(Qe,xe)|0;var Se=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Se>>>26)|0,Se&=67108863,S=Math.imul($e,pe),b=Math.imul($e,xe),b=b+Math.imul(et,pe)|0,M=Math.imul(et,xe);var Ae=(_+S|0)+((b&8191)<<13)|0;return _=(M+(b>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,x[0]=Re,x[1]=De,x[2]=it,x[3]=je,x[4]=gt,x[5]=st,x[6]=tt,x[7]=At,x[8]=Rt,x[9]=Mt,x[10]=Et,x[11]=dt,x[12]=_t,x[13]=ot,x[14]=wt,x[15]=lt,x[16]=at,x[17]=Se,x[18]=Ae,_!==0&&(x[19]=_,f.length++),f};Math.imul||(N=P);function D(G,E,m){m.negative=E.negative^G.negative,m.length=G.length+E.length;for(var f=0,p=0,v=0;v>>26)|0,p+=x>>>26,x&=67108863}m.words[v]=_,f=x,x=p}return f!==0?m.words[v]=f:m.length--,m.strip()}function k(G,E,m){var f=new $;return f.mulp(G,E,m)}s.prototype.mulTo=function(E,m){var f,p=this.length+E.length;return this.length===10&&E.length===10?f=N(this,E,m):p<63?f=P(this,E,m):p<1024?f=D(this,E,m):f=k(this,E,m),f};function $(G,E){this.x=G,this.y=E}$.prototype.makeRBT=function(E){for(var m=new Array(E),f=s.prototype._countBits(E)-1,p=0;p>=1;return p},$.prototype.permute=function(E,m,f,p,v,x){for(var _=0;_>>1)v++;return 1<>>13,f[2*x+1]=v&8191,v=v>>>13;for(x=2*m;x>=26,m+=p/67108864|0,m+=v>>>26,this.words[f]=v&67108863}return m!==0&&(this.words[f]=m,this.length++),this},s.prototype.muln=function(E){return this.clone().imuln(E)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(E){var m=A(E);if(m.length===0)return new s(1);for(var f=this,p=0;p=0);var m=E%26,f=(E-m)/26,p=67108863>>>26-m<<26-m,v;if(m!==0){var x=0;for(v=0;v>>26-m}x&&(this.words[v]=x,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var p;m?p=(m-m%26)/26:p=0;var v=E%26,x=Math.min((E-v)/26,this.length),_=67108863^67108863>>>v<x)for(this.length-=x,b=0;b=0&&(M!==0||b>=p);b--){var I=this.words[b]|0;this.words[b]=M<<26-v|I>>>v,M=I&_}return S&&M!==0&&(S.words[S.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(E,m,f){return n(this.negative===0),this.iushrn(E,m,f)},s.prototype.shln=function(E){return this.clone().ishln(E)},s.prototype.ushln=function(E){return this.clone().iushln(E)},s.prototype.shrn=function(E){return this.clone().ishrn(E)},s.prototype.ushrn=function(E){return this.clone().iushrn(E)},s.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var m=E%26,f=(E-m)/26,p=1<=0);var m=E%26,f=(E-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(m!==0&&f++,this.length=Math.min(f,this.length),m!==0){var p=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(S/67108864|0),this.words[v+f]=x&67108863}for(;v>26,this.words[v+f]=x&67108863;if(_===0)return this.strip();for(n(_===-1),_=0,v=0;v>26,this.words[v]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(E,m){var f=this.length-E.length,p=this.clone(),v=E,x=v.words[v.length-1]|0,_=this._countBits(x);f=26-_,f!==0&&(v=v.ushln(f),p.iushln(f),x=v.words[v.length-1]|0);var S=p.length-v.length,b;if(m!=="mod"){b=new s(null),b.length=S+1,b.words=new Array(b.length);for(var M=0;M=0;F--){var ae=(p.words[v.length+F]|0)*67108864+(p.words[v.length+F-1]|0);for(ae=Math.min(ae/x|0,67108863),p._ishlnsubmul(v,ae,F);p.negative!==0;)ae--,p.negative=0,p._ishlnsubmul(v,1,F),p.isZero()||(p.negative^=1);b&&(b.words[F]=ae)}return b&&b.strip(),p.strip(),m!=="div"&&f!==0&&p.iushrn(f),{div:b||null,mod:p}},s.prototype.divmod=function(E,m,f){if(n(!E.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var p,v,x;return this.negative!==0&&E.negative===0?(x=this.neg().divmod(E,m),m!=="mod"&&(p=x.div.neg()),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.iadd(E)),{div:p,mod:v}):this.negative===0&&E.negative!==0?(x=this.divmod(E.neg(),m),m!=="mod"&&(p=x.div.neg()),{div:p,mod:x.mod}):this.negative&E.negative?(x=this.neg().divmod(E.neg(),m),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.isub(E)),{div:x.div,mod:v}):E.length>this.length||this.cmp(E)<0?{div:new s(0),mod:this}:E.length===1?m==="div"?{div:this.divn(E.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new s(this.modn(E.words[0]))}:this._wordDiv(E,m)},s.prototype.div=function(E){return this.divmod(E,"div",!1).div},s.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},s.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},s.prototype.divRound=function(E){var m=this.divmod(E);if(m.mod.isZero())return m.div;var f=m.div.negative!==0?m.mod.isub(E):m.mod,p=E.ushrn(1),v=E.andln(1),x=f.cmp(p);return x<0||v===1&&x===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(E){n(E<=67108863);for(var m=(1<<26)%E,f=0,p=this.length-1;p>=0;p--)f=(m*f+(this.words[p]|0))%E;return f},s.prototype.idivn=function(E){n(E<=67108863);for(var m=0,f=this.length-1;f>=0;f--){var p=(this.words[f]|0)+m*67108864;this.words[f]=p/E|0,m=p%E}return this.strip()},s.prototype.divn=function(E){return this.clone().idivn(E)},s.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var p=new s(1),v=new s(0),x=new s(0),_=new s(1),S=0;m.isEven()&&f.isEven();)m.iushrn(1),f.iushrn(1),++S;for(var b=f.clone(),M=m.clone();!m.isZero();){for(var I=0,F=1;!(m.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(m.iushrn(I);I-- >0;)(p.isOdd()||v.isOdd())&&(p.iadd(b),v.isub(M)),p.iushrn(1),v.iushrn(1);for(var ae=0,O=1;!(f.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(f.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(b),_.isub(M)),x.iushrn(1),_.iushrn(1);m.cmp(f)>=0?(m.isub(f),p.isub(x),v.isub(_)):(f.isub(m),x.isub(p),_.isub(v))}return{a:x,b:_,gcd:f.iushln(S)}},s.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var p=new s(1),v=new s(0),x=f.clone();m.cmpn(1)>0&&f.cmpn(1)>0;){for(var _=0,S=1;!(m.words[0]&S)&&_<26;++_,S<<=1);if(_>0)for(m.iushrn(_);_-- >0;)p.isOdd()&&p.iadd(x),p.iushrn(1);for(var b=0,M=1;!(f.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(f.iushrn(b);b-- >0;)v.isOdd()&&v.iadd(x),v.iushrn(1);m.cmp(f)>=0?(m.isub(f),p.isub(v)):(f.isub(m),v.isub(p))}var I;return m.cmpn(1)===0?I=p:I=v,I.cmpn(0)<0&&I.iadd(E),I},s.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var m=this.clone(),f=E.clone();m.negative=0,f.negative=0;for(var p=0;m.isEven()&&f.isEven();p++)m.iushrn(1),f.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=m.cmp(f);if(v<0){var x=m;m=f,f=x}else if(v===0||f.cmpn(1)===0)break;m.isub(f)}while(!0);return f.iushln(p)},s.prototype.invm=function(E){return this.egcd(E).a.umod(E)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(E){return this.words[0]&E},s.prototype.bincn=function(E){n(typeof E=="number");var m=E%26,f=(E-m)/26,p=1<>>26,_&=67108863,this.words[x]=_}return v!==0&&(this.words[x]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(E){var m=E<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var f;if(this.length>1)f=1;else{m&&(E=-E),n(E<=67108863,"Number is too big");var p=this.words[0]|0;f=p===E?0:pE.length)return 1;if(this.length=0;f--){var p=this.words[f]|0,v=E.words[f]|0;if(p!==v){pv&&(m=1);break}}return m},s.prototype.gtn=function(E){return this.cmpn(E)===1},s.prototype.gt=function(E){return this.cmp(E)===1},s.prototype.gten=function(E){return this.cmpn(E)>=0},s.prototype.gte=function(E){return this.cmp(E)>=0},s.prototype.ltn=function(E){return this.cmpn(E)===-1},s.prototype.lt=function(E){return this.cmp(E)===-1},s.prototype.lten=function(E){return this.cmpn(E)<=0},s.prototype.lte=function(E){return this.cmp(E)<=0},s.prototype.eqn=function(E){return this.cmpn(E)===0},s.prototype.eq=function(E){return this.cmp(E)===0},s.red=function(E){return new ue(E)},s.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(E){return this.red=E,this},s.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},s.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},s.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},s.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},s.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},s.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},s.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},s.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var q={k256:null,p224:null,p192:null,p25519:null};function U(G,E){this.name=G,this.p=new s(E,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var E=new s(null);return E.words=new Array(Math.ceil(this.n/13)),E},U.prototype.ireduce=function(E){var m=E,f;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),f=m.bitLength();while(f>this.n);var p=f0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},U.prototype.split=function(E,m){E.iushrn(this.n,0,m)},U.prototype.imulK=function(E){return E.imul(this.k)};function K(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(K,U),K.prototype.split=function(E,m){for(var f=4194303,p=Math.min(E.length,9),v=0;v>>22,x=_}x>>>=22,E.words[v-10]=x,x===0&&E.length>10?E.length-=10:E.length-=9},K.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var m=0,f=0;f>>=26,E.words[f]=v,m=p}return m!==0&&(E.words[E.length++]=m),E},s._prime=function(E){if(q[E])return q[E];var m;if(E==="k256")m=new K;else if(E==="p224")m=new J;else if(E==="p192")m=new T;else if(E==="p25519")m=new z;else throw new Error("Unknown prime "+E);return q[E]=m,m};function ue(G){if(typeof G=="string"){var E=s._prime(G);this.m=E.p,this.prime=E}else n(G.gtn(1),"modulus must be greater than 1"),this.m=G,this.prime=null}ue.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},ue.prototype._verify2=function(E,m){n((E.negative|m.negative)===0,"red works only with positives"),n(E.red&&E.red===m.red,"red works only with red numbers")},ue.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},ue.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},ue.prototype.add=function(E,m){this._verify2(E,m);var f=E.add(m);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},ue.prototype.iadd=function(E,m){this._verify2(E,m);var f=E.iadd(m);return f.cmp(this.m)>=0&&f.isub(this.m),f},ue.prototype.sub=function(E,m){this._verify2(E,m);var f=E.sub(m);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},ue.prototype.isub=function(E,m){this._verify2(E,m);var f=E.isub(m);return f.cmpn(0)<0&&f.iadd(this.m),f},ue.prototype.shl=function(E,m){return this._verify1(E),this.imod(E.ushln(m))},ue.prototype.imul=function(E,m){return this._verify2(E,m),this.imod(E.imul(m))},ue.prototype.mul=function(E,m){return this._verify2(E,m),this.imod(E.mul(m))},ue.prototype.isqr=function(E){return this.imul(E,E.clone())},ue.prototype.sqr=function(E){return this.mul(E,E)},ue.prototype.sqrt=function(E){if(E.isZero())return E.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(E,f)}for(var p=this.m.subn(1),v=0;!p.isZero()&&p.andln(1)===0;)v++,p.iushrn(1);n(!p.isZero());var x=new s(1).toRed(this),_=x.redNeg(),S=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new s(2*b*b).toRed(this);this.pow(b,S).cmp(_)!==0;)b.redIAdd(_);for(var M=this.pow(b,p),I=this.pow(E,p.addn(1).iushrn(1)),F=this.pow(E,p),ae=v;F.cmp(x)!==0;){for(var O=F,se=0;O.cmp(x)!==0;se++)O=O.redSqr();n(se=0;v--){for(var M=m.words[v],I=b-1;I>=0;I--){var F=M>>I&1;if(x!==p[0]&&(x=this.sqr(x)),F===0&&_===0){S=0;continue}_<<=1,_|=F,S++,!(S!==f&&(v!==0||I!==0))&&(x=this.mul(x,p[_]),S=0,_=0)}b=26}return x},ue.prototype.convertTo=function(E){var m=E.umod(this.m);return m===E?m.clone():m},ue.prototype.convertFrom=function(E){var m=E.clone();return m.red=null,m},s.mont=function(E){return new _e(E)};function _e(G){ue.call(this,G),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(_e,ue),_e.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},_e.prototype.convertFrom=function(E){var m=this.imod(E.mul(this.rinv));return m.red=null,m},_e.prototype.imul=function(E,m){if(E.isZero()||m.isZero())return E.words[0]=0,E.length=1,E;var f=E.imul(m),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.mul=function(E,m){if(E.isZero()||m.isZero())return new s(0)._forceRed(this);var f=E.mul(m),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.invm=function(E){var m=this.imod(E._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,nn)}(Wm);var wo=Wm.exports,Km={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var u=0;u>8,g=l&255;d?a.push(d,g):a.push(g)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(N>>1)-1?k=(N>>1)-$:k=$,D.isubn(k)):k=0,A[P]=k,D.iushrn(1)}return A}e.getNAF=s;function o(d,g){var y=[[],[]];d=d.clone(),g=g.clone();for(var A=0,P=0,N;d.cmpn(-A)>0||g.cmpn(-P)>0;){var D=d.andln(3)+A&3,k=g.andln(3)+P&3;D===3&&(D=-1),k===3&&(k=-1);var $;D&1?(N=d.andln(7)+A&7,(N===3||N===5)&&k===2?$=-D:$=D):$=0,y[0].push($);var q;k&1?(N=g.andln(7)+P&7,(N===3||N===5)&&D===2?q=-k:q=k):q=0,y[1].push(q),2*A===$+1&&(A=1-A),2*P===q+1&&(P=1-P),d.iushrn(1),g.iushrn(1)}return y}e.getJSF=o;function a(d,g,y){var A="_"+g;d.prototype[g]=function(){return this[A]!==void 0?this[A]:this[A]=y.call(this)}}e.cachedProperty=a;function u(d){return typeof d=="string"?e.toArray(d,"hex"):d}e.parseBytes=u;function l(d){return new r(d,"hex","le")}e.intFromLE=l}(Ti);var Vm={exports:{}},Gm;Vm.exports=function(e){return Gm||(Gm=new oa(null)),Gm.generate(e)};function oa(t){this.rand=t}if(Vm.exports.Rand=oa,oa.prototype.generate=function(e){return this._rand(e)},oa.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Td=aa;aa.prototype.point=function(){throw new Error("Not implemented")},aa.prototype.validate=function(){throw new Error("Not implemented")},aa.prototype._fixedNafMul=function(e,r){Cd(e.precomputed);var n=e._getDoubles(),i=Id(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),g=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Cd(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},aa.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,g,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=Id(n[P],o[P],this._bitLength),u[N]=Id(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],$=Ek(n[P],n[N]);for(l=Math.max($[0].length,l),u[P]=new Array(l),u[N]=new Array(l),g=0;g=0;d--){for(var T=0;d>=0;){var z=!0;for(g=0;g=0&&T++,K=K.dblp(T),d<0)break;for(g=0;g0?y=a[g][ue-1>>1]:ue<0&&(y=a[g][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Ki.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),g.negative&&(g=g.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:g,b:y},{a:A,b:P}]},Vi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),g=e.sub(a).sub(u),y=l.add(d).neg();return{k1:g,k2:y}},Vi.prototype.pointFromX=function(e,r){e=new en(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Vi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Vi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},On.prototype.isInfinity=function(){return this.inf},On.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},On.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},On.prototype.getX=function(){return this.x.fromRed()},On.prototype.getY=function(){return this.y.fromRed()},On.prototype.mul=function(e){return e=new en(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},On.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},On.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},On.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},On.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},On.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function jn(t,e,r,n){vu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new en(0)):(this.x=new en(e,16),this.y=new en(r,16),this.z=new en(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Jm(jn,vu.BasePoint),Vi.prototype.jpoint=function(e,r,n){return new jn(this,e,r,n)},jn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},jn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},jn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),g=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(g).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(g)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},jn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),g=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(g).redISub(g),A=u.redMul(g.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},jn.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},jn.prototype.inspect=function(){return this.isInfinity()?"":""},jn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var bu=wo,I3=bd,Rd=Td,Mk=Ti;function yu(t){Rd.call(this,"mont",t),this.a=new bu(t.a,16).toRed(this.red),this.b=new bu(t.b,16).toRed(this.red),this.i4=new bu(4).toRed(this.red).redInvm(),this.two=new bu(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}I3(yu,Rd);var Ik=yu;yu.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function Nn(t,e,r){Rd.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new bu(e,16),this.z=new bu(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}I3(Nn,Rd.BasePoint),yu.prototype.decodePoint=function(e,r){return this.point(Mk.toArray(e,r),1)},yu.prototype.point=function(e,r){return new Nn(this,e,r)},yu.prototype.pointFromJSON=function(e){return Nn.fromJSON(this,e)},Nn.prototype.precompute=function(){},Nn.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Nn.fromJSON=function(e,r){return new Nn(e,r[0],r[1]||e.one)},Nn.prototype.inspect=function(){return this.isInfinity()?"":""},Nn.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Nn.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)},Nn.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),u=s.redMul(i),l=r.z.redMul(a.redAdd(u).redSqr()),d=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(l,d)},Nn.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i},Nn.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Nn.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Nn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var Ck=Ti,xo=wo,C3=bd,Dd=Td,Tk=Ck.assert;function qs(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Dd.call(this,"edwards",t),this.a=new xo(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new xo(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new xo(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Tk(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}C3(qs,Dd);var Rk=qs;qs.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},qs.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},qs.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)},qs.prototype.pointFromX=function(e,r){e=new xo(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var u=a.fromRed().isOdd();return(r&&!u||!r&&u)&&(a=a.redNeg()),this.point(e,a)},qs.prototype.pointFromY=function(e,r){e=new xo(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)},qs.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function Hr(t,e,r,n,i){Dd.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new xo(e,16),this.y=new xo(r,16),this.z=n?new xo(n,16):this.curve.one,this.t=i&&new xo(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}C3(Hr,Dd.BasePoint),qs.prototype.pointFromJSON=function(e){return Hr.fromJSON(this,e)},qs.prototype.point=function(e,r,n,i){return new Hr(this,e,r,n,i)},Hr.fromJSON=function(e,r){return new Hr(e,r[0],r[1],r[2])},Hr.prototype.inspect=function(){return this.isInfinity()?"":""},Hr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Hr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),u=i.redSub(r),l=s.redMul(a),d=o.redMul(u),g=s.redMul(u),y=a.redMul(o);return this.curve.point(l,d,y,g)},Hr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,u,l;if(this.curve.twisted){a=this.curve._mulA(r);var d=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(d.redSub(this.curve.two)),s=d.redMul(a.redSub(n)),o=d.redSqr().redSub(d).redSub(d)):(u=this.z.redSqr(),l=d.redSub(u).redISub(u),i=e.redSub(r).redISub(n).redMul(l),s=d.redMul(a.redSub(n)),o=d.redMul(l))}else a=r.redAdd(n),u=this.curve._mulC(this.z).redSqr(),l=a.redSub(u).redSub(u),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)},Hr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Hr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),u=s.redAdd(i),l=n.redAdd(r),d=o.redMul(a),g=u.redMul(l),y=o.redMul(l),A=a.redMul(u);return this.curve.point(d,g,A,y)},Hr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),u=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),d=r.redMul(a).redMul(l),g,y;return this.curve.twisted?(g=r.redMul(u).redMul(s.redSub(this.curve._mulA(i))),y=a.redMul(u)):(g=r.redMul(u).redMul(s.redSub(i)),y=this.curve._mulC(a).redMul(u)),this.curve.point(d,g,y)},Hr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Hr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Hr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)},Hr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)},Hr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Hr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Hr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Hr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Hr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Hr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Hr.prototype.toP=Hr.prototype.normalize,Hr.prototype.mixedAdd=Hr.prototype.add,function(t){var e=t;e.base=Td,e.short=Pk,e.mont=Ik,e.edwards=Rk}(Ym);var Od={},Xm,T3;function Dk(){return T3||(T3=1,Xm={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Xm}(function(t){var e=t,r=ol,n=Ym,i=Ti,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,d){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var g=new o(d);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:g}),g}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=Dk()}catch{u=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})})(Od);var Ok=ol,Xa=Km,R3=Va;function ca(t){if(!(this instanceof ca))return new ca(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Xa.toArray(t.entropy,t.entropyEnc||"hex"),r=Xa.toArray(t.nonce,t.nonceEnc||"hex"),n=Xa.toArray(t.pers,t.persEnc||"hex");R3(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Nk=ca;ca.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ca.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Xa.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var Nd=wo,Qm=Ti,Bk=Qm.assert;function Ld(t,e){if(t instanceof Ld)return t;this._importDER(t,e)||(Bk(t.r&&t.s,"Signature without r or s"),this.r=new Nd(t.r,16),this.s=new Nd(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Fk=Ld;function Uk(){this.place=0}function e1(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function D3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Ld.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=D3(r),n=D3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];t1(i,r.length),i=i.concat(r),i.push(2),t1(i,n.length);var s=i.concat(n),o=[48];return t1(o,s.length),o=o.concat(s),Qm.encode(o,e)};var _o=wo,O3=Nk,jk=Ti,r1=Od,qk=M3,N3=jk.assert,n1=$k,kd=Fk;function Gi(t){if(!(this instanceof Gi))return new Gi(t);typeof t=="string"&&(N3(Object.prototype.hasOwnProperty.call(r1,t),"Unknown curve "+t),t=r1[t]),t instanceof r1.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var zk=Gi;Gi.prototype.keyPair=function(e){return new n1(this,e)},Gi.prototype.keyFromPrivate=function(e,r){return n1.fromPrivate(this,e,r)},Gi.prototype.keyFromPublic=function(e,r){return n1.fromPublic(this,e,r)},Gi.prototype.genKeyPair=function(e){e||(e={});for(var r=new O3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||qk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new _o(2));;){var s=new _o(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Gi.prototype._truncateToN=function(e,r,n){var i;if(_o.isBN(e)||typeof e=="number")e=new _o(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new _o(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new _o(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Gi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new O3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new _o(1)),d=0;;d++){var g=i.k?i.k(d):new _o(u.generate(this.n.byteLength()));if(g=this._truncateToN(g,!0),!(g.cmpn(1)<=0||g.cmp(l)>=0)){var y=this.g.mul(g);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=g.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new kd({r:P,s:N,recoveryParam:D})}}}}}},Gi.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new kd(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),l=u.mul(e).umod(this.n),d=u.mul(o).umod(this.n),g;return this.curve._maxwellTrick?(g=this.g.jmulAdd(l,n.getPublic(),d),g.isInfinity()?!1:g.eqXToP(o)):(g=this.g.mulAdd(l,n.getPublic(),d),g.isInfinity()?!1:g.getX().umod(this.n).cmp(o)===0)},Gi.prototype.recoverPubKey=function(t,e,r,n){N3((3&r)===r,"The recovery param is more than two bits"),e=new kd(e,n);var i=this.n,s=new _o(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),g=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(g,o,y)},Gi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new kd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var hl=Ti,L3=hl.assert,k3=hl.parseBytes,wu=hl.cachedProperty;function Ln(t,e){this.eddsa=t,this._secret=k3(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=k3(e.pub)}Ln.fromPublic=function(e,r){return r instanceof Ln?r:new Ln(e,{pub:r})},Ln.fromSecret=function(e,r){return r instanceof Ln?r:new Ln(e,{secret:r})},Ln.prototype.secret=function(){return this._secret},wu(Ln,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),wu(Ln,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),wu(Ln,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i}),wu(Ln,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),wu(Ln,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),wu(Ln,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Ln.prototype.sign=function(e){return L3(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Ln.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},Ln.prototype.getSecret=function(e){return L3(this._secret,"KeyPair is public only"),hl.encode(this.secret(),e)},Ln.prototype.getPublic=function(e){return hl.encode(this.pubBytes(),e)};var Hk=Ln,Wk=wo,$d=Ti,$3=$d.assert,Bd=$d.cachedProperty,Kk=$d.parseBytes;function Za(t,e){this.eddsa=t,typeof e!="object"&&(e=Kk(e)),Array.isArray(e)&&($3(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),$3(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof Wk&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Bd(Za,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Bd(Za,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Bd(Za,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Bd(Za,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Za.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Za.prototype.toHex=function(){return $d.encode(this.toBytes(),"hex").toUpperCase()};var Vk=Za,Gk=ol,Yk=Od,xu=Ti,Jk=xu.assert,B3=xu.parseBytes,F3=Hk,U3=Vk;function vi(t){if(Jk(t==="ed25519","only tested with ed25519 so far"),!(this instanceof vi))return new vi(t);t=Yk[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=Gk.sha512}var Xk=vi;vi.prototype.sign=function(e,r){e=B3(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),u=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:u,Rencoded:o})},vi.prototype.verify=function(e,r,n){if(e=B3(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)},vi.prototype.hashInt=function(){for(var e=this.hash(),r=0;re in t?e$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,H3=(t,e)=>{for(var r in e||(e={}))t$.call(e,r)&&z3(t,r,e[r]);if(q3)for(var r of q3(e))r$.call(e,r)&&z3(t,r,e[r]);return t};const n$="ReactNative",Ri={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},i$="js";function Fd(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Eu(){return!rl()&&!!mm()&&navigator.product===n$}function dl(){return!Fd()&&!!mm()&&!!rl()}function pl(){return Eu()?Ri.reactNative:Fd()?Ri.node:dl()?Ri.browser:Ri.unknown}function s$(){var t;try{return Eu()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function o$(t,e){let r=nl.parse(t);return r=H3(H3({},r),e),t=nl.stringify(r),t}function W3(){return Ax()||{name:"",description:"",url:"",icons:[""]}}function a$(){if(pl()===Ri.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=OO();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function c$(){var t;const e=pl();return e===Ri.browser?[e,((t=Sx())==null?void 0:t.host)||"unknown"].join(":"):e}function K3(t,e,r){const n=a$(),i=c$();return[[t,e].join("-"),[i$,r].join("-"),n,i].join("/")}function u$({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const u=r.split("?"),l=K3(t,e,n),d={auth:i,ua:l,projectId:s,useOnCloseEvent:o,origin:a||void 0},g=o$(u[1]||"",d);return u[0]+"?"+g}function Qa(t,e){return t.filter(r=>e.includes(r)).length===t.length}function V3(t){return Object.fromEntries(t.entries())}function G3(t){return new Map(Object.entries(t))}function ec(t=mt.FIVE_MINUTES,e){const r=mt.toMiliseconds(t||mt.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Su(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function Y3(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function f$(t){return Y3("topic",t)}function l$(t){return Y3("id",t)}function J3(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function En(t,e){return mt.fromMiliseconds(Date.now()+mt.toMiliseconds(t))}function ua(t){return Date.now()>=mt.toMiliseconds(t)}function vr(t,e){return`${t}${e?`:${e}`:""}`}function Ud(t=[],e=[]){return[...new Set([...t,...e])]}async function h$({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=d$(s,t,e),a=pl();if(a===Ri.browser){if(!((n=rl())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,g$()?"_blank":"_self","noreferrer noopener")}else a===Ri.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function d$(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${m$(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function p$(t,e){let r="";try{if(dl()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function X3(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function Z3(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function i1(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function g$(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function m$(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function Q3(t){return Buffer.from(t,"base64").toString("utf-8")}const v$="https://rpc.walletconnect.org/v1";async function b$(t,e,r,n,i,s){switch(r.t){case"eip191":return y$(t,e,r.s);case"eip1271":return await w$(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function y$(t,e,r){return ck(jx(e),r).toLowerCase()===t.toLowerCase()}async function w$(t,e,r,n,i,s){const o=_u(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",d=r.substring(2),g=jx(e).substring(2),y=a+g+u+l+d,A=await fetch(`${s||v$}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:x$(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:y},"latest"]})}),{result:P}=await A.json();return P?P.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function x$(){return Date.now()+Math.floor(Math.random()*1e3)}var _$=Object.defineProperty,E$=Object.defineProperties,S$=Object.getOwnPropertyDescriptors,e_=Object.getOwnPropertySymbols,A$=Object.prototype.hasOwnProperty,P$=Object.prototype.propertyIsEnumerable,t_=(t,e,r)=>e in t?_$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,M$=(t,e)=>{for(var r in e||(e={}))A$.call(e,r)&&t_(t,r,e[r]);if(e_)for(var r of e_(e))P$.call(e,r)&&t_(t,r,e[r]);return t},I$=(t,e)=>E$(t,S$(e));const C$="did:pkh:",s1=t=>t==null?void 0:t.split(":"),T$=t=>{const e=t&&s1(t);if(e)return t.includes(C$)?e[3]:e[1]},o1=t=>{const e=t&&s1(t);if(e)return e[2]+":"+e[3]},jd=t=>{const e=t&&s1(t);if(e)return e.pop()};async function r_(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=n_(i,i.iss),o=jd(i.iss);return await b$(o,s,n,o1(i.iss),r)}const n_=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=jd(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${T$(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,d=t.exp?`Expiration Time: ${t.exp}`:void 0,g=t.nbf?`Not Before: ${t.nbf}`:void 0,y=t.requestId?`Request ID: ${t.requestId}`:void 0,A=t.resources?`Resources:${t.resources.map(N=>` -- ${N}`).join("")}`:void 0,P=qd(t.resources);if(P){const N=gl(P);i=F$(i,N)}return[r,n,"",i,"",s,o,a,u,l,d,g,y,A].filter(N=>N!=null).join(` -`)};function R$(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function D$(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function tc(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function O$(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:N$(e,r,n)}}}function N$(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function i_(t){return tc(t),`urn:recap:${R$(t).replace(/=/g,"")}`}function gl(t){const e=D$(t.replace("urn:recap:",""));return tc(e),e}function L$(t,e,r){const n=O$(t,e,r);return i_(n)}function k$(t){return t&&t.includes("urn:recap:")}function $$(t,e){const r=gl(t),n=gl(e),i=B$(r,n);return i_(i)}function B$(t,e){tc(t),tc(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,u)=>a.localeCompare(u)).forEach(a=>{var u,l;n.att[i]=I$(M$({},n.att[i]),{[a]:((u=t.att[i])==null?void 0:u[a])||((l=e.att[i])==null?void 0:l[a])})})}),n}function F$(t="",e){tc(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const u=Object.keys(e.att[a]).map(g=>({ability:g.split("/")[0],action:g.split("/")[1]}));u.sort((g,y)=>g.action.localeCompare(y.action));const l={};u.forEach(g=>{l[g.ability]||(l[g.ability]=[]),l[g.ability].push(g.action)});const d=Object.keys(l).map(g=>(i++,`(${i}) '${g}': '${l[g].join("', '")}' for '${a}'.`));n.push(d.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function s_(t){var e;const r=gl(t);tc(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function o_(t){const e=gl(t);tc(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function qd(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return k$(e)?e:void 0}const a_="base10",ni="base16",fa="base64pad",ml="base64url",vl="utf8",c_=0,Eo=1,bl=2,U$=0,u_=1,yl=12,a1=32;function j$(){const t=Hm.generateKeyPair();return{privateKey:Tn(t.secretKey,ni),publicKey:Tn(t.publicKey,ni)}}function c1(){const t=ea.randomBytes(a1);return Tn(t,ni)}function q$(t,e){const r=Hm.sharedKey(Rn(t,ni),Rn(e,ni),!0),n=new xk(fl.SHA256,r).expand(a1);return Tn(n,ni)}function zd(t){const e=fl.hash(Rn(t,ni));return Tn(e,ni)}function So(t){const e=fl.hash(Rn(t,vl));return Tn(e,ni)}function f_(t){return Rn(`${t}`,a_)}function rc(t){return Number(Tn(t,a_))}function z$(t){const e=f_(typeof t.type<"u"?t.type:c_);if(rc(e)===Eo&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Rn(t.senderPublicKey,ni):void 0,n=typeof t.iv<"u"?Rn(t.iv,ni):ea.randomBytes(yl),i=new jm.ChaCha20Poly1305(Rn(t.symKey,ni)).seal(n,Rn(t.message,vl));return l_({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function H$(t,e){const r=f_(bl),n=ea.randomBytes(yl),i=Rn(t,vl);return l_({type:r,sealed:i,iv:n,encoding:e})}function W$(t){const e=new jm.ChaCha20Poly1305(Rn(t.symKey,ni)),{sealed:r,iv:n}=wl({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Tn(i,vl)}function K$(t,e){const{sealed:r}=wl({encoded:t,encoding:e});return Tn(r,vl)}function l_(t){const{encoding:e=fa}=t;if(rc(t.type)===bl)return Tn(dd([t.type,t.sealed]),e);if(rc(t.type)===Eo){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Tn(dd([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return Tn(dd([t.type,t.iv,t.sealed]),e)}function wl(t){const{encoded:e,encoding:r=fa}=t,n=Rn(e,r),i=n.slice(U$,u_),s=u_;if(rc(i)===Eo){const l=s+a1,d=l+yl,g=n.slice(s,l),y=n.slice(l,d),A=n.slice(d);return{type:i,sealed:A,iv:y,senderPublicKey:g}}if(rc(i)===bl){const l=n.slice(s),d=ea.randomBytes(yl);return{type:i,sealed:l,iv:d}}const o=s+yl,a=n.slice(s,o),u=n.slice(o);return{type:i,sealed:u,iv:a}}function V$(t,e){const r=wl({encoded:t,encoding:e==null?void 0:e.encoding});return h_({type:rc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Tn(r.senderPublicKey,ni):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function h_(t){const e=(t==null?void 0:t.type)||c_;if(e===Eo){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function d_(t){return t.type===Eo&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function p_(t){return t.type===bl}function G$(t){return new A3.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function Y$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function J$(t){return Buffer.from(Y$(t),"base64")}function X$(t,e){const[r,n,i]=t.split("."),s=J$(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),u=`${r}.${n}`,l=new fl.SHA256().update(Buffer.from(u)).digest(),d=G$(e),g=Buffer.from(l).toString("hex");if(!d.verify(g,{r:o,s:a}))throw new Error("Invalid signature");return gm(t).payload}const Z$="irn";function u1(t){return(t==null?void 0:t.relay)||{protocol:Z$}}function xl(t){const e=Zk[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var Q$=Object.defineProperty,eB=Object.defineProperties,tB=Object.getOwnPropertyDescriptors,g_=Object.getOwnPropertySymbols,rB=Object.prototype.hasOwnProperty,nB=Object.prototype.propertyIsEnumerable,m_=(t,e,r)=>e in t?Q$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v_=(t,e)=>{for(var r in e||(e={}))rB.call(e,r)&&m_(t,r,e[r]);if(g_)for(var r of g_(e))nB.call(e,r)&&m_(t,r,e[r]);return t},iB=(t,e)=>eB(t,tB(e));function sB(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function b_(t){if(!t.includes("wc:")){const u=Q3(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=nl.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:oB(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:sB(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function oB(t){return t.startsWith("//")?t.substring(2):t}function aB(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function y_(t){return`${t.protocol}:${t.topic}@${t.version}?`+nl.stringify(v_(iB(v_({symKey:t.symKey},aB(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Hd(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Au(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function cB(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Au(r.accounts))}),e}function uB(t,e){const r=[];return Object.values(t).forEach(n=>{Au(n.accounts).includes(e)&&r.push(...n.methods)}),r}function fB(t,e){const r=[];return Object.values(t).forEach(n=>{Au(n.accounts).includes(e)&&r.push(...n.events)}),r}function f1(t){return t.includes(":")}function _l(t){return f1(t)?t.split(":")[0]:t}function lB(t){const e={};return t==null||t.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function w_(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=lB(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=Ud(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const hB={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},dB={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ut(t,e){const{message:r,code:n}=dB[t];return{message:e?`${r} ${e}`:r,code:n}}function Dr(t,e){const{message:r,code:n}=hB[t];return{message:e?`${r} ${e}`:r,code:n}}function nc(t,e){return!!Array.isArray(t)}function El(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function bi(t){return typeof t>"u"}function an(t,e){return e&&bi(t)?!0:typeof t=="string"&&!!t.trim().length}function l1(t,e){return typeof t=="number"&&!isNaN(t)}function pB(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return Qa(i,n)?(n.forEach(o=>{const{accounts:a,methods:u,events:l}=t.namespaces[o],d=Au(a),g=r[o];(!Qa(j3(o,g),d)||!Qa(g.methods,u)||!Qa(g.events,l))&&(s=!1)}),s):!1}function Wd(t){return an(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function gB(t){if(an(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Wd(r)}}return!1}function mB(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(an(t,!1)){if(e(t))return!0;const r=Q3(t);return e(r)}}catch{}return!1}function vB(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function bB(t){return t==null?void 0:t.topic}function yB(t,e){let r=null;return an(t==null?void 0:t.publicKey,!1)||(r=ut("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function x_(t){let e=!0;return nc(t)?t.length&&(e=t.every(r=>an(r,!1))):e=!1,e}function wB(t,e,r){let n=null;return nc(e)&&e.length?e.forEach(i=>{n||Wd(i)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Wd(t)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function xB(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=wB(i,j3(i,s),`${e} ${r}`);o&&(n=o)}),n}function _B(t,e){let r=null;return nc(t)?t.forEach(n=>{r||gB(n)||(r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function EB(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=_B(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function SB(t,e){let r=null;return x_(t==null?void 0:t.methods)?x_(t==null?void 0:t.events)||(r=Dr("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Dr("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function __(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=SB(n,`${e}, namespace`);i&&(r=i)}),r}function AB(t,e,r){let n=null;if(t&&El(t)){const i=__(t,e);i&&(n=i);const s=xB(t,e,r);s&&(n=s)}else n=ut("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function h1(t,e){let r=null;if(t&&El(t)){const n=__(t,e);n&&(r=n);const i=EB(t,e);i&&(r=i)}else r=ut("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function E_(t){return an(t.protocol,!0)}function PB(t,e){let r=!1;return t?t&&nc(t)&&t.length&&t.forEach(n=>{r=E_(n)}):r=!0,r}function MB(t){return typeof t=="number"}function yi(t){return typeof t<"u"&&typeof t!==null}function IB(t){return!(!t||typeof t!="object"||!t.code||!l1(t.code)||!t.message||!an(t.message,!1))}function CB(t){return!(bi(t)||!an(t.method,!1))}function TB(t){return!(bi(t)||bi(t.result)&&bi(t.error)||!l1(t.id)||!an(t.jsonrpc,!1))}function RB(t){return!(bi(t)||!an(t.name,!1))}function S_(t,e){return!(!Wd(e)||!cB(t).includes(e))}function DB(t,e,r){return an(r,!1)?uB(t,e).includes(r):!1}function OB(t,e,r){return an(r,!1)?fB(t,e).includes(r):!1}function A_(t,e,r){let n=null;const i=NB(t),s=LB(e),o=Object.keys(i),a=Object.keys(s),u=P_(Object.keys(t)),l=P_(Object.keys(e)),d=u.filter(g=>!l.includes(g));return d.length&&(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. + */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=nn:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],g=[4,1024,262144,67108864],y=[1,256,65536,16777216],A=[6,1536,393216,100663296],P=[0,8,16,24],O=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],D=[224,256,384,512],k=[128,256],B=["hex","buffer","arrayBuffer","array","digest"],j={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(N){return Object.prototype.toString.call(N)==="[object Array]"}),u&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(N){return typeof N=="object"&&N.buffer&&N.buffer.constructor===ArrayBuffer});for(var U=function(N,se,ee){return function(X){return new I(N,se,N).update(X)[ee]()}},K=function(N,se,ee){return function(X,Q){return new I(N,se,Q).update(X)[ee]()}},J=function(N,se,ee){return function(X,Q,R,Z){return f["cshake"+N].update(X,Q,R,Z)[ee]()}},T=function(N,se,ee){return function(X,Q,R,Z){return f["kmac"+N].update(X,Q,R,Z)[ee]()}},z=function(N,se,ee,X){for(var Q=0;Q>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ee>>5,this.extraBytes=(ee&31)>>3;for(var X=0;X<50;++X)this.s[X]=0}I.prototype.update=function(N){if(this.finalized)throw new Error(r);var se,ee=typeof N;if(ee!=="string"){if(ee==="object"){if(N===null)throw new Error(e);if(u&&N.constructor===ArrayBuffer)N=new Uint8Array(N);else if(!Array.isArray(N)&&(!u||!ArrayBuffer.isView(N)))throw new Error(e)}else throw new Error(e);se=!0}for(var X=this.blocks,Q=this.byteCount,R=N.length,Z=this.blockCount,te=0,he=this.s,ie,fe;te>2]|=N[te]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(X[ie>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=Q){for(this.start=ie-Q,this.block=X[Z],ie=0;ie>8,ee=N&255;ee>0;)Q.unshift(ee),N=N>>8,ee=N&255,++X;return se?Q.push(X):Q.unshift(X),this.update(Q),Q.length},I.prototype.encodeString=function(N){var se,ee=typeof N;if(ee!=="string"){if(ee==="object"){if(N===null)throw new Error(e);if(u&&N.constructor===ArrayBuffer)N=new Uint8Array(N);else if(!Array.isArray(N)&&(!u||!ArrayBuffer.isView(N)))throw new Error(e)}else throw new Error(e);se=!0}var X=0,Q=N.length;if(se)X=Q;else for(var R=0;R=57344?X+=3:(Z=65536+((Z&1023)<<10|N.charCodeAt(++R)&1023),X+=4)}return X+=this.encode(X*8),this.update(N),X},I.prototype.bytepad=function(N,se){for(var ee=this.encode(se),X=0;X>2]|=this.padding[se&3],this.lastByteIndex===this.byteCount)for(N[0]=N[ee],se=1;se>4&15]+l[te&15]+l[te>>12&15]+l[te>>8&15]+l[te>>20&15]+l[te>>16&15]+l[te>>28&15]+l[te>>24&15];R%N===0&&(ae(se),Q=0)}return X&&(te=se[Q],Z+=l[te>>4&15]+l[te&15],X>1&&(Z+=l[te>>12&15]+l[te>>8&15]),X>2&&(Z+=l[te>>20&15]+l[te>>16&15])),Z},I.prototype.arrayBuffer=function(){this.finalize();var N=this.blockCount,se=this.s,ee=this.outputBlocks,X=this.extraBytes,Q=0,R=0,Z=this.outputBits>>3,te;X?te=new ArrayBuffer(ee+1<<2):te=new ArrayBuffer(Z);for(var he=new Uint32Array(te);R>8&255,Z[te+2]=he>>16&255,Z[te+3]=he>>24&255;R%N===0&&ae(se)}return X&&(te=R<<2,he=se[Q],Z[te]=he&255,X>1&&(Z[te+1]=he>>8&255),X>2&&(Z[te+2]=he>>16&255)),Z};function F(N,se,ee){I.call(this,N,se,ee)}F.prototype=new I,F.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var ae=function(N){var se,ee,X,Q,R,Z,te,he,ie,fe,ve,Me,Ne,Te,$e,Ie,Le,Ve,ke,ze,He,Ee,Qe,ct,Be,et,rt,Je,pt,ht,ft,Ht,Jt,St,er,Xt,Ot,Bt,Tt,vt,Dt,Lt,bt,$t,jt,nt,Ft,$,H,V,C,Y,q,oe,ge,xe,Re,De,it,Ue,gt,st,tt;for(X=0;X<48;X+=2)Q=N[0]^N[10]^N[20]^N[30]^N[40],R=N[1]^N[11]^N[21]^N[31]^N[41],Z=N[2]^N[12]^N[22]^N[32]^N[42],te=N[3]^N[13]^N[23]^N[33]^N[43],he=N[4]^N[14]^N[24]^N[34]^N[44],ie=N[5]^N[15]^N[25]^N[35]^N[45],fe=N[6]^N[16]^N[26]^N[36]^N[46],ve=N[7]^N[17]^N[27]^N[37]^N[47],Me=N[8]^N[18]^N[28]^N[38]^N[48],Ne=N[9]^N[19]^N[29]^N[39]^N[49],se=Me^(Z<<1|te>>>31),ee=Ne^(te<<1|Z>>>31),N[0]^=se,N[1]^=ee,N[10]^=se,N[11]^=ee,N[20]^=se,N[21]^=ee,N[30]^=se,N[31]^=ee,N[40]^=se,N[41]^=ee,se=Q^(he<<1|ie>>>31),ee=R^(ie<<1|he>>>31),N[2]^=se,N[3]^=ee,N[12]^=se,N[13]^=ee,N[22]^=se,N[23]^=ee,N[32]^=se,N[33]^=ee,N[42]^=se,N[43]^=ee,se=Z^(fe<<1|ve>>>31),ee=te^(ve<<1|fe>>>31),N[4]^=se,N[5]^=ee,N[14]^=se,N[15]^=ee,N[24]^=se,N[25]^=ee,N[34]^=se,N[35]^=ee,N[44]^=se,N[45]^=ee,se=he^(Me<<1|Ne>>>31),ee=ie^(Ne<<1|Me>>>31),N[6]^=se,N[7]^=ee,N[16]^=se,N[17]^=ee,N[26]^=se,N[27]^=ee,N[36]^=se,N[37]^=ee,N[46]^=se,N[47]^=ee,se=fe^(Q<<1|R>>>31),ee=ve^(R<<1|Q>>>31),N[8]^=se,N[9]^=ee,N[18]^=se,N[19]^=ee,N[28]^=se,N[29]^=ee,N[38]^=se,N[39]^=ee,N[48]^=se,N[49]^=ee,Te=N[0],$e=N[1],nt=N[11]<<4|N[10]>>>28,Ft=N[10]<<4|N[11]>>>28,Je=N[20]<<3|N[21]>>>29,pt=N[21]<<3|N[20]>>>29,Ue=N[31]<<9|N[30]>>>23,gt=N[30]<<9|N[31]>>>23,Lt=N[40]<<18|N[41]>>>14,bt=N[41]<<18|N[40]>>>14,St=N[2]<<1|N[3]>>>31,er=N[3]<<1|N[2]>>>31,Ie=N[13]<<12|N[12]>>>20,Le=N[12]<<12|N[13]>>>20,$=N[22]<<10|N[23]>>>22,H=N[23]<<10|N[22]>>>22,ht=N[33]<<13|N[32]>>>19,ft=N[32]<<13|N[33]>>>19,st=N[42]<<2|N[43]>>>30,tt=N[43]<<2|N[42]>>>30,oe=N[5]<<30|N[4]>>>2,ge=N[4]<<30|N[5]>>>2,Xt=N[14]<<6|N[15]>>>26,Ot=N[15]<<6|N[14]>>>26,Ve=N[25]<<11|N[24]>>>21,ke=N[24]<<11|N[25]>>>21,V=N[34]<<15|N[35]>>>17,C=N[35]<<15|N[34]>>>17,Ht=N[45]<<29|N[44]>>>3,Jt=N[44]<<29|N[45]>>>3,ct=N[6]<<28|N[7]>>>4,Be=N[7]<<28|N[6]>>>4,xe=N[17]<<23|N[16]>>>9,Re=N[16]<<23|N[17]>>>9,Bt=N[26]<<25|N[27]>>>7,Tt=N[27]<<25|N[26]>>>7,ze=N[36]<<21|N[37]>>>11,He=N[37]<<21|N[36]>>>11,Y=N[47]<<24|N[46]>>>8,q=N[46]<<24|N[47]>>>8,$t=N[8]<<27|N[9]>>>5,jt=N[9]<<27|N[8]>>>5,et=N[18]<<20|N[19]>>>12,rt=N[19]<<20|N[18]>>>12,De=N[29]<<7|N[28]>>>25,it=N[28]<<7|N[29]>>>25,vt=N[38]<<8|N[39]>>>24,Dt=N[39]<<8|N[38]>>>24,Ee=N[48]<<14|N[49]>>>18,Qe=N[49]<<14|N[48]>>>18,N[0]=Te^~Ie&Ve,N[1]=$e^~Le&ke,N[10]=ct^~et&Je,N[11]=Be^~rt&pt,N[20]=St^~Xt&Bt,N[21]=er^~Ot&Tt,N[30]=$t^~nt&$,N[31]=jt^~Ft&H,N[40]=oe^~xe&De,N[41]=ge^~Re&it,N[2]=Ie^~Ve&ze,N[3]=Le^~ke&He,N[12]=et^~Je&ht,N[13]=rt^~pt&ft,N[22]=Xt^~Bt&vt,N[23]=Ot^~Tt&Dt,N[32]=nt^~$&V,N[33]=Ft^~H&C,N[42]=xe^~De&Ue,N[43]=Re^~it>,N[4]=Ve^~ze&Ee,N[5]=ke^~He&Qe,N[14]=Je^~ht&Ht,N[15]=pt^~ft&Jt,N[24]=Bt^~vt&Lt,N[25]=Tt^~Dt&bt,N[34]=$^~V&Y,N[35]=H^~C&q,N[44]=De^~Ue&st,N[45]=it^~gt&tt,N[6]=ze^~Ee&Te,N[7]=He^~Qe&$e,N[16]=ht^~Ht&ct,N[17]=ft^~Jt&Be,N[26]=vt^~Lt&St,N[27]=Dt^~bt&er,N[36]=V^~Y&$t,N[37]=C^~q&jt,N[46]=Ue^~st&oe,N[47]=gt^~tt&ge,N[8]=Ee^~Te&Ie,N[9]=Qe^~$e&Le,N[18]=Ht^~ct&et,N[19]=Jt^~Be&rt,N[28]=Lt^~St&Xt,N[29]=bt^~er&Ot,N[38]=Y^~$t&nt,N[39]=q^~jt&Ft,N[48]=st^~oe&xe,N[49]=tt^~ge&Re,N[0]^=O[X],N[1]^=O[X+1]};if(a)t.exports=f;else for(v=0;v{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const kx=gN();var wm;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(wm||(wm={}));var ps;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(ps||(ps={}));const Bx="0123456789abcdef";class Kr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();vd[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Lx>vd[n])&&console.log.apply(console,r)}debug(...e){this._log(Kr.levels.DEBUG,e)}info(...e){this._log(Kr.levels.INFO,e)}warn(...e){this._log(Kr.levels.WARNING,e)}makeError(e,r,n){if(Nx)return this.makeError("censored error",r,{});r||(r=Kr.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(u=>{const l=n[u];try{if(l instanceof Uint8Array){let d="";for(let g=0;g>4],d+=Bx[l[g]&15];i.push(u+"=Uint8Array(0x"+d+")")}else i.push(u+"="+JSON.stringify(l))}catch{i.push(u+"="+JSON.stringify(n[u].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case ps.NUMERIC_FAULT:{o="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case ps.CALL_EXCEPTION:case ps.INSUFFICIENT_FUNDS:case ps.MISSING_NEW:case ps.NONCE_EXPIRED:case ps.REPLACEMENT_UNDERPRICED:case ps.TRANSACTION_REPLACED:case ps.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(u){a[u]=n[u]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Kr.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){kx&&this.throwError("platform missing String.prototype.normalize",Kr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:kx})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Kr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Kr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return ym||(ym=new Kr(pN)),ym}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Ox){if(!e)return;this.globalLogger().throwError("error censorship permanent",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Nx=!!e,Ox=!!r}static setLogLevel(e){const r=vd[e.toLowerCase()];if(r==null){Kr.globalLogger().warn("invalid log level - "+e);return}Lx=r}static from(e){return new Kr(e)}}Kr.errors=ps,Kr.levels=wm;const mN="bytes/5.7.0",on=new Kr(mN);function $x(t){return!!t.toHexString}function uu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return uu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function vN(t){return Ns(t)&&!(t.length%2)||xm(t)}function Fx(t){return typeof t=="number"&&t==t&&t%1===0}function xm(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!Fx(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function bn(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),uu(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),$x(t)&&(t=t.toHexString()),Ns(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":on.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ibn(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),uu(n)}function yN(t,e){t=bn(t),t.length>e&&on.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),uu(r)}function Ns(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const _m="0123456789abcdef";function Ii(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=_m[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),$x(t))return t.toHexString();if(Ns(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":on.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(xm(t)){let r="0x";for(let n=0;n>4]+_m[i&15]}return r}return on.throwArgumentError("invalid hexlify value","value",t)}function wN(t){if(typeof t!="string")t=Ii(t);else if(!Ns(t)||t.length%2)return null;return(t.length-2)/2}function jx(t,e,r){return typeof t!="string"?t=Ii(t):(!Ns(t)||t.length%2)&&on.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function fu(t,e){for(typeof t!="string"?t=Ii(t):Ns(t)||on.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&on.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Ux(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(vN(t)){let r=bn(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64))):r.length===65?(e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64)),e.v=r[64]):on.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:on.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Ii(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=yN(bn(e._vs),32);e._vs=Ii(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&on.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=Ii(i);e.s==null?e.s=o:e.s!==o&&on.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?on.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&on.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Ns(e.r)?on.throwArgumentError("signature missing or invalid r","signature",t):e.r=fu(e.r,32),e.s==null||!Ns(e.s)?on.throwArgumentError("signature missing or invalid s","signature",t):e.s=fu(e.s,32);const r=bn(e.s);r[0]>=128&&on.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=Ii(r);e._vs&&(Ns(e._vs)||on.throwArgumentError("signature invalid _vs","signature",t),e._vs=fu(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&on.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Em(t){return"0x"+dN.keccak_256(bn(t))}var Sm={exports:{}};Sm.exports,function(t){(function(e,r){function n(m,f){if(!m)throw new Error(f||"Assertion failed")}function i(m,f){m.super_=f;var p=function(){};p.prototype=f.prototype,m.prototype=new p,m.prototype.constructor=m}function s(m,f,p){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((f==="le"||f==="be")&&(p=f,f=10),this._init(m||0,f||10,p||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,p){return f.cmp(p)>0?f:p},s.min=function(f,p){return f.cmp(p)<0?f:p},s.prototype._init=function(f,p,v){if(typeof f=="number")return this._initNumber(f,p,v);if(typeof f=="object")return this._initArray(f,p,v);p==="hex"&&(p=16),n(p===(p|0)&&p>=2&&p<=36),f=f.toString().replace(/\s+/g,"");var x=0;f[0]==="-"&&(x++,this.negative=1),x=0;x-=3)S=f[x]|f[x-1]<<8|f[x-2]<<16,this.words[_]|=S<>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);else if(v==="le")for(x=0,_=0;x>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);return this._strip()};function a(m,f){var p=m.charCodeAt(f);if(p>=48&&p<=57)return p-48;if(p>=65&&p<=70)return p-55;if(p>=97&&p<=102)return p-87;n(!1,"Invalid character in "+m)}function u(m,f,p){var v=a(m,p);return p-1>=f&&(v|=a(m,p-1)<<4),v}s.prototype._parseHex=function(f,p,v){this.length=Math.ceil((f.length-p)/6),this.words=new Array(this.length);for(var x=0;x=p;x-=2)b=u(f,p,x)<<_,this.words[S]|=b&67108863,_>=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8;else{var M=f.length-p;for(x=M%2===0?p+1:p;x=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8}this._strip()};function l(m,f,p,v){for(var x=0,_=0,S=Math.min(m.length,p),b=f;b=49?_=M-49+10:M>=17?_=M-17+10:_=M,n(M>=0&&_1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=g}catch{s.prototype.inspect=g}else s.prototype.inspect=g;function g(){return(this.red?""}var y=["","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"],A=[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,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(f,p){f=f||10,p=p|0||1;var v;if(f===16||f==="hex"){v="";for(var x=0,_=0,S=0;S>>24-x&16777215,x+=2,x>=26&&(x-=26,S--),_!==0||S!==this.length-1?v=y[6-M.length]+M+v:v=M+v}for(_!==0&&(v=_.toString(16)+v);v.length%p!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(f===(f|0)&&f>=2&&f<=36){var I=A[f],F=P[f];v="";var ae=this.clone();for(ae.negative=0;!ae.isZero();){var N=ae.modrn(F).toString(f);ae=ae.idivn(F),ae.isZero()?v=N+v:v=y[I-N.length]+N+v}for(this.isZero()&&(v="0"+v);v.length%p!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,p){return this.toArrayLike(o,f,p)}),s.prototype.toArray=function(f,p){return this.toArrayLike(Array,f,p)};var O=function(f,p){return f.allocUnsafe?f.allocUnsafe(p):new f(p)};s.prototype.toArrayLike=function(f,p,v){this._strip();var x=this.byteLength(),_=v||Math.max(1,x);n(x<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var S=O(f,_),b=p==="le"?"LE":"BE";return this["_toArrayLike"+b](S,x),S},s.prototype._toArrayLikeLE=function(f,p){for(var v=0,x=0,_=0,S=0;_>8&255),v>16&255),S===6?(v>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v=0&&(f[v--]=b>>8&255),v>=0&&(f[v--]=b>>16&255),S===6?(v>=0&&(f[v--]=b>>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v>=0)for(f[v--]=x;v>=0;)f[v--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var p=f,v=0;return p>=4096&&(v+=13,p>>>=13),p>=64&&(v+=7,p>>>=7),p>=8&&(v+=4,p>>>=4),p>=2&&(v+=2,p>>>=2),v+p},s.prototype._zeroBits=function(f){if(f===0)return 26;var p=f,v=0;return p&8191||(v+=13,p>>>=13),p&127||(v+=7,p>>>=7),p&15||(v+=4,p>>>=4),p&3||(v+=2,p>>>=2),p&1||v++,v},s.prototype.bitLength=function(){var f=this.words[this.length-1],p=this._countBits(f);return(this.length-1)*26+p};function D(m){for(var f=new Array(m.bitLength()),p=0;p>>x&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,p=0;pf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var p;this.length>f.length?p=f:p=this;for(var v=0;vf.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var p,v;this.length>f.length?(p=this,v=f):(p=f,v=this);for(var x=0;xf.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var p=Math.ceil(f/26)|0,v=f%26;this._expand(p),v>0&&p--;for(var x=0;x0&&(this.words[x]=~this.words[x]&67108863>>26-v),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,p){n(typeof f=="number"&&f>=0);var v=f/26|0,x=f%26;return this._expand(v+1),p?this.words[v]=this.words[v]|1<f.length?(v=this,x=f):(v=f,x=this);for(var _=0,S=0;S>>26;for(;_!==0&&S>>26;if(this.length=v.length,_!==0)this.words[this.length]=_,this.length++;else if(v!==this)for(;Sf.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var p=this.iadd(f);return f.negative=1,p._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var v=this.cmp(f);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,_;v>0?(x=this,_=f):(x=f,_=this);for(var S=0,b=0;b<_.length;b++)p=(x.words[b]|0)-(_.words[b]|0)+S,S=p>>26,this.words[b]=p&67108863;for(;S!==0&&b>26,this.words[b]=p&67108863;if(S===0&&b>>26,ae=M&67108863,N=Math.min(I,f.length-1),se=Math.max(0,I-m.length+1);se<=N;se++){var ee=I-se|0;x=m.words[ee]|0,_=f.words[se]|0,S=x*_+ae,F+=S/67108864|0,ae=S&67108863}p.words[I]=ae|0,M=F|0}return M!==0?p.words[I]=M|0:p.length--,p._strip()}var B=function(f,p,v){var x=f.words,_=p.words,S=v.words,b=0,M,I,F,ae=x[0]|0,N=ae&8191,se=ae>>>13,ee=x[1]|0,X=ee&8191,Q=ee>>>13,R=x[2]|0,Z=R&8191,te=R>>>13,he=x[3]|0,ie=he&8191,fe=he>>>13,ve=x[4]|0,Me=ve&8191,Ne=ve>>>13,Te=x[5]|0,$e=Te&8191,Ie=Te>>>13,Le=x[6]|0,Ve=Le&8191,ke=Le>>>13,ze=x[7]|0,He=ze&8191,Ee=ze>>>13,Qe=x[8]|0,ct=Qe&8191,Be=Qe>>>13,et=x[9]|0,rt=et&8191,Je=et>>>13,pt=_[0]|0,ht=pt&8191,ft=pt>>>13,Ht=_[1]|0,Jt=Ht&8191,St=Ht>>>13,er=_[2]|0,Xt=er&8191,Ot=er>>>13,Bt=_[3]|0,Tt=Bt&8191,vt=Bt>>>13,Dt=_[4]|0,Lt=Dt&8191,bt=Dt>>>13,$t=_[5]|0,jt=$t&8191,nt=$t>>>13,Ft=_[6]|0,$=Ft&8191,H=Ft>>>13,V=_[7]|0,C=V&8191,Y=V>>>13,q=_[8]|0,oe=q&8191,ge=q>>>13,xe=_[9]|0,Re=xe&8191,De=xe>>>13;v.negative=f.negative^p.negative,v.length=19,M=Math.imul(N,ht),I=Math.imul(N,ft),I=I+Math.imul(se,ht)|0,F=Math.imul(se,ft);var it=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(it>>>26)|0,it&=67108863,M=Math.imul(X,ht),I=Math.imul(X,ft),I=I+Math.imul(Q,ht)|0,F=Math.imul(Q,ft),M=M+Math.imul(N,Jt)|0,I=I+Math.imul(N,St)|0,I=I+Math.imul(se,Jt)|0,F=F+Math.imul(se,St)|0;var Ue=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,M=Math.imul(Z,ht),I=Math.imul(Z,ft),I=I+Math.imul(te,ht)|0,F=Math.imul(te,ft),M=M+Math.imul(X,Jt)|0,I=I+Math.imul(X,St)|0,I=I+Math.imul(Q,Jt)|0,F=F+Math.imul(Q,St)|0,M=M+Math.imul(N,Xt)|0,I=I+Math.imul(N,Ot)|0,I=I+Math.imul(se,Xt)|0,F=F+Math.imul(se,Ot)|0;var gt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(gt>>>26)|0,gt&=67108863,M=Math.imul(ie,ht),I=Math.imul(ie,ft),I=I+Math.imul(fe,ht)|0,F=Math.imul(fe,ft),M=M+Math.imul(Z,Jt)|0,I=I+Math.imul(Z,St)|0,I=I+Math.imul(te,Jt)|0,F=F+Math.imul(te,St)|0,M=M+Math.imul(X,Xt)|0,I=I+Math.imul(X,Ot)|0,I=I+Math.imul(Q,Xt)|0,F=F+Math.imul(Q,Ot)|0,M=M+Math.imul(N,Tt)|0,I=I+Math.imul(N,vt)|0,I=I+Math.imul(se,Tt)|0,F=F+Math.imul(se,vt)|0;var st=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(st>>>26)|0,st&=67108863,M=Math.imul(Me,ht),I=Math.imul(Me,ft),I=I+Math.imul(Ne,ht)|0,F=Math.imul(Ne,ft),M=M+Math.imul(ie,Jt)|0,I=I+Math.imul(ie,St)|0,I=I+Math.imul(fe,Jt)|0,F=F+Math.imul(fe,St)|0,M=M+Math.imul(Z,Xt)|0,I=I+Math.imul(Z,Ot)|0,I=I+Math.imul(te,Xt)|0,F=F+Math.imul(te,Ot)|0,M=M+Math.imul(X,Tt)|0,I=I+Math.imul(X,vt)|0,I=I+Math.imul(Q,Tt)|0,F=F+Math.imul(Q,vt)|0,M=M+Math.imul(N,Lt)|0,I=I+Math.imul(N,bt)|0,I=I+Math.imul(se,Lt)|0,F=F+Math.imul(se,bt)|0;var tt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(tt>>>26)|0,tt&=67108863,M=Math.imul($e,ht),I=Math.imul($e,ft),I=I+Math.imul(Ie,ht)|0,F=Math.imul(Ie,ft),M=M+Math.imul(Me,Jt)|0,I=I+Math.imul(Me,St)|0,I=I+Math.imul(Ne,Jt)|0,F=F+Math.imul(Ne,St)|0,M=M+Math.imul(ie,Xt)|0,I=I+Math.imul(ie,Ot)|0,I=I+Math.imul(fe,Xt)|0,F=F+Math.imul(fe,Ot)|0,M=M+Math.imul(Z,Tt)|0,I=I+Math.imul(Z,vt)|0,I=I+Math.imul(te,Tt)|0,F=F+Math.imul(te,vt)|0,M=M+Math.imul(X,Lt)|0,I=I+Math.imul(X,bt)|0,I=I+Math.imul(Q,Lt)|0,F=F+Math.imul(Q,bt)|0,M=M+Math.imul(N,jt)|0,I=I+Math.imul(N,nt)|0,I=I+Math.imul(se,jt)|0,F=F+Math.imul(se,nt)|0;var At=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(At>>>26)|0,At&=67108863,M=Math.imul(Ve,ht),I=Math.imul(Ve,ft),I=I+Math.imul(ke,ht)|0,F=Math.imul(ke,ft),M=M+Math.imul($e,Jt)|0,I=I+Math.imul($e,St)|0,I=I+Math.imul(Ie,Jt)|0,F=F+Math.imul(Ie,St)|0,M=M+Math.imul(Me,Xt)|0,I=I+Math.imul(Me,Ot)|0,I=I+Math.imul(Ne,Xt)|0,F=F+Math.imul(Ne,Ot)|0,M=M+Math.imul(ie,Tt)|0,I=I+Math.imul(ie,vt)|0,I=I+Math.imul(fe,Tt)|0,F=F+Math.imul(fe,vt)|0,M=M+Math.imul(Z,Lt)|0,I=I+Math.imul(Z,bt)|0,I=I+Math.imul(te,Lt)|0,F=F+Math.imul(te,bt)|0,M=M+Math.imul(X,jt)|0,I=I+Math.imul(X,nt)|0,I=I+Math.imul(Q,jt)|0,F=F+Math.imul(Q,nt)|0,M=M+Math.imul(N,$)|0,I=I+Math.imul(N,H)|0,I=I+Math.imul(se,$)|0,F=F+Math.imul(se,H)|0;var Rt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,M=Math.imul(He,ht),I=Math.imul(He,ft),I=I+Math.imul(Ee,ht)|0,F=Math.imul(Ee,ft),M=M+Math.imul(Ve,Jt)|0,I=I+Math.imul(Ve,St)|0,I=I+Math.imul(ke,Jt)|0,F=F+Math.imul(ke,St)|0,M=M+Math.imul($e,Xt)|0,I=I+Math.imul($e,Ot)|0,I=I+Math.imul(Ie,Xt)|0,F=F+Math.imul(Ie,Ot)|0,M=M+Math.imul(Me,Tt)|0,I=I+Math.imul(Me,vt)|0,I=I+Math.imul(Ne,Tt)|0,F=F+Math.imul(Ne,vt)|0,M=M+Math.imul(ie,Lt)|0,I=I+Math.imul(ie,bt)|0,I=I+Math.imul(fe,Lt)|0,F=F+Math.imul(fe,bt)|0,M=M+Math.imul(Z,jt)|0,I=I+Math.imul(Z,nt)|0,I=I+Math.imul(te,jt)|0,F=F+Math.imul(te,nt)|0,M=M+Math.imul(X,$)|0,I=I+Math.imul(X,H)|0,I=I+Math.imul(Q,$)|0,F=F+Math.imul(Q,H)|0,M=M+Math.imul(N,C)|0,I=I+Math.imul(N,Y)|0,I=I+Math.imul(se,C)|0,F=F+Math.imul(se,Y)|0;var Mt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,M=Math.imul(ct,ht),I=Math.imul(ct,ft),I=I+Math.imul(Be,ht)|0,F=Math.imul(Be,ft),M=M+Math.imul(He,Jt)|0,I=I+Math.imul(He,St)|0,I=I+Math.imul(Ee,Jt)|0,F=F+Math.imul(Ee,St)|0,M=M+Math.imul(Ve,Xt)|0,I=I+Math.imul(Ve,Ot)|0,I=I+Math.imul(ke,Xt)|0,F=F+Math.imul(ke,Ot)|0,M=M+Math.imul($e,Tt)|0,I=I+Math.imul($e,vt)|0,I=I+Math.imul(Ie,Tt)|0,F=F+Math.imul(Ie,vt)|0,M=M+Math.imul(Me,Lt)|0,I=I+Math.imul(Me,bt)|0,I=I+Math.imul(Ne,Lt)|0,F=F+Math.imul(Ne,bt)|0,M=M+Math.imul(ie,jt)|0,I=I+Math.imul(ie,nt)|0,I=I+Math.imul(fe,jt)|0,F=F+Math.imul(fe,nt)|0,M=M+Math.imul(Z,$)|0,I=I+Math.imul(Z,H)|0,I=I+Math.imul(te,$)|0,F=F+Math.imul(te,H)|0,M=M+Math.imul(X,C)|0,I=I+Math.imul(X,Y)|0,I=I+Math.imul(Q,C)|0,F=F+Math.imul(Q,Y)|0,M=M+Math.imul(N,oe)|0,I=I+Math.imul(N,ge)|0,I=I+Math.imul(se,oe)|0,F=F+Math.imul(se,ge)|0;var Et=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Et>>>26)|0,Et&=67108863,M=Math.imul(rt,ht),I=Math.imul(rt,ft),I=I+Math.imul(Je,ht)|0,F=Math.imul(Je,ft),M=M+Math.imul(ct,Jt)|0,I=I+Math.imul(ct,St)|0,I=I+Math.imul(Be,Jt)|0,F=F+Math.imul(Be,St)|0,M=M+Math.imul(He,Xt)|0,I=I+Math.imul(He,Ot)|0,I=I+Math.imul(Ee,Xt)|0,F=F+Math.imul(Ee,Ot)|0,M=M+Math.imul(Ve,Tt)|0,I=I+Math.imul(Ve,vt)|0,I=I+Math.imul(ke,Tt)|0,F=F+Math.imul(ke,vt)|0,M=M+Math.imul($e,Lt)|0,I=I+Math.imul($e,bt)|0,I=I+Math.imul(Ie,Lt)|0,F=F+Math.imul(Ie,bt)|0,M=M+Math.imul(Me,jt)|0,I=I+Math.imul(Me,nt)|0,I=I+Math.imul(Ne,jt)|0,F=F+Math.imul(Ne,nt)|0,M=M+Math.imul(ie,$)|0,I=I+Math.imul(ie,H)|0,I=I+Math.imul(fe,$)|0,F=F+Math.imul(fe,H)|0,M=M+Math.imul(Z,C)|0,I=I+Math.imul(Z,Y)|0,I=I+Math.imul(te,C)|0,F=F+Math.imul(te,Y)|0,M=M+Math.imul(X,oe)|0,I=I+Math.imul(X,ge)|0,I=I+Math.imul(Q,oe)|0,F=F+Math.imul(Q,ge)|0,M=M+Math.imul(N,Re)|0,I=I+Math.imul(N,De)|0,I=I+Math.imul(se,Re)|0,F=F+Math.imul(se,De)|0;var dt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(dt>>>26)|0,dt&=67108863,M=Math.imul(rt,Jt),I=Math.imul(rt,St),I=I+Math.imul(Je,Jt)|0,F=Math.imul(Je,St),M=M+Math.imul(ct,Xt)|0,I=I+Math.imul(ct,Ot)|0,I=I+Math.imul(Be,Xt)|0,F=F+Math.imul(Be,Ot)|0,M=M+Math.imul(He,Tt)|0,I=I+Math.imul(He,vt)|0,I=I+Math.imul(Ee,Tt)|0,F=F+Math.imul(Ee,vt)|0,M=M+Math.imul(Ve,Lt)|0,I=I+Math.imul(Ve,bt)|0,I=I+Math.imul(ke,Lt)|0,F=F+Math.imul(ke,bt)|0,M=M+Math.imul($e,jt)|0,I=I+Math.imul($e,nt)|0,I=I+Math.imul(Ie,jt)|0,F=F+Math.imul(Ie,nt)|0,M=M+Math.imul(Me,$)|0,I=I+Math.imul(Me,H)|0,I=I+Math.imul(Ne,$)|0,F=F+Math.imul(Ne,H)|0,M=M+Math.imul(ie,C)|0,I=I+Math.imul(ie,Y)|0,I=I+Math.imul(fe,C)|0,F=F+Math.imul(fe,Y)|0,M=M+Math.imul(Z,oe)|0,I=I+Math.imul(Z,ge)|0,I=I+Math.imul(te,oe)|0,F=F+Math.imul(te,ge)|0,M=M+Math.imul(X,Re)|0,I=I+Math.imul(X,De)|0,I=I+Math.imul(Q,Re)|0,F=F+Math.imul(Q,De)|0;var _t=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(_t>>>26)|0,_t&=67108863,M=Math.imul(rt,Xt),I=Math.imul(rt,Ot),I=I+Math.imul(Je,Xt)|0,F=Math.imul(Je,Ot),M=M+Math.imul(ct,Tt)|0,I=I+Math.imul(ct,vt)|0,I=I+Math.imul(Be,Tt)|0,F=F+Math.imul(Be,vt)|0,M=M+Math.imul(He,Lt)|0,I=I+Math.imul(He,bt)|0,I=I+Math.imul(Ee,Lt)|0,F=F+Math.imul(Ee,bt)|0,M=M+Math.imul(Ve,jt)|0,I=I+Math.imul(Ve,nt)|0,I=I+Math.imul(ke,jt)|0,F=F+Math.imul(ke,nt)|0,M=M+Math.imul($e,$)|0,I=I+Math.imul($e,H)|0,I=I+Math.imul(Ie,$)|0,F=F+Math.imul(Ie,H)|0,M=M+Math.imul(Me,C)|0,I=I+Math.imul(Me,Y)|0,I=I+Math.imul(Ne,C)|0,F=F+Math.imul(Ne,Y)|0,M=M+Math.imul(ie,oe)|0,I=I+Math.imul(ie,ge)|0,I=I+Math.imul(fe,oe)|0,F=F+Math.imul(fe,ge)|0,M=M+Math.imul(Z,Re)|0,I=I+Math.imul(Z,De)|0,I=I+Math.imul(te,Re)|0,F=F+Math.imul(te,De)|0;var ot=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(ot>>>26)|0,ot&=67108863,M=Math.imul(rt,Tt),I=Math.imul(rt,vt),I=I+Math.imul(Je,Tt)|0,F=Math.imul(Je,vt),M=M+Math.imul(ct,Lt)|0,I=I+Math.imul(ct,bt)|0,I=I+Math.imul(Be,Lt)|0,F=F+Math.imul(Be,bt)|0,M=M+Math.imul(He,jt)|0,I=I+Math.imul(He,nt)|0,I=I+Math.imul(Ee,jt)|0,F=F+Math.imul(Ee,nt)|0,M=M+Math.imul(Ve,$)|0,I=I+Math.imul(Ve,H)|0,I=I+Math.imul(ke,$)|0,F=F+Math.imul(ke,H)|0,M=M+Math.imul($e,C)|0,I=I+Math.imul($e,Y)|0,I=I+Math.imul(Ie,C)|0,F=F+Math.imul(Ie,Y)|0,M=M+Math.imul(Me,oe)|0,I=I+Math.imul(Me,ge)|0,I=I+Math.imul(Ne,oe)|0,F=F+Math.imul(Ne,ge)|0,M=M+Math.imul(ie,Re)|0,I=I+Math.imul(ie,De)|0,I=I+Math.imul(fe,Re)|0,F=F+Math.imul(fe,De)|0;var wt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(wt>>>26)|0,wt&=67108863,M=Math.imul(rt,Lt),I=Math.imul(rt,bt),I=I+Math.imul(Je,Lt)|0,F=Math.imul(Je,bt),M=M+Math.imul(ct,jt)|0,I=I+Math.imul(ct,nt)|0,I=I+Math.imul(Be,jt)|0,F=F+Math.imul(Be,nt)|0,M=M+Math.imul(He,$)|0,I=I+Math.imul(He,H)|0,I=I+Math.imul(Ee,$)|0,F=F+Math.imul(Ee,H)|0,M=M+Math.imul(Ve,C)|0,I=I+Math.imul(Ve,Y)|0,I=I+Math.imul(ke,C)|0,F=F+Math.imul(ke,Y)|0,M=M+Math.imul($e,oe)|0,I=I+Math.imul($e,ge)|0,I=I+Math.imul(Ie,oe)|0,F=F+Math.imul(Ie,ge)|0,M=M+Math.imul(Me,Re)|0,I=I+Math.imul(Me,De)|0,I=I+Math.imul(Ne,Re)|0,F=F+Math.imul(Ne,De)|0;var lt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(lt>>>26)|0,lt&=67108863,M=Math.imul(rt,jt),I=Math.imul(rt,nt),I=I+Math.imul(Je,jt)|0,F=Math.imul(Je,nt),M=M+Math.imul(ct,$)|0,I=I+Math.imul(ct,H)|0,I=I+Math.imul(Be,$)|0,F=F+Math.imul(Be,H)|0,M=M+Math.imul(He,C)|0,I=I+Math.imul(He,Y)|0,I=I+Math.imul(Ee,C)|0,F=F+Math.imul(Ee,Y)|0,M=M+Math.imul(Ve,oe)|0,I=I+Math.imul(Ve,ge)|0,I=I+Math.imul(ke,oe)|0,F=F+Math.imul(ke,ge)|0,M=M+Math.imul($e,Re)|0,I=I+Math.imul($e,De)|0,I=I+Math.imul(Ie,Re)|0,F=F+Math.imul(Ie,De)|0;var at=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(at>>>26)|0,at&=67108863,M=Math.imul(rt,$),I=Math.imul(rt,H),I=I+Math.imul(Je,$)|0,F=Math.imul(Je,H),M=M+Math.imul(ct,C)|0,I=I+Math.imul(ct,Y)|0,I=I+Math.imul(Be,C)|0,F=F+Math.imul(Be,Y)|0,M=M+Math.imul(He,oe)|0,I=I+Math.imul(He,ge)|0,I=I+Math.imul(Ee,oe)|0,F=F+Math.imul(Ee,ge)|0,M=M+Math.imul(Ve,Re)|0,I=I+Math.imul(Ve,De)|0,I=I+Math.imul(ke,Re)|0,F=F+Math.imul(ke,De)|0;var Ae=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,M=Math.imul(rt,C),I=Math.imul(rt,Y),I=I+Math.imul(Je,C)|0,F=Math.imul(Je,Y),M=M+Math.imul(ct,oe)|0,I=I+Math.imul(ct,ge)|0,I=I+Math.imul(Be,oe)|0,F=F+Math.imul(Be,ge)|0,M=M+Math.imul(He,Re)|0,I=I+Math.imul(He,De)|0,I=I+Math.imul(Ee,Re)|0,F=F+Math.imul(Ee,De)|0;var Pe=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,M=Math.imul(rt,oe),I=Math.imul(rt,ge),I=I+Math.imul(Je,oe)|0,F=Math.imul(Je,ge),M=M+Math.imul(ct,Re)|0,I=I+Math.imul(ct,De)|0,I=I+Math.imul(Be,Re)|0,F=F+Math.imul(Be,De)|0;var Ge=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,M=Math.imul(rt,Re),I=Math.imul(rt,De),I=I+Math.imul(Je,Re)|0,F=Math.imul(Je,De);var je=(b+M|0)+((I&8191)<<13)|0;return b=(F+(I>>>13)|0)+(je>>>26)|0,je&=67108863,S[0]=it,S[1]=Ue,S[2]=gt,S[3]=st,S[4]=tt,S[5]=At,S[6]=Rt,S[7]=Mt,S[8]=Et,S[9]=dt,S[10]=_t,S[11]=ot,S[12]=wt,S[13]=lt,S[14]=at,S[15]=Ae,S[16]=Pe,S[17]=Ge,S[18]=je,b!==0&&(S[19]=b,v.length++),v};Math.imul||(B=k);function j(m,f,p){p.negative=f.negative^m.negative,p.length=m.length+f.length;for(var v=0,x=0,_=0;_>>26)|0,x+=S>>>26,S&=67108863}p.words[_]=b,v=S,S=x}return v!==0?p.words[_]=v:p.length--,p._strip()}function U(m,f,p){return j(m,f,p)}s.prototype.mulTo=function(f,p){var v,x=this.length+f.length;return this.length===10&&f.length===10?v=B(this,f,p):x<63?v=k(this,f,p):x<1024?v=j(this,f,p):v=U(this,f,p),v},s.prototype.mul=function(f){var p=new s(null);return p.words=new Array(this.length+f.length),this.mulTo(f,p)},s.prototype.mulf=function(f){var p=new s(null);return p.words=new Array(this.length+f.length),U(this,f,p)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var p=f<0;p&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var v=0,x=0;x>=26,v+=_/67108864|0,v+=S>>>26,this.words[x]=S&67108863}return v!==0&&(this.words[x]=v,this.length++),p?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var p=D(f);if(p.length===0)return new s(1);for(var v=this,x=0;x=0);var p=f%26,v=(f-p)/26,x=67108863>>>26-p<<26-p,_;if(p!==0){var S=0;for(_=0;_>>26-p}S&&(this.words[_]=S,this.length++)}if(v!==0){for(_=this.length-1;_>=0;_--)this.words[_+v]=this.words[_];for(_=0;_=0);var x;p?x=(p-p%26)/26:x=0;var _=f%26,S=Math.min((f-_)/26,this.length),b=67108863^67108863>>>_<<_,M=v;if(x-=S,x=Math.max(0,x),M){for(var I=0;IS)for(this.length-=S,I=0;I=0&&(F!==0||I>=x);I--){var ae=this.words[I]|0;this.words[I]=F<<26-_|ae>>>_,F=ae&b}return M&&F!==0&&(M.words[M.length++]=F),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,p,v){return n(this.negative===0),this.iushrn(f,p,v)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var p=f%26,v=(f-p)/26,x=1<=0);var p=f%26,v=(f-p)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(p!==0&&v++,this.length=Math.min(v,this.length),p!==0){var x=67108863^67108863>>>p<=67108864;p++)this.words[p]-=67108864,p===this.length-1?this.words[p+1]=1:this.words[p+1]++;return this.length=Math.max(this.length,p+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var p=0;p>26)-(M/67108864|0),this.words[_+v]=S&67108863}for(;_>26,this.words[_+v]=S&67108863;if(b===0)return this._strip();for(n(b===-1),b=0,_=0;_>26,this.words[_]=S&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,p){var v=this.length-f.length,x=this.clone(),_=f,S=_.words[_.length-1]|0,b=this._countBits(S);v=26-b,v!==0&&(_=_.ushln(v),x.iushln(v),S=_.words[_.length-1]|0);var M=x.length-_.length,I;if(p!=="mod"){I=new s(null),I.length=M+1,I.words=new Array(I.length);for(var F=0;F=0;N--){var se=(x.words[_.length+N]|0)*67108864+(x.words[_.length+N-1]|0);for(se=Math.min(se/S|0,67108863),x._ishlnsubmul(_,se,N);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(_,1,N),x.isZero()||(x.negative^=1);I&&(I.words[N]=se)}return I&&I._strip(),x._strip(),p!=="div"&&v!==0&&x.iushrn(v),{div:I||null,mod:x}},s.prototype.divmod=function(f,p,v){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,_,S;return this.negative!==0&&f.negative===0?(S=this.neg().divmod(f,p),p!=="mod"&&(x=S.div.neg()),p!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.iadd(f)),{div:x,mod:_}):this.negative===0&&f.negative!==0?(S=this.divmod(f.neg(),p),p!=="mod"&&(x=S.div.neg()),{div:x,mod:S.mod}):this.negative&f.negative?(S=this.neg().divmod(f.neg(),p),p!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.isub(f)),{div:S.div,mod:_}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?p==="div"?{div:this.divn(f.words[0]),mod:null}:p==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,p)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var p=this.divmod(f);if(p.mod.isZero())return p.div;var v=p.div.negative!==0?p.mod.isub(f):p.mod,x=f.ushrn(1),_=f.andln(1),S=v.cmp(x);return S<0||_===1&&S===0?p.div:p.div.negative!==0?p.div.isubn(1):p.div.iaddn(1)},s.prototype.modrn=function(f){var p=f<0;p&&(f=-f),n(f<=67108863);for(var v=(1<<26)%f,x=0,_=this.length-1;_>=0;_--)x=(v*x+(this.words[_]|0))%f;return p?-x:x},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var p=f<0;p&&(f=-f),n(f<=67108863);for(var v=0,x=this.length-1;x>=0;x--){var _=(this.words[x]|0)+v*67108864;this.words[x]=_/f|0,v=_%f}return this._strip(),p?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var p=this,v=f.clone();p.negative!==0?p=p.umod(f):p=p.clone();for(var x=new s(1),_=new s(0),S=new s(0),b=new s(1),M=0;p.isEven()&&v.isEven();)p.iushrn(1),v.iushrn(1),++M;for(var I=v.clone(),F=p.clone();!p.isZero();){for(var ae=0,N=1;!(p.words[0]&N)&&ae<26;++ae,N<<=1);if(ae>0)for(p.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(I),_.isub(F)),x.iushrn(1),_.iushrn(1);for(var se=0,ee=1;!(v.words[0]&ee)&&se<26;++se,ee<<=1);if(se>0)for(v.iushrn(se);se-- >0;)(S.isOdd()||b.isOdd())&&(S.iadd(I),b.isub(F)),S.iushrn(1),b.iushrn(1);p.cmp(v)>=0?(p.isub(v),x.isub(S),_.isub(b)):(v.isub(p),S.isub(x),b.isub(_))}return{a:S,b,gcd:v.iushln(M)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var p=this,v=f.clone();p.negative!==0?p=p.umod(f):p=p.clone();for(var x=new s(1),_=new s(0),S=v.clone();p.cmpn(1)>0&&v.cmpn(1)>0;){for(var b=0,M=1;!(p.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(p.iushrn(b);b-- >0;)x.isOdd()&&x.iadd(S),x.iushrn(1);for(var I=0,F=1;!(v.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(v.iushrn(I);I-- >0;)_.isOdd()&&_.iadd(S),_.iushrn(1);p.cmp(v)>=0?(p.isub(v),x.isub(_)):(v.isub(p),_.isub(x))}var ae;return p.cmpn(1)===0?ae=x:ae=_,ae.cmpn(0)<0&&ae.iadd(f),ae},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var p=this.clone(),v=f.clone();p.negative=0,v.negative=0;for(var x=0;p.isEven()&&v.isEven();x++)p.iushrn(1),v.iushrn(1);do{for(;p.isEven();)p.iushrn(1);for(;v.isEven();)v.iushrn(1);var _=p.cmp(v);if(_<0){var S=p;p=v,v=S}else if(_===0||v.cmpn(1)===0)break;p.isub(v)}while(!0);return v.iushln(x)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var p=f%26,v=(f-p)/26,x=1<>>26,b&=67108863,this.words[S]=b}return _!==0&&(this.words[S]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var p=f<0;if(this.negative!==0&&!p)return-1;if(this.negative===0&&p)return 1;this._strip();var v;if(this.length>1)v=1;else{p&&(f=-f),n(f<=67108863,"Number is too big");var x=this.words[0]|0;v=x===f?0:xf.length)return 1;if(this.length=0;v--){var x=this.words[v]|0,_=f.words[v]|0;if(x!==_){x<_?p=-1:x>_&&(p=1);break}}return p},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new G(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var K={k256:null,p224:null,p192:null,p25519:null};function J(m,f){this.name=m,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}J.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},J.prototype.ireduce=function(f){var p=f,v;do this.split(p,this.tmp),p=this.imulK(p),p=p.iadd(this.tmp),v=p.bitLength();while(v>this.n);var x=v0?p.isub(this.p):p.strip!==void 0?p.strip():p._strip(),p},J.prototype.split=function(f,p){f.iushrn(this.n,0,p)},J.prototype.imulK=function(f){return f.imul(this.k)};function T(){J.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(T,J),T.prototype.split=function(f,p){for(var v=4194303,x=Math.min(f.length,9),_=0;_>>22,S=b}S>>>=22,f.words[_-10]=S,S===0&&f.length>10?f.length-=10:f.length-=9},T.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var p=0,v=0;v>>=26,f.words[v]=_,p=x}return p!==0&&(f.words[f.length++]=p),f},s._prime=function(f){if(K[f])return K[f];var p;if(f==="k256")p=new T;else if(f==="p224")p=new z;else if(f==="p192")p=new ue;else if(f==="p25519")p=new _e;else throw new Error("Unknown prime "+f);return K[f]=p,p};function G(m){if(typeof m=="string"){var f=s._prime(m);this.m=f.p,this.prime=f}else n(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}G.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},G.prototype._verify2=function(f,p){n((f.negative|p.negative)===0,"red works only with positives"),n(f.red&&f.red===p.red,"red works only with red numbers")},G.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(d(f,f.umod(this.m)._forceRed(this)),f)},G.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},G.prototype.add=function(f,p){this._verify2(f,p);var v=f.add(p);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},G.prototype.iadd=function(f,p){this._verify2(f,p);var v=f.iadd(p);return v.cmp(this.m)>=0&&v.isub(this.m),v},G.prototype.sub=function(f,p){this._verify2(f,p);var v=f.sub(p);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},G.prototype.isub=function(f,p){this._verify2(f,p);var v=f.isub(p);return v.cmpn(0)<0&&v.iadd(this.m),v},G.prototype.shl=function(f,p){return this._verify1(f),this.imod(f.ushln(p))},G.prototype.imul=function(f,p){return this._verify2(f,p),this.imod(f.imul(p))},G.prototype.mul=function(f,p){return this._verify2(f,p),this.imod(f.mul(p))},G.prototype.isqr=function(f){return this.imul(f,f.clone())},G.prototype.sqr=function(f){return this.mul(f,f)},G.prototype.sqrt=function(f){if(f.isZero())return f.clone();var p=this.m.andln(3);if(n(p%2===1),p===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(f,v)}for(var x=this.m.subn(1),_=0;!x.isZero()&&x.andln(1)===0;)_++,x.iushrn(1);n(!x.isZero());var S=new s(1).toRed(this),b=S.redNeg(),M=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,M).cmp(b)!==0;)I.redIAdd(b);for(var F=this.pow(I,x),ae=this.pow(f,x.addn(1).iushrn(1)),N=this.pow(f,x),se=_;N.cmp(S)!==0;){for(var ee=N,X=0;ee.cmp(S)!==0;X++)ee=ee.redSqr();n(X=0;_--){for(var F=p.words[_],ae=I-1;ae>=0;ae--){var N=F>>ae&1;if(S!==x[0]&&(S=this.sqr(S)),N===0&&b===0){M=0;continue}b<<=1,b|=N,M++,!(M!==v&&(_!==0||ae!==0))&&(S=this.mul(S,x[b]),M=0,b=0)}I=26}return S},G.prototype.convertTo=function(f){var p=f.umod(this.m);return p===f?p.clone():p},G.prototype.convertFrom=function(f){var p=f.clone();return p.red=null,p},s.mont=function(f){return new E(f)};function E(m){G.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(E,G),E.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},E.prototype.convertFrom=function(f){var p=this.imod(f.mul(this.rinv));return p.red=null,p},E.prototype.imul=function(f,p){if(f.isZero()||p.isZero())return f.words[0]=0,f.length=1,f;var v=f.imul(p),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.mul=function(f,p){if(f.isZero()||p.isZero())return new s(0)._forceRed(this);var v=f.mul(p),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.invm=function(f){var p=this.imod(f._invmp(this.m).mul(this.r2));return p._forceRed(this)}})(t,nn)}(Sm);var xN=Sm.exports;const rr=Ui(xN);var _N=rr.BN;function EN(t){return new _N(t,36).toString(16)}const SN="strings/5.7.0",AN=new Kr(SN);var bd;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(bd||(bd={}));var qx;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(qx||(qx={}));function Am(t,e=bd.current){e!=bd.current&&(AN.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return bn(r)}const PN=`Ethereum Signed Message: +`;function zx(t){return typeof t=="string"&&(t=Am(t)),Em(bN([Am(PN),Am(String(t.length)),t]))}const MN="address/5.7.0",sl=new Kr(MN);function Hx(t){Ns(t,20)||sl.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=bn(Em(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const IN=9007199254740991;function CN(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const Pm={};for(let t=0;t<10;t++)Pm[String(t)]=String(t);for(let t=0;t<26;t++)Pm[String.fromCharCode(65+t)]=String(10+t);const Wx=Math.floor(CN(IN));function TN(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Pm[n]).join("");for(;e.length>=Wx;){let n=e.substring(0,Wx);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function RN(t){let e=null;if(typeof t!="string"&&sl.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=Hx(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&sl.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==TN(t)&&sl.throwArgumentError("bad icap checksum","address",t),e=EN(t.substring(4));e.length<40;)e="0"+e;e=Hx("0x"+e)}else sl.throwArgumentError("invalid address","address",t);return e}function ol(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var al={},yr={},Ja=Kx;function Kx(t,e){if(!t)throw new Error(e||"Assertion failed")}Kx.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var Mm={exports:{}};typeof Object.create=="function"?Mm.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Mm.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var yd=Mm.exports,DN=Ja,ON=yd;yr.inherits=ON;function NN(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function LN(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):NN(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}yr.htonl=Vx;function BN(t,e){for(var r="",n=0;n>>0}return s}yr.join32=$N;function FN(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}yr.split32=FN;function jN(t,e){return t>>>e|t<<32-e}yr.rotr32=jN;function UN(t,e){return t<>>32-e}yr.rotl32=UN;function qN(t,e){return t+e>>>0}yr.sum32=qN;function zN(t,e,r){return t+e+r>>>0}yr.sum32_3=zN;function HN(t,e,r,n){return t+e+r+n>>>0}yr.sum32_4=HN;function WN(t,e,r,n,i){return t+e+r+n+i>>>0}yr.sum32_5=WN;function KN(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}yr.sum64=KN;function VN(t,e,r,n){var i=e+n>>>0,s=(i>>0}yr.sum64_hi=VN;function GN(t,e,r,n){var i=e+n;return i>>>0}yr.sum64_lo=GN;function YN(t,e,r,n,i,s,o,a){var u=0,l=e;l=l+n>>>0,u+=l>>0,u+=l>>0,u+=l>>0}yr.sum64_4_hi=YN;function JN(t,e,r,n,i,s,o,a){var u=e+n+s+a;return u>>>0}yr.sum64_4_lo=JN;function XN(t,e,r,n,i,s,o,a,u,l){var d=0,g=e;g=g+n>>>0,d+=g>>0,d+=g>>0,d+=g>>0,d+=g>>0}yr.sum64_5_hi=XN;function ZN(t,e,r,n,i,s,o,a,u,l){var d=e+n+s+a+l;return d>>>0}yr.sum64_5_lo=ZN;function QN(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}yr.rotr64_hi=QN;function eL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.rotr64_lo=eL;function tL(t,e,r){return t>>>r}yr.shr64_hi=tL;function rL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.shr64_lo=rL;var lu={},Jx=yr,nL=Ja;function wd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}lu.BlockHash=wd,wd.prototype.update=function(e,r){if(e=Jx.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Jx.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}Ls.g0_256=cL;function uL(t){return ks(t,17)^ks(t,19)^t>>>10}Ls.g1_256=uL;var du=yr,fL=lu,lL=Ls,Im=du.rotl32,cl=du.sum32,hL=du.sum32_5,dL=lL.ft_1,e3=fL.BlockHash,pL=[1518500249,1859775393,2400959708,3395469782];function Bs(){if(!(this instanceof Bs))return new Bs;e3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}du.inherits(Bs,e3);var gL=Bs;Bs.blockSize=512,Bs.outSize=160,Bs.hmacStrength=80,Bs.padLength=64,Bs.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),rk(e.length<=this.blockSize);for(var r=e.length;r>8,y=d&255;g?u.push(g,y):u.push(y)}return u}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",u=0;u(y>>1)-1?O=(y>>1)-D:O=D,A.isubn(O)):O=0,g[P]=O,A.iushrn(1)}return g}r.getNAF=n;function i(u,l){var d=[[],[]];u=u.clone(),l=l.clone();for(var g=0,y=0,A;u.cmpn(-g)>0||l.cmpn(-y)>0;){var P=u.andln(3)+g&3,O=l.andln(3)+y&3;P===3&&(P=-1),O===3&&(O=-1);var D;P&1?(A=u.andln(7)+g&7,(A===3||A===5)&&O===2?D=-P:D=P):D=0,d[0].push(D);var k;O&1?(A=l.andln(7)+y&7,(A===3||A===5)&&P===2?k=-O:k=O):k=0,d[1].push(k),2*g===D+1&&(g=1-g),2*y===k+1&&(y=1-y),u.iushrn(1),l.iushrn(1)}return d}r.getJSF=i;function s(u,l,d){var g="_"+l;u.prototype[l]=function(){return this[g]!==void 0?this[g]:this[g]=d.call(this)}}r.cachedProperty=s;function o(u){return typeof u=="string"?r.toArray(u,"hex"):u}r.parseBytes=o;function a(u){return new rr(u,"hex","le")}r.intFromLE=a}),_d=Ci.getNAF,sk=Ci.getJSF,Ed=Ci.assert;function sa(t,e){this.type=t,this.p=new rr(e.p,16),this.red=e.prime?rr.red(e.prime):rr.mont(this.p),this.zero=new rr(0).toRed(this.red),this.one=new rr(1).toRed(this.red),this.two=new rr(2).toRed(this.red),this.n=e.n&&new rr(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Za=sa;sa.prototype.point=function(){throw new Error("Not implemented")},sa.prototype.validate=function(){throw new Error("Not implemented")},sa.prototype._fixedNafMul=function(e,r){Ed(e.precomputed);var n=e._getDoubles(),i=_d(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),g=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Ed(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},sa.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,g,y;for(d=0;d=1;d-=2){var P=d-1,O=d;if(o[P]!==1||o[O]!==1){u[P]=_d(n[P],o[P],this._bitLength),u[O]=_d(n[O],o[O],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[O].length,l);continue}var D=[r[P],null,null,r[O]];r[P].y.cmp(r[O].y)===0?(D[1]=r[P].add(r[O]),D[2]=r[P].toJ().mixedAdd(r[O].neg())):r[P].y.cmp(r[O].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[O]),D[2]=r[P].add(r[O].neg())):(D[1]=r[P].toJ().mixedAdd(r[O]),D[2]=r[P].toJ().mixedAdd(r[O].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=sk(n[P],n[O]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[O]=new Array(l),g=0;g=0;d--){for(var T=0;d>=0;){var z=!0;for(g=0;g=0&&T++,K=K.dblp(T),d<0)break;for(g=0;g0?y=a[g][ue-1>>1]:ue<0&&(y=a[g][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Hi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),g.negative&&(g=g.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:g,b:y},{a:A,b:P}]},Wi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),g=e.sub(a).sub(u),y=l.add(d).neg();return{k1:g,k2:y}},Wi.prototype.pointFromX=function(e,r){e=new rr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Wi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Wi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Dn.prototype.isInfinity=function(){return this.inf},Dn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Dn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Dn.prototype.getX=function(){return this.x.fromRed()},Dn.prototype.getY=function(){return this.y.fromRed()},Dn.prototype.mul=function(e){return e=new rr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Dn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Dn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Dn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Dn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Dn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Un(t,e,r,n){Za.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new rr(0)):(this.x=new rr(e,16),this.y=new rr(r,16),this.z=new rr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Nm(Un,Za.BasePoint),Wi.prototype.jpoint=function(e,r,n){return new Un(this,e,r,n)},Un.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},Un.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Un.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),g=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(g).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(g)),O=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,O)},Un.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),g=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(g).redISub(g),A=u.redMul(g.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},Un.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},Un.prototype.inspect=function(){return this.isInfinity()?"":""},Un.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Sd=vu(function(t,e){var r=e;r.base=Za,r.short=ak,r.mont=null,r.edwards=null}),Ad=vu(function(t,e){var r=e,n=Ci.assert;function i(a){a.type==="short"?this.curve=new Sd.short(a):a.type==="edwards"?this.curve=new Sd.edwards(a):this.curve=new Sd.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,u){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(u);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:_o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:_o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:_o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:_o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:_o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:_o.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:_o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:_o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function oa(t){if(!(this instanceof oa))return new oa(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=vs.toArray(t.entropy,t.entropyEnc||"hex"),r=vs.toArray(t.nonce,t.nonceEnc||"hex"),n=vs.toArray(t.pers,t.persEnc||"hex");Om(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var g3=oa;oa.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},oa.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=vs.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var ck=Ci.assert;function Pd(t,e){if(t instanceof Pd)return t;this._importDER(t,e)||(ck(t.r&&t.s,"Signature without r or s"),this.r=new rr(t.r,16),this.s=new rr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Md=Pd;function uk(){this.place=0}function Bm(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function m3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Pd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=m3(r),n=m3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];$m(i,r.length),i=i.concat(r),i.push(2),$m(i,n.length);var s=i.concat(n),o=[48];return $m(o,s.length),o=o.concat(s),Ci.encode(o,e)};var fk=function(){throw new Error("unsupported")},v3=Ci.assert;function Ki(t){if(!(this instanceof Ki))return new Ki(t);typeof t=="string"&&(v3(Object.prototype.hasOwnProperty.call(Ad,t),"Unknown curve "+t),t=Ad[t]),t instanceof Ad.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var lk=Ki;Ki.prototype.keyPair=function(e){return new km(this,e)},Ki.prototype.keyFromPrivate=function(e,r){return km.fromPrivate(this,e,r)},Ki.prototype.keyFromPublic=function(e,r){return km.fromPublic(this,e,r)},Ki.prototype.genKeyPair=function(e){e||(e={});for(var r=new g3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||fk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new rr(2));;){var s=new rr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Ki.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Ki.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new rr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new g3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new rr(1)),d=0;;d++){var g=i.k?i.k(d):new rr(u.generate(this.n.byteLength()));if(g=this._truncateToN(g,!0),!(g.cmpn(1)<=0||g.cmp(l)>=0)){var y=this.g.mul(g);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var O=g.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(O=O.umod(this.n),O.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&O.cmp(this.nh)>0&&(O=this.n.sub(O),D^=1),new Md({r:P,s:O,recoveryParam:D})}}}}}},Ki.prototype.verify=function(e,r,n,i){e=this._truncateToN(new rr(e,16)),n=this.keyFromPublic(n,i),r=new Md(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),u=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.eqXToP(s)):(d=this.g.mulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.getX().umod(this.n).cmp(s)===0)},Ki.prototype.recoverPubKey=function(t,e,r,n){v3((3&r)===r,"The recovery param is more than two bits"),e=new Md(e,n);var i=this.n,s=new rr(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),g=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(g,o,y)},Ki.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Md(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var hk=vu(function(t,e){var r=e;r.version="6.5.4",r.utils=Ci,r.rand=function(){throw new Error("unsupported")},r.curve=Sd,r.curves=Ad,r.ec=lk,r.eddsa=null}),dk=hk.ec;const pk="signing-key/5.7.0",Fm=new Kr(pk);let jm=null;function aa(){return jm||(jm=new dk("secp256k1")),jm}class gk{constructor(e){ol(this,"curve","secp256k1"),ol(this,"privateKey",Ii(e)),wN(this.privateKey)!==32&&Fm.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=aa().keyFromPrivate(bn(this.privateKey));ol(this,"publicKey","0x"+r.getPublic(!1,"hex")),ol(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ol(this,"_isSigningKey",!0)}_addPoint(e){const r=aa().keyFromPublic(bn(this.publicKey)),n=aa().keyFromPublic(bn(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=aa().keyFromPrivate(bn(this.privateKey)),n=bn(e);n.length!==32&&Fm.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Ux({recoveryParam:i.recoveryParam,r:fu("0x"+i.r.toString(16),32),s:fu("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=aa().keyFromPrivate(bn(this.privateKey)),n=aa().keyFromPublic(bn(b3(e)));return fu("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function mk(t,e){const r=Ux(e),n={r:bn(r.r),s:bn(r.s)};return"0x"+aa().recoverPubKey(bn(t),n,r.recoveryParam).encode("hex",!1)}function b3(t,e){const r=bn(t);return r.length===32?new gk(r).publicKey:r.length===33?"0x"+aa().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?Ii(r):Fm.throwArgumentError("invalid public or private key","key","[REDACTED]")}var y3;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(y3||(y3={}));function vk(t){const e=b3(t);return RN(jx(Em(jx(e,1)),12))}function bk(t,e){return vk(mk(bn(t),e))}var Um={},Id={};Object.defineProperty(Id,"__esModule",{value:!0});var Yn=or,qm=Mi,yk=20;function wk(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],g=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],P=r[31]<<24|r[30]<<16|r[29]<<8|r[28],O=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],k=e[11]<<24|e[10]<<16|e[9]<<8|e[8],B=e[15]<<24|e[14]<<16|e[13]<<8|e[12],j=n,U=i,K=s,J=o,T=a,z=u,ue=l,_e=d,G=g,E=y,m=A,f=P,p=O,v=D,x=k,_=B,S=0;S>>16|p<<16,G=G+p|0,T^=G,T=T>>>20|T<<12,U=U+z|0,v^=U,v=v>>>16|v<<16,E=E+v|0,z^=E,z=z>>>20|z<<12,K=K+ue|0,x^=K,x=x>>>16|x<<16,m=m+x|0,ue^=m,ue=ue>>>20|ue<<12,J=J+_e|0,_^=J,_=_>>>16|_<<16,f=f+_|0,_e^=f,_e=_e>>>20|_e<<12,K=K+ue|0,x^=K,x=x>>>24|x<<8,m=m+x|0,ue^=m,ue=ue>>>25|ue<<7,J=J+_e|0,_^=J,_=_>>>24|_<<8,f=f+_|0,_e^=f,_e=_e>>>25|_e<<7,U=U+z|0,v^=U,v=v>>>24|v<<8,E=E+v|0,z^=E,z=z>>>25|z<<7,j=j+T|0,p^=j,p=p>>>24|p<<8,G=G+p|0,T^=G,T=T>>>25|T<<7,j=j+z|0,_^=j,_=_>>>16|_<<16,m=m+_|0,z^=m,z=z>>>20|z<<12,U=U+ue|0,p^=U,p=p>>>16|p<<16,f=f+p|0,ue^=f,ue=ue>>>20|ue<<12,K=K+_e|0,v^=K,v=v>>>16|v<<16,G=G+v|0,_e^=G,_e=_e>>>20|_e<<12,J=J+T|0,x^=J,x=x>>>16|x<<16,E=E+x|0,T^=E,T=T>>>20|T<<12,K=K+_e|0,v^=K,v=v>>>24|v<<8,G=G+v|0,_e^=G,_e=_e>>>25|_e<<7,J=J+T|0,x^=J,x=x>>>24|x<<8,E=E+x|0,T^=E,T=T>>>25|T<<7,U=U+ue|0,p^=U,p=p>>>24|p<<8,f=f+p|0,ue^=f,ue=ue>>>25|ue<<7,j=j+z|0,_^=j,_=_>>>24|_<<8,m=m+_|0,z^=m,z=z>>>25|z<<7;Yn.writeUint32LE(j+n|0,t,0),Yn.writeUint32LE(U+i|0,t,4),Yn.writeUint32LE(K+s|0,t,8),Yn.writeUint32LE(J+o|0,t,12),Yn.writeUint32LE(T+a|0,t,16),Yn.writeUint32LE(z+u|0,t,20),Yn.writeUint32LE(ue+l|0,t,24),Yn.writeUint32LE(_e+d|0,t,28),Yn.writeUint32LE(G+g|0,t,32),Yn.writeUint32LE(E+y|0,t,36),Yn.writeUint32LE(m+A|0,t,40),Yn.writeUint32LE(f+P|0,t,44),Yn.writeUint32LE(p+O|0,t,48),Yn.writeUint32LE(v+D|0,t,52),Yn.writeUint32LE(x+k|0,t,56),Yn.writeUint32LE(_+B|0,t,60)}function w3(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var x3={},ca={};Object.defineProperty(ca,"__esModule",{value:!0});function Ek(t,e,r){return~(t-1)&e|t-1&r}ca.select=Ek;function Sk(t,e){return(t|0)-(e|0)-1>>>31&1}ca.lessOrEqual=Sk;function _3(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}ca.compare=_3;function Ak(t,e){return t.length===0||e.length===0?!1:_3(t,e)!==0}ca.equal=Ak,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ca,r=Mi;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var u=a[0]|a[1]<<8;this._r[0]=u&8191;var l=a[2]|a[3]<<8;this._r[1]=(u>>>13|l<<3)&8191;var d=a[4]|a[5]<<8;this._r[2]=(l>>>10|d<<6)&7939;var g=a[6]|a[7]<<8;this._r[3]=(d>>>7|g<<9)&8191;var y=a[8]|a[9]<<8;this._r[4]=(g>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var A=a[10]|a[11]<<8;this._r[6]=(y>>>14|A<<2)&8191;var P=a[12]|a[13]<<8;this._r[7]=(A>>>11|P<<5)&8065;var O=a[14]|a[15]<<8;this._r[8]=(P>>>8|O<<8)&8191,this._r[9]=O>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,u,l){for(var d=this._fin?0:2048,g=this._h[0],y=this._h[1],A=this._h[2],P=this._h[3],O=this._h[4],D=this._h[5],k=this._h[6],B=this._h[7],j=this._h[8],U=this._h[9],K=this._r[0],J=this._r[1],T=this._r[2],z=this._r[3],ue=this._r[4],_e=this._r[5],G=this._r[6],E=this._r[7],m=this._r[8],f=this._r[9];l>=16;){var p=a[u+0]|a[u+1]<<8;g+=p&8191;var v=a[u+2]|a[u+3]<<8;y+=(p>>>13|v<<3)&8191;var x=a[u+4]|a[u+5]<<8;A+=(v>>>10|x<<6)&8191;var _=a[u+6]|a[u+7]<<8;P+=(x>>>7|_<<9)&8191;var S=a[u+8]|a[u+9]<<8;O+=(_>>>4|S<<12)&8191,D+=S>>>1&8191;var b=a[u+10]|a[u+11]<<8;k+=(S>>>14|b<<2)&8191;var M=a[u+12]|a[u+13]<<8;B+=(b>>>11|M<<5)&8191;var I=a[u+14]|a[u+15]<<8;j+=(M>>>8|I<<8)&8191,U+=I>>>5|d;var F=0,ae=F;ae+=g*K,ae+=y*(5*f),ae+=A*(5*m),ae+=P*(5*E),ae+=O*(5*G),F=ae>>>13,ae&=8191,ae+=D*(5*_e),ae+=k*(5*ue),ae+=B*(5*z),ae+=j*(5*T),ae+=U*(5*J),F+=ae>>>13,ae&=8191;var N=F;N+=g*J,N+=y*K,N+=A*(5*f),N+=P*(5*m),N+=O*(5*E),F=N>>>13,N&=8191,N+=D*(5*G),N+=k*(5*_e),N+=B*(5*ue),N+=j*(5*z),N+=U*(5*T),F+=N>>>13,N&=8191;var se=F;se+=g*T,se+=y*J,se+=A*K,se+=P*(5*f),se+=O*(5*m),F=se>>>13,se&=8191,se+=D*(5*E),se+=k*(5*G),se+=B*(5*_e),se+=j*(5*ue),se+=U*(5*z),F+=se>>>13,se&=8191;var ee=F;ee+=g*z,ee+=y*T,ee+=A*J,ee+=P*K,ee+=O*(5*f),F=ee>>>13,ee&=8191,ee+=D*(5*m),ee+=k*(5*E),ee+=B*(5*G),ee+=j*(5*_e),ee+=U*(5*ue),F+=ee>>>13,ee&=8191;var X=F;X+=g*ue,X+=y*z,X+=A*T,X+=P*J,X+=O*K,F=X>>>13,X&=8191,X+=D*(5*f),X+=k*(5*m),X+=B*(5*E),X+=j*(5*G),X+=U*(5*_e),F+=X>>>13,X&=8191;var Q=F;Q+=g*_e,Q+=y*ue,Q+=A*z,Q+=P*T,Q+=O*J,F=Q>>>13,Q&=8191,Q+=D*K,Q+=k*(5*f),Q+=B*(5*m),Q+=j*(5*E),Q+=U*(5*G),F+=Q>>>13,Q&=8191;var R=F;R+=g*G,R+=y*_e,R+=A*ue,R+=P*z,R+=O*T,F=R>>>13,R&=8191,R+=D*J,R+=k*K,R+=B*(5*f),R+=j*(5*m),R+=U*(5*E),F+=R>>>13,R&=8191;var Z=F;Z+=g*E,Z+=y*G,Z+=A*_e,Z+=P*ue,Z+=O*z,F=Z>>>13,Z&=8191,Z+=D*T,Z+=k*J,Z+=B*K,Z+=j*(5*f),Z+=U*(5*m),F+=Z>>>13,Z&=8191;var te=F;te+=g*m,te+=y*E,te+=A*G,te+=P*_e,te+=O*ue,F=te>>>13,te&=8191,te+=D*z,te+=k*T,te+=B*J,te+=j*K,te+=U*(5*f),F+=te>>>13,te&=8191;var he=F;he+=g*f,he+=y*m,he+=A*E,he+=P*G,he+=O*_e,F=he>>>13,he&=8191,he+=D*ue,he+=k*z,he+=B*T,he+=j*J,he+=U*K,F+=he>>>13,he&=8191,F=(F<<2)+F|0,F=F+ae|0,ae=F&8191,F=F>>>13,N+=F,g=ae,y=N,A=se,P=ee,O=X,D=Q,k=R,B=Z,j=te,U=he,u+=16,l-=16}this._h[0]=g,this._h[1]=y,this._h[2]=A,this._h[3]=P,this._h[4]=O,this._h[5]=D,this._h[6]=k,this._h[7]=B,this._h[8]=j,this._h[9]=U},o.prototype.finish=function(a,u){u===void 0&&(u=0);var l=new Uint16Array(10),d,g,y,A;if(this._leftover){for(A=this._leftover,this._buffer[A++]=1;A<16;A++)this._buffer[A]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(d=this._h[1]>>>13,this._h[1]&=8191,A=2;A<10;A++)this._h[A]+=d,d=this._h[A]>>>13,this._h[A]&=8191;for(this._h[0]+=d*5,d=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=d,d=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=d,l[0]=this._h[0]+5,d=l[0]>>>13,l[0]&=8191,A=1;A<10;A++)l[A]=this._h[A]+d,d=l[A]>>>13,l[A]&=8191;for(l[9]-=8192,g=(d^1)-1,A=0;A<10;A++)l[A]&=g;for(g=~g,A=0;A<10;A++)this._h[A]=this._h[A]&g|l[A];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,y=this._h[0]+this._pad[0],this._h[0]=y&65535,A=1;A<8;A++)y=(this._h[A]+this._pad[A]|0)+(y>>>16)|0,this._h[A]=y&65535;return a[u+0]=this._h[0]>>>0,a[u+1]=this._h[0]>>>8,a[u+2]=this._h[1]>>>0,a[u+3]=this._h[1]>>>8,a[u+4]=this._h[2]>>>0,a[u+5]=this._h[2]>>>8,a[u+6]=this._h[3]>>>0,a[u+7]=this._h[3]>>>8,a[u+8]=this._h[4]>>>0,a[u+9]=this._h[4]>>>8,a[u+10]=this._h[5]>>>0,a[u+11]=this._h[5]>>>8,a[u+12]=this._h[6]>>>0,a[u+13]=this._h[6]>>>8,a[u+14]=this._h[7]>>>0,a[u+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var u=0,l=a.length,d;if(this._leftover){d=16-this._leftover,d>l&&(d=l);for(var g=0;g=16&&(d=l-l%16,this._blocks(a,u,d),u+=d,l-=d),l){for(var g=0;g16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var A=new Uint8Array(16);A.set(l,A.length-l.length);var P=new Uint8Array(32);e.stream(this._key,A,P,4);var O=d.length+this.tagLength,D;if(y){if(y.length!==O)throw new Error("ChaCha20Poly1305: incorrect destination length");D=y}else D=new Uint8Array(O);return e.streamXOR(this._key,A,d,D,4),this._authenticate(D.subarray(D.length-this.tagLength,D.length),P,D.subarray(0,D.length-this.tagLength),g),n.wipe(A),D},u.prototype.open=function(l,d,g,y){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(d.length0&&A.update(o.subarray(y.length%16))),A.update(g),g.length%16>0&&A.update(o.subarray(g.length%16));var P=new Uint8Array(8);y&&i.writeUint64LE(y.length,P),A.update(P),i.writeUint64LE(g.length,P),A.update(P);for(var O=A.digest(),D=0;Dthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._temp,this._state,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,g=l/536870912|0,y=l<<3,A=l%64<56?64:128;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._state.set(u.state),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.state),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,u,l,d,g){for(;g>=64;){for(var y=u[0],A=u[1],P=u[2],O=u[3],D=u[4],k=u[5],B=u[6],j=u[7],U=0;U<16;U++){var K=d+U*4;a[U]=e.readUint32BE(l,K)}for(var U=16;U<64;U++){var J=a[U-2],T=(J>>>17|J<<15)^(J>>>19|J<<13)^J>>>10;J=a[U-15];var z=(J>>>7|J<<25)^(J>>>18|J<<14)^J>>>3;a[U]=(T+a[U-7]|0)+(z+a[U-16]|0)}for(var U=0;U<64;U++){var T=(((D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7))+(D&k^~D&B)|0)+(j+(i[U]+a[U]|0)|0)|0,z=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&A^y&P^A&P)|0;j=B,B=k,k=D,D=O+T|0,O=P,P=A,A=y,y=T+z|0}u[0]+=y,u[1]+=A,u[2]+=P,u[3]+=O,u[4]+=D,u[5]+=k,u[6]+=B,u[7]+=j,d+=64,g-=64}return d}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ll);var Hm={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=na,r=Mi;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(U){const K=new Float64Array(16);if(U)for(let J=0;J>16&1),J[_e-1]&=65535;J[15]=T[15]-32767-(J[14]>>16&1);const ue=J[15]>>16&1;J[14]&=65535,a(T,J,1-ue)}for(let z=0;z<16;z++)U[2*z]=T[z]&255,U[2*z+1]=T[z]>>8}function l(U,K){for(let J=0;J<16;J++)U[J]=K[2*J]+(K[2*J+1]<<8);U[15]&=32767}function d(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]+J[T]}function g(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]-J[T]}function y(U,K,J){let T,z,ue=0,_e=0,G=0,E=0,m=0,f=0,p=0,v=0,x=0,_=0,S=0,b=0,M=0,I=0,F=0,ae=0,N=0,se=0,ee=0,X=0,Q=0,R=0,Z=0,te=0,he=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=J[0],Ie=J[1],Le=J[2],Ve=J[3],ke=J[4],ze=J[5],He=J[6],Ee=J[7],Qe=J[8],ct=J[9],Be=J[10],et=J[11],rt=J[12],Je=J[13],pt=J[14],ht=J[15];T=K[0],ue+=T*$e,_e+=T*Ie,G+=T*Le,E+=T*Ve,m+=T*ke,f+=T*ze,p+=T*He,v+=T*Ee,x+=T*Qe,_+=T*ct,S+=T*Be,b+=T*et,M+=T*rt,I+=T*Je,F+=T*pt,ae+=T*ht,T=K[1],_e+=T*$e,G+=T*Ie,E+=T*Le,m+=T*Ve,f+=T*ke,p+=T*ze,v+=T*He,x+=T*Ee,_+=T*Qe,S+=T*ct,b+=T*Be,M+=T*et,I+=T*rt,F+=T*Je,ae+=T*pt,N+=T*ht,T=K[2],G+=T*$e,E+=T*Ie,m+=T*Le,f+=T*Ve,p+=T*ke,v+=T*ze,x+=T*He,_+=T*Ee,S+=T*Qe,b+=T*ct,M+=T*Be,I+=T*et,F+=T*rt,ae+=T*Je,N+=T*pt,se+=T*ht,T=K[3],E+=T*$e,m+=T*Ie,f+=T*Le,p+=T*Ve,v+=T*ke,x+=T*ze,_+=T*He,S+=T*Ee,b+=T*Qe,M+=T*ct,I+=T*Be,F+=T*et,ae+=T*rt,N+=T*Je,se+=T*pt,ee+=T*ht,T=K[4],m+=T*$e,f+=T*Ie,p+=T*Le,v+=T*Ve,x+=T*ke,_+=T*ze,S+=T*He,b+=T*Ee,M+=T*Qe,I+=T*ct,F+=T*Be,ae+=T*et,N+=T*rt,se+=T*Je,ee+=T*pt,X+=T*ht,T=K[5],f+=T*$e,p+=T*Ie,v+=T*Le,x+=T*Ve,_+=T*ke,S+=T*ze,b+=T*He,M+=T*Ee,I+=T*Qe,F+=T*ct,ae+=T*Be,N+=T*et,se+=T*rt,ee+=T*Je,X+=T*pt,Q+=T*ht,T=K[6],p+=T*$e,v+=T*Ie,x+=T*Le,_+=T*Ve,S+=T*ke,b+=T*ze,M+=T*He,I+=T*Ee,F+=T*Qe,ae+=T*ct,N+=T*Be,se+=T*et,ee+=T*rt,X+=T*Je,Q+=T*pt,R+=T*ht,T=K[7],v+=T*$e,x+=T*Ie,_+=T*Le,S+=T*Ve,b+=T*ke,M+=T*ze,I+=T*He,F+=T*Ee,ae+=T*Qe,N+=T*ct,se+=T*Be,ee+=T*et,X+=T*rt,Q+=T*Je,R+=T*pt,Z+=T*ht,T=K[8],x+=T*$e,_+=T*Ie,S+=T*Le,b+=T*Ve,M+=T*ke,I+=T*ze,F+=T*He,ae+=T*Ee,N+=T*Qe,se+=T*ct,ee+=T*Be,X+=T*et,Q+=T*rt,R+=T*Je,Z+=T*pt,te+=T*ht,T=K[9],_+=T*$e,S+=T*Ie,b+=T*Le,M+=T*Ve,I+=T*ke,F+=T*ze,ae+=T*He,N+=T*Ee,se+=T*Qe,ee+=T*ct,X+=T*Be,Q+=T*et,R+=T*rt,Z+=T*Je,te+=T*pt,he+=T*ht,T=K[10],S+=T*$e,b+=T*Ie,M+=T*Le,I+=T*Ve,F+=T*ke,ae+=T*ze,N+=T*He,se+=T*Ee,ee+=T*Qe,X+=T*ct,Q+=T*Be,R+=T*et,Z+=T*rt,te+=T*Je,he+=T*pt,ie+=T*ht,T=K[11],b+=T*$e,M+=T*Ie,I+=T*Le,F+=T*Ve,ae+=T*ke,N+=T*ze,se+=T*He,ee+=T*Ee,X+=T*Qe,Q+=T*ct,R+=T*Be,Z+=T*et,te+=T*rt,he+=T*Je,ie+=T*pt,fe+=T*ht,T=K[12],M+=T*$e,I+=T*Ie,F+=T*Le,ae+=T*Ve,N+=T*ke,se+=T*ze,ee+=T*He,X+=T*Ee,Q+=T*Qe,R+=T*ct,Z+=T*Be,te+=T*et,he+=T*rt,ie+=T*Je,fe+=T*pt,ve+=T*ht,T=K[13],I+=T*$e,F+=T*Ie,ae+=T*Le,N+=T*Ve,se+=T*ke,ee+=T*ze,X+=T*He,Q+=T*Ee,R+=T*Qe,Z+=T*ct,te+=T*Be,he+=T*et,ie+=T*rt,fe+=T*Je,ve+=T*pt,Me+=T*ht,T=K[14],F+=T*$e,ae+=T*Ie,N+=T*Le,se+=T*Ve,ee+=T*ke,X+=T*ze,Q+=T*He,R+=T*Ee,Z+=T*Qe,te+=T*ct,he+=T*Be,ie+=T*et,fe+=T*rt,ve+=T*Je,Me+=T*pt,Ne+=T*ht,T=K[15],ae+=T*$e,N+=T*Ie,se+=T*Le,ee+=T*Ve,X+=T*ke,Q+=T*ze,R+=T*He,Z+=T*Ee,te+=T*Qe,he+=T*ct,ie+=T*Be,fe+=T*et,ve+=T*rt,Me+=T*Je,Ne+=T*pt,Te+=T*ht,ue+=38*N,_e+=38*se,G+=38*ee,E+=38*X,m+=38*Q,f+=38*R,p+=38*Z,v+=38*te,x+=38*he,_+=38*ie,S+=38*fe,b+=38*ve,M+=38*Me,I+=38*Ne,F+=38*Te,z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=p+z+65535,z=Math.floor(T/65536),p=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=p+z+65535,z=Math.floor(T/65536),p=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),U[0]=ue,U[1]=_e,U[2]=G,U[3]=E,U[4]=m,U[5]=f,U[6]=p,U[7]=v,U[8]=x,U[9]=_,U[10]=S,U[11]=b,U[12]=M,U[13]=I,U[14]=F,U[15]=ae}function A(U,K){y(U,K,K)}function P(U,K){const J=n();for(let T=0;T<16;T++)J[T]=K[T];for(let T=253;T>=0;T--)A(J,J),T!==2&&T!==4&&y(J,J,K);for(let T=0;T<16;T++)U[T]=J[T]}function O(U,K){const J=new Uint8Array(32),T=new Float64Array(80),z=n(),ue=n(),_e=n(),G=n(),E=n(),m=n();for(let x=0;x<31;x++)J[x]=U[x];J[31]=U[31]&127|64,J[0]&=248,l(T,K);for(let x=0;x<16;x++)ue[x]=T[x];z[0]=G[0]=1;for(let x=254;x>=0;--x){const _=J[x>>>3]>>>(x&7)&1;a(z,ue,_),a(_e,G,_),d(E,z,_e),g(z,z,_e),d(_e,ue,G),g(ue,ue,G),A(G,E),A(m,z),y(z,_e,z),y(_e,ue,E),d(E,z,_e),g(z,z,_e),A(ue,z),g(_e,G,m),y(z,_e,s),d(z,z,G),y(_e,_e,z),y(z,G,m),y(G,ue,T),A(ue,E),a(z,ue,_),a(_e,G,_)}for(let x=0;x<16;x++)T[x+16]=z[x],T[x+32]=_e[x],T[x+48]=ue[x],T[x+64]=G[x];const f=T.subarray(32),p=T.subarray(16);P(f,f),y(p,p,f);const v=new Uint8Array(32);return u(v,p),v}t.scalarMult=O;function D(U){return O(U,i)}t.scalarMultBase=D;function k(U){if(U.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const K=new Uint8Array(U);return{publicKey:D(K),secretKey:K}}t.generateKeyPairFromSeed=k;function B(U){const K=(0,e.randomBytes)(32,U),J=k(K);return(0,r.wipe)(K),J}t.generateKeyPair=B;function j(U,K,J=!1){if(U.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(K.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const T=O(U,K);if(J){let z=0;for(let ue=0;ue",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}};var Ti={},Wm={exports:{}};Wm.exports,function(t){(function(e,r){function n(G,E){if(!G)throw new Error(E||"Assertion failed")}function i(G,E){G.super_=E;var m=function(){};m.prototype=E.prototype,G.prototype=new m,G.prototype.constructor=G}function s(G,E,m){if(s.isBN(G))return G;this.negative=0,this.words=null,this.length=0,this.red=null,G!==null&&((E==="le"||E==="be")&&(m=E,E=10),this._init(G||0,E||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(E){return E instanceof s?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===s.wordSize&&Array.isArray(E.words)},s.max=function(E,m){return E.cmp(m)>0?E:m},s.min=function(E,m){return E.cmp(m)<0?E:m},s.prototype._init=function(E,m,f){if(typeof E=="number")return this._initNumber(E,m,f);if(typeof E=="object")return this._initArray(E,m,f);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),E=E.toString().replace(/\s+/g,"");var p=0;E[0]==="-"&&(p++,this.negative=1),p=0;p-=3)x=E[p]|E[p-1]<<8|E[p-2]<<16,this.words[v]|=x<<_&67108863,this.words[v+1]=x>>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);else if(f==="le")for(p=0,v=0;p>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);return this.strip()};function a(G,E){var m=G.charCodeAt(E);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function u(G,E,m){var f=a(G,m);return m-1>=E&&(f|=a(G,m-1)<<4),f}s.prototype._parseHex=function(E,m,f){this.length=Math.ceil((E.length-m)/6),this.words=new Array(this.length);for(var p=0;p=m;p-=2)_=u(E,m,p)<=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8;else{var S=E.length-m;for(p=S%2===0?m+1:m;p=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8}this.strip()};function l(G,E,m,f){for(var p=0,v=Math.min(G.length,m),x=E;x=49?p+=_-49+10:_>=17?p+=_-17+10:p+=_}return p}s.prototype._parseBase=function(E,m,f){this.words=[0],this.length=1;for(var p=0,v=1;v<=67108863;v*=m)p++;p--,v=v/m|0;for(var x=E.length-f,_=x%p,S=Math.min(x,x-_)+f,b=0,M=f;M1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var d=["","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"],g=[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],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(E,m){E=E||10,m=m|0||1;var f;if(E===16||E==="hex"){f="";for(var p=0,v=0,x=0;x>>24-p&16777215,p+=2,p>=26&&(p-=26,x--),v!==0||x!==this.length-1?f=d[6-S.length]+S+f:f=S+f}for(v!==0&&(f=v.toString(16)+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(E===(E|0)&&E>=2&&E<=36){var b=g[E],M=y[E];f="";var I=this.clone();for(I.negative=0;!I.isZero();){var F=I.modn(M).toString(E);I=I.idivn(M),I.isZero()?f=F+f:f=d[b-F.length]+F+f}for(this.isZero()&&(f="0"+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(E,m){return n(typeof o<"u"),this.toArrayLike(o,E,m)},s.prototype.toArray=function(E,m){return this.toArrayLike(Array,E,m)},s.prototype.toArrayLike=function(E,m,f){var p=this.byteLength(),v=f||Math.max(1,p);n(p<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var x=m==="le",_=new E(v),S,b,M=this.clone();if(x){for(b=0;!M.isZero();b++)S=M.andln(255),M.iushrn(8),_[b]=S;for(;b=4096&&(f+=13,m>>>=13),m>=64&&(f+=7,m>>>=7),m>=8&&(f+=4,m>>>=4),m>=2&&(f+=2,m>>>=2),f+m},s.prototype._zeroBits=function(E){if(E===0)return 26;var m=E,f=0;return m&8191||(f+=13,m>>>=13),m&127||(f+=7,m>>>=7),m&15||(f+=4,m>>>=4),m&3||(f+=2,m>>>=2),m&1||f++,f},s.prototype.bitLength=function(){var E=this.words[this.length-1],m=this._countBits(E);return(this.length-1)*26+m};function A(G){for(var E=new Array(G.bitLength()),m=0;m>>p}return E}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,m=0;mE.length?this.clone().ior(E):E.clone().ior(this)},s.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},s.prototype.iuand=function(E){var m;this.length>E.length?m=E:m=this;for(var f=0;fE.length?this.clone().iand(E):E.clone().iand(this)},s.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},s.prototype.iuxor=function(E){var m,f;this.length>E.length?(m=this,f=E):(m=E,f=this);for(var p=0;pE.length?this.clone().ixor(E):E.clone().ixor(this)},s.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},s.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var m=Math.ceil(E/26)|0,f=E%26;this._expand(m),f>0&&m--;for(var p=0;p0&&(this.words[p]=~this.words[p]&67108863>>26-f),this.strip()},s.prototype.notn=function(E){return this.clone().inotn(E)},s.prototype.setn=function(E,m){n(typeof E=="number"&&E>=0);var f=E/26|0,p=E%26;return this._expand(f+1),m?this.words[f]=this.words[f]|1<E.length?(f=this,p=E):(f=E,p=this);for(var v=0,x=0;x>>26;for(;v!==0&&x>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;xE.length?this.clone().iadd(E):E.clone().iadd(this)},s.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var m=this.iadd(E);return E.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var f=this.cmp(E);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,v;f>0?(p=this,v=E):(p=E,v=this);for(var x=0,_=0;_>26,this.words[_]=m&67108863;for(;x!==0&&_>26,this.words[_]=m&67108863;if(x===0&&_>>26,I=S&67108863,F=Math.min(b,E.length-1),ae=Math.max(0,b-G.length+1);ae<=F;ae++){var N=b-ae|0;p=G.words[N]|0,v=E.words[ae]|0,x=p*v+I,M+=x/67108864|0,I=x&67108863}m.words[b]=I|0,S=M|0}return S!==0?m.words[b]=S|0:m.length--,m.strip()}var O=function(E,m,f){var p=E.words,v=m.words,x=f.words,_=0,S,b,M,I=p[0]|0,F=I&8191,ae=I>>>13,N=p[1]|0,se=N&8191,ee=N>>>13,X=p[2]|0,Q=X&8191,R=X>>>13,Z=p[3]|0,te=Z&8191,he=Z>>>13,ie=p[4]|0,fe=ie&8191,ve=ie>>>13,Me=p[5]|0,Ne=Me&8191,Te=Me>>>13,$e=p[6]|0,Ie=$e&8191,Le=$e>>>13,Ve=p[7]|0,ke=Ve&8191,ze=Ve>>>13,He=p[8]|0,Ee=He&8191,Qe=He>>>13,ct=p[9]|0,Be=ct&8191,et=ct>>>13,rt=v[0]|0,Je=rt&8191,pt=rt>>>13,ht=v[1]|0,ft=ht&8191,Ht=ht>>>13,Jt=v[2]|0,St=Jt&8191,er=Jt>>>13,Xt=v[3]|0,Ot=Xt&8191,Bt=Xt>>>13,Tt=v[4]|0,vt=Tt&8191,Dt=Tt>>>13,Lt=v[5]|0,bt=Lt&8191,$t=Lt>>>13,jt=v[6]|0,nt=jt&8191,Ft=jt>>>13,$=v[7]|0,H=$&8191,V=$>>>13,C=v[8]|0,Y=C&8191,q=C>>>13,oe=v[9]|0,ge=oe&8191,xe=oe>>>13;f.negative=E.negative^m.negative,f.length=19,S=Math.imul(F,Je),b=Math.imul(F,pt),b=b+Math.imul(ae,Je)|0,M=Math.imul(ae,pt);var Re=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Re>>>26)|0,Re&=67108863,S=Math.imul(se,Je),b=Math.imul(se,pt),b=b+Math.imul(ee,Je)|0,M=Math.imul(ee,pt),S=S+Math.imul(F,ft)|0,b=b+Math.imul(F,Ht)|0,b=b+Math.imul(ae,ft)|0,M=M+Math.imul(ae,Ht)|0;var De=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(De>>>26)|0,De&=67108863,S=Math.imul(Q,Je),b=Math.imul(Q,pt),b=b+Math.imul(R,Je)|0,M=Math.imul(R,pt),S=S+Math.imul(se,ft)|0,b=b+Math.imul(se,Ht)|0,b=b+Math.imul(ee,ft)|0,M=M+Math.imul(ee,Ht)|0,S=S+Math.imul(F,St)|0,b=b+Math.imul(F,er)|0,b=b+Math.imul(ae,St)|0,M=M+Math.imul(ae,er)|0;var it=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(it>>>26)|0,it&=67108863,S=Math.imul(te,Je),b=Math.imul(te,pt),b=b+Math.imul(he,Je)|0,M=Math.imul(he,pt),S=S+Math.imul(Q,ft)|0,b=b+Math.imul(Q,Ht)|0,b=b+Math.imul(R,ft)|0,M=M+Math.imul(R,Ht)|0,S=S+Math.imul(se,St)|0,b=b+Math.imul(se,er)|0,b=b+Math.imul(ee,St)|0,M=M+Math.imul(ee,er)|0,S=S+Math.imul(F,Ot)|0,b=b+Math.imul(F,Bt)|0,b=b+Math.imul(ae,Ot)|0,M=M+Math.imul(ae,Bt)|0;var Ue=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,S=Math.imul(fe,Je),b=Math.imul(fe,pt),b=b+Math.imul(ve,Je)|0,M=Math.imul(ve,pt),S=S+Math.imul(te,ft)|0,b=b+Math.imul(te,Ht)|0,b=b+Math.imul(he,ft)|0,M=M+Math.imul(he,Ht)|0,S=S+Math.imul(Q,St)|0,b=b+Math.imul(Q,er)|0,b=b+Math.imul(R,St)|0,M=M+Math.imul(R,er)|0,S=S+Math.imul(se,Ot)|0,b=b+Math.imul(se,Bt)|0,b=b+Math.imul(ee,Ot)|0,M=M+Math.imul(ee,Bt)|0,S=S+Math.imul(F,vt)|0,b=b+Math.imul(F,Dt)|0,b=b+Math.imul(ae,vt)|0,M=M+Math.imul(ae,Dt)|0;var gt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(gt>>>26)|0,gt&=67108863,S=Math.imul(Ne,Je),b=Math.imul(Ne,pt),b=b+Math.imul(Te,Je)|0,M=Math.imul(Te,pt),S=S+Math.imul(fe,ft)|0,b=b+Math.imul(fe,Ht)|0,b=b+Math.imul(ve,ft)|0,M=M+Math.imul(ve,Ht)|0,S=S+Math.imul(te,St)|0,b=b+Math.imul(te,er)|0,b=b+Math.imul(he,St)|0,M=M+Math.imul(he,er)|0,S=S+Math.imul(Q,Ot)|0,b=b+Math.imul(Q,Bt)|0,b=b+Math.imul(R,Ot)|0,M=M+Math.imul(R,Bt)|0,S=S+Math.imul(se,vt)|0,b=b+Math.imul(se,Dt)|0,b=b+Math.imul(ee,vt)|0,M=M+Math.imul(ee,Dt)|0,S=S+Math.imul(F,bt)|0,b=b+Math.imul(F,$t)|0,b=b+Math.imul(ae,bt)|0,M=M+Math.imul(ae,$t)|0;var st=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(st>>>26)|0,st&=67108863,S=Math.imul(Ie,Je),b=Math.imul(Ie,pt),b=b+Math.imul(Le,Je)|0,M=Math.imul(Le,pt),S=S+Math.imul(Ne,ft)|0,b=b+Math.imul(Ne,Ht)|0,b=b+Math.imul(Te,ft)|0,M=M+Math.imul(Te,Ht)|0,S=S+Math.imul(fe,St)|0,b=b+Math.imul(fe,er)|0,b=b+Math.imul(ve,St)|0,M=M+Math.imul(ve,er)|0,S=S+Math.imul(te,Ot)|0,b=b+Math.imul(te,Bt)|0,b=b+Math.imul(he,Ot)|0,M=M+Math.imul(he,Bt)|0,S=S+Math.imul(Q,vt)|0,b=b+Math.imul(Q,Dt)|0,b=b+Math.imul(R,vt)|0,M=M+Math.imul(R,Dt)|0,S=S+Math.imul(se,bt)|0,b=b+Math.imul(se,$t)|0,b=b+Math.imul(ee,bt)|0,M=M+Math.imul(ee,$t)|0,S=S+Math.imul(F,nt)|0,b=b+Math.imul(F,Ft)|0,b=b+Math.imul(ae,nt)|0,M=M+Math.imul(ae,Ft)|0;var tt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(tt>>>26)|0,tt&=67108863,S=Math.imul(ke,Je),b=Math.imul(ke,pt),b=b+Math.imul(ze,Je)|0,M=Math.imul(ze,pt),S=S+Math.imul(Ie,ft)|0,b=b+Math.imul(Ie,Ht)|0,b=b+Math.imul(Le,ft)|0,M=M+Math.imul(Le,Ht)|0,S=S+Math.imul(Ne,St)|0,b=b+Math.imul(Ne,er)|0,b=b+Math.imul(Te,St)|0,M=M+Math.imul(Te,er)|0,S=S+Math.imul(fe,Ot)|0,b=b+Math.imul(fe,Bt)|0,b=b+Math.imul(ve,Ot)|0,M=M+Math.imul(ve,Bt)|0,S=S+Math.imul(te,vt)|0,b=b+Math.imul(te,Dt)|0,b=b+Math.imul(he,vt)|0,M=M+Math.imul(he,Dt)|0,S=S+Math.imul(Q,bt)|0,b=b+Math.imul(Q,$t)|0,b=b+Math.imul(R,bt)|0,M=M+Math.imul(R,$t)|0,S=S+Math.imul(se,nt)|0,b=b+Math.imul(se,Ft)|0,b=b+Math.imul(ee,nt)|0,M=M+Math.imul(ee,Ft)|0,S=S+Math.imul(F,H)|0,b=b+Math.imul(F,V)|0,b=b+Math.imul(ae,H)|0,M=M+Math.imul(ae,V)|0;var At=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(At>>>26)|0,At&=67108863,S=Math.imul(Ee,Je),b=Math.imul(Ee,pt),b=b+Math.imul(Qe,Je)|0,M=Math.imul(Qe,pt),S=S+Math.imul(ke,ft)|0,b=b+Math.imul(ke,Ht)|0,b=b+Math.imul(ze,ft)|0,M=M+Math.imul(ze,Ht)|0,S=S+Math.imul(Ie,St)|0,b=b+Math.imul(Ie,er)|0,b=b+Math.imul(Le,St)|0,M=M+Math.imul(Le,er)|0,S=S+Math.imul(Ne,Ot)|0,b=b+Math.imul(Ne,Bt)|0,b=b+Math.imul(Te,Ot)|0,M=M+Math.imul(Te,Bt)|0,S=S+Math.imul(fe,vt)|0,b=b+Math.imul(fe,Dt)|0,b=b+Math.imul(ve,vt)|0,M=M+Math.imul(ve,Dt)|0,S=S+Math.imul(te,bt)|0,b=b+Math.imul(te,$t)|0,b=b+Math.imul(he,bt)|0,M=M+Math.imul(he,$t)|0,S=S+Math.imul(Q,nt)|0,b=b+Math.imul(Q,Ft)|0,b=b+Math.imul(R,nt)|0,M=M+Math.imul(R,Ft)|0,S=S+Math.imul(se,H)|0,b=b+Math.imul(se,V)|0,b=b+Math.imul(ee,H)|0,M=M+Math.imul(ee,V)|0,S=S+Math.imul(F,Y)|0,b=b+Math.imul(F,q)|0,b=b+Math.imul(ae,Y)|0,M=M+Math.imul(ae,q)|0;var Rt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,S=Math.imul(Be,Je),b=Math.imul(Be,pt),b=b+Math.imul(et,Je)|0,M=Math.imul(et,pt),S=S+Math.imul(Ee,ft)|0,b=b+Math.imul(Ee,Ht)|0,b=b+Math.imul(Qe,ft)|0,M=M+Math.imul(Qe,Ht)|0,S=S+Math.imul(ke,St)|0,b=b+Math.imul(ke,er)|0,b=b+Math.imul(ze,St)|0,M=M+Math.imul(ze,er)|0,S=S+Math.imul(Ie,Ot)|0,b=b+Math.imul(Ie,Bt)|0,b=b+Math.imul(Le,Ot)|0,M=M+Math.imul(Le,Bt)|0,S=S+Math.imul(Ne,vt)|0,b=b+Math.imul(Ne,Dt)|0,b=b+Math.imul(Te,vt)|0,M=M+Math.imul(Te,Dt)|0,S=S+Math.imul(fe,bt)|0,b=b+Math.imul(fe,$t)|0,b=b+Math.imul(ve,bt)|0,M=M+Math.imul(ve,$t)|0,S=S+Math.imul(te,nt)|0,b=b+Math.imul(te,Ft)|0,b=b+Math.imul(he,nt)|0,M=M+Math.imul(he,Ft)|0,S=S+Math.imul(Q,H)|0,b=b+Math.imul(Q,V)|0,b=b+Math.imul(R,H)|0,M=M+Math.imul(R,V)|0,S=S+Math.imul(se,Y)|0,b=b+Math.imul(se,q)|0,b=b+Math.imul(ee,Y)|0,M=M+Math.imul(ee,q)|0,S=S+Math.imul(F,ge)|0,b=b+Math.imul(F,xe)|0,b=b+Math.imul(ae,ge)|0,M=M+Math.imul(ae,xe)|0;var Mt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,S=Math.imul(Be,ft),b=Math.imul(Be,Ht),b=b+Math.imul(et,ft)|0,M=Math.imul(et,Ht),S=S+Math.imul(Ee,St)|0,b=b+Math.imul(Ee,er)|0,b=b+Math.imul(Qe,St)|0,M=M+Math.imul(Qe,er)|0,S=S+Math.imul(ke,Ot)|0,b=b+Math.imul(ke,Bt)|0,b=b+Math.imul(ze,Ot)|0,M=M+Math.imul(ze,Bt)|0,S=S+Math.imul(Ie,vt)|0,b=b+Math.imul(Ie,Dt)|0,b=b+Math.imul(Le,vt)|0,M=M+Math.imul(Le,Dt)|0,S=S+Math.imul(Ne,bt)|0,b=b+Math.imul(Ne,$t)|0,b=b+Math.imul(Te,bt)|0,M=M+Math.imul(Te,$t)|0,S=S+Math.imul(fe,nt)|0,b=b+Math.imul(fe,Ft)|0,b=b+Math.imul(ve,nt)|0,M=M+Math.imul(ve,Ft)|0,S=S+Math.imul(te,H)|0,b=b+Math.imul(te,V)|0,b=b+Math.imul(he,H)|0,M=M+Math.imul(he,V)|0,S=S+Math.imul(Q,Y)|0,b=b+Math.imul(Q,q)|0,b=b+Math.imul(R,Y)|0,M=M+Math.imul(R,q)|0,S=S+Math.imul(se,ge)|0,b=b+Math.imul(se,xe)|0,b=b+Math.imul(ee,ge)|0,M=M+Math.imul(ee,xe)|0;var Et=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Et>>>26)|0,Et&=67108863,S=Math.imul(Be,St),b=Math.imul(Be,er),b=b+Math.imul(et,St)|0,M=Math.imul(et,er),S=S+Math.imul(Ee,Ot)|0,b=b+Math.imul(Ee,Bt)|0,b=b+Math.imul(Qe,Ot)|0,M=M+Math.imul(Qe,Bt)|0,S=S+Math.imul(ke,vt)|0,b=b+Math.imul(ke,Dt)|0,b=b+Math.imul(ze,vt)|0,M=M+Math.imul(ze,Dt)|0,S=S+Math.imul(Ie,bt)|0,b=b+Math.imul(Ie,$t)|0,b=b+Math.imul(Le,bt)|0,M=M+Math.imul(Le,$t)|0,S=S+Math.imul(Ne,nt)|0,b=b+Math.imul(Ne,Ft)|0,b=b+Math.imul(Te,nt)|0,M=M+Math.imul(Te,Ft)|0,S=S+Math.imul(fe,H)|0,b=b+Math.imul(fe,V)|0,b=b+Math.imul(ve,H)|0,M=M+Math.imul(ve,V)|0,S=S+Math.imul(te,Y)|0,b=b+Math.imul(te,q)|0,b=b+Math.imul(he,Y)|0,M=M+Math.imul(he,q)|0,S=S+Math.imul(Q,ge)|0,b=b+Math.imul(Q,xe)|0,b=b+Math.imul(R,ge)|0,M=M+Math.imul(R,xe)|0;var dt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(dt>>>26)|0,dt&=67108863,S=Math.imul(Be,Ot),b=Math.imul(Be,Bt),b=b+Math.imul(et,Ot)|0,M=Math.imul(et,Bt),S=S+Math.imul(Ee,vt)|0,b=b+Math.imul(Ee,Dt)|0,b=b+Math.imul(Qe,vt)|0,M=M+Math.imul(Qe,Dt)|0,S=S+Math.imul(ke,bt)|0,b=b+Math.imul(ke,$t)|0,b=b+Math.imul(ze,bt)|0,M=M+Math.imul(ze,$t)|0,S=S+Math.imul(Ie,nt)|0,b=b+Math.imul(Ie,Ft)|0,b=b+Math.imul(Le,nt)|0,M=M+Math.imul(Le,Ft)|0,S=S+Math.imul(Ne,H)|0,b=b+Math.imul(Ne,V)|0,b=b+Math.imul(Te,H)|0,M=M+Math.imul(Te,V)|0,S=S+Math.imul(fe,Y)|0,b=b+Math.imul(fe,q)|0,b=b+Math.imul(ve,Y)|0,M=M+Math.imul(ve,q)|0,S=S+Math.imul(te,ge)|0,b=b+Math.imul(te,xe)|0,b=b+Math.imul(he,ge)|0,M=M+Math.imul(he,xe)|0;var _t=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(_t>>>26)|0,_t&=67108863,S=Math.imul(Be,vt),b=Math.imul(Be,Dt),b=b+Math.imul(et,vt)|0,M=Math.imul(et,Dt),S=S+Math.imul(Ee,bt)|0,b=b+Math.imul(Ee,$t)|0,b=b+Math.imul(Qe,bt)|0,M=M+Math.imul(Qe,$t)|0,S=S+Math.imul(ke,nt)|0,b=b+Math.imul(ke,Ft)|0,b=b+Math.imul(ze,nt)|0,M=M+Math.imul(ze,Ft)|0,S=S+Math.imul(Ie,H)|0,b=b+Math.imul(Ie,V)|0,b=b+Math.imul(Le,H)|0,M=M+Math.imul(Le,V)|0,S=S+Math.imul(Ne,Y)|0,b=b+Math.imul(Ne,q)|0,b=b+Math.imul(Te,Y)|0,M=M+Math.imul(Te,q)|0,S=S+Math.imul(fe,ge)|0,b=b+Math.imul(fe,xe)|0,b=b+Math.imul(ve,ge)|0,M=M+Math.imul(ve,xe)|0;var ot=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(ot>>>26)|0,ot&=67108863,S=Math.imul(Be,bt),b=Math.imul(Be,$t),b=b+Math.imul(et,bt)|0,M=Math.imul(et,$t),S=S+Math.imul(Ee,nt)|0,b=b+Math.imul(Ee,Ft)|0,b=b+Math.imul(Qe,nt)|0,M=M+Math.imul(Qe,Ft)|0,S=S+Math.imul(ke,H)|0,b=b+Math.imul(ke,V)|0,b=b+Math.imul(ze,H)|0,M=M+Math.imul(ze,V)|0,S=S+Math.imul(Ie,Y)|0,b=b+Math.imul(Ie,q)|0,b=b+Math.imul(Le,Y)|0,M=M+Math.imul(Le,q)|0,S=S+Math.imul(Ne,ge)|0,b=b+Math.imul(Ne,xe)|0,b=b+Math.imul(Te,ge)|0,M=M+Math.imul(Te,xe)|0;var wt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(wt>>>26)|0,wt&=67108863,S=Math.imul(Be,nt),b=Math.imul(Be,Ft),b=b+Math.imul(et,nt)|0,M=Math.imul(et,Ft),S=S+Math.imul(Ee,H)|0,b=b+Math.imul(Ee,V)|0,b=b+Math.imul(Qe,H)|0,M=M+Math.imul(Qe,V)|0,S=S+Math.imul(ke,Y)|0,b=b+Math.imul(ke,q)|0,b=b+Math.imul(ze,Y)|0,M=M+Math.imul(ze,q)|0,S=S+Math.imul(Ie,ge)|0,b=b+Math.imul(Ie,xe)|0,b=b+Math.imul(Le,ge)|0,M=M+Math.imul(Le,xe)|0;var lt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul(Be,H),b=Math.imul(Be,V),b=b+Math.imul(et,H)|0,M=Math.imul(et,V),S=S+Math.imul(Ee,Y)|0,b=b+Math.imul(Ee,q)|0,b=b+Math.imul(Qe,Y)|0,M=M+Math.imul(Qe,q)|0,S=S+Math.imul(ke,ge)|0,b=b+Math.imul(ke,xe)|0,b=b+Math.imul(ze,ge)|0,M=M+Math.imul(ze,xe)|0;var at=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(at>>>26)|0,at&=67108863,S=Math.imul(Be,Y),b=Math.imul(Be,q),b=b+Math.imul(et,Y)|0,M=Math.imul(et,q),S=S+Math.imul(Ee,ge)|0,b=b+Math.imul(Ee,xe)|0,b=b+Math.imul(Qe,ge)|0,M=M+Math.imul(Qe,xe)|0;var Ae=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,S=Math.imul(Be,ge),b=Math.imul(Be,xe),b=b+Math.imul(et,ge)|0,M=Math.imul(et,xe);var Pe=(_+S|0)+((b&8191)<<13)|0;return _=(M+(b>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,x[0]=Re,x[1]=De,x[2]=it,x[3]=Ue,x[4]=gt,x[5]=st,x[6]=tt,x[7]=At,x[8]=Rt,x[9]=Mt,x[10]=Et,x[11]=dt,x[12]=_t,x[13]=ot,x[14]=wt,x[15]=lt,x[16]=at,x[17]=Ae,x[18]=Pe,_!==0&&(x[19]=_,f.length++),f};Math.imul||(O=P);function D(G,E,m){m.negative=E.negative^G.negative,m.length=G.length+E.length;for(var f=0,p=0,v=0;v>>26)|0,p+=x>>>26,x&=67108863}m.words[v]=_,f=x,x=p}return f!==0?m.words[v]=f:m.length--,m.strip()}function k(G,E,m){var f=new B;return f.mulp(G,E,m)}s.prototype.mulTo=function(E,m){var f,p=this.length+E.length;return this.length===10&&E.length===10?f=O(this,E,m):p<63?f=P(this,E,m):p<1024?f=D(this,E,m):f=k(this,E,m),f};function B(G,E){this.x=G,this.y=E}B.prototype.makeRBT=function(E){for(var m=new Array(E),f=s.prototype._countBits(E)-1,p=0;p>=1;return p},B.prototype.permute=function(E,m,f,p,v,x){for(var _=0;_>>1)v++;return 1<>>13,f[2*x+1]=v&8191,v=v>>>13;for(x=2*m;x>=26,m+=p/67108864|0,m+=v>>>26,this.words[f]=v&67108863}return m!==0&&(this.words[f]=m,this.length++),this},s.prototype.muln=function(E){return this.clone().imuln(E)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(E){var m=A(E);if(m.length===0)return new s(1);for(var f=this,p=0;p=0);var m=E%26,f=(E-m)/26,p=67108863>>>26-m<<26-m,v;if(m!==0){var x=0;for(v=0;v>>26-m}x&&(this.words[v]=x,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var p;m?p=(m-m%26)/26:p=0;var v=E%26,x=Math.min((E-v)/26,this.length),_=67108863^67108863>>>v<x)for(this.length-=x,b=0;b=0&&(M!==0||b>=p);b--){var I=this.words[b]|0;this.words[b]=M<<26-v|I>>>v,M=I&_}return S&&M!==0&&(S.words[S.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(E,m,f){return n(this.negative===0),this.iushrn(E,m,f)},s.prototype.shln=function(E){return this.clone().ishln(E)},s.prototype.ushln=function(E){return this.clone().iushln(E)},s.prototype.shrn=function(E){return this.clone().ishrn(E)},s.prototype.ushrn=function(E){return this.clone().iushrn(E)},s.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var m=E%26,f=(E-m)/26,p=1<=0);var m=E%26,f=(E-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(m!==0&&f++,this.length=Math.min(f,this.length),m!==0){var p=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(S/67108864|0),this.words[v+f]=x&67108863}for(;v>26,this.words[v+f]=x&67108863;if(_===0)return this.strip();for(n(_===-1),_=0,v=0;v>26,this.words[v]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(E,m){var f=this.length-E.length,p=this.clone(),v=E,x=v.words[v.length-1]|0,_=this._countBits(x);f=26-_,f!==0&&(v=v.ushln(f),p.iushln(f),x=v.words[v.length-1]|0);var S=p.length-v.length,b;if(m!=="mod"){b=new s(null),b.length=S+1,b.words=new Array(b.length);for(var M=0;M=0;F--){var ae=(p.words[v.length+F]|0)*67108864+(p.words[v.length+F-1]|0);for(ae=Math.min(ae/x|0,67108863),p._ishlnsubmul(v,ae,F);p.negative!==0;)ae--,p.negative=0,p._ishlnsubmul(v,1,F),p.isZero()||(p.negative^=1);b&&(b.words[F]=ae)}return b&&b.strip(),p.strip(),m!=="div"&&f!==0&&p.iushrn(f),{div:b||null,mod:p}},s.prototype.divmod=function(E,m,f){if(n(!E.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var p,v,x;return this.negative!==0&&E.negative===0?(x=this.neg().divmod(E,m),m!=="mod"&&(p=x.div.neg()),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.iadd(E)),{div:p,mod:v}):this.negative===0&&E.negative!==0?(x=this.divmod(E.neg(),m),m!=="mod"&&(p=x.div.neg()),{div:p,mod:x.mod}):this.negative&E.negative?(x=this.neg().divmod(E.neg(),m),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.isub(E)),{div:x.div,mod:v}):E.length>this.length||this.cmp(E)<0?{div:new s(0),mod:this}:E.length===1?m==="div"?{div:this.divn(E.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new s(this.modn(E.words[0]))}:this._wordDiv(E,m)},s.prototype.div=function(E){return this.divmod(E,"div",!1).div},s.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},s.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},s.prototype.divRound=function(E){var m=this.divmod(E);if(m.mod.isZero())return m.div;var f=m.div.negative!==0?m.mod.isub(E):m.mod,p=E.ushrn(1),v=E.andln(1),x=f.cmp(p);return x<0||v===1&&x===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(E){n(E<=67108863);for(var m=(1<<26)%E,f=0,p=this.length-1;p>=0;p--)f=(m*f+(this.words[p]|0))%E;return f},s.prototype.idivn=function(E){n(E<=67108863);for(var m=0,f=this.length-1;f>=0;f--){var p=(this.words[f]|0)+m*67108864;this.words[f]=p/E|0,m=p%E}return this.strip()},s.prototype.divn=function(E){return this.clone().idivn(E)},s.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var p=new s(1),v=new s(0),x=new s(0),_=new s(1),S=0;m.isEven()&&f.isEven();)m.iushrn(1),f.iushrn(1),++S;for(var b=f.clone(),M=m.clone();!m.isZero();){for(var I=0,F=1;!(m.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(m.iushrn(I);I-- >0;)(p.isOdd()||v.isOdd())&&(p.iadd(b),v.isub(M)),p.iushrn(1),v.iushrn(1);for(var ae=0,N=1;!(f.words[0]&N)&&ae<26;++ae,N<<=1);if(ae>0)for(f.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(b),_.isub(M)),x.iushrn(1),_.iushrn(1);m.cmp(f)>=0?(m.isub(f),p.isub(x),v.isub(_)):(f.isub(m),x.isub(p),_.isub(v))}return{a:x,b:_,gcd:f.iushln(S)}},s.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var p=new s(1),v=new s(0),x=f.clone();m.cmpn(1)>0&&f.cmpn(1)>0;){for(var _=0,S=1;!(m.words[0]&S)&&_<26;++_,S<<=1);if(_>0)for(m.iushrn(_);_-- >0;)p.isOdd()&&p.iadd(x),p.iushrn(1);for(var b=0,M=1;!(f.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(f.iushrn(b);b-- >0;)v.isOdd()&&v.iadd(x),v.iushrn(1);m.cmp(f)>=0?(m.isub(f),p.isub(v)):(f.isub(m),v.isub(p))}var I;return m.cmpn(1)===0?I=p:I=v,I.cmpn(0)<0&&I.iadd(E),I},s.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var m=this.clone(),f=E.clone();m.negative=0,f.negative=0;for(var p=0;m.isEven()&&f.isEven();p++)m.iushrn(1),f.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=m.cmp(f);if(v<0){var x=m;m=f,f=x}else if(v===0||f.cmpn(1)===0)break;m.isub(f)}while(!0);return f.iushln(p)},s.prototype.invm=function(E){return this.egcd(E).a.umod(E)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(E){return this.words[0]&E},s.prototype.bincn=function(E){n(typeof E=="number");var m=E%26,f=(E-m)/26,p=1<>>26,_&=67108863,this.words[x]=_}return v!==0&&(this.words[x]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(E){var m=E<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var f;if(this.length>1)f=1;else{m&&(E=-E),n(E<=67108863,"Number is too big");var p=this.words[0]|0;f=p===E?0:pE.length)return 1;if(this.length=0;f--){var p=this.words[f]|0,v=E.words[f]|0;if(p!==v){pv&&(m=1);break}}return m},s.prototype.gtn=function(E){return this.cmpn(E)===1},s.prototype.gt=function(E){return this.cmp(E)===1},s.prototype.gten=function(E){return this.cmpn(E)>=0},s.prototype.gte=function(E){return this.cmp(E)>=0},s.prototype.ltn=function(E){return this.cmpn(E)===-1},s.prototype.lt=function(E){return this.cmp(E)===-1},s.prototype.lten=function(E){return this.cmpn(E)<=0},s.prototype.lte=function(E){return this.cmp(E)<=0},s.prototype.eqn=function(E){return this.cmpn(E)===0},s.prototype.eq=function(E){return this.cmp(E)===0},s.red=function(E){return new ue(E)},s.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(E){return this.red=E,this},s.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},s.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},s.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},s.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},s.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},s.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},s.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},s.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var j={k256:null,p224:null,p192:null,p25519:null};function U(G,E){this.name=G,this.p=new s(E,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var E=new s(null);return E.words=new Array(Math.ceil(this.n/13)),E},U.prototype.ireduce=function(E){var m=E,f;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),f=m.bitLength();while(f>this.n);var p=f0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},U.prototype.split=function(E,m){E.iushrn(this.n,0,m)},U.prototype.imulK=function(E){return E.imul(this.k)};function K(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(K,U),K.prototype.split=function(E,m){for(var f=4194303,p=Math.min(E.length,9),v=0;v>>22,x=_}x>>>=22,E.words[v-10]=x,x===0&&E.length>10?E.length-=10:E.length-=9},K.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var m=0,f=0;f>>=26,E.words[f]=v,m=p}return m!==0&&(E.words[E.length++]=m),E},s._prime=function(E){if(j[E])return j[E];var m;if(E==="k256")m=new K;else if(E==="p224")m=new J;else if(E==="p192")m=new T;else if(E==="p25519")m=new z;else throw new Error("Unknown prime "+E);return j[E]=m,m};function ue(G){if(typeof G=="string"){var E=s._prime(G);this.m=E.p,this.prime=E}else n(G.gtn(1),"modulus must be greater than 1"),this.m=G,this.prime=null}ue.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},ue.prototype._verify2=function(E,m){n((E.negative|m.negative)===0,"red works only with positives"),n(E.red&&E.red===m.red,"red works only with red numbers")},ue.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},ue.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},ue.prototype.add=function(E,m){this._verify2(E,m);var f=E.add(m);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},ue.prototype.iadd=function(E,m){this._verify2(E,m);var f=E.iadd(m);return f.cmp(this.m)>=0&&f.isub(this.m),f},ue.prototype.sub=function(E,m){this._verify2(E,m);var f=E.sub(m);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},ue.prototype.isub=function(E,m){this._verify2(E,m);var f=E.isub(m);return f.cmpn(0)<0&&f.iadd(this.m),f},ue.prototype.shl=function(E,m){return this._verify1(E),this.imod(E.ushln(m))},ue.prototype.imul=function(E,m){return this._verify2(E,m),this.imod(E.imul(m))},ue.prototype.mul=function(E,m){return this._verify2(E,m),this.imod(E.mul(m))},ue.prototype.isqr=function(E){return this.imul(E,E.clone())},ue.prototype.sqr=function(E){return this.mul(E,E)},ue.prototype.sqrt=function(E){if(E.isZero())return E.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(E,f)}for(var p=this.m.subn(1),v=0;!p.isZero()&&p.andln(1)===0;)v++,p.iushrn(1);n(!p.isZero());var x=new s(1).toRed(this),_=x.redNeg(),S=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new s(2*b*b).toRed(this);this.pow(b,S).cmp(_)!==0;)b.redIAdd(_);for(var M=this.pow(b,p),I=this.pow(E,p.addn(1).iushrn(1)),F=this.pow(E,p),ae=v;F.cmp(x)!==0;){for(var N=F,se=0;N.cmp(x)!==0;se++)N=N.redSqr();n(se=0;v--){for(var M=m.words[v],I=b-1;I>=0;I--){var F=M>>I&1;if(x!==p[0]&&(x=this.sqr(x)),F===0&&_===0){S=0;continue}_<<=1,_|=F,S++,!(S!==f&&(v!==0||I!==0))&&(x=this.mul(x,p[_]),S=0,_=0)}b=26}return x},ue.prototype.convertTo=function(E){var m=E.umod(this.m);return m===E?m.clone():m},ue.prototype.convertFrom=function(E){var m=E.clone();return m.red=null,m},s.mont=function(E){return new _e(E)};function _e(G){ue.call(this,G),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(_e,ue),_e.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},_e.prototype.convertFrom=function(E){var m=this.imod(E.mul(this.rinv));return m.red=null,m},_e.prototype.imul=function(E,m){if(E.isZero()||m.isZero())return E.words[0]=0,E.length=1,E;var f=E.imul(m),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.mul=function(E,m){if(E.isZero()||m.isZero())return new s(0)._forceRed(this);var f=E.mul(m),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.invm=function(E){var m=this.imod(E._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,nn)}(Wm);var Eo=Wm.exports,Km={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var u=0;u>8,g=l&255;d?a.push(d,g):a.push(g)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(O>>1)-1?k=(O>>1)-B:k=B,D.isubn(k)):k=0,A[P]=k,D.iushrn(1)}return A}e.getNAF=s;function o(d,g){var y=[[],[]];d=d.clone(),g=g.clone();for(var A=0,P=0,O;d.cmpn(-A)>0||g.cmpn(-P)>0;){var D=d.andln(3)+A&3,k=g.andln(3)+P&3;D===3&&(D=-1),k===3&&(k=-1);var B;D&1?(O=d.andln(7)+A&7,(O===3||O===5)&&k===2?B=-D:B=D):B=0,y[0].push(B);var j;k&1?(O=g.andln(7)+P&7,(O===3||O===5)&&D===2?j=-k:j=k):j=0,y[1].push(j),2*A===B+1&&(A=1-A),2*P===j+1&&(P=1-P),d.iushrn(1),g.iushrn(1)}return y}e.getJSF=o;function a(d,g,y){var A="_"+g;d.prototype[g]=function(){return this[A]!==void 0?this[A]:this[A]=y.call(this)}}e.cachedProperty=a;function u(d){return typeof d=="string"?e.toArray(d,"hex"):d}e.parseBytes=u;function l(d){return new r(d,"hex","le")}e.intFromLE=l}(Ti);var Vm={exports:{}},Gm;Vm.exports=function(e){return Gm||(Gm=new ua(null)),Gm.generate(e)};function ua(t){this.rand=t}if(Vm.exports.Rand=ua,ua.prototype.generate=function(e){return this._rand(e)},ua.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Rd=fa;fa.prototype.point=function(){throw new Error("Not implemented")},fa.prototype.validate=function(){throw new Error("Not implemented")},fa.prototype._fixedNafMul=function(e,r){Td(e.precomputed);var n=e._getDoubles(),i=Cd(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),g=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Td(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},fa.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,g,y;for(d=0;d=1;d-=2){var P=d-1,O=d;if(o[P]!==1||o[O]!==1){u[P]=Cd(n[P],o[P],this._bitLength),u[O]=Cd(n[O],o[O],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[O].length,l);continue}var D=[r[P],null,null,r[O]];r[P].y.cmp(r[O].y)===0?(D[1]=r[P].add(r[O]),D[2]=r[P].toJ().mixedAdd(r[O].neg())):r[P].y.cmp(r[O].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[O]),D[2]=r[P].add(r[O].neg())):(D[1]=r[P].toJ().mixedAdd(r[O]),D[2]=r[P].toJ().mixedAdd(r[O].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=Ok(n[P],n[O]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[O]=new Array(l),g=0;g=0;d--){for(var T=0;d>=0;){var z=!0;for(g=0;g=0&&T++,K=K.dblp(T),d<0)break;for(g=0;g0?y=a[g][ue-1>>1]:ue<0&&(y=a[g][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Vi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),g.negative&&(g=g.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:g,b:y},{a:A,b:P}]},Gi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),g=e.sub(a).sub(u),y=l.add(d).neg();return{k1:g,k2:y}},Gi.prototype.pointFromX=function(e,r){e=new en(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Gi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Gi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},On.prototype.isInfinity=function(){return this.inf},On.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},On.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},On.prototype.getX=function(){return this.x.fromRed()},On.prototype.getY=function(){return this.y.fromRed()},On.prototype.mul=function(e){return e=new en(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},On.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},On.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},On.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},On.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},On.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function qn(t,e,r,n){bu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new en(0)):(this.x=new en(e,16),this.y=new en(r,16),this.z=new en(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Jm(qn,bu.BasePoint),Gi.prototype.jpoint=function(e,r,n){return new qn(this,e,r,n)},qn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},qn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},qn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),g=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(g).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(g)),O=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,O)},qn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),g=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(g).redISub(g),A=u.redMul(g.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},qn.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},qn.prototype.inspect=function(){return this.isInfinity()?"":""},qn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var yu=Eo,T3=yd,Dd=Rd,Bk=Ti;function wu(t){Dd.call(this,"mont",t),this.a=new yu(t.a,16).toRed(this.red),this.b=new yu(t.b,16).toRed(this.red),this.i4=new yu(4).toRed(this.red).redInvm(),this.two=new yu(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}T3(wu,Dd);var $k=wu;wu.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function Nn(t,e,r){Dd.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new yu(e,16),this.z=new yu(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}T3(Nn,Dd.BasePoint),wu.prototype.decodePoint=function(e,r){return this.point(Bk.toArray(e,r),1)},wu.prototype.point=function(e,r){return new Nn(this,e,r)},wu.prototype.pointFromJSON=function(e){return Nn.fromJSON(this,e)},Nn.prototype.precompute=function(){},Nn.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Nn.fromJSON=function(e,r){return new Nn(e,r[0],r[1]||e.one)},Nn.prototype.inspect=function(){return this.isInfinity()?"":""},Nn.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Nn.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)},Nn.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),u=s.redMul(i),l=r.z.redMul(a.redAdd(u).redSqr()),d=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(l,d)},Nn.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i},Nn.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Nn.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Nn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var Fk=Ti,So=Eo,R3=yd,Od=Rd,jk=Fk.assert;function zs(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Od.call(this,"edwards",t),this.a=new So(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new So(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new So(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),jk(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}R3(zs,Od);var Uk=zs;zs.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},zs.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},zs.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)},zs.prototype.pointFromX=function(e,r){e=new So(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var u=a.fromRed().isOdd();return(r&&!u||!r&&u)&&(a=a.redNeg()),this.point(e,a)},zs.prototype.pointFromY=function(e,r){e=new So(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)},zs.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function Hr(t,e,r,n,i){Od.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new So(e,16),this.y=new So(r,16),this.z=n?new So(n,16):this.curve.one,this.t=i&&new So(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}R3(Hr,Od.BasePoint),zs.prototype.pointFromJSON=function(e){return Hr.fromJSON(this,e)},zs.prototype.point=function(e,r,n,i){return new Hr(this,e,r,n,i)},Hr.fromJSON=function(e,r){return new Hr(e,r[0],r[1],r[2])},Hr.prototype.inspect=function(){return this.isInfinity()?"":""},Hr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Hr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),u=i.redSub(r),l=s.redMul(a),d=o.redMul(u),g=s.redMul(u),y=a.redMul(o);return this.curve.point(l,d,y,g)},Hr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,u,l;if(this.curve.twisted){a=this.curve._mulA(r);var d=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(d.redSub(this.curve.two)),s=d.redMul(a.redSub(n)),o=d.redSqr().redSub(d).redSub(d)):(u=this.z.redSqr(),l=d.redSub(u).redISub(u),i=e.redSub(r).redISub(n).redMul(l),s=d.redMul(a.redSub(n)),o=d.redMul(l))}else a=r.redAdd(n),u=this.curve._mulC(this.z).redSqr(),l=a.redSub(u).redSub(u),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)},Hr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Hr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),u=s.redAdd(i),l=n.redAdd(r),d=o.redMul(a),g=u.redMul(l),y=o.redMul(l),A=a.redMul(u);return this.curve.point(d,g,A,y)},Hr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),u=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),d=r.redMul(a).redMul(l),g,y;return this.curve.twisted?(g=r.redMul(u).redMul(s.redSub(this.curve._mulA(i))),y=a.redMul(u)):(g=r.redMul(u).redMul(s.redSub(i)),y=this.curve._mulC(a).redMul(u)),this.curve.point(d,g,y)},Hr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Hr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Hr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)},Hr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)},Hr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Hr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Hr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Hr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Hr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Hr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Hr.prototype.toP=Hr.prototype.normalize,Hr.prototype.mixedAdd=Hr.prototype.add,function(t){var e=t;e.base=Rd,e.short=kk,e.mont=$k,e.edwards=Uk}(Ym);var Nd={},Xm,D3;function qk(){return D3||(D3=1,Xm={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Xm}(function(t){var e=t,r=al,n=Ym,i=Ti,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,d){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var g=new o(d);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:g}),g}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=qk()}catch{u=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})})(Nd);var zk=al,ec=Km,O3=Ja;function la(t){if(!(this instanceof la))return new la(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ec.toArray(t.entropy,t.entropyEnc||"hex"),r=ec.toArray(t.nonce,t.nonceEnc||"hex"),n=ec.toArray(t.pers,t.persEnc||"hex");O3(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Hk=la;la.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},la.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=ec.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var Ld=Eo,Qm=Ti,Gk=Qm.assert;function kd(t,e){if(t instanceof kd)return t;this._importDER(t,e)||(Gk(t.r&&t.s,"Signature without r or s"),this.r=new Ld(t.r,16),this.s=new Ld(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Yk=kd;function Jk(){this.place=0}function e1(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function N3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}kd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=N3(r),n=N3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];t1(i,r.length),i=i.concat(r),i.push(2),t1(i,n.length);var s=i.concat(n),o=[48];return t1(o,s.length),o=o.concat(s),Qm.encode(o,e)};var Ao=Eo,L3=Hk,Xk=Ti,r1=Nd,Zk=C3,k3=Xk.assert,n1=Vk,Bd=Yk;function Yi(t){if(!(this instanceof Yi))return new Yi(t);typeof t=="string"&&(k3(Object.prototype.hasOwnProperty.call(r1,t),"Unknown curve "+t),t=r1[t]),t instanceof r1.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Qk=Yi;Yi.prototype.keyPair=function(e){return new n1(this,e)},Yi.prototype.keyFromPrivate=function(e,r){return n1.fromPrivate(this,e,r)},Yi.prototype.keyFromPublic=function(e,r){return n1.fromPublic(this,e,r)},Yi.prototype.genKeyPair=function(e){e||(e={});for(var r=new L3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Zk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new Ao(2));;){var s=new Ao(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Yi.prototype._truncateToN=function(e,r,n){var i;if(Ao.isBN(e)||typeof e=="number")e=new Ao(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new Ao(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new Ao(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Yi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new L3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new Ao(1)),d=0;;d++){var g=i.k?i.k(d):new Ao(u.generate(this.n.byteLength()));if(g=this._truncateToN(g,!0),!(g.cmpn(1)<=0||g.cmp(l)>=0)){var y=this.g.mul(g);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var O=g.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(O=O.umod(this.n),O.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&O.cmp(this.nh)>0&&(O=this.n.sub(O),D^=1),new Bd({r:P,s:O,recoveryParam:D})}}}}}},Yi.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new Bd(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),l=u.mul(e).umod(this.n),d=u.mul(o).umod(this.n),g;return this.curve._maxwellTrick?(g=this.g.jmulAdd(l,n.getPublic(),d),g.isInfinity()?!1:g.eqXToP(o)):(g=this.g.mulAdd(l,n.getPublic(),d),g.isInfinity()?!1:g.getX().umod(this.n).cmp(o)===0)},Yi.prototype.recoverPubKey=function(t,e,r,n){k3((3&r)===r,"The recovery param is more than two bits"),e=new Bd(e,n);var i=this.n,s=new Ao(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),g=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(g,o,y)},Yi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Bd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dl=Ti,B3=dl.assert,$3=dl.parseBytes,xu=dl.cachedProperty;function Ln(t,e){this.eddsa=t,this._secret=$3(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=$3(e.pub)}Ln.fromPublic=function(e,r){return r instanceof Ln?r:new Ln(e,{pub:r})},Ln.fromSecret=function(e,r){return r instanceof Ln?r:new Ln(e,{secret:r})},Ln.prototype.secret=function(){return this._secret},xu(Ln,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),xu(Ln,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),xu(Ln,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i}),xu(Ln,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),xu(Ln,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),xu(Ln,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Ln.prototype.sign=function(e){return B3(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Ln.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},Ln.prototype.getSecret=function(e){return B3(this._secret,"KeyPair is public only"),dl.encode(this.secret(),e)},Ln.prototype.getPublic=function(e){return dl.encode(this.pubBytes(),e)};var eB=Ln,tB=Eo,$d=Ti,F3=$d.assert,Fd=$d.cachedProperty,rB=$d.parseBytes;function tc(t,e){this.eddsa=t,typeof e!="object"&&(e=rB(e)),Array.isArray(e)&&(F3(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),F3(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof tB&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Fd(tc,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Fd(tc,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Fd(tc,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Fd(tc,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),tc.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},tc.prototype.toHex=function(){return $d.encode(this.toBytes(),"hex").toUpperCase()};var nB=tc,iB=al,sB=Nd,_u=Ti,oB=_u.assert,j3=_u.parseBytes,U3=eB,q3=nB;function vi(t){if(oB(t==="ed25519","only tested with ed25519 so far"),!(this instanceof vi))return new vi(t);t=sB[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=iB.sha512}var aB=vi;vi.prototype.sign=function(e,r){e=j3(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),u=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:u,Rencoded:o})},vi.prototype.verify=function(e,r,n){if(e=j3(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)},vi.prototype.hashInt=function(){for(var e=this.hash(),r=0;re in t?fB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,K3=(t,e)=>{for(var r in e||(e={}))lB.call(e,r)&&W3(t,r,e[r]);if(H3)for(var r of H3(e))hB.call(e,r)&&W3(t,r,e[r]);return t};const dB="ReactNative",Ri={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},pB="js";function jd(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Su(){return!nl()&&!!mm()&&navigator.product===dB}function pl(){return!jd()&&!!mm()&&!!nl()}function gl(){return Su()?Ri.reactNative:jd()?Ri.node:pl()?Ri.browser:Ri.unknown}function gB(){var t;try{return Su()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function mB(t,e){let r=il.parse(t);return r=K3(K3({},r),e),t=il.stringify(r),t}function V3(){return Mx()||{name:"",description:"",url:"",icons:[""]}}function vB(){if(gl()===Ri.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=zO();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function bB(){var t;const e=gl();return e===Ri.browser?[e,((t=Px())==null?void 0:t.host)||"unknown"].join(":"):e}function G3(t,e,r){const n=vB(),i=bB();return[[t,e].join("-"),[pB,r].join("-"),n,i].join("/")}function yB({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const u=r.split("?"),l=G3(t,e,n),d={auth:i,ua:l,projectId:s,useOnCloseEvent:o,origin:a||void 0},g=mB(u[1]||"",d);return u[0]+"?"+g}function rc(t,e){return t.filter(r=>e.includes(r)).length===t.length}function Y3(t){return Object.fromEntries(t.entries())}function J3(t){return new Map(Object.entries(t))}function nc(t=mt.FIVE_MINUTES,e){const r=mt.toMiliseconds(t||mt.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Au(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function X3(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function wB(t){return X3("topic",t)}function xB(t){return X3("id",t)}function Z3(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function En(t,e){return mt.fromMiliseconds(Date.now()+mt.toMiliseconds(t))}function ha(t){return Date.now()>=mt.toMiliseconds(t)}function vr(t,e){return`${t}${e?`:${e}`:""}`}function Ud(t=[],e=[]){return[...new Set([...t,...e])]}async function _B({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=EB(s,t,e),a=gl();if(a===Ri.browser){if(!((n=nl())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,AB()?"_blank":"_self","noreferrer noopener")}else a===Ri.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function EB(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${PB(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function SB(t,e){let r="";try{if(pl()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function Q3(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function e_(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function i1(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function AB(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function PB(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function t_(t){return Buffer.from(t,"base64").toString("utf-8")}const MB="https://rpc.walletconnect.org/v1";async function IB(t,e,r,n,i,s){switch(r.t){case"eip191":return CB(t,e,r.s);case"eip1271":return await TB(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function CB(t,e,r){return bk(zx(e),r).toLowerCase()===t.toLowerCase()}async function TB(t,e,r,n,i,s){const o=Eu(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",d=r.substring(2),g=zx(e).substring(2),y=a+g+u+l+d,A=await fetch(`${s||MB}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:RB(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:y},"latest"]})}),{result:P}=await A.json();return P?P.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function RB(){return Date.now()+Math.floor(Math.random()*1e3)}var DB=Object.defineProperty,OB=Object.defineProperties,NB=Object.getOwnPropertyDescriptors,r_=Object.getOwnPropertySymbols,LB=Object.prototype.hasOwnProperty,kB=Object.prototype.propertyIsEnumerable,n_=(t,e,r)=>e in t?DB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,BB=(t,e)=>{for(var r in e||(e={}))LB.call(e,r)&&n_(t,r,e[r]);if(r_)for(var r of r_(e))kB.call(e,r)&&n_(t,r,e[r]);return t},$B=(t,e)=>OB(t,NB(e));const FB="did:pkh:",s1=t=>t==null?void 0:t.split(":"),jB=t=>{const e=t&&s1(t);if(e)return t.includes(FB)?e[3]:e[1]},o1=t=>{const e=t&&s1(t);if(e)return e[2]+":"+e[3]},qd=t=>{const e=t&&s1(t);if(e)return e.pop()};async function i_(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=s_(i,i.iss),o=qd(i.iss);return await IB(o,s,n,o1(i.iss),r)}const s_=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=qd(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${jB(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,d=t.exp?`Expiration Time: ${t.exp}`:void 0,g=t.nbf?`Not Before: ${t.nbf}`:void 0,y=t.requestId?`Request ID: ${t.requestId}`:void 0,A=t.resources?`Resources:${t.resources.map(O=>` +- ${O}`).join("")}`:void 0,P=zd(t.resources);if(P){const O=ml(P);i=YB(i,O)}return[r,n,"",i,"",s,o,a,u,l,d,g,y,A].filter(O=>O!=null).join(` +`)};function UB(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function qB(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function ic(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function zB(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:HB(e,r,n)}}}function HB(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function o_(t){return ic(t),`urn:recap:${UB(t).replace(/=/g,"")}`}function ml(t){const e=qB(t.replace("urn:recap:",""));return ic(e),e}function WB(t,e,r){const n=zB(t,e,r);return o_(n)}function KB(t){return t&&t.includes("urn:recap:")}function VB(t,e){const r=ml(t),n=ml(e),i=GB(r,n);return o_(i)}function GB(t,e){ic(t),ic(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,u)=>a.localeCompare(u)).forEach(a=>{var u,l;n.att[i]=$B(BB({},n.att[i]),{[a]:((u=t.att[i])==null?void 0:u[a])||((l=e.att[i])==null?void 0:l[a])})})}),n}function YB(t="",e){ic(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const u=Object.keys(e.att[a]).map(g=>({ability:g.split("/")[0],action:g.split("/")[1]}));u.sort((g,y)=>g.action.localeCompare(y.action));const l={};u.forEach(g=>{l[g.ability]||(l[g.ability]=[]),l[g.ability].push(g.action)});const d=Object.keys(l).map(g=>(i++,`(${i}) '${g}': '${l[g].join("', '")}' for '${a}'.`));n.push(d.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function a_(t){var e;const r=ml(t);ic(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function c_(t){const e=ml(t);ic(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function zd(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return KB(e)?e:void 0}const u_="base10",ni="base16",da="base64pad",vl="base64url",bl="utf8",f_=0,Po=1,yl=2,JB=0,l_=1,wl=12,a1=32;function XB(){const t=Hm.generateKeyPair();return{privateKey:Tn(t.secretKey,ni),publicKey:Tn(t.publicKey,ni)}}function c1(){const t=na.randomBytes(a1);return Tn(t,ni)}function ZB(t,e){const r=Hm.sharedKey(Rn(t,ni),Rn(e,ni),!0),n=new Rk(ll.SHA256,r).expand(a1);return Tn(n,ni)}function Hd(t){const e=ll.hash(Rn(t,ni));return Tn(e,ni)}function Mo(t){const e=ll.hash(Rn(t,bl));return Tn(e,ni)}function h_(t){return Rn(`${t}`,u_)}function sc(t){return Number(Tn(t,u_))}function QB(t){const e=h_(typeof t.type<"u"?t.type:f_);if(sc(e)===Po&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Rn(t.senderPublicKey,ni):void 0,n=typeof t.iv<"u"?Rn(t.iv,ni):na.randomBytes(wl),i=new Um.ChaCha20Poly1305(Rn(t.symKey,ni)).seal(n,Rn(t.message,bl));return d_({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function e$(t,e){const r=h_(yl),n=na.randomBytes(wl),i=Rn(t,bl);return d_({type:r,sealed:i,iv:n,encoding:e})}function t$(t){const e=new Um.ChaCha20Poly1305(Rn(t.symKey,ni)),{sealed:r,iv:n}=xl({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Tn(i,bl)}function r$(t,e){const{sealed:r}=xl({encoded:t,encoding:e});return Tn(r,bl)}function d_(t){const{encoding:e=da}=t;if(sc(t.type)===yl)return Tn(pd([t.type,t.sealed]),e);if(sc(t.type)===Po){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Tn(pd([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return Tn(pd([t.type,t.iv,t.sealed]),e)}function xl(t){const{encoded:e,encoding:r=da}=t,n=Rn(e,r),i=n.slice(JB,l_),s=l_;if(sc(i)===Po){const l=s+a1,d=l+wl,g=n.slice(s,l),y=n.slice(l,d),A=n.slice(d);return{type:i,sealed:A,iv:y,senderPublicKey:g}}if(sc(i)===yl){const l=n.slice(s),d=na.randomBytes(wl);return{type:i,sealed:l,iv:d}}const o=s+wl,a=n.slice(s,o),u=n.slice(o);return{type:i,sealed:u,iv:a}}function n$(t,e){const r=xl({encoded:t,encoding:e==null?void 0:e.encoding});return p_({type:sc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Tn(r.senderPublicKey,ni):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function p_(t){const e=(t==null?void 0:t.type)||f_;if(e===Po){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function g_(t){return t.type===Po&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function m_(t){return t.type===yl}function i$(t){return new M3.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function s$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function o$(t){return Buffer.from(s$(t),"base64")}function a$(t,e){const[r,n,i]=t.split("."),s=o$(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),u=`${r}.${n}`,l=new ll.SHA256().update(Buffer.from(u)).digest(),d=i$(e),g=Buffer.from(l).toString("hex");if(!d.verify(g,{r:o,s:a}))throw new Error("Invalid signature");return gm(t).payload}const c$="irn";function u1(t){return(t==null?void 0:t.relay)||{protocol:c$}}function _l(t){const e=cB[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var u$=Object.defineProperty,f$=Object.defineProperties,l$=Object.getOwnPropertyDescriptors,v_=Object.getOwnPropertySymbols,h$=Object.prototype.hasOwnProperty,d$=Object.prototype.propertyIsEnumerable,b_=(t,e,r)=>e in t?u$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,y_=(t,e)=>{for(var r in e||(e={}))h$.call(e,r)&&b_(t,r,e[r]);if(v_)for(var r of v_(e))d$.call(e,r)&&b_(t,r,e[r]);return t},p$=(t,e)=>f$(t,l$(e));function g$(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function w_(t){if(!t.includes("wc:")){const u=t_(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=il.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:m$(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:g$(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function m$(t){return t.startsWith("//")?t.substring(2):t}function v$(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function x_(t){return`${t.protocol}:${t.topic}@${t.version}?`+il.stringify(y_(p$(y_({symKey:t.symKey},v$(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Wd(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Pu(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function b$(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Pu(r.accounts))}),e}function y$(t,e){const r=[];return Object.values(t).forEach(n=>{Pu(n.accounts).includes(e)&&r.push(...n.methods)}),r}function w$(t,e){const r=[];return Object.values(t).forEach(n=>{Pu(n.accounts).includes(e)&&r.push(...n.events)}),r}function f1(t){return t.includes(":")}function El(t){return f1(t)?t.split(":")[0]:t}function x$(t){const e={};return t==null||t.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function __(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=x$(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=Ud(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const _$={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},E$={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ut(t,e){const{message:r,code:n}=E$[t];return{message:e?`${r} ${e}`:r,code:n}}function Dr(t,e){const{message:r,code:n}=_$[t];return{message:e?`${r} ${e}`:r,code:n}}function oc(t,e){return!!Array.isArray(t)}function Sl(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function bi(t){return typeof t>"u"}function an(t,e){return e&&bi(t)?!0:typeof t=="string"&&!!t.trim().length}function l1(t,e){return typeof t=="number"&&!isNaN(t)}function S$(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return rc(i,n)?(n.forEach(o=>{const{accounts:a,methods:u,events:l}=t.namespaces[o],d=Pu(a),g=r[o];(!rc(z3(o,g),d)||!rc(g.methods,u)||!rc(g.events,l))&&(s=!1)}),s):!1}function Kd(t){return an(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function A$(t){if(an(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Kd(r)}}return!1}function P$(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(an(t,!1)){if(e(t))return!0;const r=t_(t);return e(r)}}catch{}return!1}function M$(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function I$(t){return t==null?void 0:t.topic}function C$(t,e){let r=null;return an(t==null?void 0:t.publicKey,!1)||(r=ut("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function E_(t){let e=!0;return oc(t)?t.length&&(e=t.every(r=>an(r,!1))):e=!1,e}function T$(t,e,r){let n=null;return oc(e)&&e.length?e.forEach(i=>{n||Kd(i)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Kd(t)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function R$(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=T$(i,z3(i,s),`${e} ${r}`);o&&(n=o)}),n}function D$(t,e){let r=null;return oc(t)?t.forEach(n=>{r||A$(n)||(r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function O$(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=D$(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function N$(t,e){let r=null;return E_(t==null?void 0:t.methods)?E_(t==null?void 0:t.events)||(r=Dr("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Dr("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function S_(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=N$(n,`${e}, namespace`);i&&(r=i)}),r}function L$(t,e,r){let n=null;if(t&&Sl(t)){const i=S_(t,e);i&&(n=i);const s=R$(t,e,r);s&&(n=s)}else n=ut("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function h1(t,e){let r=null;if(t&&Sl(t)){const n=S_(t,e);n&&(r=n);const i=O$(t,e);i&&(r=i)}else r=ut("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function A_(t){return an(t.protocol,!0)}function k$(t,e){let r=!1;return t?t&&oc(t)&&t.length&&t.forEach(n=>{r=A_(n)}):r=!0,r}function B$(t){return typeof t=="number"}function yi(t){return typeof t<"u"&&typeof t!==null}function $$(t){return!(!t||typeof t!="object"||!t.code||!l1(t.code)||!t.message||!an(t.message,!1))}function F$(t){return!(bi(t)||!an(t.method,!1))}function j$(t){return!(bi(t)||bi(t.result)&&bi(t.error)||!l1(t.id)||!an(t.jsonrpc,!1))}function U$(t){return!(bi(t)||!an(t.name,!1))}function P_(t,e){return!(!Kd(e)||!b$(t).includes(e))}function q$(t,e,r){return an(r,!1)?y$(t,e).includes(r):!1}function z$(t,e,r){return an(r,!1)?w$(t,e).includes(r):!1}function M_(t,e,r){let n=null;const i=H$(t),s=W$(e),o=Object.keys(i),a=Object.keys(s),u=I_(Object.keys(t)),l=I_(Object.keys(e)),d=u.filter(g=>!l.includes(g));return d.length&&(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${d.toString()} - Received: ${Object.keys(e).toString()}`)),Qa(o,a)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. + Received: ${Object.keys(e).toString()}`)),rc(o,a)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} - Approved: ${a.toString()}`)),Object.keys(e).forEach(g=>{if(!g.includes(":")||n)return;const y=Au(e[g].accounts);y.includes(g)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${g} + Approved: ${a.toString()}`)),Object.keys(e).forEach(g=>{if(!g.includes(":")||n)return;const y=Pu(e[g].accounts);y.includes(g)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${g} Required: ${g} - Approved: ${y.toString()}`))}),o.forEach(g=>{n||(Qa(i[g].methods,s[g].methods)?Qa(i[g].events,s[g].events)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${g}`)):n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${g}`))}),n}function NB(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function P_(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function LB(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Au(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function kB(t,e){return l1(t)&&t<=e.max&&t>=e.min}function M_(){const t=pl();return new Promise(e=>{switch(t){case Ri.browser:e($B());break;case Ri.reactNative:e(BB());break;case Ri.node:e(FB());break;default:e(!0)}})}function $B(){return dl()&&(navigator==null?void 0:navigator.onLine)}async function BB(){if(Eu()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function FB(){return!0}function UB(t){switch(pl()){case Ri.browser:jB(t);break;case Ri.reactNative:qB(t);break}}function jB(t){!Eu()&&dl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function qB(t){Eu()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const d1={};class Sl{static get(e){return d1[e]}static set(e,r){d1[e]=r}static delete(e){delete d1[e]}}const zB="PARSE_ERROR",HB="INVALID_REQUEST",WB="METHOD_NOT_FOUND",KB="INVALID_PARAMS",I_="INTERNAL_ERROR",p1="SERVER_ERROR",VB=[-32700,-32600,-32601,-32602,-32603],Al={[zB]:{code:-32700,message:"Parse error"},[HB]:{code:-32600,message:"Invalid Request"},[WB]:{code:-32601,message:"Method not found"},[KB]:{code:-32602,message:"Invalid params"},[I_]:{code:-32603,message:"Internal error"},[p1]:{code:-32e3,message:"Server error"}},C_=p1;function GB(t){return VB.includes(t)}function T_(t){return Object.keys(Al).includes(t)?Al[t]:Al[C_]}function YB(t){const e=Object.values(Al).find(r=>r.code===t);return e||Al[C_]}function R_(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var D_={},Ao={},O_;function JB(){if(O_)return Ao;O_=1,Object.defineProperty(Ao,"__esModule",{value:!0}),Ao.isBrowserCryptoAvailable=Ao.getSubtleCrypto=Ao.getBrowerCrypto=void 0;function t(){return(nn==null?void 0:nn.crypto)||(nn==null?void 0:nn.msCrypto)||{}}Ao.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Ao.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Ao.isBrowserCryptoAvailable=r,Ao}var Po={},N_;function XB(){if(N_)return Po;N_=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.isBrowser=Po.isNode=Po.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Po.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Po.isNode=e;function r(){return!t()&&!e()}return Po.isBrowser=r,Po}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Kf;e.__exportStar(JB(),t),e.__exportStar(XB(),t)})(D_);function la(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function ic(t=6){return BigInt(la(t))}function ha(t,e,r){return{id:r||la(),jsonrpc:"2.0",method:t,params:e}}function Kd(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Vd(t,e,r){return{id:t,jsonrpc:"2.0",error:ZB(e)}}function ZB(t,e){return typeof t>"u"?T_(I_):(typeof t=="string"&&(t=Object.assign(Object.assign({},T_(p1)),{message:t})),GB(t.code)&&(t=YB(t.code)),t)}let QB=class{},eF=class extends QB{constructor(){super()}},tF=class extends eF{constructor(e){super()}};const rF="^https?:",nF="^wss?:";function iF(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function L_(t,e){const r=iF(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function k_(t){return L_(t,rF)}function $_(t){return L_(t,nF)}function sF(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function B_(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function g1(t){return B_(t)&&"method"in t}function Gd(t){return B_(t)&&(zs(t)||Yi(t))}function zs(t){return"result"in t}function Yi(t){return"error"in t}let Ji=class extends tF{constructor(e){super(e),this.events=new qi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(ha(e.method,e.params||[],e.id||ic().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Yi(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Gd(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const oF=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),aF=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",F_=t=>t.split("?")[0],U_=10,cF=oF();let uF=class{constructor(e){if(this.url=e,this.events=new qi.EventEmitter,this.registering=!1,!$_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(go(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!$_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=D_.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!sF(e)},o=new cF(e,[],s);aF()?o.onerror=a=>{const u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Wa(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Vd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return R_(e,F_(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>U_&&this.events.setMaxListeners(U_)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${F_(this.url)}`));return this.events.emit("register_error",r),r}};var Yd={exports:{}};Yd.exports,function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",u="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",g="[object Date]",y="[object Error]",A="[object Function]",P="[object GeneratorFunction]",N="[object Map]",D="[object Number]",k="[object Null]",$="[object Object]",q="[object Promise]",U="[object Proxy]",K="[object RegExp]",J="[object Set]",T="[object String]",z="[object Symbol]",ue="[object Undefined]",_e="[object WeakMap]",G="[object ArrayBuffer]",E="[object DataView]",m="[object Float32Array]",f="[object Float64Array]",p="[object Int8Array]",v="[object Int16Array]",x="[object Int32Array]",_="[object Uint8Array]",S="[object Uint8ClampedArray]",b="[object Uint16Array]",M="[object Uint32Array]",I=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,O={};O[m]=O[f]=O[p]=O[v]=O[x]=O[_]=O[S]=O[b]=O[M]=!0,O[a]=O[u]=O[G]=O[d]=O[E]=O[g]=O[y]=O[A]=O[N]=O[D]=O[$]=O[K]=O[J]=O[T]=O[_e]=!1;var se=typeof nn=="object"&&nn&&nn.Object===Object&&nn,ee=typeof self=="object"&&self&&self.Object===Object&&self,X=se||ee||Function("return this")(),Q=e&&!e.nodeType&&e,R=Q&&!0&&t&&!t.nodeType&&t,Z=R&&R.exports===Q,te=Z&&se.process,le=function(){try{return te&&te.binding&&te.binding("util")}catch{}}(),ie=le&&le.isTypedArray;function fe(ce,ye){for(var Ye=-1,It=ce==null?0:ce.length,Ur=0,ir=[];++Ye-1}function st(ce,ye){var Ye=this.__data__,It=Xe(Ye,ce);return It<0?(++this.size,Ye.push([ce,ye])):Ye[It][1]=ye,this}Re.prototype.clear=De,Re.prototype.delete=it,Re.prototype.get=je,Re.prototype.has=gt,Re.prototype.set=st;function tt(ce){var ye=-1,Ye=ce==null?0:ce.length;for(this.clear();++yewn))return!1;var jr=ir.get(ce);if(jr&&ir.get(ye))return jr==ye;var gn=-1,_i=!0,xn=Ye&s?new _t:void 0;for(ir.set(ce,ye),ir.set(ye,ce);++gn-1&&ce%1==0&&ce-1&&ce%1==0&&ce<=o}function up(ce){var ye=typeof ce;return ce!=null&&(ye=="object"||ye=="function")}function Ac(ce){return ce!=null&&typeof ce=="object"}var fp=ie?Te(ie):dr;function jb(ce){return Fb(ce)?qe(ce):pr(ce)}function Fr(){return[]}function kr(){return!1}t.exports=Ub}(Yd,Yd.exports);var fF=Yd.exports;const lF=Ui(fF),j_="wc",q_=2,z_="core",Hs=`${j_}@2:${z_}:`,hF={logger:"error"},dF={database:":memory:"},pF="crypto",H_="client_ed25519_seed",gF=mt.ONE_DAY,mF="keychain",vF="0.3",bF="messages",yF="0.3",wF=mt.SIX_HOURS,xF="publisher",W_="irn",_F="error",K_="wss://relay.walletconnect.org",EF="relayer",ii={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},SF="_subscription",Xi={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},AF=.1,m1="2.17.2",Wr={link_mode:"link_mode",relay:"relay"},PF="0.3",MF="WALLETCONNECT_CLIENT_ID",V_="WALLETCONNECT_LINK_MODE_APPS",Ws={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},IF="subscription",CF="0.3",TF=mt.FIVE_SECONDS*1e3,RF="pairing",DF="0.3",Pl={wc_pairingDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:0},res:{ttl:mt.ONE_DAY,prompt:!1,tag:0}}},sc={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},vs={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},OF="history",NF="0.3",LF="expirer",Zi={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},kF="0.3",$F="verify-api",BF="https://verify.walletconnect.com",G_="https://verify.walletconnect.org",Ml=G_,FF=`${Ml}/v3`,UF=[BF,G_],jF="echo",qF="https://echo.walletconnect.com",Ks={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},Mo={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},bs={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},oc={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},ac={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Il={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},zF=.1,HF="event-client",WF=86400,KF="https://pulse.walletconnect.org/batch";function VF(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(q);k!==$;){for(var K=P[k],J=0,T=q-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=q-D;z!==q&&U[z]===0;)z++;for(var ue=u.repeat(N);z>>0,q=new Uint8Array($);P[N];){var U=r[P.charCodeAt(N)];if(U===255)return;for(var K=0,J=$-1;(U!==0||K>>0,q[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,N++}if(P[N]!==" "){for(var T=$-k;T!==$&&q[T]===0;)T++;for(var z=new Uint8Array(D+($-T)),ue=D;T!==$;)z[ue++]=q[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:g,decodeUnsafe:y,decode:A}}var GF=VF,YF=GF;const Y_=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},JF=t=>new TextEncoder().encode(t),XF=t=>new TextDecoder().decode(t);class ZF{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class QF{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return J_(this,e)}}class eU{constructor(e){this.decoders=e}or(e){return J_(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const J_=(t,e)=>new eU({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class tU{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new ZF(e,r,n),this.decoder=new QF(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Jd=({name:t,prefix:e,encode:r,decode:n})=>new tU(t,e,r,n),Cl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=YF(r,e);return Jd({prefix:t,name:e,encode:n,decode:s=>Y_(i(s))})},rU=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},nU=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Jd({prefix:e,name:t,encode(i){return nU(i,n,r)},decode(i){return rU(i,n,r,t)}}),iU=Jd({prefix:"\0",name:"identity",encode:t=>XF(t),decode:t=>JF(t)});var sU=Object.freeze({__proto__:null,identity:iU});const oU=qn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var aU=Object.freeze({__proto__:null,base2:oU});const cU=qn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var uU=Object.freeze({__proto__:null,base8:cU});const fU=Cl({prefix:"9",name:"base10",alphabet:"0123456789"});var lU=Object.freeze({__proto__:null,base10:fU});const hU=qn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),dU=qn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var pU=Object.freeze({__proto__:null,base16:hU,base16upper:dU});const gU=qn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),mU=qn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),vU=qn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),bU=qn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),yU=qn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),wU=qn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),xU=qn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),_U=qn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),EU=qn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var SU=Object.freeze({__proto__:null,base32:gU,base32upper:mU,base32pad:vU,base32padupper:bU,base32hex:yU,base32hexupper:wU,base32hexpad:xU,base32hexpadupper:_U,base32z:EU});const AU=Cl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),PU=Cl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var MU=Object.freeze({__proto__:null,base36:AU,base36upper:PU});const IU=Cl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),CU=Cl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var TU=Object.freeze({__proto__:null,base58btc:IU,base58flickr:CU});const RU=qn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),DU=qn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),OU=qn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),NU=qn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var LU=Object.freeze({__proto__:null,base64:RU,base64pad:DU,base64url:OU,base64urlpad:NU});const X_=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),kU=X_.reduce((t,e,r)=>(t[r]=e,t),[]),$U=X_.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function BU(t){return t.reduce((e,r)=>(e+=kU[r],e),"")}function FU(t){const e=[];for(const r of t){const n=$U[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const UU=Jd({prefix:"🚀",name:"base256emoji",encode:BU,decode:FU});var jU=Object.freeze({__proto__:null,base256emoji:UU}),qU=Q_,Z_=128,zU=127,HU=~zU,WU=Math.pow(2,31);function Q_(t,e,r){e=e||[],r=r||0;for(var n=r;t>=WU;)e[r++]=t&255|Z_,t/=128;for(;t&HU;)e[r++]=t&255|Z_,t>>>=7;return e[r]=t|0,Q_.bytes=r-n+1,e}var KU=v1,VU=128,e6=127;function v1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw v1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&e6)<=VU);return v1.bytes=s-n,r}var GU=Math.pow(2,7),YU=Math.pow(2,14),JU=Math.pow(2,21),XU=Math.pow(2,28),ZU=Math.pow(2,35),QU=Math.pow(2,42),ej=Math.pow(2,49),tj=Math.pow(2,56),rj=Math.pow(2,63),nj=function(t){return t(t6.encode(t,e,r),e),n6=t=>t6.encodingLength(t),b1=(t,e)=>{const r=e.byteLength,n=n6(t),i=n+n6(r),s=new Uint8Array(i+r);return r6(t,s,0),r6(r,s,n),s.set(e,i),new sj(t,r,e,s)};class sj{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const i6=({name:t,code:e,encode:r})=>new oj(t,e,r);class oj{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?b1(this.code,r):r.then(n=>b1(this.code,n))}else throw Error("Unknown type, must be binary type")}}const s6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),aj=i6({name:"sha2-256",code:18,encode:s6("SHA-256")}),cj=i6({name:"sha2-512",code:19,encode:s6("SHA-512")});var uj=Object.freeze({__proto__:null,sha256:aj,sha512:cj});const o6=0,fj="identity",a6=Y_;var lj=Object.freeze({__proto__:null,identity:{code:o6,name:fj,encode:a6,digest:t=>b1(o6,a6(t))}});new TextEncoder,new TextDecoder;const c6={...sU,...aU,...uU,...lU,...pU,...SU,...MU,...TU,...LU,...jU};({...uj,...lj});function hj(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function u6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const f6=u6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),y1=u6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=hj(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=ut("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,V3(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?G3(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}},mj=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=pF,this.randomSessionIdentifier=c1(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=wx(i);return yx(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=j$();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=wx(s),a=this.randomSessionIdentifier;return await SO(a,i,gF,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),u=q$(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||zd(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=h_(o),u=go(s);if(p_(a))return H$(u,o==null?void 0:o.encoding);if(d_(a)){const y=a.senderPublicKey,A=a.receiverPublicKey;i=await this.generateSharedKey(y,A)}const l=this.getSymKey(i),{type:d,senderPublicKey:g}=a;return z$({type:d,symKey:l,message:u,senderPublicKey:g,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=V$(s,o);if(p_(a)){const u=K$(s,o==null?void 0:o.encoding);return Wa(u)}if(d_(a)){const u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{const u=this.getSymKey(i),l=W$({symKey:u,encoded:s,encoding:o==null?void 0:o.encoding});return Wa(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=(i,s=fa)=>{const o=wl({encoded:i,encoding:s});return rc(o.type)},this.getPayloadSenderPublicKey=(i,s=fa)=>{const o=wl({encoded:i,encoding:s});return o.senderPublicKey?Tn(o.senderPublicKey,ni):void 0},this.core=e,this.logger=ri(r,this.name),this.keychain=n||new gj(this.core,this.logger)}get context(){return gi(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(H_)}catch{e=c1(),await this.keychain.set(H_,e)}return pj(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}};class vj extends DR{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=bF,this.version=yF,this.initialized=!1,this.storagePrefix=Hs,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=So(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=So(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=ri(e,this.name),this.core=r}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,V3(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?G3(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class bj extends OR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new qi.EventEmitter,this.name=xF,this.queue=new Map,this.publishTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.failedPublishTimeout=mt.toMiliseconds(mt.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||wF,u=u1(s),l=(s==null?void 0:s.prompt)||!1,d=(s==null?void 0:s.tag)||0,g=(s==null?void 0:s.id)||ic().toString(),y={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:d,id:g,attestation:s==null?void 0:s.attestation}},A=`Failed to publish payload, please try again. id:${g} tag:${d}`,P=Date.now();let N,D=1;try{for(;N===void 0;){if(Date.now()-P>this.publishTimeout)throw new Error(A);this.logger.trace({id:g,attempts:D},`publisher.publish - attempt ${D}`),N=await await Su(this.rpcPublish(n,i,a,u,l,d,g,s==null?void 0:s.attestation).catch(k=>this.logger.warn(k)),this.publishTimeout,A),D++,N||await new Promise(k=>setTimeout(k,this.failedPublishTimeout))}this.relayer.events.emit(ii.publish,y),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:g,topic:n,message:i,opts:s}})}catch(k){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(k),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw k;this.queue.set(g,y)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=ri(r,this.name),this.registerEventListeners()}get context(){return gi(this.logger)}rpcPublish(e,r,n,i,s,o,a,u){var l,d,g,y;const A={method:xl(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:u},id:a};return bi((l=A.params)==null?void 0:l.prompt)&&((d=A.params)==null||delete d.prompt),bi((g=A.params)==null?void 0:g.tag)&&((y=A.params)==null||delete y.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:A}),this.relayer.request(A)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(nu.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ii.connection_stalled);return}this.checkQueue()}),this.relayer.on(ii.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class yj{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var wj=Object.defineProperty,xj=Object.defineProperties,_j=Object.getOwnPropertyDescriptors,l6=Object.getOwnPropertySymbols,Ej=Object.prototype.hasOwnProperty,Sj=Object.prototype.propertyIsEnumerable,h6=(t,e,r)=>e in t?wj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Tl=(t,e)=>{for(var r in e||(e={}))Ej.call(e,r)&&h6(t,r,e[r]);if(l6)for(var r of l6(e))Sj.call(e,r)&&h6(t,r,e[r]);return t},w1=(t,e)=>xj(t,_j(e));class Aj extends kR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new yj,this.events=new qi.EventEmitter,this.name=IF,this.version=CF,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Hs,this.subscribeTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=u1(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new mt.Watch;a.start(i);const u=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(u),a.stop(i),s(!0)),a.elapsed(i)>=TF&&(clearInterval(u),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ri(r,this.name),this.clientId=""}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=u1(n);await this.rpcUnsubscribe(e,r,i);const s=Dr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===Wr.relay&&await this.restartToComplete();const s={method:xl(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=So(e+this.clientId);if((n==null?void 0:n.transportType)===Wr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},mt.toMiliseconds(mt.ONE_SECOND)),a;const u=await Su(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return u?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ii.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:xl(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Su(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:xl(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Su(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:xl(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,w1(Tl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Tl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Tl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Ws.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Ws.deleted,w1(Tl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Ws.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);nc(r)&&this.onBatchSubscribe(r.map((n,i)=>w1(Tl({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(nu.pulse,async()=>{await this.checkPending()}),this.events.on(Ws.created,async e=>{const r=Ws.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Ws.deleted,async e=>{const r=Ws.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var Pj=Object.defineProperty,d6=Object.getOwnPropertySymbols,Mj=Object.prototype.hasOwnProperty,Ij=Object.prototype.propertyIsEnumerable,p6=(t,e,r)=>e in t?Pj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,g6=(t,e)=>{for(var r in e||(e={}))Mj.call(e,r)&&p6(t,r,e[r]);if(d6)for(var r of d6(e))Ij.call(e,r)&&p6(t,r,e[r]);return t};class Cj extends NR{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new qi.EventEmitter,this.name=EF,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=mt.toMiliseconds(mt.THIRTY_SECONDS+mt.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||ic().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(u,l)=>{const d=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Xi.disconnect,d);const g=await o;this.provider.off(Xi.disconnect,d),u(g)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(Fd())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(ii.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ii.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Xi.payload,this.onPayloadHandler),this.provider.on(Xi.connect,this.onConnectHandler),this.provider.on(Xi.disconnect,this.onDisconnectHandler),this.provider.on(Xi.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ri(e.logger,this.name):Zf(sd({level:e.logger||_F})),this.messages=new vj(this.logger,e.core),this.subscriber=new Aj(this,this.logger),this.publisher=new bj(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||K_,this.projectId=e.projectId,this.bundleId=s$(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return gi(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Wr.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",u;const l=d=>{d.topic===e&&(this.subscriber.off(Ws.created,l),u())};return await Promise.all([new Promise(d=>{u=d,this.subscriber.on(Ws.created,l)}),new Promise(async(d,g)=>{a=await this.subscriber.subscribe(e,g6({internal:{throwOnFailedPublish:o}},r)).catch(y=>{o&&g(y)})||a,d()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Su(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Xi.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Xi.disconnect,i),await Su(this.provider.connect(),mt.toMiliseconds(mt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await M_())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=En(mt.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(ii.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(Fd())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Ji(new uF(u$({sdkVersion:m1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),g1(e)){if(!e.method.endsWith(SF))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:Wr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(g6({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else Gd(e)&&this.events.emit(ii.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ii.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Kd(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Xi.payload,this.onPayloadHandler),this.provider.off(Xi.connect,this.onConnectHandler),this.provider.off(Xi.disconnect,this.onDisconnectHandler),this.provider.off(Xi.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await M_();UB(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(ii.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},mt.toMiliseconds(AF))))}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var Tj=Object.defineProperty,m6=Object.getOwnPropertySymbols,Rj=Object.prototype.hasOwnProperty,Dj=Object.prototype.propertyIsEnumerable,v6=(t,e,r)=>e in t?Tj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b6=(t,e)=>{for(var r in e||(e={}))Rj.call(e,r)&&v6(t,r,e[r]);if(m6)for(var r of m6(e))Dj.call(e,r)&&v6(t,r,e[r]);return t};class cc extends LR{constructor(e,r,n,i=Hs,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=PF,this.cached=[],this.initialized=!1,this.storagePrefix=Hs,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!bi(o)?this.map.set(this.getKey(o),o):vB(o)?this.map.set(o.id,o):bB(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>lF(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const u=b6(b6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=ri(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Oj{constructor(e,r){this.core=e,this.logger=r,this.name=RF,this.version=DF,this.events=new Yg,this.initialized=!1,this.storagePrefix=Hs,this.ignoredPayloadTypes=[Eo],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=c1(),s=await this.core.crypto.setSymKey(i),o=En(mt.FIVE_MINUTES),a={protocol:W_},u={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=y_({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(sc.create,u),this.core.expirer.set(s,o),await this.pairings.set(s,u),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Ks.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:u,methods:l}=b_(n.uri);i.props.properties.topic=s,i.addTrace(Ks.pairing_uri_validation_success),i.addTrace(Ks.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(Ks.existing_pairing),d.active)throw i.setError(Mo.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Ks.pairing_not_expired)}const g=u||En(mt.FIVE_MINUTES),y={topic:s,relay:a,expiry:g,active:!1,methods:l};this.core.expirer.set(s,g),await this.pairings.set(s,y),i.addTrace(Ks.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(sc.create,y),i.addTrace(Ks.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Ks.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Mo.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(A){throw i.setError(Mo.subscribe_pairing_topic_failure),A}return i.addTrace(Ks.subscribe_pairing_topic_success),y},this.activate=async({topic:n})=>{this.isInitialized();const i=En(mt.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=ec();this.events.once(vr("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Dr("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,u=this.core.crypto.keychain.get(i);return y_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:u,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=ha(i,s),a=await this.core.crypto.encode(n,o),u=Pl[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{const o=Kd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Pl[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=Vd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Pl[u.request.method]?Pl[u.request.method].res:Pl.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Dr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>ua(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(sc.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{zs(i)?this.events.emit(vr("pairing_ping",s),{}):Yi(i)&&this.events.emit(vr("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(sc.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Dr("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Dr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!yi(n)){const{message:a}=ut("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Mo.malformed_pairing_uri),new Error(a)}if(!mB(n.uri)){const{message:a}=ut("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Mo.malformed_pairing_uri),new Error(a)}const o=b_(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Mo.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Mo.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&mt.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!an(n,!1)){const{message:i}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ua(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ut("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=ri(r,this.name),this.pairings=new cc(this.core,this.logger,this.name,this.storagePrefix)}get context(){return gi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ii.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===Wr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{g1(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):Gd(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Zi.expired,async e=>{const{topic:r}=J3(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(sc.expire,{topic:r}))})}}class Nj extends RR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new qi.EventEmitter,this.name=OF,this.version=NF,this.cached=[],this.initialized=!1,this.storagePrefix=Hs,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:En(mt.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(vs.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Yi(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(vs.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(vs.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:ha(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(vs.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(vs.created,e=>{const r=vs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(vs.updated,e=>{const r=vs.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(vs.deleted,e=>{const r=vs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(nu.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{mt.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(vs.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Lj extends $R{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new qi.EventEmitter,this.name=LF,this.version=kF,this.cached=[],this.initialized=!1,this.storagePrefix=Hs,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Zi.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Zi.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return f$(e);if(typeof e=="number")return l$(e);const{message:r}=ut("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Zi.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;mt.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Zi.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(nu.pulse,()=>this.checkExpirations()),this.events.on(Zi.created,e=>{const r=Zi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.expired,e=>{const r=Zi.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.deleted,e=>{const r=Zi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class kj extends BR{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=$F,this.verifyUrlV3=FF,this.storagePrefix=Hs,this.version=q_,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&mt.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!dl()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,u=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=rl(),d=this.startAbortTimer(mt.ONE_SECOND*5),g=await new Promise((y,A)=>{const P=()=>{window.removeEventListener("message",D),l.body.removeChild(N),A("attestation aborted")};this.abortController.signal.addEventListener("abort",P);const N=l.createElement("iframe");N.src=u,N.style.display="none",N.addEventListener("error",P,{signal:this.abortController.signal});const D=k=>{if(k.data&&typeof k.data=="string")try{const $=JSON.parse(k.data);if($.type==="verify_attestation"){if(gm($.attestation).payload.id!==o)return;clearInterval(d),l.body.removeChild(N),this.abortController.signal.removeEventListener("abort",P),window.removeEventListener("message",D),y($.attestation===null?"":$.attestation)}}catch($){this.logger.warn($)}};l.body.appendChild(N),window.addEventListener("message",D,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",g),g}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(gm(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const u=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,u)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(mt.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Ml;return UF.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Ml}`),s=Ml),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(mt.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=X$(i,s.publicKey),a={hasExpired:mt.toMiliseconds(o.exp)this.abortController.abort(),mt.toMiliseconds(e))}}class $j extends FR{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=jF,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${qF}/${this.projectId}/clients`;await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=ri(r,this.context)}}var Bj=Object.defineProperty,y6=Object.getOwnPropertySymbols,Fj=Object.prototype.hasOwnProperty,Uj=Object.prototype.propertyIsEnumerable,w6=(t,e,r)=>e in t?Bj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rl=(t,e)=>{for(var r in e||(e={}))Fj.call(e,r)&&w6(t,r,e[r]);if(y6)for(var r of y6(e))Uj.call(e,r)&&w6(t,r,e[r]);return t};class jj extends UR{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=HF,this.storagePrefix=Hs,this.storageVersion=zF,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!i1())try{const i={eventId:Z3(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:K3(this.core.relayer.protocol,this.core.relayer.version,m1)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:u}}=i,l=Z3(),d=this.core.projectId||"",g=Date.now(),y=Rl({eventId:l,timestamp:g,props:{event:s,type:o,properties:{topic:a,trace:u}},bundleId:d,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,y),this.shouldPersist=!0),y},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(u=>u.props.properties.topic===o);if(a)return Rl(Rl({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(nu.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{mt.fromMiliseconds(Date.now())-mt.fromMiliseconds(i.timestamp)>WF&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Rl(Rl({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${KF}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${m1}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>W3().url,this.logger=ri(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var qj=Object.defineProperty,x6=Object.getOwnPropertySymbols,zj=Object.prototype.hasOwnProperty,Hj=Object.prototype.propertyIsEnumerable,_6=(t,e,r)=>e in t?qj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,E6=(t,e)=>{for(var r in e||(e={}))zj.call(e,r)&&_6(t,r,e[r]);if(x6)for(var r of x6(e))Hj.call(e,r)&&_6(t,r,e[r]);return t};class x1 extends TR{constructor(e){var r;super(e),this.protocol=j_,this.version=q_,this.name=z_,this.events=new qi.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:u})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:Wr.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||K_,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=sd({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:hF.logger}),{logger:i,chunkLoggerController:s}=CR({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ri(i,this.name),this.heartbeat=new ET,this.crypto=new mj(this,this.logger,e==null?void 0:e.keychain),this.history=new Nj(this,this.logger),this.expirer=new Lj(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new tR(E6(E6({},dF),e==null?void 0:e.storageOptions)),this.relayer=new Cj({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Oj(this,this.logger),this.verify=new kj(this,this.logger,this.storage),this.echoClient=new $j(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new jj(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new x1(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(MF,n),r}get context(){return gi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(V_,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(V_)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const Wj=x1,S6="wc",A6=2,P6="client",_1=`${S6}@${A6}:${P6}:`,E1={name:P6,logger:"error"},M6="WALLETCONNECT_DEEPLINK_CHOICE",Kj="proposal",I6="Proposal expired",Vj="session",Pu=mt.SEVEN_DAYS,Gj="engine",kn={wc_sessionPropose:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:mt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:mt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1119}}},S1={min:mt.FIVE_MINUTES,max:mt.SEVEN_DAYS},Vs={idle:"IDLE",active:"ACTIVE"},Yj="request",Jj=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],Xj="wc",Zj="auth",Qj="authKeys",eq="pairingTopics",tq="requests",Xd=`${Xj}@${1.5}:${Zj}:`,Zd=`${Xd}:PUB_KEY`;var rq=Object.defineProperty,nq=Object.defineProperties,iq=Object.getOwnPropertyDescriptors,C6=Object.getOwnPropertySymbols,sq=Object.prototype.hasOwnProperty,oq=Object.prototype.propertyIsEnumerable,T6=(t,e,r)=>e in t?rq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))sq.call(e,r)&&T6(t,r,e[r]);if(C6)for(var r of C6(e))oq.call(e,r)&&T6(t,r,e[r]);return t},ys=(t,e)=>nq(t,iq(e));class aq extends qR{constructor(e){super(e),this.name=Gj,this.events=new Yg,this.initialized=!1,this.requestQueue={state:Vs.idle,queue:[]},this.sessionRequestQueue={state:Vs.idle,queue:[]},this.requestQueueDelay=mt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(kn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=ys(tn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n;let l=i,d,g=!1;try{l&&(g=this.client.core.pairing.pairings.get(l).active)}catch(U){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),U}if(!l||!g){const{topic:U,uri:K}=await this.client.core.pairing.create();l=U,d=K}if(!l){const{message:U}=ut("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(U)}const y=await this.client.core.crypto.generateKeyPair(),A=kn.wc_sessionPropose.req.ttl||mt.FIVE_MINUTES,P=En(A),N=tn({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:W_}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:P,pairingTopic:l},a&&{sessionProperties:a}),{reject:D,resolve:k,done:$}=ec(A,I6);this.events.once(vr("session_connect"),async({error:U,session:K})=>{if(U)D(U);else if(K){K.self.publicKey=y;const J=ys(tn({},K),{pairingTopic:N.pairingTopic,requiredNamespaces:N.requiredNamespaces,optionalNamespaces:N.optionalNamespaces,transportType:Wr.relay});await this.client.session.set(K.topic,J),await this.setExpiry(K.topic,K.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:K.peer.metadata}),this.cleanupDuplicatePairings(J),k(J)}});const q=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:N,throwOnFailedPublish:!0});return await this.setProposal(q,tn({id:q},N)),{uri:d,approval:$}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[bs.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(z){throw o.setError(oc.no_internet_connection),z}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(z){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(oc.proposal_not_found),z}try{await this.isValidApprove(r)}catch(z){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(oc.session_approve_namespace_validation_failure),z}const{id:a,relayProtocol:u,namespaces:l,sessionProperties:d,sessionConfig:g}=r,y=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:A,proposer:P,requiredNamespaces:N,optionalNamespaces:D}=y;let k=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:A});k||(k=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:bs.session_approve_started,properties:{topic:A,trace:[bs.session_approve_started,bs.session_namespaces_validation_success]}}));const $=await this.client.core.crypto.generateKeyPair(),q=P.publicKey,U=await this.client.core.crypto.generateSharedKey($,q),K=tn(tn({relay:{protocol:u??"irn"},namespaces:l,controller:{publicKey:$,metadata:this.client.metadata},expiry:En(Pu)},d&&{sessionProperties:d}),g&&{sessionConfig:g}),J=Wr.relay;k.addTrace(bs.subscribing_session_topic);try{await this.client.core.relayer.subscribe(U,{transportType:J})}catch(z){throw k.setError(oc.subscribe_session_topic_failure),z}k.addTrace(bs.subscribe_session_topic_success);const T=ys(tn({},K),{topic:U,requiredNamespaces:N,optionalNamespaces:D,pairingTopic:A,acknowledged:!1,self:K.controller,peer:{publicKey:P.publicKey,metadata:P.metadata},controller:$,transportType:Wr.relay});await this.client.session.set(U,T),k.addTrace(bs.store_session);try{k.addTrace(bs.publishing_session_settle),await this.sendRequest({topic:U,method:"wc_sessionSettle",params:K,throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(oc.session_settle_publish_failure),z}),k.addTrace(bs.session_settle_publish_success),k.addTrace(bs.publishing_session_approve),await this.sendResult({id:a,topic:A,result:{relay:{protocol:u??"irn"},responderPublicKey:$},throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(oc.session_approve_publish_failure),z}),k.addTrace(bs.session_approve_publish_success)}catch(z){throw this.client.logger.error(z),this.client.session.delete(U,Dr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(U),z}return this.client.core.eventClient.deleteEvent({eventId:k.eventId}),await this.client.core.pairing.updateMetadata({topic:A,metadata:P.metadata}),await this.client.proposal.delete(a,Dr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:A}),await this.setExpiry(U,En(Pu)),{topic:U,acknowledged:()=>Promise.resolve(this.client.session.get(U))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:kn.wc_sessionPropose.reject}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(g){throw this.client.logger.error("update() -> isValidUpdate() failed"),g}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=ec(),u=la(),l=ic().toString(),d=this.client.session.get(n).namespaces;return this.events.once(vr("session_update",u),({error:g})=>{g?a(g):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:u,relayRpcId:l}).catch(g=>{this.client.logger.error(g),this.client.session.update(n,{namespaces:d}),a(g)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(u){throw this.client.logger.error("extend() -> isValidExtend() failed"),u}const{topic:n}=r,i=la(),{done:s,resolve:o,reject:a}=ec();return this.events.once(vr("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,En(Pu)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(u=>{a(u)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(P){throw this.client.logger.error("request() -> isValidRequest() failed"),P}const{chainId:n,request:i,topic:s,expiry:o=kn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=la(),l=ic().toString(),{done:d,resolve:g,reject:y}=ec(o,"Request expired. Please try again.");this.events.once(vr("session_request",u),({error:P,result:N})=>{P?y(P):g(N)});const A=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return A?(await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ys(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:A}).catch(P=>y(P)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),await d()):await Promise.all([new Promise(async P=>{await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ys(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(N=>y(N)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),P()}),new Promise(async P=>{var N;if(!((N=a.sessionConfig)!=null&&N.disableDeepLink)){const D=await p$(this.client.core.storage,M6);await h$({id:u,topic:s,wcDeepLink:D})}P()}),d()]).then(P=>P[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);zs(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Yi(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=la(),s=ic().toString(),{done:o,resolve:a,reject:u}=ec();this.events.once(vr("session_ping",i),({error:l})=>{l?u(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=ic().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Dr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ut("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>pB(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?Wr.link_mode:Wr.relay;o===Wr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:u="",uri:l,domain:d,nonce:g,type:y,exp:A,nbf:P,methods:N=[],expiry:D}=r,k=[...r.resources||[]],{topic:$,uri:q}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:$,uri:q}});const U=await this.client.core.crypto.generateKeyPair(),K=zd(U);if(await Promise.all([this.client.auth.authKeys.set(Zd,{responseTopic:K,publicKey:U}),this.client.auth.pairingTopics.set(K,{topic:K,pairingTopic:$})]),await this.client.core.relayer.subscribe(K,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${$}`),N.length>0){const{namespace:_}=_u(a[0]);let S=L$(_,"request",N);qd(k)&&(S=$$(S,k.pop())),k.push(S)}const J=D&&D>kn.wc_sessionAuthenticate.req.ttl?D:kn.wc_sessionAuthenticate.req.ttl,T={authPayload:{type:y??"caip122",chains:a,statement:u,aud:l,domain:d,version:"1",nonce:g,iat:new Date().toISOString(),exp:A,nbf:P,resources:k},requester:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(J)},z={eip155:{chains:a,methods:[...new Set(["personal_sign",...N])],events:["chainChanged","accountsChanged"]}},ue={requiredNamespaces:{},optionalNamespaces:z,relays:[{protocol:"irn"}],pairingTopic:$,proposer:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(kn.wc_sessionPropose.req.ttl)},{done:_e,resolve:G,reject:E}=ec(J,"Request expired"),m=async({error:_,session:S})=>{if(this.events.off(vr("session_request",p),f),_)E(_);else if(S){S.self.publicKey=U,await this.client.session.set(S.topic,S),await this.setExpiry(S.topic,S.expiry),$&&await this.client.core.pairing.updateMetadata({topic:$,metadata:S.peer.metadata});const b=this.client.session.get(S.topic);await this.deleteProposal(v),G({session:b})}},f=async _=>{var S,b,M;if(await this.deletePendingAuthRequest(p,{message:"fulfilled",code:0}),_.error){const X=Dr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return _.error.code===X.code?void 0:(this.events.off(vr("session_connect"),m),E(_.error.message))}await this.deleteProposal(v),this.events.off(vr("session_connect"),m);const{cacaos:I,responder:F}=_.result,ae=[],O=[];for(const X of I){await r_({cacao:X,projectId:this.client.core.projectId})||(this.client.logger.error(X,"Signature verification failed"),E(Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Q}=X,R=qd(Q.resources),Z=[o1(Q.iss)],te=jd(Q.iss);if(R){const le=s_(R),ie=o_(R);ae.push(...le),Z.push(...ie)}for(const le of Z)O.push(`${le}:${te}`)}const se=await this.client.core.crypto.generateSharedKey(U,F.publicKey);let ee;ae.length>0&&(ee={topic:se,acknowledged:!0,self:{publicKey:U,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:En(Pu),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:$,namespaces:w_([...new Set(ae)],[...new Set(O)]),transportType:o},await this.client.core.relayer.subscribe(se,{transportType:o}),await this.client.session.set(se,ee),$&&await this.client.core.pairing.updateMetadata({topic:$,metadata:F.metadata}),ee=this.client.session.get(se)),(S=this.client.metadata.redirect)!=null&&S.linkMode&&(b=F.metadata.redirect)!=null&&b.linkMode&&(M=F.metadata.redirect)!=null&&M.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(se,{transportType:Wr.link_mode})),G({auths:I,session:ee})},p=la(),v=la();this.events.once(vr("session_connect"),m),this.events.once(vr("session_request",p),f);let x;try{if(s){const _=ha("wc_sessionAuthenticate",T,p);this.client.core.history.set($,_);const S=await this.client.core.crypto.encode("",_,{type:bl,encoding:ml});x=Hd(n,$,S)}else await Promise.all([this.sendRequest({topic:$,method:"wc_sessionAuthenticate",params:T,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:p}),this.sendRequest({topic:$,method:"wc_sessionPropose",params:ue,expiry:kn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:v})])}catch(_){throw this.events.off(vr("session_connect"),m),this.events.off(vr("session_request",p),f),_}return await this.setProposal(v,tn({id:v},ue)),await this.setAuthRequest(p,{request:ys(tn({},T),{verifyContext:{}}),pairingTopic:$,transportType:o}),{uri:x??q,response:_e}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[ac.authenticated_session_approve_started]}});try{this.isInitialized()}catch(D){throw s.setError(Il.no_internet_connection),D}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Il.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||Wr.relay;a===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=zd(u),g={type:Eo,receiverPublicKey:u,senderPublicKey:l},y=[],A=[];for(const D of i){if(!await r_({cacao:D,projectId:this.client.core.projectId})){s.setError(Il.invalid_cacao);const K=Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:K,encodeOpts:g}),new Error(K.message)}s.addTrace(ac.cacaos_verified);const{p:k}=D,$=qd(k.resources),q=[o1(k.iss)],U=jd(k.iss);if($){const K=s_($),J=o_($);y.push(...K),q.push(...J)}for(const K of q)A.push(`${K}:${U}`)}const P=await this.client.core.crypto.generateSharedKey(l,u);s.addTrace(ac.create_authenticated_session_topic);let N;if((y==null?void 0:y.length)>0){N={topic:P,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:u,metadata:o.requester.metadata},controller:u,expiry:En(Pu),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:w_([...new Set(y)],[...new Set(A)]),transportType:a},s.addTrace(ac.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(P,{transportType:a})}catch(D){throw s.setError(Il.subscribe_authenticated_session_topic_failure),D}s.addTrace(ac.subscribe_authenticated_session_topic_success),await this.client.session.set(P,N),s.addTrace(ac.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(ac.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:g,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(D){throw s.setError(Il.authenticated_session_approve_publish_failure),D}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:N}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),u=zd(o),l={type:Eo,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:u,error:i,encodeOpts:l,rpcOpts:kn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return n_(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:u}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Dr("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(M6).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,Dr("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Vs.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(oc.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Dr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Vs.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,En(kn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=Wr.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||En(kn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l,appLink:d}=r,g=ha(i,s,u);let y;const A=!!d;try{const D=A?ml:fa;y=await this.client.core.crypto.encode(n,g,{encoding:D})}catch(D){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),D}let P;if(Jj.includes(i)){const D=So(JSON.stringify(g)),k=So(y);P=await this.client.core.verify.register({id:k,decryptedId:D})}const N=kn[i].req;if(N.attestation=P,o&&(N.ttl=o),a&&(N.id=a),this.client.core.history.set(n,g),A){const D=Hd(d,n,y);await global.Linking.openURL(D,this.client.name)}else{const D=kn[i].req;o&&(D.ttl=o),a&&(D.id=a),l?(D.internal=ys(tn({},D.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,y,D)):this.client.core.relayer.publish(n,y,D).catch(k=>this.client.logger.error(k))}return g.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:u}=r,l=Kd(n,s);let d;const g=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=g?ml:fa;d=await this.client.core.crypto.encode(i,l,ys(tn({},a||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),A}if(g){const A=Hd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=kn[y.request.method].res;o?(A.internal=ys(tn({},A.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,A)):this.client.core.relayer.publish(i,d,A).catch(P=>this.client.logger.error(P))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:u}=r,l=Vd(n,s);let d;const g=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=g?ml:fa;d=await this.client.core.crypto.encode(i,l,ys(tn({},o||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),A}if(g){const A=Hd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=a||kn[y.request.method].res;this.client.core.relayer.publish(i,d,A)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;ua(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{ua(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Vs.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Vs.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Vs.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,u=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:u}))switch(u){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=ut("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:u}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(tn({},i.params));const d=a.expiryTimestamp||En(kn.wc_sessionPropose.req.ttl),g=tn({id:u,pairingTopic:n,expiryTimestamp:d},a);await this.setProposal(u,g);const y=await this.getVerifyContext({attestationId:s,hash:So(JSON.stringify(i)),encryptedId:o,metadata:g.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(Mo.proposal_listener_not_found)),l==null||l.addTrace(Ks.emit_session_proposal),this.client.events.emit("session_proposal",{id:u,params:g,verifyContext:y})}catch(l){await this.sendError({id:u,topic:n,error:l,rpcOpts:kn.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(zs(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const u=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const d=await this.client.core.crypto.generateSharedKey(u,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:d});const g=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:g}),await this.client.core.pairing.activate({topic:r})}else if(Yi(n)){await this.client.proposal.delete(s,Dr("USER_DISCONNECTED"));const o=vr("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(vr("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:u,namespaces:l,sessionProperties:d,sessionConfig:g}=n.params,y=ys(tn(tn({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},d&&{sessionProperties:d}),g&&{sessionConfig:g}),{transportType:Wr.relay}),A=vr("session_connect");if(this.events.listenerCount(A)===0)throw new Error(`emitting ${A} without any listeners 997`);this.events.emit(vr("session_connect"),{session:y}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;zs(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(vr("session_approve",i),{})):Yi(n)&&(await this.client.session.delete(r,Dr("USER_DISCONNECTED")),this.events.emit(vr("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Sl.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Dr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(tn({topic:r},i));try{Sl.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(u){throw Sl.delete(o),u}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=vr("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);zs(n)?this.events.emit(vr("session_update",i),{}):Yi(n)&&this.events.emit(vr("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,En(Pu)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=vr("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);zs(n)?this.events.emit(vr("session_extend",i),{}):Yi(n)&&this.events.emit(vr("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=vr("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{zs(n)?this.events.emit(vr("session_ping",i),{}):Yi(n)&&this.events.emit(vr("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(ii.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Dr("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:u,encryptedId:l,transportType:d}=r,{id:g,params:y}=a;try{await this.isValidRequest(tn({topic:o},y));const A=this.client.session.get(o),P=await this.getVerifyContext({attestationId:u,hash:So(JSON.stringify(ha("wc_sessionRequest",y,g))),encryptedId:l,metadata:A.peer.metadata,transportType:d}),N={id:g,topic:o,params:y,verifyContext:P};await this.setPendingSessionRequest(N),d===Wr.link_mode&&(n=A.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=A.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(N):(this.addSessionRequestToSessionRequestQueue(N),this.processSessionRequestQueue())}catch(A){await this.sendError({id:g,topic:o,error:A}),this.client.logger.error(A)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=vr("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);zs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Sl.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(tn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Sl.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),zs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:u}=r;try{const{requester:l,authPayload:d,expiryTimestamp:g}=s.params,y=await this.getVerifyContext({attestationId:o,hash:So(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:u}),A={requester:l,pairingTopic:i,id:s.id,authPayload:d,verifyContext:y,expiryTimestamp:g};await this.setAuthRequest(s.id,{request:A,pairingTopic:i,transportType:u}),u===Wr.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:y})}catch(l){this.client.logger.error(l);const d=s.params.requester.publicKey,g=await this.client.core.crypto.generateKeyPair(),y=this.getAppLinkIfEnabled(s.params.requester.metadata,u),A={type:Eo,receiverPublicKey:d,senderPublicKey:g};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:A,rpcOpts:kn.wc_sessionAuthenticate.autoReject,appLink:y})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Vs.idle,this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=vr("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(vr("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Vs.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Vs.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:ha("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(bi(n)||await this.isValidPairingTopic(n),!PB(a)){const{message:u}=ut("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!bi(i)&&El(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!bi(s)&&El(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),bi(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=AB(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!yi(r))throw new Error(ut("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),u=h1(i,"approve()");if(u)throw new Error(u.message);const l=A_(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!an(s,!0)){const{message:d}=ut("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}bi(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!yi(r)){const{message:s}=ut("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!IB(i)){const{message:s}=ut("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!yi(r)){const{message:l}=ut("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!E_(n)){const{message:l}=ut("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=yB(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const u=h1(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(ua(o)){const{message:l}=ut("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=h1(i,"update()");if(o)throw new Error(o.message);const a=A_(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!S_(a,s)){const{message:u}=ut("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!CB(i)){const{message:u}=ut("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!DB(a,s,i.method)){const{message:u}=ut("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!kB(o,S1)){const{message:u}=ut("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${S1.min} and ${S1.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!yi(r)){const{message:o}=ut("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!TB(s)){const{message:o}=ut("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!yi(r)){const{message:a}=ut("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!S_(o,s)){const{message:a}=ut("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!RB(i)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!OB(o,s,i.name)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!an(i,!1))throw new Error("uri is required parameter");if(!an(s,!1))throw new Error("domain is required parameter");if(!an(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(u=>_u(u).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=_u(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,u={verified:{verifyUrl:o.verifyUrl||Ml,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Wr.link_mode){const d=this.getAppLinkIfEnabled(o,a);return u.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",u}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(u.verified.origin=l.origin,u.verified.isScam=l.isScam,u.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(u)}`),u},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!an(i,!1)){const{message:s}=ut("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,u,l,d,g,y;return!r||n!==Wr.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(u=this.client.metadata)==null?void 0:u.redirect)==null?void 0:l.universal)!==""&&((d=r==null?void 0:r.redirect)==null?void 0:d.universal)!==void 0&&((g=r==null?void 0:r.redirect)==null?void 0:g.universal)!==""&&((y=r==null?void 0:r.redirect)==null?void 0:y.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=X3(r,"topic")||"",i=decodeURIComponent(X3(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:Wr.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(i1()||Eu()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ii.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(Zd)?this.client.auth.authKeys.get(Zd):{publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===Wr.link_mode?ml:fa});try{g1(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:So(n)})):Gd(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(u){this.client.logger.error(u)}}registerExpirerEvents(){this.client.core.expirer.on(Zi.expired,async e=>{const{topic:r,id:n}=J3(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ut("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,ut("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(sc.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(sc.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(ua(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=ut("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(ua(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=ut("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=ut("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(an(e,!1)){const{message:r}=ut("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=ut("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!MB(e)){const{message:r}=ut("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(ua(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=ut("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class cq extends cc{constructor(e,r){super(e,r,Kj,_1),this.core=e,this.logger=r}}let uq=class extends cc{constructor(e,r){super(e,r,Vj,_1),this.core=e,this.logger=r}};class fq extends cc{constructor(e,r){super(e,r,Yj,_1,n=>n.id),this.core=e,this.logger=r}}class lq extends cc{constructor(e,r){super(e,r,Qj,Xd,()=>Zd),this.core=e,this.logger=r}}class hq extends cc{constructor(e,r){super(e,r,eq,Xd),this.core=e,this.logger=r}}class dq extends cc{constructor(e,r){super(e,r,tq,Xd,n=>n.id),this.core=e,this.logger=r}}class pq{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new lq(this.core,this.logger),this.pairingTopics=new hq(this.core,this.logger),this.requests=new dq(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class A1 extends jR{constructor(e){super(e),this.protocol=S6,this.version=A6,this.name=E1.name,this.events=new qi.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||E1.name,this.metadata=(e==null?void 0:e.metadata)||W3(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Zf(sd({level:(e==null?void 0:e.logger)||E1.logger}));this.core=(e==null?void 0:e.core)||new Wj(e),this.logger=ri(r,this.name),this.session=new uq(this.core,this.logger),this.proposal=new cq(this.core,this.logger),this.pendingRequest=new fq(this.core,this.logger),this.engine=new aq(this),this.auth=new pq(this.core,this.logger)}static async init(e){const r=new A1(e);return await r.initialize(),r}get context(){return gi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var Qd={exports:{}};/** + Approved: ${y.toString()}`))}),o.forEach(g=>{n||(rc(i[g].methods,s[g].methods)?rc(i[g].events,s[g].events)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${g}`)):n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${g}`))}),n}function H$(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function I_(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function W$(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Pu(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function K$(t,e){return l1(t)&&t<=e.max&&t>=e.min}function C_(){const t=gl();return new Promise(e=>{switch(t){case Ri.browser:e(V$());break;case Ri.reactNative:e(G$());break;case Ri.node:e(Y$());break;default:e(!0)}})}function V$(){return pl()&&(navigator==null?void 0:navigator.onLine)}async function G$(){if(Su()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function Y$(){return!0}function J$(t){switch(gl()){case Ri.browser:X$(t);break;case Ri.reactNative:Z$(t);break}}function X$(t){!Su()&&pl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function Z$(t){Su()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const d1={};class Al{static get(e){return d1[e]}static set(e,r){d1[e]=r}static delete(e){delete d1[e]}}const Q$="PARSE_ERROR",eF="INVALID_REQUEST",tF="METHOD_NOT_FOUND",rF="INVALID_PARAMS",T_="INTERNAL_ERROR",p1="SERVER_ERROR",nF=[-32700,-32600,-32601,-32602,-32603],Pl={[Q$]:{code:-32700,message:"Parse error"},[eF]:{code:-32600,message:"Invalid Request"},[tF]:{code:-32601,message:"Method not found"},[rF]:{code:-32602,message:"Invalid params"},[T_]:{code:-32603,message:"Internal error"},[p1]:{code:-32e3,message:"Server error"}},R_=p1;function iF(t){return nF.includes(t)}function D_(t){return Object.keys(Pl).includes(t)?Pl[t]:Pl[R_]}function sF(t){const e=Object.values(Pl).find(r=>r.code===t);return e||Pl[R_]}function O_(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var N_={},Io={},L_;function oF(){if(L_)return Io;L_=1,Object.defineProperty(Io,"__esModule",{value:!0}),Io.isBrowserCryptoAvailable=Io.getSubtleCrypto=Io.getBrowerCrypto=void 0;function t(){return(nn==null?void 0:nn.crypto)||(nn==null?void 0:nn.msCrypto)||{}}Io.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Io.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Io.isBrowserCryptoAvailable=r,Io}var Co={},k_;function aF(){if(k_)return Co;k_=1,Object.defineProperty(Co,"__esModule",{value:!0}),Co.isBrowser=Co.isNode=Co.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Co.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Co.isNode=e;function r(){return!t()&&!e()}return Co.isBrowser=r,Co}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(oF(),t),e.__exportStar(aF(),t)})(N_);function pa(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function ac(t=6){return BigInt(pa(t))}function ga(t,e,r){return{id:r||pa(),jsonrpc:"2.0",method:t,params:e}}function Vd(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Gd(t,e,r){return{id:t,jsonrpc:"2.0",error:cF(e)}}function cF(t,e){return typeof t>"u"?D_(T_):(typeof t=="string"&&(t=Object.assign(Object.assign({},D_(p1)),{message:t})),iF(t.code)&&(t=sF(t.code)),t)}let uF=class{},fF=class extends uF{constructor(){super()}},lF=class extends fF{constructor(e){super()}};const hF="^https?:",dF="^wss?:";function pF(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function B_(t,e){const r=pF(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function $_(t){return B_(t,hF)}function F_(t){return B_(t,dF)}function gF(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function j_(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function g1(t){return j_(t)&&"method"in t}function Yd(t){return j_(t)&&(Hs(t)||Ji(t))}function Hs(t){return"result"in t}function Ji(t){return"error"in t}let Xi=class extends lF{constructor(e){super(e),this.events=new zi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(ga(e.method,e.params||[],e.id||ac().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Ji(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Yd(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const mF=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),vF=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",U_=t=>t.split("?")[0],q_=10,bF=mF();let yF=class{constructor(e){if(this.url=e,this.events=new zi.EventEmitter,this.registering=!1,!F_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(bo(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!F_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=N_.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!gF(e)},o=new bF(e,[],s);vF()?o.onerror=a=>{const u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ga(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return O_(e,U_(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>q_&&this.events.setMaxListeners(q_)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${U_(this.url)}`));return this.events.emit("register_error",r),r}};var Jd={exports:{}};Jd.exports,function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",u="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",g="[object Date]",y="[object Error]",A="[object Function]",P="[object GeneratorFunction]",O="[object Map]",D="[object Number]",k="[object Null]",B="[object Object]",j="[object Promise]",U="[object Proxy]",K="[object RegExp]",J="[object Set]",T="[object String]",z="[object Symbol]",ue="[object Undefined]",_e="[object WeakMap]",G="[object ArrayBuffer]",E="[object DataView]",m="[object Float32Array]",f="[object Float64Array]",p="[object Int8Array]",v="[object Int16Array]",x="[object Int32Array]",_="[object Uint8Array]",S="[object Uint8ClampedArray]",b="[object Uint16Array]",M="[object Uint32Array]",I=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,N={};N[m]=N[f]=N[p]=N[v]=N[x]=N[_]=N[S]=N[b]=N[M]=!0,N[a]=N[u]=N[G]=N[d]=N[E]=N[g]=N[y]=N[A]=N[O]=N[D]=N[B]=N[K]=N[J]=N[T]=N[_e]=!1;var se=typeof nn=="object"&&nn&&nn.Object===Object&&nn,ee=typeof self=="object"&&self&&self.Object===Object&&self,X=se||ee||Function("return this")(),Q=e&&!e.nodeType&&e,R=Q&&!0&&t&&!t.nodeType&&t,Z=R&&R.exports===Q,te=Z&&se.process,he=function(){try{return te&&te.binding&&te.binding("util")}catch{}}(),ie=he&&he.isTypedArray;function fe(ce,ye){for(var Ye=-1,It=ce==null?0:ce.length,jr=0,ir=[];++Ye-1}function st(ce,ye){var Ye=this.__data__,It=Xe(Ye,ce);return It<0?(++this.size,Ye.push([ce,ye])):Ye[It][1]=ye,this}Re.prototype.clear=De,Re.prototype.delete=it,Re.prototype.get=Ue,Re.prototype.has=gt,Re.prototype.set=st;function tt(ce){var ye=-1,Ye=ce==null?0:ce.length;for(this.clear();++yewn))return!1;var Ur=ir.get(ce);if(Ur&&ir.get(ye))return Ur==ye;var gn=-1,_i=!0,xn=Ye&s?new _t:void 0;for(ir.set(ce,ye),ir.set(ye,ce);++gn-1&&ce%1==0&&ce-1&&ce%1==0&&ce<=o}function up(ce){var ye=typeof ce;return ce!=null&&(ye=="object"||ye=="function")}function Pc(ce){return ce!=null&&typeof ce=="object"}var fp=ie?Te(ie):dr;function zb(ce){return Ub(ce)?qe(ce):pr(ce)}function Fr(){return[]}function kr(){return!1}t.exports=qb}(Jd,Jd.exports);var wF=Jd.exports;const xF=Ui(wF),z_="wc",H_=2,W_="core",Ws=`${z_}@2:${W_}:`,_F={logger:"error"},EF={database:":memory:"},SF="crypto",K_="client_ed25519_seed",AF=mt.ONE_DAY,PF="keychain",MF="0.3",IF="messages",CF="0.3",TF=mt.SIX_HOURS,RF="publisher",V_="irn",DF="error",G_="wss://relay.walletconnect.org",OF="relayer",ii={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},NF="_subscription",Zi={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},LF=.1,m1="2.17.2",Wr={link_mode:"link_mode",relay:"relay"},kF="0.3",BF="WALLETCONNECT_CLIENT_ID",Y_="WALLETCONNECT_LINK_MODE_APPS",Ks={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},$F="subscription",FF="0.3",jF=mt.FIVE_SECONDS*1e3,UF="pairing",qF="0.3",Ml={wc_pairingDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:0},res:{ttl:mt.ONE_DAY,prompt:!1,tag:0}}},cc={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},bs={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},zF="history",HF="0.3",WF="expirer",Qi={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},KF="0.3",VF="verify-api",GF="https://verify.walletconnect.com",J_="https://verify.walletconnect.org",Il=J_,YF=`${Il}/v3`,JF=[GF,J_],XF="echo",ZF="https://echo.walletconnect.com",Vs={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},To={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},ys={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},uc={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},fc={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Cl={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},QF=.1,ej="event-client",tj=86400,rj="https://pulse.walletconnect.org/batch";function nj(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(j);k!==B;){for(var K=P[k],J=0,T=j-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=j-D;z!==j&&U[z]===0;)z++;for(var ue=u.repeat(O);z>>0,j=new Uint8Array(B);P[O];){var U=r[P.charCodeAt(O)];if(U===255)return;for(var K=0,J=B-1;(U!==0||K>>0,j[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,O++}if(P[O]!==" "){for(var T=B-k;T!==B&&j[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=j[T++];return z}}}function A(P){var O=y(P);if(O)return O;throw new Error(`Non-${e} character`)}return{encode:g,decodeUnsafe:y,decode:A}}var ij=nj,sj=ij;const X_=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},oj=t=>new TextEncoder().encode(t),aj=t=>new TextDecoder().decode(t);class cj{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class uj{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Z_(this,e)}}class fj{constructor(e){this.decoders=e}or(e){return Z_(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Z_=(t,e)=>new fj({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class lj{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new cj(e,r,n),this.decoder=new uj(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Xd=({name:t,prefix:e,encode:r,decode:n})=>new lj(t,e,r,n),Tl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=sj(r,e);return Xd({prefix:t,name:e,encode:n,decode:s=>X_(i(s))})},hj=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},dj=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Xd({prefix:e,name:t,encode(i){return dj(i,n,r)},decode(i){return hj(i,n,r,t)}}),pj=Xd({prefix:"\0",name:"identity",encode:t=>aj(t),decode:t=>oj(t)});var gj=Object.freeze({__proto__:null,identity:pj});const mj=zn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var vj=Object.freeze({__proto__:null,base2:mj});const bj=zn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var yj=Object.freeze({__proto__:null,base8:bj});const wj=Tl({prefix:"9",name:"base10",alphabet:"0123456789"});var xj=Object.freeze({__proto__:null,base10:wj});const _j=zn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ej=zn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Sj=Object.freeze({__proto__:null,base16:_j,base16upper:Ej});const Aj=zn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Pj=zn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Mj=zn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ij=zn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Cj=zn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Tj=zn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Rj=zn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Dj=zn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Oj=zn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Nj=Object.freeze({__proto__:null,base32:Aj,base32upper:Pj,base32pad:Mj,base32padupper:Ij,base32hex:Cj,base32hexupper:Tj,base32hexpad:Rj,base32hexpadupper:Dj,base32z:Oj});const Lj=Tl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),kj=Tl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Bj=Object.freeze({__proto__:null,base36:Lj,base36upper:kj});const $j=Tl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Fj=Tl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var jj=Object.freeze({__proto__:null,base58btc:$j,base58flickr:Fj});const Uj=zn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),qj=zn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),zj=zn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Hj=zn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Wj=Object.freeze({__proto__:null,base64:Uj,base64pad:qj,base64url:zj,base64urlpad:Hj});const Q_=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Kj=Q_.reduce((t,e,r)=>(t[r]=e,t),[]),Vj=Q_.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Gj(t){return t.reduce((e,r)=>(e+=Kj[r],e),"")}function Yj(t){const e=[];for(const r of t){const n=Vj[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const Jj=Xd({prefix:"🚀",name:"base256emoji",encode:Gj,decode:Yj});var Xj=Object.freeze({__proto__:null,base256emoji:Jj}),Zj=t6,e6=128,Qj=127,eU=~Qj,tU=Math.pow(2,31);function t6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=tU;)e[r++]=t&255|e6,t/=128;for(;t&eU;)e[r++]=t&255|e6,t>>>=7;return e[r]=t|0,t6.bytes=r-n+1,e}var rU=v1,nU=128,r6=127;function v1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw v1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&r6)<=nU);return v1.bytes=s-n,r}var iU=Math.pow(2,7),sU=Math.pow(2,14),oU=Math.pow(2,21),aU=Math.pow(2,28),cU=Math.pow(2,35),uU=Math.pow(2,42),fU=Math.pow(2,49),lU=Math.pow(2,56),hU=Math.pow(2,63),dU=function(t){return t(n6.encode(t,e,r),e),s6=t=>n6.encodingLength(t),b1=(t,e)=>{const r=e.byteLength,n=s6(t),i=n+s6(r),s=new Uint8Array(i+r);return i6(t,s,0),i6(r,s,n),s.set(e,i),new gU(t,r,e,s)};class gU{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const o6=({name:t,code:e,encode:r})=>new mU(t,e,r);class mU{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?b1(this.code,r):r.then(n=>b1(this.code,n))}else throw Error("Unknown type, must be binary type")}}const a6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),vU=o6({name:"sha2-256",code:18,encode:a6("SHA-256")}),bU=o6({name:"sha2-512",code:19,encode:a6("SHA-512")});var yU=Object.freeze({__proto__:null,sha256:vU,sha512:bU});const c6=0,wU="identity",u6=X_;var xU=Object.freeze({__proto__:null,identity:{code:c6,name:wU,encode:u6,digest:t=>b1(c6,u6(t))}});new TextEncoder,new TextDecoder;const f6={...gj,...vj,...yj,...xj,...Sj,...Nj,...Bj,...jj,...Wj,...Xj};({...yU,...xU});function _U(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function l6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const h6=l6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),y1=l6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=_U(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=ut("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Y3(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?J3(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}},PU=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=SF,this.randomSessionIdentifier=c1(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=_x(i);return xx(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=XB();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=_x(s),a=this.randomSessionIdentifier;return await NO(a,i,AF,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),u=ZB(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||Hd(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=p_(o),u=bo(s);if(m_(a))return e$(u,o==null?void 0:o.encoding);if(g_(a)){const y=a.senderPublicKey,A=a.receiverPublicKey;i=await this.generateSharedKey(y,A)}const l=this.getSymKey(i),{type:d,senderPublicKey:g}=a;return QB({type:d,symKey:l,message:u,senderPublicKey:g,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=n$(s,o);if(m_(a)){const u=r$(s,o==null?void 0:o.encoding);return Ga(u)}if(g_(a)){const u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{const u=this.getSymKey(i),l=t$({symKey:u,encoded:s,encoding:o==null?void 0:o.encoding});return Ga(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=(i,s=da)=>{const o=xl({encoded:i,encoding:s});return sc(o.type)},this.getPayloadSenderPublicKey=(i,s=da)=>{const o=xl({encoded:i,encoding:s});return o.senderPublicKey?Tn(o.senderPublicKey,ni):void 0},this.core=e,this.logger=ri(r,this.name),this.keychain=n||new AU(this.core,this.logger)}get context(){return gi(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(K_)}catch{e=c1(),await this.keychain.set(K_,e)}return SU(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}};class MU extends qR{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=IF,this.version=CF,this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Mo(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Mo(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=ri(e,this.name),this.core=r}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Y3(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?J3(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class IU extends zR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new zi.EventEmitter,this.name=RF,this.queue=new Map,this.publishTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.failedPublishTimeout=mt.toMiliseconds(mt.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||TF,u=u1(s),l=(s==null?void 0:s.prompt)||!1,d=(s==null?void 0:s.tag)||0,g=(s==null?void 0:s.id)||ac().toString(),y={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:d,id:g,attestation:s==null?void 0:s.attestation}},A=`Failed to publish payload, please try again. id:${g} tag:${d}`,P=Date.now();let O,D=1;try{for(;O===void 0;){if(Date.now()-P>this.publishTimeout)throw new Error(A);this.logger.trace({id:g,attempts:D},`publisher.publish - attempt ${D}`),O=await await Au(this.rpcPublish(n,i,a,u,l,d,g,s==null?void 0:s.attestation).catch(k=>this.logger.warn(k)),this.publishTimeout,A),D++,O||await new Promise(k=>setTimeout(k,this.failedPublishTimeout))}this.relayer.events.emit(ii.publish,y),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:g,topic:n,message:i,opts:s}})}catch(k){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(k),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw k;this.queue.set(g,y)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=ri(r,this.name),this.registerEventListeners()}get context(){return gi(this.logger)}rpcPublish(e,r,n,i,s,o,a,u){var l,d,g,y;const A={method:_l(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:u},id:a};return bi((l=A.params)==null?void 0:l.prompt)&&((d=A.params)==null||delete d.prompt),bi((g=A.params)==null?void 0:g.tag)&&((y=A.params)==null||delete y.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:A}),this.relayer.request(A)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(iu.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ii.connection_stalled);return}this.checkQueue()}),this.relayer.on(ii.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class CU{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var TU=Object.defineProperty,RU=Object.defineProperties,DU=Object.getOwnPropertyDescriptors,d6=Object.getOwnPropertySymbols,OU=Object.prototype.hasOwnProperty,NU=Object.prototype.propertyIsEnumerable,p6=(t,e,r)=>e in t?TU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rl=(t,e)=>{for(var r in e||(e={}))OU.call(e,r)&&p6(t,r,e[r]);if(d6)for(var r of d6(e))NU.call(e,r)&&p6(t,r,e[r]);return t},w1=(t,e)=>RU(t,DU(e));class LU extends KR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new CU,this.events=new zi.EventEmitter,this.name=$F,this.version=FF,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Ws,this.subscribeTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=u1(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new mt.Watch;a.start(i);const u=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(u),a.stop(i),s(!0)),a.elapsed(i)>=jF&&(clearInterval(u),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ri(r,this.name),this.clientId=""}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=u1(n);await this.rpcUnsubscribe(e,r,i);const s=Dr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===Wr.relay&&await this.restartToComplete();const s={method:_l(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=Mo(e+this.clientId);if((n==null?void 0:n.transportType)===Wr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},mt.toMiliseconds(mt.ONE_SECOND)),a;const u=await Au(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return u?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ii.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Au(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Au(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:_l(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,w1(Rl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Rl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Rl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Ks.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Ks.deleted,w1(Rl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Ks.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);oc(r)&&this.onBatchSubscribe(r.map((n,i)=>w1(Rl({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(iu.pulse,async()=>{await this.checkPending()}),this.events.on(Ks.created,async e=>{const r=Ks.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Ks.deleted,async e=>{const r=Ks.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var kU=Object.defineProperty,g6=Object.getOwnPropertySymbols,BU=Object.prototype.hasOwnProperty,$U=Object.prototype.propertyIsEnumerable,m6=(t,e,r)=>e in t?kU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v6=(t,e)=>{for(var r in e||(e={}))BU.call(e,r)&&m6(t,r,e[r]);if(g6)for(var r of g6(e))$U.call(e,r)&&m6(t,r,e[r]);return t};class FU extends HR{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new zi.EventEmitter,this.name=OF,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=mt.toMiliseconds(mt.THIRTY_SECONDS+mt.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||ac().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(u,l)=>{const d=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Zi.disconnect,d);const g=await o;this.provider.off(Zi.disconnect,d),u(g)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(jd())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(ii.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ii.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Zi.payload,this.onPayloadHandler),this.provider.on(Zi.connect,this.onConnectHandler),this.provider.on(Zi.disconnect,this.onDisconnectHandler),this.provider.on(Zi.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ri(e.logger,this.name):Qf(od({level:e.logger||DF})),this.messages=new MU(this.logger,e.core),this.subscriber=new LU(this,this.logger),this.publisher=new IU(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||G_,this.projectId=e.projectId,this.bundleId=gB(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return gi(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Wr.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",u;const l=d=>{d.topic===e&&(this.subscriber.off(Ks.created,l),u())};return await Promise.all([new Promise(d=>{u=d,this.subscriber.on(Ks.created,l)}),new Promise(async(d,g)=>{a=await this.subscriber.subscribe(e,v6({internal:{throwOnFailedPublish:o}},r)).catch(y=>{o&&g(y)})||a,d()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Au(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Zi.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Zi.disconnect,i),await Au(this.provider.connect(),mt.toMiliseconds(mt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await C_())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=En(mt.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(ii.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(jd())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Xi(new yF(yB({sdkVersion:m1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),g1(e)){if(!e.method.endsWith(NF))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:Wr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(v6({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else Yd(e)&&this.events.emit(ii.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ii.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Vd(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Zi.payload,this.onPayloadHandler),this.provider.off(Zi.connect,this.onConnectHandler),this.provider.off(Zi.disconnect,this.onDisconnectHandler),this.provider.off(Zi.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await C_();J$(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(ii.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},mt.toMiliseconds(LF))))}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var jU=Object.defineProperty,b6=Object.getOwnPropertySymbols,UU=Object.prototype.hasOwnProperty,qU=Object.prototype.propertyIsEnumerable,y6=(t,e,r)=>e in t?jU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,w6=(t,e)=>{for(var r in e||(e={}))UU.call(e,r)&&y6(t,r,e[r]);if(b6)for(var r of b6(e))qU.call(e,r)&&y6(t,r,e[r]);return t};class lc extends WR{constructor(e,r,n,i=Ws,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=kF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!bi(o)?this.map.set(this.getKey(o),o):M$(o)?this.map.set(o.id,o):I$(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>xF(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const u=w6(w6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=ri(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class zU{constructor(e,r){this.core=e,this.logger=r,this.name=UF,this.version=qF,this.events=new Yg,this.initialized=!1,this.storagePrefix=Ws,this.ignoredPayloadTypes=[Po],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=c1(),s=await this.core.crypto.setSymKey(i),o=En(mt.FIVE_MINUTES),a={protocol:V_},u={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=x_({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(cc.create,u),this.core.expirer.set(s,o),await this.pairings.set(s,u),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Vs.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:u,methods:l}=w_(n.uri);i.props.properties.topic=s,i.addTrace(Vs.pairing_uri_validation_success),i.addTrace(Vs.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(Vs.existing_pairing),d.active)throw i.setError(To.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Vs.pairing_not_expired)}const g=u||En(mt.FIVE_MINUTES),y={topic:s,relay:a,expiry:g,active:!1,methods:l};this.core.expirer.set(s,g),await this.pairings.set(s,y),i.addTrace(Vs.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(cc.create,y),i.addTrace(Vs.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Vs.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(To.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(A){throw i.setError(To.subscribe_pairing_topic_failure),A}return i.addTrace(Vs.subscribe_pairing_topic_success),y},this.activate=async({topic:n})=>{this.isInitialized();const i=En(mt.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=nc();this.events.once(vr("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Dr("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,u=this.core.crypto.keychain.get(i);return x_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:u,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=ga(i,s),a=await this.core.crypto.encode(n,o),u=Ml[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{const o=Vd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=Gd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method]?Ml[u.request.method].res:Ml.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Dr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>ha(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(cc.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{Hs(i)?this.events.emit(vr("pairing_ping",s),{}):Ji(i)&&this.events.emit(vr("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(cc.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Dr("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Dr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!yi(n)){const{message:a}=ut("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(To.malformed_pairing_uri),new Error(a)}if(!P$(n.uri)){const{message:a}=ut("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(To.malformed_pairing_uri),new Error(a)}const o=w_(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(To.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(To.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&mt.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!an(n,!1)){const{message:i}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ha(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ut("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=ri(r,this.name),this.pairings=new lc(this.core,this.logger,this.name,this.storagePrefix)}get context(){return gi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ii.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===Wr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{g1(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):Yd(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Qi.expired,async e=>{const{topic:r}=Z3(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(cc.expire,{topic:r}))})}}class HU extends UR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new zi.EventEmitter,this.name=zF,this.version=HF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:En(mt.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(bs.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Ji(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(bs.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(bs.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:ga(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(bs.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(bs.created,e=>{const r=bs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.updated,e=>{const r=bs.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.deleted,e=>{const r=bs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(iu.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{mt.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(bs.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class WU extends VR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new zi.EventEmitter,this.name=WF,this.version=KF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Qi.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Qi.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return wB(e);if(typeof e=="number")return xB(e);const{message:r}=ut("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Qi.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;mt.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Qi.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(iu.pulse,()=>this.checkExpirations()),this.events.on(Qi.created,e=>{const r=Qi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Qi.expired,e=>{const r=Qi.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Qi.deleted,e=>{const r=Qi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class KU extends GR{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=VF,this.verifyUrlV3=YF,this.storagePrefix=Ws,this.version=H_,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&mt.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!pl()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,u=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=nl(),d=this.startAbortTimer(mt.ONE_SECOND*5),g=await new Promise((y,A)=>{const P=()=>{window.removeEventListener("message",D),l.body.removeChild(O),A("attestation aborted")};this.abortController.signal.addEventListener("abort",P);const O=l.createElement("iframe");O.src=u,O.style.display="none",O.addEventListener("error",P,{signal:this.abortController.signal});const D=k=>{if(k.data&&typeof k.data=="string")try{const B=JSON.parse(k.data);if(B.type==="verify_attestation"){if(gm(B.attestation).payload.id!==o)return;clearInterval(d),l.body.removeChild(O),this.abortController.signal.removeEventListener("abort",P),window.removeEventListener("message",D),y(B.attestation===null?"":B.attestation)}}catch(B){this.logger.warn(B)}};l.body.appendChild(O),window.addEventListener("message",D,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",g),g}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(gm(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const u=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,u)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(mt.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Il;return JF.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Il}`),s=Il),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(mt.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=a$(i,s.publicKey),a={hasExpired:mt.toMiliseconds(o.exp)this.abortController.abort(),mt.toMiliseconds(e))}}class VU extends YR{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=XF,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${ZF}/${this.projectId}/clients`;await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=ri(r,this.context)}}var GU=Object.defineProperty,x6=Object.getOwnPropertySymbols,YU=Object.prototype.hasOwnProperty,JU=Object.prototype.propertyIsEnumerable,_6=(t,e,r)=>e in t?GU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dl=(t,e)=>{for(var r in e||(e={}))YU.call(e,r)&&_6(t,r,e[r]);if(x6)for(var r of x6(e))JU.call(e,r)&&_6(t,r,e[r]);return t};class XU extends JR{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=ej,this.storagePrefix=Ws,this.storageVersion=QF,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!i1())try{const i={eventId:e_(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:G3(this.core.relayer.protocol,this.core.relayer.version,m1)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:u}}=i,l=e_(),d=this.core.projectId||"",g=Date.now(),y=Dl({eventId:l,timestamp:g,props:{event:s,type:o,properties:{topic:a,trace:u}},bundleId:d,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,y),this.shouldPersist=!0),y},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(u=>u.props.properties.topic===o);if(a)return Dl(Dl({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(iu.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{mt.fromMiliseconds(Date.now())-mt.fromMiliseconds(i.timestamp)>tj&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Dl(Dl({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${rj}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${m1}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>V3().url,this.logger=ri(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var ZU=Object.defineProperty,E6=Object.getOwnPropertySymbols,QU=Object.prototype.hasOwnProperty,eq=Object.prototype.propertyIsEnumerable,S6=(t,e,r)=>e in t?ZU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A6=(t,e)=>{for(var r in e||(e={}))QU.call(e,r)&&S6(t,r,e[r]);if(E6)for(var r of E6(e))eq.call(e,r)&&S6(t,r,e[r]);return t};class x1 extends jR{constructor(e){var r;super(e),this.protocol=z_,this.version=H_,this.name=W_,this.events=new zi.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:u})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:Wr.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||G_,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=od({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:_F.logger}),{logger:i,chunkLoggerController:s}=FR({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ri(i,this.name),this.heartbeat=new OT,this.crypto=new PU(this,this.logger,e==null?void 0:e.keychain),this.history=new HU(this,this.logger),this.expirer=new WU(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new lR(A6(A6({},EF),e==null?void 0:e.storageOptions)),this.relayer=new FU({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new zU(this,this.logger),this.verify=new KU(this,this.logger,this.storage),this.echoClient=new VU(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new XU(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new x1(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(BF,n),r}get context(){return gi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(Y_,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(Y_)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const tq=x1,P6="wc",M6=2,I6="client",_1=`${P6}@${M6}:${I6}:`,E1={name:I6,logger:"error"},C6="WALLETCONNECT_DEEPLINK_CHOICE",rq="proposal",T6="Proposal expired",nq="session",Mu=mt.SEVEN_DAYS,iq="engine",kn={wc_sessionPropose:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:mt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:mt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1119}}},S1={min:mt.FIVE_MINUTES,max:mt.SEVEN_DAYS},Gs={idle:"IDLE",active:"ACTIVE"},sq="request",oq=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],aq="wc",cq="auth",uq="authKeys",fq="pairingTopics",lq="requests",Zd=`${aq}@${1.5}:${cq}:`,Qd=`${Zd}:PUB_KEY`;var hq=Object.defineProperty,dq=Object.defineProperties,pq=Object.getOwnPropertyDescriptors,R6=Object.getOwnPropertySymbols,gq=Object.prototype.hasOwnProperty,mq=Object.prototype.propertyIsEnumerable,D6=(t,e,r)=>e in t?hq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))gq.call(e,r)&&D6(t,r,e[r]);if(R6)for(var r of R6(e))mq.call(e,r)&&D6(t,r,e[r]);return t},ws=(t,e)=>dq(t,pq(e));class vq extends ZR{constructor(e){super(e),this.name=iq,this.events=new Yg,this.initialized=!1,this.requestQueue={state:Gs.idle,queue:[]},this.sessionRequestQueue={state:Gs.idle,queue:[]},this.requestQueueDelay=mt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(kn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=ws(tn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n;let l=i,d,g=!1;try{l&&(g=this.client.core.pairing.pairings.get(l).active)}catch(U){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),U}if(!l||!g){const{topic:U,uri:K}=await this.client.core.pairing.create();l=U,d=K}if(!l){const{message:U}=ut("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(U)}const y=await this.client.core.crypto.generateKeyPair(),A=kn.wc_sessionPropose.req.ttl||mt.FIVE_MINUTES,P=En(A),O=tn({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:V_}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:P,pairingTopic:l},a&&{sessionProperties:a}),{reject:D,resolve:k,done:B}=nc(A,T6);this.events.once(vr("session_connect"),async({error:U,session:K})=>{if(U)D(U);else if(K){K.self.publicKey=y;const J=ws(tn({},K),{pairingTopic:O.pairingTopic,requiredNamespaces:O.requiredNamespaces,optionalNamespaces:O.optionalNamespaces,transportType:Wr.relay});await this.client.session.set(K.topic,J),await this.setExpiry(K.topic,K.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:K.peer.metadata}),this.cleanupDuplicatePairings(J),k(J)}});const j=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:O,throwOnFailedPublish:!0});return await this.setProposal(j,tn({id:j},O)),{uri:d,approval:B}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[ys.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(z){throw o.setError(uc.no_internet_connection),z}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(z){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(uc.proposal_not_found),z}try{await this.isValidApprove(r)}catch(z){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(uc.session_approve_namespace_validation_failure),z}const{id:a,relayProtocol:u,namespaces:l,sessionProperties:d,sessionConfig:g}=r,y=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:A,proposer:P,requiredNamespaces:O,optionalNamespaces:D}=y;let k=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:A});k||(k=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:ys.session_approve_started,properties:{topic:A,trace:[ys.session_approve_started,ys.session_namespaces_validation_success]}}));const B=await this.client.core.crypto.generateKeyPair(),j=P.publicKey,U=await this.client.core.crypto.generateSharedKey(B,j),K=tn(tn({relay:{protocol:u??"irn"},namespaces:l,controller:{publicKey:B,metadata:this.client.metadata},expiry:En(Mu)},d&&{sessionProperties:d}),g&&{sessionConfig:g}),J=Wr.relay;k.addTrace(ys.subscribing_session_topic);try{await this.client.core.relayer.subscribe(U,{transportType:J})}catch(z){throw k.setError(uc.subscribe_session_topic_failure),z}k.addTrace(ys.subscribe_session_topic_success);const T=ws(tn({},K),{topic:U,requiredNamespaces:O,optionalNamespaces:D,pairingTopic:A,acknowledged:!1,self:K.controller,peer:{publicKey:P.publicKey,metadata:P.metadata},controller:B,transportType:Wr.relay});await this.client.session.set(U,T),k.addTrace(ys.store_session);try{k.addTrace(ys.publishing_session_settle),await this.sendRequest({topic:U,method:"wc_sessionSettle",params:K,throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(uc.session_settle_publish_failure),z}),k.addTrace(ys.session_settle_publish_success),k.addTrace(ys.publishing_session_approve),await this.sendResult({id:a,topic:A,result:{relay:{protocol:u??"irn"},responderPublicKey:B},throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(uc.session_approve_publish_failure),z}),k.addTrace(ys.session_approve_publish_success)}catch(z){throw this.client.logger.error(z),this.client.session.delete(U,Dr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(U),z}return this.client.core.eventClient.deleteEvent({eventId:k.eventId}),await this.client.core.pairing.updateMetadata({topic:A,metadata:P.metadata}),await this.client.proposal.delete(a,Dr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:A}),await this.setExpiry(U,En(Mu)),{topic:U,acknowledged:()=>Promise.resolve(this.client.session.get(U))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:kn.wc_sessionPropose.reject}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(g){throw this.client.logger.error("update() -> isValidUpdate() failed"),g}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=nc(),u=pa(),l=ac().toString(),d=this.client.session.get(n).namespaces;return this.events.once(vr("session_update",u),({error:g})=>{g?a(g):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:u,relayRpcId:l}).catch(g=>{this.client.logger.error(g),this.client.session.update(n,{namespaces:d}),a(g)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(u){throw this.client.logger.error("extend() -> isValidExtend() failed"),u}const{topic:n}=r,i=pa(),{done:s,resolve:o,reject:a}=nc();return this.events.once(vr("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,En(Mu)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(u=>{a(u)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(P){throw this.client.logger.error("request() -> isValidRequest() failed"),P}const{chainId:n,request:i,topic:s,expiry:o=kn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=pa(),l=ac().toString(),{done:d,resolve:g,reject:y}=nc(o,"Request expired. Please try again.");this.events.once(vr("session_request",u),({error:P,result:O})=>{P?y(P):g(O)});const A=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return A?(await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:A}).catch(P=>y(P)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),await d()):await Promise.all([new Promise(async P=>{await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(O=>y(O)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),P()}),new Promise(async P=>{var O;if(!((O=a.sessionConfig)!=null&&O.disableDeepLink)){const D=await SB(this.client.core.storage,C6);await _B({id:u,topic:s,wcDeepLink:D})}P()}),d()]).then(P=>P[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);Hs(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Ji(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=pa(),s=ac().toString(),{done:o,resolve:a,reject:u}=nc();this.events.once(vr("session_ping",i),({error:l})=>{l?u(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=ac().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Dr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ut("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>S$(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?Wr.link_mode:Wr.relay;o===Wr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:u="",uri:l,domain:d,nonce:g,type:y,exp:A,nbf:P,methods:O=[],expiry:D}=r,k=[...r.resources||[]],{topic:B,uri:j}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:B,uri:j}});const U=await this.client.core.crypto.generateKeyPair(),K=Hd(U);if(await Promise.all([this.client.auth.authKeys.set(Qd,{responseTopic:K,publicKey:U}),this.client.auth.pairingTopics.set(K,{topic:K,pairingTopic:B})]),await this.client.core.relayer.subscribe(K,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${B}`),O.length>0){const{namespace:_}=Eu(a[0]);let S=WB(_,"request",O);zd(k)&&(S=VB(S,k.pop())),k.push(S)}const J=D&&D>kn.wc_sessionAuthenticate.req.ttl?D:kn.wc_sessionAuthenticate.req.ttl,T={authPayload:{type:y??"caip122",chains:a,statement:u,aud:l,domain:d,version:"1",nonce:g,iat:new Date().toISOString(),exp:A,nbf:P,resources:k},requester:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(J)},z={eip155:{chains:a,methods:[...new Set(["personal_sign",...O])],events:["chainChanged","accountsChanged"]}},ue={requiredNamespaces:{},optionalNamespaces:z,relays:[{protocol:"irn"}],pairingTopic:B,proposer:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(kn.wc_sessionPropose.req.ttl)},{done:_e,resolve:G,reject:E}=nc(J,"Request expired"),m=async({error:_,session:S})=>{if(this.events.off(vr("session_request",p),f),_)E(_);else if(S){S.self.publicKey=U,await this.client.session.set(S.topic,S),await this.setExpiry(S.topic,S.expiry),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:S.peer.metadata});const b=this.client.session.get(S.topic);await this.deleteProposal(v),G({session:b})}},f=async _=>{var S,b,M;if(await this.deletePendingAuthRequest(p,{message:"fulfilled",code:0}),_.error){const X=Dr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return _.error.code===X.code?void 0:(this.events.off(vr("session_connect"),m),E(_.error.message))}await this.deleteProposal(v),this.events.off(vr("session_connect"),m);const{cacaos:I,responder:F}=_.result,ae=[],N=[];for(const X of I){await i_({cacao:X,projectId:this.client.core.projectId})||(this.client.logger.error(X,"Signature verification failed"),E(Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Q}=X,R=zd(Q.resources),Z=[o1(Q.iss)],te=qd(Q.iss);if(R){const he=a_(R),ie=c_(R);ae.push(...he),Z.push(...ie)}for(const he of Z)N.push(`${he}:${te}`)}const se=await this.client.core.crypto.generateSharedKey(U,F.publicKey);let ee;ae.length>0&&(ee={topic:se,acknowledged:!0,self:{publicKey:U,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:En(Mu),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:B,namespaces:__([...new Set(ae)],[...new Set(N)]),transportType:o},await this.client.core.relayer.subscribe(se,{transportType:o}),await this.client.session.set(se,ee),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:F.metadata}),ee=this.client.session.get(se)),(S=this.client.metadata.redirect)!=null&&S.linkMode&&(b=F.metadata.redirect)!=null&&b.linkMode&&(M=F.metadata.redirect)!=null&&M.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(se,{transportType:Wr.link_mode})),G({auths:I,session:ee})},p=pa(),v=pa();this.events.once(vr("session_connect"),m),this.events.once(vr("session_request",p),f);let x;try{if(s){const _=ga("wc_sessionAuthenticate",T,p);this.client.core.history.set(B,_);const S=await this.client.core.crypto.encode("",_,{type:yl,encoding:vl});x=Wd(n,B,S)}else await Promise.all([this.sendRequest({topic:B,method:"wc_sessionAuthenticate",params:T,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:p}),this.sendRequest({topic:B,method:"wc_sessionPropose",params:ue,expiry:kn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:v})])}catch(_){throw this.events.off(vr("session_connect"),m),this.events.off(vr("session_request",p),f),_}return await this.setProposal(v,tn({id:v},ue)),await this.setAuthRequest(p,{request:ws(tn({},T),{verifyContext:{}}),pairingTopic:B,transportType:o}),{uri:x??j,response:_e}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[fc.authenticated_session_approve_started]}});try{this.isInitialized()}catch(D){throw s.setError(Cl.no_internet_connection),D}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Cl.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||Wr.relay;a===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=Hd(u),g={type:Po,receiverPublicKey:u,senderPublicKey:l},y=[],A=[];for(const D of i){if(!await i_({cacao:D,projectId:this.client.core.projectId})){s.setError(Cl.invalid_cacao);const K=Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:K,encodeOpts:g}),new Error(K.message)}s.addTrace(fc.cacaos_verified);const{p:k}=D,B=zd(k.resources),j=[o1(k.iss)],U=qd(k.iss);if(B){const K=a_(B),J=c_(B);y.push(...K),j.push(...J)}for(const K of j)A.push(`${K}:${U}`)}const P=await this.client.core.crypto.generateSharedKey(l,u);s.addTrace(fc.create_authenticated_session_topic);let O;if((y==null?void 0:y.length)>0){O={topic:P,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:u,metadata:o.requester.metadata},controller:u,expiry:En(Mu),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:__([...new Set(y)],[...new Set(A)]),transportType:a},s.addTrace(fc.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(P,{transportType:a})}catch(D){throw s.setError(Cl.subscribe_authenticated_session_topic_failure),D}s.addTrace(fc.subscribe_authenticated_session_topic_success),await this.client.session.set(P,O),s.addTrace(fc.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(fc.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:g,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(D){throw s.setError(Cl.authenticated_session_approve_publish_failure),D}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:O}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),u=Hd(o),l={type:Po,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:u,error:i,encodeOpts:l,rpcOpts:kn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return s_(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:u}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Dr("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(C6).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,Dr("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Gs.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(uc.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Dr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Gs.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,En(kn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=Wr.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||En(kn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l,appLink:d}=r,g=ga(i,s,u);let y;const A=!!d;try{const D=A?vl:da;y=await this.client.core.crypto.encode(n,g,{encoding:D})}catch(D){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),D}let P;if(oq.includes(i)){const D=Mo(JSON.stringify(g)),k=Mo(y);P=await this.client.core.verify.register({id:k,decryptedId:D})}const O=kn[i].req;if(O.attestation=P,o&&(O.ttl=o),a&&(O.id=a),this.client.core.history.set(n,g),A){const D=Wd(d,n,y);await global.Linking.openURL(D,this.client.name)}else{const D=kn[i].req;o&&(D.ttl=o),a&&(D.id=a),l?(D.internal=ws(tn({},D.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,y,D)):this.client.core.relayer.publish(n,y,D).catch(k=>this.client.logger.error(k))}return g.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:u}=r,l=Vd(n,s);let d;const g=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=g?vl:da;d=await this.client.core.crypto.encode(i,l,ws(tn({},a||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),A}if(g){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=kn[y.request.method].res;o?(A.internal=ws(tn({},A.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,A)):this.client.core.relayer.publish(i,d,A).catch(P=>this.client.logger.error(P))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:u}=r,l=Gd(n,s);let d;const g=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=g?vl:da;d=await this.client.core.crypto.encode(i,l,ws(tn({},o||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),A}if(g){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=a||kn[y.request.method].res;this.client.core.relayer.publish(i,d,A)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;ha(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{ha(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Gs.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Gs.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Gs.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,u=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:u}))switch(u){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=ut("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:u}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(tn({},i.params));const d=a.expiryTimestamp||En(kn.wc_sessionPropose.req.ttl),g=tn({id:u,pairingTopic:n,expiryTimestamp:d},a);await this.setProposal(u,g);const y=await this.getVerifyContext({attestationId:s,hash:Mo(JSON.stringify(i)),encryptedId:o,metadata:g.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(To.proposal_listener_not_found)),l==null||l.addTrace(Vs.emit_session_proposal),this.client.events.emit("session_proposal",{id:u,params:g,verifyContext:y})}catch(l){await this.sendError({id:u,topic:n,error:l,rpcOpts:kn.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(Hs(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const u=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const d=await this.client.core.crypto.generateSharedKey(u,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:d});const g=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:g}),await this.client.core.pairing.activate({topic:r})}else if(Ji(n)){await this.client.proposal.delete(s,Dr("USER_DISCONNECTED"));const o=vr("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(vr("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:u,namespaces:l,sessionProperties:d,sessionConfig:g}=n.params,y=ws(tn(tn({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},d&&{sessionProperties:d}),g&&{sessionConfig:g}),{transportType:Wr.relay}),A=vr("session_connect");if(this.events.listenerCount(A)===0)throw new Error(`emitting ${A} without any listeners 997`);this.events.emit(vr("session_connect"),{session:y}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;Hs(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(vr("session_approve",i),{})):Ji(n)&&(await this.client.session.delete(r,Dr("USER_DISCONNECTED")),this.events.emit(vr("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Dr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(tn({topic:r},i));try{Al.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(u){throw Al.delete(o),u}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=vr("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_update",i),{}):Ji(n)&&this.events.emit(vr("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,En(Mu)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=vr("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_extend",i),{}):Ji(n)&&this.events.emit(vr("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=vr("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{Hs(n)?this.events.emit(vr("session_ping",i),{}):Ji(n)&&this.events.emit(vr("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(ii.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Dr("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:u,encryptedId:l,transportType:d}=r,{id:g,params:y}=a;try{await this.isValidRequest(tn({topic:o},y));const A=this.client.session.get(o),P=await this.getVerifyContext({attestationId:u,hash:Mo(JSON.stringify(ga("wc_sessionRequest",y,g))),encryptedId:l,metadata:A.peer.metadata,transportType:d}),O={id:g,topic:o,params:y,verifyContext:P};await this.setPendingSessionRequest(O),d===Wr.link_mode&&(n=A.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=A.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(O):(this.addSessionRequestToSessionRequestQueue(O),this.processSessionRequestQueue())}catch(A){await this.sendError({id:g,topic:o,error:A}),this.client.logger.error(A)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=vr("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Ji(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(tn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Al.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Ji(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:u}=r;try{const{requester:l,authPayload:d,expiryTimestamp:g}=s.params,y=await this.getVerifyContext({attestationId:o,hash:Mo(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:u}),A={requester:l,pairingTopic:i,id:s.id,authPayload:d,verifyContext:y,expiryTimestamp:g};await this.setAuthRequest(s.id,{request:A,pairingTopic:i,transportType:u}),u===Wr.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:y})}catch(l){this.client.logger.error(l);const d=s.params.requester.publicKey,g=await this.client.core.crypto.generateKeyPair(),y=this.getAppLinkIfEnabled(s.params.requester.metadata,u),A={type:Po,receiverPublicKey:d,senderPublicKey:g};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:A,rpcOpts:kn.wc_sessionAuthenticate.autoReject,appLink:y})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Gs.idle,this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=vr("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(vr("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Gs.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Gs.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:ga("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(bi(n)||await this.isValidPairingTopic(n),!k$(a)){const{message:u}=ut("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!bi(i)&&Sl(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!bi(s)&&Sl(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),bi(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=L$(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!yi(r))throw new Error(ut("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),u=h1(i,"approve()");if(u)throw new Error(u.message);const l=M_(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!an(s,!0)){const{message:d}=ut("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}bi(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!yi(r)){const{message:s}=ut("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!$$(i)){const{message:s}=ut("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!yi(r)){const{message:l}=ut("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!A_(n)){const{message:l}=ut("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=C$(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const u=h1(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(ha(o)){const{message:l}=ut("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=h1(i,"update()");if(o)throw new Error(o.message);const a=M_(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!P_(a,s)){const{message:u}=ut("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!F$(i)){const{message:u}=ut("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!q$(a,s,i.method)){const{message:u}=ut("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!K$(o,S1)){const{message:u}=ut("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${S1.min} and ${S1.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!yi(r)){const{message:o}=ut("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!j$(s)){const{message:o}=ut("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!yi(r)){const{message:a}=ut("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!P_(o,s)){const{message:a}=ut("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!U$(i)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!z$(o,s,i.name)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!an(i,!1))throw new Error("uri is required parameter");if(!an(s,!1))throw new Error("domain is required parameter");if(!an(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(u=>Eu(u).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Eu(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,u={verified:{verifyUrl:o.verifyUrl||Il,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Wr.link_mode){const d=this.getAppLinkIfEnabled(o,a);return u.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",u}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(u.verified.origin=l.origin,u.verified.isScam=l.isScam,u.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(u)}`),u},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!an(i,!1)){const{message:s}=ut("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,u,l,d,g,y;return!r||n!==Wr.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(u=this.client.metadata)==null?void 0:u.redirect)==null?void 0:l.universal)!==""&&((d=r==null?void 0:r.redirect)==null?void 0:d.universal)!==void 0&&((g=r==null?void 0:r.redirect)==null?void 0:g.universal)!==""&&((y=r==null?void 0:r.redirect)==null?void 0:y.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=Q3(r,"topic")||"",i=decodeURIComponent(Q3(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:Wr.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(i1()||Su()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ii.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(Qd)?this.client.auth.authKeys.get(Qd):{publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===Wr.link_mode?vl:da});try{g1(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:Mo(n)})):Yd(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(u){this.client.logger.error(u)}}registerExpirerEvents(){this.client.core.expirer.on(Qi.expired,async e=>{const{topic:r,id:n}=Z3(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ut("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,ut("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(cc.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(cc.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(ha(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=ut("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(ha(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=ut("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=ut("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(an(e,!1)){const{message:r}=ut("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=ut("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!B$(e)){const{message:r}=ut("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(ha(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=ut("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class bq extends lc{constructor(e,r){super(e,r,rq,_1),this.core=e,this.logger=r}}let yq=class extends lc{constructor(e,r){super(e,r,nq,_1),this.core=e,this.logger=r}};class wq extends lc{constructor(e,r){super(e,r,sq,_1,n=>n.id),this.core=e,this.logger=r}}class xq extends lc{constructor(e,r){super(e,r,uq,Zd,()=>Qd),this.core=e,this.logger=r}}class _q extends lc{constructor(e,r){super(e,r,fq,Zd),this.core=e,this.logger=r}}class Eq extends lc{constructor(e,r){super(e,r,lq,Zd,n=>n.id),this.core=e,this.logger=r}}class Sq{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new xq(this.core,this.logger),this.pairingTopics=new _q(this.core,this.logger),this.requests=new Eq(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class A1 extends XR{constructor(e){super(e),this.protocol=P6,this.version=M6,this.name=E1.name,this.events=new zi.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||E1.name,this.metadata=(e==null?void 0:e.metadata)||V3(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||E1.logger}));this.core=(e==null?void 0:e.core)||new tq(e),this.logger=ri(r,this.name),this.session=new yq(this.core,this.logger),this.proposal=new bq(this.core,this.logger),this.pendingRequest=new wq(this.core,this.logger),this.engine=new vq(this),this.auth=new Sq(this.core,this.logger)}static async init(e){const r=new A1(e);return await r.initialize(),r}get context(){return gi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var e0={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */Qd.exports,function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",l=500,d="__lodash_placeholder__",g=1,y=2,A=4,P=1,N=2,D=1,k=2,$=4,q=8,U=16,K=32,J=64,T=128,z=256,ue=512,_e=30,G="...",E=800,m=16,f=1,p=2,v=3,x=1/0,_=9007199254740991,S=17976931348623157e292,b=NaN,M=4294967295,I=M-1,F=M>>>1,ae=[["ary",T],["bind",D],["bindKey",k],["curry",q],["curryRight",U],["flip",ue],["partial",K],["partialRight",J],["rearg",z]],O="[object Arguments]",se="[object Array]",ee="[object AsyncFunction]",X="[object Boolean]",Q="[object Date]",R="[object DOMException]",Z="[object Error]",te="[object Function]",le="[object GeneratorFunction]",ie="[object Map]",fe="[object Number]",ve="[object Null]",Me="[object Object]",Ne="[object Promise]",Te="[object Proxy]",Be="[object RegExp]",Ie="[object Set]",Le="[object String]",Ve="[object Symbol]",ke="[object Undefined]",ze="[object WeakMap]",He="[object WeakSet]",Ee="[object ArrayBuffer]",Qe="[object DataView]",ct="[object Float32Array]",$e="[object Float64Array]",et="[object Int8Array]",rt="[object Int16Array]",Je="[object Int32Array]",pt="[object Uint8Array]",ht="[object Uint8ClampedArray]",ft="[object Uint16Array]",Ht="[object Uint32Array]",Jt=/\b__p \+= '';/g,St=/\b(__p \+=) '' \+/g,er=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Xt=/&(?:amp|lt|gt|quot|#39);/g,Ot=/[&<>"']/g,$t=RegExp(Xt.source),Tt=RegExp(Ot.source),vt=/<%-([\s\S]+?)%>/g,Dt=/<%([\s\S]+?)%>/g,Lt=/<%=([\s\S]+?)%>/g,bt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Bt=/^\w*$/,Ut=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(nt.source),B=/^\s+/,H=/\s/,V=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C=/\{\n\/\* \[wrapped with (.+)\] \*/,Y=/,? & /,j=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,oe=/[()=,{}\[\]\/\s]/,pe=/\\(\\)?/g,xe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Re=/\w*$/,De=/^[-+]0x[0-9a-f]+$/i,it=/^0b[01]+$/i,je=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,st=/^(?:0|[1-9]\d*)$/,tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,Rt=/['\n\r\u2028\u2029\\]/g,Mt="\\ud800-\\udfff",Et="\\u0300-\\u036f",dt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",ot=Et+dt+_t,wt="\\u2700-\\u27bf",lt="a-z\\xdf-\\xf6\\xf8-\\xff",at="\\xac\\xb1\\xd7\\xf7",Se="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ae="\\u2000-\\u206f",Ge=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ue="A-Z\\xc0-\\xd6\\xd8-\\xde",qe="\\ufe0e\\ufe0f",Xe=at+Se+Ae+Ge,kt="['’]",Wt="["+Mt+"]",Zt="["+Xe+"]",Kt="["+ot+"]",de="\\d+",nr="["+wt+"]",dr="["+lt+"]",pr="[^"+Mt+Xe+de+wt+lt+Ue+"]",Qt="\\ud83c[\\udffb-\\udfff]",gr="(?:"+Kt+"|"+Qt+")",lr="[^"+Mt+"]",Lr="(?:\\ud83c[\\udde6-\\uddff]){2}",mr="[\\ud800-\\udbff][\\udc00-\\udfff]",wr="["+Ue+"]",$r="\\u200d",Br="(?:"+dr+"|"+pr+")",Ir="(?:"+wr+"|"+pr+")",hn="(?:"+kt+"(?:d|ll|m|re|s|t|ve))?",dn="(?:"+kt+"(?:D|LL|M|RE|S|T|VE))?",pn=gr+"?",sp="["+qe+"]?",Bb="(?:"+$r+"(?:"+[lr,Lr,mr].join("|")+")"+sp+pn+")*",Fo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",op="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ap=sp+pn+Bb,Zu="(?:"+[nr,Lr,mr].join("|")+")"+ap,Fb="(?:"+[lr+Kt+"?",Kt,Lr,mr,Wt].join("|")+")",ph=RegExp(kt,"g"),Ub=RegExp(Kt,"g"),Qu=RegExp(Qt+"(?="+Qt+")|"+Fb+ap,"g"),cp=RegExp([wr+"?"+dr+"+"+hn+"(?="+[Zt,wr,"$"].join("|")+")",Ir+"+"+dn+"(?="+[Zt,wr+Br,"$"].join("|")+")",wr+"?"+Br+"+"+hn,wr+"+"+dn,op,Fo,de,Zu].join("|"),"g"),up=RegExp("["+$r+Mt+ot+qe+"]"),Ac=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],jb=-1,Fr={};Fr[ct]=Fr[$e]=Fr[et]=Fr[rt]=Fr[Je]=Fr[pt]=Fr[ht]=Fr[ft]=Fr[Ht]=!0,Fr[O]=Fr[se]=Fr[Ee]=Fr[X]=Fr[Qe]=Fr[Q]=Fr[Z]=Fr[te]=Fr[ie]=Fr[fe]=Fr[Me]=Fr[Be]=Fr[Ie]=Fr[Le]=Fr[ze]=!1;var kr={};kr[O]=kr[se]=kr[Ee]=kr[Qe]=kr[X]=kr[Q]=kr[ct]=kr[$e]=kr[et]=kr[rt]=kr[Je]=kr[ie]=kr[fe]=kr[Me]=kr[Be]=kr[Ie]=kr[Le]=kr[Ve]=kr[pt]=kr[ht]=kr[ft]=kr[Ht]=!0,kr[Z]=kr[te]=kr[ze]=!1;var ce={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ye={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye={"&":"&","<":"<",">":">",""":'"',"'":"'"},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ur=parseFloat,ir=parseInt,Yr=typeof nn=="object"&&nn&&nn.Object===Object&&nn,wn=typeof self=="object"&&self&&self.Object===Object&&self,_r=Yr||wn||Function("return this")(),jr=e&&!e.nodeType&&e,gn=jr&&!0&&t&&!t.nodeType&&t,_i=gn&&gn.exports===jr,xn=_i&&Yr.process,Jr=function(){try{var be=gn&&gn.require&&gn.require("util").types;return be||xn&&xn.binding&&xn.binding("util")}catch{}}(),oi=Jr&&Jr.isArrayBuffer,As=Jr&&Jr.isDate,ns=Jr&&Jr.isMap,to=Jr&&Jr.isRegExp,gh=Jr&&Jr.isSet,Pc=Jr&&Jr.isTypedArray;function $n(be,Fe,Ce){switch(Ce.length){case 0:return be.call(Fe);case 1:return be.call(Fe,Ce[0]);case 2:return be.call(Fe,Ce[0],Ce[1]);case 3:return be.call(Fe,Ce[0],Ce[1],Ce[2])}return be.apply(Fe,Ce)}function PQ(be,Fe,Ce,Ct){for(var tr=-1,Mr=be==null?0:be.length;++tr-1}function qb(be,Fe,Ce){for(var Ct=-1,tr=be==null?0:be.length;++Ct-1;);return Ce}function W7(be,Fe){for(var Ce=be.length;Ce--&&ef(Fe,be[Ce],0)>-1;);return Ce}function LQ(be,Fe){for(var Ce=be.length,Ct=0;Ce--;)be[Ce]===Fe&&++Ct;return Ct}var kQ=Kb(ce),$Q=Kb(ye);function BQ(be){return"\\"+It[be]}function FQ(be,Fe){return be==null?r:be[Fe]}function tf(be){return up.test(be)}function UQ(be){return Ac.test(be)}function jQ(be){for(var Fe,Ce=[];!(Fe=be.next()).done;)Ce.push(Fe.value);return Ce}function Jb(be){var Fe=-1,Ce=Array(be.size);return be.forEach(function(Ct,tr){Ce[++Fe]=[tr,Ct]}),Ce}function K7(be,Fe){return function(Ce){return be(Fe(Ce))}}function Ca(be,Fe){for(var Ce=-1,Ct=be.length,tr=0,Mr=[];++Ce-1}function Iee(c,h){var w=this.__data__,L=Ip(w,c);return L<0?(++this.size,w.push([c,h])):w[L][1]=h,this}Uo.prototype.clear=See,Uo.prototype.delete=Aee,Uo.prototype.get=Pee,Uo.prototype.has=Mee,Uo.prototype.set=Iee;function jo(c){var h=-1,w=c==null?0:c.length;for(this.clear();++h=h?c:h)),c}function as(c,h,w,L,W,ne){var he,ge=h&g,we=h&y,We=h&A;if(w&&(he=W?w(c,L,W,ne):w(c)),he!==r)return he;if(!Qr(c))return c;var Ke=sr(c);if(Ke){if(he=Dte(c),!ge)return Ei(c,he)}else{var Ze=ti(c),xt=Ze==te||Ze==le;if(La(c))return I9(c,ge);if(Ze==Me||Ze==O||xt&&!W){if(he=we||xt?{}:V9(c),!ge)return we?xte(c,Hee(he,c)):wte(c,i9(he,c))}else{if(!kr[Ze])return W?c:{};he=Ote(c,Ze,ge)}}ne||(ne=new Ms);var Nt=ne.get(c);if(Nt)return Nt;ne.set(c,he),_A(c)?c.forEach(function(Gt){he.add(as(Gt,h,w,Gt,c,ne))}):wA(c)&&c.forEach(function(Gt,br){he.set(br,as(Gt,h,w,br,c,ne))});var Vt=We?we?_y:xy:we?Ai:Bn,fr=Ke?r:Vt(c);return is(fr||c,function(Gt,br){fr&&(br=Gt,Gt=c[br]),_h(he,br,as(Gt,h,w,br,c,ne))}),he}function Wee(c){var h=Bn(c);return function(w){return s9(w,c,h)}}function s9(c,h,w){var L=w.length;if(c==null)return!L;for(c=qr(c);L--;){var W=w[L],ne=h[W],he=c[W];if(he===r&&!(W in c)||!ne(he))return!1}return!0}function o9(c,h,w){if(typeof c!="function")throw new ss(o);return Ch(function(){c.apply(r,w)},h)}function Eh(c,h,w,L){var W=-1,ne=lp,he=!0,ge=c.length,we=[],We=h.length;if(!ge)return we;w&&(h=Xr(h,Li(w))),L?(ne=qb,he=!1):h.length>=i&&(ne=mh,he=!1,h=new Cc(h));e:for(;++WW?0:W+w),L=L===r||L>W?W:ur(L),L<0&&(L+=W),L=w>L?0:SA(L);w0&&w(ge)?h>1?Kn(ge,h-1,w,L,W):Ia(W,ge):L||(W[W.length]=ge)}return W}var ny=N9(),u9=N9(!0);function ro(c,h){return c&&ny(c,h,Bn)}function iy(c,h){return c&&u9(c,h,Bn)}function Tp(c,h){return Ma(h,function(w){return Ko(c[w])})}function Rc(c,h){h=Oa(h,c);for(var w=0,L=h.length;c!=null&&wh}function Gee(c,h){return c!=null&&Tr.call(c,h)}function Yee(c,h){return c!=null&&h in qr(c)}function Jee(c,h,w){return c>=ei(h,w)&&c=120&&Ke.length>=120)?new Cc(he&&Ke):r}Ke=c[0];var Ze=-1,xt=ge[0];e:for(;++Ze-1;)ge!==c&&xp.call(ge,we,1),xp.call(c,we,1);return c}function w9(c,h){for(var w=c?h.length:0,L=w-1;w--;){var W=h[w];if(w==L||W!==ne){var ne=W;Wo(W)?xp.call(c,W,1):py(c,W)}}return c}function ly(c,h){return c+Sp(e9()*(h-c+1))}function ute(c,h,w,L){for(var W=-1,ne=Pn(Ep((h-c)/(w||1)),0),he=Ce(ne);ne--;)he[L?ne:++W]=c,c+=w;return he}function hy(c,h){var w="";if(!c||h<1||h>_)return w;do h%2&&(w+=c),h=Sp(h/2),h&&(c+=c);while(h);return w}function hr(c,h){return Cy(J9(c,h,Pi),c+"")}function fte(c){return n9(df(c))}function lte(c,h){var w=df(c);return jp(w,Tc(h,0,w.length))}function Ph(c,h,w,L){if(!Qr(c))return c;h=Oa(h,c);for(var W=-1,ne=h.length,he=ne-1,ge=c;ge!=null&&++WW?0:W+h),w=w>W?W:w,w<0&&(w+=W),W=h>w?0:w-h>>>0,h>>>=0;for(var ne=Ce(W);++L>>1,he=c[ne];he!==null&&!$i(he)&&(w?he<=h:he=i){var We=h?null:Ate(c);if(We)return dp(We);he=!1,W=mh,we=new Cc}else we=h?[]:ge;e:for(;++L=L?c:cs(c,h,w)}var M9=ree||function(c){return _r.clearTimeout(c)};function I9(c,h){if(h)return c.slice();var w=c.length,L=Y7?Y7(w):new c.constructor(w);return c.copy(L),L}function by(c){var h=new c.constructor(c.byteLength);return new yp(h).set(new yp(c)),h}function mte(c,h){var w=h?by(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.byteLength)}function vte(c){var h=new c.constructor(c.source,Re.exec(c));return h.lastIndex=c.lastIndex,h}function bte(c){return xh?qr(xh.call(c)):{}}function C9(c,h){var w=h?by(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.length)}function T9(c,h){if(c!==h){var w=c!==r,L=c===null,W=c===c,ne=$i(c),he=h!==r,ge=h===null,we=h===h,We=$i(h);if(!ge&&!We&&!ne&&c>h||ne&&he&&we&&!ge&&!We||L&&he&&we||!w&&we||!W)return 1;if(!L&&!ne&&!We&&c=ge)return we;var We=w[L];return we*(We=="desc"?-1:1)}}return c.index-h.index}function R9(c,h,w,L){for(var W=-1,ne=c.length,he=w.length,ge=-1,we=h.length,We=Pn(ne-he,0),Ke=Ce(we+We),Ze=!L;++ge1?w[W-1]:r,he=W>2?w[2]:r;for(ne=c.length>3&&typeof ne=="function"?(W--,ne):r,he&&ci(w[0],w[1],he)&&(ne=W<3?r:ne,W=1),h=qr(h);++L-1?W[ne?h[he]:he]:r}}function $9(c){return Ho(function(h){var w=h.length,L=w,W=os.prototype.thru;for(c&&h.reverse();L--;){var ne=h[L];if(typeof ne!="function")throw new ss(o);if(W&&!he&&Fp(ne)=="wrapper")var he=new os([],!0)}for(L=he?L:w;++L1&&Er.reverse(),Ke&&wege))return!1;var We=ne.get(c),Ke=ne.get(h);if(We&&Ke)return We==h&&Ke==c;var Ze=-1,xt=!0,Nt=w&N?new Cc:r;for(ne.set(c,h),ne.set(h,c);++Ze1?"& ":"")+h[L],h=h.join(w>2?", ":" "),c.replace(V,`{ + */e0.exports,function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",l=500,d="__lodash_placeholder__",g=1,y=2,A=4,P=1,O=2,D=1,k=2,B=4,j=8,U=16,K=32,J=64,T=128,z=256,ue=512,_e=30,G="...",E=800,m=16,f=1,p=2,v=3,x=1/0,_=9007199254740991,S=17976931348623157e292,b=NaN,M=4294967295,I=M-1,F=M>>>1,ae=[["ary",T],["bind",D],["bindKey",k],["curry",j],["curryRight",U],["flip",ue],["partial",K],["partialRight",J],["rearg",z]],N="[object Arguments]",se="[object Array]",ee="[object AsyncFunction]",X="[object Boolean]",Q="[object Date]",R="[object DOMException]",Z="[object Error]",te="[object Function]",he="[object GeneratorFunction]",ie="[object Map]",fe="[object Number]",ve="[object Null]",Me="[object Object]",Ne="[object Promise]",Te="[object Proxy]",$e="[object RegExp]",Ie="[object Set]",Le="[object String]",Ve="[object Symbol]",ke="[object Undefined]",ze="[object WeakMap]",He="[object WeakSet]",Ee="[object ArrayBuffer]",Qe="[object DataView]",ct="[object Float32Array]",Be="[object Float64Array]",et="[object Int8Array]",rt="[object Int16Array]",Je="[object Int32Array]",pt="[object Uint8Array]",ht="[object Uint8ClampedArray]",ft="[object Uint16Array]",Ht="[object Uint32Array]",Jt=/\b__p \+= '';/g,St=/\b(__p \+=) '' \+/g,er=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Xt=/&(?:amp|lt|gt|quot|#39);/g,Ot=/[&<>"']/g,Bt=RegExp(Xt.source),Tt=RegExp(Ot.source),vt=/<%-([\s\S]+?)%>/g,Dt=/<%([\s\S]+?)%>/g,Lt=/<%=([\s\S]+?)%>/g,bt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$t=/^\w*$/,jt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(nt.source),$=/^\s+/,H=/\s/,V=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C=/\{\n\/\* \[wrapped with (.+)\] \*/,Y=/,? & /,q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,oe=/[()=,{}\[\]\/\s]/,ge=/\\(\\)?/g,xe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Re=/\w*$/,De=/^[-+]0x[0-9a-f]+$/i,it=/^0b[01]+$/i,Ue=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,st=/^(?:0|[1-9]\d*)$/,tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,Rt=/['\n\r\u2028\u2029\\]/g,Mt="\\ud800-\\udfff",Et="\\u0300-\\u036f",dt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",ot=Et+dt+_t,wt="\\u2700-\\u27bf",lt="a-z\\xdf-\\xf6\\xf8-\\xff",at="\\xac\\xb1\\xd7\\xf7",Ae="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Pe="\\u2000-\\u206f",Ge=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="A-Z\\xc0-\\xd6\\xd8-\\xde",qe="\\ufe0e\\ufe0f",Xe=at+Ae+Pe+Ge,kt="['’]",Wt="["+Mt+"]",Zt="["+Xe+"]",Kt="["+ot+"]",pe="\\d+",nr="["+wt+"]",dr="["+lt+"]",pr="[^"+Mt+Xe+pe+wt+lt+je+"]",Qt="\\ud83c[\\udffb-\\udfff]",gr="(?:"+Kt+"|"+Qt+")",lr="[^"+Mt+"]",Lr="(?:\\ud83c[\\udde6-\\uddff]){2}",mr="[\\ud800-\\udbff][\\udc00-\\udfff]",wr="["+je+"]",Br="\\u200d",$r="(?:"+dr+"|"+pr+")",Ir="(?:"+wr+"|"+pr+")",hn="(?:"+kt+"(?:d|ll|m|re|s|t|ve))?",dn="(?:"+kt+"(?:D|LL|M|RE|S|T|VE))?",pn=gr+"?",sp="["+qe+"]?",jb="(?:"+Br+"(?:"+[lr,Lr,mr].join("|")+")"+sp+pn+")*",qo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",op="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ap=sp+pn+jb,Qu="(?:"+[nr,Lr,mr].join("|")+")"+ap,Ub="(?:"+[lr+Kt+"?",Kt,Lr,mr,Wt].join("|")+")",gh=RegExp(kt,"g"),qb=RegExp(Kt,"g"),ef=RegExp(Qt+"(?="+Qt+")|"+Ub+ap,"g"),cp=RegExp([wr+"?"+dr+"+"+hn+"(?="+[Zt,wr,"$"].join("|")+")",Ir+"+"+dn+"(?="+[Zt,wr+$r,"$"].join("|")+")",wr+"?"+$r+"+"+hn,wr+"+"+dn,op,qo,pe,Qu].join("|"),"g"),up=RegExp("["+Br+Mt+ot+qe+"]"),Pc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],zb=-1,Fr={};Fr[ct]=Fr[Be]=Fr[et]=Fr[rt]=Fr[Je]=Fr[pt]=Fr[ht]=Fr[ft]=Fr[Ht]=!0,Fr[N]=Fr[se]=Fr[Ee]=Fr[X]=Fr[Qe]=Fr[Q]=Fr[Z]=Fr[te]=Fr[ie]=Fr[fe]=Fr[Me]=Fr[$e]=Fr[Ie]=Fr[Le]=Fr[ze]=!1;var kr={};kr[N]=kr[se]=kr[Ee]=kr[Qe]=kr[X]=kr[Q]=kr[ct]=kr[Be]=kr[et]=kr[rt]=kr[Je]=kr[ie]=kr[fe]=kr[Me]=kr[$e]=kr[Ie]=kr[Le]=kr[Ve]=kr[pt]=kr[ht]=kr[ft]=kr[Ht]=!0,kr[Z]=kr[te]=kr[ze]=!1;var ce={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ye={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye={"&":"&","<":"<",">":">",""":'"',"'":"'"},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},jr=parseFloat,ir=parseInt,Yr=typeof nn=="object"&&nn&&nn.Object===Object&&nn,wn=typeof self=="object"&&self&&self.Object===Object&&self,_r=Yr||wn||Function("return this")(),Ur=e&&!e.nodeType&&e,gn=Ur&&!0&&t&&!t.nodeType&&t,_i=gn&&gn.exports===Ur,xn=_i&&Yr.process,Jr=function(){try{var be=gn&&gn.require&&gn.require("util").types;return be||xn&&xn.binding&&xn.binding("util")}catch{}}(),oi=Jr&&Jr.isArrayBuffer,Ps=Jr&&Jr.isDate,is=Jr&&Jr.isMap,io=Jr&&Jr.isRegExp,mh=Jr&&Jr.isSet,Mc=Jr&&Jr.isTypedArray;function Bn(be,Fe,Ce){switch(Ce.length){case 0:return be.call(Fe);case 1:return be.call(Fe,Ce[0]);case 2:return be.call(Fe,Ce[0],Ce[1]);case 3:return be.call(Fe,Ce[0],Ce[1],Ce[2])}return be.apply(Fe,Ce)}function TQ(be,Fe,Ce,Ct){for(var tr=-1,Mr=be==null?0:be.length;++tr-1}function Hb(be,Fe,Ce){for(var Ct=-1,tr=be==null?0:be.length;++Ct-1;);return Ce}function t9(be,Fe){for(var Ce=be.length;Ce--&&tf(Fe,be[Ce],0)>-1;);return Ce}function FQ(be,Fe){for(var Ce=be.length,Ct=0;Ce--;)be[Ce]===Fe&&++Ct;return Ct}var jQ=Gb(ce),UQ=Gb(ye);function qQ(be){return"\\"+It[be]}function zQ(be,Fe){return be==null?r:be[Fe]}function rf(be){return up.test(be)}function HQ(be){return Pc.test(be)}function WQ(be){for(var Fe,Ce=[];!(Fe=be.next()).done;)Ce.push(Fe.value);return Ce}function Zb(be){var Fe=-1,Ce=Array(be.size);return be.forEach(function(Ct,tr){Ce[++Fe]=[tr,Ct]}),Ce}function r9(be,Fe){return function(Ce){return be(Fe(Ce))}}function Da(be,Fe){for(var Ce=-1,Ct=be.length,tr=0,Mr=[];++Ce-1}function Dee(c,h){var w=this.__data__,L=Ip(w,c);return L<0?(++this.size,w.push([c,h])):w[L][1]=h,this}zo.prototype.clear=Iee,zo.prototype.delete=Cee,zo.prototype.get=Tee,zo.prototype.has=Ree,zo.prototype.set=Dee;function Ho(c){var h=-1,w=c==null?0:c.length;for(this.clear();++h=h?c:h)),c}function cs(c,h,w,L,W,ne){var de,me=h&g,we=h&y,We=h&A;if(w&&(de=W?w(c,L,W,ne):w(c)),de!==r)return de;if(!Qr(c))return c;var Ke=sr(c);if(Ke){if(de=kte(c),!me)return Ei(c,de)}else{var Ze=ti(c),xt=Ze==te||Ze==he;if($a(c))return $9(c,me);if(Ze==Me||Ze==N||xt&&!W){if(de=we||xt?{}:nA(c),!me)return we?Ate(c,Gee(de,c)):Ste(c,p9(de,c))}else{if(!kr[Ze])return W?c:{};de=Bte(c,Ze,me)}}ne||(ne=new Is);var Nt=ne.get(c);if(Nt)return Nt;ne.set(c,de),DA(c)?c.forEach(function(Gt){de.add(cs(Gt,h,w,Gt,c,ne))}):TA(c)&&c.forEach(function(Gt,br){de.set(br,cs(Gt,h,w,br,c,ne))});var Vt=We?we?Sy:Ey:we?Ai:$n,fr=Ke?r:Vt(c);return ss(fr||c,function(Gt,br){fr&&(br=Gt,Gt=c[br]),Eh(de,br,cs(Gt,h,w,br,c,ne))}),de}function Yee(c){var h=$n(c);return function(w){return g9(w,c,h)}}function g9(c,h,w){var L=w.length;if(c==null)return!L;for(c=qr(c);L--;){var W=w[L],ne=h[W],de=c[W];if(de===r&&!(W in c)||!ne(de))return!1}return!0}function m9(c,h,w){if(typeof c!="function")throw new os(o);return Th(function(){c.apply(r,w)},h)}function Sh(c,h,w,L){var W=-1,ne=lp,de=!0,me=c.length,we=[],We=h.length;if(!me)return we;w&&(h=Xr(h,ki(w))),L?(ne=Hb,de=!1):h.length>=i&&(ne=vh,de=!1,h=new Tc(h));e:for(;++WW?0:W+w),L=L===r||L>W?W:ur(L),L<0&&(L+=W),L=w>L?0:NA(L);w0&&w(me)?h>1?Vn(me,h-1,w,L,W):Ra(W,me):L||(W[W.length]=me)}return W}var sy=H9(),y9=H9(!0);function so(c,h){return c&&sy(c,h,$n)}function oy(c,h){return c&&y9(c,h,$n)}function Tp(c,h){return Ta(h,function(w){return Yo(c[w])})}function Dc(c,h){h=ka(h,c);for(var w=0,L=h.length;c!=null&&wh}function Zee(c,h){return c!=null&&Tr.call(c,h)}function Qee(c,h){return c!=null&&h in qr(c)}function ete(c,h,w){return c>=ei(h,w)&&c=120&&Ke.length>=120)?new Tc(de&&Ke):r}Ke=c[0];var Ze=-1,xt=me[0];e:for(;++Ze-1;)me!==c&&xp.call(me,we,1),xp.call(c,we,1);return c}function T9(c,h){for(var w=c?h.length:0,L=w-1;w--;){var W=h[w];if(w==L||W!==ne){var ne=W;Go(W)?xp.call(c,W,1):my(c,W)}}return c}function dy(c,h){return c+Sp(f9()*(h-c+1))}function dte(c,h,w,L){for(var W=-1,ne=Pn(Ep((h-c)/(w||1)),0),de=Ce(ne);ne--;)de[L?ne:++W]=c,c+=w;return de}function py(c,h){var w="";if(!c||h<1||h>_)return w;do h%2&&(w+=c),h=Sp(h/2),h&&(c+=c);while(h);return w}function hr(c,h){return Ry(oA(c,h,Pi),c+"")}function pte(c){return d9(pf(c))}function gte(c,h){var w=pf(c);return Up(w,Rc(h,0,w.length))}function Mh(c,h,w,L){if(!Qr(c))return c;h=ka(h,c);for(var W=-1,ne=h.length,de=ne-1,me=c;me!=null&&++WW?0:W+h),w=w>W?W:w,w<0&&(w+=W),W=h>w?0:w-h>>>0,h>>>=0;for(var ne=Ce(W);++L>>1,de=c[ne];de!==null&&!$i(de)&&(w?de<=h:de=i){var We=h?null:Cte(c);if(We)return dp(We);de=!1,W=vh,we=new Tc}else we=h?[]:me;e:for(;++L=L?c:us(c,h,w)}var B9=oee||function(c){return _r.clearTimeout(c)};function $9(c,h){if(h)return c.slice();var w=c.length,L=s9?s9(w):new c.constructor(w);return c.copy(L),L}function wy(c){var h=new c.constructor(c.byteLength);return new yp(h).set(new yp(c)),h}function wte(c,h){var w=h?wy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.byteLength)}function xte(c){var h=new c.constructor(c.source,Re.exec(c));return h.lastIndex=c.lastIndex,h}function _te(c){return _h?qr(_h.call(c)):{}}function F9(c,h){var w=h?wy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.length)}function j9(c,h){if(c!==h){var w=c!==r,L=c===null,W=c===c,ne=$i(c),de=h!==r,me=h===null,we=h===h,We=$i(h);if(!me&&!We&&!ne&&c>h||ne&&de&&we&&!me&&!We||L&&de&&we||!w&&we||!W)return 1;if(!L&&!ne&&!We&&c=me)return we;var We=w[L];return we*(We=="desc"?-1:1)}}return c.index-h.index}function U9(c,h,w,L){for(var W=-1,ne=c.length,de=w.length,me=-1,we=h.length,We=Pn(ne-de,0),Ke=Ce(we+We),Ze=!L;++me1?w[W-1]:r,de=W>2?w[2]:r;for(ne=c.length>3&&typeof ne=="function"?(W--,ne):r,de&&ci(w[0],w[1],de)&&(ne=W<3?r:ne,W=1),h=qr(h);++L-1?W[ne?h[de]:de]:r}}function V9(c){return Vo(function(h){var w=h.length,L=w,W=as.prototype.thru;for(c&&h.reverse();L--;){var ne=h[L];if(typeof ne!="function")throw new os(o);if(W&&!de&&Fp(ne)=="wrapper")var de=new as([],!0)}for(L=de?L:w;++L1&&Er.reverse(),Ke&&weme))return!1;var We=ne.get(c),Ke=ne.get(h);if(We&&Ke)return We==h&&Ke==c;var Ze=-1,xt=!0,Nt=w&O?new Tc:r;for(ne.set(c,h),ne.set(h,c);++Ze1?"& ":"")+h[L],h=h.join(w>2?", ":" "),c.replace(V,`{ /* [wrapped with `+h+`] */ -`)}function Lte(c){return sr(c)||Nc(c)||!!(Z7&&c&&c[Z7])}function Wo(c,h){var w=typeof c;return h=h??_,!!h&&(w=="number"||w!="symbol"&&st.test(c))&&c>-1&&c%1==0&&c0){if(++h>=E)return arguments[0]}else h=0;return c.apply(r,arguments)}}function jp(c,h){var w=-1,L=c.length,W=L-1;for(h=h===r?L:h;++w1?c[h-1]:r;return w=typeof w=="function"?(c.pop(),w):r,cA(c,w)});function uA(c){var h=re(c);return h.__chain__=!0,h}function Kre(c,h){return h(c),c}function qp(c,h){return h(c)}var Vre=Ho(function(c){var h=c.length,w=h?c[0]:0,L=this.__wrapped__,W=function(ne){return ry(ne,c)};return h>1||this.__actions__.length||!(L instanceof xr)||!Wo(w)?this.thru(W):(L=L.slice(w,+w+(h?1:0)),L.__actions__.push({func:qp,args:[W],thisArg:r}),new os(L,this.__chain__).thru(function(ne){return h&&!ne.length&&ne.push(r),ne}))});function Gre(){return uA(this)}function Yre(){return new os(this.value(),this.__chain__)}function Jre(){this.__values__===r&&(this.__values__=EA(this.value()));var c=this.__index__>=this.__values__.length,h=c?r:this.__values__[this.__index__++];return{done:c,value:h}}function Xre(){return this}function Zre(c){for(var h,w=this;w instanceof Mp;){var L=rA(w);L.__index__=0,L.__values__=r,h?W.__wrapped__=L:h=L;var W=L;w=w.__wrapped__}return W.__wrapped__=c,h}function Qre(){var c=this.__wrapped__;if(c instanceof xr){var h=c;return this.__actions__.length&&(h=new xr(this)),h=h.reverse(),h.__actions__.push({func:qp,args:[Ty],thisArg:r}),new os(h,this.__chain__)}return this.thru(Ty)}function ene(){return A9(this.__wrapped__,this.__actions__)}var tne=Np(function(c,h,w){Tr.call(c,w)?++c[w]:qo(c,w,1)});function rne(c,h,w){var L=sr(c)?B7:Kee;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}function nne(c,h){var w=sr(c)?Ma:c9;return w(c,qt(h,3))}var ine=k9(nA),sne=k9(iA);function one(c,h){return Kn(zp(c,h),1)}function ane(c,h){return Kn(zp(c,h),x)}function cne(c,h,w){return w=w===r?1:ur(w),Kn(zp(c,h),w)}function fA(c,h){var w=sr(c)?is:Ra;return w(c,qt(h,3))}function lA(c,h){var w=sr(c)?MQ:a9;return w(c,qt(h,3))}var une=Np(function(c,h,w){Tr.call(c,w)?c[w].push(h):qo(c,w,[h])});function fne(c,h,w,L){c=Si(c)?c:df(c),w=w&&!L?ur(w):0;var W=c.length;return w<0&&(w=Pn(W+w,0)),Gp(c)?w<=W&&c.indexOf(h,w)>-1:!!W&&ef(c,h,w)>-1}var lne=hr(function(c,h,w){var L=-1,W=typeof h=="function",ne=Si(c)?Ce(c.length):[];return Ra(c,function(he){ne[++L]=W?$n(h,he,w):Sh(he,h,w)}),ne}),hne=Np(function(c,h,w){qo(c,w,h)});function zp(c,h){var w=sr(c)?Xr:p9;return w(c,qt(h,3))}function dne(c,h,w,L){return c==null?[]:(sr(h)||(h=h==null?[]:[h]),w=L?r:w,sr(w)||(w=w==null?[]:[w]),b9(c,h,w))}var pne=Np(function(c,h,w){c[w?0:1].push(h)},function(){return[[],[]]});function gne(c,h,w){var L=sr(c)?zb:q7,W=arguments.length<3;return L(c,qt(h,4),w,W,Ra)}function mne(c,h,w){var L=sr(c)?IQ:q7,W=arguments.length<3;return L(c,qt(h,4),w,W,a9)}function vne(c,h){var w=sr(c)?Ma:c9;return w(c,Kp(qt(h,3)))}function bne(c){var h=sr(c)?n9:fte;return h(c)}function yne(c,h,w){(w?ci(c,h,w):h===r)?h=1:h=ur(h);var L=sr(c)?jee:lte;return L(c,h)}function wne(c){var h=sr(c)?qee:dte;return h(c)}function xne(c){if(c==null)return 0;if(Si(c))return Gp(c)?rf(c):c.length;var h=ti(c);return h==ie||h==Ie?c.size:cy(c).length}function _ne(c,h,w){var L=sr(c)?Hb:pte;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}var Ene=hr(function(c,h){if(c==null)return[];var w=h.length;return w>1&&ci(c,h[0],h[1])?h=[]:w>2&&ci(h[0],h[1],h[2])&&(h=[h[0]]),b9(c,Kn(h,1),[])}),Hp=nee||function(){return _r.Date.now()};function Sne(c,h){if(typeof h!="function")throw new ss(o);return c=ur(c),function(){if(--c<1)return h.apply(this,arguments)}}function hA(c,h,w){return h=w?r:h,h=c&&h==null?c.length:h,zo(c,T,r,r,r,r,h)}function dA(c,h){var w;if(typeof h!="function")throw new ss(o);return c=ur(c),function(){return--c>0&&(w=h.apply(this,arguments)),c<=1&&(h=r),w}}var Dy=hr(function(c,h,w){var L=D;if(w.length){var W=Ca(w,lf(Dy));L|=K}return zo(c,L,h,w,W)}),pA=hr(function(c,h,w){var L=D|k;if(w.length){var W=Ca(w,lf(pA));L|=K}return zo(h,L,c,w,W)});function gA(c,h,w){h=w?r:h;var L=zo(c,q,r,r,r,r,r,h);return L.placeholder=gA.placeholder,L}function mA(c,h,w){h=w?r:h;var L=zo(c,U,r,r,r,r,r,h);return L.placeholder=mA.placeholder,L}function vA(c,h,w){var L,W,ne,he,ge,we,We=0,Ke=!1,Ze=!1,xt=!0;if(typeof c!="function")throw new ss(o);h=fs(h)||0,Qr(w)&&(Ke=!!w.leading,Ze="maxWait"in w,ne=Ze?Pn(fs(w.maxWait)||0,h):ne,xt="trailing"in w?!!w.trailing:xt);function Nt(vn){var Cs=L,Go=W;return L=W=r,We=vn,he=c.apply(Go,Cs),he}function Vt(vn){return We=vn,ge=Ch(br,h),Ke?Nt(vn):he}function fr(vn){var Cs=vn-we,Go=vn-We,kA=h-Cs;return Ze?ei(kA,ne-Go):kA}function Gt(vn){var Cs=vn-we,Go=vn-We;return we===r||Cs>=h||Cs<0||Ze&&Go>=ne}function br(){var vn=Hp();if(Gt(vn))return Er(vn);ge=Ch(br,fr(vn))}function Er(vn){return ge=r,xt&&L?Nt(vn):(L=W=r,he)}function Bi(){ge!==r&&M9(ge),We=0,L=we=W=ge=r}function ui(){return ge===r?he:Er(Hp())}function Fi(){var vn=Hp(),Cs=Gt(vn);if(L=arguments,W=this,we=vn,Cs){if(ge===r)return Vt(we);if(Ze)return M9(ge),ge=Ch(br,h),Nt(we)}return ge===r&&(ge=Ch(br,h)),he}return Fi.cancel=Bi,Fi.flush=ui,Fi}var Ane=hr(function(c,h){return o9(c,1,h)}),Pne=hr(function(c,h,w){return o9(c,fs(h)||0,w)});function Mne(c){return zo(c,ue)}function Wp(c,h){if(typeof c!="function"||h!=null&&typeof h!="function")throw new ss(o);var w=function(){var L=arguments,W=h?h.apply(this,L):L[0],ne=w.cache;if(ne.has(W))return ne.get(W);var he=c.apply(this,L);return w.cache=ne.set(W,he)||ne,he};return w.cache=new(Wp.Cache||jo),w}Wp.Cache=jo;function Kp(c){if(typeof c!="function")throw new ss(o);return function(){var h=arguments;switch(h.length){case 0:return!c.call(this);case 1:return!c.call(this,h[0]);case 2:return!c.call(this,h[0],h[1]);case 3:return!c.call(this,h[0],h[1],h[2])}return!c.apply(this,h)}}function Ine(c){return dA(2,c)}var Cne=gte(function(c,h){h=h.length==1&&sr(h[0])?Xr(h[0],Li(qt())):Xr(Kn(h,1),Li(qt()));var w=h.length;return hr(function(L){for(var W=-1,ne=ei(L.length,w);++W=h}),Nc=l9(function(){return arguments}())?l9:function(c){return rn(c)&&Tr.call(c,"callee")&&!X7.call(c,"callee")},sr=Ce.isArray,Hne=oi?Li(oi):Zee;function Si(c){return c!=null&&Vp(c.length)&&!Ko(c)}function mn(c){return rn(c)&&Si(c)}function Wne(c){return c===!0||c===!1||rn(c)&&ai(c)==X}var La=see||Hy,Kne=As?Li(As):Qee;function Vne(c){return rn(c)&&c.nodeType===1&&!Th(c)}function Gne(c){if(c==null)return!0;if(Si(c)&&(sr(c)||typeof c=="string"||typeof c.splice=="function"||La(c)||hf(c)||Nc(c)))return!c.length;var h=ti(c);if(h==ie||h==Ie)return!c.size;if(Ih(c))return!cy(c).length;for(var w in c)if(Tr.call(c,w))return!1;return!0}function Yne(c,h){return Ah(c,h)}function Jne(c,h,w){w=typeof w=="function"?w:r;var L=w?w(c,h):r;return L===r?Ah(c,h,r,w):!!L}function Ny(c){if(!rn(c))return!1;var h=ai(c);return h==Z||h==R||typeof c.message=="string"&&typeof c.name=="string"&&!Th(c)}function Xne(c){return typeof c=="number"&&Q7(c)}function Ko(c){if(!Qr(c))return!1;var h=ai(c);return h==te||h==le||h==ee||h==Te}function yA(c){return typeof c=="number"&&c==ur(c)}function Vp(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=_}function Qr(c){var h=typeof c;return c!=null&&(h=="object"||h=="function")}function rn(c){return c!=null&&typeof c=="object"}var wA=ns?Li(ns):tte;function Zne(c,h){return c===h||ay(c,h,Sy(h))}function Qne(c,h,w){return w=typeof w=="function"?w:r,ay(c,h,Sy(h),w)}function eie(c){return xA(c)&&c!=+c}function tie(c){if(Bte(c))throw new tr(s);return h9(c)}function rie(c){return c===null}function nie(c){return c==null}function xA(c){return typeof c=="number"||rn(c)&&ai(c)==fe}function Th(c){if(!rn(c)||ai(c)!=Me)return!1;var h=wp(c);if(h===null)return!0;var w=Tr.call(h,"constructor")&&h.constructor;return typeof w=="function"&&w instanceof w&&mp.call(w)==QQ}var Ly=to?Li(to):rte;function iie(c){return yA(c)&&c>=-_&&c<=_}var _A=gh?Li(gh):nte;function Gp(c){return typeof c=="string"||!sr(c)&&rn(c)&&ai(c)==Le}function $i(c){return typeof c=="symbol"||rn(c)&&ai(c)==Ve}var hf=Pc?Li(Pc):ite;function sie(c){return c===r}function oie(c){return rn(c)&&ti(c)==ze}function aie(c){return rn(c)&&ai(c)==He}var cie=Bp(uy),uie=Bp(function(c,h){return c<=h});function EA(c){if(!c)return[];if(Si(c))return Gp(c)?Ps(c):Ei(c);if(vh&&c[vh])return jQ(c[vh]());var h=ti(c),w=h==ie?Jb:h==Ie?dp:df;return w(c)}function Vo(c){if(!c)return c===0?c:0;if(c=fs(c),c===x||c===-x){var h=c<0?-1:1;return h*S}return c===c?c:0}function ur(c){var h=Vo(c),w=h%1;return h===h?w?h-w:h:0}function SA(c){return c?Tc(ur(c),0,M):0}function fs(c){if(typeof c=="number")return c;if($i(c))return b;if(Qr(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=Qr(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=z7(c);var w=it.test(c);return w||gt.test(c)?ir(c.slice(2),w?2:8):De.test(c)?b:+c}function AA(c){return no(c,Ai(c))}function fie(c){return c?Tc(ur(c),-_,_):c===0?c:0}function Cr(c){return c==null?"":ki(c)}var lie=uf(function(c,h){if(Ih(h)||Si(h)){no(h,Bn(h),c);return}for(var w in h)Tr.call(h,w)&&_h(c,w,h[w])}),PA=uf(function(c,h){no(h,Ai(h),c)}),Yp=uf(function(c,h,w,L){no(h,Ai(h),c,L)}),hie=uf(function(c,h,w,L){no(h,Bn(h),c,L)}),die=Ho(ry);function pie(c,h){var w=cf(c);return h==null?w:i9(w,h)}var gie=hr(function(c,h){c=qr(c);var w=-1,L=h.length,W=L>2?h[2]:r;for(W&&ci(h[0],h[1],W)&&(L=1);++w1),ne}),no(c,_y(c),w),L&&(w=as(w,g|y|A,Pte));for(var W=h.length;W--;)py(w,h[W]);return w});function Oie(c,h){return IA(c,Kp(qt(h)))}var Nie=Ho(function(c,h){return c==null?{}:ate(c,h)});function IA(c,h){if(c==null)return{};var w=Xr(_y(c),function(L){return[L]});return h=qt(h),y9(c,w,function(L,W){return h(L,W[0])})}function Lie(c,h,w){h=Oa(h,c);var L=-1,W=h.length;for(W||(W=1,c=r);++Lh){var L=c;c=h,h=L}if(w||c%1||h%1){var W=e9();return ei(c+W*(h-c+Ur("1e-"+((W+"").length-1))),h)}return ly(c,h)}var Kie=ff(function(c,h,w){return h=h.toLowerCase(),c+(w?RA(h):h)});function RA(c){return By(Cr(c).toLowerCase())}function DA(c){return c=Cr(c),c&&c.replace(tt,kQ).replace(Ub,"")}function Vie(c,h,w){c=Cr(c),h=ki(h);var L=c.length;w=w===r?L:Tc(ur(w),0,L);var W=w;return w-=h.length,w>=0&&c.slice(w,W)==h}function Gie(c){return c=Cr(c),c&&Tt.test(c)?c.replace(Ot,$Q):c}function Yie(c){return c=Cr(c),c&&Ft.test(c)?c.replace(nt,"\\$&"):c}var Jie=ff(function(c,h,w){return c+(w?"-":"")+h.toLowerCase()}),Xie=ff(function(c,h,w){return c+(w?" ":"")+h.toLowerCase()}),Zie=L9("toLowerCase");function Qie(c,h,w){c=Cr(c),h=ur(h);var L=h?rf(c):0;if(!h||L>=h)return c;var W=(h-L)/2;return $p(Sp(W),w)+c+$p(Ep(W),w)}function ese(c,h,w){c=Cr(c),h=ur(h);var L=h?rf(c):0;return h&&L>>0,w?(c=Cr(c),c&&(typeof h=="string"||h!=null&&!Ly(h))&&(h=ki(h),!h&&tf(c))?Na(Ps(c),0,w):c.split(h,w)):[]}var ase=ff(function(c,h,w){return c+(w?" ":"")+By(h)});function cse(c,h,w){return c=Cr(c),w=w==null?0:Tc(ur(w),0,c.length),h=ki(h),c.slice(w,w+h.length)==h}function use(c,h,w){var L=re.templateSettings;w&&ci(c,h,w)&&(h=r),c=Cr(c),h=Yp({},h,L,q9);var W=Yp({},h.imports,L.imports,q9),ne=Bn(W),he=Yb(W,ne),ge,we,We=0,Ke=h.interpolate||At,Ze="__p += '",xt=Xb((h.escape||At).source+"|"+Ke.source+"|"+(Ke===Lt?xe:At).source+"|"+(h.evaluate||At).source+"|$","g"),Nt="//# sourceURL="+(Tr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++jb+"]")+` -`;c.replace(xt,function(Gt,br,Er,Bi,ui,Fi){return Er||(Er=Bi),Ze+=c.slice(We,Fi).replace(Rt,BQ),br&&(ge=!0,Ze+=`' + +`)}function Fte(c){return sr(c)||Lc(c)||!!(c9&&c&&c[c9])}function Go(c,h){var w=typeof c;return h=h??_,!!h&&(w=="number"||w!="symbol"&&st.test(c))&&c>-1&&c%1==0&&c0){if(++h>=E)return arguments[0]}else h=0;return c.apply(r,arguments)}}function Up(c,h){var w=-1,L=c.length,W=L-1;for(h=h===r?L:h;++w1?c[h-1]:r;return w=typeof w=="function"?(c.pop(),w):r,bA(c,w)});function yA(c){var h=re(c);return h.__chain__=!0,h}function Jre(c,h){return h(c),c}function qp(c,h){return h(c)}var Xre=Vo(function(c){var h=c.length,w=h?c[0]:0,L=this.__wrapped__,W=function(ne){return iy(ne,c)};return h>1||this.__actions__.length||!(L instanceof xr)||!Go(w)?this.thru(W):(L=L.slice(w,+w+(h?1:0)),L.__actions__.push({func:qp,args:[W],thisArg:r}),new as(L,this.__chain__).thru(function(ne){return h&&!ne.length&&ne.push(r),ne}))});function Zre(){return yA(this)}function Qre(){return new as(this.value(),this.__chain__)}function ene(){this.__values__===r&&(this.__values__=OA(this.value()));var c=this.__index__>=this.__values__.length,h=c?r:this.__values__[this.__index__++];return{done:c,value:h}}function tne(){return this}function rne(c){for(var h,w=this;w instanceof Mp;){var L=hA(w);L.__index__=0,L.__values__=r,h?W.__wrapped__=L:h=L;var W=L;w=w.__wrapped__}return W.__wrapped__=c,h}function nne(){var c=this.__wrapped__;if(c instanceof xr){var h=c;return this.__actions__.length&&(h=new xr(this)),h=h.reverse(),h.__actions__.push({func:qp,args:[Dy],thisArg:r}),new as(h,this.__chain__)}return this.thru(Dy)}function ine(){return L9(this.__wrapped__,this.__actions__)}var sne=Np(function(c,h,w){Tr.call(c,w)?++c[w]:Wo(c,w,1)});function one(c,h,w){var L=sr(c)?G7:Jee;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}function ane(c,h){var w=sr(c)?Ta:b9;return w(c,qt(h,3))}var cne=K9(dA),une=K9(pA);function fne(c,h){return Vn(zp(c,h),1)}function lne(c,h){return Vn(zp(c,h),x)}function hne(c,h,w){return w=w===r?1:ur(w),Vn(zp(c,h),w)}function wA(c,h){var w=sr(c)?ss:Na;return w(c,qt(h,3))}function xA(c,h){var w=sr(c)?RQ:v9;return w(c,qt(h,3))}var dne=Np(function(c,h,w){Tr.call(c,w)?c[w].push(h):Wo(c,w,[h])});function pne(c,h,w,L){c=Si(c)?c:pf(c),w=w&&!L?ur(w):0;var W=c.length;return w<0&&(w=Pn(W+w,0)),Gp(c)?w<=W&&c.indexOf(h,w)>-1:!!W&&tf(c,h,w)>-1}var gne=hr(function(c,h,w){var L=-1,W=typeof h=="function",ne=Si(c)?Ce(c.length):[];return Na(c,function(de){ne[++L]=W?Bn(h,de,w):Ah(de,h,w)}),ne}),mne=Np(function(c,h,w){Wo(c,w,h)});function zp(c,h){var w=sr(c)?Xr:S9;return w(c,qt(h,3))}function vne(c,h,w,L){return c==null?[]:(sr(h)||(h=h==null?[]:[h]),w=L?r:w,sr(w)||(w=w==null?[]:[w]),I9(c,h,w))}var bne=Np(function(c,h,w){c[w?0:1].push(h)},function(){return[[],[]]});function yne(c,h,w){var L=sr(c)?Wb:Z7,W=arguments.length<3;return L(c,qt(h,4),w,W,Na)}function wne(c,h,w){var L=sr(c)?DQ:Z7,W=arguments.length<3;return L(c,qt(h,4),w,W,v9)}function xne(c,h){var w=sr(c)?Ta:b9;return w(c,Kp(qt(h,3)))}function _ne(c){var h=sr(c)?d9:pte;return h(c)}function Ene(c,h,w){(w?ci(c,h,w):h===r)?h=1:h=ur(h);var L=sr(c)?Wee:gte;return L(c,h)}function Sne(c){var h=sr(c)?Kee:vte;return h(c)}function Ane(c){if(c==null)return 0;if(Si(c))return Gp(c)?nf(c):c.length;var h=ti(c);return h==ie||h==Ie?c.size:fy(c).length}function Pne(c,h,w){var L=sr(c)?Kb:bte;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}var Mne=hr(function(c,h){if(c==null)return[];var w=h.length;return w>1&&ci(c,h[0],h[1])?h=[]:w>2&&ci(h[0],h[1],h[2])&&(h=[h[0]]),I9(c,Vn(h,1),[])}),Hp=aee||function(){return _r.Date.now()};function Ine(c,h){if(typeof h!="function")throw new os(o);return c=ur(c),function(){if(--c<1)return h.apply(this,arguments)}}function _A(c,h,w){return h=w?r:h,h=c&&h==null?c.length:h,Ko(c,T,r,r,r,r,h)}function EA(c,h){var w;if(typeof h!="function")throw new os(o);return c=ur(c),function(){return--c>0&&(w=h.apply(this,arguments)),c<=1&&(h=r),w}}var Ny=hr(function(c,h,w){var L=D;if(w.length){var W=Da(w,hf(Ny));L|=K}return Ko(c,L,h,w,W)}),SA=hr(function(c,h,w){var L=D|k;if(w.length){var W=Da(w,hf(SA));L|=K}return Ko(h,L,c,w,W)});function AA(c,h,w){h=w?r:h;var L=Ko(c,j,r,r,r,r,r,h);return L.placeholder=AA.placeholder,L}function PA(c,h,w){h=w?r:h;var L=Ko(c,U,r,r,r,r,r,h);return L.placeholder=PA.placeholder,L}function MA(c,h,w){var L,W,ne,de,me,we,We=0,Ke=!1,Ze=!1,xt=!0;if(typeof c!="function")throw new os(o);h=ls(h)||0,Qr(w)&&(Ke=!!w.leading,Ze="maxWait"in w,ne=Ze?Pn(ls(w.maxWait)||0,h):ne,xt="trailing"in w?!!w.trailing:xt);function Nt(vn){var Ts=L,Xo=W;return L=W=r,We=vn,de=c.apply(Xo,Ts),de}function Vt(vn){return We=vn,me=Th(br,h),Ke?Nt(vn):de}function fr(vn){var Ts=vn-we,Xo=vn-We,KA=h-Ts;return Ze?ei(KA,ne-Xo):KA}function Gt(vn){var Ts=vn-we,Xo=vn-We;return we===r||Ts>=h||Ts<0||Ze&&Xo>=ne}function br(){var vn=Hp();if(Gt(vn))return Er(vn);me=Th(br,fr(vn))}function Er(vn){return me=r,xt&&L?Nt(vn):(L=W=r,de)}function Fi(){me!==r&&B9(me),We=0,L=we=W=me=r}function ui(){return me===r?de:Er(Hp())}function ji(){var vn=Hp(),Ts=Gt(vn);if(L=arguments,W=this,we=vn,Ts){if(me===r)return Vt(we);if(Ze)return B9(me),me=Th(br,h),Nt(we)}return me===r&&(me=Th(br,h)),de}return ji.cancel=Fi,ji.flush=ui,ji}var Cne=hr(function(c,h){return m9(c,1,h)}),Tne=hr(function(c,h,w){return m9(c,ls(h)||0,w)});function Rne(c){return Ko(c,ue)}function Wp(c,h){if(typeof c!="function"||h!=null&&typeof h!="function")throw new os(o);var w=function(){var L=arguments,W=h?h.apply(this,L):L[0],ne=w.cache;if(ne.has(W))return ne.get(W);var de=c.apply(this,L);return w.cache=ne.set(W,de)||ne,de};return w.cache=new(Wp.Cache||Ho),w}Wp.Cache=Ho;function Kp(c){if(typeof c!="function")throw new os(o);return function(){var h=arguments;switch(h.length){case 0:return!c.call(this);case 1:return!c.call(this,h[0]);case 2:return!c.call(this,h[0],h[1]);case 3:return!c.call(this,h[0],h[1],h[2])}return!c.apply(this,h)}}function Dne(c){return EA(2,c)}var One=yte(function(c,h){h=h.length==1&&sr(h[0])?Xr(h[0],ki(qt())):Xr(Vn(h,1),ki(qt()));var w=h.length;return hr(function(L){for(var W=-1,ne=ei(L.length,w);++W=h}),Lc=x9(function(){return arguments}())?x9:function(c){return rn(c)&&Tr.call(c,"callee")&&!a9.call(c,"callee")},sr=Ce.isArray,Gne=oi?ki(oi):rte;function Si(c){return c!=null&&Vp(c.length)&&!Yo(c)}function mn(c){return rn(c)&&Si(c)}function Yne(c){return c===!0||c===!1||rn(c)&&ai(c)==X}var $a=uee||Ky,Jne=Ps?ki(Ps):nte;function Xne(c){return rn(c)&&c.nodeType===1&&!Rh(c)}function Zne(c){if(c==null)return!0;if(Si(c)&&(sr(c)||typeof c=="string"||typeof c.splice=="function"||$a(c)||df(c)||Lc(c)))return!c.length;var h=ti(c);if(h==ie||h==Ie)return!c.size;if(Ch(c))return!fy(c).length;for(var w in c)if(Tr.call(c,w))return!1;return!0}function Qne(c,h){return Ph(c,h)}function eie(c,h,w){w=typeof w=="function"?w:r;var L=w?w(c,h):r;return L===r?Ph(c,h,r,w):!!L}function ky(c){if(!rn(c))return!1;var h=ai(c);return h==Z||h==R||typeof c.message=="string"&&typeof c.name=="string"&&!Rh(c)}function tie(c){return typeof c=="number"&&u9(c)}function Yo(c){if(!Qr(c))return!1;var h=ai(c);return h==te||h==he||h==ee||h==Te}function CA(c){return typeof c=="number"&&c==ur(c)}function Vp(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=_}function Qr(c){var h=typeof c;return c!=null&&(h=="object"||h=="function")}function rn(c){return c!=null&&typeof c=="object"}var TA=is?ki(is):ste;function rie(c,h){return c===h||uy(c,h,Py(h))}function nie(c,h,w){return w=typeof w=="function"?w:r,uy(c,h,Py(h),w)}function iie(c){return RA(c)&&c!=+c}function sie(c){if(qte(c))throw new tr(s);return _9(c)}function oie(c){return c===null}function aie(c){return c==null}function RA(c){return typeof c=="number"||rn(c)&&ai(c)==fe}function Rh(c){if(!rn(c)||ai(c)!=Me)return!1;var h=wp(c);if(h===null)return!0;var w=Tr.call(h,"constructor")&&h.constructor;return typeof w=="function"&&w instanceof w&&mp.call(w)==nee}var By=io?ki(io):ote;function cie(c){return CA(c)&&c>=-_&&c<=_}var DA=mh?ki(mh):ate;function Gp(c){return typeof c=="string"||!sr(c)&&rn(c)&&ai(c)==Le}function $i(c){return typeof c=="symbol"||rn(c)&&ai(c)==Ve}var df=Mc?ki(Mc):cte;function uie(c){return c===r}function fie(c){return rn(c)&&ti(c)==ze}function lie(c){return rn(c)&&ai(c)==He}var hie=$p(ly),die=$p(function(c,h){return c<=h});function OA(c){if(!c)return[];if(Si(c))return Gp(c)?Ms(c):Ei(c);if(bh&&c[bh])return WQ(c[bh]());var h=ti(c),w=h==ie?Zb:h==Ie?dp:pf;return w(c)}function Jo(c){if(!c)return c===0?c:0;if(c=ls(c),c===x||c===-x){var h=c<0?-1:1;return h*S}return c===c?c:0}function ur(c){var h=Jo(c),w=h%1;return h===h?w?h-w:h:0}function NA(c){return c?Rc(ur(c),0,M):0}function ls(c){if(typeof c=="number")return c;if($i(c))return b;if(Qr(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=Qr(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=Q7(c);var w=it.test(c);return w||gt.test(c)?ir(c.slice(2),w?2:8):De.test(c)?b:+c}function LA(c){return oo(c,Ai(c))}function pie(c){return c?Rc(ur(c),-_,_):c===0?c:0}function Cr(c){return c==null?"":Bi(c)}var gie=ff(function(c,h){if(Ch(h)||Si(h)){oo(h,$n(h),c);return}for(var w in h)Tr.call(h,w)&&Eh(c,w,h[w])}),kA=ff(function(c,h){oo(h,Ai(h),c)}),Yp=ff(function(c,h,w,L){oo(h,Ai(h),c,L)}),mie=ff(function(c,h,w,L){oo(h,$n(h),c,L)}),vie=Vo(iy);function bie(c,h){var w=uf(c);return h==null?w:p9(w,h)}var yie=hr(function(c,h){c=qr(c);var w=-1,L=h.length,W=L>2?h[2]:r;for(W&&ci(h[0],h[1],W)&&(L=1);++w1),ne}),oo(c,Sy(c),w),L&&(w=cs(w,g|y|A,Tte));for(var W=h.length;W--;)my(w,h[W]);return w});function Bie(c,h){return $A(c,Kp(qt(h)))}var $ie=Vo(function(c,h){return c==null?{}:lte(c,h)});function $A(c,h){if(c==null)return{};var w=Xr(Sy(c),function(L){return[L]});return h=qt(h),C9(c,w,function(L,W){return h(L,W[0])})}function Fie(c,h,w){h=ka(h,c);var L=-1,W=h.length;for(W||(W=1,c=r);++Lh){var L=c;c=h,h=L}if(w||c%1||h%1){var W=f9();return ei(c+W*(h-c+jr("1e-"+((W+"").length-1))),h)}return dy(c,h)}var Jie=lf(function(c,h,w){return h=h.toLowerCase(),c+(w?UA(h):h)});function UA(c){return jy(Cr(c).toLowerCase())}function qA(c){return c=Cr(c),c&&c.replace(tt,jQ).replace(qb,"")}function Xie(c,h,w){c=Cr(c),h=Bi(h);var L=c.length;w=w===r?L:Rc(ur(w),0,L);var W=w;return w-=h.length,w>=0&&c.slice(w,W)==h}function Zie(c){return c=Cr(c),c&&Tt.test(c)?c.replace(Ot,UQ):c}function Qie(c){return c=Cr(c),c&&Ft.test(c)?c.replace(nt,"\\$&"):c}var ese=lf(function(c,h,w){return c+(w?"-":"")+h.toLowerCase()}),tse=lf(function(c,h,w){return c+(w?" ":"")+h.toLowerCase()}),rse=W9("toLowerCase");function nse(c,h,w){c=Cr(c),h=ur(h);var L=h?nf(c):0;if(!h||L>=h)return c;var W=(h-L)/2;return Bp(Sp(W),w)+c+Bp(Ep(W),w)}function ise(c,h,w){c=Cr(c),h=ur(h);var L=h?nf(c):0;return h&&L>>0,w?(c=Cr(c),c&&(typeof h=="string"||h!=null&&!By(h))&&(h=Bi(h),!h&&rf(c))?Ba(Ms(c),0,w):c.split(h,w)):[]}var lse=lf(function(c,h,w){return c+(w?" ":"")+jy(h)});function hse(c,h,w){return c=Cr(c),w=w==null?0:Rc(ur(w),0,c.length),h=Bi(h),c.slice(w,w+h.length)==h}function dse(c,h,w){var L=re.templateSettings;w&&ci(c,h,w)&&(h=r),c=Cr(c),h=Yp({},h,L,Z9);var W=Yp({},h.imports,L.imports,Z9),ne=$n(W),de=Xb(W,ne),me,we,We=0,Ke=h.interpolate||At,Ze="__p += '",xt=Qb((h.escape||At).source+"|"+Ke.source+"|"+(Ke===Lt?xe:At).source+"|"+(h.evaluate||At).source+"|$","g"),Nt="//# sourceURL="+(Tr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++zb+"]")+` +`;c.replace(xt,function(Gt,br,Er,Fi,ui,ji){return Er||(Er=Fi),Ze+=c.slice(We,ji).replace(Rt,qQ),br&&(me=!0,Ze+=`' + __e(`+br+`) + '`),ui&&(we=!0,Ze+=`'; `+ui+`; __p += '`),Er&&(Ze+=`' + ((__t = (`+Er+`)) == null ? '' : __t) + -'`),We=Fi+Gt.length,Gt}),Ze+=`'; +'`),We=ji+Gt.length,Gt}),Ze+=`'; `;var Vt=Tr.call(h,"variable")&&h.variable;if(!Vt)Ze=`with (obj) { `+Ze+` } `;else if(oe.test(Vt))throw new tr(a);Ze=(we?Ze.replace(Jt,""):Ze).replace(St,"$1").replace(er,"$1;"),Ze="function("+(Vt||"obj")+`) { `+(Vt?"":`obj || (obj = {}); -`)+"var __t, __p = ''"+(ge?", __e = _.escape":"")+(we?`, __j = Array.prototype.join; +`)+"var __t, __p = ''"+(me?", __e = _.escape":"")+(we?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+Ze+`return __p -}`;var fr=NA(function(){return Mr(ne,Nt+"return "+Ze).apply(r,he)});if(fr.source=Ze,Ny(fr))throw fr;return fr}function fse(c){return Cr(c).toLowerCase()}function lse(c){return Cr(c).toUpperCase()}function hse(c,h,w){if(c=Cr(c),c&&(w||h===r))return z7(c);if(!c||!(h=ki(h)))return c;var L=Ps(c),W=Ps(h),ne=H7(L,W),he=W7(L,W)+1;return Na(L,ne,he).join("")}function dse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.slice(0,V7(c)+1);if(!c||!(h=ki(h)))return c;var L=Ps(c),W=W7(L,Ps(h))+1;return Na(L,0,W).join("")}function pse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.replace(B,"");if(!c||!(h=ki(h)))return c;var L=Ps(c),W=H7(L,Ps(h));return Na(L,W).join("")}function gse(c,h){var w=_e,L=G;if(Qr(h)){var W="separator"in h?h.separator:W;w="length"in h?ur(h.length):w,L="omission"in h?ki(h.omission):L}c=Cr(c);var ne=c.length;if(tf(c)){var he=Ps(c);ne=he.length}if(w>=ne)return c;var ge=w-rf(L);if(ge<1)return L;var we=he?Na(he,0,ge).join(""):c.slice(0,ge);if(W===r)return we+L;if(he&&(ge+=we.length-ge),Ly(W)){if(c.slice(ge).search(W)){var We,Ke=we;for(W.global||(W=Xb(W.source,Cr(Re.exec(W))+"g")),W.lastIndex=0;We=W.exec(Ke);)var Ze=We.index;we=we.slice(0,Ze===r?ge:Ze)}}else if(c.indexOf(ki(W),ge)!=ge){var xt=we.lastIndexOf(W);xt>-1&&(we=we.slice(0,xt))}return we+L}function mse(c){return c=Cr(c),c&&$t.test(c)?c.replace(Xt,WQ):c}var vse=ff(function(c,h,w){return c+(w?" ":"")+h.toUpperCase()}),By=L9("toUpperCase");function OA(c,h,w){return c=Cr(c),h=w?r:h,h===r?UQ(c)?GQ(c):RQ(c):c.match(h)||[]}var NA=hr(function(c,h){try{return $n(c,r,h)}catch(w){return Ny(w)?w:new tr(w)}}),bse=Ho(function(c,h){return is(h,function(w){w=io(w),qo(c,w,Dy(c[w],c))}),c});function yse(c){var h=c==null?0:c.length,w=qt();return c=h?Xr(c,function(L){if(typeof L[1]!="function")throw new ss(o);return[w(L[0]),L[1]]}):[],hr(function(L){for(var W=-1;++W_)return[];var w=M,L=ei(c,M);h=qt(h),c-=M;for(var W=Gb(L,h);++w0||h<0)?new xr(w):(c<0?w=w.takeRight(-c):c&&(w=w.drop(c)),h!==r&&(h=ur(h),w=h<0?w.dropRight(-h):w.take(h-c)),w)},xr.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},xr.prototype.toArray=function(){return this.take(M)},ro(xr.prototype,function(c,h){var w=/^(?:filter|find|map|reject)|While$/.test(h),L=/^(?:head|last)$/.test(h),W=re[L?"take"+(h=="last"?"Right":""):h],ne=L||/^find/.test(h);W&&(re.prototype[h]=function(){var he=this.__wrapped__,ge=L?[1]:arguments,we=he instanceof xr,We=ge[0],Ke=we||sr(he),Ze=function(br){var Er=W.apply(re,Ia([br],ge));return L&&xt?Er[0]:Er};Ke&&w&&typeof We=="function"&&We.length!=1&&(we=Ke=!1);var xt=this.__chain__,Nt=!!this.__actions__.length,Vt=ne&&!xt,fr=we&&!Nt;if(!ne&&Ke){he=fr?he:new xr(this);var Gt=c.apply(he,ge);return Gt.__actions__.push({func:qp,args:[Ze],thisArg:r}),new os(Gt,xt)}return Vt&&fr?c.apply(this,ge):(Gt=this.thru(Ze),Vt?L?Gt.value()[0]:Gt.value():Gt)})}),is(["pop","push","shift","sort","splice","unshift"],function(c){var h=pp[c],w=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",L=/^(?:pop|shift)$/.test(c);re.prototype[c]=function(){var W=arguments;if(L&&!this.__chain__){var ne=this.value();return h.apply(sr(ne)?ne:[],W)}return this[w](function(he){return h.apply(sr(he)?he:[],W)})}}),ro(xr.prototype,function(c,h){var w=re[h];if(w){var L=w.name+"";Tr.call(af,L)||(af[L]=[]),af[L].push({name:h,func:w})}}),af[Lp(r,k).name]=[{name:"wrapper",func:r}],xr.prototype.clone=mee,xr.prototype.reverse=vee,xr.prototype.value=bee,re.prototype.at=Vre,re.prototype.chain=Gre,re.prototype.commit=Yre,re.prototype.next=Jre,re.prototype.plant=Zre,re.prototype.reverse=Qre,re.prototype.toJSON=re.prototype.valueOf=re.prototype.value=ene,re.prototype.first=re.prototype.head,vh&&(re.prototype[vh]=Xre),re},nf=YQ();gn?((gn.exports=nf)._=nf,jr._=nf):_r._=nf}).call(nn)}(Qd,Qd.exports);var gq=Qd.exports,P1={exports:{}};(function(t,e){var r=typeof self<"u"?self:nn,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function u(f){return f&&DataView.prototype.isPrototypeOf(f)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(f){return f&&l.indexOf(Object.prototype.toString.call(f))>-1};function g(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function y(f){return typeof f!="string"&&(f=String(f)),f}function A(f){var p={next:function(){var v=f.shift();return{done:v===void 0,value:v}}};return a.iterable&&(p[Symbol.iterator]=function(){return p}),p}function P(f){this.map={},f instanceof P?f.forEach(function(p,v){this.append(v,p)},this):Array.isArray(f)?f.forEach(function(p){this.append(p[0],p[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(p){this.append(p,f[p])},this)}P.prototype.append=function(f,p){f=g(f),p=y(p);var v=this.map[f];this.map[f]=v?v+", "+p:p},P.prototype.delete=function(f){delete this.map[g(f)]},P.prototype.get=function(f){return f=g(f),this.has(f)?this.map[f]:null},P.prototype.has=function(f){return this.map.hasOwnProperty(g(f))},P.prototype.set=function(f,p){this.map[g(f)]=y(p)},P.prototype.forEach=function(f,p){for(var v in this.map)this.map.hasOwnProperty(v)&&f.call(p,this.map[v],v,this)},P.prototype.keys=function(){var f=[];return this.forEach(function(p,v){f.push(v)}),A(f)},P.prototype.values=function(){var f=[];return this.forEach(function(p){f.push(p)}),A(f)},P.prototype.entries=function(){var f=[];return this.forEach(function(p,v){f.push([v,p])}),A(f)},a.iterable&&(P.prototype[Symbol.iterator]=P.prototype.entries);function N(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function D(f){return new Promise(function(p,v){f.onload=function(){p(f.result)},f.onerror=function(){v(f.error)}})}function k(f){var p=new FileReader,v=D(p);return p.readAsArrayBuffer(f),v}function $(f){var p=new FileReader,v=D(p);return p.readAsText(f),v}function q(f){for(var p=new Uint8Array(f),v=new Array(p.length),x=0;x-1?p:f}function z(f,p){p=p||{};var v=p.body;if(f instanceof z){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,p.headers||(this.headers=new P(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!v&&f._bodyInit!=null&&(v=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=p.credentials||this.credentials||"same-origin",(p.headers||!this.headers)&&(this.headers=new P(p.headers)),this.method=T(p.method||this.method||"GET"),this.mode=p.mode||this.mode||null,this.signal=p.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(v)}z.prototype.clone=function(){return new z(this,{body:this._bodyInit})};function ue(f){var p=new FormData;return f.trim().split("&").forEach(function(v){if(v){var x=v.split("="),_=x.shift().replace(/\+/g," "),S=x.join("=").replace(/\+/g," ");p.append(decodeURIComponent(_),decodeURIComponent(S))}}),p}function _e(f){var p=new P,v=f.replace(/\r?\n[\t ]+/g," ");return v.split(/\r?\n/).forEach(function(x){var _=x.split(":"),S=_.shift().trim();if(S){var b=_.join(":").trim();p.append(S,b)}}),p}K.call(z.prototype);function G(f,p){p||(p={}),this.type="default",this.status=p.status===void 0?200:p.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in p?p.statusText:"OK",this.headers=new P(p.headers),this.url=p.url||"",this._initBody(f)}K.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new P(this.headers),url:this.url})},G.error=function(){var f=new G(null,{status:0,statusText:""});return f.type="error",f};var E=[301,302,303,307,308];G.redirect=function(f,p){if(E.indexOf(p)===-1)throw new RangeError("Invalid status code");return new G(null,{status:p,headers:{location:f}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(p,v){this.message=p,this.name=v;var x=Error(p);this.stack=x.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function m(f,p){return new Promise(function(v,x){var _=new z(f,p);if(_.signal&&_.signal.aborted)return x(new o.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function b(){S.abort()}S.onload=function(){var M={status:S.status,statusText:S.statusText,headers:_e(S.getAllResponseHeaders()||"")};M.url="responseURL"in S?S.responseURL:M.headers.get("X-Request-URL");var I="response"in S?S.response:S.responseText;v(new G(I,M))},S.onerror=function(){x(new TypeError("Network request failed"))},S.ontimeout=function(){x(new TypeError("Network request failed"))},S.onabort=function(){x(new o.DOMException("Aborted","AbortError"))},S.open(_.method,_.url,!0),_.credentials==="include"?S.withCredentials=!0:_.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&a.blob&&(S.responseType="blob"),_.headers.forEach(function(M,I){S.setRequestHeader(I,M)}),_.signal&&(_.signal.addEventListener("abort",b),S.onreadystatechange=function(){S.readyState===4&&_.signal.removeEventListener("abort",b)}),S.send(typeof _._bodyInit>"u"?null:_._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=P,s.Request=z,s.Response=G),o.Headers=P,o.Request=z,o.Response=G,o.fetch=m,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(P1,P1.exports);var mq=P1.exports;const R6=Ui(mq);var vq=Object.defineProperty,bq=Object.defineProperties,yq=Object.getOwnPropertyDescriptors,D6=Object.getOwnPropertySymbols,wq=Object.prototype.hasOwnProperty,xq=Object.prototype.propertyIsEnumerable,O6=(t,e,r)=>e in t?vq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,N6=(t,e)=>{for(var r in e||(e={}))wq.call(e,r)&&O6(t,r,e[r]);if(D6)for(var r of D6(e))xq.call(e,r)&&O6(t,r,e[r]);return t},L6=(t,e)=>bq(t,yq(e));const _q={Accept:"application/json","Content-Type":"application/json"},Eq="POST",k6={headers:_q,method:Eq},$6=10;let ws=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new qi.EventEmitter,this.isAvailable=!1,this.registering=!1,!k_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=go(e),n=await(await R6(this.url,L6(N6({},k6),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!k_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=go({id:1,jsonrpc:"2.0",method:"test",params:[]});await R6(e,L6(N6({},k6),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Wa(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Vd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return R_(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>$6&&this.events.setMaxListeners($6)}};const B6="error",Sq="wss://relay.walletconnect.org",Aq="wc",Pq="universal_provider",F6=`${Aq}@2:${Pq}:`,U6="https://rpc.walletconnect.org/v1/",Mu="generic",Mq=`${U6}bundler`,Qi={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Iq=Object.defineProperty,Cq=Object.defineProperties,Tq=Object.getOwnPropertyDescriptors,j6=Object.getOwnPropertySymbols,Rq=Object.prototype.hasOwnProperty,Dq=Object.prototype.propertyIsEnumerable,q6=(t,e,r)=>e in t?Iq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,e0=(t,e)=>{for(var r in e||(e={}))Rq.call(e,r)&&q6(t,r,e[r]);if(j6)for(var r of j6(e))Dq.call(e,r)&&q6(t,r,e[r]);return t},Oq=(t,e)=>Cq(t,Tq(e));function Di(t,e,r){var n;const i=_u(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${U6}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function uc(t){return t.includes(":")?t.split(":")[1]:t}function z6(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Nq(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function M1(t={},e={}){const r=H6(t),n=H6(e);return gq.merge(r,n)}function H6(t){var e,r,n,i;const s={};if(!El(t))return s;for(const[o,a]of Object.entries(t)){const u=f1(o)?[o]:a.chains,l=a.methods||[],d=a.events||[],g=a.rpcMap||{},y=_l(o);s[y]=Oq(e0(e0({},s[y]),a),{chains:Ud(u,(e=s[y])==null?void 0:e.chains),methods:Ud(l,(r=s[y])==null?void 0:r.methods),events:Ud(d,(n=s[y])==null?void 0:n.events),rpcMap:e0(e0({},g),(i=s[y])==null?void 0:i.rpcMap)})}return s}function Lq(t){return t.includes(":")?t.split(":")[2]:t}function W6(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=f1(r)?[r]:n.chains?n.chains:z6(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function I1(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const K6={},Ar=t=>K6[t],C1=(t,e)=>{K6[t]=e};class kq{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=uc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}}var $q=Object.defineProperty,Bq=Object.defineProperties,Fq=Object.getOwnPropertyDescriptors,V6=Object.getOwnPropertySymbols,Uq=Object.prototype.hasOwnProperty,jq=Object.prototype.propertyIsEnumerable,G6=(t,e,r)=>e in t?$q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Y6=(t,e)=>{for(var r in e||(e={}))Uq.call(e,r)&&G6(t,r,e[r]);if(V6)for(var r of V6(e))jq.call(e,r)&&G6(t,r,e[r]);return t},J6=(t,e)=>Bq(t,Fq(e));class qq{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(uc(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const u=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:J6(Y6({},o.sessionProperties||{}),{capabilities:J6(Y6({},a||{}),{[s]:u})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return u}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ha("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${Mq}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class zq{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=uc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}}let Hq=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=uc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}},Wq=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ji(new ws(n,Ar("disableProviderPing")))}},Kq=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=uc(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}},Vq=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=uc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}};class Gq{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=uc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}}let Yq=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new ws(n,Ar("disableProviderPing")))}};class Jq{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new ws(n))}}class Xq{constructor(e){this.name=Mu,this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=_u(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new ws(n,Ar("disableProviderPing")))}}var Zq=Object.defineProperty,Qq=Object.defineProperties,ez=Object.getOwnPropertyDescriptors,X6=Object.getOwnPropertySymbols,tz=Object.prototype.hasOwnProperty,rz=Object.prototype.propertyIsEnumerable,Z6=(t,e,r)=>e in t?Zq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,t0=(t,e)=>{for(var r in e||(e={}))tz.call(e,r)&&Z6(t,r,e[r]);if(X6)for(var r of X6(e))rz.call(e,r)&&Z6(t,r,e[r]);return t},T1=(t,e)=>Qq(t,ez(e));let Q6=class BA{constructor(e){this.events=new Yg,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Zf(sd({level:(e==null?void 0:e.logger)||B6})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new BA(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:t0({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,Kd(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Dr("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=W6(this.session.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=W6(s.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==I6)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Mu?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(nc(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await A1.init({core:this.providerOpts.core,logger:this.providerOpts.logger||B6,relayUrl:this.providerOpts.relayUrl||Sq,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>_l(r)))];C1("client",this.client),C1("events",this.events),C1("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Nq(r,this.session),i=z6(n),s=M1(this.namespaces,this.optionalNamespaces),o=T1(t0({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new qq({namespace:o});break;case"algorand":this.rpcProviders[r]=new Wq({namespace:o});break;case"solana":this.rpcProviders[r]=new zq({namespace:o});break;case"cosmos":this.rpcProviders[r]=new Hq({namespace:o});break;case"polkadot":this.rpcProviders[r]=new kq({namespace:o});break;case"cip34":this.rpcProviders[r]=new Kq({namespace:o});break;case"elrond":this.rpcProviders[r]=new Vq({namespace:o});break;case"multiversx":this.rpcProviders[r]=new Gq({namespace:o});break;case"near":this.rpcProviders[r]=new Yq({namespace:o});break;case"tezos":this.rpcProviders[r]=new Jq({namespace:o});break;default:this.rpcProviders[Mu]?this.rpcProviders[Mu].updateNamespace(o):this.rpcProviders[Mu]=new Xq({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&nc(i)&&this.events.emit("accountsChanged",i.map(Lq))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=_l(i),a=I1(i)!==I1(s)?`${o}:${I1(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=T1(t0({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",T1(t0({},Dr("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Qi.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Mu]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>_l(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=_l(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${F6}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${F6}/${e}`)}};const nz=Q6;function iz(){return new Promise(t=>{const e=[];let r;window.addEventListener("eip6963:announceProvider",n=>{const{detail:i}=n;r&&clearTimeout(r),e.push(i),r=setTimeout(()=>t(e),200)}),r=setTimeout(()=>t(e),200),window.dispatchEvent(new Event("eip6963:requestProvider"))})}class Gs{constructor(e,r){this.scope=e,this.module=r}storeObject(e,r){this.setItem(e,JSON.stringify(r))}loadObject(e){const r=this.getItem(e);return r?JSON.parse(r):void 0}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new Gs("CBWSDK").clear(),new Gs("walletlink").clear()}}const cn={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},R1={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},e5="Unspecified error message.",sz="Unspecified server error.";function D1(t,e=e5){if(t&&Number.isInteger(t)){const r=t.toString();if(O1(R1,r))return R1[r].message;if(t5(t))return sz}return e}function oz(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(R1[e]||t5(t))}function az(t,{shouldIncludeStack:e=!1}={}){const r={};if(t&&typeof t=="object"&&!Array.isArray(t)&&O1(t,"code")&&oz(t.code)){const n=t;r.code=n.code,n.message&&typeof n.message=="string"?(r.message=n.message,O1(n,"data")&&(r.data=n.data)):(r.message=D1(r.code),r.data={originalError:r5(t)})}else r.code=cn.rpc.internal,r.message=n5(t,"message")?t.message:e5,r.data={originalError:r5(t)};return e&&(r.stack=n5(t,"stack")?t.stack:void 0),r}function t5(t){return t>=-32099&&t<=-32e3}function r5(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function O1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function n5(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const Sr={rpc:{parse:t=>es(cn.rpc.parse,t),invalidRequest:t=>es(cn.rpc.invalidRequest,t),invalidParams:t=>es(cn.rpc.invalidParams,t),methodNotFound:t=>es(cn.rpc.methodNotFound,t),internal:t=>es(cn.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return es(e,t)},invalidInput:t=>es(cn.rpc.invalidInput,t),resourceNotFound:t=>es(cn.rpc.resourceNotFound,t),resourceUnavailable:t=>es(cn.rpc.resourceUnavailable,t),transactionRejected:t=>es(cn.rpc.transactionRejected,t),methodNotSupported:t=>es(cn.rpc.methodNotSupported,t),limitExceeded:t=>es(cn.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Iu(cn.provider.userRejectedRequest,t),unauthorized:t=>Iu(cn.provider.unauthorized,t),unsupportedMethod:t=>Iu(cn.provider.unsupportedMethod,t),disconnected:t=>Iu(cn.provider.disconnected,t),chainDisconnected:t=>Iu(cn.provider.chainDisconnected,t),unsupportedChain:t=>Iu(cn.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new o5(e,r,n)}}};function es(t,e){const[r,n]=i5(e);return new s5(t,r||D1(t),n)}function Iu(t,e){const[r,n]=i5(e);return new o5(t,r||D1(t),n)}function i5(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}class s5 extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}}class o5 extends s5{constructor(e,r,n){if(!cz(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}function cz(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function N1(){return t=>t}const Dl=N1(),uz=N1(),fz=N1();function Io(t){return Math.floor(t)}const a5=/^[0-9]*$/,c5=/^[a-f0-9]*$/;function fc(t){return L1(crypto.getRandomValues(new Uint8Array(t)))}function L1(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function r0(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function Ol(t,e=!1){const r=t.toString("hex");return Dl(e?`0x${r}`:r)}function k1(t){return Ol(F1(t),!0)}function Ys(t){return fz(t.toString(10))}function da(t){return Dl(`0x${BigInt(t).toString(16)}`)}function u5(t){return t.startsWith("0x")||t.startsWith("0X")}function $1(t){return u5(t)?t.slice(2):t}function f5(t){return u5(t)?`0x${t.slice(2)}`:`0x${t}`}function n0(t){if(typeof t!="string")return!1;const e=$1(t).toLowerCase();return c5.test(e)}function lz(t,e=!1){if(typeof t=="string"){const r=$1(t).toLowerCase();if(c5.test(r))return Dl(e?`0x${r}`:r)}throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function B1(t,e=!1){let r=lz(t,!1);return r.length%2===1&&(r=Dl(`0${r}`)),e?Dl(`0x${r}`):r}function pa(t){if(typeof t=="string"){const e=$1(t).toLowerCase();if(n0(e)&&e.length===40)return uz(f5(e))}throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function F1(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(n0(t)){const e=B1(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Sr.rpc.invalidParams(`Not binary data: ${String(t)}`)}function Nl(t){if(typeof t=="number"&&Number.isInteger(t))return Io(t);if(typeof t=="string"){if(a5.test(t))return Io(Number(t));if(n0(t))return Io(Number(BigInt(B1(t,!0))))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function Ll(t){if(t!==null&&(typeof t=="bigint"||dz(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(Nl(t));if(typeof t=="string"){if(a5.test(t))return BigInt(t);if(n0(t))return BigInt(B1(t,!0))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function hz(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Sr.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function dz(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function pz(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function gz(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function mz(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,new TextEncoder().encode(e));return{iv:r,cipherText:n}}async function vz(t,{iv:e,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return new TextDecoder().decode(n)}function l5(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function h5(t,e){const r=l5(t),n=await crypto.subtle.exportKey(r,e);return L1(new Uint8Array(n))}async function d5(t,e){const r=l5(t),n=r0(e).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function bz(t,e){const r=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return mz(e,r)}async function yz(t,e){return JSON.parse(await vz(e,t))}const U1={storageKey:"ownPrivateKey",keyType:"private"},j1={storageKey:"ownPublicKey",keyType:"public"},q1={storageKey:"peerPublicKey",keyType:"public"};class wz{constructor(){this.storage=new Gs("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(q1,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(j1.storageKey),this.storage.removeItem(U1.storageKey),this.storage.removeItem(q1.storageKey)}async generateKeyPair(){const e=await pz();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(U1,e.privateKey),await this.storeKey(j1,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(U1)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(j1)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(q1)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await gz(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const r=this.storage.getItem(e.storageKey);return r?d5(e.keyType,r):null}async storeKey(e,r){const n=await h5(e.keyType,r);this.storage.setItem(e.storageKey,n)}}const kl="4.2.4",p5="@coinbase/wallet-sdk";async function g5(t,e){const r=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":kl,"X-Cbw-Sdk-Platform":p5}}),{result:i,error:s}=await n.json();if(s)throw s;return i}function xz(){return globalThis.coinbaseWalletExtension}function _z(){var t,e;try{const r=globalThis;return(t=r.ethereum)!==null&&t!==void 0?t:(e=r.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Ez({metadata:t,preference:e}){var r,n;const{appName:i,appLogoUrl:s,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const u=xz();if(u)return(r=u.setAppInfo)===null||r===void 0||r.call(u,i,s,o,e),u}const a=_z();if(a!=null&&a.isCoinbaseBrowser)return(n=a.setAppInfo)===null||n===void 0||n.call(a,i,s,o,e),a}function Sz(t){if(!t||typeof t!="object"||Array.isArray(t))throw Sr.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:r}=t;if(typeof e!="string"||e.length===0)throw Sr.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Sr.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw Sr.provider.unsupportedMethod()}}const m5="accounts",v5="activeChain",b5="availableChains",y5="walletCapabilities";class Az{constructor(e){var r,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new wz,this.storage=new Gs("CBWSDK","SCWStateManager"),this.accounts=(r=this.storage.loadObject(m5))!==null&&r!==void 0?r:[],this.chain=this.storage.loadObject(v5)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var r,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(r=e.params)!==null&&r!==void 0?r:{})}}),s=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in s.content)throw s.content.failure;const o=await d5("public",s.sender);await this.keyManager.setPeerPublicKey(o);const u=(await this.decryptResponseMessage(s)).result;if("error"in u)throw u.error;const l=u.value;this.accounts=l,this.storage.storeObject(m5,l),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",l)}async request(e){var r;if(this.accounts.length===0)throw Sr.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:da(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return da(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(y5);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var r,n;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const i=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(i)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,r;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(r=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&r!==void 0?r:1}}async handleSwitchChainRequest(e){var r;const n=e.params;if(!n||!(!((r=n[0])===null||r===void 0)&&r.chainId))throw Sr.rpc.invalidParams();const i=Nl(n[0].chainId);if(this.updateChain(i))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(i),o}async sendEncryptedRequest(e){const r=await this.keyManager.getSharedSecret();if(!r)throw Sr.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await bz({action:e,chainId:this.chain.id},r),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const r=await h5("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:r,content:e,timestamp:new Date}}async decryptResponseMessage(e){var r,n;const i=e.content;if("failure"in i)throw i.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw Sr.provider.unauthorized("Invalid session");const o=await yz(i.encrypted,s),a=(r=o.data)===null||r===void 0?void 0:r.chains;if(a){const l=Object.entries(a).map(([d,g])=>({id:Number(d),rpcUrl:g}));this.storage.storeObject(b5,l),this.updateChain(this.chain.id,l)}const u=(n=o.data)===null||n===void 0?void 0:n.capabilities;return u&&this.storage.storeObject(y5,u),o}updateChain(e,r){var n;const i=r??this.storage.loadObject(b5),s=i==null?void 0:i.find(o=>o.id===e);return s?(s!==this.chain&&(this.chain=s,this.storage.storeObject(v5,s),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",da(s.id))),!0):!1}}const Pz=Jp(HP),{keccak_256:Mz}=Pz;function w5(t){return Buffer.allocUnsafe(t).fill(0)}function Iz(t){return t.toString(2).length}function x5(t,e){let r=t.toString(16);r.length%2!==0&&(r="0"+r);const n=r.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(r=I5(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(Js(t,e[s]));if(r==="dynamic"){var o=Js("uint256",e.length);i.unshift(o)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([Js("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,si.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Cu(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return si.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Cu(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=lc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+a);if(n<0)throw new Error("Supplied uint is negative");return si.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(r=Cu(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=lc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied int exceeds width: "+r+" vs "+a);const u=si.twosFromBigInt(n,256);return si.bufferBEFromBigInt(u,32)}else if(t.startsWith("ufixed")){if(r=M5(t),n=lc(e),n<0)throw new Error("Supplied ufixed is negative");return Js("uint256",n*BigInt(2)**BigInt(r[1]))}else if(t.startsWith("fixed"))return r=M5(t),Js("int256",lc(e)*BigInt(2)**BigInt(r[1]))}throw new Error("Unsupported or invalid type: "+t)}function Nz(t){return t==="string"||t==="bytes"||I5(t)==="dynamic"}function Lz(t){return t.lastIndexOf("]")===t.length-1}function kz(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var o=P5(t[s]),a=e[s],u=Js(o,a);Nz(o)?(r.push(Js("uint256",i)),n.push(u),i+=u.length):r.push(u)}return Buffer.concat(r.concat(n))}function C5(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(si.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=Cu(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=lc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+u);i.push(si.bufferBEFromBigInt(n,r/8))}else if(o.startsWith("int")){if(r=Cu(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=lc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied int exceeds width: "+r+" vs "+u);const l=si.twosFromBigInt(n,r);i.push(si.bufferBEFromBigInt(l,r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function $z(t,e){return si.keccak(C5(t,e))}var Bz={rawEncode:kz,solidityPack:C5,soliditySHA3:$z};const xs=A5,$l=Bz,T5={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},z1={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const o=(a,u,l)=>{if(r[u]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":xs.keccak(this.encodeData(u,l,r,n))];if(l===void 0)throw new Error(`missing value for field ${a} of type ${u}`);if(u==="bytes")return["bytes32",xs.keccak(l)];if(u==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",xs.keccak(l)];if(u.lastIndexOf("]")===u.length-1){const d=u.slice(0,u.lastIndexOf("[")),g=l.map(y=>o(a,d,y));return["bytes32",xs.keccak($l.rawEncode(g.map(([y])=>y),g.map(([,y])=>y)))]}return[u,l]};for(const a of r[t]){const[u,l]=o(a.name,a.type,e[a.name]);i.push(u),s.push(l)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=xs.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=xs.keccak(a),s.push(a);else if(r[o.type]!==void 0)i.push("bytes32"),a=xs.keccak(this.encodeData(o.type,a,r,n)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return $l.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return xs.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return xs.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in T5.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),xs.keccak(Buffer.concat(n))}};var Fz={TYPED_MESSAGE_SCHEMA:T5,TypedDataUtils:z1,hashForSignTypedDataLegacy:function(t){return Uz(t.data)},hashForSignTypedData_v3:function(t){return z1.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return z1.hash(t.data)}};function Uz(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?xs.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return $l.soliditySHA3(["bytes32","bytes32"],[$l.soliditySHA3(new Array(t.length).fill("string"),i),$l.soliditySHA3(n,r)])}const s0=Ui(Fz),jz="walletUsername",H1="Addresses",qz="AppVersion";function zn(t){return t.errorMessage!==void 0}class zz{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",r0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),a=16,u=o.slice(o.byteLength-a),l=o.slice(0,o.byteLength-a),d=new Uint8Array(u),g=new Uint8Array(l),y=new Uint8Array([...n,...d,...g]);return L1(y)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",r0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=r0(e),a=o.slice(0,12),u=o.slice(12,28),l=o.slice(28),d=new Uint8Array([...l,...u]),g={name:"AES-GCM",iv:new Uint8Array(a)};try{const y=await window.crypto.subtle.decrypt(g,s,d),A=new TextDecoder;n(A.decode(y))}catch(y){i(y)}})()})}}class Hz{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}var Co;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(Co||(Co={}));class Wz{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,Co.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,Co.DISCONNECTED)},i.onopen=s=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,Co.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(u=>this.sendData(u)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const u=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,u)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,Co.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const R5=1e4,Kz=6e4;class Vz{constructor({session:e,linkAPIUrl:r,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Io(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,u)=>{const l=s[u];l!==void 0&&a(l)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,u)},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(jz,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(qz,s)},this.handleChainUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(s),l=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(u,l)},this.session=e,this.cipher=new zz(e.secret),this.listener=n;const i=new Wz(`${r}/rpc`,WebSocket);i.setConnectionStateListener(async s=>{let o=!1;switch(s){case Co.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(u=>setTimeout(u,5e3)),this.destroyed||i.connect().catch(()=>{a()})};a()}break;case Co.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},R5),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case Co.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(s=>{var o;switch(s.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=s.type==="IsLinkedOK"?s.linked:void 0;this.linked=a||s.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(s.metadata);break}case"Event":{this.handleIncomingEvent(s);break}}s.id!==void 0&&((o=this.requestResolutions.get(s.id))===null||o===void 0||o(s))}),this.ws=i,this.http=new Hz(r,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Io(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:s,response:o}=i;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s,o)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Io(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>R5*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r={timeout:Kz}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r.timeout)}),new Promise(s=>{this.requestResolutions.set(n,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Io(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Io(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Io(this.nextReqId++),sessionId:this.session.id}),!0)}}class Gz{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=f5(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}const D5="session:id",O5="session:secret",N5="session:linked";class Tu{constructor(e,r,n,i=!1){this.storage=e,this.id=r,this.secret=n,this.key=EP(Pg(`${r}, ${n} WalletLink`)),this._linked=!!i}static create(e){const r=fc(16),n=fc(32);return new Tu(e,r,n).save()}static load(e){const r=e.getItem(D5),n=e.getItem(N5),i=e.getItem(O5);return r&&i?new Tu(e,r,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(D5,this.id),this.storage.setItem(O5,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(N5,this._linked?"1":"0")}}function Yz(){try{return window.frameElement!==null}catch{return!1}}function Jz(){try{return Yz()&&window.top?window.top.location:window.location}catch{return window.location}}function Xz(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function L5(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const Zz='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function k5(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(Zz)),document.documentElement.appendChild(t)}function $5(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e2&&(o.children=arguments.length>3?o0.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return a0(t,o,n,i,null)}function a0(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++B5,__i:-1,__u:0};return i==null&&Vr.vnode!=null&&Vr.vnode(s),s}function Ul(t){return t.children}function c0(t,e){this.props=t,this.context=e}function Ru(t,e){if(e==null)return t.__?Ru(t.__,t.__i+1):null;for(var r;ee&&hc.sort(W1));u0.__r=0}function W5(t,e,r,n,i,s,o,a,u,l,d){var g,y,A,P,N,D,k=n&&n.__k||q5,$=e.length;for(u=eH(r,e,k,u),g=0;g<$;g++)(A=r.__k[g])!=null&&(y=A.__i===-1?Fl:k[A.__i]||Fl,A.__i=g,D=X1(t,A,y,i,s,o,a,u,l,d),P=A.__e,A.ref&&y.ref!=A.ref&&(y.ref&&Z1(y.ref,null,A),d.push(A.ref,A.__c||P,A)),N==null&&P!=null&&(N=P),4&A.__u||y.__k===A.__k?u=K5(A,u,t):typeof A.type=="function"&&D!==void 0?u=D:P&&(u=P.nextSibling),A.__u&=-7);return r.__e=N,u}function eH(t,e,r,n){var i,s,o,a,u,l=e.length,d=r.length,g=d,y=0;for(t.__k=[],i=0;i0?a0(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,(u=s.__i=tH(s,r,a,g))!==-1&&(g--,(o=r[u])&&(o.__u|=2)),o==null||o.__v===null?(u==-1&&y--,typeof s.type!="function"&&(s.__u|=4)):u!==a&&(u==a-1?y--:u==a+1?y++:(u>a?y--:y++,s.__u|=4))):s=t.__k[i]=null;if(g)for(i=0;i(u!=null&&!(2&u.__u)?1:0))for(;o>=0||a=0){if((u=e[o])&&!(2&u.__u)&&i==u.key&&s===u.type)return o;o--}if(a=r.__.length&&r.__.push({}),r.__[t]}function o4(t){return tv=1,iH(c4,t)}function iH(t,e,r){var n=s4(l0++,2);if(n.t=t,!n.__c&&(n.__=[c4(void 0,e),function(a){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,a);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=un,!un.u)){var i=function(a,u,l){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(y){return!!y.__c});if(d.every(function(y){return!y.__N}))return!s||s.call(this,a,u,l);var g=n.__c.props!==a;return d.forEach(function(y){if(y.__N){var A=y.__[0];y.__=y.__N,y.__N=void 0,A!==y.__[0]&&(g=!0)}}),s&&s.call(this,a,u,l)||g};un.u=!0;var s=un.shouldComponentUpdate,o=un.componentWillUpdate;un.componentWillUpdate=function(a,u,l){if(this.__e){var d=s;s=void 0,i(a,u,l),s=d}o&&o.call(this,a,u,l)},un.shouldComponentUpdate=i}return n.__N||n.__}function sH(t,e){var r=s4(l0++,3);!yn.__s&&cH(r.__H,e)&&(r.__=t,r.i=e,un.__H.__h.push(r))}function oH(){for(var t;t=Z5.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(h0),t.__H.__h.forEach(rv),t.__H.__h=[]}catch(e){t.__H.__h=[],yn.__e(e,t.__v)}}yn.__b=function(t){un=null,Q5&&Q5(t)},yn.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),i4&&i4(t,e)},yn.__r=function(t){e4&&e4(t),l0=0;var e=(un=t.__c).__H;e&&(ev===un?(e.__h=[],un.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(h0),e.__h.forEach(rv),e.__h=[],l0=0)),ev=un},yn.diffed=function(t){t4&&t4(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Z5.push(e)!==1&&X5===yn.requestAnimationFrame||((X5=yn.requestAnimationFrame)||aH)(oH)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),ev=un=null},yn.__c=function(t,e){e.some(function(r){try{r.__h.forEach(h0),r.__h=r.__h.filter(function(n){return!n.__||rv(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],yn.__e(n,r.__v)}}),r4&&r4(t,e)},yn.unmount=function(t){n4&&n4(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{h0(n)}catch(i){e=i}}),r.__H=void 0,e&&yn.__e(e,r.__v))};var a4=typeof requestAnimationFrame=="function";function aH(t){var e,r=function(){clearTimeout(n),a4&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);a4&&(e=requestAnimationFrame(r))}function h0(t){var e=un,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),un=e}function rv(t){var e=un;t.__c=t.__(),un=e}function cH(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function c4(t,e){return typeof e=="function"?e(t):e}const uH=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",fH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",lH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class hH{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=L5()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const r=this.nextItemKey++;return this.items.set(r,e),this.render(),()=>{this.items.delete(r),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&Q1(Or("div",null,Or(u4,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,r])=>Or(dH,Object.assign({},r,{key:e}))))),this.root)}}const u4=t=>Or("div",{class:Bl("-cbwsdk-snackbar-container")},Or("style",null,uH),Or("div",{class:"-cbwsdk-snackbar"},t.children)),dH=({autoExpand:t,message:e,menuItems:r})=>{const[n,i]=o4(!0),[s,o]=o4(t??!1);sH(()=>{const u=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{u.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return Or("div",{class:Bl("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},Or("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},Or("img",{src:fH,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",Or("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),Or("div",{class:"-gear-container"},!s&&Or("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),Or("img",{src:lH,class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&Or("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((u,l)=>Or("div",{class:Bl("-cbwsdk-snackbar-instance-menu-item",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:u.onClick,key:l},Or("svg",{width:u.svgWidth,height:u.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("path",{"fill-rule":u.defaultFillRule,"clip-rule":u.defaultClipRule,d:u.path,fill:"#AAAAAA"})),Or("span",{class:Bl("-cbwsdk-snackbar-instance-menu-item-info",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},u.info)))))};class pH{constructor(){this.attached=!1,this.snackbar=new hH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.snackbar.attach(r),this.attached=!0,k5()}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}}const gH=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class mH{constructor(){this.root=null,this.darkMode=L5()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),k5()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(Q1(null,this.root),e&&Q1(Or(vH,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const vH=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return Or(u4,{darkMode:r},Or("div",{class:"-cbwsdk-redirect-dialog"},Or("style",null,gH),Or("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),Or("div",{class:Bl("-cbwsdk-redirect-dialog-box",s)},Or("p",null,t),Or("button",{onClick:n},e))))},bH="https://keys.coinbase.com/connect",f4="https://www.walletlink.org",yH="https://go.cb-w.com/walletlink";class l4{constructor(){this.attached=!1,this.redirectDialog=new mH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const r=new URL(yH);r.searchParams.append("redirect_url",Jz().href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class To{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=Xz(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(H1);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!u&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),To.accountRequestCallbackIds.size>0&&(Array.from(To.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),To.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new Gz,this.ui=n,this.ui.attach()}subscribe(){const e=Tu.load(this.storage)||Tu.create(this.storage),{linkAPIUrl:r}=this,n=new Vz({session:e,linkAPIUrl:r,listener:this}),i=this.isMobileWeb?new l4:new pH;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=Tu.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Gs.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Ys(e.weiValue),data:Ol(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Ys(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?Ys(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?Ys(e.gasPriceInWei):null,gasLimit:e.gasLimit?Ys(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Ys(e.weiValue),data:Ol(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Ys(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?Ys(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?Ys(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?Ys(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Ol(e,!0),chainId:r}})}getWalletLinkSession(){return this._session}sendRequest(e){let r=null;const n=fc(8),i=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,s),r==null||r()};return new Promise((s,o)=>{r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,a=>{if(r==null||r(),zn(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,r){const n={type:"WEB3_REQUEST",id:e,request:r};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:r.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(r.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof l4)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e,r){if(r.method==="requestEthereumAccounts"){To.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,r)),To.accountRequestCallbackIds.clear();return}this.invokeCallback(e,r)}handleErrorResponse(e,r,n){var i;const s=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:r,errorMessage:s})}invokeCallback(e,r){const n=this.relayEventManager.callbacks.get(e);n&&(n(r),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:r}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:r}},i=fc(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(zn(a))return o(new Error(a.errorMessage));s(a)}),To.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,r,n,i,s,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:o}};let u=null;const l=fc(8),d=g=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,g),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((g,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),zn(A))return y(new Error(A.errorMessage));g(A)}),this.publishWeb3RequestEvent(l,a)})}addEthereumChain(e,r,n,i,s,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:o}};let u=null;const l=fc(8),d=g=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,g),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((g,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),zn(A))return y(new Error(A.errorMessage));g(A)}),this.publishWeb3RequestEvent(l,a)})}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})};let i=null;const s=fc(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,u)=>{this.relayEventManager.callbacks.set(s,l=>{if(i==null||i(),zn(l)&&l.errorCode)return u(Sr.provider.custom({code:l.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(zn(l))return u(new Error(l.errorMessage));a(l)}),this.publishWeb3RequestEvent(s,n)})}}To.accountRequestCallbackIds=new Set;const h4="DefaultChainId",d4="DefaultJsonRpcUrl";class p4{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new Gs("walletlink",f4),this.callback=e.callback||null;const r=this._storage.getItem(H1);if(r){const n=r.split(" ");n[0]!==""&&(this._addresses=n.map(i=>pa(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:r,secret:n}=e.getWalletLinkSession();return{id:r,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(d4))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(d4,e)}updateProviderInfo(e,r){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(h4,r.toString(10)),Nl(r)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",da(r)))}async watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw Sr.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw Sr.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw Sr.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw Sr.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=r.options,l=await this.initializeRelay().watchAsset(r.type,i,s,a,o,n==null?void 0:n.toString());return zn(l)?!1:!!l.result}async addEthereumChain(e){var r,n;const i=e[0];if(((r=i.rpcUrls)===null||r===void 0?void 0:r.length)===0)throw Sr.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw Sr.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw Sr.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:u=[],chainName:l,iconUrls:d=[],nativeCurrency:g}=i,y=await o.addEthereumChain(s.toString(),a,d,u,l,g);if(zn(y))return!1;if(((n=y.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw Sr.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const r=e[0],n=Number.parseInt(r.chainId,16),s=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(zn(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,r){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(s=>pa(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(H1,i.join(" ")))}async request(e){const r=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return da(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(r);case"wallet_switchEthereumChain":return this.switchEthereumChain(r);case"wallet_watchAsset":return this.watchAsset(r);default:if(!this.jsonRpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const r=pa(e);if(!this._addresses.map(i=>pa(i)).includes(r))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?pa(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?pa(e.to):null,i=e.value!=null?Ll(e.value):BigInt(0),s=e.data?F1(e.data):Buffer.alloc(0),o=e.nonce!=null?Nl(e.nonce):null,a=e.gasPrice!=null?Ll(e.gasPrice):null,u=e.maxFeePerGas!=null?Ll(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?Ll(e.maxPriorityFeePerGas):null,d=e.gas!=null?Ll(e.gas):null,g=e.chainId?Nl(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:u,maxPriorityFeePerGas:l,gasLimit:d,chainId:g}}async ecRecover(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:k1(n[0]),signature:k1(n[1]),addPrefix:r==="personal_ecRecover"}});if(zn(s))throw s;return s.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(h4))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,r;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:da(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(zn(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:da(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw Sr.rpc.invalidParams();const r=e[1],n=e[0];this._ensureKnownAddress(r);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:pa(r),message:k1(n),addPrefix:!0,typedDataJson:null}});if(zn(s))throw s;return s.result}async _eth_signTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(r);if(zn(i))throw i;return i.result}async _eth_sendRawTransaction(e){const r=F1(e[0]),i=await this.initializeRelay().submitEthereumTransaction(r,this.getChainId());if(zn(i))throw i;return i.result}async _eth_sendTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(r);if(zn(i))throw i;return i.result}async signTypedData(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const i=l=>{const d={eth_signTypedData_v1:s0.hashForSignTypedDataLegacy,eth_signTypedData_v3:s0.hashForSignTypedData_v3,eth_signTypedData_v4:s0.hashForSignTypedData_v4,eth_signTypedData:s0.hashForSignTypedData_v4};return Ol(d[r]({data:hz(l)}),!0)},s=n[r==="eth_signTypedData_v1"?1:0],o=n[r==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const u=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:pa(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(zn(u))throw u;return u.result}initializeRelay(){return this._relay||(this._relay=new To({linkAPIUrl:f4,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const g4="SignerType",m4=new Gs("CBWSDK","SignerConfigurator");function wH(){return m4.getItem(g4)}function xH(t){m4.setItem(g4,t)}async function _H(t){const{communicator:e,metadata:r,handshakeRequest:n,callback:i}=t;SH(e,r,i).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:o}=await e.postRequestAndWaitForResponse(s);return o}function EH(t){const{signerType:e,metadata:r,communicator:n,callback:i}=t;switch(e){case"scw":return new Az({metadata:r,callback:i,communicator:n});case"walletlink":return new p4({metadata:r,callback:i})}}async function SH(t,e,r){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new p4({metadata:e,callback:r});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const AH=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. +}`;var fr=HA(function(){return Mr(ne,Nt+"return "+Ze).apply(r,de)});if(fr.source=Ze,ky(fr))throw fr;return fr}function pse(c){return Cr(c).toLowerCase()}function gse(c){return Cr(c).toUpperCase()}function mse(c,h,w){if(c=Cr(c),c&&(w||h===r))return Q7(c);if(!c||!(h=Bi(h)))return c;var L=Ms(c),W=Ms(h),ne=e9(L,W),de=t9(L,W)+1;return Ba(L,ne,de).join("")}function vse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.slice(0,n9(c)+1);if(!c||!(h=Bi(h)))return c;var L=Ms(c),W=t9(L,Ms(h))+1;return Ba(L,0,W).join("")}function bse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.replace($,"");if(!c||!(h=Bi(h)))return c;var L=Ms(c),W=e9(L,Ms(h));return Ba(L,W).join("")}function yse(c,h){var w=_e,L=G;if(Qr(h)){var W="separator"in h?h.separator:W;w="length"in h?ur(h.length):w,L="omission"in h?Bi(h.omission):L}c=Cr(c);var ne=c.length;if(rf(c)){var de=Ms(c);ne=de.length}if(w>=ne)return c;var me=w-nf(L);if(me<1)return L;var we=de?Ba(de,0,me).join(""):c.slice(0,me);if(W===r)return we+L;if(de&&(me+=we.length-me),By(W)){if(c.slice(me).search(W)){var We,Ke=we;for(W.global||(W=Qb(W.source,Cr(Re.exec(W))+"g")),W.lastIndex=0;We=W.exec(Ke);)var Ze=We.index;we=we.slice(0,Ze===r?me:Ze)}}else if(c.indexOf(Bi(W),me)!=me){var xt=we.lastIndexOf(W);xt>-1&&(we=we.slice(0,xt))}return we+L}function wse(c){return c=Cr(c),c&&Bt.test(c)?c.replace(Xt,YQ):c}var xse=lf(function(c,h,w){return c+(w?" ":"")+h.toUpperCase()}),jy=W9("toUpperCase");function zA(c,h,w){return c=Cr(c),h=w?r:h,h===r?HQ(c)?ZQ(c):LQ(c):c.match(h)||[]}var HA=hr(function(c,h){try{return Bn(c,r,h)}catch(w){return ky(w)?w:new tr(w)}}),_se=Vo(function(c,h){return ss(h,function(w){w=ao(w),Wo(c,w,Ny(c[w],c))}),c});function Ese(c){var h=c==null?0:c.length,w=qt();return c=h?Xr(c,function(L){if(typeof L[1]!="function")throw new os(o);return[w(L[0]),L[1]]}):[],hr(function(L){for(var W=-1;++W_)return[];var w=M,L=ei(c,M);h=qt(h),c-=M;for(var W=Jb(L,h);++w0||h<0)?new xr(w):(c<0?w=w.takeRight(-c):c&&(w=w.drop(c)),h!==r&&(h=ur(h),w=h<0?w.dropRight(-h):w.take(h-c)),w)},xr.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},xr.prototype.toArray=function(){return this.take(M)},so(xr.prototype,function(c,h){var w=/^(?:filter|find|map|reject)|While$/.test(h),L=/^(?:head|last)$/.test(h),W=re[L?"take"+(h=="last"?"Right":""):h],ne=L||/^find/.test(h);W&&(re.prototype[h]=function(){var de=this.__wrapped__,me=L?[1]:arguments,we=de instanceof xr,We=me[0],Ke=we||sr(de),Ze=function(br){var Er=W.apply(re,Ra([br],me));return L&&xt?Er[0]:Er};Ke&&w&&typeof We=="function"&&We.length!=1&&(we=Ke=!1);var xt=this.__chain__,Nt=!!this.__actions__.length,Vt=ne&&!xt,fr=we&&!Nt;if(!ne&&Ke){de=fr?de:new xr(this);var Gt=c.apply(de,me);return Gt.__actions__.push({func:qp,args:[Ze],thisArg:r}),new as(Gt,xt)}return Vt&&fr?c.apply(this,me):(Gt=this.thru(Ze),Vt?L?Gt.value()[0]:Gt.value():Gt)})}),ss(["pop","push","shift","sort","splice","unshift"],function(c){var h=pp[c],w=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",L=/^(?:pop|shift)$/.test(c);re.prototype[c]=function(){var W=arguments;if(L&&!this.__chain__){var ne=this.value();return h.apply(sr(ne)?ne:[],W)}return this[w](function(de){return h.apply(sr(de)?de:[],W)})}}),so(xr.prototype,function(c,h){var w=re[h];if(w){var L=w.name+"";Tr.call(cf,L)||(cf[L]=[]),cf[L].push({name:h,func:w})}}),cf[Lp(r,k).name]=[{name:"wrapper",func:r}],xr.prototype.clone=wee,xr.prototype.reverse=xee,xr.prototype.value=_ee,re.prototype.at=Xre,re.prototype.chain=Zre,re.prototype.commit=Qre,re.prototype.next=ene,re.prototype.plant=rne,re.prototype.reverse=nne,re.prototype.toJSON=re.prototype.valueOf=re.prototype.value=ine,re.prototype.first=re.prototype.head,bh&&(re.prototype[bh]=tne),re},sf=QQ();gn?((gn.exports=sf)._=sf,Ur._=sf):_r._=sf}).call(nn)}(e0,e0.exports);var Aq=e0.exports,P1={exports:{}};(function(t,e){var r=typeof self<"u"?self:nn,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function u(f){return f&&DataView.prototype.isPrototypeOf(f)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(f){return f&&l.indexOf(Object.prototype.toString.call(f))>-1};function g(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function y(f){return typeof f!="string"&&(f=String(f)),f}function A(f){var p={next:function(){var v=f.shift();return{done:v===void 0,value:v}}};return a.iterable&&(p[Symbol.iterator]=function(){return p}),p}function P(f){this.map={},f instanceof P?f.forEach(function(p,v){this.append(v,p)},this):Array.isArray(f)?f.forEach(function(p){this.append(p[0],p[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(p){this.append(p,f[p])},this)}P.prototype.append=function(f,p){f=g(f),p=y(p);var v=this.map[f];this.map[f]=v?v+", "+p:p},P.prototype.delete=function(f){delete this.map[g(f)]},P.prototype.get=function(f){return f=g(f),this.has(f)?this.map[f]:null},P.prototype.has=function(f){return this.map.hasOwnProperty(g(f))},P.prototype.set=function(f,p){this.map[g(f)]=y(p)},P.prototype.forEach=function(f,p){for(var v in this.map)this.map.hasOwnProperty(v)&&f.call(p,this.map[v],v,this)},P.prototype.keys=function(){var f=[];return this.forEach(function(p,v){f.push(v)}),A(f)},P.prototype.values=function(){var f=[];return this.forEach(function(p){f.push(p)}),A(f)},P.prototype.entries=function(){var f=[];return this.forEach(function(p,v){f.push([v,p])}),A(f)},a.iterable&&(P.prototype[Symbol.iterator]=P.prototype.entries);function O(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function D(f){return new Promise(function(p,v){f.onload=function(){p(f.result)},f.onerror=function(){v(f.error)}})}function k(f){var p=new FileReader,v=D(p);return p.readAsArrayBuffer(f),v}function B(f){var p=new FileReader,v=D(p);return p.readAsText(f),v}function j(f){for(var p=new Uint8Array(f),v=new Array(p.length),x=0;x-1?p:f}function z(f,p){p=p||{};var v=p.body;if(f instanceof z){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,p.headers||(this.headers=new P(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!v&&f._bodyInit!=null&&(v=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=p.credentials||this.credentials||"same-origin",(p.headers||!this.headers)&&(this.headers=new P(p.headers)),this.method=T(p.method||this.method||"GET"),this.mode=p.mode||this.mode||null,this.signal=p.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(v)}z.prototype.clone=function(){return new z(this,{body:this._bodyInit})};function ue(f){var p=new FormData;return f.trim().split("&").forEach(function(v){if(v){var x=v.split("="),_=x.shift().replace(/\+/g," "),S=x.join("=").replace(/\+/g," ");p.append(decodeURIComponent(_),decodeURIComponent(S))}}),p}function _e(f){var p=new P,v=f.replace(/\r?\n[\t ]+/g," ");return v.split(/\r?\n/).forEach(function(x){var _=x.split(":"),S=_.shift().trim();if(S){var b=_.join(":").trim();p.append(S,b)}}),p}K.call(z.prototype);function G(f,p){p||(p={}),this.type="default",this.status=p.status===void 0?200:p.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in p?p.statusText:"OK",this.headers=new P(p.headers),this.url=p.url||"",this._initBody(f)}K.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new P(this.headers),url:this.url})},G.error=function(){var f=new G(null,{status:0,statusText:""});return f.type="error",f};var E=[301,302,303,307,308];G.redirect=function(f,p){if(E.indexOf(p)===-1)throw new RangeError("Invalid status code");return new G(null,{status:p,headers:{location:f}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(p,v){this.message=p,this.name=v;var x=Error(p);this.stack=x.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function m(f,p){return new Promise(function(v,x){var _=new z(f,p);if(_.signal&&_.signal.aborted)return x(new o.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function b(){S.abort()}S.onload=function(){var M={status:S.status,statusText:S.statusText,headers:_e(S.getAllResponseHeaders()||"")};M.url="responseURL"in S?S.responseURL:M.headers.get("X-Request-URL");var I="response"in S?S.response:S.responseText;v(new G(I,M))},S.onerror=function(){x(new TypeError("Network request failed"))},S.ontimeout=function(){x(new TypeError("Network request failed"))},S.onabort=function(){x(new o.DOMException("Aborted","AbortError"))},S.open(_.method,_.url,!0),_.credentials==="include"?S.withCredentials=!0:_.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&a.blob&&(S.responseType="blob"),_.headers.forEach(function(M,I){S.setRequestHeader(I,M)}),_.signal&&(_.signal.addEventListener("abort",b),S.onreadystatechange=function(){S.readyState===4&&_.signal.removeEventListener("abort",b)}),S.send(typeof _._bodyInit>"u"?null:_._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=P,s.Request=z,s.Response=G),o.Headers=P,o.Request=z,o.Response=G,o.fetch=m,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(P1,P1.exports);var Pq=P1.exports;const O6=Ui(Pq);var Mq=Object.defineProperty,Iq=Object.defineProperties,Cq=Object.getOwnPropertyDescriptors,N6=Object.getOwnPropertySymbols,Tq=Object.prototype.hasOwnProperty,Rq=Object.prototype.propertyIsEnumerable,L6=(t,e,r)=>e in t?Mq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,k6=(t,e)=>{for(var r in e||(e={}))Tq.call(e,r)&&L6(t,r,e[r]);if(N6)for(var r of N6(e))Rq.call(e,r)&&L6(t,r,e[r]);return t},B6=(t,e)=>Iq(t,Cq(e));const Dq={Accept:"application/json","Content-Type":"application/json"},Oq="POST",$6={headers:Dq,method:Oq},F6=10;let xs=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new zi.EventEmitter,this.isAvailable=!1,this.registering=!1,!$_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=bo(e),n=await(await O6(this.url,B6(k6({},$6),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!$_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=bo({id:1,jsonrpc:"2.0",method:"test",params:[]});await O6(e,B6(k6({},$6),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ga(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return O_(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>F6&&this.events.setMaxListeners(F6)}};const j6="error",Nq="wss://relay.walletconnect.org",Lq="wc",kq="universal_provider",U6=`${Lq}@2:${kq}:`,q6="https://rpc.walletconnect.org/v1/",Iu="generic",Bq=`${q6}bundler`,es={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var $q=Object.defineProperty,Fq=Object.defineProperties,jq=Object.getOwnPropertyDescriptors,z6=Object.getOwnPropertySymbols,Uq=Object.prototype.hasOwnProperty,qq=Object.prototype.propertyIsEnumerable,H6=(t,e,r)=>e in t?$q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,t0=(t,e)=>{for(var r in e||(e={}))Uq.call(e,r)&&H6(t,r,e[r]);if(z6)for(var r of z6(e))qq.call(e,r)&&H6(t,r,e[r]);return t},zq=(t,e)=>Fq(t,jq(e));function Di(t,e,r){var n;const i=Eu(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${q6}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function hc(t){return t.includes(":")?t.split(":")[1]:t}function W6(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Hq(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function M1(t={},e={}){const r=K6(t),n=K6(e);return Aq.merge(r,n)}function K6(t){var e,r,n,i;const s={};if(!Sl(t))return s;for(const[o,a]of Object.entries(t)){const u=f1(o)?[o]:a.chains,l=a.methods||[],d=a.events||[],g=a.rpcMap||{},y=El(o);s[y]=zq(t0(t0({},s[y]),a),{chains:Ud(u,(e=s[y])==null?void 0:e.chains),methods:Ud(l,(r=s[y])==null?void 0:r.methods),events:Ud(d,(n=s[y])==null?void 0:n.events),rpcMap:t0(t0({},g),(i=s[y])==null?void 0:i.rpcMap)})}return s}function Wq(t){return t.includes(":")?t.split(":")[2]:t}function V6(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=f1(r)?[r]:n.chains?n.chains:W6(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function I1(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const G6={},Ar=t=>G6[t],C1=(t,e)=>{G6[t]=e};class Kq{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=hc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Xi(new xs(n,Ar("disableProviderPing")))}}var Vq=Object.defineProperty,Gq=Object.defineProperties,Yq=Object.getOwnPropertyDescriptors,Y6=Object.getOwnPropertySymbols,Jq=Object.prototype.hasOwnProperty,Xq=Object.prototype.propertyIsEnumerable,J6=(t,e,r)=>e in t?Vq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,X6=(t,e)=>{for(var r in e||(e={}))Jq.call(e,r)&&J6(t,r,e[r]);if(Y6)for(var r of Y6(e))Xq.call(e,r)&&J6(t,r,e[r]);return t},Z6=(t,e)=>Gq(t,Yq(e));class Zq{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Xi(new xs(n,Ar("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(hc(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const u=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:Z6(X6({},o.sessionProperties||{}),{capabilities:Z6(X6({},a||{}),{[s]:u})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return u}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ga("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${Bq}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class Qq{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=hc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Xi(new xs(n,Ar("disableProviderPing")))}}let ez=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=hc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Xi(new xs(n,Ar("disableProviderPing")))}},tz=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Xi(new xs(n,Ar("disableProviderPing")))}},rz=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=hc(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Xi(new xs(n,Ar("disableProviderPing")))}},nz=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=hc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Xi(new xs(n,Ar("disableProviderPing")))}};class iz{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=hc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Xi(new xs(n,Ar("disableProviderPing")))}}let sz=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Xi(new xs(n,Ar("disableProviderPing")))}};class oz{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Xi(new xs(n))}}class az{constructor(e){this.name=Iu,this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=Eu(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Xi(new xs(n,Ar("disableProviderPing")))}}var cz=Object.defineProperty,uz=Object.defineProperties,fz=Object.getOwnPropertyDescriptors,Q6=Object.getOwnPropertySymbols,lz=Object.prototype.hasOwnProperty,hz=Object.prototype.propertyIsEnumerable,e5=(t,e,r)=>e in t?cz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,r0=(t,e)=>{for(var r in e||(e={}))lz.call(e,r)&&e5(t,r,e[r]);if(Q6)for(var r of Q6(e))hz.call(e,r)&&e5(t,r,e[r]);return t},T1=(t,e)=>uz(t,fz(e));let t5=class GA{constructor(e){this.events=new Yg,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||j6})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new GA(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:r0({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,Vd(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Dr("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=V6(this.session.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=V6(s.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==T6)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Iu?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(oc(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await A1.init({core:this.providerOpts.core,logger:this.providerOpts.logger||j6,relayUrl:this.providerOpts.relayUrl||Nq,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>El(r)))];C1("client",this.client),C1("events",this.events),C1("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Hq(r,this.session),i=W6(n),s=M1(this.namespaces,this.optionalNamespaces),o=T1(r0({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new Zq({namespace:o});break;case"algorand":this.rpcProviders[r]=new tz({namespace:o});break;case"solana":this.rpcProviders[r]=new Qq({namespace:o});break;case"cosmos":this.rpcProviders[r]=new ez({namespace:o});break;case"polkadot":this.rpcProviders[r]=new Kq({namespace:o});break;case"cip34":this.rpcProviders[r]=new rz({namespace:o});break;case"elrond":this.rpcProviders[r]=new nz({namespace:o});break;case"multiversx":this.rpcProviders[r]=new iz({namespace:o});break;case"near":this.rpcProviders[r]=new sz({namespace:o});break;case"tezos":this.rpcProviders[r]=new oz({namespace:o});break;default:this.rpcProviders[Iu]?this.rpcProviders[Iu].updateNamespace(o):this.rpcProviders[Iu]=new az({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&oc(i)&&this.events.emit("accountsChanged",i.map(Wq))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=El(i),a=I1(i)!==I1(s)?`${o}:${I1(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=T1(r0({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",T1(r0({},Dr("USER_DISCONNECTED")),{data:e.topic}))}),this.on(es.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Iu]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>El(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=El(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${U6}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${U6}/${e}`)}};const dz=t5;function pz(){return new Promise(t=>{const e=[];let r;window.addEventListener("eip6963:announceProvider",n=>{const{detail:i}=n;r&&clearTimeout(r),e.push(i),r=setTimeout(()=>t(e),200)}),r=setTimeout(()=>t(e),200),window.dispatchEvent(new Event("eip6963:requestProvider"))})}class Ys{constructor(e,r){this.scope=e,this.module=r}storeObject(e,r){this.setItem(e,JSON.stringify(r))}loadObject(e){const r=this.getItem(e);return r?JSON.parse(r):void 0}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new Ys("CBWSDK").clear(),new Ys("walletlink").clear()}}const cn={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},R1={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},r5="Unspecified error message.",gz="Unspecified server error.";function D1(t,e=r5){if(t&&Number.isInteger(t)){const r=t.toString();if(O1(R1,r))return R1[r].message;if(n5(t))return gz}return e}function mz(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(R1[e]||n5(t))}function vz(t,{shouldIncludeStack:e=!1}={}){const r={};if(t&&typeof t=="object"&&!Array.isArray(t)&&O1(t,"code")&&mz(t.code)){const n=t;r.code=n.code,n.message&&typeof n.message=="string"?(r.message=n.message,O1(n,"data")&&(r.data=n.data)):(r.message=D1(r.code),r.data={originalError:i5(t)})}else r.code=cn.rpc.internal,r.message=s5(t,"message")?t.message:r5,r.data={originalError:i5(t)};return e&&(r.stack=s5(t,"stack")?t.stack:void 0),r}function n5(t){return t>=-32099&&t<=-32e3}function i5(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function O1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function s5(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const Sr={rpc:{parse:t=>ts(cn.rpc.parse,t),invalidRequest:t=>ts(cn.rpc.invalidRequest,t),invalidParams:t=>ts(cn.rpc.invalidParams,t),methodNotFound:t=>ts(cn.rpc.methodNotFound,t),internal:t=>ts(cn.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return ts(e,t)},invalidInput:t=>ts(cn.rpc.invalidInput,t),resourceNotFound:t=>ts(cn.rpc.resourceNotFound,t),resourceUnavailable:t=>ts(cn.rpc.resourceUnavailable,t),transactionRejected:t=>ts(cn.rpc.transactionRejected,t),methodNotSupported:t=>ts(cn.rpc.methodNotSupported,t),limitExceeded:t=>ts(cn.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Cu(cn.provider.userRejectedRequest,t),unauthorized:t=>Cu(cn.provider.unauthorized,t),unsupportedMethod:t=>Cu(cn.provider.unsupportedMethod,t),disconnected:t=>Cu(cn.provider.disconnected,t),chainDisconnected:t=>Cu(cn.provider.chainDisconnected,t),unsupportedChain:t=>Cu(cn.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new c5(e,r,n)}}};function ts(t,e){const[r,n]=o5(e);return new a5(t,r||D1(t),n)}function Cu(t,e){const[r,n]=o5(e);return new c5(t,r||D1(t),n)}function o5(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}class a5 extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}}class c5 extends a5{constructor(e,r,n){if(!bz(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}function bz(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function N1(){return t=>t}const Ol=N1(),yz=N1(),wz=N1();function Ro(t){return Math.floor(t)}const u5=/^[0-9]*$/,f5=/^[a-f0-9]*$/;function dc(t){return L1(crypto.getRandomValues(new Uint8Array(t)))}function L1(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function n0(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function Nl(t,e=!1){const r=t.toString("hex");return Ol(e?`0x${r}`:r)}function k1(t){return Nl(F1(t),!0)}function Js(t){return wz(t.toString(10))}function ma(t){return Ol(`0x${BigInt(t).toString(16)}`)}function l5(t){return t.startsWith("0x")||t.startsWith("0X")}function B1(t){return l5(t)?t.slice(2):t}function h5(t){return l5(t)?`0x${t.slice(2)}`:`0x${t}`}function i0(t){if(typeof t!="string")return!1;const e=B1(t).toLowerCase();return f5.test(e)}function xz(t,e=!1){if(typeof t=="string"){const r=B1(t).toLowerCase();if(f5.test(r))return Ol(e?`0x${r}`:r)}throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function $1(t,e=!1){let r=xz(t,!1);return r.length%2===1&&(r=Ol(`0${r}`)),e?Ol(`0x${r}`):r}function va(t){if(typeof t=="string"){const e=B1(t).toLowerCase();if(i0(e)&&e.length===40)return yz(h5(e))}throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function F1(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(i0(t)){const e=$1(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Sr.rpc.invalidParams(`Not binary data: ${String(t)}`)}function Ll(t){if(typeof t=="number"&&Number.isInteger(t))return Ro(t);if(typeof t=="string"){if(u5.test(t))return Ro(Number(t));if(i0(t))return Ro(Number(BigInt($1(t,!0))))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function kl(t){if(t!==null&&(typeof t=="bigint"||Ez(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(Ll(t));if(typeof t=="string"){if(u5.test(t))return BigInt(t);if(i0(t))return BigInt($1(t,!0))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function _z(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Sr.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function Ez(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function Sz(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function Az(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Pz(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,new TextEncoder().encode(e));return{iv:r,cipherText:n}}async function Mz(t,{iv:e,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return new TextDecoder().decode(n)}function d5(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function p5(t,e){const r=d5(t),n=await crypto.subtle.exportKey(r,e);return L1(new Uint8Array(n))}async function g5(t,e){const r=d5(t),n=n0(e).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function Iz(t,e){const r=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return Pz(e,r)}async function Cz(t,e){return JSON.parse(await Mz(e,t))}const j1={storageKey:"ownPrivateKey",keyType:"private"},U1={storageKey:"ownPublicKey",keyType:"public"},q1={storageKey:"peerPublicKey",keyType:"public"};class Tz{constructor(){this.storage=new Ys("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(q1,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(U1.storageKey),this.storage.removeItem(j1.storageKey),this.storage.removeItem(q1.storageKey)}async generateKeyPair(){const e=await Sz();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(j1,e.privateKey),await this.storeKey(U1,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(j1)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(U1)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(q1)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await Az(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const r=this.storage.getItem(e.storageKey);return r?g5(e.keyType,r):null}async storeKey(e,r){const n=await p5(e.keyType,r);this.storage.setItem(e.storageKey,n)}}const Bl="4.2.4",m5="@coinbase/wallet-sdk";async function v5(t,e){const r=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":Bl,"X-Cbw-Sdk-Platform":m5}}),{result:i,error:s}=await n.json();if(s)throw s;return i}function Rz(){return globalThis.coinbaseWalletExtension}function Dz(){var t,e;try{const r=globalThis;return(t=r.ethereum)!==null&&t!==void 0?t:(e=r.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Oz({metadata:t,preference:e}){var r,n;const{appName:i,appLogoUrl:s,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const u=Rz();if(u)return(r=u.setAppInfo)===null||r===void 0||r.call(u,i,s,o,e),u}const a=Dz();if(a!=null&&a.isCoinbaseBrowser)return(n=a.setAppInfo)===null||n===void 0||n.call(a,i,s,o,e),a}function Nz(t){if(!t||typeof t!="object"||Array.isArray(t))throw Sr.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:r}=t;if(typeof e!="string"||e.length===0)throw Sr.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Sr.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw Sr.provider.unsupportedMethod()}}const b5="accounts",y5="activeChain",w5="availableChains",x5="walletCapabilities";class Lz{constructor(e){var r,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new Tz,this.storage=new Ys("CBWSDK","SCWStateManager"),this.accounts=(r=this.storage.loadObject(b5))!==null&&r!==void 0?r:[],this.chain=this.storage.loadObject(y5)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var r,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(r=e.params)!==null&&r!==void 0?r:{})}}),s=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in s.content)throw s.content.failure;const o=await g5("public",s.sender);await this.keyManager.setPeerPublicKey(o);const u=(await this.decryptResponseMessage(s)).result;if("error"in u)throw u.error;const l=u.value;this.accounts=l,this.storage.storeObject(b5,l),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",l)}async request(e){var r;if(this.accounts.length===0)throw Sr.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:ma(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return ma(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(x5);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return v5(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var r,n;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const i=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(i)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,r;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(r=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&r!==void 0?r:1}}async handleSwitchChainRequest(e){var r;const n=e.params;if(!n||!(!((r=n[0])===null||r===void 0)&&r.chainId))throw Sr.rpc.invalidParams();const i=Ll(n[0].chainId);if(this.updateChain(i))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(i),o}async sendEncryptedRequest(e){const r=await this.keyManager.getSharedSecret();if(!r)throw Sr.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await Iz({action:e,chainId:this.chain.id},r),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const r=await p5("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:r,content:e,timestamp:new Date}}async decryptResponseMessage(e){var r,n;const i=e.content;if("failure"in i)throw i.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw Sr.provider.unauthorized("Invalid session");const o=await Cz(i.encrypted,s),a=(r=o.data)===null||r===void 0?void 0:r.chains;if(a){const l=Object.entries(a).map(([d,g])=>({id:Number(d),rpcUrl:g}));this.storage.storeObject(w5,l),this.updateChain(this.chain.id,l)}const u=(n=o.data)===null||n===void 0?void 0:n.capabilities;return u&&this.storage.storeObject(x5,u),o}updateChain(e,r){var n;const i=r??this.storage.loadObject(w5),s=i==null?void 0:i.find(o=>o.id===e);return s?(s!==this.chain&&(this.chain=s,this.storage.storeObject(y5,s),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",ma(s.id))),!0):!1}}const kz=Jp(eM),{keccak_256:Bz}=kz;function _5(t){return Buffer.allocUnsafe(t).fill(0)}function $z(t){return t.toString(2).length}function E5(t,e){let r=t.toString(16);r.length%2!==0&&(r="0"+r);const n=r.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(r=T5(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(Xs(t,e[s]));if(r==="dynamic"){var o=Xs("uint256",e.length);i.unshift(o)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([Xs("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,si.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Tu(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return si.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Tu(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=pc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+a);if(n<0)throw new Error("Supplied uint is negative");return si.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(r=Tu(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=pc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied int exceeds width: "+r+" vs "+a);const u=si.twosFromBigInt(n,256);return si.bufferBEFromBigInt(u,32)}else if(t.startsWith("ufixed")){if(r=C5(t),n=pc(e),n<0)throw new Error("Supplied ufixed is negative");return Xs("uint256",n*BigInt(2)**BigInt(r[1]))}else if(t.startsWith("fixed"))return r=C5(t),Xs("int256",pc(e)*BigInt(2)**BigInt(r[1]))}throw new Error("Unsupported or invalid type: "+t)}function Hz(t){return t==="string"||t==="bytes"||T5(t)==="dynamic"}function Wz(t){return t.lastIndexOf("]")===t.length-1}function Kz(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var o=I5(t[s]),a=e[s],u=Xs(o,a);Hz(o)?(r.push(Xs("uint256",i)),n.push(u),i+=u.length):r.push(u)}return Buffer.concat(r.concat(n))}function R5(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(si.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=Tu(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=pc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+u);i.push(si.bufferBEFromBigInt(n,r/8))}else if(o.startsWith("int")){if(r=Tu(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=pc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied int exceeds width: "+r+" vs "+u);const l=si.twosFromBigInt(n,r);i.push(si.bufferBEFromBigInt(l,r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function Vz(t,e){return si.keccak(R5(t,e))}var Gz={rawEncode:Kz,solidityPack:R5,soliditySHA3:Vz};const _s=M5,$l=Gz,D5={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},z1={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const o=(a,u,l)=>{if(r[u]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":_s.keccak(this.encodeData(u,l,r,n))];if(l===void 0)throw new Error(`missing value for field ${a} of type ${u}`);if(u==="bytes")return["bytes32",_s.keccak(l)];if(u==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",_s.keccak(l)];if(u.lastIndexOf("]")===u.length-1){const d=u.slice(0,u.lastIndexOf("[")),g=l.map(y=>o(a,d,y));return["bytes32",_s.keccak($l.rawEncode(g.map(([y])=>y),g.map(([,y])=>y)))]}return[u,l]};for(const a of r[t]){const[u,l]=o(a.name,a.type,e[a.name]);i.push(u),s.push(l)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=_s.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=_s.keccak(a),s.push(a);else if(r[o.type]!==void 0)i.push("bytes32"),a=_s.keccak(this.encodeData(o.type,a,r,n)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return $l.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return _s.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return _s.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in D5.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),_s.keccak(Buffer.concat(n))}};var Yz={TYPED_MESSAGE_SCHEMA:D5,TypedDataUtils:z1,hashForSignTypedDataLegacy:function(t){return Jz(t.data)},hashForSignTypedData_v3:function(t){return z1.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return z1.hash(t.data)}};function Jz(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?_s.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return $l.soliditySHA3(["bytes32","bytes32"],[$l.soliditySHA3(new Array(t.length).fill("string"),i),$l.soliditySHA3(n,r)])}const o0=Ui(Yz),Xz="walletUsername",H1="Addresses",Zz="AppVersion";function Hn(t){return t.errorMessage!==void 0}class Qz{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),a=16,u=o.slice(o.byteLength-a),l=o.slice(0,o.byteLength-a),d=new Uint8Array(u),g=new Uint8Array(l),y=new Uint8Array([...n,...d,...g]);return L1(y)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=n0(e),a=o.slice(0,12),u=o.slice(12,28),l=o.slice(28),d=new Uint8Array([...l,...u]),g={name:"AES-GCM",iv:new Uint8Array(a)};try{const y=await window.crypto.subtle.decrypt(g,s,d),A=new TextDecoder;n(A.decode(y))}catch(y){i(y)}})()})}}class eH{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}var Do;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(Do||(Do={}));class tH{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,Do.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,Do.DISCONNECTED)},i.onopen=s=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,Do.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(u=>this.sendData(u)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const u=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,u)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,Do.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const O5=1e4,rH=6e4;class nH{constructor({session:e,linkAPIUrl:r,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Ro(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,u)=>{const l=s[u];l!==void 0&&a(l)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,u)},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(Xz,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(Zz,s)},this.handleChainUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(s),l=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(u,l)},this.session=e,this.cipher=new Qz(e.secret),this.listener=n;const i=new tH(`${r}/rpc`,WebSocket);i.setConnectionStateListener(async s=>{let o=!1;switch(s){case Do.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(u=>setTimeout(u,5e3)),this.destroyed||i.connect().catch(()=>{a()})};a()}break;case Do.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},O5),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case Do.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(s=>{var o;switch(s.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=s.type==="IsLinkedOK"?s.linked:void 0;this.linked=a||s.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(s.metadata);break}case"Event":{this.handleIncomingEvent(s);break}}s.id!==void 0&&((o=this.requestResolutions.get(s.id))===null||o===void 0||o(s))}),this.ws=i,this.http=new eH(r,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Ro(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:s,response:o}=i;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s,o)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Ro(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>O5*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r={timeout:rH}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r.timeout)}),new Promise(s=>{this.requestResolutions.set(n,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Ro(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Ro(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Ro(this.nextReqId++),sessionId:this.session.id}),!0)}}class iH{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=h5(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}const N5="session:id",L5="session:secret",k5="session:linked";class Ru{constructor(e,r,n,i=!1){this.storage=e,this.id=r,this.secret=n,this.key=OP(Pg(`${r}, ${n} WalletLink`)),this._linked=!!i}static create(e){const r=dc(16),n=dc(32);return new Ru(e,r,n).save()}static load(e){const r=e.getItem(N5),n=e.getItem(k5),i=e.getItem(L5);return r&&i?new Ru(e,r,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(N5,this.id),this.storage.setItem(L5,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(k5,this._linked?"1":"0")}}function sH(){try{return window.frameElement!==null}catch{return!1}}function oH(){try{return sH()&&window.top?window.top.location:window.location}catch{return window.location}}function aH(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function B5(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const cH='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function $5(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(cH)),document.documentElement.appendChild(t)}function F5(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e2&&(o.children=arguments.length>3?a0.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return c0(t,o,n,i,null)}function c0(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++j5,__i:-1,__u:0};return i==null&&Vr.vnode!=null&&Vr.vnode(s),s}function Ul(t){return t.children}function u0(t,e){this.props=t,this.context=e}function Du(t,e){if(e==null)return t.__?Du(t.__,t.__i+1):null;for(var r;ee&&gc.sort(W1));f0.__r=0}function V5(t,e,r,n,i,s,o,a,u,l,d){var g,y,A,P,O,D,k=n&&n.__k||H5,B=e.length;for(u=fH(r,e,k,u),g=0;g0?c0(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,(u=s.__i=lH(s,r,a,g))!==-1&&(g--,(o=r[u])&&(o.__u|=2)),o==null||o.__v===null?(u==-1&&y--,typeof s.type!="function"&&(s.__u|=4)):u!==a&&(u==a-1?y--:u==a+1?y++:(u>a?y--:y++,s.__u|=4))):s=t.__k[i]=null;if(g)for(i=0;i(u!=null&&!(2&u.__u)?1:0))for(;o>=0||a=0){if((u=e[o])&&!(2&u.__u)&&i==u.key&&s===u.type)return o;o--}if(a=r.__.length&&r.__.push({}),r.__[t]}function c4(t){return tv=1,pH(f4,t)}function pH(t,e,r){var n=a4(h0++,2);if(n.t=t,!n.__c&&(n.__=[f4(void 0,e),function(a){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,a);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=un,!un.u)){var i=function(a,u,l){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(y){return!!y.__c});if(d.every(function(y){return!y.__N}))return!s||s.call(this,a,u,l);var g=n.__c.props!==a;return d.forEach(function(y){if(y.__N){var A=y.__[0];y.__=y.__N,y.__N=void 0,A!==y.__[0]&&(g=!0)}}),s&&s.call(this,a,u,l)||g};un.u=!0;var s=un.shouldComponentUpdate,o=un.componentWillUpdate;un.componentWillUpdate=function(a,u,l){if(this.__e){var d=s;s=void 0,i(a,u,l),s=d}o&&o.call(this,a,u,l)},un.shouldComponentUpdate=i}return n.__N||n.__}function gH(t,e){var r=a4(h0++,3);!yn.__s&&bH(r.__H,e)&&(r.__=t,r.i=e,un.__H.__h.push(r))}function mH(){for(var t;t=e4.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(d0),t.__H.__h.forEach(rv),t.__H.__h=[]}catch(e){t.__H.__h=[],yn.__e(e,t.__v)}}yn.__b=function(t){un=null,t4&&t4(t)},yn.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),o4&&o4(t,e)},yn.__r=function(t){r4&&r4(t),h0=0;var e=(un=t.__c).__H;e&&(ev===un?(e.__h=[],un.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(d0),e.__h.forEach(rv),e.__h=[],h0=0)),ev=un},yn.diffed=function(t){n4&&n4(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(e4.push(e)!==1&&Q5===yn.requestAnimationFrame||((Q5=yn.requestAnimationFrame)||vH)(mH)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),ev=un=null},yn.__c=function(t,e){e.some(function(r){try{r.__h.forEach(d0),r.__h=r.__h.filter(function(n){return!n.__||rv(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],yn.__e(n,r.__v)}}),i4&&i4(t,e)},yn.unmount=function(t){s4&&s4(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{d0(n)}catch(i){e=i}}),r.__H=void 0,e&&yn.__e(e,r.__v))};var u4=typeof requestAnimationFrame=="function";function vH(t){var e,r=function(){clearTimeout(n),u4&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);u4&&(e=requestAnimationFrame(r))}function d0(t){var e=un,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),un=e}function rv(t){var e=un;t.__c=t.__(),un=e}function bH(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function f4(t,e){return typeof e=="function"?e(t):e}const yH=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",wH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",xH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class _H{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=B5()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const r=this.nextItemKey++;return this.items.set(r,e),this.render(),()=>{this.items.delete(r),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&Q1(Or("div",null,Or(l4,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,r])=>Or(EH,Object.assign({},r,{key:e}))))),this.root)}}const l4=t=>Or("div",{class:Fl("-cbwsdk-snackbar-container")},Or("style",null,yH),Or("div",{class:"-cbwsdk-snackbar"},t.children)),EH=({autoExpand:t,message:e,menuItems:r})=>{const[n,i]=c4(!0),[s,o]=c4(t??!1);gH(()=>{const u=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{u.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return Or("div",{class:Fl("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},Or("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},Or("img",{src:wH,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",Or("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),Or("div",{class:"-gear-container"},!s&&Or("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),Or("img",{src:xH,class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&Or("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((u,l)=>Or("div",{class:Fl("-cbwsdk-snackbar-instance-menu-item",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:u.onClick,key:l},Or("svg",{width:u.svgWidth,height:u.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("path",{"fill-rule":u.defaultFillRule,"clip-rule":u.defaultClipRule,d:u.path,fill:"#AAAAAA"})),Or("span",{class:Fl("-cbwsdk-snackbar-instance-menu-item-info",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},u.info)))))};class SH{constructor(){this.attached=!1,this.snackbar=new _H}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.snackbar.attach(r),this.attached=!0,$5()}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}}const AH=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class PH{constructor(){this.root=null,this.darkMode=B5()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),$5()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(Q1(null,this.root),e&&Q1(Or(MH,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const MH=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return Or(l4,{darkMode:r},Or("div",{class:"-cbwsdk-redirect-dialog"},Or("style",null,AH),Or("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),Or("div",{class:Fl("-cbwsdk-redirect-dialog-box",s)},Or("p",null,t),Or("button",{onClick:n},e))))},IH="https://keys.coinbase.com/connect",h4="https://www.walletlink.org",CH="https://go.cb-w.com/walletlink";class d4{constructor(){this.attached=!1,this.redirectDialog=new PH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const r=new URL(CH);r.searchParams.append("redirect_url",oH().href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class Oo{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=aH(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(H1);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!u&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),Oo.accountRequestCallbackIds.size>0&&(Array.from(Oo.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),Oo.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new iH,this.ui=n,this.ui.attach()}subscribe(){const e=Ru.load(this.storage)||Ru.create(this.storage),{linkAPIUrl:r}=this,n=new nH({session:e,linkAPIUrl:r,listener:this}),i=this.isMobileWeb?new d4:new SH;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=Ru.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Ys.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?Js(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?Js(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Nl(e,!0),chainId:r}})}getWalletLinkSession(){return this._session}sendRequest(e){let r=null;const n=dc(8),i=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,s),r==null||r()};return new Promise((s,o)=>{r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,a=>{if(r==null||r(),Hn(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,r){const n={type:"WEB3_REQUEST",id:e,request:r};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:r.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(r.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof d4)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e,r){if(r.method==="requestEthereumAccounts"){Oo.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,r)),Oo.accountRequestCallbackIds.clear();return}this.invokeCallback(e,r)}handleErrorResponse(e,r,n){var i;const s=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:r,errorMessage:s})}invokeCallback(e,r){const n=this.relayEventManager.callbacks.get(e);n&&(n(r),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:r}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:r}},i=dc(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(Hn(a))return o(new Error(a.errorMessage));s(a)}),Oo.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,r,n,i,s,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:o}};let u=null;const l=dc(8),d=g=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,g),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((g,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));g(A)}),this.publishWeb3RequestEvent(l,a)})}addEthereumChain(e,r,n,i,s,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:o}};let u=null;const l=dc(8),d=g=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,g),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((g,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));g(A)}),this.publishWeb3RequestEvent(l,a)})}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})};let i=null;const s=dc(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,u)=>{this.relayEventManager.callbacks.set(s,l=>{if(i==null||i(),Hn(l)&&l.errorCode)return u(Sr.provider.custom({code:l.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(Hn(l))return u(new Error(l.errorMessage));a(l)}),this.publishWeb3RequestEvent(s,n)})}}Oo.accountRequestCallbackIds=new Set;const p4="DefaultChainId",g4="DefaultJsonRpcUrl";class m4{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new Ys("walletlink",h4),this.callback=e.callback||null;const r=this._storage.getItem(H1);if(r){const n=r.split(" ");n[0]!==""&&(this._addresses=n.map(i=>va(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:r,secret:n}=e.getWalletLinkSession();return{id:r,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(g4))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(g4,e)}updateProviderInfo(e,r){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(p4,r.toString(10)),Ll(r)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",ma(r)))}async watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw Sr.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw Sr.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw Sr.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw Sr.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=r.options,l=await this.initializeRelay().watchAsset(r.type,i,s,a,o,n==null?void 0:n.toString());return Hn(l)?!1:!!l.result}async addEthereumChain(e){var r,n;const i=e[0];if(((r=i.rpcUrls)===null||r===void 0?void 0:r.length)===0)throw Sr.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw Sr.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw Sr.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:u=[],chainName:l,iconUrls:d=[],nativeCurrency:g}=i,y=await o.addEthereumChain(s.toString(),a,d,u,l,g);if(Hn(y))return!1;if(((n=y.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw Sr.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const r=e[0],n=Number.parseInt(r.chainId,16),s=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(Hn(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,r){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(s=>va(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(H1,i.join(" ")))}async request(e){const r=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return ma(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(r);case"wallet_switchEthereumChain":return this.switchEthereumChain(r);case"wallet_watchAsset":return this.watchAsset(r);default:if(!this.jsonRpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return v5(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const r=va(e);if(!this._addresses.map(i=>va(i)).includes(r))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?va(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?va(e.to):null,i=e.value!=null?kl(e.value):BigInt(0),s=e.data?F1(e.data):Buffer.alloc(0),o=e.nonce!=null?Ll(e.nonce):null,a=e.gasPrice!=null?kl(e.gasPrice):null,u=e.maxFeePerGas!=null?kl(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?kl(e.maxPriorityFeePerGas):null,d=e.gas!=null?kl(e.gas):null,g=e.chainId?Ll(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:u,maxPriorityFeePerGas:l,gasLimit:d,chainId:g}}async ecRecover(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:k1(n[0]),signature:k1(n[1]),addPrefix:r==="personal_ecRecover"}});if(Hn(s))throw s;return s.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(p4))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,r;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:ma(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(Hn(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:ma(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw Sr.rpc.invalidParams();const r=e[1],n=e[0];this._ensureKnownAddress(r);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:va(r),message:k1(n),addPrefix:!0,typedDataJson:null}});if(Hn(s))throw s;return s.result}async _eth_signTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(r);if(Hn(i))throw i;return i.result}async _eth_sendRawTransaction(e){const r=F1(e[0]),i=await this.initializeRelay().submitEthereumTransaction(r,this.getChainId());if(Hn(i))throw i;return i.result}async _eth_sendTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(r);if(Hn(i))throw i;return i.result}async signTypedData(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const i=l=>{const d={eth_signTypedData_v1:o0.hashForSignTypedDataLegacy,eth_signTypedData_v3:o0.hashForSignTypedData_v3,eth_signTypedData_v4:o0.hashForSignTypedData_v4,eth_signTypedData:o0.hashForSignTypedData_v4};return Nl(d[r]({data:_z(l)}),!0)},s=n[r==="eth_signTypedData_v1"?1:0],o=n[r==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const u=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:va(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(Hn(u))throw u;return u.result}initializeRelay(){return this._relay||(this._relay=new Oo({linkAPIUrl:h4,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const v4="SignerType",b4=new Ys("CBWSDK","SignerConfigurator");function TH(){return b4.getItem(v4)}function RH(t){b4.setItem(v4,t)}async function DH(t){const{communicator:e,metadata:r,handshakeRequest:n,callback:i}=t;NH(e,r,i).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:o}=await e.postRequestAndWaitForResponse(s);return o}function OH(t){const{signerType:e,metadata:r,communicator:n,callback:i}=t;switch(e){case"scw":return new Lz({metadata:r,callback:i,communicator:n});case"walletlink":return new m4({metadata:r,callback:i})}}async function NH(t,e,r){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new m4({metadata:e,callback:r});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const LH=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. -Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,PH=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,r=await fetch(e,{method:"HEAD"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const n=r.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(AH)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:MH,getCrossOriginOpenerPolicy:IH}=PH(),v4=420,b4=540;function CH(t){const e=(window.innerWidth-v4)/2+window.screenX,r=(window.innerHeight-b4)/2+window.screenY;RH(t);const n=window.open(t,"Smart Wallet",`width=${v4}, height=${b4}, left=${e}, top=${r}`);if(n==null||n.focus(),!n)throw Sr.rpc.internal("Pop up window failed to open");return n}function TH(t){t&&!t.closed&&t.close()}function RH(t){const e={sdkName:p5,sdkVersion:kl,origin:window.location.origin,coop:IH()};for(const[r,n]of Object.entries(e))t.searchParams.append(r,n.toString())}class DH{constructor({url:e=bH,metadata:r,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=u=>{if(u.origin!==this.url.origin)return;const l=u.data;i(l)&&(s(l),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{TH(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(Sr.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=CH(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:kl,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw Sr.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=r,this.preference=n}}function OH(t){const e=az(NH(t),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",kl),r.searchParams.set("code",e.code.toString()),r.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:r.href})}function NH(t){var e;if(typeof t=="string")return{message:t,code:cn.rpc.internal};if(zn(t)){const r=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:r.match(/(denied|rejected)/i)?cn.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:r,code:n,data:{method:t.method}})}return t}var y4={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,l,d){this.fn=u,this.context=l,this.once=d||!1}function s(u,l,d,g,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var A=new i(d,g||u,y),P=r?r+l:l;return u._events[P]?u._events[P].fn?u._events[P]=[u._events[P],A]:u._events[P].push(A):(u._events[P]=A,u._eventsCount++),u}function o(u,l){--u._eventsCount===0?u._events=new n:delete u._events[l]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,g;if(this._eventsCount===0)return l;for(g in d=this._events)e.call(d,g)&&l.push(r?g.slice(1):g);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=r?r+l:l,g=this._events[d];if(!g)return[];if(g.fn)return[g.fn];for(var y=0,A=g.length,P=new Array(A);y(i||(i=jH(n)),i)}}function w4(t,e){return function(){return t.apply(e,arguments)}}const{toString:HH}=Object.prototype,{getPrototypeOf:nv}=Object,d0=(t=>e=>{const r=HH.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),_s=t=>(t=t.toLowerCase(),e=>d0(e)===t),p0=t=>e=>typeof e===t,{isArray:Du}=Array,jl=p0("undefined");function WH(t){return t!==null&&!jl(t)&&t.constructor!==null&&!jl(t.constructor)&&Oi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const x4=_s("ArrayBuffer");function KH(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&x4(t.buffer),e}const VH=p0("string"),Oi=p0("function"),_4=p0("number"),g0=t=>t!==null&&typeof t=="object",GH=t=>t===!0||t===!1,m0=t=>{if(d0(t)!=="object")return!1;const e=nv(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},YH=_s("Date"),JH=_s("File"),XH=_s("Blob"),ZH=_s("FileList"),QH=t=>g0(t)&&Oi(t.pipe),eW=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Oi(t.append)&&((e=d0(t))==="formdata"||e==="object"&&Oi(t.toString)&&t.toString()==="[object FormData]"))},tW=_s("URLSearchParams"),[rW,nW,iW,sW]=["ReadableStream","Request","Response","Headers"].map(_s),oW=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ql(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Du(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const dc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,S4=t=>!jl(t)&&t!==dc;function iv(){const{caseless:t}=S4(this)&&this||{},e={},r=(n,i)=>{const s=t&&E4(e,i)||i;m0(e[s])&&m0(n)?e[s]=iv(e[s],n):m0(n)?e[s]=iv({},n):Du(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(ql(e,(i,s)=>{r&&Oi(i)?t[s]=w4(i,r):t[s]=i},{allOwnKeys:n}),t),cW=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),uW=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},fW=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&nv(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},lW=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},hW=t=>{if(!t)return null;if(Du(t))return t;let e=t.length;if(!_4(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},dW=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&nv(Uint8Array)),pW=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},gW=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},mW=_s("HTMLFormElement"),vW=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),A4=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),bW=_s("RegExp"),P4=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};ql(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},yW=t=>{P4(t,(e,r)=>{if(Oi(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Oi(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},wW=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Du(t)?n(t):n(String(t).split(e)),r},xW=()=>{},_W=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,sv="abcdefghijklmnopqrstuvwxyz",M4="0123456789",I4={DIGIT:M4,ALPHA:sv,ALPHA_DIGIT:sv+sv.toUpperCase()+M4},EW=(t=16,e=I4.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function SW(t){return!!(t&&Oi(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const AW=t=>{const e=new Array(10),r=(n,i)=>{if(g0(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Du(n)?[]:{};return ql(n,(o,a)=>{const u=r(o,i+1);!jl(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},PW=_s("AsyncFunction"),MW=t=>t&&(g0(t)||Oi(t))&&Oi(t.then)&&Oi(t.catch),C4=((t,e)=>t?setImmediate:e?((r,n)=>(dc.addEventListener("message",({source:i,data:s})=>{i===dc&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),dc.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Oi(dc.postMessage)),IW=typeof queueMicrotask<"u"?queueMicrotask.bind(dc):typeof process<"u"&&process.nextTick||C4,Oe={isArray:Du,isArrayBuffer:x4,isBuffer:WH,isFormData:eW,isArrayBufferView:KH,isString:VH,isNumber:_4,isBoolean:GH,isObject:g0,isPlainObject:m0,isReadableStream:rW,isRequest:nW,isResponse:iW,isHeaders:sW,isUndefined:jl,isDate:YH,isFile:JH,isBlob:XH,isRegExp:bW,isFunction:Oi,isStream:QH,isURLSearchParams:tW,isTypedArray:dW,isFileList:ZH,forEach:ql,merge:iv,extend:aW,trim:oW,stripBOM:cW,inherits:uW,toFlatObject:fW,kindOf:d0,kindOfTest:_s,endsWith:lW,toArray:hW,forEachEntry:pW,matchAll:gW,isHTMLForm:mW,hasOwnProperty:A4,hasOwnProp:A4,reduceDescriptors:P4,freezeMethods:yW,toObjectSet:wW,toCamelCase:vW,noop:xW,toFiniteNumber:_W,findKey:E4,global:dc,isContextDefined:S4,ALPHABET:I4,generateString:EW,isSpecCompliantForm:SW,toJSONObject:AW,isAsyncFn:PW,isThenable:MW,setImmediate:C4,asap:IW};function ar(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Oe.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const T4=ar.prototype,R4={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{R4[t]={value:t}}),Object.defineProperties(ar,R4),Object.defineProperty(T4,"isAxiosError",{value:!0}),ar.from=(t,e,r,n,i,s)=>{const o=Object.create(T4);return Oe.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),ar.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const CW=null;function ov(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function D4(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function O4(t,e,r){return t?t.concat(e).map(function(i,s){return i=D4(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function TW(t){return Oe.isArray(t)&&!t.some(ov)}const RW=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function v0(t,e,r){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Oe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(N,D){return!Oe.isUndefined(D[N])});const n=r.metaTokens,i=r.visitor||d,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(i))throw new TypeError("visitor must be a function");function l(P){if(P===null)return"";if(Oe.isDate(P))return P.toISOString();if(!u&&Oe.isBlob(P))throw new ar("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(P)||Oe.isTypedArray(P)?u&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function d(P,N,D){let k=P;if(P&&!D&&typeof P=="object"){if(Oe.endsWith(N,"{}"))N=n?N:N.slice(0,-2),P=JSON.stringify(P);else if(Oe.isArray(P)&&TW(P)||(Oe.isFileList(P)||Oe.endsWith(N,"[]"))&&(k=Oe.toArray(P)))return N=D4(N),k.forEach(function(q,U){!(Oe.isUndefined(q)||q===null)&&e.append(o===!0?O4([N],U,s):o===null?N:N+"[]",l(q))}),!1}return ov(P)?!0:(e.append(O4(D,N,s),l(P)),!1)}const g=[],y=Object.assign(RW,{defaultVisitor:d,convertValue:l,isVisitable:ov});function A(P,N){if(!Oe.isUndefined(P)){if(g.indexOf(P)!==-1)throw Error("Circular reference detected in "+N.join("."));g.push(P),Oe.forEach(P,function(k,$){(!(Oe.isUndefined(k)||k===null)&&i.call(e,k,Oe.isString($)?$.trim():$,N,y))===!0&&A(k,N?N.concat($):[$])}),g.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return A(t),e}function N4(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function av(t,e){this._pairs=[],t&&v0(t,this,e)}const L4=av.prototype;L4.append=function(e,r){this._pairs.push([e,r])},L4.toString=function(e){const r=e?function(n){return e.call(this,n,N4)}:N4;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function DW(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function k4(t,e,r){if(!e)return t;const n=r&&r.encode||DW;Oe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(e,r):s=Oe.isURLSearchParams(e)?e.toString():new av(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class $4{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(n){n!==null&&e(n)})}}const B4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},OW={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:av,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},cv=typeof window<"u"&&typeof document<"u",uv=typeof navigator=="object"&&navigator||void 0,NW=cv&&(!uv||["ReactNative","NativeScript","NS"].indexOf(uv.product)<0),LW=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",kW=cv&&window.location.href||"http://localhost",Xn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:cv,hasStandardBrowserEnv:NW,hasStandardBrowserWebWorkerEnv:LW,navigator:uv,origin:kW},Symbol.toStringTag,{value:"Module"})),...OW};function $W(t,e){return v0(t,new Xn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Xn.isNode&&Oe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function BW(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function FW(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&Oe.isArray(i)?i.length:o,u?(Oe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Oe.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Oe.isArray(i[o])&&(i[o]=FW(i[o])),!a)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const r={};return Oe.forEachEntry(t,(n,i)=>{e(BW(n),i,r,0)}),r}return null}function UW(t,e,r){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const zl={transitional:B4,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Oe.isObject(e);if(s&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return i?JSON.stringify(F4(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return $W(e,this.formSerializer).toString();if((a=Oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return v0(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),UW(e)):e}],transformResponse:[function(e){const r=this.transitional||zl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ar.from(a,ar.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xn.classes.FormData,Blob:Xn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{zl.headers[t]={}});const jW=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),qW=t=>{const e={};let r,n,i;return t&&t.split(` -`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&jW[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},U4=Symbol("internals");function Hl(t){return t&&String(t).trim().toLowerCase()}function b0(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(b0):String(t)}function zW(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const HW=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function fv(t,e,r,n,i){if(Oe.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Oe.isString(e)){if(Oe.isString(n))return e.indexOf(n)!==-1;if(Oe.isRegExp(n))return n.test(e)}}function WW(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function KW(t,e){const r=Oe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}let wi=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,u,l){const d=Hl(u);if(!d)throw new Error("header name must be a non-empty string");const g=Oe.findKey(i,d);(!g||i[g]===void 0||l===!0||l===void 0&&i[g]!==!1)&&(i[g||u]=b0(a))}const o=(a,u)=>Oe.forEach(a,(l,d)=>s(l,d,u));if(Oe.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(Oe.isString(e)&&(e=e.trim())&&!HW(e))o(qW(e),r);else if(Oe.isHeaders(e))for(const[a,u]of e.entries())s(u,a,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=Hl(e),e){const n=Oe.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return zW(i);if(Oe.isFunction(r))return r.call(this,i,n);if(Oe.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Hl(e),e){const n=Oe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||fv(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=Hl(o),o){const a=Oe.findKey(n,o);a&&(!r||fv(n,n[a],a,r))&&(delete n[a],i=!0)}}return Oe.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||fv(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Oe.forEach(this,(i,s)=>{const o=Oe.findKey(n,s);if(o){r[o]=b0(i),delete r[s];return}const a=e?WW(s):String(s).trim();a!==s&&delete r[s],r[a]=b0(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Oe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Oe.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[U4]=this[U4]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Hl(o);n[a]||(KW(i,o),n[a]=!0)}return Oe.isArray(e)?e.forEach(s):s(e),this}};wi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Oe.reduceDescriptors(wi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),Oe.freezeMethods(wi);function lv(t,e){const r=this||zl,n=e||r,i=wi.from(n.headers);let s=n.data;return Oe.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function j4(t){return!!(t&&t.__CANCEL__)}function Ou(t,e,r){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,r),this.name="CanceledError"}Oe.inherits(Ou,ar,{__CANCEL__:!0});function q4(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new ar("Request failed with status code "+r.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function VW(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function GW(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),d=n[s];o||(o=l),r[i]=u,n[i]=l;let g=s,y=0;for(;g!==i;)y+=r[g++],g=g%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),l-o{r=d,i=null,s&&(clearTimeout(s),s=null),t.apply(null,l)};return[(...l)=>{const d=Date.now(),g=d-r;g>=n?o(l,d):(i=l,s||(s=setTimeout(()=>{s=null,o(i)},n-g)))},()=>i&&o(i)]}const y0=(t,e,r=3)=>{let n=0;const i=GW(50,250);return YW(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,u=o-n,l=i(u),d=o<=a;n=o;const g={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:l||void 0,estimated:l&&a&&d?(a-o)/l:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(g)},r)},z4=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},H4=t=>(...e)=>Oe.asap(()=>t(...e)),JW=Xn.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Xn.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Xn.origin),Xn.navigator&&/(msie|trident)/i.test(Xn.navigator.userAgent)):()=>!0,XW=Xn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];Oe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Oe.isString(n)&&o.push("path="+n),Oe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function ZW(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function QW(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function W4(t,e){return t&&!ZW(e)?QW(t,e):e}const K4=t=>t instanceof wi?{...t}:t;function pc(t,e){e=e||{};const r={};function n(l,d,g,y){return Oe.isPlainObject(l)&&Oe.isPlainObject(d)?Oe.merge.call({caseless:y},l,d):Oe.isPlainObject(d)?Oe.merge({},d):Oe.isArray(d)?d.slice():d}function i(l,d,g,y){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l,g,y)}else return n(l,d,g,y)}function s(l,d){if(!Oe.isUndefined(d))return n(void 0,d)}function o(l,d){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l)}else return n(void 0,d)}function a(l,d,g){if(g in e)return n(l,d);if(g in t)return n(void 0,l)}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,d,g)=>i(K4(l),K4(d),g,!0)};return Oe.forEach(Object.keys(Object.assign({},t,e)),function(d){const g=u[d]||i,y=g(t[d],e[d],d);Oe.isUndefined(y)&&g!==a||(r[d]=y)}),r}const V4=t=>{const e=pc({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=wi.from(o),e.url=k4(W4(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(Oe.isFormData(r)){if(Xn.hasStandardBrowserEnv||Xn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[l,...d]=u?u.split(";").map(g=>g.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...d].join("; "))}}if(Xn.hasStandardBrowserEnv&&(n&&Oe.isFunction(n)&&(n=n(e)),n||n!==!1&&JW(e.url))){const l=i&&s&&XW.read(s);l&&o.set(i,l)}return e},eK=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=V4(t);let s=i.data;const o=wi.from(i.headers).normalize();let{responseType:a,onUploadProgress:u,onDownloadProgress:l}=i,d,g,y,A,P;function N(){A&&A(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let D=new XMLHttpRequest;D.open(i.method.toUpperCase(),i.url,!0),D.timeout=i.timeout;function k(){if(!D)return;const q=wi.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),K={data:!a||a==="text"||a==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:q,config:t,request:D};q4(function(T){r(T),N()},function(T){n(T),N()},K),D=null}"onloadend"in D?D.onloadend=k:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(k)},D.onabort=function(){D&&(n(new ar("Request aborted",ar.ECONNABORTED,t,D)),D=null)},D.onerror=function(){n(new ar("Network Error",ar.ERR_NETWORK,t,D)),D=null},D.ontimeout=function(){let U=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const K=i.transitional||B4;i.timeoutErrorMessage&&(U=i.timeoutErrorMessage),n(new ar(U,K.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,D)),D=null},s===void 0&&o.setContentType(null),"setRequestHeader"in D&&Oe.forEach(o.toJSON(),function(U,K){D.setRequestHeader(K,U)}),Oe.isUndefined(i.withCredentials)||(D.withCredentials=!!i.withCredentials),a&&a!=="json"&&(D.responseType=i.responseType),l&&([y,P]=y0(l,!0),D.addEventListener("progress",y)),u&&D.upload&&([g,A]=y0(u),D.upload.addEventListener("progress",g),D.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(d=q=>{D&&(n(!q||q.type?new Ou(null,t,D):q),D.abort(),D=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const $=VW(i.url);if($&&Xn.protocols.indexOf($)===-1){n(new ar("Unsupported protocol "+$+":",ar.ERR_BAD_REQUEST,t));return}D.send(s||null)})},tK=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i;const s=function(l){if(!i){i=!0,a();const d=l instanceof Error?l:this.reason;n.abort(d instanceof ar?d:new Ou(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,s(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),t=null)};t.forEach(l=>l.addEventListener("abort",s));const{signal:u}=n;return u.unsubscribe=()=>Oe.asap(a),u}},rK=function*(t,e){let r=t.byteLength;if(r{const i=nK(t,e);let s=0,o,a=u=>{o||(o=!0,n&&n(u))};return new ReadableStream({async pull(u){try{const{done:l,value:d}=await i.next();if(l){a(),u.close();return}let g=d.byteLength;if(r){let y=s+=g;r(y)}u.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(u){return a(u),i.return()}},{highWaterMark:2})},w0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Y4=w0&&typeof ReadableStream=="function",sK=w0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),J4=(t,...e)=>{try{return!!t(...e)}catch{return!1}},oK=Y4&&J4(()=>{let t=!1;const e=new Request(Xn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),X4=64*1024,hv=Y4&&J4(()=>Oe.isReadableStream(new Response("").body)),x0={stream:hv&&(t=>t.body)};w0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!x0[e]&&(x0[e]=Oe.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,n)})})})(new Response);const aK=async t=>{if(t==null)return 0;if(Oe.isBlob(t))return t.size;if(Oe.isSpecCompliantForm(t))return(await new Request(Xn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(t)||Oe.isArrayBuffer(t))return t.byteLength;if(Oe.isURLSearchParams(t)&&(t=t+""),Oe.isString(t))return(await sK(t)).byteLength},cK=async(t,e)=>{const r=Oe.toFiniteNumber(t.getContentLength());return r??aK(e)},dv={http:CW,xhr:eK,fetch:w0&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:l,headers:d,withCredentials:g="same-origin",fetchOptions:y}=V4(t);l=l?(l+"").toLowerCase():"text";let A=tK([i,s&&s.toAbortSignal()],o),P;const N=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let D;try{if(u&&oK&&r!=="get"&&r!=="head"&&(D=await cK(d,n))!==0){let K=new Request(e,{method:"POST",body:n,duplex:"half"}),J;if(Oe.isFormData(n)&&(J=K.headers.get("content-type"))&&d.setContentType(J),K.body){const[T,z]=z4(D,y0(H4(u)));n=G4(K.body,X4,T,z)}}Oe.isString(g)||(g=g?"include":"omit");const k="credentials"in Request.prototype;P=new Request(e,{...y,signal:A,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:k?g:void 0});let $=await fetch(P);const q=hv&&(l==="stream"||l==="response");if(hv&&(a||q&&N)){const K={};["status","statusText","headers"].forEach(ue=>{K[ue]=$[ue]});const J=Oe.toFiniteNumber($.headers.get("content-length")),[T,z]=a&&z4(J,y0(H4(a),!0))||[];$=new Response(G4($.body,X4,T,()=>{z&&z(),N&&N()}),K)}l=l||"text";let U=await x0[Oe.findKey(x0,l)||"text"]($,t);return!q&&N&&N(),await new Promise((K,J)=>{q4(K,J,{data:U,headers:wi.from($.headers),status:$.status,statusText:$.statusText,config:t,request:P})})}catch(k){throw N&&N(),k&&k.name==="TypeError"&&/fetch/i.test(k.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,P),{cause:k.cause||k}):ar.from(k,k&&k.code,t,P)}})};Oe.forEach(dv,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Z4=t=>`- ${t}`,uK=t=>Oe.isFunction(t)||t===null||t===!1,Q4={getAdapter:t=>{t=Oe.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : -`+s.map(Z4).join(` -`):" "+Z4(s[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:dv};function pv(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Ou(null,t)}function e8(t){return pv(t),t.headers=wi.from(t.headers),t.data=lv.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Q4.getAdapter(t.adapter||zl.adapter)(t).then(function(n){return pv(t),n.data=lv.call(t,t.transformResponse,n),n.headers=wi.from(n.headers),n},function(n){return j4(n)||(pv(t),n&&n.response&&(n.response.data=lv.call(t,t.transformResponse,n.response),n.response.headers=wi.from(n.response.headers))),Promise.reject(n)})}const t8="1.7.8",_0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{_0[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const r8={};_0.transitional=function(e,r,n){function i(s,o){return"[Axios v"+t8+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new ar(i(o," has been removed"+(r?" in "+r:"")),ar.ERR_DEPRECATED);return r&&!r8[o]&&(r8[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}},_0.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function fK(t,e,r){if(typeof t!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new ar("option "+s+" must be "+u,ar.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ar("Unknown option "+s,ar.ERR_BAD_OPTION)}}const E0={assertOptions:fK,validators:_0},Xs=E0.validators;let gc=class{constructor(e){this.defaults=e,this.interceptors={request:new $4,response:new $4}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` -`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=pc(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&E0.assertOptions(n,{silentJSONParsing:Xs.transitional(Xs.boolean),forcedJSONParsing:Xs.transitional(Xs.boolean),clarifyTimeoutError:Xs.transitional(Xs.boolean)},!1),i!=null&&(Oe.isFunction(i)?r.paramsSerializer={serialize:i}:E0.assertOptions(i,{encode:Xs.function,serialize:Xs.function},!0)),E0.assertOptions(r,{baseUrl:Xs.spelling("baseURL"),withXsrfToken:Xs.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Oe.merge(s.common,s[r.method]);s&&Oe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete s[P]}),r.headers=wi.concat(o,s);const a=[];let u=!0;this.interceptors.request.forEach(function(N){typeof N.runWhen=="function"&&N.runWhen(r)===!1||(u=u&&N.synchronous,a.unshift(N.fulfilled,N.rejected))});const l=[];this.interceptors.response.forEach(function(N){l.push(N.fulfilled,N.rejected)});let d,g=0,y;if(!u){const P=[e8.bind(this),void 0];for(P.unshift.apply(P,a),P.push.apply(P,l),y=P.length,d=Promise.resolve(r);g{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new Ou(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new FA(function(i){e=i}),cancel:e}}};function hK(t){return function(r){return t.apply(null,r)}}function dK(t){return Oe.isObject(t)&&t.isAxiosError===!0}const gv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(gv).forEach(([t,e])=>{gv[e]=t});function n8(t){const e=new gc(t),r=w4(gc.prototype.request,e);return Oe.extend(r,gc.prototype,e,{allOwnKeys:!0}),Oe.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return n8(pc(t,i))},r}const fn=n8(zl);fn.Axios=gc,fn.CanceledError=Ou,fn.CancelToken=lK,fn.isCancel=j4,fn.VERSION=t8,fn.toFormData=v0,fn.AxiosError=ar,fn.Cancel=fn.CanceledError,fn.all=function(e){return Promise.all(e)},fn.spread=hK,fn.isAxiosError=dK,fn.mergeConfig=pc,fn.AxiosHeaders=wi,fn.formToJSON=t=>F4(Oe.isHTMLForm(t)?new FormData(t):t),fn.getAdapter=Q4.getAdapter,fn.HttpStatusCode=gv,fn.default=fn;const{Axios:Roe,AxiosError:pK,CanceledError:Doe,isCancel:Ooe,CancelToken:Noe,VERSION:Loe,all:koe,Cancel:$oe,isAxiosError:Boe,spread:Foe,toFormData:Uoe,AxiosHeaders:joe,HttpStatusCode:qoe,formToJSON:zoe,getAdapter:Hoe,mergeConfig:Woe}=fn,i8=fn.create({timeout:6e4,headers:{"Content-Type":"application/json",token:localStorage.getItem("auth")}});function gK(t){var e,r,n;if(((e=t.data)==null?void 0:e.success)!==!0){const i=new pK((r=t.data)==null?void 0:r.errorMessage,(n=t.data)==null?void 0:n.errorCode,t.config,t.request,t);return Promise.reject(i)}else return t}i8.interceptors.response.use(gK);class mK{constructor(e){so(this,"_apiBase","");this.request=e}setApiBase(e){this._apiBase=e||""}async getNonce(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/nonce`,e);return r.data}async getEmailCode(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/get_code`,e);return r.data}async emailLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async walletLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async tonLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async bindEmail(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindTonWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindEvmWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}}const ma=new mK(i8),vK={projectId:"7a4434fefbcc9af474fb5c995e47d286",metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},s8=zH({appName:"codatta",appLogoUrl:"https://avatars.githubusercontent.com/u/171659315"}),o8=Pe.createContext({saveLastUsedWallet:()=>{},lastUsedWallet:null,wallets:[],initialized:!1,featuredWallets:[]});function Wl(){return Pe.useContext(o8)}function bK(t){const{apiBaseUrl:e}=t,[r,n]=Pe.useState([]),[i,s]=Pe.useState([]),[o,a]=Pe.useState(null),[u,l]=Pe.useState(!1),d=A=>{console.log("saveLastUsedWallet",A)};function g(A){const P=A.filter(k=>k.featured||k.installed),N=A.filter(k=>!k.featured&&!k.installed),D=[...P,...N];n(D),s(P)}async function y(){const A=[],P=new Map;qA.forEach(D=>{const k=new Hf(D);D.name==="Coinbase Wallet"&&k.EIP6963Detected({info:{name:"Coinbase Wallet",uuid:"coinbase",icon:D.image,rdns:"coinbase"},provider:s8.getProvider()}),P.set(k.key,k),A.push(k)}),(await iz()).forEach(D=>{const k=P.get(D.info.name);if(k)k.EIP6963Detected(D);else{const $=new Hf(D);P.set($.key,$),A.push($)}});try{const D=JSON.parse(localStorage.getItem("xn-last-used-info")||"{}"),k=P.get(D.key);if(k){if(k.lastUsed=!0,D.provider==="UniversalProvider"){const $=await Q6.init(vK);$.session&&k.setUniversalProvider($)}a(k)}}catch(D){console.log(D)}g(A),l(!0)}return Pe.useEffect(()=>{y(),ma.setApiBase(e)},[]),me.jsx(o8.Provider,{value:{saveLastUsedWallet:d,wallets:r,initialized:u,lastUsedWallet:o,featuredWallets:i},children:t.children})}/** +Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,kH=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,r=await fetch(e,{method:"HEAD"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const n=r.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(LH)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:BH,getCrossOriginOpenerPolicy:$H}=kH(),y4=420,w4=540;function FH(t){const e=(window.innerWidth-y4)/2+window.screenX,r=(window.innerHeight-w4)/2+window.screenY;UH(t);const n=window.open(t,"Smart Wallet",`width=${y4}, height=${w4}, left=${e}, top=${r}`);if(n==null||n.focus(),!n)throw Sr.rpc.internal("Pop up window failed to open");return n}function jH(t){t&&!t.closed&&t.close()}function UH(t){const e={sdkName:m5,sdkVersion:Bl,origin:window.location.origin,coop:$H()};for(const[r,n]of Object.entries(e))t.searchParams.append(r,n.toString())}class qH{constructor({url:e=IH,metadata:r,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=u=>{if(u.origin!==this.url.origin)return;const l=u.data;i(l)&&(s(l),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{jH(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(Sr.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=FH(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:Bl,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw Sr.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=r,this.preference=n}}function zH(t){const e=vz(HH(t),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",Bl),r.searchParams.set("code",e.code.toString()),r.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:r.href})}function HH(t){var e;if(typeof t=="string")return{message:t,code:cn.rpc.internal};if(Hn(t)){const r=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:r.match(/(denied|rejected)/i)?cn.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:r,code:n,data:{method:t.method}})}return t}var x4={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,l,d){this.fn=u,this.context=l,this.once=d||!1}function s(u,l,d,g,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var A=new i(d,g||u,y),P=r?r+l:l;return u._events[P]?u._events[P].fn?u._events[P]=[u._events[P],A]:u._events[P].push(A):(u._events[P]=A,u._eventsCount++),u}function o(u,l){--u._eventsCount===0?u._events=new n:delete u._events[l]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,g;if(this._eventsCount===0)return l;for(g in d=this._events)e.call(d,g)&&l.push(r?g.slice(1):g);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=r?r+l:l,g=this._events[d];if(!g)return[];if(g.fn)return[g.fn];for(var y=0,A=g.length,P=new Array(A);y(i||(i=XH(n)),i)}}function _4(t,e){return function(){return t.apply(e,arguments)}}const{toString:eW}=Object.prototype,{getPrototypeOf:nv}=Object,p0=(t=>e=>{const r=eW.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Es=t=>(t=t.toLowerCase(),e=>p0(e)===t),g0=t=>e=>typeof e===t,{isArray:Ou}=Array,ql=g0("undefined");function tW(t){return t!==null&&!ql(t)&&t.constructor!==null&&!ql(t.constructor)&&Oi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const E4=Es("ArrayBuffer");function rW(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&E4(t.buffer),e}const nW=g0("string"),Oi=g0("function"),S4=g0("number"),m0=t=>t!==null&&typeof t=="object",iW=t=>t===!0||t===!1,v0=t=>{if(p0(t)!=="object")return!1;const e=nv(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},sW=Es("Date"),oW=Es("File"),aW=Es("Blob"),cW=Es("FileList"),uW=t=>m0(t)&&Oi(t.pipe),fW=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Oi(t.append)&&((e=p0(t))==="formdata"||e==="object"&&Oi(t.toString)&&t.toString()==="[object FormData]"))},lW=Es("URLSearchParams"),[hW,dW,pW,gW]=["ReadableStream","Request","Response","Headers"].map(Es),mW=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function zl(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Ou(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const mc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,P4=t=>!ql(t)&&t!==mc;function iv(){const{caseless:t}=P4(this)&&this||{},e={},r=(n,i)=>{const s=t&&A4(e,i)||i;v0(e[s])&&v0(n)?e[s]=iv(e[s],n):v0(n)?e[s]=iv({},n):Ou(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(zl(e,(i,s)=>{r&&Oi(i)?t[s]=_4(i,r):t[s]=i},{allOwnKeys:n}),t),bW=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),yW=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},wW=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&nv(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},xW=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},_W=t=>{if(!t)return null;if(Ou(t))return t;let e=t.length;if(!S4(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},EW=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&nv(Uint8Array)),SW=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},AW=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},PW=Es("HTMLFormElement"),MW=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),M4=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),IW=Es("RegExp"),I4=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};zl(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},CW=t=>{I4(t,(e,r)=>{if(Oi(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Oi(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},TW=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Ou(t)?n(t):n(String(t).split(e)),r},RW=()=>{},DW=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,sv="abcdefghijklmnopqrstuvwxyz",C4="0123456789",T4={DIGIT:C4,ALPHA:sv,ALPHA_DIGIT:sv+sv.toUpperCase()+C4},OW=(t=16,e=T4.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function NW(t){return!!(t&&Oi(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const LW=t=>{const e=new Array(10),r=(n,i)=>{if(m0(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Ou(n)?[]:{};return zl(n,(o,a)=>{const u=r(o,i+1);!ql(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},kW=Es("AsyncFunction"),BW=t=>t&&(m0(t)||Oi(t))&&Oi(t.then)&&Oi(t.catch),R4=((t,e)=>t?setImmediate:e?((r,n)=>(mc.addEventListener("message",({source:i,data:s})=>{i===mc&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),mc.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Oi(mc.postMessage)),$W=typeof queueMicrotask<"u"?queueMicrotask.bind(mc):typeof process<"u"&&process.nextTick||R4,Oe={isArray:Ou,isArrayBuffer:E4,isBuffer:tW,isFormData:fW,isArrayBufferView:rW,isString:nW,isNumber:S4,isBoolean:iW,isObject:m0,isPlainObject:v0,isReadableStream:hW,isRequest:dW,isResponse:pW,isHeaders:gW,isUndefined:ql,isDate:sW,isFile:oW,isBlob:aW,isRegExp:IW,isFunction:Oi,isStream:uW,isURLSearchParams:lW,isTypedArray:EW,isFileList:cW,forEach:zl,merge:iv,extend:vW,trim:mW,stripBOM:bW,inherits:yW,toFlatObject:wW,kindOf:p0,kindOfTest:Es,endsWith:xW,toArray:_W,forEachEntry:SW,matchAll:AW,isHTMLForm:PW,hasOwnProperty:M4,hasOwnProp:M4,reduceDescriptors:I4,freezeMethods:CW,toObjectSet:TW,toCamelCase:MW,noop:RW,toFiniteNumber:DW,findKey:A4,global:mc,isContextDefined:P4,ALPHABET:T4,generateString:OW,isSpecCompliantForm:NW,toJSONObject:LW,isAsyncFn:kW,isThenable:BW,setImmediate:R4,asap:$W};function ar(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Oe.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const D4=ar.prototype,O4={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{O4[t]={value:t}}),Object.defineProperties(ar,O4),Object.defineProperty(D4,"isAxiosError",{value:!0}),ar.from=(t,e,r,n,i,s)=>{const o=Object.create(D4);return Oe.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),ar.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const FW=null;function ov(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function N4(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function L4(t,e,r){return t?t.concat(e).map(function(i,s){return i=N4(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function jW(t){return Oe.isArray(t)&&!t.some(ov)}const UW=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function b0(t,e,r){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Oe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(O,D){return!Oe.isUndefined(D[O])});const n=r.metaTokens,i=r.visitor||d,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(i))throw new TypeError("visitor must be a function");function l(P){if(P===null)return"";if(Oe.isDate(P))return P.toISOString();if(!u&&Oe.isBlob(P))throw new ar("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(P)||Oe.isTypedArray(P)?u&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function d(P,O,D){let k=P;if(P&&!D&&typeof P=="object"){if(Oe.endsWith(O,"{}"))O=n?O:O.slice(0,-2),P=JSON.stringify(P);else if(Oe.isArray(P)&&jW(P)||(Oe.isFileList(P)||Oe.endsWith(O,"[]"))&&(k=Oe.toArray(P)))return O=N4(O),k.forEach(function(j,U){!(Oe.isUndefined(j)||j===null)&&e.append(o===!0?L4([O],U,s):o===null?O:O+"[]",l(j))}),!1}return ov(P)?!0:(e.append(L4(D,O,s),l(P)),!1)}const g=[],y=Object.assign(UW,{defaultVisitor:d,convertValue:l,isVisitable:ov});function A(P,O){if(!Oe.isUndefined(P)){if(g.indexOf(P)!==-1)throw Error("Circular reference detected in "+O.join("."));g.push(P),Oe.forEach(P,function(k,B){(!(Oe.isUndefined(k)||k===null)&&i.call(e,k,Oe.isString(B)?B.trim():B,O,y))===!0&&A(k,O?O.concat(B):[B])}),g.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return A(t),e}function k4(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function av(t,e){this._pairs=[],t&&b0(t,this,e)}const B4=av.prototype;B4.append=function(e,r){this._pairs.push([e,r])},B4.toString=function(e){const r=e?function(n){return e.call(this,n,k4)}:k4;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function qW(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function $4(t,e,r){if(!e)return t;const n=r&&r.encode||qW;Oe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(e,r):s=Oe.isURLSearchParams(e)?e.toString():new av(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class F4{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(n){n!==null&&e(n)})}}const j4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},zW={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:av,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},cv=typeof window<"u"&&typeof document<"u",uv=typeof navigator=="object"&&navigator||void 0,HW=cv&&(!uv||["ReactNative","NativeScript","NS"].indexOf(uv.product)<0),WW=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",KW=cv&&window.location.href||"http://localhost",Xn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:cv,hasStandardBrowserEnv:HW,hasStandardBrowserWebWorkerEnv:WW,navigator:uv,origin:KW},Symbol.toStringTag,{value:"Module"})),...zW};function VW(t,e){return b0(t,new Xn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Xn.isNode&&Oe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function GW(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function YW(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&Oe.isArray(i)?i.length:o,u?(Oe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Oe.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Oe.isArray(i[o])&&(i[o]=YW(i[o])),!a)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const r={};return Oe.forEachEntry(t,(n,i)=>{e(GW(n),i,r,0)}),r}return null}function JW(t,e,r){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const Hl={transitional:j4,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Oe.isObject(e);if(s&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return i?JSON.stringify(U4(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return VW(e,this.formSerializer).toString();if((a=Oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return b0(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),JW(e)):e}],transformResponse:[function(e){const r=this.transitional||Hl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ar.from(a,ar.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xn.classes.FormData,Blob:Xn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{Hl.headers[t]={}});const XW=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ZW=t=>{const e={};let r,n,i;return t&&t.split(` +`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&XW[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},q4=Symbol("internals");function Wl(t){return t&&String(t).trim().toLowerCase()}function y0(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(y0):String(t)}function QW(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const eK=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function fv(t,e,r,n,i){if(Oe.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Oe.isString(e)){if(Oe.isString(n))return e.indexOf(n)!==-1;if(Oe.isRegExp(n))return n.test(e)}}function tK(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function rK(t,e){const r=Oe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}let wi=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,u,l){const d=Wl(u);if(!d)throw new Error("header name must be a non-empty string");const g=Oe.findKey(i,d);(!g||i[g]===void 0||l===!0||l===void 0&&i[g]!==!1)&&(i[g||u]=y0(a))}const o=(a,u)=>Oe.forEach(a,(l,d)=>s(l,d,u));if(Oe.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(Oe.isString(e)&&(e=e.trim())&&!eK(e))o(ZW(e),r);else if(Oe.isHeaders(e))for(const[a,u]of e.entries())s(u,a,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return QW(i);if(Oe.isFunction(r))return r.call(this,i,n);if(Oe.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||fv(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=Wl(o),o){const a=Oe.findKey(n,o);a&&(!r||fv(n,n[a],a,r))&&(delete n[a],i=!0)}}return Oe.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||fv(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Oe.forEach(this,(i,s)=>{const o=Oe.findKey(n,s);if(o){r[o]=y0(i),delete r[s];return}const a=e?tK(s):String(s).trim();a!==s&&delete r[s],r[a]=y0(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Oe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Oe.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[q4]=this[q4]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Wl(o);n[a]||(rK(i,o),n[a]=!0)}return Oe.isArray(e)?e.forEach(s):s(e),this}};wi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Oe.reduceDescriptors(wi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),Oe.freezeMethods(wi);function lv(t,e){const r=this||Hl,n=e||r,i=wi.from(n.headers);let s=n.data;return Oe.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function z4(t){return!!(t&&t.__CANCEL__)}function Nu(t,e,r){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,r),this.name="CanceledError"}Oe.inherits(Nu,ar,{__CANCEL__:!0});function H4(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new ar("Request failed with status code "+r.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function nK(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function iK(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),d=n[s];o||(o=l),r[i]=u,n[i]=l;let g=s,y=0;for(;g!==i;)y+=r[g++],g=g%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),l-o{r=d,i=null,s&&(clearTimeout(s),s=null),t.apply(null,l)};return[(...l)=>{const d=Date.now(),g=d-r;g>=n?o(l,d):(i=l,s||(s=setTimeout(()=>{s=null,o(i)},n-g)))},()=>i&&o(i)]}const w0=(t,e,r=3)=>{let n=0;const i=iK(50,250);return sK(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,u=o-n,l=i(u),d=o<=a;n=o;const g={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:l||void 0,estimated:l&&a&&d?(a-o)/l:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(g)},r)},W4=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},K4=t=>(...e)=>Oe.asap(()=>t(...e)),oK=Xn.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Xn.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Xn.origin),Xn.navigator&&/(msie|trident)/i.test(Xn.navigator.userAgent)):()=>!0,aK=Xn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];Oe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Oe.isString(n)&&o.push("path="+n),Oe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function cK(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function uK(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function V4(t,e){return t&&!cK(e)?uK(t,e):e}const G4=t=>t instanceof wi?{...t}:t;function vc(t,e){e=e||{};const r={};function n(l,d,g,y){return Oe.isPlainObject(l)&&Oe.isPlainObject(d)?Oe.merge.call({caseless:y},l,d):Oe.isPlainObject(d)?Oe.merge({},d):Oe.isArray(d)?d.slice():d}function i(l,d,g,y){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l,g,y)}else return n(l,d,g,y)}function s(l,d){if(!Oe.isUndefined(d))return n(void 0,d)}function o(l,d){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l)}else return n(void 0,d)}function a(l,d,g){if(g in e)return n(l,d);if(g in t)return n(void 0,l)}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,d,g)=>i(G4(l),G4(d),g,!0)};return Oe.forEach(Object.keys(Object.assign({},t,e)),function(d){const g=u[d]||i,y=g(t[d],e[d],d);Oe.isUndefined(y)&&g!==a||(r[d]=y)}),r}const Y4=t=>{const e=vc({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=wi.from(o),e.url=$4(V4(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(Oe.isFormData(r)){if(Xn.hasStandardBrowserEnv||Xn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[l,...d]=u?u.split(";").map(g=>g.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...d].join("; "))}}if(Xn.hasStandardBrowserEnv&&(n&&Oe.isFunction(n)&&(n=n(e)),n||n!==!1&&oK(e.url))){const l=i&&s&&aK.read(s);l&&o.set(i,l)}return e},fK=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=Y4(t);let s=i.data;const o=wi.from(i.headers).normalize();let{responseType:a,onUploadProgress:u,onDownloadProgress:l}=i,d,g,y,A,P;function O(){A&&A(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let D=new XMLHttpRequest;D.open(i.method.toUpperCase(),i.url,!0),D.timeout=i.timeout;function k(){if(!D)return;const j=wi.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),K={data:!a||a==="text"||a==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:j,config:t,request:D};H4(function(T){r(T),O()},function(T){n(T),O()},K),D=null}"onloadend"in D?D.onloadend=k:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(k)},D.onabort=function(){D&&(n(new ar("Request aborted",ar.ECONNABORTED,t,D)),D=null)},D.onerror=function(){n(new ar("Network Error",ar.ERR_NETWORK,t,D)),D=null},D.ontimeout=function(){let U=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const K=i.transitional||j4;i.timeoutErrorMessage&&(U=i.timeoutErrorMessage),n(new ar(U,K.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,D)),D=null},s===void 0&&o.setContentType(null),"setRequestHeader"in D&&Oe.forEach(o.toJSON(),function(U,K){D.setRequestHeader(K,U)}),Oe.isUndefined(i.withCredentials)||(D.withCredentials=!!i.withCredentials),a&&a!=="json"&&(D.responseType=i.responseType),l&&([y,P]=w0(l,!0),D.addEventListener("progress",y)),u&&D.upload&&([g,A]=w0(u),D.upload.addEventListener("progress",g),D.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(d=j=>{D&&(n(!j||j.type?new Nu(null,t,D):j),D.abort(),D=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const B=nK(i.url);if(B&&Xn.protocols.indexOf(B)===-1){n(new ar("Unsupported protocol "+B+":",ar.ERR_BAD_REQUEST,t));return}D.send(s||null)})},lK=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i;const s=function(l){if(!i){i=!0,a();const d=l instanceof Error?l:this.reason;n.abort(d instanceof ar?d:new Nu(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,s(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),t=null)};t.forEach(l=>l.addEventListener("abort",s));const{signal:u}=n;return u.unsubscribe=()=>Oe.asap(a),u}},hK=function*(t,e){let r=t.byteLength;if(r{const i=dK(t,e);let s=0,o,a=u=>{o||(o=!0,n&&n(u))};return new ReadableStream({async pull(u){try{const{done:l,value:d}=await i.next();if(l){a(),u.close();return}let g=d.byteLength;if(r){let y=s+=g;r(y)}u.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(u){return a(u),i.return()}},{highWaterMark:2})},x0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",X4=x0&&typeof ReadableStream=="function",gK=x0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),Z4=(t,...e)=>{try{return!!t(...e)}catch{return!1}},mK=X4&&Z4(()=>{let t=!1;const e=new Request(Xn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Q4=64*1024,hv=X4&&Z4(()=>Oe.isReadableStream(new Response("").body)),_0={stream:hv&&(t=>t.body)};x0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!_0[e]&&(_0[e]=Oe.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,n)})})})(new Response);const vK=async t=>{if(t==null)return 0;if(Oe.isBlob(t))return t.size;if(Oe.isSpecCompliantForm(t))return(await new Request(Xn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(t)||Oe.isArrayBuffer(t))return t.byteLength;if(Oe.isURLSearchParams(t)&&(t=t+""),Oe.isString(t))return(await gK(t)).byteLength},bK=async(t,e)=>{const r=Oe.toFiniteNumber(t.getContentLength());return r??vK(e)},dv={http:FW,xhr:fK,fetch:x0&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:l,headers:d,withCredentials:g="same-origin",fetchOptions:y}=Y4(t);l=l?(l+"").toLowerCase():"text";let A=lK([i,s&&s.toAbortSignal()],o),P;const O=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let D;try{if(u&&mK&&r!=="get"&&r!=="head"&&(D=await bK(d,n))!==0){let K=new Request(e,{method:"POST",body:n,duplex:"half"}),J;if(Oe.isFormData(n)&&(J=K.headers.get("content-type"))&&d.setContentType(J),K.body){const[T,z]=W4(D,w0(K4(u)));n=J4(K.body,Q4,T,z)}}Oe.isString(g)||(g=g?"include":"omit");const k="credentials"in Request.prototype;P=new Request(e,{...y,signal:A,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:k?g:void 0});let B=await fetch(P);const j=hv&&(l==="stream"||l==="response");if(hv&&(a||j&&O)){const K={};["status","statusText","headers"].forEach(ue=>{K[ue]=B[ue]});const J=Oe.toFiniteNumber(B.headers.get("content-length")),[T,z]=a&&W4(J,w0(K4(a),!0))||[];B=new Response(J4(B.body,Q4,T,()=>{z&&z(),O&&O()}),K)}l=l||"text";let U=await _0[Oe.findKey(_0,l)||"text"](B,t);return!j&&O&&O(),await new Promise((K,J)=>{H4(K,J,{data:U,headers:wi.from(B.headers),status:B.status,statusText:B.statusText,config:t,request:P})})}catch(k){throw O&&O(),k&&k.name==="TypeError"&&/fetch/i.test(k.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,P),{cause:k.cause||k}):ar.from(k,k&&k.code,t,P)}})};Oe.forEach(dv,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const e8=t=>`- ${t}`,yK=t=>Oe.isFunction(t)||t===null||t===!1,t8={getAdapter:t=>{t=Oe.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : +`+s.map(e8).join(` +`):" "+e8(s[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:dv};function pv(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Nu(null,t)}function r8(t){return pv(t),t.headers=wi.from(t.headers),t.data=lv.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),t8.getAdapter(t.adapter||Hl.adapter)(t).then(function(n){return pv(t),n.data=lv.call(t,t.transformResponse,n),n.headers=wi.from(n.headers),n},function(n){return z4(n)||(pv(t),n&&n.response&&(n.response.data=lv.call(t,t.transformResponse,n.response),n.response.headers=wi.from(n.response.headers))),Promise.reject(n)})}const n8="1.7.8",E0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{E0[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const i8={};E0.transitional=function(e,r,n){function i(s,o){return"[Axios v"+n8+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new ar(i(o," has been removed"+(r?" in "+r:"")),ar.ERR_DEPRECATED);return r&&!i8[o]&&(i8[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}},E0.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function wK(t,e,r){if(typeof t!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new ar("option "+s+" must be "+u,ar.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ar("Unknown option "+s,ar.ERR_BAD_OPTION)}}const S0={assertOptions:wK,validators:E0},Zs=S0.validators;let bc=class{constructor(e){this.defaults=e,this.interceptors={request:new F4,response:new F4}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` +`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=vc(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&S0.assertOptions(n,{silentJSONParsing:Zs.transitional(Zs.boolean),forcedJSONParsing:Zs.transitional(Zs.boolean),clarifyTimeoutError:Zs.transitional(Zs.boolean)},!1),i!=null&&(Oe.isFunction(i)?r.paramsSerializer={serialize:i}:S0.assertOptions(i,{encode:Zs.function,serialize:Zs.function},!0)),S0.assertOptions(r,{baseUrl:Zs.spelling("baseURL"),withXsrfToken:Zs.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Oe.merge(s.common,s[r.method]);s&&Oe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete s[P]}),r.headers=wi.concat(o,s);const a=[];let u=!0;this.interceptors.request.forEach(function(O){typeof O.runWhen=="function"&&O.runWhen(r)===!1||(u=u&&O.synchronous,a.unshift(O.fulfilled,O.rejected))});const l=[];this.interceptors.response.forEach(function(O){l.push(O.fulfilled,O.rejected)});let d,g=0,y;if(!u){const P=[r8.bind(this),void 0];for(P.unshift.apply(P,a),P.push.apply(P,l),y=P.length,d=Promise.resolve(r);g{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new Nu(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new YA(function(i){e=i}),cancel:e}}};function _K(t){return function(r){return t.apply(null,r)}}function EK(t){return Oe.isObject(t)&&t.isAxiosError===!0}const gv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(gv).forEach(([t,e])=>{gv[e]=t});function s8(t){const e=new bc(t),r=_4(bc.prototype.request,e);return Oe.extend(r,bc.prototype,e,{allOwnKeys:!0}),Oe.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return s8(vc(t,i))},r}const fn=s8(Hl);fn.Axios=bc,fn.CanceledError=Nu,fn.CancelToken=xK,fn.isCancel=z4,fn.VERSION=n8,fn.toFormData=b0,fn.AxiosError=ar,fn.Cancel=fn.CanceledError,fn.all=function(e){return Promise.all(e)},fn.spread=_K,fn.isAxiosError=EK,fn.mergeConfig=vc,fn.AxiosHeaders=wi,fn.formToJSON=t=>U4(Oe.isHTMLForm(t)?new FormData(t):t),fn.getAdapter=t8.getAdapter,fn.HttpStatusCode=gv,fn.default=fn;const{Axios:Loe,AxiosError:SK,CanceledError:koe,isCancel:Boe,CancelToken:$oe,VERSION:Foe,all:joe,Cancel:Uoe,isAxiosError:qoe,spread:zoe,toFormData:Hoe,AxiosHeaders:Woe,HttpStatusCode:Koe,formToJSON:Voe,getAdapter:Goe,mergeConfig:Yoe}=fn,o8=fn.create({timeout:6e4,headers:{"Content-Type":"application/json",token:localStorage.getItem("auth")}});function AK(t){var e,r,n;if(((e=t.data)==null?void 0:e.success)!==!0){const i=new SK((r=t.data)==null?void 0:r.errorMessage,(n=t.data)==null?void 0:n.errorCode,t.config,t.request,t);return Promise.reject(i)}else return t}o8.interceptors.response.use(AK);class PK{constructor(e){co(this,"_apiBase","");this.request=e}setApiBase(e){this._apiBase=e||""}async getNonce(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/nonce`,e);return r.data}async getEmailCode(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/get_code`,e);return r.data}async emailLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async walletLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async tonLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async bindEmail(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindTonWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindEvmWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}}const No=new PK(o8),MK={projectId:"7a4434fefbcc9af474fb5c995e47d286",metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},a8=QH({appName:"codatta",appLogoUrl:"https://avatars.githubusercontent.com/u/171659315"}),c8=Se.createContext({saveLastUsedWallet:()=>{},lastUsedWallet:null,wallets:[],initialized:!1,featuredWallets:[]});function Kl(){return Se.useContext(c8)}function IK(t){const{apiBaseUrl:e}=t,[r,n]=Se.useState([]),[i,s]=Se.useState([]),[o,a]=Se.useState(null),[u,l]=Se.useState(!1),d=A=>{console.log("saveLastUsedWallet",A)};function g(A){const P=A.filter(k=>k.featured||k.installed),O=A.filter(k=>!k.featured&&!k.installed),D=[...P,...O];n(D),s(P)}async function y(){const A=[],P=new Map;ZA.forEach(D=>{const k=new Wf(D);D.name==="Coinbase Wallet"&&k.EIP6963Detected({info:{name:"Coinbase Wallet",uuid:"coinbase",icon:D.image,rdns:"coinbase"},provider:a8.getProvider()}),P.set(k.key,k),A.push(k)}),(await pz()).forEach(D=>{const k=P.get(D.info.name);if(k)k.EIP6963Detected(D);else{const B=new Wf(D);P.set(B.key,B),A.push(B)}});try{const D=JSON.parse(localStorage.getItem("xn-last-used-info")||"{}"),k=P.get(D.key);if(k){if(k.lastUsed=!0,D.provider==="UniversalProvider"){const B=await t5.init(MK);B.session&&k.setUniversalProvider(B)}a(k)}}catch(D){console.log(D)}g(A),l(!0)}return Se.useEffect(()=>{y(),No.setApiBase(e)},[]),le.jsx(c8.Provider,{value:{saveLastUsedWallet:d,wallets:r,initialized:u,lastUsedWallet:o,featuredWallets:i},children:t.children})}/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const yK=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a8=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/** + */const CK=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),u8=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */var wK={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + */var TK={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xK=Pe.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:s,iconNode:o,...a},u)=>Pe.createElement("svg",{ref:u,...wK,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:a8("lucide",i),...a},[...o.map(([l,d])=>Pe.createElement(l,d)),...Array.isArray(s)?s:[s]]));/** + */const RK=Se.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:s,iconNode:o,...a},u)=>Se.createElement("svg",{ref:u,...TK,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:u8("lucide",i),...a},[...o.map(([l,d])=>Se.createElement(l,d)),...Array.isArray(s)?s:[s]]));/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Es=(t,e)=>{const r=Pe.forwardRef(({className:n,...i},s)=>Pe.createElement(xK,{ref:s,iconNode:e,className:a8(`lucide-${yK(t)}`,n),...i}));return r.displayName=`${t}`,r};/** + */const Ss=(t,e)=>{const r=Se.forwardRef(({className:n,...i},s)=>Se.createElement(RK,{ref:s,iconNode:e,className:u8(`lucide-${CK(t)}`,n),...i}));return r.displayName=`${t}`,r};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _K=Es("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + */const DK=Ss("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const c8=Es("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + */const f8=Ss("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const EK=Es("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const OK=Ss("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const SK=Es("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** + */const NK=Ss("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const AK=Es("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + */const LK=Ss("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const PK=Es("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** + */const kK=Ss("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const u8=Es("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** + */const l8=Ss("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const MK=Es("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** + */const BK=Ss("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mc=Es("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + */const ya=Ss("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const IK=Es("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** + */const h8=Ss("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const f8=Es("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),l8=new Set;function S0(t,e,r){t||l8.has(e)||(console.warn(e),l8.add(e))}function CK(t){if(typeof Proxy>"u")return t;const e=new Map,r=(...n)=>(process.env.NODE_ENV!=="production"&&S0(!1,"motion() is deprecated. Use motion.create() instead."),t(...n));return new Proxy(r,{get:(n,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}function A0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const mv=t=>Array.isArray(t);function h8(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function vv(t,e,r,n){if(typeof e=="function"){const[i,s]=d8(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=d8(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function P0(t,e,r){const n=t.getProps();return vv(n,e,r!==void 0?r:n.custom,t)}const bv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],yv=["initial",...bv],Vl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],vc=new Set(Vl),Zs=t=>t*1e3,Ro=t=>t/1e3,TK={type:"spring",stiffness:500,damping:25,restSpeed:10},RK=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),DK={type:"keyframes",duration:.8},OK={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},NK=(t,{keyframes:e})=>e.length>2?DK:vc.has(t)?t.startsWith("scale")?RK(e[1]):TK:OK;function wv(t,e){return t?t[e]||t.default||t:void 0}const LK={useManualTiming:!1},kK=t=>t!==null;function M0(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(kK),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const Hn=t=>t;function $K(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){s.has(l)&&(u.schedule(l),t()),l(o)}const u={schedule:(l,d=!1,g=!1)=>{const A=g&&n?e:r;return d&&s.add(l),A.has(l)||A.add(l),l},cancel:l=>{r.delete(l),s.delete(l)},process:l=>{if(o=l,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,u.process(l))}};return u}const I0=["read","resolveKeyframes","update","preRender","render","postRender"],BK=40;function p8(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=I0.reduce((k,$)=>(k[$]=$K(s),k),{}),{read:a,resolveKeyframes:u,update:l,preRender:d,render:g,postRender:y}=o,A=()=>{const k=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(k-i.timestamp,BK),1),i.timestamp=k,i.isProcessing=!0,a.process(i),u.process(i),l.process(i),d.process(i),g.process(i),y.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(A))},P=()=>{r=!0,n=!0,i.isProcessing||t(A)};return{schedule:I0.reduce((k,$)=>{const q=o[$];return k[$]=(U,K=!1,J=!1)=>(r||P(),q.schedule(U,K,J)),k},{}),cancel:k=>{for(let $=0;$(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,FK=1e-7,UK=12;function jK(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=g8(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>FK&&++ajK(s,0,1,t,r);return s=>s===0||s===1?s:g8(i(s),e,n)}const m8=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,v8=t=>e=>1-t(1-e),b8=Gl(.33,1.53,.69,.99),_v=v8(b8),y8=m8(_v),w8=t=>(t*=2)<1?.5*_v(t):.5*(2-Math.pow(2,-10*(t-1))),Ev=t=>1-Math.sin(Math.acos(t)),x8=v8(Ev),_8=m8(Ev),E8=t=>/^0[^.\s]+$/u.test(t);function qK(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||E8(t):!0}let Nu=Hn,Do=Hn;process.env.NODE_ENV!=="production"&&(Nu=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},Do=(t,e)=>{if(!t)throw new Error(e)});const S8=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),A8=t=>e=>typeof e=="string"&&e.startsWith(t),P8=A8("--"),zK=A8("var(--"),Sv=t=>zK(t)?HK.test(t.split("/*")[0].trim()):!1,HK=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,WK=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function KK(t){const e=WK.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}const VK=4;function M8(t,e,r=1){Do(r<=VK,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[n,i]=KK(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return S8(o)?parseFloat(o):o}return Sv(i)?M8(i,e,r+1):i}const ba=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},Yl={...Lu,transform:t=>ba(0,1,t)},C0={...Lu,default:1},Jl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),ya=Jl("deg"),Qs=Jl("%"),zt=Jl("px"),GK=Jl("vh"),YK=Jl("vw"),I8={...Qs,parse:t=>Qs.parse(t)/100,transform:t=>Qs.transform(t*100)},JK=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),C8=t=>t===Lu||t===zt,T8=(t,e)=>parseFloat(t.split(", ")[e]),R8=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return T8(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?T8(s[1],t):0}},XK=new Set(["x","y","z"]),ZK=Vl.filter(t=>!XK.has(t));function QK(t){const e=[];return ZK.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const ku={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:R8(4,13),y:R8(5,14)};ku.translateX=ku.x,ku.translateY=ku.y;const D8=t=>e=>e.test(t),O8=[Lu,zt,Qs,ya,YK,GK,{test:t=>t==="auto",parse:t=>t}],N8=t=>O8.find(D8(t)),bc=new Set;let Av=!1,Pv=!1;function L8(){if(Pv){const t=Array.from(bc).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=QK(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}Pv=!1,Av=!1,bc.forEach(t=>t.complete()),bc.clear()}function k8(){bc.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Pv=!0)})}function eV(){k8(),L8()}class Mv{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(bc.add(this),Av||(Av=!0,Nr.read(k8),Nr.resolveKeyframes(L8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sMath.round(t*1e5)/1e5,Iv=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function tV(t){return t==null}const rV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Cv=(t,e)=>r=>!!(typeof r=="string"&&rV.test(r)&&r.startsWith(t)||e&&!tV(r)&&Object.prototype.hasOwnProperty.call(r,e)),$8=(t,e,r)=>n=>{if(typeof n!="string")return n;const[i,s,o,a]=n.match(Iv);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},nV=t=>ba(0,255,t),Tv={...Lu,transform:t=>Math.round(nV(t))},yc={test:Cv("rgb","red"),parse:$8("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+Tv.transform(t)+", "+Tv.transform(e)+", "+Tv.transform(r)+", "+Xl(Yl.transform(n))+")"};function iV(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const Rv={test:Cv("#"),parse:iV,transform:yc.transform},$u={test:Cv("hsl","hue"),parse:$8("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+Qs.transform(Xl(e))+", "+Qs.transform(Xl(r))+", "+Xl(Yl.transform(n))+")"},Zn={test:t=>yc.test(t)||Rv.test(t)||$u.test(t),parse:t=>yc.test(t)?yc.parse(t):$u.test(t)?$u.parse(t):Rv.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?yc.transform(t):$u.transform(t)},sV=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function oV(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Iv))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(sV))===null||r===void 0?void 0:r.length)||0)>0}const B8="number",F8="color",aV="var",cV="var(",U8="${}",uV=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Zl(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(uV,u=>(Zn.test(u)?(n.color.push(s),i.push(F8),r.push(Zn.parse(u))):u.startsWith(cV)?(n.var.push(s),i.push(aV),r.push(u)):(n.number.push(s),i.push(B8),r.push(parseFloat(u))),++s,U8)).split(U8);return{values:r,split:a,indexes:n,types:i}}function j8(t){return Zl(t).values}function q8(t){const{split:e,types:r}=Zl(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function lV(t){const e=j8(t);return q8(t)(e.map(fV))}const wa={test:oV,parse:j8,createTransformer:q8,getAnimatableNone:lV},hV=new Set(["brightness","contrast","saturate","opacity"]);function dV(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(Iv)||[];if(!n)return t;const i=r.replace(n,"");let s=hV.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const pV=/\b([a-z-]*)\(.*?\)/gu,Dv={...wa,getAnimatableNone:t=>{const e=t.match(pV);return e?e.map(dV).join(" "):t}},gV={borderWidth:zt,borderTopWidth:zt,borderRightWidth:zt,borderBottomWidth:zt,borderLeftWidth:zt,borderRadius:zt,radius:zt,borderTopLeftRadius:zt,borderTopRightRadius:zt,borderBottomRightRadius:zt,borderBottomLeftRadius:zt,width:zt,maxWidth:zt,height:zt,maxHeight:zt,top:zt,right:zt,bottom:zt,left:zt,padding:zt,paddingTop:zt,paddingRight:zt,paddingBottom:zt,paddingLeft:zt,margin:zt,marginTop:zt,marginRight:zt,marginBottom:zt,marginLeft:zt,backgroundPositionX:zt,backgroundPositionY:zt},mV={rotate:ya,rotateX:ya,rotateY:ya,rotateZ:ya,scale:C0,scaleX:C0,scaleY:C0,scaleZ:C0,skew:ya,skewX:ya,skewY:ya,distance:zt,translateX:zt,translateY:zt,translateZ:zt,x:zt,y:zt,z:zt,perspective:zt,transformPerspective:zt,opacity:Yl,originX:I8,originY:I8,originZ:zt},z8={...Lu,transform:Math.round},Ov={...gV,...mV,zIndex:z8,size:zt,fillOpacity:Yl,strokeOpacity:Yl,numOctaves:z8},vV={...Ov,color:Zn,backgroundColor:Zn,outlineColor:Zn,fill:Zn,stroke:Zn,borderColor:Zn,borderTopColor:Zn,borderRightColor:Zn,borderBottomColor:Zn,borderLeftColor:Zn,filter:Dv,WebkitFilter:Dv},Nv=t=>vV[t];function H8(t,e){let r=Nv(t);return r!==Dv&&(r=wa),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const bV=new Set(["auto","none","0"]);function yV(t,e,r){let n=0,i;for(;n{r.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function Lv(t){return typeof t=="function"}let T0;function wV(){T0=void 0}const eo={now:()=>(T0===void 0&&eo.set(Wn.isProcessing||LK.useManualTiming?Wn.timestamp:performance.now()),T0),set:t=>{T0=t,queueMicrotask(wV)}},K8=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(wa.test(t)||t==="0")&&!t.startsWith("url("));function xV(t){const e=t[0];if(t.length===1)return!0;for(let r=0;rEV?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&eV(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=eo.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:u,isGenerator:l}=this.options;if(!l&&!_V(e,n,i,s))if(o)this.options.duration=0;else{u==null||u(M0(e,this.options,r)),a==null||a(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,r);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...d},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function G8(t,e){return e?t*(1e3/e):0}const SV=5;function Y8(t,e,r){const n=Math.max(e-SV,0);return G8(r-t(n),e-n)}const kv=.001,AV=.01,J8=10,PV=.05,MV=1;function IV({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;Nu(t<=Zs(J8),"Spring duration must be 10 seconds or less");let o=1-e;o=ba(PV,MV,o),t=ba(AV,J8,Ro(t)),o<1?(i=l=>{const d=l*o,g=d*t,y=d-r,A=$v(l,o),P=Math.exp(-g);return kv-y/A*P},s=l=>{const g=l*o*t,y=g*r+r,A=Math.pow(o,2)*Math.pow(l,2)*t,P=Math.exp(-g),N=$v(Math.pow(l,2),o);return(-i(l)+kv>0?-1:1)*((y-A)*P)/N}):(i=l=>{const d=Math.exp(-l*t),g=(l-r)*t+1;return-kv+d*g},s=l=>{const d=Math.exp(-l*t),g=(r-l)*(t*t);return d*g});const a=5/t,u=TV(i,s,a);if(t=Zs(t),isNaN(u))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(u,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:t}}}const CV=12;function TV(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function OV(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!X8(t,DV)&&X8(t,RV)){const r=IV(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function Z8({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:u,mass:l,duration:d,velocity:g,isResolvedFromDuration:y}=OV({...n,velocity:-Ro(n.velocity||0)}),A=g||0,P=u/(2*Math.sqrt(a*l)),N=s-i,D=Ro(Math.sqrt(a/l)),k=Math.abs(N)<5;r||(r=k?.01:2),e||(e=k?.005:.5);let $;if(P<1){const q=$v(D,P);$=U=>{const K=Math.exp(-P*D*U);return s-K*((A+P*D*N)/q*Math.sin(q*U)+N*Math.cos(q*U))}}else if(P===1)$=q=>s-Math.exp(-D*q)*(N+(A+D*N)*q);else{const q=D*Math.sqrt(P*P-1);$=U=>{const K=Math.exp(-P*D*U),J=Math.min(q*U,300);return s-K*((A+P*D*N)*Math.sinh(J)+q*N*Math.cosh(J))/q}}return{calculatedDuration:y&&d||null,next:q=>{const U=$(q);if(y)o.done=q>=d;else{let K=0;P<1&&(K=q===0?Zs(A):Y8($,q,U));const J=Math.abs(K)<=r,T=Math.abs(s-U)<=e;o.done=J&&T}return o.value=o.done?s:U,o}}}function Q8({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:d}){const g=t[0],y={done:!1,value:g},A=z=>a!==void 0&&zu,P=z=>a===void 0?u:u===void 0||Math.abs(a-z)-N*Math.exp(-z/n),q=z=>k+$(z),U=z=>{const ue=$(z),_e=q(z);y.done=Math.abs(ue)<=l,y.value=y.done?k:_e};let K,J;const T=z=>{A(y.value)&&(K=z,J=Z8({keyframes:[y.value,P(y.value)],velocity:Y8(q,z,y.value),damping:i,stiffness:s,restDelta:l,restSpeed:d}))};return T(0),{calculatedDuration:null,next:z=>{let ue=!1;return!J&&K===void 0&&(ue=!0,U(z),T(z)),K!==void 0&&z>=K?J.next(z-K):(!ue&&U(z),y)}}}const NV=Gl(.42,0,1,1),LV=Gl(0,0,.58,1),eE=Gl(.42,0,.58,1),kV=t=>Array.isArray(t)&&typeof t[0]!="number",Bv=t=>Array.isArray(t)&&typeof t[0]=="number",tE={linear:Hn,easeIn:NV,easeInOut:eE,easeOut:LV,circIn:Ev,circInOut:_8,circOut:x8,backIn:_v,backInOut:y8,backOut:b8,anticipate:w8},rE=t=>{if(Bv(t)){Do(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,r,n,i]=t;return Gl(e,r,n,i)}else if(typeof t=="string")return Do(tE[t]!==void 0,`Invalid easing type '${t}'`),tE[t];return t},$V=(t,e)=>r=>e(t(r)),Oo=(...t)=>t.reduce($V),Bu=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},Zr=(t,e,r)=>t+(e-t)*r;function Fv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function BV({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,u=2*r-a;i=Fv(u,a,t+1/3),s=Fv(u,a,t),o=Fv(u,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function R0(t,e){return r=>r>0?e:t}const Uv=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},FV=[Rv,yc,$u],UV=t=>FV.find(e=>e.test(t));function nE(t){const e=UV(t);if(Nu(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let r=e.parse(t);return e===$u&&(r=BV(r)),r}const iE=(t,e)=>{const r=nE(t),n=nE(e);if(!r||!n)return R0(t,e);const i={...r};return s=>(i.red=Uv(r.red,n.red,s),i.green=Uv(r.green,n.green,s),i.blue=Uv(r.blue,n.blue,s),i.alpha=Zr(r.alpha,n.alpha,s),yc.transform(i))},jv=new Set(["none","hidden"]);function jV(t,e){return jv.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function qV(t,e){return r=>Zr(t,e,r)}function qv(t){return typeof t=="number"?qV:typeof t=="string"?Sv(t)?R0:Zn.test(t)?iE:WV:Array.isArray(t)?sE:typeof t=="object"?Zn.test(t)?iE:zV:R0}function sE(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>qv(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function HV(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=wa.createTransformer(e),n=Zl(t),i=Zl(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?jv.has(t)&&!i.values.length||jv.has(e)&&!n.values.length?jV(t,e):Oo(sE(HV(n,i),i.values),r):(Nu(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),R0(t,e))};function oE(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Zr(t,e,r):qv(t)(t,e)}function KV(t,e,r){const n=[],i=r||oE,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=KV(e,n,i),a=o.length,u=l=>{let d=0;if(a>1)for(;du(ba(t[0],t[s-1],l)):u}function GV(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=Bu(0,e,n);t.push(Zr(r,1,i))}}function YV(t){const e=[0];return GV(e,t.length-1),e}function JV(t,e){return t.map(r=>r*e)}function XV(t,e){return t.map(()=>e||eE).splice(0,t.length-1)}function D0({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=kV(n)?n.map(rE):rE(n),s={done:!1,value:e[0]},o=JV(r&&r.length===e.length?r:YV(e),t),a=VV(o,e,{ease:Array.isArray(i)?i:XV(e,i)});return{calculatedDuration:t,next:u=>(s.value=a(u),s.done=u>=t,s)}}const aE=2e4;function ZV(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=aE?1/0:e}const QV=t=>{const e=({timestamp:r})=>t(r);return{start:()=>Nr.update(e,!0),stop:()=>va(e),now:()=>Wn.isProcessing?Wn.timestamp:eo.now()}},eG={decay:Q8,inertia:Q8,tween:D0,keyframes:D0,spring:Z8},tG=t=>t/100;class zv extends V8{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:u}=this.options;u&&u()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Mv,a=(u,l)=>this.onKeyframesResolved(u,l);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=Lv(r)?r:eG[r]||D0;let u,l;a!==D0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&Do(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),u=Oo(tG,oE(e[0],e[1])),e=[0,100]);const d=a({...this.options,keyframes:e});s==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=ZV(d));const{calculatedDuration:g}=d,y=g+i,A=y*(n+1)-i;return{generator:d,mirroredGenerator:l,mapPercentToKeyframes:u,calculatedDuration:g,resolvedDuration:y,totalDuration:A}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:z}=this.options;return{done:!0,value:z[z.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:u,calculatedDuration:l,totalDuration:d,resolvedDuration:g}=n;if(this.startTime===null)return s.next(0);const{delay:y,repeat:A,repeatType:P,repeatDelay:N,onUpdate:D}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const k=this.currentTime-y*(this.speed>=0?1:-1),$=this.speed>=0?k<0:k>d;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let q=this.currentTime,U=s;if(A){const z=Math.min(this.currentTime,d)/g;let ue=Math.floor(z),_e=z%1;!_e&&z>=1&&(_e=1),_e===1&&ue--,ue=Math.min(ue,A+1),!!(ue%2)&&(P==="reverse"?(_e=1-_e,N&&(_e-=N/g)):P==="mirror"&&(U=o)),q=ba(0,1,_e)*g}const K=$?{done:!1,value:u[0]}:U.next(q);a&&(K.value=a(K.value));let{done:J}=K;!$&&l!==null&&(J=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&J);return T&&i!==void 0&&(K.value=M0(u,this.options,i)),D&&D(K.value),T&&this.finish(),K}get duration(){const{resolved:e}=this;return e?Ro(e.calculatedDuration):0}get time(){return Ro(this.currentTime)}set time(e){e=Zs(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=Ro(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=QV,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const rG=new Set(["opacity","clipPath","filter","transform"]),nG=10,iG=(t,e)=>{let r="";const n=Math.max(Math.round(e/nG),2);for(let i=0;i(e===void 0&&(e=t()),e)}const sG={linearEasing:void 0};function oG(t,e){const r=Hv(t);return()=>{var n;return(n=sG[e])!==null&&n!==void 0?n:r()}}const O0=oG(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function cE(t){return!!(typeof t=="function"&&O0()||!t||typeof t=="string"&&(t in Wv||O0())||Bv(t)||Array.isArray(t)&&t.every(cE))}const Ql=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,Wv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ql([0,.65,.55,1]),circOut:Ql([.55,0,1,.45]),backIn:Ql([.31,.01,.66,-.59]),backOut:Ql([.33,1.53,.69,.99])};function uE(t,e){if(t)return typeof t=="function"&&O0()?iG(t,e):Bv(t)?Ql(t):Array.isArray(t)?t.map(r=>uE(r,e)||Wv.easeOut):Wv[t]}function aG(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:u}={}){const l={[e]:r};u&&(l.offset=u);const d=uE(a,i);return Array.isArray(d)&&(l.easing=d),t.animate(l,{delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function fE(t,e){t.timeline=e,t.onfinish=null}const cG=Hv(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),N0=10,uG=2e4;function fG(t){return Lv(t.type)||t.type==="spring"||!cE(t.ease)}function lG(t,e){const r=new zv({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&sthis.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:u,name:l,startTime:d}=this.options;if(!(!((n=u.owner)===null||n===void 0)&&n.current))return!1;if(typeof o=="string"&&O0()&&hG(o)&&(o=lE[o]),fG(this.options)){const{onComplete:y,onUpdate:A,motionValue:P,element:N,...D}=this.options,k=lG(e,D);e=k.keyframes,e.length===1&&(e[1]=e[0]),i=k.duration,s=k.times,o=k.ease,a="keyframes"}const g=aG(u.owner.current,l,e,{...this.options,duration:i,times:s,ease:o});return g.startTime=d??this.calcStartTime(),this.pendingTimeline?(fE(g,this.pendingTimeline),this.pendingTimeline=void 0):g.onfinish=()=>{const{onComplete:y}=this.options;u.set(M0(e,this.options,r)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:g,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return Ro(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return Ro(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=Zs(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return Hn;const{animation:n}=r;fE(n,e)}return Hn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:d,onComplete:g,element:y,...A}=this.options,P=new zv({...A,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),N=Zs(this.time);l.setWithVelocity(P.sample(N-N0).value,P.sample(N).value,N0)}const{onStop:u}=this.options;u&&u(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return cG()&&n&&rG.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}const dG=Hv(()=>window.ScrollTimeline!==void 0);class pG{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;ndG()&&i.attachTimeline?i.attachTimeline(e):r(i));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function gG({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:u,elapsed:l,...d}){return!!Object.keys(d).length}const Kv=(t,e,r,n={},i,s)=>o=>{const a=wv(n,t)||{},u=a.delay||n.delay||0;let{elapsed:l=0}=n;l=l-Zs(u);let d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:y=>{e.set(y),a.onUpdate&&a.onUpdate(y)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:i};gG(a)||(d={...d,...NK(t,d)}),d.duration&&(d.duration=Zs(d.duration)),d.repeatDelay&&(d.repeatDelay=Zs(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let g=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(g=!0)),g&&!s&&e.get()!==void 0){const y=M0(d.keyframes,a);if(y!==void 0)return Nr.update(()=>{d.onUpdate(y),d.onComplete()}),new pG([])}return!s&&hE.supports(d)?new hE(d):new zv(d)},mG=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),vG=t=>mv(t)?t[t.length-1]||0:t;function Vv(t,e){t.indexOf(e)===-1&&t.push(e)}function Gv(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class Yv{constructor(){this.subscriptions=[]}add(e){return Vv(this.subscriptions,e),()=>Gv(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class yG{constructor(e,r={}){this.version="11.11.17",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=eo.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=eo.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=bG(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&S0(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new Yv);const n=this.events[e].add(r);return e==="change"?()=>{n(),Nr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=eo.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>dE)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,dE);return G8(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function eh(t,e){return new yG(t,e)}function wG(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,eh(r))}function xG(t,e){const r=P0(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=vG(s[o]);wG(t,o,a)}}const Jv=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),pE="data-"+Jv("framerAppearId");function gE(t){return t.props[pE]}const Qn=t=>!!(t&&t.getVelocity);function _G(t){return!!(Qn(t)&&t.add)}function Xv(t,e){const r=t.getValue("willChange");if(_G(r))return r.add(e)}function EG({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function mE(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...u}=e;n&&(o=n);const l=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const g in u){const y=t.getValue(g,(s=t.latestValues[g])!==null&&s!==void 0?s:null),A=u[g];if(A===void 0||d&&EG(d,g))continue;const P={delay:r,...wv(o||{},g)};let N=!1;if(window.MotionHandoffAnimation){const k=gE(t);if(k){const $=window.MotionHandoffAnimation(k,g,Nr);$!==null&&(P.startTime=$,N=!0)}}Xv(t,g),y.start(Kv(g,y,A,t.shouldReduceMotion&&vc.has(g)?{type:!1}:P,t,N));const D=y.animation;D&&l.push(D)}return a&&Promise.all(l).then(()=>{Nr.update(()=>{a&&xG(t,a)})}),l}function Zv(t,e,r={}){var n;const i=P0(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(mE(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:g,staggerDirection:y}=s;return SG(t,e,d+l,g,y,r)}:()=>Promise.resolve(),{when:u}=s;if(u){const[l,d]=u==="beforeChildren"?[o,a]:[a,o];return l().then(()=>d())}else return Promise.all([o(),a(r.delay)])}function SG(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,u=i===1?(l=0)=>l*n:(l=0)=>a-l*n;return Array.from(t.variantChildren).sort(AG).forEach((l,d)=>{l.notify("AnimationStart",e),o.push(Zv(l,e,{...s,delay:r+u(d)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function AG(t,e){return t.sortNodePosition(e)}function PG(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>Zv(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=Zv(t,e,r);else{const i=typeof e=="function"?P0(t,e,r.custom):e;n=Promise.all(mE(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const MG=yv.length;function vE(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?vE(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;rPromise.all(e.map(({animation:r,options:n})=>PG(t,r,n)))}function RG(t){let e=TG(t),r=bE(),n=!0;const i=u=>(l,d)=>{var g;const y=P0(t,d,u==="exit"?(g=t.presenceContext)===null||g===void 0?void 0:g.custom:void 0);if(y){const{transition:A,transitionEnd:P,...N}=y;l={...l,...N,...P}}return l};function s(u){e=u(t)}function o(u){const{props:l}=t,d=vE(t.parent)||{},g=[],y=new Set;let A={},P=1/0;for(let D=0;DP&&U,ue=!1;const _e=Array.isArray(q)?q:[q];let G=_e.reduce(i(k),{});K===!1&&(G={});const{prevResolvedValues:E={}}=$,m={...E,...G},f=x=>{z=!0,y.has(x)&&(ue=!0,y.delete(x)),$.needsAnimating[x]=!0;const _=t.getValue(x);_&&(_.liveStyle=!1)};for(const x in m){const _=G[x],S=E[x];if(A.hasOwnProperty(x))continue;let b=!1;mv(_)&&mv(S)?b=!h8(_,S):b=_!==S,b?_!=null?f(x):y.add(x):_!==void 0&&y.has(x)?f(x):$.protectedKeys[x]=!0}$.prevProp=q,$.prevResolvedValues=G,$.isActive&&(A={...A,...G}),n&&t.blockInitialAnimation&&(z=!1),z&&(!(J&&T)||ue)&&g.push(..._e.map(x=>({animation:x,options:{type:k}})))}if(y.size){const D={};y.forEach(k=>{const $=t.getBaseTarget(k),q=t.getValue(k);q&&(q.liveStyle=!0),D[k]=$??null}),g.push({animation:D})}let N=!!g.length;return n&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(N=!1),n=!1,N?e(g):Promise.resolve()}function a(u,l){var d;if(r[u].isActive===l)return Promise.resolve();(d=t.variantChildren)===null||d===void 0||d.forEach(y=>{var A;return(A=y.animationState)===null||A===void 0?void 0:A.setActive(u,l)}),r[u].isActive=l;const g=o(u);for(const y in r)r[y].protectedKeys={};return g}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=bE(),n=!0}}}function DG(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!h8(e,t):!1}function wc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function bE(){return{animate:wc(!0),whileInView:wc(),whileHover:wc(),whileTap:wc(),whileDrag:wc(),whileFocus:wc(),exit:wc()}}class xa{constructor(e){this.isMounted=!1,this.node=e}update(){}}class OG extends xa{constructor(e){super(e),e.animationState||(e.animationState=RG(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();A0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let NG=0;class LG extends xa{constructor(){super(...arguments),this.id=NG++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const kG={animation:{Feature:OG},exit:{Feature:LG}},yE=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function L0(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const $G=t=>e=>yE(e)&&t(e,L0(e));function No(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function Lo(t,e,r,n){return No(t,e,$G(r),n)}const wE=(t,e)=>Math.abs(t-e);function BG(t,e){const r=wE(t.x,e.x),n=wE(t.y,e.y);return Math.sqrt(r**2+n**2)}class xE{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=eb(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,A=BG(g.offset,{x:0,y:0})>=3;if(!y&&!A)return;const{point:P}=g,{timestamp:N}=Wn;this.history.push({...P,timestamp:N});const{onStart:D,onMove:k}=this.handlers;y||(D&&D(this.lastMoveEvent,g),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,g)},this.handlePointerMove=(g,y)=>{this.lastMoveEvent=g,this.lastMoveEventInfo=Qv(y,this.transformPagePoint),Nr.update(this.updatePoint,!0)},this.handlePointerUp=(g,y)=>{this.end();const{onEnd:A,onSessionEnd:P,resumeAnimation:N}=this.handlers;if(this.dragSnapToOrigin&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=eb(g.type==="pointercancel"?this.lastMoveEventInfo:Qv(y,this.transformPagePoint),this.history);this.startEvent&&A&&A(g,D),P&&P(g,D)},!yE(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=L0(e),a=Qv(o,this.transformPagePoint),{point:u}=a,{timestamp:l}=Wn;this.history=[{...u,timestamp:l}];const{onSessionStart:d}=r;d&&d(e,eb(a,this.history)),this.removeListeners=Oo(Lo(this.contextWindow,"pointermove",this.handlePointerMove),Lo(this.contextWindow,"pointerup",this.handlePointerUp),Lo(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),va(this.updatePoint)}}function Qv(t,e){return e?{point:e(t.point)}:t}function _E(t,e){return{x:t.x-e.x,y:t.y-e.y}}function eb({point:t},e){return{point:t,delta:_E(t,EE(e)),offset:_E(t,FG(e)),velocity:UG(e,.1)}}function FG(t){return t[0]}function EE(t){return t[t.length-1]}function UG(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=EE(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>Zs(e)));)r--;if(!n)return{x:0,y:0};const s=Ro(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function SE(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const AE=SE("dragHorizontal"),PE=SE("dragVertical");function ME(t){let e=!1;if(t==="y")e=PE();else if(t==="x")e=AE();else{const r=AE(),n=PE();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function IE(){const t=ME(!0);return t?(t(),!1):!0}function Fu(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const CE=1e-4,jG=1-CE,qG=1+CE,TE=.01,zG=0-TE,HG=0+TE;function Ni(t){return t.max-t.min}function WG(t,e,r){return Math.abs(t-e)<=r}function RE(t,e,r,n=.5){t.origin=n,t.originPoint=Zr(e.min,e.max,t.origin),t.scale=Ni(r)/Ni(e),t.translate=Zr(r.min,r.max,t.origin)-t.originPoint,(t.scale>=jG&&t.scale<=qG||isNaN(t.scale))&&(t.scale=1),(t.translate>=zG&&t.translate<=HG||isNaN(t.translate))&&(t.translate=0)}function th(t,e,r,n){RE(t.x,e.x,r.x,n?n.originX:void 0),RE(t.y,e.y,r.y,n?n.originY:void 0)}function DE(t,e,r){t.min=r.min+e.min,t.max=t.min+Ni(e)}function KG(t,e,r){DE(t.x,e.x,r.x),DE(t.y,e.y,r.y)}function OE(t,e,r){t.min=e.min-r.min,t.max=t.min+Ni(e)}function rh(t,e,r){OE(t.x,e.x,r.x),OE(t.y,e.y,r.y)}function VG(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?Zr(r,t,n.max):Math.min(t,r)),t}function NE(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function GG(t,{top:e,left:r,bottom:n,right:i}){return{x:NE(t.x,r,i),y:NE(t.y,e,n)}}function LE(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=Bu(e.min,e.max-n,t.min):n>i&&(r=Bu(t.min,t.max-i,e.min)),ba(0,1,r)}function XG(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const tb=.35;function ZG(t=tb){return t===!1?t=0:t===!0&&(t=tb),{x:kE(t,"left","right"),y:kE(t,"top","bottom")}}function kE(t,e,r){return{min:$E(t,e),max:$E(t,r)}}function $E(t,e){return typeof t=="number"?t:t[e]||0}const BE=()=>({translate:0,scale:1,origin:0,originPoint:0}),Uu=()=>({x:BE(),y:BE()}),FE=()=>({min:0,max:0}),ln=()=>({x:FE(),y:FE()});function ts(t){return[t("x"),t("y")]}function UE({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function QG({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function eY(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function rb(t){return t===void 0||t===1}function nb({scale:t,scaleX:e,scaleY:r}){return!rb(t)||!rb(e)||!rb(r)}function xc(t){return nb(t)||jE(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function jE(t){return qE(t.x)||qE(t.y)}function qE(t){return t&&t!=="0%"}function k0(t,e,r){const n=t-r,i=e*n;return r+i}function zE(t,e,r,n,i){return i!==void 0&&(t=k0(t,i,n)),k0(t,r,n)+e}function ib(t,e=0,r=1,n,i){t.min=zE(t.min,e,r,n,i),t.max=zE(t.max,e,r,n,i)}function HE(t,{x:e,y:r}){ib(t.x,e.translate,e.scale,e.originPoint),ib(t.y,r.translate,r.scale,r.originPoint)}const WE=.999999999999,KE=1.0000000000001;function tY(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;aWE&&(e.x=1),e.yWE&&(e.y=1)}function ju(t,e){t.min=t.min+e,t.max=t.max+e}function VE(t,e,r,n,i=.5){const s=Zr(t.min,t.max,i);ib(t,e,r,s,n)}function qu(t,e){VE(t.x,e.x,e.scaleX,e.scale,e.originX),VE(t.y,e.y,e.scaleY,e.scale,e.originY)}function GE(t,e){return UE(eY(t.getBoundingClientRect(),e))}function rY(t,e,r){const n=GE(t,r),{scroll:i}=e;return i&&(ju(n.x,i.offset.x),ju(n.y,i.offset.y)),n}const YE=({current:t})=>t?t.ownerDocument.defaultView:null,nY=new WeakMap;class iY{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ln(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:g}=this.getProps();g?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(L0(d,"page").point)},s=(d,g)=>{const{drag:y,dragPropagation:A,onDragStart:P}=this.getProps();if(y&&!A&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=ME(y),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ts(D=>{let k=this.getAxisMotionValue(D).get()||0;if(Qs.test(k)){const{projection:$}=this.visualElement;if($&&$.layout){const q=$.layout.layoutBox[D];q&&(k=Ni(q)*(parseFloat(k)/100))}}this.originPoint[D]=k}),P&&Nr.postRender(()=>P(d,g)),Xv(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},o=(d,g)=>{const{dragPropagation:y,dragDirectionLock:A,onDirectionLock:P,onDrag:N}=this.getProps();if(!y&&!this.openGlobalLock)return;const{offset:D}=g;if(A&&this.currentDirection===null){this.currentDirection=sY(D),this.currentDirection!==null&&P&&P(this.currentDirection);return}this.updateAxis("x",g.point,D),this.updateAxis("y",g.point,D),this.visualElement.render(),N&&N(d,g)},a=(d,g)=>this.stop(d,g),u=()=>ts(d=>{var g;return this.getAnimationState(d)==="paused"&&((g=this.getAxisMotionValue(d).animation)===null||g===void 0?void 0:g.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new xE(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:YE(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Nr.postRender(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!$0(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=VG(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&Fu(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=GG(i.layoutBox,r):this.constraints=!1,this.elastic=ZG(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&ts(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=XG(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!Fu(e))return!1;const n=e.current;Do(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=rY(n,i.root,this.visualElement.getTransformPagePoint());let o=YG(i.layout.layoutBox,s);if(r){const a=r(QG(o));this.hasMutatedConstraints=!!a,a&&(o=UE(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),u=this.constraints||{},l=ts(d=>{if(!$0(d,r,this.currentDirection))return;let g=u&&u[d]||{};o&&(g={min:0,max:0});const y=i?200:1e6,A=i?40:1e7,P={type:"inertia",velocity:n?e[d]:0,bounceStiffness:y,bounceDamping:A,timeConstant:750,restDelta:1,restSpeed:10,...s,...g};return this.startAxisValueAnimation(d,P)});return Promise.all(l).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return Xv(this.visualElement,e),n.start(Kv(e,n,0,r,this.visualElement,!1))}stopAnimation(){ts(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){ts(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){ts(r=>{const{drag:n}=this.getProps();if(!$0(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-Zr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!Fu(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};ts(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const u=a.get();i[o]=JG({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),ts(o=>{if(!$0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:u,max:l}=this.constraints[o];a.set(Zr(u,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;nY.set(this.visualElement,this);const e=this.visualElement.current,r=Lo(e,"pointerdown",u=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();Fu(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Nr.read(n);const o=No(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(ts(d=>{const g=this.getAxisMotionValue(d);g&&(this.originPoint[d]+=u[d].translate,g.set(g.get()+u[d].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=tb,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function $0(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function sY(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class oY extends xa{constructor(e){super(e),this.removeGroupControls=Hn,this.removeListeners=Hn,this.controls=new iY(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Hn}unmount(){this.removeGroupControls(),this.removeListeners()}}const JE=t=>(e,r)=>{t&&Nr.postRender(()=>t(e,r))};class aY extends xa{constructor(){super(...arguments),this.removePointerDownListener=Hn}onPointerDown(e){this.session=new xE(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:YE(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:JE(e),onStart:JE(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&Nr.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=Lo(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const B0=Pe.createContext(null);function cY(){const t=Pe.useContext(B0);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=Pe.useId();Pe.useEffect(()=>n(i),[]);const s=Pe.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const sb=Pe.createContext({}),XE=Pe.createContext({}),F0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function ZE(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const nh={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(zt.test(t))t=parseFloat(t);else return t;const r=ZE(t,e.target.x),n=ZE(t,e.target.y);return`${r}% ${n}%`}},uY={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=wa.parse(t);if(i.length>5)return n;const s=wa.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,u=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=u;const l=Zr(a,u,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),s(i)}},U0={};function fY(t){Object.assign(U0,t)}const{schedule:ob}=p8(queueMicrotask,!1);class lY extends Pe.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;fY(hY),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),F0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Nr.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ob.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function QE(t){const[e,r]=cY(),n=Pe.useContext(sb);return me.jsx(lY,{...t,layoutGroup:n,switchLayoutGroup:Pe.useContext(XE),isPresent:e,safeToRemove:r})}const hY={borderRadius:{...nh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:nh,borderTopRightRadius:nh,borderBottomLeftRadius:nh,borderBottomRightRadius:nh,boxShadow:uY},eS=["TopLeft","TopRight","BottomLeft","BottomRight"],dY=eS.length,tS=t=>typeof t=="string"?parseFloat(t):t,rS=t=>typeof t=="number"||zt.test(t);function pY(t,e,r,n,i,s){i?(t.opacity=Zr(0,r.opacity!==void 0?r.opacity:1,gY(n)),t.opacityExit=Zr(e.opacity!==void 0?e.opacity:1,0,mY(n))):s&&(t.opacity=Zr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(Bu(t,e,n))}function sS(t,e){t.min=e.min,t.max=e.max}function rs(t,e){sS(t.x,e.x),sS(t.y,e.y)}function oS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function aS(t,e,r,n,i){return t-=e,t=k0(t,1/r,n),i!==void 0&&(t=k0(t,1/i,n)),t}function vY(t,e=0,r=1,n=.5,i,s=t,o=t){if(Qs.test(e)&&(e=parseFloat(e),e=Zr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Zr(s.min,s.max,n);t===s&&(a-=e),t.min=aS(t.min,e,r,a,i),t.max=aS(t.max,e,r,a,i)}function cS(t,e,[r,n,i],s,o){vY(t,e[r],e[n],e[i],e.scale,s,o)}const bY=["x","scaleX","originX"],yY=["y","scaleY","originY"];function uS(t,e,r,n){cS(t.x,e,bY,r?r.x:void 0,n?n.x:void 0),cS(t.y,e,yY,r?r.y:void 0,n?n.y:void 0)}function fS(t){return t.translate===0&&t.scale===1}function lS(t){return fS(t.x)&&fS(t.y)}function hS(t,e){return t.min===e.min&&t.max===e.max}function wY(t,e){return hS(t.x,e.x)&&hS(t.y,e.y)}function dS(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function pS(t,e){return dS(t.x,e.x)&&dS(t.y,e.y)}function gS(t){return Ni(t.x)/Ni(t.y)}function mS(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class xY{constructor(){this.members=[]}add(e){Vv(this.members,e),e.scheduleRender()}remove(e){if(Gv(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function _Y(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:l,rotate:d,rotateX:g,rotateY:y,skewX:A,skewY:P}=r;l&&(n=`perspective(${l}px) ${n}`),d&&(n+=`rotate(${d}deg) `),g&&(n+=`rotateX(${g}deg) `),y&&(n+=`rotateY(${y}deg) `),A&&(n+=`skewX(${A}deg) `),P&&(n+=`skewY(${P}deg) `)}const a=t.x.scale*e.x,u=t.y.scale*e.y;return(a!==1||u!==1)&&(n+=`scale(${a}, ${u})`),n||"none"}const EY=(t,e)=>t.depth-e.depth;class SY{constructor(){this.children=[],this.isDirty=!1}add(e){Vv(this.children,e),this.isDirty=!0}remove(e){Gv(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(EY),this.isDirty=!1,this.children.forEach(e)}}function j0(t){const e=Qn(t)?t.get():t;return mG(e)?e.toValue():e}function AY(t,e){const r=eo.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(va(n),t(s-e))};return Nr.read(n,!0),()=>va(n)}function PY(t){return t instanceof SVGElement&&t.tagName!=="svg"}function MY(t,e,r){const n=Qn(t)?t:eh(t);return n.start(Kv("",n,e,r)),n.animation}const _c={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},ih=typeof window<"u"&&window.MotionDebug!==void 0,ab=["","X","Y","Z"],IY={visibility:"hidden"},vS=1e3;let CY=0;function cb(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function bS(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=gE(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Nr,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&bS(n)}function yS({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=CY++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,ih&&(_c.totalNodes=_c.resolvedTargetDeltas=_c.recalculatedProjection=0),this.nodes.forEach(DY),this.nodes.forEach($Y),this.nodes.forEach(BY),this.nodes.forEach(OY),ih&&window.MotionDebug.record(_c)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let u=0;uthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,g&&g(),g=AY(y,250),F0.hasAnimatedSinceResize&&(F0.hasAnimatedSinceResize=!1,this.nodes.forEach(xS))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&d&&(u||l)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:y,hasRelativeTargetChanged:A,layout:P})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const N=this.options.transition||d.getDefaultTransition()||zY,{onLayoutAnimationStart:D,onLayoutAnimationComplete:k}=d.getProps(),$=!this.targetLayout||!pS(this.targetLayout,P)||A,q=!y&&A;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||q||y&&($||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(g,q);const U={...wv(N,"layout"),onPlay:D,onComplete:k};(d.shouldReduceMotion||this.options.layoutRoot)&&(U.delay=0,U.type=!1),this.startAnimation(U)}else y||xS(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=P})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,va(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(FY),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&bS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u{const K=U/1e3;_S(g.x,o.x,K),_S(g.y,o.y,K),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(rh(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),jY(this.relativeTarget,this.relativeTargetOrigin,y,K),q&&wY(this.relativeTarget,q)&&(this.isProjectionDirty=!1),q||(q=ln()),rs(q,this.relativeTarget)),N&&(this.animationValues=d,pY(d,l,this.latestValues,K,$,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=K},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(va(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nr.update(()=>{F0.hasAnimatedSinceResize=!0,this.currentAnimation=MY(0,vS,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(vS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:u,layout:l,latestValues:d}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&MS(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||ln();const g=Ni(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+g;const y=Ni(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+y}rs(a,u),qu(a,d),th(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new xY),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(a=!0),!a)return;const l={};u.z&&cb("z",o,l,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(wS),this.root.sharedNodes.clear()}}}function TY(t){t.updateLayout()}function RY(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?ts(g=>{const y=o?r.measuredBox[g]:r.layoutBox[g],A=Ni(y);y.min=n[g].min,y.max=y.min+A}):MS(s,r.layoutBox,n)&&ts(g=>{const y=o?r.measuredBox[g]:r.layoutBox[g],A=Ni(n[g]);y.max=y.min+A,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[g].max=t.relativeTarget[g].min+A)});const a=Uu();th(a,n,r.layoutBox);const u=Uu();o?th(u,t.applyTransform(i,!0),r.measuredBox):th(u,n,r.layoutBox);const l=!lS(a);let d=!1;if(!t.resumeFrom){const g=t.getClosestProjectingParent();if(g&&!g.resumeFrom){const{snapshot:y,layout:A}=g;if(y&&A){const P=ln();rh(P,r.layoutBox,y.layoutBox);const N=ln();rh(N,n,A.layoutBox),pS(P,N)||(d=!0),g.options.layoutRoot&&(t.relativeTarget=N,t.relativeTargetOrigin=P,t.relativeParent=g)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:u,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function DY(t){ih&&_c.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function OY(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function NY(t){t.clearSnapshot()}function wS(t){t.clearMeasurements()}function LY(t){t.isLayoutDirty=!1}function kY(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function xS(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function $Y(t){t.resolveTargetDelta()}function BY(t){t.calcProjection()}function FY(t){t.resetSkewAndRotation()}function UY(t){t.removeLeadSnapshot()}function _S(t,e,r){t.translate=Zr(e.translate,0,r),t.scale=Zr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function ES(t,e,r,n){t.min=Zr(e.min,r.min,n),t.max=Zr(e.max,r.max,n)}function jY(t,e,r,n){ES(t.x,e.x,r.x,n),ES(t.y,e.y,r.y,n)}function qY(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const zY={duration:.45,ease:[.4,0,.1,1]},SS=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),AS=SS("applewebkit/")&&!SS("chrome/")?Math.round:Hn;function PS(t){t.min=AS(t.min),t.max=AS(t.max)}function HY(t){PS(t.x),PS(t.y)}function MS(t,e,r){return t==="position"||t==="preserve-aspect"&&!WG(gS(e),gS(r),.2)}function WY(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const KY=yS({attachResizeListener:(t,e)=>No(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ub={current:void 0},IS=yS({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!ub.current){const t=new KY({});t.mount(window),t.setOptions({layoutScroll:!0}),ub.current=t}return ub.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),VY={pan:{Feature:aY},drag:{Feature:oY,ProjectionNode:IS,MeasureLayout:QE}};function CS(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||IE())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const u=a[n];u&&Nr.postRender(()=>u(s,o))};return Lo(t.current,r,i,{passive:!t.getProps()[n]})}class GY extends xa{mount(){this.unmount=Oo(CS(this.node,!0),CS(this.node,!1))}unmount(){}}class YY extends xa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Oo(No(this.node.current,"focus",()=>this.onFocus()),No(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const TS=(t,e)=>e?t===e?!0:TS(t,e.parentElement):!1;function fb(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,L0(r))}class JY extends xa{constructor(){super(...arguments),this.removeStartListeners=Hn,this.removeEndListeners=Hn,this.removeAccessibleListeners=Hn,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=Lo(window,"pointerup",(a,u)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:d,globalTapTarget:g}=this.node.getProps(),y=!g&&!TS(this.node.current,a.target)?d:l;y&&Nr.update(()=>y(a,u))},{passive:!(n.onTap||n.onPointerUp)}),o=Lo(window,"pointercancel",(a,u)=>this.cancelPress(a,u),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=Oo(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||fb("up",(u,l)=>{const{onTap:d}=this.node.getProps();d&&Nr.postRender(()=>d(u,l))})};this.removeEndListeners(),this.removeEndListeners=No(this.node.current,"keyup",o),fb("down",(a,u)=>{this.startPress(a,u)})},r=No(this.node.current,"keydown",e),n=()=>{this.isPressing&&fb("cancel",(s,o)=>this.cancelPress(s,o))},i=No(this.node.current,"blur",n);this.removeAccessibleListeners=Oo(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Nr.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!IE()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Nr.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=Lo(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=No(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Oo(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const lb=new WeakMap,hb=new WeakMap,XY=t=>{const e=lb.get(t.target);e&&e(t)},ZY=t=>{t.forEach(XY)};function QY({root:t,...e}){const r=t||document;hb.has(r)||hb.set(r,{});const n=hb.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(ZY,{root:t,...e})),n[i]}function eJ(t,e,r){const n=QY(e);return lb.set(t,r),n.observe(t),()=>{lb.delete(t),n.unobserve(t)}}const tJ={some:0,all:1};class rJ extends xa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:tJ[i]},a=u=>{const{isIntersecting:l}=u;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:g}=this.node.getProps(),y=l?d:g;y&&y(u)};return eJ(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(nJ(e,r))&&this.startObserver()}unmount(){}}function nJ({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const iJ={inView:{Feature:rJ},tap:{Feature:JY},focus:{Feature:YY},hover:{Feature:GY}},sJ={layout:{ProjectionNode:IS,MeasureLayout:QE}},db=Pe.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),q0=Pe.createContext({}),pb=typeof window<"u",RS=pb?Pe.useLayoutEffect:Pe.useEffect,DS=Pe.createContext({strict:!1});function oJ(t,e,r,n,i){var s,o;const{visualElement:a}=Pe.useContext(q0),u=Pe.useContext(DS),l=Pe.useContext(B0),d=Pe.useContext(db).reducedMotion,g=Pe.useRef();n=n||u.renderer,!g.current&&n&&(g.current=n(t,{visualState:e,parent:a,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d}));const y=g.current,A=Pe.useContext(XE);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&aJ(g.current,r,i,A);const P=Pe.useRef(!1);Pe.useInsertionEffect(()=>{y&&P.current&&y.update(r,l)});const N=r[pE],D=Pe.useRef(!!N&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,N))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,N)));return RS(()=>{y&&(P.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),ob.render(y.render),D.current&&y.animationState&&y.animationState.animateChanges())}),Pe.useEffect(()=>{y&&(!D.current&&y.animationState&&y.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{var k;(k=window.MotionHandoffMarkAsComplete)===null||k===void 0||k.call(window,N)}),D.current=!1))}),y}function aJ(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:u,layoutRoot:l}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:OS(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&Fu(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:u,layoutRoot:l})}function OS(t){if(t)return t.options.allowProjection!==!1?t.projection:OS(t.parent)}function cJ(t,e,r){return Pe.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):Fu(r)&&(r.current=n))},[e])}function z0(t){return A0(t.animate)||yv.some(e=>Kl(t[e]))}function NS(t){return!!(z0(t)||t.variants)}function uJ(t,e){if(z0(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Kl(r)?r:void 0,animate:Kl(n)?n:void 0}}return t.inherit!==!1?e:{}}function fJ(t){const{initial:e,animate:r}=uJ(t,Pe.useContext(q0));return Pe.useMemo(()=>({initial:e,animate:r}),[LS(e),LS(r)])}function LS(t){return Array.isArray(t)?t.join(" "):t}const kS={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},zu={};for(const t in kS)zu[t]={isEnabled:e=>kS[t].some(r=>!!e[r])};function lJ(t){for(const e in t)zu[e]={...zu[e],...t[e]}}const hJ=Symbol.for("motionComponentSymbol");function dJ({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&lJ(t);function s(a,u){let l;const d={...Pe.useContext(db),...a,layoutId:pJ(a)},{isStatic:g}=d,y=fJ(a),A=n(a,g);if(!g&&pb){gJ(d,t);const P=mJ(d);l=P.MeasureLayout,y.visualElement=oJ(i,A,d,e,P.ProjectionNode)}return me.jsxs(q0.Provider,{value:y,children:[l&&y.visualElement?me.jsx(l,{visualElement:y.visualElement,...d}):null,r(i,a,cJ(A,y.visualElement,u),A,g,y.visualElement)]})}const o=Pe.forwardRef(s);return o[hJ]=i,o}function pJ({layoutId:t}){const e=Pe.useContext(sb).id;return e&&t!==void 0?e+"-"+t:t}function gJ(t,e){const r=Pe.useContext(DS).strict;if(process.env.NODE_ENV!=="production"&&e&&r){const n="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?Nu(!1,n):Do(!1,n)}}function mJ(t){const{drag:e,layout:r}=zu;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const vJ=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function gb(t){return typeof t!="string"||t.includes("-")?!1:!!(vJ.indexOf(t)>-1||/[A-Z]/u.test(t))}function $S(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const BS=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function FS(t,e,r,n){$S(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(BS.has(i)?i:Jv(i),e.attrs[i])}function US(t,{layout:e,layoutId:r}){return vc.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!U0[t]||t==="opacity")}function mb(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(Qn(i[o])||e.style&&Qn(e.style[o])||US(o,t)||((n=r==null?void 0:r.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function jS(t,e,r){const n=mb(t,e,r);for(const i in t)if(Qn(t[i])||Qn(e[i])){const s=Vl.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function vb(t){const e=Pe.useRef(null);return e.current===null&&(e.current=t()),e.current}function bJ({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:yJ(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const qS=t=>(e,r)=>{const n=Pe.useContext(q0),i=Pe.useContext(B0),s=()=>bJ(t,e,n,i);return r?s():vb(s)};function yJ(t,e,r,n){const i={},s=n(t,{});for(const y in s)i[y]=j0(s[y]);let{initial:o,animate:a}=t;const u=z0(t),l=NS(t);e&&l&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const g=d?a:o;if(g&&typeof g!="boolean"&&!A0(g)){const y=Array.isArray(g)?g:[g];for(let A=0;A({style:{},transform:{},transformOrigin:{},vars:{}}),zS=()=>({...bb(),attrs:{}}),HS=(t,e)=>e&&typeof t=="number"?e.transform(t):t,wJ={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},xJ=Vl.length;function _J(t,e,r){let n="",i=!0;for(let s=0;stypeof t=="string"&&t.toLowerCase()==="svg",MJ={useVisualState:qS({scrapeMotionValuesFromProps:jS,createRenderState:zS,onMount:(t,e,{renderState:r,latestValues:n})=>{Nr.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),Nr.render(()=>{wb(r,n,xb(e.tagName),t.transformTemplate),FS(e,r)})}})},IJ={useVisualState:qS({scrapeMotionValuesFromProps:mb,createRenderState:bb})};function KS(t,e,r){for(const n in e)!Qn(e[n])&&!US(n,r)&&(t[n]=e[n])}function CJ({transformTemplate:t},e){return Pe.useMemo(()=>{const r=bb();return yb(r,e,t),Object.assign({},r.vars,r.style)},[e])}function TJ(t,e){const r=t.style||{},n={};return KS(n,r,t),Object.assign(n,CJ(t,e)),n}function RJ(t,e){const r={},n=TJ(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const DJ=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function H0(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||DJ.has(t)}let VS=t=>!H0(t);function OJ(t){t&&(VS=e=>e.startsWith("on")?!H0(e):t(e))}try{OJ(require("@emotion/is-prop-valid").default)}catch{}function NJ(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(VS(i)||r===!0&&H0(i)||!e&&!H0(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function LJ(t,e,r,n){const i=Pe.useMemo(()=>{const s=zS();return wb(s,e,xb(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};KS(s,t.style,t),i.style={...s,...i.style}}return i}function kJ(t=!1){return(r,n,i,{latestValues:s},o)=>{const u=(gb(r)?LJ:RJ)(n,s,o,r),l=NJ(n,typeof r=="string",t),d=r!==Pe.Fragment?{...l,...u,ref:i}:{},{children:g}=n,y=Pe.useMemo(()=>Qn(g)?g.get():g,[g]);return Pe.createElement(r,{...d,children:y})}}function $J(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...gb(n)?MJ:IJ,preloadedFeatures:t,useRender:kJ(i),createVisualElement:e,Component:n};return dJ(o)}}const _b={current:null},GS={current:!1};function BJ(){if(GS.current=!0,!!pb)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>_b.current=t.matches;t.addListener(e),e()}else _b.current=!1}function FJ(t,e,r){for(const n in e){const i=e[n],s=r[n];if(Qn(i))t.addValue(n,i),process.env.NODE_ENV==="development"&&S0(i.version==="11.11.17",`Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`);else if(Qn(s))t.addValue(n,eh(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,eh(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const YS=new WeakMap,UJ=[...O8,Zn,wa],jJ=t=>UJ.find(D8(t)),JS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class qJ{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Mv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=eo.now();this.renderScheduledAtthis.bindToMotionValue(n,r)),GS.current||BJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:_b.current,process.env.NODE_ENV!=="production"&&S0(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){YS.delete(this.current),this.projection&&this.projection.unmount(),va(this.notifyUpdate),va(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=vc.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Nr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in zu){const r=zu[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ln()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=eh(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(S8(i)||E8(i))?i=parseFloat(i):!jJ(i)&&wa.test(r)&&(i=H8(e,r)),this.setBaseTarget(e,Qn(i)?i.get():i)),Qn(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=vv(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Qn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new Yv),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class XS extends qJ{constructor(){super(...arguments),this.KeyframeResolver=W8}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function zJ(t){return window.getComputedStyle(t)}class HJ extends XS{constructor(){super(...arguments),this.type="html",this.renderInstance=$S}readValueFromInstance(e,r){if(vc.has(r)){const n=Nv(r);return n&&n.default||0}else{const n=zJ(e),i=(P8(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return GE(e,r)}build(e,r,n){yb(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return mb(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Qn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class WJ extends XS{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ln}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(vc.has(r)){const n=Nv(r);return n&&n.default||0}return r=BS.has(r)?r:Jv(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return jS(e,r,n)}build(e,r,n){wb(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){FS(e,r,n,i)}mount(e){this.isSVGTag=xb(e.tagName),super.mount(e)}}const KJ=(t,e)=>gb(t)?new WJ(e):new HJ(e,{allowProjection:t!==Pe.Fragment}),VJ=$J({...kG,...iJ,...VY,...sJ},KJ),GJ=CK(VJ);class YJ extends Yt.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function JJ({children:t,isPresent:e}){const r=Pe.useId(),n=Pe.useRef(null),i=Pe.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=Pe.useContext(db);return Pe.useInsertionEffect(()=>{const{width:o,height:a,top:u,left:l}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` + */const d8=Ss("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),p8=new Set;function A0(t,e,r){t||p8.has(e)||(console.warn(e),p8.add(e))}function $K(t){if(typeof Proxy>"u")return t;const e=new Map,r=(...n)=>(process.env.NODE_ENV!=="production"&&A0(!1,"motion() is deprecated. Use motion.create() instead."),t(...n));return new Proxy(r,{get:(n,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}function P0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const mv=t=>Array.isArray(t);function g8(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function vv(t,e,r,n){if(typeof e=="function"){const[i,s]=m8(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=m8(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function M0(t,e,r){const n=t.getProps();return vv(n,e,r!==void 0?r:n.custom,t)}const bv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],yv=["initial",...bv],Gl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],yc=new Set(Gl),Qs=t=>t*1e3,Lo=t=>t/1e3,FK={type:"spring",stiffness:500,damping:25,restSpeed:10},jK=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),UK={type:"keyframes",duration:.8},qK={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},zK=(t,{keyframes:e})=>e.length>2?UK:yc.has(t)?t.startsWith("scale")?jK(e[1]):FK:qK;function wv(t,e){return t?t[e]||t.default||t:void 0}const HK={useManualTiming:!1},WK=t=>t!==null;function I0(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(WK),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const Wn=t=>t;function KK(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){s.has(l)&&(u.schedule(l),t()),l(o)}const u={schedule:(l,d=!1,g=!1)=>{const A=g&&n?e:r;return d&&s.add(l),A.has(l)||A.add(l),l},cancel:l=>{r.delete(l),s.delete(l)},process:l=>{if(o=l,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,u.process(l))}};return u}const C0=["read","resolveKeyframes","update","preRender","render","postRender"],VK=40;function v8(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=C0.reduce((k,B)=>(k[B]=KK(s),k),{}),{read:a,resolveKeyframes:u,update:l,preRender:d,render:g,postRender:y}=o,A=()=>{const k=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(k-i.timestamp,VK),1),i.timestamp=k,i.isProcessing=!0,a.process(i),u.process(i),l.process(i),d.process(i),g.process(i),y.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(A))},P=()=>{r=!0,n=!0,i.isProcessing||t(A)};return{schedule:C0.reduce((k,B)=>{const j=o[B];return k[B]=(U,K=!1,J=!1)=>(r||P(),j.schedule(U,K,J)),k},{}),cancel:k=>{for(let B=0;B(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,GK=1e-7,YK=12;function JK(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=b8(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>GK&&++aJK(s,0,1,t,r);return s=>s===0||s===1?s:b8(i(s),e,n)}const y8=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,w8=t=>e=>1-t(1-e),x8=Yl(.33,1.53,.69,.99),_v=w8(x8),_8=y8(_v),E8=t=>(t*=2)<1?.5*_v(t):.5*(2-Math.pow(2,-10*(t-1))),Ev=t=>1-Math.sin(Math.acos(t)),S8=w8(Ev),A8=y8(Ev),P8=t=>/^0[^.\s]+$/u.test(t);function XK(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||P8(t):!0}let Lu=Wn,ko=Wn;process.env.NODE_ENV!=="production"&&(Lu=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},ko=(t,e)=>{if(!t)throw new Error(e)});const M8=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),I8=t=>e=>typeof e=="string"&&e.startsWith(t),C8=I8("--"),ZK=I8("var(--"),Sv=t=>ZK(t)?QK.test(t.split("/*")[0].trim()):!1,QK=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,eV=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function tV(t){const e=eV.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}const rV=4;function T8(t,e,r=1){ko(r<=rV,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[n,i]=tV(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return M8(o)?parseFloat(o):o}return Sv(i)?T8(i,e,r+1):i}const xa=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},Jl={...ku,transform:t=>xa(0,1,t)},T0={...ku,default:1},Xl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),_a=Xl("deg"),eo=Xl("%"),zt=Xl("px"),nV=Xl("vh"),iV=Xl("vw"),R8={...eo,parse:t=>eo.parse(t)/100,transform:t=>eo.transform(t*100)},sV=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),D8=t=>t===ku||t===zt,O8=(t,e)=>parseFloat(t.split(", ")[e]),N8=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return O8(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?O8(s[1],t):0}},oV=new Set(["x","y","z"]),aV=Gl.filter(t=>!oV.has(t));function cV(t){const e=[];return aV.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const Bu={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:N8(4,13),y:N8(5,14)};Bu.translateX=Bu.x,Bu.translateY=Bu.y;const L8=t=>e=>e.test(t),k8=[ku,zt,eo,_a,iV,nV,{test:t=>t==="auto",parse:t=>t}],B8=t=>k8.find(L8(t)),wc=new Set;let Av=!1,Pv=!1;function $8(){if(Pv){const t=Array.from(wc).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=cV(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}Pv=!1,Av=!1,wc.forEach(t=>t.complete()),wc.clear()}function F8(){wc.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Pv=!0)})}function uV(){F8(),$8()}class Mv{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(wc.add(this),Av||(Av=!0,Nr.read(F8),Nr.resolveKeyframes($8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sMath.round(t*1e5)/1e5,Iv=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function fV(t){return t==null}const lV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Cv=(t,e)=>r=>!!(typeof r=="string"&&lV.test(r)&&r.startsWith(t)||e&&!fV(r)&&Object.prototype.hasOwnProperty.call(r,e)),j8=(t,e,r)=>n=>{if(typeof n!="string")return n;const[i,s,o,a]=n.match(Iv);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},hV=t=>xa(0,255,t),Tv={...ku,transform:t=>Math.round(hV(t))},xc={test:Cv("rgb","red"),parse:j8("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+Tv.transform(t)+", "+Tv.transform(e)+", "+Tv.transform(r)+", "+Zl(Jl.transform(n))+")"};function dV(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const Rv={test:Cv("#"),parse:dV,transform:xc.transform},$u={test:Cv("hsl","hue"),parse:j8("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+eo.transform(Zl(e))+", "+eo.transform(Zl(r))+", "+Zl(Jl.transform(n))+")"},Zn={test:t=>xc.test(t)||Rv.test(t)||$u.test(t),parse:t=>xc.test(t)?xc.parse(t):$u.test(t)?$u.parse(t):Rv.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?xc.transform(t):$u.transform(t)},pV=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function gV(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Iv))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(pV))===null||r===void 0?void 0:r.length)||0)>0}const U8="number",q8="color",mV="var",vV="var(",z8="${}",bV=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ql(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(bV,u=>(Zn.test(u)?(n.color.push(s),i.push(q8),r.push(Zn.parse(u))):u.startsWith(vV)?(n.var.push(s),i.push(mV),r.push(u)):(n.number.push(s),i.push(U8),r.push(parseFloat(u))),++s,z8)).split(z8);return{values:r,split:a,indexes:n,types:i}}function H8(t){return Ql(t).values}function W8(t){const{split:e,types:r}=Ql(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function wV(t){const e=H8(t);return W8(t)(e.map(yV))}const Ea={test:gV,parse:H8,createTransformer:W8,getAnimatableNone:wV},xV=new Set(["brightness","contrast","saturate","opacity"]);function _V(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(Iv)||[];if(!n)return t;const i=r.replace(n,"");let s=xV.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const EV=/\b([a-z-]*)\(.*?\)/gu,Dv={...Ea,getAnimatableNone:t=>{const e=t.match(EV);return e?e.map(_V).join(" "):t}},SV={borderWidth:zt,borderTopWidth:zt,borderRightWidth:zt,borderBottomWidth:zt,borderLeftWidth:zt,borderRadius:zt,radius:zt,borderTopLeftRadius:zt,borderTopRightRadius:zt,borderBottomRightRadius:zt,borderBottomLeftRadius:zt,width:zt,maxWidth:zt,height:zt,maxHeight:zt,top:zt,right:zt,bottom:zt,left:zt,padding:zt,paddingTop:zt,paddingRight:zt,paddingBottom:zt,paddingLeft:zt,margin:zt,marginTop:zt,marginRight:zt,marginBottom:zt,marginLeft:zt,backgroundPositionX:zt,backgroundPositionY:zt},AV={rotate:_a,rotateX:_a,rotateY:_a,rotateZ:_a,scale:T0,scaleX:T0,scaleY:T0,scaleZ:T0,skew:_a,skewX:_a,skewY:_a,distance:zt,translateX:zt,translateY:zt,translateZ:zt,x:zt,y:zt,z:zt,perspective:zt,transformPerspective:zt,opacity:Jl,originX:R8,originY:R8,originZ:zt},K8={...ku,transform:Math.round},Ov={...SV,...AV,zIndex:K8,size:zt,fillOpacity:Jl,strokeOpacity:Jl,numOctaves:K8},PV={...Ov,color:Zn,backgroundColor:Zn,outlineColor:Zn,fill:Zn,stroke:Zn,borderColor:Zn,borderTopColor:Zn,borderRightColor:Zn,borderBottomColor:Zn,borderLeftColor:Zn,filter:Dv,WebkitFilter:Dv},Nv=t=>PV[t];function V8(t,e){let r=Nv(t);return r!==Dv&&(r=Ea),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const MV=new Set(["auto","none","0"]);function IV(t,e,r){let n=0,i;for(;n{r.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function Lv(t){return typeof t=="function"}let R0;function CV(){R0=void 0}const to={now:()=>(R0===void 0&&to.set(Kn.isProcessing||HK.useManualTiming?Kn.timestamp:performance.now()),R0),set:t=>{R0=t,queueMicrotask(CV)}},Y8=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Ea.test(t)||t==="0")&&!t.startsWith("url("));function TV(t){const e=t[0];if(t.length===1)return!0;for(let r=0;rDV?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&uV(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=to.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:u,isGenerator:l}=this.options;if(!l&&!RV(e,n,i,s))if(o)this.options.duration=0;else{u==null||u(I0(e,this.options,r)),a==null||a(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,r);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...d},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function X8(t,e){return e?t*(1e3/e):0}const OV=5;function Z8(t,e,r){const n=Math.max(e-OV,0);return X8(r-t(n),e-n)}const kv=.001,NV=.01,Q8=10,LV=.05,kV=1;function BV({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;Lu(t<=Qs(Q8),"Spring duration must be 10 seconds or less");let o=1-e;o=xa(LV,kV,o),t=xa(NV,Q8,Lo(t)),o<1?(i=l=>{const d=l*o,g=d*t,y=d-r,A=Bv(l,o),P=Math.exp(-g);return kv-y/A*P},s=l=>{const g=l*o*t,y=g*r+r,A=Math.pow(o,2)*Math.pow(l,2)*t,P=Math.exp(-g),O=Bv(Math.pow(l,2),o);return(-i(l)+kv>0?-1:1)*((y-A)*P)/O}):(i=l=>{const d=Math.exp(-l*t),g=(l-r)*t+1;return-kv+d*g},s=l=>{const d=Math.exp(-l*t),g=(r-l)*(t*t);return d*g});const a=5/t,u=FV(i,s,a);if(t=Qs(t),isNaN(u))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(u,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:t}}}const $V=12;function FV(t,e,r){let n=r;for(let i=1;i<$V;i++)n=n-t(n)/e(n);return n}function Bv(t,e){return t*Math.sqrt(1-e*e)}const jV=["duration","bounce"],UV=["stiffness","damping","mass"];function eE(t,e){return e.some(r=>t[r]!==void 0)}function qV(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!eE(t,UV)&&eE(t,jV)){const r=BV(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function tE({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:u,mass:l,duration:d,velocity:g,isResolvedFromDuration:y}=qV({...n,velocity:-Lo(n.velocity||0)}),A=g||0,P=u/(2*Math.sqrt(a*l)),O=s-i,D=Lo(Math.sqrt(a/l)),k=Math.abs(O)<5;r||(r=k?.01:2),e||(e=k?.005:.5);let B;if(P<1){const j=Bv(D,P);B=U=>{const K=Math.exp(-P*D*U);return s-K*((A+P*D*O)/j*Math.sin(j*U)+O*Math.cos(j*U))}}else if(P===1)B=j=>s-Math.exp(-D*j)*(O+(A+D*O)*j);else{const j=D*Math.sqrt(P*P-1);B=U=>{const K=Math.exp(-P*D*U),J=Math.min(j*U,300);return s-K*((A+P*D*O)*Math.sinh(J)+j*O*Math.cosh(J))/j}}return{calculatedDuration:y&&d||null,next:j=>{const U=B(j);if(y)o.done=j>=d;else{let K=0;P<1&&(K=j===0?Qs(A):Z8(B,j,U));const J=Math.abs(K)<=r,T=Math.abs(s-U)<=e;o.done=J&&T}return o.value=o.done?s:U,o}}}function rE({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:d}){const g=t[0],y={done:!1,value:g},A=z=>a!==void 0&&zu,P=z=>a===void 0?u:u===void 0||Math.abs(a-z)-O*Math.exp(-z/n),j=z=>k+B(z),U=z=>{const ue=B(z),_e=j(z);y.done=Math.abs(ue)<=l,y.value=y.done?k:_e};let K,J;const T=z=>{A(y.value)&&(K=z,J=tE({keyframes:[y.value,P(y.value)],velocity:Z8(j,z,y.value),damping:i,stiffness:s,restDelta:l,restSpeed:d}))};return T(0),{calculatedDuration:null,next:z=>{let ue=!1;return!J&&K===void 0&&(ue=!0,U(z),T(z)),K!==void 0&&z>=K?J.next(z-K):(!ue&&U(z),y)}}}const zV=Yl(.42,0,1,1),HV=Yl(0,0,.58,1),nE=Yl(.42,0,.58,1),WV=t=>Array.isArray(t)&&typeof t[0]!="number",$v=t=>Array.isArray(t)&&typeof t[0]=="number",iE={linear:Wn,easeIn:zV,easeInOut:nE,easeOut:HV,circIn:Ev,circInOut:A8,circOut:S8,backIn:_v,backInOut:_8,backOut:x8,anticipate:E8},sE=t=>{if($v(t)){ko(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,r,n,i]=t;return Yl(e,r,n,i)}else if(typeof t=="string")return ko(iE[t]!==void 0,`Invalid easing type '${t}'`),iE[t];return t},KV=(t,e)=>r=>e(t(r)),Bo=(...t)=>t.reduce(KV),Fu=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},Zr=(t,e,r)=>t+(e-t)*r;function Fv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function VV({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,u=2*r-a;i=Fv(u,a,t+1/3),s=Fv(u,a,t),o=Fv(u,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function D0(t,e){return r=>r>0?e:t}const jv=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},GV=[Rv,xc,$u],YV=t=>GV.find(e=>e.test(t));function oE(t){const e=YV(t);if(Lu(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let r=e.parse(t);return e===$u&&(r=VV(r)),r}const aE=(t,e)=>{const r=oE(t),n=oE(e);if(!r||!n)return D0(t,e);const i={...r};return s=>(i.red=jv(r.red,n.red,s),i.green=jv(r.green,n.green,s),i.blue=jv(r.blue,n.blue,s),i.alpha=Zr(r.alpha,n.alpha,s),xc.transform(i))},Uv=new Set(["none","hidden"]);function JV(t,e){return Uv.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function XV(t,e){return r=>Zr(t,e,r)}function qv(t){return typeof t=="number"?XV:typeof t=="string"?Sv(t)?D0:Zn.test(t)?aE:eG:Array.isArray(t)?cE:typeof t=="object"?Zn.test(t)?aE:ZV:D0}function cE(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>qv(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function QV(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=Ea.createTransformer(e),n=Ql(t),i=Ql(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?Uv.has(t)&&!i.values.length||Uv.has(e)&&!n.values.length?JV(t,e):Bo(cE(QV(n,i),i.values),r):(Lu(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),D0(t,e))};function uE(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Zr(t,e,r):qv(t)(t,e)}function tG(t,e,r){const n=[],i=r||uE,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=tG(e,n,i),a=o.length,u=l=>{let d=0;if(a>1)for(;du(xa(t[0],t[s-1],l)):u}function nG(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=Fu(0,e,n);t.push(Zr(r,1,i))}}function iG(t){const e=[0];return nG(e,t.length-1),e}function sG(t,e){return t.map(r=>r*e)}function oG(t,e){return t.map(()=>e||nE).splice(0,t.length-1)}function O0({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=WV(n)?n.map(sE):sE(n),s={done:!1,value:e[0]},o=sG(r&&r.length===e.length?r:iG(e),t),a=rG(o,e,{ease:Array.isArray(i)?i:oG(e,i)});return{calculatedDuration:t,next:u=>(s.value=a(u),s.done=u>=t,s)}}const fE=2e4;function aG(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=fE?1/0:e}const cG=t=>{const e=({timestamp:r})=>t(r);return{start:()=>Nr.update(e,!0),stop:()=>wa(e),now:()=>Kn.isProcessing?Kn.timestamp:to.now()}},uG={decay:rE,inertia:rE,tween:O0,keyframes:O0,spring:tE},fG=t=>t/100;class zv extends J8{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:u}=this.options;u&&u()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Mv,a=(u,l)=>this.onKeyframesResolved(u,l);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=Lv(r)?r:uG[r]||O0;let u,l;a!==O0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&ko(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),u=Bo(fG,uE(e[0],e[1])),e=[0,100]);const d=a({...this.options,keyframes:e});s==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=aG(d));const{calculatedDuration:g}=d,y=g+i,A=y*(n+1)-i;return{generator:d,mirroredGenerator:l,mapPercentToKeyframes:u,calculatedDuration:g,resolvedDuration:y,totalDuration:A}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:z}=this.options;return{done:!0,value:z[z.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:u,calculatedDuration:l,totalDuration:d,resolvedDuration:g}=n;if(this.startTime===null)return s.next(0);const{delay:y,repeat:A,repeatType:P,repeatDelay:O,onUpdate:D}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const k=this.currentTime-y*(this.speed>=0?1:-1),B=this.speed>=0?k<0:k>d;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let j=this.currentTime,U=s;if(A){const z=Math.min(this.currentTime,d)/g;let ue=Math.floor(z),_e=z%1;!_e&&z>=1&&(_e=1),_e===1&&ue--,ue=Math.min(ue,A+1),!!(ue%2)&&(P==="reverse"?(_e=1-_e,O&&(_e-=O/g)):P==="mirror"&&(U=o)),j=xa(0,1,_e)*g}const K=B?{done:!1,value:u[0]}:U.next(j);a&&(K.value=a(K.value));let{done:J}=K;!B&&l!==null&&(J=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&J);return T&&i!==void 0&&(K.value=I0(u,this.options,i)),D&&D(K.value),T&&this.finish(),K}get duration(){const{resolved:e}=this;return e?Lo(e.calculatedDuration):0}get time(){return Lo(this.currentTime)}set time(e){e=Qs(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=Lo(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=cG,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const lG=new Set(["opacity","clipPath","filter","transform"]),hG=10,dG=(t,e)=>{let r="";const n=Math.max(Math.round(e/hG),2);for(let i=0;i(e===void 0&&(e=t()),e)}const pG={linearEasing:void 0};function gG(t,e){const r=Hv(t);return()=>{var n;return(n=pG[e])!==null&&n!==void 0?n:r()}}const N0=gG(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function lE(t){return!!(typeof t=="function"&&N0()||!t||typeof t=="string"&&(t in Wv||N0())||$v(t)||Array.isArray(t)&&t.every(lE))}const eh=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,Wv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:eh([0,.65,.55,1]),circOut:eh([.55,0,1,.45]),backIn:eh([.31,.01,.66,-.59]),backOut:eh([.33,1.53,.69,.99])};function hE(t,e){if(t)return typeof t=="function"&&N0()?dG(t,e):$v(t)?eh(t):Array.isArray(t)?t.map(r=>hE(r,e)||Wv.easeOut):Wv[t]}function mG(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:u}={}){const l={[e]:r};u&&(l.offset=u);const d=hE(a,i);return Array.isArray(d)&&(l.easing=d),t.animate(l,{delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function dE(t,e){t.timeline=e,t.onfinish=null}const vG=Hv(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),L0=10,bG=2e4;function yG(t){return Lv(t.type)||t.type==="spring"||!lE(t.ease)}function wG(t,e){const r=new zv({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&sthis.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:u,name:l,startTime:d}=this.options;if(!(!((n=u.owner)===null||n===void 0)&&n.current))return!1;if(typeof o=="string"&&N0()&&xG(o)&&(o=pE[o]),yG(this.options)){const{onComplete:y,onUpdate:A,motionValue:P,element:O,...D}=this.options,k=wG(e,D);e=k.keyframes,e.length===1&&(e[1]=e[0]),i=k.duration,s=k.times,o=k.ease,a="keyframes"}const g=mG(u.owner.current,l,e,{...this.options,duration:i,times:s,ease:o});return g.startTime=d??this.calcStartTime(),this.pendingTimeline?(dE(g,this.pendingTimeline),this.pendingTimeline=void 0):g.onfinish=()=>{const{onComplete:y}=this.options;u.set(I0(e,this.options,r)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:g,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return Lo(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return Lo(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=Qs(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return Wn;const{animation:n}=r;dE(n,e)}return Wn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:d,onComplete:g,element:y,...A}=this.options,P=new zv({...A,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),O=Qs(this.time);l.setWithVelocity(P.sample(O-L0).value,P.sample(O).value,L0)}const{onStop:u}=this.options;u&&u(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return vG()&&n&&lG.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}const _G=Hv(()=>window.ScrollTimeline!==void 0);class EG{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;n_G()&&i.attachTimeline?i.attachTimeline(e):r(i));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function SG({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:u,elapsed:l,...d}){return!!Object.keys(d).length}const Kv=(t,e,r,n={},i,s)=>o=>{const a=wv(n,t)||{},u=a.delay||n.delay||0;let{elapsed:l=0}=n;l=l-Qs(u);let d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:y=>{e.set(y),a.onUpdate&&a.onUpdate(y)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:i};SG(a)||(d={...d,...zK(t,d)}),d.duration&&(d.duration=Qs(d.duration)),d.repeatDelay&&(d.repeatDelay=Qs(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let g=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(g=!0)),g&&!s&&e.get()!==void 0){const y=I0(d.keyframes,a);if(y!==void 0)return Nr.update(()=>{d.onUpdate(y),d.onComplete()}),new EG([])}return!s&&gE.supports(d)?new gE(d):new zv(d)},AG=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),PG=t=>mv(t)?t[t.length-1]||0:t;function Vv(t,e){t.indexOf(e)===-1&&t.push(e)}function Gv(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class Yv{constructor(){this.subscriptions=[]}add(e){return Vv(this.subscriptions,e),()=>Gv(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class IG{constructor(e,r={}){this.version="11.11.17",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=to.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=to.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=MG(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&A0(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new Yv);const n=this.events[e].add(r);return e==="change"?()=>{n(),Nr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=to.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>mE)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,mE);return X8(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function th(t,e){return new IG(t,e)}function CG(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,th(r))}function TG(t,e){const r=M0(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=PG(s[o]);CG(t,o,a)}}const Jv=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),vE="data-"+Jv("framerAppearId");function bE(t){return t.props[vE]}const Qn=t=>!!(t&&t.getVelocity);function RG(t){return!!(Qn(t)&&t.add)}function Xv(t,e){const r=t.getValue("willChange");if(RG(r))return r.add(e)}function DG({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function yE(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...u}=e;n&&(o=n);const l=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const g in u){const y=t.getValue(g,(s=t.latestValues[g])!==null&&s!==void 0?s:null),A=u[g];if(A===void 0||d&&DG(d,g))continue;const P={delay:r,...wv(o||{},g)};let O=!1;if(window.MotionHandoffAnimation){const k=bE(t);if(k){const B=window.MotionHandoffAnimation(k,g,Nr);B!==null&&(P.startTime=B,O=!0)}}Xv(t,g),y.start(Kv(g,y,A,t.shouldReduceMotion&&yc.has(g)?{type:!1}:P,t,O));const D=y.animation;D&&l.push(D)}return a&&Promise.all(l).then(()=>{Nr.update(()=>{a&&TG(t,a)})}),l}function Zv(t,e,r={}){var n;const i=M0(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(yE(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:g,staggerDirection:y}=s;return OG(t,e,d+l,g,y,r)}:()=>Promise.resolve(),{when:u}=s;if(u){const[l,d]=u==="beforeChildren"?[o,a]:[a,o];return l().then(()=>d())}else return Promise.all([o(),a(r.delay)])}function OG(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,u=i===1?(l=0)=>l*n:(l=0)=>a-l*n;return Array.from(t.variantChildren).sort(NG).forEach((l,d)=>{l.notify("AnimationStart",e),o.push(Zv(l,e,{...s,delay:r+u(d)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function NG(t,e){return t.sortNodePosition(e)}function LG(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>Zv(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=Zv(t,e,r);else{const i=typeof e=="function"?M0(t,e,r.custom):e;n=Promise.all(yE(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const kG=yv.length;function wE(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?wE(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;rPromise.all(e.map(({animation:r,options:n})=>LG(t,r,n)))}function jG(t){let e=FG(t),r=xE(),n=!0;const i=u=>(l,d)=>{var g;const y=M0(t,d,u==="exit"?(g=t.presenceContext)===null||g===void 0?void 0:g.custom:void 0);if(y){const{transition:A,transitionEnd:P,...O}=y;l={...l,...O,...P}}return l};function s(u){e=u(t)}function o(u){const{props:l}=t,d=wE(t.parent)||{},g=[],y=new Set;let A={},P=1/0;for(let D=0;D<$G;D++){const k=BG[D],B=r[k],j=l[k]!==void 0?l[k]:d[k],U=Vl(j),K=k===u?B.isActive:null;K===!1&&(P=D);let J=j===d[k]&&j!==l[k]&&U;if(J&&n&&t.manuallyAnimateOnMount&&(J=!1),B.protectedKeys={...A},!B.isActive&&K===null||!j&&!B.prevProp||P0(j)||typeof j=="boolean")continue;const T=UG(B.prevProp,j);let z=T||k===u&&B.isActive&&!J&&U||D>P&&U,ue=!1;const _e=Array.isArray(j)?j:[j];let G=_e.reduce(i(k),{});K===!1&&(G={});const{prevResolvedValues:E={}}=B,m={...E,...G},f=x=>{z=!0,y.has(x)&&(ue=!0,y.delete(x)),B.needsAnimating[x]=!0;const _=t.getValue(x);_&&(_.liveStyle=!1)};for(const x in m){const _=G[x],S=E[x];if(A.hasOwnProperty(x))continue;let b=!1;mv(_)&&mv(S)?b=!g8(_,S):b=_!==S,b?_!=null?f(x):y.add(x):_!==void 0&&y.has(x)?f(x):B.protectedKeys[x]=!0}B.prevProp=j,B.prevResolvedValues=G,B.isActive&&(A={...A,...G}),n&&t.blockInitialAnimation&&(z=!1),z&&(!(J&&T)||ue)&&g.push(..._e.map(x=>({animation:x,options:{type:k}})))}if(y.size){const D={};y.forEach(k=>{const B=t.getBaseTarget(k),j=t.getValue(k);j&&(j.liveStyle=!0),D[k]=B??null}),g.push({animation:D})}let O=!!g.length;return n&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(O=!1),n=!1,O?e(g):Promise.resolve()}function a(u,l){var d;if(r[u].isActive===l)return Promise.resolve();(d=t.variantChildren)===null||d===void 0||d.forEach(y=>{var A;return(A=y.animationState)===null||A===void 0?void 0:A.setActive(u,l)}),r[u].isActive=l;const g=o(u);for(const y in r)r[y].protectedKeys={};return g}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=xE(),n=!0}}}function UG(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!g8(e,t):!1}function _c(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function xE(){return{animate:_c(!0),whileInView:_c(),whileHover:_c(),whileTap:_c(),whileDrag:_c(),whileFocus:_c(),exit:_c()}}class Sa{constructor(e){this.isMounted=!1,this.node=e}update(){}}class qG extends Sa{constructor(e){super(e),e.animationState||(e.animationState=jG(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();P0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let zG=0;class HG extends Sa{constructor(){super(...arguments),this.id=zG++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const WG={animation:{Feature:qG},exit:{Feature:HG}},_E=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function k0(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const KG=t=>e=>_E(e)&&t(e,k0(e));function $o(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function Fo(t,e,r,n){return $o(t,e,KG(r),n)}const EE=(t,e)=>Math.abs(t-e);function VG(t,e){const r=EE(t.x,e.x),n=EE(t.y,e.y);return Math.sqrt(r**2+n**2)}class SE{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=eb(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,A=VG(g.offset,{x:0,y:0})>=3;if(!y&&!A)return;const{point:P}=g,{timestamp:O}=Kn;this.history.push({...P,timestamp:O});const{onStart:D,onMove:k}=this.handlers;y||(D&&D(this.lastMoveEvent,g),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,g)},this.handlePointerMove=(g,y)=>{this.lastMoveEvent=g,this.lastMoveEventInfo=Qv(y,this.transformPagePoint),Nr.update(this.updatePoint,!0)},this.handlePointerUp=(g,y)=>{this.end();const{onEnd:A,onSessionEnd:P,resumeAnimation:O}=this.handlers;if(this.dragSnapToOrigin&&O&&O(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=eb(g.type==="pointercancel"?this.lastMoveEventInfo:Qv(y,this.transformPagePoint),this.history);this.startEvent&&A&&A(g,D),P&&P(g,D)},!_E(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=k0(e),a=Qv(o,this.transformPagePoint),{point:u}=a,{timestamp:l}=Kn;this.history=[{...u,timestamp:l}];const{onSessionStart:d}=r;d&&d(e,eb(a,this.history)),this.removeListeners=Bo(Fo(this.contextWindow,"pointermove",this.handlePointerMove),Fo(this.contextWindow,"pointerup",this.handlePointerUp),Fo(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),wa(this.updatePoint)}}function Qv(t,e){return e?{point:e(t.point)}:t}function AE(t,e){return{x:t.x-e.x,y:t.y-e.y}}function eb({point:t},e){return{point:t,delta:AE(t,PE(e)),offset:AE(t,GG(e)),velocity:YG(e,.1)}}function GG(t){return t[0]}function PE(t){return t[t.length-1]}function YG(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=PE(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>Qs(e)));)r--;if(!n)return{x:0,y:0};const s=Lo(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function ME(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const IE=ME("dragHorizontal"),CE=ME("dragVertical");function TE(t){let e=!1;if(t==="y")e=CE();else if(t==="x")e=IE();else{const r=IE(),n=CE();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function RE(){const t=TE(!0);return t?(t(),!1):!0}function ju(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const DE=1e-4,JG=1-DE,XG=1+DE,OE=.01,ZG=0-OE,QG=0+OE;function Ni(t){return t.max-t.min}function eY(t,e,r){return Math.abs(t-e)<=r}function NE(t,e,r,n=.5){t.origin=n,t.originPoint=Zr(e.min,e.max,t.origin),t.scale=Ni(r)/Ni(e),t.translate=Zr(r.min,r.max,t.origin)-t.originPoint,(t.scale>=JG&&t.scale<=XG||isNaN(t.scale))&&(t.scale=1),(t.translate>=ZG&&t.translate<=QG||isNaN(t.translate))&&(t.translate=0)}function rh(t,e,r,n){NE(t.x,e.x,r.x,n?n.originX:void 0),NE(t.y,e.y,r.y,n?n.originY:void 0)}function LE(t,e,r){t.min=r.min+e.min,t.max=t.min+Ni(e)}function tY(t,e,r){LE(t.x,e.x,r.x),LE(t.y,e.y,r.y)}function kE(t,e,r){t.min=e.min-r.min,t.max=t.min+Ni(e)}function nh(t,e,r){kE(t.x,e.x,r.x),kE(t.y,e.y,r.y)}function rY(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?Zr(r,t,n.max):Math.min(t,r)),t}function BE(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function nY(t,{top:e,left:r,bottom:n,right:i}){return{x:BE(t.x,r,i),y:BE(t.y,e,n)}}function $E(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=Fu(e.min,e.max-n,t.min):n>i&&(r=Fu(t.min,t.max-i,e.min)),xa(0,1,r)}function oY(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const tb=.35;function aY(t=tb){return t===!1?t=0:t===!0&&(t=tb),{x:FE(t,"left","right"),y:FE(t,"top","bottom")}}function FE(t,e,r){return{min:jE(t,e),max:jE(t,r)}}function jE(t,e){return typeof t=="number"?t:t[e]||0}const UE=()=>({translate:0,scale:1,origin:0,originPoint:0}),Uu=()=>({x:UE(),y:UE()}),qE=()=>({min:0,max:0}),ln=()=>({x:qE(),y:qE()});function rs(t){return[t("x"),t("y")]}function zE({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function cY({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function uY(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function rb(t){return t===void 0||t===1}function nb({scale:t,scaleX:e,scaleY:r}){return!rb(t)||!rb(e)||!rb(r)}function Ec(t){return nb(t)||HE(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function HE(t){return WE(t.x)||WE(t.y)}function WE(t){return t&&t!=="0%"}function B0(t,e,r){const n=t-r,i=e*n;return r+i}function KE(t,e,r,n,i){return i!==void 0&&(t=B0(t,i,n)),B0(t,r,n)+e}function ib(t,e=0,r=1,n,i){t.min=KE(t.min,e,r,n,i),t.max=KE(t.max,e,r,n,i)}function VE(t,{x:e,y:r}){ib(t.x,e.translate,e.scale,e.originPoint),ib(t.y,r.translate,r.scale,r.originPoint)}const GE=.999999999999,YE=1.0000000000001;function fY(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;aGE&&(e.x=1),e.yGE&&(e.y=1)}function qu(t,e){t.min=t.min+e,t.max=t.max+e}function JE(t,e,r,n,i=.5){const s=Zr(t.min,t.max,i);ib(t,e,r,s,n)}function zu(t,e){JE(t.x,e.x,e.scaleX,e.scale,e.originX),JE(t.y,e.y,e.scaleY,e.scale,e.originY)}function XE(t,e){return zE(uY(t.getBoundingClientRect(),e))}function lY(t,e,r){const n=XE(t,r),{scroll:i}=e;return i&&(qu(n.x,i.offset.x),qu(n.y,i.offset.y)),n}const ZE=({current:t})=>t?t.ownerDocument.defaultView:null,hY=new WeakMap;class dY{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ln(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:g}=this.getProps();g?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(k0(d,"page").point)},s=(d,g)=>{const{drag:y,dragPropagation:A,onDragStart:P}=this.getProps();if(y&&!A&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=TE(y),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),rs(D=>{let k=this.getAxisMotionValue(D).get()||0;if(eo.test(k)){const{projection:B}=this.visualElement;if(B&&B.layout){const j=B.layout.layoutBox[D];j&&(k=Ni(j)*(parseFloat(k)/100))}}this.originPoint[D]=k}),P&&Nr.postRender(()=>P(d,g)),Xv(this.visualElement,"transform");const{animationState:O}=this.visualElement;O&&O.setActive("whileDrag",!0)},o=(d,g)=>{const{dragPropagation:y,dragDirectionLock:A,onDirectionLock:P,onDrag:O}=this.getProps();if(!y&&!this.openGlobalLock)return;const{offset:D}=g;if(A&&this.currentDirection===null){this.currentDirection=pY(D),this.currentDirection!==null&&P&&P(this.currentDirection);return}this.updateAxis("x",g.point,D),this.updateAxis("y",g.point,D),this.visualElement.render(),O&&O(d,g)},a=(d,g)=>this.stop(d,g),u=()=>rs(d=>{var g;return this.getAnimationState(d)==="paused"&&((g=this.getAxisMotionValue(d).animation)===null||g===void 0?void 0:g.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new SE(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:ZE(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Nr.postRender(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!$0(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=rY(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&ju(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=nY(i.layoutBox,r):this.constraints=!1,this.elastic=aY(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&rs(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=oY(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!ju(e))return!1;const n=e.current;ko(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=lY(n,i.root,this.visualElement.getTransformPagePoint());let o=iY(i.layout.layoutBox,s);if(r){const a=r(cY(o));this.hasMutatedConstraints=!!a,a&&(o=zE(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),u=this.constraints||{},l=rs(d=>{if(!$0(d,r,this.currentDirection))return;let g=u&&u[d]||{};o&&(g={min:0,max:0});const y=i?200:1e6,A=i?40:1e7,P={type:"inertia",velocity:n?e[d]:0,bounceStiffness:y,bounceDamping:A,timeConstant:750,restDelta:1,restSpeed:10,...s,...g};return this.startAxisValueAnimation(d,P)});return Promise.all(l).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return Xv(this.visualElement,e),n.start(Kv(e,n,0,r,this.visualElement,!1))}stopAnimation(){rs(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){rs(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){rs(r=>{const{drag:n}=this.getProps();if(!$0(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-Zr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!ju(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};rs(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const u=a.get();i[o]=sY({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),rs(o=>{if(!$0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:u,max:l}=this.constraints[o];a.set(Zr(u,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;hY.set(this.visualElement,this);const e=this.visualElement.current,r=Fo(e,"pointerdown",u=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();ju(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Nr.read(n);const o=$o(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(rs(d=>{const g=this.getAxisMotionValue(d);g&&(this.originPoint[d]+=u[d].translate,g.set(g.get()+u[d].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=tb,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function $0(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function pY(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class gY extends Sa{constructor(e){super(e),this.removeGroupControls=Wn,this.removeListeners=Wn,this.controls=new dY(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Wn}unmount(){this.removeGroupControls(),this.removeListeners()}}const QE=t=>(e,r)=>{t&&Nr.postRender(()=>t(e,r))};class mY extends Sa{constructor(){super(...arguments),this.removePointerDownListener=Wn}onPointerDown(e){this.session=new SE(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:ZE(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:QE(e),onStart:QE(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&Nr.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=Fo(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const F0=Se.createContext(null);function vY(){const t=Se.useContext(F0);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=Se.useId();Se.useEffect(()=>n(i),[]);const s=Se.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const sb=Se.createContext({}),eS=Se.createContext({}),j0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function tS(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ih={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(zt.test(t))t=parseFloat(t);else return t;const r=tS(t,e.target.x),n=tS(t,e.target.y);return`${r}% ${n}%`}},bY={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=Ea.parse(t);if(i.length>5)return n;const s=Ea.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,u=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=u;const l=Zr(a,u,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),s(i)}},U0={};function yY(t){Object.assign(U0,t)}const{schedule:ob}=v8(queueMicrotask,!1);class wY extends Se.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;yY(xY),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),j0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Nr.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ob.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function rS(t){const[e,r]=vY(),n=Se.useContext(sb);return le.jsx(wY,{...t,layoutGroup:n,switchLayoutGroup:Se.useContext(eS),isPresent:e,safeToRemove:r})}const xY={borderRadius:{...ih,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ih,borderTopRightRadius:ih,borderBottomLeftRadius:ih,borderBottomRightRadius:ih,boxShadow:bY},nS=["TopLeft","TopRight","BottomLeft","BottomRight"],_Y=nS.length,iS=t=>typeof t=="string"?parseFloat(t):t,sS=t=>typeof t=="number"||zt.test(t);function EY(t,e,r,n,i,s){i?(t.opacity=Zr(0,r.opacity!==void 0?r.opacity:1,SY(n)),t.opacityExit=Zr(e.opacity!==void 0?e.opacity:1,0,AY(n))):s&&(t.opacity=Zr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;o<_Y;o++){const a=`border${nS[o]}Radius`;let u=oS(e,a),l=oS(r,a);if(u===void 0&&l===void 0)continue;u||(u=0),l||(l=0),u===0||l===0||sS(u)===sS(l)?(t[a]=Math.max(Zr(iS(u),iS(l),n),0),(eo.test(l)||eo.test(u))&&(t[a]+="%")):t[a]=l}(e.rotate||r.rotate)&&(t.rotate=Zr(e.rotate||0,r.rotate||0,n))}function oS(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const SY=aS(0,.5,S8),AY=aS(.5,.95,Wn);function aS(t,e,r){return n=>ne?1:r(Fu(t,e,n))}function cS(t,e){t.min=e.min,t.max=e.max}function ns(t,e){cS(t.x,e.x),cS(t.y,e.y)}function uS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function fS(t,e,r,n,i){return t-=e,t=B0(t,1/r,n),i!==void 0&&(t=B0(t,1/i,n)),t}function PY(t,e=0,r=1,n=.5,i,s=t,o=t){if(eo.test(e)&&(e=parseFloat(e),e=Zr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Zr(s.min,s.max,n);t===s&&(a-=e),t.min=fS(t.min,e,r,a,i),t.max=fS(t.max,e,r,a,i)}function lS(t,e,[r,n,i],s,o){PY(t,e[r],e[n],e[i],e.scale,s,o)}const MY=["x","scaleX","originX"],IY=["y","scaleY","originY"];function hS(t,e,r,n){lS(t.x,e,MY,r?r.x:void 0,n?n.x:void 0),lS(t.y,e,IY,r?r.y:void 0,n?n.y:void 0)}function dS(t){return t.translate===0&&t.scale===1}function pS(t){return dS(t.x)&&dS(t.y)}function gS(t,e){return t.min===e.min&&t.max===e.max}function CY(t,e){return gS(t.x,e.x)&&gS(t.y,e.y)}function mS(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function vS(t,e){return mS(t.x,e.x)&&mS(t.y,e.y)}function bS(t){return Ni(t.x)/Ni(t.y)}function yS(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class TY{constructor(){this.members=[]}add(e){Vv(this.members,e),e.scheduleRender()}remove(e){if(Gv(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function RY(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:l,rotate:d,rotateX:g,rotateY:y,skewX:A,skewY:P}=r;l&&(n=`perspective(${l}px) ${n}`),d&&(n+=`rotate(${d}deg) `),g&&(n+=`rotateX(${g}deg) `),y&&(n+=`rotateY(${y}deg) `),A&&(n+=`skewX(${A}deg) `),P&&(n+=`skewY(${P}deg) `)}const a=t.x.scale*e.x,u=t.y.scale*e.y;return(a!==1||u!==1)&&(n+=`scale(${a}, ${u})`),n||"none"}const DY=(t,e)=>t.depth-e.depth;class OY{constructor(){this.children=[],this.isDirty=!1}add(e){Vv(this.children,e),this.isDirty=!0}remove(e){Gv(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(DY),this.isDirty=!1,this.children.forEach(e)}}function q0(t){const e=Qn(t)?t.get():t;return AG(e)?e.toValue():e}function NY(t,e){const r=to.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(wa(n),t(s-e))};return Nr.read(n,!0),()=>wa(n)}function LY(t){return t instanceof SVGElement&&t.tagName!=="svg"}function kY(t,e,r){const n=Qn(t)?t:th(t);return n.start(Kv("",n,e,r)),n.animation}const Sc={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},sh=typeof window<"u"&&window.MotionDebug!==void 0,ab=["","X","Y","Z"],BY={visibility:"hidden"},wS=1e3;let $Y=0;function cb(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function xS(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=bE(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Nr,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&xS(n)}function _S({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=$Y++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,sh&&(Sc.totalNodes=Sc.resolvedTargetDeltas=Sc.recalculatedProjection=0),this.nodes.forEach(UY),this.nodes.forEach(KY),this.nodes.forEach(VY),this.nodes.forEach(qY),sh&&window.MotionDebug.record(Sc)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let u=0;uthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,g&&g(),g=NY(y,250),j0.hasAnimatedSinceResize&&(j0.hasAnimatedSinceResize=!1,this.nodes.forEach(SS))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&d&&(u||l)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:y,hasRelativeTargetChanged:A,layout:P})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const O=this.options.transition||d.getDefaultTransition()||ZY,{onLayoutAnimationStart:D,onLayoutAnimationComplete:k}=d.getProps(),B=!this.targetLayout||!vS(this.targetLayout,P)||A,j=!y&&A;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||j||y&&(B||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(g,j);const U={...wv(O,"layout"),onPlay:D,onComplete:k};(d.shouldReduceMotion||this.options.layoutRoot)&&(U.delay=0,U.type=!1),this.startAnimation(U)}else y||SS(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=P})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,wa(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(GY),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&xS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u{const K=U/1e3;AS(g.x,o.x,K),AS(g.y,o.y,K),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(nh(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),JY(this.relativeTarget,this.relativeTargetOrigin,y,K),j&&CY(this.relativeTarget,j)&&(this.isProjectionDirty=!1),j||(j=ln()),ns(j,this.relativeTarget)),O&&(this.animationValues=d,EY(d,l,this.latestValues,K,B,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=K},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(wa(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nr.update(()=>{j0.hasAnimatedSinceResize=!0,this.currentAnimation=kY(0,wS,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(wS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:u,layout:l,latestValues:d}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&TS(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||ln();const g=Ni(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+g;const y=Ni(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+y}ns(a,u),zu(a,d),rh(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new TY),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(a=!0),!a)return;const l={};u.z&&cb("z",o,l,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(ES),this.root.sharedNodes.clear()}}}function FY(t){t.updateLayout()}function jY(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?rs(g=>{const y=o?r.measuredBox[g]:r.layoutBox[g],A=Ni(y);y.min=n[g].min,y.max=y.min+A}):TS(s,r.layoutBox,n)&&rs(g=>{const y=o?r.measuredBox[g]:r.layoutBox[g],A=Ni(n[g]);y.max=y.min+A,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[g].max=t.relativeTarget[g].min+A)});const a=Uu();rh(a,n,r.layoutBox);const u=Uu();o?rh(u,t.applyTransform(i,!0),r.measuredBox):rh(u,n,r.layoutBox);const l=!pS(a);let d=!1;if(!t.resumeFrom){const g=t.getClosestProjectingParent();if(g&&!g.resumeFrom){const{snapshot:y,layout:A}=g;if(y&&A){const P=ln();nh(P,r.layoutBox,y.layoutBox);const O=ln();nh(O,n,A.layoutBox),vS(P,O)||(d=!0),g.options.layoutRoot&&(t.relativeTarget=O,t.relativeTargetOrigin=P,t.relativeParent=g)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:u,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function UY(t){sh&&Sc.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function qY(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function zY(t){t.clearSnapshot()}function ES(t){t.clearMeasurements()}function HY(t){t.isLayoutDirty=!1}function WY(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function SS(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function KY(t){t.resolveTargetDelta()}function VY(t){t.calcProjection()}function GY(t){t.resetSkewAndRotation()}function YY(t){t.removeLeadSnapshot()}function AS(t,e,r){t.translate=Zr(e.translate,0,r),t.scale=Zr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function PS(t,e,r,n){t.min=Zr(e.min,r.min,n),t.max=Zr(e.max,r.max,n)}function JY(t,e,r,n){PS(t.x,e.x,r.x,n),PS(t.y,e.y,r.y,n)}function XY(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const ZY={duration:.45,ease:[.4,0,.1,1]},MS=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),IS=MS("applewebkit/")&&!MS("chrome/")?Math.round:Wn;function CS(t){t.min=IS(t.min),t.max=IS(t.max)}function QY(t){CS(t.x),CS(t.y)}function TS(t,e,r){return t==="position"||t==="preserve-aspect"&&!eY(bS(e),bS(r),.2)}function eJ(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const tJ=_S({attachResizeListener:(t,e)=>$o(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ub={current:void 0},RS=_S({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!ub.current){const t=new tJ({});t.mount(window),t.setOptions({layoutScroll:!0}),ub.current=t}return ub.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),rJ={pan:{Feature:mY},drag:{Feature:gY,ProjectionNode:RS,MeasureLayout:rS}};function DS(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||RE())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const u=a[n];u&&Nr.postRender(()=>u(s,o))};return Fo(t.current,r,i,{passive:!t.getProps()[n]})}class nJ extends Sa{mount(){this.unmount=Bo(DS(this.node,!0),DS(this.node,!1))}unmount(){}}class iJ extends Sa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Bo($o(this.node.current,"focus",()=>this.onFocus()),$o(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const OS=(t,e)=>e?t===e?!0:OS(t,e.parentElement):!1;function fb(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,k0(r))}class sJ extends Sa{constructor(){super(...arguments),this.removeStartListeners=Wn,this.removeEndListeners=Wn,this.removeAccessibleListeners=Wn,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=Fo(window,"pointerup",(a,u)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:d,globalTapTarget:g}=this.node.getProps(),y=!g&&!OS(this.node.current,a.target)?d:l;y&&Nr.update(()=>y(a,u))},{passive:!(n.onTap||n.onPointerUp)}),o=Fo(window,"pointercancel",(a,u)=>this.cancelPress(a,u),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=Bo(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||fb("up",(u,l)=>{const{onTap:d}=this.node.getProps();d&&Nr.postRender(()=>d(u,l))})};this.removeEndListeners(),this.removeEndListeners=$o(this.node.current,"keyup",o),fb("down",(a,u)=>{this.startPress(a,u)})},r=$o(this.node.current,"keydown",e),n=()=>{this.isPressing&&fb("cancel",(s,o)=>this.cancelPress(s,o))},i=$o(this.node.current,"blur",n);this.removeAccessibleListeners=Bo(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Nr.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!RE()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Nr.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=Fo(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=$o(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Bo(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const lb=new WeakMap,hb=new WeakMap,oJ=t=>{const e=lb.get(t.target);e&&e(t)},aJ=t=>{t.forEach(oJ)};function cJ({root:t,...e}){const r=t||document;hb.has(r)||hb.set(r,{});const n=hb.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(aJ,{root:t,...e})),n[i]}function uJ(t,e,r){const n=cJ(e);return lb.set(t,r),n.observe(t),()=>{lb.delete(t),n.unobserve(t)}}const fJ={some:0,all:1};class lJ extends Sa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:fJ[i]},a=u=>{const{isIntersecting:l}=u;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:g}=this.node.getProps(),y=l?d:g;y&&y(u)};return uJ(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(hJ(e,r))&&this.startObserver()}unmount(){}}function hJ({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const dJ={inView:{Feature:lJ},tap:{Feature:sJ},focus:{Feature:iJ},hover:{Feature:nJ}},pJ={layout:{ProjectionNode:RS,MeasureLayout:rS}},db=Se.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),z0=Se.createContext({}),pb=typeof window<"u",NS=pb?Se.useLayoutEffect:Se.useEffect,LS=Se.createContext({strict:!1});function gJ(t,e,r,n,i){var s,o;const{visualElement:a}=Se.useContext(z0),u=Se.useContext(LS),l=Se.useContext(F0),d=Se.useContext(db).reducedMotion,g=Se.useRef();n=n||u.renderer,!g.current&&n&&(g.current=n(t,{visualState:e,parent:a,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d}));const y=g.current,A=Se.useContext(eS);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&mJ(g.current,r,i,A);const P=Se.useRef(!1);Se.useInsertionEffect(()=>{y&&P.current&&y.update(r,l)});const O=r[vE],D=Se.useRef(!!O&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,O))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,O)));return NS(()=>{y&&(P.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),ob.render(y.render),D.current&&y.animationState&&y.animationState.animateChanges())}),Se.useEffect(()=>{y&&(!D.current&&y.animationState&&y.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{var k;(k=window.MotionHandoffMarkAsComplete)===null||k===void 0||k.call(window,O)}),D.current=!1))}),y}function mJ(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:u,layoutRoot:l}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:kS(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&ju(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:u,layoutRoot:l})}function kS(t){if(t)return t.options.allowProjection!==!1?t.projection:kS(t.parent)}function vJ(t,e,r){return Se.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):ju(r)&&(r.current=n))},[e])}function H0(t){return P0(t.animate)||yv.some(e=>Vl(t[e]))}function BS(t){return!!(H0(t)||t.variants)}function bJ(t,e){if(H0(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Vl(r)?r:void 0,animate:Vl(n)?n:void 0}}return t.inherit!==!1?e:{}}function yJ(t){const{initial:e,animate:r}=bJ(t,Se.useContext(z0));return Se.useMemo(()=>({initial:e,animate:r}),[$S(e),$S(r)])}function $S(t){return Array.isArray(t)?t.join(" "):t}const FS={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Hu={};for(const t in FS)Hu[t]={isEnabled:e=>FS[t].some(r=>!!e[r])};function wJ(t){for(const e in t)Hu[e]={...Hu[e],...t[e]}}const xJ=Symbol.for("motionComponentSymbol");function _J({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&wJ(t);function s(a,u){let l;const d={...Se.useContext(db),...a,layoutId:EJ(a)},{isStatic:g}=d,y=yJ(a),A=n(a,g);if(!g&&pb){SJ(d,t);const P=AJ(d);l=P.MeasureLayout,y.visualElement=gJ(i,A,d,e,P.ProjectionNode)}return le.jsxs(z0.Provider,{value:y,children:[l&&y.visualElement?le.jsx(l,{visualElement:y.visualElement,...d}):null,r(i,a,vJ(A,y.visualElement,u),A,g,y.visualElement)]})}const o=Se.forwardRef(s);return o[xJ]=i,o}function EJ({layoutId:t}){const e=Se.useContext(sb).id;return e&&t!==void 0?e+"-"+t:t}function SJ(t,e){const r=Se.useContext(LS).strict;if(process.env.NODE_ENV!=="production"&&e&&r){const n="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?Lu(!1,n):ko(!1,n)}}function AJ(t){const{drag:e,layout:r}=Hu;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const PJ=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function gb(t){return typeof t!="string"||t.includes("-")?!1:!!(PJ.indexOf(t)>-1||/[A-Z]/u.test(t))}function jS(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const US=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function qS(t,e,r,n){jS(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(US.has(i)?i:Jv(i),e.attrs[i])}function zS(t,{layout:e,layoutId:r}){return yc.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!U0[t]||t==="opacity")}function mb(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(Qn(i[o])||e.style&&Qn(e.style[o])||zS(o,t)||((n=r==null?void 0:r.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function HS(t,e,r){const n=mb(t,e,r);for(const i in t)if(Qn(t[i])||Qn(e[i])){const s=Gl.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function vb(t){const e=Se.useRef(null);return e.current===null&&(e.current=t()),e.current}function MJ({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:IJ(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const WS=t=>(e,r)=>{const n=Se.useContext(z0),i=Se.useContext(F0),s=()=>MJ(t,e,n,i);return r?s():vb(s)};function IJ(t,e,r,n){const i={},s=n(t,{});for(const y in s)i[y]=q0(s[y]);let{initial:o,animate:a}=t;const u=H0(t),l=BS(t);e&&l&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const g=d?a:o;if(g&&typeof g!="boolean"&&!P0(g)){const y=Array.isArray(g)?g:[g];for(let A=0;A({style:{},transform:{},transformOrigin:{},vars:{}}),KS=()=>({...bb(),attrs:{}}),VS=(t,e)=>e&&typeof t=="number"?e.transform(t):t,CJ={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},TJ=Gl.length;function RJ(t,e,r){let n="",i=!0;for(let s=0;stypeof t=="string"&&t.toLowerCase()==="svg",kJ={useVisualState:WS({scrapeMotionValuesFromProps:HS,createRenderState:KS,onMount:(t,e,{renderState:r,latestValues:n})=>{Nr.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),Nr.render(()=>{wb(r,n,xb(e.tagName),t.transformTemplate),qS(e,r)})}})},BJ={useVisualState:WS({scrapeMotionValuesFromProps:mb,createRenderState:bb})};function YS(t,e,r){for(const n in e)!Qn(e[n])&&!zS(n,r)&&(t[n]=e[n])}function $J({transformTemplate:t},e){return Se.useMemo(()=>{const r=bb();return yb(r,e,t),Object.assign({},r.vars,r.style)},[e])}function FJ(t,e){const r=t.style||{},n={};return YS(n,r,t),Object.assign(n,$J(t,e)),n}function jJ(t,e){const r={},n=FJ(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const UJ=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function W0(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||UJ.has(t)}let JS=t=>!W0(t);function qJ(t){t&&(JS=e=>e.startsWith("on")?!W0(e):t(e))}try{qJ(require("@emotion/is-prop-valid").default)}catch{}function zJ(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(JS(i)||r===!0&&W0(i)||!e&&!W0(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function HJ(t,e,r,n){const i=Se.useMemo(()=>{const s=KS();return wb(s,e,xb(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};YS(s,t.style,t),i.style={...s,...i.style}}return i}function WJ(t=!1){return(r,n,i,{latestValues:s},o)=>{const u=(gb(r)?HJ:jJ)(n,s,o,r),l=zJ(n,typeof r=="string",t),d=r!==Se.Fragment?{...l,...u,ref:i}:{},{children:g}=n,y=Se.useMemo(()=>Qn(g)?g.get():g,[g]);return Se.createElement(r,{...d,children:y})}}function KJ(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...gb(n)?kJ:BJ,preloadedFeatures:t,useRender:WJ(i),createVisualElement:e,Component:n};return _J(o)}}const _b={current:null},XS={current:!1};function VJ(){if(XS.current=!0,!!pb)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>_b.current=t.matches;t.addListener(e),e()}else _b.current=!1}function GJ(t,e,r){for(const n in e){const i=e[n],s=r[n];if(Qn(i))t.addValue(n,i),process.env.NODE_ENV==="development"&&A0(i.version==="11.11.17",`Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`);else if(Qn(s))t.addValue(n,th(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,th(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const ZS=new WeakMap,YJ=[...k8,Zn,Ea],JJ=t=>YJ.find(L8(t)),QS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class XJ{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Mv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=to.now();this.renderScheduledAtthis.bindToMotionValue(n,r)),XS.current||VJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:_b.current,process.env.NODE_ENV!=="production"&&A0(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){ZS.delete(this.current),this.projection&&this.projection.unmount(),wa(this.notifyUpdate),wa(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=yc.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Nr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Hu){const r=Hu[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ln()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=th(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(M8(i)||P8(i))?i=parseFloat(i):!JJ(i)&&Ea.test(r)&&(i=V8(e,r)),this.setBaseTarget(e,Qn(i)?i.get():i)),Qn(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=vv(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Qn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new Yv),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class e7 extends XJ{constructor(){super(...arguments),this.KeyframeResolver=G8}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function ZJ(t){return window.getComputedStyle(t)}class QJ extends e7{constructor(){super(...arguments),this.type="html",this.renderInstance=jS}readValueFromInstance(e,r){if(yc.has(r)){const n=Nv(r);return n&&n.default||0}else{const n=ZJ(e),i=(C8(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return XE(e,r)}build(e,r,n){yb(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return mb(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Qn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class eX extends e7{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ln}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(yc.has(r)){const n=Nv(r);return n&&n.default||0}return r=US.has(r)?r:Jv(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return HS(e,r,n)}build(e,r,n){wb(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){qS(e,r,n,i)}mount(e){this.isSVGTag=xb(e.tagName),super.mount(e)}}const tX=(t,e)=>gb(t)?new eX(e):new QJ(e,{allowProjection:t!==Se.Fragment}),rX=KJ({...WG,...dJ,...rJ,...pJ},tX),nX=$K(rX);class iX extends Yt.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function sX({children:t,isPresent:e}){const r=Se.useId(),n=Se.useRef(null),i=Se.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=Se.useContext(db);return Se.useInsertionEffect(()=>{const{width:o,height:a,top:u,left:l}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` [data-motion-pop-id="${r}"] { position: absolute !important; width: ${o}px !important; @@ -194,7 +194,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene top: ${u}px !important; left: ${l}px !important; } - `),()=>{document.head.removeChild(d)}},[e]),me.jsx(YJ,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const XJ=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=vb(ZJ),u=Pe.useId(),l=Pe.useCallback(g=>{a.set(g,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Pe.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:g=>(a.set(g,!1),()=>a.delete(g))}),s?[Math.random(),l]:[r,l]);return Pe.useMemo(()=>{a.forEach((g,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=me.jsx(JJ,{isPresent:r,children:t})),me.jsx(B0.Provider,{value:d,children:t})};function ZJ(){return new Map}const W0=t=>t.key||"";function ZS(t){const e=[];return Pe.Children.forEach(t,r=>{Pe.isValidElement(r)&&e.push(r)}),e}const QJ=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Do(!e,"Replace exitBeforeEnter with mode='wait'");const a=Pe.useMemo(()=>ZS(t),[t]),u=a.map(W0),l=Pe.useRef(!0),d=Pe.useRef(a),g=vb(()=>new Map),[y,A]=Pe.useState(a),[P,N]=Pe.useState(a);RS(()=>{l.current=!1,d.current=a;for(let $=0;$1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=Pe.useContext(sb);return me.jsx(me.Fragment,{children:P.map($=>{const q=W0($),U=a===P||u.includes(q),K=()=>{if(g.has(q))g.set(q,!0);else return;let J=!0;g.forEach(T=>{T||(J=!1)}),J&&(k==null||k(),N(d.current),i&&i())};return me.jsx(XJ,{isPresent:U,initial:!l.current||n?void 0:!1,custom:U?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:U?void 0:K,children:$},q)})})},Ec=t=>me.jsx(QJ,{children:me.jsx(GJ.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Eb(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return me.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,me.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[me.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),me.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:me.jsx(EK,{})})]})]})}function eX(t){return t.lastUsed?me.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[me.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?me.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[me.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function QS(t){var o,a;const{wallet:e,onClick:r}=t,n=me.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Pe.useMemo(()=>eX(e),[e]);return me.jsx(Eb,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function e7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=sX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Sb);return a[0]===""&&a.length!==1&&a.shift(),t7(a,e)||iX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},t7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?t7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Sb);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},r7=/^\[(.+)\]$/,iX=t=>{if(r7.test(t)){const e=r7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},sX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return aX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Ab(o,n,s,e)}),n},Ab=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:n7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(oX(i)){Ab(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Ab(o,n7(e,s),r,n)})})},n7=(t,e)=>{let r=t;return e.split(Sb).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},oX=t=>t.isThemeGetter,aX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,cX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},i7="!",uX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,g;for(let D=0;Dd?g-d:void 0;return{modifiers:u,hasImportantModifier:A,baseClassName:P,maybePostfixModifierPosition:N}};return r?a=>r({className:a,parseClassName:o}):o},fX=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},lX=t=>({cache:cX(t.cacheSize),parseClassName:uX(t),...nX(t)}),hX=/\s+/,dX=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(hX);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:A}=r(l);let P=!!A,N=n(P?y.substring(0,A):y);if(!N){if(!P){a=l+(a.length>0?" "+a:a);continue}if(N=n(y),!N){a=l+(a.length>0?" "+a:a);continue}P=!1}const D=fX(d).join(":"),k=g?D+i7:D,$=k+N;if(s.includes($))continue;s.push($);const q=i(N,P);for(let U=0;U0?" "+a:a)}return a};function pX(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;ng(d),t());return r=lX(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=dX(u,r);return i(u,d),d}return function(){return s(pX.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},o7=/^\[(?:([a-z-]+):)?(.+)\]$/i,mX=/^\d+\/\d+$/,vX=new Set(["px","full","screen"]),bX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,yX=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,wX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,xX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_X=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ko=t=>Hu(t)||vX.has(t)||mX.test(t),_a=t=>Wu(t,"length",TX),Hu=t=>!!t&&!Number.isNaN(Number(t)),Pb=t=>Wu(t,"number",Hu),sh=t=>!!t&&Number.isInteger(Number(t)),EX=t=>t.endsWith("%")&&Hu(t.slice(0,-1)),cr=t=>o7.test(t),Ea=t=>bX.test(t),SX=new Set(["length","size","percentage"]),AX=t=>Wu(t,SX,a7),PX=t=>Wu(t,"position",a7),MX=new Set(["image","url"]),IX=t=>Wu(t,MX,DX),CX=t=>Wu(t,"",RX),oh=()=>!0,Wu=(t,e,r)=>{const n=o7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},TX=t=>yX.test(t)&&!wX.test(t),a7=()=>!1,RX=t=>xX.test(t),DX=t=>_X.test(t),OX=gX(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),g=Gr("invert"),y=Gr("gap"),A=Gr("gradientColorStops"),P=Gr("gradientColorStopPositions"),N=Gr("inset"),D=Gr("margin"),k=Gr("opacity"),$=Gr("padding"),q=Gr("saturate"),U=Gr("scale"),K=Gr("sepia"),J=Gr("skew"),T=Gr("space"),z=Gr("translate"),ue=()=>["auto","contain","none"],_e=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",ko,_a],f=()=>["auto",Hu,cr],p=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],S=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Hu,cr];return{cacheSize:500,separator:":",theme:{colors:[oh],spacing:[ko,_a],blur:["none","",Ea,cr],brightness:M(),borderColor:[t],borderRadius:["none","","full",Ea,cr],borderSpacing:E(),borderWidth:m(),contrast:M(),grayscale:S(),hueRotate:M(),invert:S(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[EX,_a],inset:G(),margin:G(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:S(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Ea]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...p(),cr]}],overflow:[{overflow:_e()}],"overflow-x":[{"overflow-x":_e()}],"overflow-y":[{"overflow-y":_e()}],overscroll:[{overscroll:ue()}],"overscroll-x":[{"overscroll-x":ue()}],"overscroll-y":[{"overscroll-y":ue()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",sh,cr]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",sh,cr]}],"grid-cols":[{"grid-cols":[oh]}],"col-start-end":[{col:["auto",{span:["full",sh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[oh]}],"row-start-end":[{row:["auto",{span:[sh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[$]}],px:[{px:[$]}],py:[{py:[$]}],ps:[{ps:[$]}],pe:[{pe:[$]}],pt:[{pt:[$]}],pr:[{pr:[$]}],pb:[{pb:[$]}],pl:[{pl:[$]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Ea]},Ea]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Ea,_a]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Pb]}],"font-family":[{font:[oh]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Hu,Pb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ko,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ko,_a]}],"underline-offset":[{"underline-offset":["auto",ko,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...p(),PX]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",AX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},IX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[A]}],"gradient-via":[{via:[A]}],"gradient-to":[{to:[A]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[ko,cr]}],"outline-w":[{outline:[ko,_a]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[ko,_a]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Ea,CX]}],"shadow-color":[{shadow:[oh]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Ea,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[g]}],saturate:[{saturate:[q]}],sepia:[{sepia:[K]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[q]}],"backdrop-sepia":[{"backdrop-sepia":[K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[U]}],"scale-x":[{"scale-x":[U]}],"scale-y":[{"scale-y":[U]}],rotate:[{rotate:[sh,cr]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[J]}],"skew-y":[{"skew-y":[J]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[ko,_a,Pb]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function $o(...t){return OX(rX(t))}function c7(t){const{className:e}=t;return me.jsxs("div",{className:$o("xc-flex xc-items-center xc-gap-2"),children:[me.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)}),me.jsx("div",{className:"xc-shrink-0",children:t.children}),me.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)})]})}const NX="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function LX(t){const{onClick:e}=t;function r(){e&&e()}return me.jsx(c7,{className:"xc-opacity-20",children:me.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[me.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),me.jsx(c8,{size:16})]})})}function kX(t){const[e,r]=Pe.useState(""),{featuredWallets:n,initialized:i}=Wl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Pe.useMemo(()=>{const N=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!N.test(e)&&D.test(e)},[e]);function g(N){o(N)}function y(N){r(N.target.value)}async function A(){s(e)}function P(N){N.key==="Enter"&&d&&A()}return me.jsx(Ec,{children:i&&me.jsxs(me.Fragment,{children:[t.header||me.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),l.showEmailSignIn&&me.jsxs("div",{className:"xc-mb-4",children:[me.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:y,onKeyDown:P}),me.jsx("button",{disabled:!d,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:A,children:"Continue"})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&me.jsx("div",{className:"xc-mb-4",children:me.jsxs(c7,{className:"xc-opacity-20",children:[" ",me.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),me.jsxs("div",{children:[me.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(N=>me.jsx(QS,{wallet:N,onClick:g},`feature-${N.key}`)),l.showTonConnect&&me.jsx(Eb,{icon:me.jsx("img",{className:"xc-h-5 xc-w-5",src:NX}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&me.jsx(LX,{onClick:a})]})]})})}function ah(t){const{title:e}=t;return me.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[me.jsx(_K,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),me.jsx("span",{children:e})]})}var $X=Object.defineProperty,BX=Object.defineProperties,FX=Object.getOwnPropertyDescriptors,K0=Object.getOwnPropertySymbols,u7=Object.prototype.hasOwnProperty,f7=Object.prototype.propertyIsEnumerable,l7=(t,e,r)=>e in t?$X(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,UX=(t,e)=>{for(var r in e||(e={}))u7.call(e,r)&&l7(t,r,e[r]);if(K0)for(var r of K0(e))f7.call(e,r)&&l7(t,r,e[r]);return t},jX=(t,e)=>BX(t,FX(e)),qX=(t,e)=>{var r={};for(var n in t)u7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&K0)for(var n of K0(t))e.indexOf(n)<0&&f7.call(t,n)&&(r[n]=t[n]);return r};function zX(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function HX(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var WX=18,h7=40,KX=`${h7}px`,VX=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function GX({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),g=Yt.useCallback(()=>{let y=t.current,A=e.current;if(!y||!A||u||r==="none")return;let P=y,N=P.getBoundingClientRect().left+P.offsetWidth,D=P.getBoundingClientRect().top+P.offsetHeight/2,k=N-WX,$=D;document.querySelectorAll(VX).length===0&&document.elementFromPoint(k,$)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function A(){let N=window.innerWidth-y.getBoundingClientRect().right;a(N>=h7)}A();let P=setInterval(A,1e3);return()=>{clearInterval(P)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let A=setTimeout(g,0),P=setTimeout(g,2e3),N=setTimeout(g,5e3),D=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(A),clearTimeout(P),clearTimeout(N),clearTimeout(D)}},[e,n,r,g]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:KX}}var d7=Yt.createContext({}),p7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:g="increase-width",pasteTransformer:y,containerClassName:A,noScriptCSSFallback:P=YX,render:N,children:D}=r,k=qX(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),$,q,U,K,J;let[T,z]=Yt.useState(typeof k.defaultValue=="string"?k.defaultValue:""),ue=n??T,_e=HX(ue),G=Yt.useCallback(ie=>{i==null||i(ie),z(ie)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),p=Yt.useRef({value:ue,onChange:G,isIOS:typeof window<"u"&&((q=($=window==null?void 0:window.CSS)==null?void 0:$.supports)==null?void 0:q.call($,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(U=m.current)==null?void 0:U.selectionStart,(K=m.current)==null?void 0:K.selectionEnd,(J=m.current)==null?void 0:J.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let ie=m.current,fe=f.current;if(!ie||!fe)return;p.current.value!==ie.value&&p.current.onChange(ie.value),v.current.prev=[ie.selectionStart,ie.selectionEnd,ie.selectionDirection];function ve(){if(document.activeElement!==ie){I(null),ae(null);return}let Te=ie.selectionStart,Be=ie.selectionEnd,Ie=ie.selectionDirection,Le=ie.maxLength,Ve=ie.value,ke=v.current.prev,ze=-1,He=-1,Ee;if(Ve.length!==0&&Te!==null&&Be!==null){let et=Te===Be,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let pt=0;if(ke[0]!==null&&ke[1]!==null){Ee=Je{fe&&fe.style.setProperty("--root-height",`${ie.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(ie),()=>{document.removeEventListener("selectionchange",ve,{capture:!0}),Ne.disconnect()}},[]);let[x,_]=Yt.useState(!1),[S,b]=Yt.useState(!1),[M,I]=Yt.useState(null),[F,ae]=Yt.useState(null);Yt.useEffect(()=>{zX(()=>{var ie,fe,ve,Me;(ie=m.current)==null||ie.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(ve=m.current)==null?void 0:ve.selectionEnd,Be=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ae(Te),v.current.prev=[Ne,Te,Be])})},[ue,S]),Yt.useEffect(()=>{_e!==void 0&&ue!==_e&&_e.length{let fe=ie.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){ie.preventDefault();return}typeof _e=="string"&&fe.length<_e.length&&document.dispatchEvent(new Event("selectionchange")),G(fe)},[s,G,_e,E]),ee=Yt.useCallback(()=>{var ie;if(m.current){let fe=Math.min(m.current.value.length,s-1),ve=m.current.value.length;(ie=m.current)==null||ie.setSelectionRange(fe,ve),I(fe),ae(ve)}b(!0)},[s]),X=Yt.useCallback(ie=>{var fe,ve;let Me=m.current;if(!y&&(!p.current.isIOS||!ie.clipboardData||!Me))return;let Ne=ie.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),ie.preventDefault();let Be=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(ve=m.current)==null?void 0:ve.selectionEnd,Le=(Be!==Ie?ue.slice(0,Be)+Te+ue.slice(Ie):ue.slice(0,Be)+Te+ue.slice(Be)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,G(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ae(ke)},[s,G,E,ue]),Q=Yt.useMemo(()=>({position:"relative",cursor:k.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[k.disabled]),R=Yt.useMemo(()=>({position:"absolute",inset:0,width:O.willPushPWMBadge?`calc(100% + ${O.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:O.willPushPWMBadge?`inset(0 ${O.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[O.PWM_BADGE_SPACE_WIDTH,O.willPushPWMBadge,o]),Z=Yt.useMemo(()=>Yt.createElement("input",jX(UX({autoComplete:k.autoComplete||"one-time-code"},k),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ue.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:R,maxLength:s,value:ue,ref:m,onPaste:ie=>{var fe;X(ie),(fe=k.onPaste)==null||fe.call(k,ie)},onChange:se,onMouseOver:ie=>{var fe;_(!0),(fe=k.onMouseOver)==null||fe.call(k,ie)},onMouseLeave:ie=>{var fe;_(!1),(fe=k.onMouseLeave)==null||fe.call(k,ie)},onFocus:ie=>{var fe;ee(),(fe=k.onFocus)==null||fe.call(k,ie)},onBlur:ie=>{var fe;b(!1),(fe=k.onBlur)==null||fe.call(k,ie)}})),[se,ee,X,l,R,s,F,M,k,E==null?void 0:E.source,ue]),te=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ie,fe)=>{var ve;let Me=S&&M!==null&&F!==null&&(M===F&&fe===M||fe>=M&&feN?N(te):Yt.createElement(d7.Provider,{value:te},D),[D,te,N]);return Yt.createElement(Yt.Fragment,null,P!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,P)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:A},le,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Z)))});p7.displayName="Input";function ch(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var YX=` + `),()=>{document.head.removeChild(d)}},[e]),le.jsx(iX,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const oX=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=vb(aX),u=Se.useId(),l=Se.useCallback(g=>{a.set(g,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Se.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:g=>(a.set(g,!1),()=>a.delete(g))}),s?[Math.random(),l]:[r,l]);return Se.useMemo(()=>{a.forEach((g,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=le.jsx(sX,{isPresent:r,children:t})),le.jsx(F0.Provider,{value:d,children:t})};function aX(){return new Map}const K0=t=>t.key||"";function t7(t){const e=[];return Se.Children.forEach(t,r=>{Se.isValidElement(r)&&e.push(r)}),e}const cX=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{ko(!e,"Replace exitBeforeEnter with mode='wait'");const a=Se.useMemo(()=>t7(t),[t]),u=a.map(K0),l=Se.useRef(!0),d=Se.useRef(a),g=vb(()=>new Map),[y,A]=Se.useState(a),[P,O]=Se.useState(a);NS(()=>{l.current=!1,d.current=a;for(let B=0;B1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=Se.useContext(sb);return le.jsx(le.Fragment,{children:P.map(B=>{const j=K0(B),U=a===P||u.includes(j),K=()=>{if(g.has(j))g.set(j,!0);else return;let J=!0;g.forEach(T=>{T||(J=!1)}),J&&(k==null||k(),O(d.current),i&&i())};return le.jsx(oX,{isPresent:U,initial:!l.current||n?void 0:!1,custom:U?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:U?void 0:K,children:B},j)})})},ro=t=>le.jsx(cX,{children:le.jsx(nX.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Eb(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return le.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,le.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[le.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),le.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:le.jsx(OK,{})})]})]})}function uX(t){return t.lastUsed?le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[le.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[le.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function r7(t){var o,a;const{wallet:e,onClick:r}=t,n=le.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Se.useMemo(()=>uX(e),[e]);return le.jsx(Eb,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function n7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=pX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Sb);return a[0]===""&&a.length!==1&&a.shift(),i7(a,e)||dX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},i7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?i7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Sb);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},s7=/^\[(.+)\]$/,dX=t=>{if(s7.test(t)){const e=s7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},pX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return mX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Ab(o,n,s,e)}),n},Ab=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:o7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(gX(i)){Ab(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Ab(o,o7(e,s),r,n)})})},o7=(t,e)=>{let r=t;return e.split(Sb).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},gX=t=>t.isThemeGetter,mX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,vX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},a7="!",bX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,g;for(let D=0;Dd?g-d:void 0;return{modifiers:u,hasImportantModifier:A,baseClassName:P,maybePostfixModifierPosition:O}};return r?a=>r({className:a,parseClassName:o}):o},yX=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},wX=t=>({cache:vX(t.cacheSize),parseClassName:bX(t),...hX(t)}),xX=/\s+/,_X=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(xX);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:A}=r(l);let P=!!A,O=n(P?y.substring(0,A):y);if(!O){if(!P){a=l+(a.length>0?" "+a:a);continue}if(O=n(y),!O){a=l+(a.length>0?" "+a:a);continue}P=!1}const D=yX(d).join(":"),k=g?D+a7:D,B=k+O;if(s.includes(B))continue;s.push(B);const j=i(O,P);for(let U=0;U0?" "+a:a)}return a};function EX(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;ng(d),t());return r=wX(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=_X(u,r);return i(u,d),d}return function(){return s(EX.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},u7=/^\[(?:([a-z-]+):)?(.+)\]$/i,AX=/^\d+\/\d+$/,PX=new Set(["px","full","screen"]),MX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,IX=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,CX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,TX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,RX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,jo=t=>Wu(t)||PX.has(t)||AX.test(t),Aa=t=>Ku(t,"length",FX),Wu=t=>!!t&&!Number.isNaN(Number(t)),Pb=t=>Ku(t,"number",Wu),oh=t=>!!t&&Number.isInteger(Number(t)),DX=t=>t.endsWith("%")&&Wu(t.slice(0,-1)),cr=t=>u7.test(t),Pa=t=>MX.test(t),OX=new Set(["length","size","percentage"]),NX=t=>Ku(t,OX,f7),LX=t=>Ku(t,"position",f7),kX=new Set(["image","url"]),BX=t=>Ku(t,kX,UX),$X=t=>Ku(t,"",jX),ah=()=>!0,Ku=(t,e,r)=>{const n=u7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},FX=t=>IX.test(t)&&!CX.test(t),f7=()=>!1,jX=t=>TX.test(t),UX=t=>RX.test(t),qX=SX(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),g=Gr("invert"),y=Gr("gap"),A=Gr("gradientColorStops"),P=Gr("gradientColorStopPositions"),O=Gr("inset"),D=Gr("margin"),k=Gr("opacity"),B=Gr("padding"),j=Gr("saturate"),U=Gr("scale"),K=Gr("sepia"),J=Gr("skew"),T=Gr("space"),z=Gr("translate"),ue=()=>["auto","contain","none"],_e=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",jo,Aa],f=()=>["auto",Wu,cr],p=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],S=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Wu,cr];return{cacheSize:500,separator:":",theme:{colors:[ah],spacing:[jo,Aa],blur:["none","",Pa,cr],brightness:M(),borderColor:[t],borderRadius:["none","","full",Pa,cr],borderSpacing:E(),borderWidth:m(),contrast:M(),grayscale:S(),hueRotate:M(),invert:S(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[DX,Aa],inset:G(),margin:G(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:S(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Pa]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...p(),cr]}],overflow:[{overflow:_e()}],"overflow-x":[{"overflow-x":_e()}],"overflow-y":[{"overflow-y":_e()}],overscroll:[{overscroll:ue()}],"overscroll-x":[{"overscroll-x":ue()}],"overscroll-y":[{"overscroll-y":ue()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[O]}],"inset-x":[{"inset-x":[O]}],"inset-y":[{"inset-y":[O]}],start:[{start:[O]}],end:[{end:[O]}],top:[{top:[O]}],right:[{right:[O]}],bottom:[{bottom:[O]}],left:[{left:[O]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",oh,cr]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",oh,cr]}],"grid-cols":[{"grid-cols":[ah]}],"col-start-end":[{col:["auto",{span:["full",oh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[ah]}],"row-start-end":[{row:["auto",{span:[oh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[B]}],px:[{px:[B]}],py:[{py:[B]}],ps:[{ps:[B]}],pe:[{pe:[B]}],pt:[{pt:[B]}],pr:[{pr:[B]}],pb:[{pb:[B]}],pl:[{pl:[B]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Pa]},Pa]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Pa,Aa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Pb]}],"font-family":[{font:[ah]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Wu,Pb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",jo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",jo,Aa]}],"underline-offset":[{"underline-offset":["auto",jo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...p(),LX]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",NX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},BX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[A]}],"gradient-via":[{via:[A]}],"gradient-to":[{to:[A]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[jo,cr]}],"outline-w":[{outline:[jo,Aa]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[jo,Aa]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Pa,$X]}],"shadow-color":[{shadow:[ah]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Pa,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[g]}],saturate:[{saturate:[j]}],sepia:[{sepia:[K]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[j]}],"backdrop-sepia":[{"backdrop-sepia":[K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[U]}],"scale-x":[{"scale-x":[U]}],"scale-y":[{"scale-y":[U]}],rotate:[{rotate:[oh,cr]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[J]}],"skew-y":[{"skew-y":[J]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[jo,Aa,Pb]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function no(...t){return qX(lX(t))}function l7(t){const{className:e}=t;return le.jsxs("div",{className:no("xc-flex xc-items-center xc-gap-2"),children:[le.jsx("hr",{className:no("xc-flex-1 xc-border-gray-200",e)}),le.jsx("div",{className:"xc-shrink-0",children:t.children}),le.jsx("hr",{className:no("xc-flex-1 xc-border-gray-200",e)})]})}const zX="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function HX(t){const{onClick:e}=t;function r(){e&&e()}return le.jsx(l7,{className:"xc-opacity-20",children:le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[le.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),le.jsx(f8,{size:16})]})})}function h7(t){const[e,r]=Se.useState(""),{featuredWallets:n,initialized:i}=Kl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Se.useMemo(()=>{const O=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!O.test(e)&&D.test(e)},[e]);function g(O){o(O)}function y(O){r(O.target.value)}async function A(){s(e)}function P(O){O.key==="Enter"&&d&&A()}return le.jsx(ro,{children:i&&le.jsxs(le.Fragment,{children:[t.header||le.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),l.showEmailSignIn&&le.jsxs("div",{className:"xc-mb-4",children:[le.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:y,onKeyDown:P}),le.jsx("button",{disabled:!d,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:A,children:"Continue"})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&le.jsx("div",{className:"xc-mb-4",children:le.jsxs(l7,{className:"xc-opacity-20",children:[" ",le.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),le.jsxs("div",{children:[le.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(O=>le.jsx(r7,{wallet:O,onClick:g},`feature-${O.key}`)),l.showTonConnect&&le.jsx(Eb,{icon:le.jsx("img",{className:"xc-h-5 xc-w-5",src:zX}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&le.jsx(HX,{onClick:a})]})]})})}function Ac(t){const{title:e}=t;return le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[le.jsx(DK,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),le.jsx("span",{children:e})]})}var WX=Object.defineProperty,KX=Object.defineProperties,VX=Object.getOwnPropertyDescriptors,V0=Object.getOwnPropertySymbols,d7=Object.prototype.hasOwnProperty,p7=Object.prototype.propertyIsEnumerable,g7=(t,e,r)=>e in t?WX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,GX=(t,e)=>{for(var r in e||(e={}))d7.call(e,r)&&g7(t,r,e[r]);if(V0)for(var r of V0(e))p7.call(e,r)&&g7(t,r,e[r]);return t},YX=(t,e)=>KX(t,VX(e)),JX=(t,e)=>{var r={};for(var n in t)d7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&V0)for(var n of V0(t))e.indexOf(n)<0&&p7.call(t,n)&&(r[n]=t[n]);return r};function XX(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function ZX(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var QX=18,m7=40,eZ=`${m7}px`,tZ=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function rZ({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),g=Yt.useCallback(()=>{let y=t.current,A=e.current;if(!y||!A||u||r==="none")return;let P=y,O=P.getBoundingClientRect().left+P.offsetWidth,D=P.getBoundingClientRect().top+P.offsetHeight/2,k=O-QX,B=D;document.querySelectorAll(tZ).length===0&&document.elementFromPoint(k,B)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function A(){let O=window.innerWidth-y.getBoundingClientRect().right;a(O>=m7)}A();let P=setInterval(A,1e3);return()=>{clearInterval(P)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let A=setTimeout(g,0),P=setTimeout(g,2e3),O=setTimeout(g,5e3),D=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(A),clearTimeout(P),clearTimeout(O),clearTimeout(D)}},[e,n,r,g]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:eZ}}var v7=Yt.createContext({}),b7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:g="increase-width",pasteTransformer:y,containerClassName:A,noScriptCSSFallback:P=nZ,render:O,children:D}=r,k=JX(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),B,j,U,K,J;let[T,z]=Yt.useState(typeof k.defaultValue=="string"?k.defaultValue:""),ue=n??T,_e=ZX(ue),G=Yt.useCallback(ie=>{i==null||i(ie),z(ie)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),p=Yt.useRef({value:ue,onChange:G,isIOS:typeof window<"u"&&((j=(B=window==null?void 0:window.CSS)==null?void 0:B.supports)==null?void 0:j.call(B,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(U=m.current)==null?void 0:U.selectionStart,(K=m.current)==null?void 0:K.selectionEnd,(J=m.current)==null?void 0:J.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let ie=m.current,fe=f.current;if(!ie||!fe)return;p.current.value!==ie.value&&p.current.onChange(ie.value),v.current.prev=[ie.selectionStart,ie.selectionEnd,ie.selectionDirection];function ve(){if(document.activeElement!==ie){I(null),ae(null);return}let Te=ie.selectionStart,$e=ie.selectionEnd,Ie=ie.selectionDirection,Le=ie.maxLength,Ve=ie.value,ke=v.current.prev,ze=-1,He=-1,Ee;if(Ve.length!==0&&Te!==null&&$e!==null){let et=Te===$e,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let pt=0;if(ke[0]!==null&&ke[1]!==null){Ee=Je{fe&&fe.style.setProperty("--root-height",`${ie.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(ie),()=>{document.removeEventListener("selectionchange",ve,{capture:!0}),Ne.disconnect()}},[]);let[x,_]=Yt.useState(!1),[S,b]=Yt.useState(!1),[M,I]=Yt.useState(null),[F,ae]=Yt.useState(null);Yt.useEffect(()=>{XX(()=>{var ie,fe,ve,Me;(ie=m.current)==null||ie.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(ve=m.current)==null?void 0:ve.selectionEnd,$e=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ae(Te),v.current.prev=[Ne,Te,$e])})},[ue,S]),Yt.useEffect(()=>{_e!==void 0&&ue!==_e&&_e.length{let fe=ie.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){ie.preventDefault();return}typeof _e=="string"&&fe.length<_e.length&&document.dispatchEvent(new Event("selectionchange")),G(fe)},[s,G,_e,E]),ee=Yt.useCallback(()=>{var ie;if(m.current){let fe=Math.min(m.current.value.length,s-1),ve=m.current.value.length;(ie=m.current)==null||ie.setSelectionRange(fe,ve),I(fe),ae(ve)}b(!0)},[s]),X=Yt.useCallback(ie=>{var fe,ve;let Me=m.current;if(!y&&(!p.current.isIOS||!ie.clipboardData||!Me))return;let Ne=ie.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),ie.preventDefault();let $e=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(ve=m.current)==null?void 0:ve.selectionEnd,Le=($e!==Ie?ue.slice(0,$e)+Te+ue.slice(Ie):ue.slice(0,$e)+Te+ue.slice($e)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,G(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ae(ke)},[s,G,E,ue]),Q=Yt.useMemo(()=>({position:"relative",cursor:k.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[k.disabled]),R=Yt.useMemo(()=>({position:"absolute",inset:0,width:N.willPushPWMBadge?`calc(100% + ${N.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:N.willPushPWMBadge?`inset(0 ${N.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[N.PWM_BADGE_SPACE_WIDTH,N.willPushPWMBadge,o]),Z=Yt.useMemo(()=>Yt.createElement("input",YX(GX({autoComplete:k.autoComplete||"one-time-code"},k),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ue.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:R,maxLength:s,value:ue,ref:m,onPaste:ie=>{var fe;X(ie),(fe=k.onPaste)==null||fe.call(k,ie)},onChange:se,onMouseOver:ie=>{var fe;_(!0),(fe=k.onMouseOver)==null||fe.call(k,ie)},onMouseLeave:ie=>{var fe;_(!1),(fe=k.onMouseLeave)==null||fe.call(k,ie)},onFocus:ie=>{var fe;ee(),(fe=k.onFocus)==null||fe.call(k,ie)},onBlur:ie=>{var fe;b(!1),(fe=k.onBlur)==null||fe.call(k,ie)}})),[se,ee,X,l,R,s,F,M,k,E==null?void 0:E.source,ue]),te=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ie,fe)=>{var ve;let Me=S&&M!==null&&F!==null&&(M===F&&fe===M||fe>=M&&feO?O(te):Yt.createElement(v7.Provider,{value:te},D),[D,te,O]);return Yt.createElement(Yt.Fragment,null,P!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,P)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:A},he,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Z)))});b7.displayName="Input";function ch(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var nZ=` [data-input-otp] { --nojs-bg: white !important; --nojs-fg: black !important; @@ -213,13 +213,13 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene --nojs-bg: black !important; --nojs-fg: white !important; } -}`;const g7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>me.jsx(p7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));g7.displayName="InputOTP";const m7=Yt.forwardRef(({className:t,...e},r)=>me.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));m7.displayName="InputOTPGroup";const Sc=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(d7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return me.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&me.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:me.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Sc.displayName="InputOTPSlot";function JX(t){const{spinning:e,children:r,className:n}=t;return me.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&me.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:me.jsx(mc,{className:"xc-animate-spin"})})]})}const v7=Pe.createContext({channel:"",device:"WEB",app:"",inviterCode:""});function Mb(){return Pe.useContext(v7)}function XX(t){const{config:e}=t,[r,n]=Pe.useState(e.channel),[i,s]=Pe.useState(e.device),[o,a]=Pe.useState(e.app),[u,l]=Pe.useState(e.inviterCode);return Pe.useEffect(()=>{n(e.channel),s(e.device),a(e.app),l(e.inviterCode)},[e]),me.jsx(v7.Provider,{value:{channel:r,device:i,app:o,inviterCode:u},children:t.children})}function ZX(t){const{email:e}=t,[r,n]=Pe.useState(0),[i,s]=Pe.useState(!1),[o,a]=Pe.useState(!1),[u,l]=Pe.useState(""),[d,g]=Pe.useState(""),y=Mb();async function A(){n(60);const D=setInterval(()=>{n(k=>k===0?(clearInterval(D),0):k-1)},1e3)}async function P(D){a(!0);try{l(""),await ma.getEmailCode({account_type:"email",email:D}),A()}catch(k){l(k.message)}a(!1)}Pe.useEffect(()=>{e&&P(e)},[e]);async function N(D){if(g(""),!(D.length<6)){s(!0);try{const k=await ma.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:D,email:e,inviter_code:y.inviterCode,source:{device:y.device,channel:y.channel,app:y.app}});t.onLogin(k.data)}catch(k){g(k.message)}s(!1)}}return me.jsxs(Ec,{children:[me.jsx("div",{className:"xc-mb-12",children:me.jsx(ah,{title:"Sign in with email",onBack:t.onBack})}),me.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[me.jsx(IK,{className:"xc-mb-4",size:60}),me.jsx("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:u?me.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:me.jsx("p",{className:"xc-px-8",children:u})}):o?me.jsx(mc,{className:"xc-animate-spin"}):me.jsxs(me.Fragment,{children:[me.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),me.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]})}),me.jsx("div",{className:"xc-mb-2 xc-h-12",children:me.jsx(JX,{spinning:i,className:"xc-rounded-xl",children:me.jsx(g7,{maxLength:6,onChange:N,disabled:i,className:"disabled:xc-opacity-20",children:me.jsx(m7,{children:me.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[me.jsx(Sc,{index:0}),me.jsx(Sc,{index:1}),me.jsx(Sc,{index:2}),me.jsx(Sc,{index:3}),me.jsx(Sc,{index:4}),me.jsx(Sc,{index:5})]})})})})}),d&&me.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:me.jsx("p",{children:d})})]}),me.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Recend in ${r}s`:me.jsx("button",{onClick:()=>P(e),children:"Send again"})]})]})}var b7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var g=function(f,p){var v=f,x=k[p],_=null,S=0,b=null,M=[],I={},F=function(te,le){_=function(ie){for(var fe=new Array(ie),ve=0;ve=7&&ee(te),b==null&&(b=R(v,x,M)),Q(b,le)},ae=function(te,le){for(var ie=-1;ie<=7;ie+=1)if(!(te+ie<=-1||S<=te+ie))for(var fe=-1;fe<=7;fe+=1)le+fe<=-1||S<=le+fe||(_[te+ie][le+fe]=0<=ie&&ie<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(ie==0||ie==6)||2<=ie&&ie<=4&&2<=fe&&fe<=4)},O=function(){for(var te=8;te>ie&1)==1;_[Math.floor(ie/3)][ie%3+S-8-3]=fe}for(ie=0;ie<18;ie+=1)fe=!te&&(le>>ie&1)==1,_[ie%3+S-8-3][Math.floor(ie/3)]=fe},X=function(te,le){for(var ie=x<<3|le,fe=$.getBCHTypeInfo(ie),ve=0;ve<15;ve+=1){var Me=!te&&(fe>>ve&1)==1;ve<6?_[ve][8]=Me:ve<8?_[ve+1][8]=Me:_[S-15+ve][8]=Me}for(ve=0;ve<15;ve+=1)Me=!te&&(fe>>ve&1)==1,ve<8?_[8][S-ve-1]=Me:ve<9?_[8][15-ve-1+1]=Me:_[8][15-ve-1]=Me;_[S-8][8]=!te},Q=function(te,le){for(var ie=-1,fe=S-1,ve=7,Me=0,Ne=$.getMaskFunction(le),Te=S-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var Be=0;Be<2;Be+=1)if(_[fe][Te-Be]==null){var Ie=!1;Me>>ve&1)==1),Ne(fe,Te-Be)&&(Ie=!Ie),_[fe][Te-Be]=Ie,(ve-=1)==-1&&(Me+=1,ve=7)}if((fe+=ie)<0||S<=fe){fe-=ie,ie=-ie;break}}},R=function(te,le,ie){for(var fe=K.getRSBlocks(te,le),ve=J(),Me=0;Me8*Te)throw"code length overflow. ("+ve.getLengthInBits()+">"+8*Te+")";for(ve.getLengthInBits()+4<=8*Te&&ve.put(0,4);ve.getLengthInBits()%8!=0;)ve.putBit(!1);for(;!(ve.getLengthInBits()>=8*Te||(ve.put(236,8),ve.getLengthInBits()>=8*Te));)ve.put(17,8);return function(Be,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Ee=0;Ee=0?rt.getAt(Je):0}}var pt=0;for($e=0;$eIe)&&(Ne=Ie,Te=Be)}return Te}())},I.createTableTag=function(te,le){te=te||2;var ie="";ie+='";for(var ve=0;ve';ie+=""}return(ie+="")+"
"},I.createSvgTag=function(te,le,ie,fe){var ve={};typeof arguments[0]=="object"&&(te=(ve=arguments[0]).cellSize,le=ve.margin,ie=ve.alt,fe=ve.title),te=te||2,le=le===void 0?4*te:le,(ie=typeof ie=="string"?{text:ie}:ie||{}).text=ie.text||null,ie.id=ie.text?ie.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,Be,Ie=I.getModuleCount()*te+2*le,Le="";for(Be="l"+te+",0 0,"+te+" -"+te+",0 0,-"+te+"z ",Le+=''+Z(fe.text)+"":"",Le+=ie.text?''+Z(ie.text)+"":"",Le+='',Le+='"},I.createDataURL=function(te,le){te=te||2,le=le===void 0?4*te:le;var ie=I.getModuleCount()*te+2*le,fe=le,ve=ie-le;return m(ie,ie,function(Me,Ne){if(fe<=Me&&Me"};var Z=function(te){for(var le="",ie=0;ie":le+=">";break;case"&":le+="&";break;case'"':le+=""";break;default:le+=fe}}return le};return I.createASCII=function(te,le){if((te=te||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Ee,Qe,ct,$e,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[$e]:pt[$e];ft+=` -`}return et%2&&ze>0?ft.substring(0,ft.length-et-1)+Array(et+1).join("▀"):ft.substring(0,ft.length-1)}(le);te-=1,le=le===void 0?2*te:le;var ie,fe,ve,Me,Ne=I.getModuleCount()*te+2*le,Te=le,Be=Ne-le,Ie=Array(te+1).join("██"),Le=Array(te+1).join(" "),Ve="",ke="";for(ie=0;ie>>8),S.push(255&I)):S.push(x)}}return S}};var y,A,P,N,D,k={L:1,M:0,Q:3,H:2},$=(y=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],A=1335,P=7973,D=function(f){for(var p=0;f!=0;)p+=1,f>>>=1;return p},(N={}).getBCHTypeInfo=function(f){for(var p=f<<10;D(p)-D(A)>=0;)p^=A<=0;)p^=P<5&&(v+=3+S-5)}for(x=0;x=256;)x-=255;return f[x]}}}();function U(f,p){if(f.length===void 0)throw f.length+"/"+p;var v=function(){for(var _=0;_>>7-x%8&1)==1},put:function(x,_){for(var S=0;S<_;S+=1)v.putBit((x>>>_-S-1&1)==1)},getLengthInBits:function(){return p},putBit:function(x){var _=Math.floor(p/8);f.length<=_&&f.push(0),x&&(f[_]|=128>>>p%8),p+=1}};return v},T=function(f){var p=f,v={getMode:function(){return 1},getLength:function(S){return p.length},write:function(S){for(var b=p,M=0;M+2>>8&255)+(255&M),_.put(M,13),b+=2}if(b>>8)},writeBytes:function(v,x,_){x=x||0,_=_||v.length;for(var S=0;S<_;S+=1)p.writeByte(v[S+x])},writeString:function(v){for(var x=0;x0&&(v+=","),v+=f[x];return v+"]"}};return p},E=function(f){var p=f,v=0,x=0,_=0,S={read:function(){for(;_<8;){if(v>=p.length){if(_==0)return-1;throw"unexpected end of file./"+_}var M=p.charAt(v);if(v+=1,M=="=")return _=0,-1;M.match(/^\s$/)||(x=x<<6|b(M.charCodeAt(0)),_+=6)}var I=x>>>_-8&255;return _-=8,I}},b=function(M){if(65<=M&&M<=90)return M-65;if(97<=M&&M<=122)return M-97+26;if(48<=M&&M<=57)return M-48+52;if(M==43)return 62;if(M==47)return 63;throw"c:"+M};return S},m=function(f,p,v){for(var x=function(ae,O){var se=ae,ee=O,X=new Array(ae*O),Q={setPixel:function(te,le,ie){X[le*se+te]=ie},write:function(te){te.writeString("GIF87a"),te.writeShort(se),te.writeShort(ee),te.writeByte(128),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(255),te.writeByte(255),te.writeByte(255),te.writeString(","),te.writeShort(0),te.writeShort(0),te.writeShort(se),te.writeShort(ee),te.writeByte(0);var le=R(2);te.writeByte(2);for(var ie=0;le.length-ie>255;)te.writeByte(255),te.writeBytes(le,ie,255),ie+=255;te.writeByte(le.length-ie),te.writeBytes(le,ie,le.length-ie),te.writeByte(0),te.writeString(";")}},R=function(te){for(var le=1<>>Ee)throw"length over";for(;Te+Ee>=8;)Ne.writeByte(255&(He<>>=8-Te,Be=0,Te=0;Be|=He<0&&Ne.writeByte(Be)}});Le.write(le,fe);var Ve=0,ke=String.fromCharCode(X[Ve]);for(Ve+=1;Ve=6;)Q(ae>>>O-6),O-=6},X.flush=function(){if(O>0&&(Q(ae<<6-O),ae=0,O=0),se%3!=0)for(var Z=3-se%3,te=0;te>6,128|63&N):N<55296||N>=57344?A.push(224|N>>12,128|N>>6&63,128|63&N):(P++,N=65536+((1023&N)<<10|1023&y.charCodeAt(P)),A.push(240|N>>18,128|N>>12&63,128|N>>6&63,128|63&N))}return A}(g)},(l=typeof(u=function(){return d})=="function"?u.apply(a,[]):u)===void 0||(o.exports=l)}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var u=n[o]={exports:{}};return r[o](u,u.exports,i),u.exports}i.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return i.d(a,{a}),a},i.d=(o,a)=>{for(var u in a)i.o(a,u)&&!i.o(o,u)&&Object.defineProperty(o,u,{enumerable:!0,get:a[u]})},i.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a);var s={};return(()=>{i.d(s,{default:()=>G});const o=E=>!!E&&typeof E=="object"&&!Array.isArray(E);function a(E,...m){if(!m.length)return E;const f=m.shift();return f!==void 0&&o(E)&&o(f)?(E=Object.assign({},E),Object.keys(f).forEach(p=>{const v=E[p],x=f[p];Array.isArray(v)&&Array.isArray(x)?E[p]=x:o(v)&&o(x)?E[p]=a(Object.assign({},v),x):E[p]=x}),a(E,...m)):E}function u(E,m){const f=document.createElement("a");f.download=m,f.href=E,document.body.appendChild(f),f.click(),document.body.removeChild(f)}const l={L:.07,M:.15,Q:.25,H:.3};class d{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;switch(this._type){case"dots":x=this._drawDot;break;case"classy":x=this._drawClassy;break;case"classy-rounded":x=this._drawClassyRounded;break;case"rounded":x=this._drawRounded;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawSquare}x.call(this,{x:m,y:f,size:p,getNeighbor:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(p+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(p)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_basicSideRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, 0 ${-f}`)}}))}_basicCornerRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}v `+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_basicCornerExtraRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`)}}))}_basicCornersRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${f/2} ${f/2}h `+f/2+"v "+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_drawDot({x:m,y:f,size:p}){this._basicDot({x:m,y:f,size:p,rotation:0})}_drawSquare({x:m,y:f,size:p}){this._basicSquare({x:m,y:f,size:p,rotation:0})}_drawRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:p,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerRounded({x:m,y:f,size:p,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:p,rotation:I})}}else this._basicDot({x:m,y:f,size:p,rotation:0})}_drawExtraRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:p,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:p,rotation:I})}}else this._basicDot({x:m,y:f,size:p,rotation:0})}_drawClassy({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:p,rotation:0}):this._basicCornerRounded({x:m,y:f,size:p,rotation:Math.PI/2}):this._basicCornerRounded({x:m,y:f,size:p,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:p,rotation:Math.PI/2})}_drawClassyRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:p,rotation:0}):this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:p,rotation:Math.PI/2})}}class g{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;switch(this._type){case"square":x=this._drawSquare;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawDot}x.call(this,{x:m,y:f,size:p,rotation:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p+f/2} ${v}a ${f/2} ${f/2} 0 1 0 0.1 0zm 0 ${x}a ${f/2-x} ${f/2-x} 0 1 1 -0.1 0Z`)}}))}_basicSquare(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}v `+-f+`zM ${p+x} ${v+x}h `+(f-2*x)+"v "+(f-2*x)+"h "+(2*x-f)+"z")}}))}_basicExtraRounded(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p} ${v+2.5*x}v `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*x}h `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*-x}v `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*-x}h `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*x}M ${p+2.5*x} ${v+x}h `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*x}v `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*x}h `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*-x}v `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*-x}`)}}))}_drawDot({x:m,y:f,size:p,rotation:v}){this._basicDot({x:m,y:f,size:p,rotation:v})}_drawSquare({x:m,y:f,size:p,rotation:v}){this._basicSquare({x:m,y:f,size:p,rotation:v})}_drawExtraRounded({x:m,y:f,size:p,rotation:v}){this._basicExtraRounded({x:m,y:f,size:p,rotation:v})}}class y{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;x=this._type==="square"?this._drawSquare:this._drawDot,x.call(this,{x:m,y:f,size:p,rotation:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(p+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(p)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_drawDot({x:m,y:f,size:p,rotation:v}){this._basicDot({x:m,y:f,size:p,rotation:v})}_drawSquare({x:m,y:f,size:p,rotation:v}){this._basicSquare({x:m,y:f,size:p,rotation:v})}}const A="circle",P=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],N=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class D{constructor(m,f){this._roundSize=p=>this._options.dotsOptions.roundSize?Math.floor(p):p,this._window=f,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(m.width)),this._element.setAttribute("height",String(m.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),m.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=m.image,this._instanceId=D.instanceCount++,this._options=m}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(m){const f=m.getModuleCount(),p=Math.min(this._options.width,this._options.height)-2*this._options.margin,v=this._options.shape===A?p/Math.sqrt(2):p,x=this._roundSize(v/f);let _={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=m,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:S,qrOptions:b}=this._options,M=S.imageSize*l[b.errorCorrectionLevel],I=Math.floor(M*f*f);_=function({originalHeight:F,originalWidth:ae,maxHiddenDots:O,maxHiddenAxisDots:se,dotSize:ee}){const X={x:0,y:0},Q={x:0,y:0};if(F<=0||ae<=0||O<=0||ee<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const R=F/ae;return X.x=Math.floor(Math.sqrt(O/R)),X.x<=0&&(X.x=1),se&&seO||se&&se{var M,I,F,ae,O,se;return!(this._options.imageOptions.hideBackgroundDots&&S>=(f-_.hideYDots)/2&&S<(f+_.hideYDots)/2&&b>=(f-_.hideXDots)/2&&b<(f+_.hideXDots)/2||!((M=P[S])===null||M===void 0)&&M[b]||!((I=P[S-f+7])===null||I===void 0)&&I[b]||!((F=P[S])===null||F===void 0)&&F[b-f+7]||!((ae=N[S])===null||ae===void 0)&&ae[b]||!((O=N[S-f+7])===null||O===void 0)&&O[b]||!((se=N[S])===null||se===void 0)&&se[b-f+7])}),this.drawCorners(),this._options.image&&await this.drawImage({width:_.width,height:_.height,count:f,dotSize:x})}drawBackground(){var m,f,p;const v=this._element,x=this._options;if(v){const _=(m=x.backgroundOptions)===null||m===void 0?void 0:m.gradient,S=(f=x.backgroundOptions)===null||f===void 0?void 0:f.color;let b=x.height,M=x.width;if(_||S){const I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((p=x.backgroundOptions)===null||p===void 0)&&p.round&&(b=M=Math.min(x.width,x.height),I.setAttribute("rx",String(b/2*x.backgroundOptions.round))),I.setAttribute("x",String(this._roundSize((x.width-M)/2))),I.setAttribute("y",String(this._roundSize((x.height-b)/2))),I.setAttribute("width",String(M)),I.setAttribute("height",String(b)),this._backgroundClipPath.appendChild(I),this._createColor({options:_,color:S,additionalRotation:0,x:0,y:0,height:x.height,width:x.width,name:`background-color-${this._instanceId}`})}}}drawDots(m){var f,p;if(!this._qr)throw"QR code is not defined";const v=this._options,x=this._qr.getModuleCount();if(x>v.width||x>v.height)throw"The canvas is too small.";const _=Math.min(v.width,v.height)-2*v.margin,S=v.shape===A?_/Math.sqrt(2):_,b=this._roundSize(S/x),M=this._roundSize((v.width-x*b)/2),I=this._roundSize((v.height-x*b)/2),F=new d({svg:this._element,type:v.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(f=v.dotsOptions)===null||f===void 0?void 0:f.gradient,color:v.dotsOptions.color,additionalRotation:0,x:0,y:0,height:v.height,width:v.width,name:`dot-color-${this._instanceId}`});for(let ae=0;ae!(O+se<0||ae+ee<0||O+se>=x||ae+ee>=x)&&!(m&&!m(ae+ee,O+se))&&!!this._qr&&this._qr.isDark(ae+ee,O+se)),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element));if(v.shape===A){const ae=this._roundSize((_/b-x)/2),O=x+2*ae,se=M-ae*b,ee=I-ae*b,X=[],Q=this._roundSize(O/2);for(let R=0;R=ae-1&&R<=O-ae&&Z>=ae-1&&Z<=O-ae||Math.sqrt((R-Q)*(R-Q)+(Z-Q)*(Z-Q))>Q?X[R][Z]=0:X[R][Z]=this._qr.isDark(Z-2*ae<0?Z:Z>=x?Z-2*ae:Z-ae,R-2*ae<0?R:R>=x?R-2*ae:R-ae)?1:0}for(let R=0;R{var ie;return!!(!((ie=X[R+le])===null||ie===void 0)&&ie[Z+te])}),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const m=this._element,f=this._options;if(!m)throw"Element code is not defined";const p=this._qr.getModuleCount(),v=Math.min(f.width,f.height)-2*f.margin,x=f.shape===A?v/Math.sqrt(2):v,_=this._roundSize(x/p),S=7*_,b=3*_,M=this._roundSize((f.width-p*_)/2),I=this._roundSize((f.height-p*_)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([F,ae,O])=>{var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me;const Ne=M+F*_*(p-7),Te=I+ae*_*(p-7);let Be=this._dotsClipPath,Ie=this._dotsClipPath;if((!((se=f.cornersSquareOptions)===null||se===void 0)&&se.gradient||!((ee=f.cornersSquareOptions)===null||ee===void 0)&&ee.color)&&(Be=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Be.setAttribute("id",`clip-path-corners-square-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild(Be),this._cornersSquareClipPath=this._cornersDotClipPath=Ie=Be,this._createColor({options:(X=f.cornersSquareOptions)===null||X===void 0?void 0:X.gradient,color:(Q=f.cornersSquareOptions)===null||Q===void 0?void 0:Q.color,additionalRotation:O,x:Ne,y:Te,height:S,width:S,name:`corners-square-color-${F}-${ae}-${this._instanceId}`})),(R=f.cornersSquareOptions)===null||R===void 0?void 0:R.type){const Le=new g({svg:this._element,type:f.cornersSquareOptions.type,window:this._window});Le.draw(Ne,Te,S,O),Le._element&&Be&&Be.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=P[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&Be&&Be.appendChild(Le._element))}if((!((te=f.cornersDotOptions)===null||te===void 0)&&te.gradient||!((le=f.cornersDotOptions)===null||le===void 0)&&le.color)&&(Ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Ie.setAttribute("id",`clip-path-corners-dot-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild(Ie),this._cornersDotClipPath=Ie,this._createColor({options:(ie=f.cornersDotOptions)===null||ie===void 0?void 0:ie.gradient,color:(fe=f.cornersDotOptions)===null||fe===void 0?void 0:fe.color,additionalRotation:O,x:Ne+2*_,y:Te+2*_,height:b,width:b,name:`corners-dot-color-${F}-${ae}-${this._instanceId}`})),(ve=f.cornersDotOptions)===null||ve===void 0?void 0:ve.type){const Le=new y({svg:this._element,type:f.cornersDotOptions.type,window:this._window});Le.draw(Ne+2*_,Te+2*_,b,O),Le._element&&Ie&&Ie.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=N[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&Ie&&Ie.appendChild(Le._element))}})}loadImage(){return new Promise((m,f)=>{var p;const v=this._options;if(!v.image)return f("Image is not defined");if(!((p=v.nodeCanvas)===null||p===void 0)&&p.loadImage)v.nodeCanvas.loadImage(v.image).then(x=>{var _,S;if(this._image=x,this._options.imageOptions.saveAsBlob){const b=(_=v.nodeCanvas)===null||_===void 0?void 0:_.createCanvas(this._image.width,this._image.height);(S=b==null?void 0:b.getContext("2d"))===null||S===void 0||S.drawImage(x,0,0),this._imageUri=b==null?void 0:b.toDataURL()}m()}).catch(f);else{const x=new this._window.Image;typeof v.imageOptions.crossOrigin=="string"&&(x.crossOrigin=v.imageOptions.crossOrigin),this._image=x,x.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await async function(_,S){return new Promise(b=>{const M=new S.XMLHttpRequest;M.onload=function(){const I=new S.FileReader;I.onloadend=function(){b(I.result)},I.readAsDataURL(M.response)},M.open("GET",_),M.responseType="blob",M.send()})}(v.image||"",this._window)),m()},x.src=v.image}})}async drawImage({width:m,height:f,count:p,dotSize:v}){const x=this._options,_=this._roundSize((x.width-p*v)/2),S=this._roundSize((x.height-p*v)/2),b=_+this._roundSize(x.imageOptions.margin+(p*v-m)/2),M=S+this._roundSize(x.imageOptions.margin+(p*v-f)/2),I=m-2*x.imageOptions.margin,F=f-2*x.imageOptions.margin,ae=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");ae.setAttribute("href",this._imageUri||""),ae.setAttribute("x",String(b)),ae.setAttribute("y",String(M)),ae.setAttribute("width",`${I}px`),ae.setAttribute("height",`${F}px`),this._element.appendChild(ae)}_createColor({options:m,color:f,additionalRotation:p,x:v,y:x,height:_,width:S,name:b}){const M=S>_?S:_,I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(I.setAttribute("x",String(v)),I.setAttribute("y",String(x)),I.setAttribute("height",String(_)),I.setAttribute("width",String(S)),I.setAttribute("clip-path",`url('#clip-path-${b}')`),m){let F;if(m.type==="radial")F=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("fx",String(v+S/2)),F.setAttribute("fy",String(x+_/2)),F.setAttribute("cx",String(v+S/2)),F.setAttribute("cy",String(x+_/2)),F.setAttribute("r",String(M/2));else{const ae=((m.rotation||0)+p)%(2*Math.PI),O=(ae+2*Math.PI)%(2*Math.PI);let se=v+S/2,ee=x+_/2,X=v+S/2,Q=x+_/2;O>=0&&O<=.25*Math.PI||O>1.75*Math.PI&&O<=2*Math.PI?(se-=S/2,ee-=_/2*Math.tan(ae),X+=S/2,Q+=_/2*Math.tan(ae)):O>.25*Math.PI&&O<=.75*Math.PI?(ee-=_/2,se-=S/2/Math.tan(ae),Q+=_/2,X+=S/2/Math.tan(ae)):O>.75*Math.PI&&O<=1.25*Math.PI?(se+=S/2,ee+=_/2*Math.tan(ae),X-=S/2,Q-=_/2*Math.tan(ae)):O>1.25*Math.PI&&O<=1.75*Math.PI&&(ee+=_/2,se+=S/2/Math.tan(ae),Q-=_/2,X-=S/2/Math.tan(ae)),F=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("x1",String(Math.round(se))),F.setAttribute("y1",String(Math.round(ee))),F.setAttribute("x2",String(Math.round(X))),F.setAttribute("y2",String(Math.round(Q)))}m.colorStops.forEach(({offset:ae,color:O})=>{const se=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");se.setAttribute("offset",100*ae+"%"),se.setAttribute("stop-color",O),F.appendChild(se)}),I.setAttribute("fill",`url('#${b}')`),this._defs.appendChild(F)}else f&&I.setAttribute("fill",f);this._element.appendChild(I)}}D.instanceCount=0;const k=D,$="canvas",q={};for(let E=0;E<=40;E++)q[E]=E;const U={type:$,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:q[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function K(E){const m=Object.assign({},E);if(!m.colorStops||!m.colorStops.length)throw"Field 'colorStops' is required in gradient";return m.rotation?m.rotation=Number(m.rotation):m.rotation=0,m.colorStops=m.colorStops.map(f=>Object.assign(Object.assign({},f),{offset:Number(f.offset)})),m}function J(E){const m=Object.assign({},E);return m.width=Number(m.width),m.height=Number(m.height),m.margin=Number(m.margin),m.imageOptions=Object.assign(Object.assign({},m.imageOptions),{hideBackgroundDots:!!m.imageOptions.hideBackgroundDots,imageSize:Number(m.imageOptions.imageSize),margin:Number(m.imageOptions.margin)}),m.margin>Math.min(m.width,m.height)&&(m.margin=Math.min(m.width,m.height)),m.dotsOptions=Object.assign({},m.dotsOptions),m.dotsOptions.gradient&&(m.dotsOptions.gradient=K(m.dotsOptions.gradient)),m.cornersSquareOptions&&(m.cornersSquareOptions=Object.assign({},m.cornersSquareOptions),m.cornersSquareOptions.gradient&&(m.cornersSquareOptions.gradient=K(m.cornersSquareOptions.gradient))),m.cornersDotOptions&&(m.cornersDotOptions=Object.assign({},m.cornersDotOptions),m.cornersDotOptions.gradient&&(m.cornersDotOptions.gradient=K(m.cornersDotOptions.gradient))),m.backgroundOptions&&(m.backgroundOptions=Object.assign({},m.backgroundOptions),m.backgroundOptions.gradient&&(m.backgroundOptions.gradient=K(m.backgroundOptions.gradient))),m}var T=i(873),z=i.n(T);function ue(E){if(!E)throw new Error("Extension must be defined");E[0]==="."&&(E=E.substring(1));const m={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[E.toLowerCase()];if(!m)throw new Error(`Extension "${E}" is not supported`);return m}class _e{constructor(m){m!=null&&m.jsdom?this._window=new m.jsdom("",{resources:"usable"}).window:this._window=window,this._options=m?J(a(U,m)):U,this.update()}static _clearContainer(m){m&&(m.innerHTML="")}_setupSvg(){if(!this._qr)return;const m=new k(this._options,this._window);this._svg=m.getElement(),this._svgDrawingPromise=m.drawQR(this._qr).then(()=>{var f;this._svg&&((f=this._extension)===null||f===void 0||f.call(this,m.getElement(),this._options))})}_setupCanvas(){var m,f;this._qr&&(!((m=this._options.nodeCanvas)===null||m===void 0)&&m.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(f=this._svgDrawingPromise)===null||f===void 0?void 0:f.then(()=>{var p;if(!this._svg)return;const v=this._svg,x=new this._window.XMLSerializer().serializeToString(v),_=btoa(x),S=`data:${ue("svg")};base64,${_}`;if(!((p=this._options.nodeCanvas)===null||p===void 0)&&p.loadImage)return this._options.nodeCanvas.loadImage(S).then(b=>{var M,I;b.width=this._options.width,b.height=this._options.height,(I=(M=this._nodeCanvas)===null||M===void 0?void 0:M.getContext("2d"))===null||I===void 0||I.drawImage(b,0,0)});{const b=new this._window.Image;return new Promise(M=>{b.onload=()=>{var I,F;(F=(I=this._domCanvas)===null||I===void 0?void 0:I.getContext("2d"))===null||F===void 0||F.drawImage(b,0,0),M()},b.src=S})}}))}async _getElement(m="png"){if(!this._qr)throw"QR code is empty";return m.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(m){_e._clearContainer(this._container),this._options=m?J(a(this._options,m)):this._options,this._options.data&&(this._qr=z()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(f){switch(!0){case/^[0-9]*$/.test(f):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(f):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===$?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(m){if(m){if(typeof m.appendChild!="function")throw"Container should be a single DOM node";this._options.type===$?this._domCanvas&&m.appendChild(this._domCanvas):this._svg&&m.appendChild(this._svg),this._container=m}}applyExtension(m){if(!m)throw"Extension function should be defined.";this._extension=m,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(m="png"){if(!this._qr)throw"QR code is empty";const f=await this._getElement(m),p=ue(m);if(!f)return null;if(m.toLowerCase()==="svg"){const v=`\r +}`;const Mb=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>le.jsx(b7,{ref:n,containerClassName:no("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:no("disabled:xc-cursor-not-allowed",t),...r}));Mb.displayName="InputOTP";const Ib=Yt.forwardRef(({className:t,...e},r)=>le.jsx("div",{ref:r,className:no("xc-flex xc-items-center",t),...e}));Ib.displayName="InputOTPGroup";const Li=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(v7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return le.jsxs("div",{ref:n,className:no("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&le.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:le.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Li.displayName="InputOTPSlot";function y7(t){const{spinning:e,children:r,className:n}=t;return le.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&le.jsx("div",{className:no("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:le.jsx(ya,{className:"xc-animate-spin"})})]})}const w7=Se.createContext({channel:"",device:"WEB",app:"",inviterCode:""});function Cb(){return Se.useContext(w7)}function iZ(t){const{config:e}=t,[r,n]=Se.useState(e.channel),[i,s]=Se.useState(e.device),[o,a]=Se.useState(e.app),[u,l]=Se.useState(e.inviterCode);return Se.useEffect(()=>{n(e.channel),s(e.device),a(e.app),l(e.inviterCode)},[e]),le.jsx(w7.Provider,{value:{channel:r,device:i,app:o,inviterCode:u},children:t.children})}function sZ(t){const{email:e}=t,[r,n]=Se.useState(0),[i,s]=Se.useState(!1),[o,a]=Se.useState(!1),[u,l]=Se.useState(""),[d,g]=Se.useState(""),y=Cb();async function A(){n(60);const D=setInterval(()=>{n(k=>k===0?(clearInterval(D),0):k-1)},1e3)}async function P(D){a(!0);try{l(""),await No.getEmailCode({account_type:"email",email:D}),A()}catch(k){l(k.message)}a(!1)}Se.useEffect(()=>{e&&P(e)},[e]);async function O(D){if(g(""),!(D.length<6)){s(!0);try{const k=await No.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:D,email:e,inviter_code:y.inviterCode,source:{device:y.device,channel:y.channel,app:y.app}});t.onLogin(k.data)}catch(k){g(k.message)}s(!1)}}return le.jsxs(ro,{children:[le.jsx("div",{className:"xc-mb-12",children:le.jsx(Ac,{title:"Sign in with email",onBack:t.onBack})}),le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[le.jsx(h8,{className:"xc-mb-4",size:60}),le.jsx("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:u?le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{className:"xc-px-8",children:u})}):o?le.jsx(ya,{className:"xc-animate-spin"}):le.jsxs(le.Fragment,{children:[le.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),le.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]})}),le.jsx("div",{className:"xc-mb-2 xc-h-12",children:le.jsx(y7,{spinning:i,className:"xc-rounded-xl",children:le.jsx(Mb,{maxLength:6,onChange:O,disabled:i,className:"disabled:xc-opacity-20",children:le.jsx(Ib,{children:le.jsxs("div",{className:no("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[le.jsx(Li,{index:0}),le.jsx(Li,{index:1}),le.jsx(Li,{index:2}),le.jsx(Li,{index:3}),le.jsx(Li,{index:4}),le.jsx(Li,{index:5})]})})})})}),d&&le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{children:d})})]}),le.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Recend in ${r}s`:le.jsx("button",{onClick:()=>P(e),children:"Send again"})]})]})}var x7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var g=function(f,p){var v=f,x=k[p],_=null,S=0,b=null,M=[],I={},F=function(te,he){_=function(ie){for(var fe=new Array(ie),ve=0;ve=7&&ee(te),b==null&&(b=R(v,x,M)),Q(b,he)},ae=function(te,he){for(var ie=-1;ie<=7;ie+=1)if(!(te+ie<=-1||S<=te+ie))for(var fe=-1;fe<=7;fe+=1)he+fe<=-1||S<=he+fe||(_[te+ie][he+fe]=0<=ie&&ie<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(ie==0||ie==6)||2<=ie&&ie<=4&&2<=fe&&fe<=4)},N=function(){for(var te=8;te>ie&1)==1;_[Math.floor(ie/3)][ie%3+S-8-3]=fe}for(ie=0;ie<18;ie+=1)fe=!te&&(he>>ie&1)==1,_[ie%3+S-8-3][Math.floor(ie/3)]=fe},X=function(te,he){for(var ie=x<<3|he,fe=B.getBCHTypeInfo(ie),ve=0;ve<15;ve+=1){var Me=!te&&(fe>>ve&1)==1;ve<6?_[ve][8]=Me:ve<8?_[ve+1][8]=Me:_[S-15+ve][8]=Me}for(ve=0;ve<15;ve+=1)Me=!te&&(fe>>ve&1)==1,ve<8?_[8][S-ve-1]=Me:ve<9?_[8][15-ve-1+1]=Me:_[8][15-ve-1]=Me;_[S-8][8]=!te},Q=function(te,he){for(var ie=-1,fe=S-1,ve=7,Me=0,Ne=B.getMaskFunction(he),Te=S-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var $e=0;$e<2;$e+=1)if(_[fe][Te-$e]==null){var Ie=!1;Me>>ve&1)==1),Ne(fe,Te-$e)&&(Ie=!Ie),_[fe][Te-$e]=Ie,(ve-=1)==-1&&(Me+=1,ve=7)}if((fe+=ie)<0||S<=fe){fe-=ie,ie=-ie;break}}},R=function(te,he,ie){for(var fe=K.getRSBlocks(te,he),ve=J(),Me=0;Me8*Te)throw"code length overflow. ("+ve.getLengthInBits()+">"+8*Te+")";for(ve.getLengthInBits()+4<=8*Te&&ve.put(0,4);ve.getLengthInBits()%8!=0;)ve.putBit(!1);for(;!(ve.getLengthInBits()>=8*Te||(ve.put(236,8),ve.getLengthInBits()>=8*Te));)ve.put(17,8);return function($e,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Ee=0;Ee=0?rt.getAt(Je):0}}var pt=0;for(Be=0;BeIe)&&(Ne=Ie,Te=$e)}return Te}())},I.createTableTag=function(te,he){te=te||2;var ie="";ie+='";for(var ve=0;ve';ie+=""}return(ie+="")+"
"},I.createSvgTag=function(te,he,ie,fe){var ve={};typeof arguments[0]=="object"&&(te=(ve=arguments[0]).cellSize,he=ve.margin,ie=ve.alt,fe=ve.title),te=te||2,he=he===void 0?4*te:he,(ie=typeof ie=="string"?{text:ie}:ie||{}).text=ie.text||null,ie.id=ie.text?ie.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*te+2*he,Le="";for($e="l"+te+",0 0,"+te+" -"+te+",0 0,-"+te+"z ",Le+=''+Z(fe.text)+"":"",Le+=ie.text?''+Z(ie.text)+"":"",Le+='',Le+='"},I.createDataURL=function(te,he){te=te||2,he=he===void 0?4*te:he;var ie=I.getModuleCount()*te+2*he,fe=he,ve=ie-he;return m(ie,ie,function(Me,Ne){if(fe<=Me&&Me"};var Z=function(te){for(var he="",ie=0;ie":he+=">";break;case"&":he+="&";break;case'"':he+=""";break;default:he+=fe}}return he};return I.createASCII=function(te,he){if((te=te||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Ee,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:pt[Be];ft+=` +`}return et%2&&ze>0?ft.substring(0,ft.length-et-1)+Array(et+1).join("▀"):ft.substring(0,ft.length-1)}(he);te-=1,he=he===void 0?2*te:he;var ie,fe,ve,Me,Ne=I.getModuleCount()*te+2*he,Te=he,$e=Ne-he,Ie=Array(te+1).join("██"),Le=Array(te+1).join(" "),Ve="",ke="";for(ie=0;ie>>8),S.push(255&I)):S.push(x)}}return S}};var y,A,P,O,D,k={L:1,M:0,Q:3,H:2},B=(y=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],A=1335,P=7973,D=function(f){for(var p=0;f!=0;)p+=1,f>>>=1;return p},(O={}).getBCHTypeInfo=function(f){for(var p=f<<10;D(p)-D(A)>=0;)p^=A<=0;)p^=P<5&&(v+=3+S-5)}for(x=0;x=256;)x-=255;return f[x]}}}();function U(f,p){if(f.length===void 0)throw f.length+"/"+p;var v=function(){for(var _=0;_>>7-x%8&1)==1},put:function(x,_){for(var S=0;S<_;S+=1)v.putBit((x>>>_-S-1&1)==1)},getLengthInBits:function(){return p},putBit:function(x){var _=Math.floor(p/8);f.length<=_&&f.push(0),x&&(f[_]|=128>>>p%8),p+=1}};return v},T=function(f){var p=f,v={getMode:function(){return 1},getLength:function(S){return p.length},write:function(S){for(var b=p,M=0;M+2>>8&255)+(255&M),_.put(M,13),b+=2}if(b>>8)},writeBytes:function(v,x,_){x=x||0,_=_||v.length;for(var S=0;S<_;S+=1)p.writeByte(v[S+x])},writeString:function(v){for(var x=0;x0&&(v+=","),v+=f[x];return v+"]"}};return p},E=function(f){var p=f,v=0,x=0,_=0,S={read:function(){for(;_<8;){if(v>=p.length){if(_==0)return-1;throw"unexpected end of file./"+_}var M=p.charAt(v);if(v+=1,M=="=")return _=0,-1;M.match(/^\s$/)||(x=x<<6|b(M.charCodeAt(0)),_+=6)}var I=x>>>_-8&255;return _-=8,I}},b=function(M){if(65<=M&&M<=90)return M-65;if(97<=M&&M<=122)return M-97+26;if(48<=M&&M<=57)return M-48+52;if(M==43)return 62;if(M==47)return 63;throw"c:"+M};return S},m=function(f,p,v){for(var x=function(ae,N){var se=ae,ee=N,X=new Array(ae*N),Q={setPixel:function(te,he,ie){X[he*se+te]=ie},write:function(te){te.writeString("GIF87a"),te.writeShort(se),te.writeShort(ee),te.writeByte(128),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(255),te.writeByte(255),te.writeByte(255),te.writeString(","),te.writeShort(0),te.writeShort(0),te.writeShort(se),te.writeShort(ee),te.writeByte(0);var he=R(2);te.writeByte(2);for(var ie=0;he.length-ie>255;)te.writeByte(255),te.writeBytes(he,ie,255),ie+=255;te.writeByte(he.length-ie),te.writeBytes(he,ie,he.length-ie),te.writeByte(0),te.writeString(";")}},R=function(te){for(var he=1<>>Ee)throw"length over";for(;Te+Ee>=8;)Ne.writeByte(255&(He<>>=8-Te,$e=0,Te=0;$e|=He<0&&Ne.writeByte($e)}});Le.write(he,fe);var Ve=0,ke=String.fromCharCode(X[Ve]);for(Ve+=1;Ve=6;)Q(ae>>>N-6),N-=6},X.flush=function(){if(N>0&&(Q(ae<<6-N),ae=0,N=0),se%3!=0)for(var Z=3-se%3,te=0;te>6,128|63&O):O<55296||O>=57344?A.push(224|O>>12,128|O>>6&63,128|63&O):(P++,O=65536+((1023&O)<<10|1023&y.charCodeAt(P)),A.push(240|O>>18,128|O>>12&63,128|O>>6&63,128|63&O))}return A}(g)},(l=typeof(u=function(){return d})=="function"?u.apply(a,[]):u)===void 0||(o.exports=l)}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var u=n[o]={exports:{}};return r[o](u,u.exports,i),u.exports}i.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return i.d(a,{a}),a},i.d=(o,a)=>{for(var u in a)i.o(a,u)&&!i.o(o,u)&&Object.defineProperty(o,u,{enumerable:!0,get:a[u]})},i.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a);var s={};return(()=>{i.d(s,{default:()=>G});const o=E=>!!E&&typeof E=="object"&&!Array.isArray(E);function a(E,...m){if(!m.length)return E;const f=m.shift();return f!==void 0&&o(E)&&o(f)?(E=Object.assign({},E),Object.keys(f).forEach(p=>{const v=E[p],x=f[p];Array.isArray(v)&&Array.isArray(x)?E[p]=x:o(v)&&o(x)?E[p]=a(Object.assign({},v),x):E[p]=x}),a(E,...m)):E}function u(E,m){const f=document.createElement("a");f.download=m,f.href=E,document.body.appendChild(f),f.click(),document.body.removeChild(f)}const l={L:.07,M:.15,Q:.25,H:.3};class d{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;switch(this._type){case"dots":x=this._drawDot;break;case"classy":x=this._drawClassy;break;case"classy-rounded":x=this._drawClassyRounded;break;case"rounded":x=this._drawRounded;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawSquare}x.call(this,{x:m,y:f,size:p,getNeighbor:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(p+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(p)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_basicSideRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, 0 ${-f}`)}}))}_basicCornerRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}v `+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_basicCornerExtraRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`)}}))}_basicCornersRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${f/2} ${f/2}h `+f/2+"v "+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_drawDot({x:m,y:f,size:p}){this._basicDot({x:m,y:f,size:p,rotation:0})}_drawSquare({x:m,y:f,size:p}){this._basicSquare({x:m,y:f,size:p,rotation:0})}_drawRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:p,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerRounded({x:m,y:f,size:p,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:p,rotation:I})}}else this._basicDot({x:m,y:f,size:p,rotation:0})}_drawExtraRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:p,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:p,rotation:I})}}else this._basicDot({x:m,y:f,size:p,rotation:0})}_drawClassy({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:p,rotation:0}):this._basicCornerRounded({x:m,y:f,size:p,rotation:Math.PI/2}):this._basicCornerRounded({x:m,y:f,size:p,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:p,rotation:Math.PI/2})}_drawClassyRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:p,rotation:0}):this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:p,rotation:Math.PI/2})}}class g{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;switch(this._type){case"square":x=this._drawSquare;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawDot}x.call(this,{x:m,y:f,size:p,rotation:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p+f/2} ${v}a ${f/2} ${f/2} 0 1 0 0.1 0zm 0 ${x}a ${f/2-x} ${f/2-x} 0 1 1 -0.1 0Z`)}}))}_basicSquare(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}v `+-f+`zM ${p+x} ${v+x}h `+(f-2*x)+"v "+(f-2*x)+"h "+(2*x-f)+"z")}}))}_basicExtraRounded(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p} ${v+2.5*x}v `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*x}h `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*-x}v `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*-x}h `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*x}M ${p+2.5*x} ${v+x}h `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*x}v `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*x}h `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*-x}v `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*-x}`)}}))}_drawDot({x:m,y:f,size:p,rotation:v}){this._basicDot({x:m,y:f,size:p,rotation:v})}_drawSquare({x:m,y:f,size:p,rotation:v}){this._basicSquare({x:m,y:f,size:p,rotation:v})}_drawExtraRounded({x:m,y:f,size:p,rotation:v}){this._basicExtraRounded({x:m,y:f,size:p,rotation:v})}}class y{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;x=this._type==="square"?this._drawSquare:this._drawDot,x.call(this,{x:m,y:f,size:p,rotation:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(p+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(p)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_drawDot({x:m,y:f,size:p,rotation:v}){this._basicDot({x:m,y:f,size:p,rotation:v})}_drawSquare({x:m,y:f,size:p,rotation:v}){this._basicSquare({x:m,y:f,size:p,rotation:v})}}const A="circle",P=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],O=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class D{constructor(m,f){this._roundSize=p=>this._options.dotsOptions.roundSize?Math.floor(p):p,this._window=f,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(m.width)),this._element.setAttribute("height",String(m.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),m.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=m.image,this._instanceId=D.instanceCount++,this._options=m}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(m){const f=m.getModuleCount(),p=Math.min(this._options.width,this._options.height)-2*this._options.margin,v=this._options.shape===A?p/Math.sqrt(2):p,x=this._roundSize(v/f);let _={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=m,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:S,qrOptions:b}=this._options,M=S.imageSize*l[b.errorCorrectionLevel],I=Math.floor(M*f*f);_=function({originalHeight:F,originalWidth:ae,maxHiddenDots:N,maxHiddenAxisDots:se,dotSize:ee}){const X={x:0,y:0},Q={x:0,y:0};if(F<=0||ae<=0||N<=0||ee<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const R=F/ae;return X.x=Math.floor(Math.sqrt(N/R)),X.x<=0&&(X.x=1),se&&seN||se&&se{var M,I,F,ae,N,se;return!(this._options.imageOptions.hideBackgroundDots&&S>=(f-_.hideYDots)/2&&S<(f+_.hideYDots)/2&&b>=(f-_.hideXDots)/2&&b<(f+_.hideXDots)/2||!((M=P[S])===null||M===void 0)&&M[b]||!((I=P[S-f+7])===null||I===void 0)&&I[b]||!((F=P[S])===null||F===void 0)&&F[b-f+7]||!((ae=O[S])===null||ae===void 0)&&ae[b]||!((N=O[S-f+7])===null||N===void 0)&&N[b]||!((se=O[S])===null||se===void 0)&&se[b-f+7])}),this.drawCorners(),this._options.image&&await this.drawImage({width:_.width,height:_.height,count:f,dotSize:x})}drawBackground(){var m,f,p;const v=this._element,x=this._options;if(v){const _=(m=x.backgroundOptions)===null||m===void 0?void 0:m.gradient,S=(f=x.backgroundOptions)===null||f===void 0?void 0:f.color;let b=x.height,M=x.width;if(_||S){const I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((p=x.backgroundOptions)===null||p===void 0)&&p.round&&(b=M=Math.min(x.width,x.height),I.setAttribute("rx",String(b/2*x.backgroundOptions.round))),I.setAttribute("x",String(this._roundSize((x.width-M)/2))),I.setAttribute("y",String(this._roundSize((x.height-b)/2))),I.setAttribute("width",String(M)),I.setAttribute("height",String(b)),this._backgroundClipPath.appendChild(I),this._createColor({options:_,color:S,additionalRotation:0,x:0,y:0,height:x.height,width:x.width,name:`background-color-${this._instanceId}`})}}}drawDots(m){var f,p;if(!this._qr)throw"QR code is not defined";const v=this._options,x=this._qr.getModuleCount();if(x>v.width||x>v.height)throw"The canvas is too small.";const _=Math.min(v.width,v.height)-2*v.margin,S=v.shape===A?_/Math.sqrt(2):_,b=this._roundSize(S/x),M=this._roundSize((v.width-x*b)/2),I=this._roundSize((v.height-x*b)/2),F=new d({svg:this._element,type:v.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(f=v.dotsOptions)===null||f===void 0?void 0:f.gradient,color:v.dotsOptions.color,additionalRotation:0,x:0,y:0,height:v.height,width:v.width,name:`dot-color-${this._instanceId}`});for(let ae=0;ae!(N+se<0||ae+ee<0||N+se>=x||ae+ee>=x)&&!(m&&!m(ae+ee,N+se))&&!!this._qr&&this._qr.isDark(ae+ee,N+se)),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element));if(v.shape===A){const ae=this._roundSize((_/b-x)/2),N=x+2*ae,se=M-ae*b,ee=I-ae*b,X=[],Q=this._roundSize(N/2);for(let R=0;R=ae-1&&R<=N-ae&&Z>=ae-1&&Z<=N-ae||Math.sqrt((R-Q)*(R-Q)+(Z-Q)*(Z-Q))>Q?X[R][Z]=0:X[R][Z]=this._qr.isDark(Z-2*ae<0?Z:Z>=x?Z-2*ae:Z-ae,R-2*ae<0?R:R>=x?R-2*ae:R-ae)?1:0}for(let R=0;R{var ie;return!!(!((ie=X[R+he])===null||ie===void 0)&&ie[Z+te])}),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const m=this._element,f=this._options;if(!m)throw"Element code is not defined";const p=this._qr.getModuleCount(),v=Math.min(f.width,f.height)-2*f.margin,x=f.shape===A?v/Math.sqrt(2):v,_=this._roundSize(x/p),S=7*_,b=3*_,M=this._roundSize((f.width-p*_)/2),I=this._roundSize((f.height-p*_)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([F,ae,N])=>{var se,ee,X,Q,R,Z,te,he,ie,fe,ve,Me;const Ne=M+F*_*(p-7),Te=I+ae*_*(p-7);let $e=this._dotsClipPath,Ie=this._dotsClipPath;if((!((se=f.cornersSquareOptions)===null||se===void 0)&&se.gradient||!((ee=f.cornersSquareOptions)===null||ee===void 0)&&ee.color)&&($e=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),$e.setAttribute("id",`clip-path-corners-square-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild($e),this._cornersSquareClipPath=this._cornersDotClipPath=Ie=$e,this._createColor({options:(X=f.cornersSquareOptions)===null||X===void 0?void 0:X.gradient,color:(Q=f.cornersSquareOptions)===null||Q===void 0?void 0:Q.color,additionalRotation:N,x:Ne,y:Te,height:S,width:S,name:`corners-square-color-${F}-${ae}-${this._instanceId}`})),(R=f.cornersSquareOptions)===null||R===void 0?void 0:R.type){const Le=new g({svg:this._element,type:f.cornersSquareOptions.type,window:this._window});Le.draw(Ne,Te,S,N),Le._element&&$e&&$e.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=P[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&$e&&$e.appendChild(Le._element))}if((!((te=f.cornersDotOptions)===null||te===void 0)&&te.gradient||!((he=f.cornersDotOptions)===null||he===void 0)&&he.color)&&(Ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Ie.setAttribute("id",`clip-path-corners-dot-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild(Ie),this._cornersDotClipPath=Ie,this._createColor({options:(ie=f.cornersDotOptions)===null||ie===void 0?void 0:ie.gradient,color:(fe=f.cornersDotOptions)===null||fe===void 0?void 0:fe.color,additionalRotation:N,x:Ne+2*_,y:Te+2*_,height:b,width:b,name:`corners-dot-color-${F}-${ae}-${this._instanceId}`})),(ve=f.cornersDotOptions)===null||ve===void 0?void 0:ve.type){const Le=new y({svg:this._element,type:f.cornersDotOptions.type,window:this._window});Le.draw(Ne+2*_,Te+2*_,b,N),Le._element&&Ie&&Ie.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=O[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&Ie&&Ie.appendChild(Le._element))}})}loadImage(){return new Promise((m,f)=>{var p;const v=this._options;if(!v.image)return f("Image is not defined");if(!((p=v.nodeCanvas)===null||p===void 0)&&p.loadImage)v.nodeCanvas.loadImage(v.image).then(x=>{var _,S;if(this._image=x,this._options.imageOptions.saveAsBlob){const b=(_=v.nodeCanvas)===null||_===void 0?void 0:_.createCanvas(this._image.width,this._image.height);(S=b==null?void 0:b.getContext("2d"))===null||S===void 0||S.drawImage(x,0,0),this._imageUri=b==null?void 0:b.toDataURL()}m()}).catch(f);else{const x=new this._window.Image;typeof v.imageOptions.crossOrigin=="string"&&(x.crossOrigin=v.imageOptions.crossOrigin),this._image=x,x.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await async function(_,S){return new Promise(b=>{const M=new S.XMLHttpRequest;M.onload=function(){const I=new S.FileReader;I.onloadend=function(){b(I.result)},I.readAsDataURL(M.response)},M.open("GET",_),M.responseType="blob",M.send()})}(v.image||"",this._window)),m()},x.src=v.image}})}async drawImage({width:m,height:f,count:p,dotSize:v}){const x=this._options,_=this._roundSize((x.width-p*v)/2),S=this._roundSize((x.height-p*v)/2),b=_+this._roundSize(x.imageOptions.margin+(p*v-m)/2),M=S+this._roundSize(x.imageOptions.margin+(p*v-f)/2),I=m-2*x.imageOptions.margin,F=f-2*x.imageOptions.margin,ae=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");ae.setAttribute("href",this._imageUri||""),ae.setAttribute("x",String(b)),ae.setAttribute("y",String(M)),ae.setAttribute("width",`${I}px`),ae.setAttribute("height",`${F}px`),this._element.appendChild(ae)}_createColor({options:m,color:f,additionalRotation:p,x:v,y:x,height:_,width:S,name:b}){const M=S>_?S:_,I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(I.setAttribute("x",String(v)),I.setAttribute("y",String(x)),I.setAttribute("height",String(_)),I.setAttribute("width",String(S)),I.setAttribute("clip-path",`url('#clip-path-${b}')`),m){let F;if(m.type==="radial")F=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("fx",String(v+S/2)),F.setAttribute("fy",String(x+_/2)),F.setAttribute("cx",String(v+S/2)),F.setAttribute("cy",String(x+_/2)),F.setAttribute("r",String(M/2));else{const ae=((m.rotation||0)+p)%(2*Math.PI),N=(ae+2*Math.PI)%(2*Math.PI);let se=v+S/2,ee=x+_/2,X=v+S/2,Q=x+_/2;N>=0&&N<=.25*Math.PI||N>1.75*Math.PI&&N<=2*Math.PI?(se-=S/2,ee-=_/2*Math.tan(ae),X+=S/2,Q+=_/2*Math.tan(ae)):N>.25*Math.PI&&N<=.75*Math.PI?(ee-=_/2,se-=S/2/Math.tan(ae),Q+=_/2,X+=S/2/Math.tan(ae)):N>.75*Math.PI&&N<=1.25*Math.PI?(se+=S/2,ee+=_/2*Math.tan(ae),X-=S/2,Q-=_/2*Math.tan(ae)):N>1.25*Math.PI&&N<=1.75*Math.PI&&(ee+=_/2,se+=S/2/Math.tan(ae),Q-=_/2,X-=S/2/Math.tan(ae)),F=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("x1",String(Math.round(se))),F.setAttribute("y1",String(Math.round(ee))),F.setAttribute("x2",String(Math.round(X))),F.setAttribute("y2",String(Math.round(Q)))}m.colorStops.forEach(({offset:ae,color:N})=>{const se=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");se.setAttribute("offset",100*ae+"%"),se.setAttribute("stop-color",N),F.appendChild(se)}),I.setAttribute("fill",`url('#${b}')`),this._defs.appendChild(F)}else f&&I.setAttribute("fill",f);this._element.appendChild(I)}}D.instanceCount=0;const k=D,B="canvas",j={};for(let E=0;E<=40;E++)j[E]=E;const U={type:B,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:j[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function K(E){const m=Object.assign({},E);if(!m.colorStops||!m.colorStops.length)throw"Field 'colorStops' is required in gradient";return m.rotation?m.rotation=Number(m.rotation):m.rotation=0,m.colorStops=m.colorStops.map(f=>Object.assign(Object.assign({},f),{offset:Number(f.offset)})),m}function J(E){const m=Object.assign({},E);return m.width=Number(m.width),m.height=Number(m.height),m.margin=Number(m.margin),m.imageOptions=Object.assign(Object.assign({},m.imageOptions),{hideBackgroundDots:!!m.imageOptions.hideBackgroundDots,imageSize:Number(m.imageOptions.imageSize),margin:Number(m.imageOptions.margin)}),m.margin>Math.min(m.width,m.height)&&(m.margin=Math.min(m.width,m.height)),m.dotsOptions=Object.assign({},m.dotsOptions),m.dotsOptions.gradient&&(m.dotsOptions.gradient=K(m.dotsOptions.gradient)),m.cornersSquareOptions&&(m.cornersSquareOptions=Object.assign({},m.cornersSquareOptions),m.cornersSquareOptions.gradient&&(m.cornersSquareOptions.gradient=K(m.cornersSquareOptions.gradient))),m.cornersDotOptions&&(m.cornersDotOptions=Object.assign({},m.cornersDotOptions),m.cornersDotOptions.gradient&&(m.cornersDotOptions.gradient=K(m.cornersDotOptions.gradient))),m.backgroundOptions&&(m.backgroundOptions=Object.assign({},m.backgroundOptions),m.backgroundOptions.gradient&&(m.backgroundOptions.gradient=K(m.backgroundOptions.gradient))),m}var T=i(873),z=i.n(T);function ue(E){if(!E)throw new Error("Extension must be defined");E[0]==="."&&(E=E.substring(1));const m={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[E.toLowerCase()];if(!m)throw new Error(`Extension "${E}" is not supported`);return m}class _e{constructor(m){m!=null&&m.jsdom?this._window=new m.jsdom("",{resources:"usable"}).window:this._window=window,this._options=m?J(a(U,m)):U,this.update()}static _clearContainer(m){m&&(m.innerHTML="")}_setupSvg(){if(!this._qr)return;const m=new k(this._options,this._window);this._svg=m.getElement(),this._svgDrawingPromise=m.drawQR(this._qr).then(()=>{var f;this._svg&&((f=this._extension)===null||f===void 0||f.call(this,m.getElement(),this._options))})}_setupCanvas(){var m,f;this._qr&&(!((m=this._options.nodeCanvas)===null||m===void 0)&&m.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(f=this._svgDrawingPromise)===null||f===void 0?void 0:f.then(()=>{var p;if(!this._svg)return;const v=this._svg,x=new this._window.XMLSerializer().serializeToString(v),_=btoa(x),S=`data:${ue("svg")};base64,${_}`;if(!((p=this._options.nodeCanvas)===null||p===void 0)&&p.loadImage)return this._options.nodeCanvas.loadImage(S).then(b=>{var M,I;b.width=this._options.width,b.height=this._options.height,(I=(M=this._nodeCanvas)===null||M===void 0?void 0:M.getContext("2d"))===null||I===void 0||I.drawImage(b,0,0)});{const b=new this._window.Image;return new Promise(M=>{b.onload=()=>{var I,F;(F=(I=this._domCanvas)===null||I===void 0?void 0:I.getContext("2d"))===null||F===void 0||F.drawImage(b,0,0),M()},b.src=S})}}))}async _getElement(m="png"){if(!this._qr)throw"QR code is empty";return m.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(m){_e._clearContainer(this._container),this._options=m?J(a(this._options,m)):this._options,this._options.data&&(this._qr=z()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(f){switch(!0){case/^[0-9]*$/.test(f):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(f):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===B?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(m){if(m){if(typeof m.appendChild!="function")throw"Container should be a single DOM node";this._options.type===B?this._domCanvas&&m.appendChild(this._domCanvas):this._svg&&m.appendChild(this._svg),this._container=m}}applyExtension(m){if(!m)throw"Extension function should be defined.";this._extension=m,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(m="png"){if(!this._qr)throw"QR code is empty";const f=await this._getElement(m),p=ue(m);if(!f)return null;if(m.toLowerCase()==="svg"){const v=`\r ${new this._window.XMLSerializer().serializeToString(f)}`;return typeof Blob>"u"||this._options.jsdom?Buffer.from(v):new Blob([v],{type:p})}return new Promise(v=>{const x=f;if("toBuffer"in x)if(p==="image/png")v(x.toBuffer(p));else if(p==="image/jpeg")v(x.toBuffer(p));else{if(p!=="application/pdf")throw Error("Unsupported extension");v(x.toBuffer(p))}else"toBlob"in x&&x.toBlob(v,p,1)})}async download(m){if(!this._qr)throw"QR code is empty";if(typeof Blob>"u")throw"Cannot download in Node.js, call getRawData instead.";let f="png",p="qr";typeof m=="string"?(f=m,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):typeof m=="object"&&m!==null&&(m.name&&(p=m.name),m.extension&&(f=m.extension));const v=await this._getElement(f);if(v)if(f.toLowerCase()==="svg"){let x=new XMLSerializer().serializeToString(v);x=`\r -`+x,u(`data:${ue(f)};charset=utf-8,${encodeURIComponent(x)}`,`${p}.svg`)}else u(v.toDataURL(ue(f)),`${p}.${f}`)}}const G=_e})(),s.default})())})(b7);var QX=b7.exports;const y7=Ui(QX);class Sa extends yt{constructor(e){const{docsPath:r,field:n,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${n}".`,{docsPath:r,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}function w7(t){if(/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t)||/%[^0-9a-f]/i.test(t)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(t))return!1;const e=eZ(t),r=e[1],n=e[2],i=e[3],s=e[4],o=e[5];if(!(r!=null&&r.length&&i.length>=0))return!1;if(n!=null&&n.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9\+\-\.]*$/.test(r.toLowerCase()))return!1;let a="";return a+=`${r}:`,n!=null&&n.length&&(a+=`//${n}`),a+=i,s!=null&&s.length&&(a+=`?${s}`),o!=null&&o.length&&(a+=`#${o}`),a}function eZ(t){return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}function x7(t){const{chainId:e,domain:r,expirationTime:n,issuedAt:i=new Date,nonce:s,notBefore:o,requestId:a,resources:u,scheme:l,uri:d,version:g}=t;{if(e!==Math.floor(e))throw new Sa({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${e}`]});if(!(tZ.test(r)||rZ.test(r)||nZ.test(r)))throw new Sa({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${r}`]});if(!iZ.test(s))throw new Sa({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${s}`]});if(!w7(d))throw new Sa({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${d}`]});if(g!=="1")throw new Sa({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${g}`]});if(l&&!sZ.test(l))throw new Sa({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${l}`]});const k=t.statement;if(k!=null&&k.includes(` -`))throw new Sa({field:"statement",metaMessages:["- Statement must not include '\\n'.","",`Provided value: ${k}`]})}const y=og(t.address),A=l?`${l}://${r}`:r,P=t.statement?`${t.statement} -`:"",N=`${A} wants you to sign in with your Ethereum account: +`+x,u(`data:${ue(f)};charset=utf-8,${encodeURIComponent(x)}`,`${p}.svg`)}else u(v.toDataURL(ue(f)),`${p}.${f}`)}}const G=_e})(),s.default})())})(x7);var oZ=x7.exports;const _7=Ui(oZ);class Ma extends yt{constructor(e){const{docsPath:r,field:n,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${n}".`,{docsPath:r,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}function E7(t){if(/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t)||/%[^0-9a-f]/i.test(t)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(t))return!1;const e=aZ(t),r=e[1],n=e[2],i=e[3],s=e[4],o=e[5];if(!(r!=null&&r.length&&i.length>=0))return!1;if(n!=null&&n.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9\+\-\.]*$/.test(r.toLowerCase()))return!1;let a="";return a+=`${r}:`,n!=null&&n.length&&(a+=`//${n}`),a+=i,s!=null&&s.length&&(a+=`?${s}`),o!=null&&o.length&&(a+=`#${o}`),a}function aZ(t){return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}function S7(t){const{chainId:e,domain:r,expirationTime:n,issuedAt:i=new Date,nonce:s,notBefore:o,requestId:a,resources:u,scheme:l,uri:d,version:g}=t;{if(e!==Math.floor(e))throw new Ma({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${e}`]});if(!(cZ.test(r)||uZ.test(r)||fZ.test(r)))throw new Ma({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${r}`]});if(!lZ.test(s))throw new Ma({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${s}`]});if(!E7(d))throw new Ma({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${d}`]});if(g!=="1")throw new Ma({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${g}`]});if(l&&!hZ.test(l))throw new Ma({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${l}`]});const k=t.statement;if(k!=null&&k.includes(` +`))throw new Ma({field:"statement",metaMessages:["- Statement must not include '\\n'.","",`Provided value: ${k}`]})}const y=og(t.address),A=l?`${l}://${r}`:r,P=t.statement?`${t.statement} +`:"",O=`${A} wants you to sign in with your Ethereum account: ${y} ${P}`;let D=`URI: ${d} @@ -230,13 +230,13 @@ Issued At: ${i.toISOString()}`;if(n&&(D+=` Expiration Time: ${n.toISOString()}`),o&&(D+=` Not Before: ${o.toISOString()}`),a&&(D+=` Request ID: ${a}`),u){let k=` -Resources:`;for(const $ of u){if(!w7($))throw new Sa({field:"resources",metaMessages:["- Every resource must be a RFC 3986 URI.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${$}`]});k+=` -- ${$}`}D+=k}return`${N} -${D}`}const tZ=/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/,rZ=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/,nZ=/^localhost(:[0-9]{1,5})?$/,iZ=/^[a-zA-Z0-9]{8,}$/,sZ=/^([a-zA-Z][a-zA-Z0-9+-.]*)$/,_7="7a4434fefbcc9af474fb5c995e47d286",oZ={projectId:_7,metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},aZ={namespaces:{eip155:{methods:["eth_sendTransaction","eth_signTransaction","eth_sign","personal_sign","eth_signTypedData"],chains:["eip155:1"],events:["chainChanged","accountsChanged","disconnect"],rpcMap:{1:`https://rpc.walletconnect.com?chainId=eip155:1&projectId=${_7}`}}},skipPairing:!1};function cZ(t,e){const r=window.location.host,n=window.location.href;return x7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function uZ(t){var ue,_e,G;const e=Pe.useRef(null),{wallet:r,onGetExtension:n,onSignFinish:i}=t,[s,o]=Pe.useState(""),[a,u]=Pe.useState(!1),[l,d]=Pe.useState(""),[g,y]=Pe.useState("scan"),A=Pe.useRef(),[P,N]=Pe.useState((ue=r.config)==null?void 0:ue.image),[D,k]=Pe.useState(!1),{saveLastUsedWallet:$}=Wl();async function q(E){var f,p,v,x;u(!0);const m=await nz.init(oZ);m.session&&await m.disconnect();try{if(y("scan"),m.on("display_uri",ae=>{console.log("display_uri",ae),o(ae),u(!1),y("scan")}),m.on("error",ae=>{console.log(ae)}),m.on("session_update",ae=>{console.log("session_update",ae)}),!await m.connect(aZ))throw new Error("Walletconnect init failed");const S=new Hf(m);N(((f=S.config)==null?void 0:f.image)||((p=E.config)==null?void 0:p.image));const b=await S.getAddress(),M=await ma.getNonce({account_type:"block_chain"});console.log("get nonce",M);const I=cZ(b,M);y("sign");const F=await S.signMessage(I,b);y("waiting"),await i(S,{message:I,nonce:M,signature:F,address:b,wallet_name:((v=S.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),$(S)}catch(_){console.log("err",_),d(_.details||_.message)}}function U(){A.current=new y7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),A.current.append(e.current)}function K(E){var m;console.log(A.current),(m=A.current)==null||m.update({data:E})}Pe.useEffect(()=>{s&&K(s)},[s]),Pe.useEffect(()=>{q(r)},[r]),Pe.useEffect(()=>{U()},[]);function J(){d(""),K(""),q(r)}function T(){k(!0),navigator.clipboard.writeText(s),setTimeout(()=>{k(!1)},2500)}function z(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return me.jsxs("div",{children:[me.jsx("div",{className:"xc-text-center",children:me.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[me.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),me.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?me.jsx(mc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):me.jsx("img",{className:"xc-h-10 xc-w-10",src:P})})]})}),me.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[me.jsx("button",{disabled:!s,onClick:T,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:D?me.jsxs(me.Fragment,{children:[" ",me.jsx(SK,{})," Copied!"]}):me.jsxs(me.Fragment,{children:[me.jsx(MK,{}),"Copy QR URL"]})}),((_e=r.config)==null?void 0:_e.getWallet)&&me.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[me.jsx(AK,{}),"Get Extension"]}),((G=r.config)==null?void 0:G.desktop_link)&&me.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:z,children:[me.jsx(u8,{}),"Desktop"]})]}),me.jsx("div",{className:"xc-text-center",children:l?me.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[me.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),me.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:J,children:"Retry"})]}):me.jsxs(me.Fragment,{children:[g==="scan"&&me.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),g==="connect"&&me.jsx("p",{children:"Click connect in your wallet app"}),g==="sign"&&me.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),g==="waiting"&&me.jsx("div",{className:"xc-text-center",children:me.jsx(mc,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const fZ="Accept connection request in the wallet",lZ="Accept sign-in request in your wallet";function hZ(t,e){const r=window.location.host,n=window.location.href;return x7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function dZ(t){var g;const[e,r]=Pe.useState(),{wallet:n,onSignFinish:i}=t,s=Pe.useRef(),[o,a]=Pe.useState("connect"),{saveLastUsedWallet:u}=Wl();async function l(y){var A;try{a("connect");const P=await n.connect();if(!P||P.length===0)throw new Error("Wallet connect error");const N=og(P[0]),D=hZ(N,y);a("sign");const k=await n.signMessage(D,N);if(!k||k.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:N,signature:k,message:D,nonce:y,wallet_name:((A=n.config)==null?void 0:A.name)||""}),u(n)}catch(P){console.log(P.details),r(P.details||P.message)}}async function d(){try{r("");const y=await ma.getNonce({account_type:"block_chain"});s.current=y,l(s.current)}catch(y){console.log(y.details),r(y.message)}}return Pe.useEffect(()=>{d()},[]),me.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[me.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(g=n.config)==null?void 0:g.image,alt:""}),e&&me.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[me.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),me.jsx("div",{className:"xc-flex xc-gap-2",children:me.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:d,children:"Retry"})})]}),!e&&me.jsxs(me.Fragment,{children:[o==="connect"&&me.jsx("span",{className:"xc-text-center",children:fZ}),o==="sign"&&me.jsx("span",{className:"xc-text-center",children:lZ}),o==="waiting"&&me.jsx("span",{className:"xc-text-center",children:me.jsx(mc,{className:"xc-animate-spin"})})]})]})}const Ku="https://static.codatta.io/codatta-connect/wallet-icons.svg",pZ="https://itunes.apple.com/app/",gZ="https://play.google.com/store/apps/details?id=",mZ="https://chromewebstore.google.com/detail/",vZ="https://chromewebstore.google.com/detail/",bZ="https://addons.mozilla.org/en-US/firefox/addon/",yZ="https://microsoftedge.microsoft.com/addons/detail/";function Vu(t){const{icon:e,title:r,link:n}=t;return me.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[me.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,me.jsx(c8,{className:"xc-ml-auto xc-text-gray-400"})]})}function wZ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${pZ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${gZ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${mZ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${vZ}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${bZ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${yZ}${t.edge_addon_id}`),e}function xZ(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=wZ(r);return me.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[me.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),me.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),me.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),me.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&me.jsx(Vu,{link:n.chromeStoreLink,icon:`${Ku}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&me.jsx(Vu,{link:n.appStoreLink,icon:`${Ku}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&me.jsx(Vu,{link:n.playStoreLink,icon:`${Ku}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&me.jsx(Vu,{link:n.edgeStoreLink,icon:`${Ku}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&me.jsx(Vu,{link:n.braveStoreLink,icon:`${Ku}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&me.jsx(Vu,{link:n.firefoxStoreLink,icon:`${Ku}#firefox`,title:"Mozilla Firefox"})]})]})}function _Z(t){const{wallet:e}=t,[r,n]=Pe.useState(e.installed?"connect":"qr"),i=Mb();async function s(o,a){var l;const u=await ma.walletLogin({account_type:"block_chain",account_enum:"C",connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return me.jsxs(Ec,{children:[me.jsx("div",{className:"xc-mb-6",children:me.jsx(ah,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&me.jsx(uZ,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&me.jsx(dZ,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&me.jsx(xZ,{wallet:e})]})}function EZ(t){const{wallet:e,onClick:r}=t,n=me.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return me.jsx(Eb,{icon:n,title:i,onClick:()=>r(e)})}function SZ(t){const{connector:e}=t,[r,n]=Pe.useState(),[i,s]=Pe.useState([]),o=Pe.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d),console.log(d)}Pe.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return me.jsxs(Ec,{children:[me.jsx("div",{className:"xc-mb-6",children:me.jsx(ah,{title:"Select wallet",onBack:t.onBack})}),me.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[me.jsx(f8,{className:"xc-shrink-0 xc-opacity-50"}),me.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),me.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>me.jsx(EZ,{wallet:d,onClick:l},d.name))})]})}var E7={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,B[H+1]=V>>16&255,B[H+2]=V>>8&255,B[H+3]=V&255,B[H+4]=C>>24&255,B[H+5]=C>>16&255,B[H+6]=C>>8&255,B[H+7]=C&255}function N(B,H,V,C,Y){var j,oe=0;for(j=0;j>>8)-1}function D(B,H,V,C){return N(B,H,V,C,16)}function k(B,H,V,C){return N(B,H,V,C,32)}function $(B,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,j=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,je=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=j,ot=oe,wt=pe,lt=xe,at=Re,Se=De,Ae=it,Ge=je,Ue=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,Ue^=de<<7|de>>>25,de=Ue+at|0,Wt^=de<<9|de>>>23,de=Wt+Ue|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Se|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Se^=de<<13|de>>>19,de=Se+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Ae^=de<<9|de>>>23,de=Ae+wt|0,Xe^=de<<13|de>>>19,de=Xe+Ae|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Se^=de<<7|de>>>25,de=Se+at|0,Ae^=de<<9|de>>>23,de=Ae+Se|0,lt^=de<<13|de>>>19,de=lt+Ae|0,at^=de<<18|de>>>14,de=qe+Ue|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,Ue^=de<<13|de>>>19,de=Ue+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;dt=dt+Y|0,_t=_t+j|0,ot=ot+oe|0,wt=wt+pe|0,lt=lt+xe|0,at=at+Re|0,Se=Se+De|0,Ae=Ae+it|0,Ge=Ge+je|0,Ue=Ue+gt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,B[0]=dt>>>0&255,B[1]=dt>>>8&255,B[2]=dt>>>16&255,B[3]=dt>>>24&255,B[4]=_t>>>0&255,B[5]=_t>>>8&255,B[6]=_t>>>16&255,B[7]=_t>>>24&255,B[8]=ot>>>0&255,B[9]=ot>>>8&255,B[10]=ot>>>16&255,B[11]=ot>>>24&255,B[12]=wt>>>0&255,B[13]=wt>>>8&255,B[14]=wt>>>16&255,B[15]=wt>>>24&255,B[16]=lt>>>0&255,B[17]=lt>>>8&255,B[18]=lt>>>16&255,B[19]=lt>>>24&255,B[20]=at>>>0&255,B[21]=at>>>8&255,B[22]=at>>>16&255,B[23]=at>>>24&255,B[24]=Se>>>0&255,B[25]=Se>>>8&255,B[26]=Se>>>16&255,B[27]=Se>>>24&255,B[28]=Ae>>>0&255,B[29]=Ae>>>8&255,B[30]=Ae>>>16&255,B[31]=Ae>>>24&255,B[32]=Ge>>>0&255,B[33]=Ge>>>8&255,B[34]=Ge>>>16&255,B[35]=Ge>>>24&255,B[36]=Ue>>>0&255,B[37]=Ue>>>8&255,B[38]=Ue>>>16&255,B[39]=Ue>>>24&255,B[40]=qe>>>0&255,B[41]=qe>>>8&255,B[42]=qe>>>16&255,B[43]=qe>>>24&255,B[44]=Xe>>>0&255,B[45]=Xe>>>8&255,B[46]=Xe>>>16&255,B[47]=Xe>>>24&255,B[48]=kt>>>0&255,B[49]=kt>>>8&255,B[50]=kt>>>16&255,B[51]=kt>>>24&255,B[52]=Wt>>>0&255,B[53]=Wt>>>8&255,B[54]=Wt>>>16&255,B[55]=Wt>>>24&255,B[56]=Zt>>>0&255,B[57]=Zt>>>8&255,B[58]=Zt>>>16&255,B[59]=Zt>>>24&255,B[60]=Kt>>>0&255,B[61]=Kt>>>8&255,B[62]=Kt>>>16&255,B[63]=Kt>>>24&255}function q(B,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,j=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,je=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=j,ot=oe,wt=pe,lt=xe,at=Re,Se=De,Ae=it,Ge=je,Ue=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,Ue^=de<<7|de>>>25,de=Ue+at|0,Wt^=de<<9|de>>>23,de=Wt+Ue|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Se|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Se^=de<<13|de>>>19,de=Se+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Ae^=de<<9|de>>>23,de=Ae+wt|0,Xe^=de<<13|de>>>19,de=Xe+Ae|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Se^=de<<7|de>>>25,de=Se+at|0,Ae^=de<<9|de>>>23,de=Ae+Se|0,lt^=de<<13|de>>>19,de=lt+Ae|0,at^=de<<18|de>>>14,de=qe+Ue|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,Ue^=de<<13|de>>>19,de=Ue+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;B[0]=dt>>>0&255,B[1]=dt>>>8&255,B[2]=dt>>>16&255,B[3]=dt>>>24&255,B[4]=at>>>0&255,B[5]=at>>>8&255,B[6]=at>>>16&255,B[7]=at>>>24&255,B[8]=qe>>>0&255,B[9]=qe>>>8&255,B[10]=qe>>>16&255,B[11]=qe>>>24&255,B[12]=Kt>>>0&255,B[13]=Kt>>>8&255,B[14]=Kt>>>16&255,B[15]=Kt>>>24&255,B[16]=Se>>>0&255,B[17]=Se>>>8&255,B[18]=Se>>>16&255,B[19]=Se>>>24&255,B[20]=Ae>>>0&255,B[21]=Ae>>>8&255,B[22]=Ae>>>16&255,B[23]=Ae>>>24&255,B[24]=Ge>>>0&255,B[25]=Ge>>>8&255,B[26]=Ge>>>16&255,B[27]=Ge>>>24&255,B[28]=Ue>>>0&255,B[29]=Ue>>>8&255,B[30]=Ue>>>16&255,B[31]=Ue>>>24&255}function U(B,H,V,C){$(B,H,V,C)}function K(B,H,V,C){q(B,H,V,C)}var J=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T(B,H,V,C,Y,j,oe){var pe=new Uint8Array(16),xe=new Uint8Array(64),Re,De;for(De=0;De<16;De++)pe[De]=0;for(De=0;De<8;De++)pe[De]=j[De];for(;Y>=64;){for(U(xe,pe,oe,J),De=0;De<64;De++)B[H+De]=V[C+De]^xe[De];for(Re=1,De=8;De<16;De++)Re=Re+(pe[De]&255)|0,pe[De]=Re&255,Re>>>=8;Y-=64,H+=64,C+=64}if(Y>0)for(U(xe,pe,oe,J),De=0;De=64;){for(U(oe,j,Y,J),xe=0;xe<64;xe++)B[H+xe]=oe[xe];for(pe=1,xe=8;xe<16;xe++)pe=pe+(j[xe]&255)|0,j[xe]=pe&255,pe>>>=8;V-=64,H+=64}if(V>0)for(U(oe,j,Y,J),xe=0;xe>>13|V<<3)&8191,C=B[4]&255|(B[5]&255)<<8,this.r[2]=(V>>>10|C<<6)&7939,Y=B[6]&255|(B[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,j=B[8]&255|(B[9]&255)<<8,this.r[4]=(Y>>>4|j<<12)&255,this.r[5]=j>>>1&8190,oe=B[10]&255|(B[11]&255)<<8,this.r[6]=(j>>>14|oe<<2)&8191,pe=B[12]&255|(B[13]&255)<<8,this.r[7]=(oe>>>11|pe<<5)&8065,xe=B[14]&255|(B[15]&255)<<8,this.r[8]=(pe>>>8|xe<<8)&8191,this.r[9]=xe>>>5&127,this.pad[0]=B[16]&255|(B[17]&255)<<8,this.pad[1]=B[18]&255|(B[19]&255)<<8,this.pad[2]=B[20]&255|(B[21]&255)<<8,this.pad[3]=B[22]&255|(B[23]&255)<<8,this.pad[4]=B[24]&255|(B[25]&255)<<8,this.pad[5]=B[26]&255|(B[27]&255)<<8,this.pad[6]=B[28]&255|(B[29]&255)<<8,this.pad[7]=B[30]&255|(B[31]&255)<<8};G.prototype.blocks=function(B,H,V){for(var C=this.fin?0:2048,Y,j,oe,pe,xe,Re,De,it,je,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Se=this.h[3],Ae=this.h[4],Ge=this.h[5],Ue=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],de=this.r[3],nr=this.r[4],dr=this.r[5],pr=this.r[6],Qt=this.r[7],gr=this.r[8],lr=this.r[9];V>=16;)Y=B[H+0]&255|(B[H+1]&255)<<8,wt+=Y&8191,j=B[H+2]&255|(B[H+3]&255)<<8,lt+=(Y>>>13|j<<3)&8191,oe=B[H+4]&255|(B[H+5]&255)<<8,at+=(j>>>10|oe<<6)&8191,pe=B[H+6]&255|(B[H+7]&255)<<8,Se+=(oe>>>7|pe<<9)&8191,xe=B[H+8]&255|(B[H+9]&255)<<8,Ae+=(pe>>>4|xe<<12)&8191,Ge+=xe>>>1&8191,Re=B[H+10]&255|(B[H+11]&255)<<8,Ue+=(xe>>>14|Re<<2)&8191,De=B[H+12]&255|(B[H+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=B[H+14]&255|(B[H+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,je=0,gt=je,gt+=wt*Wt,gt+=lt*(5*lr),gt+=at*(5*gr),gt+=Se*(5*Qt),gt+=Ae*(5*pr),je=gt>>>13,gt&=8191,gt+=Ge*(5*dr),gt+=Ue*(5*nr),gt+=qe*(5*de),gt+=Xe*(5*Kt),gt+=kt*(5*Zt),je+=gt>>>13,gt&=8191,st=je,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Se*(5*gr),st+=Ae*(5*Qt),je=st>>>13,st&=8191,st+=Ge*(5*pr),st+=Ue*(5*dr),st+=qe*(5*nr),st+=Xe*(5*de),st+=kt*(5*Kt),je+=st>>>13,st&=8191,tt=je,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Se*(5*lr),tt+=Ae*(5*gr),je=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=Ue*(5*pr),tt+=qe*(5*dr),tt+=Xe*(5*nr),tt+=kt*(5*de),je+=tt>>>13,tt&=8191,At=je,At+=wt*de,At+=lt*Kt,At+=at*Zt,At+=Se*Wt,At+=Ae*(5*lr),je=At>>>13,At&=8191,At+=Ge*(5*gr),At+=Ue*(5*Qt),At+=qe*(5*pr),At+=Xe*(5*dr),At+=kt*(5*nr),je+=At>>>13,At&=8191,Rt=je,Rt+=wt*nr,Rt+=lt*de,Rt+=at*Kt,Rt+=Se*Zt,Rt+=Ae*Wt,je=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=Ue*(5*gr),Rt+=qe*(5*Qt),Rt+=Xe*(5*pr),Rt+=kt*(5*dr),je+=Rt>>>13,Rt&=8191,Mt=je,Mt+=wt*dr,Mt+=lt*nr,Mt+=at*de,Mt+=Se*Kt,Mt+=Ae*Zt,je=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=Ue*(5*lr),Mt+=qe*(5*gr),Mt+=Xe*(5*Qt),Mt+=kt*(5*pr),je+=Mt>>>13,Mt&=8191,Et=je,Et+=wt*pr,Et+=lt*dr,Et+=at*nr,Et+=Se*de,Et+=Ae*Kt,je=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=Ue*Wt,Et+=qe*(5*lr),Et+=Xe*(5*gr),Et+=kt*(5*Qt),je+=Et>>>13,Et&=8191,dt=je,dt+=wt*Qt,dt+=lt*pr,dt+=at*dr,dt+=Se*nr,dt+=Ae*de,je=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=Ue*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*gr),je+=dt>>>13,dt&=8191,_t=je,_t+=wt*gr,_t+=lt*Qt,_t+=at*pr,_t+=Se*dr,_t+=Ae*nr,je=_t>>>13,_t&=8191,_t+=Ge*de,_t+=Ue*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),je+=_t>>>13,_t&=8191,ot=je,ot+=wt*lr,ot+=lt*gr,ot+=at*Qt,ot+=Se*pr,ot+=Ae*dr,je=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=Ue*de,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,je+=ot>>>13,ot&=8191,je=(je<<2)+je|0,je=je+gt|0,gt=je&8191,je=je>>>13,st+=je,wt=gt,lt=st,at=tt,Se=At,Ae=Rt,Ge=Mt,Ue=Et,qe=dt,Xe=_t,kt=ot,H+=16,V-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Se,this.h[4]=Ae,this.h[5]=Ge,this.h[6]=Ue,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},G.prototype.finish=function(B,H){var V=new Uint16Array(10),C,Y,j,oe;if(this.leftover){for(oe=this.leftover,this.buffer[oe++]=1;oe<16;oe++)this.buffer[oe]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,oe=2;oe<10;oe++)this.h[oe]+=C,C=this.h[oe]>>>13,this.h[oe]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,V[0]=this.h[0]+5,C=V[0]>>>13,V[0]&=8191,oe=1;oe<10;oe++)V[oe]=this.h[oe]+C,C=V[oe]>>>13,V[oe]&=8191;for(V[9]-=8192,Y=(C^1)-1,oe=0;oe<10;oe++)V[oe]&=Y;for(Y=~Y,oe=0;oe<10;oe++)this.h[oe]=this.h[oe]&Y|V[oe];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,j=this.h[0]+this.pad[0],this.h[0]=j&65535,oe=1;oe<8;oe++)j=(this.h[oe]+this.pad[oe]|0)+(j>>>16)|0,this.h[oe]=j&65535;B[H+0]=this.h[0]>>>0&255,B[H+1]=this.h[0]>>>8&255,B[H+2]=this.h[1]>>>0&255,B[H+3]=this.h[1]>>>8&255,B[H+4]=this.h[2]>>>0&255,B[H+5]=this.h[2]>>>8&255,B[H+6]=this.h[3]>>>0&255,B[H+7]=this.h[3]>>>8&255,B[H+8]=this.h[4]>>>0&255,B[H+9]=this.h[4]>>>8&255,B[H+10]=this.h[5]>>>0&255,B[H+11]=this.h[5]>>>8&255,B[H+12]=this.h[6]>>>0&255,B[H+13]=this.h[6]>>>8&255,B[H+14]=this.h[7]>>>0&255,B[H+15]=this.h[7]>>>8&255},G.prototype.update=function(B,H,V){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>V&&(Y=V),C=0;C=16&&(Y=V-V%16,this.blocks(B,H,Y),H+=Y,V-=Y),V){for(C=0;C>16&1),j[V-1]&=65535;j[15]=oe[15]-32767-(j[14]>>16&1),Y=j[15]>>16&1,j[14]&=65535,_(oe,j,1-Y)}for(V=0;V<16;V++)B[2*V]=oe[V]&255,B[2*V+1]=oe[V]>>8}function b(B,H){var V=new Uint8Array(32),C=new Uint8Array(32);return S(V,B),S(C,H),k(V,0,C,0)}function M(B){var H=new Uint8Array(32);return S(H,B),H[0]&1}function I(B,H){var V;for(V=0;V<16;V++)B[V]=H[2*V]+(H[2*V+1]<<8);B[15]&=32767}function F(B,H,V){for(var C=0;C<16;C++)B[C]=H[C]+V[C]}function ae(B,H,V){for(var C=0;C<16;C++)B[C]=H[C]-V[C]}function O(B,H,V){var C,Y,j=0,oe=0,pe=0,xe=0,Re=0,De=0,it=0,je=0,gt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Se=0,Ae=0,Ge=0,Ue=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,de=V[0],nr=V[1],dr=V[2],pr=V[3],Qt=V[4],gr=V[5],lr=V[6],Lr=V[7],mr=V[8],wr=V[9],$r=V[10],Br=V[11],Ir=V[12],hn=V[13],dn=V[14],pn=V[15];C=H[0],j+=C*de,oe+=C*nr,pe+=C*dr,xe+=C*pr,Re+=C*Qt,De+=C*gr,it+=C*lr,je+=C*Lr,gt+=C*mr,st+=C*wr,tt+=C*$r,At+=C*Br,Rt+=C*Ir,Mt+=C*hn,Et+=C*dn,dt+=C*pn,C=H[1],oe+=C*de,pe+=C*nr,xe+=C*dr,Re+=C*pr,De+=C*Qt,it+=C*gr,je+=C*lr,gt+=C*Lr,st+=C*mr,tt+=C*wr,At+=C*$r,Rt+=C*Br,Mt+=C*Ir,Et+=C*hn,dt+=C*dn,_t+=C*pn,C=H[2],pe+=C*de,xe+=C*nr,Re+=C*dr,De+=C*pr,it+=C*Qt,je+=C*gr,gt+=C*lr,st+=C*Lr,tt+=C*mr,At+=C*wr,Rt+=C*$r,Mt+=C*Br,Et+=C*Ir,dt+=C*hn,_t+=C*dn,ot+=C*pn,C=H[3],xe+=C*de,Re+=C*nr,De+=C*dr,it+=C*pr,je+=C*Qt,gt+=C*gr,st+=C*lr,tt+=C*Lr,At+=C*mr,Rt+=C*wr,Mt+=C*$r,Et+=C*Br,dt+=C*Ir,_t+=C*hn,ot+=C*dn,wt+=C*pn,C=H[4],Re+=C*de,De+=C*nr,it+=C*dr,je+=C*pr,gt+=C*Qt,st+=C*gr,tt+=C*lr,At+=C*Lr,Rt+=C*mr,Mt+=C*wr,Et+=C*$r,dt+=C*Br,_t+=C*Ir,ot+=C*hn,wt+=C*dn,lt+=C*pn,C=H[5],De+=C*de,it+=C*nr,je+=C*dr,gt+=C*pr,st+=C*Qt,tt+=C*gr,At+=C*lr,Rt+=C*Lr,Mt+=C*mr,Et+=C*wr,dt+=C*$r,_t+=C*Br,ot+=C*Ir,wt+=C*hn,lt+=C*dn,at+=C*pn,C=H[6],it+=C*de,je+=C*nr,gt+=C*dr,st+=C*pr,tt+=C*Qt,At+=C*gr,Rt+=C*lr,Mt+=C*Lr,Et+=C*mr,dt+=C*wr,_t+=C*$r,ot+=C*Br,wt+=C*Ir,lt+=C*hn,at+=C*dn,Se+=C*pn,C=H[7],je+=C*de,gt+=C*nr,st+=C*dr,tt+=C*pr,At+=C*Qt,Rt+=C*gr,Mt+=C*lr,Et+=C*Lr,dt+=C*mr,_t+=C*wr,ot+=C*$r,wt+=C*Br,lt+=C*Ir,at+=C*hn,Se+=C*dn,Ae+=C*pn,C=H[8],gt+=C*de,st+=C*nr,tt+=C*dr,At+=C*pr,Rt+=C*Qt,Mt+=C*gr,Et+=C*lr,dt+=C*Lr,_t+=C*mr,ot+=C*wr,wt+=C*$r,lt+=C*Br,at+=C*Ir,Se+=C*hn,Ae+=C*dn,Ge+=C*pn,C=H[9],st+=C*de,tt+=C*nr,At+=C*dr,Rt+=C*pr,Mt+=C*Qt,Et+=C*gr,dt+=C*lr,_t+=C*Lr,ot+=C*mr,wt+=C*wr,lt+=C*$r,at+=C*Br,Se+=C*Ir,Ae+=C*hn,Ge+=C*dn,Ue+=C*pn,C=H[10],tt+=C*de,At+=C*nr,Rt+=C*dr,Mt+=C*pr,Et+=C*Qt,dt+=C*gr,_t+=C*lr,ot+=C*Lr,wt+=C*mr,lt+=C*wr,at+=C*$r,Se+=C*Br,Ae+=C*Ir,Ge+=C*hn,Ue+=C*dn,qe+=C*pn,C=H[11],At+=C*de,Rt+=C*nr,Mt+=C*dr,Et+=C*pr,dt+=C*Qt,_t+=C*gr,ot+=C*lr,wt+=C*Lr,lt+=C*mr,at+=C*wr,Se+=C*$r,Ae+=C*Br,Ge+=C*Ir,Ue+=C*hn,qe+=C*dn,Xe+=C*pn,C=H[12],Rt+=C*de,Mt+=C*nr,Et+=C*dr,dt+=C*pr,_t+=C*Qt,ot+=C*gr,wt+=C*lr,lt+=C*Lr,at+=C*mr,Se+=C*wr,Ae+=C*$r,Ge+=C*Br,Ue+=C*Ir,qe+=C*hn,Xe+=C*dn,kt+=C*pn,C=H[13],Mt+=C*de,Et+=C*nr,dt+=C*dr,_t+=C*pr,ot+=C*Qt,wt+=C*gr,lt+=C*lr,at+=C*Lr,Se+=C*mr,Ae+=C*wr,Ge+=C*$r,Ue+=C*Br,qe+=C*Ir,Xe+=C*hn,kt+=C*dn,Wt+=C*pn,C=H[14],Et+=C*de,dt+=C*nr,_t+=C*dr,ot+=C*pr,wt+=C*Qt,lt+=C*gr,at+=C*lr,Se+=C*Lr,Ae+=C*mr,Ge+=C*wr,Ue+=C*$r,qe+=C*Br,Xe+=C*Ir,kt+=C*hn,Wt+=C*dn,Zt+=C*pn,C=H[15],dt+=C*de,_t+=C*nr,ot+=C*dr,wt+=C*pr,lt+=C*Qt,at+=C*gr,Se+=C*lr,Ae+=C*Lr,Ge+=C*mr,Ue+=C*wr,qe+=C*$r,Xe+=C*Br,kt+=C*Ir,Wt+=C*hn,Zt+=C*dn,Kt+=C*pn,j+=38*_t,oe+=38*ot,pe+=38*wt,xe+=38*lt,Re+=38*at,De+=38*Se,it+=38*Ae,je+=38*Ge,gt+=38*Ue,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=j+Y+65535,Y=Math.floor(C/65536),j=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=je+Y+65535,Y=Math.floor(C/65536),je=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,j+=Y-1+37*(Y-1),Y=1,C=j+Y+65535,Y=Math.floor(C/65536),j=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=je+Y+65535,Y=Math.floor(C/65536),je=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,j+=Y-1+37*(Y-1),B[0]=j,B[1]=oe,B[2]=pe,B[3]=xe,B[4]=Re,B[5]=De,B[6]=it,B[7]=je,B[8]=gt,B[9]=st,B[10]=tt,B[11]=At,B[12]=Rt,B[13]=Mt,B[14]=Et,B[15]=dt}function se(B,H){O(B,H,H)}function ee(B,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=253;C>=0;C--)se(V,V),C!==2&&C!==4&&O(V,V,H);for(C=0;C<16;C++)B[C]=V[C]}function X(B,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=250;C>=0;C--)se(V,V),C!==1&&O(V,V,H);for(C=0;C<16;C++)B[C]=V[C]}function Q(B,H,V){var C=new Uint8Array(32),Y=new Float64Array(80),j,oe,pe=r(),xe=r(),Re=r(),De=r(),it=r(),je=r();for(oe=0;oe<31;oe++)C[oe]=H[oe];for(C[31]=H[31]&127|64,C[0]&=248,I(Y,V),oe=0;oe<16;oe++)xe[oe]=Y[oe],De[oe]=pe[oe]=Re[oe]=0;for(pe[0]=De[0]=1,oe=254;oe>=0;--oe)j=C[oe>>>3]>>>(oe&7)&1,_(pe,xe,j),_(Re,De,j),F(it,pe,Re),ae(pe,pe,Re),F(Re,xe,De),ae(xe,xe,De),se(De,it),se(je,pe),O(pe,Re,pe),O(Re,xe,it),F(it,pe,Re),ae(pe,pe,Re),se(xe,pe),ae(Re,De,je),O(pe,Re,u),F(pe,pe,De),O(Re,Re,pe),O(pe,De,je),O(De,xe,Y),se(xe,it),_(pe,xe,j),_(Re,De,j);for(oe=0;oe<16;oe++)Y[oe+16]=pe[oe],Y[oe+32]=Re[oe],Y[oe+48]=xe[oe],Y[oe+64]=De[oe];var gt=Y.subarray(32),st=Y.subarray(16);return ee(gt,gt),O(st,st,gt),S(B,st),0}function R(B,H){return Q(B,H,s)}function Z(B,H){return n(H,32),R(B,H)}function te(B,H,V){var C=new Uint8Array(32);return Q(C,V,H),K(B,i,C,J)}var le=f,ie=p;function fe(B,H,V,C,Y,j){var oe=new Uint8Array(32);return te(oe,Y,j),le(B,H,V,C,oe)}function ve(B,H,V,C,Y,j){var oe=new Uint8Array(32);return te(oe,Y,j),ie(B,H,V,C,oe)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne(B,H,V,C){for(var Y=new Int32Array(16),j=new Int32Array(16),oe,pe,xe,Re,De,it,je,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Se,Ae,Ge,Ue,qe,Xe,kt=B[0],Wt=B[1],Zt=B[2],Kt=B[3],de=B[4],nr=B[5],dr=B[6],pr=B[7],Qt=H[0],gr=H[1],lr=H[2],Lr=H[3],mr=H[4],wr=H[5],$r=H[6],Br=H[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=V[at+0]<<24|V[at+1]<<16|V[at+2]<<8|V[at+3],j[lt]=V[at+4]<<24|V[at+5]<<16|V[at+6]<<8|V[at+7];for(lt=0;lt<80;lt++)if(oe=kt,pe=Wt,xe=Zt,Re=Kt,De=de,it=nr,je=dr,gt=pr,st=Qt,tt=gr,At=lr,Rt=Lr,Mt=mr,Et=wr,dt=$r,_t=Br,Se=pr,Ae=Br,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=(de>>>14|mr<<18)^(de>>>18|mr<<14)^(mr>>>9|de<<23),Ae=(mr>>>14|de<<18)^(mr>>>18|de<<14)^(de>>>9|mr<<23),Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Se=de&nr^~de&dr,Ae=mr&wr^~mr&$r,Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Se=Me[lt*2],Ae=Me[lt*2+1],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Se=Y[lt%16],Ae=j[lt%16],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|Ue<<16,Se=ot,Ae=wt,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Ae=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Se=kt&Wt^kt&Zt^Wt&Zt,Ae=Qt&gr^Qt&lr^gr&lr,Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,gt=qe&65535|Xe<<16,_t=Ge&65535|Ue<<16,Se=Re,Ae=Rt,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=ot,Ae=wt,Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|Ue<<16,Wt=oe,Zt=pe,Kt=xe,de=Re,nr=De,dr=it,pr=je,kt=gt,gr=st,lr=tt,Lr=At,mr=Rt,wr=Mt,$r=Et,Br=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Se=Y[at],Ae=j[at],Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=Y[(at+9)%16],Ae=j[(at+9)%16],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,ot=Y[(at+1)%16],wt=j[(at+1)%16],Se=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Ae=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,ot=Y[(at+14)%16],wt=j[(at+14)%16],Se=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Ae=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,j[at]=Ge&65535|Ue<<16;Se=kt,Ae=Qt,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[0],Ae=H[0],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[0]=kt=qe&65535|Xe<<16,H[0]=Qt=Ge&65535|Ue<<16,Se=Wt,Ae=gr,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[1],Ae=H[1],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[1]=Wt=qe&65535|Xe<<16,H[1]=gr=Ge&65535|Ue<<16,Se=Zt,Ae=lr,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[2],Ae=H[2],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[2]=Zt=qe&65535|Xe<<16,H[2]=lr=Ge&65535|Ue<<16,Se=Kt,Ae=Lr,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[3],Ae=H[3],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[3]=Kt=qe&65535|Xe<<16,H[3]=Lr=Ge&65535|Ue<<16,Se=de,Ae=mr,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[4],Ae=H[4],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[4]=de=qe&65535|Xe<<16,H[4]=mr=Ge&65535|Ue<<16,Se=nr,Ae=wr,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[5],Ae=H[5],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[5]=nr=qe&65535|Xe<<16,H[5]=wr=Ge&65535|Ue<<16,Se=dr,Ae=$r,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[6],Ae=H[6],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[6]=dr=qe&65535|Xe<<16,H[6]=$r=Ge&65535|Ue<<16,Se=pr,Ae=Br,Ge=Ae&65535,Ue=Ae>>>16,qe=Se&65535,Xe=Se>>>16,Se=B[7],Ae=H[7],Ge+=Ae&65535,Ue+=Ae>>>16,qe+=Se&65535,Xe+=Se>>>16,Ue+=Ge>>>16,qe+=Ue>>>16,Xe+=qe>>>16,B[7]=pr=qe&65535|Xe<<16,H[7]=Br=Ge&65535|Ue<<16,Ir+=128,C-=128}return C}function Te(B,H,V){var C=new Int32Array(8),Y=new Int32Array(8),j=new Uint8Array(256),oe,pe=V;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,H,V),V%=128,oe=0;oe=0;--Y)C=V[Y/8|0]>>(Y&7)&1,Ie(B,H,C),Be(H,B),Be(B,B),Ie(B,H,C)}function ke(B,H){var V=[r(),r(),r(),r()];v(V[0],g),v(V[1],y),v(V[2],a),O(V[3],g,y),Ve(B,V,H)}function ze(B,H,V){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],j;for(V||n(H,32),Te(C,H,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le(B,Y),j=0;j<32;j++)H[j+32]=B[j];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Ee(B,H){var V,C,Y,j;for(C=63;C>=32;--C){for(V=0,Y=C-32,j=C-12;Y>4)*He[Y],V=H[Y]>>8,H[Y]&=255;for(Y=0;Y<32;Y++)H[Y]-=V*He[Y];for(C=0;C<32;C++)H[C+1]+=H[C]>>8,B[C]=H[C]&255}function Qe(B){var H=new Float64Array(64),V;for(V=0;V<64;V++)H[V]=B[V];for(V=0;V<64;V++)B[V]=0;Ee(B,H)}function ct(B,H,V,C){var Y=new Uint8Array(64),j=new Uint8Array(64),oe=new Uint8Array(64),pe,xe,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=V+64;for(pe=0;pe>7&&ae(B[0],o,B[0]),O(B[3],B[0],B[1]),0)}function et(B,H,V,C){var Y,j=new Uint8Array(32),oe=new Uint8Array(64),pe=[r(),r(),r(),r()],xe=[r(),r(),r(),r()];if(V<64||$e(xe,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var B=new Uint8Array(vt),H=new Uint8Array(Dt);return ze(B,H),{publicKey:B,secretKey:H}},e.sign.keyPair.fromSecretKey=function(B){if(nt(B),B.length!==Dt)throw new Error("bad secret key size");for(var H=new Uint8Array(vt),V=0;V=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function Ib(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function G0(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{console.log("display_uri",ae),o(ae),u(!1),y("scan")}),m.on("error",ae=>{console.log(ae)}),m.on("session_update",ae=>{console.log("session_update",ae)}),!await m.connect(pZ))throw new Error("Walletconnect init failed");const S=new Wf(m);O(((f=S.config)==null?void 0:f.image)||((p=E.config)==null?void 0:p.image));const b=await S.getAddress(),M=await No.getNonce({account_type:"block_chain"});console.log("get nonce",M);const I=gZ(b,M);y("sign");const F=await S.signMessage(I,b);y("waiting"),await i(S,{message:I,nonce:M,signature:F,address:b,wallet_name:((v=S.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),B(S)}catch(_){console.log("err",_),d(_.details||_.message)}}function U(){A.current=new _7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),A.current.append(e.current)}function K(E){var m;console.log(A.current),(m=A.current)==null||m.update({data:E})}Se.useEffect(()=>{s&&K(s)},[s]),Se.useEffect(()=>{j(r)},[r]),Se.useEffect(()=>{U()},[]);function J(){d(""),K(""),j(r)}function T(){k(!0),navigator.clipboard.writeText(s),setTimeout(()=>{k(!1)},2500)}function z(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return le.jsxs("div",{children:[le.jsx("div",{className:"xc-text-center",children:le.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[le.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),le.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?le.jsx(ya,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):le.jsx("img",{className:"xc-h-10 xc-w-10",src:P})})]})}),le.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[le.jsx("button",{disabled:!s,onClick:T,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:D?le.jsxs(le.Fragment,{children:[" ",le.jsx(NK,{})," Copied!"]}):le.jsxs(le.Fragment,{children:[le.jsx(BK,{}),"Copy QR URL"]})}),((_e=r.config)==null?void 0:_e.getWallet)&&le.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[le.jsx(LK,{}),"Get Extension"]}),((G=r.config)==null?void 0:G.desktop_link)&&le.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:z,children:[le.jsx(l8,{}),"Desktop"]})]}),le.jsx("div",{className:"xc-text-center",children:l?le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),le.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:J,children:"Retry"})]}):le.jsxs(le.Fragment,{children:[g==="scan"&&le.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),g==="connect"&&le.jsx("p",{children:"Click connect in your wallet app"}),g==="sign"&&le.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),g==="waiting"&&le.jsx("div",{className:"xc-text-center",children:le.jsx(ya,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const mZ="Accept connection request in the wallet",vZ="Accept sign-in request in your wallet";function bZ(t,e){const r=window.location.host,n=window.location.href;return S7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function M7(t){var g;const[e,r]=Se.useState(),{wallet:n,onSignFinish:i}=t,s=Se.useRef(),[o,a]=Se.useState("connect"),{saveLastUsedWallet:u}=Kl();async function l(y){var A;try{a("connect");const P=await n.connect();if(!P||P.length===0)throw new Error("Wallet connect error");const O=og(P[0]),D=bZ(O,y);a("sign");const k=await n.signMessage(D,O);if(!k||k.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:O,signature:k,message:D,nonce:y,wallet_name:((A=n.config)==null?void 0:A.name)||""}),u(n)}catch(P){console.log(P.details),r(P.details||P.message)}}async function d(){try{r("");const y=await No.getNonce({account_type:"block_chain"});s.current=y,l(s.current)}catch(y){console.log(y.details),r(y.message)}}return Se.useEffect(()=>{d()},[]),le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[le.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(g=n.config)==null?void 0:g.image,alt:""}),e&&le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),le.jsx("div",{className:"xc-flex xc-gap-2",children:le.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:d,children:"Retry"})})]}),!e&&le.jsxs(le.Fragment,{children:[o==="connect"&&le.jsx("span",{className:"xc-text-center",children:mZ}),o==="sign"&&le.jsx("span",{className:"xc-text-center",children:vZ}),o==="waiting"&&le.jsx("span",{className:"xc-text-center",children:le.jsx(ya,{className:"xc-animate-spin"})})]})]})}const Vu="https://static.codatta.io/codatta-connect/wallet-icons.svg",yZ="https://itunes.apple.com/app/",wZ="https://play.google.com/store/apps/details?id=",xZ="https://chromewebstore.google.com/detail/",_Z="https://chromewebstore.google.com/detail/",EZ="https://addons.mozilla.org/en-US/firefox/addon/",SZ="https://microsoftedge.microsoft.com/addons/detail/";function Gu(t){const{icon:e,title:r,link:n}=t;return le.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[le.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,le.jsx(f8,{className:"xc-ml-auto xc-text-gray-400"})]})}function AZ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${yZ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${wZ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${xZ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${_Z}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${EZ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${SZ}${t.edge_addon_id}`),e}function I7(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=AZ(r);return le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),le.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),le.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),le.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&le.jsx(Gu,{link:n.chromeStoreLink,icon:`${Vu}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&le.jsx(Gu,{link:n.appStoreLink,icon:`${Vu}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&le.jsx(Gu,{link:n.playStoreLink,icon:`${Vu}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&le.jsx(Gu,{link:n.edgeStoreLink,icon:`${Vu}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&le.jsx(Gu,{link:n.braveStoreLink,icon:`${Vu}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&le.jsx(Gu,{link:n.firefoxStoreLink,icon:`${Vu}#firefox`,title:"Mozilla Firefox"})]})]})}function PZ(t){const{wallet:e}=t,[r,n]=Se.useState(e.installed?"connect":"qr"),i=Cb();async function s(o,a){var l;const u=await No.walletLogin({account_type:"block_chain",account_enum:"C",connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return le.jsxs(ro,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Ac,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&le.jsx(P7,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&le.jsx(M7,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&le.jsx(I7,{wallet:e})]})}function MZ(t){const{wallet:e,onClick:r}=t,n=le.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return le.jsx(Eb,{icon:n,title:i,onClick:()=>r(e)})}function C7(t){const{connector:e}=t,[r,n]=Se.useState(),[i,s]=Se.useState([]),o=Se.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d),console.log(d)}Se.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return le.jsxs(ro,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Ac,{title:"Select wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[le.jsx(d8,{className:"xc-shrink-0 xc-opacity-50"}),le.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),le.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>le.jsx(MZ,{wallet:d,onClick:l},d.name))})]})}var T7={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,$[H+1]=V>>16&255,$[H+2]=V>>8&255,$[H+3]=V&255,$[H+4]=C>>24&255,$[H+5]=C>>16&255,$[H+6]=C>>8&255,$[H+7]=C&255}function O($,H,V,C,Y){var q,oe=0;for(q=0;q>>8)-1}function D($,H,V,C){return O($,H,V,C,16)}function k($,H,V,C){return O($,H,V,C,32)}function B($,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,ge=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,Ue=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=oe,wt=ge,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,pe,nr=0;nr<20;nr+=2)pe=dt+kt|0,lt^=pe<<7|pe>>>25,pe=lt+dt|0,Ge^=pe<<9|pe>>>23,pe=Ge+lt|0,kt^=pe<<13|pe>>>19,pe=kt+Ge|0,dt^=pe<<18|pe>>>14,pe=at+_t|0,je^=pe<<7|pe>>>25,pe=je+at|0,Wt^=pe<<9|pe>>>23,pe=Wt+je|0,_t^=pe<<13|pe>>>19,pe=_t+Wt|0,at^=pe<<18|pe>>>14,pe=qe+Ae|0,Zt^=pe<<7|pe>>>25,pe=Zt+qe|0,ot^=pe<<9|pe>>>23,pe=ot+Zt|0,Ae^=pe<<13|pe>>>19,pe=Ae+ot|0,qe^=pe<<18|pe>>>14,pe=Kt+Xe|0,wt^=pe<<7|pe>>>25,pe=wt+Kt|0,Pe^=pe<<9|pe>>>23,pe=Pe+wt|0,Xe^=pe<<13|pe>>>19,pe=Xe+Pe|0,Kt^=pe<<18|pe>>>14,pe=dt+wt|0,_t^=pe<<7|pe>>>25,pe=_t+dt|0,ot^=pe<<9|pe>>>23,pe=ot+_t|0,wt^=pe<<13|pe>>>19,pe=wt+ot|0,dt^=pe<<18|pe>>>14,pe=at+lt|0,Ae^=pe<<7|pe>>>25,pe=Ae+at|0,Pe^=pe<<9|pe>>>23,pe=Pe+Ae|0,lt^=pe<<13|pe>>>19,pe=lt+Pe|0,at^=pe<<18|pe>>>14,pe=qe+je|0,Xe^=pe<<7|pe>>>25,pe=Xe+qe|0,Ge^=pe<<9|pe>>>23,pe=Ge+Xe|0,je^=pe<<13|pe>>>19,pe=je+Ge|0,qe^=pe<<18|pe>>>14,pe=Kt+Zt|0,kt^=pe<<7|pe>>>25,pe=kt+Kt|0,Wt^=pe<<9|pe>>>23,pe=Wt+kt|0,Zt^=pe<<13|pe>>>19,pe=Zt+Wt|0,Kt^=pe<<18|pe>>>14;dt=dt+Y|0,_t=_t+q|0,ot=ot+oe|0,wt=wt+ge|0,lt=lt+xe|0,at=at+Re|0,Ae=Ae+De|0,Pe=Pe+it|0,Ge=Ge+Ue|0,je=je+gt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=_t>>>0&255,$[5]=_t>>>8&255,$[6]=_t>>>16&255,$[7]=_t>>>24&255,$[8]=ot>>>0&255,$[9]=ot>>>8&255,$[10]=ot>>>16&255,$[11]=ot>>>24&255,$[12]=wt>>>0&255,$[13]=wt>>>8&255,$[14]=wt>>>16&255,$[15]=wt>>>24&255,$[16]=lt>>>0&255,$[17]=lt>>>8&255,$[18]=lt>>>16&255,$[19]=lt>>>24&255,$[20]=at>>>0&255,$[21]=at>>>8&255,$[22]=at>>>16&255,$[23]=at>>>24&255,$[24]=Ae>>>0&255,$[25]=Ae>>>8&255,$[26]=Ae>>>16&255,$[27]=Ae>>>24&255,$[28]=Pe>>>0&255,$[29]=Pe>>>8&255,$[30]=Pe>>>16&255,$[31]=Pe>>>24&255,$[32]=Ge>>>0&255,$[33]=Ge>>>8&255,$[34]=Ge>>>16&255,$[35]=Ge>>>24&255,$[36]=je>>>0&255,$[37]=je>>>8&255,$[38]=je>>>16&255,$[39]=je>>>24&255,$[40]=qe>>>0&255,$[41]=qe>>>8&255,$[42]=qe>>>16&255,$[43]=qe>>>24&255,$[44]=Xe>>>0&255,$[45]=Xe>>>8&255,$[46]=Xe>>>16&255,$[47]=Xe>>>24&255,$[48]=kt>>>0&255,$[49]=kt>>>8&255,$[50]=kt>>>16&255,$[51]=kt>>>24&255,$[52]=Wt>>>0&255,$[53]=Wt>>>8&255,$[54]=Wt>>>16&255,$[55]=Wt>>>24&255,$[56]=Zt>>>0&255,$[57]=Zt>>>8&255,$[58]=Zt>>>16&255,$[59]=Zt>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255}function j($,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,ge=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,Ue=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=oe,wt=ge,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,pe,nr=0;nr<20;nr+=2)pe=dt+kt|0,lt^=pe<<7|pe>>>25,pe=lt+dt|0,Ge^=pe<<9|pe>>>23,pe=Ge+lt|0,kt^=pe<<13|pe>>>19,pe=kt+Ge|0,dt^=pe<<18|pe>>>14,pe=at+_t|0,je^=pe<<7|pe>>>25,pe=je+at|0,Wt^=pe<<9|pe>>>23,pe=Wt+je|0,_t^=pe<<13|pe>>>19,pe=_t+Wt|0,at^=pe<<18|pe>>>14,pe=qe+Ae|0,Zt^=pe<<7|pe>>>25,pe=Zt+qe|0,ot^=pe<<9|pe>>>23,pe=ot+Zt|0,Ae^=pe<<13|pe>>>19,pe=Ae+ot|0,qe^=pe<<18|pe>>>14,pe=Kt+Xe|0,wt^=pe<<7|pe>>>25,pe=wt+Kt|0,Pe^=pe<<9|pe>>>23,pe=Pe+wt|0,Xe^=pe<<13|pe>>>19,pe=Xe+Pe|0,Kt^=pe<<18|pe>>>14,pe=dt+wt|0,_t^=pe<<7|pe>>>25,pe=_t+dt|0,ot^=pe<<9|pe>>>23,pe=ot+_t|0,wt^=pe<<13|pe>>>19,pe=wt+ot|0,dt^=pe<<18|pe>>>14,pe=at+lt|0,Ae^=pe<<7|pe>>>25,pe=Ae+at|0,Pe^=pe<<9|pe>>>23,pe=Pe+Ae|0,lt^=pe<<13|pe>>>19,pe=lt+Pe|0,at^=pe<<18|pe>>>14,pe=qe+je|0,Xe^=pe<<7|pe>>>25,pe=Xe+qe|0,Ge^=pe<<9|pe>>>23,pe=Ge+Xe|0,je^=pe<<13|pe>>>19,pe=je+Ge|0,qe^=pe<<18|pe>>>14,pe=Kt+Zt|0,kt^=pe<<7|pe>>>25,pe=kt+Kt|0,Wt^=pe<<9|pe>>>23,pe=Wt+kt|0,Zt^=pe<<13|pe>>>19,pe=Zt+Wt|0,Kt^=pe<<18|pe>>>14;$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=at>>>0&255,$[5]=at>>>8&255,$[6]=at>>>16&255,$[7]=at>>>24&255,$[8]=qe>>>0&255,$[9]=qe>>>8&255,$[10]=qe>>>16&255,$[11]=qe>>>24&255,$[12]=Kt>>>0&255,$[13]=Kt>>>8&255,$[14]=Kt>>>16&255,$[15]=Kt>>>24&255,$[16]=Ae>>>0&255,$[17]=Ae>>>8&255,$[18]=Ae>>>16&255,$[19]=Ae>>>24&255,$[20]=Pe>>>0&255,$[21]=Pe>>>8&255,$[22]=Pe>>>16&255,$[23]=Pe>>>24&255,$[24]=Ge>>>0&255,$[25]=Ge>>>8&255,$[26]=Ge>>>16&255,$[27]=Ge>>>24&255,$[28]=je>>>0&255,$[29]=je>>>8&255,$[30]=je>>>16&255,$[31]=je>>>24&255}function U($,H,V,C){B($,H,V,C)}function K($,H,V,C){j($,H,V,C)}var J=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T($,H,V,C,Y,q,oe){var ge=new Uint8Array(16),xe=new Uint8Array(64),Re,De;for(De=0;De<16;De++)ge[De]=0;for(De=0;De<8;De++)ge[De]=q[De];for(;Y>=64;){for(U(xe,ge,oe,J),De=0;De<64;De++)$[H+De]=V[C+De]^xe[De];for(Re=1,De=8;De<16;De++)Re=Re+(ge[De]&255)|0,ge[De]=Re&255,Re>>>=8;Y-=64,H+=64,C+=64}if(Y>0)for(U(xe,ge,oe,J),De=0;De=64;){for(U(oe,q,Y,J),xe=0;xe<64;xe++)$[H+xe]=oe[xe];for(ge=1,xe=8;xe<16;xe++)ge=ge+(q[xe]&255)|0,q[xe]=ge&255,ge>>>=8;V-=64,H+=64}if(V>0)for(U(oe,q,Y,J),xe=0;xe>>13|V<<3)&8191,C=$[4]&255|($[5]&255)<<8,this.r[2]=(V>>>10|C<<6)&7939,Y=$[6]&255|($[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,q=$[8]&255|($[9]&255)<<8,this.r[4]=(Y>>>4|q<<12)&255,this.r[5]=q>>>1&8190,oe=$[10]&255|($[11]&255)<<8,this.r[6]=(q>>>14|oe<<2)&8191,ge=$[12]&255|($[13]&255)<<8,this.r[7]=(oe>>>11|ge<<5)&8065,xe=$[14]&255|($[15]&255)<<8,this.r[8]=(ge>>>8|xe<<8)&8191,this.r[9]=xe>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};G.prototype.blocks=function($,H,V){for(var C=this.fin?0:2048,Y,q,oe,ge,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Ae=this.h[3],Pe=this.h[4],Ge=this.h[5],je=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],pe=this.r[3],nr=this.r[4],dr=this.r[5],pr=this.r[6],Qt=this.r[7],gr=this.r[8],lr=this.r[9];V>=16;)Y=$[H+0]&255|($[H+1]&255)<<8,wt+=Y&8191,q=$[H+2]&255|($[H+3]&255)<<8,lt+=(Y>>>13|q<<3)&8191,oe=$[H+4]&255|($[H+5]&255)<<8,at+=(q>>>10|oe<<6)&8191,ge=$[H+6]&255|($[H+7]&255)<<8,Ae+=(oe>>>7|ge<<9)&8191,xe=$[H+8]&255|($[H+9]&255)<<8,Pe+=(ge>>>4|xe<<12)&8191,Ge+=xe>>>1&8191,Re=$[H+10]&255|($[H+11]&255)<<8,je+=(xe>>>14|Re<<2)&8191,De=$[H+12]&255|($[H+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=$[H+14]&255|($[H+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,Ue=0,gt=Ue,gt+=wt*Wt,gt+=lt*(5*lr),gt+=at*(5*gr),gt+=Ae*(5*Qt),gt+=Pe*(5*pr),Ue=gt>>>13,gt&=8191,gt+=Ge*(5*dr),gt+=je*(5*nr),gt+=qe*(5*pe),gt+=Xe*(5*Kt),gt+=kt*(5*Zt),Ue+=gt>>>13,gt&=8191,st=Ue,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Ae*(5*gr),st+=Pe*(5*Qt),Ue=st>>>13,st&=8191,st+=Ge*(5*pr),st+=je*(5*dr),st+=qe*(5*nr),st+=Xe*(5*pe),st+=kt*(5*Kt),Ue+=st>>>13,st&=8191,tt=Ue,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Ae*(5*lr),tt+=Pe*(5*gr),Ue=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=je*(5*pr),tt+=qe*(5*dr),tt+=Xe*(5*nr),tt+=kt*(5*pe),Ue+=tt>>>13,tt&=8191,At=Ue,At+=wt*pe,At+=lt*Kt,At+=at*Zt,At+=Ae*Wt,At+=Pe*(5*lr),Ue=At>>>13,At&=8191,At+=Ge*(5*gr),At+=je*(5*Qt),At+=qe*(5*pr),At+=Xe*(5*dr),At+=kt*(5*nr),Ue+=At>>>13,At&=8191,Rt=Ue,Rt+=wt*nr,Rt+=lt*pe,Rt+=at*Kt,Rt+=Ae*Zt,Rt+=Pe*Wt,Ue=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=je*(5*gr),Rt+=qe*(5*Qt),Rt+=Xe*(5*pr),Rt+=kt*(5*dr),Ue+=Rt>>>13,Rt&=8191,Mt=Ue,Mt+=wt*dr,Mt+=lt*nr,Mt+=at*pe,Mt+=Ae*Kt,Mt+=Pe*Zt,Ue=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=je*(5*lr),Mt+=qe*(5*gr),Mt+=Xe*(5*Qt),Mt+=kt*(5*pr),Ue+=Mt>>>13,Mt&=8191,Et=Ue,Et+=wt*pr,Et+=lt*dr,Et+=at*nr,Et+=Ae*pe,Et+=Pe*Kt,Ue=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=je*Wt,Et+=qe*(5*lr),Et+=Xe*(5*gr),Et+=kt*(5*Qt),Ue+=Et>>>13,Et&=8191,dt=Ue,dt+=wt*Qt,dt+=lt*pr,dt+=at*dr,dt+=Ae*nr,dt+=Pe*pe,Ue=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=je*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*gr),Ue+=dt>>>13,dt&=8191,_t=Ue,_t+=wt*gr,_t+=lt*Qt,_t+=at*pr,_t+=Ae*dr,_t+=Pe*nr,Ue=_t>>>13,_t&=8191,_t+=Ge*pe,_t+=je*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),Ue+=_t>>>13,_t&=8191,ot=Ue,ot+=wt*lr,ot+=lt*gr,ot+=at*Qt,ot+=Ae*pr,ot+=Pe*dr,Ue=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=je*pe,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,Ue+=ot>>>13,ot&=8191,Ue=(Ue<<2)+Ue|0,Ue=Ue+gt|0,gt=Ue&8191,Ue=Ue>>>13,st+=Ue,wt=gt,lt=st,at=tt,Ae=At,Pe=Rt,Ge=Mt,je=Et,qe=dt,Xe=_t,kt=ot,H+=16,V-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Ae,this.h[4]=Pe,this.h[5]=Ge,this.h[6]=je,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},G.prototype.finish=function($,H){var V=new Uint16Array(10),C,Y,q,oe;if(this.leftover){for(oe=this.leftover,this.buffer[oe++]=1;oe<16;oe++)this.buffer[oe]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,oe=2;oe<10;oe++)this.h[oe]+=C,C=this.h[oe]>>>13,this.h[oe]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,V[0]=this.h[0]+5,C=V[0]>>>13,V[0]&=8191,oe=1;oe<10;oe++)V[oe]=this.h[oe]+C,C=V[oe]>>>13,V[oe]&=8191;for(V[9]-=8192,Y=(C^1)-1,oe=0;oe<10;oe++)V[oe]&=Y;for(Y=~Y,oe=0;oe<10;oe++)this.h[oe]=this.h[oe]&Y|V[oe];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,q=this.h[0]+this.pad[0],this.h[0]=q&65535,oe=1;oe<8;oe++)q=(this.h[oe]+this.pad[oe]|0)+(q>>>16)|0,this.h[oe]=q&65535;$[H+0]=this.h[0]>>>0&255,$[H+1]=this.h[0]>>>8&255,$[H+2]=this.h[1]>>>0&255,$[H+3]=this.h[1]>>>8&255,$[H+4]=this.h[2]>>>0&255,$[H+5]=this.h[2]>>>8&255,$[H+6]=this.h[3]>>>0&255,$[H+7]=this.h[3]>>>8&255,$[H+8]=this.h[4]>>>0&255,$[H+9]=this.h[4]>>>8&255,$[H+10]=this.h[5]>>>0&255,$[H+11]=this.h[5]>>>8&255,$[H+12]=this.h[6]>>>0&255,$[H+13]=this.h[6]>>>8&255,$[H+14]=this.h[7]>>>0&255,$[H+15]=this.h[7]>>>8&255},G.prototype.update=function($,H,V){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>V&&(Y=V),C=0;C=16&&(Y=V-V%16,this.blocks($,H,Y),H+=Y,V-=Y),V){for(C=0;C>16&1),q[V-1]&=65535;q[15]=oe[15]-32767-(q[14]>>16&1),Y=q[15]>>16&1,q[14]&=65535,_(oe,q,1-Y)}for(V=0;V<16;V++)$[2*V]=oe[V]&255,$[2*V+1]=oe[V]>>8}function b($,H){var V=new Uint8Array(32),C=new Uint8Array(32);return S(V,$),S(C,H),k(V,0,C,0)}function M($){var H=new Uint8Array(32);return S(H,$),H[0]&1}function I($,H){var V;for(V=0;V<16;V++)$[V]=H[2*V]+(H[2*V+1]<<8);$[15]&=32767}function F($,H,V){for(var C=0;C<16;C++)$[C]=H[C]+V[C]}function ae($,H,V){for(var C=0;C<16;C++)$[C]=H[C]-V[C]}function N($,H,V){var C,Y,q=0,oe=0,ge=0,xe=0,Re=0,De=0,it=0,Ue=0,gt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Ae=0,Pe=0,Ge=0,je=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,pe=V[0],nr=V[1],dr=V[2],pr=V[3],Qt=V[4],gr=V[5],lr=V[6],Lr=V[7],mr=V[8],wr=V[9],Br=V[10],$r=V[11],Ir=V[12],hn=V[13],dn=V[14],pn=V[15];C=H[0],q+=C*pe,oe+=C*nr,ge+=C*dr,xe+=C*pr,Re+=C*Qt,De+=C*gr,it+=C*lr,Ue+=C*Lr,gt+=C*mr,st+=C*wr,tt+=C*Br,At+=C*$r,Rt+=C*Ir,Mt+=C*hn,Et+=C*dn,dt+=C*pn,C=H[1],oe+=C*pe,ge+=C*nr,xe+=C*dr,Re+=C*pr,De+=C*Qt,it+=C*gr,Ue+=C*lr,gt+=C*Lr,st+=C*mr,tt+=C*wr,At+=C*Br,Rt+=C*$r,Mt+=C*Ir,Et+=C*hn,dt+=C*dn,_t+=C*pn,C=H[2],ge+=C*pe,xe+=C*nr,Re+=C*dr,De+=C*pr,it+=C*Qt,Ue+=C*gr,gt+=C*lr,st+=C*Lr,tt+=C*mr,At+=C*wr,Rt+=C*Br,Mt+=C*$r,Et+=C*Ir,dt+=C*hn,_t+=C*dn,ot+=C*pn,C=H[3],xe+=C*pe,Re+=C*nr,De+=C*dr,it+=C*pr,Ue+=C*Qt,gt+=C*gr,st+=C*lr,tt+=C*Lr,At+=C*mr,Rt+=C*wr,Mt+=C*Br,Et+=C*$r,dt+=C*Ir,_t+=C*hn,ot+=C*dn,wt+=C*pn,C=H[4],Re+=C*pe,De+=C*nr,it+=C*dr,Ue+=C*pr,gt+=C*Qt,st+=C*gr,tt+=C*lr,At+=C*Lr,Rt+=C*mr,Mt+=C*wr,Et+=C*Br,dt+=C*$r,_t+=C*Ir,ot+=C*hn,wt+=C*dn,lt+=C*pn,C=H[5],De+=C*pe,it+=C*nr,Ue+=C*dr,gt+=C*pr,st+=C*Qt,tt+=C*gr,At+=C*lr,Rt+=C*Lr,Mt+=C*mr,Et+=C*wr,dt+=C*Br,_t+=C*$r,ot+=C*Ir,wt+=C*hn,lt+=C*dn,at+=C*pn,C=H[6],it+=C*pe,Ue+=C*nr,gt+=C*dr,st+=C*pr,tt+=C*Qt,At+=C*gr,Rt+=C*lr,Mt+=C*Lr,Et+=C*mr,dt+=C*wr,_t+=C*Br,ot+=C*$r,wt+=C*Ir,lt+=C*hn,at+=C*dn,Ae+=C*pn,C=H[7],Ue+=C*pe,gt+=C*nr,st+=C*dr,tt+=C*pr,At+=C*Qt,Rt+=C*gr,Mt+=C*lr,Et+=C*Lr,dt+=C*mr,_t+=C*wr,ot+=C*Br,wt+=C*$r,lt+=C*Ir,at+=C*hn,Ae+=C*dn,Pe+=C*pn,C=H[8],gt+=C*pe,st+=C*nr,tt+=C*dr,At+=C*pr,Rt+=C*Qt,Mt+=C*gr,Et+=C*lr,dt+=C*Lr,_t+=C*mr,ot+=C*wr,wt+=C*Br,lt+=C*$r,at+=C*Ir,Ae+=C*hn,Pe+=C*dn,Ge+=C*pn,C=H[9],st+=C*pe,tt+=C*nr,At+=C*dr,Rt+=C*pr,Mt+=C*Qt,Et+=C*gr,dt+=C*lr,_t+=C*Lr,ot+=C*mr,wt+=C*wr,lt+=C*Br,at+=C*$r,Ae+=C*Ir,Pe+=C*hn,Ge+=C*dn,je+=C*pn,C=H[10],tt+=C*pe,At+=C*nr,Rt+=C*dr,Mt+=C*pr,Et+=C*Qt,dt+=C*gr,_t+=C*lr,ot+=C*Lr,wt+=C*mr,lt+=C*wr,at+=C*Br,Ae+=C*$r,Pe+=C*Ir,Ge+=C*hn,je+=C*dn,qe+=C*pn,C=H[11],At+=C*pe,Rt+=C*nr,Mt+=C*dr,Et+=C*pr,dt+=C*Qt,_t+=C*gr,ot+=C*lr,wt+=C*Lr,lt+=C*mr,at+=C*wr,Ae+=C*Br,Pe+=C*$r,Ge+=C*Ir,je+=C*hn,qe+=C*dn,Xe+=C*pn,C=H[12],Rt+=C*pe,Mt+=C*nr,Et+=C*dr,dt+=C*pr,_t+=C*Qt,ot+=C*gr,wt+=C*lr,lt+=C*Lr,at+=C*mr,Ae+=C*wr,Pe+=C*Br,Ge+=C*$r,je+=C*Ir,qe+=C*hn,Xe+=C*dn,kt+=C*pn,C=H[13],Mt+=C*pe,Et+=C*nr,dt+=C*dr,_t+=C*pr,ot+=C*Qt,wt+=C*gr,lt+=C*lr,at+=C*Lr,Ae+=C*mr,Pe+=C*wr,Ge+=C*Br,je+=C*$r,qe+=C*Ir,Xe+=C*hn,kt+=C*dn,Wt+=C*pn,C=H[14],Et+=C*pe,dt+=C*nr,_t+=C*dr,ot+=C*pr,wt+=C*Qt,lt+=C*gr,at+=C*lr,Ae+=C*Lr,Pe+=C*mr,Ge+=C*wr,je+=C*Br,qe+=C*$r,Xe+=C*Ir,kt+=C*hn,Wt+=C*dn,Zt+=C*pn,C=H[15],dt+=C*pe,_t+=C*nr,ot+=C*dr,wt+=C*pr,lt+=C*Qt,at+=C*gr,Ae+=C*lr,Pe+=C*Lr,Ge+=C*mr,je+=C*wr,qe+=C*Br,Xe+=C*$r,kt+=C*Ir,Wt+=C*hn,Zt+=C*dn,Kt+=C*pn,q+=38*_t,oe+=38*ot,ge+=38*wt,xe+=38*lt,Re+=38*at,De+=38*Ae,it+=38*Pe,Ue+=38*Ge,gt+=38*je,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=ge+Y+65535,Y=Math.floor(C/65536),ge=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=ge+Y+65535,Y=Math.floor(C/65536),ge=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),$[0]=q,$[1]=oe,$[2]=ge,$[3]=xe,$[4]=Re,$[5]=De,$[6]=it,$[7]=Ue,$[8]=gt,$[9]=st,$[10]=tt,$[11]=At,$[12]=Rt,$[13]=Mt,$[14]=Et,$[15]=dt}function se($,H){N($,H,H)}function ee($,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=253;C>=0;C--)se(V,V),C!==2&&C!==4&&N(V,V,H);for(C=0;C<16;C++)$[C]=V[C]}function X($,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=250;C>=0;C--)se(V,V),C!==1&&N(V,V,H);for(C=0;C<16;C++)$[C]=V[C]}function Q($,H,V){var C=new Uint8Array(32),Y=new Float64Array(80),q,oe,ge=r(),xe=r(),Re=r(),De=r(),it=r(),Ue=r();for(oe=0;oe<31;oe++)C[oe]=H[oe];for(C[31]=H[31]&127|64,C[0]&=248,I(Y,V),oe=0;oe<16;oe++)xe[oe]=Y[oe],De[oe]=ge[oe]=Re[oe]=0;for(ge[0]=De[0]=1,oe=254;oe>=0;--oe)q=C[oe>>>3]>>>(oe&7)&1,_(ge,xe,q),_(Re,De,q),F(it,ge,Re),ae(ge,ge,Re),F(Re,xe,De),ae(xe,xe,De),se(De,it),se(Ue,ge),N(ge,Re,ge),N(Re,xe,it),F(it,ge,Re),ae(ge,ge,Re),se(xe,ge),ae(Re,De,Ue),N(ge,Re,u),F(ge,ge,De),N(Re,Re,ge),N(ge,De,Ue),N(De,xe,Y),se(xe,it),_(ge,xe,q),_(Re,De,q);for(oe=0;oe<16;oe++)Y[oe+16]=ge[oe],Y[oe+32]=Re[oe],Y[oe+48]=xe[oe],Y[oe+64]=De[oe];var gt=Y.subarray(32),st=Y.subarray(16);return ee(gt,gt),N(st,st,gt),S($,st),0}function R($,H){return Q($,H,s)}function Z($,H){return n(H,32),R($,H)}function te($,H,V){var C=new Uint8Array(32);return Q(C,V,H),K($,i,C,J)}var he=f,ie=p;function fe($,H,V,C,Y,q){var oe=new Uint8Array(32);return te(oe,Y,q),he($,H,V,C,oe)}function ve($,H,V,C,Y,q){var oe=new Uint8Array(32);return te(oe,Y,q),ie($,H,V,C,oe)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne($,H,V,C){for(var Y=new Int32Array(16),q=new Int32Array(16),oe,ge,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Ae,Pe,Ge,je,qe,Xe,kt=$[0],Wt=$[1],Zt=$[2],Kt=$[3],pe=$[4],nr=$[5],dr=$[6],pr=$[7],Qt=H[0],gr=H[1],lr=H[2],Lr=H[3],mr=H[4],wr=H[5],Br=H[6],$r=H[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=V[at+0]<<24|V[at+1]<<16|V[at+2]<<8|V[at+3],q[lt]=V[at+4]<<24|V[at+5]<<16|V[at+6]<<8|V[at+7];for(lt=0;lt<80;lt++)if(oe=kt,ge=Wt,xe=Zt,Re=Kt,De=pe,it=nr,Ue=dr,gt=pr,st=Qt,tt=gr,At=lr,Rt=Lr,Mt=mr,Et=wr,dt=Br,_t=$r,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(pe>>>14|mr<<18)^(pe>>>18|mr<<14)^(mr>>>9|pe<<23),Pe=(mr>>>14|pe<<18)^(mr>>>18|pe<<14)^(pe>>>9|mr<<23),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=pe&nr^~pe&dr,Pe=mr&wr^~mr&Br,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Me[lt*2],Pe=Me[lt*2+1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Y[lt%16],Pe=q[lt%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|je<<16,Ae=ot,Pe=wt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Pe=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=kt&Wt^kt&Zt^Wt&Zt,Pe=Qt&gr^Qt&lr^gr&lr,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,gt=qe&65535|Xe<<16,_t=Ge&65535|je<<16,Ae=Re,Pe=Rt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=ot,Pe=wt,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|je<<16,Wt=oe,Zt=ge,Kt=xe,pe=Re,nr=De,dr=it,pr=Ue,kt=gt,gr=st,lr=tt,Lr=At,mr=Rt,wr=Mt,Br=Et,$r=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Ae=Y[at],Pe=q[at],Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=Y[(at+9)%16],Pe=q[(at+9)%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+1)%16],wt=q[(at+1)%16],Ae=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Pe=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+14)%16],wt=q[(at+14)%16],Ae=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Pe=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,q[at]=Ge&65535|je<<16;Ae=kt,Pe=Qt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[0],Pe=H[0],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[0]=kt=qe&65535|Xe<<16,H[0]=Qt=Ge&65535|je<<16,Ae=Wt,Pe=gr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[1],Pe=H[1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[1]=Wt=qe&65535|Xe<<16,H[1]=gr=Ge&65535|je<<16,Ae=Zt,Pe=lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[2],Pe=H[2],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[2]=Zt=qe&65535|Xe<<16,H[2]=lr=Ge&65535|je<<16,Ae=Kt,Pe=Lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[3],Pe=H[3],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[3]=Kt=qe&65535|Xe<<16,H[3]=Lr=Ge&65535|je<<16,Ae=pe,Pe=mr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[4],Pe=H[4],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[4]=pe=qe&65535|Xe<<16,H[4]=mr=Ge&65535|je<<16,Ae=nr,Pe=wr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[5],Pe=H[5],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[5]=nr=qe&65535|Xe<<16,H[5]=wr=Ge&65535|je<<16,Ae=dr,Pe=Br,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[6],Pe=H[6],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[6]=dr=qe&65535|Xe<<16,H[6]=Br=Ge&65535|je<<16,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[7],Pe=H[7],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[7]=pr=qe&65535|Xe<<16,H[7]=$r=Ge&65535|je<<16,Ir+=128,C-=128}return C}function Te($,H,V){var C=new Int32Array(8),Y=new Int32Array(8),q=new Uint8Array(256),oe,ge=V;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,H,V),V%=128,oe=0;oe=0;--Y)C=V[Y/8|0]>>(Y&7)&1,Ie($,H,C),$e(H,$),$e($,$),Ie($,H,C)}function ke($,H){var V=[r(),r(),r(),r()];v(V[0],g),v(V[1],y),v(V[2],a),N(V[3],g,y),Ve($,V,H)}function ze($,H,V){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],q;for(V||n(H,32),Te(C,H,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le($,Y),q=0;q<32;q++)H[q+32]=$[q];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Ee($,H){var V,C,Y,q;for(C=63;C>=32;--C){for(V=0,Y=C-32,q=C-12;Y>4)*He[Y],V=H[Y]>>8,H[Y]&=255;for(Y=0;Y<32;Y++)H[Y]-=V*He[Y];for(C=0;C<32;C++)H[C+1]+=H[C]>>8,$[C]=H[C]&255}function Qe($){var H=new Float64Array(64),V;for(V=0;V<64;V++)H[V]=$[V];for(V=0;V<64;V++)$[V]=0;Ee($,H)}function ct($,H,V,C){var Y=new Uint8Array(64),q=new Uint8Array(64),oe=new Uint8Array(64),ge,xe,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=V+64;for(ge=0;ge>7&&ae($[0],o,$[0]),N($[3],$[0],$[1]),0)}function et($,H,V,C){var Y,q=new Uint8Array(32),oe=new Uint8Array(64),ge=[r(),r(),r(),r()],xe=[r(),r(),r(),r()];if(V<64||Be(xe,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var $=new Uint8Array(vt),H=new Uint8Array(Dt);return ze($,H),{publicKey:$,secretKey:H}},e.sign.keyPair.fromSecretKey=function($){if(nt($),$.length!==Dt)throw new Error("bad secret key size");for(var H=new Uint8Array(vt),V=0;V=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function Tb(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function Y0(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new jt("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new jt("Delay aborted"))})})})}function Ss(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function fh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=Ss(e==null?void 0:e.signal);if(typeof t!="function")throw new jt(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=g??null,o==null||o.abort(),o=Ss(g),o.signal.aborted)throw new jt("Resource creation was aborted");n=y??null;const A=t(o.signal,...y);i=A;const P=yield A;if(i!==A&&P!==r)throw yield e(P),new jt("Resource creation was aborted by a new resource creation");return r=P,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const g=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([g?e(g):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:g=>Pt(this,void 0,void 0,function*(){const y=r,A=i,P=n,N=s;if(yield O7(g),y===r&&A===i&&P===n&&N===s)return yield a(s,...P??[]);throw new jt("Resource recreation was aborted by a new resource creation")})}}function WZ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=Ss(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new jt("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new jt(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new jt("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class Nb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=HZ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield KZ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new FZ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(D7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=C7.encode(e);yield fh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new jt(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Bo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Bo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new jt(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new jt("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),Sn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new jt("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new jt(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function KZ(t){return Pt(this,void 0,void 0,function*(){return yield WZ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=Ss(n.signal).signal;if(o.aborted){r(new jt("Bridge connection aborted"));return}const a=new URL(D7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new jt("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new jt("Bridge connection aborted"));return}try{const g=yield t.errorHandler(l,d);g!==l&&l.close(),g&&g!==l&&e(g)}catch(g){l.close(),r(g)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new jt("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new jt("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new jt("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function lh(t){return!("connectEvent"in t)}class hh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!lh(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Cb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Cb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new jt("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new jt("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new jt("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new jt("Trying to read HTTP connection source while injected connection is stored");if(!lh(e))throw new jt("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new jt("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new jt("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!lh(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const N7=2;class dh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new hh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getHttpConnection();return lh(n)?new dh(e,n.connectionSource):new dh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=Ss(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Cb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield fh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=Ss(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(lh(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new jt("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Nb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield fh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new jt("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),G0(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=Ss(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){Sn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(C7.decode(e.message).toUint8Array(),G0(e.from)));if(Sn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){Sn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Bo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(Sn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new jt(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return jZ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",N7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+qZ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new Nb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>fh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Nb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function L7(t,e){return k7(t,[e])}function k7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function VZ(t){try{return!L7(t,"tonconnect")||!L7(t.tonconnect,"walletInfo")?!1:k7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Yu{constructor(){this.storage={}}static getInstance(){return Yu.instance||(Yu.instance=new Yu),Yu.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function rp(){if(!(typeof window>"u"))return window}function GZ(){const t=rp();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function YZ(){if(!(typeof document>"u"))return document}function JZ(){var t;const e=(t=rp())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function XZ(){if(ZZ())return localStorage;if(QZ())throw new jt("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Yu.getInstance()}function ZZ(){try{return typeof localStorage<"u"}catch{return!1}}function QZ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class xi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=xi.window;if(!xi.isWindowContainsWallet(n,r))throw new Db;this.connectionStorage=new hh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getInjectedConnection();return new xi(e,n.jsBridgeKey)})}static isWalletInjected(e){return xi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return xi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?GZ().filter(([n,i])=>VZ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(N7,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{Sn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();Sn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){Sn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>Sn("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{Sn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);Sn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){Sn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{Sn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}xi.window=rp();class eQ{constructor(){this.localStorage=XZ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function $7(t){return rQ(t)&&t.injected}function tQ(t){return $7(t)&&t.embedded}function rQ(t){return"jsBridgeKey"in t}const nQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class Lb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(tQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new Ob("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Bo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Bo(n),e=nQ}let r=[];try{r=xi.getCurrentlyInjectedWallets()}catch(n){Bo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=xi.isWalletInjected(o),i.embedded=xi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class np extends jt{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,np.prototype)}}function iQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new np("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function dQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Xu(t,e)),kb(e,r))}function pQ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Xu(t,e)),kb(e,r))}function gQ(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Xu(t,e)),kb(e,r))}function mQ(t,e,r){return Object.assign({type:"disconnection",scope:r},Xu(t,e))}class vQ{constructor(){this.window=rp()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class bQ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new vQ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Ju({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",oQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",sQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=aQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=cQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=uQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=fQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=lQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=hQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=mQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=dQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=pQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=gQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const yQ="3.0.5";class ip{constructor(e){if(this.walletsList=new Lb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||JZ(),storage:(e==null?void 0:e.storage)||new eQ},this.walletsList=new Lb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new bQ({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:yQ}),!this.dappSettings.manifestUrl)throw new Tb("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new hh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Rb;const o=Ss(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new jt("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=Ss(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield dh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield xi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Bo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=fh(g=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:g.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(g=>setTimeout(()=>g(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=Ss(n==null?void 0:n.signal);if(i.signal.aborted)throw new jt("Transaction sending was aborted");this.checkConnection(),iQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=OZ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(tp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(tp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),tp.parseAndThrowError(l);const d=tp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new X0;const n=Ss(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new jt("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=YZ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Bo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&NZ(e)?r=new xi(this.dappSettings.storage,e.jsBridgeKey):r=new dh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new jt("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=kZ.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),Sn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof J0||r instanceof Y0)throw Bo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new X0}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}ip.walletsList=new Lb,ip.isWalletInjected=t=>xi.isWalletInjected(t),ip.isInsideWalletBrowser=t=>xi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function $b(t){const{children:e,onClick:r}=t;return me.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function wQ(t){const{wallet:e,connector:r,loading:n}=t,i=Pe.useRef(null),s=Pe.useRef(),[o,a]=Pe.useState(),[u,l]=Pe.useState(),[d,g]=Pe.useState("connect"),[y,A]=Pe.useState(!1),[P,N]=Pe.useState();function D(z){var ue;(ue=s.current)==null||ue.update({data:z})}async function k(){A(!0);try{a("");const z=await ma.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ue=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:z}});if(!ue)return;N(ue),D(ue),l(z)}}catch(z){a(z.message)}A(!1)}function $(){s.current=new y7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function q(){r.connect(e,{request:{tonProof:u}})}function U(){if("deepLink"in e){if(!e.deepLink||!P)return;const z=new URL(P),ue=`${e.deepLink}${z.search}`;window.open(ue)}}function K(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(P)}const J=Pe.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),T=Pe.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Pe.useEffect(()=>{$(),k()},[]),me.jsxs(Ec,{children:[me.jsx("div",{className:"xc-mb-6",children:me.jsx(ah,{title:"Connect wallet",onBack:t.onBack})}),me.jsxs("div",{className:"xc-text-center xc-mb-6",children:[me.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[me.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),me.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?me.jsx(mc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):me.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),me.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),me.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&me.jsx(mc,{className:"xc-animate-spin"}),!y&&!n&&me.jsxs(me.Fragment,{children:[$7(e)&&me.jsxs($b,{onClick:q,children:[me.jsx(PK,{className:"xc-opacity-80"}),"Extension"]}),J&&me.jsxs($b,{onClick:U,children:[me.jsx(u8,{className:"xc-opacity-80"}),"Desktop"]}),T&&me.jsx($b,{onClick:K,children:"Telegram Mini App"})]})]})]})}function xQ(t){const[e,r]=Pe.useState(""),[n,i]=Pe.useState(),[s,o]=Pe.useState(),a=Mb(),[u,l]=Pe.useState(!1);async function d(y){var P,N;if(!y||!((P=y.connectItems)!=null&&P.tonProof))return;l(!0);const A=await ma.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(N=y.connectItems)==null?void 0:N.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(A.data),l(!1)}Pe.useEffect(()=>{const y=new ip({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),A=y.onStatusChange(d);return o(y),r("select"),A},[]);function g(y){r("connect"),i(y)}return me.jsxs(Ec,{children:[e==="select"&&me.jsx(SZ,{connector:s,onSelect:g,onBack:t.onBack}),e==="connect"&&me.jsx(wQ,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function _Q(t){const{children:e,className:r}=t,n=Pe.useRef(null),[i,s]=Pe.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Pe.useEffect(()=>{console.log("maxHeight",i)},[i]),me.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function EQ(){return me.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[me.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),me.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),me.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),me.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),me.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),me.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function SQ(t){const{wallets:e}=Wl(),[r,n]=Pe.useState(),i=Pe.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return me.jsxs(Ec,{children:[me.jsx("div",{className:"xc-mb-6",children:me.jsx(ah,{title:"Select wallet",onBack:t.onBack})}),me.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[me.jsx(f8,{className:"xc-shrink-0 xc-opacity-50"}),me.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),me.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>me.jsx(QS,{wallet:a,onClick:s},`feature-${a.key}`)):me.jsx(EQ,{})})]})}function AQ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Pe.useState(""),[l,d]=Pe.useState(null),[g,y]=Pe.useState("");function A(k){d(k),u("evm-wallet")}function P(k){u("email"),y(k)}async function N(k){await e(k)}function D(){u("ton-wallet")}return Pe.useEffect(()=>{u("index")},[]),me.jsx(XX,{config:t.config,children:me.jsxs(_Q,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&me.jsx(_Z,{onBack:()=>u("index"),onLogin:N,wallet:l}),a==="ton-wallet"&&me.jsx(xQ,{onBack:()=>u("index"),onLogin:N}),a==="email"&&me.jsx(ZX,{email:g,onBack:()=>u("index"),onLogin:N}),a==="index"&&me.jsx(kX,{header:r,onEmailConfirm:P,onSelectWallet:A,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&me.jsx(SQ,{onBack:()=>u("index"),onSelectWallet:A})]})})}Vn.CodattaConnectContextProvider=bK,Vn.CodattaSignin=AQ,Vn.coinbaseWallet=s8,Vn.useCodattaConnectContext=Wl,Object.defineProperty(Vn,Symbol.toStringTag,{value:"Module"})}); + ***************************************************************************** */function kZ(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new Ut("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new Ut("Delay aborted"))})})})}function As(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function fh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=As(e==null?void 0:e.signal);if(typeof t!="function")throw new Ut(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=g??null,o==null||o.abort(),o=As(g),o.signal.aborted)throw new Ut("Resource creation was aborted");n=y??null;const A=t(o.signal,...y);i=A;const P=yield A;if(i!==A&&P!==r)throw yield e(P),new Ut("Resource creation was aborted by a new resource creation");return r=P,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const g=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([g?e(g):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:g=>Pt(this,void 0,void 0,function*(){const y=r,A=i,P=n,O=s;if(yield j7(g),y===r&&A===i&&P===n&&O===s)return yield a(s,...P??[]);throw new Ut("Resource recreation was aborted by a new resource creation")})}}function GZ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=As(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new Ut("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new Ut(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new Ut("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class kb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=VZ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield YZ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new qZ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(F7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=k7.encode(e);yield fh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new Ut(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Uo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Uo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new Ut(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new Ut("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),Sn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Ut("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new Ut(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function YZ(t){return Pt(this,void 0,void 0,function*(){return yield GZ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=As(n.signal).signal;if(o.aborted){r(new Ut("Bridge connection aborted"));return}const a=new URL(F7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new Ut("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}try{const g=yield t.errorHandler(l,d);g!==l&&l.close(),g&&g!==l&&e(g)}catch(g){l.close(),r(g)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new Ut("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function lh(t){return!("connectEvent"in t)}class hh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!lh(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Rb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Rb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");if(!lh(e))throw new Ut("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new Ut("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!lh(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const U7=2;class dh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new hh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getHttpConnection();return lh(n)?new dh(e,n.connectionSource):new dh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=As(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Rb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield fh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(lh(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new Ut("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new kb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield fh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Ut("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),Y0(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=As(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){Sn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(k7.decode(e.message).toUint8Array(),Y0(e.from)));if(Sn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){Sn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Uo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(Sn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new Ut(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return HZ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",U7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+WZ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new kb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>fh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new kb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function q7(t,e){return z7(t,[e])}function z7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function JZ(t){try{return!q7(t,"tonconnect")||!q7(t.tonconnect,"walletInfo")?!1:z7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Ju{constructor(){this.storage={}}static getInstance(){return Ju.instance||(Ju.instance=new Ju),Ju.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function np(){if(!(typeof window>"u"))return window}function XZ(){const t=np();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function ZZ(){if(!(typeof document>"u"))return document}function QZ(){var t;const e=(t=np())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function eQ(){if(tQ())return localStorage;if(rQ())throw new Ut("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Ju.getInstance()}function tQ(){try{return typeof localStorage<"u"}catch{return!1}}function rQ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class xi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=xi.window;if(!xi.isWindowContainsWallet(n,r))throw new Nb;this.connectionStorage=new hh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getInjectedConnection();return new xi(e,n.jsBridgeKey)})}static isWalletInjected(e){return xi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return xi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?XZ().filter(([n,i])=>JZ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(U7,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{Sn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();Sn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){Sn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>Sn("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{Sn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);Sn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){Sn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{Sn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}xi.window=np();class nQ{constructor(){this.localStorage=eQ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function H7(t){return sQ(t)&&t.injected}function iQ(t){return H7(t)&&t.embedded}function sQ(t){return"jsBridgeKey"in t}const oQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class Bb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(iQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new Lb("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Uo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Uo(n),e=oQ}let r=[];try{r=xi.getCurrentlyInjectedWallets()}catch(n){Uo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=xi.isWalletInjected(o),i.embedded=xi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class ip extends Ut{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,ip.prototype)}}function aQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new ip("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function mQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Zu(t,e)),$b(e,r))}function vQ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Zu(t,e)),$b(e,r))}function bQ(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Zu(t,e)),$b(e,r))}function yQ(t,e,r){return Object.assign({type:"disconnection",scope:r},Zu(t,e))}class wQ{constructor(){this.window=np()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class xQ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new wQ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Xu({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",uQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",cQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=fQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=lQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=hQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=dQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=pQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=gQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=yQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=mQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=vQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=bQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const _Q="3.0.5";class ph{constructor(e){if(this.walletsList=new Bb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||QZ(),storage:(e==null?void 0:e.storage)||new nQ},this.walletsList=new Bb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new xQ({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:_Q}),!this.dappSettings.manifestUrl)throw new Db("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new hh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Ob;const o=As(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new Ut("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield dh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield xi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Uo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=fh(g=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:g.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(g=>setTimeout(()=>g(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=As(n==null?void 0:n.signal);if(i.signal.aborted)throw new Ut("Transaction sending was aborted");this.checkConnection(),aQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=kZ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(rp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(rp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),rp.parseAndThrowError(l);const d=rp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new Z0;const n=As(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Ut("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=ZZ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Uo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&BZ(e)?r=new xi(this.dappSettings.storage,e.jsBridgeKey):r=new dh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new Ut("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=FZ.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),Sn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof X0||r instanceof J0)throw Uo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new Z0}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}ph.walletsList=new Bb,ph.isWalletInjected=t=>xi.isWalletInjected(t),ph.isInsideWalletBrowser=t=>xi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function Fb(t){const{children:e,onClick:r}=t;return le.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function W7(t){const{wallet:e,connector:r,loading:n}=t,i=Se.useRef(null),s=Se.useRef(),[o,a]=Se.useState(),[u,l]=Se.useState(),[d,g]=Se.useState("connect"),[y,A]=Se.useState(!1),[P,O]=Se.useState();function D(z){var ue;(ue=s.current)==null||ue.update({data:z})}async function k(){A(!0);try{a("");const z=await No.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ue=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:z}});if(!ue)return;O(ue),D(ue),l(z)}}catch(z){a(z.message)}A(!1)}function B(){s.current=new _7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function j(){r.connect(e,{request:{tonProof:u}})}function U(){if("deepLink"in e){if(!e.deepLink||!P)return;const z=new URL(P),ue=`${e.deepLink}${z.search}`;window.open(ue)}}function K(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(P)}const J=Se.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),T=Se.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Se.useEffect(()=>{B(),k()},[]),le.jsxs(ro,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Ac,{title:"Connect wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-text-center xc-mb-6",children:[le.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[le.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),le.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?le.jsx(ya,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):le.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),le.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),le.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&le.jsx(ya,{className:"xc-animate-spin"}),!y&&!n&&le.jsxs(le.Fragment,{children:[H7(e)&&le.jsxs(Fb,{onClick:j,children:[le.jsx(kK,{className:"xc-opacity-80"}),"Extension"]}),J&&le.jsxs(Fb,{onClick:U,children:[le.jsx(l8,{className:"xc-opacity-80"}),"Desktop"]}),T&&le.jsx(Fb,{onClick:K,children:"Telegram Mini App"})]})]})]})}function EQ(t){const[e,r]=Se.useState(""),[n,i]=Se.useState(),[s,o]=Se.useState(),a=Cb(),[u,l]=Se.useState(!1);async function d(y){var P,O;if(!y||!((P=y.connectItems)!=null&&P.tonProof))return;l(!0);const A=await No.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(O=y.connectItems)==null?void 0:O.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(A.data),l(!1)}Se.useEffect(()=>{const y=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),A=y.onStatusChange(d);return o(y),r("select"),A},[]);function g(y){r("connect"),i(y)}return le.jsxs(ro,{children:[e==="select"&&le.jsx(C7,{connector:s,onSelect:g,onBack:t.onBack}),e==="connect"&&le.jsx(W7,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function K7(t){const{children:e,className:r}=t,n=Se.useRef(null),[i,s]=Se.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Se.useEffect(()=>{console.log("maxHeight",i)},[i]),le.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function SQ(){return le.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[le.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),le.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function V7(t){const{wallets:e}=Kl(),[r,n]=Se.useState(),i=Se.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return le.jsxs(ro,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Ac,{title:"Select wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[le.jsx(d8,{className:"xc-shrink-0 xc-opacity-50"}),le.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),le.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>le.jsx(r7,{wallet:a,onClick:s},`feature-${a.key}`)):le.jsx(SQ,{})})]})}function AQ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Se.useState(""),[l,d]=Se.useState(null),[g,y]=Se.useState("");function A(k){d(k),u("evm-wallet")}function P(k){u("email"),y(k)}async function O(k){await e(k)}function D(){u("ton-wallet")}return Se.useEffect(()=>{u("index")},[]),le.jsx(iZ,{config:t.config,children:le.jsxs(K7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&le.jsx(PZ,{onBack:()=>u("index"),onLogin:O,wallet:l}),a==="ton-wallet"&&le.jsx(EQ,{onBack:()=>u("index"),onLogin:O}),a==="email"&&le.jsx(sZ,{email:g,onBack:()=>u("index"),onLogin:O}),a==="index"&&le.jsx(h7,{header:r,onEmailConfirm:P,onSelectWallet:A,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&le.jsx(V7,{onBack:()=>u("index"),onSelectWallet:A})]})})}function PQ(t){const{wallet:e,onConnect:r}=t,[n,i]=Se.useState(e.installed?"connect":"qr");async function s(o,a){r(o,a)}return le.jsxs(ro,{children:[le.jsx("div",{className:"mb-6",children:le.jsx(Ac,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&le.jsx(P7,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&le.jsx(M7,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&le.jsx(I7,{wallet:e})]})}function MQ(t){const{email:e}=t,[r,n]=Se.useState(0),[i,s]=Se.useState(!1),[o,a]=Se.useState(!1),[u,l]=Se.useState(""),[d,g]=Se.useState("");async function y(){n(60);const O=setInterval(()=>{n(D=>D===0?(clearInterval(O),0):D-1)},1e3)}async function A(O){a(!0);try{l(""),await No.getEmailCode({account_type:"email",email:O}),y()}catch(D){l(D.message)}a(!1)}Se.useEffect(()=>{e&&A(e)},[e]);async function P(O){if(g(""),!(O.length<6)){s(!0);try{await t.onInputCode(e,O)}catch(D){g(D.message)}s(!1)}}return le.jsxs(ro,{children:[le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[le.jsx(h8,{className:"xc-mb-4",size:60}),le.jsx("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:u?le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{className:"xc-px-8",children:u})}):o?le.jsx(ya,{className:"xc-animate-spin"}):le.jsxs(le.Fragment,{children:[le.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),le.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]})}),le.jsx("div",{className:"xc-mb-2 xc-h-12",children:le.jsx(y7,{spinning:i,className:"xc-rounded-xl",children:le.jsx(Mb,{maxLength:6,onChange:P,disabled:i,className:"disabled:xc-opacity-20",children:le.jsx(Ib,{children:le.jsxs("div",{className:no("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[le.jsx(Li,{index:0}),le.jsx(Li,{index:1}),le.jsx(Li,{index:2}),le.jsx(Li,{index:3}),le.jsx(Li,{index:4}),le.jsx(Li,{index:5})]})})})})}),d&&le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{children:d})})]}),le.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Recend in ${r}s`:le.jsx("button",{onClick:()=>A(e),children:"Send again"})]})]})}function IQ(t){const{email:e}=t;return le.jsxs(ro,{children:[le.jsx("div",{className:"xc-mb-12",children:le.jsx(Ac,{title:"Sign in with email",onBack:t.onBack})}),le.jsx(MQ,{email:e,onInputCode:t.onInputCode})]})}function CQ(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Se.useState(""),[a,u]=Se.useState(),[l,d]=Se.useState(),g=Se.useRef(),[y,A]=Se.useState("");function P(j){u(j),o("evm-wallet-connect")}function O(j){A(j),o("email-connect")}async function D(j,U){await e({chain_type:"eip155",client:j.client,connect_info:U}),o("index")}function k(j){d(j),o("ton-wallet-connect")}async function B(j){j&&await r({chain_type:"ton",client:g.current,connect_info:j})}return Se.useEffect(()=>{g.current=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const j=g.current.onStatusChange(B);return o("index"),j},[]),le.jsxs(K7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&le.jsx(V7,{onBack:()=>o("index"),onSelectWallet:P}),s==="evm-wallet-connect"&&le.jsx(PQ,{onBack:()=>o("index"),onConnect:D,wallet:a}),s==="ton-wallet-select"&&le.jsx(C7,{connector:g.current,onSelect:k,onBack:()=>o("index")}),s==="ton-wallet-connect"&&le.jsx(W7,{connector:g.current,wallet:l,onBack:()=>o("index")}),s==="email-connect"&&le.jsx(IQ,{email:y,onBack:()=>o("index"),onInputCode:n}),s==="index"&&le.jsx(h7,{onEmailConfirm:O,onSelectWallet:P,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Fn.CodattaConnect=CQ,Fn.CodattaConnectContextProvider=IK,Fn.CodattaSignin=AQ,Fn.coinbaseWallet=a8,Fn.useCodattaConnectContext=Kl,Object.defineProperty(Fn,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/main-Dv8NlLmw.js b/dist/main-DfEBGh6l.js similarity index 69% rename from dist/main-Dv8NlLmw.js rename to dist/main-DfEBGh6l.js index d73e777..197abff 100644 --- a/dist/main-Dv8NlLmw.js +++ b/dist/main-DfEBGh6l.js @@ -1,11 +1,11 @@ -var ER = Object.defineProperty; -var SR = (t, e, r) => e in t ? ER(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; -var Rs = (t, e, r) => SR(t, typeof e != "symbol" ? e + "" : e, r); -import * as Gt from "react"; -import pv, { createContext as Sa, useContext as Tn, useState as fr, useEffect as Xn, forwardRef as gv, createElement as jd, useId as mv, useCallback as vv, Component as AR, useLayoutEffect as PR, useRef as bi, useInsertionEffect as b5, useMemo as Oi, Fragment as y5, Children as MR, isValidElement as IR } from "react"; +var OR = Object.defineProperty; +var NR = (t, e, r) => e in t ? OR(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; +var Ds = (t, e, r) => NR(t, typeof e != "symbol" ? e + "" : e, r); +import * as Yt from "react"; +import pv, { createContext as Ma, useContext as Tn, useState as Gt, useEffect as Dn, forwardRef as gv, createElement as qd, useId as mv, useCallback as vv, Component as LR, useLayoutEffect as kR, useRef as oi, useInsertionEffect as w5, useMemo as Ni, Fragment as x5, Children as $R, isValidElement as BR } from "react"; import "https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"; var gn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; -function ts(t) { +function rs(t) { return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; } function bv(t) { @@ -27,7 +27,7 @@ function bv(t) { }); }), r; } -var Ym = { exports: {} }, pf = {}; +var Ym = { exports: {} }, gf = {}; /** * @license React * react-jsx-runtime.production.min.js @@ -37,21 +37,21 @@ var Ym = { exports: {} }, pf = {}; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -var d2; -function CR() { - if (d2) return pf; - d2 = 1; +var g2; +function FR() { + if (g2) return gf; + g2 = 1; var t = pv, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 }; function o(a, u, l) { - var d, g = {}, w = null, A = null; + var d, p = {}, w = null, A = null; l !== void 0 && (w = "" + l), u.key !== void 0 && (w = "" + u.key), u.ref !== void 0 && (A = u.ref); - for (d in u) n.call(u, d) && !s.hasOwnProperty(d) && (g[d] = u[d]); - if (a && a.defaultProps) for (d in u = a.defaultProps, u) g[d] === void 0 && (g[d] = u[d]); - return { $$typeof: e, type: a, key: w, ref: A, props: g, _owner: i.current }; + for (d in u) n.call(u, d) && !s.hasOwnProperty(d) && (p[d] = u[d]); + if (a && a.defaultProps) for (d in u = a.defaultProps, u) p[d] === void 0 && (p[d] = u[d]); + return { $$typeof: e, type: a, key: w, ref: A, props: p, _owner: i.current }; } - return pf.Fragment = r, pf.jsx = o, pf.jsxs = o, pf; + return gf.Fragment = r, gf.jsx = o, gf.jsxs = o, gf; } -var gf = {}; +var mf = {}; /** * @license React * react-jsx-runtime.development.js @@ -61,61 +61,61 @@ var gf = {}; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -var p2; -function TR() { - return p2 || (p2 = 1, process.env.NODE_ENV !== "production" && function() { - var t = pv, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), a = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), g = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), M = Symbol.iterator, N = "@@iterator"; - function L(U) { - if (U === null || typeof U != "object") +var m2; +function jR() { + return m2 || (m2 = 1, process.env.NODE_ENV !== "production" && function() { + var t = pv, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), a = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), P = Symbol.iterator, N = "@@iterator"; + function L(j) { + if (j === null || typeof j != "object") return null; - var se = M && U[M] || U[N]; + var se = P && j[P] || j[N]; return typeof se == "function" ? se : null; } var $ = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - function F(U) { + function B(j) { { - for (var se = arguments.length, he = new Array(se > 1 ? se - 1 : 0), xe = 1; xe < se; xe++) - he[xe - 1] = arguments[xe]; - K("error", U, he); + for (var se = arguments.length, de = new Array(se > 1 ? se - 1 : 0), xe = 1; xe < se; xe++) + de[xe - 1] = arguments[xe]; + H("error", j, de); } } - function K(U, se, he) { + function H(j, se, de) { { var xe = $.ReactDebugCurrentFrame, Te = xe.getStackAddendum(); - Te !== "" && (se += "%s", he = he.concat([Te])); - var Re = he.map(function(nt) { + Te !== "" && (se += "%s", de = de.concat([Te])); + var Re = de.map(function(nt) { return String(nt); }); - Re.unshift("Warning: " + se), Function.prototype.apply.call(console[U], console, Re); + Re.unshift("Warning: " + se), Function.prototype.apply.call(console[j], console, Re); } } - var H = !1, V = !1, te = !1, R = !1, W = !1, pe; - pe = Symbol.for("react.module.reference"); - function Ee(U) { - return !!(typeof U == "string" || typeof U == "function" || U === n || U === s || W || U === i || U === l || U === d || R || U === A || H || V || te || typeof U == "object" && U !== null && (U.$$typeof === w || U.$$typeof === g || U.$$typeof === o || U.$$typeof === a || U.$$typeof === u || // This needs to include all possible module reference object + var W = !1, V = !1, te = !1, R = !1, K = !1, ge; + ge = Symbol.for("react.module.reference"); + function Ee(j) { + return !!(typeof j == "string" || typeof j == "function" || j === n || j === s || K || j === i || j === l || j === d || R || j === A || W || V || te || typeof j == "object" && j !== null && (j.$$typeof === w || j.$$typeof === p || j.$$typeof === o || j.$$typeof === a || j.$$typeof === u || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. - U.$$typeof === pe || U.getModuleId !== void 0)); + j.$$typeof === ge || j.getModuleId !== void 0)); } - function Y(U, se, he) { - var xe = U.displayName; + function Y(j, se, de) { + var xe = j.displayName; if (xe) return xe; var Te = se.displayName || se.name || ""; - return Te !== "" ? he + "(" + Te + ")" : he; + return Te !== "" ? de + "(" + Te + ")" : de; } - function S(U) { - return U.displayName || "Context"; + function S(j) { + return j.displayName || "Context"; } - function m(U) { - if (U == null) + function m(j) { + if (j == null) return null; - if (typeof U.tag == "number" && F("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof U == "function") - return U.displayName || U.name || null; - if (typeof U == "string") - return U; - switch (U) { + if (typeof j.tag == "number" && B("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof j == "function") + return j.displayName || j.name || null; + if (typeof j == "string") + return j; + switch (j) { case n: return "Fragment"; case r: @@ -129,21 +129,21 @@ function TR() { case d: return "SuspenseList"; } - if (typeof U == "object") - switch (U.$$typeof) { + if (typeof j == "object") + switch (j.$$typeof) { case a: - var se = U; + var se = j; return S(se) + ".Consumer"; case o: - var he = U; - return S(he._context) + ".Provider"; + var de = j; + return S(de._context) + ".Provider"; case u: - return Y(U, U.render, "ForwardRef"); - case g: - var xe = U.displayName || null; - return xe !== null ? xe : m(U.type) || "Memo"; + return Y(j, j.render, "ForwardRef"); + case p: + var xe = j.displayName || null; + return xe !== null ? xe : m(j.type) || "Memo"; case w: { - var Te = U, Re = Te._payload, nt = Te._init; + var Te = j, Re = Te._payload, nt = Te._init; try { return m(nt(Re)); } catch { @@ -153,70 +153,70 @@ function TR() { } return null; } - var f = Object.assign, p = 0, b, x, _, E, v, P, I; - function B() { + var f = Object.assign, g = 0, b, x, _, E, v, M, I; + function F() { } - B.__reactDisabledLog = !0; + F.__reactDisabledLog = !0; function ce() { { - if (p === 0) { - b = console.log, x = console.info, _ = console.warn, E = console.error, v = console.group, P = console.groupCollapsed, I = console.groupEnd; - var U = { + if (g === 0) { + b = console.log, x = console.info, _ = console.warn, E = console.error, v = console.group, M = console.groupCollapsed, I = console.groupEnd; + var j = { configurable: !0, enumerable: !0, - value: B, + value: F, writable: !0 }; Object.defineProperties(console, { - info: U, - log: U, - warn: U, - error: U, - group: U, - groupCollapsed: U, - groupEnd: U + info: j, + log: j, + warn: j, + error: j, + group: j, + groupCollapsed: j, + groupEnd: j }); } - p++; + g++; } } function D() { { - if (p--, p === 0) { - var U = { + if (g--, g === 0) { + var j = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { - log: f({}, U, { + log: f({}, j, { value: b }), - info: f({}, U, { + info: f({}, j, { value: x }), - warn: f({}, U, { + warn: f({}, j, { value: _ }), - error: f({}, U, { + error: f({}, j, { value: E }), - group: f({}, U, { + group: f({}, j, { value: v }), - groupCollapsed: f({}, U, { - value: P + groupCollapsed: f({}, j, { + value: M }), - groupEnd: f({}, U, { + groupEnd: f({}, j, { value: I }) }); } - p < 0 && F("disabledDepth fell below zero. This is a bug in React. Please file an issue."); + g < 0 && B("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var oe = $.ReactCurrentDispatcher, Z; - function J(U, se, he) { + function J(j, se, de) { { if (Z === void 0) try { @@ -226,7 +226,7 @@ function TR() { Z = xe && xe[1] || ""; } return ` -` + Z + U; +` + Z + j; } } var Q = !1, T; @@ -234,13 +234,13 @@ function TR() { var X = typeof WeakMap == "function" ? WeakMap : Map; T = new X(); } - function re(U, se) { - if (!U || Q) + function re(j, se) { + if (!j || Q) return ""; { - var he = T.get(U); - if (he !== void 0) - return he; + var de = T.get(j); + if (de !== void 0) + return de; } var xe; Q = !0; @@ -263,14 +263,14 @@ function TR() { } catch (_t) { xe = _t; } - Reflect.construct(U, [], nt); + Reflect.construct(j, [], nt); } else { try { nt.call(); } catch (_t) { xe = _t; } - U.call(nt.prototype); + j.call(nt.prototype); } } else { try { @@ -278,22 +278,22 @@ function TR() { } catch (_t) { xe = _t; } - U(); + j(); } } catch (_t) { if (_t && xe && typeof _t.stack == "string") { - for (var Ue = _t.stack.split(` + for (var je = _t.stack.split(` `), pt = xe.stack.split(` -`), it = Ue.length - 1, et = pt.length - 1; it >= 1 && et >= 0 && Ue[it] !== pt[et]; ) +`), it = je.length - 1, et = pt.length - 1; it >= 1 && et >= 0 && je[it] !== pt[et]; ) et--; for (; it >= 1 && et >= 0; it--, et--) - if (Ue[it] !== pt[et]) { + if (je[it] !== pt[et]) { if (it !== 1 || et !== 1) do - if (it--, et--, et < 0 || Ue[it] !== pt[et]) { + if (it--, et--, et < 0 || je[it] !== pt[et]) { var St = ` -` + Ue[it].replace(" at new ", " at "); - return U.displayName && St.includes("") && (St = St.replace("", U.displayName)), typeof U == "function" && T.set(U, St), St; +` + je[it].replace(" at new ", " at "); + return j.displayName && St.includes("") && (St = St.replace("", j.displayName)), typeof j == "function" && T.set(j, St), St; } while (it >= 1 && et >= 0); break; @@ -302,39 +302,39 @@ function TR() { } finally { Q = !1, oe.current = Re, D(), Error.prepareStackTrace = Te; } - var Tt = U ? U.displayName || U.name : "", At = Tt ? J(Tt) : ""; - return typeof U == "function" && T.set(U, At), At; + var Tt = j ? j.displayName || j.name : "", At = Tt ? J(Tt) : ""; + return typeof j == "function" && T.set(j, At), At; } - function de(U, se, he) { - return re(U, !1); + function pe(j, se, de) { + return re(j, !1); } - function ie(U) { - var se = U.prototype; + function ie(j) { + var se = j.prototype; return !!(se && se.isReactComponent); } - function ue(U, se, he) { - if (U == null) + function ue(j, se, de) { + if (j == null) return ""; - if (typeof U == "function") - return re(U, ie(U)); - if (typeof U == "string") - return J(U); - switch (U) { + if (typeof j == "function") + return re(j, ie(j)); + if (typeof j == "string") + return J(j); + switch (j) { case l: return J("Suspense"); case d: return J("SuspenseList"); } - if (typeof U == "object") - switch (U.$$typeof) { + if (typeof j == "object") + switch (j.$$typeof) { case u: - return de(U.render); - case g: - return ue(U.type, se, he); + return pe(j.render); + case p: + return ue(j.type, se, de); case w: { - var xe = U, Te = xe._payload, Re = xe._init; + var xe = j, Te = xe._payload, Re = xe._init; try { - return ue(Re(Te), se, he); + return ue(Re(Te), se, de); } catch { } } @@ -342,55 +342,55 @@ function TR() { return ""; } var ve = Object.prototype.hasOwnProperty, Pe = {}, De = $.ReactDebugCurrentFrame; - function Ce(U) { - if (U) { - var se = U._owner, he = ue(U.type, U._source, se ? se.type : null); - De.setExtraStackFrame(he); + function Ce(j) { + if (j) { + var se = j._owner, de = ue(j.type, j._source, se ? se.type : null); + De.setExtraStackFrame(de); } else De.setExtraStackFrame(null); } - function $e(U, se, he, xe, Te) { + function $e(j, se, de, xe, Te) { { var Re = Function.call.bind(ve); - for (var nt in U) - if (Re(U, nt)) { - var Ue = void 0; + for (var nt in j) + if (Re(j, nt)) { + var je = void 0; try { - if (typeof U[nt] != "function") { - var pt = Error((xe || "React class") + ": " + he + " type `" + nt + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof U[nt] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); + if (typeof j[nt] != "function") { + var pt = Error((xe || "React class") + ": " + de + " type `" + nt + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof j[nt] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw pt.name = "Invariant Violation", pt; } - Ue = U[nt](se, nt, xe, he, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); + je = j[nt](se, nt, xe, de, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (it) { - Ue = it; + je = it; } - Ue && !(Ue instanceof Error) && (Ce(Te), F("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", xe || "React class", he, nt, typeof Ue), Ce(null)), Ue instanceof Error && !(Ue.message in Pe) && (Pe[Ue.message] = !0, Ce(Te), F("Failed %s type: %s", he, Ue.message), Ce(null)); + je && !(je instanceof Error) && (Ce(Te), B("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", xe || "React class", de, nt, typeof je), Ce(null)), je instanceof Error && !(je.message in Pe) && (Pe[je.message] = !0, Ce(Te), B("Failed %s type: %s", de, je.message), Ce(null)); } } } var Me = Array.isArray; - function Ne(U) { - return Me(U); + function Ne(j) { + return Me(j); } - function Ke(U) { + function Ke(j) { { - var se = typeof Symbol == "function" && Symbol.toStringTag, he = se && U[Symbol.toStringTag] || U.constructor.name || "Object"; - return he; + var se = typeof Symbol == "function" && Symbol.toStringTag, de = se && j[Symbol.toStringTag] || j.constructor.name || "Object"; + return de; } } - function Le(U) { + function Le(j) { try { - return qe(U), !1; + return qe(j), !1; } catch { return !0; } } - function qe(U) { - return "" + U; + function qe(j) { + return "" + j; } - function ze(U) { - if (Le(U)) - return F("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(U)), qe(U); + function ze(j) { + if (Le(j)) + return B("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(j)), qe(j); } var _e = $.ReactCurrentOwner, Ze = { key: !0, @@ -399,220 +399,220 @@ function TR() { __source: !0 }, at, ke, Qe; Qe = {}; - function tt(U) { - if (ve.call(U, "ref")) { - var se = Object.getOwnPropertyDescriptor(U, "ref").get; + function tt(j) { + if (ve.call(j, "ref")) { + var se = Object.getOwnPropertyDescriptor(j, "ref").get; if (se && se.isReactWarning) return !1; } - return U.ref !== void 0; + return j.ref !== void 0; } - function Ye(U) { - if (ve.call(U, "key")) { - var se = Object.getOwnPropertyDescriptor(U, "key").get; + function Ye(j) { + if (ve.call(j, "key")) { + var se = Object.getOwnPropertyDescriptor(j, "key").get; if (se && se.isReactWarning) return !1; } - return U.key !== void 0; + return j.key !== void 0; } - function dt(U, se) { - if (typeof U.ref == "string" && _e.current && se && _e.current.stateNode !== se) { - var he = m(_e.current.type); - Qe[he] || (F('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', m(_e.current.type), U.ref), Qe[he] = !0); + function dt(j, se) { + if (typeof j.ref == "string" && _e.current && se && _e.current.stateNode !== se) { + var de = m(_e.current.type); + Qe[de] || (B('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', m(_e.current.type), j.ref), Qe[de] = !0); } } - function lt(U, se) { + function lt(j, se) { { - var he = function() { - at || (at = !0, F("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); + var de = function() { + at || (at = !0, B("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); }; - he.isReactWarning = !0, Object.defineProperty(U, "key", { - get: he, + de.isReactWarning = !0, Object.defineProperty(j, "key", { + get: de, configurable: !0 }); } } - function ct(U, se) { + function ct(j, se) { { - var he = function() { - ke || (ke = !0, F("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); + var de = function() { + ke || (ke = !0, B("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); }; - he.isReactWarning = !0, Object.defineProperty(U, "ref", { - get: he, + de.isReactWarning = !0, Object.defineProperty(j, "ref", { + get: de, configurable: !0 }); } } - var qt = function(U, se, he, xe, Te, Re, nt) { - var Ue = { + var qt = function(j, se, de, xe, Te, Re, nt) { + var je = { // This tag allows us to uniquely identify this as a React Element $$typeof: e, // Built-in properties that belong on the element - type: U, + type: j, key: se, - ref: he, + ref: de, props: nt, // Record the component responsible for creating this element. _owner: Re }; - return Ue._store = {}, Object.defineProperty(Ue._store, "validated", { + return je._store = {}, Object.defineProperty(je._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: !1 - }), Object.defineProperty(Ue, "_self", { + }), Object.defineProperty(je, "_self", { configurable: !1, enumerable: !1, writable: !1, value: xe - }), Object.defineProperty(Ue, "_source", { + }), Object.defineProperty(je, "_source", { configurable: !1, enumerable: !1, writable: !1, value: Te - }), Object.freeze && (Object.freeze(Ue.props), Object.freeze(Ue)), Ue; + }), Object.freeze && (Object.freeze(je.props), Object.freeze(je)), je; }; - function Yt(U, se, he, xe, Te) { + function Jt(j, se, de, xe, Te) { { - var Re, nt = {}, Ue = null, pt = null; - he !== void 0 && (ze(he), Ue = "" + he), Ye(se) && (ze(se.key), Ue = "" + se.key), tt(se) && (pt = se.ref, dt(se, Te)); + var Re, nt = {}, je = null, pt = null; + de !== void 0 && (ze(de), je = "" + de), Ye(se) && (ze(se.key), je = "" + se.key), tt(se) && (pt = se.ref, dt(se, Te)); for (Re in se) ve.call(se, Re) && !Ze.hasOwnProperty(Re) && (nt[Re] = se[Re]); - if (U && U.defaultProps) { - var it = U.defaultProps; + if (j && j.defaultProps) { + var it = j.defaultProps; for (Re in it) nt[Re] === void 0 && (nt[Re] = it[Re]); } - if (Ue || pt) { - var et = typeof U == "function" ? U.displayName || U.name || "Unknown" : U; - Ue && lt(nt, et), pt && ct(nt, et); + if (je || pt) { + var et = typeof j == "function" ? j.displayName || j.name || "Unknown" : j; + je && lt(nt, et), pt && ct(nt, et); } - return qt(U, Ue, pt, Te, xe, _e.current, nt); + return qt(j, je, pt, Te, xe, _e.current, nt); } } - var Et = $.ReactCurrentOwner, Qt = $.ReactDebugCurrentFrame; - function Jt(U) { - if (U) { - var se = U._owner, he = ue(U.type, U._source, se ? se.type : null); - Qt.setExtraStackFrame(he); + var Et = $.ReactCurrentOwner, er = $.ReactDebugCurrentFrame; + function Xt(j) { + if (j) { + var se = j._owner, de = ue(j.type, j._source, se ? se.type : null); + er.setExtraStackFrame(de); } else - Qt.setExtraStackFrame(null); + er.setExtraStackFrame(null); } var Dt; Dt = !1; - function kt(U) { - return typeof U == "object" && U !== null && U.$$typeof === e; + function kt(j) { + return typeof j == "object" && j !== null && j.$$typeof === e; } function Ct() { { if (Et.current) { - var U = m(Et.current.type); - if (U) + var j = m(Et.current.type); + if (j) return ` -Check the render method of \`` + U + "`."; +Check the render method of \`` + j + "`."; } return ""; } } - function gt(U) { + function gt(j) { return ""; } var Rt = {}; - function Nt(U) { + function Nt(j) { { var se = Ct(); if (!se) { - var he = typeof U == "string" ? U : U.displayName || U.name; - he && (se = ` + var de = typeof j == "string" ? j : j.displayName || j.name; + de && (se = ` -Check the top-level render call using <` + he + ">."); +Check the top-level render call using <` + de + ">."); } return se; } } - function vt(U, se) { + function vt(j, se) { { - if (!U._store || U._store.validated || U.key != null) + if (!j._store || j._store.validated || j.key != null) return; - U._store.validated = !0; - var he = Nt(se); - if (Rt[he]) + j._store.validated = !0; + var de = Nt(se); + if (Rt[de]) return; - Rt[he] = !0; + Rt[de] = !0; var xe = ""; - U && U._owner && U._owner !== Et.current && (xe = " It was passed a child from " + m(U._owner.type) + "."), Jt(U), F('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', he, xe), Jt(null); + j && j._owner && j._owner !== Et.current && (xe = " It was passed a child from " + m(j._owner.type) + "."), Xt(j), B('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', de, xe), Xt(null); } } - function $t(U, se) { + function $t(j, se) { { - if (typeof U != "object") + if (typeof j != "object") return; - if (Ne(U)) - for (var he = 0; he < U.length; he++) { - var xe = U[he]; + if (Ne(j)) + for (var de = 0; de < j.length; de++) { + var xe = j[de]; kt(xe) && vt(xe, se); } - else if (kt(U)) - U._store && (U._store.validated = !0); - else if (U) { - var Te = L(U); - if (typeof Te == "function" && Te !== U.entries) - for (var Re = Te.call(U), nt; !(nt = Re.next()).done; ) + else if (kt(j)) + j._store && (j._store.validated = !0); + else if (j) { + var Te = L(j); + if (typeof Te == "function" && Te !== j.entries) + for (var Re = Te.call(j), nt; !(nt = Re.next()).done; ) kt(nt.value) && vt(nt.value, se); } } } - function Bt(U) { + function Ft(j) { { - var se = U.type; + var se = j.type; if (se == null || typeof se == "string") return; - var he; + var de; if (typeof se == "function") - he = se.propTypes; + de = se.propTypes; else if (typeof se == "object" && (se.$$typeof === u || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. - se.$$typeof === g)) - he = se.propTypes; + se.$$typeof === p)) + de = se.propTypes; else return; - if (he) { + if (de) { var xe = m(se); - $e(he, U.props, "prop", xe, U); + $e(de, j.props, "prop", xe, j); } else if (se.PropTypes !== void 0 && !Dt) { Dt = !0; var Te = m(se); - F("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Te || "Unknown"); + B("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Te || "Unknown"); } - typeof se.getDefaultProps == "function" && !se.getDefaultProps.isReactClassApproved && F("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); + typeof se.getDefaultProps == "function" && !se.getDefaultProps.isReactClassApproved && B("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } - function rt(U) { + function rt(j) { { - for (var se = Object.keys(U.props), he = 0; he < se.length; he++) { - var xe = se[he]; + for (var se = Object.keys(j.props), de = 0; de < se.length; de++) { + var xe = se[de]; if (xe !== "children" && xe !== "key") { - Jt(U), F("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", xe), Jt(null); + Xt(j), B("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", xe), Xt(null); break; } } - U.ref !== null && (Jt(U), F("Invalid attribute `ref` supplied to `React.Fragment`."), Jt(null)); + j.ref !== null && (Xt(j), B("Invalid attribute `ref` supplied to `React.Fragment`."), Xt(null)); } } - var Ft = {}; - function k(U, se, he, xe, Te, Re) { + var Bt = {}; + function k(j, se, de, xe, Te, Re) { { - var nt = Ee(U); + var nt = Ee(j); if (!nt) { - var Ue = ""; - (U === void 0 || typeof U == "object" && U !== null && Object.keys(U).length === 0) && (Ue += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); + var je = ""; + (j === void 0 || typeof j == "object" && j !== null && Object.keys(j).length === 0) && (je += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); var pt = gt(); - pt ? Ue += pt : Ue += Ct(); + pt ? je += pt : je += Ct(); var it; - U === null ? it = "null" : Ne(U) ? it = "array" : U !== void 0 && U.$$typeof === e ? (it = "<" + (m(U.type) || "Unknown") + " />", Ue = " Did you accidentally export a JSX literal instead of a component?") : it = typeof U, F("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", it, Ue); + j === null ? it = "null" : Ne(j) ? it = "array" : j !== void 0 && j.$$typeof === e ? (it = "<" + (m(j.type) || "Unknown") + " />", je = " Did you accidentally export a JSX literal instead of a component?") : it = typeof j, B("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", it, je); } - var et = Yt(U, se, he, Te, Re); + var et = Jt(j, se, de, Te, Re); if (et == null) return et; if (nt) { @@ -621,48 +621,48 @@ Check the top-level render call using <` + he + ">."); if (xe) if (Ne(St)) { for (var Tt = 0; Tt < St.length; Tt++) - $t(St[Tt], U); + $t(St[Tt], j); Object.freeze && Object.freeze(St); } else - F("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); + B("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else - $t(St, U); + $t(St, j); } if (ve.call(se, "key")) { - var At = m(U), _t = Object.keys(se).filter(function(st) { + var At = m(j), _t = Object.keys(se).filter(function(st) { return st !== "key"; }), ht = _t.length > 0 ? "{key: someKey, " + _t.join(": ..., ") + ": ...}" : "{key: someKey}"; - if (!Ft[At + ht]) { + if (!Bt[At + ht]) { var xt = _t.length > 0 ? "{" + _t.join(": ..., ") + ": ...}" : "{}"; - F(`A props object containing a "key" prop is being spread into JSX: + B(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; - <%s key={someKey} {...props} />`, ht, At, xt, At), Ft[At + ht] = !0; + <%s key={someKey} {...props} />`, ht, At, xt, At), Bt[At + ht] = !0; } } - return U === n ? rt(et) : Bt(et), et; + return j === n ? rt(et) : Ft(et), et; } } - function j(U, se, he) { - return k(U, se, he, !0); + function U(j, se, de) { + return k(j, se, de, !0); } - function z(U, se, he) { - return k(U, se, he, !1); + function z(j, se, de) { + return k(j, se, de, !1); } - var C = z, G = j; - gf.Fragment = n, gf.jsx = C, gf.jsxs = G; - }()), gf; + var C = z, G = U; + mf.Fragment = n, mf.jsx = C, mf.jsxs = G; + }()), mf; } -process.env.NODE_ENV === "production" ? Ym.exports = CR() : Ym.exports = TR(); -var me = Ym.exports; -const Ds = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", RR = [ +process.env.NODE_ENV === "production" ? Ym.exports = FR() : Ym.exports = jR(); +var fe = Ym.exports; +const Os = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", UR = [ { featured: !0, name: "MetaMask", rdns: "io.metamask", - image: `${Ds}#metamask`, + image: `${Os}#metamask`, getWallet: { chrome_store_id: "nkbihfbeogaeaoehlefnkodbefgpgknn", brave_store_id: "nkbihfbeogaeaoehlefnkodbefgpgknn", @@ -678,7 +678,7 @@ const Ds = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", RR featured: !0, name: "OKX Wallet", rdns: "com.okex.wallet", - image: `${Ds}#okx`, + image: `${Os}#okx`, getWallet: { chrome_store_id: "mcohilncbfahbmgdjkbpemcciiolgcge", brave_store_id: "mcohilncbfahbmgdjkbpemcciiolgcge", @@ -692,18 +692,18 @@ const Ds = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", RR { featured: !0, name: "WalletConnect", - image: `${Ds}#walletconnect` + image: `${Os}#walletconnect` }, { featured: !1, name: "Coinbase Wallet", - image: `${Ds}#coinbase` + image: `${Os}#coinbase` }, { featured: !1, name: "GateWallet", rdns: "io.gate.wallet", - image: `${Ds}#6e528abf-7a7d-47bd-d84d-481f169b1200`, + image: `${Os}#6e528abf-7a7d-47bd-d84d-481f169b1200`, getWallet: { chrome_store_id: "cpmkedoipcpimgecpmgpldfpohjplkpp", brave_store_id: "cpmkedoipcpimgecpmgpldfpohjplkpp", @@ -718,7 +718,7 @@ const Ds = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", RR featured: !1, name: "Onekey", rdns: "so.onekey.app.wallet", - image: `${Ds}#onekey`, + image: `${Os}#onekey`, getWallet: { chrome_store_id: "jnmbobjmhlngoefaiojfljckilhhlhcj", brave_store_id: "jnmbobjmhlngoefaiojfljckilhhlhcj", @@ -731,14 +731,14 @@ const Ds = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", RR { featured: !1, name: "Infinity Wallet", - image: `${Ds}#9f259366-0bcd-4817-0af9-f78773e41900`, + image: `${Os}#9f259366-0bcd-4817-0af9-f78773e41900`, desktop_link: "infinity://wc" }, { name: "Rabby Wallet", rdns: "io.rabby", featured: !1, - image: `${Ds}#rabby`, + image: `${Os}#rabby`, getWallet: { chrome_store_id: "acmacodkjbdgmoleebolmdjonilkdbch", brave_store_id: "acmacodkjbdgmoleebolmdjonilkdbch", @@ -749,7 +749,7 @@ const Ds = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", RR { name: "Binance Web3 Wallet", featured: !1, - image: `${Ds}#ebac7b39-688c-41e3-7912-a4fefba74600`, + image: `${Os}#ebac7b39-688c-41e3-7912-a4fefba74600`, getWallet: { play_store_id: "com.binance.dev", app_store_id: "id1436799971" @@ -759,7 +759,7 @@ const Ds = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", RR name: "Rainbow Wallet", rdns: "me.rainbow", featured: !1, - image: `${Ds}#rainbow`, + image: `${Os}#rainbow`, getWallet: { chrome_store_id: "opfgelmcmbiajamepnmloijbpoleiama", edge_addon_id: "cpojfbodiccabbabgimdeohkkpjfpbnf", @@ -769,21 +769,21 @@ const Ds = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", RR } } ]; -function DR(t, e) { +function qR(t, e) { const r = t.exec(e); return r == null ? void 0 : r.groups; } -const g2 = /^tuple(?(\[(\d*)\])*)$/; +const v2 = /^tuple(?(\[(\d*)\])*)$/; function Jm(t) { let e = t.type; - if (g2.test(t.type) && "components" in t) { + if (v2.test(t.type) && "components" in t) { e = "("; const r = t.components.length; for (let i = 0; i < r; i++) { const s = t.components[i]; e += Jm(s), i < r - 1 && (e += ", "); } - const n = DR(g2, t.type); + const n = qR(v2, t.type); return e += `)${(n == null ? void 0 : n.array) ?? ""}`, Jm({ ...t, type: e @@ -791,7 +791,7 @@ function Jm(t) { } return "indexed" in t && t.indexed && (e = `${e} indexed`), t.name ? `${e} ${t.name}` : e; } -function mf(t) { +function vf(t) { let e = ""; const r = t.length; for (let n = 0; n < r; n++) { @@ -800,37 +800,37 @@ function mf(t) { } return e; } -function OR(t) { - return t.type === "function" ? `function ${t.name}(${mf(t.inputs)})${t.stateMutability && t.stateMutability !== "nonpayable" ? ` ${t.stateMutability}` : ""}${t.outputs.length ? ` returns (${mf(t.outputs)})` : ""}` : t.type === "event" ? `event ${t.name}(${mf(t.inputs)})` : t.type === "error" ? `error ${t.name}(${mf(t.inputs)})` : t.type === "constructor" ? `constructor(${mf(t.inputs)})${t.stateMutability === "payable" ? " payable" : ""}` : t.type === "fallback" ? "fallback()" : "receive() external payable"; +function zR(t) { + return t.type === "function" ? `function ${t.name}(${vf(t.inputs)})${t.stateMutability && t.stateMutability !== "nonpayable" ? ` ${t.stateMutability}` : ""}${t.outputs.length ? ` returns (${vf(t.outputs)})` : ""}` : t.type === "event" ? `event ${t.name}(${vf(t.inputs)})` : t.type === "error" ? `error ${t.name}(${vf(t.inputs)})` : t.type === "constructor" ? `constructor(${vf(t.inputs)})${t.stateMutability === "payable" ? " payable" : ""}` : t.type === "fallback" ? "fallback()" : "receive() external payable"; } -function vi(t, e, r) { +function bi(t, e, r) { const n = t[e.name]; if (typeof n == "function") return n; const i = t[r]; return typeof i == "function" ? i : (s) => e(t, s); } -function mu(t, { includeName: e = !1 } = {}) { +function vu(t, { includeName: e = !1 } = {}) { if (t.type !== "function" && t.type !== "event" && t.type !== "error") - throw new WR(t.type); + throw new tD(t.type); return `${t.name}(${yv(t.inputs, { includeName: e })})`; } function yv(t, { includeName: e = !1 } = {}) { - return t ? t.map((r) => NR(r, { includeName: e })).join(e ? ", " : ",") : ""; + return t ? t.map((r) => WR(r, { includeName: e })).join(e ? ", " : ",") : ""; } -function NR(t, { includeName: e }) { +function WR(t, { includeName: e }) { return t.type.startsWith("tuple") ? `(${yv(t.components, { includeName: e })})${t.type.slice(5)}` : t.type + (e && t.name ? ` ${t.name}` : ""); } -function ma(t, { strict: e = !0 } = {}) { +function ya(t, { strict: e = !0 } = {}) { return !t || typeof t != "string" ? !1 : e ? /^0x[0-9a-fA-F]*$/.test(t) : t.startsWith("0x"); } function An(t) { - return ma(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length; + return ya(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length; } -const w5 = "2.21.45"; -let vf = { +const _5 = "2.21.45"; +let bf = { getDocsUrl: ({ docsBaseUrl: t, docsPath: e = "", docsSlug: r }) => e ? `${t ?? "https://viem.sh"}${e}${r ? `#${r}` : ""}` : void 0, - version: `viem@${w5}` + version: `viem@${_5}` }; class yt extends Error { constructor(e, r = {}) { @@ -838,13 +838,13 @@ class yt extends Error { const n = (() => { var u; return r.cause instanceof yt ? r.cause.details : (u = r.cause) != null && u.message ? r.cause.message : r.details; - })(), i = r.cause instanceof yt && r.cause.docsPath || r.docsPath, s = (a = vf.getDocsUrl) == null ? void 0 : a.call(vf, { ...r, docsPath: i }), o = [ + })(), i = r.cause instanceof yt && r.cause.docsPath || r.docsPath, s = (a = bf.getDocsUrl) == null ? void 0 : a.call(bf, { ...r, docsPath: i }), o = [ e || "An error occurred.", "", ...r.metaMessages ? [...r.metaMessages, ""] : [], ...s ? [`Docs: ${s}`] : [], ...n ? [`Details: ${n}`] : [], - ...vf.version ? [`Version: ${vf.version}`] : [] + ...bf.version ? [`Version: ${bf.version}`] : [] ].join(` `); super(o, r.cause ? { cause: r.cause } : void 0), Object.defineProperty(this, "details", { @@ -877,16 +877,16 @@ class yt extends Error { configurable: !0, writable: !0, value: "BaseError" - }), this.details = n, this.docsPath = i, this.metaMessages = r.metaMessages, this.name = r.name ?? this.name, this.shortMessage = e, this.version = w5; + }), this.details = n, this.docsPath = i, this.metaMessages = r.metaMessages, this.name = r.name ?? this.name, this.shortMessage = e, this.version = _5; } walk(e) { - return x5(this, e); + return E5(this, e); } } -function x5(t, e) { - return e != null && e(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ? x5(t.cause, e) : e ? null : t; +function E5(t, e) { + return e != null && e(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ? E5(t.cause, e) : e ? null : t; } -class LR extends yt { +class HR extends yt { constructor({ docsPath: e }) { super([ "A constructor was not found on the ABI.", @@ -898,7 +898,7 @@ class LR extends yt { }); } } -class m2 extends yt { +class b2 extends yt { constructor({ docsPath: e }) { super([ "Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.", @@ -910,7 +910,7 @@ class m2 extends yt { }); } } -class kR extends yt { +class KR extends yt { constructor({ data: e, params: r, size: n }) { super([`Data size of ${n} bytes is too small for given parameters.`].join(` `), { @@ -944,7 +944,7 @@ class wv extends yt { }); } } -class $R extends yt { +class VR extends yt { constructor({ expectedLength: e, givenLength: r, type: n }) { super([ `ABI encoding array length mismatch for type ${n}.`, @@ -954,12 +954,12 @@ class $R extends yt { `), { name: "AbiEncodingArrayLengthMismatchError" }); } } -class FR extends yt { +class GR extends yt { constructor({ expectedSize: e, value: r }) { super(`Size of bytes "${r}" (bytes${An(r)}) does not match expected size (bytes${e}).`, { name: "AbiEncodingBytesSizeMismatchError" }); } } -class BR extends yt { +class YR extends yt { constructor({ expectedLength: e, givenLength: r }) { super([ "ABI encoding params/values length mismatch.", @@ -969,7 +969,7 @@ class BR extends yt { `), { name: "AbiEncodingLengthMismatchError" }); } } -class _5 extends yt { +class S5 extends yt { constructor(e, { docsPath: r }) { super([ `Encoded error signature "${e}" not found on ABI.`, @@ -987,7 +987,7 @@ class _5 extends yt { }), this.signature = e; } } -class v2 extends yt { +class y2 extends yt { constructor(e, { docsPath: r } = {}) { super([ `Function ${e ? `"${e}" ` : ""}not found on ABI.`, @@ -999,12 +999,12 @@ class v2 extends yt { }); } } -class UR extends yt { +class JR extends yt { constructor(e, r) { super("Found ambiguous types in overloaded ABI items.", { metaMessages: [ - `\`${e.type}\` in \`${mu(e.abiItem)}\`, and`, - `\`${r.type}\` in \`${mu(r.abiItem)}\``, + `\`${e.type}\` in \`${vu(e.abiItem)}\`, and`, + `\`${r.type}\` in \`${vu(r.abiItem)}\``, "", "These types encode differently and cannot be distinguished at runtime.", "Remove one of the ambiguous items in the ABI." @@ -1013,14 +1013,14 @@ class UR extends yt { }); } } -class jR extends yt { +class XR extends yt { constructor({ expectedSize: e, givenSize: r }) { super(`Expected bytes${e}, got bytes${r}.`, { name: "BytesSizeMismatchError" }); } } -class qR extends yt { +class ZR extends yt { constructor(e, { docsPath: r }) { super([ `Type "${e}" is not a valid encoding type.`, @@ -1029,7 +1029,7 @@ class qR extends yt { `), { docsPath: r, name: "InvalidAbiEncodingType" }); } } -class zR extends yt { +class QR extends yt { constructor(e, { docsPath: r }) { super([ `Type "${e}" is not a valid decoding type.`, @@ -1038,7 +1038,7 @@ class zR extends yt { `), { docsPath: r, name: "InvalidAbiDecodingType" }); } } -class HR extends yt { +class eD extends yt { constructor(e) { super([`Value "${e}" is not a valid array.`].join(` `), { @@ -1046,7 +1046,7 @@ class HR extends yt { }); } } -class WR extends yt { +class tD extends yt { constructor(e) { super([ `"${e}" is not a valid definition type.`, @@ -1055,41 +1055,41 @@ class WR extends yt { `), { name: "InvalidDefinitionTypeError" }); } } -class E5 extends yt { +class A5 extends yt { constructor({ offset: e, position: r, size: n }) { super(`Slice ${r === "start" ? "starting" : "ending"} at offset "${e}" is out-of-bounds (size: ${n}).`, { name: "SliceOffsetOutOfBoundsError" }); } } -class S5 extends yt { +class P5 extends yt { constructor({ size: e, targetSize: r, type: n }) { super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`, { name: "SizeExceedsPaddingSizeError" }); } } -class b2 extends yt { +class w2 extends yt { constructor({ size: e, targetSize: r, type: n }) { super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`, { name: "InvalidBytesLengthError" }); } } -function Cu(t, { dir: e, size: r = 32 } = {}) { - return typeof t == "string" ? ga(t, { dir: e, size: r }) : KR(t, { dir: e, size: r }); +function Tu(t, { dir: e, size: r = 32 } = {}) { + return typeof t == "string" ? ba(t, { dir: e, size: r }) : rD(t, { dir: e, size: r }); } -function ga(t, { dir: e, size: r = 32 } = {}) { +function ba(t, { dir: e, size: r = 32 } = {}) { if (r === null) return t; const n = t.replace("0x", ""); if (n.length > r * 2) - throw new S5({ + throw new P5({ size: Math.ceil(n.length / 2), targetSize: r, type: "hex" }); return `0x${n[e === "right" ? "padEnd" : "padStart"](r * 2, "0")}`; } -function KR(t, { dir: e, size: r = 32 } = {}) { +function rD(t, { dir: e, size: r = 32 } = {}) { if (r === null) return t; if (t.length > r) - throw new S5({ + throw new P5({ size: t.length, targetSize: r, type: "bytes" @@ -1101,19 +1101,19 @@ function KR(t, { dir: e, size: r = 32 } = {}) { } return n; } -class VR extends yt { +class nD extends yt { constructor({ max: e, min: r, signed: n, size: i, value: s }) { super(`Number "${s}" is not in safe ${i ? `${i * 8}-bit ${n ? "signed" : "unsigned"} ` : ""}integer range ${e ? `(${r} to ${e})` : `(above ${r})`}`, { name: "IntegerOutOfRangeError" }); } } -class GR extends yt { +class iD extends yt { constructor(e) { super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, { name: "InvalidBytesBooleanError" }); } } -class YR extends yt { +class sD extends yt { constructor({ givenSize: e, maxSize: r }) { super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" }); } @@ -1124,39 +1124,39 @@ function xv(t, { dir: e = "left" } = {}) { n++; return r = e === "left" ? r.slice(n) : r.slice(0, r.length - n), typeof t == "string" ? (r.length === 1 && e === "right" && (r = `${r}0`), `0x${r.length % 2 === 1 ? `0${r}` : r}`) : r; } -function eo(t, { size: e }) { +function ro(t, { size: e }) { if (An(t) > e) - throw new YR({ + throw new sD({ givenSize: An(t), maxSize: e }); } -function Qf(t, e = {}) { +function el(t, e = {}) { const { signed: r } = e; - e.size && eo(t, { size: e.size }); + e.size && ro(t, { size: e.size }); const n = BigInt(t); if (!r) return n; const i = (t.length - 2) / 2, s = (1n << BigInt(i) * 8n - 1n) - 1n; return n <= s ? n : n - BigInt(`0x${"f".padStart(i * 2, "f")}`) - 1n; } -function vu(t, e = {}) { - return Number(Qf(t, e)); +function bu(t, e = {}) { + return Number(el(t, e)); } -const JR = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); -function qd(t, e = {}) { - return typeof t == "number" || typeof t == "bigint" ? Mr(t, e) : typeof t == "string" ? M0(t, e) : typeof t == "boolean" ? A5(t, e) : wi(t, e); +const oD = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); +function zd(t, e = {}) { + return typeof t == "number" || typeof t == "bigint" ? Mr(t, e) : typeof t == "string" ? I0(t, e) : typeof t == "boolean" ? M5(t, e) : wi(t, e); } -function A5(t, e = {}) { +function M5(t, e = {}) { const r = `0x${Number(t)}`; - return typeof e.size == "number" ? (eo(r, { size: e.size }), Cu(r, { size: e.size })) : r; + return typeof e.size == "number" ? (ro(r, { size: e.size }), Tu(r, { size: e.size })) : r; } function wi(t, e = {}) { let r = ""; for (let i = 0; i < t.length; i++) - r += JR[t[i]]; + r += oD[t[i]]; const n = `0x${r}`; - return typeof e.size == "number" ? (eo(n, { size: e.size }), Cu(n, { dir: "right", size: e.size })) : n; + return typeof e.size == "number" ? (ro(n, { size: e.size }), Tu(n, { dir: "right", size: e.size })) : n; } function Mr(t, e = {}) { const { signed: r, size: n } = e, i = BigInt(t); @@ -1165,7 +1165,7 @@ function Mr(t, e = {}) { const o = typeof s == "bigint" && r ? -s - 1n : 0; if (s && i > s || i < o) { const u = typeof t == "bigint" ? "n" : ""; - throw new VR({ + throw new nD({ max: s ? `${s}${u}` : void 0, min: `${o}${u}`, signed: r, @@ -1174,22 +1174,22 @@ function Mr(t, e = {}) { }); } const a = `0x${(r && i < 0 ? (1n << BigInt(n * 8)) + BigInt(i) : i).toString(16)}`; - return n ? Cu(a, { size: n }) : a; + return n ? Tu(a, { size: n }) : a; } -const XR = /* @__PURE__ */ new TextEncoder(); -function M0(t, e = {}) { - const r = XR.encode(t); +const aD = /* @__PURE__ */ new TextEncoder(); +function I0(t, e = {}) { + const r = aD.encode(t); return wi(r, e); } -const ZR = /* @__PURE__ */ new TextEncoder(); +const cD = /* @__PURE__ */ new TextEncoder(); function _v(t, e = {}) { - return typeof t == "number" || typeof t == "bigint" ? eD(t, e) : typeof t == "boolean" ? QR(t, e) : ma(t) ? No(t, e) : P5(t, e); + return typeof t == "number" || typeof t == "bigint" ? fD(t, e) : typeof t == "boolean" ? uD(t, e) : ya(t) ? ko(t, e) : I5(t, e); } -function QR(t, e = {}) { +function uD(t, e = {}) { const r = new Uint8Array(1); - return r[0] = Number(t), typeof e.size == "number" ? (eo(r, { size: e.size }), Cu(r, { size: e.size })) : r; + return r[0] = Number(t), typeof e.size == "number" ? (ro(r, { size: e.size }), Tu(r, { size: e.size })) : r; } -const po = { +const vo = { zero: 48, nine: 57, A: 65, @@ -1197,53 +1197,53 @@ const po = { a: 97, f: 102 }; -function y2(t) { - if (t >= po.zero && t <= po.nine) - return t - po.zero; - if (t >= po.A && t <= po.F) - return t - (po.A - 10); - if (t >= po.a && t <= po.f) - return t - (po.a - 10); +function x2(t) { + if (t >= vo.zero && t <= vo.nine) + return t - vo.zero; + if (t >= vo.A && t <= vo.F) + return t - (vo.A - 10); + if (t >= vo.a && t <= vo.f) + return t - (vo.a - 10); } -function No(t, e = {}) { +function ko(t, e = {}) { let r = t; - e.size && (eo(r, { size: e.size }), r = Cu(r, { dir: "right", size: e.size })); + e.size && (ro(r, { size: e.size }), r = Tu(r, { dir: "right", size: e.size })); let n = r.slice(2); n.length % 2 && (n = `0${n}`); const i = n.length / 2, s = new Uint8Array(i); for (let o = 0, a = 0; o < i; o++) { - const u = y2(n.charCodeAt(a++)), l = y2(n.charCodeAt(a++)); + const u = x2(n.charCodeAt(a++)), l = x2(n.charCodeAt(a++)); if (u === void 0 || l === void 0) throw new yt(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`); s[o] = u * 16 + l; } return s; } -function eD(t, e) { +function fD(t, e) { const r = Mr(t, e); - return No(r); + return ko(r); } -function P5(t, e = {}) { - const r = ZR.encode(t); - return typeof e.size == "number" ? (eo(r, { size: e.size }), Cu(r, { dir: "right", size: e.size })) : r; +function I5(t, e = {}) { + const r = cD.encode(t); + return typeof e.size == "number" ? (ro(r, { size: e.size }), Tu(r, { dir: "right", size: e.size })) : r; } -function zd(t) { +function Wd(t) { if (!Number.isSafeInteger(t) || t < 0) throw new Error(`positive integer expected, not ${t}`); } -function tD(t) { +function lD(t) { return t instanceof Uint8Array || t != null && typeof t == "object" && t.constructor.name === "Uint8Array"; } -function Nl(t, ...e) { - if (!tD(t)) +function Ll(t, ...e) { + if (!lD(t)) throw new Error("Uint8Array expected"); if (e.length > 0 && !e.includes(t.length)) throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`); } -function use(t) { +function hse(t) { if (typeof t != "function" || typeof t.create != "function") throw new Error("Hash should be wrapped by utils.wrapConstructor"); - zd(t.outputLen), zd(t.blockLen); + Wd(t.outputLen), Wd(t.blockLen); } function Hd(t, e = !0) { if (t.destroyed) @@ -1251,52 +1251,52 @@ function Hd(t, e = !0) { if (e && t.finished) throw new Error("Hash#digest() has already been called"); } -function M5(t, e) { - Nl(t); +function C5(t, e) { + Ll(t); const r = e.outputLen; if (t.length < r) throw new Error(`digestInto() expects output buffer of length at least ${r}`); } -const td = /* @__PURE__ */ BigInt(2 ** 32 - 1), w2 = /* @__PURE__ */ BigInt(32); -function rD(t, e = !1) { - return e ? { h: Number(t & td), l: Number(t >> w2 & td) } : { h: Number(t >> w2 & td) | 0, l: Number(t & td) | 0 }; +const rd = /* @__PURE__ */ BigInt(2 ** 32 - 1), _2 = /* @__PURE__ */ BigInt(32); +function hD(t, e = !1) { + return e ? { h: Number(t & rd), l: Number(t >> _2 & rd) } : { h: Number(t >> _2 & rd) | 0, l: Number(t & rd) | 0 }; } -function nD(t, e = !1) { +function dD(t, e = !1) { let r = new Uint32Array(t.length), n = new Uint32Array(t.length); for (let i = 0; i < t.length; i++) { - const { h: s, l: o } = rD(t[i], e); + const { h: s, l: o } = hD(t[i], e); [r[i], n[i]] = [s, o]; } return [r, n]; } -const iD = (t, e, r) => t << r | e >>> 32 - r, sD = (t, e, r) => e << r | t >>> 32 - r, oD = (t, e, r) => e << r - 32 | t >>> 64 - r, aD = (t, e, r) => t << r - 32 | e >>> 64 - r, jc = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0; +const pD = (t, e, r) => t << r | e >>> 32 - r, gD = (t, e, r) => e << r | t >>> 32 - r, mD = (t, e, r) => e << r - 32 | t >>> 64 - r, vD = (t, e, r) => t << r - 32 | e >>> 64 - r, qc = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0; /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -const cD = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), Fg = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), Os = (t, e) => t << 32 - e | t >>> e, x2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, uD = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255; -function _2(t) { +const bD = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), Bg = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), Ns = (t, e) => t << 32 - e | t >>> e, E2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, yD = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255; +function S2(t) { for (let e = 0; e < t.length; e++) - t[e] = uD(t[e]); + t[e] = yD(t[e]); } -const fD = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); -function lD(t) { - Nl(t); +const wD = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); +function xD(t) { + Ll(t); let e = ""; for (let r = 0; r < t.length; r++) - e += fD[t[r]]; + e += wD[t[r]]; return e; } -function hD(t) { +function _D(t) { if (typeof t != "string") throw new Error(`utf8ToBytes expected string, got ${typeof t}`); return new Uint8Array(new TextEncoder().encode(t)); } -function I0(t) { - return typeof t == "string" && (t = hD(t)), Nl(t), t; +function C0(t) { + return typeof t == "string" && (t = _D(t)), Ll(t), t; } -function fse(...t) { +function dse(...t) { let e = 0; for (let n = 0; n < t.length; n++) { const i = t[n]; - Nl(i), e += i.length; + Ll(i), e += i.length; } const r = new Uint8Array(e); for (let n = 0, i = 0; n < t.length; n++) { @@ -1305,49 +1305,49 @@ function fse(...t) { } return r; } -class I5 { +class T5 { // Safe version that clones internal state clone() { return this._cloneInto(); } } -function C5(t) { - const e = (n) => t().update(I0(n)).digest(), r = t(); +function R5(t) { + const e = (n) => t().update(C0(n)).digest(), r = t(); return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = () => t(), e; } -function dD(t) { - const e = (n, i) => t(i).update(I0(n)).digest(), r = t({}); +function ED(t) { + const e = (n, i) => t(i).update(C0(n)).digest(), r = t({}); return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = (n) => t(n), e; } -function lse(t = 32) { - if (jc && typeof jc.getRandomValues == "function") - return jc.getRandomValues(new Uint8Array(t)); - if (jc && typeof jc.randomBytes == "function") - return jc.randomBytes(t); +function pse(t = 32) { + if (qc && typeof qc.getRandomValues == "function") + return qc.getRandomValues(new Uint8Array(t)); + if (qc && typeof qc.randomBytes == "function") + return qc.randomBytes(t); throw new Error("crypto.getRandomValues must be defined"); } -const T5 = [], R5 = [], D5 = [], pD = /* @__PURE__ */ BigInt(0), bf = /* @__PURE__ */ BigInt(1), gD = /* @__PURE__ */ BigInt(2), mD = /* @__PURE__ */ BigInt(7), vD = /* @__PURE__ */ BigInt(256), bD = /* @__PURE__ */ BigInt(113); -for (let t = 0, e = bf, r = 1, n = 0; t < 24; t++) { - [r, n] = [n, (2 * r + 3 * n) % 5], T5.push(2 * (5 * n + r)), R5.push((t + 1) * (t + 2) / 2 % 64); - let i = pD; +const D5 = [], O5 = [], N5 = [], SD = /* @__PURE__ */ BigInt(0), yf = /* @__PURE__ */ BigInt(1), AD = /* @__PURE__ */ BigInt(2), PD = /* @__PURE__ */ BigInt(7), MD = /* @__PURE__ */ BigInt(256), ID = /* @__PURE__ */ BigInt(113); +for (let t = 0, e = yf, r = 1, n = 0; t < 24; t++) { + [r, n] = [n, (2 * r + 3 * n) % 5], D5.push(2 * (5 * n + r)), O5.push((t + 1) * (t + 2) / 2 % 64); + let i = SD; for (let s = 0; s < 7; s++) - e = (e << bf ^ (e >> mD) * bD) % vD, e & gD && (i ^= bf << (bf << /* @__PURE__ */ BigInt(s)) - bf); - D5.push(i); + e = (e << yf ^ (e >> PD) * ID) % MD, e & AD && (i ^= yf << (yf << /* @__PURE__ */ BigInt(s)) - yf); + N5.push(i); } -const [yD, wD] = /* @__PURE__ */ nD(D5, !0), E2 = (t, e, r) => r > 32 ? oD(t, e, r) : iD(t, e, r), S2 = (t, e, r) => r > 32 ? aD(t, e, r) : sD(t, e, r); -function O5(t, e = 24) { +const [CD, TD] = /* @__PURE__ */ dD(N5, !0), A2 = (t, e, r) => r > 32 ? mD(t, e, r) : pD(t, e, r), P2 = (t, e, r) => r > 32 ? vD(t, e, r) : gD(t, e, r); +function L5(t, e = 24) { const r = new Uint32Array(10); for (let n = 24 - e; n < 24; n++) { for (let o = 0; o < 10; o++) r[o] = t[o] ^ t[o + 10] ^ t[o + 20] ^ t[o + 30] ^ t[o + 40]; for (let o = 0; o < 10; o += 2) { - const a = (o + 8) % 10, u = (o + 2) % 10, l = r[u], d = r[u + 1], g = E2(l, d, 1) ^ r[a], w = S2(l, d, 1) ^ r[a + 1]; + const a = (o + 8) % 10, u = (o + 2) % 10, l = r[u], d = r[u + 1], p = A2(l, d, 1) ^ r[a], w = P2(l, d, 1) ^ r[a + 1]; for (let A = 0; A < 50; A += 10) - t[o + A] ^= g, t[o + A + 1] ^= w; + t[o + A] ^= p, t[o + A + 1] ^= w; } let i = t[2], s = t[3]; for (let o = 0; o < 24; o++) { - const a = R5[o], u = E2(i, s, a), l = S2(i, s, a), d = T5[o]; + const a = O5[o], u = A2(i, s, a), l = P2(i, s, a), d = D5[o]; i = t[d], s = t[d + 1], t[d] = u, t[d + 1] = l; } for (let o = 0; o < 50; o += 10) { @@ -1356,24 +1356,24 @@ function O5(t, e = 24) { for (let a = 0; a < 10; a++) t[o + a] ^= ~r[(a + 2) % 10] & r[(a + 4) % 10]; } - t[0] ^= yD[n], t[1] ^= wD[n]; + t[0] ^= CD[n], t[1] ^= TD[n]; } r.fill(0); } -class Ll extends I5 { +class kl extends T5 { // NOTE: we accept arguments in bytes instead of bits here. constructor(e, r, n, i = !1, s = 24) { - if (super(), this.blockLen = e, this.suffix = r, this.outputLen = n, this.enableXOF = i, this.rounds = s, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, zd(n), 0 >= this.blockLen || this.blockLen >= 200) + if (super(), this.blockLen = e, this.suffix = r, this.outputLen = n, this.enableXOF = i, this.rounds = s, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, Wd(n), 0 >= this.blockLen || this.blockLen >= 200) throw new Error("Sha3 supports only keccak-f1600 function"); - this.state = new Uint8Array(200), this.state32 = cD(this.state); + this.state = new Uint8Array(200), this.state32 = bD(this.state); } keccak() { - x2 || _2(this.state32), O5(this.state32, this.rounds), x2 || _2(this.state32), this.posOut = 0, this.pos = 0; + E2 || S2(this.state32), L5(this.state32, this.rounds), E2 || S2(this.state32), this.posOut = 0, this.pos = 0; } update(e) { Hd(this); const { blockLen: r, state: n } = this; - e = I0(e); + e = C0(e); const i = e.length; for (let s = 0; s < i; ) { const o = Math.min(r - this.pos, i - s); @@ -1391,7 +1391,7 @@ class Ll extends I5 { e[n] ^= r, r & 128 && n === i - 1 && this.keccak(), e[i - 1] ^= 128, this.keccak(); } writeInto(e) { - Hd(this, !1), Nl(e), this.finish(); + Hd(this, !1), Ll(e), this.finish(); const r = this.state, { blockLen: n } = this; for (let i = 0, s = e.length; i < s; ) { this.posOut >= n && this.keccak(); @@ -1406,10 +1406,10 @@ class Ll extends I5 { return this.writeInto(e); } xof(e) { - return zd(e), this.xofInto(new Uint8Array(e)); + return Wd(e), this.xofInto(new Uint8Array(e)); } digestInto(e) { - if (M5(e, this), this.finished) + if (C5(e, this), this.finished) throw new Error("digest() was already called"); return this.writeInto(e), this.destroy(), e; } @@ -1421,33 +1421,33 @@ class Ll extends I5 { } _cloneInto(e) { const { blockLen: r, suffix: n, outputLen: i, rounds: s, enableXOF: o } = this; - return e || (e = new Ll(r, n, i, o, s)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = s, e.suffix = n, e.outputLen = i, e.enableXOF = o, e.destroyed = this.destroyed, e; + return e || (e = new kl(r, n, i, o, s)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = s, e.suffix = n, e.outputLen = i, e.enableXOF = o, e.destroyed = this.destroyed, e; } } -const Aa = (t, e, r) => C5(() => new Ll(e, t, r)), xD = /* @__PURE__ */ Aa(6, 144, 224 / 8), _D = /* @__PURE__ */ Aa(6, 136, 256 / 8), ED = /* @__PURE__ */ Aa(6, 104, 384 / 8), SD = /* @__PURE__ */ Aa(6, 72, 512 / 8), AD = /* @__PURE__ */ Aa(1, 144, 224 / 8), N5 = /* @__PURE__ */ Aa(1, 136, 256 / 8), PD = /* @__PURE__ */ Aa(1, 104, 384 / 8), MD = /* @__PURE__ */ Aa(1, 72, 512 / 8), L5 = (t, e, r) => dD((n = {}) => new Ll(e, t, n.dkLen === void 0 ? r : n.dkLen, !0)), ID = /* @__PURE__ */ L5(31, 168, 128 / 8), CD = /* @__PURE__ */ L5(31, 136, 256 / 8), TD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +const Ia = (t, e, r) => R5(() => new kl(e, t, r)), RD = /* @__PURE__ */ Ia(6, 144, 224 / 8), DD = /* @__PURE__ */ Ia(6, 136, 256 / 8), OD = /* @__PURE__ */ Ia(6, 104, 384 / 8), ND = /* @__PURE__ */ Ia(6, 72, 512 / 8), LD = /* @__PURE__ */ Ia(1, 144, 224 / 8), k5 = /* @__PURE__ */ Ia(1, 136, 256 / 8), kD = /* @__PURE__ */ Ia(1, 104, 384 / 8), $D = /* @__PURE__ */ Ia(1, 72, 512 / 8), $5 = (t, e, r) => ED((n = {}) => new kl(e, t, n.dkLen === void 0 ? r : n.dkLen, !0)), BD = /* @__PURE__ */ $5(31, 168, 128 / 8), FD = /* @__PURE__ */ $5(31, 136, 256 / 8), jD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - Keccak: Ll, - keccakP: O5, - keccak_224: AD, - keccak_256: N5, - keccak_384: PD, - keccak_512: MD, - sha3_224: xD, - sha3_256: _D, - sha3_384: ED, - sha3_512: SD, - shake128: ID, - shake256: CD + Keccak: kl, + keccakP: L5, + keccak_224: LD, + keccak_256: k5, + keccak_384: kD, + keccak_512: $D, + sha3_224: RD, + sha3_256: DD, + sha3_384: OD, + sha3_512: ND, + shake128: BD, + shake256: FD }, Symbol.toStringTag, { value: "Module" })); -function kl(t, e) { - const r = e || "hex", n = N5(ma(t, { strict: !1 }) ? _v(t) : t); - return r === "bytes" ? n : qd(n); +function $l(t, e) { + const r = e || "hex", n = k5(ya(t, { strict: !1 }) ? _v(t) : t); + return r === "bytes" ? n : zd(n); } -const RD = (t) => kl(_v(t)); -function DD(t) { - return RD(t); +const UD = (t) => $l(_v(t)); +function qD(t) { + return UD(t); } -function OD(t) { +function zD(t) { let e = !0, r = "", n = 0, i = "", s = !1; for (let o = 0; o < t.length; o++) { const a = t[o]; @@ -1472,15 +1472,15 @@ function OD(t) { throw new yt("Unable to normalize signature."); return i; } -const ND = (t) => { - const e = typeof t == "string" ? t : OR(t); - return OD(e); +const WD = (t) => { + const e = typeof t == "string" ? t : zR(t); + return zD(e); }; -function k5(t) { - return DD(ND(t)); +function B5(t) { + return qD(WD(t)); } -const LD = k5; -class bu extends yt { +const HD = B5; +class yu extends yt { constructor({ address: e }) { super(`Address "${e}" is invalid.`, { metaMessages: [ @@ -1491,7 +1491,7 @@ class bu extends yt { }); } } -class C0 extends Map { +class T0 extends Map { constructor(e) { super(), Object.defineProperty(this, "maxSize", { enumerable: !0, @@ -1512,33 +1512,33 @@ class C0 extends Map { return this; } } -const Bg = /* @__PURE__ */ new C0(8192); -function $l(t, e) { - if (Bg.has(`${t}.${e}`)) - return Bg.get(`${t}.${e}`); - const r = t.substring(2).toLowerCase(), n = kl(P5(r), "bytes"), i = r.split(""); +const Fg = /* @__PURE__ */ new T0(8192); +function Bl(t, e) { + if (Fg.has(`${t}.${e}`)) + return Fg.get(`${t}.${e}`); + const r = t.substring(2).toLowerCase(), n = $l(I5(r), "bytes"), i = r.split(""); for (let o = 0; o < 40; o += 2) n[o >> 1] >> 4 >= 8 && i[o] && (i[o] = i[o].toUpperCase()), (n[o >> 1] & 15) >= 8 && i[o + 1] && (i[o + 1] = i[o + 1].toUpperCase()); const s = `0x${i.join("")}`; - return Bg.set(`${t}.${e}`, s), s; + return Fg.set(`${t}.${e}`, s), s; } function Ev(t, e) { - if (!Lo(t, { strict: !1 })) - throw new bu({ address: t }); - return $l(t, e); + if (!$o(t, { strict: !1 })) + throw new yu({ address: t }); + return Bl(t, e); } -const kD = /^0x[a-fA-F0-9]{40}$/, Ug = /* @__PURE__ */ new C0(8192); -function Lo(t, e) { +const KD = /^0x[a-fA-F0-9]{40}$/, jg = /* @__PURE__ */ new T0(8192); +function $o(t, e) { const { strict: r = !0 } = e ?? {}, n = `${t}.${r}`; - if (Ug.has(n)) - return Ug.get(n); - const i = kD.test(t) ? t.toLowerCase() === t ? !0 : r ? $l(t) === t : !0 : !1; - return Ug.set(n, i), i; + if (jg.has(n)) + return jg.get(n); + const i = KD.test(t) ? t.toLowerCase() === t ? !0 : r ? Bl(t) === t : !0 : !1; + return jg.set(n, i), i; } -function yu(t) { - return typeof t[0] == "string" ? T0(t) : $D(t); +function wu(t) { + return typeof t[0] == "string" ? R0(t) : VD(t); } -function $D(t) { +function VD(t) { let e = 0; for (const i of t) e += i.length; @@ -1548,55 +1548,55 @@ function $D(t) { r.set(i, n), n += i.length; return r; } -function T0(t) { +function R0(t) { return `0x${t.reduce((e, r) => e + r.replace("0x", ""), "")}`; } -function Wd(t, e, r, { strict: n } = {}) { - return ma(t, { strict: !1 }) ? FD(t, e, r, { +function Kd(t, e, r, { strict: n } = {}) { + return ya(t, { strict: !1 }) ? GD(t, e, r, { strict: n - }) : B5(t, e, r, { + }) : U5(t, e, r, { strict: n }); } -function $5(t, e) { +function F5(t, e) { if (typeof e == "number" && e > 0 && e > An(t) - 1) - throw new E5({ + throw new A5({ offset: e, position: "start", size: An(t) }); } -function F5(t, e, r) { +function j5(t, e, r) { if (typeof e == "number" && typeof r == "number" && An(t) !== r - e) - throw new E5({ + throw new A5({ offset: r, position: "end", size: An(t) }); } -function B5(t, e, r, { strict: n } = {}) { - $5(t, e); +function U5(t, e, r, { strict: n } = {}) { + F5(t, e); const i = t.slice(e, r); - return n && F5(i, e, r), i; + return n && j5(i, e, r), i; } -function FD(t, e, r, { strict: n } = {}) { - $5(t, e); +function GD(t, e, r, { strict: n } = {}) { + F5(t, e); const i = `0x${t.replace("0x", "").slice((e ?? 0) * 2, (r ?? t.length) * 2)}`; - return n && F5(i, e, r), i; + return n && j5(i, e, r), i; } -function U5(t, e) { +function q5(t, e) { if (t.length !== e.length) - throw new BR({ + throw new YR({ expectedLength: t.length, givenLength: e.length }); - const r = BD({ + const r = YD({ params: t, values: e }), n = Av(r); return n.length === 0 ? "0x" : n; } -function BD({ params: t, values: e }) { +function YD({ params: t, values: e }) { const r = []; for (let n = 0; n < t.length; n++) r.push(Sv({ param: t[n], value: e[n] })); @@ -1606,25 +1606,25 @@ function Sv({ param: t, value: e }) { const r = Pv(t.type); if (r) { const [n, i] = r; - return jD(e, { length: n, param: { ...t, type: i } }); + return XD(e, { length: n, param: { ...t, type: i } }); } if (t.type === "tuple") - return KD(e, { + return rO(e, { param: t }); if (t.type === "address") - return UD(e); + return JD(e); if (t.type === "bool") - return zD(e); + return QD(e); if (t.type.startsWith("uint") || t.type.startsWith("int")) { const n = t.type.startsWith("int"); - return HD(e, { signed: n }); + return eO(e, { signed: n }); } if (t.type.startsWith("bytes")) - return qD(e, { param: t }); + return ZD(e, { param: t }); if (t.type === "string") - return WD(e); - throw new qR(t.type, { + return tO(e); + throw new ZR(t.type, { docsPath: "/docs/contract/encodeAbiParameters" }); } @@ -1640,19 +1640,19 @@ function Av(t) { const { dynamic: o, encoded: a } = t[s]; o ? (r.push(Mr(e + i, { size: 32 })), n.push(a), i += An(a)) : r.push(a); } - return yu([...r, ...n]); + return wu([...r, ...n]); } -function UD(t) { - if (!Lo(t)) - throw new bu({ address: t }); - return { dynamic: !1, encoded: ga(t.toLowerCase()) }; +function JD(t) { + if (!$o(t)) + throw new yu({ address: t }); + return { dynamic: !1, encoded: ba(t.toLowerCase()) }; } -function jD(t, { length: e, param: r }) { +function XD(t, { length: e, param: r }) { const n = e === null; if (!Array.isArray(t)) - throw new HR(t); + throw new eD(t); if (!n && t.length !== e) - throw new $R({ + throw new VR({ expectedLength: e, givenLength: t.length, type: `${r.type}[${e}]` @@ -1669,7 +1669,7 @@ function jD(t, { length: e, param: r }) { const a = Mr(s.length, { size: 32 }); return { dynamic: !0, - encoded: s.length > 0 ? yu([a, o]) : a + encoded: s.length > 0 ? wu([a, o]) : a }; } if (i) @@ -1677,34 +1677,34 @@ function jD(t, { length: e, param: r }) { } return { dynamic: !1, - encoded: yu(s.map(({ encoded: o }) => o)) + encoded: wu(s.map(({ encoded: o }) => o)) }; } -function qD(t, { param: e }) { +function ZD(t, { param: e }) { const [, r] = e.type.split("bytes"), n = An(t); if (!r) { let i = t; - return n % 32 !== 0 && (i = ga(i, { + return n % 32 !== 0 && (i = ba(i, { dir: "right", size: Math.ceil((t.length - 2) / 2 / 32) * 32 })), { dynamic: !0, - encoded: yu([ga(Mr(n, { size: 32 })), i]) + encoded: wu([ba(Mr(n, { size: 32 })), i]) }; } if (n !== Number.parseInt(r)) - throw new FR({ + throw new GR({ expectedSize: Number.parseInt(r), value: t }); - return { dynamic: !1, encoded: ga(t, { dir: "right" }) }; + return { dynamic: !1, encoded: ba(t, { dir: "right" }) }; } -function zD(t) { +function QD(t) { if (typeof t != "boolean") throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`); - return { dynamic: !1, encoded: ga(A5(t)) }; + return { dynamic: !1, encoded: ba(M5(t)) }; } -function HD(t, { signed: e }) { +function eO(t, { signed: e }) { return { dynamic: !1, encoded: Mr(t, { @@ -1713,21 +1713,21 @@ function HD(t, { signed: e }) { }) }; } -function WD(t) { - const e = M0(t), r = Math.ceil(An(e) / 32), n = []; +function tO(t) { + const e = I0(t), r = Math.ceil(An(e) / 32), n = []; for (let i = 0; i < r; i++) - n.push(ga(Wd(e, i * 32, (i + 1) * 32), { + n.push(ba(Kd(e, i * 32, (i + 1) * 32), { dir: "right" })); return { dynamic: !0, - encoded: yu([ - ga(Mr(An(e), { size: 32 })), + encoded: wu([ + ba(Mr(An(e), { size: 32 })), ...n ]) }; } -function KD(t, { param: e }) { +function rO(t, { param: e }) { let r = !1; const n = []; for (let i = 0; i < e.components.length; i++) { @@ -1739,7 +1739,7 @@ function KD(t, { param: e }) { } return { dynamic: r, - encoded: r ? Av(n) : yu(n.map(({ encoded: i }) => i)) + encoded: r ? Av(n) : wu(n.map(({ encoded: i }) => i)) }; } function Pv(t) { @@ -1749,9 +1749,9 @@ function Pv(t) { [e[2] ? Number(e[2]) : null, e[1]] ) : void 0; } -const Mv = (t) => Wd(k5(t), 0, 4); -function j5(t) { - const { abi: e, args: r = [], name: n } = t, i = ma(n, { strict: !1 }), s = e.filter((a) => i ? a.type === "function" ? Mv(a) === n : a.type === "event" ? LD(a) === n : !1 : "name" in a && a.name === n); +const Mv = (t) => Kd(B5(t), 0, 4); +function z5(t) { + const { abi: e, args: r = [], name: n } = t, i = ya(n, { strict: !1 }), s = e.filter((a) => i ? a.type === "function" ? Mv(a) === n : a.type === "event" ? HD(a) === n : !1 : "name" in a && a.name === n); if (s.length === 0) return; if (s.length === 1) @@ -1768,13 +1768,13 @@ function j5(t) { if (!a.inputs || a.inputs.length === 0 || a.inputs.length !== r.length) continue; if (r.every((l, d) => { - const g = "inputs" in a && a.inputs[d]; - return g ? Xm(l, g) : !1; + const p = "inputs" in a && a.inputs[d]; + return p ? Xm(l, p) : !1; })) { if (o && "inputs" in o && o.inputs) { - const l = q5(a.inputs, o.inputs, r); + const l = W5(a.inputs, o.inputs, r); if (l) - throw new UR({ + throw new JR({ abiItem: a, type: l[0] }, { @@ -1791,7 +1791,7 @@ function Xm(t, e) { const r = typeof t, n = e.type; switch (n) { case "address": - return Lo(t, { strict: !1 }); + return $o(t, { strict: !1 }); case "bool": return r === "boolean"; case "function": @@ -1806,48 +1806,48 @@ function Xm(t, e) { })) : !1; } } -function q5(t, e, r) { +function W5(t, e, r) { for (const n in t) { const i = t[n], s = e[n]; if (i.type === "tuple" && s.type === "tuple" && "components" in i && "components" in s) - return q5(i.components, s.components, r[n]); + return W5(i.components, s.components, r[n]); const o = [i.type, s.type]; - if (o.includes("address") && o.includes("bytes20") ? !0 : o.includes("address") && o.includes("string") ? Lo(r[n], { strict: !1 }) : o.includes("address") && o.includes("bytes") ? Lo(r[n], { strict: !1 }) : !1) + if (o.includes("address") && o.includes("bytes20") ? !0 : o.includes("address") && o.includes("string") ? $o(r[n], { strict: !1 }) : o.includes("address") && o.includes("bytes") ? $o(r[n], { strict: !1 }) : !1) return o; } } -function jo(t) { +function Wo(t) { return typeof t == "string" ? { address: t, type: "json-rpc" } : t; } -const A2 = "/docs/contract/encodeFunctionData"; -function VD(t) { +const M2 = "/docs/contract/encodeFunctionData"; +function nO(t) { const { abi: e, args: r, functionName: n } = t; let i = e[0]; if (n) { - const s = j5({ + const s = z5({ abi: e, args: r, name: n }); if (!s) - throw new v2(n, { docsPath: A2 }); + throw new y2(n, { docsPath: M2 }); i = s; } if (i.type !== "function") - throw new v2(void 0, { docsPath: A2 }); + throw new y2(void 0, { docsPath: M2 }); return { abi: [i], - functionName: Mv(mu(i)) + functionName: Mv(vu(i)) }; } -function GD(t) { +function iO(t) { const { args: e } = t, { abi: r, functionName: n } = (() => { var a; - return t.abi.length === 1 && ((a = t.functionName) != null && a.startsWith("0x")) ? t : VD(t); - })(), i = r[0], s = n, o = "inputs" in i && i.inputs ? U5(i.inputs, e ?? []) : void 0; - return T0([s, o ?? "0x"]); + return t.abi.length === 1 && ((a = t.functionName) != null && a.startsWith("0x")) ? t : nO(t); + })(), i = r[0], s = n, o = "inputs" in i && i.inputs ? q5(i.inputs, e ?? []) : void 0; + return R0([s, o ?? "0x"]); } -const YD = { +const sO = { 1: "An `assert` condition failed.", 17: "Arithmetic operation resulted in underflow or overflow.", 18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).", @@ -1857,7 +1857,7 @@ const YD = { 50: "Array index is out of bounds.", 65: "Allocated too much memory or created an array which is too large.", 81: "Attempted to call a zero-initialized variable of internal function type." -}, JD = { +}, oO = { inputs: [ { name: "message", @@ -1866,7 +1866,7 @@ const YD = { ], name: "Error", type: "error" -}, XD = { +}, aO = { inputs: [ { name: "reason", @@ -1876,24 +1876,24 @@ const YD = { name: "Panic", type: "error" }; -class P2 extends yt { +class I2 extends yt { constructor({ offset: e }) { super(`Offset \`${e}\` cannot be negative.`, { name: "NegativeOffsetError" }); } } -class ZD extends yt { +class cO extends yt { constructor({ length: e, position: r }) { super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`, { name: "PositionOutOfBoundsError" }); } } -class QD extends yt { +class uO extends yt { constructor({ count: e, limit: r }) { super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`, { name: "RecursiveReadLimitExceededError" }); } } -const eO = { +const fO = { bytes: new Uint8Array(), dataView: new DataView(new ArrayBuffer(0)), position: 0, @@ -1902,21 +1902,21 @@ const eO = { recursiveReadLimit: Number.POSITIVE_INFINITY, assertReadLimit() { if (this.recursiveReadCount >= this.recursiveReadLimit) - throw new QD({ + throw new uO({ count: this.recursiveReadCount + 1, limit: this.recursiveReadLimit }); }, assertPosition(t) { if (t < 0 || t > this.bytes.length - 1) - throw new ZD({ + throw new cO({ length: this.bytes.length, position: t }); }, decrementPosition(t) { if (t < 0) - throw new P2({ offset: t }); + throw new I2({ offset: t }); const e = this.position - t; this.assertPosition(e), this.position = e; }, @@ -1925,7 +1925,7 @@ const eO = { }, incrementPosition(t) { if (t < 0) - throw new P2({ offset: t }); + throw new I2({ offset: t }); const e = this.position + t; this.assertPosition(e), this.position = e; }, @@ -2016,35 +2016,35 @@ const eO = { } }; function Iv(t, { recursiveReadLimit: e = 8192 } = {}) { - const r = Object.create(eO); + const r = Object.create(fO); return r.bytes = t, r.dataView = new DataView(t.buffer, t.byteOffset, t.byteLength), r.positionReadCount = /* @__PURE__ */ new Map(), r.recursiveReadLimit = e, r; } -function tO(t, e = {}) { - typeof e.size < "u" && eo(t, { size: e.size }); +function lO(t, e = {}) { + typeof e.size < "u" && ro(t, { size: e.size }); const r = wi(t, e); - return Qf(r, e); + return el(r, e); } -function rO(t, e = {}) { +function hO(t, e = {}) { let r = t; - if (typeof e.size < "u" && (eo(r, { size: e.size }), r = xv(r)), r.length > 1 || r[0] > 1) - throw new GR(r); + if (typeof e.size < "u" && (ro(r, { size: e.size }), r = xv(r)), r.length > 1 || r[0] > 1) + throw new iD(r); return !!r[0]; } -function Mo(t, e = {}) { - typeof e.size < "u" && eo(t, { size: e.size }); +function To(t, e = {}) { + typeof e.size < "u" && ro(t, { size: e.size }); const r = wi(t, e); - return vu(r, e); + return bu(r, e); } -function nO(t, e = {}) { +function dO(t, e = {}) { let r = t; - return typeof e.size < "u" && (eo(r, { size: e.size }), r = xv(r, { dir: "right" })), new TextDecoder().decode(r); + return typeof e.size < "u" && (ro(r, { size: e.size }), r = xv(r, { dir: "right" })), new TextDecoder().decode(r); } -function iO(t, e) { - const r = typeof e == "string" ? No(e) : e, n = Iv(r); +function pO(t, e) { + const r = typeof e == "string" ? ko(e) : e, n = Iv(r); if (An(r) === 0 && t.length > 0) throw new wv(); if (An(e) && An(e) < 32) - throw new kR({ + throw new KR({ data: typeof e == "string" ? e : wi(e), params: t, size: An(e) @@ -2054,61 +2054,61 @@ function iO(t, e) { for (let o = 0; o < t.length; ++o) { const a = t[o]; n.setPosition(i); - const [u, l] = ou(n, a, { + const [u, l] = au(n, a, { staticPosition: 0 }); i += l, s.push(u); } return s; } -function ou(t, e, { staticPosition: r }) { +function au(t, e, { staticPosition: r }) { const n = Pv(e.type); if (n) { const [i, s] = n; - return oO(t, { ...e, type: s }, { length: i, staticPosition: r }); + return mO(t, { ...e, type: s }, { length: i, staticPosition: r }); } if (e.type === "tuple") - return fO(t, e, { staticPosition: r }); + return wO(t, e, { staticPosition: r }); if (e.type === "address") - return sO(t); + return gO(t); if (e.type === "bool") - return aO(t); + return vO(t); if (e.type.startsWith("bytes")) - return cO(t, e, { staticPosition: r }); + return bO(t, e, { staticPosition: r }); if (e.type.startsWith("uint") || e.type.startsWith("int")) - return uO(t, e); + return yO(t, e); if (e.type === "string") - return lO(t, { staticPosition: r }); - throw new zR(e.type, { + return xO(t, { staticPosition: r }); + throw new QR(e.type, { docsPath: "/docs/contract/decodeAbiParameters" }); } -const M2 = 32, Zm = 32; -function sO(t) { +const C2 = 32, Zm = 32; +function gO(t) { const e = t.readBytes(32); - return [$l(wi(B5(e, -20))), 32]; + return [Bl(wi(U5(e, -20))), 32]; } -function oO(t, e, { length: r, staticPosition: n }) { +function mO(t, e, { length: r, staticPosition: n }) { if (!r) { - const o = Mo(t.readBytes(Zm)), a = n + o, u = a + M2; + const o = To(t.readBytes(Zm)), a = n + o, u = a + C2; t.setPosition(a); - const l = Mo(t.readBytes(M2)), d = el(e); - let g = 0; + const l = To(t.readBytes(C2)), d = tl(e); + let p = 0; const w = []; for (let A = 0; A < l; ++A) { - t.setPosition(u + (d ? A * 32 : g)); - const [M, N] = ou(t, e, { + t.setPosition(u + (d ? A * 32 : p)); + const [P, N] = au(t, e, { staticPosition: u }); - g += N, w.push(M); + p += N, w.push(P); } return t.setPosition(n + 32), [w, 32]; } - if (el(e)) { - const o = Mo(t.readBytes(Zm)), a = n + o, u = []; + if (tl(e)) { + const o = To(t.readBytes(Zm)), a = n + o, u = []; for (let l = 0; l < r; ++l) { t.setPosition(a + l * 32); - const [d] = ou(t, e, { + const [d] = au(t, e, { staticPosition: a }); u.push(d); @@ -2118,22 +2118,22 @@ function oO(t, e, { length: r, staticPosition: n }) { let i = 0; const s = []; for (let o = 0; o < r; ++o) { - const [a, u] = ou(t, e, { + const [a, u] = au(t, e, { staticPosition: n + i }); i += u, s.push(a); } return [s, i]; } -function aO(t) { - return [rO(t.readBytes(32), { size: 32 }), 32]; +function vO(t) { + return [hO(t.readBytes(32), { size: 32 }), 32]; } -function cO(t, e, { staticPosition: r }) { +function bO(t, e, { staticPosition: r }) { const [n, i] = e.type.split("bytes"); if (!i) { - const o = Mo(t.readBytes(32)); + const o = To(t.readBytes(32)); t.setPosition(r + o); - const a = Mo(t.readBytes(32)); + const a = To(t.readBytes(32)); if (a === 0) return t.setPosition(r + 32), ["0x", 32]; const u = t.readBytes(a); @@ -2141,83 +2141,83 @@ function cO(t, e, { staticPosition: r }) { } return [wi(t.readBytes(Number.parseInt(i), 32)), 32]; } -function uO(t, e) { +function yO(t, e) { const r = e.type.startsWith("int"), n = Number.parseInt(e.type.split("int")[1] || "256"), i = t.readBytes(32); return [ - n > 48 ? tO(i, { signed: r }) : Mo(i, { signed: r }), + n > 48 ? lO(i, { signed: r }) : To(i, { signed: r }), 32 ]; } -function fO(t, e, { staticPosition: r }) { +function wO(t, e, { staticPosition: r }) { const n = e.components.length === 0 || e.components.some(({ name: o }) => !o), i = n ? [] : {}; let s = 0; - if (el(e)) { - const o = Mo(t.readBytes(Zm)), a = r + o; + if (tl(e)) { + const o = To(t.readBytes(Zm)), a = r + o; for (let u = 0; u < e.components.length; ++u) { const l = e.components[u]; t.setPosition(a + s); - const [d, g] = ou(t, l, { + const [d, p] = au(t, l, { staticPosition: a }); - s += g, i[n ? u : l == null ? void 0 : l.name] = d; + s += p, i[n ? u : l == null ? void 0 : l.name] = d; } return t.setPosition(r + 32), [i, 32]; } for (let o = 0; o < e.components.length; ++o) { - const a = e.components[o], [u, l] = ou(t, a, { + const a = e.components[o], [u, l] = au(t, a, { staticPosition: r }); i[n ? o : a == null ? void 0 : a.name] = u, s += l; } return [i, s]; } -function lO(t, { staticPosition: e }) { - const r = Mo(t.readBytes(32)), n = e + r; +function xO(t, { staticPosition: e }) { + const r = To(t.readBytes(32)), n = e + r; t.setPosition(n); - const i = Mo(t.readBytes(32)); + const i = To(t.readBytes(32)); if (i === 0) return t.setPosition(e + 32), ["", 32]; - const s = t.readBytes(i, 32), o = nO(xv(s)); + const s = t.readBytes(i, 32), o = dO(xv(s)); return t.setPosition(e + 32), [o, 32]; } -function el(t) { +function tl(t) { var n; const { type: e } = t; if (e === "string" || e === "bytes" || e.endsWith("[]")) return !0; if (e === "tuple") - return (n = t.components) == null ? void 0 : n.some(el); + return (n = t.components) == null ? void 0 : n.some(tl); const r = Pv(t.type); - return !!(r && el({ ...t, type: r[1] })); + return !!(r && tl({ ...t, type: r[1] })); } -function hO(t) { - const { abi: e, data: r } = t, n = Wd(r, 0, 4); +function _O(t) { + const { abi: e, data: r } = t, n = Kd(r, 0, 4); if (n === "0x") throw new wv(); - const s = [...e || [], JD, XD].find((o) => o.type === "error" && n === Mv(mu(o))); + const s = [...e || [], oO, aO].find((o) => o.type === "error" && n === Mv(vu(o))); if (!s) - throw new _5(n, { + throw new S5(n, { docsPath: "/docs/contract/decodeErrorResult" }); return { abiItem: s, - args: "inputs" in s && s.inputs && s.inputs.length > 0 ? iO(s.inputs, Wd(r, 4)) : void 0, + args: "inputs" in s && s.inputs && s.inputs.length > 0 ? pO(s.inputs, Kd(r, 4)) : void 0, errorName: s.name }; } -const Tu = (t, e, r) => JSON.stringify(t, (n, i) => typeof i == "bigint" ? i.toString() : i, r); -function z5({ abiItem: t, args: e, includeFunctionName: r = !0, includeName: n = !1 }) { +const Ru = (t, e, r) => JSON.stringify(t, (n, i) => typeof i == "bigint" ? i.toString() : i, r); +function H5({ abiItem: t, args: e, includeFunctionName: r = !0, includeName: n = !1 }) { if ("name" in t && "inputs" in t && t.inputs) - return `${r ? t.name : ""}(${t.inputs.map((i, s) => `${n && i.name ? `${i.name}: ` : ""}${typeof e[s] == "object" ? Tu(e[s]) : e[s]}`).join(", ")})`; + return `${r ? t.name : ""}(${t.inputs.map((i, s) => `${n && i.name ? `${i.name}: ` : ""}${typeof e[s] == "object" ? Ru(e[s]) : e[s]}`).join(", ")})`; } -const dO = { +const EO = { gwei: 9, wei: 18 -}, pO = { +}, SO = { ether: -9, wei: 9 }; -function H5(t, e) { +function K5(t, e) { let r = t.toString(); const n = r.startsWith("-"); n && (r = r.slice(1)), r = r.padStart(e, "0"); @@ -2227,32 +2227,32 @@ function H5(t, e) { ]; return s = s.replace(/(0+)$/, ""), `${n ? "-" : ""}${i || "0"}${s ? `.${s}` : ""}`; } -function W5(t, e = "wei") { - return H5(t, dO[e]); +function V5(t, e = "wei") { + return K5(t, EO[e]); } -function _s(t, e = "wei") { - return H5(t, pO[e]); +function Es(t, e = "wei") { + return K5(t, SO[e]); } -class gO extends yt { +class AO extends yt { constructor({ address: e }) { super(`State for account "${e}" is set multiple times.`, { name: "AccountStateConflictError" }); } } -class mO extends yt { +class PO extends yt { constructor() { super("state and stateDiff are set on the same account.", { name: "StateAssignmentConflictError" }); } } -function R0(t) { +function D0(t) { const e = Object.entries(t).map(([n, i]) => i === void 0 || i === !1 ? null : [n, i]).filter(Boolean), r = e.reduce((n, [i]) => Math.max(n, i.length), 0); return e.map(([n, i]) => ` ${`${n}:`.padEnd(r + 1)} ${i}`).join(` `); } -class vO extends yt { +class MO extends yt { constructor() { super([ "Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.", @@ -2261,13 +2261,13 @@ class vO extends yt { `), { name: "FeeConflictError" }); } } -class bO extends yt { +class IO extends yt { constructor({ transaction: e }) { super("Cannot infer a transaction type from provided transaction.", { metaMessages: [ "Provided Transaction:", "{", - R0(e), + D0(e), "}", "", "To infer the type, either provide:", @@ -2282,19 +2282,19 @@ class bO extends yt { }); } } -class yO extends yt { - constructor(e, { account: r, docsPath: n, chain: i, data: s, gas: o, gasPrice: a, maxFeePerGas: u, maxPriorityFeePerGas: l, nonce: d, to: g, value: w }) { - var M; - const A = R0({ +class CO extends yt { + constructor(e, { account: r, docsPath: n, chain: i, data: s, gas: o, gasPrice: a, maxFeePerGas: u, maxPriorityFeePerGas: l, nonce: d, to: p, value: w }) { + var P; + const A = D0({ chain: i && `${i == null ? void 0 : i.name} (id: ${i == null ? void 0 : i.id})`, from: r == null ? void 0 : r.address, - to: g, - value: typeof w < "u" && `${W5(w)} ${((M = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : M.symbol) || "ETH"}`, + to: p, + value: typeof w < "u" && `${V5(w)} ${((P = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : P.symbol) || "ETH"}`, data: s, gas: o, - gasPrice: typeof a < "u" && `${_s(a)} gwei`, - maxFeePerGas: typeof u < "u" && `${_s(u)} gwei`, - maxPriorityFeePerGas: typeof l < "u" && `${_s(l)} gwei`, + gasPrice: typeof a < "u" && `${Es(a)} gwei`, + maxFeePerGas: typeof u < "u" && `${Es(u)} gwei`, + maxPriorityFeePerGas: typeof l < "u" && `${Es(l)} gwei`, nonce: d }); super(e.shortMessage, { @@ -2314,16 +2314,16 @@ class yO extends yt { }), this.cause = e; } } -const wO = (t) => t, K5 = (t) => t; -class xO extends yt { +const TO = (t) => t, G5 = (t) => t; +class RO extends yt { constructor(e, { abi: r, args: n, contractAddress: i, docsPath: s, functionName: o, sender: a }) { - const u = j5({ abi: r, args: n, name: o }), l = u ? z5({ + const u = z5({ abi: r, args: n, name: o }), l = u ? H5({ abiItem: u, args: n, includeFunctionName: !1, includeName: !1 - }) : void 0, d = u ? mu(u, { includeName: !0 }) : void 0, g = R0({ - address: i && wO(i), + }) : void 0, d = u ? vu(u, { includeName: !0 }) : void 0, p = D0({ + address: i && TO(i), function: d, args: l && l !== "()" && `${[...Array((o == null ? void 0 : o.length) ?? 0).keys()].map(() => " ").join("")}${l}`, sender: a @@ -2333,8 +2333,8 @@ class xO extends yt { docsPath: s, metaMessages: [ ...e.metaMessages ? [...e.metaMessages, " "] : [], - g && "Contract Call:", - g + p && "Contract Call:", + p ].filter(Boolean), name: "ContractFunctionExecutionError" }), Object.defineProperty(this, "abi", { @@ -2375,20 +2375,20 @@ class xO extends yt { }), this.abi = r, this.args = n, this.cause = e, this.contractAddress = i, this.functionName = o, this.sender = a; } } -class _O extends yt { +class DO extends yt { constructor({ abi: e, data: r, functionName: n, message: i }) { let s, o, a, u; if (r && r !== "0x") try { - o = hO({ abi: e, data: r }); - const { abiItem: d, errorName: g, args: w } = o; - if (g === "Error") + o = _O({ abi: e, data: r }); + const { abiItem: d, errorName: p, args: w } = o; + if (p === "Error") u = w[0]; - else if (g === "Panic") { + else if (p === "Panic") { const [A] = w; - u = YD[A]; + u = sO[A]; } else { - const A = d ? mu(d, { includeName: !0 }) : void 0, M = d && w ? z5({ + const A = d ? vu(d, { includeName: !0 }) : void 0, P = d && w ? H5({ abiItem: d, args: w, includeFunctionName: !1, @@ -2396,7 +2396,7 @@ class _O extends yt { }) : void 0; a = [ A ? `Error: ${A}` : "", - M && M !== "()" ? ` ${[...Array((g == null ? void 0 : g.length) ?? 0).keys()].map(() => " ").join("")}${M}` : "" + P && P !== "()" ? ` ${[...Array((p == null ? void 0 : p.length) ?? 0).keys()].map(() => " ").join("")}${P}` : "" ]; } } catch (d) { @@ -2404,7 +2404,7 @@ class _O extends yt { } else i && (u = i); let l; - s instanceof _5 && (l = s.signature, a = [ + s instanceof S5 && (l = s.signature, a = [ `Unable to decode signature "${l}" as it was not found on the provided ABI.`, "Make sure you are using the correct ABI and that the error exists on it.", `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.` @@ -2434,7 +2434,7 @@ class _O extends yt { }), this.data = o, this.reason = u, this.signature = l; } } -class EO extends yt { +class OO extends yt { constructor({ functionName: e }) { super(`The contract function "${e}" returned no data ("0x").`, { metaMessages: [ @@ -2447,7 +2447,7 @@ class EO extends yt { }); } } -class SO extends yt { +class NO extends yt { constructor({ data: e, message: r }) { super(r || "", { name: "RawContractError" }), Object.defineProperty(this, "code", { enumerable: !0, @@ -2462,15 +2462,15 @@ class SO extends yt { }), this.data = e; } } -class V5 extends yt { +class Y5 extends yt { constructor({ body: e, cause: r, details: n, headers: i, status: s, url: o }) { super("HTTP request failed.", { cause: r, details: n, metaMessages: [ s && `Status: ${s}`, - `URL: ${K5(o)}`, - e && `Request body: ${Tu(e)}` + `URL: ${G5(o)}`, + e && `Request body: ${Ru(e)}` ].filter(Boolean), name: "HttpRequestError" }), Object.defineProperty(this, "body", { @@ -2496,12 +2496,12 @@ class V5 extends yt { }), this.body = e, this.headers = i, this.status = s, this.url = o; } } -class AO extends yt { +class LO extends yt { constructor({ body: e, error: r, url: n }) { super("RPC Request failed.", { cause: r, details: r.message, - metaMessages: [`URL: ${K5(n)}`, `Request body: ${Tu(e)}`], + metaMessages: [`URL: ${G5(n)}`, `Request body: ${Ru(e)}`], name: "RpcRequestError" }), Object.defineProperty(this, "code", { enumerable: !0, @@ -2511,7 +2511,7 @@ class AO extends yt { }), this.code = r.code; } } -const PO = -1; +const kO = -1; class Ei extends yt { constructor(e, { code: r, docsPath: n, metaMessages: i, name: s, shortMessage: o }) { super(o, { @@ -2524,10 +2524,10 @@ class Ei extends yt { configurable: !0, writable: !0, value: void 0 - }), this.name = s || e.name, this.code = e instanceof AO ? e.code : r ?? PO; + }), this.name = s || e.name, this.code = e instanceof LO ? e.code : r ?? kO; } } -class Ru extends Ei { +class Du extends Ei { constructor(e, r) { super(e, r), Object.defineProperty(this, "data", { enumerable: !0, @@ -2537,55 +2537,55 @@ class Ru extends Ei { }), this.data = r.data; } } -class tl extends Ei { +class rl extends Ei { constructor(e) { super(e, { - code: tl.code, + code: rl.code, name: "ParseRpcError", shortMessage: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text." }); } } -Object.defineProperty(tl, "code", { +Object.defineProperty(rl, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32700 }); -class rl extends Ei { +class nl extends Ei { constructor(e) { super(e, { - code: rl.code, + code: nl.code, name: "InvalidRequestRpcError", shortMessage: "JSON is not a valid request object." }); } } -Object.defineProperty(rl, "code", { +Object.defineProperty(nl, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32600 }); -class nl extends Ei { +class il extends Ei { constructor(e, { method: r } = {}) { super(e, { - code: nl.code, + code: il.code, name: "MethodNotFoundRpcError", shortMessage: `The method${r ? ` "${r}"` : ""} does not exist / is not available.` }); } } -Object.defineProperty(nl, "code", { +Object.defineProperty(il, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32601 }); -class il extends Ei { +class sl extends Ei { constructor(e) { super(e, { - code: il.code, + code: sl.code, name: "InvalidParamsRpcError", shortMessage: [ "Invalid parameters were provided to the RPC method.", @@ -2595,31 +2595,31 @@ class il extends Ei { }); } } -Object.defineProperty(il, "code", { +Object.defineProperty(sl, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32602 }); -class cc extends Ei { +class fc extends Ei { constructor(e) { super(e, { - code: cc.code, + code: fc.code, name: "InternalRpcError", shortMessage: "An internal error was received." }); } } -Object.defineProperty(cc, "code", { +Object.defineProperty(fc, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32603 }); -class sl extends Ei { +class ol extends Ei { constructor(e) { super(e, { - code: sl.code, + code: ol.code, name: "InvalidInputRpcError", shortMessage: [ "Missing or invalid parameters.", @@ -2629,16 +2629,16 @@ class sl extends Ei { }); } } -Object.defineProperty(sl, "code", { +Object.defineProperty(ol, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32e3 }); -class ol extends Ei { +class al extends Ei { constructor(e) { super(e, { - code: ol.code, + code: al.code, name: "ResourceNotFoundRpcError", shortMessage: "Requested resource not found." }), Object.defineProperty(this, "name", { @@ -2649,178 +2649,178 @@ class ol extends Ei { }); } } -Object.defineProperty(ol, "code", { +Object.defineProperty(al, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32001 }); -class al extends Ei { +class cl extends Ei { constructor(e) { super(e, { - code: al.code, + code: cl.code, name: "ResourceUnavailableRpcError", shortMessage: "Requested resource not available." }); } } -Object.defineProperty(al, "code", { +Object.defineProperty(cl, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32002 }); -class cl extends Ei { +class ul extends Ei { constructor(e) { super(e, { - code: cl.code, + code: ul.code, name: "TransactionRejectedRpcError", shortMessage: "Transaction creation failed." }); } } -Object.defineProperty(cl, "code", { +Object.defineProperty(ul, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32003 }); -class ul extends Ei { +class fl extends Ei { constructor(e, { method: r } = {}) { super(e, { - code: ul.code, + code: fl.code, name: "MethodNotSupportedRpcError", shortMessage: `Method${r ? ` "${r}"` : ""} is not implemented.` }); } } -Object.defineProperty(ul, "code", { +Object.defineProperty(fl, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32004 }); -class wu extends Ei { +class xu extends Ei { constructor(e) { super(e, { - code: wu.code, + code: xu.code, name: "LimitExceededRpcError", shortMessage: "Request exceeds defined limit." }); } } -Object.defineProperty(wu, "code", { +Object.defineProperty(xu, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32005 }); -class fl extends Ei { +class ll extends Ei { constructor(e) { super(e, { - code: fl.code, + code: ll.code, name: "JsonRpcVersionUnsupportedError", shortMessage: "Version of JSON-RPC protocol is not supported." }); } } -Object.defineProperty(fl, "code", { +Object.defineProperty(ll, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32006 }); -class au extends Ru { +class cu extends Du { constructor(e) { super(e, { - code: au.code, + code: cu.code, name: "UserRejectedRequestError", shortMessage: "User rejected the request." }); } } -Object.defineProperty(au, "code", { +Object.defineProperty(cu, "code", { enumerable: !0, configurable: !0, writable: !0, value: 4001 }); -class ll extends Ru { +class hl extends Du { constructor(e) { super(e, { - code: ll.code, + code: hl.code, name: "UnauthorizedProviderError", shortMessage: "The requested method and/or account has not been authorized by the user." }); } } -Object.defineProperty(ll, "code", { +Object.defineProperty(hl, "code", { enumerable: !0, configurable: !0, writable: !0, value: 4100 }); -class hl extends Ru { +class dl extends Du { constructor(e, { method: r } = {}) { super(e, { - code: hl.code, + code: dl.code, name: "UnsupportedProviderMethodError", shortMessage: `The Provider does not support the requested method${r ? ` " ${r}"` : ""}.` }); } } -Object.defineProperty(hl, "code", { +Object.defineProperty(dl, "code", { enumerable: !0, configurable: !0, writable: !0, value: 4200 }); -class dl extends Ru { +class pl extends Du { constructor(e) { super(e, { - code: dl.code, + code: pl.code, name: "ProviderDisconnectedError", shortMessage: "The Provider is disconnected from all chains." }); } } -Object.defineProperty(dl, "code", { +Object.defineProperty(pl, "code", { enumerable: !0, configurable: !0, writable: !0, value: 4900 }); -class pl extends Ru { +class gl extends Du { constructor(e) { super(e, { - code: pl.code, + code: gl.code, name: "ChainDisconnectedError", shortMessage: "The Provider is not connected to the requested chain." }); } } -Object.defineProperty(pl, "code", { +Object.defineProperty(gl, "code", { enumerable: !0, configurable: !0, writable: !0, value: 4901 }); -class gl extends Ru { +class ml extends Du { constructor(e) { super(e, { - code: gl.code, + code: ml.code, name: "SwitchChainError", shortMessage: "An error occurred when attempting to switch chain." }); } } -Object.defineProperty(gl, "code", { +Object.defineProperty(ml, "code", { enumerable: !0, configurable: !0, writable: !0, value: 4902 }); -class MO extends Ei { +class $O extends Ei { constructor(e) { super(e, { name: "UnknownRpcError", @@ -2828,15 +2828,15 @@ class MO extends Ei { }); } } -const IO = 3; -function CO(t, { abi: e, address: r, args: n, docsPath: i, functionName: s, sender: o }) { - const { code: a, data: u, message: l, shortMessage: d } = t instanceof SO ? t : t instanceof yt ? t.walk((w) => "data" in w) || t.walk() : {}, g = t instanceof wv ? new EO({ functionName: s }) : [IO, cc.code].includes(a) && (u || l || d) ? new _O({ +const BO = 3; +function FO(t, { abi: e, address: r, args: n, docsPath: i, functionName: s, sender: o }) { + const { code: a, data: u, message: l, shortMessage: d } = t instanceof NO ? t : t instanceof yt ? t.walk((w) => "data" in w) || t.walk() : {}, p = t instanceof wv ? new OO({ functionName: s }) : [BO, fc.code].includes(a) && (u || l || d) ? new DO({ abi: e, data: typeof u == "object" ? u.data : u, functionName: s, message: d ?? l }) : t; - return new xO(g, { + return new RO(p, { abi: e, args: n, contractAddress: r, @@ -2845,22 +2845,22 @@ function CO(t, { abi: e, address: r, args: n, docsPath: i, functionName: s, send sender: o }); } -function TO(t) { - const e = kl(`0x${t.substring(4)}`).substring(26); - return $l(`0x${e}`); +function jO(t) { + const e = $l(`0x${t.substring(4)}`).substring(26); + return Bl(`0x${e}`); } -async function RO({ hash: t, signature: e }) { - const r = ma(t) ? t : qd(t), { secp256k1: n } = await import("./secp256k1-CWJe94hK.js"); +async function UO({ hash: t, signature: e }) { + const r = ya(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-S2RhtMGq.js"); return `0x${(() => { if (typeof e == "object" && "r" in e && "s" in e) { - const { r: l, s: d, v: g, yParity: w } = e, A = Number(w ?? g), M = I2(A); - return new n.Signature(Qf(l), Qf(d)).addRecoveryBit(M); + const { r: l, s: d, v: p, yParity: w } = e, A = Number(w ?? p), P = T2(A); + return new n.Signature(el(l), el(d)).addRecoveryBit(P); } - const o = ma(e) ? e : qd(e), a = vu(`0x${o.slice(130)}`), u = I2(a); + const o = ya(e) ? e : zd(e), a = bu(`0x${o.slice(130)}`), u = T2(a); return n.Signature.fromCompact(o.substring(2, 130)).addRecoveryBit(u); })().recoverPublicKey(r.substring(2)).toHex(!1)}`; } -function I2(t) { +function T2(t) { if (t === 0 || t === 1) return t; if (t === 27) @@ -2869,18 +2869,18 @@ function I2(t) { return 1; throw new Error("Invalid yParityOrV value"); } -async function DO({ hash: t, signature: e }) { - return TO(await RO({ hash: t, signature: e })); +async function qO({ hash: t, signature: e }) { + return jO(await UO({ hash: t, signature: e })); } -function OO(t, e = "hex") { - const r = G5(t), n = Iv(new Uint8Array(r.length)); +function zO(t, e = "hex") { + const r = J5(t), n = Iv(new Uint8Array(r.length)); return r.encode(n), e === "hex" ? wi(n.bytes) : n.bytes; } -function G5(t) { - return Array.isArray(t) ? NO(t.map((e) => G5(e))) : LO(t); +function J5(t) { + return Array.isArray(t) ? WO(t.map((e) => J5(e))) : HO(t); } -function NO(t) { - const e = t.reduce((i, s) => i + s.length, 0), r = Y5(e); +function WO(t) { + const e = t.reduce((i, s) => i + s.length, 0), r = X5(e); return { length: e <= 55 ? 1 + e : 1 + r + e, encode(i) { @@ -2890,8 +2890,8 @@ function NO(t) { } }; } -function LO(t) { - const e = typeof t == "string" ? No(t) : t, r = Y5(e.length); +function HO(t) { + const e = typeof t == "string" ? ko(t) : t, r = X5(e.length); return { length: e.length === 1 && e[0] < 128 ? 1 : e.length <= 55 ? 1 + e.length : 1 + r + e.length, encode(i) { @@ -2899,7 +2899,7 @@ function LO(t) { } }; } -function Y5(t) { +function X5(t) { if (t < 2 ** 8) return 1; if (t < 2 ** 16) @@ -2910,36 +2910,36 @@ function Y5(t) { return 4; throw new yt("Length is too large."); } -function kO(t) { - const { chainId: e, contractAddress: r, nonce: n, to: i } = t, s = kl(T0([ +function KO(t) { + const { chainId: e, contractAddress: r, nonce: n, to: i } = t, s = $l(R0([ "0x05", - OO([ + zO([ e ? Mr(e) : "0x", r, n ? Mr(n) : "0x" ]) ])); - return i === "bytes" ? No(s) : s; + return i === "bytes" ? ko(s) : s; } -async function J5(t) { +async function Z5(t) { const { authorization: e, signature: r } = t; - return DO({ - hash: kO(e), + return qO({ + hash: KO(e), signature: r ?? e }); } -class $O extends yt { - constructor(e, { account: r, docsPath: n, chain: i, data: s, gas: o, gasPrice: a, maxFeePerGas: u, maxPriorityFeePerGas: l, nonce: d, to: g, value: w }) { - var M; - const A = R0({ +class VO extends yt { + constructor(e, { account: r, docsPath: n, chain: i, data: s, gas: o, gasPrice: a, maxFeePerGas: u, maxPriorityFeePerGas: l, nonce: d, to: p, value: w }) { + var P; + const A = D0({ from: r == null ? void 0 : r.address, - to: g, - value: typeof w < "u" && `${W5(w)} ${((M = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : M.symbol) || "ETH"}`, + to: p, + value: typeof w < "u" && `${V5(w)} ${((P = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : P.symbol) || "ETH"}`, data: s, gas: o, - gasPrice: typeof a < "u" && `${_s(a)} gwei`, - maxFeePerGas: typeof u < "u" && `${_s(u)} gwei`, - maxPriorityFeePerGas: typeof l < "u" && `${_s(l)} gwei`, + gasPrice: typeof a < "u" && `${Es(a)} gwei`, + maxFeePerGas: typeof u < "u" && `${Es(u)} gwei`, + maxPriorityFeePerGas: typeof l < "u" && `${Es(l)} gwei`, nonce: d }); super(e.shortMessage, { @@ -2959,7 +2959,7 @@ class $O extends yt { }), this.cause = e; } } -class Xc extends yt { +class Zc extends yt { constructor({ cause: e, message: r } = {}) { var i; const n = (i = r == null ? void 0 : r.replace("execution reverted: ", "")) == null ? void 0 : i.replace("execution reverted", ""); @@ -2969,27 +2969,27 @@ class Xc extends yt { }); } } -Object.defineProperty(Xc, "code", { +Object.defineProperty(Zc, "code", { enumerable: !0, configurable: !0, writable: !0, value: 3 }); -Object.defineProperty(Xc, "nodeMessage", { +Object.defineProperty(Zc, "nodeMessage", { enumerable: !0, configurable: !0, writable: !0, value: /execution reverted/ }); -class Kd extends yt { +class Vd extends yt { constructor({ cause: e, maxFeePerGas: r } = {}) { - super(`The fee cap (\`maxFeePerGas\`${r ? ` = ${_s(r)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, { + super(`The fee cap (\`maxFeePerGas\`${r ? ` = ${Es(r)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, { cause: e, name: "FeeCapTooHighError" }); } } -Object.defineProperty(Kd, "nodeMessage", { +Object.defineProperty(Vd, "nodeMessage", { enumerable: !0, configurable: !0, writable: !0, @@ -2997,7 +2997,7 @@ Object.defineProperty(Kd, "nodeMessage", { }); class Qm extends yt { constructor({ cause: e, maxFeePerGas: r } = {}) { - super(`The fee cap (\`maxFeePerGas\`${r ? ` = ${_s(r)}` : ""} gwei) cannot be lower than the block base fee.`, { + super(`The fee cap (\`maxFeePerGas\`${r ? ` = ${Es(r)}` : ""} gwei) cannot be lower than the block base fee.`, { cause: e, name: "FeeCapTooLowError" }); @@ -3115,10 +3115,10 @@ Object.defineProperty(o1, "nodeMessage", { writable: !0, value: /transaction type not valid/ }); -class Vd extends yt { +class Gd extends yt { constructor({ cause: e, maxPriorityFeePerGas: r, maxFeePerGas: n } = {}) { super([ - `The provided tip (\`maxPriorityFeePerGas\`${r ? ` = ${_s(r)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n ? ` = ${_s(n)} gwei` : ""}).` + `The provided tip (\`maxPriorityFeePerGas\`${r ? ` = ${Es(r)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n ? ` = ${Es(n)} gwei` : ""}).` ].join(` `), { cause: e, @@ -3126,7 +3126,7 @@ class Vd extends yt { }); } } -Object.defineProperty(Vd, "nodeMessage", { +Object.defineProperty(Gd, "nodeMessage", { enumerable: !0, configurable: !0, writable: !0, @@ -3140,21 +3140,21 @@ class Cv extends yt { }); } } -function X5(t, e) { - const r = (t.details || "").toLowerCase(), n = t instanceof yt ? t.walk((i) => (i == null ? void 0 : i.code) === Xc.code) : t; - return n instanceof yt ? new Xc({ +function Q5(t, e) { + const r = (t.details || "").toLowerCase(), n = t instanceof yt ? t.walk((i) => (i == null ? void 0 : i.code) === Zc.code) : t; + return n instanceof yt ? new Zc({ cause: t, message: n.details - }) : Xc.nodeMessage.test(r) ? new Xc({ + }) : Zc.nodeMessage.test(r) ? new Zc({ cause: t, message: t.details - }) : Kd.nodeMessage.test(r) ? new Kd({ + }) : Vd.nodeMessage.test(r) ? new Vd({ cause: t, maxFeePerGas: e == null ? void 0 : e.maxFeePerGas }) : Qm.nodeMessage.test(r) ? new Qm({ cause: t, maxFeePerGas: e == null ? void 0 : e.maxFeePerGas - }) : e1.nodeMessage.test(r) ? new e1({ cause: t, nonce: e == null ? void 0 : e.nonce }) : t1.nodeMessage.test(r) ? new t1({ cause: t, nonce: e == null ? void 0 : e.nonce }) : r1.nodeMessage.test(r) ? new r1({ cause: t, nonce: e == null ? void 0 : e.nonce }) : n1.nodeMessage.test(r) ? new n1({ cause: t }) : i1.nodeMessage.test(r) ? new i1({ cause: t, gas: e == null ? void 0 : e.gas }) : s1.nodeMessage.test(r) ? new s1({ cause: t, gas: e == null ? void 0 : e.gas }) : o1.nodeMessage.test(r) ? new o1({ cause: t }) : Vd.nodeMessage.test(r) ? new Vd({ + }) : e1.nodeMessage.test(r) ? new e1({ cause: t, nonce: e == null ? void 0 : e.nonce }) : t1.nodeMessage.test(r) ? new t1({ cause: t, nonce: e == null ? void 0 : e.nonce }) : r1.nodeMessage.test(r) ? new r1({ cause: t, nonce: e == null ? void 0 : e.nonce }) : n1.nodeMessage.test(r) ? new n1({ cause: t }) : i1.nodeMessage.test(r) ? new i1({ cause: t, gas: e == null ? void 0 : e.gas }) : s1.nodeMessage.test(r) ? new s1({ cause: t, gas: e == null ? void 0 : e.gas }) : o1.nodeMessage.test(r) ? new o1({ cause: t }) : Gd.nodeMessage.test(r) ? new Gd({ cause: t, maxFeePerGas: e == null ? void 0 : e.maxFeePerGas, maxPriorityFeePerGas: e == null ? void 0 : e.maxPriorityFeePerGas @@ -3162,17 +3162,17 @@ function X5(t, e) { cause: t }); } -function FO(t, { docsPath: e, ...r }) { +function GO(t, { docsPath: e, ...r }) { const n = (() => { - const i = X5(t, r); + const i = Q5(t, r); return i instanceof Cv ? t : i; })(); - return new $O(n, { + return new VO(n, { docsPath: e, ...r }); } -function Z5(t, { format: e }) { +function e4(t, { format: e }) { if (!e) return {}; const r = {}; @@ -3184,7 +3184,7 @@ function Z5(t, { format: e }) { const i = e(t || {}); return n(i), r; } -const BO = { +const YO = { legacy: "0x0", eip2930: "0x1", eip1559: "0x2", @@ -3193,9 +3193,9 @@ const BO = { }; function Tv(t) { const e = {}; - return typeof t.authorizationList < "u" && (e.authorizationList = UO(t.authorizationList)), typeof t.accessList < "u" && (e.accessList = t.accessList), typeof t.blobVersionedHashes < "u" && (e.blobVersionedHashes = t.blobVersionedHashes), typeof t.blobs < "u" && (typeof t.blobs[0] != "string" ? e.blobs = t.blobs.map((r) => wi(r)) : e.blobs = t.blobs), typeof t.data < "u" && (e.data = t.data), typeof t.from < "u" && (e.from = t.from), typeof t.gas < "u" && (e.gas = Mr(t.gas)), typeof t.gasPrice < "u" && (e.gasPrice = Mr(t.gasPrice)), typeof t.maxFeePerBlobGas < "u" && (e.maxFeePerBlobGas = Mr(t.maxFeePerBlobGas)), typeof t.maxFeePerGas < "u" && (e.maxFeePerGas = Mr(t.maxFeePerGas)), typeof t.maxPriorityFeePerGas < "u" && (e.maxPriorityFeePerGas = Mr(t.maxPriorityFeePerGas)), typeof t.nonce < "u" && (e.nonce = Mr(t.nonce)), typeof t.to < "u" && (e.to = t.to), typeof t.type < "u" && (e.type = BO[t.type]), typeof t.value < "u" && (e.value = Mr(t.value)), e; + return typeof t.authorizationList < "u" && (e.authorizationList = JO(t.authorizationList)), typeof t.accessList < "u" && (e.accessList = t.accessList), typeof t.blobVersionedHashes < "u" && (e.blobVersionedHashes = t.blobVersionedHashes), typeof t.blobs < "u" && (typeof t.blobs[0] != "string" ? e.blobs = t.blobs.map((r) => wi(r)) : e.blobs = t.blobs), typeof t.data < "u" && (e.data = t.data), typeof t.from < "u" && (e.from = t.from), typeof t.gas < "u" && (e.gas = Mr(t.gas)), typeof t.gasPrice < "u" && (e.gasPrice = Mr(t.gasPrice)), typeof t.maxFeePerBlobGas < "u" && (e.maxFeePerBlobGas = Mr(t.maxFeePerBlobGas)), typeof t.maxFeePerGas < "u" && (e.maxFeePerGas = Mr(t.maxFeePerGas)), typeof t.maxPriorityFeePerGas < "u" && (e.maxPriorityFeePerGas = Mr(t.maxPriorityFeePerGas)), typeof t.nonce < "u" && (e.nonce = Mr(t.nonce)), typeof t.to < "u" && (e.to = t.to), typeof t.type < "u" && (e.type = YO[t.type]), typeof t.value < "u" && (e.value = Mr(t.value)), e; } -function UO(t) { +function JO(t) { return t.map((e) => ({ address: e.contractAddress, r: e.r, @@ -3206,17 +3206,17 @@ function UO(t) { ...typeof e.v < "u" && typeof e.yParity > "u" ? { v: Mr(e.v) } : {} })); } -function C2(t) { +function R2(t) { if (!(!t || t.length === 0)) return t.reduce((e, { slot: r, value: n }) => { if (r.length !== 66) - throw new b2({ + throw new w2({ size: r.length, targetSize: 66, type: "hex" }); if (n.length !== 66) - throw new b2({ + throw new w2({ size: n.length, targetSize: 66, type: "hex" @@ -3224,43 +3224,43 @@ function C2(t) { return e[r] = n, e; }, {}); } -function jO(t) { +function XO(t) { const { balance: e, nonce: r, state: n, stateDiff: i, code: s } = t, o = {}; - if (s !== void 0 && (o.code = s), e !== void 0 && (o.balance = Mr(e)), r !== void 0 && (o.nonce = Mr(r)), n !== void 0 && (o.state = C2(n)), i !== void 0) { + if (s !== void 0 && (o.code = s), e !== void 0 && (o.balance = Mr(e)), r !== void 0 && (o.nonce = Mr(r)), n !== void 0 && (o.state = R2(n)), i !== void 0) { if (o.state) - throw new mO(); - o.stateDiff = C2(i); + throw new PO(); + o.stateDiff = R2(i); } return o; } -function qO(t) { +function ZO(t) { if (!t) return; const e = {}; for (const { address: r, ...n } of t) { - if (!Lo(r, { strict: !1 })) - throw new bu({ address: r }); + if (!$o(r, { strict: !1 })) + throw new yu({ address: r }); if (e[r]) - throw new gO({ address: r }); - e[r] = jO(n); + throw new AO({ address: r }); + e[r] = XO(n); } return e; } -const zO = 2n ** 256n - 1n; -function D0(t) { - const { account: e, gasPrice: r, maxFeePerGas: n, maxPriorityFeePerGas: i, to: s } = t, o = e ? jo(e) : void 0; - if (o && !Lo(o.address)) - throw new bu({ address: o.address }); - if (s && !Lo(s)) - throw new bu({ address: s }); +const QO = 2n ** 256n - 1n; +function O0(t) { + const { account: e, gasPrice: r, maxFeePerGas: n, maxPriorityFeePerGas: i, to: s } = t, o = e ? Wo(e) : void 0; + if (o && !$o(o.address)) + throw new yu({ address: o.address }); + if (s && !$o(s)) + throw new yu({ address: s }); if (typeof r < "u" && (typeof n < "u" || typeof i < "u")) - throw new vO(); - if (n && n > zO) - throw new Kd({ maxFeePerGas: n }); + throw new MO(); + if (n && n > QO) + throw new Vd({ maxFeePerGas: n }); if (i && n && i > n) - throw new Vd({ maxFeePerGas: n, maxPriorityFeePerGas: i }); + throw new Gd({ maxFeePerGas: n, maxPriorityFeePerGas: i }); } -class HO extends yt { +class eN extends yt { constructor() { super("`baseFeeMultiplier` must be greater than 1.", { name: "BaseFeeScalarError" @@ -3274,44 +3274,44 @@ class Rv extends yt { }); } } -class WO extends yt { +class tN extends yt { constructor({ maxPriorityFeePerGas: e }) { - super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${_s(e)} gwei).`, { name: "MaxFeePerGasTooLowError" }); + super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Es(e)} gwei).`, { name: "MaxFeePerGasTooLowError" }); } } -class KO extends yt { +class rN extends yt { constructor({ blockHash: e, blockNumber: r }) { let n = "Block"; e && (n = `Block at hash "${e}"`), r && (n = `Block at number "${r}"`), super(`${n} could not be found.`, { name: "BlockNotFoundError" }); } } -const VO = { +const nN = { "0x0": "legacy", "0x1": "eip2930", "0x2": "eip1559", "0x3": "eip4844", "0x4": "eip7702" }; -function GO(t) { +function iN(t) { const e = { ...t, blockHash: t.blockHash ? t.blockHash : null, blockNumber: t.blockNumber ? BigInt(t.blockNumber) : null, - chainId: t.chainId ? vu(t.chainId) : void 0, + chainId: t.chainId ? bu(t.chainId) : void 0, gas: t.gas ? BigInt(t.gas) : void 0, gasPrice: t.gasPrice ? BigInt(t.gasPrice) : void 0, maxFeePerBlobGas: t.maxFeePerBlobGas ? BigInt(t.maxFeePerBlobGas) : void 0, maxFeePerGas: t.maxFeePerGas ? BigInt(t.maxFeePerGas) : void 0, maxPriorityFeePerGas: t.maxPriorityFeePerGas ? BigInt(t.maxPriorityFeePerGas) : void 0, - nonce: t.nonce ? vu(t.nonce) : void 0, + nonce: t.nonce ? bu(t.nonce) : void 0, to: t.to ? t.to : null, transactionIndex: t.transactionIndex ? Number(t.transactionIndex) : null, - type: t.type ? VO[t.type] : void 0, + type: t.type ? nN[t.type] : void 0, typeHex: t.type ? t.type : void 0, value: t.value ? BigInt(t.value) : void 0, v: t.v ? BigInt(t.v) : void 0 }; - return t.authorizationList && (e.authorizationList = YO(t.authorizationList)), e.yParity = (() => { + return t.authorizationList && (e.authorizationList = sN(t.authorizationList)), e.yParity = (() => { if (t.yParity) return Number(t.yParity); if (typeof e.v == "bigint") { @@ -3324,7 +3324,7 @@ function GO(t) { } })(), e.type === "legacy" && (delete e.accessList, delete e.maxFeePerBlobGas, delete e.maxFeePerGas, delete e.maxPriorityFeePerGas, delete e.yParity), e.type === "eip2930" && (delete e.maxFeePerBlobGas, delete e.maxFeePerGas, delete e.maxPriorityFeePerGas), e.type === "eip1559" && delete e.maxFeePerBlobGas, e; } -function YO(t) { +function sN(t) { return t.map((e) => ({ contractAddress: e.address, chainId: Number(e.chainId), @@ -3334,8 +3334,8 @@ function YO(t) { yParity: Number(e.yParity) })); } -function JO(t) { - const e = (t.transactions ?? []).map((r) => typeof r == "string" ? r : GO(r)); +function oN(t) { + const e = (t.transactions ?? []).map((r) => typeof r == "string" ? r : iN(r)); return { ...t, baseFeePerGas: t.baseFeePerGas ? BigInt(t.baseFeePerGas) : null, @@ -3354,8 +3354,8 @@ function JO(t) { totalDifficulty: t.totalDifficulty ? BigInt(t.totalDifficulty) : null }; } -async function Gd(t, { blockHash: e, blockNumber: r, blockTag: n, includeTransactions: i } = {}) { - var d, g, w; +async function Yd(t, { blockHash: e, blockNumber: r, blockTag: n, includeTransactions: i } = {}) { + var d, p, w; const s = n ?? "latest", o = i ?? !1, a = r !== void 0 ? Mr(r) : void 0; let u = null; if (e ? u = await t.request({ @@ -3365,22 +3365,22 @@ async function Gd(t, { blockHash: e, blockNumber: r, blockTag: n, includeTransac method: "eth_getBlockByNumber", params: [a || s, o] }, { dedupe: !!a }), !u) - throw new KO({ blockHash: e, blockNumber: r }); - return (((w = (g = (d = t.chain) == null ? void 0 : d.formatters) == null ? void 0 : g.block) == null ? void 0 : w.format) || JO)(u); + throw new rN({ blockHash: e, blockNumber: r }); + return (((w = (p = (d = t.chain) == null ? void 0 : d.formatters) == null ? void 0 : p.block) == null ? void 0 : w.format) || oN)(u); } -async function Q5(t) { +async function t4(t) { const e = await t.request({ method: "eth_gasPrice" }); return BigInt(e); } -async function XO(t, e) { +async function aN(t, e) { var s, o; const { block: r, chain: n = t.chain, request: i } = e || {}; try { const a = ((s = n == null ? void 0 : n.fees) == null ? void 0 : s.maxPriorityFeePerGas) ?? ((o = n == null ? void 0 : n.fees) == null ? void 0 : o.defaultPriorityFee); if (typeof a == "function") { - const l = r || await vi(t, Gd, "getBlock")({}), d = await a({ + const l = r || await bi(t, Yd, "getBlock")({}), d = await a({ block: l, client: t, request: i @@ -3394,11 +3394,11 @@ async function XO(t, e) { const u = await t.request({ method: "eth_maxPriorityFeePerGas" }); - return Qf(u); + return el(u); } catch { const [a, u] = await Promise.all([ - r ? Promise.resolve(r) : vi(t, Gd, "getBlock")({}), - vi(t, Q5, "getGasPrice")({}) + r ? Promise.resolve(r) : bi(t, Yd, "getBlock")({}), + bi(t, t4, "getGasPrice")({}) ]); if (typeof a.baseFeePerGas != "bigint") throw new Rv(); @@ -3406,88 +3406,88 @@ async function XO(t, e) { return l < 0n ? 0n : l; } } -async function T2(t, e) { +async function D2(t, e) { var w, A; const { block: r, chain: n = t.chain, request: i, type: s = "eip1559" } = e || {}, o = await (async () => { - var M, N; - return typeof ((M = n == null ? void 0 : n.fees) == null ? void 0 : M.baseFeeMultiplier) == "function" ? n.fees.baseFeeMultiplier({ + var P, N; + return typeof ((P = n == null ? void 0 : n.fees) == null ? void 0 : P.baseFeeMultiplier) == "function" ? n.fees.baseFeeMultiplier({ block: r, client: t, request: i }) : ((N = n == null ? void 0 : n.fees) == null ? void 0 : N.baseFeeMultiplier) ?? 1.2; })(); if (o < 1) - throw new HO(); - const u = 10 ** (((w = o.toString().split(".")[1]) == null ? void 0 : w.length) ?? 0), l = (M) => M * BigInt(Math.ceil(o * u)) / BigInt(u), d = r || await vi(t, Gd, "getBlock")({}); + throw new eN(); + const u = 10 ** (((w = o.toString().split(".")[1]) == null ? void 0 : w.length) ?? 0), l = (P) => P * BigInt(Math.ceil(o * u)) / BigInt(u), d = r || await bi(t, Yd, "getBlock")({}); if (typeof ((A = n == null ? void 0 : n.fees) == null ? void 0 : A.estimateFeesPerGas) == "function") { - const M = await n.fees.estimateFeesPerGas({ + const P = await n.fees.estimateFeesPerGas({ block: r, client: t, multiply: l, request: i, type: s }); - if (M !== null) - return M; + if (P !== null) + return P; } if (s === "eip1559") { if (typeof d.baseFeePerGas != "bigint") throw new Rv(); - const M = typeof (i == null ? void 0 : i.maxPriorityFeePerGas) == "bigint" ? i.maxPriorityFeePerGas : await XO(t, { + const P = typeof (i == null ? void 0 : i.maxPriorityFeePerGas) == "bigint" ? i.maxPriorityFeePerGas : await aN(t, { block: d, chain: n, request: i }), N = l(d.baseFeePerGas); return { - maxFeePerGas: (i == null ? void 0 : i.maxFeePerGas) ?? N + M, - maxPriorityFeePerGas: M + maxFeePerGas: (i == null ? void 0 : i.maxFeePerGas) ?? N + P, + maxPriorityFeePerGas: P }; } return { - gasPrice: (i == null ? void 0 : i.gasPrice) ?? l(await vi(t, Q5, "getGasPrice")({})) + gasPrice: (i == null ? void 0 : i.gasPrice) ?? l(await bi(t, t4, "getGasPrice")({})) }; } -async function ZO(t, { address: e, blockTag: r = "latest", blockNumber: n }) { +async function cN(t, { address: e, blockTag: r = "latest", blockNumber: n }) { const i = await t.request({ method: "eth_getTransactionCount", params: [e, n ? Mr(n) : r] }, { dedupe: !!n }); - return vu(i); + return bu(i); } -function e4(t) { - const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((s) => No(s)) : t.blobs, i = []; +function r4(t) { + const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((s) => ko(s)) : t.blobs, i = []; for (const s of n) i.push(Uint8Array.from(e.blobToKzgCommitment(s))); return r === "bytes" ? i : i.map((s) => wi(s)); } -function t4(t) { - const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((o) => No(o)) : t.blobs, i = typeof t.commitments[0] == "string" ? t.commitments.map((o) => No(o)) : t.commitments, s = []; +function n4(t) { + const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((o) => ko(o)) : t.blobs, i = typeof t.commitments[0] == "string" ? t.commitments.map((o) => ko(o)) : t.commitments, s = []; for (let o = 0; o < n.length; o++) { const a = n[o], u = i[o]; s.push(Uint8Array.from(e.computeBlobKzgProof(a, u))); } return r === "bytes" ? s : s.map((o) => wi(o)); } -function QO(t, e, r, n) { +function uN(t, e, r, n) { if (typeof t.setBigUint64 == "function") return t.setBigUint64(e, r, n); const i = BigInt(32), s = BigInt(4294967295), o = Number(r >> i & s), a = Number(r & s), u = n ? 4 : 0, l = n ? 0 : 4; t.setUint32(e + u, o, n), t.setUint32(e + l, a, n); } -const eN = (t, e, r) => t & e ^ ~t & r, tN = (t, e, r) => t & e ^ t & r ^ e & r; -class rN extends I5 { +const fN = (t, e, r) => t & e ^ ~t & r, lN = (t, e, r) => t & e ^ t & r ^ e & r; +class hN extends T5 { constructor(e, r, n, i) { - super(), this.blockLen = e, this.outputLen = r, this.padOffset = n, this.isLE = i, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(e), this.view = Fg(this.buffer); + super(), this.blockLen = e, this.outputLen = r, this.padOffset = n, this.isLE = i, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(e), this.view = Bg(this.buffer); } update(e) { Hd(this); const { view: r, buffer: n, blockLen: i } = this; - e = I0(e); + e = C0(e); const s = e.length; for (let o = 0; o < s; ) { const a = Math.min(i - this.pos, s - o); if (a === i) { - const u = Fg(e); + const u = Bg(e); for (; i <= s - o; o += i) this.process(u, o); continue; @@ -3497,21 +3497,21 @@ class rN extends I5 { return this.length += e.length, this.roundClean(), this; } digestInto(e) { - Hd(this), M5(e, this), this.finished = !0; + Hd(this), C5(e, this), this.finished = !0; const { buffer: r, view: n, blockLen: i, isLE: s } = this; let { pos: o } = this; r[o++] = 128, this.buffer.subarray(o).fill(0), this.padOffset > i - o && (this.process(n, 0), o = 0); - for (let g = o; g < i; g++) - r[g] = 0; - QO(n, i - 8, BigInt(this.length * 8), s), this.process(n, 0); - const a = Fg(e), u = this.outputLen; + for (let p = o; p < i; p++) + r[p] = 0; + uN(n, i - 8, BigInt(this.length * 8), s), this.process(n, 0); + const a = Bg(e), u = this.outputLen; if (u % 4) throw new Error("_sha2: outputLen should be aligned to 32bit"); const l = u / 4, d = this.get(); if (l > d.length) throw new Error("_sha2: outputLen bigger than state"); - for (let g = 0; g < l; g++) - a.setUint32(4 * g, d[g], s); + for (let p = 0; p < l; p++) + a.setUint32(4 * p, d[p], s); } digest() { const { buffer: e, outputLen: r } = this; @@ -3525,7 +3525,7 @@ class rN extends I5 { return e.length = i, e.pos = a, e.finished = s, e.destroyed = o, i % r && e.buffer.set(n), e; } } -const nN = /* @__PURE__ */ new Uint32Array([ +const dN = /* @__PURE__ */ new Uint32Array([ 1116352408, 1899447441, 3049323471, @@ -3590,7 +3590,7 @@ const nN = /* @__PURE__ */ new Uint32Array([ 2756734187, 3204031479, 3329325298 -]), Zo = /* @__PURE__ */ new Uint32Array([ +]), ta = /* @__PURE__ */ new Uint32Array([ 1779033703, 3144134277, 1013904242, @@ -3599,10 +3599,10 @@ const nN = /* @__PURE__ */ new Uint32Array([ 2600822924, 528734635, 1541459225 -]), Qo = /* @__PURE__ */ new Uint32Array(64); -let iN = class extends rN { +]), ra = /* @__PURE__ */ new Uint32Array(64); +let pN = class extends hN { constructor() { - super(64, 32, 8, !1), this.A = Zo[0] | 0, this.B = Zo[1] | 0, this.C = Zo[2] | 0, this.D = Zo[3] | 0, this.E = Zo[4] | 0, this.F = Zo[5] | 0, this.G = Zo[6] | 0, this.H = Zo[7] | 0; + super(64, 32, 8, !1), this.A = ta[0] | 0, this.B = ta[1] | 0, this.C = ta[2] | 0, this.D = ta[3] | 0, this.E = ta[4] | 0, this.F = ta[5] | 0, this.G = ta[6] | 0, this.H = ta[7] | 0; } get() { const { A: e, B: r, C: n, D: i, E: s, F: o, G: a, H: u } = this; @@ -3613,48 +3613,48 @@ let iN = class extends rN { this.A = e | 0, this.B = r | 0, this.C = n | 0, this.D = i | 0, this.E = s | 0, this.F = o | 0, this.G = a | 0, this.H = u | 0; } process(e, r) { - for (let g = 0; g < 16; g++, r += 4) - Qo[g] = e.getUint32(r, !1); - for (let g = 16; g < 64; g++) { - const w = Qo[g - 15], A = Qo[g - 2], M = Os(w, 7) ^ Os(w, 18) ^ w >>> 3, N = Os(A, 17) ^ Os(A, 19) ^ A >>> 10; - Qo[g] = N + Qo[g - 7] + M + Qo[g - 16] | 0; + for (let p = 0; p < 16; p++, r += 4) + ra[p] = e.getUint32(r, !1); + for (let p = 16; p < 64; p++) { + const w = ra[p - 15], A = ra[p - 2], P = Ns(w, 7) ^ Ns(w, 18) ^ w >>> 3, N = Ns(A, 17) ^ Ns(A, 19) ^ A >>> 10; + ra[p] = N + ra[p - 7] + P + ra[p - 16] | 0; } let { A: n, B: i, C: s, D: o, E: a, F: u, G: l, H: d } = this; - for (let g = 0; g < 64; g++) { - const w = Os(a, 6) ^ Os(a, 11) ^ Os(a, 25), A = d + w + eN(a, u, l) + nN[g] + Qo[g] | 0, N = (Os(n, 2) ^ Os(n, 13) ^ Os(n, 22)) + tN(n, i, s) | 0; + for (let p = 0; p < 64; p++) { + const w = Ns(a, 6) ^ Ns(a, 11) ^ Ns(a, 25), A = d + w + fN(a, u, l) + dN[p] + ra[p] | 0, N = (Ns(n, 2) ^ Ns(n, 13) ^ Ns(n, 22)) + lN(n, i, s) | 0; d = l, l = u, u = a, a = o + A | 0, o = s, s = i, i = n, n = A + N | 0; } n = n + this.A | 0, i = i + this.B | 0, s = s + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, u = u + this.F | 0, l = l + this.G | 0, d = d + this.H | 0, this.set(n, i, s, o, a, u, l, d); } roundClean() { - Qo.fill(0); + ra.fill(0); } destroy() { this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0); } }; -const r4 = /* @__PURE__ */ C5(() => new iN()); -function sN(t, e) { - return r4(ma(t, { strict: !1 }) ? _v(t) : t); +const i4 = /* @__PURE__ */ R5(() => new pN()); +function gN(t, e) { + return i4(ya(t, { strict: !1 }) ? _v(t) : t); } -function oN(t) { - const { commitment: e, version: r = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), i = sN(e); +function mN(t) { + const { commitment: e, version: r = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), i = gN(e); return i.set([r], 0), n === "bytes" ? i : wi(i); } -function aN(t) { +function vN(t) { const { commitments: e, version: r } = t, n = t.to ?? (typeof e[0] == "string" ? "hex" : "bytes"), i = []; for (const s of e) - i.push(oN({ + i.push(mN({ commitment: s, to: n, version: r })); return i; } -const R2 = 6, n4 = 32, Dv = 4096, i4 = n4 * Dv, D2 = i4 * R2 - // terminator byte (0x80). +const O2 = 6, s4 = 32, Dv = 4096, o4 = s4 * Dv, N2 = o4 * O2 - // terminator byte (0x80). 1 - // zero byte (0x00) appended to each field element. -1 * Dv * R2; -class cN extends yt { +1 * Dv * O2; +class bN extends yt { constructor({ maxSize: e, size: r }) { super("Blob size is too large.", { metaMessages: [`Max: ${e} bytes`, `Given: ${r} bytes`], @@ -3662,27 +3662,27 @@ class cN extends yt { }); } } -class uN extends yt { +class yN extends yt { constructor() { super("Blob data must not be empty.", { name: "EmptyBlobError" }); } } -function fN(t) { - const e = t.to ?? (typeof t.data == "string" ? "hex" : "bytes"), r = typeof t.data == "string" ? No(t.data) : t.data, n = An(r); +function wN(t) { + const e = t.to ?? (typeof t.data == "string" ? "hex" : "bytes"), r = typeof t.data == "string" ? ko(t.data) : t.data, n = An(r); if (!n) - throw new uN(); - if (n > D2) - throw new cN({ - maxSize: D2, + throw new yN(); + if (n > N2) + throw new bN({ + maxSize: N2, size: n }); const i = []; let s = !0, o = 0; for (; s; ) { - const a = Iv(new Uint8Array(i4)); + const a = Iv(new Uint8Array(o4)); let u = 0; for (; u < Dv; ) { - const l = r.slice(o, o + (n4 - 1)); + const l = r.slice(o, o + (s4 - 1)); if (a.pushByte(0), a.pushBytes(l), l.length < 31) { a.pushByte(128), s = !1; break; @@ -3693,8 +3693,8 @@ function fN(t) { } return e === "bytes" ? i.map((a) => a.bytes) : i.map((a) => wi(a.bytes)); } -function lN(t) { - const { data: e, kzg: r, to: n } = t, i = t.blobs ?? fN({ data: e, to: n }), s = t.commitments ?? e4({ blobs: i, kzg: r, to: n }), o = t.proofs ?? t4({ blobs: i, commitments: s, kzg: r, to: n }), a = []; +function xN(t) { + const { data: e, kzg: r, to: n } = t, i = t.blobs ?? wN({ data: e, to: n }), s = t.commitments ?? r4({ blobs: i, kzg: r, to: n }), o = t.proofs ?? n4({ blobs: i, commitments: s, kzg: r, to: n }), a = []; for (let u = 0; u < i.length; u++) a.push({ blob: i[u], @@ -3703,7 +3703,7 @@ function lN(t) { }); return a; } -function hN(t) { +function _N(t) { if (t.type) return t.type; if (typeof t.authorizationList < "u") @@ -3714,15 +3714,15 @@ function hN(t) { return "eip1559"; if (typeof t.gasPrice < "u") return typeof t.accessList < "u" ? "eip2930" : "legacy"; - throw new bO({ transaction: t }); + throw new IO({ transaction: t }); } -async function O0(t) { +async function N0(t) { const e = await t.request({ method: "eth_chainId" }, { dedupe: !0 }); - return vu(e); + return bu(e); } -const s4 = [ +const a4 = [ "blobVersionedHashes", "chainId", "fees", @@ -3731,94 +3731,94 @@ const s4 = [ "type" ]; async function Ov(t, e) { - const { account: r = t.account, blobs: n, chain: i, gas: s, kzg: o, nonce: a, nonceManager: u, parameters: l = s4, type: d } = e, g = r && jo(r), w = { ...e, ...g ? { from: g == null ? void 0 : g.address } : {} }; + const { account: r = t.account, blobs: n, chain: i, gas: s, kzg: o, nonce: a, nonceManager: u, parameters: l = a4, type: d } = e, p = r && Wo(r), w = { ...e, ...p ? { from: p == null ? void 0 : p.address } : {} }; let A; - async function M() { - return A || (A = await vi(t, Gd, "getBlock")({ blockTag: "latest" }), A); + async function P() { + return A || (A = await bi(t, Yd, "getBlock")({ blockTag: "latest" }), A); } let N; async function L() { - return N || (i ? i.id : typeof e.chainId < "u" ? e.chainId : (N = await vi(t, O0, "getChainId")({}), N)); + return N || (i ? i.id : typeof e.chainId < "u" ? e.chainId : (N = await bi(t, N0, "getChainId")({}), N)); } if ((l.includes("blobVersionedHashes") || l.includes("sidecars")) && n && o) { - const $ = e4({ blobs: n, kzg: o }); + const $ = r4({ blobs: n, kzg: o }); if (l.includes("blobVersionedHashes")) { - const F = aN({ + const B = vN({ commitments: $, to: "hex" }); - w.blobVersionedHashes = F; + w.blobVersionedHashes = B; } if (l.includes("sidecars")) { - const F = t4({ blobs: n, commitments: $, kzg: o }), K = lN({ + const B = n4({ blobs: n, commitments: $, kzg: o }), H = xN({ blobs: n, commitments: $, - proofs: F, + proofs: B, to: "hex" }); - w.sidecars = K; + w.sidecars = H; } } - if (l.includes("chainId") && (w.chainId = await L()), l.includes("nonce") && typeof a > "u" && g) + if (l.includes("chainId") && (w.chainId = await L()), l.includes("nonce") && typeof a > "u" && p) if (u) { const $ = await L(); w.nonce = await u.consume({ - address: g.address, + address: p.address, chainId: $, client: t }); } else - w.nonce = await vi(t, ZO, "getTransactionCount")({ - address: g.address, + w.nonce = await bi(t, cN, "getTransactionCount")({ + address: p.address, blockTag: "pending" }); if ((l.includes("fees") || l.includes("type")) && typeof d > "u") try { - w.type = hN(w); + w.type = _N(w); } catch { - const $ = await M(); + const $ = await P(); w.type = typeof ($ == null ? void 0 : $.baseFeePerGas) == "bigint" ? "eip1559" : "legacy"; } if (l.includes("fees")) if (w.type !== "legacy" && w.type !== "eip2930") { if (typeof w.maxFeePerGas > "u" || typeof w.maxPriorityFeePerGas > "u") { - const $ = await M(), { maxFeePerGas: F, maxPriorityFeePerGas: K } = await T2(t, { + const $ = await P(), { maxFeePerGas: B, maxPriorityFeePerGas: H } = await D2(t, { block: $, chain: i, request: w }); - if (typeof e.maxPriorityFeePerGas > "u" && e.maxFeePerGas && e.maxFeePerGas < K) - throw new WO({ - maxPriorityFeePerGas: K + if (typeof e.maxPriorityFeePerGas > "u" && e.maxFeePerGas && e.maxFeePerGas < H) + throw new tN({ + maxPriorityFeePerGas: H }); - w.maxPriorityFeePerGas = K, w.maxFeePerGas = F; + w.maxPriorityFeePerGas = H, w.maxFeePerGas = B; } } else { if (typeof e.maxFeePerGas < "u" || typeof e.maxPriorityFeePerGas < "u") throw new Rv(); - const $ = await M(), { gasPrice: F } = await T2(t, { + const $ = await P(), { gasPrice: B } = await D2(t, { block: $, chain: i, request: w, type: "legacy" }); - w.gasPrice = F; + w.gasPrice = B; } - return l.includes("gas") && typeof s > "u" && (w.gas = await vi(t, pN, "estimateGas")({ + return l.includes("gas") && typeof s > "u" && (w.gas = await bi(t, SN, "estimateGas")({ ...w, - account: g && { address: g.address, type: "json-rpc" } - })), D0(w), delete w.parameters, w; + account: p && { address: p.address, type: "json-rpc" } + })), O0(w), delete w.parameters, w; } -async function dN(t, { address: e, blockNumber: r, blockTag: n = "latest" }) { +async function EN(t, { address: e, blockNumber: r, blockTag: n = "latest" }) { const i = r ? Mr(r) : void 0, s = await t.request({ method: "eth_getBalance", params: [e, i || n] }); return BigInt(s); } -async function pN(t, e) { +async function SN(t, e) { var i, s, o; - const { account: r = t.account } = e, n = r ? jo(r) : void 0; + const { account: r = t.account } = e, n = r ? Wo(r) : void 0; try { let f = function(b) { const { block: x, request: _, rpcStateOverride: E } = b; @@ -3827,47 +3827,47 @@ async function pN(t, e) { params: E ? [_, x ?? "latest", E] : x ? [_, x] : [_] }); }; - const { accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, blockNumber: g, blockTag: w, data: A, gas: M, gasPrice: N, maxFeePerBlobGas: L, maxFeePerGas: $, maxPriorityFeePerGas: F, nonce: K, value: H, stateOverride: V, ...te } = await Ov(t, { + const { accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, blockNumber: p, blockTag: w, data: A, gas: P, gasPrice: N, maxFeePerBlobGas: L, maxFeePerGas: $, maxPriorityFeePerGas: B, nonce: H, value: W, stateOverride: V, ...te } = await Ov(t, { ...e, parameters: ( // Some RPC Providers do not compute versioned hashes from blobs. We will need // to compute them. (n == null ? void 0 : n.type) === "local" ? void 0 : ["blobVersionedHashes"] ) - }), W = (g ? Mr(g) : void 0) || w, pe = qO(V), Ee = await (async () => { + }), K = (p ? Mr(p) : void 0) || w, ge = ZO(V), Ee = await (async () => { if (te.to) return te.to; if (u && u.length > 0) - return await J5({ + return await Z5({ authorization: u[0] }).catch(() => { throw new yt("`to` is required. Could not infer from `authorizationList`"); }); })(); - D0(e); + O0(e); const Y = (o = (s = (i = t.chain) == null ? void 0 : i.formatters) == null ? void 0 : s.transactionRequest) == null ? void 0 : o.format, m = (Y || Tv)({ // Pick out extra data that might exist on the chain's transaction request type. - ...Z5(te, { format: Y }), + ...e4(te, { format: Y }), from: n == null ? void 0 : n.address, accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, data: A, - gas: M, + gas: P, gasPrice: N, maxFeePerBlobGas: L, maxFeePerGas: $, - maxPriorityFeePerGas: F, - nonce: K, + maxPriorityFeePerGas: B, + nonce: H, to: Ee, - value: H + value: W }); - let p = BigInt(await f({ block: W, request: m, rpcStateOverride: pe })); + let g = BigInt(await f({ block: K, request: m, rpcStateOverride: ge })); if (u) { - const b = await dN(t, { address: m.from }), x = await Promise.all(u.map(async (_) => { + const b = await EN(t, { address: m.from }), x = await Promise.all(u.map(async (_) => { const { contractAddress: E } = _, v = await f({ - block: W, + block: K, request: { authorizationList: void 0, data: A, @@ -3875,22 +3875,22 @@ async function pN(t, e) { to: E, value: Mr(b) }, - rpcStateOverride: pe + rpcStateOverride: ge }).catch(() => 100000n); return 2n * BigInt(v); })); - p += x.reduce((_, E) => _ + E, 0n); + g += x.reduce((_, E) => _ + E, 0n); } - return p; + return g; } catch (a) { - throw FO(a, { + throw GO(a, { ...e, account: n, chain: t.chain }); } } -class gN extends yt { +class AN extends yt { constructor({ chain: e, currentChainId: r }) { super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`, { metaMessages: [ @@ -3901,7 +3901,7 @@ class gN extends yt { }); } } -class mN extends yt { +class PN extends yt { constructor() { super([ "No chain was provided to the request.", @@ -3912,22 +3912,22 @@ class mN extends yt { }); } } -const jg = "/docs/contract/encodeDeployData"; -function vN(t) { +const Ug = "/docs/contract/encodeDeployData"; +function MN(t) { const { abi: e, args: r, bytecode: n } = t; if (!r || r.length === 0) return n; const i = e.find((o) => "type" in o && o.type === "constructor"); if (!i) - throw new LR({ docsPath: jg }); + throw new HR({ docsPath: Ug }); if (!("inputs" in i)) - throw new m2({ docsPath: jg }); + throw new b2({ docsPath: Ug }); if (!i.inputs || i.inputs.length === 0) - throw new m2({ docsPath: jg }); - const s = U5(i.inputs, r); - return T0([n, s]); + throw new b2({ docsPath: Ug }); + const s = q5(i.inputs, r); + return R0([n, s]); } -async function bN(t) { +async function IN(t) { return new Promise((e) => setTimeout(e, t)); } class Fl extends yt { @@ -3952,44 +3952,44 @@ class qg extends yt { }); } } -function o4({ chain: t, currentChainId: e }) { +function c4({ chain: t, currentChainId: e }) { if (!t) - throw new mN(); + throw new PN(); if (e !== t.id) - throw new gN({ chain: t, currentChainId: e }); + throw new AN({ chain: t, currentChainId: e }); } -function yN(t, { docsPath: e, ...r }) { +function CN(t, { docsPath: e, ...r }) { const n = (() => { - const i = X5(t, r); + const i = Q5(t, r); return i instanceof Cv ? t : i; })(); - return new yO(n, { + return new CO(n, { docsPath: e, ...r }); } -async function a4(t, { serializedTransaction: e }) { +async function u4(t, { serializedTransaction: e }) { return t.request({ method: "eth_sendRawTransaction", params: [e] }, { retryCount: 0 }); } -const zg = new C0(128); +const zg = new T0(128); async function Nv(t, e) { - var $, F, K, H; - const { account: r = t.account, chain: n = t.chain, accessList: i, authorizationList: s, blobs: o, data: a, gas: u, gasPrice: l, maxFeePerBlobGas: d, maxFeePerGas: g, maxPriorityFeePerGas: w, nonce: A, value: M, ...N } = e; + var $, B, H, W; + const { account: r = t.account, chain: n = t.chain, accessList: i, authorizationList: s, blobs: o, data: a, gas: u, gasPrice: l, maxFeePerBlobGas: d, maxFeePerGas: p, maxPriorityFeePerGas: w, nonce: A, value: P, ...N } = e; if (typeof r > "u") throw new Fl({ docsPath: "/docs/actions/wallet/sendTransaction" }); - const L = r ? jo(r) : null; + const L = r ? Wo(r) : null; try { - D0(e); + O0(e); const V = await (async () => { if (e.to) return e.to; if (s && s.length > 0) - return await J5({ + return await Z5({ authorization: s[0] }).catch(() => { throw new yt("`to` is required. Could not infer from `authorizationList`."); @@ -3997,13 +3997,13 @@ async function Nv(t, e) { })(); if ((L == null ? void 0 : L.type) === "json-rpc" || L === null) { let te; - n !== null && (te = await vi(t, O0, "getChainId")({}), o4({ + n !== null && (te = await bi(t, N0, "getChainId")({}), c4({ currentChainId: te, chain: n })); - const R = (K = (F = ($ = t.chain) == null ? void 0 : $.formatters) == null ? void 0 : F.transactionRequest) == null ? void 0 : K.format, pe = (R || Tv)({ + const R = (H = (B = ($ = t.chain) == null ? void 0 : $.formatters) == null ? void 0 : B.transactionRequest) == null ? void 0 : H.format, ge = (R || Tv)({ // Pick out extra data that might exist on the chain's transaction request type. - ...Z5(N, { format: R }), + ...e4(N, { format: R }), accessList: i, authorizationList: s, blobs: o, @@ -4013,16 +4013,16 @@ async function Nv(t, e) { gas: u, gasPrice: l, maxFeePerBlobGas: d, - maxFeePerGas: g, + maxFeePerGas: p, maxPriorityFeePerGas: w, nonce: A, to: V, - value: M + value: P }), Ee = zg.get(t.uid), Y = Ee ? "wallet_sendTransaction" : "eth_sendTransaction"; try { return await t.request({ method: Y, - params: [pe] + params: [ge] }, { retryCount: 0 }); } catch (S) { if (Ee === !1) @@ -4031,16 +4031,16 @@ async function Nv(t, e) { if (m.name === "InvalidInputRpcError" || m.name === "InvalidParamsRpcError" || m.name === "MethodNotFoundRpcError" || m.name === "MethodNotSupportedRpcError") return await t.request({ method: "wallet_sendTransaction", - params: [pe] + params: [ge] }, { retryCount: 0 }).then((f) => (zg.set(t.uid, !0), f)).catch((f) => { - const p = f; - throw p.name === "MethodNotFoundRpcError" || p.name === "MethodNotSupportedRpcError" ? (zg.set(t.uid, !1), m) : p; + const g = f; + throw g.name === "MethodNotFoundRpcError" || g.name === "MethodNotSupportedRpcError" ? (zg.set(t.uid, !1), m) : g; }); throw m; } } if ((L == null ? void 0 : L.type) === "local") { - const te = await vi(t, Ov, "prepareTransactionRequest")({ + const te = await bi(t, Ov, "prepareTransactionRequest")({ account: L, accessList: i, authorizationList: s, @@ -4050,19 +4050,19 @@ async function Nv(t, e) { gas: u, gasPrice: l, maxFeePerBlobGas: d, - maxFeePerGas: g, + maxFeePerGas: p, maxPriorityFeePerGas: w, nonce: A, nonceManager: L.nonceManager, - parameters: [...s4, "sidecars"], - value: M, + parameters: [...a4, "sidecars"], + value: P, ...N, to: V - }), R = (H = n == null ? void 0 : n.serializers) == null ? void 0 : H.transaction, W = await L.signTransaction(te, { + }), R = (W = n == null ? void 0 : n.serializers) == null ? void 0 : W.transaction, K = await L.signTransaction(te, { serializer: R }); - return await vi(t, a4, "sendRawTransaction")({ - serializedTransaction: W + return await bi(t, u4, "sendRawTransaction")({ + serializedTransaction: K }); } throw (L == null ? void 0 : L.type) === "smart" ? new qg({ @@ -4076,33 +4076,33 @@ async function Nv(t, e) { type: L == null ? void 0 : L.type }); } catch (V) { - throw V instanceof qg ? V : yN(V, { + throw V instanceof qg ? V : CN(V, { ...e, account: L, chain: e.chain || void 0 }); } } -async function wN(t, e) { +async function TN(t, e) { const { abi: r, account: n = t.account, address: i, args: s, dataSuffix: o, functionName: a, ...u } = e; if (typeof n > "u") throw new Fl({ docsPath: "/docs/contract/writeContract" }); - const l = n ? jo(n) : null, d = GD({ + const l = n ? Wo(n) : null, d = iO({ abi: r, args: s, functionName: a }); try { - return await vi(t, Nv, "sendTransaction")({ + return await bi(t, Nv, "sendTransaction")({ data: `${d}${o ? o.replace("0x", "") : ""}`, to: i, account: l, ...u }); - } catch (g) { - throw CO(g, { + } catch (p) { + throw FO(p, { abi: r, address: i, args: s, @@ -4112,7 +4112,7 @@ async function wN(t, e) { }); } } -async function xN(t, { chain: e }) { +async function RN(t, { chain: e }) { const { id: r, name: n, nativeCurrency: i, rpcUrls: s, blockExplorers: o } = e; await t.request({ method: "wallet_addEthereumChain", @@ -4128,20 +4128,20 @@ async function xN(t, { chain: e }) { }, { dedupe: !0, retryCount: 0 }); } const a1 = 256; -let rd = a1, nd; -function c4(t = 11) { - if (!nd || rd + t > a1 * 2) { - nd = "", rd = 0; +let nd = a1, id; +function f4(t = 11) { + if (!id || nd + t > a1 * 2) { + id = "", nd = 0; for (let e = 0; e < a1; e++) - nd += (256 + Math.random() * 256 | 0).toString(16).substring(1); + id += (256 + Math.random() * 256 | 0).toString(16).substring(1); } - return nd.substring(rd, rd++ + t); + return id.substring(nd, nd++ + t); } -function _N(t) { - const { batch: e, cacheTime: r = t.pollingInterval ?? 4e3, ccipRead: n, key: i = "base", name: s = "Base Client", pollingInterval: o = 4e3, type: a = "base" } = t, u = t.chain, l = t.account ? jo(t.account) : void 0, { config: d, request: g, value: w } = t.transport({ +function DN(t) { + const { batch: e, cacheTime: r = t.pollingInterval ?? 4e3, ccipRead: n, key: i = "base", name: s = "Base Client", pollingInterval: o = 4e3, type: a = "base" } = t, u = t.chain, l = t.account ? Wo(t.account) : void 0, { config: d, request: p, value: w } = t.transport({ chain: u, pollingInterval: o - }), A = { ...d, ...w }, M = { + }), A = { ...d, ...w }, P = { account: l, batch: e, cacheTime: r, @@ -4150,37 +4150,37 @@ function _N(t) { key: i, name: s, pollingInterval: o, - request: g, + request: p, transport: A, type: a, - uid: c4() + uid: f4() }; function N(L) { return ($) => { - const F = $(L); - for (const H in M) - delete F[H]; - const K = { ...L, ...F }; - return Object.assign(K, { extend: N(K) }); + const B = $(L); + for (const W in P) + delete B[W]; + const H = { ...L, ...B }; + return Object.assign(H, { extend: N(H) }); }; } - return Object.assign(M, { extend: N(M) }); + return Object.assign(P, { extend: N(P) }); } -const id = /* @__PURE__ */ new C0(8192); -function EN(t, { enabled: e = !0, id: r }) { +const sd = /* @__PURE__ */ new T0(8192); +function ON(t, { enabled: e = !0, id: r }) { if (!e || !r) return t(); - if (id.get(r)) - return id.get(r); - const n = t().finally(() => id.delete(r)); - return id.set(r, n), n; + if (sd.get(r)) + return sd.get(r); + const n = t().finally(() => sd.delete(r)); + return sd.set(r, n), n; } -function SN(t, { delay: e = 100, retryCount: r = 2, shouldRetry: n = () => !0 } = {}) { +function NN(t, { delay: e = 100, retryCount: r = 2, shouldRetry: n = () => !0 } = {}) { return new Promise((i, s) => { const o = async ({ count: a = 0 } = {}) => { const u = async ({ error: l }) => { const d = typeof e == "function" ? e({ count: a, error: l }) : e; - d && await bN(d), o({ count: a + 1 }); + d && await IN(d), o({ count: a + 1 }); }; try { const l = await t(); @@ -4194,30 +4194,28 @@ function SN(t, { delay: e = 100, retryCount: r = 2, shouldRetry: n = () => !0 } o(); }); } -function AN(t, e = {}) { +function LN(t, e = {}) { return async (r, n = {}) => { const { dedupe: i = !1, retryDelay: s = 150, retryCount: o = 3, uid: a } = { ...e, ...n - }, u = i ? kl(M0(`${a}.${Tu(r)}`)) : void 0; - return EN(() => SN(async () => { + }, u = i ? $l(I0(`${a}.${Ru(r)}`)) : void 0; + return ON(() => NN(async () => { try { return await t(r); } catch (l) { const d = l; switch (d.code) { - case tl.code: - throw new tl(d); case rl.code: throw new rl(d); case nl.code: - throw new nl(d, { method: r.method }); + throw new nl(d); case il.code: - throw new il(d); - case cc.code: - throw new cc(d); + throw new il(d, { method: r.method }); case sl.code: throw new sl(d); + case fc.code: + throw new fc(d); case ol.code: throw new ol(d); case al.code: @@ -4225,17 +4223,17 @@ function AN(t, e = {}) { case cl.code: throw new cl(d); case ul.code: - throw new ul(d, { + throw new ul(d); + case fl.code: + throw new fl(d, { method: r.method }); - case wu.code: - throw new wu(d); - case fl.code: - throw new fl(d); - case au.code: - throw new au(d); + case xu.code: + throw new xu(d); case ll.code: throw new ll(d); + case cu.code: + throw new cu(d); case hl.code: throw new hl(d); case dl.code: @@ -4244,32 +4242,34 @@ function AN(t, e = {}) { throw new pl(d); case gl.code: throw new gl(d); + case ml.code: + throw new ml(d); case 5e3: - throw new au(d); + throw new cu(d); default: - throw l instanceof yt ? l : new MO(d); + throw l instanceof yt ? l : new $O(d); } } }, { delay: ({ count: l, error: d }) => { - var g; - if (d && d instanceof V5) { - const w = (g = d == null ? void 0 : d.headers) == null ? void 0 : g.get("Retry-After"); + var p; + if (d && d instanceof Y5) { + const w = (p = d == null ? void 0 : d.headers) == null ? void 0 : p.get("Retry-After"); if (w != null && w.match(/\d/)) return Number.parseInt(w) * 1e3; } return ~~(1 << l) * s; }, retryCount: o, - shouldRetry: ({ error: l }) => PN(l) + shouldRetry: ({ error: l }) => kN(l) }), { enabled: i, id: u }); }; } -function PN(t) { - return "code" in t && typeof t.code == "number" ? t.code === -1 || t.code === wu.code || t.code === cc.code : t instanceof V5 && t.status ? t.status === 403 || t.status === 408 || t.status === 413 || t.status === 429 || t.status === 500 || t.status === 502 || t.status === 503 || t.status === 504 : !0; +function kN(t) { + return "code" in t && typeof t.code == "number" ? t.code === -1 || t.code === xu.code || t.code === fc.code : t instanceof Y5 && t.status ? t.status === 403 || t.status === 408 || t.status === 413 || t.status === 429 || t.status === 500 || t.status === 502 || t.status === 503 || t.status === 504 : !0; } -function MN({ key: t, name: e, request: r, retryCount: n = 3, retryDelay: i = 150, timeout: s, type: o }, a) { - const u = c4(); +function $N({ key: t, name: e, request: r, retryCount: n = 3, retryDelay: i = 150, timeout: s, type: o }, a) { + const u = f4(); return { config: { key: t, @@ -4280,13 +4280,13 @@ function MN({ key: t, name: e, request: r, retryCount: n = 3, retryDelay: i = 15 timeout: s, type: o }, - request: AN(r, { retryCount: n, retryDelay: i, uid: u }), + request: LN(r, { retryCount: n, retryDelay: i, uid: u }), value: a }; } -function IN(t, e = {}) { +function BN(t, e = {}) { const { key: r = "custom", name: n = "Custom Provider", retryDelay: i } = e; - return ({ retryCount: s }) => MN({ + return ({ retryCount: s }) => $N({ key: r, name: n, request: t.request.bind(t), @@ -4295,15 +4295,15 @@ function IN(t, e = {}) { type: "custom" }); } -const CN = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, TN = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/; -class RN extends yt { +const FN = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, jN = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/; +class UN extends yt { constructor({ domain: e }) { - super(`Invalid domain "${Tu(e)}".`, { + super(`Invalid domain "${Ru(e)}".`, { metaMessages: ["Must be a valid EIP-712 domain."] }); } } -class DN extends yt { +class qN extends yt { constructor({ primaryType: e, types: r }) { super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`, { docsPath: "/api/glossary/Errors#typeddatainvalidprimarytypeerror", @@ -4311,7 +4311,7 @@ class DN extends yt { }); } } -class ON extends yt { +class zN extends yt { constructor({ type: e }) { super(`Struct type "${e}" is invalid.`, { metaMessages: ["Struct type must not be a Solidity type."], @@ -4319,11 +4319,11 @@ class ON extends yt { }); } } -function NN(t) { +function WN(t) { const { domain: e, message: r, primaryType: n, types: i } = t, s = (u, l) => { const d = { ...l }; - for (const g of u) { - const { name: w, type: A } = g; + for (const p of u) { + const { name: w, type: A } = p; A === "address" && (d[w] = d[w].toLowerCase()); } return d; @@ -4331,46 +4331,46 @@ function NN(t) { if (n !== "EIP712Domain") return s(i[n], r); })(); - return Tu({ domain: o, message: a, primaryType: n, types: i }); + return Ru({ domain: o, message: a, primaryType: n, types: i }); } -function LN(t) { +function HN(t) { const { domain: e, message: r, primaryType: n, types: i } = t, s = (o, a) => { for (const u of o) { - const { name: l, type: d } = u, g = a[l], w = d.match(TN); - if (w && (typeof g == "number" || typeof g == "bigint")) { + const { name: l, type: d } = u, p = a[l], w = d.match(jN); + if (w && (typeof p == "number" || typeof p == "bigint")) { const [N, L, $] = w; - Mr(g, { + Mr(p, { signed: L === "int", size: Number.parseInt($) / 8 }); } - if (d === "address" && typeof g == "string" && !Lo(g)) - throw new bu({ address: g }); - const A = d.match(CN); + if (d === "address" && typeof p == "string" && !$o(p)) + throw new yu({ address: p }); + const A = d.match(FN); if (A) { const [N, L] = A; - if (L && An(g) !== Number.parseInt(L)) - throw new jR({ + if (L && An(p) !== Number.parseInt(L)) + throw new XR({ expectedSize: Number.parseInt(L), - givenSize: An(g) + givenSize: An(p) }); } - const M = i[d]; - M && ($N(d), s(M, g)); + const P = i[d]; + P && (VN(d), s(P, p)); } }; if (i.EIP712Domain && e) { if (typeof e != "object") - throw new RN({ domain: e }); + throw new UN({ domain: e }); s(i.EIP712Domain, e); } if (n !== "EIP712Domain") if (i[n]) s(i[n], r); else - throw new DN({ primaryType: n, types: i }); + throw new qN({ primaryType: n, types: i }); } -function kN({ domain: t }) { +function KN({ domain: t }) { return [ typeof (t == null ? void 0 : t.name) == "string" && { name: "name", type: "string" }, (t == null ? void 0 : t.version) && { name: "version", type: "string" }, @@ -4385,61 +4385,61 @@ function kN({ domain: t }) { (t == null ? void 0 : t.salt) && { name: "salt", type: "bytes32" } ].filter(Boolean); } -function $N(t) { +function VN(t) { if (t === "address" || t === "bool" || t === "string" || t.startsWith("bytes") || t.startsWith("uint") || t.startsWith("int")) - throw new ON({ type: t }); + throw new zN({ type: t }); } -function FN(t, e) { - const { abi: r, args: n, bytecode: i, ...s } = e, o = vN({ abi: r, args: n, bytecode: i }); +function GN(t, e) { + const { abi: r, args: n, bytecode: i, ...s } = e, o = MN({ abi: r, args: n, bytecode: i }); return Nv(t, { ...s, data: o }); } -async function BN(t) { +async function YN(t) { var r; - return ((r = t.account) == null ? void 0 : r.type) === "local" ? [t.account.address] : (await t.request({ method: "eth_accounts" }, { dedupe: !0 })).map((n) => $l(n)); + return ((r = t.account) == null ? void 0 : r.type) === "local" ? [t.account.address] : (await t.request({ method: "eth_accounts" }, { dedupe: !0 })).map((n) => Bl(n)); } -async function UN(t) { +async function JN(t) { return await t.request({ method: "wallet_getPermissions" }, { dedupe: !0 }); } -async function jN(t) { +async function XN(t) { return (await t.request({ method: "eth_requestAccounts" }, { dedupe: !0, retryCount: 0 })).map((r) => Ev(r)); } -async function qN(t, e) { +async function ZN(t, e) { return t.request({ method: "wallet_requestPermissions", params: [e] }, { retryCount: 0 }); } -async function zN(t, { account: e = t.account, message: r }) { +async function QN(t, { account: e = t.account, message: r }) { if (!e) throw new Fl({ docsPath: "/docs/actions/wallet/signMessage" }); - const n = jo(e); + const n = Wo(e); if (n.signMessage) return n.signMessage({ message: r }); - const i = typeof r == "string" ? M0(r) : r.raw instanceof Uint8Array ? qd(r.raw) : r.raw; + const i = typeof r == "string" ? I0(r) : r.raw instanceof Uint8Array ? zd(r.raw) : r.raw; return t.request({ method: "personal_sign", params: [i, n.address] }, { retryCount: 0 }); } -async function HN(t, e) { - var l, d, g, w; +async function eL(t, e) { + var l, d, p, w; const { account: r = t.account, chain: n = t.chain, ...i } = e; if (!r) throw new Fl({ docsPath: "/docs/actions/wallet/signTransaction" }); - const s = jo(r); - D0({ + const s = Wo(r); + O0({ account: s, ...e }); - const o = await vi(t, O0, "getChainId")({}); - n !== null && o4({ + const o = await bi(t, N0, "getChainId")({}); + n !== null && c4({ currentChainId: o, chain: n }); @@ -4447,7 +4447,7 @@ async function HN(t, e) { return s.signTransaction ? s.signTransaction({ ...i, chainId: o - }, { serializer: (w = (g = t.chain) == null ? void 0 : g.serializers) == null ? void 0 : w.transaction }) : await t.request({ + }, { serializer: (w = (p = t.chain) == null ? void 0 : p.serializers) == null ? void 0 : w.transaction }) : await t.request({ method: "eth_signTransaction", params: [ { @@ -4458,25 +4458,25 @@ async function HN(t, e) { ] }, { retryCount: 0 }); } -async function WN(t, e) { +async function tL(t, e) { const { account: r = t.account, domain: n, message: i, primaryType: s } = e; if (!r) throw new Fl({ docsPath: "/docs/actions/wallet/signTypedData" }); - const o = jo(r), a = { - EIP712Domain: kN({ domain: n }), + const o = Wo(r), a = { + EIP712Domain: KN({ domain: n }), ...e.types }; - if (LN({ domain: n, message: i, primaryType: s, types: a }), o.signTypedData) + if (HN({ domain: n, message: i, primaryType: s, types: a }), o.signTypedData) return o.signTypedData({ domain: n, message: i, primaryType: s, types: a }); - const u = NN({ domain: n, message: i, primaryType: s, types: a }); + const u = WN({ domain: n, message: i, primaryType: s, types: a }); return t.request({ method: "eth_signTypedData_v4", params: [o.address, u] }, { retryCount: 0 }); } -async function KN(t, { id: e }) { +async function rL(t, { id: e }) { await t.request({ method: "wallet_switchEthereumChain", params: [ @@ -4486,52 +4486,52 @@ async function KN(t, { id: e }) { ] }, { retryCount: 0 }); } -async function VN(t, e) { +async function nL(t, e) { return await t.request({ method: "wallet_watchAsset", params: e }, { retryCount: 0 }); } -function GN(t) { +function iL(t) { return { - addChain: (e) => xN(t, e), - deployContract: (e) => FN(t, e), - getAddresses: () => BN(t), - getChainId: () => O0(t), - getPermissions: () => UN(t), + addChain: (e) => RN(t, e), + deployContract: (e) => GN(t, e), + getAddresses: () => YN(t), + getChainId: () => N0(t), + getPermissions: () => JN(t), prepareTransactionRequest: (e) => Ov(t, e), - requestAddresses: () => jN(t), - requestPermissions: (e) => qN(t, e), - sendRawTransaction: (e) => a4(t, e), + requestAddresses: () => XN(t), + requestPermissions: (e) => ZN(t, e), + sendRawTransaction: (e) => u4(t, e), sendTransaction: (e) => Nv(t, e), - signMessage: (e) => zN(t, e), - signTransaction: (e) => HN(t, e), - signTypedData: (e) => WN(t, e), - switchChain: (e) => KN(t, e), - watchAsset: (e) => VN(t, e), - writeContract: (e) => wN(t, e) + signMessage: (e) => QN(t, e), + signTransaction: (e) => eL(t, e), + signTypedData: (e) => tL(t, e), + switchChain: (e) => rL(t, e), + watchAsset: (e) => nL(t, e), + writeContract: (e) => TN(t, e) }; } -function YN(t) { +function sL(t) { const { key: e = "wallet", name: r = "Wallet Client", transport: n } = t; - return _N({ + return DN({ ...t, key: e, name: r, transport: n, type: "walletClient" - }).extend(GN); + }).extend(iL); } -class ml { +class vl { constructor(e) { - Rs(this, "_key"); - Rs(this, "_config", null); - Rs(this, "_provider", null); - Rs(this, "_connected", !1); - Rs(this, "_address", null); - Rs(this, "_fatured", !1); - Rs(this, "_installed", !1); - Rs(this, "lastUsed", !1); + Ds(this, "_key"); + Ds(this, "_config", null); + Ds(this, "_provider", null); + Ds(this, "_connected", !1); + Ds(this, "_address", null); + Ds(this, "_fatured", !1); + Ds(this, "_installed", !1); + Ds(this, "lastUsed", !1); var r; if ("name" in e && "image" in e) this._key = e.name, this._config = e, this._fatured = e.featured; @@ -4567,13 +4567,13 @@ class ml { return this._installed; } get client() { - return this._provider ? YN({ transport: IN(this._provider) }) : null; + return this._provider ? sL({ transport: BN(this._provider) }) : null; } get config() { return this._config; } static fromWalletConfig(e) { - return new ml(e); + return new vl(e); } EIP6963Detected(e) { this._provider = e.provider, this._installed = !0, this._provider.on("disconnect", this.disconnect), this._provider.on("accountsChanged", (r) => { @@ -4614,58 +4614,58 @@ class ml { this._provider && "session" in this._provider && await this._provider.disconnect(), this._connected = !1, this._address = null; } } -var Lv = { exports: {} }, cu = typeof Reflect == "object" ? Reflect : null, O2 = cu && typeof cu.apply == "function" ? cu.apply : function(e, r, n) { +var Lv = { exports: {} }, uu = typeof Reflect == "object" ? Reflect : null, L2 = uu && typeof uu.apply == "function" ? uu.apply : function(e, r, n) { return Function.prototype.apply.call(e, r, n); -}, wd; -cu && typeof cu.ownKeys == "function" ? wd = cu.ownKeys : Object.getOwnPropertySymbols ? wd = function(e) { +}, xd; +uu && typeof uu.ownKeys == "function" ? xd = uu.ownKeys : Object.getOwnPropertySymbols ? xd = function(e) { return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e)); -} : wd = function(e) { +} : xd = function(e) { return Object.getOwnPropertyNames(e); }; -function JN(t) { +function oL(t) { console && console.warn && console.warn(t); } -var u4 = Number.isNaN || function(e) { +var l4 = Number.isNaN || function(e) { return e !== e; }; function kr() { kr.init.call(this); } Lv.exports = kr; -Lv.exports.once = eL; +Lv.exports.once = fL; kr.EventEmitter = kr; kr.prototype._events = void 0; kr.prototype._eventsCount = 0; kr.prototype._maxListeners = void 0; -var N2 = 10; -function N0(t) { +var k2 = 10; +function L0(t) { if (typeof t != "function") throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof t); } Object.defineProperty(kr, "defaultMaxListeners", { enumerable: !0, get: function() { - return N2; + return k2; }, set: function(t) { - if (typeof t != "number" || t < 0 || u4(t)) + if (typeof t != "number" || t < 0 || l4(t)) throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + t + "."); - N2 = t; + k2 = t; } }); kr.init = function() { (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0; }; kr.prototype.setMaxListeners = function(e) { - if (typeof e != "number" || e < 0 || u4(e)) + if (typeof e != "number" || e < 0 || l4(e)) throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + "."); return this._maxListeners = e, this; }; -function f4(t) { +function h4(t) { return t._maxListeners === void 0 ? kr.defaultMaxListeners : t._maxListeners; } kr.prototype.getMaxListeners = function() { - return f4(this); + return h4(this); }; kr.prototype.emit = function(e) { for (var r = [], n = 1; n < arguments.length; n++) r.push(arguments[n]); @@ -4685,51 +4685,51 @@ kr.prototype.emit = function(e) { if (u === void 0) return !1; if (typeof u == "function") - O2(u, this, r); + L2(u, this, r); else - for (var l = u.length, d = g4(u, l), n = 0; n < l; ++n) - O2(d[n], this, r); + for (var l = u.length, d = v4(u, l), n = 0; n < l; ++n) + L2(d[n], this, r); return !0; }; -function l4(t, e, r, n) { +function d4(t, e, r, n) { var i, s, o; - if (N0(r), s = t._events, s === void 0 ? (s = t._events = /* @__PURE__ */ Object.create(null), t._eventsCount = 0) : (s.newListener !== void 0 && (t.emit( + if (L0(r), s = t._events, s === void 0 ? (s = t._events = /* @__PURE__ */ Object.create(null), t._eventsCount = 0) : (s.newListener !== void 0 && (t.emit( "newListener", e, r.listener ? r.listener : r ), s = t._events), o = s[e]), o === void 0) o = s[e] = r, ++t._eventsCount; - else if (typeof o == "function" ? o = s[e] = n ? [r, o] : [o, r] : n ? o.unshift(r) : o.push(r), i = f4(t), i > 0 && o.length > i && !o.warned) { + else if (typeof o == "function" ? o = s[e] = n ? [r, o] : [o, r] : n ? o.unshift(r) : o.push(r), i = h4(t), i > 0 && o.length > i && !o.warned) { o.warned = !0; var a = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit"); - a.name = "MaxListenersExceededWarning", a.emitter = t, a.type = e, a.count = o.length, JN(a); + a.name = "MaxListenersExceededWarning", a.emitter = t, a.type = e, a.count = o.length, oL(a); } return t; } kr.prototype.addListener = function(e, r) { - return l4(this, e, r, !1); + return d4(this, e, r, !1); }; kr.prototype.on = kr.prototype.addListener; kr.prototype.prependListener = function(e, r) { - return l4(this, e, r, !0); + return d4(this, e, r, !0); }; -function XN() { +function aL() { if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments); } -function h4(t, e, r) { - var n = { fired: !1, wrapFn: void 0, target: t, type: e, listener: r }, i = XN.bind(n); +function p4(t, e, r) { + var n = { fired: !1, wrapFn: void 0, target: t, type: e, listener: r }, i = aL.bind(n); return i.listener = r, n.wrapFn = i, i; } kr.prototype.once = function(e, r) { - return N0(r), this.on(e, h4(this, e, r)), this; + return L0(r), this.on(e, p4(this, e, r)), this; }; kr.prototype.prependOnceListener = function(e, r) { - return N0(r), this.prependListener(e, h4(this, e, r)), this; + return L0(r), this.prependListener(e, p4(this, e, r)), this; }; kr.prototype.removeListener = function(e, r) { var n, i, s, o, a; - if (N0(r), i = this._events, i === void 0) + if (L0(r), i = this._events, i === void 0) return this; if (n = i[e], n === void 0) return this; @@ -4743,7 +4743,7 @@ kr.prototype.removeListener = function(e, r) { } if (s < 0) return this; - s === 0 ? n.shift() : ZN(n, s), n.length === 1 && (i[e] = n[0]), i.removeListener !== void 0 && this.emit("removeListener", e, a || r); + s === 0 ? n.shift() : cL(n, s), n.length === 1 && (i[e] = n[0]), i.removeListener !== void 0 && this.emit("removeListener", e, a || r); } return this; }; @@ -4767,24 +4767,24 @@ kr.prototype.removeAllListeners = function(e) { this.removeListener(e, r[i]); return this; }; -function d4(t, e, r) { +function g4(t, e, r) { var n = t._events; if (n === void 0) return []; var i = n[e]; - return i === void 0 ? [] : typeof i == "function" ? r ? [i.listener || i] : [i] : r ? QN(i) : g4(i, i.length); + return i === void 0 ? [] : typeof i == "function" ? r ? [i.listener || i] : [i] : r ? uL(i) : v4(i, i.length); } kr.prototype.listeners = function(e) { - return d4(this, e, !0); + return g4(this, e, !0); }; kr.prototype.rawListeners = function(e) { - return d4(this, e, !1); + return g4(this, e, !1); }; kr.listenerCount = function(t, e) { - return typeof t.listenerCount == "function" ? t.listenerCount(e) : p4.call(t, e); + return typeof t.listenerCount == "function" ? t.listenerCount(e) : m4.call(t, e); }; -kr.prototype.listenerCount = p4; -function p4(t) { +kr.prototype.listenerCount = m4; +function m4(t) { var e = this._events; if (e !== void 0) { var r = e[t]; @@ -4796,24 +4796,24 @@ function p4(t) { return 0; } kr.prototype.eventNames = function() { - return this._eventsCount > 0 ? wd(this._events) : []; + return this._eventsCount > 0 ? xd(this._events) : []; }; -function g4(t, e) { +function v4(t, e) { for (var r = new Array(e), n = 0; n < e; ++n) r[n] = t[n]; return r; } -function ZN(t, e) { +function cL(t, e) { for (; e + 1 < t.length; e++) t[e] = t[e + 1]; t.pop(); } -function QN(t) { +function uL(t) { for (var e = new Array(t.length), r = 0; r < e.length; ++r) e[r] = t[r].listener || t[r]; return e; } -function eL(t, e) { +function fL(t, e) { return new Promise(function(r, n) { function i(o) { t.removeListener(e, s), n(o); @@ -4821,13 +4821,13 @@ function eL(t, e) { function s() { typeof t.removeListener == "function" && t.removeListener("error", i), r([].slice.call(arguments)); } - m4(t, e, s, { once: !0 }), e !== "error" && tL(t, i, { once: !0 }); + b4(t, e, s, { once: !0 }), e !== "error" && lL(t, i, { once: !0 }); }); } -function tL(t, e, r) { - typeof t.on == "function" && m4(t, "error", e, r); +function lL(t, e, r) { + typeof t.on == "function" && b4(t, "error", e, r); } -function m4(t, e, r, n) { +function b4(t, e, r, n) { if (typeof t.on == "function") n.once ? t.once(e, r) : t.on(e, r); else if (typeof t.addEventListener == "function") @@ -4837,8 +4837,8 @@ function m4(t, e, r, n) { else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof t); } -var rs = Lv.exports; -const kv = /* @__PURE__ */ ts(rs); +var ns = Lv.exports; +const kv = /* @__PURE__ */ rs(ns); var mt = {}; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. @@ -4861,7 +4861,7 @@ var c1 = function(t, e) { for (var i in n) n.hasOwnProperty(i) && (r[i] = n[i]); }, c1(t, e); }; -function rL(t, e) { +function hL(t, e) { c1(t, e); function r() { this.constructor = t; @@ -4877,7 +4877,7 @@ var u1 = function() { return e; }, u1.apply(this, arguments); }; -function nL(t, e) { +function dL(t, e) { var r = {}; for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); if (t != null && typeof Object.getOwnPropertySymbols == "function") @@ -4885,21 +4885,21 @@ function nL(t, e) { e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]); return r; } -function iL(t, e, r, n) { +function pL(t, e, r, n) { var i = arguments.length, s = i < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, r) : n, o; if (typeof Reflect == "object" && typeof Reflect.decorate == "function") s = Reflect.decorate(t, e, r, n); else for (var a = t.length - 1; a >= 0; a--) (o = t[a]) && (s = (i < 3 ? o(s) : i > 3 ? o(e, r, s) : o(e, r)) || s); return i > 3 && s && Object.defineProperty(e, r, s), s; } -function sL(t, e) { +function gL(t, e) { return function(r, n) { e(r, n, t); }; } -function oL(t, e) { +function mL(t, e) { if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(t, e); } -function aL(t, e, r, n) { +function vL(t, e, r, n) { function i(s) { return s instanceof r ? s : new r(function(o) { o(s); @@ -4909,15 +4909,15 @@ function aL(t, e, r, n) { function a(d) { try { l(n.next(d)); - } catch (g) { - o(g); + } catch (p) { + o(p); } } function u(d) { try { l(n.throw(d)); - } catch (g) { - o(g); + } catch (p) { + o(p); } } function l(d) { @@ -4926,7 +4926,7 @@ function aL(t, e, r, n) { l((n = n.apply(t, e || [])).next()); }); } -function cL(t, e) { +function bL(t, e) { var r = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; @@ -4986,10 +4986,10 @@ function cL(t, e) { return { value: l[0] ? l[1] : void 0, done: !0 }; } } -function uL(t, e, r, n) { +function yL(t, e, r, n) { n === void 0 && (n = r), t[n] = e[r]; } -function fL(t, e) { +function wL(t, e) { for (var r in t) r !== "default" && !e.hasOwnProperty(r) && (e[r] = t[r]); } function f1(t) { @@ -5002,7 +5002,7 @@ function f1(t) { }; throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined."); } -function v4(t, e) { +function y4(t, e) { var r = typeof Symbol == "function" && t[Symbol.iterator]; if (!r) return t; var n = r.call(t), i, s = [], o; @@ -5019,22 +5019,22 @@ function v4(t, e) { } return s; } -function lL() { +function xL() { for (var t = [], e = 0; e < arguments.length; e++) - t = t.concat(v4(arguments[e])); + t = t.concat(y4(arguments[e])); return t; } -function hL() { +function _L() { for (var t = 0, e = 0, r = arguments.length; e < r; e++) t += arguments[e].length; for (var n = Array(t), i = 0, e = 0; e < r; e++) for (var s = arguments[e], o = 0, a = s.length; o < a; o++, i++) n[i] = s[o]; return n; } -function vl(t) { - return this instanceof vl ? (this.v = t, this) : new vl(t); +function bl(t) { + return this instanceof bl ? (this.v = t, this) : new bl(t); } -function dL(t, e, r) { +function EL(t, e, r) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var n = r.apply(t, e || []), i, s = []; return i = {}, o("next"), o("throw"), o("return"), i[Symbol.asyncIterator] = function() { @@ -5042,20 +5042,20 @@ function dL(t, e, r) { }, i; function o(w) { n[w] && (i[w] = function(A) { - return new Promise(function(M, N) { - s.push([w, A, M, N]) > 1 || a(w, A); + return new Promise(function(P, N) { + s.push([w, A, P, N]) > 1 || a(w, A); }); }); } function a(w, A) { try { u(n[w](A)); - } catch (M) { - g(s[0][3], M); + } catch (P) { + p(s[0][3], P); } } function u(w) { - w.value instanceof vl ? Promise.resolve(w.value.v).then(l, d) : g(s[0][2], w); + w.value instanceof bl ? Promise.resolve(w.value.v).then(l, d) : p(s[0][2], w); } function l(w) { a("next", w); @@ -5063,11 +5063,11 @@ function dL(t, e, r) { function d(w) { a("throw", w); } - function g(w, A) { + function p(w, A) { w(A), s.shift(), s.length && a(s[0][0], s[0][1]); } } -function pL(t) { +function SL(t) { var e, r; return e = {}, n("next"), n("throw", function(i) { throw i; @@ -5076,11 +5076,11 @@ function pL(t) { }, e; function n(i, s) { e[i] = t[i] ? function(o) { - return (r = !r) ? { value: vl(t[i](o)), done: i === "return" } : s ? s(o) : o; + return (r = !r) ? { value: bl(t[i](o)), done: i === "return" } : s ? s(o) : o; } : s; } } -function gL(t) { +function AL(t) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var e = t[Symbol.asyncIterator], r; return e ? e.call(t) : (t = typeof f1 == "function" ? f1(t) : t[Symbol.iterator](), r = {}, n("next"), n("throw"), n("return"), r[Symbol.asyncIterator] = function() { @@ -5099,60 +5099,60 @@ function gL(t) { }, o); } } -function mL(t, e) { +function PL(t, e) { return Object.defineProperty ? Object.defineProperty(t, "raw", { value: e }) : t.raw = e, t; } -function vL(t) { +function ML(t) { if (t && t.__esModule) return t; var e = {}; if (t != null) for (var r in t) Object.hasOwnProperty.call(t, r) && (e[r] = t[r]); return e.default = t, e; } -function bL(t) { +function IL(t) { return t && t.__esModule ? t : { default: t }; } -function yL(t, e) { +function CL(t, e) { if (!e.has(t)) throw new TypeError("attempted to get private field on non-instance"); return e.get(t); } -function wL(t, e, r) { +function TL(t, e, r) { if (!e.has(t)) throw new TypeError("attempted to set private field on non-instance"); return e.set(t, r), r; } -const xL = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +const RL = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, get __assign() { return u1; }, - __asyncDelegator: pL, - __asyncGenerator: dL, - __asyncValues: gL, - __await: vl, - __awaiter: aL, - __classPrivateFieldGet: yL, - __classPrivateFieldSet: wL, - __createBinding: uL, - __decorate: iL, - __exportStar: fL, - __extends: rL, - __generator: cL, - __importDefault: bL, - __importStar: vL, - __makeTemplateObject: mL, - __metadata: oL, - __param: sL, - __read: v4, - __rest: nL, - __spread: lL, - __spreadArrays: hL, + __asyncDelegator: SL, + __asyncGenerator: EL, + __asyncValues: AL, + __await: bl, + __awaiter: vL, + __classPrivateFieldGet: CL, + __classPrivateFieldSet: TL, + __createBinding: yL, + __decorate: pL, + __exportStar: wL, + __extends: hL, + __generator: bL, + __importDefault: IL, + __importStar: ML, + __makeTemplateObject: PL, + __metadata: mL, + __param: gL, + __read: y4, + __rest: dL, + __spread: xL, + __spreadArrays: _L, __values: f1 -}, Symbol.toStringTag, { value: "Module" })), Bl = /* @__PURE__ */ bv(xL); -var Hg = {}, yf = {}, L2; -function _L() { - if (L2) return yf; - L2 = 1, Object.defineProperty(yf, "__esModule", { value: !0 }), yf.delay = void 0; +}, Symbol.toStringTag, { value: "Module" })), jl = /* @__PURE__ */ bv(RL); +var Wg = {}, wf = {}, $2; +function DL() { + if ($2) return wf; + $2 = 1, Object.defineProperty(wf, "__esModule", { value: !0 }), wf.delay = void 0; function t(e) { return new Promise((r) => { setTimeout(() => { @@ -5160,52 +5160,52 @@ function _L() { }, e); }); } - return yf.delay = t, yf; + return wf.delay = t, wf; } -var ja = {}, Wg = {}, qa = {}, k2; -function EL() { - return k2 || (k2 = 1, Object.defineProperty(qa, "__esModule", { value: !0 }), qa.ONE_THOUSAND = qa.ONE_HUNDRED = void 0, qa.ONE_HUNDRED = 100, qa.ONE_THOUSAND = 1e3), qa; +var Wa = {}, Hg = {}, Ha = {}, B2; +function OL() { + return B2 || (B2 = 1, Object.defineProperty(Ha, "__esModule", { value: !0 }), Ha.ONE_THOUSAND = Ha.ONE_HUNDRED = void 0, Ha.ONE_HUNDRED = 100, Ha.ONE_THOUSAND = 1e3), Ha; } -var Kg = {}, $2; -function SL() { - return $2 || ($2 = 1, function(t) { +var Kg = {}, F2; +function NL() { + return F2 || (F2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.ONE_YEAR = t.FOUR_WEEKS = t.THREE_WEEKS = t.TWO_WEEKS = t.ONE_WEEK = t.THIRTY_DAYS = t.SEVEN_DAYS = t.FIVE_DAYS = t.THREE_DAYS = t.ONE_DAY = t.TWENTY_FOUR_HOURS = t.TWELVE_HOURS = t.SIX_HOURS = t.THREE_HOURS = t.ONE_HOUR = t.SIXTY_MINUTES = t.THIRTY_MINUTES = t.TEN_MINUTES = t.FIVE_MINUTES = t.ONE_MINUTE = t.SIXTY_SECONDS = t.THIRTY_SECONDS = t.TEN_SECONDS = t.FIVE_SECONDS = t.ONE_SECOND = void 0, t.ONE_SECOND = 1, t.FIVE_SECONDS = 5, t.TEN_SECONDS = 10, t.THIRTY_SECONDS = 30, t.SIXTY_SECONDS = 60, t.ONE_MINUTE = t.SIXTY_SECONDS, t.FIVE_MINUTES = t.ONE_MINUTE * 5, t.TEN_MINUTES = t.ONE_MINUTE * 10, t.THIRTY_MINUTES = t.ONE_MINUTE * 30, t.SIXTY_MINUTES = t.ONE_MINUTE * 60, t.ONE_HOUR = t.SIXTY_MINUTES, t.THREE_HOURS = t.ONE_HOUR * 3, t.SIX_HOURS = t.ONE_HOUR * 6, t.TWELVE_HOURS = t.ONE_HOUR * 12, t.TWENTY_FOUR_HOURS = t.ONE_HOUR * 24, t.ONE_DAY = t.TWENTY_FOUR_HOURS, t.THREE_DAYS = t.ONE_DAY * 3, t.FIVE_DAYS = t.ONE_DAY * 5, t.SEVEN_DAYS = t.ONE_DAY * 7, t.THIRTY_DAYS = t.ONE_DAY * 30, t.ONE_WEEK = t.SEVEN_DAYS, t.TWO_WEEKS = t.ONE_WEEK * 2, t.THREE_WEEKS = t.ONE_WEEK * 3, t.FOUR_WEEKS = t.ONE_WEEK * 4, t.ONE_YEAR = t.ONE_DAY * 365; }(Kg)), Kg; } -var F2; -function b4() { - return F2 || (F2 = 1, function(t) { +var j2; +function w4() { + return j2 || (j2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - const e = Bl; - e.__exportStar(EL(), t), e.__exportStar(SL(), t); - }(Wg)), Wg; + const e = jl; + e.__exportStar(OL(), t), e.__exportStar(NL(), t); + }(Hg)), Hg; } -var B2; -function AL() { - if (B2) return ja; - B2 = 1, Object.defineProperty(ja, "__esModule", { value: !0 }), ja.fromMiliseconds = ja.toMiliseconds = void 0; - const t = b4(); +var U2; +function LL() { + if (U2) return Wa; + U2 = 1, Object.defineProperty(Wa, "__esModule", { value: !0 }), Wa.fromMiliseconds = Wa.toMiliseconds = void 0; + const t = w4(); function e(n) { return n * t.ONE_THOUSAND; } - ja.toMiliseconds = e; + Wa.toMiliseconds = e; function r(n) { return Math.floor(n / t.ONE_THOUSAND); } - return ja.fromMiliseconds = r, ja; + return Wa.fromMiliseconds = r, Wa; } -var U2; -function PL() { - return U2 || (U2 = 1, function(t) { +var q2; +function kL() { + return q2 || (q2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - const e = Bl; - e.__exportStar(_L(), t), e.__exportStar(AL(), t); - }(Hg)), Hg; + const e = jl; + e.__exportStar(DL(), t), e.__exportStar(LL(), t); + }(Wg)), Wg; } -var qc = {}, j2; -function ML() { - if (j2) return qc; - j2 = 1, Object.defineProperty(qc, "__esModule", { value: !0 }), qc.Watch = void 0; +var zc = {}, z2; +function $L() { + if (z2) return zc; + z2 = 1, Object.defineProperty(zc, "__esModule", { value: !0 }), zc.Watch = void 0; class t { constructor() { this.timestamps = /* @__PURE__ */ new Map(); @@ -5233,41 +5233,41 @@ function ML() { return n.elapsed || Date.now() - n.started; } } - return qc.Watch = t, qc.default = t, qc; + return zc.Watch = t, zc.default = t, zc; } -var Vg = {}, wf = {}, q2; -function IL() { - if (q2) return wf; - q2 = 1, Object.defineProperty(wf, "__esModule", { value: !0 }), wf.IWatch = void 0; +var Vg = {}, xf = {}, W2; +function BL() { + if (W2) return xf; + W2 = 1, Object.defineProperty(xf, "__esModule", { value: !0 }), xf.IWatch = void 0; class t { } - return wf.IWatch = t, wf; + return xf.IWatch = t, xf; } -var z2; -function CL() { - return z2 || (z2 = 1, function(t) { - Object.defineProperty(t, "__esModule", { value: !0 }), Bl.__exportStar(IL(), t); +var H2; +function FL() { + return H2 || (H2 = 1, function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }), jl.__exportStar(BL(), t); }(Vg)), Vg; } (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - const e = Bl; - e.__exportStar(PL(), t), e.__exportStar(ML(), t), e.__exportStar(CL(), t), e.__exportStar(b4(), t); + const e = jl; + e.__exportStar(kL(), t), e.__exportStar($L(), t), e.__exportStar(FL(), t), e.__exportStar(w4(), t); })(mt); -class mc { +class vc { } -let TL = class extends mc { +let jL = class extends vc { constructor(e) { super(); } }; -const H2 = mt.FIVE_SECONDS, Du = { pulse: "heartbeat_pulse" }; -let RL = class y4 extends TL { +const K2 = mt.FIVE_SECONDS, Ou = { pulse: "heartbeat_pulse" }; +let UL = class x4 extends jL { constructor(e) { - super(e), this.events = new rs.EventEmitter(), this.interval = H2, this.interval = (e == null ? void 0 : e.interval) || H2; + super(e), this.events = new ns.EventEmitter(), this.interval = K2, this.interval = (e == null ? void 0 : e.interval) || K2; } static async init(e) { - const r = new y4(e); + const r = new x4(e); return await r.init(), r; } async init() { @@ -5292,21 +5292,21 @@ let RL = class y4 extends TL { this.intervalRef = setInterval(() => this.pulse(), mt.toMiliseconds(this.interval)); } pulse() { - this.events.emit(Du.pulse); + this.events.emit(Ou.pulse); } }; -const DL = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/, OL = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/, NL = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/; -function LL(t, e) { +const qL = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/, zL = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/, WL = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/; +function HL(t, e) { if (t === "__proto__" || t === "constructor" && e && typeof e == "object" && "prototype" in e) { - kL(t); + KL(t); return; } return e; } -function kL(t) { +function KL(t) { console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`); } -function sd(t, e = {}) { +function od(t, e = {}) { if (typeof t != "string") return t; const r = t.trim(); @@ -5332,16 +5332,16 @@ function sd(t, e = {}) { if (n === "-infinity") return Number.NEGATIVE_INFINITY; } - if (!NL.test(t)) { + if (!WL.test(t)) { if (e.strict) throw new SyntaxError("[destr] Invalid JSON"); return t; } try { - if (DL.test(t) || OL.test(t)) { + if (qL.test(t) || zL.test(t)) { if (e.strict) throw new Error("[destr] Possible prototype pollution"); - return JSON.parse(t, LL); + return JSON.parse(t, HL); } return JSON.parse(t); } catch (n) { @@ -5350,61 +5350,61 @@ function sd(t, e = {}) { return t; } } -function $L(t) { +function VL(t) { return !t || typeof t.then != "function" ? Promise.resolve(t) : t; } function Cn(t, ...e) { try { - return $L(t(...e)); + return VL(t(...e)); } catch (r) { return Promise.reject(r); } } -function FL(t) { +function GL(t) { const e = typeof t; return t === null || e !== "object" && e !== "function"; } -function BL(t) { +function YL(t) { const e = Object.getPrototypeOf(t); return !e || e.isPrototypeOf(Object); } -function xd(t) { - if (FL(t)) +function _d(t) { + if (GL(t)) return String(t); - if (BL(t) || Array.isArray(t)) + if (YL(t) || Array.isArray(t)) return JSON.stringify(t); if (typeof t.toJSON == "function") - return xd(t.toJSON()); + return _d(t.toJSON()); throw new Error("[unstorage] Cannot stringify value!"); } -function w4() { +function _4() { if (typeof Buffer > "u") throw new TypeError("[unstorage] Buffer is not supported!"); } const l1 = "base64:"; -function UL(t) { +function JL(t) { if (typeof t == "string") return t; - w4(); + _4(); const e = Buffer.from(t).toString("base64"); return l1 + e; } -function jL(t) { - return typeof t != "string" || !t.startsWith(l1) ? t : (w4(), Buffer.from(t.slice(l1.length), "base64")); +function XL(t) { + return typeof t != "string" || !t.startsWith(l1) ? t : (_4(), Buffer.from(t.slice(l1.length), "base64")); } -function di(t) { +function pi(t) { return t ? t.split("?")[0].replace(/[/\\]/g, ":").replace(/:+/g, ":").replace(/^:|:$/g, "") : ""; } -function qL(...t) { - return di(t.join(":")); +function ZL(...t) { + return pi(t.join(":")); } -function od(t) { - return t = di(t), t ? t + ":" : ""; +function ad(t) { + return t = pi(t), t ? t + ":" : ""; } -const zL = "memory", HL = () => { +const QL = "memory", ek = () => { const t = /* @__PURE__ */ new Map(); return { - name: zL, + name: QL, getInstance: () => t, hasItem(e) { return t.has(e); @@ -5435,9 +5435,9 @@ const zL = "memory", HL = () => { } }; }; -function WL(t = {}) { +function tk(t = {}) { const e = { - mounts: { "": t.driver || HL() }, + mounts: { "": t.driver || ek() }, mountpoints: [""], watching: !1, watchListeners: [], @@ -5456,22 +5456,22 @@ function WL(t = {}) { driver: e.mounts[""] }; }, n = (l, d) => e.mountpoints.filter( - (g) => g.startsWith(l) || d && l.startsWith(g) - ).map((g) => ({ - relativeBase: l.length > g.length ? l.slice(g.length) : void 0, - mountpoint: g, - driver: e.mounts[g] + (p) => p.startsWith(l) || d && l.startsWith(p) + ).map((p) => ({ + relativeBase: l.length > p.length ? l.slice(p.length) : void 0, + mountpoint: p, + driver: e.mounts[p] })), i = (l, d) => { if (e.watching) { - d = di(d); - for (const g of e.watchListeners) - g(l, d); + d = pi(d); + for (const p of e.watchListeners) + p(l, d); } }, s = async () => { if (!e.watching) { e.watching = !0; for (const l in e.mounts) - e.unwatch[l] = await W2( + e.unwatch[l] = await V2( e.mounts[l], i, l @@ -5483,174 +5483,174 @@ function WL(t = {}) { await e.unwatch[l](); e.unwatch = {}, e.watching = !1; } - }, a = (l, d, g) => { - const w = /* @__PURE__ */ new Map(), A = (M) => { - let N = w.get(M.base); + }, a = (l, d, p) => { + const w = /* @__PURE__ */ new Map(), A = (P) => { + let N = w.get(P.base); return N || (N = { - driver: M.driver, - base: M.base, + driver: P.driver, + base: P.base, items: [] - }, w.set(M.base, N)), N; + }, w.set(P.base, N)), N; }; - for (const M of l) { - const N = typeof M == "string", L = di(N ? M : M.key), $ = N ? void 0 : M.value, F = N || !M.options ? d : { ...d, ...M.options }, K = r(L); - A(K).items.push({ + for (const P of l) { + const N = typeof P == "string", L = pi(N ? P : P.key), $ = N ? void 0 : P.value, B = N || !P.options ? d : { ...d, ...P.options }, H = r(L); + A(H).items.push({ key: L, value: $, - relativeKey: K.relativeKey, - options: F + relativeKey: H.relativeKey, + options: B }); } - return Promise.all([...w.values()].map((M) => g(M))).then( - (M) => M.flat() + return Promise.all([...w.values()].map((P) => p(P))).then( + (P) => P.flat() ); }, u = { // Item hasItem(l, d = {}) { - l = di(l); - const { relativeKey: g, driver: w } = r(l); - return Cn(w.hasItem, g, d); + l = pi(l); + const { relativeKey: p, driver: w } = r(l); + return Cn(w.hasItem, p, d); }, getItem(l, d = {}) { - l = di(l); - const { relativeKey: g, driver: w } = r(l); - return Cn(w.getItem, g, d).then( - (A) => sd(A) + l = pi(l); + const { relativeKey: p, driver: w } = r(l); + return Cn(w.getItem, p, d).then( + (A) => od(A) ); }, getItems(l, d) { - return a(l, d, (g) => g.driver.getItems ? Cn( - g.driver.getItems, - g.items.map((w) => ({ + return a(l, d, (p) => p.driver.getItems ? Cn( + p.driver.getItems, + p.items.map((w) => ({ key: w.relativeKey, options: w.options })), d ).then( (w) => w.map((A) => ({ - key: qL(g.base, A.key), - value: sd(A.value) + key: ZL(p.base, A.key), + value: od(A.value) })) ) : Promise.all( - g.items.map((w) => Cn( - g.driver.getItem, + p.items.map((w) => Cn( + p.driver.getItem, w.relativeKey, w.options ).then((A) => ({ key: w.key, - value: sd(A) + value: od(A) }))) )); }, getItemRaw(l, d = {}) { - l = di(l); - const { relativeKey: g, driver: w } = r(l); - return w.getItemRaw ? Cn(w.getItemRaw, g, d) : Cn(w.getItem, g, d).then( - (A) => jL(A) + l = pi(l); + const { relativeKey: p, driver: w } = r(l); + return w.getItemRaw ? Cn(w.getItemRaw, p, d) : Cn(w.getItem, p, d).then( + (A) => XL(A) ); }, - async setItem(l, d, g = {}) { + async setItem(l, d, p = {}) { if (d === void 0) return u.removeItem(l); - l = di(l); + l = pi(l); const { relativeKey: w, driver: A } = r(l); - A.setItem && (await Cn(A.setItem, w, xd(d), g), A.watch || i("update", l)); + A.setItem && (await Cn(A.setItem, w, _d(d), p), A.watch || i("update", l)); }, async setItems(l, d) { - await a(l, d, async (g) => { - if (g.driver.setItems) + await a(l, d, async (p) => { + if (p.driver.setItems) return Cn( - g.driver.setItems, - g.items.map((w) => ({ + p.driver.setItems, + p.items.map((w) => ({ key: w.relativeKey, - value: xd(w.value), + value: _d(w.value), options: w.options })), d ); - g.driver.setItem && await Promise.all( - g.items.map((w) => Cn( - g.driver.setItem, + p.driver.setItem && await Promise.all( + p.items.map((w) => Cn( + p.driver.setItem, w.relativeKey, - xd(w.value), + _d(w.value), w.options )) ); }); }, - async setItemRaw(l, d, g = {}) { + async setItemRaw(l, d, p = {}) { if (d === void 0) - return u.removeItem(l, g); - l = di(l); + return u.removeItem(l, p); + l = pi(l); const { relativeKey: w, driver: A } = r(l); if (A.setItemRaw) - await Cn(A.setItemRaw, w, d, g); + await Cn(A.setItemRaw, w, d, p); else if (A.setItem) - await Cn(A.setItem, w, UL(d), g); + await Cn(A.setItem, w, JL(d), p); else return; A.watch || i("update", l); }, async removeItem(l, d = {}) { - typeof d == "boolean" && (d = { removeMeta: d }), l = di(l); - const { relativeKey: g, driver: w } = r(l); - w.removeItem && (await Cn(w.removeItem, g, d), (d.removeMeta || d.removeMata) && await Cn(w.removeItem, g + "$", d), w.watch || i("remove", l)); + typeof d == "boolean" && (d = { removeMeta: d }), l = pi(l); + const { relativeKey: p, driver: w } = r(l); + w.removeItem && (await Cn(w.removeItem, p, d), (d.removeMeta || d.removeMata) && await Cn(w.removeItem, p + "$", d), w.watch || i("remove", l)); }, // Meta async getMeta(l, d = {}) { - typeof d == "boolean" && (d = { nativeOnly: d }), l = di(l); - const { relativeKey: g, driver: w } = r(l), A = /* @__PURE__ */ Object.create(null); - if (w.getMeta && Object.assign(A, await Cn(w.getMeta, g, d)), !d.nativeOnly) { - const M = await Cn( + typeof d == "boolean" && (d = { nativeOnly: d }), l = pi(l); + const { relativeKey: p, driver: w } = r(l), A = /* @__PURE__ */ Object.create(null); + if (w.getMeta && Object.assign(A, await Cn(w.getMeta, p, d)), !d.nativeOnly) { + const P = await Cn( w.getItem, - g + "$", + p + "$", d - ).then((N) => sd(N)); - M && typeof M == "object" && (typeof M.atime == "string" && (M.atime = new Date(M.atime)), typeof M.mtime == "string" && (M.mtime = new Date(M.mtime)), Object.assign(A, M)); + ).then((N) => od(N)); + P && typeof P == "object" && (typeof P.atime == "string" && (P.atime = new Date(P.atime)), typeof P.mtime == "string" && (P.mtime = new Date(P.mtime)), Object.assign(A, P)); } return A; }, - setMeta(l, d, g = {}) { - return this.setItem(l + "$", d, g); + setMeta(l, d, p = {}) { + return this.setItem(l + "$", d, p); }, removeMeta(l, d = {}) { return this.removeItem(l + "$", d); }, // Keys async getKeys(l, d = {}) { - l = od(l); - const g = n(l, !0); + l = ad(l); + const p = n(l, !0); let w = []; const A = []; - for (const M of g) { + for (const P of p) { const N = await Cn( - M.driver.getKeys, - M.relativeBase, + P.driver.getKeys, + P.relativeBase, d ); for (const L of N) { - const $ = M.mountpoint + di(L); - w.some((F) => $.startsWith(F)) || A.push($); + const $ = P.mountpoint + pi(L); + w.some((B) => $.startsWith(B)) || A.push($); } w = [ - M.mountpoint, - ...w.filter((L) => !L.startsWith(M.mountpoint)) + P.mountpoint, + ...w.filter((L) => !L.startsWith(P.mountpoint)) ]; } return l ? A.filter( - (M) => M.startsWith(l) && M[M.length - 1] !== "$" - ) : A.filter((M) => M[M.length - 1] !== "$"); + (P) => P.startsWith(l) && P[P.length - 1] !== "$" + ) : A.filter((P) => P[P.length - 1] !== "$"); }, // Utils async clear(l, d = {}) { - l = od(l), await Promise.all( - n(l, !1).map(async (g) => { - if (g.driver.clear) - return Cn(g.driver.clear, g.relativeBase, d); - if (g.driver.removeItem) { - const w = await g.driver.getKeys(g.relativeBase || "", d); + l = ad(l), await Promise.all( + n(l, !1).map(async (p) => { + if (p.driver.clear) + return Cn(p.driver.clear, p.relativeBase, d); + if (p.driver.removeItem) { + const w = await p.driver.getKeys(p.relativeBase || "", d); return Promise.all( - w.map((A) => g.driver.removeItem(A, d)) + w.map((A) => p.driver.removeItem(A, d)) ); } }) @@ -5658,7 +5658,7 @@ function WL(t = {}) { }, async dispose() { await Promise.all( - Object.values(e.mounts).map((l) => K2(l)) + Object.values(e.mounts).map((l) => G2(l)) ); }, async watch(l) { @@ -5673,17 +5673,17 @@ function WL(t = {}) { }, // Mount mount(l, d) { - if (l = od(l), l && e.mounts[l]) + if (l = ad(l), l && e.mounts[l]) throw new Error(`already mounted at ${l}`); - return l && (e.mountpoints.push(l), e.mountpoints.sort((g, w) => w.length - g.length)), e.mounts[l] = d, e.watching && Promise.resolve(W2(d, i, l)).then((g) => { - e.unwatch[l] = g; + return l && (e.mountpoints.push(l), e.mountpoints.sort((p, w) => w.length - p.length)), e.mounts[l] = d, e.watching && Promise.resolve(V2(d, i, l)).then((p) => { + e.unwatch[l] = p; }).catch(console.error), u; }, async unmount(l, d = !0) { - l = od(l), !(!l || !e.mounts[l]) && (e.watching && l in e.unwatch && (e.unwatch[l](), delete e.unwatch[l]), d && await K2(e.mounts[l]), e.mountpoints = e.mountpoints.filter((g) => g !== l), delete e.mounts[l]); + l = ad(l), !(!l || !e.mounts[l]) && (e.watching && l in e.unwatch && (e.unwatch[l](), delete e.unwatch[l]), d && await G2(e.mounts[l]), e.mountpoints = e.mountpoints.filter((p) => p !== l), delete e.mounts[l]); }, getMount(l = "") { - l = di(l) + ":"; + l = pi(l) + ":"; const d = r(l); return { driver: d.driver, @@ -5691,7 +5691,7 @@ function WL(t = {}) { }; }, getMounts(l = "", d = {}) { - return l = di(l), n(l, d.parents).map((w) => ({ + return l = pi(l), n(l, d.parents).map((w) => ({ driver: w.driver, base: w.mountpoint })); @@ -5699,98 +5699,98 @@ function WL(t = {}) { // Aliases keys: (l, d = {}) => u.getKeys(l, d), get: (l, d = {}) => u.getItem(l, d), - set: (l, d, g = {}) => u.setItem(l, d, g), + set: (l, d, p = {}) => u.setItem(l, d, p), has: (l, d = {}) => u.hasItem(l, d), del: (l, d = {}) => u.removeItem(l, d), remove: (l, d = {}) => u.removeItem(l, d) }; return u; } -function W2(t, e, r) { +function V2(t, e, r) { return t.watch ? t.watch((n, i) => e(n, r + i)) : () => { }; } -async function K2(t) { +async function G2(t) { typeof t.dispose == "function" && await Cn(t.dispose); } -function vc(t) { +function bc(t) { return new Promise((e, r) => { t.oncomplete = t.onsuccess = () => e(t.result), t.onabort = t.onerror = () => r(t.error); }); } -function x4(t, e) { +function E4(t, e) { const r = indexedDB.open(t); r.onupgradeneeded = () => r.result.createObjectStore(e); - const n = vc(r); + const n = bc(r); return (i, s) => n.then((o) => s(o.transaction(e, i).objectStore(e))); } let Gg; function Ul() { - return Gg || (Gg = x4("keyval-store", "keyval")), Gg; + return Gg || (Gg = E4("keyval-store", "keyval")), Gg; } -function V2(t, e = Ul()) { - return e("readonly", (r) => vc(r.get(t))); +function Y2(t, e = Ul()) { + return e("readonly", (r) => bc(r.get(t))); } -function KL(t, e, r = Ul()) { - return r("readwrite", (n) => (n.put(e, t), vc(n.transaction))); +function rk(t, e, r = Ul()) { + return r("readwrite", (n) => (n.put(e, t), bc(n.transaction))); } -function VL(t, e = Ul()) { - return e("readwrite", (r) => (r.delete(t), vc(r.transaction))); +function nk(t, e = Ul()) { + return e("readwrite", (r) => (r.delete(t), bc(r.transaction))); } -function GL(t = Ul()) { - return t("readwrite", (e) => (e.clear(), vc(e.transaction))); +function ik(t = Ul()) { + return t("readwrite", (e) => (e.clear(), bc(e.transaction))); } -function YL(t, e) { +function sk(t, e) { return t.openCursor().onsuccess = function() { this.result && (e(this.result), this.result.continue()); - }, vc(t.transaction); + }, bc(t.transaction); } -function JL(t = Ul()) { +function ok(t = Ul()) { return t("readonly", (e) => { if (e.getAllKeys) - return vc(e.getAllKeys()); + return bc(e.getAllKeys()); const r = []; - return YL(e, (n) => r.push(n.key)).then(() => r); + return sk(e, (n) => r.push(n.key)).then(() => r); }); } -const XL = (t) => JSON.stringify(t, (e, r) => typeof r == "bigint" ? r.toString() + "n" : r), ZL = (t) => { +const ak = (t) => JSON.stringify(t, (e, r) => typeof r == "bigint" ? r.toString() + "n" : r), ck = (t) => { const e = /([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g, r = t.replace(e, '$1"$2n"$3'); return JSON.parse(r, (n, i) => typeof i == "string" && i.match(/^\d+n$/) ? BigInt(i.substring(0, i.length - 1)) : i); }; -function uc(t) { +function lc(t) { if (typeof t != "string") throw new Error(`Cannot safe json parse value of type ${typeof t}`); try { - return ZL(t); + return ck(t); } catch { return t; } } -function ko(t) { - return typeof t == "string" ? t : XL(t) || ""; +function Bo(t) { + return typeof t == "string" ? t : ak(t) || ""; } -const QL = "idb-keyval"; -var ek = (t = {}) => { +const uk = "idb-keyval"; +var fk = (t = {}) => { const e = t.base && t.base.length > 0 ? `${t.base}:` : "", r = (i) => e + i; let n; - return t.dbName && t.storeName && (n = x4(t.dbName, t.storeName)), { name: QL, options: t, async hasItem(i) { - return !(typeof await V2(r(i), n) > "u"); + return t.dbName && t.storeName && (n = E4(t.dbName, t.storeName)), { name: uk, options: t, async hasItem(i) { + return !(typeof await Y2(r(i), n) > "u"); }, async getItem(i) { - return await V2(r(i), n) ?? null; + return await Y2(r(i), n) ?? null; }, setItem(i, s) { - return KL(r(i), s, n); + return rk(r(i), s, n); }, removeItem(i) { - return VL(r(i), n); + return nk(r(i), n); }, getKeys() { - return JL(n); + return ok(n); }, clear() { - return GL(n); + return ik(n); } }; }; -const tk = "WALLET_CONNECT_V2_INDEXED_DB", rk = "keyvaluestorage"; -let nk = class { +const lk = "WALLET_CONNECT_V2_INDEXED_DB", hk = "keyvaluestorage"; +let dk = class { constructor() { - this.indexedDb = WL({ driver: ek({ dbName: tk, storeName: rk }) }); + this.indexedDb = tk({ driver: fk({ dbName: lk, storeName: hk }) }); } async getKeys() { return this.indexedDb.getKeys(); @@ -5803,13 +5803,13 @@ let nk = class { if (r !== null) return r; } async setItem(e, r) { - await this.indexedDb.setItem(e, ko(r)); + await this.indexedDb.setItem(e, Bo(r)); } async removeItem(e) { await this.indexedDb.removeItem(e); } }; -var Yg = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, _d = { exports: {} }; +var Yg = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Ed = { exports: {} }; (function() { let t; function e() { @@ -5829,36 +5829,36 @@ var Yg = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t return r = r || 0, Object.keys(this)[r]; }, t.prototype.__defineGetter__("length", function() { return Object.keys(this).length; - }), typeof Yg < "u" && Yg.localStorage ? _d.exports = Yg.localStorage : typeof window < "u" && window.localStorage ? _d.exports = window.localStorage : _d.exports = new e(); + }), typeof Yg < "u" && Yg.localStorage ? Ed.exports = Yg.localStorage : typeof window < "u" && window.localStorage ? Ed.exports = window.localStorage : Ed.exports = new e(); })(); -function ik(t) { +function pk(t) { var e; - return [t[0], uc((e = t[1]) != null ? e : "")]; + return [t[0], lc((e = t[1]) != null ? e : "")]; } -let sk = class { +let gk = class { constructor() { - this.localStorage = _d.exports; + this.localStorage = Ed.exports; } async getKeys() { return Object.keys(this.localStorage); } async getEntries() { - return Object.entries(this.localStorage).map(ik); + return Object.entries(this.localStorage).map(pk); } async getItem(e) { const r = this.localStorage.getItem(e); - if (r !== null) return uc(r); + if (r !== null) return lc(r); } async setItem(e, r) { - this.localStorage.setItem(e, ko(r)); + this.localStorage.setItem(e, Bo(r)); } async removeItem(e) { this.localStorage.removeItem(e); } }; -const ok = "wc_storage_version", G2 = 1, ak = async (t, e, r) => { - const n = ok, i = await e.getItem(n); - if (i && i >= G2) { +const mk = "wc_storage_version", J2 = 1, vk = async (t, e, r) => { + const n = mk, i = await e.getItem(n); + if (i && i >= J2) { r(e); return; } @@ -5877,22 +5877,22 @@ const ok = "wc_storage_version", G2 = 1, ak = async (t, e, r) => { await e.setItem(a, l), o.push(a); } } - await e.setItem(n, G2), r(e), ck(t, o); -}, ck = async (t, e) => { + await e.setItem(n, J2), r(e), bk(t, o); +}, bk = async (t, e) => { e.length && e.forEach(async (r) => { await t.removeItem(r); }); }; -let uk = class { +let yk = class { constructor() { this.initialized = !1, this.setInitialized = (r) => { this.storage = r, this.initialized = !0; }; - const e = new sk(); + const e = new gk(); this.storage = e; try { - const r = new nk(); - ak(e, r, this.setInitialized); + const r = new dk(); + vk(e, r, this.setInitialized); } catch { this.initialized = !0; } @@ -5920,16 +5920,16 @@ let uk = class { }); } }; -function fk(t) { +function wk(t) { try { return JSON.stringify(t); } catch { return '"[Circular]"'; } } -var lk = hk; -function hk(t, e, r) { - var n = r && r.stringify || fk, i = 1; +var xk = _k; +function _k(t, e, r) { + var n = r && r.stringify || wk, i = 1; if (typeof t == "object" && t !== null) { var s = e.length + i; if (s === 1) return t; @@ -5943,83 +5943,83 @@ function hk(t, e, r) { return t; var u = e.length; if (u === 0) return t; - for (var l = "", d = 1 - i, g = -1, w = t && t.length || 0, A = 0; A < w; ) { + for (var l = "", d = 1 - i, p = -1, w = t && t.length || 0, A = 0; A < w; ) { if (t.charCodeAt(A) === 37 && A + 1 < w) { - switch (g = g > -1 ? g : 0, t.charCodeAt(A + 1)) { + switch (p = p > -1 ? p : 0, t.charCodeAt(A + 1)) { case 100: case 102: if (d >= u || e[d] == null) break; - g < A && (l += t.slice(g, A)), l += Number(e[d]), g = A + 2, A++; + p < A && (l += t.slice(p, A)), l += Number(e[d]), p = A + 2, A++; break; case 105: if (d >= u || e[d] == null) break; - g < A && (l += t.slice(g, A)), l += Math.floor(Number(e[d])), g = A + 2, A++; + p < A && (l += t.slice(p, A)), l += Math.floor(Number(e[d])), p = A + 2, A++; break; case 79: case 111: case 106: if (d >= u || e[d] === void 0) break; - g < A && (l += t.slice(g, A)); - var M = typeof e[d]; - if (M === "string") { - l += "'" + e[d] + "'", g = A + 2, A++; + p < A && (l += t.slice(p, A)); + var P = typeof e[d]; + if (P === "string") { + l += "'" + e[d] + "'", p = A + 2, A++; break; } - if (M === "function") { - l += e[d].name || "", g = A + 2, A++; + if (P === "function") { + l += e[d].name || "", p = A + 2, A++; break; } - l += n(e[d]), g = A + 2, A++; + l += n(e[d]), p = A + 2, A++; break; case 115: if (d >= u) break; - g < A && (l += t.slice(g, A)), l += String(e[d]), g = A + 2, A++; + p < A && (l += t.slice(p, A)), l += String(e[d]), p = A + 2, A++; break; case 37: - g < A && (l += t.slice(g, A)), l += "%", g = A + 2, A++, d--; + p < A && (l += t.slice(p, A)), l += "%", p = A + 2, A++, d--; break; } ++d; } ++A; } - return g === -1 ? t : (g < w && (l += t.slice(g)), l); + return p === -1 ? t : (p < w && (l += t.slice(p)), l); } -const Y2 = lk; -var Yc = $o; -const bl = _k().console || {}, dk = { - mapHttpRequest: ad, - mapHttpResponse: ad, +const X2 = xk; +var Jc = Fo; +const yl = Dk().console || {}, Ek = { + mapHttpRequest: cd, + mapHttpResponse: cd, wrapRequestSerializer: Jg, wrapResponseSerializer: Jg, wrapErrorSerializer: Jg, - req: ad, - res: ad, - err: bk + req: cd, + res: cd, + err: Ik }; -function pk(t, e) { +function Sk(t, e) { return Array.isArray(t) ? t.filter(function(n) { return n !== "!stdSerializers.err"; }) : t === !0 ? Object.keys(e) : !1; } -function $o(t) { +function Fo(t) { t = t || {}, t.browser = t.browser || {}; const e = t.browser.transmit; if (e && typeof e.send != "function") throw Error("pino: transmit option must have a send function"); - const r = t.browser.write || bl; + const r = t.browser.write || yl; t.browser.write && (t.browser.asObject = !0); - const n = t.serializers || {}, i = pk(t.browser.serialize, n); + const n = t.serializers || {}, i = Sk(t.browser.serialize, n); let s = t.browser.serialize; Array.isArray(t.browser.serialize) && t.browser.serialize.indexOf("!stdSerializers.err") > -1 && (s = !1); const o = ["error", "fatal", "warn", "info", "debug", "trace"]; typeof r == "function" && (r.error = r.fatal = r.warn = r.info = r.debug = r.trace = r), t.enabled === !1 && (t.level = "silent"); const a = t.level || "info", u = Object.create(r); - u.log || (u.log = yl), Object.defineProperty(u, "levelVal", { + u.log || (u.log = wl), Object.defineProperty(u, "levelVal", { get: d }), Object.defineProperty(u, "level", { - get: g, + get: p, set: w }); const l = { @@ -6027,39 +6027,39 @@ function $o(t) { serialize: i, asObject: t.browser.asObject, levels: o, - timestamp: yk(t) + timestamp: Ck(t) }; - u.levels = $o.levels, u.level = a, u.setMaxListeners = u.getMaxListeners = u.emit = u.addListener = u.on = u.prependListener = u.once = u.prependOnceListener = u.removeListener = u.removeAllListeners = u.listeners = u.listenerCount = u.eventNames = u.write = u.flush = yl, u.serializers = n, u._serialize = i, u._stdErrSerialize = s, u.child = A, e && (u._logEvent = h1()); + u.levels = Fo.levels, u.level = a, u.setMaxListeners = u.getMaxListeners = u.emit = u.addListener = u.on = u.prependListener = u.once = u.prependOnceListener = u.removeListener = u.removeAllListeners = u.listeners = u.listenerCount = u.eventNames = u.write = u.flush = wl, u.serializers = n, u._serialize = i, u._stdErrSerialize = s, u.child = A, e && (u._logEvent = h1()); function d() { return this.level === "silent" ? 1 / 0 : this.levels.values[this.level]; } - function g() { + function p() { return this._level; } - function w(M) { - if (M !== "silent" && !this.levels.values[M]) - throw Error("unknown level " + M); - this._level = M, zc(l, u, "error", "log"), zc(l, u, "fatal", "error"), zc(l, u, "warn", "error"), zc(l, u, "info", "log"), zc(l, u, "debug", "log"), zc(l, u, "trace", "log"); + function w(P) { + if (P !== "silent" && !this.levels.values[P]) + throw Error("unknown level " + P); + this._level = P, Wc(l, u, "error", "log"), Wc(l, u, "fatal", "error"), Wc(l, u, "warn", "error"), Wc(l, u, "info", "log"), Wc(l, u, "debug", "log"), Wc(l, u, "trace", "log"); } - function A(M, N) { - if (!M) + function A(P, N) { + if (!P) throw new Error("missing bindings for child Pino"); - N = N || {}, i && M.serializers && (N.serializers = M.serializers); + N = N || {}, i && P.serializers && (N.serializers = P.serializers); const L = N.serializers; if (i && L) { - var $ = Object.assign({}, n, L), F = t.browser.serialize === !0 ? Object.keys($) : i; - delete M.serializers, L0([M], F, $, this._stdErrSerialize); + var $ = Object.assign({}, n, L), B = t.browser.serialize === !0 ? Object.keys($) : i; + delete P.serializers, k0([P], B, $, this._stdErrSerialize); } - function K(H) { - this._childLevel = (H._childLevel | 0) + 1, this.error = Hc(H, M, "error"), this.fatal = Hc(H, M, "fatal"), this.warn = Hc(H, M, "warn"), this.info = Hc(H, M, "info"), this.debug = Hc(H, M, "debug"), this.trace = Hc(H, M, "trace"), $ && (this.serializers = $, this._serialize = F), e && (this._logEvent = h1( - [].concat(H._logEvent.bindings, M) + function H(W) { + this._childLevel = (W._childLevel | 0) + 1, this.error = Hc(W, P, "error"), this.fatal = Hc(W, P, "fatal"), this.warn = Hc(W, P, "warn"), this.info = Hc(W, P, "info"), this.debug = Hc(W, P, "debug"), this.trace = Hc(W, P, "trace"), $ && (this.serializers = $, this._serialize = B), e && (this._logEvent = h1( + [].concat(W._logEvent.bindings, P) )); } - return K.prototype = this, new K(this); + return H.prototype = this, new H(this); } return u; } -$o.levels = { +Fo.levels = { values: { fatal: 60, error: 50, @@ -6077,24 +6077,24 @@ $o.levels = { 60: "fatal" } }; -$o.stdSerializers = dk; -$o.stdTimeFunctions = Object.assign({}, { nullTime: _4, epochTime: E4, unixTime: wk, isoTime: xk }); -function zc(t, e, r, n) { +Fo.stdSerializers = Ek; +Fo.stdTimeFunctions = Object.assign({}, { nullTime: S4, epochTime: A4, unixTime: Tk, isoTime: Rk }); +function Wc(t, e, r, n) { const i = Object.getPrototypeOf(e); - e[r] = e.levelVal > e.levels.values[r] ? yl : i[r] ? i[r] : bl[r] || bl[n] || yl, gk(t, e, r); + e[r] = e.levelVal > e.levels.values[r] ? wl : i[r] ? i[r] : yl[r] || yl[n] || wl, Ak(t, e, r); } -function gk(t, e, r) { - !t.transmit && e[r] === yl || (e[r] = /* @__PURE__ */ function(n) { +function Ak(t, e, r) { + !t.transmit && e[r] === wl || (e[r] = /* @__PURE__ */ function(n) { return function() { - const s = t.timestamp(), o = new Array(arguments.length), a = Object.getPrototypeOf && Object.getPrototypeOf(this) === bl ? bl : this; + const s = t.timestamp(), o = new Array(arguments.length), a = Object.getPrototypeOf && Object.getPrototypeOf(this) === yl ? yl : this; for (var u = 0; u < o.length; u++) o[u] = arguments[u]; - if (t.serialize && !t.asObject && L0(o, this._serialize, this.serializers, this._stdErrSerialize), t.asObject ? n.call(a, mk(this, r, o, s)) : n.apply(a, o), t.transmit) { - const l = t.transmit.level || e.level, d = $o.levels.values[l], g = $o.levels.values[r]; - if (g < d) return; - vk(this, { + if (t.serialize && !t.asObject && k0(o, this._serialize, this.serializers, this._stdErrSerialize), t.asObject ? n.call(a, Pk(this, r, o, s)) : n.apply(a, o), t.transmit) { + const l = t.transmit.level || e.level, d = Fo.levels.values[l], p = Fo.levels.values[r]; + if (p < d) return; + Mk(this, { ts: s, methodLevel: r, - methodValue: g, + methodValue: p, send: t.transmit.send, val: e.levelVal }, o); @@ -6102,24 +6102,24 @@ function gk(t, e, r) { }; }(e[r])); } -function mk(t, e, r, n) { - t._serialize && L0(r, t._serialize, t.serializers, t._stdErrSerialize); +function Pk(t, e, r, n) { + t._serialize && k0(r, t._serialize, t.serializers, t._stdErrSerialize); const i = r.slice(); let s = i[0]; const o = {}; - n && (o.time = n), o.level = $o.levels.values[e]; + n && (o.time = n), o.level = Fo.levels.values[e]; let a = (t._childLevel | 0) + 1; if (a < 1 && (a = 1), s !== null && typeof s == "object") { for (; a-- && typeof i[0] == "object"; ) Object.assign(o, i.shift()); - s = i.length ? Y2(i.shift(), i) : void 0; - } else typeof s == "string" && (s = Y2(i.shift(), i)); + s = i.length ? X2(i.shift(), i) : void 0; + } else typeof s == "string" && (s = X2(i.shift(), i)); return s !== void 0 && (o.msg = s), o; } -function L0(t, e, r, n) { +function k0(t, e, r, n) { for (const i in t) if (n && t[i] instanceof Error) - t[i] = $o.stdSerializers.err(t[i]); + t[i] = Fo.stdSerializers.err(t[i]); else if (typeof t[i] == "object" && !Array.isArray(t[i])) for (const s in t[i]) e && e.indexOf(s) > -1 && s in r && (t[i][s] = r[s](t[i][s])); @@ -6133,9 +6133,9 @@ function Hc(t, e, r) { return t[r].apply(this, n); }; } -function vk(t, e, r) { +function Mk(t, e, r) { const n = e.send, i = e.ts, s = e.methodLevel, o = e.methodValue, a = e.val, u = t._logEvent.bindings; - L0( + k0( r, t._serialize || Object.keys(t.serializers), t.serializers, @@ -6152,7 +6152,7 @@ function h1(t) { level: { label: "", value: 0 } }; } -function bk(t) { +function Ik(t) { const e = { type: t.constructor.name, msg: t.message, @@ -6162,30 +6162,30 @@ function bk(t) { e[r] === void 0 && (e[r] = t[r]); return e; } -function yk(t) { - return typeof t.timestamp == "function" ? t.timestamp : t.timestamp === !1 ? _4 : E4; +function Ck(t) { + return typeof t.timestamp == "function" ? t.timestamp : t.timestamp === !1 ? S4 : A4; } -function ad() { +function cd() { return {}; } function Jg(t) { return t; } -function yl() { +function wl() { } -function _4() { +function S4() { return !1; } -function E4() { +function A4() { return Date.now(); } -function wk() { +function Tk() { return Math.round(Date.now() / 1e3); } -function xk() { +function Rk() { return new Date(Date.now()).toISOString(); } -function _k() { +function Dk() { function t(e) { return typeof e < "u" && e; } @@ -6200,8 +6200,8 @@ function _k() { return t(self) || t(window) || t(this) || {}; } } -const jl = /* @__PURE__ */ ts(Yc), Ek = { level: "info" }, ql = "custom_context", $v = 1e3 * 1024; -let Sk = class { +const ql = /* @__PURE__ */ rs(Jc), Ok = { level: "info" }, zl = "custom_context", $v = 1e3 * 1024; +let Nk = class { constructor(e) { this.nodeValue = e, this.sizeInBytes = new TextEncoder().encode(this.nodeValue).length, this.next = null; } @@ -6211,12 +6211,12 @@ let Sk = class { get size() { return this.sizeInBytes; } -}, J2 = class { +}, Z2 = class { constructor(e) { this.head = null, this.tail = null, this.lengthInNodes = 0, this.maxSizeInBytes = e, this.sizeInBytes = 0; } append(e) { - const r = new Sk(e); + const r = new Nk(e); if (r.size > this.maxSizeInBytes) throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`); for (; this.size + r.size > this.maxSizeInBytes; ) this.shift(); this.head ? (this.tail && (this.tail.next = r), this.tail = r) : (this.head = r, this.tail = r), this.lengthInNodes++, this.sizeInBytes += r.size; @@ -6249,15 +6249,15 @@ let Sk = class { return e = e.next, { done: !1, value: r }; } }; } -}, S4 = class { +}, P4 = class { constructor(e, r = $v) { - this.level = e ?? "error", this.levelValue = Yc.levels.values[this.level], this.MAX_LOG_SIZE_IN_BYTES = r, this.logs = new J2(this.MAX_LOG_SIZE_IN_BYTES); + this.level = e ?? "error", this.levelValue = Jc.levels.values[this.level], this.MAX_LOG_SIZE_IN_BYTES = r, this.logs = new Z2(this.MAX_LOG_SIZE_IN_BYTES); } forwardToConsole(e, r) { - r === Yc.levels.values.error ? console.error(e) : r === Yc.levels.values.warn ? console.warn(e) : r === Yc.levels.values.debug ? console.debug(e) : r === Yc.levels.values.trace ? console.trace(e) : console.log(e); + r === Jc.levels.values.error ? console.error(e) : r === Jc.levels.values.warn ? console.warn(e) : r === Jc.levels.values.debug ? console.debug(e) : r === Jc.levels.values.trace ? console.trace(e) : console.log(e); } appendToLogs(e) { - this.logs.append(ko({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), log: e })); + this.logs.append(Bo({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), log: e })); const r = typeof e == "string" ? JSON.parse(e).level : e.level; r >= this.levelValue && this.forwardToConsole(e, r); } @@ -6265,18 +6265,18 @@ let Sk = class { return this.logs; } clearLogs() { - this.logs = new J2(this.MAX_LOG_SIZE_IN_BYTES); + this.logs = new Z2(this.MAX_LOG_SIZE_IN_BYTES); } getLogArray() { return Array.from(this.logs); } logsToBlob(e) { const r = this.getLogArray(); - return r.push(ko({ extraMetadata: e })), new Blob(r, { type: "application/json" }); + return r.push(Bo({ extraMetadata: e })), new Blob(r, { type: "application/json" }); } -}, Ak = class { +}, Lk = class { constructor(e, r = $v) { - this.baseChunkLogger = new S4(e, r); + this.baseChunkLogger = new P4(e, r); } write(e) { this.baseChunkLogger.appendToLogs(e); @@ -6297,9 +6297,9 @@ let Sk = class { const r = URL.createObjectURL(this.logsToBlob(e)), n = document.createElement("a"); n.href = r, n.download = `walletconnect-logs-${(/* @__PURE__ */ new Date()).toISOString()}.txt`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(r); } -}, Pk = class { +}, kk = class { constructor(e, r = $v) { - this.baseChunkLogger = new S4(e, r); + this.baseChunkLogger = new P4(e, r); } write(e) { this.baseChunkLogger.appendToLogs(e); @@ -6317,103 +6317,103 @@ let Sk = class { return this.baseChunkLogger.logsToBlob(e); } }; -var Mk = Object.defineProperty, Ik = Object.defineProperties, Ck = Object.getOwnPropertyDescriptors, X2 = Object.getOwnPropertySymbols, Tk = Object.prototype.hasOwnProperty, Rk = Object.prototype.propertyIsEnumerable, Z2 = (t, e, r) => e in t ? Mk(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Yd = (t, e) => { - for (var r in e || (e = {})) Tk.call(e, r) && Z2(t, r, e[r]); - if (X2) for (var r of X2(e)) Rk.call(e, r) && Z2(t, r, e[r]); +var $k = Object.defineProperty, Bk = Object.defineProperties, Fk = Object.getOwnPropertyDescriptors, Q2 = Object.getOwnPropertySymbols, jk = Object.prototype.hasOwnProperty, Uk = Object.prototype.propertyIsEnumerable, ex = (t, e, r) => e in t ? $k(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Jd = (t, e) => { + for (var r in e || (e = {})) jk.call(e, r) && ex(t, r, e[r]); + if (Q2) for (var r of Q2(e)) Uk.call(e, r) && ex(t, r, e[r]); return t; -}, Jd = (t, e) => Ik(t, Ck(e)); -function k0(t) { - return Jd(Yd({}, t), { level: (t == null ? void 0 : t.level) || Ek.level }); +}, Xd = (t, e) => Bk(t, Fk(e)); +function $0(t) { + return Xd(Jd({}, t), { level: (t == null ? void 0 : t.level) || Ok.level }); } -function Dk(t, e = ql) { +function qk(t, e = zl) { return t[e] || ""; } -function Ok(t, e, r = ql) { +function zk(t, e, r = zl) { return t[r] = e, t; } -function Si(t, e = ql) { +function Si(t, e = zl) { let r = ""; - return typeof t.bindings > "u" ? r = Dk(t, e) : r = t.bindings().context || "", r; + return typeof t.bindings > "u" ? r = qk(t, e) : r = t.bindings().context || "", r; } -function Nk(t, e, r = ql) { +function Wk(t, e, r = zl) { const n = Si(t, r); return n.trim() ? `${n}/${e}` : e; } -function ai(t, e, r = ql) { - const n = Nk(t, e, r), i = t.child({ context: n }); - return Ok(i, n, r); +function ci(t, e, r = zl) { + const n = Wk(t, e, r), i = t.child({ context: n }); + return zk(i, n, r); } -function Lk(t) { +function Hk(t) { var e, r; - const n = new Ak((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); - return { logger: jl(Jd(Yd({}, t.opts), { level: "trace", browser: Jd(Yd({}, (r = t.opts) == null ? void 0 : r.browser), { write: (i) => n.write(i) }) })), chunkLoggerController: n }; + const n = new Lk((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); + return { logger: ql(Xd(Jd({}, t.opts), { level: "trace", browser: Xd(Jd({}, (r = t.opts) == null ? void 0 : r.browser), { write: (i) => n.write(i) }) })), chunkLoggerController: n }; } -function kk(t) { +function Kk(t) { var e; - const r = new Pk((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); - return { logger: jl(Jd(Yd({}, t.opts), { level: "trace" }), r), chunkLoggerController: r }; + const r = new kk((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); + return { logger: ql(Xd(Jd({}, t.opts), { level: "trace" }), r), chunkLoggerController: r }; } -function $k(t) { - return typeof t.loggerOverride < "u" && typeof t.loggerOverride != "string" ? { logger: t.loggerOverride, chunkLoggerController: null } : typeof window < "u" ? Lk(t) : kk(t); +function Vk(t) { + return typeof t.loggerOverride < "u" && typeof t.loggerOverride != "string" ? { logger: t.loggerOverride, chunkLoggerController: null } : typeof window < "u" ? Hk(t) : Kk(t); } -let Fk = class extends mc { +let Gk = class extends vc { constructor(e) { super(), this.opts = e, this.protocol = "wc", this.version = 2; } -}, Bk = class extends mc { +}, Yk = class extends vc { constructor(e, r) { super(), this.core = e, this.logger = r, this.records = /* @__PURE__ */ new Map(); } -}, Uk = class { +}, Jk = class { constructor(e, r) { this.logger = e, this.core = r; } -}, jk = class extends mc { +}, Xk = class extends vc { constructor(e, r) { super(), this.relayer = e, this.logger = r; } -}, qk = class extends mc { +}, Zk = class extends vc { constructor(e) { super(); } -}, zk = class { +}, Qk = class { constructor(e, r, n, i) { this.core = e, this.logger = r, this.name = n; } -}, Hk = class extends mc { +}, e$ = class extends vc { constructor(e, r) { super(), this.relayer = e, this.logger = r; } -}, Wk = class extends mc { +}, t$ = class extends vc { constructor(e, r) { super(), this.core = e, this.logger = r; } -}, Kk = class { +}, r$ = class { constructor(e, r, n) { this.core = e, this.logger = r, this.store = n; } -}, Vk = class { +}, n$ = class { constructor(e, r) { this.projectId = e, this.logger = r; } -}, Gk = class { +}, i$ = class { constructor(e, r, n) { this.core = e, this.logger = r, this.telemetryEnabled = n; } -}, Yk = class { +}, s$ = class { constructor(e) { this.opts = e, this.protocol = "wc", this.version = 2; } -}, Jk = class { +}, o$ = class { constructor(e) { this.client = e; } }; -var Fv = {}, Pa = {}, $0 = {}, F0 = {}; +var Bv = {}, Ca = {}, B0 = {}, F0 = {}; Object.defineProperty(F0, "__esModule", { value: !0 }); F0.BrowserRandomSource = void 0; -const Q2 = 65536; -class Xk { +const tx = 65536; +class a$ { constructor() { this.isAvailable = !1, this.isInstantiated = !1; const e = typeof self < "u" ? self.crypto || self.msCrypto : null; @@ -6423,34 +6423,34 @@ class Xk { if (!this.isAvailable || !this._crypto) throw new Error("Browser random byte generator is not available."); const r = new Uint8Array(e); - for (let n = 0; n < r.length; n += Q2) - this._crypto.getRandomValues(r.subarray(n, n + Math.min(r.length - n, Q2))); + for (let n = 0; n < r.length; n += tx) + this._crypto.getRandomValues(r.subarray(n, n + Math.min(r.length - n, tx))); return r; } } -F0.BrowserRandomSource = Xk; -function A4(t) { +F0.BrowserRandomSource = a$; +function M4(t) { throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } -var B0 = {}, ki = {}; -Object.defineProperty(ki, "__esModule", { value: !0 }); -function Zk(t) { +var j0 = {}, $i = {}; +Object.defineProperty($i, "__esModule", { value: !0 }); +function c$(t) { for (var e = 0; e < t.length; e++) t[e] = 0; return t; } -ki.wipe = Zk; -const Qk = {}, e$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +$i.wipe = c$; +const u$ = {}, f$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - default: Qk -}, Symbol.toStringTag, { value: "Module" })), zl = /* @__PURE__ */ bv(e$); -Object.defineProperty(B0, "__esModule", { value: !0 }); -B0.NodeRandomSource = void 0; -const t$ = ki; -class r$ { + default: u$ +}, Symbol.toStringTag, { value: "Module" })), Wl = /* @__PURE__ */ bv(f$); +Object.defineProperty(j0, "__esModule", { value: !0 }); +j0.NodeRandomSource = void 0; +const l$ = $i; +class h$ { constructor() { - if (this.isAvailable = !1, this.isInstantiated = !1, typeof A4 < "u") { - const e = zl; + if (this.isAvailable = !1, this.isInstantiated = !1, typeof M4 < "u") { + const e = Wl; e && e.randomBytes && (this._crypto = e, this.isAvailable = !0, this.isInstantiated = !0); } } @@ -6463,20 +6463,20 @@ class r$ { const n = new Uint8Array(e); for (let i = 0; i < n.length; i++) n[i] = r[i]; - return (0, t$.wipe)(r), n; + return (0, l$.wipe)(r), n; } } -B0.NodeRandomSource = r$; -Object.defineProperty($0, "__esModule", { value: !0 }); -$0.SystemRandomSource = void 0; -const n$ = F0, i$ = B0; -class s$ { +j0.NodeRandomSource = h$; +Object.defineProperty(B0, "__esModule", { value: !0 }); +B0.SystemRandomSource = void 0; +const d$ = F0, p$ = j0; +class g$ { constructor() { - if (this.isAvailable = !1, this.name = "", this._source = new n$.BrowserRandomSource(), this._source.isAvailable) { + if (this.isAvailable = !1, this.name = "", this._source = new d$.BrowserRandomSource(), this._source.isAvailable) { this.isAvailable = !0, this.name = "Browser"; return; } - if (this._source = new i$.NodeRandomSource(), this._source.isAvailable) { + if (this._source = new p$.NodeRandomSource(), this._source.isAvailable) { this.isAvailable = !0, this.name = "Node"; return; } @@ -6487,13 +6487,13 @@ class s$ { return this._source.randomBytes(e); } } -$0.SystemRandomSource = s$; -var or = {}, P4 = {}; +B0.SystemRandomSource = g$; +var ar = {}, I4 = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); function e(a, u) { - var l = a >>> 16 & 65535, d = a & 65535, g = u >>> 16 & 65535, w = u & 65535; - return d * w + (l * w + d * g << 16 >>> 0) | 0; + var l = a >>> 16 & 65535, d = a & 65535, p = u >>> 16 & 65535, w = u & 65535; + return d * w + (l * w + d * p << 16 >>> 0) | 0; } t.mul = Math.imul || e; function r(a, u) { @@ -6518,96 +6518,96 @@ var or = {}, P4 = {}; t.isInteger = Number.isInteger || o, t.MAX_SAFE_INTEGER = 9007199254740991, t.isSafeInteger = function(a) { return t.isInteger(a) && a >= -t.MAX_SAFE_INTEGER && a <= t.MAX_SAFE_INTEGER; }; -})(P4); -Object.defineProperty(or, "__esModule", { value: !0 }); -var M4 = P4; -function o$(t, e) { +})(I4); +Object.defineProperty(ar, "__esModule", { value: !0 }); +var C4 = I4; +function m$(t, e) { return e === void 0 && (e = 0), (t[e + 0] << 8 | t[e + 1]) << 16 >> 16; } -or.readInt16BE = o$; -function a$(t, e) { +ar.readInt16BE = m$; +function v$(t, e) { return e === void 0 && (e = 0), (t[e + 0] << 8 | t[e + 1]) >>> 0; } -or.readUint16BE = a$; -function c$(t, e) { +ar.readUint16BE = v$; +function b$(t, e) { return e === void 0 && (e = 0), (t[e + 1] << 8 | t[e]) << 16 >> 16; } -or.readInt16LE = c$; -function u$(t, e) { +ar.readInt16LE = b$; +function y$(t, e) { return e === void 0 && (e = 0), (t[e + 1] << 8 | t[e]) >>> 0; } -or.readUint16LE = u$; -function I4(t, e, r) { +ar.readUint16LE = y$; +function T4(t, e, r) { return e === void 0 && (e = new Uint8Array(2)), r === void 0 && (r = 0), e[r + 0] = t >>> 8, e[r + 1] = t >>> 0, e; } -or.writeUint16BE = I4; -or.writeInt16BE = I4; -function C4(t, e, r) { +ar.writeUint16BE = T4; +ar.writeInt16BE = T4; +function R4(t, e, r) { return e === void 0 && (e = new Uint8Array(2)), r === void 0 && (r = 0), e[r + 0] = t >>> 0, e[r + 1] = t >>> 8, e; } -or.writeUint16LE = C4; -or.writeInt16LE = C4; +ar.writeUint16LE = R4; +ar.writeInt16LE = R4; function d1(t, e) { return e === void 0 && (e = 0), t[e] << 24 | t[e + 1] << 16 | t[e + 2] << 8 | t[e + 3]; } -or.readInt32BE = d1; +ar.readInt32BE = d1; function p1(t, e) { return e === void 0 && (e = 0), (t[e] << 24 | t[e + 1] << 16 | t[e + 2] << 8 | t[e + 3]) >>> 0; } -or.readUint32BE = p1; +ar.readUint32BE = p1; function g1(t, e) { return e === void 0 && (e = 0), t[e + 3] << 24 | t[e + 2] << 16 | t[e + 1] << 8 | t[e]; } -or.readInt32LE = g1; +ar.readInt32LE = g1; function m1(t, e) { return e === void 0 && (e = 0), (t[e + 3] << 24 | t[e + 2] << 16 | t[e + 1] << 8 | t[e]) >>> 0; } -or.readUint32LE = m1; -function Xd(t, e, r) { +ar.readUint32LE = m1; +function Zd(t, e, r) { return e === void 0 && (e = new Uint8Array(4)), r === void 0 && (r = 0), e[r + 0] = t >>> 24, e[r + 1] = t >>> 16, e[r + 2] = t >>> 8, e[r + 3] = t >>> 0, e; } -or.writeUint32BE = Xd; -or.writeInt32BE = Xd; -function Zd(t, e, r) { +ar.writeUint32BE = Zd; +ar.writeInt32BE = Zd; +function Qd(t, e, r) { return e === void 0 && (e = new Uint8Array(4)), r === void 0 && (r = 0), e[r + 0] = t >>> 0, e[r + 1] = t >>> 8, e[r + 2] = t >>> 16, e[r + 3] = t >>> 24, e; } -or.writeUint32LE = Zd; -or.writeInt32LE = Zd; -function f$(t, e) { +ar.writeUint32LE = Qd; +ar.writeInt32LE = Qd; +function w$(t, e) { e === void 0 && (e = 0); var r = d1(t, e), n = d1(t, e + 4); return r * 4294967296 + n - (n >> 31) * 4294967296; } -or.readInt64BE = f$; -function l$(t, e) { +ar.readInt64BE = w$; +function x$(t, e) { e === void 0 && (e = 0); var r = p1(t, e), n = p1(t, e + 4); return r * 4294967296 + n; } -or.readUint64BE = l$; -function h$(t, e) { +ar.readUint64BE = x$; +function _$(t, e) { e === void 0 && (e = 0); var r = g1(t, e), n = g1(t, e + 4); return n * 4294967296 + r - (r >> 31) * 4294967296; } -or.readInt64LE = h$; -function d$(t, e) { +ar.readInt64LE = _$; +function E$(t, e) { e === void 0 && (e = 0); var r = m1(t, e), n = m1(t, e + 4); return n * 4294967296 + r; } -or.readUint64LE = d$; -function T4(t, e, r) { - return e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0), Xd(t / 4294967296 >>> 0, e, r), Xd(t >>> 0, e, r + 4), e; +ar.readUint64LE = E$; +function D4(t, e, r) { + return e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0), Zd(t / 4294967296 >>> 0, e, r), Zd(t >>> 0, e, r + 4), e; } -or.writeUint64BE = T4; -or.writeInt64BE = T4; -function R4(t, e, r) { - return e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0), Zd(t >>> 0, e, r), Zd(t / 4294967296 >>> 0, e, r + 4), e; +ar.writeUint64BE = D4; +ar.writeInt64BE = D4; +function O4(t, e, r) { + return e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0), Qd(t >>> 0, e, r), Qd(t / 4294967296 >>> 0, e, r + 4), e; } -or.writeUint64LE = R4; -or.writeInt64LE = R4; -function p$(t, e, r) { +ar.writeUint64LE = O4; +ar.writeInt64LE = O4; +function S$(t, e, r) { if (r === void 0 && (r = 0), t % 8 !== 0) throw new Error("readUintBE supports only bitLengths divisible by 8"); if (t / 8 > e.length - r) @@ -6616,8 +6616,8 @@ function p$(t, e, r) { n += e[s] * i, i *= 256; return n; } -or.readUintBE = p$; -function g$(t, e, r) { +ar.readUintBE = S$; +function A$(t, e, r) { if (r === void 0 && (r = 0), t % 8 !== 0) throw new Error("readUintLE supports only bitLengths divisible by 8"); if (t / 8 > e.length - r) @@ -6626,117 +6626,117 @@ function g$(t, e, r) { n += e[s] * i, i *= 256; return n; } -or.readUintLE = g$; -function m$(t, e, r, n) { +ar.readUintLE = A$; +function P$(t, e, r, n) { if (r === void 0 && (r = new Uint8Array(t / 8)), n === void 0 && (n = 0), t % 8 !== 0) throw new Error("writeUintBE supports only bitLengths divisible by 8"); - if (!M4.isSafeInteger(e)) + if (!C4.isSafeInteger(e)) throw new Error("writeUintBE value must be an integer"); for (var i = 1, s = t / 8 + n - 1; s >= n; s--) r[s] = e / i & 255, i *= 256; return r; } -or.writeUintBE = m$; -function v$(t, e, r, n) { +ar.writeUintBE = P$; +function M$(t, e, r, n) { if (r === void 0 && (r = new Uint8Array(t / 8)), n === void 0 && (n = 0), t % 8 !== 0) throw new Error("writeUintLE supports only bitLengths divisible by 8"); - if (!M4.isSafeInteger(e)) + if (!C4.isSafeInteger(e)) throw new Error("writeUintLE value must be an integer"); for (var i = 1, s = n; s < n + t / 8; s++) r[s] = e / i & 255, i *= 256; return r; } -or.writeUintLE = v$; -function b$(t, e) { +ar.writeUintLE = M$; +function I$(t, e) { e === void 0 && (e = 0); var r = new DataView(t.buffer, t.byteOffset, t.byteLength); return r.getFloat32(e); } -or.readFloat32BE = b$; -function y$(t, e) { +ar.readFloat32BE = I$; +function C$(t, e) { e === void 0 && (e = 0); var r = new DataView(t.buffer, t.byteOffset, t.byteLength); return r.getFloat32(e, !0); } -or.readFloat32LE = y$; -function w$(t, e) { +ar.readFloat32LE = C$; +function T$(t, e) { e === void 0 && (e = 0); var r = new DataView(t.buffer, t.byteOffset, t.byteLength); return r.getFloat64(e); } -or.readFloat64BE = w$; -function x$(t, e) { +ar.readFloat64BE = T$; +function R$(t, e) { e === void 0 && (e = 0); var r = new DataView(t.buffer, t.byteOffset, t.byteLength); return r.getFloat64(e, !0); } -or.readFloat64LE = x$; -function _$(t, e, r) { +ar.readFloat64LE = R$; +function D$(t, e, r) { e === void 0 && (e = new Uint8Array(4)), r === void 0 && (r = 0); var n = new DataView(e.buffer, e.byteOffset, e.byteLength); return n.setFloat32(r, t), e; } -or.writeFloat32BE = _$; -function E$(t, e, r) { +ar.writeFloat32BE = D$; +function O$(t, e, r) { e === void 0 && (e = new Uint8Array(4)), r === void 0 && (r = 0); var n = new DataView(e.buffer, e.byteOffset, e.byteLength); return n.setFloat32(r, t, !0), e; } -or.writeFloat32LE = E$; -function S$(t, e, r) { +ar.writeFloat32LE = O$; +function N$(t, e, r) { e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0); var n = new DataView(e.buffer, e.byteOffset, e.byteLength); return n.setFloat64(r, t), e; } -or.writeFloat64BE = S$; -function A$(t, e, r) { +ar.writeFloat64BE = N$; +function L$(t, e, r) { e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0); var n = new DataView(e.buffer, e.byteOffset, e.byteLength); return n.setFloat64(r, t, !0), e; } -or.writeFloat64LE = A$; +ar.writeFloat64LE = L$; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.randomStringForEntropy = t.randomString = t.randomUint32 = t.randomBytes = t.defaultRandomSource = void 0; - const e = $0, r = or, n = ki; + const e = B0, r = ar, n = $i; t.defaultRandomSource = new e.SystemRandomSource(); function i(l, d = t.defaultRandomSource) { return d.randomBytes(l); } t.randomBytes = i; function s(l = t.defaultRandomSource) { - const d = i(4, l), g = (0, r.readUint32LE)(d); - return (0, n.wipe)(d), g; + const d = i(4, l), p = (0, r.readUint32LE)(d); + return (0, n.wipe)(d), p; } t.randomUint32 = s; const o = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - function a(l, d = o, g = t.defaultRandomSource) { + function a(l, d = o, p = t.defaultRandomSource) { if (d.length < 2) throw new Error("randomString charset is too short"); if (d.length > 256) throw new Error("randomString charset is too long"); let w = ""; - const A = d.length, M = 256 - 256 % A; + const A = d.length, P = 256 - 256 % A; for (; l > 0; ) { - const N = i(Math.ceil(l * 256 / M), g); + const N = i(Math.ceil(l * 256 / P), p); for (let L = 0; L < N.length && l > 0; L++) { const $ = N[L]; - $ < M && (w += d.charAt($ % A), l--); + $ < P && (w += d.charAt($ % A), l--); } (0, n.wipe)(N); } return w; } t.randomString = a; - function u(l, d = o, g = t.defaultRandomSource) { + function u(l, d = o, p = t.defaultRandomSource) { const w = Math.ceil(l / (Math.log(d.length) / Math.LN2)); - return a(w, d, g); + return a(w, d, p); } t.randomStringForEntropy = u; -})(Pa); -var D4 = {}; +})(Ca); +var N4 = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - var e = or, r = ki; + var e = ar, r = $i; t.DIGEST_LENGTH = 64, t.BLOCK_SIZE = 128; var n = ( /** @class */ @@ -6764,14 +6764,14 @@ var D4 = {}; return this; }, a.prototype.finish = function(u) { if (!this._finished) { - var l = this._bytesHashed, d = this._bufferLength, g = l / 536870912 | 0, w = l << 3, A = l % 128 < 112 ? 128 : 256; + var l = this._bytesHashed, d = this._bufferLength, p = l / 536870912 | 0, w = l << 3, A = l % 128 < 112 ? 128 : 256; this._buffer[d] = 128; - for (var M = d + 1; M < A - 8; M++) - this._buffer[M] = 0; - e.writeUint32BE(g, this._buffer, A - 8), e.writeUint32BE(w, this._buffer, A - 4), s(this._tempHi, this._tempLo, this._stateHi, this._stateLo, this._buffer, 0, A), this._finished = !0; + for (var P = d + 1; P < A - 8; P++) + this._buffer[P] = 0; + e.writeUint32BE(p, this._buffer, A - 8), e.writeUint32BE(w, this._buffer, A - 4), s(this._tempHi, this._tempLo, this._stateHi, this._stateLo, this._buffer, 0, A), this._finished = !0; } - for (var M = 0; M < this.digestLength / 8; M++) - e.writeUint32BE(this._stateHi[M], u, M * 8), e.writeUint32BE(this._stateLo[M], u, M * 8 + 4); + for (var P = 0; P < this.digestLength / 8; P++) + e.writeUint32BE(this._stateHi[P], u, P * 8), e.writeUint32BE(this._stateLo[P], u, P * 8 + 4); return this; }, a.prototype.digest = function() { var u = new Uint8Array(this.digestLength); @@ -6956,19 +6956,19 @@ var D4 = {}; 1816402316, 1246189591 ]); - function s(a, u, l, d, g, w, A) { - for (var M = l[0], N = l[1], L = l[2], $ = l[3], F = l[4], K = l[5], H = l[6], V = l[7], te = d[0], R = d[1], W = d[2], pe = d[3], Ee = d[4], Y = d[5], S = d[6], m = d[7], f, p, b, x, _, E, v, P; A >= 128; ) { + function s(a, u, l, d, p, w, A) { + for (var P = l[0], N = l[1], L = l[2], $ = l[3], B = l[4], H = l[5], W = l[6], V = l[7], te = d[0], R = d[1], K = d[2], ge = d[3], Ee = d[4], Y = d[5], S = d[6], m = d[7], f, g, b, x, _, E, v, M; A >= 128; ) { for (var I = 0; I < 16; I++) { - var B = 8 * I + w; - a[I] = e.readUint32BE(g, B), u[I] = e.readUint32BE(g, B + 4); + var F = 8 * I + w; + a[I] = e.readUint32BE(p, F), u[I] = e.readUint32BE(p, F + 4); } for (var I = 0; I < 80; I++) { - var ce = M, D = N, oe = L, Z = $, J = F, Q = K, T = H, X = V, re = te, de = R, ie = W, ue = pe, ve = Ee, Pe = Y, De = S, Ce = m; - if (f = V, p = m, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = (F >>> 14 | Ee << 18) ^ (F >>> 18 | Ee << 14) ^ (Ee >>> 9 | F << 23), p = (Ee >>> 14 | F << 18) ^ (Ee >>> 18 | F << 14) ^ (F >>> 9 | Ee << 23), _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, f = F & K ^ ~F & H, p = Ee & Y ^ ~Ee & S, _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, f = i[I * 2], p = i[I * 2 + 1], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, f = a[I % 16], p = u[I % 16], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, b = v & 65535 | P << 16, x = _ & 65535 | E << 16, f = b, p = x, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = (M >>> 28 | te << 4) ^ (te >>> 2 | M << 30) ^ (te >>> 7 | M << 25), p = (te >>> 28 | M << 4) ^ (M >>> 2 | te << 30) ^ (M >>> 7 | te << 25), _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, f = M & N ^ M & L ^ N & L, p = te & R ^ te & W ^ R & W, _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, X = v & 65535 | P << 16, Ce = _ & 65535 | E << 16, f = Z, p = ue, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = b, p = x, _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, Z = v & 65535 | P << 16, ue = _ & 65535 | E << 16, N = ce, L = D, $ = oe, F = Z, K = J, H = Q, V = T, M = X, R = re, W = de, pe = ie, Ee = ue, Y = ve, S = Pe, m = De, te = Ce, I % 16 === 15) - for (var B = 0; B < 16; B++) - f = a[B], p = u[B], _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = a[(B + 9) % 16], p = u[(B + 9) % 16], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, b = a[(B + 1) % 16], x = u[(B + 1) % 16], f = (b >>> 1 | x << 31) ^ (b >>> 8 | x << 24) ^ b >>> 7, p = (x >>> 1 | b << 31) ^ (x >>> 8 | b << 24) ^ (x >>> 7 | b << 25), _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, b = a[(B + 14) % 16], x = u[(B + 14) % 16], f = (b >>> 19 | x << 13) ^ (x >>> 29 | b << 3) ^ b >>> 6, p = (x >>> 19 | b << 13) ^ (b >>> 29 | x << 3) ^ (x >>> 6 | b << 26), _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, a[B] = v & 65535 | P << 16, u[B] = _ & 65535 | E << 16; + var ce = P, D = N, oe = L, Z = $, J = B, Q = H, T = W, X = V, re = te, pe = R, ie = K, ue = ge, ve = Ee, Pe = Y, De = S, Ce = m; + if (f = V, g = m, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = (B >>> 14 | Ee << 18) ^ (B >>> 18 | Ee << 14) ^ (Ee >>> 9 | B << 23), g = (Ee >>> 14 | B << 18) ^ (Ee >>> 18 | B << 14) ^ (B >>> 9 | Ee << 23), _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, f = B & H ^ ~B & W, g = Ee & Y ^ ~Ee & S, _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, f = i[I * 2], g = i[I * 2 + 1], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, f = a[I % 16], g = u[I % 16], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, b = v & 65535 | M << 16, x = _ & 65535 | E << 16, f = b, g = x, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = (P >>> 28 | te << 4) ^ (te >>> 2 | P << 30) ^ (te >>> 7 | P << 25), g = (te >>> 28 | P << 4) ^ (P >>> 2 | te << 30) ^ (P >>> 7 | te << 25), _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, f = P & N ^ P & L ^ N & L, g = te & R ^ te & K ^ R & K, _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, X = v & 65535 | M << 16, Ce = _ & 65535 | E << 16, f = Z, g = ue, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = b, g = x, _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, Z = v & 65535 | M << 16, ue = _ & 65535 | E << 16, N = ce, L = D, $ = oe, B = Z, H = J, W = Q, V = T, P = X, R = re, K = pe, ge = ie, Ee = ue, Y = ve, S = Pe, m = De, te = Ce, I % 16 === 15) + for (var F = 0; F < 16; F++) + f = a[F], g = u[F], _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = a[(F + 9) % 16], g = u[(F + 9) % 16], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, b = a[(F + 1) % 16], x = u[(F + 1) % 16], f = (b >>> 1 | x << 31) ^ (b >>> 8 | x << 24) ^ b >>> 7, g = (x >>> 1 | b << 31) ^ (x >>> 8 | b << 24) ^ (x >>> 7 | b << 25), _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, b = a[(F + 14) % 16], x = u[(F + 14) % 16], f = (b >>> 19 | x << 13) ^ (x >>> 29 | b << 3) ^ b >>> 6, g = (x >>> 19 | b << 13) ^ (b >>> 29 | x << 3) ^ (x >>> 6 | b << 26), _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, a[F] = v & 65535 | M << 16, u[F] = _ & 65535 | E << 16; } - f = M, p = te, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[0], p = d[0], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[0] = M = v & 65535 | P << 16, d[0] = te = _ & 65535 | E << 16, f = N, p = R, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[1], p = d[1], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[1] = N = v & 65535 | P << 16, d[1] = R = _ & 65535 | E << 16, f = L, p = W, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[2], p = d[2], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[2] = L = v & 65535 | P << 16, d[2] = W = _ & 65535 | E << 16, f = $, p = pe, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[3], p = d[3], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[3] = $ = v & 65535 | P << 16, d[3] = pe = _ & 65535 | E << 16, f = F, p = Ee, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[4], p = d[4], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[4] = F = v & 65535 | P << 16, d[4] = Ee = _ & 65535 | E << 16, f = K, p = Y, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[5], p = d[5], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[5] = K = v & 65535 | P << 16, d[5] = Y = _ & 65535 | E << 16, f = H, p = S, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[6], p = d[6], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[6] = H = v & 65535 | P << 16, d[6] = S = _ & 65535 | E << 16, f = V, p = m, _ = p & 65535, E = p >>> 16, v = f & 65535, P = f >>> 16, f = l[7], p = d[7], _ += p & 65535, E += p >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[7] = V = v & 65535 | P << 16, d[7] = m = _ & 65535 | E << 16, w += 128, A -= 128; + f = P, g = te, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = l[0], g = d[0], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, l[0] = P = v & 65535 | M << 16, d[0] = te = _ & 65535 | E << 16, f = N, g = R, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = l[1], g = d[1], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, l[1] = N = v & 65535 | M << 16, d[1] = R = _ & 65535 | E << 16, f = L, g = K, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = l[2], g = d[2], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, l[2] = L = v & 65535 | M << 16, d[2] = K = _ & 65535 | E << 16, f = $, g = ge, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = l[3], g = d[3], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, l[3] = $ = v & 65535 | M << 16, d[3] = ge = _ & 65535 | E << 16, f = B, g = Ee, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = l[4], g = d[4], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, l[4] = B = v & 65535 | M << 16, d[4] = Ee = _ & 65535 | E << 16, f = H, g = Y, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = l[5], g = d[5], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, l[5] = H = v & 65535 | M << 16, d[5] = Y = _ & 65535 | E << 16, f = W, g = S, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = l[6], g = d[6], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, l[6] = W = v & 65535 | M << 16, d[6] = S = _ & 65535 | E << 16, f = V, g = m, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = l[7], g = d[7], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, l[7] = V = v & 65535 | M << 16, d[7] = m = _ & 65535 | E << 16, w += 128, A -= 128; } return w; } @@ -6979,10 +6979,10 @@ var D4 = {}; return u.clean(), l; } t.hash = o; -})(D4); +})(N4); (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.convertSecretKeyToX25519 = t.convertPublicKeyToX25519 = t.verify = t.sign = t.extractPublicKeyFromSecretKey = t.generateKeyPair = t.generateKeyPairFromSeed = t.SEED_LENGTH = t.SECRET_KEY_LENGTH = t.PUBLIC_KEY_LENGTH = t.SIGNATURE_LENGTH = void 0; - const e = Pa, r = D4, n = ki; + const e = Ca, r = N4, n = $i; t.SIGNATURE_LENGTH = 64, t.PUBLIC_KEY_LENGTH = 32, t.SECRET_KEY_LENGTH = 64, t.SEED_LENGTH = 32; function i(Z) { const J = new Float64Array(16); @@ -7044,7 +7044,7 @@ var D4 = {}; 52590, 14035, 8553 - ]), g = i([ + ]), p = i([ 26200, 26214, 26214, @@ -7083,7 +7083,7 @@ var D4 = {}; for (let Q = 0; Q < 16; Q++) Z[Q] = J[Q] | 0; } - function M(Z) { + function P(Z) { let J = 1; for (let Q = 0; Q < 16; Q++) { let T = Z[Q] + J + 65535; @@ -7102,11 +7102,11 @@ var D4 = {}; const Q = i(), T = i(); for (let X = 0; X < 16; X++) T[X] = J[X]; - M(T), M(T), M(T); + P(T), P(T), P(T); for (let X = 0; X < 2; X++) { Q[0] = T[0] - 65517; - for (let de = 1; de < 15; de++) - Q[de] = T[de] - 65535 - (Q[de - 1] >> 16 & 1), Q[de - 1] &= 65535; + for (let pe = 1; pe < 15; pe++) + Q[pe] = T[pe] - 65535 - (Q[pe - 1] >> 16 & 1), Q[pe - 1] &= 65535; Q[15] = T[15] - 32767 - (Q[14] >> 16 & 1); const re = Q[15] >> 16 & 1; Q[14] &= 65535, N(T, Q, 1 - re); @@ -7120,15 +7120,15 @@ var D4 = {}; Q |= Z[T] ^ J[T]; return (1 & Q - 1 >>> 8) - 1; } - function F(Z, J) { + function B(Z, J) { const Q = new Uint8Array(32), T = new Uint8Array(32); return L(Q, Z), L(T, J), $(Q, T); } - function K(Z) { + function H(Z) { const J = new Uint8Array(32); return L(J, Z), J[0] & 1; } - function H(Z, J) { + function W(Z, J) { for (let Q = 0; Q < 16; Q++) Z[Q] = J[2 * Q] + (J[2 * Q + 1] << 8); Z[15] &= 32767; @@ -7142,19 +7142,19 @@ var D4 = {}; Z[T] = J[T] - Q[T]; } function R(Z, J, Q) { - let T, X, re = 0, de = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = 0, Me = 0, Ne = 0, Ke = 0, Le = 0, qe = 0, ze = 0, _e = 0, Ze = 0, at = 0, ke = 0, Qe = 0, tt = 0, Ye = 0, dt = 0, lt = 0, ct = 0, qt = 0, Yt = 0, Et = 0, Qt = 0, Jt = 0, Dt = 0, kt = Q[0], Ct = Q[1], gt = Q[2], Rt = Q[3], Nt = Q[4], vt = Q[5], $t = Q[6], Bt = Q[7], rt = Q[8], Ft = Q[9], k = Q[10], j = Q[11], z = Q[12], C = Q[13], G = Q[14], U = Q[15]; - T = J[0], re += T * kt, de += T * Ct, ie += T * gt, ue += T * Rt, ve += T * Nt, Pe += T * vt, De += T * $t, Ce += T * Bt, $e += T * rt, Me += T * Ft, Ne += T * k, Ke += T * j, Le += T * z, qe += T * C, ze += T * G, _e += T * U, T = J[1], de += T * kt, ie += T * Ct, ue += T * gt, ve += T * Rt, Pe += T * Nt, De += T * vt, Ce += T * $t, $e += T * Bt, Me += T * rt, Ne += T * Ft, Ke += T * k, Le += T * j, qe += T * z, ze += T * C, _e += T * G, Ze += T * U, T = J[2], ie += T * kt, ue += T * Ct, ve += T * gt, Pe += T * Rt, De += T * Nt, Ce += T * vt, $e += T * $t, Me += T * Bt, Ne += T * rt, Ke += T * Ft, Le += T * k, qe += T * j, ze += T * z, _e += T * C, Ze += T * G, at += T * U, T = J[3], ue += T * kt, ve += T * Ct, Pe += T * gt, De += T * Rt, Ce += T * Nt, $e += T * vt, Me += T * $t, Ne += T * Bt, Ke += T * rt, Le += T * Ft, qe += T * k, ze += T * j, _e += T * z, Ze += T * C, at += T * G, ke += T * U, T = J[4], ve += T * kt, Pe += T * Ct, De += T * gt, Ce += T * Rt, $e += T * Nt, Me += T * vt, Ne += T * $t, Ke += T * Bt, Le += T * rt, qe += T * Ft, ze += T * k, _e += T * j, Ze += T * z, at += T * C, ke += T * G, Qe += T * U, T = J[5], Pe += T * kt, De += T * Ct, Ce += T * gt, $e += T * Rt, Me += T * Nt, Ne += T * vt, Ke += T * $t, Le += T * Bt, qe += T * rt, ze += T * Ft, _e += T * k, Ze += T * j, at += T * z, ke += T * C, Qe += T * G, tt += T * U, T = J[6], De += T * kt, Ce += T * Ct, $e += T * gt, Me += T * Rt, Ne += T * Nt, Ke += T * vt, Le += T * $t, qe += T * Bt, ze += T * rt, _e += T * Ft, Ze += T * k, at += T * j, ke += T * z, Qe += T * C, tt += T * G, Ye += T * U, T = J[7], Ce += T * kt, $e += T * Ct, Me += T * gt, Ne += T * Rt, Ke += T * Nt, Le += T * vt, qe += T * $t, ze += T * Bt, _e += T * rt, Ze += T * Ft, at += T * k, ke += T * j, Qe += T * z, tt += T * C, Ye += T * G, dt += T * U, T = J[8], $e += T * kt, Me += T * Ct, Ne += T * gt, Ke += T * Rt, Le += T * Nt, qe += T * vt, ze += T * $t, _e += T * Bt, Ze += T * rt, at += T * Ft, ke += T * k, Qe += T * j, tt += T * z, Ye += T * C, dt += T * G, lt += T * U, T = J[9], Me += T * kt, Ne += T * Ct, Ke += T * gt, Le += T * Rt, qe += T * Nt, ze += T * vt, _e += T * $t, Ze += T * Bt, at += T * rt, ke += T * Ft, Qe += T * k, tt += T * j, Ye += T * z, dt += T * C, lt += T * G, ct += T * U, T = J[10], Ne += T * kt, Ke += T * Ct, Le += T * gt, qe += T * Rt, ze += T * Nt, _e += T * vt, Ze += T * $t, at += T * Bt, ke += T * rt, Qe += T * Ft, tt += T * k, Ye += T * j, dt += T * z, lt += T * C, ct += T * G, qt += T * U, T = J[11], Ke += T * kt, Le += T * Ct, qe += T * gt, ze += T * Rt, _e += T * Nt, Ze += T * vt, at += T * $t, ke += T * Bt, Qe += T * rt, tt += T * Ft, Ye += T * k, dt += T * j, lt += T * z, ct += T * C, qt += T * G, Yt += T * U, T = J[12], Le += T * kt, qe += T * Ct, ze += T * gt, _e += T * Rt, Ze += T * Nt, at += T * vt, ke += T * $t, Qe += T * Bt, tt += T * rt, Ye += T * Ft, dt += T * k, lt += T * j, ct += T * z, qt += T * C, Yt += T * G, Et += T * U, T = J[13], qe += T * kt, ze += T * Ct, _e += T * gt, Ze += T * Rt, at += T * Nt, ke += T * vt, Qe += T * $t, tt += T * Bt, Ye += T * rt, dt += T * Ft, lt += T * k, ct += T * j, qt += T * z, Yt += T * C, Et += T * G, Qt += T * U, T = J[14], ze += T * kt, _e += T * Ct, Ze += T * gt, at += T * Rt, ke += T * Nt, Qe += T * vt, tt += T * $t, Ye += T * Bt, dt += T * rt, lt += T * Ft, ct += T * k, qt += T * j, Yt += T * z, Et += T * C, Qt += T * G, Jt += T * U, T = J[15], _e += T * kt, Ze += T * Ct, at += T * gt, ke += T * Rt, Qe += T * Nt, tt += T * vt, Ye += T * $t, dt += T * Bt, lt += T * rt, ct += T * Ft, qt += T * k, Yt += T * j, Et += T * z, Qt += T * C, Jt += T * G, Dt += T * U, re += 38 * Ze, de += 38 * at, ie += 38 * ke, ue += 38 * Qe, ve += 38 * tt, Pe += 38 * Ye, De += 38 * dt, Ce += 38 * lt, $e += 38 * ct, Me += 38 * qt, Ne += 38 * Yt, Ke += 38 * Et, Le += 38 * Qt, qe += 38 * Jt, ze += 38 * Dt, X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = de + X + 65535, X = Math.floor(T / 65536), de = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = de + X + 65535, X = Math.floor(T / 65536), de = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), Z[0] = re, Z[1] = de, Z[2] = ie, Z[3] = ue, Z[4] = ve, Z[5] = Pe, Z[6] = De, Z[7] = Ce, Z[8] = $e, Z[9] = Me, Z[10] = Ne, Z[11] = Ke, Z[12] = Le, Z[13] = qe, Z[14] = ze, Z[15] = _e; + let T, X, re = 0, pe = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = 0, Me = 0, Ne = 0, Ke = 0, Le = 0, qe = 0, ze = 0, _e = 0, Ze = 0, at = 0, ke = 0, Qe = 0, tt = 0, Ye = 0, dt = 0, lt = 0, ct = 0, qt = 0, Jt = 0, Et = 0, er = 0, Xt = 0, Dt = 0, kt = Q[0], Ct = Q[1], gt = Q[2], Rt = Q[3], Nt = Q[4], vt = Q[5], $t = Q[6], Ft = Q[7], rt = Q[8], Bt = Q[9], k = Q[10], U = Q[11], z = Q[12], C = Q[13], G = Q[14], j = Q[15]; + T = J[0], re += T * kt, pe += T * Ct, ie += T * gt, ue += T * Rt, ve += T * Nt, Pe += T * vt, De += T * $t, Ce += T * Ft, $e += T * rt, Me += T * Bt, Ne += T * k, Ke += T * U, Le += T * z, qe += T * C, ze += T * G, _e += T * j, T = J[1], pe += T * kt, ie += T * Ct, ue += T * gt, ve += T * Rt, Pe += T * Nt, De += T * vt, Ce += T * $t, $e += T * Ft, Me += T * rt, Ne += T * Bt, Ke += T * k, Le += T * U, qe += T * z, ze += T * C, _e += T * G, Ze += T * j, T = J[2], ie += T * kt, ue += T * Ct, ve += T * gt, Pe += T * Rt, De += T * Nt, Ce += T * vt, $e += T * $t, Me += T * Ft, Ne += T * rt, Ke += T * Bt, Le += T * k, qe += T * U, ze += T * z, _e += T * C, Ze += T * G, at += T * j, T = J[3], ue += T * kt, ve += T * Ct, Pe += T * gt, De += T * Rt, Ce += T * Nt, $e += T * vt, Me += T * $t, Ne += T * Ft, Ke += T * rt, Le += T * Bt, qe += T * k, ze += T * U, _e += T * z, Ze += T * C, at += T * G, ke += T * j, T = J[4], ve += T * kt, Pe += T * Ct, De += T * gt, Ce += T * Rt, $e += T * Nt, Me += T * vt, Ne += T * $t, Ke += T * Ft, Le += T * rt, qe += T * Bt, ze += T * k, _e += T * U, Ze += T * z, at += T * C, ke += T * G, Qe += T * j, T = J[5], Pe += T * kt, De += T * Ct, Ce += T * gt, $e += T * Rt, Me += T * Nt, Ne += T * vt, Ke += T * $t, Le += T * Ft, qe += T * rt, ze += T * Bt, _e += T * k, Ze += T * U, at += T * z, ke += T * C, Qe += T * G, tt += T * j, T = J[6], De += T * kt, Ce += T * Ct, $e += T * gt, Me += T * Rt, Ne += T * Nt, Ke += T * vt, Le += T * $t, qe += T * Ft, ze += T * rt, _e += T * Bt, Ze += T * k, at += T * U, ke += T * z, Qe += T * C, tt += T * G, Ye += T * j, T = J[7], Ce += T * kt, $e += T * Ct, Me += T * gt, Ne += T * Rt, Ke += T * Nt, Le += T * vt, qe += T * $t, ze += T * Ft, _e += T * rt, Ze += T * Bt, at += T * k, ke += T * U, Qe += T * z, tt += T * C, Ye += T * G, dt += T * j, T = J[8], $e += T * kt, Me += T * Ct, Ne += T * gt, Ke += T * Rt, Le += T * Nt, qe += T * vt, ze += T * $t, _e += T * Ft, Ze += T * rt, at += T * Bt, ke += T * k, Qe += T * U, tt += T * z, Ye += T * C, dt += T * G, lt += T * j, T = J[9], Me += T * kt, Ne += T * Ct, Ke += T * gt, Le += T * Rt, qe += T * Nt, ze += T * vt, _e += T * $t, Ze += T * Ft, at += T * rt, ke += T * Bt, Qe += T * k, tt += T * U, Ye += T * z, dt += T * C, lt += T * G, ct += T * j, T = J[10], Ne += T * kt, Ke += T * Ct, Le += T * gt, qe += T * Rt, ze += T * Nt, _e += T * vt, Ze += T * $t, at += T * Ft, ke += T * rt, Qe += T * Bt, tt += T * k, Ye += T * U, dt += T * z, lt += T * C, ct += T * G, qt += T * j, T = J[11], Ke += T * kt, Le += T * Ct, qe += T * gt, ze += T * Rt, _e += T * Nt, Ze += T * vt, at += T * $t, ke += T * Ft, Qe += T * rt, tt += T * Bt, Ye += T * k, dt += T * U, lt += T * z, ct += T * C, qt += T * G, Jt += T * j, T = J[12], Le += T * kt, qe += T * Ct, ze += T * gt, _e += T * Rt, Ze += T * Nt, at += T * vt, ke += T * $t, Qe += T * Ft, tt += T * rt, Ye += T * Bt, dt += T * k, lt += T * U, ct += T * z, qt += T * C, Jt += T * G, Et += T * j, T = J[13], qe += T * kt, ze += T * Ct, _e += T * gt, Ze += T * Rt, at += T * Nt, ke += T * vt, Qe += T * $t, tt += T * Ft, Ye += T * rt, dt += T * Bt, lt += T * k, ct += T * U, qt += T * z, Jt += T * C, Et += T * G, er += T * j, T = J[14], ze += T * kt, _e += T * Ct, Ze += T * gt, at += T * Rt, ke += T * Nt, Qe += T * vt, tt += T * $t, Ye += T * Ft, dt += T * rt, lt += T * Bt, ct += T * k, qt += T * U, Jt += T * z, Et += T * C, er += T * G, Xt += T * j, T = J[15], _e += T * kt, Ze += T * Ct, at += T * gt, ke += T * Rt, Qe += T * Nt, tt += T * vt, Ye += T * $t, dt += T * Ft, lt += T * rt, ct += T * Bt, qt += T * k, Jt += T * U, Et += T * z, er += T * C, Xt += T * G, Dt += T * j, re += 38 * Ze, pe += 38 * at, ie += 38 * ke, ue += 38 * Qe, ve += 38 * tt, Pe += 38 * Ye, De += 38 * dt, Ce += 38 * lt, $e += 38 * ct, Me += 38 * qt, Ne += 38 * Jt, Ke += 38 * Et, Le += 38 * er, qe += 38 * Xt, ze += 38 * Dt, X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = pe + X + 65535, X = Math.floor(T / 65536), pe = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = pe + X + 65535, X = Math.floor(T / 65536), pe = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), Z[0] = re, Z[1] = pe, Z[2] = ie, Z[3] = ue, Z[4] = ve, Z[5] = Pe, Z[6] = De, Z[7] = Ce, Z[8] = $e, Z[9] = Me, Z[10] = Ne, Z[11] = Ke, Z[12] = Le, Z[13] = qe, Z[14] = ze, Z[15] = _e; } - function W(Z, J) { + function K(Z, J) { R(Z, J, J); } - function pe(Z, J) { + function ge(Z, J) { const Q = i(); let T; for (T = 0; T < 16; T++) Q[T] = J[T]; for (T = 253; T >= 0; T--) - W(Q, Q), T !== 2 && T !== 4 && R(Q, Q, J); + K(Q, Q), T !== 2 && T !== 4 && R(Q, Q, J); for (T = 0; T < 16; T++) Z[T] = Q[T]; } @@ -7164,13 +7164,13 @@ var D4 = {}; for (T = 0; T < 16; T++) Q[T] = J[T]; for (T = 250; T >= 0; T--) - W(Q, Q), T !== 1 && R(Q, Q, J); + K(Q, Q), T !== 1 && R(Q, Q, J); for (T = 0; T < 16; T++) Z[T] = Q[T]; } function Y(Z, J) { - const Q = i(), T = i(), X = i(), re = i(), de = i(), ie = i(), ue = i(), ve = i(), Pe = i(); - te(Q, Z[1], Z[0]), te(Pe, J[1], J[0]), R(Q, Q, Pe), V(T, Z[0], Z[1]), V(Pe, J[0], J[1]), R(T, T, Pe), R(X, Z[3], J[3]), R(X, X, l), R(re, Z[2], J[2]), V(re, re, re), te(de, T, Q), te(ie, re, X), V(ue, re, X), V(ve, T, Q), R(Z[0], de, ie), R(Z[1], ve, ue), R(Z[2], ue, ie), R(Z[3], de, ve); + const Q = i(), T = i(), X = i(), re = i(), pe = i(), ie = i(), ue = i(), ve = i(), Pe = i(); + te(Q, Z[1], Z[0]), te(Pe, J[1], J[0]), R(Q, Q, Pe), V(T, Z[0], Z[1]), V(Pe, J[0], J[1]), R(T, T, Pe), R(X, Z[3], J[3]), R(X, X, l), R(re, Z[2], J[2]), V(re, re, re), te(pe, T, Q), te(ie, re, X), V(ue, re, X), V(ve, T, Q), R(Z[0], pe, ie), R(Z[1], ve, ue), R(Z[2], ue, ie), R(Z[3], pe, ve); } function S(Z, J, Q) { for (let T = 0; T < 4; T++) @@ -7178,7 +7178,7 @@ var D4 = {}; } function m(Z, J) { const Q = i(), T = i(), X = i(); - pe(X, J[2]), R(Q, J[0], X), R(T, J[1], X), L(Z, T), Z[31] ^= K(Q) << 7; + ge(X, J[2]), R(Q, J[0], X), R(T, J[1], X), L(Z, T), Z[31] ^= H(Q) << 7; } function f(Z, J, Q) { A(Z[0], o), A(Z[1], a), A(Z[2], a), A(Z[3], o); @@ -7187,9 +7187,9 @@ var D4 = {}; S(Z, J, X), Y(J, Z), Y(Z, Z), S(Z, J, X); } } - function p(Z, J) { + function g(Z, J) { const Q = [i(), i(), i(), i()]; - A(Q[0], d), A(Q[1], g), A(Q[2], a), R(Q[3], d, g), f(Z, Q, J); + A(Q[0], d), A(Q[1], p), A(Q[2], a), R(Q[3], d, p), f(Z, Q, J); } function b(Z) { if (Z.length !== t.SEED_LENGTH) @@ -7197,7 +7197,7 @@ var D4 = {}; const J = (0, r.hash)(Z); J[0] &= 248, J[31] &= 127, J[31] |= 64; const Q = new Uint8Array(32), T = [i(), i(), i(), i()]; - p(T, J), m(Q, T); + g(T, J), m(Q, T); const X = new Uint8Array(64); return X.set(Z), X.set(Q, 32), { publicKey: Q, @@ -7264,7 +7264,7 @@ var D4 = {}; for (T = 0; T < 32; T++) J[T + 1] += J[T] >> 8, Z[T] = J[T] & 255; } - function P(Z) { + function M(Z) { const J = new Float64Array(64); for (let Q = 0; Q < 64; Q++) J[Q] = Z[Q]; @@ -7277,12 +7277,12 @@ var D4 = {}; X[0] &= 248, X[31] &= 127, X[31] |= 64; const re = new Uint8Array(64); re.set(X.subarray(32), 32); - const de = new r.SHA512(); - de.update(re.subarray(32)), de.update(J); - const ie = de.digest(); - de.clean(), P(ie), p(T, ie), m(re, T), de.reset(), de.update(re.subarray(0, 32)), de.update(Z.subarray(32)), de.update(J); - const ue = de.digest(); - P(ue); + const pe = new r.SHA512(); + pe.update(re.subarray(32)), pe.update(J); + const ie = pe.digest(); + pe.clean(), M(ie), g(T, ie), m(re, T), pe.reset(), pe.update(re.subarray(0, 32)), pe.update(Z.subarray(32)), pe.update(J); + const ue = pe.digest(); + M(ue); for (let ve = 0; ve < 32; ve++) Q[ve] = ie[ve]; for (let ve = 0; ve < 32; ve++) @@ -7291,28 +7291,28 @@ var D4 = {}; return v(re.subarray(32), Q), re; } t.sign = I; - function B(Z, J) { - const Q = i(), T = i(), X = i(), re = i(), de = i(), ie = i(), ue = i(); - return A(Z[2], a), H(Z[1], J), W(X, Z[1]), R(re, X, u), te(X, X, Z[2]), V(re, Z[2], re), W(de, re), W(ie, de), R(ue, ie, de), R(Q, ue, X), R(Q, Q, re), Ee(Q, Q), R(Q, Q, X), R(Q, Q, re), R(Q, Q, re), R(Z[0], Q, re), W(T, Z[0]), R(T, T, re), F(T, X) && R(Z[0], Z[0], w), W(T, Z[0]), R(T, T, re), F(T, X) ? -1 : (K(Z[0]) === J[31] >> 7 && te(Z[0], o, Z[0]), R(Z[3], Z[0], Z[1]), 0); + function F(Z, J) { + const Q = i(), T = i(), X = i(), re = i(), pe = i(), ie = i(), ue = i(); + return A(Z[2], a), W(Z[1], J), K(X, Z[1]), R(re, X, u), te(X, X, Z[2]), V(re, Z[2], re), K(pe, re), K(ie, pe), R(ue, ie, pe), R(Q, ue, X), R(Q, Q, re), Ee(Q, Q), R(Q, Q, X), R(Q, Q, re), R(Q, Q, re), R(Z[0], Q, re), K(T, Z[0]), R(T, T, re), B(T, X) && R(Z[0], Z[0], w), K(T, Z[0]), R(T, T, re), B(T, X) ? -1 : (H(Z[0]) === J[31] >> 7 && te(Z[0], o, Z[0]), R(Z[3], Z[0], Z[1]), 0); } function ce(Z, J, Q) { const T = new Uint8Array(32), X = [i(), i(), i(), i()], re = [i(), i(), i(), i()]; if (Q.length !== t.SIGNATURE_LENGTH) throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`); - if (B(re, Z)) + if (F(re, Z)) return !1; - const de = new r.SHA512(); - de.update(Q.subarray(0, 32)), de.update(Z), de.update(J); - const ie = de.digest(); - return P(ie), f(X, re, ie), p(re, Q.subarray(32)), Y(X, re), m(T, X), !$(Q, T); + const pe = new r.SHA512(); + pe.update(Q.subarray(0, 32)), pe.update(Z), pe.update(J); + const ie = pe.digest(); + return M(ie), f(X, re, ie), g(re, Q.subarray(32)), Y(X, re), m(T, X), !$(Q, T); } t.verify = ce; function D(Z) { let J = [i(), i(), i(), i()]; - if (B(J, Z)) + if (F(J, Z)) throw new Error("Ed25519: invalid public key"); let Q = i(), T = i(), X = J[1]; - V(Q, a, X), te(T, a, X), pe(T, T), R(Q, Q, T); + V(Q, a, X), te(T, a, X), ge(T, T), R(Q, Q, T); let re = new Uint8Array(32); return L(re, Q), re; } @@ -7324,20 +7324,20 @@ var D4 = {}; return (0, n.wipe)(J), Q; } t.convertSecretKeyToX25519 = oe; -})(Fv); -const P$ = "EdDSA", M$ = "JWT", Qd = ".", U0 = "base64url", O4 = "utf8", N4 = "utf8", I$ = ":", C$ = "did", T$ = "key", ex = "base58btc", R$ = "z", D$ = "K36", O$ = 32; -function L4(t = 0) { +})(Bv); +const k$ = "EdDSA", $$ = "JWT", e0 = ".", U0 = "base64url", L4 = "utf8", k4 = "utf8", B$ = ":", F$ = "did", j$ = "key", rx = "base58btc", U$ = "z", q$ = "K36", z$ = 32; +function $4(t = 0) { return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); } -function Ed(t, e) { +function Sd(t, e) { e || (e = t.reduce((i, s) => i + s.length, 0)); - const r = L4(e); + const r = $4(e); let n = 0; for (const i of t) r.set(i, n), n += i.length; return r; } -function N$(t, e) { +function W$(t, e) { if (t.length >= 255) throw new TypeError("Alphabet too long"); for (var r = new Uint8Array(256), n = 0; n < r.length; n++) @@ -7349,68 +7349,68 @@ function N$(t, e) { r[o] = i; } var a = t.length, u = t.charAt(0), l = Math.log(a) / Math.log(256), d = Math.log(256) / Math.log(a); - function g(M) { - if (M instanceof Uint8Array || (ArrayBuffer.isView(M) ? M = new Uint8Array(M.buffer, M.byteOffset, M.byteLength) : Array.isArray(M) && (M = Uint8Array.from(M))), !(M instanceof Uint8Array)) + function p(P) { + if (P instanceof Uint8Array || (ArrayBuffer.isView(P) ? P = new Uint8Array(P.buffer, P.byteOffset, P.byteLength) : Array.isArray(P) && (P = Uint8Array.from(P))), !(P instanceof Uint8Array)) throw new TypeError("Expected Uint8Array"); - if (M.length === 0) + if (P.length === 0) return ""; - for (var N = 0, L = 0, $ = 0, F = M.length; $ !== F && M[$] === 0; ) + for (var N = 0, L = 0, $ = 0, B = P.length; $ !== B && P[$] === 0; ) $++, N++; - for (var K = (F - $) * d + 1 >>> 0, H = new Uint8Array(K); $ !== F; ) { - for (var V = M[$], te = 0, R = K - 1; (V !== 0 || te < L) && R !== -1; R--, te++) - V += 256 * H[R] >>> 0, H[R] = V % a >>> 0, V = V / a >>> 0; + for (var H = (B - $) * d + 1 >>> 0, W = new Uint8Array(H); $ !== B; ) { + for (var V = P[$], te = 0, R = H - 1; (V !== 0 || te < L) && R !== -1; R--, te++) + V += 256 * W[R] >>> 0, W[R] = V % a >>> 0, V = V / a >>> 0; if (V !== 0) throw new Error("Non-zero carry"); L = te, $++; } - for (var W = K - L; W !== K && H[W] === 0; ) - W++; - for (var pe = u.repeat(N); W < K; ++W) - pe += t.charAt(H[W]); - return pe; + for (var K = H - L; K !== H && W[K] === 0; ) + K++; + for (var ge = u.repeat(N); K < H; ++K) + ge += t.charAt(W[K]); + return ge; } - function w(M) { - if (typeof M != "string") + function w(P) { + if (typeof P != "string") throw new TypeError("Expected String"); - if (M.length === 0) + if (P.length === 0) return new Uint8Array(); var N = 0; - if (M[N] !== " ") { - for (var L = 0, $ = 0; M[N] === u; ) + if (P[N] !== " ") { + for (var L = 0, $ = 0; P[N] === u; ) L++, N++; - for (var F = (M.length - N) * l + 1 >>> 0, K = new Uint8Array(F); M[N]; ) { - var H = r[M.charCodeAt(N)]; - if (H === 255) + for (var B = (P.length - N) * l + 1 >>> 0, H = new Uint8Array(B); P[N]; ) { + var W = r[P.charCodeAt(N)]; + if (W === 255) return; - for (var V = 0, te = F - 1; (H !== 0 || V < $) && te !== -1; te--, V++) - H += a * K[te] >>> 0, K[te] = H % 256 >>> 0, H = H / 256 >>> 0; - if (H !== 0) + for (var V = 0, te = B - 1; (W !== 0 || V < $) && te !== -1; te--, V++) + W += a * H[te] >>> 0, H[te] = W % 256 >>> 0, W = W / 256 >>> 0; + if (W !== 0) throw new Error("Non-zero carry"); $ = V, N++; } - if (M[N] !== " ") { - for (var R = F - $; R !== F && K[R] === 0; ) + if (P[N] !== " ") { + for (var R = B - $; R !== B && H[R] === 0; ) R++; - for (var W = new Uint8Array(L + (F - R)), pe = L; R !== F; ) - W[pe++] = K[R++]; - return W; + for (var K = new Uint8Array(L + (B - R)), ge = L; R !== B; ) + K[ge++] = H[R++]; + return K; } } } - function A(M) { - var N = w(M); + function A(P) { + var N = w(P); if (N) return N; throw new Error(`Non-${e} character`); } return { - encode: g, + encode: p, decodeUnsafe: w, decode: A }; } -var L$ = N$, k$ = L$; -const $$ = (t) => { +var H$ = W$, K$ = H$; +const V$ = (t) => { if (t instanceof Uint8Array && t.constructor.name === "Uint8Array") return t; if (t instanceof ArrayBuffer) @@ -7418,8 +7418,8 @@ const $$ = (t) => { if (ArrayBuffer.isView(t)) return new Uint8Array(t.buffer, t.byteOffset, t.byteLength); throw new Error("Unknown type, must be binary type"); -}, F$ = (t) => new TextEncoder().encode(t), B$ = (t) => new TextDecoder().decode(t); -class U$ { +}, G$ = (t) => new TextEncoder().encode(t), Y$ = (t) => new TextDecoder().decode(t); +class J$ { constructor(e, r, n) { this.name = e, this.prefix = r, this.baseEncode = n; } @@ -7429,7 +7429,7 @@ class U$ { throw Error("Unknown type, must be binary type"); } } -class j$ { +class X$ { constructor(e, r, n) { if (this.name = e, this.prefix = r, r.codePointAt(0) === void 0) throw new Error("Invalid prefix character"); @@ -7444,15 +7444,15 @@ class j$ { throw Error("Can only multibase decode strings"); } or(e) { - return k4(this, e); + return B4(this, e); } } -class q$ { +class Z$ { constructor(e) { this.decoders = e; } or(e) { - return k4(this, e); + return B4(this, e); } decode(e) { const r = e[0], n = this.decoders[r]; @@ -7461,13 +7461,13 @@ class q$ { throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`); } } -const k4 = (t, e) => new q$({ +const B4 = (t, e) => new Z$({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); -class z$ { +class Q$ { constructor(e, r, n, i) { - this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new U$(e, r, n), this.decoder = new j$(e, r, i); + this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new J$(e, r, n), this.decoder = new X$(e, r, i); } encode(e) { return this.encoder.encode(e); @@ -7476,15 +7476,15 @@ class z$ { return this.decoder.decode(e); } } -const j0 = ({ name: t, prefix: e, encode: r, decode: n }) => new z$(t, e, r, n), Hl = ({ prefix: t, name: e, alphabet: r }) => { - const { encode: n, decode: i } = k$(r, e); - return j0({ +const q0 = ({ name: t, prefix: e, encode: r, decode: n }) => new Q$(t, e, r, n), Hl = ({ prefix: t, name: e, alphabet: r }) => { + const { encode: n, decode: i } = K$(r, e); + return q0({ prefix: t, name: e, encode: n, - decode: (s) => $$(i(s)) + decode: (s) => V$(i(s)) }); -}, H$ = (t, e, r, n) => { +}, eB = (t, e, r, n) => { const i = {}; for (let d = 0; d < e.length; ++d) i[e[d]] = d; @@ -7494,15 +7494,15 @@ const j0 = ({ name: t, prefix: e, encode: r, decode: n }) => new z$(t, e, r, n), const o = new Uint8Array(s * r / 8 | 0); let a = 0, u = 0, l = 0; for (let d = 0; d < s; ++d) { - const g = i[t[d]]; - if (g === void 0) + const p = i[t[d]]; + if (p === void 0) throw new SyntaxError(`Non-${n} character`); - u = u << r | g, a += r, a >= 8 && (a -= 8, o[l++] = 255 & u >> a); + u = u << r | p, a += r, a >= 8 && (a -= 8, o[l++] = 255 & u >> a); } if (a >= r || 255 & u << 8 - a) throw new SyntaxError("Unexpected end of data"); return o; -}, W$ = (t, e, r) => { +}, tB = (t, e, r) => { const n = e[e.length - 1] === "=", i = (1 << r) - 1; let s = "", o = 0, a = 0; for (let u = 0; u < t.length; ++u) @@ -7512,204 +7512,204 @@ const j0 = ({ name: t, prefix: e, encode: r, decode: n }) => new z$(t, e, r, n), for (; s.length * r & 7; ) s += "="; return s; -}, jn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => j0({ +}, qn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => q0({ prefix: e, name: t, encode(i) { - return W$(i, n, r); + return tB(i, n, r); }, decode(i) { - return H$(i, n, r, t); + return eB(i, n, r, t); } -}), K$ = j0({ +}), rB = q0({ prefix: "\0", name: "identity", - encode: (t) => B$(t), - decode: (t) => F$(t) -}), V$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + encode: (t) => Y$(t), + decode: (t) => G$(t) +}), nB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - identity: K$ -}, Symbol.toStringTag, { value: "Module" })), G$ = jn({ + identity: rB +}, Symbol.toStringTag, { value: "Module" })), iB = qn({ prefix: "0", name: "base2", alphabet: "01", bitsPerChar: 1 -}), Y$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), sB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base2: G$ -}, Symbol.toStringTag, { value: "Module" })), J$ = jn({ + base2: iB +}, Symbol.toStringTag, { value: "Module" })), oB = qn({ prefix: "7", name: "base8", alphabet: "01234567", bitsPerChar: 3 -}), X$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), aB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base8: J$ -}, Symbol.toStringTag, { value: "Module" })), Z$ = Hl({ + base8: oB +}, Symbol.toStringTag, { value: "Module" })), cB = Hl({ prefix: "9", name: "base10", alphabet: "0123456789" -}), Q$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), uB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base10: Z$ -}, Symbol.toStringTag, { value: "Module" })), eF = jn({ + base10: cB +}, Symbol.toStringTag, { value: "Module" })), fB = qn({ prefix: "f", name: "base16", alphabet: "0123456789abcdef", bitsPerChar: 4 -}), tF = jn({ +}), lB = qn({ prefix: "F", name: "base16upper", alphabet: "0123456789ABCDEF", bitsPerChar: 4 -}), rF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), hB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base16: eF, - base16upper: tF -}, Symbol.toStringTag, { value: "Module" })), nF = jn({ + base16: fB, + base16upper: lB +}, Symbol.toStringTag, { value: "Module" })), dB = qn({ prefix: "b", name: "base32", alphabet: "abcdefghijklmnopqrstuvwxyz234567", bitsPerChar: 5 -}), iF = jn({ +}), pB = qn({ prefix: "B", name: "base32upper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", bitsPerChar: 5 -}), sF = jn({ +}), gB = qn({ prefix: "c", name: "base32pad", alphabet: "abcdefghijklmnopqrstuvwxyz234567=", bitsPerChar: 5 -}), oF = jn({ +}), mB = qn({ prefix: "C", name: "base32padupper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", bitsPerChar: 5 -}), aF = jn({ +}), vB = qn({ prefix: "v", name: "base32hex", alphabet: "0123456789abcdefghijklmnopqrstuv", bitsPerChar: 5 -}), cF = jn({ +}), bB = qn({ prefix: "V", name: "base32hexupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", bitsPerChar: 5 -}), uF = jn({ +}), yB = qn({ prefix: "t", name: "base32hexpad", alphabet: "0123456789abcdefghijklmnopqrstuv=", bitsPerChar: 5 -}), fF = jn({ +}), wB = qn({ prefix: "T", name: "base32hexpadupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=", bitsPerChar: 5 -}), lF = jn({ +}), xB = qn({ prefix: "h", name: "base32z", alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769", bitsPerChar: 5 -}), hF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), _B = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base32: nF, - base32hex: aF, - base32hexpad: uF, - base32hexpadupper: fF, - base32hexupper: cF, - base32pad: sF, - base32padupper: oF, - base32upper: iF, - base32z: lF -}, Symbol.toStringTag, { value: "Module" })), dF = Hl({ + base32: dB, + base32hex: vB, + base32hexpad: yB, + base32hexpadupper: wB, + base32hexupper: bB, + base32pad: gB, + base32padupper: mB, + base32upper: pB, + base32z: xB +}, Symbol.toStringTag, { value: "Module" })), EB = Hl({ prefix: "k", name: "base36", alphabet: "0123456789abcdefghijklmnopqrstuvwxyz" -}), pF = Hl({ +}), SB = Hl({ prefix: "K", name: "base36upper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" -}), gF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), AB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base36: dF, - base36upper: pF -}, Symbol.toStringTag, { value: "Module" })), mF = Hl({ + base36: EB, + base36upper: SB +}, Symbol.toStringTag, { value: "Module" })), PB = Hl({ name: "base58btc", prefix: "z", alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" -}), vF = Hl({ +}), MB = Hl({ name: "base58flickr", prefix: "Z", alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" -}), bF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), IB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base58btc: mF, - base58flickr: vF -}, Symbol.toStringTag, { value: "Module" })), yF = jn({ + base58btc: PB, + base58flickr: MB +}, Symbol.toStringTag, { value: "Module" })), CB = qn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 -}), wF = jn({ +}), TB = qn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 -}), xF = jn({ +}), RB = qn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 -}), _F = jn({ +}), DB = qn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", bitsPerChar: 6 -}), EF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), OB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base64: yF, - base64pad: wF, - base64url: xF, - base64urlpad: _F -}, Symbol.toStringTag, { value: "Module" })), $4 = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), SF = $4.reduce((t, e, r) => (t[r] = e, t), []), AF = $4.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); -function PF(t) { - return t.reduce((e, r) => (e += SF[r], e), ""); + base64: CB, + base64pad: TB, + base64url: RB, + base64urlpad: DB +}, Symbol.toStringTag, { value: "Module" })), F4 = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), NB = F4.reduce((t, e, r) => (t[r] = e, t), []), LB = F4.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); +function kB(t) { + return t.reduce((e, r) => (e += NB[r], e), ""); } -function MF(t) { +function $B(t) { const e = []; for (const r of t) { - const n = AF[r.codePointAt(0)]; + const n = LB[r.codePointAt(0)]; if (n === void 0) throw new Error(`Non-base256emoji character: ${r}`); e.push(n); } return new Uint8Array(e); } -const IF = j0({ +const BB = q0({ prefix: "🚀", name: "base256emoji", - encode: PF, - decode: MF -}), CF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + encode: kB, + decode: $B +}), FB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base256emoji: IF + base256emoji: BB }, Symbol.toStringTag, { value: "Module" })); new TextEncoder(); new TextDecoder(); -const tx = { - ...V$, - ...Y$, - ...X$, - ...Q$, - ...rF, - ...hF, - ...gF, - ...bF, - ...EF, - ...CF -}; -function F4(t, e, r, n) { +const nx = { + ...nB, + ...sB, + ...aB, + ...uB, + ...hB, + ..._B, + ...AB, + ...IB, + ...OB, + ...FB +}; +function j4(t, e, r, n) { return { name: t, prefix: e, @@ -7721,80 +7721,80 @@ function F4(t, e, r, n) { decoder: { decode: n } }; } -const rx = F4("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), Xg = F4("ascii", "a", (t) => { +const ix = j4("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), Xg = j4("ascii", "a", (t) => { let e = "a"; for (let r = 0; r < t.length; r++) e += String.fromCharCode(t[r]); return e; }, (t) => { t = t.substring(1); - const e = L4(t.length); + const e = $4(t.length); for (let r = 0; r < t.length; r++) e[r] = t.charCodeAt(r); return e; -}), B4 = { - utf8: rx, - "utf-8": rx, - hex: tx.base16, +}), U4 = { + utf8: ix, + "utf-8": ix, + hex: nx.base16, latin1: Xg, ascii: Xg, binary: Xg, - ...tx + ...nx }; -function Dn(t, e = "utf8") { - const r = B4[e]; +function On(t, e = "utf8") { + const r = U4[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t.buffer, t.byteOffset, t.byteLength).toString("utf8") : r.encoder.encode(t).substring(1); } function Rn(t, e = "utf8") { - const r = B4[e]; + const r = U4[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t, "utf8") : r.decoder.decode(`${r.prefix}${t}`); } -function nx(t) { - return uc(Dn(Rn(t, U0), O4)); +function sx(t) { + return lc(On(Rn(t, U0), L4)); } -function e0(t) { - return Dn(Rn(ko(t), O4), U0); +function t0(t) { + return On(Rn(Bo(t), L4), U0); } -function U4(t) { - const e = Rn(D$, ex), r = R$ + Dn(Ed([e, t]), ex); - return [C$, T$, r].join(I$); +function q4(t) { + const e = Rn(q$, rx), r = U$ + On(Sd([e, t]), rx); + return [F$, j$, r].join(B$); } -function TF(t) { - return Dn(t, U0); +function jB(t) { + return On(t, U0); } -function RF(t) { +function UB(t) { return Rn(t, U0); } -function DF(t) { - return Rn([e0(t.header), e0(t.payload)].join(Qd), N4); +function qB(t) { + return Rn([t0(t.header), t0(t.payload)].join(e0), k4); } -function OF(t) { +function zB(t) { return [ - e0(t.header), - e0(t.payload), - TF(t.signature) - ].join(Qd); + t0(t.header), + t0(t.payload), + jB(t.signature) + ].join(e0); } function v1(t) { - const e = t.split(Qd), r = nx(e[0]), n = nx(e[1]), i = RF(e[2]), s = Rn(e.slice(0, 2).join(Qd), N4); + const e = t.split(e0), r = sx(e[0]), n = sx(e[1]), i = UB(e[2]), s = Rn(e.slice(0, 2).join(e0), k4); return { header: r, payload: n, signature: i, data: s }; } -function ix(t = Pa.randomBytes(O$)) { - return Fv.generateKeyPairFromSeed(t); +function ox(t = Ca.randomBytes(z$)) { + return Bv.generateKeyPairFromSeed(t); } -async function NF(t, e, r, n, i = mt.fromMiliseconds(Date.now())) { - const s = { alg: P$, typ: M$ }, o = U4(n.publicKey), a = i + r, u = { iss: o, sub: t, aud: e, iat: i, exp: a }, l = DF({ header: s, payload: u }), d = Fv.sign(n.secretKey, l); - return OF({ header: s, payload: u, signature: d }); +async function WB(t, e, r, n, i = mt.fromMiliseconds(Date.now())) { + const s = { alg: k$, typ: $$ }, o = q4(n.publicKey), a = i + r, u = { iss: o, sub: t, aud: e, iat: i, exp: a }, l = qB({ header: s, payload: u }), d = Bv.sign(n.secretKey, l); + return zB({ header: s, payload: u, signature: d }); } -var sx = function(t, e, r) { +var ax = function(t, e, r) { if (r || arguments.length === 2) for (var n = 0, i = e.length, s; n < i; n++) (s || !(n in e)) && (s || (s = Array.prototype.slice.call(e, 0, n)), s[n] = e[n]); return t.concat(s || Array.prototype.slice.call(e)); -}, LF = ( +}, HB = ( /** @class */ /* @__PURE__ */ function() { function t(e, r, n) { @@ -7802,7 +7802,7 @@ var sx = function(t, e, r) { } return t; }() -), kF = ( +), KB = ( /** @class */ /* @__PURE__ */ function() { function t(e) { @@ -7810,7 +7810,7 @@ var sx = function(t, e, r) { } return t; }() -), $F = ( +), VB = ( /** @class */ /* @__PURE__ */ function() { function t(e, r, n, i) { @@ -7818,7 +7818,7 @@ var sx = function(t, e, r) { } return t; }() -), FF = ( +), GB = ( /** @class */ /* @__PURE__ */ function() { function t() { @@ -7826,7 +7826,7 @@ var sx = function(t, e, r) { } return t; }() -), BF = ( +), YB = ( /** @class */ /* @__PURE__ */ function() { function t() { @@ -7834,7 +7834,7 @@ var sx = function(t, e, r) { } return t; }() -), UF = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/, jF = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, ox = 3, qF = [ +), JB = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/, XB = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, cx = 3, ZB = [ ["aol", /AOLShield\/([0-9\._]+)/], ["edge", /Edge\/([0-9\._]+)/], ["edge-ios", /EdgiOS\/([0-9\._]+)/], @@ -7872,8 +7872,8 @@ var sx = function(t, e, r) { ["ios-webview", /AppleWebKit\/([0-9\.]+).*Mobile/], ["ios-webview", /AppleWebKit\/([0-9\.]+).*Gecko\)$/], ["curl", /^curl\/([0-9\.]+)$/], - ["searchbot", UF] -], ax = [ + ["searchbot", JB] +], ux = [ ["iOS", /iP(hone|od|ad)/], ["Android OS", /Android/], ["BlackBerry OS", /BlackBerry|BB10/], @@ -7901,11 +7901,11 @@ var sx = function(t, e, r) { ["BeOS", /BeOS/], ["OS/2", /OS\/2/] ]; -function zF(t) { - return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative" ? new BF() : typeof navigator < "u" ? WF(navigator.userAgent) : VF(); +function QB(t) { + return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative" ? new YB() : typeof navigator < "u" ? tF(navigator.userAgent) : nF(); } -function HF(t) { - return t !== "" && qF.reduce(function(e, r) { +function eF(t) { + return t !== "" && ZB.reduce(function(e, r) { var n = r[0], i = r[1]; if (e) return e; @@ -7913,117 +7913,117 @@ function HF(t) { return !!s && [n, s]; }, !1); } -function WF(t) { - var e = HF(t); +function tF(t) { + var e = eF(t); if (!e) return null; var r = e[0], n = e[1]; if (r === "searchbot") - return new FF(); + return new GB(); var i = n[1] && n[1].split(".").join("_").split("_").slice(0, 3); - i ? i.length < ox && (i = sx(sx([], i, !0), GF(ox - i.length), !0)) : i = []; - var s = i.join("."), o = KF(t), a = jF.exec(t); - return a && a[1] ? new $F(r, s, o, a[1]) : new LF(r, s, o); + i ? i.length < cx && (i = ax(ax([], i, !0), iF(cx - i.length), !0)) : i = []; + var s = i.join("."), o = rF(t), a = XB.exec(t); + return a && a[1] ? new VB(r, s, o, a[1]) : new HB(r, s, o); } -function KF(t) { - for (var e = 0, r = ax.length; e < r; e++) { - var n = ax[e], i = n[0], s = n[1], o = s.exec(t); +function rF(t) { + for (var e = 0, r = ux.length; e < r; e++) { + var n = ux[e], i = n[0], s = n[1], o = s.exec(t); if (o) return i; } return null; } -function VF() { +function nF() { var t = typeof process < "u" && process.version; - return t ? new kF(process.version.slice(1)) : null; + return t ? new KB(process.version.slice(1)) : null; } -function GF(t) { +function iF(t) { for (var e = [], r = 0; r < t; r++) e.push("0"); return e; } -var Hr = {}; -Object.defineProperty(Hr, "__esModule", { value: !0 }); -Hr.getLocalStorage = Hr.getLocalStorageOrThrow = Hr.getCrypto = Hr.getCryptoOrThrow = j4 = Hr.getLocation = Hr.getLocationOrThrow = Bv = Hr.getNavigator = Hr.getNavigatorOrThrow = Wl = Hr.getDocument = Hr.getDocumentOrThrow = Hr.getFromWindowOrThrow = Hr.getFromWindow = void 0; -function bc(t) { +var Wr = {}; +Object.defineProperty(Wr, "__esModule", { value: !0 }); +Wr.getLocalStorage = Wr.getLocalStorageOrThrow = Wr.getCrypto = Wr.getCryptoOrThrow = z4 = Wr.getLocation = Wr.getLocationOrThrow = Fv = Wr.getNavigator = Wr.getNavigatorOrThrow = Kl = Wr.getDocument = Wr.getDocumentOrThrow = Wr.getFromWindowOrThrow = Wr.getFromWindow = void 0; +function yc(t) { let e; return typeof window < "u" && typeof window[t] < "u" && (e = window[t]), e; } -Hr.getFromWindow = bc; -function Ou(t) { - const e = bc(t); +Wr.getFromWindow = yc; +function Nu(t) { + const e = yc(t); if (!e) throw new Error(`${t} is not defined in Window`); return e; } -Hr.getFromWindowOrThrow = Ou; -function YF() { - return Ou("document"); +Wr.getFromWindowOrThrow = Nu; +function sF() { + return Nu("document"); } -Hr.getDocumentOrThrow = YF; -function JF() { - return bc("document"); +Wr.getDocumentOrThrow = sF; +function oF() { + return yc("document"); } -var Wl = Hr.getDocument = JF; -function XF() { - return Ou("navigator"); +var Kl = Wr.getDocument = oF; +function aF() { + return Nu("navigator"); } -Hr.getNavigatorOrThrow = XF; -function ZF() { - return bc("navigator"); +Wr.getNavigatorOrThrow = aF; +function cF() { + return yc("navigator"); } -var Bv = Hr.getNavigator = ZF; -function QF() { - return Ou("location"); +var Fv = Wr.getNavigator = cF; +function uF() { + return Nu("location"); } -Hr.getLocationOrThrow = QF; -function eB() { - return bc("location"); +Wr.getLocationOrThrow = uF; +function fF() { + return yc("location"); } -var j4 = Hr.getLocation = eB; -function tB() { - return Ou("crypto"); +var z4 = Wr.getLocation = fF; +function lF() { + return Nu("crypto"); } -Hr.getCryptoOrThrow = tB; -function rB() { - return bc("crypto"); +Wr.getCryptoOrThrow = lF; +function hF() { + return yc("crypto"); } -Hr.getCrypto = rB; -function nB() { - return Ou("localStorage"); +Wr.getCrypto = hF; +function dF() { + return Nu("localStorage"); } -Hr.getLocalStorageOrThrow = nB; -function iB() { - return bc("localStorage"); +Wr.getLocalStorageOrThrow = dF; +function pF() { + return yc("localStorage"); } -Hr.getLocalStorage = iB; -var Uv = {}; -Object.defineProperty(Uv, "__esModule", { value: !0 }); -var q4 = Uv.getWindowMetadata = void 0; -const cx = Hr; -function sB() { +Wr.getLocalStorage = pF; +var jv = {}; +Object.defineProperty(jv, "__esModule", { value: !0 }); +var W4 = jv.getWindowMetadata = void 0; +const fx = Wr; +function gF() { let t, e; try { - t = cx.getDocumentOrThrow(), e = cx.getLocationOrThrow(); + t = fx.getDocumentOrThrow(), e = fx.getLocationOrThrow(); } catch { return null; } function r() { - const g = t.getElementsByTagName("link"), w = []; - for (let A = 0; A < g.length; A++) { - const M = g[A], N = M.getAttribute("rel"); + const p = t.getElementsByTagName("link"), w = []; + for (let A = 0; A < p.length; A++) { + const P = p[A], N = P.getAttribute("rel"); if (N && N.toLowerCase().indexOf("icon") > -1) { - const L = M.getAttribute("href"); + const L = P.getAttribute("href"); if (L) if (L.toLowerCase().indexOf("https:") === -1 && L.toLowerCase().indexOf("http:") === -1 && L.indexOf("//") !== 0) { let $ = e.protocol + "//" + e.host; if (L.indexOf("/") === 0) $ += L; else { - const F = e.pathname.split("/"); - F.pop(); - const K = F.join("/"); - $ += K + "/" + L; + const B = e.pathname.split("/"); + B.pop(); + const H = B.join("/"); + $ += H + "/" + L; } w.push($); } else if (L.indexOf("//") === 0) { @@ -8035,12 +8035,12 @@ function sB() { } return w; } - function n(...g) { + function n(...p) { const w = t.getElementsByTagName("meta"); for (let A = 0; A < w.length; A++) { - const M = w[A], N = ["itemprop", "property", "name"].map((L) => M.getAttribute(L)).filter((L) => L ? g.includes(L) : !1); + const P = w[A], N = ["itemprop", "property", "name"].map((L) => P.getAttribute(L)).filter((L) => L ? p.includes(L) : !1); if (N.length && N) { - const L = M.getAttribute("content"); + const L = P.getAttribute("content"); if (L) return L; } @@ -8048,8 +8048,8 @@ function sB() { return ""; } function i() { - let g = n("name", "og:site_name", "og:title", "twitter:title"); - return g || (g = t.title), g; + let p = n("name", "og:site_name", "og:title", "twitter:title"); + return p || (p = t.title), p; } function s() { return n("description", "og:description", "twitter:description", "keywords"); @@ -8062,8 +8062,8 @@ function sB() { name: o }; } -q4 = Uv.getWindowMetadata = sB; -var wl = {}, oB = (t) => encodeURIComponent(t).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), z4 = "%[a-f0-9]{2}", ux = new RegExp("(" + z4 + ")|([^%]+?)", "gi"), fx = new RegExp("(" + z4 + ")+", "gi"); +W4 = jv.getWindowMetadata = gF; +var xl = {}, mF = (t) => encodeURIComponent(t).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), H4 = "%[a-f0-9]{2}", lx = new RegExp("(" + H4 + ")|([^%]+?)", "gi"), hx = new RegExp("(" + H4 + ")+", "gi"); function b1(t, e) { try { return [decodeURIComponent(t.join(""))]; @@ -8075,27 +8075,27 @@ function b1(t, e) { var r = t.slice(0, e), n = t.slice(e); return Array.prototype.concat.call([], b1(r), b1(n)); } -function aB(t) { +function vF(t) { try { return decodeURIComponent(t); } catch { - for (var e = t.match(ux) || [], r = 1; r < e.length; r++) - t = b1(e, r).join(""), e = t.match(ux) || []; + for (var e = t.match(lx) || [], r = 1; r < e.length; r++) + t = b1(e, r).join(""), e = t.match(lx) || []; return t; } } -function cB(t) { +function bF(t) { for (var e = { "%FE%FF": "��", "%FF%FE": "��" - }, r = fx.exec(t); r; ) { + }, r = hx.exec(t); r; ) { try { e[r[0]] = decodeURIComponent(r[0]); } catch { - var n = aB(r[0]); + var n = vF(r[0]); n !== r[0] && (e[r[0]] = n); } - r = fx.exec(t); + r = hx.exec(t); } e["%C2"] = "�"; for (var i = Object.keys(e), s = 0; s < i.length; s++) { @@ -8104,15 +8104,15 @@ function cB(t) { } return t; } -var uB = function(t) { +var yF = function(t) { if (typeof t != "string") throw new TypeError("Expected `encodedURI` to be of type `string`, got `" + typeof t + "`"); try { return t = t.replace(/\+/g, " "), decodeURIComponent(t); } catch { - return cB(t); + return bF(t); } -}, fB = (t, e) => { +}, wF = (t, e) => { if (!(typeof t == "string" && typeof e == "string")) throw new TypeError("Expected the arguments to be of type `string`"); if (e === "") @@ -8122,7 +8122,7 @@ var uB = function(t) { t.slice(0, r), t.slice(r + e.length) ]; -}, lB = function(t, e) { +}, xF = function(t, e) { for (var r = {}, n = Object.keys(t), i = Array.isArray(e), s = 0; s < n.length; s++) { var o = n[s], a = t[o]; (i ? e.indexOf(o) !== -1 : e(o, a, t)) && (r[o] = a); @@ -8130,216 +8130,216 @@ var uB = function(t) { return r; }; (function(t) { - const e = oB, r = uB, n = fB, i = lB, s = (F) => F == null, o = Symbol("encodeFragmentIdentifier"); - function a(F) { - switch (F.arrayFormat) { + const e = mF, r = yF, n = wF, i = xF, s = (B) => B == null, o = Symbol("encodeFragmentIdentifier"); + function a(B) { + switch (B.arrayFormat) { case "index": - return (K) => (H, V) => { - const te = H.length; - return V === void 0 || F.skipNull && V === null || F.skipEmptyString && V === "" ? H : V === null ? [...H, [d(K, F), "[", te, "]"].join("")] : [ - ...H, - [d(K, F), "[", d(te, F), "]=", d(V, F)].join("") + return (H) => (W, V) => { + const te = W.length; + return V === void 0 || B.skipNull && V === null || B.skipEmptyString && V === "" ? W : V === null ? [...W, [d(H, B), "[", te, "]"].join("")] : [ + ...W, + [d(H, B), "[", d(te, B), "]=", d(V, B)].join("") ]; }; case "bracket": - return (K) => (H, V) => V === void 0 || F.skipNull && V === null || F.skipEmptyString && V === "" ? H : V === null ? [...H, [d(K, F), "[]"].join("")] : [...H, [d(K, F), "[]=", d(V, F)].join("")]; + return (H) => (W, V) => V === void 0 || B.skipNull && V === null || B.skipEmptyString && V === "" ? W : V === null ? [...W, [d(H, B), "[]"].join("")] : [...W, [d(H, B), "[]=", d(V, B)].join("")]; case "colon-list-separator": - return (K) => (H, V) => V === void 0 || F.skipNull && V === null || F.skipEmptyString && V === "" ? H : V === null ? [...H, [d(K, F), ":list="].join("")] : [...H, [d(K, F), ":list=", d(V, F)].join("")]; + return (H) => (W, V) => V === void 0 || B.skipNull && V === null || B.skipEmptyString && V === "" ? W : V === null ? [...W, [d(H, B), ":list="].join("")] : [...W, [d(H, B), ":list=", d(V, B)].join("")]; case "comma": case "separator": case "bracket-separator": { - const K = F.arrayFormat === "bracket-separator" ? "[]=" : "="; - return (H) => (V, te) => te === void 0 || F.skipNull && te === null || F.skipEmptyString && te === "" ? V : (te = te === null ? "" : te, V.length === 0 ? [[d(H, F), K, d(te, F)].join("")] : [[V, d(te, F)].join(F.arrayFormatSeparator)]); + const H = B.arrayFormat === "bracket-separator" ? "[]=" : "="; + return (W) => (V, te) => te === void 0 || B.skipNull && te === null || B.skipEmptyString && te === "" ? V : (te = te === null ? "" : te, V.length === 0 ? [[d(W, B), H, d(te, B)].join("")] : [[V, d(te, B)].join(B.arrayFormatSeparator)]); } default: - return (K) => (H, V) => V === void 0 || F.skipNull && V === null || F.skipEmptyString && V === "" ? H : V === null ? [...H, d(K, F)] : [...H, [d(K, F), "=", d(V, F)].join("")]; + return (H) => (W, V) => V === void 0 || B.skipNull && V === null || B.skipEmptyString && V === "" ? W : V === null ? [...W, d(H, B)] : [...W, [d(H, B), "=", d(V, B)].join("")]; } } - function u(F) { - let K; - switch (F.arrayFormat) { + function u(B) { + let H; + switch (B.arrayFormat) { case "index": - return (H, V, te) => { - if (K = /\[(\d*)\]$/.exec(H), H = H.replace(/\[\d*\]$/, ""), !K) { - te[H] = V; + return (W, V, te) => { + if (H = /\[(\d*)\]$/.exec(W), W = W.replace(/\[\d*\]$/, ""), !H) { + te[W] = V; return; } - te[H] === void 0 && (te[H] = {}), te[H][K[1]] = V; + te[W] === void 0 && (te[W] = {}), te[W][H[1]] = V; }; case "bracket": - return (H, V, te) => { - if (K = /(\[\])$/.exec(H), H = H.replace(/\[\]$/, ""), !K) { - te[H] = V; + return (W, V, te) => { + if (H = /(\[\])$/.exec(W), W = W.replace(/\[\]$/, ""), !H) { + te[W] = V; return; } - if (te[H] === void 0) { - te[H] = [V]; + if (te[W] === void 0) { + te[W] = [V]; return; } - te[H] = [].concat(te[H], V); + te[W] = [].concat(te[W], V); }; case "colon-list-separator": - return (H, V, te) => { - if (K = /(:list)$/.exec(H), H = H.replace(/:list$/, ""), !K) { - te[H] = V; + return (W, V, te) => { + if (H = /(:list)$/.exec(W), W = W.replace(/:list$/, ""), !H) { + te[W] = V; return; } - if (te[H] === void 0) { - te[H] = [V]; + if (te[W] === void 0) { + te[W] = [V]; return; } - te[H] = [].concat(te[H], V); + te[W] = [].concat(te[W], V); }; case "comma": case "separator": - return (H, V, te) => { - const R = typeof V == "string" && V.includes(F.arrayFormatSeparator), W = typeof V == "string" && !R && g(V, F).includes(F.arrayFormatSeparator); - V = W ? g(V, F) : V; - const pe = R || W ? V.split(F.arrayFormatSeparator).map((Ee) => g(Ee, F)) : V === null ? V : g(V, F); - te[H] = pe; + return (W, V, te) => { + const R = typeof V == "string" && V.includes(B.arrayFormatSeparator), K = typeof V == "string" && !R && p(V, B).includes(B.arrayFormatSeparator); + V = K ? p(V, B) : V; + const ge = R || K ? V.split(B.arrayFormatSeparator).map((Ee) => p(Ee, B)) : V === null ? V : p(V, B); + te[W] = ge; }; case "bracket-separator": - return (H, V, te) => { - const R = /(\[\])$/.test(H); - if (H = H.replace(/\[\]$/, ""), !R) { - te[H] = V && g(V, F); + return (W, V, te) => { + const R = /(\[\])$/.test(W); + if (W = W.replace(/\[\]$/, ""), !R) { + te[W] = V && p(V, B); return; } - const W = V === null ? [] : V.split(F.arrayFormatSeparator).map((pe) => g(pe, F)); - if (te[H] === void 0) { - te[H] = W; + const K = V === null ? [] : V.split(B.arrayFormatSeparator).map((ge) => p(ge, B)); + if (te[W] === void 0) { + te[W] = K; return; } - te[H] = [].concat(te[H], W); + te[W] = [].concat(te[W], K); }; default: - return (H, V, te) => { - if (te[H] === void 0) { - te[H] = V; + return (W, V, te) => { + if (te[W] === void 0) { + te[W] = V; return; } - te[H] = [].concat(te[H], V); + te[W] = [].concat(te[W], V); }; } } - function l(F) { - if (typeof F != "string" || F.length !== 1) + function l(B) { + if (typeof B != "string" || B.length !== 1) throw new TypeError("arrayFormatSeparator must be single character string"); } - function d(F, K) { - return K.encode ? K.strict ? e(F) : encodeURIComponent(F) : F; + function d(B, H) { + return H.encode ? H.strict ? e(B) : encodeURIComponent(B) : B; } - function g(F, K) { - return K.decode ? r(F) : F; + function p(B, H) { + return H.decode ? r(B) : B; } - function w(F) { - return Array.isArray(F) ? F.sort() : typeof F == "object" ? w(Object.keys(F)).sort((K, H) => Number(K) - Number(H)).map((K) => F[K]) : F; + function w(B) { + return Array.isArray(B) ? B.sort() : typeof B == "object" ? w(Object.keys(B)).sort((H, W) => Number(H) - Number(W)).map((H) => B[H]) : B; } - function A(F) { - const K = F.indexOf("#"); - return K !== -1 && (F = F.slice(0, K)), F; + function A(B) { + const H = B.indexOf("#"); + return H !== -1 && (B = B.slice(0, H)), B; } - function M(F) { - let K = ""; - const H = F.indexOf("#"); - return H !== -1 && (K = F.slice(H)), K; + function P(B) { + let H = ""; + const W = B.indexOf("#"); + return W !== -1 && (H = B.slice(W)), H; } - function N(F) { - F = A(F); - const K = F.indexOf("?"); - return K === -1 ? "" : F.slice(K + 1); + function N(B) { + B = A(B); + const H = B.indexOf("?"); + return H === -1 ? "" : B.slice(H + 1); } - function L(F, K) { - return K.parseNumbers && !Number.isNaN(Number(F)) && typeof F == "string" && F.trim() !== "" ? F = Number(F) : K.parseBooleans && F !== null && (F.toLowerCase() === "true" || F.toLowerCase() === "false") && (F = F.toLowerCase() === "true"), F; + function L(B, H) { + return H.parseNumbers && !Number.isNaN(Number(B)) && typeof B == "string" && B.trim() !== "" ? B = Number(B) : H.parseBooleans && B !== null && (B.toLowerCase() === "true" || B.toLowerCase() === "false") && (B = B.toLowerCase() === "true"), B; } - function $(F, K) { - K = Object.assign({ + function $(B, H) { + H = Object.assign({ decode: !0, sort: !0, arrayFormat: "none", arrayFormatSeparator: ",", parseNumbers: !1, parseBooleans: !1 - }, K), l(K.arrayFormatSeparator); - const H = u(K), V = /* @__PURE__ */ Object.create(null); - if (typeof F != "string" || (F = F.trim().replace(/^[?#&]/, ""), !F)) + }, H), l(H.arrayFormatSeparator); + const W = u(H), V = /* @__PURE__ */ Object.create(null); + if (typeof B != "string" || (B = B.trim().replace(/^[?#&]/, ""), !B)) return V; - for (const te of F.split("&")) { + for (const te of B.split("&")) { if (te === "") continue; - let [R, W] = n(K.decode ? te.replace(/\+/g, " ") : te, "="); - W = W === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(K.arrayFormat) ? W : g(W, K), H(g(R, K), W, V); + let [R, K] = n(H.decode ? te.replace(/\+/g, " ") : te, "="); + K = K === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(H.arrayFormat) ? K : p(K, H), W(p(R, H), K, V); } for (const te of Object.keys(V)) { const R = V[te]; if (typeof R == "object" && R !== null) - for (const W of Object.keys(R)) - R[W] = L(R[W], K); + for (const K of Object.keys(R)) + R[K] = L(R[K], H); else - V[te] = L(R, K); + V[te] = L(R, H); } - return K.sort === !1 ? V : (K.sort === !0 ? Object.keys(V).sort() : Object.keys(V).sort(K.sort)).reduce((te, R) => { - const W = V[R]; - return W && typeof W == "object" && !Array.isArray(W) ? te[R] = w(W) : te[R] = W, te; + return H.sort === !1 ? V : (H.sort === !0 ? Object.keys(V).sort() : Object.keys(V).sort(H.sort)).reduce((te, R) => { + const K = V[R]; + return K && typeof K == "object" && !Array.isArray(K) ? te[R] = w(K) : te[R] = K, te; }, /* @__PURE__ */ Object.create(null)); } - t.extract = N, t.parse = $, t.stringify = (F, K) => { - if (!F) + t.extract = N, t.parse = $, t.stringify = (B, H) => { + if (!B) return ""; - K = Object.assign({ + H = Object.assign({ encode: !0, strict: !0, arrayFormat: "none", arrayFormatSeparator: "," - }, K), l(K.arrayFormatSeparator); - const H = (W) => K.skipNull && s(F[W]) || K.skipEmptyString && F[W] === "", V = a(K), te = {}; - for (const W of Object.keys(F)) - H(W) || (te[W] = F[W]); + }, H), l(H.arrayFormatSeparator); + const W = (K) => H.skipNull && s(B[K]) || H.skipEmptyString && B[K] === "", V = a(H), te = {}; + for (const K of Object.keys(B)) + W(K) || (te[K] = B[K]); const R = Object.keys(te); - return K.sort !== !1 && R.sort(K.sort), R.map((W) => { - const pe = F[W]; - return pe === void 0 ? "" : pe === null ? d(W, K) : Array.isArray(pe) ? pe.length === 0 && K.arrayFormat === "bracket-separator" ? d(W, K) + "[]" : pe.reduce(V(W), []).join("&") : d(W, K) + "=" + d(pe, K); - }).filter((W) => W.length > 0).join("&"); - }, t.parseUrl = (F, K) => { - K = Object.assign({ + return H.sort !== !1 && R.sort(H.sort), R.map((K) => { + const ge = B[K]; + return ge === void 0 ? "" : ge === null ? d(K, H) : Array.isArray(ge) ? ge.length === 0 && H.arrayFormat === "bracket-separator" ? d(K, H) + "[]" : ge.reduce(V(K), []).join("&") : d(K, H) + "=" + d(ge, H); + }).filter((K) => K.length > 0).join("&"); + }, t.parseUrl = (B, H) => { + H = Object.assign({ decode: !0 - }, K); - const [H, V] = n(F, "#"); + }, H); + const [W, V] = n(B, "#"); return Object.assign( { - url: H.split("?")[0] || "", - query: $(N(F), K) + url: W.split("?")[0] || "", + query: $(N(B), H) }, - K && K.parseFragmentIdentifier && V ? { fragmentIdentifier: g(V, K) } : {} + H && H.parseFragmentIdentifier && V ? { fragmentIdentifier: p(V, H) } : {} ); - }, t.stringifyUrl = (F, K) => { - K = Object.assign({ + }, t.stringifyUrl = (B, H) => { + H = Object.assign({ encode: !0, strict: !0, [o]: !0 - }, K); - const H = A(F.url).split("?")[0] || "", V = t.extract(F.url), te = t.parse(V, { sort: !1 }), R = Object.assign(te, F.query); - let W = t.stringify(R, K); - W && (W = `?${W}`); - let pe = M(F.url); - return F.fragmentIdentifier && (pe = `#${K[o] ? d(F.fragmentIdentifier, K) : F.fragmentIdentifier}`), `${H}${W}${pe}`; - }, t.pick = (F, K, H) => { - H = Object.assign({ + }, H); + const W = A(B.url).split("?")[0] || "", V = t.extract(B.url), te = t.parse(V, { sort: !1 }), R = Object.assign(te, B.query); + let K = t.stringify(R, H); + K && (K = `?${K}`); + let ge = P(B.url); + return B.fragmentIdentifier && (ge = `#${H[o] ? d(B.fragmentIdentifier, H) : B.fragmentIdentifier}`), `${W}${K}${ge}`; + }, t.pick = (B, H, W) => { + W = Object.assign({ parseFragmentIdentifier: !0, [o]: !1 - }, H); - const { url: V, query: te, fragmentIdentifier: R } = t.parseUrl(F, H); + }, W); + const { url: V, query: te, fragmentIdentifier: R } = t.parseUrl(B, W); return t.stringifyUrl({ url: V, - query: i(te, K), + query: i(te, H), fragmentIdentifier: R - }, H); - }, t.exclude = (F, K, H) => { - const V = Array.isArray(K) ? (te) => !K.includes(te) : (te, R) => !K(te, R); - return t.pick(F, V, H); + }, W); + }, t.exclude = (B, H, W) => { + const V = Array.isArray(H) ? (te) => !H.includes(te) : (te, R) => !H(te, R); + return t.pick(B, V, W); }; -})(wl); -var H4 = { exports: {} }; +})(xl); +var K4 = { exports: {} }; /** * [js-sha3]{@link https://github.com/emn178/js-sha3} * @@ -8354,7 +8354,7 @@ var H4 = { exports: {} }; i.JS_SHA3_NO_WINDOW && (n = !1); var s = !n && typeof self == "object", o = !i.JS_SHA3_NO_NODE_JS && typeof process == "object" && process.versions && process.versions.node; o ? i = gn : s && (i = self); - var a = !i.JS_SHA3_NO_COMMON_JS && !0 && t.exports, u = !i.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", l = "0123456789abcdef".split(""), d = [31, 7936, 2031616, 520093696], g = [4, 1024, 262144, 67108864], w = [1, 256, 65536, 16777216], A = [6, 1536, 393216, 100663296], M = [0, 8, 16, 24], N = [ + var a = !i.JS_SHA3_NO_COMMON_JS && !0 && t.exports, u = !i.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", l = "0123456789abcdef".split(""), d = [31, 7936, 2031616, 520093696], p = [4, 1024, 262144, 67108864], w = [1, 256, 65536, 16777216], A = [6, 1536, 393216, 100663296], P = [0, 8, 16, 24], N = [ 1, 0, 32898, @@ -8403,7 +8403,7 @@ var H4 = { exports: {} }; 0, 2147516424, 2147483648 - ], L = [224, 256, 384, 512], $ = [128, 256], F = ["hex", "buffer", "arrayBuffer", "array", "digest"], K = { + ], L = [224, 256, 384, 512], $ = [128, 256], B = ["hex", "buffer", "arrayBuffer", "array", "digest"], H = { 128: 168, 256: 136 }; @@ -8412,7 +8412,7 @@ var H4 = { exports: {} }; }), u && (i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView) && (ArrayBuffer.isView = function(D) { return typeof D == "object" && D.buffer && D.buffer.constructor === ArrayBuffer; }); - for (var H = function(D, oe, Z) { + for (var W = function(D, oe, Z) { return function(J) { return new I(D, oe, D).update(J)[Z](); }; @@ -8428,52 +8428,52 @@ var H4 = { exports: {} }; return function(J, Q, T, X) { return f["kmac" + D].update(J, Q, T, X)[Z](); }; - }, W = function(D, oe, Z, J) { - for (var Q = 0; Q < F.length; ++Q) { - var T = F[Q]; + }, K = function(D, oe, Z, J) { + for (var Q = 0; Q < B.length; ++Q) { + var T = B[Q]; D[T] = oe(Z, J, T); } return D; - }, pe = function(D, oe) { - var Z = H(D, oe, "hex"); + }, ge = function(D, oe) { + var Z = W(D, oe, "hex"); return Z.create = function() { return new I(D, oe, D); }, Z.update = function(J) { return Z.create().update(J); - }, W(Z, H, D, oe); + }, K(Z, W, D, oe); }, Ee = function(D, oe) { var Z = V(D, oe, "hex"); return Z.create = function(J) { return new I(D, oe, J); }, Z.update = function(J, Q) { return Z.create(Q).update(J); - }, W(Z, V, D, oe); + }, K(Z, V, D, oe); }, Y = function(D, oe) { - var Z = K[D], J = te(D, oe, "hex"); + var Z = H[D], J = te(D, oe, "hex"); return J.create = function(Q, T, X) { return !T && !X ? f["shake" + D].create(Q) : new I(D, oe, Q).bytepad([T, X], Z); }, J.update = function(Q, T, X, re) { return J.create(T, X, re).update(Q); - }, W(J, te, D, oe); + }, K(J, te, D, oe); }, S = function(D, oe) { - var Z = K[D], J = R(D, oe, "hex"); + var Z = H[D], J = R(D, oe, "hex"); return J.create = function(Q, T, X) { - return new B(D, oe, T).bytepad(["KMAC", X], Z).bytepad([Q], Z); + return new F(D, oe, T).bytepad(["KMAC", X], Z).bytepad([Q], Z); }, J.update = function(Q, T, X, re) { return J.create(Q, X, re).update(T); - }, W(J, R, D, oe); + }, K(J, R, D, oe); }, m = [ - { name: "keccak", padding: w, bits: L, createMethod: pe }, - { name: "sha3", padding: A, bits: L, createMethod: pe }, + { name: "keccak", padding: w, bits: L, createMethod: ge }, + { name: "sha3", padding: A, bits: L, createMethod: ge }, { name: "shake", padding: d, bits: $, createMethod: Ee }, - { name: "cshake", padding: g, bits: $, createMethod: Y }, - { name: "kmac", padding: g, bits: $, createMethod: S } - ], f = {}, p = [], b = 0; b < m.length; ++b) + { name: "cshake", padding: p, bits: $, createMethod: Y }, + { name: "kmac", padding: p, bits: $, createMethod: S } + ], f = {}, g = [], b = 0; b < m.length; ++b) for (var x = m[b], _ = x.bits, E = 0; E < _.length; ++E) { var v = x.name + "_" + _[E]; - if (p.push(v), f[v] = x.createMethod(_[E], x.padding), x.name !== "sha3") { - var P = x.name + _[E]; - p.push(P), f[P] = f[v]; + if (g.push(v), f[v] = x.createMethod(_[E], x.padding), x.name !== "sha3") { + var M = x.name + _[E]; + g.push(M), f[M] = f[v]; } } function I(D, oe, Z) { @@ -8497,20 +8497,20 @@ var H4 = { exports: {} }; throw new Error(e); oe = !0; } - for (var J = this.blocks, Q = this.byteCount, T = D.length, X = this.blockCount, re = 0, de = this.s, ie, ue; re < T; ) { + for (var J = this.blocks, Q = this.byteCount, T = D.length, X = this.blockCount, re = 0, pe = this.s, ie, ue; re < T; ) { if (this.reset) for (this.reset = !1, J[0] = this.block, ie = 1; ie < X + 1; ++ie) J[ie] = 0; if (oe) for (ie = this.start; re < T && ie < Q; ++re) - J[ie >> 2] |= D[re] << M[ie++ & 3]; + J[ie >> 2] |= D[re] << P[ie++ & 3]; else for (ie = this.start; re < T && ie < Q; ++re) - ue = D.charCodeAt(re), ue < 128 ? J[ie >> 2] |= ue << M[ie++ & 3] : ue < 2048 ? (J[ie >> 2] |= (192 | ue >> 6) << M[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << M[ie++ & 3]) : ue < 55296 || ue >= 57344 ? (J[ie >> 2] |= (224 | ue >> 12) << M[ie++ & 3], J[ie >> 2] |= (128 | ue >> 6 & 63) << M[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << M[ie++ & 3]) : (ue = 65536 + ((ue & 1023) << 10 | D.charCodeAt(++re) & 1023), J[ie >> 2] |= (240 | ue >> 18) << M[ie++ & 3], J[ie >> 2] |= (128 | ue >> 12 & 63) << M[ie++ & 3], J[ie >> 2] |= (128 | ue >> 6 & 63) << M[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << M[ie++ & 3]); + ue = D.charCodeAt(re), ue < 128 ? J[ie >> 2] |= ue << P[ie++ & 3] : ue < 2048 ? (J[ie >> 2] |= (192 | ue >> 6) << P[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << P[ie++ & 3]) : ue < 55296 || ue >= 57344 ? (J[ie >> 2] |= (224 | ue >> 12) << P[ie++ & 3], J[ie >> 2] |= (128 | ue >> 6 & 63) << P[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << P[ie++ & 3]) : (ue = 65536 + ((ue & 1023) << 10 | D.charCodeAt(++re) & 1023), J[ie >> 2] |= (240 | ue >> 18) << P[ie++ & 3], J[ie >> 2] |= (128 | ue >> 12 & 63) << P[ie++ & 3], J[ie >> 2] |= (128 | ue >> 6 & 63) << P[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << P[ie++ & 3]); if (this.lastByteIndex = ie, ie >= Q) { for (this.start = ie - Q, this.block = J[X], ie = 0; ie < X; ++ie) - de[ie] ^= J[ie]; - ce(de), this.reset = !0; + pe[ie] ^= J[ie]; + ce(pe), this.reset = !0; } else this.start = ie; } @@ -8571,45 +8571,45 @@ var H4 = { exports: {} }; this.finalize(); var D = this.blockCount, oe = this.s, Z = this.outputBlocks, J = this.extraBytes, Q = 0, T = 0, X = this.outputBits >> 3, re; J ? re = new ArrayBuffer(Z + 1 << 2) : re = new ArrayBuffer(X); - for (var de = new Uint32Array(re); T < Z; ) { + for (var pe = new Uint32Array(re); T < Z; ) { for (Q = 0; Q < D && T < Z; ++Q, ++T) - de[T] = oe[Q]; + pe[T] = oe[Q]; T % D === 0 && ce(oe); } - return J && (de[Q] = oe[Q], re = re.slice(0, X)), re; + return J && (pe[Q] = oe[Q], re = re.slice(0, X)), re; }, I.prototype.buffer = I.prototype.arrayBuffer, I.prototype.digest = I.prototype.array = function() { this.finalize(); - for (var D = this.blockCount, oe = this.s, Z = this.outputBlocks, J = this.extraBytes, Q = 0, T = 0, X = [], re, de; T < Z; ) { + for (var D = this.blockCount, oe = this.s, Z = this.outputBlocks, J = this.extraBytes, Q = 0, T = 0, X = [], re, pe; T < Z; ) { for (Q = 0; Q < D && T < Z; ++Q, ++T) - re = T << 2, de = oe[Q], X[re] = de & 255, X[re + 1] = de >> 8 & 255, X[re + 2] = de >> 16 & 255, X[re + 3] = de >> 24 & 255; + re = T << 2, pe = oe[Q], X[re] = pe & 255, X[re + 1] = pe >> 8 & 255, X[re + 2] = pe >> 16 & 255, X[re + 3] = pe >> 24 & 255; T % D === 0 && ce(oe); } - return J && (re = T << 2, de = oe[Q], X[re] = de & 255, J > 1 && (X[re + 1] = de >> 8 & 255), J > 2 && (X[re + 2] = de >> 16 & 255)), X; + return J && (re = T << 2, pe = oe[Q], X[re] = pe & 255, J > 1 && (X[re + 1] = pe >> 8 & 255), J > 2 && (X[re + 2] = pe >> 16 & 255)), X; }; - function B(D, oe, Z) { + function F(D, oe, Z) { I.call(this, D, oe, Z); } - B.prototype = new I(), B.prototype.finalize = function() { + F.prototype = new I(), F.prototype.finalize = function() { return this.encode(this.outputBits, !0), I.prototype.finalize.call(this); }; var ce = function(D) { - var oe, Z, J, Q, T, X, re, de, ie, ue, ve, Pe, De, Ce, $e, Me, Ne, Ke, Le, qe, ze, _e, Ze, at, ke, Qe, tt, Ye, dt, lt, ct, qt, Yt, Et, Qt, Jt, Dt, kt, Ct, gt, Rt, Nt, vt, $t, Bt, rt, Ft, k, j, z, C, G, U, se, he, xe, Te, Re, nt, Ue, pt, it, et; + var oe, Z, J, Q, T, X, re, pe, ie, ue, ve, Pe, De, Ce, $e, Me, Ne, Ke, Le, qe, ze, _e, Ze, at, ke, Qe, tt, Ye, dt, lt, ct, qt, Jt, Et, er, Xt, Dt, kt, Ct, gt, Rt, Nt, vt, $t, Ft, rt, Bt, k, U, z, C, G, j, se, de, xe, Te, Re, nt, je, pt, it, et; for (J = 0; J < 48; J += 2) - Q = D[0] ^ D[10] ^ D[20] ^ D[30] ^ D[40], T = D[1] ^ D[11] ^ D[21] ^ D[31] ^ D[41], X = D[2] ^ D[12] ^ D[22] ^ D[32] ^ D[42], re = D[3] ^ D[13] ^ D[23] ^ D[33] ^ D[43], de = D[4] ^ D[14] ^ D[24] ^ D[34] ^ D[44], ie = D[5] ^ D[15] ^ D[25] ^ D[35] ^ D[45], ue = D[6] ^ D[16] ^ D[26] ^ D[36] ^ D[46], ve = D[7] ^ D[17] ^ D[27] ^ D[37] ^ D[47], Pe = D[8] ^ D[18] ^ D[28] ^ D[38] ^ D[48], De = D[9] ^ D[19] ^ D[29] ^ D[39] ^ D[49], oe = Pe ^ (X << 1 | re >>> 31), Z = De ^ (re << 1 | X >>> 31), D[0] ^= oe, D[1] ^= Z, D[10] ^= oe, D[11] ^= Z, D[20] ^= oe, D[21] ^= Z, D[30] ^= oe, D[31] ^= Z, D[40] ^= oe, D[41] ^= Z, oe = Q ^ (de << 1 | ie >>> 31), Z = T ^ (ie << 1 | de >>> 31), D[2] ^= oe, D[3] ^= Z, D[12] ^= oe, D[13] ^= Z, D[22] ^= oe, D[23] ^= Z, D[32] ^= oe, D[33] ^= Z, D[42] ^= oe, D[43] ^= Z, oe = X ^ (ue << 1 | ve >>> 31), Z = re ^ (ve << 1 | ue >>> 31), D[4] ^= oe, D[5] ^= Z, D[14] ^= oe, D[15] ^= Z, D[24] ^= oe, D[25] ^= Z, D[34] ^= oe, D[35] ^= Z, D[44] ^= oe, D[45] ^= Z, oe = de ^ (Pe << 1 | De >>> 31), Z = ie ^ (De << 1 | Pe >>> 31), D[6] ^= oe, D[7] ^= Z, D[16] ^= oe, D[17] ^= Z, D[26] ^= oe, D[27] ^= Z, D[36] ^= oe, D[37] ^= Z, D[46] ^= oe, D[47] ^= Z, oe = ue ^ (Q << 1 | T >>> 31), Z = ve ^ (T << 1 | Q >>> 31), D[8] ^= oe, D[9] ^= Z, D[18] ^= oe, D[19] ^= Z, D[28] ^= oe, D[29] ^= Z, D[38] ^= oe, D[39] ^= Z, D[48] ^= oe, D[49] ^= Z, Ce = D[0], $e = D[1], rt = D[11] << 4 | D[10] >>> 28, Ft = D[10] << 4 | D[11] >>> 28, Ye = D[20] << 3 | D[21] >>> 29, dt = D[21] << 3 | D[20] >>> 29, Ue = D[31] << 9 | D[30] >>> 23, pt = D[30] << 9 | D[31] >>> 23, Nt = D[40] << 18 | D[41] >>> 14, vt = D[41] << 18 | D[40] >>> 14, Et = D[2] << 1 | D[3] >>> 31, Qt = D[3] << 1 | D[2] >>> 31, Me = D[13] << 12 | D[12] >>> 20, Ne = D[12] << 12 | D[13] >>> 20, k = D[22] << 10 | D[23] >>> 22, j = D[23] << 10 | D[22] >>> 22, lt = D[33] << 13 | D[32] >>> 19, ct = D[32] << 13 | D[33] >>> 19, it = D[42] << 2 | D[43] >>> 30, et = D[43] << 2 | D[42] >>> 30, se = D[5] << 30 | D[4] >>> 2, he = D[4] << 30 | D[5] >>> 2, Jt = D[14] << 6 | D[15] >>> 26, Dt = D[15] << 6 | D[14] >>> 26, Ke = D[25] << 11 | D[24] >>> 21, Le = D[24] << 11 | D[25] >>> 21, z = D[34] << 15 | D[35] >>> 17, C = D[35] << 15 | D[34] >>> 17, qt = D[45] << 29 | D[44] >>> 3, Yt = D[44] << 29 | D[45] >>> 3, at = D[6] << 28 | D[7] >>> 4, ke = D[7] << 28 | D[6] >>> 4, xe = D[17] << 23 | D[16] >>> 9, Te = D[16] << 23 | D[17] >>> 9, kt = D[26] << 25 | D[27] >>> 7, Ct = D[27] << 25 | D[26] >>> 7, qe = D[36] << 21 | D[37] >>> 11, ze = D[37] << 21 | D[36] >>> 11, G = D[47] << 24 | D[46] >>> 8, U = D[46] << 24 | D[47] >>> 8, $t = D[8] << 27 | D[9] >>> 5, Bt = D[9] << 27 | D[8] >>> 5, Qe = D[18] << 20 | D[19] >>> 12, tt = D[19] << 20 | D[18] >>> 12, Re = D[29] << 7 | D[28] >>> 25, nt = D[28] << 7 | D[29] >>> 25, gt = D[38] << 8 | D[39] >>> 24, Rt = D[39] << 8 | D[38] >>> 24, _e = D[48] << 14 | D[49] >>> 18, Ze = D[49] << 14 | D[48] >>> 18, D[0] = Ce ^ ~Me & Ke, D[1] = $e ^ ~Ne & Le, D[10] = at ^ ~Qe & Ye, D[11] = ke ^ ~tt & dt, D[20] = Et ^ ~Jt & kt, D[21] = Qt ^ ~Dt & Ct, D[30] = $t ^ ~rt & k, D[31] = Bt ^ ~Ft & j, D[40] = se ^ ~xe & Re, D[41] = he ^ ~Te & nt, D[2] = Me ^ ~Ke & qe, D[3] = Ne ^ ~Le & ze, D[12] = Qe ^ ~Ye & lt, D[13] = tt ^ ~dt & ct, D[22] = Jt ^ ~kt & gt, D[23] = Dt ^ ~Ct & Rt, D[32] = rt ^ ~k & z, D[33] = Ft ^ ~j & C, D[42] = xe ^ ~Re & Ue, D[43] = Te ^ ~nt & pt, D[4] = Ke ^ ~qe & _e, D[5] = Le ^ ~ze & Ze, D[14] = Ye ^ ~lt & qt, D[15] = dt ^ ~ct & Yt, D[24] = kt ^ ~gt & Nt, D[25] = Ct ^ ~Rt & vt, D[34] = k ^ ~z & G, D[35] = j ^ ~C & U, D[44] = Re ^ ~Ue & it, D[45] = nt ^ ~pt & et, D[6] = qe ^ ~_e & Ce, D[7] = ze ^ ~Ze & $e, D[16] = lt ^ ~qt & at, D[17] = ct ^ ~Yt & ke, D[26] = gt ^ ~Nt & Et, D[27] = Rt ^ ~vt & Qt, D[36] = z ^ ~G & $t, D[37] = C ^ ~U & Bt, D[46] = Ue ^ ~it & se, D[47] = pt ^ ~et & he, D[8] = _e ^ ~Ce & Me, D[9] = Ze ^ ~$e & Ne, D[18] = qt ^ ~at & Qe, D[19] = Yt ^ ~ke & tt, D[28] = Nt ^ ~Et & Jt, D[29] = vt ^ ~Qt & Dt, D[38] = G ^ ~$t & rt, D[39] = U ^ ~Bt & Ft, D[48] = it ^ ~se & xe, D[49] = et ^ ~he & Te, D[0] ^= N[J], D[1] ^= N[J + 1]; + Q = D[0] ^ D[10] ^ D[20] ^ D[30] ^ D[40], T = D[1] ^ D[11] ^ D[21] ^ D[31] ^ D[41], X = D[2] ^ D[12] ^ D[22] ^ D[32] ^ D[42], re = D[3] ^ D[13] ^ D[23] ^ D[33] ^ D[43], pe = D[4] ^ D[14] ^ D[24] ^ D[34] ^ D[44], ie = D[5] ^ D[15] ^ D[25] ^ D[35] ^ D[45], ue = D[6] ^ D[16] ^ D[26] ^ D[36] ^ D[46], ve = D[7] ^ D[17] ^ D[27] ^ D[37] ^ D[47], Pe = D[8] ^ D[18] ^ D[28] ^ D[38] ^ D[48], De = D[9] ^ D[19] ^ D[29] ^ D[39] ^ D[49], oe = Pe ^ (X << 1 | re >>> 31), Z = De ^ (re << 1 | X >>> 31), D[0] ^= oe, D[1] ^= Z, D[10] ^= oe, D[11] ^= Z, D[20] ^= oe, D[21] ^= Z, D[30] ^= oe, D[31] ^= Z, D[40] ^= oe, D[41] ^= Z, oe = Q ^ (pe << 1 | ie >>> 31), Z = T ^ (ie << 1 | pe >>> 31), D[2] ^= oe, D[3] ^= Z, D[12] ^= oe, D[13] ^= Z, D[22] ^= oe, D[23] ^= Z, D[32] ^= oe, D[33] ^= Z, D[42] ^= oe, D[43] ^= Z, oe = X ^ (ue << 1 | ve >>> 31), Z = re ^ (ve << 1 | ue >>> 31), D[4] ^= oe, D[5] ^= Z, D[14] ^= oe, D[15] ^= Z, D[24] ^= oe, D[25] ^= Z, D[34] ^= oe, D[35] ^= Z, D[44] ^= oe, D[45] ^= Z, oe = pe ^ (Pe << 1 | De >>> 31), Z = ie ^ (De << 1 | Pe >>> 31), D[6] ^= oe, D[7] ^= Z, D[16] ^= oe, D[17] ^= Z, D[26] ^= oe, D[27] ^= Z, D[36] ^= oe, D[37] ^= Z, D[46] ^= oe, D[47] ^= Z, oe = ue ^ (Q << 1 | T >>> 31), Z = ve ^ (T << 1 | Q >>> 31), D[8] ^= oe, D[9] ^= Z, D[18] ^= oe, D[19] ^= Z, D[28] ^= oe, D[29] ^= Z, D[38] ^= oe, D[39] ^= Z, D[48] ^= oe, D[49] ^= Z, Ce = D[0], $e = D[1], rt = D[11] << 4 | D[10] >>> 28, Bt = D[10] << 4 | D[11] >>> 28, Ye = D[20] << 3 | D[21] >>> 29, dt = D[21] << 3 | D[20] >>> 29, je = D[31] << 9 | D[30] >>> 23, pt = D[30] << 9 | D[31] >>> 23, Nt = D[40] << 18 | D[41] >>> 14, vt = D[41] << 18 | D[40] >>> 14, Et = D[2] << 1 | D[3] >>> 31, er = D[3] << 1 | D[2] >>> 31, Me = D[13] << 12 | D[12] >>> 20, Ne = D[12] << 12 | D[13] >>> 20, k = D[22] << 10 | D[23] >>> 22, U = D[23] << 10 | D[22] >>> 22, lt = D[33] << 13 | D[32] >>> 19, ct = D[32] << 13 | D[33] >>> 19, it = D[42] << 2 | D[43] >>> 30, et = D[43] << 2 | D[42] >>> 30, se = D[5] << 30 | D[4] >>> 2, de = D[4] << 30 | D[5] >>> 2, Xt = D[14] << 6 | D[15] >>> 26, Dt = D[15] << 6 | D[14] >>> 26, Ke = D[25] << 11 | D[24] >>> 21, Le = D[24] << 11 | D[25] >>> 21, z = D[34] << 15 | D[35] >>> 17, C = D[35] << 15 | D[34] >>> 17, qt = D[45] << 29 | D[44] >>> 3, Jt = D[44] << 29 | D[45] >>> 3, at = D[6] << 28 | D[7] >>> 4, ke = D[7] << 28 | D[6] >>> 4, xe = D[17] << 23 | D[16] >>> 9, Te = D[16] << 23 | D[17] >>> 9, kt = D[26] << 25 | D[27] >>> 7, Ct = D[27] << 25 | D[26] >>> 7, qe = D[36] << 21 | D[37] >>> 11, ze = D[37] << 21 | D[36] >>> 11, G = D[47] << 24 | D[46] >>> 8, j = D[46] << 24 | D[47] >>> 8, $t = D[8] << 27 | D[9] >>> 5, Ft = D[9] << 27 | D[8] >>> 5, Qe = D[18] << 20 | D[19] >>> 12, tt = D[19] << 20 | D[18] >>> 12, Re = D[29] << 7 | D[28] >>> 25, nt = D[28] << 7 | D[29] >>> 25, gt = D[38] << 8 | D[39] >>> 24, Rt = D[39] << 8 | D[38] >>> 24, _e = D[48] << 14 | D[49] >>> 18, Ze = D[49] << 14 | D[48] >>> 18, D[0] = Ce ^ ~Me & Ke, D[1] = $e ^ ~Ne & Le, D[10] = at ^ ~Qe & Ye, D[11] = ke ^ ~tt & dt, D[20] = Et ^ ~Xt & kt, D[21] = er ^ ~Dt & Ct, D[30] = $t ^ ~rt & k, D[31] = Ft ^ ~Bt & U, D[40] = se ^ ~xe & Re, D[41] = de ^ ~Te & nt, D[2] = Me ^ ~Ke & qe, D[3] = Ne ^ ~Le & ze, D[12] = Qe ^ ~Ye & lt, D[13] = tt ^ ~dt & ct, D[22] = Xt ^ ~kt & gt, D[23] = Dt ^ ~Ct & Rt, D[32] = rt ^ ~k & z, D[33] = Bt ^ ~U & C, D[42] = xe ^ ~Re & je, D[43] = Te ^ ~nt & pt, D[4] = Ke ^ ~qe & _e, D[5] = Le ^ ~ze & Ze, D[14] = Ye ^ ~lt & qt, D[15] = dt ^ ~ct & Jt, D[24] = kt ^ ~gt & Nt, D[25] = Ct ^ ~Rt & vt, D[34] = k ^ ~z & G, D[35] = U ^ ~C & j, D[44] = Re ^ ~je & it, D[45] = nt ^ ~pt & et, D[6] = qe ^ ~_e & Ce, D[7] = ze ^ ~Ze & $e, D[16] = lt ^ ~qt & at, D[17] = ct ^ ~Jt & ke, D[26] = gt ^ ~Nt & Et, D[27] = Rt ^ ~vt & er, D[36] = z ^ ~G & $t, D[37] = C ^ ~j & Ft, D[46] = je ^ ~it & se, D[47] = pt ^ ~et & de, D[8] = _e ^ ~Ce & Me, D[9] = Ze ^ ~$e & Ne, D[18] = qt ^ ~at & Qe, D[19] = Jt ^ ~ke & tt, D[28] = Nt ^ ~Et & Xt, D[29] = vt ^ ~er & Dt, D[38] = G ^ ~$t & rt, D[39] = j ^ ~Ft & Bt, D[48] = it ^ ~se & xe, D[49] = et ^ ~de & Te, D[0] ^= N[J], D[1] ^= N[J + 1]; }; if (a) t.exports = f; else - for (b = 0; b < p.length; ++b) - i[p[b]] = f[p[b]]; + for (b = 0; b < g.length; ++b) + i[g[b]] = f[g[b]]; })(); -})(H4); -var hB = H4.exports; -const dB = /* @__PURE__ */ ts(hB), pB = "logger/5.7.0"; -let lx = !1, hx = !1; -const Sd = { debug: 1, default: 2, info: 2, warning: 3, error: 4, off: 5 }; -let dx = Sd.default, Zg = null; -function gB() { +})(K4); +var _F = K4.exports; +const EF = /* @__PURE__ */ rs(_F), SF = "logger/5.7.0"; +let dx = !1, px = !1; +const Ad = { debug: 1, default: 2, info: 2, warning: 3, error: 4, off: 5 }; +let gx = Ad.default, Zg = null; +function AF() { try { const t = []; if (["NFD", "NFC", "NFKD", "NFKC"].forEach((e) => { @@ -8628,16 +8628,16 @@ function gB() { } return null; } -const px = gB(); +const mx = AF(); var y1; (function(t) { t.DEBUG = "DEBUG", t.INFO = "INFO", t.WARNING = "WARNING", t.ERROR = "ERROR", t.OFF = "OFF"; })(y1 || (y1 = {})); -var ys; +var ws; (function(t) { t.UNKNOWN_ERROR = "UNKNOWN_ERROR", t.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", t.UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION", t.NETWORK_ERROR = "NETWORK_ERROR", t.SERVER_ERROR = "SERVER_ERROR", t.TIMEOUT = "TIMEOUT", t.BUFFER_OVERRUN = "BUFFER_OVERRUN", t.NUMERIC_FAULT = "NUMERIC_FAULT", t.MISSING_NEW = "MISSING_NEW", t.INVALID_ARGUMENT = "INVALID_ARGUMENT", t.MISSING_ARGUMENT = "MISSING_ARGUMENT", t.UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT", t.CALL_EXCEPTION = "CALL_EXCEPTION", t.INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS", t.NONCE_EXPIRED = "NONCE_EXPIRED", t.REPLACEMENT_UNDERPRICED = "REPLACEMENT_UNDERPRICED", t.UNPREDICTABLE_GAS_LIMIT = "UNPREDICTABLE_GAS_LIMIT", t.TRANSACTION_REPLACED = "TRANSACTION_REPLACED", t.ACTION_REJECTED = "ACTION_REJECTED"; -})(ys || (ys = {})); -const gx = "0123456789abcdef"; +})(ws || (ws = {})); +const vx = "0123456789abcdef"; class Yr { constructor(e) { Object.defineProperty(this, "version", { @@ -8648,7 +8648,7 @@ class Yr { } _log(e, r) { const n = e.toLowerCase(); - Sd[n] == null && this.throwArgumentError("invalid log level name", "logLevel", e), !(dx > Sd[n]) && console.log.apply(console, r); + Ad[n] == null && this.throwArgumentError("invalid log level name", "logLevel", e), !(gx > Ad[n]) && console.log.apply(console, r); } debug(...e) { this._log(Yr.levels.DEBUG, e); @@ -8660,7 +8660,7 @@ class Yr { this._log(Yr.levels.WARNING, e); } makeError(e, r, n) { - if (hx) + if (px) return this.makeError("censored error", r, {}); r || (r = Yr.errors.UNKNOWN_ERROR), n || (n = {}); const i = []; @@ -8669,8 +8669,8 @@ class Yr { try { if (l instanceof Uint8Array) { let d = ""; - for (let g = 0; g < l.length; g++) - d += gx[l[g] >> 4], d += gx[l[g] & 15]; + for (let p = 0; p < l.length; p++) + d += vx[l[p] >> 4], d += vx[l[p] & 15]; i.push(u + "=Uint8Array(0x" + d + ")"); } else i.push(u + "=" + JSON.stringify(l)); @@ -8681,7 +8681,7 @@ class Yr { const s = e; let o = ""; switch (r) { - case ys.NUMERIC_FAULT: { + case ws.NUMERIC_FAULT: { o = "NUMERIC_FAULT"; const u = e; switch (u) { @@ -8700,13 +8700,13 @@ class Yr { } break; } - case ys.CALL_EXCEPTION: - case ys.INSUFFICIENT_FUNDS: - case ys.MISSING_NEW: - case ys.NONCE_EXPIRED: - case ys.REPLACEMENT_UNDERPRICED: - case ys.TRANSACTION_REPLACED: - case ys.UNPREDICTABLE_GAS_LIMIT: + case ws.CALL_EXCEPTION: + case ws.INSUFFICIENT_FUNDS: + case ws.MISSING_NEW: + case ws.NONCE_EXPIRED: + case ws.REPLACEMENT_UNDERPRICED: + case ws.TRANSACTION_REPLACED: + case ws.UNPREDICTABLE_GAS_LIMIT: o = r; break; } @@ -8732,9 +8732,9 @@ class Yr { e || this.throwArgumentError(r, n, i); } checkNormalize(e) { - px && this.throwError("platform missing String.prototype.normalize", Yr.errors.UNSUPPORTED_OPERATION, { + mx && this.throwError("platform missing String.prototype.normalize", Yr.errors.UNSUPPORTED_OPERATION, { operation: "String.prototype.normalize", - form: px + form: mx }); } checkSafeUint53(e, r) { @@ -8764,60 +8764,60 @@ class Yr { e === r ? this.throwError("cannot instantiate abstract class " + JSON.stringify(r.name) + " directly; use a sub-class", Yr.errors.UNSUPPORTED_OPERATION, { name: e.name, operation: "new" }) : (e === Object || e == null) && this.throwError("missing new", Yr.errors.MISSING_NEW, { name: r.name }); } static globalLogger() { - return Zg || (Zg = new Yr(pB)), Zg; + return Zg || (Zg = new Yr(SF)), Zg; } static setCensorship(e, r) { if (!e && r && this.globalLogger().throwError("cannot permanently disable censorship", Yr.errors.UNSUPPORTED_OPERATION, { operation: "setCensorship" - }), lx) { + }), dx) { if (!e) return; this.globalLogger().throwError("error censorship permanent", Yr.errors.UNSUPPORTED_OPERATION, { operation: "setCensorship" }); } - hx = !!e, lx = !!r; + px = !!e, dx = !!r; } static setLogLevel(e) { - const r = Sd[e.toLowerCase()]; + const r = Ad[e.toLowerCase()]; if (r == null) { Yr.globalLogger().warn("invalid log level - " + e); return; } - dx = r; + gx = r; } static from(e) { return new Yr(e); } } -Yr.errors = ys; +Yr.errors = ws; Yr.levels = y1; -const mB = "bytes/5.7.0", hn = new Yr(mB); -function W4(t) { +const PF = "bytes/5.7.0", hn = new Yr(PF); +function V4(t) { return !!t.toHexString; } -function uu(t) { +function fu(t) { return t.slice || (t.slice = function() { const e = Array.prototype.slice.call(arguments); - return uu(new Uint8Array(Array.prototype.slice.apply(t, e))); + return fu(new Uint8Array(Array.prototype.slice.apply(t, e))); }), t; } -function vB(t) { - return qs(t) && !(t.length % 2) || jv(t); +function MF(t) { + return zs(t) && !(t.length % 2) || Uv(t); } -function mx(t) { +function bx(t) { return typeof t == "number" && t == t && t % 1 === 0; } -function jv(t) { +function Uv(t) { if (t == null) return !1; if (t.constructor === Uint8Array) return !0; - if (typeof t == "string" || !mx(t.length) || t.length < 0) + if (typeof t == "string" || !bx(t.length) || t.length < 0) return !1; for (let e = 0; e < t.length; e++) { const r = t[e]; - if (!mx(r) || r < 0 || r >= 256) + if (!bx(r) || r < 0 || r >= 256) return !1; } return !0; @@ -8828,28 +8828,28 @@ function wn(t, e) { const r = []; for (; t; ) r.unshift(t & 255), t = parseInt(String(t / 256)); - return r.length === 0 && r.push(0), uu(new Uint8Array(r)); + return r.length === 0 && r.push(0), fu(new Uint8Array(r)); } - if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), W4(t) && (t = t.toHexString()), qs(t)) { + if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), V4(t) && (t = t.toHexString()), zs(t)) { let r = t.substring(2); r.length % 2 && (e.hexPad === "left" ? r = "0" + r : e.hexPad === "right" ? r += "0" : hn.throwArgumentError("hex data is odd-length", "value", t)); const n = []; for (let i = 0; i < r.length; i += 2) n.push(parseInt(r.substring(i, i + 2), 16)); - return uu(new Uint8Array(n)); + return fu(new Uint8Array(n)); } - return jv(t) ? uu(new Uint8Array(t)) : hn.throwArgumentError("invalid arrayify value", "value", t); + return Uv(t) ? fu(new Uint8Array(t)) : hn.throwArgumentError("invalid arrayify value", "value", t); } -function bB(t) { +function IF(t) { const e = t.map((i) => wn(i)), r = e.reduce((i, s) => i + s.length, 0), n = new Uint8Array(r); - return e.reduce((i, s) => (n.set(s, i), i + s.length), 0), uu(n); + return e.reduce((i, s) => (n.set(s, i), i + s.length), 0), fu(n); } -function yB(t, e) { +function CF(t, e) { t = wn(t), t.length > e && hn.throwArgumentError("value out of range", "value", arguments[0]); const r = new Uint8Array(e); - return r.set(t, e - t.length), uu(r); + return r.set(t, e - t.length), fu(r); } -function qs(t, e) { +function zs(t, e) { return !(typeof t != "string" || !t.match(/^0x[0-9A-Fa-f]*$/) || e && t.length !== 2 + 2 * e); } const Qg = "0123456789abcdef"; @@ -8863,11 +8863,11 @@ function Ti(t, e) { } if (typeof t == "bigint") return t = t.toString(16), t.length % 2 ? "0x0" + t : "0x" + t; - if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), W4(t)) + if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), V4(t)) return t.toHexString(); - if (qs(t)) + if (zs(t)) return t.length % 2 && (e.hexPad === "left" ? t = "0x0" + t.substring(2) : e.hexPad === "right" ? t += "0" : hn.throwArgumentError("hex data is odd-length", "value", t)), t.toLowerCase(); - if (jv(t)) { + if (Uv(t)) { let r = "0x"; for (let n = 0; n < t.length; n++) { let i = t[n]; @@ -8877,22 +8877,22 @@ function Ti(t, e) { } return hn.throwArgumentError("invalid hexlify value", "value", t); } -function wB(t) { +function TF(t) { if (typeof t != "string") t = Ti(t); - else if (!qs(t) || t.length % 2) + else if (!zs(t) || t.length % 2) return null; return (t.length - 2) / 2; } -function vx(t, e, r) { - return typeof t != "string" ? t = Ti(t) : (!qs(t) || t.length % 2) && hn.throwArgumentError("invalid hexData", "value", t), e = 2 + 2 * e, "0x" + t.substring(e); +function yx(t, e, r) { + return typeof t != "string" ? t = Ti(t) : (!zs(t) || t.length % 2) && hn.throwArgumentError("invalid hexData", "value", t), e = 2 + 2 * e, "0x" + t.substring(e); } -function fu(t, e) { - for (typeof t != "string" ? t = Ti(t) : qs(t) || hn.throwArgumentError("invalid hex string", "value", t), t.length > 2 * e + 2 && hn.throwArgumentError("value out of range", "value", arguments[1]); t.length < 2 * e + 2; ) +function lu(t, e) { + for (typeof t != "string" ? t = Ti(t) : zs(t) || hn.throwArgumentError("invalid hex string", "value", t), t.length > 2 * e + 2 && hn.throwArgumentError("value out of range", "value", arguments[1]); t.length < 2 * e + 2; ) t = "0x0" + t.substring(2); return t; } -function K4(t) { +function G4(t) { const e = { r: "0x", s: "0x", @@ -8902,12 +8902,12 @@ function K4(t) { yParityAndS: "0x", compact: "0x" }; - if (vB(t)) { + if (MF(t)) { let r = wn(t); r.length === 64 ? (e.v = 27 + (r[32] >> 7), r[32] &= 127, e.r = Ti(r.slice(0, 32)), e.s = Ti(r.slice(32, 64))) : r.length === 65 ? (e.r = Ti(r.slice(0, 32)), e.s = Ti(r.slice(32, 64)), e.v = r[64]) : hn.throwArgumentError("invalid signature string", "signature", t), e.v < 27 && (e.v === 0 || e.v === 1 ? e.v += 27 : hn.throwArgumentError("signature invalid v byte", "signature", t)), e.recoveryParam = 1 - e.v % 2, e.recoveryParam && (r[32] |= 128), e._vs = Ti(r.slice(32, 64)); } else { if (e.r = t.r, e.s = t.s, e.v = t.v, e.recoveryParam = t.recoveryParam, e._vs = t._vs, e._vs != null) { - const i = yB(wn(e._vs), 32); + const i = CF(wn(e._vs), 32); e._vs = Ti(i); const s = i[0] >= 128 ? 1 : 0; e.recoveryParam == null ? e.recoveryParam = s : e.recoveryParam !== s && hn.throwArgumentError("signature recoveryParam mismatch _vs", "signature", t), i[0] &= 127; @@ -8922,16 +8922,16 @@ function K4(t) { const i = e.v === 0 || e.v === 1 ? e.v : 1 - e.v % 2; e.recoveryParam !== i && hn.throwArgumentError("signature recoveryParam mismatch v", "signature", t); } - e.r == null || !qs(e.r) ? hn.throwArgumentError("signature missing or invalid r", "signature", t) : e.r = fu(e.r, 32), e.s == null || !qs(e.s) ? hn.throwArgumentError("signature missing or invalid s", "signature", t) : e.s = fu(e.s, 32); + e.r == null || !zs(e.r) ? hn.throwArgumentError("signature missing or invalid r", "signature", t) : e.r = lu(e.r, 32), e.s == null || !zs(e.s) ? hn.throwArgumentError("signature missing or invalid s", "signature", t) : e.s = lu(e.s, 32); const r = wn(e.s); r[0] >= 128 && hn.throwArgumentError("signature s out of range", "signature", t), e.recoveryParam && (r[0] |= 128); const n = Ti(r); - e._vs && (qs(e._vs) || hn.throwArgumentError("signature invalid _vs", "signature", t), e._vs = fu(e._vs, 32)), e._vs == null ? e._vs = n : e._vs !== n && hn.throwArgumentError("signature _vs mismatch v and s", "signature", t); + e._vs && (zs(e._vs) || hn.throwArgumentError("signature invalid _vs", "signature", t), e._vs = lu(e._vs, 32)), e._vs == null ? e._vs = n : e._vs !== n && hn.throwArgumentError("signature _vs mismatch v and s", "signature", t); } return e.yParityAndS = e._vs, e.compact = e.r + e.yParityAndS.substring(2), e; } function qv(t) { - return "0x" + dB.keccak_256(wn(t)); + return "0x" + EF.keccak_256(wn(t)); } var zv = { exports: {} }; zv.exports; @@ -8942,36 +8942,36 @@ zv.exports; } function i(m, f) { m.super_ = f; - var p = function() { + var g = function() { }; - p.prototype = f.prototype, m.prototype = new p(), m.prototype.constructor = m; + g.prototype = f.prototype, m.prototype = new g(), m.prototype.constructor = m; } - function s(m, f, p) { + function s(m, f, g) { if (s.isBN(m)) return m; - this.negative = 0, this.words = null, this.length = 0, this.red = null, m !== null && ((f === "le" || f === "be") && (p = f, f = 10), this._init(m || 0, f || 10, p || "be")); + this.negative = 0, this.words = null, this.length = 0, this.red = null, m !== null && ((f === "le" || f === "be") && (g = f, f = 10), this._init(m || 0, f || 10, g || "be")); } typeof e == "object" ? e.exports = s : r.BN = s, s.BN = s, s.wordSize = 26; var o; try { - typeof window < "u" && typeof window.Buffer < "u" ? o = window.Buffer : o = zl.Buffer; + typeof window < "u" && typeof window.Buffer < "u" ? o = window.Buffer : o = Wl.Buffer; } catch { } s.isBN = function(f) { return f instanceof s ? !0 : f !== null && typeof f == "object" && f.constructor.wordSize === s.wordSize && Array.isArray(f.words); - }, s.max = function(f, p) { - return f.cmp(p) > 0 ? f : p; - }, s.min = function(f, p) { - return f.cmp(p) < 0 ? f : p; - }, s.prototype._init = function(f, p, b) { + }, s.max = function(f, g) { + return f.cmp(g) > 0 ? f : g; + }, s.min = function(f, g) { + return f.cmp(g) < 0 ? f : g; + }, s.prototype._init = function(f, g, b) { if (typeof f == "number") - return this._initNumber(f, p, b); + return this._initNumber(f, g, b); if (typeof f == "object") - return this._initArray(f, p, b); - p === "hex" && (p = 16), n(p === (p | 0) && p >= 2 && p <= 36), f = f.toString().replace(/\s+/g, ""); + return this._initArray(f, g, b); + g === "hex" && (g = 16), n(g === (g | 0) && g >= 2 && g <= 36), f = f.toString().replace(/\s+/g, ""); var x = 0; - f[0] === "-" && (x++, this.negative = 1), x < f.length && (p === 16 ? this._parseHex(f, x, b) : (this._parseBase(f, p, x), b === "le" && this._initArray(this.toArray(), p, b))); - }, s.prototype._initNumber = function(f, p, b) { + f[0] === "-" && (x++, this.negative = 1), x < f.length && (g === 16 ? this._parseHex(f, x, b) : (this._parseBase(f, g, x), b === "le" && this._initArray(this.toArray(), g, b))); + }, s.prototype._initNumber = function(f, g, b) { f < 0 && (this.negative = 1, f = -f), f < 67108864 ? (this.words = [f & 67108863], this.length = 1) : f < 4503599627370496 ? (this.words = [ f & 67108863, f / 67108864 & 67108863 @@ -8979,8 +8979,8 @@ zv.exports; f & 67108863, f / 67108864 & 67108863, 1 - ], this.length = 3), b === "le" && this._initArray(this.toArray(), p, b); - }, s.prototype._initArray = function(f, p, b) { + ], this.length = 3), b === "le" && this._initArray(this.toArray(), g, b); + }, s.prototype._initArray = function(f, g, b) { if (n(typeof f.length == "number"), f.length <= 0) return this.words = [0], this.length = 1, this; this.length = Math.ceil(f.length / 3), this.words = new Array(this.length); @@ -8996,59 +8996,59 @@ zv.exports; return this._strip(); }; function a(m, f) { - var p = m.charCodeAt(f); - if (p >= 48 && p <= 57) - return p - 48; - if (p >= 65 && p <= 70) - return p - 55; - if (p >= 97 && p <= 102) - return p - 87; + var g = m.charCodeAt(f); + if (g >= 48 && g <= 57) + return g - 48; + if (g >= 65 && g <= 70) + return g - 55; + if (g >= 97 && g <= 102) + return g - 87; n(!1, "Invalid character in " + m); } - function u(m, f, p) { - var b = a(m, p); - return p - 1 >= f && (b |= a(m, p - 1) << 4), b; + function u(m, f, g) { + var b = a(m, g); + return g - 1 >= f && (b |= a(m, g - 1) << 4), b; } - s.prototype._parseHex = function(f, p, b) { - this.length = Math.ceil((f.length - p) / 6), this.words = new Array(this.length); + s.prototype._parseHex = function(f, g, b) { + this.length = Math.ceil((f.length - g) / 6), this.words = new Array(this.length); for (var x = 0; x < this.length; x++) this.words[x] = 0; var _ = 0, E = 0, v; if (b === "be") - for (x = f.length - 1; x >= p; x -= 2) - v = u(f, p, x) << _, this.words[E] |= v & 67108863, _ >= 18 ? (_ -= 18, E += 1, this.words[E] |= v >>> 26) : _ += 8; + for (x = f.length - 1; x >= g; x -= 2) + v = u(f, g, x) << _, this.words[E] |= v & 67108863, _ >= 18 ? (_ -= 18, E += 1, this.words[E] |= v >>> 26) : _ += 8; else { - var P = f.length - p; - for (x = P % 2 === 0 ? p + 1 : p; x < f.length; x += 2) - v = u(f, p, x) << _, this.words[E] |= v & 67108863, _ >= 18 ? (_ -= 18, E += 1, this.words[E] |= v >>> 26) : _ += 8; + var M = f.length - g; + for (x = M % 2 === 0 ? g + 1 : g; x < f.length; x += 2) + v = u(f, g, x) << _, this.words[E] |= v & 67108863, _ >= 18 ? (_ -= 18, E += 1, this.words[E] |= v >>> 26) : _ += 8; } this._strip(); }; - function l(m, f, p, b) { - for (var x = 0, _ = 0, E = Math.min(m.length, p), v = f; v < E; v++) { - var P = m.charCodeAt(v) - 48; - x *= b, P >= 49 ? _ = P - 49 + 10 : P >= 17 ? _ = P - 17 + 10 : _ = P, n(P >= 0 && _ < b, "Invalid character"), x += _; + function l(m, f, g, b) { + for (var x = 0, _ = 0, E = Math.min(m.length, g), v = f; v < E; v++) { + var M = m.charCodeAt(v) - 48; + x *= b, M >= 49 ? _ = M - 49 + 10 : M >= 17 ? _ = M - 17 + 10 : _ = M, n(M >= 0 && _ < b, "Invalid character"), x += _; } return x; } - s.prototype._parseBase = function(f, p, b) { + s.prototype._parseBase = function(f, g, b) { this.words = [0], this.length = 1; - for (var x = 0, _ = 1; _ <= 67108863; _ *= p) + for (var x = 0, _ = 1; _ <= 67108863; _ *= g) x++; - x--, _ = _ / p | 0; - for (var E = f.length - b, v = E % x, P = Math.min(E, E - v) + b, I = 0, B = b; B < P; B += x) - I = l(f, B, B + x, p), this.imuln(_), this.words[0] + I < 67108864 ? this.words[0] += I : this._iaddn(I); + x--, _ = _ / g | 0; + for (var E = f.length - b, v = E % x, M = Math.min(E, E - v) + b, I = 0, F = b; F < M; F += x) + I = l(f, F, F + x, g), this.imuln(_), this.words[0] + I < 67108864 ? this.words[0] += I : this._iaddn(I); if (v !== 0) { var ce = 1; - for (I = l(f, B, f.length, p), B = 0; B < v; B++) - ce *= p; + for (I = l(f, F, f.length, g), F = 0; F < v; F++) + ce *= g; this.imuln(ce), this.words[0] + I < 67108864 ? this.words[0] += I : this._iaddn(I); } this._strip(); }, s.prototype.copy = function(f) { f.words = new Array(this.length); - for (var p = 0; p < this.length; p++) - f.words[p] = this.words[p]; + for (var g = 0; g < this.length; g++) + f.words[g] = this.words[g]; f.length = this.length, f.negative = this.negative, f.red = this.red; }; function d(m, f) { @@ -9071,13 +9071,13 @@ zv.exports; return this.length === 1 && this.words[0] === 0 && (this.negative = 0), this; }, typeof Symbol < "u" && typeof Symbol.for == "function") try { - s.prototype[Symbol.for("nodejs.util.inspect.custom")] = g; + s.prototype[Symbol.for("nodejs.util.inspect.custom")] = p; } catch { - s.prototype.inspect = g; + s.prototype.inspect = p; } else - s.prototype.inspect = g; - function g() { + s.prototype.inspect = p; + function p() { return (this.red ? ""; } var w = [ @@ -9145,7 +9145,7 @@ zv.exports; 5, 5, 5 - ], M = [ + ], P = [ 0, 0, 33554432, @@ -9184,28 +9184,28 @@ zv.exports; 52521875, 60466176 ]; - s.prototype.toString = function(f, p) { - f = f || 10, p = p | 0 || 1; + s.prototype.toString = function(f, g) { + f = f || 10, g = g | 0 || 1; var b; if (f === 16 || f === "hex") { b = ""; for (var x = 0, _ = 0, E = 0; E < this.length; E++) { - var v = this.words[E], P = ((v << x | _) & 16777215).toString(16); - _ = v >>> 24 - x & 16777215, x += 2, x >= 26 && (x -= 26, E--), _ !== 0 || E !== this.length - 1 ? b = w[6 - P.length] + P + b : b = P + b; + var v = this.words[E], M = ((v << x | _) & 16777215).toString(16); + _ = v >>> 24 - x & 16777215, x += 2, x >= 26 && (x -= 26, E--), _ !== 0 || E !== this.length - 1 ? b = w[6 - M.length] + M + b : b = M + b; } - for (_ !== 0 && (b = _.toString(16) + b); b.length % p !== 0; ) + for (_ !== 0 && (b = _.toString(16) + b); b.length % g !== 0; ) b = "0" + b; return this.negative !== 0 && (b = "-" + b), b; } if (f === (f | 0) && f >= 2 && f <= 36) { - var I = A[f], B = M[f]; + var I = A[f], F = P[f]; b = ""; var ce = this.clone(); for (ce.negative = 0; !ce.isZero(); ) { - var D = ce.modrn(B).toString(f); - ce = ce.idivn(B), ce.isZero() ? b = D + b : b = w[I - D.length] + D + b; + var D = ce.modrn(F).toString(f); + ce = ce.idivn(F), ce.isZero() ? b = D + b : b = w[I - D.length] + D + b; } - for (this.isZero() && (b = "0" + b); b.length % p !== 0; ) + for (this.isZero() && (b = "0" + b); b.length % g !== 0; ) b = "0" + b; return this.negative !== 0 && (b = "-" + b), b; } @@ -9215,21 +9215,21 @@ zv.exports; return this.length === 2 ? f += this.words[1] * 67108864 : this.length === 3 && this.words[2] === 1 ? f += 4503599627370496 + this.words[1] * 67108864 : this.length > 2 && n(!1, "Number can only safely store up to 53 bits"), this.negative !== 0 ? -f : f; }, s.prototype.toJSON = function() { return this.toString(16, 2); - }, o && (s.prototype.toBuffer = function(f, p) { - return this.toArrayLike(o, f, p); - }), s.prototype.toArray = function(f, p) { - return this.toArrayLike(Array, f, p); + }, o && (s.prototype.toBuffer = function(f, g) { + return this.toArrayLike(o, f, g); + }), s.prototype.toArray = function(f, g) { + return this.toArrayLike(Array, f, g); }; - var N = function(f, p) { - return f.allocUnsafe ? f.allocUnsafe(p) : new f(p); + var N = function(f, g) { + return f.allocUnsafe ? f.allocUnsafe(g) : new f(g); }; - s.prototype.toArrayLike = function(f, p, b) { + s.prototype.toArrayLike = function(f, g, b) { this._strip(); var x = this.byteLength(), _ = b || Math.max(1, x); n(x <= _, "byte array longer than desired length"), n(_ > 0, "Requested array length <= 0"); - var E = N(f, _), v = p === "le" ? "LE" : "BE"; + var E = N(f, _), v = g === "le" ? "LE" : "BE"; return this["_toArrayLike" + v](E, x), E; - }, s.prototype._toArrayLikeLE = function(f, p) { + }, s.prototype._toArrayLikeLE = function(f, g) { for (var b = 0, x = 0, _ = 0, E = 0; _ < this.length; _++) { var v = this.words[_] << E | x; f[b++] = v & 255, b < f.length && (f[b++] = v >> 8 & 255), b < f.length && (f[b++] = v >> 16 & 255), E === 6 ? (b < f.length && (f[b++] = v >> 24 & 255), x = 0, E = 0) : (x = v >>> 24, E += 2); @@ -9237,7 +9237,7 @@ zv.exports; if (b < f.length) for (f[b++] = x; b < f.length; ) f[b++] = 0; - }, s.prototype._toArrayLikeBE = function(f, p) { + }, s.prototype._toArrayLikeBE = function(f, g) { for (var b = f.length - 1, x = 0, _ = 0, E = 0; _ < this.length; _++) { var v = this.words[_] << E | x; f[b--] = v & 255, b >= 0 && (f[b--] = v >> 8 & 255), b >= 0 && (f[b--] = v >> 16 & 255), E === 6 ? (b >= 0 && (f[b--] = v >> 24 & 255), x = 0, E = 0) : (x = v >>> 24, E += 2); @@ -9248,27 +9248,27 @@ zv.exports; }, Math.clz32 ? s.prototype._countBits = function(f) { return 32 - Math.clz32(f); } : s.prototype._countBits = function(f) { - var p = f, b = 0; - return p >= 4096 && (b += 13, p >>>= 13), p >= 64 && (b += 7, p >>>= 7), p >= 8 && (b += 4, p >>>= 4), p >= 2 && (b += 2, p >>>= 2), b + p; + var g = f, b = 0; + return g >= 4096 && (b += 13, g >>>= 13), g >= 64 && (b += 7, g >>>= 7), g >= 8 && (b += 4, g >>>= 4), g >= 2 && (b += 2, g >>>= 2), b + g; }, s.prototype._zeroBits = function(f) { if (f === 0) return 26; - var p = f, b = 0; - return p & 8191 || (b += 13, p >>>= 13), p & 127 || (b += 7, p >>>= 7), p & 15 || (b += 4, p >>>= 4), p & 3 || (b += 2, p >>>= 2), p & 1 || b++, b; + var g = f, b = 0; + return g & 8191 || (b += 13, g >>>= 13), g & 127 || (b += 7, g >>>= 7), g & 15 || (b += 4, g >>>= 4), g & 3 || (b += 2, g >>>= 2), g & 1 || b++, b; }, s.prototype.bitLength = function() { - var f = this.words[this.length - 1], p = this._countBits(f); - return (this.length - 1) * 26 + p; + var f = this.words[this.length - 1], g = this._countBits(f); + return (this.length - 1) * 26 + g; }; function L(m) { - for (var f = new Array(m.bitLength()), p = 0; p < f.length; p++) { - var b = p / 26 | 0, x = p % 26; - f[p] = m.words[b] >>> x & 1; + for (var f = new Array(m.bitLength()), g = 0; g < f.length; g++) { + var b = g / 26 | 0, x = g % 26; + f[g] = m.words[b] >>> x & 1; } return f; } s.prototype.zeroBits = function() { if (this.isZero()) return 0; - for (var f = 0, p = 0; p < this.length; p++) { - var b = this._zeroBits(this.words[p]); + for (var f = 0, g = 0; g < this.length; g++) { + var b = this._zeroBits(this.words[g]); if (f += b, b !== 26) break; } return f; @@ -9287,8 +9287,8 @@ zv.exports; }, s.prototype.iuor = function(f) { for (; this.length < f.length; ) this.words[this.length++] = 0; - for (var p = 0; p < f.length; p++) - this.words[p] = this.words[p] | f.words[p]; + for (var g = 0; g < f.length; g++) + this.words[g] = this.words[g] | f.words[g]; return this._strip(); }, s.prototype.ior = function(f) { return n((this.negative | f.negative) === 0), this.iuor(f); @@ -9297,11 +9297,11 @@ zv.exports; }, s.prototype.uor = function(f) { return this.length > f.length ? this.clone().iuor(f) : f.clone().iuor(this); }, s.prototype.iuand = function(f) { - var p; - this.length > f.length ? p = f : p = this; - for (var b = 0; b < p.length; b++) + var g; + this.length > f.length ? g = f : g = this; + for (var b = 0; b < g.length; b++) this.words[b] = this.words[b] & f.words[b]; - return this.length = p.length, this._strip(); + return this.length = g.length, this._strip(); }, s.prototype.iand = function(f) { return n((this.negative | f.negative) === 0), this.iuand(f); }, s.prototype.and = function(f) { @@ -9309,14 +9309,14 @@ zv.exports; }, s.prototype.uand = function(f) { return this.length > f.length ? this.clone().iuand(f) : f.clone().iuand(this); }, s.prototype.iuxor = function(f) { - var p, b; - this.length > f.length ? (p = this, b = f) : (p = f, b = this); + var g, b; + this.length > f.length ? (g = this, b = f) : (g = f, b = this); for (var x = 0; x < b.length; x++) - this.words[x] = p.words[x] ^ b.words[x]; - if (this !== p) - for (; x < p.length; x++) - this.words[x] = p.words[x]; - return this.length = p.length, this._strip(); + this.words[x] = g.words[x] ^ b.words[x]; + if (this !== g) + for (; x < g.length; x++) + this.words[x] = g.words[x]; + return this.length = g.length, this._strip(); }, s.prototype.ixor = function(f) { return n((this.negative | f.negative) === 0), this.iuxor(f); }, s.prototype.xor = function(f) { @@ -9325,29 +9325,29 @@ zv.exports; return this.length > f.length ? this.clone().iuxor(f) : f.clone().iuxor(this); }, s.prototype.inotn = function(f) { n(typeof f == "number" && f >= 0); - var p = Math.ceil(f / 26) | 0, b = f % 26; - this._expand(p), b > 0 && p--; - for (var x = 0; x < p; x++) + var g = Math.ceil(f / 26) | 0, b = f % 26; + this._expand(g), b > 0 && g--; + for (var x = 0; x < g; x++) this.words[x] = ~this.words[x] & 67108863; return b > 0 && (this.words[x] = ~this.words[x] & 67108863 >> 26 - b), this._strip(); }, s.prototype.notn = function(f) { return this.clone().inotn(f); - }, s.prototype.setn = function(f, p) { + }, s.prototype.setn = function(f, g) { n(typeof f == "number" && f >= 0); var b = f / 26 | 0, x = f % 26; - return this._expand(b + 1), p ? this.words[b] = this.words[b] | 1 << x : this.words[b] = this.words[b] & ~(1 << x), this._strip(); + return this._expand(b + 1), g ? this.words[b] = this.words[b] | 1 << x : this.words[b] = this.words[b] & ~(1 << x), this._strip(); }, s.prototype.iadd = function(f) { - var p; + var g; if (this.negative !== 0 && f.negative === 0) - return this.negative = 0, p = this.isub(f), this.negative ^= 1, this._normSign(); + return this.negative = 0, g = this.isub(f), this.negative ^= 1, this._normSign(); if (this.negative === 0 && f.negative !== 0) - return f.negative = 0, p = this.isub(f), f.negative = 1, p._normSign(); + return f.negative = 0, g = this.isub(f), f.negative = 1, g._normSign(); var b, x; this.length > f.length ? (b = this, x = f) : (b = f, x = this); for (var _ = 0, E = 0; E < x.length; E++) - p = (b.words[E] | 0) + (x.words[E] | 0) + _, this.words[E] = p & 67108863, _ = p >>> 26; + g = (b.words[E] | 0) + (x.words[E] | 0) + _, this.words[E] = g & 67108863, _ = g >>> 26; for (; _ !== 0 && E < b.length; E++) - p = (b.words[E] | 0) + _, this.words[E] = p & 67108863, _ = p >>> 26; + g = (b.words[E] | 0) + _, this.words[E] = g & 67108863, _ = g >>> 26; if (this.length = b.length, _ !== 0) this.words[this.length] = _, this.length++; else if (b !== this) @@ -9355,13 +9355,13 @@ zv.exports; this.words[E] = b.words[E]; return this; }, s.prototype.add = function(f) { - var p; - return f.negative !== 0 && this.negative === 0 ? (f.negative = 0, p = this.sub(f), f.negative ^= 1, p) : f.negative === 0 && this.negative !== 0 ? (this.negative = 0, p = f.sub(this), this.negative = 1, p) : this.length > f.length ? this.clone().iadd(f) : f.clone().iadd(this); + var g; + return f.negative !== 0 && this.negative === 0 ? (f.negative = 0, g = this.sub(f), f.negative ^= 1, g) : f.negative === 0 && this.negative !== 0 ? (this.negative = 0, g = f.sub(this), this.negative = 1, g) : this.length > f.length ? this.clone().iadd(f) : f.clone().iadd(this); }, s.prototype.isub = function(f) { if (f.negative !== 0) { f.negative = 0; - var p = this.iadd(f); - return f.negative = 1, p._normSign(); + var g = this.iadd(f); + return f.negative = 1, g._normSign(); } else if (this.negative !== 0) return this.negative = 0, this.iadd(f), this.negative = 1, this._normSign(); var b = this.cmp(f); @@ -9370,9 +9370,9 @@ zv.exports; var x, _; b > 0 ? (x = this, _ = f) : (x = f, _ = this); for (var E = 0, v = 0; v < _.length; v++) - p = (x.words[v] | 0) - (_.words[v] | 0) + E, E = p >> 26, this.words[v] = p & 67108863; + g = (x.words[v] | 0) - (_.words[v] | 0) + E, E = g >> 26, this.words[v] = g & 67108863; for (; E !== 0 && v < x.length; v++) - p = (x.words[v] | 0) + E, E = p >> 26, this.words[v] = p & 67108863; + g = (x.words[v] | 0) + E, E = g >> 26, this.words[v] = g & 67108863; if (E === 0 && v < x.length && x !== this) for (; v < x.length; v++) this.words[v] = x.words[v]; @@ -9380,99 +9380,99 @@ zv.exports; }, s.prototype.sub = function(f) { return this.clone().isub(f); }; - function $(m, f, p) { - p.negative = f.negative ^ m.negative; + function $(m, f, g) { + g.negative = f.negative ^ m.negative; var b = m.length + f.length | 0; - p.length = b, b = b - 1 | 0; - var x = m.words[0] | 0, _ = f.words[0] | 0, E = x * _, v = E & 67108863, P = E / 67108864 | 0; - p.words[0] = v; + g.length = b, b = b - 1 | 0; + var x = m.words[0] | 0, _ = f.words[0] | 0, E = x * _, v = E & 67108863, M = E / 67108864 | 0; + g.words[0] = v; for (var I = 1; I < b; I++) { - for (var B = P >>> 26, ce = P & 67108863, D = Math.min(I, f.length - 1), oe = Math.max(0, I - m.length + 1); oe <= D; oe++) { + for (var F = M >>> 26, ce = M & 67108863, D = Math.min(I, f.length - 1), oe = Math.max(0, I - m.length + 1); oe <= D; oe++) { var Z = I - oe | 0; - x = m.words[Z] | 0, _ = f.words[oe] | 0, E = x * _ + ce, B += E / 67108864 | 0, ce = E & 67108863; - } - p.words[I] = ce | 0, P = B | 0; - } - return P !== 0 ? p.words[I] = P | 0 : p.length--, p._strip(); - } - var F = function(f, p, b) { - var x = f.words, _ = p.words, E = b.words, v = 0, P, I, B, ce = x[0] | 0, D = ce & 8191, oe = ce >>> 13, Z = x[1] | 0, J = Z & 8191, Q = Z >>> 13, T = x[2] | 0, X = T & 8191, re = T >>> 13, de = x[3] | 0, ie = de & 8191, ue = de >>> 13, ve = x[4] | 0, Pe = ve & 8191, De = ve >>> 13, Ce = x[5] | 0, $e = Ce & 8191, Me = Ce >>> 13, Ne = x[6] | 0, Ke = Ne & 8191, Le = Ne >>> 13, qe = x[7] | 0, ze = qe & 8191, _e = qe >>> 13, Ze = x[8] | 0, at = Ze & 8191, ke = Ze >>> 13, Qe = x[9] | 0, tt = Qe & 8191, Ye = Qe >>> 13, dt = _[0] | 0, lt = dt & 8191, ct = dt >>> 13, qt = _[1] | 0, Yt = qt & 8191, Et = qt >>> 13, Qt = _[2] | 0, Jt = Qt & 8191, Dt = Qt >>> 13, kt = _[3] | 0, Ct = kt & 8191, gt = kt >>> 13, Rt = _[4] | 0, Nt = Rt & 8191, vt = Rt >>> 13, $t = _[5] | 0, Bt = $t & 8191, rt = $t >>> 13, Ft = _[6] | 0, k = Ft & 8191, j = Ft >>> 13, z = _[7] | 0, C = z & 8191, G = z >>> 13, U = _[8] | 0, se = U & 8191, he = U >>> 13, xe = _[9] | 0, Te = xe & 8191, Re = xe >>> 13; - b.negative = f.negative ^ p.negative, b.length = 19, P = Math.imul(D, lt), I = Math.imul(D, ct), I = I + Math.imul(oe, lt) | 0, B = Math.imul(oe, ct); - var nt = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (B + (I >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, P = Math.imul(J, lt), I = Math.imul(J, ct), I = I + Math.imul(Q, lt) | 0, B = Math.imul(Q, ct), P = P + Math.imul(D, Yt) | 0, I = I + Math.imul(D, Et) | 0, I = I + Math.imul(oe, Yt) | 0, B = B + Math.imul(oe, Et) | 0; - var Ue = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (B + (I >>> 13) | 0) + (Ue >>> 26) | 0, Ue &= 67108863, P = Math.imul(X, lt), I = Math.imul(X, ct), I = I + Math.imul(re, lt) | 0, B = Math.imul(re, ct), P = P + Math.imul(J, Yt) | 0, I = I + Math.imul(J, Et) | 0, I = I + Math.imul(Q, Yt) | 0, B = B + Math.imul(Q, Et) | 0, P = P + Math.imul(D, Jt) | 0, I = I + Math.imul(D, Dt) | 0, I = I + Math.imul(oe, Jt) | 0, B = B + Math.imul(oe, Dt) | 0; - var pt = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (B + (I >>> 13) | 0) + (pt >>> 26) | 0, pt &= 67108863, P = Math.imul(ie, lt), I = Math.imul(ie, ct), I = I + Math.imul(ue, lt) | 0, B = Math.imul(ue, ct), P = P + Math.imul(X, Yt) | 0, I = I + Math.imul(X, Et) | 0, I = I + Math.imul(re, Yt) | 0, B = B + Math.imul(re, Et) | 0, P = P + Math.imul(J, Jt) | 0, I = I + Math.imul(J, Dt) | 0, I = I + Math.imul(Q, Jt) | 0, B = B + Math.imul(Q, Dt) | 0, P = P + Math.imul(D, Ct) | 0, I = I + Math.imul(D, gt) | 0, I = I + Math.imul(oe, Ct) | 0, B = B + Math.imul(oe, gt) | 0; - var it = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (B + (I >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, P = Math.imul(Pe, lt), I = Math.imul(Pe, ct), I = I + Math.imul(De, lt) | 0, B = Math.imul(De, ct), P = P + Math.imul(ie, Yt) | 0, I = I + Math.imul(ie, Et) | 0, I = I + Math.imul(ue, Yt) | 0, B = B + Math.imul(ue, Et) | 0, P = P + Math.imul(X, Jt) | 0, I = I + Math.imul(X, Dt) | 0, I = I + Math.imul(re, Jt) | 0, B = B + Math.imul(re, Dt) | 0, P = P + Math.imul(J, Ct) | 0, I = I + Math.imul(J, gt) | 0, I = I + Math.imul(Q, Ct) | 0, B = B + Math.imul(Q, gt) | 0, P = P + Math.imul(D, Nt) | 0, I = I + Math.imul(D, vt) | 0, I = I + Math.imul(oe, Nt) | 0, B = B + Math.imul(oe, vt) | 0; - var et = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (B + (I >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, P = Math.imul($e, lt), I = Math.imul($e, ct), I = I + Math.imul(Me, lt) | 0, B = Math.imul(Me, ct), P = P + Math.imul(Pe, Yt) | 0, I = I + Math.imul(Pe, Et) | 0, I = I + Math.imul(De, Yt) | 0, B = B + Math.imul(De, Et) | 0, P = P + Math.imul(ie, Jt) | 0, I = I + Math.imul(ie, Dt) | 0, I = I + Math.imul(ue, Jt) | 0, B = B + Math.imul(ue, Dt) | 0, P = P + Math.imul(X, Ct) | 0, I = I + Math.imul(X, gt) | 0, I = I + Math.imul(re, Ct) | 0, B = B + Math.imul(re, gt) | 0, P = P + Math.imul(J, Nt) | 0, I = I + Math.imul(J, vt) | 0, I = I + Math.imul(Q, Nt) | 0, B = B + Math.imul(Q, vt) | 0, P = P + Math.imul(D, Bt) | 0, I = I + Math.imul(D, rt) | 0, I = I + Math.imul(oe, Bt) | 0, B = B + Math.imul(oe, rt) | 0; - var St = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (B + (I >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, P = Math.imul(Ke, lt), I = Math.imul(Ke, ct), I = I + Math.imul(Le, lt) | 0, B = Math.imul(Le, ct), P = P + Math.imul($e, Yt) | 0, I = I + Math.imul($e, Et) | 0, I = I + Math.imul(Me, Yt) | 0, B = B + Math.imul(Me, Et) | 0, P = P + Math.imul(Pe, Jt) | 0, I = I + Math.imul(Pe, Dt) | 0, I = I + Math.imul(De, Jt) | 0, B = B + Math.imul(De, Dt) | 0, P = P + Math.imul(ie, Ct) | 0, I = I + Math.imul(ie, gt) | 0, I = I + Math.imul(ue, Ct) | 0, B = B + Math.imul(ue, gt) | 0, P = P + Math.imul(X, Nt) | 0, I = I + Math.imul(X, vt) | 0, I = I + Math.imul(re, Nt) | 0, B = B + Math.imul(re, vt) | 0, P = P + Math.imul(J, Bt) | 0, I = I + Math.imul(J, rt) | 0, I = I + Math.imul(Q, Bt) | 0, B = B + Math.imul(Q, rt) | 0, P = P + Math.imul(D, k) | 0, I = I + Math.imul(D, j) | 0, I = I + Math.imul(oe, k) | 0, B = B + Math.imul(oe, j) | 0; - var Tt = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (B + (I >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, P = Math.imul(ze, lt), I = Math.imul(ze, ct), I = I + Math.imul(_e, lt) | 0, B = Math.imul(_e, ct), P = P + Math.imul(Ke, Yt) | 0, I = I + Math.imul(Ke, Et) | 0, I = I + Math.imul(Le, Yt) | 0, B = B + Math.imul(Le, Et) | 0, P = P + Math.imul($e, Jt) | 0, I = I + Math.imul($e, Dt) | 0, I = I + Math.imul(Me, Jt) | 0, B = B + Math.imul(Me, Dt) | 0, P = P + Math.imul(Pe, Ct) | 0, I = I + Math.imul(Pe, gt) | 0, I = I + Math.imul(De, Ct) | 0, B = B + Math.imul(De, gt) | 0, P = P + Math.imul(ie, Nt) | 0, I = I + Math.imul(ie, vt) | 0, I = I + Math.imul(ue, Nt) | 0, B = B + Math.imul(ue, vt) | 0, P = P + Math.imul(X, Bt) | 0, I = I + Math.imul(X, rt) | 0, I = I + Math.imul(re, Bt) | 0, B = B + Math.imul(re, rt) | 0, P = P + Math.imul(J, k) | 0, I = I + Math.imul(J, j) | 0, I = I + Math.imul(Q, k) | 0, B = B + Math.imul(Q, j) | 0, P = P + Math.imul(D, C) | 0, I = I + Math.imul(D, G) | 0, I = I + Math.imul(oe, C) | 0, B = B + Math.imul(oe, G) | 0; - var At = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (B + (I >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, P = Math.imul(at, lt), I = Math.imul(at, ct), I = I + Math.imul(ke, lt) | 0, B = Math.imul(ke, ct), P = P + Math.imul(ze, Yt) | 0, I = I + Math.imul(ze, Et) | 0, I = I + Math.imul(_e, Yt) | 0, B = B + Math.imul(_e, Et) | 0, P = P + Math.imul(Ke, Jt) | 0, I = I + Math.imul(Ke, Dt) | 0, I = I + Math.imul(Le, Jt) | 0, B = B + Math.imul(Le, Dt) | 0, P = P + Math.imul($e, Ct) | 0, I = I + Math.imul($e, gt) | 0, I = I + Math.imul(Me, Ct) | 0, B = B + Math.imul(Me, gt) | 0, P = P + Math.imul(Pe, Nt) | 0, I = I + Math.imul(Pe, vt) | 0, I = I + Math.imul(De, Nt) | 0, B = B + Math.imul(De, vt) | 0, P = P + Math.imul(ie, Bt) | 0, I = I + Math.imul(ie, rt) | 0, I = I + Math.imul(ue, Bt) | 0, B = B + Math.imul(ue, rt) | 0, P = P + Math.imul(X, k) | 0, I = I + Math.imul(X, j) | 0, I = I + Math.imul(re, k) | 0, B = B + Math.imul(re, j) | 0, P = P + Math.imul(J, C) | 0, I = I + Math.imul(J, G) | 0, I = I + Math.imul(Q, C) | 0, B = B + Math.imul(Q, G) | 0, P = P + Math.imul(D, se) | 0, I = I + Math.imul(D, he) | 0, I = I + Math.imul(oe, se) | 0, B = B + Math.imul(oe, he) | 0; - var _t = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (B + (I >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, P = Math.imul(tt, lt), I = Math.imul(tt, ct), I = I + Math.imul(Ye, lt) | 0, B = Math.imul(Ye, ct), P = P + Math.imul(at, Yt) | 0, I = I + Math.imul(at, Et) | 0, I = I + Math.imul(ke, Yt) | 0, B = B + Math.imul(ke, Et) | 0, P = P + Math.imul(ze, Jt) | 0, I = I + Math.imul(ze, Dt) | 0, I = I + Math.imul(_e, Jt) | 0, B = B + Math.imul(_e, Dt) | 0, P = P + Math.imul(Ke, Ct) | 0, I = I + Math.imul(Ke, gt) | 0, I = I + Math.imul(Le, Ct) | 0, B = B + Math.imul(Le, gt) | 0, P = P + Math.imul($e, Nt) | 0, I = I + Math.imul($e, vt) | 0, I = I + Math.imul(Me, Nt) | 0, B = B + Math.imul(Me, vt) | 0, P = P + Math.imul(Pe, Bt) | 0, I = I + Math.imul(Pe, rt) | 0, I = I + Math.imul(De, Bt) | 0, B = B + Math.imul(De, rt) | 0, P = P + Math.imul(ie, k) | 0, I = I + Math.imul(ie, j) | 0, I = I + Math.imul(ue, k) | 0, B = B + Math.imul(ue, j) | 0, P = P + Math.imul(X, C) | 0, I = I + Math.imul(X, G) | 0, I = I + Math.imul(re, C) | 0, B = B + Math.imul(re, G) | 0, P = P + Math.imul(J, se) | 0, I = I + Math.imul(J, he) | 0, I = I + Math.imul(Q, se) | 0, B = B + Math.imul(Q, he) | 0, P = P + Math.imul(D, Te) | 0, I = I + Math.imul(D, Re) | 0, I = I + Math.imul(oe, Te) | 0, B = B + Math.imul(oe, Re) | 0; - var ht = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (B + (I >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, P = Math.imul(tt, Yt), I = Math.imul(tt, Et), I = I + Math.imul(Ye, Yt) | 0, B = Math.imul(Ye, Et), P = P + Math.imul(at, Jt) | 0, I = I + Math.imul(at, Dt) | 0, I = I + Math.imul(ke, Jt) | 0, B = B + Math.imul(ke, Dt) | 0, P = P + Math.imul(ze, Ct) | 0, I = I + Math.imul(ze, gt) | 0, I = I + Math.imul(_e, Ct) | 0, B = B + Math.imul(_e, gt) | 0, P = P + Math.imul(Ke, Nt) | 0, I = I + Math.imul(Ke, vt) | 0, I = I + Math.imul(Le, Nt) | 0, B = B + Math.imul(Le, vt) | 0, P = P + Math.imul($e, Bt) | 0, I = I + Math.imul($e, rt) | 0, I = I + Math.imul(Me, Bt) | 0, B = B + Math.imul(Me, rt) | 0, P = P + Math.imul(Pe, k) | 0, I = I + Math.imul(Pe, j) | 0, I = I + Math.imul(De, k) | 0, B = B + Math.imul(De, j) | 0, P = P + Math.imul(ie, C) | 0, I = I + Math.imul(ie, G) | 0, I = I + Math.imul(ue, C) | 0, B = B + Math.imul(ue, G) | 0, P = P + Math.imul(X, se) | 0, I = I + Math.imul(X, he) | 0, I = I + Math.imul(re, se) | 0, B = B + Math.imul(re, he) | 0, P = P + Math.imul(J, Te) | 0, I = I + Math.imul(J, Re) | 0, I = I + Math.imul(Q, Te) | 0, B = B + Math.imul(Q, Re) | 0; - var xt = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (B + (I >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, P = Math.imul(tt, Jt), I = Math.imul(tt, Dt), I = I + Math.imul(Ye, Jt) | 0, B = Math.imul(Ye, Dt), P = P + Math.imul(at, Ct) | 0, I = I + Math.imul(at, gt) | 0, I = I + Math.imul(ke, Ct) | 0, B = B + Math.imul(ke, gt) | 0, P = P + Math.imul(ze, Nt) | 0, I = I + Math.imul(ze, vt) | 0, I = I + Math.imul(_e, Nt) | 0, B = B + Math.imul(_e, vt) | 0, P = P + Math.imul(Ke, Bt) | 0, I = I + Math.imul(Ke, rt) | 0, I = I + Math.imul(Le, Bt) | 0, B = B + Math.imul(Le, rt) | 0, P = P + Math.imul($e, k) | 0, I = I + Math.imul($e, j) | 0, I = I + Math.imul(Me, k) | 0, B = B + Math.imul(Me, j) | 0, P = P + Math.imul(Pe, C) | 0, I = I + Math.imul(Pe, G) | 0, I = I + Math.imul(De, C) | 0, B = B + Math.imul(De, G) | 0, P = P + Math.imul(ie, se) | 0, I = I + Math.imul(ie, he) | 0, I = I + Math.imul(ue, se) | 0, B = B + Math.imul(ue, he) | 0, P = P + Math.imul(X, Te) | 0, I = I + Math.imul(X, Re) | 0, I = I + Math.imul(re, Te) | 0, B = B + Math.imul(re, Re) | 0; - var st = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (B + (I >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, P = Math.imul(tt, Ct), I = Math.imul(tt, gt), I = I + Math.imul(Ye, Ct) | 0, B = Math.imul(Ye, gt), P = P + Math.imul(at, Nt) | 0, I = I + Math.imul(at, vt) | 0, I = I + Math.imul(ke, Nt) | 0, B = B + Math.imul(ke, vt) | 0, P = P + Math.imul(ze, Bt) | 0, I = I + Math.imul(ze, rt) | 0, I = I + Math.imul(_e, Bt) | 0, B = B + Math.imul(_e, rt) | 0, P = P + Math.imul(Ke, k) | 0, I = I + Math.imul(Ke, j) | 0, I = I + Math.imul(Le, k) | 0, B = B + Math.imul(Le, j) | 0, P = P + Math.imul($e, C) | 0, I = I + Math.imul($e, G) | 0, I = I + Math.imul(Me, C) | 0, B = B + Math.imul(Me, G) | 0, P = P + Math.imul(Pe, se) | 0, I = I + Math.imul(Pe, he) | 0, I = I + Math.imul(De, se) | 0, B = B + Math.imul(De, he) | 0, P = P + Math.imul(ie, Te) | 0, I = I + Math.imul(ie, Re) | 0, I = I + Math.imul(ue, Te) | 0, B = B + Math.imul(ue, Re) | 0; - var bt = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (B + (I >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, P = Math.imul(tt, Nt), I = Math.imul(tt, vt), I = I + Math.imul(Ye, Nt) | 0, B = Math.imul(Ye, vt), P = P + Math.imul(at, Bt) | 0, I = I + Math.imul(at, rt) | 0, I = I + Math.imul(ke, Bt) | 0, B = B + Math.imul(ke, rt) | 0, P = P + Math.imul(ze, k) | 0, I = I + Math.imul(ze, j) | 0, I = I + Math.imul(_e, k) | 0, B = B + Math.imul(_e, j) | 0, P = P + Math.imul(Ke, C) | 0, I = I + Math.imul(Ke, G) | 0, I = I + Math.imul(Le, C) | 0, B = B + Math.imul(Le, G) | 0, P = P + Math.imul($e, se) | 0, I = I + Math.imul($e, he) | 0, I = I + Math.imul(Me, se) | 0, B = B + Math.imul(Me, he) | 0, P = P + Math.imul(Pe, Te) | 0, I = I + Math.imul(Pe, Re) | 0, I = I + Math.imul(De, Te) | 0, B = B + Math.imul(De, Re) | 0; - var ut = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (B + (I >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, P = Math.imul(tt, Bt), I = Math.imul(tt, rt), I = I + Math.imul(Ye, Bt) | 0, B = Math.imul(Ye, rt), P = P + Math.imul(at, k) | 0, I = I + Math.imul(at, j) | 0, I = I + Math.imul(ke, k) | 0, B = B + Math.imul(ke, j) | 0, P = P + Math.imul(ze, C) | 0, I = I + Math.imul(ze, G) | 0, I = I + Math.imul(_e, C) | 0, B = B + Math.imul(_e, G) | 0, P = P + Math.imul(Ke, se) | 0, I = I + Math.imul(Ke, he) | 0, I = I + Math.imul(Le, se) | 0, B = B + Math.imul(Le, he) | 0, P = P + Math.imul($e, Te) | 0, I = I + Math.imul($e, Re) | 0, I = I + Math.imul(Me, Te) | 0, B = B + Math.imul(Me, Re) | 0; - var ot = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (B + (I >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, P = Math.imul(tt, k), I = Math.imul(tt, j), I = I + Math.imul(Ye, k) | 0, B = Math.imul(Ye, j), P = P + Math.imul(at, C) | 0, I = I + Math.imul(at, G) | 0, I = I + Math.imul(ke, C) | 0, B = B + Math.imul(ke, G) | 0, P = P + Math.imul(ze, se) | 0, I = I + Math.imul(ze, he) | 0, I = I + Math.imul(_e, se) | 0, B = B + Math.imul(_e, he) | 0, P = P + Math.imul(Ke, Te) | 0, I = I + Math.imul(Ke, Re) | 0, I = I + Math.imul(Le, Te) | 0, B = B + Math.imul(Le, Re) | 0; - var Se = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (B + (I >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, P = Math.imul(tt, C), I = Math.imul(tt, G), I = I + Math.imul(Ye, C) | 0, B = Math.imul(Ye, G), P = P + Math.imul(at, se) | 0, I = I + Math.imul(at, he) | 0, I = I + Math.imul(ke, se) | 0, B = B + Math.imul(ke, he) | 0, P = P + Math.imul(ze, Te) | 0, I = I + Math.imul(ze, Re) | 0, I = I + Math.imul(_e, Te) | 0, B = B + Math.imul(_e, Re) | 0; - var Ae = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (B + (I >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, P = Math.imul(tt, se), I = Math.imul(tt, he), I = I + Math.imul(Ye, se) | 0, B = Math.imul(Ye, he), P = P + Math.imul(at, Te) | 0, I = I + Math.imul(at, Re) | 0, I = I + Math.imul(ke, Te) | 0, B = B + Math.imul(ke, Re) | 0; - var Ve = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (B + (I >>> 13) | 0) + (Ve >>> 26) | 0, Ve &= 67108863, P = Math.imul(tt, Te), I = Math.imul(tt, Re), I = I + Math.imul(Ye, Te) | 0, B = Math.imul(Ye, Re); - var Be = (v + P | 0) + ((I & 8191) << 13) | 0; - return v = (B + (I >>> 13) | 0) + (Be >>> 26) | 0, Be &= 67108863, E[0] = nt, E[1] = Ue, E[2] = pt, E[3] = it, E[4] = et, E[5] = St, E[6] = Tt, E[7] = At, E[8] = _t, E[9] = ht, E[10] = xt, E[11] = st, E[12] = bt, E[13] = ut, E[14] = ot, E[15] = Se, E[16] = Ae, E[17] = Ve, E[18] = Be, v !== 0 && (E[19] = v, b.length++), b; + x = m.words[Z] | 0, _ = f.words[oe] | 0, E = x * _ + ce, F += E / 67108864 | 0, ce = E & 67108863; + } + g.words[I] = ce | 0, M = F | 0; + } + return M !== 0 ? g.words[I] = M | 0 : g.length--, g._strip(); + } + var B = function(f, g, b) { + var x = f.words, _ = g.words, E = b.words, v = 0, M, I, F, ce = x[0] | 0, D = ce & 8191, oe = ce >>> 13, Z = x[1] | 0, J = Z & 8191, Q = Z >>> 13, T = x[2] | 0, X = T & 8191, re = T >>> 13, pe = x[3] | 0, ie = pe & 8191, ue = pe >>> 13, ve = x[4] | 0, Pe = ve & 8191, De = ve >>> 13, Ce = x[5] | 0, $e = Ce & 8191, Me = Ce >>> 13, Ne = x[6] | 0, Ke = Ne & 8191, Le = Ne >>> 13, qe = x[7] | 0, ze = qe & 8191, _e = qe >>> 13, Ze = x[8] | 0, at = Ze & 8191, ke = Ze >>> 13, Qe = x[9] | 0, tt = Qe & 8191, Ye = Qe >>> 13, dt = _[0] | 0, lt = dt & 8191, ct = dt >>> 13, qt = _[1] | 0, Jt = qt & 8191, Et = qt >>> 13, er = _[2] | 0, Xt = er & 8191, Dt = er >>> 13, kt = _[3] | 0, Ct = kt & 8191, gt = kt >>> 13, Rt = _[4] | 0, Nt = Rt & 8191, vt = Rt >>> 13, $t = _[5] | 0, Ft = $t & 8191, rt = $t >>> 13, Bt = _[6] | 0, k = Bt & 8191, U = Bt >>> 13, z = _[7] | 0, C = z & 8191, G = z >>> 13, j = _[8] | 0, se = j & 8191, de = j >>> 13, xe = _[9] | 0, Te = xe & 8191, Re = xe >>> 13; + b.negative = f.negative ^ g.negative, b.length = 19, M = Math.imul(D, lt), I = Math.imul(D, ct), I = I + Math.imul(oe, lt) | 0, F = Math.imul(oe, ct); + var nt = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, M = Math.imul(J, lt), I = Math.imul(J, ct), I = I + Math.imul(Q, lt) | 0, F = Math.imul(Q, ct), M = M + Math.imul(D, Jt) | 0, I = I + Math.imul(D, Et) | 0, I = I + Math.imul(oe, Jt) | 0, F = F + Math.imul(oe, Et) | 0; + var je = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (je >>> 26) | 0, je &= 67108863, M = Math.imul(X, lt), I = Math.imul(X, ct), I = I + Math.imul(re, lt) | 0, F = Math.imul(re, ct), M = M + Math.imul(J, Jt) | 0, I = I + Math.imul(J, Et) | 0, I = I + Math.imul(Q, Jt) | 0, F = F + Math.imul(Q, Et) | 0, M = M + Math.imul(D, Xt) | 0, I = I + Math.imul(D, Dt) | 0, I = I + Math.imul(oe, Xt) | 0, F = F + Math.imul(oe, Dt) | 0; + var pt = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (pt >>> 26) | 0, pt &= 67108863, M = Math.imul(ie, lt), I = Math.imul(ie, ct), I = I + Math.imul(ue, lt) | 0, F = Math.imul(ue, ct), M = M + Math.imul(X, Jt) | 0, I = I + Math.imul(X, Et) | 0, I = I + Math.imul(re, Jt) | 0, F = F + Math.imul(re, Et) | 0, M = M + Math.imul(J, Xt) | 0, I = I + Math.imul(J, Dt) | 0, I = I + Math.imul(Q, Xt) | 0, F = F + Math.imul(Q, Dt) | 0, M = M + Math.imul(D, Ct) | 0, I = I + Math.imul(D, gt) | 0, I = I + Math.imul(oe, Ct) | 0, F = F + Math.imul(oe, gt) | 0; + var it = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, M = Math.imul(Pe, lt), I = Math.imul(Pe, ct), I = I + Math.imul(De, lt) | 0, F = Math.imul(De, ct), M = M + Math.imul(ie, Jt) | 0, I = I + Math.imul(ie, Et) | 0, I = I + Math.imul(ue, Jt) | 0, F = F + Math.imul(ue, Et) | 0, M = M + Math.imul(X, Xt) | 0, I = I + Math.imul(X, Dt) | 0, I = I + Math.imul(re, Xt) | 0, F = F + Math.imul(re, Dt) | 0, M = M + Math.imul(J, Ct) | 0, I = I + Math.imul(J, gt) | 0, I = I + Math.imul(Q, Ct) | 0, F = F + Math.imul(Q, gt) | 0, M = M + Math.imul(D, Nt) | 0, I = I + Math.imul(D, vt) | 0, I = I + Math.imul(oe, Nt) | 0, F = F + Math.imul(oe, vt) | 0; + var et = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, M = Math.imul($e, lt), I = Math.imul($e, ct), I = I + Math.imul(Me, lt) | 0, F = Math.imul(Me, ct), M = M + Math.imul(Pe, Jt) | 0, I = I + Math.imul(Pe, Et) | 0, I = I + Math.imul(De, Jt) | 0, F = F + Math.imul(De, Et) | 0, M = M + Math.imul(ie, Xt) | 0, I = I + Math.imul(ie, Dt) | 0, I = I + Math.imul(ue, Xt) | 0, F = F + Math.imul(ue, Dt) | 0, M = M + Math.imul(X, Ct) | 0, I = I + Math.imul(X, gt) | 0, I = I + Math.imul(re, Ct) | 0, F = F + Math.imul(re, gt) | 0, M = M + Math.imul(J, Nt) | 0, I = I + Math.imul(J, vt) | 0, I = I + Math.imul(Q, Nt) | 0, F = F + Math.imul(Q, vt) | 0, M = M + Math.imul(D, Ft) | 0, I = I + Math.imul(D, rt) | 0, I = I + Math.imul(oe, Ft) | 0, F = F + Math.imul(oe, rt) | 0; + var St = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, M = Math.imul(Ke, lt), I = Math.imul(Ke, ct), I = I + Math.imul(Le, lt) | 0, F = Math.imul(Le, ct), M = M + Math.imul($e, Jt) | 0, I = I + Math.imul($e, Et) | 0, I = I + Math.imul(Me, Jt) | 0, F = F + Math.imul(Me, Et) | 0, M = M + Math.imul(Pe, Xt) | 0, I = I + Math.imul(Pe, Dt) | 0, I = I + Math.imul(De, Xt) | 0, F = F + Math.imul(De, Dt) | 0, M = M + Math.imul(ie, Ct) | 0, I = I + Math.imul(ie, gt) | 0, I = I + Math.imul(ue, Ct) | 0, F = F + Math.imul(ue, gt) | 0, M = M + Math.imul(X, Nt) | 0, I = I + Math.imul(X, vt) | 0, I = I + Math.imul(re, Nt) | 0, F = F + Math.imul(re, vt) | 0, M = M + Math.imul(J, Ft) | 0, I = I + Math.imul(J, rt) | 0, I = I + Math.imul(Q, Ft) | 0, F = F + Math.imul(Q, rt) | 0, M = M + Math.imul(D, k) | 0, I = I + Math.imul(D, U) | 0, I = I + Math.imul(oe, k) | 0, F = F + Math.imul(oe, U) | 0; + var Tt = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, M = Math.imul(ze, lt), I = Math.imul(ze, ct), I = I + Math.imul(_e, lt) | 0, F = Math.imul(_e, ct), M = M + Math.imul(Ke, Jt) | 0, I = I + Math.imul(Ke, Et) | 0, I = I + Math.imul(Le, Jt) | 0, F = F + Math.imul(Le, Et) | 0, M = M + Math.imul($e, Xt) | 0, I = I + Math.imul($e, Dt) | 0, I = I + Math.imul(Me, Xt) | 0, F = F + Math.imul(Me, Dt) | 0, M = M + Math.imul(Pe, Ct) | 0, I = I + Math.imul(Pe, gt) | 0, I = I + Math.imul(De, Ct) | 0, F = F + Math.imul(De, gt) | 0, M = M + Math.imul(ie, Nt) | 0, I = I + Math.imul(ie, vt) | 0, I = I + Math.imul(ue, Nt) | 0, F = F + Math.imul(ue, vt) | 0, M = M + Math.imul(X, Ft) | 0, I = I + Math.imul(X, rt) | 0, I = I + Math.imul(re, Ft) | 0, F = F + Math.imul(re, rt) | 0, M = M + Math.imul(J, k) | 0, I = I + Math.imul(J, U) | 0, I = I + Math.imul(Q, k) | 0, F = F + Math.imul(Q, U) | 0, M = M + Math.imul(D, C) | 0, I = I + Math.imul(D, G) | 0, I = I + Math.imul(oe, C) | 0, F = F + Math.imul(oe, G) | 0; + var At = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, M = Math.imul(at, lt), I = Math.imul(at, ct), I = I + Math.imul(ke, lt) | 0, F = Math.imul(ke, ct), M = M + Math.imul(ze, Jt) | 0, I = I + Math.imul(ze, Et) | 0, I = I + Math.imul(_e, Jt) | 0, F = F + Math.imul(_e, Et) | 0, M = M + Math.imul(Ke, Xt) | 0, I = I + Math.imul(Ke, Dt) | 0, I = I + Math.imul(Le, Xt) | 0, F = F + Math.imul(Le, Dt) | 0, M = M + Math.imul($e, Ct) | 0, I = I + Math.imul($e, gt) | 0, I = I + Math.imul(Me, Ct) | 0, F = F + Math.imul(Me, gt) | 0, M = M + Math.imul(Pe, Nt) | 0, I = I + Math.imul(Pe, vt) | 0, I = I + Math.imul(De, Nt) | 0, F = F + Math.imul(De, vt) | 0, M = M + Math.imul(ie, Ft) | 0, I = I + Math.imul(ie, rt) | 0, I = I + Math.imul(ue, Ft) | 0, F = F + Math.imul(ue, rt) | 0, M = M + Math.imul(X, k) | 0, I = I + Math.imul(X, U) | 0, I = I + Math.imul(re, k) | 0, F = F + Math.imul(re, U) | 0, M = M + Math.imul(J, C) | 0, I = I + Math.imul(J, G) | 0, I = I + Math.imul(Q, C) | 0, F = F + Math.imul(Q, G) | 0, M = M + Math.imul(D, se) | 0, I = I + Math.imul(D, de) | 0, I = I + Math.imul(oe, se) | 0, F = F + Math.imul(oe, de) | 0; + var _t = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, M = Math.imul(tt, lt), I = Math.imul(tt, ct), I = I + Math.imul(Ye, lt) | 0, F = Math.imul(Ye, ct), M = M + Math.imul(at, Jt) | 0, I = I + Math.imul(at, Et) | 0, I = I + Math.imul(ke, Jt) | 0, F = F + Math.imul(ke, Et) | 0, M = M + Math.imul(ze, Xt) | 0, I = I + Math.imul(ze, Dt) | 0, I = I + Math.imul(_e, Xt) | 0, F = F + Math.imul(_e, Dt) | 0, M = M + Math.imul(Ke, Ct) | 0, I = I + Math.imul(Ke, gt) | 0, I = I + Math.imul(Le, Ct) | 0, F = F + Math.imul(Le, gt) | 0, M = M + Math.imul($e, Nt) | 0, I = I + Math.imul($e, vt) | 0, I = I + Math.imul(Me, Nt) | 0, F = F + Math.imul(Me, vt) | 0, M = M + Math.imul(Pe, Ft) | 0, I = I + Math.imul(Pe, rt) | 0, I = I + Math.imul(De, Ft) | 0, F = F + Math.imul(De, rt) | 0, M = M + Math.imul(ie, k) | 0, I = I + Math.imul(ie, U) | 0, I = I + Math.imul(ue, k) | 0, F = F + Math.imul(ue, U) | 0, M = M + Math.imul(X, C) | 0, I = I + Math.imul(X, G) | 0, I = I + Math.imul(re, C) | 0, F = F + Math.imul(re, G) | 0, M = M + Math.imul(J, se) | 0, I = I + Math.imul(J, de) | 0, I = I + Math.imul(Q, se) | 0, F = F + Math.imul(Q, de) | 0, M = M + Math.imul(D, Te) | 0, I = I + Math.imul(D, Re) | 0, I = I + Math.imul(oe, Te) | 0, F = F + Math.imul(oe, Re) | 0; + var ht = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, M = Math.imul(tt, Jt), I = Math.imul(tt, Et), I = I + Math.imul(Ye, Jt) | 0, F = Math.imul(Ye, Et), M = M + Math.imul(at, Xt) | 0, I = I + Math.imul(at, Dt) | 0, I = I + Math.imul(ke, Xt) | 0, F = F + Math.imul(ke, Dt) | 0, M = M + Math.imul(ze, Ct) | 0, I = I + Math.imul(ze, gt) | 0, I = I + Math.imul(_e, Ct) | 0, F = F + Math.imul(_e, gt) | 0, M = M + Math.imul(Ke, Nt) | 0, I = I + Math.imul(Ke, vt) | 0, I = I + Math.imul(Le, Nt) | 0, F = F + Math.imul(Le, vt) | 0, M = M + Math.imul($e, Ft) | 0, I = I + Math.imul($e, rt) | 0, I = I + Math.imul(Me, Ft) | 0, F = F + Math.imul(Me, rt) | 0, M = M + Math.imul(Pe, k) | 0, I = I + Math.imul(Pe, U) | 0, I = I + Math.imul(De, k) | 0, F = F + Math.imul(De, U) | 0, M = M + Math.imul(ie, C) | 0, I = I + Math.imul(ie, G) | 0, I = I + Math.imul(ue, C) | 0, F = F + Math.imul(ue, G) | 0, M = M + Math.imul(X, se) | 0, I = I + Math.imul(X, de) | 0, I = I + Math.imul(re, se) | 0, F = F + Math.imul(re, de) | 0, M = M + Math.imul(J, Te) | 0, I = I + Math.imul(J, Re) | 0, I = I + Math.imul(Q, Te) | 0, F = F + Math.imul(Q, Re) | 0; + var xt = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, M = Math.imul(tt, Xt), I = Math.imul(tt, Dt), I = I + Math.imul(Ye, Xt) | 0, F = Math.imul(Ye, Dt), M = M + Math.imul(at, Ct) | 0, I = I + Math.imul(at, gt) | 0, I = I + Math.imul(ke, Ct) | 0, F = F + Math.imul(ke, gt) | 0, M = M + Math.imul(ze, Nt) | 0, I = I + Math.imul(ze, vt) | 0, I = I + Math.imul(_e, Nt) | 0, F = F + Math.imul(_e, vt) | 0, M = M + Math.imul(Ke, Ft) | 0, I = I + Math.imul(Ke, rt) | 0, I = I + Math.imul(Le, Ft) | 0, F = F + Math.imul(Le, rt) | 0, M = M + Math.imul($e, k) | 0, I = I + Math.imul($e, U) | 0, I = I + Math.imul(Me, k) | 0, F = F + Math.imul(Me, U) | 0, M = M + Math.imul(Pe, C) | 0, I = I + Math.imul(Pe, G) | 0, I = I + Math.imul(De, C) | 0, F = F + Math.imul(De, G) | 0, M = M + Math.imul(ie, se) | 0, I = I + Math.imul(ie, de) | 0, I = I + Math.imul(ue, se) | 0, F = F + Math.imul(ue, de) | 0, M = M + Math.imul(X, Te) | 0, I = I + Math.imul(X, Re) | 0, I = I + Math.imul(re, Te) | 0, F = F + Math.imul(re, Re) | 0; + var st = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, M = Math.imul(tt, Ct), I = Math.imul(tt, gt), I = I + Math.imul(Ye, Ct) | 0, F = Math.imul(Ye, gt), M = M + Math.imul(at, Nt) | 0, I = I + Math.imul(at, vt) | 0, I = I + Math.imul(ke, Nt) | 0, F = F + Math.imul(ke, vt) | 0, M = M + Math.imul(ze, Ft) | 0, I = I + Math.imul(ze, rt) | 0, I = I + Math.imul(_e, Ft) | 0, F = F + Math.imul(_e, rt) | 0, M = M + Math.imul(Ke, k) | 0, I = I + Math.imul(Ke, U) | 0, I = I + Math.imul(Le, k) | 0, F = F + Math.imul(Le, U) | 0, M = M + Math.imul($e, C) | 0, I = I + Math.imul($e, G) | 0, I = I + Math.imul(Me, C) | 0, F = F + Math.imul(Me, G) | 0, M = M + Math.imul(Pe, se) | 0, I = I + Math.imul(Pe, de) | 0, I = I + Math.imul(De, se) | 0, F = F + Math.imul(De, de) | 0, M = M + Math.imul(ie, Te) | 0, I = I + Math.imul(ie, Re) | 0, I = I + Math.imul(ue, Te) | 0, F = F + Math.imul(ue, Re) | 0; + var bt = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, M = Math.imul(tt, Nt), I = Math.imul(tt, vt), I = I + Math.imul(Ye, Nt) | 0, F = Math.imul(Ye, vt), M = M + Math.imul(at, Ft) | 0, I = I + Math.imul(at, rt) | 0, I = I + Math.imul(ke, Ft) | 0, F = F + Math.imul(ke, rt) | 0, M = M + Math.imul(ze, k) | 0, I = I + Math.imul(ze, U) | 0, I = I + Math.imul(_e, k) | 0, F = F + Math.imul(_e, U) | 0, M = M + Math.imul(Ke, C) | 0, I = I + Math.imul(Ke, G) | 0, I = I + Math.imul(Le, C) | 0, F = F + Math.imul(Le, G) | 0, M = M + Math.imul($e, se) | 0, I = I + Math.imul($e, de) | 0, I = I + Math.imul(Me, se) | 0, F = F + Math.imul(Me, de) | 0, M = M + Math.imul(Pe, Te) | 0, I = I + Math.imul(Pe, Re) | 0, I = I + Math.imul(De, Te) | 0, F = F + Math.imul(De, Re) | 0; + var ut = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, M = Math.imul(tt, Ft), I = Math.imul(tt, rt), I = I + Math.imul(Ye, Ft) | 0, F = Math.imul(Ye, rt), M = M + Math.imul(at, k) | 0, I = I + Math.imul(at, U) | 0, I = I + Math.imul(ke, k) | 0, F = F + Math.imul(ke, U) | 0, M = M + Math.imul(ze, C) | 0, I = I + Math.imul(ze, G) | 0, I = I + Math.imul(_e, C) | 0, F = F + Math.imul(_e, G) | 0, M = M + Math.imul(Ke, se) | 0, I = I + Math.imul(Ke, de) | 0, I = I + Math.imul(Le, se) | 0, F = F + Math.imul(Le, de) | 0, M = M + Math.imul($e, Te) | 0, I = I + Math.imul($e, Re) | 0, I = I + Math.imul(Me, Te) | 0, F = F + Math.imul(Me, Re) | 0; + var ot = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, M = Math.imul(tt, k), I = Math.imul(tt, U), I = I + Math.imul(Ye, k) | 0, F = Math.imul(Ye, U), M = M + Math.imul(at, C) | 0, I = I + Math.imul(at, G) | 0, I = I + Math.imul(ke, C) | 0, F = F + Math.imul(ke, G) | 0, M = M + Math.imul(ze, se) | 0, I = I + Math.imul(ze, de) | 0, I = I + Math.imul(_e, se) | 0, F = F + Math.imul(_e, de) | 0, M = M + Math.imul(Ke, Te) | 0, I = I + Math.imul(Ke, Re) | 0, I = I + Math.imul(Le, Te) | 0, F = F + Math.imul(Le, Re) | 0; + var Se = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, M = Math.imul(tt, C), I = Math.imul(tt, G), I = I + Math.imul(Ye, C) | 0, F = Math.imul(Ye, G), M = M + Math.imul(at, se) | 0, I = I + Math.imul(at, de) | 0, I = I + Math.imul(ke, se) | 0, F = F + Math.imul(ke, de) | 0, M = M + Math.imul(ze, Te) | 0, I = I + Math.imul(ze, Re) | 0, I = I + Math.imul(_e, Te) | 0, F = F + Math.imul(_e, Re) | 0; + var Ae = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, M = Math.imul(tt, se), I = Math.imul(tt, de), I = I + Math.imul(Ye, se) | 0, F = Math.imul(Ye, de), M = M + Math.imul(at, Te) | 0, I = I + Math.imul(at, Re) | 0, I = I + Math.imul(ke, Te) | 0, F = F + Math.imul(ke, Re) | 0; + var Ve = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (Ve >>> 26) | 0, Ve &= 67108863, M = Math.imul(tt, Te), I = Math.imul(tt, Re), I = I + Math.imul(Ye, Te) | 0, F = Math.imul(Ye, Re); + var Fe = (v + M | 0) + ((I & 8191) << 13) | 0; + return v = (F + (I >>> 13) | 0) + (Fe >>> 26) | 0, Fe &= 67108863, E[0] = nt, E[1] = je, E[2] = pt, E[3] = it, E[4] = et, E[5] = St, E[6] = Tt, E[7] = At, E[8] = _t, E[9] = ht, E[10] = xt, E[11] = st, E[12] = bt, E[13] = ut, E[14] = ot, E[15] = Se, E[16] = Ae, E[17] = Ve, E[18] = Fe, v !== 0 && (E[19] = v, b.length++), b; }; - Math.imul || (F = $); - function K(m, f, p) { - p.negative = f.negative ^ m.negative, p.length = m.length + f.length; - for (var b = 0, x = 0, _ = 0; _ < p.length - 1; _++) { + Math.imul || (B = $); + function H(m, f, g) { + g.negative = f.negative ^ m.negative, g.length = m.length + f.length; + for (var b = 0, x = 0, _ = 0; _ < g.length - 1; _++) { var E = x; x = 0; - for (var v = b & 67108863, P = Math.min(_, f.length - 1), I = Math.max(0, _ - m.length + 1); I <= P; I++) { - var B = _ - I, ce = m.words[B] | 0, D = f.words[I] | 0, oe = ce * D, Z = oe & 67108863; + for (var v = b & 67108863, M = Math.min(_, f.length - 1), I = Math.max(0, _ - m.length + 1); I <= M; I++) { + var F = _ - I, ce = m.words[F] | 0, D = f.words[I] | 0, oe = ce * D, Z = oe & 67108863; E = E + (oe / 67108864 | 0) | 0, Z = Z + v | 0, v = Z & 67108863, E = E + (Z >>> 26) | 0, x += E >>> 26, E &= 67108863; } - p.words[_] = v, b = E, E = x; + g.words[_] = v, b = E, E = x; } - return b !== 0 ? p.words[_] = b : p.length--, p._strip(); + return b !== 0 ? g.words[_] = b : g.length--, g._strip(); } - function H(m, f, p) { - return K(m, f, p); + function W(m, f, g) { + return H(m, f, g); } - s.prototype.mulTo = function(f, p) { + s.prototype.mulTo = function(f, g) { var b, x = this.length + f.length; - return this.length === 10 && f.length === 10 ? b = F(this, f, p) : x < 63 ? b = $(this, f, p) : x < 1024 ? b = K(this, f, p) : b = H(this, f, p), b; + return this.length === 10 && f.length === 10 ? b = B(this, f, g) : x < 63 ? b = $(this, f, g) : x < 1024 ? b = H(this, f, g) : b = W(this, f, g), b; }, s.prototype.mul = function(f) { - var p = new s(null); - return p.words = new Array(this.length + f.length), this.mulTo(f, p); + var g = new s(null); + return g.words = new Array(this.length + f.length), this.mulTo(f, g); }, s.prototype.mulf = function(f) { - var p = new s(null); - return p.words = new Array(this.length + f.length), H(this, f, p); + var g = new s(null); + return g.words = new Array(this.length + f.length), W(this, f, g); }, s.prototype.imul = function(f) { return this.clone().mulTo(f, this); }, s.prototype.imuln = function(f) { - var p = f < 0; - p && (f = -f), n(typeof f == "number"), n(f < 67108864); + var g = f < 0; + g && (f = -f), n(typeof f == "number"), n(f < 67108864); for (var b = 0, x = 0; x < this.length; x++) { var _ = (this.words[x] | 0) * f, E = (_ & 67108863) + (b & 67108863); b >>= 26, b += _ / 67108864 | 0, b += E >>> 26, this.words[x] = E & 67108863; } - return b !== 0 && (this.words[x] = b, this.length++), p ? this.ineg() : this; + return b !== 0 && (this.words[x] = b, this.length++), g ? this.ineg() : this; }, s.prototype.muln = function(f) { return this.clone().imuln(f); }, s.prototype.sqr = function() { @@ -9480,22 +9480,22 @@ zv.exports; }, s.prototype.isqr = function() { return this.imul(this.clone()); }, s.prototype.pow = function(f) { - var p = L(f); - if (p.length === 0) return new s(1); - for (var b = this, x = 0; x < p.length && p[x] === 0; x++, b = b.sqr()) + var g = L(f); + if (g.length === 0) return new s(1); + for (var b = this, x = 0; x < g.length && g[x] === 0; x++, b = b.sqr()) ; - if (++x < p.length) - for (var _ = b.sqr(); x < p.length; x++, _ = _.sqr()) - p[x] !== 0 && (b = b.mul(_)); + if (++x < g.length) + for (var _ = b.sqr(); x < g.length; x++, _ = _.sqr()) + g[x] !== 0 && (b = b.mul(_)); return b; }, s.prototype.iushln = function(f) { n(typeof f == "number" && f >= 0); - var p = f % 26, b = (f - p) / 26, x = 67108863 >>> 26 - p << 26 - p, _; - if (p !== 0) { + var g = f % 26, b = (f - g) / 26, x = 67108863 >>> 26 - g << 26 - g, _; + if (g !== 0) { var E = 0; for (_ = 0; _ < this.length; _++) { - var v = this.words[_] & x, P = (this.words[_] | 0) - v << p; - this.words[_] = P | E, E = v >>> 26 - p; + var v = this.words[_] & x, M = (this.words[_] | 0) - v << g; + this.words[_] = M | E, E = v >>> 26 - g; } E && (this.words[_] = E, this.length++); } @@ -9509,29 +9509,29 @@ zv.exports; return this._strip(); }, s.prototype.ishln = function(f) { return n(this.negative === 0), this.iushln(f); - }, s.prototype.iushrn = function(f, p, b) { + }, s.prototype.iushrn = function(f, g, b) { n(typeof f == "number" && f >= 0); var x; - p ? x = (p - p % 26) / 26 : x = 0; - var _ = f % 26, E = Math.min((f - _) / 26, this.length), v = 67108863 ^ 67108863 >>> _ << _, P = b; - if (x -= E, x = Math.max(0, x), P) { + g ? x = (g - g % 26) / 26 : x = 0; + var _ = f % 26, E = Math.min((f - _) / 26, this.length), v = 67108863 ^ 67108863 >>> _ << _, M = b; + if (x -= E, x = Math.max(0, x), M) { for (var I = 0; I < E; I++) - P.words[I] = this.words[I]; - P.length = E; + M.words[I] = this.words[I]; + M.length = E; } if (E !== 0) if (this.length > E) for (this.length -= E, I = 0; I < this.length; I++) this.words[I] = this.words[I + E]; else this.words[0] = 0, this.length = 1; - var B = 0; - for (I = this.length - 1; I >= 0 && (B !== 0 || I >= x); I--) { + var F = 0; + for (I = this.length - 1; I >= 0 && (F !== 0 || I >= x); I--) { var ce = this.words[I] | 0; - this.words[I] = B << 26 - _ | ce >>> _, B = ce & v; + this.words[I] = F << 26 - _ | ce >>> _, F = ce & v; } - return P && B !== 0 && (P.words[P.length++] = B), this.length === 0 && (this.words[0] = 0, this.length = 1), this._strip(); - }, s.prototype.ishrn = function(f, p, b) { - return n(this.negative === 0), this.iushrn(f, p, b); + return M && F !== 0 && (M.words[M.length++] = F), this.length === 0 && (this.words[0] = 0, this.length = 1), this._strip(); + }, s.prototype.ishrn = function(f, g, b) { + return n(this.negative === 0), this.iushrn(f, g, b); }, s.prototype.shln = function(f) { return this.clone().ishln(f); }, s.prototype.ushln = function(f) { @@ -9542,17 +9542,17 @@ zv.exports; return this.clone().iushrn(f); }, s.prototype.testn = function(f) { n(typeof f == "number" && f >= 0); - var p = f % 26, b = (f - p) / 26, x = 1 << p; + var g = f % 26, b = (f - g) / 26, x = 1 << g; if (this.length <= b) return !1; var _ = this.words[b]; return !!(_ & x); }, s.prototype.imaskn = function(f) { n(typeof f == "number" && f >= 0); - var p = f % 26, b = (f - p) / 26; + var g = f % 26, b = (f - g) / 26; if (n(this.negative === 0, "imaskn works only with positive numbers"), this.length <= b) return this; - if (p !== 0 && b++, this.length = Math.min(b, this.length), p !== 0) { - var x = 67108863 ^ 67108863 >>> p << p; + if (g !== 0 && b++, this.length = Math.min(b, this.length), g !== 0) { + var x = 67108863 ^ 67108863 >>> g << g; this.words[this.length - 1] &= x; } return this._strip(); @@ -9562,9 +9562,9 @@ zv.exports; return n(typeof f == "number"), n(f < 67108864), f < 0 ? this.isubn(-f) : this.negative !== 0 ? this.length === 1 && (this.words[0] | 0) <= f ? (this.words[0] = f - (this.words[0] | 0), this.negative = 0, this) : (this.negative = 0, this.isubn(f), this.negative = 1, this) : this._iaddn(f); }, s.prototype._iaddn = function(f) { this.words[0] += f; - for (var p = 0; p < this.length && this.words[p] >= 67108864; p++) - this.words[p] -= 67108864, p === this.length - 1 ? this.words[p + 1] = 1 : this.words[p + 1]++; - return this.length = Math.max(this.length, p + 1), this; + for (var g = 0; g < this.length && this.words[g] >= 67108864; g++) + this.words[g] -= 67108864, g === this.length - 1 ? this.words[g + 1] = 1 : this.words[g + 1]++; + return this.length = Math.max(this.length, g + 1), this; }, s.prototype.isubn = function(f) { if (n(typeof f == "number"), n(f < 67108864), f < 0) return this.iaddn(-f); if (this.negative !== 0) @@ -9572,8 +9572,8 @@ zv.exports; if (this.words[0] -= f, this.length === 1 && this.words[0] < 0) this.words[0] = -this.words[0], this.negative = 1; else - for (var p = 0; p < this.length && this.words[p] < 0; p++) - this.words[p] += 67108864, this.words[p + 1] -= 1; + for (var g = 0; g < this.length && this.words[g] < 0; g++) + this.words[g] += 67108864, this.words[g + 1] -= 1; return this._strip(); }, s.prototype.addn = function(f) { return this.clone().iaddn(f); @@ -9583,14 +9583,14 @@ zv.exports; return this.negative = 0, this; }, s.prototype.abs = function() { return this.clone().iabs(); - }, s.prototype._ishlnsubmul = function(f, p, b) { + }, s.prototype._ishlnsubmul = function(f, g, b) { var x = f.length + b, _; this._expand(x); var E, v = 0; for (_ = 0; _ < f.length; _++) { E = (this.words[_ + b] | 0) + v; - var P = (f.words[_] | 0) * p; - E -= P & 67108863, v = (E >> 26) - (P / 67108864 | 0), this.words[_ + b] = E & 67108863; + var M = (f.words[_] | 0) * g; + E -= M & 67108863, v = (E >> 26) - (M / 67108864 | 0), this.words[_ + b] = E & 67108863; } for (; _ < this.length - b; _++) E = (this.words[_ + b] | 0) + v, v = E >> 26, this.words[_ + b] = E & 67108863; @@ -9598,56 +9598,56 @@ zv.exports; for (n(v === -1), v = 0, _ = 0; _ < this.length; _++) E = -(this.words[_] | 0) + v, v = E >> 26, this.words[_] = E & 67108863; return this.negative = 1, this._strip(); - }, s.prototype._wordDiv = function(f, p) { + }, s.prototype._wordDiv = function(f, g) { var b = this.length - f.length, x = this.clone(), _ = f, E = _.words[_.length - 1] | 0, v = this._countBits(E); b = 26 - v, b !== 0 && (_ = _.ushln(b), x.iushln(b), E = _.words[_.length - 1] | 0); - var P = x.length - _.length, I; - if (p !== "mod") { - I = new s(null), I.length = P + 1, I.words = new Array(I.length); - for (var B = 0; B < I.length; B++) - I.words[B] = 0; - } - var ce = x.clone()._ishlnsubmul(_, 1, P); - ce.negative === 0 && (x = ce, I && (I.words[P] = 1)); - for (var D = P - 1; D >= 0; D--) { + var M = x.length - _.length, I; + if (g !== "mod") { + I = new s(null), I.length = M + 1, I.words = new Array(I.length); + for (var F = 0; F < I.length; F++) + I.words[F] = 0; + } + var ce = x.clone()._ishlnsubmul(_, 1, M); + ce.negative === 0 && (x = ce, I && (I.words[M] = 1)); + for (var D = M - 1; D >= 0; D--) { var oe = (x.words[_.length + D] | 0) * 67108864 + (x.words[_.length + D - 1] | 0); for (oe = Math.min(oe / E | 0, 67108863), x._ishlnsubmul(_, oe, D); x.negative !== 0; ) oe--, x.negative = 0, x._ishlnsubmul(_, 1, D), x.isZero() || (x.negative ^= 1); I && (I.words[D] = oe); } - return I && I._strip(), x._strip(), p !== "div" && b !== 0 && x.iushrn(b), { + return I && I._strip(), x._strip(), g !== "div" && b !== 0 && x.iushrn(b), { div: I || null, mod: x }; - }, s.prototype.divmod = function(f, p, b) { + }, s.prototype.divmod = function(f, g, b) { if (n(!f.isZero()), this.isZero()) return { div: new s(0), mod: new s(0) }; var x, _, E; - return this.negative !== 0 && f.negative === 0 ? (E = this.neg().divmod(f, p), p !== "mod" && (x = E.div.neg()), p !== "div" && (_ = E.mod.neg(), b && _.negative !== 0 && _.iadd(f)), { + return this.negative !== 0 && f.negative === 0 ? (E = this.neg().divmod(f, g), g !== "mod" && (x = E.div.neg()), g !== "div" && (_ = E.mod.neg(), b && _.negative !== 0 && _.iadd(f)), { div: x, mod: _ - }) : this.negative === 0 && f.negative !== 0 ? (E = this.divmod(f.neg(), p), p !== "mod" && (x = E.div.neg()), { + }) : this.negative === 0 && f.negative !== 0 ? (E = this.divmod(f.neg(), g), g !== "mod" && (x = E.div.neg()), { div: x, mod: E.mod - }) : this.negative & f.negative ? (E = this.neg().divmod(f.neg(), p), p !== "div" && (_ = E.mod.neg(), b && _.negative !== 0 && _.isub(f)), { + }) : this.negative & f.negative ? (E = this.neg().divmod(f.neg(), g), g !== "div" && (_ = E.mod.neg(), b && _.negative !== 0 && _.isub(f)), { div: E.div, mod: _ }) : f.length > this.length || this.cmp(f) < 0 ? { div: new s(0), mod: this - } : f.length === 1 ? p === "div" ? { + } : f.length === 1 ? g === "div" ? { div: this.divn(f.words[0]), mod: null - } : p === "mod" ? { + } : g === "mod" ? { div: null, mod: new s(this.modrn(f.words[0])) } : { div: this.divn(f.words[0]), mod: new s(this.modrn(f.words[0])) - } : this._wordDiv(f, p); + } : this._wordDiv(f, g); }, s.prototype.div = function(f) { return this.divmod(f, "div", !1).div; }, s.prototype.mod = function(f) { @@ -9655,86 +9655,86 @@ zv.exports; }, s.prototype.umod = function(f) { return this.divmod(f, "mod", !0).mod; }, s.prototype.divRound = function(f) { - var p = this.divmod(f); - if (p.mod.isZero()) return p.div; - var b = p.div.negative !== 0 ? p.mod.isub(f) : p.mod, x = f.ushrn(1), _ = f.andln(1), E = b.cmp(x); - return E < 0 || _ === 1 && E === 0 ? p.div : p.div.negative !== 0 ? p.div.isubn(1) : p.div.iaddn(1); + var g = this.divmod(f); + if (g.mod.isZero()) return g.div; + var b = g.div.negative !== 0 ? g.mod.isub(f) : g.mod, x = f.ushrn(1), _ = f.andln(1), E = b.cmp(x); + return E < 0 || _ === 1 && E === 0 ? g.div : g.div.negative !== 0 ? g.div.isubn(1) : g.div.iaddn(1); }, s.prototype.modrn = function(f) { - var p = f < 0; - p && (f = -f), n(f <= 67108863); + var g = f < 0; + g && (f = -f), n(f <= 67108863); for (var b = (1 << 26) % f, x = 0, _ = this.length - 1; _ >= 0; _--) x = (b * x + (this.words[_] | 0)) % f; - return p ? -x : x; + return g ? -x : x; }, s.prototype.modn = function(f) { return this.modrn(f); }, s.prototype.idivn = function(f) { - var p = f < 0; - p && (f = -f), n(f <= 67108863); + var g = f < 0; + g && (f = -f), n(f <= 67108863); for (var b = 0, x = this.length - 1; x >= 0; x--) { var _ = (this.words[x] | 0) + b * 67108864; this.words[x] = _ / f | 0, b = _ % f; } - return this._strip(), p ? this.ineg() : this; + return this._strip(), g ? this.ineg() : this; }, s.prototype.divn = function(f) { return this.clone().idivn(f); }, s.prototype.egcd = function(f) { n(f.negative === 0), n(!f.isZero()); - var p = this, b = f.clone(); - p.negative !== 0 ? p = p.umod(f) : p = p.clone(); - for (var x = new s(1), _ = new s(0), E = new s(0), v = new s(1), P = 0; p.isEven() && b.isEven(); ) - p.iushrn(1), b.iushrn(1), ++P; - for (var I = b.clone(), B = p.clone(); !p.isZero(); ) { - for (var ce = 0, D = 1; !(p.words[0] & D) && ce < 26; ++ce, D <<= 1) ; + var g = this, b = f.clone(); + g.negative !== 0 ? g = g.umod(f) : g = g.clone(); + for (var x = new s(1), _ = new s(0), E = new s(0), v = new s(1), M = 0; g.isEven() && b.isEven(); ) + g.iushrn(1), b.iushrn(1), ++M; + for (var I = b.clone(), F = g.clone(); !g.isZero(); ) { + for (var ce = 0, D = 1; !(g.words[0] & D) && ce < 26; ++ce, D <<= 1) ; if (ce > 0) - for (p.iushrn(ce); ce-- > 0; ) - (x.isOdd() || _.isOdd()) && (x.iadd(I), _.isub(B)), x.iushrn(1), _.iushrn(1); + for (g.iushrn(ce); ce-- > 0; ) + (x.isOdd() || _.isOdd()) && (x.iadd(I), _.isub(F)), x.iushrn(1), _.iushrn(1); for (var oe = 0, Z = 1; !(b.words[0] & Z) && oe < 26; ++oe, Z <<= 1) ; if (oe > 0) for (b.iushrn(oe); oe-- > 0; ) - (E.isOdd() || v.isOdd()) && (E.iadd(I), v.isub(B)), E.iushrn(1), v.iushrn(1); - p.cmp(b) >= 0 ? (p.isub(b), x.isub(E), _.isub(v)) : (b.isub(p), E.isub(x), v.isub(_)); + (E.isOdd() || v.isOdd()) && (E.iadd(I), v.isub(F)), E.iushrn(1), v.iushrn(1); + g.cmp(b) >= 0 ? (g.isub(b), x.isub(E), _.isub(v)) : (b.isub(g), E.isub(x), v.isub(_)); } return { a: E, b: v, - gcd: b.iushln(P) + gcd: b.iushln(M) }; }, s.prototype._invmp = function(f) { n(f.negative === 0), n(!f.isZero()); - var p = this, b = f.clone(); - p.negative !== 0 ? p = p.umod(f) : p = p.clone(); - for (var x = new s(1), _ = new s(0), E = b.clone(); p.cmpn(1) > 0 && b.cmpn(1) > 0; ) { - for (var v = 0, P = 1; !(p.words[0] & P) && v < 26; ++v, P <<= 1) ; + var g = this, b = f.clone(); + g.negative !== 0 ? g = g.umod(f) : g = g.clone(); + for (var x = new s(1), _ = new s(0), E = b.clone(); g.cmpn(1) > 0 && b.cmpn(1) > 0; ) { + for (var v = 0, M = 1; !(g.words[0] & M) && v < 26; ++v, M <<= 1) ; if (v > 0) - for (p.iushrn(v); v-- > 0; ) + for (g.iushrn(v); v-- > 0; ) x.isOdd() && x.iadd(E), x.iushrn(1); - for (var I = 0, B = 1; !(b.words[0] & B) && I < 26; ++I, B <<= 1) ; + for (var I = 0, F = 1; !(b.words[0] & F) && I < 26; ++I, F <<= 1) ; if (I > 0) for (b.iushrn(I); I-- > 0; ) _.isOdd() && _.iadd(E), _.iushrn(1); - p.cmp(b) >= 0 ? (p.isub(b), x.isub(_)) : (b.isub(p), _.isub(x)); + g.cmp(b) >= 0 ? (g.isub(b), x.isub(_)) : (b.isub(g), _.isub(x)); } var ce; - return p.cmpn(1) === 0 ? ce = x : ce = _, ce.cmpn(0) < 0 && ce.iadd(f), ce; + return g.cmpn(1) === 0 ? ce = x : ce = _, ce.cmpn(0) < 0 && ce.iadd(f), ce; }, s.prototype.gcd = function(f) { if (this.isZero()) return f.abs(); if (f.isZero()) return this.abs(); - var p = this.clone(), b = f.clone(); - p.negative = 0, b.negative = 0; - for (var x = 0; p.isEven() && b.isEven(); x++) - p.iushrn(1), b.iushrn(1); + var g = this.clone(), b = f.clone(); + g.negative = 0, b.negative = 0; + for (var x = 0; g.isEven() && b.isEven(); x++) + g.iushrn(1), b.iushrn(1); do { - for (; p.isEven(); ) - p.iushrn(1); + for (; g.isEven(); ) + g.iushrn(1); for (; b.isEven(); ) b.iushrn(1); - var _ = p.cmp(b); + var _ = g.cmp(b); if (_ < 0) { - var E = p; - p = b, b = E; + var E = g; + g = b, b = E; } else if (_ === 0 || b.cmpn(1) === 0) break; - p.isub(b); + g.isub(b); } while (!0); return b.iushln(x); }, s.prototype.invm = function(f) { @@ -9747,7 +9747,7 @@ zv.exports; return this.words[0] & f; }, s.prototype.bincn = function(f) { n(typeof f == "number"); - var p = f % 26, b = (f - p) / 26, x = 1 << p; + var g = f % 26, b = (f - g) / 26, x = 1 << g; if (this.length <= b) return this._expand(b + 1), this.words[b] |= x, this; for (var _ = x, E = b; _ !== 0 && E < this.length; E++) { @@ -9758,15 +9758,15 @@ zv.exports; }, s.prototype.isZero = function() { return this.length === 1 && this.words[0] === 0; }, s.prototype.cmpn = function(f) { - var p = f < 0; - if (this.negative !== 0 && !p) return -1; - if (this.negative === 0 && p) return 1; + var g = f < 0; + if (this.negative !== 0 && !g) return -1; + if (this.negative === 0 && g) return 1; this._strip(); var b; if (this.length > 1) b = 1; else { - p && (f = -f), n(f <= 67108863, "Number is too big"); + g && (f = -f), n(f <= 67108863, "Number is too big"); var x = this.words[0] | 0; b = x === f ? 0 : x < f ? -1 : 1; } @@ -9774,19 +9774,19 @@ zv.exports; }, s.prototype.cmp = function(f) { if (this.negative !== 0 && f.negative === 0) return -1; if (this.negative === 0 && f.negative !== 0) return 1; - var p = this.ucmp(f); - return this.negative !== 0 ? -p | 0 : p; + var g = this.ucmp(f); + return this.negative !== 0 ? -g | 0 : g; }, s.prototype.ucmp = function(f) { if (this.length > f.length) return 1; if (this.length < f.length) return -1; - for (var p = 0, b = this.length - 1; b >= 0; b--) { + for (var g = 0, b = this.length - 1; b >= 0; b--) { var x = this.words[b] | 0, _ = f.words[b] | 0; if (x !== _) { - x < _ ? p = -1 : x > _ && (p = 1); + x < _ ? g = -1 : x > _ && (g = 1); break; } } - return p; + return g; }, s.prototype.gtn = function(f) { return this.cmpn(f) === 1; }, s.prototype.gt = function(f) { @@ -9857,14 +9857,14 @@ zv.exports; var f = new s(null); return f.words = new Array(Math.ceil(this.n / 13)), f; }, te.prototype.ireduce = function(f) { - var p = f, b; + var g = f, b; do - this.split(p, this.tmp), p = this.imulK(p), p = p.iadd(this.tmp), b = p.bitLength(); + this.split(g, this.tmp), g = this.imulK(g), g = g.iadd(this.tmp), b = g.bitLength(); while (b > this.n); - var x = b < this.n ? -1 : p.ucmp(this.p); - return x === 0 ? (p.words[0] = 0, p.length = 1) : x > 0 ? p.isub(this.p) : p.strip !== void 0 ? p.strip() : p._strip(), p; - }, te.prototype.split = function(f, p) { - f.iushrn(this.n, 0, p); + var x = b < this.n ? -1 : g.ucmp(this.p); + return x === 0 ? (g.words[0] = 0, g.length = 1) : x > 0 ? g.isub(this.p) : g.strip !== void 0 ? g.strip() : g._strip(), g; + }, te.prototype.split = function(f, g) { + f.iushrn(this.n, 0, g); }, te.prototype.imulK = function(f) { return f.imul(this.k); }; @@ -9875,43 +9875,43 @@ zv.exports; "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f" ); } - i(R, te), R.prototype.split = function(f, p) { + i(R, te), R.prototype.split = function(f, g) { for (var b = 4194303, x = Math.min(f.length, 9), _ = 0; _ < x; _++) - p.words[_] = f.words[_]; - if (p.length = x, f.length <= 9) { + g.words[_] = f.words[_]; + if (g.length = x, f.length <= 9) { f.words[0] = 0, f.length = 1; return; } var E = f.words[9]; - for (p.words[p.length++] = E & b, _ = 10; _ < f.length; _++) { + for (g.words[g.length++] = E & b, _ = 10; _ < f.length; _++) { var v = f.words[_] | 0; f.words[_ - 10] = (v & b) << 4 | E >>> 22, E = v; } E >>>= 22, f.words[_ - 10] = E, E === 0 && f.length > 10 ? f.length -= 10 : f.length -= 9; }, R.prototype.imulK = function(f) { f.words[f.length] = 0, f.words[f.length + 1] = 0, f.length += 2; - for (var p = 0, b = 0; b < f.length; b++) { + for (var g = 0, b = 0; b < f.length; b++) { var x = f.words[b] | 0; - p += x * 977, f.words[b] = p & 67108863, p = x * 64 + (p / 67108864 | 0); + g += x * 977, f.words[b] = g & 67108863, g = x * 64 + (g / 67108864 | 0); } return f.words[f.length - 1] === 0 && (f.length--, f.words[f.length - 1] === 0 && f.length--), f; }; - function W() { + function K() { te.call( this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001" ); } - i(W, te); - function pe() { + i(K, te); + function ge() { te.call( this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff" ); } - i(pe, te); + i(ge, te); function Ee() { te.call( this, @@ -9920,25 +9920,25 @@ zv.exports; ); } i(Ee, te), Ee.prototype.imulK = function(f) { - for (var p = 0, b = 0; b < f.length; b++) { - var x = (f.words[b] | 0) * 19 + p, _ = x & 67108863; - x >>>= 26, f.words[b] = _, p = x; + for (var g = 0, b = 0; b < f.length; b++) { + var x = (f.words[b] | 0) * 19 + g, _ = x & 67108863; + x >>>= 26, f.words[b] = _, g = x; } - return p !== 0 && (f.words[f.length++] = p), f; + return g !== 0 && (f.words[f.length++] = g), f; }, s._prime = function(f) { if (V[f]) return V[f]; - var p; + var g; if (f === "k256") - p = new R(); + g = new R(); else if (f === "p224") - p = new W(); + g = new K(); else if (f === "p192") - p = new pe(); + g = new ge(); else if (f === "p25519") - p = new Ee(); + g = new Ee(); else throw new Error("Unknown prime " + f); - return V[f] = p, p; + return V[f] = g, g; }; function Y(m) { if (typeof m == "string") { @@ -9949,91 +9949,91 @@ zv.exports; } Y.prototype._verify1 = function(f) { n(f.negative === 0, "red works only with positives"), n(f.red, "red works only with red numbers"); - }, Y.prototype._verify2 = function(f, p) { - n((f.negative | p.negative) === 0, "red works only with positives"), n( - f.red && f.red === p.red, + }, Y.prototype._verify2 = function(f, g) { + n((f.negative | g.negative) === 0, "red works only with positives"), n( + f.red && f.red === g.red, "red works only with red numbers" ); }, Y.prototype.imod = function(f) { return this.prime ? this.prime.ireduce(f)._forceRed(this) : (d(f, f.umod(this.m)._forceRed(this)), f); }, Y.prototype.neg = function(f) { return f.isZero() ? f.clone() : this.m.sub(f)._forceRed(this); - }, Y.prototype.add = function(f, p) { - this._verify2(f, p); - var b = f.add(p); + }, Y.prototype.add = function(f, g) { + this._verify2(f, g); + var b = f.add(g); return b.cmp(this.m) >= 0 && b.isub(this.m), b._forceRed(this); - }, Y.prototype.iadd = function(f, p) { - this._verify2(f, p); - var b = f.iadd(p); + }, Y.prototype.iadd = function(f, g) { + this._verify2(f, g); + var b = f.iadd(g); return b.cmp(this.m) >= 0 && b.isub(this.m), b; - }, Y.prototype.sub = function(f, p) { - this._verify2(f, p); - var b = f.sub(p); + }, Y.prototype.sub = function(f, g) { + this._verify2(f, g); + var b = f.sub(g); return b.cmpn(0) < 0 && b.iadd(this.m), b._forceRed(this); - }, Y.prototype.isub = function(f, p) { - this._verify2(f, p); - var b = f.isub(p); + }, Y.prototype.isub = function(f, g) { + this._verify2(f, g); + var b = f.isub(g); return b.cmpn(0) < 0 && b.iadd(this.m), b; - }, Y.prototype.shl = function(f, p) { - return this._verify1(f), this.imod(f.ushln(p)); - }, Y.prototype.imul = function(f, p) { - return this._verify2(f, p), this.imod(f.imul(p)); - }, Y.prototype.mul = function(f, p) { - return this._verify2(f, p), this.imod(f.mul(p)); + }, Y.prototype.shl = function(f, g) { + return this._verify1(f), this.imod(f.ushln(g)); + }, Y.prototype.imul = function(f, g) { + return this._verify2(f, g), this.imod(f.imul(g)); + }, Y.prototype.mul = function(f, g) { + return this._verify2(f, g), this.imod(f.mul(g)); }, Y.prototype.isqr = function(f) { return this.imul(f, f.clone()); }, Y.prototype.sqr = function(f) { return this.mul(f, f); }, Y.prototype.sqrt = function(f) { if (f.isZero()) return f.clone(); - var p = this.m.andln(3); - if (n(p % 2 === 1), p === 3) { + var g = this.m.andln(3); + if (n(g % 2 === 1), g === 3) { var b = this.m.add(new s(1)).iushrn(2); return this.pow(f, b); } for (var x = this.m.subn(1), _ = 0; !x.isZero() && x.andln(1) === 0; ) _++, x.iushrn(1); n(!x.isZero()); - var E = new s(1).toRed(this), v = E.redNeg(), P = this.m.subn(1).iushrn(1), I = this.m.bitLength(); - for (I = new s(2 * I * I).toRed(this); this.pow(I, P).cmp(v) !== 0; ) + var E = new s(1).toRed(this), v = E.redNeg(), M = this.m.subn(1).iushrn(1), I = this.m.bitLength(); + for (I = new s(2 * I * I).toRed(this); this.pow(I, M).cmp(v) !== 0; ) I.redIAdd(v); - for (var B = this.pow(I, x), ce = this.pow(f, x.addn(1).iushrn(1)), D = this.pow(f, x), oe = _; D.cmp(E) !== 0; ) { + for (var F = this.pow(I, x), ce = this.pow(f, x.addn(1).iushrn(1)), D = this.pow(f, x), oe = _; D.cmp(E) !== 0; ) { for (var Z = D, J = 0; Z.cmp(E) !== 0; J++) Z = Z.redSqr(); n(J < oe); - var Q = this.pow(B, new s(1).iushln(oe - J - 1)); - ce = ce.redMul(Q), B = Q.redSqr(), D = D.redMul(B), oe = J; + var Q = this.pow(F, new s(1).iushln(oe - J - 1)); + ce = ce.redMul(Q), F = Q.redSqr(), D = D.redMul(F), oe = J; } return ce; }, Y.prototype.invm = function(f) { - var p = f._invmp(this.m); - return p.negative !== 0 ? (p.negative = 0, this.imod(p).redNeg()) : this.imod(p); - }, Y.prototype.pow = function(f, p) { - if (p.isZero()) return new s(1).toRed(this); - if (p.cmpn(1) === 0) return f.clone(); + var g = f._invmp(this.m); + return g.negative !== 0 ? (g.negative = 0, this.imod(g).redNeg()) : this.imod(g); + }, Y.prototype.pow = function(f, g) { + if (g.isZero()) return new s(1).toRed(this); + if (g.cmpn(1) === 0) return f.clone(); var b = 4, x = new Array(1 << b); x[0] = new s(1).toRed(this), x[1] = f; for (var _ = 2; _ < x.length; _++) x[_] = this.mul(x[_ - 1], f); - var E = x[0], v = 0, P = 0, I = p.bitLength() % 26; - for (I === 0 && (I = 26), _ = p.length - 1; _ >= 0; _--) { - for (var B = p.words[_], ce = I - 1; ce >= 0; ce--) { - var D = B >> ce & 1; + var E = x[0], v = 0, M = 0, I = g.bitLength() % 26; + for (I === 0 && (I = 26), _ = g.length - 1; _ >= 0; _--) { + for (var F = g.words[_], ce = I - 1; ce >= 0; ce--) { + var D = F >> ce & 1; if (E !== x[0] && (E = this.sqr(E)), D === 0 && v === 0) { - P = 0; + M = 0; continue; } - v <<= 1, v |= D, P++, !(P !== b && (_ !== 0 || ce !== 0)) && (E = this.mul(E, x[v]), P = 0, v = 0); + v <<= 1, v |= D, M++, !(M !== b && (_ !== 0 || ce !== 0)) && (E = this.mul(E, x[v]), M = 0, v = 0); } I = 26; } return E; }, Y.prototype.convertTo = function(f) { - var p = f.umod(this.m); - return p === f ? p.clone() : p; + var g = f.umod(this.m); + return g === f ? g.clone() : g; }, Y.prototype.convertFrom = function(f) { - var p = f.clone(); - return p.red = null, p; + var g = f.clone(); + return g.red = null, g; }, s.mont = function(f) { return new S(f); }; @@ -10043,40 +10043,40 @@ zv.exports; i(S, Y), S.prototype.convertTo = function(f) { return this.imod(f.ushln(this.shift)); }, S.prototype.convertFrom = function(f) { - var p = this.imod(f.mul(this.rinv)); - return p.red = null, p; - }, S.prototype.imul = function(f, p) { - if (f.isZero() || p.isZero()) + var g = this.imod(f.mul(this.rinv)); + return g.red = null, g; + }, S.prototype.imul = function(f, g) { + if (f.isZero() || g.isZero()) return f.words[0] = 0, f.length = 1, f; - var b = f.imul(p), x = b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), _ = b.isub(x).iushrn(this.shift), E = _; + var b = f.imul(g), x = b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), _ = b.isub(x).iushrn(this.shift), E = _; return _.cmp(this.m) >= 0 ? E = _.isub(this.m) : _.cmpn(0) < 0 && (E = _.iadd(this.m)), E._forceRed(this); - }, S.prototype.mul = function(f, p) { - if (f.isZero() || p.isZero()) return new s(0)._forceRed(this); - var b = f.mul(p), x = b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), _ = b.isub(x).iushrn(this.shift), E = _; + }, S.prototype.mul = function(f, g) { + if (f.isZero() || g.isZero()) return new s(0)._forceRed(this); + var b = f.mul(g), x = b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), _ = b.isub(x).iushrn(this.shift), E = _; return _.cmp(this.m) >= 0 ? E = _.isub(this.m) : _.cmpn(0) < 0 && (E = _.iadd(this.m)), E._forceRed(this); }, S.prototype.invm = function(f) { - var p = this.imod(f._invmp(this.m).mul(this.r2)); - return p._forceRed(this); + var g = this.imod(f._invmp(this.m).mul(this.r2)); + return g._forceRed(this); }; })(t, gn); })(zv); -var xB = zv.exports; -const ir = /* @__PURE__ */ ts(xB); -var _B = ir.BN; -function EB(t) { - return new _B(t, 36).toString(16); -} -const SB = "strings/5.7.0", AB = new Yr(SB); -var t0; +var RF = zv.exports; +const sr = /* @__PURE__ */ rs(RF); +var DF = sr.BN; +function OF(t) { + return new DF(t, 36).toString(16); +} +const NF = "strings/5.7.0", LF = new Yr(NF); +var r0; (function(t) { t.current = "", t.NFC = "NFC", t.NFD = "NFD", t.NFKC = "NFKC", t.NFKD = "NFKD"; -})(t0 || (t0 = {})); -var bx; +})(r0 || (r0 = {})); +var wx; (function(t) { t.UNEXPECTED_CONTINUE = "unexpected continuation byte", t.BAD_PREFIX = "bad codepoint prefix", t.OVERRUN = "string overrun", t.MISSING_CONTINUE = "missing continuation byte", t.OUT_OF_RANGE = "out of UTF-8 range", t.UTF16_SURROGATE = "UTF-16 surrogate", t.OVERLONG = "overlong representation"; -})(bx || (bx = {})); -function em(t, e = t0.current) { - e != t0.current && (AB.checkNormalize(), t = t.normalize(e)); +})(wx || (wx = {})); +function em(t, e = r0.current) { + e != r0.current && (LF.checkNormalize(), t = t.normalize(e)); let r = []; for (let n = 0; n < t.length; n++) { const i = t.charCodeAt(n); @@ -10096,18 +10096,18 @@ function em(t, e = t0.current) { } return wn(r); } -const PB = `Ethereum Signed Message: +const kF = `Ethereum Signed Message: `; -function V4(t) { - return typeof t == "string" && (t = em(t)), qv(bB([ - em(PB), +function Y4(t) { + return typeof t == "string" && (t = em(t)), qv(IF([ + em(kF), em(String(t.length)), t ])); } -const MB = "address/5.7.0", kf = new Yr(MB); -function yx(t) { - qs(t, 20) || kf.throwArgumentError("invalid address", "address", t), t = t.toLowerCase(); +const $F = "address/5.7.0", $f = new Yr($F); +function xx(t) { + zs(t, 20) || $f.throwArgumentError("invalid address", "address", t), t = t.toLowerCase(); const e = t.substring(2).split(""), r = new Uint8Array(40); for (let i = 0; i < 40; i++) r[i] = e[i].charCodeAt(0); @@ -10116,21 +10116,21 @@ function yx(t) { n[i >> 1] >> 4 >= 8 && (e[i] = e[i].toUpperCase()), (n[i >> 1] & 15) >= 8 && (e[i + 1] = e[i + 1].toUpperCase()); return "0x" + e.join(""); } -const IB = 9007199254740991; -function CB(t) { +const BF = 9007199254740991; +function FF(t) { return Math.log10 ? Math.log10(t) : Math.log(t) / Math.LN10; } -const Hv = {}; +const Wv = {}; for (let t = 0; t < 10; t++) - Hv[String(t)] = String(t); + Wv[String(t)] = String(t); for (let t = 0; t < 26; t++) - Hv[String.fromCharCode(65 + t)] = String(10 + t); -const wx = Math.floor(CB(IB)); -function TB(t) { + Wv[String.fromCharCode(65 + t)] = String(10 + t); +const _x = Math.floor(FF(BF)); +function jF(t) { t = t.toUpperCase(), t = t.substring(4) + t.substring(0, 2) + "00"; - let e = t.split("").map((n) => Hv[n]).join(""); - for (; e.length >= wx; ) { - let n = e.substring(0, wx); + let e = t.split("").map((n) => Wv[n]).join(""); + for (; e.length >= _x; ) { + let n = e.substring(0, _x); e = parseInt(n, 10) % 97 + e.substring(n.length); } let r = String(98 - parseInt(e, 10) % 97); @@ -10138,31 +10138,31 @@ function TB(t) { r = "0" + r; return r; } -function RB(t) { +function UF(t) { let e = null; - if (typeof t != "string" && kf.throwArgumentError("invalid address", "address", t), t.match(/^(0x)?[0-9a-fA-F]{40}$/)) - t.substring(0, 2) !== "0x" && (t = "0x" + t), e = yx(t), t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && e !== t && kf.throwArgumentError("bad address checksum", "address", t); + if (typeof t != "string" && $f.throwArgumentError("invalid address", "address", t), t.match(/^(0x)?[0-9a-fA-F]{40}$/)) + t.substring(0, 2) !== "0x" && (t = "0x" + t), e = xx(t), t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && e !== t && $f.throwArgumentError("bad address checksum", "address", t); else if (t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { - for (t.substring(2, 4) !== TB(t) && kf.throwArgumentError("bad icap checksum", "address", t), e = EB(t.substring(4)); e.length < 40; ) + for (t.substring(2, 4) !== jF(t) && $f.throwArgumentError("bad icap checksum", "address", t), e = OF(t.substring(4)); e.length < 40; ) e = "0" + e; - e = yx("0x" + e); + e = xx("0x" + e); } else - kf.throwArgumentError("invalid address", "address", t); + $f.throwArgumentError("invalid address", "address", t); return e; } -function xf(t, e, r) { +function _f(t, e, r) { Object.defineProperty(t, e, { enumerable: !0, value: r, writable: !1 }); } -var Kl = {}, xr = {}, yc = G4; -function G4(t, e) { +var Vl = {}, xr = {}, wc = J4; +function J4(t, e) { if (!t) throw new Error(e || "Assertion failed"); } -G4.equal = function(e, r, n) { +J4.equal = function(e, r, n) { if (e != r) throw new Error(n || "Assertion failed: " + e + " != " + r); }; @@ -10184,12 +10184,12 @@ typeof Object.create == "function" ? w1.exports = function(e, r) { n.prototype = r.prototype, e.prototype = new n(), e.prototype.constructor = e; } }; -var q0 = w1.exports, DB = yc, OB = q0; -xr.inherits = OB; -function NB(t, e) { +var z0 = w1.exports, qF = wc, zF = z0; +xr.inherits = zF; +function WF(t, e) { return (t.charCodeAt(e) & 64512) !== 55296 || e < 0 || e + 1 >= t.length ? !1 : (t.charCodeAt(e + 1) & 64512) === 56320; } -function LB(t, e) { +function HF(t, e) { if (Array.isArray(t)) return t.slice(); if (!t) @@ -10202,160 +10202,160 @@ function LB(t, e) { r.push(parseInt(t[i] + t[i + 1], 16)); } else for (var n = 0, i = 0; i < t.length; i++) { var s = t.charCodeAt(i); - s < 128 ? r[n++] = s : s < 2048 ? (r[n++] = s >> 6 | 192, r[n++] = s & 63 | 128) : NB(t, i) ? (s = 65536 + ((s & 1023) << 10) + (t.charCodeAt(++i) & 1023), r[n++] = s >> 18 | 240, r[n++] = s >> 12 & 63 | 128, r[n++] = s >> 6 & 63 | 128, r[n++] = s & 63 | 128) : (r[n++] = s >> 12 | 224, r[n++] = s >> 6 & 63 | 128, r[n++] = s & 63 | 128); + s < 128 ? r[n++] = s : s < 2048 ? (r[n++] = s >> 6 | 192, r[n++] = s & 63 | 128) : WF(t, i) ? (s = 65536 + ((s & 1023) << 10) + (t.charCodeAt(++i) & 1023), r[n++] = s >> 18 | 240, r[n++] = s >> 12 & 63 | 128, r[n++] = s >> 6 & 63 | 128, r[n++] = s & 63 | 128) : (r[n++] = s >> 12 | 224, r[n++] = s >> 6 & 63 | 128, r[n++] = s & 63 | 128); } else for (i = 0; i < t.length; i++) r[i] = t[i] | 0; return r; } -xr.toArray = LB; -function kB(t) { +xr.toArray = HF; +function KF(t) { for (var e = "", r = 0; r < t.length; r++) - e += J4(t[r].toString(16)); + e += Z4(t[r].toString(16)); return e; } -xr.toHex = kB; -function Y4(t) { +xr.toHex = KF; +function X4(t) { var e = t >>> 24 | t >>> 8 & 65280 | t << 8 & 16711680 | (t & 255) << 24; return e >>> 0; } -xr.htonl = Y4; -function $B(t, e) { +xr.htonl = X4; +function VF(t, e) { for (var r = "", n = 0; n < t.length; n++) { var i = t[n]; - e === "little" && (i = Y4(i)), r += X4(i.toString(16)); + e === "little" && (i = X4(i)), r += Q4(i.toString(16)); } return r; } -xr.toHex32 = $B; -function J4(t) { +xr.toHex32 = VF; +function Z4(t) { return t.length === 1 ? "0" + t : t; } -xr.zero2 = J4; -function X4(t) { +xr.zero2 = Z4; +function Q4(t) { return t.length === 7 ? "0" + t : t.length === 6 ? "00" + t : t.length === 5 ? "000" + t : t.length === 4 ? "0000" + t : t.length === 3 ? "00000" + t : t.length === 2 ? "000000" + t : t.length === 1 ? "0000000" + t : t; } -xr.zero8 = X4; -function FB(t, e, r, n) { +xr.zero8 = Q4; +function GF(t, e, r, n) { var i = r - e; - DB(i % 4 === 0); + qF(i % 4 === 0); for (var s = new Array(i / 4), o = 0, a = e; o < s.length; o++, a += 4) { var u; n === "big" ? u = t[a] << 24 | t[a + 1] << 16 | t[a + 2] << 8 | t[a + 3] : u = t[a + 3] << 24 | t[a + 2] << 16 | t[a + 1] << 8 | t[a], s[o] = u >>> 0; } return s; } -xr.join32 = FB; -function BB(t, e) { +xr.join32 = GF; +function YF(t, e) { for (var r = new Array(t.length * 4), n = 0, i = 0; n < t.length; n++, i += 4) { var s = t[n]; e === "big" ? (r[i] = s >>> 24, r[i + 1] = s >>> 16 & 255, r[i + 2] = s >>> 8 & 255, r[i + 3] = s & 255) : (r[i + 3] = s >>> 24, r[i + 2] = s >>> 16 & 255, r[i + 1] = s >>> 8 & 255, r[i] = s & 255); } return r; } -xr.split32 = BB; -function UB(t, e) { +xr.split32 = YF; +function JF(t, e) { return t >>> e | t << 32 - e; } -xr.rotr32 = UB; -function jB(t, e) { +xr.rotr32 = JF; +function XF(t, e) { return t << e | t >>> 32 - e; } -xr.rotl32 = jB; -function qB(t, e) { +xr.rotl32 = XF; +function ZF(t, e) { return t + e >>> 0; } -xr.sum32 = qB; -function zB(t, e, r) { +xr.sum32 = ZF; +function QF(t, e, r) { return t + e + r >>> 0; } -xr.sum32_3 = zB; -function HB(t, e, r, n) { +xr.sum32_3 = QF; +function ej(t, e, r, n) { return t + e + r + n >>> 0; } -xr.sum32_4 = HB; -function WB(t, e, r, n, i) { +xr.sum32_4 = ej; +function tj(t, e, r, n, i) { return t + e + r + n + i >>> 0; } -xr.sum32_5 = WB; -function KB(t, e, r, n) { +xr.sum32_5 = tj; +function rj(t, e, r, n) { var i = t[e], s = t[e + 1], o = n + s >>> 0, a = (o < n ? 1 : 0) + r + i; t[e] = a >>> 0, t[e + 1] = o; } -xr.sum64 = KB; -function VB(t, e, r, n) { +xr.sum64 = rj; +function nj(t, e, r, n) { var i = e + n >>> 0, s = (i < e ? 1 : 0) + t + r; return s >>> 0; } -xr.sum64_hi = VB; -function GB(t, e, r, n) { +xr.sum64_hi = nj; +function ij(t, e, r, n) { var i = e + n; return i >>> 0; } -xr.sum64_lo = GB; -function YB(t, e, r, n, i, s, o, a) { +xr.sum64_lo = ij; +function sj(t, e, r, n, i, s, o, a) { var u = 0, l = e; l = l + n >>> 0, u += l < e ? 1 : 0, l = l + s >>> 0, u += l < s ? 1 : 0, l = l + a >>> 0, u += l < a ? 1 : 0; var d = t + r + i + o + u; return d >>> 0; } -xr.sum64_4_hi = YB; -function JB(t, e, r, n, i, s, o, a) { +xr.sum64_4_hi = sj; +function oj(t, e, r, n, i, s, o, a) { var u = e + n + s + a; return u >>> 0; } -xr.sum64_4_lo = JB; -function XB(t, e, r, n, i, s, o, a, u, l) { - var d = 0, g = e; - g = g + n >>> 0, d += g < e ? 1 : 0, g = g + s >>> 0, d += g < s ? 1 : 0, g = g + a >>> 0, d += g < a ? 1 : 0, g = g + l >>> 0, d += g < l ? 1 : 0; +xr.sum64_4_lo = oj; +function aj(t, e, r, n, i, s, o, a, u, l) { + var d = 0, p = e; + p = p + n >>> 0, d += p < e ? 1 : 0, p = p + s >>> 0, d += p < s ? 1 : 0, p = p + a >>> 0, d += p < a ? 1 : 0, p = p + l >>> 0, d += p < l ? 1 : 0; var w = t + r + i + o + u + d; return w >>> 0; } -xr.sum64_5_hi = XB; -function ZB(t, e, r, n, i, s, o, a, u, l) { +xr.sum64_5_hi = aj; +function cj(t, e, r, n, i, s, o, a, u, l) { var d = e + n + s + a + l; return d >>> 0; } -xr.sum64_5_lo = ZB; -function QB(t, e, r) { +xr.sum64_5_lo = cj; +function uj(t, e, r) { var n = e << 32 - r | t >>> r; return n >>> 0; } -xr.rotr64_hi = QB; -function eU(t, e, r) { +xr.rotr64_hi = uj; +function fj(t, e, r) { var n = t << 32 - r | e >>> r; return n >>> 0; } -xr.rotr64_lo = eU; -function tU(t, e, r) { +xr.rotr64_lo = fj; +function lj(t, e, r) { return t >>> r; } -xr.shr64_hi = tU; -function rU(t, e, r) { +xr.shr64_hi = lj; +function hj(t, e, r) { var n = t << 32 - r | e >>> r; return n >>> 0; } -xr.shr64_lo = rU; -var Nu = {}, xx = xr, nU = yc; -function z0() { +xr.shr64_lo = hj; +var Lu = {}, Ex = xr, dj = wc; +function W0() { this.pending = null, this.pendingTotal = 0, this.blockSize = this.constructor.blockSize, this.outSize = this.constructor.outSize, this.hmacStrength = this.constructor.hmacStrength, this.padLength = this.constructor.padLength / 8, this.endian = "big", this._delta8 = this.blockSize / 8, this._delta32 = this.blockSize / 32; } -Nu.BlockHash = z0; -z0.prototype.update = function(e, r) { - if (e = xx.toArray(e, r), this.pending ? this.pending = this.pending.concat(e) : this.pending = e, this.pendingTotal += e.length, this.pending.length >= this._delta8) { +Lu.BlockHash = W0; +W0.prototype.update = function(e, r) { + if (e = Ex.toArray(e, r), this.pending ? this.pending = this.pending.concat(e) : this.pending = e, this.pendingTotal += e.length, this.pending.length >= this._delta8) { e = this.pending; var n = e.length % this._delta8; - this.pending = e.slice(e.length - n, e.length), this.pending.length === 0 && (this.pending = null), e = xx.join32(e, 0, e.length - n, this.endian); + this.pending = e.slice(e.length - n, e.length), this.pending.length === 0 && (this.pending = null), e = Ex.join32(e, 0, e.length - n, this.endian); for (var i = 0; i < e.length; i += this._delta32) this._update(e, i, i + this._delta32); } return this; }; -z0.prototype.digest = function(e) { - return this.update(this._pad()), nU(this.pending === null), this._digest(e); +W0.prototype.digest = function(e) { + return this.update(this._pad()), dj(this.pending === null), this._digest(e); }; -z0.prototype._pad = function() { +W0.prototype._pad = function() { var e = this.pendingTotal, r = this._delta8, n = r - (e + this.padLength) % r, i = new Array(n + this.padLength); i[0] = 128; for (var s = 1; s < n; s++) @@ -10369,54 +10369,54 @@ z0.prototype._pad = function() { i[s++] = 0; return i; }; -var Lu = {}, to = {}, iU = xr, zs = iU.rotr32; -function sU(t, e, r, n) { +var ku = {}, no = {}, pj = xr, Ws = pj.rotr32; +function gj(t, e, r, n) { if (t === 0) - return Z4(e, r, n); - if (t === 1 || t === 3) return e8(e, r, n); + if (t === 1 || t === 3) + return r8(e, r, n); if (t === 2) - return Q4(e, r, n); + return t8(e, r, n); } -to.ft_1 = sU; -function Z4(t, e, r) { +no.ft_1 = gj; +function e8(t, e, r) { return t & e ^ ~t & r; } -to.ch32 = Z4; -function Q4(t, e, r) { +no.ch32 = e8; +function t8(t, e, r) { return t & e ^ t & r ^ e & r; } -to.maj32 = Q4; -function e8(t, e, r) { +no.maj32 = t8; +function r8(t, e, r) { return t ^ e ^ r; } -to.p32 = e8; -function oU(t) { - return zs(t, 2) ^ zs(t, 13) ^ zs(t, 22); +no.p32 = r8; +function mj(t) { + return Ws(t, 2) ^ Ws(t, 13) ^ Ws(t, 22); } -to.s0_256 = oU; -function aU(t) { - return zs(t, 6) ^ zs(t, 11) ^ zs(t, 25); +no.s0_256 = mj; +function vj(t) { + return Ws(t, 6) ^ Ws(t, 11) ^ Ws(t, 25); } -to.s1_256 = aU; -function cU(t) { - return zs(t, 7) ^ zs(t, 18) ^ t >>> 3; +no.s1_256 = vj; +function bj(t) { + return Ws(t, 7) ^ Ws(t, 18) ^ t >>> 3; } -to.g0_256 = cU; -function uU(t) { - return zs(t, 17) ^ zs(t, 19) ^ t >>> 10; +no.g0_256 = bj; +function yj(t) { + return Ws(t, 17) ^ Ws(t, 19) ^ t >>> 10; } -to.g1_256 = uU; -var xu = xr, fU = Nu, lU = to, tm = xu.rotl32, _f = xu.sum32, hU = xu.sum32_5, dU = lU.ft_1, t8 = fU.BlockHash, pU = [ +no.g1_256 = yj; +var _u = xr, wj = Lu, xj = no, tm = _u.rotl32, Ef = _u.sum32, _j = _u.sum32_5, Ej = xj.ft_1, n8 = wj.BlockHash, Sj = [ 1518500249, 1859775393, 2400959708, 3395469782 ]; -function Ys() { - if (!(this instanceof Ys)) - return new Ys(); - t8.call(this), this.h = [ +function Xs() { + if (!(this instanceof Xs)) + return new Xs(); + n8.call(this), this.h = [ 1732584193, 4023233417, 2562383102, @@ -10424,28 +10424,28 @@ function Ys() { 3285377520 ], this.W = new Array(80); } -xu.inherits(Ys, t8); -var gU = Ys; -Ys.blockSize = 512; -Ys.outSize = 160; -Ys.hmacStrength = 80; -Ys.padLength = 64; -Ys.prototype._update = function(e, r) { +_u.inherits(Xs, n8); +var Aj = Xs; +Xs.blockSize = 512; +Xs.outSize = 160; +Xs.hmacStrength = 80; +Xs.padLength = 64; +Xs.prototype._update = function(e, r) { for (var n = this.W, i = 0; i < 16; i++) n[i] = e[r + i]; for (; i < n.length; i++) n[i] = tm(n[i - 3] ^ n[i - 8] ^ n[i - 14] ^ n[i - 16], 1); var s = this.h[0], o = this.h[1], a = this.h[2], u = this.h[3], l = this.h[4]; for (i = 0; i < n.length; i++) { - var d = ~~(i / 20), g = hU(tm(s, 5), dU(d, o, a, u), l, n[i], pU[d]); - l = u, u = a, a = tm(o, 30), o = s, s = g; + var d = ~~(i / 20), p = _j(tm(s, 5), Ej(d, o, a, u), l, n[i], Sj[d]); + l = u, u = a, a = tm(o, 30), o = s, s = p; } - this.h[0] = _f(this.h[0], s), this.h[1] = _f(this.h[1], o), this.h[2] = _f(this.h[2], a), this.h[3] = _f(this.h[3], u), this.h[4] = _f(this.h[4], l); + this.h[0] = Ef(this.h[0], s), this.h[1] = Ef(this.h[1], o), this.h[2] = Ef(this.h[2], a), this.h[3] = Ef(this.h[3], u), this.h[4] = Ef(this.h[4], l); }; -Ys.prototype._digest = function(e) { - return e === "hex" ? xu.toHex32(this.h, "big") : xu.split32(this.h, "big"); +Xs.prototype._digest = function(e) { + return e === "hex" ? _u.toHex32(this.h, "big") : _u.split32(this.h, "big"); }; -var _u = xr, mU = Nu, ku = to, vU = yc, ps = _u.sum32, bU = _u.sum32_4, yU = _u.sum32_5, wU = ku.ch32, xU = ku.maj32, _U = ku.s0_256, EU = ku.s1_256, SU = ku.g0_256, AU = ku.g1_256, r8 = mU.BlockHash, PU = [ +var Eu = xr, Pj = Lu, $u = no, Mj = wc, gs = Eu.sum32, Ij = Eu.sum32_4, Cj = Eu.sum32_5, Tj = $u.ch32, Rj = $u.maj32, Dj = $u.s0_256, Oj = $u.s1_256, Nj = $u.g0_256, Lj = $u.g1_256, i8 = Pj.BlockHash, kj = [ 1116352408, 1899447441, 3049323471, @@ -10511,10 +10511,10 @@ var _u = xr, mU = Nu, ku = to, vU = yc, ps = _u.sum32, bU = _u.sum32_4, yU = _u. 3204031479, 3329325298 ]; -function Js() { - if (!(this instanceof Js)) - return new Js(); - r8.call(this), this.h = [ +function Zs() { + if (!(this instanceof Zs)) + return new Zs(); + i8.call(this), this.h = [ 1779033703, 3144134277, 1013904242, @@ -10523,34 +10523,34 @@ function Js() { 2600822924, 528734635, 1541459225 - ], this.k = PU, this.W = new Array(64); -} -_u.inherits(Js, r8); -var n8 = Js; -Js.blockSize = 512; -Js.outSize = 256; -Js.hmacStrength = 192; -Js.padLength = 64; -Js.prototype._update = function(e, r) { + ], this.k = kj, this.W = new Array(64); +} +Eu.inherits(Zs, i8); +var s8 = Zs; +Zs.blockSize = 512; +Zs.outSize = 256; +Zs.hmacStrength = 192; +Zs.padLength = 64; +Zs.prototype._update = function(e, r) { for (var n = this.W, i = 0; i < 16; i++) n[i] = e[r + i]; for (; i < n.length; i++) - n[i] = bU(AU(n[i - 2]), n[i - 7], SU(n[i - 15]), n[i - 16]); - var s = this.h[0], o = this.h[1], a = this.h[2], u = this.h[3], l = this.h[4], d = this.h[5], g = this.h[6], w = this.h[7]; - for (vU(this.k.length === n.length), i = 0; i < n.length; i++) { - var A = yU(w, EU(l), wU(l, d, g), this.k[i], n[i]), M = ps(_U(s), xU(s, o, a)); - w = g, g = d, d = l, l = ps(u, A), u = a, a = o, o = s, s = ps(A, M); - } - this.h[0] = ps(this.h[0], s), this.h[1] = ps(this.h[1], o), this.h[2] = ps(this.h[2], a), this.h[3] = ps(this.h[3], u), this.h[4] = ps(this.h[4], l), this.h[5] = ps(this.h[5], d), this.h[6] = ps(this.h[6], g), this.h[7] = ps(this.h[7], w); -}; -Js.prototype._digest = function(e) { - return e === "hex" ? _u.toHex32(this.h, "big") : _u.split32(this.h, "big"); -}; -var x1 = xr, i8 = n8; -function Fo() { - if (!(this instanceof Fo)) - return new Fo(); - i8.call(this), this.h = [ + n[i] = Ij(Lj(n[i - 2]), n[i - 7], Nj(n[i - 15]), n[i - 16]); + var s = this.h[0], o = this.h[1], a = this.h[2], u = this.h[3], l = this.h[4], d = this.h[5], p = this.h[6], w = this.h[7]; + for (Mj(this.k.length === n.length), i = 0; i < n.length; i++) { + var A = Cj(w, Oj(l), Tj(l, d, p), this.k[i], n[i]), P = gs(Dj(s), Rj(s, o, a)); + w = p, p = d, d = l, l = gs(u, A), u = a, a = o, o = s, s = gs(A, P); + } + this.h[0] = gs(this.h[0], s), this.h[1] = gs(this.h[1], o), this.h[2] = gs(this.h[2], a), this.h[3] = gs(this.h[3], u), this.h[4] = gs(this.h[4], l), this.h[5] = gs(this.h[5], d), this.h[6] = gs(this.h[6], p), this.h[7] = gs(this.h[7], w); +}; +Zs.prototype._digest = function(e) { + return e === "hex" ? Eu.toHex32(this.h, "big") : Eu.split32(this.h, "big"); +}; +var x1 = xr, o8 = s8; +function jo() { + if (!(this instanceof jo)) + return new jo(); + o8.call(this), this.h = [ 3238371032, 914150663, 812702999, @@ -10561,16 +10561,16 @@ function Fo() { 3204075428 ]; } -x1.inherits(Fo, i8); -var MU = Fo; -Fo.blockSize = 512; -Fo.outSize = 224; -Fo.hmacStrength = 192; -Fo.padLength = 64; -Fo.prototype._digest = function(e) { +x1.inherits(jo, o8); +var $j = jo; +jo.blockSize = 512; +jo.outSize = 224; +jo.hmacStrength = 192; +jo.padLength = 64; +jo.prototype._digest = function(e) { return e === "hex" ? x1.toHex32(this.h.slice(0, 7), "big") : x1.split32(this.h.slice(0, 7), "big"); }; -var xi = xr, IU = Nu, CU = yc, Hs = xi.rotr64_hi, Ws = xi.rotr64_lo, s8 = xi.shr64_hi, o8 = xi.shr64_lo, ea = xi.sum64, rm = xi.sum64_hi, nm = xi.sum64_lo, TU = xi.sum64_4_hi, RU = xi.sum64_4_lo, DU = xi.sum64_5_hi, OU = xi.sum64_5_lo, a8 = IU.BlockHash, NU = [ +var xi = xr, Bj = Lu, Fj = wc, Hs = xi.rotr64_hi, Ks = xi.rotr64_lo, a8 = xi.shr64_hi, c8 = xi.shr64_lo, na = xi.sum64, rm = xi.sum64_hi, nm = xi.sum64_lo, jj = xi.sum64_4_hi, Uj = xi.sum64_4_lo, qj = xi.sum64_5_hi, zj = xi.sum64_5_lo, u8 = Bj.BlockHash, Wj = [ 1116352408, 3609767458, 1899447441, @@ -10732,10 +10732,10 @@ var xi = xr, IU = Nu, CU = yc, Hs = xi.rotr64_hi, Ws = xi.rotr64_lo, s8 = xi.shr 1816402316, 1246189591 ]; -function Es() { - if (!(this instanceof Es)) - return new Es(); - a8.call(this), this.h = [ +function Ss() { + if (!(this instanceof Ss)) + return new Ss(); + u8.call(this), this.h = [ 1779033703, 4089235720, 3144134277, @@ -10752,130 +10752,130 @@ function Es() { 4215389547, 1541459225, 327033209 - ], this.k = NU, this.W = new Array(160); -} -xi.inherits(Es, a8); -var c8 = Es; -Es.blockSize = 1024; -Es.outSize = 512; -Es.hmacStrength = 192; -Es.padLength = 128; -Es.prototype._prepareBlock = function(e, r) { + ], this.k = Wj, this.W = new Array(160); +} +xi.inherits(Ss, u8); +var f8 = Ss; +Ss.blockSize = 1024; +Ss.outSize = 512; +Ss.hmacStrength = 192; +Ss.padLength = 128; +Ss.prototype._prepareBlock = function(e, r) { for (var n = this.W, i = 0; i < 32; i++) n[i] = e[r + i]; for (; i < n.length; i += 2) { - var s = WU(n[i - 4], n[i - 3]), o = KU(n[i - 4], n[i - 3]), a = n[i - 14], u = n[i - 13], l = zU(n[i - 30], n[i - 29]), d = HU(n[i - 30], n[i - 29]), g = n[i - 32], w = n[i - 31]; - n[i] = TU( + var s = tU(n[i - 4], n[i - 3]), o = rU(n[i - 4], n[i - 3]), a = n[i - 14], u = n[i - 13], l = Qj(n[i - 30], n[i - 29]), d = eU(n[i - 30], n[i - 29]), p = n[i - 32], w = n[i - 31]; + n[i] = jj( s, o, a, u, l, d, - g, + p, w - ), n[i + 1] = RU( + ), n[i + 1] = Uj( s, o, a, u, l, d, - g, + p, w ); } }; -Es.prototype._update = function(e, r) { +Ss.prototype._update = function(e, r) { this._prepareBlock(e, r); - var n = this.W, i = this.h[0], s = this.h[1], o = this.h[2], a = this.h[3], u = this.h[4], l = this.h[5], d = this.h[6], g = this.h[7], w = this.h[8], A = this.h[9], M = this.h[10], N = this.h[11], L = this.h[12], $ = this.h[13], F = this.h[14], K = this.h[15]; - CU(this.k.length === n.length); - for (var H = 0; H < n.length; H += 2) { - var V = F, te = K, R = jU(w, A), W = qU(w, A), pe = LU(w, A, M, N, L), Ee = kU(w, A, M, N, L, $), Y = this.k[H], S = this.k[H + 1], m = n[H], f = n[H + 1], p = DU( + var n = this.W, i = this.h[0], s = this.h[1], o = this.h[2], a = this.h[3], u = this.h[4], l = this.h[5], d = this.h[6], p = this.h[7], w = this.h[8], A = this.h[9], P = this.h[10], N = this.h[11], L = this.h[12], $ = this.h[13], B = this.h[14], H = this.h[15]; + Fj(this.k.length === n.length); + for (var W = 0; W < n.length; W += 2) { + var V = B, te = H, R = Xj(w, A), K = Zj(w, A), ge = Hj(w, A, P, N, L), Ee = Kj(w, A, P, N, L, $), Y = this.k[W], S = this.k[W + 1], m = n[W], f = n[W + 1], g = qj( V, te, R, - W, - pe, + K, + ge, Ee, Y, S, m, f - ), b = OU( + ), b = zj( V, te, R, - W, - pe, + K, + ge, Ee, Y, S, m, f ); - V = BU(i, s), te = UU(i, s), R = $U(i, s, o, a, u), W = FU(i, s, o, a, u, l); - var x = rm(V, te, R, W), _ = nm(V, te, R, W); - F = L, K = $, L = M, $ = N, M = w, N = A, w = rm(d, g, p, b), A = nm(g, g, p, b), d = u, g = l, u = o, l = a, o = i, a = s, i = rm(p, b, x, _), s = nm(p, b, x, _); + V = Yj(i, s), te = Jj(i, s), R = Vj(i, s, o, a, u), K = Gj(i, s, o, a, u, l); + var x = rm(V, te, R, K), _ = nm(V, te, R, K); + B = L, H = $, L = P, $ = N, P = w, N = A, w = rm(d, p, g, b), A = nm(p, p, g, b), d = u, p = l, u = o, l = a, o = i, a = s, i = rm(g, b, x, _), s = nm(g, b, x, _); } - ea(this.h, 0, i, s), ea(this.h, 2, o, a), ea(this.h, 4, u, l), ea(this.h, 6, d, g), ea(this.h, 8, w, A), ea(this.h, 10, M, N), ea(this.h, 12, L, $), ea(this.h, 14, F, K); + na(this.h, 0, i, s), na(this.h, 2, o, a), na(this.h, 4, u, l), na(this.h, 6, d, p), na(this.h, 8, w, A), na(this.h, 10, P, N), na(this.h, 12, L, $), na(this.h, 14, B, H); }; -Es.prototype._digest = function(e) { +Ss.prototype._digest = function(e) { return e === "hex" ? xi.toHex32(this.h, "big") : xi.split32(this.h, "big"); }; -function LU(t, e, r, n, i) { +function Hj(t, e, r, n, i) { var s = t & r ^ ~t & i; return s < 0 && (s += 4294967296), s; } -function kU(t, e, r, n, i, s) { +function Kj(t, e, r, n, i, s) { var o = e & n ^ ~e & s; return o < 0 && (o += 4294967296), o; } -function $U(t, e, r, n, i) { +function Vj(t, e, r, n, i) { var s = t & r ^ t & i ^ r & i; return s < 0 && (s += 4294967296), s; } -function FU(t, e, r, n, i, s) { +function Gj(t, e, r, n, i, s) { var o = e & n ^ e & s ^ n & s; return o < 0 && (o += 4294967296), o; } -function BU(t, e) { +function Yj(t, e) { var r = Hs(t, e, 28), n = Hs(e, t, 2), i = Hs(e, t, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function UU(t, e) { - var r = Ws(t, e, 28), n = Ws(e, t, 2), i = Ws(e, t, 7), s = r ^ n ^ i; +function Jj(t, e) { + var r = Ks(t, e, 28), n = Ks(e, t, 2), i = Ks(e, t, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function jU(t, e) { +function Xj(t, e) { var r = Hs(t, e, 14), n = Hs(t, e, 18), i = Hs(e, t, 9), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function qU(t, e) { - var r = Ws(t, e, 14), n = Ws(t, e, 18), i = Ws(e, t, 9), s = r ^ n ^ i; +function Zj(t, e) { + var r = Ks(t, e, 14), n = Ks(t, e, 18), i = Ks(e, t, 9), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function zU(t, e) { - var r = Hs(t, e, 1), n = Hs(t, e, 8), i = s8(t, e, 7), s = r ^ n ^ i; +function Qj(t, e) { + var r = Hs(t, e, 1), n = Hs(t, e, 8), i = a8(t, e, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function HU(t, e) { - var r = Ws(t, e, 1), n = Ws(t, e, 8), i = o8(t, e, 7), s = r ^ n ^ i; +function eU(t, e) { + var r = Ks(t, e, 1), n = Ks(t, e, 8), i = c8(t, e, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function WU(t, e) { - var r = Hs(t, e, 19), n = Hs(e, t, 29), i = s8(t, e, 6), s = r ^ n ^ i; +function tU(t, e) { + var r = Hs(t, e, 19), n = Hs(e, t, 29), i = a8(t, e, 6), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function KU(t, e) { - var r = Ws(t, e, 19), n = Ws(e, t, 29), i = o8(t, e, 6), s = r ^ n ^ i; +function rU(t, e) { + var r = Ks(t, e, 19), n = Ks(e, t, 29), i = c8(t, e, 6), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -var _1 = xr, u8 = c8; -function Bo() { - if (!(this instanceof Bo)) - return new Bo(); - u8.call(this), this.h = [ +var _1 = xr, l8 = f8; +function Uo() { + if (!(this instanceof Uo)) + return new Uo(); + l8.call(this), this.h = [ 3418070365, 3238371032, 1654270250, @@ -10894,64 +10894,64 @@ function Bo() { 3204075428 ]; } -_1.inherits(Bo, u8); -var VU = Bo; -Bo.blockSize = 1024; -Bo.outSize = 384; -Bo.hmacStrength = 192; -Bo.padLength = 128; -Bo.prototype._digest = function(e) { +_1.inherits(Uo, l8); +var nU = Uo; +Uo.blockSize = 1024; +Uo.outSize = 384; +Uo.hmacStrength = 192; +Uo.padLength = 128; +Uo.prototype._digest = function(e) { return e === "hex" ? _1.toHex32(this.h.slice(0, 12), "big") : _1.split32(this.h.slice(0, 12), "big"); }; -Lu.sha1 = gU; -Lu.sha224 = MU; -Lu.sha256 = n8; -Lu.sha384 = VU; -Lu.sha512 = c8; -var f8 = {}, fc = xr, GU = Nu, cd = fc.rotl32, _x = fc.sum32, Ef = fc.sum32_3, Ex = fc.sum32_4, l8 = GU.BlockHash; -function Xs() { - if (!(this instanceof Xs)) - return new Xs(); - l8.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = "little"; -} -fc.inherits(Xs, l8); -f8.ripemd160 = Xs; -Xs.blockSize = 512; -Xs.outSize = 160; -Xs.hmacStrength = 192; -Xs.padLength = 64; -Xs.prototype._update = function(e, r) { - for (var n = this.h[0], i = this.h[1], s = this.h[2], o = this.h[3], a = this.h[4], u = n, l = i, d = s, g = o, w = a, A = 0; A < 80; A++) { - var M = _x( - cd( - Ex(n, Sx(A, i, s, o), e[XU[A] + r], YU(A)), - QU[A] +ku.sha1 = Aj; +ku.sha224 = $j; +ku.sha256 = s8; +ku.sha384 = nU; +ku.sha512 = f8; +var h8 = {}, hc = xr, iU = Lu, ud = hc.rotl32, Sx = hc.sum32, Sf = hc.sum32_3, Ax = hc.sum32_4, d8 = iU.BlockHash; +function Qs() { + if (!(this instanceof Qs)) + return new Qs(); + d8.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = "little"; +} +hc.inherits(Qs, d8); +h8.ripemd160 = Qs; +Qs.blockSize = 512; +Qs.outSize = 160; +Qs.hmacStrength = 192; +Qs.padLength = 64; +Qs.prototype._update = function(e, r) { + for (var n = this.h[0], i = this.h[1], s = this.h[2], o = this.h[3], a = this.h[4], u = n, l = i, d = s, p = o, w = a, A = 0; A < 80; A++) { + var P = Sx( + ud( + Ax(n, Px(A, i, s, o), e[aU[A] + r], sU(A)), + uU[A] ), a ); - n = a, a = o, o = cd(s, 10), s = i, i = M, M = _x( - cd( - Ex(u, Sx(79 - A, l, d, g), e[ZU[A] + r], JU(A)), - ej[A] + n = a, a = o, o = ud(s, 10), s = i, i = P, P = Sx( + ud( + Ax(u, Px(79 - A, l, d, p), e[cU[A] + r], oU(A)), + fU[A] ), w - ), u = w, w = g, g = cd(d, 10), d = l, l = M; + ), u = w, w = p, p = ud(d, 10), d = l, l = P; } - M = Ef(this.h[1], s, g), this.h[1] = Ef(this.h[2], o, w), this.h[2] = Ef(this.h[3], a, u), this.h[3] = Ef(this.h[4], n, l), this.h[4] = Ef(this.h[0], i, d), this.h[0] = M; + P = Sf(this.h[1], s, p), this.h[1] = Sf(this.h[2], o, w), this.h[2] = Sf(this.h[3], a, u), this.h[3] = Sf(this.h[4], n, l), this.h[4] = Sf(this.h[0], i, d), this.h[0] = P; }; -Xs.prototype._digest = function(e) { - return e === "hex" ? fc.toHex32(this.h, "little") : fc.split32(this.h, "little"); +Qs.prototype._digest = function(e) { + return e === "hex" ? hc.toHex32(this.h, "little") : hc.split32(this.h, "little"); }; -function Sx(t, e, r, n) { +function Px(t, e, r, n) { return t <= 15 ? e ^ r ^ n : t <= 31 ? e & r | ~e & n : t <= 47 ? (e | ~r) ^ n : t <= 63 ? e & n | r & ~n : e ^ (r | ~n); } -function YU(t) { +function sU(t) { return t <= 15 ? 0 : t <= 31 ? 1518500249 : t <= 47 ? 1859775393 : t <= 63 ? 2400959708 : 2840853838; } -function JU(t) { +function oU(t) { return t <= 15 ? 1352829926 : t <= 31 ? 1548603684 : t <= 47 ? 1836072691 : t <= 63 ? 2053994217 : 0; } -var XU = [ +var aU = [ 0, 1, 2, @@ -11032,7 +11032,7 @@ var XU = [ 6, 15, 13 -], ZU = [ +], cU = [ 5, 14, 7, @@ -11113,7 +11113,7 @@ var XU = [ 3, 9, 11 -], QU = [ +], uU = [ 11, 14, 15, @@ -11194,7 +11194,7 @@ var XU = [ 8, 5, 6 -], ej = [ +], fU = [ 8, 9, 9, @@ -11275,15 +11275,15 @@ var XU = [ 13, 11, 11 -], tj = xr, rj = yc; -function Eu(t, e, r) { - if (!(this instanceof Eu)) - return new Eu(t, e, r); - this.Hash = t, this.blockSize = t.blockSize / 8, this.outSize = t.outSize / 8, this.inner = null, this.outer = null, this._init(tj.toArray(e, r)); -} -var nj = Eu; -Eu.prototype._init = function(e) { - e.length > this.blockSize && (e = new this.Hash().update(e).digest()), rj(e.length <= this.blockSize); +], lU = xr, hU = wc; +function Su(t, e, r) { + if (!(this instanceof Su)) + return new Su(t, e, r); + this.Hash = t, this.blockSize = t.blockSize / 8, this.outSize = t.outSize / 8, this.inner = null, this.outer = null, this._init(lU.toArray(e, r)); +} +var dU = Su; +Su.prototype._init = function(e) { + e.length > this.blockSize && (e = new this.Hash().update(e).digest()), hU(e.length <= this.blockSize); for (var r = e.length; r < this.blockSize; r++) e.push(0); for (r = 0; r < e.length; r++) @@ -11292,39 +11292,39 @@ Eu.prototype._init = function(e) { e[r] ^= 106; this.outer = new this.Hash().update(e); }; -Eu.prototype.update = function(e, r) { +Su.prototype.update = function(e, r) { return this.inner.update(e, r), this; }; -Eu.prototype.digest = function(e) { +Su.prototype.digest = function(e) { return this.outer.update(this.inner.digest()), this.outer.digest(e); }; (function(t) { var e = t; - e.utils = xr, e.common = Nu, e.sha = Lu, e.ripemd = f8, e.hmac = nj, e.sha1 = e.sha.sha1, e.sha256 = e.sha.sha256, e.sha224 = e.sha.sha224, e.sha384 = e.sha.sha384, e.sha512 = e.sha.sha512, e.ripemd160 = e.ripemd.ripemd160; -})(Kl); -const bo = /* @__PURE__ */ ts(Kl); -function $u(t, e, r) { + e.utils = xr, e.common = Lu, e.sha = ku, e.ripemd = h8, e.hmac = dU, e.sha1 = e.sha.sha1, e.sha256 = e.sha.sha256, e.sha224 = e.sha.sha224, e.sha384 = e.sha.sha384, e.sha512 = e.sha.sha512, e.ripemd160 = e.ripemd.ripemd160; +})(Vl); +const xo = /* @__PURE__ */ rs(Vl); +function Bu(t, e, r) { return r = { path: e, exports: {}, require: function(n, i) { - return ij(n, i ?? r.path); + return pU(n, i ?? r.path); } }, t(r, r.exports), r.exports; } -function ij() { +function pU() { throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs"); } -var Wv = h8; -function h8(t, e) { +var Hv = p8; +function p8(t, e) { if (!t) throw new Error(e || "Assertion failed"); } -h8.equal = function(e, r, n) { +p8.equal = function(e, r, n) { if (e != r) throw new Error(n || "Assertion failed: " + e + " != " + r); }; -var ws = $u(function(t, e) { +var xs = Bu(function(t, e) { var r = e; function n(o, a) { if (Array.isArray(o)) @@ -11343,8 +11343,8 @@ var ws = $u(function(t, e) { u.push(parseInt(o[l] + o[l + 1], 16)); } else for (var l = 0; l < o.length; l++) { - var d = o.charCodeAt(l), g = d >> 8, w = d & 255; - g ? u.push(g, w) : u.push(w); + var d = o.charCodeAt(l), p = d >> 8, w = d & 255; + p ? u.push(p, w) : u.push(w); } return u; } @@ -11361,17 +11361,17 @@ var ws = $u(function(t, e) { r.toHex = s, r.encode = function(a, u) { return u === "hex" ? s(a) : a; }; -}), $i = $u(function(t, e) { +}), Bi = Bu(function(t, e) { var r = e; - r.assert = Wv, r.toArray = ws.toArray, r.zero2 = ws.zero2, r.toHex = ws.toHex, r.encode = ws.encode; + r.assert = Hv, r.toArray = xs.toArray, r.zero2 = xs.zero2, r.toHex = xs.toHex, r.encode = xs.encode; function n(u, l, d) { - var g = new Array(Math.max(u.bitLength(), d) + 1); - g.fill(0); - for (var w = 1 << l + 1, A = u.clone(), M = 0; M < g.length; M++) { + var p = new Array(Math.max(u.bitLength(), d) + 1); + p.fill(0); + for (var w = 1 << l + 1, A = u.clone(), P = 0; P < p.length; P++) { var N, L = A.andln(w - 1); - A.isOdd() ? (L > (w >> 1) - 1 ? N = (w >> 1) - L : N = L, A.isubn(N)) : N = 0, g[M] = N, A.iushrn(1); + A.isOdd() ? (L > (w >> 1) - 1 ? N = (w >> 1) - L : N = L, A.isubn(N)) : N = 0, p[P] = N, A.iushrn(1); } - return g; + return p; } r.getNAF = n; function i(u, l) { @@ -11380,21 +11380,21 @@ var ws = $u(function(t, e) { [] ]; u = u.clone(), l = l.clone(); - for (var g = 0, w = 0, A; u.cmpn(-g) > 0 || l.cmpn(-w) > 0; ) { - var M = u.andln(3) + g & 3, N = l.andln(3) + w & 3; - M === 3 && (M = -1), N === 3 && (N = -1); + for (var p = 0, w = 0, A; u.cmpn(-p) > 0 || l.cmpn(-w) > 0; ) { + var P = u.andln(3) + p & 3, N = l.andln(3) + w & 3; + P === 3 && (P = -1), N === 3 && (N = -1); var L; - M & 1 ? (A = u.andln(7) + g & 7, (A === 3 || A === 5) && N === 2 ? L = -M : L = M) : L = 0, d[0].push(L); + P & 1 ? (A = u.andln(7) + p & 7, (A === 3 || A === 5) && N === 2 ? L = -P : L = P) : L = 0, d[0].push(L); var $; - N & 1 ? (A = l.andln(7) + w & 7, (A === 3 || A === 5) && M === 2 ? $ = -N : $ = N) : $ = 0, d[1].push($), 2 * g === L + 1 && (g = 1 - g), 2 * w === $ + 1 && (w = 1 - w), u.iushrn(1), l.iushrn(1); + N & 1 ? (A = l.andln(7) + w & 7, (A === 3 || A === 5) && P === 2 ? $ = -N : $ = N) : $ = 0, d[1].push($), 2 * p === L + 1 && (p = 1 - p), 2 * w === $ + 1 && (w = 1 - w), u.iushrn(1), l.iushrn(1); } return d; } r.getJSF = i; function s(u, l, d) { - var g = "_" + l; + var p = "_" + l; u.prototype[l] = function() { - return this[g] !== void 0 ? this[g] : this[g] = d.call(this); + return this[p] !== void 0 ? this[p] : this[p] = d.call(this); }; } r.cachedProperty = s; @@ -11403,25 +11403,25 @@ var ws = $u(function(t, e) { } r.parseBytes = o; function a(u) { - return new ir(u, "hex", "le"); + return new sr(u, "hex", "le"); } r.intFromLE = a; -}), r0 = $i.getNAF, sj = $i.getJSF, n0 = $i.assert; -function Ma(t, e) { - this.type = t, this.p = new ir(e.p, 16), this.red = e.prime ? ir.red(e.prime) : ir.mont(this.p), this.zero = new ir(0).toRed(this.red), this.one = new ir(1).toRed(this.red), this.two = new ir(2).toRed(this.red), this.n = e.n && new ir(e.n, 16), this.g = e.g && this.pointFromJSON(e.g, e.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; +}), n0 = Bi.getNAF, gU = Bi.getJSF, i0 = Bi.assert; +function Ta(t, e) { + this.type = t, this.p = new sr(e.p, 16), this.red = e.prime ? sr.red(e.prime) : sr.mont(this.p), this.zero = new sr(0).toRed(this.red), this.one = new sr(1).toRed(this.red), this.two = new sr(2).toRed(this.red), this.n = e.n && new sr(e.n, 16), this.g = e.g && this.pointFromJSON(e.g, e.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; var r = this.n && this.p.div(this.n); !r || r.cmpn(100) > 0 ? this.redN = null : (this._maxwellTrick = !0, this.redN = this.n.toRed(this.red)); } -var wc = Ma; -Ma.prototype.point = function() { +var xc = Ta; +Ta.prototype.point = function() { throw new Error("Not implemented"); }; -Ma.prototype.validate = function() { +Ta.prototype.validate = function() { throw new Error("Not implemented"); }; -Ma.prototype._fixedNafMul = function(e, r) { - n0(e.precomputed); - var n = e._getDoubles(), i = r0(r, 1, this._bitLength), s = (1 << n.step + 1) - (n.step % 2 === 0 ? 2 : 1); +Ta.prototype._fixedNafMul = function(e, r) { + i0(e.precomputed); + var n = e._getDoubles(), i = n0(r, 1, this._bitLength), s = (1 << n.step + 1) - (n.step % 2 === 0 ? 2 : 1); s /= 3; var o = [], a, u; for (a = 0; a < i.length; a += n.step) { @@ -11430,41 +11430,41 @@ Ma.prototype._fixedNafMul = function(e, r) { u = (u << 1) + i[l]; o.push(u); } - for (var d = this.jpoint(null, null, null), g = this.jpoint(null, null, null), w = s; w > 0; w--) { + for (var d = this.jpoint(null, null, null), p = this.jpoint(null, null, null), w = s; w > 0; w--) { for (a = 0; a < o.length; a++) - u = o[a], u === w ? g = g.mixedAdd(n.points[a]) : u === -w && (g = g.mixedAdd(n.points[a].neg())); - d = d.add(g); + u = o[a], u === w ? p = p.mixedAdd(n.points[a]) : u === -w && (p = p.mixedAdd(n.points[a].neg())); + d = d.add(p); } return d.toP(); }; -Ma.prototype._wnafMul = function(e, r) { +Ta.prototype._wnafMul = function(e, r) { var n = 4, i = e._getNAFPoints(n); n = i.wnd; - for (var s = i.points, o = r0(r, n, this._bitLength), a = this.jpoint(null, null, null), u = o.length - 1; u >= 0; u--) { + for (var s = i.points, o = n0(r, n, this._bitLength), a = this.jpoint(null, null, null), u = o.length - 1; u >= 0; u--) { for (var l = 0; u >= 0 && o[u] === 0; u--) l++; if (u >= 0 && l++, a = a.dblp(l), u < 0) break; var d = o[u]; - n0(d !== 0), e.type === "affine" ? d > 0 ? a = a.mixedAdd(s[d - 1 >> 1]) : a = a.mixedAdd(s[-d - 1 >> 1].neg()) : d > 0 ? a = a.add(s[d - 1 >> 1]) : a = a.add(s[-d - 1 >> 1].neg()); + i0(d !== 0), e.type === "affine" ? d > 0 ? a = a.mixedAdd(s[d - 1 >> 1]) : a = a.mixedAdd(s[-d - 1 >> 1].neg()) : d > 0 ? a = a.add(s[d - 1 >> 1]) : a = a.add(s[-d - 1 >> 1].neg()); } return e.type === "affine" ? a.toP() : a; }; -Ma.prototype._wnafMulAdd = function(e, r, n, i, s) { - var o = this._wnafT1, a = this._wnafT2, u = this._wnafT3, l = 0, d, g, w; +Ta.prototype._wnafMulAdd = function(e, r, n, i, s) { + var o = this._wnafT1, a = this._wnafT2, u = this._wnafT3, l = 0, d, p, w; for (d = 0; d < i; d++) { w = r[d]; var A = w._getNAFPoints(e); o[d] = A.wnd, a[d] = A.points; } for (d = i - 1; d >= 1; d -= 2) { - var M = d - 1, N = d; - if (o[M] !== 1 || o[N] !== 1) { - u[M] = r0(n[M], o[M], this._bitLength), u[N] = r0(n[N], o[N], this._bitLength), l = Math.max(u[M].length, l), l = Math.max(u[N].length, l); + var P = d - 1, N = d; + if (o[P] !== 1 || o[N] !== 1) { + u[P] = n0(n[P], o[P], this._bitLength), u[N] = n0(n[N], o[N], this._bitLength), l = Math.max(u[P].length, l), l = Math.max(u[N].length, l); continue; } var L = [ - r[M], + r[P], /* 1 */ null, /* 3 */ @@ -11473,7 +11473,7 @@ Ma.prototype._wnafMulAdd = function(e, r, n, i, s) { r[N] /* 7 */ ]; - r[M].y.cmp(r[N].y) === 0 ? (L[1] = r[M].add(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())) : r[M].y.cmp(r[N].y.redNeg()) === 0 ? (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].add(r[N].neg())) : (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())); + r[P].y.cmp(r[N].y) === 0 ? (L[1] = r[P].add(r[N]), L[2] = r[P].toJ().mixedAdd(r[N].neg())) : r[P].y.cmp(r[N].y.redNeg()) === 0 ? (L[1] = r[P].toJ().mixedAdd(r[N]), L[2] = r[P].add(r[N].neg())) : (L[1] = r[P].toJ().mixedAdd(r[N]), L[2] = r[P].toJ().mixedAdd(r[N].neg())); var $ = [ -3, /* -1 -1 */ @@ -11493,48 +11493,48 @@ Ma.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 1 0 */ 3 /* 1 1 */ - ], F = sj(n[M], n[N]); - for (l = Math.max(F[0].length, l), u[M] = new Array(l), u[N] = new Array(l), g = 0; g < l; g++) { - var K = F[0][g] | 0, H = F[1][g] | 0; - u[M][g] = $[(K + 1) * 3 + (H + 1)], u[N][g] = 0, a[M] = L; + ], B = gU(n[P], n[N]); + for (l = Math.max(B[0].length, l), u[P] = new Array(l), u[N] = new Array(l), p = 0; p < l; p++) { + var H = B[0][p] | 0, W = B[1][p] | 0; + u[P][p] = $[(H + 1) * 3 + (W + 1)], u[N][p] = 0, a[P] = L; } } var V = this.jpoint(null, null, null), te = this._wnafT4; for (d = l; d >= 0; d--) { for (var R = 0; d >= 0; ) { - var W = !0; - for (g = 0; g < i; g++) - te[g] = u[g][d] | 0, te[g] !== 0 && (W = !1); - if (!W) + var K = !0; + for (p = 0; p < i; p++) + te[p] = u[p][d] | 0, te[p] !== 0 && (K = !1); + if (!K) break; R++, d--; } if (d >= 0 && R++, V = V.dblp(R), d < 0) break; - for (g = 0; g < i; g++) { - var pe = te[g]; - pe !== 0 && (pe > 0 ? w = a[g][pe - 1 >> 1] : pe < 0 && (w = a[g][-pe - 1 >> 1].neg()), w.type === "affine" ? V = V.mixedAdd(w) : V = V.add(w)); + for (p = 0; p < i; p++) { + var ge = te[p]; + ge !== 0 && (ge > 0 ? w = a[p][ge - 1 >> 1] : ge < 0 && (w = a[p][-ge - 1 >> 1].neg()), w.type === "affine" ? V = V.mixedAdd(w) : V = V.add(w)); } } for (d = 0; d < i; d++) a[d] = null; return s ? V : V.toP(); }; -function ns(t, e) { +function is(t, e) { this.curve = t, this.type = e, this.precomputed = null; } -Ma.BasePoint = ns; -ns.prototype.eq = function() { +Ta.BasePoint = is; +is.prototype.eq = function() { throw new Error("Not implemented"); }; -ns.prototype.validate = function() { +is.prototype.validate = function() { return this.curve.validate(this); }; -Ma.prototype.decodePoint = function(e, r) { - e = $i.toArray(e, r); +Ta.prototype.decodePoint = function(e, r) { + e = Bi.toArray(e, r); var n = this.p.byteLength(); if ((e[0] === 4 || e[0] === 6 || e[0] === 7) && e.length - 1 === 2 * n) { - e[0] === 6 ? n0(e[e.length - 1] % 2 === 0) : e[0] === 7 && n0(e[e.length - 1] % 2 === 1); + e[0] === 6 ? i0(e[e.length - 1] % 2 === 0) : e[0] === 7 && i0(e[e.length - 1] % 2 === 1); var i = this.point( e.slice(1, 1 + n), e.slice(1 + n, 1 + 2 * n) @@ -11544,17 +11544,17 @@ Ma.prototype.decodePoint = function(e, r) { return this.pointFromX(e.slice(1, 1 + n), e[0] === 3); throw new Error("Unknown point format"); }; -ns.prototype.encodeCompressed = function(e) { +is.prototype.encodeCompressed = function(e) { return this.encode(e, !0); }; -ns.prototype._encode = function(e) { +is.prototype._encode = function(e) { var r = this.curve.p.byteLength(), n = this.getX().toArray("be", r); return e ? [this.getY().isEven() ? 2 : 3].concat(n) : [4].concat(n, this.getY().toArray("be", r)); }; -ns.prototype.encode = function(e, r) { - return $i.encode(this._encode(r), e); +is.prototype.encode = function(e, r) { + return Bi.encode(this._encode(r), e); }; -ns.prototype.precompute = function(e) { +is.prototype.precompute = function(e) { if (this.precomputed) return this; var r = { @@ -11564,13 +11564,13 @@ ns.prototype.precompute = function(e) { }; return r.naf = this._getNAFPoints(8), r.doubles = this._getDoubles(4, e), r.beta = this._getBeta(), this.precomputed = r, this; }; -ns.prototype._hasDoubles = function(e) { +is.prototype._hasDoubles = function(e) { if (!this.precomputed) return !1; var r = this.precomputed.doubles; return r ? r.points.length >= Math.ceil((e.bitLength() + 1) / r.step) : !1; }; -ns.prototype._getDoubles = function(e, r) { +is.prototype._getDoubles = function(e, r) { if (this.precomputed && this.precomputed.doubles) return this.precomputed.doubles; for (var n = [this], i = this, s = 0; s < r; s += e) { @@ -11583,7 +11583,7 @@ ns.prototype._getDoubles = function(e, r) { points: n }; }; -ns.prototype._getNAFPoints = function(e) { +is.prototype._getNAFPoints = function(e) { if (this.precomputed && this.precomputed.naf) return this.precomputed.naf; for (var r = [this], n = (1 << e) - 1, i = n === 1 ? null : this.dbl(), s = 1; s < n; s++) @@ -11593,15 +11593,15 @@ ns.prototype._getNAFPoints = function(e) { points: r }; }; -ns.prototype._getBeta = function() { +is.prototype._getBeta = function() { return null; }; -ns.prototype.dblp = function(e) { +is.prototype.dblp = function(e) { for (var r = this, n = 0; n < e; n++) r = r.dbl(); return r; }; -var Kv = $u(function(t) { +var Kv = Bu(function(t) { typeof Object.create == "function" ? t.exports = function(r, n) { n && (r.super_ = n, r.prototype = Object.create(n.prototype, { constructor: { @@ -11619,32 +11619,32 @@ var Kv = $u(function(t) { i.prototype = n.prototype, r.prototype = new i(), r.prototype.constructor = r; } }; -}), oj = $i.assert; -function is(t) { - wc.call(this, "short", t), this.a = new ir(t.a, 16).toRed(this.red), this.b = new ir(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); +}), mU = Bi.assert; +function ss(t) { + xc.call(this, "short", t), this.a = new sr(t.a, 16).toRed(this.red), this.b = new sr(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); } -Kv(is, wc); -var aj = is; -is.prototype._getEndomorphism = function(e) { +Kv(ss, xc); +var vU = ss; +ss.prototype._getEndomorphism = function(e) { if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { var r, n; if (e.beta) - r = new ir(e.beta, 16).toRed(this.red); + r = new sr(e.beta, 16).toRed(this.red); else { var i = this._getEndoRoots(this.p); r = i[0].cmp(i[1]) < 0 ? i[0] : i[1], r = r.toRed(this.red); } if (e.lambda) - n = new ir(e.lambda, 16); + n = new sr(e.lambda, 16); else { var s = this._getEndoRoots(this.n); - this.g.mul(s[0]).x.cmp(this.g.x.redMul(r)) === 0 ? n = s[0] : (n = s[1], oj(this.g.mul(n).x.cmp(this.g.x.redMul(r)) === 0)); + this.g.mul(s[0]).x.cmp(this.g.x.redMul(r)) === 0 ? n = s[0] : (n = s[1], mU(this.g.mul(n).x.cmp(this.g.x.redMul(r)) === 0)); } var o; return e.basis ? o = e.basis.map(function(a) { return { - a: new ir(a.a, 16), - b: new ir(a.b, 16) + a: new sr(a.a, 16), + b: new sr(a.b, 16) }; }) : o = this._getEndoBasis(n), { beta: r, @@ -11653,66 +11653,66 @@ is.prototype._getEndomorphism = function(e) { }; } }; -is.prototype._getEndoRoots = function(e) { - var r = e === this.p ? this.red : ir.mont(e), n = new ir(2).toRed(r).redInvm(), i = n.redNeg(), s = new ir(3).toRed(r).redNeg().redSqrt().redMul(n), o = i.redAdd(s).fromRed(), a = i.redSub(s).fromRed(); +ss.prototype._getEndoRoots = function(e) { + var r = e === this.p ? this.red : sr.mont(e), n = new sr(2).toRed(r).redInvm(), i = n.redNeg(), s = new sr(3).toRed(r).redNeg().redSqrt().redMul(n), o = i.redAdd(s).fromRed(), a = i.redSub(s).fromRed(); return [o, a]; }; -is.prototype._getEndoBasis = function(e) { - for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new ir(1), o = new ir(0), a = new ir(0), u = new ir(1), l, d, g, w, A, M, N, L = 0, $, F; n.cmpn(0) !== 0; ) { - var K = i.div(n); - $ = i.sub(K.mul(n)), F = a.sub(K.mul(s)); - var H = u.sub(K.mul(o)); - if (!g && $.cmp(r) < 0) - l = N.neg(), d = s, g = $.neg(), w = F; - else if (g && ++L === 2) +ss.prototype._getEndoBasis = function(e) { + for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new sr(1), o = new sr(0), a = new sr(0), u = new sr(1), l, d, p, w, A, P, N, L = 0, $, B; n.cmpn(0) !== 0; ) { + var H = i.div(n); + $ = i.sub(H.mul(n)), B = a.sub(H.mul(s)); + var W = u.sub(H.mul(o)); + if (!p && $.cmp(r) < 0) + l = N.neg(), d = s, p = $.neg(), w = B; + else if (p && ++L === 2) break; - N = $, i = n, n = $, a = s, s = F, u = o, o = H; + N = $, i = n, n = $, a = s, s = B, u = o, o = W; } - A = $.neg(), M = F; - var V = g.sqr().add(w.sqr()), te = A.sqr().add(M.sqr()); - return te.cmp(V) >= 0 && (A = l, M = d), g.negative && (g = g.neg(), w = w.neg()), A.negative && (A = A.neg(), M = M.neg()), [ - { a: g, b: w }, - { a: A, b: M } + A = $.neg(), P = B; + var V = p.sqr().add(w.sqr()), te = A.sqr().add(P.sqr()); + return te.cmp(V) >= 0 && (A = l, P = d), p.negative && (p = p.neg(), w = w.neg()), A.negative && (A = A.neg(), P = P.neg()), [ + { a: p, b: w }, + { a: A, b: P } ]; }; -is.prototype._endoSplit = function(e) { - var r = this.endo.basis, n = r[0], i = r[1], s = i.b.mul(e).divRound(this.n), o = n.b.neg().mul(e).divRound(this.n), a = s.mul(n.a), u = o.mul(i.a), l = s.mul(n.b), d = o.mul(i.b), g = e.sub(a).sub(u), w = l.add(d).neg(); - return { k1: g, k2: w }; +ss.prototype._endoSplit = function(e) { + var r = this.endo.basis, n = r[0], i = r[1], s = i.b.mul(e).divRound(this.n), o = n.b.neg().mul(e).divRound(this.n), a = s.mul(n.a), u = o.mul(i.a), l = s.mul(n.b), d = o.mul(i.b), p = e.sub(a).sub(u), w = l.add(d).neg(); + return { k1: p, k2: w }; }; -is.prototype.pointFromX = function(e, r) { - e = new ir(e, 16), e.red || (e = e.toRed(this.red)); +ss.prototype.pointFromX = function(e, r) { + e = new sr(e, 16), e.red || (e = e.toRed(this.red)); var n = e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b), i = n.redSqrt(); if (i.redSqr().redSub(n).cmp(this.zero) !== 0) throw new Error("invalid point"); var s = i.fromRed().isOdd(); return (r && !s || !r && s) && (i = i.redNeg()), this.point(e, i); }; -is.prototype.validate = function(e) { +ss.prototype.validate = function(e) { if (e.inf) return !0; var r = e.x, n = e.y, i = this.a.redMul(r), s = r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b); return n.redSqr().redISub(s).cmpn(0) === 0; }; -is.prototype._endoWnafMulAdd = function(e, r, n) { +ss.prototype._endoWnafMulAdd = function(e, r, n) { for (var i = this._endoWnafT1, s = this._endoWnafT2, o = 0; o < e.length; o++) { var a = this._endoSplit(r[o]), u = e[o], l = u._getBeta(); a.k1.negative && (a.k1.ineg(), u = u.neg(!0)), a.k2.negative && (a.k2.ineg(), l = l.neg(!0)), i[o * 2] = u, i[o * 2 + 1] = l, s[o * 2] = a.k1, s[o * 2 + 1] = a.k2; } - for (var d = this._wnafMulAdd(1, i, s, o * 2, n), g = 0; g < o * 2; g++) - i[g] = null, s[g] = null; + for (var d = this._wnafMulAdd(1, i, s, o * 2, n), p = 0; p < o * 2; p++) + i[p] = null, s[p] = null; return d; }; -function Ln(t, e, r, n) { - wc.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new ir(e, 16), this.y = new ir(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); +function kn(t, e, r, n) { + xc.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new sr(e, 16), this.y = new sr(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); } -Kv(Ln, wc.BasePoint); -is.prototype.point = function(e, r, n) { - return new Ln(this, e, r, n); +Kv(kn, xc.BasePoint); +ss.prototype.point = function(e, r, n) { + return new kn(this, e, r, n); }; -is.prototype.pointFromJSON = function(e, r) { - return Ln.fromJSON(this, e, r); +ss.prototype.pointFromJSON = function(e, r) { + return kn.fromJSON(this, e, r); }; -Ln.prototype._getBeta = function() { +kn.prototype._getBeta = function() { if (this.curve.endo) { var e = this.precomputed; if (e && e.beta) @@ -11737,7 +11737,7 @@ Ln.prototype._getBeta = function() { return r; } }; -Ln.prototype.toJSON = function() { +kn.prototype.toJSON = function() { return this.precomputed ? [this.x, this.y, this.precomputed && { doubles: this.precomputed.doubles && { step: this.precomputed.doubles.step, @@ -11749,7 +11749,7 @@ Ln.prototype.toJSON = function() { } }] : [this.x, this.y]; }; -Ln.fromJSON = function(e, r, n) { +kn.fromJSON = function(e, r, n) { typeof r == "string" && (r = JSON.parse(r)); var i = e.point(r[0], r[1], n); if (!r[2]) @@ -11770,13 +11770,13 @@ Ln.fromJSON = function(e, r, n) { } }, i; }; -Ln.prototype.inspect = function() { +kn.prototype.inspect = function() { return this.isInfinity() ? "" : ""; }; -Ln.prototype.isInfinity = function() { +kn.prototype.isInfinity = function() { return this.inf; }; -Ln.prototype.add = function(e) { +kn.prototype.add = function(e) { if (this.inf) return e; if (e.inf) @@ -11792,7 +11792,7 @@ Ln.prototype.add = function(e) { var n = r.redSqr().redISub(this.x).redISub(e.x), i = r.redMul(this.x.redSub(n)).redISub(this.y); return this.curve.point(n, i); }; -Ln.prototype.dbl = function() { +kn.prototype.dbl = function() { if (this.inf) return this; var e = this.y.redAdd(this.y); @@ -11801,27 +11801,27 @@ Ln.prototype.dbl = function() { var r = this.curve.a, n = this.x.redSqr(), i = e.redInvm(), s = n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i), o = s.redSqr().redISub(this.x.redAdd(this.x)), a = s.redMul(this.x.redSub(o)).redISub(this.y); return this.curve.point(o, a); }; -Ln.prototype.getX = function() { +kn.prototype.getX = function() { return this.x.fromRed(); }; -Ln.prototype.getY = function() { +kn.prototype.getY = function() { return this.y.fromRed(); }; -Ln.prototype.mul = function(e) { - return e = new ir(e, 16), this.isInfinity() ? this : this._hasDoubles(e) ? this.curve._fixedNafMul(this, e) : this.curve.endo ? this.curve._endoWnafMulAdd([this], [e]) : this.curve._wnafMul(this, e); +kn.prototype.mul = function(e) { + return e = new sr(e, 16), this.isInfinity() ? this : this._hasDoubles(e) ? this.curve._fixedNafMul(this, e) : this.curve.endo ? this.curve._endoWnafMulAdd([this], [e]) : this.curve._wnafMul(this, e); }; -Ln.prototype.mulAdd = function(e, r, n) { +kn.prototype.mulAdd = function(e, r, n) { var i = [this, r], s = [e, n]; return this.curve.endo ? this.curve._endoWnafMulAdd(i, s) : this.curve._wnafMulAdd(1, i, s, 2); }; -Ln.prototype.jmulAdd = function(e, r, n) { +kn.prototype.jmulAdd = function(e, r, n) { var i = [this, r], s = [e, n]; return this.curve.endo ? this.curve._endoWnafMulAdd(i, s, !0) : this.curve._wnafMulAdd(1, i, s, 2, !0); }; -Ln.prototype.eq = function(e) { +kn.prototype.eq = function(e) { return this === e || this.inf === e.inf && (this.inf || this.x.cmp(e.x) === 0 && this.y.cmp(e.y) === 0); }; -Ln.prototype.neg = function(e) { +kn.prototype.neg = function(e) { if (this.inf) return this; var r = this.curve.point(this.x, this.y.redNeg()); @@ -11842,29 +11842,29 @@ Ln.prototype.neg = function(e) { } return r; }; -Ln.prototype.toJ = function() { +kn.prototype.toJ = function() { if (this.inf) return this.curve.jpoint(null, null, null); var e = this.curve.jpoint(this.x, this.y, this.curve.one); return e; }; -function qn(t, e, r, n) { - wc.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new ir(0)) : (this.x = new ir(e, 16), this.y = new ir(r, 16), this.z = new ir(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; +function zn(t, e, r, n) { + xc.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new sr(0)) : (this.x = new sr(e, 16), this.y = new sr(r, 16), this.z = new sr(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; } -Kv(qn, wc.BasePoint); -is.prototype.jpoint = function(e, r, n) { - return new qn(this, e, r, n); +Kv(zn, xc.BasePoint); +ss.prototype.jpoint = function(e, r, n) { + return new zn(this, e, r, n); }; -qn.prototype.toP = function() { +zn.prototype.toP = function() { if (this.isInfinity()) return this.curve.point(null, null); var e = this.z.redInvm(), r = e.redSqr(), n = this.x.redMul(r), i = this.y.redMul(r).redMul(e); return this.curve.point(n, i); }; -qn.prototype.neg = function() { +zn.prototype.neg = function() { return this.curve.jpoint(this.x, this.y.redNeg(), this.z); }; -qn.prototype.add = function(e) { +zn.prototype.add = function(e) { if (this.isInfinity()) return e; if (e.isInfinity()) @@ -11872,10 +11872,10 @@ qn.prototype.add = function(e) { var r = e.z.redSqr(), n = this.z.redSqr(), i = this.x.redMul(r), s = e.x.redMul(n), o = this.y.redMul(r.redMul(e.z)), a = e.y.redMul(n.redMul(this.z)), u = i.redSub(s), l = o.redSub(a); if (u.cmpn(0) === 0) return l.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var d = u.redSqr(), g = d.redMul(u), w = i.redMul(d), A = l.redSqr().redIAdd(g).redISub(w).redISub(w), M = l.redMul(w.redISub(A)).redISub(o.redMul(g)), N = this.z.redMul(e.z).redMul(u); - return this.curve.jpoint(A, M, N); + var d = u.redSqr(), p = d.redMul(u), w = i.redMul(d), A = l.redSqr().redIAdd(p).redISub(w).redISub(w), P = l.redMul(w.redISub(A)).redISub(o.redMul(p)), N = this.z.redMul(e.z).redMul(u); + return this.curve.jpoint(A, P, N); }; -qn.prototype.mixedAdd = function(e) { +zn.prototype.mixedAdd = function(e) { if (this.isInfinity()) return e.toJ(); if (e.isInfinity()) @@ -11883,10 +11883,10 @@ qn.prototype.mixedAdd = function(e) { var r = this.z.redSqr(), n = this.x, i = e.x.redMul(r), s = this.y, o = e.y.redMul(r).redMul(this.z), a = n.redSub(i), u = s.redSub(o); if (a.cmpn(0) === 0) return u.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var l = a.redSqr(), d = l.redMul(a), g = n.redMul(l), w = u.redSqr().redIAdd(d).redISub(g).redISub(g), A = u.redMul(g.redISub(w)).redISub(s.redMul(d)), M = this.z.redMul(a); - return this.curve.jpoint(w, A, M); + var l = a.redSqr(), d = l.redMul(a), p = n.redMul(l), w = u.redSqr().redIAdd(d).redISub(p).redISub(p), A = u.redMul(p.redISub(w)).redISub(s.redMul(d)), P = this.z.redMul(a); + return this.curve.jpoint(w, A, P); }; -qn.prototype.dblp = function(e) { +zn.prototype.dblp = function(e) { if (e === 0) return this; if (this.isInfinity()) @@ -11902,17 +11902,17 @@ qn.prototype.dblp = function(e) { } var i = this.curve.a, s = this.curve.tinv, o = this.x, a = this.y, u = this.z, l = u.redSqr().redSqr(), d = a.redAdd(a); for (r = 0; r < e; r++) { - var g = o.redSqr(), w = d.redSqr(), A = w.redSqr(), M = g.redAdd(g).redIAdd(g).redIAdd(i.redMul(l)), N = o.redMul(w), L = M.redSqr().redISub(N.redAdd(N)), $ = N.redISub(L), F = M.redMul($); - F = F.redIAdd(F).redISub(A); - var K = d.redMul(u); - r + 1 < e && (l = l.redMul(A)), o = L, u = K, d = F; + var p = o.redSqr(), w = d.redSqr(), A = w.redSqr(), P = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), N = o.redMul(w), L = P.redSqr().redISub(N.redAdd(N)), $ = N.redISub(L), B = P.redMul($); + B = B.redIAdd(B).redISub(A); + var H = d.redMul(u); + r + 1 < e && (l = l.redMul(A)), o = L, u = H, d = B; } return this.curve.jpoint(o, d.redMul(s), u); }; -qn.prototype.dbl = function() { +zn.prototype.dbl = function() { return this.isInfinity() ? this : this.curve.zeroA ? this._zeroDbl() : this.curve.threeA ? this._threeDbl() : this._dbl(); }; -qn.prototype._zeroDbl = function() { +zn.prototype._zeroDbl = function() { var e, r, n; if (this.zOne) { var i = this.x.redSqr(), s = this.y.redSqr(), o = s.redSqr(), a = this.x.redAdd(s).redSqr().redISub(i).redISub(o); @@ -11920,14 +11920,14 @@ qn.prototype._zeroDbl = function() { var u = i.redAdd(i).redIAdd(i), l = u.redSqr().redISub(a).redISub(a), d = o.redIAdd(o); d = d.redIAdd(d), d = d.redIAdd(d), e = l, r = u.redMul(a.redISub(l)).redISub(d), n = this.y.redAdd(this.y); } else { - var g = this.x.redSqr(), w = this.y.redSqr(), A = w.redSqr(), M = this.x.redAdd(w).redSqr().redISub(g).redISub(A); - M = M.redIAdd(M); - var N = g.redAdd(g).redIAdd(g), L = N.redSqr(), $ = A.redIAdd(A); - $ = $.redIAdd($), $ = $.redIAdd($), e = L.redISub(M).redISub(M), r = N.redMul(M.redISub(e)).redISub($), n = this.y.redMul(this.z), n = n.redIAdd(n); + var p = this.x.redSqr(), w = this.y.redSqr(), A = w.redSqr(), P = this.x.redAdd(w).redSqr().redISub(p).redISub(A); + P = P.redIAdd(P); + var N = p.redAdd(p).redIAdd(p), L = N.redSqr(), $ = A.redIAdd(A); + $ = $.redIAdd($), $ = $.redIAdd($), e = L.redISub(P).redISub(P), r = N.redMul(P.redISub(e)).redISub($), n = this.y.redMul(this.z), n = n.redIAdd(n); } return this.curve.jpoint(e, r, n); }; -qn.prototype._threeDbl = function() { +zn.prototype._threeDbl = function() { var e, r, n; if (this.zOne) { var i = this.x.redSqr(), s = this.y.redSqr(), o = s.redSqr(), a = this.x.redAdd(s).redSqr().redISub(i).redISub(o); @@ -11937,45 +11937,45 @@ qn.prototype._threeDbl = function() { var d = o.redIAdd(o); d = d.redIAdd(d), d = d.redIAdd(d), r = u.redMul(a.redISub(l)).redISub(d), n = this.y.redAdd(this.y); } else { - var g = this.z.redSqr(), w = this.y.redSqr(), A = this.x.redMul(w), M = this.x.redSub(g).redMul(this.x.redAdd(g)); - M = M.redAdd(M).redIAdd(M); + var p = this.z.redSqr(), w = this.y.redSqr(), A = this.x.redMul(w), P = this.x.redSub(p).redMul(this.x.redAdd(p)); + P = P.redAdd(P).redIAdd(P); var N = A.redIAdd(A); N = N.redIAdd(N); var L = N.redAdd(N); - e = M.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(g); + e = P.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(p); var $ = w.redSqr(); - $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($), r = M.redMul(N.redISub(e)).redISub($); + $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($), r = P.redMul(N.redISub(e)).redISub($); } return this.curve.jpoint(e, r, n); }; -qn.prototype._dbl = function() { +zn.prototype._dbl = function() { var e = this.curve.a, r = this.x, n = this.y, i = this.z, s = i.redSqr().redSqr(), o = r.redSqr(), a = n.redSqr(), u = o.redAdd(o).redIAdd(o).redIAdd(e.redMul(s)), l = r.redAdd(r); l = l.redIAdd(l); - var d = l.redMul(a), g = u.redSqr().redISub(d.redAdd(d)), w = d.redISub(g), A = a.redSqr(); + var d = l.redMul(a), p = u.redSqr().redISub(d.redAdd(d)), w = d.redISub(p), A = a.redSqr(); A = A.redIAdd(A), A = A.redIAdd(A), A = A.redIAdd(A); - var M = u.redMul(w).redISub(A), N = n.redAdd(n).redMul(i); - return this.curve.jpoint(g, M, N); + var P = u.redMul(w).redISub(A), N = n.redAdd(n).redMul(i); + return this.curve.jpoint(p, P, N); }; -qn.prototype.trpl = function() { +zn.prototype.trpl = function() { if (!this.curve.zeroA) return this.dbl().add(this); var e = this.x.redSqr(), r = this.y.redSqr(), n = this.z.redSqr(), i = r.redSqr(), s = e.redAdd(e).redIAdd(e), o = s.redSqr(), a = this.x.redAdd(r).redSqr().redISub(e).redISub(i); a = a.redIAdd(a), a = a.redAdd(a).redIAdd(a), a = a.redISub(o); var u = a.redSqr(), l = i.redIAdd(i); l = l.redIAdd(l), l = l.redIAdd(l), l = l.redIAdd(l); - var d = s.redIAdd(a).redSqr().redISub(o).redISub(u).redISub(l), g = r.redMul(d); - g = g.redIAdd(g), g = g.redIAdd(g); - var w = this.x.redMul(u).redISub(g); + var d = s.redIAdd(a).redSqr().redISub(o).redISub(u).redISub(l), p = r.redMul(d); + p = p.redIAdd(p), p = p.redIAdd(p); + var w = this.x.redMul(u).redISub(p); w = w.redIAdd(w), w = w.redIAdd(w); var A = this.y.redMul(d.redMul(l.redISub(d)).redISub(a.redMul(u))); A = A.redIAdd(A), A = A.redIAdd(A), A = A.redIAdd(A); - var M = this.z.redAdd(a).redSqr().redISub(n).redISub(u); - return this.curve.jpoint(w, A, M); + var P = this.z.redAdd(a).redSqr().redISub(n).redISub(u); + return this.curve.jpoint(w, A, P); }; -qn.prototype.mul = function(e, r) { - return e = new ir(e, r), this.curve._wnafMul(this, e); +zn.prototype.mul = function(e, r) { + return e = new sr(e, r), this.curve._wnafMul(this, e); }; -qn.prototype.eq = function(e) { +zn.prototype.eq = function(e) { if (e.type === "affine") return this.eq(e.toJ()); if (this === e) @@ -11986,7 +11986,7 @@ qn.prototype.eq = function(e) { var i = r.redMul(this.z), s = n.redMul(e.z); return this.y.redMul(s).redISub(e.y.redMul(i)).cmpn(0) === 0; }; -qn.prototype.eqXToP = function(e) { +zn.prototype.eqXToP = function(e) { var r = this.z.redSqr(), n = e.toRed(this.curve.red).redMul(r); if (this.x.cmp(n) === 0) return !0; @@ -11997,21 +11997,21 @@ qn.prototype.eqXToP = function(e) { return !0; } }; -qn.prototype.inspect = function() { +zn.prototype.inspect = function() { return this.isInfinity() ? "" : ""; }; -qn.prototype.isInfinity = function() { +zn.prototype.isInfinity = function() { return this.z.cmpn(0) === 0; }; -var Ad = $u(function(t, e) { +var Pd = Bu(function(t, e) { var r = e; - r.base = wc, r.short = aj, r.mont = /*RicMoo:ethers:require(./mont)*/ + r.base = xc, r.short = vU, r.mont = /*RicMoo:ethers:require(./mont)*/ null, r.edwards = /*RicMoo:ethers:require(./edwards)*/ null; -}), Pd = $u(function(t, e) { - var r = e, n = $i.assert; +}), Md = Bu(function(t, e) { + var r = e, n = Bi.assert; function i(a) { - a.type === "short" ? this.curve = new Ad.short(a) : a.type === "edwards" ? this.curve = new Ad.edwards(a) : this.curve = new Ad.mont(a), this.g = this.curve.g, this.n = this.curve.n, this.hash = a.hash, n(this.g.validate(), "Invalid curve"), n(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); + a.type === "short" ? this.curve = new Pd.short(a) : a.type === "edwards" ? this.curve = new Pd.edwards(a) : this.curve = new Pd.mont(a), this.g = this.curve.g, this.n = this.curve.n, this.hash = a.hash, n(this.g.validate(), "Invalid curve"), n(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); } r.PresetCurve = i; function s(a, u) { @@ -12035,7 +12035,7 @@ var Ad = $u(function(t, e) { a: "ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc", b: "64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1", n: "ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831", - hash: bo.sha256, + hash: xo.sha256, gRed: !1, g: [ "188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012", @@ -12048,7 +12048,7 @@ var Ad = $u(function(t, e) { a: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe", b: "b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4", n: "ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d", - hash: bo.sha256, + hash: xo.sha256, gRed: !1, g: [ "b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21", @@ -12061,7 +12061,7 @@ var Ad = $u(function(t, e) { a: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc", b: "5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b", n: "ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551", - hash: bo.sha256, + hash: xo.sha256, gRed: !1, g: [ "6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296", @@ -12074,7 +12074,7 @@ var Ad = $u(function(t, e) { a: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc", b: "b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef", n: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973", - hash: bo.sha384, + hash: xo.sha384, gRed: !1, g: [ "aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7", @@ -12087,7 +12087,7 @@ var Ad = $u(function(t, e) { a: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc", b: "00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00", n: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409", - hash: bo.sha512, + hash: xo.sha512, gRed: !1, g: [ "000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66", @@ -12100,7 +12100,7 @@ var Ad = $u(function(t, e) { a: "76d06", b: "1", n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", - hash: bo.sha256, + hash: xo.sha256, gRed: !1, g: [ "9" @@ -12114,7 +12114,7 @@ var Ad = $u(function(t, e) { // -121665 * (121666^(-1)) (mod P) d: "52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3", n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", - hash: bo.sha256, + hash: xo.sha256, gRed: !1, g: [ "216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a", @@ -12137,7 +12137,7 @@ var Ad = $u(function(t, e) { b: "7", n: "ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141", h: "1", - hash: bo.sha256, + hash: xo.sha256, // Precomputed endomorphism beta: "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee", lambda: "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72", @@ -12159,47 +12159,47 @@ var Ad = $u(function(t, e) { ] }); }); -function va(t) { - if (!(this instanceof va)) - return new va(t); +function wa(t) { + if (!(this instanceof wa)) + return new wa(t); this.hash = t.hash, this.predResist = !!t.predResist, this.outLen = this.hash.outSize, this.minEntropy = t.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null; - var e = ws.toArray(t.entropy, t.entropyEnc || "hex"), r = ws.toArray(t.nonce, t.nonceEnc || "hex"), n = ws.toArray(t.pers, t.persEnc || "hex"); - Wv( + var e = xs.toArray(t.entropy, t.entropyEnc || "hex"), r = xs.toArray(t.nonce, t.nonceEnc || "hex"), n = xs.toArray(t.pers, t.persEnc || "hex"); + Hv( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._init(e, r, n); } -var d8 = va; -va.prototype._init = function(e, r, n) { +var g8 = wa; +wa.prototype._init = function(e, r, n) { var i = e.concat(r).concat(n); this.K = new Array(this.outLen / 8), this.V = new Array(this.outLen / 8); for (var s = 0; s < this.V.length; s++) this.K[s] = 0, this.V[s] = 1; this._update(i), this._reseed = 1, this.reseedInterval = 281474976710656; }; -va.prototype._hmac = function() { - return new bo.hmac(this.hash, this.K); +wa.prototype._hmac = function() { + return new xo.hmac(this.hash, this.K); }; -va.prototype._update = function(e) { +wa.prototype._update = function(e) { var r = this._hmac().update(this.V).update([0]); e && (r = r.update(e)), this.K = r.digest(), this.V = this._hmac().update(this.V).digest(), e && (this.K = this._hmac().update(this.V).update([1]).update(e).digest(), this.V = this._hmac().update(this.V).digest()); }; -va.prototype.reseed = function(e, r, n, i) { - typeof r != "string" && (i = n, n = r, r = null), e = ws.toArray(e, r), n = ws.toArray(n, i), Wv( +wa.prototype.reseed = function(e, r, n, i) { + typeof r != "string" && (i = n, n = r, r = null), e = xs.toArray(e, r), n = xs.toArray(n, i), Hv( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._update(e.concat(n || [])), this._reseed = 1; }; -va.prototype.generate = function(e, r, n, i) { +wa.prototype.generate = function(e, r, n, i) { if (this._reseed > this.reseedInterval) throw new Error("Reseed is required"); - typeof r != "string" && (i = n, n = r, r = null), n && (n = ws.toArray(n, i || "hex"), this._update(n)); + typeof r != "string" && (i = n, n = r, r = null), n && (n = xs.toArray(n, i || "hex"), this._update(n)); for (var s = []; s.length < e; ) this.V = this._hmac().update(this.V).digest(), s = s.concat(this.V); var o = s.slice(0, e); - return this._update(n), this._reseed++, ws.encode(o, r); + return this._update(n), this._reseed++, xs.encode(o, r); }; -var E1 = $i.assert; +var E1 = Bi.assert; function Zn(t, e) { this.ec = t, this.priv = null, this.pub = null, e.priv && this._importPrivate(e.priv, e.privEnc), e.pub && this._importPublic(e.pub, e.pubEnc); } @@ -12227,7 +12227,7 @@ Zn.prototype.getPrivate = function(e) { return e === "hex" ? this.priv.toString(16, 2) : this.priv; }; Zn.prototype._importPrivate = function(e, r) { - this.priv = new ir(e, r || 16), this.priv = this.priv.umod(this.ec.curve.n); + this.priv = new sr(e, r || 16), this.priv = this.priv.umod(this.ec.curve.n); }; Zn.prototype._importPublic = function(e, r) { if (e.x || e.y) { @@ -12248,14 +12248,14 @@ Zn.prototype.verify = function(e, r) { Zn.prototype.inspect = function() { return ""; }; -var cj = $i.assert; +var bU = Bi.assert; function H0(t, e) { if (t instanceof H0) return t; - this._importDER(t, e) || (cj(t.r && t.s, "Signature without r or s"), this.r = new ir(t.r, 16), this.s = new ir(t.s, 16), t.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = t.recoveryParam); + this._importDER(t, e) || (bU(t.r && t.s, "Signature without r or s"), this.r = new sr(t.r, 16), this.s = new sr(t.s, 16), t.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = t.recoveryParam); } -var W0 = H0; -function uj() { +var K0 = H0; +function yU() { this.place = 0; } function im(t, e) { @@ -12269,14 +12269,14 @@ function im(t, e) { i <<= 8, i |= t[o], i >>>= 0; return i <= 127 ? !1 : (e.place = o, i); } -function Ax(t) { +function Mx(t) { for (var e = 0, r = t.length - 1; !t[e] && !(t[e + 1] & 128) && e < r; ) e++; return e === 0 ? t : t.slice(e); } H0.prototype._importDER = function(e, r) { - e = $i.toArray(e, r); - var n = new uj(); + e = Bi.toArray(e, r); + var n = new yU(); if (e[n.place++] !== 48) return !1; var i = im(e, n); @@ -12302,7 +12302,7 @@ H0.prototype._importDER = function(e, r) { u = u.slice(1); else return !1; - return this.r = new ir(o), this.s = new ir(u), this.recoveryParam = null, !0; + return this.r = new sr(o), this.s = new sr(u), this.recoveryParam = null, !0; }; function sm(t, e) { if (e < 128) { @@ -12316,100 +12316,100 @@ function sm(t, e) { } H0.prototype.toDER = function(e) { var r = this.r.toArray(), n = this.s.toArray(); - for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Ax(r), n = Ax(n); !n[0] && !(n[1] & 128); ) + for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Mx(r), n = Mx(n); !n[0] && !(n[1] & 128); ) n = n.slice(1); var i = [2]; sm(i, r.length), i = i.concat(r), i.push(2), sm(i, n.length); var s = i.concat(n), o = [48]; - return sm(o, s.length), o = o.concat(s), $i.encode(o, e); + return sm(o, s.length), o = o.concat(s), Bi.encode(o, e); }; -var fj = ( +var wU = ( /*RicMoo:ethers:require(brorand)*/ function() { throw new Error("unsupported"); } -), p8 = $i.assert; -function Qi(t) { - if (!(this instanceof Qi)) - return new Qi(t); - typeof t == "string" && (p8( - Object.prototype.hasOwnProperty.call(Pd, t), +), m8 = Bi.assert; +function es(t) { + if (!(this instanceof es)) + return new es(t); + typeof t == "string" && (m8( + Object.prototype.hasOwnProperty.call(Md, t), "Unknown curve " + t - ), t = Pd[t]), t instanceof Pd.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; + ), t = Md[t]), t instanceof Md.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; } -var lj = Qi; -Qi.prototype.keyPair = function(e) { +var xU = es; +es.prototype.keyPair = function(e) { return new Vv(this, e); }; -Qi.prototype.keyFromPrivate = function(e, r) { +es.prototype.keyFromPrivate = function(e, r) { return Vv.fromPrivate(this, e, r); }; -Qi.prototype.keyFromPublic = function(e, r) { +es.prototype.keyFromPublic = function(e, r) { return Vv.fromPublic(this, e, r); }; -Qi.prototype.genKeyPair = function(e) { +es.prototype.genKeyPair = function(e) { e || (e = {}); - for (var r = new d8({ + for (var r = new g8({ hash: this.hash, pers: e.pers, persEnc: e.persEnc || "utf8", - entropy: e.entropy || fj(this.hash.hmacStrength), + entropy: e.entropy || wU(this.hash.hmacStrength), entropyEnc: e.entropy && e.entropyEnc || "utf8", nonce: this.n.toArray() - }), n = this.n.byteLength(), i = this.n.sub(new ir(2)); ; ) { - var s = new ir(r.generate(n)); + }), n = this.n.byteLength(), i = this.n.sub(new sr(2)); ; ) { + var s = new sr(r.generate(n)); if (!(s.cmp(i) > 0)) return s.iaddn(1), this.keyFromPrivate(s); } }; -Qi.prototype._truncateToN = function(e, r) { +es.prototype._truncateToN = function(e, r) { var n = e.byteLength() * 8 - this.n.bitLength(); return n > 0 && (e = e.ushrn(n)), !r && e.cmp(this.n) >= 0 ? e.sub(this.n) : e; }; -Qi.prototype.sign = function(e, r, n, i) { - typeof n == "object" && (i = n, n = null), i || (i = {}), r = this.keyFromPrivate(r, n), e = this._truncateToN(new ir(e, 16)); - for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new d8({ +es.prototype.sign = function(e, r, n, i) { + typeof n == "object" && (i = n, n = null), i || (i = {}), r = this.keyFromPrivate(r, n), e = this._truncateToN(new sr(e, 16)); + for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new g8({ hash: this.hash, entropy: o, nonce: a, pers: i.pers, persEnc: i.persEnc || "utf8" - }), l = this.n.sub(new ir(1)), d = 0; ; d++) { - var g = i.k ? i.k(d) : new ir(u.generate(this.n.byteLength())); - if (g = this._truncateToN(g, !0), !(g.cmpn(1) <= 0 || g.cmp(l) >= 0)) { - var w = this.g.mul(g); + }), l = this.n.sub(new sr(1)), d = 0; ; d++) { + var p = i.k ? i.k(d) : new sr(u.generate(this.n.byteLength())); + if (p = this._truncateToN(p, !0), !(p.cmpn(1) <= 0 || p.cmp(l) >= 0)) { + var w = this.g.mul(p); if (!w.isInfinity()) { - var A = w.getX(), M = A.umod(this.n); - if (M.cmpn(0) !== 0) { - var N = g.invm(this.n).mul(M.mul(r.getPrivate()).iadd(e)); + var A = w.getX(), P = A.umod(this.n); + if (P.cmpn(0) !== 0) { + var N = p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e)); if (N = N.umod(this.n), N.cmpn(0) !== 0) { - var L = (w.getY().isOdd() ? 1 : 0) | (A.cmp(M) !== 0 ? 2 : 0); - return i.canonical && N.cmp(this.nh) > 0 && (N = this.n.sub(N), L ^= 1), new W0({ r: M, s: N, recoveryParam: L }); + var L = (w.getY().isOdd() ? 1 : 0) | (A.cmp(P) !== 0 ? 2 : 0); + return i.canonical && N.cmp(this.nh) > 0 && (N = this.n.sub(N), L ^= 1), new K0({ r: P, s: N, recoveryParam: L }); } } } } } }; -Qi.prototype.verify = function(e, r, n, i) { - e = this._truncateToN(new ir(e, 16)), n = this.keyFromPublic(n, i), r = new W0(r, "hex"); +es.prototype.verify = function(e, r, n, i) { + e = this._truncateToN(new sr(e, 16)), n = this.keyFromPublic(n, i), r = new K0(r, "hex"); var s = r.r, o = r.s; if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0 || o.cmpn(1) < 0 || o.cmp(this.n) >= 0) return !1; var a = o.invm(this.n), u = a.mul(e).umod(this.n), l = a.mul(s).umod(this.n), d; return this.curve._maxwellTrick ? (d = this.g.jmulAdd(u, n.getPublic(), l), d.isInfinity() ? !1 : d.eqXToP(s)) : (d = this.g.mulAdd(u, n.getPublic(), l), d.isInfinity() ? !1 : d.getX().umod(this.n).cmp(s) === 0); }; -Qi.prototype.recoverPubKey = function(t, e, r, n) { - p8((3 & r) === r, "The recovery param is more than two bits"), e = new W0(e, n); - var i = this.n, s = new ir(t), o = e.r, a = e.s, u = r & 1, l = r >> 1; +es.prototype.recoverPubKey = function(t, e, r, n) { + m8((3 & r) === r, "The recovery param is more than two bits"), e = new K0(e, n); + var i = this.n, s = new sr(t), o = e.r, a = e.s, u = r & 1, l = r >> 1; if (o.cmp(this.curve.p.umod(this.curve.n)) >= 0 && l) throw new Error("Unable to find sencond key candinate"); l ? o = this.curve.pointFromX(o.add(this.curve.n), u) : o = this.curve.pointFromX(o, u); - var d = e.r.invm(i), g = i.sub(s).mul(d).umod(i), w = a.mul(d).umod(i); - return this.g.mulAdd(g, o, w); + var d = e.r.invm(i), p = i.sub(s).mul(d).umod(i), w = a.mul(d).umod(i); + return this.g.mulAdd(p, o, w); }; -Qi.prototype.getKeyRecoveryParam = function(t, e, r, n) { - if (e = new W0(e, n), e.recoveryParam !== null) +es.prototype.getKeyRecoveryParam = function(t, e, r, n) { + if (e = new K0(e, n), e.recoveryParam !== null) return e.recoveryParam; for (var i = 0; i < 4; i++) { var s; @@ -12423,75 +12423,75 @@ Qi.prototype.getKeyRecoveryParam = function(t, e, r, n) { } throw new Error("Unable to find valid recovery factor"); }; -var hj = $u(function(t, e) { +var _U = Bu(function(t, e) { var r = e; - r.version = "6.5.4", r.utils = $i, r.rand = /*RicMoo:ethers:require(brorand)*/ + r.version = "6.5.4", r.utils = Bi, r.rand = /*RicMoo:ethers:require(brorand)*/ function() { throw new Error("unsupported"); - }, r.curve = Ad, r.curves = Pd, r.ec = lj, r.eddsa = /*RicMoo:ethers:require(./elliptic/eddsa)*/ + }, r.curve = Pd, r.curves = Md, r.ec = xU, r.eddsa = /*RicMoo:ethers:require(./elliptic/eddsa)*/ null; -}), dj = hj.ec; -const pj = "signing-key/5.7.0", S1 = new Yr(pj); +}), EU = _U.ec; +const SU = "signing-key/5.7.0", S1 = new Yr(SU); let om = null; -function oa() { - return om || (om = new dj("secp256k1")), om; +function ua() { + return om || (om = new EU("secp256k1")), om; } -class gj { +class AU { constructor(e) { - xf(this, "curve", "secp256k1"), xf(this, "privateKey", Ti(e)), wB(this.privateKey) !== 32 && S1.throwArgumentError("invalid private key", "privateKey", "[[ REDACTED ]]"); - const r = oa().keyFromPrivate(wn(this.privateKey)); - xf(this, "publicKey", "0x" + r.getPublic(!1, "hex")), xf(this, "compressedPublicKey", "0x" + r.getPublic(!0, "hex")), xf(this, "_isSigningKey", !0); + _f(this, "curve", "secp256k1"), _f(this, "privateKey", Ti(e)), TF(this.privateKey) !== 32 && S1.throwArgumentError("invalid private key", "privateKey", "[[ REDACTED ]]"); + const r = ua().keyFromPrivate(wn(this.privateKey)); + _f(this, "publicKey", "0x" + r.getPublic(!1, "hex")), _f(this, "compressedPublicKey", "0x" + r.getPublic(!0, "hex")), _f(this, "_isSigningKey", !0); } _addPoint(e) { - const r = oa().keyFromPublic(wn(this.publicKey)), n = oa().keyFromPublic(wn(e)); + const r = ua().keyFromPublic(wn(this.publicKey)), n = ua().keyFromPublic(wn(e)); return "0x" + r.pub.add(n.pub).encodeCompressed("hex"); } signDigest(e) { - const r = oa().keyFromPrivate(wn(this.privateKey)), n = wn(e); + const r = ua().keyFromPrivate(wn(this.privateKey)), n = wn(e); n.length !== 32 && S1.throwArgumentError("bad digest length", "digest", e); const i = r.sign(n, { canonical: !0 }); - return K4({ + return G4({ recoveryParam: i.recoveryParam, - r: fu("0x" + i.r.toString(16), 32), - s: fu("0x" + i.s.toString(16), 32) + r: lu("0x" + i.r.toString(16), 32), + s: lu("0x" + i.s.toString(16), 32) }); } computeSharedSecret(e) { - const r = oa().keyFromPrivate(wn(this.privateKey)), n = oa().keyFromPublic(wn(g8(e))); - return fu("0x" + r.derive(n.getPublic()).toString(16), 32); + const r = ua().keyFromPrivate(wn(this.privateKey)), n = ua().keyFromPublic(wn(v8(e))); + return lu("0x" + r.derive(n.getPublic()).toString(16), 32); } static isSigningKey(e) { return !!(e && e._isSigningKey); } } -function mj(t, e) { - const r = K4(e), n = { r: wn(r.r), s: wn(r.s) }; - return "0x" + oa().recoverPubKey(wn(t), n, r.recoveryParam).encode("hex", !1); +function PU(t, e) { + const r = G4(e), n = { r: wn(r.r), s: wn(r.s) }; + return "0x" + ua().recoverPubKey(wn(t), n, r.recoveryParam).encode("hex", !1); } -function g8(t, e) { +function v8(t, e) { const r = wn(t); - return r.length === 32 ? new gj(r).publicKey : r.length === 33 ? "0x" + oa().keyFromPublic(r).getPublic(!1, "hex") : r.length === 65 ? Ti(r) : S1.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); + return r.length === 32 ? new AU(r).publicKey : r.length === 33 ? "0x" + ua().keyFromPublic(r).getPublic(!1, "hex") : r.length === 65 ? Ti(r) : S1.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); } -var Px; +var Ix; (function(t) { t[t.legacy = 0] = "legacy", t[t.eip2930 = 1] = "eip2930", t[t.eip1559 = 2] = "eip1559"; -})(Px || (Px = {})); -function vj(t) { - const e = g8(t); - return RB(vx(qv(vx(e, 1)), 12)); -} -function bj(t, e) { - return vj(mj(wn(t), e)); -} -var Gv = {}, K0 = {}; -Object.defineProperty(K0, "__esModule", { value: !0 }); -var Vn = or, A1 = ki, yj = 20; -function wj(t, e, r) { - for (var n = 1634760805, i = 857760878, s = 2036477234, o = 1797285236, a = r[3] << 24 | r[2] << 16 | r[1] << 8 | r[0], u = r[7] << 24 | r[6] << 16 | r[5] << 8 | r[4], l = r[11] << 24 | r[10] << 16 | r[9] << 8 | r[8], d = r[15] << 24 | r[14] << 16 | r[13] << 8 | r[12], g = r[19] << 24 | r[18] << 16 | r[17] << 8 | r[16], w = r[23] << 24 | r[22] << 16 | r[21] << 8 | r[20], A = r[27] << 24 | r[26] << 16 | r[25] << 8 | r[24], M = r[31] << 24 | r[30] << 16 | r[29] << 8 | r[28], N = e[3] << 24 | e[2] << 16 | e[1] << 8 | e[0], L = e[7] << 24 | e[6] << 16 | e[5] << 8 | e[4], $ = e[11] << 24 | e[10] << 16 | e[9] << 8 | e[8], F = e[15] << 24 | e[14] << 16 | e[13] << 8 | e[12], K = n, H = i, V = s, te = o, R = a, W = u, pe = l, Ee = d, Y = g, S = w, m = A, f = M, p = N, b = L, x = $, _ = F, E = 0; E < yj; E += 2) - K = K + R | 0, p ^= K, p = p >>> 16 | p << 16, Y = Y + p | 0, R ^= Y, R = R >>> 20 | R << 12, H = H + W | 0, b ^= H, b = b >>> 16 | b << 16, S = S + b | 0, W ^= S, W = W >>> 20 | W << 12, V = V + pe | 0, x ^= V, x = x >>> 16 | x << 16, m = m + x | 0, pe ^= m, pe = pe >>> 20 | pe << 12, te = te + Ee | 0, _ ^= te, _ = _ >>> 16 | _ << 16, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 20 | Ee << 12, V = V + pe | 0, x ^= V, x = x >>> 24 | x << 8, m = m + x | 0, pe ^= m, pe = pe >>> 25 | pe << 7, te = te + Ee | 0, _ ^= te, _ = _ >>> 24 | _ << 8, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 25 | Ee << 7, H = H + W | 0, b ^= H, b = b >>> 24 | b << 8, S = S + b | 0, W ^= S, W = W >>> 25 | W << 7, K = K + R | 0, p ^= K, p = p >>> 24 | p << 8, Y = Y + p | 0, R ^= Y, R = R >>> 25 | R << 7, K = K + W | 0, _ ^= K, _ = _ >>> 16 | _ << 16, m = m + _ | 0, W ^= m, W = W >>> 20 | W << 12, H = H + pe | 0, p ^= H, p = p >>> 16 | p << 16, f = f + p | 0, pe ^= f, pe = pe >>> 20 | pe << 12, V = V + Ee | 0, b ^= V, b = b >>> 16 | b << 16, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 20 | Ee << 12, te = te + R | 0, x ^= te, x = x >>> 16 | x << 16, S = S + x | 0, R ^= S, R = R >>> 20 | R << 12, V = V + Ee | 0, b ^= V, b = b >>> 24 | b << 8, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 25 | Ee << 7, te = te + R | 0, x ^= te, x = x >>> 24 | x << 8, S = S + x | 0, R ^= S, R = R >>> 25 | R << 7, H = H + pe | 0, p ^= H, p = p >>> 24 | p << 8, f = f + p | 0, pe ^= f, pe = pe >>> 25 | pe << 7, K = K + W | 0, _ ^= K, _ = _ >>> 24 | _ << 8, m = m + _ | 0, W ^= m, W = W >>> 25 | W << 7; - Vn.writeUint32LE(K + n | 0, t, 0), Vn.writeUint32LE(H + i | 0, t, 4), Vn.writeUint32LE(V + s | 0, t, 8), Vn.writeUint32LE(te + o | 0, t, 12), Vn.writeUint32LE(R + a | 0, t, 16), Vn.writeUint32LE(W + u | 0, t, 20), Vn.writeUint32LE(pe + l | 0, t, 24), Vn.writeUint32LE(Ee + d | 0, t, 28), Vn.writeUint32LE(Y + g | 0, t, 32), Vn.writeUint32LE(S + w | 0, t, 36), Vn.writeUint32LE(m + A | 0, t, 40), Vn.writeUint32LE(f + M | 0, t, 44), Vn.writeUint32LE(p + N | 0, t, 48), Vn.writeUint32LE(b + L | 0, t, 52), Vn.writeUint32LE(x + $ | 0, t, 56), Vn.writeUint32LE(_ + F | 0, t, 60); -} -function m8(t, e, r, n, i) { +})(Ix || (Ix = {})); +function MU(t) { + const e = v8(t); + return UF(yx(qv(yx(e, 1)), 12)); +} +function IU(t, e) { + return MU(PU(wn(t), e)); +} +var Gv = {}, V0 = {}; +Object.defineProperty(V0, "__esModule", { value: !0 }); +var Gn = ar, A1 = $i, CU = 20; +function TU(t, e, r) { + for (var n = 1634760805, i = 857760878, s = 2036477234, o = 1797285236, a = r[3] << 24 | r[2] << 16 | r[1] << 8 | r[0], u = r[7] << 24 | r[6] << 16 | r[5] << 8 | r[4], l = r[11] << 24 | r[10] << 16 | r[9] << 8 | r[8], d = r[15] << 24 | r[14] << 16 | r[13] << 8 | r[12], p = r[19] << 24 | r[18] << 16 | r[17] << 8 | r[16], w = r[23] << 24 | r[22] << 16 | r[21] << 8 | r[20], A = r[27] << 24 | r[26] << 16 | r[25] << 8 | r[24], P = r[31] << 24 | r[30] << 16 | r[29] << 8 | r[28], N = e[3] << 24 | e[2] << 16 | e[1] << 8 | e[0], L = e[7] << 24 | e[6] << 16 | e[5] << 8 | e[4], $ = e[11] << 24 | e[10] << 16 | e[9] << 8 | e[8], B = e[15] << 24 | e[14] << 16 | e[13] << 8 | e[12], H = n, W = i, V = s, te = o, R = a, K = u, ge = l, Ee = d, Y = p, S = w, m = A, f = P, g = N, b = L, x = $, _ = B, E = 0; E < CU; E += 2) + H = H + R | 0, g ^= H, g = g >>> 16 | g << 16, Y = Y + g | 0, R ^= Y, R = R >>> 20 | R << 12, W = W + K | 0, b ^= W, b = b >>> 16 | b << 16, S = S + b | 0, K ^= S, K = K >>> 20 | K << 12, V = V + ge | 0, x ^= V, x = x >>> 16 | x << 16, m = m + x | 0, ge ^= m, ge = ge >>> 20 | ge << 12, te = te + Ee | 0, _ ^= te, _ = _ >>> 16 | _ << 16, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 20 | Ee << 12, V = V + ge | 0, x ^= V, x = x >>> 24 | x << 8, m = m + x | 0, ge ^= m, ge = ge >>> 25 | ge << 7, te = te + Ee | 0, _ ^= te, _ = _ >>> 24 | _ << 8, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 25 | Ee << 7, W = W + K | 0, b ^= W, b = b >>> 24 | b << 8, S = S + b | 0, K ^= S, K = K >>> 25 | K << 7, H = H + R | 0, g ^= H, g = g >>> 24 | g << 8, Y = Y + g | 0, R ^= Y, R = R >>> 25 | R << 7, H = H + K | 0, _ ^= H, _ = _ >>> 16 | _ << 16, m = m + _ | 0, K ^= m, K = K >>> 20 | K << 12, W = W + ge | 0, g ^= W, g = g >>> 16 | g << 16, f = f + g | 0, ge ^= f, ge = ge >>> 20 | ge << 12, V = V + Ee | 0, b ^= V, b = b >>> 16 | b << 16, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 20 | Ee << 12, te = te + R | 0, x ^= te, x = x >>> 16 | x << 16, S = S + x | 0, R ^= S, R = R >>> 20 | R << 12, V = V + Ee | 0, b ^= V, b = b >>> 24 | b << 8, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 25 | Ee << 7, te = te + R | 0, x ^= te, x = x >>> 24 | x << 8, S = S + x | 0, R ^= S, R = R >>> 25 | R << 7, W = W + ge | 0, g ^= W, g = g >>> 24 | g << 8, f = f + g | 0, ge ^= f, ge = ge >>> 25 | ge << 7, H = H + K | 0, _ ^= H, _ = _ >>> 24 | _ << 8, m = m + _ | 0, K ^= m, K = K >>> 25 | K << 7; + Gn.writeUint32LE(H + n | 0, t, 0), Gn.writeUint32LE(W + i | 0, t, 4), Gn.writeUint32LE(V + s | 0, t, 8), Gn.writeUint32LE(te + o | 0, t, 12), Gn.writeUint32LE(R + a | 0, t, 16), Gn.writeUint32LE(K + u | 0, t, 20), Gn.writeUint32LE(ge + l | 0, t, 24), Gn.writeUint32LE(Ee + d | 0, t, 28), Gn.writeUint32LE(Y + p | 0, t, 32), Gn.writeUint32LE(S + w | 0, t, 36), Gn.writeUint32LE(m + A | 0, t, 40), Gn.writeUint32LE(f + P | 0, t, 44), Gn.writeUint32LE(g + N | 0, t, 48), Gn.writeUint32LE(b + L | 0, t, 52), Gn.writeUint32LE(x + $ | 0, t, 56), Gn.writeUint32LE(_ + B | 0, t, 60); +} +function b8(t, e, r, n, i) { if (i === void 0 && (i = 0), t.length !== 32) throw new Error("ChaCha: key size must be 32 bytes"); if (n.length < r.length) @@ -12507,49 +12507,49 @@ function m8(t, e, r, n, i) { s = e, o = i; } for (var a = new Uint8Array(64), u = 0; u < r.length; u += 64) { - wj(a, s, t); + TU(a, s, t); for (var l = u; l < u + 64 && l < r.length; l++) n[l] = r[l] ^ a[l - u]; - _j(s, 0, o); + DU(s, 0, o); } return A1.wipe(a), i === 0 && A1.wipe(s), n; } -K0.streamXOR = m8; -function xj(t, e, r, n) { - return n === void 0 && (n = 0), A1.wipe(r), m8(t, e, r, r, n); +V0.streamXOR = b8; +function RU(t, e, r, n) { + return n === void 0 && (n = 0), A1.wipe(r), b8(t, e, r, r, n); } -K0.stream = xj; -function _j(t, e, r) { +V0.stream = RU; +function DU(t, e, r) { for (var n = 1; r--; ) n = n + (t[e] & 255) | 0, t[e] = n & 255, n >>>= 8, e++; if (n > 0) throw new Error("ChaCha: counter overflow"); } -var v8 = {}, Ia = {}; -Object.defineProperty(Ia, "__esModule", { value: !0 }); -function Ej(t, e, r) { +var y8 = {}, Ra = {}; +Object.defineProperty(Ra, "__esModule", { value: !0 }); +function OU(t, e, r) { return ~(t - 1) & e | t - 1 & r; } -Ia.select = Ej; -function Sj(t, e) { +Ra.select = OU; +function NU(t, e) { return (t | 0) - (e | 0) - 1 >>> 31 & 1; } -Ia.lessOrEqual = Sj; -function b8(t, e) { +Ra.lessOrEqual = NU; +function w8(t, e) { if (t.length !== e.length) return 0; for (var r = 0, n = 0; n < t.length; n++) r |= t[n] ^ e[n]; return 1 & r - 1 >>> 8; } -Ia.compare = b8; -function Aj(t, e) { - return t.length === 0 || e.length === 0 ? !1 : b8(t, e) !== 0; +Ra.compare = w8; +function LU(t, e) { + return t.length === 0 || e.length === 0 ? !1 : w8(t, e) !== 0; } -Ia.equal = Aj; +Ra.equal = LU; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - var e = Ia, r = ki; + var e = Ra, r = $i; t.DIGEST_LENGTH = 16; var n = ( /** @class */ @@ -12562,60 +12562,60 @@ Ia.equal = Aj; this._r[1] = (u >>> 13 | l << 3) & 8191; var d = a[4] | a[5] << 8; this._r[2] = (l >>> 10 | d << 6) & 7939; - var g = a[6] | a[7] << 8; - this._r[3] = (d >>> 7 | g << 9) & 8191; + var p = a[6] | a[7] << 8; + this._r[3] = (d >>> 7 | p << 9) & 8191; var w = a[8] | a[9] << 8; - this._r[4] = (g >>> 4 | w << 12) & 255, this._r[5] = w >>> 1 & 8190; + this._r[4] = (p >>> 4 | w << 12) & 255, this._r[5] = w >>> 1 & 8190; var A = a[10] | a[11] << 8; this._r[6] = (w >>> 14 | A << 2) & 8191; - var M = a[12] | a[13] << 8; - this._r[7] = (A >>> 11 | M << 5) & 8065; + var P = a[12] | a[13] << 8; + this._r[7] = (A >>> 11 | P << 5) & 8065; var N = a[14] | a[15] << 8; - this._r[8] = (M >>> 8 | N << 8) & 8191, this._r[9] = N >>> 5 & 127, this._pad[0] = a[16] | a[17] << 8, this._pad[1] = a[18] | a[19] << 8, this._pad[2] = a[20] | a[21] << 8, this._pad[3] = a[22] | a[23] << 8, this._pad[4] = a[24] | a[25] << 8, this._pad[5] = a[26] | a[27] << 8, this._pad[6] = a[28] | a[29] << 8, this._pad[7] = a[30] | a[31] << 8; + this._r[8] = (P >>> 8 | N << 8) & 8191, this._r[9] = N >>> 5 & 127, this._pad[0] = a[16] | a[17] << 8, this._pad[1] = a[18] | a[19] << 8, this._pad[2] = a[20] | a[21] << 8, this._pad[3] = a[22] | a[23] << 8, this._pad[4] = a[24] | a[25] << 8, this._pad[5] = a[26] | a[27] << 8, this._pad[6] = a[28] | a[29] << 8, this._pad[7] = a[30] | a[31] << 8; } return o.prototype._blocks = function(a, u, l) { - for (var d = this._fin ? 0 : 2048, g = this._h[0], w = this._h[1], A = this._h[2], M = this._h[3], N = this._h[4], L = this._h[5], $ = this._h[6], F = this._h[7], K = this._h[8], H = this._h[9], V = this._r[0], te = this._r[1], R = this._r[2], W = this._r[3], pe = this._r[4], Ee = this._r[5], Y = this._r[6], S = this._r[7], m = this._r[8], f = this._r[9]; l >= 16; ) { - var p = a[u + 0] | a[u + 1] << 8; - g += p & 8191; + for (var d = this._fin ? 0 : 2048, p = this._h[0], w = this._h[1], A = this._h[2], P = this._h[3], N = this._h[4], L = this._h[5], $ = this._h[6], B = this._h[7], H = this._h[8], W = this._h[9], V = this._r[0], te = this._r[1], R = this._r[2], K = this._r[3], ge = this._r[4], Ee = this._r[5], Y = this._r[6], S = this._r[7], m = this._r[8], f = this._r[9]; l >= 16; ) { + var g = a[u + 0] | a[u + 1] << 8; + p += g & 8191; var b = a[u + 2] | a[u + 3] << 8; - w += (p >>> 13 | b << 3) & 8191; + w += (g >>> 13 | b << 3) & 8191; var x = a[u + 4] | a[u + 5] << 8; A += (b >>> 10 | x << 6) & 8191; var _ = a[u + 6] | a[u + 7] << 8; - M += (x >>> 7 | _ << 9) & 8191; + P += (x >>> 7 | _ << 9) & 8191; var E = a[u + 8] | a[u + 9] << 8; N += (_ >>> 4 | E << 12) & 8191, L += E >>> 1 & 8191; var v = a[u + 10] | a[u + 11] << 8; $ += (E >>> 14 | v << 2) & 8191; - var P = a[u + 12] | a[u + 13] << 8; - F += (v >>> 11 | P << 5) & 8191; + var M = a[u + 12] | a[u + 13] << 8; + B += (v >>> 11 | M << 5) & 8191; var I = a[u + 14] | a[u + 15] << 8; - K += (P >>> 8 | I << 8) & 8191, H += I >>> 5 | d; - var B = 0, ce = B; - ce += g * V, ce += w * (5 * f), ce += A * (5 * m), ce += M * (5 * S), ce += N * (5 * Y), B = ce >>> 13, ce &= 8191, ce += L * (5 * Ee), ce += $ * (5 * pe), ce += F * (5 * W), ce += K * (5 * R), ce += H * (5 * te), B += ce >>> 13, ce &= 8191; - var D = B; - D += g * te, D += w * V, D += A * (5 * f), D += M * (5 * m), D += N * (5 * S), B = D >>> 13, D &= 8191, D += L * (5 * Y), D += $ * (5 * Ee), D += F * (5 * pe), D += K * (5 * W), D += H * (5 * R), B += D >>> 13, D &= 8191; - var oe = B; - oe += g * R, oe += w * te, oe += A * V, oe += M * (5 * f), oe += N * (5 * m), B = oe >>> 13, oe &= 8191, oe += L * (5 * S), oe += $ * (5 * Y), oe += F * (5 * Ee), oe += K * (5 * pe), oe += H * (5 * W), B += oe >>> 13, oe &= 8191; - var Z = B; - Z += g * W, Z += w * R, Z += A * te, Z += M * V, Z += N * (5 * f), B = Z >>> 13, Z &= 8191, Z += L * (5 * m), Z += $ * (5 * S), Z += F * (5 * Y), Z += K * (5 * Ee), Z += H * (5 * pe), B += Z >>> 13, Z &= 8191; - var J = B; - J += g * pe, J += w * W, J += A * R, J += M * te, J += N * V, B = J >>> 13, J &= 8191, J += L * (5 * f), J += $ * (5 * m), J += F * (5 * S), J += K * (5 * Y), J += H * (5 * Ee), B += J >>> 13, J &= 8191; - var Q = B; - Q += g * Ee, Q += w * pe, Q += A * W, Q += M * R, Q += N * te, B = Q >>> 13, Q &= 8191, Q += L * V, Q += $ * (5 * f), Q += F * (5 * m), Q += K * (5 * S), Q += H * (5 * Y), B += Q >>> 13, Q &= 8191; - var T = B; - T += g * Y, T += w * Ee, T += A * pe, T += M * W, T += N * R, B = T >>> 13, T &= 8191, T += L * te, T += $ * V, T += F * (5 * f), T += K * (5 * m), T += H * (5 * S), B += T >>> 13, T &= 8191; - var X = B; - X += g * S, X += w * Y, X += A * Ee, X += M * pe, X += N * W, B = X >>> 13, X &= 8191, X += L * R, X += $ * te, X += F * V, X += K * (5 * f), X += H * (5 * m), B += X >>> 13, X &= 8191; - var re = B; - re += g * m, re += w * S, re += A * Y, re += M * Ee, re += N * pe, B = re >>> 13, re &= 8191, re += L * W, re += $ * R, re += F * te, re += K * V, re += H * (5 * f), B += re >>> 13, re &= 8191; - var de = B; - de += g * f, de += w * m, de += A * S, de += M * Y, de += N * Ee, B = de >>> 13, de &= 8191, de += L * pe, de += $ * W, de += F * R, de += K * te, de += H * V, B += de >>> 13, de &= 8191, B = (B << 2) + B | 0, B = B + ce | 0, ce = B & 8191, B = B >>> 13, D += B, g = ce, w = D, A = oe, M = Z, N = J, L = Q, $ = T, F = X, K = re, H = de, u += 16, l -= 16; - } - this._h[0] = g, this._h[1] = w, this._h[2] = A, this._h[3] = M, this._h[4] = N, this._h[5] = L, this._h[6] = $, this._h[7] = F, this._h[8] = K, this._h[9] = H; + H += (M >>> 8 | I << 8) & 8191, W += I >>> 5 | d; + var F = 0, ce = F; + ce += p * V, ce += w * (5 * f), ce += A * (5 * m), ce += P * (5 * S), ce += N * (5 * Y), F = ce >>> 13, ce &= 8191, ce += L * (5 * Ee), ce += $ * (5 * ge), ce += B * (5 * K), ce += H * (5 * R), ce += W * (5 * te), F += ce >>> 13, ce &= 8191; + var D = F; + D += p * te, D += w * V, D += A * (5 * f), D += P * (5 * m), D += N * (5 * S), F = D >>> 13, D &= 8191, D += L * (5 * Y), D += $ * (5 * Ee), D += B * (5 * ge), D += H * (5 * K), D += W * (5 * R), F += D >>> 13, D &= 8191; + var oe = F; + oe += p * R, oe += w * te, oe += A * V, oe += P * (5 * f), oe += N * (5 * m), F = oe >>> 13, oe &= 8191, oe += L * (5 * S), oe += $ * (5 * Y), oe += B * (5 * Ee), oe += H * (5 * ge), oe += W * (5 * K), F += oe >>> 13, oe &= 8191; + var Z = F; + Z += p * K, Z += w * R, Z += A * te, Z += P * V, Z += N * (5 * f), F = Z >>> 13, Z &= 8191, Z += L * (5 * m), Z += $ * (5 * S), Z += B * (5 * Y), Z += H * (5 * Ee), Z += W * (5 * ge), F += Z >>> 13, Z &= 8191; + var J = F; + J += p * ge, J += w * K, J += A * R, J += P * te, J += N * V, F = J >>> 13, J &= 8191, J += L * (5 * f), J += $ * (5 * m), J += B * (5 * S), J += H * (5 * Y), J += W * (5 * Ee), F += J >>> 13, J &= 8191; + var Q = F; + Q += p * Ee, Q += w * ge, Q += A * K, Q += P * R, Q += N * te, F = Q >>> 13, Q &= 8191, Q += L * V, Q += $ * (5 * f), Q += B * (5 * m), Q += H * (5 * S), Q += W * (5 * Y), F += Q >>> 13, Q &= 8191; + var T = F; + T += p * Y, T += w * Ee, T += A * ge, T += P * K, T += N * R, F = T >>> 13, T &= 8191, T += L * te, T += $ * V, T += B * (5 * f), T += H * (5 * m), T += W * (5 * S), F += T >>> 13, T &= 8191; + var X = F; + X += p * S, X += w * Y, X += A * Ee, X += P * ge, X += N * K, F = X >>> 13, X &= 8191, X += L * R, X += $ * te, X += B * V, X += H * (5 * f), X += W * (5 * m), F += X >>> 13, X &= 8191; + var re = F; + re += p * m, re += w * S, re += A * Y, re += P * Ee, re += N * ge, F = re >>> 13, re &= 8191, re += L * K, re += $ * R, re += B * te, re += H * V, re += W * (5 * f), F += re >>> 13, re &= 8191; + var pe = F; + pe += p * f, pe += w * m, pe += A * S, pe += P * Y, pe += N * Ee, F = pe >>> 13, pe &= 8191, pe += L * ge, pe += $ * K, pe += B * R, pe += H * te, pe += W * V, F += pe >>> 13, pe &= 8191, F = (F << 2) + F | 0, F = F + ce | 0, ce = F & 8191, F = F >>> 13, D += F, p = ce, w = D, A = oe, P = Z, N = J, L = Q, $ = T, B = X, H = re, W = pe, u += 16, l -= 16; + } + this._h[0] = p, this._h[1] = w, this._h[2] = A, this._h[3] = P, this._h[4] = N, this._h[5] = L, this._h[6] = $, this._h[7] = B, this._h[8] = H, this._h[9] = W; }, o.prototype.finish = function(a, u) { u === void 0 && (u = 0); - var l = new Uint16Array(10), d, g, w, A; + var l = new Uint16Array(10), d, p, w, A; if (this._leftover) { for (A = this._leftover, this._buffer[A++] = 1; A < 16; A++) this._buffer[A] = 0; @@ -12625,10 +12625,10 @@ Ia.equal = Aj; this._h[A] += d, d = this._h[A] >>> 13, this._h[A] &= 8191; for (this._h[0] += d * 5, d = this._h[0] >>> 13, this._h[0] &= 8191, this._h[1] += d, d = this._h[1] >>> 13, this._h[1] &= 8191, this._h[2] += d, l[0] = this._h[0] + 5, d = l[0] >>> 13, l[0] &= 8191, A = 1; A < 10; A++) l[A] = this._h[A] + d, d = l[A] >>> 13, l[A] &= 8191; - for (l[9] -= 8192, g = (d ^ 1) - 1, A = 0; A < 10; A++) - l[A] &= g; - for (g = ~g, A = 0; A < 10; A++) - this._h[A] = this._h[A] & g | l[A]; + for (l[9] -= 8192, p = (d ^ 1) - 1, A = 0; A < 10; A++) + l[A] &= p; + for (p = ~p, A = 0; A < 10; A++) + this._h[A] = this._h[A] & p | l[A]; for (this._h[0] = (this._h[0] | this._h[1] << 13) & 65535, this._h[1] = (this._h[1] >>> 3 | this._h[2] << 10) & 65535, this._h[2] = (this._h[2] >>> 6 | this._h[3] << 7) & 65535, this._h[3] = (this._h[3] >>> 9 | this._h[4] << 4) & 65535, this._h[4] = (this._h[4] >>> 12 | this._h[5] << 1 | this._h[6] << 14) & 65535, this._h[5] = (this._h[6] >>> 2 | this._h[7] << 11) & 65535, this._h[6] = (this._h[7] >>> 5 | this._h[8] << 8) & 65535, this._h[7] = (this._h[8] >>> 8 | this._h[9] << 5) & 65535, w = this._h[0] + this._pad[0], this._h[0] = w & 65535, A = 1; A < 8; A++) w = (this._h[A] + this._pad[A] | 0) + (w >>> 16) | 0, this._h[A] = w & 65535; return a[u + 0] = this._h[0] >>> 0, a[u + 1] = this._h[0] >>> 8, a[u + 2] = this._h[1] >>> 0, a[u + 3] = this._h[1] >>> 8, a[u + 4] = this._h[2] >>> 0, a[u + 5] = this._h[2] >>> 8, a[u + 6] = this._h[3] >>> 0, a[u + 7] = this._h[3] >>> 8, a[u + 8] = this._h[4] >>> 0, a[u + 9] = this._h[4] >>> 8, a[u + 10] = this._h[5] >>> 0, a[u + 11] = this._h[5] >>> 8, a[u + 12] = this._h[6] >>> 0, a[u + 13] = this._h[6] >>> 8, a[u + 14] = this._h[7] >>> 0, a[u + 15] = this._h[7] >>> 8, this._finished = !0, this; @@ -12636,15 +12636,15 @@ Ia.equal = Aj; var u = 0, l = a.length, d; if (this._leftover) { d = 16 - this._leftover, d > l && (d = l); - for (var g = 0; g < d; g++) - this._buffer[this._leftover + g] = a[u + g]; + for (var p = 0; p < d; p++) + this._buffer[this._leftover + p] = a[u + p]; if (l -= d, u += d, this._leftover += d, this._leftover < 16) return this; this._blocks(this._buffer, 0, 16), this._leftover = 0; } if (l >= 16 && (d = l - l % 16, this._blocks(a, u, d), u += d, l -= d), l) { - for (var g = 0; g < l; g++) - this._buffer[this._leftover + g] = a[u + g]; + for (var p = 0; p < l; p++) + this._buffer[this._leftover + p] = a[u + p]; this._leftover += l; } return this; @@ -12670,10 +12670,10 @@ Ia.equal = Aj; return o.length !== t.DIGEST_LENGTH || a.length !== t.DIGEST_LENGTH ? !1 : e.equal(o, a); } t.equal = s; -})(v8); +})(y8); (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - var e = K0, r = v8, n = ki, i = or, s = Ia; + var e = V0, r = y8, n = $i, i = ar, s = Ra; t.KEY_LENGTH = 32, t.NONCE_LENGTH = 12, t.TAG_LENGTH = 16; var o = new Uint8Array(16), a = ( /** @class */ @@ -12683,13 +12683,13 @@ Ia.equal = Aj; throw new Error("ChaCha20Poly1305 needs 32-byte key"); this._key = new Uint8Array(l); } - return u.prototype.seal = function(l, d, g, w) { + return u.prototype.seal = function(l, d, p, w) { if (l.length > 16) throw new Error("ChaCha20Poly1305: incorrect nonce length"); var A = new Uint8Array(16); A.set(l, A.length - l.length); - var M = new Uint8Array(32); - e.stream(this._key, A, M, 4); + var P = new Uint8Array(32); + e.stream(this._key, A, P, 4); var N = d.length + this.tagLength, L; if (w) { if (w.length !== N) @@ -12697,18 +12697,18 @@ Ia.equal = Aj; L = w; } else L = new Uint8Array(N); - return e.streamXOR(this._key, A, d, L, 4), this._authenticate(L.subarray(L.length - this.tagLength, L.length), M, L.subarray(0, L.length - this.tagLength), g), n.wipe(A), L; - }, u.prototype.open = function(l, d, g, w) { + return e.streamXOR(this._key, A, d, L, 4), this._authenticate(L.subarray(L.length - this.tagLength, L.length), P, L.subarray(0, L.length - this.tagLength), p), n.wipe(A), L; + }, u.prototype.open = function(l, d, p, w) { if (l.length > 16) throw new Error("ChaCha20Poly1305: incorrect nonce length"); if (d.length < this.tagLength) return null; var A = new Uint8Array(16); A.set(l, A.length - l.length); - var M = new Uint8Array(32); - e.stream(this._key, A, M, 4); + var P = new Uint8Array(32); + e.stream(this._key, A, P, 4); var N = new Uint8Array(this.tagLength); - if (this._authenticate(N, M, d.subarray(0, d.length - this.tagLength), g), !s.equal(N, d.subarray(d.length - this.tagLength, d.length))) + if (this._authenticate(N, P, d.subarray(0, d.length - this.tagLength), p), !s.equal(N, d.subarray(d.length - this.tagLength, d.length))) return null; var L = d.length - this.tagLength, $; if (w) { @@ -12720,27 +12720,27 @@ Ia.equal = Aj; return e.streamXOR(this._key, A, d.subarray(0, d.length - this.tagLength), $, 4), n.wipe(A), $; }, u.prototype.clean = function() { return n.wipe(this._key), this; - }, u.prototype._authenticate = function(l, d, g, w) { + }, u.prototype._authenticate = function(l, d, p, w) { var A = new r.Poly1305(d); - w && (A.update(w), w.length % 16 > 0 && A.update(o.subarray(w.length % 16))), A.update(g), g.length % 16 > 0 && A.update(o.subarray(g.length % 16)); - var M = new Uint8Array(8); - w && i.writeUint64LE(w.length, M), A.update(M), i.writeUint64LE(g.length, M), A.update(M); + w && (A.update(w), w.length % 16 > 0 && A.update(o.subarray(w.length % 16))), A.update(p), p.length % 16 > 0 && A.update(o.subarray(p.length % 16)); + var P = new Uint8Array(8); + w && i.writeUint64LE(w.length, P), A.update(P), i.writeUint64LE(p.length, P), A.update(P); for (var N = A.digest(), L = 0; L < N.length; L++) l[L] = N[L]; - A.clean(), n.wipe(N), n.wipe(M); + A.clean(), n.wipe(N), n.wipe(P); }, u; }() ); t.ChaCha20Poly1305 = a; })(Gv); -var y8 = {}, Vl = {}, Yv = {}; +var x8 = {}, Gl = {}, Yv = {}; Object.defineProperty(Yv, "__esModule", { value: !0 }); -function Pj(t) { +function kU(t) { return typeof t.saveState < "u" && typeof t.restoreState < "u" && typeof t.cleanSavedState < "u"; } -Yv.isSerializableHash = Pj; -Object.defineProperty(Vl, "__esModule", { value: !0 }); -var Ns = Yv, Mj = Ia, Ij = ki, w8 = ( +Yv.isSerializableHash = kU; +Object.defineProperty(Gl, "__esModule", { value: !0 }); +var Ls = Yv, $U = Ra, BU = $i, _8 = ( /** @class */ function() { function t(e, r) { @@ -12752,14 +12752,14 @@ var Ns = Yv, Mj = Ia, Ij = ki, w8 = ( this._inner.update(n); for (var i = 0; i < n.length; i++) n[i] ^= 106; - this._outer.update(n), Ns.isSerializableHash(this._inner) && Ns.isSerializableHash(this._outer) && (this._innerKeyedState = this._inner.saveState(), this._outerKeyedState = this._outer.saveState()), Ij.wipe(n); + this._outer.update(n), Ls.isSerializableHash(this._inner) && Ls.isSerializableHash(this._outer) && (this._innerKeyedState = this._inner.saveState(), this._outerKeyedState = this._outer.saveState()), BU.wipe(n); } return t.prototype.reset = function() { - if (!Ns.isSerializableHash(this._inner) || !Ns.isSerializableHash(this._outer)) + if (!Ls.isSerializableHash(this._inner) || !Ls.isSerializableHash(this._outer)) throw new Error("hmac: can't reset() because hash doesn't implement restoreState()"); return this._inner.restoreState(this._innerKeyedState), this._outer.restoreState(this._outerKeyedState), this._finished = !1, this; }, t.prototype.clean = function() { - Ns.isSerializableHash(this._inner) && this._inner.cleanSavedState(this._innerKeyedState), Ns.isSerializableHash(this._outer) && this._outer.cleanSavedState(this._outerKeyedState), this._inner.clean(), this._outer.clean(); + Ls.isSerializableHash(this._inner) && this._inner.cleanSavedState(this._innerKeyedState), Ls.isSerializableHash(this._outer) && this._outer.cleanSavedState(this._outerKeyedState), this._inner.clean(), this._outer.clean(); }, t.prototype.update = function(e) { return this._inner.update(e), this; }, t.prototype.finish = function(e) { @@ -12768,37 +12768,37 @@ var Ns = Yv, Mj = Ia, Ij = ki, w8 = ( var e = new Uint8Array(this.digestLength); return this.finish(e), e; }, t.prototype.saveState = function() { - if (!Ns.isSerializableHash(this._inner)) + if (!Ls.isSerializableHash(this._inner)) throw new Error("hmac: can't saveState() because hash doesn't implement it"); return this._inner.saveState(); }, t.prototype.restoreState = function(e) { - if (!Ns.isSerializableHash(this._inner) || !Ns.isSerializableHash(this._outer)) + if (!Ls.isSerializableHash(this._inner) || !Ls.isSerializableHash(this._outer)) throw new Error("hmac: can't restoreState() because hash doesn't implement it"); return this._inner.restoreState(e), this._outer.restoreState(this._outerKeyedState), this._finished = !1, this; }, t.prototype.cleanSavedState = function(e) { - if (!Ns.isSerializableHash(this._inner)) + if (!Ls.isSerializableHash(this._inner)) throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it"); this._inner.cleanSavedState(e); }, t; }() ); -Vl.HMAC = w8; -function Cj(t, e, r) { - var n = new w8(t, e); +Gl.HMAC = _8; +function FU(t, e, r) { + var n = new _8(t, e); n.update(r); var i = n.digest(); return n.clean(), i; } -Vl.hmac = Cj; -Vl.equal = Mj.equal; -Object.defineProperty(y8, "__esModule", { value: !0 }); -var Mx = Vl, Ix = ki, Tj = ( +Gl.hmac = FU; +Gl.equal = $U.equal; +Object.defineProperty(x8, "__esModule", { value: !0 }); +var Cx = Gl, Tx = $i, jU = ( /** @class */ function() { function t(e, r, n, i) { n === void 0 && (n = new Uint8Array(0)), this._counter = new Uint8Array(1), this._hash = e, this._info = i; - var s = Mx.hmac(this._hash, n, r); - this._hmac = new Mx.HMAC(e, s), this._buffer = new Uint8Array(this._hmac.digestLength), this._bufpos = this._buffer.length; + var s = Cx.hmac(this._hash, n, r); + this._hmac = new Cx.HMAC(e, s), this._buffer = new Uint8Array(this._hmac.digestLength), this._bufpos = this._buffer.length; } return t.prototype._fillBuffer = function() { this._counter[0]++; @@ -12811,13 +12811,13 @@ var Mx = Vl, Ix = ki, Tj = ( this._bufpos === this._buffer.length && this._fillBuffer(), r[n] = this._buffer[this._bufpos++]; return r; }, t.prototype.clean = function() { - this._hmac.clean(), Ix.wipe(this._buffer), Ix.wipe(this._counter), this._bufpos = 0; + this._hmac.clean(), Tx.wipe(this._buffer), Tx.wipe(this._counter), this._bufpos = 0; }, t; }() -), Rj = y8.HKDF = Tj, Gl = {}; +), UU = x8.HKDF = jU, Yl = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - var e = or, r = ki; + var e = ar, r = $i; t.DIGEST_LENGTH = 32, t.BLOCK_SIZE = 64; var n = ( /** @class */ @@ -12845,14 +12845,14 @@ var Mx = Vl, Ix = ki, Tj = ( return this; }, a.prototype.finish = function(u) { if (!this._finished) { - var l = this._bytesHashed, d = this._bufferLength, g = l / 536870912 | 0, w = l << 3, A = l % 64 < 56 ? 64 : 128; + var l = this._bytesHashed, d = this._bufferLength, p = l / 536870912 | 0, w = l << 3, A = l % 64 < 56 ? 64 : 128; this._buffer[d] = 128; - for (var M = d + 1; M < A - 8; M++) - this._buffer[M] = 0; - e.writeUint32BE(g, this._buffer, A - 8), e.writeUint32BE(w, this._buffer, A - 4), s(this._temp, this._state, this._buffer, 0, A), this._finished = !0; + for (var P = d + 1; P < A - 8; P++) + this._buffer[P] = 0; + e.writeUint32BE(p, this._buffer, A - 8), e.writeUint32BE(w, this._buffer, A - 4), s(this._temp, this._state, this._buffer, 0, A), this._finished = !0; } - for (var M = 0; M < this.digestLength / 4; M++) - e.writeUint32BE(this._state[M], u, M * 4); + for (var P = 0; P < this.digestLength / 4; P++) + e.writeUint32BE(this._state[P], u, P * 4); return this; }, a.prototype.digest = function() { var u = new Uint8Array(this.digestLength); @@ -12940,23 +12940,23 @@ var Mx = Vl, Ix = ki, Tj = ( 3204031479, 3329325298 ]); - function s(a, u, l, d, g) { - for (; g >= 64; ) { - for (var w = u[0], A = u[1], M = u[2], N = u[3], L = u[4], $ = u[5], F = u[6], K = u[7], H = 0; H < 16; H++) { - var V = d + H * 4; - a[H] = e.readUint32BE(l, V); + function s(a, u, l, d, p) { + for (; p >= 64; ) { + for (var w = u[0], A = u[1], P = u[2], N = u[3], L = u[4], $ = u[5], B = u[6], H = u[7], W = 0; W < 16; W++) { + var V = d + W * 4; + a[W] = e.readUint32BE(l, V); } - for (var H = 16; H < 64; H++) { - var te = a[H - 2], R = (te >>> 17 | te << 15) ^ (te >>> 19 | te << 13) ^ te >>> 10; - te = a[H - 15]; - var W = (te >>> 7 | te << 25) ^ (te >>> 18 | te << 14) ^ te >>> 3; - a[H] = (R + a[H - 7] | 0) + (W + a[H - 16] | 0); + for (var W = 16; W < 64; W++) { + var te = a[W - 2], R = (te >>> 17 | te << 15) ^ (te >>> 19 | te << 13) ^ te >>> 10; + te = a[W - 15]; + var K = (te >>> 7 | te << 25) ^ (te >>> 18 | te << 14) ^ te >>> 3; + a[W] = (R + a[W - 7] | 0) + (K + a[W - 16] | 0); } - for (var H = 0; H < 64; H++) { - var R = (((L >>> 6 | L << 26) ^ (L >>> 11 | L << 21) ^ (L >>> 25 | L << 7)) + (L & $ ^ ~L & F) | 0) + (K + (i[H] + a[H] | 0) | 0) | 0, W = ((w >>> 2 | w << 30) ^ (w >>> 13 | w << 19) ^ (w >>> 22 | w << 10)) + (w & A ^ w & M ^ A & M) | 0; - K = F, F = $, $ = L, L = N + R | 0, N = M, M = A, A = w, w = R + W | 0; + for (var W = 0; W < 64; W++) { + var R = (((L >>> 6 | L << 26) ^ (L >>> 11 | L << 21) ^ (L >>> 25 | L << 7)) + (L & $ ^ ~L & B) | 0) + (H + (i[W] + a[W] | 0) | 0) | 0, K = ((w >>> 2 | w << 30) ^ (w >>> 13 | w << 19) ^ (w >>> 22 | w << 10)) + (w & A ^ w & P ^ A & P) | 0; + H = B, B = $, $ = L, L = N + R | 0, N = P, P = A, A = w, w = R + K | 0; } - u[0] += w, u[1] += A, u[2] += M, u[3] += N, u[4] += L, u[5] += $, u[6] += F, u[7] += K, d += 64, g -= 64; + u[0] += w, u[1] += A, u[2] += P, u[3] += N, u[4] += L, u[5] += $, u[6] += B, u[7] += H, d += 64, p -= 64; } return d; } @@ -12967,158 +12967,158 @@ var Mx = Vl, Ix = ki, Tj = ( return u.clean(), l; } t.hash = o; -})(Gl); +})(Yl); var Jv = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.sharedKey = t.generateKeyPair = t.generateKeyPairFromSeed = t.scalarMultBase = t.scalarMult = t.SHARED_KEY_LENGTH = t.SECRET_KEY_LENGTH = t.PUBLIC_KEY_LENGTH = void 0; - const e = Pa, r = ki; + const e = Ca, r = $i; t.PUBLIC_KEY_LENGTH = 32, t.SECRET_KEY_LENGTH = 32, t.SHARED_KEY_LENGTH = 32; - function n(H) { + function n(W) { const V = new Float64Array(16); - if (H) - for (let te = 0; te < H.length; te++) - V[te] = H[te]; + if (W) + for (let te = 0; te < W.length; te++) + V[te] = W[te]; return V; } const i = new Uint8Array(32); i[0] = 9; const s = n([56129, 1]); - function o(H) { + function o(W) { let V = 1; for (let te = 0; te < 16; te++) { - let R = H[te] + V + 65535; - V = Math.floor(R / 65536), H[te] = R - V * 65536; + let R = W[te] + V + 65535; + V = Math.floor(R / 65536), W[te] = R - V * 65536; } - H[0] += V - 1 + 37 * (V - 1); + W[0] += V - 1 + 37 * (V - 1); } - function a(H, V, te) { + function a(W, V, te) { const R = ~(te - 1); - for (let W = 0; W < 16; W++) { - const pe = R & (H[W] ^ V[W]); - H[W] ^= pe, V[W] ^= pe; + for (let K = 0; K < 16; K++) { + const ge = R & (W[K] ^ V[K]); + W[K] ^= ge, V[K] ^= ge; } } - function u(H, V) { + function u(W, V) { const te = n(), R = n(); - for (let W = 0; W < 16; W++) - R[W] = V[W]; + for (let K = 0; K < 16; K++) + R[K] = V[K]; o(R), o(R), o(R); - for (let W = 0; W < 2; W++) { + for (let K = 0; K < 2; K++) { te[0] = R[0] - 65517; for (let Ee = 1; Ee < 15; Ee++) te[Ee] = R[Ee] - 65535 - (te[Ee - 1] >> 16 & 1), te[Ee - 1] &= 65535; te[15] = R[15] - 32767 - (te[14] >> 16 & 1); - const pe = te[15] >> 16 & 1; - te[14] &= 65535, a(R, te, 1 - pe); + const ge = te[15] >> 16 & 1; + te[14] &= 65535, a(R, te, 1 - ge); } - for (let W = 0; W < 16; W++) - H[2 * W] = R[W] & 255, H[2 * W + 1] = R[W] >> 8; + for (let K = 0; K < 16; K++) + W[2 * K] = R[K] & 255, W[2 * K + 1] = R[K] >> 8; } - function l(H, V) { + function l(W, V) { for (let te = 0; te < 16; te++) - H[te] = V[2 * te] + (V[2 * te + 1] << 8); - H[15] &= 32767; + W[te] = V[2 * te] + (V[2 * te + 1] << 8); + W[15] &= 32767; } - function d(H, V, te) { + function d(W, V, te) { for (let R = 0; R < 16; R++) - H[R] = V[R] + te[R]; + W[R] = V[R] + te[R]; } - function g(H, V, te) { + function p(W, V, te) { for (let R = 0; R < 16; R++) - H[R] = V[R] - te[R]; + W[R] = V[R] - te[R]; } - function w(H, V, te) { - let R, W, pe = 0, Ee = 0, Y = 0, S = 0, m = 0, f = 0, p = 0, b = 0, x = 0, _ = 0, E = 0, v = 0, P = 0, I = 0, B = 0, ce = 0, D = 0, oe = 0, Z = 0, J = 0, Q = 0, T = 0, X = 0, re = 0, de = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = te[0], Me = te[1], Ne = te[2], Ke = te[3], Le = te[4], qe = te[5], ze = te[6], _e = te[7], Ze = te[8], at = te[9], ke = te[10], Qe = te[11], tt = te[12], Ye = te[13], dt = te[14], lt = te[15]; - R = V[0], pe += R * $e, Ee += R * Me, Y += R * Ne, S += R * Ke, m += R * Le, f += R * qe, p += R * ze, b += R * _e, x += R * Ze, _ += R * at, E += R * ke, v += R * Qe, P += R * tt, I += R * Ye, B += R * dt, ce += R * lt, R = V[1], Ee += R * $e, Y += R * Me, S += R * Ne, m += R * Ke, f += R * Le, p += R * qe, b += R * ze, x += R * _e, _ += R * Ze, E += R * at, v += R * ke, P += R * Qe, I += R * tt, B += R * Ye, ce += R * dt, D += R * lt, R = V[2], Y += R * $e, S += R * Me, m += R * Ne, f += R * Ke, p += R * Le, b += R * qe, x += R * ze, _ += R * _e, E += R * Ze, v += R * at, P += R * ke, I += R * Qe, B += R * tt, ce += R * Ye, D += R * dt, oe += R * lt, R = V[3], S += R * $e, m += R * Me, f += R * Ne, p += R * Ke, b += R * Le, x += R * qe, _ += R * ze, E += R * _e, v += R * Ze, P += R * at, I += R * ke, B += R * Qe, ce += R * tt, D += R * Ye, oe += R * dt, Z += R * lt, R = V[4], m += R * $e, f += R * Me, p += R * Ne, b += R * Ke, x += R * Le, _ += R * qe, E += R * ze, v += R * _e, P += R * Ze, I += R * at, B += R * ke, ce += R * Qe, D += R * tt, oe += R * Ye, Z += R * dt, J += R * lt, R = V[5], f += R * $e, p += R * Me, b += R * Ne, x += R * Ke, _ += R * Le, E += R * qe, v += R * ze, P += R * _e, I += R * Ze, B += R * at, ce += R * ke, D += R * Qe, oe += R * tt, Z += R * Ye, J += R * dt, Q += R * lt, R = V[6], p += R * $e, b += R * Me, x += R * Ne, _ += R * Ke, E += R * Le, v += R * qe, P += R * ze, I += R * _e, B += R * Ze, ce += R * at, D += R * ke, oe += R * Qe, Z += R * tt, J += R * Ye, Q += R * dt, T += R * lt, R = V[7], b += R * $e, x += R * Me, _ += R * Ne, E += R * Ke, v += R * Le, P += R * qe, I += R * ze, B += R * _e, ce += R * Ze, D += R * at, oe += R * ke, Z += R * Qe, J += R * tt, Q += R * Ye, T += R * dt, X += R * lt, R = V[8], x += R * $e, _ += R * Me, E += R * Ne, v += R * Ke, P += R * Le, I += R * qe, B += R * ze, ce += R * _e, D += R * Ze, oe += R * at, Z += R * ke, J += R * Qe, Q += R * tt, T += R * Ye, X += R * dt, re += R * lt, R = V[9], _ += R * $e, E += R * Me, v += R * Ne, P += R * Ke, I += R * Le, B += R * qe, ce += R * ze, D += R * _e, oe += R * Ze, Z += R * at, J += R * ke, Q += R * Qe, T += R * tt, X += R * Ye, re += R * dt, de += R * lt, R = V[10], E += R * $e, v += R * Me, P += R * Ne, I += R * Ke, B += R * Le, ce += R * qe, D += R * ze, oe += R * _e, Z += R * Ze, J += R * at, Q += R * ke, T += R * Qe, X += R * tt, re += R * Ye, de += R * dt, ie += R * lt, R = V[11], v += R * $e, P += R * Me, I += R * Ne, B += R * Ke, ce += R * Le, D += R * qe, oe += R * ze, Z += R * _e, J += R * Ze, Q += R * at, T += R * ke, X += R * Qe, re += R * tt, de += R * Ye, ie += R * dt, ue += R * lt, R = V[12], P += R * $e, I += R * Me, B += R * Ne, ce += R * Ke, D += R * Le, oe += R * qe, Z += R * ze, J += R * _e, Q += R * Ze, T += R * at, X += R * ke, re += R * Qe, de += R * tt, ie += R * Ye, ue += R * dt, ve += R * lt, R = V[13], I += R * $e, B += R * Me, ce += R * Ne, D += R * Ke, oe += R * Le, Z += R * qe, J += R * ze, Q += R * _e, T += R * Ze, X += R * at, re += R * ke, de += R * Qe, ie += R * tt, ue += R * Ye, ve += R * dt, Pe += R * lt, R = V[14], B += R * $e, ce += R * Me, D += R * Ne, oe += R * Ke, Z += R * Le, J += R * qe, Q += R * ze, T += R * _e, X += R * Ze, re += R * at, de += R * ke, ie += R * Qe, ue += R * tt, ve += R * Ye, Pe += R * dt, De += R * lt, R = V[15], ce += R * $e, D += R * Me, oe += R * Ne, Z += R * Ke, J += R * Le, Q += R * qe, T += R * ze, X += R * _e, re += R * Ze, de += R * at, ie += R * ke, ue += R * Qe, ve += R * tt, Pe += R * Ye, De += R * dt, Ce += R * lt, pe += 38 * D, Ee += 38 * oe, Y += 38 * Z, S += 38 * J, m += 38 * Q, f += 38 * T, p += 38 * X, b += 38 * re, x += 38 * de, _ += 38 * ie, E += 38 * ue, v += 38 * ve, P += 38 * Pe, I += 38 * De, B += 38 * Ce, W = 1, R = pe + W + 65535, W = Math.floor(R / 65536), pe = R - W * 65536, R = Ee + W + 65535, W = Math.floor(R / 65536), Ee = R - W * 65536, R = Y + W + 65535, W = Math.floor(R / 65536), Y = R - W * 65536, R = S + W + 65535, W = Math.floor(R / 65536), S = R - W * 65536, R = m + W + 65535, W = Math.floor(R / 65536), m = R - W * 65536, R = f + W + 65535, W = Math.floor(R / 65536), f = R - W * 65536, R = p + W + 65535, W = Math.floor(R / 65536), p = R - W * 65536, R = b + W + 65535, W = Math.floor(R / 65536), b = R - W * 65536, R = x + W + 65535, W = Math.floor(R / 65536), x = R - W * 65536, R = _ + W + 65535, W = Math.floor(R / 65536), _ = R - W * 65536, R = E + W + 65535, W = Math.floor(R / 65536), E = R - W * 65536, R = v + W + 65535, W = Math.floor(R / 65536), v = R - W * 65536, R = P + W + 65535, W = Math.floor(R / 65536), P = R - W * 65536, R = I + W + 65535, W = Math.floor(R / 65536), I = R - W * 65536, R = B + W + 65535, W = Math.floor(R / 65536), B = R - W * 65536, R = ce + W + 65535, W = Math.floor(R / 65536), ce = R - W * 65536, pe += W - 1 + 37 * (W - 1), W = 1, R = pe + W + 65535, W = Math.floor(R / 65536), pe = R - W * 65536, R = Ee + W + 65535, W = Math.floor(R / 65536), Ee = R - W * 65536, R = Y + W + 65535, W = Math.floor(R / 65536), Y = R - W * 65536, R = S + W + 65535, W = Math.floor(R / 65536), S = R - W * 65536, R = m + W + 65535, W = Math.floor(R / 65536), m = R - W * 65536, R = f + W + 65535, W = Math.floor(R / 65536), f = R - W * 65536, R = p + W + 65535, W = Math.floor(R / 65536), p = R - W * 65536, R = b + W + 65535, W = Math.floor(R / 65536), b = R - W * 65536, R = x + W + 65535, W = Math.floor(R / 65536), x = R - W * 65536, R = _ + W + 65535, W = Math.floor(R / 65536), _ = R - W * 65536, R = E + W + 65535, W = Math.floor(R / 65536), E = R - W * 65536, R = v + W + 65535, W = Math.floor(R / 65536), v = R - W * 65536, R = P + W + 65535, W = Math.floor(R / 65536), P = R - W * 65536, R = I + W + 65535, W = Math.floor(R / 65536), I = R - W * 65536, R = B + W + 65535, W = Math.floor(R / 65536), B = R - W * 65536, R = ce + W + 65535, W = Math.floor(R / 65536), ce = R - W * 65536, pe += W - 1 + 37 * (W - 1), H[0] = pe, H[1] = Ee, H[2] = Y, H[3] = S, H[4] = m, H[5] = f, H[6] = p, H[7] = b, H[8] = x, H[9] = _, H[10] = E, H[11] = v, H[12] = P, H[13] = I, H[14] = B, H[15] = ce; + function w(W, V, te) { + let R, K, ge = 0, Ee = 0, Y = 0, S = 0, m = 0, f = 0, g = 0, b = 0, x = 0, _ = 0, E = 0, v = 0, M = 0, I = 0, F = 0, ce = 0, D = 0, oe = 0, Z = 0, J = 0, Q = 0, T = 0, X = 0, re = 0, pe = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = te[0], Me = te[1], Ne = te[2], Ke = te[3], Le = te[4], qe = te[5], ze = te[6], _e = te[7], Ze = te[8], at = te[9], ke = te[10], Qe = te[11], tt = te[12], Ye = te[13], dt = te[14], lt = te[15]; + R = V[0], ge += R * $e, Ee += R * Me, Y += R * Ne, S += R * Ke, m += R * Le, f += R * qe, g += R * ze, b += R * _e, x += R * Ze, _ += R * at, E += R * ke, v += R * Qe, M += R * tt, I += R * Ye, F += R * dt, ce += R * lt, R = V[1], Ee += R * $e, Y += R * Me, S += R * Ne, m += R * Ke, f += R * Le, g += R * qe, b += R * ze, x += R * _e, _ += R * Ze, E += R * at, v += R * ke, M += R * Qe, I += R * tt, F += R * Ye, ce += R * dt, D += R * lt, R = V[2], Y += R * $e, S += R * Me, m += R * Ne, f += R * Ke, g += R * Le, b += R * qe, x += R * ze, _ += R * _e, E += R * Ze, v += R * at, M += R * ke, I += R * Qe, F += R * tt, ce += R * Ye, D += R * dt, oe += R * lt, R = V[3], S += R * $e, m += R * Me, f += R * Ne, g += R * Ke, b += R * Le, x += R * qe, _ += R * ze, E += R * _e, v += R * Ze, M += R * at, I += R * ke, F += R * Qe, ce += R * tt, D += R * Ye, oe += R * dt, Z += R * lt, R = V[4], m += R * $e, f += R * Me, g += R * Ne, b += R * Ke, x += R * Le, _ += R * qe, E += R * ze, v += R * _e, M += R * Ze, I += R * at, F += R * ke, ce += R * Qe, D += R * tt, oe += R * Ye, Z += R * dt, J += R * lt, R = V[5], f += R * $e, g += R * Me, b += R * Ne, x += R * Ke, _ += R * Le, E += R * qe, v += R * ze, M += R * _e, I += R * Ze, F += R * at, ce += R * ke, D += R * Qe, oe += R * tt, Z += R * Ye, J += R * dt, Q += R * lt, R = V[6], g += R * $e, b += R * Me, x += R * Ne, _ += R * Ke, E += R * Le, v += R * qe, M += R * ze, I += R * _e, F += R * Ze, ce += R * at, D += R * ke, oe += R * Qe, Z += R * tt, J += R * Ye, Q += R * dt, T += R * lt, R = V[7], b += R * $e, x += R * Me, _ += R * Ne, E += R * Ke, v += R * Le, M += R * qe, I += R * ze, F += R * _e, ce += R * Ze, D += R * at, oe += R * ke, Z += R * Qe, J += R * tt, Q += R * Ye, T += R * dt, X += R * lt, R = V[8], x += R * $e, _ += R * Me, E += R * Ne, v += R * Ke, M += R * Le, I += R * qe, F += R * ze, ce += R * _e, D += R * Ze, oe += R * at, Z += R * ke, J += R * Qe, Q += R * tt, T += R * Ye, X += R * dt, re += R * lt, R = V[9], _ += R * $e, E += R * Me, v += R * Ne, M += R * Ke, I += R * Le, F += R * qe, ce += R * ze, D += R * _e, oe += R * Ze, Z += R * at, J += R * ke, Q += R * Qe, T += R * tt, X += R * Ye, re += R * dt, pe += R * lt, R = V[10], E += R * $e, v += R * Me, M += R * Ne, I += R * Ke, F += R * Le, ce += R * qe, D += R * ze, oe += R * _e, Z += R * Ze, J += R * at, Q += R * ke, T += R * Qe, X += R * tt, re += R * Ye, pe += R * dt, ie += R * lt, R = V[11], v += R * $e, M += R * Me, I += R * Ne, F += R * Ke, ce += R * Le, D += R * qe, oe += R * ze, Z += R * _e, J += R * Ze, Q += R * at, T += R * ke, X += R * Qe, re += R * tt, pe += R * Ye, ie += R * dt, ue += R * lt, R = V[12], M += R * $e, I += R * Me, F += R * Ne, ce += R * Ke, D += R * Le, oe += R * qe, Z += R * ze, J += R * _e, Q += R * Ze, T += R * at, X += R * ke, re += R * Qe, pe += R * tt, ie += R * Ye, ue += R * dt, ve += R * lt, R = V[13], I += R * $e, F += R * Me, ce += R * Ne, D += R * Ke, oe += R * Le, Z += R * qe, J += R * ze, Q += R * _e, T += R * Ze, X += R * at, re += R * ke, pe += R * Qe, ie += R * tt, ue += R * Ye, ve += R * dt, Pe += R * lt, R = V[14], F += R * $e, ce += R * Me, D += R * Ne, oe += R * Ke, Z += R * Le, J += R * qe, Q += R * ze, T += R * _e, X += R * Ze, re += R * at, pe += R * ke, ie += R * Qe, ue += R * tt, ve += R * Ye, Pe += R * dt, De += R * lt, R = V[15], ce += R * $e, D += R * Me, oe += R * Ne, Z += R * Ke, J += R * Le, Q += R * qe, T += R * ze, X += R * _e, re += R * Ze, pe += R * at, ie += R * ke, ue += R * Qe, ve += R * tt, Pe += R * Ye, De += R * dt, Ce += R * lt, ge += 38 * D, Ee += 38 * oe, Y += 38 * Z, S += 38 * J, m += 38 * Q, f += 38 * T, g += 38 * X, b += 38 * re, x += 38 * pe, _ += 38 * ie, E += 38 * ue, v += 38 * ve, M += 38 * Pe, I += 38 * De, F += 38 * Ce, K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = _ + K + 65535, K = Math.floor(R / 65536), _ = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = M + K + 65535, K = Math.floor(R / 65536), M = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = _ + K + 65535, K = Math.floor(R / 65536), _ = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = M + K + 65535, K = Math.floor(R / 65536), M = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), W[0] = ge, W[1] = Ee, W[2] = Y, W[3] = S, W[4] = m, W[5] = f, W[6] = g, W[7] = b, W[8] = x, W[9] = _, W[10] = E, W[11] = v, W[12] = M, W[13] = I, W[14] = F, W[15] = ce; } - function A(H, V) { - w(H, V, V); + function A(W, V) { + w(W, V, V); } - function M(H, V) { + function P(W, V) { const te = n(); for (let R = 0; R < 16; R++) te[R] = V[R]; for (let R = 253; R >= 0; R--) A(te, te), R !== 2 && R !== 4 && w(te, te, V); for (let R = 0; R < 16; R++) - H[R] = te[R]; + W[R] = te[R]; } - function N(H, V) { - const te = new Uint8Array(32), R = new Float64Array(80), W = n(), pe = n(), Ee = n(), Y = n(), S = n(), m = n(); + function N(W, V) { + const te = new Uint8Array(32), R = new Float64Array(80), K = n(), ge = n(), Ee = n(), Y = n(), S = n(), m = n(); for (let x = 0; x < 31; x++) - te[x] = H[x]; - te[31] = H[31] & 127 | 64, te[0] &= 248, l(R, V); + te[x] = W[x]; + te[31] = W[31] & 127 | 64, te[0] &= 248, l(R, V); for (let x = 0; x < 16; x++) - pe[x] = R[x]; - W[0] = Y[0] = 1; + ge[x] = R[x]; + K[0] = Y[0] = 1; for (let x = 254; x >= 0; --x) { const _ = te[x >>> 3] >>> (x & 7) & 1; - a(W, pe, _), a(Ee, Y, _), d(S, W, Ee), g(W, W, Ee), d(Ee, pe, Y), g(pe, pe, Y), A(Y, S), A(m, W), w(W, Ee, W), w(Ee, pe, S), d(S, W, Ee), g(W, W, Ee), A(pe, W), g(Ee, Y, m), w(W, Ee, s), d(W, W, Y), w(Ee, Ee, W), w(W, Y, m), w(Y, pe, R), A(pe, S), a(W, pe, _), a(Ee, Y, _); + a(K, ge, _), a(Ee, Y, _), d(S, K, Ee), p(K, K, Ee), d(Ee, ge, Y), p(ge, ge, Y), A(Y, S), A(m, K), w(K, Ee, K), w(Ee, ge, S), d(S, K, Ee), p(K, K, Ee), A(ge, K), p(Ee, Y, m), w(K, Ee, s), d(K, K, Y), w(Ee, Ee, K), w(K, Y, m), w(Y, ge, R), A(ge, S), a(K, ge, _), a(Ee, Y, _); } for (let x = 0; x < 16; x++) - R[x + 16] = W[x], R[x + 32] = Ee[x], R[x + 48] = pe[x], R[x + 64] = Y[x]; - const f = R.subarray(32), p = R.subarray(16); - M(f, f), w(p, p, f); + R[x + 16] = K[x], R[x + 32] = Ee[x], R[x + 48] = ge[x], R[x + 64] = Y[x]; + const f = R.subarray(32), g = R.subarray(16); + P(f, f), w(g, g, f); const b = new Uint8Array(32); - return u(b, p), b; + return u(b, g), b; } t.scalarMult = N; - function L(H) { - return N(H, i); + function L(W) { + return N(W, i); } t.scalarMultBase = L; - function $(H) { - if (H.length !== t.SECRET_KEY_LENGTH) + function $(W) { + if (W.length !== t.SECRET_KEY_LENGTH) throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`); - const V = new Uint8Array(H); + const V = new Uint8Array(W); return { publicKey: L(V), secretKey: V }; } t.generateKeyPairFromSeed = $; - function F(H) { - const V = (0, e.randomBytes)(32, H), te = $(V); + function B(W) { + const V = (0, e.randomBytes)(32, W), te = $(V); return (0, r.wipe)(V), te; } - t.generateKeyPair = F; - function K(H, V, te = !1) { - if (H.length !== t.PUBLIC_KEY_LENGTH) + t.generateKeyPair = B; + function H(W, V, te = !1) { + if (W.length !== t.PUBLIC_KEY_LENGTH) throw new Error("X25519: incorrect secret key length"); if (V.length !== t.PUBLIC_KEY_LENGTH) throw new Error("X25519: incorrect public key length"); - const R = N(H, V); + const R = N(W, V); if (te) { - let W = 0; - for (let pe = 0; pe < R.length; pe++) - W |= R[pe]; - if (W === 0) + let K = 0; + for (let ge = 0; ge < R.length; ge++) + K |= R[ge]; + if (K === 0) throw new Error("X25519: invalid shared key"); } return R; } - t.sharedKey = K; + t.sharedKey = H; })(Jv); -var x8 = {}; -const Dj = "elliptic", Oj = "6.6.0", Nj = "EC cryptography", Lj = "lib/elliptic.js", kj = [ +var E8 = {}; +const qU = "elliptic", zU = "6.6.0", WU = "EC cryptography", HU = "lib/elliptic.js", KU = [ "lib" -], $j = { +], VU = { lint: "eslint lib test", "lint:fix": "npm run lint -- --fix", unit: "istanbul test _mocha --reporter=spec test/index.js", test: "npm run lint && npm run unit", version: "grunt dist && git add dist/" -}, Fj = { +}, GU = { type: "git", url: "git@github.com:indutny/elliptic" -}, Bj = [ +}, YU = [ "EC", "Elliptic", "curve", "Cryptography" -], Uj = "Fedor Indutny ", jj = "MIT", qj = { +], JU = "Fedor Indutny ", XU = "MIT", ZU = { url: "https://github.com/indutny/elliptic/issues" -}, zj = "https://github.com/indutny/elliptic", Hj = { +}, QU = "https://github.com/indutny/elliptic", eq = { brfs: "^2.0.2", coveralls: "^3.1.0", eslint: "^7.6.0", @@ -13132,7 +13132,7 @@ const Dj = "elliptic", Oj = "6.6.0", Nj = "EC cryptography", Lj = "lib/elliptic. "grunt-saucelabs": "^9.0.1", istanbul: "^0.4.5", mocha: "^8.0.1" -}, Wj = { +}, tq = { "bn.js": "^4.11.9", brorand: "^1.1.0", "hash.js": "^1.0.0", @@ -13140,21 +13140,21 @@ const Dj = "elliptic", Oj = "6.6.0", Nj = "EC cryptography", Lj = "lib/elliptic. inherits: "^2.0.4", "minimalistic-assert": "^1.0.1", "minimalistic-crypto-utils": "^1.0.1" -}, Kj = { - name: Dj, - version: Oj, - description: Nj, - main: Lj, - files: kj, - scripts: $j, - repository: Fj, - keywords: Bj, - author: Uj, - license: jj, - bugs: qj, - homepage: zj, - devDependencies: Hj, - dependencies: Wj +}, rq = { + name: qU, + version: zU, + description: WU, + main: HU, + files: KU, + scripts: VU, + repository: GU, + keywords: YU, + author: JU, + license: XU, + bugs: ZU, + homepage: QU, + devDependencies: eq, + dependencies: tq }; var Fi = {}, Xv = { exports: {} }; Xv.exports; @@ -13177,7 +13177,7 @@ Xv.exports; typeof e == "object" ? e.exports = s : r.BN = s, s.BN = s, s.wordSize = 26; var o; try { - typeof window < "u" && typeof window.Buffer < "u" ? o = window.Buffer : o = zl.Buffer; + typeof window < "u" && typeof window.Buffer < "u" ? o = window.Buffer : o = Wl.Buffer; } catch { } s.isBN = function(S) { @@ -13192,8 +13192,8 @@ Xv.exports; if (typeof S == "object") return this._initArray(S, m, f); m === "hex" && (m = 16), n(m === (m | 0) && m >= 2 && m <= 36), S = S.toString().replace(/\s+/g, ""); - var p = 0; - S[0] === "-" && (p++, this.negative = 1), p < S.length && (m === 16 ? this._parseHex(S, p, f) : (this._parseBase(S, m, p), f === "le" && this._initArray(this.toArray(), m, f))); + var g = 0; + S[0] === "-" && (g++, this.negative = 1), g < S.length && (m === 16 ? this._parseHex(S, g, f) : (this._parseBase(S, m, g), f === "le" && this._initArray(this.toArray(), m, f))); }, s.prototype._initNumber = function(S, m, f) { S < 0 && (this.negative = 1, S = -S), S < 67108864 ? (this.words = [S & 67108863], this.length = 1) : S < 4503599627370496 ? (this.words = [ S & 67108863, @@ -13207,15 +13207,15 @@ Xv.exports; if (n(typeof S.length == "number"), S.length <= 0) return this.words = [0], this.length = 1, this; this.length = Math.ceil(S.length / 3), this.words = new Array(this.length); - for (var p = 0; p < this.length; p++) - this.words[p] = 0; + for (var g = 0; g < this.length; g++) + this.words[g] = 0; var b, x, _ = 0; if (f === "be") - for (p = S.length - 1, b = 0; p >= 0; p -= 3) - x = S[p] | S[p - 1] << 8 | S[p - 2] << 16, this.words[b] |= x << _ & 67108863, this.words[b + 1] = x >>> 26 - _ & 67108863, _ += 24, _ >= 26 && (_ -= 26, b++); + for (g = S.length - 1, b = 0; g >= 0; g -= 3) + x = S[g] | S[g - 1] << 8 | S[g - 2] << 16, this.words[b] |= x << _ & 67108863, this.words[b + 1] = x >>> 26 - _ & 67108863, _ += 24, _ >= 26 && (_ -= 26, b++); else if (f === "le") - for (p = 0, b = 0; p < S.length; p += 3) - x = S[p] | S[p + 1] << 8 | S[p + 2] << 16, this.words[b] |= x << _ & 67108863, this.words[b + 1] = x >>> 26 - _ & 67108863, _ += 24, _ >= 26 && (_ -= 26, b++); + for (g = 0, b = 0; g < S.length; g += 3) + x = S[g] | S[g + 1] << 8 | S[g + 2] << 16, this.words[b] |= x << _ & 67108863, this.words[b + 1] = x >>> 26 - _ & 67108863, _ += 24, _ >= 26 && (_ -= 26, b++); return this.strip(); }; function a(Y, S) { @@ -13228,36 +13228,36 @@ Xv.exports; } s.prototype._parseHex = function(S, m, f) { this.length = Math.ceil((S.length - m) / 6), this.words = new Array(this.length); - for (var p = 0; p < this.length; p++) - this.words[p] = 0; + for (var g = 0; g < this.length; g++) + this.words[g] = 0; var b = 0, x = 0, _; if (f === "be") - for (p = S.length - 1; p >= m; p -= 2) - _ = u(S, m, p) << b, this.words[x] |= _ & 67108863, b >= 18 ? (b -= 18, x += 1, this.words[x] |= _ >>> 26) : b += 8; + for (g = S.length - 1; g >= m; g -= 2) + _ = u(S, m, g) << b, this.words[x] |= _ & 67108863, b >= 18 ? (b -= 18, x += 1, this.words[x] |= _ >>> 26) : b += 8; else { var E = S.length - m; - for (p = E % 2 === 0 ? m + 1 : m; p < S.length; p += 2) - _ = u(S, m, p) << b, this.words[x] |= _ & 67108863, b >= 18 ? (b -= 18, x += 1, this.words[x] |= _ >>> 26) : b += 8; + for (g = E % 2 === 0 ? m + 1 : m; g < S.length; g += 2) + _ = u(S, m, g) << b, this.words[x] |= _ & 67108863, b >= 18 ? (b -= 18, x += 1, this.words[x] |= _ >>> 26) : b += 8; } this.strip(); }; function l(Y, S, m, f) { - for (var p = 0, b = Math.min(Y.length, m), x = S; x < b; x++) { + for (var g = 0, b = Math.min(Y.length, m), x = S; x < b; x++) { var _ = Y.charCodeAt(x) - 48; - p *= f, _ >= 49 ? p += _ - 49 + 10 : _ >= 17 ? p += _ - 17 + 10 : p += _; + g *= f, _ >= 49 ? g += _ - 49 + 10 : _ >= 17 ? g += _ - 17 + 10 : g += _; } - return p; + return g; } s.prototype._parseBase = function(S, m, f) { this.words = [0], this.length = 1; - for (var p = 0, b = 1; b <= 67108863; b *= m) - p++; - p--, b = b / m | 0; - for (var x = S.length - f, _ = x % p, E = Math.min(x, x - _) + f, v = 0, P = f; P < E; P += p) - v = l(S, P, P + p, m), this.imuln(b), this.words[0] + v < 67108864 ? this.words[0] += v : this._iaddn(v); + for (var g = 0, b = 1; b <= 67108863; b *= m) + g++; + g--, b = b / m | 0; + for (var x = S.length - f, _ = x % g, E = Math.min(x, x - _) + f, v = 0, M = f; M < E; M += g) + v = l(S, M, M + g, m), this.imuln(b), this.words[0] + v < 67108864 ? this.words[0] += v : this._iaddn(v); if (_ !== 0) { var I = 1; - for (v = l(S, P, S.length, m), P = 0; P < _; P++) + for (v = l(S, M, S.length, m), M = 0; M < _; M++) I *= m; this.imuln(I), this.words[0] + v < 67108864 ? this.words[0] += v : this._iaddn(v); } @@ -13310,7 +13310,7 @@ Xv.exports; "00000000000000000000000", "000000000000000000000000", "0000000000000000000000000" - ], g = [ + ], p = [ 0, 0, 25, @@ -13392,21 +13392,21 @@ Xv.exports; var f; if (S === 16 || S === "hex") { f = ""; - for (var p = 0, b = 0, x = 0; x < this.length; x++) { - var _ = this.words[x], E = ((_ << p | b) & 16777215).toString(16); - b = _ >>> 24 - p & 16777215, p += 2, p >= 26 && (p -= 26, x--), b !== 0 || x !== this.length - 1 ? f = d[6 - E.length] + E + f : f = E + f; + for (var g = 0, b = 0, x = 0; x < this.length; x++) { + var _ = this.words[x], E = ((_ << g | b) & 16777215).toString(16); + b = _ >>> 24 - g & 16777215, g += 2, g >= 26 && (g -= 26, x--), b !== 0 || x !== this.length - 1 ? f = d[6 - E.length] + E + f : f = E + f; } for (b !== 0 && (f = b.toString(16) + f); f.length % m !== 0; ) f = "0" + f; return this.negative !== 0 && (f = "-" + f), f; } if (S === (S | 0) && S >= 2 && S <= 36) { - var v = g[S], P = w[S]; + var v = p[S], M = w[S]; f = ""; var I = this.clone(); for (I.negative = 0; !I.isZero(); ) { - var B = I.modn(P).toString(S); - I = I.idivn(P), I.isZero() ? f = B + f : f = d[v - B.length] + B + f; + var F = I.modn(M).toString(S); + I = I.idivn(M), I.isZero() ? f = F + f : f = d[v - F.length] + F + f; } for (this.isZero() && (f = "0" + f); f.length % m !== 0; ) f = "0" + f; @@ -13423,19 +13423,19 @@ Xv.exports; }, s.prototype.toArray = function(S, m) { return this.toArrayLike(Array, S, m); }, s.prototype.toArrayLike = function(S, m, f) { - var p = this.byteLength(), b = f || Math.max(1, p); - n(p <= b, "byte array longer than desired length"), n(b > 0, "Requested array length <= 0"), this.strip(); - var x = m === "le", _ = new S(b), E, v, P = this.clone(); + var g = this.byteLength(), b = f || Math.max(1, g); + n(g <= b, "byte array longer than desired length"), n(b > 0, "Requested array length <= 0"), this.strip(); + var x = m === "le", _ = new S(b), E, v, M = this.clone(); if (x) { - for (v = 0; !P.isZero(); v++) - E = P.andln(255), P.iushrn(8), _[v] = E; + for (v = 0; !M.isZero(); v++) + E = M.andln(255), M.iushrn(8), _[v] = E; for (; v < b; v++) _[v] = 0; } else { - for (v = 0; v < b - p; v++) + for (v = 0; v < b - g; v++) _[v] = 0; - for (v = 0; !P.isZero(); v++) - E = P.andln(255), P.iushrn(8), _[b - v - 1] = E; + for (v = 0; !M.isZero(); v++) + E = M.andln(255), M.iushrn(8), _[b - v - 1] = E; } return _; }, Math.clz32 ? s.prototype._countBits = function(S) { @@ -13453,8 +13453,8 @@ Xv.exports; }; function A(Y) { for (var S = new Array(Y.bitLength()), m = 0; m < S.length; m++) { - var f = m / 26 | 0, p = m % 26; - S[m] = (Y.words[f] & 1 << p) >>> p; + var f = m / 26 | 0, g = m % 26; + S[m] = (Y.words[f] & 1 << g) >>> g; } return S; } @@ -13504,11 +13504,11 @@ Xv.exports; }, s.prototype.iuxor = function(S) { var m, f; this.length > S.length ? (m = this, f = S) : (m = S, f = this); - for (var p = 0; p < f.length; p++) - this.words[p] = m.words[p] ^ f.words[p]; + for (var g = 0; g < f.length; g++) + this.words[g] = m.words[g] ^ f.words[g]; if (this !== m) - for (; p < m.length; p++) - this.words[p] = m.words[p]; + for (; g < m.length; g++) + this.words[g] = m.words[g]; return this.length = m.length, this.strip(); }, s.prototype.ixor = function(S) { return n((this.negative | S.negative) === 0), this.iuxor(S); @@ -13520,25 +13520,25 @@ Xv.exports; n(typeof S == "number" && S >= 0); var m = Math.ceil(S / 26) | 0, f = S % 26; this._expand(m), f > 0 && m--; - for (var p = 0; p < m; p++) - this.words[p] = ~this.words[p] & 67108863; - return f > 0 && (this.words[p] = ~this.words[p] & 67108863 >> 26 - f), this.strip(); + for (var g = 0; g < m; g++) + this.words[g] = ~this.words[g] & 67108863; + return f > 0 && (this.words[g] = ~this.words[g] & 67108863 >> 26 - f), this.strip(); }, s.prototype.notn = function(S) { return this.clone().inotn(S); }, s.prototype.setn = function(S, m) { n(typeof S == "number" && S >= 0); - var f = S / 26 | 0, p = S % 26; - return this._expand(f + 1), m ? this.words[f] = this.words[f] | 1 << p : this.words[f] = this.words[f] & ~(1 << p), this.strip(); + var f = S / 26 | 0, g = S % 26; + return this._expand(f + 1), m ? this.words[f] = this.words[f] | 1 << g : this.words[f] = this.words[f] & ~(1 << g), this.strip(); }, s.prototype.iadd = function(S) { var m; if (this.negative !== 0 && S.negative === 0) return this.negative = 0, m = this.isub(S), this.negative ^= 1, this._normSign(); if (this.negative === 0 && S.negative !== 0) return S.negative = 0, m = this.isub(S), S.negative = 1, m._normSign(); - var f, p; - this.length > S.length ? (f = this, p = S) : (f = S, p = this); - for (var b = 0, x = 0; x < p.length; x++) - m = (f.words[x] | 0) + (p.words[x] | 0) + b, this.words[x] = m & 67108863, b = m >>> 26; + var f, g; + this.length > S.length ? (f = this, g = S) : (f = S, g = this); + for (var b = 0, x = 0; x < g.length; x++) + m = (f.words[x] | 0) + (g.words[x] | 0) + b, this.words[x] = m & 67108863, b = m >>> 26; for (; b !== 0 && x < f.length; x++) m = (f.words[x] | 0) + b, this.words[x] = m & 67108863, b = m >>> 26; if (this.length = f.length, b !== 0) @@ -13560,156 +13560,156 @@ Xv.exports; var f = this.cmp(S); if (f === 0) return this.negative = 0, this.length = 1, this.words[0] = 0, this; - var p, b; - f > 0 ? (p = this, b = S) : (p = S, b = this); + var g, b; + f > 0 ? (g = this, b = S) : (g = S, b = this); for (var x = 0, _ = 0; _ < b.length; _++) - m = (p.words[_] | 0) - (b.words[_] | 0) + x, x = m >> 26, this.words[_] = m & 67108863; - for (; x !== 0 && _ < p.length; _++) - m = (p.words[_] | 0) + x, x = m >> 26, this.words[_] = m & 67108863; - if (x === 0 && _ < p.length && p !== this) - for (; _ < p.length; _++) - this.words[_] = p.words[_]; - return this.length = Math.max(this.length, _), p !== this && (this.negative = 1), this.strip(); + m = (g.words[_] | 0) - (b.words[_] | 0) + x, x = m >> 26, this.words[_] = m & 67108863; + for (; x !== 0 && _ < g.length; _++) + m = (g.words[_] | 0) + x, x = m >> 26, this.words[_] = m & 67108863; + if (x === 0 && _ < g.length && g !== this) + for (; _ < g.length; _++) + this.words[_] = g.words[_]; + return this.length = Math.max(this.length, _), g !== this && (this.negative = 1), this.strip(); }, s.prototype.sub = function(S) { return this.clone().isub(S); }; - function M(Y, S, m) { + function P(Y, S, m) { m.negative = S.negative ^ Y.negative; var f = Y.length + S.length | 0; m.length = f, f = f - 1 | 0; - var p = Y.words[0] | 0, b = S.words[0] | 0, x = p * b, _ = x & 67108863, E = x / 67108864 | 0; + var g = Y.words[0] | 0, b = S.words[0] | 0, x = g * b, _ = x & 67108863, E = x / 67108864 | 0; m.words[0] = _; for (var v = 1; v < f; v++) { - for (var P = E >>> 26, I = E & 67108863, B = Math.min(v, S.length - 1), ce = Math.max(0, v - Y.length + 1); ce <= B; ce++) { + for (var M = E >>> 26, I = E & 67108863, F = Math.min(v, S.length - 1), ce = Math.max(0, v - Y.length + 1); ce <= F; ce++) { var D = v - ce | 0; - p = Y.words[D] | 0, b = S.words[ce] | 0, x = p * b + I, P += x / 67108864 | 0, I = x & 67108863; + g = Y.words[D] | 0, b = S.words[ce] | 0, x = g * b + I, M += x / 67108864 | 0, I = x & 67108863; } - m.words[v] = I | 0, E = P | 0; + m.words[v] = I | 0, E = M | 0; } return E !== 0 ? m.words[v] = E | 0 : m.length--, m.strip(); } var N = function(S, m, f) { - var p = S.words, b = m.words, x = f.words, _ = 0, E, v, P, I = p[0] | 0, B = I & 8191, ce = I >>> 13, D = p[1] | 0, oe = D & 8191, Z = D >>> 13, J = p[2] | 0, Q = J & 8191, T = J >>> 13, X = p[3] | 0, re = X & 8191, de = X >>> 13, ie = p[4] | 0, ue = ie & 8191, ve = ie >>> 13, Pe = p[5] | 0, De = Pe & 8191, Ce = Pe >>> 13, $e = p[6] | 0, Me = $e & 8191, Ne = $e >>> 13, Ke = p[7] | 0, Le = Ke & 8191, qe = Ke >>> 13, ze = p[8] | 0, _e = ze & 8191, Ze = ze >>> 13, at = p[9] | 0, ke = at & 8191, Qe = at >>> 13, tt = b[0] | 0, Ye = tt & 8191, dt = tt >>> 13, lt = b[1] | 0, ct = lt & 8191, qt = lt >>> 13, Yt = b[2] | 0, Et = Yt & 8191, Qt = Yt >>> 13, Jt = b[3] | 0, Dt = Jt & 8191, kt = Jt >>> 13, Ct = b[4] | 0, gt = Ct & 8191, Rt = Ct >>> 13, Nt = b[5] | 0, vt = Nt & 8191, $t = Nt >>> 13, Bt = b[6] | 0, rt = Bt & 8191, Ft = Bt >>> 13, k = b[7] | 0, j = k & 8191, z = k >>> 13, C = b[8] | 0, G = C & 8191, U = C >>> 13, se = b[9] | 0, he = se & 8191, xe = se >>> 13; - f.negative = S.negative ^ m.negative, f.length = 19, E = Math.imul(B, Ye), v = Math.imul(B, dt), v = v + Math.imul(ce, Ye) | 0, P = Math.imul(ce, dt); + var g = S.words, b = m.words, x = f.words, _ = 0, E, v, M, I = g[0] | 0, F = I & 8191, ce = I >>> 13, D = g[1] | 0, oe = D & 8191, Z = D >>> 13, J = g[2] | 0, Q = J & 8191, T = J >>> 13, X = g[3] | 0, re = X & 8191, pe = X >>> 13, ie = g[4] | 0, ue = ie & 8191, ve = ie >>> 13, Pe = g[5] | 0, De = Pe & 8191, Ce = Pe >>> 13, $e = g[6] | 0, Me = $e & 8191, Ne = $e >>> 13, Ke = g[7] | 0, Le = Ke & 8191, qe = Ke >>> 13, ze = g[8] | 0, _e = ze & 8191, Ze = ze >>> 13, at = g[9] | 0, ke = at & 8191, Qe = at >>> 13, tt = b[0] | 0, Ye = tt & 8191, dt = tt >>> 13, lt = b[1] | 0, ct = lt & 8191, qt = lt >>> 13, Jt = b[2] | 0, Et = Jt & 8191, er = Jt >>> 13, Xt = b[3] | 0, Dt = Xt & 8191, kt = Xt >>> 13, Ct = b[4] | 0, gt = Ct & 8191, Rt = Ct >>> 13, Nt = b[5] | 0, vt = Nt & 8191, $t = Nt >>> 13, Ft = b[6] | 0, rt = Ft & 8191, Bt = Ft >>> 13, k = b[7] | 0, U = k & 8191, z = k >>> 13, C = b[8] | 0, G = C & 8191, j = C >>> 13, se = b[9] | 0, de = se & 8191, xe = se >>> 13; + f.negative = S.negative ^ m.negative, f.length = 19, E = Math.imul(F, Ye), v = Math.imul(F, dt), v = v + Math.imul(ce, Ye) | 0, M = Math.imul(ce, dt); var Te = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (Te >>> 26) | 0, Te &= 67108863, E = Math.imul(oe, Ye), v = Math.imul(oe, dt), v = v + Math.imul(Z, Ye) | 0, P = Math.imul(Z, dt), E = E + Math.imul(B, ct) | 0, v = v + Math.imul(B, qt) | 0, v = v + Math.imul(ce, ct) | 0, P = P + Math.imul(ce, qt) | 0; + _ = (M + (v >>> 13) | 0) + (Te >>> 26) | 0, Te &= 67108863, E = Math.imul(oe, Ye), v = Math.imul(oe, dt), v = v + Math.imul(Z, Ye) | 0, M = Math.imul(Z, dt), E = E + Math.imul(F, ct) | 0, v = v + Math.imul(F, qt) | 0, v = v + Math.imul(ce, ct) | 0, M = M + Math.imul(ce, qt) | 0; var Re = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (Re >>> 26) | 0, Re &= 67108863, E = Math.imul(Q, Ye), v = Math.imul(Q, dt), v = v + Math.imul(T, Ye) | 0, P = Math.imul(T, dt), E = E + Math.imul(oe, ct) | 0, v = v + Math.imul(oe, qt) | 0, v = v + Math.imul(Z, ct) | 0, P = P + Math.imul(Z, qt) | 0, E = E + Math.imul(B, Et) | 0, v = v + Math.imul(B, Qt) | 0, v = v + Math.imul(ce, Et) | 0, P = P + Math.imul(ce, Qt) | 0; + _ = (M + (v >>> 13) | 0) + (Re >>> 26) | 0, Re &= 67108863, E = Math.imul(Q, Ye), v = Math.imul(Q, dt), v = v + Math.imul(T, Ye) | 0, M = Math.imul(T, dt), E = E + Math.imul(oe, ct) | 0, v = v + Math.imul(oe, qt) | 0, v = v + Math.imul(Z, ct) | 0, M = M + Math.imul(Z, qt) | 0, E = E + Math.imul(F, Et) | 0, v = v + Math.imul(F, er) | 0, v = v + Math.imul(ce, Et) | 0, M = M + Math.imul(ce, er) | 0; var nt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, E = Math.imul(re, Ye), v = Math.imul(re, dt), v = v + Math.imul(de, Ye) | 0, P = Math.imul(de, dt), E = E + Math.imul(Q, ct) | 0, v = v + Math.imul(Q, qt) | 0, v = v + Math.imul(T, ct) | 0, P = P + Math.imul(T, qt) | 0, E = E + Math.imul(oe, Et) | 0, v = v + Math.imul(oe, Qt) | 0, v = v + Math.imul(Z, Et) | 0, P = P + Math.imul(Z, Qt) | 0, E = E + Math.imul(B, Dt) | 0, v = v + Math.imul(B, kt) | 0, v = v + Math.imul(ce, Dt) | 0, P = P + Math.imul(ce, kt) | 0; - var Ue = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (Ue >>> 26) | 0, Ue &= 67108863, E = Math.imul(ue, Ye), v = Math.imul(ue, dt), v = v + Math.imul(ve, Ye) | 0, P = Math.imul(ve, dt), E = E + Math.imul(re, ct) | 0, v = v + Math.imul(re, qt) | 0, v = v + Math.imul(de, ct) | 0, P = P + Math.imul(de, qt) | 0, E = E + Math.imul(Q, Et) | 0, v = v + Math.imul(Q, Qt) | 0, v = v + Math.imul(T, Et) | 0, P = P + Math.imul(T, Qt) | 0, E = E + Math.imul(oe, Dt) | 0, v = v + Math.imul(oe, kt) | 0, v = v + Math.imul(Z, Dt) | 0, P = P + Math.imul(Z, kt) | 0, E = E + Math.imul(B, gt) | 0, v = v + Math.imul(B, Rt) | 0, v = v + Math.imul(ce, gt) | 0, P = P + Math.imul(ce, Rt) | 0; + _ = (M + (v >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, E = Math.imul(re, Ye), v = Math.imul(re, dt), v = v + Math.imul(pe, Ye) | 0, M = Math.imul(pe, dt), E = E + Math.imul(Q, ct) | 0, v = v + Math.imul(Q, qt) | 0, v = v + Math.imul(T, ct) | 0, M = M + Math.imul(T, qt) | 0, E = E + Math.imul(oe, Et) | 0, v = v + Math.imul(oe, er) | 0, v = v + Math.imul(Z, Et) | 0, M = M + Math.imul(Z, er) | 0, E = E + Math.imul(F, Dt) | 0, v = v + Math.imul(F, kt) | 0, v = v + Math.imul(ce, Dt) | 0, M = M + Math.imul(ce, kt) | 0; + var je = (_ + E | 0) + ((v & 8191) << 13) | 0; + _ = (M + (v >>> 13) | 0) + (je >>> 26) | 0, je &= 67108863, E = Math.imul(ue, Ye), v = Math.imul(ue, dt), v = v + Math.imul(ve, Ye) | 0, M = Math.imul(ve, dt), E = E + Math.imul(re, ct) | 0, v = v + Math.imul(re, qt) | 0, v = v + Math.imul(pe, ct) | 0, M = M + Math.imul(pe, qt) | 0, E = E + Math.imul(Q, Et) | 0, v = v + Math.imul(Q, er) | 0, v = v + Math.imul(T, Et) | 0, M = M + Math.imul(T, er) | 0, E = E + Math.imul(oe, Dt) | 0, v = v + Math.imul(oe, kt) | 0, v = v + Math.imul(Z, Dt) | 0, M = M + Math.imul(Z, kt) | 0, E = E + Math.imul(F, gt) | 0, v = v + Math.imul(F, Rt) | 0, v = v + Math.imul(ce, gt) | 0, M = M + Math.imul(ce, Rt) | 0; var pt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (pt >>> 26) | 0, pt &= 67108863, E = Math.imul(De, Ye), v = Math.imul(De, dt), v = v + Math.imul(Ce, Ye) | 0, P = Math.imul(Ce, dt), E = E + Math.imul(ue, ct) | 0, v = v + Math.imul(ue, qt) | 0, v = v + Math.imul(ve, ct) | 0, P = P + Math.imul(ve, qt) | 0, E = E + Math.imul(re, Et) | 0, v = v + Math.imul(re, Qt) | 0, v = v + Math.imul(de, Et) | 0, P = P + Math.imul(de, Qt) | 0, E = E + Math.imul(Q, Dt) | 0, v = v + Math.imul(Q, kt) | 0, v = v + Math.imul(T, Dt) | 0, P = P + Math.imul(T, kt) | 0, E = E + Math.imul(oe, gt) | 0, v = v + Math.imul(oe, Rt) | 0, v = v + Math.imul(Z, gt) | 0, P = P + Math.imul(Z, Rt) | 0, E = E + Math.imul(B, vt) | 0, v = v + Math.imul(B, $t) | 0, v = v + Math.imul(ce, vt) | 0, P = P + Math.imul(ce, $t) | 0; + _ = (M + (v >>> 13) | 0) + (pt >>> 26) | 0, pt &= 67108863, E = Math.imul(De, Ye), v = Math.imul(De, dt), v = v + Math.imul(Ce, Ye) | 0, M = Math.imul(Ce, dt), E = E + Math.imul(ue, ct) | 0, v = v + Math.imul(ue, qt) | 0, v = v + Math.imul(ve, ct) | 0, M = M + Math.imul(ve, qt) | 0, E = E + Math.imul(re, Et) | 0, v = v + Math.imul(re, er) | 0, v = v + Math.imul(pe, Et) | 0, M = M + Math.imul(pe, er) | 0, E = E + Math.imul(Q, Dt) | 0, v = v + Math.imul(Q, kt) | 0, v = v + Math.imul(T, Dt) | 0, M = M + Math.imul(T, kt) | 0, E = E + Math.imul(oe, gt) | 0, v = v + Math.imul(oe, Rt) | 0, v = v + Math.imul(Z, gt) | 0, M = M + Math.imul(Z, Rt) | 0, E = E + Math.imul(F, vt) | 0, v = v + Math.imul(F, $t) | 0, v = v + Math.imul(ce, vt) | 0, M = M + Math.imul(ce, $t) | 0; var it = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, E = Math.imul(Me, Ye), v = Math.imul(Me, dt), v = v + Math.imul(Ne, Ye) | 0, P = Math.imul(Ne, dt), E = E + Math.imul(De, ct) | 0, v = v + Math.imul(De, qt) | 0, v = v + Math.imul(Ce, ct) | 0, P = P + Math.imul(Ce, qt) | 0, E = E + Math.imul(ue, Et) | 0, v = v + Math.imul(ue, Qt) | 0, v = v + Math.imul(ve, Et) | 0, P = P + Math.imul(ve, Qt) | 0, E = E + Math.imul(re, Dt) | 0, v = v + Math.imul(re, kt) | 0, v = v + Math.imul(de, Dt) | 0, P = P + Math.imul(de, kt) | 0, E = E + Math.imul(Q, gt) | 0, v = v + Math.imul(Q, Rt) | 0, v = v + Math.imul(T, gt) | 0, P = P + Math.imul(T, Rt) | 0, E = E + Math.imul(oe, vt) | 0, v = v + Math.imul(oe, $t) | 0, v = v + Math.imul(Z, vt) | 0, P = P + Math.imul(Z, $t) | 0, E = E + Math.imul(B, rt) | 0, v = v + Math.imul(B, Ft) | 0, v = v + Math.imul(ce, rt) | 0, P = P + Math.imul(ce, Ft) | 0; + _ = (M + (v >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, E = Math.imul(Me, Ye), v = Math.imul(Me, dt), v = v + Math.imul(Ne, Ye) | 0, M = Math.imul(Ne, dt), E = E + Math.imul(De, ct) | 0, v = v + Math.imul(De, qt) | 0, v = v + Math.imul(Ce, ct) | 0, M = M + Math.imul(Ce, qt) | 0, E = E + Math.imul(ue, Et) | 0, v = v + Math.imul(ue, er) | 0, v = v + Math.imul(ve, Et) | 0, M = M + Math.imul(ve, er) | 0, E = E + Math.imul(re, Dt) | 0, v = v + Math.imul(re, kt) | 0, v = v + Math.imul(pe, Dt) | 0, M = M + Math.imul(pe, kt) | 0, E = E + Math.imul(Q, gt) | 0, v = v + Math.imul(Q, Rt) | 0, v = v + Math.imul(T, gt) | 0, M = M + Math.imul(T, Rt) | 0, E = E + Math.imul(oe, vt) | 0, v = v + Math.imul(oe, $t) | 0, v = v + Math.imul(Z, vt) | 0, M = M + Math.imul(Z, $t) | 0, E = E + Math.imul(F, rt) | 0, v = v + Math.imul(F, Bt) | 0, v = v + Math.imul(ce, rt) | 0, M = M + Math.imul(ce, Bt) | 0; var et = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, E = Math.imul(Le, Ye), v = Math.imul(Le, dt), v = v + Math.imul(qe, Ye) | 0, P = Math.imul(qe, dt), E = E + Math.imul(Me, ct) | 0, v = v + Math.imul(Me, qt) | 0, v = v + Math.imul(Ne, ct) | 0, P = P + Math.imul(Ne, qt) | 0, E = E + Math.imul(De, Et) | 0, v = v + Math.imul(De, Qt) | 0, v = v + Math.imul(Ce, Et) | 0, P = P + Math.imul(Ce, Qt) | 0, E = E + Math.imul(ue, Dt) | 0, v = v + Math.imul(ue, kt) | 0, v = v + Math.imul(ve, Dt) | 0, P = P + Math.imul(ve, kt) | 0, E = E + Math.imul(re, gt) | 0, v = v + Math.imul(re, Rt) | 0, v = v + Math.imul(de, gt) | 0, P = P + Math.imul(de, Rt) | 0, E = E + Math.imul(Q, vt) | 0, v = v + Math.imul(Q, $t) | 0, v = v + Math.imul(T, vt) | 0, P = P + Math.imul(T, $t) | 0, E = E + Math.imul(oe, rt) | 0, v = v + Math.imul(oe, Ft) | 0, v = v + Math.imul(Z, rt) | 0, P = P + Math.imul(Z, Ft) | 0, E = E + Math.imul(B, j) | 0, v = v + Math.imul(B, z) | 0, v = v + Math.imul(ce, j) | 0, P = P + Math.imul(ce, z) | 0; + _ = (M + (v >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, E = Math.imul(Le, Ye), v = Math.imul(Le, dt), v = v + Math.imul(qe, Ye) | 0, M = Math.imul(qe, dt), E = E + Math.imul(Me, ct) | 0, v = v + Math.imul(Me, qt) | 0, v = v + Math.imul(Ne, ct) | 0, M = M + Math.imul(Ne, qt) | 0, E = E + Math.imul(De, Et) | 0, v = v + Math.imul(De, er) | 0, v = v + Math.imul(Ce, Et) | 0, M = M + Math.imul(Ce, er) | 0, E = E + Math.imul(ue, Dt) | 0, v = v + Math.imul(ue, kt) | 0, v = v + Math.imul(ve, Dt) | 0, M = M + Math.imul(ve, kt) | 0, E = E + Math.imul(re, gt) | 0, v = v + Math.imul(re, Rt) | 0, v = v + Math.imul(pe, gt) | 0, M = M + Math.imul(pe, Rt) | 0, E = E + Math.imul(Q, vt) | 0, v = v + Math.imul(Q, $t) | 0, v = v + Math.imul(T, vt) | 0, M = M + Math.imul(T, $t) | 0, E = E + Math.imul(oe, rt) | 0, v = v + Math.imul(oe, Bt) | 0, v = v + Math.imul(Z, rt) | 0, M = M + Math.imul(Z, Bt) | 0, E = E + Math.imul(F, U) | 0, v = v + Math.imul(F, z) | 0, v = v + Math.imul(ce, U) | 0, M = M + Math.imul(ce, z) | 0; var St = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, E = Math.imul(_e, Ye), v = Math.imul(_e, dt), v = v + Math.imul(Ze, Ye) | 0, P = Math.imul(Ze, dt), E = E + Math.imul(Le, ct) | 0, v = v + Math.imul(Le, qt) | 0, v = v + Math.imul(qe, ct) | 0, P = P + Math.imul(qe, qt) | 0, E = E + Math.imul(Me, Et) | 0, v = v + Math.imul(Me, Qt) | 0, v = v + Math.imul(Ne, Et) | 0, P = P + Math.imul(Ne, Qt) | 0, E = E + Math.imul(De, Dt) | 0, v = v + Math.imul(De, kt) | 0, v = v + Math.imul(Ce, Dt) | 0, P = P + Math.imul(Ce, kt) | 0, E = E + Math.imul(ue, gt) | 0, v = v + Math.imul(ue, Rt) | 0, v = v + Math.imul(ve, gt) | 0, P = P + Math.imul(ve, Rt) | 0, E = E + Math.imul(re, vt) | 0, v = v + Math.imul(re, $t) | 0, v = v + Math.imul(de, vt) | 0, P = P + Math.imul(de, $t) | 0, E = E + Math.imul(Q, rt) | 0, v = v + Math.imul(Q, Ft) | 0, v = v + Math.imul(T, rt) | 0, P = P + Math.imul(T, Ft) | 0, E = E + Math.imul(oe, j) | 0, v = v + Math.imul(oe, z) | 0, v = v + Math.imul(Z, j) | 0, P = P + Math.imul(Z, z) | 0, E = E + Math.imul(B, G) | 0, v = v + Math.imul(B, U) | 0, v = v + Math.imul(ce, G) | 0, P = P + Math.imul(ce, U) | 0; + _ = (M + (v >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, E = Math.imul(_e, Ye), v = Math.imul(_e, dt), v = v + Math.imul(Ze, Ye) | 0, M = Math.imul(Ze, dt), E = E + Math.imul(Le, ct) | 0, v = v + Math.imul(Le, qt) | 0, v = v + Math.imul(qe, ct) | 0, M = M + Math.imul(qe, qt) | 0, E = E + Math.imul(Me, Et) | 0, v = v + Math.imul(Me, er) | 0, v = v + Math.imul(Ne, Et) | 0, M = M + Math.imul(Ne, er) | 0, E = E + Math.imul(De, Dt) | 0, v = v + Math.imul(De, kt) | 0, v = v + Math.imul(Ce, Dt) | 0, M = M + Math.imul(Ce, kt) | 0, E = E + Math.imul(ue, gt) | 0, v = v + Math.imul(ue, Rt) | 0, v = v + Math.imul(ve, gt) | 0, M = M + Math.imul(ve, Rt) | 0, E = E + Math.imul(re, vt) | 0, v = v + Math.imul(re, $t) | 0, v = v + Math.imul(pe, vt) | 0, M = M + Math.imul(pe, $t) | 0, E = E + Math.imul(Q, rt) | 0, v = v + Math.imul(Q, Bt) | 0, v = v + Math.imul(T, rt) | 0, M = M + Math.imul(T, Bt) | 0, E = E + Math.imul(oe, U) | 0, v = v + Math.imul(oe, z) | 0, v = v + Math.imul(Z, U) | 0, M = M + Math.imul(Z, z) | 0, E = E + Math.imul(F, G) | 0, v = v + Math.imul(F, j) | 0, v = v + Math.imul(ce, G) | 0, M = M + Math.imul(ce, j) | 0; var Tt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, E = Math.imul(ke, Ye), v = Math.imul(ke, dt), v = v + Math.imul(Qe, Ye) | 0, P = Math.imul(Qe, dt), E = E + Math.imul(_e, ct) | 0, v = v + Math.imul(_e, qt) | 0, v = v + Math.imul(Ze, ct) | 0, P = P + Math.imul(Ze, qt) | 0, E = E + Math.imul(Le, Et) | 0, v = v + Math.imul(Le, Qt) | 0, v = v + Math.imul(qe, Et) | 0, P = P + Math.imul(qe, Qt) | 0, E = E + Math.imul(Me, Dt) | 0, v = v + Math.imul(Me, kt) | 0, v = v + Math.imul(Ne, Dt) | 0, P = P + Math.imul(Ne, kt) | 0, E = E + Math.imul(De, gt) | 0, v = v + Math.imul(De, Rt) | 0, v = v + Math.imul(Ce, gt) | 0, P = P + Math.imul(Ce, Rt) | 0, E = E + Math.imul(ue, vt) | 0, v = v + Math.imul(ue, $t) | 0, v = v + Math.imul(ve, vt) | 0, P = P + Math.imul(ve, $t) | 0, E = E + Math.imul(re, rt) | 0, v = v + Math.imul(re, Ft) | 0, v = v + Math.imul(de, rt) | 0, P = P + Math.imul(de, Ft) | 0, E = E + Math.imul(Q, j) | 0, v = v + Math.imul(Q, z) | 0, v = v + Math.imul(T, j) | 0, P = P + Math.imul(T, z) | 0, E = E + Math.imul(oe, G) | 0, v = v + Math.imul(oe, U) | 0, v = v + Math.imul(Z, G) | 0, P = P + Math.imul(Z, U) | 0, E = E + Math.imul(B, he) | 0, v = v + Math.imul(B, xe) | 0, v = v + Math.imul(ce, he) | 0, P = P + Math.imul(ce, xe) | 0; + _ = (M + (v >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, E = Math.imul(ke, Ye), v = Math.imul(ke, dt), v = v + Math.imul(Qe, Ye) | 0, M = Math.imul(Qe, dt), E = E + Math.imul(_e, ct) | 0, v = v + Math.imul(_e, qt) | 0, v = v + Math.imul(Ze, ct) | 0, M = M + Math.imul(Ze, qt) | 0, E = E + Math.imul(Le, Et) | 0, v = v + Math.imul(Le, er) | 0, v = v + Math.imul(qe, Et) | 0, M = M + Math.imul(qe, er) | 0, E = E + Math.imul(Me, Dt) | 0, v = v + Math.imul(Me, kt) | 0, v = v + Math.imul(Ne, Dt) | 0, M = M + Math.imul(Ne, kt) | 0, E = E + Math.imul(De, gt) | 0, v = v + Math.imul(De, Rt) | 0, v = v + Math.imul(Ce, gt) | 0, M = M + Math.imul(Ce, Rt) | 0, E = E + Math.imul(ue, vt) | 0, v = v + Math.imul(ue, $t) | 0, v = v + Math.imul(ve, vt) | 0, M = M + Math.imul(ve, $t) | 0, E = E + Math.imul(re, rt) | 0, v = v + Math.imul(re, Bt) | 0, v = v + Math.imul(pe, rt) | 0, M = M + Math.imul(pe, Bt) | 0, E = E + Math.imul(Q, U) | 0, v = v + Math.imul(Q, z) | 0, v = v + Math.imul(T, U) | 0, M = M + Math.imul(T, z) | 0, E = E + Math.imul(oe, G) | 0, v = v + Math.imul(oe, j) | 0, v = v + Math.imul(Z, G) | 0, M = M + Math.imul(Z, j) | 0, E = E + Math.imul(F, de) | 0, v = v + Math.imul(F, xe) | 0, v = v + Math.imul(ce, de) | 0, M = M + Math.imul(ce, xe) | 0; var At = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, E = Math.imul(ke, ct), v = Math.imul(ke, qt), v = v + Math.imul(Qe, ct) | 0, P = Math.imul(Qe, qt), E = E + Math.imul(_e, Et) | 0, v = v + Math.imul(_e, Qt) | 0, v = v + Math.imul(Ze, Et) | 0, P = P + Math.imul(Ze, Qt) | 0, E = E + Math.imul(Le, Dt) | 0, v = v + Math.imul(Le, kt) | 0, v = v + Math.imul(qe, Dt) | 0, P = P + Math.imul(qe, kt) | 0, E = E + Math.imul(Me, gt) | 0, v = v + Math.imul(Me, Rt) | 0, v = v + Math.imul(Ne, gt) | 0, P = P + Math.imul(Ne, Rt) | 0, E = E + Math.imul(De, vt) | 0, v = v + Math.imul(De, $t) | 0, v = v + Math.imul(Ce, vt) | 0, P = P + Math.imul(Ce, $t) | 0, E = E + Math.imul(ue, rt) | 0, v = v + Math.imul(ue, Ft) | 0, v = v + Math.imul(ve, rt) | 0, P = P + Math.imul(ve, Ft) | 0, E = E + Math.imul(re, j) | 0, v = v + Math.imul(re, z) | 0, v = v + Math.imul(de, j) | 0, P = P + Math.imul(de, z) | 0, E = E + Math.imul(Q, G) | 0, v = v + Math.imul(Q, U) | 0, v = v + Math.imul(T, G) | 0, P = P + Math.imul(T, U) | 0, E = E + Math.imul(oe, he) | 0, v = v + Math.imul(oe, xe) | 0, v = v + Math.imul(Z, he) | 0, P = P + Math.imul(Z, xe) | 0; + _ = (M + (v >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, E = Math.imul(ke, ct), v = Math.imul(ke, qt), v = v + Math.imul(Qe, ct) | 0, M = Math.imul(Qe, qt), E = E + Math.imul(_e, Et) | 0, v = v + Math.imul(_e, er) | 0, v = v + Math.imul(Ze, Et) | 0, M = M + Math.imul(Ze, er) | 0, E = E + Math.imul(Le, Dt) | 0, v = v + Math.imul(Le, kt) | 0, v = v + Math.imul(qe, Dt) | 0, M = M + Math.imul(qe, kt) | 0, E = E + Math.imul(Me, gt) | 0, v = v + Math.imul(Me, Rt) | 0, v = v + Math.imul(Ne, gt) | 0, M = M + Math.imul(Ne, Rt) | 0, E = E + Math.imul(De, vt) | 0, v = v + Math.imul(De, $t) | 0, v = v + Math.imul(Ce, vt) | 0, M = M + Math.imul(Ce, $t) | 0, E = E + Math.imul(ue, rt) | 0, v = v + Math.imul(ue, Bt) | 0, v = v + Math.imul(ve, rt) | 0, M = M + Math.imul(ve, Bt) | 0, E = E + Math.imul(re, U) | 0, v = v + Math.imul(re, z) | 0, v = v + Math.imul(pe, U) | 0, M = M + Math.imul(pe, z) | 0, E = E + Math.imul(Q, G) | 0, v = v + Math.imul(Q, j) | 0, v = v + Math.imul(T, G) | 0, M = M + Math.imul(T, j) | 0, E = E + Math.imul(oe, de) | 0, v = v + Math.imul(oe, xe) | 0, v = v + Math.imul(Z, de) | 0, M = M + Math.imul(Z, xe) | 0; var _t = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, E = Math.imul(ke, Et), v = Math.imul(ke, Qt), v = v + Math.imul(Qe, Et) | 0, P = Math.imul(Qe, Qt), E = E + Math.imul(_e, Dt) | 0, v = v + Math.imul(_e, kt) | 0, v = v + Math.imul(Ze, Dt) | 0, P = P + Math.imul(Ze, kt) | 0, E = E + Math.imul(Le, gt) | 0, v = v + Math.imul(Le, Rt) | 0, v = v + Math.imul(qe, gt) | 0, P = P + Math.imul(qe, Rt) | 0, E = E + Math.imul(Me, vt) | 0, v = v + Math.imul(Me, $t) | 0, v = v + Math.imul(Ne, vt) | 0, P = P + Math.imul(Ne, $t) | 0, E = E + Math.imul(De, rt) | 0, v = v + Math.imul(De, Ft) | 0, v = v + Math.imul(Ce, rt) | 0, P = P + Math.imul(Ce, Ft) | 0, E = E + Math.imul(ue, j) | 0, v = v + Math.imul(ue, z) | 0, v = v + Math.imul(ve, j) | 0, P = P + Math.imul(ve, z) | 0, E = E + Math.imul(re, G) | 0, v = v + Math.imul(re, U) | 0, v = v + Math.imul(de, G) | 0, P = P + Math.imul(de, U) | 0, E = E + Math.imul(Q, he) | 0, v = v + Math.imul(Q, xe) | 0, v = v + Math.imul(T, he) | 0, P = P + Math.imul(T, xe) | 0; + _ = (M + (v >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, E = Math.imul(ke, Et), v = Math.imul(ke, er), v = v + Math.imul(Qe, Et) | 0, M = Math.imul(Qe, er), E = E + Math.imul(_e, Dt) | 0, v = v + Math.imul(_e, kt) | 0, v = v + Math.imul(Ze, Dt) | 0, M = M + Math.imul(Ze, kt) | 0, E = E + Math.imul(Le, gt) | 0, v = v + Math.imul(Le, Rt) | 0, v = v + Math.imul(qe, gt) | 0, M = M + Math.imul(qe, Rt) | 0, E = E + Math.imul(Me, vt) | 0, v = v + Math.imul(Me, $t) | 0, v = v + Math.imul(Ne, vt) | 0, M = M + Math.imul(Ne, $t) | 0, E = E + Math.imul(De, rt) | 0, v = v + Math.imul(De, Bt) | 0, v = v + Math.imul(Ce, rt) | 0, M = M + Math.imul(Ce, Bt) | 0, E = E + Math.imul(ue, U) | 0, v = v + Math.imul(ue, z) | 0, v = v + Math.imul(ve, U) | 0, M = M + Math.imul(ve, z) | 0, E = E + Math.imul(re, G) | 0, v = v + Math.imul(re, j) | 0, v = v + Math.imul(pe, G) | 0, M = M + Math.imul(pe, j) | 0, E = E + Math.imul(Q, de) | 0, v = v + Math.imul(Q, xe) | 0, v = v + Math.imul(T, de) | 0, M = M + Math.imul(T, xe) | 0; var ht = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, E = Math.imul(ke, Dt), v = Math.imul(ke, kt), v = v + Math.imul(Qe, Dt) | 0, P = Math.imul(Qe, kt), E = E + Math.imul(_e, gt) | 0, v = v + Math.imul(_e, Rt) | 0, v = v + Math.imul(Ze, gt) | 0, P = P + Math.imul(Ze, Rt) | 0, E = E + Math.imul(Le, vt) | 0, v = v + Math.imul(Le, $t) | 0, v = v + Math.imul(qe, vt) | 0, P = P + Math.imul(qe, $t) | 0, E = E + Math.imul(Me, rt) | 0, v = v + Math.imul(Me, Ft) | 0, v = v + Math.imul(Ne, rt) | 0, P = P + Math.imul(Ne, Ft) | 0, E = E + Math.imul(De, j) | 0, v = v + Math.imul(De, z) | 0, v = v + Math.imul(Ce, j) | 0, P = P + Math.imul(Ce, z) | 0, E = E + Math.imul(ue, G) | 0, v = v + Math.imul(ue, U) | 0, v = v + Math.imul(ve, G) | 0, P = P + Math.imul(ve, U) | 0, E = E + Math.imul(re, he) | 0, v = v + Math.imul(re, xe) | 0, v = v + Math.imul(de, he) | 0, P = P + Math.imul(de, xe) | 0; + _ = (M + (v >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, E = Math.imul(ke, Dt), v = Math.imul(ke, kt), v = v + Math.imul(Qe, Dt) | 0, M = Math.imul(Qe, kt), E = E + Math.imul(_e, gt) | 0, v = v + Math.imul(_e, Rt) | 0, v = v + Math.imul(Ze, gt) | 0, M = M + Math.imul(Ze, Rt) | 0, E = E + Math.imul(Le, vt) | 0, v = v + Math.imul(Le, $t) | 0, v = v + Math.imul(qe, vt) | 0, M = M + Math.imul(qe, $t) | 0, E = E + Math.imul(Me, rt) | 0, v = v + Math.imul(Me, Bt) | 0, v = v + Math.imul(Ne, rt) | 0, M = M + Math.imul(Ne, Bt) | 0, E = E + Math.imul(De, U) | 0, v = v + Math.imul(De, z) | 0, v = v + Math.imul(Ce, U) | 0, M = M + Math.imul(Ce, z) | 0, E = E + Math.imul(ue, G) | 0, v = v + Math.imul(ue, j) | 0, v = v + Math.imul(ve, G) | 0, M = M + Math.imul(ve, j) | 0, E = E + Math.imul(re, de) | 0, v = v + Math.imul(re, xe) | 0, v = v + Math.imul(pe, de) | 0, M = M + Math.imul(pe, xe) | 0; var xt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, E = Math.imul(ke, gt), v = Math.imul(ke, Rt), v = v + Math.imul(Qe, gt) | 0, P = Math.imul(Qe, Rt), E = E + Math.imul(_e, vt) | 0, v = v + Math.imul(_e, $t) | 0, v = v + Math.imul(Ze, vt) | 0, P = P + Math.imul(Ze, $t) | 0, E = E + Math.imul(Le, rt) | 0, v = v + Math.imul(Le, Ft) | 0, v = v + Math.imul(qe, rt) | 0, P = P + Math.imul(qe, Ft) | 0, E = E + Math.imul(Me, j) | 0, v = v + Math.imul(Me, z) | 0, v = v + Math.imul(Ne, j) | 0, P = P + Math.imul(Ne, z) | 0, E = E + Math.imul(De, G) | 0, v = v + Math.imul(De, U) | 0, v = v + Math.imul(Ce, G) | 0, P = P + Math.imul(Ce, U) | 0, E = E + Math.imul(ue, he) | 0, v = v + Math.imul(ue, xe) | 0, v = v + Math.imul(ve, he) | 0, P = P + Math.imul(ve, xe) | 0; + _ = (M + (v >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, E = Math.imul(ke, gt), v = Math.imul(ke, Rt), v = v + Math.imul(Qe, gt) | 0, M = Math.imul(Qe, Rt), E = E + Math.imul(_e, vt) | 0, v = v + Math.imul(_e, $t) | 0, v = v + Math.imul(Ze, vt) | 0, M = M + Math.imul(Ze, $t) | 0, E = E + Math.imul(Le, rt) | 0, v = v + Math.imul(Le, Bt) | 0, v = v + Math.imul(qe, rt) | 0, M = M + Math.imul(qe, Bt) | 0, E = E + Math.imul(Me, U) | 0, v = v + Math.imul(Me, z) | 0, v = v + Math.imul(Ne, U) | 0, M = M + Math.imul(Ne, z) | 0, E = E + Math.imul(De, G) | 0, v = v + Math.imul(De, j) | 0, v = v + Math.imul(Ce, G) | 0, M = M + Math.imul(Ce, j) | 0, E = E + Math.imul(ue, de) | 0, v = v + Math.imul(ue, xe) | 0, v = v + Math.imul(ve, de) | 0, M = M + Math.imul(ve, xe) | 0; var st = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, E = Math.imul(ke, vt), v = Math.imul(ke, $t), v = v + Math.imul(Qe, vt) | 0, P = Math.imul(Qe, $t), E = E + Math.imul(_e, rt) | 0, v = v + Math.imul(_e, Ft) | 0, v = v + Math.imul(Ze, rt) | 0, P = P + Math.imul(Ze, Ft) | 0, E = E + Math.imul(Le, j) | 0, v = v + Math.imul(Le, z) | 0, v = v + Math.imul(qe, j) | 0, P = P + Math.imul(qe, z) | 0, E = E + Math.imul(Me, G) | 0, v = v + Math.imul(Me, U) | 0, v = v + Math.imul(Ne, G) | 0, P = P + Math.imul(Ne, U) | 0, E = E + Math.imul(De, he) | 0, v = v + Math.imul(De, xe) | 0, v = v + Math.imul(Ce, he) | 0, P = P + Math.imul(Ce, xe) | 0; + _ = (M + (v >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, E = Math.imul(ke, vt), v = Math.imul(ke, $t), v = v + Math.imul(Qe, vt) | 0, M = Math.imul(Qe, $t), E = E + Math.imul(_e, rt) | 0, v = v + Math.imul(_e, Bt) | 0, v = v + Math.imul(Ze, rt) | 0, M = M + Math.imul(Ze, Bt) | 0, E = E + Math.imul(Le, U) | 0, v = v + Math.imul(Le, z) | 0, v = v + Math.imul(qe, U) | 0, M = M + Math.imul(qe, z) | 0, E = E + Math.imul(Me, G) | 0, v = v + Math.imul(Me, j) | 0, v = v + Math.imul(Ne, G) | 0, M = M + Math.imul(Ne, j) | 0, E = E + Math.imul(De, de) | 0, v = v + Math.imul(De, xe) | 0, v = v + Math.imul(Ce, de) | 0, M = M + Math.imul(Ce, xe) | 0; var bt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, E = Math.imul(ke, rt), v = Math.imul(ke, Ft), v = v + Math.imul(Qe, rt) | 0, P = Math.imul(Qe, Ft), E = E + Math.imul(_e, j) | 0, v = v + Math.imul(_e, z) | 0, v = v + Math.imul(Ze, j) | 0, P = P + Math.imul(Ze, z) | 0, E = E + Math.imul(Le, G) | 0, v = v + Math.imul(Le, U) | 0, v = v + Math.imul(qe, G) | 0, P = P + Math.imul(qe, U) | 0, E = E + Math.imul(Me, he) | 0, v = v + Math.imul(Me, xe) | 0, v = v + Math.imul(Ne, he) | 0, P = P + Math.imul(Ne, xe) | 0; + _ = (M + (v >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, E = Math.imul(ke, rt), v = Math.imul(ke, Bt), v = v + Math.imul(Qe, rt) | 0, M = Math.imul(Qe, Bt), E = E + Math.imul(_e, U) | 0, v = v + Math.imul(_e, z) | 0, v = v + Math.imul(Ze, U) | 0, M = M + Math.imul(Ze, z) | 0, E = E + Math.imul(Le, G) | 0, v = v + Math.imul(Le, j) | 0, v = v + Math.imul(qe, G) | 0, M = M + Math.imul(qe, j) | 0, E = E + Math.imul(Me, de) | 0, v = v + Math.imul(Me, xe) | 0, v = v + Math.imul(Ne, de) | 0, M = M + Math.imul(Ne, xe) | 0; var ut = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, E = Math.imul(ke, j), v = Math.imul(ke, z), v = v + Math.imul(Qe, j) | 0, P = Math.imul(Qe, z), E = E + Math.imul(_e, G) | 0, v = v + Math.imul(_e, U) | 0, v = v + Math.imul(Ze, G) | 0, P = P + Math.imul(Ze, U) | 0, E = E + Math.imul(Le, he) | 0, v = v + Math.imul(Le, xe) | 0, v = v + Math.imul(qe, he) | 0, P = P + Math.imul(qe, xe) | 0; + _ = (M + (v >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, E = Math.imul(ke, U), v = Math.imul(ke, z), v = v + Math.imul(Qe, U) | 0, M = Math.imul(Qe, z), E = E + Math.imul(_e, G) | 0, v = v + Math.imul(_e, j) | 0, v = v + Math.imul(Ze, G) | 0, M = M + Math.imul(Ze, j) | 0, E = E + Math.imul(Le, de) | 0, v = v + Math.imul(Le, xe) | 0, v = v + Math.imul(qe, de) | 0, M = M + Math.imul(qe, xe) | 0; var ot = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, E = Math.imul(ke, G), v = Math.imul(ke, U), v = v + Math.imul(Qe, G) | 0, P = Math.imul(Qe, U), E = E + Math.imul(_e, he) | 0, v = v + Math.imul(_e, xe) | 0, v = v + Math.imul(Ze, he) | 0, P = P + Math.imul(Ze, xe) | 0; + _ = (M + (v >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, E = Math.imul(ke, G), v = Math.imul(ke, j), v = v + Math.imul(Qe, G) | 0, M = Math.imul(Qe, j), E = E + Math.imul(_e, de) | 0, v = v + Math.imul(_e, xe) | 0, v = v + Math.imul(Ze, de) | 0, M = M + Math.imul(Ze, xe) | 0; var Se = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, E = Math.imul(ke, he), v = Math.imul(ke, xe), v = v + Math.imul(Qe, he) | 0, P = Math.imul(Qe, xe); + _ = (M + (v >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, E = Math.imul(ke, de), v = Math.imul(ke, xe), v = v + Math.imul(Qe, de) | 0, M = Math.imul(Qe, xe); var Ae = (_ + E | 0) + ((v & 8191) << 13) | 0; - return _ = (P + (v >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, x[0] = Te, x[1] = Re, x[2] = nt, x[3] = Ue, x[4] = pt, x[5] = it, x[6] = et, x[7] = St, x[8] = Tt, x[9] = At, x[10] = _t, x[11] = ht, x[12] = xt, x[13] = st, x[14] = bt, x[15] = ut, x[16] = ot, x[17] = Se, x[18] = Ae, _ !== 0 && (x[19] = _, f.length++), f; + return _ = (M + (v >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, x[0] = Te, x[1] = Re, x[2] = nt, x[3] = je, x[4] = pt, x[5] = it, x[6] = et, x[7] = St, x[8] = Tt, x[9] = At, x[10] = _t, x[11] = ht, x[12] = xt, x[13] = st, x[14] = bt, x[15] = ut, x[16] = ot, x[17] = Se, x[18] = Ae, _ !== 0 && (x[19] = _, f.length++), f; }; - Math.imul || (N = M); + Math.imul || (N = P); function L(Y, S, m) { m.negative = S.negative ^ Y.negative, m.length = Y.length + S.length; - for (var f = 0, p = 0, b = 0; b < m.length - 1; b++) { - var x = p; - p = 0; + for (var f = 0, g = 0, b = 0; b < m.length - 1; b++) { + var x = g; + g = 0; for (var _ = f & 67108863, E = Math.min(b, S.length - 1), v = Math.max(0, b - Y.length + 1); v <= E; v++) { - var P = b - v, I = Y.words[P] | 0, B = S.words[v] | 0, ce = I * B, D = ce & 67108863; - x = x + (ce / 67108864 | 0) | 0, D = D + _ | 0, _ = D & 67108863, x = x + (D >>> 26) | 0, p += x >>> 26, x &= 67108863; + var M = b - v, I = Y.words[M] | 0, F = S.words[v] | 0, ce = I * F, D = ce & 67108863; + x = x + (ce / 67108864 | 0) | 0, D = D + _ | 0, _ = D & 67108863, x = x + (D >>> 26) | 0, g += x >>> 26, x &= 67108863; } - m.words[b] = _, f = x, x = p; + m.words[b] = _, f = x, x = g; } return f !== 0 ? m.words[b] = f : m.length--, m.strip(); } function $(Y, S, m) { - var f = new F(); + var f = new B(); return f.mulp(Y, S, m); } s.prototype.mulTo = function(S, m) { - var f, p = this.length + S.length; - return this.length === 10 && S.length === 10 ? f = N(this, S, m) : p < 63 ? f = M(this, S, m) : p < 1024 ? f = L(this, S, m) : f = $(this, S, m), f; + var f, g = this.length + S.length; + return this.length === 10 && S.length === 10 ? f = N(this, S, m) : g < 63 ? f = P(this, S, m) : g < 1024 ? f = L(this, S, m) : f = $(this, S, m), f; }; - function F(Y, S) { + function B(Y, S) { this.x = Y, this.y = S; } - F.prototype.makeRBT = function(S) { - for (var m = new Array(S), f = s.prototype._countBits(S) - 1, p = 0; p < S; p++) - m[p] = this.revBin(p, f, S); + B.prototype.makeRBT = function(S) { + for (var m = new Array(S), f = s.prototype._countBits(S) - 1, g = 0; g < S; g++) + m[g] = this.revBin(g, f, S); return m; - }, F.prototype.revBin = function(S, m, f) { + }, B.prototype.revBin = function(S, m, f) { if (S === 0 || S === f - 1) return S; - for (var p = 0, b = 0; b < m; b++) - p |= (S & 1) << m - b - 1, S >>= 1; - return p; - }, F.prototype.permute = function(S, m, f, p, b, x) { + for (var g = 0, b = 0; b < m; b++) + g |= (S & 1) << m - b - 1, S >>= 1; + return g; + }, B.prototype.permute = function(S, m, f, g, b, x) { for (var _ = 0; _ < x; _++) - p[_] = m[S[_]], b[_] = f[S[_]]; - }, F.prototype.transform = function(S, m, f, p, b, x) { - this.permute(x, S, m, f, p, b); + g[_] = m[S[_]], b[_] = f[S[_]]; + }, B.prototype.transform = function(S, m, f, g, b, x) { + this.permute(x, S, m, f, g, b); for (var _ = 1; _ < b; _ <<= 1) - for (var E = _ << 1, v = Math.cos(2 * Math.PI / E), P = Math.sin(2 * Math.PI / E), I = 0; I < b; I += E) - for (var B = v, ce = P, D = 0; D < _; D++) { - var oe = f[I + D], Z = p[I + D], J = f[I + D + _], Q = p[I + D + _], T = B * J - ce * Q; - Q = B * Q + ce * J, J = T, f[I + D] = oe + J, p[I + D] = Z + Q, f[I + D + _] = oe - J, p[I + D + _] = Z - Q, D !== E && (T = v * B - P * ce, ce = v * ce + P * B, B = T); + for (var E = _ << 1, v = Math.cos(2 * Math.PI / E), M = Math.sin(2 * Math.PI / E), I = 0; I < b; I += E) + for (var F = v, ce = M, D = 0; D < _; D++) { + var oe = f[I + D], Z = g[I + D], J = f[I + D + _], Q = g[I + D + _], T = F * J - ce * Q; + Q = F * Q + ce * J, J = T, f[I + D] = oe + J, g[I + D] = Z + Q, f[I + D + _] = oe - J, g[I + D + _] = Z - Q, D !== E && (T = v * F - M * ce, ce = v * ce + M * F, F = T); } - }, F.prototype.guessLen13b = function(S, m) { - var f = Math.max(m, S) | 1, p = f & 1, b = 0; + }, B.prototype.guessLen13b = function(S, m) { + var f = Math.max(m, S) | 1, g = f & 1, b = 0; for (f = f / 2 | 0; f; f = f >>> 1) b++; - return 1 << b + 1 + p; - }, F.prototype.conjugate = function(S, m, f) { + return 1 << b + 1 + g; + }, B.prototype.conjugate = function(S, m, f) { if (!(f <= 1)) - for (var p = 0; p < f / 2; p++) { - var b = S[p]; - S[p] = S[f - p - 1], S[f - p - 1] = b, b = m[p], m[p] = -m[f - p - 1], m[f - p - 1] = -b; + for (var g = 0; g < f / 2; g++) { + var b = S[g]; + S[g] = S[f - g - 1], S[f - g - 1] = b, b = m[g], m[g] = -m[f - g - 1], m[f - g - 1] = -b; } - }, F.prototype.normalize13b = function(S, m) { - for (var f = 0, p = 0; p < m / 2; p++) { - var b = Math.round(S[2 * p + 1] / m) * 8192 + Math.round(S[2 * p] / m) + f; - S[p] = b & 67108863, b < 67108864 ? f = 0 : f = b / 67108864 | 0; + }, B.prototype.normalize13b = function(S, m) { + for (var f = 0, g = 0; g < m / 2; g++) { + var b = Math.round(S[2 * g + 1] / m) * 8192 + Math.round(S[2 * g] / m) + f; + S[g] = b & 67108863, b < 67108864 ? f = 0 : f = b / 67108864 | 0; } return S; - }, F.prototype.convert13b = function(S, m, f, p) { + }, B.prototype.convert13b = function(S, m, f, g) { for (var b = 0, x = 0; x < m; x++) b = b + (S[x] | 0), f[2 * x] = b & 8191, b = b >>> 13, f[2 * x + 1] = b & 8191, b = b >>> 13; - for (x = 2 * m; x < p; ++x) + for (x = 2 * m; x < g; ++x) f[x] = 0; n(b === 0), n((b & -8192) === 0); - }, F.prototype.stub = function(S) { + }, B.prototype.stub = function(S) { for (var m = new Array(S), f = 0; f < S; f++) m[f] = 0; return m; - }, F.prototype.mulp = function(S, m, f) { - var p = 2 * this.guessLen13b(S.length, m.length), b = this.makeRBT(p), x = this.stub(p), _ = new Array(p), E = new Array(p), v = new Array(p), P = new Array(p), I = new Array(p), B = new Array(p), ce = f.words; - ce.length = p, this.convert13b(S.words, S.length, _, p), this.convert13b(m.words, m.length, P, p), this.transform(_, x, E, v, p, b), this.transform(P, x, I, B, p, b); - for (var D = 0; D < p; D++) { - var oe = E[D] * I[D] - v[D] * B[D]; - v[D] = E[D] * B[D] + v[D] * I[D], E[D] = oe; - } - return this.conjugate(E, v, p), this.transform(E, v, ce, x, p, b), this.conjugate(ce, x, p), this.normalize13b(ce, p), f.negative = S.negative ^ m.negative, f.length = S.length + m.length, f.strip(); + }, B.prototype.mulp = function(S, m, f) { + var g = 2 * this.guessLen13b(S.length, m.length), b = this.makeRBT(g), x = this.stub(g), _ = new Array(g), E = new Array(g), v = new Array(g), M = new Array(g), I = new Array(g), F = new Array(g), ce = f.words; + ce.length = g, this.convert13b(S.words, S.length, _, g), this.convert13b(m.words, m.length, M, g), this.transform(_, x, E, v, g, b), this.transform(M, x, I, F, g, b); + for (var D = 0; D < g; D++) { + var oe = E[D] * I[D] - v[D] * F[D]; + v[D] = E[D] * F[D] + v[D] * I[D], E[D] = oe; + } + return this.conjugate(E, v, g), this.transform(E, v, ce, x, g, b), this.conjugate(ce, x, g), this.normalize13b(ce, g), f.negative = S.negative ^ m.negative, f.length = S.length + m.length, f.strip(); }, s.prototype.mul = function(S) { var m = new s(null); return m.words = new Array(this.length + S.length), this.mulTo(S, m); @@ -13721,8 +13721,8 @@ Xv.exports; }, s.prototype.imuln = function(S) { n(typeof S == "number"), n(S < 67108864); for (var m = 0, f = 0; f < this.length; f++) { - var p = (this.words[f] | 0) * S, b = (p & 67108863) + (m & 67108863); - m >>= 26, m += p / 67108864 | 0, m += b >>> 26, this.words[f] = b & 67108863; + var g = (this.words[f] | 0) * S, b = (g & 67108863) + (m & 67108863); + m >>= 26, m += g / 67108864 | 0, m += b >>> 26, this.words[f] = b & 67108863; } return m !== 0 && (this.words[f] = m, this.length++), this; }, s.prototype.muln = function(S) { @@ -13734,19 +13734,19 @@ Xv.exports; }, s.prototype.pow = function(S) { var m = A(S); if (m.length === 0) return new s(1); - for (var f = this, p = 0; p < m.length && m[p] === 0; p++, f = f.sqr()) + for (var f = this, g = 0; g < m.length && m[g] === 0; g++, f = f.sqr()) ; - if (++p < m.length) - for (var b = f.sqr(); p < m.length; p++, b = b.sqr()) - m[p] !== 0 && (f = f.mul(b)); + if (++g < m.length) + for (var b = f.sqr(); g < m.length; g++, b = b.sqr()) + m[g] !== 0 && (f = f.mul(b)); return f; }, s.prototype.iushln = function(S) { n(typeof S == "number" && S >= 0); - var m = S % 26, f = (S - m) / 26, p = 67108863 >>> 26 - m << 26 - m, b; + var m = S % 26, f = (S - m) / 26, g = 67108863 >>> 26 - m << 26 - m, b; if (m !== 0) { var x = 0; for (b = 0; b < this.length; b++) { - var _ = this.words[b] & p, E = (this.words[b] | 0) - _ << m; + var _ = this.words[b] & g, E = (this.words[b] | 0) - _ << m; this.words[b] = E | x, x = _ >>> 26 - m; } x && (this.words[b] = x, this.length++); @@ -13763,10 +13763,10 @@ Xv.exports; return n(this.negative === 0), this.iushln(S); }, s.prototype.iushrn = function(S, m, f) { n(typeof S == "number" && S >= 0); - var p; - m ? p = (m - m % 26) / 26 : p = 0; + var g; + m ? g = (m - m % 26) / 26 : g = 0; var b = S % 26, x = Math.min((S - b) / 26, this.length), _ = 67108863 ^ 67108863 >>> b << b, E = f; - if (p -= x, p = Math.max(0, p), E) { + if (g -= x, g = Math.max(0, g), E) { for (var v = 0; v < x; v++) E.words[v] = this.words[v]; E.length = x; @@ -13776,12 +13776,12 @@ Xv.exports; this.words[v] = this.words[v + x]; else this.words[0] = 0, this.length = 1; - var P = 0; - for (v = this.length - 1; v >= 0 && (P !== 0 || v >= p); v--) { + var M = 0; + for (v = this.length - 1; v >= 0 && (M !== 0 || v >= g); v--) { var I = this.words[v] | 0; - this.words[v] = P << 26 - b | I >>> b, P = I & _; + this.words[v] = M << 26 - b | I >>> b, M = I & _; } - return E && P !== 0 && (E.words[E.length++] = P), this.length === 0 && (this.words[0] = 0, this.length = 1), this.strip(); + return E && M !== 0 && (E.words[E.length++] = M), this.length === 0 && (this.words[0] = 0, this.length = 1), this.strip(); }, s.prototype.ishrn = function(S, m, f) { return n(this.negative === 0), this.iushrn(S, m, f); }, s.prototype.shln = function(S) { @@ -13794,18 +13794,18 @@ Xv.exports; return this.clone().iushrn(S); }, s.prototype.testn = function(S) { n(typeof S == "number" && S >= 0); - var m = S % 26, f = (S - m) / 26, p = 1 << m; + var m = S % 26, f = (S - m) / 26, g = 1 << m; if (this.length <= f) return !1; var b = this.words[f]; - return !!(b & p); + return !!(b & g); }, s.prototype.imaskn = function(S) { n(typeof S == "number" && S >= 0); var m = S % 26, f = (S - m) / 26; if (n(this.negative === 0, "imaskn works only with positive numbers"), this.length <= f) return this; if (m !== 0 && f++, this.length = Math.min(f, this.length), m !== 0) { - var p = 67108863 ^ 67108863 >>> m << m; - this.words[this.length - 1] &= p; + var g = 67108863 ^ 67108863 >>> m << m; + this.words[this.length - 1] &= g; } return this.strip(); }, s.prototype.maskn = function(S) { @@ -13836,8 +13836,8 @@ Xv.exports; }, s.prototype.abs = function() { return this.clone().iabs(); }, s.prototype._ishlnsubmul = function(S, m, f) { - var p = S.length + f, b; - this._expand(p); + var g = S.length + f, b; + this._expand(g); var x, _ = 0; for (b = 0; b < S.length; b++) { x = (this.words[b + f] | 0) + _; @@ -13851,25 +13851,25 @@ Xv.exports; x = -(this.words[b] | 0) + _, _ = x >> 26, this.words[b] = x & 67108863; return this.negative = 1, this.strip(); }, s.prototype._wordDiv = function(S, m) { - var f = this.length - S.length, p = this.clone(), b = S, x = b.words[b.length - 1] | 0, _ = this._countBits(x); - f = 26 - _, f !== 0 && (b = b.ushln(f), p.iushln(f), x = b.words[b.length - 1] | 0); - var E = p.length - b.length, v; + var f = this.length - S.length, g = this.clone(), b = S, x = b.words[b.length - 1] | 0, _ = this._countBits(x); + f = 26 - _, f !== 0 && (b = b.ushln(f), g.iushln(f), x = b.words[b.length - 1] | 0); + var E = g.length - b.length, v; if (m !== "mod") { v = new s(null), v.length = E + 1, v.words = new Array(v.length); - for (var P = 0; P < v.length; P++) - v.words[P] = 0; - } - var I = p.clone()._ishlnsubmul(b, 1, E); - I.negative === 0 && (p = I, v && (v.words[E] = 1)); - for (var B = E - 1; B >= 0; B--) { - var ce = (p.words[b.length + B] | 0) * 67108864 + (p.words[b.length + B - 1] | 0); - for (ce = Math.min(ce / x | 0, 67108863), p._ishlnsubmul(b, ce, B); p.negative !== 0; ) - ce--, p.negative = 0, p._ishlnsubmul(b, 1, B), p.isZero() || (p.negative ^= 1); - v && (v.words[B] = ce); - } - return v && v.strip(), p.strip(), m !== "div" && f !== 0 && p.iushrn(f), { + for (var M = 0; M < v.length; M++) + v.words[M] = 0; + } + var I = g.clone()._ishlnsubmul(b, 1, E); + I.negative === 0 && (g = I, v && (v.words[E] = 1)); + for (var F = E - 1; F >= 0; F--) { + var ce = (g.words[b.length + F] | 0) * 67108864 + (g.words[b.length + F - 1] | 0); + for (ce = Math.min(ce / x | 0, 67108863), g._ishlnsubmul(b, ce, F); g.negative !== 0; ) + ce--, g.negative = 0, g._ishlnsubmul(b, 1, F), g.isZero() || (g.negative ^= 1); + v && (v.words[F] = ce); + } + return v && v.strip(), g.strip(), m !== "div" && f !== 0 && g.iushrn(f), { div: v || null, - mod: p + mod: g }; }, s.prototype.divmod = function(S, m, f) { if (n(!S.isZero()), this.isZero()) @@ -13877,12 +13877,12 @@ Xv.exports; div: new s(0), mod: new s(0) }; - var p, b, x; - return this.negative !== 0 && S.negative === 0 ? (x = this.neg().divmod(S, m), m !== "mod" && (p = x.div.neg()), m !== "div" && (b = x.mod.neg(), f && b.negative !== 0 && b.iadd(S)), { - div: p, + var g, b, x; + return this.negative !== 0 && S.negative === 0 ? (x = this.neg().divmod(S, m), m !== "mod" && (g = x.div.neg()), m !== "div" && (b = x.mod.neg(), f && b.negative !== 0 && b.iadd(S)), { + div: g, mod: b - }) : this.negative === 0 && S.negative !== 0 ? (x = this.divmod(S.neg(), m), m !== "mod" && (p = x.div.neg()), { - div: p, + }) : this.negative === 0 && S.negative !== 0 ? (x = this.divmod(S.neg(), m), m !== "mod" && (g = x.div.neg()), { + div: g, mod: x.mod }) : this.negative & S.negative ? (x = this.neg().divmod(S.neg(), m), m !== "div" && (b = x.mod.neg(), f && b.negative !== 0 && b.isub(S)), { div: x.div, @@ -13909,18 +13909,18 @@ Xv.exports; }, s.prototype.divRound = function(S) { var m = this.divmod(S); if (m.mod.isZero()) return m.div; - var f = m.div.negative !== 0 ? m.mod.isub(S) : m.mod, p = S.ushrn(1), b = S.andln(1), x = f.cmp(p); + var f = m.div.negative !== 0 ? m.mod.isub(S) : m.mod, g = S.ushrn(1), b = S.andln(1), x = f.cmp(g); return x < 0 || b === 1 && x === 0 ? m.div : m.div.negative !== 0 ? m.div.isubn(1) : m.div.iaddn(1); }, s.prototype.modn = function(S) { n(S <= 67108863); - for (var m = (1 << 26) % S, f = 0, p = this.length - 1; p >= 0; p--) - f = (m * f + (this.words[p] | 0)) % S; + for (var m = (1 << 26) % S, f = 0, g = this.length - 1; g >= 0; g--) + f = (m * f + (this.words[g] | 0)) % S; return f; }, s.prototype.idivn = function(S) { n(S <= 67108863); for (var m = 0, f = this.length - 1; f >= 0; f--) { - var p = (this.words[f] | 0) + m * 67108864; - this.words[f] = p / S | 0, m = p % S; + var g = (this.words[f] | 0) + m * 67108864; + this.words[f] = g / S | 0, m = g % S; } return this.strip(); }, s.prototype.divn = function(S) { @@ -13929,18 +13929,18 @@ Xv.exports; n(S.negative === 0), n(!S.isZero()); var m = this, f = S.clone(); m.negative !== 0 ? m = m.umod(S) : m = m.clone(); - for (var p = new s(1), b = new s(0), x = new s(0), _ = new s(1), E = 0; m.isEven() && f.isEven(); ) + for (var g = new s(1), b = new s(0), x = new s(0), _ = new s(1), E = 0; m.isEven() && f.isEven(); ) m.iushrn(1), f.iushrn(1), ++E; - for (var v = f.clone(), P = m.clone(); !m.isZero(); ) { - for (var I = 0, B = 1; !(m.words[0] & B) && I < 26; ++I, B <<= 1) ; + for (var v = f.clone(), M = m.clone(); !m.isZero(); ) { + for (var I = 0, F = 1; !(m.words[0] & F) && I < 26; ++I, F <<= 1) ; if (I > 0) for (m.iushrn(I); I-- > 0; ) - (p.isOdd() || b.isOdd()) && (p.iadd(v), b.isub(P)), p.iushrn(1), b.iushrn(1); + (g.isOdd() || b.isOdd()) && (g.iadd(v), b.isub(M)), g.iushrn(1), b.iushrn(1); for (var ce = 0, D = 1; !(f.words[0] & D) && ce < 26; ++ce, D <<= 1) ; if (ce > 0) for (f.iushrn(ce); ce-- > 0; ) - (x.isOdd() || _.isOdd()) && (x.iadd(v), _.isub(P)), x.iushrn(1), _.iushrn(1); - m.cmp(f) >= 0 ? (m.isub(f), p.isub(x), b.isub(_)) : (f.isub(m), x.isub(p), _.isub(b)); + (x.isOdd() || _.isOdd()) && (x.iadd(v), _.isub(M)), x.iushrn(1), _.iushrn(1); + m.cmp(f) >= 0 ? (m.isub(f), g.isub(x), b.isub(_)) : (f.isub(m), x.isub(g), _.isub(b)); } return { a: x, @@ -13951,25 +13951,25 @@ Xv.exports; n(S.negative === 0), n(!S.isZero()); var m = this, f = S.clone(); m.negative !== 0 ? m = m.umod(S) : m = m.clone(); - for (var p = new s(1), b = new s(0), x = f.clone(); m.cmpn(1) > 0 && f.cmpn(1) > 0; ) { + for (var g = new s(1), b = new s(0), x = f.clone(); m.cmpn(1) > 0 && f.cmpn(1) > 0; ) { for (var _ = 0, E = 1; !(m.words[0] & E) && _ < 26; ++_, E <<= 1) ; if (_ > 0) for (m.iushrn(_); _-- > 0; ) - p.isOdd() && p.iadd(x), p.iushrn(1); - for (var v = 0, P = 1; !(f.words[0] & P) && v < 26; ++v, P <<= 1) ; + g.isOdd() && g.iadd(x), g.iushrn(1); + for (var v = 0, M = 1; !(f.words[0] & M) && v < 26; ++v, M <<= 1) ; if (v > 0) for (f.iushrn(v); v-- > 0; ) b.isOdd() && b.iadd(x), b.iushrn(1); - m.cmp(f) >= 0 ? (m.isub(f), p.isub(b)) : (f.isub(m), b.isub(p)); + m.cmp(f) >= 0 ? (m.isub(f), g.isub(b)) : (f.isub(m), b.isub(g)); } var I; - return m.cmpn(1) === 0 ? I = p : I = b, I.cmpn(0) < 0 && I.iadd(S), I; + return m.cmpn(1) === 0 ? I = g : I = b, I.cmpn(0) < 0 && I.iadd(S), I; }, s.prototype.gcd = function(S) { if (this.isZero()) return S.abs(); if (S.isZero()) return this.abs(); var m = this.clone(), f = S.clone(); m.negative = 0, f.negative = 0; - for (var p = 0; m.isEven() && f.isEven(); p++) + for (var g = 0; m.isEven() && f.isEven(); g++) m.iushrn(1), f.iushrn(1); do { for (; m.isEven(); ) @@ -13984,7 +13984,7 @@ Xv.exports; break; m.isub(f); } while (!0); - return f.iushln(p); + return f.iushln(g); }, s.prototype.invm = function(S) { return this.egcd(S).a.umod(S); }, s.prototype.isEven = function() { @@ -13995,10 +13995,10 @@ Xv.exports; return this.words[0] & S; }, s.prototype.bincn = function(S) { n(typeof S == "number"); - var m = S % 26, f = (S - m) / 26, p = 1 << m; + var m = S % 26, f = (S - m) / 26, g = 1 << m; if (this.length <= f) - return this._expand(f + 1), this.words[f] |= p, this; - for (var b = p, x = f; b !== 0 && x < this.length; x++) { + return this._expand(f + 1), this.words[f] |= g, this; + for (var b = g, x = f; b !== 0 && x < this.length; x++) { var _ = this.words[x] | 0; _ += b, b = _ >>> 26, _ &= 67108863, this.words[x] = _; } @@ -14015,8 +14015,8 @@ Xv.exports; f = 1; else { m && (S = -S), n(S <= 67108863, "Number is too big"); - var p = this.words[0] | 0; - f = p === S ? 0 : p < S ? -1 : 1; + var g = this.words[0] | 0; + f = g === S ? 0 : g < S ? -1 : 1; } return this.negative !== 0 ? -f | 0 : f; }, s.prototype.cmp = function(S) { @@ -14028,9 +14028,9 @@ Xv.exports; if (this.length > S.length) return 1; if (this.length < S.length) return -1; for (var m = 0, f = this.length - 1; f >= 0; f--) { - var p = this.words[f] | 0, b = S.words[f] | 0; - if (p !== b) { - p < b ? m = -1 : p > b && (m = 1); + var g = this.words[f] | 0, b = S.words[f] | 0; + if (g !== b) { + g < b ? m = -1 : g > b && (m = 1); break; } } @@ -14056,7 +14056,7 @@ Xv.exports; }, s.prototype.eq = function(S) { return this.cmp(S) === 0; }, s.red = function(S) { - return new pe(S); + return new ge(S); }, s.prototype.toRed = function(S) { return n(!this.red, "Already a number in reduction context"), n(this.negative === 0, "red works only with positives"), S.convertTo(this)._forceRed(S); }, s.prototype.fromRed = function() { @@ -14092,41 +14092,41 @@ Xv.exports; }, s.prototype.redPow = function(S) { return n(this.red && !S.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, S); }; - var K = { + var H = { k256: null, p224: null, p192: null, p25519: null }; - function H(Y, S) { + function W(Y, S) { this.name = Y, this.p = new s(S, 16), this.n = this.p.bitLength(), this.k = new s(1).iushln(this.n).isub(this.p), this.tmp = this._tmp(); } - H.prototype._tmp = function() { + W.prototype._tmp = function() { var S = new s(null); return S.words = new Array(Math.ceil(this.n / 13)), S; - }, H.prototype.ireduce = function(S) { + }, W.prototype.ireduce = function(S) { var m = S, f; do this.split(m, this.tmp), m = this.imulK(m), m = m.iadd(this.tmp), f = m.bitLength(); while (f > this.n); - var p = f < this.n ? -1 : m.ucmp(this.p); - return p === 0 ? (m.words[0] = 0, m.length = 1) : p > 0 ? m.isub(this.p) : m.strip !== void 0 ? m.strip() : m._strip(), m; - }, H.prototype.split = function(S, m) { + var g = f < this.n ? -1 : m.ucmp(this.p); + return g === 0 ? (m.words[0] = 0, m.length = 1) : g > 0 ? m.isub(this.p) : m.strip !== void 0 ? m.strip() : m._strip(), m; + }, W.prototype.split = function(S, m) { S.iushrn(this.n, 0, m); - }, H.prototype.imulK = function(S) { + }, W.prototype.imulK = function(S) { return S.imul(this.k); }; function V() { - H.call( + W.call( this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f" ); } - i(V, H), V.prototype.split = function(S, m) { - for (var f = 4194303, p = Math.min(S.length, 9), b = 0; b < p; b++) + i(V, W), V.prototype.split = function(S, m) { + for (var f = 4194303, g = Math.min(S.length, 9), b = 0; b < g; b++) m.words[b] = S.words[b]; - if (m.length = p, S.length <= 9) { + if (m.length = g, S.length <= 9) { S.words[0] = 0, S.length = 1; return; } @@ -14139,42 +14139,42 @@ Xv.exports; }, V.prototype.imulK = function(S) { S.words[S.length] = 0, S.words[S.length + 1] = 0, S.length += 2; for (var m = 0, f = 0; f < S.length; f++) { - var p = S.words[f] | 0; - m += p * 977, S.words[f] = m & 67108863, m = p * 64 + (m / 67108864 | 0); + var g = S.words[f] | 0; + m += g * 977, S.words[f] = m & 67108863, m = g * 64 + (m / 67108864 | 0); } return S.words[S.length - 1] === 0 && (S.length--, S.words[S.length - 1] === 0 && S.length--), S; }; function te() { - H.call( + W.call( this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001" ); } - i(te, H); + i(te, W); function R() { - H.call( + W.call( this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff" ); } - i(R, H); - function W() { - H.call( + i(R, W); + function K() { + W.call( this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed" ); } - i(W, H), W.prototype.imulK = function(S) { + i(K, W), K.prototype.imulK = function(S) { for (var m = 0, f = 0; f < S.length; f++) { - var p = (S.words[f] | 0) * 19 + m, b = p & 67108863; - p >>>= 26, S.words[f] = b, m = p; + var g = (S.words[f] | 0) * 19 + m, b = g & 67108863; + g >>>= 26, S.words[f] = b, m = g; } return m !== 0 && (S.words[S.length++] = m), S; }, s._prime = function(S) { - if (K[S]) return K[S]; + if (H[S]) return H[S]; var m; if (S === "k256") m = new V(); @@ -14183,112 +14183,112 @@ Xv.exports; else if (S === "p192") m = new R(); else if (S === "p25519") - m = new W(); + m = new K(); else throw new Error("Unknown prime " + S); - return K[S] = m, m; + return H[S] = m, m; }; - function pe(Y) { + function ge(Y) { if (typeof Y == "string") { var S = s._prime(Y); this.m = S.p, this.prime = S; } else n(Y.gtn(1), "modulus must be greater than 1"), this.m = Y, this.prime = null; } - pe.prototype._verify1 = function(S) { + ge.prototype._verify1 = function(S) { n(S.negative === 0, "red works only with positives"), n(S.red, "red works only with red numbers"); - }, pe.prototype._verify2 = function(S, m) { + }, ge.prototype._verify2 = function(S, m) { n((S.negative | m.negative) === 0, "red works only with positives"), n( S.red && S.red === m.red, "red works only with red numbers" ); - }, pe.prototype.imod = function(S) { + }, ge.prototype.imod = function(S) { return this.prime ? this.prime.ireduce(S)._forceRed(this) : S.umod(this.m)._forceRed(this); - }, pe.prototype.neg = function(S) { + }, ge.prototype.neg = function(S) { return S.isZero() ? S.clone() : this.m.sub(S)._forceRed(this); - }, pe.prototype.add = function(S, m) { + }, ge.prototype.add = function(S, m) { this._verify2(S, m); var f = S.add(m); return f.cmp(this.m) >= 0 && f.isub(this.m), f._forceRed(this); - }, pe.prototype.iadd = function(S, m) { + }, ge.prototype.iadd = function(S, m) { this._verify2(S, m); var f = S.iadd(m); return f.cmp(this.m) >= 0 && f.isub(this.m), f; - }, pe.prototype.sub = function(S, m) { + }, ge.prototype.sub = function(S, m) { this._verify2(S, m); var f = S.sub(m); return f.cmpn(0) < 0 && f.iadd(this.m), f._forceRed(this); - }, pe.prototype.isub = function(S, m) { + }, ge.prototype.isub = function(S, m) { this._verify2(S, m); var f = S.isub(m); return f.cmpn(0) < 0 && f.iadd(this.m), f; - }, pe.prototype.shl = function(S, m) { + }, ge.prototype.shl = function(S, m) { return this._verify1(S), this.imod(S.ushln(m)); - }, pe.prototype.imul = function(S, m) { + }, ge.prototype.imul = function(S, m) { return this._verify2(S, m), this.imod(S.imul(m)); - }, pe.prototype.mul = function(S, m) { + }, ge.prototype.mul = function(S, m) { return this._verify2(S, m), this.imod(S.mul(m)); - }, pe.prototype.isqr = function(S) { + }, ge.prototype.isqr = function(S) { return this.imul(S, S.clone()); - }, pe.prototype.sqr = function(S) { + }, ge.prototype.sqr = function(S) { return this.mul(S, S); - }, pe.prototype.sqrt = function(S) { + }, ge.prototype.sqrt = function(S) { if (S.isZero()) return S.clone(); var m = this.m.andln(3); if (n(m % 2 === 1), m === 3) { var f = this.m.add(new s(1)).iushrn(2); return this.pow(S, f); } - for (var p = this.m.subn(1), b = 0; !p.isZero() && p.andln(1) === 0; ) - b++, p.iushrn(1); - n(!p.isZero()); + for (var g = this.m.subn(1), b = 0; !g.isZero() && g.andln(1) === 0; ) + b++, g.iushrn(1); + n(!g.isZero()); var x = new s(1).toRed(this), _ = x.redNeg(), E = this.m.subn(1).iushrn(1), v = this.m.bitLength(); for (v = new s(2 * v * v).toRed(this); this.pow(v, E).cmp(_) !== 0; ) v.redIAdd(_); - for (var P = this.pow(v, p), I = this.pow(S, p.addn(1).iushrn(1)), B = this.pow(S, p), ce = b; B.cmp(x) !== 0; ) { - for (var D = B, oe = 0; D.cmp(x) !== 0; oe++) + for (var M = this.pow(v, g), I = this.pow(S, g.addn(1).iushrn(1)), F = this.pow(S, g), ce = b; F.cmp(x) !== 0; ) { + for (var D = F, oe = 0; D.cmp(x) !== 0; oe++) D = D.redSqr(); n(oe < ce); - var Z = this.pow(P, new s(1).iushln(ce - oe - 1)); - I = I.redMul(Z), P = Z.redSqr(), B = B.redMul(P), ce = oe; + var Z = this.pow(M, new s(1).iushln(ce - oe - 1)); + I = I.redMul(Z), M = Z.redSqr(), F = F.redMul(M), ce = oe; } return I; - }, pe.prototype.invm = function(S) { + }, ge.prototype.invm = function(S) { var m = S._invmp(this.m); return m.negative !== 0 ? (m.negative = 0, this.imod(m).redNeg()) : this.imod(m); - }, pe.prototype.pow = function(S, m) { + }, ge.prototype.pow = function(S, m) { if (m.isZero()) return new s(1).toRed(this); if (m.cmpn(1) === 0) return S.clone(); - var f = 4, p = new Array(1 << f); - p[0] = new s(1).toRed(this), p[1] = S; - for (var b = 2; b < p.length; b++) - p[b] = this.mul(p[b - 1], S); - var x = p[0], _ = 0, E = 0, v = m.bitLength() % 26; + var f = 4, g = new Array(1 << f); + g[0] = new s(1).toRed(this), g[1] = S; + for (var b = 2; b < g.length; b++) + g[b] = this.mul(g[b - 1], S); + var x = g[0], _ = 0, E = 0, v = m.bitLength() % 26; for (v === 0 && (v = 26), b = m.length - 1; b >= 0; b--) { - for (var P = m.words[b], I = v - 1; I >= 0; I--) { - var B = P >> I & 1; - if (x !== p[0] && (x = this.sqr(x)), B === 0 && _ === 0) { + for (var M = m.words[b], I = v - 1; I >= 0; I--) { + var F = M >> I & 1; + if (x !== g[0] && (x = this.sqr(x)), F === 0 && _ === 0) { E = 0; continue; } - _ <<= 1, _ |= B, E++, !(E !== f && (b !== 0 || I !== 0)) && (x = this.mul(x, p[_]), E = 0, _ = 0); + _ <<= 1, _ |= F, E++, !(E !== f && (b !== 0 || I !== 0)) && (x = this.mul(x, g[_]), E = 0, _ = 0); } v = 26; } return x; - }, pe.prototype.convertTo = function(S) { + }, ge.prototype.convertTo = function(S) { var m = S.umod(this.m); return m === S ? m.clone() : m; - }, pe.prototype.convertFrom = function(S) { + }, ge.prototype.convertFrom = function(S) { var m = S.clone(); return m.red = null, m; }, s.mont = function(S) { return new Ee(S); }; function Ee(Y) { - pe.call(this, Y), this.shift = this.m.bitLength(), this.shift % 26 !== 0 && (this.shift += 26 - this.shift % 26), this.r = new s(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this.rinv = this.r._invmp(this.m), this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv = this.minv.umod(this.r), this.minv = this.r.sub(this.minv); + ge.call(this, Y), this.shift = this.m.bitLength(), this.shift % 26 !== 0 && (this.shift += 26 - this.shift % 26), this.r = new s(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this.rinv = this.r._invmp(this.m), this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv = this.minv.umod(this.r), this.minv = this.r.sub(this.minv); } - i(Ee, pe), Ee.prototype.convertTo = function(S) { + i(Ee, ge), Ee.prototype.convertTo = function(S) { return this.imod(S.ushln(this.shift)); }, Ee.prototype.convertFrom = function(S) { var m = this.imod(S.mul(this.rinv)); @@ -14296,11 +14296,11 @@ Xv.exports; }, Ee.prototype.imul = function(S, m) { if (S.isZero() || m.isZero()) return S.words[0] = 0, S.length = 1, S; - var f = S.imul(m), p = f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), b = f.isub(p).iushrn(this.shift), x = b; + var f = S.imul(m), g = f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), b = f.isub(g).iushrn(this.shift), x = b; return b.cmp(this.m) >= 0 ? x = b.isub(this.m) : b.cmpn(0) < 0 && (x = b.iadd(this.m)), x._forceRed(this); }, Ee.prototype.mul = function(S, m) { if (S.isZero() || m.isZero()) return new s(0)._forceRed(this); - var f = S.mul(m), p = f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), b = f.isub(p).iushrn(this.shift), x = b; + var f = S.mul(m), g = f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), b = f.isub(g).iushrn(this.shift), x = b; return b.cmp(this.m) >= 0 ? x = b.isub(this.m) : b.cmpn(0) < 0 && (x = b.iadd(this.m)), x._forceRed(this); }, Ee.prototype.invm = function(S) { var m = this.imod(S._invmp(this.m).mul(this.r2)); @@ -14308,7 +14308,7 @@ Xv.exports; }; })(t, gn); })(Xv); -var qo = Xv.exports, Zv = {}; +var Ho = Xv.exports, Zv = {}; (function(t) { var e = t; function r(s, o) { @@ -14328,8 +14328,8 @@ var qo = Xv.exports, Zv = {}; a.push(parseInt(s[u] + s[u + 1], 16)); } else for (var u = 0; u < s.length; u++) { - var l = s.charCodeAt(u), d = l >> 8, g = l & 255; - d ? a.push(d, g) : a.push(g); + var l = s.charCodeAt(u), d = l >> 8, p = l & 255; + d ? a.push(d, p) : a.push(p); } return a; } @@ -14348,40 +14348,40 @@ var qo = Xv.exports, Zv = {}; }; })(Zv); (function(t) { - var e = t, r = qo, n = yc, i = Zv; + var e = t, r = Ho, n = wc, i = Zv; e.assert = n, e.toArray = i.toArray, e.zero2 = i.zero2, e.toHex = i.toHex, e.encode = i.encode; - function s(d, g, w) { - var A = new Array(Math.max(d.bitLength(), w) + 1), M; - for (M = 0; M < A.length; M += 1) - A[M] = 0; - var N = 1 << g + 1, L = d.clone(); - for (M = 0; M < A.length; M++) { - var $, F = L.andln(N - 1); - L.isOdd() ? (F > (N >> 1) - 1 ? $ = (N >> 1) - F : $ = F, L.isubn($)) : $ = 0, A[M] = $, L.iushrn(1); + function s(d, p, w) { + var A = new Array(Math.max(d.bitLength(), w) + 1), P; + for (P = 0; P < A.length; P += 1) + A[P] = 0; + var N = 1 << p + 1, L = d.clone(); + for (P = 0; P < A.length; P++) { + var $, B = L.andln(N - 1); + L.isOdd() ? (B > (N >> 1) - 1 ? $ = (N >> 1) - B : $ = B, L.isubn($)) : $ = 0, A[P] = $, L.iushrn(1); } return A; } e.getNAF = s; - function o(d, g) { + function o(d, p) { var w = [ [], [] ]; - d = d.clone(), g = g.clone(); - for (var A = 0, M = 0, N; d.cmpn(-A) > 0 || g.cmpn(-M) > 0; ) { - var L = d.andln(3) + A & 3, $ = g.andln(3) + M & 3; + d = d.clone(), p = p.clone(); + for (var A = 0, P = 0, N; d.cmpn(-A) > 0 || p.cmpn(-P) > 0; ) { + var L = d.andln(3) + A & 3, $ = p.andln(3) + P & 3; L === 3 && (L = -1), $ === 3 && ($ = -1); - var F; - L & 1 ? (N = d.andln(7) + A & 7, (N === 3 || N === 5) && $ === 2 ? F = -L : F = L) : F = 0, w[0].push(F); - var K; - $ & 1 ? (N = g.andln(7) + M & 7, (N === 3 || N === 5) && L === 2 ? K = -$ : K = $) : K = 0, w[1].push(K), 2 * A === F + 1 && (A = 1 - A), 2 * M === K + 1 && (M = 1 - M), d.iushrn(1), g.iushrn(1); + var B; + L & 1 ? (N = d.andln(7) + A & 7, (N === 3 || N === 5) && $ === 2 ? B = -L : B = L) : B = 0, w[0].push(B); + var H; + $ & 1 ? (N = p.andln(7) + P & 7, (N === 3 || N === 5) && L === 2 ? H = -$ : H = $) : H = 0, w[1].push(H), 2 * A === B + 1 && (A = 1 - A), 2 * P === H + 1 && (P = 1 - P), d.iushrn(1), p.iushrn(1); } return w; } e.getJSF = o; - function a(d, g, w) { - var A = "_" + g; - d.prototype[g] = function() { + function a(d, p, w) { + var A = "_" + p; + d.prototype[p] = function() { return this[A] !== void 0 ? this[A] : this[A] = w.call(this); }; } @@ -14397,16 +14397,16 @@ var qo = Xv.exports, Zv = {}; })(Fi); var Qv = { exports: {} }, am; Qv.exports = function(e) { - return am || (am = new fa(null)), am.generate(e); + return am || (am = new da(null)), am.generate(e); }; -function fa(t) { +function da(t) { this.rand = t; } -Qv.exports.Rand = fa; -fa.prototype.generate = function(e) { +Qv.exports.Rand = da; +da.prototype.generate = function(e) { return this._rand(e); }; -fa.prototype._rand = function(e) { +da.prototype._rand = function(e) { if (this.rand.getBytes) return this.rand.getBytes(e); for (var r = new Uint8Array(e), n = 0; n < r.length; n++) @@ -14414,41 +14414,41 @@ fa.prototype._rand = function(e) { return r; }; if (typeof self == "object") - self.crypto && self.crypto.getRandomValues ? fa.prototype._rand = function(e) { + self.crypto && self.crypto.getRandomValues ? da.prototype._rand = function(e) { var r = new Uint8Array(e); return self.crypto.getRandomValues(r), r; - } : self.msCrypto && self.msCrypto.getRandomValues ? fa.prototype._rand = function(e) { + } : self.msCrypto && self.msCrypto.getRandomValues ? da.prototype._rand = function(e) { var r = new Uint8Array(e); return self.msCrypto.getRandomValues(r), r; - } : typeof window == "object" && (fa.prototype._rand = function() { + } : typeof window == "object" && (da.prototype._rand = function() { throw new Error("Not implemented yet"); }); else try { - var Cx = zl; - if (typeof Cx.randomBytes != "function") + var Rx = Wl; + if (typeof Rx.randomBytes != "function") throw new Error("Not supported"); - fa.prototype._rand = function(e) { - return Cx.randomBytes(e); + da.prototype._rand = function(e) { + return Rx.randomBytes(e); }; } catch { } -var _8 = Qv.exports, eb = {}, za = qo, Yl = Fi, i0 = Yl.getNAF, Vj = Yl.getJSF, s0 = Yl.assert; -function Ca(t, e) { - this.type = t, this.p = new za(e.p, 16), this.red = e.prime ? za.red(e.prime) : za.mont(this.p), this.zero = new za(0).toRed(this.red), this.one = new za(1).toRed(this.red), this.two = new za(2).toRed(this.red), this.n = e.n && new za(e.n, 16), this.g = e.g && this.pointFromJSON(e.g, e.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; +var S8 = Qv.exports, eb = {}, Ka = Ho, Jl = Fi, s0 = Jl.getNAF, nq = Jl.getJSF, o0 = Jl.assert; +function Da(t, e) { + this.type = t, this.p = new Ka(e.p, 16), this.red = e.prime ? Ka.red(e.prime) : Ka.mont(this.p), this.zero = new Ka(0).toRed(this.red), this.one = new Ka(1).toRed(this.red), this.two = new Ka(2).toRed(this.red), this.n = e.n && new Ka(e.n, 16), this.g = e.g && this.pointFromJSON(e.g, e.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; var r = this.n && this.p.div(this.n); !r || r.cmpn(100) > 0 ? this.redN = null : (this._maxwellTrick = !0, this.redN = this.n.toRed(this.red)); } -var V0 = Ca; -Ca.prototype.point = function() { +var G0 = Da; +Da.prototype.point = function() { throw new Error("Not implemented"); }; -Ca.prototype.validate = function() { +Da.prototype.validate = function() { throw new Error("Not implemented"); }; -Ca.prototype._fixedNafMul = function(e, r) { - s0(e.precomputed); - var n = e._getDoubles(), i = i0(r, 1, this._bitLength), s = (1 << n.step + 1) - (n.step % 2 === 0 ? 2 : 1); +Da.prototype._fixedNafMul = function(e, r) { + o0(e.precomputed); + var n = e._getDoubles(), i = s0(r, 1, this._bitLength), s = (1 << n.step + 1) - (n.step % 2 === 0 ? 2 : 1); s /= 3; var o = [], a, u; for (a = 0; a < i.length; a += n.step) { @@ -14457,41 +14457,41 @@ Ca.prototype._fixedNafMul = function(e, r) { u = (u << 1) + i[l]; o.push(u); } - for (var d = this.jpoint(null, null, null), g = this.jpoint(null, null, null), w = s; w > 0; w--) { + for (var d = this.jpoint(null, null, null), p = this.jpoint(null, null, null), w = s; w > 0; w--) { for (a = 0; a < o.length; a++) - u = o[a], u === w ? g = g.mixedAdd(n.points[a]) : u === -w && (g = g.mixedAdd(n.points[a].neg())); - d = d.add(g); + u = o[a], u === w ? p = p.mixedAdd(n.points[a]) : u === -w && (p = p.mixedAdd(n.points[a].neg())); + d = d.add(p); } return d.toP(); }; -Ca.prototype._wnafMul = function(e, r) { +Da.prototype._wnafMul = function(e, r) { var n = 4, i = e._getNAFPoints(n); n = i.wnd; - for (var s = i.points, o = i0(r, n, this._bitLength), a = this.jpoint(null, null, null), u = o.length - 1; u >= 0; u--) { + for (var s = i.points, o = s0(r, n, this._bitLength), a = this.jpoint(null, null, null), u = o.length - 1; u >= 0; u--) { for (var l = 0; u >= 0 && o[u] === 0; u--) l++; if (u >= 0 && l++, a = a.dblp(l), u < 0) break; var d = o[u]; - s0(d !== 0), e.type === "affine" ? d > 0 ? a = a.mixedAdd(s[d - 1 >> 1]) : a = a.mixedAdd(s[-d - 1 >> 1].neg()) : d > 0 ? a = a.add(s[d - 1 >> 1]) : a = a.add(s[-d - 1 >> 1].neg()); + o0(d !== 0), e.type === "affine" ? d > 0 ? a = a.mixedAdd(s[d - 1 >> 1]) : a = a.mixedAdd(s[-d - 1 >> 1].neg()) : d > 0 ? a = a.add(s[d - 1 >> 1]) : a = a.add(s[-d - 1 >> 1].neg()); } return e.type === "affine" ? a.toP() : a; }; -Ca.prototype._wnafMulAdd = function(e, r, n, i, s) { - var o = this._wnafT1, a = this._wnafT2, u = this._wnafT3, l = 0, d, g, w; +Da.prototype._wnafMulAdd = function(e, r, n, i, s) { + var o = this._wnafT1, a = this._wnafT2, u = this._wnafT3, l = 0, d, p, w; for (d = 0; d < i; d++) { w = r[d]; var A = w._getNAFPoints(e); o[d] = A.wnd, a[d] = A.points; } for (d = i - 1; d >= 1; d -= 2) { - var M = d - 1, N = d; - if (o[M] !== 1 || o[N] !== 1) { - u[M] = i0(n[M], o[M], this._bitLength), u[N] = i0(n[N], o[N], this._bitLength), l = Math.max(u[M].length, l), l = Math.max(u[N].length, l); + var P = d - 1, N = d; + if (o[P] !== 1 || o[N] !== 1) { + u[P] = s0(n[P], o[P], this._bitLength), u[N] = s0(n[N], o[N], this._bitLength), l = Math.max(u[P].length, l), l = Math.max(u[N].length, l); continue; } var L = [ - r[M], + r[P], /* 1 */ null, /* 3 */ @@ -14500,7 +14500,7 @@ Ca.prototype._wnafMulAdd = function(e, r, n, i, s) { r[N] /* 7 */ ]; - r[M].y.cmp(r[N].y) === 0 ? (L[1] = r[M].add(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())) : r[M].y.cmp(r[N].y.redNeg()) === 0 ? (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].add(r[N].neg())) : (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())); + r[P].y.cmp(r[N].y) === 0 ? (L[1] = r[P].add(r[N]), L[2] = r[P].toJ().mixedAdd(r[N].neg())) : r[P].y.cmp(r[N].y.redNeg()) === 0 ? (L[1] = r[P].toJ().mixedAdd(r[N]), L[2] = r[P].add(r[N].neg())) : (L[1] = r[P].toJ().mixedAdd(r[N]), L[2] = r[P].toJ().mixedAdd(r[N].neg())); var $ = [ -3, /* -1 -1 */ @@ -14520,48 +14520,48 @@ Ca.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 1 0 */ 3 /* 1 1 */ - ], F = Vj(n[M], n[N]); - for (l = Math.max(F[0].length, l), u[M] = new Array(l), u[N] = new Array(l), g = 0; g < l; g++) { - var K = F[0][g] | 0, H = F[1][g] | 0; - u[M][g] = $[(K + 1) * 3 + (H + 1)], u[N][g] = 0, a[M] = L; + ], B = nq(n[P], n[N]); + for (l = Math.max(B[0].length, l), u[P] = new Array(l), u[N] = new Array(l), p = 0; p < l; p++) { + var H = B[0][p] | 0, W = B[1][p] | 0; + u[P][p] = $[(H + 1) * 3 + (W + 1)], u[N][p] = 0, a[P] = L; } } var V = this.jpoint(null, null, null), te = this._wnafT4; for (d = l; d >= 0; d--) { for (var R = 0; d >= 0; ) { - var W = !0; - for (g = 0; g < i; g++) - te[g] = u[g][d] | 0, te[g] !== 0 && (W = !1); - if (!W) + var K = !0; + for (p = 0; p < i; p++) + te[p] = u[p][d] | 0, te[p] !== 0 && (K = !1); + if (!K) break; R++, d--; } if (d >= 0 && R++, V = V.dblp(R), d < 0) break; - for (g = 0; g < i; g++) { - var pe = te[g]; - pe !== 0 && (pe > 0 ? w = a[g][pe - 1 >> 1] : pe < 0 && (w = a[g][-pe - 1 >> 1].neg()), w.type === "affine" ? V = V.mixedAdd(w) : V = V.add(w)); + for (p = 0; p < i; p++) { + var ge = te[p]; + ge !== 0 && (ge > 0 ? w = a[p][ge - 1 >> 1] : ge < 0 && (w = a[p][-ge - 1 >> 1].neg()), w.type === "affine" ? V = V.mixedAdd(w) : V = V.add(w)); } } for (d = 0; d < i; d++) a[d] = null; return s ? V : V.toP(); }; -function ss(t, e) { +function os(t, e) { this.curve = t, this.type = e, this.precomputed = null; } -Ca.BasePoint = ss; -ss.prototype.eq = function() { +Da.BasePoint = os; +os.prototype.eq = function() { throw new Error("Not implemented"); }; -ss.prototype.validate = function() { +os.prototype.validate = function() { return this.curve.validate(this); }; -Ca.prototype.decodePoint = function(e, r) { - e = Yl.toArray(e, r); +Da.prototype.decodePoint = function(e, r) { + e = Jl.toArray(e, r); var n = this.p.byteLength(); if ((e[0] === 4 || e[0] === 6 || e[0] === 7) && e.length - 1 === 2 * n) { - e[0] === 6 ? s0(e[e.length - 1] % 2 === 0) : e[0] === 7 && s0(e[e.length - 1] % 2 === 1); + e[0] === 6 ? o0(e[e.length - 1] % 2 === 0) : e[0] === 7 && o0(e[e.length - 1] % 2 === 1); var i = this.point( e.slice(1, 1 + n), e.slice(1 + n, 1 + 2 * n) @@ -14571,17 +14571,17 @@ Ca.prototype.decodePoint = function(e, r) { return this.pointFromX(e.slice(1, 1 + n), e[0] === 3); throw new Error("Unknown point format"); }; -ss.prototype.encodeCompressed = function(e) { +os.prototype.encodeCompressed = function(e) { return this.encode(e, !0); }; -ss.prototype._encode = function(e) { +os.prototype._encode = function(e) { var r = this.curve.p.byteLength(), n = this.getX().toArray("be", r); return e ? [this.getY().isEven() ? 2 : 3].concat(n) : [4].concat(n, this.getY().toArray("be", r)); }; -ss.prototype.encode = function(e, r) { - return Yl.encode(this._encode(r), e); +os.prototype.encode = function(e, r) { + return Jl.encode(this._encode(r), e); }; -ss.prototype.precompute = function(e) { +os.prototype.precompute = function(e) { if (this.precomputed) return this; var r = { @@ -14591,13 +14591,13 @@ ss.prototype.precompute = function(e) { }; return r.naf = this._getNAFPoints(8), r.doubles = this._getDoubles(4, e), r.beta = this._getBeta(), this.precomputed = r, this; }; -ss.prototype._hasDoubles = function(e) { +os.prototype._hasDoubles = function(e) { if (!this.precomputed) return !1; var r = this.precomputed.doubles; return r ? r.points.length >= Math.ceil((e.bitLength() + 1) / r.step) : !1; }; -ss.prototype._getDoubles = function(e, r) { +os.prototype._getDoubles = function(e, r) { if (this.precomputed && this.precomputed.doubles) return this.precomputed.doubles; for (var n = [this], i = this, s = 0; s < r; s += e) { @@ -14610,7 +14610,7 @@ ss.prototype._getDoubles = function(e, r) { points: n }; }; -ss.prototype._getNAFPoints = function(e) { +os.prototype._getNAFPoints = function(e) { if (this.precomputed && this.precomputed.naf) return this.precomputed.naf; for (var r = [this], n = (1 << e) - 1, i = n === 1 ? null : this.dbl(), s = 1; s < n; s++) @@ -14620,21 +14620,21 @@ ss.prototype._getNAFPoints = function(e) { points: r }; }; -ss.prototype._getBeta = function() { +os.prototype._getBeta = function() { return null; }; -ss.prototype.dblp = function(e) { +os.prototype.dblp = function(e) { for (var r = this, n = 0; n < e; n++) r = r.dbl(); return r; }; -var Gj = Fi, rn = qo, tb = q0, Fu = V0, Yj = Gj.assert; -function os(t) { +var iq = Fi, rn = Ho, tb = z0, Fu = G0, sq = iq.assert; +function as(t) { Fu.call(this, "short", t), this.a = new rn(t.a, 16).toRed(this.red), this.b = new rn(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); } -tb(os, Fu); -var Jj = os; -os.prototype._getEndomorphism = function(e) { +tb(as, Fu); +var oq = as; +as.prototype._getEndomorphism = function(e) { if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { var r, n; if (e.beta) @@ -14647,7 +14647,7 @@ os.prototype._getEndomorphism = function(e) { n = new rn(e.lambda, 16); else { var s = this._getEndoRoots(this.n); - this.g.mul(s[0]).x.cmp(this.g.x.redMul(r)) === 0 ? n = s[0] : (n = s[1], Yj(this.g.mul(n).x.cmp(this.g.x.redMul(r)) === 0)); + this.g.mul(s[0]).x.cmp(this.g.x.redMul(r)) === 0 ? n = s[0] : (n = s[1], sq(this.g.mul(n).x.cmp(this.g.x.redMul(r)) === 0)); } var o; return e.basis ? o = e.basis.map(function(a) { @@ -14662,33 +14662,33 @@ os.prototype._getEndomorphism = function(e) { }; } }; -os.prototype._getEndoRoots = function(e) { +as.prototype._getEndoRoots = function(e) { var r = e === this.p ? this.red : rn.mont(e), n = new rn(2).toRed(r).redInvm(), i = n.redNeg(), s = new rn(3).toRed(r).redNeg().redSqrt().redMul(n), o = i.redAdd(s).fromRed(), a = i.redSub(s).fromRed(); return [o, a]; }; -os.prototype._getEndoBasis = function(e) { - for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new rn(1), o = new rn(0), a = new rn(0), u = new rn(1), l, d, g, w, A, M, N, L = 0, $, F; n.cmpn(0) !== 0; ) { - var K = i.div(n); - $ = i.sub(K.mul(n)), F = a.sub(K.mul(s)); - var H = u.sub(K.mul(o)); - if (!g && $.cmp(r) < 0) - l = N.neg(), d = s, g = $.neg(), w = F; - else if (g && ++L === 2) +as.prototype._getEndoBasis = function(e) { + for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new rn(1), o = new rn(0), a = new rn(0), u = new rn(1), l, d, p, w, A, P, N, L = 0, $, B; n.cmpn(0) !== 0; ) { + var H = i.div(n); + $ = i.sub(H.mul(n)), B = a.sub(H.mul(s)); + var W = u.sub(H.mul(o)); + if (!p && $.cmp(r) < 0) + l = N.neg(), d = s, p = $.neg(), w = B; + else if (p && ++L === 2) break; - N = $, i = n, n = $, a = s, s = F, u = o, o = H; + N = $, i = n, n = $, a = s, s = B, u = o, o = W; } - A = $.neg(), M = F; - var V = g.sqr().add(w.sqr()), te = A.sqr().add(M.sqr()); - return te.cmp(V) >= 0 && (A = l, M = d), g.negative && (g = g.neg(), w = w.neg()), A.negative && (A = A.neg(), M = M.neg()), [ - { a: g, b: w }, - { a: A, b: M } + A = $.neg(), P = B; + var V = p.sqr().add(w.sqr()), te = A.sqr().add(P.sqr()); + return te.cmp(V) >= 0 && (A = l, P = d), p.negative && (p = p.neg(), w = w.neg()), A.negative && (A = A.neg(), P = P.neg()), [ + { a: p, b: w }, + { a: A, b: P } ]; }; -os.prototype._endoSplit = function(e) { - var r = this.endo.basis, n = r[0], i = r[1], s = i.b.mul(e).divRound(this.n), o = n.b.neg().mul(e).divRound(this.n), a = s.mul(n.a), u = o.mul(i.a), l = s.mul(n.b), d = o.mul(i.b), g = e.sub(a).sub(u), w = l.add(d).neg(); - return { k1: g, k2: w }; +as.prototype._endoSplit = function(e) { + var r = this.endo.basis, n = r[0], i = r[1], s = i.b.mul(e).divRound(this.n), o = n.b.neg().mul(e).divRound(this.n), a = s.mul(n.a), u = o.mul(i.a), l = s.mul(n.b), d = o.mul(i.b), p = e.sub(a).sub(u), w = l.add(d).neg(); + return { k1: p, k2: w }; }; -os.prototype.pointFromX = function(e, r) { +as.prototype.pointFromX = function(e, r) { e = new rn(e, 16), e.red || (e = e.toRed(this.red)); var n = e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b), i = n.redSqrt(); if (i.redSqr().redSub(n).cmp(this.zero) !== 0) @@ -14696,32 +14696,32 @@ os.prototype.pointFromX = function(e, r) { var s = i.fromRed().isOdd(); return (r && !s || !r && s) && (i = i.redNeg()), this.point(e, i); }; -os.prototype.validate = function(e) { +as.prototype.validate = function(e) { if (e.inf) return !0; var r = e.x, n = e.y, i = this.a.redMul(r), s = r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b); return n.redSqr().redISub(s).cmpn(0) === 0; }; -os.prototype._endoWnafMulAdd = function(e, r, n) { +as.prototype._endoWnafMulAdd = function(e, r, n) { for (var i = this._endoWnafT1, s = this._endoWnafT2, o = 0; o < e.length; o++) { var a = this._endoSplit(r[o]), u = e[o], l = u._getBeta(); a.k1.negative && (a.k1.ineg(), u = u.neg(!0)), a.k2.negative && (a.k2.ineg(), l = l.neg(!0)), i[o * 2] = u, i[o * 2 + 1] = l, s[o * 2] = a.k1, s[o * 2 + 1] = a.k2; } - for (var d = this._wnafMulAdd(1, i, s, o * 2, n), g = 0; g < o * 2; g++) - i[g] = null, s[g] = null; + for (var d = this._wnafMulAdd(1, i, s, o * 2, n), p = 0; p < o * 2; p++) + i[p] = null, s[p] = null; return d; }; -function kn(t, e, r, n) { +function $n(t, e, r, n) { Fu.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new rn(e, 16), this.y = new rn(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); } -tb(kn, Fu.BasePoint); -os.prototype.point = function(e, r, n) { - return new kn(this, e, r, n); +tb($n, Fu.BasePoint); +as.prototype.point = function(e, r, n) { + return new $n(this, e, r, n); }; -os.prototype.pointFromJSON = function(e, r) { - return kn.fromJSON(this, e, r); +as.prototype.pointFromJSON = function(e, r) { + return $n.fromJSON(this, e, r); }; -kn.prototype._getBeta = function() { +$n.prototype._getBeta = function() { if (this.curve.endo) { var e = this.precomputed; if (e && e.beta) @@ -14746,7 +14746,7 @@ kn.prototype._getBeta = function() { return r; } }; -kn.prototype.toJSON = function() { +$n.prototype.toJSON = function() { return this.precomputed ? [this.x, this.y, this.precomputed && { doubles: this.precomputed.doubles && { step: this.precomputed.doubles.step, @@ -14758,7 +14758,7 @@ kn.prototype.toJSON = function() { } }] : [this.x, this.y]; }; -kn.fromJSON = function(e, r, n) { +$n.fromJSON = function(e, r, n) { typeof r == "string" && (r = JSON.parse(r)); var i = e.point(r[0], r[1], n); if (!r[2]) @@ -14779,13 +14779,13 @@ kn.fromJSON = function(e, r, n) { } }, i; }; -kn.prototype.inspect = function() { +$n.prototype.inspect = function() { return this.isInfinity() ? "" : ""; }; -kn.prototype.isInfinity = function() { +$n.prototype.isInfinity = function() { return this.inf; }; -kn.prototype.add = function(e) { +$n.prototype.add = function(e) { if (this.inf) return e; if (e.inf) @@ -14801,7 +14801,7 @@ kn.prototype.add = function(e) { var n = r.redSqr().redISub(this.x).redISub(e.x), i = r.redMul(this.x.redSub(n)).redISub(this.y); return this.curve.point(n, i); }; -kn.prototype.dbl = function() { +$n.prototype.dbl = function() { if (this.inf) return this; var e = this.y.redAdd(this.y); @@ -14810,27 +14810,27 @@ kn.prototype.dbl = function() { var r = this.curve.a, n = this.x.redSqr(), i = e.redInvm(), s = n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i), o = s.redSqr().redISub(this.x.redAdd(this.x)), a = s.redMul(this.x.redSub(o)).redISub(this.y); return this.curve.point(o, a); }; -kn.prototype.getX = function() { +$n.prototype.getX = function() { return this.x.fromRed(); }; -kn.prototype.getY = function() { +$n.prototype.getY = function() { return this.y.fromRed(); }; -kn.prototype.mul = function(e) { +$n.prototype.mul = function(e) { return e = new rn(e, 16), this.isInfinity() ? this : this._hasDoubles(e) ? this.curve._fixedNafMul(this, e) : this.curve.endo ? this.curve._endoWnafMulAdd([this], [e]) : this.curve._wnafMul(this, e); }; -kn.prototype.mulAdd = function(e, r, n) { +$n.prototype.mulAdd = function(e, r, n) { var i = [this, r], s = [e, n]; return this.curve.endo ? this.curve._endoWnafMulAdd(i, s) : this.curve._wnafMulAdd(1, i, s, 2); }; -kn.prototype.jmulAdd = function(e, r, n) { +$n.prototype.jmulAdd = function(e, r, n) { var i = [this, r], s = [e, n]; return this.curve.endo ? this.curve._endoWnafMulAdd(i, s, !0) : this.curve._wnafMulAdd(1, i, s, 2, !0); }; -kn.prototype.eq = function(e) { +$n.prototype.eq = function(e) { return this === e || this.inf === e.inf && (this.inf || this.x.cmp(e.x) === 0 && this.y.cmp(e.y) === 0); }; -kn.prototype.neg = function(e) { +$n.prototype.neg = function(e) { if (this.inf) return this; var r = this.curve.point(this.x, this.y.redNeg()); @@ -14851,29 +14851,29 @@ kn.prototype.neg = function(e) { } return r; }; -kn.prototype.toJ = function() { +$n.prototype.toJ = function() { if (this.inf) return this.curve.jpoint(null, null, null); var e = this.curve.jpoint(this.x, this.y, this.curve.one); return e; }; -function zn(t, e, r, n) { +function Wn(t, e, r, n) { Fu.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new rn(0)) : (this.x = new rn(e, 16), this.y = new rn(r, 16), this.z = new rn(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; } -tb(zn, Fu.BasePoint); -os.prototype.jpoint = function(e, r, n) { - return new zn(this, e, r, n); +tb(Wn, Fu.BasePoint); +as.prototype.jpoint = function(e, r, n) { + return new Wn(this, e, r, n); }; -zn.prototype.toP = function() { +Wn.prototype.toP = function() { if (this.isInfinity()) return this.curve.point(null, null); var e = this.z.redInvm(), r = e.redSqr(), n = this.x.redMul(r), i = this.y.redMul(r).redMul(e); return this.curve.point(n, i); }; -zn.prototype.neg = function() { +Wn.prototype.neg = function() { return this.curve.jpoint(this.x, this.y.redNeg(), this.z); }; -zn.prototype.add = function(e) { +Wn.prototype.add = function(e) { if (this.isInfinity()) return e; if (e.isInfinity()) @@ -14881,10 +14881,10 @@ zn.prototype.add = function(e) { var r = e.z.redSqr(), n = this.z.redSqr(), i = this.x.redMul(r), s = e.x.redMul(n), o = this.y.redMul(r.redMul(e.z)), a = e.y.redMul(n.redMul(this.z)), u = i.redSub(s), l = o.redSub(a); if (u.cmpn(0) === 0) return l.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var d = u.redSqr(), g = d.redMul(u), w = i.redMul(d), A = l.redSqr().redIAdd(g).redISub(w).redISub(w), M = l.redMul(w.redISub(A)).redISub(o.redMul(g)), N = this.z.redMul(e.z).redMul(u); - return this.curve.jpoint(A, M, N); + var d = u.redSqr(), p = d.redMul(u), w = i.redMul(d), A = l.redSqr().redIAdd(p).redISub(w).redISub(w), P = l.redMul(w.redISub(A)).redISub(o.redMul(p)), N = this.z.redMul(e.z).redMul(u); + return this.curve.jpoint(A, P, N); }; -zn.prototype.mixedAdd = function(e) { +Wn.prototype.mixedAdd = function(e) { if (this.isInfinity()) return e.toJ(); if (e.isInfinity()) @@ -14892,10 +14892,10 @@ zn.prototype.mixedAdd = function(e) { var r = this.z.redSqr(), n = this.x, i = e.x.redMul(r), s = this.y, o = e.y.redMul(r).redMul(this.z), a = n.redSub(i), u = s.redSub(o); if (a.cmpn(0) === 0) return u.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var l = a.redSqr(), d = l.redMul(a), g = n.redMul(l), w = u.redSqr().redIAdd(d).redISub(g).redISub(g), A = u.redMul(g.redISub(w)).redISub(s.redMul(d)), M = this.z.redMul(a); - return this.curve.jpoint(w, A, M); + var l = a.redSqr(), d = l.redMul(a), p = n.redMul(l), w = u.redSqr().redIAdd(d).redISub(p).redISub(p), A = u.redMul(p.redISub(w)).redISub(s.redMul(d)), P = this.z.redMul(a); + return this.curve.jpoint(w, A, P); }; -zn.prototype.dblp = function(e) { +Wn.prototype.dblp = function(e) { if (e === 0) return this; if (this.isInfinity()) @@ -14911,17 +14911,17 @@ zn.prototype.dblp = function(e) { } var i = this.curve.a, s = this.curve.tinv, o = this.x, a = this.y, u = this.z, l = u.redSqr().redSqr(), d = a.redAdd(a); for (r = 0; r < e; r++) { - var g = o.redSqr(), w = d.redSqr(), A = w.redSqr(), M = g.redAdd(g).redIAdd(g).redIAdd(i.redMul(l)), N = o.redMul(w), L = M.redSqr().redISub(N.redAdd(N)), $ = N.redISub(L), F = M.redMul($); - F = F.redIAdd(F).redISub(A); - var K = d.redMul(u); - r + 1 < e && (l = l.redMul(A)), o = L, u = K, d = F; + var p = o.redSqr(), w = d.redSqr(), A = w.redSqr(), P = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), N = o.redMul(w), L = P.redSqr().redISub(N.redAdd(N)), $ = N.redISub(L), B = P.redMul($); + B = B.redIAdd(B).redISub(A); + var H = d.redMul(u); + r + 1 < e && (l = l.redMul(A)), o = L, u = H, d = B; } return this.curve.jpoint(o, d.redMul(s), u); }; -zn.prototype.dbl = function() { +Wn.prototype.dbl = function() { return this.isInfinity() ? this : this.curve.zeroA ? this._zeroDbl() : this.curve.threeA ? this._threeDbl() : this._dbl(); }; -zn.prototype._zeroDbl = function() { +Wn.prototype._zeroDbl = function() { var e, r, n; if (this.zOne) { var i = this.x.redSqr(), s = this.y.redSqr(), o = s.redSqr(), a = this.x.redAdd(s).redSqr().redISub(i).redISub(o); @@ -14929,14 +14929,14 @@ zn.prototype._zeroDbl = function() { var u = i.redAdd(i).redIAdd(i), l = u.redSqr().redISub(a).redISub(a), d = o.redIAdd(o); d = d.redIAdd(d), d = d.redIAdd(d), e = l, r = u.redMul(a.redISub(l)).redISub(d), n = this.y.redAdd(this.y); } else { - var g = this.x.redSqr(), w = this.y.redSqr(), A = w.redSqr(), M = this.x.redAdd(w).redSqr().redISub(g).redISub(A); - M = M.redIAdd(M); - var N = g.redAdd(g).redIAdd(g), L = N.redSqr(), $ = A.redIAdd(A); - $ = $.redIAdd($), $ = $.redIAdd($), e = L.redISub(M).redISub(M), r = N.redMul(M.redISub(e)).redISub($), n = this.y.redMul(this.z), n = n.redIAdd(n); + var p = this.x.redSqr(), w = this.y.redSqr(), A = w.redSqr(), P = this.x.redAdd(w).redSqr().redISub(p).redISub(A); + P = P.redIAdd(P); + var N = p.redAdd(p).redIAdd(p), L = N.redSqr(), $ = A.redIAdd(A); + $ = $.redIAdd($), $ = $.redIAdd($), e = L.redISub(P).redISub(P), r = N.redMul(P.redISub(e)).redISub($), n = this.y.redMul(this.z), n = n.redIAdd(n); } return this.curve.jpoint(e, r, n); }; -zn.prototype._threeDbl = function() { +Wn.prototype._threeDbl = function() { var e, r, n; if (this.zOne) { var i = this.x.redSqr(), s = this.y.redSqr(), o = s.redSqr(), a = this.x.redAdd(s).redSqr().redISub(i).redISub(o); @@ -14946,45 +14946,45 @@ zn.prototype._threeDbl = function() { var d = o.redIAdd(o); d = d.redIAdd(d), d = d.redIAdd(d), r = u.redMul(a.redISub(l)).redISub(d), n = this.y.redAdd(this.y); } else { - var g = this.z.redSqr(), w = this.y.redSqr(), A = this.x.redMul(w), M = this.x.redSub(g).redMul(this.x.redAdd(g)); - M = M.redAdd(M).redIAdd(M); + var p = this.z.redSqr(), w = this.y.redSqr(), A = this.x.redMul(w), P = this.x.redSub(p).redMul(this.x.redAdd(p)); + P = P.redAdd(P).redIAdd(P); var N = A.redIAdd(A); N = N.redIAdd(N); var L = N.redAdd(N); - e = M.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(g); + e = P.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(p); var $ = w.redSqr(); - $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($), r = M.redMul(N.redISub(e)).redISub($); + $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($), r = P.redMul(N.redISub(e)).redISub($); } return this.curve.jpoint(e, r, n); }; -zn.prototype._dbl = function() { +Wn.prototype._dbl = function() { var e = this.curve.a, r = this.x, n = this.y, i = this.z, s = i.redSqr().redSqr(), o = r.redSqr(), a = n.redSqr(), u = o.redAdd(o).redIAdd(o).redIAdd(e.redMul(s)), l = r.redAdd(r); l = l.redIAdd(l); - var d = l.redMul(a), g = u.redSqr().redISub(d.redAdd(d)), w = d.redISub(g), A = a.redSqr(); + var d = l.redMul(a), p = u.redSqr().redISub(d.redAdd(d)), w = d.redISub(p), A = a.redSqr(); A = A.redIAdd(A), A = A.redIAdd(A), A = A.redIAdd(A); - var M = u.redMul(w).redISub(A), N = n.redAdd(n).redMul(i); - return this.curve.jpoint(g, M, N); + var P = u.redMul(w).redISub(A), N = n.redAdd(n).redMul(i); + return this.curve.jpoint(p, P, N); }; -zn.prototype.trpl = function() { +Wn.prototype.trpl = function() { if (!this.curve.zeroA) return this.dbl().add(this); var e = this.x.redSqr(), r = this.y.redSqr(), n = this.z.redSqr(), i = r.redSqr(), s = e.redAdd(e).redIAdd(e), o = s.redSqr(), a = this.x.redAdd(r).redSqr().redISub(e).redISub(i); a = a.redIAdd(a), a = a.redAdd(a).redIAdd(a), a = a.redISub(o); var u = a.redSqr(), l = i.redIAdd(i); l = l.redIAdd(l), l = l.redIAdd(l), l = l.redIAdd(l); - var d = s.redIAdd(a).redSqr().redISub(o).redISub(u).redISub(l), g = r.redMul(d); - g = g.redIAdd(g), g = g.redIAdd(g); - var w = this.x.redMul(u).redISub(g); + var d = s.redIAdd(a).redSqr().redISub(o).redISub(u).redISub(l), p = r.redMul(d); + p = p.redIAdd(p), p = p.redIAdd(p); + var w = this.x.redMul(u).redISub(p); w = w.redIAdd(w), w = w.redIAdd(w); var A = this.y.redMul(d.redMul(l.redISub(d)).redISub(a.redMul(u))); A = A.redIAdd(A), A = A.redIAdd(A), A = A.redIAdd(A); - var M = this.z.redAdd(a).redSqr().redISub(n).redISub(u); - return this.curve.jpoint(w, A, M); + var P = this.z.redAdd(a).redSqr().redISub(n).redISub(u); + return this.curve.jpoint(w, A, P); }; -zn.prototype.mul = function(e, r) { +Wn.prototype.mul = function(e, r) { return e = new rn(e, r), this.curve._wnafMul(this, e); }; -zn.prototype.eq = function(e) { +Wn.prototype.eq = function(e) { if (e.type === "affine") return this.eq(e.toJ()); if (this === e) @@ -14995,7 +14995,7 @@ zn.prototype.eq = function(e) { var i = r.redMul(this.z), s = n.redMul(e.z); return this.y.redMul(s).redISub(e.y.redMul(i)).cmpn(0) === 0; }; -zn.prototype.eqXToP = function(e) { +Wn.prototype.eqXToP = function(e) { var r = this.z.redSqr(), n = e.toRed(this.curve.red).redMul(r); if (this.x.cmp(n) === 0) return !0; @@ -15006,107 +15006,107 @@ zn.prototype.eqXToP = function(e) { return !0; } }; -zn.prototype.inspect = function() { +Wn.prototype.inspect = function() { return this.isInfinity() ? "" : ""; }; -zn.prototype.isInfinity = function() { +Wn.prototype.isInfinity = function() { return this.z.cmpn(0) === 0; }; -var Zc = qo, E8 = q0, G0 = V0, Xj = Fi; -function Bu(t) { - G0.call(this, "mont", t), this.a = new Zc(t.a, 16).toRed(this.red), this.b = new Zc(t.b, 16).toRed(this.red), this.i4 = new Zc(4).toRed(this.red).redInvm(), this.two = new Zc(2).toRed(this.red), this.a24 = this.i4.redMul(this.a.redAdd(this.two)); +var Qc = Ho, A8 = z0, Y0 = G0, aq = Fi; +function ju(t) { + Y0.call(this, "mont", t), this.a = new Qc(t.a, 16).toRed(this.red), this.b = new Qc(t.b, 16).toRed(this.red), this.i4 = new Qc(4).toRed(this.red).redInvm(), this.two = new Qc(2).toRed(this.red), this.a24 = this.i4.redMul(this.a.redAdd(this.two)); } -E8(Bu, G0); -var Zj = Bu; -Bu.prototype.validate = function(e) { +A8(ju, Y0); +var cq = ju; +ju.prototype.validate = function(e) { var r = e.normalize().x, n = r.redSqr(), i = n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r), s = i.redSqrt(); return s.redSqr().cmp(i) === 0; }; -function Nn(t, e, r) { - G0.BasePoint.call(this, t, "projective"), e === null && r === null ? (this.x = this.curve.one, this.z = this.curve.zero) : (this.x = new Zc(e, 16), this.z = new Zc(r, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red))); +function Ln(t, e, r) { + Y0.BasePoint.call(this, t, "projective"), e === null && r === null ? (this.x = this.curve.one, this.z = this.curve.zero) : (this.x = new Qc(e, 16), this.z = new Qc(r, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red))); } -E8(Nn, G0.BasePoint); -Bu.prototype.decodePoint = function(e, r) { - return this.point(Xj.toArray(e, r), 1); +A8(Ln, Y0.BasePoint); +ju.prototype.decodePoint = function(e, r) { + return this.point(aq.toArray(e, r), 1); }; -Bu.prototype.point = function(e, r) { - return new Nn(this, e, r); +ju.prototype.point = function(e, r) { + return new Ln(this, e, r); }; -Bu.prototype.pointFromJSON = function(e) { - return Nn.fromJSON(this, e); +ju.prototype.pointFromJSON = function(e) { + return Ln.fromJSON(this, e); }; -Nn.prototype.precompute = function() { +Ln.prototype.precompute = function() { }; -Nn.prototype._encode = function() { +Ln.prototype._encode = function() { return this.getX().toArray("be", this.curve.p.byteLength()); }; -Nn.fromJSON = function(e, r) { - return new Nn(e, r[0], r[1] || e.one); +Ln.fromJSON = function(e, r) { + return new Ln(e, r[0], r[1] || e.one); }; -Nn.prototype.inspect = function() { +Ln.prototype.inspect = function() { return this.isInfinity() ? "" : ""; }; -Nn.prototype.isInfinity = function() { +Ln.prototype.isInfinity = function() { return this.z.cmpn(0) === 0; }; -Nn.prototype.dbl = function() { +Ln.prototype.dbl = function() { var e = this.x.redAdd(this.z), r = e.redSqr(), n = this.x.redSub(this.z), i = n.redSqr(), s = r.redSub(i), o = r.redMul(i), a = s.redMul(i.redAdd(this.curve.a24.redMul(s))); return this.curve.point(o, a); }; -Nn.prototype.add = function() { +Ln.prototype.add = function() { throw new Error("Not supported on Montgomery curve"); }; -Nn.prototype.diffAdd = function(e, r) { +Ln.prototype.diffAdd = function(e, r) { var n = this.x.redAdd(this.z), i = this.x.redSub(this.z), s = e.x.redAdd(e.z), o = e.x.redSub(e.z), a = o.redMul(n), u = s.redMul(i), l = r.z.redMul(a.redAdd(u).redSqr()), d = r.x.redMul(a.redISub(u).redSqr()); return this.curve.point(l, d); }; -Nn.prototype.mul = function(e) { +Ln.prototype.mul = function(e) { for (var r = e.clone(), n = this, i = this.curve.point(null, null), s = this, o = []; r.cmpn(0) !== 0; r.iushrn(1)) o.push(r.andln(1)); for (var a = o.length - 1; a >= 0; a--) o[a] === 0 ? (n = n.diffAdd(i, s), i = i.dbl()) : (i = n.diffAdd(i, s), n = n.dbl()); return i; }; -Nn.prototype.mulAdd = function() { +Ln.prototype.mulAdd = function() { throw new Error("Not supported on Montgomery curve"); }; -Nn.prototype.jumlAdd = function() { +Ln.prototype.jumlAdd = function() { throw new Error("Not supported on Montgomery curve"); }; -Nn.prototype.eq = function(e) { +Ln.prototype.eq = function(e) { return this.getX().cmp(e.getX()) === 0; }; -Nn.prototype.normalize = function() { +Ln.prototype.normalize = function() { return this.x = this.x.redMul(this.z.redInvm()), this.z = this.curve.one, this; }; -Nn.prototype.getX = function() { +Ln.prototype.getX = function() { return this.normalize(), this.x.fromRed(); }; -var Qj = Fi, Eo = qo, S8 = q0, Y0 = V0, eq = Qj.assert; -function ro(t) { - this.twisted = (t.a | 0) !== 1, this.mOneA = this.twisted && (t.a | 0) === -1, this.extended = this.mOneA, Y0.call(this, "edwards", t), this.a = new Eo(t.a, 16).umod(this.red.m), this.a = this.a.toRed(this.red), this.c = new Eo(t.c, 16).toRed(this.red), this.c2 = this.c.redSqr(), this.d = new Eo(t.d, 16).toRed(this.red), this.dd = this.d.redAdd(this.d), eq(!this.twisted || this.c.fromRed().cmpn(1) === 0), this.oneC = (t.c | 0) === 1; +var uq = Fi, Po = Ho, P8 = z0, J0 = G0, fq = uq.assert; +function io(t) { + this.twisted = (t.a | 0) !== 1, this.mOneA = this.twisted && (t.a | 0) === -1, this.extended = this.mOneA, J0.call(this, "edwards", t), this.a = new Po(t.a, 16).umod(this.red.m), this.a = this.a.toRed(this.red), this.c = new Po(t.c, 16).toRed(this.red), this.c2 = this.c.redSqr(), this.d = new Po(t.d, 16).toRed(this.red), this.dd = this.d.redAdd(this.d), fq(!this.twisted || this.c.fromRed().cmpn(1) === 0), this.oneC = (t.c | 0) === 1; } -S8(ro, Y0); -var tq = ro; -ro.prototype._mulA = function(e) { +P8(io, J0); +var lq = io; +io.prototype._mulA = function(e) { return this.mOneA ? e.redNeg() : this.a.redMul(e); }; -ro.prototype._mulC = function(e) { +io.prototype._mulC = function(e) { return this.oneC ? e : this.c.redMul(e); }; -ro.prototype.jpoint = function(e, r, n, i) { +io.prototype.jpoint = function(e, r, n, i) { return this.point(e, r, n, i); }; -ro.prototype.pointFromX = function(e, r) { - e = new Eo(e, 16), e.red || (e = e.toRed(this.red)); +io.prototype.pointFromX = function(e, r) { + e = new Po(e, 16), e.red || (e = e.toRed(this.red)); var n = e.redSqr(), i = this.c2.redSub(this.a.redMul(n)), s = this.one.redSub(this.c2.redMul(this.d).redMul(n)), o = i.redMul(s.redInvm()), a = o.redSqrt(); if (a.redSqr().redSub(o).cmp(this.zero) !== 0) throw new Error("invalid point"); var u = a.fromRed().isOdd(); return (r && !u || !r && u) && (a = a.redNeg()), this.point(e, a); }; -ro.prototype.pointFromY = function(e, r) { - e = new Eo(e, 16), e.red || (e = e.toRed(this.red)); +io.prototype.pointFromY = function(e, r) { + e = new Po(e, 16), e.red || (e = e.toRed(this.red)); var n = e.redSqr(), i = n.redSub(this.c2), s = n.redMul(this.d).redMul(this.c2).redSub(this.a), o = i.redMul(s.redInvm()); if (o.cmp(this.zero) === 0) { if (r) @@ -15118,39 +15118,39 @@ ro.prototype.pointFromY = function(e, r) { throw new Error("invalid point"); return a.fromRed().isOdd() !== r && (a = a.redNeg()), this.point(a, e); }; -ro.prototype.validate = function(e) { +io.prototype.validate = function(e) { if (e.isInfinity()) return !0; e.normalize(); var r = e.x.redSqr(), n = e.y.redSqr(), i = r.redMul(this.a).redAdd(n), s = this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n))); return i.cmp(s) === 0; }; -function Wr(t, e, r, n, i) { - Y0.BasePoint.call(this, t, "projective"), e === null && r === null && n === null ? (this.x = this.curve.zero, this.y = this.curve.one, this.z = this.curve.one, this.t = this.curve.zero, this.zOne = !0) : (this.x = new Eo(e, 16), this.y = new Eo(r, 16), this.z = n ? new Eo(n, 16) : this.curve.one, this.t = i && new Eo(i, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.t && !this.t.red && (this.t = this.t.toRed(this.curve.red)), this.zOne = this.z === this.curve.one, this.curve.extended && !this.t && (this.t = this.x.redMul(this.y), this.zOne || (this.t = this.t.redMul(this.z.redInvm())))); +function Hr(t, e, r, n, i) { + J0.BasePoint.call(this, t, "projective"), e === null && r === null && n === null ? (this.x = this.curve.zero, this.y = this.curve.one, this.z = this.curve.one, this.t = this.curve.zero, this.zOne = !0) : (this.x = new Po(e, 16), this.y = new Po(r, 16), this.z = n ? new Po(n, 16) : this.curve.one, this.t = i && new Po(i, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.t && !this.t.red && (this.t = this.t.toRed(this.curve.red)), this.zOne = this.z === this.curve.one, this.curve.extended && !this.t && (this.t = this.x.redMul(this.y), this.zOne || (this.t = this.t.redMul(this.z.redInvm())))); } -S8(Wr, Y0.BasePoint); -ro.prototype.pointFromJSON = function(e) { - return Wr.fromJSON(this, e); +P8(Hr, J0.BasePoint); +io.prototype.pointFromJSON = function(e) { + return Hr.fromJSON(this, e); }; -ro.prototype.point = function(e, r, n, i) { - return new Wr(this, e, r, n, i); +io.prototype.point = function(e, r, n, i) { + return new Hr(this, e, r, n, i); }; -Wr.fromJSON = function(e, r) { - return new Wr(e, r[0], r[1], r[2]); +Hr.fromJSON = function(e, r) { + return new Hr(e, r[0], r[1], r[2]); }; -Wr.prototype.inspect = function() { +Hr.prototype.inspect = function() { return this.isInfinity() ? "" : ""; }; -Wr.prototype.isInfinity = function() { +Hr.prototype.isInfinity = function() { return this.x.cmpn(0) === 0 && (this.y.cmp(this.z) === 0 || this.zOne && this.y.cmp(this.curve.c) === 0); }; -Wr.prototype._extDbl = function() { +Hr.prototype._extDbl = function() { var e = this.x.redSqr(), r = this.y.redSqr(), n = this.z.redSqr(); n = n.redIAdd(n); - var i = this.curve._mulA(e), s = this.x.redAdd(this.y).redSqr().redISub(e).redISub(r), o = i.redAdd(r), a = o.redSub(n), u = i.redSub(r), l = s.redMul(a), d = o.redMul(u), g = s.redMul(u), w = a.redMul(o); - return this.curve.point(l, d, w, g); + var i = this.curve._mulA(e), s = this.x.redAdd(this.y).redSqr().redISub(e).redISub(r), o = i.redAdd(r), a = o.redSub(n), u = i.redSub(r), l = s.redMul(a), d = o.redMul(u), p = s.redMul(u), w = a.redMul(o); + return this.curve.point(l, d, w, p); }; -Wr.prototype._projDbl = function() { +Hr.prototype._projDbl = function() { var e = this.x.redAdd(this.y).redSqr(), r = this.x.redSqr(), n = this.y.redSqr(), i, s, o, a, u, l; if (this.curve.twisted) { a = this.curve._mulA(r); @@ -15160,36 +15160,36 @@ Wr.prototype._projDbl = function() { a = r.redAdd(n), u = this.curve._mulC(this.z).redSqr(), l = a.redSub(u).redSub(u), i = this.curve._mulC(e.redISub(a)).redMul(l), s = this.curve._mulC(a).redMul(r.redISub(n)), o = a.redMul(l); return this.curve.point(i, s, o); }; -Wr.prototype.dbl = function() { +Hr.prototype.dbl = function() { return this.isInfinity() ? this : this.curve.extended ? this._extDbl() : this._projDbl(); }; -Wr.prototype._extAdd = function(e) { - var r = this.y.redSub(this.x).redMul(e.y.redSub(e.x)), n = this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)), i = this.t.redMul(this.curve.dd).redMul(e.t), s = this.z.redMul(e.z.redAdd(e.z)), o = n.redSub(r), a = s.redSub(i), u = s.redAdd(i), l = n.redAdd(r), d = o.redMul(a), g = u.redMul(l), w = o.redMul(l), A = a.redMul(u); - return this.curve.point(d, g, A, w); +Hr.prototype._extAdd = function(e) { + var r = this.y.redSub(this.x).redMul(e.y.redSub(e.x)), n = this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)), i = this.t.redMul(this.curve.dd).redMul(e.t), s = this.z.redMul(e.z.redAdd(e.z)), o = n.redSub(r), a = s.redSub(i), u = s.redAdd(i), l = n.redAdd(r), d = o.redMul(a), p = u.redMul(l), w = o.redMul(l), A = a.redMul(u); + return this.curve.point(d, p, A, w); }; -Wr.prototype._projAdd = function(e) { - var r = this.z.redMul(e.z), n = r.redSqr(), i = this.x.redMul(e.x), s = this.y.redMul(e.y), o = this.curve.d.redMul(i).redMul(s), a = n.redSub(o), u = n.redAdd(o), l = this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s), d = r.redMul(a).redMul(l), g, w; - return this.curve.twisted ? (g = r.redMul(u).redMul(s.redSub(this.curve._mulA(i))), w = a.redMul(u)) : (g = r.redMul(u).redMul(s.redSub(i)), w = this.curve._mulC(a).redMul(u)), this.curve.point(d, g, w); +Hr.prototype._projAdd = function(e) { + var r = this.z.redMul(e.z), n = r.redSqr(), i = this.x.redMul(e.x), s = this.y.redMul(e.y), o = this.curve.d.redMul(i).redMul(s), a = n.redSub(o), u = n.redAdd(o), l = this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s), d = r.redMul(a).redMul(l), p, w; + return this.curve.twisted ? (p = r.redMul(u).redMul(s.redSub(this.curve._mulA(i))), w = a.redMul(u)) : (p = r.redMul(u).redMul(s.redSub(i)), w = this.curve._mulC(a).redMul(u)), this.curve.point(d, p, w); }; -Wr.prototype.add = function(e) { +Hr.prototype.add = function(e) { return this.isInfinity() ? e : e.isInfinity() ? this : this.curve.extended ? this._extAdd(e) : this._projAdd(e); }; -Wr.prototype.mul = function(e) { +Hr.prototype.mul = function(e) { return this._hasDoubles(e) ? this.curve._fixedNafMul(this, e) : this.curve._wnafMul(this, e); }; -Wr.prototype.mulAdd = function(e, r, n) { +Hr.prototype.mulAdd = function(e, r, n) { return this.curve._wnafMulAdd(1, [this, r], [e, n], 2, !1); }; -Wr.prototype.jmulAdd = function(e, r, n) { +Hr.prototype.jmulAdd = function(e, r, n) { return this.curve._wnafMulAdd(1, [this, r], [e, n], 2, !0); }; -Wr.prototype.normalize = function() { +Hr.prototype.normalize = function() { if (this.zOne) return this; var e = this.z.redInvm(); return this.x = this.x.redMul(e), this.y = this.y.redMul(e), this.t && (this.t = this.t.redMul(e)), this.z = this.curve.one, this.zOne = !0, this; }; -Wr.prototype.neg = function() { +Hr.prototype.neg = function() { return this.curve.point( this.x.redNeg(), this.y, @@ -15197,16 +15197,16 @@ Wr.prototype.neg = function() { this.t && this.t.redNeg() ); }; -Wr.prototype.getX = function() { +Hr.prototype.getX = function() { return this.normalize(), this.x.fromRed(); }; -Wr.prototype.getY = function() { +Hr.prototype.getY = function() { return this.normalize(), this.y.fromRed(); }; -Wr.prototype.eq = function(e) { +Hr.prototype.eq = function(e) { return this === e || this.getX().cmp(e.getX()) === 0 && this.getY().cmp(e.getY()) === 0; }; -Wr.prototype.eqXToP = function(e) { +Hr.prototype.eqXToP = function(e) { var r = e.toRed(this.curve.red).redMul(this.z); if (this.x.cmp(r) === 0) return !0; @@ -15217,15 +15217,15 @@ Wr.prototype.eqXToP = function(e) { return !0; } }; -Wr.prototype.toP = Wr.prototype.normalize; -Wr.prototype.mixedAdd = Wr.prototype.add; +Hr.prototype.toP = Hr.prototype.normalize; +Hr.prototype.mixedAdd = Hr.prototype.add; (function(t) { var e = t; - e.base = V0, e.short = Jj, e.mont = Zj, e.edwards = tq; + e.base = G0, e.short = oq, e.mont = cq, e.edwards = lq; })(eb); -var J0 = {}, cm, Tx; -function rq() { - return Tx || (Tx = 1, cm = { +var X0 = {}, cm, Dx; +function hq() { + return Dx || (Dx = 1, cm = { doubles: { step: 4, points: [ @@ -16007,7 +16007,7 @@ function rq() { }), cm; } (function(t) { - var e = t, r = Kl, n = eb, i = Fi, s = i.assert; + var e = t, r = Vl, n = eb, i = Fi, s = i.assert; function o(l) { l.type === "short" ? this.curve = new n.short(l) : l.type === "edwards" ? this.curve = new n.edwards(l) : this.curve = new n.mont(l), this.g = this.curve.g, this.n = this.curve.n, this.hash = l.hash, s(this.g.validate(), "Invalid curve"), s(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); } @@ -16017,12 +16017,12 @@ function rq() { configurable: !0, enumerable: !0, get: function() { - var g = new o(d); + var p = new o(d); return Object.defineProperty(e, l, { configurable: !0, enumerable: !0, - value: g - }), g; + value: p + }), p; } }); } @@ -16122,7 +16122,7 @@ function rq() { }); var u; try { - u = rq(); + u = hq(); } catch { u = void 0; } @@ -16155,53 +16155,53 @@ function rq() { u ] }); -})(J0); -var nq = Kl, sc = Zv, A8 = yc; -function ba(t) { - if (!(this instanceof ba)) - return new ba(t); +})(X0); +var dq = Vl, ac = Zv, M8 = wc; +function xa(t) { + if (!(this instanceof xa)) + return new xa(t); this.hash = t.hash, this.predResist = !!t.predResist, this.outLen = this.hash.outSize, this.minEntropy = t.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null; - var e = sc.toArray(t.entropy, t.entropyEnc || "hex"), r = sc.toArray(t.nonce, t.nonceEnc || "hex"), n = sc.toArray(t.pers, t.persEnc || "hex"); - A8( + var e = ac.toArray(t.entropy, t.entropyEnc || "hex"), r = ac.toArray(t.nonce, t.nonceEnc || "hex"), n = ac.toArray(t.pers, t.persEnc || "hex"); + M8( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._init(e, r, n); } -var iq = ba; -ba.prototype._init = function(e, r, n) { +var pq = xa; +xa.prototype._init = function(e, r, n) { var i = e.concat(r).concat(n); this.K = new Array(this.outLen / 8), this.V = new Array(this.outLen / 8); for (var s = 0; s < this.V.length; s++) this.K[s] = 0, this.V[s] = 1; this._update(i), this._reseed = 1, this.reseedInterval = 281474976710656; }; -ba.prototype._hmac = function() { - return new nq.hmac(this.hash, this.K); +xa.prototype._hmac = function() { + return new dq.hmac(this.hash, this.K); }; -ba.prototype._update = function(e) { +xa.prototype._update = function(e) { var r = this._hmac().update(this.V).update([0]); e && (r = r.update(e)), this.K = r.digest(), this.V = this._hmac().update(this.V).digest(), e && (this.K = this._hmac().update(this.V).update([1]).update(e).digest(), this.V = this._hmac().update(this.V).digest()); }; -ba.prototype.reseed = function(e, r, n, i) { - typeof r != "string" && (i = n, n = r, r = null), e = sc.toArray(e, r), n = sc.toArray(n, i), A8( +xa.prototype.reseed = function(e, r, n, i) { + typeof r != "string" && (i = n, n = r, r = null), e = ac.toArray(e, r), n = ac.toArray(n, i), M8( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._update(e.concat(n || [])), this._reseed = 1; }; -ba.prototype.generate = function(e, r, n, i) { +xa.prototype.generate = function(e, r, n, i) { if (this._reseed > this.reseedInterval) throw new Error("Reseed is required"); - typeof r != "string" && (i = n, n = r, r = null), n && (n = sc.toArray(n, i || "hex"), this._update(n)); + typeof r != "string" && (i = n, n = r, r = null), n && (n = ac.toArray(n, i || "hex"), this._update(n)); for (var s = []; s.length < e; ) this.V = this._hmac().update(this.V).digest(), s = s.concat(this.V); var o = s.slice(0, e); - return this._update(n), this._reseed++, sc.encode(o, r); + return this._update(n), this._reseed++, ac.encode(o, r); }; -var sq = qo, oq = Fi, P1 = oq.assert; +var gq = Ho, mq = Fi, P1 = mq.assert; function Qn(t, e) { this.ec = t, this.priv = null, this.pub = null, e.priv && this._importPrivate(e.priv, e.privEnc), e.pub && this._importPublic(e.pub, e.pubEnc); } -var aq = Qn; +var vq = Qn; Qn.fromPublic = function(e, r, n) { return r instanceof Qn ? r : new Qn(e, { pub: r, @@ -16225,7 +16225,7 @@ Qn.prototype.getPrivate = function(e) { return e === "hex" ? this.priv.toString(16, 2) : this.priv; }; Qn.prototype._importPrivate = function(e, r) { - this.priv = new sq(e, r || 16), this.priv = this.priv.umod(this.ec.curve.n); + this.priv = new gq(e, r || 16), this.priv = this.priv.umod(this.ec.curve.n); }; Qn.prototype._importPublic = function(e, r) { if (e.x || e.y) { @@ -16246,14 +16246,14 @@ Qn.prototype.verify = function(e, r, n) { Qn.prototype.inspect = function() { return ""; }; -var o0 = qo, rb = Fi, cq = rb.assert; -function X0(t, e) { - if (t instanceof X0) +var a0 = Ho, rb = Fi, bq = rb.assert; +function Z0(t, e) { + if (t instanceof Z0) return t; - this._importDER(t, e) || (cq(t.r && t.s, "Signature without r or s"), this.r = new o0(t.r, 16), this.s = new o0(t.s, 16), t.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = t.recoveryParam); + this._importDER(t, e) || (bq(t.r && t.s, "Signature without r or s"), this.r = new a0(t.r, 16), this.s = new a0(t.s, 16), t.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = t.recoveryParam); } -var uq = X0; -function fq() { +var yq = Z0; +function wq() { this.place = 0; } function um(t, e) { @@ -16267,14 +16267,14 @@ function um(t, e) { i <<= 8, i |= t[o], i >>>= 0; return i <= 127 ? !1 : (e.place = o, i); } -function Rx(t) { +function Ox(t) { for (var e = 0, r = t.length - 1; !t[e] && !(t[e + 1] & 128) && e < r; ) e++; return e === 0 ? t : t.slice(e); } -X0.prototype._importDER = function(e, r) { +Z0.prototype._importDER = function(e, r) { e = rb.toArray(e, r); - var n = new fq(); + var n = new wq(); if (e[n.place++] !== 48) return !1; var i = um(e, n); @@ -16300,7 +16300,7 @@ X0.prototype._importDER = function(e, r) { u = u.slice(1); else return !1; - return this.r = new o0(o), this.s = new o0(u), this.recoveryParam = null, !0; + return this.r = new a0(o), this.s = new a0(u), this.recoveryParam = null, !0; }; function fm(t, e) { if (e < 128) { @@ -16312,107 +16312,107 @@ function fm(t, e) { t.push(e >>> (r << 3) & 255); t.push(e); } -X0.prototype.toDER = function(e) { +Z0.prototype.toDER = function(e) { var r = this.r.toArray(), n = this.s.toArray(); - for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Rx(r), n = Rx(n); !n[0] && !(n[1] & 128); ) + for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Ox(r), n = Ox(n); !n[0] && !(n[1] & 128); ) n = n.slice(1); var i = [2]; fm(i, r.length), i = i.concat(r), i.push(2), fm(i, n.length); var s = i.concat(n), o = [48]; return fm(o, s.length), o = o.concat(s), rb.encode(o, e); }; -var So = qo, P8 = iq, lq = Fi, lm = J0, hq = _8, M8 = lq.assert, nb = aq, Z0 = uq; -function es(t) { - if (!(this instanceof es)) - return new es(t); - typeof t == "string" && (M8( +var Mo = Ho, I8 = pq, xq = Fi, lm = X0, _q = S8, C8 = xq.assert, nb = vq, Q0 = yq; +function ts(t) { + if (!(this instanceof ts)) + return new ts(t); + typeof t == "string" && (C8( Object.prototype.hasOwnProperty.call(lm, t), "Unknown curve " + t ), t = lm[t]), t instanceof lm.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; } -var dq = es; -es.prototype.keyPair = function(e) { +var Eq = ts; +ts.prototype.keyPair = function(e) { return new nb(this, e); }; -es.prototype.keyFromPrivate = function(e, r) { +ts.prototype.keyFromPrivate = function(e, r) { return nb.fromPrivate(this, e, r); }; -es.prototype.keyFromPublic = function(e, r) { +ts.prototype.keyFromPublic = function(e, r) { return nb.fromPublic(this, e, r); }; -es.prototype.genKeyPair = function(e) { +ts.prototype.genKeyPair = function(e) { e || (e = {}); - for (var r = new P8({ + for (var r = new I8({ hash: this.hash, pers: e.pers, persEnc: e.persEnc || "utf8", - entropy: e.entropy || hq(this.hash.hmacStrength), + entropy: e.entropy || _q(this.hash.hmacStrength), entropyEnc: e.entropy && e.entropyEnc || "utf8", nonce: this.n.toArray() - }), n = this.n.byteLength(), i = this.n.sub(new So(2)); ; ) { - var s = new So(r.generate(n)); + }), n = this.n.byteLength(), i = this.n.sub(new Mo(2)); ; ) { + var s = new Mo(r.generate(n)); if (!(s.cmp(i) > 0)) return s.iaddn(1), this.keyFromPrivate(s); } }; -es.prototype._truncateToN = function(e, r, n) { +ts.prototype._truncateToN = function(e, r, n) { var i; - if (So.isBN(e) || typeof e == "number") - e = new So(e, 16), i = e.byteLength(); + if (Mo.isBN(e) || typeof e == "number") + e = new Mo(e, 16), i = e.byteLength(); else if (typeof e == "object") - i = e.length, e = new So(e, 16); + i = e.length, e = new Mo(e, 16); else { var s = e.toString(); - i = s.length + 1 >>> 1, e = new So(s, 16); + i = s.length + 1 >>> 1, e = new Mo(s, 16); } typeof n != "number" && (n = i * 8); var o = n - this.n.bitLength(); return o > 0 && (e = e.ushrn(o)), !r && e.cmp(this.n) >= 0 ? e.sub(this.n) : e; }; -es.prototype.sign = function(e, r, n, i) { +ts.prototype.sign = function(e, r, n, i) { typeof n == "object" && (i = n, n = null), i || (i = {}), r = this.keyFromPrivate(r, n), e = this._truncateToN(e, !1, i.msgBitLength); - for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new P8({ + for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new I8({ hash: this.hash, entropy: o, nonce: a, pers: i.pers, persEnc: i.persEnc || "utf8" - }), l = this.n.sub(new So(1)), d = 0; ; d++) { - var g = i.k ? i.k(d) : new So(u.generate(this.n.byteLength())); - if (g = this._truncateToN(g, !0), !(g.cmpn(1) <= 0 || g.cmp(l) >= 0)) { - var w = this.g.mul(g); + }), l = this.n.sub(new Mo(1)), d = 0; ; d++) { + var p = i.k ? i.k(d) : new Mo(u.generate(this.n.byteLength())); + if (p = this._truncateToN(p, !0), !(p.cmpn(1) <= 0 || p.cmp(l) >= 0)) { + var w = this.g.mul(p); if (!w.isInfinity()) { - var A = w.getX(), M = A.umod(this.n); - if (M.cmpn(0) !== 0) { - var N = g.invm(this.n).mul(M.mul(r.getPrivate()).iadd(e)); + var A = w.getX(), P = A.umod(this.n); + if (P.cmpn(0) !== 0) { + var N = p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e)); if (N = N.umod(this.n), N.cmpn(0) !== 0) { - var L = (w.getY().isOdd() ? 1 : 0) | (A.cmp(M) !== 0 ? 2 : 0); - return i.canonical && N.cmp(this.nh) > 0 && (N = this.n.sub(N), L ^= 1), new Z0({ r: M, s: N, recoveryParam: L }); + var L = (w.getY().isOdd() ? 1 : 0) | (A.cmp(P) !== 0 ? 2 : 0); + return i.canonical && N.cmp(this.nh) > 0 && (N = this.n.sub(N), L ^= 1), new Q0({ r: P, s: N, recoveryParam: L }); } } } } } }; -es.prototype.verify = function(e, r, n, i, s) { - s || (s = {}), e = this._truncateToN(e, !1, s.msgBitLength), n = this.keyFromPublic(n, i), r = new Z0(r, "hex"); +ts.prototype.verify = function(e, r, n, i, s) { + s || (s = {}), e = this._truncateToN(e, !1, s.msgBitLength), n = this.keyFromPublic(n, i), r = new Q0(r, "hex"); var o = r.r, a = r.s; if (o.cmpn(1) < 0 || o.cmp(this.n) >= 0 || a.cmpn(1) < 0 || a.cmp(this.n) >= 0) return !1; - var u = a.invm(this.n), l = u.mul(e).umod(this.n), d = u.mul(o).umod(this.n), g; - return this.curve._maxwellTrick ? (g = this.g.jmulAdd(l, n.getPublic(), d), g.isInfinity() ? !1 : g.eqXToP(o)) : (g = this.g.mulAdd(l, n.getPublic(), d), g.isInfinity() ? !1 : g.getX().umod(this.n).cmp(o) === 0); + var u = a.invm(this.n), l = u.mul(e).umod(this.n), d = u.mul(o).umod(this.n), p; + return this.curve._maxwellTrick ? (p = this.g.jmulAdd(l, n.getPublic(), d), p.isInfinity() ? !1 : p.eqXToP(o)) : (p = this.g.mulAdd(l, n.getPublic(), d), p.isInfinity() ? !1 : p.getX().umod(this.n).cmp(o) === 0); }; -es.prototype.recoverPubKey = function(t, e, r, n) { - M8((3 & r) === r, "The recovery param is more than two bits"), e = new Z0(e, n); - var i = this.n, s = new So(t), o = e.r, a = e.s, u = r & 1, l = r >> 1; +ts.prototype.recoverPubKey = function(t, e, r, n) { + C8((3 & r) === r, "The recovery param is more than two bits"), e = new Q0(e, n); + var i = this.n, s = new Mo(t), o = e.r, a = e.s, u = r & 1, l = r >> 1; if (o.cmp(this.curve.p.umod(this.curve.n)) >= 0 && l) throw new Error("Unable to find sencond key candinate"); l ? o = this.curve.pointFromX(o.add(this.curve.n), u) : o = this.curve.pointFromX(o, u); - var d = e.r.invm(i), g = i.sub(s).mul(d).umod(i), w = a.mul(d).umod(i); - return this.g.mulAdd(g, o, w); + var d = e.r.invm(i), p = i.sub(s).mul(d).umod(i), w = a.mul(d).umod(i); + return this.g.mulAdd(p, o, w); }; -es.prototype.getKeyRecoveryParam = function(t, e, r, n) { - if (e = new Z0(e, n), e.recoveryParam !== null) +ts.prototype.getKeyRecoveryParam = function(t, e, r, n) { + if (e = new Q0(e, n), e.recoveryParam !== null) return e.recoveryParam; for (var i = 0; i < 4; i++) { var s; @@ -16426,89 +16426,89 @@ es.prototype.getKeyRecoveryParam = function(t, e, r, n) { } throw new Error("Unable to find valid recovery factor"); }; -var Jl = Fi, I8 = Jl.assert, Dx = Jl.parseBytes, Uu = Jl.cachedProperty; -function On(t, e) { - this.eddsa = t, this._secret = Dx(e.secret), t.isPoint(e.pub) ? this._pub = e.pub : this._pubBytes = Dx(e.pub); +var Xl = Fi, T8 = Xl.assert, Nx = Xl.parseBytes, Uu = Xl.cachedProperty; +function Nn(t, e) { + this.eddsa = t, this._secret = Nx(e.secret), t.isPoint(e.pub) ? this._pub = e.pub : this._pubBytes = Nx(e.pub); } -On.fromPublic = function(e, r) { - return r instanceof On ? r : new On(e, { pub: r }); +Nn.fromPublic = function(e, r) { + return r instanceof Nn ? r : new Nn(e, { pub: r }); }; -On.fromSecret = function(e, r) { - return r instanceof On ? r : new On(e, { secret: r }); +Nn.fromSecret = function(e, r) { + return r instanceof Nn ? r : new Nn(e, { secret: r }); }; -On.prototype.secret = function() { +Nn.prototype.secret = function() { return this._secret; }; -Uu(On, "pubBytes", function() { +Uu(Nn, "pubBytes", function() { return this.eddsa.encodePoint(this.pub()); }); -Uu(On, "pub", function() { +Uu(Nn, "pub", function() { return this._pubBytes ? this.eddsa.decodePoint(this._pubBytes) : this.eddsa.g.mul(this.priv()); }); -Uu(On, "privBytes", function() { +Uu(Nn, "privBytes", function() { var e = this.eddsa, r = this.hash(), n = e.encodingLength - 1, i = r.slice(0, e.encodingLength); return i[0] &= 248, i[n] &= 127, i[n] |= 64, i; }); -Uu(On, "priv", function() { +Uu(Nn, "priv", function() { return this.eddsa.decodeInt(this.privBytes()); }); -Uu(On, "hash", function() { +Uu(Nn, "hash", function() { return this.eddsa.hash().update(this.secret()).digest(); }); -Uu(On, "messagePrefix", function() { +Uu(Nn, "messagePrefix", function() { return this.hash().slice(this.eddsa.encodingLength); }); -On.prototype.sign = function(e) { - return I8(this._secret, "KeyPair can only verify"), this.eddsa.sign(e, this); +Nn.prototype.sign = function(e) { + return T8(this._secret, "KeyPair can only verify"), this.eddsa.sign(e, this); }; -On.prototype.verify = function(e, r) { +Nn.prototype.verify = function(e, r) { return this.eddsa.verify(e, r, this); }; -On.prototype.getSecret = function(e) { - return I8(this._secret, "KeyPair is public only"), Jl.encode(this.secret(), e); +Nn.prototype.getSecret = function(e) { + return T8(this._secret, "KeyPair is public only"), Xl.encode(this.secret(), e); }; -On.prototype.getPublic = function(e) { - return Jl.encode(this.pubBytes(), e); +Nn.prototype.getPublic = function(e) { + return Xl.encode(this.pubBytes(), e); }; -var pq = On, gq = qo, Q0 = Fi, Ox = Q0.assert, ep = Q0.cachedProperty, mq = Q0.parseBytes; -function xc(t, e) { - this.eddsa = t, typeof e != "object" && (e = mq(e)), Array.isArray(e) && (Ox(e.length === t.encodingLength * 2, "Signature has invalid size"), e = { +var Sq = Nn, Aq = Ho, ep = Fi, Lx = ep.assert, tp = ep.cachedProperty, Pq = ep.parseBytes; +function _c(t, e) { + this.eddsa = t, typeof e != "object" && (e = Pq(e)), Array.isArray(e) && (Lx(e.length === t.encodingLength * 2, "Signature has invalid size"), e = { R: e.slice(0, t.encodingLength), S: e.slice(t.encodingLength) - }), Ox(e.R && e.S, "Signature without R or S"), t.isPoint(e.R) && (this._R = e.R), e.S instanceof gq && (this._S = e.S), this._Rencoded = Array.isArray(e.R) ? e.R : e.Rencoded, this._Sencoded = Array.isArray(e.S) ? e.S : e.Sencoded; + }), Lx(e.R && e.S, "Signature without R or S"), t.isPoint(e.R) && (this._R = e.R), e.S instanceof Aq && (this._S = e.S), this._Rencoded = Array.isArray(e.R) ? e.R : e.Rencoded, this._Sencoded = Array.isArray(e.S) ? e.S : e.Sencoded; } -ep(xc, "S", function() { +tp(_c, "S", function() { return this.eddsa.decodeInt(this.Sencoded()); }); -ep(xc, "R", function() { +tp(_c, "R", function() { return this.eddsa.decodePoint(this.Rencoded()); }); -ep(xc, "Rencoded", function() { +tp(_c, "Rencoded", function() { return this.eddsa.encodePoint(this.R()); }); -ep(xc, "Sencoded", function() { +tp(_c, "Sencoded", function() { return this.eddsa.encodeInt(this.S()); }); -xc.prototype.toBytes = function() { +_c.prototype.toBytes = function() { return this.Rencoded().concat(this.Sencoded()); }; -xc.prototype.toHex = function() { - return Q0.encode(this.toBytes(), "hex").toUpperCase(); +_c.prototype.toHex = function() { + return ep.encode(this.toBytes(), "hex").toUpperCase(); }; -var vq = xc, bq = Kl, yq = J0, Su = Fi, wq = Su.assert, C8 = Su.parseBytes, T8 = pq, Nx = vq; +var Mq = _c, Iq = Vl, Cq = X0, Au = Fi, Tq = Au.assert, R8 = Au.parseBytes, D8 = Sq, kx = Mq; function _i(t) { - if (wq(t === "ed25519", "only tested with ed25519 so far"), !(this instanceof _i)) + if (Tq(t === "ed25519", "only tested with ed25519 so far"), !(this instanceof _i)) return new _i(t); - t = yq[t].curve, this.curve = t, this.g = t.g, this.g.precompute(t.n.bitLength() + 1), this.pointClass = t.point().constructor, this.encodingLength = Math.ceil(t.n.bitLength() / 8), this.hash = bq.sha512; + t = Cq[t].curve, this.curve = t, this.g = t.g, this.g.precompute(t.n.bitLength() + 1), this.pointClass = t.point().constructor, this.encodingLength = Math.ceil(t.n.bitLength() / 8), this.hash = Iq.sha512; } -var xq = _i; +var Rq = _i; _i.prototype.sign = function(e, r) { - e = C8(e); + e = R8(e); var n = this.keyFromSecret(r), i = this.hashInt(n.messagePrefix(), e), s = this.g.mul(i), o = this.encodePoint(s), a = this.hashInt(o, n.pubBytes(), e).mul(n.priv()), u = i.add(a).umod(this.curve.n); return this.makeSignature({ R: s, S: u, Rencoded: o }); }; _i.prototype.verify = function(e, r, n) { - if (e = C8(e), r = this.makeSignature(r), r.S().gte(r.eddsa.curve.n) || r.S().isNeg()) + if (e = R8(e), r = this.makeSignature(r), r.S().gte(r.eddsa.curve.n) || r.S().isNeg()) return !1; var i = this.keyFromPublic(n), s = this.hashInt(r.Rencoded(), i.pubBytes(), e), o = this.g.mul(r.S()), a = r.R().add(i.pub().mul(s)); return a.eq(o); @@ -16516,113 +16516,113 @@ _i.prototype.verify = function(e, r, n) { _i.prototype.hashInt = function() { for (var e = this.hash(), r = 0; r < arguments.length; r++) e.update(arguments[r]); - return Su.intFromLE(e.digest()).umod(this.curve.n); + return Au.intFromLE(e.digest()).umod(this.curve.n); }; _i.prototype.keyFromPublic = function(e) { - return T8.fromPublic(this, e); + return D8.fromPublic(this, e); }; _i.prototype.keyFromSecret = function(e) { - return T8.fromSecret(this, e); + return D8.fromSecret(this, e); }; _i.prototype.makeSignature = function(e) { - return e instanceof Nx ? e : new Nx(this, e); + return e instanceof kx ? e : new kx(this, e); }; _i.prototype.encodePoint = function(e) { var r = e.getY().toArray("le", this.encodingLength); return r[this.encodingLength - 1] |= e.getX().isOdd() ? 128 : 0, r; }; _i.prototype.decodePoint = function(e) { - e = Su.parseBytes(e); - var r = e.length - 1, n = e.slice(0, r).concat(e[r] & -129), i = (e[r] & 128) !== 0, s = Su.intFromLE(n); + e = Au.parseBytes(e); + var r = e.length - 1, n = e.slice(0, r).concat(e[r] & -129), i = (e[r] & 128) !== 0, s = Au.intFromLE(n); return this.curve.pointFromY(s, i); }; _i.prototype.encodeInt = function(e) { return e.toArray("le", this.encodingLength); }; _i.prototype.decodeInt = function(e) { - return Su.intFromLE(e); + return Au.intFromLE(e); }; _i.prototype.isPoint = function(e) { return e instanceof this.pointClass; }; (function(t) { var e = t; - e.version = Kj.version, e.utils = Fi, e.rand = _8, e.curve = eb, e.curves = J0, e.ec = dq, e.eddsa = xq; -})(x8); -const _q = { waku: { publish: "waku_publish", batchPublish: "waku_batchPublish", subscribe: "waku_subscribe", batchSubscribe: "waku_batchSubscribe", subscription: "waku_subscription", unsubscribe: "waku_unsubscribe", batchUnsubscribe: "waku_batchUnsubscribe", batchFetchMessages: "waku_batchFetchMessages" }, irn: { publish: "irn_publish", batchPublish: "irn_batchPublish", subscribe: "irn_subscribe", batchSubscribe: "irn_batchSubscribe", subscription: "irn_subscription", unsubscribe: "irn_unsubscribe", batchUnsubscribe: "irn_batchUnsubscribe", batchFetchMessages: "irn_batchFetchMessages" }, iridium: { publish: "iridium_publish", batchPublish: "iridium_batchPublish", subscribe: "iridium_subscribe", batchSubscribe: "iridium_batchSubscribe", subscription: "iridium_subscription", unsubscribe: "iridium_unsubscribe", batchUnsubscribe: "iridium_batchUnsubscribe", batchFetchMessages: "iridium_batchFetchMessages" } }, Eq = ":"; -function lu(t) { - const [e, r] = t.split(Eq); + e.version = rq.version, e.utils = Fi, e.rand = S8, e.curve = eb, e.curves = X0, e.ec = Eq, e.eddsa = Rq; +})(E8); +const Dq = { waku: { publish: "waku_publish", batchPublish: "waku_batchPublish", subscribe: "waku_subscribe", batchSubscribe: "waku_batchSubscribe", subscription: "waku_subscription", unsubscribe: "waku_unsubscribe", batchUnsubscribe: "waku_batchUnsubscribe", batchFetchMessages: "waku_batchFetchMessages" }, irn: { publish: "irn_publish", batchPublish: "irn_batchPublish", subscribe: "irn_subscribe", batchSubscribe: "irn_batchSubscribe", subscription: "irn_subscription", unsubscribe: "irn_unsubscribe", batchUnsubscribe: "irn_batchUnsubscribe", batchFetchMessages: "irn_batchFetchMessages" }, iridium: { publish: "iridium_publish", batchPublish: "iridium_batchPublish", subscribe: "iridium_subscribe", batchSubscribe: "iridium_batchSubscribe", subscription: "iridium_subscription", unsubscribe: "iridium_unsubscribe", batchUnsubscribe: "iridium_batchUnsubscribe", batchFetchMessages: "iridium_batchFetchMessages" } }, Oq = ":"; +function hu(t) { + const [e, r] = t.split(Oq); return { namespace: e, reference: r }; } -function R8(t, e) { +function O8(t, e) { return t.includes(":") ? [t] : e.chains || []; } -var Sq = Object.defineProperty, Lx = Object.getOwnPropertySymbols, Aq = Object.prototype.hasOwnProperty, Pq = Object.prototype.propertyIsEnumerable, kx = (t, e, r) => e in t ? Sq(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, $x = (t, e) => { - for (var r in e || (e = {})) Aq.call(e, r) && kx(t, r, e[r]); - if (Lx) for (var r of Lx(e)) Pq.call(e, r) && kx(t, r, e[r]); +var Nq = Object.defineProperty, $x = Object.getOwnPropertySymbols, Lq = Object.prototype.hasOwnProperty, kq = Object.prototype.propertyIsEnumerable, Bx = (t, e, r) => e in t ? Nq(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Fx = (t, e) => { + for (var r in e || (e = {})) Lq.call(e, r) && Bx(t, r, e[r]); + if ($x) for (var r of $x(e)) kq.call(e, r) && Bx(t, r, e[r]); return t; }; -const Mq = "ReactNative", Ri = { reactNative: "react-native", node: "node", browser: "browser", unknown: "unknown" }, Iq = "js"; -function a0() { +const $q = "ReactNative", Di = { reactNative: "react-native", node: "node", browser: "browser", unknown: "unknown" }, Bq = "js"; +function c0() { return typeof process < "u" && typeof process.versions < "u" && typeof process.versions.node < "u"; } -function ju() { - return !Wl() && !!Bv() && navigator.product === Mq; -} -function Xl() { - return !a0() && !!Bv() && !!Wl(); +function qu() { + return !Kl() && !!Fv() && navigator.product === $q; } function Zl() { - return ju() ? Ri.reactNative : a0() ? Ri.node : Xl() ? Ri.browser : Ri.unknown; + return !c0() && !!Fv() && !!Kl(); +} +function Ql() { + return qu() ? Di.reactNative : c0() ? Di.node : Zl() ? Di.browser : Di.unknown; } -function Cq() { +function Fq() { var t; try { - return ju() && typeof global < "u" && typeof (global == null ? void 0 : global.Application) < "u" ? (t = global.Application) == null ? void 0 : t.applicationId : void 0; + return qu() && typeof global < "u" && typeof (global == null ? void 0 : global.Application) < "u" ? (t = global.Application) == null ? void 0 : t.applicationId : void 0; } catch { return; } } -function Tq(t, e) { - let r = wl.parse(t); - return r = $x($x({}, r), e), t = wl.stringify(r), t; +function jq(t, e) { + let r = xl.parse(t); + return r = Fx(Fx({}, r), e), t = xl.stringify(r), t; } -function D8() { - return q4() || { name: "", description: "", url: "", icons: [""] }; +function N8() { + return W4() || { name: "", description: "", url: "", icons: [""] }; } -function Rq() { - if (Zl() === Ri.reactNative && typeof global < "u" && typeof (global == null ? void 0 : global.Platform) < "u") { +function Uq() { + if (Ql() === Di.reactNative && typeof global < "u" && typeof (global == null ? void 0 : global.Platform) < "u") { const { OS: r, Version: n } = global.Platform; return [r, n].join("-"); } - const t = zF(); + const t = QB(); if (t === null) return "unknown"; const e = t.os ? t.os.replace(" ", "").toLowerCase() : "unknown"; return t.type === "browser" ? [e, t.name, t.version].join("-") : [e, t.version].join("-"); } -function Dq() { +function qq() { var t; - const e = Zl(); - return e === Ri.browser ? [e, ((t = j4()) == null ? void 0 : t.host) || "unknown"].join(":") : e; + const e = Ql(); + return e === Di.browser ? [e, ((t = z4()) == null ? void 0 : t.host) || "unknown"].join(":") : e; } -function O8(t, e, r) { - const n = Rq(), i = Dq(); - return [[t, e].join("-"), [Iq, r].join("-"), n, i].join("/"); +function L8(t, e, r) { + const n = Uq(), i = qq(); + return [[t, e].join("-"), [Bq, r].join("-"), n, i].join("/"); } -function Oq({ protocol: t, version: e, relayUrl: r, sdkVersion: n, auth: i, projectId: s, useOnCloseEvent: o, bundleId: a }) { - const u = r.split("?"), l = O8(t, e, n), d = { auth: i, ua: l, projectId: s, useOnCloseEvent: o, origin: a || void 0 }, g = Tq(u[1] || "", d); - return u[0] + "?" + g; +function zq({ protocol: t, version: e, relayUrl: r, sdkVersion: n, auth: i, projectId: s, useOnCloseEvent: o, bundleId: a }) { + const u = r.split("?"), l = L8(t, e, n), d = { auth: i, ua: l, projectId: s, useOnCloseEvent: o, origin: a || void 0 }, p = jq(u[1] || "", d); + return u[0] + "?" + p; } -function tc(t, e) { +function nc(t, e) { return t.filter((r) => e.includes(r)).length === t.length; } -function N8(t) { +function k8(t) { return Object.fromEntries(t.entries()); } -function L8(t) { +function $8(t) { return new Map(Object.entries(t)); } -function Va(t = mt.FIVE_MINUTES, e) { +function Ja(t = mt.FIVE_MINUTES, e) { const r = mt.toMiliseconds(t || mt.FIVE_MINUTES); let n, i, s; return { resolve: (o) => { @@ -16635,7 +16635,7 @@ function Va(t = mt.FIVE_MINUTES, e) { }, r), n = o, i = a; }) }; } -function hu(t, e, r) { +function du(t, e, r) { return new Promise(async (n, i) => { const s = setTimeout(() => i(new Error(r)), e); try { @@ -16647,7 +16647,7 @@ function hu(t, e, r) { clearTimeout(s); }); } -function k8(t, e) { +function B8(t, e) { if (typeof e == "string" && e.startsWith(`${t}:`)) return e; if (t.toLowerCase() === "topic") { if (typeof e != "string") throw new Error('Value must be "string" for expirer target type: topic'); @@ -16658,13 +16658,13 @@ function k8(t, e) { } throw new Error(`Unknown expirer target type: ${t}`); } -function Nq(t) { - return k8("topic", t); +function Wq(t) { + return B8("topic", t); } -function Lq(t) { - return k8("id", t); +function Hq(t) { + return B8("id", t); } -function $8(t) { +function F8(t) { const [e, r] = t.split(":"), n = { id: void 0, topic: void 0 }; if (e === "topic" && typeof r == "string") n.topic = r; else if (e === "id" && Number.isInteger(Number(r))) n.id = Number(r); @@ -16674,59 +16674,59 @@ function $8(t) { function En(t, e) { return mt.fromMiliseconds(Date.now() + mt.toMiliseconds(t)); } -function aa(t) { +function fa(t) { return Date.now() >= mt.toMiliseconds(t); } function br(t, e) { return `${t}${e ? `:${e}` : ""}`; } -function Md(t = [], e = []) { +function Id(t = [], e = []) { return [.../* @__PURE__ */ new Set([...t, ...e])]; } -async function kq({ id: t, topic: e, wcDeepLink: r }) { +async function Kq({ id: t, topic: e, wcDeepLink: r }) { var n; try { if (!r) return; const i = typeof r == "string" ? JSON.parse(r) : r, s = i == null ? void 0 : i.href; if (typeof s != "string") return; - const o = $q(s, t, e), a = Zl(); - if (a === Ri.browser) { - if (!((n = Wl()) != null && n.hasFocus())) { + const o = Vq(s, t, e), a = Ql(); + if (a === Di.browser) { + if (!((n = Kl()) != null && n.hasFocus())) { console.warn("Document does not have focus, skipping deeplink."); return; } - o.startsWith("https://") || o.startsWith("http://") ? window.open(o, "_blank", "noreferrer noopener") : window.open(o, Bq() ? "_blank" : "_self", "noreferrer noopener"); - } else a === Ri.reactNative && typeof (global == null ? void 0 : global.Linking) < "u" && await global.Linking.openURL(o); + o.startsWith("https://") || o.startsWith("http://") ? window.open(o, "_blank", "noreferrer noopener") : window.open(o, Yq() ? "_blank" : "_self", "noreferrer noopener"); + } else a === Di.reactNative && typeof (global == null ? void 0 : global.Linking) < "u" && await global.Linking.openURL(o); } catch (i) { console.error(i); } } -function $q(t, e, r) { +function Vq(t, e, r) { const n = `requestId=${e}&sessionTopic=${r}`; t.endsWith("/") && (t = t.slice(0, -1)); let i = `${t}`; if (t.startsWith("https://t.me")) { const s = t.includes("?") ? "&startapp=" : "?startapp="; - i = `${i}${s}${Uq(n, !0)}`; + i = `${i}${s}${Jq(n, !0)}`; } else i = `${i}/wc?${n}`; return i; } -async function Fq(t, e) { +async function Gq(t, e) { let r = ""; try { - if (Xl() && (r = localStorage.getItem(e), r)) return r; + if (Zl() && (r = localStorage.getItem(e), r)) return r; r = await t.getItem(e); } catch (n) { console.error(n); } return r; } -function Fx(t, e) { +function jx(t, e) { if (!t.includes(e)) return null; const r = t.split(/([&,?,=])/), n = r.indexOf(e); return r[n + 2]; } -function Bx() { +function Ux() { return typeof crypto < "u" && crypto != null && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu, (t) => { const e = Math.random() * 16 | 0; return (t === "x" ? e : e & 3 | 8).toString(16); @@ -16735,82 +16735,82 @@ function Bx() { function ib() { return typeof process < "u" && process.env.IS_VITEST === "true"; } -function Bq() { +function Yq() { return typeof window < "u" && (!!window.TelegramWebviewProxy || !!window.Telegram || !!window.TelegramWebviewProxyProto); } -function Uq(t, e = !1) { +function Jq(t, e = !1) { const r = Buffer.from(t).toString("base64"); return e ? r.replace(/[=]/g, "") : r; } -function F8(t) { +function j8(t) { return Buffer.from(t, "base64").toString("utf-8"); } -const jq = "https://rpc.walletconnect.org/v1"; -async function qq(t, e, r, n, i, s) { +const Xq = "https://rpc.walletconnect.org/v1"; +async function Zq(t, e, r, n, i, s) { switch (r.t) { case "eip191": - return zq(t, e, r.s); + return Qq(t, e, r.s); case "eip1271": - return await Hq(t, e, r.s, n, i, s); + return await ez(t, e, r.s, n, i, s); default: throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`); } } -function zq(t, e, r) { - return bj(V4(e), r).toLowerCase() === t.toLowerCase(); +function Qq(t, e, r) { + return IU(Y4(e), r).toLowerCase() === t.toLowerCase(); } -async function Hq(t, e, r, n, i, s) { - const o = lu(n); +async function ez(t, e, r, n, i, s) { + const o = hu(n); if (!o.namespace || !o.reference) throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`); try { - const a = "0x1626ba7e", u = "0000000000000000000000000000000000000000000000000000000000000040", l = "0000000000000000000000000000000000000000000000000000000000000041", d = r.substring(2), g = V4(e).substring(2), w = a + g + u + l + d, A = await fetch(`${s || jq}/?chainId=${n}&projectId=${i}`, { method: "POST", body: JSON.stringify({ id: Wq(), jsonrpc: "2.0", method: "eth_call", params: [{ to: t, data: w }, "latest"] }) }), { result: M } = await A.json(); - return M ? M.slice(0, a.length).toLowerCase() === a.toLowerCase() : !1; + const a = "0x1626ba7e", u = "0000000000000000000000000000000000000000000000000000000000000040", l = "0000000000000000000000000000000000000000000000000000000000000041", d = r.substring(2), p = Y4(e).substring(2), w = a + p + u + l + d, A = await fetch(`${s || Xq}/?chainId=${n}&projectId=${i}`, { method: "POST", body: JSON.stringify({ id: tz(), jsonrpc: "2.0", method: "eth_call", params: [{ to: t, data: w }, "latest"] }) }), { result: P } = await A.json(); + return P ? P.slice(0, a.length).toLowerCase() === a.toLowerCase() : !1; } catch (a) { return console.error("isValidEip1271Signature: ", a), !1; } } -function Wq() { +function tz() { return Date.now() + Math.floor(Math.random() * 1e3); } -var Kq = Object.defineProperty, Vq = Object.defineProperties, Gq = Object.getOwnPropertyDescriptors, Ux = Object.getOwnPropertySymbols, Yq = Object.prototype.hasOwnProperty, Jq = Object.prototype.propertyIsEnumerable, jx = (t, e, r) => e in t ? Kq(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Xq = (t, e) => { - for (var r in e || (e = {})) Yq.call(e, r) && jx(t, r, e[r]); - if (Ux) for (var r of Ux(e)) Jq.call(e, r) && jx(t, r, e[r]); +var rz = Object.defineProperty, nz = Object.defineProperties, iz = Object.getOwnPropertyDescriptors, qx = Object.getOwnPropertySymbols, sz = Object.prototype.hasOwnProperty, oz = Object.prototype.propertyIsEnumerable, zx = (t, e, r) => e in t ? rz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, az = (t, e) => { + for (var r in e || (e = {})) sz.call(e, r) && zx(t, r, e[r]); + if (qx) for (var r of qx(e)) oz.call(e, r) && zx(t, r, e[r]); return t; -}, Zq = (t, e) => Vq(t, Gq(e)); -const Qq = "did:pkh:", sb = (t) => t == null ? void 0 : t.split(":"), ez = (t) => { +}, cz = (t, e) => nz(t, iz(e)); +const uz = "did:pkh:", sb = (t) => t == null ? void 0 : t.split(":"), fz = (t) => { const e = t && sb(t); - if (e) return t.includes(Qq) ? e[3] : e[1]; + if (e) return t.includes(uz) ? e[3] : e[1]; }, M1 = (t) => { const e = t && sb(t); if (e) return e[2] + ":" + e[3]; -}, c0 = (t) => { +}, u0 = (t) => { const e = t && sb(t); if (e) return e.pop(); }; -async function qx(t) { - const { cacao: e, projectId: r } = t, { s: n, p: i } = e, s = B8(i, i.iss), o = c0(i.iss); - return await qq(o, s, n, M1(i.iss), r); +async function Wx(t) { + const { cacao: e, projectId: r } = t, { s: n, p: i } = e, s = U8(i, i.iss), o = u0(i.iss); + return await Zq(o, s, n, M1(i.iss), r); } -const B8 = (t, e) => { - const r = `${t.domain} wants you to sign in with your Ethereum account:`, n = c0(e); +const U8 = (t, e) => { + const r = `${t.domain} wants you to sign in with your Ethereum account:`, n = u0(e); if (!t.aud && !t.uri) throw new Error("Either `aud` or `uri` is required to construct the message"); let i = t.statement || void 0; - const s = `URI: ${t.aud || t.uri}`, o = `Version: ${t.version}`, a = `Chain ID: ${ez(e)}`, u = `Nonce: ${t.nonce}`, l = `Issued At: ${t.iat}`, d = t.exp ? `Expiration Time: ${t.exp}` : void 0, g = t.nbf ? `Not Before: ${t.nbf}` : void 0, w = t.requestId ? `Request ID: ${t.requestId}` : void 0, A = t.resources ? `Resources:${t.resources.map((N) => ` -- ${N}`).join("")}` : void 0, M = Id(t.resources); - if (M) { - const N = xl(M); - i = uz(i, N); + const s = `URI: ${t.aud || t.uri}`, o = `Version: ${t.version}`, a = `Chain ID: ${fz(e)}`, u = `Nonce: ${t.nonce}`, l = `Issued At: ${t.iat}`, d = t.exp ? `Expiration Time: ${t.exp}` : void 0, p = t.nbf ? `Not Before: ${t.nbf}` : void 0, w = t.requestId ? `Request ID: ${t.requestId}` : void 0, A = t.resources ? `Resources:${t.resources.map((N) => ` +- ${N}`).join("")}` : void 0, P = Cd(t.resources); + if (P) { + const N = _l(P); + i = yz(i, N); } - return [r, n, "", i, "", s, o, a, u, l, d, g, w, A].filter((N) => N != null).join(` + return [r, n, "", i, "", s, o, a, u, l, d, p, w, A].filter((N) => N != null).join(` `); }; -function tz(t) { +function lz(t) { return Buffer.from(JSON.stringify(t)).toString("base64"); } -function rz(t) { +function hz(t) { return JSON.parse(Buffer.from(t, "base64").toString("utf-8")); } -function lc(t) { +function dc(t) { if (!t) throw new Error("No recap provided, value is undefined"); if (!t.att) throw new Error("No `att` property found"); const e = Object.keys(t.att); @@ -16830,72 +16830,72 @@ function lc(t) { }); }); } -function nz(t, e, r, n = {}) { - return r == null || r.sort((i, s) => i.localeCompare(s)), { att: { [t]: iz(e, r, n) } }; +function dz(t, e, r, n = {}) { + return r == null || r.sort((i, s) => i.localeCompare(s)), { att: { [t]: pz(e, r, n) } }; } -function iz(t, e, r = {}) { +function pz(t, e, r = {}) { e = e == null ? void 0 : e.sort((i, s) => i.localeCompare(s)); const n = e.map((i) => ({ [`${t}/${i}`]: [r] })); return Object.assign({}, ...n); } -function U8(t) { - return lc(t), `urn:recap:${tz(t).replace(/=/g, "")}`; +function q8(t) { + return dc(t), `urn:recap:${lz(t).replace(/=/g, "")}`; } -function xl(t) { - const e = rz(t.replace("urn:recap:", "")); - return lc(e), e; +function _l(t) { + const e = hz(t.replace("urn:recap:", "")); + return dc(e), e; } -function sz(t, e, r) { - const n = nz(t, e, r); - return U8(n); +function gz(t, e, r) { + const n = dz(t, e, r); + return q8(n); } -function oz(t) { +function mz(t) { return t && t.includes("urn:recap:"); } -function az(t, e) { - const r = xl(t), n = xl(e), i = cz(r, n); - return U8(i); +function vz(t, e) { + const r = _l(t), n = _l(e), i = bz(r, n); + return q8(i); } -function cz(t, e) { - lc(t), lc(e); +function bz(t, e) { + dc(t), dc(e); const r = Object.keys(t.att).concat(Object.keys(e.att)).sort((i, s) => i.localeCompare(s)), n = { att: {} }; return r.forEach((i) => { var s, o; Object.keys(((s = t.att) == null ? void 0 : s[i]) || {}).concat(Object.keys(((o = e.att) == null ? void 0 : o[i]) || {})).sort((a, u) => a.localeCompare(u)).forEach((a) => { var u, l; - n.att[i] = Zq(Xq({}, n.att[i]), { [a]: ((u = t.att[i]) == null ? void 0 : u[a]) || ((l = e.att[i]) == null ? void 0 : l[a]) }); + n.att[i] = cz(az({}, n.att[i]), { [a]: ((u = t.att[i]) == null ? void 0 : u[a]) || ((l = e.att[i]) == null ? void 0 : l[a]) }); }); }), n; } -function uz(t = "", e) { - lc(e); +function yz(t = "", e) { + dc(e); const r = "I further authorize the stated URI to perform the following actions on my behalf: "; if (t.includes(r)) return t; const n = []; let i = 0; Object.keys(e.att).forEach((a) => { - const u = Object.keys(e.att[a]).map((g) => ({ ability: g.split("/")[0], action: g.split("/")[1] })); - u.sort((g, w) => g.action.localeCompare(w.action)); + const u = Object.keys(e.att[a]).map((p) => ({ ability: p.split("/")[0], action: p.split("/")[1] })); + u.sort((p, w) => p.action.localeCompare(w.action)); const l = {}; - u.forEach((g) => { - l[g.ability] || (l[g.ability] = []), l[g.ability].push(g.action); + u.forEach((p) => { + l[p.ability] || (l[p.ability] = []), l[p.ability].push(p.action); }); - const d = Object.keys(l).map((g) => (i++, `(${i}) '${g}': '${l[g].join("', '")}' for '${a}'.`)); + const d = Object.keys(l).map((p) => (i++, `(${i}) '${p}': '${l[p].join("', '")}' for '${a}'.`)); n.push(d.join(", ").replace(".,", ".")); }); const s = n.join(" "), o = `${r}${s}`; return `${t ? t + " " : ""}${o}`; } -function zx(t) { +function Hx(t) { var e; - const r = xl(t); - lc(r); + const r = _l(t); + dc(r); const n = (e = r.att) == null ? void 0 : e.eip155; return n ? Object.keys(n).map((i) => i.split("/")[1]) : []; } -function Hx(t) { - const e = xl(t); - lc(e); +function Kx(t) { + const e = _l(t); + dc(e); const r = []; return Object.values(e.att).forEach((n) => { Object.values(n).forEach((i) => { @@ -16904,130 +16904,130 @@ function Hx(t) { }); }), [...new Set(r.flat())]; } -function Id(t) { +function Cd(t) { if (!t) return; const e = t == null ? void 0 : t[t.length - 1]; - return oz(e) ? e : void 0; + return mz(e) ? e : void 0; } -const j8 = "base10", oi = "base16", la = "base64pad", Sf = "base64url", Ql = "utf8", q8 = 0, Io = 1, eh = 2, fz = 0, Wx = 1, jf = 12, ob = 32; -function lz() { +const z8 = "base10", ai = "base16", pa = "base64pad", Af = "base64url", eh = "utf8", W8 = 0, Ro = 1, th = 2, wz = 0, Vx = 1, qf = 12, ob = 32; +function xz() { const t = Jv.generateKeyPair(); - return { privateKey: Dn(t.secretKey, oi), publicKey: Dn(t.publicKey, oi) }; + return { privateKey: On(t.secretKey, ai), publicKey: On(t.publicKey, ai) }; } function I1() { - const t = Pa.randomBytes(ob); - return Dn(t, oi); + const t = Ca.randomBytes(ob); + return On(t, ai); } -function hz(t, e) { - const r = Jv.sharedKey(Rn(t, oi), Rn(e, oi), !0), n = new Rj(Gl.SHA256, r).expand(ob); - return Dn(n, oi); +function _z(t, e) { + const r = Jv.sharedKey(Rn(t, ai), Rn(e, ai), !0), n = new UU(Yl.SHA256, r).expand(ob); + return On(n, ai); } -function Cd(t) { - const e = Gl.hash(Rn(t, oi)); - return Dn(e, oi); +function Td(t) { + const e = Yl.hash(Rn(t, ai)); + return On(e, ai); } -function wo(t) { - const e = Gl.hash(Rn(t, Ql)); - return Dn(e, oi); +function Eo(t) { + const e = Yl.hash(Rn(t, eh)); + return On(e, ai); } -function z8(t) { - return Rn(`${t}`, j8); +function H8(t) { + return Rn(`${t}`, z8); } -function hc(t) { - return Number(Dn(t, j8)); +function pc(t) { + return Number(On(t, z8)); } -function dz(t) { - const e = z8(typeof t.type < "u" ? t.type : q8); - if (hc(e) === Io && typeof t.senderPublicKey > "u") throw new Error("Missing sender public key for type 1 envelope"); - const r = typeof t.senderPublicKey < "u" ? Rn(t.senderPublicKey, oi) : void 0, n = typeof t.iv < "u" ? Rn(t.iv, oi) : Pa.randomBytes(jf), i = new Gv.ChaCha20Poly1305(Rn(t.symKey, oi)).seal(n, Rn(t.message, Ql)); - return H8({ type: e, sealed: i, iv: n, senderPublicKey: r, encoding: t.encoding }); +function Ez(t) { + const e = H8(typeof t.type < "u" ? t.type : W8); + if (pc(e) === Ro && typeof t.senderPublicKey > "u") throw new Error("Missing sender public key for type 1 envelope"); + const r = typeof t.senderPublicKey < "u" ? Rn(t.senderPublicKey, ai) : void 0, n = typeof t.iv < "u" ? Rn(t.iv, ai) : Ca.randomBytes(qf), i = new Gv.ChaCha20Poly1305(Rn(t.symKey, ai)).seal(n, Rn(t.message, eh)); + return K8({ type: e, sealed: i, iv: n, senderPublicKey: r, encoding: t.encoding }); } -function pz(t, e) { - const r = z8(eh), n = Pa.randomBytes(jf), i = Rn(t, Ql); - return H8({ type: r, sealed: i, iv: n, encoding: e }); +function Sz(t, e) { + const r = H8(th), n = Ca.randomBytes(qf), i = Rn(t, eh); + return K8({ type: r, sealed: i, iv: n, encoding: e }); } -function gz(t) { - const e = new Gv.ChaCha20Poly1305(Rn(t.symKey, oi)), { sealed: r, iv: n } = _l({ encoded: t.encoded, encoding: t == null ? void 0 : t.encoding }), i = e.open(n, r); +function Az(t) { + const e = new Gv.ChaCha20Poly1305(Rn(t.symKey, ai)), { sealed: r, iv: n } = El({ encoded: t.encoded, encoding: t == null ? void 0 : t.encoding }), i = e.open(n, r); if (i === null) throw new Error("Failed to decrypt"); - return Dn(i, Ql); + return On(i, eh); } -function mz(t, e) { - const { sealed: r } = _l({ encoded: t, encoding: e }); - return Dn(r, Ql); +function Pz(t, e) { + const { sealed: r } = El({ encoded: t, encoding: e }); + return On(r, eh); } -function H8(t) { - const { encoding: e = la } = t; - if (hc(t.type) === eh) return Dn(Ed([t.type, t.sealed]), e); - if (hc(t.type) === Io) { +function K8(t) { + const { encoding: e = pa } = t; + if (pc(t.type) === th) return On(Sd([t.type, t.sealed]), e); + if (pc(t.type) === Ro) { if (typeof t.senderPublicKey > "u") throw new Error("Missing sender public key for type 1 envelope"); - return Dn(Ed([t.type, t.senderPublicKey, t.iv, t.sealed]), e); + return On(Sd([t.type, t.senderPublicKey, t.iv, t.sealed]), e); } - return Dn(Ed([t.type, t.iv, t.sealed]), e); + return On(Sd([t.type, t.iv, t.sealed]), e); } -function _l(t) { - const { encoded: e, encoding: r = la } = t, n = Rn(e, r), i = n.slice(fz, Wx), s = Wx; - if (hc(i) === Io) { - const l = s + ob, d = l + jf, g = n.slice(s, l), w = n.slice(l, d), A = n.slice(d); - return { type: i, sealed: A, iv: w, senderPublicKey: g }; +function El(t) { + const { encoded: e, encoding: r = pa } = t, n = Rn(e, r), i = n.slice(wz, Vx), s = Vx; + if (pc(i) === Ro) { + const l = s + ob, d = l + qf, p = n.slice(s, l), w = n.slice(l, d), A = n.slice(d); + return { type: i, sealed: A, iv: w, senderPublicKey: p }; } - if (hc(i) === eh) { - const l = n.slice(s), d = Pa.randomBytes(jf); + if (pc(i) === th) { + const l = n.slice(s), d = Ca.randomBytes(qf); return { type: i, sealed: l, iv: d }; } - const o = s + jf, a = n.slice(s, o), u = n.slice(o); + const o = s + qf, a = n.slice(s, o), u = n.slice(o); return { type: i, sealed: u, iv: a }; } -function vz(t, e) { - const r = _l({ encoded: t, encoding: e == null ? void 0 : e.encoding }); - return W8({ type: hc(r.type), senderPublicKey: typeof r.senderPublicKey < "u" ? Dn(r.senderPublicKey, oi) : void 0, receiverPublicKey: e == null ? void 0 : e.receiverPublicKey }); +function Mz(t, e) { + const r = El({ encoded: t, encoding: e == null ? void 0 : e.encoding }); + return V8({ type: pc(r.type), senderPublicKey: typeof r.senderPublicKey < "u" ? On(r.senderPublicKey, ai) : void 0, receiverPublicKey: e == null ? void 0 : e.receiverPublicKey }); } -function W8(t) { - const e = (t == null ? void 0 : t.type) || q8; - if (e === Io) { +function V8(t) { + const e = (t == null ? void 0 : t.type) || W8; + if (e === Ro) { if (typeof (t == null ? void 0 : t.senderPublicKey) > "u") throw new Error("missing sender public key"); if (typeof (t == null ? void 0 : t.receiverPublicKey) > "u") throw new Error("missing receiver public key"); } return { type: e, senderPublicKey: t == null ? void 0 : t.senderPublicKey, receiverPublicKey: t == null ? void 0 : t.receiverPublicKey }; } -function Kx(t) { - return t.type === Io && typeof t.senderPublicKey == "string" && typeof t.receiverPublicKey == "string"; +function Gx(t) { + return t.type === Ro && typeof t.senderPublicKey == "string" && typeof t.receiverPublicKey == "string"; } -function Vx(t) { - return t.type === eh; +function Yx(t) { + return t.type === th; } -function bz(t) { - return new x8.ec("p256").keyFromPublic({ x: Buffer.from(t.x, "base64").toString("hex"), y: Buffer.from(t.y, "base64").toString("hex") }, "hex"); +function Iz(t) { + return new E8.ec("p256").keyFromPublic({ x: Buffer.from(t.x, "base64").toString("hex"), y: Buffer.from(t.y, "base64").toString("hex") }, "hex"); } -function yz(t) { +function Cz(t) { let e = t.replace(/-/g, "+").replace(/_/g, "/"); const r = e.length % 4; return r > 0 && (e += "=".repeat(4 - r)), e; } -function wz(t) { - return Buffer.from(yz(t), "base64"); +function Tz(t) { + return Buffer.from(Cz(t), "base64"); } -function xz(t, e) { - const [r, n, i] = t.split("."), s = wz(i); +function Rz(t, e) { + const [r, n, i] = t.split("."), s = Tz(i); if (s.length !== 64) throw new Error("Invalid signature length"); - const o = s.slice(0, 32).toString("hex"), a = s.slice(32, 64).toString("hex"), u = `${r}.${n}`, l = new Gl.SHA256().update(Buffer.from(u)).digest(), d = bz(e), g = Buffer.from(l).toString("hex"); - if (!d.verify(g, { r: o, s: a })) throw new Error("Invalid signature"); + const o = s.slice(0, 32).toString("hex"), a = s.slice(32, 64).toString("hex"), u = `${r}.${n}`, l = new Yl.SHA256().update(Buffer.from(u)).digest(), d = Iz(e), p = Buffer.from(l).toString("hex"); + if (!d.verify(p, { r: o, s: a })) throw new Error("Invalid signature"); return v1(t).payload; } -const _z = "irn"; +const Dz = "irn"; function C1(t) { - return (t == null ? void 0 : t.relay) || { protocol: _z }; + return (t == null ? void 0 : t.relay) || { protocol: Dz }; } -function $f(t) { - const e = _q[t]; +function Bf(t) { + const e = Dq[t]; if (typeof e > "u") throw new Error(`Relay Protocol not supported: ${t}`); return e; } -var Ez = Object.defineProperty, Sz = Object.defineProperties, Az = Object.getOwnPropertyDescriptors, Gx = Object.getOwnPropertySymbols, Pz = Object.prototype.hasOwnProperty, Mz = Object.prototype.propertyIsEnumerable, Yx = (t, e, r) => e in t ? Ez(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Jx = (t, e) => { - for (var r in e || (e = {})) Pz.call(e, r) && Yx(t, r, e[r]); - if (Gx) for (var r of Gx(e)) Mz.call(e, r) && Yx(t, r, e[r]); +var Oz = Object.defineProperty, Nz = Object.defineProperties, Lz = Object.getOwnPropertyDescriptors, Jx = Object.getOwnPropertySymbols, kz = Object.prototype.hasOwnProperty, $z = Object.prototype.propertyIsEnumerable, Xx = (t, e, r) => e in t ? Oz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Zx = (t, e) => { + for (var r in e || (e = {})) kz.call(e, r) && Xx(t, r, e[r]); + if (Jx) for (var r of Jx(e)) $z.call(e, r) && Xx(t, r, e[r]); return t; -}, Iz = (t, e) => Sz(t, Az(e)); -function Cz(t, e = "-") { +}, Bz = (t, e) => Nz(t, Lz(e)); +function Fz(t, e = "-") { const r = {}, n = "relay" + e; return Object.keys(t).forEach((i) => { if (i.startsWith(n)) { @@ -17036,54 +17036,54 @@ function Cz(t, e = "-") { } }), r; } -function Xx(t) { +function Qx(t) { if (!t.includes("wc:")) { - const u = F8(t); + const u = j8(t); u != null && u.includes("wc:") && (t = u); } t = t.includes("wc://") ? t.replace("wc://", "") : t, t = t.includes("wc:") ? t.replace("wc:", "") : t; - const e = t.indexOf(":"), r = t.indexOf("?") !== -1 ? t.indexOf("?") : void 0, n = t.substring(0, e), i = t.substring(e + 1, r).split("@"), s = typeof r < "u" ? t.substring(r) : "", o = wl.parse(s), a = typeof o.methods == "string" ? o.methods.split(",") : void 0; - return { protocol: n, topic: Tz(i[0]), version: parseInt(i[1], 10), symKey: o.symKey, relay: Cz(o), methods: a, expiryTimestamp: o.expiryTimestamp ? parseInt(o.expiryTimestamp, 10) : void 0 }; + const e = t.indexOf(":"), r = t.indexOf("?") !== -1 ? t.indexOf("?") : void 0, n = t.substring(0, e), i = t.substring(e + 1, r).split("@"), s = typeof r < "u" ? t.substring(r) : "", o = xl.parse(s), a = typeof o.methods == "string" ? o.methods.split(",") : void 0; + return { protocol: n, topic: jz(i[0]), version: parseInt(i[1], 10), symKey: o.symKey, relay: Fz(o), methods: a, expiryTimestamp: o.expiryTimestamp ? parseInt(o.expiryTimestamp, 10) : void 0 }; } -function Tz(t) { +function jz(t) { return t.startsWith("//") ? t.substring(2) : t; } -function Rz(t, e = "-") { +function Uz(t, e = "-") { const r = "relay", n = {}; return Object.keys(t).forEach((i) => { const s = r + e + i; t[i] && (n[s] = t[i]); }), n; } -function Zx(t) { - return `${t.protocol}:${t.topic}@${t.version}?` + wl.stringify(Jx(Iz(Jx({ symKey: t.symKey }, Rz(t.relay)), { expiryTimestamp: t.expiryTimestamp }), t.methods ? { methods: t.methods.join(",") } : {})); +function e3(t) { + return `${t.protocol}:${t.topic}@${t.version}?` + xl.stringify(Zx(Bz(Zx({ symKey: t.symKey }, Uz(t.relay)), { expiryTimestamp: t.expiryTimestamp }), t.methods ? { methods: t.methods.join(",") } : {})); } -function ud(t, e, r) { +function fd(t, e, r) { return `${t}?wc_ev=${r}&topic=${e}`; } -function qu(t) { +function zu(t) { const e = []; return t.forEach((r) => { const [n, i] = r.split(":"); e.push(`${n}:${i}`); }), e; } -function Dz(t) { +function qz(t) { const e = []; return Object.values(t).forEach((r) => { - e.push(...qu(r.accounts)); + e.push(...zu(r.accounts)); }), e; } -function Oz(t, e) { +function zz(t, e) { const r = []; return Object.values(t).forEach((n) => { - qu(n.accounts).includes(e) && r.push(...n.methods); + zu(n.accounts).includes(e) && r.push(...n.methods); }), r; } -function Nz(t, e) { +function Wz(t, e) { const r = []; return Object.values(t).forEach((n) => { - qu(n.accounts).includes(e) && r.push(...n.events); + zu(n.accounts).includes(e) && r.push(...n.events); }), r; } function ab(t) { @@ -17092,65 +17092,65 @@ function ab(t) { function Ff(t) { return ab(t) ? t.split(":")[0] : t; } -function Lz(t) { +function Hz(t) { const e = {}; return t == null || t.forEach((r) => { const [n, i] = r.split(":"); e[n] || (e[n] = { accounts: [], chains: [], events: [] }), e[n].accounts.push(r), e[n].chains.push(`${n}:${i}`); }), e; } -function Qx(t, e) { +function t3(t, e) { e = e.map((n) => n.replace("did:pkh:", "")); - const r = Lz(e); - for (const [n, i] of Object.entries(r)) i.methods ? i.methods = Md(i.methods, t) : i.methods = t, i.events = ["chainChanged", "accountsChanged"]; + const r = Hz(e); + for (const [n, i] of Object.entries(r)) i.methods ? i.methods = Id(i.methods, t) : i.methods = t, i.events = ["chainChanged", "accountsChanged"]; return r; } -const kz = { INVALID_METHOD: { message: "Invalid method.", code: 1001 }, INVALID_EVENT: { message: "Invalid event.", code: 1002 }, INVALID_UPDATE_REQUEST: { message: "Invalid update request.", code: 1003 }, INVALID_EXTEND_REQUEST: { message: "Invalid extend request.", code: 1004 }, INVALID_SESSION_SETTLE_REQUEST: { message: "Invalid session settle request.", code: 1005 }, UNAUTHORIZED_METHOD: { message: "Unauthorized method.", code: 3001 }, UNAUTHORIZED_EVENT: { message: "Unauthorized event.", code: 3002 }, UNAUTHORIZED_UPDATE_REQUEST: { message: "Unauthorized update request.", code: 3003 }, UNAUTHORIZED_EXTEND_REQUEST: { message: "Unauthorized extend request.", code: 3004 }, USER_REJECTED: { message: "User rejected.", code: 5e3 }, USER_REJECTED_CHAINS: { message: "User rejected chains.", code: 5001 }, USER_REJECTED_METHODS: { message: "User rejected methods.", code: 5002 }, USER_REJECTED_EVENTS: { message: "User rejected events.", code: 5003 }, UNSUPPORTED_CHAINS: { message: "Unsupported chains.", code: 5100 }, UNSUPPORTED_METHODS: { message: "Unsupported methods.", code: 5101 }, UNSUPPORTED_EVENTS: { message: "Unsupported events.", code: 5102 }, UNSUPPORTED_ACCOUNTS: { message: "Unsupported accounts.", code: 5103 }, UNSUPPORTED_NAMESPACE_KEY: { message: "Unsupported namespace key.", code: 5104 }, USER_DISCONNECTED: { message: "User disconnected.", code: 6e3 }, SESSION_SETTLEMENT_FAILED: { message: "Session settlement failed.", code: 7e3 }, WC_METHOD_UNSUPPORTED: { message: "Unsupported wc_ method.", code: 10001 } }, $z = { NOT_INITIALIZED: { message: "Not initialized.", code: 1 }, NO_MATCHING_KEY: { message: "No matching key.", code: 2 }, RESTORE_WILL_OVERRIDE: { message: "Restore will override.", code: 3 }, RESUBSCRIBED: { message: "Resubscribed.", code: 4 }, MISSING_OR_INVALID: { message: "Missing or invalid.", code: 5 }, EXPIRED: { message: "Expired.", code: 6 }, UNKNOWN_TYPE: { message: "Unknown type.", code: 7 }, MISMATCHED_TOPIC: { message: "Mismatched topic.", code: 8 }, NON_CONFORMING_NAMESPACES: { message: "Non conforming namespaces.", code: 9 } }; +const Kz = { INVALID_METHOD: { message: "Invalid method.", code: 1001 }, INVALID_EVENT: { message: "Invalid event.", code: 1002 }, INVALID_UPDATE_REQUEST: { message: "Invalid update request.", code: 1003 }, INVALID_EXTEND_REQUEST: { message: "Invalid extend request.", code: 1004 }, INVALID_SESSION_SETTLE_REQUEST: { message: "Invalid session settle request.", code: 1005 }, UNAUTHORIZED_METHOD: { message: "Unauthorized method.", code: 3001 }, UNAUTHORIZED_EVENT: { message: "Unauthorized event.", code: 3002 }, UNAUTHORIZED_UPDATE_REQUEST: { message: "Unauthorized update request.", code: 3003 }, UNAUTHORIZED_EXTEND_REQUEST: { message: "Unauthorized extend request.", code: 3004 }, USER_REJECTED: { message: "User rejected.", code: 5e3 }, USER_REJECTED_CHAINS: { message: "User rejected chains.", code: 5001 }, USER_REJECTED_METHODS: { message: "User rejected methods.", code: 5002 }, USER_REJECTED_EVENTS: { message: "User rejected events.", code: 5003 }, UNSUPPORTED_CHAINS: { message: "Unsupported chains.", code: 5100 }, UNSUPPORTED_METHODS: { message: "Unsupported methods.", code: 5101 }, UNSUPPORTED_EVENTS: { message: "Unsupported events.", code: 5102 }, UNSUPPORTED_ACCOUNTS: { message: "Unsupported accounts.", code: 5103 }, UNSUPPORTED_NAMESPACE_KEY: { message: "Unsupported namespace key.", code: 5104 }, USER_DISCONNECTED: { message: "User disconnected.", code: 6e3 }, SESSION_SETTLEMENT_FAILED: { message: "Session settlement failed.", code: 7e3 }, WC_METHOD_UNSUPPORTED: { message: "Unsupported wc_ method.", code: 10001 } }, Vz = { NOT_INITIALIZED: { message: "Not initialized.", code: 1 }, NO_MATCHING_KEY: { message: "No matching key.", code: 2 }, RESTORE_WILL_OVERRIDE: { message: "Restore will override.", code: 3 }, RESUBSCRIBED: { message: "Resubscribed.", code: 4 }, MISSING_OR_INVALID: { message: "Missing or invalid.", code: 5 }, EXPIRED: { message: "Expired.", code: 6 }, UNKNOWN_TYPE: { message: "Unknown type.", code: 7 }, MISMATCHED_TOPIC: { message: "Mismatched topic.", code: 8 }, NON_CONFORMING_NAMESPACES: { message: "Non conforming namespaces.", code: 9 } }; function ft(t, e) { - const { message: r, code: n } = $z[t]; + const { message: r, code: n } = Vz[t]; return { message: e ? `${r} ${e}` : r, code: n }; } function Or(t, e) { - const { message: r, code: n } = kz[t]; + const { message: r, code: n } = Kz[t]; return { message: e ? `${r} ${e}` : r, code: n }; } -function dc(t, e) { +function gc(t, e) { return !!Array.isArray(t); } -function El(t) { +function Sl(t) { return Object.getPrototypeOf(t) === Object.prototype && Object.keys(t).length; } -function gi(t) { +function mi(t) { return typeof t > "u"; } function dn(t, e) { - return e && gi(t) ? !0 : typeof t == "string" && !!t.trim().length; + return e && mi(t) ? !0 : typeof t == "string" && !!t.trim().length; } function cb(t, e) { return typeof t == "number" && !isNaN(t); } -function Fz(t, e) { +function Gz(t, e) { const { requiredNamespaces: r } = e, n = Object.keys(t.namespaces), i = Object.keys(r); let s = !0; - return tc(i, n) ? (n.forEach((o) => { - const { accounts: a, methods: u, events: l } = t.namespaces[o], d = qu(a), g = r[o]; - (!tc(R8(o, g), d) || !tc(g.methods, u) || !tc(g.events, l)) && (s = !1); + return nc(i, n) ? (n.forEach((o) => { + const { accounts: a, methods: u, events: l } = t.namespaces[o], d = zu(a), p = r[o]; + (!nc(O8(o, p), d) || !nc(p.methods, u) || !nc(p.events, l)) && (s = !1); }), s) : !1; } -function u0(t) { +function f0(t) { return dn(t, !1) && t.includes(":") ? t.split(":").length === 2 : !1; } -function Bz(t) { +function Yz(t) { if (dn(t, !1) && t.includes(":")) { const e = t.split(":"); if (e.length === 3) { const r = e[0] + ":" + e[1]; - return !!e[2] && u0(r); + return !!e[2] && f0(r); } } return !1; } -function Uz(t) { +function Jz(t) { function e(r) { try { return typeof new URL(r) < "u"; @@ -17161,142 +17161,142 @@ function Uz(t) { try { if (dn(t, !1)) { if (e(t)) return !0; - const r = F8(t); + const r = j8(t); return e(r); } } catch { } return !1; } -function jz(t) { +function Xz(t) { var e; return (e = t == null ? void 0 : t.proposer) == null ? void 0 : e.publicKey; } -function qz(t) { +function Zz(t) { return t == null ? void 0 : t.topic; } -function zz(t, e) { +function Qz(t, e) { let r = null; return dn(t == null ? void 0 : t.publicKey, !1) || (r = ft("MISSING_OR_INVALID", `${e} controller public key should be a string`)), r; } -function e3(t) { +function r3(t) { let e = !0; - return dc(t) ? t.length && (e = t.every((r) => dn(r, !1))) : e = !1, e; + return gc(t) ? t.length && (e = t.every((r) => dn(r, !1))) : e = !1, e; } -function Hz(t, e, r) { +function eW(t, e, r) { let n = null; - return dc(e) && e.length ? e.forEach((i) => { - n || u0(i) || (n = Or("UNSUPPORTED_CHAINS", `${r}, chain ${i} should be a string and conform to "namespace:chainId" format`)); - }) : u0(t) || (n = Or("UNSUPPORTED_CHAINS", `${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)), n; + return gc(e) && e.length ? e.forEach((i) => { + n || f0(i) || (n = Or("UNSUPPORTED_CHAINS", `${r}, chain ${i} should be a string and conform to "namespace:chainId" format`)); + }) : f0(t) || (n = Or("UNSUPPORTED_CHAINS", `${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)), n; } -function Wz(t, e, r) { +function tW(t, e, r) { let n = null; return Object.entries(t).forEach(([i, s]) => { if (n) return; - const o = Hz(i, R8(i, s), `${e} ${r}`); + const o = eW(i, O8(i, s), `${e} ${r}`); o && (n = o); }), n; } -function Kz(t, e) { +function rW(t, e) { let r = null; - return dc(t) ? t.forEach((n) => { - r || Bz(n) || (r = Or("UNSUPPORTED_ACCOUNTS", `${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`)); + return gc(t) ? t.forEach((n) => { + r || Yz(n) || (r = Or("UNSUPPORTED_ACCOUNTS", `${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`)); }) : r = Or("UNSUPPORTED_ACCOUNTS", `${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`), r; } -function Vz(t, e) { +function nW(t, e) { let r = null; return Object.values(t).forEach((n) => { if (r) return; - const i = Kz(n == null ? void 0 : n.accounts, `${e} namespace`); + const i = rW(n == null ? void 0 : n.accounts, `${e} namespace`); i && (r = i); }), r; } -function Gz(t, e) { +function iW(t, e) { let r = null; - return e3(t == null ? void 0 : t.methods) ? e3(t == null ? void 0 : t.events) || (r = Or("UNSUPPORTED_EVENTS", `${e}, events should be an array of strings or empty array for no events`)) : r = Or("UNSUPPORTED_METHODS", `${e}, methods should be an array of strings or empty array for no methods`), r; + return r3(t == null ? void 0 : t.methods) ? r3(t == null ? void 0 : t.events) || (r = Or("UNSUPPORTED_EVENTS", `${e}, events should be an array of strings or empty array for no events`)) : r = Or("UNSUPPORTED_METHODS", `${e}, methods should be an array of strings or empty array for no methods`), r; } -function K8(t, e) { +function G8(t, e) { let r = null; return Object.values(t).forEach((n) => { if (r) return; - const i = Gz(n, `${e}, namespace`); + const i = iW(n, `${e}, namespace`); i && (r = i); }), r; } -function Yz(t, e, r) { +function sW(t, e, r) { let n = null; - if (t && El(t)) { - const i = K8(t, e); + if (t && Sl(t)) { + const i = G8(t, e); i && (n = i); - const s = Wz(t, e, r); + const s = tW(t, e, r); s && (n = s); } else n = ft("MISSING_OR_INVALID", `${e}, ${r} should be an object with data`); return n; } function hm(t, e) { let r = null; - if (t && El(t)) { - const n = K8(t, e); + if (t && Sl(t)) { + const n = G8(t, e); n && (r = n); - const i = Vz(t, e); + const i = nW(t, e); i && (r = i); } else r = ft("MISSING_OR_INVALID", `${e}, namespaces should be an object with data`); return r; } -function V8(t) { +function Y8(t) { return dn(t.protocol, !0); } -function Jz(t, e) { +function oW(t, e) { let r = !1; - return t ? t && dc(t) && t.length && t.forEach((n) => { - r = V8(n); + return t ? t && gc(t) && t.length && t.forEach((n) => { + r = Y8(n); }) : r = !0, r; } -function Xz(t) { +function aW(t) { return typeof t == "number"; } -function pi(t) { +function gi(t) { return typeof t < "u" && typeof t !== null; } -function Zz(t) { +function cW(t) { return !(!t || typeof t != "object" || !t.code || !cb(t.code) || !t.message || !dn(t.message, !1)); } -function Qz(t) { - return !(gi(t) || !dn(t.method, !1)); +function uW(t) { + return !(mi(t) || !dn(t.method, !1)); } -function eH(t) { - return !(gi(t) || gi(t.result) && gi(t.error) || !cb(t.id) || !dn(t.jsonrpc, !1)); +function fW(t) { + return !(mi(t) || mi(t.result) && mi(t.error) || !cb(t.id) || !dn(t.jsonrpc, !1)); } -function tH(t) { - return !(gi(t) || !dn(t.name, !1)); +function lW(t) { + return !(mi(t) || !dn(t.name, !1)); } -function t3(t, e) { - return !(!u0(e) || !Dz(t).includes(e)); +function n3(t, e) { + return !(!f0(e) || !qz(t).includes(e)); } -function rH(t, e, r) { - return dn(r, !1) ? Oz(t, e).includes(r) : !1; +function hW(t, e, r) { + return dn(r, !1) ? zz(t, e).includes(r) : !1; } -function nH(t, e, r) { - return dn(r, !1) ? Nz(t, e).includes(r) : !1; +function dW(t, e, r) { + return dn(r, !1) ? Wz(t, e).includes(r) : !1; } -function r3(t, e, r) { +function i3(t, e, r) { let n = null; - const i = iH(t), s = sH(e), o = Object.keys(i), a = Object.keys(s), u = n3(Object.keys(t)), l = n3(Object.keys(e)), d = u.filter((g) => !l.includes(g)); + const i = pW(t), s = gW(e), o = Object.keys(i), a = Object.keys(s), u = s3(Object.keys(t)), l = s3(Object.keys(e)), d = u.filter((p) => !l.includes(p)); return d.length && (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces keys don't satisfy requiredNamespaces. Required: ${d.toString()} - Received: ${Object.keys(e).toString()}`)), tc(o, a) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces chains don't satisfy required namespaces. + Received: ${Object.keys(e).toString()}`)), nc(o, a) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} - Approved: ${a.toString()}`)), Object.keys(e).forEach((g) => { - if (!g.includes(":") || n) return; - const w = qu(e[g].accounts); - w.includes(g) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces accounts don't satisfy namespace accounts for ${g} - Required: ${g} + Approved: ${a.toString()}`)), Object.keys(e).forEach((p) => { + if (!p.includes(":") || n) return; + const w = zu(e[p].accounts); + w.includes(p) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces accounts don't satisfy namespace accounts for ${p} + Required: ${p} Approved: ${w.toString()}`)); - }), o.forEach((g) => { - n || (tc(i[g].methods, s[g].methods) ? tc(i[g].events, s[g].events) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces events don't satisfy namespace events for ${g}`)) : n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces methods don't satisfy namespace methods for ${g}`)); + }), o.forEach((p) => { + n || (nc(i[p].methods, s[p].methods) ? nc(i[p].events, s[p].events) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces events don't satisfy namespace events for ${p}`)) : n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces methods don't satisfy namespace methods for ${p}`)); }), n; } -function iH(t) { +function pW(t) { const e = {}; return Object.keys(t).forEach((r) => { var n; @@ -17305,73 +17305,73 @@ function iH(t) { }); }), e; } -function n3(t) { +function s3(t) { return [...new Set(t.map((e) => e.includes(":") ? e.split(":")[0] : e))]; } -function sH(t) { +function gW(t) { const e = {}; return Object.keys(t).forEach((r) => { if (r.includes(":")) e[r] = t[r]; else { - const n = qu(t[r].accounts); + const n = zu(t[r].accounts); n == null || n.forEach((i) => { e[i] = { accounts: t[r].accounts.filter((s) => s.includes(`${i}:`)), methods: t[r].methods, events: t[r].events }; }); } }), e; } -function oH(t, e) { +function mW(t, e) { return cb(t) && t <= e.max && t >= e.min; } -function i3() { - const t = Zl(); +function o3() { + const t = Ql(); return new Promise((e) => { switch (t) { - case Ri.browser: - e(aH()); + case Di.browser: + e(vW()); break; - case Ri.reactNative: - e(cH()); + case Di.reactNative: + e(bW()); break; - case Ri.node: - e(uH()); + case Di.node: + e(yW()); break; default: e(!0); } }); } -function aH() { - return Xl() && (navigator == null ? void 0 : navigator.onLine); +function vW() { + return Zl() && (navigator == null ? void 0 : navigator.onLine); } -async function cH() { - if (ju() && typeof global < "u" && global != null && global.NetInfo) { +async function bW() { + if (qu() && typeof global < "u" && global != null && global.NetInfo) { const t = await (global == null ? void 0 : global.NetInfo.fetch()); return t == null ? void 0 : t.isConnected; } return !0; } -function uH() { +function yW() { return !0; } -function fH(t) { - switch (Zl()) { - case Ri.browser: - lH(t); +function wW(t) { + switch (Ql()) { + case Di.browser: + xW(t); break; - case Ri.reactNative: - hH(t); + case Di.reactNative: + _W(t); break; } } -function lH(t) { - !ju() && Xl() && (window.addEventListener("online", () => t(!0)), window.addEventListener("offline", () => t(!1))); +function xW(t) { + !qu() && Zl() && (window.addEventListener("online", () => t(!0)), window.addEventListener("offline", () => t(!1))); } -function hH(t) { - ju() && typeof global < "u" && global != null && global.NetInfo && (global == null || global.NetInfo.addEventListener((e) => t(e == null ? void 0 : e.isConnected))); +function _W(t) { + qu() && typeof global < "u" && global != null && global.NetInfo && (global == null || global.NetInfo.addEventListener((e) => t(e == null ? void 0 : e.isConnected))); } const dm = {}; -class Af { +class Pf { static get(e) { return dm[e]; } @@ -17382,146 +17382,146 @@ class Af { delete dm[e]; } } -const dH = "PARSE_ERROR", pH = "INVALID_REQUEST", gH = "METHOD_NOT_FOUND", mH = "INVALID_PARAMS", G8 = "INTERNAL_ERROR", ub = "SERVER_ERROR", vH = [-32700, -32600, -32601, -32602, -32603], qf = { - [dH]: { code: -32700, message: "Parse error" }, - [pH]: { code: -32600, message: "Invalid Request" }, - [gH]: { code: -32601, message: "Method not found" }, - [mH]: { code: -32602, message: "Invalid params" }, - [G8]: { code: -32603, message: "Internal error" }, +const EW = "PARSE_ERROR", SW = "INVALID_REQUEST", AW = "METHOD_NOT_FOUND", PW = "INVALID_PARAMS", J8 = "INTERNAL_ERROR", ub = "SERVER_ERROR", MW = [-32700, -32600, -32601, -32602, -32603], zf = { + [EW]: { code: -32700, message: "Parse error" }, + [SW]: { code: -32600, message: "Invalid Request" }, + [AW]: { code: -32601, message: "Method not found" }, + [PW]: { code: -32602, message: "Invalid params" }, + [J8]: { code: -32603, message: "Internal error" }, [ub]: { code: -32e3, message: "Server error" } -}, Y8 = ub; -function bH(t) { - return vH.includes(t); +}, X8 = ub; +function IW(t) { + return MW.includes(t); } -function s3(t) { - return Object.keys(qf).includes(t) ? qf[t] : qf[Y8]; +function a3(t) { + return Object.keys(zf).includes(t) ? zf[t] : zf[X8]; } -function yH(t) { - const e = Object.values(qf).find((r) => r.code === t); - return e || qf[Y8]; +function CW(t) { + const e = Object.values(zf).find((r) => r.code === t); + return e || zf[X8]; } -function J8(t, e, r) { +function Z8(t, e, r) { return t.message.includes("getaddrinfo ENOTFOUND") || t.message.includes("connect ECONNREFUSED") ? new Error(`Unavailable ${r} RPC url at ${e}`) : t; } -var X8 = {}, go = {}, o3; -function wH() { - if (o3) return go; - o3 = 1, Object.defineProperty(go, "__esModule", { value: !0 }), go.isBrowserCryptoAvailable = go.getSubtleCrypto = go.getBrowerCrypto = void 0; +var Q8 = {}, bo = {}, c3; +function TW() { + if (c3) return bo; + c3 = 1, Object.defineProperty(bo, "__esModule", { value: !0 }), bo.isBrowserCryptoAvailable = bo.getSubtleCrypto = bo.getBrowerCrypto = void 0; function t() { return (gn == null ? void 0 : gn.crypto) || (gn == null ? void 0 : gn.msCrypto) || {}; } - go.getBrowerCrypto = t; + bo.getBrowerCrypto = t; function e() { const n = t(); return n.subtle || n.webkitSubtle; } - go.getSubtleCrypto = e; + bo.getSubtleCrypto = e; function r() { return !!t() && !!e(); } - return go.isBrowserCryptoAvailable = r, go; + return bo.isBrowserCryptoAvailable = r, bo; } -var mo = {}, a3; -function xH() { - if (a3) return mo; - a3 = 1, Object.defineProperty(mo, "__esModule", { value: !0 }), mo.isBrowser = mo.isNode = mo.isReactNative = void 0; +var yo = {}, u3; +function RW() { + if (u3) return yo; + u3 = 1, Object.defineProperty(yo, "__esModule", { value: !0 }), yo.isBrowser = yo.isNode = yo.isReactNative = void 0; function t() { return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative"; } - mo.isReactNative = t; + yo.isReactNative = t; function e() { return typeof process < "u" && typeof process.versions < "u" && typeof process.versions.node < "u"; } - mo.isNode = e; + yo.isNode = e; function r() { return !t() && !e(); } - return mo.isBrowser = r, mo; + return yo.isBrowser = r, yo; } (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - const e = Bl; - e.__exportStar(wH(), t), e.__exportStar(xH(), t); -})(X8); -function ca(t = 3) { + const e = jl; + e.__exportStar(TW(), t), e.__exportStar(RW(), t); +})(Q8); +function la(t = 3) { const e = Date.now() * Math.pow(10, t), r = Math.floor(Math.random() * Math.pow(10, t)); return e + r; } -function rc(t = 6) { - return BigInt(ca(t)); +function ic(t = 6) { + return BigInt(la(t)); } -function ha(t, e, r) { +function ga(t, e, r) { return { - id: r || ca(), + id: r || la(), jsonrpc: "2.0", method: t, params: e }; } -function tp(t, e) { +function rp(t, e) { return { id: t, jsonrpc: "2.0", result: e }; } -function rp(t, e, r) { +function np(t, e, r) { return { id: t, jsonrpc: "2.0", - error: _H(e) + error: DW(e) }; } -function _H(t, e) { - return typeof t > "u" ? s3(G8) : (typeof t == "string" && (t = Object.assign(Object.assign({}, s3(ub)), { message: t })), bH(t.code) && (t = yH(t.code)), t); +function DW(t, e) { + return typeof t > "u" ? a3(J8) : (typeof t == "string" && (t = Object.assign(Object.assign({}, a3(ub)), { message: t })), IW(t.code) && (t = CW(t.code)), t); } -let EH = class { -}, SH = class extends EH { +let OW = class { +}, NW = class extends OW { constructor() { super(); } -}, AH = class extends SH { +}, LW = class extends NW { constructor(e) { super(); } }; -const PH = "^https?:", MH = "^wss?:"; -function IH(t) { +const kW = "^https?:", $W = "^wss?:"; +function BW(t) { const e = t.match(new RegExp(/^\w+:/, "gi")); if (!(!e || !e.length)) return e[0]; } -function Z8(t, e) { - const r = IH(t); +function eE(t, e) { + const r = BW(t); return typeof r > "u" ? !1 : new RegExp(e).test(r); } -function c3(t) { - return Z8(t, PH); +function f3(t) { + return eE(t, kW); } -function u3(t) { - return Z8(t, MH); +function l3(t) { + return eE(t, $W); } -function CH(t) { +function FW(t) { return new RegExp("wss?://localhost(:d{2,5})?").test(t); } -function Q8(t) { +function tE(t) { return typeof t == "object" && "id" in t && "jsonrpc" in t && t.jsonrpc === "2.0"; } function fb(t) { - return Q8(t) && "method" in t; + return tE(t) && "method" in t; } -function np(t) { - return Q8(t) && (Bs(t) || Zi(t)); +function ip(t) { + return tE(t) && (js(t) || Qi(t)); } -function Bs(t) { +function js(t) { return "result" in t; } -function Zi(t) { +function Qi(t) { return "error" in t; } -let as = class extends AH { +let cs = class extends LW { constructor(e) { - super(e), this.events = new rs.EventEmitter(), this.hasRegisteredEventListeners = !1, this.connection = this.setConnection(e), this.connection.connected && this.registerEventListeners(); + super(e), this.events = new ns.EventEmitter(), this.hasRegisteredEventListeners = !1, this.connection = this.setConnection(e), this.connection.connected && this.registerEventListeners(); } async connect(e = this.connection) { await this.open(e); @@ -17542,7 +17542,7 @@ let as = class extends AH { this.events.removeListener(e, r); } async request(e, r) { - return this.requestStrict(ha(e.method, e.params || [], e.id || rc().toString()), r); + return this.requestStrict(ga(e.method, e.params || [], e.id || ic().toString()), r); } async requestStrict(e, r) { return new Promise(async (n, i) => { @@ -17552,7 +17552,7 @@ let as = class extends AH { i(s); } this.events.on(`${e.id}`, (s) => { - Zi(s) ? i(s.error) : n(s.result); + Qi(s) ? i(s.error) : n(s.result); }); try { await this.connection.send(e, r); @@ -17565,7 +17565,7 @@ let as = class extends AH { return e; } onPayload(e) { - this.events.emit("payload", e), np(e) ? this.events.emit(`${e.id}`, e) : this.events.emit("message", { type: e.method, data: e.params }); + this.events.emit("payload", e), ip(e) ? this.events.emit(`${e.id}`, e) : this.events.emit("message", { type: e.method, data: e.params }); } onClose(e) { e && e.code === 3e3 && this.events.emit("error", new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason ? `(${e.reason})` : ""}`)), this.events.emit("disconnect"); @@ -17580,10 +17580,10 @@ let as = class extends AH { this.hasRegisteredEventListeners || (this.connection.on("payload", (e) => this.onPayload(e)), this.connection.on("close", (e) => this.onClose(e)), this.connection.on("error", (e) => this.events.emit("error", e)), this.connection.on("register_error", (e) => this.onClose()), this.hasRegisteredEventListeners = !0); } }; -const TH = () => typeof WebSocket < "u" ? WebSocket : typeof global < "u" && typeof global.WebSocket < "u" ? global.WebSocket : typeof window < "u" && typeof window.WebSocket < "u" ? window.WebSocket : typeof self < "u" && typeof self.WebSocket < "u" ? self.WebSocket : require("ws"), RH = () => typeof WebSocket < "u" || typeof global < "u" && typeof global.WebSocket < "u" || typeof window < "u" && typeof window.WebSocket < "u" || typeof self < "u" && typeof self.WebSocket < "u", f3 = (t) => t.split("?")[0], l3 = 10, DH = TH(); -let OH = class { +const jW = () => typeof WebSocket < "u" ? WebSocket : typeof global < "u" && typeof global.WebSocket < "u" ? global.WebSocket : typeof window < "u" && typeof window.WebSocket < "u" ? window.WebSocket : typeof self < "u" && typeof self.WebSocket < "u" ? self.WebSocket : require("ws"), UW = () => typeof WebSocket < "u" || typeof global < "u" && typeof global.WebSocket < "u" || typeof window < "u" && typeof window.WebSocket < "u" || typeof self < "u" && typeof self.WebSocket < "u", h3 = (t) => t.split("?")[0], d3 = 10, qW = jW(); +let zW = class { constructor(e) { - if (this.url = e, this.events = new rs.EventEmitter(), this.registering = !1, !u3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); + if (this.url = e, this.events = new ns.EventEmitter(), this.registering = !1, !l3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); this.url = e; } get connected() { @@ -17621,13 +17621,13 @@ let OH = class { async send(e) { typeof this.socket > "u" && (this.socket = await this.register()); try { - this.socket.send(ko(e)); + this.socket.send(Bo(e)); } catch (r) { this.onError(e.id, r); } } register(e = this.url) { - if (!u3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); + if (!l3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); if (this.registering) { const r = this.events.getMaxListeners(); return (this.events.listenerCount("register_error") >= r || this.events.listenerCount("open") >= r) && this.events.setMaxListeners(r + 1), new Promise((n, i) => { @@ -17640,8 +17640,8 @@ let OH = class { }); } return this.url = e, this.registering = !0, new Promise((r, n) => { - const i = new URLSearchParams(e).get("origin"), s = X8.isReactNative() ? { headers: { origin: i } } : { rejectUnauthorized: !CH(e) }, o = new DH(e, [], s); - RH() ? o.onerror = (a) => { + const i = new URLSearchParams(e).get("origin"), s = Q8.isReactNative() ? { headers: { origin: i } } : { rejectUnauthorized: !FW(e) }, o = new qW(e, [], s); + UW() ? o.onerror = (a) => { const u = a; n(this.emitError(u.error)); } : o.on("error", (a) => { @@ -17659,45 +17659,45 @@ let OH = class { } onPayload(e) { if (typeof e.data > "u") return; - const r = typeof e.data == "string" ? uc(e.data) : e.data; + const r = typeof e.data == "string" ? lc(e.data) : e.data; this.events.emit("payload", r); } onError(e, r) { - const n = this.parseError(r), i = n.message || n.toString(), s = rp(e, i); + const n = this.parseError(r), i = n.message || n.toString(), s = np(e, i); this.events.emit("payload", s); } parseError(e, r = this.url) { - return J8(e, f3(r), "WS"); + return Z8(e, h3(r), "WS"); } resetMaxListeners() { - this.events.getMaxListeners() > l3 && this.events.setMaxListeners(l3); + this.events.getMaxListeners() > d3 && this.events.setMaxListeners(d3); } emitError(e) { - const r = this.parseError(new Error((e == null ? void 0 : e.message) || `WebSocket connection failed for host: ${f3(this.url)}`)); + const r = this.parseError(new Error((e == null ? void 0 : e.message) || `WebSocket connection failed for host: ${h3(this.url)}`)); return this.events.emit("register_error", r), r; } }; -var f0 = { exports: {} }; -f0.exports; +var l0 = { exports: {} }; +l0.exports; (function(t, e) { - var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", u = "[object Array]", l = "[object AsyncFunction]", d = "[object Boolean]", g = "[object Date]", w = "[object Error]", A = "[object Function]", M = "[object GeneratorFunction]", N = "[object Map]", L = "[object Number]", $ = "[object Null]", F = "[object Object]", K = "[object Promise]", H = "[object Proxy]", V = "[object RegExp]", te = "[object Set]", R = "[object String]", W = "[object Symbol]", pe = "[object Undefined]", Ee = "[object WeakMap]", Y = "[object ArrayBuffer]", S = "[object DataView]", m = "[object Float32Array]", f = "[object Float64Array]", p = "[object Int8Array]", b = "[object Int16Array]", x = "[object Int32Array]", _ = "[object Uint8Array]", E = "[object Uint8ClampedArray]", v = "[object Uint16Array]", P = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, B = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, D = {}; - D[m] = D[f] = D[p] = D[b] = D[x] = D[_] = D[E] = D[v] = D[P] = !0, D[a] = D[u] = D[Y] = D[d] = D[S] = D[g] = D[w] = D[A] = D[N] = D[L] = D[F] = D[V] = D[te] = D[R] = D[Ee] = !1; - var oe = typeof gn == "object" && gn && gn.Object === Object && gn, Z = typeof self == "object" && self && self.Object === Object && self, J = oe || Z || Function("return this")(), Q = e && !e.nodeType && e, T = Q && !0 && t && !t.nodeType && t, X = T && T.exports === Q, re = X && oe.process, de = function() { + var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", u = "[object Array]", l = "[object AsyncFunction]", d = "[object Boolean]", p = "[object Date]", w = "[object Error]", A = "[object Function]", P = "[object GeneratorFunction]", N = "[object Map]", L = "[object Number]", $ = "[object Null]", B = "[object Object]", H = "[object Promise]", W = "[object Proxy]", V = "[object RegExp]", te = "[object Set]", R = "[object String]", K = "[object Symbol]", ge = "[object Undefined]", Ee = "[object WeakMap]", Y = "[object ArrayBuffer]", S = "[object DataView]", m = "[object Float32Array]", f = "[object Float64Array]", g = "[object Int8Array]", b = "[object Int16Array]", x = "[object Int32Array]", _ = "[object Uint8Array]", E = "[object Uint8ClampedArray]", v = "[object Uint16Array]", M = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, F = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, D = {}; + D[m] = D[f] = D[g] = D[b] = D[x] = D[_] = D[E] = D[v] = D[M] = !0, D[a] = D[u] = D[Y] = D[d] = D[S] = D[p] = D[w] = D[A] = D[N] = D[L] = D[B] = D[V] = D[te] = D[R] = D[Ee] = !1; + var oe = typeof gn == "object" && gn && gn.Object === Object && gn, Z = typeof self == "object" && self && self.Object === Object && self, J = oe || Z || Function("return this")(), Q = e && !e.nodeType && e, T = Q && !0 && t && !t.nodeType && t, X = T && T.exports === Q, re = X && oe.process, pe = function() { try { return re && re.binding && re.binding("util"); } catch { } - }(), ie = de && de.isTypedArray; + }(), ie = pe && pe.isTypedArray; function ue(ae, ye) { - for (var Ge = -1, Pt = ae == null ? 0 : ae.length, Ur = 0, rr = []; ++Ge < Pt; ) { + for (var Ge = -1, Pt = ae == null ? 0 : ae.length, jr = 0, nr = []; ++Ge < Pt; ) { var Kr = ae[Ge]; - ye(Kr, Ge, ae) && (rr[Ur++] = Kr); + ye(Kr, Ge, ae) && (nr[jr++] = Kr); } - return rr; + return nr; } function ve(ae, ye) { - for (var Ge = -1, Pt = ye.length, Ur = ae.length; ++Ge < Pt; ) - ae[Ur + Ge] = ye[Ge]; + for (var Ge = -1, Pt = ye.length, jr = ae.length; ++Ge < Pt; ) + ae[jr + Ge] = ye[Ge]; return ae; } function Pe(ae, ye) { @@ -17724,8 +17724,8 @@ f0.exports; } function Ne(ae) { var ye = -1, Ge = Array(ae.size); - return ae.forEach(function(Pt, Ur) { - Ge[++ye] = [Ur, Pt]; + return ae.forEach(function(Pt, jr) { + Ge[++ye] = [jr, Pt]; }), Ge; } function Ke(ae, ye) { @@ -17744,7 +17744,7 @@ f0.exports; return ae ? "Symbol(src)_1." + ae : ""; }(), tt = _e.toString, Ye = RegExp( "^" + at.call(ke).replace(I, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" - ), dt = X ? J.Buffer : void 0, lt = J.Symbol, ct = J.Uint8Array, qt = _e.propertyIsEnumerable, Yt = qe.splice, Et = lt ? lt.toStringTag : void 0, Qt = Object.getOwnPropertySymbols, Jt = dt ? dt.isBuffer : void 0, Dt = Ke(Object.keys, Object), kt = yr(J, "DataView"), Ct = yr(J, "Map"), gt = yr(J, "Promise"), Rt = yr(J, "Set"), Nt = yr(J, "WeakMap"), vt = yr(Object, "create"), $t = no(kt), Bt = no(Ct), rt = no(gt), Ft = no(Rt), k = no(Nt), j = lt ? lt.prototype : void 0, z = j ? j.valueOf : void 0; + ), dt = X ? J.Buffer : void 0, lt = J.Symbol, ct = J.Uint8Array, qt = _e.propertyIsEnumerable, Jt = qe.splice, Et = lt ? lt.toStringTag : void 0, er = Object.getOwnPropertySymbols, Xt = dt ? dt.isBuffer : void 0, Dt = Ke(Object.keys, Object), kt = yr(J, "DataView"), Ct = yr(J, "Map"), gt = yr(J, "Promise"), Rt = yr(J, "Set"), Nt = yr(J, "WeakMap"), vt = yr(Object, "create"), $t = oo(kt), Ft = oo(Ct), rt = oo(gt), Bt = oo(Rt), k = oo(Nt), U = lt ? lt.prototype : void 0, z = U ? U.valueOf : void 0; function C(ae) { var ye = -1, Ge = ae == null ? 0 : ae.length; for (this.clear(); ++ye < Ge; ) { @@ -17755,7 +17755,7 @@ f0.exports; function G() { this.__data__ = vt ? vt(null) : {}, this.size = 0; } - function U(ae) { + function j(ae) { var ye = this.has(ae) && delete this.__data__[ae]; return this.size -= ye ? 1 : 0, ye; } @@ -17767,7 +17767,7 @@ f0.exports; } return ke.call(ye, ae) ? ye[ae] : void 0; } - function he(ae) { + function de(ae) { var ye = this.__data__; return vt ? ye[ae] !== void 0 : ke.call(ye, ae); } @@ -17775,7 +17775,7 @@ f0.exports; var Ge = this.__data__; return this.size += this.has(ae) ? 0 : 1, Ge[ae] = vt && ye === void 0 ? n : ye, this; } - C.prototype.clear = G, C.prototype.delete = U, C.prototype.get = se, C.prototype.has = he, C.prototype.set = xe; + C.prototype.clear = G, C.prototype.delete = j, C.prototype.get = se, C.prototype.has = de, C.prototype.set = xe; function Te(ae) { var ye = -1, Ge = ae == null ? 0 : ae.length; for (this.clear(); ++ye < Ge; ) { @@ -17791,9 +17791,9 @@ f0.exports; if (Ge < 0) return !1; var Pt = ye.length - 1; - return Ge == Pt ? ye.pop() : Yt.call(ye, Ge, 1), --this.size, !0; + return Ge == Pt ? ye.pop() : Jt.call(ye, Ge, 1), --this.size, !0; } - function Ue(ae) { + function je(ae) { var ye = this.__data__, Ge = Je(ye, ae); return Ge < 0 ? void 0 : ye[Ge][1]; } @@ -17804,7 +17804,7 @@ f0.exports; var Ge = this.__data__, Pt = Je(Ge, ae); return Pt < 0 ? (++this.size, Ge.push([ae, ye])) : Ge[Pt][1] = ye, this; } - Te.prototype.clear = Re, Te.prototype.delete = nt, Te.prototype.get = Ue, Te.prototype.has = pt, Te.prototype.set = it; + Te.prototype.clear = Re, Te.prototype.delete = nt, Te.prototype.get = je, Te.prototype.has = pt, Te.prototype.set = it; function et(ae) { var ye = -1, Ge = ae == null ? 0 : ae.length; for (this.clear(); ++ye < Ge; ) { @@ -17863,7 +17863,7 @@ f0.exports; function Ve(ae) { return this.__data__.has(ae); } - function Be(ae, ye) { + function Fe(ae, ye) { var Ge = this.__data__; if (Ge instanceof Te) { var Pt = Ge.__data__; @@ -17873,118 +17873,118 @@ f0.exports; } return Ge.set(ae, ye), this.size = Ge.size, this; } - ut.prototype.clear = ot, ut.prototype.delete = Se, ut.prototype.get = Ae, ut.prototype.has = Ve, ut.prototype.set = Be; - function je(ae, ye) { - var Ge = Pc(ae), Pt = !Ge && hh(ae), Ur = !Ge && !Pt && Ju(ae), rr = !Ge && !Pt && !Ur && gh(ae), Kr = Ge || Pt || Ur || rr, vn = Kr ? De(ae.length, String) : [], _r = vn.length; - for (var jr in ae) - ke.call(ae, jr) && !(Kr && // Safari 9 has enumerable `arguments.length` in strict mode. - (jr == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. - Ur && (jr == "offset" || jr == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. - rr && (jr == "buffer" || jr == "byteLength" || jr == "byteOffset") || // Skip index properties. - nn(jr, _r))) && vn.push(jr); + ut.prototype.clear = ot, ut.prototype.delete = Se, ut.prototype.get = Ae, ut.prototype.has = Ve, ut.prototype.set = Fe; + function Ue(ae, ye) { + var Ge = Mc(ae), Pt = !Ge && dh(ae), jr = !Ge && !Pt && Xu(ae), nr = !Ge && !Pt && !jr && mh(ae), Kr = Ge || Pt || jr || nr, vn = Kr ? De(ae.length, String) : [], _r = vn.length; + for (var Ur in ae) + ke.call(ae, Ur) && !(Kr && // Safari 9 has enumerable `arguments.length` in strict mode. + (Ur == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. + jr && (Ur == "offset" || Ur == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. + nr && (Ur == "buffer" || Ur == "byteLength" || Ur == "byteOffset") || // Skip index properties. + nn(Ur, _r))) && vn.push(Ur); return vn; } function Je(ae, ye) { for (var Ge = ae.length; Ge--; ) - if (lh(ae[Ge][0], ye)) + if (hh(ae[Ge][0], ye)) return Ge; return -1; } function Lt(ae, ye, Ge) { var Pt = ye(ae); - return Pc(ae) ? Pt : ve(Pt, Ge(ae)); + return Mc(ae) ? Pt : ve(Pt, Ge(ae)); } function zt(ae) { - return ae == null ? ae === void 0 ? pe : $ : Et && Et in Object(ae) ? $r(ae) : Rp(ae); + return ae == null ? ae === void 0 ? ge : $ : Et && Et in Object(ae) ? $r(ae) : Rp(ae); } - function Xt(ae) { - return Ra(ae) && zt(ae) == a; + function Zt(ae) { + return Na(ae) && zt(ae) == a; } - function Ht(ae, ye, Ge, Pt, Ur) { - return ae === ye ? !0 : ae == null || ye == null || !Ra(ae) && !Ra(ye) ? ae !== ae && ye !== ye : le(ae, ye, Ge, Pt, Ht, Ur); + function Wt(ae, ye, Ge, Pt, jr) { + return ae === ye ? !0 : ae == null || ye == null || !Na(ae) && !Na(ye) ? ae !== ae && ye !== ye : he(ae, ye, Ge, Pt, Wt, jr); } - function le(ae, ye, Ge, Pt, Ur, rr) { - var Kr = Pc(ae), vn = Pc(ye), _r = Kr ? u : Ir(ae), jr = vn ? u : Ir(ye); - _r = _r == a ? F : _r, jr = jr == a ? F : jr; - var an = _r == F, ci = jr == F, bn = _r == jr; - if (bn && Ju(ae)) { - if (!Ju(ye)) + function he(ae, ye, Ge, Pt, jr, nr) { + var Kr = Mc(ae), vn = Mc(ye), _r = Kr ? u : Ir(ae), Ur = vn ? u : Ir(ye); + _r = _r == a ? B : _r, Ur = Ur == a ? B : Ur; + var an = _r == B, ui = Ur == B, bn = _r == Ur; + if (bn && Xu(ae)) { + if (!Xu(ye)) return !1; Kr = !0, an = !1; } if (bn && !an) - return rr || (rr = new ut()), Kr || gh(ae) ? Zt(ae, ye, Ge, Pt, Ur, rr) : gr(ae, ye, _r, Ge, Pt, Ur, rr); + return nr || (nr = new ut()), Kr || mh(ae) ? Qt(ae, ye, Ge, Pt, jr, nr) : gr(ae, ye, _r, Ge, Pt, jr, nr); if (!(Ge & i)) { - var Vr = an && ke.call(ae, "__wrapped__"), ei = ci && ke.call(ye, "__wrapped__"); + var Vr = an && ke.call(ae, "__wrapped__"), ei = ui && ke.call(ye, "__wrapped__"); if (Vr || ei) { - var us = Vr ? ae.value() : ae, Bi = ei ? ye.value() : ye; - return rr || (rr = new ut()), Ur(us, Bi, Ge, Pt, rr); + var fs = Vr ? ae.value() : ae, ji = ei ? ye.value() : ye; + return nr || (nr = new ut()), jr(fs, ji, Ge, Pt, nr); } } - return bn ? (rr || (rr = new ut()), lr(ae, ye, Ge, Pt, Ur, rr)) : !1; + return bn ? (nr || (nr = new ut()), lr(ae, ye, Ge, Pt, jr, nr)) : !1; } - function tr(ae) { - if (!ph(ae) || on(ae)) + function rr(ae) { + if (!gh(ae) || on(ae)) return !1; - var ye = Mc(ae) ? Ye : B; - return ye.test(no(ae)); + var ye = Ic(ae) ? Ye : F; + return ye.test(oo(ae)); } function dr(ae) { - return Ra(ae) && dh(ae.length) && !!D[zt(ae)]; + return Na(ae) && ph(ae.length) && !!D[zt(ae)]; } function pr(ae) { - if (!fh(ae)) + if (!lh(ae)) return Dt(ae); var ye = []; for (var Ge in Object(ae)) ke.call(ae, Ge) && Ge != "constructor" && ye.push(Ge); return ye; } - function Zt(ae, ye, Ge, Pt, Ur, rr) { + function Qt(ae, ye, Ge, Pt, jr, nr) { var Kr = Ge & i, vn = ae.length, _r = ye.length; if (vn != _r && !(Kr && _r > vn)) return !1; - var jr = rr.get(ae); - if (jr && rr.get(ye)) - return jr == ye; - var an = -1, ci = !0, bn = Ge & s ? new xt() : void 0; - for (rr.set(ae, ye), rr.set(ye, ae); ++an < vn; ) { + var Ur = nr.get(ae); + if (Ur && nr.get(ye)) + return Ur == ye; + var an = -1, ui = !0, bn = Ge & s ? new xt() : void 0; + for (nr.set(ae, ye), nr.set(ye, ae); ++an < vn; ) { var Vr = ae[an], ei = ye[an]; if (Pt) - var us = Kr ? Pt(ei, Vr, an, ye, ae, rr) : Pt(Vr, ei, an, ae, ye, rr); - if (us !== void 0) { - if (us) + var fs = Kr ? Pt(ei, Vr, an, ye, ae, nr) : Pt(Vr, ei, an, ae, ye, nr); + if (fs !== void 0) { + if (fs) continue; - ci = !1; + ui = !1; break; } if (bn) { - if (!Pe(ye, function(Bi, Ms) { - if (!$e(bn, Ms) && (Vr === Bi || Ur(Vr, Bi, Ge, Pt, rr))) - return bn.push(Ms); + if (!Pe(ye, function(ji, Is) { + if (!$e(bn, Is) && (Vr === ji || jr(Vr, ji, Ge, Pt, nr))) + return bn.push(Is); })) { - ci = !1; + ui = !1; break; } - } else if (!(Vr === ei || Ur(Vr, ei, Ge, Pt, rr))) { - ci = !1; + } else if (!(Vr === ei || jr(Vr, ei, Ge, Pt, nr))) { + ui = !1; break; } } - return rr.delete(ae), rr.delete(ye), ci; + return nr.delete(ae), nr.delete(ye), ui; } - function gr(ae, ye, Ge, Pt, Ur, rr, Kr) { + function gr(ae, ye, Ge, Pt, jr, nr, Kr) { switch (Ge) { case S: if (ae.byteLength != ye.byteLength || ae.byteOffset != ye.byteOffset) return !1; ae = ae.buffer, ye = ye.buffer; case Y: - return !(ae.byteLength != ye.byteLength || !rr(new ct(ae), new ct(ye))); + return !(ae.byteLength != ye.byteLength || !nr(new ct(ae), new ct(ye))); case d: - case g: + case p: case L: - return lh(+ae, +ye); + return hh(+ae, +ye); case w: return ae.name == ye.name && ae.message == ye.message; case V: @@ -17996,51 +17996,51 @@ f0.exports; var _r = Pt & i; if (vn || (vn = Le), ae.size != ye.size && !_r) return !1; - var jr = Kr.get(ae); - if (jr) - return jr == ye; + var Ur = Kr.get(ae); + if (Ur) + return Ur == ye; Pt |= s, Kr.set(ae, ye); - var an = Zt(vn(ae), vn(ye), Pt, Ur, rr, Kr); + var an = Qt(vn(ae), vn(ye), Pt, jr, nr, Kr); return Kr.delete(ae), an; - case W: + case K: if (z) return z.call(ae) == z.call(ye); } return !1; } - function lr(ae, ye, Ge, Pt, Ur, rr) { - var Kr = Ge & i, vn = Rr(ae), _r = vn.length, jr = Rr(ye), an = jr.length; + function lr(ae, ye, Ge, Pt, jr, nr) { + var Kr = Ge & i, vn = Rr(ae), _r = vn.length, Ur = Rr(ye), an = Ur.length; if (_r != an && !Kr) return !1; - for (var ci = _r; ci--; ) { - var bn = vn[ci]; + for (var ui = _r; ui--; ) { + var bn = vn[ui]; if (!(Kr ? bn in ye : ke.call(ye, bn))) return !1; } - var Vr = rr.get(ae); - if (Vr && rr.get(ye)) + var Vr = nr.get(ae); + if (Vr && nr.get(ye)) return Vr == ye; var ei = !0; - rr.set(ae, ye), rr.set(ye, ae); - for (var us = Kr; ++ci < _r; ) { - bn = vn[ci]; - var Bi = ae[bn], Ms = ye[bn]; + nr.set(ae, ye), nr.set(ye, ae); + for (var fs = Kr; ++ui < _r; ) { + bn = vn[ui]; + var ji = ae[bn], Is = ye[bn]; if (Pt) - var Xu = Kr ? Pt(Ms, Bi, bn, ye, ae, rr) : Pt(Bi, Ms, bn, ae, ye, rr); - if (!(Xu === void 0 ? Bi === Ms || Ur(Bi, Ms, Ge, Pt, rr) : Xu)) { + var Zu = Kr ? Pt(Is, ji, bn, ye, ae, nr) : Pt(ji, Is, bn, ae, ye, nr); + if (!(Zu === void 0 ? ji === Is || jr(ji, Is, Ge, Pt, nr) : Zu)) { ei = !1; break; } - us || (us = bn == "constructor"); + fs || (fs = bn == "constructor"); } - if (ei && !us) { - var Da = ae.constructor, Pn = ye.constructor; - Da != Pn && "constructor" in ae && "constructor" in ye && !(typeof Da == "function" && Da instanceof Da && typeof Pn == "function" && Pn instanceof Pn) && (ei = !1); + if (ei && !fs) { + var La = ae.constructor, Pn = ye.constructor; + La != Pn && "constructor" in ae && "constructor" in ye && !(typeof La == "function" && La instanceof La && typeof Pn == "function" && Pn instanceof Pn) && (ei = !1); } - return rr.delete(ae), rr.delete(ye), ei; + return nr.delete(ae), nr.delete(ye), ei; } function Rr(ae) { - return Lt(ae, Np, Fr); + return Lt(ae, Np, Br); } function mr(ae, ye) { var Ge = ae.__data__; @@ -18048,7 +18048,7 @@ f0.exports; } function yr(ae, ye) { var Ge = Me(ae, ye); - return tr(Ge) ? Ge : void 0; + return rr(Ge) ? Ge : void 0; } function $r(ae) { var ye = ke.call(ae, Et), Ge = ae[Et]; @@ -18057,25 +18057,25 @@ f0.exports; var Pt = !0; } catch { } - var Ur = tt.call(ae); - return Pt && (ye ? ae[Et] = Ge : delete ae[Et]), Ur; + var jr = tt.call(ae); + return Pt && (ye ? ae[Et] = Ge : delete ae[Et]), jr; } - var Fr = Qt ? function(ae) { - return ae == null ? [] : (ae = Object(ae), ue(Qt(ae), function(ye) { + var Br = er ? function(ae) { + return ae == null ? [] : (ae = Object(ae), ue(er(ae), function(ye) { return qt.call(ae, ye); })); - } : Br, Ir = zt; - (kt && Ir(new kt(new ArrayBuffer(1))) != S || Ct && Ir(new Ct()) != N || gt && Ir(gt.resolve()) != K || Rt && Ir(new Rt()) != te || Nt && Ir(new Nt()) != Ee) && (Ir = function(ae) { - var ye = zt(ae), Ge = ye == F ? ae.constructor : void 0, Pt = Ge ? no(Ge) : ""; + } : Fr, Ir = zt; + (kt && Ir(new kt(new ArrayBuffer(1))) != S || Ct && Ir(new Ct()) != N || gt && Ir(gt.resolve()) != H || Rt && Ir(new Rt()) != te || Nt && Ir(new Nt()) != Ee) && (Ir = function(ae) { + var ye = zt(ae), Ge = ye == B ? ae.constructor : void 0, Pt = Ge ? oo(Ge) : ""; if (Pt) switch (Pt) { case $t: return S; - case Bt: + case Ft: return N; case rt: - return K; - case Ft: + return H; + case Bt: return te; case k: return Ee; @@ -18092,14 +18092,14 @@ f0.exports; function on(ae) { return !!Qe && Qe in ae; } - function fh(ae) { + function lh(ae) { var ye = ae && ae.constructor, Ge = typeof ye == "function" && ye.prototype || _e; return ae === Ge; } function Rp(ae) { return tt.call(ae); } - function no(ae) { + function oo(ae) { if (ae != null) { try { return at.call(ae); @@ -18112,52 +18112,52 @@ f0.exports; } return ""; } - function lh(ae, ye) { + function hh(ae, ye) { return ae === ye || ae !== ae && ye !== ye; } - var hh = Xt(/* @__PURE__ */ function() { + var dh = Zt(/* @__PURE__ */ function() { return arguments; - }()) ? Xt : function(ae) { - return Ra(ae) && ke.call(ae, "callee") && !qt.call(ae, "callee"); - }, Pc = Array.isArray; + }()) ? Zt : function(ae) { + return Na(ae) && ke.call(ae, "callee") && !qt.call(ae, "callee"); + }, Mc = Array.isArray; function Dp(ae) { - return ae != null && dh(ae.length) && !Mc(ae); + return ae != null && ph(ae.length) && !Ic(ae); } - var Ju = Jt || Dr; + var Xu = Xt || Dr; function Op(ae, ye) { - return Ht(ae, ye); + return Wt(ae, ye); } - function Mc(ae) { - if (!ph(ae)) + function Ic(ae) { + if (!gh(ae)) return !1; var ye = zt(ae); - return ye == A || ye == M || ye == l || ye == H; + return ye == A || ye == P || ye == l || ye == W; } - function dh(ae) { + function ph(ae) { return typeof ae == "number" && ae > -1 && ae % 1 == 0 && ae <= o; } - function ph(ae) { + function gh(ae) { var ye = typeof ae; return ae != null && (ye == "object" || ye == "function"); } - function Ra(ae) { + function Na(ae) { return ae != null && typeof ae == "object"; } - var gh = ie ? Ce(ie) : dr; + var mh = ie ? Ce(ie) : dr; function Np(ae) { - return Dp(ae) ? je(ae) : pr(ae); + return Dp(ae) ? Ue(ae) : pr(ae); } - function Br() { + function Fr() { return []; } function Dr() { return !1; } t.exports = Op; -})(f0, f0.exports); -var NH = f0.exports; -const LH = /* @__PURE__ */ ts(NH), eE = "wc", tE = 2, rE = "core", Zs = `${eE}@2:${rE}:`, kH = { logger: "error" }, $H = { database: ":memory:" }, FH = "crypto", h3 = "client_ed25519_seed", BH = mt.ONE_DAY, UH = "keychain", jH = "0.3", qH = "messages", zH = "0.3", HH = mt.SIX_HOURS, WH = "publisher", nE = "irn", KH = "error", iE = "wss://relay.walletconnect.org", VH = "relayer", si = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", publish: "relayer_publish" }, GH = "_subscription", Vi = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, YH = 0.1, T1 = "2.17.2", zr = { link_mode: "link_mode", relay: "relay" }, JH = "0.3", XH = "WALLETCONNECT_CLIENT_ID", d3 = "WALLETCONNECT_LINK_MODE_APPS", Us = { created: "subscription_created", deleted: "subscription_deleted", sync: "subscription_sync", resubscribed: "subscription_resubscribed" }, ZH = "subscription", QH = "0.3", eW = mt.FIVE_SECONDS * 1e3, tW = "pairing", rW = "0.3", Pf = { wc_pairingDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1e3 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1001 } }, wc_pairingPing: { req: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1002 }, res: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1003 } }, unregistered_method: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 } } }, Xa = { create: "pairing_create", expire: "pairing_expire", delete: "pairing_delete", ping: "pairing_ping" }, gs = { created: "history_created", updated: "history_updated", deleted: "history_deleted", sync: "history_sync" }, nW = "history", iW = "0.3", sW = "expirer", Ji = { created: "expirer_created", deleted: "expirer_deleted", expired: "expirer_expired", sync: "expirer_sync" }, oW = "0.3", aW = "verify-api", cW = "https://verify.walletconnect.com", sE = "https://verify.walletconnect.org", zf = sE, uW = `${zf}/v3`, fW = [cW, sE], lW = "echo", hW = "https://echo.walletconnect.com", Fs = { pairing_started: "pairing_started", pairing_uri_validation_success: "pairing_uri_validation_success", pairing_uri_not_expired: "pairing_uri_not_expired", store_new_pairing: "store_new_pairing", subscribing_pairing_topic: "subscribing_pairing_topic", subscribe_pairing_topic_success: "subscribe_pairing_topic_success", existing_pairing: "existing_pairing", pairing_not_expired: "pairing_not_expired", emit_inactive_pairing: "emit_inactive_pairing", emit_session_proposal: "emit_session_proposal" }, yo = { no_internet_connection: "no_internet_connection", malformed_pairing_uri: "malformed_pairing_uri", active_pairing_already_exists: "active_pairing_already_exists", subscribe_pairing_topic_failure: "subscribe_pairing_topic_failure", pairing_expired: "pairing_expired", proposal_listener_not_found: "proposal_listener_not_found" }, ms = { session_approve_started: "session_approve_started", session_namespaces_validation_success: "session_namespaces_validation_success", subscribing_session_topic: "subscribing_session_topic", subscribe_session_topic_success: "subscribe_session_topic_success", publishing_session_approve: "publishing_session_approve", session_approve_publish_success: "session_approve_publish_success", store_session: "store_session", publishing_session_settle: "publishing_session_settle", session_settle_publish_success: "session_settle_publish_success" }, Ha = { no_internet_connection: "no_internet_connection", proposal_expired: "proposal_expired", subscribe_session_topic_failure: "subscribe_session_topic_failure", session_approve_publish_failure: "session_approve_publish_failure", session_settle_publish_failure: "session_settle_publish_failure", session_approve_namespace_validation_failure: "session_approve_namespace_validation_failure", proposal_not_found: "proposal_not_found" }, Wa = { authenticated_session_approve_started: "authenticated_session_approve_started", create_authenticated_session_topic: "create_authenticated_session_topic", cacaos_verified: "cacaos_verified", store_authenticated_session: "store_authenticated_session", subscribing_authenticated_session_topic: "subscribing_authenticated_session_topic", subscribe_authenticated_session_topic_success: "subscribe_authenticated_session_topic_success", publishing_authenticated_session_approve: "publishing_authenticated_session_approve" }, Mf = { no_internet_connection: "no_internet_connection", invalid_cacao: "invalid_cacao", subscribe_authenticated_session_topic_failure: "subscribe_authenticated_session_topic_failure", authenticated_session_approve_publish_failure: "authenticated_session_approve_publish_failure", authenticated_session_pending_request_not_found: "authenticated_session_pending_request_not_found" }, dW = 0.1, pW = "event-client", gW = 86400, mW = "https://pulse.walletconnect.org/batch"; -function vW(t, e) { +})(l0, l0.exports); +var WW = l0.exports; +const HW = /* @__PURE__ */ rs(WW), rE = "wc", nE = 2, iE = "core", eo = `${rE}@2:${iE}:`, KW = { logger: "error" }, VW = { database: ":memory:" }, GW = "crypto", p3 = "client_ed25519_seed", YW = mt.ONE_DAY, JW = "keychain", XW = "0.3", ZW = "messages", QW = "0.3", eH = mt.SIX_HOURS, tH = "publisher", sE = "irn", rH = "error", oE = "wss://relay.walletconnect.org", nH = "relayer", si = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", publish: "relayer_publish" }, iH = "_subscription", Gi = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, sH = 0.1, T1 = "2.17.2", zr = { link_mode: "link_mode", relay: "relay" }, oH = "0.3", aH = "WALLETCONNECT_CLIENT_ID", g3 = "WALLETCONNECT_LINK_MODE_APPS", Us = { created: "subscription_created", deleted: "subscription_deleted", sync: "subscription_sync", resubscribed: "subscription_resubscribed" }, cH = "subscription", uH = "0.3", fH = mt.FIVE_SECONDS * 1e3, lH = "pairing", hH = "0.3", Mf = { wc_pairingDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1e3 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1001 } }, wc_pairingPing: { req: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1002 }, res: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1003 } }, unregistered_method: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 } } }, Qa = { create: "pairing_create", expire: "pairing_expire", delete: "pairing_delete", ping: "pairing_ping" }, ms = { created: "history_created", updated: "history_updated", deleted: "history_deleted", sync: "history_sync" }, dH = "history", pH = "0.3", gH = "expirer", Xi = { created: "expirer_created", deleted: "expirer_deleted", expired: "expirer_expired", sync: "expirer_sync" }, mH = "0.3", vH = "verify-api", bH = "https://verify.walletconnect.com", aE = "https://verify.walletconnect.org", Wf = aE, yH = `${Wf}/v3`, wH = [bH, aE], xH = "echo", _H = "https://echo.walletconnect.com", Fs = { pairing_started: "pairing_started", pairing_uri_validation_success: "pairing_uri_validation_success", pairing_uri_not_expired: "pairing_uri_not_expired", store_new_pairing: "store_new_pairing", subscribing_pairing_topic: "subscribing_pairing_topic", subscribe_pairing_topic_success: "subscribe_pairing_topic_success", existing_pairing: "existing_pairing", pairing_not_expired: "pairing_not_expired", emit_inactive_pairing: "emit_inactive_pairing", emit_session_proposal: "emit_session_proposal" }, _o = { no_internet_connection: "no_internet_connection", malformed_pairing_uri: "malformed_pairing_uri", active_pairing_already_exists: "active_pairing_already_exists", subscribe_pairing_topic_failure: "subscribe_pairing_topic_failure", pairing_expired: "pairing_expired", proposal_listener_not_found: "proposal_listener_not_found" }, vs = { session_approve_started: "session_approve_started", session_namespaces_validation_success: "session_namespaces_validation_success", subscribing_session_topic: "subscribing_session_topic", subscribe_session_topic_success: "subscribe_session_topic_success", publishing_session_approve: "publishing_session_approve", session_approve_publish_success: "session_approve_publish_success", store_session: "store_session", publishing_session_settle: "publishing_session_settle", session_settle_publish_success: "session_settle_publish_success" }, Va = { no_internet_connection: "no_internet_connection", proposal_expired: "proposal_expired", subscribe_session_topic_failure: "subscribe_session_topic_failure", session_approve_publish_failure: "session_approve_publish_failure", session_settle_publish_failure: "session_settle_publish_failure", session_approve_namespace_validation_failure: "session_approve_namespace_validation_failure", proposal_not_found: "proposal_not_found" }, Ga = { authenticated_session_approve_started: "authenticated_session_approve_started", create_authenticated_session_topic: "create_authenticated_session_topic", cacaos_verified: "cacaos_verified", store_authenticated_session: "store_authenticated_session", subscribing_authenticated_session_topic: "subscribing_authenticated_session_topic", subscribe_authenticated_session_topic_success: "subscribe_authenticated_session_topic_success", publishing_authenticated_session_approve: "publishing_authenticated_session_approve" }, If = { no_internet_connection: "no_internet_connection", invalid_cacao: "invalid_cacao", subscribe_authenticated_session_topic_failure: "subscribe_authenticated_session_topic_failure", authenticated_session_approve_publish_failure: "authenticated_session_approve_publish_failure", authenticated_session_pending_request_not_found: "authenticated_session_pending_request_not_found" }, EH = 0.1, SH = "event-client", AH = 86400, PH = "https://pulse.walletconnect.org/batch"; +function MH(t, e) { if (t.length >= 255) throw new TypeError("Alphabet too long"); for (var r = new Uint8Array(256), n = 0; n < r.length; n++) r[n] = 255; for (var i = 0; i < t.length; i++) { @@ -18166,54 +18166,54 @@ function vW(t, e) { r[o] = i; } var a = t.length, u = t.charAt(0), l = Math.log(a) / Math.log(256), d = Math.log(256) / Math.log(a); - function g(M) { - if (M instanceof Uint8Array || (ArrayBuffer.isView(M) ? M = new Uint8Array(M.buffer, M.byteOffset, M.byteLength) : Array.isArray(M) && (M = Uint8Array.from(M))), !(M instanceof Uint8Array)) throw new TypeError("Expected Uint8Array"); - if (M.length === 0) return ""; - for (var N = 0, L = 0, $ = 0, F = M.length; $ !== F && M[$] === 0; ) $++, N++; - for (var K = (F - $) * d + 1 >>> 0, H = new Uint8Array(K); $ !== F; ) { - for (var V = M[$], te = 0, R = K - 1; (V !== 0 || te < L) && R !== -1; R--, te++) V += 256 * H[R] >>> 0, H[R] = V % a >>> 0, V = V / a >>> 0; + function p(P) { + if (P instanceof Uint8Array || (ArrayBuffer.isView(P) ? P = new Uint8Array(P.buffer, P.byteOffset, P.byteLength) : Array.isArray(P) && (P = Uint8Array.from(P))), !(P instanceof Uint8Array)) throw new TypeError("Expected Uint8Array"); + if (P.length === 0) return ""; + for (var N = 0, L = 0, $ = 0, B = P.length; $ !== B && P[$] === 0; ) $++, N++; + for (var H = (B - $) * d + 1 >>> 0, W = new Uint8Array(H); $ !== B; ) { + for (var V = P[$], te = 0, R = H - 1; (V !== 0 || te < L) && R !== -1; R--, te++) V += 256 * W[R] >>> 0, W[R] = V % a >>> 0, V = V / a >>> 0; if (V !== 0) throw new Error("Non-zero carry"); L = te, $++; } - for (var W = K - L; W !== K && H[W] === 0; ) W++; - for (var pe = u.repeat(N); W < K; ++W) pe += t.charAt(H[W]); - return pe; + for (var K = H - L; K !== H && W[K] === 0; ) K++; + for (var ge = u.repeat(N); K < H; ++K) ge += t.charAt(W[K]); + return ge; } - function w(M) { - if (typeof M != "string") throw new TypeError("Expected String"); - if (M.length === 0) return new Uint8Array(); + function w(P) { + if (typeof P != "string") throw new TypeError("Expected String"); + if (P.length === 0) return new Uint8Array(); var N = 0; - if (M[N] !== " ") { - for (var L = 0, $ = 0; M[N] === u; ) L++, N++; - for (var F = (M.length - N) * l + 1 >>> 0, K = new Uint8Array(F); M[N]; ) { - var H = r[M.charCodeAt(N)]; - if (H === 255) return; - for (var V = 0, te = F - 1; (H !== 0 || V < $) && te !== -1; te--, V++) H += a * K[te] >>> 0, K[te] = H % 256 >>> 0, H = H / 256 >>> 0; - if (H !== 0) throw new Error("Non-zero carry"); + if (P[N] !== " ") { + for (var L = 0, $ = 0; P[N] === u; ) L++, N++; + for (var B = (P.length - N) * l + 1 >>> 0, H = new Uint8Array(B); P[N]; ) { + var W = r[P.charCodeAt(N)]; + if (W === 255) return; + for (var V = 0, te = B - 1; (W !== 0 || V < $) && te !== -1; te--, V++) W += a * H[te] >>> 0, H[te] = W % 256 >>> 0, W = W / 256 >>> 0; + if (W !== 0) throw new Error("Non-zero carry"); $ = V, N++; } - if (M[N] !== " ") { - for (var R = F - $; R !== F && K[R] === 0; ) R++; - for (var W = new Uint8Array(L + (F - R)), pe = L; R !== F; ) W[pe++] = K[R++]; - return W; + if (P[N] !== " ") { + for (var R = B - $; R !== B && H[R] === 0; ) R++; + for (var K = new Uint8Array(L + (B - R)), ge = L; R !== B; ) K[ge++] = H[R++]; + return K; } } } - function A(M) { - var N = w(M); + function A(P) { + var N = w(P); if (N) return N; throw new Error(`Non-${e} character`); } - return { encode: g, decodeUnsafe: w, decode: A }; + return { encode: p, decodeUnsafe: w, decode: A }; } -var bW = vW, yW = bW; -const oE = (t) => { +var IH = MH, CH = IH; +const cE = (t) => { if (t instanceof Uint8Array && t.constructor.name === "Uint8Array") return t; if (t instanceof ArrayBuffer) return new Uint8Array(t); if (ArrayBuffer.isView(t)) return new Uint8Array(t.buffer, t.byteOffset, t.byteLength); throw new Error("Unknown type, must be binary type"); -}, wW = (t) => new TextEncoder().encode(t), xW = (t) => new TextDecoder().decode(t); -class _W { +}, TH = (t) => new TextEncoder().encode(t), RH = (t) => new TextDecoder().decode(t); +class DH { constructor(e, r, n) { this.name = e, this.prefix = r, this.baseEncode = n; } @@ -18222,7 +18222,7 @@ class _W { throw Error("Unknown type, must be binary type"); } } -class EW { +class OH { constructor(e, r, n) { if (this.name = e, this.prefix = r, r.codePointAt(0) === void 0) throw new Error("Invalid prefix character"); this.prefixCodePoint = r.codePointAt(0), this.baseDecode = n; @@ -18234,15 +18234,15 @@ class EW { } else throw Error("Can only multibase decode strings"); } or(e) { - return aE(this, e); + return uE(this, e); } } -class SW { +class NH { constructor(e) { this.decoders = e; } or(e) { - return aE(this, e); + return uE(this, e); } decode(e) { const r = e[0], n = this.decoders[r]; @@ -18250,10 +18250,10 @@ class SW { throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`); } } -const aE = (t, e) => new SW({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); -class AW { +const uE = (t, e) => new NH({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); +class LH { constructor(e, r, n, i) { - this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new _W(e, r, n), this.decoder = new EW(e, r, i); + this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new DH(e, r, n), this.decoder = new OH(e, r, i); } encode(e) { return this.encoder.encode(e); @@ -18262,10 +18262,10 @@ class AW { return this.decoder.decode(e); } } -const ip = ({ name: t, prefix: e, encode: r, decode: n }) => new AW(t, e, r, n), th = ({ prefix: t, name: e, alphabet: r }) => { - const { encode: n, decode: i } = yW(r, e); - return ip({ prefix: t, name: e, encode: n, decode: (s) => oE(i(s)) }); -}, PW = (t, e, r, n) => { +const sp = ({ name: t, prefix: e, encode: r, decode: n }) => new LH(t, e, r, n), rh = ({ prefix: t, name: e, alphabet: r }) => { + const { encode: n, decode: i } = CH(r, e); + return sp({ prefix: t, name: e, encode: n, decode: (s) => cE(i(s)) }); +}, kH = (t, e, r, n) => { const i = {}; for (let d = 0; d < e.length; ++d) i[e[d]] = d; let s = t.length; @@ -18273,84 +18273,84 @@ const ip = ({ name: t, prefix: e, encode: r, decode: n }) => new AW(t, e, r, n), const o = new Uint8Array(s * r / 8 | 0); let a = 0, u = 0, l = 0; for (let d = 0; d < s; ++d) { - const g = i[t[d]]; - if (g === void 0) throw new SyntaxError(`Non-${n} character`); - u = u << r | g, a += r, a >= 8 && (a -= 8, o[l++] = 255 & u >> a); + const p = i[t[d]]; + if (p === void 0) throw new SyntaxError(`Non-${n} character`); + u = u << r | p, a += r, a >= 8 && (a -= 8, o[l++] = 255 & u >> a); } if (a >= r || 255 & u << 8 - a) throw new SyntaxError("Unexpected end of data"); return o; -}, MW = (t, e, r) => { +}, $H = (t, e, r) => { const n = e[e.length - 1] === "=", i = (1 << r) - 1; let s = "", o = 0, a = 0; for (let u = 0; u < t.length; ++u) for (a = a << 8 | t[u], o += 8; o > r; ) o -= r, s += e[i & a >> o]; if (o && (s += e[i & a << r - o]), n) for (; s.length * r & 7; ) s += "="; return s; -}, Hn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => ip({ prefix: e, name: t, encode(i) { - return MW(i, n, r); +}, Hn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => sp({ prefix: e, name: t, encode(i) { + return $H(i, n, r); }, decode(i) { - return PW(i, n, r, t); -} }), IW = ip({ prefix: "\0", name: "identity", encode: (t) => xW(t), decode: (t) => wW(t) }); -var CW = Object.freeze({ __proto__: null, identity: IW }); -const TW = Hn({ prefix: "0", name: "base2", alphabet: "01", bitsPerChar: 1 }); -var RW = Object.freeze({ __proto__: null, base2: TW }); -const DW = Hn({ prefix: "7", name: "base8", alphabet: "01234567", bitsPerChar: 3 }); -var OW = Object.freeze({ __proto__: null, base8: DW }); -const NW = th({ prefix: "9", name: "base10", alphabet: "0123456789" }); -var LW = Object.freeze({ __proto__: null, base10: NW }); -const kW = Hn({ prefix: "f", name: "base16", alphabet: "0123456789abcdef", bitsPerChar: 4 }), $W = Hn({ prefix: "F", name: "base16upper", alphabet: "0123456789ABCDEF", bitsPerChar: 4 }); -var FW = Object.freeze({ __proto__: null, base16: kW, base16upper: $W }); -const BW = Hn({ prefix: "b", name: "base32", alphabet: "abcdefghijklmnopqrstuvwxyz234567", bitsPerChar: 5 }), UW = Hn({ prefix: "B", name: "base32upper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", bitsPerChar: 5 }), jW = Hn({ prefix: "c", name: "base32pad", alphabet: "abcdefghijklmnopqrstuvwxyz234567=", bitsPerChar: 5 }), qW = Hn({ prefix: "C", name: "base32padupper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", bitsPerChar: 5 }), zW = Hn({ prefix: "v", name: "base32hex", alphabet: "0123456789abcdefghijklmnopqrstuv", bitsPerChar: 5 }), HW = Hn({ prefix: "V", name: "base32hexupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", bitsPerChar: 5 }), WW = Hn({ prefix: "t", name: "base32hexpad", alphabet: "0123456789abcdefghijklmnopqrstuv=", bitsPerChar: 5 }), KW = Hn({ prefix: "T", name: "base32hexpadupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=", bitsPerChar: 5 }), VW = Hn({ prefix: "h", name: "base32z", alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769", bitsPerChar: 5 }); -var GW = Object.freeze({ __proto__: null, base32: BW, base32upper: UW, base32pad: jW, base32padupper: qW, base32hex: zW, base32hexupper: HW, base32hexpad: WW, base32hexpadupper: KW, base32z: VW }); -const YW = th({ prefix: "k", name: "base36", alphabet: "0123456789abcdefghijklmnopqrstuvwxyz" }), JW = th({ prefix: "K", name: "base36upper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" }); -var XW = Object.freeze({ __proto__: null, base36: YW, base36upper: JW }); -const ZW = th({ name: "base58btc", prefix: "z", alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" }), QW = th({ name: "base58flickr", prefix: "Z", alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" }); -var eK = Object.freeze({ __proto__: null, base58btc: ZW, base58flickr: QW }); -const tK = Hn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 }), rK = Hn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 }), nK = Hn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 }), iK = Hn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", bitsPerChar: 6 }); -var sK = Object.freeze({ __proto__: null, base64: tK, base64pad: rK, base64url: nK, base64urlpad: iK }); -const cE = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), oK = cE.reduce((t, e, r) => (t[r] = e, t), []), aK = cE.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); -function cK(t) { - return t.reduce((e, r) => (e += oK[r], e), ""); -} -function uK(t) { + return kH(i, n, r, t); +} }), BH = sp({ prefix: "\0", name: "identity", encode: (t) => RH(t), decode: (t) => TH(t) }); +var FH = Object.freeze({ __proto__: null, identity: BH }); +const jH = Hn({ prefix: "0", name: "base2", alphabet: "01", bitsPerChar: 1 }); +var UH = Object.freeze({ __proto__: null, base2: jH }); +const qH = Hn({ prefix: "7", name: "base8", alphabet: "01234567", bitsPerChar: 3 }); +var zH = Object.freeze({ __proto__: null, base8: qH }); +const WH = rh({ prefix: "9", name: "base10", alphabet: "0123456789" }); +var HH = Object.freeze({ __proto__: null, base10: WH }); +const KH = Hn({ prefix: "f", name: "base16", alphabet: "0123456789abcdef", bitsPerChar: 4 }), VH = Hn({ prefix: "F", name: "base16upper", alphabet: "0123456789ABCDEF", bitsPerChar: 4 }); +var GH = Object.freeze({ __proto__: null, base16: KH, base16upper: VH }); +const YH = Hn({ prefix: "b", name: "base32", alphabet: "abcdefghijklmnopqrstuvwxyz234567", bitsPerChar: 5 }), JH = Hn({ prefix: "B", name: "base32upper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", bitsPerChar: 5 }), XH = Hn({ prefix: "c", name: "base32pad", alphabet: "abcdefghijklmnopqrstuvwxyz234567=", bitsPerChar: 5 }), ZH = Hn({ prefix: "C", name: "base32padupper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", bitsPerChar: 5 }), QH = Hn({ prefix: "v", name: "base32hex", alphabet: "0123456789abcdefghijklmnopqrstuv", bitsPerChar: 5 }), eK = Hn({ prefix: "V", name: "base32hexupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", bitsPerChar: 5 }), tK = Hn({ prefix: "t", name: "base32hexpad", alphabet: "0123456789abcdefghijklmnopqrstuv=", bitsPerChar: 5 }), rK = Hn({ prefix: "T", name: "base32hexpadupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=", bitsPerChar: 5 }), nK = Hn({ prefix: "h", name: "base32z", alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769", bitsPerChar: 5 }); +var iK = Object.freeze({ __proto__: null, base32: YH, base32upper: JH, base32pad: XH, base32padupper: ZH, base32hex: QH, base32hexupper: eK, base32hexpad: tK, base32hexpadupper: rK, base32z: nK }); +const sK = rh({ prefix: "k", name: "base36", alphabet: "0123456789abcdefghijklmnopqrstuvwxyz" }), oK = rh({ prefix: "K", name: "base36upper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" }); +var aK = Object.freeze({ __proto__: null, base36: sK, base36upper: oK }); +const cK = rh({ name: "base58btc", prefix: "z", alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" }), uK = rh({ name: "base58flickr", prefix: "Z", alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" }); +var fK = Object.freeze({ __proto__: null, base58btc: cK, base58flickr: uK }); +const lK = Hn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 }), hK = Hn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 }), dK = Hn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 }), pK = Hn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", bitsPerChar: 6 }); +var gK = Object.freeze({ __proto__: null, base64: lK, base64pad: hK, base64url: dK, base64urlpad: pK }); +const fE = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), mK = fE.reduce((t, e, r) => (t[r] = e, t), []), vK = fE.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); +function bK(t) { + return t.reduce((e, r) => (e += mK[r], e), ""); +} +function yK(t) { const e = []; for (const r of t) { - const n = aK[r.codePointAt(0)]; + const n = vK[r.codePointAt(0)]; if (n === void 0) throw new Error(`Non-base256emoji character: ${r}`); e.push(n); } return new Uint8Array(e); } -const fK = ip({ prefix: "🚀", name: "base256emoji", encode: cK, decode: uK }); -var lK = Object.freeze({ __proto__: null, base256emoji: fK }), hK = uE, p3 = 128, dK = 127, pK = ~dK, gK = Math.pow(2, 31); -function uE(t, e, r) { +const wK = sp({ prefix: "🚀", name: "base256emoji", encode: bK, decode: yK }); +var xK = Object.freeze({ __proto__: null, base256emoji: wK }), _K = lE, m3 = 128, EK = 127, SK = ~EK, AK = Math.pow(2, 31); +function lE(t, e, r) { e = e || [], r = r || 0; - for (var n = r; t >= gK; ) e[r++] = t & 255 | p3, t /= 128; - for (; t & pK; ) e[r++] = t & 255 | p3, t >>>= 7; - return e[r] = t | 0, uE.bytes = r - n + 1, e; + for (var n = r; t >= AK; ) e[r++] = t & 255 | m3, t /= 128; + for (; t & SK; ) e[r++] = t & 255 | m3, t >>>= 7; + return e[r] = t | 0, lE.bytes = r - n + 1, e; } -var mK = R1, vK = 128, g3 = 127; +var PK = R1, MK = 128, v3 = 127; function R1(t, n) { var r = 0, n = n || 0, i = 0, s = n, o, a = t.length; do { if (s >= a) throw R1.bytes = 0, new RangeError("Could not decode varint"); - o = t[s++], r += i < 28 ? (o & g3) << i : (o & g3) * Math.pow(2, i), i += 7; - } while (o >= vK); + o = t[s++], r += i < 28 ? (o & v3) << i : (o & v3) * Math.pow(2, i), i += 7; + } while (o >= MK); return R1.bytes = s - n, r; } -var bK = Math.pow(2, 7), yK = Math.pow(2, 14), wK = Math.pow(2, 21), xK = Math.pow(2, 28), _K = Math.pow(2, 35), EK = Math.pow(2, 42), SK = Math.pow(2, 49), AK = Math.pow(2, 56), PK = Math.pow(2, 63), MK = function(t) { - return t < bK ? 1 : t < yK ? 2 : t < wK ? 3 : t < xK ? 4 : t < _K ? 5 : t < EK ? 6 : t < SK ? 7 : t < AK ? 8 : t < PK ? 9 : 10; -}, IK = { encode: hK, decode: mK, encodingLength: MK }, fE = IK; -const m3 = (t, e, r = 0) => (fE.encode(t, e, r), e), v3 = (t) => fE.encodingLength(t), D1 = (t, e) => { - const r = e.byteLength, n = v3(t), i = n + v3(r), s = new Uint8Array(i + r); - return m3(t, s, 0), m3(r, s, n), s.set(e, i), new CK(t, r, e, s); +var IK = Math.pow(2, 7), CK = Math.pow(2, 14), TK = Math.pow(2, 21), RK = Math.pow(2, 28), DK = Math.pow(2, 35), OK = Math.pow(2, 42), NK = Math.pow(2, 49), LK = Math.pow(2, 56), kK = Math.pow(2, 63), $K = function(t) { + return t < IK ? 1 : t < CK ? 2 : t < TK ? 3 : t < RK ? 4 : t < DK ? 5 : t < OK ? 6 : t < NK ? 7 : t < LK ? 8 : t < kK ? 9 : 10; +}, BK = { encode: _K, decode: PK, encodingLength: $K }, hE = BK; +const b3 = (t, e, r = 0) => (hE.encode(t, e, r), e), y3 = (t) => hE.encodingLength(t), D1 = (t, e) => { + const r = e.byteLength, n = y3(t), i = n + y3(r), s = new Uint8Array(i + r); + return b3(t, s, 0), b3(r, s, n), s.set(e, i), new FK(t, r, e, s); }; -class CK { +class FK { constructor(e, r, n, i) { this.code = e, this.size = r, this.digest = n, this.bytes = i; } } -const lE = ({ name: t, code: e, encode: r }) => new TK(t, e, r); -class TK { +const dE = ({ name: t, code: e, encode: r }) => new jK(t, e, r); +class jK { constructor(e, r, n) { this.name = e, this.code = r, this.encode = n; } @@ -18361,37 +18361,37 @@ class TK { } else throw Error("Unknown type, must be binary type"); } } -const hE = (t) => async (e) => new Uint8Array(await crypto.subtle.digest(t, e)), RK = lE({ name: "sha2-256", code: 18, encode: hE("SHA-256") }), DK = lE({ name: "sha2-512", code: 19, encode: hE("SHA-512") }); -var OK = Object.freeze({ __proto__: null, sha256: RK, sha512: DK }); -const dE = 0, NK = "identity", pE = oE, LK = (t) => D1(dE, pE(t)), kK = { code: dE, name: NK, encode: pE, digest: LK }; -var $K = Object.freeze({ __proto__: null, identity: kK }); +const pE = (t) => async (e) => new Uint8Array(await crypto.subtle.digest(t, e)), UK = dE({ name: "sha2-256", code: 18, encode: pE("SHA-256") }), qK = dE({ name: "sha2-512", code: 19, encode: pE("SHA-512") }); +var zK = Object.freeze({ __proto__: null, sha256: UK, sha512: qK }); +const gE = 0, WK = "identity", mE = cE, HK = (t) => D1(gE, mE(t)), KK = { code: gE, name: WK, encode: mE, digest: HK }; +var VK = Object.freeze({ __proto__: null, identity: KK }); new TextEncoder(), new TextDecoder(); -const b3 = { ...CW, ...RW, ...OW, ...LW, ...FW, ...GW, ...XW, ...eK, ...sK, ...lK }; -({ ...OK, ...$K }); -function FK(t = 0) { +const w3 = { ...FH, ...UH, ...zH, ...HH, ...GH, ...iK, ...aK, ...fK, ...gK, ...xK }; +({ ...zK, ...VK }); +function GK(t = 0) { return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); } -function gE(t, e, r, n) { +function vE(t, e, r, n) { return { name: t, prefix: e, encoder: { name: t, prefix: e, encode: r }, decoder: { decode: n } }; } -const y3 = gE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), pm = gE("ascii", "a", (t) => { +const x3 = vE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), pm = vE("ascii", "a", (t) => { let e = "a"; for (let r = 0; r < t.length; r++) e += String.fromCharCode(t[r]); return e; }, (t) => { t = t.substring(1); - const e = FK(t.length); + const e = GK(t.length); for (let r = 0; r < t.length; r++) e[r] = t.charCodeAt(r); return e; -}), BK = { utf8: y3, "utf-8": y3, hex: b3.base16, latin1: pm, ascii: pm, binary: pm, ...b3 }; -function UK(t, e = "utf8") { - const r = BK[e]; +}), YK = { utf8: x3, "utf-8": x3, hex: w3.base16, latin1: pm, ascii: pm, binary: pm, ...w3 }; +function JK(t, e = "utf8") { + const r = YK[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t, "utf8") : r.decoder.decode(`${r.prefix}${t}`); } -let jK = class { +let XK = class { constructor(e, r) { - this.core = e, this.logger = r, this.keychain = /* @__PURE__ */ new Map(), this.name = UH, this.version = jH, this.initialized = !1, this.storagePrefix = Zs, this.init = async () => { + this.core = e, this.logger = r, this.keychain = /* @__PURE__ */ new Map(), this.name = JW, this.version = XW, this.initialized = !1, this.storagePrefix = eo, this.init = async () => { if (!this.initialized) { const n = await this.getKeyChain(); typeof n < "u" && (this.keychain = n), this.initialized = !0; @@ -18408,7 +18408,7 @@ let jK = class { return i; }, this.del = async (n) => { this.isInitialized(), this.keychain.delete(n), await this.persist(); - }, this.core = e, this.logger = ai(r, this.name); + }, this.core = e, this.logger = ci(r, this.name); } get context() { return Si(this.logger); @@ -18417,11 +18417,11 @@ let jK = class { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; } async setKeyChain(e) { - await this.core.storage.setItem(this.storageKey, N8(e)); + await this.core.storage.setItem(this.storageKey, k8(e)); } async getKeyChain() { const e = await this.core.storage.getItem(this.storageKey); - return typeof e < "u" ? L8(e) : void 0; + return typeof e < "u" ? $8(e) : void 0; } async persist() { await this.setKeyChain(this.keychain); @@ -18432,29 +18432,29 @@ let jK = class { throw new Error(e); } } -}, qK = class { +}, ZK = class { constructor(e, r, n) { - this.core = e, this.logger = r, this.name = FH, this.randomSessionIdentifier = I1(), this.initialized = !1, this.init = async () => { + this.core = e, this.logger = r, this.name = GW, this.randomSessionIdentifier = I1(), this.initialized = !1, this.init = async () => { this.initialized || (await this.keychain.init(), this.initialized = !0); }, this.hasKeys = (i) => (this.isInitialized(), this.keychain.has(i)), this.getClientId = async () => { this.isInitialized(); - const i = await this.getClientSeed(), s = ix(i); - return U4(s.publicKey); + const i = await this.getClientSeed(), s = ox(i); + return q4(s.publicKey); }, this.generateKeyPair = () => { this.isInitialized(); - const i = lz(); + const i = xz(); return this.setPrivateKey(i.publicKey, i.privateKey); }, this.signJWT = async (i) => { this.isInitialized(); - const s = await this.getClientSeed(), o = ix(s), a = this.randomSessionIdentifier; - return await NF(a, i, BH, o); + const s = await this.getClientSeed(), o = ox(s), a = this.randomSessionIdentifier; + return await WB(a, i, YW, o); }, this.generateSharedKey = (i, s, o) => { this.isInitialized(); - const a = this.getPrivateKey(i), u = hz(a, s); + const a = this.getPrivateKey(i), u = _z(a, s); return this.setSymKey(u, o); }, this.setSymKey = async (i, s) => { this.isInitialized(); - const o = s || Cd(i); + const o = s || Td(i); return await this.keychain.set(o, i), o; }, this.deleteKeyPair = async (i) => { this.isInitialized(), await this.keychain.del(i); @@ -18462,38 +18462,38 @@ let jK = class { this.isInitialized(), await this.keychain.del(i); }, this.encode = async (i, s, o) => { this.isInitialized(); - const a = W8(o), u = ko(s); - if (Vx(a)) return pz(u, o == null ? void 0 : o.encoding); - if (Kx(a)) { + const a = V8(o), u = Bo(s); + if (Yx(a)) return Sz(u, o == null ? void 0 : o.encoding); + if (Gx(a)) { const w = a.senderPublicKey, A = a.receiverPublicKey; i = await this.generateSharedKey(w, A); } - const l = this.getSymKey(i), { type: d, senderPublicKey: g } = a; - return dz({ type: d, symKey: l, message: u, senderPublicKey: g, encoding: o == null ? void 0 : o.encoding }); + const l = this.getSymKey(i), { type: d, senderPublicKey: p } = a; + return Ez({ type: d, symKey: l, message: u, senderPublicKey: p, encoding: o == null ? void 0 : o.encoding }); }, this.decode = async (i, s, o) => { this.isInitialized(); - const a = vz(s, o); - if (Vx(a)) { - const u = mz(s, o == null ? void 0 : o.encoding); - return uc(u); + const a = Mz(s, o); + if (Yx(a)) { + const u = Pz(s, o == null ? void 0 : o.encoding); + return lc(u); } - if (Kx(a)) { + if (Gx(a)) { const u = a.receiverPublicKey, l = a.senderPublicKey; i = await this.generateSharedKey(u, l); } try { - const u = this.getSymKey(i), l = gz({ symKey: u, encoded: s, encoding: o == null ? void 0 : o.encoding }); - return uc(l); + const u = this.getSymKey(i), l = Az({ symKey: u, encoded: s, encoding: o == null ? void 0 : o.encoding }); + return lc(l); } catch (u) { this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`), this.logger.error(u); } - }, this.getPayloadType = (i, s = la) => { - const o = _l({ encoded: i, encoding: s }); - return hc(o.type); - }, this.getPayloadSenderPublicKey = (i, s = la) => { - const o = _l({ encoded: i, encoding: s }); - return o.senderPublicKey ? Dn(o.senderPublicKey, oi) : void 0; - }, this.core = e, this.logger = ai(r, this.name), this.keychain = n || new jK(this.core, this.logger); + }, this.getPayloadType = (i, s = pa) => { + const o = El({ encoded: i, encoding: s }); + return pc(o.type); + }, this.getPayloadSenderPublicKey = (i, s = pa) => { + const o = El({ encoded: i, encoding: s }); + return o.senderPublicKey ? On(o.senderPublicKey, ai) : void 0; + }, this.core = e, this.logger = ci(r, this.name), this.keychain = n || new XK(this.core, this.logger); } get context() { return Si(this.logger); @@ -18507,11 +18507,11 @@ let jK = class { async getClientSeed() { let e = ""; try { - e = this.keychain.get(h3); + e = this.keychain.get(p3); } catch { - e = I1(), await this.keychain.set(h3, e); + e = I1(), await this.keychain.set(p3, e); } - return UK(e, "base16"); + return JK(e, "base16"); } getSymKey(e) { return this.keychain.get(e); @@ -18523,9 +18523,9 @@ let jK = class { } } }; -class zK extends Uk { +class QK extends Jk { constructor(e, r) { - super(e, r), this.logger = e, this.core = r, this.messages = /* @__PURE__ */ new Map(), this.name = qH, this.version = zH, this.initialized = !1, this.storagePrefix = Zs, this.init = async () => { + super(e, r), this.logger = e, this.core = r, this.messages = /* @__PURE__ */ new Map(), this.name = ZW, this.version = QW, this.initialized = !1, this.storagePrefix = eo, this.init = async () => { if (!this.initialized) { this.logger.trace("Initialized"); try { @@ -18539,7 +18539,7 @@ class zK extends Uk { } }, this.set = async (n, i) => { this.isInitialized(); - const s = wo(i); + const s = Eo(i); let o = this.messages.get(n); return typeof o > "u" && (o = {}), typeof o[s] < "u" || (o[s] = i, this.messages.set(n, o), await this.persist()), s; }, this.get = (n) => { @@ -18548,11 +18548,11 @@ class zK extends Uk { return typeof i > "u" && (i = {}), i; }, this.has = (n, i) => { this.isInitialized(); - const s = this.get(n), o = wo(i); + const s = this.get(n), o = Eo(i); return typeof s[o] < "u"; }, this.del = async (n) => { this.isInitialized(), this.messages.delete(n), await this.persist(); - }, this.logger = ai(e, this.name), this.core = r; + }, this.logger = ci(e, this.name), this.core = r; } get context() { return Si(this.logger); @@ -18561,11 +18561,11 @@ class zK extends Uk { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; } async setRelayerMessages(e) { - await this.core.storage.setItem(this.storageKey, N8(e)); + await this.core.storage.setItem(this.storageKey, k8(e)); } async getRelayerMessages() { const e = await this.core.storage.getItem(this.storageKey); - return typeof e < "u" ? L8(e) : void 0; + return typeof e < "u" ? $8(e) : void 0; } async persist() { await this.setRelayerMessages(this.messages); @@ -18577,22 +18577,22 @@ class zK extends Uk { } } } -class HK extends jk { +class eV extends Xk { constructor(e, r) { - super(e, r), this.relayer = e, this.logger = r, this.events = new rs.EventEmitter(), this.name = WH, this.queue = /* @__PURE__ */ new Map(), this.publishTimeout = mt.toMiliseconds(mt.ONE_MINUTE), this.failedPublishTimeout = mt.toMiliseconds(mt.ONE_SECOND), this.needsTransportRestart = !1, this.publish = async (n, i, s) => { + super(e, r), this.relayer = e, this.logger = r, this.events = new ns.EventEmitter(), this.name = tH, this.queue = /* @__PURE__ */ new Map(), this.publishTimeout = mt.toMiliseconds(mt.ONE_MINUTE), this.failedPublishTimeout = mt.toMiliseconds(mt.ONE_SECOND), this.needsTransportRestart = !1, this.publish = async (n, i, s) => { var o; this.logger.debug("Publishing Payload"), this.logger.trace({ type: "method", method: "publish", params: { topic: n, message: i, opts: s } }); - const a = (s == null ? void 0 : s.ttl) || HH, u = C1(s), l = (s == null ? void 0 : s.prompt) || !1, d = (s == null ? void 0 : s.tag) || 0, g = (s == null ? void 0 : s.id) || rc().toString(), w = { topic: n, message: i, opts: { ttl: a, relay: u, prompt: l, tag: d, id: g, attestation: s == null ? void 0 : s.attestation } }, A = `Failed to publish payload, please try again. id:${g} tag:${d}`, M = Date.now(); + const a = (s == null ? void 0 : s.ttl) || eH, u = C1(s), l = (s == null ? void 0 : s.prompt) || !1, d = (s == null ? void 0 : s.tag) || 0, p = (s == null ? void 0 : s.id) || ic().toString(), w = { topic: n, message: i, opts: { ttl: a, relay: u, prompt: l, tag: d, id: p, attestation: s == null ? void 0 : s.attestation } }, A = `Failed to publish payload, please try again. id:${p} tag:${d}`, P = Date.now(); let N, L = 1; try { for (; N === void 0; ) { - if (Date.now() - M > this.publishTimeout) throw new Error(A); - this.logger.trace({ id: g, attempts: L }, `publisher.publish - attempt ${L}`), N = await await hu(this.rpcPublish(n, i, a, u, l, d, g, s == null ? void 0 : s.attestation).catch(($) => this.logger.warn($)), this.publishTimeout, A), L++, N || await new Promise(($) => setTimeout($, this.failedPublishTimeout)); + if (Date.now() - P > this.publishTimeout) throw new Error(A); + this.logger.trace({ id: p, attempts: L }, `publisher.publish - attempt ${L}`), N = await await du(this.rpcPublish(n, i, a, u, l, d, p, s == null ? void 0 : s.attestation).catch(($) => this.logger.warn($)), this.publishTimeout, A), L++, N || await new Promise(($) => setTimeout($, this.failedPublishTimeout)); } - this.relayer.events.emit(si.publish, w), this.logger.debug("Successfully Published Payload"), this.logger.trace({ type: "method", method: "publish", params: { id: g, topic: n, message: i, opts: s } }); + this.relayer.events.emit(si.publish, w), this.logger.debug("Successfully Published Payload"), this.logger.trace({ type: "method", method: "publish", params: { id: p, topic: n, message: i, opts: s } }); } catch ($) { if (this.logger.debug("Failed to Publish Payload"), this.logger.error($), (o = s == null ? void 0 : s.internal) != null && o.throwOnFailedPublish) throw $; - this.queue.set(g, w); + this.queue.set(p, w); } }, this.on = (n, i) => { this.events.on(n, i); @@ -18602,15 +18602,15 @@ class HK extends jk { this.events.off(n, i); }, this.removeListener = (n, i) => { this.events.removeListener(n, i); - }, this.relayer = e, this.logger = ai(r, this.name), this.registerEventListeners(); + }, this.relayer = e, this.logger = ci(r, this.name), this.registerEventListeners(); } get context() { return Si(this.logger); } rpcPublish(e, r, n, i, s, o, a, u) { - var l, d, g, w; - const A = { method: $f(i.protocol).publish, params: { topic: e, message: r, ttl: n, prompt: s, tag: o, attestation: u }, id: a }; - return gi((l = A.params) == null ? void 0 : l.prompt) && ((d = A.params) == null || delete d.prompt), gi((g = A.params) == null ? void 0 : g.tag) && ((w = A.params) == null || delete w.tag), this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "message", direction: "outgoing", request: A }), this.relayer.request(A); + var l, d, p, w; + const A = { method: Bf(i.protocol).publish, params: { topic: e, message: r, ttl: n, prompt: s, tag: o, attestation: u }, id: a }; + return mi((l = A.params) == null ? void 0 : l.prompt) && ((d = A.params) == null || delete d.prompt), mi((p = A.params) == null ? void 0 : p.tag) && ((w = A.params) == null || delete w.tag), this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "message", direction: "outgoing", request: A }), this.relayer.request(A); } removeRequestFromQueue(e) { this.queue.delete(e); @@ -18622,7 +18622,7 @@ class HK extends jk { }); } registerEventListeners() { - this.relayer.core.heartbeat.on(Du.pulse, () => { + this.relayer.core.heartbeat.on(Ou.pulse, () => { if (this.needsTransportRestart) { this.needsTransportRestart = !1, this.relayer.events.emit(si.connection_stalled); return; @@ -18633,7 +18633,7 @@ class HK extends jk { }); } } -class WK { +class tV { constructor() { this.map = /* @__PURE__ */ new Map(), this.set = (e, r) => { const n = this.get(e); @@ -18660,14 +18660,14 @@ class WK { return Array.from(this.map.keys()); } } -var KK = Object.defineProperty, VK = Object.defineProperties, GK = Object.getOwnPropertyDescriptors, w3 = Object.getOwnPropertySymbols, YK = Object.prototype.hasOwnProperty, JK = Object.prototype.propertyIsEnumerable, x3 = (t, e, r) => e in t ? KK(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, If = (t, e) => { - for (var r in e || (e = {})) YK.call(e, r) && x3(t, r, e[r]); - if (w3) for (var r of w3(e)) JK.call(e, r) && x3(t, r, e[r]); +var rV = Object.defineProperty, nV = Object.defineProperties, iV = Object.getOwnPropertyDescriptors, _3 = Object.getOwnPropertySymbols, sV = Object.prototype.hasOwnProperty, oV = Object.prototype.propertyIsEnumerable, E3 = (t, e, r) => e in t ? rV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Cf = (t, e) => { + for (var r in e || (e = {})) sV.call(e, r) && E3(t, r, e[r]); + if (_3) for (var r of _3(e)) oV.call(e, r) && E3(t, r, e[r]); return t; -}, gm = (t, e) => VK(t, GK(e)); -class XK extends Hk { +}, gm = (t, e) => nV(t, iV(e)); +class aV extends e$ { constructor(e, r) { - super(e, r), this.relayer = e, this.logger = r, this.subscriptions = /* @__PURE__ */ new Map(), this.topicMap = new WK(), this.events = new rs.EventEmitter(), this.name = ZH, this.version = QH, this.pending = /* @__PURE__ */ new Map(), this.cached = [], this.initialized = !1, this.pendingSubscriptionWatchLabel = "pending_sub_watch_label", this.pollingInterval = 20, this.storagePrefix = Zs, this.subscribeTimeout = mt.toMiliseconds(mt.ONE_MINUTE), this.restartInProgress = !1, this.batchSubscribeTopicsLimit = 500, this.pendingBatchMessages = [], this.init = async () => { + super(e, r), this.relayer = e, this.logger = r, this.subscriptions = /* @__PURE__ */ new Map(), this.topicMap = new tV(), this.events = new ns.EventEmitter(), this.name = cH, this.version = uH, this.pending = /* @__PURE__ */ new Map(), this.cached = [], this.initialized = !1, this.pendingSubscriptionWatchLabel = "pending_sub_watch_label", this.pollingInterval = 20, this.storagePrefix = eo, this.subscribeTimeout = mt.toMiliseconds(mt.ONE_MINUTE), this.restartInProgress = !1, this.batchSubscribeTopicsLimit = 500, this.pendingBatchMessages = [], this.init = async () => { this.initialized || (this.logger.trace("Initialized"), this.registerEventListeners(), this.clientId = await this.relayer.core.crypto.getClientId(), await this.restore()), this.initialized = !0; }, this.subscribe = async (n, i) => { this.isInitialized(), this.logger.debug("Subscribing Topic"), this.logger.trace({ type: "method", method: "subscribe", params: { topic: n, opts: i } }); @@ -18688,7 +18688,7 @@ class XK extends Hk { const a = new mt.Watch(); a.start(i); const u = setInterval(() => { - !this.pending.has(n) && this.topics.includes(n) && (clearInterval(u), a.stop(i), s(!0)), a.elapsed(i) >= eW && (clearInterval(u), a.stop(i), o(new Error("Subscription resolution timeout"))); + !this.pending.has(n) && this.topics.includes(n) && (clearInterval(u), a.stop(i), s(!0)), a.elapsed(i) >= fH && (clearInterval(u), a.stop(i), o(new Error("Subscription resolution timeout"))); }, this.pollingInterval); }).catch(() => !1); }, this.on = (n, i) => { @@ -18705,7 +18705,7 @@ class XK extends Hk { await this.onDisconnect(); }, this.restart = async () => { this.restartInProgress = !0, await this.restore(), await this.reset(), this.restartInProgress = !1; - }, this.relayer = e, this.logger = ai(r, this.name), this.clientId = ""; + }, this.relayer = e, this.logger = ci(r, this.name), this.clientId = ""; } get context() { return Si(this.logger); @@ -18757,15 +18757,15 @@ class XK extends Hk { async rpcSubscribe(e, r, n) { var i; (n == null ? void 0 : n.transportType) === zr.relay && await this.restartToComplete(); - const s = { method: $f(r.protocol).subscribe, params: { topic: e } }; + const s = { method: Bf(r.protocol).subscribe, params: { topic: e } }; this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: s }); const o = (i = n == null ? void 0 : n.internal) == null ? void 0 : i.throwOnFailedPublish; try { - const a = wo(e + this.clientId); + const a = Eo(e + this.clientId); if ((n == null ? void 0 : n.transportType) === zr.link_mode) return setTimeout(() => { (this.relayer.connected || this.relayer.connecting) && this.relayer.request(s).catch((l) => this.logger.warn(l)); }, mt.toMiliseconds(mt.ONE_SECOND)), a; - const u = await hu(this.relayer.request(s).catch((l) => this.logger.warn(l)), this.subscribeTimeout, `Subscribing to ${e} failed, please try again`); + const u = await du(this.relayer.request(s).catch((l) => this.logger.warn(l)), this.subscribeTimeout, `Subscribing to ${e} failed, please try again`); if (!u && o) throw new Error(`Subscribing to ${e} failed, please try again`); return u ? a : null; } catch (a) { @@ -18775,36 +18775,36 @@ class XK extends Hk { } async rpcBatchSubscribe(e) { if (!e.length) return; - const r = e[0].relay, n = { method: $f(r.protocol).batchSubscribe, params: { topics: e.map((i) => i.topic) } }; + const r = e[0].relay, n = { method: Bf(r.protocol).batchSubscribe, params: { topics: e.map((i) => i.topic) } }; this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: n }); try { - return await await hu(this.relayer.request(n).catch((i) => this.logger.warn(i)), this.subscribeTimeout); + return await await du(this.relayer.request(n).catch((i) => this.logger.warn(i)), this.subscribeTimeout); } catch { this.relayer.events.emit(si.connection_stalled); } } async rpcBatchFetchMessages(e) { if (!e.length) return; - const r = e[0].relay, n = { method: $f(r.protocol).batchFetchMessages, params: { topics: e.map((s) => s.topic) } }; + const r = e[0].relay, n = { method: Bf(r.protocol).batchFetchMessages, params: { topics: e.map((s) => s.topic) } }; this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: n }); let i; try { - i = await await hu(this.relayer.request(n).catch((s) => this.logger.warn(s)), this.subscribeTimeout); + i = await await du(this.relayer.request(n).catch((s) => this.logger.warn(s)), this.subscribeTimeout); } catch { this.relayer.events.emit(si.connection_stalled); } return i; } rpcUnsubscribe(e, r, n) { - const i = { method: $f(n.protocol).unsubscribe, params: { topic: e, id: r } }; + const i = { method: Bf(n.protocol).unsubscribe, params: { topic: e, id: r } }; return this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: i }), this.relayer.request(i); } onSubscribe(e, r) { - this.setSubscription(e, gm(If({}, r), { id: e })), this.pending.delete(r.topic); + this.setSubscription(e, gm(Cf({}, r), { id: e })), this.pending.delete(r.topic); } onBatchSubscribe(e) { e.length && e.forEach((r) => { - this.setSubscription(r.id, If({}, r)), this.pending.delete(r.topic); + this.setSubscription(r.id, Cf({}, r)), this.pending.delete(r.topic); }); } async onUnsubscribe(e, r, n) { @@ -18820,7 +18820,7 @@ class XK extends Hk { this.logger.debug("Setting subscription"), this.logger.trace({ type: "method", method: "setSubscription", id: e, subscription: r }), this.addSubscription(e, r); } addSubscription(e, r) { - this.subscriptions.set(e, If({}, r)), this.topicMap.set(r.topic, e), this.events.emit(Us.created, r); + this.subscriptions.set(e, Cf({}, r)), this.topicMap.set(r.topic, e), this.events.emit(Us.created, r); } getSubscription(e) { this.logger.debug("Getting subscription"), this.logger.trace({ type: "method", method: "getSubscription", id: e }); @@ -18834,7 +18834,7 @@ class XK extends Hk { deleteSubscription(e, r) { this.logger.debug("Deleting subscription"), this.logger.trace({ type: "method", method: "deleteSubscription", id: e, reason: r }); const n = this.getSubscription(e); - this.subscriptions.delete(e), this.topicMap.delete(n.topic, e), this.events.emit(Us.deleted, gm(If({}, n), { reason: r })); + this.subscriptions.delete(e), this.topicMap.delete(n.topic, e), this.events.emit(Us.deleted, gm(Cf({}, n), { reason: r })); } async persist() { await this.setRelayerSubscriptions(this.values), this.events.emit(Us.sync); @@ -18865,7 +18865,7 @@ class XK extends Hk { async batchSubscribe(e) { if (!e.length) return; const r = await this.rpcBatchSubscribe(e); - dc(r) && this.onBatchSubscribe(r.map((n, i) => gm(If({}, e[i]), { id: n }))); + gc(r) && this.onBatchSubscribe(r.map((n, i) => gm(Cf({}, e[i]), { id: n }))); } async batchFetchMessages(e) { if (!e.length) return; @@ -18887,7 +18887,7 @@ class XK extends Hk { }), await this.batchSubscribe(e), this.pendingBatchMessages.length && (await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages), this.pendingBatchMessages = []); } registerEventListeners() { - this.relayer.core.heartbeat.on(Du.pulse, async () => { + this.relayer.core.heartbeat.on(Ou.pulse, async () => { await this.checkPending(); }), this.events.on(Us.created, async (e) => { const r = Us.created; @@ -18911,17 +18911,17 @@ class XK extends Hk { }); } } -var ZK = Object.defineProperty, _3 = Object.getOwnPropertySymbols, QK = Object.prototype.hasOwnProperty, eV = Object.prototype.propertyIsEnumerable, E3 = (t, e, r) => e in t ? ZK(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, S3 = (t, e) => { - for (var r in e || (e = {})) QK.call(e, r) && E3(t, r, e[r]); - if (_3) for (var r of _3(e)) eV.call(e, r) && E3(t, r, e[r]); +var cV = Object.defineProperty, S3 = Object.getOwnPropertySymbols, uV = Object.prototype.hasOwnProperty, fV = Object.prototype.propertyIsEnumerable, A3 = (t, e, r) => e in t ? cV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, P3 = (t, e) => { + for (var r in e || (e = {})) uV.call(e, r) && A3(t, r, e[r]); + if (S3) for (var r of S3(e)) fV.call(e, r) && A3(t, r, e[r]); return t; }; -class tV extends qk { +class lV extends Zk { constructor(e) { - super(e), this.protocol = "wc", this.version = 2, this.events = new rs.EventEmitter(), this.name = VH, this.transportExplicitlyClosed = !1, this.initialized = !1, this.connectionAttemptInProgress = !1, this.connectionStatusPollingInterval = 20, this.staleConnectionErrors = ["socket hang up", "stalled", "interrupted"], this.hasExperiencedNetworkDisruption = !1, this.requestsInFlight = /* @__PURE__ */ new Map(), this.heartBeatTimeout = mt.toMiliseconds(mt.THIRTY_SECONDS + mt.ONE_SECOND), this.request = async (r) => { + super(e), this.protocol = "wc", this.version = 2, this.events = new ns.EventEmitter(), this.name = nH, this.transportExplicitlyClosed = !1, this.initialized = !1, this.connectionAttemptInProgress = !1, this.connectionStatusPollingInterval = 20, this.staleConnectionErrors = ["socket hang up", "stalled", "interrupted"], this.hasExperiencedNetworkDisruption = !1, this.requestsInFlight = /* @__PURE__ */ new Map(), this.heartBeatTimeout = mt.toMiliseconds(mt.THIRTY_SECONDS + mt.ONE_SECOND), this.request = async (r) => { var n, i; this.logger.debug("Publishing Request Payload"); - const s = r.id || rc().toString(); + const s = r.id || ic().toString(); await this.toEstablishConnection(); try { const o = this.provider.request(r); @@ -18930,9 +18930,9 @@ class tV extends qk { const d = () => { l(new Error(`relayer.request - publish interrupted, id: ${s}`)); }; - this.provider.on(Vi.disconnect, d); - const g = await o; - this.provider.off(Vi.disconnect, d), u(g); + this.provider.on(Gi.disconnect, d); + const p = await o; + this.provider.off(Gi.disconnect, d), u(p); }); return this.logger.trace({ id: s, method: r.method, topic: (i = r.params) == null ? void 0 : i.topic }, "relayer.request - published"), a; } catch (o) { @@ -18941,7 +18941,7 @@ class tV extends qk { this.requestsInFlight.delete(s); } }, this.resetPingTimeout = () => { - if (a0()) try { + if (c0()) try { clearTimeout(this.pingTimeout), this.pingTimeout = setTimeout(() => { var r, n, i; (i = (n = (r = this.provider) == null ? void 0 : r.connection) == null ? void 0 : n.socket) == null || i.terminate(); @@ -18958,8 +18958,8 @@ class tV extends qk { }, this.onProviderErrorHandler = (r) => { this.logger.error(r), this.events.emit(si.error, r), this.logger.info("Fatal socket error received, closing transport"), this.transportClose(); }, this.registerProviderListeners = () => { - this.provider.on(Vi.payload, this.onPayloadHandler), this.provider.on(Vi.connect, this.onConnectHandler), this.provider.on(Vi.disconnect, this.onDisconnectHandler), this.provider.on(Vi.error, this.onProviderErrorHandler); - }, this.core = e.core, this.logger = typeof e.logger < "u" && typeof e.logger != "string" ? ai(e.logger, this.name) : jl(k0({ level: e.logger || KH })), this.messages = new zK(this.logger, e.core), this.subscriber = new XK(this, this.logger), this.publisher = new HK(this, this.logger), this.relayUrl = (e == null ? void 0 : e.relayUrl) || iE, this.projectId = e.projectId, this.bundleId = Cq(), this.provider = {}; + this.provider.on(Gi.payload, this.onPayloadHandler), this.provider.on(Gi.connect, this.onConnectHandler), this.provider.on(Gi.disconnect, this.onDisconnectHandler), this.provider.on(Gi.error, this.onProviderErrorHandler); + }, this.core = e.core, this.logger = typeof e.logger < "u" && typeof e.logger != "string" ? ci(e.logger, this.name) : ql($0({ level: e.logger || rH })), this.messages = new QK(this.logger, e.core), this.subscriber = new aV(this, this.logger), this.publisher = new eV(this, this.logger), this.relayUrl = (e == null ? void 0 : e.relayUrl) || oE, this.projectId = e.projectId, this.bundleId = Fq(), this.provider = {}; } async init() { if (this.logger.trace("Initialized"), this.registerEventListeners(), await Promise.all([this.messages.init(), this.subscriber.init()]), this.initialized = !0, this.subscriber.cached.length > 0) try { @@ -18992,9 +18992,9 @@ class tV extends qk { }; return await Promise.all([new Promise((d) => { u = d, this.subscriber.on(Us.created, l); - }), new Promise(async (d, g) => { - a = await this.subscriber.subscribe(e, S3({ internal: { throwOnFailedPublish: o } }, r)).catch((w) => { - o && g(w); + }), new Promise(async (d, p) => { + a = await this.subscriber.subscribe(e, P3({ internal: { throwOnFailedPublish: o } }, r)).catch((w) => { + o && p(w); }) || a, d(); })]), a; } @@ -19019,7 +19019,7 @@ class tV extends qk { } catch (e) { this.logger.warn(e); } - this.provider.disconnect && (this.hasExperiencedNetworkDisruption || this.connected) ? await hu(this.provider.disconnect(), 2e3, "provider.disconnect()").catch(() => this.onProviderDisconnect()) : this.onProviderDisconnect(); + this.provider.disconnect && (this.hasExperiencedNetworkDisruption || this.connected) ? await du(this.provider.disconnect(), 2e3, "provider.disconnect()").catch(() => this.onProviderDisconnect()) : this.onProviderDisconnect(); } async transportClose() { this.transportExplicitlyClosed = !0, await this.transportDisconnect(); @@ -19029,9 +19029,9 @@ class tV extends qk { try { await new Promise(async (r, n) => { const i = () => { - this.provider.off(Vi.disconnect, i), n(new Error("Connection interrupted while trying to subscribe")); + this.provider.off(Gi.disconnect, i), n(new Error("Connection interrupted while trying to subscribe")); }; - this.provider.on(Vi.disconnect, i), await hu(this.provider.connect(), mt.toMiliseconds(mt.ONE_MINUTE), `Socket stalled when trying to connect to ${this.relayUrl}`).catch((s) => { + this.provider.on(Gi.disconnect, i), await du(this.provider.connect(), mt.toMiliseconds(mt.ONE_MINUTE), `Socket stalled when trying to connect to ${this.relayUrl}`).catch((s) => { n(s); }).finally(() => { clearTimeout(this.reconnectTimeout), this.reconnectTimeout = void 0; @@ -19051,7 +19051,7 @@ class tV extends qk { this.connectionAttemptInProgress || (this.relayUrl = e || this.relayUrl, await this.confirmOnlineStateOrThrow(), await this.transportClose(), await this.transportOpen()); } async confirmOnlineStateOrThrow() { - if (!await i3()) throw new Error("No internet connection detected. Please restart your network and try again."); + if (!await o3()) throw new Error("No internet connection detected. Please restart your network and try again."); } async handleBatchMessageEvents(e) { if ((e == null ? void 0 : e.length) === 0) { @@ -19077,7 +19077,7 @@ class tV extends qk { } startPingTimeout() { var e, r, n, i, s; - if (a0()) try { + if (c0()) try { (r = (e = this.provider) == null ? void 0 : e.connection) != null && r.socket && ((s = (i = (n = this.provider) == null ? void 0 : n.connection) == null ? void 0 : i.socket) == null || s.once("ping", () => { this.resetPingTimeout(); })), this.resetPingTimeout(); @@ -19091,7 +19091,7 @@ class tV extends qk { async createProvider() { this.provider.connection && this.unregisterProviderListeners(); const e = await this.core.crypto.signJWT(this.relayUrl); - this.provider = new as(new OH(Oq({ sdkVersion: T1, protocol: this.protocol, version: this.version, relayUrl: this.relayUrl, projectId: this.projectId, auth: e, useOnCloseEvent: !0, bundleId: this.bundleId }))), this.registerProviderListeners(); + this.provider = new cs(new zW(zq({ sdkVersion: T1, protocol: this.protocol, version: this.version, relayUrl: this.relayUrl, projectId: this.projectId, auth: e, useOnCloseEvent: !0, bundleId: this.bundleId }))), this.registerProviderListeners(); } async recordMessageEvent(e) { const { topic: r, message: n } = e; @@ -19106,31 +19106,31 @@ class tV extends qk { } async onProviderPayload(e) { if (this.logger.debug("Incoming Relay Payload"), this.logger.trace({ type: "payload", direction: "incoming", payload: e }), fb(e)) { - if (!e.method.endsWith(GH)) return; + if (!e.method.endsWith(iH)) return; const r = e.params, { topic: n, message: i, publishedAt: s, attestation: o } = r.data, a = { topic: n, message: i, publishedAt: s, transportType: zr.relay, attestation: o }; - this.logger.debug("Emitting Relayer Payload"), this.logger.trace(S3({ type: "event", event: r.id }, a)), this.events.emit(r.id, a), await this.acknowledgePayload(e), await this.onMessageEvent(a); - } else np(e) && this.events.emit(si.message_ack, e); + this.logger.debug("Emitting Relayer Payload"), this.logger.trace(P3({ type: "event", event: r.id }, a)), this.events.emit(r.id, a), await this.acknowledgePayload(e), await this.onMessageEvent(a); + } else ip(e) && this.events.emit(si.message_ack, e); } async onMessageEvent(e) { await this.shouldIgnoreMessageEvent(e) || (this.events.emit(si.message, e), await this.recordMessageEvent(e)); } async acknowledgePayload(e) { - const r = tp(e.id, !0); + const r = rp(e.id, !0); await this.provider.connection.send(r); } unregisterProviderListeners() { - this.provider.off(Vi.payload, this.onPayloadHandler), this.provider.off(Vi.connect, this.onConnectHandler), this.provider.off(Vi.disconnect, this.onDisconnectHandler), this.provider.off(Vi.error, this.onProviderErrorHandler), clearTimeout(this.pingTimeout); + this.provider.off(Gi.payload, this.onPayloadHandler), this.provider.off(Gi.connect, this.onConnectHandler), this.provider.off(Gi.disconnect, this.onDisconnectHandler), this.provider.off(Gi.error, this.onProviderErrorHandler), clearTimeout(this.pingTimeout); } async registerEventListeners() { - let e = await i3(); - fH(async (r) => { + let e = await o3(); + wW(async (r) => { e !== r && (e = r, r ? await this.restartTransport().catch((n) => this.logger.error(n)) : (this.hasExperiencedNetworkDisruption = !0, await this.transportDisconnect(), this.transportExplicitlyClosed = !1)); }); } async onProviderDisconnect() { await this.subscriber.stop(), this.requestsInFlight.clear(), clearTimeout(this.pingTimeout), this.events.emit(si.disconnect), this.connectionAttemptInProgress = !1, !this.transportExplicitlyClosed && (this.reconnectTimeout || (this.reconnectTimeout = setTimeout(async () => { await this.transportOpen().catch((e) => this.logger.error(e)); - }, mt.toMiliseconds(YH)))); + }, mt.toMiliseconds(sH)))); } isInitialized() { if (!this.initialized) { @@ -19146,26 +19146,26 @@ class tV extends qk { }), await this.transportOpen()); } } -var rV = Object.defineProperty, A3 = Object.getOwnPropertySymbols, nV = Object.prototype.hasOwnProperty, iV = Object.prototype.propertyIsEnumerable, P3 = (t, e, r) => e in t ? rV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, M3 = (t, e) => { - for (var r in e || (e = {})) nV.call(e, r) && P3(t, r, e[r]); - if (A3) for (var r of A3(e)) iV.call(e, r) && P3(t, r, e[r]); +var hV = Object.defineProperty, M3 = Object.getOwnPropertySymbols, dV = Object.prototype.hasOwnProperty, pV = Object.prototype.propertyIsEnumerable, I3 = (t, e, r) => e in t ? hV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, C3 = (t, e) => { + for (var r in e || (e = {})) dV.call(e, r) && I3(t, r, e[r]); + if (M3) for (var r of M3(e)) pV.call(e, r) && I3(t, r, e[r]); return t; }; -class _c extends zk { - constructor(e, r, n, i = Zs, s = void 0) { - super(e, r, n, i), this.core = e, this.logger = r, this.name = n, this.map = /* @__PURE__ */ new Map(), this.version = JH, this.cached = [], this.initialized = !1, this.storagePrefix = Zs, this.recentlyDeleted = [], this.recentlyDeletedLimit = 200, this.init = async () => { +class Ec extends Qk { + constructor(e, r, n, i = eo, s = void 0) { + super(e, r, n, i), this.core = e, this.logger = r, this.name = n, this.map = /* @__PURE__ */ new Map(), this.version = oH, this.cached = [], this.initialized = !1, this.storagePrefix = eo, this.recentlyDeleted = [], this.recentlyDeletedLimit = 200, this.init = async () => { this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((o) => { - this.getKey && o !== null && !gi(o) ? this.map.set(this.getKey(o), o) : jz(o) ? this.map.set(o.id, o) : qz(o) && this.map.set(o.topic, o); + this.getKey && o !== null && !mi(o) ? this.map.set(this.getKey(o), o) : Xz(o) ? this.map.set(o.id, o) : Zz(o) && this.map.set(o.topic, o); }), this.cached = [], this.initialized = !0); }, this.set = async (o, a) => { this.isInitialized(), this.map.has(o) ? await this.update(o, a) : (this.logger.debug("Setting value"), this.logger.trace({ type: "method", method: "set", key: o, value: a }), this.map.set(o, a), await this.persist()); - }, this.get = (o) => (this.isInitialized(), this.logger.debug("Getting value"), this.logger.trace({ type: "method", method: "get", key: o }), this.getData(o)), this.getAll = (o) => (this.isInitialized(), o ? this.values.filter((a) => Object.keys(o).every((u) => LH(a[u], o[u]))) : this.values), this.update = async (o, a) => { + }, this.get = (o) => (this.isInitialized(), this.logger.debug("Getting value"), this.logger.trace({ type: "method", method: "get", key: o }), this.getData(o)), this.getAll = (o) => (this.isInitialized(), o ? this.values.filter((a) => Object.keys(o).every((u) => HW(a[u], o[u]))) : this.values), this.update = async (o, a) => { this.isInitialized(), this.logger.debug("Updating value"), this.logger.trace({ type: "method", method: "update", key: o, update: a }); - const u = M3(M3({}, this.getData(o)), a); + const u = C3(C3({}, this.getData(o)), a); this.map.set(o, u), await this.persist(); }, this.delete = async (o, a) => { this.isInitialized(), this.map.has(o) && (this.logger.debug("Deleting value"), this.logger.trace({ type: "method", method: "delete", key: o, reason: a }), this.map.delete(o), this.addToRecentlyDeleted(o), await this.persist()); - }, this.logger = ai(r, this.name), this.storagePrefix = i, this.getKey = s; + }, this.logger = ci(r, this.name), this.storagePrefix = i, this.getKey = s; } get context() { return Si(this.logger); @@ -19226,38 +19226,38 @@ class _c extends zk { } } } -class sV { +class gV { constructor(e, r) { - this.core = e, this.logger = r, this.name = tW, this.version = rW, this.events = new kv(), this.initialized = !1, this.storagePrefix = Zs, this.ignoredPayloadTypes = [Io], this.registeredMethods = [], this.init = async () => { + this.core = e, this.logger = r, this.name = lH, this.version = hH, this.events = new kv(), this.initialized = !1, this.storagePrefix = eo, this.ignoredPayloadTypes = [Ro], this.registeredMethods = [], this.init = async () => { this.initialized || (await this.pairings.init(), await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.initialized = !0, this.logger.trace("Initialized")); }, this.register = ({ methods: n }) => { this.isInitialized(), this.registeredMethods = [.../* @__PURE__ */ new Set([...this.registeredMethods, ...n])]; }, this.create = async (n) => { this.isInitialized(); - const i = I1(), s = await this.core.crypto.setSymKey(i), o = En(mt.FIVE_MINUTES), a = { protocol: nE }, u = { topic: s, expiry: o, relay: a, active: !1, methods: n == null ? void 0 : n.methods }, l = Zx({ protocol: this.core.protocol, version: this.core.version, topic: s, symKey: i, relay: a, expiryTimestamp: o, methods: n == null ? void 0 : n.methods }); - return this.events.emit(Xa.create, u), this.core.expirer.set(s, o), await this.pairings.set(s, u), await this.core.relayer.subscribe(s, { transportType: n == null ? void 0 : n.transportType }), { topic: s, uri: l }; + const i = I1(), s = await this.core.crypto.setSymKey(i), o = En(mt.FIVE_MINUTES), a = { protocol: sE }, u = { topic: s, expiry: o, relay: a, active: !1, methods: n == null ? void 0 : n.methods }, l = e3({ protocol: this.core.protocol, version: this.core.version, topic: s, symKey: i, relay: a, expiryTimestamp: o, methods: n == null ? void 0 : n.methods }); + return this.events.emit(Qa.create, u), this.core.expirer.set(s, o), await this.pairings.set(s, u), await this.core.relayer.subscribe(s, { transportType: n == null ? void 0 : n.transportType }), { topic: s, uri: l }; }, this.pair = async (n) => { this.isInitialized(); const i = this.core.eventClient.createEvent({ properties: { topic: n == null ? void 0 : n.uri, trace: [Fs.pairing_started] } }); this.isValidPair(n, i); - const { topic: s, symKey: o, relay: a, expiryTimestamp: u, methods: l } = Xx(n.uri); + const { topic: s, symKey: o, relay: a, expiryTimestamp: u, methods: l } = Qx(n.uri); i.props.properties.topic = s, i.addTrace(Fs.pairing_uri_validation_success), i.addTrace(Fs.pairing_uri_not_expired); let d; if (this.pairings.keys.includes(s)) { - if (d = this.pairings.get(s), i.addTrace(Fs.existing_pairing), d.active) throw i.setError(yo.active_pairing_already_exists), new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`); + if (d = this.pairings.get(s), i.addTrace(Fs.existing_pairing), d.active) throw i.setError(_o.active_pairing_already_exists), new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`); i.addTrace(Fs.pairing_not_expired); } - const g = u || En(mt.FIVE_MINUTES), w = { topic: s, relay: a, expiry: g, active: !1, methods: l }; - this.core.expirer.set(s, g), await this.pairings.set(s, w), i.addTrace(Fs.store_new_pairing), n.activatePairing && await this.activate({ topic: s }), this.events.emit(Xa.create, w), i.addTrace(Fs.emit_inactive_pairing), this.core.crypto.keychain.has(s) || await this.core.crypto.setSymKey(o, s), i.addTrace(Fs.subscribing_pairing_topic); + const p = u || En(mt.FIVE_MINUTES), w = { topic: s, relay: a, expiry: p, active: !1, methods: l }; + this.core.expirer.set(s, p), await this.pairings.set(s, w), i.addTrace(Fs.store_new_pairing), n.activatePairing && await this.activate({ topic: s }), this.events.emit(Qa.create, w), i.addTrace(Fs.emit_inactive_pairing), this.core.crypto.keychain.has(s) || await this.core.crypto.setSymKey(o, s), i.addTrace(Fs.subscribing_pairing_topic); try { await this.core.relayer.confirmOnlineStateOrThrow(); } catch { - i.setError(yo.no_internet_connection); + i.setError(_o.no_internet_connection); } try { await this.core.relayer.subscribe(s, { relay: a }); } catch (A) { - throw i.setError(yo.subscribe_pairing_topic_failure), A; + throw i.setError(_o.subscribe_pairing_topic_failure), A; } return i.addTrace(Fs.subscribe_pairing_topic_success), w; }, this.activate = async ({ topic: n }) => { @@ -19268,7 +19268,7 @@ class sV { this.isInitialized(), await this.isValidPing(n); const { topic: i } = n; if (this.pairings.keys.includes(i)) { - const s = await this.sendRequest(i, "wc_pairingPing", {}), { done: o, resolve: a, reject: u } = Va(); + const s = await this.sendRequest(i, "wc_pairingPing", {}), { done: o, resolve: a, reject: u } = Ja(); this.events.once(br("pairing_ping", s), ({ error: l }) => { l ? u(l) : a(); }), await o(); @@ -19284,20 +19284,20 @@ class sV { }, this.formatUriFromPairing = (n) => { this.isInitialized(); const { topic: i, relay: s, expiry: o, methods: a } = n, u = this.core.crypto.keychain.get(i); - return Zx({ protocol: this.core.protocol, version: this.core.version, topic: i, symKey: u, relay: s, expiryTimestamp: o, methods: a }); + return e3({ protocol: this.core.protocol, version: this.core.version, topic: i, symKey: u, relay: s, expiryTimestamp: o, methods: a }); }, this.sendRequest = async (n, i, s) => { - const o = ha(i, s), a = await this.core.crypto.encode(n, o), u = Pf[i].req; + const o = ga(i, s), a = await this.core.crypto.encode(n, o), u = Mf[i].req; return this.core.history.set(n, o), this.core.relayer.publish(n, a, u), o.id; }, this.sendResult = async (n, i, s) => { - const o = tp(n, s), a = await this.core.crypto.encode(i, o), u = await this.core.history.get(i, n), l = Pf[u.request.method].res; + const o = rp(n, s), a = await this.core.crypto.encode(i, o), u = await this.core.history.get(i, n), l = Mf[u.request.method].res; await this.core.relayer.publish(i, a, l), await this.core.history.resolve(o); }, this.sendError = async (n, i, s) => { - const o = rp(n, s), a = await this.core.crypto.encode(i, o), u = await this.core.history.get(i, n), l = Pf[u.request.method] ? Pf[u.request.method].res : Pf.unregistered_method.res; + const o = np(n, s), a = await this.core.crypto.encode(i, o), u = await this.core.history.get(i, n), l = Mf[u.request.method] ? Mf[u.request.method].res : Mf.unregistered_method.res; await this.core.relayer.publish(i, a, l), await this.core.history.resolve(o); }, this.deletePairing = async (n, i) => { await this.core.relayer.unsubscribe(n), await Promise.all([this.pairings.delete(n, Or("USER_DISCONNECTED")), this.core.crypto.deleteSymKey(n), i ? Promise.resolve() : this.core.expirer.del(n)]); }, this.cleanup = async () => { - const n = this.pairings.getAll().filter((i) => aa(i.expiry)); + const n = this.pairings.getAll().filter((i) => fa(i.expiry)); await Promise.all(n.map((i) => this.deletePairing(i.topic))); }, this.onRelayEventRequest = (n) => { const { topic: i, payload: s } = n; @@ -19320,19 +19320,19 @@ class sV { }, this.onPairingPingRequest = async (n, i) => { const { id: s } = i; try { - this.isValidPing({ topic: n }), await this.sendResult(s, n, !0), this.events.emit(Xa.ping, { id: s, topic: n }); + this.isValidPing({ topic: n }), await this.sendResult(s, n, !0), this.events.emit(Qa.ping, { id: s, topic: n }); } catch (o) { await this.sendError(s, n, o), this.logger.error(o); } }, this.onPairingPingResponse = (n, i) => { const { id: s } = i; setTimeout(() => { - Bs(i) ? this.events.emit(br("pairing_ping", s), {}) : Zi(i) && this.events.emit(br("pairing_ping", s), { error: i.error }); + js(i) ? this.events.emit(br("pairing_ping", s), {}) : Qi(i) && this.events.emit(br("pairing_ping", s), { error: i.error }); }, 500); }, this.onPairingDeleteRequest = async (n, i) => { const { id: s } = i; try { - this.isValidDisconnect({ topic: n }), await this.deletePairing(n), this.events.emit(Xa.delete, { id: s, topic: n }); + this.isValidDisconnect({ topic: n }), await this.deletePairing(n), this.events.emit(Qa.delete, { id: s, topic: n }); } catch (o) { await this.sendError(s, n, o), this.logger.error(o); } @@ -19349,37 +19349,37 @@ class sV { this.registeredMethods.includes(n) || this.logger.error(Or("WC_METHOD_UNSUPPORTED", n)); }, this.isValidPair = (n, i) => { var s; - if (!pi(n)) { + if (!gi(n)) { const { message: a } = ft("MISSING_OR_INVALID", `pair() params: ${n}`); - throw i.setError(yo.malformed_pairing_uri), new Error(a); + throw i.setError(_o.malformed_pairing_uri), new Error(a); } - if (!Uz(n.uri)) { + if (!Jz(n.uri)) { const { message: a } = ft("MISSING_OR_INVALID", `pair() uri: ${n.uri}`); - throw i.setError(yo.malformed_pairing_uri), new Error(a); + throw i.setError(_o.malformed_pairing_uri), new Error(a); } - const o = Xx(n == null ? void 0 : n.uri); + const o = Qx(n == null ? void 0 : n.uri); if (!((s = o == null ? void 0 : o.relay) != null && s.protocol)) { const { message: a } = ft("MISSING_OR_INVALID", "pair() uri#relay-protocol"); - throw i.setError(yo.malformed_pairing_uri), new Error(a); + throw i.setError(_o.malformed_pairing_uri), new Error(a); } if (!(o != null && o.symKey)) { const { message: a } = ft("MISSING_OR_INVALID", "pair() uri#symKey"); - throw i.setError(yo.malformed_pairing_uri), new Error(a); + throw i.setError(_o.malformed_pairing_uri), new Error(a); } if (o != null && o.expiryTimestamp && mt.toMiliseconds(o == null ? void 0 : o.expiryTimestamp) < Date.now()) { - i.setError(yo.pairing_expired); + i.setError(_o.pairing_expired); const { message: a } = ft("EXPIRED", "pair() URI has expired. Please try again with a new connection URI."); throw new Error(a); } }, this.isValidPing = async (n) => { - if (!pi(n)) { + if (!gi(n)) { const { message: s } = ft("MISSING_OR_INVALID", `ping() params: ${n}`); throw new Error(s); } const { topic: i } = n; await this.isValidPairingTopic(i); }, this.isValidDisconnect = async (n) => { - if (!pi(n)) { + if (!gi(n)) { const { message: s } = ft("MISSING_OR_INVALID", `disconnect() params: ${n}`); throw new Error(s); } @@ -19394,12 +19394,12 @@ class sV { const { message: i } = ft("NO_MATCHING_KEY", `pairing topic doesn't exist: ${n}`); throw new Error(i); } - if (aa(this.pairings.get(n).expiry)) { + if (fa(this.pairings.get(n).expiry)) { await this.deletePairing(n); const { message: i } = ft("EXPIRED", `pairing topic: ${n}`); throw new Error(i); } - }, this.core = e, this.logger = ai(r, this.name), this.pairings = new _c(this.core, this.logger, this.name, this.storagePrefix); + }, this.core = e, this.logger = ci(r, this.name), this.pairings = new Ec(this.core, this.logger, this.name, this.storagePrefix); } get context() { return Si(this.logger); @@ -19416,36 +19416,36 @@ class sV { if (!this.pairings.keys.includes(r) || i === zr.link_mode || this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n))) return; const s = await this.core.crypto.decode(r, n); try { - fb(s) ? (this.core.history.set(r, s), this.onRelayEventRequest({ topic: r, payload: s })) : np(s) && (await this.core.history.resolve(s), await this.onRelayEventResponse({ topic: r, payload: s }), this.core.history.delete(r, s.id)); + fb(s) ? (this.core.history.set(r, s), this.onRelayEventRequest({ topic: r, payload: s })) : ip(s) && (await this.core.history.resolve(s), await this.onRelayEventResponse({ topic: r, payload: s }), this.core.history.delete(r, s.id)); } catch (o) { this.logger.error(o); } }); } registerExpirerEvents() { - this.core.expirer.on(Ji.expired, async (e) => { - const { topic: r } = $8(e.target); - r && this.pairings.keys.includes(r) && (await this.deletePairing(r, !0), this.events.emit(Xa.expire, { topic: r })); + this.core.expirer.on(Xi.expired, async (e) => { + const { topic: r } = F8(e.target); + r && this.pairings.keys.includes(r) && (await this.deletePairing(r, !0), this.events.emit(Qa.expire, { topic: r })); }); } } -class oV extends Bk { +class mV extends Yk { constructor(e, r) { - super(e, r), this.core = e, this.logger = r, this.records = /* @__PURE__ */ new Map(), this.events = new rs.EventEmitter(), this.name = nW, this.version = iW, this.cached = [], this.initialized = !1, this.storagePrefix = Zs, this.init = async () => { + super(e, r), this.core = e, this.logger = r, this.records = /* @__PURE__ */ new Map(), this.events = new ns.EventEmitter(), this.name = dH, this.version = pH, this.cached = [], this.initialized = !1, this.storagePrefix = eo, this.init = async () => { this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((n) => this.records.set(n.id, n)), this.cached = [], this.registerEventListeners(), this.initialized = !0); }, this.set = (n, i, s) => { if (this.isInitialized(), this.logger.debug("Setting JSON-RPC request history record"), this.logger.trace({ type: "method", method: "set", topic: n, request: i, chainId: s }), this.records.has(i.id)) return; const o = { id: i.id, topic: n, request: { method: i.method, params: i.params || null }, chainId: s, expiry: En(mt.THIRTY_DAYS) }; - this.records.set(o.id, o), this.persist(), this.events.emit(gs.created, o); + this.records.set(o.id, o), this.persist(), this.events.emit(ms.created, o); }, this.resolve = async (n) => { if (this.isInitialized(), this.logger.debug("Updating JSON-RPC response history record"), this.logger.trace({ type: "method", method: "update", response: n }), !this.records.has(n.id)) return; const i = await this.getRecord(n.id); - typeof i.response > "u" && (i.response = Zi(n) ? { error: n.error } : { result: n.result }, this.records.set(i.id, i), this.persist(), this.events.emit(gs.updated, i)); + typeof i.response > "u" && (i.response = Qi(n) ? { error: n.error } : { result: n.result }, this.records.set(i.id, i), this.persist(), this.events.emit(ms.updated, i)); }, this.get = async (n, i) => (this.isInitialized(), this.logger.debug("Getting record"), this.logger.trace({ type: "method", method: "get", topic: n, id: i }), await this.getRecord(i)), this.delete = (n, i) => { this.isInitialized(), this.logger.debug("Deleting record"), this.logger.trace({ type: "method", method: "delete", id: i }), this.values.forEach((s) => { if (s.topic === n) { if (typeof i < "u" && s.id !== i) return; - this.records.delete(s.id), this.events.emit(gs.deleted, s); + this.records.delete(s.id), this.events.emit(ms.deleted, s); } }), this.persist(); }, this.exists = async (n, i) => (this.isInitialized(), this.records.has(i) ? (await this.getRecord(i)).topic === n : !1), this.on = (n, i) => { @@ -19456,7 +19456,7 @@ class oV extends Bk { this.events.off(n, i); }, this.removeListener = (n, i) => { this.events.removeListener(n, i); - }, this.logger = ai(r, this.name); + }, this.logger = ci(r, this.name); } get context() { return Si(this.logger); @@ -19477,7 +19477,7 @@ class oV extends Bk { const e = []; return this.values.forEach((r) => { if (typeof r.response < "u") return; - const n = { topic: r.topic, request: ha(r.request.method, r.request.params, r.id), chainId: r.chainId }; + const n = { topic: r.topic, request: ga(r.request.method, r.request.params, r.id), chainId: r.chainId }; return e.push(n); }), e; } @@ -19497,7 +19497,7 @@ class oV extends Bk { return r; } async persist() { - await this.setJsonRpcRecords(this.values), this.events.emit(gs.sync); + await this.setJsonRpcRecords(this.values), this.events.emit(ms.sync); } async restore() { try { @@ -19513,16 +19513,16 @@ class oV extends Bk { } } registerEventListeners() { - this.events.on(gs.created, (e) => { - const r = gs.created; + this.events.on(ms.created, (e) => { + const r = ms.created; this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, record: e }); - }), this.events.on(gs.updated, (e) => { - const r = gs.updated; + }), this.events.on(ms.updated, (e) => { + const r = ms.updated; this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, record: e }); - }), this.events.on(gs.deleted, (e) => { - const r = gs.deleted; + }), this.events.on(ms.deleted, (e) => { + const r = ms.deleted; this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, record: e }); - }), this.core.heartbeat.on(Du.pulse, () => { + }), this.core.heartbeat.on(Ou.pulse, () => { this.cleanup(); }); } @@ -19531,7 +19531,7 @@ class oV extends Bk { this.isInitialized(); let e = !1; this.records.forEach((r) => { - mt.toMiliseconds(r.expiry || 0) - Date.now() <= 0 && (this.logger.info(`Deleting expired history log: ${r.id}`), this.records.delete(r.id), this.events.emit(gs.deleted, r, !1), e = !0); + mt.toMiliseconds(r.expiry || 0) - Date.now() <= 0 && (this.logger.info(`Deleting expired history log: ${r.id}`), this.records.delete(r.id), this.events.emit(ms.deleted, r, !1), e = !0); }), e && this.persist(); } catch (e) { this.logger.warn(e); @@ -19544,9 +19544,9 @@ class oV extends Bk { } } } -class aV extends Wk { +class vV extends t$ { constructor(e, r) { - super(e, r), this.core = e, this.logger = r, this.expirations = /* @__PURE__ */ new Map(), this.events = new rs.EventEmitter(), this.name = sW, this.version = oW, this.cached = [], this.initialized = !1, this.storagePrefix = Zs, this.init = async () => { + super(e, r), this.core = e, this.logger = r, this.expirations = /* @__PURE__ */ new Map(), this.events = new ns.EventEmitter(), this.name = gH, this.version = mH, this.cached = [], this.initialized = !1, this.storagePrefix = eo, this.init = async () => { this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((n) => this.expirations.set(n.target, n)), this.cached = [], this.registerEventListeners(), this.initialized = !0); }, this.has = (n) => { try { @@ -19558,7 +19558,7 @@ class aV extends Wk { }, this.set = (n, i) => { this.isInitialized(); const s = this.formatTarget(n), o = { target: s, expiry: i }; - this.expirations.set(s, o), this.checkExpiry(s, o), this.events.emit(Ji.created, { target: s, expiration: o }); + this.expirations.set(s, o), this.checkExpiry(s, o), this.events.emit(Xi.created, { target: s, expiration: o }); }, this.get = (n) => { this.isInitialized(); const i = this.formatTarget(n); @@ -19566,7 +19566,7 @@ class aV extends Wk { }, this.del = (n) => { if (this.isInitialized(), this.has(n)) { const i = this.formatTarget(n), s = this.getExpiration(i); - this.expirations.delete(i), this.events.emit(Ji.deleted, { target: i, expiration: s }); + this.expirations.delete(i), this.events.emit(Xi.deleted, { target: i, expiration: s }); } }, this.on = (n, i) => { this.events.on(n, i); @@ -19576,7 +19576,7 @@ class aV extends Wk { this.events.off(n, i); }, this.removeListener = (n, i) => { this.events.removeListener(n, i); - }, this.logger = ai(r, this.name); + }, this.logger = ci(r, this.name); } get context() { return Si(this.logger); @@ -19594,8 +19594,8 @@ class aV extends Wk { return Array.from(this.expirations.values()); } formatTarget(e) { - if (typeof e == "string") return Nq(e); - if (typeof e == "number") return Lq(e); + if (typeof e == "string") return Wq(e); + if (typeof e == "number") return Hq(e); const { message: r } = ft("UNKNOWN_TYPE", `Target type: ${typeof e}`); throw new Error(r); } @@ -19606,7 +19606,7 @@ class aV extends Wk { return await this.core.storage.getItem(this.storageKey); } async persist() { - await this.setExpirations(this.values), this.events.emit(Ji.sync); + await this.setExpirations(this.values), this.events.emit(Xi.sync); } async restore() { try { @@ -19634,20 +19634,20 @@ class aV extends Wk { mt.toMiliseconds(n) - Date.now() <= 0 && this.expire(e, r); } expire(e, r) { - this.expirations.delete(e), this.events.emit(Ji.expired, { target: e, expiration: r }); + this.expirations.delete(e), this.events.emit(Xi.expired, { target: e, expiration: r }); } checkExpirations() { this.core.relayer.connected && this.expirations.forEach((e, r) => this.checkExpiry(r, e)); } registerEventListeners() { - this.core.heartbeat.on(Du.pulse, () => this.checkExpirations()), this.events.on(Ji.created, (e) => { - const r = Ji.created; + this.core.heartbeat.on(Ou.pulse, () => this.checkExpirations()), this.events.on(Xi.created, (e) => { + const r = Xi.created; this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), this.persist(); - }), this.events.on(Ji.expired, (e) => { - const r = Ji.expired; + }), this.events.on(Xi.expired, (e) => { + const r = Xi.expired; this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), this.persist(); - }), this.events.on(Ji.deleted, (e) => { - const r = Ji.deleted; + }), this.events.on(Xi.deleted, (e) => { + const r = Xi.deleted; this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), this.persist(); }); } @@ -19658,36 +19658,36 @@ class aV extends Wk { } } } -class cV extends Kk { +class bV extends r$ { constructor(e, r, n) { - super(e, r, n), this.core = e, this.logger = r, this.store = n, this.name = aW, this.verifyUrlV3 = uW, this.storagePrefix = Zs, this.version = tE, this.init = async () => { + super(e, r, n), this.core = e, this.logger = r, this.store = n, this.name = vH, this.verifyUrlV3 = yH, this.storagePrefix = eo, this.version = nE, this.init = async () => { var i; this.isDevEnv || (this.publicKey = await this.store.getItem(this.storeKey), this.publicKey && mt.toMiliseconds((i = this.publicKey) == null ? void 0 : i.expiresAt) < Date.now() && (this.logger.debug("verify v2 public key expired"), await this.removePublicKey())); }, this.register = async (i) => { - if (!Xl() || this.isDevEnv) return; + if (!Zl() || this.isDevEnv) return; const s = window.location.origin, { id: o, decryptedId: a } = i, u = `${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`; try { - const l = Wl(), d = this.startAbortTimer(mt.ONE_SECOND * 5), g = await new Promise((w, A) => { - const M = () => { + const l = Kl(), d = this.startAbortTimer(mt.ONE_SECOND * 5), p = await new Promise((w, A) => { + const P = () => { window.removeEventListener("message", L), l.body.removeChild(N), A("attestation aborted"); }; - this.abortController.signal.addEventListener("abort", M); + this.abortController.signal.addEventListener("abort", P); const N = l.createElement("iframe"); - N.src = u, N.style.display = "none", N.addEventListener("error", M, { signal: this.abortController.signal }); + N.src = u, N.style.display = "none", N.addEventListener("error", P, { signal: this.abortController.signal }); const L = ($) => { if ($.data && typeof $.data == "string") try { - const F = JSON.parse($.data); - if (F.type === "verify_attestation") { - if (v1(F.attestation).payload.id !== o) return; - clearInterval(d), l.body.removeChild(N), this.abortController.signal.removeEventListener("abort", M), window.removeEventListener("message", L), w(F.attestation === null ? "" : F.attestation); + const B = JSON.parse($.data); + if (B.type === "verify_attestation") { + if (v1(B.attestation).payload.id !== o) return; + clearInterval(d), l.body.removeChild(N), this.abortController.signal.removeEventListener("abort", P), window.removeEventListener("message", L), w(B.attestation === null ? "" : B.attestation); } - } catch (F) { - this.logger.warn(F); + } catch (B) { + this.logger.warn(B); } }; l.body.appendChild(N), window.addEventListener("message", L, { signal: this.abortController.signal }); }); - return this.logger.debug("jwt attestation", g), g; + return this.logger.debug("jwt attestation", p), p; } catch (l) { this.logger.warn(l); } @@ -19718,8 +19718,8 @@ class cV extends Kk { const o = this.startAbortTimer(mt.ONE_SECOND * 5), a = await fetch(`${s}/attestation/${i}?v2Supported=true`, { signal: this.abortController.signal }); return clearTimeout(o), a.status === 200 ? await a.json() : void 0; }, this.getVerifyUrl = (i) => { - let s = i || zf; - return fW.includes(s) || (this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${zf}`), s = zf), s; + let s = i || Wf; + return wH.includes(s) || (this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Wf}`), s = Wf), s; }, this.fetchPublicKey = async () => { try { this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`); @@ -19754,10 +19754,10 @@ class cV extends Kk { const i = await this.fetchPromise; return this.fetchPromise = void 0, i; }, this.validateAttestation = (i, s) => { - const o = xz(i, s.publicKey), a = { hasExpired: mt.toMiliseconds(o.exp) < Date.now(), payload: o }; + const o = Rz(i, s.publicKey), a = { hasExpired: mt.toMiliseconds(o.exp) < Date.now(), payload: o }; if (a.hasExpired) throw this.logger.warn("resolve: jwt attestation expired"), new Error("JWT attestation expired"); return { origin: a.payload.origin, isScam: a.payload.isScam, isVerified: a.payload.isVerified }; - }, this.logger = ai(r, this.name), this.abortController = new AbortController(), this.isDevEnv = ib(), this.init(); + }, this.logger = ci(r, this.name), this.abortController = new AbortController(), this.isDevEnv = ib(), this.init(); } get storeKey() { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//verify:public:key"; @@ -19769,43 +19769,43 @@ class cV extends Kk { return this.abortController = new AbortController(), setTimeout(() => this.abortController.abort(), mt.toMiliseconds(e)); } } -class uV extends Vk { +class yV extends n$ { constructor(e, r) { - super(e, r), this.projectId = e, this.logger = r, this.context = lW, this.registerDeviceToken = async (n) => { - const { clientId: i, token: s, notificationType: o, enableEncrypted: a = !1 } = n, u = `${hW}/${this.projectId}/clients`; + super(e, r), this.projectId = e, this.logger = r, this.context = xH, this.registerDeviceToken = async (n) => { + const { clientId: i, token: s, notificationType: o, enableEncrypted: a = !1 } = n, u = `${_H}/${this.projectId}/clients`; await fetch(u, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ client_id: i, type: o, token: s, always_raw: a }) }); - }, this.logger = ai(r, this.context); + }, this.logger = ci(r, this.context); } } -var fV = Object.defineProperty, I3 = Object.getOwnPropertySymbols, lV = Object.prototype.hasOwnProperty, hV = Object.prototype.propertyIsEnumerable, C3 = (t, e, r) => e in t ? fV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Cf = (t, e) => { - for (var r in e || (e = {})) lV.call(e, r) && C3(t, r, e[r]); - if (I3) for (var r of I3(e)) hV.call(e, r) && C3(t, r, e[r]); +var wV = Object.defineProperty, T3 = Object.getOwnPropertySymbols, xV = Object.prototype.hasOwnProperty, _V = Object.prototype.propertyIsEnumerable, R3 = (t, e, r) => e in t ? wV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Tf = (t, e) => { + for (var r in e || (e = {})) xV.call(e, r) && R3(t, r, e[r]); + if (T3) for (var r of T3(e)) _V.call(e, r) && R3(t, r, e[r]); return t; }; -class dV extends Gk { +class EV extends i$ { constructor(e, r, n = !0) { - super(e, r, n), this.core = e, this.logger = r, this.context = pW, this.storagePrefix = Zs, this.storageVersion = dW, this.events = /* @__PURE__ */ new Map(), this.shouldPersist = !1, this.init = async () => { + super(e, r, n), this.core = e, this.logger = r, this.context = SH, this.storagePrefix = eo, this.storageVersion = EH, this.events = /* @__PURE__ */ new Map(), this.shouldPersist = !1, this.init = async () => { if (!ib()) try { - const i = { eventId: Bx(), timestamp: Date.now(), domain: this.getAppDomain(), props: { event: "INIT", type: "", properties: { client_id: await this.core.crypto.getClientId(), user_agent: O8(this.core.relayer.protocol, this.core.relayer.version, T1) } } }; + const i = { eventId: Ux(), timestamp: Date.now(), domain: this.getAppDomain(), props: { event: "INIT", type: "", properties: { client_id: await this.core.crypto.getClientId(), user_agent: L8(this.core.relayer.protocol, this.core.relayer.version, T1) } } }; await this.sendEvent([i]); } catch (i) { this.logger.warn(i); } }, this.createEvent = (i) => { - const { event: s = "ERROR", type: o = "", properties: { topic: a, trace: u } } = i, l = Bx(), d = this.core.projectId || "", g = Date.now(), w = Cf({ eventId: l, timestamp: g, props: { event: s, type: o, properties: { topic: a, trace: u } }, bundleId: d, domain: this.getAppDomain() }, this.setMethods(l)); + const { event: s = "ERROR", type: o = "", properties: { topic: a, trace: u } } = i, l = Ux(), d = this.core.projectId || "", p = Date.now(), w = Tf({ eventId: l, timestamp: p, props: { event: s, type: o, properties: { topic: a, trace: u } }, bundleId: d, domain: this.getAppDomain() }, this.setMethods(l)); return this.telemetryEnabled && (this.events.set(l, w), this.shouldPersist = !0), w; }, this.getEvent = (i) => { const { eventId: s, topic: o } = i; if (s) return this.events.get(s); const a = Array.from(this.events.values()).find((u) => u.props.properties.topic === o); - if (a) return Cf(Cf({}, a), this.setMethods(a.eventId)); + if (a) return Tf(Tf({}, a), this.setMethods(a.eventId)); }, this.deleteEvent = (i) => { const { eventId: s } = i; this.events.delete(s), this.shouldPersist = !0; }, this.setEventListeners = () => { - this.core.heartbeat.on(Du.pulse, async () => { + this.core.heartbeat.on(Ou.pulse, async () => { this.shouldPersist && await this.persist(), this.events.forEach((i) => { - mt.fromMiliseconds(Date.now()) - mt.fromMiliseconds(i.timestamp) > gW && (this.events.delete(i.eventId), this.shouldPersist = !0); + mt.fromMiliseconds(Date.now()) - mt.fromMiliseconds(i.timestamp) > AH && (this.events.delete(i.eventId), this.shouldPersist = !0); }); }); }, this.setMethods = (i) => ({ addTrace: (s) => this.addTrace(i, s), setError: (s) => this.setError(i, s) }), this.addTrace = (i, s) => { @@ -19821,7 +19821,7 @@ class dV extends Gk { const i = await this.core.storage.getItem(this.storageKey) || []; if (!i.length) return; i.forEach((s) => { - this.events.set(s.eventId, Cf(Cf({}, s), this.setMethods(s.eventId))); + this.events.set(s.eventId, Tf(Tf({}, s), this.setMethods(s.eventId))); }); } catch (i) { this.logger.warn(i); @@ -19837,8 +19837,8 @@ class dV extends Gk { } }, this.sendEvent = async (i) => { const s = this.getAppDomain() ? "" : "&sp=desktop"; - return await fetch(`${mW}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${T1}${s}`, { method: "POST", body: JSON.stringify(i) }); - }, this.getAppDomain = () => D8().url, this.logger = ai(r, this.context), this.telemetryEnabled = n, n ? this.restore().then(async () => { + return await fetch(`${PH}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${T1}${s}`, { method: "POST", body: JSON.stringify(i) }); + }, this.getAppDomain = () => N8().url, this.logger = ci(r, this.context), this.telemetryEnabled = n, n ? this.restore().then(async () => { await this.submit(), this.setEventListeners(); }) : this.persist(); } @@ -19846,30 +19846,30 @@ class dV extends Gk { return this.storagePrefix + this.storageVersion + this.core.customStoragePrefix + "//" + this.context; } } -var pV = Object.defineProperty, T3 = Object.getOwnPropertySymbols, gV = Object.prototype.hasOwnProperty, mV = Object.prototype.propertyIsEnumerable, R3 = (t, e, r) => e in t ? pV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, D3 = (t, e) => { - for (var r in e || (e = {})) gV.call(e, r) && R3(t, r, e[r]); - if (T3) for (var r of T3(e)) mV.call(e, r) && R3(t, r, e[r]); +var SV = Object.defineProperty, D3 = Object.getOwnPropertySymbols, AV = Object.prototype.hasOwnProperty, PV = Object.prototype.propertyIsEnumerable, O3 = (t, e, r) => e in t ? SV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, N3 = (t, e) => { + for (var r in e || (e = {})) AV.call(e, r) && O3(t, r, e[r]); + if (D3) for (var r of D3(e)) PV.call(e, r) && O3(t, r, e[r]); return t; }; -class lb extends Fk { +class lb extends Gk { constructor(e) { var r; - super(e), this.protocol = eE, this.version = tE, this.name = rE, this.events = new rs.EventEmitter(), this.initialized = !1, this.on = (o, a) => this.events.on(o, a), this.once = (o, a) => this.events.once(o, a), this.off = (o, a) => this.events.off(o, a), this.removeListener = (o, a) => this.events.removeListener(o, a), this.dispatchEnvelope = ({ topic: o, message: a, sessionExists: u }) => { + super(e), this.protocol = rE, this.version = nE, this.name = iE, this.events = new ns.EventEmitter(), this.initialized = !1, this.on = (o, a) => this.events.on(o, a), this.once = (o, a) => this.events.once(o, a), this.off = (o, a) => this.events.off(o, a), this.removeListener = (o, a) => this.events.removeListener(o, a), this.dispatchEnvelope = ({ topic: o, message: a, sessionExists: u }) => { if (!o || !a) return; const l = { topic: o, message: a, publishedAt: Date.now(), transportType: zr.link_mode }; this.relayer.onLinkMessageEvent(l, { sessionExists: u }); - }, this.projectId = e == null ? void 0 : e.projectId, this.relayUrl = (e == null ? void 0 : e.relayUrl) || iE, this.customStoragePrefix = e != null && e.customStoragePrefix ? `:${e.customStoragePrefix}` : ""; - const n = k0({ level: typeof (e == null ? void 0 : e.logger) == "string" && e.logger ? e.logger : kH.logger }), { logger: i, chunkLoggerController: s } = $k({ opts: n, maxSizeInBytes: e == null ? void 0 : e.maxLogBlobSizeInBytes, loggerOverride: e == null ? void 0 : e.logger }); + }, this.projectId = e == null ? void 0 : e.projectId, this.relayUrl = (e == null ? void 0 : e.relayUrl) || oE, this.customStoragePrefix = e != null && e.customStoragePrefix ? `:${e.customStoragePrefix}` : ""; + const n = $0({ level: typeof (e == null ? void 0 : e.logger) == "string" && e.logger ? e.logger : KW.logger }), { logger: i, chunkLoggerController: s } = Vk({ opts: n, maxSizeInBytes: e == null ? void 0 : e.maxLogBlobSizeInBytes, loggerOverride: e == null ? void 0 : e.logger }); this.logChunkController = s, (r = this.logChunkController) != null && r.downloadLogsBlobInBrowser && (window.downloadLogsBlobInBrowser = async () => { var o, a; (o = this.logChunkController) != null && o.downloadLogsBlobInBrowser && ((a = this.logChunkController) == null || a.downloadLogsBlobInBrowser({ clientId: await this.crypto.getClientId() })); - }), this.logger = ai(i, this.name), this.heartbeat = new RL(), this.crypto = new qK(this, this.logger, e == null ? void 0 : e.keychain), this.history = new oV(this, this.logger), this.expirer = new aV(this, this.logger), this.storage = e != null && e.storage ? e.storage : new uk(D3(D3({}, $H), e == null ? void 0 : e.storageOptions)), this.relayer = new tV({ core: this, logger: this.logger, relayUrl: this.relayUrl, projectId: this.projectId }), this.pairing = new sV(this, this.logger), this.verify = new cV(this, this.logger, this.storage), this.echoClient = new uV(this.projectId || "", this.logger), this.linkModeSupportedApps = [], this.eventClient = new dV(this, this.logger, e == null ? void 0 : e.telemetryEnabled); + }), this.logger = ci(i, this.name), this.heartbeat = new UL(), this.crypto = new ZK(this, this.logger, e == null ? void 0 : e.keychain), this.history = new mV(this, this.logger), this.expirer = new vV(this, this.logger), this.storage = e != null && e.storage ? e.storage : new yk(N3(N3({}, VW), e == null ? void 0 : e.storageOptions)), this.relayer = new lV({ core: this, logger: this.logger, relayUrl: this.relayUrl, projectId: this.projectId }), this.pairing = new gV(this, this.logger), this.verify = new bV(this, this.logger, this.storage), this.echoClient = new yV(this.projectId || "", this.logger), this.linkModeSupportedApps = [], this.eventClient = new EV(this, this.logger, e == null ? void 0 : e.telemetryEnabled); } static async init(e) { const r = new lb(e); await r.initialize(); const n = await r.crypto.getClientId(); - return await r.storage.setItem(XH, n), r; + return await r.storage.setItem(aH, n), r; } get context() { return Si(this.logger); @@ -19882,59 +19882,59 @@ class lb extends Fk { return (e = this.logChunkController) == null ? void 0 : e.logsToBlob({ clientId: await this.crypto.getClientId() }); } async addLinkModeSupportedApp(e) { - this.linkModeSupportedApps.includes(e) || (this.linkModeSupportedApps.push(e), await this.storage.setItem(d3, this.linkModeSupportedApps)); + this.linkModeSupportedApps.includes(e) || (this.linkModeSupportedApps.push(e), await this.storage.setItem(g3, this.linkModeSupportedApps)); } async initialize() { this.logger.trace("Initialized"); try { - await this.crypto.init(), await this.history.init(), await this.expirer.init(), await this.relayer.init(), await this.heartbeat.init(), await this.pairing.init(), this.eventClient.init(), this.linkModeSupportedApps = await this.storage.getItem(d3) || [], this.initialized = !0, this.logger.info("Core Initialization Success"); + await this.crypto.init(), await this.history.init(), await this.expirer.init(), await this.relayer.init(), await this.heartbeat.init(), await this.pairing.init(), this.eventClient.init(), this.linkModeSupportedApps = await this.storage.getItem(g3) || [], this.initialized = !0, this.logger.info("Core Initialization Success"); } catch (e) { throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`, e), this.logger.error(e.message), e; } } } -const vV = lb, mE = "wc", vE = 2, bE = "client", hb = `${mE}@${vE}:${bE}:`, mm = { name: bE, logger: "error" }, O3 = "WALLETCONNECT_DEEPLINK_CHOICE", bV = "proposal", yE = "Proposal expired", yV = "session", Wc = mt.SEVEN_DAYS, wV = "engine", In = { wc_sessionPropose: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1100 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1101 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1120 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1121 } }, wc_sessionSettle: { req: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1102 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1103 } }, wc_sessionUpdate: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1104 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1105 } }, wc_sessionExtend: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1106 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1107 } }, wc_sessionRequest: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1108 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1109 } }, wc_sessionEvent: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1110 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1111 } }, wc_sessionDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1112 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1113 } }, wc_sessionPing: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1114 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1115 } }, wc_sessionAuthenticate: { req: { ttl: mt.ONE_HOUR, prompt: !0, tag: 1116 }, res: { ttl: mt.ONE_HOUR, prompt: !1, tag: 1117 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1118 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1119 } } }, vm = { min: mt.FIVE_MINUTES, max: mt.SEVEN_DAYS }, Ls = { idle: "IDLE", active: "ACTIVE" }, xV = "request", _V = ["wc_sessionPropose", "wc_sessionRequest", "wc_authRequest", "wc_sessionAuthenticate"], EV = "wc", SV = "auth", AV = "authKeys", PV = "pairingTopics", MV = "requests", sp = `${EV}@${1.5}:${SV}:`, Td = `${sp}:PUB_KEY`; -var IV = Object.defineProperty, CV = Object.defineProperties, TV = Object.getOwnPropertyDescriptors, N3 = Object.getOwnPropertySymbols, RV = Object.prototype.hasOwnProperty, DV = Object.prototype.propertyIsEnumerable, L3 = (t, e, r) => e in t ? IV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, tn = (t, e) => { - for (var r in e || (e = {})) RV.call(e, r) && L3(t, r, e[r]); - if (N3) for (var r of N3(e)) DV.call(e, r) && L3(t, r, e[r]); +const MV = lb, bE = "wc", yE = 2, wE = "client", hb = `${bE}@${yE}:${wE}:`, mm = { name: wE, logger: "error" }, L3 = "WALLETCONNECT_DEEPLINK_CHOICE", IV = "proposal", xE = "Proposal expired", CV = "session", Kc = mt.SEVEN_DAYS, TV = "engine", In = { wc_sessionPropose: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1100 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1101 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1120 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1121 } }, wc_sessionSettle: { req: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1102 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1103 } }, wc_sessionUpdate: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1104 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1105 } }, wc_sessionExtend: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1106 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1107 } }, wc_sessionRequest: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1108 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1109 } }, wc_sessionEvent: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1110 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1111 } }, wc_sessionDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1112 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1113 } }, wc_sessionPing: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1114 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1115 } }, wc_sessionAuthenticate: { req: { ttl: mt.ONE_HOUR, prompt: !0, tag: 1116 }, res: { ttl: mt.ONE_HOUR, prompt: !1, tag: 1117 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1118 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1119 } } }, vm = { min: mt.FIVE_MINUTES, max: mt.SEVEN_DAYS }, ks = { idle: "IDLE", active: "ACTIVE" }, RV = "request", DV = ["wc_sessionPropose", "wc_sessionRequest", "wc_authRequest", "wc_sessionAuthenticate"], OV = "wc", NV = "auth", LV = "authKeys", kV = "pairingTopics", $V = "requests", op = `${OV}@${1.5}:${NV}:`, Rd = `${op}:PUB_KEY`; +var BV = Object.defineProperty, FV = Object.defineProperties, jV = Object.getOwnPropertyDescriptors, k3 = Object.getOwnPropertySymbols, UV = Object.prototype.hasOwnProperty, qV = Object.prototype.propertyIsEnumerable, $3 = (t, e, r) => e in t ? BV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, tn = (t, e) => { + for (var r in e || (e = {})) UV.call(e, r) && $3(t, r, e[r]); + if (k3) for (var r of k3(e)) qV.call(e, r) && $3(t, r, e[r]); return t; -}, vs = (t, e) => CV(t, TV(e)); -class OV extends Jk { +}, bs = (t, e) => FV(t, jV(e)); +class zV extends o$ { constructor(e) { - super(e), this.name = wV, this.events = new kv(), this.initialized = !1, this.requestQueue = { state: Ls.idle, queue: [] }, this.sessionRequestQueue = { state: Ls.idle, queue: [] }, this.requestQueueDelay = mt.ONE_SECOND, this.expectedPairingMethodMap = /* @__PURE__ */ new Map(), this.recentlyDeletedMap = /* @__PURE__ */ new Map(), this.recentlyDeletedLimit = 200, this.relayMessageCache = [], this.init = async () => { + super(e), this.name = TV, this.events = new kv(), this.initialized = !1, this.requestQueue = { state: ks.idle, queue: [] }, this.sessionRequestQueue = { state: ks.idle, queue: [] }, this.requestQueueDelay = mt.ONE_SECOND, this.expectedPairingMethodMap = /* @__PURE__ */ new Map(), this.recentlyDeletedMap = /* @__PURE__ */ new Map(), this.recentlyDeletedLimit = 200, this.relayMessageCache = [], this.init = async () => { this.initialized || (await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.registerPairingEvents(), await this.registerLinkModeListeners(), this.client.core.pairing.register({ methods: Object.keys(In) }), this.initialized = !0, setTimeout(() => { this.sessionRequestQueue.queue = this.getPendingSessionRequests(), this.processSessionRequestQueue(); }, mt.toMiliseconds(this.requestQueueDelay))); }, this.connect = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); - const n = vs(tn({}, r), { requiredNamespaces: r.requiredNamespaces || {}, optionalNamespaces: r.optionalNamespaces || {} }); + const n = bs(tn({}, r), { requiredNamespaces: r.requiredNamespaces || {}, optionalNamespaces: r.optionalNamespaces || {} }); await this.isValidConnect(n); const { pairingTopic: i, requiredNamespaces: s, optionalNamespaces: o, sessionProperties: a, relays: u } = n; - let l = i, d, g = !1; + let l = i, d, p = !1; try { - l && (g = this.client.core.pairing.pairings.get(l).active); - } catch (H) { - throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`), H; + l && (p = this.client.core.pairing.pairings.get(l).active); + } catch (W) { + throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`), W; } - if (!l || !g) { - const { topic: H, uri: V } = await this.client.core.pairing.create(); - l = H, d = V; + if (!l || !p) { + const { topic: W, uri: V } = await this.client.core.pairing.create(); + l = W, d = V; } if (!l) { - const { message: H } = ft("NO_MATCHING_KEY", `connect() pairing topic: ${l}`); - throw new Error(H); + const { message: W } = ft("NO_MATCHING_KEY", `connect() pairing topic: ${l}`); + throw new Error(W); } - const w = await this.client.core.crypto.generateKeyPair(), A = In.wc_sessionPropose.req.ttl || mt.FIVE_MINUTES, M = En(A), N = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: u ?? [{ protocol: nE }], proposer: { publicKey: w, metadata: this.client.metadata }, expiryTimestamp: M, pairingTopic: l }, a && { sessionProperties: a }), { reject: L, resolve: $, done: F } = Va(A, yE); - this.events.once(br("session_connect"), async ({ error: H, session: V }) => { - if (H) L(H); + const w = await this.client.core.crypto.generateKeyPair(), A = In.wc_sessionPropose.req.ttl || mt.FIVE_MINUTES, P = En(A), N = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: u ?? [{ protocol: sE }], proposer: { publicKey: w, metadata: this.client.metadata }, expiryTimestamp: P, pairingTopic: l }, a && { sessionProperties: a }), { reject: L, resolve: $, done: B } = Ja(A, xE); + this.events.once(br("session_connect"), async ({ error: W, session: V }) => { + if (W) L(W); else if (V) { V.self.publicKey = w; - const te = vs(tn({}, V), { pairingTopic: N.pairingTopic, requiredNamespaces: N.requiredNamespaces, optionalNamespaces: N.optionalNamespaces, transportType: zr.relay }); + const te = bs(tn({}, V), { pairingTopic: N.pairingTopic, requiredNamespaces: N.requiredNamespaces, optionalNamespaces: N.optionalNamespaces, transportType: zr.relay }); await this.client.session.set(V.topic, te), await this.setExpiry(V.topic, V.expiry), l && await this.client.core.pairing.updateMetadata({ topic: l, metadata: V.peer.metadata }), this.cleanupDuplicatePairings(te), $(te); } }); - const K = await this.sendRequest({ topic: l, method: "wc_sessionPropose", params: N, throwOnFailedPublish: !0 }); - return await this.setProposal(K, tn({ id: K }, N)), { uri: d, approval: F }; + const H = await this.sendRequest({ topic: l, method: "wc_sessionPropose", params: N, throwOnFailedPublish: !0 }); + return await this.setProposal(H, tn({ id: H }, N)), { uri: d, approval: B }; }, this.pair = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); try { @@ -19944,47 +19944,47 @@ class OV extends Jk { } }, this.approve = async (r) => { var n, i, s; - const o = this.client.core.eventClient.createEvent({ properties: { topic: (n = r == null ? void 0 : r.id) == null ? void 0 : n.toString(), trace: [ms.session_approve_started] } }); + const o = this.client.core.eventClient.createEvent({ properties: { topic: (n = r == null ? void 0 : r.id) == null ? void 0 : n.toString(), trace: [vs.session_approve_started] } }); try { this.isInitialized(), await this.confirmOnlineStateOrThrow(); - } catch (W) { - throw o.setError(Ha.no_internet_connection), W; + } catch (K) { + throw o.setError(Va.no_internet_connection), K; } try { await this.isValidProposalId(r == null ? void 0 : r.id); - } catch (W) { - throw this.client.logger.error(`approve() -> proposal.get(${r == null ? void 0 : r.id}) failed`), o.setError(Ha.proposal_not_found), W; + } catch (K) { + throw this.client.logger.error(`approve() -> proposal.get(${r == null ? void 0 : r.id}) failed`), o.setError(Va.proposal_not_found), K; } try { await this.isValidApprove(r); - } catch (W) { - throw this.client.logger.error("approve() -> isValidApprove() failed"), o.setError(Ha.session_approve_namespace_validation_failure), W; + } catch (K) { + throw this.client.logger.error("approve() -> isValidApprove() failed"), o.setError(Va.session_approve_namespace_validation_failure), K; } - const { id: a, relayProtocol: u, namespaces: l, sessionProperties: d, sessionConfig: g } = r, w = this.client.proposal.get(a); + const { id: a, relayProtocol: u, namespaces: l, sessionProperties: d, sessionConfig: p } = r, w = this.client.proposal.get(a); this.client.core.eventClient.deleteEvent({ eventId: o.eventId }); - const { pairingTopic: A, proposer: M, requiredNamespaces: N, optionalNamespaces: L } = w; + const { pairingTopic: A, proposer: P, requiredNamespaces: N, optionalNamespaces: L } = w; let $ = (i = this.client.core.eventClient) == null ? void 0 : i.getEvent({ topic: A }); - $ || ($ = (s = this.client.core.eventClient) == null ? void 0 : s.createEvent({ type: ms.session_approve_started, properties: { topic: A, trace: [ms.session_approve_started, ms.session_namespaces_validation_success] } })); - const F = await this.client.core.crypto.generateKeyPair(), K = M.publicKey, H = await this.client.core.crypto.generateSharedKey(F, K), V = tn(tn({ relay: { protocol: u ?? "irn" }, namespaces: l, controller: { publicKey: F, metadata: this.client.metadata }, expiry: En(Wc) }, d && { sessionProperties: d }), g && { sessionConfig: g }), te = zr.relay; - $.addTrace(ms.subscribing_session_topic); + $ || ($ = (s = this.client.core.eventClient) == null ? void 0 : s.createEvent({ type: vs.session_approve_started, properties: { topic: A, trace: [vs.session_approve_started, vs.session_namespaces_validation_success] } })); + const B = await this.client.core.crypto.generateKeyPair(), H = P.publicKey, W = await this.client.core.crypto.generateSharedKey(B, H), V = tn(tn({ relay: { protocol: u ?? "irn" }, namespaces: l, controller: { publicKey: B, metadata: this.client.metadata }, expiry: En(Kc) }, d && { sessionProperties: d }), p && { sessionConfig: p }), te = zr.relay; + $.addTrace(vs.subscribing_session_topic); try { - await this.client.core.relayer.subscribe(H, { transportType: te }); - } catch (W) { - throw $.setError(Ha.subscribe_session_topic_failure), W; + await this.client.core.relayer.subscribe(W, { transportType: te }); + } catch (K) { + throw $.setError(Va.subscribe_session_topic_failure), K; } - $.addTrace(ms.subscribe_session_topic_success); - const R = vs(tn({}, V), { topic: H, requiredNamespaces: N, optionalNamespaces: L, pairingTopic: A, acknowledged: !1, self: V.controller, peer: { publicKey: M.publicKey, metadata: M.metadata }, controller: F, transportType: zr.relay }); - await this.client.session.set(H, R), $.addTrace(ms.store_session); + $.addTrace(vs.subscribe_session_topic_success); + const R = bs(tn({}, V), { topic: W, requiredNamespaces: N, optionalNamespaces: L, pairingTopic: A, acknowledged: !1, self: V.controller, peer: { publicKey: P.publicKey, metadata: P.metadata }, controller: B, transportType: zr.relay }); + await this.client.session.set(W, R), $.addTrace(vs.store_session); try { - $.addTrace(ms.publishing_session_settle), await this.sendRequest({ topic: H, method: "wc_sessionSettle", params: V, throwOnFailedPublish: !0 }).catch((W) => { - throw $ == null || $.setError(Ha.session_settle_publish_failure), W; - }), $.addTrace(ms.session_settle_publish_success), $.addTrace(ms.publishing_session_approve), await this.sendResult({ id: a, topic: A, result: { relay: { protocol: u ?? "irn" }, responderPublicKey: F }, throwOnFailedPublish: !0 }).catch((W) => { - throw $ == null || $.setError(Ha.session_approve_publish_failure), W; - }), $.addTrace(ms.session_approve_publish_success); - } catch (W) { - throw this.client.logger.error(W), this.client.session.delete(H, Or("USER_DISCONNECTED")), await this.client.core.relayer.unsubscribe(H), W; - } - return this.client.core.eventClient.deleteEvent({ eventId: $.eventId }), await this.client.core.pairing.updateMetadata({ topic: A, metadata: M.metadata }), await this.client.proposal.delete(a, Or("USER_DISCONNECTED")), await this.client.core.pairing.activate({ topic: A }), await this.setExpiry(H, En(Wc)), { topic: H, acknowledged: () => Promise.resolve(this.client.session.get(H)) }; + $.addTrace(vs.publishing_session_settle), await this.sendRequest({ topic: W, method: "wc_sessionSettle", params: V, throwOnFailedPublish: !0 }).catch((K) => { + throw $ == null || $.setError(Va.session_settle_publish_failure), K; + }), $.addTrace(vs.session_settle_publish_success), $.addTrace(vs.publishing_session_approve), await this.sendResult({ id: a, topic: A, result: { relay: { protocol: u ?? "irn" }, responderPublicKey: B }, throwOnFailedPublish: !0 }).catch((K) => { + throw $ == null || $.setError(Va.session_approve_publish_failure), K; + }), $.addTrace(vs.session_approve_publish_success); + } catch (K) { + throw this.client.logger.error(K), this.client.session.delete(W, Or("USER_DISCONNECTED")), await this.client.core.relayer.unsubscribe(W), K; + } + return this.client.core.eventClient.deleteEvent({ eventId: $.eventId }), await this.client.core.pairing.updateMetadata({ topic: A, metadata: P.metadata }), await this.client.proposal.delete(a, Or("USER_DISCONNECTED")), await this.client.core.pairing.activate({ topic: A }), await this.setExpiry(W, En(Kc)), { topic: W, acknowledged: () => Promise.resolve(this.client.session.get(W)) }; }, this.reject = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); try { @@ -20004,14 +20004,14 @@ class OV extends Jk { this.isInitialized(), await this.confirmOnlineStateOrThrow(); try { await this.isValidUpdate(r); - } catch (g) { - throw this.client.logger.error("update() -> isValidUpdate() failed"), g; - } - const { topic: n, namespaces: i } = r, { done: s, resolve: o, reject: a } = Va(), u = ca(), l = rc().toString(), d = this.client.session.get(n).namespaces; - return this.events.once(br("session_update", u), ({ error: g }) => { - g ? a(g) : o(); - }), await this.client.session.update(n, { namespaces: i }), await this.sendRequest({ topic: n, method: "wc_sessionUpdate", params: { namespaces: i }, throwOnFailedPublish: !0, clientRpcId: u, relayRpcId: l }).catch((g) => { - this.client.logger.error(g), this.client.session.update(n, { namespaces: d }), a(g); + } catch (p) { + throw this.client.logger.error("update() -> isValidUpdate() failed"), p; + } + const { topic: n, namespaces: i } = r, { done: s, resolve: o, reject: a } = Ja(), u = la(), l = ic().toString(), d = this.client.session.get(n).namespaces; + return this.events.once(br("session_update", u), ({ error: p }) => { + p ? a(p) : o(); + }), await this.client.session.update(n, { namespaces: i }), await this.sendRequest({ topic: n, method: "wc_sessionUpdate", params: { namespaces: i }, throwOnFailedPublish: !0, clientRpcId: u, relayRpcId: l }).catch((p) => { + this.client.logger.error(p), this.client.session.update(n, { namespaces: d }), a(p); }), { acknowledged: s }; }, this.extend = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); @@ -20020,42 +20020,42 @@ class OV extends Jk { } catch (u) { throw this.client.logger.error("extend() -> isValidExtend() failed"), u; } - const { topic: n } = r, i = ca(), { done: s, resolve: o, reject: a } = Va(); + const { topic: n } = r, i = la(), { done: s, resolve: o, reject: a } = Ja(); return this.events.once(br("session_extend", i), ({ error: u }) => { u ? a(u) : o(); - }), await this.setExpiry(n, En(Wc)), this.sendRequest({ topic: n, method: "wc_sessionExtend", params: {}, clientRpcId: i, throwOnFailedPublish: !0 }).catch((u) => { + }), await this.setExpiry(n, En(Kc)), this.sendRequest({ topic: n, method: "wc_sessionExtend", params: {}, clientRpcId: i, throwOnFailedPublish: !0 }).catch((u) => { a(u); }), { acknowledged: s }; }, this.request = async (r) => { this.isInitialized(); try { await this.isValidRequest(r); - } catch (M) { - throw this.client.logger.error("request() -> isValidRequest() failed"), M; + } catch (P) { + throw this.client.logger.error("request() -> isValidRequest() failed"), P; } const { chainId: n, request: i, topic: s, expiry: o = In.wc_sessionRequest.req.ttl } = r, a = this.client.session.get(s); (a == null ? void 0 : a.transportType) === zr.relay && await this.confirmOnlineStateOrThrow(); - const u = ca(), l = rc().toString(), { done: d, resolve: g, reject: w } = Va(o, "Request expired. Please try again."); - this.events.once(br("session_request", u), ({ error: M, result: N }) => { - M ? w(M) : g(N); + const u = la(), l = ic().toString(), { done: d, resolve: p, reject: w } = Ja(o, "Request expired. Please try again."); + this.events.once(br("session_request", u), ({ error: P, result: N }) => { + P ? w(P) : p(N); }); const A = this.getAppLinkIfEnabled(a.peer.metadata, a.transportType); - return A ? (await this.sendRequest({ clientRpcId: u, relayRpcId: l, topic: s, method: "wc_sessionRequest", params: { request: vs(tn({}, i), { expiryTimestamp: En(o) }), chainId: n }, expiry: o, throwOnFailedPublish: !0, appLink: A }).catch((M) => w(M)), this.client.events.emit("session_request_sent", { topic: s, request: i, chainId: n, id: u }), await d()) : await Promise.all([new Promise(async (M) => { - await this.sendRequest({ clientRpcId: u, relayRpcId: l, topic: s, method: "wc_sessionRequest", params: { request: vs(tn({}, i), { expiryTimestamp: En(o) }), chainId: n }, expiry: o, throwOnFailedPublish: !0 }).catch((N) => w(N)), this.client.events.emit("session_request_sent", { topic: s, request: i, chainId: n, id: u }), M(); - }), new Promise(async (M) => { + return A ? (await this.sendRequest({ clientRpcId: u, relayRpcId: l, topic: s, method: "wc_sessionRequest", params: { request: bs(tn({}, i), { expiryTimestamp: En(o) }), chainId: n }, expiry: o, throwOnFailedPublish: !0, appLink: A }).catch((P) => w(P)), this.client.events.emit("session_request_sent", { topic: s, request: i, chainId: n, id: u }), await d()) : await Promise.all([new Promise(async (P) => { + await this.sendRequest({ clientRpcId: u, relayRpcId: l, topic: s, method: "wc_sessionRequest", params: { request: bs(tn({}, i), { expiryTimestamp: En(o) }), chainId: n }, expiry: o, throwOnFailedPublish: !0 }).catch((N) => w(N)), this.client.events.emit("session_request_sent", { topic: s, request: i, chainId: n, id: u }), P(); + }), new Promise(async (P) => { var N; if (!((N = a.sessionConfig) != null && N.disableDeepLink)) { - const L = await Fq(this.client.core.storage, O3); - await kq({ id: u, topic: s, wcDeepLink: L }); + const L = await Gq(this.client.core.storage, L3); + await Kq({ id: u, topic: s, wcDeepLink: L }); } - M(); - }), d()]).then((M) => M[2]); + P(); + }), d()]).then((P) => P[2]); }, this.respond = async (r) => { this.isInitialized(), await this.isValidRespond(r); const { topic: n, response: i } = r, { id: s } = i, o = this.client.session.get(n); o.transportType === zr.relay && await this.confirmOnlineStateOrThrow(); const a = this.getAppLinkIfEnabled(o.peer.metadata, o.transportType); - Bs(i) ? await this.sendResult({ id: s, topic: n, result: i.result, throwOnFailedPublish: !0, appLink: a }) : Zi(i) && await this.sendError({ id: s, topic: n, error: i.error, appLink: a }), this.cleanupAfterResponse(r); + js(i) ? await this.sendResult({ id: s, topic: n, result: i.result, throwOnFailedPublish: !0, appLink: a }) : Qi(i) && await this.sendError({ id: s, topic: n, error: i.error, appLink: a }), this.cleanupAfterResponse(r); }, this.ping = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); try { @@ -20065,14 +20065,14 @@ class OV extends Jk { } const { topic: n } = r; if (this.client.session.keys.includes(n)) { - const i = ca(), s = rc().toString(), { done: o, resolve: a, reject: u } = Va(); + const i = la(), s = ic().toString(), { done: o, resolve: a, reject: u } = Ja(); this.events.once(br("session_ping", i), ({ error: l }) => { l ? u(l) : a(); }), await Promise.all([this.sendRequest({ topic: n, method: "wc_sessionPing", params: {}, throwOnFailedPublish: !0, clientRpcId: i, relayRpcId: s }), o()]); } else this.client.core.pairing.pairings.keys.includes(n) && await this.client.core.pairing.ping({ topic: n }); }, this.emit = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(), await this.isValidEmit(r); - const { topic: n, event: i, chainId: s } = r, o = rc().toString(); + const { topic: n, event: i, chainId: s } = r, o = ic().toString(); await this.sendRequest({ topic: n, method: "wc_sessionEvent", params: { event: i, chainId: s }, throwOnFailedPublish: !0, relayRpcId: o }); }, this.disconnect = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(), await this.isValidDisconnect(r); @@ -20083,103 +20083,103 @@ class OV extends Jk { const { message: i } = ft("MISMATCHED_TOPIC", `Session or pairing topic not found: ${n}`); throw new Error(i); } - }, this.find = (r) => (this.isInitialized(), this.client.session.getAll().filter((n) => Fz(n, r))), this.getPendingSessionRequests = () => this.client.pendingRequest.getAll(), this.authenticate = async (r, n) => { + }, this.find = (r) => (this.isInitialized(), this.client.session.getAll().filter((n) => Gz(n, r))), this.getPendingSessionRequests = () => this.client.pendingRequest.getAll(), this.authenticate = async (r, n) => { var i; this.isInitialized(), this.isValidAuthenticate(r); const s = n && this.client.core.linkModeSupportedApps.includes(n) && ((i = this.client.metadata.redirect) == null ? void 0 : i.linkMode), o = s ? zr.link_mode : zr.relay; o === zr.relay && await this.confirmOnlineStateOrThrow(); - const { chains: a, statement: u = "", uri: l, domain: d, nonce: g, type: w, exp: A, nbf: M, methods: N = [], expiry: L } = r, $ = [...r.resources || []], { topic: F, uri: K } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); - this.client.logger.info({ message: "Generated new pairing", pairing: { topic: F, uri: K } }); - const H = await this.client.core.crypto.generateKeyPair(), V = Cd(H); - if (await Promise.all([this.client.auth.authKeys.set(Td, { responseTopic: V, publicKey: H }), this.client.auth.pairingTopics.set(V, { topic: V, pairingTopic: F })]), await this.client.core.relayer.subscribe(V, { transportType: o }), this.client.logger.info(`sending request to new pairing topic: ${F}`), N.length > 0) { - const { namespace: _ } = lu(a[0]); - let E = sz(_, "request", N); - Id($) && (E = az(E, $.pop())), $.push(E); - } - const te = L && L > In.wc_sessionAuthenticate.req.ttl ? L : In.wc_sessionAuthenticate.req.ttl, R = { authPayload: { type: w ?? "caip122", chains: a, statement: u, aud: l, domain: d, version: "1", nonce: g, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: A, nbf: M, resources: $ }, requester: { publicKey: H, metadata: this.client.metadata }, expiryTimestamp: En(te) }, W = { eip155: { chains: a, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...N])], events: ["chainChanged", "accountsChanged"] } }, pe = { requiredNamespaces: {}, optionalNamespaces: W, relays: [{ protocol: "irn" }], pairingTopic: F, proposer: { publicKey: H, metadata: this.client.metadata }, expiryTimestamp: En(In.wc_sessionPropose.req.ttl) }, { done: Ee, resolve: Y, reject: S } = Va(te, "Request expired"), m = async ({ error: _, session: E }) => { - if (this.events.off(br("session_request", p), f), _) S(_); + const { chains: a, statement: u = "", uri: l, domain: d, nonce: p, type: w, exp: A, nbf: P, methods: N = [], expiry: L } = r, $ = [...r.resources || []], { topic: B, uri: H } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); + this.client.logger.info({ message: "Generated new pairing", pairing: { topic: B, uri: H } }); + const W = await this.client.core.crypto.generateKeyPair(), V = Td(W); + if (await Promise.all([this.client.auth.authKeys.set(Rd, { responseTopic: V, publicKey: W }), this.client.auth.pairingTopics.set(V, { topic: V, pairingTopic: B })]), await this.client.core.relayer.subscribe(V, { transportType: o }), this.client.logger.info(`sending request to new pairing topic: ${B}`), N.length > 0) { + const { namespace: _ } = hu(a[0]); + let E = gz(_, "request", N); + Cd($) && (E = vz(E, $.pop())), $.push(E); + } + const te = L && L > In.wc_sessionAuthenticate.req.ttl ? L : In.wc_sessionAuthenticate.req.ttl, R = { authPayload: { type: w ?? "caip122", chains: a, statement: u, aud: l, domain: d, version: "1", nonce: p, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: A, nbf: P, resources: $ }, requester: { publicKey: W, metadata: this.client.metadata }, expiryTimestamp: En(te) }, K = { eip155: { chains: a, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...N])], events: ["chainChanged", "accountsChanged"] } }, ge = { requiredNamespaces: {}, optionalNamespaces: K, relays: [{ protocol: "irn" }], pairingTopic: B, proposer: { publicKey: W, metadata: this.client.metadata }, expiryTimestamp: En(In.wc_sessionPropose.req.ttl) }, { done: Ee, resolve: Y, reject: S } = Ja(te, "Request expired"), m = async ({ error: _, session: E }) => { + if (this.events.off(br("session_request", g), f), _) S(_); else if (E) { - E.self.publicKey = H, await this.client.session.set(E.topic, E), await this.setExpiry(E.topic, E.expiry), F && await this.client.core.pairing.updateMetadata({ topic: F, metadata: E.peer.metadata }); + E.self.publicKey = W, await this.client.session.set(E.topic, E), await this.setExpiry(E.topic, E.expiry), B && await this.client.core.pairing.updateMetadata({ topic: B, metadata: E.peer.metadata }); const v = this.client.session.get(E.topic); await this.deleteProposal(b), Y({ session: v }); } }, f = async (_) => { - var E, v, P; - if (await this.deletePendingAuthRequest(p, { message: "fulfilled", code: 0 }), _.error) { + var E, v, M; + if (await this.deletePendingAuthRequest(g, { message: "fulfilled", code: 0 }), _.error) { const J = Or("WC_METHOD_UNSUPPORTED", "wc_sessionAuthenticate"); return _.error.code === J.code ? void 0 : (this.events.off(br("session_connect"), m), S(_.error.message)); } await this.deleteProposal(b), this.events.off(br("session_connect"), m); - const { cacaos: I, responder: B } = _.result, ce = [], D = []; + const { cacaos: I, responder: F } = _.result, ce = [], D = []; for (const J of I) { - await qx({ cacao: J, projectId: this.client.core.projectId }) || (this.client.logger.error(J, "Signature verification failed"), S(Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"))); - const { p: Q } = J, T = Id(Q.resources), X = [M1(Q.iss)], re = c0(Q.iss); + await Wx({ cacao: J, projectId: this.client.core.projectId }) || (this.client.logger.error(J, "Signature verification failed"), S(Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"))); + const { p: Q } = J, T = Cd(Q.resources), X = [M1(Q.iss)], re = u0(Q.iss); if (T) { - const de = zx(T), ie = Hx(T); - ce.push(...de), X.push(...ie); + const pe = Hx(T), ie = Kx(T); + ce.push(...pe), X.push(...ie); } - for (const de of X) D.push(`${de}:${re}`); + for (const pe of X) D.push(`${pe}:${re}`); } - const oe = await this.client.core.crypto.generateSharedKey(H, B.publicKey); + const oe = await this.client.core.crypto.generateSharedKey(W, F.publicKey); let Z; - ce.length > 0 && (Z = { topic: oe, acknowledged: !0, self: { publicKey: H, metadata: this.client.metadata }, peer: B, controller: B.publicKey, expiry: En(Wc), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: F, namespaces: Qx([...new Set(ce)], [...new Set(D)]), transportType: o }, await this.client.core.relayer.subscribe(oe, { transportType: o }), await this.client.session.set(oe, Z), F && await this.client.core.pairing.updateMetadata({ topic: F, metadata: B.metadata }), Z = this.client.session.get(oe)), (E = this.client.metadata.redirect) != null && E.linkMode && (v = B.metadata.redirect) != null && v.linkMode && (P = B.metadata.redirect) != null && P.universal && n && (this.client.core.addLinkModeSupportedApp(B.metadata.redirect.universal), this.client.session.update(oe, { transportType: zr.link_mode })), Y({ auths: I, session: Z }); - }, p = ca(), b = ca(); - this.events.once(br("session_connect"), m), this.events.once(br("session_request", p), f); + ce.length > 0 && (Z = { topic: oe, acknowledged: !0, self: { publicKey: W, metadata: this.client.metadata }, peer: F, controller: F.publicKey, expiry: En(Kc), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: B, namespaces: t3([...new Set(ce)], [...new Set(D)]), transportType: o }, await this.client.core.relayer.subscribe(oe, { transportType: o }), await this.client.session.set(oe, Z), B && await this.client.core.pairing.updateMetadata({ topic: B, metadata: F.metadata }), Z = this.client.session.get(oe)), (E = this.client.metadata.redirect) != null && E.linkMode && (v = F.metadata.redirect) != null && v.linkMode && (M = F.metadata.redirect) != null && M.universal && n && (this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal), this.client.session.update(oe, { transportType: zr.link_mode })), Y({ auths: I, session: Z }); + }, g = la(), b = la(); + this.events.once(br("session_connect"), m), this.events.once(br("session_request", g), f); let x; try { if (s) { - const _ = ha("wc_sessionAuthenticate", R, p); - this.client.core.history.set(F, _); - const E = await this.client.core.crypto.encode("", _, { type: eh, encoding: Sf }); - x = ud(n, F, E); - } else await Promise.all([this.sendRequest({ topic: F, method: "wc_sessionAuthenticate", params: R, expiry: r.expiry, throwOnFailedPublish: !0, clientRpcId: p }), this.sendRequest({ topic: F, method: "wc_sessionPropose", params: pe, expiry: In.wc_sessionPropose.req.ttl, throwOnFailedPublish: !0, clientRpcId: b })]); + const _ = ga("wc_sessionAuthenticate", R, g); + this.client.core.history.set(B, _); + const E = await this.client.core.crypto.encode("", _, { type: th, encoding: Af }); + x = fd(n, B, E); + } else await Promise.all([this.sendRequest({ topic: B, method: "wc_sessionAuthenticate", params: R, expiry: r.expiry, throwOnFailedPublish: !0, clientRpcId: g }), this.sendRequest({ topic: B, method: "wc_sessionPropose", params: ge, expiry: In.wc_sessionPropose.req.ttl, throwOnFailedPublish: !0, clientRpcId: b })]); } catch (_) { - throw this.events.off(br("session_connect"), m), this.events.off(br("session_request", p), f), _; + throw this.events.off(br("session_connect"), m), this.events.off(br("session_request", g), f), _; } - return await this.setProposal(b, tn({ id: b }, pe)), await this.setAuthRequest(p, { request: vs(tn({}, R), { verifyContext: {} }), pairingTopic: F, transportType: o }), { uri: x ?? K, response: Ee }; + return await this.setProposal(b, tn({ id: b }, ge)), await this.setAuthRequest(g, { request: bs(tn({}, R), { verifyContext: {} }), pairingTopic: B, transportType: o }), { uri: x ?? H, response: Ee }; }, this.approveSessionAuthenticate = async (r) => { - const { id: n, auths: i } = r, s = this.client.core.eventClient.createEvent({ properties: { topic: n.toString(), trace: [Wa.authenticated_session_approve_started] } }); + const { id: n, auths: i } = r, s = this.client.core.eventClient.createEvent({ properties: { topic: n.toString(), trace: [Ga.authenticated_session_approve_started] } }); try { this.isInitialized(); } catch (L) { - throw s.setError(Mf.no_internet_connection), L; + throw s.setError(If.no_internet_connection), L; } const o = this.getPendingAuthRequest(n); - if (!o) throw s.setError(Mf.authenticated_session_pending_request_not_found), new Error(`Could not find pending auth request with id ${n}`); + if (!o) throw s.setError(If.authenticated_session_pending_request_not_found), new Error(`Could not find pending auth request with id ${n}`); const a = o.transportType || zr.relay; a === zr.relay && await this.confirmOnlineStateOrThrow(); - const u = o.requester.publicKey, l = await this.client.core.crypto.generateKeyPair(), d = Cd(u), g = { type: Io, receiverPublicKey: u, senderPublicKey: l }, w = [], A = []; + const u = o.requester.publicKey, l = await this.client.core.crypto.generateKeyPair(), d = Td(u), p = { type: Ro, receiverPublicKey: u, senderPublicKey: l }, w = [], A = []; for (const L of i) { - if (!await qx({ cacao: L, projectId: this.client.core.projectId })) { - s.setError(Mf.invalid_cacao); + if (!await Wx({ cacao: L, projectId: this.client.core.projectId })) { + s.setError(If.invalid_cacao); const V = Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"); - throw await this.sendError({ id: n, topic: d, error: V, encodeOpts: g }), new Error(V.message); + throw await this.sendError({ id: n, topic: d, error: V, encodeOpts: p }), new Error(V.message); } - s.addTrace(Wa.cacaos_verified); - const { p: $ } = L, F = Id($.resources), K = [M1($.iss)], H = c0($.iss); - if (F) { - const V = zx(F), te = Hx(F); - w.push(...V), K.push(...te); + s.addTrace(Ga.cacaos_verified); + const { p: $ } = L, B = Cd($.resources), H = [M1($.iss)], W = u0($.iss); + if (B) { + const V = Hx(B), te = Kx(B); + w.push(...V), H.push(...te); } - for (const V of K) A.push(`${V}:${H}`); + for (const V of H) A.push(`${V}:${W}`); } - const M = await this.client.core.crypto.generateSharedKey(l, u); - s.addTrace(Wa.create_authenticated_session_topic); + const P = await this.client.core.crypto.generateSharedKey(l, u); + s.addTrace(Ga.create_authenticated_session_topic); let N; if ((w == null ? void 0 : w.length) > 0) { - N = { topic: M, acknowledged: !0, self: { publicKey: l, metadata: this.client.metadata }, peer: { publicKey: u, metadata: o.requester.metadata }, controller: u, expiry: En(Wc), authentication: i, requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: o.pairingTopic, namespaces: Qx([...new Set(w)], [...new Set(A)]), transportType: a }, s.addTrace(Wa.subscribing_authenticated_session_topic); + N = { topic: P, acknowledged: !0, self: { publicKey: l, metadata: this.client.metadata }, peer: { publicKey: u, metadata: o.requester.metadata }, controller: u, expiry: En(Kc), authentication: i, requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: o.pairingTopic, namespaces: t3([...new Set(w)], [...new Set(A)]), transportType: a }, s.addTrace(Ga.subscribing_authenticated_session_topic); try { - await this.client.core.relayer.subscribe(M, { transportType: a }); + await this.client.core.relayer.subscribe(P, { transportType: a }); } catch (L) { - throw s.setError(Mf.subscribe_authenticated_session_topic_failure), L; + throw s.setError(If.subscribe_authenticated_session_topic_failure), L; } - s.addTrace(Wa.subscribe_authenticated_session_topic_success), await this.client.session.set(M, N), s.addTrace(Wa.store_authenticated_session), await this.client.core.pairing.updateMetadata({ topic: o.pairingTopic, metadata: o.requester.metadata }); + s.addTrace(Ga.subscribe_authenticated_session_topic_success), await this.client.session.set(P, N), s.addTrace(Ga.store_authenticated_session), await this.client.core.pairing.updateMetadata({ topic: o.pairingTopic, metadata: o.requester.metadata }); } - s.addTrace(Wa.publishing_authenticated_session_approve); + s.addTrace(Ga.publishing_authenticated_session_approve); try { - await this.sendResult({ topic: d, id: n, result: { cacaos: i, responder: { publicKey: l, metadata: this.client.metadata } }, encodeOpts: g, throwOnFailedPublish: !0, appLink: this.getAppLinkIfEnabled(o.requester.metadata, a) }); + await this.sendResult({ topic: d, id: n, result: { cacaos: i, responder: { publicKey: l, metadata: this.client.metadata } }, encodeOpts: p, throwOnFailedPublish: !0, appLink: this.getAppLinkIfEnabled(o.requester.metadata, a) }); } catch (L) { - throw s.setError(Mf.authenticated_session_approve_publish_failure), L; + throw s.setError(If.authenticated_session_approve_publish_failure), L; } return await this.client.auth.requests.delete(n, { message: "fulfilled", code: 0 }), await this.client.core.pairing.activate({ topic: o.pairingTopic }), this.client.core.eventClient.deleteEvent({ eventId: s.eventId }), { session: N }; }, this.rejectSessionAuthenticate = async (r) => { @@ -20187,12 +20187,12 @@ class OV extends Jk { const { id: n, reason: i } = r, s = this.getPendingAuthRequest(n); if (!s) throw new Error(`Could not find pending auth request with id ${n}`); s.transportType === zr.relay && await this.confirmOnlineStateOrThrow(); - const o = s.requester.publicKey, a = await this.client.core.crypto.generateKeyPair(), u = Cd(o), l = { type: Io, receiverPublicKey: o, senderPublicKey: a }; + const o = s.requester.publicKey, a = await this.client.core.crypto.generateKeyPair(), u = Td(o), l = { type: Ro, receiverPublicKey: o, senderPublicKey: a }; await this.sendError({ id: n, topic: u, error: i, encodeOpts: l, rpcOpts: In.wc_sessionAuthenticate.reject, appLink: this.getAppLinkIfEnabled(s.requester.metadata, s.transportType) }), await this.client.auth.requests.delete(n, { message: "rejected", code: 0 }), await this.client.proposal.delete(n, Or("USER_DISCONNECTED")); }, this.formatAuthMessage = (r) => { this.isInitialized(); const { request: n, iss: i } = r; - return B8(n, i); + return U8(n, i); }, this.processRelayMessageCache = () => { setTimeout(async () => { if (this.relayMessageCache.length !== 0) for (; this.relayMessageCache.length > 0; ) try { @@ -20216,18 +20216,18 @@ class OV extends Jk { }, this.deleteSession = async (r) => { var n; const { topic: i, expirerHasDeleted: s = !1, emitEvent: o = !0, id: a = 0 } = r, { self: u } = this.client.session.get(i); - await this.client.core.relayer.unsubscribe(i), await this.client.session.delete(i, Or("USER_DISCONNECTED")), this.addToRecentlyDeleted(i, "session"), this.client.core.crypto.keychain.has(u.publicKey) && await this.client.core.crypto.deleteKeyPair(u.publicKey), this.client.core.crypto.keychain.has(i) && await this.client.core.crypto.deleteSymKey(i), s || this.client.core.expirer.del(i), this.client.core.storage.removeItem(O3).catch((l) => this.client.logger.warn(l)), this.getPendingSessionRequests().forEach((l) => { + await this.client.core.relayer.unsubscribe(i), await this.client.session.delete(i, Or("USER_DISCONNECTED")), this.addToRecentlyDeleted(i, "session"), this.client.core.crypto.keychain.has(u.publicKey) && await this.client.core.crypto.deleteKeyPair(u.publicKey), this.client.core.crypto.keychain.has(i) && await this.client.core.crypto.deleteSymKey(i), s || this.client.core.expirer.del(i), this.client.core.storage.removeItem(L3).catch((l) => this.client.logger.warn(l)), this.getPendingSessionRequests().forEach((l) => { l.topic === i && this.deletePendingSessionRequest(l.id, Or("USER_DISCONNECTED")); - }), i === ((n = this.sessionRequestQueue.queue[0]) == null ? void 0 : n.topic) && (this.sessionRequestQueue.state = Ls.idle), o && this.client.events.emit("session_delete", { id: a, topic: i }); + }), i === ((n = this.sessionRequestQueue.queue[0]) == null ? void 0 : n.topic) && (this.sessionRequestQueue.state = ks.idle), o && this.client.events.emit("session_delete", { id: a, topic: i }); }, this.deleteProposal = async (r, n) => { if (n) try { const i = this.client.proposal.get(r), s = this.client.core.eventClient.getEvent({ topic: i.pairingTopic }); - s == null || s.setError(Ha.proposal_expired); + s == null || s.setError(Va.proposal_expired); } catch { } await Promise.all([this.client.proposal.delete(r, Or("USER_DISCONNECTED")), n ? Promise.resolve() : this.client.core.expirer.del(r)]), this.addToRecentlyDeleted(r, "proposal"); }, this.deletePendingSessionRequest = async (r, n, i = !1) => { - await Promise.all([this.client.pendingRequest.delete(r, n), i ? Promise.resolve() : this.client.core.expirer.del(r)]), this.addToRecentlyDeleted(r, "request"), this.sessionRequestQueue.queue = this.sessionRequestQueue.queue.filter((s) => s.id !== r), i && (this.sessionRequestQueue.state = Ls.idle, this.client.events.emit("session_request_expire", { id: r })); + await Promise.all([this.client.pendingRequest.delete(r, n), i ? Promise.resolve() : this.client.core.expirer.del(r)]), this.addToRecentlyDeleted(r, "request"), this.sessionRequestQueue.queue = this.sessionRequestQueue.queue.filter((s) => s.id !== r), i && (this.sessionRequestQueue.state = ks.idle, this.client.events.emit("session_request_expire", { id: r })); }, this.deletePendingAuthRequest = async (r, n, i = !1) => { await Promise.all([this.client.auth.requests.delete(r, n), i ? Promise.resolve() : this.client.core.expirer.del(r)]); }, this.setExpiry = async (r, n) => { @@ -20241,36 +20241,36 @@ class OV extends Jk { const { id: n, topic: i, params: s, verifyContext: o } = r, a = s.request.expiryTimestamp || En(In.wc_sessionRequest.req.ttl); this.client.core.expirer.set(n, a), await this.client.pendingRequest.set(n, { id: n, topic: i, params: s, verifyContext: o }); }, this.sendRequest = async (r) => { - const { topic: n, method: i, params: s, expiry: o, relayRpcId: a, clientRpcId: u, throwOnFailedPublish: l, appLink: d } = r, g = ha(i, s, u); + const { topic: n, method: i, params: s, expiry: o, relayRpcId: a, clientRpcId: u, throwOnFailedPublish: l, appLink: d } = r, p = ga(i, s, u); let w; const A = !!d; try { - const L = A ? Sf : la; - w = await this.client.core.crypto.encode(n, g, { encoding: L }); + const L = A ? Af : pa; + w = await this.client.core.crypto.encode(n, p, { encoding: L }); } catch (L) { throw await this.cleanup(), this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`), L; } - let M; - if (_V.includes(i)) { - const L = wo(JSON.stringify(g)), $ = wo(w); - M = await this.client.core.verify.register({ id: $, decryptedId: L }); + let P; + if (DV.includes(i)) { + const L = Eo(JSON.stringify(p)), $ = Eo(w); + P = await this.client.core.verify.register({ id: $, decryptedId: L }); } const N = In[i].req; - if (N.attestation = M, o && (N.ttl = o), a && (N.id = a), this.client.core.history.set(n, g), A) { - const L = ud(d, n, w); + if (N.attestation = P, o && (N.ttl = o), a && (N.id = a), this.client.core.history.set(n, p), A) { + const L = fd(d, n, w); await global.Linking.openURL(L, this.client.name); } else { const L = In[i].req; - o && (L.ttl = o), a && (L.id = a), l ? (L.internal = vs(tn({}, L.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(n, w, L)) : this.client.core.relayer.publish(n, w, L).catch(($) => this.client.logger.error($)); + o && (L.ttl = o), a && (L.id = a), l ? (L.internal = bs(tn({}, L.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(n, w, L)) : this.client.core.relayer.publish(n, w, L).catch(($) => this.client.logger.error($)); } - return g.id; + return p.id; }, this.sendResult = async (r) => { - const { id: n, topic: i, result: s, throwOnFailedPublish: o, encodeOpts: a, appLink: u } = r, l = tp(n, s); + const { id: n, topic: i, result: s, throwOnFailedPublish: o, encodeOpts: a, appLink: u } = r, l = rp(n, s); let d; - const g = u && typeof (global == null ? void 0 : global.Linking) < "u"; + const p = u && typeof (global == null ? void 0 : global.Linking) < "u"; try { - const A = g ? Sf : la; - d = await this.client.core.crypto.encode(i, l, vs(tn({}, a || {}), { encoding: A })); + const A = p ? Af : pa; + d = await this.client.core.crypto.encode(i, l, bs(tn({}, a || {}), { encoding: A })); } catch (A) { throw await this.cleanup(), this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`), A; } @@ -20280,21 +20280,21 @@ class OV extends Jk { } catch (A) { throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`), A; } - if (g) { - const A = ud(u, i, d); + if (p) { + const A = fd(u, i, d); await global.Linking.openURL(A, this.client.name); } else { const A = In[w.request.method].res; - o ? (A.internal = vs(tn({}, A.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(i, d, A)) : this.client.core.relayer.publish(i, d, A).catch((M) => this.client.logger.error(M)); + o ? (A.internal = bs(tn({}, A.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(i, d, A)) : this.client.core.relayer.publish(i, d, A).catch((P) => this.client.logger.error(P)); } await this.client.core.history.resolve(l); }, this.sendError = async (r) => { - const { id: n, topic: i, error: s, encodeOpts: o, rpcOpts: a, appLink: u } = r, l = rp(n, s); + const { id: n, topic: i, error: s, encodeOpts: o, rpcOpts: a, appLink: u } = r, l = np(n, s); let d; - const g = u && typeof (global == null ? void 0 : global.Linking) < "u"; + const p = u && typeof (global == null ? void 0 : global.Linking) < "u"; try { - const A = g ? Sf : la; - d = await this.client.core.crypto.encode(i, l, vs(tn({}, o || {}), { encoding: A })); + const A = p ? Af : pa; + d = await this.client.core.crypto.encode(i, l, bs(tn({}, o || {}), { encoding: A })); } catch (A) { throw await this.cleanup(), this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`), A; } @@ -20304,8 +20304,8 @@ class OV extends Jk { } catch (A) { throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`), A; } - if (g) { - const A = ud(u, i, d); + if (p) { + const A = fd(u, i, d); await global.Linking.openURL(A, this.client.name); } else { const A = a || In[w.request.method].res; @@ -20316,19 +20316,19 @@ class OV extends Jk { const r = [], n = []; this.client.session.getAll().forEach((i) => { let s = !1; - aa(i.expiry) && (s = !0), this.client.core.crypto.keychain.has(i.topic) || (s = !0), s && r.push(i.topic); + fa(i.expiry) && (s = !0), this.client.core.crypto.keychain.has(i.topic) || (s = !0), s && r.push(i.topic); }), this.client.proposal.getAll().forEach((i) => { - aa(i.expiryTimestamp) && n.push(i.id); + fa(i.expiryTimestamp) && n.push(i.id); }), await Promise.all([...r.map((i) => this.deleteSession({ topic: i })), ...n.map((i) => this.deleteProposal(i))]); }, this.onRelayEventRequest = async (r) => { this.requestQueue.queue.push(r), await this.processRequestsQueue(); }, this.processRequestsQueue = async () => { - if (this.requestQueue.state === Ls.active) { + if (this.requestQueue.state === ks.active) { this.client.logger.info("Request queue already active, skipping..."); return; } for (this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`); this.requestQueue.queue.length > 0; ) { - this.requestQueue.state = Ls.active; + this.requestQueue.state = ks.active; const r = this.requestQueue.queue.shift(); if (r) try { await this.processRequest(r); @@ -20336,7 +20336,7 @@ class OV extends Jk { this.client.logger.warn(n); } } - this.requestQueue.state = Ls.idle; + this.requestQueue.state = ks.idle; }, this.processRequest = async (r) => { const { topic: n, payload: i, attestation: s, transportType: o, encryptedId: a } = r, u = i.method; if (!this.shouldIgnorePairingRequest({ topic: n, requestMethod: u })) switch (u) { @@ -20392,16 +20392,16 @@ class OV extends Jk { try { const l = this.client.core.eventClient.getEvent({ topic: n }); this.isValidConnect(tn({}, i.params)); - const d = a.expiryTimestamp || En(In.wc_sessionPropose.req.ttl), g = tn({ id: u, pairingTopic: n, expiryTimestamp: d }, a); - await this.setProposal(u, g); - const w = await this.getVerifyContext({ attestationId: s, hash: wo(JSON.stringify(i)), encryptedId: o, metadata: g.proposer.metadata }); - this.client.events.listenerCount("session_proposal") === 0 && (console.warn("No listener for session_proposal event"), l == null || l.setError(yo.proposal_listener_not_found)), l == null || l.addTrace(Fs.emit_session_proposal), this.client.events.emit("session_proposal", { id: u, params: g, verifyContext: w }); + const d = a.expiryTimestamp || En(In.wc_sessionPropose.req.ttl), p = tn({ id: u, pairingTopic: n, expiryTimestamp: d }, a); + await this.setProposal(u, p); + const w = await this.getVerifyContext({ attestationId: s, hash: Eo(JSON.stringify(i)), encryptedId: o, metadata: p.proposer.metadata }); + this.client.events.listenerCount("session_proposal") === 0 && (console.warn("No listener for session_proposal event"), l == null || l.setError(_o.proposal_listener_not_found)), l == null || l.addTrace(Fs.emit_session_proposal), this.client.events.emit("session_proposal", { id: u, params: p, verifyContext: w }); } catch (l) { await this.sendError({ id: u, topic: n, error: l, rpcOpts: In.wc_sessionPropose.autoReject }), this.client.logger.error(l); } }, this.onSessionProposeResponse = async (r, n, i) => { const { id: s } = n; - if (Bs(n)) { + if (js(n)) { const { result: o } = n; this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", result: o }); const a = this.client.proposal.get(s); @@ -20412,9 +20412,9 @@ class OV extends Jk { this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", peerPublicKey: l }); const d = await this.client.core.crypto.generateSharedKey(u, l); this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", sessionTopic: d }); - const g = await this.client.core.relayer.subscribe(d, { transportType: i }); - this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", subscriptionId: g }), await this.client.core.pairing.activate({ topic: r }); - } else if (Zi(n)) { + const p = await this.client.core.relayer.subscribe(d, { transportType: i }); + this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", subscriptionId: p }), await this.client.core.pairing.activate({ topic: r }); + } else if (Qi(n)) { await this.client.proposal.delete(s, Or("USER_DISCONNECTED")); const o = br("session_connect"); if (this.events.listenerCount(o) === 0) throw new Error(`emitting ${o} without any listeners, 954`); @@ -20424,7 +20424,7 @@ class OV extends Jk { const { id: i, params: s } = n; try { this.isValidSessionSettleRequest(s); - const { relay: o, controller: a, expiry: u, namespaces: l, sessionProperties: d, sessionConfig: g } = n.params, w = vs(tn(tn({ topic: r, relay: o, expiry: u, namespaces: l, acknowledged: !0, pairingTopic: "", requiredNamespaces: {}, optionalNamespaces: {}, controller: a.publicKey, self: { publicKey: "", metadata: this.client.metadata }, peer: { publicKey: a.publicKey, metadata: a.metadata } }, d && { sessionProperties: d }), g && { sessionConfig: g }), { transportType: zr.relay }), A = br("session_connect"); + const { relay: o, controller: a, expiry: u, namespaces: l, sessionProperties: d, sessionConfig: p } = n.params, w = bs(tn(tn({ topic: r, relay: o, expiry: u, namespaces: l, acknowledged: !0, pairingTopic: "", requiredNamespaces: {}, optionalNamespaces: {}, controller: a.publicKey, self: { publicKey: "", metadata: this.client.metadata }, peer: { publicKey: a.publicKey, metadata: a.metadata } }, d && { sessionProperties: d }), p && { sessionConfig: p }), { transportType: zr.relay }), A = br("session_connect"); if (this.events.listenerCount(A) === 0) throw new Error(`emitting ${A} without any listeners 997`); this.events.emit(br("session_connect"), { session: w }), await this.sendResult({ id: n.id, topic: r, result: !0, throwOnFailedPublish: !0 }); } catch (o) { @@ -20432,20 +20432,20 @@ class OV extends Jk { } }, this.onSessionSettleResponse = async (r, n) => { const { id: i } = n; - Bs(n) ? (await this.client.session.update(r, { acknowledged: !0 }), this.events.emit(br("session_approve", i), {})) : Zi(n) && (await this.client.session.delete(r, Or("USER_DISCONNECTED")), this.events.emit(br("session_approve", i), { error: n.error })); + js(n) ? (await this.client.session.update(r, { acknowledged: !0 }), this.events.emit(br("session_approve", i), {})) : Qi(n) && (await this.client.session.delete(r, Or("USER_DISCONNECTED")), this.events.emit(br("session_approve", i), { error: n.error })); }, this.onSessionUpdateRequest = async (r, n) => { const { params: i, id: s } = n; try { - const o = `${r}_session_update`, a = Af.get(o); + const o = `${r}_session_update`, a = Pf.get(o); if (a && this.isRequestOutOfSync(a, s)) { this.client.logger.info(`Discarding out of sync request - ${s}`), this.sendError({ id: s, topic: r, error: Or("INVALID_UPDATE_REQUEST") }); return; } this.isValidUpdate(tn({ topic: r }, i)); try { - Af.set(o, s), await this.client.session.update(r, { namespaces: i.namespaces }), await this.sendResult({ id: s, topic: r, result: !0, throwOnFailedPublish: !0 }); + Pf.set(o, s), await this.client.session.update(r, { namespaces: i.namespaces }), await this.sendResult({ id: s, topic: r, result: !0, throwOnFailedPublish: !0 }); } catch (u) { - throw Af.delete(o), u; + throw Pf.delete(o), u; } this.client.events.emit("session_update", { id: s, topic: r, params: i }); } catch (o) { @@ -20454,18 +20454,18 @@ class OV extends Jk { }, this.isRequestOutOfSync = (r, n) => parseInt(n.toString().slice(0, -3)) <= parseInt(r.toString().slice(0, -3)), this.onSessionUpdateResponse = (r, n) => { const { id: i } = n, s = br("session_update", i); if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); - Bs(n) ? this.events.emit(br("session_update", i), {}) : Zi(n) && this.events.emit(br("session_update", i), { error: n.error }); + js(n) ? this.events.emit(br("session_update", i), {}) : Qi(n) && this.events.emit(br("session_update", i), { error: n.error }); }, this.onSessionExtendRequest = async (r, n) => { const { id: i } = n; try { - this.isValidExtend({ topic: r }), await this.setExpiry(r, En(Wc)), await this.sendResult({ id: i, topic: r, result: !0, throwOnFailedPublish: !0 }), this.client.events.emit("session_extend", { id: i, topic: r }); + this.isValidExtend({ topic: r }), await this.setExpiry(r, En(Kc)), await this.sendResult({ id: i, topic: r, result: !0, throwOnFailedPublish: !0 }), this.client.events.emit("session_extend", { id: i, topic: r }); } catch (s) { await this.sendError({ id: i, topic: r, error: s }), this.client.logger.error(s); } }, this.onSessionExtendResponse = (r, n) => { const { id: i } = n, s = br("session_extend", i); if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); - Bs(n) ? this.events.emit(br("session_extend", i), {}) : Zi(n) && this.events.emit(br("session_extend", i), { error: n.error }); + js(n) ? this.events.emit(br("session_extend", i), {}) : Qi(n) && this.events.emit(br("session_extend", i), { error: n.error }); }, this.onSessionPingRequest = async (r, n) => { const { id: i } = n; try { @@ -20477,7 +20477,7 @@ class OV extends Jk { const { id: i } = n, s = br("session_ping", i); if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); setTimeout(() => { - Bs(n) ? this.events.emit(br("session_ping", i), {}) : Zi(n) && this.events.emit(br("session_ping", i), { error: n.error }); + js(n) ? this.events.emit(br("session_ping", i), {}) : Qi(n) && this.events.emit(br("session_ping", i), { error: n.error }); }, 500); }, this.onSessionDeleteRequest = async (r, n) => { const { id: i } = n; @@ -20492,49 +20492,49 @@ class OV extends Jk { } }, this.onSessionRequest = async (r) => { var n, i, s; - const { topic: o, payload: a, attestation: u, encryptedId: l, transportType: d } = r, { id: g, params: w } = a; + const { topic: o, payload: a, attestation: u, encryptedId: l, transportType: d } = r, { id: p, params: w } = a; try { await this.isValidRequest(tn({ topic: o }, w)); - const A = this.client.session.get(o), M = await this.getVerifyContext({ attestationId: u, hash: wo(JSON.stringify(ha("wc_sessionRequest", w, g))), encryptedId: l, metadata: A.peer.metadata, transportType: d }), N = { id: g, topic: o, params: w, verifyContext: M }; + const A = this.client.session.get(o), P = await this.getVerifyContext({ attestationId: u, hash: Eo(JSON.stringify(ga("wc_sessionRequest", w, p))), encryptedId: l, metadata: A.peer.metadata, transportType: d }), N = { id: p, topic: o, params: w, verifyContext: P }; await this.setPendingSessionRequest(N), d === zr.link_mode && (n = A.peer.metadata.redirect) != null && n.universal && this.client.core.addLinkModeSupportedApp((i = A.peer.metadata.redirect) == null ? void 0 : i.universal), (s = this.client.signConfig) != null && s.disableRequestQueue ? this.emitSessionRequest(N) : (this.addSessionRequestToSessionRequestQueue(N), this.processSessionRequestQueue()); } catch (A) { - await this.sendError({ id: g, topic: o, error: A }), this.client.logger.error(A); + await this.sendError({ id: p, topic: o, error: A }), this.client.logger.error(A); } }, this.onSessionRequestResponse = (r, n) => { const { id: i } = n, s = br("session_request", i); if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); - Bs(n) ? this.events.emit(br("session_request", i), { result: n.result }) : Zi(n) && this.events.emit(br("session_request", i), { error: n.error }); + js(n) ? this.events.emit(br("session_request", i), { result: n.result }) : Qi(n) && this.events.emit(br("session_request", i), { error: n.error }); }, this.onSessionEventRequest = async (r, n) => { const { id: i, params: s } = n; try { - const o = `${r}_session_event_${s.event.name}`, a = Af.get(o); + const o = `${r}_session_event_${s.event.name}`, a = Pf.get(o); if (a && this.isRequestOutOfSync(a, i)) { this.client.logger.info(`Discarding out of sync request - ${i}`); return; } - this.isValidEmit(tn({ topic: r }, s)), this.client.events.emit("session_event", { id: i, topic: r, params: s }), Af.set(o, i); + this.isValidEmit(tn({ topic: r }, s)), this.client.events.emit("session_event", { id: i, topic: r, params: s }), Pf.set(o, i); } catch (o) { await this.sendError({ id: i, topic: r, error: o }), this.client.logger.error(o); } }, this.onSessionAuthenticateResponse = (r, n) => { const { id: i } = n; - this.client.logger.trace({ type: "method", method: "onSessionAuthenticateResponse", topic: r, payload: n }), Bs(n) ? this.events.emit(br("session_request", i), { result: n.result }) : Zi(n) && this.events.emit(br("session_request", i), { error: n.error }); + this.client.logger.trace({ type: "method", method: "onSessionAuthenticateResponse", topic: r, payload: n }), js(n) ? this.events.emit(br("session_request", i), { result: n.result }) : Qi(n) && this.events.emit(br("session_request", i), { error: n.error }); }, this.onSessionAuthenticateRequest = async (r) => { var n; const { topic: i, payload: s, attestation: o, encryptedId: a, transportType: u } = r; try { - const { requester: l, authPayload: d, expiryTimestamp: g } = s.params, w = await this.getVerifyContext({ attestationId: o, hash: wo(JSON.stringify(s)), encryptedId: a, metadata: l.metadata, transportType: u }), A = { requester: l, pairingTopic: i, id: s.id, authPayload: d, verifyContext: w, expiryTimestamp: g }; + const { requester: l, authPayload: d, expiryTimestamp: p } = s.params, w = await this.getVerifyContext({ attestationId: o, hash: Eo(JSON.stringify(s)), encryptedId: a, metadata: l.metadata, transportType: u }), A = { requester: l, pairingTopic: i, id: s.id, authPayload: d, verifyContext: w, expiryTimestamp: p }; await this.setAuthRequest(s.id, { request: A, pairingTopic: i, transportType: u }), u === zr.link_mode && (n = l.metadata.redirect) != null && n.universal && this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal), this.client.events.emit("session_authenticate", { topic: i, params: s.params, id: s.id, verifyContext: w }); } catch (l) { this.client.logger.error(l); - const d = s.params.requester.publicKey, g = await this.client.core.crypto.generateKeyPair(), w = this.getAppLinkIfEnabled(s.params.requester.metadata, u), A = { type: Io, receiverPublicKey: d, senderPublicKey: g }; + const d = s.params.requester.publicKey, p = await this.client.core.crypto.generateKeyPair(), w = this.getAppLinkIfEnabled(s.params.requester.metadata, u), A = { type: Ro, receiverPublicKey: d, senderPublicKey: p }; await this.sendError({ id: s.id, topic: i, error: l, encodeOpts: A, rpcOpts: In.wc_sessionAuthenticate.autoReject, appLink: w }); } }, this.addSessionRequestToSessionRequestQueue = (r) => { this.sessionRequestQueue.queue.push(r); }, this.cleanupAfterResponse = (r) => { this.deletePendingSessionRequest(r.response.id, { message: "fulfilled", code: 0 }), setTimeout(() => { - this.sessionRequestQueue.state = Ls.idle, this.processSessionRequestQueue(); + this.sessionRequestQueue.state = ks.idle, this.processSessionRequestQueue(); }, mt.toMiliseconds(this.requestQueueDelay)); }, this.cleanupPendingSentRequestsForTopic = ({ topic: r, error: n }) => { const i = this.client.core.history.pending; @@ -20544,7 +20544,7 @@ class OV extends Jk { this.events.emit(br("session_request", s.request.id), { error: n }); }); }, this.processSessionRequestQueue = () => { - if (this.sessionRequestQueue.state === Ls.active) { + if (this.sessionRequestQueue.state === ks.active) { this.client.logger.info("session request queue is already active."); return; } @@ -20554,7 +20554,7 @@ class OV extends Jk { return; } try { - this.sessionRequestQueue.state = Ls.active, this.emitSessionRequest(r); + this.sessionRequestQueue.state = ks.active, this.emitSessionRequest(r); } catch (n) { this.client.logger.error(n); } @@ -20563,64 +20563,64 @@ class OV extends Jk { }, this.onPairingCreated = (r) => { if (r.methods && this.expectedPairingMethodMap.set(r.topic, r.methods), r.active) return; const n = this.client.proposal.getAll().find((i) => i.pairingTopic === r.topic); - n && this.onSessionProposeRequest({ topic: r.topic, payload: ha("wc_sessionPropose", { requiredNamespaces: n.requiredNamespaces, optionalNamespaces: n.optionalNamespaces, relays: n.relays, proposer: n.proposer, sessionProperties: n.sessionProperties }, n.id) }); + n && this.onSessionProposeRequest({ topic: r.topic, payload: ga("wc_sessionPropose", { requiredNamespaces: n.requiredNamespaces, optionalNamespaces: n.optionalNamespaces, relays: n.relays, proposer: n.proposer, sessionProperties: n.sessionProperties }, n.id) }); }, this.isValidConnect = async (r) => { - if (!pi(r)) { + if (!gi(r)) { const { message: u } = ft("MISSING_OR_INVALID", `connect() params: ${JSON.stringify(r)}`); throw new Error(u); } const { pairingTopic: n, requiredNamespaces: i, optionalNamespaces: s, sessionProperties: o, relays: a } = r; - if (gi(n) || await this.isValidPairingTopic(n), !Jz(a)) { + if (mi(n) || await this.isValidPairingTopic(n), !oW(a)) { const { message: u } = ft("MISSING_OR_INVALID", `connect() relays: ${a}`); throw new Error(u); } - !gi(i) && El(i) !== 0 && this.validateNamespaces(i, "requiredNamespaces"), !gi(s) && El(s) !== 0 && this.validateNamespaces(s, "optionalNamespaces"), gi(o) || this.validateSessionProps(o, "sessionProperties"); + !mi(i) && Sl(i) !== 0 && this.validateNamespaces(i, "requiredNamespaces"), !mi(s) && Sl(s) !== 0 && this.validateNamespaces(s, "optionalNamespaces"), mi(o) || this.validateSessionProps(o, "sessionProperties"); }, this.validateNamespaces = (r, n) => { - const i = Yz(r, "connect()", n); + const i = sW(r, "connect()", n); if (i) throw new Error(i.message); }, this.isValidApprove = async (r) => { - if (!pi(r)) throw new Error(ft("MISSING_OR_INVALID", `approve() params: ${r}`).message); + if (!gi(r)) throw new Error(ft("MISSING_OR_INVALID", `approve() params: ${r}`).message); const { id: n, namespaces: i, relayProtocol: s, sessionProperties: o } = r; this.checkRecentlyDeleted(n), await this.isValidProposalId(n); const a = this.client.proposal.get(n), u = hm(i, "approve()"); if (u) throw new Error(u.message); - const l = r3(a.requiredNamespaces, i, "approve()"); + const l = i3(a.requiredNamespaces, i, "approve()"); if (l) throw new Error(l.message); if (!dn(s, !0)) { const { message: d } = ft("MISSING_OR_INVALID", `approve() relayProtocol: ${s}`); throw new Error(d); } - gi(o) || this.validateSessionProps(o, "sessionProperties"); + mi(o) || this.validateSessionProps(o, "sessionProperties"); }, this.isValidReject = async (r) => { - if (!pi(r)) { + if (!gi(r)) { const { message: s } = ft("MISSING_OR_INVALID", `reject() params: ${r}`); throw new Error(s); } const { id: n, reason: i } = r; - if (this.checkRecentlyDeleted(n), await this.isValidProposalId(n), !Zz(i)) { + if (this.checkRecentlyDeleted(n), await this.isValidProposalId(n), !cW(i)) { const { message: s } = ft("MISSING_OR_INVALID", `reject() reason: ${JSON.stringify(i)}`); throw new Error(s); } }, this.isValidSessionSettleRequest = (r) => { - if (!pi(r)) { + if (!gi(r)) { const { message: l } = ft("MISSING_OR_INVALID", `onSessionSettleRequest() params: ${r}`); throw new Error(l); } const { relay: n, controller: i, namespaces: s, expiry: o } = r; - if (!V8(n)) { + if (!Y8(n)) { const { message: l } = ft("MISSING_OR_INVALID", "onSessionSettleRequest() relay protocol should be a string"); throw new Error(l); } - const a = zz(i, "onSessionSettleRequest()"); + const a = Qz(i, "onSessionSettleRequest()"); if (a) throw new Error(a.message); const u = hm(s, "onSessionSettleRequest()"); if (u) throw new Error(u.message); - if (aa(o)) { + if (fa(o)) { const { message: l } = ft("EXPIRED", "onSessionSettleRequest()"); throw new Error(l); } }, this.isValidUpdate = async (r) => { - if (!pi(r)) { + if (!gi(r)) { const { message: u } = ft("MISSING_OR_INVALID", `update() params: ${r}`); throw new Error(u); } @@ -20628,42 +20628,42 @@ class OV extends Jk { this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); const s = this.client.session.get(n), o = hm(i, "update()"); if (o) throw new Error(o.message); - const a = r3(s.requiredNamespaces, i, "update()"); + const a = i3(s.requiredNamespaces, i, "update()"); if (a) throw new Error(a.message); }, this.isValidExtend = async (r) => { - if (!pi(r)) { + if (!gi(r)) { const { message: i } = ft("MISSING_OR_INVALID", `extend() params: ${r}`); throw new Error(i); } const { topic: n } = r; this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); }, this.isValidRequest = async (r) => { - if (!pi(r)) { + if (!gi(r)) { const { message: u } = ft("MISSING_OR_INVALID", `request() params: ${r}`); throw new Error(u); } const { topic: n, request: i, chainId: s, expiry: o } = r; this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); const { namespaces: a } = this.client.session.get(n); - if (!t3(a, s)) { + if (!n3(a, s)) { const { message: u } = ft("MISSING_OR_INVALID", `request() chainId: ${s}`); throw new Error(u); } - if (!Qz(i)) { + if (!uW(i)) { const { message: u } = ft("MISSING_OR_INVALID", `request() ${JSON.stringify(i)}`); throw new Error(u); } - if (!rH(a, s, i.method)) { + if (!hW(a, s, i.method)) { const { message: u } = ft("MISSING_OR_INVALID", `request() method: ${i.method}`); throw new Error(u); } - if (o && !oH(o, vm)) { + if (o && !mW(o, vm)) { const { message: u } = ft("MISSING_OR_INVALID", `request() expiry: ${o}. Expiry must be a number (in seconds) between ${vm.min} and ${vm.max}`); throw new Error(u); } }, this.isValidRespond = async (r) => { var n; - if (!pi(r)) { + if (!gi(r)) { const { message: o } = ft("MISSING_OR_INVALID", `respond() params: ${r}`); throw new Error(o); } @@ -20673,39 +20673,39 @@ class OV extends Jk { } catch (o) { throw (n = r == null ? void 0 : r.response) != null && n.id && this.cleanupAfterResponse(r), o; } - if (!eH(s)) { + if (!fW(s)) { const { message: o } = ft("MISSING_OR_INVALID", `respond() response: ${JSON.stringify(s)}`); throw new Error(o); } }, this.isValidPing = async (r) => { - if (!pi(r)) { + if (!gi(r)) { const { message: i } = ft("MISSING_OR_INVALID", `ping() params: ${r}`); throw new Error(i); } const { topic: n } = r; await this.isValidSessionOrPairingTopic(n); }, this.isValidEmit = async (r) => { - if (!pi(r)) { + if (!gi(r)) { const { message: a } = ft("MISSING_OR_INVALID", `emit() params: ${r}`); throw new Error(a); } const { topic: n, event: i, chainId: s } = r; await this.isValidSessionTopic(n); const { namespaces: o } = this.client.session.get(n); - if (!t3(o, s)) { + if (!n3(o, s)) { const { message: a } = ft("MISSING_OR_INVALID", `emit() chainId: ${s}`); throw new Error(a); } - if (!tH(i)) { + if (!lW(i)) { const { message: a } = ft("MISSING_OR_INVALID", `emit() event: ${JSON.stringify(i)}`); throw new Error(a); } - if (!nH(o, s, i.name)) { + if (!dW(o, s, i.name)) { const { message: a } = ft("MISSING_OR_INVALID", `emit() event: ${JSON.stringify(i)}`); throw new Error(a); } }, this.isValidDisconnect = async (r) => { - if (!pi(r)) { + if (!gi(r)) { const { message: i } = ft("MISSING_OR_INVALID", `disconnect() params: ${r}`); throw new Error(i); } @@ -20717,11 +20717,11 @@ class OV extends Jk { if (!dn(i, !1)) throw new Error("uri is required parameter"); if (!dn(s, !1)) throw new Error("domain is required parameter"); if (!dn(o, !1)) throw new Error("nonce is required parameter"); - if ([...new Set(n.map((u) => lu(u).namespace))].length > 1) throw new Error("Multi-namespace requests are not supported. Please request single namespace only."); - const { namespace: a } = lu(n[0]); + if ([...new Set(n.map((u) => hu(u).namespace))].length > 1) throw new Error("Multi-namespace requests are not supported. Please request single namespace only."); + const { namespace: a } = hu(n[0]); if (a !== "eip155") throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains."); }, this.getVerifyContext = async (r) => { - const { attestationId: n, hash: i, encryptedId: s, metadata: o, transportType: a } = r, u = { verified: { verifyUrl: o.verifyUrl || zf, validation: "UNKNOWN", origin: o.url || "" } }; + const { attestationId: n, hash: i, encryptedId: s, metadata: o, transportType: a } = r, u = { verified: { verifyUrl: o.verifyUrl || Wf, validation: "UNKNOWN", origin: o.url || "" } }; try { if (a === zr.link_mode) { const d = this.getAppLinkIfEnabled(o, a); @@ -20759,18 +20759,18 @@ class OV extends Jk { throw new Error(i); } }, this.isLinkModeEnabled = (r, n) => { - var i, s, o, a, u, l, d, g, w; - return !r || n !== zr.link_mode ? !1 : ((s = (i = this.client.metadata) == null ? void 0 : i.redirect) == null ? void 0 : s.linkMode) === !0 && ((a = (o = this.client.metadata) == null ? void 0 : o.redirect) == null ? void 0 : a.universal) !== void 0 && ((l = (u = this.client.metadata) == null ? void 0 : u.redirect) == null ? void 0 : l.universal) !== "" && ((d = r == null ? void 0 : r.redirect) == null ? void 0 : d.universal) !== void 0 && ((g = r == null ? void 0 : r.redirect) == null ? void 0 : g.universal) !== "" && ((w = r == null ? void 0 : r.redirect) == null ? void 0 : w.linkMode) === !0 && this.client.core.linkModeSupportedApps.includes(r.redirect.universal) && typeof (global == null ? void 0 : global.Linking) < "u"; + var i, s, o, a, u, l, d, p, w; + return !r || n !== zr.link_mode ? !1 : ((s = (i = this.client.metadata) == null ? void 0 : i.redirect) == null ? void 0 : s.linkMode) === !0 && ((a = (o = this.client.metadata) == null ? void 0 : o.redirect) == null ? void 0 : a.universal) !== void 0 && ((l = (u = this.client.metadata) == null ? void 0 : u.redirect) == null ? void 0 : l.universal) !== "" && ((d = r == null ? void 0 : r.redirect) == null ? void 0 : d.universal) !== void 0 && ((p = r == null ? void 0 : r.redirect) == null ? void 0 : p.universal) !== "" && ((w = r == null ? void 0 : r.redirect) == null ? void 0 : w.linkMode) === !0 && this.client.core.linkModeSupportedApps.includes(r.redirect.universal) && typeof (global == null ? void 0 : global.Linking) < "u"; }, this.getAppLinkIfEnabled = (r, n) => { var i; return this.isLinkModeEnabled(r, n) ? (i = r == null ? void 0 : r.redirect) == null ? void 0 : i.universal : void 0; }, this.handleLinkModeMessage = ({ url: r }) => { if (!r || !r.includes("wc_ev") || !r.includes("topic")) return; - const n = Fx(r, "topic") || "", i = decodeURIComponent(Fx(r, "wc_ev") || ""), s = this.client.session.keys.includes(n); + const n = jx(r, "topic") || "", i = decodeURIComponent(jx(r, "wc_ev") || ""), s = this.client.session.keys.includes(n); s && this.client.session.update(n, { transportType: zr.link_mode }), this.client.core.dispatchEnvelope({ topic: n, message: i, sessionExists: s }); }, this.registerLinkModeListeners = async () => { var r; - if (ib() || ju() && (r = this.client.metadata.redirect) != null && r.linkMode) { + if (ib() || qu() && (r = this.client.metadata.redirect) != null && r.linkMode) { const n = global == null ? void 0 : global.Linking; if (typeof n < "u") { n.addEventListener("url", this.handleLinkModeMessage, this.client.name); @@ -20797,23 +20797,23 @@ class OV extends Jk { }); } async onRelayMessage(e) { - const { topic: r, message: n, attestation: i, transportType: s } = e, { publicKey: o } = this.client.auth.authKeys.keys.includes(Td) ? this.client.auth.authKeys.get(Td) : { publicKey: void 0 }, a = await this.client.core.crypto.decode(r, n, { receiverPublicKey: o, encoding: s === zr.link_mode ? Sf : la }); + const { topic: r, message: n, attestation: i, transportType: s } = e, { publicKey: o } = this.client.auth.authKeys.keys.includes(Rd) ? this.client.auth.authKeys.get(Rd) : { publicKey: void 0 }, a = await this.client.core.crypto.decode(r, n, { receiverPublicKey: o, encoding: s === zr.link_mode ? Af : pa }); try { - fb(a) ? (this.client.core.history.set(r, a), this.onRelayEventRequest({ topic: r, payload: a, attestation: i, transportType: s, encryptedId: wo(n) })) : np(a) ? (await this.client.core.history.resolve(a), await this.onRelayEventResponse({ topic: r, payload: a, transportType: s }), this.client.core.history.delete(r, a.id)) : this.onRelayEventUnknownPayload({ topic: r, payload: a, transportType: s }); + fb(a) ? (this.client.core.history.set(r, a), this.onRelayEventRequest({ topic: r, payload: a, attestation: i, transportType: s, encryptedId: Eo(n) })) : ip(a) ? (await this.client.core.history.resolve(a), await this.onRelayEventResponse({ topic: r, payload: a, transportType: s }), this.client.core.history.delete(r, a.id)) : this.onRelayEventUnknownPayload({ topic: r, payload: a, transportType: s }); } catch (u) { this.client.logger.error(u); } } registerExpirerEvents() { - this.client.core.expirer.on(Ji.expired, async (e) => { - const { topic: r, id: n } = $8(e.target); + this.client.core.expirer.on(Xi.expired, async (e) => { + const { topic: r, id: n } = F8(e.target); if (n && this.client.pendingRequest.keys.includes(n)) return await this.deletePendingSessionRequest(n, ft("EXPIRED"), !0); if (n && this.client.auth.requests.keys.includes(n)) return await this.deletePendingAuthRequest(n, ft("EXPIRED"), !0); r ? this.client.session.keys.includes(r) && (await this.deleteSession({ topic: r, expirerHasDeleted: !0 }), this.client.events.emit("session_expire", { topic: r })) : n && (await this.deleteProposal(n, !0), this.client.events.emit("proposal_expire", { id: n })); }); } registerPairingEvents() { - this.client.core.pairing.events.on(Xa.create, (e) => this.onPairingCreated(e)), this.client.core.pairing.events.on(Xa.delete, (e) => { + this.client.core.pairing.events.on(Qa.create, (e) => this.onPairingCreated(e)), this.client.core.pairing.events.on(Qa.delete, (e) => { this.addToRecentlyDeleted(e.topic, "pairing"); }); } @@ -20826,7 +20826,7 @@ class OV extends Jk { const { message: r } = ft("NO_MATCHING_KEY", `pairing topic doesn't exist: ${e}`); throw new Error(r); } - if (aa(this.client.core.pairing.pairings.get(e).expiry)) { + if (fa(this.client.core.pairing.pairings.get(e).expiry)) { const { message: r } = ft("EXPIRED", `pairing topic: ${e}`); throw new Error(r); } @@ -20840,7 +20840,7 @@ class OV extends Jk { const { message: r } = ft("NO_MATCHING_KEY", `session topic doesn't exist: ${e}`); throw new Error(r); } - if (aa(this.client.session.get(e).expiry)) { + if (fa(this.client.session.get(e).expiry)) { await this.deleteSession({ topic: e }); const { message: r } = ft("EXPIRED", `session topic: ${e}`); throw new Error(r); @@ -20862,7 +20862,7 @@ class OV extends Jk { } } async isValidProposalId(e) { - if (!Xz(e)) { + if (!aW(e)) { const { message: r } = ft("MISSING_OR_INVALID", `proposal id should be a number: ${e}`); throw new Error(r); } @@ -20870,54 +20870,54 @@ class OV extends Jk { const { message: r } = ft("NO_MATCHING_KEY", `proposal id doesn't exist: ${e}`); throw new Error(r); } - if (aa(this.client.proposal.get(e).expiryTimestamp)) { + if (fa(this.client.proposal.get(e).expiryTimestamp)) { await this.deleteProposal(e); const { message: r } = ft("EXPIRED", `proposal id: ${e}`); throw new Error(r); } } } -class NV extends _c { +class WV extends Ec { constructor(e, r) { - super(e, r, bV, hb), this.core = e, this.logger = r; + super(e, r, IV, hb), this.core = e, this.logger = r; } } -let LV = class extends _c { +let HV = class extends Ec { constructor(e, r) { - super(e, r, yV, hb), this.core = e, this.logger = r; + super(e, r, CV, hb), this.core = e, this.logger = r; } }; -class kV extends _c { +class KV extends Ec { constructor(e, r) { - super(e, r, xV, hb, (n) => n.id), this.core = e, this.logger = r; + super(e, r, RV, hb, (n) => n.id), this.core = e, this.logger = r; } } -class $V extends _c { +class VV extends Ec { constructor(e, r) { - super(e, r, AV, sp, () => Td), this.core = e, this.logger = r; + super(e, r, LV, op, () => Rd), this.core = e, this.logger = r; } } -class FV extends _c { +class GV extends Ec { constructor(e, r) { - super(e, r, PV, sp), this.core = e, this.logger = r; + super(e, r, kV, op), this.core = e, this.logger = r; } } -class BV extends _c { +class YV extends Ec { constructor(e, r) { - super(e, r, MV, sp, (n) => n.id), this.core = e, this.logger = r; + super(e, r, $V, op, (n) => n.id), this.core = e, this.logger = r; } } -class UV { +class JV { constructor(e, r) { - this.core = e, this.logger = r, this.authKeys = new $V(this.core, this.logger), this.pairingTopics = new FV(this.core, this.logger), this.requests = new BV(this.core, this.logger); + this.core = e, this.logger = r, this.authKeys = new VV(this.core, this.logger), this.pairingTopics = new GV(this.core, this.logger), this.requests = new YV(this.core, this.logger); } async init() { await this.authKeys.init(), await this.pairingTopics.init(), await this.requests.init(); } } -class db extends Yk { +class db extends s$ { constructor(e) { - super(e), this.protocol = mE, this.version = vE, this.name = mm.name, this.events = new rs.EventEmitter(), this.on = (n, i) => this.events.on(n, i), this.once = (n, i) => this.events.once(n, i), this.off = (n, i) => this.events.off(n, i), this.removeListener = (n, i) => this.events.removeListener(n, i), this.removeAllListeners = (n) => this.events.removeAllListeners(n), this.connect = async (n) => { + super(e), this.protocol = bE, this.version = yE, this.name = mm.name, this.events = new ns.EventEmitter(), this.on = (n, i) => this.events.on(n, i), this.once = (n, i) => this.events.once(n, i), this.off = (n, i) => this.events.off(n, i), this.removeListener = (n, i) => this.events.removeListener(n, i), this.removeAllListeners = (n) => this.events.removeAllListeners(n), this.connect = async (n) => { try { return await this.engine.connect(n); } catch (i) { @@ -21019,9 +21019,9 @@ class db extends Yk { } catch (i) { throw this.logger.error(i.message), i; } - }, this.name = (e == null ? void 0 : e.name) || mm.name, this.metadata = (e == null ? void 0 : e.metadata) || D8(), this.signConfig = e == null ? void 0 : e.signConfig; - const r = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : jl(k0({ level: (e == null ? void 0 : e.logger) || mm.logger })); - this.core = (e == null ? void 0 : e.core) || new vV(e), this.logger = ai(r, this.name), this.session = new LV(this.core, this.logger), this.proposal = new NV(this.core, this.logger), this.pendingRequest = new kV(this.core, this.logger), this.engine = new OV(this), this.auth = new UV(this.core, this.logger); + }, this.name = (e == null ? void 0 : e.name) || mm.name, this.metadata = (e == null ? void 0 : e.metadata) || N8(), this.signConfig = e == null ? void 0 : e.signConfig; + const r = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : ql($0({ level: (e == null ? void 0 : e.logger) || mm.logger })); + this.core = (e == null ? void 0 : e.core) || new MV(e), this.logger = ci(r, this.name), this.session = new HV(this.core, this.logger), this.proposal = new WV(this.core, this.logger), this.pendingRequest = new KV(this.core, this.logger), this.engine = new zV(this), this.auth = new JV(this.core, this.logger); } static async init(e) { const r = new db(e); @@ -21042,7 +21042,7 @@ class db extends Yk { } } } -var l0 = { exports: {} }; +var h0 = { exports: {} }; /** * @license * Lodash @@ -21051,29 +21051,29 @@ var l0 = { exports: {} }; * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -l0.exports; +h0.exports; (function(t, e) { (function() { - var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", u = "__lodash_hash_undefined__", l = 500, d = "__lodash_placeholder__", g = 1, w = 2, A = 4, M = 1, N = 2, L = 1, $ = 2, F = 4, K = 8, H = 16, V = 32, te = 64, R = 128, W = 256, pe = 512, Ee = 30, Y = "...", S = 800, m = 16, f = 1, p = 2, b = 3, x = 1 / 0, _ = 9007199254740991, E = 17976931348623157e292, v = NaN, P = 4294967295, I = P - 1, B = P >>> 1, ce = [ + var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", u = "__lodash_hash_undefined__", l = 500, d = "__lodash_placeholder__", p = 1, w = 2, A = 4, P = 1, N = 2, L = 1, $ = 2, B = 4, H = 8, W = 16, V = 32, te = 64, R = 128, K = 256, ge = 512, Ee = 30, Y = "...", S = 800, m = 16, f = 1, g = 2, b = 3, x = 1 / 0, _ = 9007199254740991, E = 17976931348623157e292, v = NaN, M = 4294967295, I = M - 1, F = M >>> 1, ce = [ ["ary", R], ["bind", L], ["bindKey", $], - ["curry", K], - ["curryRight", H], - ["flip", pe], + ["curry", H], + ["curryRight", W], + ["flip", ge], ["partial", V], ["partialRight", te], - ["rearg", W] - ], D = "[object Arguments]", oe = "[object Array]", Z = "[object AsyncFunction]", J = "[object Boolean]", Q = "[object Date]", T = "[object DOMException]", X = "[object Error]", re = "[object Function]", de = "[object GeneratorFunction]", ie = "[object Map]", ue = "[object Number]", ve = "[object Null]", Pe = "[object Object]", De = "[object Promise]", Ce = "[object Proxy]", $e = "[object RegExp]", Me = "[object Set]", Ne = "[object String]", Ke = "[object Symbol]", Le = "[object Undefined]", qe = "[object WeakMap]", ze = "[object WeakSet]", _e = "[object ArrayBuffer]", Ze = "[object DataView]", at = "[object Float32Array]", ke = "[object Float64Array]", Qe = "[object Int8Array]", tt = "[object Int16Array]", Ye = "[object Int32Array]", dt = "[object Uint8Array]", lt = "[object Uint8ClampedArray]", ct = "[object Uint16Array]", qt = "[object Uint32Array]", Yt = /\b__p \+= '';/g, Et = /\b(__p \+=) '' \+/g, Qt = /(__e\(.*?\)|\b__t\)) \+\n'';/g, Jt = /&(?:amp|lt|gt|quot|#39);/g, Dt = /[&<>"']/g, kt = RegExp(Jt.source), Ct = RegExp(Dt.source), gt = /<%-([\s\S]+?)%>/g, Rt = /<%([\s\S]+?)%>/g, Nt = /<%=([\s\S]+?)%>/g, vt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $t = /^\w*$/, Bt = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, rt = /[\\^$.*+?()[\]{}|]/g, Ft = RegExp(rt.source), k = /^\s+/, j = /\s/, z = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, C = /\{\n\/\* \[wrapped with (.+)\] \*/, G = /,? & /, U = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, se = /[()=,{}\[\]\/\s]/, he = /\\(\\)?/g, xe = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Te = /\w*$/, Re = /^[-+]0x[0-9a-f]+$/i, nt = /^0b[01]+$/i, Ue = /^\[object .+?Constructor\]$/, pt = /^0o[0-7]+$/i, it = /^(?:0|[1-9]\d*)$/, et = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, St = /($^)/, Tt = /['\n\r\u2028\u2029\\]/g, At = "\\ud800-\\udfff", _t = "\\u0300-\\u036f", ht = "\\ufe20-\\ufe2f", xt = "\\u20d0-\\u20ff", st = _t + ht + xt, bt = "\\u2700-\\u27bf", ut = "a-z\\xdf-\\xf6\\xf8-\\xff", ot = "\\xac\\xb1\\xd7\\xf7", Se = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Ae = "\\u2000-\\u206f", Ve = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Be = "A-Z\\xc0-\\xd6\\xd8-\\xde", je = "\\ufe0e\\ufe0f", Je = ot + Se + Ae + Ve, Lt = "['’]", zt = "[" + At + "]", Xt = "[" + Je + "]", Ht = "[" + st + "]", le = "\\d+", tr = "[" + bt + "]", dr = "[" + ut + "]", pr = "[^" + At + Je + le + bt + ut + Be + "]", Zt = "\\ud83c[\\udffb-\\udfff]", gr = "(?:" + Ht + "|" + Zt + ")", lr = "[^" + At + "]", Rr = "(?:\\ud83c[\\udde6-\\uddff]){2}", mr = "[\\ud800-\\udbff][\\udc00-\\udfff]", yr = "[" + Be + "]", $r = "\\u200d", Fr = "(?:" + dr + "|" + pr + ")", Ir = "(?:" + yr + "|" + pr + ")", nn = "(?:" + Lt + "(?:d|ll|m|re|s|t|ve))?", sn = "(?:" + Lt + "(?:D|LL|M|RE|S|T|VE))?", on = gr + "?", fh = "[" + je + "]?", Rp = "(?:" + $r + "(?:" + [lr, Rr, mr].join("|") + ")" + fh + on + ")*", no = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", lh = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", hh = fh + on + Rp, Pc = "(?:" + [tr, Rr, mr].join("|") + ")" + hh, Dp = "(?:" + [lr + Ht + "?", Ht, Rr, mr, zt].join("|") + ")", Ju = RegExp(Lt, "g"), Op = RegExp(Ht, "g"), Mc = RegExp(Zt + "(?=" + Zt + ")|" + Dp + hh, "g"), dh = RegExp([ - yr + "?" + dr + "+" + nn + "(?=" + [Xt, yr, "$"].join("|") + ")", - Ir + "+" + sn + "(?=" + [Xt, yr + Fr, "$"].join("|") + ")", - yr + "?" + Fr + "+" + nn, + ["rearg", K] + ], D = "[object Arguments]", oe = "[object Array]", Z = "[object AsyncFunction]", J = "[object Boolean]", Q = "[object Date]", T = "[object DOMException]", X = "[object Error]", re = "[object Function]", pe = "[object GeneratorFunction]", ie = "[object Map]", ue = "[object Number]", ve = "[object Null]", Pe = "[object Object]", De = "[object Promise]", Ce = "[object Proxy]", $e = "[object RegExp]", Me = "[object Set]", Ne = "[object String]", Ke = "[object Symbol]", Le = "[object Undefined]", qe = "[object WeakMap]", ze = "[object WeakSet]", _e = "[object ArrayBuffer]", Ze = "[object DataView]", at = "[object Float32Array]", ke = "[object Float64Array]", Qe = "[object Int8Array]", tt = "[object Int16Array]", Ye = "[object Int32Array]", dt = "[object Uint8Array]", lt = "[object Uint8ClampedArray]", ct = "[object Uint16Array]", qt = "[object Uint32Array]", Jt = /\b__p \+= '';/g, Et = /\b(__p \+=) '' \+/g, er = /(__e\(.*?\)|\b__t\)) \+\n'';/g, Xt = /&(?:amp|lt|gt|quot|#39);/g, Dt = /[&<>"']/g, kt = RegExp(Xt.source), Ct = RegExp(Dt.source), gt = /<%-([\s\S]+?)%>/g, Rt = /<%([\s\S]+?)%>/g, Nt = /<%=([\s\S]+?)%>/g, vt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $t = /^\w*$/, Ft = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, rt = /[\\^$.*+?()[\]{}|]/g, Bt = RegExp(rt.source), k = /^\s+/, U = /\s/, z = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, C = /\{\n\/\* \[wrapped with (.+)\] \*/, G = /,? & /, j = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, se = /[()=,{}\[\]\/\s]/, de = /\\(\\)?/g, xe = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Te = /\w*$/, Re = /^[-+]0x[0-9a-f]+$/i, nt = /^0b[01]+$/i, je = /^\[object .+?Constructor\]$/, pt = /^0o[0-7]+$/i, it = /^(?:0|[1-9]\d*)$/, et = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, St = /($^)/, Tt = /['\n\r\u2028\u2029\\]/g, At = "\\ud800-\\udfff", _t = "\\u0300-\\u036f", ht = "\\ufe20-\\ufe2f", xt = "\\u20d0-\\u20ff", st = _t + ht + xt, bt = "\\u2700-\\u27bf", ut = "a-z\\xdf-\\xf6\\xf8-\\xff", ot = "\\xac\\xb1\\xd7\\xf7", Se = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Ae = "\\u2000-\\u206f", Ve = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Fe = "A-Z\\xc0-\\xd6\\xd8-\\xde", Ue = "\\ufe0e\\ufe0f", Je = ot + Se + Ae + Ve, Lt = "['’]", zt = "[" + At + "]", Zt = "[" + Je + "]", Wt = "[" + st + "]", he = "\\d+", rr = "[" + bt + "]", dr = "[" + ut + "]", pr = "[^" + At + Je + he + bt + ut + Fe + "]", Qt = "\\ud83c[\\udffb-\\udfff]", gr = "(?:" + Wt + "|" + Qt + ")", lr = "[^" + At + "]", Rr = "(?:\\ud83c[\\udde6-\\uddff]){2}", mr = "[\\ud800-\\udbff][\\udc00-\\udfff]", yr = "[" + Fe + "]", $r = "\\u200d", Br = "(?:" + dr + "|" + pr + ")", Ir = "(?:" + yr + "|" + pr + ")", nn = "(?:" + Lt + "(?:d|ll|m|re|s|t|ve))?", sn = "(?:" + Lt + "(?:D|LL|M|RE|S|T|VE))?", on = gr + "?", lh = "[" + Ue + "]?", Rp = "(?:" + $r + "(?:" + [lr, Rr, mr].join("|") + ")" + lh + on + ")*", oo = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", hh = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", dh = lh + on + Rp, Mc = "(?:" + [rr, Rr, mr].join("|") + ")" + dh, Dp = "(?:" + [lr + Wt + "?", Wt, Rr, mr, zt].join("|") + ")", Xu = RegExp(Lt, "g"), Op = RegExp(Wt, "g"), Ic = RegExp(Qt + "(?=" + Qt + ")|" + Dp + dh, "g"), ph = RegExp([ + yr + "?" + dr + "+" + nn + "(?=" + [Zt, yr, "$"].join("|") + ")", + Ir + "+" + sn + "(?=" + [Zt, yr + Br, "$"].join("|") + ")", + yr + "?" + Br + "+" + nn, yr + "+" + sn, - lh, - no, - le, - Pc - ].join("|"), "g"), ph = RegExp("[" + $r + At + st + je + "]"), Ra = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, gh = [ + hh, + oo, + he, + Mc + ].join("|"), "g"), gh = RegExp("[" + $r + At + st + Ue + "]"), Na = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, mh = [ "Array", "Buffer", "DataView", @@ -21104,8 +21104,8 @@ l0.exports; "isFinite", "parseInt", "setTimeout" - ], Np = -1, Br = {}; - Br[at] = Br[ke] = Br[Qe] = Br[tt] = Br[Ye] = Br[dt] = Br[lt] = Br[ct] = Br[qt] = !0, Br[D] = Br[oe] = Br[_e] = Br[J] = Br[Ze] = Br[Q] = Br[X] = Br[re] = Br[ie] = Br[ue] = Br[Pe] = Br[$e] = Br[Me] = Br[Ne] = Br[qe] = !1; + ], Np = -1, Fr = {}; + Fr[at] = Fr[ke] = Fr[Qe] = Fr[tt] = Fr[Ye] = Fr[dt] = Fr[lt] = Fr[ct] = Fr[qt] = !0, Fr[D] = Fr[oe] = Fr[_e] = Fr[J] = Fr[Ze] = Fr[Q] = Fr[X] = Fr[re] = Fr[ie] = Fr[ue] = Fr[Pe] = Fr[$e] = Fr[Me] = Fr[Ne] = Fr[qe] = !1; var Dr = {}; Dr[D] = Dr[oe] = Dr[_e] = Dr[Ze] = Dr[J] = Dr[Q] = Dr[at] = Dr[ke] = Dr[Qe] = Dr[tt] = Dr[Ye] = Dr[ie] = Dr[ue] = Dr[Pe] = Dr[$e] = Dr[Me] = Dr[Ne] = Dr[Ke] = Dr[dt] = Dr[lt] = Dr[ct] = Dr[qt] = !0, Dr[X] = Dr[re] = Dr[qe] = !1; var ae = { @@ -21320,321 +21320,321 @@ l0.exports; "\r": "r", "\u2028": "u2028", "\u2029": "u2029" - }, Ur = parseFloat, rr = parseInt, Kr = typeof gn == "object" && gn && gn.Object === Object && gn, vn = typeof self == "object" && self && self.Object === Object && self, _r = Kr || vn || Function("return this")(), jr = e && !e.nodeType && e, an = jr && !0 && t && !t.nodeType && t, ci = an && an.exports === jr, bn = ci && Kr.process, Vr = function() { + }, jr = parseFloat, nr = parseInt, Kr = typeof gn == "object" && gn && gn.Object === Object && gn, vn = typeof self == "object" && self && self.Object === Object && self, _r = Kr || vn || Function("return this")(), Ur = e && !e.nodeType && e, an = Ur && !0 && t && !t.nodeType && t, ui = an && an.exports === Ur, bn = ui && Kr.process, Vr = function() { try { var be = an && an.require && an.require("util").types; return be || bn && bn.binding && bn.binding("util"); } catch { } - }(), ei = Vr && Vr.isArrayBuffer, us = Vr && Vr.isDate, Bi = Vr && Vr.isMap, Ms = Vr && Vr.isRegExp, Xu = Vr && Vr.isSet, Da = Vr && Vr.isTypedArray; - function Pn(be, Fe, Ie) { + }(), ei = Vr && Vr.isArrayBuffer, fs = Vr && Vr.isDate, ji = Vr && Vr.isMap, Is = Vr && Vr.isRegExp, Zu = Vr && Vr.isSet, La = Vr && Vr.isTypedArray; + function Pn(be, Be, Ie) { switch (Ie.length) { case 0: - return be.call(Fe); + return be.call(Be); case 1: - return be.call(Fe, Ie[0]); + return be.call(Be, Ie[0]); case 2: - return be.call(Fe, Ie[0], Ie[1]); + return be.call(Be, Ie[0], Ie[1]); case 3: - return be.call(Fe, Ie[0], Ie[1], Ie[2]); + return be.call(Be, Ie[0], Ie[1], Ie[2]); } - return be.apply(Fe, Ie); + return be.apply(Be, Ie); } - function K9(be, Fe, Ie, It) { - for (var er = -1, Pr = be == null ? 0 : be.length; ++er < Pr; ) { - var xn = be[er]; - Fe(It, xn, Ie(xn), be); + function rA(be, Be, Ie, It) { + for (var tr = -1, Pr = be == null ? 0 : be.length; ++tr < Pr; ) { + var xn = be[tr]; + Be(It, xn, Ie(xn), be); } return It; } - function Ui(be, Fe) { - for (var Ie = -1, It = be == null ? 0 : be.length; ++Ie < It && Fe(be[Ie], Ie, be) !== !1; ) + function Ui(be, Be) { + for (var Ie = -1, It = be == null ? 0 : be.length; ++Ie < It && Be(be[Ie], Ie, be) !== !1; ) ; return be; } - function V9(be, Fe) { - for (var Ie = be == null ? 0 : be.length; Ie-- && Fe(be[Ie], Ie, be) !== !1; ) + function nA(be, Be) { + for (var Ie = be == null ? 0 : be.length; Ie-- && Be(be[Ie], Ie, be) !== !1; ) ; return be; } - function py(be, Fe) { + function my(be, Be) { for (var Ie = -1, It = be == null ? 0 : be.length; ++Ie < It; ) - if (!Fe(be[Ie], Ie, be)) + if (!Be(be[Ie], Ie, be)) return !1; return !0; } - function zo(be, Fe) { - for (var Ie = -1, It = be == null ? 0 : be.length, er = 0, Pr = []; ++Ie < It; ) { + function Ko(be, Be) { + for (var Ie = -1, It = be == null ? 0 : be.length, tr = 0, Pr = []; ++Ie < It; ) { var xn = be[Ie]; - Fe(xn, Ie, be) && (Pr[er++] = xn); + Be(xn, Ie, be) && (Pr[tr++] = xn); } return Pr; } - function mh(be, Fe) { + function vh(be, Be) { var Ie = be == null ? 0 : be.length; - return !!Ie && Ic(be, Fe, 0) > -1; + return !!Ie && Cc(be, Be, 0) > -1; } - function Lp(be, Fe, Ie) { - for (var It = -1, er = be == null ? 0 : be.length; ++It < er; ) - if (Ie(Fe, be[It])) + function Lp(be, Be, Ie) { + for (var It = -1, tr = be == null ? 0 : be.length; ++It < tr; ) + if (Ie(Be, be[It])) return !0; return !1; } - function Xr(be, Fe) { - for (var Ie = -1, It = be == null ? 0 : be.length, er = Array(It); ++Ie < It; ) - er[Ie] = Fe(be[Ie], Ie, be); - return er; + function Xr(be, Be) { + for (var Ie = -1, It = be == null ? 0 : be.length, tr = Array(It); ++Ie < It; ) + tr[Ie] = Be(be[Ie], Ie, be); + return tr; } - function Ho(be, Fe) { - for (var Ie = -1, It = Fe.length, er = be.length; ++Ie < It; ) - be[er + Ie] = Fe[Ie]; + function Vo(be, Be) { + for (var Ie = -1, It = Be.length, tr = be.length; ++Ie < It; ) + be[tr + Ie] = Be[Ie]; return be; } - function kp(be, Fe, Ie, It) { - var er = -1, Pr = be == null ? 0 : be.length; - for (It && Pr && (Ie = be[++er]); ++er < Pr; ) - Ie = Fe(Ie, be[er], er, be); + function kp(be, Be, Ie, It) { + var tr = -1, Pr = be == null ? 0 : be.length; + for (It && Pr && (Ie = be[++tr]); ++tr < Pr; ) + Ie = Be(Ie, be[tr], tr, be); return Ie; } - function G9(be, Fe, Ie, It) { - var er = be == null ? 0 : be.length; - for (It && er && (Ie = be[--er]); er--; ) - Ie = Fe(Ie, be[er], er, be); + function iA(be, Be, Ie, It) { + var tr = be == null ? 0 : be.length; + for (It && tr && (Ie = be[--tr]); tr--; ) + Ie = Be(Ie, be[tr], tr, be); return Ie; } - function $p(be, Fe) { + function $p(be, Be) { for (var Ie = -1, It = be == null ? 0 : be.length; ++Ie < It; ) - if (Fe(be[Ie], Ie, be)) + if (Be(be[Ie], Ie, be)) return !0; return !1; } - var Y9 = Fp("length"); - function J9(be) { + var sA = Bp("length"); + function oA(be) { return be.split(""); } - function X9(be) { - return be.match(U) || []; + function aA(be) { + return be.match(j) || []; } - function gy(be, Fe, Ie) { + function vy(be, Be, Ie) { var It; - return Ie(be, function(er, Pr, xn) { - if (Fe(er, Pr, xn)) + return Ie(be, function(tr, Pr, xn) { + if (Be(tr, Pr, xn)) return It = Pr, !1; }), It; } - function vh(be, Fe, Ie, It) { - for (var er = be.length, Pr = Ie + (It ? 1 : -1); It ? Pr-- : ++Pr < er; ) - if (Fe(be[Pr], Pr, be)) + function bh(be, Be, Ie, It) { + for (var tr = be.length, Pr = Ie + (It ? 1 : -1); It ? Pr-- : ++Pr < tr; ) + if (Be(be[Pr], Pr, be)) return Pr; return -1; } - function Ic(be, Fe, Ie) { - return Fe === Fe ? uA(be, Fe, Ie) : vh(be, my, Ie); + function Cc(be, Be, Ie) { + return Be === Be ? yA(be, Be, Ie) : bh(be, by, Ie); } - function Z9(be, Fe, Ie, It) { - for (var er = Ie - 1, Pr = be.length; ++er < Pr; ) - if (It(be[er], Fe)) - return er; + function cA(be, Be, Ie, It) { + for (var tr = Ie - 1, Pr = be.length; ++tr < Pr; ) + if (It(be[tr], Be)) + return tr; return -1; } - function my(be) { + function by(be) { return be !== be; } - function vy(be, Fe) { + function yy(be, Be) { var Ie = be == null ? 0 : be.length; - return Ie ? Up(be, Fe) / Ie : v; + return Ie ? jp(be, Be) / Ie : v; } - function Fp(be) { - return function(Fe) { - return Fe == null ? r : Fe[be]; + function Bp(be) { + return function(Be) { + return Be == null ? r : Be[be]; }; } - function Bp(be) { - return function(Fe) { - return be == null ? r : be[Fe]; + function Fp(be) { + return function(Be) { + return be == null ? r : be[Be]; }; } - function by(be, Fe, Ie, It, er) { - return er(be, function(Pr, xn, qr) { - Ie = It ? (It = !1, Pr) : Fe(Ie, Pr, xn, qr); + function wy(be, Be, Ie, It, tr) { + return tr(be, function(Pr, xn, qr) { + Ie = It ? (It = !1, Pr) : Be(Ie, Pr, xn, qr); }), Ie; } - function Q9(be, Fe) { + function uA(be, Be) { var Ie = be.length; - for (be.sort(Fe); Ie--; ) + for (be.sort(Be); Ie--; ) be[Ie] = be[Ie].value; return be; } - function Up(be, Fe) { - for (var Ie, It = -1, er = be.length; ++It < er; ) { - var Pr = Fe(be[It]); + function jp(be, Be) { + for (var Ie, It = -1, tr = be.length; ++It < tr; ) { + var Pr = Be(be[It]); Pr !== r && (Ie = Ie === r ? Pr : Ie + Pr); } return Ie; } - function jp(be, Fe) { + function Up(be, Be) { for (var Ie = -1, It = Array(be); ++Ie < be; ) - It[Ie] = Fe(Ie); + It[Ie] = Be(Ie); return It; } - function eA(be, Fe) { - return Xr(Fe, function(Ie) { + function fA(be, Be) { + return Xr(Be, function(Ie) { return [Ie, be[Ie]]; }); } - function yy(be) { - return be && be.slice(0, Ey(be) + 1).replace(k, ""); + function xy(be) { + return be && be.slice(0, Ay(be) + 1).replace(k, ""); } function Ai(be) { - return function(Fe) { - return be(Fe); + return function(Be) { + return be(Be); }; } - function qp(be, Fe) { - return Xr(Fe, function(Ie) { + function qp(be, Be) { + return Xr(Be, function(Ie) { return be[Ie]; }); } - function Zu(be, Fe) { - return be.has(Fe); + function Qu(be, Be) { + return be.has(Be); } - function wy(be, Fe) { - for (var Ie = -1, It = be.length; ++Ie < It && Ic(Fe, be[Ie], 0) > -1; ) + function _y(be, Be) { + for (var Ie = -1, It = be.length; ++Ie < It && Cc(Be, be[Ie], 0) > -1; ) ; return Ie; } - function xy(be, Fe) { - for (var Ie = be.length; Ie-- && Ic(Fe, be[Ie], 0) > -1; ) + function Ey(be, Be) { + for (var Ie = be.length; Ie-- && Cc(Be, be[Ie], 0) > -1; ) ; return Ie; } - function tA(be, Fe) { + function lA(be, Be) { for (var Ie = be.length, It = 0; Ie--; ) - be[Ie] === Fe && ++It; + be[Ie] === Be && ++It; return It; } - var rA = Bp(ae), nA = Bp(ye); - function iA(be) { + var hA = Fp(ae), dA = Fp(ye); + function pA(be) { return "\\" + Pt[be]; } - function sA(be, Fe) { - return be == null ? r : be[Fe]; + function gA(be, Be) { + return be == null ? r : be[Be]; } - function Cc(be) { - return ph.test(be); + function Tc(be) { + return gh.test(be); } - function oA(be) { - return Ra.test(be); + function mA(be) { + return Na.test(be); } - function aA(be) { - for (var Fe, Ie = []; !(Fe = be.next()).done; ) - Ie.push(Fe.value); + function vA(be) { + for (var Be, Ie = []; !(Be = be.next()).done; ) + Ie.push(Be.value); return Ie; } function zp(be) { - var Fe = -1, Ie = Array(be.size); - return be.forEach(function(It, er) { - Ie[++Fe] = [er, It]; + var Be = -1, Ie = Array(be.size); + return be.forEach(function(It, tr) { + Ie[++Be] = [tr, It]; }), Ie; } - function _y(be, Fe) { + function Sy(be, Be) { return function(Ie) { - return be(Fe(Ie)); + return be(Be(Ie)); }; } - function Wo(be, Fe) { - for (var Ie = -1, It = be.length, er = 0, Pr = []; ++Ie < It; ) { + function Go(be, Be) { + for (var Ie = -1, It = be.length, tr = 0, Pr = []; ++Ie < It; ) { var xn = be[Ie]; - (xn === Fe || xn === d) && (be[Ie] = d, Pr[er++] = Ie); + (xn === Be || xn === d) && (be[Ie] = d, Pr[tr++] = Ie); } return Pr; } - function bh(be) { - var Fe = -1, Ie = Array(be.size); + function yh(be) { + var Be = -1, Ie = Array(be.size); return be.forEach(function(It) { - Ie[++Fe] = It; + Ie[++Be] = It; }), Ie; } - function cA(be) { - var Fe = -1, Ie = Array(be.size); + function bA(be) { + var Be = -1, Ie = Array(be.size); return be.forEach(function(It) { - Ie[++Fe] = [It, It]; + Ie[++Be] = [It, It]; }), Ie; } - function uA(be, Fe, Ie) { - for (var It = Ie - 1, er = be.length; ++It < er; ) - if (be[It] === Fe) + function yA(be, Be, Ie) { + for (var It = Ie - 1, tr = be.length; ++It < tr; ) + if (be[It] === Be) return It; return -1; } - function fA(be, Fe, Ie) { + function wA(be, Be, Ie) { for (var It = Ie + 1; It--; ) - if (be[It] === Fe) + if (be[It] === Be) return It; return It; } - function Tc(be) { - return Cc(be) ? hA(be) : Y9(be); + function Rc(be) { + return Tc(be) ? _A(be) : sA(be); } - function fs(be) { - return Cc(be) ? dA(be) : J9(be); + function ls(be) { + return Tc(be) ? EA(be) : oA(be); } - function Ey(be) { - for (var Fe = be.length; Fe-- && j.test(be.charAt(Fe)); ) + function Ay(be) { + for (var Be = be.length; Be-- && U.test(be.charAt(Be)); ) ; - return Fe; + return Be; } - var lA = Bp(Ge); - function hA(be) { - for (var Fe = Mc.lastIndex = 0; Mc.test(be); ) - ++Fe; - return Fe; + var xA = Fp(Ge); + function _A(be) { + for (var Be = Ic.lastIndex = 0; Ic.test(be); ) + ++Be; + return Be; } - function dA(be) { - return be.match(Mc) || []; + function EA(be) { + return be.match(Ic) || []; } - function pA(be) { - return be.match(dh) || []; + function SA(be) { + return be.match(ph) || []; } - var gA = function be(Fe) { - Fe = Fe == null ? _r : Rc.defaults(_r.Object(), Fe, Rc.pick(_r, gh)); - var Ie = Fe.Array, It = Fe.Date, er = Fe.Error, Pr = Fe.Function, xn = Fe.Math, qr = Fe.Object, Hp = Fe.RegExp, mA = Fe.String, ji = Fe.TypeError, yh = Ie.prototype, vA = Pr.prototype, Dc = qr.prototype, wh = Fe["__core-js_shared__"], xh = vA.toString, Tr = Dc.hasOwnProperty, bA = 0, Sy = function() { - var c = /[^.]+$/.exec(wh && wh.keys && wh.keys.IE_PROTO || ""); + var AA = function be(Be) { + Be = Be == null ? _r : Dc.defaults(_r.Object(), Be, Dc.pick(_r, mh)); + var Ie = Be.Array, It = Be.Date, tr = Be.Error, Pr = Be.Function, xn = Be.Math, qr = Be.Object, Wp = Be.RegExp, PA = Be.String, qi = Be.TypeError, wh = Ie.prototype, MA = Pr.prototype, Oc = qr.prototype, xh = Be["__core-js_shared__"], _h = MA.toString, Tr = Oc.hasOwnProperty, IA = 0, Py = function() { + var c = /[^.]+$/.exec(xh && xh.keys && xh.keys.IE_PROTO || ""); return c ? "Symbol(src)_1." + c : ""; - }(), _h = Dc.toString, yA = xh.call(qr), wA = _r._, xA = Hp( - "^" + xh.call(Tr).replace(rt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" - ), Eh = ci ? Fe.Buffer : r, Ko = Fe.Symbol, Sh = Fe.Uint8Array, Ay = Eh ? Eh.allocUnsafe : r, Ah = _y(qr.getPrototypeOf, qr), Py = qr.create, My = Dc.propertyIsEnumerable, Ph = yh.splice, Iy = Ko ? Ko.isConcatSpreadable : r, Qu = Ko ? Ko.iterator : r, Oa = Ko ? Ko.toStringTag : r, Mh = function() { + }(), Eh = Oc.toString, CA = _h.call(qr), TA = _r._, RA = Wp( + "^" + _h.call(Tr).replace(rt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" + ), Sh = ui ? Be.Buffer : r, Yo = Be.Symbol, Ah = Be.Uint8Array, My = Sh ? Sh.allocUnsafe : r, Ph = Sy(qr.getPrototypeOf, qr), Iy = qr.create, Cy = Oc.propertyIsEnumerable, Mh = wh.splice, Ty = Yo ? Yo.isConcatSpreadable : r, ef = Yo ? Yo.iterator : r, ka = Yo ? Yo.toStringTag : r, Ih = function() { try { - var c = Fa(qr, "defineProperty"); + var c = Ua(qr, "defineProperty"); return c({}, "", {}), c; } catch { } - }(), _A = Fe.clearTimeout !== _r.clearTimeout && Fe.clearTimeout, EA = It && It.now !== _r.Date.now && It.now, SA = Fe.setTimeout !== _r.setTimeout && Fe.setTimeout, Ih = xn.ceil, Ch = xn.floor, Wp = qr.getOwnPropertySymbols, AA = Eh ? Eh.isBuffer : r, Cy = Fe.isFinite, PA = yh.join, MA = _y(qr.keys, qr), _n = xn.max, Wn = xn.min, IA = It.now, CA = Fe.parseInt, Ty = xn.random, TA = yh.reverse, Kp = Fa(Fe, "DataView"), ef = Fa(Fe, "Map"), Vp = Fa(Fe, "Promise"), Oc = Fa(Fe, "Set"), tf = Fa(Fe, "WeakMap"), rf = Fa(qr, "create"), Th = tf && new tf(), Nc = {}, RA = Ba(Kp), DA = Ba(ef), OA = Ba(Vp), NA = Ba(Oc), LA = Ba(tf), Rh = Ko ? Ko.prototype : r, nf = Rh ? Rh.valueOf : r, Ry = Rh ? Rh.toString : r; + }(), DA = Be.clearTimeout !== _r.clearTimeout && Be.clearTimeout, OA = It && It.now !== _r.Date.now && It.now, NA = Be.setTimeout !== _r.setTimeout && Be.setTimeout, Ch = xn.ceil, Th = xn.floor, Hp = qr.getOwnPropertySymbols, LA = Sh ? Sh.isBuffer : r, Ry = Be.isFinite, kA = wh.join, $A = Sy(qr.keys, qr), _n = xn.max, Kn = xn.min, BA = It.now, FA = Be.parseInt, Dy = xn.random, jA = wh.reverse, Kp = Ua(Be, "DataView"), tf = Ua(Be, "Map"), Vp = Ua(Be, "Promise"), Nc = Ua(Be, "Set"), rf = Ua(Be, "WeakMap"), nf = Ua(qr, "create"), Rh = rf && new rf(), Lc = {}, UA = qa(Kp), qA = qa(tf), zA = qa(Vp), WA = qa(Nc), HA = qa(rf), Dh = Yo ? Yo.prototype : r, sf = Dh ? Dh.valueOf : r, Oy = Dh ? Dh.toString : r; function ee(c) { - if (en(c) && !nr(c) && !(c instanceof wr)) { - if (c instanceof qi) + if (en(c) && !ir(c) && !(c instanceof wr)) { + if (c instanceof zi) return c; if (Tr.call(c, "__wrapped__")) - return Dw(c); + return Nw(c); } - return new qi(c); + return new zi(c); } - var Lc = /* @__PURE__ */ function() { + var kc = /* @__PURE__ */ function() { function c() { } return function(h) { if (!Zr(h)) return {}; - if (Py) - return Py(h); + if (Iy) + return Iy(h); c.prototype = h; var y = new c(); return c.prototype = r, y; }; }(); - function Dh() { + function Oh() { } - function qi(c, h) { + function zi(c, h) { this.__wrapped__ = c, this.__actions__ = [], this.__chain__ = !!h, this.__index__ = 0, this.__values__ = r; } ee.templateSettings = { @@ -21681,15 +21681,15 @@ l0.exports; */ _: ee } - }, ee.prototype = Dh.prototype, ee.prototype.constructor = ee, qi.prototype = Lc(Dh.prototype), qi.prototype.constructor = qi; + }, ee.prototype = Oh.prototype, ee.prototype.constructor = ee, zi.prototype = kc(Oh.prototype), zi.prototype.constructor = zi; function wr(c) { - this.__wrapped__ = c, this.__actions__ = [], this.__dir__ = 1, this.__filtered__ = !1, this.__iteratees__ = [], this.__takeCount__ = P, this.__views__ = []; + this.__wrapped__ = c, this.__actions__ = [], this.__dir__ = 1, this.__filtered__ = !1, this.__iteratees__ = [], this.__takeCount__ = M, this.__views__ = []; } - function kA() { + function KA() { var c = new wr(this.__wrapped__); - return c.__actions__ = ui(this.__actions__), c.__dir__ = this.__dir__, c.__filtered__ = this.__filtered__, c.__iteratees__ = ui(this.__iteratees__), c.__takeCount__ = this.__takeCount__, c.__views__ = ui(this.__views__), c; + return c.__actions__ = fi(this.__actions__), c.__dir__ = this.__dir__, c.__filtered__ = this.__filtered__, c.__iteratees__ = fi(this.__iteratees__), c.__takeCount__ = this.__takeCount__, c.__views__ = fi(this.__views__), c; } - function $A() { + function VA() { if (this.__filtered__) { var c = new wr(this); c.__dir__ = -1, c.__filtered__ = !0; @@ -21697,17 +21697,17 @@ l0.exports; c = this.clone(), c.__dir__ *= -1; return c; } - function FA() { - var c = this.__wrapped__.value(), h = this.__dir__, y = nr(c), O = h < 0, q = y ? c.length : 0, ne = JP(0, q, this.__views__), fe = ne.start, ge = ne.end, we = ge - fe, He = O ? ge : fe - 1, We = this.__iteratees__, Xe = We.length, wt = 0, Ot = Wn(we, this.__takeCount__); + function GA() { + var c = this.__wrapped__.value(), h = this.__dir__, y = ir(c), O = h < 0, q = y ? c.length : 0, ne = oM(0, q, this.__views__), le = ne.start, me = ne.end, we = me - le, We = O ? me : le - 1, He = this.__iteratees__, Xe = He.length, wt = 0, Ot = Kn(we, this.__takeCount__); if (!y || !O && q == we && Ot == we) - return tw(c, this.__actions__); - var Wt = []; + return nw(c, this.__actions__); + var Ht = []; e: for (; we-- && wt < Ot; ) { - He += h; - for (var ur = -1, Kt = c[He]; ++ur < Xe; ) { - var vr = We[ur], Er = vr.iteratee, Ii = vr.type, ni = Er(Kt); - if (Ii == p) + We += h; + for (var fr = -1, Kt = c[We]; ++fr < Xe; ) { + var vr = He[fr], Er = vr.iteratee, Ii = vr.type, ni = Er(Kt); + if (Ii == g) Kt = ni; else if (!ni) { if (Ii == f) @@ -21715,186 +21715,186 @@ l0.exports; break e; } } - Wt[wt++] = Kt; + Ht[wt++] = Kt; } - return Wt; + return Ht; } - wr.prototype = Lc(Dh.prototype), wr.prototype.constructor = wr; - function Na(c) { + wr.prototype = kc(Oh.prototype), wr.prototype.constructor = wr; + function $a(c) { var h = -1, y = c == null ? 0 : c.length; for (this.clear(); ++h < y; ) { var O = c[h]; this.set(O[0], O[1]); } } - function BA() { - this.__data__ = rf ? rf(null) : {}, this.size = 0; + function YA() { + this.__data__ = nf ? nf(null) : {}, this.size = 0; } - function UA(c) { + function JA(c) { var h = this.has(c) && delete this.__data__[c]; return this.size -= h ? 1 : 0, h; } - function jA(c) { + function XA(c) { var h = this.__data__; - if (rf) { + if (nf) { var y = h[c]; return y === u ? r : y; } return Tr.call(h, c) ? h[c] : r; } - function qA(c) { + function ZA(c) { var h = this.__data__; - return rf ? h[c] !== r : Tr.call(h, c); + return nf ? h[c] !== r : Tr.call(h, c); } - function zA(c, h) { + function QA(c, h) { var y = this.__data__; - return this.size += this.has(c) ? 0 : 1, y[c] = rf && h === r ? u : h, this; + return this.size += this.has(c) ? 0 : 1, y[c] = nf && h === r ? u : h, this; } - Na.prototype.clear = BA, Na.prototype.delete = UA, Na.prototype.get = jA, Na.prototype.has = qA, Na.prototype.set = zA; - function io(c) { + $a.prototype.clear = YA, $a.prototype.delete = JA, $a.prototype.get = XA, $a.prototype.has = ZA, $a.prototype.set = QA; + function ao(c) { var h = -1, y = c == null ? 0 : c.length; for (this.clear(); ++h < y; ) { var O = c[h]; this.set(O[0], O[1]); } } - function HA() { + function eP() { this.__data__ = [], this.size = 0; } - function WA(c) { - var h = this.__data__, y = Oh(h, c); + function tP(c) { + var h = this.__data__, y = Nh(h, c); if (y < 0) return !1; var O = h.length - 1; - return y == O ? h.pop() : Ph.call(h, y, 1), --this.size, !0; + return y == O ? h.pop() : Mh.call(h, y, 1), --this.size, !0; } - function KA(c) { - var h = this.__data__, y = Oh(h, c); + function rP(c) { + var h = this.__data__, y = Nh(h, c); return y < 0 ? r : h[y][1]; } - function VA(c) { - return Oh(this.__data__, c) > -1; + function nP(c) { + return Nh(this.__data__, c) > -1; } - function GA(c, h) { - var y = this.__data__, O = Oh(y, c); + function iP(c, h) { + var y = this.__data__, O = Nh(y, c); return O < 0 ? (++this.size, y.push([c, h])) : y[O][1] = h, this; } - io.prototype.clear = HA, io.prototype.delete = WA, io.prototype.get = KA, io.prototype.has = VA, io.prototype.set = GA; - function so(c) { + ao.prototype.clear = eP, ao.prototype.delete = tP, ao.prototype.get = rP, ao.prototype.has = nP, ao.prototype.set = iP; + function co(c) { var h = -1, y = c == null ? 0 : c.length; for (this.clear(); ++h < y; ) { var O = c[h]; this.set(O[0], O[1]); } } - function YA() { + function sP() { this.size = 0, this.__data__ = { - hash: new Na(), - map: new (ef || io)(), - string: new Na() + hash: new $a(), + map: new (tf || ao)(), + string: new $a() }; } - function JA(c) { - var h = Wh(this, c).delete(c); + function oP(c) { + var h = Kh(this, c).delete(c); return this.size -= h ? 1 : 0, h; } - function XA(c) { - return Wh(this, c).get(c); + function aP(c) { + return Kh(this, c).get(c); } - function ZA(c) { - return Wh(this, c).has(c); + function cP(c) { + return Kh(this, c).has(c); } - function QA(c, h) { - var y = Wh(this, c), O = y.size; + function uP(c, h) { + var y = Kh(this, c), O = y.size; return y.set(c, h), this.size += y.size == O ? 0 : 1, this; } - so.prototype.clear = YA, so.prototype.delete = JA, so.prototype.get = XA, so.prototype.has = ZA, so.prototype.set = QA; - function La(c) { + co.prototype.clear = sP, co.prototype.delete = oP, co.prototype.get = aP, co.prototype.has = cP, co.prototype.set = uP; + function Ba(c) { var h = -1, y = c == null ? 0 : c.length; - for (this.__data__ = new so(); ++h < y; ) + for (this.__data__ = new co(); ++h < y; ) this.add(c[h]); } - function eP(c) { + function fP(c) { return this.__data__.set(c, u), this; } - function tP(c) { + function lP(c) { return this.__data__.has(c); } - La.prototype.add = La.prototype.push = eP, La.prototype.has = tP; - function ls(c) { - var h = this.__data__ = new io(c); + Ba.prototype.add = Ba.prototype.push = fP, Ba.prototype.has = lP; + function hs(c) { + var h = this.__data__ = new ao(c); this.size = h.size; } - function rP() { - this.__data__ = new io(), this.size = 0; + function hP() { + this.__data__ = new ao(), this.size = 0; } - function nP(c) { + function dP(c) { var h = this.__data__, y = h.delete(c); return this.size = h.size, y; } - function iP(c) { + function pP(c) { return this.__data__.get(c); } - function sP(c) { + function gP(c) { return this.__data__.has(c); } - function oP(c, h) { + function mP(c, h) { var y = this.__data__; - if (y instanceof io) { + if (y instanceof ao) { var O = y.__data__; - if (!ef || O.length < i - 1) + if (!tf || O.length < i - 1) return O.push([c, h]), this.size = ++y.size, this; - y = this.__data__ = new so(O); + y = this.__data__ = new co(O); } return y.set(c, h), this.size = y.size, this; } - ls.prototype.clear = rP, ls.prototype.delete = nP, ls.prototype.get = iP, ls.prototype.has = sP, ls.prototype.set = oP; - function Dy(c, h) { - var y = nr(c), O = !y && Ua(c), q = !y && !O && Xo(c), ne = !y && !O && !q && Bc(c), fe = y || O || q || ne, ge = fe ? jp(c.length, mA) : [], we = ge.length; - for (var He in c) - (h || Tr.call(c, He)) && !(fe && // Safari 9 has enumerable `arguments.length` in strict mode. - (He == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. - q && (He == "offset" || He == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. - ne && (He == "buffer" || He == "byteLength" || He == "byteOffset") || // Skip index properties. - uo(He, we))) && ge.push(He); - return ge; - } - function Oy(c) { + hs.prototype.clear = hP, hs.prototype.delete = dP, hs.prototype.get = pP, hs.prototype.has = gP, hs.prototype.set = mP; + function Ny(c, h) { + var y = ir(c), O = !y && za(c), q = !y && !O && ea(c), ne = !y && !O && !q && jc(c), le = y || O || q || ne, me = le ? Up(c.length, PA) : [], we = me.length; + for (var We in c) + (h || Tr.call(c, We)) && !(le && // Safari 9 has enumerable `arguments.length` in strict mode. + (We == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. + q && (We == "offset" || We == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. + ne && (We == "buffer" || We == "byteLength" || We == "byteOffset") || // Skip index properties. + ho(We, we))) && me.push(We); + return me; + } + function Ly(c) { var h = c.length; return h ? c[ig(0, h - 1)] : r; } - function aP(c, h) { - return Kh(ui(c), ka(h, 0, c.length)); + function vP(c, h) { + return Vh(fi(c), Fa(h, 0, c.length)); } - function cP(c) { - return Kh(ui(c)); + function bP(c) { + return Vh(fi(c)); } function Gp(c, h, y) { - (y !== r && !hs(c[h], y) || y === r && !(h in c)) && oo(c, h, y); + (y !== r && !ds(c[h], y) || y === r && !(h in c)) && uo(c, h, y); } - function sf(c, h, y) { + function of(c, h, y) { var O = c[h]; - (!(Tr.call(c, h) && hs(O, y)) || y === r && !(h in c)) && oo(c, h, y); + (!(Tr.call(c, h) && ds(O, y)) || y === r && !(h in c)) && uo(c, h, y); } - function Oh(c, h) { + function Nh(c, h) { for (var y = c.length; y--; ) - if (hs(c[y][0], h)) + if (ds(c[y][0], h)) return y; return -1; } - function uP(c, h, y, O) { - return Vo(c, function(q, ne, fe) { - h(O, q, y(q), fe); + function yP(c, h, y, O) { + return Jo(c, function(q, ne, le) { + h(O, q, y(q), le); }), O; } - function Ny(c, h) { - return c && Cs(h, Mn(h), c); + function ky(c, h) { + return c && Ts(h, Mn(h), c); } - function fP(c, h) { - return c && Cs(h, li(h), c); + function wP(c, h) { + return c && Ts(h, hi(h), c); } - function oo(c, h, y) { - h == "__proto__" && Mh ? Mh(c, h, { + function uo(c, h, y) { + h == "__proto__" && Ih ? Ih(c, h, { configurable: !0, enumerable: !0, value: y, @@ -21906,280 +21906,280 @@ l0.exports; q[y] = ne ? r : Cg(c, h[y]); return q; } - function ka(c, h, y) { + function Fa(c, h, y) { return c === c && (y !== r && (c = c <= y ? c : y), h !== r && (c = c >= h ? c : h)), c; } - function zi(c, h, y, O, q, ne) { - var fe, ge = h & g, we = h & w, He = h & A; - if (y && (fe = q ? y(c, O, q, ne) : y(c)), fe !== r) - return fe; + function Wi(c, h, y, O, q, ne) { + var le, me = h & p, we = h & w, We = h & A; + if (y && (le = q ? y(c, O, q, ne) : y(c)), le !== r) + return le; if (!Zr(c)) return c; - var We = nr(c); - if (We) { - if (fe = ZP(c), !ge) - return ui(c, fe); + var He = ir(c); + if (He) { + if (le = cM(c), !me) + return fi(c, le); } else { - var Xe = Kn(c), wt = Xe == re || Xe == de; - if (Xo(c)) - return iw(c, ge); + var Xe = Vn(c), wt = Xe == re || Xe == pe; + if (ea(c)) + return ow(c, me); if (Xe == Pe || Xe == D || wt && !q) { - if (fe = we || wt ? {} : Ew(c), !ge) - return we ? jP(c, fP(fe, c)) : UP(c, Ny(fe, c)); + if (le = we || wt ? {} : Aw(c), !me) + return we ? XP(c, wP(le, c)) : JP(c, ky(le, c)); } else { if (!Dr[Xe]) return q ? c : {}; - fe = QP(c, Xe, ge); + le = uM(c, Xe, me); } } - ne || (ne = new ls()); + ne || (ne = new hs()); var Ot = ne.get(c); if (Ot) return Ot; - ne.set(c, fe), Zw(c) ? c.forEach(function(Kt) { - fe.add(zi(Kt, h, y, Kt, c, ne)); - }) : Jw(c) && c.forEach(function(Kt, vr) { - fe.set(vr, zi(Kt, h, y, vr, c, ne)); + ne.set(c, le), e2(c) ? c.forEach(function(Kt) { + le.add(Wi(Kt, h, y, Kt, c, ne)); + }) : Zw(c) && c.forEach(function(Kt, vr) { + le.set(vr, Wi(Kt, h, y, vr, c, ne)); }); - var Wt = He ? we ? gg : pg : we ? li : Mn, ur = We ? r : Wt(c); - return Ui(ur || c, function(Kt, vr) { - ur && (vr = Kt, Kt = c[vr]), sf(fe, vr, zi(Kt, h, y, vr, c, ne)); - }), fe; + var Ht = We ? we ? gg : pg : we ? hi : Mn, fr = He ? r : Ht(c); + return Ui(fr || c, function(Kt, vr) { + fr && (vr = Kt, Kt = c[vr]), of(le, vr, Wi(Kt, h, y, vr, c, ne)); + }), le; } - function lP(c) { + function xP(c) { var h = Mn(c); return function(y) { - return Ly(y, c, h); + return $y(y, c, h); }; } - function Ly(c, h, y) { + function $y(c, h, y) { var O = y.length; if (c == null) return !O; for (c = qr(c); O--; ) { - var q = y[O], ne = h[q], fe = c[q]; - if (fe === r && !(q in c) || !ne(fe)) + var q = y[O], ne = h[q], le = c[q]; + if (le === r && !(q in c) || !ne(le)) return !1; } return !0; } - function ky(c, h, y) { + function By(c, h, y) { if (typeof c != "function") - throw new ji(o); - return hf(function() { + throw new qi(o); + return df(function() { c.apply(r, y); }, h); } - function of(c, h, y, O) { - var q = -1, ne = mh, fe = !0, ge = c.length, we = [], He = h.length; - if (!ge) + function af(c, h, y, O) { + var q = -1, ne = vh, le = !0, me = c.length, we = [], We = h.length; + if (!me) return we; - y && (h = Xr(h, Ai(y))), O ? (ne = Lp, fe = !1) : h.length >= i && (ne = Zu, fe = !1, h = new La(h)); + y && (h = Xr(h, Ai(y))), O ? (ne = Lp, le = !1) : h.length >= i && (ne = Qu, le = !1, h = new Ba(h)); e: - for (; ++q < ge; ) { - var We = c[q], Xe = y == null ? We : y(We); - if (We = O || We !== 0 ? We : 0, fe && Xe === Xe) { - for (var wt = He; wt--; ) + for (; ++q < me; ) { + var He = c[q], Xe = y == null ? He : y(He); + if (He = O || He !== 0 ? He : 0, le && Xe === Xe) { + for (var wt = We; wt--; ) if (h[wt] === Xe) continue e; - we.push(We); - } else ne(h, Xe, O) || we.push(We); + we.push(He); + } else ne(h, Xe, O) || we.push(He); } return we; } - var Vo = uw(Is), $y = uw(Xp, !0); - function hP(c, h) { + var Jo = lw(Cs), Fy = lw(Xp, !0); + function _P(c, h) { var y = !0; - return Vo(c, function(O, q, ne) { + return Jo(c, function(O, q, ne) { return y = !!h(O, q, ne), y; }), y; } - function Nh(c, h, y) { + function Lh(c, h, y) { for (var O = -1, q = c.length; ++O < q; ) { - var ne = c[O], fe = h(ne); - if (fe != null && (ge === r ? fe === fe && !Mi(fe) : y(fe, ge))) - var ge = fe, we = ne; + var ne = c[O], le = h(ne); + if (le != null && (me === r ? le === le && !Mi(le) : y(le, me))) + var me = le, we = ne; } return we; } - function dP(c, h, y, O) { + function EP(c, h, y, O) { var q = c.length; - for (y = ar(y), y < 0 && (y = -y > q ? 0 : q + y), O = O === r || O > q ? q : ar(O), O < 0 && (O += q), O = y > O ? 0 : e2(O); y < O; ) + for (y = cr(y), y < 0 && (y = -y > q ? 0 : q + y), O = O === r || O > q ? q : cr(O), O < 0 && (O += q), O = y > O ? 0 : r2(O); y < O; ) c[y++] = h; return c; } - function Fy(c, h) { + function jy(c, h) { var y = []; - return Vo(c, function(O, q, ne) { + return Jo(c, function(O, q, ne) { h(O, q, ne) && y.push(O); }), y; } - function $n(c, h, y, O, q) { - var ne = -1, fe = c.length; - for (y || (y = tM), q || (q = []); ++ne < fe; ) { - var ge = c[ne]; - h > 0 && y(ge) ? h > 1 ? $n(ge, h - 1, y, O, q) : Ho(q, ge) : O || (q[q.length] = ge); + function Bn(c, h, y, O, q) { + var ne = -1, le = c.length; + for (y || (y = lM), q || (q = []); ++ne < le; ) { + var me = c[ne]; + h > 0 && y(me) ? h > 1 ? Bn(me, h - 1, y, O, q) : Vo(q, me) : O || (q[q.length] = me); } return q; } - var Jp = fw(), By = fw(!0); - function Is(c, h) { + var Jp = hw(), Uy = hw(!0); + function Cs(c, h) { return c && Jp(c, h, Mn); } function Xp(c, h) { - return c && By(c, h, Mn); + return c && Uy(c, h, Mn); } - function Lh(c, h) { - return zo(h, function(y) { - return fo(c[y]); + function kh(c, h) { + return Ko(h, function(y) { + return po(c[y]); }); } - function $a(c, h) { - h = Yo(h, c); + function ja(c, h) { + h = Zo(h, c); for (var y = 0, O = h.length; c != null && y < O; ) - c = c[Ts(h[y++])]; + c = c[Rs(h[y++])]; return y && y == O ? c : r; } - function Uy(c, h, y) { + function qy(c, h, y) { var O = h(c); - return nr(c) ? O : Ho(O, y(c)); + return ir(c) ? O : Vo(O, y(c)); } function ti(c) { - return c == null ? c === r ? Le : ve : Oa && Oa in qr(c) ? YP(c) : cM(c); + return c == null ? c === r ? Le : ve : ka && ka in qr(c) ? sM(c) : bM(c); } function Zp(c, h) { return c > h; } - function pP(c, h) { + function SP(c, h) { return c != null && Tr.call(c, h); } - function gP(c, h) { + function AP(c, h) { return c != null && h in qr(c); } - function mP(c, h, y) { - return c >= Wn(h, y) && c < _n(h, y); + function PP(c, h, y) { + return c >= Kn(h, y) && c < _n(h, y); } function Qp(c, h, y) { - for (var O = y ? Lp : mh, q = c[0].length, ne = c.length, fe = ne, ge = Ie(ne), we = 1 / 0, He = []; fe--; ) { - var We = c[fe]; - fe && h && (We = Xr(We, Ai(h))), we = Wn(We.length, we), ge[fe] = !y && (h || q >= 120 && We.length >= 120) ? new La(fe && We) : r; + for (var O = y ? Lp : vh, q = c[0].length, ne = c.length, le = ne, me = Ie(ne), we = 1 / 0, We = []; le--; ) { + var He = c[le]; + le && h && (He = Xr(He, Ai(h))), we = Kn(He.length, we), me[le] = !y && (h || q >= 120 && He.length >= 120) ? new Ba(le && He) : r; } - We = c[0]; - var Xe = -1, wt = ge[0]; + He = c[0]; + var Xe = -1, wt = me[0]; e: - for (; ++Xe < q && He.length < we; ) { - var Ot = We[Xe], Wt = h ? h(Ot) : Ot; - if (Ot = y || Ot !== 0 ? Ot : 0, !(wt ? Zu(wt, Wt) : O(He, Wt, y))) { - for (fe = ne; --fe; ) { - var ur = ge[fe]; - if (!(ur ? Zu(ur, Wt) : O(c[fe], Wt, y))) + for (; ++Xe < q && We.length < we; ) { + var Ot = He[Xe], Ht = h ? h(Ot) : Ot; + if (Ot = y || Ot !== 0 ? Ot : 0, !(wt ? Qu(wt, Ht) : O(We, Ht, y))) { + for (le = ne; --le; ) { + var fr = me[le]; + if (!(fr ? Qu(fr, Ht) : O(c[le], Ht, y))) continue e; } - wt && wt.push(Wt), He.push(Ot); + wt && wt.push(Ht), We.push(Ot); } } - return He; + return We; } - function vP(c, h, y, O) { - return Is(c, function(q, ne, fe) { - h(O, y(q), ne, fe); + function MP(c, h, y, O) { + return Cs(c, function(q, ne, le) { + h(O, y(q), ne, le); }), O; } - function af(c, h, y) { - h = Yo(h, c), c = Mw(c, h); - var O = c == null ? c : c[Ts(Wi(h))]; + function cf(c, h, y) { + h = Zo(h, c), c = Cw(c, h); + var O = c == null ? c : c[Rs(Ki(h))]; return O == null ? r : Pn(O, c, y); } - function jy(c) { + function zy(c) { return en(c) && ti(c) == D; } - function bP(c) { + function IP(c) { return en(c) && ti(c) == _e; } - function yP(c) { + function CP(c) { return en(c) && ti(c) == Q; } - function cf(c, h, y, O, q) { - return c === h ? !0 : c == null || h == null || !en(c) && !en(h) ? c !== c && h !== h : wP(c, h, y, O, cf, q); + function uf(c, h, y, O, q) { + return c === h ? !0 : c == null || h == null || !en(c) && !en(h) ? c !== c && h !== h : TP(c, h, y, O, uf, q); } - function wP(c, h, y, O, q, ne) { - var fe = nr(c), ge = nr(h), we = fe ? oe : Kn(c), He = ge ? oe : Kn(h); - we = we == D ? Pe : we, He = He == D ? Pe : He; - var We = we == Pe, Xe = He == Pe, wt = we == He; - if (wt && Xo(c)) { - if (!Xo(h)) + function TP(c, h, y, O, q, ne) { + var le = ir(c), me = ir(h), we = le ? oe : Vn(c), We = me ? oe : Vn(h); + we = we == D ? Pe : we, We = We == D ? Pe : We; + var He = we == Pe, Xe = We == Pe, wt = we == We; + if (wt && ea(c)) { + if (!ea(h)) return !1; - fe = !0, We = !1; - } - if (wt && !We) - return ne || (ne = new ls()), fe || Bc(c) ? ww(c, h, y, O, q, ne) : VP(c, h, we, y, O, q, ne); - if (!(y & M)) { - var Ot = We && Tr.call(c, "__wrapped__"), Wt = Xe && Tr.call(h, "__wrapped__"); - if (Ot || Wt) { - var ur = Ot ? c.value() : c, Kt = Wt ? h.value() : h; - return ne || (ne = new ls()), q(ur, Kt, y, O, ne); + le = !0, He = !1; + } + if (wt && !He) + return ne || (ne = new hs()), le || jc(c) ? _w(c, h, y, O, q, ne) : nM(c, h, we, y, O, q, ne); + if (!(y & P)) { + var Ot = He && Tr.call(c, "__wrapped__"), Ht = Xe && Tr.call(h, "__wrapped__"); + if (Ot || Ht) { + var fr = Ot ? c.value() : c, Kt = Ht ? h.value() : h; + return ne || (ne = new hs()), q(fr, Kt, y, O, ne); } } - return wt ? (ne || (ne = new ls()), GP(c, h, y, O, q, ne)) : !1; + return wt ? (ne || (ne = new hs()), iM(c, h, y, O, q, ne)) : !1; } - function xP(c) { - return en(c) && Kn(c) == ie; + function RP(c) { + return en(c) && Vn(c) == ie; } function eg(c, h, y, O) { - var q = y.length, ne = q, fe = !O; + var q = y.length, ne = q, le = !O; if (c == null) return !ne; for (c = qr(c); q--; ) { - var ge = y[q]; - if (fe && ge[2] ? ge[1] !== c[ge[0]] : !(ge[0] in c)) + var me = y[q]; + if (le && me[2] ? me[1] !== c[me[0]] : !(me[0] in c)) return !1; } for (; ++q < ne; ) { - ge = y[q]; - var we = ge[0], He = c[we], We = ge[1]; - if (fe && ge[2]) { - if (He === r && !(we in c)) + me = y[q]; + var we = me[0], We = c[we], He = me[1]; + if (le && me[2]) { + if (We === r && !(we in c)) return !1; } else { - var Xe = new ls(); + var Xe = new hs(); if (O) - var wt = O(He, We, we, c, h, Xe); - if (!(wt === r ? cf(We, He, M | N, O, Xe) : wt)) + var wt = O(We, He, we, c, h, Xe); + if (!(wt === r ? uf(He, We, P | N, O, Xe) : wt)) return !1; } } return !0; } - function qy(c) { - if (!Zr(c) || nM(c)) + function Wy(c) { + if (!Zr(c) || dM(c)) return !1; - var h = fo(c) ? xA : Ue; - return h.test(Ba(c)); + var h = po(c) ? RA : je; + return h.test(qa(c)); } - function _P(c) { + function DP(c) { return en(c) && ti(c) == $e; } - function EP(c) { - return en(c) && Kn(c) == Me; + function OP(c) { + return en(c) && Vn(c) == Me; } - function SP(c) { - return en(c) && Zh(c.length) && !!Br[ti(c)]; + function NP(c) { + return en(c) && Qh(c.length) && !!Fr[ti(c)]; } - function zy(c) { - return typeof c == "function" ? c : c == null ? hi : typeof c == "object" ? nr(c) ? Ky(c[0], c[1]) : Wy(c) : l2(c); + function Hy(c) { + return typeof c == "function" ? c : c == null ? di : typeof c == "object" ? ir(c) ? Gy(c[0], c[1]) : Vy(c) : d2(c); } function tg(c) { - if (!lf(c)) - return MA(c); + if (!hf(c)) + return $A(c); var h = []; for (var y in qr(c)) Tr.call(c, y) && y != "constructor" && h.push(y); return h; } - function AP(c) { + function LP(c) { if (!Zr(c)) - return aM(c); - var h = lf(c), y = []; + return vM(c); + var h = hf(c), y = []; for (var O in c) O == "constructor" && (h || !Tr.call(c, O)) || y.push(O); return y; @@ -22187,159 +22187,159 @@ l0.exports; function rg(c, h) { return c < h; } - function Hy(c, h) { - var y = -1, O = fi(c) ? Ie(c.length) : []; - return Vo(c, function(q, ne, fe) { - O[++y] = h(q, ne, fe); + function Ky(c, h) { + var y = -1, O = li(c) ? Ie(c.length) : []; + return Jo(c, function(q, ne, le) { + O[++y] = h(q, ne, le); }), O; } - function Wy(c) { + function Vy(c) { var h = vg(c); - return h.length == 1 && h[0][2] ? Aw(h[0][0], h[0][1]) : function(y) { + return h.length == 1 && h[0][2] ? Mw(h[0][0], h[0][1]) : function(y) { return y === c || eg(y, c, h); }; } - function Ky(c, h) { - return yg(c) && Sw(h) ? Aw(Ts(c), h) : function(y) { + function Gy(c, h) { + return yg(c) && Pw(h) ? Mw(Rs(c), h) : function(y) { var O = Cg(y, c); - return O === r && O === h ? Tg(y, c) : cf(h, O, M | N); + return O === r && O === h ? Tg(y, c) : uf(h, O, P | N); }; } - function kh(c, h, y, O, q) { - c !== h && Jp(h, function(ne, fe) { - if (q || (q = new ls()), Zr(ne)) - PP(c, h, fe, y, kh, O, q); + function $h(c, h, y, O, q) { + c !== h && Jp(h, function(ne, le) { + if (q || (q = new hs()), Zr(ne)) + kP(c, h, le, y, $h, O, q); else { - var ge = O ? O(xg(c, fe), ne, fe + "", c, h, q) : r; - ge === r && (ge = ne), Gp(c, fe, ge); + var me = O ? O(xg(c, le), ne, le + "", c, h, q) : r; + me === r && (me = ne), Gp(c, le, me); } - }, li); + }, hi); } - function PP(c, h, y, O, q, ne, fe) { - var ge = xg(c, y), we = xg(h, y), He = fe.get(we); - if (He) { - Gp(c, y, He); + function kP(c, h, y, O, q, ne, le) { + var me = xg(c, y), we = xg(h, y), We = le.get(we); + if (We) { + Gp(c, y, We); return; } - var We = ne ? ne(ge, we, y + "", c, h, fe) : r, Xe = We === r; + var He = ne ? ne(me, we, y + "", c, h, le) : r, Xe = He === r; if (Xe) { - var wt = nr(we), Ot = !wt && Xo(we), Wt = !wt && !Ot && Bc(we); - We = we, wt || Ot || Wt ? nr(ge) ? We = ge : cn(ge) ? We = ui(ge) : Ot ? (Xe = !1, We = iw(we, !0)) : Wt ? (Xe = !1, We = sw(we, !0)) : We = [] : df(we) || Ua(we) ? (We = ge, Ua(ge) ? We = t2(ge) : (!Zr(ge) || fo(ge)) && (We = Ew(we))) : Xe = !1; + var wt = ir(we), Ot = !wt && ea(we), Ht = !wt && !Ot && jc(we); + He = we, wt || Ot || Ht ? ir(me) ? He = me : cn(me) ? He = fi(me) : Ot ? (Xe = !1, He = ow(we, !0)) : Ht ? (Xe = !1, He = aw(we, !0)) : He = [] : pf(we) || za(we) ? (He = me, za(me) ? He = n2(me) : (!Zr(me) || po(me)) && (He = Aw(we))) : Xe = !1; } - Xe && (fe.set(we, We), q(We, we, O, ne, fe), fe.delete(we)), Gp(c, y, We); + Xe && (le.set(we, He), q(He, we, O, ne, le), le.delete(we)), Gp(c, y, He); } - function Vy(c, h) { + function Yy(c, h) { var y = c.length; if (y) - return h += h < 0 ? y : 0, uo(h, y) ? c[h] : r; + return h += h < 0 ? y : 0, ho(h, y) ? c[h] : r; } - function Gy(c, h, y) { + function Jy(c, h, y) { h.length ? h = Xr(h, function(ne) { - return nr(ne) ? function(fe) { - return $a(fe, ne.length === 1 ? ne[0] : ne); + return ir(ne) ? function(le) { + return ja(le, ne.length === 1 ? ne[0] : ne); } : ne; - }) : h = [hi]; + }) : h = [di]; var O = -1; - h = Xr(h, Ai(jt())); - var q = Hy(c, function(ne, fe, ge) { - var we = Xr(h, function(He) { - return He(ne); + h = Xr(h, Ai(Ut())); + var q = Ky(c, function(ne, le, me) { + var we = Xr(h, function(We) { + return We(ne); }); return { criteria: we, index: ++O, value: ne }; }); - return Q9(q, function(ne, fe) { - return BP(ne, fe, y); + return uA(q, function(ne, le) { + return YP(ne, le, y); }); } - function MP(c, h) { - return Yy(c, h, function(y, O) { + function $P(c, h) { + return Xy(c, h, function(y, O) { return Tg(c, O); }); } - function Yy(c, h, y) { + function Xy(c, h, y) { for (var O = -1, q = h.length, ne = {}; ++O < q; ) { - var fe = h[O], ge = $a(c, fe); - y(ge, fe) && uf(ne, Yo(fe, c), ge); + var le = h[O], me = ja(c, le); + y(me, le) && ff(ne, Zo(le, c), me); } return ne; } - function IP(c) { + function BP(c) { return function(h) { - return $a(h, c); + return ja(h, c); }; } function ng(c, h, y, O) { - var q = O ? Z9 : Ic, ne = -1, fe = h.length, ge = c; - for (c === h && (h = ui(h)), y && (ge = Xr(c, Ai(y))); ++ne < fe; ) - for (var we = 0, He = h[ne], We = y ? y(He) : He; (we = q(ge, We, we, O)) > -1; ) - ge !== c && Ph.call(ge, we, 1), Ph.call(c, we, 1); + var q = O ? cA : Cc, ne = -1, le = h.length, me = c; + for (c === h && (h = fi(h)), y && (me = Xr(c, Ai(y))); ++ne < le; ) + for (var we = 0, We = h[ne], He = y ? y(We) : We; (we = q(me, He, we, O)) > -1; ) + me !== c && Mh.call(me, we, 1), Mh.call(c, we, 1); return c; } - function Jy(c, h) { + function Zy(c, h) { for (var y = c ? h.length : 0, O = y - 1; y--; ) { var q = h[y]; if (y == O || q !== ne) { var ne = q; - uo(q) ? Ph.call(c, q, 1) : ag(c, q); + ho(q) ? Mh.call(c, q, 1) : ag(c, q); } } return c; } function ig(c, h) { - return c + Ch(Ty() * (h - c + 1)); + return c + Th(Dy() * (h - c + 1)); } - function CP(c, h, y, O) { - for (var q = -1, ne = _n(Ih((h - c) / (y || 1)), 0), fe = Ie(ne); ne--; ) - fe[O ? ne : ++q] = c, c += y; - return fe; + function FP(c, h, y, O) { + for (var q = -1, ne = _n(Ch((h - c) / (y || 1)), 0), le = Ie(ne); ne--; ) + le[O ? ne : ++q] = c, c += y; + return le; } function sg(c, h) { var y = ""; if (!c || h < 1 || h > _) return y; do - h % 2 && (y += c), h = Ch(h / 2), h && (c += c); + h % 2 && (y += c), h = Th(h / 2), h && (c += c); while (h); return y; } function hr(c, h) { - return _g(Pw(c, h, hi), c + ""); + return _g(Iw(c, h, di), c + ""); } - function TP(c) { - return Oy(Uc(c)); + function jP(c) { + return Ly(Uc(c)); } - function RP(c, h) { + function UP(c, h) { var y = Uc(c); - return Kh(y, ka(h, 0, y.length)); + return Vh(y, Fa(h, 0, y.length)); } - function uf(c, h, y, O) { + function ff(c, h, y, O) { if (!Zr(c)) return c; - h = Yo(h, c); - for (var q = -1, ne = h.length, fe = ne - 1, ge = c; ge != null && ++q < ne; ) { - var we = Ts(h[q]), He = y; + h = Zo(h, c); + for (var q = -1, ne = h.length, le = ne - 1, me = c; me != null && ++q < ne; ) { + var we = Rs(h[q]), We = y; if (we === "__proto__" || we === "constructor" || we === "prototype") return c; - if (q != fe) { - var We = ge[we]; - He = O ? O(We, we, ge) : r, He === r && (He = Zr(We) ? We : uo(h[q + 1]) ? [] : {}); + if (q != le) { + var He = me[we]; + We = O ? O(He, we, me) : r, We === r && (We = Zr(He) ? He : ho(h[q + 1]) ? [] : {}); } - sf(ge, we, He), ge = ge[we]; + of(me, we, We), me = me[we]; } return c; } - var Xy = Th ? function(c, h) { - return Th.set(c, h), c; - } : hi, DP = Mh ? function(c, h) { - return Mh(c, "toString", { + var Qy = Rh ? function(c, h) { + return Rh.set(c, h), c; + } : di, qP = Ih ? function(c, h) { + return Ih(c, "toString", { configurable: !0, enumerable: !1, value: Dg(h), writable: !0 }); - } : hi; - function OP(c) { - return Kh(Uc(c)); + } : di; + function zP(c) { + return Vh(Uc(c)); } function Hi(c, h, y) { var O = -1, q = c.length; @@ -22348,277 +22348,277 @@ l0.exports; ne[O] = c[O + h]; return ne; } - function NP(c, h) { + function WP(c, h) { var y; - return Vo(c, function(O, q, ne) { + return Jo(c, function(O, q, ne) { return y = h(O, q, ne), !y; }), !!y; } - function $h(c, h, y) { + function Bh(c, h, y) { var O = 0, q = c == null ? O : c.length; - if (typeof h == "number" && h === h && q <= B) { + if (typeof h == "number" && h === h && q <= F) { for (; O < q; ) { - var ne = O + q >>> 1, fe = c[ne]; - fe !== null && !Mi(fe) && (y ? fe <= h : fe < h) ? O = ne + 1 : q = ne; + var ne = O + q >>> 1, le = c[ne]; + le !== null && !Mi(le) && (y ? le <= h : le < h) ? O = ne + 1 : q = ne; } return q; } - return og(c, h, hi, y); + return og(c, h, di, y); } function og(c, h, y, O) { var q = 0, ne = c == null ? 0 : c.length; if (ne === 0) return 0; h = y(h); - for (var fe = h !== h, ge = h === null, we = Mi(h), He = h === r; q < ne; ) { - var We = Ch((q + ne) / 2), Xe = y(c[We]), wt = Xe !== r, Ot = Xe === null, Wt = Xe === Xe, ur = Mi(Xe); - if (fe) - var Kt = O || Wt; - else He ? Kt = Wt && (O || wt) : ge ? Kt = Wt && wt && (O || !Ot) : we ? Kt = Wt && wt && !Ot && (O || !ur) : Ot || ur ? Kt = !1 : Kt = O ? Xe <= h : Xe < h; - Kt ? q = We + 1 : ne = We; + for (var le = h !== h, me = h === null, we = Mi(h), We = h === r; q < ne; ) { + var He = Th((q + ne) / 2), Xe = y(c[He]), wt = Xe !== r, Ot = Xe === null, Ht = Xe === Xe, fr = Mi(Xe); + if (le) + var Kt = O || Ht; + else We ? Kt = Ht && (O || wt) : me ? Kt = Ht && wt && (O || !Ot) : we ? Kt = Ht && wt && !Ot && (O || !fr) : Ot || fr ? Kt = !1 : Kt = O ? Xe <= h : Xe < h; + Kt ? q = He + 1 : ne = He; } - return Wn(ne, I); + return Kn(ne, I); } - function Zy(c, h) { + function ew(c, h) { for (var y = -1, O = c.length, q = 0, ne = []; ++y < O; ) { - var fe = c[y], ge = h ? h(fe) : fe; - if (!y || !hs(ge, we)) { - var we = ge; - ne[q++] = fe === 0 ? 0 : fe; + var le = c[y], me = h ? h(le) : le; + if (!y || !ds(me, we)) { + var we = me; + ne[q++] = le === 0 ? 0 : le; } } return ne; } - function Qy(c) { + function tw(c) { return typeof c == "number" ? c : Mi(c) ? v : +c; } function Pi(c) { if (typeof c == "string") return c; - if (nr(c)) + if (ir(c)) return Xr(c, Pi) + ""; if (Mi(c)) - return Ry ? Ry.call(c) : ""; + return Oy ? Oy.call(c) : ""; var h = c + ""; return h == "0" && 1 / c == -x ? "-0" : h; } - function Go(c, h, y) { - var O = -1, q = mh, ne = c.length, fe = !0, ge = [], we = ge; + function Xo(c, h, y) { + var O = -1, q = vh, ne = c.length, le = !0, me = [], we = me; if (y) - fe = !1, q = Lp; + le = !1, q = Lp; else if (ne >= i) { - var He = h ? null : WP(c); - if (He) - return bh(He); - fe = !1, q = Zu, we = new La(); + var We = h ? null : tM(c); + if (We) + return yh(We); + le = !1, q = Qu, we = new Ba(); } else - we = h ? [] : ge; + we = h ? [] : me; e: for (; ++O < ne; ) { - var We = c[O], Xe = h ? h(We) : We; - if (We = y || We !== 0 ? We : 0, fe && Xe === Xe) { + var He = c[O], Xe = h ? h(He) : He; + if (He = y || He !== 0 ? He : 0, le && Xe === Xe) { for (var wt = we.length; wt--; ) if (we[wt] === Xe) continue e; - h && we.push(Xe), ge.push(We); - } else q(we, Xe, y) || (we !== ge && we.push(Xe), ge.push(We)); + h && we.push(Xe), me.push(He); + } else q(we, Xe, y) || (we !== me && we.push(Xe), me.push(He)); } - return ge; + return me; } function ag(c, h) { - return h = Yo(h, c), c = Mw(c, h), c == null || delete c[Ts(Wi(h))]; + return h = Zo(h, c), c = Cw(c, h), c == null || delete c[Rs(Ki(h))]; } - function ew(c, h, y, O) { - return uf(c, h, y($a(c, h)), O); + function rw(c, h, y, O) { + return ff(c, h, y(ja(c, h)), O); } function Fh(c, h, y, O) { for (var q = c.length, ne = O ? q : -1; (O ? ne-- : ++ne < q) && h(c[ne], ne, c); ) ; return y ? Hi(c, O ? 0 : ne, O ? ne + 1 : q) : Hi(c, O ? ne + 1 : 0, O ? q : ne); } - function tw(c, h) { + function nw(c, h) { var y = c; return y instanceof wr && (y = y.value()), kp(h, function(O, q) { - return q.func.apply(q.thisArg, Ho([O], q.args)); + return q.func.apply(q.thisArg, Vo([O], q.args)); }, y); } function cg(c, h, y) { var O = c.length; if (O < 2) - return O ? Go(c[0]) : []; + return O ? Xo(c[0]) : []; for (var q = -1, ne = Ie(O); ++q < O; ) - for (var fe = c[q], ge = -1; ++ge < O; ) - ge != q && (ne[q] = of(ne[q] || fe, c[ge], h, y)); - return Go($n(ne, 1), h, y); + for (var le = c[q], me = -1; ++me < O; ) + me != q && (ne[q] = af(ne[q] || le, c[me], h, y)); + return Xo(Bn(ne, 1), h, y); } - function rw(c, h, y) { - for (var O = -1, q = c.length, ne = h.length, fe = {}; ++O < q; ) { - var ge = O < ne ? h[O] : r; - y(fe, c[O], ge); + function iw(c, h, y) { + for (var O = -1, q = c.length, ne = h.length, le = {}; ++O < q; ) { + var me = O < ne ? h[O] : r; + y(le, c[O], me); } - return fe; + return le; } function ug(c) { return cn(c) ? c : []; } function fg(c) { - return typeof c == "function" ? c : hi; + return typeof c == "function" ? c : di; } - function Yo(c, h) { - return nr(c) ? c : yg(c, h) ? [c] : Rw(Cr(c)); + function Zo(c, h) { + return ir(c) ? c : yg(c, h) ? [c] : Ow(Cr(c)); } - var LP = hr; - function Jo(c, h, y) { + var HP = hr; + function Qo(c, h, y) { var O = c.length; return y = y === r ? O : y, !h && y >= O ? c : Hi(c, h, y); } - var nw = _A || function(c) { + var sw = DA || function(c) { return _r.clearTimeout(c); }; - function iw(c, h) { + function ow(c, h) { if (h) return c.slice(); - var y = c.length, O = Ay ? Ay(y) : new c.constructor(y); + var y = c.length, O = My ? My(y) : new c.constructor(y); return c.copy(O), O; } function lg(c) { var h = new c.constructor(c.byteLength); - return new Sh(h).set(new Sh(c)), h; + return new Ah(h).set(new Ah(c)), h; } - function kP(c, h) { + function KP(c, h) { var y = h ? lg(c.buffer) : c.buffer; return new c.constructor(y, c.byteOffset, c.byteLength); } - function $P(c) { + function VP(c) { var h = new c.constructor(c.source, Te.exec(c)); return h.lastIndex = c.lastIndex, h; } - function FP(c) { - return nf ? qr(nf.call(c)) : {}; + function GP(c) { + return sf ? qr(sf.call(c)) : {}; } - function sw(c, h) { + function aw(c, h) { var y = h ? lg(c.buffer) : c.buffer; return new c.constructor(y, c.byteOffset, c.length); } - function ow(c, h) { + function cw(c, h) { if (c !== h) { - var y = c !== r, O = c === null, q = c === c, ne = Mi(c), fe = h !== r, ge = h === null, we = h === h, He = Mi(h); - if (!ge && !He && !ne && c > h || ne && fe && we && !ge && !He || O && fe && we || !y && we || !q) + var y = c !== r, O = c === null, q = c === c, ne = Mi(c), le = h !== r, me = h === null, we = h === h, We = Mi(h); + if (!me && !We && !ne && c > h || ne && le && we && !me && !We || O && le && we || !y && we || !q) return 1; - if (!O && !ne && !He && c < h || He && y && q && !O && !ne || ge && y && q || !fe && q || !we) + if (!O && !ne && !We && c < h || We && y && q && !O && !ne || me && y && q || !le && q || !we) return -1; } return 0; } - function BP(c, h, y) { - for (var O = -1, q = c.criteria, ne = h.criteria, fe = q.length, ge = y.length; ++O < fe; ) { - var we = ow(q[O], ne[O]); + function YP(c, h, y) { + for (var O = -1, q = c.criteria, ne = h.criteria, le = q.length, me = y.length; ++O < le; ) { + var we = cw(q[O], ne[O]); if (we) { - if (O >= ge) + if (O >= me) return we; - var He = y[O]; - return we * (He == "desc" ? -1 : 1); + var We = y[O]; + return we * (We == "desc" ? -1 : 1); } } return c.index - h.index; } - function aw(c, h, y, O) { - for (var q = -1, ne = c.length, fe = y.length, ge = -1, we = h.length, He = _n(ne - fe, 0), We = Ie(we + He), Xe = !O; ++ge < we; ) - We[ge] = h[ge]; - for (; ++q < fe; ) - (Xe || q < ne) && (We[y[q]] = c[q]); - for (; He--; ) - We[ge++] = c[q++]; - return We; + function uw(c, h, y, O) { + for (var q = -1, ne = c.length, le = y.length, me = -1, we = h.length, We = _n(ne - le, 0), He = Ie(we + We), Xe = !O; ++me < we; ) + He[me] = h[me]; + for (; ++q < le; ) + (Xe || q < ne) && (He[y[q]] = c[q]); + for (; We--; ) + He[me++] = c[q++]; + return He; } - function cw(c, h, y, O) { - for (var q = -1, ne = c.length, fe = -1, ge = y.length, we = -1, He = h.length, We = _n(ne - ge, 0), Xe = Ie(We + He), wt = !O; ++q < We; ) + function fw(c, h, y, O) { + for (var q = -1, ne = c.length, le = -1, me = y.length, we = -1, We = h.length, He = _n(ne - me, 0), Xe = Ie(He + We), wt = !O; ++q < He; ) Xe[q] = c[q]; - for (var Ot = q; ++we < He; ) + for (var Ot = q; ++we < We; ) Xe[Ot + we] = h[we]; - for (; ++fe < ge; ) - (wt || q < ne) && (Xe[Ot + y[fe]] = c[q++]); + for (; ++le < me; ) + (wt || q < ne) && (Xe[Ot + y[le]] = c[q++]); return Xe; } - function ui(c, h) { + function fi(c, h) { var y = -1, O = c.length; for (h || (h = Ie(O)); ++y < O; ) h[y] = c[y]; return h; } - function Cs(c, h, y, O) { + function Ts(c, h, y, O) { var q = !y; y || (y = {}); - for (var ne = -1, fe = h.length; ++ne < fe; ) { - var ge = h[ne], we = O ? O(y[ge], c[ge], ge, y, c) : r; - we === r && (we = c[ge]), q ? oo(y, ge, we) : sf(y, ge, we); + for (var ne = -1, le = h.length; ++ne < le; ) { + var me = h[ne], we = O ? O(y[me], c[me], me, y, c) : r; + we === r && (we = c[me]), q ? uo(y, me, we) : of(y, me, we); } return y; } - function UP(c, h) { - return Cs(c, bg(c), h); + function JP(c, h) { + return Ts(c, bg(c), h); } - function jP(c, h) { - return Cs(c, xw(c), h); + function XP(c, h) { + return Ts(c, Ew(c), h); } - function Bh(c, h) { + function jh(c, h) { return function(y, O) { - var q = nr(y) ? K9 : uP, ne = h ? h() : {}; - return q(y, c, jt(O, 2), ne); + var q = ir(y) ? rA : yP, ne = h ? h() : {}; + return q(y, c, Ut(O, 2), ne); }; } - function kc(c) { + function $c(c) { return hr(function(h, y) { - var O = -1, q = y.length, ne = q > 1 ? y[q - 1] : r, fe = q > 2 ? y[2] : r; - for (ne = c.length > 3 && typeof ne == "function" ? (q--, ne) : r, fe && ri(y[0], y[1], fe) && (ne = q < 3 ? r : ne, q = 1), h = qr(h); ++O < q; ) { - var ge = y[O]; - ge && c(h, ge, O, ne); + var O = -1, q = y.length, ne = q > 1 ? y[q - 1] : r, le = q > 2 ? y[2] : r; + for (ne = c.length > 3 && typeof ne == "function" ? (q--, ne) : r, le && ri(y[0], y[1], le) && (ne = q < 3 ? r : ne, q = 1), h = qr(h); ++O < q; ) { + var me = y[O]; + me && c(h, me, O, ne); } return h; }); } - function uw(c, h) { + function lw(c, h) { return function(y, O) { if (y == null) return y; - if (!fi(y)) + if (!li(y)) return c(y, O); - for (var q = y.length, ne = h ? q : -1, fe = qr(y); (h ? ne-- : ++ne < q) && O(fe[ne], ne, fe) !== !1; ) + for (var q = y.length, ne = h ? q : -1, le = qr(y); (h ? ne-- : ++ne < q) && O(le[ne], ne, le) !== !1; ) ; return y; }; } - function fw(c) { + function hw(c) { return function(h, y, O) { - for (var q = -1, ne = qr(h), fe = O(h), ge = fe.length; ge--; ) { - var we = fe[c ? ge : ++q]; + for (var q = -1, ne = qr(h), le = O(h), me = le.length; me--; ) { + var we = le[c ? me : ++q]; if (y(ne[we], we, ne) === !1) break; } return h; }; } - function qP(c, h, y) { - var O = h & L, q = ff(c); + function ZP(c, h, y) { + var O = h & L, q = lf(c); function ne() { - var fe = this && this !== _r && this instanceof ne ? q : c; - return fe.apply(O ? y : this, arguments); + var le = this && this !== _r && this instanceof ne ? q : c; + return le.apply(O ? y : this, arguments); } return ne; } - function lw(c) { + function dw(c) { return function(h) { h = Cr(h); - var y = Cc(h) ? fs(h) : r, O = y ? y[0] : h.charAt(0), q = y ? Jo(y, 1).join("") : h.slice(1); + var y = Tc(h) ? ls(h) : r, O = y ? y[0] : h.charAt(0), q = y ? Qo(y, 1).join("") : h.slice(1); return O[c]() + q; }; } - function $c(c) { + function Bc(c) { return function(h) { - return kp(u2(c2(h).replace(Ju, "")), c, ""); + return kp(l2(f2(h).replace(Xu, "")), c, ""); }; } - function ff(c) { + function lf(c) { return function() { var h = arguments; switch (h.length) { @@ -22639,82 +22639,82 @@ l0.exports; case 7: return new c(h[0], h[1], h[2], h[3], h[4], h[5], h[6]); } - var y = Lc(c.prototype), O = c.apply(y, h); + var y = kc(c.prototype), O = c.apply(y, h); return Zr(O) ? O : y; }; } - function zP(c, h, y) { - var O = ff(c); + function QP(c, h, y) { + var O = lf(c); function q() { - for (var ne = arguments.length, fe = Ie(ne), ge = ne, we = Fc(q); ge--; ) - fe[ge] = arguments[ge]; - var He = ne < 3 && fe[0] !== we && fe[ne - 1] !== we ? [] : Wo(fe, we); - if (ne -= He.length, ne < y) - return mw( + for (var ne = arguments.length, le = Ie(ne), me = ne, we = Fc(q); me--; ) + le[me] = arguments[me]; + var We = ne < 3 && le[0] !== we && le[ne - 1] !== we ? [] : Go(le, we); + if (ne -= We.length, ne < y) + return bw( c, h, Uh, q.placeholder, r, - fe, - He, + le, + We, r, r, y - ne ); - var We = this && this !== _r && this instanceof q ? O : c; - return Pn(We, this, fe); + var He = this && this !== _r && this instanceof q ? O : c; + return Pn(He, this, le); } return q; } - function hw(c) { + function pw(c) { return function(h, y, O) { var q = qr(h); - if (!fi(h)) { - var ne = jt(y, 3); - h = Mn(h), y = function(ge) { - return ne(q[ge], ge, q); + if (!li(h)) { + var ne = Ut(y, 3); + h = Mn(h), y = function(me) { + return ne(q[me], me, q); }; } - var fe = c(h, y, O); - return fe > -1 ? q[ne ? h[fe] : fe] : r; + var le = c(h, y, O); + return le > -1 ? q[ne ? h[le] : le] : r; }; } - function dw(c) { - return co(function(h) { - var y = h.length, O = y, q = qi.prototype.thru; + function gw(c) { + return lo(function(h) { + var y = h.length, O = y, q = zi.prototype.thru; for (c && h.reverse(); O--; ) { var ne = h[O]; if (typeof ne != "function") - throw new ji(o); - if (q && !fe && Hh(ne) == "wrapper") - var fe = new qi([], !0); + throw new qi(o); + if (q && !le && Hh(ne) == "wrapper") + var le = new zi([], !0); } - for (O = fe ? O : y; ++O < y; ) { + for (O = le ? O : y; ++O < y; ) { ne = h[O]; - var ge = Hh(ne), we = ge == "wrapper" ? mg(ne) : r; - we && wg(we[0]) && we[1] == (R | K | V | W) && !we[4].length && we[9] == 1 ? fe = fe[Hh(we[0])].apply(fe, we[3]) : fe = ne.length == 1 && wg(ne) ? fe[ge]() : fe.thru(ne); + var me = Hh(ne), we = me == "wrapper" ? mg(ne) : r; + we && wg(we[0]) && we[1] == (R | H | V | K) && !we[4].length && we[9] == 1 ? le = le[Hh(we[0])].apply(le, we[3]) : le = ne.length == 1 && wg(ne) ? le[me]() : le.thru(ne); } return function() { - var He = arguments, We = He[0]; - if (fe && He.length == 1 && nr(We)) - return fe.plant(We).value(); - for (var Xe = 0, wt = y ? h[Xe].apply(this, He) : We; ++Xe < y; ) + var We = arguments, He = We[0]; + if (le && We.length == 1 && ir(He)) + return le.plant(He).value(); + for (var Xe = 0, wt = y ? h[Xe].apply(this, We) : He; ++Xe < y; ) wt = h[Xe].call(this, wt); return wt; }; }); } - function Uh(c, h, y, O, q, ne, fe, ge, we, He) { - var We = h & R, Xe = h & L, wt = h & $, Ot = h & (K | H), Wt = h & pe, ur = wt ? r : ff(c); + function Uh(c, h, y, O, q, ne, le, me, we, We) { + var He = h & R, Xe = h & L, wt = h & $, Ot = h & (H | W), Ht = h & ge, fr = wt ? r : lf(c); function Kt() { for (var vr = arguments.length, Er = Ie(vr), Ii = vr; Ii--; ) Er[Ii] = arguments[Ii]; if (Ot) - var ni = Fc(Kt), Ci = tA(Er, ni); - if (O && (Er = aw(Er, O, q, Ot)), ne && (Er = cw(Er, ne, fe, Ot)), vr -= Ci, Ot && vr < He) { - var un = Wo(Er, ni); - return mw( + var ni = Fc(Kt), Ci = lA(Er, ni); + if (O && (Er = uw(Er, O, q, Ot)), ne && (Er = fw(Er, ne, le, Ot)), vr -= Ci, Ot && vr < We) { + var un = Go(Er, ni); + return bw( c, h, Uh, @@ -22722,22 +22722,22 @@ l0.exports; y, Er, un, - ge, + me, we, - He - vr + We - vr ); } - var ds = Xe ? y : this, ho = wt ? ds[c] : c; - return vr = Er.length, ge ? Er = uM(Er, ge) : Wt && vr > 1 && Er.reverse(), We && we < vr && (Er.length = we), this && this !== _r && this instanceof Kt && (ho = ur || ff(ho)), ho.apply(ds, Er); + var ps = Xe ? y : this, mo = wt ? ps[c] : c; + return vr = Er.length, me ? Er = yM(Er, me) : Ht && vr > 1 && Er.reverse(), He && we < vr && (Er.length = we), this && this !== _r && this instanceof Kt && (mo = fr || lf(mo)), mo.apply(ps, Er); } return Kt; } - function pw(c, h) { + function mw(c, h) { return function(y, O) { - return vP(y, c, h(O), {}); + return MP(y, c, h(O), {}); }; } - function jh(c, h) { + function qh(c, h) { return function(y, O) { var q; if (y === r && O === r) @@ -22745,14 +22745,14 @@ l0.exports; if (y !== r && (q = y), O !== r) { if (q === r) return O; - typeof y == "string" || typeof O == "string" ? (y = Pi(y), O = Pi(O)) : (y = Qy(y), O = Qy(O)), q = c(y, O); + typeof y == "string" || typeof O == "string" ? (y = Pi(y), O = Pi(O)) : (y = tw(y), O = tw(O)), q = c(y, O); } return q; }; } function hg(c) { - return co(function(h) { - return h = Xr(h, Ai(jt())), hr(function(y) { + return lo(function(h) { + return h = Xr(h, Ai(Ut())), hr(function(y) { var O = this; return c(h, function(q) { return Pn(q, O, y); @@ -22760,78 +22760,78 @@ l0.exports; }); }); } - function qh(c, h) { + function zh(c, h) { h = h === r ? " " : Pi(h); var y = h.length; if (y < 2) return y ? sg(h, c) : h; - var O = sg(h, Ih(c / Tc(h))); - return Cc(h) ? Jo(fs(O), 0, c).join("") : O.slice(0, c); - } - function HP(c, h, y, O) { - var q = h & L, ne = ff(c); - function fe() { - for (var ge = -1, we = arguments.length, He = -1, We = O.length, Xe = Ie(We + we), wt = this && this !== _r && this instanceof fe ? ne : c; ++He < We; ) - Xe[He] = O[He]; + var O = sg(h, Ch(c / Rc(h))); + return Tc(h) ? Qo(ls(O), 0, c).join("") : O.slice(0, c); + } + function eM(c, h, y, O) { + var q = h & L, ne = lf(c); + function le() { + for (var me = -1, we = arguments.length, We = -1, He = O.length, Xe = Ie(He + we), wt = this && this !== _r && this instanceof le ? ne : c; ++We < He; ) + Xe[We] = O[We]; for (; we--; ) - Xe[He++] = arguments[++ge]; + Xe[We++] = arguments[++me]; return Pn(wt, q ? y : this, Xe); } - return fe; + return le; } - function gw(c) { + function vw(c) { return function(h, y, O) { - return O && typeof O != "number" && ri(h, y, O) && (y = O = r), h = lo(h), y === r ? (y = h, h = 0) : y = lo(y), O = O === r ? h < y ? 1 : -1 : lo(O), CP(h, y, O, c); + return O && typeof O != "number" && ri(h, y, O) && (y = O = r), h = go(h), y === r ? (y = h, h = 0) : y = go(y), O = O === r ? h < y ? 1 : -1 : go(O), FP(h, y, O, c); }; } - function zh(c) { + function Wh(c) { return function(h, y) { - return typeof h == "string" && typeof y == "string" || (h = Ki(h), y = Ki(y)), c(h, y); + return typeof h == "string" && typeof y == "string" || (h = Vi(h), y = Vi(y)), c(h, y); }; } - function mw(c, h, y, O, q, ne, fe, ge, we, He) { - var We = h & K, Xe = We ? fe : r, wt = We ? r : fe, Ot = We ? ne : r, Wt = We ? r : ne; - h |= We ? V : te, h &= ~(We ? te : V), h & F || (h &= ~(L | $)); - var ur = [ + function bw(c, h, y, O, q, ne, le, me, we, We) { + var He = h & H, Xe = He ? le : r, wt = He ? r : le, Ot = He ? ne : r, Ht = He ? r : ne; + h |= He ? V : te, h &= ~(He ? te : V), h & B || (h &= ~(L | $)); + var fr = [ c, h, q, Ot, Xe, - Wt, + Ht, wt, - ge, + me, we, - He - ], Kt = y.apply(r, ur); - return wg(c) && Iw(Kt, ur), Kt.placeholder = O, Cw(Kt, c, h); + We + ], Kt = y.apply(r, fr); + return wg(c) && Tw(Kt, fr), Kt.placeholder = O, Rw(Kt, c, h); } function dg(c) { var h = xn[c]; return function(y, O) { - if (y = Ki(y), O = O == null ? 0 : Wn(ar(O), 292), O && Cy(y)) { + if (y = Vi(y), O = O == null ? 0 : Kn(cr(O), 292), O && Ry(y)) { var q = (Cr(y) + "e").split("e"), ne = h(q[0] + "e" + (+q[1] + O)); return q = (Cr(ne) + "e").split("e"), +(q[0] + "e" + (+q[1] - O)); } return h(y); }; } - var WP = Oc && 1 / bh(new Oc([, -0]))[1] == x ? function(c) { - return new Oc(c); + var tM = Nc && 1 / yh(new Nc([, -0]))[1] == x ? function(c) { + return new Nc(c); } : Lg; - function vw(c) { + function yw(c) { return function(h) { - var y = Kn(h); - return y == ie ? zp(h) : y == Me ? cA(h) : eA(h, c(h)); + var y = Vn(h); + return y == ie ? zp(h) : y == Me ? bA(h) : fA(h, c(h)); }; } - function ao(c, h, y, O, q, ne, fe, ge) { + function fo(c, h, y, O, q, ne, le, me) { var we = h & $; if (!we && typeof c != "function") - throw new ji(o); - var He = O ? O.length : 0; - if (He || (h &= ~(V | te), O = q = r), fe = fe === r ? fe : _n(ar(fe), 0), ge = ge === r ? ge : ar(ge), He -= q ? q.length : 0, h & te) { - var We = O, Xe = q; + throw new qi(o); + var We = O ? O.length : 0; + if (We || (h &= ~(V | te), O = q = r), le = le === r ? le : _n(cr(le), 0), me = me === r ? me : cr(me), We -= q ? q.length : 0, h & te) { + var He = O, Xe = q; O = q = r; } var wt = we ? r : mg(c), Ot = [ @@ -22840,39 +22840,39 @@ l0.exports; y, O, q, - We, + He, Xe, ne, - fe, - ge + le, + me ]; - if (wt && oM(Ot, wt), c = Ot[0], h = Ot[1], y = Ot[2], O = Ot[3], q = Ot[4], ge = Ot[9] = Ot[9] === r ? we ? 0 : c.length : _n(Ot[9] - He, 0), !ge && h & (K | H) && (h &= ~(K | H)), !h || h == L) - var Wt = qP(c, h, y); - else h == K || h == H ? Wt = zP(c, h, ge) : (h == V || h == (L | V)) && !q.length ? Wt = HP(c, h, y, O) : Wt = Uh.apply(r, Ot); - var ur = wt ? Xy : Iw; - return Cw(ur(Wt, Ot), c, h); + if (wt && mM(Ot, wt), c = Ot[0], h = Ot[1], y = Ot[2], O = Ot[3], q = Ot[4], me = Ot[9] = Ot[9] === r ? we ? 0 : c.length : _n(Ot[9] - We, 0), !me && h & (H | W) && (h &= ~(H | W)), !h || h == L) + var Ht = ZP(c, h, y); + else h == H || h == W ? Ht = QP(c, h, me) : (h == V || h == (L | V)) && !q.length ? Ht = eM(c, h, y, O) : Ht = Uh.apply(r, Ot); + var fr = wt ? Qy : Tw; + return Rw(fr(Ht, Ot), c, h); } - function bw(c, h, y, O) { - return c === r || hs(c, Dc[y]) && !Tr.call(O, y) ? h : c; + function ww(c, h, y, O) { + return c === r || ds(c, Oc[y]) && !Tr.call(O, y) ? h : c; } - function yw(c, h, y, O, q, ne) { - return Zr(c) && Zr(h) && (ne.set(h, c), kh(c, h, r, yw, ne), ne.delete(h)), c; + function xw(c, h, y, O, q, ne) { + return Zr(c) && Zr(h) && (ne.set(h, c), $h(c, h, r, xw, ne), ne.delete(h)), c; } - function KP(c) { - return df(c) ? r : c; + function rM(c) { + return pf(c) ? r : c; } - function ww(c, h, y, O, q, ne) { - var fe = y & M, ge = c.length, we = h.length; - if (ge != we && !(fe && we > ge)) + function _w(c, h, y, O, q, ne) { + var le = y & P, me = c.length, we = h.length; + if (me != we && !(le && we > me)) return !1; - var He = ne.get(c), We = ne.get(h); - if (He && We) - return He == h && We == c; - var Xe = -1, wt = !0, Ot = y & N ? new La() : r; - for (ne.set(c, h), ne.set(h, c); ++Xe < ge; ) { - var Wt = c[Xe], ur = h[Xe]; + var We = ne.get(c), He = ne.get(h); + if (We && He) + return We == h && He == c; + var Xe = -1, wt = !0, Ot = y & N ? new Ba() : r; + for (ne.set(c, h), ne.set(h, c); ++Xe < me; ) { + var Ht = c[Xe], fr = h[Xe]; if (O) - var Kt = fe ? O(ur, Wt, Xe, h, c, ne) : O(Wt, ur, Xe, c, h, ne); + var Kt = le ? O(fr, Ht, Xe, h, c, ne) : O(Ht, fr, Xe, c, h, ne); if (Kt !== r) { if (Kt) continue; @@ -22881,99 +22881,99 @@ l0.exports; } if (Ot) { if (!$p(h, function(vr, Er) { - if (!Zu(Ot, Er) && (Wt === vr || q(Wt, vr, y, O, ne))) + if (!Qu(Ot, Er) && (Ht === vr || q(Ht, vr, y, O, ne))) return Ot.push(Er); })) { wt = !1; break; } - } else if (!(Wt === ur || q(Wt, ur, y, O, ne))) { + } else if (!(Ht === fr || q(Ht, fr, y, O, ne))) { wt = !1; break; } } return ne.delete(c), ne.delete(h), wt; } - function VP(c, h, y, O, q, ne, fe) { + function nM(c, h, y, O, q, ne, le) { switch (y) { case Ze: if (c.byteLength != h.byteLength || c.byteOffset != h.byteOffset) return !1; c = c.buffer, h = h.buffer; case _e: - return !(c.byteLength != h.byteLength || !ne(new Sh(c), new Sh(h))); + return !(c.byteLength != h.byteLength || !ne(new Ah(c), new Ah(h))); case J: case Q: case ue: - return hs(+c, +h); + return ds(+c, +h); case X: return c.name == h.name && c.message == h.message; case $e: case Ne: return c == h + ""; case ie: - var ge = zp; + var me = zp; case Me: - var we = O & M; - if (ge || (ge = bh), c.size != h.size && !we) + var we = O & P; + if (me || (me = yh), c.size != h.size && !we) return !1; - var He = fe.get(c); - if (He) - return He == h; - O |= N, fe.set(c, h); - var We = ww(ge(c), ge(h), O, q, ne, fe); - return fe.delete(c), We; + var We = le.get(c); + if (We) + return We == h; + O |= N, le.set(c, h); + var He = _w(me(c), me(h), O, q, ne, le); + return le.delete(c), He; case Ke: - if (nf) - return nf.call(c) == nf.call(h); + if (sf) + return sf.call(c) == sf.call(h); } return !1; } - function GP(c, h, y, O, q, ne) { - var fe = y & M, ge = pg(c), we = ge.length, He = pg(h), We = He.length; - if (we != We && !fe) + function iM(c, h, y, O, q, ne) { + var le = y & P, me = pg(c), we = me.length, We = pg(h), He = We.length; + if (we != He && !le) return !1; for (var Xe = we; Xe--; ) { - var wt = ge[Xe]; - if (!(fe ? wt in h : Tr.call(h, wt))) + var wt = me[Xe]; + if (!(le ? wt in h : Tr.call(h, wt))) return !1; } - var Ot = ne.get(c), Wt = ne.get(h); - if (Ot && Wt) - return Ot == h && Wt == c; - var ur = !0; + var Ot = ne.get(c), Ht = ne.get(h); + if (Ot && Ht) + return Ot == h && Ht == c; + var fr = !0; ne.set(c, h), ne.set(h, c); - for (var Kt = fe; ++Xe < we; ) { - wt = ge[Xe]; + for (var Kt = le; ++Xe < we; ) { + wt = me[Xe]; var vr = c[wt], Er = h[wt]; if (O) - var Ii = fe ? O(Er, vr, wt, h, c, ne) : O(vr, Er, wt, c, h, ne); + var Ii = le ? O(Er, vr, wt, h, c, ne) : O(vr, Er, wt, c, h, ne); if (!(Ii === r ? vr === Er || q(vr, Er, y, O, ne) : Ii)) { - ur = !1; + fr = !1; break; } Kt || (Kt = wt == "constructor"); } - if (ur && !Kt) { + if (fr && !Kt) { var ni = c.constructor, Ci = h.constructor; - ni != Ci && "constructor" in c && "constructor" in h && !(typeof ni == "function" && ni instanceof ni && typeof Ci == "function" && Ci instanceof Ci) && (ur = !1); + ni != Ci && "constructor" in c && "constructor" in h && !(typeof ni == "function" && ni instanceof ni && typeof Ci == "function" && Ci instanceof Ci) && (fr = !1); } - return ne.delete(c), ne.delete(h), ur; + return ne.delete(c), ne.delete(h), fr; } - function co(c) { - return _g(Pw(c, r, Lw), c + ""); + function lo(c) { + return _g(Iw(c, r, $w), c + ""); } function pg(c) { - return Uy(c, Mn, bg); + return qy(c, Mn, bg); } function gg(c) { - return Uy(c, li, xw); + return qy(c, hi, Ew); } - var mg = Th ? function(c) { - return Th.get(c); + var mg = Rh ? function(c) { + return Rh.get(c); } : Lg; function Hh(c) { - for (var h = c.name + "", y = Nc[h], O = Tr.call(Nc, h) ? y.length : 0; O--; ) { + for (var h = c.name + "", y = Lc[h], O = Tr.call(Lc, h) ? y.length : 0; O--; ) { var q = y[O], ne = q.func; if (ne == null || ne == c) return q.name; @@ -22984,103 +22984,103 @@ l0.exports; var h = Tr.call(ee, "placeholder") ? ee : c; return h.placeholder; } - function jt() { + function Ut() { var c = ee.iteratee || Og; - return c = c === Og ? zy : c, arguments.length ? c(arguments[0], arguments[1]) : c; + return c = c === Og ? Hy : c, arguments.length ? c(arguments[0], arguments[1]) : c; } - function Wh(c, h) { + function Kh(c, h) { var y = c.__data__; - return rM(h) ? y[typeof h == "string" ? "string" : "hash"] : y.map; + return hM(h) ? y[typeof h == "string" ? "string" : "hash"] : y.map; } function vg(c) { for (var h = Mn(c), y = h.length; y--; ) { var O = h[y], q = c[O]; - h[y] = [O, q, Sw(q)]; + h[y] = [O, q, Pw(q)]; } return h; } - function Fa(c, h) { - var y = sA(c, h); - return qy(y) ? y : r; + function Ua(c, h) { + var y = gA(c, h); + return Wy(y) ? y : r; } - function YP(c) { - var h = Tr.call(c, Oa), y = c[Oa]; + function sM(c) { + var h = Tr.call(c, ka), y = c[ka]; try { - c[Oa] = r; + c[ka] = r; var O = !0; } catch { } - var q = _h.call(c); - return O && (h ? c[Oa] = y : delete c[Oa]), q; + var q = Eh.call(c); + return O && (h ? c[ka] = y : delete c[ka]), q; } - var bg = Wp ? function(c) { - return c == null ? [] : (c = qr(c), zo(Wp(c), function(h) { - return My.call(c, h); + var bg = Hp ? function(c) { + return c == null ? [] : (c = qr(c), Ko(Hp(c), function(h) { + return Cy.call(c, h); })); - } : kg, xw = Wp ? function(c) { + } : kg, Ew = Hp ? function(c) { for (var h = []; c; ) - Ho(h, bg(c)), c = Ah(c); + Vo(h, bg(c)), c = Ph(c); return h; - } : kg, Kn = ti; - (Kp && Kn(new Kp(new ArrayBuffer(1))) != Ze || ef && Kn(new ef()) != ie || Vp && Kn(Vp.resolve()) != De || Oc && Kn(new Oc()) != Me || tf && Kn(new tf()) != qe) && (Kn = function(c) { - var h = ti(c), y = h == Pe ? c.constructor : r, O = y ? Ba(y) : ""; + } : kg, Vn = ti; + (Kp && Vn(new Kp(new ArrayBuffer(1))) != Ze || tf && Vn(new tf()) != ie || Vp && Vn(Vp.resolve()) != De || Nc && Vn(new Nc()) != Me || rf && Vn(new rf()) != qe) && (Vn = function(c) { + var h = ti(c), y = h == Pe ? c.constructor : r, O = y ? qa(y) : ""; if (O) switch (O) { - case RA: + case UA: return Ze; - case DA: + case qA: return ie; - case OA: + case zA: return De; - case NA: + case WA: return Me; - case LA: + case HA: return qe; } return h; }); - function JP(c, h, y) { + function oM(c, h, y) { for (var O = -1, q = y.length; ++O < q; ) { - var ne = y[O], fe = ne.size; + var ne = y[O], le = ne.size; switch (ne.type) { case "drop": - c += fe; + c += le; break; case "dropRight": - h -= fe; + h -= le; break; case "take": - h = Wn(h, c + fe); + h = Kn(h, c + le); break; case "takeRight": - c = _n(c, h - fe); + c = _n(c, h - le); break; } } return { start: c, end: h }; } - function XP(c) { + function aM(c) { var h = c.match(C); return h ? h[1].split(G) : []; } - function _w(c, h, y) { - h = Yo(h, c); + function Sw(c, h, y) { + h = Zo(h, c); for (var O = -1, q = h.length, ne = !1; ++O < q; ) { - var fe = Ts(h[O]); - if (!(ne = c != null && y(c, fe))) + var le = Rs(h[O]); + if (!(ne = c != null && y(c, le))) break; - c = c[fe]; + c = c[le]; } - return ne || ++O != q ? ne : (q = c == null ? 0 : c.length, !!q && Zh(q) && uo(fe, q) && (nr(c) || Ua(c))); + return ne || ++O != q ? ne : (q = c == null ? 0 : c.length, !!q && Qh(q) && ho(le, q) && (ir(c) || za(c))); } - function ZP(c) { + function cM(c) { var h = c.length, y = new c.constructor(h); return h && typeof c[0] == "string" && Tr.call(c, "index") && (y.index = c.index, y.input = c.input), y; } - function Ew(c) { - return typeof c.constructor == "function" && !lf(c) ? Lc(Ah(c)) : {}; + function Aw(c) { + return typeof c.constructor == "function" && !hf(c) ? kc(Ph(c)) : {}; } - function QP(c, h, y) { + function uM(c, h, y) { var O = c.constructor; switch (h) { case _e: @@ -23089,7 +23089,7 @@ l0.exports; case Q: return new O(+c); case Ze: - return kP(c, y); + return KP(c, y); case at: case ke: case Qe: @@ -23099,21 +23099,21 @@ l0.exports; case lt: case ct: case qt: - return sw(c, y); + return aw(c, y); case ie: return new O(); case ue: case Ne: return new O(c); case $e: - return $P(c); + return VP(c); case Me: return new O(); case Ke: - return FP(c); + return GP(c); } } - function eM(c, h) { + function fM(c, h) { var y = h.length; if (!y) return c; @@ -23122,10 +23122,10 @@ l0.exports; /* [wrapped with ` + h + `] */ `); } - function tM(c) { - return nr(c) || Ua(c) || !!(Iy && c && c[Iy]); + function lM(c) { + return ir(c) || za(c) || !!(Ty && c && c[Ty]); } - function uo(c, h) { + function ho(c, h) { var y = typeof c; return h = h ?? _, !!h && (y == "number" || y != "symbol" && it.test(c)) && c > -1 && c % 1 == 0 && c < h; } @@ -23133,15 +23133,15 @@ l0.exports; if (!Zr(y)) return !1; var O = typeof h; - return (O == "number" ? fi(y) && uo(h, y.length) : O == "string" && h in y) ? hs(y[h], c) : !1; + return (O == "number" ? li(y) && ho(h, y.length) : O == "string" && h in y) ? ds(y[h], c) : !1; } function yg(c, h) { - if (nr(c)) + if (ir(c)) return !1; var y = typeof c; return y == "number" || y == "symbol" || y == "boolean" || c == null || Mi(c) ? !0 : $t.test(c) || !vt.test(c) || h != null && c in qr(h); } - function rM(c) { + function hM(c) { var h = typeof c; return h == "string" || h == "number" || h == "symbol" || h == "boolean" ? c !== "__proto__" : c === null; } @@ -23154,67 +23154,67 @@ l0.exports; var O = mg(y); return !!O && c === O[0]; } - function nM(c) { - return !!Sy && Sy in c; + function dM(c) { + return !!Py && Py in c; } - var iM = wh ? fo : $g; - function lf(c) { - var h = c && c.constructor, y = typeof h == "function" && h.prototype || Dc; + var pM = xh ? po : $g; + function hf(c) { + var h = c && c.constructor, y = typeof h == "function" && h.prototype || Oc; return c === y; } - function Sw(c) { + function Pw(c) { return c === c && !Zr(c); } - function Aw(c, h) { + function Mw(c, h) { return function(y) { return y == null ? !1 : y[c] === h && (h !== r || c in qr(y)); }; } - function sM(c) { - var h = Jh(c, function(O) { + function gM(c) { + var h = Xh(c, function(O) { return y.size === l && y.clear(), O; }), y = h.cache; return h; } - function oM(c, h) { - var y = c[1], O = h[1], q = y | O, ne = q < (L | $ | R), fe = O == R && y == K || O == R && y == W && c[7].length <= h[8] || O == (R | W) && h[7].length <= h[8] && y == K; - if (!(ne || fe)) + function mM(c, h) { + var y = c[1], O = h[1], q = y | O, ne = q < (L | $ | R), le = O == R && y == H || O == R && y == K && c[7].length <= h[8] || O == (R | K) && h[7].length <= h[8] && y == H; + if (!(ne || le)) return c; - O & L && (c[2] = h[2], q |= y & L ? 0 : F); - var ge = h[3]; - if (ge) { + O & L && (c[2] = h[2], q |= y & L ? 0 : B); + var me = h[3]; + if (me) { var we = c[3]; - c[3] = we ? aw(we, ge, h[4]) : ge, c[4] = we ? Wo(c[3], d) : h[4]; + c[3] = we ? uw(we, me, h[4]) : me, c[4] = we ? Go(c[3], d) : h[4]; } - return ge = h[5], ge && (we = c[5], c[5] = we ? cw(we, ge, h[6]) : ge, c[6] = we ? Wo(c[5], d) : h[6]), ge = h[7], ge && (c[7] = ge), O & R && (c[8] = c[8] == null ? h[8] : Wn(c[8], h[8])), c[9] == null && (c[9] = h[9]), c[0] = h[0], c[1] = q, c; + return me = h[5], me && (we = c[5], c[5] = we ? fw(we, me, h[6]) : me, c[6] = we ? Go(c[5], d) : h[6]), me = h[7], me && (c[7] = me), O & R && (c[8] = c[8] == null ? h[8] : Kn(c[8], h[8])), c[9] == null && (c[9] = h[9]), c[0] = h[0], c[1] = q, c; } - function aM(c) { + function vM(c) { var h = []; if (c != null) for (var y in qr(c)) h.push(y); return h; } - function cM(c) { - return _h.call(c); + function bM(c) { + return Eh.call(c); } - function Pw(c, h, y) { + function Iw(c, h, y) { return h = _n(h === r ? c.length - 1 : h, 0), function() { - for (var O = arguments, q = -1, ne = _n(O.length - h, 0), fe = Ie(ne); ++q < ne; ) - fe[q] = O[h + q]; + for (var O = arguments, q = -1, ne = _n(O.length - h, 0), le = Ie(ne); ++q < ne; ) + le[q] = O[h + q]; q = -1; - for (var ge = Ie(h + 1); ++q < h; ) - ge[q] = O[q]; - return ge[h] = y(fe), Pn(c, this, ge); + for (var me = Ie(h + 1); ++q < h; ) + me[q] = O[q]; + return me[h] = y(le), Pn(c, this, me); }; } - function Mw(c, h) { - return h.length < 2 ? c : $a(c, Hi(h, 0, -1)); + function Cw(c, h) { + return h.length < 2 ? c : ja(c, Hi(h, 0, -1)); } - function uM(c, h) { - for (var y = c.length, O = Wn(h.length, y), q = ui(c); O--; ) { + function yM(c, h) { + for (var y = c.length, O = Kn(h.length, y), q = fi(c); O--; ) { var ne = h[O]; - c[O] = uo(ne, y) ? q[ne] : r; + c[O] = ho(ne, y) ? q[ne] : r; } return c; } @@ -23222,17 +23222,17 @@ l0.exports; if (!(h === "constructor" && typeof c[h] == "function") && h != "__proto__") return c[h]; } - var Iw = Tw(Xy), hf = SA || function(c, h) { + var Tw = Dw(Qy), df = NA || function(c, h) { return _r.setTimeout(c, h); - }, _g = Tw(DP); - function Cw(c, h, y) { + }, _g = Dw(qP); + function Rw(c, h, y) { var O = h + ""; - return _g(c, eM(O, fM(XP(O), y))); + return _g(c, fM(O, wM(aM(O), y))); } - function Tw(c) { + function Dw(c) { var h = 0, y = 0; return function() { - var O = IA(), q = m - (O - y); + var O = BA(), q = m - (O - y); if (y = O, q > 0) { if (++h >= S) return arguments[0]; @@ -23241,30 +23241,30 @@ l0.exports; return c.apply(r, arguments); }; } - function Kh(c, h) { + function Vh(c, h) { var y = -1, O = c.length, q = O - 1; for (h = h === r ? O : h; ++y < h; ) { - var ne = ig(y, q), fe = c[ne]; - c[ne] = c[y], c[y] = fe; + var ne = ig(y, q), le = c[ne]; + c[ne] = c[y], c[y] = le; } return c.length = h, c; } - var Rw = sM(function(c) { + var Ow = gM(function(c) { var h = []; - return c.charCodeAt(0) === 46 && h.push(""), c.replace(Bt, function(y, O, q, ne) { - h.push(q ? ne.replace(he, "$1") : O || y); + return c.charCodeAt(0) === 46 && h.push(""), c.replace(Ft, function(y, O, q, ne) { + h.push(q ? ne.replace(de, "$1") : O || y); }), h; }); - function Ts(c) { + function Rs(c) { if (typeof c == "string" || Mi(c)) return c; var h = c + ""; return h == "0" && 1 / c == -x ? "-0" : h; } - function Ba(c) { + function qa(c) { if (c != null) { try { - return xh.call(c); + return _h.call(c); } catch { } try { @@ -23274,260 +23274,260 @@ l0.exports; } return ""; } - function fM(c, h) { + function wM(c, h) { return Ui(ce, function(y) { var O = "_." + y[0]; - h & y[1] && !mh(c, O) && c.push(O); + h & y[1] && !vh(c, O) && c.push(O); }), c.sort(); } - function Dw(c) { + function Nw(c) { if (c instanceof wr) return c.clone(); - var h = new qi(c.__wrapped__, c.__chain__); - return h.__actions__ = ui(c.__actions__), h.__index__ = c.__index__, h.__values__ = c.__values__, h; + var h = new zi(c.__wrapped__, c.__chain__); + return h.__actions__ = fi(c.__actions__), h.__index__ = c.__index__, h.__values__ = c.__values__, h; } - function lM(c, h, y) { - (y ? ri(c, h, y) : h === r) ? h = 1 : h = _n(ar(h), 0); + function xM(c, h, y) { + (y ? ri(c, h, y) : h === r) ? h = 1 : h = _n(cr(h), 0); var O = c == null ? 0 : c.length; if (!O || h < 1) return []; - for (var q = 0, ne = 0, fe = Ie(Ih(O / h)); q < O; ) - fe[ne++] = Hi(c, q, q += h); - return fe; + for (var q = 0, ne = 0, le = Ie(Ch(O / h)); q < O; ) + le[ne++] = Hi(c, q, q += h); + return le; } - function hM(c) { + function _M(c) { for (var h = -1, y = c == null ? 0 : c.length, O = 0, q = []; ++h < y; ) { var ne = c[h]; ne && (q[O++] = ne); } return q; } - function dM() { + function EM() { var c = arguments.length; if (!c) return []; for (var h = Ie(c - 1), y = arguments[0], O = c; O--; ) h[O - 1] = arguments[O]; - return Ho(nr(y) ? ui(y) : [y], $n(h, 1)); - } - var pM = hr(function(c, h) { - return cn(c) ? of(c, $n(h, 1, cn, !0)) : []; - }), gM = hr(function(c, h) { - var y = Wi(h); - return cn(y) && (y = r), cn(c) ? of(c, $n(h, 1, cn, !0), jt(y, 2)) : []; - }), mM = hr(function(c, h) { - var y = Wi(h); - return cn(y) && (y = r), cn(c) ? of(c, $n(h, 1, cn, !0), r, y) : []; + return Vo(ir(y) ? fi(y) : [y], Bn(h, 1)); + } + var SM = hr(function(c, h) { + return cn(c) ? af(c, Bn(h, 1, cn, !0)) : []; + }), AM = hr(function(c, h) { + var y = Ki(h); + return cn(y) && (y = r), cn(c) ? af(c, Bn(h, 1, cn, !0), Ut(y, 2)) : []; + }), PM = hr(function(c, h) { + var y = Ki(h); + return cn(y) && (y = r), cn(c) ? af(c, Bn(h, 1, cn, !0), r, y) : []; }); - function vM(c, h, y) { + function MM(c, h, y) { var O = c == null ? 0 : c.length; - return O ? (h = y || h === r ? 1 : ar(h), Hi(c, h < 0 ? 0 : h, O)) : []; + return O ? (h = y || h === r ? 1 : cr(h), Hi(c, h < 0 ? 0 : h, O)) : []; } - function bM(c, h, y) { + function IM(c, h, y) { var O = c == null ? 0 : c.length; - return O ? (h = y || h === r ? 1 : ar(h), h = O - h, Hi(c, 0, h < 0 ? 0 : h)) : []; + return O ? (h = y || h === r ? 1 : cr(h), h = O - h, Hi(c, 0, h < 0 ? 0 : h)) : []; } - function yM(c, h) { - return c && c.length ? Fh(c, jt(h, 3), !0, !0) : []; + function CM(c, h) { + return c && c.length ? Fh(c, Ut(h, 3), !0, !0) : []; } - function wM(c, h) { - return c && c.length ? Fh(c, jt(h, 3), !0) : []; + function TM(c, h) { + return c && c.length ? Fh(c, Ut(h, 3), !0) : []; } - function xM(c, h, y, O) { + function RM(c, h, y, O) { var q = c == null ? 0 : c.length; - return q ? (y && typeof y != "number" && ri(c, h, y) && (y = 0, O = q), dP(c, h, y, O)) : []; + return q ? (y && typeof y != "number" && ri(c, h, y) && (y = 0, O = q), EP(c, h, y, O)) : []; } - function Ow(c, h, y) { + function Lw(c, h, y) { var O = c == null ? 0 : c.length; if (!O) return -1; - var q = y == null ? 0 : ar(y); - return q < 0 && (q = _n(O + q, 0)), vh(c, jt(h, 3), q); + var q = y == null ? 0 : cr(y); + return q < 0 && (q = _n(O + q, 0)), bh(c, Ut(h, 3), q); } - function Nw(c, h, y) { + function kw(c, h, y) { var O = c == null ? 0 : c.length; if (!O) return -1; var q = O - 1; - return y !== r && (q = ar(y), q = y < 0 ? _n(O + q, 0) : Wn(q, O - 1)), vh(c, jt(h, 3), q, !0); + return y !== r && (q = cr(y), q = y < 0 ? _n(O + q, 0) : Kn(q, O - 1)), bh(c, Ut(h, 3), q, !0); } - function Lw(c) { + function $w(c) { var h = c == null ? 0 : c.length; - return h ? $n(c, 1) : []; + return h ? Bn(c, 1) : []; } - function _M(c) { + function DM(c) { var h = c == null ? 0 : c.length; - return h ? $n(c, x) : []; + return h ? Bn(c, x) : []; } - function EM(c, h) { + function OM(c, h) { var y = c == null ? 0 : c.length; - return y ? (h = h === r ? 1 : ar(h), $n(c, h)) : []; + return y ? (h = h === r ? 1 : cr(h), Bn(c, h)) : []; } - function SM(c) { + function NM(c) { for (var h = -1, y = c == null ? 0 : c.length, O = {}; ++h < y; ) { var q = c[h]; O[q[0]] = q[1]; } return O; } - function kw(c) { + function Bw(c) { return c && c.length ? c[0] : r; } - function AM(c, h, y) { + function LM(c, h, y) { var O = c == null ? 0 : c.length; if (!O) return -1; - var q = y == null ? 0 : ar(y); - return q < 0 && (q = _n(O + q, 0)), Ic(c, h, q); + var q = y == null ? 0 : cr(y); + return q < 0 && (q = _n(O + q, 0)), Cc(c, h, q); } - function PM(c) { + function kM(c) { var h = c == null ? 0 : c.length; return h ? Hi(c, 0, -1) : []; } - var MM = hr(function(c) { + var $M = hr(function(c) { var h = Xr(c, ug); return h.length && h[0] === c[0] ? Qp(h) : []; - }), IM = hr(function(c) { - var h = Wi(c), y = Xr(c, ug); - return h === Wi(y) ? h = r : y.pop(), y.length && y[0] === c[0] ? Qp(y, jt(h, 2)) : []; - }), CM = hr(function(c) { - var h = Wi(c), y = Xr(c, ug); + }), BM = hr(function(c) { + var h = Ki(c), y = Xr(c, ug); + return h === Ki(y) ? h = r : y.pop(), y.length && y[0] === c[0] ? Qp(y, Ut(h, 2)) : []; + }), FM = hr(function(c) { + var h = Ki(c), y = Xr(c, ug); return h = typeof h == "function" ? h : r, h && y.pop(), y.length && y[0] === c[0] ? Qp(y, r, h) : []; }); - function TM(c, h) { - return c == null ? "" : PA.call(c, h); + function jM(c, h) { + return c == null ? "" : kA.call(c, h); } - function Wi(c) { + function Ki(c) { var h = c == null ? 0 : c.length; return h ? c[h - 1] : r; } - function RM(c, h, y) { + function UM(c, h, y) { var O = c == null ? 0 : c.length; if (!O) return -1; var q = O; - return y !== r && (q = ar(y), q = q < 0 ? _n(O + q, 0) : Wn(q, O - 1)), h === h ? fA(c, h, q) : vh(c, my, q, !0); + return y !== r && (q = cr(y), q = q < 0 ? _n(O + q, 0) : Kn(q, O - 1)), h === h ? wA(c, h, q) : bh(c, by, q, !0); } - function DM(c, h) { - return c && c.length ? Vy(c, ar(h)) : r; + function qM(c, h) { + return c && c.length ? Yy(c, cr(h)) : r; } - var OM = hr($w); - function $w(c, h) { + var zM = hr(Fw); + function Fw(c, h) { return c && c.length && h && h.length ? ng(c, h) : c; } - function NM(c, h, y) { - return c && c.length && h && h.length ? ng(c, h, jt(y, 2)) : c; + function WM(c, h, y) { + return c && c.length && h && h.length ? ng(c, h, Ut(y, 2)) : c; } - function LM(c, h, y) { + function HM(c, h, y) { return c && c.length && h && h.length ? ng(c, h, r, y) : c; } - var kM = co(function(c, h) { + var KM = lo(function(c, h) { var y = c == null ? 0 : c.length, O = Yp(c, h); - return Jy(c, Xr(h, function(q) { - return uo(q, y) ? +q : q; - }).sort(ow)), O; + return Zy(c, Xr(h, function(q) { + return ho(q, y) ? +q : q; + }).sort(cw)), O; }); - function $M(c, h) { + function VM(c, h) { var y = []; if (!(c && c.length)) return y; var O = -1, q = [], ne = c.length; - for (h = jt(h, 3); ++O < ne; ) { - var fe = c[O]; - h(fe, O, c) && (y.push(fe), q.push(O)); + for (h = Ut(h, 3); ++O < ne; ) { + var le = c[O]; + h(le, O, c) && (y.push(le), q.push(O)); } - return Jy(c, q), y; + return Zy(c, q), y; } function Eg(c) { - return c == null ? c : TA.call(c); + return c == null ? c : jA.call(c); } - function FM(c, h, y) { + function GM(c, h, y) { var O = c == null ? 0 : c.length; - return O ? (y && typeof y != "number" && ri(c, h, y) ? (h = 0, y = O) : (h = h == null ? 0 : ar(h), y = y === r ? O : ar(y)), Hi(c, h, y)) : []; + return O ? (y && typeof y != "number" && ri(c, h, y) ? (h = 0, y = O) : (h = h == null ? 0 : cr(h), y = y === r ? O : cr(y)), Hi(c, h, y)) : []; } - function BM(c, h) { - return $h(c, h); + function YM(c, h) { + return Bh(c, h); } - function UM(c, h, y) { - return og(c, h, jt(y, 2)); + function JM(c, h, y) { + return og(c, h, Ut(y, 2)); } - function jM(c, h) { + function XM(c, h) { var y = c == null ? 0 : c.length; if (y) { - var O = $h(c, h); - if (O < y && hs(c[O], h)) + var O = Bh(c, h); + if (O < y && ds(c[O], h)) return O; } return -1; } - function qM(c, h) { - return $h(c, h, !0); + function ZM(c, h) { + return Bh(c, h, !0); } - function zM(c, h, y) { - return og(c, h, jt(y, 2), !0); + function QM(c, h, y) { + return og(c, h, Ut(y, 2), !0); } - function HM(c, h) { + function eI(c, h) { var y = c == null ? 0 : c.length; if (y) { - var O = $h(c, h, !0) - 1; - if (hs(c[O], h)) + var O = Bh(c, h, !0) - 1; + if (ds(c[O], h)) return O; } return -1; } - function WM(c) { - return c && c.length ? Zy(c) : []; + function tI(c) { + return c && c.length ? ew(c) : []; } - function KM(c, h) { - return c && c.length ? Zy(c, jt(h, 2)) : []; + function rI(c, h) { + return c && c.length ? ew(c, Ut(h, 2)) : []; } - function VM(c) { + function nI(c) { var h = c == null ? 0 : c.length; return h ? Hi(c, 1, h) : []; } - function GM(c, h, y) { - return c && c.length ? (h = y || h === r ? 1 : ar(h), Hi(c, 0, h < 0 ? 0 : h)) : []; + function iI(c, h, y) { + return c && c.length ? (h = y || h === r ? 1 : cr(h), Hi(c, 0, h < 0 ? 0 : h)) : []; } - function YM(c, h, y) { + function sI(c, h, y) { var O = c == null ? 0 : c.length; - return O ? (h = y || h === r ? 1 : ar(h), h = O - h, Hi(c, h < 0 ? 0 : h, O)) : []; - } - function JM(c, h) { - return c && c.length ? Fh(c, jt(h, 3), !1, !0) : []; - } - function XM(c, h) { - return c && c.length ? Fh(c, jt(h, 3)) : []; - } - var ZM = hr(function(c) { - return Go($n(c, 1, cn, !0)); - }), QM = hr(function(c) { - var h = Wi(c); - return cn(h) && (h = r), Go($n(c, 1, cn, !0), jt(h, 2)); - }), eI = hr(function(c) { - var h = Wi(c); - return h = typeof h == "function" ? h : r, Go($n(c, 1, cn, !0), r, h); + return O ? (h = y || h === r ? 1 : cr(h), h = O - h, Hi(c, h < 0 ? 0 : h, O)) : []; + } + function oI(c, h) { + return c && c.length ? Fh(c, Ut(h, 3), !1, !0) : []; + } + function aI(c, h) { + return c && c.length ? Fh(c, Ut(h, 3)) : []; + } + var cI = hr(function(c) { + return Xo(Bn(c, 1, cn, !0)); + }), uI = hr(function(c) { + var h = Ki(c); + return cn(h) && (h = r), Xo(Bn(c, 1, cn, !0), Ut(h, 2)); + }), fI = hr(function(c) { + var h = Ki(c); + return h = typeof h == "function" ? h : r, Xo(Bn(c, 1, cn, !0), r, h); }); - function tI(c) { - return c && c.length ? Go(c) : []; + function lI(c) { + return c && c.length ? Xo(c) : []; } - function rI(c, h) { - return c && c.length ? Go(c, jt(h, 2)) : []; + function hI(c, h) { + return c && c.length ? Xo(c, Ut(h, 2)) : []; } - function nI(c, h) { - return h = typeof h == "function" ? h : r, c && c.length ? Go(c, r, h) : []; + function dI(c, h) { + return h = typeof h == "function" ? h : r, c && c.length ? Xo(c, r, h) : []; } function Sg(c) { if (!(c && c.length)) return []; var h = 0; - return c = zo(c, function(y) { + return c = Ko(c, function(y) { if (cn(y)) return h = _n(y.length, h), !0; - }), jp(h, function(y) { - return Xr(c, Fp(y)); + }), Up(h, function(y) { + return Xr(c, Bp(y)); }); } - function Fw(c, h) { + function jw(c, h) { if (!(c && c.length)) return []; var y = Sg(c); @@ -23535,304 +23535,304 @@ l0.exports; return Pn(h, r, O); }); } - var iI = hr(function(c, h) { - return cn(c) ? of(c, h) : []; - }), sI = hr(function(c) { - return cg(zo(c, cn)); - }), oI = hr(function(c) { - var h = Wi(c); - return cn(h) && (h = r), cg(zo(c, cn), jt(h, 2)); - }), aI = hr(function(c) { - var h = Wi(c); - return h = typeof h == "function" ? h : r, cg(zo(c, cn), r, h); - }), cI = hr(Sg); - function uI(c, h) { - return rw(c || [], h || [], sf); - } - function fI(c, h) { - return rw(c || [], h || [], uf); - } - var lI = hr(function(c) { + var pI = hr(function(c, h) { + return cn(c) ? af(c, h) : []; + }), gI = hr(function(c) { + return cg(Ko(c, cn)); + }), mI = hr(function(c) { + var h = Ki(c); + return cn(h) && (h = r), cg(Ko(c, cn), Ut(h, 2)); + }), vI = hr(function(c) { + var h = Ki(c); + return h = typeof h == "function" ? h : r, cg(Ko(c, cn), r, h); + }), bI = hr(Sg); + function yI(c, h) { + return iw(c || [], h || [], of); + } + function wI(c, h) { + return iw(c || [], h || [], ff); + } + var xI = hr(function(c) { var h = c.length, y = h > 1 ? c[h - 1] : r; - return y = typeof y == "function" ? (c.pop(), y) : r, Fw(c, y); + return y = typeof y == "function" ? (c.pop(), y) : r, jw(c, y); }); - function Bw(c) { + function Uw(c) { var h = ee(c); return h.__chain__ = !0, h; } - function hI(c, h) { + function _I(c, h) { return h(c), c; } - function Vh(c, h) { + function Gh(c, h) { return h(c); } - var dI = co(function(c) { + var EI = lo(function(c) { var h = c.length, y = h ? c[0] : 0, O = this.__wrapped__, q = function(ne) { return Yp(ne, c); }; - return h > 1 || this.__actions__.length || !(O instanceof wr) || !uo(y) ? this.thru(q) : (O = O.slice(y, +y + (h ? 1 : 0)), O.__actions__.push({ - func: Vh, + return h > 1 || this.__actions__.length || !(O instanceof wr) || !ho(y) ? this.thru(q) : (O = O.slice(y, +y + (h ? 1 : 0)), O.__actions__.push({ + func: Gh, args: [q], thisArg: r - }), new qi(O, this.__chain__).thru(function(ne) { + }), new zi(O, this.__chain__).thru(function(ne) { return h && !ne.length && ne.push(r), ne; })); }); - function pI() { - return Bw(this); + function SI() { + return Uw(this); } - function gI() { - return new qi(this.value(), this.__chain__); + function AI() { + return new zi(this.value(), this.__chain__); } - function mI() { - this.__values__ === r && (this.__values__ = Qw(this.value())); + function PI() { + this.__values__ === r && (this.__values__ = t2(this.value())); var c = this.__index__ >= this.__values__.length, h = c ? r : this.__values__[this.__index__++]; return { done: c, value: h }; } - function vI() { + function MI() { return this; } - function bI(c) { - for (var h, y = this; y instanceof Dh; ) { - var O = Dw(y); + function II(c) { + for (var h, y = this; y instanceof Oh; ) { + var O = Nw(y); O.__index__ = 0, O.__values__ = r, h ? q.__wrapped__ = O : h = O; var q = O; y = y.__wrapped__; } return q.__wrapped__ = c, h; } - function yI() { + function CI() { var c = this.__wrapped__; if (c instanceof wr) { var h = c; return this.__actions__.length && (h = new wr(this)), h = h.reverse(), h.__actions__.push({ - func: Vh, + func: Gh, args: [Eg], thisArg: r - }), new qi(h, this.__chain__); + }), new zi(h, this.__chain__); } return this.thru(Eg); } - function wI() { - return tw(this.__wrapped__, this.__actions__); + function TI() { + return nw(this.__wrapped__, this.__actions__); } - var xI = Bh(function(c, h, y) { - Tr.call(c, y) ? ++c[y] : oo(c, y, 1); + var RI = jh(function(c, h, y) { + Tr.call(c, y) ? ++c[y] : uo(c, y, 1); }); - function _I(c, h, y) { - var O = nr(c) ? py : hP; - return y && ri(c, h, y) && (h = r), O(c, jt(h, 3)); + function DI(c, h, y) { + var O = ir(c) ? my : _P; + return y && ri(c, h, y) && (h = r), O(c, Ut(h, 3)); } - function EI(c, h) { - var y = nr(c) ? zo : Fy; - return y(c, jt(h, 3)); + function OI(c, h) { + var y = ir(c) ? Ko : jy; + return y(c, Ut(h, 3)); } - var SI = hw(Ow), AI = hw(Nw); - function PI(c, h) { - return $n(Gh(c, h), 1); + var NI = pw(Lw), LI = pw(kw); + function kI(c, h) { + return Bn(Yh(c, h), 1); } - function MI(c, h) { - return $n(Gh(c, h), x); + function $I(c, h) { + return Bn(Yh(c, h), x); } - function II(c, h, y) { - return y = y === r ? 1 : ar(y), $n(Gh(c, h), y); + function BI(c, h, y) { + return y = y === r ? 1 : cr(y), Bn(Yh(c, h), y); } - function Uw(c, h) { - var y = nr(c) ? Ui : Vo; - return y(c, jt(h, 3)); + function qw(c, h) { + var y = ir(c) ? Ui : Jo; + return y(c, Ut(h, 3)); } - function jw(c, h) { - var y = nr(c) ? V9 : $y; - return y(c, jt(h, 3)); + function zw(c, h) { + var y = ir(c) ? nA : Fy; + return y(c, Ut(h, 3)); } - var CI = Bh(function(c, h, y) { - Tr.call(c, y) ? c[y].push(h) : oo(c, y, [h]); + var FI = jh(function(c, h, y) { + Tr.call(c, y) ? c[y].push(h) : uo(c, y, [h]); }); - function TI(c, h, y, O) { - c = fi(c) ? c : Uc(c), y = y && !O ? ar(y) : 0; + function jI(c, h, y, O) { + c = li(c) ? c : Uc(c), y = y && !O ? cr(y) : 0; var q = c.length; - return y < 0 && (y = _n(q + y, 0)), Qh(c) ? y <= q && c.indexOf(h, y) > -1 : !!q && Ic(c, h, y) > -1; + return y < 0 && (y = _n(q + y, 0)), ed(c) ? y <= q && c.indexOf(h, y) > -1 : !!q && Cc(c, h, y) > -1; } - var RI = hr(function(c, h, y) { - var O = -1, q = typeof h == "function", ne = fi(c) ? Ie(c.length) : []; - return Vo(c, function(fe) { - ne[++O] = q ? Pn(h, fe, y) : af(fe, h, y); + var UI = hr(function(c, h, y) { + var O = -1, q = typeof h == "function", ne = li(c) ? Ie(c.length) : []; + return Jo(c, function(le) { + ne[++O] = q ? Pn(h, le, y) : cf(le, h, y); }), ne; - }), DI = Bh(function(c, h, y) { - oo(c, y, h); + }), qI = jh(function(c, h, y) { + uo(c, y, h); }); - function Gh(c, h) { - var y = nr(c) ? Xr : Hy; - return y(c, jt(h, 3)); + function Yh(c, h) { + var y = ir(c) ? Xr : Ky; + return y(c, Ut(h, 3)); } - function OI(c, h, y, O) { - return c == null ? [] : (nr(h) || (h = h == null ? [] : [h]), y = O ? r : y, nr(y) || (y = y == null ? [] : [y]), Gy(c, h, y)); + function zI(c, h, y, O) { + return c == null ? [] : (ir(h) || (h = h == null ? [] : [h]), y = O ? r : y, ir(y) || (y = y == null ? [] : [y]), Jy(c, h, y)); } - var NI = Bh(function(c, h, y) { + var WI = jh(function(c, h, y) { c[y ? 0 : 1].push(h); }, function() { return [[], []]; }); - function LI(c, h, y) { - var O = nr(c) ? kp : by, q = arguments.length < 3; - return O(c, jt(h, 4), y, q, Vo); + function HI(c, h, y) { + var O = ir(c) ? kp : wy, q = arguments.length < 3; + return O(c, Ut(h, 4), y, q, Jo); } - function kI(c, h, y) { - var O = nr(c) ? G9 : by, q = arguments.length < 3; - return O(c, jt(h, 4), y, q, $y); + function KI(c, h, y) { + var O = ir(c) ? iA : wy, q = arguments.length < 3; + return O(c, Ut(h, 4), y, q, Fy); } - function $I(c, h) { - var y = nr(c) ? zo : Fy; - return y(c, Xh(jt(h, 3))); + function VI(c, h) { + var y = ir(c) ? Ko : jy; + return y(c, Zh(Ut(h, 3))); } - function FI(c) { - var h = nr(c) ? Oy : TP; + function GI(c) { + var h = ir(c) ? Ly : jP; return h(c); } - function BI(c, h, y) { - (y ? ri(c, h, y) : h === r) ? h = 1 : h = ar(h); - var O = nr(c) ? aP : RP; + function YI(c, h, y) { + (y ? ri(c, h, y) : h === r) ? h = 1 : h = cr(h); + var O = ir(c) ? vP : UP; return O(c, h); } - function UI(c) { - var h = nr(c) ? cP : OP; + function JI(c) { + var h = ir(c) ? bP : zP; return h(c); } - function jI(c) { + function XI(c) { if (c == null) return 0; - if (fi(c)) - return Qh(c) ? Tc(c) : c.length; - var h = Kn(c); + if (li(c)) + return ed(c) ? Rc(c) : c.length; + var h = Vn(c); return h == ie || h == Me ? c.size : tg(c).length; } - function qI(c, h, y) { - var O = nr(c) ? $p : NP; - return y && ri(c, h, y) && (h = r), O(c, jt(h, 3)); + function ZI(c, h, y) { + var O = ir(c) ? $p : WP; + return y && ri(c, h, y) && (h = r), O(c, Ut(h, 3)); } - var zI = hr(function(c, h) { + var QI = hr(function(c, h) { if (c == null) return []; var y = h.length; - return y > 1 && ri(c, h[0], h[1]) ? h = [] : y > 2 && ri(h[0], h[1], h[2]) && (h = [h[0]]), Gy(c, $n(h, 1), []); - }), Yh = EA || function() { + return y > 1 && ri(c, h[0], h[1]) ? h = [] : y > 2 && ri(h[0], h[1], h[2]) && (h = [h[0]]), Jy(c, Bn(h, 1), []); + }), Jh = OA || function() { return _r.Date.now(); }; - function HI(c, h) { + function eC(c, h) { if (typeof h != "function") - throw new ji(o); - return c = ar(c), function() { + throw new qi(o); + return c = cr(c), function() { if (--c < 1) return h.apply(this, arguments); }; } - function qw(c, h, y) { - return h = y ? r : h, h = c && h == null ? c.length : h, ao(c, R, r, r, r, r, h); + function Ww(c, h, y) { + return h = y ? r : h, h = c && h == null ? c.length : h, fo(c, R, r, r, r, r, h); } - function zw(c, h) { + function Hw(c, h) { var y; if (typeof h != "function") - throw new ji(o); - return c = ar(c), function() { + throw new qi(o); + return c = cr(c), function() { return --c > 0 && (y = h.apply(this, arguments)), c <= 1 && (h = r), y; }; } var Ag = hr(function(c, h, y) { var O = L; if (y.length) { - var q = Wo(y, Fc(Ag)); + var q = Go(y, Fc(Ag)); O |= V; } - return ao(c, O, h, y, q); - }), Hw = hr(function(c, h, y) { + return fo(c, O, h, y, q); + }), Kw = hr(function(c, h, y) { var O = L | $; if (y.length) { - var q = Wo(y, Fc(Hw)); + var q = Go(y, Fc(Kw)); O |= V; } - return ao(h, O, c, y, q); + return fo(h, O, c, y, q); }); - function Ww(c, h, y) { + function Vw(c, h, y) { h = y ? r : h; - var O = ao(c, K, r, r, r, r, r, h); - return O.placeholder = Ww.placeholder, O; + var O = fo(c, H, r, r, r, r, r, h); + return O.placeholder = Vw.placeholder, O; } - function Kw(c, h, y) { + function Gw(c, h, y) { h = y ? r : h; - var O = ao(c, H, r, r, r, r, r, h); - return O.placeholder = Kw.placeholder, O; + var O = fo(c, W, r, r, r, r, r, h); + return O.placeholder = Gw.placeholder, O; } - function Vw(c, h, y) { - var O, q, ne, fe, ge, we, He = 0, We = !1, Xe = !1, wt = !0; + function Yw(c, h, y) { + var O, q, ne, le, me, we, We = 0, He = !1, Xe = !1, wt = !0; if (typeof c != "function") - throw new ji(o); - h = Ki(h) || 0, Zr(y) && (We = !!y.leading, Xe = "maxWait" in y, ne = Xe ? _n(Ki(y.maxWait) || 0, h) : ne, wt = "trailing" in y ? !!y.trailing : wt); + throw new qi(o); + h = Vi(h) || 0, Zr(y) && (He = !!y.leading, Xe = "maxWait" in y, ne = Xe ? _n(Vi(y.maxWait) || 0, h) : ne, wt = "trailing" in y ? !!y.trailing : wt); function Ot(un) { - var ds = O, ho = q; - return O = q = r, He = un, fe = c.apply(ho, ds), fe; + var ps = O, mo = q; + return O = q = r, We = un, le = c.apply(mo, ps), le; } - function Wt(un) { - return He = un, ge = hf(vr, h), We ? Ot(un) : fe; + function Ht(un) { + return We = un, me = df(vr, h), He ? Ot(un) : le; } - function ur(un) { - var ds = un - we, ho = un - He, h2 = h - ds; - return Xe ? Wn(h2, ne - ho) : h2; + function fr(un) { + var ps = un - we, mo = un - We, p2 = h - ps; + return Xe ? Kn(p2, ne - mo) : p2; } function Kt(un) { - var ds = un - we, ho = un - He; - return we === r || ds >= h || ds < 0 || Xe && ho >= ne; + var ps = un - we, mo = un - We; + return we === r || ps >= h || ps < 0 || Xe && mo >= ne; } function vr() { - var un = Yh(); + var un = Jh(); if (Kt(un)) return Er(un); - ge = hf(vr, ur(un)); + me = df(vr, fr(un)); } function Er(un) { - return ge = r, wt && O ? Ot(un) : (O = q = r, fe); + return me = r, wt && O ? Ot(un) : (O = q = r, le); } function Ii() { - ge !== r && nw(ge), He = 0, O = we = q = ge = r; + me !== r && sw(me), We = 0, O = we = q = me = r; } function ni() { - return ge === r ? fe : Er(Yh()); + return me === r ? le : Er(Jh()); } function Ci() { - var un = Yh(), ds = Kt(un); - if (O = arguments, q = this, we = un, ds) { - if (ge === r) - return Wt(we); + var un = Jh(), ps = Kt(un); + if (O = arguments, q = this, we = un, ps) { + if (me === r) + return Ht(we); if (Xe) - return nw(ge), ge = hf(vr, h), Ot(we); + return sw(me), me = df(vr, h), Ot(we); } - return ge === r && (ge = hf(vr, h)), fe; + return me === r && (me = df(vr, h)), le; } return Ci.cancel = Ii, Ci.flush = ni, Ci; } - var WI = hr(function(c, h) { - return ky(c, 1, h); - }), KI = hr(function(c, h, y) { - return ky(c, Ki(h) || 0, y); + var tC = hr(function(c, h) { + return By(c, 1, h); + }), rC = hr(function(c, h, y) { + return By(c, Vi(h) || 0, y); }); - function VI(c) { - return ao(c, pe); + function nC(c) { + return fo(c, ge); } - function Jh(c, h) { + function Xh(c, h) { if (typeof c != "function" || h != null && typeof h != "function") - throw new ji(o); + throw new qi(o); var y = function() { var O = arguments, q = h ? h.apply(this, O) : O[0], ne = y.cache; if (ne.has(q)) return ne.get(q); - var fe = c.apply(this, O); - return y.cache = ne.set(q, fe) || ne, fe; + var le = c.apply(this, O); + return y.cache = ne.set(q, le) || ne, le; }; - return y.cache = new (Jh.Cache || so)(), y; + return y.cache = new (Xh.Cache || co)(), y; } - Jh.Cache = so; - function Xh(c) { + Xh.Cache = co; + function Zh(c) { if (typeof c != "function") - throw new ji(o); + throw new qi(o); return function() { var h = arguments; switch (h.length) { @@ -23848,141 +23848,141 @@ l0.exports; return !c.apply(this, h); }; } - function GI(c) { - return zw(2, c); + function iC(c) { + return Hw(2, c); } - var YI = LP(function(c, h) { - h = h.length == 1 && nr(h[0]) ? Xr(h[0], Ai(jt())) : Xr($n(h, 1), Ai(jt())); + var sC = HP(function(c, h) { + h = h.length == 1 && ir(h[0]) ? Xr(h[0], Ai(Ut())) : Xr(Bn(h, 1), Ai(Ut())); var y = h.length; return hr(function(O) { - for (var q = -1, ne = Wn(O.length, y); ++q < ne; ) + for (var q = -1, ne = Kn(O.length, y); ++q < ne; ) O[q] = h[q].call(this, O[q]); return Pn(c, this, O); }); }), Pg = hr(function(c, h) { - var y = Wo(h, Fc(Pg)); - return ao(c, V, r, h, y); - }), Gw = hr(function(c, h) { - var y = Wo(h, Fc(Gw)); - return ao(c, te, r, h, y); - }), JI = co(function(c, h) { - return ao(c, W, r, r, r, h); + var y = Go(h, Fc(Pg)); + return fo(c, V, r, h, y); + }), Jw = hr(function(c, h) { + var y = Go(h, Fc(Jw)); + return fo(c, te, r, h, y); + }), oC = lo(function(c, h) { + return fo(c, K, r, r, r, h); }); - function XI(c, h) { + function aC(c, h) { if (typeof c != "function") - throw new ji(o); - return h = h === r ? h : ar(h), hr(c, h); + throw new qi(o); + return h = h === r ? h : cr(h), hr(c, h); } - function ZI(c, h) { + function cC(c, h) { if (typeof c != "function") - throw new ji(o); - return h = h == null ? 0 : _n(ar(h), 0), hr(function(y) { - var O = y[h], q = Jo(y, 0, h); - return O && Ho(q, O), Pn(c, this, q); + throw new qi(o); + return h = h == null ? 0 : _n(cr(h), 0), hr(function(y) { + var O = y[h], q = Qo(y, 0, h); + return O && Vo(q, O), Pn(c, this, q); }); } - function QI(c, h, y) { + function uC(c, h, y) { var O = !0, q = !0; if (typeof c != "function") - throw new ji(o); - return Zr(y) && (O = "leading" in y ? !!y.leading : O, q = "trailing" in y ? !!y.trailing : q), Vw(c, h, { + throw new qi(o); + return Zr(y) && (O = "leading" in y ? !!y.leading : O, q = "trailing" in y ? !!y.trailing : q), Yw(c, h, { leading: O, maxWait: h, trailing: q }); } - function eC(c) { - return qw(c, 1); + function fC(c) { + return Ww(c, 1); } - function tC(c, h) { + function lC(c, h) { return Pg(fg(h), c); } - function rC() { + function hC() { if (!arguments.length) return []; var c = arguments[0]; - return nr(c) ? c : [c]; + return ir(c) ? c : [c]; } - function nC(c) { - return zi(c, A); + function dC(c) { + return Wi(c, A); } - function iC(c, h) { - return h = typeof h == "function" ? h : r, zi(c, A, h); + function pC(c, h) { + return h = typeof h == "function" ? h : r, Wi(c, A, h); } - function sC(c) { - return zi(c, g | A); + function gC(c) { + return Wi(c, p | A); } - function oC(c, h) { - return h = typeof h == "function" ? h : r, zi(c, g | A, h); + function mC(c, h) { + return h = typeof h == "function" ? h : r, Wi(c, p | A, h); } - function aC(c, h) { - return h == null || Ly(c, h, Mn(h)); + function vC(c, h) { + return h == null || $y(c, h, Mn(h)); } - function hs(c, h) { + function ds(c, h) { return c === h || c !== c && h !== h; } - var cC = zh(Zp), uC = zh(function(c, h) { + var bC = Wh(Zp), yC = Wh(function(c, h) { return c >= h; - }), Ua = jy(/* @__PURE__ */ function() { + }), za = zy(/* @__PURE__ */ function() { return arguments; - }()) ? jy : function(c) { - return en(c) && Tr.call(c, "callee") && !My.call(c, "callee"); - }, nr = Ie.isArray, fC = ei ? Ai(ei) : bP; - function fi(c) { - return c != null && Zh(c.length) && !fo(c); + }()) ? zy : function(c) { + return en(c) && Tr.call(c, "callee") && !Cy.call(c, "callee"); + }, ir = Ie.isArray, wC = ei ? Ai(ei) : IP; + function li(c) { + return c != null && Qh(c.length) && !po(c); } function cn(c) { - return en(c) && fi(c); + return en(c) && li(c); } - function lC(c) { + function xC(c) { return c === !0 || c === !1 || en(c) && ti(c) == J; } - var Xo = AA || $g, hC = us ? Ai(us) : yP; - function dC(c) { - return en(c) && c.nodeType === 1 && !df(c); + var ea = LA || $g, _C = fs ? Ai(fs) : CP; + function EC(c) { + return en(c) && c.nodeType === 1 && !pf(c); } - function pC(c) { + function SC(c) { if (c == null) return !0; - if (fi(c) && (nr(c) || typeof c == "string" || typeof c.splice == "function" || Xo(c) || Bc(c) || Ua(c))) + if (li(c) && (ir(c) || typeof c == "string" || typeof c.splice == "function" || ea(c) || jc(c) || za(c))) return !c.length; - var h = Kn(c); + var h = Vn(c); if (h == ie || h == Me) return !c.size; - if (lf(c)) + if (hf(c)) return !tg(c).length; for (var y in c) if (Tr.call(c, y)) return !1; return !0; } - function gC(c, h) { - return cf(c, h); + function AC(c, h) { + return uf(c, h); } - function mC(c, h, y) { + function PC(c, h, y) { y = typeof y == "function" ? y : r; var O = y ? y(c, h) : r; - return O === r ? cf(c, h, r, y) : !!O; + return O === r ? uf(c, h, r, y) : !!O; } function Mg(c) { if (!en(c)) return !1; var h = ti(c); - return h == X || h == T || typeof c.message == "string" && typeof c.name == "string" && !df(c); + return h == X || h == T || typeof c.message == "string" && typeof c.name == "string" && !pf(c); } - function vC(c) { - return typeof c == "number" && Cy(c); + function MC(c) { + return typeof c == "number" && Ry(c); } - function fo(c) { + function po(c) { if (!Zr(c)) return !1; var h = ti(c); - return h == re || h == de || h == Z || h == Ce; + return h == re || h == pe || h == Z || h == Ce; } - function Yw(c) { - return typeof c == "number" && c == ar(c); + function Xw(c) { + return typeof c == "number" && c == cr(c); } - function Zh(c) { + function Qh(c) { return typeof c == "number" && c > -1 && c % 1 == 0 && c <= _; } function Zr(c) { @@ -23992,90 +23992,90 @@ l0.exports; function en(c) { return c != null && typeof c == "object"; } - var Jw = Bi ? Ai(Bi) : xP; - function bC(c, h) { + var Zw = ji ? Ai(ji) : RP; + function IC(c, h) { return c === h || eg(c, h, vg(h)); } - function yC(c, h, y) { + function CC(c, h, y) { return y = typeof y == "function" ? y : r, eg(c, h, vg(h), y); } - function wC(c) { - return Xw(c) && c != +c; + function TC(c) { + return Qw(c) && c != +c; } - function xC(c) { - if (iM(c)) - throw new er(s); - return qy(c); + function RC(c) { + if (pM(c)) + throw new tr(s); + return Wy(c); } - function _C(c) { + function DC(c) { return c === null; } - function EC(c) { + function OC(c) { return c == null; } - function Xw(c) { + function Qw(c) { return typeof c == "number" || en(c) && ti(c) == ue; } - function df(c) { + function pf(c) { if (!en(c) || ti(c) != Pe) return !1; - var h = Ah(c); + var h = Ph(c); if (h === null) return !0; var y = Tr.call(h, "constructor") && h.constructor; - return typeof y == "function" && y instanceof y && xh.call(y) == yA; + return typeof y == "function" && y instanceof y && _h.call(y) == CA; } - var Ig = Ms ? Ai(Ms) : _P; - function SC(c) { - return Yw(c) && c >= -_ && c <= _; + var Ig = Is ? Ai(Is) : DP; + function NC(c) { + return Xw(c) && c >= -_ && c <= _; } - var Zw = Xu ? Ai(Xu) : EP; - function Qh(c) { - return typeof c == "string" || !nr(c) && en(c) && ti(c) == Ne; + var e2 = Zu ? Ai(Zu) : OP; + function ed(c) { + return typeof c == "string" || !ir(c) && en(c) && ti(c) == Ne; } function Mi(c) { return typeof c == "symbol" || en(c) && ti(c) == Ke; } - var Bc = Da ? Ai(Da) : SP; - function AC(c) { + var jc = La ? Ai(La) : NP; + function LC(c) { return c === r; } - function PC(c) { - return en(c) && Kn(c) == qe; + function kC(c) { + return en(c) && Vn(c) == qe; } - function MC(c) { + function $C(c) { return en(c) && ti(c) == ze; } - var IC = zh(rg), CC = zh(function(c, h) { + var BC = Wh(rg), FC = Wh(function(c, h) { return c <= h; }); - function Qw(c) { + function t2(c) { if (!c) return []; - if (fi(c)) - return Qh(c) ? fs(c) : ui(c); - if (Qu && c[Qu]) - return aA(c[Qu]()); - var h = Kn(c), y = h == ie ? zp : h == Me ? bh : Uc; + if (li(c)) + return ed(c) ? ls(c) : fi(c); + if (ef && c[ef]) + return vA(c[ef]()); + var h = Vn(c), y = h == ie ? zp : h == Me ? yh : Uc; return y(c); } - function lo(c) { + function go(c) { if (!c) return c === 0 ? c : 0; - if (c = Ki(c), c === x || c === -x) { + if (c = Vi(c), c === x || c === -x) { var h = c < 0 ? -1 : 1; return h * E; } return c === c ? c : 0; } - function ar(c) { - var h = lo(c), y = h % 1; + function cr(c) { + var h = go(c), y = h % 1; return h === h ? y ? h - y : h : 0; } - function e2(c) { - return c ? ka(ar(c), 0, P) : 0; + function r2(c) { + return c ? Fa(cr(c), 0, M) : 0; } - function Ki(c) { + function Vi(c) { if (typeof c == "number") return c; if (Mi(c)) @@ -24086,391 +24086,391 @@ l0.exports; } if (typeof c != "string") return c === 0 ? c : +c; - c = yy(c); + c = xy(c); var y = nt.test(c); - return y || pt.test(c) ? rr(c.slice(2), y ? 2 : 8) : Re.test(c) ? v : +c; + return y || pt.test(c) ? nr(c.slice(2), y ? 2 : 8) : Re.test(c) ? v : +c; } - function t2(c) { - return Cs(c, li(c)); + function n2(c) { + return Ts(c, hi(c)); } - function TC(c) { - return c ? ka(ar(c), -_, _) : c === 0 ? c : 0; + function jC(c) { + return c ? Fa(cr(c), -_, _) : c === 0 ? c : 0; } function Cr(c) { return c == null ? "" : Pi(c); } - var RC = kc(function(c, h) { - if (lf(h) || fi(h)) { - Cs(h, Mn(h), c); + var UC = $c(function(c, h) { + if (hf(h) || li(h)) { + Ts(h, Mn(h), c); return; } for (var y in h) - Tr.call(h, y) && sf(c, y, h[y]); - }), r2 = kc(function(c, h) { - Cs(h, li(h), c); - }), ed = kc(function(c, h, y, O) { - Cs(h, li(h), c, O); - }), DC = kc(function(c, h, y, O) { - Cs(h, Mn(h), c, O); - }), OC = co(Yp); - function NC(c, h) { - var y = Lc(c); - return h == null ? y : Ny(y, h); - } - var LC = hr(function(c, h) { + Tr.call(h, y) && of(c, y, h[y]); + }), i2 = $c(function(c, h) { + Ts(h, hi(h), c); + }), td = $c(function(c, h, y, O) { + Ts(h, hi(h), c, O); + }), qC = $c(function(c, h, y, O) { + Ts(h, Mn(h), c, O); + }), zC = lo(Yp); + function WC(c, h) { + var y = kc(c); + return h == null ? y : ky(y, h); + } + var HC = hr(function(c, h) { c = qr(c); var y = -1, O = h.length, q = O > 2 ? h[2] : r; for (q && ri(h[0], h[1], q) && (O = 1); ++y < O; ) - for (var ne = h[y], fe = li(ne), ge = -1, we = fe.length; ++ge < we; ) { - var He = fe[ge], We = c[He]; - (We === r || hs(We, Dc[He]) && !Tr.call(c, He)) && (c[He] = ne[He]); + for (var ne = h[y], le = hi(ne), me = -1, we = le.length; ++me < we; ) { + var We = le[me], He = c[We]; + (He === r || ds(He, Oc[We]) && !Tr.call(c, We)) && (c[We] = ne[We]); } return c; - }), kC = hr(function(c) { - return c.push(r, yw), Pn(n2, r, c); + }), KC = hr(function(c) { + return c.push(r, xw), Pn(s2, r, c); }); - function $C(c, h) { - return gy(c, jt(h, 3), Is); + function VC(c, h) { + return vy(c, Ut(h, 3), Cs); } - function FC(c, h) { - return gy(c, jt(h, 3), Xp); + function GC(c, h) { + return vy(c, Ut(h, 3), Xp); } - function BC(c, h) { - return c == null ? c : Jp(c, jt(h, 3), li); + function YC(c, h) { + return c == null ? c : Jp(c, Ut(h, 3), hi); } - function UC(c, h) { - return c == null ? c : By(c, jt(h, 3), li); + function JC(c, h) { + return c == null ? c : Uy(c, Ut(h, 3), hi); } - function jC(c, h) { - return c && Is(c, jt(h, 3)); + function XC(c, h) { + return c && Cs(c, Ut(h, 3)); } - function qC(c, h) { - return c && Xp(c, jt(h, 3)); + function ZC(c, h) { + return c && Xp(c, Ut(h, 3)); } - function zC(c) { - return c == null ? [] : Lh(c, Mn(c)); + function QC(c) { + return c == null ? [] : kh(c, Mn(c)); } - function HC(c) { - return c == null ? [] : Lh(c, li(c)); + function eT(c) { + return c == null ? [] : kh(c, hi(c)); } function Cg(c, h, y) { - var O = c == null ? r : $a(c, h); + var O = c == null ? r : ja(c, h); return O === r ? y : O; } - function WC(c, h) { - return c != null && _w(c, h, pP); + function tT(c, h) { + return c != null && Sw(c, h, SP); } function Tg(c, h) { - return c != null && _w(c, h, gP); + return c != null && Sw(c, h, AP); } - var KC = pw(function(c, h, y) { - h != null && typeof h.toString != "function" && (h = _h.call(h)), c[h] = y; - }, Dg(hi)), VC = pw(function(c, h, y) { - h != null && typeof h.toString != "function" && (h = _h.call(h)), Tr.call(c, h) ? c[h].push(y) : c[h] = [y]; - }, jt), GC = hr(af); + var rT = mw(function(c, h, y) { + h != null && typeof h.toString != "function" && (h = Eh.call(h)), c[h] = y; + }, Dg(di)), nT = mw(function(c, h, y) { + h != null && typeof h.toString != "function" && (h = Eh.call(h)), Tr.call(c, h) ? c[h].push(y) : c[h] = [y]; + }, Ut), iT = hr(cf); function Mn(c) { - return fi(c) ? Dy(c) : tg(c); + return li(c) ? Ny(c) : tg(c); } - function li(c) { - return fi(c) ? Dy(c, !0) : AP(c); + function hi(c) { + return li(c) ? Ny(c, !0) : LP(c); } - function YC(c, h) { + function sT(c, h) { var y = {}; - return h = jt(h, 3), Is(c, function(O, q, ne) { - oo(y, h(O, q, ne), O); + return h = Ut(h, 3), Cs(c, function(O, q, ne) { + uo(y, h(O, q, ne), O); }), y; } - function JC(c, h) { + function oT(c, h) { var y = {}; - return h = jt(h, 3), Is(c, function(O, q, ne) { - oo(y, q, h(O, q, ne)); + return h = Ut(h, 3), Cs(c, function(O, q, ne) { + uo(y, q, h(O, q, ne)); }), y; } - var XC = kc(function(c, h, y) { - kh(c, h, y); - }), n2 = kc(function(c, h, y, O) { - kh(c, h, y, O); - }), ZC = co(function(c, h) { + var aT = $c(function(c, h, y) { + $h(c, h, y); + }), s2 = $c(function(c, h, y, O) { + $h(c, h, y, O); + }), cT = lo(function(c, h) { var y = {}; if (c == null) return y; var O = !1; h = Xr(h, function(ne) { - return ne = Yo(ne, c), O || (O = ne.length > 1), ne; - }), Cs(c, gg(c), y), O && (y = zi(y, g | w | A, KP)); + return ne = Zo(ne, c), O || (O = ne.length > 1), ne; + }), Ts(c, gg(c), y), O && (y = Wi(y, p | w | A, rM)); for (var q = h.length; q--; ) ag(y, h[q]); return y; }); - function QC(c, h) { - return i2(c, Xh(jt(h))); + function uT(c, h) { + return o2(c, Zh(Ut(h))); } - var eT = co(function(c, h) { - return c == null ? {} : MP(c, h); + var fT = lo(function(c, h) { + return c == null ? {} : $P(c, h); }); - function i2(c, h) { + function o2(c, h) { if (c == null) return {}; var y = Xr(gg(c), function(O) { return [O]; }); - return h = jt(h), Yy(c, y, function(O, q) { + return h = Ut(h), Xy(c, y, function(O, q) { return h(O, q[0]); }); } - function tT(c, h, y) { - h = Yo(h, c); + function lT(c, h, y) { + h = Zo(h, c); var O = -1, q = h.length; for (q || (q = 1, c = r); ++O < q; ) { - var ne = c == null ? r : c[Ts(h[O])]; - ne === r && (O = q, ne = y), c = fo(ne) ? ne.call(c) : ne; + var ne = c == null ? r : c[Rs(h[O])]; + ne === r && (O = q, ne = y), c = po(ne) ? ne.call(c) : ne; } return c; } - function rT(c, h, y) { - return c == null ? c : uf(c, h, y); + function hT(c, h, y) { + return c == null ? c : ff(c, h, y); } - function nT(c, h, y, O) { - return O = typeof O == "function" ? O : r, c == null ? c : uf(c, h, y, O); + function dT(c, h, y, O) { + return O = typeof O == "function" ? O : r, c == null ? c : ff(c, h, y, O); } - var s2 = vw(Mn), o2 = vw(li); - function iT(c, h, y) { - var O = nr(c), q = O || Xo(c) || Bc(c); - if (h = jt(h, 4), y == null) { + var a2 = yw(Mn), c2 = yw(hi); + function pT(c, h, y) { + var O = ir(c), q = O || ea(c) || jc(c); + if (h = Ut(h, 4), y == null) { var ne = c && c.constructor; - q ? y = O ? new ne() : [] : Zr(c) ? y = fo(ne) ? Lc(Ah(c)) : {} : y = {}; + q ? y = O ? new ne() : [] : Zr(c) ? y = po(ne) ? kc(Ph(c)) : {} : y = {}; } - return (q ? Ui : Is)(c, function(fe, ge, we) { - return h(y, fe, ge, we); + return (q ? Ui : Cs)(c, function(le, me, we) { + return h(y, le, me, we); }), y; } - function sT(c, h) { + function gT(c, h) { return c == null ? !0 : ag(c, h); } - function oT(c, h, y) { - return c == null ? c : ew(c, h, fg(y)); + function mT(c, h, y) { + return c == null ? c : rw(c, h, fg(y)); } - function aT(c, h, y, O) { - return O = typeof O == "function" ? O : r, c == null ? c : ew(c, h, fg(y), O); + function vT(c, h, y, O) { + return O = typeof O == "function" ? O : r, c == null ? c : rw(c, h, fg(y), O); } function Uc(c) { return c == null ? [] : qp(c, Mn(c)); } - function cT(c) { - return c == null ? [] : qp(c, li(c)); + function bT(c) { + return c == null ? [] : qp(c, hi(c)); } - function uT(c, h, y) { - return y === r && (y = h, h = r), y !== r && (y = Ki(y), y = y === y ? y : 0), h !== r && (h = Ki(h), h = h === h ? h : 0), ka(Ki(c), h, y); + function yT(c, h, y) { + return y === r && (y = h, h = r), y !== r && (y = Vi(y), y = y === y ? y : 0), h !== r && (h = Vi(h), h = h === h ? h : 0), Fa(Vi(c), h, y); } - function fT(c, h, y) { - return h = lo(h), y === r ? (y = h, h = 0) : y = lo(y), c = Ki(c), mP(c, h, y); + function wT(c, h, y) { + return h = go(h), y === r ? (y = h, h = 0) : y = go(y), c = Vi(c), PP(c, h, y); } - function lT(c, h, y) { - if (y && typeof y != "boolean" && ri(c, h, y) && (h = y = r), y === r && (typeof h == "boolean" ? (y = h, h = r) : typeof c == "boolean" && (y = c, c = r)), c === r && h === r ? (c = 0, h = 1) : (c = lo(c), h === r ? (h = c, c = 0) : h = lo(h)), c > h) { + function xT(c, h, y) { + if (y && typeof y != "boolean" && ri(c, h, y) && (h = y = r), y === r && (typeof h == "boolean" ? (y = h, h = r) : typeof c == "boolean" && (y = c, c = r)), c === r && h === r ? (c = 0, h = 1) : (c = go(c), h === r ? (h = c, c = 0) : h = go(h)), c > h) { var O = c; c = h, h = O; } if (y || c % 1 || h % 1) { - var q = Ty(); - return Wn(c + q * (h - c + Ur("1e-" + ((q + "").length - 1))), h); + var q = Dy(); + return Kn(c + q * (h - c + jr("1e-" + ((q + "").length - 1))), h); } return ig(c, h); } - var hT = $c(function(c, h, y) { - return h = h.toLowerCase(), c + (y ? a2(h) : h); + var _T = Bc(function(c, h, y) { + return h = h.toLowerCase(), c + (y ? u2(h) : h); }); - function a2(c) { + function u2(c) { return Rg(Cr(c).toLowerCase()); } - function c2(c) { - return c = Cr(c), c && c.replace(et, rA).replace(Op, ""); + function f2(c) { + return c = Cr(c), c && c.replace(et, hA).replace(Op, ""); } - function dT(c, h, y) { + function ET(c, h, y) { c = Cr(c), h = Pi(h); var O = c.length; - y = y === r ? O : ka(ar(y), 0, O); + y = y === r ? O : Fa(cr(y), 0, O); var q = y; return y -= h.length, y >= 0 && c.slice(y, q) == h; } - function pT(c) { - return c = Cr(c), c && Ct.test(c) ? c.replace(Dt, nA) : c; + function ST(c) { + return c = Cr(c), c && Ct.test(c) ? c.replace(Dt, dA) : c; } - function gT(c) { - return c = Cr(c), c && Ft.test(c) ? c.replace(rt, "\\$&") : c; + function AT(c) { + return c = Cr(c), c && Bt.test(c) ? c.replace(rt, "\\$&") : c; } - var mT = $c(function(c, h, y) { + var PT = Bc(function(c, h, y) { return c + (y ? "-" : "") + h.toLowerCase(); - }), vT = $c(function(c, h, y) { + }), MT = Bc(function(c, h, y) { return c + (y ? " " : "") + h.toLowerCase(); - }), bT = lw("toLowerCase"); - function yT(c, h, y) { - c = Cr(c), h = ar(h); - var O = h ? Tc(c) : 0; + }), IT = dw("toLowerCase"); + function CT(c, h, y) { + c = Cr(c), h = cr(h); + var O = h ? Rc(c) : 0; if (!h || O >= h) return c; var q = (h - O) / 2; - return qh(Ch(q), y) + c + qh(Ih(q), y); + return zh(Th(q), y) + c + zh(Ch(q), y); } - function wT(c, h, y) { - c = Cr(c), h = ar(h); - var O = h ? Tc(c) : 0; - return h && O < h ? c + qh(h - O, y) : c; + function TT(c, h, y) { + c = Cr(c), h = cr(h); + var O = h ? Rc(c) : 0; + return h && O < h ? c + zh(h - O, y) : c; } - function xT(c, h, y) { - c = Cr(c), h = ar(h); - var O = h ? Tc(c) : 0; - return h && O < h ? qh(h - O, y) + c : c; + function RT(c, h, y) { + c = Cr(c), h = cr(h); + var O = h ? Rc(c) : 0; + return h && O < h ? zh(h - O, y) + c : c; } - function _T(c, h, y) { - return y || h == null ? h = 0 : h && (h = +h), CA(Cr(c).replace(k, ""), h || 0); + function DT(c, h, y) { + return y || h == null ? h = 0 : h && (h = +h), FA(Cr(c).replace(k, ""), h || 0); } - function ET(c, h, y) { - return (y ? ri(c, h, y) : h === r) ? h = 1 : h = ar(h), sg(Cr(c), h); + function OT(c, h, y) { + return (y ? ri(c, h, y) : h === r) ? h = 1 : h = cr(h), sg(Cr(c), h); } - function ST() { + function NT() { var c = arguments, h = Cr(c[0]); return c.length < 3 ? h : h.replace(c[1], c[2]); } - var AT = $c(function(c, h, y) { + var LT = Bc(function(c, h, y) { return c + (y ? "_" : "") + h.toLowerCase(); }); - function PT(c, h, y) { - return y && typeof y != "number" && ri(c, h, y) && (h = y = r), y = y === r ? P : y >>> 0, y ? (c = Cr(c), c && (typeof h == "string" || h != null && !Ig(h)) && (h = Pi(h), !h && Cc(c)) ? Jo(fs(c), 0, y) : c.split(h, y)) : []; + function kT(c, h, y) { + return y && typeof y != "number" && ri(c, h, y) && (h = y = r), y = y === r ? M : y >>> 0, y ? (c = Cr(c), c && (typeof h == "string" || h != null && !Ig(h)) && (h = Pi(h), !h && Tc(c)) ? Qo(ls(c), 0, y) : c.split(h, y)) : []; } - var MT = $c(function(c, h, y) { + var $T = Bc(function(c, h, y) { return c + (y ? " " : "") + Rg(h); }); - function IT(c, h, y) { - return c = Cr(c), y = y == null ? 0 : ka(ar(y), 0, c.length), h = Pi(h), c.slice(y, y + h.length) == h; + function BT(c, h, y) { + return c = Cr(c), y = y == null ? 0 : Fa(cr(y), 0, c.length), h = Pi(h), c.slice(y, y + h.length) == h; } - function CT(c, h, y) { + function FT(c, h, y) { var O = ee.templateSettings; - y && ri(c, h, y) && (h = r), c = Cr(c), h = ed({}, h, O, bw); - var q = ed({}, h.imports, O.imports, bw), ne = Mn(q), fe = qp(q, ne), ge, we, He = 0, We = h.interpolate || St, Xe = "__p += '", wt = Hp( - (h.escape || St).source + "|" + We.source + "|" + (We === Nt ? xe : St).source + "|" + (h.evaluate || St).source + "|$", + y && ri(c, h, y) && (h = r), c = Cr(c), h = td({}, h, O, ww); + var q = td({}, h.imports, O.imports, ww), ne = Mn(q), le = qp(q, ne), me, we, We = 0, He = h.interpolate || St, Xe = "__p += '", wt = Wp( + (h.escape || St).source + "|" + He.source + "|" + (He === Nt ? xe : St).source + "|" + (h.evaluate || St).source + "|$", "g" ), Ot = "//# sourceURL=" + (Tr.call(h, "sourceURL") ? (h.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++Np + "]") + ` `; c.replace(wt, function(Kt, vr, Er, Ii, ni, Ci) { - return Er || (Er = Ii), Xe += c.slice(He, Ci).replace(Tt, iA), vr && (ge = !0, Xe += `' + + return Er || (Er = Ii), Xe += c.slice(We, Ci).replace(Tt, pA), vr && (me = !0, Xe += `' + __e(` + vr + `) + '`), ni && (we = !0, Xe += `'; ` + ni + `; __p += '`), Er && (Xe += `' + ((__t = (` + Er + `)) == null ? '' : __t) + -'`), He = Ci + Kt.length, Kt; +'`), We = Ci + Kt.length, Kt; }), Xe += `'; `; - var Wt = Tr.call(h, "variable") && h.variable; - if (!Wt) + var Ht = Tr.call(h, "variable") && h.variable; + if (!Ht) Xe = `with (obj) { ` + Xe + ` } `; - else if (se.test(Wt)) - throw new er(a); - Xe = (we ? Xe.replace(Yt, "") : Xe).replace(Et, "$1").replace(Qt, "$1;"), Xe = "function(" + (Wt || "obj") + `) { -` + (Wt ? "" : `obj || (obj = {}); -`) + "var __t, __p = ''" + (ge ? ", __e = _.escape" : "") + (we ? `, __j = Array.prototype.join; + else if (se.test(Ht)) + throw new tr(a); + Xe = (we ? Xe.replace(Jt, "") : Xe).replace(Et, "$1").replace(er, "$1;"), Xe = "function(" + (Ht || "obj") + `) { +` + (Ht ? "" : `obj || (obj = {}); +`) + "var __t, __p = ''" + (me ? ", __e = _.escape" : "") + (we ? `, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } ` : `; `) + Xe + `return __p }`; - var ur = f2(function() { - return Pr(ne, Ot + "return " + Xe).apply(r, fe); + var fr = h2(function() { + return Pr(ne, Ot + "return " + Xe).apply(r, le); }); - if (ur.source = Xe, Mg(ur)) - throw ur; - return ur; + if (fr.source = Xe, Mg(fr)) + throw fr; + return fr; } - function TT(c) { + function jT(c) { return Cr(c).toLowerCase(); } - function RT(c) { + function UT(c) { return Cr(c).toUpperCase(); } - function DT(c, h, y) { + function qT(c, h, y) { if (c = Cr(c), c && (y || h === r)) - return yy(c); + return xy(c); if (!c || !(h = Pi(h))) return c; - var O = fs(c), q = fs(h), ne = wy(O, q), fe = xy(O, q) + 1; - return Jo(O, ne, fe).join(""); + var O = ls(c), q = ls(h), ne = _y(O, q), le = Ey(O, q) + 1; + return Qo(O, ne, le).join(""); } - function OT(c, h, y) { + function zT(c, h, y) { if (c = Cr(c), c && (y || h === r)) - return c.slice(0, Ey(c) + 1); + return c.slice(0, Ay(c) + 1); if (!c || !(h = Pi(h))) return c; - var O = fs(c), q = xy(O, fs(h)) + 1; - return Jo(O, 0, q).join(""); + var O = ls(c), q = Ey(O, ls(h)) + 1; + return Qo(O, 0, q).join(""); } - function NT(c, h, y) { + function WT(c, h, y) { if (c = Cr(c), c && (y || h === r)) return c.replace(k, ""); if (!c || !(h = Pi(h))) return c; - var O = fs(c), q = wy(O, fs(h)); - return Jo(O, q).join(""); + var O = ls(c), q = _y(O, ls(h)); + return Qo(O, q).join(""); } - function LT(c, h) { + function HT(c, h) { var y = Ee, O = Y; if (Zr(h)) { var q = "separator" in h ? h.separator : q; - y = "length" in h ? ar(h.length) : y, O = "omission" in h ? Pi(h.omission) : O; + y = "length" in h ? cr(h.length) : y, O = "omission" in h ? Pi(h.omission) : O; } c = Cr(c); var ne = c.length; - if (Cc(c)) { - var fe = fs(c); - ne = fe.length; + if (Tc(c)) { + var le = ls(c); + ne = le.length; } if (y >= ne) return c; - var ge = y - Tc(O); - if (ge < 1) + var me = y - Rc(O); + if (me < 1) return O; - var we = fe ? Jo(fe, 0, ge).join("") : c.slice(0, ge); + var we = le ? Qo(le, 0, me).join("") : c.slice(0, me); if (q === r) return we + O; - if (fe && (ge += we.length - ge), Ig(q)) { - if (c.slice(ge).search(q)) { - var He, We = we; - for (q.global || (q = Hp(q.source, Cr(Te.exec(q)) + "g")), q.lastIndex = 0; He = q.exec(We); ) - var Xe = He.index; - we = we.slice(0, Xe === r ? ge : Xe); + if (le && (me += we.length - me), Ig(q)) { + if (c.slice(me).search(q)) { + var We, He = we; + for (q.global || (q = Wp(q.source, Cr(Te.exec(q)) + "g")), q.lastIndex = 0; We = q.exec(He); ) + var Xe = We.index; + we = we.slice(0, Xe === r ? me : Xe); } - } else if (c.indexOf(Pi(q), ge) != ge) { + } else if (c.indexOf(Pi(q), me) != me) { var wt = we.lastIndexOf(q); wt > -1 && (we = we.slice(0, wt)); } return we + O; } - function kT(c) { - return c = Cr(c), c && kt.test(c) ? c.replace(Jt, lA) : c; + function KT(c) { + return c = Cr(c), c && kt.test(c) ? c.replace(Xt, xA) : c; } - var $T = $c(function(c, h, y) { + var VT = Bc(function(c, h, y) { return c + (y ? " " : "") + h.toUpperCase(); - }), Rg = lw("toUpperCase"); - function u2(c, h, y) { - return c = Cr(c), h = y ? r : h, h === r ? oA(c) ? pA(c) : X9(c) : c.match(h) || []; + }), Rg = dw("toUpperCase"); + function l2(c, h, y) { + return c = Cr(c), h = y ? r : h, h === r ? mA(c) ? SA(c) : aA(c) : c.match(h) || []; } - var f2 = hr(function(c, h) { + var h2 = hr(function(c, h) { try { return Pn(c, r, h); } catch (y) { - return Mg(y) ? y : new er(y); + return Mg(y) ? y : new tr(y); } - }), FT = co(function(c, h) { + }), GT = lo(function(c, h) { return Ui(h, function(y) { - y = Ts(y), oo(c, y, Ag(c[y], c)); + y = Rs(y), uo(c, y, Ag(c[y], c)); }), c; }); - function BT(c) { - var h = c == null ? 0 : c.length, y = jt(); + function YT(c) { + var h = c == null ? 0 : c.length, y = Ut(); return c = h ? Xr(c, function(O) { if (typeof O[1] != "function") - throw new ji(o); + throw new qi(o); return [y(O[0]), O[1]]; }) : [], hr(function(O) { for (var q = -1; ++q < h; ) { @@ -24480,153 +24480,153 @@ function print() { __p += __j.call(arguments, '') } } }); } - function UT(c) { - return lP(zi(c, g)); + function JT(c) { + return xP(Wi(c, p)); } function Dg(c) { return function() { return c; }; } - function jT(c, h) { + function XT(c, h) { return c == null || c !== c ? h : c; } - var qT = dw(), zT = dw(!0); - function hi(c) { + var ZT = gw(), QT = gw(!0); + function di(c) { return c; } function Og(c) { - return zy(typeof c == "function" ? c : zi(c, g)); + return Hy(typeof c == "function" ? c : Wi(c, p)); } - function HT(c) { - return Wy(zi(c, g)); + function eR(c) { + return Vy(Wi(c, p)); } - function WT(c, h) { - return Ky(c, zi(h, g)); + function tR(c, h) { + return Gy(c, Wi(h, p)); } - var KT = hr(function(c, h) { + var rR = hr(function(c, h) { return function(y) { - return af(y, c, h); + return cf(y, c, h); }; - }), VT = hr(function(c, h) { + }), nR = hr(function(c, h) { return function(y) { - return af(c, y, h); + return cf(c, y, h); }; }); function Ng(c, h, y) { - var O = Mn(h), q = Lh(h, O); - y == null && !(Zr(h) && (q.length || !O.length)) && (y = h, h = c, c = this, q = Lh(h, Mn(h))); - var ne = !(Zr(y) && "chain" in y) || !!y.chain, fe = fo(c); - return Ui(q, function(ge) { - var we = h[ge]; - c[ge] = we, fe && (c.prototype[ge] = function() { - var He = this.__chain__; - if (ne || He) { - var We = c(this.__wrapped__), Xe = We.__actions__ = ui(this.__actions__); - return Xe.push({ func: we, args: arguments, thisArg: c }), We.__chain__ = He, We; + var O = Mn(h), q = kh(h, O); + y == null && !(Zr(h) && (q.length || !O.length)) && (y = h, h = c, c = this, q = kh(h, Mn(h))); + var ne = !(Zr(y) && "chain" in y) || !!y.chain, le = po(c); + return Ui(q, function(me) { + var we = h[me]; + c[me] = we, le && (c.prototype[me] = function() { + var We = this.__chain__; + if (ne || We) { + var He = c(this.__wrapped__), Xe = He.__actions__ = fi(this.__actions__); + return Xe.push({ func: we, args: arguments, thisArg: c }), He.__chain__ = We, He; } - return we.apply(c, Ho([this.value()], arguments)); + return we.apply(c, Vo([this.value()], arguments)); }); }), c; } - function GT() { - return _r._ === this && (_r._ = wA), this; + function iR() { + return _r._ === this && (_r._ = TA), this; } function Lg() { } - function YT(c) { - return c = ar(c), hr(function(h) { - return Vy(h, c); + function sR(c) { + return c = cr(c), hr(function(h) { + return Yy(h, c); }); } - var JT = hg(Xr), XT = hg(py), ZT = hg($p); - function l2(c) { - return yg(c) ? Fp(Ts(c)) : IP(c); + var oR = hg(Xr), aR = hg(my), cR = hg($p); + function d2(c) { + return yg(c) ? Bp(Rs(c)) : BP(c); } - function QT(c) { + function uR(c) { return function(h) { - return c == null ? r : $a(c, h); + return c == null ? r : ja(c, h); }; } - var eR = gw(), tR = gw(!0); + var fR = vw(), lR = vw(!0); function kg() { return []; } function $g() { return !1; } - function rR() { + function hR() { return {}; } - function nR() { + function dR() { return ""; } - function iR() { + function pR() { return !0; } - function sR(c, h) { - if (c = ar(c), c < 1 || c > _) + function gR(c, h) { + if (c = cr(c), c < 1 || c > _) return []; - var y = P, O = Wn(c, P); - h = jt(h), c -= P; - for (var q = jp(O, h); ++y < c; ) + var y = M, O = Kn(c, M); + h = Ut(h), c -= M; + for (var q = Up(O, h); ++y < c; ) h(y); return q; } - function oR(c) { - return nr(c) ? Xr(c, Ts) : Mi(c) ? [c] : ui(Rw(Cr(c))); + function mR(c) { + return ir(c) ? Xr(c, Rs) : Mi(c) ? [c] : fi(Ow(Cr(c))); } - function aR(c) { - var h = ++bA; + function vR(c) { + var h = ++IA; return Cr(c) + h; } - var cR = jh(function(c, h) { + var bR = qh(function(c, h) { return c + h; - }, 0), uR = dg("ceil"), fR = jh(function(c, h) { + }, 0), yR = dg("ceil"), wR = qh(function(c, h) { return c / h; - }, 1), lR = dg("floor"); - function hR(c) { - return c && c.length ? Nh(c, hi, Zp) : r; + }, 1), xR = dg("floor"); + function _R(c) { + return c && c.length ? Lh(c, di, Zp) : r; } - function dR(c, h) { - return c && c.length ? Nh(c, jt(h, 2), Zp) : r; + function ER(c, h) { + return c && c.length ? Lh(c, Ut(h, 2), Zp) : r; } - function pR(c) { - return vy(c, hi); + function SR(c) { + return yy(c, di); } - function gR(c, h) { - return vy(c, jt(h, 2)); + function AR(c, h) { + return yy(c, Ut(h, 2)); } - function mR(c) { - return c && c.length ? Nh(c, hi, rg) : r; + function PR(c) { + return c && c.length ? Lh(c, di, rg) : r; } - function vR(c, h) { - return c && c.length ? Nh(c, jt(h, 2), rg) : r; + function MR(c, h) { + return c && c.length ? Lh(c, Ut(h, 2), rg) : r; } - var bR = jh(function(c, h) { + var IR = qh(function(c, h) { return c * h; - }, 1), yR = dg("round"), wR = jh(function(c, h) { + }, 1), CR = dg("round"), TR = qh(function(c, h) { return c - h; }, 0); - function xR(c) { - return c && c.length ? Up(c, hi) : 0; + function RR(c) { + return c && c.length ? jp(c, di) : 0; } - function _R(c, h) { - return c && c.length ? Up(c, jt(h, 2)) : 0; + function DR(c, h) { + return c && c.length ? jp(c, Ut(h, 2)) : 0; } - return ee.after = HI, ee.ary = qw, ee.assign = RC, ee.assignIn = r2, ee.assignInWith = ed, ee.assignWith = DC, ee.at = OC, ee.before = zw, ee.bind = Ag, ee.bindAll = FT, ee.bindKey = Hw, ee.castArray = rC, ee.chain = Bw, ee.chunk = lM, ee.compact = hM, ee.concat = dM, ee.cond = BT, ee.conforms = UT, ee.constant = Dg, ee.countBy = xI, ee.create = NC, ee.curry = Ww, ee.curryRight = Kw, ee.debounce = Vw, ee.defaults = LC, ee.defaultsDeep = kC, ee.defer = WI, ee.delay = KI, ee.difference = pM, ee.differenceBy = gM, ee.differenceWith = mM, ee.drop = vM, ee.dropRight = bM, ee.dropRightWhile = yM, ee.dropWhile = wM, ee.fill = xM, ee.filter = EI, ee.flatMap = PI, ee.flatMapDeep = MI, ee.flatMapDepth = II, ee.flatten = Lw, ee.flattenDeep = _M, ee.flattenDepth = EM, ee.flip = VI, ee.flow = qT, ee.flowRight = zT, ee.fromPairs = SM, ee.functions = zC, ee.functionsIn = HC, ee.groupBy = CI, ee.initial = PM, ee.intersection = MM, ee.intersectionBy = IM, ee.intersectionWith = CM, ee.invert = KC, ee.invertBy = VC, ee.invokeMap = RI, ee.iteratee = Og, ee.keyBy = DI, ee.keys = Mn, ee.keysIn = li, ee.map = Gh, ee.mapKeys = YC, ee.mapValues = JC, ee.matches = HT, ee.matchesProperty = WT, ee.memoize = Jh, ee.merge = XC, ee.mergeWith = n2, ee.method = KT, ee.methodOf = VT, ee.mixin = Ng, ee.negate = Xh, ee.nthArg = YT, ee.omit = ZC, ee.omitBy = QC, ee.once = GI, ee.orderBy = OI, ee.over = JT, ee.overArgs = YI, ee.overEvery = XT, ee.overSome = ZT, ee.partial = Pg, ee.partialRight = Gw, ee.partition = NI, ee.pick = eT, ee.pickBy = i2, ee.property = l2, ee.propertyOf = QT, ee.pull = OM, ee.pullAll = $w, ee.pullAllBy = NM, ee.pullAllWith = LM, ee.pullAt = kM, ee.range = eR, ee.rangeRight = tR, ee.rearg = JI, ee.reject = $I, ee.remove = $M, ee.rest = XI, ee.reverse = Eg, ee.sampleSize = BI, ee.set = rT, ee.setWith = nT, ee.shuffle = UI, ee.slice = FM, ee.sortBy = zI, ee.sortedUniq = WM, ee.sortedUniqBy = KM, ee.split = PT, ee.spread = ZI, ee.tail = VM, ee.take = GM, ee.takeRight = YM, ee.takeRightWhile = JM, ee.takeWhile = XM, ee.tap = hI, ee.throttle = QI, ee.thru = Vh, ee.toArray = Qw, ee.toPairs = s2, ee.toPairsIn = o2, ee.toPath = oR, ee.toPlainObject = t2, ee.transform = iT, ee.unary = eC, ee.union = ZM, ee.unionBy = QM, ee.unionWith = eI, ee.uniq = tI, ee.uniqBy = rI, ee.uniqWith = nI, ee.unset = sT, ee.unzip = Sg, ee.unzipWith = Fw, ee.update = oT, ee.updateWith = aT, ee.values = Uc, ee.valuesIn = cT, ee.without = iI, ee.words = u2, ee.wrap = tC, ee.xor = sI, ee.xorBy = oI, ee.xorWith = aI, ee.zip = cI, ee.zipObject = uI, ee.zipObjectDeep = fI, ee.zipWith = lI, ee.entries = s2, ee.entriesIn = o2, ee.extend = r2, ee.extendWith = ed, Ng(ee, ee), ee.add = cR, ee.attempt = f2, ee.camelCase = hT, ee.capitalize = a2, ee.ceil = uR, ee.clamp = uT, ee.clone = nC, ee.cloneDeep = sC, ee.cloneDeepWith = oC, ee.cloneWith = iC, ee.conformsTo = aC, ee.deburr = c2, ee.defaultTo = jT, ee.divide = fR, ee.endsWith = dT, ee.eq = hs, ee.escape = pT, ee.escapeRegExp = gT, ee.every = _I, ee.find = SI, ee.findIndex = Ow, ee.findKey = $C, ee.findLast = AI, ee.findLastIndex = Nw, ee.findLastKey = FC, ee.floor = lR, ee.forEach = Uw, ee.forEachRight = jw, ee.forIn = BC, ee.forInRight = UC, ee.forOwn = jC, ee.forOwnRight = qC, ee.get = Cg, ee.gt = cC, ee.gte = uC, ee.has = WC, ee.hasIn = Tg, ee.head = kw, ee.identity = hi, ee.includes = TI, ee.indexOf = AM, ee.inRange = fT, ee.invoke = GC, ee.isArguments = Ua, ee.isArray = nr, ee.isArrayBuffer = fC, ee.isArrayLike = fi, ee.isArrayLikeObject = cn, ee.isBoolean = lC, ee.isBuffer = Xo, ee.isDate = hC, ee.isElement = dC, ee.isEmpty = pC, ee.isEqual = gC, ee.isEqualWith = mC, ee.isError = Mg, ee.isFinite = vC, ee.isFunction = fo, ee.isInteger = Yw, ee.isLength = Zh, ee.isMap = Jw, ee.isMatch = bC, ee.isMatchWith = yC, ee.isNaN = wC, ee.isNative = xC, ee.isNil = EC, ee.isNull = _C, ee.isNumber = Xw, ee.isObject = Zr, ee.isObjectLike = en, ee.isPlainObject = df, ee.isRegExp = Ig, ee.isSafeInteger = SC, ee.isSet = Zw, ee.isString = Qh, ee.isSymbol = Mi, ee.isTypedArray = Bc, ee.isUndefined = AC, ee.isWeakMap = PC, ee.isWeakSet = MC, ee.join = TM, ee.kebabCase = mT, ee.last = Wi, ee.lastIndexOf = RM, ee.lowerCase = vT, ee.lowerFirst = bT, ee.lt = IC, ee.lte = CC, ee.max = hR, ee.maxBy = dR, ee.mean = pR, ee.meanBy = gR, ee.min = mR, ee.minBy = vR, ee.stubArray = kg, ee.stubFalse = $g, ee.stubObject = rR, ee.stubString = nR, ee.stubTrue = iR, ee.multiply = bR, ee.nth = DM, ee.noConflict = GT, ee.noop = Lg, ee.now = Yh, ee.pad = yT, ee.padEnd = wT, ee.padStart = xT, ee.parseInt = _T, ee.random = lT, ee.reduce = LI, ee.reduceRight = kI, ee.repeat = ET, ee.replace = ST, ee.result = tT, ee.round = yR, ee.runInContext = be, ee.sample = FI, ee.size = jI, ee.snakeCase = AT, ee.some = qI, ee.sortedIndex = BM, ee.sortedIndexBy = UM, ee.sortedIndexOf = jM, ee.sortedLastIndex = qM, ee.sortedLastIndexBy = zM, ee.sortedLastIndexOf = HM, ee.startCase = MT, ee.startsWith = IT, ee.subtract = wR, ee.sum = xR, ee.sumBy = _R, ee.template = CT, ee.times = sR, ee.toFinite = lo, ee.toInteger = ar, ee.toLength = e2, ee.toLower = TT, ee.toNumber = Ki, ee.toSafeInteger = TC, ee.toString = Cr, ee.toUpper = RT, ee.trim = DT, ee.trimEnd = OT, ee.trimStart = NT, ee.truncate = LT, ee.unescape = kT, ee.uniqueId = aR, ee.upperCase = $T, ee.upperFirst = Rg, ee.each = Uw, ee.eachRight = jw, ee.first = kw, Ng(ee, function() { + return ee.after = eC, ee.ary = Ww, ee.assign = UC, ee.assignIn = i2, ee.assignInWith = td, ee.assignWith = qC, ee.at = zC, ee.before = Hw, ee.bind = Ag, ee.bindAll = GT, ee.bindKey = Kw, ee.castArray = hC, ee.chain = Uw, ee.chunk = xM, ee.compact = _M, ee.concat = EM, ee.cond = YT, ee.conforms = JT, ee.constant = Dg, ee.countBy = RI, ee.create = WC, ee.curry = Vw, ee.curryRight = Gw, ee.debounce = Yw, ee.defaults = HC, ee.defaultsDeep = KC, ee.defer = tC, ee.delay = rC, ee.difference = SM, ee.differenceBy = AM, ee.differenceWith = PM, ee.drop = MM, ee.dropRight = IM, ee.dropRightWhile = CM, ee.dropWhile = TM, ee.fill = RM, ee.filter = OI, ee.flatMap = kI, ee.flatMapDeep = $I, ee.flatMapDepth = BI, ee.flatten = $w, ee.flattenDeep = DM, ee.flattenDepth = OM, ee.flip = nC, ee.flow = ZT, ee.flowRight = QT, ee.fromPairs = NM, ee.functions = QC, ee.functionsIn = eT, ee.groupBy = FI, ee.initial = kM, ee.intersection = $M, ee.intersectionBy = BM, ee.intersectionWith = FM, ee.invert = rT, ee.invertBy = nT, ee.invokeMap = UI, ee.iteratee = Og, ee.keyBy = qI, ee.keys = Mn, ee.keysIn = hi, ee.map = Yh, ee.mapKeys = sT, ee.mapValues = oT, ee.matches = eR, ee.matchesProperty = tR, ee.memoize = Xh, ee.merge = aT, ee.mergeWith = s2, ee.method = rR, ee.methodOf = nR, ee.mixin = Ng, ee.negate = Zh, ee.nthArg = sR, ee.omit = cT, ee.omitBy = uT, ee.once = iC, ee.orderBy = zI, ee.over = oR, ee.overArgs = sC, ee.overEvery = aR, ee.overSome = cR, ee.partial = Pg, ee.partialRight = Jw, ee.partition = WI, ee.pick = fT, ee.pickBy = o2, ee.property = d2, ee.propertyOf = uR, ee.pull = zM, ee.pullAll = Fw, ee.pullAllBy = WM, ee.pullAllWith = HM, ee.pullAt = KM, ee.range = fR, ee.rangeRight = lR, ee.rearg = oC, ee.reject = VI, ee.remove = VM, ee.rest = aC, ee.reverse = Eg, ee.sampleSize = YI, ee.set = hT, ee.setWith = dT, ee.shuffle = JI, ee.slice = GM, ee.sortBy = QI, ee.sortedUniq = tI, ee.sortedUniqBy = rI, ee.split = kT, ee.spread = cC, ee.tail = nI, ee.take = iI, ee.takeRight = sI, ee.takeRightWhile = oI, ee.takeWhile = aI, ee.tap = _I, ee.throttle = uC, ee.thru = Gh, ee.toArray = t2, ee.toPairs = a2, ee.toPairsIn = c2, ee.toPath = mR, ee.toPlainObject = n2, ee.transform = pT, ee.unary = fC, ee.union = cI, ee.unionBy = uI, ee.unionWith = fI, ee.uniq = lI, ee.uniqBy = hI, ee.uniqWith = dI, ee.unset = gT, ee.unzip = Sg, ee.unzipWith = jw, ee.update = mT, ee.updateWith = vT, ee.values = Uc, ee.valuesIn = bT, ee.without = pI, ee.words = l2, ee.wrap = lC, ee.xor = gI, ee.xorBy = mI, ee.xorWith = vI, ee.zip = bI, ee.zipObject = yI, ee.zipObjectDeep = wI, ee.zipWith = xI, ee.entries = a2, ee.entriesIn = c2, ee.extend = i2, ee.extendWith = td, Ng(ee, ee), ee.add = bR, ee.attempt = h2, ee.camelCase = _T, ee.capitalize = u2, ee.ceil = yR, ee.clamp = yT, ee.clone = dC, ee.cloneDeep = gC, ee.cloneDeepWith = mC, ee.cloneWith = pC, ee.conformsTo = vC, ee.deburr = f2, ee.defaultTo = XT, ee.divide = wR, ee.endsWith = ET, ee.eq = ds, ee.escape = ST, ee.escapeRegExp = AT, ee.every = DI, ee.find = NI, ee.findIndex = Lw, ee.findKey = VC, ee.findLast = LI, ee.findLastIndex = kw, ee.findLastKey = GC, ee.floor = xR, ee.forEach = qw, ee.forEachRight = zw, ee.forIn = YC, ee.forInRight = JC, ee.forOwn = XC, ee.forOwnRight = ZC, ee.get = Cg, ee.gt = bC, ee.gte = yC, ee.has = tT, ee.hasIn = Tg, ee.head = Bw, ee.identity = di, ee.includes = jI, ee.indexOf = LM, ee.inRange = wT, ee.invoke = iT, ee.isArguments = za, ee.isArray = ir, ee.isArrayBuffer = wC, ee.isArrayLike = li, ee.isArrayLikeObject = cn, ee.isBoolean = xC, ee.isBuffer = ea, ee.isDate = _C, ee.isElement = EC, ee.isEmpty = SC, ee.isEqual = AC, ee.isEqualWith = PC, ee.isError = Mg, ee.isFinite = MC, ee.isFunction = po, ee.isInteger = Xw, ee.isLength = Qh, ee.isMap = Zw, ee.isMatch = IC, ee.isMatchWith = CC, ee.isNaN = TC, ee.isNative = RC, ee.isNil = OC, ee.isNull = DC, ee.isNumber = Qw, ee.isObject = Zr, ee.isObjectLike = en, ee.isPlainObject = pf, ee.isRegExp = Ig, ee.isSafeInteger = NC, ee.isSet = e2, ee.isString = ed, ee.isSymbol = Mi, ee.isTypedArray = jc, ee.isUndefined = LC, ee.isWeakMap = kC, ee.isWeakSet = $C, ee.join = jM, ee.kebabCase = PT, ee.last = Ki, ee.lastIndexOf = UM, ee.lowerCase = MT, ee.lowerFirst = IT, ee.lt = BC, ee.lte = FC, ee.max = _R, ee.maxBy = ER, ee.mean = SR, ee.meanBy = AR, ee.min = PR, ee.minBy = MR, ee.stubArray = kg, ee.stubFalse = $g, ee.stubObject = hR, ee.stubString = dR, ee.stubTrue = pR, ee.multiply = IR, ee.nth = qM, ee.noConflict = iR, ee.noop = Lg, ee.now = Jh, ee.pad = CT, ee.padEnd = TT, ee.padStart = RT, ee.parseInt = DT, ee.random = xT, ee.reduce = HI, ee.reduceRight = KI, ee.repeat = OT, ee.replace = NT, ee.result = lT, ee.round = CR, ee.runInContext = be, ee.sample = GI, ee.size = XI, ee.snakeCase = LT, ee.some = ZI, ee.sortedIndex = YM, ee.sortedIndexBy = JM, ee.sortedIndexOf = XM, ee.sortedLastIndex = ZM, ee.sortedLastIndexBy = QM, ee.sortedLastIndexOf = eI, ee.startCase = $T, ee.startsWith = BT, ee.subtract = TR, ee.sum = RR, ee.sumBy = DR, ee.template = FT, ee.times = gR, ee.toFinite = go, ee.toInteger = cr, ee.toLength = r2, ee.toLower = jT, ee.toNumber = Vi, ee.toSafeInteger = jC, ee.toString = Cr, ee.toUpper = UT, ee.trim = qT, ee.trimEnd = zT, ee.trimStart = WT, ee.truncate = HT, ee.unescape = KT, ee.uniqueId = vR, ee.upperCase = VT, ee.upperFirst = Rg, ee.each = qw, ee.eachRight = zw, ee.first = Bw, Ng(ee, function() { var c = {}; - return Is(ee, function(h, y) { + return Cs(ee, function(h, y) { Tr.call(ee.prototype, y) || (c[y] = h); }), c; }(), { chain: !1 }), ee.VERSION = n, Ui(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(c) { ee[c].placeholder = ee; }), Ui(["drop", "take"], function(c, h) { wr.prototype[c] = function(y) { - y = y === r ? 1 : _n(ar(y), 0); + y = y === r ? 1 : _n(cr(y), 0); var O = this.__filtered__ && !h ? new wr(this) : this.clone(); - return O.__filtered__ ? O.__takeCount__ = Wn(y, O.__takeCount__) : O.__views__.push({ - size: Wn(y, P), + return O.__filtered__ ? O.__takeCount__ = Kn(y, O.__takeCount__) : O.__views__.push({ + size: Kn(y, M), type: c + (O.__dir__ < 0 ? "Right" : "") }), O; }, wr.prototype[c + "Right"] = function(y) { @@ -24637,7 +24637,7 @@ function print() { __p += __j.call(arguments, '') } wr.prototype[c] = function(q) { var ne = this.clone(); return ne.__iteratees__.push({ - iteratee: jt(q, 3), + iteratee: Ut(q, 3), type: y }), ne.__filtered__ = ne.__filtered__ || O, ne; }; @@ -24652,68 +24652,68 @@ function print() { __p += __j.call(arguments, '') } return this.__filtered__ ? new wr(this) : this[y](1); }; }), wr.prototype.compact = function() { - return this.filter(hi); + return this.filter(di); }, wr.prototype.find = function(c) { return this.filter(c).head(); }, wr.prototype.findLast = function(c) { return this.reverse().find(c); }, wr.prototype.invokeMap = hr(function(c, h) { return typeof c == "function" ? new wr(this) : this.map(function(y) { - return af(y, c, h); + return cf(y, c, h); }); }), wr.prototype.reject = function(c) { - return this.filter(Xh(jt(c))); + return this.filter(Zh(Ut(c))); }, wr.prototype.slice = function(c, h) { - c = ar(c); + c = cr(c); var y = this; - return y.__filtered__ && (c > 0 || h < 0) ? new wr(y) : (c < 0 ? y = y.takeRight(-c) : c && (y = y.drop(c)), h !== r && (h = ar(h), y = h < 0 ? y.dropRight(-h) : y.take(h - c)), y); + return y.__filtered__ && (c > 0 || h < 0) ? new wr(y) : (c < 0 ? y = y.takeRight(-c) : c && (y = y.drop(c)), h !== r && (h = cr(h), y = h < 0 ? y.dropRight(-h) : y.take(h - c)), y); }, wr.prototype.takeRightWhile = function(c) { return this.reverse().takeWhile(c).reverse(); }, wr.prototype.toArray = function() { - return this.take(P); - }, Is(wr.prototype, function(c, h) { + return this.take(M); + }, Cs(wr.prototype, function(c, h) { var y = /^(?:filter|find|map|reject)|While$/.test(h), O = /^(?:head|last)$/.test(h), q = ee[O ? "take" + (h == "last" ? "Right" : "") : h], ne = O || /^find/.test(h); q && (ee.prototype[h] = function() { - var fe = this.__wrapped__, ge = O ? [1] : arguments, we = fe instanceof wr, He = ge[0], We = we || nr(fe), Xe = function(vr) { - var Er = q.apply(ee, Ho([vr], ge)); + var le = this.__wrapped__, me = O ? [1] : arguments, we = le instanceof wr, We = me[0], He = we || ir(le), Xe = function(vr) { + var Er = q.apply(ee, Vo([vr], me)); return O && wt ? Er[0] : Er; }; - We && y && typeof He == "function" && He.length != 1 && (we = We = !1); - var wt = this.__chain__, Ot = !!this.__actions__.length, Wt = ne && !wt, ur = we && !Ot; - if (!ne && We) { - fe = ur ? fe : new wr(this); - var Kt = c.apply(fe, ge); - return Kt.__actions__.push({ func: Vh, args: [Xe], thisArg: r }), new qi(Kt, wt); + He && y && typeof We == "function" && We.length != 1 && (we = He = !1); + var wt = this.__chain__, Ot = !!this.__actions__.length, Ht = ne && !wt, fr = we && !Ot; + if (!ne && He) { + le = fr ? le : new wr(this); + var Kt = c.apply(le, me); + return Kt.__actions__.push({ func: Gh, args: [Xe], thisArg: r }), new zi(Kt, wt); } - return Wt && ur ? c.apply(this, ge) : (Kt = this.thru(Xe), Wt ? O ? Kt.value()[0] : Kt.value() : Kt); + return Ht && fr ? c.apply(this, me) : (Kt = this.thru(Xe), Ht ? O ? Kt.value()[0] : Kt.value() : Kt); }); }), Ui(["pop", "push", "shift", "sort", "splice", "unshift"], function(c) { - var h = yh[c], y = /^(?:push|sort|unshift)$/.test(c) ? "tap" : "thru", O = /^(?:pop|shift)$/.test(c); + var h = wh[c], y = /^(?:push|sort|unshift)$/.test(c) ? "tap" : "thru", O = /^(?:pop|shift)$/.test(c); ee.prototype[c] = function() { var q = arguments; if (O && !this.__chain__) { var ne = this.value(); - return h.apply(nr(ne) ? ne : [], q); + return h.apply(ir(ne) ? ne : [], q); } - return this[y](function(fe) { - return h.apply(nr(fe) ? fe : [], q); + return this[y](function(le) { + return h.apply(ir(le) ? le : [], q); }); }; - }), Is(wr.prototype, function(c, h) { + }), Cs(wr.prototype, function(c, h) { var y = ee[h]; if (y) { var O = y.name + ""; - Tr.call(Nc, O) || (Nc[O] = []), Nc[O].push({ name: h, func: y }); + Tr.call(Lc, O) || (Lc[O] = []), Lc[O].push({ name: h, func: y }); } - }), Nc[Uh(r, $).name] = [{ + }), Lc[Uh(r, $).name] = [{ name: "wrapper", func: r - }], wr.prototype.clone = kA, wr.prototype.reverse = $A, wr.prototype.value = FA, ee.prototype.at = dI, ee.prototype.chain = pI, ee.prototype.commit = gI, ee.prototype.next = mI, ee.prototype.plant = bI, ee.prototype.reverse = yI, ee.prototype.toJSON = ee.prototype.valueOf = ee.prototype.value = wI, ee.prototype.first = ee.prototype.head, Qu && (ee.prototype[Qu] = vI), ee; - }, Rc = gA(); - an ? ((an.exports = Rc)._ = Rc, jr._ = Rc) : _r._ = Rc; + }], wr.prototype.clone = KA, wr.prototype.reverse = VA, wr.prototype.value = GA, ee.prototype.at = EI, ee.prototype.chain = SI, ee.prototype.commit = AI, ee.prototype.next = PI, ee.prototype.plant = II, ee.prototype.reverse = CI, ee.prototype.toJSON = ee.prototype.valueOf = ee.prototype.value = TI, ee.prototype.first = ee.prototype.head, ef && (ee.prototype[ef] = MI), ee; + }, Dc = AA(); + an ? ((an.exports = Dc)._ = Dc, Ur._ = Dc) : _r._ = Dc; }).call(gn); -})(l0, l0.exports); -var jV = l0.exports, O1 = { exports: {} }; +})(h0, h0.exports); +var XV = h0.exports, O1 = { exports: {} }; (function(t, e) { var r = typeof self < "u" ? self : gn, n = function() { function s() { @@ -24753,7 +24753,7 @@ var jV = l0.exports, O1 = { exports: {} }; ], d = ArrayBuffer.isView || function(f) { return f && l.indexOf(Object.prototype.toString.call(f)) > -1; }; - function g(f) { + function p(f) { if (typeof f != "string" && (f = String(f)), /[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f)) throw new TypeError("Invalid character in header field name"); return f.toLowerCase(); @@ -24762,92 +24762,92 @@ var jV = l0.exports, O1 = { exports: {} }; return typeof f != "string" && (f = String(f)), f; } function A(f) { - var p = { + var g = { next: function() { var b = f.shift(); return { done: b === void 0, value: b }; } }; - return a.iterable && (p[Symbol.iterator] = function() { - return p; - }), p; + return a.iterable && (g[Symbol.iterator] = function() { + return g; + }), g; } - function M(f) { - this.map = {}, f instanceof M ? f.forEach(function(p, b) { - this.append(b, p); - }, this) : Array.isArray(f) ? f.forEach(function(p) { - this.append(p[0], p[1]); - }, this) : f && Object.getOwnPropertyNames(f).forEach(function(p) { - this.append(p, f[p]); + function P(f) { + this.map = {}, f instanceof P ? f.forEach(function(g, b) { + this.append(b, g); + }, this) : Array.isArray(f) ? f.forEach(function(g) { + this.append(g[0], g[1]); + }, this) : f && Object.getOwnPropertyNames(f).forEach(function(g) { + this.append(g, f[g]); }, this); } - M.prototype.append = function(f, p) { - f = g(f), p = w(p); + P.prototype.append = function(f, g) { + f = p(f), g = w(g); var b = this.map[f]; - this.map[f] = b ? b + ", " + p : p; - }, M.prototype.delete = function(f) { - delete this.map[g(f)]; - }, M.prototype.get = function(f) { - return f = g(f), this.has(f) ? this.map[f] : null; - }, M.prototype.has = function(f) { - return this.map.hasOwnProperty(g(f)); - }, M.prototype.set = function(f, p) { - this.map[g(f)] = w(p); - }, M.prototype.forEach = function(f, p) { + this.map[f] = b ? b + ", " + g : g; + }, P.prototype.delete = function(f) { + delete this.map[p(f)]; + }, P.prototype.get = function(f) { + return f = p(f), this.has(f) ? this.map[f] : null; + }, P.prototype.has = function(f) { + return this.map.hasOwnProperty(p(f)); + }, P.prototype.set = function(f, g) { + this.map[p(f)] = w(g); + }, P.prototype.forEach = function(f, g) { for (var b in this.map) - this.map.hasOwnProperty(b) && f.call(p, this.map[b], b, this); - }, M.prototype.keys = function() { + this.map.hasOwnProperty(b) && f.call(g, this.map[b], b, this); + }, P.prototype.keys = function() { var f = []; - return this.forEach(function(p, b) { + return this.forEach(function(g, b) { f.push(b); }), A(f); - }, M.prototype.values = function() { + }, P.prototype.values = function() { var f = []; - return this.forEach(function(p) { - f.push(p); + return this.forEach(function(g) { + f.push(g); }), A(f); - }, M.prototype.entries = function() { + }, P.prototype.entries = function() { var f = []; - return this.forEach(function(p, b) { - f.push([b, p]); + return this.forEach(function(g, b) { + f.push([b, g]); }), A(f); - }, a.iterable && (M.prototype[Symbol.iterator] = M.prototype.entries); + }, a.iterable && (P.prototype[Symbol.iterator] = P.prototype.entries); function N(f) { if (f.bodyUsed) return Promise.reject(new TypeError("Already read")); f.bodyUsed = !0; } function L(f) { - return new Promise(function(p, b) { + return new Promise(function(g, b) { f.onload = function() { - p(f.result); + g(f.result); }, f.onerror = function() { b(f.error); }; }); } function $(f) { - var p = new FileReader(), b = L(p); - return p.readAsArrayBuffer(f), b; + var g = new FileReader(), b = L(g); + return g.readAsArrayBuffer(f), b; } - function F(f) { - var p = new FileReader(), b = L(p); - return p.readAsText(f), b; + function B(f) { + var g = new FileReader(), b = L(g); + return g.readAsText(f), b; } - function K(f) { - for (var p = new Uint8Array(f), b = new Array(p.length), x = 0; x < p.length; x++) - b[x] = String.fromCharCode(p[x]); + function H(f) { + for (var g = new Uint8Array(f), b = new Array(g.length), x = 0; x < g.length; x++) + b[x] = String.fromCharCode(g[x]); return b.join(""); } - function H(f) { + function W(f) { if (f.slice) return f.slice(0); - var p = new Uint8Array(f.byteLength); - return p.set(new Uint8Array(f)), p.buffer; + var g = new Uint8Array(f.byteLength); + return g.set(new Uint8Array(f)), g.buffer; } function V() { return this.bodyUsed = !1, this._initBody = function(f) { - this._bodyInit = f, f ? typeof f == "string" ? this._bodyText = f : a.blob && Blob.prototype.isPrototypeOf(f) ? this._bodyBlob = f : a.formData && FormData.prototype.isPrototypeOf(f) ? this._bodyFormData = f : a.searchParams && URLSearchParams.prototype.isPrototypeOf(f) ? this._bodyText = f.toString() : a.arrayBuffer && a.blob && u(f) ? (this._bodyArrayBuffer = H(f.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(f) || d(f)) ? this._bodyArrayBuffer = H(f) : this._bodyText = f = Object.prototype.toString.call(f) : this._bodyText = "", this.headers.get("content-type") || (typeof f == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : a.searchParams && URLSearchParams.prototype.isPrototypeOf(f) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8")); + this._bodyInit = f, f ? typeof f == "string" ? this._bodyText = f : a.blob && Blob.prototype.isPrototypeOf(f) ? this._bodyBlob = f : a.formData && FormData.prototype.isPrototypeOf(f) ? this._bodyFormData = f : a.searchParams && URLSearchParams.prototype.isPrototypeOf(f) ? this._bodyText = f.toString() : a.arrayBuffer && a.blob && u(f) ? (this._bodyArrayBuffer = W(f.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(f) || d(f)) ? this._bodyArrayBuffer = W(f) : this._bodyText = f = Object.prototype.toString.call(f) : this._bodyText = "", this.headers.get("content-type") || (typeof f == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : a.searchParams && URLSearchParams.prototype.isPrototypeOf(f) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8")); }, a.blob && (this.blob = function() { var f = N(this); if (f) @@ -24866,67 +24866,67 @@ var jV = l0.exports, O1 = { exports: {} }; if (f) return f; if (this._bodyBlob) - return F(this._bodyBlob); + return B(this._bodyBlob); if (this._bodyArrayBuffer) - return Promise.resolve(K(this._bodyArrayBuffer)); + return Promise.resolve(H(this._bodyArrayBuffer)); if (this._bodyFormData) throw new Error("could not read FormData body as text"); return Promise.resolve(this._bodyText); }, a.formData && (this.formData = function() { - return this.text().then(pe); + return this.text().then(ge); }), this.json = function() { return this.text().then(JSON.parse); }, this; } var te = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"]; function R(f) { - var p = f.toUpperCase(); - return te.indexOf(p) > -1 ? p : f; + var g = f.toUpperCase(); + return te.indexOf(g) > -1 ? g : f; } - function W(f, p) { - p = p || {}; - var b = p.body; - if (f instanceof W) { + function K(f, g) { + g = g || {}; + var b = g.body; + if (f instanceof K) { if (f.bodyUsed) throw new TypeError("Already read"); - this.url = f.url, this.credentials = f.credentials, p.headers || (this.headers = new M(f.headers)), this.method = f.method, this.mode = f.mode, this.signal = f.signal, !b && f._bodyInit != null && (b = f._bodyInit, f.bodyUsed = !0); + this.url = f.url, this.credentials = f.credentials, g.headers || (this.headers = new P(f.headers)), this.method = f.method, this.mode = f.mode, this.signal = f.signal, !b && f._bodyInit != null && (b = f._bodyInit, f.bodyUsed = !0); } else this.url = String(f); - if (this.credentials = p.credentials || this.credentials || "same-origin", (p.headers || !this.headers) && (this.headers = new M(p.headers)), this.method = R(p.method || this.method || "GET"), this.mode = p.mode || this.mode || null, this.signal = p.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && b) + if (this.credentials = g.credentials || this.credentials || "same-origin", (g.headers || !this.headers) && (this.headers = new P(g.headers)), this.method = R(g.method || this.method || "GET"), this.mode = g.mode || this.mode || null, this.signal = g.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && b) throw new TypeError("Body not allowed for GET or HEAD requests"); this._initBody(b); } - W.prototype.clone = function() { - return new W(this, { body: this._bodyInit }); + K.prototype.clone = function() { + return new K(this, { body: this._bodyInit }); }; - function pe(f) { - var p = new FormData(); + function ge(f) { + var g = new FormData(); return f.trim().split("&").forEach(function(b) { if (b) { var x = b.split("="), _ = x.shift().replace(/\+/g, " "), E = x.join("=").replace(/\+/g, " "); - p.append(decodeURIComponent(_), decodeURIComponent(E)); + g.append(decodeURIComponent(_), decodeURIComponent(E)); } - }), p; + }), g; } function Ee(f) { - var p = new M(), b = f.replace(/\r?\n[\t ]+/g, " "); + var g = new P(), b = f.replace(/\r?\n[\t ]+/g, " "); return b.split(/\r?\n/).forEach(function(x) { var _ = x.split(":"), E = _.shift().trim(); if (E) { var v = _.join(":").trim(); - p.append(E, v); + g.append(E, v); } - }), p; + }), g; } - V.call(W.prototype); - function Y(f, p) { - p || (p = {}), this.type = "default", this.status = p.status === void 0 ? 200 : p.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in p ? p.statusText : "OK", this.headers = new M(p.headers), this.url = p.url || "", this._initBody(f); + V.call(K.prototype); + function Y(f, g) { + g || (g = {}), this.type = "default", this.status = g.status === void 0 ? 200 : g.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in g ? g.statusText : "OK", this.headers = new P(g.headers), this.url = g.url || "", this._initBody(f); } V.call(Y.prototype), Y.prototype.clone = function() { return new Y(this._bodyInit, { status: this.status, statusText: this.statusText, - headers: new M(this.headers), + headers: new P(this.headers), url: this.url }); }, Y.error = function() { @@ -24934,23 +24934,23 @@ var jV = l0.exports, O1 = { exports: {} }; return f.type = "error", f; }; var S = [301, 302, 303, 307, 308]; - Y.redirect = function(f, p) { - if (S.indexOf(p) === -1) + Y.redirect = function(f, g) { + if (S.indexOf(g) === -1) throw new RangeError("Invalid status code"); - return new Y(null, { status: p, headers: { location: f } }); + return new Y(null, { status: g, headers: { location: f } }); }, o.DOMException = s.DOMException; try { new o.DOMException(); } catch { - o.DOMException = function(p, b) { - this.message = p, this.name = b; - var x = Error(p); + o.DOMException = function(g, b) { + this.message = g, this.name = b; + var x = Error(g); this.stack = x.stack; }, o.DOMException.prototype = Object.create(Error.prototype), o.DOMException.prototype.constructor = o.DOMException; } - function m(f, p) { + function m(f, g) { return new Promise(function(b, x) { - var _ = new W(f, p); + var _ = new K(f, g); if (_.signal && _.signal.aborted) return x(new o.DOMException("Aborted", "AbortError")); var E = new XMLHttpRequest(); @@ -24958,44 +24958,44 @@ var jV = l0.exports, O1 = { exports: {} }; E.abort(); } E.onload = function() { - var P = { + var M = { status: E.status, statusText: E.statusText, headers: Ee(E.getAllResponseHeaders() || "") }; - P.url = "responseURL" in E ? E.responseURL : P.headers.get("X-Request-URL"); + M.url = "responseURL" in E ? E.responseURL : M.headers.get("X-Request-URL"); var I = "response" in E ? E.response : E.responseText; - b(new Y(I, P)); + b(new Y(I, M)); }, E.onerror = function() { x(new TypeError("Network request failed")); }, E.ontimeout = function() { x(new TypeError("Network request failed")); }, E.onabort = function() { x(new o.DOMException("Aborted", "AbortError")); - }, E.open(_.method, _.url, !0), _.credentials === "include" ? E.withCredentials = !0 : _.credentials === "omit" && (E.withCredentials = !1), "responseType" in E && a.blob && (E.responseType = "blob"), _.headers.forEach(function(P, I) { - E.setRequestHeader(I, P); + }, E.open(_.method, _.url, !0), _.credentials === "include" ? E.withCredentials = !0 : _.credentials === "omit" && (E.withCredentials = !1), "responseType" in E && a.blob && (E.responseType = "blob"), _.headers.forEach(function(M, I) { + E.setRequestHeader(I, M); }), _.signal && (_.signal.addEventListener("abort", v), E.onreadystatechange = function() { E.readyState === 4 && _.signal.removeEventListener("abort", v); }), E.send(typeof _._bodyInit > "u" ? null : _._bodyInit); }); } - return m.polyfill = !0, s.fetch || (s.fetch = m, s.Headers = M, s.Request = W, s.Response = Y), o.Headers = M, o.Request = W, o.Response = Y, o.fetch = m, Object.defineProperty(o, "__esModule", { value: !0 }), o; + return m.polyfill = !0, s.fetch || (s.fetch = m, s.Headers = P, s.Request = K, s.Response = Y), o.Headers = P, o.Request = K, o.Response = Y, o.fetch = m, Object.defineProperty(o, "__esModule", { value: !0 }), o; })({}); })(n), n.fetch.ponyfill = !0, delete n.fetch.polyfill; var i = n; e = i.fetch, e.default = i.fetch, e.fetch = i.fetch, e.Headers = i.Headers, e.Request = i.Request, e.Response = i.Response, t.exports = e; })(O1, O1.exports); -var qV = O1.exports; -const k3 = /* @__PURE__ */ ts(qV); -var zV = Object.defineProperty, HV = Object.defineProperties, WV = Object.getOwnPropertyDescriptors, $3 = Object.getOwnPropertySymbols, KV = Object.prototype.hasOwnProperty, VV = Object.prototype.propertyIsEnumerable, F3 = (t, e, r) => e in t ? zV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, B3 = (t, e) => { - for (var r in e || (e = {})) KV.call(e, r) && F3(t, r, e[r]); - if ($3) for (var r of $3(e)) VV.call(e, r) && F3(t, r, e[r]); +var ZV = O1.exports; +const B3 = /* @__PURE__ */ rs(ZV); +var QV = Object.defineProperty, eG = Object.defineProperties, tG = Object.getOwnPropertyDescriptors, F3 = Object.getOwnPropertySymbols, rG = Object.prototype.hasOwnProperty, nG = Object.prototype.propertyIsEnumerable, j3 = (t, e, r) => e in t ? QV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, U3 = (t, e) => { + for (var r in e || (e = {})) rG.call(e, r) && j3(t, r, e[r]); + if (F3) for (var r of F3(e)) nG.call(e, r) && j3(t, r, e[r]); return t; -}, U3 = (t, e) => HV(t, WV(e)); -const GV = { Accept: "application/json", "Content-Type": "application/json" }, YV = "POST", j3 = { headers: GV, method: YV }, q3 = 10; -let Ss = class { +}, q3 = (t, e) => eG(t, tG(e)); +const iG = { Accept: "application/json", "Content-Type": "application/json" }, sG = "POST", z3 = { headers: iG, method: sG }, W3 = 10; +let As = class { constructor(e, r = !1) { - if (this.url = e, this.disableProviderPing = r, this.events = new rs.EventEmitter(), this.isAvailable = !1, this.registering = !1, !c3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); + if (this.url = e, this.disableProviderPing = r, this.events = new ns.EventEmitter(), this.isAvailable = !1, this.registering = !1, !f3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); this.url = e, this.disableProviderPing = r; } get connected() { @@ -25026,14 +25026,14 @@ let Ss = class { async send(e) { this.isAvailable || await this.register(); try { - const r = ko(e), n = await (await k3(this.url, U3(B3({}, j3), { body: r }))).json(); + const r = Bo(e), n = await (await B3(this.url, q3(U3({}, z3), { body: r }))).json(); this.onPayload({ data: n }); } catch (r) { this.onError(e.id, r); } } async register(e = this.url) { - if (!c3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); + if (!f3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); if (this.registering) { const r = this.events.getMaxListeners(); return (this.events.listenerCount("register_error") >= r || this.events.listenerCount("open") >= r) && this.events.setMaxListeners(r + 1), new Promise((n, i) => { @@ -25048,8 +25048,8 @@ let Ss = class { this.url = e, this.registering = !0; try { if (!this.disableProviderPing) { - const r = ko({ id: 1, jsonrpc: "2.0", method: "test", params: [] }); - await k3(e, U3(B3({}, j3), { body: r })); + const r = Bo({ id: 1, jsonrpc: "2.0", method: "test", params: [] }); + await B3(e, q3(U3({}, z3), { body: r })); } this.onOpen(); } catch (r) { @@ -25065,38 +25065,38 @@ let Ss = class { } onPayload(e) { if (typeof e.data > "u") return; - const r = typeof e.data == "string" ? uc(e.data) : e.data; + const r = typeof e.data == "string" ? lc(e.data) : e.data; this.events.emit("payload", r); } onError(e, r) { - const n = this.parseError(r), i = n.message || n.toString(), s = rp(e, i); + const n = this.parseError(r), i = n.message || n.toString(), s = np(e, i); this.events.emit("payload", s); } parseError(e, r = this.url) { - return J8(e, r, "HTTP"); + return Z8(e, r, "HTTP"); } resetMaxListeners() { - this.events.getMaxListeners() > q3 && this.events.setMaxListeners(q3); + this.events.getMaxListeners() > W3 && this.events.setMaxListeners(W3); } }; -const z3 = "error", JV = "wss://relay.walletconnect.org", XV = "wc", ZV = "universal_provider", H3 = `${XV}@2:${ZV}:`, wE = "https://rpc.walletconnect.org/v1/", Jc = "generic", QV = `${wE}bundler`, cs = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; -var eG = Object.defineProperty, tG = Object.defineProperties, rG = Object.getOwnPropertyDescriptors, W3 = Object.getOwnPropertySymbols, nG = Object.prototype.hasOwnProperty, iG = Object.prototype.propertyIsEnumerable, K3 = (t, e, r) => e in t ? eG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, fd = (t, e) => { - for (var r in e || (e = {})) nG.call(e, r) && K3(t, r, e[r]); - if (W3) for (var r of W3(e)) iG.call(e, r) && K3(t, r, e[r]); +const H3 = "error", oG = "wss://relay.walletconnect.org", aG = "wc", cG = "universal_provider", K3 = `${aG}@2:${cG}:`, _E = "https://rpc.walletconnect.org/v1/", Xc = "generic", uG = `${_E}bundler`, us = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; +var fG = Object.defineProperty, lG = Object.defineProperties, hG = Object.getOwnPropertyDescriptors, V3 = Object.getOwnPropertySymbols, dG = Object.prototype.hasOwnProperty, pG = Object.prototype.propertyIsEnumerable, G3 = (t, e, r) => e in t ? fG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ld = (t, e) => { + for (var r in e || (e = {})) dG.call(e, r) && G3(t, r, e[r]); + if (V3) for (var r of V3(e)) pG.call(e, r) && G3(t, r, e[r]); return t; -}, sG = (t, e) => tG(t, rG(e)); -function Ni(t, e, r) { +}, gG = (t, e) => lG(t, hG(e)); +function Li(t, e, r) { var n; - const i = lu(t); - return ((n = e.rpcMap) == null ? void 0 : n[i.reference]) || `${wE}?chainId=${i.namespace}:${i.reference}&projectId=${r}`; + const i = hu(t); + return ((n = e.rpcMap) == null ? void 0 : n[i.reference]) || `${_E}?chainId=${i.namespace}:${i.reference}&projectId=${r}`; } -function Ec(t) { +function Sc(t) { return t.includes(":") ? t.split(":")[1] : t; } -function xE(t) { +function EE(t) { return t.map((e) => `${e.split(":")[0]}:${e.split(":")[1]}`); } -function oG(t, e) { +function mG(t, e) { const r = Object.keys(e.namespaces).filter((i) => i.includes(t)); if (!r.length) return []; const n = []; @@ -25106,26 +25106,26 @@ function oG(t, e) { }), n; } function bm(t = {}, e = {}) { - const r = V3(t), n = V3(e); - return jV.merge(r, n); + const r = Y3(t), n = Y3(e); + return XV.merge(r, n); } -function V3(t) { +function Y3(t) { var e, r, n, i; const s = {}; - if (!El(t)) return s; + if (!Sl(t)) return s; for (const [o, a] of Object.entries(t)) { - const u = ab(o) ? [o] : a.chains, l = a.methods || [], d = a.events || [], g = a.rpcMap || {}, w = Ff(o); - s[w] = sG(fd(fd({}, s[w]), a), { chains: Md(u, (e = s[w]) == null ? void 0 : e.chains), methods: Md(l, (r = s[w]) == null ? void 0 : r.methods), events: Md(d, (n = s[w]) == null ? void 0 : n.events), rpcMap: fd(fd({}, g), (i = s[w]) == null ? void 0 : i.rpcMap) }); + const u = ab(o) ? [o] : a.chains, l = a.methods || [], d = a.events || [], p = a.rpcMap || {}, w = Ff(o); + s[w] = gG(ld(ld({}, s[w]), a), { chains: Id(u, (e = s[w]) == null ? void 0 : e.chains), methods: Id(l, (r = s[w]) == null ? void 0 : r.methods), events: Id(d, (n = s[w]) == null ? void 0 : n.events), rpcMap: ld(ld({}, p), (i = s[w]) == null ? void 0 : i.rpcMap) }); } return s; } -function aG(t) { +function vG(t) { return t.includes(":") ? t.split(":")[2] : t; } -function G3(t) { +function J3(t) { const e = {}; for (const [r, n] of Object.entries(t)) { - const i = n.methods || [], s = n.events || [], o = n.accounts || [], a = ab(r) ? [r] : n.chains ? n.chains : xE(n.accounts); + const i = n.methods || [], s = n.events || [], o = n.accounts || [], a = ab(r) ? [r] : n.chains ? n.chains : EE(n.accounts); e[r] = { chains: a, methods: i, events: s, accounts: o }; } return e; @@ -25133,10 +25133,10 @@ function G3(t) { function ym(t) { return typeof t == "number" ? t : t.includes("0x") ? parseInt(t, 16) : (t = t.includes(":") ? t.split(":")[1] : t, isNaN(Number(t)) ? t : Number(t)); } -const _E = {}, Ar = (t) => _E[t], wm = (t, e) => { - _E[t] = e; +const SE = {}, Ar = (t) => SE[t], wm = (t, e) => { + SE[t] = e; }; -class cG { +class bG { constructor(e) { this.name = "polkadot", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25157,7 +25157,7 @@ class cG { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); } getAccounts() { const e = this.namespace.accounts; @@ -25167,7 +25167,7 @@ class cG { const e = {}; return this.namespace.chains.forEach((r) => { var n; - const i = Ec(r); + const i = Sc(r); e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); }), e; } @@ -25181,17 +25181,17 @@ class cG { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Ni(e, this.namespace, this.client.core.projectId); + const n = r || Li(e, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new as(new Ss(n, Ar("disableProviderPing"))); + return new cs(new As(n, Ar("disableProviderPing"))); } } -var uG = Object.defineProperty, fG = Object.defineProperties, lG = Object.getOwnPropertyDescriptors, Y3 = Object.getOwnPropertySymbols, hG = Object.prototype.hasOwnProperty, dG = Object.prototype.propertyIsEnumerable, J3 = (t, e, r) => e in t ? uG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, X3 = (t, e) => { - for (var r in e || (e = {})) hG.call(e, r) && J3(t, r, e[r]); - if (Y3) for (var r of Y3(e)) dG.call(e, r) && J3(t, r, e[r]); +var yG = Object.defineProperty, wG = Object.defineProperties, xG = Object.getOwnPropertyDescriptors, X3 = Object.getOwnPropertySymbols, _G = Object.prototype.hasOwnProperty, EG = Object.prototype.propertyIsEnumerable, Z3 = (t, e, r) => e in t ? yG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Q3 = (t, e) => { + for (var r in e || (e = {})) _G.call(e, r) && Z3(t, r, e[r]); + if (X3) for (var r of X3(e)) EG.call(e, r) && Z3(t, r, e[r]); return t; -}, Z3 = (t, e) => fG(t, lG(e)); -class pG { +}, e6 = (t, e) => wG(t, xG(e)); +class SG { constructor(e) { this.name = "eip155", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.httpProviders = this.createHttpProviders(), this.chainId = parseInt(this.getDefaultChain()); } @@ -25216,7 +25216,7 @@ class pG { this.namespace = Object.assign(this.namespace, e); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(parseInt(e), r), this.chainId = parseInt(e), this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + this.httpProviders[e] || this.setHttpProvider(parseInt(e), r), this.chainId = parseInt(e), this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); } requestAccounts() { return this.getAccounts(); @@ -25229,9 +25229,9 @@ class pG { return e.split(":")[1]; } createHttpProvider(e, r) { - const n = r || Ni(`${this.name}:${e}`, this.namespace, this.client.core.projectId); + const n = r || Li(`${this.name}:${e}`, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new as(new Ss(n, Ar("disableProviderPing"))); + return new cs(new As(n, Ar("disableProviderPing"))); } setHttpProvider(e, r) { const n = this.createHttpProvider(e, r); @@ -25241,7 +25241,7 @@ class pG { const e = {}; return this.namespace.chains.forEach((r) => { var n; - const i = parseInt(Ec(r)); + const i = parseInt(Sc(r)); e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); }), e; } @@ -25275,7 +25275,7 @@ class pG { if (a != null && a[s]) return a == null ? void 0 : a[s]; const u = await this.client.request(e); try { - await this.client.session.update(e.topic, { sessionProperties: Z3(X3({}, o.sessionProperties || {}), { capabilities: Z3(X3({}, a || {}), { [s]: u }) }) }); + await this.client.session.update(e.topic, { sessionProperties: e6(Q3({}, o.sessionProperties || {}), { capabilities: e6(Q3({}, a || {}), { [s]: u }) }) }); } catch (l) { console.warn("Failed to update session with capabilities", l); } @@ -25303,15 +25303,15 @@ class pG { } async getUserOperationReceipt(e, r) { var n; - const i = new URL(e), s = await fetch(i, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(ha("eth_getUserOperationReceipt", [(n = r.request.params) == null ? void 0 : n[0]])) }); + const i = new URL(e), s = await fetch(i, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(ga("eth_getUserOperationReceipt", [(n = r.request.params) == null ? void 0 : n[0]])) }); if (!s.ok) throw new Error(`Failed to fetch user operation receipt - ${s.status}`); return await s.json(); } getBundlerUrl(e, r) { - return `${QV}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`; + return `${uG}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`; } } -class gG { +class AG { constructor(e) { this.name = "solana", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25325,7 +25325,7 @@ class gG { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); } getDefaultChain() { if (this.chainId) return this.chainId; @@ -25342,7 +25342,7 @@ class gG { const e = {}; return this.namespace.chains.forEach((r) => { var n; - const i = Ec(r); + const i = Sc(r); e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); }), e; } @@ -25356,12 +25356,12 @@ class gG { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Ni(e, this.namespace, this.client.core.projectId); + const n = r || Li(e, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new as(new Ss(n, Ar("disableProviderPing"))); + return new cs(new As(n, Ar("disableProviderPing"))); } } -let mG = class { +let PG = class { constructor(e) { this.name = "cosmos", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25382,7 +25382,7 @@ let mG = class { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); } getAccounts() { const e = this.namespace.accounts; @@ -25392,7 +25392,7 @@ let mG = class { const e = {}; return this.namespace.chains.forEach((r) => { var n; - const i = Ec(r); + const i = Sc(r); e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); }), e; } @@ -25406,11 +25406,11 @@ let mG = class { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Ni(e, this.namespace, this.client.core.projectId); + const n = r || Li(e, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new as(new Ss(n, Ar("disableProviderPing"))); + return new cs(new As(n, Ar("disableProviderPing"))); } -}, vG = class { +}, MG = class { constructor(e) { this.name = "algorand", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25425,11 +25425,11 @@ let mG = class { } setDefaultChain(e, r) { if (!this.httpProviders[e]) { - const n = r || Ni(`${this.name}:${e}`, this.namespace, this.client.core.projectId); + const n = r || Li(`${this.name}:${e}`, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); this.setHttpProvider(e, n); } - this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + this.chainId = e, this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); } getDefaultChain() { if (this.chainId) return this.chainId; @@ -25459,10 +25459,10 @@ let mG = class { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Ni(e, this.namespace, this.client.core.projectId); - return typeof n > "u" ? void 0 : new as(new Ss(n, Ar("disableProviderPing"))); + const n = r || Li(e, this.namespace, this.client.core.projectId); + return typeof n > "u" ? void 0 : new cs(new As(n, Ar("disableProviderPing"))); } -}, bG = class { +}, IG = class { constructor(e) { this.name = "cip34", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25483,7 +25483,7 @@ let mG = class { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); } getAccounts() { const e = this.namespace.accounts; @@ -25492,7 +25492,7 @@ let mG = class { createHttpProviders() { const e = {}; return this.namespace.chains.forEach((r) => { - const n = this.getCardanoRPCUrl(r), i = Ec(r); + const n = this.getCardanoRPCUrl(r), i = Sc(r); e[i] = this.createHttpProvider(i, n); }), e; } @@ -25512,9 +25512,9 @@ let mG = class { createHttpProvider(e, r) { const n = r || this.getCardanoRPCUrl(e); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new as(new Ss(n, Ar("disableProviderPing"))); + return new cs(new As(n, Ar("disableProviderPing"))); } -}, yG = class { +}, CG = class { constructor(e) { this.name = "elrond", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25528,7 +25528,7 @@ let mG = class { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); } getDefaultChain() { if (this.chainId) return this.chainId; @@ -25545,7 +25545,7 @@ let mG = class { const e = {}; return this.namespace.chains.forEach((r) => { var n; - const i = Ec(r); + const i = Sc(r); e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); }), e; } @@ -25559,12 +25559,12 @@ let mG = class { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Ni(e, this.namespace, this.client.core.projectId); + const n = r || Li(e, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new as(new Ss(n, Ar("disableProviderPing"))); + return new cs(new As(n, Ar("disableProviderPing"))); } }; -class wG { +class TG { constructor(e) { this.name = "multiversx", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25578,7 +25578,7 @@ class wG { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); } getDefaultChain() { if (this.chainId) return this.chainId; @@ -25595,7 +25595,7 @@ class wG { const e = {}; return this.namespace.chains.forEach((r) => { var n; - const i = Ec(r); + const i = Sc(r); e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); }), e; } @@ -25609,12 +25609,12 @@ class wG { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Ni(e, this.namespace, this.client.core.projectId); + const n = r || Li(e, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new as(new Ss(n, Ar("disableProviderPing"))); + return new cs(new As(n, Ar("disableProviderPing"))); } } -let xG = class { +let RG = class { constructor(e) { this.name = "near", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25636,11 +25636,11 @@ let xG = class { } setDefaultChain(e, r) { if (this.chainId = e, !this.httpProviders[e]) { - const n = r || Ni(`${this.name}:${e}`, this.namespace); + const n = r || Li(`${this.name}:${e}`, this.namespace); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); this.setHttpProvider(e, n); } - this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); } getAccounts() { const e = this.namespace.accounts; @@ -25663,11 +25663,11 @@ let xG = class { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Ni(e, this.namespace); - return typeof n > "u" ? void 0 : new as(new Ss(n, Ar("disableProviderPing"))); + const n = r || Li(e, this.namespace); + return typeof n > "u" ? void 0 : new cs(new As(n, Ar("disableProviderPing"))); } }; -class _G { +class DG { constructor(e) { this.name = "tezos", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25689,11 +25689,11 @@ class _G { } setDefaultChain(e, r) { if (this.chainId = e, !this.httpProviders[e]) { - const n = r || Ni(`${this.name}:${e}`, this.namespace); + const n = r || Li(`${this.name}:${e}`, this.namespace); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); this.setHttpProvider(e, n); } - this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); } getAccounts() { const e = this.namespace.accounts; @@ -25715,13 +25715,13 @@ class _G { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Ni(e, this.namespace); - return typeof n > "u" ? void 0 : new as(new Ss(n)); + const n = r || Li(e, this.namespace); + return typeof n > "u" ? void 0 : new cs(new As(n)); } } -class EG { +class OG { constructor(e) { - this.name = Jc, this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + this.name = Xc, this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } updateNamespace(e) { this.namespace.chains = [...new Set((this.namespace.chains || []).concat(e.chains || []))], this.namespace.accounts = [...new Set((this.namespace.accounts || []).concat(e.accounts || []))], this.namespace.methods = [...new Set((this.namespace.methods || []).concat(e.methods || []))], this.namespace.events = [...new Set((this.namespace.events || []).concat(e.events || []))], this.httpProviders = this.createHttpProviders(); @@ -25733,7 +25733,7 @@ class EG { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider(e.chainId).request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); } getDefaultChain() { if (this.chainId) return this.chainId; @@ -25750,7 +25750,7 @@ class EG { var e, r; const n = {}; return (r = (e = this.namespace) == null ? void 0 : e.accounts) == null || r.forEach((i) => { - const s = lu(i); + const s = hu(i); n[`${s.namespace}:${s.reference}`] = this.createHttpProvider(i); }), n; } @@ -25764,32 +25764,32 @@ class EG { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Ni(e, this.namespace, this.client.core.projectId); + const n = r || Li(e, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new as(new Ss(n, Ar("disableProviderPing"))); + return new cs(new As(n, Ar("disableProviderPing"))); } } -var SG = Object.defineProperty, AG = Object.defineProperties, PG = Object.getOwnPropertyDescriptors, Q3 = Object.getOwnPropertySymbols, MG = Object.prototype.hasOwnProperty, IG = Object.prototype.propertyIsEnumerable, e_ = (t, e, r) => e in t ? SG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ld = (t, e) => { - for (var r in e || (e = {})) MG.call(e, r) && e_(t, r, e[r]); - if (Q3) for (var r of Q3(e)) IG.call(e, r) && e_(t, r, e[r]); +var NG = Object.defineProperty, LG = Object.defineProperties, kG = Object.getOwnPropertyDescriptors, t6 = Object.getOwnPropertySymbols, $G = Object.prototype.hasOwnProperty, BG = Object.prototype.propertyIsEnumerable, r6 = (t, e, r) => e in t ? NG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, hd = (t, e) => { + for (var r in e || (e = {})) $G.call(e, r) && r6(t, r, e[r]); + if (t6) for (var r of t6(e)) BG.call(e, r) && r6(t, r, e[r]); return t; -}, xm = (t, e) => AG(t, PG(e)); -let EE = class SE { +}, xm = (t, e) => LG(t, kG(e)); +let AE = class PE { constructor(e) { - this.events = new kv(), this.rpcProviders = {}, this.shouldAbortPairingAttempt = !1, this.maxPairingAttempts = 10, this.disableProviderPing = !1, this.providerOpts = e, this.logger = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : jl(k0({ level: (e == null ? void 0 : e.logger) || z3 })), this.disableProviderPing = (e == null ? void 0 : e.disableProviderPing) || !1; + this.events = new kv(), this.rpcProviders = {}, this.shouldAbortPairingAttempt = !1, this.maxPairingAttempts = 10, this.disableProviderPing = !1, this.providerOpts = e, this.logger = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : ql($0({ level: (e == null ? void 0 : e.logger) || H3 })), this.disableProviderPing = (e == null ? void 0 : e.disableProviderPing) || !1; } static async init(e) { - const r = new SE(e); + const r = new PE(e); return await r.initialize(), r; } async request(e, r, n) { const [i, s] = this.validateChain(r); if (!this.session) throw new Error("Please call connect() before request()"); - return await this.getProvider(i).request({ request: ld({}, e), chainId: `${i}:${s}`, topic: this.session.topic, expiry: n }); + return await this.getProvider(i).request({ request: hd({}, e), chainId: `${i}:${s}`, topic: this.session.topic, expiry: n }); } sendAsync(e, r, n, i) { const s = (/* @__PURE__ */ new Date()).getTime(); - this.request(e, n, i).then((o) => r(null, tp(s, o))).catch((o) => r(o, void 0)); + this.request(e, n, i).then((o) => r(null, rp(s, o))).catch((o) => r(o, void 0)); } async enable() { if (!this.client) throw new Error("Sign Client not initialized"); @@ -25811,7 +25811,7 @@ let EE = class SE { n && (this.uri = n, this.events.emit("display_uri", n)); const s = await i(); if (this.session = s.session, this.session) { - const o = G3(this.session.namespaces); + const o = J3(this.session.namespaces); this.namespaces = bm(this.namespaces, o), this.persist("namespaces", this.namespaces), this.onConnect(); } return s; @@ -25840,10 +25840,10 @@ let EE = class SE { const { uri: n, approval: i } = await this.client.connect({ pairingTopic: e, requiredNamespaces: this.namespaces, optionalNamespaces: this.optionalNamespaces, sessionProperties: this.sessionProperties }); n && (this.uri = n, this.events.emit("display_uri", n)), await i().then((s) => { this.session = s; - const o = G3(s.namespaces); + const o = J3(s.namespaces); this.namespaces = bm(this.namespaces, o), this.persist("namespaces", this.namespaces); }).catch((s) => { - if (s.message !== yE) throw s; + if (s.message !== xE) throw s; r++; }); } while (!this.session); @@ -25853,7 +25853,7 @@ let EE = class SE { try { if (!this.session) return; const [n, i] = this.validateChain(e), s = this.getProvider(n); - s.name === Jc ? s.setDefaultChain(`${n}:${i}`, r) : s.setDefaultChain(i, r); + s.name === Xc ? s.setDefaultChain(`${n}:${i}`, r) : s.setDefaultChain(i, r); } catch (n) { if (!/Please call connect/.test(n.message)) throw n; } @@ -25861,7 +25861,7 @@ let EE = class SE { async cleanupPendingPairings(e = {}) { this.logger.info("Cleaning up inactive pairings..."); const r = this.client.pairing.getAll(); - if (dc(r)) { + if (gc(r)) { for (const n of r) e.deletePairings ? this.client.core.expirer.set(n.topic, 0) : await this.client.core.relayer.subscriber.unsubscribe(n.topic); this.logger.info(`Inactive pairings cleared: ${r.length}`); } @@ -25879,7 +25879,7 @@ let EE = class SE { this.logger.trace("Initialized"), await this.createClient(), await this.checkStorage(), this.registerEventListeners(); } async createClient() { - this.client = this.providerOpts.client || await db.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || z3, relayUrl: this.providerOpts.relayUrl || JV, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); + this.client = this.providerOpts.client || await db.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || H3, relayUrl: this.providerOpts.relayUrl || oG, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); } createProviders() { if (!this.client) throw new Error("Sign Client not initialized"); @@ -25887,40 +25887,40 @@ let EE = class SE { const e = [...new Set(Object.keys(this.session.namespaces).map((r) => Ff(r)))]; wm("client", this.client), wm("events", this.events), wm("disableProviderPing", this.disableProviderPing), e.forEach((r) => { if (!this.session) return; - const n = oG(r, this.session), i = xE(n), s = bm(this.namespaces, this.optionalNamespaces), o = xm(ld({}, s[r]), { accounts: n, chains: i }); + const n = mG(r, this.session), i = EE(n), s = bm(this.namespaces, this.optionalNamespaces), o = xm(hd({}, s[r]), { accounts: n, chains: i }); switch (r) { case "eip155": - this.rpcProviders[r] = new pG({ namespace: o }); + this.rpcProviders[r] = new SG({ namespace: o }); break; case "algorand": - this.rpcProviders[r] = new vG({ namespace: o }); + this.rpcProviders[r] = new MG({ namespace: o }); break; case "solana": - this.rpcProviders[r] = new gG({ namespace: o }); + this.rpcProviders[r] = new AG({ namespace: o }); break; case "cosmos": - this.rpcProviders[r] = new mG({ namespace: o }); + this.rpcProviders[r] = new PG({ namespace: o }); break; case "polkadot": - this.rpcProviders[r] = new cG({ namespace: o }); + this.rpcProviders[r] = new bG({ namespace: o }); break; case "cip34": - this.rpcProviders[r] = new bG({ namespace: o }); + this.rpcProviders[r] = new IG({ namespace: o }); break; case "elrond": - this.rpcProviders[r] = new yG({ namespace: o }); + this.rpcProviders[r] = new CG({ namespace: o }); break; case "multiversx": - this.rpcProviders[r] = new wG({ namespace: o }); + this.rpcProviders[r] = new TG({ namespace: o }); break; case "near": - this.rpcProviders[r] = new xG({ namespace: o }); + this.rpcProviders[r] = new RG({ namespace: o }); break; case "tezos": - this.rpcProviders[r] = new _G({ namespace: o }); + this.rpcProviders[r] = new DG({ namespace: o }); break; default: - this.rpcProviders[Jc] ? this.rpcProviders[Jc].updateNamespace(o) : this.rpcProviders[Jc] = new EG({ namespace: o }); + this.rpcProviders[Xc] ? this.rpcProviders[Xc].updateNamespace(o) : this.rpcProviders[Xc] = new OG({ namespace: o }); } }); } @@ -25932,7 +25932,7 @@ let EE = class SE { const { params: r } = e, { event: n } = r; if (n.name === "accountsChanged") { const i = n.data; - i && dc(i) && this.events.emit("accountsChanged", i.map(aG)); + i && gc(i) && this.events.emit("accountsChanged", i.map(vG)); } else if (n.name === "chainChanged") { const i = r.chainId, s = r.event.data, o = Ff(i), a = ym(i) !== ym(s) ? `${o}:${ym(s)}` : i; this.onChainChanged(a); @@ -25941,15 +25941,15 @@ let EE = class SE { }), this.client.on("session_update", ({ topic: e, params: r }) => { var n; const { namespaces: i } = r, s = (n = this.client) == null ? void 0 : n.session.get(e); - this.session = xm(ld({}, s), { namespaces: i }), this.onSessionUpdate(), this.events.emit("session_update", { topic: e, params: r }); + this.session = xm(hd({}, s), { namespaces: i }), this.onSessionUpdate(), this.events.emit("session_update", { topic: e, params: r }); }), this.client.on("session_delete", async (e) => { - await this.cleanup(), this.events.emit("session_delete", e), this.events.emit("disconnect", xm(ld({}, Or("USER_DISCONNECTED")), { data: e.topic })); - }), this.on(cs.DEFAULT_CHAIN_CHANGED, (e) => { + await this.cleanup(), this.events.emit("session_delete", e), this.events.emit("disconnect", xm(hd({}, Or("USER_DISCONNECTED")), { data: e.topic })); + }), this.on(us.DEFAULT_CHAIN_CHANGED, (e) => { this.onChainChanged(e, !0); }); } getProvider(e) { - return this.rpcProviders[e] || this.rpcProviders[Jc]; + return this.rpcProviders[e] || this.rpcProviders[Xc]; } onSessionUpdate() { Object.keys(this.rpcProviders).forEach((e) => { @@ -25985,14 +25985,14 @@ let EE = class SE { this.session = void 0, this.namespaces = void 0, this.optionalNamespaces = void 0, this.sessionProperties = void 0, this.persist("namespaces", void 0), this.persist("optionalNamespaces", void 0), this.persist("sessionProperties", void 0), await this.cleanupPendingPairings({ deletePairings: !0 }); } persist(e, r) { - this.client.core.storage.setItem(`${H3}/${e}`, r); + this.client.core.storage.setItem(`${K3}/${e}`, r); } async getFromStore(e) { - return await this.client.core.storage.getItem(`${H3}/${e}`); + return await this.client.core.storage.getItem(`${K3}/${e}`); } }; -const CG = EE; -function TG() { +const FG = AE; +function jG() { return new Promise((t) => { const e = []; let r; @@ -26002,7 +26002,7 @@ function TG() { }), r = setTimeout(() => t(e), 200), window.dispatchEvent(new Event("eip6963:requestProvider")); }); } -class Qs { +class to { constructor(e, r) { this.scope = e, this.module = r; } @@ -26034,7 +26034,7 @@ class Qs { return `-${this.scope}${this.module ? `:${this.module}` : ""}:${e}`; } static clearAll() { - new Qs("CBWSDK").clear(), new Qs("walletlink").clear(); + new to("CBWSDK").clear(), new to("walletlink").clear(); } } const fn = { @@ -26128,92 +26128,92 @@ const fn = { standard: "EIP-3085", message: "Unrecognized chain ID." } -}, AE = "Unspecified error message.", RG = "Unspecified server error."; -function pb(t, e = AE) { +}, ME = "Unspecified error message.", UG = "Unspecified server error."; +function pb(t, e = ME) { if (t && Number.isInteger(t)) { const r = t.toString(); if (L1(N1, r)) return N1[r].message; - if (PE(t)) - return RG; + if (IE(t)) + return UG; } return e; } -function DG(t) { +function qG(t) { if (!Number.isInteger(t)) return !1; const e = t.toString(); - return !!(N1[e] || PE(t)); + return !!(N1[e] || IE(t)); } -function OG(t, { shouldIncludeStack: e = !1 } = {}) { +function zG(t, { shouldIncludeStack: e = !1 } = {}) { const r = {}; - if (t && typeof t == "object" && !Array.isArray(t) && L1(t, "code") && DG(t.code)) { + if (t && typeof t == "object" && !Array.isArray(t) && L1(t, "code") && qG(t.code)) { const n = t; - r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, L1(n, "data") && (r.data = n.data)) : (r.message = pb(r.code), r.data = { originalError: t_(t) }); + r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, L1(n, "data") && (r.data = n.data)) : (r.message = pb(r.code), r.data = { originalError: n6(t) }); } else - r.code = fn.rpc.internal, r.message = r_(t, "message") ? t.message : AE, r.data = { originalError: t_(t) }; - return e && (r.stack = r_(t, "stack") ? t.stack : void 0), r; + r.code = fn.rpc.internal, r.message = i6(t, "message") ? t.message : ME, r.data = { originalError: n6(t) }; + return e && (r.stack = i6(t, "stack") ? t.stack : void 0), r; } -function PE(t) { +function IE(t) { return t >= -32099 && t <= -32e3; } -function t_(t) { +function n6(t) { return t && typeof t == "object" && !Array.isArray(t) ? Object.assign({}, t) : t; } function L1(t, e) { return Object.prototype.hasOwnProperty.call(t, e); } -function r_(t, e) { +function i6(t, e) { return typeof t == "object" && t !== null && e in t && typeof t[e] == "string"; } const Sr = { rpc: { - parse: (t) => Gi(fn.rpc.parse, t), - invalidRequest: (t) => Gi(fn.rpc.invalidRequest, t), - invalidParams: (t) => Gi(fn.rpc.invalidParams, t), - methodNotFound: (t) => Gi(fn.rpc.methodNotFound, t), - internal: (t) => Gi(fn.rpc.internal, t), + parse: (t) => Yi(fn.rpc.parse, t), + invalidRequest: (t) => Yi(fn.rpc.invalidRequest, t), + invalidParams: (t) => Yi(fn.rpc.invalidParams, t), + methodNotFound: (t) => Yi(fn.rpc.methodNotFound, t), + internal: (t) => Yi(fn.rpc.internal, t), server: (t) => { if (!t || typeof t != "object" || Array.isArray(t)) throw new Error("Ethereum RPC Server errors must provide single object argument."); const { code: e } = t; if (!Number.isInteger(e) || e > -32005 || e < -32099) throw new Error('"code" must be an integer such that: -32099 <= code <= -32005'); - return Gi(e, t); + return Yi(e, t); }, - invalidInput: (t) => Gi(fn.rpc.invalidInput, t), - resourceNotFound: (t) => Gi(fn.rpc.resourceNotFound, t), - resourceUnavailable: (t) => Gi(fn.rpc.resourceUnavailable, t), - transactionRejected: (t) => Gi(fn.rpc.transactionRejected, t), - methodNotSupported: (t) => Gi(fn.rpc.methodNotSupported, t), - limitExceeded: (t) => Gi(fn.rpc.limitExceeded, t) + invalidInput: (t) => Yi(fn.rpc.invalidInput, t), + resourceNotFound: (t) => Yi(fn.rpc.resourceNotFound, t), + resourceUnavailable: (t) => Yi(fn.rpc.resourceUnavailable, t), + transactionRejected: (t) => Yi(fn.rpc.transactionRejected, t), + methodNotSupported: (t) => Yi(fn.rpc.methodNotSupported, t), + limitExceeded: (t) => Yi(fn.rpc.limitExceeded, t) }, provider: { - userRejectedRequest: (t) => Kc(fn.provider.userRejectedRequest, t), - unauthorized: (t) => Kc(fn.provider.unauthorized, t), - unsupportedMethod: (t) => Kc(fn.provider.unsupportedMethod, t), - disconnected: (t) => Kc(fn.provider.disconnected, t), - chainDisconnected: (t) => Kc(fn.provider.chainDisconnected, t), - unsupportedChain: (t) => Kc(fn.provider.unsupportedChain, t), + userRejectedRequest: (t) => Vc(fn.provider.userRejectedRequest, t), + unauthorized: (t) => Vc(fn.provider.unauthorized, t), + unsupportedMethod: (t) => Vc(fn.provider.unsupportedMethod, t), + disconnected: (t) => Vc(fn.provider.disconnected, t), + chainDisconnected: (t) => Vc(fn.provider.chainDisconnected, t), + unsupportedChain: (t) => Vc(fn.provider.unsupportedChain, t), custom: (t) => { if (!t || typeof t != "object" || Array.isArray(t)) throw new Error("Ethereum Provider custom errors must provide single object argument."); const { code: e, message: r, data: n } = t; if (!r || typeof r != "string") throw new Error('"message" must be a nonempty string'); - return new CE(e, r, n); + return new RE(e, r, n); } } }; -function Gi(t, e) { - const [r, n] = ME(e); - return new IE(t, r || pb(t), n); +function Yi(t, e) { + const [r, n] = CE(e); + return new TE(t, r || pb(t), n); } -function Kc(t, e) { - const [r, n] = ME(e); - return new CE(t, r || pb(t), n); +function Vc(t, e) { + const [r, n] = CE(e); + return new RE(t, r || pb(t), n); } -function ME(t) { +function CE(t) { if (t) { if (typeof t == "string") return [t]; @@ -26226,7 +26226,7 @@ function ME(t) { } return []; } -class IE extends Error { +class TE extends Error { constructor(e, r, n) { if (!Number.isInteger(e)) throw new Error('"code" must be an integer.'); @@ -26235,82 +26235,82 @@ class IE extends Error { super(r), this.code = e, n !== void 0 && (this.data = n); } } -class CE extends IE { +class RE extends TE { /** * Create an Ethereum Provider JSON-RPC error. * `code` must be an integer in the 1000 <= 4999 range. */ constructor(e, r, n) { - if (!NG(e)) + if (!WG(e)) throw new Error('"code" must be an integer such that: 1000 <= code <= 4999'); super(e, r, n); } } -function NG(t) { +function WG(t) { return Number.isInteger(t) && t >= 1e3 && t <= 4999; } function gb() { return (t) => t; } -const Sl = gb(), LG = gb(), kG = gb(); -function xo(t) { +const Al = gb(), HG = gb(), KG = gb(); +function So(t) { return Math.floor(t); } -const TE = /^[0-9]*$/, RE = /^[a-f0-9]*$/; -function Za(t) { +const DE = /^[0-9]*$/, OE = /^[a-f0-9]*$/; +function ec(t) { return mb(crypto.getRandomValues(new Uint8Array(t))); } function mb(t) { return [...t].map((e) => e.toString(16).padStart(2, "0")).join(""); } -function Rd(t) { +function Dd(t) { return new Uint8Array(t.match(/.{1,2}/g).map((e) => Number.parseInt(e, 16))); } function Hf(t, e = !1) { const r = t.toString("hex"); - return Sl(e ? `0x${r}` : r); + return Al(e ? `0x${r}` : r); } function _m(t) { return Hf(k1(t), !0); } -function ks(t) { - return kG(t.toString(10)); +function $s(t) { + return KG(t.toString(10)); } -function da(t) { - return Sl(`0x${BigInt(t).toString(16)}`); +function ma(t) { + return Al(`0x${BigInt(t).toString(16)}`); } -function DE(t) { +function NE(t) { return t.startsWith("0x") || t.startsWith("0X"); } function vb(t) { - return DE(t) ? t.slice(2) : t; + return NE(t) ? t.slice(2) : t; } -function OE(t) { - return DE(t) ? `0x${t.slice(2)}` : `0x${t}`; +function LE(t) { + return NE(t) ? `0x${t.slice(2)}` : `0x${t}`; } -function op(t) { +function ap(t) { if (typeof t != "string") return !1; const e = vb(t).toLowerCase(); - return RE.test(e); + return OE.test(e); } -function $G(t, e = !1) { +function VG(t, e = !1) { if (typeof t == "string") { const r = vb(t).toLowerCase(); - if (RE.test(r)) - return Sl(e ? `0x${r}` : r); + if (OE.test(r)) + return Al(e ? `0x${r}` : r); } throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`); } function bb(t, e = !1) { - let r = $G(t, !1); - return r.length % 2 === 1 && (r = Sl(`0${r}`)), e ? Sl(`0x${r}`) : r; + let r = VG(t, !1); + return r.length % 2 === 1 && (r = Al(`0${r}`)), e ? Al(`0x${r}`) : r; } -function ta(t) { +function ia(t) { if (typeof t == "string") { const e = vb(t).toLowerCase(); - if (op(e) && e.length === 40) - return LG(OE(e)); + if (ap(e) && e.length === 40) + return HG(LE(e)); } throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`); } @@ -26318,7 +26318,7 @@ function k1(t) { if (Buffer.isBuffer(t)) return t; if (typeof t == "string") { - if (op(t)) { + if (ap(t)) { const e = bb(t, !1); return Buffer.from(e, "hex"); } @@ -26326,50 +26326,50 @@ function k1(t) { } throw Sr.rpc.invalidParams(`Not binary data: ${String(t)}`); } -function Wf(t) { +function Kf(t) { if (typeof t == "number" && Number.isInteger(t)) - return xo(t); + return So(t); if (typeof t == "string") { - if (TE.test(t)) - return xo(Number(t)); - if (op(t)) - return xo(Number(BigInt(bb(t, !0)))); + if (DE.test(t)) + return So(Number(t)); + if (ap(t)) + return So(Number(BigInt(bb(t, !0)))); } throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`); } -function Tf(t) { - if (t !== null && (typeof t == "bigint" || BG(t))) +function Rf(t) { + if (t !== null && (typeof t == "bigint" || YG(t))) return BigInt(t.toString(10)); if (typeof t == "number") - return BigInt(Wf(t)); + return BigInt(Kf(t)); if (typeof t == "string") { - if (TE.test(t)) + if (DE.test(t)) return BigInt(t); - if (op(t)) + if (ap(t)) return BigInt(bb(t, !0)); } throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`); } -function FG(t) { +function GG(t) { if (typeof t == "string") return JSON.parse(t); if (typeof t == "object") return t; throw Sr.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`); } -function BG(t) { +function YG(t) { if (t == null || typeof t.constructor != "function") return !1; const { constructor: e } = t; return typeof e.config == "function" && typeof e.EUCLID == "number"; } -async function UG() { +async function JG() { return crypto.subtle.generateKey({ name: "ECDH", namedCurve: "P-256" }, !0, ["deriveKey"]); } -async function jG(t, e) { +async function XG(t, e) { return crypto.subtle.deriveKey({ name: "ECDH", public: e @@ -26378,21 +26378,21 @@ async function jG(t, e) { length: 256 }, !1, ["encrypt", "decrypt"]); } -async function qG(t, e) { +async function ZG(t, e) { const r = crypto.getRandomValues(new Uint8Array(12)), n = await crypto.subtle.encrypt({ name: "AES-GCM", iv: r }, t, new TextEncoder().encode(e)); return { iv: r, cipherText: n }; } -async function zG(t, { iv: e, cipherText: r }) { +async function QG(t, { iv: e, cipherText: r }) { const n = await crypto.subtle.decrypt({ name: "AES-GCM", iv: e }, t, r); return new TextDecoder().decode(n); } -function NE(t) { +function kE(t) { switch (t) { case "public": return "spki"; @@ -26400,28 +26400,28 @@ function NE(t) { return "pkcs8"; } } -async function LE(t, e) { - const r = NE(t), n = await crypto.subtle.exportKey(r, e); +async function $E(t, e) { + const r = kE(t), n = await crypto.subtle.exportKey(r, e); return mb(new Uint8Array(n)); } -async function kE(t, e) { - const r = NE(t), n = Rd(e).buffer; +async function BE(t, e) { + const r = kE(t), n = Dd(e).buffer; return await crypto.subtle.importKey(r, new Uint8Array(n), { name: "ECDH", namedCurve: "P-256" }, !0, t === "private" ? ["deriveKey"] : []); } -async function HG(t, e) { +async function eY(t, e) { const r = JSON.stringify(t, (n, i) => { if (!(i instanceof Error)) return i; const s = i; return Object.assign(Object.assign({}, s.code ? { code: s.code } : {}), { message: s.message }); }); - return qG(e, r); + return ZG(e, r); } -async function WG(t, e) { - return JSON.parse(await zG(e, t)); +async function tY(t, e) { + return JSON.parse(await QG(e, t)); } const Em = { storageKey: "ownPrivateKey", @@ -26433,9 +26433,9 @@ const Em = { storageKey: "peerPublicKey", keyType: "public" }; -class KG { +class rY { constructor() { - this.storage = new Qs("CBWSDK", "SCWKeyManager"), this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null; + this.storage = new to("CBWSDK", "SCWKeyManager"), this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null; } async getOwnPublicKey() { return await this.loadKeysIfNeeded(), this.ownPublicKey; @@ -26451,46 +26451,46 @@ class KG { this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null, this.storage.removeItem(Sm.storageKey), this.storage.removeItem(Em.storageKey), this.storage.removeItem(Am.storageKey); } async generateKeyPair() { - const e = await UG(); + const e = await JG(); this.ownPrivateKey = e.privateKey, this.ownPublicKey = e.publicKey, await this.storeKey(Em, e.privateKey), await this.storeKey(Sm, e.publicKey); } async loadKeysIfNeeded() { if (this.ownPrivateKey === null && (this.ownPrivateKey = await this.loadKey(Em)), this.ownPublicKey === null && (this.ownPublicKey = await this.loadKey(Sm)), (this.ownPrivateKey === null || this.ownPublicKey === null) && await this.generateKeyPair(), this.peerPublicKey === null && (this.peerPublicKey = await this.loadKey(Am)), this.sharedSecret === null) { if (this.ownPrivateKey === null || this.peerPublicKey === null) return; - this.sharedSecret = await jG(this.ownPrivateKey, this.peerPublicKey); + this.sharedSecret = await XG(this.ownPrivateKey, this.peerPublicKey); } } // storage methods async loadKey(e) { const r = this.storage.getItem(e.storageKey); - return r ? kE(e.keyType, r) : null; + return r ? BE(e.keyType, r) : null; } async storeKey(e, r) { - const n = await LE(e.keyType, r); + const n = await $E(e.keyType, r); this.storage.setItem(e.storageKey, n); } } -const rh = "4.2.4", $E = "@coinbase/wallet-sdk"; -async function FE(t, e) { +const nh = "4.2.4", FE = "@coinbase/wallet-sdk"; +async function jE(t, e) { const r = Object.assign(Object.assign({}, t), { jsonrpc: "2.0", id: crypto.randomUUID() }), n = await window.fetch(e, { method: "POST", body: JSON.stringify(r), mode: "cors", headers: { "Content-Type": "application/json", - "X-Cbw-Sdk-Version": rh, - "X-Cbw-Sdk-Platform": $E + "X-Cbw-Sdk-Version": nh, + "X-Cbw-Sdk-Platform": FE } }), { result: i, error: s } = await n.json(); if (s) throw s; return i; } -function VG() { +function nY() { return globalThis.coinbaseWalletExtension; } -function GG() { +function iY() { var t, e; try { const r = globalThis; @@ -26499,19 +26499,19 @@ function GG() { return; } } -function YG({ metadata: t, preference: e }) { +function sY({ metadata: t, preference: e }) { var r, n; const { appName: i, appLogoUrl: s, appChainIds: o } = t; if (e.options !== "smartWalletOnly") { - const u = VG(); + const u = nY(); if (u) return (r = u.setAppInfo) === null || r === void 0 || r.call(u, i, s, o, e), u; } - const a = GG(); + const a = iY(); if (a != null && a.isCoinbaseBrowser) return (n = a.setAppInfo) === null || n === void 0 || n.call(a, i, s, o, e), a; } -function JG(t) { +function oY(t) { if (!t || typeof t != "object" || Array.isArray(t)) throw Sr.rpc.invalidParams({ message: "Expected a single, non-array, object argument.", @@ -26536,11 +26536,11 @@ function JG(t) { throw Sr.provider.unsupportedMethod(); } } -const n_ = "accounts", i_ = "activeChain", s_ = "availableChains", o_ = "walletCapabilities"; -class XG { +const s6 = "accounts", o6 = "activeChain", a6 = "availableChains", c6 = "walletCapabilities"; +class aY { constructor(e) { var r, n, i; - this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new KG(), this.storage = new Qs("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(n_)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(i_) || { + this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new rY(), this.storage = new to("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(s6)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(o6) || { id: (i = (n = e.metadata.appChainIds) === null || n === void 0 ? void 0 : n[0]) !== null && i !== void 0 ? i : 1 }, this.handshake = this.handshake.bind(this), this.request = this.request.bind(this), this.createRequestMessage = this.createRequestMessage.bind(this), this.decryptResponseMessage = this.decryptResponseMessage.bind(this); } @@ -26554,13 +26554,13 @@ class XG { }), s = await this.communicator.postRequestAndWaitForResponse(i); if ("failure" in s.content) throw s.content.failure; - const o = await kE("public", s.sender); + const o = await BE("public", s.sender); await this.keyManager.setPeerPublicKey(o); const u = (await this.decryptResponseMessage(s)).result; if ("error" in u) throw u.error; const l = u.value; - this.accounts = l, this.storage.storeObject(n_, l), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", l); + this.accounts = l, this.storage.storeObject(s6, l), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", l); } async request(e) { var r; @@ -26568,7 +26568,7 @@ class XG { throw Sr.provider.unauthorized(); switch (e.method) { case "eth_requestAccounts": - return (r = this.callback) === null || r === void 0 || r.call(this, "connect", { chainId: da(this.chain.id) }), this.accounts; + return (r = this.callback) === null || r === void 0 || r.call(this, "connect", { chainId: ma(this.chain.id) }), this.accounts; case "eth_accounts": return this.accounts; case "eth_coinbase": @@ -26576,9 +26576,9 @@ class XG { case "net_version": return this.chain.id; case "eth_chainId": - return da(this.chain.id); + return ma(this.chain.id); case "wallet_getCapabilities": - return this.storage.loadObject(o_); + return this.storage.loadObject(c6); case "wallet_switchEthereumChain": return this.handleSwitchChainRequest(e); case "eth_ecRecover": @@ -26599,7 +26599,7 @@ class XG { default: if (!this.chain.rpcUrl) throw Sr.rpc.internal("No RPC URL set for chain"); - return FE(e, this.chain.rpcUrl); + return jE(e, this.chain.rpcUrl); } } async sendRequestToPopup(e) { @@ -26625,7 +26625,7 @@ class XG { const n = e.params; if (!n || !(!((r = n[0]) === null || r === void 0) && r.chainId)) throw Sr.rpc.invalidParams(); - const i = Wf(n[0].chainId); + const i = Kf(n[0].chainId); if (this.updateChain(i)) return null; const o = await this.sendRequestToPopup(e); @@ -26635,14 +26635,14 @@ class XG { const r = await this.keyManager.getSharedSecret(); if (!r) throw Sr.provider.unauthorized("No valid session found, try requestAccounts before other methods"); - const n = await HG({ + const n = await eY({ action: e, chainId: this.chain.id }, r), i = await this.createRequestMessage({ encrypted: n }); return this.communicator.postRequestAndWaitForResponse(i); } async createRequestMessage(e) { - const r = await LE("public", await this.keyManager.getOwnPublicKey()); + const r = await $E("public", await this.keyManager.getOwnPublicKey()); return { id: crypto.randomUUID(), sender: r, @@ -26658,31 +26658,31 @@ class XG { const s = await this.keyManager.getSharedSecret(); if (!s) throw Sr.provider.unauthorized("Invalid session"); - const o = await WG(i.encrypted, s), a = (r = o.data) === null || r === void 0 ? void 0 : r.chains; + const o = await tY(i.encrypted, s), a = (r = o.data) === null || r === void 0 ? void 0 : r.chains; if (a) { - const l = Object.entries(a).map(([d, g]) => ({ + const l = Object.entries(a).map(([d, p]) => ({ id: Number(d), - rpcUrl: g + rpcUrl: p })); - this.storage.storeObject(s_, l), this.updateChain(this.chain.id, l); + this.storage.storeObject(a6, l), this.updateChain(this.chain.id, l); } const u = (n = o.data) === null || n === void 0 ? void 0 : n.capabilities; - return u && this.storage.storeObject(o_, u), o; + return u && this.storage.storeObject(c6, u), o; } updateChain(e, r) { var n; - const i = r ?? this.storage.loadObject(s_), s = i == null ? void 0 : i.find((o) => o.id === e); - return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(i_, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", da(s.id))), !0) : !1; + const i = r ?? this.storage.loadObject(a6), s = i == null ? void 0 : i.find((o) => o.id === e); + return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(o6, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", ma(s.id))), !0) : !1; } } -const ZG = /* @__PURE__ */ bv(TD), { keccak_256: QG } = ZG; -function BE(t) { +const cY = /* @__PURE__ */ bv(jD), { keccak_256: uY } = cY; +function UE(t) { return Buffer.allocUnsafe(t).fill(0); } -function eY(t) { +function fY(t) { return t.toString(2).length; } -function UE(t, e) { +function qE(t, e) { let r = t.toString(16); r.length % 2 !== 0 && (r = "0" + r); const n = r.match(/.{1,2}/g).map((i) => parseInt(i, 16)); @@ -26690,7 +26690,7 @@ function UE(t, e) { n.unshift(0); return Buffer.from(n); } -function tY(t, e) { +function lY(t, e) { const r = t < 0n; let n; if (r) { @@ -26700,77 +26700,77 @@ function tY(t, e) { n = t; return n &= (1n << BigInt(e)) - 1n, n; } -function jE(t, e, r) { - const n = BE(e); - return t = ap(t), r ? t.length < e ? (t.copy(n), n) : t.slice(0, e) : t.length < e ? (t.copy(n, e - t.length), n) : t.slice(-e); +function zE(t, e, r) { + const n = UE(e); + return t = cp(t), r ? t.length < e ? (t.copy(n), n) : t.slice(0, e) : t.length < e ? (t.copy(n, e - t.length), n) : t.slice(-e); } -function rY(t, e) { - return jE(t, e, !0); +function hY(t, e) { + return zE(t, e, !0); } -function ap(t) { +function cp(t) { if (!Buffer.isBuffer(t)) if (Array.isArray(t)) t = Buffer.from(t); else if (typeof t == "string") - qE(t) ? t = Buffer.from(sY(zE(t)), "hex") : t = Buffer.from(t); + WE(t) ? t = Buffer.from(gY(HE(t)), "hex") : t = Buffer.from(t); else if (typeof t == "number") t = intToBuffer(t); else if (t == null) t = Buffer.allocUnsafe(0); else if (typeof t == "bigint") - t = UE(t); + t = qE(t); else if (t.toArray) t = Buffer.from(t.toArray()); else throw new Error("invalid type"); return t; } -function nY(t) { - return t = ap(t), "0x" + t.toString("hex"); +function dY(t) { + return t = cp(t), "0x" + t.toString("hex"); } -function iY(t, e) { - if (t = ap(t), e || (e = 256), e !== 256) +function pY(t, e) { + if (t = cp(t), e || (e = 256), e !== 256) throw new Error("unsupported"); - return Buffer.from(QG(new Uint8Array(t))); + return Buffer.from(uY(new Uint8Array(t))); } -function sY(t) { +function gY(t) { return t.length % 2 ? "0" + t : t; } -function qE(t) { +function WE(t) { return typeof t == "string" && t.match(/^0x[0-9A-Fa-f]*$/); } -function zE(t) { +function HE(t) { return typeof t == "string" && t.startsWith("0x") ? t.slice(2) : t; } -var HE = { - zeros: BE, - setLength: jE, - setLengthRight: rY, - isHexString: qE, - stripHexPrefix: zE, - toBuffer: ap, - bufferToHex: nY, - keccak: iY, - bitLengthFromBigInt: eY, - bufferBEFromBigInt: UE, - twosFromBigInt: tY -}; -const ii = HE; -function WE(t) { +var KE = { + zeros: UE, + setLength: zE, + setLengthRight: hY, + isHexString: WE, + stripHexPrefix: HE, + toBuffer: cp, + bufferToHex: dY, + keccak: pY, + bitLengthFromBigInt: fY, + bufferBEFromBigInt: qE, + twosFromBigInt: lY +}; +const ii = KE; +function VE(t) { return t.startsWith("int[") ? "int256" + t.slice(3) : t === "int" ? "int256" : t.startsWith("uint[") ? "uint256" + t.slice(4) : t === "uint" ? "uint256" : t.startsWith("fixed[") ? "fixed128x128" + t.slice(5) : t === "fixed" ? "fixed128x128" : t.startsWith("ufixed[") ? "ufixed128x128" + t.slice(6) : t === "ufixed" ? "ufixed128x128" : t; } -function du(t) { +function pu(t) { return Number.parseInt(/^\D+(\d+)$/.exec(t)[1], 10); } -function a_(t) { +function u6(t) { var e = /^\D+(\d+)x(\d+)$/.exec(t); return [Number.parseInt(e[1], 10), Number.parseInt(e[2], 10)]; } -function KE(t) { +function GE(t) { var e = t.match(/(.*)\[(.*?)\]$/); return e ? e[2] === "" ? "dynamic" : Number.parseInt(e[2], 10) : null; } -function Qa(t) { +function tc(t) { var e = typeof t; if (e === "string" || e === "number") return BigInt(t); @@ -26778,38 +26778,38 @@ function Qa(t) { return t; throw new Error("Argument is not a number"); } -function js(t, e) { +function qs(t, e) { var r, n, i, s; if (t === "address") - return js("uint160", Qa(e)); + return qs("uint160", tc(e)); if (t === "bool") - return js("uint8", e ? 1 : 0); + return qs("uint8", e ? 1 : 0); if (t === "string") - return js("bytes", new Buffer(e, "utf8")); - if (aY(t)) { + return qs("bytes", new Buffer(e, "utf8")); + if (vY(t)) { if (typeof e.length > "u") throw new Error("Not an array?"); - if (r = KE(t), r !== "dynamic" && r !== 0 && e.length > r) + if (r = GE(t), r !== "dynamic" && r !== 0 && e.length > r) throw new Error("Elements exceed array size: " + r); i = [], t = t.slice(0, t.lastIndexOf("[")), typeof e == "string" && (e = JSON.parse(e)); for (s in e) - i.push(js(t, e[s])); + i.push(qs(t, e[s])); if (r === "dynamic") { - var o = js("uint256", e.length); + var o = qs("uint256", e.length); i.unshift(o); } return Buffer.concat(i); } else { if (t === "bytes") - return e = new Buffer(e), i = Buffer.concat([js("uint256", e.length), e]), e.length % 32 !== 0 && (i = Buffer.concat([i, ii.zeros(32 - e.length % 32)])), i; + return e = new Buffer(e), i = Buffer.concat([qs("uint256", e.length), e]), e.length % 32 !== 0 && (i = Buffer.concat([i, ii.zeros(32 - e.length % 32)])), i; if (t.startsWith("bytes")) { - if (r = du(t), r < 1 || r > 32) + if (r = pu(t), r < 1 || r > 32) throw new Error("Invalid bytes width: " + r); return ii.setLengthRight(e, 32); } else if (t.startsWith("uint")) { - if (r = du(t), r % 8 || r < 8 || r > 256) + if (r = pu(t), r % 8 || r < 8 || r > 256) throw new Error("Invalid uint width: " + r); - n = Qa(e); + n = tc(e); const a = ii.bitLengthFromBigInt(n); if (a > r) throw new Error("Supplied uint exceeds width: " + r + " vs " + a); @@ -26817,42 +26817,42 @@ function js(t, e) { throw new Error("Supplied uint is negative"); return ii.bufferBEFromBigInt(n, 32); } else if (t.startsWith("int")) { - if (r = du(t), r % 8 || r < 8 || r > 256) + if (r = pu(t), r % 8 || r < 8 || r > 256) throw new Error("Invalid int width: " + r); - n = Qa(e); + n = tc(e); const a = ii.bitLengthFromBigInt(n); if (a > r) throw new Error("Supplied int exceeds width: " + r + " vs " + a); const u = ii.twosFromBigInt(n, 256); return ii.bufferBEFromBigInt(u, 32); } else if (t.startsWith("ufixed")) { - if (r = a_(t), n = Qa(e), n < 0) + if (r = u6(t), n = tc(e), n < 0) throw new Error("Supplied ufixed is negative"); - return js("uint256", n * BigInt(2) ** BigInt(r[1])); + return qs("uint256", n * BigInt(2) ** BigInt(r[1])); } else if (t.startsWith("fixed")) - return r = a_(t), js("int256", Qa(e) * BigInt(2) ** BigInt(r[1])); + return r = u6(t), qs("int256", tc(e) * BigInt(2) ** BigInt(r[1])); } throw new Error("Unsupported or invalid type: " + t); } -function oY(t) { - return t === "string" || t === "bytes" || KE(t) === "dynamic"; +function mY(t) { + return t === "string" || t === "bytes" || GE(t) === "dynamic"; } -function aY(t) { +function vY(t) { return t.lastIndexOf("]") === t.length - 1; } -function cY(t, e) { +function bY(t, e) { var r = [], n = [], i = 32 * t.length; for (var s in t) { - var o = WE(t[s]), a = e[s], u = js(o, a); - oY(o) ? (r.push(js("uint256", i)), n.push(u), i += u.length) : r.push(u); + var o = VE(t[s]), a = e[s], u = qs(o, a); + mY(o) ? (r.push(qs("uint256", i)), n.push(u), i += u.length) : r.push(u); } return Buffer.concat(r.concat(n)); } -function VE(t, e) { +function YE(t, e) { if (t.length !== e.length) throw new Error("Number of types are not matching the values"); for (var r, n, i = [], s = 0; s < t.length; s++) { - var o = WE(t[s]), a = e[s]; + var o = VE(t[s]), a = e[s]; if (o === "bytes") i.push(a); else if (o === "string") @@ -26862,21 +26862,21 @@ function VE(t, e) { else if (o === "address") i.push(ii.setLength(a, 20)); else if (o.startsWith("bytes")) { - if (r = du(o), r < 1 || r > 32) + if (r = pu(o), r < 1 || r > 32) throw new Error("Invalid bytes width: " + r); i.push(ii.setLengthRight(a, r)); } else if (o.startsWith("uint")) { - if (r = du(o), r % 8 || r < 8 || r > 256) + if (r = pu(o), r % 8 || r < 8 || r > 256) throw new Error("Invalid uint width: " + r); - n = Qa(a); + n = tc(a); const u = ii.bitLengthFromBigInt(n); if (u > r) throw new Error("Supplied uint exceeds width: " + r + " vs " + u); i.push(ii.bufferBEFromBigInt(n, r / 8)); } else if (o.startsWith("int")) { - if (r = du(o), r % 8 || r < 8 || r > 256) + if (r = pu(o), r % 8 || r < 8 || r > 256) throw new Error("Invalid int width: " + r); - n = Qa(a); + n = tc(a); const u = ii.bitLengthFromBigInt(n); if (u > r) throw new Error("Supplied int exceeds width: " + r + " vs " + u); @@ -26887,15 +26887,15 @@ function VE(t, e) { } return Buffer.concat(i); } -function uY(t, e) { - return ii.keccak(VE(t, e)); +function yY(t, e) { + return ii.keccak(YE(t, e)); } -var fY = { - rawEncode: cY, - solidityPack: VE, - soliditySHA3: uY +var wY = { + rawEncode: bY, + solidityPack: YE, + soliditySHA3: yY }; -const bs = HE, Kf = fY, GE = { +const ys = KE, Vf = wY, JE = { type: "object", properties: { types: { @@ -26931,18 +26931,18 @@ const bs = HE, Kf = fY, GE = { if (n) { const o = (a, u, l) => { if (r[u] !== void 0) - return ["bytes32", l == null ? "0x0000000000000000000000000000000000000000000000000000000000000000" : bs.keccak(this.encodeData(u, l, r, n))]; + return ["bytes32", l == null ? "0x0000000000000000000000000000000000000000000000000000000000000000" : ys.keccak(this.encodeData(u, l, r, n))]; if (l === void 0) throw new Error(`missing value for field ${a} of type ${u}`); if (u === "bytes") - return ["bytes32", bs.keccak(l)]; + return ["bytes32", ys.keccak(l)]; if (u === "string") - return typeof l == "string" && (l = Buffer.from(l, "utf8")), ["bytes32", bs.keccak(l)]; + return typeof l == "string" && (l = Buffer.from(l, "utf8")), ["bytes32", ys.keccak(l)]; if (u.lastIndexOf("]") === u.length - 1) { - const d = u.slice(0, u.lastIndexOf("[")), g = l.map((w) => o(a, d, w)); - return ["bytes32", bs.keccak(Kf.rawEncode( - g.map(([w]) => w), - g.map(([, w]) => w) + const d = u.slice(0, u.lastIndexOf("[")), p = l.map((w) => o(a, d, w)); + return ["bytes32", ys.keccak(Vf.rawEncode( + p.map(([w]) => w), + p.map(([, w]) => w) ))]; } return [u, l]; @@ -26956,18 +26956,18 @@ const bs = HE, Kf = fY, GE = { let a = e[o.name]; if (a !== void 0) if (o.type === "bytes") - i.push("bytes32"), a = bs.keccak(a), s.push(a); + i.push("bytes32"), a = ys.keccak(a), s.push(a); else if (o.type === "string") - i.push("bytes32"), typeof a == "string" && (a = Buffer.from(a, "utf8")), a = bs.keccak(a), s.push(a); + i.push("bytes32"), typeof a == "string" && (a = Buffer.from(a, "utf8")), a = ys.keccak(a), s.push(a); else if (r[o.type] !== void 0) - i.push("bytes32"), a = bs.keccak(this.encodeData(o.type, a, r, n)), s.push(a); + i.push("bytes32"), a = ys.keccak(this.encodeData(o.type, a, r, n)), s.push(a); else { if (o.type.lastIndexOf("]") === o.type.length - 1) throw new Error("Arrays currently unimplemented in encodeData"); i.push(o.type), s.push(a); } } - return Kf.rawEncode(i, s); + return Vf.rawEncode(i, s); }, /** * Encodes the type of an object by encoding a comma delimited list of its members @@ -27012,7 +27012,7 @@ const bs = HE, Kf = fY, GE = { * @returns {Buffer} - Hash of an object */ hashStruct(t, e, r, n = !0) { - return bs.keccak(this.encodeData(t, e, r, n)); + return ys.keccak(this.encodeData(t, e, r, n)); }, /** * Hashes the type of an object @@ -27022,7 +27022,7 @@ const bs = HE, Kf = fY, GE = { * @returns {string} - Hash of an object */ hashType(t, e) { - return bs.keccak(this.encodeType(t, e)); + return ys.keccak(this.encodeType(t, e)); }, /** * Removes properties from a message object that are not defined per EIP-712 @@ -27032,7 +27032,7 @@ const bs = HE, Kf = fY, GE = { */ sanitizeData(t) { const e = {}; - for (const r in GE.properties) + for (const r in JE.properties) t[r] && (e[r] = t[r]); return e.types && (e.types = Object.assign({ EIP712Domain: [] }, e.types)), e; }, @@ -27044,14 +27044,14 @@ const bs = HE, Kf = fY, GE = { */ hash(t, e = !0) { const r = this.sanitizeData(t), n = [Buffer.from("1901", "hex")]; - return n.push(this.hashStruct("EIP712Domain", r.domain, r.types, e)), r.primaryType !== "EIP712Domain" && n.push(this.hashStruct(r.primaryType, r.message, r.types, e)), bs.keccak(Buffer.concat(n)); + return n.push(this.hashStruct("EIP712Domain", r.domain, r.types, e)), r.primaryType !== "EIP712Domain" && n.push(this.hashStruct(r.primaryType, r.message, r.types, e)), ys.keccak(Buffer.concat(n)); } }; -var lY = { - TYPED_MESSAGE_SCHEMA: GE, +var xY = { + TYPED_MESSAGE_SCHEMA: JE, TypedDataUtils: Pm, hashForSignTypedDataLegacy: function(t) { - return hY(t.data); + return _Y(t.data); }, hashForSignTypedData_v3: function(t) { return Pm.hash(t.data, !1); @@ -27060,30 +27060,30 @@ var lY = { return Pm.hash(t.data); } }; -function hY(t) { +function _Y(t) { const e = new Error("Expect argument to be non-empty array"); if (typeof t != "object" || !t.length) throw e; const r = t.map(function(s) { - return s.type === "bytes" ? bs.toBuffer(s.value) : s.value; + return s.type === "bytes" ? ys.toBuffer(s.value) : s.value; }), n = t.map(function(s) { return s.type; }), i = t.map(function(s) { if (!s.name) throw e; return s.type + " " + s.name; }); - return Kf.soliditySHA3( + return Vf.soliditySHA3( ["bytes32", "bytes32"], [ - Kf.soliditySHA3(new Array(t.length).fill("string"), i), - Kf.soliditySHA3(n, r) + Vf.soliditySHA3(new Array(t.length).fill("string"), i), + Vf.soliditySHA3(n, r) ] ); } -const hd = /* @__PURE__ */ ts(lY), dY = "walletUsername", $1 = "Addresses", pY = "AppVersion"; -function Bn(t) { +const dd = /* @__PURE__ */ rs(xY), EY = "walletUsername", $1 = "Addresses", SY = "AppVersion"; +function jn(t) { return t.errorMessage !== void 0; } -class gY { +class AY { // @param secret hex representation of 32-byte secret constructor(e) { this.secret = e; @@ -27099,10 +27099,10 @@ class gY { const r = this.secret; if (r.length !== 64) throw Error("secret must be 256 bits"); - const n = crypto.getRandomValues(new Uint8Array(12)), i = await crypto.subtle.importKey("raw", Rd(r), { name: "aes-gcm" }, !1, ["encrypt", "decrypt"]), s = new TextEncoder(), o = await window.crypto.subtle.encrypt({ + const n = crypto.getRandomValues(new Uint8Array(12)), i = await crypto.subtle.importKey("raw", Dd(r), { name: "aes-gcm" }, !1, ["encrypt", "decrypt"]), s = new TextEncoder(), o = await window.crypto.subtle.encrypt({ name: "AES-GCM", iv: n - }, i, s.encode(e)), a = 16, u = o.slice(o.byteLength - a), l = o.slice(0, o.byteLength - a), d = new Uint8Array(u), g = new Uint8Array(l), w = new Uint8Array([...n, ...d, ...g]); + }, i, s.encode(e)), a = 16, u = o.slice(o.byteLength - a), l = o.slice(0, o.byteLength - a), d = new Uint8Array(u), p = new Uint8Array(l), w = new Uint8Array([...n, ...d, ...p]); return mb(w); } /** @@ -27116,12 +27116,12 @@ class gY { throw Error("secret must be 256 bits"); return new Promise((n, i) => { (async function() { - const s = await crypto.subtle.importKey("raw", Rd(r), { name: "aes-gcm" }, !1, ["encrypt", "decrypt"]), o = Rd(e), a = o.slice(0, 12), u = o.slice(12, 28), l = o.slice(28), d = new Uint8Array([...l, ...u]), g = { + const s = await crypto.subtle.importKey("raw", Dd(r), { name: "aes-gcm" }, !1, ["encrypt", "decrypt"]), o = Dd(e), a = o.slice(0, 12), u = o.slice(12, 28), l = o.slice(28), d = new Uint8Array([...l, ...u]), p = { name: "AES-GCM", iv: new Uint8Array(a) }; try { - const w = await window.crypto.subtle.decrypt(g, s, d), A = new TextDecoder(); + const w = await window.crypto.subtle.decrypt(p, s, d), A = new TextDecoder(); n(A.decode(w)); } catch (w) { i(w); @@ -27130,7 +27130,7 @@ class gY { }); } } -class mY { +class PY { constructor(e, r, n) { this.linkAPIUrl = e, this.sessionId = r; const i = `${r}:${n}`; @@ -27168,11 +27168,11 @@ class mY { throw new Error(`Check unseen events failed: ${r.status}`); } } -var Ao; +var Io; (function(t) { t[t.DISCONNECTED = 0] = "DISCONNECTED", t[t.CONNECTING = 1] = "CONNECTING", t[t.CONNECTED = 2] = "CONNECTED"; -})(Ao || (Ao = {})); -class vY { +})(Io || (Io = {})); +class MY { setConnectionStateListener(e) { this.connectionStateListener = e; } @@ -27203,12 +27203,12 @@ class vY { r(s); return; } - (n = this.connectionStateListener) === null || n === void 0 || n.call(this, Ao.CONNECTING), i.onclose = (s) => { + (n = this.connectionStateListener) === null || n === void 0 || n.call(this, Io.CONNECTING), i.onclose = (s) => { var o; - this.clearWebSocket(), r(new Error(`websocket error ${s.code}: ${s.reason}`)), (o = this.connectionStateListener) === null || o === void 0 || o.call(this, Ao.DISCONNECTED); + this.clearWebSocket(), r(new Error(`websocket error ${s.code}: ${s.reason}`)), (o = this.connectionStateListener) === null || o === void 0 || o.call(this, Io.DISCONNECTED); }, i.onopen = (s) => { var o; - e(), (o = this.connectionStateListener) === null || o === void 0 || o.call(this, Ao.CONNECTED), this.pendingData.length > 0 && ([...this.pendingData].forEach((u) => this.sendData(u)), this.pendingData = []); + e(), (o = this.connectionStateListener) === null || o === void 0 || o.call(this, Io.CONNECTED), this.pendingData.length > 0 && ([...this.pendingData].forEach((u) => this.sendData(u)), this.pendingData = []); }, i.onmessage = (s) => { var o, a; if (s.data === "h") @@ -27231,7 +27231,7 @@ class vY { var e; const { webSocket: r } = this; if (r) { - this.clearWebSocket(), (e = this.connectionStateListener) === null || e === void 0 || e.call(this, Ao.DISCONNECTED), this.connectionStateListener = void 0, this.incomingDataListener = void 0; + this.clearWebSocket(), (e = this.connectionStateListener) === null || e === void 0 || e.call(this, Io.DISCONNECTED), this.connectionStateListener = void 0, this.incomingDataListener = void 0; try { r.close(); } catch { @@ -27255,8 +27255,8 @@ class vY { e && (this.webSocket = null, e.onclose = null, e.onerror = null, e.onmessage = null, e.onopen = null); } } -const c_ = 1e4, bY = 6e4; -class yY { +const f6 = 1e4, IY = 6e4; +class CY { /** * Constructor * @param session Session @@ -27265,7 +27265,7 @@ class yY { * @param [WebSocketClass] Custom WebSocket implementation */ constructor({ session: e, linkAPIUrl: r, listener: n }) { - this.destroyed = !1, this.lastHeartbeatResponse = 0, this.nextReqId = xo(1), this._connected = !1, this._linked = !1, this.shouldFetchUnseenEventsOnConnect = !1, this.requestResolutions = /* @__PURE__ */ new Map(), this.handleSessionMetadataUpdated = (s) => { + this.destroyed = !1, this.lastHeartbeatResponse = 0, this.nextReqId = So(1), this._connected = !1, this._linked = !1, this.shouldFetchUnseenEventsOnConnect = !1, this.requestResolutions = /* @__PURE__ */ new Map(), this.handleSessionMetadataUpdated = (s) => { if (!s) return; (/* @__PURE__ */ new Map([ @@ -27294,19 +27294,19 @@ class yY { const u = await this.cipher.decrypt(o); (a = this.listener) === null || a === void 0 || a.metadataUpdated(s, u); }, this.handleWalletUsernameUpdated = async (s) => { - this.handleMetadataUpdated(dY, s); + this.handleMetadataUpdated(EY, s); }, this.handleAppVersionUpdated = async (s) => { - this.handleMetadataUpdated(pY, s); + this.handleMetadataUpdated(SY, s); }, this.handleChainUpdated = async (s, o) => { var a; const u = await this.cipher.decrypt(s), l = await this.cipher.decrypt(o); (a = this.listener) === null || a === void 0 || a.chainUpdated(u, l); - }, this.session = e, this.cipher = new gY(e.secret), this.listener = n; - const i = new vY(`${r}/rpc`, WebSocket); + }, this.session = e, this.cipher = new AY(e.secret), this.listener = n; + const i = new MY(`${r}/rpc`, WebSocket); i.setConnectionStateListener(async (s) => { let o = !1; switch (s) { - case Ao.DISCONNECTED: + case Io.DISCONNECTED: if (!this.destroyed) { const a = async () => { await new Promise((u) => setTimeout(u, 5e3)), this.destroyed || i.connect().catch(() => { @@ -27316,12 +27316,12 @@ class yY { a(); } break; - case Ao.CONNECTED: + case Io.CONNECTED: o = await this.handleConnected(), this.updateLastHeartbeat(), setInterval(() => { this.heartbeat(); - }, c_), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); + }, f6), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); break; - case Ao.CONNECTING: + case Io.CONNECTING: break; } this.connected !== o && (this.connected = o); @@ -27348,7 +27348,7 @@ class yY { } } s.id !== void 0 && ((o = this.requestResolutions.get(s.id)) === null || o === void 0 || o(s)); - }), this.ws = i, this.http = new mY(r, e.id, e.key); + }), this.ws = i, this.http = new PY(r, e.id, e.key); } /** * Make a connection to the server @@ -27365,7 +27365,7 @@ class yY { async destroy() { this.destroyed || (await this.makeRequest({ type: "SetSessionConfig", - id: xo(this.nextReqId++), + id: So(this.nextReqId++), sessionId: this.session.id, metadata: { __destroyed: "1" } }, { timeout: 1e3 }), this.destroyed = !0, this.ws.disconnect(), this.listener = void 0); @@ -27425,7 +27425,7 @@ class yY { async publishEvent(e, r, n = !1) { const i = await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({}, r), { origin: location.origin, location: location.href, relaySource: "coinbaseWalletExtension" in window && window.coinbaseWalletExtension ? "injected_sdk" : "sdk" }))), s = { type: "PublishEvent", - id: xo(this.nextReqId++), + id: So(this.nextReqId++), sessionId: this.session.id, event: e, data: i, @@ -27445,7 +27445,7 @@ class yY { this.lastHeartbeatResponse = Date.now(); } heartbeat() { - if (Date.now() - this.lastHeartbeatResponse > c_ * 2) { + if (Date.now() - this.lastHeartbeatResponse > f6 * 2) { this.ws.disconnect(); return; } @@ -27454,7 +27454,7 @@ class yY { } catch { } } - async makeRequest(e, r = { timeout: bY }) { + async makeRequest(e, r = { timeout: IY }) { const n = e.id; this.sendData(e); let i; @@ -27474,42 +27474,42 @@ class yY { async handleConnected() { return (await this.makeRequest({ type: "HostSession", - id: xo(this.nextReqId++), + id: So(this.nextReqId++), sessionId: this.session.id, sessionKey: this.session.key })).type === "Fail" ? !1 : (this.sendData({ type: "IsLinked", - id: xo(this.nextReqId++), + id: So(this.nextReqId++), sessionId: this.session.id }), this.sendData({ type: "GetSessionConfig", - id: xo(this.nextReqId++), + id: So(this.nextReqId++), sessionId: this.session.id }), !0); } } -class wY { +class TY { constructor() { this._nextRequestId = 0, this.callbacks = /* @__PURE__ */ new Map(); } makeRequestId() { this._nextRequestId = (this._nextRequestId + 1) % 2147483647; - const e = this._nextRequestId, r = OE(e.toString(16)); + const e = this._nextRequestId, r = LE(e.toString(16)); return this.callbacks.get(r) && this.callbacks.delete(r), e; } } -const u_ = "session:id", f_ = "session:secret", l_ = "session:linked"; -class pu { +const l6 = "session:id", h6 = "session:secret", d6 = "session:linked"; +class gu { constructor(e, r, n, i = !1) { - this.storage = e, this.id = r, this.secret = n, this.key = lD(r4(`${r}, ${n} WalletLink`)), this._linked = !!i; + this.storage = e, this.id = r, this.secret = n, this.key = xD(i4(`${r}, ${n} WalletLink`)), this._linked = !!i; } static create(e) { - const r = Za(16), n = Za(32); - return new pu(e, r, n).save(); + const r = ec(16), n = ec(32); + return new gu(e, r, n).save(); } static load(e) { - const r = e.getItem(u_), n = e.getItem(l_), i = e.getItem(f_); - return r && i ? new pu(e, r, i, n === "1") : null; + const r = e.getItem(l6), n = e.getItem(d6), i = e.getItem(h6); + return r && i ? new gu(e, r, i, n === "1") : null; } get linked() { return this._linked; @@ -27518,52 +27518,52 @@ class pu { this._linked = e, this.persistLinked(); } save() { - return this.storage.setItem(u_, this.id), this.storage.setItem(f_, this.secret), this.persistLinked(), this; + return this.storage.setItem(l6, this.id), this.storage.setItem(h6, this.secret), this.persistLinked(), this; } persistLinked() { - this.storage.setItem(l_, this._linked ? "1" : "0"); + this.storage.setItem(d6, this._linked ? "1" : "0"); } } -function xY() { +function RY() { try { return window.frameElement !== null; } catch { return !1; } } -function _Y() { +function DY() { try { - return xY() && window.top ? window.top.location : window.location; + return RY() && window.top ? window.top.location : window.location; } catch { return window.location; } } -function EY() { +function OY() { var t; return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t = window == null ? void 0 : window.navigator) === null || t === void 0 ? void 0 : t.userAgent); } -function YE() { +function XE() { var t, e; return (e = (t = window == null ? void 0 : window.matchMedia) === null || t === void 0 ? void 0 : t.call(window, "(prefers-color-scheme: dark)").matches) !== null && e !== void 0 ? e : !1; } -const SY = '@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}'; -function JE() { +const NY = '@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}'; +function ZE() { const t = document.createElement("style"); - t.type = "text/css", t.appendChild(document.createTextNode(SY)), document.documentElement.appendChild(t); + t.type = "text/css", t.appendChild(document.createTextNode(NY)), document.documentElement.appendChild(t); } -function XE(t) { +function QE(t) { var e, r, n = ""; if (typeof t == "string" || typeof t == "number") n += t; - else if (typeof t == "object") if (Array.isArray(t)) for (e = 0; e < t.length; e++) t[e] && (r = XE(t[e])) && (n && (n += " "), n += r); + else if (typeof t == "object") if (Array.isArray(t)) for (e = 0; e < t.length; e++) t[e] && (r = QE(t[e])) && (n && (n += " "), n += r); else for (e in t) t[e] && (n && (n += " "), n += e); return n; } -function Vf() { - for (var t, e, r = 0, n = ""; r < arguments.length; ) (t = arguments[r++]) && (e = XE(t)) && (n && (n += " "), n += e); +function Gf() { + for (var t, e, r = 0, n = ""; r < arguments.length; ) (t = arguments[r++]) && (e = QE(t)) && (n && (n += " "), n += e); return n; } -var cp, Jr, ZE, ec, h_, QE, F1, eS, yb, B1, U1, Al = {}, tS = [], AY = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, wb = Array.isArray; -function pa(t, e) { +var up, Jr, eS, rc, p6, tS, B1, rS, yb, F1, j1, Pl = {}, nS = [], LY = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, wb = Array.isArray; +function va(t, e) { for (var r in e) t[r] = e[r]; return t; } @@ -27573,69 +27573,69 @@ function xb(t) { function Nr(t, e, r) { var n, i, s, o = {}; for (s in e) s == "key" ? n = e[s] : s == "ref" ? i = e[s] : o[s] = e[s]; - if (arguments.length > 2 && (o.children = arguments.length > 3 ? cp.call(arguments, 2) : r), typeof t == "function" && t.defaultProps != null) for (s in t.defaultProps) o[s] === void 0 && (o[s] = t.defaultProps[s]); - return Dd(t, o, n, i, null); + if (arguments.length > 2 && (o.children = arguments.length > 3 ? up.call(arguments, 2) : r), typeof t == "function" && t.defaultProps != null) for (s in t.defaultProps) o[s] === void 0 && (o[s] = t.defaultProps[s]); + return Od(t, o, n, i, null); } -function Dd(t, e, r, n, i) { - var s = { type: t, props: e, key: r, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++ZE, __i: -1, __u: 0 }; +function Od(t, e, r, n, i) { + var s = { type: t, props: e, key: r, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++eS, __i: -1, __u: 0 }; return i == null && Jr.vnode != null && Jr.vnode(s), s; } -function nh(t) { +function ih(t) { return t.children; } -function Od(t, e) { +function Nd(t, e) { this.props = t, this.context = e; } -function Au(t, e) { - if (e == null) return t.__ ? Au(t.__, t.__i + 1) : null; +function Pu(t, e) { + if (e == null) return t.__ ? Pu(t.__, t.__i + 1) : null; for (var r; e < t.__k.length; e++) if ((r = t.__k[e]) != null && r.__e != null) return r.__e; - return typeof t.type == "function" ? Au(t) : null; + return typeof t.type == "function" ? Pu(t) : null; } -function rS(t) { +function iS(t) { var e, r; if ((t = t.__) != null && t.__c != null) { for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) if ((r = t.__k[e]) != null && r.__e != null) { t.__e = t.__c.base = r.__e; break; } - return rS(t); + return iS(t); } } -function d_(t) { - (!t.__d && (t.__d = !0) && ec.push(t) && !h0.__r++ || h_ !== Jr.debounceRendering) && ((h_ = Jr.debounceRendering) || QE)(h0); +function g6(t) { + (!t.__d && (t.__d = !0) && rc.push(t) && !d0.__r++ || p6 !== Jr.debounceRendering) && ((p6 = Jr.debounceRendering) || tS)(d0); } -function h0() { +function d0() { var t, e, r, n, i, s, o, a; - for (ec.sort(F1); t = ec.shift(); ) t.__d && (e = ec.length, n = void 0, s = (i = (r = t).__v).__e, o = [], a = [], r.__P && ((n = pa({}, i)).__v = i.__v + 1, Jr.vnode && Jr.vnode(n), _b(r.__P, n, i, r.__n, r.__P.namespaceURI, 32 & i.__u ? [s] : null, o, s ?? Au(i), !!(32 & i.__u), a), n.__v = i.__v, n.__.__k[n.__i] = n, sS(o, n, a), n.__e != s && rS(n)), ec.length > e && ec.sort(F1)); - h0.__r = 0; + for (rc.sort(B1); t = rc.shift(); ) t.__d && (e = rc.length, n = void 0, s = (i = (r = t).__v).__e, o = [], a = [], r.__P && ((n = va({}, i)).__v = i.__v + 1, Jr.vnode && Jr.vnode(n), _b(r.__P, n, i, r.__n, r.__P.namespaceURI, 32 & i.__u ? [s] : null, o, s ?? Pu(i), !!(32 & i.__u), a), n.__v = i.__v, n.__.__k[n.__i] = n, aS(o, n, a), n.__e != s && iS(n)), rc.length > e && rc.sort(B1)); + d0.__r = 0; } -function nS(t, e, r, n, i, s, o, a, u, l, d) { - var g, w, A, M, N, L, $ = n && n.__k || tS, F = e.length; - for (u = PY(r, e, $, u), g = 0; g < F; g++) (A = r.__k[g]) != null && (w = A.__i === -1 ? Al : $[A.__i] || Al, A.__i = g, L = _b(t, A, w, i, s, o, a, u, l, d), M = A.__e, A.ref && w.ref != A.ref && (w.ref && Eb(w.ref, null, A), d.push(A.ref, A.__c || M, A)), N == null && M != null && (N = M), 4 & A.__u || w.__k === A.__k ? u = iS(A, u, t) : typeof A.type == "function" && L !== void 0 ? u = L : M && (u = M.nextSibling), A.__u &= -7); +function sS(t, e, r, n, i, s, o, a, u, l, d) { + var p, w, A, P, N, L, $ = n && n.__k || nS, B = e.length; + for (u = kY(r, e, $, u), p = 0; p < B; p++) (A = r.__k[p]) != null && (w = A.__i === -1 ? Pl : $[A.__i] || Pl, A.__i = p, L = _b(t, A, w, i, s, o, a, u, l, d), P = A.__e, A.ref && w.ref != A.ref && (w.ref && Eb(w.ref, null, A), d.push(A.ref, A.__c || P, A)), N == null && P != null && (N = P), 4 & A.__u || w.__k === A.__k ? u = oS(A, u, t) : typeof A.type == "function" && L !== void 0 ? u = L : P && (u = P.nextSibling), A.__u &= -7); return r.__e = N, u; } -function PY(t, e, r, n) { - var i, s, o, a, u, l = e.length, d = r.length, g = d, w = 0; - for (t.__k = [], i = 0; i < l; i++) (s = e[i]) != null && typeof s != "boolean" && typeof s != "function" ? (a = i + w, (s = t.__k[i] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Dd(null, s, null, null, null) : wb(s) ? Dd(nh, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? Dd(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, o = null, (u = s.__i = MY(s, r, a, g)) !== -1 && (g--, (o = r[u]) && (o.__u |= 2)), o == null || o.__v === null ? (u == -1 && w--, typeof s.type != "function" && (s.__u |= 4)) : u !== a && (u == a - 1 ? w-- : u == a + 1 ? w++ : (u > a ? w-- : w++, s.__u |= 4))) : s = t.__k[i] = null; - if (g) for (i = 0; i < d; i++) (o = r[i]) != null && !(2 & o.__u) && (o.__e == n && (n = Au(o)), oS(o, o)); +function kY(t, e, r, n) { + var i, s, o, a, u, l = e.length, d = r.length, p = d, w = 0; + for (t.__k = [], i = 0; i < l; i++) (s = e[i]) != null && typeof s != "boolean" && typeof s != "function" ? (a = i + w, (s = t.__k[i] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Od(null, s, null, null, null) : wb(s) ? Od(ih, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? Od(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, o = null, (u = s.__i = $Y(s, r, a, p)) !== -1 && (p--, (o = r[u]) && (o.__u |= 2)), o == null || o.__v === null ? (u == -1 && w--, typeof s.type != "function" && (s.__u |= 4)) : u !== a && (u == a - 1 ? w-- : u == a + 1 ? w++ : (u > a ? w-- : w++, s.__u |= 4))) : s = t.__k[i] = null; + if (p) for (i = 0; i < d; i++) (o = r[i]) != null && !(2 & o.__u) && (o.__e == n && (n = Pu(o)), cS(o, o)); return n; } -function iS(t, e, r) { +function oS(t, e, r) { var n, i; if (typeof t.type == "function") { - for (n = t.__k, i = 0; n && i < n.length; i++) n[i] && (n[i].__ = t, e = iS(n[i], e, r)); + for (n = t.__k, i = 0; n && i < n.length; i++) n[i] && (n[i].__ = t, e = oS(n[i], e, r)); return e; } - t.__e != e && (e && t.type && !r.contains(e) && (e = Au(t)), r.insertBefore(t.__e, e || null), e = t.__e); + t.__e != e && (e && t.type && !r.contains(e) && (e = Pu(t)), r.insertBefore(t.__e, e || null), e = t.__e); do e = e && e.nextSibling; while (e != null && e.nodeType === 8); return e; } -function MY(t, e, r, n) { +function $Y(t, e, r, n) { var i = t.key, s = t.type, o = r - 1, a = r + 1, u = e[r]; if (u === null || u && i == u.key && s === u.type && !(2 & u.__u)) return r; - if ((typeof s != "function" || s === nh || i) && n > (u != null && !(2 & u.__u) ? 1 : 0)) for (; o >= 0 || a < e.length; ) { + if ((typeof s != "function" || s === ih || i) && n > (u != null && !(2 & u.__u) ? 1 : 0)) for (; o >= 0 || a < e.length; ) { if (o >= 0) { if ((u = e[o]) && !(2 & u.__u) && i == u.key && s === u.type) return o; o--; @@ -27647,17 +27647,17 @@ function MY(t, e, r, n) { } return -1; } -function p_(t, e, r) { - e[0] === "-" ? t.setProperty(e, r ?? "") : t[e] = r == null ? "" : typeof r != "number" || AY.test(e) ? r : r + "px"; +function m6(t, e, r) { + e[0] === "-" ? t.setProperty(e, r ?? "") : t[e] = r == null ? "" : typeof r != "number" || LY.test(e) ? r : r + "px"; } -function dd(t, e, r, n, i) { +function pd(t, e, r, n, i) { var s; e: if (e === "style") if (typeof r == "string") t.style.cssText = r; else { - if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || p_(t.style, e, ""); - if (r) for (e in r) n && r[e] === n[e] || p_(t.style, e, r[e]); + if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || m6(t.style, e, ""); + if (r) for (e in r) n && r[e] === n[e] || m6(t.style, e, r[e]); } - else if (e[0] === "o" && e[1] === "n") s = e !== (e = e.replace(eS, "$1")), e = e.toLowerCase() in t || e === "onFocusOut" || e === "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = yb, t.addEventListener(e, s ? U1 : B1, s)) : t.removeEventListener(e, s ? U1 : B1, s); + else if (e[0] === "o" && e[1] === "n") s = e !== (e = e.replace(rS, "$1")), e = e.toLowerCase() in t || e === "onFocusOut" || e === "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = yb, t.addEventListener(e, s ? j1 : F1, s)) : t.removeEventListener(e, s ? j1 : F1, s); else { if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try { @@ -27668,7 +27668,7 @@ function dd(t, e, r, n, i) { typeof r == "function" || (r == null || r === !1 && e[4] !== "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && r == 1 ? "" : r)); } } -function g_(t) { +function v6(t) { return function(e) { if (this.l) { var r = this.l[e.type + t]; @@ -27679,30 +27679,30 @@ function g_(t) { }; } function _b(t, e, r, n, i, s, o, a, u, l) { - var d, g, w, A, M, N, L, $, F, K, H, V, te, R, W, pe, Ee, Y = e.type; + var d, p, w, A, P, N, L, $, B, H, W, V, te, R, K, ge, Ee, Y = e.type; if (e.constructor !== void 0) return null; 128 & r.__u && (u = !!(32 & r.__u), s = [a = e.__e = r.__e]), (d = Jr.__b) && d(e); e: if (typeof Y == "function") try { - if ($ = e.props, F = "prototype" in Y && Y.prototype.render, K = (d = Y.contextType) && n[d.__c], H = d ? K ? K.props.value : d.__ : n, r.__c ? L = (g = e.__c = r.__c).__ = g.__E : (F ? e.__c = g = new Y($, H) : (e.__c = g = new Od($, H), g.constructor = Y, g.render = CY), K && K.sub(g), g.props = $, g.state || (g.state = {}), g.context = H, g.__n = n, w = g.__d = !0, g.__h = [], g._sb = []), F && g.__s == null && (g.__s = g.state), F && Y.getDerivedStateFromProps != null && (g.__s == g.state && (g.__s = pa({}, g.__s)), pa(g.__s, Y.getDerivedStateFromProps($, g.__s))), A = g.props, M = g.state, g.__v = e, w) F && Y.getDerivedStateFromProps == null && g.componentWillMount != null && g.componentWillMount(), F && g.componentDidMount != null && g.__h.push(g.componentDidMount); + if ($ = e.props, B = "prototype" in Y && Y.prototype.render, H = (d = Y.contextType) && n[d.__c], W = d ? H ? H.props.value : d.__ : n, r.__c ? L = (p = e.__c = r.__c).__ = p.__E : (B ? e.__c = p = new Y($, W) : (e.__c = p = new Nd($, W), p.constructor = Y, p.render = FY), H && H.sub(p), p.props = $, p.state || (p.state = {}), p.context = W, p.__n = n, w = p.__d = !0, p.__h = [], p._sb = []), B && p.__s == null && (p.__s = p.state), B && Y.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = va({}, p.__s)), va(p.__s, Y.getDerivedStateFromProps($, p.__s))), A = p.props, P = p.state, p.__v = e, w) B && Y.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), B && p.componentDidMount != null && p.__h.push(p.componentDidMount); else { - if (F && Y.getDerivedStateFromProps == null && $ !== A && g.componentWillReceiveProps != null && g.componentWillReceiveProps($, H), !g.__e && (g.shouldComponentUpdate != null && g.shouldComponentUpdate($, g.__s, H) === !1 || e.__v === r.__v)) { - for (e.__v !== r.__v && (g.props = $, g.state = g.__s, g.__d = !1), e.__e = r.__e, e.__k = r.__k, e.__k.some(function(S) { + if (B && Y.getDerivedStateFromProps == null && $ !== A && p.componentWillReceiveProps != null && p.componentWillReceiveProps($, W), !p.__e && (p.shouldComponentUpdate != null && p.shouldComponentUpdate($, p.__s, W) === !1 || e.__v === r.__v)) { + for (e.__v !== r.__v && (p.props = $, p.state = p.__s, p.__d = !1), e.__e = r.__e, e.__k = r.__k, e.__k.some(function(S) { S && (S.__ = e); - }), V = 0; V < g._sb.length; V++) g.__h.push(g._sb[V]); - g._sb = [], g.__h.length && o.push(g); + }), V = 0; V < p._sb.length; V++) p.__h.push(p._sb[V]); + p._sb = [], p.__h.length && o.push(p); break e; } - g.componentWillUpdate != null && g.componentWillUpdate($, g.__s, H), F && g.componentDidUpdate != null && g.__h.push(function() { - g.componentDidUpdate(A, M, N); + p.componentWillUpdate != null && p.componentWillUpdate($, p.__s, W), B && p.componentDidUpdate != null && p.__h.push(function() { + p.componentDidUpdate(A, P, N); }); } - if (g.context = H, g.props = $, g.__P = t, g.__e = !1, te = Jr.__r, R = 0, F) { - for (g.state = g.__s, g.__d = !1, te && te(e), d = g.render(g.props, g.state, g.context), W = 0; W < g._sb.length; W++) g.__h.push(g._sb[W]); - g._sb = []; + if (p.context = W, p.props = $, p.__P = t, p.__e = !1, te = Jr.__r, R = 0, B) { + for (p.state = p.__s, p.__d = !1, te && te(e), d = p.render(p.props, p.state, p.context), K = 0; K < p._sb.length; K++) p.__h.push(p._sb[K]); + p._sb = []; } else do - g.__d = !1, te && te(e), d = g.render(g.props, g.state, g.context), g.state = g.__s; - while (g.__d && ++R < 25); - g.state = g.__s, g.getChildContext != null && (n = pa(pa({}, n), g.getChildContext())), F && !w && g.getSnapshotBeforeUpdate != null && (N = g.getSnapshotBeforeUpdate(A, M)), a = nS(t, wb(pe = d != null && d.type === nh && d.key == null ? d.props.children : d) ? pe : [pe], e, r, n, i, s, o, a, u, l), g.base = e.__e, e.__u &= -161, g.__h.length && o.push(g), L && (g.__E = g.__ = null); + p.__d = !1, te && te(e), d = p.render(p.props, p.state, p.context), p.state = p.__s; + while (p.__d && ++R < 25); + p.state = p.__s, p.getChildContext != null && (n = va(va({}, n), p.getChildContext())), B && !w && p.getSnapshotBeforeUpdate != null && (N = p.getSnapshotBeforeUpdate(A, P)), a = sS(t, wb(ge = d != null && d.type === ih && d.key == null ? d.props.children : d) ? ge : [ge], e, r, n, i, s, o, a, u, l), p.base = e.__e, e.__u &= -161, p.__h.length && o.push(p), L && (p.__E = p.__ = null); } catch (S) { if (e.__v = null, u || s != null) if (S.then) { for (e.__u |= u ? 160 : 128; a && a.nodeType === 8 && a.nextSibling; ) a = a.nextSibling; @@ -27711,10 +27711,10 @@ function _b(t, e, r, n, i, s, o, a, u, l) { else e.__e = r.__e, e.__k = r.__k; Jr.__e(S, e, r); } - else s == null && e.__v === r.__v ? (e.__k = r.__k, e.__e = r.__e) : a = e.__e = IY(r.__e, e, r, n, i, s, o, u, l); + else s == null && e.__v === r.__v ? (e.__k = r.__k, e.__e = r.__e) : a = e.__e = BY(r.__e, e, r, n, i, s, o, u, l); return (d = Jr.diffed) && d(e), 128 & e.__u ? void 0 : a; } -function sS(t, e, r) { +function aS(t, e, r) { for (var n = 0; n < r.length; n++) Eb(r[n], r[++n], r[++n]); Jr.__c && Jr.__c(e, t), t.some(function(i) { try { @@ -27726,32 +27726,32 @@ function sS(t, e, r) { } }); } -function IY(t, e, r, n, i, s, o, a, u) { - var l, d, g, w, A, M, N, L = r.props, $ = e.props, F = e.type; - if (F === "svg" ? i = "http://www.w3.org/2000/svg" : F === "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) { - for (l = 0; l < s.length; l++) if ((A = s[l]) && "setAttribute" in A == !!F && (F ? A.localName === F : A.nodeType === 3)) { +function BY(t, e, r, n, i, s, o, a, u) { + var l, d, p, w, A, P, N, L = r.props, $ = e.props, B = e.type; + if (B === "svg" ? i = "http://www.w3.org/2000/svg" : B === "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) { + for (l = 0; l < s.length; l++) if ((A = s[l]) && "setAttribute" in A == !!B && (B ? A.localName === B : A.nodeType === 3)) { t = A, s[l] = null; break; } } if (t == null) { - if (F === null) return document.createTextNode($); - t = document.createElementNS(i, F, $.is && $), a && (Jr.__m && Jr.__m(e, s), a = !1), s = null; + if (B === null) return document.createTextNode($); + t = document.createElementNS(i, B, $.is && $), a && (Jr.__m && Jr.__m(e, s), a = !1), s = null; } - if (F === null) L === $ || a && t.data === $ || (t.data = $); + if (B === null) L === $ || a && t.data === $ || (t.data = $); else { - if (s = s && cp.call(t.childNodes), L = r.props || Al, !a && s != null) for (L = {}, l = 0; l < t.attributes.length; l++) L[(A = t.attributes[l]).name] = A.value; + if (s = s && up.call(t.childNodes), L = r.props || Pl, !a && s != null) for (L = {}, l = 0; l < t.attributes.length; l++) L[(A = t.attributes[l]).name] = A.value; for (l in L) if (A = L[l], l != "children") { - if (l == "dangerouslySetInnerHTML") g = A; + if (l == "dangerouslySetInnerHTML") p = A; else if (!(l in $)) { if (l == "value" && "defaultValue" in $ || l == "checked" && "defaultChecked" in $) continue; - dd(t, l, null, A, i); + pd(t, l, null, A, i); } } - for (l in $) A = $[l], l == "children" ? w = A : l == "dangerouslySetInnerHTML" ? d = A : l == "value" ? M = A : l == "checked" ? N = A : a && typeof A != "function" || L[l] === A || dd(t, l, A, L[l], i); - if (d) a || g && (d.__html === g.__html || d.__html === t.innerHTML) || (t.innerHTML = d.__html), e.__k = []; - else if (g && (t.innerHTML = ""), nS(t, wb(w) ? w : [w], e, r, n, F === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && Au(r, 0), a, u), s != null) for (l = s.length; l--; ) xb(s[l]); - a || (l = "value", F === "progress" && M == null ? t.removeAttribute("value") : M !== void 0 && (M !== t[l] || F === "progress" && !M || F === "option" && M !== L[l]) && dd(t, l, M, L[l], i), l = "checked", N !== void 0 && N !== t[l] && dd(t, l, N, L[l], i)); + for (l in $) A = $[l], l == "children" ? w = A : l == "dangerouslySetInnerHTML" ? d = A : l == "value" ? P = A : l == "checked" ? N = A : a && typeof A != "function" || L[l] === A || pd(t, l, A, L[l], i); + if (d) a || p && (d.__html === p.__html || d.__html === t.innerHTML) || (t.innerHTML = d.__html), e.__k = []; + else if (p && (t.innerHTML = ""), sS(t, wb(w) ? w : [w], e, r, n, B === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && Pu(r, 0), a, u), s != null) for (l = s.length; l--; ) xb(s[l]); + a || (l = "value", B === "progress" && P == null ? t.removeAttribute("value") : P !== void 0 && (P !== t[l] || B === "progress" && !P || B === "option" && P !== L[l]) && pd(t, l, P, L[l], i), l = "checked", N !== void 0 && N !== t[l] && pd(t, l, N, L[l], i)); } return t; } @@ -27765,7 +27765,7 @@ function Eb(t, e, r) { Jr.__e(i, r); } } -function oS(t, e, r) { +function cS(t, e, r) { var n, i; if (Jr.unmount && Jr.unmount(t), (n = t.ref) && (n.current && n.current !== t.__e || Eb(n, null, e)), (n = t.__c) != null) { if (n.componentWillUnmount) try { @@ -27775,43 +27775,43 @@ function oS(t, e, r) { } n.base = n.__P = null; } - if (n = t.__k) for (i = 0; i < n.length; i++) n[i] && oS(n[i], e, r || typeof t.type != "function"); + if (n = t.__k) for (i = 0; i < n.length; i++) n[i] && cS(n[i], e, r || typeof t.type != "function"); r || xb(t.__e), t.__c = t.__ = t.__e = void 0; } -function CY(t, e, r) { +function FY(t, e, r) { return this.constructor(t, r); } -function j1(t, e, r) { +function U1(t, e, r) { var n, i, s, o; - e === document && (e = document.documentElement), Jr.__ && Jr.__(t, e), i = (n = typeof r == "function") ? null : e.__k, s = [], o = [], _b(e, t = (!n && r || e).__k = Nr(nh, null, [t]), i || Al, Al, e.namespaceURI, !n && r ? [r] : i ? null : e.firstChild ? cp.call(e.childNodes) : null, s, !n && r ? r : i ? i.__e : e.firstChild, n, o), sS(s, t, o); + e === document && (e = document.documentElement), Jr.__ && Jr.__(t, e), i = (n = typeof r == "function") ? null : e.__k, s = [], o = [], _b(e, t = (!n && r || e).__k = Nr(ih, null, [t]), i || Pl, Pl, e.namespaceURI, !n && r ? [r] : i ? null : e.firstChild ? up.call(e.childNodes) : null, s, !n && r ? r : i ? i.__e : e.firstChild, n, o), aS(s, t, o); } -cp = tS.slice, Jr = { __e: function(t, e, r, n) { +up = nS.slice, Jr = { __e: function(t, e, r, n) { for (var i, s, o; e = e.__; ) if ((i = e.__c) && !i.__) try { if ((s = i.constructor) && s.getDerivedStateFromError != null && (i.setState(s.getDerivedStateFromError(t)), o = i.__d), i.componentDidCatch != null && (i.componentDidCatch(t, n || {}), o = i.__d), o) return i.__E = i; } catch (a) { t = a; } throw t; -} }, ZE = 0, Od.prototype.setState = function(t, e) { +} }, eS = 0, Nd.prototype.setState = function(t, e) { var r; - r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = pa({}, this.state), typeof t == "function" && (t = t(pa({}, r), this.props)), t && pa(r, t), t != null && this.__v && (e && this._sb.push(e), d_(this)); -}, Od.prototype.forceUpdate = function(t) { - this.__v && (this.__e = !0, t && this.__h.push(t), d_(this)); -}, Od.prototype.render = nh, ec = [], QE = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, F1 = function(t, e) { + r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = va({}, this.state), typeof t == "function" && (t = t(va({}, r), this.props)), t && va(r, t), t != null && this.__v && (e && this._sb.push(e), g6(this)); +}, Nd.prototype.forceUpdate = function(t) { + this.__v && (this.__e = !0, t && this.__h.push(t), g6(this)); +}, Nd.prototype.render = ih, rc = [], tS = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, B1 = function(t, e) { return t.__v.__b - e.__v.__b; -}, h0.__r = 0, eS = /(PointerCapture)$|Capture$/i, yb = 0, B1 = g_(!1), U1 = g_(!0); -var d0, pn, Mm, m_, q1 = 0, aS = [], yn = Jr, v_ = yn.__b, b_ = yn.__r, y_ = yn.diffed, w_ = yn.__c, x_ = yn.unmount, __ = yn.__; -function cS(t, e) { +}, d0.__r = 0, rS = /(PointerCapture)$|Capture$/i, yb = 0, F1 = v6(!1), j1 = v6(!0); +var p0, pn, Mm, b6, q1 = 0, uS = [], yn = Jr, y6 = yn.__b, w6 = yn.__r, x6 = yn.diffed, _6 = yn.__c, E6 = yn.unmount, S6 = yn.__; +function fS(t, e) { yn.__h && yn.__h(pn, t, q1 || e), q1 = 0; var r = pn.__H || (pn.__H = { __: [], __h: [] }); return t >= r.__.length && r.__.push({}), r.__[t]; } -function E_(t) { - return q1 = 1, TY(uS, t); +function A6(t) { + return q1 = 1, jY(lS, t); } -function TY(t, e, r) { - var n = cS(d0++, 2); - if (n.t = t, !n.__c && (n.__ = [uS(void 0, e), function(a) { +function jY(t, e, r) { + var n = fS(p0++, 2); + if (n.t = t, !n.__c && (n.__ = [lS(void 0, e), function(a) { var u = n.__N ? n.__N[0] : n.__[0], l = n.t(u, a); u !== l && (n.__N = [l, n.__[1]], n.__c.setState({})); }], n.__c = pn, !pn.u)) { @@ -27823,13 +27823,13 @@ function TY(t, e, r) { if (d.every(function(w) { return !w.__N; })) return !s || s.call(this, a, u, l); - var g = n.__c.props !== a; + var p = n.__c.props !== a; return d.forEach(function(w) { if (w.__N) { var A = w.__[0]; - w.__ = w.__N, w.__N = void 0, A !== w.__[0] && (g = !0); + w.__ = w.__N, w.__N = void 0, A !== w.__[0] && (p = !0); } - }), s && s.call(this, a, u, l) || g; + }), s && s.call(this, a, u, l) || p; }; pn.u = !0; var s = pn.shouldComponentUpdate, o = pn.componentWillUpdate; @@ -27843,37 +27843,37 @@ function TY(t, e, r) { } return n.__N || n.__; } -function RY(t, e) { - var r = cS(d0++, 3); - !yn.__s && NY(r.__H, e) && (r.__ = t, r.i = e, pn.__H.__h.push(r)); +function UY(t, e) { + var r = fS(p0++, 3); + !yn.__s && WY(r.__H, e) && (r.__ = t, r.i = e, pn.__H.__h.push(r)); } -function DY() { - for (var t; t = aS.shift(); ) if (t.__P && t.__H) try { - t.__H.__h.forEach(Nd), t.__H.__h.forEach(z1), t.__H.__h = []; +function qY() { + for (var t; t = uS.shift(); ) if (t.__P && t.__H) try { + t.__H.__h.forEach(Ld), t.__H.__h.forEach(z1), t.__H.__h = []; } catch (e) { t.__H.__h = [], yn.__e(e, t.__v); } } yn.__b = function(t) { - pn = null, v_ && v_(t); + pn = null, y6 && y6(t); }, yn.__ = function(t, e) { - t && e.__k && e.__k.__m && (t.__m = e.__k.__m), __ && __(t, e); + t && e.__k && e.__k.__m && (t.__m = e.__k.__m), S6 && S6(t, e); }, yn.__r = function(t) { - b_ && b_(t), d0 = 0; + w6 && w6(t), p0 = 0; var e = (pn = t.__c).__H; e && (Mm === pn ? (e.__h = [], pn.__h = [], e.__.forEach(function(r) { r.__N && (r.__ = r.__N), r.i = r.__N = void 0; - })) : (e.__h.forEach(Nd), e.__h.forEach(z1), e.__h = [], d0 = 0)), Mm = pn; + })) : (e.__h.forEach(Ld), e.__h.forEach(z1), e.__h = [], p0 = 0)), Mm = pn; }, yn.diffed = function(t) { - y_ && y_(t); + x6 && x6(t); var e = t.__c; - e && e.__H && (e.__H.__h.length && (aS.push(e) !== 1 && m_ === yn.requestAnimationFrame || ((m_ = yn.requestAnimationFrame) || OY)(DY)), e.__H.__.forEach(function(r) { + e && e.__H && (e.__H.__h.length && (uS.push(e) !== 1 && b6 === yn.requestAnimationFrame || ((b6 = yn.requestAnimationFrame) || zY)(qY)), e.__H.__.forEach(function(r) { r.i && (r.__H = r.i), r.i = void 0; })), Mm = pn = null; }, yn.__c = function(t, e) { e.some(function(r) { try { - r.__h.forEach(Nd), r.__h = r.__h.filter(function(n) { + r.__h.forEach(Ld), r.__h = r.__h.filter(function(n) { return !n.__ || z1(n); }); } catch (n) { @@ -27881,26 +27881,26 @@ yn.__b = function(t) { i.__h && (i.__h = []); }), e = [], yn.__e(n, r.__v); } - }), w_ && w_(t, e); + }), _6 && _6(t, e); }, yn.unmount = function(t) { - x_ && x_(t); + E6 && E6(t); var e, r = t.__c; r && r.__H && (r.__H.__.forEach(function(n) { try { - Nd(n); + Ld(n); } catch (i) { e = i; } }), r.__H = void 0, e && yn.__e(e, r.__v)); }; -var S_ = typeof requestAnimationFrame == "function"; -function OY(t) { +var P6 = typeof requestAnimationFrame == "function"; +function zY(t) { var e, r = function() { - clearTimeout(n), S_ && cancelAnimationFrame(e), setTimeout(t); + clearTimeout(n), P6 && cancelAnimationFrame(e), setTimeout(t); }, n = setTimeout(r, 100); - S_ && (e = requestAnimationFrame(r)); + P6 && (e = requestAnimationFrame(r)); } -function Nd(t) { +function Ld(t) { var e = pn, r = t.__c; typeof r == "function" && (t.__c = void 0, r()), pn = e; } @@ -27908,18 +27908,18 @@ function z1(t) { var e = pn; t.__c = t.__(), pn = e; } -function NY(t, e) { +function WY(t, e) { return !t || t.length !== e.length || e.some(function(r, n) { return r !== t[n]; }); } -function uS(t, e) { +function lS(t, e) { return typeof e == "function" ? e(t) : e; } -const LY = ".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}", kY = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+", $Y = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4="; -class FY { +const HY = ".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}", KY = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+", VY = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4="; +class GY { constructor() { - this.items = /* @__PURE__ */ new Map(), this.nextItemKey = 0, this.root = null, this.darkMode = YE(); + this.items = /* @__PURE__ */ new Map(), this.nextItemKey = 0, this.root = null, this.darkMode = XE(); } attach(e) { this.root = document.createElement("div"), this.root.className = "-cbwsdk-snackbar-root", e.appendChild(this.root), this.render(); @@ -27934,21 +27934,21 @@ class FY { this.items.clear(), this.render(); } render() { - this.root && j1(Nr( + this.root && U1(Nr( "div", null, - Nr(fS, { darkMode: this.darkMode }, Array.from(this.items.entries()).map(([e, r]) => Nr(BY, Object.assign({}, r, { key: e })))) + Nr(hS, { darkMode: this.darkMode }, Array.from(this.items.entries()).map(([e, r]) => Nr(YY, Object.assign({}, r, { key: e })))) ), this.root); } } -const fS = (t) => Nr( +const hS = (t) => Nr( "div", - { class: Vf("-cbwsdk-snackbar-container") }, - Nr("style", null, LY), + { class: Gf("-cbwsdk-snackbar-container") }, + Nr("style", null, HY), Nr("div", { class: "-cbwsdk-snackbar" }, t.children) -), BY = ({ autoExpand: t, message: e, menuItems: r }) => { - const [n, i] = E_(!0), [s, o] = E_(t ?? !1); - RY(() => { +), YY = ({ autoExpand: t, message: e, menuItems: r }) => { + const [n, i] = A6(!0), [s, o] = A6(t ?? !1); + UY(() => { const u = [ window.setTimeout(() => { i(!1); @@ -27966,11 +27966,11 @@ const fS = (t) => Nr( }; return Nr( "div", - { class: Vf("-cbwsdk-snackbar-instance", n && "-cbwsdk-snackbar-instance-hidden", s && "-cbwsdk-snackbar-instance-expanded") }, + { class: Gf("-cbwsdk-snackbar-instance", n && "-cbwsdk-snackbar-instance-hidden", s && "-cbwsdk-snackbar-instance-expanded") }, Nr( "div", { class: "-cbwsdk-snackbar-instance-header", onClick: a }, - Nr("img", { src: kY, class: "-cbwsdk-snackbar-instance-header-cblogo" }), + Nr("img", { src: KY, class: "-cbwsdk-snackbar-instance-header-cblogo" }), " ", Nr("div", { class: "-cbwsdk-snackbar-instance-header-message" }, e), Nr( @@ -27981,30 +27981,30 @@ const fS = (t) => Nr( { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, Nr("circle", { cx: "12", cy: "12", r: "12", fill: "#F5F7F8" }) ), - Nr("img", { src: $Y, class: "-gear-icon", title: "Expand" }) + Nr("img", { src: VY, class: "-gear-icon", title: "Expand" }) ) ), r && r.length > 0 && Nr("div", { class: "-cbwsdk-snackbar-instance-menu" }, r.map((u, l) => Nr( "div", - { class: Vf("-cbwsdk-snackbar-instance-menu-item", u.isRed && "-cbwsdk-snackbar-instance-menu-item-is-red"), onClick: u.onClick, key: l }, + { class: Gf("-cbwsdk-snackbar-instance-menu-item", u.isRed && "-cbwsdk-snackbar-instance-menu-item-is-red"), onClick: u.onClick, key: l }, Nr( "svg", { width: u.svgWidth, height: u.svgHeight, viewBox: "0 0 10 11", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, Nr("path", { "fill-rule": u.defaultFillRule, "clip-rule": u.defaultClipRule, d: u.path, fill: "#AAAAAA" }) ), - Nr("span", { class: Vf("-cbwsdk-snackbar-instance-menu-item-info", u.isRed && "-cbwsdk-snackbar-instance-menu-item-info-is-red") }, u.info) + Nr("span", { class: Gf("-cbwsdk-snackbar-instance-menu-item-info", u.isRed && "-cbwsdk-snackbar-instance-menu-item-info-is-red") }, u.info) ))) ); }; -class UY { +class JY { constructor() { - this.attached = !1, this.snackbar = new FY(); + this.attached = !1, this.snackbar = new GY(); } attach() { if (this.attached) throw new Error("Coinbase Wallet SDK UI is already attached"); const e = document.documentElement, r = document.createElement("div"); - r.className = "-cbwsdk-css-reset", e.appendChild(r), this.snackbar.attach(r), this.attached = !0, JE(); + r.className = "-cbwsdk-css-reset", e.appendChild(r), this.snackbar.attach(r), this.attached = !0, ZE(); } showConnecting(e) { let r; @@ -28050,14 +28050,14 @@ class UY { }, this.snackbar.presentItem(r); } } -const jY = ".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}"; -class qY { +const XY = ".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}"; +class ZY { constructor() { - this.root = null, this.darkMode = YE(); + this.root = null, this.darkMode = XE(); } attach() { const e = document.documentElement; - this.root = document.createElement("div"), this.root.className = "-cbwsdk-css-reset", e.appendChild(this.root), JE(); + this.root = document.createElement("div"), this.root.className = "-cbwsdk-css-reset", e.appendChild(this.root), ZE(); } present(e) { this.render(e); @@ -28066,33 +28066,33 @@ class qY { this.render(null); } render(e) { - this.root && (j1(null, this.root), e && j1(Nr(zY, Object.assign({}, e, { onDismiss: () => { + this.root && (U1(null, this.root), e && U1(Nr(QY, Object.assign({}, e, { onDismiss: () => { this.clear(); }, darkMode: this.darkMode })), this.root)); } } -const zY = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: i }) => { +const QY = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: i }) => { const s = r ? "dark" : "light"; return Nr( - fS, + hS, { darkMode: r }, Nr( "div", { class: "-cbwsdk-redirect-dialog" }, - Nr("style", null, jY), + Nr("style", null, XY), Nr("div", { class: "-cbwsdk-redirect-dialog-backdrop", onClick: i }), Nr( "div", - { class: Vf("-cbwsdk-redirect-dialog-box", s) }, + { class: Gf("-cbwsdk-redirect-dialog-box", s) }, Nr("p", null, t), Nr("button", { onClick: n }, e) ) ) ); -}, HY = "https://keys.coinbase.com/connect", A_ = "https://www.walletlink.org", WY = "https://go.cb-w.com/walletlink"; -class P_ { +}, eJ = "https://keys.coinbase.com/connect", M6 = "https://www.walletlink.org", tJ = "https://go.cb-w.com/walletlink"; +class I6 { constructor() { - this.attached = !1, this.redirectDialog = new qY(); + this.attached = !1, this.redirectDialog = new ZY(); } attach() { if (this.attached) @@ -28100,8 +28100,8 @@ class P_ { this.redirectDialog.attach(), this.attached = !0; } redirectToCoinbaseWallet(e) { - const r = new URL(WY); - r.searchParams.append("redirect_url", _Y().href), e && r.searchParams.append("wl_url", e); + const r = new URL(tJ); + r.searchParams.append("redirect_url", DY().href), e && r.searchParams.append("wl_url", e); const n = document.createElement("a"); n.target = "cbw-opener", n.href = r.href, n.rel = "noreferrer noopener", n.click(); } @@ -28122,9 +28122,9 @@ class P_ { }; } } -class _o { +class Ao { constructor(e) { - this.chainCallbackParams = { chainId: "", jsonRpcUrl: "" }, this.isMobileWeb = EY(), this.linkedUpdated = (s) => { + this.chainCallbackParams = { chainId: "", jsonRpcUrl: "" }, this.isMobileWeb = OY(), this.linkedUpdated = (s) => { this.isLinked = s; const o = this.storage.getItem($1); if (s && (this._session.linked = s), this.isUnlinkedErrorState = !1, o) { @@ -28139,28 +28139,28 @@ class _o { jsonRpcUrl: o }, this.chainCallback && this.chainCallback(o, Number.parseInt(s, 10))); }, this.accountUpdated = (s) => { - this.accountsCallback && this.accountsCallback([s]), _o.accountRequestCallbackIds.size > 0 && (Array.from(_o.accountRequestCallbackIds.values()).forEach((o) => { + this.accountsCallback && this.accountsCallback([s]), Ao.accountRequestCallbackIds.size > 0 && (Array.from(Ao.accountRequestCallbackIds.values()).forEach((o) => { this.invokeCallback(o, { method: "requestEthereumAccounts", result: [s] }); - }), _o.accountRequestCallbackIds.clear()); + }), Ao.accountRequestCallbackIds.clear()); }, this.resetAndReload = this.resetAndReload.bind(this), this.linkAPIUrl = e.linkAPIUrl, this.storage = e.storage, this.metadata = e.metadata, this.accountsCallback = e.accountsCallback, this.chainCallback = e.chainCallback; const { session: r, ui: n, connection: i } = this.subscribe(); - this._session = r, this.connection = i, this.relayEventManager = new wY(), this.ui = n, this.ui.attach(); + this._session = r, this.connection = i, this.relayEventManager = new TY(), this.ui = n, this.ui.attach(); } subscribe() { - const e = pu.load(this.storage) || pu.create(this.storage), { linkAPIUrl: r } = this, n = new yY({ + const e = gu.load(this.storage) || gu.create(this.storage), { linkAPIUrl: r } = this, n = new CY({ session: e, linkAPIUrl: r, listener: this - }), i = this.isMobileWeb ? new P_() : new UY(); + }), i = this.isMobileWeb ? new I6() : new JY(); return n.connect(), { session: e, ui: i, connection: n }; } resetAndReload() { this.connection.destroy().then(() => { - const e = pu.load(this.storage); - (e == null ? void 0 : e.id) === this._session.id && Qs.clearAll(), document.location.reload(); + const e = gu.load(this.storage); + (e == null ? void 0 : e.id) === this._session.id && to.clearAll(), document.location.reload(); }).catch((e) => { }); } @@ -28170,13 +28170,13 @@ class _o { params: { fromAddress: e.fromAddress, toAddress: e.toAddress, - weiValue: ks(e.weiValue), + weiValue: $s(e.weiValue), data: Hf(e.data, !0), nonce: e.nonce, - gasPriceInWei: e.gasPriceInWei ? ks(e.gasPriceInWei) : null, - maxFeePerGas: e.gasPriceInWei ? ks(e.gasPriceInWei) : null, - maxPriorityFeePerGas: e.gasPriceInWei ? ks(e.gasPriceInWei) : null, - gasLimit: e.gasLimit ? ks(e.gasLimit) : null, + gasPriceInWei: e.gasPriceInWei ? $s(e.gasPriceInWei) : null, + maxFeePerGas: e.gasPriceInWei ? $s(e.gasPriceInWei) : null, + maxPriorityFeePerGas: e.gasPriceInWei ? $s(e.gasPriceInWei) : null, + gasLimit: e.gasLimit ? $s(e.gasLimit) : null, chainId: e.chainId, shouldSubmit: !1 } @@ -28188,13 +28188,13 @@ class _o { params: { fromAddress: e.fromAddress, toAddress: e.toAddress, - weiValue: ks(e.weiValue), + weiValue: $s(e.weiValue), data: Hf(e.data, !0), nonce: e.nonce, - gasPriceInWei: e.gasPriceInWei ? ks(e.gasPriceInWei) : null, - maxFeePerGas: e.maxFeePerGas ? ks(e.maxFeePerGas) : null, - maxPriorityFeePerGas: e.maxPriorityFeePerGas ? ks(e.maxPriorityFeePerGas) : null, - gasLimit: e.gasLimit ? ks(e.gasLimit) : null, + gasPriceInWei: e.gasPriceInWei ? $s(e.gasPriceInWei) : null, + maxFeePerGas: e.maxFeePerGas ? $s(e.maxFeePerGas) : null, + maxPriorityFeePerGas: e.maxPriorityFeePerGas ? $s(e.maxPriorityFeePerGas) : null, + gasLimit: e.gasLimit ? $s(e.gasLimit) : null, chainId: e.chainId, shouldSubmit: !0 } @@ -28214,7 +28214,7 @@ class _o { } sendRequest(e) { let r = null; - const n = Za(8), i = (s) => { + const n = ec(8), i = (s) => { this.publishWeb3RequestCanceledEvent(n), this.handleErrorResponse(n, e.method, s), r == null || r(); }; return new Promise((s, o) => { @@ -28224,7 +28224,7 @@ class _o { onResetConnection: this.resetAndReload // eslint-disable-line @typescript-eslint/unbound-method }), this.relayEventManager.callbacks.set(n, (a) => { - if (r == null || r(), Bn(a)) + if (r == null || r(), jn(a)) return o(new Error(a.errorMessage)); s(a); }), this.publishWeb3RequestEvent(n, e); @@ -28242,7 +28242,7 @@ class _o { } // copied from MobileRelay openCoinbaseWalletDeeplink(e) { - if (this.ui instanceof P_) + if (this.ui instanceof I6) switch (e) { case "requestEthereumAccounts": case "switchEthereumChain": @@ -28268,7 +28268,7 @@ class _o { } handleWeb3ResponseMessage(e, r) { if (r.method === "requestEthereumAccounts") { - _o.accountRequestCallbackIds.forEach((n) => this.invokeCallback(n, r)), _o.accountRequestCallbackIds.clear(); + Ao.accountRequestCallbackIds.forEach((n) => this.invokeCallback(n, r)), Ao.accountRequestCallbackIds.clear(); return; } this.invokeCallback(e, r); @@ -28292,13 +28292,13 @@ class _o { appName: e, appLogoUrl: r } - }, i = Za(8); + }, i = ec(8); return new Promise((s, o) => { this.relayEventManager.callbacks.set(i, (a) => { - if (Bn(a)) + if (jn(a)) return o(new Error(a.errorMessage)); s(a); - }), _o.accountRequestCallbackIds.add(i), this.publishWeb3RequestEvent(i, n); + }), Ao.accountRequestCallbackIds.add(i), this.publishWeb3RequestEvent(i, n); }); } watchAsset(e, r, n, i, s, o) { @@ -28316,19 +28316,19 @@ class _o { } }; let u = null; - const l = Za(8), d = (g) => { - this.publishWeb3RequestCanceledEvent(l), this.handleErrorResponse(l, a.method, g), u == null || u(); + const l = ec(8), d = (p) => { + this.publishWeb3RequestCanceledEvent(l), this.handleErrorResponse(l, a.method, p), u == null || u(); }; return u = this.ui.showConnecting({ isUnlinkedErrorState: this.isUnlinkedErrorState, onCancel: d, onResetConnection: this.resetAndReload // eslint-disable-line @typescript-eslint/unbound-method - }), new Promise((g, w) => { + }), new Promise((p, w) => { this.relayEventManager.callbacks.set(l, (A) => { - if (u == null || u(), Bn(A)) + if (u == null || u(), jn(A)) return w(new Error(A.errorMessage)); - g(A); + p(A); }), this.publishWeb3RequestEvent(l, a); }); } @@ -28345,19 +28345,19 @@ class _o { } }; let u = null; - const l = Za(8), d = (g) => { - this.publishWeb3RequestCanceledEvent(l), this.handleErrorResponse(l, a.method, g), u == null || u(); + const l = ec(8), d = (p) => { + this.publishWeb3RequestCanceledEvent(l), this.handleErrorResponse(l, a.method, p), u == null || u(); }; return u = this.ui.showConnecting({ isUnlinkedErrorState: this.isUnlinkedErrorState, onCancel: d, onResetConnection: this.resetAndReload // eslint-disable-line @typescript-eslint/unbound-method - }), new Promise((g, w) => { + }), new Promise((p, w) => { this.relayEventManager.callbacks.set(l, (A) => { - if (u == null || u(), Bn(A)) + if (u == null || u(), jn(A)) return w(new Error(A.errorMessage)); - g(A); + p(A); }), this.publishWeb3RequestEvent(l, a); }); } @@ -28367,7 +28367,7 @@ class _o { params: Object.assign({ chainId: e }, { address: r }) }; let i = null; - const s = Za(8), o = (a) => { + const s = ec(8), o = (a) => { this.publishWeb3RequestCanceledEvent(s), this.handleErrorResponse(s, n.method, a), i == null || i(); }; return i = this.ui.showConnecting({ @@ -28377,27 +28377,27 @@ class _o { // eslint-disable-line @typescript-eslint/unbound-method }), new Promise((a, u) => { this.relayEventManager.callbacks.set(s, (l) => { - if (i == null || i(), Bn(l) && l.errorCode) + if (i == null || i(), jn(l) && l.errorCode) return u(Sr.provider.custom({ code: l.errorCode, message: "Unrecognized chain ID. Try adding the chain using addEthereumChain first." })); - if (Bn(l)) + if (jn(l)) return u(new Error(l.errorMessage)); a(l); }), this.publishWeb3RequestEvent(s, n); }); } } -_o.accountRequestCallbackIds = /* @__PURE__ */ new Set(); -const M_ = "DefaultChainId", I_ = "DefaultJsonRpcUrl"; -class lS { +Ao.accountRequestCallbackIds = /* @__PURE__ */ new Set(); +const C6 = "DefaultChainId", T6 = "DefaultJsonRpcUrl"; +class dS { constructor(e) { - this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new Qs("walletlink", A_), this.callback = e.callback || null; + this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new to("walletlink", M6), this.callback = e.callback || null; const r = this._storage.getItem($1); if (r) { const n = r.split(" "); - n[0] !== "" && (this._addresses = n.map((i) => ta(i))); + n[0] !== "" && (this._addresses = n.map((i) => ia(i))); } this.initializeRelay(); } @@ -28413,16 +28413,16 @@ class lS { } get jsonRpcUrl() { var e; - return (e = this._storage.getItem(I_)) !== null && e !== void 0 ? e : void 0; + return (e = this._storage.getItem(T6)) !== null && e !== void 0 ? e : void 0; } set jsonRpcUrl(e) { - this._storage.setItem(I_, e); + this._storage.setItem(T6, e); } updateProviderInfo(e, r) { var n; this.jsonRpcUrl = e; const i = this.getChainId(); - this._storage.setItem(M_, r.toString(10)), Wf(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", da(r))); + this._storage.setItem(C6, r.toString(10)), Kf(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", ma(r))); } async watchAsset(e) { const r = Array.isArray(e) ? e[0] : e; @@ -28435,7 +28435,7 @@ class lS { if (!(r != null && r.options.address)) throw Sr.rpc.invalidParams("Address is required"); const n = this.getChainId(), { address: i, symbol: s, image: o, decimals: a } = r.options, l = await this.initializeRelay().watchAsset(r.type, i, s, a, o, n == null ? void 0 : n.toString()); - return Bn(l) ? !1 : !!l.result; + return jn(l) ? !1 : !!l.result; } async addEthereumChain(e) { var r, n; @@ -28449,8 +28449,8 @@ class lS { const s = Number.parseInt(i.chainId, 16); if (s === this.getChainId()) return !1; - const o = this.initializeRelay(), { rpcUrls: a = [], blockExplorerUrls: u = [], chainName: l, iconUrls: d = [], nativeCurrency: g } = i, w = await o.addEthereumChain(s.toString(), a, d, u, l, g); - if (Bn(w)) + const o = this.initializeRelay(), { rpcUrls: a = [], blockExplorerUrls: u = [], chainName: l, iconUrls: d = [], nativeCurrency: p } = i, w = await o.addEthereumChain(s.toString(), a, d, u, l, p); + if (jn(w)) return !1; if (((n = w.result) === null || n === void 0 ? void 0 : n.isApproved) === !0) return this.updateProviderInfo(a[0], s), null; @@ -28458,7 +28458,7 @@ class lS { } async switchEthereumChain(e) { const r = e[0], n = Number.parseInt(r.chainId, 16), s = await this.initializeRelay().switchEthereumChain(n.toString(10), this.selectedAddress || void 0); - if (Bn(s)) + if (jn(s)) throw s; const o = s.result; return o.isApproved && o.rpcUrl.length > 0 && this.updateProviderInfo(o.rpcUrl, n), null; @@ -28470,7 +28470,7 @@ class lS { var n; if (!Array.isArray(e)) throw new Error("addresses is not an array"); - const i = e.map((s) => ta(s)); + const i = e.map((s) => ia(s)); JSON.stringify(i) !== JSON.stringify(this._addresses) && (this._addresses = i, (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", i), this._storage.setItem($1, i.join(" "))); } async request(e) { @@ -28483,7 +28483,7 @@ class lS { case "net_version": return this.getChainId().toString(10); case "eth_chainId": - return da(this.getChainId()); + return ma(this.getChainId()); case "eth_requestAccounts": return this._eth_requestAccounts(); case "eth_ecRecover": @@ -28511,20 +28511,20 @@ class lS { default: if (!this.jsonRpcUrl) throw Sr.rpc.internal("No RPC URL set for chain"); - return FE(e, this.jsonRpcUrl); + return jE(e, this.jsonRpcUrl); } } _ensureKnownAddress(e) { - const r = ta(e); - if (!this._addresses.map((i) => ta(i)).includes(r)) + const r = ia(e); + if (!this._addresses.map((i) => ia(i)).includes(r)) throw new Error("Unknown Ethereum address"); } _prepareTransactionParams(e) { - const r = e.from ? ta(e.from) : this.selectedAddress; + const r = e.from ? ia(e.from) : this.selectedAddress; if (!r) throw new Error("Ethereum address is unavailable"); this._ensureKnownAddress(r); - const n = e.to ? ta(e.to) : null, i = e.value != null ? Tf(e.value) : BigInt(0), s = e.data ? k1(e.data) : Buffer.alloc(0), o = e.nonce != null ? Wf(e.nonce) : null, a = e.gasPrice != null ? Tf(e.gasPrice) : null, u = e.maxFeePerGas != null ? Tf(e.maxFeePerGas) : null, l = e.maxPriorityFeePerGas != null ? Tf(e.maxPriorityFeePerGas) : null, d = e.gas != null ? Tf(e.gas) : null, g = e.chainId ? Wf(e.chainId) : this.getChainId(); + const n = e.to ? ia(e.to) : null, i = e.value != null ? Rf(e.value) : BigInt(0), s = e.data ? k1(e.data) : Buffer.alloc(0), o = e.nonce != null ? Kf(e.nonce) : null, a = e.gasPrice != null ? Rf(e.gasPrice) : null, u = e.maxFeePerGas != null ? Rf(e.maxFeePerGas) : null, l = e.maxPriorityFeePerGas != null ? Rf(e.maxPriorityFeePerGas) : null, d = e.gas != null ? Rf(e.gas) : null, p = e.chainId ? Kf(e.chainId) : this.getChainId(); return { fromAddress: r, toAddress: n, @@ -28535,7 +28535,7 @@ class lS { maxFeePerGas: u, maxPriorityFeePerGas: l, gasLimit: d, - chainId: g + chainId: p }; } async ecRecover(e) { @@ -28550,24 +28550,24 @@ class lS { addPrefix: r === "personal_ecRecover" } }); - if (Bn(s)) + if (jn(s)) throw s; return s.result; } getChainId() { var e; - return Number.parseInt((e = this._storage.getItem(M_)) !== null && e !== void 0 ? e : "1", 10); + return Number.parseInt((e = this._storage.getItem(C6)) !== null && e !== void 0 ? e : "1", 10); } async _eth_requestAccounts() { var e, r; if (this._addresses.length > 0) - return (e = this.callback) === null || e === void 0 || e.call(this, "connect", { chainId: da(this.getChainId()) }), this._addresses; + return (e = this.callback) === null || e === void 0 || e.call(this, "connect", { chainId: ma(this.getChainId()) }), this._addresses; const i = await this.initializeRelay().requestEthereumAccounts(); - if (Bn(i)) + if (jn(i)) throw i; if (!i.result) throw new Error("accounts received is empty"); - return this._setAddresses(i.result), (r = this.callback) === null || r === void 0 || r.call(this, "connect", { chainId: da(this.getChainId()) }), this._addresses; + return this._setAddresses(i.result), (r = this.callback) === null || r === void 0 || r.call(this, "connect", { chainId: ma(this.getChainId()) }), this._addresses; } async personalSign({ params: e }) { if (!Array.isArray(e)) @@ -28577,31 +28577,31 @@ class lS { const s = await this.initializeRelay().sendRequest({ method: "signEthereumMessage", params: { - address: ta(r), + address: ia(r), message: _m(n), addPrefix: !0, typedDataJson: null } }); - if (Bn(s)) + if (jn(s)) throw s; return s.result; } async _eth_signTransaction(e) { const r = this._prepareTransactionParams(e[0] || {}), i = await this.initializeRelay().signEthereumTransaction(r); - if (Bn(i)) + if (jn(i)) throw i; return i.result; } async _eth_sendRawTransaction(e) { const r = k1(e[0]), i = await this.initializeRelay().submitEthereumTransaction(r, this.getChainId()); - if (Bn(i)) + if (jn(i)) throw i; return i.result; } async _eth_sendTransaction(e) { const r = this._prepareTransactionParams(e[0] || {}), i = await this.initializeRelay().signAndSubmitEthereumTransaction(r); - if (Bn(i)) + if (jn(i)) throw i; return i.result; } @@ -28611,32 +28611,32 @@ class lS { throw Sr.rpc.invalidParams(); const i = (l) => { const d = { - eth_signTypedData_v1: hd.hashForSignTypedDataLegacy, - eth_signTypedData_v3: hd.hashForSignTypedData_v3, - eth_signTypedData_v4: hd.hashForSignTypedData_v4, - eth_signTypedData: hd.hashForSignTypedData_v4 + eth_signTypedData_v1: dd.hashForSignTypedDataLegacy, + eth_signTypedData_v3: dd.hashForSignTypedData_v3, + eth_signTypedData_v4: dd.hashForSignTypedData_v4, + eth_signTypedData: dd.hashForSignTypedData_v4 }; return Hf(d[r]({ - data: FG(l) + data: GG(l) }), !0); }, s = n[r === "eth_signTypedData_v1" ? 1 : 0], o = n[r === "eth_signTypedData_v1" ? 0 : 1]; this._ensureKnownAddress(s); const u = await this.initializeRelay().sendRequest({ method: "signEthereumMessage", params: { - address: ta(s), + address: ia(s), message: i(o), typedDataJson: JSON.stringify(o, null, 2), addPrefix: !1 } }); - if (Bn(u)) + if (jn(u)) throw u; return u.result; } initializeRelay() { - return this._relay || (this._relay = new _o({ - linkAPIUrl: A_, + return this._relay || (this._relay = new Ao({ + linkAPIUrl: M6, storage: this._storage, metadata: this.metadata, accountsCallback: this._setAddresses.bind(this), @@ -28644,16 +28644,16 @@ class lS { })), this._relay; } } -const hS = "SignerType", dS = new Qs("CBWSDK", "SignerConfigurator"); -function KY() { - return dS.getItem(hS); +const pS = "SignerType", gS = new to("CBWSDK", "SignerConfigurator"); +function rJ() { + return gS.getItem(pS); } -function VY(t) { - dS.setItem(hS, t); +function nJ(t) { + gS.setItem(pS, t); } -async function GY(t) { +async function iJ(t) { const { communicator: e, metadata: r, handshakeRequest: n, callback: i } = t; - JY(e, r, i).catch(() => { + oJ(e, r, i).catch(() => { }); const s = { id: crypto.randomUUID(), @@ -28662,25 +28662,25 @@ async function GY(t) { }, { data: o } = await e.postRequestAndWaitForResponse(s); return o; } -function YY(t) { +function sJ(t) { const { signerType: e, metadata: r, communicator: n, callback: i } = t; switch (e) { case "scw": - return new XG({ + return new aY({ metadata: r, callback: i, communicator: n }); case "walletlink": - return new lS({ + return new dS({ metadata: r, callback: i }); } } -async function JY(t, e, r) { +async function oJ(t, e, r) { await t.onMessage(({ event: i }) => i === "WalletLinkSessionRequest"); - const n = new lS({ + const n = new dS({ metadata: e, callback: r }); @@ -28692,9 +28692,9 @@ async function JY(t, e, r) { data: { connected: !0 } }); } -const XY = `Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. +const aJ = `Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. -Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`, ZY = () => { +Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`, cJ = () => { let t; return { getCrossOriginOpenerPolicy: () => t === void 0 ? "undefined" : t, @@ -28710,36 +28710,36 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene if (!r.ok) throw new Error(`HTTP error! status: ${r.status}`); const n = r.headers.get("Cross-Origin-Opener-Policy"); - t = n ?? "null", t === "same-origin" && console.error(XY); + t = n ?? "null", t === "same-origin" && console.error(aJ); } catch (e) { console.error("Error checking Cross-Origin-Opener-Policy:", e.message), t = "error"; } } }; -}, { checkCrossOriginOpenerPolicy: QY, getCrossOriginOpenerPolicy: eJ } = ZY(), C_ = 420, T_ = 540; -function tJ(t) { - const e = (window.innerWidth - C_) / 2 + window.screenX, r = (window.innerHeight - T_) / 2 + window.screenY; - nJ(t); - const n = window.open(t, "Smart Wallet", `width=${C_}, height=${T_}, left=${e}, top=${r}`); +}, { checkCrossOriginOpenerPolicy: uJ, getCrossOriginOpenerPolicy: fJ } = cJ(), R6 = 420, D6 = 540; +function lJ(t) { + const e = (window.innerWidth - R6) / 2 + window.screenX, r = (window.innerHeight - D6) / 2 + window.screenY; + dJ(t); + const n = window.open(t, "Smart Wallet", `width=${R6}, height=${D6}, left=${e}, top=${r}`); if (n == null || n.focus(), !n) throw Sr.rpc.internal("Pop up window failed to open"); return n; } -function rJ(t) { +function hJ(t) { t && !t.closed && t.close(); } -function nJ(t) { +function dJ(t) { const e = { - sdkName: $E, - sdkVersion: rh, + sdkName: FE, + sdkVersion: nh, origin: window.location.origin, - coop: eJ() + coop: fJ() }; for (const [r, n] of Object.entries(e)) t.searchParams.append(r, n.toString()); } -class iJ { - constructor({ url: e = HY, metadata: r, preference: n }) { +class pJ { + constructor({ url: e = eJ, metadata: r, preference: n }) { this.popup = null, this.listeners = /* @__PURE__ */ new Map(), this.postMessage = async (i) => { (await this.waitForPopupLoaded()).postMessage(i, this.url.origin); }, this.postRequestAndWaitForResponse = async (i) => { @@ -28754,15 +28754,15 @@ class iJ { }; window.addEventListener("message", a), this.listeners.set(a, { reject: o }); }), this.disconnect = () => { - rJ(this.popup), this.popup = null, this.listeners.forEach(({ reject: i }, s) => { + hJ(this.popup), this.popup = null, this.listeners.forEach(({ reject: i }, s) => { i(Sr.provider.userRejectedRequest("Request rejected")), window.removeEventListener("message", s); }), this.listeners.clear(); - }, this.waitForPopupLoaded = async () => this.popup && !this.popup.closed ? (this.popup.focus(), this.popup) : (this.popup = tJ(this.url), this.onMessage(({ event: i }) => i === "PopupUnload").then(this.disconnect).catch(() => { + }, this.waitForPopupLoaded = async () => this.popup && !this.popup.closed ? (this.popup.focus(), this.popup) : (this.popup = lJ(this.url), this.onMessage(({ event: i }) => i === "PopupUnload").then(this.disconnect).catch(() => { }), this.onMessage(({ event: i }) => i === "PopupLoaded").then((i) => { this.postMessage({ requestId: i.id, data: { - version: rh, + version: nh, metadata: this.metadata, preference: this.preference, location: window.location.toString() @@ -28775,20 +28775,20 @@ class iJ { })), this.url = new URL(e), this.metadata = r, this.preference = n; } } -function sJ(t) { - const e = OG(oJ(t), { +function gJ(t) { + const e = zG(mJ(t), { shouldIncludeStack: !0 }), r = new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors"); - return r.searchParams.set("version", rh), r.searchParams.set("code", e.code.toString()), r.searchParams.set("message", e.message), Object.assign(Object.assign({}, e), { docUrl: r.href }); + return r.searchParams.set("version", nh), r.searchParams.set("code", e.code.toString()), r.searchParams.set("message", e.message), Object.assign(Object.assign({}, e), { docUrl: r.href }); } -function oJ(t) { +function mJ(t) { var e; if (typeof t == "string") return { message: t, code: fn.rpc.internal }; - if (Bn(t)) { + if (jn(t)) { const r = t.errorMessage, n = (e = t.errorCode) !== null && e !== void 0 ? e : r.match(/(denied|rejected)/i) ? fn.provider.userRejectedRequest : void 0; return Object.assign(Object.assign({}, t), { message: r, @@ -28798,7 +28798,7 @@ function oJ(t) { } return t; } -var pS = { exports: {} }; +var mS = { exports: {} }; (function(t) { var e = Object.prototype.hasOwnProperty, r = "~"; function n() { @@ -28807,11 +28807,11 @@ var pS = { exports: {} }; function i(u, l, d) { this.fn = u, this.context = l, this.once = d || !1; } - function s(u, l, d, g, w) { + function s(u, l, d, p, w) { if (typeof d != "function") throw new TypeError("The listener must be a function"); - var A = new i(d, g || u, w), M = r ? r + l : l; - return u._events[M] ? u._events[M].fn ? u._events[M] = [u._events[M], A] : u._events[M].push(A) : (u._events[M] = A, u._eventsCount++), u; + var A = new i(d, p || u, w), P = r ? r + l : l; + return u._events[P] ? u._events[P].fn ? u._events[P] = [u._events[P], A] : u._events[P].push(A) : (u._events[P] = A, u._eventsCount++), u; } function o(u, l) { --u._eventsCount === 0 ? u._events = new n() : delete u._events[l]; @@ -28820,25 +28820,25 @@ var pS = { exports: {} }; this._events = new n(), this._eventsCount = 0; } a.prototype.eventNames = function() { - var l = [], d, g; + var l = [], d, p; if (this._eventsCount === 0) return l; - for (g in d = this._events) - e.call(d, g) && l.push(r ? g.slice(1) : g); + for (p in d = this._events) + e.call(d, p) && l.push(r ? p.slice(1) : p); return Object.getOwnPropertySymbols ? l.concat(Object.getOwnPropertySymbols(d)) : l; }, a.prototype.listeners = function(l) { - var d = r ? r + l : l, g = this._events[d]; - if (!g) return []; - if (g.fn) return [g.fn]; - for (var w = 0, A = g.length, M = new Array(A); w < A; w++) - M[w] = g[w].fn; - return M; + var d = r ? r + l : l, p = this._events[d]; + if (!p) return []; + if (p.fn) return [p.fn]; + for (var w = 0, A = p.length, P = new Array(A); w < A; w++) + P[w] = p[w].fn; + return P; }, a.prototype.listenerCount = function(l) { - var d = r ? r + l : l, g = this._events[d]; - return g ? g.fn ? 1 : g.length : 0; - }, a.prototype.emit = function(l, d, g, w, A, M) { + var d = r ? r + l : l, p = this._events[d]; + return p ? p.fn ? 1 : p.length : 0; + }, a.prototype.emit = function(l, d, p, w, A, P) { var N = r ? r + l : l; if (!this._events[N]) return !1; - var L = this._events[N], $ = arguments.length, F, K; + var L = this._events[N], $ = arguments.length, B, H; if (L.fn) { switch (L.once && this.removeListener(l, L.fn, void 0, !0), $) { case 1: @@ -28846,55 +28846,55 @@ var pS = { exports: {} }; case 2: return L.fn.call(L.context, d), !0; case 3: - return L.fn.call(L.context, d, g), !0; + return L.fn.call(L.context, d, p), !0; case 4: - return L.fn.call(L.context, d, g, w), !0; + return L.fn.call(L.context, d, p, w), !0; case 5: - return L.fn.call(L.context, d, g, w, A), !0; + return L.fn.call(L.context, d, p, w, A), !0; case 6: - return L.fn.call(L.context, d, g, w, A, M), !0; + return L.fn.call(L.context, d, p, w, A, P), !0; } - for (K = 1, F = new Array($ - 1); K < $; K++) - F[K - 1] = arguments[K]; - L.fn.apply(L.context, F); + for (H = 1, B = new Array($ - 1); H < $; H++) + B[H - 1] = arguments[H]; + L.fn.apply(L.context, B); } else { - var H = L.length, V; - for (K = 0; K < H; K++) - switch (L[K].once && this.removeListener(l, L[K].fn, void 0, !0), $) { + var W = L.length, V; + for (H = 0; H < W; H++) + switch (L[H].once && this.removeListener(l, L[H].fn, void 0, !0), $) { case 1: - L[K].fn.call(L[K].context); + L[H].fn.call(L[H].context); break; case 2: - L[K].fn.call(L[K].context, d); + L[H].fn.call(L[H].context, d); break; case 3: - L[K].fn.call(L[K].context, d, g); + L[H].fn.call(L[H].context, d, p); break; case 4: - L[K].fn.call(L[K].context, d, g, w); + L[H].fn.call(L[H].context, d, p, w); break; default: - if (!F) for (V = 1, F = new Array($ - 1); V < $; V++) - F[V - 1] = arguments[V]; - L[K].fn.apply(L[K].context, F); + if (!B) for (V = 1, B = new Array($ - 1); V < $; V++) + B[V - 1] = arguments[V]; + L[H].fn.apply(L[H].context, B); } } return !0; - }, a.prototype.on = function(l, d, g) { - return s(this, l, d, g, !1); - }, a.prototype.once = function(l, d, g) { - return s(this, l, d, g, !0); - }, a.prototype.removeListener = function(l, d, g, w) { + }, a.prototype.on = function(l, d, p) { + return s(this, l, d, p, !1); + }, a.prototype.once = function(l, d, p) { + return s(this, l, d, p, !0); + }, a.prototype.removeListener = function(l, d, p, w) { var A = r ? r + l : l; if (!this._events[A]) return this; if (!d) return o(this, A), this; - var M = this._events[A]; - if (M.fn) - M.fn === d && (!w || M.once) && (!g || M.context === g) && o(this, A); + var P = this._events[A]; + if (P.fn) + P.fn === d && (!w || P.once) && (!p || P.context === p) && o(this, A); else { - for (var N = 0, L = [], $ = M.length; N < $; N++) - (M[N].fn !== d || w && !M[N].once || g && M[N].context !== g) && L.push(M[N]); + for (var N = 0, L = [], $ = P.length; N < $; N++) + (P[N].fn !== d || w && !P[N].once || p && P[N].context !== p) && L.push(P[N]); L.length ? this._events[A] = L.length === 1 ? L[0] : L : o(this, A); } return this; @@ -28902,12 +28902,12 @@ var pS = { exports: {} }; var d; return l ? (d = r ? r + l : l, this._events[d] && o(this, d)) : (this._events = new n(), this._eventsCount = 0), this; }, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = r, a.EventEmitter = a, t.exports = a; -})(pS); -var aJ = pS.exports; -const cJ = /* @__PURE__ */ ts(aJ); -class uJ extends cJ { +})(mS); +var vJ = mS.exports; +const bJ = /* @__PURE__ */ rs(vJ); +class yJ extends bJ { } -var fJ = function(t, e) { +var wJ = function(t, e) { var r = {}; for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); if (t != null && typeof Object.getOwnPropertySymbols == "function") @@ -28915,37 +28915,37 @@ var fJ = function(t, e) { e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]); return r; }; -class lJ extends uJ { +class xJ extends yJ { constructor(e) { - var { metadata: r } = e, n = e.preference, { keysUrl: i } = n, s = fJ(n, ["keysUrl"]); - super(), this.signer = null, this.isCoinbaseWallet = !0, this.metadata = r, this.preference = s, this.communicator = new iJ({ + var { metadata: r } = e, n = e.preference, { keysUrl: i } = n, s = wJ(n, ["keysUrl"]); + super(), this.signer = null, this.isCoinbaseWallet = !0, this.metadata = r, this.preference = s, this.communicator = new pJ({ url: i, metadata: r, preference: s }); - const o = KY(); + const o = rJ(); o && (this.signer = this.initSigner(o)); } async request(e) { try { - if (JG(e), !this.signer) + if (oY(e), !this.signer) switch (e.method) { case "eth_requestAccounts": { const r = await this.requestSignerSelection(e), n = this.initSigner(r); - await n.handshake(e), this.signer = n, VY(r); + await n.handshake(e), this.signer = n, nJ(r); break; } case "net_version": return 1; case "eth_chainId": - return da(1); + return ma(1); default: throw Sr.provider.unauthorized("Must call 'eth_requestAccounts' before other methods"); } return this.signer.request(e); } catch (r) { const { code: n } = r; - return n === fn.provider.unauthorized && this.disconnect(), Promise.reject(sJ(r)); + return n === fn.provider.unauthorized && this.disconnect(), Promise.reject(gJ(r)); } } /** @deprecated Use `.request({ method: 'eth_requestAccounts' })` instead. */ @@ -28956,10 +28956,10 @@ class lJ extends uJ { } async disconnect() { var e; - await ((e = this.signer) === null || e === void 0 ? void 0 : e.cleanup()), this.signer = null, Qs.clearAll(), this.emit("disconnect", Sr.provider.disconnected("User initiated disconnection")); + await ((e = this.signer) === null || e === void 0 ? void 0 : e.cleanup()), this.signer = null, to.clearAll(), this.emit("disconnect", Sr.provider.disconnected("User initiated disconnection")); } requestSignerSelection(e) { - return GY({ + return iJ({ communicator: this.communicator, preference: this.preference, metadata: this.metadata, @@ -28968,7 +28968,7 @@ class lJ extends uJ { }); } initSigner(e) { - return YY({ + return sJ({ signerType: e, metadata: this.metadata, communicator: this.communicator, @@ -28976,7 +28976,7 @@ class lJ extends uJ { }); } } -function hJ(t) { +function _J(t) { if (t) { if (!["all", "smartWalletOnly", "eoaOnly"].includes(t.options)) throw new Error(`Invalid options: ${t.options}`); @@ -28984,66 +28984,66 @@ function hJ(t) { throw new Error("Attribution cannot contain both auto and dataSuffix properties"); } } -function dJ(t) { +function EJ(t) { var e; const r = { metadata: t.metadata, preference: t.preference }; - return (e = YG(r)) !== null && e !== void 0 ? e : new lJ(r); + return (e = sY(r)) !== null && e !== void 0 ? e : new xJ(r); } -const pJ = { +const SJ = { options: "all" }; -function gJ(t) { +function AJ(t) { var e; - new Qs("CBWSDK").setItem("VERSION", rh), QY(); + new to("CBWSDK").setItem("VERSION", nh), uJ(); const n = { metadata: { appName: t.appName || "Dapp", appLogoUrl: t.appLogoUrl || "", appChainIds: t.appChainIds || [] }, - preference: Object.assign(pJ, (e = t.preference) !== null && e !== void 0 ? e : {}) + preference: Object.assign(SJ, (e = t.preference) !== null && e !== void 0 ? e : {}) }; - hJ(n.preference); + _J(n.preference); let i = null; return { - getProvider: () => (i || (i = dJ(n)), i) + getProvider: () => (i || (i = EJ(n)), i) }; } -function gS(t, e) { +function vS(t, e) { return function() { return t.apply(e, arguments); }; } -const { toString: mJ } = Object.prototype, { getPrototypeOf: Sb } = Object, up = /* @__PURE__ */ ((t) => (e) => { - const r = mJ.call(e); +const { toString: PJ } = Object.prototype, { getPrototypeOf: Sb } = Object, fp = /* @__PURE__ */ ((t) => (e) => { + const r = PJ.call(e); return t[r] || (t[r] = r.slice(8, -1).toLowerCase()); -})(/* @__PURE__ */ Object.create(null)), As = (t) => (t = t.toLowerCase(), (e) => up(e) === t), fp = (t) => (e) => typeof e === t, { isArray: zu } = Array, Pl = fp("undefined"); -function vJ(t) { - return t !== null && !Pl(t) && t.constructor !== null && !Pl(t.constructor) && Di(t.constructor.isBuffer) && t.constructor.isBuffer(t); +})(/* @__PURE__ */ Object.create(null)), Ps = (t) => (t = t.toLowerCase(), (e) => fp(e) === t), lp = (t) => (e) => typeof e === t, { isArray: Wu } = Array, Ml = lp("undefined"); +function MJ(t) { + return t !== null && !Ml(t) && t.constructor !== null && !Ml(t.constructor) && Oi(t.constructor.isBuffer) && t.constructor.isBuffer(t); } -const mS = As("ArrayBuffer"); -function bJ(t) { +const bS = Ps("ArrayBuffer"); +function IJ(t) { let e; - return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && mS(t.buffer), e; + return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && bS(t.buffer), e; } -const yJ = fp("string"), Di = fp("function"), vS = fp("number"), lp = (t) => t !== null && typeof t == "object", wJ = (t) => t === !0 || t === !1, Ld = (t) => { - if (up(t) !== "object") +const CJ = lp("string"), Oi = lp("function"), yS = lp("number"), hp = (t) => t !== null && typeof t == "object", TJ = (t) => t === !0 || t === !1, kd = (t) => { + if (fp(t) !== "object") return !1; const e = Sb(t); return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in t) && !(Symbol.iterator in t); -}, xJ = As("Date"), _J = As("File"), EJ = As("Blob"), SJ = As("FileList"), AJ = (t) => lp(t) && Di(t.pipe), PJ = (t) => { +}, RJ = Ps("Date"), DJ = Ps("File"), OJ = Ps("Blob"), NJ = Ps("FileList"), LJ = (t) => hp(t) && Oi(t.pipe), kJ = (t) => { let e; - return t && (typeof FormData == "function" && t instanceof FormData || Di(t.append) && ((e = up(t)) === "formdata" || // detect form-data instance - e === "object" && Di(t.toString) && t.toString() === "[object FormData]")); -}, MJ = As("URLSearchParams"), [IJ, CJ, TJ, RJ] = ["ReadableStream", "Request", "Response", "Headers"].map(As), DJ = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); -function ih(t, e, { allOwnKeys: r = !1 } = {}) { + return t && (typeof FormData == "function" && t instanceof FormData || Oi(t.append) && ((e = fp(t)) === "formdata" || // detect form-data instance + e === "object" && Oi(t.toString) && t.toString() === "[object FormData]")); +}, $J = Ps("URLSearchParams"), [BJ, FJ, jJ, UJ] = ["ReadableStream", "Request", "Response", "Headers"].map(Ps), qJ = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); +function sh(t, e, { allOwnKeys: r = !1 } = {}) { if (t === null || typeof t > "u") return; let n, i; - if (typeof t != "object" && (t = [t]), zu(t)) + if (typeof t != "object" && (t = [t]), Wu(t)) for (n = 0, i = t.length; n < i; n++) e.call(null, t[n], n, t); else { @@ -29053,7 +29053,7 @@ function ih(t, e, { allOwnKeys: r = !1 } = {}) { a = s[n], e.call(null, t[a], a, t); } } -function bS(t, e) { +function wS(t, e) { e = e.toLowerCase(); const r = Object.keys(t); let n = r.length, i; @@ -29062,23 +29062,23 @@ function bS(t, e) { return i; return null; } -const nc = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, yS = (t) => !Pl(t) && t !== nc; -function H1() { - const { caseless: t } = yS(this) && this || {}, e = {}, r = (n, i) => { - const s = t && bS(e, i) || i; - Ld(e[s]) && Ld(n) ? e[s] = H1(e[s], n) : Ld(n) ? e[s] = H1({}, n) : zu(n) ? e[s] = n.slice() : e[s] = n; +const sc = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, xS = (t) => !Ml(t) && t !== sc; +function W1() { + const { caseless: t } = xS(this) && this || {}, e = {}, r = (n, i) => { + const s = t && wS(e, i) || i; + kd(e[s]) && kd(n) ? e[s] = W1(e[s], n) : kd(n) ? e[s] = W1({}, n) : Wu(n) ? e[s] = n.slice() : e[s] = n; }; for (let n = 0, i = arguments.length; n < i; n++) - arguments[n] && ih(arguments[n], r); + arguments[n] && sh(arguments[n], r); return e; } -const OJ = (t, e, r, { allOwnKeys: n } = {}) => (ih(e, (i, s) => { - r && Di(i) ? t[s] = gS(i, r) : t[s] = i; -}, { allOwnKeys: n }), t), NJ = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), LJ = (t, e, r, n) => { +const zJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { + r && Oi(i) ? t[s] = vS(i, r) : t[s] = i; +}, { allOwnKeys: n }), t), WJ = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), HJ = (t, e, r, n) => { t.prototype = Object.create(e.prototype, n), t.prototype.constructor = t, Object.defineProperty(t, "super", { value: e.prototype }), r && Object.assign(t.prototype, r); -}, kJ = (t, e, r, n) => { +}, KJ = (t, e, r, n) => { let i, s, o; const a = {}; if (e = e || {}, t == null) return e; @@ -29088,49 +29088,49 @@ const OJ = (t, e, r, { allOwnKeys: n } = {}) => (ih(e, (i, s) => { t = r !== !1 && Sb(t); } while (t && (!r || r(t, e)) && t !== Object.prototype); return e; -}, $J = (t, e, r) => { +}, VJ = (t, e, r) => { t = String(t), (r === void 0 || r > t.length) && (r = t.length), r -= e.length; const n = t.indexOf(e, r); return n !== -1 && n === r; -}, FJ = (t) => { +}, GJ = (t) => { if (!t) return null; - if (zu(t)) return t; + if (Wu(t)) return t; let e = t.length; - if (!vS(e)) return null; + if (!yS(e)) return null; const r = new Array(e); for (; e-- > 0; ) r[e] = t[e]; return r; -}, BJ = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Sb(Uint8Array)), UJ = (t, e) => { +}, YJ = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Sb(Uint8Array)), JJ = (t, e) => { const n = (t && t[Symbol.iterator]).call(t); let i; for (; (i = n.next()) && !i.done; ) { const s = i.value; e.call(t, s[0], s[1]); } -}, jJ = (t, e) => { +}, XJ = (t, e) => { let r; const n = []; for (; (r = t.exec(e)) !== null; ) n.push(r); return n; -}, qJ = As("HTMLFormElement"), zJ = (t) => t.toLowerCase().replace( +}, ZJ = Ps("HTMLFormElement"), QJ = (t) => t.toLowerCase().replace( /[-_\s]([a-z\d])(\w*)/g, function(r, n, i) { return n.toUpperCase() + i; } -), R_ = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), HJ = As("RegExp"), wS = (t, e) => { +), O6 = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), eX = Ps("RegExp"), _S = (t, e) => { const r = Object.getOwnPropertyDescriptors(t), n = {}; - ih(r, (i, s) => { + sh(r, (i, s) => { let o; (o = e(i, s, t)) !== !1 && (n[s] = o || i); }), Object.defineProperties(t, n); -}, WJ = (t) => { - wS(t, (e, r) => { - if (Di(t) && ["arguments", "caller", "callee"].indexOf(r) !== -1) +}, tX = (t) => { + _S(t, (e, r) => { + if (Oi(t) && ["arguments", "caller", "callee"].indexOf(r) !== -1) return !1; const n = t[r]; - if (Di(n)) { + if (Oi(n)) { if (e.enumerable = !1, "writable" in e) { e.writable = !1; return; @@ -29140,116 +29140,116 @@ const OJ = (t, e, r, { allOwnKeys: n } = {}) => (ih(e, (i, s) => { }); } }); -}, KJ = (t, e) => { +}, rX = (t, e) => { const r = {}, n = (i) => { i.forEach((s) => { r[s] = !0; }); }; - return zu(t) ? n(t) : n(String(t).split(e)), r; -}, VJ = () => { -}, GJ = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, Im = "abcdefghijklmnopqrstuvwxyz", D_ = "0123456789", xS = { - DIGIT: D_, + return Wu(t) ? n(t) : n(String(t).split(e)), r; +}, nX = () => { +}, iX = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, Im = "abcdefghijklmnopqrstuvwxyz", N6 = "0123456789", ES = { + DIGIT: N6, ALPHA: Im, - ALPHA_DIGIT: Im + Im.toUpperCase() + D_ -}, YJ = (t = 16, e = xS.ALPHA_DIGIT) => { + ALPHA_DIGIT: Im + Im.toUpperCase() + N6 +}, sX = (t = 16, e = ES.ALPHA_DIGIT) => { let r = ""; const { length: n } = e; for (; t--; ) r += e[Math.random() * n | 0]; return r; }; -function JJ(t) { - return !!(t && Di(t.append) && t[Symbol.toStringTag] === "FormData" && t[Symbol.iterator]); +function oX(t) { + return !!(t && Oi(t.append) && t[Symbol.toStringTag] === "FormData" && t[Symbol.iterator]); } -const XJ = (t) => { +const aX = (t) => { const e = new Array(10), r = (n, i) => { - if (lp(n)) { + if (hp(n)) { if (e.indexOf(n) >= 0) return; if (!("toJSON" in n)) { e[i] = n; - const s = zu(n) ? [] : {}; - return ih(n, (o, a) => { + const s = Wu(n) ? [] : {}; + return sh(n, (o, a) => { const u = r(o, i + 1); - !Pl(u) && (s[a] = u); + !Ml(u) && (s[a] = u); }), e[i] = void 0, s; } } return n; }; return r(t, 0); -}, ZJ = As("AsyncFunction"), QJ = (t) => t && (lp(t) || Di(t)) && Di(t.then) && Di(t.catch), _S = ((t, e) => t ? setImmediate : e ? ((r, n) => (nc.addEventListener("message", ({ source: i, data: s }) => { - i === nc && s === r && n.length && n.shift()(); +}, cX = Ps("AsyncFunction"), uX = (t) => t && (hp(t) || Oi(t)) && Oi(t.then) && Oi(t.catch), SS = ((t, e) => t ? setImmediate : e ? ((r, n) => (sc.addEventListener("message", ({ source: i, data: s }) => { + i === sc && s === r && n.length && n.shift()(); }, !1), (i) => { - n.push(i), nc.postMessage(r, "*"); + n.push(i), sc.postMessage(r, "*"); }))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))( typeof setImmediate == "function", - Di(nc.postMessage) -), eX = typeof queueMicrotask < "u" ? queueMicrotask.bind(nc) : typeof process < "u" && process.nextTick || _S, Oe = { - isArray: zu, - isArrayBuffer: mS, - isBuffer: vJ, - isFormData: PJ, - isArrayBufferView: bJ, - isString: yJ, - isNumber: vS, - isBoolean: wJ, - isObject: lp, - isPlainObject: Ld, - isReadableStream: IJ, - isRequest: CJ, - isResponse: TJ, - isHeaders: RJ, - isUndefined: Pl, - isDate: xJ, - isFile: _J, - isBlob: EJ, - isRegExp: HJ, - isFunction: Di, - isStream: AJ, - isURLSearchParams: MJ, - isTypedArray: BJ, - isFileList: SJ, - forEach: ih, - merge: H1, - extend: OJ, - trim: DJ, - stripBOM: NJ, - inherits: LJ, - toFlatObject: kJ, - kindOf: up, - kindOfTest: As, - endsWith: $J, - toArray: FJ, - forEachEntry: UJ, - matchAll: jJ, - isHTMLForm: qJ, - hasOwnProperty: R_, - hasOwnProp: R_, + Oi(sc.postMessage) +), fX = typeof queueMicrotask < "u" ? queueMicrotask.bind(sc) : typeof process < "u" && process.nextTick || SS, Oe = { + isArray: Wu, + isArrayBuffer: bS, + isBuffer: MJ, + isFormData: kJ, + isArrayBufferView: IJ, + isString: CJ, + isNumber: yS, + isBoolean: TJ, + isObject: hp, + isPlainObject: kd, + isReadableStream: BJ, + isRequest: FJ, + isResponse: jJ, + isHeaders: UJ, + isUndefined: Ml, + isDate: RJ, + isFile: DJ, + isBlob: OJ, + isRegExp: eX, + isFunction: Oi, + isStream: LJ, + isURLSearchParams: $J, + isTypedArray: YJ, + isFileList: NJ, + forEach: sh, + merge: W1, + extend: zJ, + trim: qJ, + stripBOM: WJ, + inherits: HJ, + toFlatObject: KJ, + kindOf: fp, + kindOfTest: Ps, + endsWith: VJ, + toArray: GJ, + forEachEntry: JJ, + matchAll: XJ, + isHTMLForm: ZJ, + hasOwnProperty: O6, + hasOwnProp: O6, // an alias to avoid ESLint no-prototype-builtins detection - reduceDescriptors: wS, - freezeMethods: WJ, - toObjectSet: KJ, - toCamelCase: zJ, - noop: VJ, - toFiniteNumber: GJ, - findKey: bS, - global: nc, - isContextDefined: yS, - ALPHABET: xS, - generateString: YJ, - isSpecCompliantForm: JJ, - toJSONObject: XJ, - isAsyncFn: ZJ, - isThenable: QJ, - setImmediate: _S, - asap: eX -}; -function sr(t, e, r, n, i) { + reduceDescriptors: _S, + freezeMethods: tX, + toObjectSet: rX, + toCamelCase: QJ, + noop: nX, + toFiniteNumber: iX, + findKey: wS, + global: sc, + isContextDefined: xS, + ALPHABET: ES, + generateString: sX, + isSpecCompliantForm: oX, + toJSONObject: aX, + isAsyncFn: cX, + isThenable: uX, + setImmediate: SS, + asap: fX +}; +function or(t, e, r, n, i) { Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = t, this.name = "AxiosError", e && (this.code = e), r && (this.config = r), n && (this.request = n), i && (this.response = i, this.status = i.status ? i.status : null); } -Oe.inherits(sr, Error, { +Oe.inherits(or, Error, { toJSON: function() { return { // Standard @@ -29270,7 +29270,7 @@ Oe.inherits(sr, Error, { }; } }); -const ES = sr.prototype, SS = {}; +const AS = or.prototype, PS = {}; [ "ERR_BAD_OPTION_VALUE", "ERR_BAD_OPTION", @@ -29286,35 +29286,35 @@ const ES = sr.prototype, SS = {}; "ERR_INVALID_URL" // eslint-disable-next-line func-names ].forEach((t) => { - SS[t] = { value: t }; + PS[t] = { value: t }; }); -Object.defineProperties(sr, SS); -Object.defineProperty(ES, "isAxiosError", { value: !0 }); -sr.from = (t, e, r, n, i, s) => { - const o = Object.create(ES); +Object.defineProperties(or, PS); +Object.defineProperty(AS, "isAxiosError", { value: !0 }); +or.from = (t, e, r, n, i, s) => { + const o = Object.create(AS); return Oe.toFlatObject(t, o, function(u) { return u !== Error.prototype; - }, (a) => a !== "isAxiosError"), sr.call(o, t.message, e, r, n, i), o.cause = t, o.name = t.name, s && Object.assign(o, s), o; + }, (a) => a !== "isAxiosError"), or.call(o, t.message, e, r, n, i), o.cause = t, o.name = t.name, s && Object.assign(o, s), o; }; -const tX = null; -function W1(t) { +const lX = null; +function H1(t) { return Oe.isPlainObject(t) || Oe.isArray(t); } -function AS(t) { +function MS(t) { return Oe.endsWith(t, "[]") ? t.slice(0, -2) : t; } -function O_(t, e, r) { +function L6(t, e, r) { return t ? t.concat(e).map(function(i, s) { - return i = AS(i), !r && s ? "[" + i + "]" : i; + return i = MS(i), !r && s ? "[" + i + "]" : i; }).join(r ? "." : "") : e; } -function rX(t) { - return Oe.isArray(t) && !t.some(W1); +function hX(t) { + return Oe.isArray(t) && !t.some(H1); } -const nX = Oe.toFlatObject(Oe, {}, null, function(e) { +const dX = Oe.toFlatObject(Oe, {}, null, function(e) { return /^is[A-Z]/.test(e); }); -function hp(t, e, r) { +function dp(t, e, r) { if (!Oe.isObject(t)) throw new TypeError("target must be an object"); e = e || new FormData(), r = Oe.toFlatObject(r, { @@ -29327,55 +29327,55 @@ function hp(t, e, r) { const n = r.metaTokens, i = r.visitor || d, s = r.dots, o = r.indexes, u = (r.Blob || typeof Blob < "u" && Blob) && Oe.isSpecCompliantForm(e); if (!Oe.isFunction(i)) throw new TypeError("visitor must be a function"); - function l(M) { - if (M === null) return ""; - if (Oe.isDate(M)) - return M.toISOString(); - if (!u && Oe.isBlob(M)) - throw new sr("Blob is not supported. Use a Buffer instead."); - return Oe.isArrayBuffer(M) || Oe.isTypedArray(M) ? u && typeof Blob == "function" ? new Blob([M]) : Buffer.from(M) : M; - } - function d(M, N, L) { - let $ = M; - if (M && !L && typeof M == "object") { + function l(P) { + if (P === null) return ""; + if (Oe.isDate(P)) + return P.toISOString(); + if (!u && Oe.isBlob(P)) + throw new or("Blob is not supported. Use a Buffer instead."); + return Oe.isArrayBuffer(P) || Oe.isTypedArray(P) ? u && typeof Blob == "function" ? new Blob([P]) : Buffer.from(P) : P; + } + function d(P, N, L) { + let $ = P; + if (P && !L && typeof P == "object") { if (Oe.endsWith(N, "{}")) - N = n ? N : N.slice(0, -2), M = JSON.stringify(M); - else if (Oe.isArray(M) && rX(M) || (Oe.isFileList(M) || Oe.endsWith(N, "[]")) && ($ = Oe.toArray(M))) - return N = AS(N), $.forEach(function(K, H) { - !(Oe.isUndefined(K) || K === null) && e.append( + N = n ? N : N.slice(0, -2), P = JSON.stringify(P); + else if (Oe.isArray(P) && hX(P) || (Oe.isFileList(P) || Oe.endsWith(N, "[]")) && ($ = Oe.toArray(P))) + return N = MS(N), $.forEach(function(H, W) { + !(Oe.isUndefined(H) || H === null) && e.append( // eslint-disable-next-line no-nested-ternary - o === !0 ? O_([N], H, s) : o === null ? N : N + "[]", - l(K) + o === !0 ? L6([N], W, s) : o === null ? N : N + "[]", + l(H) ); }), !1; } - return W1(M) ? !0 : (e.append(O_(L, N, s), l(M)), !1); + return H1(P) ? !0 : (e.append(L6(L, N, s), l(P)), !1); } - const g = [], w = Object.assign(nX, { + const p = [], w = Object.assign(dX, { defaultVisitor: d, convertValue: l, - isVisitable: W1 + isVisitable: H1 }); - function A(M, N) { - if (!Oe.isUndefined(M)) { - if (g.indexOf(M) !== -1) + function A(P, N) { + if (!Oe.isUndefined(P)) { + if (p.indexOf(P) !== -1) throw Error("Circular reference detected in " + N.join(".")); - g.push(M), Oe.forEach(M, function($, F) { + p.push(P), Oe.forEach(P, function($, B) { (!(Oe.isUndefined($) || $ === null) && i.call( e, $, - Oe.isString(F) ? F.trim() : F, + Oe.isString(B) ? B.trim() : B, N, w - )) === !0 && A($, N ? N.concat(F) : [F]); - }), g.pop(); + )) === !0 && A($, N ? N.concat(B) : [B]); + }), p.pop(); } } if (!Oe.isObject(t)) throw new TypeError("data must be an object"); return A(t), e; } -function N_(t) { +function k6(t) { const e = { "!": "%21", "'": "%27", @@ -29390,27 +29390,27 @@ function N_(t) { }); } function Ab(t, e) { - this._pairs = [], t && hp(t, this, e); + this._pairs = [], t && dp(t, this, e); } -const PS = Ab.prototype; -PS.append = function(e, r) { +const IS = Ab.prototype; +IS.append = function(e, r) { this._pairs.push([e, r]); }; -PS.toString = function(e) { +IS.toString = function(e) { const r = e ? function(n) { - return e.call(this, n, N_); - } : N_; + return e.call(this, n, k6); + } : k6; return this._pairs.map(function(i) { return r(i[0]) + "=" + r(i[1]); }, "").join("&"); }; -function iX(t) { +function pX(t) { return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]"); } -function MS(t, e, r) { +function CS(t, e, r) { if (!e) return t; - const n = r && r.encode || iX; + const n = r && r.encode || pX; Oe.isFunction(r) && (r = { serialize: r }); @@ -29422,7 +29422,7 @@ function MS(t, e, r) { } return t; } -class L_ { +class $6 { constructor() { this.handlers = []; } @@ -29476,41 +29476,41 @@ class L_ { }); } } -const IS = { +const TS = { silentJSONParsing: !0, forcedJSONParsing: !0, clarifyTimeoutError: !1 -}, sX = typeof URLSearchParams < "u" ? URLSearchParams : Ab, oX = typeof FormData < "u" ? FormData : null, aX = typeof Blob < "u" ? Blob : null, cX = { +}, gX = typeof URLSearchParams < "u" ? URLSearchParams : Ab, mX = typeof FormData < "u" ? FormData : null, vX = typeof Blob < "u" ? Blob : null, bX = { isBrowser: !0, classes: { - URLSearchParams: sX, - FormData: oX, - Blob: aX + URLSearchParams: gX, + FormData: mX, + Blob: vX }, protocols: ["http", "https", "file", "blob", "url", "data"] -}, Pb = typeof window < "u" && typeof document < "u", K1 = typeof navigator == "object" && navigator || void 0, uX = Pb && (!K1 || ["ReactNative", "NativeScript", "NS"].indexOf(K1.product) < 0), fX = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef -self instanceof WorkerGlobalScope && typeof self.importScripts == "function", lX = Pb && window.location.href || "http://localhost", hX = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}, Pb = typeof window < "u" && typeof document < "u", K1 = typeof navigator == "object" && navigator || void 0, yX = Pb && (!K1 || ["ReactNative", "NativeScript", "NS"].indexOf(K1.product) < 0), wX = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef +self instanceof WorkerGlobalScope && typeof self.importScripts == "function", xX = Pb && window.location.href || "http://localhost", _X = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, hasBrowserEnv: Pb, - hasStandardBrowserEnv: uX, - hasStandardBrowserWebWorkerEnv: fX, + hasStandardBrowserEnv: yX, + hasStandardBrowserWebWorkerEnv: wX, navigator: K1, - origin: lX -}, Symbol.toStringTag, { value: "Module" })), Yn = { - ...hX, - ...cX + origin: xX +}, Symbol.toStringTag, { value: "Module" })), Jn = { + ..._X, + ...bX }; -function dX(t, e) { - return hp(t, new Yn.classes.URLSearchParams(), Object.assign({ +function EX(t, e) { + return dp(t, new Jn.classes.URLSearchParams(), Object.assign({ visitor: function(r, n, i, s) { - return Yn.isNode && Oe.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : s.defaultVisitor.apply(this, arguments); + return Jn.isNode && Oe.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : s.defaultVisitor.apply(this, arguments); } }, e)); } -function pX(t) { +function SX(t) { return Oe.matchAll(/\w+|\[(\w*)]/g, t).map((e) => e[0] === "[]" ? "" : e[1] || e[0]); } -function gX(t) { +function AX(t) { const e = {}, r = Object.keys(t); let n; const i = r.length; @@ -29519,22 +29519,22 @@ function gX(t) { s = r[n], e[s] = t[s]; return e; } -function CS(t) { +function RS(t) { function e(r, n, i, s) { let o = r[s++]; if (o === "__proto__") return !0; const a = Number.isFinite(+o), u = s >= r.length; - return o = !o && Oe.isArray(i) ? i.length : o, u ? (Oe.hasOwnProp(i, o) ? i[o] = [i[o], n] : i[o] = n, !a) : ((!i[o] || !Oe.isObject(i[o])) && (i[o] = []), e(r, n, i[o], s) && Oe.isArray(i[o]) && (i[o] = gX(i[o])), !a); + return o = !o && Oe.isArray(i) ? i.length : o, u ? (Oe.hasOwnProp(i, o) ? i[o] = [i[o], n] : i[o] = n, !a) : ((!i[o] || !Oe.isObject(i[o])) && (i[o] = []), e(r, n, i[o], s) && Oe.isArray(i[o]) && (i[o] = AX(i[o])), !a); } if (Oe.isFormData(t) && Oe.isFunction(t.entries)) { const r = {}; return Oe.forEachEntry(t, (n, i) => { - e(pX(n), i, r, 0); + e(SX(n), i, r, 0); }), r; } return null; } -function mX(t, e, r) { +function PX(t, e, r) { if (Oe.isString(t)) try { return (e || JSON.parse)(t), Oe.trim(t); @@ -29544,13 +29544,13 @@ function mX(t, e, r) { } return (r || JSON.stringify)(t); } -const sh = { - transitional: IS, +const oh = { + transitional: TS, adapter: ["xhr", "http", "fetch"], transformRequest: [function(e, r) { const n = r.getContentType() || "", i = n.indexOf("application/json") > -1, s = Oe.isObject(e); if (s && Oe.isHTMLForm(e) && (e = new FormData(e)), Oe.isFormData(e)) - return i ? JSON.stringify(CS(e)) : e; + return i ? JSON.stringify(RS(e)) : e; if (Oe.isArrayBuffer(e) || Oe.isBuffer(e) || Oe.isStream(e) || Oe.isFile(e) || Oe.isBlob(e) || Oe.isReadableStream(e)) return e; if (Oe.isArrayBufferView(e)) @@ -29560,20 +29560,20 @@ const sh = { let a; if (s) { if (n.indexOf("application/x-www-form-urlencoded") > -1) - return dX(e, this.formSerializer).toString(); + return EX(e, this.formSerializer).toString(); if ((a = Oe.isFileList(e)) || n.indexOf("multipart/form-data") > -1) { const u = this.env && this.env.FormData; - return hp( + return dp( a ? { "files[]": e } : e, u && new u(), this.formSerializer ); } } - return s || i ? (r.setContentType("application/json", !1), mX(e)) : e; + return s || i ? (r.setContentType("application/json", !1), PX(e)) : e; }], transformResponse: [function(e) { - const r = this.transitional || sh.transitional, n = r && r.forcedJSONParsing, i = this.responseType === "json"; + const r = this.transitional || oh.transitional, n = r && r.forcedJSONParsing, i = this.responseType === "json"; if (Oe.isResponse(e) || Oe.isReadableStream(e)) return e; if (e && Oe.isString(e) && (n && !this.responseType || i)) { @@ -29582,7 +29582,7 @@ const sh = { return JSON.parse(e); } catch (a) { if (o) - throw a.name === "SyntaxError" ? sr.from(a, sr.ERR_BAD_RESPONSE, this, null, this.response) : a; + throw a.name === "SyntaxError" ? or.from(a, or.ERR_BAD_RESPONSE, this, null, this.response) : a; } } return e; @@ -29597,8 +29597,8 @@ const sh = { maxContentLength: -1, maxBodyLength: -1, env: { - FormData: Yn.classes.FormData, - Blob: Yn.classes.Blob + FormData: Jn.classes.FormData, + Blob: Jn.classes.Blob }, validateStatus: function(e) { return e >= 200 && e < 300; @@ -29611,9 +29611,9 @@ const sh = { } }; Oe.forEach(["delete", "get", "head", "post", "put", "patch"], (t) => { - sh.headers[t] = {}; + oh.headers[t] = {}; }); -const vX = Oe.toObjectSet([ +const MX = Oe.toObjectSet([ "age", "authorization", "content-length", @@ -29631,28 +29631,28 @@ const vX = Oe.toObjectSet([ "referer", "retry-after", "user-agent" -]), bX = (t) => { +]), IX = (t) => { const e = {}; let r, n, i; return t && t.split(` `).forEach(function(o) { - i = o.indexOf(":"), r = o.substring(0, i).trim().toLowerCase(), n = o.substring(i + 1).trim(), !(!r || e[r] && vX[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n); + i = o.indexOf(":"), r = o.substring(0, i).trim().toLowerCase(), n = o.substring(i + 1).trim(), !(!r || e[r] && MX[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n); }), e; -}, k_ = Symbol("internals"); -function Rf(t) { +}, B6 = Symbol("internals"); +function Df(t) { return t && String(t).trim().toLowerCase(); } -function kd(t) { - return t === !1 || t == null ? t : Oe.isArray(t) ? t.map(kd) : String(t); +function $d(t) { + return t === !1 || t == null ? t : Oe.isArray(t) ? t.map($d) : String(t); } -function yX(t) { +function CX(t) { const e = /* @__PURE__ */ Object.create(null), r = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; let n; for (; n = r.exec(t); ) e[n[1]] = n[2]; return e; } -const wX = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()); +const TX = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()); function Cm(t, e, r, n, i) { if (Oe.isFunction(n)) return n.call(this, e, r); @@ -29663,10 +29663,10 @@ function Cm(t, e, r, n, i) { return n.test(e); } } -function xX(t) { +function RX(t) { return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, r, n) => r.toUpperCase() + n); } -function _X(t, e) { +function DX(t, e) { const r = Oe.toCamelCase(" " + e); ["get", "set", "has"].forEach((n) => { Object.defineProperty(t, n + r, { @@ -29684,17 +29684,17 @@ let yi = class { set(e, r, n) { const i = this; function s(a, u, l) { - const d = Rf(u); + const d = Df(u); if (!d) throw new Error("header name must be a non-empty string"); - const g = Oe.findKey(i, d); - (!g || i[g] === void 0 || l === !0 || l === void 0 && i[g] !== !1) && (i[g || u] = kd(a)); + const p = Oe.findKey(i, d); + (!p || i[p] === void 0 || l === !0 || l === void 0 && i[p] !== !1) && (i[p || u] = $d(a)); } const o = (a, u) => Oe.forEach(a, (l, d) => s(l, d, u)); if (Oe.isPlainObject(e) || e instanceof this.constructor) o(e, r); - else if (Oe.isString(e) && (e = e.trim()) && !wX(e)) - o(bX(e), r); + else if (Oe.isString(e) && (e = e.trim()) && !TX(e)) + o(IX(e), r); else if (Oe.isHeaders(e)) for (const [a, u] of e.entries()) s(u, a, n); @@ -29703,14 +29703,14 @@ let yi = class { return this; } get(e, r) { - if (e = Rf(e), e) { + if (e = Df(e), e) { const n = Oe.findKey(this, e); if (n) { const i = this[n]; if (!r) return i; if (r === !0) - return yX(i); + return CX(i); if (Oe.isFunction(r)) return r.call(this, i, n); if (Oe.isRegExp(r)) @@ -29720,7 +29720,7 @@ let yi = class { } } has(e, r) { - if (e = Rf(e), e) { + if (e = Df(e), e) { const n = Oe.findKey(this, e); return !!(n && this[n] !== void 0 && (!r || Cm(this, this[n], n, r))); } @@ -29730,7 +29730,7 @@ let yi = class { const n = this; let i = !1; function s(o) { - if (o = Rf(o), o) { + if (o = Df(o), o) { const a = Oe.findKey(n, o); a && (!r || Cm(n, n[a], a, r)) && (delete n[a], i = !0); } @@ -29751,11 +29751,11 @@ let yi = class { return Oe.forEach(this, (i, s) => { const o = Oe.findKey(n, s); if (o) { - r[o] = kd(i), delete r[s]; + r[o] = $d(i), delete r[s]; return; } - const a = e ? xX(s) : String(s).trim(); - a !== s && delete r[s], r[a] = kd(i), n[a] = !0; + const a = e ? RX(s) : String(s).trim(); + a !== s && delete r[s], r[a] = $d(i), n[a] = !0; }), this; } concat(...e) { @@ -29785,12 +29785,12 @@ let yi = class { return r.forEach((i) => n.set(i)), n; } static accessor(e) { - const n = (this[k_] = this[k_] = { + const n = (this[B6] = this[B6] = { accessors: {} }).accessors, i = this.prototype; function s(o) { - const a = Rf(o); - n[a] || (_X(i, o), n[a] = !0); + const a = Df(o); + n[a] || (DX(i, o), n[a] = !0); } return Oe.isArray(e) ? e.forEach(s) : s(e), this; } @@ -29807,70 +29807,70 @@ Oe.reduceDescriptors(yi.prototype, ({ value: t }, e) => { }); Oe.freezeMethods(yi); function Tm(t, e) { - const r = this || sh, n = e || r, i = yi.from(n.headers); + const r = this || oh, n = e || r, i = yi.from(n.headers); let s = n.data; return Oe.forEach(t, function(a) { s = a.call(r, s, i.normalize(), e ? e.status : void 0); }), i.normalize(), s; } -function TS(t) { +function DS(t) { return !!(t && t.__CANCEL__); } function Hu(t, e, r) { - sr.call(this, t ?? "canceled", sr.ERR_CANCELED, e, r), this.name = "CanceledError"; + or.call(this, t ?? "canceled", or.ERR_CANCELED, e, r), this.name = "CanceledError"; } -Oe.inherits(Hu, sr, { +Oe.inherits(Hu, or, { __CANCEL__: !0 }); -function RS(t, e, r) { +function OS(t, e, r) { const n = r.config.validateStatus; - !r.status || !n || n(r.status) ? t(r) : e(new sr( + !r.status || !n || n(r.status) ? t(r) : e(new or( "Request failed with status code " + r.status, - [sr.ERR_BAD_REQUEST, sr.ERR_BAD_RESPONSE][Math.floor(r.status / 100) - 4], + [or.ERR_BAD_REQUEST, or.ERR_BAD_RESPONSE][Math.floor(r.status / 100) - 4], r.config, r.request, r )); } -function EX(t) { +function OX(t) { const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(t); return e && e[1] || ""; } -function SX(t, e) { +function NX(t, e) { t = t || 10; const r = new Array(t), n = new Array(t); let i = 0, s = 0, o; return e = e !== void 0 ? e : 1e3, function(u) { const l = Date.now(), d = n[s]; o || (o = l), r[i] = u, n[i] = l; - let g = s, w = 0; - for (; g !== i; ) - w += r[g++], g = g % t; + let p = s, w = 0; + for (; p !== i; ) + w += r[p++], p = p % t; if (i = (i + 1) % t, i === s && (s = (s + 1) % t), l - o < e) return; const A = d && l - d; return A ? Math.round(w * 1e3 / A) : void 0; }; } -function AX(t, e) { +function LX(t, e) { let r = 0, n = 1e3 / e, i, s; const o = (l, d = Date.now()) => { r = d, i = null, s && (clearTimeout(s), s = null), t.apply(null, l); }; return [(...l) => { - const d = Date.now(), g = d - r; - g >= n ? o(l, d) : (i = l, s || (s = setTimeout(() => { + const d = Date.now(), p = d - r; + p >= n ? o(l, d) : (i = l, s || (s = setTimeout(() => { s = null, o(i); - }, n - g))); + }, n - p))); }, () => i && o(i)]; } -const p0 = (t, e, r = 3) => { +const g0 = (t, e, r = 3) => { let n = 0; - const i = SX(50, 250); - return AX((s) => { + const i = NX(50, 250); + return LX((s) => { const o = s.loaded, a = s.lengthComputable ? s.total : void 0, u = o - n, l = i(u), d = o <= a; n = o; - const g = { + const p = { loaded: o, total: a, progress: a ? o / a : void 0, @@ -29881,19 +29881,19 @@ const p0 = (t, e, r = 3) => { lengthComputable: a != null, [e ? "download" : "upload"]: !0 }; - t(g); + t(p); }, r); -}, $_ = (t, e) => { +}, F6 = (t, e) => { const r = t != null; return [(n) => e[0]({ lengthComputable: r, total: t, loaded: n }), e[1]]; -}, F_ = (t) => (...e) => Oe.asap(() => t(...e)), PX = Yn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Yn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( - new URL(Yn.origin), - Yn.navigator && /(msie|trident)/i.test(Yn.navigator.userAgent) -) : () => !0, MX = Yn.hasStandardBrowserEnv ? ( +}, j6 = (t) => (...e) => Oe.asap(() => t(...e)), kX = Jn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Jn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( + new URL(Jn.origin), + Jn.navigator && /(msie|trident)/i.test(Jn.navigator.userAgent) +) : () => !0, $X = Jn.hasStandardBrowserEnv ? ( // Standard browser envs support document.cookie { write(t, e, r, n, i, s) { @@ -29920,27 +29920,27 @@ const p0 = (t, e, r = 3) => { } } ); -function IX(t) { +function BX(t) { return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t); } -function CX(t, e) { +function FX(t, e) { return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t; } -function DS(t, e) { - return t && !IX(e) ? CX(t, e) : e; +function NS(t, e) { + return t && !BX(e) ? FX(t, e) : e; } -const B_ = (t) => t instanceof yi ? { ...t } : t; -function pc(t, e) { +const U6 = (t) => t instanceof yi ? { ...t } : t; +function mc(t, e) { e = e || {}; const r = {}; - function n(l, d, g, w) { + function n(l, d, p, w) { return Oe.isPlainObject(l) && Oe.isPlainObject(d) ? Oe.merge.call({ caseless: w }, l, d) : Oe.isPlainObject(d) ? Oe.merge({}, d) : Oe.isArray(d) ? d.slice() : d; } - function i(l, d, g, w) { + function i(l, d, p, w) { if (Oe.isUndefined(d)) { if (!Oe.isUndefined(l)) - return n(void 0, l, g, w); - } else return n(l, d, g, w); + return n(void 0, l, p, w); + } else return n(l, d, p, w); } function s(l, d) { if (!Oe.isUndefined(d)) @@ -29952,10 +29952,10 @@ function pc(t, e) { return n(void 0, l); } else return n(void 0, d); } - function a(l, d, g) { - if (g in e) + function a(l, d, p) { + if (p in e) return n(l, d); - if (g in t) + if (p in t) return n(void 0, l); } const u = { @@ -29987,59 +29987,59 @@ function pc(t, e) { socketPath: o, responseEncoding: o, validateStatus: a, - headers: (l, d, g) => i(B_(l), B_(d), g, !0) + headers: (l, d, p) => i(U6(l), U6(d), p, !0) }; return Oe.forEach(Object.keys(Object.assign({}, t, e)), function(d) { - const g = u[d] || i, w = g(t[d], e[d], d); - Oe.isUndefined(w) && g !== a || (r[d] = w); + const p = u[d] || i, w = p(t[d], e[d], d); + Oe.isUndefined(w) && p !== a || (r[d] = w); }), r; } -const OS = (t) => { - const e = pc({}, t); +const LS = (t) => { + const e = mc({}, t); let { data: r, withXSRFToken: n, xsrfHeaderName: i, xsrfCookieName: s, headers: o, auth: a } = e; - e.headers = o = yi.from(o), e.url = MS(DS(e.baseURL, e.url), t.params, t.paramsSerializer), a && o.set( + e.headers = o = yi.from(o), e.url = CS(NS(e.baseURL, e.url), t.params, t.paramsSerializer), a && o.set( "Authorization", "Basic " + btoa((a.username || "") + ":" + (a.password ? unescape(encodeURIComponent(a.password)) : "")) ); let u; if (Oe.isFormData(r)) { - if (Yn.hasStandardBrowserEnv || Yn.hasStandardBrowserWebWorkerEnv) + if (Jn.hasStandardBrowserEnv || Jn.hasStandardBrowserWebWorkerEnv) o.setContentType(void 0); else if ((u = o.getContentType()) !== !1) { - const [l, ...d] = u ? u.split(";").map((g) => g.trim()).filter(Boolean) : []; + const [l, ...d] = u ? u.split(";").map((p) => p.trim()).filter(Boolean) : []; o.setContentType([l || "multipart/form-data", ...d].join("; ")); } } - if (Yn.hasStandardBrowserEnv && (n && Oe.isFunction(n) && (n = n(e)), n || n !== !1 && PX(e.url))) { - const l = i && s && MX.read(s); + if (Jn.hasStandardBrowserEnv && (n && Oe.isFunction(n) && (n = n(e)), n || n !== !1 && kX(e.url))) { + const l = i && s && $X.read(s); l && o.set(i, l); } return e; -}, TX = typeof XMLHttpRequest < "u", RX = TX && function(t) { +}, jX = typeof XMLHttpRequest < "u", UX = jX && function(t) { return new Promise(function(r, n) { - const i = OS(t); + const i = LS(t); let s = i.data; const o = yi.from(i.headers).normalize(); - let { responseType: a, onUploadProgress: u, onDownloadProgress: l } = i, d, g, w, A, M; + let { responseType: a, onUploadProgress: u, onDownloadProgress: l } = i, d, p, w, A, P; function N() { - A && A(), M && M(), i.cancelToken && i.cancelToken.unsubscribe(d), i.signal && i.signal.removeEventListener("abort", d); + A && A(), P && P(), i.cancelToken && i.cancelToken.unsubscribe(d), i.signal && i.signal.removeEventListener("abort", d); } let L = new XMLHttpRequest(); L.open(i.method.toUpperCase(), i.url, !0), L.timeout = i.timeout; function $() { if (!L) return; - const K = yi.from( + const H = yi.from( "getAllResponseHeaders" in L && L.getAllResponseHeaders() ), V = { data: !a || a === "text" || a === "json" ? L.responseText : L.response, status: L.status, statusText: L.statusText, - headers: K, + headers: H, config: t, request: L }; - RS(function(R) { + OS(function(R) { r(R), N(); }, function(R) { n(R), N(); @@ -30048,31 +30048,31 @@ const OS = (t) => { "onloadend" in L ? L.onloadend = $ : L.onreadystatechange = function() { !L || L.readyState !== 4 || L.status === 0 && !(L.responseURL && L.responseURL.indexOf("file:") === 0) || setTimeout($); }, L.onabort = function() { - L && (n(new sr("Request aborted", sr.ECONNABORTED, t, L)), L = null); + L && (n(new or("Request aborted", or.ECONNABORTED, t, L)), L = null); }, L.onerror = function() { - n(new sr("Network Error", sr.ERR_NETWORK, t, L)), L = null; + n(new or("Network Error", or.ERR_NETWORK, t, L)), L = null; }, L.ontimeout = function() { - let H = i.timeout ? "timeout of " + i.timeout + "ms exceeded" : "timeout exceeded"; - const V = i.transitional || IS; - i.timeoutErrorMessage && (H = i.timeoutErrorMessage), n(new sr( - H, - V.clarifyTimeoutError ? sr.ETIMEDOUT : sr.ECONNABORTED, + let W = i.timeout ? "timeout of " + i.timeout + "ms exceeded" : "timeout exceeded"; + const V = i.transitional || TS; + i.timeoutErrorMessage && (W = i.timeoutErrorMessage), n(new or( + W, + V.clarifyTimeoutError ? or.ETIMEDOUT : or.ECONNABORTED, t, L )), L = null; - }, s === void 0 && o.setContentType(null), "setRequestHeader" in L && Oe.forEach(o.toJSON(), function(H, V) { - L.setRequestHeader(V, H); - }), Oe.isUndefined(i.withCredentials) || (L.withCredentials = !!i.withCredentials), a && a !== "json" && (L.responseType = i.responseType), l && ([w, M] = p0(l, !0), L.addEventListener("progress", w)), u && L.upload && ([g, A] = p0(u), L.upload.addEventListener("progress", g), L.upload.addEventListener("loadend", A)), (i.cancelToken || i.signal) && (d = (K) => { - L && (n(!K || K.type ? new Hu(null, t, L) : K), L.abort(), L = null); + }, s === void 0 && o.setContentType(null), "setRequestHeader" in L && Oe.forEach(o.toJSON(), function(W, V) { + L.setRequestHeader(V, W); + }), Oe.isUndefined(i.withCredentials) || (L.withCredentials = !!i.withCredentials), a && a !== "json" && (L.responseType = i.responseType), l && ([w, P] = g0(l, !0), L.addEventListener("progress", w)), u && L.upload && ([p, A] = g0(u), L.upload.addEventListener("progress", p), L.upload.addEventListener("loadend", A)), (i.cancelToken || i.signal) && (d = (H) => { + L && (n(!H || H.type ? new Hu(null, t, L) : H), L.abort(), L = null); }, i.cancelToken && i.cancelToken.subscribe(d), i.signal && (i.signal.aborted ? d() : i.signal.addEventListener("abort", d))); - const F = EX(i.url); - if (F && Yn.protocols.indexOf(F) === -1) { - n(new sr("Unsupported protocol " + F + ":", sr.ERR_BAD_REQUEST, t)); + const B = OX(i.url); + if (B && Jn.protocols.indexOf(B) === -1) { + n(new or("Unsupported protocol " + B + ":", or.ERR_BAD_REQUEST, t)); return; } L.send(s || null); }); -}, DX = (t, e) => { +}, qX = (t, e) => { const { length: r } = t = t ? t.filter(Boolean) : []; if (e || r) { let n = new AbortController(), i; @@ -30080,11 +30080,11 @@ const OS = (t) => { if (!i) { i = !0, a(); const d = l instanceof Error ? l : this.reason; - n.abort(d instanceof sr ? d : new Hu(d instanceof Error ? d.message : d)); + n.abort(d instanceof or ? d : new Hu(d instanceof Error ? d.message : d)); } }; let o = e && setTimeout(() => { - o = null, s(new sr(`timeout ${e} of ms exceeded`, sr.ETIMEDOUT)); + o = null, s(new or(`timeout ${e} of ms exceeded`, or.ETIMEDOUT)); }, e); const a = () => { t && (o && clearTimeout(o), o = null, t.forEach((l) => { @@ -30095,7 +30095,7 @@ const OS = (t) => { const { signal: u } = n; return u.unsubscribe = () => Oe.asap(a), u; } -}, OX = function* (t, e) { +}, zX = function* (t, e) { let r = t.byteLength; if (r < e) { yield t; @@ -30104,10 +30104,10 @@ const OS = (t) => { let n = 0, i; for (; n < r; ) i = n + e, yield t.slice(n, i), n = i; -}, NX = async function* (t, e) { - for await (const r of LX(t)) - yield* OX(r, e); -}, LX = async function* (t) { +}, WX = async function* (t, e) { + for await (const r of HX(t)) + yield* zX(r, e); +}, HX = async function* (t) { if (t[Symbol.asyncIterator]) { yield* t; return; @@ -30123,8 +30123,8 @@ const OS = (t) => { } finally { await e.cancel(); } -}, U_ = (t, e, r, n) => { - const i = NX(t, e); +}, q6 = (t, e, r, n) => { + const i = WX(t, e); let s = 0, o, a = (u) => { o || (o = !0, n && n(u)); }; @@ -30136,9 +30136,9 @@ const OS = (t) => { a(), u.close(); return; } - let g = d.byteLength; + let p = d.byteLength; if (r) { - let w = s += g; + let w = s += p; r(w); } u.enqueue(new Uint8Array(d)); @@ -30152,15 +30152,15 @@ const OS = (t) => { }, { highWaterMark: 2 }); -}, dp = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", NS = dp && typeof ReadableStream == "function", kX = dp && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), LS = (t, ...e) => { +}, pp = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", kS = pp && typeof ReadableStream == "function", KX = pp && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), $S = (t, ...e) => { try { return !!t(...e); } catch { return !1; } -}, $X = NS && LS(() => { +}, VX = kS && $S(() => { let t = !1; - const e = new Request(Yn.origin, { + const e = new Request(Jn.origin, { body: new ReadableStream(), method: "POST", get duplex() { @@ -30168,34 +30168,34 @@ const OS = (t) => { } }).headers.has("Content-Type"); return t && !e; -}), j_ = 64 * 1024, V1 = NS && LS(() => Oe.isReadableStream(new Response("").body)), g0 = { +}), z6 = 64 * 1024, V1 = kS && $S(() => Oe.isReadableStream(new Response("").body)), m0 = { stream: V1 && ((t) => t.body) }; -dp && ((t) => { +pp && ((t) => { ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => { - !g0[e] && (g0[e] = Oe.isFunction(t[e]) ? (r) => r[e]() : (r, n) => { - throw new sr(`Response type '${e}' is not supported`, sr.ERR_NOT_SUPPORT, n); + !m0[e] && (m0[e] = Oe.isFunction(t[e]) ? (r) => r[e]() : (r, n) => { + throw new or(`Response type '${e}' is not supported`, or.ERR_NOT_SUPPORT, n); }); }); })(new Response()); -const FX = async (t) => { +const GX = async (t) => { if (t == null) return 0; if (Oe.isBlob(t)) return t.size; if (Oe.isSpecCompliantForm(t)) - return (await new Request(Yn.origin, { + return (await new Request(Jn.origin, { method: "POST", body: t }).arrayBuffer()).byteLength; if (Oe.isArrayBufferView(t) || Oe.isArrayBuffer(t)) return t.byteLength; if (Oe.isURLSearchParams(t) && (t = t + ""), Oe.isString(t)) - return (await kX(t)).byteLength; -}, BX = async (t, e) => { + return (await KX(t)).byteLength; +}, YX = async (t, e) => { const r = Oe.toFiniteNumber(t.getContentLength()); - return r ?? FX(e); -}, UX = dp && (async (t) => { + return r ?? GX(e); +}, JX = pp && (async (t) => { let { url: e, method: r, @@ -30207,83 +30207,83 @@ const FX = async (t) => { onUploadProgress: u, responseType: l, headers: d, - withCredentials: g = "same-origin", + withCredentials: p = "same-origin", fetchOptions: w - } = OS(t); + } = LS(t); l = l ? (l + "").toLowerCase() : "text"; - let A = DX([i, s && s.toAbortSignal()], o), M; + let A = qX([i, s && s.toAbortSignal()], o), P; const N = A && A.unsubscribe && (() => { A.unsubscribe(); }); let L; try { - if (u && $X && r !== "get" && r !== "head" && (L = await BX(d, n)) !== 0) { + if (u && VX && r !== "get" && r !== "head" && (L = await YX(d, n)) !== 0) { let V = new Request(e, { method: "POST", body: n, duplex: "half" }), te; if (Oe.isFormData(n) && (te = V.headers.get("content-type")) && d.setContentType(te), V.body) { - const [R, W] = $_( + const [R, K] = F6( L, - p0(F_(u)) + g0(j6(u)) ); - n = U_(V.body, j_, R, W); + n = q6(V.body, z6, R, K); } } - Oe.isString(g) || (g = g ? "include" : "omit"); + Oe.isString(p) || (p = p ? "include" : "omit"); const $ = "credentials" in Request.prototype; - M = new Request(e, { + P = new Request(e, { ...w, signal: A, method: r.toUpperCase(), headers: d.normalize().toJSON(), body: n, duplex: "half", - credentials: $ ? g : void 0 + credentials: $ ? p : void 0 }); - let F = await fetch(M); - const K = V1 && (l === "stream" || l === "response"); - if (V1 && (a || K && N)) { + let B = await fetch(P); + const H = V1 && (l === "stream" || l === "response"); + if (V1 && (a || H && N)) { const V = {}; - ["status", "statusText", "headers"].forEach((pe) => { - V[pe] = F[pe]; + ["status", "statusText", "headers"].forEach((ge) => { + V[ge] = B[ge]; }); - const te = Oe.toFiniteNumber(F.headers.get("content-length")), [R, W] = a && $_( + const te = Oe.toFiniteNumber(B.headers.get("content-length")), [R, K] = a && F6( te, - p0(F_(a), !0) + g0(j6(a), !0) ) || []; - F = new Response( - U_(F.body, j_, R, () => { - W && W(), N && N(); + B = new Response( + q6(B.body, z6, R, () => { + K && K(), N && N(); }), V ); } l = l || "text"; - let H = await g0[Oe.findKey(g0, l) || "text"](F, t); - return !K && N && N(), await new Promise((V, te) => { - RS(V, te, { - data: H, - headers: yi.from(F.headers), - status: F.status, - statusText: F.statusText, + let W = await m0[Oe.findKey(m0, l) || "text"](B, t); + return !H && N && N(), await new Promise((V, te) => { + OS(V, te, { + data: W, + headers: yi.from(B.headers), + status: B.status, + statusText: B.statusText, config: t, - request: M + request: P }); }); } catch ($) { throw N && N(), $ && $.name === "TypeError" && /fetch/i.test($.message) ? Object.assign( - new sr("Network Error", sr.ERR_NETWORK, t, M), + new or("Network Error", or.ERR_NETWORK, t, P), { cause: $.cause || $ } - ) : sr.from($, $ && $.code, t, M); + ) : or.from($, $ && $.code, t, P); } }), G1 = { - http: tX, - xhr: RX, - fetch: UX + http: lX, + xhr: UX, + fetch: JX }; Oe.forEach(G1, (t, e) => { if (t) { @@ -30294,7 +30294,7 @@ Oe.forEach(G1, (t, e) => { Object.defineProperty(t, "adapterName", { value: e }); } }); -const q_ = (t) => `- ${t}`, jX = (t) => Oe.isFunction(t) || t === null || t === !1, kS = { +const W6 = (t) => `- ${t}`, XX = (t) => Oe.isFunction(t) || t === null || t === !1, BS = { getAdapter: (t) => { t = Oe.isArray(t) ? t : [t]; const { length: e } = t; @@ -30303,8 +30303,8 @@ const q_ = (t) => `- ${t}`, jX = (t) => Oe.isFunction(t) || t === null || t === for (let s = 0; s < e; s++) { r = t[s]; let o; - if (n = r, !jX(r) && (n = G1[(o = String(r)).toLowerCase()], n === void 0)) - throw new sr(`Unknown adapter '${o}'`); + if (n = r, !XX(r) && (n = G1[(o = String(r)).toLowerCase()], n === void 0)) + throw new or(`Unknown adapter '${o}'`); if (n) break; i[o || "#" + s] = n; @@ -30314,9 +30314,9 @@ const q_ = (t) => `- ${t}`, jX = (t) => Oe.isFunction(t) || t === null || t === ([a, u]) => `adapter ${a} ` + (u === !1 ? "is not supported by the environment" : "is not available in the build") ); let o = e ? s.length > 1 ? `since : -` + s.map(q_).join(` -`) : " " + q_(s[0]) : "as no adapter specified"; - throw new sr( +` + s.map(W6).join(` +`) : " " + W6(s[0]) : "as no adapter specified"; + throw new or( "There is no suitable adapter to dispatch the request " + o, "ERR_NOT_SUPPORT" ); @@ -30329,42 +30329,42 @@ function Rm(t) { if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted) throw new Hu(null, t); } -function z_(t) { +function H6(t) { return Rm(t), t.headers = yi.from(t.headers), t.data = Tm.call( t, t.transformRequest - ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), kS.getAdapter(t.adapter || sh.adapter)(t).then(function(n) { + ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), BS.getAdapter(t.adapter || oh.adapter)(t).then(function(n) { return Rm(t), n.data = Tm.call( t, t.transformResponse, n ), n.headers = yi.from(n.headers), n; }, function(n) { - return TS(n) || (Rm(t), n && n.response && (n.response.data = Tm.call( + return DS(n) || (Rm(t), n && n.response && (n.response.data = Tm.call( t, t.transformResponse, n.response ), n.response.headers = yi.from(n.response.headers))), Promise.reject(n); }); } -const $S = "1.7.8", pp = {}; +const FS = "1.7.8", gp = {}; ["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => { - pp[t] = function(n) { + gp[t] = function(n) { return typeof n === t || "a" + (e < 1 ? "n " : " ") + t; }; }); -const H_ = {}; -pp.transitional = function(e, r, n) { +const K6 = {}; +gp.transitional = function(e, r, n) { function i(s, o) { - return "[Axios v" + $S + "] Transitional option '" + s + "'" + o + (n ? ". " + n : ""); + return "[Axios v" + FS + "] Transitional option '" + s + "'" + o + (n ? ". " + n : ""); } return (s, o, a) => { if (e === !1) - throw new sr( + throw new or( i(o, " has been removed" + (r ? " in " + r : "")), - sr.ERR_DEPRECATED + or.ERR_DEPRECATED ); - return r && !H_[o] && (H_[o] = !0, console.warn( + return r && !K6[o] && (K6[o] = !0, console.warn( i( o, " has been deprecated since v" + r + " and will be removed in the near future" @@ -30372,12 +30372,12 @@ pp.transitional = function(e, r, n) { )), e ? e(s, o, a) : !0; }; }; -pp.spelling = function(e) { +gp.spelling = function(e) { return (r, n) => (console.warn(`${n} is likely a misspelling of ${e}`), !0); }; -function qX(t, e, r) { +function ZX(t, e, r) { if (typeof t != "object") - throw new sr("options must be an object", sr.ERR_BAD_OPTION_VALUE); + throw new or("options must be an object", or.ERR_BAD_OPTION_VALUE); const n = Object.keys(t); let i = n.length; for (; i-- > 0; ) { @@ -30385,22 +30385,22 @@ function qX(t, e, r) { if (o) { const a = t[s], u = a === void 0 || o(a, s, t); if (u !== !0) - throw new sr("option " + s + " must be " + u, sr.ERR_BAD_OPTION_VALUE); + throw new or("option " + s + " must be " + u, or.ERR_BAD_OPTION_VALUE); continue; } if (r !== !0) - throw new sr("Unknown option " + s, sr.ERR_BAD_OPTION); + throw new or("Unknown option " + s, or.ERR_BAD_OPTION); } } -const $d = { - assertOptions: qX, - validators: pp -}, $s = $d.validators; -let oc = class { +const Bd = { + assertOptions: ZX, + validators: gp +}, Bs = Bd.validators; +let cc = class { constructor(e) { this.defaults = e, this.interceptors = { - request: new L_(), - response: new L_() + request: new $6(), + response: new $6() }; } /** @@ -30429,20 +30429,20 @@ let oc = class { } } _request(e, r) { - typeof e == "string" ? (r = r || {}, r.url = e) : r = e || {}, r = pc(this.defaults, r); + typeof e == "string" ? (r = r || {}, r.url = e) : r = e || {}, r = mc(this.defaults, r); const { transitional: n, paramsSerializer: i, headers: s } = r; - n !== void 0 && $d.assertOptions(n, { - silentJSONParsing: $s.transitional($s.boolean), - forcedJSONParsing: $s.transitional($s.boolean), - clarifyTimeoutError: $s.transitional($s.boolean) + n !== void 0 && Bd.assertOptions(n, { + silentJSONParsing: Bs.transitional(Bs.boolean), + forcedJSONParsing: Bs.transitional(Bs.boolean), + clarifyTimeoutError: Bs.transitional(Bs.boolean) }, !1), i != null && (Oe.isFunction(i) ? r.paramsSerializer = { serialize: i - } : $d.assertOptions(i, { - encode: $s.function, - serialize: $s.function - }, !0)), $d.assertOptions(r, { - baseUrl: $s.spelling("baseURL"), - withXsrfToken: $s.spelling("withXSRFToken") + } : Bd.assertOptions(i, { + encode: Bs.function, + serialize: Bs.function + }, !0)), Bd.assertOptions(r, { + baseUrl: Bs.spelling("baseURL"), + withXsrfToken: Bs.spelling("withXSRFToken") }, !0), r.method = (r.method || this.defaults.method || "get").toLowerCase(); let o = s && Oe.merge( s.common, @@ -30450,8 +30450,8 @@ let oc = class { ); s && Oe.forEach( ["delete", "get", "head", "post", "put", "patch", "common"], - (M) => { - delete s[M]; + (P) => { + delete s[P]; } ), r.headers = yi.concat(o, s); const a = []; @@ -30463,42 +30463,42 @@ let oc = class { this.interceptors.response.forEach(function(N) { l.push(N.fulfilled, N.rejected); }); - let d, g = 0, w; + let d, p = 0, w; if (!u) { - const M = [z_.bind(this), void 0]; - for (M.unshift.apply(M, a), M.push.apply(M, l), w = M.length, d = Promise.resolve(r); g < w; ) - d = d.then(M[g++], M[g++]); + const P = [H6.bind(this), void 0]; + for (P.unshift.apply(P, a), P.push.apply(P, l), w = P.length, d = Promise.resolve(r); p < w; ) + d = d.then(P[p++], P[p++]); return d; } w = a.length; let A = r; - for (g = 0; g < w; ) { - const M = a[g++], N = a[g++]; + for (p = 0; p < w; ) { + const P = a[p++], N = a[p++]; try { - A = M(A); + A = P(A); } catch (L) { N.call(this, L); break; } } try { - d = z_.call(this, A); - } catch (M) { - return Promise.reject(M); + d = H6.call(this, A); + } catch (P) { + return Promise.reject(P); } - for (g = 0, w = l.length; g < w; ) - d = d.then(l[g++], l[g++]); + for (p = 0, w = l.length; p < w; ) + d = d.then(l[p++], l[p++]); return d; } getUri(e) { - e = pc(this.defaults, e); - const r = DS(e.baseURL, e.url); - return MS(r, e.params, e.paramsSerializer); + e = mc(this.defaults, e); + const r = NS(e.baseURL, e.url); + return CS(r, e.params, e.paramsSerializer); } }; Oe.forEach(["delete", "get", "head", "options"], function(e) { - oc.prototype[e] = function(r, n) { - return this.request(pc(n || {}, { + cc.prototype[e] = function(r, n) { + return this.request(mc(n || {}, { method: e, url: r, data: (n || {}).data @@ -30508,7 +30508,7 @@ Oe.forEach(["delete", "get", "head", "options"], function(e) { Oe.forEach(["post", "put", "patch"], function(e) { function r(n) { return function(s, o, a) { - return this.request(pc(a || {}, { + return this.request(mc(a || {}, { method: e, headers: n ? { "Content-Type": "multipart/form-data" @@ -30518,9 +30518,9 @@ Oe.forEach(["post", "put", "patch"], function(e) { })); }; } - oc.prototype[e] = r(), oc.prototype[e + "Form"] = r(!0); + cc.prototype[e] = r(), cc.prototype[e + "Form"] = r(!0); }); -let zX = class FS { +let QX = class jS { constructor(e) { if (typeof e != "function") throw new TypeError("executor must be a function."); @@ -30586,19 +30586,19 @@ let zX = class FS { static source() { let e; return { - token: new FS(function(i) { + token: new jS(function(i) { e = i; }), cancel: e }; } }; -function HX(t) { +function eZ(t) { return function(r) { return t.apply(null, r); }; } -function WX(t) { +function tZ(t) { return Oe.isObject(t) && t.isAxiosError === !0; } const Y1 = { @@ -30669,60 +30669,60 @@ const Y1 = { Object.entries(Y1).forEach(([t, e]) => { Y1[e] = t; }); -function BS(t) { - const e = new oc(t), r = gS(oc.prototype.request, e); - return Oe.extend(r, oc.prototype, e, { allOwnKeys: !0 }), Oe.extend(r, e, null, { allOwnKeys: !0 }), r.create = function(i) { - return BS(pc(t, i)); +function US(t) { + const e = new cc(t), r = vS(cc.prototype.request, e); + return Oe.extend(r, cc.prototype, e, { allOwnKeys: !0 }), Oe.extend(r, e, null, { allOwnKeys: !0 }), r.create = function(i) { + return US(mc(t, i)); }, r; } -const mn = BS(sh); -mn.Axios = oc; +const mn = US(oh); +mn.Axios = cc; mn.CanceledError = Hu; -mn.CancelToken = zX; -mn.isCancel = TS; -mn.VERSION = $S; -mn.toFormData = hp; -mn.AxiosError = sr; +mn.CancelToken = QX; +mn.isCancel = DS; +mn.VERSION = FS; +mn.toFormData = dp; +mn.AxiosError = or; mn.Cancel = mn.CanceledError; mn.all = function(e) { return Promise.all(e); }; -mn.spread = HX; -mn.isAxiosError = WX; -mn.mergeConfig = pc; +mn.spread = eZ; +mn.isAxiosError = tZ; +mn.mergeConfig = mc; mn.AxiosHeaders = yi; -mn.formToJSON = (t) => CS(Oe.isHTMLForm(t) ? new FormData(t) : t); -mn.getAdapter = kS.getAdapter; +mn.formToJSON = (t) => RS(Oe.isHTMLForm(t) ? new FormData(t) : t); +mn.getAdapter = BS.getAdapter; mn.HttpStatusCode = Y1; mn.default = mn; const { - Axios: Xse, - AxiosError: KX, - CanceledError: Zse, - isCancel: Qse, - CancelToken: eoe, - VERSION: toe, - all: roe, - Cancel: noe, - isAxiosError: ioe, - spread: soe, - toFormData: ooe, - AxiosHeaders: aoe, - HttpStatusCode: coe, - formToJSON: uoe, - getAdapter: foe, - mergeConfig: loe -} = mn, US = mn.create({ + Axios: eoe, + AxiosError: rZ, + CanceledError: toe, + isCancel: roe, + CancelToken: noe, + VERSION: ioe, + all: soe, + Cancel: ooe, + isAxiosError: aoe, + spread: coe, + toFormData: uoe, + AxiosHeaders: foe, + HttpStatusCode: loe, + formToJSON: hoe, + getAdapter: doe, + mergeConfig: poe +} = mn, qS = mn.create({ timeout: 6e4, headers: { "Content-Type": "application/json", token: localStorage.getItem("auth") } }); -function VX(t) { +function nZ(t) { var e, r, n; if (((e = t.data) == null ? void 0 : e.success) !== !0) { - const i = new KX( + const i = new rZ( (r = t.data) == null ? void 0 : r.errorMessage, (n = t.data) == null ? void 0 : n.errorCode, t.config, @@ -30733,12 +30733,12 @@ function VX(t) { } else return t; } -US.interceptors.response.use( - VX +qS.interceptors.response.use( + nZ ); -class GX { +class iZ { constructor(e) { - Rs(this, "_apiBase", ""); + Ds(this, "_apiBase", ""); this.request = e; } setApiBase(e) { @@ -30771,7 +30771,7 @@ class GX { return (await this.request.post("/api/v2/user/account/bind", e)).data; } } -const ya = new GX(US), YX = { +const qo = new iZ(qS), sZ = { projectId: "7a4434fefbcc9af474fb5c995e47d286", metadata: { name: "codatta", @@ -30779,10 +30779,10 @@ const ya = new GX(US), YX = { url: "https://codatta.io/", icons: ["https://avatars.githubusercontent.com/u/171659315"] } -}, JX = gJ({ +}, oZ = AJ({ appName: "codatta", appLogoUrl: "https://avatars.githubusercontent.com/u/171659315" -}), jS = Sa({ +}), zS = Ma({ saveLastUsedWallet: () => { }, lastUsedWallet: null, @@ -30790,52 +30790,52 @@ const ya = new GX(US), YX = { initialized: !1, featuredWallets: [] }); -function gp() { - return Tn(jS); +function mp() { + return Tn(zS); } -function hoe(t) { - const { apiBaseUrl: e } = t, [r, n] = fr([]), [i, s] = fr([]), [o, a] = fr(null), [u, l] = fr(!1), d = (A) => { +function goe(t) { + const { apiBaseUrl: e } = t, [r, n] = Gt([]), [i, s] = Gt([]), [o, a] = Gt(null), [u, l] = Gt(!1), d = (A) => { console.log("saveLastUsedWallet", A); }; - function g(A) { - const M = A.filter(($) => $.featured || $.installed), N = A.filter(($) => !$.featured && !$.installed), L = [...M, ...N]; - n(L), s(M); + function p(A) { + const P = A.filter(($) => $.featured || $.installed), N = A.filter(($) => !$.featured && !$.installed), L = [...P, ...N]; + n(L), s(P); } async function w() { - const A = [], M = /* @__PURE__ */ new Map(); - RR.forEach((L) => { - const $ = new ml(L); + const A = [], P = /* @__PURE__ */ new Map(); + UR.forEach((L) => { + const $ = new vl(L); L.name === "Coinbase Wallet" && $.EIP6963Detected({ info: { name: "Coinbase Wallet", uuid: "coinbase", icon: L.image, rdns: "coinbase" }, - provider: JX.getProvider() - }), M.set($.key, $), A.push($); - }), (await TG()).forEach((L) => { - const $ = M.get(L.info.name); + provider: oZ.getProvider() + }), P.set($.key, $), A.push($); + }), (await jG()).forEach((L) => { + const $ = P.get(L.info.name); if ($) $.EIP6963Detected(L); else { - const F = new ml(L); - M.set(F.key, F), A.push(F); + const B = new vl(L); + P.set(B.key, B), A.push(B); } }); try { - const L = JSON.parse(localStorage.getItem("xn-last-used-info") || "{}"), $ = M.get(L.key); + const L = JSON.parse(localStorage.getItem("xn-last-used-info") || "{}"), $ = P.get(L.key); if ($) { if ($.lastUsed = !0, L.provider === "UniversalProvider") { - const F = await EE.init(YX); - F.session && $.setUniversalProvider(F); + const B = await AE.init(sZ); + B.session && $.setUniversalProvider(B); } a($); } } catch (L) { console.log(L); } - g(A), l(!0); + p(A), l(!0); } - return Xn(() => { - w(), ya.setApiBase(e); - }, []), /* @__PURE__ */ me.jsx( - jS.Provider, + return Dn(() => { + w(), qo.setApiBase(e); + }, []), /* @__PURE__ */ fe.jsx( + zS.Provider, { value: { saveLastUsedWallet: d, @@ -30854,14 +30854,14 @@ function hoe(t) { * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const XX = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), qS = (...t) => t.filter((e, r, n) => !!e && e.trim() !== "" && n.indexOf(e) === r).join(" ").trim(); +const aZ = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), WS = (...t) => t.filter((e, r, n) => !!e && e.trim() !== "" && n.indexOf(e) === r).join(" ").trim(); /** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -var ZX = { +var cZ = { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, @@ -30878,7 +30878,7 @@ var ZX = { * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const QX = gv( +const uZ = gv( ({ color: t = "currentColor", size: e = 24, @@ -30888,20 +30888,20 @@ const QX = gv( children: s, iconNode: o, ...a - }, u) => jd( + }, u) => qd( "svg", { ref: u, - ...ZX, + ...cZ, width: e, height: e, stroke: t, strokeWidth: n ? Number(r) * 24 / Number(e) : r, - className: qS("lucide", i), + className: WS("lucide", i), ...a }, [ - ...o.map(([l, d]) => jd(l, d)), + ...o.map(([l, d]) => qd(l, d)), ...Array.isArray(s) ? s : [s] ] ) @@ -30912,12 +30912,12 @@ const QX = gv( * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const Ps = (t, e) => { +const Ms = (t, e) => { const r = gv( - ({ className: n, ...i }, s) => jd(QX, { + ({ className: n, ...i }, s) => qd(uZ, { ref: s, iconNode: e, - className: qS(`lucide-${XX(t)}`, n), + className: WS(`lucide-${aZ(t)}`, n), ...i }) ); @@ -30929,7 +30929,7 @@ const Ps = (t, e) => { * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const eZ = Ps("ArrowLeft", [ +const fZ = Ms("ArrowLeft", [ ["path", { d: "m12 19-7-7 7-7", key: "1l729n" }], ["path", { d: "M19 12H5", key: "x3x0zl" }] ]); @@ -30939,7 +30939,7 @@ const eZ = Ps("ArrowLeft", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const zS = Ps("ArrowRight", [ +const HS = Ms("ArrowRight", [ ["path", { d: "M5 12h14", key: "1ays0h" }], ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }] ]); @@ -30949,7 +30949,7 @@ const zS = Ps("ArrowRight", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const tZ = Ps("ChevronRight", [ +const lZ = Ms("ChevronRight", [ ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }] ]); /** @@ -30958,7 +30958,7 @@ const tZ = Ps("ChevronRight", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const rZ = Ps("CircleCheckBig", [ +const hZ = Ms("CircleCheckBig", [ ["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }], ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }] ]); @@ -30968,7 +30968,7 @@ const rZ = Ps("CircleCheckBig", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const nZ = Ps("Download", [ +const dZ = Ms("Download", [ ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }], ["polyline", { points: "7 10 12 15 17 10", key: "2ggqvy" }], ["line", { x1: "12", x2: "12", y1: "15", y2: "3", key: "1vk2je" }] @@ -30979,7 +30979,7 @@ const nZ = Ps("Download", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const iZ = Ps("Globe", [ +const pZ = Ms("Globe", [ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }], ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }], ["path", { d: "M2 12h20", key: "9i4pu4" }] @@ -30990,7 +30990,7 @@ const iZ = Ps("Globe", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const HS = Ps("Laptop", [ +const KS = Ms("Laptop", [ [ "path", { @@ -31005,7 +31005,7 @@ const HS = Ps("Laptop", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const sZ = Ps("Link2", [ +const gZ = Ms("Link2", [ ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }], ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }], ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }] @@ -31016,7 +31016,7 @@ const sZ = Ps("Link2", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const gc = Ps("LoaderCircle", [ +const _a = Ms("LoaderCircle", [ ["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }] ]); /** @@ -31025,7 +31025,7 @@ const gc = Ps("LoaderCircle", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const oZ = Ps("Mail", [ +const VS = Ms("Mail", [ ["rect", { width: "20", height: "16", x: "2", y: "4", rx: "2", key: "18n3k1" }], ["path", { d: "m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7", key: "1ocrg3" }] ]); @@ -31035,17 +31035,17 @@ const oZ = Ps("Mail", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const WS = Ps("Search", [ +const GS = Ms("Search", [ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }], ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }] -]), W_ = /* @__PURE__ */ new Set(); -function mp(t, e, r) { - t || W_.has(e) || (console.warn(e), W_.add(e)); +]), V6 = /* @__PURE__ */ new Set(); +function vp(t, e, r) { + t || V6.has(e) || (console.warn(e), V6.add(e)); } -function aZ(t) { +function mZ(t) { if (typeof Proxy > "u") return t; - const e = /* @__PURE__ */ new Map(), r = (...n) => (process.env.NODE_ENV !== "production" && mp(!1, "motion() is deprecated. Use motion.create() instead."), t(...n)); + const e = /* @__PURE__ */ new Map(), r = (...n) => (process.env.NODE_ENV !== "production" && vp(!1, "motion() is deprecated. Use motion.create() instead."), t(...n)); return new Proxy(r, { /** * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc. @@ -31055,11 +31055,11 @@ function aZ(t) { get: (n, i) => i === "create" ? t : (e.has(i) || e.set(i, t(i)), e.get(i)) }); } -function vp(t) { +function bp(t) { return t !== null && typeof t == "object" && typeof t.start == "function"; } const J1 = (t) => Array.isArray(t); -function KS(t, e) { +function YS(t, e) { if (!Array.isArray(e)) return !1; const r = e.length; @@ -31070,10 +31070,10 @@ function KS(t, e) { return !1; return !0; } -function Ml(t) { +function Il(t) { return typeof t == "string" || Array.isArray(t); } -function K_(t) { +function G6(t) { const e = [{}, {}]; return t == null || t.values.forEach((r, n) => { e[0][n] = r.get(), e[1][n] = r.getVelocity(); @@ -31081,16 +31081,16 @@ function K_(t) { } function Mb(t, e, r, n) { if (typeof e == "function") { - const [i, s] = K_(n); + const [i, s] = G6(n); e = e(r !== void 0 ? r : t.custom, i, s); } if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") { - const [i, s] = K_(n); + const [i, s] = G6(n); e = e(r !== void 0 ? r : t.custom, i, s); } return e; } -function bp(t, e, r) { +function yp(t, e, r) { const n = t.getProps(); return Mb(n, e, r !== void 0 ? r : n.custom, t); } @@ -31102,7 +31102,7 @@ const Ib = [ "whileTap", "whileDrag", "exit" -], Cb = ["initial", ...Ib], oh = [ +], Cb = ["initial", ...Ib], ah = [ "transformPerspective", "x", "y", @@ -31120,36 +31120,36 @@ const Ib = [ "skew", "skewX", "skewY" -], Sc = new Set(oh), Ks = (t) => t * 1e3, Co = (t) => t / 1e3, cZ = { +], Ac = new Set(ah), Vs = (t) => t * 1e3, Do = (t) => t / 1e3, vZ = { type: "spring", stiffness: 500, damping: 25, restSpeed: 10 -}, uZ = (t) => ({ +}, bZ = (t) => ({ type: "spring", stiffness: 550, damping: t === 0 ? 2 * Math.sqrt(550) : 30, restSpeed: 10 -}), fZ = { +}), yZ = { type: "keyframes", duration: 0.8 -}, lZ = { +}, wZ = { type: "keyframes", ease: [0.25, 0.1, 0.35, 1], duration: 0.3 -}, hZ = (t, { keyframes: e }) => e.length > 2 ? fZ : Sc.has(t) ? t.startsWith("scale") ? uZ(e[1]) : cZ : lZ; +}, xZ = (t, { keyframes: e }) => e.length > 2 ? yZ : Ac.has(t) ? t.startsWith("scale") ? bZ(e[1]) : vZ : wZ; function Tb(t, e) { return t ? t[e] || t.default || t : void 0; } -const dZ = { +const _Z = { useManualTiming: !1 -}, pZ = (t) => t !== null; -function yp(t, { repeat: e, repeatType: r = "loop" }, n) { - const i = t.filter(pZ), s = e && r !== "loop" && e % 2 === 1 ? 0 : i.length - 1; +}, EZ = (t) => t !== null; +function wp(t, { repeat: e, repeatType: r = "loop" }, n) { + const i = t.filter(EZ), s = e && r !== "loop" && e % 2 === 1 ? 0 : i.length - 1; return !s || n === void 0 ? i[s] : n; } const Un = (t) => t; -function gZ(t) { +function SZ(t) { let e = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), n = !1, i = !1; const s = /* @__PURE__ */ new WeakSet(); let o = { @@ -31164,8 +31164,8 @@ function gZ(t) { /** * Schedule a process to run on the next frame. */ - schedule: (l, d = !1, g = !1) => { - const A = g && n ? e : r; + schedule: (l, d = !1, p = !1) => { + const A = p && n ? e : r; return d && s.add(l), A.has(l) || A.add(l), l; }, /** @@ -31187,7 +31187,7 @@ function gZ(t) { }; return u; } -const pd = [ +const gd = [ "read", // Read "resolveKeyframes", @@ -31200,95 +31200,95 @@ const pd = [ // Write "postRender" // Compute -], mZ = 40; -function VS(t, e) { +], AZ = 40; +function JS(t, e) { let r = !1, n = !0; const i = { delta: 0, timestamp: 0, isProcessing: !1 - }, s = () => r = !0, o = pd.reduce(($, F) => ($[F] = gZ(s), $), {}), { read: a, resolveKeyframes: u, update: l, preRender: d, render: g, postRender: w } = o, A = () => { + }, s = () => r = !0, o = gd.reduce(($, B) => ($[B] = SZ(s), $), {}), { read: a, resolveKeyframes: u, update: l, preRender: d, render: p, postRender: w } = o, A = () => { const $ = performance.now(); - r = !1, i.delta = n ? 1e3 / 60 : Math.max(Math.min($ - i.timestamp, mZ), 1), i.timestamp = $, i.isProcessing = !0, a.process(i), u.process(i), l.process(i), d.process(i), g.process(i), w.process(i), i.isProcessing = !1, r && e && (n = !1, t(A)); - }, M = () => { + r = !1, i.delta = n ? 1e3 / 60 : Math.max(Math.min($ - i.timestamp, AZ), 1), i.timestamp = $, i.isProcessing = !0, a.process(i), u.process(i), l.process(i), d.process(i), p.process(i), w.process(i), i.isProcessing = !1, r && e && (n = !1, t(A)); + }, P = () => { r = !0, n = !0, i.isProcessing || t(A); }; - return { schedule: pd.reduce(($, F) => { - const K = o[F]; - return $[F] = (H, V = !1, te = !1) => (r || M(), K.schedule(H, V, te)), $; + return { schedule: gd.reduce(($, B) => { + const H = o[B]; + return $[B] = (W, V = !1, te = !1) => (r || P(), H.schedule(W, V, te)), $; }, {}), cancel: ($) => { - for (let F = 0; F < pd.length; F++) - o[pd[F]].cancel($); + for (let B = 0; B < gd.length; B++) + o[gd[B]].cancel($); }, state: i, steps: o }; } -const { schedule: Lr, cancel: wa, state: Fn, steps: Dm } = VS(typeof requestAnimationFrame < "u" ? requestAnimationFrame : Un, !0), GS = (t, e, r) => (((1 - 3 * r + 3 * e) * t + (3 * r - 6 * e)) * t + 3 * e) * t, vZ = 1e-7, bZ = 12; -function yZ(t, e, r, n, i) { +const { schedule: Lr, cancel: Ea, state: Fn, steps: Dm } = JS(typeof requestAnimationFrame < "u" ? requestAnimationFrame : Un, !0), XS = (t, e, r) => (((1 - 3 * r + 3 * e) * t + (3 * r - 6 * e)) * t + 3 * e) * t, PZ = 1e-7, MZ = 12; +function IZ(t, e, r, n, i) { let s, o, a = 0; do - o = e + (r - e) / 2, s = GS(o, n, i) - t, s > 0 ? r = o : e = o; - while (Math.abs(s) > vZ && ++a < bZ); + o = e + (r - e) / 2, s = XS(o, n, i) - t, s > 0 ? r = o : e = o; + while (Math.abs(s) > PZ && ++a < MZ); return o; } -function ah(t, e, r, n) { +function ch(t, e, r, n) { if (t === e && r === n) return Un; - const i = (s) => yZ(s, 0, 1, t, r); - return (s) => s === 0 || s === 1 ? s : GS(i(s), e, n); + const i = (s) => IZ(s, 0, 1, t, r); + return (s) => s === 0 || s === 1 ? s : XS(i(s), e, n); } -const YS = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, JS = (t) => (e) => 1 - t(1 - e), XS = /* @__PURE__ */ ah(0.33, 1.53, 0.69, 0.99), Rb = /* @__PURE__ */ JS(XS), ZS = /* @__PURE__ */ YS(Rb), QS = (t) => (t *= 2) < 1 ? 0.5 * Rb(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Db = (t) => 1 - Math.sin(Math.acos(t)), e7 = JS(Db), t7 = YS(Db), r7 = (t) => /^0[^.\s]+$/u.test(t); -function wZ(t) { - return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || r7(t) : !0; +const ZS = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, QS = (t) => (e) => 1 - t(1 - e), e7 = /* @__PURE__ */ ch(0.33, 1.53, 0.69, 0.99), Rb = /* @__PURE__ */ QS(e7), t7 = /* @__PURE__ */ ZS(Rb), r7 = (t) => (t *= 2) < 1 ? 0.5 * Rb(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Db = (t) => 1 - Math.sin(Math.acos(t)), n7 = QS(Db), i7 = ZS(Db), s7 = (t) => /^0[^.\s]+$/u.test(t); +function CZ(t) { + return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || s7(t) : !0; } -let Wu = Un, Uo = Un; -process.env.NODE_ENV !== "production" && (Wu = (t, e) => { +let Ku = Un, zo = Un; +process.env.NODE_ENV !== "production" && (Ku = (t, e) => { !t && typeof console < "u" && console.warn(e); -}, Uo = (t, e) => { +}, zo = (t, e) => { if (!t) throw new Error(e); }); -const n7 = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), i7 = (t) => (e) => typeof e == "string" && e.startsWith(t), s7 = /* @__PURE__ */ i7("--"), xZ = /* @__PURE__ */ i7("var(--"), Ob = (t) => xZ(t) ? _Z.test(t.split("/*")[0].trim()) : !1, _Z = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, EZ = ( +const o7 = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), a7 = (t) => (e) => typeof e == "string" && e.startsWith(t), c7 = /* @__PURE__ */ a7("--"), TZ = /* @__PURE__ */ a7("var(--"), Ob = (t) => TZ(t) ? RZ.test(t.split("/*")[0].trim()) : !1, RZ = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, DZ = ( // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u ); -function SZ(t) { - const e = EZ.exec(t); +function OZ(t) { + const e = DZ.exec(t); if (!e) return [,]; const [, r, n, i] = e; return [`--${r ?? n}`, i]; } -const AZ = 4; -function o7(t, e, r = 1) { - Uo(r <= AZ, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`); - const [n, i] = SZ(t); +const NZ = 4; +function u7(t, e, r = 1) { + zo(r <= NZ, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`); + const [n, i] = OZ(t); if (!n) return; const s = window.getComputedStyle(e).getPropertyValue(n); if (s) { const o = s.trim(); - return n7(o) ? parseFloat(o) : o; + return o7(o) ? parseFloat(o) : o; } - return Ob(i) ? o7(i, e, r + 1) : i; + return Ob(i) ? u7(i, e, r + 1) : i; } -const xa = (t, e, r) => r > e ? e : r < t ? t : r, Ku = { +const Sa = (t, e, r) => r > e ? e : r < t ? t : r, Vu = { test: (t) => typeof t == "number", parse: parseFloat, transform: (t) => t -}, Il = { - ...Ku, - transform: (t) => xa(0, 1, t) -}, gd = { - ...Ku, +}, Cl = { + ...Vu, + transform: (t) => Sa(0, 1, t) +}, md = { + ...Vu, default: 1 -}, ch = (t) => ({ +}, uh = (t) => ({ test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1, parse: parseFloat, transform: (e) => `${e}${t}` -}), sa = /* @__PURE__ */ ch("deg"), Vs = /* @__PURE__ */ ch("%"), Vt = /* @__PURE__ */ ch("px"), PZ = /* @__PURE__ */ ch("vh"), MZ = /* @__PURE__ */ ch("vw"), V_ = { - ...Vs, - parse: (t) => Vs.parse(t) / 100, - transform: (t) => Vs.transform(t * 100) -}, IZ = /* @__PURE__ */ new Set([ +}), ca = /* @__PURE__ */ uh("deg"), Gs = /* @__PURE__ */ uh("%"), Vt = /* @__PURE__ */ uh("px"), LZ = /* @__PURE__ */ uh("vh"), kZ = /* @__PURE__ */ uh("vw"), Y6 = { + ...Gs, + parse: (t) => Gs.parse(t) / 100, + transform: (t) => Gs.transform(t * 100) +}, $Z = /* @__PURE__ */ new Set([ "width", "height", "top", @@ -31299,25 +31299,25 @@ const xa = (t, e, r) => r > e ? e : r < t ? t : r, Ku = { "y", "translateX", "translateY" -]), G_ = (t) => t === Ku || t === Vt, Y_ = (t, e) => parseFloat(t.split(", ")[e]), J_ = (t, e) => (r, { transform: n }) => { +]), J6 = (t) => t === Vu || t === Vt, X6 = (t, e) => parseFloat(t.split(", ")[e]), Z6 = (t, e) => (r, { transform: n }) => { if (n === "none" || !n) return 0; const i = n.match(/^matrix3d\((.+)\)$/u); if (i) - return Y_(i[1], e); + return X6(i[1], e); { const s = n.match(/^matrix\((.+)\)$/u); - return s ? Y_(s[1], t) : 0; + return s ? X6(s[1], t) : 0; } -}, CZ = /* @__PURE__ */ new Set(["x", "y", "z"]), TZ = oh.filter((t) => !CZ.has(t)); -function RZ(t) { +}, BZ = /* @__PURE__ */ new Set(["x", "y", "z"]), FZ = ah.filter((t) => !BZ.has(t)); +function jZ(t) { const e = []; - return TZ.forEach((r) => { + return FZ.forEach((r) => { const n = t.getValue(r); n !== void 0 && (e.push([r, n.get()]), n.set(r.startsWith("scale") ? 1 : 0)); }), e; } -const Pu = { +const Mu = { // Dimensions width: ({ x: t }, { paddingLeft: e = "0", paddingRight: r = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(r), height: ({ y: t }, { paddingTop: e = "0", paddingBottom: r = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(r), @@ -31326,21 +31326,21 @@ const Pu = { bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min), right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min), // Transform - x: J_(4, 13), - y: J_(5, 14) + x: Z6(4, 13), + y: Z6(5, 14) }; -Pu.translateX = Pu.x; -Pu.translateY = Pu.y; -const a7 = (t) => (e) => e.test(t), DZ = { +Mu.translateX = Mu.x; +Mu.translateY = Mu.y; +const f7 = (t) => (e) => e.test(t), UZ = { test: (t) => t === "auto", parse: (t) => t -}, c7 = [Ku, Vt, Vs, sa, MZ, PZ, DZ], X_ = (t) => c7.find(a7(t)), ac = /* @__PURE__ */ new Set(); +}, l7 = [Vu, Vt, Gs, ca, kZ, LZ, UZ], Q6 = (t) => l7.find(f7(t)), uc = /* @__PURE__ */ new Set(); let X1 = !1, Z1 = !1; -function u7() { +function h7() { if (Z1) { - const t = Array.from(ac).filter((n) => n.needsMeasurement), e = new Set(t.map((n) => n.element)), r = /* @__PURE__ */ new Map(); + const t = Array.from(uc).filter((n) => n.needsMeasurement), e = new Set(t.map((n) => n.element)), r = /* @__PURE__ */ new Map(); e.forEach((n) => { - const i = RZ(n); + const i = jZ(n); i.length && (r.set(n, i), n.render()); }), t.forEach((n) => n.measureInitialState()), e.forEach((n) => { n.render(); @@ -31353,22 +31353,22 @@ function u7() { n.suspendedScrollY !== void 0 && window.scrollTo(0, n.suspendedScrollY); }); } - Z1 = !1, X1 = !1, ac.forEach((t) => t.complete()), ac.clear(); + Z1 = !1, X1 = !1, uc.forEach((t) => t.complete()), uc.clear(); } -function f7() { - ac.forEach((t) => { +function d7() { + uc.forEach((t) => { t.readKeyframes(), t.needsMeasurement && (Z1 = !0); }); } -function OZ() { - f7(), u7(); +function qZ() { + d7(), h7(); } class Nb { constructor(e, r, n, i, s, o = !1) { this.isComplete = !1, this.isAsync = !1, this.needsMeasurement = !1, this.isScheduled = !1, this.unresolvedKeyframes = [...e], this.onComplete = r, this.name = n, this.motionValue = i, this.element = s, this.isAsync = o; } scheduleResolve() { - this.isScheduled = !0, this.isAsync ? (ac.add(this), X1 || (X1 = !0, Lr.read(f7), Lr.resolveKeyframes(u7))) : (this.readKeyframes(), this.complete()); + this.isScheduled = !0, this.isAsync ? (uc.add(this), X1 || (X1 = !0, Lr.read(d7), Lr.resolveKeyframes(h7))) : (this.readKeyframes(), this.complete()); } readKeyframes() { const { unresolvedKeyframes: e, name: r, element: n, motionValue: i } = this; @@ -31395,20 +31395,20 @@ class Nb { measureEndState() { } complete() { - this.isComplete = !0, this.onComplete(this.unresolvedKeyframes, this.finalKeyframe), ac.delete(this); + this.isComplete = !0, this.onComplete(this.unresolvedKeyframes, this.finalKeyframe), uc.delete(this); } cancel() { - this.isComplete || (this.isScheduled = !1, ac.delete(this)); + this.isComplete || (this.isScheduled = !1, uc.delete(this)); } resume() { this.isComplete || this.scheduleResolve(); } } -const Gf = (t) => Math.round(t * 1e5) / 1e5, Lb = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; -function NZ(t) { +const Yf = (t) => Math.round(t * 1e5) / 1e5, Lb = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; +function zZ(t) { return t == null; } -const LZ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, kb = (t, e) => (r) => !!(typeof r == "string" && LZ.test(r) && r.startsWith(t) || e && !NZ(r) && Object.prototype.hasOwnProperty.call(r, e)), l7 = (t, e, r) => (n) => { +const WZ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, kb = (t, e) => (r) => !!(typeof r == "string" && WZ.test(r) && r.startsWith(t) || e && !zZ(r) && Object.prototype.hasOwnProperty.call(r, e)), p7 = (t, e, r) => (n) => { if (typeof n != "string") return n; const [i, s, o, a] = n.match(Lb); @@ -31418,15 +31418,15 @@ const LZ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s [r]: parseFloat(o), alpha: a !== void 0 ? parseFloat(a) : 1 }; -}, kZ = (t) => xa(0, 255, t), Om = { - ...Ku, - transform: (t) => Math.round(kZ(t)) -}, ic = { +}, HZ = (t) => Sa(0, 255, t), Om = { + ...Vu, + transform: (t) => Math.round(HZ(t)) +}, oc = { test: /* @__PURE__ */ kb("rgb", "red"), - parse: /* @__PURE__ */ l7("red", "green", "blue"), - transform: ({ red: t, green: e, blue: r, alpha: n = 1 }) => "rgba(" + Om.transform(t) + ", " + Om.transform(e) + ", " + Om.transform(r) + ", " + Gf(Il.transform(n)) + ")" + parse: /* @__PURE__ */ p7("red", "green", "blue"), + transform: ({ red: t, green: e, blue: r, alpha: n = 1 }) => "rgba(" + Om.transform(t) + ", " + Om.transform(e) + ", " + Om.transform(r) + ", " + Yf(Cl.transform(n)) + ")" }; -function $Z(t) { +function KZ(t) { let e = "", r = "", n = "", i = ""; return t.length > 5 ? (e = t.substring(1, 3), r = t.substring(3, 5), n = t.substring(5, 7), i = t.substring(7, 9)) : (e = t.substring(1, 2), r = t.substring(2, 3), n = t.substring(3, 4), i = t.substring(4, 5), e += e, r += r, n += n, i += i), { red: parseInt(e, 16), @@ -31437,59 +31437,59 @@ function $Z(t) { } const Q1 = { test: /* @__PURE__ */ kb("#"), - parse: $Z, - transform: ic.transform -}, Qc = { + parse: KZ, + transform: oc.transform +}, eu = { test: /* @__PURE__ */ kb("hsl", "hue"), - parse: /* @__PURE__ */ l7("hue", "saturation", "lightness"), - transform: ({ hue: t, saturation: e, lightness: r, alpha: n = 1 }) => "hsla(" + Math.round(t) + ", " + Vs.transform(Gf(e)) + ", " + Vs.transform(Gf(r)) + ", " + Gf(Il.transform(n)) + ")" -}, Gn = { - test: (t) => ic.test(t) || Q1.test(t) || Qc.test(t), - parse: (t) => ic.test(t) ? ic.parse(t) : Qc.test(t) ? Qc.parse(t) : Q1.parse(t), - transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? ic.transform(t) : Qc.transform(t) -}, FZ = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu; -function BZ(t) { + parse: /* @__PURE__ */ p7("hue", "saturation", "lightness"), + transform: ({ hue: t, saturation: e, lightness: r, alpha: n = 1 }) => "hsla(" + Math.round(t) + ", " + Gs.transform(Yf(e)) + ", " + Gs.transform(Yf(r)) + ", " + Yf(Cl.transform(n)) + ")" +}, Yn = { + test: (t) => oc.test(t) || Q1.test(t) || eu.test(t), + parse: (t) => oc.test(t) ? oc.parse(t) : eu.test(t) ? eu.parse(t) : Q1.parse(t), + transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? oc.transform(t) : eu.transform(t) +}, VZ = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu; +function GZ(t) { var e, r; - return isNaN(t) && typeof t == "string" && (((e = t.match(Lb)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match(FZ)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; + return isNaN(t) && typeof t == "string" && (((e = t.match(Lb)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match(VZ)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; } -const h7 = "number", d7 = "color", UZ = "var", jZ = "var(", Z_ = "${}", qZ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; -function Cl(t) { +const g7 = "number", m7 = "color", YZ = "var", JZ = "var(", e_ = "${}", XZ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; +function Tl(t) { const e = t.toString(), r = [], n = { color: [], number: [], var: [] }, i = []; let s = 0; - const a = e.replace(qZ, (u) => (Gn.test(u) ? (n.color.push(s), i.push(d7), r.push(Gn.parse(u))) : u.startsWith(jZ) ? (n.var.push(s), i.push(UZ), r.push(u)) : (n.number.push(s), i.push(h7), r.push(parseFloat(u))), ++s, Z_)).split(Z_); + const a = e.replace(XZ, (u) => (Yn.test(u) ? (n.color.push(s), i.push(m7), r.push(Yn.parse(u))) : u.startsWith(JZ) ? (n.var.push(s), i.push(YZ), r.push(u)) : (n.number.push(s), i.push(g7), r.push(parseFloat(u))), ++s, e_)).split(e_); return { values: r, split: a, indexes: n, types: i }; } -function p7(t) { - return Cl(t).values; +function v7(t) { + return Tl(t).values; } -function g7(t) { - const { split: e, types: r } = Cl(t), n = e.length; +function b7(t) { + const { split: e, types: r } = Tl(t), n = e.length; return (i) => { let s = ""; for (let o = 0; o < n; o++) if (s += e[o], i[o] !== void 0) { const a = r[o]; - a === h7 ? s += Gf(i[o]) : a === d7 ? s += Gn.transform(i[o]) : s += i[o]; + a === g7 ? s += Yf(i[o]) : a === m7 ? s += Yn.transform(i[o]) : s += i[o]; } return s; }; } -const zZ = (t) => typeof t == "number" ? 0 : t; -function HZ(t) { - const e = p7(t); - return g7(t)(e.map(zZ)); -} -const _a = { - test: BZ, - parse: p7, - createTransformer: g7, - getAnimatableNone: HZ -}, WZ = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]); -function KZ(t) { +const ZZ = (t) => typeof t == "number" ? 0 : t; +function QZ(t) { + const e = v7(t); + return b7(t)(e.map(ZZ)); +} +const Aa = { + test: GZ, + parse: v7, + createTransformer: b7, + getAnimatableNone: QZ +}, eQ = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]); +function tQ(t) { const [e, r] = t.slice(0, -1).split("("); if (e === "drop-shadow") return t; @@ -31497,16 +31497,16 @@ function KZ(t) { if (!n) return t; const i = r.replace(n, ""); - let s = WZ.has(e) ? 1 : 0; + let s = eQ.has(e) ? 1 : 0; return n !== r && (s *= 100), e + "(" + s + i + ")"; } -const VZ = /\b([a-z-]*)\(.*?\)/gu, ev = { - ..._a, +const rQ = /\b([a-z-]*)\(.*?\)/gu, ev = { + ...Aa, getAnimatableNone: (t) => { - const e = t.match(VZ); - return e ? e.map(KZ).join(" ") : t; + const e = t.match(rQ); + return e ? e.map(tQ).join(" ") : t; } -}, GZ = { +}, nQ = { // Border props borderWidth: Vt, borderTopWidth: Vt, @@ -31542,18 +31542,18 @@ const VZ = /\b([a-z-]*)\(.*?\)/gu, ev = { // Misc backgroundPositionX: Vt, backgroundPositionY: Vt -}, YZ = { - rotate: sa, - rotateX: sa, - rotateY: sa, - rotateZ: sa, - scale: gd, - scaleX: gd, - scaleY: gd, - scaleZ: gd, - skew: sa, - skewX: sa, - skewY: sa, +}, iQ = { + rotate: ca, + rotateX: ca, + rotateY: ca, + rotateZ: ca, + scale: md, + scaleX: md, + scaleY: md, + scaleZ: md, + skew: ca, + skewX: ca, + skewY: ca, distance: Vt, translateX: Vt, translateY: Vt, @@ -31563,55 +31563,55 @@ const VZ = /\b([a-z-]*)\(.*?\)/gu, ev = { z: Vt, perspective: Vt, transformPerspective: Vt, - opacity: Il, - originX: V_, - originY: V_, + opacity: Cl, + originX: Y6, + originY: Y6, originZ: Vt -}, Q_ = { - ...Ku, +}, t_ = { + ...Vu, transform: Math.round }, $b = { - ...GZ, - ...YZ, - zIndex: Q_, + ...nQ, + ...iQ, + zIndex: t_, size: Vt, // SVG - fillOpacity: Il, - strokeOpacity: Il, - numOctaves: Q_ -}, JZ = { + fillOpacity: Cl, + strokeOpacity: Cl, + numOctaves: t_ +}, sQ = { ...$b, // Color props - color: Gn, - backgroundColor: Gn, - outlineColor: Gn, - fill: Gn, - stroke: Gn, + color: Yn, + backgroundColor: Yn, + outlineColor: Yn, + fill: Yn, + stroke: Yn, // Border props - borderColor: Gn, - borderTopColor: Gn, - borderRightColor: Gn, - borderBottomColor: Gn, - borderLeftColor: Gn, + borderColor: Yn, + borderTopColor: Yn, + borderRightColor: Yn, + borderBottomColor: Yn, + borderLeftColor: Yn, filter: ev, WebkitFilter: ev -}, Fb = (t) => JZ[t]; -function m7(t, e) { - let r = Fb(t); - return r !== ev && (r = _a), r.getAnimatableNone ? r.getAnimatableNone(e) : void 0; +}, Bb = (t) => sQ[t]; +function y7(t, e) { + let r = Bb(t); + return r !== ev && (r = Aa), r.getAnimatableNone ? r.getAnimatableNone(e) : void 0; } -const XZ = /* @__PURE__ */ new Set(["auto", "none", "0"]); -function ZZ(t, e, r) { +const oQ = /* @__PURE__ */ new Set(["auto", "none", "0"]); +function aQ(t, e, r) { let n = 0, i; for (; n < t.length && !i; ) { const s = t[n]; - typeof s == "string" && !XZ.has(s) && Cl(s).values.length && (i = t[n]), n++; + typeof s == "string" && !oQ.has(s) && Tl(s).values.length && (i = t[n]), n++; } if (i && r) for (const s of e) - t[s] = m7(r, i); + t[s] = y7(r, i); } -class v7 extends Nb { +class w7 extends Nb { constructor(e, r, n, i, s) { super(e, r, n, i, s, !0); } @@ -31623,15 +31623,15 @@ class v7 extends Nb { for (let u = 0; u < e.length; u++) { let l = e[u]; if (typeof l == "string" && (l = l.trim(), Ob(l))) { - const d = o7(l, r.current); + const d = u7(l, r.current); d !== void 0 && (e[u] = d), u === e.length - 1 && (this.finalKeyframe = l); } } - if (this.resolveNoneKeyframes(), !IZ.has(n) || e.length !== 2) + if (this.resolveNoneKeyframes(), !$Z.has(n) || e.length !== 2) return; - const [i, s] = e, o = X_(i), a = X_(s); + const [i, s] = e, o = Q6(i), a = Q6(s); if (o !== a) - if (G_(o) && G_(a)) + if (J6(o) && J6(a)) for (let u = 0; u < e.length; u++) { const l = e[u]; typeof l == "string" && (e[u] = parseFloat(l)); @@ -31642,14 +31642,14 @@ class v7 extends Nb { resolveNoneKeyframes() { const { unresolvedKeyframes: e, name: r } = this, n = []; for (let i = 0; i < e.length; i++) - wZ(e[i]) && n.push(i); - n.length && ZZ(e, n, r); + CZ(e[i]) && n.push(i); + n.length && aQ(e, n, r); } measureInitialState() { const { element: e, unresolvedKeyframes: r, name: n } = this; if (!e || !e.current) return; - n === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = Pu[n](e.measureViewportBox(), window.getComputedStyle(e.current)), r[0] = this.measuredOrigin; + n === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = Mu[n](e.measureViewportBox(), window.getComputedStyle(e.current)), r[0] = this.measuredOrigin; const i = r[r.length - 1]; i !== void 0 && e.getValue(n, i).jump(i, !1); } @@ -31661,27 +31661,27 @@ class v7 extends Nb { const s = r.getValue(n); s && s.jump(this.measuredOrigin, !1); const o = i.length - 1, a = i[o]; - i[o] = Pu[n](r.measureViewportBox(), window.getComputedStyle(r.current)), a !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = a), !((e = this.removedTransforms) === null || e === void 0) && e.length && this.removedTransforms.forEach(([u, l]) => { + i[o] = Mu[n](r.measureViewportBox(), window.getComputedStyle(r.current)), a !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = a), !((e = this.removedTransforms) === null || e === void 0) && e.length && this.removedTransforms.forEach(([u, l]) => { r.getValue(u).set(l); }), this.resolveNoneKeyframes(); } } -function Bb(t) { +function Fb(t) { return typeof t == "function"; } let Fd; -function QZ() { +function cQ() { Fd = void 0; } -const Gs = { - now: () => (Fd === void 0 && Gs.set(Fn.isProcessing || dZ.useManualTiming ? Fn.timestamp : performance.now()), Fd), +const Ys = { + now: () => (Fd === void 0 && Ys.set(Fn.isProcessing || _Z.useManualTiming ? Fn.timestamp : performance.now()), Fd), set: (t) => { - Fd = t, queueMicrotask(QZ); + Fd = t, queueMicrotask(cQ); } -}, e6 = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string -(_a.test(t) || t === "0") && // And it contains numbers and/or colors +}, r_ = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string +(Aa.test(t) || t === "0") && // And it contains numbers and/or colors !t.startsWith("url(")); -function eQ(t) { +function uQ(t) { const e = t[0]; if (t.length === 1) return !0; @@ -31689,19 +31689,19 @@ function eQ(t) { if (t[r] !== e) return !0; } -function tQ(t, e, r, n) { +function fQ(t, e, r, n) { const i = t[0]; if (i === null) return !1; if (e === "display" || e === "visibility") return !0; - const s = t[t.length - 1], o = e6(i, e), a = e6(s, e); - return Wu(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : eQ(t) || (r === "spring" || Bb(r)) && n; + const s = t[t.length - 1], o = r_(i, e), a = r_(s, e); + return Ku(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : uQ(t) || (r === "spring" || Fb(r)) && n; } -const rQ = 40; -class b7 { +const lQ = 40; +class x7 { constructor({ autoplay: e = !0, delay: r = 0, type: n = "keyframes", repeat: i = 0, repeatDelay: s = 0, repeatType: o = "loop", ...a }) { - this.isStopped = !1, this.hasAttemptedResolve = !1, this.createdAt = Gs.now(), this.options = { + this.isStopped = !1, this.hasAttemptedResolve = !1, this.createdAt = Ys.now(), this.options = { autoplay: e, delay: r, type: n, @@ -31722,7 +31722,7 @@ class b7 { * to avoid a sudden jump into the animation. */ calcStartTime() { - return this.resolvedAt ? this.resolvedAt - this.createdAt > rQ ? this.resolvedAt : this.createdAt : this.createdAt; + return this.resolvedAt ? this.resolvedAt - this.createdAt > lQ ? this.resolvedAt : this.createdAt : this.createdAt; } /** * A getter for resolved data. If keyframes are not yet resolved, accessing @@ -31730,7 +31730,7 @@ class b7 { * This is a deoptimisation, but at its worst still batches read/writes. */ get resolved() { - return !this._resolved && !this.hasAttemptedResolve && OZ(), this._resolved; + return !this._resolved && !this.hasAttemptedResolve && qZ(), this._resolved; } /** * A method to be called when the keyframes resolver completes. This method @@ -31738,13 +31738,13 @@ class b7 { * Otherwise, it will call initPlayback on the implementing class. */ onKeyframesResolved(e, r) { - this.resolvedAt = Gs.now(), this.hasAttemptedResolve = !0; + this.resolvedAt = Ys.now(), this.hasAttemptedResolve = !0; const { name: n, type: i, velocity: s, delay: o, onComplete: a, onUpdate: u, isGenerator: l } = this.options; - if (!l && !tQ(e, n, i, s)) + if (!l && !fQ(e, n, i, s)) if (o) this.options.duration = 0; else { - u == null || u(yp(e, this.options, r)), a == null || a(), this.resolveFinishedPromise(); + u == null || u(wp(e, this.options, r)), a == null || a(), this.resolveFinishedPromise(); return; } const d = this.initPlayback(e, r); @@ -31773,34 +31773,34 @@ class b7 { }); } } -function y7(t, e) { +function _7(t, e) { return e ? t * (1e3 / e) : 0; } -const nQ = 5; -function w7(t, e, r) { - const n = Math.max(e - nQ, 0); - return y7(r - t(n), e - n); +const hQ = 5; +function E7(t, e, r) { + const n = Math.max(e - hQ, 0); + return _7(r - t(n), e - n); } -const Nm = 1e-3, iQ = 0.01, t6 = 10, sQ = 0.05, oQ = 1; -function aQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }) { +const Nm = 1e-3, dQ = 0.01, n_ = 10, pQ = 0.05, gQ = 1; +function mQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }) { let i, s; - Wu(t <= Ks(t6), "Spring duration must be 10 seconds or less"); + Ku(t <= Vs(n_), "Spring duration must be 10 seconds or less"); let o = 1 - e; - o = xa(sQ, oQ, o), t = xa(iQ, t6, Co(t)), o < 1 ? (i = (l) => { - const d = l * o, g = d * t, w = d - r, A = tv(l, o), M = Math.exp(-g); - return Nm - w / A * M; + o = Sa(pQ, gQ, o), t = Sa(dQ, n_, Do(t)), o < 1 ? (i = (l) => { + const d = l * o, p = d * t, w = d - r, A = tv(l, o), P = Math.exp(-p); + return Nm - w / A * P; }, s = (l) => { - const g = l * o * t, w = g * r + r, A = Math.pow(o, 2) * Math.pow(l, 2) * t, M = Math.exp(-g), N = tv(Math.pow(l, 2), o); - return (-i(l) + Nm > 0 ? -1 : 1) * ((w - A) * M) / N; + const p = l * o * t, w = p * r + r, A = Math.pow(o, 2) * Math.pow(l, 2) * t, P = Math.exp(-p), N = tv(Math.pow(l, 2), o); + return (-i(l) + Nm > 0 ? -1 : 1) * ((w - A) * P) / N; }) : (i = (l) => { - const d = Math.exp(-l * t), g = (l - r) * t + 1; - return -Nm + d * g; + const d = Math.exp(-l * t), p = (l - r) * t + 1; + return -Nm + d * p; }, s = (l) => { - const d = Math.exp(-l * t), g = (r - l) * (t * t); - return d * g; + const d = Math.exp(-l * t), p = (r - l) * (t * t); + return d * p; }); - const a = 5 / t, u = uQ(i, s, a); - if (t = Ks(t), isNaN(u)) + const a = 5 / t, u = bQ(i, s, a); + if (t = Vs(t), isNaN(u)) return { stiffness: 100, damping: 10, @@ -31815,21 +31815,21 @@ function aQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }; } } -const cQ = 12; -function uQ(t, e, r) { +const vQ = 12; +function bQ(t, e, r) { let n = r; - for (let i = 1; i < cQ; i++) + for (let i = 1; i < vQ; i++) n = n - t(n) / e(n); return n; } function tv(t, e) { return t * Math.sqrt(1 - e * e); } -const fQ = ["duration", "bounce"], lQ = ["stiffness", "damping", "mass"]; -function r6(t, e) { +const yQ = ["duration", "bounce"], wQ = ["stiffness", "damping", "mass"]; +function i_(t, e) { return e.some((r) => t[r] !== void 0); } -function hQ(t) { +function xQ(t) { let e = { velocity: 0, stiffness: 100, @@ -31838,8 +31838,8 @@ function hQ(t) { isResolvedFromDuration: !1, ...t }; - if (!r6(t, lQ) && r6(t, fQ)) { - const r = aQ(t); + if (!i_(t, wQ) && i_(t, yQ)) { + const r = mQ(t); e = { ...e, ...r, @@ -31848,61 +31848,61 @@ function hQ(t) { } return e; } -function x7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { - const i = t[0], s = t[t.length - 1], o = { done: !1, value: i }, { stiffness: a, damping: u, mass: l, duration: d, velocity: g, isResolvedFromDuration: w } = hQ({ +function S7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { + const i = t[0], s = t[t.length - 1], o = { done: !1, value: i }, { stiffness: a, damping: u, mass: l, duration: d, velocity: p, isResolvedFromDuration: w } = xQ({ ...n, - velocity: -Co(n.velocity || 0) - }), A = g || 0, M = u / (2 * Math.sqrt(a * l)), N = s - i, L = Co(Math.sqrt(a / l)), $ = Math.abs(N) < 5; + velocity: -Do(n.velocity || 0) + }), A = p || 0, P = u / (2 * Math.sqrt(a * l)), N = s - i, L = Do(Math.sqrt(a / l)), $ = Math.abs(N) < 5; r || (r = $ ? 0.01 : 2), e || (e = $ ? 5e-3 : 0.5); - let F; - if (M < 1) { - const K = tv(L, M); - F = (H) => { - const V = Math.exp(-M * L * H); - return s - V * ((A + M * L * N) / K * Math.sin(K * H) + N * Math.cos(K * H)); + let B; + if (P < 1) { + const H = tv(L, P); + B = (W) => { + const V = Math.exp(-P * L * W); + return s - V * ((A + P * L * N) / H * Math.sin(H * W) + N * Math.cos(H * W)); }; - } else if (M === 1) - F = (K) => s - Math.exp(-L * K) * (N + (A + L * N) * K); + } else if (P === 1) + B = (H) => s - Math.exp(-L * H) * (N + (A + L * N) * H); else { - const K = L * Math.sqrt(M * M - 1); - F = (H) => { - const V = Math.exp(-M * L * H), te = Math.min(K * H, 300); - return s - V * ((A + M * L * N) * Math.sinh(te) + K * N * Math.cosh(te)) / K; + const H = L * Math.sqrt(P * P - 1); + B = (W) => { + const V = Math.exp(-P * L * W), te = Math.min(H * W, 300); + return s - V * ((A + P * L * N) * Math.sinh(te) + H * N * Math.cosh(te)) / H; }; } return { calculatedDuration: w && d || null, - next: (K) => { - const H = F(K); + next: (H) => { + const W = B(H); if (w) - o.done = K >= d; + o.done = H >= d; else { let V = 0; - M < 1 && (V = K === 0 ? Ks(A) : w7(F, K, H)); - const te = Math.abs(V) <= r, R = Math.abs(s - H) <= e; + P < 1 && (V = H === 0 ? Vs(A) : E7(B, H, W)); + const te = Math.abs(V) <= r, R = Math.abs(s - W) <= e; o.done = te && R; } - return o.value = o.done ? s : H, o; + return o.value = o.done ? s : W, o; } }; } -function n6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: u, restDelta: l = 0.5, restSpeed: d }) { - const g = t[0], w = { +function s_({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: u, restDelta: l = 0.5, restSpeed: d }) { + const p = t[0], w = { done: !1, - value: g - }, A = (W) => a !== void 0 && W < a || u !== void 0 && W > u, M = (W) => a === void 0 ? u : u === void 0 || Math.abs(a - W) < Math.abs(u - W) ? a : u; + value: p + }, A = (K) => a !== void 0 && K < a || u !== void 0 && K > u, P = (K) => a === void 0 ? u : u === void 0 || Math.abs(a - K) < Math.abs(u - K) ? a : u; let N = r * e; - const L = g + N, $ = o === void 0 ? L : o(L); - $ !== L && (N = $ - g); - const F = (W) => -N * Math.exp(-W / n), K = (W) => $ + F(W), H = (W) => { - const pe = F(W), Ee = K(W); - w.done = Math.abs(pe) <= l, w.value = w.done ? $ : Ee; + const L = p + N, $ = o === void 0 ? L : o(L); + $ !== L && (N = $ - p); + const B = (K) => -N * Math.exp(-K / n), H = (K) => $ + B(K), W = (K) => { + const ge = B(K), Ee = H(K); + w.done = Math.abs(ge) <= l, w.value = w.done ? $ : Ee; }; let V, te; - const R = (W) => { - A(w.value) && (V = W, te = x7({ - keyframes: [w.value, M(w.value)], - velocity: w7(K, W, w.value), + const R = (K) => { + A(w.value) && (V = K, te = S7({ + keyframes: [w.value, P(w.value)], + velocity: E7(H, K, w.value), // TODO: This should be passing * 1000 damping: i, stiffness: s, @@ -31912,40 +31912,40 @@ function n6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 3 }; return R(0), { calculatedDuration: null, - next: (W) => { - let pe = !1; - return !te && V === void 0 && (pe = !0, H(W), R(W)), V !== void 0 && W >= V ? te.next(W - V) : (!pe && H(W), w); + next: (K) => { + let ge = !1; + return !te && V === void 0 && (ge = !0, W(K), R(K)), V !== void 0 && K >= V ? te.next(K - V) : (!ge && W(K), w); } }; } -const dQ = /* @__PURE__ */ ah(0.42, 0, 1, 1), pQ = /* @__PURE__ */ ah(0, 0, 0.58, 1), _7 = /* @__PURE__ */ ah(0.42, 0, 0.58, 1), gQ = (t) => Array.isArray(t) && typeof t[0] != "number", Ub = (t) => Array.isArray(t) && typeof t[0] == "number", i6 = { +const _Q = /* @__PURE__ */ ch(0.42, 0, 1, 1), EQ = /* @__PURE__ */ ch(0, 0, 0.58, 1), A7 = /* @__PURE__ */ ch(0.42, 0, 0.58, 1), SQ = (t) => Array.isArray(t) && typeof t[0] != "number", jb = (t) => Array.isArray(t) && typeof t[0] == "number", o_ = { linear: Un, - easeIn: dQ, - easeInOut: _7, - easeOut: pQ, + easeIn: _Q, + easeInOut: A7, + easeOut: EQ, circIn: Db, - circInOut: t7, - circOut: e7, + circInOut: i7, + circOut: n7, backIn: Rb, - backInOut: ZS, - backOut: XS, - anticipate: QS -}, s6 = (t) => { - if (Ub(t)) { - Uo(t.length === 4, "Cubic bezier arrays must contain four numerical values."); + backInOut: t7, + backOut: e7, + anticipate: r7 +}, a_ = (t) => { + if (jb(t)) { + zo(t.length === 4, "Cubic bezier arrays must contain four numerical values."); const [e, r, n, i] = t; - return ah(e, r, n, i); + return ch(e, r, n, i); } else if (typeof t == "string") - return Uo(i6[t] !== void 0, `Invalid easing type '${t}'`), i6[t]; + return zo(o_[t] !== void 0, `Invalid easing type '${t}'`), o_[t]; return t; -}, mQ = (t, e) => (r) => e(t(r)), To = (...t) => t.reduce(mQ), Mu = (t, e, r) => { +}, AQ = (t, e) => (r) => e(t(r)), Oo = (...t) => t.reduce(AQ), Iu = (t, e, r) => { const n = e - t; return n === 0 ? 1 : (r - t) / n; }, Qr = (t, e, r) => t + (e - t) * r; function Lm(t, e, r) { return r < 0 && (r += 1), r > 1 && (r -= 1), r < 1 / 6 ? t + (e - t) * 6 * r : r < 1 / 2 ? e : r < 2 / 3 ? t + (e - t) * (2 / 3 - r) * 6 : t; } -function vQ({ hue: t, saturation: e, lightness: r, alpha: n }) { +function PQ({ hue: t, saturation: e, lightness: r, alpha: n }) { t /= 360, e /= 100, r /= 100; let i = 0, s = 0, o = 0; if (!e) @@ -31961,55 +31961,55 @@ function vQ({ hue: t, saturation: e, lightness: r, alpha: n }) { alpha: n }; } -function m0(t, e) { +function v0(t, e) { return (r) => r > 0 ? e : t; } const km = (t, e, r) => { const n = t * t, i = r * (e * e - n) + n; return i < 0 ? 0 : Math.sqrt(i); -}, bQ = [Q1, ic, Qc], yQ = (t) => bQ.find((e) => e.test(t)); -function o6(t) { - const e = yQ(t); - if (Wu(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e) +}, MQ = [Q1, oc, eu], IQ = (t) => MQ.find((e) => e.test(t)); +function c_(t) { + const e = IQ(t); + if (Ku(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e) return !1; let r = e.parse(t); - return e === Qc && (r = vQ(r)), r; + return e === eu && (r = PQ(r)), r; } -const a6 = (t, e) => { - const r = o6(t), n = o6(e); +const u_ = (t, e) => { + const r = c_(t), n = c_(e); if (!r || !n) - return m0(t, e); + return v0(t, e); const i = { ...r }; - return (s) => (i.red = km(r.red, n.red, s), i.green = km(r.green, n.green, s), i.blue = km(r.blue, n.blue, s), i.alpha = Qr(r.alpha, n.alpha, s), ic.transform(i)); + return (s) => (i.red = km(r.red, n.red, s), i.green = km(r.green, n.green, s), i.blue = km(r.blue, n.blue, s), i.alpha = Qr(r.alpha, n.alpha, s), oc.transform(i)); }, rv = /* @__PURE__ */ new Set(["none", "hidden"]); -function wQ(t, e) { +function CQ(t, e) { return rv.has(t) ? (r) => r <= 0 ? t : e : (r) => r >= 1 ? e : t; } -function xQ(t, e) { +function TQ(t, e) { return (r) => Qr(t, e, r); } -function jb(t) { - return typeof t == "number" ? xQ : typeof t == "string" ? Ob(t) ? m0 : Gn.test(t) ? a6 : SQ : Array.isArray(t) ? E7 : typeof t == "object" ? Gn.test(t) ? a6 : _Q : m0; +function Ub(t) { + return typeof t == "number" ? TQ : typeof t == "string" ? Ob(t) ? v0 : Yn.test(t) ? u_ : OQ : Array.isArray(t) ? P7 : typeof t == "object" ? Yn.test(t) ? u_ : RQ : v0; } -function E7(t, e) { - const r = [...t], n = r.length, i = t.map((s, o) => jb(s)(s, e[o])); +function P7(t, e) { + const r = [...t], n = r.length, i = t.map((s, o) => Ub(s)(s, e[o])); return (s) => { for (let o = 0; o < n; o++) r[o] = i[o](s); return r; }; } -function _Q(t, e) { +function RQ(t, e) { const r = { ...t, ...e }, n = {}; for (const i in r) - t[i] !== void 0 && e[i] !== void 0 && (n[i] = jb(t[i])(t[i], e[i])); + t[i] !== void 0 && e[i] !== void 0 && (n[i] = Ub(t[i])(t[i], e[i])); return (i) => { for (const s in n) r[s] = n[s](i); return r; }; } -function EQ(t, e) { +function DQ(t, e) { var r; const n = [], i = { color: 0, var: 0, number: 0 }; for (let s = 0; s < e.values.length; s++) { @@ -32018,104 +32018,104 @@ function EQ(t, e) { } return n; } -const SQ = (t, e) => { - const r = _a.createTransformer(e), n = Cl(t), i = Cl(e); - return n.indexes.var.length === i.indexes.var.length && n.indexes.color.length === i.indexes.color.length && n.indexes.number.length >= i.indexes.number.length ? rv.has(t) && !i.values.length || rv.has(e) && !n.values.length ? wQ(t, e) : To(E7(EQ(n, i), i.values), r) : (Wu(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), m0(t, e)); +const OQ = (t, e) => { + const r = Aa.createTransformer(e), n = Tl(t), i = Tl(e); + return n.indexes.var.length === i.indexes.var.length && n.indexes.color.length === i.indexes.color.length && n.indexes.number.length >= i.indexes.number.length ? rv.has(t) && !i.values.length || rv.has(e) && !n.values.length ? CQ(t, e) : Oo(P7(DQ(n, i), i.values), r) : (Ku(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), v0(t, e)); }; -function S7(t, e, r) { - return typeof t == "number" && typeof e == "number" && typeof r == "number" ? Qr(t, e, r) : jb(t)(t, e); +function M7(t, e, r) { + return typeof t == "number" && typeof e == "number" && typeof r == "number" ? Qr(t, e, r) : Ub(t)(t, e); } -function AQ(t, e, r) { - const n = [], i = r || S7, s = t.length - 1; +function NQ(t, e, r) { + const n = [], i = r || M7, s = t.length - 1; for (let o = 0; o < s; o++) { let a = i(t[o], t[o + 1]); if (e) { const u = Array.isArray(e) ? e[o] || Un : e; - a = To(u, a); + a = Oo(u, a); } n.push(a); } return n; } -function PQ(t, e, { clamp: r = !0, ease: n, mixer: i } = {}) { +function LQ(t, e, { clamp: r = !0, ease: n, mixer: i } = {}) { const s = t.length; - if (Uo(s === e.length, "Both input and output ranges must be the same length"), s === 1) + if (zo(s === e.length, "Both input and output ranges must be the same length"), s === 1) return () => e[0]; if (s === 2 && t[0] === t[1]) return () => e[1]; t[0] > t[s - 1] && (t = [...t].reverse(), e = [...e].reverse()); - const o = AQ(e, n, i), a = o.length, u = (l) => { + const o = NQ(e, n, i), a = o.length, u = (l) => { let d = 0; if (a > 1) for (; d < t.length - 2 && !(l < t[d + 1]); d++) ; - const g = Mu(t[d], t[d + 1], l); - return o[d](g); + const p = Iu(t[d], t[d + 1], l); + return o[d](p); }; - return r ? (l) => u(xa(t[0], t[s - 1], l)) : u; + return r ? (l) => u(Sa(t[0], t[s - 1], l)) : u; } -function MQ(t, e) { +function kQ(t, e) { const r = t[t.length - 1]; for (let n = 1; n <= e; n++) { - const i = Mu(0, e, n); + const i = Iu(0, e, n); t.push(Qr(r, 1, i)); } } -function IQ(t) { +function $Q(t) { const e = [0]; - return MQ(e, t.length - 1), e; + return kQ(e, t.length - 1), e; } -function CQ(t, e) { +function BQ(t, e) { return t.map((r) => r * e); } -function TQ(t, e) { - return t.map(() => e || _7).splice(0, t.length - 1); +function FQ(t, e) { + return t.map(() => e || A7).splice(0, t.length - 1); } -function v0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" }) { - const i = gQ(n) ? n.map(s6) : s6(n), s = { +function b0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" }) { + const i = SQ(n) ? n.map(a_) : a_(n), s = { done: !1, value: e[0] - }, o = CQ( + }, o = BQ( // Only use the provided offsets if they're the correct length // TODO Maybe we should warn here if there's a length mismatch - r && r.length === e.length ? r : IQ(e), + r && r.length === e.length ? r : $Q(e), t - ), a = PQ(o, e, { - ease: Array.isArray(i) ? i : TQ(e, i) + ), a = LQ(o, e, { + ease: Array.isArray(i) ? i : FQ(e, i) }); return { calculatedDuration: t, next: (u) => (s.value = a(u), s.done = u >= t, s) }; } -const c6 = 2e4; -function RQ(t) { +const f_ = 2e4; +function jQ(t) { let e = 0; const r = 50; let n = t.next(e); - for (; !n.done && e < c6; ) + for (; !n.done && e < f_; ) e += r, n = t.next(e); - return e >= c6 ? 1 / 0 : e; + return e >= f_ ? 1 / 0 : e; } -const DQ = (t) => { +const UQ = (t) => { const e = ({ timestamp: r }) => t(r); return { start: () => Lr.update(e, !0), - stop: () => wa(e), + stop: () => Ea(e), /** * If we're processing this frame we can use the * framelocked timestamp to keep things in sync. */ - now: () => Fn.isProcessing ? Fn.timestamp : Gs.now() + now: () => Fn.isProcessing ? Fn.timestamp : Ys.now() }; -}, OQ = { - decay: n6, - inertia: n6, - tween: v0, - keyframes: v0, - spring: x7 -}, NQ = (t) => t / 100; -class qb extends b7 { +}, qQ = { + decay: s_, + inertia: s_, + tween: b0, + keyframes: b0, + spring: S7 +}, zQ = (t) => t / 100; +class qb extends x7 { constructor(e) { super(e), this.holdTime = null, this.cancelTime = null, this.currentTime = 0, this.playbackSpeed = 1, this.pendingPlayState = "running", this.startTime = null, this.state = "idle", this.stop = () => { if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle") @@ -32131,21 +32131,21 @@ class qb extends b7 { super.flatten(), this._resolved && Object.assign(this._resolved, this.initPlayback(this._resolved.keyframes)); } initPlayback(e) { - const { type: r = "keyframes", repeat: n = 0, repeatDelay: i = 0, repeatType: s, velocity: o = 0 } = this.options, a = Bb(r) ? r : OQ[r] || v0; + const { type: r = "keyframes", repeat: n = 0, repeatDelay: i = 0, repeatType: s, velocity: o = 0 } = this.options, a = Fb(r) ? r : qQ[r] || b0; let u, l; - a !== v0 && typeof e[0] != "number" && (process.env.NODE_ENV !== "production" && Uo(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), u = To(NQ, S7(e[0], e[1])), e = [0, 100]); + a !== b0 && typeof e[0] != "number" && (process.env.NODE_ENV !== "production" && zo(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), u = Oo(zQ, M7(e[0], e[1])), e = [0, 100]); const d = a({ ...this.options, keyframes: e }); s === "mirror" && (l = a({ ...this.options, keyframes: [...e].reverse(), velocity: -o - })), d.calculatedDuration === null && (d.calculatedDuration = RQ(d)); - const { calculatedDuration: g } = d, w = g + i, A = w * (n + 1) - i; + })), d.calculatedDuration === null && (d.calculatedDuration = jQ(d)); + const { calculatedDuration: p } = d, w = p + i, A = w * (n + 1) - i; return { generator: d, mirroredGenerator: l, mapPercentToKeyframes: u, - calculatedDuration: g, + calculatedDuration: p, resolvedDuration: w, totalDuration: A }; @@ -32157,45 +32157,45 @@ class qb extends b7 { tick(e, r = !1) { const { resolved: n } = this; if (!n) { - const { keyframes: W } = this.options; - return { done: !0, value: W[W.length - 1] }; + const { keyframes: K } = this.options; + return { done: !0, value: K[K.length - 1] }; } - const { finalKeyframe: i, generator: s, mirroredGenerator: o, mapPercentToKeyframes: a, keyframes: u, calculatedDuration: l, totalDuration: d, resolvedDuration: g } = n; + const { finalKeyframe: i, generator: s, mirroredGenerator: o, mapPercentToKeyframes: a, keyframes: u, calculatedDuration: l, totalDuration: d, resolvedDuration: p } = n; if (this.startTime === null) return s.next(0); - const { delay: w, repeat: A, repeatType: M, repeatDelay: N, onUpdate: L } = this.options; + const { delay: w, repeat: A, repeatType: P, repeatDelay: N, onUpdate: L } = this.options; this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - d / this.speed, this.startTime)), r ? this.currentTime = e : this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = Math.round(e - this.startTime) * this.speed; - const $ = this.currentTime - w * (this.speed >= 0 ? 1 : -1), F = this.speed >= 0 ? $ < 0 : $ > d; + const $ = this.currentTime - w * (this.speed >= 0 ? 1 : -1), B = this.speed >= 0 ? $ < 0 : $ > d; this.currentTime = Math.max($, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = d); - let K = this.currentTime, H = s; + let H = this.currentTime, W = s; if (A) { - const W = Math.min(this.currentTime, d) / g; - let pe = Math.floor(W), Ee = W % 1; - !Ee && W >= 1 && (Ee = 1), Ee === 1 && pe--, pe = Math.min(pe, A + 1), !!(pe % 2) && (M === "reverse" ? (Ee = 1 - Ee, N && (Ee -= N / g)) : M === "mirror" && (H = o)), K = xa(0, 1, Ee) * g; + const K = Math.min(this.currentTime, d) / p; + let ge = Math.floor(K), Ee = K % 1; + !Ee && K >= 1 && (Ee = 1), Ee === 1 && ge--, ge = Math.min(ge, A + 1), !!(ge % 2) && (P === "reverse" ? (Ee = 1 - Ee, N && (Ee -= N / p)) : P === "mirror" && (W = o)), H = Sa(0, 1, Ee) * p; } - const V = F ? { done: !1, value: u[0] } : H.next(K); + const V = B ? { done: !1, value: u[0] } : W.next(H); a && (V.value = a(V.value)); let { done: te } = V; - !F && l !== null && (te = this.speed >= 0 ? this.currentTime >= d : this.currentTime <= 0); + !B && l !== null && (te = this.speed >= 0 ? this.currentTime >= d : this.currentTime <= 0); const R = this.holdTime === null && (this.state === "finished" || this.state === "running" && te); - return R && i !== void 0 && (V.value = yp(u, this.options, i)), L && L(V.value), R && this.finish(), V; + return R && i !== void 0 && (V.value = wp(u, this.options, i)), L && L(V.value), R && this.finish(), V; } get duration() { const { resolved: e } = this; - return e ? Co(e.calculatedDuration) : 0; + return e ? Do(e.calculatedDuration) : 0; } get time() { - return Co(this.currentTime); + return Do(this.currentTime); } set time(e) { - e = Ks(e), this.currentTime = e, this.holdTime !== null || this.speed === 0 ? this.holdTime = e : this.driver && (this.startTime = this.driver.now() - e / this.speed); + e = Vs(e), this.currentTime = e, this.holdTime !== null || this.speed === 0 ? this.holdTime = e : this.driver && (this.startTime = this.driver.now() - e / this.speed); } get speed() { return this.playbackSpeed; } set speed(e) { const r = this.playbackSpeed !== e; - this.playbackSpeed = e, r && (this.time = Co(this.currentTime)); + this.playbackSpeed = e, r && (this.time = Do(this.currentTime)); } play() { if (this.resolver.isScheduled || this.resolver.resume(), !this._resolved) { @@ -32204,7 +32204,7 @@ class qb extends b7 { } if (this.isStopped) return; - const { driver: e = DQ, onPlay: r, startTime: n } = this.options; + const { driver: e = UQ, onPlay: r, startTime: n } = this.options; this.driver || (this.driver = e((s) => this.tick(s))), r && r(); const i = this.driver.now(); this.holdTime !== null ? this.startTime = i - this.holdTime : this.startTime ? this.state === "finished" && (this.startTime = i) : this.startTime = n ?? this.calcStartTime(), this.state === "finished" && this.updateFinishedPromise(), this.cancelTime = this.startTime, this.holdTime = null, this.state = "running", this.driver.start(); @@ -32238,7 +32238,7 @@ class qb extends b7 { return this.startTime = 0, this.tick(e, !0); } } -const LQ = /* @__PURE__ */ new Set([ +const WQ = /* @__PURE__ */ new Set([ "opacity", "clipPath", "filter", @@ -32246,28 +32246,28 @@ const LQ = /* @__PURE__ */ new Set([ // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved // or until we implement support for linear() easing. // "background-color" -]), kQ = 10, $Q = (t, e) => { +]), HQ = 10, KQ = (t, e) => { let r = ""; - const n = Math.max(Math.round(e / kQ), 2); + const n = Math.max(Math.round(e / HQ), 2); for (let i = 0; i < n; i++) - r += t(Mu(0, n - 1, i)) + ", "; + r += t(Iu(0, n - 1, i)) + ", "; return `linear(${r.substring(0, r.length - 2)})`; }; function zb(t) { let e; return () => (e === void 0 && (e = t()), e); } -const FQ = { +const VQ = { linearEasing: void 0 }; -function BQ(t, e) { +function GQ(t, e) { const r = zb(t); return () => { var n; - return (n = FQ[e]) !== null && n !== void 0 ? n : r(); + return (n = VQ[e]) !== null && n !== void 0 ? n : r(); }; } -const b0 = /* @__PURE__ */ BQ(() => { +const y0 = /* @__PURE__ */ GQ(() => { try { document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" }); } catch { @@ -32275,28 +32275,28 @@ const b0 = /* @__PURE__ */ BQ(() => { } return !0; }, "linearEasing"); -function A7(t) { - return !!(typeof t == "function" && b0() || !t || typeof t == "string" && (t in nv || b0()) || Ub(t) || Array.isArray(t) && t.every(A7)); +function I7(t) { + return !!(typeof t == "function" && y0() || !t || typeof t == "string" && (t in nv || y0()) || jb(t) || Array.isArray(t) && t.every(I7)); } -const Bf = ([t, e, r, n]) => `cubic-bezier(${t}, ${e}, ${r}, ${n})`, nv = { +const jf = ([t, e, r, n]) => `cubic-bezier(${t}, ${e}, ${r}, ${n})`, nv = { linear: "linear", ease: "ease", easeIn: "ease-in", easeOut: "ease-out", easeInOut: "ease-in-out", - circIn: /* @__PURE__ */ Bf([0, 0.65, 0.55, 1]), - circOut: /* @__PURE__ */ Bf([0.55, 0, 1, 0.45]), - backIn: /* @__PURE__ */ Bf([0.31, 0.01, 0.66, -0.59]), - backOut: /* @__PURE__ */ Bf([0.33, 1.53, 0.69, 0.99]) + circIn: /* @__PURE__ */ jf([0, 0.65, 0.55, 1]), + circOut: /* @__PURE__ */ jf([0.55, 0, 1, 0.45]), + backIn: /* @__PURE__ */ jf([0.31, 0.01, 0.66, -0.59]), + backOut: /* @__PURE__ */ jf([0.33, 1.53, 0.69, 0.99]) }; -function P7(t, e) { +function C7(t, e) { if (t) - return typeof t == "function" && b0() ? $Q(t, e) : Ub(t) ? Bf(t) : Array.isArray(t) ? t.map((r) => P7(r, e) || nv.easeOut) : nv[t]; + return typeof t == "function" && y0() ? KQ(t, e) : jb(t) ? jf(t) : Array.isArray(t) ? t.map((r) => C7(r, e) || nv.easeOut) : nv[t]; } -function UQ(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatType: o = "loop", ease: a = "easeInOut", times: u } = {}) { +function YQ(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatType: o = "loop", ease: a = "easeInOut", times: u } = {}) { const l = { [e]: r }; u && (l.offset = u); - const d = P7(a, i); + const d = C7(a, i); return Array.isArray(d) && (l.easing = d), t.animate(l, { delay: n, duration: i, @@ -32306,14 +32306,14 @@ function UQ(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatTyp direction: o === "reverse" ? "alternate" : "normal" }); } -function u6(t, e) { +function l_(t, e) { t.timeline = e, t.onfinish = null; } -const jQ = /* @__PURE__ */ zb(() => Object.hasOwnProperty.call(Element.prototype, "animate")), y0 = 10, qQ = 2e4; -function zQ(t) { - return Bb(t.type) || t.type === "spring" || !A7(t.ease); +const JQ = /* @__PURE__ */ zb(() => Object.hasOwnProperty.call(Element.prototype, "animate")), w0 = 10, XQ = 2e4; +function ZQ(t) { + return Fb(t.type) || t.type === "spring" || !I7(t.ease); } -function HQ(t, e) { +function QQ(t, e) { const r = new qb({ ...e, keyframes: t, @@ -32324,44 +32324,44 @@ function HQ(t, e) { let n = { done: !1, value: t[0] }; const i = []; let s = 0; - for (; !n.done && s < qQ; ) - n = r.sample(s), i.push(n.value), s += y0; + for (; !n.done && s < XQ; ) + n = r.sample(s), i.push(n.value), s += w0; return { times: void 0, keyframes: i, - duration: s - y0, + duration: s - w0, ease: "linear" }; } -const M7 = { - anticipate: QS, - backInOut: ZS, - circInOut: t7 +const T7 = { + anticipate: r7, + backInOut: t7, + circInOut: i7 }; -function WQ(t) { - return t in M7; +function eee(t) { + return t in T7; } -class f6 extends b7 { +class h_ extends x7 { constructor(e) { super(e); const { name: r, motionValue: n, element: i, keyframes: s } = this.options; - this.resolver = new v7(s, (o, a) => this.onKeyframesResolved(o, a), r, n, i), this.resolver.scheduleResolve(); + this.resolver = new w7(s, (o, a) => this.onKeyframesResolved(o, a), r, n, i), this.resolver.scheduleResolve(); } initPlayback(e, r) { var n; let { duration: i = 300, times: s, ease: o, type: a, motionValue: u, name: l, startTime: d } = this.options; if (!(!((n = u.owner) === null || n === void 0) && n.current)) return !1; - if (typeof o == "string" && b0() && WQ(o) && (o = M7[o]), zQ(this.options)) { - const { onComplete: w, onUpdate: A, motionValue: M, element: N, ...L } = this.options, $ = HQ(e, L); + if (typeof o == "string" && y0() && eee(o) && (o = T7[o]), ZQ(this.options)) { + const { onComplete: w, onUpdate: A, motionValue: P, element: N, ...L } = this.options, $ = QQ(e, L); e = $.keyframes, e.length === 1 && (e[1] = e[0]), i = $.duration, s = $.times, o = $.ease, a = "keyframes"; } - const g = UQ(u.owner.current, l, e, { ...this.options, duration: i, times: s, ease: o }); - return g.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (u6(g, this.pendingTimeline), this.pendingTimeline = void 0) : g.onfinish = () => { + const p = YQ(u.owner.current, l, e, { ...this.options, duration: i, times: s, ease: o }); + return p.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (l_(p, this.pendingTimeline), this.pendingTimeline = void 0) : p.onfinish = () => { const { onComplete: w } = this.options; - u.set(yp(e, this.options, r)), w && w(), this.cancel(), this.resolveFinishedPromise(); + u.set(wp(e, this.options, r)), w && w(), this.cancel(), this.resolveFinishedPromise(); }, { - animation: g, + animation: p, duration: i, times: s, type: a, @@ -32374,21 +32374,21 @@ class f6 extends b7 { if (!e) return 0; const { duration: r } = e; - return Co(r); + return Do(r); } get time() { const { resolved: e } = this; if (!e) return 0; const { animation: r } = e; - return Co(r.currentTime || 0); + return Do(r.currentTime || 0); } set time(e) { const { resolved: r } = this; if (!r) return; const { animation: n } = r; - n.currentTime = Ks(e); + n.currentTime = Vs(e); } get speed() { const { resolved: e } = this; @@ -32430,7 +32430,7 @@ class f6 extends b7 { if (!r) return Un; const { animation: n } = r; - u6(n, e); + l_(n, e); } return Un; } @@ -32461,7 +32461,7 @@ class f6 extends b7 { if (r.playState === "idle" || r.playState === "finished") return; if (this.time) { - const { motionValue: l, onUpdate: d, onComplete: g, element: w, ...A } = this.options, M = new qb({ + const { motionValue: l, onUpdate: d, onComplete: p, element: w, ...A } = this.options, P = new qb({ ...A, keyframes: n, duration: i, @@ -32469,8 +32469,8 @@ class f6 extends b7 { ease: o, times: a, isGenerator: !0 - }), N = Ks(this.time); - l.setWithVelocity(M.sample(N - y0).value, M.sample(N).value, y0); + }), N = Vs(this.time); + l.setWithVelocity(P.sample(N - w0).value, P.sample(N).value, w0); } const { onStop: u } = this.options; u && u(), this.cancel(); @@ -32485,15 +32485,15 @@ class f6 extends b7 { } static supports(e) { const { motionValue: r, name: n, repeatDelay: i, repeatType: s, damping: o, type: a } = e; - return jQ() && n && LQ.has(n) && r && r.owner && r.owner.current instanceof HTMLElement && /** + return JQ() && n && WQ.has(n) && r && r.owner && r.owner.current instanceof HTMLElement && /** * If we're outputting values to onUpdate then we can't use WAAPI as there's * no way to read the value from WAAPI every frame. */ !r.owner.getProps().onUpdate && !i && s !== "mirror" && o !== 0 && a !== "inertia"; } } -const KQ = zb(() => window.ScrollTimeline !== void 0); -class VQ { +const tee = zb(() => window.ScrollTimeline !== void 0); +class ree { constructor(e) { this.stop = () => this.runAll("stop"), this.animations = e.filter(Boolean); } @@ -32511,7 +32511,7 @@ class VQ { this.animations[n][e] = r; } attachTimeline(e, r) { - const n = this.animations.map((i) => KQ() && i.attachTimeline ? i.attachTimeline(e) : r(i)); + const n = this.animations.map((i) => tee() && i.attachTimeline ? i.attachTimeline(e) : r(i)); return () => { n.forEach((i, s) => { i && i(), this.animations[s].stop(); @@ -32558,13 +32558,13 @@ class VQ { this.runAll("complete"); } } -function GQ({ when: t, delay: e, delayChildren: r, staggerChildren: n, staggerDirection: i, repeat: s, repeatType: o, repeatDelay: a, from: u, elapsed: l, ...d }) { +function nee({ when: t, delay: e, delayChildren: r, staggerChildren: n, staggerDirection: i, repeat: s, repeatType: o, repeatDelay: a, from: u, elapsed: l, ...d }) { return !!Object.keys(d).length; } -const Hb = (t, e, r, n = {}, i, s) => (o) => { +const Wb = (t, e, r, n = {}, i, s) => (o) => { const a = Tb(n, t) || {}, u = a.delay || n.delay || 0; let { elapsed: l = 0 } = n; - l = l - Ks(u); + l = l - Vs(u); let d = { keyframes: Array.isArray(r) ? r : [null, r], ease: "easeOut", @@ -32581,21 +32581,21 @@ const Hb = (t, e, r, n = {}, i, s) => (o) => { motionValue: e, element: s ? void 0 : i }; - GQ(a) || (d = { + nee(a) || (d = { ...d, - ...hZ(t, d) - }), d.duration && (d.duration = Ks(d.duration)), d.repeatDelay && (d.repeatDelay = Ks(d.repeatDelay)), d.from !== void 0 && (d.keyframes[0] = d.from); - let g = !1; - if ((d.type === !1 || d.duration === 0 && !d.repeatDelay) && (d.duration = 0, d.delay === 0 && (g = !0)), g && !s && e.get() !== void 0) { - const w = yp(d.keyframes, a); + ...xZ(t, d) + }), d.duration && (d.duration = Vs(d.duration)), d.repeatDelay && (d.repeatDelay = Vs(d.repeatDelay)), d.from !== void 0 && (d.keyframes[0] = d.from); + let p = !1; + if ((d.type === !1 || d.duration === 0 && !d.repeatDelay) && (d.duration = 0, d.delay === 0 && (p = !0)), p && !s && e.get() !== void 0) { + const w = wp(d.keyframes, a); if (w !== void 0) return Lr.update(() => { d.onUpdate(w), d.onComplete(); - }), new VQ([]); + }), new ree([]); } - return !s && f6.supports(d) ? new f6(d) : new qb(d); -}, YQ = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), JQ = (t) => J1(t) ? t[t.length - 1] || 0 : t; -function Wb(t, e) { + return !s && h_.supports(d) ? new h_(d) : new qb(d); +}, iee = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), see = (t) => J1(t) ? t[t.length - 1] || 0 : t; +function Hb(t, e) { t.indexOf(e) === -1 && t.push(e); } function Kb(t, e) { @@ -32607,7 +32607,7 @@ class Vb { this.subscriptions = []; } add(e) { - return Wb(this.subscriptions, e), () => Kb(this.subscriptions, e); + return Hb(this.subscriptions, e), () => Kb(this.subscriptions, e); } notify(e, r, n) { const i = this.subscriptions.length; @@ -32627,8 +32627,8 @@ class Vb { this.subscriptions.length = 0; } } -const l6 = 30, XQ = (t) => !isNaN(parseFloat(t)); -class ZQ { +const d_ = 30, oee = (t) => !isNaN(parseFloat(t)); +class aee { /** * @param init - The initiating value * @param config - Optional configuration options @@ -32639,12 +32639,12 @@ class ZQ { */ constructor(e, r = {}) { this.version = "11.11.17", this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (n, i = !0) => { - const s = Gs.now(); + const s = Ys.now(); this.updatedAt !== s && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(n), this.current !== this.prev && this.events.change && this.events.change.notify(this.current), i && this.events.renderRequest && this.events.renderRequest.notify(this.current); }, this.hasAnimated = !1, this.setCurrent(e), this.owner = r.owner; } setCurrent(e) { - this.current = e, this.updatedAt = Gs.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = XQ(this.current)); + this.current = e, this.updatedAt = Ys.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = oee(this.current)); } setPrevFrameValue(e = this.current) { this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt; @@ -32690,7 +32690,7 @@ class ZQ { * @deprecated */ onChange(e) { - return process.env.NODE_ENV !== "production" && mp(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e); + return process.env.NODE_ENV !== "production" && vp(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e); } on(e, r) { this.events[e] || (this.events[e] = new Vb()); @@ -32765,11 +32765,11 @@ class ZQ { * @public */ getVelocity() { - const e = Gs.now(); - if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > l6) + const e = Ys.now(); + if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > d_) return 0; - const r = Math.min(this.updatedAt - this.prevUpdatedAt, l6); - return y7(parseFloat(this.current) - parseFloat(this.prevFrameValue), r); + const r = Math.min(this.updatedAt - this.prevUpdatedAt, d_); + return _7(parseFloat(this.current) - parseFloat(this.prevFrameValue), r); } /** * Registers a new animation to control this `MotionValue`. Only one @@ -32822,77 +32822,77 @@ class ZQ { this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect(); } } -function Tl(t, e) { - return new ZQ(t, e); +function Rl(t, e) { + return new aee(t, e); } -function QQ(t, e, r) { - t.hasValue(e) ? t.getValue(e).set(r) : t.addValue(e, Tl(r)); +function cee(t, e, r) { + t.hasValue(e) ? t.getValue(e).set(r) : t.addValue(e, Rl(r)); } -function eee(t, e) { - const r = bp(t, e); +function uee(t, e) { + const r = yp(t, e); let { transitionEnd: n = {}, transition: i = {}, ...s } = r || {}; s = { ...s, ...n }; for (const o in s) { - const a = JQ(s[o]); - QQ(t, o, a); + const a = see(s[o]); + cee(t, o, a); } } -const Gb = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), tee = "framerAppearId", I7 = "data-" + Gb(tee); -function C7(t) { - return t.props[I7]; +const Gb = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), fee = "framerAppearId", R7 = "data-" + Gb(fee); +function D7(t) { + return t.props[R7]; } -const Jn = (t) => !!(t && t.getVelocity); -function ree(t) { - return !!(Jn(t) && t.add); +const Xn = (t) => !!(t && t.getVelocity); +function lee(t) { + return !!(Xn(t) && t.add); } function iv(t, e) { const r = t.getValue("willChange"); - if (ree(r)) + if (lee(r)) return r.add(e); } -function nee({ protectedKeys: t, needsAnimating: e }, r) { +function hee({ protectedKeys: t, needsAnimating: e }, r) { const n = t.hasOwnProperty(r) && e[r] !== !0; return e[r] = !1, n; } -function T7(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { +function O7(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { var s; let { transition: o = t.getDefaultTransition(), transitionEnd: a, ...u } = e; n && (o = n); const l = [], d = i && t.animationState && t.animationState.getState()[i]; - for (const g in u) { - const w = t.getValue(g, (s = t.latestValues[g]) !== null && s !== void 0 ? s : null), A = u[g]; - if (A === void 0 || d && nee(d, g)) + for (const p in u) { + const w = t.getValue(p, (s = t.latestValues[p]) !== null && s !== void 0 ? s : null), A = u[p]; + if (A === void 0 || d && hee(d, p)) continue; - const M = { + const P = { delay: r, - ...Tb(o || {}, g) + ...Tb(o || {}, p) }; let N = !1; if (window.MotionHandoffAnimation) { - const $ = C7(t); + const $ = D7(t); if ($) { - const F = window.MotionHandoffAnimation($, g, Lr); - F !== null && (M.startTime = F, N = !0); + const B = window.MotionHandoffAnimation($, p, Lr); + B !== null && (P.startTime = B, N = !0); } } - iv(t, g), w.start(Hb(g, w, A, t.shouldReduceMotion && Sc.has(g) ? { type: !1 } : M, t, N)); + iv(t, p), w.start(Wb(p, w, A, t.shouldReduceMotion && Ac.has(p) ? { type: !1 } : P, t, N)); const L = w.animation; L && l.push(L); } return a && Promise.all(l).then(() => { Lr.update(() => { - a && eee(t, a); + a && uee(t, a); }); }), l; } function sv(t, e, r = {}) { var n; - const i = bp(t, e, r.type === "exit" ? (n = t.presenceContext) === null || n === void 0 ? void 0 : n.custom : void 0); + const i = yp(t, e, r.type === "exit" ? (n = t.presenceContext) === null || n === void 0 ? void 0 : n.custom : void 0); let { transition: s = t.getDefaultTransition() || {} } = i || {}; r.transitionOverride && (s = r.transitionOverride); - const o = i ? () => Promise.all(T7(t, i, r)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (l = 0) => { - const { delayChildren: d = 0, staggerChildren: g, staggerDirection: w } = s; - return iee(t, e, d + l, g, w, r); + const o = i ? () => Promise.all(O7(t, i, r)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (l = 0) => { + const { delayChildren: d = 0, staggerChildren: p, staggerDirection: w } = s; + return dee(t, e, d + l, p, w, r); } : () => Promise.resolve(), { when: u } = s; if (u) { const [l, d] = u === "beforeChildren" ? [o, a] : [a, o]; @@ -32900,19 +32900,19 @@ function sv(t, e, r = {}) { } else return Promise.all([o(), a(r.delay)]); } -function iee(t, e, r = 0, n = 0, i = 1, s) { +function dee(t, e, r = 0, n = 0, i = 1, s) { const o = [], a = (t.variantChildren.size - 1) * n, u = i === 1 ? (l = 0) => l * n : (l = 0) => a - l * n; - return Array.from(t.variantChildren).sort(see).forEach((l, d) => { + return Array.from(t.variantChildren).sort(pee).forEach((l, d) => { l.notify("AnimationStart", e), o.push(sv(l, e, { ...s, delay: r + u(d) }).then(() => l.notify("AnimationComplete", e))); }), Promise.all(o); } -function see(t, e) { +function pee(t, e) { return t.sortNodePosition(e); } -function oee(t, e, r = {}) { +function gee(t, e, r = {}) { t.notify("AnimationStart", e); let n; if (Array.isArray(e)) { @@ -32921,40 +32921,40 @@ function oee(t, e, r = {}) { } else if (typeof e == "string") n = sv(t, e, r); else { - const i = typeof e == "function" ? bp(t, e, r.custom) : e; - n = Promise.all(T7(t, i, r)); + const i = typeof e == "function" ? yp(t, e, r.custom) : e; + n = Promise.all(O7(t, i, r)); } return n.then(() => { t.notify("AnimationComplete", e); }); } -const aee = Cb.length; -function R7(t) { +const mee = Cb.length; +function N7(t) { if (!t) return; if (!t.isControllingVariants) { - const r = t.parent ? R7(t.parent) || {} : {}; + const r = t.parent ? N7(t.parent) || {} : {}; return t.props.initial !== void 0 && (r.initial = t.props.initial), r; } const e = {}; - for (let r = 0; r < aee; r++) { + for (let r = 0; r < mee; r++) { const n = Cb[r], i = t.props[n]; - (Ml(i) || i === !1) && (e[n] = i); + (Il(i) || i === !1) && (e[n] = i); } return e; } -const cee = [...Ib].reverse(), uee = Ib.length; -function fee(t) { - return (e) => Promise.all(e.map(({ animation: r, options: n }) => oee(t, r, n))); +const vee = [...Ib].reverse(), bee = Ib.length; +function yee(t) { + return (e) => Promise.all(e.map(({ animation: r, options: n }) => gee(t, r, n))); } -function lee(t) { - let e = fee(t), r = h6(), n = !0; +function wee(t) { + let e = yee(t), r = p_(), n = !0; const i = (u) => (l, d) => { - var g; - const w = bp(t, d, u === "exit" ? (g = t.presenceContext) === null || g === void 0 ? void 0 : g.custom : void 0); + var p; + const w = yp(t, d, u === "exit" ? (p = t.presenceContext) === null || p === void 0 ? void 0 : p.custom : void 0); if (w) { - const { transition: A, transitionEnd: M, ...N } = w; - l = { ...l, ...N, ...M }; + const { transition: A, transitionEnd: P, ...N } = w; + l = { ...l, ...N, ...P }; } return l; }; @@ -32962,29 +32962,29 @@ function lee(t) { e = u(t); } function o(u) { - const { props: l } = t, d = R7(t.parent) || {}, g = [], w = /* @__PURE__ */ new Set(); - let A = {}, M = 1 / 0; - for (let L = 0; L < uee; L++) { - const $ = cee[L], F = r[$], K = l[$] !== void 0 ? l[$] : d[$], H = Ml(K), V = $ === u ? F.isActive : null; - V === !1 && (M = L); - let te = K === d[$] && K !== l[$] && H; - if (te && n && t.manuallyAnimateOnMount && (te = !1), F.protectedKeys = { ...A }, // If it isn't active and hasn't *just* been set as inactive - !F.isActive && V === null || // If we didn't and don't have any defined prop for this animation type - !K && !F.prevProp || // Or if the prop doesn't define an animation - vp(K) || typeof K == "boolean") + const { props: l } = t, d = N7(t.parent) || {}, p = [], w = /* @__PURE__ */ new Set(); + let A = {}, P = 1 / 0; + for (let L = 0; L < bee; L++) { + const $ = vee[L], B = r[$], H = l[$] !== void 0 ? l[$] : d[$], W = Il(H), V = $ === u ? B.isActive : null; + V === !1 && (P = L); + let te = H === d[$] && H !== l[$] && W; + if (te && n && t.manuallyAnimateOnMount && (te = !1), B.protectedKeys = { ...A }, // If it isn't active and hasn't *just* been set as inactive + !B.isActive && V === null || // If we didn't and don't have any defined prop for this animation type + !H && !B.prevProp || // Or if the prop doesn't define an animation + bp(H) || typeof H == "boolean") continue; - const R = hee(F.prevProp, K); - let W = R || // If we're making this variant active, we want to always make it active - $ === u && F.isActive && !te && H || // If we removed a higher-priority variant (i is in reverse order) - L > M && H, pe = !1; - const Ee = Array.isArray(K) ? K : [K]; + const R = xee(B.prevProp, H); + let K = R || // If we're making this variant active, we want to always make it active + $ === u && B.isActive && !te && W || // If we removed a higher-priority variant (i is in reverse order) + L > P && W, ge = !1; + const Ee = Array.isArray(H) ? H : [H]; let Y = Ee.reduce(i($), {}); V === !1 && (Y = {}); - const { prevResolvedValues: S = {} } = F, m = { + const { prevResolvedValues: S = {} } = B, m = { ...S, ...Y }, f = (x) => { - W = !0, w.has(x) && (pe = !0, w.delete(x)), F.needsAnimating[x] = !0; + K = !0, w.has(x) && (ge = !0, w.delete(x)), B.needsAnimating[x] = !0; const _ = t.getValue(x); _ && (_.liveStyle = !1); }; @@ -32993,9 +32993,9 @@ function lee(t) { if (A.hasOwnProperty(x)) continue; let v = !1; - J1(_) && J1(E) ? v = !KS(_, E) : v = _ !== E, v ? _ != null ? f(x) : w.add(x) : _ !== void 0 && w.has(x) ? f(x) : F.protectedKeys[x] = !0; + J1(_) && J1(E) ? v = !YS(_, E) : v = _ !== E, v ? _ != null ? f(x) : w.add(x) : _ !== void 0 && w.has(x) ? f(x) : B.protectedKeys[x] = !0; } - F.prevProp = K, F.prevResolvedValues = Y, F.isActive && (A = { ...A, ...Y }), n && t.blockInitialAnimation && (W = !1), W && (!(te && R) || pe) && g.push(...Ee.map((x) => ({ + B.prevProp = H, B.prevResolvedValues = Y, B.isActive && (A = { ...A, ...Y }), n && t.blockInitialAnimation && (K = !1), K && (!(te && R) || ge) && p.push(...Ee.map((x) => ({ animation: x, options: { type: $ } }))); @@ -33003,12 +33003,12 @@ function lee(t) { if (w.size) { const L = {}; w.forEach(($) => { - const F = t.getBaseTarget($), K = t.getValue($); - K && (K.liveStyle = !0), L[$] = F ?? null; - }), g.push({ animation: L }); + const B = t.getBaseTarget($), H = t.getValue($); + H && (H.liveStyle = !0), L[$] = B ?? null; + }), p.push({ animation: L }); } - let N = !!g.length; - return n && (l.initial === !1 || l.initial === l.animate) && !t.manuallyAnimateOnMount && (N = !1), n = !1, N ? e(g) : Promise.resolve(); + let N = !!p.length; + return n && (l.initial === !1 || l.initial === l.animate) && !t.manuallyAnimateOnMount && (N = !1), n = !1, N ? e(p) : Promise.resolve(); } function a(u, l) { var d; @@ -33018,10 +33018,10 @@ function lee(t) { var A; return (A = w.animationState) === null || A === void 0 ? void 0 : A.setActive(u, l); }), r[u].isActive = l; - const g = o(u); + const p = o(u); for (const w in r) r[w].protectedKeys = {}; - return g; + return p; } return { animateChanges: o, @@ -33029,14 +33029,14 @@ function lee(t) { setAnimateFunction: s, getState: () => r, reset: () => { - r = h6(), n = !0; + r = p_(), n = !0; } }; } -function hee(t, e) { - return typeof e == "string" ? e !== t : Array.isArray(e) ? !KS(e, t) : !1; +function xee(t, e) { + return typeof e == "string" ? e !== t : Array.isArray(e) ? !YS(e, t) : !1; } -function Ka(t = !1) { +function Ya(t = !1) { return { isActive: t, protectedKeys: {}, @@ -33044,36 +33044,36 @@ function Ka(t = !1) { prevResolvedValues: {} }; } -function h6() { +function p_() { return { - animate: Ka(!0), - whileInView: Ka(), - whileHover: Ka(), - whileTap: Ka(), - whileDrag: Ka(), - whileFocus: Ka(), - exit: Ka() + animate: Ya(!0), + whileInView: Ya(), + whileHover: Ya(), + whileTap: Ya(), + whileDrag: Ya(), + whileFocus: Ya(), + exit: Ya() }; } -class Ta { +class Oa { constructor(e) { this.isMounted = !1, this.node = e; } update() { } } -class dee extends Ta { +class _ee extends Oa { /** * We dynamically generate the AnimationState manager as it contains a reference * to the underlying animation library. We only want to load that if we load this, * so people can optionally code split it out using the `m` component. */ constructor(e) { - super(e), e.animationState || (e.animationState = lee(e)); + super(e), e.animationState || (e.animationState = wee(e)); } updateAnimationControlsSubscription() { const { animate: e } = this.node.getProps(); - vp(e) && (this.unmountControls = e.subscribe(this.node)); + bp(e) && (this.unmountControls = e.subscribe(this.node)); } /** * Subscribe any provided AnimationControls to the component's VisualElement @@ -33090,10 +33090,10 @@ class dee extends Ta { this.node.animationState.reset(), (e = this.unmountControls) === null || e === void 0 || e.call(this); } } -let pee = 0; -class gee extends Ta { +let Eee = 0; +class See extends Oa { constructor() { - super(...arguments), this.id = pee++; + super(...arguments), this.id = Eee++; } update() { if (!this.node.presenceContext) @@ -33111,15 +33111,15 @@ class gee extends Ta { unmount() { } } -const mee = { +const Aee = { animation: { - Feature: dee + Feature: _ee }, exit: { - Feature: gee + Feature: See } -}, D7 = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1; -function wp(t, e = "page") { +}, L7 = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1; +function xp(t, e = "page") { return { point: { x: t[`${e}X`], @@ -33127,84 +33127,84 @@ function wp(t, e = "page") { } }; } -const vee = (t) => (e) => D7(e) && t(e, wp(e)); -function Po(t, e, r, n = { passive: !0 }) { +const Pee = (t) => (e) => L7(e) && t(e, xp(e)); +function Co(t, e, r, n = { passive: !0 }) { return t.addEventListener(e, r, n), () => t.removeEventListener(e, r); } -function Ro(t, e, r, n) { - return Po(t, e, vee(r), n); +function No(t, e, r, n) { + return Co(t, e, Pee(r), n); } -const d6 = (t, e) => Math.abs(t - e); -function bee(t, e) { - const r = d6(t.x, e.x), n = d6(t.y, e.y); +const g_ = (t, e) => Math.abs(t - e); +function Mee(t, e) { + const r = g_(t.x, e.x), n = g_(t.y, e.y); return Math.sqrt(r ** 2 + n ** 2); } -class O7 { +class k7 { constructor(e, r, { transformPagePoint: n, contextWindow: i, dragSnapToOrigin: s = !1 } = {}) { if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.updatePoint = () => { if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return; - const g = Fm(this.lastMoveEventInfo, this.history), w = this.startEvent !== null, A = bee(g.offset, { x: 0, y: 0 }) >= 3; + const p = Bm(this.lastMoveEventInfo, this.history), w = this.startEvent !== null, A = Mee(p.offset, { x: 0, y: 0 }) >= 3; if (!w && !A) return; - const { point: M } = g, { timestamp: N } = Fn; - this.history.push({ ...M, timestamp: N }); + const { point: P } = p, { timestamp: N } = Fn; + this.history.push({ ...P, timestamp: N }); const { onStart: L, onMove: $ } = this.handlers; - w || (L && L(this.lastMoveEvent, g), this.startEvent = this.lastMoveEvent), $ && $(this.lastMoveEvent, g); - }, this.handlePointerMove = (g, w) => { - this.lastMoveEvent = g, this.lastMoveEventInfo = $m(w, this.transformPagePoint), Lr.update(this.updatePoint, !0); - }, this.handlePointerUp = (g, w) => { + w || (L && L(this.lastMoveEvent, p), this.startEvent = this.lastMoveEvent), $ && $(this.lastMoveEvent, p); + }, this.handlePointerMove = (p, w) => { + this.lastMoveEvent = p, this.lastMoveEventInfo = $m(w, this.transformPagePoint), Lr.update(this.updatePoint, !0); + }, this.handlePointerUp = (p, w) => { this.end(); - const { onEnd: A, onSessionEnd: M, resumeAnimation: N } = this.handlers; + const { onEnd: A, onSessionEnd: P, resumeAnimation: N } = this.handlers; if (this.dragSnapToOrigin && N && N(), !(this.lastMoveEvent && this.lastMoveEventInfo)) return; - const L = Fm(g.type === "pointercancel" ? this.lastMoveEventInfo : $m(w, this.transformPagePoint), this.history); - this.startEvent && A && A(g, L), M && M(g, L); - }, !D7(e)) + const L = Bm(p.type === "pointercancel" ? this.lastMoveEventInfo : $m(w, this.transformPagePoint), this.history); + this.startEvent && A && A(p, L), P && P(p, L); + }, !L7(e)) return; this.dragSnapToOrigin = s, this.handlers = r, this.transformPagePoint = n, this.contextWindow = i || window; - const o = wp(e), a = $m(o, this.transformPagePoint), { point: u } = a, { timestamp: l } = Fn; + const o = xp(e), a = $m(o, this.transformPagePoint), { point: u } = a, { timestamp: l } = Fn; this.history = [{ ...u, timestamp: l }]; const { onSessionStart: d } = r; - d && d(e, Fm(a, this.history)), this.removeListeners = To(Ro(this.contextWindow, "pointermove", this.handlePointerMove), Ro(this.contextWindow, "pointerup", this.handlePointerUp), Ro(this.contextWindow, "pointercancel", this.handlePointerUp)); + d && d(e, Bm(a, this.history)), this.removeListeners = Oo(No(this.contextWindow, "pointermove", this.handlePointerMove), No(this.contextWindow, "pointerup", this.handlePointerUp), No(this.contextWindow, "pointercancel", this.handlePointerUp)); } updateHandlers(e) { this.handlers = e; } end() { - this.removeListeners && this.removeListeners(), wa(this.updatePoint); + this.removeListeners && this.removeListeners(), Ea(this.updatePoint); } } function $m(t, e) { return e ? { point: e(t.point) } : t; } -function p6(t, e) { +function m_(t, e) { return { x: t.x - e.x, y: t.y - e.y }; } -function Fm({ point: t }, e) { +function Bm({ point: t }, e) { return { point: t, - delta: p6(t, N7(e)), - offset: p6(t, yee(e)), - velocity: wee(e, 0.1) + delta: m_(t, $7(e)), + offset: m_(t, Iee(e)), + velocity: Cee(e, 0.1) }; } -function yee(t) { +function Iee(t) { return t[0]; } -function N7(t) { +function $7(t) { return t[t.length - 1]; } -function wee(t, e) { +function Cee(t, e) { if (t.length < 2) return { x: 0, y: 0 }; let r = t.length - 1, n = null; - const i = N7(t); - for (; r >= 0 && (n = t[r], !(i.timestamp - n.timestamp > Ks(e))); ) + const i = $7(t); + for (; r >= 0 && (n = t[r], !(i.timestamp - n.timestamp > Vs(e))); ) r--; if (!n) return { x: 0, y: 0 }; - const s = Co(i.timestamp - n.timestamp); + const s = Do(i.timestamp - n.timestamp); if (s === 0) return { x: 0, y: 0 }; const o = { @@ -33213,7 +33213,7 @@ function wee(t, e) { }; return o.x === 1 / 0 && (o.x = 0), o.y === 1 / 0 && (o.y = 0), o; } -function L7(t) { +function B7(t) { let e = null; return () => { const r = () => { @@ -33222,128 +33222,128 @@ function L7(t) { return e === null ? (e = t, r) : !1; }; } -const g6 = L7("dragHorizontal"), m6 = L7("dragVertical"); -function k7(t) { +const v_ = B7("dragHorizontal"), b_ = B7("dragVertical"); +function F7(t) { let e = !1; if (t === "y") - e = m6(); + e = b_(); else if (t === "x") - e = g6(); + e = v_(); else { - const r = g6(), n = m6(); + const r = v_(), n = b_(); r && n ? e = () => { r(), n(); } : (r && r(), n && n()); } return e; } -function $7() { - const t = k7(!0); +function j7() { + const t = F7(!0); return t ? (t(), !1) : !0; } -function eu(t) { +function tu(t) { return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current"); } -const F7 = 1e-4, xee = 1 - F7, _ee = 1 + F7, B7 = 0.01, Eee = 0 - B7, See = 0 + B7; -function Li(t) { +const U7 = 1e-4, Tee = 1 - U7, Ree = 1 + U7, q7 = 0.01, Dee = 0 - q7, Oee = 0 + q7; +function ki(t) { return t.max - t.min; } -function Aee(t, e, r) { +function Nee(t, e, r) { return Math.abs(t - e) <= r; } -function v6(t, e, r, n = 0.5) { - t.origin = n, t.originPoint = Qr(e.min, e.max, t.origin), t.scale = Li(r) / Li(e), t.translate = Qr(r.min, r.max, t.origin) - t.originPoint, (t.scale >= xee && t.scale <= _ee || isNaN(t.scale)) && (t.scale = 1), (t.translate >= Eee && t.translate <= See || isNaN(t.translate)) && (t.translate = 0); +function y_(t, e, r, n = 0.5) { + t.origin = n, t.originPoint = Qr(e.min, e.max, t.origin), t.scale = ki(r) / ki(e), t.translate = Qr(r.min, r.max, t.origin) - t.originPoint, (t.scale >= Tee && t.scale <= Ree || isNaN(t.scale)) && (t.scale = 1), (t.translate >= Dee && t.translate <= Oee || isNaN(t.translate)) && (t.translate = 0); } -function Yf(t, e, r, n) { - v6(t.x, e.x, r.x, n ? n.originX : void 0), v6(t.y, e.y, r.y, n ? n.originY : void 0); +function Jf(t, e, r, n) { + y_(t.x, e.x, r.x, n ? n.originX : void 0), y_(t.y, e.y, r.y, n ? n.originY : void 0); } -function b6(t, e, r) { - t.min = r.min + e.min, t.max = t.min + Li(e); +function w_(t, e, r) { + t.min = r.min + e.min, t.max = t.min + ki(e); } -function Pee(t, e, r) { - b6(t.x, e.x, r.x), b6(t.y, e.y, r.y); +function Lee(t, e, r) { + w_(t.x, e.x, r.x), w_(t.y, e.y, r.y); } -function y6(t, e, r) { - t.min = e.min - r.min, t.max = t.min + Li(e); +function x_(t, e, r) { + t.min = e.min - r.min, t.max = t.min + ki(e); } -function Jf(t, e, r) { - y6(t.x, e.x, r.x), y6(t.y, e.y, r.y); +function Xf(t, e, r) { + x_(t.x, e.x, r.x), x_(t.y, e.y, r.y); } -function Mee(t, { min: e, max: r }, n) { +function kee(t, { min: e, max: r }, n) { return e !== void 0 && t < e ? t = n ? Qr(e, t, n.min) : Math.max(t, e) : r !== void 0 && t > r && (t = n ? Qr(r, t, n.max) : Math.min(t, r)), t; } -function w6(t, e, r) { +function __(t, e, r) { return { min: e !== void 0 ? t.min + e : void 0, max: r !== void 0 ? t.max + r - (t.max - t.min) : void 0 }; } -function Iee(t, { top: e, left: r, bottom: n, right: i }) { +function $ee(t, { top: e, left: r, bottom: n, right: i }) { return { - x: w6(t.x, r, i), - y: w6(t.y, e, n) + x: __(t.x, r, i), + y: __(t.y, e, n) }; } -function x6(t, e) { +function E_(t, e) { let r = e.min - t.min, n = e.max - t.max; return e.max - e.min < t.max - t.min && ([r, n] = [n, r]), { min: r, max: n }; } -function Cee(t, e) { +function Bee(t, e) { return { - x: x6(t.x, e.x), - y: x6(t.y, e.y) + x: E_(t.x, e.x), + y: E_(t.y, e.y) }; } -function Tee(t, e) { +function Fee(t, e) { let r = 0.5; - const n = Li(t), i = Li(e); - return i > n ? r = Mu(e.min, e.max - n, t.min) : n > i && (r = Mu(t.min, t.max - i, e.min)), xa(0, 1, r); + const n = ki(t), i = ki(e); + return i > n ? r = Iu(e.min, e.max - n, t.min) : n > i && (r = Iu(t.min, t.max - i, e.min)), Sa(0, 1, r); } -function Ree(t, e) { +function jee(t, e) { const r = {}; return e.min !== void 0 && (r.min = e.min - t.min), e.max !== void 0 && (r.max = e.max - t.min), r; } const ov = 0.35; -function Dee(t = ov) { +function Uee(t = ov) { return t === !1 ? t = 0 : t === !0 && (t = ov), { - x: _6(t, "left", "right"), - y: _6(t, "top", "bottom") + x: S_(t, "left", "right"), + y: S_(t, "top", "bottom") }; } -function _6(t, e, r) { +function S_(t, e, r) { return { - min: E6(t, e), - max: E6(t, r) + min: A_(t, e), + max: A_(t, r) }; } -function E6(t, e) { +function A_(t, e) { return typeof t == "number" ? t : t[e] || 0; } -const S6 = () => ({ +const P_ = () => ({ translate: 0, scale: 1, origin: 0, originPoint: 0 -}), tu = () => ({ - x: S6(), - y: S6() -}), A6 = () => ({ min: 0, max: 0 }), ln = () => ({ - x: A6(), - y: A6() +}), ru = () => ({ + x: P_(), + y: P_() +}), M_ = () => ({ min: 0, max: 0 }), ln = () => ({ + x: M_(), + y: M_() }); -function Xi(t) { +function Zi(t) { return [t("x"), t("y")]; } -function U7({ top: t, left: e, right: r, bottom: n }) { +function z7({ top: t, left: e, right: r, bottom: n }) { return { x: { min: e, max: r }, y: { min: t, max: n } }; } -function Oee({ x: t, y: e }) { +function qee({ x: t, y: e }) { return { top: e.min, right: t.max, bottom: e.max, left: t.min }; } -function Nee(t, e) { +function zee(t, e) { if (!e) return t; const r = e({ x: t.left, y: t.top }), n = e({ x: t.right, y: t.bottom }); @@ -33354,36 +33354,36 @@ function Nee(t, e) { right: n.x }; } -function Bm(t) { +function Fm(t) { return t === void 0 || t === 1; } function av({ scale: t, scaleX: e, scaleY: r }) { - return !Bm(t) || !Bm(e) || !Bm(r); + return !Fm(t) || !Fm(e) || !Fm(r); } -function Ga(t) { - return av(t) || j7(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY; +function Xa(t) { + return av(t) || W7(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY; } -function j7(t) { - return P6(t.x) || P6(t.y); +function W7(t) { + return I_(t.x) || I_(t.y); } -function P6(t) { +function I_(t) { return t && t !== "0%"; } -function w0(t, e, r) { +function x0(t, e, r) { const n = t - r, i = e * n; return r + i; } -function M6(t, e, r, n, i) { - return i !== void 0 && (t = w0(t, i, n)), w0(t, r, n) + e; +function C_(t, e, r, n, i) { + return i !== void 0 && (t = x0(t, i, n)), x0(t, r, n) + e; } function cv(t, e = 0, r = 1, n, i) { - t.min = M6(t.min, e, r, n, i), t.max = M6(t.max, e, r, n, i); + t.min = C_(t.min, e, r, n, i), t.max = C_(t.max, e, r, n, i); } -function q7(t, { x: e, y: r }) { +function H7(t, { x: e, y: r }) { cv(t.x, e.translate, e.scale, e.originPoint), cv(t.y, r.translate, r.scale, r.originPoint); } -const I6 = 0.999999999999, C6 = 1.0000000000001; -function Lee(t, e, r, n = !1) { +const T_ = 0.999999999999, R_ = 1.0000000000001; +function Wee(t, e, r, n = !1) { const i = r.length; if (!i) return; @@ -33392,32 +33392,32 @@ function Lee(t, e, r, n = !1) { for (let a = 0; a < i; a++) { s = r[a], o = s.projectionDelta; const { visualElement: u } = s.options; - u && u.props.style && u.props.style.display === "contents" || (n && s.options.layoutScroll && s.scroll && s !== s.root && nu(t, { + u && u.props.style && u.props.style.display === "contents" || (n && s.options.layoutScroll && s.scroll && s !== s.root && iu(t, { x: -s.scroll.offset.x, y: -s.scroll.offset.y - }), o && (e.x *= o.x.scale, e.y *= o.y.scale, q7(t, o)), n && Ga(s.latestValues) && nu(t, s.latestValues)); + }), o && (e.x *= o.x.scale, e.y *= o.y.scale, H7(t, o)), n && Xa(s.latestValues) && iu(t, s.latestValues)); } - e.x < C6 && e.x > I6 && (e.x = 1), e.y < C6 && e.y > I6 && (e.y = 1); + e.x < R_ && e.x > T_ && (e.x = 1), e.y < R_ && e.y > T_ && (e.y = 1); } -function ru(t, e) { +function nu(t, e) { t.min = t.min + e, t.max = t.max + e; } -function T6(t, e, r, n, i = 0.5) { +function D_(t, e, r, n, i = 0.5) { const s = Qr(t.min, t.max, i); cv(t, e, r, s, n); } -function nu(t, e) { - T6(t.x, e.x, e.scaleX, e.scale, e.originX), T6(t.y, e.y, e.scaleY, e.scale, e.originY); +function iu(t, e) { + D_(t.x, e.x, e.scaleX, e.scale, e.originX), D_(t.y, e.y, e.scaleY, e.scale, e.originY); } -function z7(t, e) { - return U7(Nee(t.getBoundingClientRect(), e)); +function K7(t, e) { + return z7(zee(t.getBoundingClientRect(), e)); } -function kee(t, e, r) { - const n = z7(t, r), { scroll: i } = e; - return i && (ru(n.x, i.offset.x), ru(n.y, i.offset.y)), n; +function Hee(t, e, r) { + const n = K7(t, r), { scroll: i } = e; + return i && (nu(n.x, i.offset.x), nu(n.y, i.offset.y)), n; } -const H7 = ({ current: t }) => t ? t.ownerDocument.defaultView : null, $ee = /* @__PURE__ */ new WeakMap(); -class Fee { +const V7 = ({ current: t }) => t ? t.ownerDocument.defaultView : null, Kee = /* @__PURE__ */ new WeakMap(); +class Vee { constructor(e) { this.openGlobalLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = ln(), this.visualElement = e; } @@ -33426,40 +33426,40 @@ class Fee { if (n && n.isPresent === !1) return; const i = (d) => { - const { dragSnapToOrigin: g } = this.getProps(); - g ? this.pauseAnimation() : this.stopAnimation(), r && this.snapToCursor(wp(d, "page").point); - }, s = (d, g) => { - const { drag: w, dragPropagation: A, onDragStart: M } = this.getProps(); - if (w && !A && (this.openGlobalLock && this.openGlobalLock(), this.openGlobalLock = k7(w), !this.openGlobalLock)) + const { dragSnapToOrigin: p } = this.getProps(); + p ? this.pauseAnimation() : this.stopAnimation(), r && this.snapToCursor(xp(d, "page").point); + }, s = (d, p) => { + const { drag: w, dragPropagation: A, onDragStart: P } = this.getProps(); + if (w && !A && (this.openGlobalLock && this.openGlobalLock(), this.openGlobalLock = F7(w), !this.openGlobalLock)) return; - this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), Xi((L) => { + this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), Zi((L) => { let $ = this.getAxisMotionValue(L).get() || 0; - if (Vs.test($)) { - const { projection: F } = this.visualElement; - if (F && F.layout) { - const K = F.layout.layoutBox[L]; - K && ($ = Li(K) * (parseFloat($) / 100)); + if (Gs.test($)) { + const { projection: B } = this.visualElement; + if (B && B.layout) { + const H = B.layout.layoutBox[L]; + H && ($ = ki(H) * (parseFloat($) / 100)); } } this.originPoint[L] = $; - }), M && Lr.postRender(() => M(d, g)), iv(this.visualElement, "transform"); + }), P && Lr.postRender(() => P(d, p)), iv(this.visualElement, "transform"); const { animationState: N } = this.visualElement; N && N.setActive("whileDrag", !0); - }, o = (d, g) => { - const { dragPropagation: w, dragDirectionLock: A, onDirectionLock: M, onDrag: N } = this.getProps(); + }, o = (d, p) => { + const { dragPropagation: w, dragDirectionLock: A, onDirectionLock: P, onDrag: N } = this.getProps(); if (!w && !this.openGlobalLock) return; - const { offset: L } = g; + const { offset: L } = p; if (A && this.currentDirection === null) { - this.currentDirection = Bee(L), this.currentDirection !== null && M && M(this.currentDirection); + this.currentDirection = Gee(L), this.currentDirection !== null && P && P(this.currentDirection); return; } - this.updateAxis("x", g.point, L), this.updateAxis("y", g.point, L), this.visualElement.render(), N && N(d, g); - }, a = (d, g) => this.stop(d, g), u = () => Xi((d) => { - var g; - return this.getAnimationState(d) === "paused" && ((g = this.getAxisMotionValue(d).animation) === null || g === void 0 ? void 0 : g.play()); + this.updateAxis("x", p.point, L), this.updateAxis("y", p.point, L), this.visualElement.render(), N && N(d, p); + }, a = (d, p) => this.stop(d, p), u = () => Zi((d) => { + var p; + return this.getAnimationState(d) === "paused" && ((p = this.getAxisMotionValue(d).animation) === null || p === void 0 ? void 0 : p.play()); }), { dragSnapToOrigin: l } = this.getProps(); - this.panSession = new O7(e, { + this.panSession = new k7(e, { onSessionStart: i, onStart: s, onMove: o, @@ -33468,7 +33468,7 @@ class Fee { }, { transformPagePoint: this.visualElement.getTransformPagePoint(), dragSnapToOrigin: l, - contextWindow: H7(this.visualElement) + contextWindow: V7(this.visualElement) }); } stop(e, r) { @@ -33489,43 +33489,43 @@ class Fee { } updateAxis(e, r, n) { const { drag: i } = this.getProps(); - if (!n || !md(e, i, this.currentDirection)) + if (!n || !vd(e, i, this.currentDirection)) return; const s = this.getAxisMotionValue(e); let o = this.originPoint[e] + n[e]; - this.constraints && this.constraints[e] && (o = Mee(o, this.constraints[e], this.elastic[e])), s.set(o); + this.constraints && this.constraints[e] && (o = kee(o, this.constraints[e], this.elastic[e])), s.set(o); } resolveConstraints() { var e; const { dragConstraints: r, dragElastic: n } = this.getProps(), i = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : (e = this.visualElement.projection) === null || e === void 0 ? void 0 : e.layout, s = this.constraints; - r && eu(r) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : r && i ? this.constraints = Iee(i.layoutBox, r) : this.constraints = !1, this.elastic = Dee(n), s !== this.constraints && i && this.constraints && !this.hasMutatedConstraints && Xi((o) => { - this.constraints !== !1 && this.getAxisMotionValue(o) && (this.constraints[o] = Ree(i.layoutBox[o], this.constraints[o])); + r && tu(r) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : r && i ? this.constraints = $ee(i.layoutBox, r) : this.constraints = !1, this.elastic = Uee(n), s !== this.constraints && i && this.constraints && !this.hasMutatedConstraints && Zi((o) => { + this.constraints !== !1 && this.getAxisMotionValue(o) && (this.constraints[o] = jee(i.layoutBox[o], this.constraints[o])); }); } resolveRefConstraints() { const { dragConstraints: e, onMeasureDragConstraints: r } = this.getProps(); - if (!e || !eu(e)) + if (!e || !tu(e)) return !1; const n = e.current; - Uo(n !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop."); + zo(n !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop."); const { projection: i } = this.visualElement; if (!i || !i.layout) return !1; - const s = kee(n, i.root, this.visualElement.getTransformPagePoint()); - let o = Cee(i.layout.layoutBox, s); + const s = Hee(n, i.root, this.visualElement.getTransformPagePoint()); + let o = Bee(i.layout.layoutBox, s); if (r) { - const a = r(Oee(o)); - this.hasMutatedConstraints = !!a, a && (o = U7(a)); + const a = r(qee(o)); + this.hasMutatedConstraints = !!a, a && (o = z7(a)); } return o; } startAnimation(e) { - const { drag: r, dragMomentum: n, dragElastic: i, dragTransition: s, dragSnapToOrigin: o, onDragTransitionEnd: a } = this.getProps(), u = this.constraints || {}, l = Xi((d) => { - if (!md(d, r, this.currentDirection)) + const { drag: r, dragMomentum: n, dragElastic: i, dragTransition: s, dragSnapToOrigin: o, onDragTransitionEnd: a } = this.getProps(), u = this.constraints || {}, l = Zi((d) => { + if (!vd(d, r, this.currentDirection)) return; - let g = u && u[d] || {}; - o && (g = { min: 0, max: 0 }); - const w = i ? 200 : 1e6, A = i ? 40 : 1e7, M = { + let p = u && u[d] || {}; + o && (p = { min: 0, max: 0 }); + const w = i ? 200 : 1e6, A = i ? 40 : 1e7, P = { type: "inertia", velocity: n ? e[d] : 0, bounceStiffness: w, @@ -33534,21 +33534,21 @@ class Fee { restDelta: 1, restSpeed: 10, ...s, - ...g + ...p }; - return this.startAxisValueAnimation(d, M); + return this.startAxisValueAnimation(d, P); }); return Promise.all(l).then(a); } startAxisValueAnimation(e, r) { const n = this.getAxisMotionValue(e); - return iv(this.visualElement, e), n.start(Hb(e, n, 0, r, this.visualElement, !1)); + return iv(this.visualElement, e), n.start(Wb(e, n, 0, r, this.visualElement, !1)); } stopAnimation() { - Xi((e) => this.getAxisMotionValue(e).stop()); + Zi((e) => this.getAxisMotionValue(e).stop()); } pauseAnimation() { - Xi((e) => { + Zi((e) => { var r; return (r = this.getAxisMotionValue(e).animation) === null || r === void 0 ? void 0 : r.pause(); }); @@ -33568,9 +33568,9 @@ class Fee { return i || this.visualElement.getValue(e, (n.initial ? n.initial[e] : void 0) || 0); } snapToCursor(e) { - Xi((r) => { + Zi((r) => { const { drag: n } = this.getProps(); - if (!md(r, n, this.currentDirection)) + if (!vd(r, n, this.currentDirection)) return; const { projection: i } = this.visualElement, s = this.getAxisMotionValue(r); if (i && i.layout) { @@ -33588,20 +33588,20 @@ class Fee { if (!this.visualElement.current) return; const { drag: e, dragConstraints: r } = this.getProps(), { projection: n } = this.visualElement; - if (!eu(r) || !n || !this.constraints) + if (!tu(r) || !n || !this.constraints) return; this.stopAnimation(); const i = { x: 0, y: 0 }; - Xi((o) => { + Zi((o) => { const a = this.getAxisMotionValue(o); if (a && this.constraints !== !1) { const u = a.get(); - i[o] = Tee({ min: u, max: u }, this.constraints[o]); + i[o] = Fee({ min: u, max: u }, this.constraints[o]); } }); const { transformTemplate: s } = this.visualElement.getProps(); - this.visualElement.current.style.transform = s ? s({}, "") : "none", n.root && n.root.updateScroll(), n.updateLayout(), this.resolveConstraints(), Xi((o) => { - if (!md(o, e, null)) + this.visualElement.current.style.transform = s ? s({}, "") : "none", n.root && n.root.updateScroll(), n.updateLayout(), this.resolveConstraints(), Zi((o) => { + if (!vd(o, e, null)) return; const a = this.getAxisMotionValue(o), { min: u, max: l } = this.constraints[o]; a.set(Qr(u, l, i[o])); @@ -33610,19 +33610,19 @@ class Fee { addListeners() { if (!this.visualElement.current) return; - $ee.set(this.visualElement, this); - const e = this.visualElement.current, r = Ro(e, "pointerdown", (u) => { + Kee.set(this.visualElement, this); + const e = this.visualElement.current, r = No(e, "pointerdown", (u) => { const { drag: l, dragListener: d = !0 } = this.getProps(); l && d && this.start(u); }), n = () => { const { dragConstraints: u } = this.getProps(); - eu(u) && u.current && (this.constraints = this.resolveRefConstraints()); + tu(u) && u.current && (this.constraints = this.resolveRefConstraints()); }, { projection: i } = this.visualElement, s = i.addEventListener("measure", n); i && !i.layout && (i.root && i.root.updateScroll(), i.updateLayout()), Lr.read(n); - const o = Po(window, "resize", () => this.scalePositionWithinConstraints()), a = i.addEventListener("didUpdate", ({ delta: u, hasLayoutChanged: l }) => { - this.isDragging && l && (Xi((d) => { - const g = this.getAxisMotionValue(d); - g && (this.originPoint[d] += u[d].translate, g.set(g.get() + u[d].translate)); + const o = Co(window, "resize", () => this.scalePositionWithinConstraints()), a = i.addEventListener("didUpdate", ({ delta: u, hasLayoutChanged: l }) => { + this.isDragging && l && (Zi((d) => { + const p = this.getAxisMotionValue(d); + p && (this.originPoint[d] += u[d].translate, p.set(p.get() + u[d].translate)); }), this.visualElement.render()); }); return () => { @@ -33642,16 +33642,16 @@ class Fee { }; } } -function md(t, e, r) { +function vd(t, e, r) { return (e === !0 || e === t) && (r === null || r === t); } -function Bee(t, e = 10) { +function Gee(t, e = 10) { let r = null; return Math.abs(t.y) > e ? r = "y" : Math.abs(t.x) > e && (r = "x"), r; } -class Uee extends Ta { +class Yee extends Oa { constructor(e) { - super(e), this.removeGroupControls = Un, this.removeListeners = Un, this.controls = new Fee(e); + super(e), this.removeGroupControls = Un, this.removeListeners = Un, this.controls = new Vee(e); } mount() { const { dragControls: e } = this.node.getProps(); @@ -33661,24 +33661,24 @@ class Uee extends Ta { this.removeGroupControls(), this.removeListeners(); } } -const R6 = (t) => (e, r) => { +const O_ = (t) => (e, r) => { t && Lr.postRender(() => t(e, r)); }; -class jee extends Ta { +class Jee extends Oa { constructor() { super(...arguments), this.removePointerDownListener = Un; } onPointerDown(e) { - this.session = new O7(e, this.createPanHandlers(), { + this.session = new k7(e, this.createPanHandlers(), { transformPagePoint: this.node.getTransformPagePoint(), - contextWindow: H7(this.node) + contextWindow: V7(this.node) }); } createPanHandlers() { const { onPanSessionStart: e, onPanStart: r, onPan: n, onPanEnd: i } = this.node.getProps(); return { - onSessionStart: R6(e), - onStart: R6(r), + onSessionStart: O_(e), + onStart: O_(r), onMove: n, onEnd: (s, o) => { delete this.session, i && Lr.postRender(() => i(s, o)); @@ -33686,7 +33686,7 @@ class jee extends Ta { }; } mount() { - this.removePointerDownListener = Ro(this.node.current, "pointerdown", (e) => this.onPointerDown(e)); + this.removePointerDownListener = No(this.node.current, "pointerdown", (e) => this.onPointerDown(e)); } update() { this.session && this.session.updateHandlers(this.createPanHandlers()); @@ -33695,17 +33695,17 @@ class jee extends Ta { this.removePointerDownListener(), this.session && this.session.end(); } } -const xp = Sa(null); -function qee() { - const t = Tn(xp); +const _p = Ma(null); +function Xee() { + const t = Tn(_p); if (t === null) return [!0, null]; const { isPresent: e, onExitComplete: r, register: n } = t, i = mv(); - Xn(() => n(i), []); + Dn(() => n(i), []); const s = vv(() => r && r(i), [i, r]); return !e && r ? [!1, s] : [!0]; } -const Yb = Sa({}), W7 = Sa({}), Bd = { +const Yb = Ma({}), G7 = Ma({}), jd = { /** * Global flag as to whether the tree has animated since the last time * we resized the window @@ -33717,10 +33717,10 @@ const Yb = Sa({}), W7 = Sa({}), Bd = { */ hasEverUpdated: !1 }; -function D6(t, e) { +function N_(t, e) { return e.max === e.min ? 0 : t / (e.max - e.min) * 100; } -const Df = { +const Of = { correct: (t, e) => { if (!e.target) return t; @@ -33729,25 +33729,25 @@ const Df = { t = parseFloat(t); else return t; - const r = D6(t, e.target.x), n = D6(t, e.target.y); + const r = N_(t, e.target.x), n = N_(t, e.target.y); return `${r}% ${n}%`; } -}, zee = { +}, Zee = { correct: (t, { treeScale: e, projectionDelta: r }) => { - const n = t, i = _a.parse(t); + const n = t, i = Aa.parse(t); if (i.length > 5) return n; - const s = _a.createTransformer(t), o = typeof i[0] != "number" ? 1 : 0, a = r.x.scale * e.x, u = r.y.scale * e.y; + const s = Aa.createTransformer(t), o = typeof i[0] != "number" ? 1 : 0, a = r.x.scale * e.x, u = r.y.scale * e.y; i[0 + o] /= a, i[1 + o] /= u; const l = Qr(a, u, 0.5); return typeof i[2 + o] == "number" && (i[2 + o] /= l), typeof i[3 + o] == "number" && (i[3 + o] /= l), s(i); } -}, x0 = {}; -function Hee(t) { - Object.assign(x0, t); +}, _0 = {}; +function Qee(t) { + Object.assign(_0, t); } -const { schedule: Jb } = VS(queueMicrotask, !1); -class Wee extends AR { +const { schedule: Jb } = JS(queueMicrotask, !1); +class ete extends LR { /** * This only mounts projection nodes for components that * need measuring, we might want to do it for all components @@ -33755,12 +33755,12 @@ class Wee extends AR { */ componentDidMount() { const { visualElement: e, layoutGroup: r, switchLayoutGroup: n, layoutId: i } = this.props, { projection: s } = e; - Hee(Kee), s && (r.group && r.group.add(s), n && n.register && i && n.register(s), s.root.didUpdate(), s.addEventListener("animationComplete", () => { + Qee(tte), s && (r.group && r.group.add(s), n && n.register && i && n.register(s), s.root.didUpdate(), s.addEventListener("animationComplete", () => { this.safeToRemove(); }), s.setOptions({ ...s.options, onExitComplete: () => this.safeToRemove() - })), Bd.hasEverUpdated = !0; + })), jd.hasEverUpdated = !0; } getSnapshotBeforeUpdate(e) { const { layoutDependency: r, visualElement: n, drag: i, isPresent: s } = this.props, o = n.projection; @@ -33787,13 +33787,13 @@ class Wee extends AR { return null; } } -function K7(t) { - const [e, r] = qee(), n = Tn(Yb); - return me.jsx(Wee, { ...t, layoutGroup: n, switchLayoutGroup: Tn(W7), isPresent: e, safeToRemove: r }); +function Y7(t) { + const [e, r] = Xee(), n = Tn(Yb); + return fe.jsx(ete, { ...t, layoutGroup: n, switchLayoutGroup: Tn(G7), isPresent: e, safeToRemove: r }); } -const Kee = { +const tte = { borderRadius: { - ...Df, + ...Of, applyTo: [ "borderTopLeftRadius", "borderTopRightRadius", @@ -33801,90 +33801,90 @@ const Kee = { "borderBottomRightRadius" ] }, - borderTopLeftRadius: Df, - borderTopRightRadius: Df, - borderBottomLeftRadius: Df, - borderBottomRightRadius: Df, - boxShadow: zee -}, V7 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], Vee = V7.length, O6 = (t) => typeof t == "string" ? parseFloat(t) : t, N6 = (t) => typeof t == "number" || Vt.test(t); -function Gee(t, e, r, n, i, s) { + borderTopLeftRadius: Of, + borderTopRightRadius: Of, + borderBottomLeftRadius: Of, + borderBottomRightRadius: Of, + boxShadow: Zee +}, J7 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], rte = J7.length, L_ = (t) => typeof t == "string" ? parseFloat(t) : t, k_ = (t) => typeof t == "number" || Vt.test(t); +function nte(t, e, r, n, i, s) { i ? (t.opacity = Qr( 0, // TODO Reinstate this if only child r.opacity !== void 0 ? r.opacity : 1, - Yee(n) - ), t.opacityExit = Qr(e.opacity !== void 0 ? e.opacity : 1, 0, Jee(n))) : s && (t.opacity = Qr(e.opacity !== void 0 ? e.opacity : 1, r.opacity !== void 0 ? r.opacity : 1, n)); - for (let o = 0; o < Vee; o++) { - const a = `border${V7[o]}Radius`; - let u = L6(e, a), l = L6(r, a); + ite(n) + ), t.opacityExit = Qr(e.opacity !== void 0 ? e.opacity : 1, 0, ste(n))) : s && (t.opacity = Qr(e.opacity !== void 0 ? e.opacity : 1, r.opacity !== void 0 ? r.opacity : 1, n)); + for (let o = 0; o < rte; o++) { + const a = `border${J7[o]}Radius`; + let u = $_(e, a), l = $_(r, a); if (u === void 0 && l === void 0) continue; - u || (u = 0), l || (l = 0), u === 0 || l === 0 || N6(u) === N6(l) ? (t[a] = Math.max(Qr(O6(u), O6(l), n), 0), (Vs.test(l) || Vs.test(u)) && (t[a] += "%")) : t[a] = l; + u || (u = 0), l || (l = 0), u === 0 || l === 0 || k_(u) === k_(l) ? (t[a] = Math.max(Qr(L_(u), L_(l), n), 0), (Gs.test(l) || Gs.test(u)) && (t[a] += "%")) : t[a] = l; } (e.rotate || r.rotate) && (t.rotate = Qr(e.rotate || 0, r.rotate || 0, n)); } -function L6(t, e) { +function $_(t, e) { return t[e] !== void 0 ? t[e] : t.borderRadius; } -const Yee = /* @__PURE__ */ G7(0, 0.5, e7), Jee = /* @__PURE__ */ G7(0.5, 0.95, Un); -function G7(t, e, r) { - return (n) => n < t ? 0 : n > e ? 1 : r(Mu(t, e, n)); +const ite = /* @__PURE__ */ X7(0, 0.5, n7), ste = /* @__PURE__ */ X7(0.5, 0.95, Un); +function X7(t, e, r) { + return (n) => n < t ? 0 : n > e ? 1 : r(Iu(t, e, n)); } -function k6(t, e) { +function B_(t, e) { t.min = e.min, t.max = e.max; } -function Yi(t, e) { - k6(t.x, e.x), k6(t.y, e.y); +function Ji(t, e) { + B_(t.x, e.x), B_(t.y, e.y); } -function $6(t, e) { +function F_(t, e) { t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin; } -function F6(t, e, r, n, i) { - return t -= e, t = w0(t, 1 / r, n), i !== void 0 && (t = w0(t, 1 / i, n)), t; +function j_(t, e, r, n, i) { + return t -= e, t = x0(t, 1 / r, n), i !== void 0 && (t = x0(t, 1 / i, n)), t; } -function Xee(t, e = 0, r = 1, n = 0.5, i, s = t, o = t) { - if (Vs.test(e) && (e = parseFloat(e), e = Qr(o.min, o.max, e / 100) - o.min), typeof e != "number") +function ote(t, e = 0, r = 1, n = 0.5, i, s = t, o = t) { + if (Gs.test(e) && (e = parseFloat(e), e = Qr(o.min, o.max, e / 100) - o.min), typeof e != "number") return; let a = Qr(s.min, s.max, n); - t === s && (a -= e), t.min = F6(t.min, e, r, a, i), t.max = F6(t.max, e, r, a, i); + t === s && (a -= e), t.min = j_(t.min, e, r, a, i), t.max = j_(t.max, e, r, a, i); } -function B6(t, e, [r, n, i], s, o) { - Xee(t, e[r], e[n], e[i], e.scale, s, o); +function U_(t, e, [r, n, i], s, o) { + ote(t, e[r], e[n], e[i], e.scale, s, o); } -const Zee = ["x", "scaleX", "originX"], Qee = ["y", "scaleY", "originY"]; -function U6(t, e, r, n) { - B6(t.x, e, Zee, r ? r.x : void 0, n ? n.x : void 0), B6(t.y, e, Qee, r ? r.y : void 0, n ? n.y : void 0); +const ate = ["x", "scaleX", "originX"], cte = ["y", "scaleY", "originY"]; +function q_(t, e, r, n) { + U_(t.x, e, ate, r ? r.x : void 0, n ? n.x : void 0), U_(t.y, e, cte, r ? r.y : void 0, n ? n.y : void 0); } -function j6(t) { +function z_(t) { return t.translate === 0 && t.scale === 1; } -function Y7(t) { - return j6(t.x) && j6(t.y); +function Z7(t) { + return z_(t.x) && z_(t.y); } -function q6(t, e) { +function W_(t, e) { return t.min === e.min && t.max === e.max; } -function ete(t, e) { - return q6(t.x, e.x) && q6(t.y, e.y); +function ute(t, e) { + return W_(t.x, e.x) && W_(t.y, e.y); } -function z6(t, e) { +function H_(t, e) { return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max); } -function J7(t, e) { - return z6(t.x, e.x) && z6(t.y, e.y); +function Q7(t, e) { + return H_(t.x, e.x) && H_(t.y, e.y); } -function H6(t) { - return Li(t.x) / Li(t.y); +function K_(t) { + return ki(t.x) / ki(t.y); } -function W6(t, e) { +function V_(t, e) { return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint; } -class tte { +class fte { constructor() { this.members = []; } add(e) { - Wb(this.members, e), e.scheduleRender(); + Hb(this.members, e), e.scheduleRender(); } remove(e) { if (Kb(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) { @@ -33933,85 +33933,85 @@ class tte { this.lead && this.lead.snapshot && (this.lead.snapshot = void 0); } } -function rte(t, e, r) { +function lte(t, e, r) { let n = ""; const i = t.x.translate / e.x, s = t.y.translate / e.y, o = (r == null ? void 0 : r.z) || 0; if ((i || s || o) && (n = `translate3d(${i}px, ${s}px, ${o}px) `), (e.x !== 1 || e.y !== 1) && (n += `scale(${1 / e.x}, ${1 / e.y}) `), r) { - const { transformPerspective: l, rotate: d, rotateX: g, rotateY: w, skewX: A, skewY: M } = r; - l && (n = `perspective(${l}px) ${n}`), d && (n += `rotate(${d}deg) `), g && (n += `rotateX(${g}deg) `), w && (n += `rotateY(${w}deg) `), A && (n += `skewX(${A}deg) `), M && (n += `skewY(${M}deg) `); + const { transformPerspective: l, rotate: d, rotateX: p, rotateY: w, skewX: A, skewY: P } = r; + l && (n = `perspective(${l}px) ${n}`), d && (n += `rotate(${d}deg) `), p && (n += `rotateX(${p}deg) `), w && (n += `rotateY(${w}deg) `), A && (n += `skewX(${A}deg) `), P && (n += `skewY(${P}deg) `); } const a = t.x.scale * e.x, u = t.y.scale * e.y; return (a !== 1 || u !== 1) && (n += `scale(${a}, ${u})`), n || "none"; } -const nte = (t, e) => t.depth - e.depth; -class ite { +const hte = (t, e) => t.depth - e.depth; +class dte { constructor() { this.children = [], this.isDirty = !1; } add(e) { - Wb(this.children, e), this.isDirty = !0; + Hb(this.children, e), this.isDirty = !0; } remove(e) { Kb(this.children, e), this.isDirty = !0; } forEach(e) { - this.isDirty && this.children.sort(nte), this.isDirty = !1, this.children.forEach(e); + this.isDirty && this.children.sort(hte), this.isDirty = !1, this.children.forEach(e); } } function Ud(t) { - const e = Jn(t) ? t.get() : t; - return YQ(e) ? e.toValue() : e; + const e = Xn(t) ? t.get() : t; + return iee(e) ? e.toValue() : e; } -function ste(t, e) { - const r = Gs.now(), n = ({ timestamp: i }) => { +function pte(t, e) { + const r = Ys.now(), n = ({ timestamp: i }) => { const s = i - r; - s >= e && (wa(n), t(s - e)); + s >= e && (Ea(n), t(s - e)); }; - return Lr.read(n, !0), () => wa(n); + return Lr.read(n, !0), () => Ea(n); } -function ote(t) { +function gte(t) { return t instanceof SVGElement && t.tagName !== "svg"; } -function ate(t, e, r) { - const n = Jn(t) ? t : Tl(t); - return n.start(Hb("", n, e, r)), n.animation; +function mte(t, e, r) { + const n = Xn(t) ? t : Rl(t); + return n.start(Wb("", n, e, r)), n.animation; } -const Ya = { +const Za = { type: "projectionFrame", totalNodes: 0, resolvedTargetDeltas: 0, recalculatedProjection: 0 -}, Uf = typeof window < "u" && window.MotionDebug !== void 0, Um = ["", "X", "Y", "Z"], cte = { visibility: "hidden" }, K6 = 1e3; -let ute = 0; -function jm(t, e, r, n) { +}, Uf = typeof window < "u" && window.MotionDebug !== void 0, jm = ["", "X", "Y", "Z"], vte = { visibility: "hidden" }, G_ = 1e3; +let bte = 0; +function Um(t, e, r, n) { const { latestValues: i } = e; i[t] && (r[t] = i[t], e.setStaticValue(t, 0), n && (n[t] = 0)); } -function X7(t) { +function e9(t) { if (t.hasCheckedOptimisedAppear = !0, t.root === t) return; const { visualElement: e } = t.options; if (!e) return; - const r = C7(e); + const r = D7(e); if (window.MotionHasOptimisedAnimation(r, "transform")) { const { layout: i, layoutId: s } = t.options; window.MotionCancelOptimisedAnimation(r, "transform", Lr, !(i || s)); } const { parent: n } = t; - n && !n.hasCheckedOptimisedAppear && X7(n); + n && !n.hasCheckedOptimisedAppear && e9(n); } -function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, checkIsScrollRoot: n, resetTransform: i }) { +function t9({ attachResizeListener: t, defaultParent: e, measureScroll: r, checkIsScrollRoot: n, resetTransform: i }) { return class { constructor(o = {}, a = e == null ? void 0 : e()) { - this.id = ute++, this.animationId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => { + this.id = bte++, this.animationId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => { this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots()); }, this.updateProjection = () => { - this.projectionUpdateScheduled = !1, Uf && (Ya.totalNodes = Ya.resolvedTargetDeltas = Ya.recalculatedProjection = 0), this.nodes.forEach(hte), this.nodes.forEach(vte), this.nodes.forEach(bte), this.nodes.forEach(dte), Uf && window.MotionDebug.record(Ya); + this.projectionUpdateScheduled = !1, Uf && (Za.totalNodes = Za.resolvedTargetDeltas = Za.recalculatedProjection = 0), this.nodes.forEach(xte), this.nodes.forEach(Pte), this.nodes.forEach(Mte), this.nodes.forEach(_te), Uf && window.MotionDebug.record(Za); }, this.resolvedRelativeTargetAt = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = o, this.root = a ? a.root || a : this, this.path = a ? [...a.path, a] : [], this.parent = a, this.depth = a ? a.depth + 1 : 0; for (let u = 0; u < this.path.length; u++) this.path[u].shouldResetTransform = !0; - this.root === this && (this.nodes = new ite()); + this.root === this && (this.nodes = new dte()); } addEventListener(o, a) { return this.eventHandlers.has(o) || this.eventHandlers.set(o, new Vb()), this.eventHandlers.get(o).add(a); @@ -34029,38 +34029,38 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check mount(o, a = this.root.hasTreeAnimated) { if (this.instance) return; - this.isSVG = ote(o), this.instance = o; + this.isSVG = gte(o), this.instance = o; const { layoutId: u, layout: l, visualElement: d } = this.options; if (d && !d.current && d.mount(o), this.root.nodes.add(this), this.parent && this.parent.children.add(this), a && (l || u) && (this.isLayoutDirty = !0), t) { - let g; + let p; const w = () => this.root.updateBlockedByResize = !1; t(o, () => { - this.root.updateBlockedByResize = !0, g && g(), g = ste(w, 250), Bd.hasAnimatedSinceResize && (Bd.hasAnimatedSinceResize = !1, this.nodes.forEach(G6)); + this.root.updateBlockedByResize = !0, p && p(), p = pte(w, 250), jd.hasAnimatedSinceResize && (jd.hasAnimatedSinceResize = !1, this.nodes.forEach(J_)); }); } - u && this.root.registerSharedNode(u, this), this.options.animate !== !1 && d && (u || l) && this.addEventListener("didUpdate", ({ delta: g, hasLayoutChanged: w, hasRelativeTargetChanged: A, layout: M }) => { + u && this.root.registerSharedNode(u, this), this.options.animate !== !1 && d && (u || l) && this.addEventListener("didUpdate", ({ delta: p, hasLayoutChanged: w, hasRelativeTargetChanged: A, layout: P }) => { if (this.isTreeAnimationBlocked()) { this.target = void 0, this.relativeTarget = void 0; return; } - const N = this.options.transition || d.getDefaultTransition() || Ete, { onLayoutAnimationStart: L, onLayoutAnimationComplete: $ } = d.getProps(), F = !this.targetLayout || !J7(this.targetLayout, M) || A, K = !w && A; - if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || K || w && (F || !this.currentAnimation)) { - this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0), this.setAnimationOrigin(g, K); - const H = { + const N = this.options.transition || d.getDefaultTransition() || Dte, { onLayoutAnimationStart: L, onLayoutAnimationComplete: $ } = d.getProps(), B = !this.targetLayout || !Q7(this.targetLayout, P) || A, H = !w && A; + if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || H || w && (B || !this.currentAnimation)) { + this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0), this.setAnimationOrigin(p, H); + const W = { ...Tb(N, "layout"), onPlay: L, onComplete: $ }; - (d.shouldReduceMotion || this.options.layoutRoot) && (H.delay = 0, H.type = !1), this.startAnimation(H); + (d.shouldReduceMotion || this.options.layoutRoot) && (W.delay = 0, W.type = !1), this.startAnimation(W); } else - w || G6(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete(); - this.targetLayout = M; + w || J_(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete(); + this.targetLayout = P; }); } unmount() { this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this); const o = this.getStack(); - o && o.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, wa(this.updateProjection); + o && o.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, Ea(this.updateProjection); } // only on the root blockUpdate() { @@ -34077,7 +34077,7 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check } // Note: currently only running on root node startUpdate() { - this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(yte), this.animationId++); + this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(Ite), this.animationId++); } getTransformTemplate() { const { visualElement: o } = this.options; @@ -34088,12 +34088,12 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.options.onExitComplete && this.options.onExitComplete(); return; } - if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && X7(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty) + if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && e9(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty) return; this.isLayoutDirty = !0; for (let d = 0; d < this.path.length; d++) { - const g = this.path[d]; - g.shouldResetTransform = !0, g.updateScroll("snapshot"), g.options.layoutRoot && g.willUpdate(!1); + const p = this.path[d]; + p.shouldResetTransform = !0, p.updateScroll("snapshot"), p.options.layoutRoot && p.willUpdate(!1); } const { layoutId: a, layout: u } = this.options; if (a === void 0 && !u) @@ -34103,18 +34103,18 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check } update() { if (this.updateScheduled = !1, this.isUpdateBlocked()) { - this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(V6); + this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(Y_); return; } - this.isUpdating || this.nodes.forEach(gte), this.isUpdating = !1, this.nodes.forEach(mte), this.nodes.forEach(fte), this.nodes.forEach(lte), this.clearAllSnapshots(); - const a = Gs.now(); - Fn.delta = xa(0, 1e3 / 60, a - Fn.timestamp), Fn.timestamp = a, Fn.isProcessing = !0, Dm.update.process(Fn), Dm.preRender.process(Fn), Dm.render.process(Fn), Fn.isProcessing = !1; + this.isUpdating || this.nodes.forEach(Ste), this.isUpdating = !1, this.nodes.forEach(Ate), this.nodes.forEach(yte), this.nodes.forEach(wte), this.clearAllSnapshots(); + const a = Ys.now(); + Fn.delta = Sa(0, 1e3 / 60, a - Fn.timestamp), Fn.timestamp = a, Fn.isProcessing = !0, Dm.update.process(Fn), Dm.preRender.process(Fn), Dm.render.process(Fn), Fn.isProcessing = !1; } didUpdate() { this.updateScheduled || (this.updateScheduled = !0, Jb.read(this.scheduleUpdate)); } clearAllSnapshots() { - this.nodes.forEach(pte), this.sharedNodes.forEach(wte); + this.nodes.forEach(Ete), this.sharedNodes.forEach(Cte); } scheduleUpdateProjection() { this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, Lr.preRender(this.updateProjection, !1, !0)); @@ -34157,13 +34157,13 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check resetTransform() { if (!i) return; - const o = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, a = this.projectionDelta && !Y7(this.projectionDelta), u = this.getTransformTemplate(), l = u ? u(this.latestValues, "") : void 0, d = l !== this.prevTransformTemplateValue; - o && (a || Ga(this.latestValues) || d) && (i(this.instance, l), this.shouldResetTransform = !1, this.scheduleRender()); + const o = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, a = this.projectionDelta && !Z7(this.projectionDelta), u = this.getTransformTemplate(), l = u ? u(this.latestValues, "") : void 0, d = l !== this.prevTransformTemplateValue; + o && (a || Xa(this.latestValues) || d) && (i(this.instance, l), this.shouldResetTransform = !1, this.scheduleRender()); } measure(o = !0) { const a = this.measurePageBox(); let u = this.removeElementScroll(a); - return o && (u = this.removeTransform(u)), Ste(u), { + return o && (u = this.removeTransform(u)), Ote(u), { animationId: this.root.animationId, measuredBox: a, layoutBox: u, @@ -34177,47 +34177,47 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check if (!a) return ln(); const u = a.measureViewportBox(); - if (!(((o = this.scroll) === null || o === void 0 ? void 0 : o.wasRoot) || this.path.some(Ate))) { + if (!(((o = this.scroll) === null || o === void 0 ? void 0 : o.wasRoot) || this.path.some(Nte))) { const { scroll: d } = this.root; - d && (ru(u.x, d.offset.x), ru(u.y, d.offset.y)); + d && (nu(u.x, d.offset.x), nu(u.y, d.offset.y)); } return u; } removeElementScroll(o) { var a; const u = ln(); - if (Yi(u, o), !((a = this.scroll) === null || a === void 0) && a.wasRoot) + if (Ji(u, o), !((a = this.scroll) === null || a === void 0) && a.wasRoot) return u; for (let l = 0; l < this.path.length; l++) { - const d = this.path[l], { scroll: g, options: w } = d; - d !== this.root && g && w.layoutScroll && (g.wasRoot && Yi(u, o), ru(u.x, g.offset.x), ru(u.y, g.offset.y)); + const d = this.path[l], { scroll: p, options: w } = d; + d !== this.root && p && w.layoutScroll && (p.wasRoot && Ji(u, o), nu(u.x, p.offset.x), nu(u.y, p.offset.y)); } return u; } applyTransform(o, a = !1) { const u = ln(); - Yi(u, o); + Ji(u, o); for (let l = 0; l < this.path.length; l++) { const d = this.path[l]; - !a && d.options.layoutScroll && d.scroll && d !== d.root && nu(u, { + !a && d.options.layoutScroll && d.scroll && d !== d.root && iu(u, { x: -d.scroll.offset.x, y: -d.scroll.offset.y - }), Ga(d.latestValues) && nu(u, d.latestValues); + }), Xa(d.latestValues) && iu(u, d.latestValues); } - return Ga(this.latestValues) && nu(u, this.latestValues), u; + return Xa(this.latestValues) && iu(u, this.latestValues), u; } removeTransform(o) { const a = ln(); - Yi(a, o); + Ji(a, o); for (let u = 0; u < this.path.length; u++) { const l = this.path[u]; - if (!l.instance || !Ga(l.latestValues)) + if (!l.instance || !Xa(l.latestValues)) continue; av(l.latestValues) && l.updateSnapshot(); - const d = ln(), g = l.measurePageBox(); - Yi(d, g), U6(a, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, d); + const d = ln(), p = l.measurePageBox(); + Ji(d, p), q_(a, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, d); } - return Ga(this.latestValues) && U6(a, this.latestValues), a; + return Xa(this.latestValues) && q_(a, this.latestValues), a; } setTargetDelta(o) { this.targetDelta = o, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0; @@ -34242,24 +34242,24 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check const l = !!this.resumingFrom || this !== u; if (!(o || l && this.isSharedProjectionDirty || this.isProjectionDirty || !((a = this.parent) === null || a === void 0) && a.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize)) return; - const { layout: g, layoutId: w } = this.options; - if (!(!this.layout || !(g || w))) { + const { layout: p, layoutId: w } = this.options; + if (!(!this.layout || !(p || w))) { if (this.resolvedRelativeTargetAt = Fn.timestamp, !this.targetDelta && !this.relativeTarget) { const A = this.getClosestProjectingParent(); - A && A.layout && this.animationProgress !== 1 ? (this.relativeParent = A, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), Jf(this.relativeTargetOrigin, this.layout.layoutBox, A.layout.layoutBox), Yi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; + A && A.layout && this.animationProgress !== 1 ? (this.relativeParent = A, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), Xf(this.relativeTargetOrigin, this.layout.layoutBox, A.layout.layoutBox), Ji(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; } if (!(!this.relativeTarget && !this.targetDelta)) { - if (this.target || (this.target = ln(), this.targetWithTransforms = ln()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), Pee(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : Yi(this.target, this.layout.layoutBox), q7(this.target, this.targetDelta)) : Yi(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget) { + if (this.target || (this.target = ln(), this.targetWithTransforms = ln()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), Lee(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : Ji(this.target, this.layout.layoutBox), H7(this.target, this.targetDelta)) : Ji(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget) { this.attemptToResolveRelativeTarget = !1; const A = this.getClosestProjectingParent(); - A && !!A.resumingFrom == !!this.resumingFrom && !A.options.layoutScroll && A.target && this.animationProgress !== 1 ? (this.relativeParent = A, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), Jf(this.relativeTargetOrigin, this.target, A.target), Yi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; + A && !!A.resumingFrom == !!this.resumingFrom && !A.options.layoutScroll && A.target && this.animationProgress !== 1 ? (this.relativeParent = A, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), Xf(this.relativeTargetOrigin, this.target, A.target), Ji(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; } - Uf && Ya.resolvedTargetDeltas++; + Uf && Za.resolvedTargetDeltas++; } } } getClosestProjectingParent() { - if (!(!this.parent || av(this.parent.latestValues) || j7(this.parent.latestValues))) + if (!(!this.parent || av(this.parent.latestValues) || W7(this.parent.latestValues))) return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent(); } isProjecting() { @@ -34271,18 +34271,18 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check let l = !0; if ((this.isProjectionDirty || !((o = this.parent) === null || o === void 0) && o.isProjectionDirty) && (l = !1), u && (this.isSharedProjectionDirty || this.isTransformDirty) && (l = !1), this.resolvedRelativeTargetAt === Fn.timestamp && (l = !1), l) return; - const { layout: d, layoutId: g } = this.options; - if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(d || g)) + const { layout: d, layoutId: p } = this.options; + if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(d || p)) return; - Yi(this.layoutCorrected, this.layout.layoutBox); + Ji(this.layoutCorrected, this.layout.layoutBox); const w = this.treeScale.x, A = this.treeScale.y; - Lee(this.layoutCorrected, this.treeScale, this.path, u), a.layout && !a.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (a.target = a.layout.layoutBox, a.targetWithTransforms = ln()); - const { target: M } = a; - if (!M) { + Wee(this.layoutCorrected, this.treeScale, this.path, u), a.layout && !a.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (a.target = a.layout.layoutBox, a.targetWithTransforms = ln()); + const { target: P } = a; + if (!P) { this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender()); return; } - !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : ($6(this.prevProjectionDelta.x, this.projectionDelta.x), $6(this.prevProjectionDelta.y, this.projectionDelta.y)), Yf(this.projectionDelta, this.layoutCorrected, M, this.latestValues), (this.treeScale.x !== w || this.treeScale.y !== A || !W6(this.projectionDelta.x, this.prevProjectionDelta.x) || !W6(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", M)), Uf && Ya.recalculatedProjection++; + !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (F_(this.prevProjectionDelta.x, this.projectionDelta.x), F_(this.prevProjectionDelta.y, this.projectionDelta.y)), Jf(this.projectionDelta, this.layoutCorrected, P, this.latestValues), (this.treeScale.x !== w || this.treeScale.y !== A || !V_(this.projectionDelta.x, this.prevProjectionDelta.x) || !V_(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", P)), Uf && Za.recalculatedProjection++; } hide() { this.isVisible = !1; @@ -34299,22 +34299,22 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0); } createProjectionDeltas() { - this.prevProjectionDelta = tu(), this.projectionDelta = tu(), this.projectionDeltaWithTransform = tu(); + this.prevProjectionDelta = ru(), this.projectionDelta = ru(), this.projectionDeltaWithTransform = ru(); } setAnimationOrigin(o, a = !1) { - const u = this.snapshot, l = u ? u.latestValues : {}, d = { ...this.latestValues }, g = tu(); + const u = this.snapshot, l = u ? u.latestValues : {}, d = { ...this.latestValues }, p = ru(); (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !a; - const w = ln(), A = u ? u.source : void 0, M = this.layout ? this.layout.source : void 0, N = A !== M, L = this.getStack(), $ = !L || L.members.length <= 1, F = !!(N && !$ && this.options.crossfade === !0 && !this.path.some(_te)); + const w = ln(), A = u ? u.source : void 0, P = this.layout ? this.layout.source : void 0, N = A !== P, L = this.getStack(), $ = !L || L.members.length <= 1, B = !!(N && !$ && this.options.crossfade === !0 && !this.path.some(Rte)); this.animationProgress = 0; - let K; - this.mixTargetDelta = (H) => { - const V = H / 1e3; - Y6(g.x, o.x, V), Y6(g.y, o.y, V), this.setTargetDelta(g), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Jf(w, this.layout.layoutBox, this.relativeParent.layout.layoutBox), xte(this.relativeTarget, this.relativeTargetOrigin, w, V), K && ete(this.relativeTarget, K) && (this.isProjectionDirty = !1), K || (K = ln()), Yi(K, this.relativeTarget)), N && (this.animationValues = d, Gee(d, l, this.latestValues, V, F, $)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V; + let H; + this.mixTargetDelta = (W) => { + const V = W / 1e3; + X_(p.x, o.x, V), X_(p.y, o.y, V), this.setTargetDelta(p), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Xf(w, this.layout.layoutBox, this.relativeParent.layout.layoutBox), Tte(this.relativeTarget, this.relativeTargetOrigin, w, V), H && ute(this.relativeTarget, H) && (this.isProjectionDirty = !1), H || (H = ln()), Ji(H, this.relativeTarget)), N && (this.animationValues = d, nte(d, l, this.latestValues, V, B, $)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V; }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0); } startAnimation(o) { - this.notifyListeners("animationStart"), this.currentAnimation && this.currentAnimation.stop(), this.resumingFrom && this.resumingFrom.currentAnimation && this.resumingFrom.currentAnimation.stop(), this.pendingAnimation && (wa(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = Lr.update(() => { - Bd.hasAnimatedSinceResize = !0, this.currentAnimation = ate(0, K6, { + this.notifyListeners("animationStart"), this.currentAnimation && this.currentAnimation.stop(), this.resumingFrom && this.resumingFrom.currentAnimation && this.resumingFrom.currentAnimation.stop(), this.pendingAnimation && (Ea(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = Lr.update(() => { + jd.hasAnimatedSinceResize = !0, this.currentAnimation = mte(0, G_, { ...o, onUpdate: (a) => { this.mixTargetDelta(a), o.onUpdate && o.onUpdate(a); @@ -34331,24 +34331,24 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check o && o.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete"); } finishAnimation() { - this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(K6), this.currentAnimation.stop()), this.completeAnimation(); + this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(G_), this.currentAnimation.stop()), this.completeAnimation(); } applyTransformsToTarget() { const o = this.getLead(); let { targetWithTransforms: a, target: u, layout: l, latestValues: d } = o; if (!(!a || !u || !l)) { - if (this !== o && this.layout && l && Q7(this.options.animationType, this.layout.layoutBox, l.layoutBox)) { + if (this !== o && this.layout && l && r9(this.options.animationType, this.layout.layoutBox, l.layoutBox)) { u = this.target || ln(); - const g = Li(this.layout.layoutBox.x); - u.x.min = o.target.x.min, u.x.max = u.x.min + g; - const w = Li(this.layout.layoutBox.y); + const p = ki(this.layout.layoutBox.x); + u.x.min = o.target.x.min, u.x.max = u.x.min + p; + const w = ki(this.layout.layoutBox.y); u.y.min = o.target.y.min, u.y.max = u.y.min + w; } - Yi(a, u), nu(a, d), Yf(this.projectionDeltaWithTransform, this.layoutCorrected, a, d); + Ji(a, u), iu(a, d), Jf(this.projectionDeltaWithTransform, this.layoutCorrected, a, d); } } registerSharedNode(o, a) { - this.sharedNodes.has(o) || this.sharedNodes.set(o, new tte()), this.sharedNodes.get(o).add(a); + this.sharedNodes.has(o) || this.sharedNodes.set(o, new fte()), this.sharedNodes.get(o).add(a); const l = a.options.initialPromotionConfig; a.promote({ transition: l ? l.transition : void 0, @@ -34391,9 +34391,9 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check if ((u.z || u.rotate || u.rotateX || u.rotateY || u.rotateZ || u.skewX || u.skewY) && (a = !0), !a) return; const l = {}; - u.z && jm("z", o, l, this.animationValues); - for (let d = 0; d < Um.length; d++) - jm(`rotate${Um[d]}`, o, l, this.animationValues), jm(`skew${Um[d]}`, o, l, this.animationValues); + u.z && Um("z", o, l, this.animationValues); + for (let d = 0; d < jm.length; d++) + Um(`rotate${jm[d]}`, o, l, this.animationValues), Um(`skew${jm[d]}`, o, l, this.animationValues); o.render(); for (const d in l) o.setStaticValue(d, l[d]), this.animationValues && (this.animationValues[d] = l[d]); @@ -34404,33 +34404,33 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check if (!this.instance || this.isSVG) return; if (!this.isVisible) - return cte; + return vte; const l = { visibility: "" }, d = this.getTransformTemplate(); if (this.needsReset) return this.needsReset = !1, l.opacity = "", l.pointerEvents = Ud(o == null ? void 0 : o.pointerEvents) || "", l.transform = d ? d(this.latestValues, "") : "none", l; - const g = this.getLead(); - if (!this.projectionDelta || !this.layout || !g.target) { + const p = this.getLead(); + if (!this.projectionDelta || !this.layout || !p.target) { const N = {}; - return this.options.layoutId && (N.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, N.pointerEvents = Ud(o == null ? void 0 : o.pointerEvents) || ""), this.hasProjected && !Ga(this.latestValues) && (N.transform = d ? d({}, "") : "none", this.hasProjected = !1), N; + return this.options.layoutId && (N.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, N.pointerEvents = Ud(o == null ? void 0 : o.pointerEvents) || ""), this.hasProjected && !Xa(this.latestValues) && (N.transform = d ? d({}, "") : "none", this.hasProjected = !1), N; } - const w = g.animationValues || g.latestValues; - this.applyTransformsToTarget(), l.transform = rte(this.projectionDeltaWithTransform, this.treeScale, w), d && (l.transform = d(w, l.transform)); - const { x: A, y: M } = this.projectionDelta; - l.transformOrigin = `${A.origin * 100}% ${M.origin * 100}% 0`, g.animationValues ? l.opacity = g === this ? (u = (a = w.opacity) !== null && a !== void 0 ? a : this.latestValues.opacity) !== null && u !== void 0 ? u : 1 : this.preserveOpacity ? this.latestValues.opacity : w.opacityExit : l.opacity = g === this ? w.opacity !== void 0 ? w.opacity : "" : w.opacityExit !== void 0 ? w.opacityExit : 0; - for (const N in x0) { + const w = p.animationValues || p.latestValues; + this.applyTransformsToTarget(), l.transform = lte(this.projectionDeltaWithTransform, this.treeScale, w), d && (l.transform = d(w, l.transform)); + const { x: A, y: P } = this.projectionDelta; + l.transformOrigin = `${A.origin * 100}% ${P.origin * 100}% 0`, p.animationValues ? l.opacity = p === this ? (u = (a = w.opacity) !== null && a !== void 0 ? a : this.latestValues.opacity) !== null && u !== void 0 ? u : 1 : this.preserveOpacity ? this.latestValues.opacity : w.opacityExit : l.opacity = p === this ? w.opacity !== void 0 ? w.opacity : "" : w.opacityExit !== void 0 ? w.opacityExit : 0; + for (const N in _0) { if (w[N] === void 0) continue; - const { correct: L, applyTo: $ } = x0[N], F = l.transform === "none" ? w[N] : L(w[N], g); + const { correct: L, applyTo: $ } = _0[N], B = l.transform === "none" ? w[N] : L(w[N], p); if ($) { - const K = $.length; - for (let H = 0; H < K; H++) - l[$[H]] = F; + const H = $.length; + for (let W = 0; W < H; W++) + l[$[W]] = B; } else - l[N] = F; + l[N] = B; } - return this.options.layoutId && (l.pointerEvents = g === this ? Ud(o == null ? void 0 : o.pointerEvents) || "" : "none"), l; + return this.options.layoutId && (l.pointerEvents = p === this ? Ud(o == null ? void 0 : o.pointerEvents) || "" : "none"), l; } clearSnapshot() { this.resumeFrom = this.snapshot = void 0; @@ -34440,40 +34440,40 @@ function Z7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.root.nodes.forEach((o) => { var a; return (a = o.currentAnimation) === null || a === void 0 ? void 0 : a.stop(); - }), this.root.nodes.forEach(V6), this.root.sharedNodes.clear(); + }), this.root.nodes.forEach(Y_), this.root.sharedNodes.clear(); } }; } -function fte(t) { +function yte(t) { t.updateLayout(); } -function lte(t) { +function wte(t) { var e; const r = ((e = t.resumeFrom) === null || e === void 0 ? void 0 : e.snapshot) || t.snapshot; if (t.isLead() && t.layout && r && t.hasListeners("didUpdate")) { const { layoutBox: n, measuredBox: i } = t.layout, { animationType: s } = t.options, o = r.source !== t.layout.source; - s === "size" ? Xi((g) => { - const w = o ? r.measuredBox[g] : r.layoutBox[g], A = Li(w); - w.min = n[g].min, w.max = w.min + A; - }) : Q7(s, r.layoutBox, n) && Xi((g) => { - const w = o ? r.measuredBox[g] : r.layoutBox[g], A = Li(n[g]); - w.max = w.min + A, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[g].max = t.relativeTarget[g].min + A); + s === "size" ? Zi((p) => { + const w = o ? r.measuredBox[p] : r.layoutBox[p], A = ki(w); + w.min = n[p].min, w.max = w.min + A; + }) : r9(s, r.layoutBox, n) && Zi((p) => { + const w = o ? r.measuredBox[p] : r.layoutBox[p], A = ki(n[p]); + w.max = w.min + A, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[p].max = t.relativeTarget[p].min + A); }); - const a = tu(); - Yf(a, n, r.layoutBox); - const u = tu(); - o ? Yf(u, t.applyTransform(i, !0), r.measuredBox) : Yf(u, n, r.layoutBox); - const l = !Y7(a); + const a = ru(); + Jf(a, n, r.layoutBox); + const u = ru(); + o ? Jf(u, t.applyTransform(i, !0), r.measuredBox) : Jf(u, n, r.layoutBox); + const l = !Z7(a); let d = !1; if (!t.resumeFrom) { - const g = t.getClosestProjectingParent(); - if (g && !g.resumeFrom) { - const { snapshot: w, layout: A } = g; + const p = t.getClosestProjectingParent(); + if (p && !p.resumeFrom) { + const { snapshot: w, layout: A } = p; if (w && A) { - const M = ln(); - Jf(M, r.layoutBox, w.layoutBox); + const P = ln(); + Xf(P, r.layoutBox, w.layoutBox); const N = ln(); - Jf(N, n, A.layoutBox), J7(M, N) || (d = !0), g.options.layoutRoot && (t.relativeTarget = N, t.relativeTargetOrigin = M, t.relativeParent = g); + Xf(N, n, A.layoutBox), Q7(P, N) || (d = !0), p.options.layoutRoot && (t.relativeTarget = N, t.relativeTargetOrigin = P, t.relativeParent = p); } } } @@ -34491,71 +34491,71 @@ function lte(t) { } t.options.transition = void 0; } -function hte(t) { - Uf && Ya.totalNodes++, t.parent && (t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty), t.isSharedProjectionDirty || (t.isSharedProjectionDirty = !!(t.isProjectionDirty || t.parent.isProjectionDirty || t.parent.isSharedProjectionDirty)), t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty)); +function xte(t) { + Uf && Za.totalNodes++, t.parent && (t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty), t.isSharedProjectionDirty || (t.isSharedProjectionDirty = !!(t.isProjectionDirty || t.parent.isProjectionDirty || t.parent.isSharedProjectionDirty)), t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty)); } -function dte(t) { +function _te(t) { t.isProjectionDirty = t.isSharedProjectionDirty = t.isTransformDirty = !1; } -function pte(t) { +function Ete(t) { t.clearSnapshot(); } -function V6(t) { +function Y_(t) { t.clearMeasurements(); } -function gte(t) { +function Ste(t) { t.isLayoutDirty = !1; } -function mte(t) { +function Ate(t) { const { visualElement: e } = t.options; e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform(); } -function G6(t) { +function J_(t) { t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0; } -function vte(t) { +function Pte(t) { t.resolveTargetDelta(); } -function bte(t) { +function Mte(t) { t.calcProjection(); } -function yte(t) { +function Ite(t) { t.resetSkewAndRotation(); } -function wte(t) { +function Cte(t) { t.removeLeadSnapshot(); } -function Y6(t, e, r) { +function X_(t, e, r) { t.translate = Qr(e.translate, 0, r), t.scale = Qr(e.scale, 1, r), t.origin = e.origin, t.originPoint = e.originPoint; } -function J6(t, e, r, n) { +function Z_(t, e, r, n) { t.min = Qr(e.min, r.min, n), t.max = Qr(e.max, r.max, n); } -function xte(t, e, r, n) { - J6(t.x, e.x, r.x, n), J6(t.y, e.y, r.y, n); +function Tte(t, e, r, n) { + Z_(t.x, e.x, r.x, n), Z_(t.y, e.y, r.y, n); } -function _te(t) { +function Rte(t) { return t.animationValues && t.animationValues.opacityExit !== void 0; } -const Ete = { +const Dte = { duration: 0.45, ease: [0.4, 0, 0.1, 1] -}, X6 = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Z6 = X6("applewebkit/") && !X6("chrome/") ? Math.round : Un; -function Q6(t) { - t.min = Z6(t.min), t.max = Z6(t.max); +}, Q_ = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), e5 = Q_("applewebkit/") && !Q_("chrome/") ? Math.round : Un; +function t5(t) { + t.min = e5(t.min), t.max = e5(t.max); } -function Ste(t) { - Q6(t.x), Q6(t.y); +function Ote(t) { + t5(t.x), t5(t.y); } -function Q7(t, e, r) { - return t === "position" || t === "preserve-aspect" && !Aee(H6(e), H6(r), 0.2); +function r9(t, e, r) { + return t === "position" || t === "preserve-aspect" && !Nee(K_(e), K_(r), 0.2); } -function Ate(t) { +function Nte(t) { var e; return t !== t.root && ((e = t.scroll) === null || e === void 0 ? void 0 : e.wasRoot); } -const Pte = Z7({ - attachResizeListener: (t, e) => Po(t, "resize", e), +const Lte = t9({ + attachResizeListener: (t, e) => Co(t, "resize", e), measureScroll: () => ({ x: document.documentElement.scrollLeft || document.body.scrollLeft, y: document.documentElement.scrollTop || document.body.scrollTop @@ -34563,14 +34563,14 @@ const Pte = Z7({ checkIsScrollRoot: () => !0 }), qm = { current: void 0 -}, e9 = Z7({ +}, n9 = t9({ measureScroll: (t) => ({ x: t.scrollLeft, y: t.scrollTop }), defaultParent: () => { if (!qm.current) { - const t = new Pte({}); + const t = new Lte({}); t.mount(window), t.setOptions({ layoutScroll: !0 }), qm.current = t; } return qm.current; @@ -34579,37 +34579,37 @@ const Pte = Z7({ t.style.transform = e !== void 0 ? e : "none"; }, checkIsScrollRoot: (t) => window.getComputedStyle(t).position === "fixed" -}), Mte = { +}), kte = { pan: { - Feature: jee + Feature: Jee }, drag: { - Feature: Uee, - ProjectionNode: e9, - MeasureLayout: K7 + Feature: Yee, + ProjectionNode: n9, + MeasureLayout: Y7 } }; -function e5(t, e) { +function r5(t, e) { const r = e ? "pointerenter" : "pointerleave", n = e ? "onHoverStart" : "onHoverEnd", i = (s, o) => { - if (s.pointerType === "touch" || $7()) + if (s.pointerType === "touch" || j7()) return; const a = t.getProps(); t.animationState && a.whileHover && t.animationState.setActive("whileHover", e); const u = a[n]; u && Lr.postRender(() => u(s, o)); }; - return Ro(t.current, r, i, { + return No(t.current, r, i, { passive: !t.getProps()[n] }); } -class Ite extends Ta { +class $te extends Oa { mount() { - this.unmount = To(e5(this.node, !0), e5(this.node, !1)); + this.unmount = Oo(r5(this.node, !0), r5(this.node, !1)); } unmount() { } } -class Cte extends Ta { +class Bte extends Oa { constructor() { super(...arguments), this.isActive = !1; } @@ -34626,35 +34626,35 @@ class Cte extends Ta { !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1); } mount() { - this.unmount = To(Po(this.node.current, "focus", () => this.onFocus()), Po(this.node.current, "blur", () => this.onBlur())); + this.unmount = Oo(Co(this.node.current, "focus", () => this.onFocus()), Co(this.node.current, "blur", () => this.onBlur())); } unmount() { } } -const t9 = (t, e) => e ? t === e ? !0 : t9(t, e.parentElement) : !1; +const i9 = (t, e) => e ? t === e ? !0 : i9(t, e.parentElement) : !1; function zm(t, e) { if (!e) return; const r = new PointerEvent("pointer" + t); - e(r, wp(r)); + e(r, xp(r)); } -class Tte extends Ta { +class Fte extends Oa { constructor() { super(...arguments), this.removeStartListeners = Un, this.removeEndListeners = Un, this.removeAccessibleListeners = Un, this.startPointerPress = (e, r) => { if (this.isPressing) return; this.removeEndListeners(); - const n = this.node.getProps(), s = Ro(window, "pointerup", (a, u) => { + const n = this.node.getProps(), s = No(window, "pointerup", (a, u) => { if (!this.checkPressEnd()) return; - const { onTap: l, onTapCancel: d, globalTapTarget: g } = this.node.getProps(), w = !g && !t9(this.node.current, a.target) ? d : l; + const { onTap: l, onTapCancel: d, globalTapTarget: p } = this.node.getProps(), w = !p && !i9(this.node.current, a.target) ? d : l; w && Lr.update(() => w(a, u)); }, { passive: !(n.onTap || n.onPointerUp) - }), o = Ro(window, "pointercancel", (a, u) => this.cancelPress(a, u), { + }), o = No(window, "pointercancel", (a, u) => this.cancelPress(a, u), { passive: !(n.onTapCancel || n.onPointerCancel) }); - this.removeEndListeners = To(s, o), this.startPress(e, r); + this.removeEndListeners = Oo(s, o), this.startPress(e, r); }, this.startAccessiblePress = () => { const e = (s) => { if (s.key !== "Enter" || this.isPressing) @@ -34665,13 +34665,13 @@ class Tte extends Ta { d && Lr.postRender(() => d(u, l)); }); }; - this.removeEndListeners(), this.removeEndListeners = Po(this.node.current, "keyup", o), zm("down", (a, u) => { + this.removeEndListeners(), this.removeEndListeners = Co(this.node.current, "keyup", o), zm("down", (a, u) => { this.startPress(a, u); }); - }, r = Po(this.node.current, "keydown", e), n = () => { + }, r = Co(this.node.current, "keydown", e), n = () => { this.isPressing && zm("cancel", (s, o) => this.cancelPress(s, o)); - }, i = Po(this.node.current, "blur", n); - this.removeAccessibleListeners = To(r, i); + }, i = Co(this.node.current, "blur", n); + this.removeAccessibleListeners = Oo(r, i); }; } startPress(e, r) { @@ -34680,7 +34680,7 @@ class Tte extends Ta { i && this.node.animationState && this.node.animationState.setActive("whileTap", !0), n && Lr.postRender(() => n(e, r)); } checkPressEnd() { - return this.removeEndListeners(), this.isPressing = !1, this.node.getProps().whileTap && this.node.animationState && this.node.animationState.setActive("whileTap", !1), !$7(); + return this.removeEndListeners(), this.isPressing = !1, this.node.getProps().whileTap && this.node.animationState && this.node.animationState.setActive("whileTap", !1), !j7(); } cancelPress(e, r) { if (!this.checkPressEnd()) @@ -34689,38 +34689,38 @@ class Tte extends Ta { n && Lr.postRender(() => n(e, r)); } mount() { - const e = this.node.getProps(), r = Ro(e.globalTapTarget ? window : this.node.current, "pointerdown", this.startPointerPress, { + const e = this.node.getProps(), r = No(e.globalTapTarget ? window : this.node.current, "pointerdown", this.startPointerPress, { passive: !(e.onTapStart || e.onPointerStart) - }), n = Po(this.node.current, "focus", this.startAccessiblePress); - this.removeStartListeners = To(r, n); + }), n = Co(this.node.current, "focus", this.startAccessiblePress); + this.removeStartListeners = Oo(r, n); } unmount() { this.removeStartListeners(), this.removeEndListeners(), this.removeAccessibleListeners(); } } -const uv = /* @__PURE__ */ new WeakMap(), Hm = /* @__PURE__ */ new WeakMap(), Rte = (t) => { +const uv = /* @__PURE__ */ new WeakMap(), Wm = /* @__PURE__ */ new WeakMap(), jte = (t) => { const e = uv.get(t.target); e && e(t); -}, Dte = (t) => { - t.forEach(Rte); +}, Ute = (t) => { + t.forEach(jte); }; -function Ote({ root: t, ...e }) { +function qte({ root: t, ...e }) { const r = t || document; - Hm.has(r) || Hm.set(r, {}); - const n = Hm.get(r), i = JSON.stringify(e); - return n[i] || (n[i] = new IntersectionObserver(Dte, { root: t, ...e })), n[i]; + Wm.has(r) || Wm.set(r, {}); + const n = Wm.get(r), i = JSON.stringify(e); + return n[i] || (n[i] = new IntersectionObserver(Ute, { root: t, ...e })), n[i]; } -function Nte(t, e, r) { - const n = Ote(e); +function zte(t, e, r) { + const n = qte(e); return uv.set(t, r), n.observe(t), () => { uv.delete(t), n.unobserve(t); }; } -const Lte = { +const Wte = { some: 0, all: 1 }; -class kte extends Ta { +class Hte extends Oa { constructor() { super(...arguments), this.hasEnteredView = !1, this.isInView = !1; } @@ -34729,16 +34729,16 @@ class kte extends Ta { const { viewport: e = {} } = this.node.getProps(), { root: r, margin: n, amount: i = "some", once: s } = e, o = { root: r ? r.current : void 0, rootMargin: n, - threshold: typeof i == "number" ? i : Lte[i] + threshold: typeof i == "number" ? i : Wte[i] }, a = (u) => { const { isIntersecting: l } = u; if (this.isInView === l || (this.isInView = l, s && !l && this.hasEnteredView)) return; l && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", l); - const { onViewportEnter: d, onViewportLeave: g } = this.node.getProps(), w = l ? d : g; + const { onViewportEnter: d, onViewportLeave: p } = this.node.getProps(), w = l ? d : p; w && w(u); }; - return Nte(this.node.current, o, a); + return zte(this.node.current, o, a); } mount() { this.startObserver(); @@ -34747,41 +34747,41 @@ class kte extends Ta { if (typeof IntersectionObserver > "u") return; const { props: e, prevProps: r } = this.node; - ["amount", "margin", "root"].some($te(e, r)) && this.startObserver(); + ["amount", "margin", "root"].some(Kte(e, r)) && this.startObserver(); } unmount() { } } -function $te({ viewport: t = {} }, { viewport: e = {} } = {}) { +function Kte({ viewport: t = {} }, { viewport: e = {} } = {}) { return (r) => t[r] !== e[r]; } -const Fte = { +const Vte = { inView: { - Feature: kte + Feature: Hte }, tap: { - Feature: Tte + Feature: Fte }, focus: { - Feature: Cte + Feature: Bte }, hover: { - Feature: Ite + Feature: $te } -}, Bte = { +}, Gte = { layout: { - ProjectionNode: e9, - MeasureLayout: K7 + ProjectionNode: n9, + MeasureLayout: Y7 } -}, Xb = Sa({ +}, Xb = Ma({ transformPagePoint: (t) => t, isStatic: !1, reducedMotion: "never" -}), _p = Sa({}), Zb = typeof window < "u", r9 = Zb ? PR : Xn, n9 = Sa({ strict: !1 }); -function Ute(t, e, r, n, i) { +}), Ep = Ma({}), Zb = typeof window < "u", s9 = Zb ? kR : Dn, o9 = Ma({ strict: !1 }); +function Yte(t, e, r, n, i) { var s, o; - const { visualElement: a } = Tn(_p), u = Tn(n9), l = Tn(xp), d = Tn(Xb).reducedMotion, g = bi(); - n = n || u.renderer, !g.current && n && (g.current = n(t, { + const { visualElement: a } = Tn(Ep), u = Tn(o9), l = Tn(_p), d = Tn(Xb).reducedMotion, p = oi(); + n = n || u.renderer, !p.current && n && (p.current = n(t, { visualState: e, parent: a, props: r, @@ -34789,28 +34789,28 @@ function Ute(t, e, r, n, i) { blockInitialAnimation: l ? l.initial === !1 : !1, reducedMotionConfig: d })); - const w = g.current, A = Tn(W7); - w && !w.projection && i && (w.type === "html" || w.type === "svg") && jte(g.current, r, i, A); - const M = bi(!1); - b5(() => { - w && M.current && w.update(r, l); + const w = p.current, A = Tn(G7); + w && !w.projection && i && (w.type === "html" || w.type === "svg") && Jte(p.current, r, i, A); + const P = oi(!1); + w5(() => { + w && P.current && w.update(r, l); }); - const N = r[I7], L = bi(!!N && !(!((s = window.MotionHandoffIsComplete) === null || s === void 0) && s.call(window, N)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, N))); - return r9(() => { - w && (M.current = !0, window.MotionIsMounted = !0, w.updateFeatures(), Jb.render(w.render), L.current && w.animationState && w.animationState.animateChanges()); - }), Xn(() => { + const N = r[R7], L = oi(!!N && !(!((s = window.MotionHandoffIsComplete) === null || s === void 0) && s.call(window, N)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, N))); + return s9(() => { + w && (P.current = !0, window.MotionIsMounted = !0, w.updateFeatures(), Jb.render(w.render), L.current && w.animationState && w.animationState.animateChanges()); + }), Dn(() => { w && (!L.current && w.animationState && w.animationState.animateChanges(), L.current && (queueMicrotask(() => { var $; ($ = window.MotionHandoffMarkAsComplete) === null || $ === void 0 || $.call(window, N); }), L.current = !1)); }), w; } -function jte(t, e, r, n) { +function Jte(t, e, r, n) { const { layoutId: i, layout: s, drag: o, dragConstraints: a, layoutScroll: u, layoutRoot: l } = e; - t.projection = new r(t.latestValues, e["data-framer-portal-id"] ? void 0 : i9(t.parent)), t.projection.setOptions({ + t.projection = new r(t.latestValues, e["data-framer-portal-id"] ? void 0 : a9(t.parent)), t.projection.setOptions({ layoutId: i, layout: s, - alwaysMeasureLayout: !!o || a && eu(a), + alwaysMeasureLayout: !!o || a && tu(a), visualElement: t, /** * TODO: Update options in an effect. This could be tricky as it'll be too late @@ -34825,14 +34825,14 @@ function jte(t, e, r, n) { layoutRoot: l }); } -function i9(t) { +function a9(t) { if (t) - return t.options.allowProjection !== !1 ? t.projection : i9(t.parent); + return t.options.allowProjection !== !1 ? t.projection : a9(t.parent); } -function qte(t, e, r) { +function Xte(t, e, r) { return vv( (n) => { - n && t.mount && t.mount(n), e && (n ? e.mount(n) : e.unmount()), r && (typeof r == "function" ? r(n) : eu(r) && (r.current = n)); + n && t.mount && t.mount(n), e && (n ? e.mount(n) : e.unmount()), r && (typeof r == "function" ? r(n) : tu(r) && (r.current = n)); }, /** * Only pass a new ref callback to React if we've received a visual element @@ -34842,30 +34842,30 @@ function qte(t, e, r) { [e] ); } -function Ep(t) { - return vp(t.animate) || Cb.some((e) => Ml(t[e])); +function Sp(t) { + return bp(t.animate) || Cb.some((e) => Il(t[e])); } -function s9(t) { - return !!(Ep(t) || t.variants); +function c9(t) { + return !!(Sp(t) || t.variants); } -function zte(t, e) { - if (Ep(t)) { +function Zte(t, e) { + if (Sp(t)) { const { initial: r, animate: n } = t; return { - initial: r === !1 || Ml(r) ? r : void 0, - animate: Ml(n) ? n : void 0 + initial: r === !1 || Il(r) ? r : void 0, + animate: Il(n) ? n : void 0 }; } return t.inherit !== !1 ? e : {}; } -function Hte(t) { - const { initial: e, animate: r } = zte(t, Tn(_p)); - return Oi(() => ({ initial: e, animate: r }), [t5(e), t5(r)]); +function Qte(t) { + const { initial: e, animate: r } = Zte(t, Tn(Ep)); + return Ni(() => ({ initial: e, animate: r }), [n5(e), n5(r)]); } -function t5(t) { +function n5(t) { return Array.isArray(t) ? t.join(" ") : t; } -const r5 = { +const i5 = { animation: [ "animate", "variants", @@ -34884,51 +34884,51 @@ const r5 = { pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"], inView: ["whileInView", "onViewportEnter", "onViewportLeave"], layout: ["layout", "layoutId"] -}, Iu = {}; -for (const t in r5) - Iu[t] = { - isEnabled: (e) => r5[t].some((r) => !!e[r]) +}, Cu = {}; +for (const t in i5) + Cu[t] = { + isEnabled: (e) => i5[t].some((r) => !!e[r]) }; -function Wte(t) { +function ere(t) { for (const e in t) - Iu[e] = { - ...Iu[e], + Cu[e] = { + ...Cu[e], ...t[e] }; } -const Kte = Symbol.for("motionComponentSymbol"); -function Vte({ preloadedFeatures: t, createVisualElement: e, useRender: r, useVisualState: n, Component: i }) { - t && Wte(t); +const tre = Symbol.for("motionComponentSymbol"); +function rre({ preloadedFeatures: t, createVisualElement: e, useRender: r, useVisualState: n, Component: i }) { + t && ere(t); function s(a, u) { let l; const d = { ...Tn(Xb), ...a, - layoutId: Gte(a) - }, { isStatic: g } = d, w = Hte(a), A = n(a, g); - if (!g && Zb) { - Yte(d, t); - const M = Jte(d); - l = M.MeasureLayout, w.visualElement = Ute(i, A, d, e, M.ProjectionNode); + layoutId: nre(a) + }, { isStatic: p } = d, w = Qte(a), A = n(a, p); + if (!p && Zb) { + ire(d, t); + const P = sre(d); + l = P.MeasureLayout, w.visualElement = Yte(i, A, d, e, P.ProjectionNode); } - return me.jsxs(_p.Provider, { value: w, children: [l && w.visualElement ? me.jsx(l, { visualElement: w.visualElement, ...d }) : null, r(i, a, qte(A, w.visualElement, u), A, g, w.visualElement)] }); + return fe.jsxs(Ep.Provider, { value: w, children: [l && w.visualElement ? fe.jsx(l, { visualElement: w.visualElement, ...d }) : null, r(i, a, Xte(A, w.visualElement, u), A, p, w.visualElement)] }); } const o = gv(s); - return o[Kte] = i, o; + return o[tre] = i, o; } -function Gte({ layoutId: t }) { +function nre({ layoutId: t }) { const e = Tn(Yb).id; return e && t !== void 0 ? e + "-" + t : t; } -function Yte(t, e) { - const r = Tn(n9).strict; +function ire(t, e) { + const r = Tn(o9).strict; if (process.env.NODE_ENV !== "production" && e && r) { const n = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead."; - t.ignoreStrict ? Wu(!1, n) : Uo(!1, n); + t.ignoreStrict ? Ku(!1, n) : zo(!1, n); } } -function Jte(t) { - const { drag: e, layout: r } = Iu; +function sre(t) { + const { drag: e, layout: r } = Cu; if (!e && !r) return {}; const n = { ...e, ...r }; @@ -34937,7 +34937,7 @@ function Jte(t) { ProjectionNode: n.ProjectionNode }; } -const Xte = [ +const ore = [ "animate", "circle", "defs", @@ -34977,19 +34977,19 @@ function Qb(t) { /** * If it's in our list of lowercase SVG tags, it's an SVG component */ - !!(Xte.indexOf(t) > -1 || /** + !!(ore.indexOf(t) > -1 || /** * If it contains a capital letter, it's an SVG component */ /[A-Z]/u.test(t)) ) ); } -function o9(t, { style: e, vars: r }, n, i) { +function u9(t, { style: e, vars: r }, n, i) { Object.assign(t.style, e, i && i.getProjectionStyles(n)); for (const s in r) t.style.setProperty(s, r[s]); } -const a9 = /* @__PURE__ */ new Set([ +const f9 = /* @__PURE__ */ new Set([ "baseFrequency", "diffuseConstant", "kernelMatrix", @@ -35014,71 +35014,71 @@ const a9 = /* @__PURE__ */ new Set([ "textLength", "lengthAdjust" ]); -function c9(t, e, r, n) { - o9(t, e, void 0, n); +function l9(t, e, r, n) { + u9(t, e, void 0, n); for (const i in e.attrs) - t.setAttribute(a9.has(i) ? i : Gb(i), e.attrs[i]); + t.setAttribute(f9.has(i) ? i : Gb(i), e.attrs[i]); } -function u9(t, { layout: e, layoutId: r }) { - return Sc.has(t) || t.startsWith("origin") || (e || r !== void 0) && (!!x0[t] || t === "opacity"); +function h9(t, { layout: e, layoutId: r }) { + return Ac.has(t) || t.startsWith("origin") || (e || r !== void 0) && (!!_0[t] || t === "opacity"); } function ey(t, e, r) { var n; const { style: i } = t, s = {}; for (const o in i) - (Jn(i[o]) || e.style && Jn(e.style[o]) || u9(o, t) || ((n = r == null ? void 0 : r.getValue(o)) === null || n === void 0 ? void 0 : n.liveStyle) !== void 0) && (s[o] = i[o]); + (Xn(i[o]) || e.style && Xn(e.style[o]) || h9(o, t) || ((n = r == null ? void 0 : r.getValue(o)) === null || n === void 0 ? void 0 : n.liveStyle) !== void 0) && (s[o] = i[o]); return s; } -function f9(t, e, r) { +function d9(t, e, r) { const n = ey(t, e, r); for (const i in t) - if (Jn(t[i]) || Jn(e[i])) { - const s = oh.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i; + if (Xn(t[i]) || Xn(e[i])) { + const s = ah.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i; n[s] = t[i]; } return n; } function ty(t) { - const e = bi(null); + const e = oi(null); return e.current === null && (e.current = t()), e.current; } -function Zte({ scrapeMotionValuesFromProps: t, createRenderState: e, onMount: r }, n, i, s) { +function are({ scrapeMotionValuesFromProps: t, createRenderState: e, onMount: r }, n, i, s) { const o = { - latestValues: Qte(n, i, s, t), + latestValues: cre(n, i, s, t), renderState: e() }; return r && (o.mount = (a) => r(n, a, o)), o; } -const l9 = (t) => (e, r) => { - const n = Tn(_p), i = Tn(xp), s = () => Zte(t, e, n, i); +const p9 = (t) => (e, r) => { + const n = Tn(Ep), i = Tn(_p), s = () => are(t, e, n, i); return r ? s() : ty(s); }; -function Qte(t, e, r, n) { +function cre(t, e, r, n) { const i = {}, s = n(t, {}); for (const w in s) i[w] = Ud(s[w]); let { initial: o, animate: a } = t; - const u = Ep(t), l = s9(t); + const u = Sp(t), l = c9(t); e && l && !u && t.inherit !== !1 && (o === void 0 && (o = e.initial), a === void 0 && (a = e.animate)); let d = r ? r.initial === !1 : !1; d = d || o === !1; - const g = d ? a : o; - if (g && typeof g != "boolean" && !vp(g)) { - const w = Array.isArray(g) ? g : [g]; + const p = d ? a : o; + if (p && typeof p != "boolean" && !bp(p)) { + const w = Array.isArray(p) ? p : [p]; for (let A = 0; A < w.length; A++) { - const M = Mb(t, w[A]); - if (M) { - const { transitionEnd: N, transition: L, ...$ } = M; - for (const F in $) { - let K = $[F]; - if (Array.isArray(K)) { - const H = d ? K.length - 1 : 0; - K = K[H]; + const P = Mb(t, w[A]); + if (P) { + const { transitionEnd: N, transition: L, ...$ } = P; + for (const B in $) { + let H = $[B]; + if (Array.isArray(H)) { + const W = d ? H.length - 1 : 0; + H = H[W]; } - K !== null && (i[F] = K); + H !== null && (i[B] = H); } - for (const F in N) - i[F] = N[F]; + for (const B in N) + i[B] = N[B]; } } } @@ -35089,27 +35089,27 @@ const ry = () => ({ transform: {}, transformOrigin: {}, vars: {} -}), h9 = () => ({ +}), g9 = () => ({ ...ry(), attrs: {} -}), d9 = (t, e) => e && typeof t == "number" ? e.transform(t) : t, ere = { +}), m9 = (t, e) => e && typeof t == "number" ? e.transform(t) : t, ure = { x: "translateX", y: "translateY", z: "translateZ", transformPerspective: "perspective" -}, tre = oh.length; -function rre(t, e, r) { +}, fre = ah.length; +function lre(t, e, r) { let n = "", i = !0; - for (let s = 0; s < tre; s++) { - const o = oh[s], a = t[o]; + for (let s = 0; s < fre; s++) { + const o = ah[s], a = t[o]; if (a === void 0) continue; let u = !0; if (typeof a == "number" ? u = a === (o.startsWith("scale") ? 1 : 0) : u = parseFloat(a) === 0, !u || r) { - const l = d9(a, $b[o]); + const l = m9(a, $b[o]); if (!u) { i = !1; - const d = ere[o] || o; + const d = ure[o] || o; n += `${d}(${l}) `; } r && (e[o] = l); @@ -35122,39 +35122,39 @@ function ny(t, e, r) { let o = !1, a = !1; for (const u in e) { const l = e[u]; - if (Sc.has(u)) { + if (Ac.has(u)) { o = !0; continue; - } else if (s7(u)) { + } else if (c7(u)) { i[u] = l; continue; } else { - const d = d9(l, $b[u]); + const d = m9(l, $b[u]); u.startsWith("origin") ? (a = !0, s[u] = d) : n[u] = d; } } - if (e.transform || (o || r ? n.transform = rre(e, t.transform, r) : n.transform && (n.transform = "none")), a) { + if (e.transform || (o || r ? n.transform = lre(e, t.transform, r) : n.transform && (n.transform = "none")), a) { const { originX: u = "50%", originY: l = "50%", originZ: d = 0 } = s; n.transformOrigin = `${u} ${l} ${d}`; } } -function n5(t, e, r) { +function s5(t, e, r) { return typeof t == "string" ? t : Vt.transform(e + r * t); } -function nre(t, e, r) { - const n = n5(e, t.x, t.width), i = n5(r, t.y, t.height); +function hre(t, e, r) { + const n = s5(e, t.x, t.width), i = s5(r, t.y, t.height); return `${n} ${i}`; } -const ire = { +const dre = { offset: "stroke-dashoffset", array: "stroke-dasharray" -}, sre = { +}, pre = { offset: "strokeDashoffset", array: "strokeDasharray" }; -function ore(t, e, r = 1, n = 0, i = !0) { +function gre(t, e, r = 1, n = 0, i = !0) { t.pathLength = 1; - const s = i ? ire : sre; + const s = i ? dre : pre; t[s.offset] = Vt.transform(-n); const o = Vt.transform(e), a = Vt.transform(r); t[s.array] = `${o} ${a}`; @@ -35170,19 +35170,19 @@ function iy(t, { pathOffset: u = 0, // This is object creation, which we try to avoid per-frame. ...l -}, d, g) { - if (ny(t, l, g), d) { +}, d, p) { + if (ny(t, l, p), d) { t.style.viewBox && (t.attrs.viewBox = t.style.viewBox); return; } t.attrs = t.style, t.style = {}; - const { attrs: w, style: A, dimensions: M } = t; - w.transform && (M && (A.transform = w.transform), delete w.transform), M && (i !== void 0 || s !== void 0 || A.transform) && (A.transformOrigin = nre(M, i !== void 0 ? i : 0.5, s !== void 0 ? s : 0.5)), e !== void 0 && (w.x = e), r !== void 0 && (w.y = r), n !== void 0 && (w.scale = n), o !== void 0 && ore(w, o, a, u, !1); + const { attrs: w, style: A, dimensions: P } = t; + w.transform && (P && (A.transform = w.transform), delete w.transform), P && (i !== void 0 || s !== void 0 || A.transform) && (A.transformOrigin = hre(P, i !== void 0 ? i : 0.5, s !== void 0 ? s : 0.5)), e !== void 0 && (w.x = e), r !== void 0 && (w.y = r), n !== void 0 && (w.scale = n), o !== void 0 && gre(w, o, a, u, !1); } -const sy = (t) => typeof t == "string" && t.toLowerCase() === "svg", are = { - useVisualState: l9({ - scrapeMotionValuesFromProps: f9, - createRenderState: h9, +const sy = (t) => typeof t == "string" && t.toLowerCase() === "svg", mre = { + useVisualState: p9({ + scrapeMotionValuesFromProps: d9, + createRenderState: g9, onMount: (t, e, { renderState: r, latestValues: n }) => { Lr.read(() => { try { @@ -35196,35 +35196,35 @@ const sy = (t) => typeof t == "string" && t.toLowerCase() === "svg", are = { }; } }), Lr.render(() => { - iy(r, n, sy(e.tagName), t.transformTemplate), c9(e, r); + iy(r, n, sy(e.tagName), t.transformTemplate), l9(e, r); }); } }) -}, cre = { - useVisualState: l9({ +}, vre = { + useVisualState: p9({ scrapeMotionValuesFromProps: ey, createRenderState: ry }) }; -function p9(t, e, r) { +function v9(t, e, r) { for (const n in e) - !Jn(e[n]) && !u9(n, r) && (t[n] = e[n]); + !Xn(e[n]) && !h9(n, r) && (t[n] = e[n]); } -function ure({ transformTemplate: t }, e) { - return Oi(() => { +function bre({ transformTemplate: t }, e) { + return Ni(() => { const r = ry(); return ny(r, e, t), Object.assign({}, r.vars, r.style); }, [e]); } -function fre(t, e) { +function yre(t, e) { const r = t.style || {}, n = {}; - return p9(n, r, t), Object.assign(n, ure(t, e)), n; + return v9(n, r, t), Object.assign(n, bre(t, e)), n; } -function lre(t, e) { - const r = {}, n = fre(t, e); +function wre(t, e) { + const r = {}, n = yre(t, e); return t.drag && t.dragListener !== !1 && (r.draggable = !1, n.userSelect = n.WebkitUserSelect = n.WebkitTouchCallout = "none", n.touchAction = t.drag === !0 ? "none" : `pan-${t.drag === "x" ? "y" : "x"}`), t.tabIndex === void 0 && (t.onTap || t.onTapStart || t.whileTap) && (r.tabIndex = 0), r.style = n, r; } -const hre = /* @__PURE__ */ new Set([ +const xre = /* @__PURE__ */ new Set([ "animate", "exit", "variants", @@ -35256,27 +35256,27 @@ const hre = /* @__PURE__ */ new Set([ "ignoreStrict", "viewport" ]); -function _0(t) { - return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || hre.has(t); +function E0(t) { + return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || xre.has(t); } -let g9 = (t) => !_0(t); -function dre(t) { - t && (g9 = (e) => e.startsWith("on") ? !_0(e) : t(e)); +let b9 = (t) => !E0(t); +function _re(t) { + t && (b9 = (e) => e.startsWith("on") ? !E0(e) : t(e)); } try { - dre(require("@emotion/is-prop-valid").default); + _re(require("@emotion/is-prop-valid").default); } catch { } -function pre(t, e, r) { +function Ere(t, e, r) { const n = {}; for (const i in t) - i === "values" && typeof t.values == "object" || (g9(i) || r === !0 && _0(i) || !e && !_0(i) || // If trying to use native HTML drag events, forward drag listeners + i === "values" && typeof t.values == "object" || (b9(i) || r === !0 && E0(i) || !e && !E0(i) || // If trying to use native HTML drag events, forward drag listeners t.draggable && i.startsWith("onDrag")) && (n[i] = t[i]); return n; } -function gre(t, e, r, n) { - const i = Oi(() => { - const s = h9(); +function Sre(t, e, r, n) { + const i = Ni(() => { + const s = g9(); return iy(s, e, sy(n), t.transformTemplate), { ...s.attrs, style: { ...s.style } @@ -35284,61 +35284,61 @@ function gre(t, e, r, n) { }, [e]); if (t.style) { const s = {}; - p9(s, t.style, t), i.style = { ...s, ...i.style }; + v9(s, t.style, t), i.style = { ...s, ...i.style }; } return i; } -function mre(t = !1) { +function Are(t = !1) { return (r, n, i, { latestValues: s }, o) => { - const u = (Qb(r) ? gre : lre)(n, s, o, r), l = pre(n, typeof r == "string", t), d = r !== y5 ? { ...l, ...u, ref: i } : {}, { children: g } = n, w = Oi(() => Jn(g) ? g.get() : g, [g]); - return jd(r, { + const u = (Qb(r) ? Sre : wre)(n, s, o, r), l = Ere(n, typeof r == "string", t), d = r !== x5 ? { ...l, ...u, ref: i } : {}, { children: p } = n, w = Ni(() => Xn(p) ? p.get() : p, [p]); + return qd(r, { ...d, children: w }); }; } -function vre(t, e) { +function Pre(t, e) { return function(n, { forwardMotionProps: i } = { forwardMotionProps: !1 }) { const o = { - ...Qb(n) ? are : cre, + ...Qb(n) ? mre : vre, preloadedFeatures: t, - useRender: mre(i), + useRender: Are(i), createVisualElement: e, Component: n }; - return Vte(o); + return rre(o); }; } -const fv = { current: null }, m9 = { current: !1 }; -function bre() { - if (m9.current = !0, !!Zb) +const fv = { current: null }, y9 = { current: !1 }; +function Mre() { + if (y9.current = !0, !!Zb) if (window.matchMedia) { const t = window.matchMedia("(prefers-reduced-motion)"), e = () => fv.current = t.matches; t.addListener(e), e(); } else fv.current = !1; } -function yre(t, e, r) { +function Ire(t, e, r) { for (const n in e) { const i = e[n], s = r[n]; - if (Jn(i)) - t.addValue(n, i), process.env.NODE_ENV === "development" && mp(i.version === "11.11.17", `Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`); - else if (Jn(s)) - t.addValue(n, Tl(i, { owner: t })); + if (Xn(i)) + t.addValue(n, i), process.env.NODE_ENV === "development" && vp(i.version === "11.11.17", `Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`); + else if (Xn(s)) + t.addValue(n, Rl(i, { owner: t })); else if (s !== i) if (t.hasValue(n)) { const o = t.getValue(n); o.liveStyle === !0 ? o.jump(i) : o.hasAnimated || o.set(i); } else { const o = t.getStaticValue(n); - t.addValue(n, Tl(o !== void 0 ? o : i, { owner: t })); + t.addValue(n, Rl(o !== void 0 ? o : i, { owner: t })); } } for (const n in r) e[n] === void 0 && t.removeValue(n); return e; } -const i5 = /* @__PURE__ */ new WeakMap(), wre = [...c7, Gn, _a], xre = (t) => wre.find(a7(t)), s5 = [ +const o5 = /* @__PURE__ */ new WeakMap(), Cre = [...l7, Yn, Aa], Tre = (t) => Cre.find(f7(t)), a5 = [ "AnimationStart", "AnimationComplete", "Update", @@ -35347,7 +35347,7 @@ const i5 = /* @__PURE__ */ new WeakMap(), wre = [...c7, Gn, _a], xre = (t) => wr "LayoutAnimationStart", "LayoutAnimationComplete" ]; -class _re { +class Rre { /** * This method takes React props and returns found MotionValues. For example, HTML * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays. @@ -35362,22 +35362,22 @@ class _re { this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = Nb, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => { this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection)); }, this.renderScheduledAt = 0, this.scheduleRender = () => { - const w = Gs.now(); + const w = Ys.now(); this.renderScheduledAt < w && (this.renderScheduledAt = w, Lr.render(this.render, !1, !0)); }; const { latestValues: u, renderState: l } = o; - this.latestValues = u, this.baseTarget = { ...u }, this.initialValues = r.initial ? { ...u } : {}, this.renderState = l, this.parent = e, this.props = r, this.presenceContext = n, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!s, this.isControllingVariants = Ep(r), this.isVariantNode = s9(r), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current); - const { willChange: d, ...g } = this.scrapeMotionValuesFromProps(r, {}, this); - for (const w in g) { - const A = g[w]; - u[w] !== void 0 && Jn(A) && A.set(u[w], !1); + this.latestValues = u, this.baseTarget = { ...u }, this.initialValues = r.initial ? { ...u } : {}, this.renderState = l, this.parent = e, this.props = r, this.presenceContext = n, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!s, this.isControllingVariants = Sp(r), this.isVariantNode = c9(r), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current); + const { willChange: d, ...p } = this.scrapeMotionValuesFromProps(r, {}, this); + for (const w in p) { + const A = p[w]; + u[w] !== void 0 && Xn(A) && A.set(u[w], !1); } } mount(e) { - this.current = e, i5.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((r, n) => this.bindToMotionValue(n, r)), m9.current || bre(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : fv.current, process.env.NODE_ENV !== "production" && mp(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext); + this.current = e, o5.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((r, n) => this.bindToMotionValue(n, r)), y9.current || Mre(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : fv.current, process.env.NODE_ENV !== "production" && vp(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext); } unmount() { - i5.delete(this.current), this.projection && this.projection.unmount(), wa(this.notifyUpdate), wa(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this); + o5.delete(this.current), this.projection && this.projection.unmount(), Ea(this.notifyUpdate), Ea(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this); for (const e in this.events) this.events[e].clear(); for (const e in this.features) { @@ -35388,7 +35388,7 @@ class _re { } bindToMotionValue(e, r) { this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)(); - const n = Sc.has(e), i = r.on("change", (a) => { + const n = Ac.has(e), i = r.on("change", (a) => { this.latestValues[e] = a, this.props.onUpdate && Lr.preRender(this.notifyUpdate), n && this.projection && (this.projection.isTransformDirty = !0); }), s = r.on("renderRequest", this.scheduleRender); let o; @@ -35401,8 +35401,8 @@ class _re { } updateFeatures() { let e = "animation"; - for (e in Iu) { - const r = Iu[e]; + for (e in Cu) { + const r = Cu[e]; if (!r) continue; const { isEnabled: n, Feature: i } = r; @@ -35435,13 +35435,13 @@ class _re { */ update(e, r) { (e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = r; - for (let n = 0; n < s5.length; n++) { - const i = s5[n]; + for (let n = 0; n < a5.length; n++) { + const i = a5[n]; this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]); const s = "on" + i, o = e[s]; o && (this.propEventSubscriptions[i] = this.on(i, o)); } - this.prevMotionValues = yre(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue(); + this.prevMotionValues = Ire(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue(); } getProps() { return this.props; @@ -35497,7 +35497,7 @@ class _re { if (this.props.values && this.props.values[e]) return this.props.values[e]; let n = this.values.get(e); - return n === void 0 && r !== void 0 && (n = Tl(r === null ? void 0 : r, { owner: this }), this.addValue(e, n)), n; + return n === void 0 && r !== void 0 && (n = Rl(r === null ? void 0 : r, { owner: this }), this.addValue(e, n)), n; } /** * If we're trying to animate to a previously unencountered value, @@ -35507,7 +35507,7 @@ class _re { readValue(e, r) { var n; let i = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : (n = this.getBaseTargetFromProps(this.props, e)) !== null && n !== void 0 ? n : this.readValueFromInstance(this.current, e, this.options); - return i != null && (typeof i == "string" && (n7(i) || r7(i)) ? i = parseFloat(i) : !xre(i) && _a.test(r) && (i = m7(e, r)), this.setBaseTarget(e, Jn(i) ? i.get() : i)), Jn(i) ? i.get() : i; + return i != null && (typeof i == "string" && (o7(i) || s7(i)) ? i = parseFloat(i) : !Tre(i) && Aa.test(r) && (i = y7(e, r)), this.setBaseTarget(e, Xn(i) ? i.get() : i)), Xn(i) ? i.get() : i; } /** * Set the base target to later animate back to. This is currently @@ -35531,7 +35531,7 @@ class _re { if (n && i !== void 0) return i; const s = this.getBaseTargetFromProps(this.props, e); - return s !== void 0 && !Jn(s) ? s : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e]; + return s !== void 0 && !Xn(s) ? s : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e]; } on(e, r) { return this.events[e] || (this.events[e] = new Vb()), this.events[e].add(r); @@ -35540,9 +35540,9 @@ class _re { this.events[e] && this.events[e].notify(...r); } } -class v9 extends _re { +class w9 extends Rre { constructor() { - super(...arguments), this.KeyframeResolver = v7; + super(...arguments), this.KeyframeResolver = w7; } sortInstanceNodePosition(e, r) { return e.compareDocumentPosition(r) & 2 ? 1 : -1; @@ -35554,24 +35554,24 @@ class v9 extends _re { delete r[e], delete n[e]; } } -function Ere(t) { +function Dre(t) { return window.getComputedStyle(t); } -class Sre extends v9 { +class Ore extends w9 { constructor() { - super(...arguments), this.type = "html", this.renderInstance = o9; + super(...arguments), this.type = "html", this.renderInstance = u9; } readValueFromInstance(e, r) { - if (Sc.has(r)) { - const n = Fb(r); + if (Ac.has(r)) { + const n = Bb(r); return n && n.default || 0; } else { - const n = Ere(e), i = (s7(r) ? n.getPropertyValue(r) : n[r]) || 0; + const n = Dre(e), i = (c7(r) ? n.getPropertyValue(r) : n[r]) || 0; return typeof i == "string" ? i.trim() : i; } } measureInstanceViewportBox(e, { transformPagePoint: r }) { - return z7(e, r); + return K7(e, r); } build(e, r, n) { ny(e, r, n.transformTemplate); @@ -35582,12 +35582,12 @@ class Sre extends v9 { handleChildMotionValue() { this.childSubscription && (this.childSubscription(), delete this.childSubscription); const { children: e } = this.props; - Jn(e) && (this.childSubscription = e.on("change", (r) => { + Xn(e) && (this.childSubscription = e.on("change", (r) => { this.current && (this.current.textContent = `${r}`); })); } } -class Are extends v9 { +class Nre extends w9 { constructor() { super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = ln; } @@ -35595,34 +35595,34 @@ class Are extends v9 { return e[r]; } readValueFromInstance(e, r) { - if (Sc.has(r)) { - const n = Fb(r); + if (Ac.has(r)) { + const n = Bb(r); return n && n.default || 0; } - return r = a9.has(r) ? r : Gb(r), e.getAttribute(r); + return r = f9.has(r) ? r : Gb(r), e.getAttribute(r); } scrapeMotionValuesFromProps(e, r, n) { - return f9(e, r, n); + return d9(e, r, n); } build(e, r, n) { iy(e, r, this.isSVGTag, n.transformTemplate); } renderInstance(e, r, n, i) { - c9(e, r, n, i); + l9(e, r, n, i); } mount(e) { this.isSVGTag = sy(e.tagName), super.mount(e); } } -const Pre = (t, e) => Qb(t) ? new Are(e) : new Sre(e, { - allowProjection: t !== y5 -}), Mre = /* @__PURE__ */ vre({ - ...mee, - ...Fte, - ...Mte, - ...Bte -}, Pre), Ire = /* @__PURE__ */ aZ(Mre); -class Cre extends Gt.Component { +const Lre = (t, e) => Qb(t) ? new Nre(e) : new Ore(e, { + allowProjection: t !== x5 +}), kre = /* @__PURE__ */ Pre({ + ...Aee, + ...Vte, + ...kte, + ...Gte +}, Lre), $re = /* @__PURE__ */ mZ(kre); +class Bre extends Yt.Component { getSnapshotBeforeUpdate(e) { const r = this.props.childRef.current; if (r && e.isPresent && !this.props.isPresent) { @@ -35640,14 +35640,14 @@ class Cre extends Gt.Component { return this.props.children; } } -function Tre({ children: t, isPresent: e }) { - const r = mv(), n = bi(null), i = bi({ +function Fre({ children: t, isPresent: e }) { + const r = mv(), n = oi(null), i = oi({ width: 0, height: 0, top: 0, left: 0 }), { nonce: s } = Tn(Xb); - return b5(() => { + return w5(() => { const { width: o, height: a, top: u, left: l } = i.current; if (e || !n.current || !o || !a) return; @@ -35664,23 +35664,23 @@ function Tre({ children: t, isPresent: e }) { `), () => { document.head.removeChild(d); }; - }, [e]), me.jsx(Cre, { isPresent: e, childRef: n, sizeRef: i, children: Gt.cloneElement(t, { ref: n }) }); + }, [e]), fe.jsx(Bre, { isPresent: e, childRef: n, sizeRef: i, children: Yt.cloneElement(t, { ref: n }) }); } -const Rre = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: i, presenceAffectsLayout: s, mode: o }) => { - const a = ty(Dre), u = mv(), l = vv((g) => { - a.set(g, !0); +const jre = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: i, presenceAffectsLayout: s, mode: o }) => { + const a = ty(Ure), u = mv(), l = vv((p) => { + a.set(p, !0); for (const w of a.values()) if (!w) return; n && n(); - }, [a, n]), d = Oi( + }, [a, n]), d = Ni( () => ({ id: u, initial: e, isPresent: r, custom: i, onExitComplete: l, - register: (g) => (a.set(g, !1), () => a.delete(g)) + register: (p) => (a.set(p, !1), () => a.delete(p)) }), /** * If the presence of a child affects the layout of the components around it, @@ -35689,59 +35689,59 @@ const Rre = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: */ s ? [Math.random(), l] : [r, l] ); - return Oi(() => { - a.forEach((g, w) => a.set(w, !1)); - }, [r]), Gt.useEffect(() => { + return Ni(() => { + a.forEach((p, w) => a.set(w, !1)); + }, [r]), Yt.useEffect(() => { !r && !a.size && n && n(); - }, [r]), o === "popLayout" && (t = me.jsx(Tre, { isPresent: r, children: t })), me.jsx(xp.Provider, { value: d, children: t }); + }, [r]), o === "popLayout" && (t = fe.jsx(Fre, { isPresent: r, children: t })), fe.jsx(_p.Provider, { value: d, children: t }); }; -function Dre() { +function Ure() { return /* @__PURE__ */ new Map(); } -const vd = (t) => t.key || ""; -function o5(t) { +const bd = (t) => t.key || ""; +function c5(t) { const e = []; - return MR.forEach(t, (r) => { - IR(r) && e.push(r); + return $R.forEach(t, (r) => { + BR(r) && e.push(r); }), e; } -const Ore = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExitComplete: i, presenceAffectsLayout: s = !0, mode: o = "sync" }) => { - Uo(!e, "Replace exitBeforeEnter with mode='wait'"); - const a = Oi(() => o5(t), [t]), u = a.map(vd), l = bi(!0), d = bi(a), g = ty(() => /* @__PURE__ */ new Map()), [w, A] = fr(a), [M, N] = fr(a); - r9(() => { +const qre = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExitComplete: i, presenceAffectsLayout: s = !0, mode: o = "sync" }) => { + zo(!e, "Replace exitBeforeEnter with mode='wait'"); + const a = Ni(() => c5(t), [t]), u = a.map(bd), l = oi(!0), d = oi(a), p = ty(() => /* @__PURE__ */ new Map()), [w, A] = Gt(a), [P, N] = Gt(a); + s9(() => { l.current = !1, d.current = a; - for (let F = 0; F < M.length; F++) { - const K = vd(M[F]); - u.includes(K) ? g.delete(K) : g.get(K) !== !0 && g.set(K, !1); + for (let B = 0; B < P.length; B++) { + const H = bd(P[B]); + u.includes(H) ? p.delete(H) : p.get(H) !== !0 && p.set(H, !1); } - }, [M, u.length, u.join("-")]); + }, [P, u.length, u.join("-")]); const L = []; if (a !== w) { - let F = [...a]; - for (let K = 0; K < M.length; K++) { - const H = M[K], V = vd(H); - u.includes(V) || (F.splice(K, 0, H), L.push(H)); + let B = [...a]; + for (let H = 0; H < P.length; H++) { + const W = P[H], V = bd(W); + u.includes(V) || (B.splice(H, 0, W), L.push(W)); } - o === "wait" && L.length && (F = L), N(o5(F)), A(a); + o === "wait" && L.length && (B = L), N(c5(B)), A(a); return; } - process.env.NODE_ENV !== "production" && o === "wait" && M.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`); + process.env.NODE_ENV !== "production" && o === "wait" && P.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`); const { forceRender: $ } = Tn(Yb); - return me.jsx(me.Fragment, { children: M.map((F) => { - const K = vd(F), H = a === M || u.includes(K), V = () => { - if (g.has(K)) - g.set(K, !0); + return fe.jsx(fe.Fragment, { children: P.map((B) => { + const H = bd(B), W = a === P || u.includes(H), V = () => { + if (p.has(H)) + p.set(H, !0); else return; let te = !0; - g.forEach((R) => { + p.forEach((R) => { R || (te = !1); }), te && ($ == null || $(), N(d.current), i && i()); }; - return me.jsx(Rre, { isPresent: H, initial: !l.current || n ? void 0 : !1, custom: H ? void 0 : r, presenceAffectsLayout: s, mode: o, onExitComplete: H ? void 0 : V, children: F }, K); + return fe.jsx(jre, { isPresent: W, initial: !l.current || n ? void 0 : !1, custom: W ? void 0 : r, presenceAffectsLayout: s, mode: o, onExitComplete: W ? void 0 : V, children: B }, H); }) }); -}, Ac = (t) => /* @__PURE__ */ me.jsx(Ore, { children: /* @__PURE__ */ me.jsx( - Ire.div, +}, so = (t) => /* @__PURE__ */ fe.jsx(qre, { children: /* @__PURE__ */ fe.jsx( + $re.div, { initial: { x: 0, opacity: 0 }, animate: { x: 0, opacity: 1 }, @@ -35756,7 +35756,7 @@ function oy(t) { function s() { i && i(); } - return /* @__PURE__ */ me.jsxs( + return /* @__PURE__ */ fe.jsxs( "div", { className: "xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg", @@ -35764,61 +35764,61 @@ function oy(t) { children: [ e, r, - /* @__PURE__ */ me.jsxs("div", { className: "xc-relative xc-ml-auto xc-h-6", children: [ - /* @__PURE__ */ me.jsx("div", { className: "xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0", children: n }), - /* @__PURE__ */ me.jsx("div", { className: "xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100", children: /* @__PURE__ */ me.jsx(tZ, {}) }) + /* @__PURE__ */ fe.jsxs("div", { className: "xc-relative xc-ml-auto xc-h-6", children: [ + /* @__PURE__ */ fe.jsx("div", { className: "xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0", children: n }), + /* @__PURE__ */ fe.jsx("div", { className: "xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100", children: /* @__PURE__ */ fe.jsx(lZ, {}) }) ] }) ] } ); } -function Nre(t) { - return t.lastUsed ? /* @__PURE__ */ me.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500", children: [ - /* @__PURE__ */ me.jsx("div", { className: "xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]" }), +function zre(t) { + return t.lastUsed ? /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500", children: [ + /* @__PURE__ */ fe.jsx("div", { className: "xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]" }), "Last Used" - ] }) : t.installed ? /* @__PURE__ */ me.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500", children: [ - /* @__PURE__ */ me.jsx("div", { className: "xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]" }), + ] }) : t.installed ? /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500", children: [ + /* @__PURE__ */ fe.jsx("div", { className: "xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]" }), "Installed" ] }) : null; } -function b9(t) { +function x9(t) { var o, a; - const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ me.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: (o = e.config) == null ? void 0 : o.image }), i = ((a = e.config) == null ? void 0 : a.name) || "", s = Oi(() => Nre(e), [e]); - return /* @__PURE__ */ me.jsx(oy, { icon: n, title: i, extra: s, onClick: () => r(e) }); + const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ fe.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: (o = e.config) == null ? void 0 : o.image }), i = ((a = e.config) == null ? void 0 : a.name) || "", s = Ni(() => zre(e), [e]); + return /* @__PURE__ */ fe.jsx(oy, { icon: n, title: i, extra: s, onClick: () => r(e) }); } -function y9(t) { +function _9(t) { var e, r, n = ""; if (typeof t == "string" || typeof t == "number") n += t; else if (typeof t == "object") if (Array.isArray(t)) { var i = t.length; - for (e = 0; e < i; e++) t[e] && (r = y9(t[e])) && (n && (n += " "), n += r); + for (e = 0; e < i; e++) t[e] && (r = _9(t[e])) && (n && (n += " "), n += r); } else for (r in t) t[r] && (n && (n += " "), n += r); return n; } -function Lre() { - for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++) (t = arguments[r]) && (e = y9(t)) && (n && (n += " "), n += e); +function Wre() { + for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++) (t = arguments[r]) && (e = _9(t)) && (n && (n += " "), n += e); return n; } -const kre = Lre, ay = "-", $re = (t) => { - const e = Bre(t), { +const Hre = Wre, ay = "-", Kre = (t) => { + const e = Gre(t), { conflictingClassGroups: r, conflictingClassGroupModifiers: n } = t; return { getClassGroupId: (o) => { const a = o.split(ay); - return a[0] === "" && a.length !== 1 && a.shift(), w9(a, e) || Fre(o); + return a[0] === "" && a.length !== 1 && a.shift(), E9(a, e) || Vre(o); }, getConflictingClassGroupIds: (o, a) => { const u = r[o] || []; return a && n[o] ? [...u, ...n[o]] : u; } }; -}, w9 = (t, e) => { +}, E9 = (t, e) => { var o; if (t.length === 0) return e.classGroupId; - const r = t[0], n = e.nextPart.get(r), i = n ? w9(t.slice(1), n) : void 0; + const r = t[0], n = e.nextPart.get(r), i = n ? E9(t.slice(1), n) : void 0; if (i) return i; if (e.validators.length === 0) @@ -35827,13 +35827,13 @@ const kre = Lre, ay = "-", $re = (t) => { return (o = e.validators.find(({ validator: a }) => a(s))) == null ? void 0 : o.classGroupId; -}, a5 = /^\[(.+)\]$/, Fre = (t) => { - if (a5.test(t)) { - const e = a5.exec(t)[1], r = e == null ? void 0 : e.substring(0, e.indexOf(":")); +}, u5 = /^\[(.+)\]$/, Vre = (t) => { + if (u5.test(t)) { + const e = u5.exec(t)[1], r = e == null ? void 0 : e.substring(0, e.indexOf(":")); if (r) return "arbitrary.." + r; } -}, Bre = (t) => { +}, Gre = (t) => { const { theme: e, prefix: r @@ -35841,18 +35841,18 @@ const kre = Lre, ay = "-", $re = (t) => { nextPart: /* @__PURE__ */ new Map(), validators: [] }; - return jre(Object.entries(t.classGroups), r).forEach(([s, o]) => { + return Jre(Object.entries(t.classGroups), r).forEach(([s, o]) => { lv(o, n, s, e); }), n; }, lv = (t, e, r, n) => { t.forEach((i) => { if (typeof i == "string") { - const s = i === "" ? e : c5(e, i); + const s = i === "" ? e : f5(e, i); s.classGroupId = r; return; } if (typeof i == "function") { - if (Ure(i)) { + if (Yre(i)) { lv(i(n), e, r, n); return; } @@ -35863,10 +35863,10 @@ const kre = Lre, ay = "-", $re = (t) => { return; } Object.entries(i).forEach(([s, o]) => { - lv(o, c5(e, s), r, n); + lv(o, f5(e, s), r, n); }); }); -}, c5 = (t, e) => { +}, f5 = (t, e) => { let r = t; return e.split(ay).forEach((n) => { r.nextPart.has(n) || r.nextPart.set(n, { @@ -35874,10 +35874,10 @@ const kre = Lre, ay = "-", $re = (t) => { validators: [] }), r = r.nextPart.get(n); }), r; -}, Ure = (t) => t.isThemeGetter, jre = (t, e) => e ? t.map(([r, n]) => { +}, Yre = (t) => t.isThemeGetter, Jre = (t, e) => e ? t.map(([r, n]) => { const i = n.map((s) => typeof s == "string" ? e + s : typeof s == "object" ? Object.fromEntries(Object.entries(s).map(([o, a]) => [e + o, a])) : s); return [r, i]; -}) : t, qre = (t) => { +}) : t, Xre = (t) => { if (t < 1) return { get: () => { @@ -35901,13 +35901,13 @@ const kre = Lre, ay = "-", $re = (t) => { r.has(s) ? r.set(s, o) : i(s, o); } }; -}, x9 = "!", zre = (t) => { +}, S9 = "!", Zre = (t) => { const { separator: e, experimentalParseClassName: r } = t, n = e.length === 1, i = e[0], s = e.length, o = (a) => { const u = []; - let l = 0, d = 0, g; + let l = 0, d = 0, p; for (let L = 0; L < a.length; L++) { let $ = a[L]; if (l === 0) { @@ -35916,17 +35916,17 @@ const kre = Lre, ay = "-", $re = (t) => { continue; } if ($ === "/") { - g = L; + p = L; continue; } } $ === "[" ? l++ : $ === "]" && l--; } - const w = u.length === 0 ? a : a.substring(d), A = w.startsWith(x9), M = A ? w.substring(1) : w, N = g && g > d ? g - d : void 0; + const w = u.length === 0 ? a : a.substring(d), A = w.startsWith(S9), P = A ? w.substring(1) : w, N = p && p > d ? p - d : void 0; return { modifiers: u, hasImportantModifier: A, - baseClassName: M, + baseClassName: P, maybePostfixModifierPosition: N }; }; @@ -35934,7 +35934,7 @@ const kre = Lre, ay = "-", $re = (t) => { className: a, parseClassName: o }) : o; -}, Hre = (t) => { +}, Qre = (t) => { if (t.length <= 1) return t; const e = []; @@ -35942,27 +35942,27 @@ const kre = Lre, ay = "-", $re = (t) => { return t.forEach((n) => { n[0] === "[" ? (e.push(...r.sort(), n), r = []) : r.push(n); }), e.push(...r.sort()), e; -}, Wre = (t) => ({ - cache: qre(t.cacheSize), - parseClassName: zre(t), - ...$re(t) -}), Kre = /\s+/, Vre = (t, e) => { +}, ene = (t) => ({ + cache: Xre(t.cacheSize), + parseClassName: Zre(t), + ...Kre(t) +}), tne = /\s+/, rne = (t, e) => { const { parseClassName: r, getClassGroupId: n, getConflictingClassGroupIds: i - } = e, s = [], o = t.trim().split(Kre); + } = e, s = [], o = t.trim().split(tne); let a = ""; for (let u = o.length - 1; u >= 0; u -= 1) { const l = o[u], { modifiers: d, - hasImportantModifier: g, + hasImportantModifier: p, baseClassName: w, maybePostfixModifierPosition: A } = r(l); - let M = !!A, N = n(M ? w.substring(0, A) : w); + let P = !!A, N = n(P ? w.substring(0, A) : w); if (!N) { - if (!M) { + if (!P) { a = l + (a.length > 0 ? " " + a : a); continue; } @@ -35970,92 +35970,92 @@ const kre = Lre, ay = "-", $re = (t) => { a = l + (a.length > 0 ? " " + a : a); continue; } - M = !1; + P = !1; } - const L = Hre(d).join(":"), $ = g ? L + x9 : L, F = $ + N; - if (s.includes(F)) + const L = Qre(d).join(":"), $ = p ? L + S9 : L, B = $ + N; + if (s.includes(B)) continue; - s.push(F); - const K = i(N, M); - for (let H = 0; H < K.length; ++H) { - const V = K[H]; + s.push(B); + const H = i(N, P); + for (let W = 0; W < H.length; ++W) { + const V = H[W]; s.push($ + V); } a = l + (a.length > 0 ? " " + a : a); } return a; }; -function Gre() { +function nne() { let t = 0, e, r, n = ""; for (; t < arguments.length; ) - (e = arguments[t++]) && (r = _9(e)) && (n && (n += " "), n += r); + (e = arguments[t++]) && (r = A9(e)) && (n && (n += " "), n += r); return n; } -const _9 = (t) => { +const A9 = (t) => { if (typeof t == "string") return t; let e, r = ""; for (let n = 0; n < t.length; n++) - t[n] && (e = _9(t[n])) && (r && (r += " "), r += e); + t[n] && (e = A9(t[n])) && (r && (r += " "), r += e); return r; }; -function Yre(t, ...e) { +function ine(t, ...e) { let r, n, i, s = o; function o(u) { - const l = e.reduce((d, g) => g(d), t()); - return r = Wre(l), n = r.cache.get, i = r.cache.set, s = a, a(u); + const l = e.reduce((d, p) => p(d), t()); + return r = ene(l), n = r.cache.get, i = r.cache.set, s = a, a(u); } function a(u) { const l = n(u); if (l) return l; - const d = Vre(u, r); + const d = rne(u, r); return i(u, d), d; } return function() { - return s(Gre.apply(null, arguments)); + return s(nne.apply(null, arguments)); }; } const Gr = (t) => { const e = (r) => r[t] || []; return e.isThemeGetter = !0, e; -}, E9 = /^\[(?:([a-z-]+):)?(.+)\]$/i, Jre = /^\d+\/\d+$/, Xre = /* @__PURE__ */ new Set(["px", "full", "screen"]), Zre = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, Qre = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, ene = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, tne = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, rne = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, vo = (t) => gu(t) || Xre.has(t) || Jre.test(t), ra = (t) => Vu(t, "length", fne), gu = (t) => !!t && !Number.isNaN(Number(t)), Wm = (t) => Vu(t, "number", gu), Of = (t) => !!t && Number.isInteger(Number(t)), nne = (t) => t.endsWith("%") && gu(t.slice(0, -1)), cr = (t) => E9.test(t), na = (t) => Zre.test(t), ine = /* @__PURE__ */ new Set(["length", "size", "percentage"]), sne = (t) => Vu(t, ine, S9), one = (t) => Vu(t, "position", S9), ane = /* @__PURE__ */ new Set(["image", "url"]), cne = (t) => Vu(t, ane, hne), une = (t) => Vu(t, "", lne), Nf = () => !0, Vu = (t, e, r) => { - const n = E9.exec(t); +}, P9 = /^\[(?:([a-z-]+):)?(.+)\]$/i, sne = /^\d+\/\d+$/, one = /* @__PURE__ */ new Set(["px", "full", "screen"]), ane = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, cne = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, une = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, fne = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, lne = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, wo = (t) => mu(t) || one.has(t) || sne.test(t), sa = (t) => Gu(t, "length", yne), mu = (t) => !!t && !Number.isNaN(Number(t)), Hm = (t) => Gu(t, "number", mu), Nf = (t) => !!t && Number.isInteger(Number(t)), hne = (t) => t.endsWith("%") && mu(t.slice(0, -1)), ur = (t) => P9.test(t), oa = (t) => ane.test(t), dne = /* @__PURE__ */ new Set(["length", "size", "percentage"]), pne = (t) => Gu(t, dne, M9), gne = (t) => Gu(t, "position", M9), mne = /* @__PURE__ */ new Set(["image", "url"]), vne = (t) => Gu(t, mne, xne), bne = (t) => Gu(t, "", wne), Lf = () => !0, Gu = (t, e, r) => { + const n = P9.exec(t); return n ? n[1] ? typeof e == "string" ? n[1] === e : e.has(n[1]) : r(n[2]) : !1; -}, fne = (t) => ( +}, yne = (t) => ( // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths. // For example, `hsl(0 0% 0%)` would be classified as a length without this check. // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough. - Qre.test(t) && !ene.test(t) -), S9 = () => !1, lne = (t) => tne.test(t), hne = (t) => rne.test(t), dne = () => { - const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), u = Gr("contrast"), l = Gr("grayscale"), d = Gr("hueRotate"), g = Gr("invert"), w = Gr("gap"), A = Gr("gradientColorStops"), M = Gr("gradientColorStopPositions"), N = Gr("inset"), L = Gr("margin"), $ = Gr("opacity"), F = Gr("padding"), K = Gr("saturate"), H = Gr("scale"), V = Gr("sepia"), te = Gr("skew"), R = Gr("space"), W = Gr("translate"), pe = () => ["auto", "contain", "none"], Ee = () => ["auto", "hidden", "clip", "visible", "scroll"], Y = () => ["auto", cr, e], S = () => [cr, e], m = () => ["", vo, ra], f = () => ["auto", gu, cr], p = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], b = () => ["solid", "dashed", "dotted", "double", "none"], x = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], _ = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], E = () => ["", "0", cr], v = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], P = () => [gu, cr]; + cne.test(t) && !une.test(t) +), M9 = () => !1, wne = (t) => fne.test(t), xne = (t) => lne.test(t), _ne = () => { + const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), u = Gr("contrast"), l = Gr("grayscale"), d = Gr("hueRotate"), p = Gr("invert"), w = Gr("gap"), A = Gr("gradientColorStops"), P = Gr("gradientColorStopPositions"), N = Gr("inset"), L = Gr("margin"), $ = Gr("opacity"), B = Gr("padding"), H = Gr("saturate"), W = Gr("scale"), V = Gr("sepia"), te = Gr("skew"), R = Gr("space"), K = Gr("translate"), ge = () => ["auto", "contain", "none"], Ee = () => ["auto", "hidden", "clip", "visible", "scroll"], Y = () => ["auto", ur, e], S = () => [ur, e], m = () => ["", wo, sa], f = () => ["auto", mu, ur], g = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], b = () => ["solid", "dashed", "dotted", "double", "none"], x = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], _ = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], E = () => ["", "0", ur], v = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], M = () => [mu, ur]; return { cacheSize: 500, separator: ":", theme: { - colors: [Nf], - spacing: [vo, ra], - blur: ["none", "", na, cr], - brightness: P(), + colors: [Lf], + spacing: [wo, sa], + blur: ["none", "", oa, ur], + brightness: M(), borderColor: [t], - borderRadius: ["none", "", "full", na, cr], + borderRadius: ["none", "", "full", oa, ur], borderSpacing: S(), borderWidth: m(), - contrast: P(), + contrast: M(), grayscale: E(), - hueRotate: P(), + hueRotate: M(), invert: E(), gap: S(), gradientColorStops: [t], - gradientColorStopPositions: [nne, ra], + gradientColorStopPositions: [hne, sa], inset: Y(), margin: Y(), - opacity: P(), + opacity: M(), padding: S(), - saturate: P(), - scale: P(), + saturate: M(), + scale: M(), sepia: E(), - skew: P(), + skew: M(), space: S(), translate: S() }, @@ -36066,7 +36066,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/aspect-ratio */ aspect: [{ - aspect: ["auto", "square", "video", cr] + aspect: ["auto", "square", "video", ur] }], /** * Container @@ -36078,7 +36078,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/columns */ columns: [{ - columns: [na] + columns: [oa] }], /** * Break After @@ -36151,7 +36151,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/object-position */ "object-position": [{ - object: [...p(), cr] + object: [...g(), ur] }], /** * Overflow @@ -36179,21 +36179,21 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/overscroll-behavior */ overscroll: [{ - overscroll: pe() + overscroll: ge() }], /** * Overscroll Behavior X * @see https://tailwindcss.com/docs/overscroll-behavior */ "overscroll-x": [{ - "overscroll-x": pe() + "overscroll-x": ge() }], /** * Overscroll Behavior Y * @see https://tailwindcss.com/docs/overscroll-behavior */ "overscroll-y": [{ - "overscroll-y": pe() + "overscroll-y": ge() }], /** * Position @@ -36273,7 +36273,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/z-index */ z: [{ - z: ["auto", Of, cr] + z: ["auto", Nf, ur] }], // Flexbox and Grid /** @@ -36302,7 +36302,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/flex */ flex: [{ - flex: ["1", "auto", "initial", "none", cr] + flex: ["1", "auto", "initial", "none", ur] }], /** * Flex Grow @@ -36323,14 +36323,14 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/order */ order: [{ - order: ["first", "last", "none", Of, cr] + order: ["first", "last", "none", Nf, ur] }], /** * Grid Template Columns * @see https://tailwindcss.com/docs/grid-template-columns */ "grid-cols": [{ - "grid-cols": [Nf] + "grid-cols": [Lf] }], /** * Grid Column Start / End @@ -36338,8 +36338,8 @@ const Gr = (t) => { */ "col-start-end": [{ col: ["auto", { - span: ["full", Of, cr] - }, cr] + span: ["full", Nf, ur] + }, ur] }], /** * Grid Column Start @@ -36360,7 +36360,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/grid-template-rows */ "grid-rows": [{ - "grid-rows": [Nf] + "grid-rows": [Lf] }], /** * Grid Row Start / End @@ -36368,8 +36368,8 @@ const Gr = (t) => { */ "row-start-end": [{ row: ["auto", { - span: [Of, cr] - }, cr] + span: [Nf, ur] + }, ur] }], /** * Grid Row Start @@ -36397,14 +36397,14 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/grid-auto-columns */ "auto-cols": [{ - "auto-cols": ["auto", "min", "max", "fr", cr] + "auto-cols": ["auto", "min", "max", "fr", ur] }], /** * Grid Auto Rows * @see https://tailwindcss.com/docs/grid-auto-rows */ "auto-rows": [{ - "auto-rows": ["auto", "min", "max", "fr", cr] + "auto-rows": ["auto", "min", "max", "fr", ur] }], /** * Gap @@ -36496,63 +36496,63 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/padding */ p: [{ - p: [F] + p: [B] }], /** * Padding X * @see https://tailwindcss.com/docs/padding */ px: [{ - px: [F] + px: [B] }], /** * Padding Y * @see https://tailwindcss.com/docs/padding */ py: [{ - py: [F] + py: [B] }], /** * Padding Start * @see https://tailwindcss.com/docs/padding */ ps: [{ - ps: [F] + ps: [B] }], /** * Padding End * @see https://tailwindcss.com/docs/padding */ pe: [{ - pe: [F] + pe: [B] }], /** * Padding Top * @see https://tailwindcss.com/docs/padding */ pt: [{ - pt: [F] + pt: [B] }], /** * Padding Right * @see https://tailwindcss.com/docs/padding */ pr: [{ - pr: [F] + pr: [B] }], /** * Padding Bottom * @see https://tailwindcss.com/docs/padding */ pb: [{ - pb: [F] + pb: [B] }], /** * Padding Left * @see https://tailwindcss.com/docs/padding */ pl: [{ - pl: [F] + pl: [B] }], /** * Margin @@ -36647,51 +36647,51 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/width */ w: [{ - w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw", cr, e] + w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw", ur, e] }], /** * Min-Width * @see https://tailwindcss.com/docs/min-width */ "min-w": [{ - "min-w": [cr, e, "min", "max", "fit"] + "min-w": [ur, e, "min", "max", "fit"] }], /** * Max-Width * @see https://tailwindcss.com/docs/max-width */ "max-w": [{ - "max-w": [cr, e, "none", "full", "min", "max", "fit", "prose", { - screen: [na] - }, na] + "max-w": [ur, e, "none", "full", "min", "max", "fit", "prose", { + screen: [oa] + }, oa] }], /** * Height * @see https://tailwindcss.com/docs/height */ h: [{ - h: [cr, e, "auto", "min", "max", "fit", "svh", "lvh", "dvh"] + h: [ur, e, "auto", "min", "max", "fit", "svh", "lvh", "dvh"] }], /** * Min-Height * @see https://tailwindcss.com/docs/min-height */ "min-h": [{ - "min-h": [cr, e, "min", "max", "fit", "svh", "lvh", "dvh"] + "min-h": [ur, e, "min", "max", "fit", "svh", "lvh", "dvh"] }], /** * Max-Height * @see https://tailwindcss.com/docs/max-height */ "max-h": [{ - "max-h": [cr, e, "min", "max", "fit", "svh", "lvh", "dvh"] + "max-h": [ur, e, "min", "max", "fit", "svh", "lvh", "dvh"] }], /** * Size * @see https://tailwindcss.com/docs/size */ size: [{ - size: [cr, e, "auto", "min", "max", "fit"] + size: [ur, e, "auto", "min", "max", "fit"] }], // Typography /** @@ -36699,7 +36699,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/font-size */ "font-size": [{ - text: ["base", na, ra] + text: ["base", oa, sa] }], /** * Font Smoothing @@ -36716,14 +36716,14 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/font-weight */ "font-weight": [{ - font: ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black", Wm] + font: ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black", Hm] }], /** * Font Family * @see https://tailwindcss.com/docs/font-family */ "font-family": [{ - font: [Nf] + font: [Lf] }], /** * Font Variant Numeric @@ -36760,35 +36760,35 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/letter-spacing */ tracking: [{ - tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", cr] + tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", ur] }], /** * Line Clamp * @see https://tailwindcss.com/docs/line-clamp */ "line-clamp": [{ - "line-clamp": ["none", gu, Wm] + "line-clamp": ["none", mu, Hm] }], /** * Line Height * @see https://tailwindcss.com/docs/line-height */ leading: [{ - leading: ["none", "tight", "snug", "normal", "relaxed", "loose", vo, cr] + leading: ["none", "tight", "snug", "normal", "relaxed", "loose", wo, ur] }], /** * List Style Image * @see https://tailwindcss.com/docs/list-style-image */ "list-image": [{ - "list-image": ["none", cr] + "list-image": ["none", ur] }], /** * List Style Type * @see https://tailwindcss.com/docs/list-style-type */ "list-style-type": [{ - list: ["none", "disc", "decimal", cr] + list: ["none", "disc", "decimal", ur] }], /** * List Style Position @@ -36850,14 +36850,14 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/text-decoration-thickness */ "text-decoration-thickness": [{ - decoration: ["auto", "from-font", vo, ra] + decoration: ["auto", "from-font", wo, sa] }], /** * Text Underline Offset * @see https://tailwindcss.com/docs/text-underline-offset */ "underline-offset": [{ - "underline-offset": ["auto", vo, cr] + "underline-offset": ["auto", wo, ur] }], /** * Text Decoration Color @@ -36895,7 +36895,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/vertical-align */ "vertical-align": [{ - align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", cr] + align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", ur] }], /** * Whitespace @@ -36923,7 +36923,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/content */ content: [{ - content: ["none", cr] + content: ["none", ur] }], // Backgrounds /** @@ -36960,7 +36960,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/background-position */ "bg-position": [{ - bg: [...p(), one] + bg: [...g(), gne] }], /** * Background Repeat @@ -36976,7 +36976,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/background-size */ "bg-size": [{ - bg: ["auto", "cover", "contain", sne] + bg: ["auto", "cover", "contain", pne] }], /** * Background Image @@ -36985,7 +36985,7 @@ const Gr = (t) => { "bg-image": [{ bg: ["none", { "gradient-to": ["t", "tr", "r", "br", "b", "bl", "l", "tl"] - }, cne] + }, vne] }], /** * Background Color @@ -36999,21 +36999,21 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/gradient-color-stops */ "gradient-from-pos": [{ - from: [M] + from: [P] }], /** * Gradient Color Stops Via Position * @see https://tailwindcss.com/docs/gradient-color-stops */ "gradient-via-pos": [{ - via: [M] + via: [P] }], /** * Gradient Color Stops To Position * @see https://tailwindcss.com/docs/gradient-color-stops */ "gradient-to-pos": [{ - to: [M] + to: [P] }], /** * Gradient Color Stops From @@ -37339,14 +37339,14 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/outline-offset */ "outline-offset": [{ - "outline-offset": [vo, cr] + "outline-offset": [wo, ur] }], /** * Outline Width * @see https://tailwindcss.com/docs/outline-width */ "outline-w": [{ - outline: [vo, ra] + outline: [wo, sa] }], /** * Outline Color @@ -37386,7 +37386,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/ring-offset-width */ "ring-offset-w": [{ - "ring-offset": [vo, ra] + "ring-offset": [wo, sa] }], /** * Ring Offset Color @@ -37401,14 +37401,14 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/box-shadow */ shadow: [{ - shadow: ["", "inner", "none", na, une] + shadow: ["", "inner", "none", oa, bne] }], /** * Box Shadow Color * @see https://tailwindcss.com/docs/box-shadow-color */ "shadow-color": [{ - shadow: [Nf] + shadow: [Lf] }], /** * Opacity @@ -37466,7 +37466,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/drop-shadow */ "drop-shadow": [{ - "drop-shadow": ["", "none", na, cr] + "drop-shadow": ["", "none", oa, ur] }], /** * Grayscale @@ -37487,14 +37487,14 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/invert */ invert: [{ - invert: [g] + invert: [p] }], /** * Saturate * @see https://tailwindcss.com/docs/saturate */ saturate: [{ - saturate: [K] + saturate: [H] }], /** * Sepia @@ -37551,7 +37551,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/backdrop-invert */ "backdrop-invert": [{ - "backdrop-invert": [g] + "backdrop-invert": [p] }], /** * Backdrop Opacity @@ -37565,7 +37565,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/backdrop-saturate */ "backdrop-saturate": [{ - "backdrop-saturate": [K] + "backdrop-saturate": [H] }], /** * Backdrop Sepia @@ -37623,35 +37623,35 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/transition-property */ transition: [{ - transition: ["none", "all", "", "colors", "opacity", "shadow", "transform", cr] + transition: ["none", "all", "", "colors", "opacity", "shadow", "transform", ur] }], /** * Transition Duration * @see https://tailwindcss.com/docs/transition-duration */ duration: [{ - duration: P() + duration: M() }], /** * Transition Timing Function * @see https://tailwindcss.com/docs/transition-timing-function */ ease: [{ - ease: ["linear", "in", "out", "in-out", cr] + ease: ["linear", "in", "out", "in-out", ur] }], /** * Transition Delay * @see https://tailwindcss.com/docs/transition-delay */ delay: [{ - delay: P() + delay: M() }], /** * Animation * @see https://tailwindcss.com/docs/animation */ animate: [{ - animate: ["none", "spin", "ping", "pulse", "bounce", cr] + animate: ["none", "spin", "ping", "pulse", "bounce", ur] }], // Transforms /** @@ -37666,42 +37666,42 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/scale */ scale: [{ - scale: [H] + scale: [W] }], /** * Scale X * @see https://tailwindcss.com/docs/scale */ "scale-x": [{ - "scale-x": [H] + "scale-x": [W] }], /** * Scale Y * @see https://tailwindcss.com/docs/scale */ "scale-y": [{ - "scale-y": [H] + "scale-y": [W] }], /** * Rotate * @see https://tailwindcss.com/docs/rotate */ rotate: [{ - rotate: [Of, cr] + rotate: [Nf, ur] }], /** * Translate X * @see https://tailwindcss.com/docs/translate */ "translate-x": [{ - "translate-x": [W] + "translate-x": [K] }], /** * Translate Y * @see https://tailwindcss.com/docs/translate */ "translate-y": [{ - "translate-y": [W] + "translate-y": [K] }], /** * Skew X @@ -37722,7 +37722,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/transform-origin */ "transform-origin": [{ - origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left", cr] + origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left", ur] }], // Interactivity /** @@ -37744,7 +37744,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/cursor */ cursor: [{ - cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out", cr] + cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out", ur] }], /** * Caret Color @@ -37966,7 +37966,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/will-change */ "will-change": [{ - "will-change": ["auto", "scroll", "contents", "transform", cr] + "will-change": ["auto", "scroll", "contents", "transform", ur] }], // SVG /** @@ -37981,7 +37981,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/stroke-width */ "stroke-w": [{ - stroke: [vo, ra, Wm] + stroke: [wo, sa, Hm] }], /** * Stroke @@ -38056,35 +38056,35 @@ const Gr = (t) => { "font-size": ["leading"] } }; -}, pne = /* @__PURE__ */ Yre(dne); -function Do(...t) { - return pne(kre(t)); +}, Ene = /* @__PURE__ */ ine(_ne); +function Js(...t) { + return Ene(Hre(t)); } -function A9(t) { +function I9(t) { const { className: e } = t; - return /* @__PURE__ */ me.jsxs("div", { className: Do("xc-flex xc-items-center xc-gap-2"), children: [ - /* @__PURE__ */ me.jsx("hr", { className: Do("xc-flex-1 xc-border-gray-200", e) }), - /* @__PURE__ */ me.jsx("div", { className: "xc-shrink-0", children: t.children }), - /* @__PURE__ */ me.jsx("hr", { className: Do("xc-flex-1 xc-border-gray-200", e) }) + return /* @__PURE__ */ fe.jsxs("div", { className: Js("xc-flex xc-items-center xc-gap-2"), children: [ + /* @__PURE__ */ fe.jsx("hr", { className: Js("xc-flex-1 xc-border-gray-200", e) }), + /* @__PURE__ */ fe.jsx("div", { className: "xc-shrink-0", children: t.children }), + /* @__PURE__ */ fe.jsx("hr", { className: Js("xc-flex-1 xc-border-gray-200", e) }) ] }); } -const gne = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton"; -function mne(t) { +const Sne = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton"; +function Ane(t) { const { onClick: e } = t; function r() { e && e(); } - return /* @__PURE__ */ me.jsx(A9, { className: "xc-opacity-20", children: /* @__PURE__ */ me.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-cursor-pointer", onClick: r, children: [ - /* @__PURE__ */ me.jsx("span", { className: "xc-text-sm", children: "View more wallets" }), - /* @__PURE__ */ me.jsx(zS, { size: 16 }) + return /* @__PURE__ */ fe.jsx(I9, { className: "xc-opacity-20", children: /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-cursor-pointer", onClick: r, children: [ + /* @__PURE__ */ fe.jsx("span", { className: "xc-text-sm", children: "View more wallets" }), + /* @__PURE__ */ fe.jsx(HS, { size: 16 }) ] }) }); } -function vne(t) { - const [e, r] = fr(""), { featuredWallets: n, initialized: i } = gp(), { onEmailConfirm: s, onSelectWallet: o, onSelectMoreWallets: a, onSelectTonConnect: u, config: l } = t, d = Oi(() => { +function C9(t) { + const [e, r] = Gt(""), { featuredWallets: n, initialized: i } = mp(), { onEmailConfirm: s, onSelectWallet: o, onSelectMoreWallets: a, onSelectTonConnect: u, config: l } = t, d = Ni(() => { const N = /[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu, L = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; return !N.test(e) && L.test(e); }, [e]); - function g(N) { + function p(N) { o(N); } function w(N) { @@ -38093,109 +38093,109 @@ function vne(t) { async function A() { s(e); } - function M(N) { + function P(N) { N.key === "Enter" && d && A(); } - return /* @__PURE__ */ me.jsx(Ac, { children: i && /* @__PURE__ */ me.jsxs(me.Fragment, { children: [ - t.header || /* @__PURE__ */ me.jsx("div", { className: "xc-mb-6 xc-text-xl xc-font-bold", children: "Log in or sign up" }), - l.showEmailSignIn && /* @__PURE__ */ me.jsxs("div", { className: "xc-mb-4", children: [ - /* @__PURE__ */ me.jsx("input", { className: "xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3", placeholder: "Enter your email", type: "email", onChange: w, onKeyDown: M }), - /* @__PURE__ */ me.jsx("button", { disabled: !d, className: "xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all", onClick: A, children: "Continue" }) + return /* @__PURE__ */ fe.jsx(so, { children: i && /* @__PURE__ */ fe.jsxs(fe.Fragment, { children: [ + t.header || /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-6 xc-text-xl xc-font-bold", children: "Log in or sign up" }), + l.showEmailSignIn && /* @__PURE__ */ fe.jsxs("div", { className: "xc-mb-4", children: [ + /* @__PURE__ */ fe.jsx("input", { className: "xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3", placeholder: "Enter your email", type: "email", onChange: w, onKeyDown: P }), + /* @__PURE__ */ fe.jsx("button", { disabled: !d, className: "xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all", onClick: A, children: "Continue" }) ] }), - l.showEmailSignIn && (l.showFeaturedWallets || l.showTonConnect) && /* @__PURE__ */ me.jsx("div", { className: "xc-mb-4", children: /* @__PURE__ */ me.jsxs(A9, { className: "xc-opacity-20", children: [ + l.showEmailSignIn && (l.showFeaturedWallets || l.showTonConnect) && /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-4", children: /* @__PURE__ */ fe.jsxs(I9, { className: "xc-opacity-20", children: [ " ", - /* @__PURE__ */ me.jsx("span", { className: "xc-text-sm xc-opacity-20", children: "OR" }) + /* @__PURE__ */ fe.jsx("span", { className: "xc-text-sm xc-opacity-20", children: "OR" }) ] }) }), - /* @__PURE__ */ me.jsxs("div", { children: [ - /* @__PURE__ */ me.jsxs("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: [ - l.showFeaturedWallets && n && n.map((N) => /* @__PURE__ */ me.jsx( - b9, + /* @__PURE__ */ fe.jsxs("div", { children: [ + /* @__PURE__ */ fe.jsxs("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: [ + l.showFeaturedWallets && n && n.map((N) => /* @__PURE__ */ fe.jsx( + x9, { wallet: N, - onClick: g + onClick: p }, `feature-${N.key}` )), - l.showTonConnect && /* @__PURE__ */ me.jsx( + l.showTonConnect && /* @__PURE__ */ fe.jsx( oy, { - icon: /* @__PURE__ */ me.jsx("img", { className: "xc-h-5 xc-w-5", src: gne }), + icon: /* @__PURE__ */ fe.jsx("img", { className: "xc-h-5 xc-w-5", src: Sne }), title: "TON Connect", onClick: u } ) ] }), - l.showMoreWallets && /* @__PURE__ */ me.jsx(mne, { onClick: a }) + l.showMoreWallets && /* @__PURE__ */ fe.jsx(Ane, { onClick: a }) ] }) ] }) }); } -function uh(t) { +function Pc(t) { const { title: e } = t; - return /* @__PURE__ */ me.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2", children: [ - /* @__PURE__ */ me.jsx(eZ, { onClick: t.onBack, size: 20, className: "xc-cursor-pointer" }), - /* @__PURE__ */ me.jsx("span", { children: e }) + return /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2", children: [ + /* @__PURE__ */ fe.jsx(fZ, { onClick: t.onBack, size: 20, className: "xc-cursor-pointer" }), + /* @__PURE__ */ fe.jsx("span", { children: e }) ] }); } -var bne = Object.defineProperty, yne = Object.defineProperties, wne = Object.getOwnPropertyDescriptors, E0 = Object.getOwnPropertySymbols, P9 = Object.prototype.hasOwnProperty, M9 = Object.prototype.propertyIsEnumerable, u5 = (t, e, r) => e in t ? bne(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, xne = (t, e) => { - for (var r in e || (e = {})) P9.call(e, r) && u5(t, r, e[r]); - if (E0) for (var r of E0(e)) M9.call(e, r) && u5(t, r, e[r]); +var Pne = Object.defineProperty, Mne = Object.defineProperties, Ine = Object.getOwnPropertyDescriptors, S0 = Object.getOwnPropertySymbols, T9 = Object.prototype.hasOwnProperty, R9 = Object.prototype.propertyIsEnumerable, l5 = (t, e, r) => e in t ? Pne(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Cne = (t, e) => { + for (var r in e || (e = {})) T9.call(e, r) && l5(t, r, e[r]); + if (S0) for (var r of S0(e)) R9.call(e, r) && l5(t, r, e[r]); return t; -}, _ne = (t, e) => yne(t, wne(e)), Ene = (t, e) => { +}, Tne = (t, e) => Mne(t, Ine(e)), Rne = (t, e) => { var r = {}; - for (var n in t) P9.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); - if (t != null && E0) for (var n of E0(t)) e.indexOf(n) < 0 && M9.call(t, n) && (r[n] = t[n]); + for (var n in t) T9.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); + if (t != null && S0) for (var n of S0(t)) e.indexOf(n) < 0 && R9.call(t, n) && (r[n] = t[n]); return r; }; -function Sne(t) { +function Dne(t) { let e = setTimeout(t, 0), r = setTimeout(t, 10), n = setTimeout(t, 50); return [e, r, n]; } -function Ane(t) { - let e = Gt.useRef(); - return Gt.useEffect(() => { +function One(t) { + let e = Yt.useRef(); + return Yt.useEffect(() => { e.current = t; }), e.current; } -var Pne = 18, I9 = 40, Mne = `${I9}px`, Ine = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(","); -function Cne({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isFocused: n }) { - let [i, s] = Gt.useState(!1), [o, a] = Gt.useState(!1), [u, l] = Gt.useState(!1), d = Gt.useMemo(() => r === "none" ? !1 : (r === "increase-width" || r === "experimental-no-flickering") && i && o, [i, o, r]), g = Gt.useCallback(() => { +var Nne = 18, D9 = 40, Lne = `${D9}px`, kne = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(","); +function $ne({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isFocused: n }) { + let [i, s] = Yt.useState(!1), [o, a] = Yt.useState(!1), [u, l] = Yt.useState(!1), d = Yt.useMemo(() => r === "none" ? !1 : (r === "increase-width" || r === "experimental-no-flickering") && i && o, [i, o, r]), p = Yt.useCallback(() => { let w = t.current, A = e.current; if (!w || !A || u || r === "none") return; - let M = w, N = M.getBoundingClientRect().left + M.offsetWidth, L = M.getBoundingClientRect().top + M.offsetHeight / 2, $ = N - Pne, F = L; - document.querySelectorAll(Ine).length === 0 && document.elementFromPoint($, F) === w || (s(!0), l(!0)); + let P = w, N = P.getBoundingClientRect().left + P.offsetWidth, L = P.getBoundingClientRect().top + P.offsetHeight / 2, $ = N - Nne, B = L; + document.querySelectorAll(kne).length === 0 && document.elementFromPoint($, B) === w || (s(!0), l(!0)); }, [t, e, u, r]); - return Gt.useEffect(() => { + return Yt.useEffect(() => { let w = t.current; if (!w || r === "none") return; function A() { let N = window.innerWidth - w.getBoundingClientRect().right; - a(N >= I9); + a(N >= D9); } A(); - let M = setInterval(A, 1e3); + let P = setInterval(A, 1e3); return () => { - clearInterval(M); + clearInterval(P); }; - }, [t, r]), Gt.useEffect(() => { + }, [t, r]), Yt.useEffect(() => { let w = n || document.activeElement === e.current; if (r === "none" || !w) return; - let A = setTimeout(g, 0), M = setTimeout(g, 2e3), N = setTimeout(g, 5e3), L = setTimeout(() => { + let A = setTimeout(p, 0), P = setTimeout(p, 2e3), N = setTimeout(p, 5e3), L = setTimeout(() => { l(!0); }, 6e3); return () => { - clearTimeout(A), clearTimeout(M), clearTimeout(N), clearTimeout(L); + clearTimeout(A), clearTimeout(P), clearTimeout(N), clearTimeout(L); }; - }, [e, n, r, g]), { hasPWMBadge: i, willPushPWMBadge: d, PWM_BADGE_SPACE_WIDTH: Mne }; -} -var C9 = Gt.createContext({}), T9 = Gt.forwardRef((t, e) => { - var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: u, inputMode: l = "numeric", onComplete: d, pushPasswordManagerStrategy: g = "increase-width", pasteTransformer: w, containerClassName: A, noScriptCSSFallback: M = Tne, render: N, children: L } = r, $ = Ene(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), F, K, H, V, te; - let [R, W] = Gt.useState(typeof $.defaultValue == "string" ? $.defaultValue : ""), pe = n ?? R, Ee = Ane(pe), Y = Gt.useCallback((ie) => { - i == null || i(ie), W(ie); - }, [i]), S = Gt.useMemo(() => a ? typeof a == "string" ? new RegExp(a) : a : null, [a]), m = Gt.useRef(null), f = Gt.useRef(null), p = Gt.useRef({ value: pe, onChange: Y, isIOS: typeof window < "u" && ((K = (F = window == null ? void 0 : window.CSS) == null ? void 0 : F.supports) == null ? void 0 : K.call(F, "-webkit-touch-callout", "none")) }), b = Gt.useRef({ prev: [(H = m.current) == null ? void 0 : H.selectionStart, (V = m.current) == null ? void 0 : V.selectionEnd, (te = m.current) == null ? void 0 : te.selectionDirection] }); - Gt.useImperativeHandle(e, () => m.current, []), Gt.useEffect(() => { + }, [e, n, r, p]), { hasPWMBadge: i, willPushPWMBadge: d, PWM_BADGE_SPACE_WIDTH: Lne }; +} +var O9 = Yt.createContext({}), N9 = Yt.forwardRef((t, e) => { + var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: u, inputMode: l = "numeric", onComplete: d, pushPasswordManagerStrategy: p = "increase-width", pasteTransformer: w, containerClassName: A, noScriptCSSFallback: P = Bne, render: N, children: L } = r, $ = Rne(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), B, H, W, V, te; + let [R, K] = Yt.useState(typeof $.defaultValue == "string" ? $.defaultValue : ""), ge = n ?? R, Ee = One(ge), Y = Yt.useCallback((ie) => { + i == null || i(ie), K(ie); + }, [i]), S = Yt.useMemo(() => a ? typeof a == "string" ? new RegExp(a) : a : null, [a]), m = Yt.useRef(null), f = Yt.useRef(null), g = Yt.useRef({ value: ge, onChange: Y, isIOS: typeof window < "u" && ((H = (B = window == null ? void 0 : window.CSS) == null ? void 0 : B.supports) == null ? void 0 : H.call(B, "-webkit-touch-callout", "none")) }), b = Yt.useRef({ prev: [(W = m.current) == null ? void 0 : W.selectionStart, (V = m.current) == null ? void 0 : V.selectionEnd, (te = m.current) == null ? void 0 : te.selectionDirection] }); + Yt.useImperativeHandle(e, () => m.current, []), Yt.useEffect(() => { let ie = m.current, ue = f.current; if (!ie || !ue) return; - p.current.value !== ie.value && p.current.onChange(ie.value), b.current.prev = [ie.selectionStart, ie.selectionEnd, ie.selectionDirection]; + g.current.value !== ie.value && g.current.onChange(ie.value), b.current.prev = [ie.selectionStart, ie.selectionEnd, ie.selectionDirection]; function ve() { if (document.activeElement !== ie) { I(null), ce(null); @@ -38227,7 +38227,7 @@ var C9 = Gt.createContext({}), T9 = Gt.forwardRef((t, e) => { let Ce = document.createElement("style"); if (Ce.id = "input-otp-style", document.head.appendChild(Ce), Ce.sheet) { let $e = "background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;"; - Lf(Ce.sheet, "[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"), Lf(Ce.sheet, `[data-input-otp]:autofill { ${$e} }`), Lf(Ce.sheet, `[data-input-otp]:-webkit-autofill { ${$e} }`), Lf(Ce.sheet, "@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"), Lf(Ce.sheet, "[data-input-otp] + * { pointer-events: all !important; }"); + kf(Ce.sheet, "[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"), kf(Ce.sheet, `[data-input-otp]:autofill { ${$e} }`), kf(Ce.sheet, `[data-input-otp]:-webkit-autofill { ${$e} }`), kf(Ce.sheet, "@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"), kf(Ce.sheet, "[data-input-otp] + * { pointer-events: all !important; }"); } } let Pe = () => { @@ -38239,43 +38239,43 @@ var C9 = Gt.createContext({}), T9 = Gt.forwardRef((t, e) => { document.removeEventListener("selectionchange", ve, { capture: !0 }), De.disconnect(); }; }, []); - let [x, _] = Gt.useState(!1), [E, v] = Gt.useState(!1), [P, I] = Gt.useState(null), [B, ce] = Gt.useState(null); - Gt.useEffect(() => { - Sne(() => { + let [x, _] = Yt.useState(!1), [E, v] = Yt.useState(!1), [M, I] = Yt.useState(null), [F, ce] = Yt.useState(null); + Yt.useEffect(() => { + Dne(() => { var ie, ue, ve, Pe; (ie = m.current) == null || ie.dispatchEvent(new Event("input")); let De = (ue = m.current) == null ? void 0 : ue.selectionStart, Ce = (ve = m.current) == null ? void 0 : ve.selectionEnd, $e = (Pe = m.current) == null ? void 0 : Pe.selectionDirection; De !== null && Ce !== null && (I(De), ce(Ce), b.current.prev = [De, Ce, $e]); }); - }, [pe, E]), Gt.useEffect(() => { - Ee !== void 0 && pe !== Ee && Ee.length < s && pe.length === s && (d == null || d(pe)); - }, [s, d, Ee, pe]); - let D = Cne({ containerRef: f, inputRef: m, pushPasswordManagerStrategy: g, isFocused: E }), oe = Gt.useCallback((ie) => { + }, [ge, E]), Yt.useEffect(() => { + Ee !== void 0 && ge !== Ee && Ee.length < s && ge.length === s && (d == null || d(ge)); + }, [s, d, Ee, ge]); + let D = $ne({ containerRef: f, inputRef: m, pushPasswordManagerStrategy: p, isFocused: E }), oe = Yt.useCallback((ie) => { let ue = ie.currentTarget.value.slice(0, s); if (ue.length > 0 && S && !S.test(ue)) { ie.preventDefault(); return; } typeof Ee == "string" && ue.length < Ee.length && document.dispatchEvent(new Event("selectionchange")), Y(ue); - }, [s, Y, Ee, S]), Z = Gt.useCallback(() => { + }, [s, Y, Ee, S]), Z = Yt.useCallback(() => { var ie; if (m.current) { let ue = Math.min(m.current.value.length, s - 1), ve = m.current.value.length; (ie = m.current) == null || ie.setSelectionRange(ue, ve), I(ue), ce(ve); } v(!0); - }, [s]), J = Gt.useCallback((ie) => { + }, [s]), J = Yt.useCallback((ie) => { var ue, ve; let Pe = m.current; - if (!w && (!p.current.isIOS || !ie.clipboardData || !Pe)) return; + if (!w && (!g.current.isIOS || !ie.clipboardData || !Pe)) return; let De = ie.clipboardData.getData("text/plain"), Ce = w ? w(De) : De; console.log({ _content: De, content: Ce }), ie.preventDefault(); - let $e = (ue = m.current) == null ? void 0 : ue.selectionStart, Me = (ve = m.current) == null ? void 0 : ve.selectionEnd, Ne = ($e !== Me ? pe.slice(0, $e) + Ce + pe.slice(Me) : pe.slice(0, $e) + Ce + pe.slice($e)).slice(0, s); + let $e = (ue = m.current) == null ? void 0 : ue.selectionStart, Me = (ve = m.current) == null ? void 0 : ve.selectionEnd, Ne = ($e !== Me ? ge.slice(0, $e) + Ce + ge.slice(Me) : ge.slice(0, $e) + Ce + ge.slice($e)).slice(0, s); if (Ne.length > 0 && S && !S.test(Ne)) return; Pe.value = Ne, Y(Ne); let Ke = Math.min(Ne.length, s - 1), Le = Ne.length; Pe.setSelectionRange(Ke, Le), I(Ke), ce(Le); - }, [s, Y, S, pe]), Q = Gt.useMemo(() => ({ position: "relative", cursor: $.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [$.disabled]), T = Gt.useMemo(() => ({ position: "absolute", inset: 0, width: D.willPushPWMBadge ? `calc(100% + ${D.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: D.willPushPWMBadge ? `inset(0 ${D.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: o, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [D.PWM_BADGE_SPACE_WIDTH, D.willPushPWMBadge, o]), X = Gt.useMemo(() => Gt.createElement("input", _ne(xne({ autoComplete: $.autoComplete || "one-time-code" }, $), { "data-input-otp": !0, "data-input-otp-placeholder-shown": pe.length === 0 || void 0, "data-input-otp-mss": P, "data-input-otp-mse": B, inputMode: l, pattern: S == null ? void 0 : S.source, "aria-placeholder": u, style: T, maxLength: s, value: pe, ref: m, onPaste: (ie) => { + }, [s, Y, S, ge]), Q = Yt.useMemo(() => ({ position: "relative", cursor: $.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [$.disabled]), T = Yt.useMemo(() => ({ position: "absolute", inset: 0, width: D.willPushPWMBadge ? `calc(100% + ${D.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: D.willPushPWMBadge ? `inset(0 ${D.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: o, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [D.PWM_BADGE_SPACE_WIDTH, D.willPushPWMBadge, o]), X = Yt.useMemo(() => Yt.createElement("input", Tne(Cne({ autoComplete: $.autoComplete || "one-time-code" }, $), { "data-input-otp": !0, "data-input-otp-placeholder-shown": ge.length === 0 || void 0, "data-input-otp-mss": M, "data-input-otp-mse": F, inputMode: l, pattern: S == null ? void 0 : S.source, "aria-placeholder": u, style: T, maxLength: s, value: ge, ref: m, onPaste: (ie) => { var ue; J(ie), (ue = $.onPaste) == null || ue.call($, ie); }, onChange: oe, onMouseOver: (ie) => { @@ -38290,22 +38290,22 @@ var C9 = Gt.createContext({}), T9 = Gt.forwardRef((t, e) => { }, onBlur: (ie) => { var ue; v(!1), (ue = $.onBlur) == null || ue.call($, ie); - } })), [oe, Z, J, l, T, s, B, P, $, S == null ? void 0 : S.source, pe]), re = Gt.useMemo(() => ({ slots: Array.from({ length: s }).map((ie, ue) => { + } })), [oe, Z, J, l, T, s, F, M, $, S == null ? void 0 : S.source, ge]), re = Yt.useMemo(() => ({ slots: Array.from({ length: s }).map((ie, ue) => { var ve; - let Pe = E && P !== null && B !== null && (P === B && ue === P || ue >= P && ue < B), De = pe[ue] !== void 0 ? pe[ue] : null, Ce = pe[0] !== void 0 ? null : (ve = u == null ? void 0 : u[ue]) != null ? ve : null; + let Pe = E && M !== null && F !== null && (M === F && ue === M || ue >= M && ue < F), De = ge[ue] !== void 0 ? ge[ue] : null, Ce = ge[0] !== void 0 ? null : (ve = u == null ? void 0 : u[ue]) != null ? ve : null; return { char: De, placeholderChar: Ce, isActive: Pe, hasFakeCaret: Pe && De === null }; - }), isFocused: E, isHovering: !$.disabled && x }), [E, x, s, B, P, $.disabled, pe]), de = Gt.useMemo(() => N ? N(re) : Gt.createElement(C9.Provider, { value: re }, L), [L, re, N]); - return Gt.createElement(Gt.Fragment, null, M !== null && Gt.createElement("noscript", null, Gt.createElement("style", null, M)), Gt.createElement("div", { ref: f, "data-input-otp-container": !0, style: Q, className: A }, de, Gt.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, X))); + }), isFocused: E, isHovering: !$.disabled && x }), [E, x, s, F, M, $.disabled, ge]), pe = Yt.useMemo(() => N ? N(re) : Yt.createElement(O9.Provider, { value: re }, L), [L, re, N]); + return Yt.createElement(Yt.Fragment, null, P !== null && Yt.createElement("noscript", null, Yt.createElement("style", null, P)), Yt.createElement("div", { ref: f, "data-input-otp-container": !0, style: Q, className: A }, pe, Yt.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, X))); }); -T9.displayName = "Input"; -function Lf(t, e) { +N9.displayName = "Input"; +function kf(t, e) { try { t.insertRule(e); } catch { console.error("input-otp could not insert CSS rule:", e); } } -var Tne = ` +var Bne = ` [data-input-otp] { --nojs-bg: white !important; --nojs-fg: black !important; @@ -38325,28 +38325,28 @@ var Tne = ` --nojs-fg: white !important; } }`; -const R9 = Gt.forwardRef(({ className: t, containerClassName: e, ...r }, n) => /* @__PURE__ */ me.jsx( - T9, +const cy = Yt.forwardRef(({ className: t, containerClassName: e, ...r }, n) => /* @__PURE__ */ fe.jsx( + N9, { ref: n, - containerClassName: Do( + containerClassName: Js( "xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50", e ), - className: Do("disabled:xc-cursor-not-allowed", t), + className: Js("disabled:xc-cursor-not-allowed", t), ...r } )); -R9.displayName = "InputOTP"; -const D9 = Gt.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ me.jsx("div", { ref: r, className: Do("xc-flex xc-items-center", t), ...e })); -D9.displayName = "InputOTPGroup"; -const Ja = Gt.forwardRef(({ index: t, className: e, ...r }, n) => { - const i = Gt.useContext(C9), { char: s, hasFakeCaret: o, isActive: a } = i.slots[t]; - return /* @__PURE__ */ me.jsxs( +cy.displayName = "InputOTP"; +const uy = Yt.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ fe.jsx("div", { ref: r, className: Js("xc-flex xc-items-center", t), ...e })); +uy.displayName = "InputOTPGroup"; +const Ri = Yt.forwardRef(({ index: t, className: e, ...r }, n) => { + const i = Yt.useContext(O9), { char: s, hasFakeCaret: o, isActive: a } = i.slots[t]; + return /* @__PURE__ */ fe.jsxs( "div", { ref: n, - className: Do( + className: Js( "xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all", a && "xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background", e @@ -38354,34 +38354,34 @@ const Ja = Gt.forwardRef(({ index: t, className: e, ...r }, n) => { ...r, children: [ s, - o && /* @__PURE__ */ me.jsx("div", { className: "xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center", children: /* @__PURE__ */ me.jsx("div", { className: "xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000" }) }) + o && /* @__PURE__ */ fe.jsx("div", { className: "xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center", children: /* @__PURE__ */ fe.jsx("div", { className: "xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000" }) }) ] } ); }); -Ja.displayName = "InputOTPSlot"; -function Rne(t) { +Ri.displayName = "InputOTPSlot"; +function L9(t) { const { spinning: e, children: r, className: n } = t; - return /* @__PURE__ */ me.jsxs("div", { className: "xc-inline-block xc-relative", children: [ + return /* @__PURE__ */ fe.jsxs("div", { className: "xc-inline-block xc-relative", children: [ r, - e && /* @__PURE__ */ me.jsx("div", { className: Do("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center", n), children: /* @__PURE__ */ me.jsx(gc, { className: "xc-animate-spin" }) }) + e && /* @__PURE__ */ fe.jsx("div", { className: Js("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center", n), children: /* @__PURE__ */ fe.jsx(_a, { className: "xc-animate-spin" }) }) ] }); } -const O9 = Sa({ +const k9 = Ma({ channel: "", device: "WEB", app: "", inviterCode: "" }); -function cy() { - return Tn(O9); +function fy() { + return Tn(k9); } -function Dne(t) { - const { config: e } = t, [r, n] = fr(e.channel), [i, s] = fr(e.device), [o, a] = fr(e.app), [u, l] = fr(e.inviterCode); - return Xn(() => { +function Fne(t) { + const { config: e } = t, [r, n] = Gt(e.channel), [i, s] = Gt(e.device), [o, a] = Gt(e.app), [u, l] = Gt(e.inviterCode); + return Dn(() => { n(e.channel), s(e.device), a(e.app), l(e.inviterCode); - }, [e]), /* @__PURE__ */ me.jsx( - O9.Provider, + }, [e]), /* @__PURE__ */ fe.jsx( + k9.Provider, { value: { channel: r, @@ -38393,31 +38393,31 @@ function Dne(t) { } ); } -function One(t) { - const { email: e } = t, [r, n] = fr(0), [i, s] = fr(!1), [o, a] = fr(!1), [u, l] = fr(""), [d, g] = fr(""), w = cy(); +function jne(t) { + const { email: e } = t, [r, n] = Gt(0), [i, s] = Gt(!1), [o, a] = Gt(!1), [u, l] = Gt(""), [d, p] = Gt(""), w = fy(); async function A() { n(60); const L = setInterval(() => { n(($) => $ === 0 ? (clearInterval(L), 0) : $ - 1); }, 1e3); } - async function M(L) { + async function P(L) { a(!0); try { - l(""), await ya.getEmailCode({ account_type: "email", email: L }), A(); + l(""), await qo.getEmailCode({ account_type: "email", email: L }), A(); } catch ($) { l($.message); } a(!1); } - Xn(() => { - e && M(e); + Dn(() => { + e && P(e); }, [e]); async function N(L) { - if (g(""), !(L.length < 6)) { + if (p(""), !(L.length < 6)) { s(!0); try { - const $ = await ya.emailLogin({ + const $ = await qo.emailLogin({ account_type: "email", connector: "codatta_email", account_enum: "C", @@ -38432,76 +38432,76 @@ function One(t) { }); t.onLogin($.data); } catch ($) { - g($.message); + p($.message); } s(!1); } } - return /* @__PURE__ */ me.jsxs(Ac, { children: [ - /* @__PURE__ */ me.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ me.jsx(uh, { title: "Sign in with email", onBack: t.onBack }) }), - /* @__PURE__ */ me.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ - /* @__PURE__ */ me.jsx(oZ, { className: "xc-mb-4", size: 60 }), - /* @__PURE__ */ me.jsx("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16", children: u ? /* @__PURE__ */ me.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ me.jsx("p", { className: "xc-px-8", children: u }) }) : o ? /* @__PURE__ */ me.jsx(gc, { className: "xc-animate-spin" }) : /* @__PURE__ */ me.jsxs(me.Fragment, { children: [ - /* @__PURE__ */ me.jsx("p", { className: "xc-text-lg xc-mb-1", children: "We’ve sent a verification code to" }), - /* @__PURE__ */ me.jsx("p", { className: "xc-font-bold xc-text-center", children: e }) + return /* @__PURE__ */ fe.jsxs(so, { children: [ + /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ fe.jsx(Pc, { title: "Sign in with email", onBack: t.onBack }) }), + /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ + /* @__PURE__ */ fe.jsx(VS, { className: "xc-mb-4", size: 60 }), + /* @__PURE__ */ fe.jsx("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16", children: u ? /* @__PURE__ */ fe.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ fe.jsx("p", { className: "xc-px-8", children: u }) }) : o ? /* @__PURE__ */ fe.jsx(_a, { className: "xc-animate-spin" }) : /* @__PURE__ */ fe.jsxs(fe.Fragment, { children: [ + /* @__PURE__ */ fe.jsx("p", { className: "xc-text-lg xc-mb-1", children: "We’ve sent a verification code to" }), + /* @__PURE__ */ fe.jsx("p", { className: "xc-font-bold xc-text-center", children: e }) ] }) }), - /* @__PURE__ */ me.jsx("div", { className: "xc-mb-2 xc-h-12", children: /* @__PURE__ */ me.jsx(Rne, { spinning: i, className: "xc-rounded-xl", children: /* @__PURE__ */ me.jsx(R9, { maxLength: 6, onChange: N, disabled: i, className: "disabled:xc-opacity-20", children: /* @__PURE__ */ me.jsx(D9, { children: /* @__PURE__ */ me.jsxs("div", { className: Do("xc-flex xc-gap-2", i ? "xc-opacity-20" : ""), children: [ - /* @__PURE__ */ me.jsx(Ja, { index: 0 }), - /* @__PURE__ */ me.jsx(Ja, { index: 1 }), - /* @__PURE__ */ me.jsx(Ja, { index: 2 }), - /* @__PURE__ */ me.jsx(Ja, { index: 3 }), - /* @__PURE__ */ me.jsx(Ja, { index: 4 }), - /* @__PURE__ */ me.jsx(Ja, { index: 5 }) + /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-2 xc-h-12", children: /* @__PURE__ */ fe.jsx(L9, { spinning: i, className: "xc-rounded-xl", children: /* @__PURE__ */ fe.jsx(cy, { maxLength: 6, onChange: N, disabled: i, className: "disabled:xc-opacity-20", children: /* @__PURE__ */ fe.jsx(uy, { children: /* @__PURE__ */ fe.jsxs("div", { className: Js("xc-flex xc-gap-2", i ? "xc-opacity-20" : ""), children: [ + /* @__PURE__ */ fe.jsx(Ri, { index: 0 }), + /* @__PURE__ */ fe.jsx(Ri, { index: 1 }), + /* @__PURE__ */ fe.jsx(Ri, { index: 2 }), + /* @__PURE__ */ fe.jsx(Ri, { index: 3 }), + /* @__PURE__ */ fe.jsx(Ri, { index: 4 }), + /* @__PURE__ */ fe.jsx(Ri, { index: 5 }) ] }) }) }) }) }), - d && /* @__PURE__ */ me.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ me.jsx("p", { children: d }) }) + d && /* @__PURE__ */ fe.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ fe.jsx("p", { children: d }) }) ] }), - /* @__PURE__ */ me.jsxs("div", { className: "xc-text-center xc-text-sm xc-text-gray-400", children: [ + /* @__PURE__ */ fe.jsxs("div", { className: "xc-text-center xc-text-sm xc-text-gray-400", children: [ "Not get it? ", - r ? `Recend in ${r}s` : /* @__PURE__ */ me.jsx("button", { onClick: () => M(e), children: "Send again" }) + r ? `Recend in ${r}s` : /* @__PURE__ */ fe.jsx("button", { onClick: () => P(e), children: "Send again" }) ] }) ] }); } -var N9 = { exports: {} }; +var $9 = { exports: {} }; (function(t, e) { (function(r, n) { t.exports = n(); })(gn, () => (() => { var r = { 873: (o, a) => { var u, l, d = function() { - var g = function(f, p) { - var b = f, x = $[p], _ = null, E = 0, v = null, P = [], I = {}, B = function(re, de) { + var p = function(f, g) { + var b = f, x = $[g], _ = null, E = 0, v = null, M = [], I = {}, F = function(re, pe) { _ = function(ie) { for (var ue = new Array(ie), ve = 0; ve < ie; ve += 1) { ue[ve] = new Array(ie); for (var Pe = 0; Pe < ie; Pe += 1) ue[ve][Pe] = null; } return ue; - }(E = 4 * b + 17), ce(0, 0), ce(E - 7, 0), ce(0, E - 7), oe(), D(), J(re, de), b >= 7 && Z(re), v == null && (v = T(b, x, P)), Q(v, de); - }, ce = function(re, de) { - for (var ie = -1; ie <= 7; ie += 1) if (!(re + ie <= -1 || E <= re + ie)) for (var ue = -1; ue <= 7; ue += 1) de + ue <= -1 || E <= de + ue || (_[re + ie][de + ue] = 0 <= ie && ie <= 6 && (ue == 0 || ue == 6) || 0 <= ue && ue <= 6 && (ie == 0 || ie == 6) || 2 <= ie && ie <= 4 && 2 <= ue && ue <= 4); + }(E = 4 * b + 17), ce(0, 0), ce(E - 7, 0), ce(0, E - 7), oe(), D(), J(re, pe), b >= 7 && Z(re), v == null && (v = T(b, x, M)), Q(v, pe); + }, ce = function(re, pe) { + for (var ie = -1; ie <= 7; ie += 1) if (!(re + ie <= -1 || E <= re + ie)) for (var ue = -1; ue <= 7; ue += 1) pe + ue <= -1 || E <= pe + ue || (_[re + ie][pe + ue] = 0 <= ie && ie <= 6 && (ue == 0 || ue == 6) || 0 <= ue && ue <= 6 && (ie == 0 || ie == 6) || 2 <= ie && ie <= 4 && 2 <= ue && ue <= 4); }, D = function() { for (var re = 8; re < E - 8; re += 1) _[re][6] == null && (_[re][6] = re % 2 == 0); - for (var de = 8; de < E - 8; de += 1) _[6][de] == null && (_[6][de] = de % 2 == 0); + for (var pe = 8; pe < E - 8; pe += 1) _[6][pe] == null && (_[6][pe] = pe % 2 == 0); }, oe = function() { - for (var re = F.getPatternPosition(b), de = 0; de < re.length; de += 1) for (var ie = 0; ie < re.length; ie += 1) { - var ue = re[de], ve = re[ie]; + for (var re = B.getPatternPosition(b), pe = 0; pe < re.length; pe += 1) for (var ie = 0; ie < re.length; ie += 1) { + var ue = re[pe], ve = re[ie]; if (_[ue][ve] == null) for (var Pe = -2; Pe <= 2; Pe += 1) for (var De = -2; De <= 2; De += 1) _[ue + Pe][ve + De] = Pe == -2 || Pe == 2 || De == -2 || De == 2 || Pe == 0 && De == 0; } }, Z = function(re) { - for (var de = F.getBCHTypeNumber(b), ie = 0; ie < 18; ie += 1) { - var ue = !re && (de >> ie & 1) == 1; + for (var pe = B.getBCHTypeNumber(b), ie = 0; ie < 18; ie += 1) { + var ue = !re && (pe >> ie & 1) == 1; _[Math.floor(ie / 3)][ie % 3 + E - 8 - 3] = ue; } - for (ie = 0; ie < 18; ie += 1) ue = !re && (de >> ie & 1) == 1, _[ie % 3 + E - 8 - 3][Math.floor(ie / 3)] = ue; - }, J = function(re, de) { - for (var ie = x << 3 | de, ue = F.getBCHTypeInfo(ie), ve = 0; ve < 15; ve += 1) { + for (ie = 0; ie < 18; ie += 1) ue = !re && (pe >> ie & 1) == 1, _[ie % 3 + E - 8 - 3][Math.floor(ie / 3)] = ue; + }, J = function(re, pe) { + for (var ie = x << 3 | pe, ue = B.getBCHTypeInfo(ie), ve = 0; ve < 15; ve += 1) { var Pe = !re && (ue >> ve & 1) == 1; ve < 6 ? _[ve][8] = Pe : ve < 8 ? _[ve + 1][8] = Pe : _[E - 15 + ve][8] = Pe; } for (ve = 0; ve < 15; ve += 1) Pe = !re && (ue >> ve & 1) == 1, ve < 8 ? _[8][E - ve - 1] = Pe : ve < 9 ? _[8][15 - ve - 1 + 1] = Pe : _[8][15 - ve - 1] = Pe; _[E - 8][8] = !re; - }, Q = function(re, de) { - for (var ie = -1, ue = E - 1, ve = 7, Pe = 0, De = F.getMaskFunction(de), Ce = E - 1; Ce > 0; Ce -= 2) for (Ce == 6 && (Ce -= 1); ; ) { + }, Q = function(re, pe) { + for (var ie = -1, ue = E - 1, ve = 7, Pe = 0, De = B.getMaskFunction(pe), Ce = E - 1; Ce > 0; Ce -= 2) for (Ce == 6 && (Ce -= 1); ; ) { for (var $e = 0; $e < 2; $e += 1) if (_[ue][Ce - $e] == null) { var Me = !1; Pe < re.length && (Me = (re[Pe] >>> ve & 1) == 1), De(ue, Ce - $e) && (Me = !Me), _[ue][Ce - $e] = Me, (ve -= 1) == -1 && (Pe += 1, ve = 7); @@ -38511,10 +38511,10 @@ var N9 = { exports: {} }; break; } } - }, T = function(re, de, ie) { - for (var ue = V.getRSBlocks(re, de), ve = te(), Pe = 0; Pe < ie.length; Pe += 1) { + }, T = function(re, pe, ie) { + for (var ue = V.getRSBlocks(re, pe), ve = te(), Pe = 0; Pe < ie.length; Pe += 1) { var De = ie[Pe]; - ve.put(De.getMode(), 4), ve.put(De.getLength(), F.getLengthInBits(De.getMode(), re)), De.write(ve); + ve.put(De.getMode(), 4), ve.put(De.getLength(), B.getLengthInBits(De.getMode(), re)), De.write(ve); } var Ce = 0; for (Pe = 0; Pe < ue.length; Pe += 1) Ce += ue[Pe].dataCount; @@ -38527,7 +38527,7 @@ var N9 = { exports: {} }; Ke = Math.max(Ke, Ze), Le = Math.max(Le, at), qe[_e] = new Array(Ze); for (var ke = 0; ke < qe[_e].length; ke += 1) qe[_e][ke] = 255 & $e.getBuffer()[ke + Ne]; Ne += Ze; - var Qe = F.getErrorCorrectPolynomial(at), tt = H(qe[_e], Qe.getLength() - 1).mod(Qe); + var Qe = B.getErrorCorrectPolynomial(at), tt = W(qe[_e], Qe.getLength() - 1).mod(Qe); for (ze[_e] = new Array(Qe.getLength() - 1), ke = 0; ke < ze[_e].length; ke += 1) { var Ye = ke + tt.getLength() - ze[_e].length; ze[_e][ke] = Ye >= 0 ? tt.getAt(Ye) : 0; @@ -38541,70 +38541,70 @@ var N9 = { exports: {} }; return lt; }(ve, ue); }; - I.addData = function(re, de) { + I.addData = function(re, pe) { var ie = null; - switch (de = de || "Byte") { + switch (pe = pe || "Byte") { case "Numeric": ie = R(re); break; case "Alphanumeric": - ie = W(re); + ie = K(re); break; case "Byte": - ie = pe(re); + ie = ge(re); break; case "Kanji": ie = Ee(re); break; default: - throw "mode:" + de; + throw "mode:" + pe; } - P.push(ie), v = null; - }, I.isDark = function(re, de) { - if (re < 0 || E <= re || de < 0 || E <= de) throw re + "," + de; - return _[re][de]; + M.push(ie), v = null; + }, I.isDark = function(re, pe) { + if (re < 0 || E <= re || pe < 0 || E <= pe) throw re + "," + pe; + return _[re][pe]; }, I.getModuleCount = function() { return E; }, I.make = function() { if (b < 1) { for (var re = 1; re < 40; re++) { - for (var de = V.getRSBlocks(re, x), ie = te(), ue = 0; ue < P.length; ue++) { - var ve = P[ue]; - ie.put(ve.getMode(), 4), ie.put(ve.getLength(), F.getLengthInBits(ve.getMode(), re)), ve.write(ie); + for (var pe = V.getRSBlocks(re, x), ie = te(), ue = 0; ue < M.length; ue++) { + var ve = M[ue]; + ie.put(ve.getMode(), 4), ie.put(ve.getLength(), B.getLengthInBits(ve.getMode(), re)), ve.write(ie); } var Pe = 0; - for (ue = 0; ue < de.length; ue++) Pe += de[ue].dataCount; + for (ue = 0; ue < pe.length; ue++) Pe += pe[ue].dataCount; if (ie.getLengthInBits() <= 8 * Pe) break; } b = re; } - B(!1, function() { + F(!1, function() { for (var De = 0, Ce = 0, $e = 0; $e < 8; $e += 1) { - B(!0, $e); - var Me = F.getLostPoint(I); + F(!0, $e); + var Me = B.getLostPoint(I); ($e == 0 || De > Me) && (De = Me, Ce = $e); } return Ce; }()); - }, I.createTableTag = function(re, de) { + }, I.createTableTag = function(re, pe) { re = re || 2; var ie = ""; - ie += '"; - }, I.createSvgTag = function(re, de, ie, ue) { + }, I.createSvgTag = function(re, pe, ie, ue) { var ve = {}; - typeof arguments[0] == "object" && (re = (ve = arguments[0]).cellSize, de = ve.margin, ie = ve.alt, ue = ve.title), re = re || 2, de = de === void 0 ? 4 * re : de, (ie = typeof ie == "string" ? { text: ie } : ie || {}).text = ie.text || null, ie.id = ie.text ? ie.id || "qrcode-description" : null, (ue = typeof ue == "string" ? { text: ue } : ue || {}).text = ue.text || null, ue.id = ue.text ? ue.id || "qrcode-title" : null; - var Pe, De, Ce, $e, Me = I.getModuleCount() * re + 2 * de, Ne = ""; - for ($e = "l" + re + ",0 0," + re + " -" + re + ",0 0,-" + re + "z ", Ne += '' + X(ue.text) + "" : "", Ne += ie.text ? '' + X(ie.text) + "" : "", Ne += '', Ne += '' + X(ue.text) + "" : "", Ne += ie.text ? '' + X(ie.text) + "" : "", Ne += '', Ne += '"; - }, I.createDataURL = function(re, de) { - re = re || 2, de = de === void 0 ? 4 * re : de; - var ie = I.getModuleCount() * re + 2 * de, ue = de, ve = ie - de; + }, I.createDataURL = function(re, pe) { + re = re || 2, pe = pe === void 0 ? 4 * re : pe; + var ie = I.getModuleCount() * re + 2 * pe, ue = pe, ve = ie - pe; return m(ie, ie, function(Pe, De) { if (ue <= Pe && Pe < ve && ue <= De && De < ve) { var Ce = Math.floor((Pe - ue) / re), $e = Math.floor((De - ue) / re); @@ -38612,34 +38612,34 @@ var N9 = { exports: {} }; } return 1; }); - }, I.createImgTag = function(re, de, ie) { - re = re || 2, de = de === void 0 ? 4 * re : de; - var ue = I.getModuleCount() * re + 2 * de, ve = ""; - return ve += ""; + }, I.createImgTag = function(re, pe, ie) { + re = re || 2, pe = pe === void 0 ? 4 * re : pe; + var ue = I.getModuleCount() * re + 2 * pe, ve = ""; + return ve += ""; }; var X = function(re) { - for (var de = "", ie = 0; ie < re.length; ie += 1) { + for (var pe = "", ie = 0; ie < re.length; ie += 1) { var ue = re.charAt(ie); switch (ue) { case "<": - de += "<"; + pe += "<"; break; case ">": - de += ">"; + pe += ">"; break; case "&": - de += "&"; + pe += "&"; break; case '"': - de += """; + pe += """; break; default: - de += ue; + pe += ue; } } - return de; + return pe; }; - return I.createASCII = function(re, de) { + return I.createASCII = function(re, pe) { if ((re = re || 1) < 2) return function(qe) { qe = qe === void 0 ? 2 : qe; var ze, _e, Ze, at, ke, Qe = 1 * I.getModuleCount() + 2 * qe, tt = qe, Ye = Qe - qe, dt = { "██": "█", "█ ": "▀", " █": "▄", " ": " " }, lt = { "██": "▀", "█ ": "▀", " █": " ", " ": " " }, ct = ""; @@ -38649,45 +38649,45 @@ var N9 = { exports: {} }; `; } return Qe % 2 && qe > 0 ? ct.substring(0, ct.length - Qe - 1) + Array(Qe + 1).join("▀") : ct.substring(0, ct.length - 1); - }(de); - re -= 1, de = de === void 0 ? 2 * re : de; - var ie, ue, ve, Pe, De = I.getModuleCount() * re + 2 * de, Ce = de, $e = De - de, Me = Array(re + 1).join("██"), Ne = Array(re + 1).join(" "), Ke = "", Le = ""; + }(pe); + re -= 1, pe = pe === void 0 ? 2 * re : pe; + var ie, ue, ve, Pe, De = I.getModuleCount() * re + 2 * pe, Ce = pe, $e = De - pe, Me = Array(re + 1).join("██"), Ne = Array(re + 1).join(" "), Ke = "", Le = ""; for (ie = 0; ie < De; ie += 1) { for (ve = Math.floor((ie - Ce) / re), Le = "", ue = 0; ue < De; ue += 1) Pe = 1, Ce <= ue && ue < $e && Ce <= ie && ie < $e && I.isDark(ve, Math.floor((ue - Ce) / re)) && (Pe = 0), Le += Pe ? Me : Ne; for (ve = 0; ve < re; ve += 1) Ke += Le + ` `; } return Ke.substring(0, Ke.length - 1); - }, I.renderTo2dContext = function(re, de) { - de = de || 2; - for (var ie = I.getModuleCount(), ue = 0; ue < ie; ue++) for (var ve = 0; ve < ie; ve++) re.fillStyle = I.isDark(ue, ve) ? "black" : "white", re.fillRect(ue * de, ve * de, de, de); + }, I.renderTo2dContext = function(re, pe) { + pe = pe || 2; + for (var ie = I.getModuleCount(), ue = 0; ue < ie; ue++) for (var ve = 0; ve < ie; ve++) re.fillStyle = I.isDark(ue, ve) ? "black" : "white", re.fillRect(ue * pe, ve * pe, pe, pe); }, I; }; - g.stringToBytes = (g.stringToBytesFuncs = { default: function(f) { - for (var p = [], b = 0; b < f.length; b += 1) { + p.stringToBytes = (p.stringToBytesFuncs = { default: function(f) { + for (var g = [], b = 0; b < f.length; b += 1) { var x = f.charCodeAt(b); - p.push(255 & x); + g.push(255 & x); } - return p; - } }).default, g.createStringToBytes = function(f, p) { + return g; + } }).default, p.createStringToBytes = function(f, g) { var b = function() { for (var _ = S(f), E = function() { var D = _.read(); if (D == -1) throw "eof"; return D; - }, v = 0, P = {}; ; ) { + }, v = 0, M = {}; ; ) { var I = _.read(); if (I == -1) break; - var B = E(), ce = E() << 8 | E(); - P[String.fromCharCode(I << 8 | B)] = ce, v += 1; + var F = E(), ce = E() << 8 | E(); + M[String.fromCharCode(I << 8 | F)] = ce, v += 1; } - if (v != p) throw v + " != " + p; - return P; + if (v != g) throw v + " != " + g; + return M; }(), x = 63; return function(_) { for (var E = [], v = 0; v < _.length; v += 1) { - var P = _.charCodeAt(v); - if (P < 128) E.push(P); + var M = _.charCodeAt(v); + if (M < 128) E.push(M); else { var I = b[_.charAt(v)]; typeof I == "number" ? (255 & I) == I ? E.push(I) : (E.push(I >>> 8), E.push(255 & I)) : E.push(x); @@ -38696,59 +38696,59 @@ var N9 = { exports: {} }; return E; }; }; - var w, A, M, N, L, $ = { L: 1, M: 0, Q: 3, H: 2 }, F = (w = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], A = 1335, M = 7973, L = function(f) { - for (var p = 0; f != 0; ) p += 1, f >>>= 1; - return p; + var w, A, P, N, L, $ = { L: 1, M: 0, Q: 3, H: 2 }, B = (w = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], A = 1335, P = 7973, L = function(f) { + for (var g = 0; f != 0; ) g += 1, f >>>= 1; + return g; }, (N = {}).getBCHTypeInfo = function(f) { - for (var p = f << 10; L(p) - L(A) >= 0; ) p ^= A << L(p) - L(A); - return 21522 ^ (f << 10 | p); + for (var g = f << 10; L(g) - L(A) >= 0; ) g ^= A << L(g) - L(A); + return 21522 ^ (f << 10 | g); }, N.getBCHTypeNumber = function(f) { - for (var p = f << 12; L(p) - L(M) >= 0; ) p ^= M << L(p) - L(M); - return f << 12 | p; + for (var g = f << 12; L(g) - L(P) >= 0; ) g ^= P << L(g) - L(P); + return f << 12 | g; }, N.getPatternPosition = function(f) { return w[f - 1]; }, N.getMaskFunction = function(f) { switch (f) { case 0: - return function(p, b) { - return (p + b) % 2 == 0; + return function(g, b) { + return (g + b) % 2 == 0; }; case 1: - return function(p, b) { - return p % 2 == 0; + return function(g, b) { + return g % 2 == 0; }; case 2: - return function(p, b) { + return function(g, b) { return b % 3 == 0; }; case 3: - return function(p, b) { - return (p + b) % 3 == 0; + return function(g, b) { + return (g + b) % 3 == 0; }; case 4: - return function(p, b) { - return (Math.floor(p / 2) + Math.floor(b / 3)) % 2 == 0; + return function(g, b) { + return (Math.floor(g / 2) + Math.floor(b / 3)) % 2 == 0; }; case 5: - return function(p, b) { - return p * b % 2 + p * b % 3 == 0; + return function(g, b) { + return g * b % 2 + g * b % 3 == 0; }; case 6: - return function(p, b) { - return (p * b % 2 + p * b % 3) % 2 == 0; + return function(g, b) { + return (g * b % 2 + g * b % 3) % 2 == 0; }; case 7: - return function(p, b) { - return (p * b % 3 + (p + b) % 2) % 2 == 0; + return function(g, b) { + return (g * b % 3 + (g + b) % 2) % 2 == 0; }; default: throw "bad maskPattern:" + f; } }, N.getErrorCorrectPolynomial = function(f) { - for (var p = H([1], 0), b = 0; b < f; b += 1) p = p.multiply(H([1, K.gexp(b)], 0)); - return p; - }, N.getLengthInBits = function(f, p) { - if (1 <= p && p < 10) switch (f) { + for (var g = W([1], 0), b = 0; b < f; b += 1) g = g.multiply(W([1, H.gexp(b)], 0)); + return g; + }, N.getLengthInBits = function(f, g) { + if (1 <= g && g < 10) switch (f) { case 1: return 10; case 2: @@ -38759,7 +38759,7 @@ var N9 = { exports: {} }; default: throw "mode:" + f; } - else if (p < 27) switch (f) { + else if (g < 27) switch (f) { case 1: return 12; case 2: @@ -38772,7 +38772,7 @@ var N9 = { exports: {} }; throw "mode:" + f; } else { - if (!(p < 41)) throw "type:" + p; + if (!(g < 41)) throw "type:" + g; switch (f) { case 1: return 14; @@ -38787,55 +38787,55 @@ var N9 = { exports: {} }; } } }, N.getLostPoint = function(f) { - for (var p = f.getModuleCount(), b = 0, x = 0; x < p; x += 1) for (var _ = 0; _ < p; _ += 1) { - for (var E = 0, v = f.isDark(x, _), P = -1; P <= 1; P += 1) if (!(x + P < 0 || p <= x + P)) for (var I = -1; I <= 1; I += 1) _ + I < 0 || p <= _ + I || P == 0 && I == 0 || v == f.isDark(x + P, _ + I) && (E += 1); + for (var g = f.getModuleCount(), b = 0, x = 0; x < g; x += 1) for (var _ = 0; _ < g; _ += 1) { + for (var E = 0, v = f.isDark(x, _), M = -1; M <= 1; M += 1) if (!(x + M < 0 || g <= x + M)) for (var I = -1; I <= 1; I += 1) _ + I < 0 || g <= _ + I || M == 0 && I == 0 || v == f.isDark(x + M, _ + I) && (E += 1); E > 5 && (b += 3 + E - 5); } - for (x = 0; x < p - 1; x += 1) for (_ = 0; _ < p - 1; _ += 1) { - var B = 0; - f.isDark(x, _) && (B += 1), f.isDark(x + 1, _) && (B += 1), f.isDark(x, _ + 1) && (B += 1), f.isDark(x + 1, _ + 1) && (B += 1), B != 0 && B != 4 || (b += 3); + for (x = 0; x < g - 1; x += 1) for (_ = 0; _ < g - 1; _ += 1) { + var F = 0; + f.isDark(x, _) && (F += 1), f.isDark(x + 1, _) && (F += 1), f.isDark(x, _ + 1) && (F += 1), f.isDark(x + 1, _ + 1) && (F += 1), F != 0 && F != 4 || (b += 3); } - for (x = 0; x < p; x += 1) for (_ = 0; _ < p - 6; _ += 1) f.isDark(x, _) && !f.isDark(x, _ + 1) && f.isDark(x, _ + 2) && f.isDark(x, _ + 3) && f.isDark(x, _ + 4) && !f.isDark(x, _ + 5) && f.isDark(x, _ + 6) && (b += 40); - for (_ = 0; _ < p; _ += 1) for (x = 0; x < p - 6; x += 1) f.isDark(x, _) && !f.isDark(x + 1, _) && f.isDark(x + 2, _) && f.isDark(x + 3, _) && f.isDark(x + 4, _) && !f.isDark(x + 5, _) && f.isDark(x + 6, _) && (b += 40); + for (x = 0; x < g; x += 1) for (_ = 0; _ < g - 6; _ += 1) f.isDark(x, _) && !f.isDark(x, _ + 1) && f.isDark(x, _ + 2) && f.isDark(x, _ + 3) && f.isDark(x, _ + 4) && !f.isDark(x, _ + 5) && f.isDark(x, _ + 6) && (b += 40); + for (_ = 0; _ < g; _ += 1) for (x = 0; x < g - 6; x += 1) f.isDark(x, _) && !f.isDark(x + 1, _) && f.isDark(x + 2, _) && f.isDark(x + 3, _) && f.isDark(x + 4, _) && !f.isDark(x + 5, _) && f.isDark(x + 6, _) && (b += 40); var ce = 0; - for (_ = 0; _ < p; _ += 1) for (x = 0; x < p; x += 1) f.isDark(x, _) && (ce += 1); - return b + Math.abs(100 * ce / p / p - 50) / 5 * 10; - }, N), K = function() { - for (var f = new Array(256), p = new Array(256), b = 0; b < 8; b += 1) f[b] = 1 << b; + for (_ = 0; _ < g; _ += 1) for (x = 0; x < g; x += 1) f.isDark(x, _) && (ce += 1); + return b + Math.abs(100 * ce / g / g - 50) / 5 * 10; + }, N), H = function() { + for (var f = new Array(256), g = new Array(256), b = 0; b < 8; b += 1) f[b] = 1 << b; for (b = 8; b < 256; b += 1) f[b] = f[b - 4] ^ f[b - 5] ^ f[b - 6] ^ f[b - 8]; - for (b = 0; b < 255; b += 1) p[f[b]] = b; + for (b = 0; b < 255; b += 1) g[f[b]] = b; return { glog: function(x) { if (x < 1) throw "glog(" + x + ")"; - return p[x]; + return g[x]; }, gexp: function(x) { for (; x < 0; ) x += 255; for (; x >= 256; ) x -= 255; return f[x]; } }; }(); - function H(f, p) { - if (f.length === void 0) throw f.length + "/" + p; + function W(f, g) { + if (f.length === void 0) throw f.length + "/" + g; var b = function() { for (var _ = 0; _ < f.length && f[_] == 0; ) _ += 1; - for (var E = new Array(f.length - _ + p), v = 0; v < f.length - _; v += 1) E[v] = f[v + _]; + for (var E = new Array(f.length - _ + g), v = 0; v < f.length - _; v += 1) E[v] = f[v + _]; return E; }(), x = { getAt: function(_) { return b[_]; }, getLength: function() { return b.length; }, multiply: function(_) { - for (var E = new Array(x.getLength() + _.getLength() - 1), v = 0; v < x.getLength(); v += 1) for (var P = 0; P < _.getLength(); P += 1) E[v + P] ^= K.gexp(K.glog(x.getAt(v)) + K.glog(_.getAt(P))); - return H(E, 0); + for (var E = new Array(x.getLength() + _.getLength() - 1), v = 0; v < x.getLength(); v += 1) for (var M = 0; M < _.getLength(); M += 1) E[v + M] ^= H.gexp(H.glog(x.getAt(v)) + H.glog(_.getAt(M))); + return W(E, 0); }, mod: function(_) { if (x.getLength() - _.getLength() < 0) return x; - for (var E = K.glog(x.getAt(0)) - K.glog(_.getAt(0)), v = new Array(x.getLength()), P = 0; P < x.getLength(); P += 1) v[P] = x.getAt(P); - for (P = 0; P < _.getLength(); P += 1) v[P] ^= K.gexp(K.glog(_.getAt(P)) + E); - return H(v, 0).mod(_); + for (var E = H.glog(x.getAt(0)) - H.glog(_.getAt(0)), v = new Array(x.getLength()), M = 0; M < x.getLength(); M += 1) v[M] = x.getAt(M); + for (M = 0; M < _.getLength(); M += 1) v[M] ^= H.gexp(H.glog(_.getAt(M)) + E); + return W(v, 0).mod(_); } }; return x; } var V = /* @__PURE__ */ function() { - var f = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12, 7, 37, 13], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]], p = function(x, _) { + var f = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12, 7, 37, 13], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]], g = function(x, _) { var E = {}; return E.totalCount = x, E.dataCount = _, E; }, b = { getRSBlocks: function(x, _) { @@ -38854,12 +38854,12 @@ var N9 = { exports: {} }; } }(x, _); if (E === void 0) throw "bad rs block @ typeNumber:" + x + "/errorCorrectionLevel:" + _; - for (var v = E.length / 3, P = [], I = 0; I < v; I += 1) for (var B = E[3 * I + 0], ce = E[3 * I + 1], D = E[3 * I + 2], oe = 0; oe < B; oe += 1) P.push(p(ce, D)); - return P; + for (var v = E.length / 3, M = [], I = 0; I < v; I += 1) for (var F = E[3 * I + 0], ce = E[3 * I + 1], D = E[3 * I + 2], oe = 0; oe < F; oe += 1) M.push(g(ce, D)); + return M; } }; return b; }(), te = function() { - var f = [], p = 0, b = { getBuffer: function() { + var f = [], g = 0, b = { getBuffer: function() { return f; }, getAt: function(x) { var _ = Math.floor(x / 8); @@ -38867,35 +38867,35 @@ var N9 = { exports: {} }; }, put: function(x, _) { for (var E = 0; E < _; E += 1) b.putBit((x >>> _ - E - 1 & 1) == 1); }, getLengthInBits: function() { - return p; + return g; }, putBit: function(x) { - var _ = Math.floor(p / 8); - f.length <= _ && f.push(0), x && (f[_] |= 128 >>> p % 8), p += 1; + var _ = Math.floor(g / 8); + f.length <= _ && f.push(0), x && (f[_] |= 128 >>> g % 8), g += 1; } }; return b; }, R = function(f) { - var p = f, b = { getMode: function() { + var g = f, b = { getMode: function() { return 1; }, getLength: function(E) { - return p.length; + return g.length; }, write: function(E) { - for (var v = p, P = 0; P + 2 < v.length; ) E.put(x(v.substring(P, P + 3)), 10), P += 3; - P < v.length && (v.length - P == 1 ? E.put(x(v.substring(P, P + 1)), 4) : v.length - P == 2 && E.put(x(v.substring(P, P + 2)), 7)); + for (var v = g, M = 0; M + 2 < v.length; ) E.put(x(v.substring(M, M + 3)), 10), M += 3; + M < v.length && (v.length - M == 1 ? E.put(x(v.substring(M, M + 1)), 4) : v.length - M == 2 && E.put(x(v.substring(M, M + 2)), 7)); } }, x = function(E) { - for (var v = 0, P = 0; P < E.length; P += 1) v = 10 * v + _(E.charAt(P)); + for (var v = 0, M = 0; M < E.length; M += 1) v = 10 * v + _(E.charAt(M)); return v; }, _ = function(E) { if ("0" <= E && E <= "9") return E.charCodeAt(0) - 48; throw "illegal char :" + E; }; return b; - }, W = function(f) { - var p = f, b = { getMode: function() { + }, K = function(f) { + var g = f, b = { getMode: function() { return 2; }, getLength: function(_) { - return p.length; + return g.length; }, write: function(_) { - for (var E = p, v = 0; v + 1 < E.length; ) _.put(45 * x(E.charAt(v)) + x(E.charAt(v + 1)), 11), v += 2; + for (var E = g, v = 0; v + 1 < E.length; ) _.put(45 * x(E.charAt(v)) + x(E.charAt(v + 1)), 11), v += 2; v < E.length && _.put(x(E.charAt(v)), 6); } }, x = function(_) { if ("0" <= _ && _ <= "9") return _.charCodeAt(0) - 48; @@ -38924,49 +38924,49 @@ var N9 = { exports: {} }; } }; return b; - }, pe = function(f) { - var p = g.stringToBytes(f); + }, ge = function(f) { + var g = p.stringToBytes(f); return { getMode: function() { return 4; }, getLength: function(b) { - return p.length; + return g.length; }, write: function(b) { - for (var x = 0; x < p.length; x += 1) b.put(p[x], 8); + for (var x = 0; x < g.length; x += 1) b.put(g[x], 8); } }; }, Ee = function(f) { - var p = g.stringToBytesFuncs.SJIS; - if (!p) throw "sjis not supported."; + var g = p.stringToBytesFuncs.SJIS; + if (!g) throw "sjis not supported."; (function() { - var _ = p("友"); + var _ = g("友"); if (_.length != 2 || (_[0] << 8 | _[1]) != 38726) throw "sjis not supported."; })(); - var b = p(f), x = { getMode: function() { + var b = g(f), x = { getMode: function() { return 8; }, getLength: function(_) { return ~~(b.length / 2); }, write: function(_) { for (var E = b, v = 0; v + 1 < E.length; ) { - var P = (255 & E[v]) << 8 | 255 & E[v + 1]; - if (33088 <= P && P <= 40956) P -= 33088; + var M = (255 & E[v]) << 8 | 255 & E[v + 1]; + if (33088 <= M && M <= 40956) M -= 33088; else { - if (!(57408 <= P && P <= 60351)) throw "illegal char at " + (v + 1) + "/" + P; - P -= 49472; + if (!(57408 <= M && M <= 60351)) throw "illegal char at " + (v + 1) + "/" + M; + M -= 49472; } - P = 192 * (P >>> 8 & 255) + (255 & P), _.put(P, 13), v += 2; + M = 192 * (M >>> 8 & 255) + (255 & M), _.put(M, 13), v += 2; } if (v < E.length) throw "illegal char at " + (v + 1); } }; return x; }, Y = function() { - var f = [], p = { writeByte: function(b) { + var f = [], g = { writeByte: function(b) { f.push(255 & b); }, writeShort: function(b) { - p.writeByte(b), p.writeByte(b >>> 8); + g.writeByte(b), g.writeByte(b >>> 8); }, writeBytes: function(b, x, _) { x = x || 0, _ = _ || b.length; - for (var E = 0; E < _; E += 1) p.writeByte(b[E + x]); + for (var E = 0; E < _; E += 1) g.writeByte(b[E + x]); }, writeString: function(b) { - for (var x = 0; x < b.length; x += 1) p.writeByte(b.charCodeAt(x)); + for (var x = 0; x < b.length; x += 1) g.writeByte(b.charCodeAt(x)); }, toByteArray: function() { return f; }, toString: function() { @@ -38975,42 +38975,42 @@ var N9 = { exports: {} }; for (var x = 0; x < f.length; x += 1) x > 0 && (b += ","), b += f[x]; return b + "]"; } }; - return p; + return g; }, S = function(f) { - var p = f, b = 0, x = 0, _ = 0, E = { read: function() { + var g = f, b = 0, x = 0, _ = 0, E = { read: function() { for (; _ < 8; ) { - if (b >= p.length) { + if (b >= g.length) { if (_ == 0) return -1; throw "unexpected end of file./" + _; } - var P = p.charAt(b); - if (b += 1, P == "=") return _ = 0, -1; - P.match(/^\s$/) || (x = x << 6 | v(P.charCodeAt(0)), _ += 6); + var M = g.charAt(b); + if (b += 1, M == "=") return _ = 0, -1; + M.match(/^\s$/) || (x = x << 6 | v(M.charCodeAt(0)), _ += 6); } var I = x >>> _ - 8 & 255; return _ -= 8, I; - } }, v = function(P) { - if (65 <= P && P <= 90) return P - 65; - if (97 <= P && P <= 122) return P - 97 + 26; - if (48 <= P && P <= 57) return P - 48 + 52; - if (P == 43) return 62; - if (P == 47) return 63; - throw "c:" + P; + } }, v = function(M) { + if (65 <= M && M <= 90) return M - 65; + if (97 <= M && M <= 122) return M - 97 + 26; + if (48 <= M && M <= 57) return M - 48 + 52; + if (M == 43) return 62; + if (M == 47) return 63; + throw "c:" + M; }; return E; - }, m = function(f, p, b) { + }, m = function(f, g, b) { for (var x = function(ce, D) { - var oe = ce, Z = D, J = new Array(ce * D), Q = { setPixel: function(re, de, ie) { - J[de * oe + re] = ie; + var oe = ce, Z = D, J = new Array(ce * D), Q = { setPixel: function(re, pe, ie) { + J[pe * oe + re] = ie; }, write: function(re) { re.writeString("GIF87a"), re.writeShort(oe), re.writeShort(Z), re.writeByte(128), re.writeByte(0), re.writeByte(0), re.writeByte(0), re.writeByte(0), re.writeByte(0), re.writeByte(255), re.writeByte(255), re.writeByte(255), re.writeString(","), re.writeShort(0), re.writeShort(0), re.writeShort(oe), re.writeShort(Z), re.writeByte(0); - var de = T(2); + var pe = T(2); re.writeByte(2); - for (var ie = 0; de.length - ie > 255; ) re.writeByte(255), re.writeBytes(de, ie, 255), ie += 255; - re.writeByte(de.length - ie), re.writeBytes(de, ie, de.length - ie), re.writeByte(0), re.writeString(";"); + for (var ie = 0; pe.length - ie > 255; ) re.writeByte(255), re.writeBytes(pe, ie, 255), ie += 255; + re.writeByte(pe.length - ie), re.writeBytes(pe, ie, pe.length - ie), re.writeByte(0), re.writeString(";"); } }, T = function(re) { - for (var de = 1 << re, ie = 1 + (1 << re), ue = re + 1, ve = X(), Pe = 0; Pe < de; Pe += 1) ve.add(String.fromCharCode(Pe)); - ve.add(String.fromCharCode(de)), ve.add(String.fromCharCode(ie)); + for (var pe = 1 << re, ie = 1 + (1 << re), ue = re + 1, ve = X(), Pe = 0; Pe < pe; Pe += 1) ve.add(String.fromCharCode(Pe)); + ve.add(String.fromCharCode(pe)), ve.add(String.fromCharCode(ie)); var De, Ce, $e, Me = Y(), Ne = (De = Me, Ce = 0, $e = 0, { write: function(ze, _e) { if (ze >>> _e) throw "length over"; for (; Ce + _e >= 8; ) De.writeByte(255 & (ze << Ce | $e)), _e -= 8 - Ce, ze >>>= 8 - Ce, $e = 0, Ce = 0; @@ -39018,7 +39018,7 @@ var N9 = { exports: {} }; }, flush: function() { Ce > 0 && De.writeByte($e); } }); - Ne.write(de, ue); + Ne.write(pe, ue); var Ke = 0, Le = String.fromCharCode(J[Ke]); for (Ke += 1; Ke < J.length; ) { var qe = String.fromCharCode(J[Ke]); @@ -39026,11 +39026,11 @@ var N9 = { exports: {} }; } return Ne.write(ve.indexOf(Le), ue), Ne.write(ie, ue), Ne.flush(), Me.toByteArray(); }, X = function() { - var re = {}, de = 0, ie = { add: function(ue) { + var re = {}, pe = 0, ie = { add: function(ue) { if (ie.contains(ue)) throw "dup key:" + ue; - re[ue] = de, de += 1; + re[ue] = pe, pe += 1; }, size: function() { - return de; + return pe; }, indexOf: function(ue) { return re[ue]; }, contains: function(ue) { @@ -39039,10 +39039,10 @@ var N9 = { exports: {} }; return ie; }; return Q; - }(f, p), _ = 0; _ < p; _ += 1) for (var E = 0; E < f; E += 1) x.setPixel(E, _, b(E, _)); + }(f, g), _ = 0; _ < g; _ += 1) for (var E = 0; E < f; E += 1) x.setPixel(E, _, b(E, _)); var v = Y(); x.write(v); - for (var P = function() { + for (var M = function() { var ce = 0, D = 0, oe = 0, Z = "", J = {}, Q = function(X) { Z += String.fromCharCode(T(63 & X)); }, T = function(X) { @@ -39062,19 +39062,19 @@ var N9 = { exports: {} }; }, J.toString = function() { return Z; }, J; - }(), I = v.toByteArray(), B = 0; B < I.length; B += 1) P.writeByte(I[B]); - return P.flush(), "data:image/gif;base64," + P; + }(), I = v.toByteArray(), F = 0; F < I.length; F += 1) M.writeByte(I[F]); + return M.flush(), "data:image/gif;base64," + M; }; - return g; + return p; }(); - d.stringToBytesFuncs["UTF-8"] = function(g) { + d.stringToBytesFuncs["UTF-8"] = function(p) { return function(w) { - for (var A = [], M = 0; M < w.length; M++) { - var N = w.charCodeAt(M); - N < 128 ? A.push(N) : N < 2048 ? A.push(192 | N >> 6, 128 | 63 & N) : N < 55296 || N >= 57344 ? A.push(224 | N >> 12, 128 | N >> 6 & 63, 128 | 63 & N) : (M++, N = 65536 + ((1023 & N) << 10 | 1023 & w.charCodeAt(M)), A.push(240 | N >> 18, 128 | N >> 12 & 63, 128 | N >> 6 & 63, 128 | 63 & N)); + for (var A = [], P = 0; P < w.length; P++) { + var N = w.charCodeAt(P); + N < 128 ? A.push(N) : N < 2048 ? A.push(192 | N >> 6, 128 | 63 & N) : N < 55296 || N >= 57344 ? A.push(224 | N >> 12, 128 | N >> 6 & 63, 128 | 63 & N) : (P++, N = 65536 + ((1023 & N) << 10 | 1023 & w.charCodeAt(P)), A.push(240 | N >> 18, 128 | N >> 12 & 63, 128 | N >> 6 & 63, 128 | 63 & N)); } return A; - }(g); + }(p); }, (l = typeof (u = function() { return d; }) == "function" ? u.apply(a, []) : u) === void 0 || (o.exports = l); @@ -39098,9 +39098,9 @@ var N9 = { exports: {} }; function a(S, ...m) { if (!m.length) return S; const f = m.shift(); - return f !== void 0 && o(S) && o(f) ? (S = Object.assign({}, S), Object.keys(f).forEach((p) => { - const b = S[p], x = f[p]; - Array.isArray(b) && Array.isArray(x) ? S[p] = x : o(b) && o(x) ? S[p] = a(Object.assign({}, b), x) : S[p] = x; + return f !== void 0 && o(S) && o(f) ? (S = Object.assign({}, S), Object.keys(f).forEach((g) => { + const b = S[g], x = f[g]; + Array.isArray(b) && Array.isArray(x) ? S[g] = x : o(b) && o(x) ? S[g] = a(Object.assign({}, b), x) : S[g] = x; }), a(S, ...m)) : S; } function u(S, m) { @@ -39109,10 +39109,10 @@ var N9 = { exports: {} }; } const l = { L: 0.07, M: 0.15, Q: 0.25, H: 0.3 }; class d { - constructor({ svg: m, type: f, window: p }) { - this._svg = m, this._type = f, this._window = p; + constructor({ svg: m, type: f, window: g }) { + this._svg = m, this._type = f, this._window = g; } - draw(m, f, p, b) { + draw(m, f, g, b) { let x; switch (this._type) { case "dots": @@ -39133,99 +39133,99 @@ var N9 = { exports: {} }; default: x = this._drawSquare; } - x.call(this, { x: m, y: f, size: p, getNeighbor: b }); + x.call(this, { x: m, y: f, size: g, getNeighbor: b }); } - _rotateFigure({ x: m, y: f, size: p, rotation: b = 0, draw: x }) { + _rotateFigure({ x: m, y: f, size: g, rotation: b = 0, draw: x }) { var _; - const E = m + p / 2, v = f + p / 2; + const E = m + g / 2, v = f + g / 2; x(), (_ = this._element) === null || _ === void 0 || _.setAttribute("transform", `rotate(${180 * b / Math.PI},${E},${v})`); } _basicDot(m) { - const { size: f, x: p, y: b } = m; + const { size: f, x: g, y: b } = m; this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "circle"), this._element.setAttribute("cx", String(p + f / 2)), this._element.setAttribute("cy", String(b + f / 2)), this._element.setAttribute("r", String(f / 2)); + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "circle"), this._element.setAttribute("cx", String(g + f / 2)), this._element.setAttribute("cy", String(b + f / 2)), this._element.setAttribute("r", String(f / 2)); } })); } _basicSquare(m) { - const { size: f, x: p, y: b } = m; + const { size: f, x: g, y: b } = m; this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"), this._element.setAttribute("x", String(p)), this._element.setAttribute("y", String(b)), this._element.setAttribute("width", String(f)), this._element.setAttribute("height", String(f)); + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"), this._element.setAttribute("x", String(g)), this._element.setAttribute("y", String(b)), this._element.setAttribute("width", String(f)), this._element.setAttribute("height", String(f)); } })); } _basicSideRounded(m) { - const { size: f, x: p, y: b } = m; + const { size: f, x: g, y: b } = m; this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${p} ${b}v ${f}h ` + f / 2 + `a ${f / 2} ${f / 2}, 0, 0, 0, 0 ${-f}`); + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${g} ${b}v ${f}h ` + f / 2 + `a ${f / 2} ${f / 2}, 0, 0, 0, 0 ${-f}`); } })); } _basicCornerRounded(m) { - const { size: f, x: p, y: b } = m; + const { size: f, x: g, y: b } = m; this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${p} ${b}v ${f}h ${f}v ` + -f / 2 + `a ${f / 2} ${f / 2}, 0, 0, 0, ${-f / 2} ${-f / 2}`); + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${g} ${b}v ${f}h ${f}v ` + -f / 2 + `a ${f / 2} ${f / 2}, 0, 0, 0, ${-f / 2} ${-f / 2}`); } })); } _basicCornerExtraRounded(m) { - const { size: f, x: p, y: b } = m; + const { size: f, x: g, y: b } = m; this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${p} ${b}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`); + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${g} ${b}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`); } })); } _basicCornersRounded(m) { - const { size: f, x: p, y: b } = m; + const { size: f, x: g, y: b } = m; this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${p} ${b}v ` + f / 2 + `a ${f / 2} ${f / 2}, 0, 0, 0, ${f / 2} ${f / 2}h ` + f / 2 + "v " + -f / 2 + `a ${f / 2} ${f / 2}, 0, 0, 0, ${-f / 2} ${-f / 2}`); + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${g} ${b}v ` + f / 2 + `a ${f / 2} ${f / 2}, 0, 0, 0, ${f / 2} ${f / 2}h ` + f / 2 + "v " + -f / 2 + `a ${f / 2} ${f / 2}, 0, 0, 0, ${-f / 2} ${-f / 2}`); } })); } - _drawDot({ x: m, y: f, size: p }) { - this._basicDot({ x: m, y: f, size: p, rotation: 0 }); + _drawDot({ x: m, y: f, size: g }) { + this._basicDot({ x: m, y: f, size: g, rotation: 0 }); } - _drawSquare({ x: m, y: f, size: p }) { - this._basicSquare({ x: m, y: f, size: p, rotation: 0 }); + _drawSquare({ x: m, y: f, size: g }) { + this._basicSquare({ x: m, y: f, size: g, rotation: 0 }); } - _drawRounded({ x: m, y: f, size: p, getNeighbor: b }) { - const x = b ? +b(-1, 0) : 0, _ = b ? +b(1, 0) : 0, E = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0, P = x + _ + E + v; - if (P !== 0) if (P > 2 || x && _ || E && v) this._basicSquare({ x: m, y: f, size: p, rotation: 0 }); + _drawRounded({ x: m, y: f, size: g, getNeighbor: b }) { + const x = b ? +b(-1, 0) : 0, _ = b ? +b(1, 0) : 0, E = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0, M = x + _ + E + v; + if (M !== 0) if (M > 2 || x && _ || E && v) this._basicSquare({ x: m, y: f, size: g, rotation: 0 }); else { - if (P === 2) { + if (M === 2) { let I = 0; - return x && E ? I = Math.PI / 2 : E && _ ? I = Math.PI : _ && v && (I = -Math.PI / 2), void this._basicCornerRounded({ x: m, y: f, size: p, rotation: I }); + return x && E ? I = Math.PI / 2 : E && _ ? I = Math.PI : _ && v && (I = -Math.PI / 2), void this._basicCornerRounded({ x: m, y: f, size: g, rotation: I }); } - if (P === 1) { + if (M === 1) { let I = 0; - return E ? I = Math.PI / 2 : _ ? I = Math.PI : v && (I = -Math.PI / 2), void this._basicSideRounded({ x: m, y: f, size: p, rotation: I }); + return E ? I = Math.PI / 2 : _ ? I = Math.PI : v && (I = -Math.PI / 2), void this._basicSideRounded({ x: m, y: f, size: g, rotation: I }); } } - else this._basicDot({ x: m, y: f, size: p, rotation: 0 }); + else this._basicDot({ x: m, y: f, size: g, rotation: 0 }); } - _drawExtraRounded({ x: m, y: f, size: p, getNeighbor: b }) { - const x = b ? +b(-1, 0) : 0, _ = b ? +b(1, 0) : 0, E = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0, P = x + _ + E + v; - if (P !== 0) if (P > 2 || x && _ || E && v) this._basicSquare({ x: m, y: f, size: p, rotation: 0 }); + _drawExtraRounded({ x: m, y: f, size: g, getNeighbor: b }) { + const x = b ? +b(-1, 0) : 0, _ = b ? +b(1, 0) : 0, E = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0, M = x + _ + E + v; + if (M !== 0) if (M > 2 || x && _ || E && v) this._basicSquare({ x: m, y: f, size: g, rotation: 0 }); else { - if (P === 2) { + if (M === 2) { let I = 0; - return x && E ? I = Math.PI / 2 : E && _ ? I = Math.PI : _ && v && (I = -Math.PI / 2), void this._basicCornerExtraRounded({ x: m, y: f, size: p, rotation: I }); + return x && E ? I = Math.PI / 2 : E && _ ? I = Math.PI : _ && v && (I = -Math.PI / 2), void this._basicCornerExtraRounded({ x: m, y: f, size: g, rotation: I }); } - if (P === 1) { + if (M === 1) { let I = 0; - return E ? I = Math.PI / 2 : _ ? I = Math.PI : v && (I = -Math.PI / 2), void this._basicSideRounded({ x: m, y: f, size: p, rotation: I }); + return E ? I = Math.PI / 2 : _ ? I = Math.PI : v && (I = -Math.PI / 2), void this._basicSideRounded({ x: m, y: f, size: g, rotation: I }); } } - else this._basicDot({ x: m, y: f, size: p, rotation: 0 }); + else this._basicDot({ x: m, y: f, size: g, rotation: 0 }); } - _drawClassy({ x: m, y: f, size: p, getNeighbor: b }) { + _drawClassy({ x: m, y: f, size: g, getNeighbor: b }) { const x = b ? +b(-1, 0) : 0, _ = b ? +b(1, 0) : 0, E = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0; - x + _ + E + v !== 0 ? x || E ? _ || v ? this._basicSquare({ x: m, y: f, size: p, rotation: 0 }) : this._basicCornerRounded({ x: m, y: f, size: p, rotation: Math.PI / 2 }) : this._basicCornerRounded({ x: m, y: f, size: p, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: m, y: f, size: p, rotation: Math.PI / 2 }); + x + _ + E + v !== 0 ? x || E ? _ || v ? this._basicSquare({ x: m, y: f, size: g, rotation: 0 }) : this._basicCornerRounded({ x: m, y: f, size: g, rotation: Math.PI / 2 }) : this._basicCornerRounded({ x: m, y: f, size: g, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: m, y: f, size: g, rotation: Math.PI / 2 }); } - _drawClassyRounded({ x: m, y: f, size: p, getNeighbor: b }) { + _drawClassyRounded({ x: m, y: f, size: g, getNeighbor: b }) { const x = b ? +b(-1, 0) : 0, _ = b ? +b(1, 0) : 0, E = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0; - x + _ + E + v !== 0 ? x || E ? _ || v ? this._basicSquare({ x: m, y: f, size: p, rotation: 0 }) : this._basicCornerExtraRounded({ x: m, y: f, size: p, rotation: Math.PI / 2 }) : this._basicCornerExtraRounded({ x: m, y: f, size: p, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: m, y: f, size: p, rotation: Math.PI / 2 }); + x + _ + E + v !== 0 ? x || E ? _ || v ? this._basicSquare({ x: m, y: f, size: g, rotation: 0 }) : this._basicCornerExtraRounded({ x: m, y: f, size: g, rotation: Math.PI / 2 }) : this._basicCornerExtraRounded({ x: m, y: f, size: g, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: m, y: f, size: g, rotation: Math.PI / 2 }); } } - class g { - constructor({ svg: m, type: f, window: p }) { - this._svg = m, this._type = f, this._window = p; + class p { + constructor({ svg: m, type: f, window: g }) { + this._svg = m, this._type = f, this._window = g; } - draw(m, f, p, b) { + draw(m, f, g, b) { let x; switch (this._type) { case "square": @@ -39237,77 +39237,77 @@ var N9 = { exports: {} }; default: x = this._drawDot; } - x.call(this, { x: m, y: f, size: p, rotation: b }); + x.call(this, { x: m, y: f, size: g, rotation: b }); } - _rotateFigure({ x: m, y: f, size: p, rotation: b = 0, draw: x }) { + _rotateFigure({ x: m, y: f, size: g, rotation: b = 0, draw: x }) { var _; - const E = m + p / 2, v = f + p / 2; + const E = m + g / 2, v = f + g / 2; x(), (_ = this._element) === null || _ === void 0 || _.setAttribute("transform", `rotate(${180 * b / Math.PI},${E},${v})`); } _basicDot(m) { - const { size: f, x: p, y: b } = m, x = f / 7; + const { size: f, x: g, y: b } = m, x = f / 7; this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${p + f / 2} ${b}a ${f / 2} ${f / 2} 0 1 0 0.1 0zm 0 ${x}a ${f / 2 - x} ${f / 2 - x} 0 1 1 -0.1 0Z`); + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${g + f / 2} ${b}a ${f / 2} ${f / 2} 0 1 0 0.1 0zm 0 ${x}a ${f / 2 - x} ${f / 2 - x} 0 1 1 -0.1 0Z`); } })); } _basicSquare(m) { - const { size: f, x: p, y: b } = m, x = f / 7; + const { size: f, x: g, y: b } = m, x = f / 7; this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${p} ${b}v ${f}h ${f}v ` + -f + `zM ${p + x} ${b + x}h ` + (f - 2 * x) + "v " + (f - 2 * x) + "h " + (2 * x - f) + "z"); + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${g} ${b}v ${f}h ${f}v ` + -f + `zM ${g + x} ${b + x}h ` + (f - 2 * x) + "v " + (f - 2 * x) + "h " + (2 * x - f) + "z"); } })); } _basicExtraRounded(m) { - const { size: f, x: p, y: b } = m, x = f / 7; + const { size: f, x: g, y: b } = m, x = f / 7; this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${p} ${b + 2.5 * x}v ` + 2 * x + `a ${2.5 * x} ${2.5 * x}, 0, 0, 0, ${2.5 * x} ${2.5 * x}h ` + 2 * x + `a ${2.5 * x} ${2.5 * x}, 0, 0, 0, ${2.5 * x} ${2.5 * -x}v ` + -2 * x + `a ${2.5 * x} ${2.5 * x}, 0, 0, 0, ${2.5 * -x} ${2.5 * -x}h ` + -2 * x + `a ${2.5 * x} ${2.5 * x}, 0, 0, 0, ${2.5 * -x} ${2.5 * x}M ${p + 2.5 * x} ${b + x}h ` + 2 * x + `a ${1.5 * x} ${1.5 * x}, 0, 0, 1, ${1.5 * x} ${1.5 * x}v ` + 2 * x + `a ${1.5 * x} ${1.5 * x}, 0, 0, 1, ${1.5 * -x} ${1.5 * x}h ` + -2 * x + `a ${1.5 * x} ${1.5 * x}, 0, 0, 1, ${1.5 * -x} ${1.5 * -x}v ` + -2 * x + `a ${1.5 * x} ${1.5 * x}, 0, 0, 1, ${1.5 * x} ${1.5 * -x}`); + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${g} ${b + 2.5 * x}v ` + 2 * x + `a ${2.5 * x} ${2.5 * x}, 0, 0, 0, ${2.5 * x} ${2.5 * x}h ` + 2 * x + `a ${2.5 * x} ${2.5 * x}, 0, 0, 0, ${2.5 * x} ${2.5 * -x}v ` + -2 * x + `a ${2.5 * x} ${2.5 * x}, 0, 0, 0, ${2.5 * -x} ${2.5 * -x}h ` + -2 * x + `a ${2.5 * x} ${2.5 * x}, 0, 0, 0, ${2.5 * -x} ${2.5 * x}M ${g + 2.5 * x} ${b + x}h ` + 2 * x + `a ${1.5 * x} ${1.5 * x}, 0, 0, 1, ${1.5 * x} ${1.5 * x}v ` + 2 * x + `a ${1.5 * x} ${1.5 * x}, 0, 0, 1, ${1.5 * -x} ${1.5 * x}h ` + -2 * x + `a ${1.5 * x} ${1.5 * x}, 0, 0, 1, ${1.5 * -x} ${1.5 * -x}v ` + -2 * x + `a ${1.5 * x} ${1.5 * x}, 0, 0, 1, ${1.5 * x} ${1.5 * -x}`); } })); } - _drawDot({ x: m, y: f, size: p, rotation: b }) { - this._basicDot({ x: m, y: f, size: p, rotation: b }); + _drawDot({ x: m, y: f, size: g, rotation: b }) { + this._basicDot({ x: m, y: f, size: g, rotation: b }); } - _drawSquare({ x: m, y: f, size: p, rotation: b }) { - this._basicSquare({ x: m, y: f, size: p, rotation: b }); + _drawSquare({ x: m, y: f, size: g, rotation: b }) { + this._basicSquare({ x: m, y: f, size: g, rotation: b }); } - _drawExtraRounded({ x: m, y: f, size: p, rotation: b }) { - this._basicExtraRounded({ x: m, y: f, size: p, rotation: b }); + _drawExtraRounded({ x: m, y: f, size: g, rotation: b }) { + this._basicExtraRounded({ x: m, y: f, size: g, rotation: b }); } } class w { - constructor({ svg: m, type: f, window: p }) { - this._svg = m, this._type = f, this._window = p; + constructor({ svg: m, type: f, window: g }) { + this._svg = m, this._type = f, this._window = g; } - draw(m, f, p, b) { + draw(m, f, g, b) { let x; - x = this._type === "square" ? this._drawSquare : this._drawDot, x.call(this, { x: m, y: f, size: p, rotation: b }); + x = this._type === "square" ? this._drawSquare : this._drawDot, x.call(this, { x: m, y: f, size: g, rotation: b }); } - _rotateFigure({ x: m, y: f, size: p, rotation: b = 0, draw: x }) { + _rotateFigure({ x: m, y: f, size: g, rotation: b = 0, draw: x }) { var _; - const E = m + p / 2, v = f + p / 2; + const E = m + g / 2, v = f + g / 2; x(), (_ = this._element) === null || _ === void 0 || _.setAttribute("transform", `rotate(${180 * b / Math.PI},${E},${v})`); } _basicDot(m) { - const { size: f, x: p, y: b } = m; + const { size: f, x: g, y: b } = m; this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "circle"), this._element.setAttribute("cx", String(p + f / 2)), this._element.setAttribute("cy", String(b + f / 2)), this._element.setAttribute("r", String(f / 2)); + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "circle"), this._element.setAttribute("cx", String(g + f / 2)), this._element.setAttribute("cy", String(b + f / 2)), this._element.setAttribute("r", String(f / 2)); } })); } _basicSquare(m) { - const { size: f, x: p, y: b } = m; + const { size: f, x: g, y: b } = m; this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"), this._element.setAttribute("x", String(p)), this._element.setAttribute("y", String(b)), this._element.setAttribute("width", String(f)), this._element.setAttribute("height", String(f)); + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"), this._element.setAttribute("x", String(g)), this._element.setAttribute("y", String(b)), this._element.setAttribute("width", String(f)), this._element.setAttribute("height", String(f)); } })); } - _drawDot({ x: m, y: f, size: p, rotation: b }) { - this._basicDot({ x: m, y: f, size: p, rotation: b }); + _drawDot({ x: m, y: f, size: g, rotation: b }) { + this._basicDot({ x: m, y: f, size: g, rotation: b }); } - _drawSquare({ x: m, y: f, size: p, rotation: b }) { - this._basicSquare({ x: m, y: f, size: p, rotation: b }); + _drawSquare({ x: m, y: f, size: g, rotation: b }) { + this._basicSquare({ x: m, y: f, size: g, rotation: b }); } } - const A = "circle", M = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]], N = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]; + const A = "circle", P = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]], N = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]; class L { constructor(m, f) { - this._roundSize = (p) => this._options.dotsOptions.roundSize ? Math.floor(p) : p, this._window = f, this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._element.setAttribute("width", String(m.width)), this._element.setAttribute("height", String(m.height)), this._element.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), m.dotsOptions.roundSize || this._element.setAttribute("shape-rendering", "crispEdges"), this._element.setAttribute("viewBox", `0 0 ${m.width} ${m.height}`), this._defs = this._window.document.createElementNS("http://www.w3.org/2000/svg", "defs"), this._element.appendChild(this._defs), this._imageUri = m.image, this._instanceId = L.instanceCount++, this._options = m; + this._roundSize = (g) => this._options.dotsOptions.roundSize ? Math.floor(g) : g, this._window = f, this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._element.setAttribute("width", String(m.width)), this._element.setAttribute("height", String(m.height)), this._element.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), m.dotsOptions.roundSize || this._element.setAttribute("shape-rendering", "crispEdges"), this._element.setAttribute("viewBox", `0 0 ${m.width} ${m.height}`), this._defs = this._window.document.createElementNS("http://www.w3.org/2000/svg", "defs"), this._element.appendChild(this._defs), this._imageUri = m.image, this._instanceId = L.instanceCount++, this._options = m; } get width() { return this._options.width; @@ -39319,75 +39319,75 @@ var N9 = { exports: {} }; return this._element; } async drawQR(m) { - const f = m.getModuleCount(), p = Math.min(this._options.width, this._options.height) - 2 * this._options.margin, b = this._options.shape === A ? p / Math.sqrt(2) : p, x = this._roundSize(b / f); + const f = m.getModuleCount(), g = Math.min(this._options.width, this._options.height) - 2 * this._options.margin, b = this._options.shape === A ? g / Math.sqrt(2) : g, x = this._roundSize(b / f); let _ = { hideXDots: 0, hideYDots: 0, width: 0, height: 0 }; if (this._qr = m, this._options.image) { if (await this.loadImage(), !this._image) return; - const { imageOptions: E, qrOptions: v } = this._options, P = E.imageSize * l[v.errorCorrectionLevel], I = Math.floor(P * f * f); - _ = function({ originalHeight: B, originalWidth: ce, maxHiddenDots: D, maxHiddenAxisDots: oe, dotSize: Z }) { + const { imageOptions: E, qrOptions: v } = this._options, M = E.imageSize * l[v.errorCorrectionLevel], I = Math.floor(M * f * f); + _ = function({ originalHeight: F, originalWidth: ce, maxHiddenDots: D, maxHiddenAxisDots: oe, dotSize: Z }) { const J = { x: 0, y: 0 }, Q = { x: 0, y: 0 }; - if (B <= 0 || ce <= 0 || D <= 0 || Z <= 0) return { height: 0, width: 0, hideYDots: 0, hideXDots: 0 }; - const T = B / ce; + if (F <= 0 || ce <= 0 || D <= 0 || Z <= 0) return { height: 0, width: 0, hideYDots: 0, hideXDots: 0 }; + const T = F / ce; return J.x = Math.floor(Math.sqrt(D / T)), J.x <= 0 && (J.x = 1), oe && oe < J.x && (J.x = oe), J.x % 2 == 0 && J.x--, Q.x = J.x * Z, J.y = 1 + 2 * Math.ceil((J.x * T - 1) / 2), Q.y = Math.round(Q.x * T), (J.y * J.x > D || oe && oe < J.y) && (oe && oe < J.y ? (J.y = oe, J.y % 2 == 0 && J.x--) : J.y -= 2, Q.y = J.y * Z, J.x = 1 + 2 * Math.ceil((J.y / T - 1) / 2), Q.x = Math.round(Q.y / T)), { height: Q.y, width: Q.x, hideYDots: J.y, hideXDots: J.x }; }({ originalWidth: this._image.width, originalHeight: this._image.height, maxHiddenDots: I, maxHiddenAxisDots: f - 14, dotSize: x }); } this.drawBackground(), this.drawDots((E, v) => { - var P, I, B, ce, D, oe; - return !(this._options.imageOptions.hideBackgroundDots && E >= (f - _.hideYDots) / 2 && E < (f + _.hideYDots) / 2 && v >= (f - _.hideXDots) / 2 && v < (f + _.hideXDots) / 2 || !((P = M[E]) === null || P === void 0) && P[v] || !((I = M[E - f + 7]) === null || I === void 0) && I[v] || !((B = M[E]) === null || B === void 0) && B[v - f + 7] || !((ce = N[E]) === null || ce === void 0) && ce[v] || !((D = N[E - f + 7]) === null || D === void 0) && D[v] || !((oe = N[E]) === null || oe === void 0) && oe[v - f + 7]); + var M, I, F, ce, D, oe; + return !(this._options.imageOptions.hideBackgroundDots && E >= (f - _.hideYDots) / 2 && E < (f + _.hideYDots) / 2 && v >= (f - _.hideXDots) / 2 && v < (f + _.hideXDots) / 2 || !((M = P[E]) === null || M === void 0) && M[v] || !((I = P[E - f + 7]) === null || I === void 0) && I[v] || !((F = P[E]) === null || F === void 0) && F[v - f + 7] || !((ce = N[E]) === null || ce === void 0) && ce[v] || !((D = N[E - f + 7]) === null || D === void 0) && D[v] || !((oe = N[E]) === null || oe === void 0) && oe[v - f + 7]); }), this.drawCorners(), this._options.image && await this.drawImage({ width: _.width, height: _.height, count: f, dotSize: x }); } drawBackground() { - var m, f, p; + var m, f, g; const b = this._element, x = this._options; if (b) { const _ = (m = x.backgroundOptions) === null || m === void 0 ? void 0 : m.gradient, E = (f = x.backgroundOptions) === null || f === void 0 ? void 0 : f.color; - let v = x.height, P = x.width; + let v = x.height, M = x.width; if (_ || E) { const I = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"); - this._backgroundClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._backgroundClipPath.setAttribute("id", `clip-path-background-color-${this._instanceId}`), this._defs.appendChild(this._backgroundClipPath), !((p = x.backgroundOptions) === null || p === void 0) && p.round && (v = P = Math.min(x.width, x.height), I.setAttribute("rx", String(v / 2 * x.backgroundOptions.round))), I.setAttribute("x", String(this._roundSize((x.width - P) / 2))), I.setAttribute("y", String(this._roundSize((x.height - v) / 2))), I.setAttribute("width", String(P)), I.setAttribute("height", String(v)), this._backgroundClipPath.appendChild(I), this._createColor({ options: _, color: E, additionalRotation: 0, x: 0, y: 0, height: x.height, width: x.width, name: `background-color-${this._instanceId}` }); + this._backgroundClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._backgroundClipPath.setAttribute("id", `clip-path-background-color-${this._instanceId}`), this._defs.appendChild(this._backgroundClipPath), !((g = x.backgroundOptions) === null || g === void 0) && g.round && (v = M = Math.min(x.width, x.height), I.setAttribute("rx", String(v / 2 * x.backgroundOptions.round))), I.setAttribute("x", String(this._roundSize((x.width - M) / 2))), I.setAttribute("y", String(this._roundSize((x.height - v) / 2))), I.setAttribute("width", String(M)), I.setAttribute("height", String(v)), this._backgroundClipPath.appendChild(I), this._createColor({ options: _, color: E, additionalRotation: 0, x: 0, y: 0, height: x.height, width: x.width, name: `background-color-${this._instanceId}` }); } } } drawDots(m) { - var f, p; + var f, g; if (!this._qr) throw "QR code is not defined"; const b = this._options, x = this._qr.getModuleCount(); if (x > b.width || x > b.height) throw "The canvas is too small."; - const _ = Math.min(b.width, b.height) - 2 * b.margin, E = b.shape === A ? _ / Math.sqrt(2) : _, v = this._roundSize(E / x), P = this._roundSize((b.width - x * v) / 2), I = this._roundSize((b.height - x * v) / 2), B = new d({ svg: this._element, type: b.dotsOptions.type, window: this._window }); + const _ = Math.min(b.width, b.height) - 2 * b.margin, E = b.shape === A ? _ / Math.sqrt(2) : _, v = this._roundSize(E / x), M = this._roundSize((b.width - x * v) / 2), I = this._roundSize((b.height - x * v) / 2), F = new d({ svg: this._element, type: b.dotsOptions.type, window: this._window }); this._dotsClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._dotsClipPath.setAttribute("id", `clip-path-dot-color-${this._instanceId}`), this._defs.appendChild(this._dotsClipPath), this._createColor({ options: (f = b.dotsOptions) === null || f === void 0 ? void 0 : f.gradient, color: b.dotsOptions.color, additionalRotation: 0, x: 0, y: 0, height: b.height, width: b.width, name: `dot-color-${this._instanceId}` }); - for (let ce = 0; ce < x; ce++) for (let D = 0; D < x; D++) m && !m(ce, D) || !((p = this._qr) === null || p === void 0) && p.isDark(ce, D) && (B.draw(P + D * v, I + ce * v, v, (oe, Z) => !(D + oe < 0 || ce + Z < 0 || D + oe >= x || ce + Z >= x) && !(m && !m(ce + Z, D + oe)) && !!this._qr && this._qr.isDark(ce + Z, D + oe)), B._element && this._dotsClipPath && this._dotsClipPath.appendChild(B._element)); + for (let ce = 0; ce < x; ce++) for (let D = 0; D < x; D++) m && !m(ce, D) || !((g = this._qr) === null || g === void 0) && g.isDark(ce, D) && (F.draw(M + D * v, I + ce * v, v, (oe, Z) => !(D + oe < 0 || ce + Z < 0 || D + oe >= x || ce + Z >= x) && !(m && !m(ce + Z, D + oe)) && !!this._qr && this._qr.isDark(ce + Z, D + oe)), F._element && this._dotsClipPath && this._dotsClipPath.appendChild(F._element)); if (b.shape === A) { - const ce = this._roundSize((_ / v - x) / 2), D = x + 2 * ce, oe = P - ce * v, Z = I - ce * v, J = [], Q = this._roundSize(D / 2); + const ce = this._roundSize((_ / v - x) / 2), D = x + 2 * ce, oe = M - ce * v, Z = I - ce * v, J = [], Q = this._roundSize(D / 2); for (let T = 0; T < D; T++) { J[T] = []; for (let X = 0; X < D; X++) T >= ce - 1 && T <= D - ce && X >= ce - 1 && X <= D - ce || Math.sqrt((T - Q) * (T - Q) + (X - Q) * (X - Q)) > Q ? J[T][X] = 0 : J[T][X] = this._qr.isDark(X - 2 * ce < 0 ? X : X >= x ? X - 2 * ce : X - ce, T - 2 * ce < 0 ? T : T >= x ? T - 2 * ce : T - ce) ? 1 : 0; } - for (let T = 0; T < D; T++) for (let X = 0; X < D; X++) J[T][X] && (B.draw(oe + X * v, Z + T * v, v, (re, de) => { + for (let T = 0; T < D; T++) for (let X = 0; X < D; X++) J[T][X] && (F.draw(oe + X * v, Z + T * v, v, (re, pe) => { var ie; - return !!(!((ie = J[T + de]) === null || ie === void 0) && ie[X + re]); - }), B._element && this._dotsClipPath && this._dotsClipPath.appendChild(B._element)); + return !!(!((ie = J[T + pe]) === null || ie === void 0) && ie[X + re]); + }), F._element && this._dotsClipPath && this._dotsClipPath.appendChild(F._element)); } } drawCorners() { if (!this._qr) throw "QR code is not defined"; const m = this._element, f = this._options; if (!m) throw "Element code is not defined"; - const p = this._qr.getModuleCount(), b = Math.min(f.width, f.height) - 2 * f.margin, x = f.shape === A ? b / Math.sqrt(2) : b, _ = this._roundSize(x / p), E = 7 * _, v = 3 * _, P = this._roundSize((f.width - p * _) / 2), I = this._roundSize((f.height - p * _) / 2); - [[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach(([B, ce, D]) => { - var oe, Z, J, Q, T, X, re, de, ie, ue, ve, Pe; - const De = P + B * _ * (p - 7), Ce = I + ce * _ * (p - 7); + const g = this._qr.getModuleCount(), b = Math.min(f.width, f.height) - 2 * f.margin, x = f.shape === A ? b / Math.sqrt(2) : b, _ = this._roundSize(x / g), E = 7 * _, v = 3 * _, M = this._roundSize((f.width - g * _) / 2), I = this._roundSize((f.height - g * _) / 2); + [[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach(([F, ce, D]) => { + var oe, Z, J, Q, T, X, re, pe, ie, ue, ve, Pe; + const De = M + F * _ * (g - 7), Ce = I + ce * _ * (g - 7); let $e = this._dotsClipPath, Me = this._dotsClipPath; - if ((!((oe = f.cornersSquareOptions) === null || oe === void 0) && oe.gradient || !((Z = f.cornersSquareOptions) === null || Z === void 0) && Z.color) && ($e = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), $e.setAttribute("id", `clip-path-corners-square-color-${B}-${ce}-${this._instanceId}`), this._defs.appendChild($e), this._cornersSquareClipPath = this._cornersDotClipPath = Me = $e, this._createColor({ options: (J = f.cornersSquareOptions) === null || J === void 0 ? void 0 : J.gradient, color: (Q = f.cornersSquareOptions) === null || Q === void 0 ? void 0 : Q.color, additionalRotation: D, x: De, y: Ce, height: E, width: E, name: `corners-square-color-${B}-${ce}-${this._instanceId}` })), (T = f.cornersSquareOptions) === null || T === void 0 ? void 0 : T.type) { - const Ne = new g({ svg: this._element, type: f.cornersSquareOptions.type, window: this._window }); + if ((!((oe = f.cornersSquareOptions) === null || oe === void 0) && oe.gradient || !((Z = f.cornersSquareOptions) === null || Z === void 0) && Z.color) && ($e = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), $e.setAttribute("id", `clip-path-corners-square-color-${F}-${ce}-${this._instanceId}`), this._defs.appendChild($e), this._cornersSquareClipPath = this._cornersDotClipPath = Me = $e, this._createColor({ options: (J = f.cornersSquareOptions) === null || J === void 0 ? void 0 : J.gradient, color: (Q = f.cornersSquareOptions) === null || Q === void 0 ? void 0 : Q.color, additionalRotation: D, x: De, y: Ce, height: E, width: E, name: `corners-square-color-${F}-${ce}-${this._instanceId}` })), (T = f.cornersSquareOptions) === null || T === void 0 ? void 0 : T.type) { + const Ne = new p({ svg: this._element, type: f.cornersSquareOptions.type, window: this._window }); Ne.draw(De, Ce, E, D), Ne._element && $e && $e.appendChild(Ne._element); } else { const Ne = new d({ svg: this._element, type: f.dotsOptions.type, window: this._window }); - for (let Ke = 0; Ke < M.length; Ke++) for (let Le = 0; Le < M[Ke].length; Le++) !((X = M[Ke]) === null || X === void 0) && X[Le] && (Ne.draw(De + Le * _, Ce + Ke * _, _, (qe, ze) => { + for (let Ke = 0; Ke < P.length; Ke++) for (let Le = 0; Le < P[Ke].length; Le++) !((X = P[Ke]) === null || X === void 0) && X[Le] && (Ne.draw(De + Le * _, Ce + Ke * _, _, (qe, ze) => { var _e; - return !!(!((_e = M[Ke + ze]) === null || _e === void 0) && _e[Le + qe]); + return !!(!((_e = P[Ke + ze]) === null || _e === void 0) && _e[Le + qe]); }), Ne._element && $e && $e.appendChild(Ne._element)); } - if ((!((re = f.cornersDotOptions) === null || re === void 0) && re.gradient || !((de = f.cornersDotOptions) === null || de === void 0) && de.color) && (Me = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), Me.setAttribute("id", `clip-path-corners-dot-color-${B}-${ce}-${this._instanceId}`), this._defs.appendChild(Me), this._cornersDotClipPath = Me, this._createColor({ options: (ie = f.cornersDotOptions) === null || ie === void 0 ? void 0 : ie.gradient, color: (ue = f.cornersDotOptions) === null || ue === void 0 ? void 0 : ue.color, additionalRotation: D, x: De + 2 * _, y: Ce + 2 * _, height: v, width: v, name: `corners-dot-color-${B}-${ce}-${this._instanceId}` })), (ve = f.cornersDotOptions) === null || ve === void 0 ? void 0 : ve.type) { + if ((!((re = f.cornersDotOptions) === null || re === void 0) && re.gradient || !((pe = f.cornersDotOptions) === null || pe === void 0) && pe.color) && (Me = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), Me.setAttribute("id", `clip-path-corners-dot-color-${F}-${ce}-${this._instanceId}`), this._defs.appendChild(Me), this._cornersDotClipPath = Me, this._createColor({ options: (ie = f.cornersDotOptions) === null || ie === void 0 ? void 0 : ie.gradient, color: (ue = f.cornersDotOptions) === null || ue === void 0 ? void 0 : ue.color, additionalRotation: D, x: De + 2 * _, y: Ce + 2 * _, height: v, width: v, name: `corners-dot-color-${F}-${ce}-${this._instanceId}` })), (ve = f.cornersDotOptions) === null || ve === void 0 ? void 0 : ve.type) { const Ne = new w({ svg: this._element, type: f.cornersDotOptions.type, window: this._window }); Ne.draw(De + 2 * _, Ce + 2 * _, v, D), Ne._element && Me && Me.appendChild(Ne._element); } else { @@ -39401,10 +39401,10 @@ var N9 = { exports: {} }; } loadImage() { return new Promise((m, f) => { - var p; + var g; const b = this._options; if (!b.image) return f("Image is not defined"); - if (!((p = b.nodeCanvas) === null || p === void 0) && p.loadImage) b.nodeCanvas.loadImage(b.image).then((x) => { + if (!((g = b.nodeCanvas) === null || g === void 0) && g.loadImage) b.nodeCanvas.loadImage(b.image).then((x) => { var _, E; if (this._image = x, this._options.imageOptions.saveAsBlob) { const v = (_ = b.nodeCanvas) === null || _ === void 0 ? void 0 : _.createCanvas(this._image.width, this._image.height); @@ -39417,45 +39417,45 @@ var N9 = { exports: {} }; typeof b.imageOptions.crossOrigin == "string" && (x.crossOrigin = b.imageOptions.crossOrigin), this._image = x, x.onload = async () => { this._options.imageOptions.saveAsBlob && (this._imageUri = await async function(_, E) { return new Promise((v) => { - const P = new E.XMLHttpRequest(); - P.onload = function() { + const M = new E.XMLHttpRequest(); + M.onload = function() { const I = new E.FileReader(); I.onloadend = function() { v(I.result); - }, I.readAsDataURL(P.response); - }, P.open("GET", _), P.responseType = "blob", P.send(); + }, I.readAsDataURL(M.response); + }, M.open("GET", _), M.responseType = "blob", M.send(); }); }(b.image || "", this._window)), m(); }, x.src = b.image; } }); } - async drawImage({ width: m, height: f, count: p, dotSize: b }) { - const x = this._options, _ = this._roundSize((x.width - p * b) / 2), E = this._roundSize((x.height - p * b) / 2), v = _ + this._roundSize(x.imageOptions.margin + (p * b - m) / 2), P = E + this._roundSize(x.imageOptions.margin + (p * b - f) / 2), I = m - 2 * x.imageOptions.margin, B = f - 2 * x.imageOptions.margin, ce = this._window.document.createElementNS("http://www.w3.org/2000/svg", "image"); - ce.setAttribute("href", this._imageUri || ""), ce.setAttribute("x", String(v)), ce.setAttribute("y", String(P)), ce.setAttribute("width", `${I}px`), ce.setAttribute("height", `${B}px`), this._element.appendChild(ce); + async drawImage({ width: m, height: f, count: g, dotSize: b }) { + const x = this._options, _ = this._roundSize((x.width - g * b) / 2), E = this._roundSize((x.height - g * b) / 2), v = _ + this._roundSize(x.imageOptions.margin + (g * b - m) / 2), M = E + this._roundSize(x.imageOptions.margin + (g * b - f) / 2), I = m - 2 * x.imageOptions.margin, F = f - 2 * x.imageOptions.margin, ce = this._window.document.createElementNS("http://www.w3.org/2000/svg", "image"); + ce.setAttribute("href", this._imageUri || ""), ce.setAttribute("x", String(v)), ce.setAttribute("y", String(M)), ce.setAttribute("width", `${I}px`), ce.setAttribute("height", `${F}px`), this._element.appendChild(ce); } - _createColor({ options: m, color: f, additionalRotation: p, x: b, y: x, height: _, width: E, name: v }) { - const P = E > _ ? E : _, I = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"); + _createColor({ options: m, color: f, additionalRotation: g, x: b, y: x, height: _, width: E, name: v }) { + const M = E > _ ? E : _, I = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"); if (I.setAttribute("x", String(b)), I.setAttribute("y", String(x)), I.setAttribute("height", String(_)), I.setAttribute("width", String(E)), I.setAttribute("clip-path", `url('#clip-path-${v}')`), m) { - let B; - if (m.type === "radial") B = this._window.document.createElementNS("http://www.w3.org/2000/svg", "radialGradient"), B.setAttribute("id", v), B.setAttribute("gradientUnits", "userSpaceOnUse"), B.setAttribute("fx", String(b + E / 2)), B.setAttribute("fy", String(x + _ / 2)), B.setAttribute("cx", String(b + E / 2)), B.setAttribute("cy", String(x + _ / 2)), B.setAttribute("r", String(P / 2)); + let F; + if (m.type === "radial") F = this._window.document.createElementNS("http://www.w3.org/2000/svg", "radialGradient"), F.setAttribute("id", v), F.setAttribute("gradientUnits", "userSpaceOnUse"), F.setAttribute("fx", String(b + E / 2)), F.setAttribute("fy", String(x + _ / 2)), F.setAttribute("cx", String(b + E / 2)), F.setAttribute("cy", String(x + _ / 2)), F.setAttribute("r", String(M / 2)); else { - const ce = ((m.rotation || 0) + p) % (2 * Math.PI), D = (ce + 2 * Math.PI) % (2 * Math.PI); + const ce = ((m.rotation || 0) + g) % (2 * Math.PI), D = (ce + 2 * Math.PI) % (2 * Math.PI); let oe = b + E / 2, Z = x + _ / 2, J = b + E / 2, Q = x + _ / 2; - D >= 0 && D <= 0.25 * Math.PI || D > 1.75 * Math.PI && D <= 2 * Math.PI ? (oe -= E / 2, Z -= _ / 2 * Math.tan(ce), J += E / 2, Q += _ / 2 * Math.tan(ce)) : D > 0.25 * Math.PI && D <= 0.75 * Math.PI ? (Z -= _ / 2, oe -= E / 2 / Math.tan(ce), Q += _ / 2, J += E / 2 / Math.tan(ce)) : D > 0.75 * Math.PI && D <= 1.25 * Math.PI ? (oe += E / 2, Z += _ / 2 * Math.tan(ce), J -= E / 2, Q -= _ / 2 * Math.tan(ce)) : D > 1.25 * Math.PI && D <= 1.75 * Math.PI && (Z += _ / 2, oe += E / 2 / Math.tan(ce), Q -= _ / 2, J -= E / 2 / Math.tan(ce)), B = this._window.document.createElementNS("http://www.w3.org/2000/svg", "linearGradient"), B.setAttribute("id", v), B.setAttribute("gradientUnits", "userSpaceOnUse"), B.setAttribute("x1", String(Math.round(oe))), B.setAttribute("y1", String(Math.round(Z))), B.setAttribute("x2", String(Math.round(J))), B.setAttribute("y2", String(Math.round(Q))); + D >= 0 && D <= 0.25 * Math.PI || D > 1.75 * Math.PI && D <= 2 * Math.PI ? (oe -= E / 2, Z -= _ / 2 * Math.tan(ce), J += E / 2, Q += _ / 2 * Math.tan(ce)) : D > 0.25 * Math.PI && D <= 0.75 * Math.PI ? (Z -= _ / 2, oe -= E / 2 / Math.tan(ce), Q += _ / 2, J += E / 2 / Math.tan(ce)) : D > 0.75 * Math.PI && D <= 1.25 * Math.PI ? (oe += E / 2, Z += _ / 2 * Math.tan(ce), J -= E / 2, Q -= _ / 2 * Math.tan(ce)) : D > 1.25 * Math.PI && D <= 1.75 * Math.PI && (Z += _ / 2, oe += E / 2 / Math.tan(ce), Q -= _ / 2, J -= E / 2 / Math.tan(ce)), F = this._window.document.createElementNS("http://www.w3.org/2000/svg", "linearGradient"), F.setAttribute("id", v), F.setAttribute("gradientUnits", "userSpaceOnUse"), F.setAttribute("x1", String(Math.round(oe))), F.setAttribute("y1", String(Math.round(Z))), F.setAttribute("x2", String(Math.round(J))), F.setAttribute("y2", String(Math.round(Q))); } m.colorStops.forEach(({ offset: ce, color: D }) => { const oe = this._window.document.createElementNS("http://www.w3.org/2000/svg", "stop"); - oe.setAttribute("offset", 100 * ce + "%"), oe.setAttribute("stop-color", D), B.appendChild(oe); - }), I.setAttribute("fill", `url('#${v}')`), this._defs.appendChild(B); + oe.setAttribute("offset", 100 * ce + "%"), oe.setAttribute("stop-color", D), F.appendChild(oe); + }), I.setAttribute("fill", `url('#${v}')`), this._defs.appendChild(F); } else f && I.setAttribute("fill", f); this._element.appendChild(I); } } L.instanceCount = 0; - const $ = L, F = "canvas", K = {}; - for (let S = 0; S <= 40; S++) K[S] = S; - const H = { type: F, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: K[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: !0, hideBackgroundDots: !0, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: !0 }, backgroundOptions: { round: 0, color: "#fff" } }; + const $ = L, B = "canvas", H = {}; + for (let S = 0; S <= 40; S++) H[S] = S; + const W = { type: B, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: H[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: !0, hideBackgroundDots: !0, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: !0 }, backgroundOptions: { round: 0, color: "#fff" } }; function V(S) { const m = Object.assign({}, S); if (!m.colorStops || !m.colorStops.length) throw "Field 'colorStops' is required in gradient"; @@ -39465,8 +39465,8 @@ var N9 = { exports: {} }; const m = Object.assign({}, S); return m.width = Number(m.width), m.height = Number(m.height), m.margin = Number(m.margin), m.imageOptions = Object.assign(Object.assign({}, m.imageOptions), { hideBackgroundDots: !!m.imageOptions.hideBackgroundDots, imageSize: Number(m.imageOptions.imageSize), margin: Number(m.imageOptions.margin) }), m.margin > Math.min(m.width, m.height) && (m.margin = Math.min(m.width, m.height)), m.dotsOptions = Object.assign({}, m.dotsOptions), m.dotsOptions.gradient && (m.dotsOptions.gradient = V(m.dotsOptions.gradient)), m.cornersSquareOptions && (m.cornersSquareOptions = Object.assign({}, m.cornersSquareOptions), m.cornersSquareOptions.gradient && (m.cornersSquareOptions.gradient = V(m.cornersSquareOptions.gradient))), m.cornersDotOptions && (m.cornersDotOptions = Object.assign({}, m.cornersDotOptions), m.cornersDotOptions.gradient && (m.cornersDotOptions.gradient = V(m.cornersDotOptions.gradient))), m.backgroundOptions && (m.backgroundOptions = Object.assign({}, m.backgroundOptions), m.backgroundOptions.gradient && (m.backgroundOptions.gradient = V(m.backgroundOptions.gradient))), m; } - var R = i(873), W = i.n(R); - function pe(S) { + var R = i(873), K = i.n(R); + function ge(S) { if (!S) throw new Error("Extension must be defined"); S[0] === "." && (S = S.substring(1)); const m = { bmp: "image/bmp", gif: "image/gif", ico: "image/vnd.microsoft.icon", jpeg: "image/jpeg", jpg: "image/jpeg", png: "image/png", svg: "image/svg+xml", tif: "image/tiff", tiff: "image/tiff", webp: "image/webp", pdf: "application/pdf" }[S.toLowerCase()]; @@ -39475,7 +39475,7 @@ var N9 = { exports: {} }; } class Ee { constructor(m) { - m != null && m.jsdom ? this._window = new m.jsdom("", { resources: "usable" }).window : this._window = window, this._options = m ? te(a(H, m)) : H, this.update(); + m != null && m.jsdom ? this._window = new m.jsdom("", { resources: "usable" }).window : this._window = window, this._options = m ? te(a(W, m)) : W, this.update(); } static _clearContainer(m) { m && (m.innerHTML = ""); @@ -39491,19 +39491,19 @@ var N9 = { exports: {} }; _setupCanvas() { var m, f; this._qr && (!((m = this._options.nodeCanvas) === null || m === void 0) && m.createCanvas ? (this._nodeCanvas = this._options.nodeCanvas.createCanvas(this._options.width, this._options.height), this._nodeCanvas.width = this._options.width, this._nodeCanvas.height = this._options.height) : (this._domCanvas = document.createElement("canvas"), this._domCanvas.width = this._options.width, this._domCanvas.height = this._options.height), this._setupSvg(), this._canvasDrawingPromise = (f = this._svgDrawingPromise) === null || f === void 0 ? void 0 : f.then(() => { - var p; + var g; if (!this._svg) return; - const b = this._svg, x = new this._window.XMLSerializer().serializeToString(b), _ = btoa(x), E = `data:${pe("svg")};base64,${_}`; - if (!((p = this._options.nodeCanvas) === null || p === void 0) && p.loadImage) return this._options.nodeCanvas.loadImage(E).then((v) => { - var P, I; - v.width = this._options.width, v.height = this._options.height, (I = (P = this._nodeCanvas) === null || P === void 0 ? void 0 : P.getContext("2d")) === null || I === void 0 || I.drawImage(v, 0, 0); + const b = this._svg, x = new this._window.XMLSerializer().serializeToString(b), _ = btoa(x), E = `data:${ge("svg")};base64,${_}`; + if (!((g = this._options.nodeCanvas) === null || g === void 0) && g.loadImage) return this._options.nodeCanvas.loadImage(E).then((v) => { + var M, I; + v.width = this._options.width, v.height = this._options.height, (I = (M = this._nodeCanvas) === null || M === void 0 ? void 0 : M.getContext("2d")) === null || I === void 0 || I.drawImage(v, 0, 0); }); { const v = new this._window.Image(); - return new Promise((P) => { + return new Promise((M) => { v.onload = () => { - var I, B; - (B = (I = this._domCanvas) === null || I === void 0 ? void 0 : I.getContext("2d")) === null || B === void 0 || B.drawImage(v, 0, 0), P(); + var I, F; + (F = (I = this._domCanvas) === null || I === void 0 ? void 0 : I.getContext("2d")) === null || F === void 0 || F.drawImage(v, 0, 0), M(); }, v.src = E; }); } @@ -39514,7 +39514,7 @@ var N9 = { exports: {} }; return m.toLowerCase() === "svg" ? (this._svg && this._svgDrawingPromise || this._setupSvg(), await this._svgDrawingPromise, this._svg) : ((this._domCanvas || this._nodeCanvas) && this._canvasDrawingPromise || this._setupCanvas(), await this._canvasDrawingPromise, this._domCanvas || this._nodeCanvas); } update(m) { - Ee._clearContainer(this._container), this._options = m ? te(a(this._options, m)) : this._options, this._options.data && (this._qr = W()(this._options.qrOptions.typeNumber, this._options.qrOptions.errorCorrectionLevel), this._qr.addData(this._options.data, this._options.qrOptions.mode || function(f) { + Ee._clearContainer(this._container), this._options = m ? te(a(this._options, m)) : this._options, this._options.data && (this._qr = K()(this._options.qrOptions.typeNumber, this._options.qrOptions.errorCorrectionLevel), this._qr.addData(this._options.data, this._options.qrOptions.mode || function(f) { switch (!0) { case /^[0-9]*$/.test(f): return "Numeric"; @@ -39523,12 +39523,12 @@ var N9 = { exports: {} }; default: return "Byte"; } - }(this._options.data)), this._qr.make(), this._options.type === F ? this._setupCanvas() : this._setupSvg(), this.append(this._container)); + }(this._options.data)), this._qr.make(), this._options.type === B ? this._setupCanvas() : this._setupSvg(), this.append(this._container)); } append(m) { if (m) { if (typeof m.appendChild != "function") throw "Container should be a single DOM node"; - this._options.type === F ? this._domCanvas && m.appendChild(this._domCanvas) : this._svg && m.appendChild(this._svg), this._container = m; + this._options.type === B ? this._domCanvas && m.appendChild(this._domCanvas) : this._svg && m.appendChild(this._svg), this._container = m; } } applyExtension(m) { @@ -39540,44 +39540,44 @@ var N9 = { exports: {} }; } async getRawData(m = "png") { if (!this._qr) throw "QR code is empty"; - const f = await this._getElement(m), p = pe(m); + const f = await this._getElement(m), g = ge(m); if (!f) return null; if (m.toLowerCase() === "svg") { const b = `\r ${new this._window.XMLSerializer().serializeToString(f)}`; - return typeof Blob > "u" || this._options.jsdom ? Buffer.from(b) : new Blob([b], { type: p }); + return typeof Blob > "u" || this._options.jsdom ? Buffer.from(b) : new Blob([b], { type: g }); } return new Promise((b) => { const x = f; - if ("toBuffer" in x) if (p === "image/png") b(x.toBuffer(p)); - else if (p === "image/jpeg") b(x.toBuffer(p)); + if ("toBuffer" in x) if (g === "image/png") b(x.toBuffer(g)); + else if (g === "image/jpeg") b(x.toBuffer(g)); else { - if (p !== "application/pdf") throw Error("Unsupported extension"); - b(x.toBuffer(p)); + if (g !== "application/pdf") throw Error("Unsupported extension"); + b(x.toBuffer(g)); } - else "toBlob" in x && x.toBlob(b, p, 1); + else "toBlob" in x && x.toBlob(b, g, 1); }); } async download(m) { if (!this._qr) throw "QR code is empty"; if (typeof Blob > "u") throw "Cannot download in Node.js, call getRawData instead."; - let f = "png", p = "qr"; - typeof m == "string" ? (f = m, console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")) : typeof m == "object" && m !== null && (m.name && (p = m.name), m.extension && (f = m.extension)); + let f = "png", g = "qr"; + typeof m == "string" ? (f = m, console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")) : typeof m == "object" && m !== null && (m.name && (g = m.name), m.extension && (f = m.extension)); const b = await this._getElement(f); if (b) if (f.toLowerCase() === "svg") { let x = new XMLSerializer().serializeToString(b); x = `\r -` + x, u(`data:${pe(f)};charset=utf-8,${encodeURIComponent(x)}`, `${p}.svg`); - } else u(b.toDataURL(pe(f)), `${p}.${f}`); +` + x, u(`data:${ge(f)};charset=utf-8,${encodeURIComponent(x)}`, `${g}.svg`); + } else u(b.toDataURL(ge(f)), `${g}.${f}`); } } const Y = Ee; })(), s.default; })()); -})(N9); -var Nne = N9.exports; -const L9 = /* @__PURE__ */ ts(Nne); -class ia extends yt { +})($9); +var Une = $9.exports; +const B9 = /* @__PURE__ */ rs(Une); +class aa extends yt { constructor(e) { const { docsPath: r, field: n, metaMessages: i } = e; super(`Invalid Sign-In with Ethereum message field "${n}".`, { @@ -39587,10 +39587,10 @@ class ia extends yt { }); } } -function f5(t) { +function h5(t) { if (/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t) || /%[^0-9a-f]/i.test(t) || /%[0-9a-f](:?[^0-9a-f]|$)/i.test(t)) return !1; - const e = Lne(t), r = e[1], n = e[2], i = e[3], s = e[4], o = e[5]; + const e = qne(t), r = e[1], n = e[2], i = e[3], s = e[4], o = e[5]; if (!(r != null && r.length && i.length >= 0)) return !1; if (n != null && n.length) { @@ -39603,14 +39603,14 @@ function f5(t) { let a = ""; return a += `${r}:`, n != null && n.length && (a += `//${n}`), a += i, s != null && s.length && (a += `?${s}`), o != null && o.length && (a += `#${o}`), a; } -function Lne(t) { +function qne(t) { return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/); } -function k9(t) { - const { chainId: e, domain: r, expirationTime: n, issuedAt: i = /* @__PURE__ */ new Date(), nonce: s, notBefore: o, requestId: a, resources: u, scheme: l, uri: d, version: g } = t; +function F9(t) { + const { chainId: e, domain: r, expirationTime: n, issuedAt: i = /* @__PURE__ */ new Date(), nonce: s, notBefore: o, requestId: a, resources: u, scheme: l, uri: d, version: p } = t; { if (e !== Math.floor(e)) - throw new ia({ + throw new aa({ field: "chainId", metaMessages: [ "- Chain ID must be a EIP-155 chain ID.", @@ -39619,8 +39619,8 @@ function k9(t) { `Provided value: ${e}` ] }); - if (!(kne.test(r) || $ne.test(r) || Fne.test(r))) - throw new ia({ + if (!(zne.test(r) || Wne.test(r) || Hne.test(r))) + throw new aa({ field: "domain", metaMessages: [ "- Domain must be an RFC 3986 authority.", @@ -39629,8 +39629,8 @@ function k9(t) { `Provided value: ${r}` ] }); - if (!Bne.test(s)) - throw new ia({ + if (!Kne.test(s)) + throw new aa({ field: "nonce", metaMessages: [ "- Nonce must be at least 8 characters.", @@ -39639,8 +39639,8 @@ function k9(t) { `Provided value: ${s}` ] }); - if (!f5(d)) - throw new ia({ + if (!h5(d)) + throw new aa({ field: "uri", metaMessages: [ "- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.", @@ -39649,17 +39649,17 @@ function k9(t) { `Provided value: ${d}` ] }); - if (g !== "1") - throw new ia({ + if (p !== "1") + throw new aa({ field: "version", metaMessages: [ "- Version must be '1'.", "", - `Provided value: ${g}` + `Provided value: ${p}` ] }); - if (l && !Une.test(l)) - throw new ia({ + if (l && !Vne.test(l)) + throw new aa({ field: "scheme", metaMessages: [ "- Scheme must be an RFC 3986 URI scheme.", @@ -39671,7 +39671,7 @@ function k9(t) { const $ = t.statement; if ($ != null && $.includes(` `)) - throw new ia({ + throw new aa({ field: "statement", metaMessages: [ "- Statement must not include '\\n'.", @@ -39680,13 +39680,13 @@ function k9(t) { ] }); } - const w = Ev(t.address), A = l ? `${l}://${r}` : r, M = t.statement ? `${t.statement} + const w = Ev(t.address), A = l ? `${l}://${r}` : r, P = t.statement ? `${t.statement} ` : "", N = `${A} wants you to sign in with your Ethereum account: ${w} -${M}`; +${P}`; let L = `URI: ${d} -Version: ${g} +Version: ${p} Chain ID: ${e} Nonce: ${s} Issued At: ${i.toISOString()}`; @@ -39696,34 +39696,34 @@ Not Before: ${o.toISOString()}`), a && (L += ` Request ID: ${a}`), u) { let $ = ` Resources:`; - for (const F of u) { - if (!f5(F)) - throw new ia({ + for (const B of u) { + if (!h5(B)) + throw new aa({ field: "resources", metaMessages: [ "- Every resource must be a RFC 3986 URI.", "- See https://www.rfc-editor.org/rfc/rfc3986", "", - `Provided value: ${F}` + `Provided value: ${B}` ] }); $ += ` -- ${F}`; +- ${B}`; } L += $; } return `${N} ${L}`; } -const kne = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/, $ne = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/, Fne = /^localhost(:[0-9]{1,5})?$/, Bne = /^[a-zA-Z0-9]{8,}$/, Une = /^([a-zA-Z][a-zA-Z0-9+-.]*)$/, $9 = "7a4434fefbcc9af474fb5c995e47d286", jne = { - projectId: $9, +const zne = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/, Wne = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/, Hne = /^localhost(:[0-9]{1,5})?$/, Kne = /^[a-zA-Z0-9]{8,}$/, Vne = /^([a-zA-Z][a-zA-Z0-9+-.]*)$/, j9 = "7a4434fefbcc9af474fb5c995e47d286", Gne = { + projectId: j9, metadata: { name: "codatta", description: "codatta", url: "https://codatta.io/", icons: ["https://avatars.githubusercontent.com/u/171659315"] } -}, qne = { +}, Yne = { namespaces: { eip155: { methods: [ @@ -39736,15 +39736,15 @@ const kne = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0- chains: ["eip155:1"], events: ["chainChanged", "accountsChanged", "disconnect"], rpcMap: { - 1: `https://rpc.walletconnect.com?chainId=eip155:1&projectId=${$9}` + 1: `https://rpc.walletconnect.com?chainId=eip155:1&projectId=${j9}` } } }, skipPairing: !1 }; -function zne(t, e) { +function Jne(t, e) { const r = window.location.host, n = window.location.href; - return k9({ + return F9({ address: t, chainId: 1, domain: r, @@ -39753,13 +39753,13 @@ function zne(t, e) { version: "1" }); } -function Hne(t) { - var pe, Ee, Y; - const e = bi(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = fr(""), [a, u] = fr(!1), [l, d] = fr(""), [g, w] = fr("scan"), A = bi(), [M, N] = fr((pe = r.config) == null ? void 0 : pe.image), [L, $] = fr(!1), { saveLastUsedWallet: F } = gp(); - async function K(S) { - var f, p, b, x; +function U9(t) { + var ge, Ee, Y; + const e = oi(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Gt(""), [a, u] = Gt(!1), [l, d] = Gt(""), [p, w] = Gt("scan"), A = oi(), [P, N] = Gt((ge = r.config) == null ? void 0 : ge.image), [L, $] = Gt(!1), { saveLastUsedWallet: B } = mp(); + async function H(S) { + var f, g, b, x; u(!0); - const m = await CG.init(jne); + const m = await FG.init(Gne); m.session && await m.disconnect(); try { if (w("scan"), m.on("display_uri", (ce) => { @@ -39768,27 +39768,27 @@ function Hne(t) { console.log(ce); }), m.on("session_update", (ce) => { console.log("session_update", ce); - }), !await m.connect(qne)) throw new Error("Walletconnect init failed"); - const E = new ml(m); - N(((f = E.config) == null ? void 0 : f.image) || ((p = S.config) == null ? void 0 : p.image)); - const v = await E.getAddress(), P = await ya.getNonce({ account_type: "block_chain" }); - console.log("get nonce", P); - const I = zne(v, P); + }), !await m.connect(Yne)) throw new Error("Walletconnect init failed"); + const E = new vl(m); + N(((f = E.config) == null ? void 0 : f.image) || ((g = S.config) == null ? void 0 : g.image)); + const v = await E.getAddress(), M = await qo.getNonce({ account_type: "block_chain" }); + console.log("get nonce", M); + const I = Jne(v, M); w("sign"); - const B = await E.signMessage(I, v); + const F = await E.signMessage(I, v); w("waiting"), await i(E, { message: I, - nonce: P, - signature: B, + nonce: M, + signature: F, address: v, wallet_name: ((b = E.config) == null ? void 0 : b.name) || ((x = S.config) == null ? void 0 : x.name) || "" - }), F(E); + }), B(E); } catch (_) { console.log("err", _), d(_.details || _.message); } } - function H() { - A.current = new L9({ + function W() { + A.current = new B9({ width: 264, height: 264, margin: 0, @@ -39812,89 +39812,89 @@ function Hne(t) { data: S }); } - Xn(() => { + Dn(() => { s && V(s); - }, [s]), Xn(() => { - K(r); - }, [r]), Xn(() => { - H(); + }, [s]), Dn(() => { + H(r); + }, [r]), Dn(() => { + W(); }, []); function te() { - d(""), V(""), K(r); + d(""), V(""), H(r); } function R() { $(!0), navigator.clipboard.writeText(s), setTimeout(() => { $(!1); }, 2500); } - function W() { + function K() { var f; const S = (f = r.config) == null ? void 0 : f.desktop_link; if (!S) return; const m = `${S}?uri=${encodeURIComponent(s)}`; window.open(m, "_blank"); } - return /* @__PURE__ */ me.jsxs("div", { children: [ - /* @__PURE__ */ me.jsx("div", { className: "xc-text-center", children: /* @__PURE__ */ me.jsxs("div", { className: "xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1", children: [ - /* @__PURE__ */ me.jsx("div", { className: "xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center", ref: e }), - /* @__PURE__ */ me.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: a ? /* @__PURE__ */ me.jsx(gc, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ me.jsx("img", { className: "xc-h-10 xc-w-10", src: M }) }) + return /* @__PURE__ */ fe.jsxs("div", { children: [ + /* @__PURE__ */ fe.jsx("div", { className: "xc-text-center", children: /* @__PURE__ */ fe.jsxs("div", { className: "xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1", children: [ + /* @__PURE__ */ fe.jsx("div", { className: "xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center", ref: e }), + /* @__PURE__ */ fe.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: a ? /* @__PURE__ */ fe.jsx(_a, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ fe.jsx("img", { className: "xc-h-10 xc-w-10", src: P }) }) ] }) }), - /* @__PURE__ */ me.jsxs("div", { className: "xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3", children: [ - /* @__PURE__ */ me.jsx( + /* @__PURE__ */ fe.jsxs("div", { className: "xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3", children: [ + /* @__PURE__ */ fe.jsx( "button", { disabled: !s, onClick: R, className: "xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent", - children: L ? /* @__PURE__ */ me.jsxs(me.Fragment, { children: [ + children: L ? /* @__PURE__ */ fe.jsxs(fe.Fragment, { children: [ " ", - /* @__PURE__ */ me.jsx(rZ, {}), + /* @__PURE__ */ fe.jsx(hZ, {}), " Copied!" - ] }) : /* @__PURE__ */ me.jsxs(me.Fragment, { children: [ - /* @__PURE__ */ me.jsx(sZ, {}), + ] }) : /* @__PURE__ */ fe.jsxs(fe.Fragment, { children: [ + /* @__PURE__ */ fe.jsx(gZ, {}), "Copy QR URL" ] }) } ), - ((Ee = r.config) == null ? void 0 : Ee.getWallet) && /* @__PURE__ */ me.jsxs( + ((Ee = r.config) == null ? void 0 : Ee.getWallet) && /* @__PURE__ */ fe.jsxs( "button", { className: "xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black", onClick: n, children: [ - /* @__PURE__ */ me.jsx(nZ, {}), + /* @__PURE__ */ fe.jsx(dZ, {}), "Get Extension" ] } ), - ((Y = r.config) == null ? void 0 : Y.desktop_link) && /* @__PURE__ */ me.jsxs( + ((Y = r.config) == null ? void 0 : Y.desktop_link) && /* @__PURE__ */ fe.jsxs( "button", { disabled: !s, className: "xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black", - onClick: W, + onClick: K, children: [ - /* @__PURE__ */ me.jsx(HS, {}), + /* @__PURE__ */ fe.jsx(KS, {}), "Desktop" ] } ) ] }), - /* @__PURE__ */ me.jsx("div", { className: "xc-text-center", children: l ? /* @__PURE__ */ me.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ - /* @__PURE__ */ me.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: l }), - /* @__PURE__ */ me.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: te, children: "Retry" }) - ] }) : /* @__PURE__ */ me.jsxs(me.Fragment, { children: [ - g === "scan" && /* @__PURE__ */ me.jsx("p", { children: "Scan this QR code from your mobile wallet or phone's camera to connect." }), - g === "connect" && /* @__PURE__ */ me.jsx("p", { children: "Click connect in your wallet app" }), - g === "sign" && /* @__PURE__ */ me.jsx("p", { children: "Click sign-in in your wallet to confirm you own this wallet." }), - g === "waiting" && /* @__PURE__ */ me.jsx("div", { className: "xc-text-center", children: /* @__PURE__ */ me.jsx(gc, { className: "xc-inline-block xc-animate-spin" }) }) + /* @__PURE__ */ fe.jsx("div", { className: "xc-text-center", children: l ? /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ + /* @__PURE__ */ fe.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: l }), + /* @__PURE__ */ fe.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: te, children: "Retry" }) + ] }) : /* @__PURE__ */ fe.jsxs(fe.Fragment, { children: [ + p === "scan" && /* @__PURE__ */ fe.jsx("p", { children: "Scan this QR code from your mobile wallet or phone's camera to connect." }), + p === "connect" && /* @__PURE__ */ fe.jsx("p", { children: "Click connect in your wallet app" }), + p === "sign" && /* @__PURE__ */ fe.jsx("p", { children: "Click sign-in in your wallet to confirm you own this wallet." }), + p === "waiting" && /* @__PURE__ */ fe.jsx("div", { className: "xc-text-center", children: /* @__PURE__ */ fe.jsx(_a, { className: "xc-inline-block xc-animate-spin" }) }) ] }) }) ] }); } -const Wne = "Accept connection request in the wallet", Kne = "Accept sign-in request in your wallet"; -function Vne(t, e) { +const Xne = "Accept connection request in the wallet", Zne = "Accept sign-in request in your wallet"; +function Qne(t, e) { const r = window.location.host, n = window.location.href; - return k9({ + return F9({ address: t, chainId: 1, domain: r, @@ -39903,68 +39903,68 @@ function Vne(t, e) { version: "1" }); } -function Gne(t) { - var g; - const [e, r] = fr(), { wallet: n, onSignFinish: i } = t, s = bi(), [o, a] = fr("connect"), { saveLastUsedWallet: u } = gp(); +function q9(t) { + var p; + const [e, r] = Gt(), { wallet: n, onSignFinish: i } = t, s = oi(), [o, a] = Gt("connect"), { saveLastUsedWallet: u } = mp(); async function l(w) { var A; try { a("connect"); - const M = await n.connect(); - if (!M || M.length === 0) + const P = await n.connect(); + if (!P || P.length === 0) throw new Error("Wallet connect error"); - const N = Ev(M[0]), L = Vne(N, w); + const N = Ev(P[0]), L = Qne(N, w); a("sign"); const $ = await n.signMessage(L, N); if (!$ || $.length === 0) throw new Error("user sign error"); a("waiting"), await i(n, { address: N, signature: $, message: L, nonce: w, wallet_name: ((A = n.config) == null ? void 0 : A.name) || "" }), u(n); - } catch (M) { - console.log(M.details), r(M.details || M.message); + } catch (P) { + console.log(P.details), r(P.details || P.message); } } async function d() { try { r(""); - const w = await ya.getNonce({ account_type: "block_chain" }); + const w = await qo.getNonce({ account_type: "block_chain" }); s.current = w, l(s.current); } catch (w) { console.log(w.details), r(w.message); } } - return Xn(() => { + return Dn(() => { d(); - }, []), /* @__PURE__ */ me.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4", children: [ - /* @__PURE__ */ me.jsx("img", { className: "xc-rounded-md xc-h-16 xc-w-16", src: (g = n.config) == null ? void 0 : g.image, alt: "" }), - e && /* @__PURE__ */ me.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ - /* @__PURE__ */ me.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: e }), - /* @__PURE__ */ me.jsx("div", { className: "xc-flex xc-gap-2", children: /* @__PURE__ */ me.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: d, children: "Retry" }) }) + }, []), /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4", children: [ + /* @__PURE__ */ fe.jsx("img", { className: "xc-rounded-md xc-h-16 xc-w-16", src: (p = n.config) == null ? void 0 : p.image, alt: "" }), + e && /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ + /* @__PURE__ */ fe.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: e }), + /* @__PURE__ */ fe.jsx("div", { className: "xc-flex xc-gap-2", children: /* @__PURE__ */ fe.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: d, children: "Retry" }) }) ] }), - !e && /* @__PURE__ */ me.jsxs(me.Fragment, { children: [ - o === "connect" && /* @__PURE__ */ me.jsx("span", { className: "xc-text-center", children: Wne }), - o === "sign" && /* @__PURE__ */ me.jsx("span", { className: "xc-text-center", children: Kne }), - o === "waiting" && /* @__PURE__ */ me.jsx("span", { className: "xc-text-center", children: /* @__PURE__ */ me.jsx(gc, { className: "xc-animate-spin" }) }) + !e && /* @__PURE__ */ fe.jsxs(fe.Fragment, { children: [ + o === "connect" && /* @__PURE__ */ fe.jsx("span", { className: "xc-text-center", children: Xne }), + o === "sign" && /* @__PURE__ */ fe.jsx("span", { className: "xc-text-center", children: Zne }), + o === "waiting" && /* @__PURE__ */ fe.jsx("span", { className: "xc-text-center", children: /* @__PURE__ */ fe.jsx(_a, { className: "xc-animate-spin" }) }) ] }) ] }); } -const Vc = "https://static.codatta.io/codatta-connect/wallet-icons.svg", Yne = "https://itunes.apple.com/app/", Jne = "https://play.google.com/store/apps/details?id=", Xne = "https://chromewebstore.google.com/detail/", Zne = "https://chromewebstore.google.com/detail/", Qne = "https://addons.mozilla.org/en-US/firefox/addon/", eie = "https://microsoftedge.microsoft.com/addons/detail/"; -function Gc(t) { +const Gc = "https://static.codatta.io/codatta-connect/wallet-icons.svg", eie = "https://itunes.apple.com/app/", tie = "https://play.google.com/store/apps/details?id=", rie = "https://chromewebstore.google.com/detail/", nie = "https://chromewebstore.google.com/detail/", iie = "https://addons.mozilla.org/en-US/firefox/addon/", sie = "https://microsoftedge.microsoft.com/addons/detail/"; +function Yc(t) { const { icon: e, title: r, link: n } = t; - return /* @__PURE__ */ me.jsxs( + return /* @__PURE__ */ fe.jsxs( "a", { href: n, target: "_blank", className: "xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5", children: [ - /* @__PURE__ */ me.jsx("img", { className: "xc-rounded-1 xc-h-6 xc-w-6", src: e, alt: "" }), + /* @__PURE__ */ fe.jsx("img", { className: "xc-rounded-1 xc-h-6 xc-w-6", src: e, alt: "" }), r, - /* @__PURE__ */ me.jsx(zS, { className: "xc-ml-auto xc-text-gray-400" }) + /* @__PURE__ */ fe.jsx(HS, { className: "xc-ml-auto xc-text-gray-400" }) ] } ); } -function tie(t) { +function oie(t) { const e = { appStoreLink: "", playStoreLink: "", @@ -39973,76 +39973,76 @@ function tie(t) { firefoxStoreLink: "", edgeStoreLink: "" }; - return t != null && t.app_store_id && (e.appStoreLink = `${Yne}${t.app_store_id}`), t != null && t.play_store_id && (e.playStoreLink = `${Jne}${t.play_store_id}`), t != null && t.chrome_store_id && (e.chromeStoreLink = `${Xne}${t.chrome_store_id}`), t != null && t.brave_store_id && (e.braveStoreLink = `${Zne}${t.brave_store_id}`), t != null && t.firefox_addon_id && (e.firefoxStoreLink = `${Qne}${t.firefox_addon_id}`), t != null && t.edge_addon_id && (e.edgeStoreLink = `${eie}${t.edge_addon_id}`), e; + return t != null && t.app_store_id && (e.appStoreLink = `${eie}${t.app_store_id}`), t != null && t.play_store_id && (e.playStoreLink = `${tie}${t.play_store_id}`), t != null && t.chrome_store_id && (e.chromeStoreLink = `${rie}${t.chrome_store_id}`), t != null && t.brave_store_id && (e.braveStoreLink = `${nie}${t.brave_store_id}`), t != null && t.firefox_addon_id && (e.firefoxStoreLink = `${iie}${t.firefox_addon_id}`), t != null && t.edge_addon_id && (e.edgeStoreLink = `${sie}${t.edge_addon_id}`), e; } -function rie(t) { +function z9(t) { var i, s, o; - const { wallet: e } = t, r = (i = e.config) == null ? void 0 : i.getWallet, n = tie(r); - return /* @__PURE__ */ me.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ - /* @__PURE__ */ me.jsx("img", { className: "xc-rounded-md xc-mb-2 xc-h-12 xc-w-12", src: (s = e.config) == null ? void 0 : s.image, alt: "" }), - /* @__PURE__ */ me.jsxs("p", { className: "xc-text-lg xc-font-bold", children: [ + const { wallet: e } = t, r = (i = e.config) == null ? void 0 : i.getWallet, n = oie(r); + return /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ + /* @__PURE__ */ fe.jsx("img", { className: "xc-rounded-md xc-mb-2 xc-h-12 xc-w-12", src: (s = e.config) == null ? void 0 : s.image, alt: "" }), + /* @__PURE__ */ fe.jsxs("p", { className: "xc-text-lg xc-font-bold", children: [ "Install ", (o = e.config) == null ? void 0 : o.name, " to connect" ] }), - /* @__PURE__ */ me.jsx("p", { className: "xc-mb-6 xc-text-sm xc-text-gray-500", children: "Select from your preferred options below:" }), - /* @__PURE__ */ me.jsxs("div", { className: "xc-grid xc-w-full xc-grid-cols-1 xc-gap-3", children: [ - (r == null ? void 0 : r.chrome_store_id) && /* @__PURE__ */ me.jsx( - Gc, + /* @__PURE__ */ fe.jsx("p", { className: "xc-mb-6 xc-text-sm xc-text-gray-500", children: "Select from your preferred options below:" }), + /* @__PURE__ */ fe.jsxs("div", { className: "xc-grid xc-w-full xc-grid-cols-1 xc-gap-3", children: [ + (r == null ? void 0 : r.chrome_store_id) && /* @__PURE__ */ fe.jsx( + Yc, { link: n.chromeStoreLink, - icon: `${Vc}#chrome`, + icon: `${Gc}#chrome`, title: "Google Play Store" } ), - (r == null ? void 0 : r.app_store_id) && /* @__PURE__ */ me.jsx( - Gc, + (r == null ? void 0 : r.app_store_id) && /* @__PURE__ */ fe.jsx( + Yc, { link: n.appStoreLink, - icon: `${Vc}#apple-dark`, + icon: `${Gc}#apple-dark`, title: "Apple App Store" } ), - (r == null ? void 0 : r.play_store_id) && /* @__PURE__ */ me.jsx( - Gc, + (r == null ? void 0 : r.play_store_id) && /* @__PURE__ */ fe.jsx( + Yc, { link: n.playStoreLink, - icon: `${Vc}#android`, + icon: `${Gc}#android`, title: "Google Play Store" } ), - (r == null ? void 0 : r.edge_addon_id) && /* @__PURE__ */ me.jsx( - Gc, + (r == null ? void 0 : r.edge_addon_id) && /* @__PURE__ */ fe.jsx( + Yc, { link: n.edgeStoreLink, - icon: `${Vc}#edge`, + icon: `${Gc}#edge`, title: "Microsoft Edge" } ), - (r == null ? void 0 : r.brave_store_id) && /* @__PURE__ */ me.jsx( - Gc, + (r == null ? void 0 : r.brave_store_id) && /* @__PURE__ */ fe.jsx( + Yc, { link: n.braveStoreLink, - icon: `${Vc}#brave`, + icon: `${Gc}#brave`, title: "Brave extension" } ), - (r == null ? void 0 : r.firefox_addon_id) && /* @__PURE__ */ me.jsx( - Gc, + (r == null ? void 0 : r.firefox_addon_id) && /* @__PURE__ */ fe.jsx( + Yc, { link: n.firefoxStoreLink, - icon: `${Vc}#firefox`, + icon: `${Gc}#firefox`, title: "Mozilla Firefox" } ) ] }) ] }); } -function nie(t) { - const { wallet: e } = t, [r, n] = fr(e.installed ? "connect" : "qr"), i = cy(); +function aie(t) { + const { wallet: e } = t, [r, n] = Gt(e.installed ? "connect" : "qr"), i = fy(); async function s(o, a) { var l; - const u = await ya.walletLogin({ + const u = await qo.walletLogin({ account_type: "block_chain", account_enum: "C", connector: "codatta_wallet", @@ -40061,33 +40061,33 @@ function nie(t) { }); await t.onLogin(u.data); } - return /* @__PURE__ */ me.jsxs(Ac, { children: [ - /* @__PURE__ */ me.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ me.jsx(uh, { title: "Connect wallet", onBack: t.onBack }) }), - r === "qr" && /* @__PURE__ */ me.jsx( - Hne, + return /* @__PURE__ */ fe.jsxs(so, { children: [ + /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ fe.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), + r === "qr" && /* @__PURE__ */ fe.jsx( + U9, { wallet: e, onGetExtension: () => n("get-extension"), onSignFinish: s } ), - r === "connect" && /* @__PURE__ */ me.jsx( - Gne, + r === "connect" && /* @__PURE__ */ fe.jsx( + q9, { onShowQrCode: () => n("qr"), wallet: e, onSignFinish: s } ), - r === "get-extension" && /* @__PURE__ */ me.jsx(rie, { wallet: e }) + r === "get-extension" && /* @__PURE__ */ fe.jsx(z9, { wallet: e }) ] }); } -function iie(t) { - const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ me.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: e.imageUrl }), i = e.name || ""; - return /* @__PURE__ */ me.jsx(oy, { icon: n, title: i, onClick: () => r(e) }); +function cie(t) { + const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ fe.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: e.imageUrl }), i = e.name || ""; + return /* @__PURE__ */ fe.jsx(oy, { icon: n, title: i, onClick: () => r(e) }); } -function sie(t) { - const { connector: e } = t, [r, n] = fr(), [i, s] = fr([]), o = Oi(() => r ? i.filter((d) => d.name.toLowerCase().includes(r.toLowerCase())) : i, [r, i]); +function W9(t) { + const { connector: e } = t, [r, n] = Gt(), [i, s] = Gt([]), o = Ni(() => r ? i.filter((d) => d.name.toLowerCase().includes(r.toLowerCase())) : i, [r, i]); function a(d) { n(d.target.value); } @@ -40095,22 +40095,22 @@ function sie(t) { const d = await e.getWallets(); s(d), console.log(d); } - Xn(() => { + Dn(() => { u(); }, []); function l(d) { t.onSelect(d); } - return /* @__PURE__ */ me.jsxs(Ac, { children: [ - /* @__PURE__ */ me.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ me.jsx(uh, { title: "Select wallet", onBack: t.onBack }) }), - /* @__PURE__ */ me.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ - /* @__PURE__ */ me.jsx(WS, { className: "xc-shrink-0 xc-opacity-50" }), - /* @__PURE__ */ me.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: a }) + return /* @__PURE__ */ fe.jsxs(so, { children: [ + /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ fe.jsx(Pc, { title: "Select wallet", onBack: t.onBack }) }), + /* @__PURE__ */ fe.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ + /* @__PURE__ */ fe.jsx(GS, { className: "xc-shrink-0 xc-opacity-50" }), + /* @__PURE__ */ fe.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: a }) ] }), - /* @__PURE__ */ me.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: o == null ? void 0 : o.map((d) => /* @__PURE__ */ me.jsx(iie, { wallet: d, onClick: l }, d.name)) }) + /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: o == null ? void 0 : o.map((d) => /* @__PURE__ */ fe.jsx(cie, { wallet: d, onClick: l }, d.name)) }) ] }); } -var F9 = { exports: {} }; +var H9 = { exports: {} }; (function(t) { (function(e, r) { t.exports ? t.exports = r() : (e.nacl || (e.nacl = {}), e.nacl.util = r()); @@ -40148,103 +40148,103 @@ var F9 = { exports: {} }; return o; }), e; }); -})(F9); -var oie = F9.exports; -const Rl = /* @__PURE__ */ ts(oie); -var B9 = { exports: {} }; +})(H9); +var uie = H9.exports; +const Dl = /* @__PURE__ */ rs(uie); +var K9 = { exports: {} }; (function(t) { (function(e) { var r = function(k) { - var j, z = new Float64Array(16); - if (k) for (j = 0; j < k.length; j++) z[j] = k[j]; + var U, z = new Float64Array(16); + if (k) for (U = 0; U < k.length; U++) z[U] = k[U]; return z; }, n = function() { throw new Error("no PRNG"); }, i = new Uint8Array(16), s = new Uint8Array(32); s[0] = 9; - var o = r(), a = r([1]), u = r([56129, 1]), l = r([30883, 4953, 19914, 30187, 55467, 16705, 2637, 112, 59544, 30585, 16505, 36039, 65139, 11119, 27886, 20995]), d = r([61785, 9906, 39828, 60374, 45398, 33411, 5274, 224, 53552, 61171, 33010, 6542, 64743, 22239, 55772, 9222]), g = r([54554, 36645, 11616, 51542, 42930, 38181, 51040, 26924, 56412, 64982, 57905, 49316, 21502, 52590, 14035, 8553]), w = r([26200, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214]), A = r([41136, 18958, 6951, 50414, 58488, 44335, 6150, 12099, 55207, 15867, 153, 11085, 57099, 20417, 9344, 11139]); - function M(k, j, z, C) { - k[j] = z >> 24 & 255, k[j + 1] = z >> 16 & 255, k[j + 2] = z >> 8 & 255, k[j + 3] = z & 255, k[j + 4] = C >> 24 & 255, k[j + 5] = C >> 16 & 255, k[j + 6] = C >> 8 & 255, k[j + 7] = C & 255; + var o = r(), a = r([1]), u = r([56129, 1]), l = r([30883, 4953, 19914, 30187, 55467, 16705, 2637, 112, 59544, 30585, 16505, 36039, 65139, 11119, 27886, 20995]), d = r([61785, 9906, 39828, 60374, 45398, 33411, 5274, 224, 53552, 61171, 33010, 6542, 64743, 22239, 55772, 9222]), p = r([54554, 36645, 11616, 51542, 42930, 38181, 51040, 26924, 56412, 64982, 57905, 49316, 21502, 52590, 14035, 8553]), w = r([26200, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214]), A = r([41136, 18958, 6951, 50414, 58488, 44335, 6150, 12099, 55207, 15867, 153, 11085, 57099, 20417, 9344, 11139]); + function P(k, U, z, C) { + k[U] = z >> 24 & 255, k[U + 1] = z >> 16 & 255, k[U + 2] = z >> 8 & 255, k[U + 3] = z & 255, k[U + 4] = C >> 24 & 255, k[U + 5] = C >> 16 & 255, k[U + 6] = C >> 8 & 255, k[U + 7] = C & 255; } - function N(k, j, z, C, G) { - var U, se = 0; - for (U = 0; U < G; U++) se |= k[j + U] ^ z[C + U]; + function N(k, U, z, C, G) { + var j, se = 0; + for (j = 0; j < G; j++) se |= k[U + j] ^ z[C + j]; return (1 & se - 1 >>> 8) - 1; } - function L(k, j, z, C) { - return N(k, j, z, C, 16); + function L(k, U, z, C) { + return N(k, U, z, C, 16); } - function $(k, j, z, C) { - return N(k, j, z, C, 32); + function $(k, U, z, C) { + return N(k, U, z, C, 32); } - function F(k, j, z, C) { - for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, U = z[0] & 255 | (z[1] & 255) << 8 | (z[2] & 255) << 16 | (z[3] & 255) << 24, se = z[4] & 255 | (z[5] & 255) << 8 | (z[6] & 255) << 16 | (z[7] & 255) << 24, he = z[8] & 255 | (z[9] & 255) << 8 | (z[10] & 255) << 16 | (z[11] & 255) << 24, xe = z[12] & 255 | (z[13] & 255) << 8 | (z[14] & 255) << 16 | (z[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = j[0] & 255 | (j[1] & 255) << 8 | (j[2] & 255) << 16 | (j[3] & 255) << 24, nt = j[4] & 255 | (j[5] & 255) << 8 | (j[6] & 255) << 16 | (j[7] & 255) << 24, Ue = j[8] & 255 | (j[9] & 255) << 8 | (j[10] & 255) << 16 | (j[11] & 255) << 24, pt = j[12] & 255 | (j[13] & 255) << 8 | (j[14] & 255) << 16 | (j[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = z[16] & 255 | (z[17] & 255) << 8 | (z[18] & 255) << 16 | (z[19] & 255) << 24, St = z[20] & 255 | (z[21] & 255) << 8 | (z[22] & 255) << 16 | (z[23] & 255) << 24, Tt = z[24] & 255 | (z[25] & 255) << 8 | (z[26] & 255) << 16 | (z[27] & 255) << 24, At = z[28] & 255 | (z[29] & 255) << 8 | (z[30] & 255) << 16 | (z[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = U, st = se, bt = he, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = Ue, Be = pt, je = it, Je = et, Lt = St, zt = Tt, Xt = At, Ht = _t, le, tr = 0; tr < 20; tr += 2) - le = ht + Lt | 0, ut ^= le << 7 | le >>> 25, le = ut + ht | 0, Ve ^= le << 9 | le >>> 23, le = Ve + ut | 0, Lt ^= le << 13 | le >>> 19, le = Lt + Ve | 0, ht ^= le << 18 | le >>> 14, le = ot + xt | 0, Be ^= le << 7 | le >>> 25, le = Be + ot | 0, zt ^= le << 9 | le >>> 23, le = zt + Be | 0, xt ^= le << 13 | le >>> 19, le = xt + zt | 0, ot ^= le << 18 | le >>> 14, le = je + Se | 0, Xt ^= le << 7 | le >>> 25, le = Xt + je | 0, st ^= le << 9 | le >>> 23, le = st + Xt | 0, Se ^= le << 13 | le >>> 19, le = Se + st | 0, je ^= le << 18 | le >>> 14, le = Ht + Je | 0, bt ^= le << 7 | le >>> 25, le = bt + Ht | 0, Ae ^= le << 9 | le >>> 23, le = Ae + bt | 0, Je ^= le << 13 | le >>> 19, le = Je + Ae | 0, Ht ^= le << 18 | le >>> 14, le = ht + bt | 0, xt ^= le << 7 | le >>> 25, le = xt + ht | 0, st ^= le << 9 | le >>> 23, le = st + xt | 0, bt ^= le << 13 | le >>> 19, le = bt + st | 0, ht ^= le << 18 | le >>> 14, le = ot + ut | 0, Se ^= le << 7 | le >>> 25, le = Se + ot | 0, Ae ^= le << 9 | le >>> 23, le = Ae + Se | 0, ut ^= le << 13 | le >>> 19, le = ut + Ae | 0, ot ^= le << 18 | le >>> 14, le = je + Be | 0, Je ^= le << 7 | le >>> 25, le = Je + je | 0, Ve ^= le << 9 | le >>> 23, le = Ve + Je | 0, Be ^= le << 13 | le >>> 19, le = Be + Ve | 0, je ^= le << 18 | le >>> 14, le = Ht + Xt | 0, Lt ^= le << 7 | le >>> 25, le = Lt + Ht | 0, zt ^= le << 9 | le >>> 23, le = zt + Lt | 0, Xt ^= le << 13 | le >>> 19, le = Xt + zt | 0, Ht ^= le << 18 | le >>> 14; - ht = ht + G | 0, xt = xt + U | 0, st = st + se | 0, bt = bt + he | 0, ut = ut + xe | 0, ot = ot + Te | 0, Se = Se + Re | 0, Ae = Ae + nt | 0, Ve = Ve + Ue | 0, Be = Be + pt | 0, je = je + it | 0, Je = Je + et | 0, Lt = Lt + St | 0, zt = zt + Tt | 0, Xt = Xt + At | 0, Ht = Ht + _t | 0, k[0] = ht >>> 0 & 255, k[1] = ht >>> 8 & 255, k[2] = ht >>> 16 & 255, k[3] = ht >>> 24 & 255, k[4] = xt >>> 0 & 255, k[5] = xt >>> 8 & 255, k[6] = xt >>> 16 & 255, k[7] = xt >>> 24 & 255, k[8] = st >>> 0 & 255, k[9] = st >>> 8 & 255, k[10] = st >>> 16 & 255, k[11] = st >>> 24 & 255, k[12] = bt >>> 0 & 255, k[13] = bt >>> 8 & 255, k[14] = bt >>> 16 & 255, k[15] = bt >>> 24 & 255, k[16] = ut >>> 0 & 255, k[17] = ut >>> 8 & 255, k[18] = ut >>> 16 & 255, k[19] = ut >>> 24 & 255, k[20] = ot >>> 0 & 255, k[21] = ot >>> 8 & 255, k[22] = ot >>> 16 & 255, k[23] = ot >>> 24 & 255, k[24] = Se >>> 0 & 255, k[25] = Se >>> 8 & 255, k[26] = Se >>> 16 & 255, k[27] = Se >>> 24 & 255, k[28] = Ae >>> 0 & 255, k[29] = Ae >>> 8 & 255, k[30] = Ae >>> 16 & 255, k[31] = Ae >>> 24 & 255, k[32] = Ve >>> 0 & 255, k[33] = Ve >>> 8 & 255, k[34] = Ve >>> 16 & 255, k[35] = Ve >>> 24 & 255, k[36] = Be >>> 0 & 255, k[37] = Be >>> 8 & 255, k[38] = Be >>> 16 & 255, k[39] = Be >>> 24 & 255, k[40] = je >>> 0 & 255, k[41] = je >>> 8 & 255, k[42] = je >>> 16 & 255, k[43] = je >>> 24 & 255, k[44] = Je >>> 0 & 255, k[45] = Je >>> 8 & 255, k[46] = Je >>> 16 & 255, k[47] = Je >>> 24 & 255, k[48] = Lt >>> 0 & 255, k[49] = Lt >>> 8 & 255, k[50] = Lt >>> 16 & 255, k[51] = Lt >>> 24 & 255, k[52] = zt >>> 0 & 255, k[53] = zt >>> 8 & 255, k[54] = zt >>> 16 & 255, k[55] = zt >>> 24 & 255, k[56] = Xt >>> 0 & 255, k[57] = Xt >>> 8 & 255, k[58] = Xt >>> 16 & 255, k[59] = Xt >>> 24 & 255, k[60] = Ht >>> 0 & 255, k[61] = Ht >>> 8 & 255, k[62] = Ht >>> 16 & 255, k[63] = Ht >>> 24 & 255; + function B(k, U, z, C) { + for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = z[0] & 255 | (z[1] & 255) << 8 | (z[2] & 255) << 16 | (z[3] & 255) << 24, se = z[4] & 255 | (z[5] & 255) << 8 | (z[6] & 255) << 16 | (z[7] & 255) << 24, de = z[8] & 255 | (z[9] & 255) << 8 | (z[10] & 255) << 16 | (z[11] & 255) << 24, xe = z[12] & 255 | (z[13] & 255) << 8 | (z[14] & 255) << 16 | (z[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = U[0] & 255 | (U[1] & 255) << 8 | (U[2] & 255) << 16 | (U[3] & 255) << 24, nt = U[4] & 255 | (U[5] & 255) << 8 | (U[6] & 255) << 16 | (U[7] & 255) << 24, je = U[8] & 255 | (U[9] & 255) << 8 | (U[10] & 255) << 16 | (U[11] & 255) << 24, pt = U[12] & 255 | (U[13] & 255) << 8 | (U[14] & 255) << 16 | (U[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = z[16] & 255 | (z[17] & 255) << 8 | (z[18] & 255) << 16 | (z[19] & 255) << 24, St = z[20] & 255 | (z[21] & 255) << 8 | (z[22] & 255) << 16 | (z[23] & 255) << 24, Tt = z[24] & 255 | (z[25] & 255) << 8 | (z[26] & 255) << 16 | (z[27] & 255) << 24, At = z[28] & 255 | (z[29] & 255) << 8 | (z[30] & 255) << 16 | (z[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = de, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, he, rr = 0; rr < 20; rr += 2) + he = ht + Lt | 0, ut ^= he << 7 | he >>> 25, he = ut + ht | 0, Ve ^= he << 9 | he >>> 23, he = Ve + ut | 0, Lt ^= he << 13 | he >>> 19, he = Lt + Ve | 0, ht ^= he << 18 | he >>> 14, he = ot + xt | 0, Fe ^= he << 7 | he >>> 25, he = Fe + ot | 0, zt ^= he << 9 | he >>> 23, he = zt + Fe | 0, xt ^= he << 13 | he >>> 19, he = xt + zt | 0, ot ^= he << 18 | he >>> 14, he = Ue + Se | 0, Zt ^= he << 7 | he >>> 25, he = Zt + Ue | 0, st ^= he << 9 | he >>> 23, he = st + Zt | 0, Se ^= he << 13 | he >>> 19, he = Se + st | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Je | 0, bt ^= he << 7 | he >>> 25, he = bt + Wt | 0, Ae ^= he << 9 | he >>> 23, he = Ae + bt | 0, Je ^= he << 13 | he >>> 19, he = Je + Ae | 0, Wt ^= he << 18 | he >>> 14, he = ht + bt | 0, xt ^= he << 7 | he >>> 25, he = xt + ht | 0, st ^= he << 9 | he >>> 23, he = st + xt | 0, bt ^= he << 13 | he >>> 19, he = bt + st | 0, ht ^= he << 18 | he >>> 14, he = ot + ut | 0, Se ^= he << 7 | he >>> 25, he = Se + ot | 0, Ae ^= he << 9 | he >>> 23, he = Ae + Se | 0, ut ^= he << 13 | he >>> 19, he = ut + Ae | 0, ot ^= he << 18 | he >>> 14, he = Ue + Fe | 0, Je ^= he << 7 | he >>> 25, he = Je + Ue | 0, Ve ^= he << 9 | he >>> 23, he = Ve + Je | 0, Fe ^= he << 13 | he >>> 19, he = Fe + Ve | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Zt | 0, Lt ^= he << 7 | he >>> 25, he = Lt + Wt | 0, zt ^= he << 9 | he >>> 23, he = zt + Lt | 0, Zt ^= he << 13 | he >>> 19, he = Zt + zt | 0, Wt ^= he << 18 | he >>> 14; + ht = ht + G | 0, xt = xt + j | 0, st = st + se | 0, bt = bt + de | 0, ut = ut + xe | 0, ot = ot + Te | 0, Se = Se + Re | 0, Ae = Ae + nt | 0, Ve = Ve + je | 0, Fe = Fe + pt | 0, Ue = Ue + it | 0, Je = Je + et | 0, Lt = Lt + St | 0, zt = zt + Tt | 0, Zt = Zt + At | 0, Wt = Wt + _t | 0, k[0] = ht >>> 0 & 255, k[1] = ht >>> 8 & 255, k[2] = ht >>> 16 & 255, k[3] = ht >>> 24 & 255, k[4] = xt >>> 0 & 255, k[5] = xt >>> 8 & 255, k[6] = xt >>> 16 & 255, k[7] = xt >>> 24 & 255, k[8] = st >>> 0 & 255, k[9] = st >>> 8 & 255, k[10] = st >>> 16 & 255, k[11] = st >>> 24 & 255, k[12] = bt >>> 0 & 255, k[13] = bt >>> 8 & 255, k[14] = bt >>> 16 & 255, k[15] = bt >>> 24 & 255, k[16] = ut >>> 0 & 255, k[17] = ut >>> 8 & 255, k[18] = ut >>> 16 & 255, k[19] = ut >>> 24 & 255, k[20] = ot >>> 0 & 255, k[21] = ot >>> 8 & 255, k[22] = ot >>> 16 & 255, k[23] = ot >>> 24 & 255, k[24] = Se >>> 0 & 255, k[25] = Se >>> 8 & 255, k[26] = Se >>> 16 & 255, k[27] = Se >>> 24 & 255, k[28] = Ae >>> 0 & 255, k[29] = Ae >>> 8 & 255, k[30] = Ae >>> 16 & 255, k[31] = Ae >>> 24 & 255, k[32] = Ve >>> 0 & 255, k[33] = Ve >>> 8 & 255, k[34] = Ve >>> 16 & 255, k[35] = Ve >>> 24 & 255, k[36] = Fe >>> 0 & 255, k[37] = Fe >>> 8 & 255, k[38] = Fe >>> 16 & 255, k[39] = Fe >>> 24 & 255, k[40] = Ue >>> 0 & 255, k[41] = Ue >>> 8 & 255, k[42] = Ue >>> 16 & 255, k[43] = Ue >>> 24 & 255, k[44] = Je >>> 0 & 255, k[45] = Je >>> 8 & 255, k[46] = Je >>> 16 & 255, k[47] = Je >>> 24 & 255, k[48] = Lt >>> 0 & 255, k[49] = Lt >>> 8 & 255, k[50] = Lt >>> 16 & 255, k[51] = Lt >>> 24 & 255, k[52] = zt >>> 0 & 255, k[53] = zt >>> 8 & 255, k[54] = zt >>> 16 & 255, k[55] = zt >>> 24 & 255, k[56] = Zt >>> 0 & 255, k[57] = Zt >>> 8 & 255, k[58] = Zt >>> 16 & 255, k[59] = Zt >>> 24 & 255, k[60] = Wt >>> 0 & 255, k[61] = Wt >>> 8 & 255, k[62] = Wt >>> 16 & 255, k[63] = Wt >>> 24 & 255; } - function K(k, j, z, C) { - for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, U = z[0] & 255 | (z[1] & 255) << 8 | (z[2] & 255) << 16 | (z[3] & 255) << 24, se = z[4] & 255 | (z[5] & 255) << 8 | (z[6] & 255) << 16 | (z[7] & 255) << 24, he = z[8] & 255 | (z[9] & 255) << 8 | (z[10] & 255) << 16 | (z[11] & 255) << 24, xe = z[12] & 255 | (z[13] & 255) << 8 | (z[14] & 255) << 16 | (z[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = j[0] & 255 | (j[1] & 255) << 8 | (j[2] & 255) << 16 | (j[3] & 255) << 24, nt = j[4] & 255 | (j[5] & 255) << 8 | (j[6] & 255) << 16 | (j[7] & 255) << 24, Ue = j[8] & 255 | (j[9] & 255) << 8 | (j[10] & 255) << 16 | (j[11] & 255) << 24, pt = j[12] & 255 | (j[13] & 255) << 8 | (j[14] & 255) << 16 | (j[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = z[16] & 255 | (z[17] & 255) << 8 | (z[18] & 255) << 16 | (z[19] & 255) << 24, St = z[20] & 255 | (z[21] & 255) << 8 | (z[22] & 255) << 16 | (z[23] & 255) << 24, Tt = z[24] & 255 | (z[25] & 255) << 8 | (z[26] & 255) << 16 | (z[27] & 255) << 24, At = z[28] & 255 | (z[29] & 255) << 8 | (z[30] & 255) << 16 | (z[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = U, st = se, bt = he, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = Ue, Be = pt, je = it, Je = et, Lt = St, zt = Tt, Xt = At, Ht = _t, le, tr = 0; tr < 20; tr += 2) - le = ht + Lt | 0, ut ^= le << 7 | le >>> 25, le = ut + ht | 0, Ve ^= le << 9 | le >>> 23, le = Ve + ut | 0, Lt ^= le << 13 | le >>> 19, le = Lt + Ve | 0, ht ^= le << 18 | le >>> 14, le = ot + xt | 0, Be ^= le << 7 | le >>> 25, le = Be + ot | 0, zt ^= le << 9 | le >>> 23, le = zt + Be | 0, xt ^= le << 13 | le >>> 19, le = xt + zt | 0, ot ^= le << 18 | le >>> 14, le = je + Se | 0, Xt ^= le << 7 | le >>> 25, le = Xt + je | 0, st ^= le << 9 | le >>> 23, le = st + Xt | 0, Se ^= le << 13 | le >>> 19, le = Se + st | 0, je ^= le << 18 | le >>> 14, le = Ht + Je | 0, bt ^= le << 7 | le >>> 25, le = bt + Ht | 0, Ae ^= le << 9 | le >>> 23, le = Ae + bt | 0, Je ^= le << 13 | le >>> 19, le = Je + Ae | 0, Ht ^= le << 18 | le >>> 14, le = ht + bt | 0, xt ^= le << 7 | le >>> 25, le = xt + ht | 0, st ^= le << 9 | le >>> 23, le = st + xt | 0, bt ^= le << 13 | le >>> 19, le = bt + st | 0, ht ^= le << 18 | le >>> 14, le = ot + ut | 0, Se ^= le << 7 | le >>> 25, le = Se + ot | 0, Ae ^= le << 9 | le >>> 23, le = Ae + Se | 0, ut ^= le << 13 | le >>> 19, le = ut + Ae | 0, ot ^= le << 18 | le >>> 14, le = je + Be | 0, Je ^= le << 7 | le >>> 25, le = Je + je | 0, Ve ^= le << 9 | le >>> 23, le = Ve + Je | 0, Be ^= le << 13 | le >>> 19, le = Be + Ve | 0, je ^= le << 18 | le >>> 14, le = Ht + Xt | 0, Lt ^= le << 7 | le >>> 25, le = Lt + Ht | 0, zt ^= le << 9 | le >>> 23, le = zt + Lt | 0, Xt ^= le << 13 | le >>> 19, le = Xt + zt | 0, Ht ^= le << 18 | le >>> 14; - k[0] = ht >>> 0 & 255, k[1] = ht >>> 8 & 255, k[2] = ht >>> 16 & 255, k[3] = ht >>> 24 & 255, k[4] = ot >>> 0 & 255, k[5] = ot >>> 8 & 255, k[6] = ot >>> 16 & 255, k[7] = ot >>> 24 & 255, k[8] = je >>> 0 & 255, k[9] = je >>> 8 & 255, k[10] = je >>> 16 & 255, k[11] = je >>> 24 & 255, k[12] = Ht >>> 0 & 255, k[13] = Ht >>> 8 & 255, k[14] = Ht >>> 16 & 255, k[15] = Ht >>> 24 & 255, k[16] = Se >>> 0 & 255, k[17] = Se >>> 8 & 255, k[18] = Se >>> 16 & 255, k[19] = Se >>> 24 & 255, k[20] = Ae >>> 0 & 255, k[21] = Ae >>> 8 & 255, k[22] = Ae >>> 16 & 255, k[23] = Ae >>> 24 & 255, k[24] = Ve >>> 0 & 255, k[25] = Ve >>> 8 & 255, k[26] = Ve >>> 16 & 255, k[27] = Ve >>> 24 & 255, k[28] = Be >>> 0 & 255, k[29] = Be >>> 8 & 255, k[30] = Be >>> 16 & 255, k[31] = Be >>> 24 & 255; + function H(k, U, z, C) { + for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = z[0] & 255 | (z[1] & 255) << 8 | (z[2] & 255) << 16 | (z[3] & 255) << 24, se = z[4] & 255 | (z[5] & 255) << 8 | (z[6] & 255) << 16 | (z[7] & 255) << 24, de = z[8] & 255 | (z[9] & 255) << 8 | (z[10] & 255) << 16 | (z[11] & 255) << 24, xe = z[12] & 255 | (z[13] & 255) << 8 | (z[14] & 255) << 16 | (z[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = U[0] & 255 | (U[1] & 255) << 8 | (U[2] & 255) << 16 | (U[3] & 255) << 24, nt = U[4] & 255 | (U[5] & 255) << 8 | (U[6] & 255) << 16 | (U[7] & 255) << 24, je = U[8] & 255 | (U[9] & 255) << 8 | (U[10] & 255) << 16 | (U[11] & 255) << 24, pt = U[12] & 255 | (U[13] & 255) << 8 | (U[14] & 255) << 16 | (U[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = z[16] & 255 | (z[17] & 255) << 8 | (z[18] & 255) << 16 | (z[19] & 255) << 24, St = z[20] & 255 | (z[21] & 255) << 8 | (z[22] & 255) << 16 | (z[23] & 255) << 24, Tt = z[24] & 255 | (z[25] & 255) << 8 | (z[26] & 255) << 16 | (z[27] & 255) << 24, At = z[28] & 255 | (z[29] & 255) << 8 | (z[30] & 255) << 16 | (z[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = de, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, he, rr = 0; rr < 20; rr += 2) + he = ht + Lt | 0, ut ^= he << 7 | he >>> 25, he = ut + ht | 0, Ve ^= he << 9 | he >>> 23, he = Ve + ut | 0, Lt ^= he << 13 | he >>> 19, he = Lt + Ve | 0, ht ^= he << 18 | he >>> 14, he = ot + xt | 0, Fe ^= he << 7 | he >>> 25, he = Fe + ot | 0, zt ^= he << 9 | he >>> 23, he = zt + Fe | 0, xt ^= he << 13 | he >>> 19, he = xt + zt | 0, ot ^= he << 18 | he >>> 14, he = Ue + Se | 0, Zt ^= he << 7 | he >>> 25, he = Zt + Ue | 0, st ^= he << 9 | he >>> 23, he = st + Zt | 0, Se ^= he << 13 | he >>> 19, he = Se + st | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Je | 0, bt ^= he << 7 | he >>> 25, he = bt + Wt | 0, Ae ^= he << 9 | he >>> 23, he = Ae + bt | 0, Je ^= he << 13 | he >>> 19, he = Je + Ae | 0, Wt ^= he << 18 | he >>> 14, he = ht + bt | 0, xt ^= he << 7 | he >>> 25, he = xt + ht | 0, st ^= he << 9 | he >>> 23, he = st + xt | 0, bt ^= he << 13 | he >>> 19, he = bt + st | 0, ht ^= he << 18 | he >>> 14, he = ot + ut | 0, Se ^= he << 7 | he >>> 25, he = Se + ot | 0, Ae ^= he << 9 | he >>> 23, he = Ae + Se | 0, ut ^= he << 13 | he >>> 19, he = ut + Ae | 0, ot ^= he << 18 | he >>> 14, he = Ue + Fe | 0, Je ^= he << 7 | he >>> 25, he = Je + Ue | 0, Ve ^= he << 9 | he >>> 23, he = Ve + Je | 0, Fe ^= he << 13 | he >>> 19, he = Fe + Ve | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Zt | 0, Lt ^= he << 7 | he >>> 25, he = Lt + Wt | 0, zt ^= he << 9 | he >>> 23, he = zt + Lt | 0, Zt ^= he << 13 | he >>> 19, he = Zt + zt | 0, Wt ^= he << 18 | he >>> 14; + k[0] = ht >>> 0 & 255, k[1] = ht >>> 8 & 255, k[2] = ht >>> 16 & 255, k[3] = ht >>> 24 & 255, k[4] = ot >>> 0 & 255, k[5] = ot >>> 8 & 255, k[6] = ot >>> 16 & 255, k[7] = ot >>> 24 & 255, k[8] = Ue >>> 0 & 255, k[9] = Ue >>> 8 & 255, k[10] = Ue >>> 16 & 255, k[11] = Ue >>> 24 & 255, k[12] = Wt >>> 0 & 255, k[13] = Wt >>> 8 & 255, k[14] = Wt >>> 16 & 255, k[15] = Wt >>> 24 & 255, k[16] = Se >>> 0 & 255, k[17] = Se >>> 8 & 255, k[18] = Se >>> 16 & 255, k[19] = Se >>> 24 & 255, k[20] = Ae >>> 0 & 255, k[21] = Ae >>> 8 & 255, k[22] = Ae >>> 16 & 255, k[23] = Ae >>> 24 & 255, k[24] = Ve >>> 0 & 255, k[25] = Ve >>> 8 & 255, k[26] = Ve >>> 16 & 255, k[27] = Ve >>> 24 & 255, k[28] = Fe >>> 0 & 255, k[29] = Fe >>> 8 & 255, k[30] = Fe >>> 16 & 255, k[31] = Fe >>> 24 & 255; } - function H(k, j, z, C) { - F(k, j, z, C); + function W(k, U, z, C) { + B(k, U, z, C); } - function V(k, j, z, C) { - K(k, j, z, C); + function V(k, U, z, C) { + H(k, U, z, C); } var te = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); - function R(k, j, z, C, G, U, se) { - var he = new Uint8Array(16), xe = new Uint8Array(64), Te, Re; - for (Re = 0; Re < 16; Re++) he[Re] = 0; - for (Re = 0; Re < 8; Re++) he[Re] = U[Re]; + function R(k, U, z, C, G, j, se) { + var de = new Uint8Array(16), xe = new Uint8Array(64), Te, Re; + for (Re = 0; Re < 16; Re++) de[Re] = 0; + for (Re = 0; Re < 8; Re++) de[Re] = j[Re]; for (; G >= 64; ) { - for (H(xe, he, se, te), Re = 0; Re < 64; Re++) k[j + Re] = z[C + Re] ^ xe[Re]; + for (W(xe, de, se, te), Re = 0; Re < 64; Re++) k[U + Re] = z[C + Re] ^ xe[Re]; for (Te = 1, Re = 8; Re < 16; Re++) - Te = Te + (he[Re] & 255) | 0, he[Re] = Te & 255, Te >>>= 8; - G -= 64, j += 64, C += 64; + Te = Te + (de[Re] & 255) | 0, de[Re] = Te & 255, Te >>>= 8; + G -= 64, U += 64, C += 64; } if (G > 0) - for (H(xe, he, se, te), Re = 0; Re < G; Re++) k[j + Re] = z[C + Re] ^ xe[Re]; + for (W(xe, de, se, te), Re = 0; Re < G; Re++) k[U + Re] = z[C + Re] ^ xe[Re]; return 0; } - function W(k, j, z, C, G) { - var U = new Uint8Array(16), se = new Uint8Array(64), he, xe; - for (xe = 0; xe < 16; xe++) U[xe] = 0; - for (xe = 0; xe < 8; xe++) U[xe] = C[xe]; + function K(k, U, z, C, G) { + var j = new Uint8Array(16), se = new Uint8Array(64), de, xe; + for (xe = 0; xe < 16; xe++) j[xe] = 0; + for (xe = 0; xe < 8; xe++) j[xe] = C[xe]; for (; z >= 64; ) { - for (H(se, U, G, te), xe = 0; xe < 64; xe++) k[j + xe] = se[xe]; - for (he = 1, xe = 8; xe < 16; xe++) - he = he + (U[xe] & 255) | 0, U[xe] = he & 255, he >>>= 8; - z -= 64, j += 64; + for (W(se, j, G, te), xe = 0; xe < 64; xe++) k[U + xe] = se[xe]; + for (de = 1, xe = 8; xe < 16; xe++) + de = de + (j[xe] & 255) | 0, j[xe] = de & 255, de >>>= 8; + z -= 64, U += 64; } if (z > 0) - for (H(se, U, G, te), xe = 0; xe < z; xe++) k[j + xe] = se[xe]; + for (W(se, j, G, te), xe = 0; xe < z; xe++) k[U + xe] = se[xe]; return 0; } - function pe(k, j, z, C, G) { - var U = new Uint8Array(32); - V(U, C, G, te); - for (var se = new Uint8Array(8), he = 0; he < 8; he++) se[he] = C[he + 16]; - return W(k, j, z, se, U); + function ge(k, U, z, C, G) { + var j = new Uint8Array(32); + V(j, C, G, te); + for (var se = new Uint8Array(8), de = 0; de < 8; de++) se[de] = C[de + 16]; + return K(k, U, z, se, j); } - function Ee(k, j, z, C, G, U, se) { - var he = new Uint8Array(32); - V(he, U, se, te); - for (var xe = new Uint8Array(8), Te = 0; Te < 8; Te++) xe[Te] = U[Te + 16]; - return R(k, j, z, C, G, xe, he); + function Ee(k, U, z, C, G, j, se) { + var de = new Uint8Array(32); + V(de, j, se, te); + for (var xe = new Uint8Array(8), Te = 0; Te < 8; Te++) xe[Te] = j[Te + 16]; + return R(k, U, z, C, G, xe, de); } var Y = function(k) { this.buffer = new Uint8Array(16), this.r = new Uint16Array(10), this.h = new Uint16Array(10), this.pad = new Uint16Array(8), this.leftover = 0, this.fin = 0; - var j, z, C, G, U, se, he, xe; - j = k[0] & 255 | (k[1] & 255) << 8, this.r[0] = j & 8191, z = k[2] & 255 | (k[3] & 255) << 8, this.r[1] = (j >>> 13 | z << 3) & 8191, C = k[4] & 255 | (k[5] & 255) << 8, this.r[2] = (z >>> 10 | C << 6) & 7939, G = k[6] & 255 | (k[7] & 255) << 8, this.r[3] = (C >>> 7 | G << 9) & 8191, U = k[8] & 255 | (k[9] & 255) << 8, this.r[4] = (G >>> 4 | U << 12) & 255, this.r[5] = U >>> 1 & 8190, se = k[10] & 255 | (k[11] & 255) << 8, this.r[6] = (U >>> 14 | se << 2) & 8191, he = k[12] & 255 | (k[13] & 255) << 8, this.r[7] = (se >>> 11 | he << 5) & 8065, xe = k[14] & 255 | (k[15] & 255) << 8, this.r[8] = (he >>> 8 | xe << 8) & 8191, this.r[9] = xe >>> 5 & 127, this.pad[0] = k[16] & 255 | (k[17] & 255) << 8, this.pad[1] = k[18] & 255 | (k[19] & 255) << 8, this.pad[2] = k[20] & 255 | (k[21] & 255) << 8, this.pad[3] = k[22] & 255 | (k[23] & 255) << 8, this.pad[4] = k[24] & 255 | (k[25] & 255) << 8, this.pad[5] = k[26] & 255 | (k[27] & 255) << 8, this.pad[6] = k[28] & 255 | (k[29] & 255) << 8, this.pad[7] = k[30] & 255 | (k[31] & 255) << 8; + var U, z, C, G, j, se, de, xe; + U = k[0] & 255 | (k[1] & 255) << 8, this.r[0] = U & 8191, z = k[2] & 255 | (k[3] & 255) << 8, this.r[1] = (U >>> 13 | z << 3) & 8191, C = k[4] & 255 | (k[5] & 255) << 8, this.r[2] = (z >>> 10 | C << 6) & 7939, G = k[6] & 255 | (k[7] & 255) << 8, this.r[3] = (C >>> 7 | G << 9) & 8191, j = k[8] & 255 | (k[9] & 255) << 8, this.r[4] = (G >>> 4 | j << 12) & 255, this.r[5] = j >>> 1 & 8190, se = k[10] & 255 | (k[11] & 255) << 8, this.r[6] = (j >>> 14 | se << 2) & 8191, de = k[12] & 255 | (k[13] & 255) << 8, this.r[7] = (se >>> 11 | de << 5) & 8065, xe = k[14] & 255 | (k[15] & 255) << 8, this.r[8] = (de >>> 8 | xe << 8) & 8191, this.r[9] = xe >>> 5 & 127, this.pad[0] = k[16] & 255 | (k[17] & 255) << 8, this.pad[1] = k[18] & 255 | (k[19] & 255) << 8, this.pad[2] = k[20] & 255 | (k[21] & 255) << 8, this.pad[3] = k[22] & 255 | (k[23] & 255) << 8, this.pad[4] = k[24] & 255 | (k[25] & 255) << 8, this.pad[5] = k[26] & 255 | (k[27] & 255) << 8, this.pad[6] = k[28] & 255 | (k[29] & 255) << 8, this.pad[7] = k[30] & 255 | (k[31] & 255) << 8; }; - Y.prototype.blocks = function(k, j, z) { - for (var C = this.fin ? 0 : 2048, G, U, se, he, xe, Te, Re, nt, Ue, pt, it, et, St, Tt, At, _t, ht, xt, st, bt = this.h[0], ut = this.h[1], ot = this.h[2], Se = this.h[3], Ae = this.h[4], Ve = this.h[5], Be = this.h[6], je = this.h[7], Je = this.h[8], Lt = this.h[9], zt = this.r[0], Xt = this.r[1], Ht = this.r[2], le = this.r[3], tr = this.r[4], dr = this.r[5], pr = this.r[6], Zt = this.r[7], gr = this.r[8], lr = this.r[9]; z >= 16; ) - G = k[j + 0] & 255 | (k[j + 1] & 255) << 8, bt += G & 8191, U = k[j + 2] & 255 | (k[j + 3] & 255) << 8, ut += (G >>> 13 | U << 3) & 8191, se = k[j + 4] & 255 | (k[j + 5] & 255) << 8, ot += (U >>> 10 | se << 6) & 8191, he = k[j + 6] & 255 | (k[j + 7] & 255) << 8, Se += (se >>> 7 | he << 9) & 8191, xe = k[j + 8] & 255 | (k[j + 9] & 255) << 8, Ae += (he >>> 4 | xe << 12) & 8191, Ve += xe >>> 1 & 8191, Te = k[j + 10] & 255 | (k[j + 11] & 255) << 8, Be += (xe >>> 14 | Te << 2) & 8191, Re = k[j + 12] & 255 | (k[j + 13] & 255) << 8, je += (Te >>> 11 | Re << 5) & 8191, nt = k[j + 14] & 255 | (k[j + 15] & 255) << 8, Je += (Re >>> 8 | nt << 8) & 8191, Lt += nt >>> 5 | C, Ue = 0, pt = Ue, pt += bt * zt, pt += ut * (5 * lr), pt += ot * (5 * gr), pt += Se * (5 * Zt), pt += Ae * (5 * pr), Ue = pt >>> 13, pt &= 8191, pt += Ve * (5 * dr), pt += Be * (5 * tr), pt += je * (5 * le), pt += Je * (5 * Ht), pt += Lt * (5 * Xt), Ue += pt >>> 13, pt &= 8191, it = Ue, it += bt * Xt, it += ut * zt, it += ot * (5 * lr), it += Se * (5 * gr), it += Ae * (5 * Zt), Ue = it >>> 13, it &= 8191, it += Ve * (5 * pr), it += Be * (5 * dr), it += je * (5 * tr), it += Je * (5 * le), it += Lt * (5 * Ht), Ue += it >>> 13, it &= 8191, et = Ue, et += bt * Ht, et += ut * Xt, et += ot * zt, et += Se * (5 * lr), et += Ae * (5 * gr), Ue = et >>> 13, et &= 8191, et += Ve * (5 * Zt), et += Be * (5 * pr), et += je * (5 * dr), et += Je * (5 * tr), et += Lt * (5 * le), Ue += et >>> 13, et &= 8191, St = Ue, St += bt * le, St += ut * Ht, St += ot * Xt, St += Se * zt, St += Ae * (5 * lr), Ue = St >>> 13, St &= 8191, St += Ve * (5 * gr), St += Be * (5 * Zt), St += je * (5 * pr), St += Je * (5 * dr), St += Lt * (5 * tr), Ue += St >>> 13, St &= 8191, Tt = Ue, Tt += bt * tr, Tt += ut * le, Tt += ot * Ht, Tt += Se * Xt, Tt += Ae * zt, Ue = Tt >>> 13, Tt &= 8191, Tt += Ve * (5 * lr), Tt += Be * (5 * gr), Tt += je * (5 * Zt), Tt += Je * (5 * pr), Tt += Lt * (5 * dr), Ue += Tt >>> 13, Tt &= 8191, At = Ue, At += bt * dr, At += ut * tr, At += ot * le, At += Se * Ht, At += Ae * Xt, Ue = At >>> 13, At &= 8191, At += Ve * zt, At += Be * (5 * lr), At += je * (5 * gr), At += Je * (5 * Zt), At += Lt * (5 * pr), Ue += At >>> 13, At &= 8191, _t = Ue, _t += bt * pr, _t += ut * dr, _t += ot * tr, _t += Se * le, _t += Ae * Ht, Ue = _t >>> 13, _t &= 8191, _t += Ve * Xt, _t += Be * zt, _t += je * (5 * lr), _t += Je * (5 * gr), _t += Lt * (5 * Zt), Ue += _t >>> 13, _t &= 8191, ht = Ue, ht += bt * Zt, ht += ut * pr, ht += ot * dr, ht += Se * tr, ht += Ae * le, Ue = ht >>> 13, ht &= 8191, ht += Ve * Ht, ht += Be * Xt, ht += je * zt, ht += Je * (5 * lr), ht += Lt * (5 * gr), Ue += ht >>> 13, ht &= 8191, xt = Ue, xt += bt * gr, xt += ut * Zt, xt += ot * pr, xt += Se * dr, xt += Ae * tr, Ue = xt >>> 13, xt &= 8191, xt += Ve * le, xt += Be * Ht, xt += je * Xt, xt += Je * zt, xt += Lt * (5 * lr), Ue += xt >>> 13, xt &= 8191, st = Ue, st += bt * lr, st += ut * gr, st += ot * Zt, st += Se * pr, st += Ae * dr, Ue = st >>> 13, st &= 8191, st += Ve * tr, st += Be * le, st += je * Ht, st += Je * Xt, st += Lt * zt, Ue += st >>> 13, st &= 8191, Ue = (Ue << 2) + Ue | 0, Ue = Ue + pt | 0, pt = Ue & 8191, Ue = Ue >>> 13, it += Ue, bt = pt, ut = it, ot = et, Se = St, Ae = Tt, Ve = At, Be = _t, je = ht, Je = xt, Lt = st, j += 16, z -= 16; - this.h[0] = bt, this.h[1] = ut, this.h[2] = ot, this.h[3] = Se, this.h[4] = Ae, this.h[5] = Ve, this.h[6] = Be, this.h[7] = je, this.h[8] = Je, this.h[9] = Lt; - }, Y.prototype.finish = function(k, j) { - var z = new Uint16Array(10), C, G, U, se; + Y.prototype.blocks = function(k, U, z) { + for (var C = this.fin ? 0 : 2048, G, j, se, de, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt = this.h[0], ut = this.h[1], ot = this.h[2], Se = this.h[3], Ae = this.h[4], Ve = this.h[5], Fe = this.h[6], Ue = this.h[7], Je = this.h[8], Lt = this.h[9], zt = this.r[0], Zt = this.r[1], Wt = this.r[2], he = this.r[3], rr = this.r[4], dr = this.r[5], pr = this.r[6], Qt = this.r[7], gr = this.r[8], lr = this.r[9]; z >= 16; ) + G = k[U + 0] & 255 | (k[U + 1] & 255) << 8, bt += G & 8191, j = k[U + 2] & 255 | (k[U + 3] & 255) << 8, ut += (G >>> 13 | j << 3) & 8191, se = k[U + 4] & 255 | (k[U + 5] & 255) << 8, ot += (j >>> 10 | se << 6) & 8191, de = k[U + 6] & 255 | (k[U + 7] & 255) << 8, Se += (se >>> 7 | de << 9) & 8191, xe = k[U + 8] & 255 | (k[U + 9] & 255) << 8, Ae += (de >>> 4 | xe << 12) & 8191, Ve += xe >>> 1 & 8191, Te = k[U + 10] & 255 | (k[U + 11] & 255) << 8, Fe += (xe >>> 14 | Te << 2) & 8191, Re = k[U + 12] & 255 | (k[U + 13] & 255) << 8, Ue += (Te >>> 11 | Re << 5) & 8191, nt = k[U + 14] & 255 | (k[U + 15] & 255) << 8, Je += (Re >>> 8 | nt << 8) & 8191, Lt += nt >>> 5 | C, je = 0, pt = je, pt += bt * zt, pt += ut * (5 * lr), pt += ot * (5 * gr), pt += Se * (5 * Qt), pt += Ae * (5 * pr), je = pt >>> 13, pt &= 8191, pt += Ve * (5 * dr), pt += Fe * (5 * rr), pt += Ue * (5 * he), pt += Je * (5 * Wt), pt += Lt * (5 * Zt), je += pt >>> 13, pt &= 8191, it = je, it += bt * Zt, it += ut * zt, it += ot * (5 * lr), it += Se * (5 * gr), it += Ae * (5 * Qt), je = it >>> 13, it &= 8191, it += Ve * (5 * pr), it += Fe * (5 * dr), it += Ue * (5 * rr), it += Je * (5 * he), it += Lt * (5 * Wt), je += it >>> 13, it &= 8191, et = je, et += bt * Wt, et += ut * Zt, et += ot * zt, et += Se * (5 * lr), et += Ae * (5 * gr), je = et >>> 13, et &= 8191, et += Ve * (5 * Qt), et += Fe * (5 * pr), et += Ue * (5 * dr), et += Je * (5 * rr), et += Lt * (5 * he), je += et >>> 13, et &= 8191, St = je, St += bt * he, St += ut * Wt, St += ot * Zt, St += Se * zt, St += Ae * (5 * lr), je = St >>> 13, St &= 8191, St += Ve * (5 * gr), St += Fe * (5 * Qt), St += Ue * (5 * pr), St += Je * (5 * dr), St += Lt * (5 * rr), je += St >>> 13, St &= 8191, Tt = je, Tt += bt * rr, Tt += ut * he, Tt += ot * Wt, Tt += Se * Zt, Tt += Ae * zt, je = Tt >>> 13, Tt &= 8191, Tt += Ve * (5 * lr), Tt += Fe * (5 * gr), Tt += Ue * (5 * Qt), Tt += Je * (5 * pr), Tt += Lt * (5 * dr), je += Tt >>> 13, Tt &= 8191, At = je, At += bt * dr, At += ut * rr, At += ot * he, At += Se * Wt, At += Ae * Zt, je = At >>> 13, At &= 8191, At += Ve * zt, At += Fe * (5 * lr), At += Ue * (5 * gr), At += Je * (5 * Qt), At += Lt * (5 * pr), je += At >>> 13, At &= 8191, _t = je, _t += bt * pr, _t += ut * dr, _t += ot * rr, _t += Se * he, _t += Ae * Wt, je = _t >>> 13, _t &= 8191, _t += Ve * Zt, _t += Fe * zt, _t += Ue * (5 * lr), _t += Je * (5 * gr), _t += Lt * (5 * Qt), je += _t >>> 13, _t &= 8191, ht = je, ht += bt * Qt, ht += ut * pr, ht += ot * dr, ht += Se * rr, ht += Ae * he, je = ht >>> 13, ht &= 8191, ht += Ve * Wt, ht += Fe * Zt, ht += Ue * zt, ht += Je * (5 * lr), ht += Lt * (5 * gr), je += ht >>> 13, ht &= 8191, xt = je, xt += bt * gr, xt += ut * Qt, xt += ot * pr, xt += Se * dr, xt += Ae * rr, je = xt >>> 13, xt &= 8191, xt += Ve * he, xt += Fe * Wt, xt += Ue * Zt, xt += Je * zt, xt += Lt * (5 * lr), je += xt >>> 13, xt &= 8191, st = je, st += bt * lr, st += ut * gr, st += ot * Qt, st += Se * pr, st += Ae * dr, je = st >>> 13, st &= 8191, st += Ve * rr, st += Fe * he, st += Ue * Wt, st += Je * Zt, st += Lt * zt, je += st >>> 13, st &= 8191, je = (je << 2) + je | 0, je = je + pt | 0, pt = je & 8191, je = je >>> 13, it += je, bt = pt, ut = it, ot = et, Se = St, Ae = Tt, Ve = At, Fe = _t, Ue = ht, Je = xt, Lt = st, U += 16, z -= 16; + this.h[0] = bt, this.h[1] = ut, this.h[2] = ot, this.h[3] = Se, this.h[4] = Ae, this.h[5] = Ve, this.h[6] = Fe, this.h[7] = Ue, this.h[8] = Je, this.h[9] = Lt; + }, Y.prototype.finish = function(k, U) { + var z = new Uint16Array(10), C, G, j, se; if (this.leftover) { for (se = this.leftover, this.buffer[se++] = 1; se < 16; se++) this.buffer[se] = 0; this.fin = 1, this.blocks(this.buffer, 0, 16); @@ -40255,139 +40255,139 @@ var B9 = { exports: {} }; z[se] = this.h[se] + C, C = z[se] >>> 13, z[se] &= 8191; for (z[9] -= 8192, G = (C ^ 1) - 1, se = 0; se < 10; se++) z[se] &= G; for (G = ~G, se = 0; se < 10; se++) this.h[se] = this.h[se] & G | z[se]; - for (this.h[0] = (this.h[0] | this.h[1] << 13) & 65535, this.h[1] = (this.h[1] >>> 3 | this.h[2] << 10) & 65535, this.h[2] = (this.h[2] >>> 6 | this.h[3] << 7) & 65535, this.h[3] = (this.h[3] >>> 9 | this.h[4] << 4) & 65535, this.h[4] = (this.h[4] >>> 12 | this.h[5] << 1 | this.h[6] << 14) & 65535, this.h[5] = (this.h[6] >>> 2 | this.h[7] << 11) & 65535, this.h[6] = (this.h[7] >>> 5 | this.h[8] << 8) & 65535, this.h[7] = (this.h[8] >>> 8 | this.h[9] << 5) & 65535, U = this.h[0] + this.pad[0], this.h[0] = U & 65535, se = 1; se < 8; se++) - U = (this.h[se] + this.pad[se] | 0) + (U >>> 16) | 0, this.h[se] = U & 65535; - k[j + 0] = this.h[0] >>> 0 & 255, k[j + 1] = this.h[0] >>> 8 & 255, k[j + 2] = this.h[1] >>> 0 & 255, k[j + 3] = this.h[1] >>> 8 & 255, k[j + 4] = this.h[2] >>> 0 & 255, k[j + 5] = this.h[2] >>> 8 & 255, k[j + 6] = this.h[3] >>> 0 & 255, k[j + 7] = this.h[3] >>> 8 & 255, k[j + 8] = this.h[4] >>> 0 & 255, k[j + 9] = this.h[4] >>> 8 & 255, k[j + 10] = this.h[5] >>> 0 & 255, k[j + 11] = this.h[5] >>> 8 & 255, k[j + 12] = this.h[6] >>> 0 & 255, k[j + 13] = this.h[6] >>> 8 & 255, k[j + 14] = this.h[7] >>> 0 & 255, k[j + 15] = this.h[7] >>> 8 & 255; - }, Y.prototype.update = function(k, j, z) { + for (this.h[0] = (this.h[0] | this.h[1] << 13) & 65535, this.h[1] = (this.h[1] >>> 3 | this.h[2] << 10) & 65535, this.h[2] = (this.h[2] >>> 6 | this.h[3] << 7) & 65535, this.h[3] = (this.h[3] >>> 9 | this.h[4] << 4) & 65535, this.h[4] = (this.h[4] >>> 12 | this.h[5] << 1 | this.h[6] << 14) & 65535, this.h[5] = (this.h[6] >>> 2 | this.h[7] << 11) & 65535, this.h[6] = (this.h[7] >>> 5 | this.h[8] << 8) & 65535, this.h[7] = (this.h[8] >>> 8 | this.h[9] << 5) & 65535, j = this.h[0] + this.pad[0], this.h[0] = j & 65535, se = 1; se < 8; se++) + j = (this.h[se] + this.pad[se] | 0) + (j >>> 16) | 0, this.h[se] = j & 65535; + k[U + 0] = this.h[0] >>> 0 & 255, k[U + 1] = this.h[0] >>> 8 & 255, k[U + 2] = this.h[1] >>> 0 & 255, k[U + 3] = this.h[1] >>> 8 & 255, k[U + 4] = this.h[2] >>> 0 & 255, k[U + 5] = this.h[2] >>> 8 & 255, k[U + 6] = this.h[3] >>> 0 & 255, k[U + 7] = this.h[3] >>> 8 & 255, k[U + 8] = this.h[4] >>> 0 & 255, k[U + 9] = this.h[4] >>> 8 & 255, k[U + 10] = this.h[5] >>> 0 & 255, k[U + 11] = this.h[5] >>> 8 & 255, k[U + 12] = this.h[6] >>> 0 & 255, k[U + 13] = this.h[6] >>> 8 & 255, k[U + 14] = this.h[7] >>> 0 & 255, k[U + 15] = this.h[7] >>> 8 & 255; + }, Y.prototype.update = function(k, U, z) { var C, G; if (this.leftover) { for (G = 16 - this.leftover, G > z && (G = z), C = 0; C < G; C++) - this.buffer[this.leftover + C] = k[j + C]; - if (z -= G, j += G, this.leftover += G, this.leftover < 16) + this.buffer[this.leftover + C] = k[U + C]; + if (z -= G, U += G, this.leftover += G, this.leftover < 16) return; this.blocks(this.buffer, 0, 16), this.leftover = 0; } - if (z >= 16 && (G = z - z % 16, this.blocks(k, j, G), j += G, z -= G), z) { + if (z >= 16 && (G = z - z % 16, this.blocks(k, U, G), U += G, z -= G), z) { for (C = 0; C < z; C++) - this.buffer[this.leftover + C] = k[j + C]; + this.buffer[this.leftover + C] = k[U + C]; this.leftover += z; } }; - function S(k, j, z, C, G, U) { - var se = new Y(U); - return se.update(z, C, G), se.finish(k, j), 0; + function S(k, U, z, C, G, j) { + var se = new Y(j); + return se.update(z, C, G), se.finish(k, U), 0; } - function m(k, j, z, C, G, U) { + function m(k, U, z, C, G, j) { var se = new Uint8Array(16); - return S(se, 0, z, C, G, U), L(k, j, se, 0); + return S(se, 0, z, C, G, j), L(k, U, se, 0); } - function f(k, j, z, C, G) { - var U; + function f(k, U, z, C, G) { + var j; if (z < 32) return -1; - for (Ee(k, 0, j, 0, z, C, G), S(k, 16, k, 32, z - 32, k), U = 0; U < 16; U++) k[U] = 0; + for (Ee(k, 0, U, 0, z, C, G), S(k, 16, k, 32, z - 32, k), j = 0; j < 16; j++) k[j] = 0; return 0; } - function p(k, j, z, C, G) { - var U, se = new Uint8Array(32); - if (z < 32 || (pe(se, 0, 32, C, G), m(j, 16, j, 32, z - 32, se) !== 0)) return -1; - for (Ee(k, 0, j, 0, z, C, G), U = 0; U < 32; U++) k[U] = 0; + function g(k, U, z, C, G) { + var j, se = new Uint8Array(32); + if (z < 32 || (ge(se, 0, 32, C, G), m(U, 16, U, 32, z - 32, se) !== 0)) return -1; + for (Ee(k, 0, U, 0, z, C, G), j = 0; j < 32; j++) k[j] = 0; return 0; } - function b(k, j) { + function b(k, U) { var z; - for (z = 0; z < 16; z++) k[z] = j[z] | 0; + for (z = 0; z < 16; z++) k[z] = U[z] | 0; } function x(k) { - var j, z, C = 1; - for (j = 0; j < 16; j++) - z = k[j] + C + 65535, C = Math.floor(z / 65536), k[j] = z - C * 65536; + var U, z, C = 1; + for (U = 0; U < 16; U++) + z = k[U] + C + 65535, C = Math.floor(z / 65536), k[U] = z - C * 65536; k[0] += C - 1 + 37 * (C - 1); } - function _(k, j, z) { - for (var C, G = ~(z - 1), U = 0; U < 16; U++) - C = G & (k[U] ^ j[U]), k[U] ^= C, j[U] ^= C; + function _(k, U, z) { + for (var C, G = ~(z - 1), j = 0; j < 16; j++) + C = G & (k[j] ^ U[j]), k[j] ^= C, U[j] ^= C; } - function E(k, j) { - var z, C, G, U = r(), se = r(); - for (z = 0; z < 16; z++) se[z] = j[z]; + function E(k, U) { + var z, C, G, j = r(), se = r(); + for (z = 0; z < 16; z++) se[z] = U[z]; for (x(se), x(se), x(se), C = 0; C < 2; C++) { - for (U[0] = se[0] - 65517, z = 1; z < 15; z++) - U[z] = se[z] - 65535 - (U[z - 1] >> 16 & 1), U[z - 1] &= 65535; - U[15] = se[15] - 32767 - (U[14] >> 16 & 1), G = U[15] >> 16 & 1, U[14] &= 65535, _(se, U, 1 - G); + for (j[0] = se[0] - 65517, z = 1; z < 15; z++) + j[z] = se[z] - 65535 - (j[z - 1] >> 16 & 1), j[z - 1] &= 65535; + j[15] = se[15] - 32767 - (j[14] >> 16 & 1), G = j[15] >> 16 & 1, j[14] &= 65535, _(se, j, 1 - G); } for (z = 0; z < 16; z++) k[2 * z] = se[z] & 255, k[2 * z + 1] = se[z] >> 8; } - function v(k, j) { + function v(k, U) { var z = new Uint8Array(32), C = new Uint8Array(32); - return E(z, k), E(C, j), $(z, 0, C, 0); + return E(z, k), E(C, U), $(z, 0, C, 0); } - function P(k) { - var j = new Uint8Array(32); - return E(j, k), j[0] & 1; + function M(k) { + var U = new Uint8Array(32); + return E(U, k), U[0] & 1; } - function I(k, j) { + function I(k, U) { var z; - for (z = 0; z < 16; z++) k[z] = j[2 * z] + (j[2 * z + 1] << 8); + for (z = 0; z < 16; z++) k[z] = U[2 * z] + (U[2 * z + 1] << 8); k[15] &= 32767; } - function B(k, j, z) { - for (var C = 0; C < 16; C++) k[C] = j[C] + z[C]; + function F(k, U, z) { + for (var C = 0; C < 16; C++) k[C] = U[C] + z[C]; } - function ce(k, j, z) { - for (var C = 0; C < 16; C++) k[C] = j[C] - z[C]; + function ce(k, U, z) { + for (var C = 0; C < 16; C++) k[C] = U[C] - z[C]; } - function D(k, j, z) { - var C, G, U = 0, se = 0, he = 0, xe = 0, Te = 0, Re = 0, nt = 0, Ue = 0, pt = 0, it = 0, et = 0, St = 0, Tt = 0, At = 0, _t = 0, ht = 0, xt = 0, st = 0, bt = 0, ut = 0, ot = 0, Se = 0, Ae = 0, Ve = 0, Be = 0, je = 0, Je = 0, Lt = 0, zt = 0, Xt = 0, Ht = 0, le = z[0], tr = z[1], dr = z[2], pr = z[3], Zt = z[4], gr = z[5], lr = z[6], Rr = z[7], mr = z[8], yr = z[9], $r = z[10], Fr = z[11], Ir = z[12], nn = z[13], sn = z[14], on = z[15]; - C = j[0], U += C * le, se += C * tr, he += C * dr, xe += C * pr, Te += C * Zt, Re += C * gr, nt += C * lr, Ue += C * Rr, pt += C * mr, it += C * yr, et += C * $r, St += C * Fr, Tt += C * Ir, At += C * nn, _t += C * sn, ht += C * on, C = j[1], se += C * le, he += C * tr, xe += C * dr, Te += C * pr, Re += C * Zt, nt += C * gr, Ue += C * lr, pt += C * Rr, it += C * mr, et += C * yr, St += C * $r, Tt += C * Fr, At += C * Ir, _t += C * nn, ht += C * sn, xt += C * on, C = j[2], he += C * le, xe += C * tr, Te += C * dr, Re += C * pr, nt += C * Zt, Ue += C * gr, pt += C * lr, it += C * Rr, et += C * mr, St += C * yr, Tt += C * $r, At += C * Fr, _t += C * Ir, ht += C * nn, xt += C * sn, st += C * on, C = j[3], xe += C * le, Te += C * tr, Re += C * dr, nt += C * pr, Ue += C * Zt, pt += C * gr, it += C * lr, et += C * Rr, St += C * mr, Tt += C * yr, At += C * $r, _t += C * Fr, ht += C * Ir, xt += C * nn, st += C * sn, bt += C * on, C = j[4], Te += C * le, Re += C * tr, nt += C * dr, Ue += C * pr, pt += C * Zt, it += C * gr, et += C * lr, St += C * Rr, Tt += C * mr, At += C * yr, _t += C * $r, ht += C * Fr, xt += C * Ir, st += C * nn, bt += C * sn, ut += C * on, C = j[5], Re += C * le, nt += C * tr, Ue += C * dr, pt += C * pr, it += C * Zt, et += C * gr, St += C * lr, Tt += C * Rr, At += C * mr, _t += C * yr, ht += C * $r, xt += C * Fr, st += C * Ir, bt += C * nn, ut += C * sn, ot += C * on, C = j[6], nt += C * le, Ue += C * tr, pt += C * dr, it += C * pr, et += C * Zt, St += C * gr, Tt += C * lr, At += C * Rr, _t += C * mr, ht += C * yr, xt += C * $r, st += C * Fr, bt += C * Ir, ut += C * nn, ot += C * sn, Se += C * on, C = j[7], Ue += C * le, pt += C * tr, it += C * dr, et += C * pr, St += C * Zt, Tt += C * gr, At += C * lr, _t += C * Rr, ht += C * mr, xt += C * yr, st += C * $r, bt += C * Fr, ut += C * Ir, ot += C * nn, Se += C * sn, Ae += C * on, C = j[8], pt += C * le, it += C * tr, et += C * dr, St += C * pr, Tt += C * Zt, At += C * gr, _t += C * lr, ht += C * Rr, xt += C * mr, st += C * yr, bt += C * $r, ut += C * Fr, ot += C * Ir, Se += C * nn, Ae += C * sn, Ve += C * on, C = j[9], it += C * le, et += C * tr, St += C * dr, Tt += C * pr, At += C * Zt, _t += C * gr, ht += C * lr, xt += C * Rr, st += C * mr, bt += C * yr, ut += C * $r, ot += C * Fr, Se += C * Ir, Ae += C * nn, Ve += C * sn, Be += C * on, C = j[10], et += C * le, St += C * tr, Tt += C * dr, At += C * pr, _t += C * Zt, ht += C * gr, xt += C * lr, st += C * Rr, bt += C * mr, ut += C * yr, ot += C * $r, Se += C * Fr, Ae += C * Ir, Ve += C * nn, Be += C * sn, je += C * on, C = j[11], St += C * le, Tt += C * tr, At += C * dr, _t += C * pr, ht += C * Zt, xt += C * gr, st += C * lr, bt += C * Rr, ut += C * mr, ot += C * yr, Se += C * $r, Ae += C * Fr, Ve += C * Ir, Be += C * nn, je += C * sn, Je += C * on, C = j[12], Tt += C * le, At += C * tr, _t += C * dr, ht += C * pr, xt += C * Zt, st += C * gr, bt += C * lr, ut += C * Rr, ot += C * mr, Se += C * yr, Ae += C * $r, Ve += C * Fr, Be += C * Ir, je += C * nn, Je += C * sn, Lt += C * on, C = j[13], At += C * le, _t += C * tr, ht += C * dr, xt += C * pr, st += C * Zt, bt += C * gr, ut += C * lr, ot += C * Rr, Se += C * mr, Ae += C * yr, Ve += C * $r, Be += C * Fr, je += C * Ir, Je += C * nn, Lt += C * sn, zt += C * on, C = j[14], _t += C * le, ht += C * tr, xt += C * dr, st += C * pr, bt += C * Zt, ut += C * gr, ot += C * lr, Se += C * Rr, Ae += C * mr, Ve += C * yr, Be += C * $r, je += C * Fr, Je += C * Ir, Lt += C * nn, zt += C * sn, Xt += C * on, C = j[15], ht += C * le, xt += C * tr, st += C * dr, bt += C * pr, ut += C * Zt, ot += C * gr, Se += C * lr, Ae += C * Rr, Ve += C * mr, Be += C * yr, je += C * $r, Je += C * Fr, Lt += C * Ir, zt += C * nn, Xt += C * sn, Ht += C * on, U += 38 * xt, se += 38 * st, he += 38 * bt, xe += 38 * ut, Te += 38 * ot, Re += 38 * Se, nt += 38 * Ae, Ue += 38 * Ve, pt += 38 * Be, it += 38 * je, et += 38 * Je, St += 38 * Lt, Tt += 38 * zt, At += 38 * Xt, _t += 38 * Ht, G = 1, C = U + G + 65535, G = Math.floor(C / 65536), U = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = he + G + 65535, G = Math.floor(C / 65536), he = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = Ue + G + 65535, G = Math.floor(C / 65536), Ue = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, U += G - 1 + 37 * (G - 1), G = 1, C = U + G + 65535, G = Math.floor(C / 65536), U = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = he + G + 65535, G = Math.floor(C / 65536), he = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = Ue + G + 65535, G = Math.floor(C / 65536), Ue = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, U += G - 1 + 37 * (G - 1), k[0] = U, k[1] = se, k[2] = he, k[3] = xe, k[4] = Te, k[5] = Re, k[6] = nt, k[7] = Ue, k[8] = pt, k[9] = it, k[10] = et, k[11] = St, k[12] = Tt, k[13] = At, k[14] = _t, k[15] = ht; + function D(k, U, z) { + var C, G, j = 0, se = 0, de = 0, xe = 0, Te = 0, Re = 0, nt = 0, je = 0, pt = 0, it = 0, et = 0, St = 0, Tt = 0, At = 0, _t = 0, ht = 0, xt = 0, st = 0, bt = 0, ut = 0, ot = 0, Se = 0, Ae = 0, Ve = 0, Fe = 0, Ue = 0, Je = 0, Lt = 0, zt = 0, Zt = 0, Wt = 0, he = z[0], rr = z[1], dr = z[2], pr = z[3], Qt = z[4], gr = z[5], lr = z[6], Rr = z[7], mr = z[8], yr = z[9], $r = z[10], Br = z[11], Ir = z[12], nn = z[13], sn = z[14], on = z[15]; + C = U[0], j += C * he, se += C * rr, de += C * dr, xe += C * pr, Te += C * Qt, Re += C * gr, nt += C * lr, je += C * Rr, pt += C * mr, it += C * yr, et += C * $r, St += C * Br, Tt += C * Ir, At += C * nn, _t += C * sn, ht += C * on, C = U[1], se += C * he, de += C * rr, xe += C * dr, Te += C * pr, Re += C * Qt, nt += C * gr, je += C * lr, pt += C * Rr, it += C * mr, et += C * yr, St += C * $r, Tt += C * Br, At += C * Ir, _t += C * nn, ht += C * sn, xt += C * on, C = U[2], de += C * he, xe += C * rr, Te += C * dr, Re += C * pr, nt += C * Qt, je += C * gr, pt += C * lr, it += C * Rr, et += C * mr, St += C * yr, Tt += C * $r, At += C * Br, _t += C * Ir, ht += C * nn, xt += C * sn, st += C * on, C = U[3], xe += C * he, Te += C * rr, Re += C * dr, nt += C * pr, je += C * Qt, pt += C * gr, it += C * lr, et += C * Rr, St += C * mr, Tt += C * yr, At += C * $r, _t += C * Br, ht += C * Ir, xt += C * nn, st += C * sn, bt += C * on, C = U[4], Te += C * he, Re += C * rr, nt += C * dr, je += C * pr, pt += C * Qt, it += C * gr, et += C * lr, St += C * Rr, Tt += C * mr, At += C * yr, _t += C * $r, ht += C * Br, xt += C * Ir, st += C * nn, bt += C * sn, ut += C * on, C = U[5], Re += C * he, nt += C * rr, je += C * dr, pt += C * pr, it += C * Qt, et += C * gr, St += C * lr, Tt += C * Rr, At += C * mr, _t += C * yr, ht += C * $r, xt += C * Br, st += C * Ir, bt += C * nn, ut += C * sn, ot += C * on, C = U[6], nt += C * he, je += C * rr, pt += C * dr, it += C * pr, et += C * Qt, St += C * gr, Tt += C * lr, At += C * Rr, _t += C * mr, ht += C * yr, xt += C * $r, st += C * Br, bt += C * Ir, ut += C * nn, ot += C * sn, Se += C * on, C = U[7], je += C * he, pt += C * rr, it += C * dr, et += C * pr, St += C * Qt, Tt += C * gr, At += C * lr, _t += C * Rr, ht += C * mr, xt += C * yr, st += C * $r, bt += C * Br, ut += C * Ir, ot += C * nn, Se += C * sn, Ae += C * on, C = U[8], pt += C * he, it += C * rr, et += C * dr, St += C * pr, Tt += C * Qt, At += C * gr, _t += C * lr, ht += C * Rr, xt += C * mr, st += C * yr, bt += C * $r, ut += C * Br, ot += C * Ir, Se += C * nn, Ae += C * sn, Ve += C * on, C = U[9], it += C * he, et += C * rr, St += C * dr, Tt += C * pr, At += C * Qt, _t += C * gr, ht += C * lr, xt += C * Rr, st += C * mr, bt += C * yr, ut += C * $r, ot += C * Br, Se += C * Ir, Ae += C * nn, Ve += C * sn, Fe += C * on, C = U[10], et += C * he, St += C * rr, Tt += C * dr, At += C * pr, _t += C * Qt, ht += C * gr, xt += C * lr, st += C * Rr, bt += C * mr, ut += C * yr, ot += C * $r, Se += C * Br, Ae += C * Ir, Ve += C * nn, Fe += C * sn, Ue += C * on, C = U[11], St += C * he, Tt += C * rr, At += C * dr, _t += C * pr, ht += C * Qt, xt += C * gr, st += C * lr, bt += C * Rr, ut += C * mr, ot += C * yr, Se += C * $r, Ae += C * Br, Ve += C * Ir, Fe += C * nn, Ue += C * sn, Je += C * on, C = U[12], Tt += C * he, At += C * rr, _t += C * dr, ht += C * pr, xt += C * Qt, st += C * gr, bt += C * lr, ut += C * Rr, ot += C * mr, Se += C * yr, Ae += C * $r, Ve += C * Br, Fe += C * Ir, Ue += C * nn, Je += C * sn, Lt += C * on, C = U[13], At += C * he, _t += C * rr, ht += C * dr, xt += C * pr, st += C * Qt, bt += C * gr, ut += C * lr, ot += C * Rr, Se += C * mr, Ae += C * yr, Ve += C * $r, Fe += C * Br, Ue += C * Ir, Je += C * nn, Lt += C * sn, zt += C * on, C = U[14], _t += C * he, ht += C * rr, xt += C * dr, st += C * pr, bt += C * Qt, ut += C * gr, ot += C * lr, Se += C * Rr, Ae += C * mr, Ve += C * yr, Fe += C * $r, Ue += C * Br, Je += C * Ir, Lt += C * nn, zt += C * sn, Zt += C * on, C = U[15], ht += C * he, xt += C * rr, st += C * dr, bt += C * pr, ut += C * Qt, ot += C * gr, Se += C * lr, Ae += C * Rr, Ve += C * mr, Fe += C * yr, Ue += C * $r, Je += C * Br, Lt += C * Ir, zt += C * nn, Zt += C * sn, Wt += C * on, j += 38 * xt, se += 38 * st, de += 38 * bt, xe += 38 * ut, Te += 38 * ot, Re += 38 * Se, nt += 38 * Ae, je += 38 * Ve, pt += 38 * Fe, it += 38 * Ue, et += 38 * Je, St += 38 * Lt, Tt += 38 * zt, At += 38 * Zt, _t += 38 * Wt, G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = de + G + 65535, G = Math.floor(C / 65536), de = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = de + G + 65535, G = Math.floor(C / 65536), de = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), k[0] = j, k[1] = se, k[2] = de, k[3] = xe, k[4] = Te, k[5] = Re, k[6] = nt, k[7] = je, k[8] = pt, k[9] = it, k[10] = et, k[11] = St, k[12] = Tt, k[13] = At, k[14] = _t, k[15] = ht; } - function oe(k, j) { - D(k, j, j); + function oe(k, U) { + D(k, U, U); } - function Z(k, j) { + function Z(k, U) { var z = r(), C; - for (C = 0; C < 16; C++) z[C] = j[C]; + for (C = 0; C < 16; C++) z[C] = U[C]; for (C = 253; C >= 0; C--) - oe(z, z), C !== 2 && C !== 4 && D(z, z, j); + oe(z, z), C !== 2 && C !== 4 && D(z, z, U); for (C = 0; C < 16; C++) k[C] = z[C]; } - function J(k, j) { + function J(k, U) { var z = r(), C; - for (C = 0; C < 16; C++) z[C] = j[C]; + for (C = 0; C < 16; C++) z[C] = U[C]; for (C = 250; C >= 0; C--) - oe(z, z), C !== 1 && D(z, z, j); + oe(z, z), C !== 1 && D(z, z, U); for (C = 0; C < 16; C++) k[C] = z[C]; } - function Q(k, j, z) { - var C = new Uint8Array(32), G = new Float64Array(80), U, se, he = r(), xe = r(), Te = r(), Re = r(), nt = r(), Ue = r(); - for (se = 0; se < 31; se++) C[se] = j[se]; - for (C[31] = j[31] & 127 | 64, C[0] &= 248, I(G, z), se = 0; se < 16; se++) - xe[se] = G[se], Re[se] = he[se] = Te[se] = 0; - for (he[0] = Re[0] = 1, se = 254; se >= 0; --se) - U = C[se >>> 3] >>> (se & 7) & 1, _(he, xe, U), _(Te, Re, U), B(nt, he, Te), ce(he, he, Te), B(Te, xe, Re), ce(xe, xe, Re), oe(Re, nt), oe(Ue, he), D(he, Te, he), D(Te, xe, nt), B(nt, he, Te), ce(he, he, Te), oe(xe, he), ce(Te, Re, Ue), D(he, Te, u), B(he, he, Re), D(Te, Te, he), D(he, Re, Ue), D(Re, xe, G), oe(xe, nt), _(he, xe, U), _(Te, Re, U); + function Q(k, U, z) { + var C = new Uint8Array(32), G = new Float64Array(80), j, se, de = r(), xe = r(), Te = r(), Re = r(), nt = r(), je = r(); + for (se = 0; se < 31; se++) C[se] = U[se]; + for (C[31] = U[31] & 127 | 64, C[0] &= 248, I(G, z), se = 0; se < 16; se++) + xe[se] = G[se], Re[se] = de[se] = Te[se] = 0; + for (de[0] = Re[0] = 1, se = 254; se >= 0; --se) + j = C[se >>> 3] >>> (se & 7) & 1, _(de, xe, j), _(Te, Re, j), F(nt, de, Te), ce(de, de, Te), F(Te, xe, Re), ce(xe, xe, Re), oe(Re, nt), oe(je, de), D(de, Te, de), D(Te, xe, nt), F(nt, de, Te), ce(de, de, Te), oe(xe, de), ce(Te, Re, je), D(de, Te, u), F(de, de, Re), D(Te, Te, de), D(de, Re, je), D(Re, xe, G), oe(xe, nt), _(de, xe, j), _(Te, Re, j); for (se = 0; se < 16; se++) - G[se + 16] = he[se], G[se + 32] = Te[se], G[se + 48] = xe[se], G[se + 64] = Re[se]; + G[se + 16] = de[se], G[se + 32] = Te[se], G[se + 48] = xe[se], G[se + 64] = Re[se]; var pt = G.subarray(32), it = G.subarray(16); return Z(pt, pt), D(it, it, pt), E(k, it), 0; } - function T(k, j) { - return Q(k, j, s); + function T(k, U) { + return Q(k, U, s); } - function X(k, j) { - return n(j, 32), T(k, j); + function X(k, U) { + return n(U, 32), T(k, U); } - function re(k, j, z) { + function re(k, U, z) { var C = new Uint8Array(32); - return Q(C, z, j), V(k, i, C, te); + return Q(C, z, U), V(k, i, C, te); } - var de = f, ie = p; - function ue(k, j, z, C, G, U) { + var pe = f, ie = g; + function ue(k, U, z, C, G, j) { var se = new Uint8Array(32); - return re(se, G, U), de(k, j, z, C, se); + return re(se, G, j), pe(k, U, z, C, se); } - function ve(k, j, z, C, G, U) { + function ve(k, U, z, C, G, j) { var se = new Uint8Array(32); - return re(se, G, U), ie(k, j, z, C, se); + return re(se, G, j), ie(k, U, z, C, se); } var Pe = [ 1116352408, @@ -40551,118 +40551,118 @@ var B9 = { exports: {} }; 1816402316, 1246189591 ]; - function De(k, j, z, C) { - for (var G = new Int32Array(16), U = new Int32Array(16), se, he, xe, Te, Re, nt, Ue, pt, it, et, St, Tt, At, _t, ht, xt, st, bt, ut, ot, Se, Ae, Ve, Be, je, Je, Lt = k[0], zt = k[1], Xt = k[2], Ht = k[3], le = k[4], tr = k[5], dr = k[6], pr = k[7], Zt = j[0], gr = j[1], lr = j[2], Rr = j[3], mr = j[4], yr = j[5], $r = j[6], Fr = j[7], Ir = 0; C >= 128; ) { + function De(k, U, z, C) { + for (var G = new Int32Array(16), j = new Int32Array(16), se, de, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt, ut, ot, Se, Ae, Ve, Fe, Ue, Je, Lt = k[0], zt = k[1], Zt = k[2], Wt = k[3], he = k[4], rr = k[5], dr = k[6], pr = k[7], Qt = U[0], gr = U[1], lr = U[2], Rr = U[3], mr = U[4], yr = U[5], $r = U[6], Br = U[7], Ir = 0; C >= 128; ) { for (ut = 0; ut < 16; ut++) - ot = 8 * ut + Ir, G[ut] = z[ot + 0] << 24 | z[ot + 1] << 16 | z[ot + 2] << 8 | z[ot + 3], U[ut] = z[ot + 4] << 24 | z[ot + 5] << 16 | z[ot + 6] << 8 | z[ot + 7]; + ot = 8 * ut + Ir, G[ut] = z[ot + 0] << 24 | z[ot + 1] << 16 | z[ot + 2] << 8 | z[ot + 3], j[ut] = z[ot + 4] << 24 | z[ot + 5] << 16 | z[ot + 6] << 8 | z[ot + 7]; for (ut = 0; ut < 80; ut++) - if (se = Lt, he = zt, xe = Xt, Te = Ht, Re = le, nt = tr, Ue = dr, pt = pr, it = Zt, et = gr, St = lr, Tt = Rr, At = mr, _t = yr, ht = $r, xt = Fr, Se = pr, Ae = Fr, Ve = Ae & 65535, Be = Ae >>> 16, je = Se & 65535, Je = Se >>> 16, Se = (le >>> 14 | mr << 18) ^ (le >>> 18 | mr << 14) ^ (mr >>> 9 | le << 23), Ae = (mr >>> 14 | le << 18) ^ (mr >>> 18 | le << 14) ^ (le >>> 9 | mr << 23), Ve += Ae & 65535, Be += Ae >>> 16, je += Se & 65535, Je += Se >>> 16, Se = le & tr ^ ~le & dr, Ae = mr & yr ^ ~mr & $r, Ve += Ae & 65535, Be += Ae >>> 16, je += Se & 65535, Je += Se >>> 16, Se = Pe[ut * 2], Ae = Pe[ut * 2 + 1], Ve += Ae & 65535, Be += Ae >>> 16, je += Se & 65535, Je += Se >>> 16, Se = G[ut % 16], Ae = U[ut % 16], Ve += Ae & 65535, Be += Ae >>> 16, je += Se & 65535, Je += Se >>> 16, Be += Ve >>> 16, je += Be >>> 16, Je += je >>> 16, st = je & 65535 | Je << 16, bt = Ve & 65535 | Be << 16, Se = st, Ae = bt, Ve = Ae & 65535, Be = Ae >>> 16, je = Se & 65535, Je = Se >>> 16, Se = (Lt >>> 28 | Zt << 4) ^ (Zt >>> 2 | Lt << 30) ^ (Zt >>> 7 | Lt << 25), Ae = (Zt >>> 28 | Lt << 4) ^ (Lt >>> 2 | Zt << 30) ^ (Lt >>> 7 | Zt << 25), Ve += Ae & 65535, Be += Ae >>> 16, je += Se & 65535, Je += Se >>> 16, Se = Lt & zt ^ Lt & Xt ^ zt & Xt, Ae = Zt & gr ^ Zt & lr ^ gr & lr, Ve += Ae & 65535, Be += Ae >>> 16, je += Se & 65535, Je += Se >>> 16, Be += Ve >>> 16, je += Be >>> 16, Je += je >>> 16, pt = je & 65535 | Je << 16, xt = Ve & 65535 | Be << 16, Se = Te, Ae = Tt, Ve = Ae & 65535, Be = Ae >>> 16, je = Se & 65535, Je = Se >>> 16, Se = st, Ae = bt, Ve += Ae & 65535, Be += Ae >>> 16, je += Se & 65535, Je += Se >>> 16, Be += Ve >>> 16, je += Be >>> 16, Je += je >>> 16, Te = je & 65535 | Je << 16, Tt = Ve & 65535 | Be << 16, zt = se, Xt = he, Ht = xe, le = Te, tr = Re, dr = nt, pr = Ue, Lt = pt, gr = it, lr = et, Rr = St, mr = Tt, yr = At, $r = _t, Fr = ht, Zt = xt, ut % 16 === 15) + if (se = Lt, de = zt, xe = Zt, Te = Wt, Re = he, nt = rr, je = dr, pt = pr, it = Qt, et = gr, St = lr, Tt = Rr, At = mr, _t = yr, ht = $r, xt = Br, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (he >>> 14 | mr << 18) ^ (he >>> 18 | mr << 14) ^ (mr >>> 9 | he << 23), Ae = (mr >>> 14 | he << 18) ^ (mr >>> 18 | he << 14) ^ (he >>> 9 | mr << 23), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = he & rr ^ ~he & dr, Ae = mr & yr ^ ~mr & $r, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Pe[ut * 2], Ae = Pe[ut * 2 + 1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = G[ut % 16], Ae = j[ut % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, st = Ue & 65535 | Je << 16, bt = Ve & 65535 | Fe << 16, Se = st, Ae = bt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (Lt >>> 28 | Qt << 4) ^ (Qt >>> 2 | Lt << 30) ^ (Qt >>> 7 | Lt << 25), Ae = (Qt >>> 28 | Lt << 4) ^ (Lt >>> 2 | Qt << 30) ^ (Lt >>> 7 | Qt << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Lt & zt ^ Lt & Zt ^ zt & Zt, Ae = Qt & gr ^ Qt & lr ^ gr & lr, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, pt = Ue & 65535 | Je << 16, xt = Ve & 65535 | Fe << 16, Se = Te, Ae = Tt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = st, Ae = bt, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, Te = Ue & 65535 | Je << 16, Tt = Ve & 65535 | Fe << 16, zt = se, Zt = de, Wt = xe, he = Te, rr = Re, dr = nt, pr = je, Lt = pt, gr = it, lr = et, Rr = St, mr = Tt, yr = At, $r = _t, Br = ht, Qt = xt, ut % 16 === 15) for (ot = 0; ot < 16; ot++) - Se = G[ot], Ae = U[ot], Ve = Ae & 65535, Be = Ae >>> 16, je = Se & 65535, Je = Se >>> 16, Se = G[(ot + 9) % 16], Ae = U[(ot + 9) % 16], Ve += Ae & 65535, Be += Ae >>> 16, je += Se & 65535, Je += Se >>> 16, st = G[(ot + 1) % 16], bt = U[(ot + 1) % 16], Se = (st >>> 1 | bt << 31) ^ (st >>> 8 | bt << 24) ^ st >>> 7, Ae = (bt >>> 1 | st << 31) ^ (bt >>> 8 | st << 24) ^ (bt >>> 7 | st << 25), Ve += Ae & 65535, Be += Ae >>> 16, je += Se & 65535, Je += Se >>> 16, st = G[(ot + 14) % 16], bt = U[(ot + 14) % 16], Se = (st >>> 19 | bt << 13) ^ (bt >>> 29 | st << 3) ^ st >>> 6, Ae = (bt >>> 19 | st << 13) ^ (st >>> 29 | bt << 3) ^ (bt >>> 6 | st << 26), Ve += Ae & 65535, Be += Ae >>> 16, je += Se & 65535, Je += Se >>> 16, Be += Ve >>> 16, je += Be >>> 16, Je += je >>> 16, G[ot] = je & 65535 | Je << 16, U[ot] = Ve & 65535 | Be << 16; - Se = Lt, Ae = Zt, Ve = Ae & 65535, Be = Ae >>> 16, je = Se & 65535, Je = Se >>> 16, Se = k[0], Ae = j[0], Ve += Ae & 65535, Be += Ae >>> 16, je += Se & 65535, Je += Se >>> 16, Be += Ve >>> 16, je += Be >>> 16, Je += je >>> 16, k[0] = Lt = je & 65535 | Je << 16, j[0] = Zt = Ve & 65535 | Be << 16, Se = zt, Ae = gr, Ve = Ae & 65535, Be = Ae >>> 16, je = Se & 65535, Je = Se >>> 16, Se = k[1], Ae = j[1], Ve += Ae & 65535, Be += Ae >>> 16, je += Se & 65535, Je += Se >>> 16, Be += Ve >>> 16, je += Be >>> 16, Je += je >>> 16, k[1] = zt = je & 65535 | Je << 16, j[1] = gr = Ve & 65535 | Be << 16, Se = Xt, Ae = lr, Ve = Ae & 65535, Be = Ae >>> 16, je = Se & 65535, Je = Se >>> 16, Se = k[2], Ae = j[2], Ve += Ae & 65535, Be += Ae >>> 16, je += Se & 65535, Je += Se >>> 16, Be += Ve >>> 16, je += Be >>> 16, Je += je >>> 16, k[2] = Xt = je & 65535 | Je << 16, j[2] = lr = Ve & 65535 | Be << 16, Se = Ht, Ae = Rr, Ve = Ae & 65535, Be = Ae >>> 16, je = Se & 65535, Je = Se >>> 16, Se = k[3], Ae = j[3], Ve += Ae & 65535, Be += Ae >>> 16, je += Se & 65535, Je += Se >>> 16, Be += Ve >>> 16, je += Be >>> 16, Je += je >>> 16, k[3] = Ht = je & 65535 | Je << 16, j[3] = Rr = Ve & 65535 | Be << 16, Se = le, Ae = mr, Ve = Ae & 65535, Be = Ae >>> 16, je = Se & 65535, Je = Se >>> 16, Se = k[4], Ae = j[4], Ve += Ae & 65535, Be += Ae >>> 16, je += Se & 65535, Je += Se >>> 16, Be += Ve >>> 16, je += Be >>> 16, Je += je >>> 16, k[4] = le = je & 65535 | Je << 16, j[4] = mr = Ve & 65535 | Be << 16, Se = tr, Ae = yr, Ve = Ae & 65535, Be = Ae >>> 16, je = Se & 65535, Je = Se >>> 16, Se = k[5], Ae = j[5], Ve += Ae & 65535, Be += Ae >>> 16, je += Se & 65535, Je += Se >>> 16, Be += Ve >>> 16, je += Be >>> 16, Je += je >>> 16, k[5] = tr = je & 65535 | Je << 16, j[5] = yr = Ve & 65535 | Be << 16, Se = dr, Ae = $r, Ve = Ae & 65535, Be = Ae >>> 16, je = Se & 65535, Je = Se >>> 16, Se = k[6], Ae = j[6], Ve += Ae & 65535, Be += Ae >>> 16, je += Se & 65535, Je += Se >>> 16, Be += Ve >>> 16, je += Be >>> 16, Je += je >>> 16, k[6] = dr = je & 65535 | Je << 16, j[6] = $r = Ve & 65535 | Be << 16, Se = pr, Ae = Fr, Ve = Ae & 65535, Be = Ae >>> 16, je = Se & 65535, Je = Se >>> 16, Se = k[7], Ae = j[7], Ve += Ae & 65535, Be += Ae >>> 16, je += Se & 65535, Je += Se >>> 16, Be += Ve >>> 16, je += Be >>> 16, Je += je >>> 16, k[7] = pr = je & 65535 | Je << 16, j[7] = Fr = Ve & 65535 | Be << 16, Ir += 128, C -= 128; + Se = G[ot], Ae = j[ot], Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = G[(ot + 9) % 16], Ae = j[(ot + 9) % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, st = G[(ot + 1) % 16], bt = j[(ot + 1) % 16], Se = (st >>> 1 | bt << 31) ^ (st >>> 8 | bt << 24) ^ st >>> 7, Ae = (bt >>> 1 | st << 31) ^ (bt >>> 8 | st << 24) ^ (bt >>> 7 | st << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, st = G[(ot + 14) % 16], bt = j[(ot + 14) % 16], Se = (st >>> 19 | bt << 13) ^ (bt >>> 29 | st << 3) ^ st >>> 6, Ae = (bt >>> 19 | st << 13) ^ (st >>> 29 | bt << 3) ^ (bt >>> 6 | st << 26), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, G[ot] = Ue & 65535 | Je << 16, j[ot] = Ve & 65535 | Fe << 16; + Se = Lt, Ae = Qt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[0], Ae = U[0], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[0] = Lt = Ue & 65535 | Je << 16, U[0] = Qt = Ve & 65535 | Fe << 16, Se = zt, Ae = gr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[1], Ae = U[1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[1] = zt = Ue & 65535 | Je << 16, U[1] = gr = Ve & 65535 | Fe << 16, Se = Zt, Ae = lr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[2], Ae = U[2], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[2] = Zt = Ue & 65535 | Je << 16, U[2] = lr = Ve & 65535 | Fe << 16, Se = Wt, Ae = Rr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[3], Ae = U[3], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[3] = Wt = Ue & 65535 | Je << 16, U[3] = Rr = Ve & 65535 | Fe << 16, Se = he, Ae = mr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[4], Ae = U[4], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[4] = he = Ue & 65535 | Je << 16, U[4] = mr = Ve & 65535 | Fe << 16, Se = rr, Ae = yr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[5], Ae = U[5], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[5] = rr = Ue & 65535 | Je << 16, U[5] = yr = Ve & 65535 | Fe << 16, Se = dr, Ae = $r, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[6], Ae = U[6], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[6] = dr = Ue & 65535 | Je << 16, U[6] = $r = Ve & 65535 | Fe << 16, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[7], Ae = U[7], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[7] = pr = Ue & 65535 | Je << 16, U[7] = Br = Ve & 65535 | Fe << 16, Ir += 128, C -= 128; } return C; } - function Ce(k, j, z) { - var C = new Int32Array(8), G = new Int32Array(8), U = new Uint8Array(256), se, he = z; - for (C[0] = 1779033703, C[1] = 3144134277, C[2] = 1013904242, C[3] = 2773480762, C[4] = 1359893119, C[5] = 2600822924, C[6] = 528734635, C[7] = 1541459225, G[0] = 4089235720, G[1] = 2227873595, G[2] = 4271175723, G[3] = 1595750129, G[4] = 2917565137, G[5] = 725511199, G[6] = 4215389547, G[7] = 327033209, De(C, G, j, z), z %= 128, se = 0; se < z; se++) U[se] = j[he - z + se]; - for (U[z] = 128, z = 256 - 128 * (z < 112 ? 1 : 0), U[z - 9] = 0, M(U, z - 8, he / 536870912 | 0, he << 3), De(C, G, U, z), se = 0; se < 8; se++) M(k, 8 * se, C[se], G[se]); + function Ce(k, U, z) { + var C = new Int32Array(8), G = new Int32Array(8), j = new Uint8Array(256), se, de = z; + for (C[0] = 1779033703, C[1] = 3144134277, C[2] = 1013904242, C[3] = 2773480762, C[4] = 1359893119, C[5] = 2600822924, C[6] = 528734635, C[7] = 1541459225, G[0] = 4089235720, G[1] = 2227873595, G[2] = 4271175723, G[3] = 1595750129, G[4] = 2917565137, G[5] = 725511199, G[6] = 4215389547, G[7] = 327033209, De(C, G, U, z), z %= 128, se = 0; se < z; se++) j[se] = U[de - z + se]; + for (j[z] = 128, z = 256 - 128 * (z < 112 ? 1 : 0), j[z - 9] = 0, P(j, z - 8, de / 536870912 | 0, de << 3), De(C, G, j, z), se = 0; se < 8; se++) P(k, 8 * se, C[se], G[se]); return 0; } - function $e(k, j) { - var z = r(), C = r(), G = r(), U = r(), se = r(), he = r(), xe = r(), Te = r(), Re = r(); - ce(z, k[1], k[0]), ce(Re, j[1], j[0]), D(z, z, Re), B(C, k[0], k[1]), B(Re, j[0], j[1]), D(C, C, Re), D(G, k[3], j[3]), D(G, G, d), D(U, k[2], j[2]), B(U, U, U), ce(se, C, z), ce(he, U, G), B(xe, U, G), B(Te, C, z), D(k[0], se, he), D(k[1], Te, xe), D(k[2], xe, he), D(k[3], se, Te); + function $e(k, U) { + var z = r(), C = r(), G = r(), j = r(), se = r(), de = r(), xe = r(), Te = r(), Re = r(); + ce(z, k[1], k[0]), ce(Re, U[1], U[0]), D(z, z, Re), F(C, k[0], k[1]), F(Re, U[0], U[1]), D(C, C, Re), D(G, k[3], U[3]), D(G, G, d), D(j, k[2], U[2]), F(j, j, j), ce(se, C, z), ce(de, j, G), F(xe, j, G), F(Te, C, z), D(k[0], se, de), D(k[1], Te, xe), D(k[2], xe, de), D(k[3], se, Te); } - function Me(k, j, z) { + function Me(k, U, z) { var C; for (C = 0; C < 4; C++) - _(k[C], j[C], z); + _(k[C], U[C], z); } - function Ne(k, j) { + function Ne(k, U) { var z = r(), C = r(), G = r(); - Z(G, j[2]), D(z, j[0], G), D(C, j[1], G), E(k, C), k[31] ^= P(z) << 7; + Z(G, U[2]), D(z, U[0], G), D(C, U[1], G), E(k, C), k[31] ^= M(z) << 7; } - function Ke(k, j, z) { + function Ke(k, U, z) { var C, G; for (b(k[0], o), b(k[1], a), b(k[2], a), b(k[3], o), G = 255; G >= 0; --G) - C = z[G / 8 | 0] >> (G & 7) & 1, Me(k, j, C), $e(j, k), $e(k, k), Me(k, j, C); + C = z[G / 8 | 0] >> (G & 7) & 1, Me(k, U, C), $e(U, k), $e(k, k), Me(k, U, C); } - function Le(k, j) { + function Le(k, U) { var z = [r(), r(), r(), r()]; - b(z[0], g), b(z[1], w), b(z[2], a), D(z[3], g, w), Ke(k, z, j); + b(z[0], p), b(z[1], w), b(z[2], a), D(z[3], p, w), Ke(k, z, U); } - function qe(k, j, z) { - var C = new Uint8Array(64), G = [r(), r(), r(), r()], U; - for (z || n(j, 32), Ce(C, j, 32), C[0] &= 248, C[31] &= 127, C[31] |= 64, Le(G, C), Ne(k, G), U = 0; U < 32; U++) j[U + 32] = k[U]; + function qe(k, U, z) { + var C = new Uint8Array(64), G = [r(), r(), r(), r()], j; + for (z || n(U, 32), Ce(C, U, 32), C[0] &= 248, C[31] &= 127, C[31] |= 64, Le(G, C), Ne(k, G), j = 0; j < 32; j++) U[j + 32] = k[j]; return 0; } var ze = new Float64Array([237, 211, 245, 92, 26, 99, 18, 88, 214, 156, 247, 162, 222, 249, 222, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16]); - function _e(k, j) { - var z, C, G, U; + function _e(k, U) { + var z, C, G, j; for (C = 63; C >= 32; --C) { - for (z = 0, G = C - 32, U = C - 12; G < U; ++G) - j[G] += z - 16 * j[C] * ze[G - (C - 32)], z = Math.floor((j[G] + 128) / 256), j[G] -= z * 256; - j[G] += z, j[C] = 0; + for (z = 0, G = C - 32, j = C - 12; G < j; ++G) + U[G] += z - 16 * U[C] * ze[G - (C - 32)], z = Math.floor((U[G] + 128) / 256), U[G] -= z * 256; + U[G] += z, U[C] = 0; } for (z = 0, G = 0; G < 32; G++) - j[G] += z - (j[31] >> 4) * ze[G], z = j[G] >> 8, j[G] &= 255; - for (G = 0; G < 32; G++) j[G] -= z * ze[G]; + U[G] += z - (U[31] >> 4) * ze[G], z = U[G] >> 8, U[G] &= 255; + for (G = 0; G < 32; G++) U[G] -= z * ze[G]; for (C = 0; C < 32; C++) - j[C + 1] += j[C] >> 8, k[C] = j[C] & 255; + U[C + 1] += U[C] >> 8, k[C] = U[C] & 255; } function Ze(k) { - var j = new Float64Array(64), z; - for (z = 0; z < 64; z++) j[z] = k[z]; + var U = new Float64Array(64), z; + for (z = 0; z < 64; z++) U[z] = k[z]; for (z = 0; z < 64; z++) k[z] = 0; - _e(k, j); + _e(k, U); } - function at(k, j, z, C) { - var G = new Uint8Array(64), U = new Uint8Array(64), se = new Uint8Array(64), he, xe, Te = new Float64Array(64), Re = [r(), r(), r(), r()]; + function at(k, U, z, C) { + var G = new Uint8Array(64), j = new Uint8Array(64), se = new Uint8Array(64), de, xe, Te = new Float64Array(64), Re = [r(), r(), r(), r()]; Ce(G, C, 32), G[0] &= 248, G[31] &= 127, G[31] |= 64; var nt = z + 64; - for (he = 0; he < z; he++) k[64 + he] = j[he]; - for (he = 0; he < 32; he++) k[32 + he] = G[32 + he]; - for (Ce(se, k.subarray(32), z + 32), Ze(se), Le(Re, se), Ne(k, Re), he = 32; he < 64; he++) k[he] = C[he]; - for (Ce(U, k, z + 64), Ze(U), he = 0; he < 64; he++) Te[he] = 0; - for (he = 0; he < 32; he++) Te[he] = se[he]; - for (he = 0; he < 32; he++) + for (de = 0; de < z; de++) k[64 + de] = U[de]; + for (de = 0; de < 32; de++) k[32 + de] = G[32 + de]; + for (Ce(se, k.subarray(32), z + 32), Ze(se), Le(Re, se), Ne(k, Re), de = 32; de < 64; de++) k[de] = C[de]; + for (Ce(j, k, z + 64), Ze(j), de = 0; de < 64; de++) Te[de] = 0; + for (de = 0; de < 32; de++) Te[de] = se[de]; + for (de = 0; de < 32; de++) for (xe = 0; xe < 32; xe++) - Te[he + xe] += U[he] * G[xe]; + Te[de + xe] += j[de] * G[xe]; return _e(k.subarray(32), Te), nt; } - function ke(k, j) { - var z = r(), C = r(), G = r(), U = r(), se = r(), he = r(), xe = r(); - return b(k[2], a), I(k[1], j), oe(G, k[1]), D(U, G, l), ce(G, G, k[2]), B(U, k[2], U), oe(se, U), oe(he, se), D(xe, he, se), D(z, xe, G), D(z, z, U), J(z, z), D(z, z, G), D(z, z, U), D(z, z, U), D(k[0], z, U), oe(C, k[0]), D(C, C, U), v(C, G) && D(k[0], k[0], A), oe(C, k[0]), D(C, C, U), v(C, G) ? -1 : (P(k[0]) === j[31] >> 7 && ce(k[0], o, k[0]), D(k[3], k[0], k[1]), 0); + function ke(k, U) { + var z = r(), C = r(), G = r(), j = r(), se = r(), de = r(), xe = r(); + return b(k[2], a), I(k[1], U), oe(G, k[1]), D(j, G, l), ce(G, G, k[2]), F(j, k[2], j), oe(se, j), oe(de, se), D(xe, de, se), D(z, xe, G), D(z, z, j), J(z, z), D(z, z, G), D(z, z, j), D(z, z, j), D(k[0], z, j), oe(C, k[0]), D(C, C, j), v(C, G) && D(k[0], k[0], A), oe(C, k[0]), D(C, C, j), v(C, G) ? -1 : (M(k[0]) === U[31] >> 7 && ce(k[0], o, k[0]), D(k[3], k[0], k[1]), 0); } - function Qe(k, j, z, C) { - var G, U = new Uint8Array(32), se = new Uint8Array(64), he = [r(), r(), r(), r()], xe = [r(), r(), r(), r()]; + function Qe(k, U, z, C) { + var G, j = new Uint8Array(32), se = new Uint8Array(64), de = [r(), r(), r(), r()], xe = [r(), r(), r(), r()]; if (z < 64 || ke(xe, C)) return -1; - for (G = 0; G < z; G++) k[G] = j[G]; + for (G = 0; G < z; G++) k[G] = U[G]; for (G = 0; G < 32; G++) k[G + 32] = C[G]; - if (Ce(se, k, z), Ze(se), Ke(he, xe, se), Le(xe, j.subarray(32)), $e(he, xe), Ne(U, he), z -= 64, $(j, 0, U, 0)) { + if (Ce(se, k, z), Ze(se), Ke(de, xe, se), Le(xe, U.subarray(32)), $e(de, xe), Ne(j, de), z -= 64, $(U, 0, j, 0)) { for (G = 0; G < z; G++) k[G] = 0; return -1; } - for (G = 0; G < z; G++) k[G] = j[G + 64]; + for (G = 0; G < z; G++) k[G] = U[G + 64]; return z; } - var tt = 32, Ye = 24, dt = 32, lt = 16, ct = 32, qt = 32, Yt = 32, Et = 32, Qt = 32, Jt = Ye, Dt = dt, kt = lt, Ct = 64, gt = 32, Rt = 64, Nt = 32, vt = 64; + var tt = 32, Ye = 24, dt = 32, lt = 16, ct = 32, qt = 32, Jt = 32, Et = 32, er = 32, Xt = Ye, Dt = dt, kt = lt, Ct = 64, gt = 32, Rt = 64, Nt = 32, vt = 64; e.lowlevel = { crypto_core_hsalsa20: V, crypto_stream_xor: Ee, - crypto_stream: pe, + crypto_stream: ge, crypto_stream_salsa20_xor: R, - crypto_stream_salsa20: W, + crypto_stream_salsa20: K, crypto_onetimeauth: S, crypto_onetimeauth_verify: m, crypto_verify_16: L, crypto_verify_32: $, crypto_secretbox: f, - crypto_secretbox_open: p, + crypto_secretbox_open: g, crypto_scalarmult: Q, crypto_scalarmult_base: T, crypto_box_beforenm: re, - crypto_box_afternm: de, + crypto_box_afternm: pe, crypto_box: ue, crypto_box_open: ve, crypto_box_keypair: X, @@ -40676,10 +40676,10 @@ var B9 = { exports: {} }; crypto_secretbox_BOXZEROBYTES: lt, crypto_scalarmult_BYTES: ct, crypto_scalarmult_SCALARBYTES: qt, - crypto_box_PUBLICKEYBYTES: Yt, + crypto_box_PUBLICKEYBYTES: Jt, crypto_box_SECRETKEYBYTES: Et, - crypto_box_BEFORENMBYTES: Qt, - crypto_box_NONCEBYTES: Jt, + crypto_box_BEFORENMBYTES: er, + crypto_box_NONCEBYTES: Xt, crypto_box_ZEROBYTES: Dt, crypto_box_BOXZEROBYTES: kt, crypto_sign_BYTES: Ct, @@ -40693,7 +40693,7 @@ var B9 = { exports: {} }; pack25519: E, unpack25519: I, M: D, - A: B, + A: F, S: oe, Z: ce, pow2523: J, @@ -40703,170 +40703,170 @@ var B9 = { exports: {} }; scalarmult: Ke, scalarbase: Le }; - function $t(k, j) { + function $t(k, U) { if (k.length !== tt) throw new Error("bad key size"); - if (j.length !== Ye) throw new Error("bad nonce size"); + if (U.length !== Ye) throw new Error("bad nonce size"); } - function Bt(k, j) { - if (k.length !== Yt) throw new Error("bad public key size"); - if (j.length !== Et) throw new Error("bad secret key size"); + function Ft(k, U) { + if (k.length !== Jt) throw new Error("bad public key size"); + if (U.length !== Et) throw new Error("bad secret key size"); } function rt() { for (var k = 0; k < arguments.length; k++) if (!(arguments[k] instanceof Uint8Array)) throw new TypeError("unexpected type, use Uint8Array"); } - function Ft(k) { - for (var j = 0; j < k.length; j++) k[j] = 0; + function Bt(k) { + for (var U = 0; U < k.length; U++) k[U] = 0; } e.randomBytes = function(k) { - var j = new Uint8Array(k); - return n(j, k), j; - }, e.secretbox = function(k, j, z) { - rt(k, j, z), $t(z, j); - for (var C = new Uint8Array(dt + k.length), G = new Uint8Array(C.length), U = 0; U < k.length; U++) C[U + dt] = k[U]; - return f(G, C, C.length, j, z), G.subarray(lt); - }, e.secretbox.open = function(k, j, z) { - rt(k, j, z), $t(z, j); - for (var C = new Uint8Array(lt + k.length), G = new Uint8Array(C.length), U = 0; U < k.length; U++) C[U + lt] = k[U]; - return C.length < 32 || p(G, C, C.length, j, z) !== 0 ? null : G.subarray(dt); - }, e.secretbox.keyLength = tt, e.secretbox.nonceLength = Ye, e.secretbox.overheadLength = lt, e.scalarMult = function(k, j) { - if (rt(k, j), k.length !== qt) throw new Error("bad n size"); - if (j.length !== ct) throw new Error("bad p size"); + var U = new Uint8Array(k); + return n(U, k), U; + }, e.secretbox = function(k, U, z) { + rt(k, U, z), $t(z, U); + for (var C = new Uint8Array(dt + k.length), G = new Uint8Array(C.length), j = 0; j < k.length; j++) C[j + dt] = k[j]; + return f(G, C, C.length, U, z), G.subarray(lt); + }, e.secretbox.open = function(k, U, z) { + rt(k, U, z), $t(z, U); + for (var C = new Uint8Array(lt + k.length), G = new Uint8Array(C.length), j = 0; j < k.length; j++) C[j + lt] = k[j]; + return C.length < 32 || g(G, C, C.length, U, z) !== 0 ? null : G.subarray(dt); + }, e.secretbox.keyLength = tt, e.secretbox.nonceLength = Ye, e.secretbox.overheadLength = lt, e.scalarMult = function(k, U) { + if (rt(k, U), k.length !== qt) throw new Error("bad n size"); + if (U.length !== ct) throw new Error("bad p size"); var z = new Uint8Array(ct); - return Q(z, k, j), z; + return Q(z, k, U), z; }, e.scalarMult.base = function(k) { if (rt(k), k.length !== qt) throw new Error("bad n size"); - var j = new Uint8Array(ct); - return T(j, k), j; - }, e.scalarMult.scalarLength = qt, e.scalarMult.groupElementLength = ct, e.box = function(k, j, z, C) { + var U = new Uint8Array(ct); + return T(U, k), U; + }, e.scalarMult.scalarLength = qt, e.scalarMult.groupElementLength = ct, e.box = function(k, U, z, C) { var G = e.box.before(z, C); - return e.secretbox(k, j, G); - }, e.box.before = function(k, j) { - rt(k, j), Bt(k, j); - var z = new Uint8Array(Qt); - return re(z, k, j), z; - }, e.box.after = e.secretbox, e.box.open = function(k, j, z, C) { + return e.secretbox(k, U, G); + }, e.box.before = function(k, U) { + rt(k, U), Ft(k, U); + var z = new Uint8Array(er); + return re(z, k, U), z; + }, e.box.after = e.secretbox, e.box.open = function(k, U, z, C) { var G = e.box.before(z, C); - return e.secretbox.open(k, j, G); + return e.secretbox.open(k, U, G); }, e.box.open.after = e.secretbox.open, e.box.keyPair = function() { - var k = new Uint8Array(Yt), j = new Uint8Array(Et); - return X(k, j), { publicKey: k, secretKey: j }; + var k = new Uint8Array(Jt), U = new Uint8Array(Et); + return X(k, U), { publicKey: k, secretKey: U }; }, e.box.keyPair.fromSecretKey = function(k) { if (rt(k), k.length !== Et) throw new Error("bad secret key size"); - var j = new Uint8Array(Yt); - return T(j, k), { publicKey: j, secretKey: new Uint8Array(k) }; - }, e.box.publicKeyLength = Yt, e.box.secretKeyLength = Et, e.box.sharedKeyLength = Qt, e.box.nonceLength = Jt, e.box.overheadLength = e.secretbox.overheadLength, e.sign = function(k, j) { - if (rt(k, j), j.length !== Rt) + var U = new Uint8Array(Jt); + return T(U, k), { publicKey: U, secretKey: new Uint8Array(k) }; + }, e.box.publicKeyLength = Jt, e.box.secretKeyLength = Et, e.box.sharedKeyLength = er, e.box.nonceLength = Xt, e.box.overheadLength = e.secretbox.overheadLength, e.sign = function(k, U) { + if (rt(k, U), U.length !== Rt) throw new Error("bad secret key size"); var z = new Uint8Array(Ct + k.length); - return at(z, k, k.length, j), z; - }, e.sign.open = function(k, j) { - if (rt(k, j), j.length !== gt) + return at(z, k, k.length, U), z; + }, e.sign.open = function(k, U) { + if (rt(k, U), U.length !== gt) throw new Error("bad public key size"); - var z = new Uint8Array(k.length), C = Qe(z, k, k.length, j); + var z = new Uint8Array(k.length), C = Qe(z, k, k.length, U); if (C < 0) return null; - for (var G = new Uint8Array(C), U = 0; U < G.length; U++) G[U] = z[U]; + for (var G = new Uint8Array(C), j = 0; j < G.length; j++) G[j] = z[j]; return G; - }, e.sign.detached = function(k, j) { - for (var z = e.sign(k, j), C = new Uint8Array(Ct), G = 0; G < C.length; G++) C[G] = z[G]; + }, e.sign.detached = function(k, U) { + for (var z = e.sign(k, U), C = new Uint8Array(Ct), G = 0; G < C.length; G++) C[G] = z[G]; return C; - }, e.sign.detached.verify = function(k, j, z) { - if (rt(k, j, z), j.length !== Ct) + }, e.sign.detached.verify = function(k, U, z) { + if (rt(k, U, z), U.length !== Ct) throw new Error("bad signature size"); if (z.length !== gt) throw new Error("bad public key size"); - var C = new Uint8Array(Ct + k.length), G = new Uint8Array(Ct + k.length), U; - for (U = 0; U < Ct; U++) C[U] = j[U]; - for (U = 0; U < k.length; U++) C[U + Ct] = k[U]; + var C = new Uint8Array(Ct + k.length), G = new Uint8Array(Ct + k.length), j; + for (j = 0; j < Ct; j++) C[j] = U[j]; + for (j = 0; j < k.length; j++) C[j + Ct] = k[j]; return Qe(G, C, C.length, z) >= 0; }, e.sign.keyPair = function() { - var k = new Uint8Array(gt), j = new Uint8Array(Rt); - return qe(k, j), { publicKey: k, secretKey: j }; + var k = new Uint8Array(gt), U = new Uint8Array(Rt); + return qe(k, U), { publicKey: k, secretKey: U }; }, e.sign.keyPair.fromSecretKey = function(k) { if (rt(k), k.length !== Rt) throw new Error("bad secret key size"); - for (var j = new Uint8Array(gt), z = 0; z < j.length; z++) j[z] = k[32 + z]; - return { publicKey: j, secretKey: new Uint8Array(k) }; + for (var U = new Uint8Array(gt), z = 0; z < U.length; z++) U[z] = k[32 + z]; + return { publicKey: U, secretKey: new Uint8Array(k) }; }, e.sign.keyPair.fromSeed = function(k) { if (rt(k), k.length !== Nt) throw new Error("bad seed size"); - for (var j = new Uint8Array(gt), z = new Uint8Array(Rt), C = 0; C < 32; C++) z[C] = k[C]; - return qe(j, z, !0), { publicKey: j, secretKey: z }; + for (var U = new Uint8Array(gt), z = new Uint8Array(Rt), C = 0; C < 32; C++) z[C] = k[C]; + return qe(U, z, !0), { publicKey: U, secretKey: z }; }, e.sign.publicKeyLength = gt, e.sign.secretKeyLength = Rt, e.sign.seedLength = Nt, e.sign.signatureLength = Ct, e.hash = function(k) { rt(k); - var j = new Uint8Array(vt); - return Ce(j, k, k.length), j; - }, e.hash.hashLength = vt, e.verify = function(k, j) { - return rt(k, j), k.length === 0 || j.length === 0 || k.length !== j.length ? !1 : N(k, 0, j, 0, k.length) === 0; + var U = new Uint8Array(vt); + return Ce(U, k, k.length), U; + }, e.hash.hashLength = vt, e.verify = function(k, U) { + return rt(k, U), k.length === 0 || U.length === 0 || k.length !== U.length ? !1 : N(k, 0, U, 0, k.length) === 0; }, e.setPRNG = function(k) { n = k; }, function() { var k = typeof self < "u" ? self.crypto || self.msCrypto : null; if (k && k.getRandomValues) { - var j = 65536; + var U = 65536; e.setPRNG(function(z, C) { - var G, U = new Uint8Array(C); - for (G = 0; G < C; G += j) - k.getRandomValues(U.subarray(G, G + Math.min(C - G, j))); - for (G = 0; G < C; G++) z[G] = U[G]; - Ft(U); + var G, j = new Uint8Array(C); + for (G = 0; G < C; G += U) + k.getRandomValues(j.subarray(G, G + Math.min(C - G, U))); + for (G = 0; G < C; G++) z[G] = j[G]; + Bt(j); }); - } else typeof A4 < "u" && (k = zl, k && k.randomBytes && e.setPRNG(function(z, C) { - var G, U = k.randomBytes(C); - for (G = 0; G < C; G++) z[G] = U[G]; - Ft(U); + } else typeof M4 < "u" && (k = Wl, k && k.randomBytes && e.setPRNG(function(z, C) { + var G, j = k.randomBytes(C); + for (G = 0; G < C; G++) z[G] = j[G]; + Bt(j); })); }(); })(t.exports ? t.exports : self.nacl = self.nacl || {}); -})(B9); -var aie = B9.exports; -const bd = /* @__PURE__ */ ts(aie); -var ua; +})(K9); +var fie = K9.exports; +const yd = /* @__PURE__ */ rs(fie); +var ha; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.MANIFEST_NOT_FOUND_ERROR = 2] = "MANIFEST_NOT_FOUND_ERROR", t[t.MANIFEST_CONTENT_ERROR = 3] = "MANIFEST_CONTENT_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(ua || (ua = {})); -var l5; +})(ha || (ha = {})); +var d5; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(l5 || (l5 = {})); -var iu; +})(d5 || (d5 = {})); +var su; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(iu || (iu = {})); -var h5; +})(su || (su = {})); +var p5; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(h5 || (h5 = {})); -var d5; +})(p5 || (p5 = {})); +var g5; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(d5 || (d5 = {})); -var p5; +})(g5 || (g5 = {})); +var m5; (function(t) { t.MAINNET = "-239", t.TESTNET = "-3"; -})(p5 || (p5 = {})); -function cie(t, e) { - const r = Rl.encodeBase64(t); +})(m5 || (m5 = {})); +function lie(t, e) { + const r = Dl.encodeBase64(t); return e ? encodeURIComponent(r) : r; } -function uie(t, e) { - return e && (t = decodeURIComponent(t)), Rl.decodeBase64(t); +function hie(t, e) { + return e && (t = decodeURIComponent(t)), Dl.decodeBase64(t); } -function fie(t, e = !1) { +function die(t, e = !1) { let r; - return t instanceof Uint8Array ? r = t : (typeof t != "string" && (t = JSON.stringify(t)), r = Rl.decodeUTF8(t)), cie(r, e); + return t instanceof Uint8Array ? r = t : (typeof t != "string" && (t = JSON.stringify(t)), r = Dl.decodeUTF8(t)), lie(r, e); } -function lie(t, e = !1) { - const r = uie(t, e); +function pie(t, e = !1) { + const r = hie(t, e); return { toString() { - return Rl.encodeUTF8(r); + return Dl.encodeUTF8(r); }, toObject() { try { - return JSON.parse(Rl.encodeUTF8(r)); + return JSON.parse(Dl.encodeUTF8(r)); } catch { return null; } @@ -40876,15 +40876,15 @@ function lie(t, e = !1) { } }; } -const U9 = { - encode: fie, - decode: lie +const V9 = { + encode: die, + decode: pie }; -function hie(t, e) { +function gie(t, e) { const r = new Uint8Array(t.length + e.length); return r.set(t), r.set(e, t.length), r; } -function die(t, e) { +function mie(t, e) { if (e >= t.length) throw new Error("Index is out of buffer"); const r = t.slice(0, e), n = t.slice(e); @@ -40896,7 +40896,7 @@ function Km(t) { e += ("0" + (r & 255).toString(16)).slice(-2); }), e; } -function S0(t) { +function A0(t) { if (t.length % 2 !== 0) throw new Error(`Cannot convert ${t} to bytesArray`); const e = new Uint8Array(t.length / 2); @@ -40909,23 +40909,23 @@ class hv { this.nonceLength = 24, this.keyPair = e ? this.createKeypairFromString(e) : this.createKeypair(), this.sessionId = Km(this.keyPair.publicKey); } createKeypair() { - return bd.box.keyPair(); + return yd.box.keyPair(); } createKeypairFromString(e) { return { - publicKey: S0(e.publicKey), - secretKey: S0(e.secretKey) + publicKey: A0(e.publicKey), + secretKey: A0(e.secretKey) }; } createNonce() { - return bd.randomBytes(this.nonceLength); + return yd.randomBytes(this.nonceLength); } encrypt(e, r) { - const n = new TextEncoder().encode(e), i = this.createNonce(), s = bd.box(n, i, r, this.keyPair.secretKey); - return hie(i, s); + const n = new TextEncoder().encode(e), i = this.createNonce(), s = yd.box(n, i, r, this.keyPair.secretKey); + return gie(i, s); } decrypt(e, r) { - const [n, i] = die(e, this.nonceLength), s = bd.box.open(i, n, r, this.keyPair.secretKey); + const [n, i] = mie(e, this.nonceLength), s = yd.box.open(i, n, r, this.keyPair.secretKey); if (!s) throw new Error(`Decryption error: message: ${e.toString()} @@ -40955,7 +40955,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ -function pie(t, e) { +function vie(t, e) { var r = {}; for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); if (t != null && typeof Object.getOwnPropertySymbols == "function") @@ -40973,15 +40973,15 @@ function Mt(t, e, r, n) { function a(d) { try { l(n.next(d)); - } catch (g) { - o(g); + } catch (p) { + o(p); } } function u(d) { try { l(n.throw(d)); - } catch (g) { - o(g); + } catch (p) { + o(p); } } function l(d) { @@ -40990,131 +40990,131 @@ function Mt(t, e, r, n) { l((n = n.apply(t, [])).next()); }); } -class Ut extends Error { +class jt extends Error { constructor(e, r) { - super(e, r), this.message = `${Ut.prefix} ${this.constructor.name}${this.info ? ": " + this.info : ""}${e ? ` -` + e : ""}`, Object.setPrototypeOf(this, Ut.prototype); + super(e, r), this.message = `${jt.prefix} ${this.constructor.name}${this.info ? ": " + this.info : ""}${e ? ` +` + e : ""}`, Object.setPrototypeOf(this, jt.prototype); } get info() { return ""; } } -Ut.prefix = "[TON_CONNECT_SDK_ERROR]"; -class uy extends Ut { +jt.prefix = "[TON_CONNECT_SDK_ERROR]"; +class ly extends jt { get info() { return "Passed DappMetadata is in incorrect format."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, uy.prototype); + super(...e), Object.setPrototypeOf(this, ly.prototype); } } -class Sp extends Ut { +class Ap extends jt { get info() { return "Passed `tonconnect-manifest.json` contains errors. Check format of your manifest. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, Sp.prototype); + super(...e), Object.setPrototypeOf(this, Ap.prototype); } } -class Ap extends Ut { +class Pp extends jt { get info() { return "Manifest not found. Make sure you added `tonconnect-manifest.json` to the root of your app or passed correct manifestUrl. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, Ap.prototype); + super(...e), Object.setPrototypeOf(this, Pp.prototype); } } -class fy extends Ut { +class hy extends jt { get info() { return "Wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, fy.prototype); + super(...e), Object.setPrototypeOf(this, hy.prototype); } } -class A0 extends Ut { +class P0 extends jt { get info() { return "Send transaction or other protocol methods called while wallet is not connected."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, A0.prototype); + super(...e), Object.setPrototypeOf(this, P0.prototype); } } -function gie(t) { +function bie(t) { return "jsBridgeKey" in t; } -class Pp extends Ut { +class Mp extends jt { get info() { return "User rejects the action in the wallet."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, Pp.prototype); + super(...e), Object.setPrototypeOf(this, Mp.prototype); } } -class Mp extends Ut { +class Ip extends jt { get info() { return "Request to the wallet contains errors."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, Mp.prototype); + super(...e), Object.setPrototypeOf(this, Ip.prototype); } } -class Ip extends Ut { +class Cp extends jt { get info() { return "App tries to send rpc request to the injected wallet while not connected."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, Ip.prototype); + super(...e), Object.setPrototypeOf(this, Cp.prototype); } } -class ly extends Ut { +class dy extends jt { get info() { return "There is an attempt to connect to the injected wallet while it is not exists in the webpage."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, ly.prototype); + super(...e), Object.setPrototypeOf(this, dy.prototype); } } -class hy extends Ut { +class py extends jt { get info() { return "An error occurred while fetching the wallets list."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, hy.prototype); + super(...e), Object.setPrototypeOf(this, py.prototype); } } -class Ea extends Ut { +class Pa extends jt { constructor(...e) { - super(...e), Object.setPrototypeOf(this, Ea.prototype); + super(...e), Object.setPrototypeOf(this, Pa.prototype); } } -const g5 = { - [ua.UNKNOWN_ERROR]: Ea, - [ua.USER_REJECTS_ERROR]: Pp, - [ua.BAD_REQUEST_ERROR]: Mp, - [ua.UNKNOWN_APP_ERROR]: Ip, - [ua.MANIFEST_NOT_FOUND_ERROR]: Ap, - [ua.MANIFEST_CONTENT_ERROR]: Sp +const v5 = { + [ha.UNKNOWN_ERROR]: Pa, + [ha.USER_REJECTS_ERROR]: Mp, + [ha.BAD_REQUEST_ERROR]: Ip, + [ha.UNKNOWN_APP_ERROR]: Cp, + [ha.MANIFEST_NOT_FOUND_ERROR]: Pp, + [ha.MANIFEST_CONTENT_ERROR]: Ap }; -class mie { +class yie { parseError(e) { - let r = Ea; - return e.code in g5 && (r = g5[e.code] || Ea), new r(e.message); + let r = Pa; + return e.code in v5 && (r = v5[e.code] || Pa), new r(e.message); } } -const vie = new mie(); -class bie { +const wie = new yie(); +class xie { isError(e) { return "error" in e; } } -const m5 = { - [iu.UNKNOWN_ERROR]: Ea, - [iu.USER_REJECTS_ERROR]: Pp, - [iu.BAD_REQUEST_ERROR]: Mp, - [iu.UNKNOWN_APP_ERROR]: Ip +const b5 = { + [su.UNKNOWN_ERROR]: Pa, + [su.USER_REJECTS_ERROR]: Mp, + [su.BAD_REQUEST_ERROR]: Ip, + [su.UNKNOWN_APP_ERROR]: Cp }; -class yie extends bie { +class _ie extends xie { convertToRpcRequest(e) { return { method: "sendTransaction", @@ -41122,8 +41122,8 @@ class yie extends bie { }; } parseAndThrowError(e) { - let r = Ea; - throw e.error.code in m5 && (r = m5[e.error.code] || Ea), new r(e.error.message); + let r = Pa; + throw e.error.code in b5 && (r = b5[e.error.code] || Pa), new r(e.error.message); } convertFromRpcResponse(e) { return { @@ -41131,8 +41131,8 @@ class yie extends bie { }; } } -const yd = new yie(); -class wie { +const wd = new _ie(); +class Eie { constructor(e, r) { this.storage = e, this.storeKey = "ton-connect-storage_http-bridge-gateway::" + r; } @@ -41153,54 +41153,54 @@ class wie { }); } } -function xie(t) { +function Sie(t) { return t.slice(-1) === "/" ? t.slice(0, -1) : t; } -function j9(t, e) { - return xie(t) + "/" + e; +function G9(t, e) { + return Sie(t) + "/" + e; } -function _ie(t) { +function Aie(t) { if (!t) return !1; const e = new URL(t); return e.protocol === "tg:" || e.hostname === "t.me"; } -function Eie(t) { +function Pie(t) { return t.replaceAll(".", "%2E").replaceAll("-", "%2D").replaceAll("_", "%5F").replaceAll("&", "-").replaceAll("=", "__").replaceAll("%", "--"); } -function q9(t, e) { +function Y9(t, e) { return Mt(this, void 0, void 0, function* () { return new Promise((r, n) => { var i, s; if (!((i = void 0) === null || i === void 0) && i.aborted) { - n(new Ut("Delay aborted")); + n(new jt("Delay aborted")); return; } const o = setTimeout(() => r(), t); (s = void 0) === null || s === void 0 || s.addEventListener("abort", () => { - clearTimeout(o), n(new Ut("Delay aborted")); + clearTimeout(o), n(new jt("Delay aborted")); }); }); }); } -function xs(t) { +function _s(t) { const e = new AbortController(); return t != null && t.aborted ? e.abort() : t == null || t.addEventListener("abort", () => e.abort(), { once: !0 }), e; } -function Xf(t, e) { +function Zf(t, e) { var r, n; return Mt(this, void 0, void 0, function* () { - const i = (r = e == null ? void 0 : e.attempts) !== null && r !== void 0 ? r : 10, s = (n = e == null ? void 0 : e.delayMs) !== null && n !== void 0 ? n : 200, o = xs(e == null ? void 0 : e.signal); + const i = (r = e == null ? void 0 : e.attempts) !== null && r !== void 0 ? r : 10, s = (n = e == null ? void 0 : e.delayMs) !== null && n !== void 0 ? n : 200, o = _s(e == null ? void 0 : e.signal); if (typeof t != "function") - throw new Ut(`Expected a function, got ${typeof t}`); + throw new jt(`Expected a function, got ${typeof t}`); let a = 0, u; for (; a < i; ) { if (o.signal.aborted) - throw new Ut(`Aborted after attempts ${a}`); + throw new jt(`Aborted after attempts ${a}`); try { return yield t({ signal: o.signal }); } catch (l) { - u = l, a++, a < i && (yield q9(s)); + u = l, a++, a < i && (yield Y9(s)); } } throw u; @@ -41212,37 +41212,37 @@ function Sn(...t) { } catch { } } -function Oo(...t) { +function Lo(...t) { try { console.error("[TON_CONNECT_SDK]", ...t); } catch { } } -function Sie(...t) { +function Mie(...t) { try { console.warn("[TON_CONNECT_SDK]", ...t); } catch { } } -function Aie(t, e) { +function Iie(t, e) { let r = null, n = null, i = null, s = null, o = null; - const a = (g, ...w) => Mt(this, void 0, void 0, function* () { - if (s = g ?? null, o == null || o.abort(), o = xs(g), o.signal.aborted) - throw new Ut("Resource creation was aborted"); + const a = (p, ...w) => Mt(this, void 0, void 0, function* () { + if (s = p ?? null, o == null || o.abort(), o = _s(p), o.signal.aborted) + throw new jt("Resource creation was aborted"); n = w ?? null; const A = t(o.signal, ...w); i = A; - const M = yield A; - if (i !== A && M !== r) - throw yield e(M), new Ut("Resource creation was aborted by a new resource creation"); - return r = M, r; + const P = yield A; + if (i !== A && P !== r) + throw yield e(P), new jt("Resource creation was aborted by a new resource creation"); + return r = P, r; }); return { create: a, current: () => r ?? null, dispose: () => Mt(this, void 0, void 0, function* () { try { - const g = r; + const p = r; r = null; const w = i; i = null; @@ -41251,32 +41251,32 @@ function Aie(t, e) { } catch { } yield Promise.allSettled([ - g ? e(g) : Promise.resolve(), + p ? e(p) : Promise.resolve(), w ? e(yield w) : Promise.resolve() ]); } catch { } }), - recreate: (g) => Mt(this, void 0, void 0, function* () { - const w = r, A = i, M = n, N = s; - if (yield q9(g), w === r && A === i && M === n && N === s) - return yield a(s, ...M ?? []); - throw new Ut("Resource recreation was aborted by a new resource creation"); + recreate: (p) => Mt(this, void 0, void 0, function* () { + const w = r, A = i, P = n, N = s; + if (yield Y9(p), w === r && A === i && P === n && N === s) + return yield a(s, ...P ?? []); + throw new jt("Resource recreation was aborted by a new resource creation"); }) }; } -function Pie(t, e) { - const r = e == null ? void 0 : e.timeout, n = e == null ? void 0 : e.signal, i = xs(n); +function Cie(t, e) { + const r = e == null ? void 0 : e.timeout, n = e == null ? void 0 : e.signal, i = _s(n); return new Promise((s, o) => Mt(this, void 0, void 0, function* () { if (i.signal.aborted) { - o(new Ut("Operation aborted")); + o(new jt("Operation aborted")); return; } let a; typeof r < "u" && (a = setTimeout(() => { - i.abort(), o(new Ut(`Timeout after ${r}ms`)); + i.abort(), o(new jt(`Timeout after ${r}ms`)); }, r)), i.signal.addEventListener("abort", () => { - clearTimeout(a), o(new Ut("Operation aborted")); + clearTimeout(a), o(new jt("Operation aborted")); }, { once: !0 }); const u = { timeout: r, abort: i.signal }; yield t((...l) => { @@ -41288,7 +41288,7 @@ function Pie(t, e) { } class Vm { constructor(e, r, n, i, s) { - this.bridgeUrl = r, this.sessionId = n, this.listener = i, this.errorsListener = s, this.ssePath = "events", this.postPath = "message", this.heartbeatMessage = "heartbeat", this.defaultTtl = 300, this.defaultReconnectDelay = 2e3, this.defaultResendDelay = 5e3, this.eventSource = Aie((o, a) => Mt(this, void 0, void 0, function* () { + this.bridgeUrl = r, this.sessionId = n, this.listener = i, this.errorsListener = s, this.ssePath = "events", this.postPath = "message", this.heartbeatMessage = "heartbeat", this.defaultTtl = 300, this.defaultReconnectDelay = 2e3, this.defaultResendDelay = 5e3, this.eventSource = Iie((o, a) => Mt(this, void 0, void 0, function* () { const u = { bridgeUrl: this.bridgeUrl, ssePath: this.ssePath, @@ -41299,10 +41299,10 @@ class Vm { signal: o, openingDeadlineMS: a }; - return yield Mie(u); + return yield Tie(u); }), (o) => Mt(this, void 0, void 0, function* () { o.close(); - })), this.bridgeGatewayStorage = new wie(e, r); + })), this.bridgeGatewayStorage = new Eie(e, r); } get isReady() { const e = this.eventSource.current(); @@ -41326,13 +41326,13 @@ class Vm { return Mt(this, void 0, void 0, function* () { const o = {}; typeof i == "number" ? o.ttl = i : (o.ttl = i == null ? void 0 : i.ttl, o.signal = i == null ? void 0 : i.signal, o.attempts = i == null ? void 0 : i.attempts); - const a = new URL(j9(this.bridgeUrl, this.postPath)); + const a = new URL(G9(this.bridgeUrl, this.postPath)); a.searchParams.append("client_id", this.sessionId), a.searchParams.append("to", r), a.searchParams.append("ttl", ((o == null ? void 0 : o.ttl) || this.defaultTtl).toString()), a.searchParams.append("topic", n); - const u = U9.encode(e); - yield Xf((l) => Mt(this, void 0, void 0, function* () { + const u = V9.encode(e); + yield Zf((l) => Mt(this, void 0, void 0, function* () { const d = yield this.post(a, u, l.signal); if (!d.ok) - throw new Ut(`Bridge send failed, status ${d.status}`); + throw new jt(`Bridge send failed, status ${d.status}`); }), { attempts: (s = o == null ? void 0 : o.attempts) !== null && s !== void 0 ? s : Number.MAX_SAFE_INTEGER, delayMs: this.defaultResendDelay, @@ -41341,7 +41341,7 @@ class Vm { }); } pause() { - this.eventSource.dispose().catch((e) => Oo(`Bridge pause failed, ${e}`)); + this.eventSource.dispose().catch((e) => Lo(`Bridge pause failed, ${e}`)); } unPause() { return Mt(this, void 0, void 0, function* () { @@ -41350,7 +41350,7 @@ class Vm { } close() { return Mt(this, void 0, void 0, function* () { - yield this.eventSource.dispose().catch((e) => Oo(`Bridge close failed, ${e}`)); + yield this.eventSource.dispose().catch((e) => Lo(`Bridge close failed, ${e}`)); }); } setListener(e) { @@ -41367,14 +41367,14 @@ class Vm { signal: n }); if (!i.ok) - throw new Ut(`Bridge send failed, status ${i.status}`); + throw new jt(`Bridge send failed, status ${i.status}`); return i; }); } errorsHandler(e, r) { return Mt(this, void 0, void 0, function* () { if (this.isConnecting) - throw e.close(), new Ut("Bridge error, failed to connect"); + throw e.close(), new jt("Bridge error, failed to connect"); if (this.isReady) { try { this.errorsListener(r); @@ -41384,7 +41384,7 @@ class Vm { } if (this.isClosed) return e.close(), Sn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`), yield this.eventSource.recreate(this.defaultReconnectDelay); - throw new Ut("Bridge error, unknown state"); + throw new jt("Bridge error, unknown state"); }); } messagesHandler(e) { @@ -41395,62 +41395,62 @@ class Vm { try { r = JSON.parse(e.data); } catch (n) { - throw new Ut(`Bridge message parse failed, message ${n.data}`); + throw new jt(`Bridge message parse failed, message ${n.data}`); } this.listener(r); }); } } -function Mie(t) { +function Tie(t) { return Mt(this, void 0, void 0, function* () { - return yield Pie((e, r, n) => Mt(this, void 0, void 0, function* () { + return yield Cie((e, r, n) => Mt(this, void 0, void 0, function* () { var i; - const o = xs(n.signal).signal; + const o = _s(n.signal).signal; if (o.aborted) { - r(new Ut("Bridge connection aborted")); + r(new jt("Bridge connection aborted")); return; } - const a = new URL(j9(t.bridgeUrl, t.ssePath)); + const a = new URL(G9(t.bridgeUrl, t.ssePath)); a.searchParams.append("client_id", t.sessionId); const u = yield t.bridgeGatewayStorage.getLastEventId(); if (u && a.searchParams.append("last_event_id", u), o.aborted) { - r(new Ut("Bridge connection aborted")); + r(new jt("Bridge connection aborted")); return; } const l = new EventSource(a.toString()); l.onerror = (d) => Mt(this, void 0, void 0, function* () { if (o.aborted) { - l.close(), r(new Ut("Bridge connection aborted")); + l.close(), r(new jt("Bridge connection aborted")); return; } try { - const g = yield t.errorHandler(l, d); - g !== l && l.close(), g && g !== l && e(g); - } catch (g) { - l.close(), r(g); + const p = yield t.errorHandler(l, d); + p !== l && l.close(), p && p !== l && e(p); + } catch (p) { + l.close(), r(p); } }), l.onopen = () => { if (o.aborted) { - l.close(), r(new Ut("Bridge connection aborted")); + l.close(), r(new jt("Bridge connection aborted")); return; } e(l); }, l.onmessage = (d) => { if (o.aborted) { - l.close(), r(new Ut("Bridge connection aborted")); + l.close(), r(new jt("Bridge connection aborted")); return; } t.messageHandler(d); }, (i = t.signal) === null || i === void 0 || i.addEventListener("abort", () => { - l.close(), r(new Ut("Bridge connection aborted")); + l.close(), r(new jt("Bridge connection aborted")); }); }), { timeout: t.openingDeadlineMS, signal: t.signal }); }); } -function Zf(t) { +function Qf(t) { return !("connectEvent" in t); } -class Dl { +class Ol { constructor(e) { this.storage = e, this.storeKey = "ton-connect-storage_bridge-connection"; } @@ -41458,7 +41458,7 @@ class Dl { return Mt(this, void 0, void 0, function* () { if (e.type === "injected") return this.storage.setItem(this.storeKey, JSON.stringify(e)); - if (!Zf(e)) { + if (!Qf(e)) { const n = { sessionKeyPair: e.session.sessionCrypto.stringifyKeypair(), walletPublicKey: e.session.walletPublicKey, @@ -41518,9 +41518,9 @@ class Dl { return Mt(this, void 0, void 0, function* () { const e = yield this.getConnection(); if (!e) - throw new Ut("Trying to read HTTP connection source while nothing is stored"); + throw new jt("Trying to read HTTP connection source while nothing is stored"); if (e.type === "injected") - throw new Ut("Trying to read HTTP connection source while injected connection is stored"); + throw new jt("Trying to read HTTP connection source while injected connection is stored"); return e; }); } @@ -41528,11 +41528,11 @@ class Dl { return Mt(this, void 0, void 0, function* () { const e = yield this.getConnection(); if (!e) - throw new Ut("Trying to read HTTP connection source while nothing is stored"); + throw new jt("Trying to read HTTP connection source while nothing is stored"); if (e.type === "injected") - throw new Ut("Trying to read HTTP connection source while injected connection is stored"); - if (!Zf(e)) - throw new Ut("Trying to read HTTP-pending connection while http connection is stored"); + throw new jt("Trying to read HTTP connection source while injected connection is stored"); + if (!Qf(e)) + throw new jt("Trying to read HTTP-pending connection while http connection is stored"); return e; }); } @@ -41540,9 +41540,9 @@ class Dl { return Mt(this, void 0, void 0, function* () { const e = yield this.getConnection(); if (!e) - throw new Ut("Trying to read Injected bridge connection source while nothing is stored"); + throw new jt("Trying to read Injected bridge connection source while nothing is stored"); if ((e == null ? void 0 : e.type) === "http") - throw new Ut("Trying to read Injected bridge connection source while HTTP connection is stored"); + throw new jt("Trying to read Injected bridge connection source while HTTP connection is stored"); return e; }); } @@ -41555,7 +41555,7 @@ class Dl { storeLastWalletEventId(e) { return Mt(this, void 0, void 0, function* () { const r = yield this.getConnection(); - if (r && r.type === "http" && !Zf(r)) + if (r && r.type === "http" && !Qf(r)) return r.lastWalletEventId = e, this.storeConnection(r); }); } @@ -41582,20 +41582,20 @@ class Dl { }); } } -const z9 = 2; -class Ol { +const J9 = 2; +class Nl { constructor(e, r) { - this.storage = e, this.walletConnectionSource = r, this.type = "http", this.standardUniversalLink = "tc://", this.pendingRequests = /* @__PURE__ */ new Map(), this.session = null, this.gateway = null, this.pendingGateways = [], this.listeners = [], this.defaultOpeningDeadlineMS = 12e3, this.defaultRetryTimeoutMS = 2e3, this.connectionStorage = new Dl(e); + this.storage = e, this.walletConnectionSource = r, this.type = "http", this.standardUniversalLink = "tc://", this.pendingRequests = /* @__PURE__ */ new Map(), this.session = null, this.gateway = null, this.pendingGateways = [], this.listeners = [], this.defaultOpeningDeadlineMS = 12e3, this.defaultRetryTimeoutMS = 2e3, this.connectionStorage = new Ol(e); } static fromStorage(e) { return Mt(this, void 0, void 0, function* () { - const n = yield new Dl(e).getHttpConnection(); - return Zf(n) ? new Ol(e, n.connectionSource) : new Ol(e, { bridgeUrl: n.session.bridgeUrl }); + const n = yield new Ol(e).getHttpConnection(); + return Qf(n) ? new Nl(e, n.connectionSource) : new Nl(e, { bridgeUrl: n.session.bridgeUrl }); }); } connect(e, r) { var n; - const i = xs(r == null ? void 0 : r.signal); + const i = _s(r == null ? void 0 : r.signal); (n = this.abortController) === null || n === void 0 || n.abort(), this.abortController = i, this.closeGateways(); const s = new hv(); this.session = { @@ -41606,7 +41606,7 @@ class Ol { connectionSource: this.walletConnectionSource, sessionCrypto: s }).then(() => Mt(this, void 0, void 0, function* () { - i.signal.aborted || (yield Xf((a) => { + i.signal.aborted || (yield Zf((a) => { var u; return this.openGateways(s, { openingDeadlineMS: (u = r == null ? void 0 : r.openingDeadlineMS) !== null && u !== void 0 ? u : this.defaultOpeningDeadlineMS, @@ -41624,7 +41624,7 @@ class Ol { restoreConnection(e) { var r, n; return Mt(this, void 0, void 0, function* () { - const i = xs(e == null ? void 0 : e.signal); + const i = _s(e == null ? void 0 : e.signal); if ((r = this.abortController) === null || r === void 0 || r.abort(), this.abortController = i, i.signal.aborted) return; this.closeGateways(); @@ -41632,7 +41632,7 @@ class Ol { if (!s || i.signal.aborted) return; const o = (n = e == null ? void 0 : e.openingDeadlineMS) !== null && n !== void 0 ? n : this.defaultOpeningDeadlineMS; - if (Zf(s)) + if (Qf(s)) return this.session = { sessionCrypto: s.sessionCrypto, bridgeUrl: "bridgeUrl" in this.walletConnectionSource ? this.walletConnectionSource.bridgeUrl : "" @@ -41641,11 +41641,11 @@ class Ol { signal: i == null ? void 0 : i.signal }); if (Array.isArray(this.walletConnectionSource)) - throw new Ut("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected."); + throw new jt("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected."); if (this.session = s.session, this.gateway && (Sn("Gateway is already opened, closing previous gateway"), yield this.gateway.close()), this.gateway = new Vm(this.storage, this.walletConnectionSource.bridgeUrl, s.session.sessionCrypto.sessionId, this.gatewayListener.bind(this), this.gatewayErrorsListener.bind(this)), !i.signal.aborted) { this.listeners.forEach((a) => a(s.connectEvent)); try { - yield Xf((a) => this.gateway.registerSession({ + yield Zf((a) => this.gateway.registerSession({ openingDeadlineMS: o, signal: a.signal }), { @@ -41665,10 +41665,10 @@ class Ol { return typeof r == "function" ? n.onRequestSent = r : (n.onRequestSent = r == null ? void 0 : r.onRequestSent, n.signal = r == null ? void 0 : r.signal, n.attempts = r == null ? void 0 : r.attempts), new Promise((i, s) => Mt(this, void 0, void 0, function* () { var o; if (!this.gateway || !this.session || !("walletPublicKey" in this.session)) - throw new Ut("Trying to send bridge request without session"); + throw new jt("Trying to send bridge request without session"); const a = (yield this.connectionStorage.getNextRpcRequestId()).toString(); yield this.connectionStorage.increaseNextRpcRequestId(), Sn("Send http-bridge request:", Object.assign(Object.assign({}, e), { id: a })); - const u = this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({}, e), { id: a })), S0(this.session.walletPublicKey)); + const u = this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({}, e), { id: a })), A0(this.session.walletPublicKey)); try { yield this.gateway.send(u, this.session.walletPublicKey, e.method, { attempts: n == null ? void 0 : n.attempts, signal: n == null ? void 0 : n.signal }), (o = n == null ? void 0 : n.onRequestSent) === null || o === void 0 || o.call(n), this.pendingRequests.set(a.toString(), i); } catch (l) { @@ -41688,7 +41688,7 @@ class Ol { }; try { this.closeGateways(); - const o = xs(e == null ? void 0 : e.signal); + const o = _s(e == null ? void 0 : e.signal); i = setTimeout(() => { o.abort(); }, this.defaultOpeningDeadlineMS), yield this.sendRequest({ method: "disconnect", params: [] }, { @@ -41728,7 +41728,7 @@ class Ol { } gatewayListener(e) { return Mt(this, void 0, void 0, function* () { - const r = JSON.parse(this.session.sessionCrypto.decrypt(U9.decode(e.message).toUint8Array(), S0(e.from))); + const r = JSON.parse(this.session.sessionCrypto.decrypt(V9.decode(e.message).toUint8Array(), A0(e.from))); if (Sn("Wallet message received:", r), !("event" in r)) { const i = r.id.toString(), s = this.pendingRequests.get(i); if (!s) { @@ -41741,7 +41741,7 @@ class Ol { if (r.id !== void 0) { const i = yield this.connectionStorage.getLastWalletEventId(); if (i !== void 0 && r.id <= i) { - Oo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `); + Lo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `); return; } r.event !== "connect" && (yield this.connectionStorage.storeLastWalletEventId(r.id)); @@ -41752,7 +41752,7 @@ class Ol { } gatewayErrorsListener(e) { return Mt(this, void 0, void 0, function* () { - throw new Ut(`Bridge error ${JSON.stringify(e)}`); + throw new jt(`Bridge error ${JSON.stringify(e)}`); }); } updateSession(e, r) { @@ -41774,14 +41774,14 @@ class Ol { }); } generateUniversalLink(e, r) { - return _ie(e) ? this.generateTGUniversalLink(e, r) : this.generateRegularUniversalLink(e, r); + return Aie(e) ? this.generateTGUniversalLink(e, r) : this.generateRegularUniversalLink(e, r); } generateRegularUniversalLink(e, r) { const n = new URL(e); - return n.searchParams.append("v", z9.toString()), n.searchParams.append("id", this.session.sessionCrypto.sessionId), n.searchParams.append("r", JSON.stringify(r)), n.toString(); + return n.searchParams.append("v", J9.toString()), n.searchParams.append("id", this.session.sessionCrypto.sessionId), n.searchParams.append("r", JSON.stringify(r)), n.toString(); } generateTGUniversalLink(e, r) { - const i = this.generateRegularUniversalLink("about:blank", r).split("?")[1], s = "tonconnect-" + Eie(i), o = this.convertToDirectLink(e), a = new URL(o); + const i = this.generateRegularUniversalLink("about:blank", r).split("?")[1], s = "tonconnect-" + Pie(i), o = this.convertToDirectLink(e), a = new URL(o); return a.searchParams.append("startapp", s), a.toString(); } // TODO: Remove this method after all dApps and the wallets-list.json have been updated @@ -41797,7 +41797,7 @@ class Ol { }, () => { }); return i.setListener((s) => this.pendingGatewaysListener(i, n.bridgeUrl, s)), i; - }), yield Promise.allSettled(this.pendingGateways.map((n) => Xf((i) => { + }), yield Promise.allSettled(this.pendingGateways.map((n) => Zf((i) => { var s; return this.pendingGateways.some((o) => o === n) ? n.registerSession({ openingDeadlineMS: (s = r == null ? void 0 : r.openingDeadlineMS) !== null && s !== void 0 ? s : this.defaultOpeningDeadlineMS, @@ -41821,15 +41821,15 @@ class Ol { (r = this.gateway) === null || r === void 0 || r.close(), this.pendingGateways.filter((n) => n !== (e == null ? void 0 : e.except)).forEach((n) => n.close()), this.pendingGateways = []; } } -function v5(t, e) { - return H9(t, [e]); +function y5(t, e) { + return X9(t, [e]); } -function H9(t, e) { +function X9(t, e) { return !t || typeof t != "object" ? !1 : e.every((r) => r in t); } -function Iie(t) { +function Rie(t) { try { - return !v5(t, "tonconnect") || !v5(t.tonconnect, "walletInfo") ? !1 : H9(t.tonconnect.walletInfo, [ + return !y5(t, "tonconnect") || !y5(t.tonconnect, "walletInfo") ? !1 : X9(t.tonconnect.walletInfo, [ "name", "app_name", "image", @@ -41840,12 +41840,12 @@ function Iie(t) { return !1; } } -class su { +class ou { constructor() { this.storage = {}; } static getInstance() { - return su.instance || (su.instance = new su()), su.instance; + return ou.instance || (ou.instance = new ou()), ou.instance; } get length() { return Object.keys(this.storage).length; @@ -41869,12 +41869,12 @@ class su { this.storage[e] = r; } } -function Cp() { +function Tp() { if (!(typeof window > "u")) return window; } -function Cie() { - const t = Cp(); +function Die() { + const t = Tp(); if (!t) return []; try { @@ -41883,54 +41883,54 @@ function Cie() { return []; } } -function Tie() { +function Oie() { if (!(typeof document > "u")) return document; } -function Rie() { +function Nie() { var t; - const e = (t = Cp()) === null || t === void 0 ? void 0 : t.location.origin; + const e = (t = Tp()) === null || t === void 0 ? void 0 : t.location.origin; return e ? e + "/tonconnect-manifest.json" : ""; } -function Die() { - if (Oie()) +function Lie() { + if (kie()) return localStorage; - if (Nie()) - throw new Ut("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector"); - return su.getInstance(); + if ($ie()) + throw new jt("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector"); + return ou.getInstance(); } -function Oie() { +function kie() { try { return typeof localStorage < "u"; } catch { return !1; } } -function Nie() { +function $ie() { return typeof process < "u" && process.versions != null && process.versions.node != null; } -class mi { +class vi { constructor(e, r) { this.injectedWalletKey = r, this.type = "injected", this.unsubscribeCallback = null, this.listenSubscriptions = !1, this.listeners = []; - const n = mi.window; - if (!mi.isWindowContainsWallet(n, r)) - throw new ly(); - this.connectionStorage = new Dl(e), this.injectedWallet = n[r].tonconnect; + const n = vi.window; + if (!vi.isWindowContainsWallet(n, r)) + throw new dy(); + this.connectionStorage = new Ol(e), this.injectedWallet = n[r].tonconnect; } static fromStorage(e) { return Mt(this, void 0, void 0, function* () { - const n = yield new Dl(e).getInjectedConnection(); - return new mi(e, n.jsBridgeKey); + const n = yield new Ol(e).getInjectedConnection(); + return new vi(e, n.jsBridgeKey); }); } static isWalletInjected(e) { - return mi.isWindowContainsWallet(this.window, e); + return vi.isWindowContainsWallet(this.window, e); } static isInsideWalletBrowser(e) { - return mi.isWindowContainsWallet(this.window, e) ? this.window[e].tonconnect.isWalletBrowser : !1; + return vi.isWindowContainsWallet(this.window, e) ? this.window[e].tonconnect.isWalletBrowser : !1; } static getCurrentlyInjectedWallets() { - return this.window ? Cie().filter(([n, i]) => Iie(i)).map(([n, i]) => ({ + return this.window ? Die().filter(([n, i]) => Rie(i)).map(([n, i]) => ({ name: i.tonconnect.walletInfo.name, appName: i.tonconnect.walletInfo.app_name, aboutUrl: i.tonconnect.walletInfo.about_url, @@ -41946,7 +41946,7 @@ class mi { return !!e && r in e && typeof e[r] == "object" && "tonconnect" in e[r]; } connect(e) { - this._connect(z9, e); + this._connect(J9, e); } restoreConnection() { return Mt(this, void 0, void 0, function* () { @@ -42029,10 +42029,10 @@ class mi { }); } } -mi.window = Cp(); -class Lie { +vi.window = Tp(); +class Bie { constructor() { - this.localStorage = Die(); + this.localStorage = Lie(); } getItem(e) { return Mt(this, void 0, void 0, function* () { @@ -42050,16 +42050,16 @@ class Lie { }); } } -function W9(t) { - return $ie(t) && t.injected; +function Z9(t) { + return jie(t) && t.injected; } -function kie(t) { - return W9(t) && t.embedded; +function Fie(t) { + return Z9(t) && t.embedded; } -function $ie(t) { +function jie(t) { return "jsBridgeKey" in t; } -const Fie = [ +const Uie = [ { app_name: "telegram-wallet", name: "Wallet", @@ -42274,7 +42274,7 @@ class dv { } getEmbeddedWallet() { return Mt(this, void 0, void 0, function* () { - const r = (yield this.getWallets()).filter(kie); + const r = (yield this.getWallets()).filter(Fie); return r.length !== 1 ? null : r[0]; }); } @@ -42283,17 +42283,17 @@ class dv { let e = []; try { if (e = yield (yield fetch(this.walletsListSource)).json(), !Array.isArray(e)) - throw new hy("Wrong wallets list format, wallets list must be an array."); + throw new py("Wrong wallets list format, wallets list must be an array."); const i = e.filter((s) => !this.isCorrectWalletConfigDTO(s)); - i.length && (Oo(`Wallet(s) ${i.map((s) => s.name).join(", ")} config format is wrong. They were removed from the wallets list.`), e = e.filter((s) => this.isCorrectWalletConfigDTO(s))); + i.length && (Lo(`Wallet(s) ${i.map((s) => s.name).join(", ")} config format is wrong. They were removed from the wallets list.`), e = e.filter((s) => this.isCorrectWalletConfigDTO(s))); } catch (n) { - Oo(n), e = Fie; + Lo(n), e = Uie; } let r = []; try { - r = mi.getCurrentlyInjectedWallets(); + r = vi.getCurrentlyInjectedWallets(); } catch (n) { - Oo(n); + Lo(n); } return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e), r); }); @@ -42311,7 +42311,7 @@ class dv { return r.bridge.forEach((s) => { if (s.type === "sse" && (i.bridgeUrl = s.url, i.universalLink = r.universal_url, i.deepLink = r.deepLink), s.type === "js") { const o = s.key; - i.jsBridgeKey = o, i.injected = mi.isWalletInjected(o), i.embedded = mi.isInsideWalletBrowser(o); + i.jsBridgeKey = o, i.injected = vi.isWalletInjected(o), i.embedded = vi.isInsideWalletBrowser(o); } }), i; }); @@ -42339,89 +42339,89 @@ class dv { return !(l && (!("key" in l) || !l.key)); } } -class P0 extends Ut { +class M0 extends jt { get info() { return "Wallet doesn't support requested feature method."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, P0.prototype); + super(...e), Object.setPrototypeOf(this, M0.prototype); } } -function Bie(t, e) { +function qie(t, e) { const r = t.includes("SendTransaction"), n = t.find((i) => i && typeof i == "object" && i.name === "SendTransaction"); if (!r && !n) - throw new P0("Wallet doesn't support SendTransaction feature."); + throw new M0("Wallet doesn't support SendTransaction feature."); if (n && n.maxMessages !== void 0) { if (n.maxMessages < e.requiredMessagesNumber) - throw new P0(`Wallet is not able to handle such SendTransaction request. Max support messages number is ${n.maxMessages}, but ${e.requiredMessagesNumber} is required.`); + throw new M0(`Wallet is not able to handle such SendTransaction request. Max support messages number is ${n.maxMessages}, but ${e.requiredMessagesNumber} is required.`); return; } - Sie("Connected wallet didn't provide information about max allowed messages in the SendTransaction request. Request may be rejected by the wallet."); + Mie("Connected wallet didn't provide information about max allowed messages in the SendTransaction request. Request may be rejected by the wallet."); } -function Uie() { +function zie() { return { type: "request-version" }; } -function jie(t) { +function Wie(t) { return { type: "response-version", version: t }; } -function Gu(t) { +function Yu(t) { return { ton_connect_sdk_lib: t.ton_connect_sdk_lib, ton_connect_ui_lib: t.ton_connect_ui_lib }; } -function Yu(t, e) { +function Ju(t, e) { var r, n, i, s, o, a, u, l; - const g = ((r = e == null ? void 0 : e.connectItems) === null || r === void 0 ? void 0 : r.tonProof) && "proof" in e.connectItems.tonProof ? "ton_proof" : "ton_addr"; + const p = ((r = e == null ? void 0 : e.connectItems) === null || r === void 0 ? void 0 : r.tonProof) && "proof" in e.connectItems.tonProof ? "ton_proof" : "ton_addr"; return { wallet_address: (i = (n = e == null ? void 0 : e.account) === null || n === void 0 ? void 0 : n.address) !== null && i !== void 0 ? i : null, wallet_type: (s = e == null ? void 0 : e.device.appName) !== null && s !== void 0 ? s : null, wallet_version: (o = e == null ? void 0 : e.device.appVersion) !== null && o !== void 0 ? o : null, - auth_type: g, - custom_data: Object.assign({ chain_id: (u = (a = e == null ? void 0 : e.account) === null || a === void 0 ? void 0 : a.chain) !== null && u !== void 0 ? u : null, provider: (l = e == null ? void 0 : e.provider) !== null && l !== void 0 ? l : null }, Gu(t)) + auth_type: p, + custom_data: Object.assign({ chain_id: (u = (a = e == null ? void 0 : e.account) === null || a === void 0 ? void 0 : a.chain) !== null && u !== void 0 ? u : null, provider: (l = e == null ? void 0 : e.provider) !== null && l !== void 0 ? l : null }, Yu(t)) }; } -function qie(t) { +function Hie(t) { return { type: "connection-started", - custom_data: Gu(t) + custom_data: Yu(t) }; } -function zie(t, e) { - return Object.assign({ type: "connection-completed", is_success: !0 }, Yu(t, e)); +function Kie(t, e) { + return Object.assign({ type: "connection-completed", is_success: !0 }, Ju(t, e)); } -function Hie(t, e, r) { +function Vie(t, e, r) { return { type: "connection-error", is_success: !1, error_message: e, error_code: r ?? null, - custom_data: Gu(t) + custom_data: Yu(t) }; } -function Wie(t) { +function Gie(t) { return { type: "connection-restoring-started", - custom_data: Gu(t) + custom_data: Yu(t) }; } -function Kie(t, e) { - return Object.assign({ type: "connection-restoring-completed", is_success: !0 }, Yu(t, e)); +function Yie(t, e) { + return Object.assign({ type: "connection-restoring-completed", is_success: !0 }, Ju(t, e)); } -function Vie(t, e) { +function Jie(t, e) { return { type: "connection-restoring-error", is_success: !1, error_message: e, - custom_data: Gu(t) + custom_data: Yu(t) }; } -function dy(t, e) { +function gy(t, e) { var r, n, i, s; return { valid_until: (r = String(e.validUntil)) !== null && r !== void 0 ? r : null, @@ -42435,21 +42435,21 @@ function dy(t, e) { }) }; } -function Gie(t, e, r) { - return Object.assign(Object.assign({ type: "transaction-sent-for-signature" }, Yu(t, e)), dy(e, r)); +function Xie(t, e, r) { + return Object.assign(Object.assign({ type: "transaction-sent-for-signature" }, Ju(t, e)), gy(e, r)); } -function Yie(t, e, r, n) { - return Object.assign(Object.assign({ type: "transaction-signed", is_success: !0, signed_transaction: n.boc }, Yu(t, e)), dy(e, r)); +function Zie(t, e, r, n) { + return Object.assign(Object.assign({ type: "transaction-signed", is_success: !0, signed_transaction: n.boc }, Ju(t, e)), gy(e, r)); } -function Jie(t, e, r, n, i) { - return Object.assign(Object.assign({ type: "transaction-signing-failed", is_success: !1, error_message: n, error_code: i ?? null }, Yu(t, e)), dy(e, r)); +function Qie(t, e, r, n, i) { + return Object.assign(Object.assign({ type: "transaction-signing-failed", is_success: !1, error_message: n, error_code: i ?? null }, Ju(t, e)), gy(e, r)); } -function Xie(t, e, r) { - return Object.assign({ type: "disconnection", scope: r }, Yu(t, e)); +function ese(t, e, r) { + return Object.assign({ type: "disconnection", scope: r }, Ju(t, e)); } -class Zie { +class tse { constructor() { - this.window = Cp(); + this.window = Tp(); } /** * Dispatches an event with the given name and details to the browser window. @@ -42481,16 +42481,16 @@ class Zie { }); } } -class Qie { +class rse { constructor(e) { var r; - this.eventPrefix = "ton-connect-", this.tonConnectUiVersion = null, this.eventDispatcher = (r = e == null ? void 0 : e.eventDispatcher) !== null && r !== void 0 ? r : new Zie(), this.tonConnectSdkVersion = e.tonConnectSdkVersion, this.init().catch(); + this.eventPrefix = "ton-connect-", this.tonConnectUiVersion = null, this.eventDispatcher = (r = e == null ? void 0 : e.eventDispatcher) !== null && r !== void 0 ? r : new tse(), this.tonConnectSdkVersion = e.tonConnectSdkVersion, this.init().catch(); } /** * Version of the library. */ get version() { - return Gu({ + return Yu({ ton_connect_sdk_lib: this.tonConnectSdkVersion, ton_connect_ui_lib: this.tonConnectUiVersion }); @@ -42513,7 +42513,7 @@ class Qie { setRequestVersionHandler() { return Mt(this, void 0, void 0, function* () { yield this.eventDispatcher.addEventListener("ton-connect-request-version", () => Mt(this, void 0, void 0, function* () { - yield this.eventDispatcher.dispatchEvent("ton-connect-response-version", jie(this.tonConnectSdkVersion)); + yield this.eventDispatcher.dispatchEvent("ton-connect-response-version", Wie(this.tonConnectSdkVersion)); })); }); } @@ -42527,7 +42527,7 @@ class Qie { try { yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version", (n) => { e(n.detail.version); - }, { once: !0 }), yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version", Uie()); + }, { once: !0 }), yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version", zie()); } catch (n) { r(n); } @@ -42551,7 +42551,7 @@ class Qie { */ trackConnectionStarted(...e) { try { - const r = qie(this.version, ...e); + const r = Hie(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42562,7 +42562,7 @@ class Qie { */ trackConnectionCompleted(...e) { try { - const r = zie(this.version, ...e); + const r = Kie(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42573,7 +42573,7 @@ class Qie { */ trackConnectionError(...e) { try { - const r = Hie(this.version, ...e); + const r = Vie(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42584,7 +42584,7 @@ class Qie { */ trackConnectionRestoringStarted(...e) { try { - const r = Wie(this.version, ...e); + const r = Gie(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42595,7 +42595,7 @@ class Qie { */ trackConnectionRestoringCompleted(...e) { try { - const r = Kie(this.version, ...e); + const r = Yie(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42606,7 +42606,7 @@ class Qie { */ trackConnectionRestoringError(...e) { try { - const r = Vie(this.version, ...e); + const r = Jie(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42617,7 +42617,7 @@ class Qie { */ trackDisconnection(...e) { try { - const r = Xie(this.version, ...e); + const r = ese(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42628,7 +42628,7 @@ class Qie { */ trackTransactionSentForSignature(...e) { try { - const r = Gie(this.version, ...e); + const r = Xie(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42639,7 +42639,7 @@ class Qie { */ trackTransactionSigned(...e) { try { - const r = Yie(this.version, ...e); + const r = Zie(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42650,27 +42650,27 @@ class Qie { */ trackTransactionSigningFailed(...e) { try { - const r = Jie(this.version, ...e); + const r = Qie(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } } } -const ese = "3.0.5"; -class Tp { +const nse = "3.0.5"; +class fh { constructor(e) { if (this.walletsList = new dv(), this._wallet = null, this.provider = null, this.statusChangeSubscriptions = [], this.statusChangeErrorSubscriptions = [], this.dappSettings = { - manifestUrl: (e == null ? void 0 : e.manifestUrl) || Rie(), - storage: (e == null ? void 0 : e.storage) || new Lie() + manifestUrl: (e == null ? void 0 : e.manifestUrl) || Nie(), + storage: (e == null ? void 0 : e.storage) || new Bie() }, this.walletsList = new dv({ walletsListSource: e == null ? void 0 : e.walletsListSource, cacheTTLMs: e == null ? void 0 : e.walletsListCacheTTLMs - }), this.tracker = new Qie({ + }), this.tracker = new rse({ eventDispatcher: e == null ? void 0 : e.eventDispatcher, - tonConnectSdkVersion: ese + tonConnectSdkVersion: nse }), !this.dappSettings.manifestUrl) - throw new uy("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"); - this.bridgeConnectionStorage = new Dl(this.dappSettings.storage), e != null && e.disableAutoPauseConnection || this.addWindowFocusAndBlurSubscriptions(); + throw new ly("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"); + this.bridgeConnectionStorage = new Ol(this.dappSettings.storage), e != null && e.disableAutoPauseConnection || this.addWindowFocusAndBlurSubscriptions(); } /** * Returns available wallets list. @@ -42721,10 +42721,10 @@ class Tp { var n, i; const s = {}; if (typeof r == "object" && "tonProof" in r && (s.request = r), typeof r == "object" && ("openingDeadlineMS" in r || "signal" in r || "request" in r) && (s.request = r == null ? void 0 : r.request, s.openingDeadlineMS = r == null ? void 0 : r.openingDeadlineMS, s.signal = r == null ? void 0 : r.signal), this.connected) - throw new fy(); - const o = xs(s == null ? void 0 : s.signal); + throw new hy(); + const o = _s(s == null ? void 0 : s.signal); if ((n = this.abortController) === null || n === void 0 || n.abort(), this.abortController = o, o.signal.aborted) - throw new Ut("Connection was aborted"); + throw new jt("Connection was aborted"); return (i = this.provider) === null || i === void 0 || i.closeConnection(), this.provider = this.createProvider(e), o.signal.addEventListener("abort", () => { var a; (a = this.provider) === null || a === void 0 || a.closeConnection(), this.provider = null; @@ -42740,7 +42740,7 @@ class Tp { var r, n; return Mt(this, void 0, void 0, function* () { this.tracker.trackConnectionRestoringStarted(); - const i = xs(e == null ? void 0 : e.signal); + const i = _s(e == null ? void 0 : e.signal); if ((r = this.abortController) === null || r === void 0 || r.abort(), this.abortController = i, i.signal.aborted) { this.tracker.trackConnectionRestoringError("Connection restoring was aborted"); return; @@ -42757,10 +42757,10 @@ class Tp { try { switch (s) { case "http": - a = yield Ol.fromStorage(this.dappSettings.storage); + a = yield Nl.fromStorage(this.dappSettings.storage); break; case "injected": - a = yield mi.fromStorage(this.dappSettings.storage); + a = yield vi.fromStorage(this.dappSettings.storage); break; default: if (o) @@ -42777,7 +42777,7 @@ class Tp { return; } if (!a) { - Oo("Provider is not restored"), this.tracker.trackConnectionRestoringError("Provider is not restored"); + Lo("Provider is not restored"), this.tracker.trackConnectionRestoringError("Provider is not restored"); return; } (n = this.provider) === null || n === void 0 || n.closeConnection(), this.provider = a, a.listen(this.walletEventsListener.bind(this)); @@ -42785,17 +42785,17 @@ class Tp { this.tracker.trackConnectionRestoringError("Connection restoring was aborted"), a == null || a.closeConnection(), a = null; }; i.signal.addEventListener("abort", u); - const l = Xf((g) => Mt(this, void 0, void 0, function* () { + const l = Zf((p) => Mt(this, void 0, void 0, function* () { yield a == null ? void 0 : a.restoreConnection({ openingDeadlineMS: e == null ? void 0 : e.openingDeadlineMS, - signal: g.signal + signal: p.signal }), i.signal.removeEventListener("abort", u), this.connected ? this.tracker.trackConnectionRestoringCompleted(this.wallet) : this.tracker.trackConnectionRestoringError("Connection restoring failed"); }), { attempts: Number.MAX_SAFE_INTEGER, delayMs: 2e3, signal: e == null ? void 0 : e.signal }), d = new Promise( - (g) => setTimeout(() => g(), 12e3) + (p) => setTimeout(() => p(), 12e3) // connection deadline ); return Promise.race([l, d]); @@ -42805,20 +42805,20 @@ class Tp { return Mt(this, void 0, void 0, function* () { const n = {}; typeof r == "function" ? n.onRequestSent = r : (n.onRequestSent = r == null ? void 0 : r.onRequestSent, n.signal = r == null ? void 0 : r.signal); - const i = xs(n == null ? void 0 : n.signal); + const i = _s(n == null ? void 0 : n.signal); if (i.signal.aborted) - throw new Ut("Transaction sending was aborted"); - this.checkConnection(), Bie(this.wallet.device.features, { + throw new jt("Transaction sending was aborted"); + this.checkConnection(), qie(this.wallet.device.features, { requiredMessagesNumber: e.messages.length }), this.tracker.trackTransactionSentForSignature(this.wallet, e); - const { validUntil: s } = e, o = pie(e, ["validUntil"]), a = e.from || this.account.address, u = e.network || this.account.chain, l = yield this.provider.sendRequest(yd.convertToRpcRequest(Object.assign(Object.assign({}, o), { + const { validUntil: s } = e, o = vie(e, ["validUntil"]), a = e.from || this.account.address, u = e.network || this.account.chain, l = yield this.provider.sendRequest(wd.convertToRpcRequest(Object.assign(Object.assign({}, o), { valid_until: s, from: a, network: u })), { onRequestSent: n.onRequestSent, signal: i.signal }); - if (yd.isError(l)) - return this.tracker.trackTransactionSigningFailed(this.wallet, e, l.error.message, l.error.code), yd.parseAndThrowError(l); - const d = yd.convertFromRpcResponse(l); + if (wd.isError(l)) + return this.tracker.trackTransactionSigningFailed(this.wallet, e, l.error.message, l.error.code), wd.parseAndThrowError(l); + const d = wd.convertFromRpcResponse(l); return this.tracker.trackTransactionSigned(this.wallet, e, d), d; }); } @@ -42829,10 +42829,10 @@ class Tp { var r; return Mt(this, void 0, void 0, function* () { if (!this.connected) - throw new A0(); - const n = xs(e == null ? void 0 : e.signal), i = this.abortController; + throw new P0(); + const n = _s(e == null ? void 0 : e.signal), i = this.abortController; if (this.abortController = n, n.signal.aborted) - throw new Ut("Disconnect was aborted"); + throw new jt("Disconnect was aborted"); this.onWalletDisconnected("dapp"), yield (r = this.provider) === null || r === void 0 ? void 0 : r.disconnect({ signal: n.signal }), i == null || i.abort(); @@ -42854,19 +42854,19 @@ class Tp { return ((e = this.provider) === null || e === void 0 ? void 0 : e.type) !== "http" ? Promise.resolve() : this.provider.unPause(); } addWindowFocusAndBlurSubscriptions() { - const e = Tie(); + const e = Oie(); if (e) try { e.addEventListener("visibilitychange", () => { e.hidden ? this.pauseConnection() : this.unPauseConnection().catch(); }); } catch (r) { - Oo("Cannot subscribe to the document.visibilitychange: ", r); + Lo("Cannot subscribe to the document.visibilitychange: ", r); } } createProvider(e) { let r; - return !Array.isArray(e) && gie(e) ? r = new mi(this.dappSettings.storage, e.jsBridgeKey) : r = new Ol(this.dappSettings.storage, e), r.listen(this.walletEventsListener.bind(this)), r; + return !Array.isArray(e) && bie(e) ? r = new vi(this.dappSettings.storage, e.jsBridgeKey) : r = new Nl(this.dappSettings.storage, e), r.listen(this.walletEventsListener.bind(this)), r; } walletEventsListener(e) { switch (e.event) { @@ -42883,7 +42883,7 @@ class Tp { onWalletConnected(e) { const r = e.items.find((s) => s.name === "ton_addr"), n = e.items.find((s) => s.name === "ton_proof"); if (!r) - throw new Ut("ton_addr connection item was not found"); + throw new jt("ton_addr connection item was not found"); const i = { device: e.device, provider: this.provider.type, @@ -42899,16 +42899,16 @@ class Tp { }), this.wallet = i, this.tracker.trackConnectionCompleted(i); } onWalletConnectError(e) { - const r = vie.parseError(e); - if (this.statusChangeErrorSubscriptions.forEach((n) => n(r)), Sn(r), this.tracker.trackConnectionError(e.message, e.code), r instanceof Ap || r instanceof Sp) - throw Oo(r), r; + const r = wie.parseError(e); + if (this.statusChangeErrorSubscriptions.forEach((n) => n(r)), Sn(r), this.tracker.trackConnectionError(e.message, e.code), r instanceof Pp || r instanceof Ap) + throw Lo(r), r; } onWalletDisconnected(e) { this.tracker.trackDisconnection(this.wallet, e), this.wallet = null; } checkConnection() { if (!this.connected) - throw new A0(); + throw new P0(); } createConnectRequest(e) { const r = [ @@ -42925,47 +42925,47 @@ class Tp { }; } } -Tp.walletsList = new dv(); -Tp.isWalletInjected = (t) => mi.isWalletInjected(t); -Tp.isInsideWalletBrowser = (t) => mi.isInsideWalletBrowser(t); +fh.walletsList = new dv(); +fh.isWalletInjected = (t) => vi.isWalletInjected(t); +fh.isInsideWalletBrowser = (t) => vi.isInsideWalletBrowser(t); for (let t = 0; t <= 255; t++) { let e = t.toString(16); e.length < 2 && (e = "0" + e); } function Gm(t) { const { children: e, onClick: r } = t; - return /* @__PURE__ */ me.jsx("button", { onClick: r, className: "xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center", children: e }); -} -function tse(t) { - const { wallet: e, connector: r, loading: n } = t, i = bi(null), s = bi(), [o, a] = fr(), [u, l] = fr(), [d, g] = fr("connect"), [w, A] = fr(!1), [M, N] = fr(); - function L(W) { - var pe; - (pe = s.current) == null || pe.update({ - data: W + return /* @__PURE__ */ fe.jsx("button", { onClick: r, className: "xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center", children: e }); +} +function Q9(t) { + const { wallet: e, connector: r, loading: n } = t, i = oi(null), s = oi(), [o, a] = Gt(), [u, l] = Gt(), [d, p] = Gt("connect"), [w, A] = Gt(!1), [P, N] = Gt(); + function L(K) { + var ge; + (ge = s.current) == null || ge.update({ + data: K }); } async function $() { A(!0); try { a(""); - const W = await ya.getNonce({ account_type: "block_chain" }); + const K = await qo.getNonce({ account_type: "block_chain" }); if ("universalLink" in e && e.universalLink) { - const pe = r.connect({ + const ge = r.connect({ universalLink: e.universalLink, bridgeUrl: e.bridgeUrl }, { - request: { tonProof: W } + request: { tonProof: K } }); - if (!pe) return; - N(pe), L(pe), l(W); + if (!ge) return; + N(ge), L(ge), l(K); } - } catch (W) { - a(W.message); + } catch (K) { + a(K.message); } A(!1); } - function F() { - s.current = new L9({ + function B() { + s.current = new B9({ width: 264, height: 264, margin: 0, @@ -42982,56 +42982,56 @@ function tse(t) { } }), s.current.append(i.current); } - function K() { + function H() { r.connect(e, { request: { tonProof: u } }); } - function H() { + function W() { if ("deepLink" in e) { - if (!e.deepLink || !M) return; - const W = new URL(M), pe = `${e.deepLink}${W.search}`; - window.open(pe); + if (!e.deepLink || !P) return; + const K = new URL(P), ge = `${e.deepLink}${K.search}`; + window.open(ge); } } function V() { - "universalLink" in e && e.universalLink && /t.me/.test(e.universalLink) && window.open(M); - } - const te = Oi(() => !!("deepLink" in e && e.deepLink), [e]), R = Oi(() => !!("universalLink" in e && e.universalLink && /t.me/.test(e.universalLink)), [e]); - return Xn(() => { - F(), $(); - }, []), /* @__PURE__ */ me.jsxs(Ac, { children: [ - /* @__PURE__ */ me.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ me.jsx(uh, { title: "Connect wallet", onBack: t.onBack }) }), - /* @__PURE__ */ me.jsxs("div", { className: "xc-text-center xc-mb-6", children: [ - /* @__PURE__ */ me.jsxs("div", { className: "xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1", children: [ - /* @__PURE__ */ me.jsx("div", { className: "xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center", ref: i }), - /* @__PURE__ */ me.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: w ? /* @__PURE__ */ me.jsx(gc, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ me.jsx("img", { className: "xc-h-10 xc-w-10 xc-rounded-md", src: e.imageUrl }) }) + "universalLink" in e && e.universalLink && /t.me/.test(e.universalLink) && window.open(P); + } + const te = Ni(() => !!("deepLink" in e && e.deepLink), [e]), R = Ni(() => !!("universalLink" in e && e.universalLink && /t.me/.test(e.universalLink)), [e]); + return Dn(() => { + B(), $(); + }, []), /* @__PURE__ */ fe.jsxs(so, { children: [ + /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ fe.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), + /* @__PURE__ */ fe.jsxs("div", { className: "xc-text-center xc-mb-6", children: [ + /* @__PURE__ */ fe.jsxs("div", { className: "xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1", children: [ + /* @__PURE__ */ fe.jsx("div", { className: "xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center", ref: i }), + /* @__PURE__ */ fe.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: w ? /* @__PURE__ */ fe.jsx(_a, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ fe.jsx("img", { className: "xc-h-10 xc-w-10 xc-rounded-md", src: e.imageUrl }) }) ] }), - /* @__PURE__ */ me.jsx("p", { className: "xc-text-center", children: "Scan the QR code below with your phone's camera. " }) + /* @__PURE__ */ fe.jsx("p", { className: "xc-text-center", children: "Scan the QR code below with your phone's camera. " }) ] }), - /* @__PURE__ */ me.jsxs("div", { className: "xc-flex xc-justify-center xc-gap-2", children: [ - n && /* @__PURE__ */ me.jsx(gc, { className: "xc-animate-spin" }), - !w && !n && /* @__PURE__ */ me.jsxs(me.Fragment, { children: [ - W9(e) && /* @__PURE__ */ me.jsxs(Gm, { onClick: K, children: [ - /* @__PURE__ */ me.jsx(iZ, { className: "xc-opacity-80" }), + /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-justify-center xc-gap-2", children: [ + n && /* @__PURE__ */ fe.jsx(_a, { className: "xc-animate-spin" }), + !w && !n && /* @__PURE__ */ fe.jsxs(fe.Fragment, { children: [ + Z9(e) && /* @__PURE__ */ fe.jsxs(Gm, { onClick: H, children: [ + /* @__PURE__ */ fe.jsx(pZ, { className: "xc-opacity-80" }), "Extension" ] }), - te && /* @__PURE__ */ me.jsxs(Gm, { onClick: H, children: [ - /* @__PURE__ */ me.jsx(HS, { className: "xc-opacity-80" }), + te && /* @__PURE__ */ fe.jsxs(Gm, { onClick: W, children: [ + /* @__PURE__ */ fe.jsx(KS, { className: "xc-opacity-80" }), "Desktop" ] }), - R && /* @__PURE__ */ me.jsx(Gm, { onClick: V, children: "Telegram Mini App" }) + R && /* @__PURE__ */ fe.jsx(Gm, { onClick: V, children: "Telegram Mini App" }) ] }) ] }) ] }); } -function rse(t) { - const [e, r] = fr(""), [n, i] = fr(), [s, o] = fr(), a = cy(), [u, l] = fr(!1); +function ise(t) { + const [e, r] = Gt(""), [n, i] = Gt(), [s, o] = Gt(), a = fy(), [u, l] = Gt(!1); async function d(w) { - var M, N; - if (!w || !((M = w.connectItems) != null && M.tonProof)) return; + var P, N; + if (!w || !((P = w.connectItems) != null && P.tonProof)) return; l(!0); - const A = await ya.tonLogin({ + const A = await qo.tonLogin({ account_type: "block_chain", connector: "codatta_ton", account_enum: "C", @@ -43051,26 +43051,26 @@ function rse(t) { }); await t.onLogin(A.data), l(!1); } - Xn(() => { - const w = new Tp({ + Dn(() => { + const w = new fh({ manifestUrl: "https://static.codatta.io/static/tonconnect-manifest.json?v=2" }), A = w.onStatusChange(d); return o(w), r("select"), A; }, []); - function g(w) { + function p(w) { r("connect"), i(w); } - return /* @__PURE__ */ me.jsxs(Ac, { children: [ - e === "select" && /* @__PURE__ */ me.jsx( - sie, + return /* @__PURE__ */ fe.jsxs(so, { children: [ + e === "select" && /* @__PURE__ */ fe.jsx( + W9, { connector: s, - onSelect: g, + onSelect: p, onBack: t.onBack } ), - e === "connect" && /* @__PURE__ */ me.jsx( - tse, + e === "connect" && /* @__PURE__ */ fe.jsx( + Q9, { connector: s, wallet: n, @@ -43080,8 +43080,8 @@ function rse(t) { ) ] }); } -function nse(t) { - const { children: e, className: r } = t, n = bi(null), [i, s] = pv.useState(0); +function eA(t) { + const { children: e, className: r } = t, n = oi(null), [i, s] = pv.useState(0); function o() { var a; try { @@ -43094,12 +43094,12 @@ function nse(t) { console.error(u); } } - return Xn(() => { + return Dn(() => { const a = new MutationObserver(o); return a.observe(n.current, { childList: !0, subtree: !0 }), () => a.disconnect(); - }, []), Xn(() => { + }, []), Dn(() => { console.log("maxHeight", i); - }, [i]), /* @__PURE__ */ me.jsx( + }, [i]), /* @__PURE__ */ fe.jsx( "div", { ref: n, @@ -43113,46 +43113,46 @@ function nse(t) { } ); } -function ise() { - return /* @__PURE__ */ me.jsxs("svg", { width: "121", height: "120", viewBox: "0 0 121 120", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [ - /* @__PURE__ */ me.jsx("rect", { x: "0.5", width: "120", height: "120", rx: "60", fill: "#404049" }), - /* @__PURE__ */ me.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z", fill: "#252532" }), - /* @__PURE__ */ me.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z", fill: "#252532" }), - /* @__PURE__ */ me.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z", fill: "#404049" }), - /* @__PURE__ */ me.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z", stroke: "#77777D", "stroke-width": "2" }), - /* @__PURE__ */ me.jsx("path", { d: "M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829", stroke: "#77777D", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) +function sse() { + return /* @__PURE__ */ fe.jsxs("svg", { width: "121", height: "120", viewBox: "0 0 121 120", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [ + /* @__PURE__ */ fe.jsx("rect", { x: "0.5", width: "120", height: "120", rx: "60", fill: "#404049" }), + /* @__PURE__ */ fe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z", fill: "#252532" }), + /* @__PURE__ */ fe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z", fill: "#252532" }), + /* @__PURE__ */ fe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z", fill: "#404049" }), + /* @__PURE__ */ fe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z", stroke: "#77777D", "stroke-width": "2" }), + /* @__PURE__ */ fe.jsx("path", { d: "M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829", stroke: "#77777D", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) ] }); } -function sse(t) { - const { wallets: e } = gp(), [r, n] = fr(), i = Oi(() => r ? e.filter((a) => a.key.toLowerCase().includes(r.toLowerCase())) : e, [r]); +function tA(t) { + const { wallets: e } = mp(), [r, n] = Gt(), i = Ni(() => r ? e.filter((a) => a.key.toLowerCase().includes(r.toLowerCase())) : e, [r]); function s(a) { t.onSelectWallet(a); } function o(a) { n(a.target.value); } - return /* @__PURE__ */ me.jsxs(Ac, { children: [ - /* @__PURE__ */ me.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ me.jsx(uh, { title: "Select wallet", onBack: t.onBack }) }), - /* @__PURE__ */ me.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ - /* @__PURE__ */ me.jsx(WS, { className: "xc-shrink-0 xc-opacity-50" }), - /* @__PURE__ */ me.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: o }) + return /* @__PURE__ */ fe.jsxs(so, { children: [ + /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ fe.jsx(Pc, { title: "Select wallet", onBack: t.onBack }) }), + /* @__PURE__ */ fe.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ + /* @__PURE__ */ fe.jsx(GS, { className: "xc-shrink-0 xc-opacity-50" }), + /* @__PURE__ */ fe.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: o }) ] }), - /* @__PURE__ */ me.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: i.length ? i.map((a) => /* @__PURE__ */ me.jsx( - b9, + /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: i.length ? i.map((a) => /* @__PURE__ */ fe.jsx( + x9, { wallet: a, onClick: s }, `feature-${a.key}` - )) : /* @__PURE__ */ me.jsx(ise, {}) }) + )) : /* @__PURE__ */ fe.jsx(sse, {}) }) ] }); } -function poe(t) { - const { onLogin: e, header: r, showEmailSignIn: n = !0, showMoreWallets: i = !0, showTonConnect: s = !0, showFeaturedWallets: o = !0 } = t, [a, u] = fr(""), [l, d] = fr(null), [g, w] = fr(""); +function voe(t) { + const { onLogin: e, header: r, showEmailSignIn: n = !0, showMoreWallets: i = !0, showTonConnect: s = !0, showFeaturedWallets: o = !0 } = t, [a, u] = Gt(""), [l, d] = Gt(null), [p, w] = Gt(""); function A($) { d($), u("evm-wallet"); } - function M($) { + function P($) { u("email"), w($); } async function N($) { @@ -43161,30 +43161,30 @@ function poe(t) { function L() { u("ton-wallet"); } - return Xn(() => { + return Dn(() => { u("index"); - }, []), /* @__PURE__ */ me.jsx(Dne, { config: t.config, children: /* @__PURE__ */ me.jsxs(nse, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ - a === "evm-wallet" && /* @__PURE__ */ me.jsx( - nie, + }, []), /* @__PURE__ */ fe.jsx(Fne, { config: t.config, children: /* @__PURE__ */ fe.jsxs(eA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ + a === "evm-wallet" && /* @__PURE__ */ fe.jsx( + aie, { onBack: () => u("index"), onLogin: N, wallet: l } ), - a === "ton-wallet" && /* @__PURE__ */ me.jsx( - rse, + a === "ton-wallet" && /* @__PURE__ */ fe.jsx( + ise, { onBack: () => u("index"), onLogin: N } ), - a === "email" && /* @__PURE__ */ me.jsx(One, { email: g, onBack: () => u("index"), onLogin: N }), - a === "index" && /* @__PURE__ */ me.jsx( - vne, + a === "email" && /* @__PURE__ */ fe.jsx(jne, { email: p, onBack: () => u("index"), onLogin: N }), + a === "index" && /* @__PURE__ */ fe.jsx( + C9, { header: r, - onEmailConfirm: M, + onEmailConfirm: P, onSelectWallet: A, onSelectMoreWallets: () => { u("all-wallet"); @@ -43198,8 +43198,8 @@ function poe(t) { } } ), - a === "all-wallet" && /* @__PURE__ */ me.jsx( - sse, + a === "all-wallet" && /* @__PURE__ */ fe.jsx( + tA, { onBack: () => u("index"), onSelectWallet: A @@ -43207,17 +43207,186 @@ function poe(t) { ) ] }) }); } +function ose(t) { + const { wallet: e, onConnect: r } = t, [n, i] = Gt(e.installed ? "connect" : "qr"); + async function s(o, a) { + r(o, a); + } + return /* @__PURE__ */ fe.jsxs(so, { children: [ + /* @__PURE__ */ fe.jsx("div", { className: "mb-6", children: /* @__PURE__ */ fe.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), + n === "qr" && /* @__PURE__ */ fe.jsx( + U9, + { + wallet: e, + onGetExtension: () => i("get-extension"), + onSignFinish: s + } + ), + n === "connect" && /* @__PURE__ */ fe.jsx( + q9, + { + onShowQrCode: () => i("qr"), + wallet: e, + onSignFinish: s + } + ), + n === "get-extension" && /* @__PURE__ */ fe.jsx(z9, { wallet: e }) + ] }); +} +function ase(t) { + const { email: e } = t, [r, n] = Gt(0), [i, s] = Gt(!1), [o, a] = Gt(!1), [u, l] = Gt(""), [d, p] = Gt(""); + async function w() { + n(60); + const N = setInterval(() => { + n((L) => L === 0 ? (clearInterval(N), 0) : L - 1); + }, 1e3); + } + async function A(N) { + a(!0); + try { + l(""), await qo.getEmailCode({ account_type: "email", email: N }), w(); + } catch (L) { + l(L.message); + } + a(!1); + } + Dn(() => { + e && A(e); + }, [e]); + async function P(N) { + if (p(""), !(N.length < 6)) { + s(!0); + try { + await t.onInputCode(e, N); + } catch (L) { + p(L.message); + } + s(!1); + } + } + return /* @__PURE__ */ fe.jsxs(so, { children: [ + /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ + /* @__PURE__ */ fe.jsx(VS, { className: "xc-mb-4", size: 60 }), + /* @__PURE__ */ fe.jsx("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16", children: u ? /* @__PURE__ */ fe.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ fe.jsx("p", { className: "xc-px-8", children: u }) }) : o ? /* @__PURE__ */ fe.jsx(_a, { className: "xc-animate-spin" }) : /* @__PURE__ */ fe.jsxs(fe.Fragment, { children: [ + /* @__PURE__ */ fe.jsx("p", { className: "xc-text-lg xc-mb-1", children: "We’ve sent a verification code to" }), + /* @__PURE__ */ fe.jsx("p", { className: "xc-font-bold xc-text-center", children: e }) + ] }) }), + /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-2 xc-h-12", children: /* @__PURE__ */ fe.jsx(L9, { spinning: i, className: "xc-rounded-xl", children: /* @__PURE__ */ fe.jsx(cy, { maxLength: 6, onChange: P, disabled: i, className: "disabled:xc-opacity-20", children: /* @__PURE__ */ fe.jsx(uy, { children: /* @__PURE__ */ fe.jsxs("div", { className: Js("xc-flex xc-gap-2", i ? "xc-opacity-20" : ""), children: [ + /* @__PURE__ */ fe.jsx(Ri, { index: 0 }), + /* @__PURE__ */ fe.jsx(Ri, { index: 1 }), + /* @__PURE__ */ fe.jsx(Ri, { index: 2 }), + /* @__PURE__ */ fe.jsx(Ri, { index: 3 }), + /* @__PURE__ */ fe.jsx(Ri, { index: 4 }), + /* @__PURE__ */ fe.jsx(Ri, { index: 5 }) + ] }) }) }) }) }), + d && /* @__PURE__ */ fe.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ fe.jsx("p", { children: d }) }) + ] }), + /* @__PURE__ */ fe.jsxs("div", { className: "xc-text-center xc-text-sm xc-text-gray-400", children: [ + "Not get it? ", + r ? `Recend in ${r}s` : /* @__PURE__ */ fe.jsx("button", { onClick: () => A(e), children: "Send again" }) + ] }) + ] }); +} +function cse(t) { + const { email: e } = t; + return /* @__PURE__ */ fe.jsxs(so, { children: [ + /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ fe.jsx(Pc, { title: "Sign in with email", onBack: t.onBack }) }), + /* @__PURE__ */ fe.jsx(ase, { email: e, onInputCode: t.onInputCode }) + ] }); +} +function boe(t) { + const { onEvmWalletConnect: e, onTonWalletConnect: r, onEmailConnect: n, config: i = { + showEmailSignIn: !1, + showFeaturedWallets: !0, + showMoreWallets: !0, + showTonConnect: !0 + } } = t, [s, o] = Gt(""), [a, u] = Gt(), [l, d] = Gt(), p = oi(), [w, A] = Gt(""); + function P(H) { + u(H), o("evm-wallet-connect"); + } + function N(H) { + A(H), o("email-connect"); + } + async function L(H, W) { + await e({ + chain_type: "eip155", + client: H.client, + connect_info: W + }), o("index"); + } + function $(H) { + d(H), o("ton-wallet-connect"); + } + async function B(H) { + H && await r({ + chain_type: "ton", + client: p.current, + connect_info: H + }); + } + return Dn(() => { + p.current = new fh({ + manifestUrl: "https://static.codatta.io/static/tonconnect-manifest.json?v=2" + }); + const H = p.current.onStatusChange(B); + return o("index"), H; + }, []), /* @__PURE__ */ fe.jsxs(eA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ + s === "evm-wallet-select" && /* @__PURE__ */ fe.jsx( + tA, + { + onBack: () => o("index"), + onSelectWallet: P + } + ), + s === "evm-wallet-connect" && /* @__PURE__ */ fe.jsx( + ose, + { + onBack: () => o("index"), + onConnect: L, + wallet: a + } + ), + s === "ton-wallet-select" && /* @__PURE__ */ fe.jsx( + W9, + { + connector: p.current, + onSelect: $, + onBack: () => o("index") + } + ), + s === "ton-wallet-connect" && /* @__PURE__ */ fe.jsx( + Q9, + { + connector: p.current, + wallet: l, + onBack: () => o("index") + } + ), + s === "email-connect" && /* @__PURE__ */ fe.jsx(cse, { email: w, onBack: () => o("index"), onInputCode: n }), + s === "index" && /* @__PURE__ */ fe.jsx( + C9, + { + onEmailConfirm: N, + onSelectWallet: P, + onSelectMoreWallets: () => o("evm-wallet-select"), + onSelectTonConnect: () => o("ton-wallet-select"), + config: i + } + ) + ] }); +} export { - hoe as C, - I5 as H, - JX as a, - Nl as b, - fse as c, - poe as d, + goe as C, + T5 as H, + oZ as a, + Ll as b, + dse as c, + voe as d, Hd as e, - use as h, - lse as r, - r4 as s, - I0 as t, - gp as u + boe as f, + hse as h, + pse as r, + i4 as s, + C0 as t, + mp as u }; diff --git a/dist/secp256k1-CWJe94hK.js b/dist/secp256k1-S2RhtMGq.js similarity index 99% rename from dist/secp256k1-CWJe94hK.js rename to dist/secp256k1-S2RhtMGq.js index 9b6dbfb..bfa472a 100644 --- a/dist/secp256k1-CWJe94hK.js +++ b/dist/secp256k1-S2RhtMGq.js @@ -1,4 +1,4 @@ -import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-Dv8NlLmw.js"; +import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-DfEBGh6l.js"; class Kt extends ee { constructor(n, t) { super(), this.finished = !1, this.destroyed = !1, ne(n); diff --git a/lib/codatta-connect.tsx b/lib/codatta-connect.tsx index fc128ef..fca22e1 100644 --- a/lib/codatta-connect.tsx +++ b/lib/codatta-connect.tsx @@ -23,7 +23,7 @@ export interface TonWalletConnectInfo { connect_info: Wallet } -export default function CodattaConnect(props: { +export function CodattaConnect(props: { onEvmWalletConnect: (connectInfo:EmvWalletConnectInfo) => Promise onTonWalletConnect: (connectInfo:TonWalletConnectInfo) => Promise onEmailConnect: (email:string, code:string) => Promise diff --git a/package.json b/package.json index 6de82fa..7cba2a7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codatta-connect", - "version": "2.1.8", + "version": "2.1.9", "type": "module", "main": "./dist/index.umd.js", "module": "./dist/index.es.js", From ac1b450d1015903a612cb923cb448bbbabfd462a Mon Sep 17 00:00:00 2001 From: markof Date: Mon, 23 Dec 2024 17:51:06 +0800 Subject: [PATCH 03/25] feat: add error --- lib/components/wallet-connect-widget.tsx | 2 +- lib/components/wallet-qr.tsx | 1 - package.json | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/components/wallet-connect-widget.tsx b/lib/components/wallet-connect-widget.tsx index 48b1178..892b00d 100644 --- a/lib/components/wallet-connect-widget.tsx +++ b/lib/components/wallet-connect-widget.tsx @@ -15,7 +15,7 @@ export default function WalletConnectWidget(props: { const [step, setStep] = useState(wallet.installed ? 'connect' : 'qr') async function handleSignFinish(wallet: WalletItem, signInfo: WalletSignInfo) { - onConnect(wallet, signInfo) + await onConnect(wallet, signInfo) } return ( diff --git a/lib/components/wallet-qr.tsx b/lib/components/wallet-qr.tsx index d0a74c3..d3742a0 100644 --- a/lib/components/wallet-qr.tsx +++ b/lib/components/wallet-qr.tsx @@ -116,7 +116,6 @@ export default function WalletQr(props: { } catch (err: any) { console.log('err', err) setError(err.details || err.message) - } } diff --git a/package.json b/package.json index 7cba2a7..939ab70 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codatta-connect", - "version": "2.1.9", + "version": "2.2.0", "type": "module", "main": "./dist/index.umd.js", "module": "./dist/index.es.js", From 299438ecd788a49ad5a67ad022e04e32f73c08fe Mon Sep 17 00:00:00 2001 From: markof Date: Mon, 23 Dec 2024 17:51:31 +0800 Subject: [PATCH 04/25] feat: release 2.2 --- dist/index.es.js | 2 +- dist/index.umd.js | 2 +- dist/{main-DfEBGh6l.js => main-DYrF27mZ.js} | 4 ++-- dist/{secp256k1-S2RhtMGq.js => secp256k1-DxcrBxlU.js} | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) rename dist/{main-DfEBGh6l.js => main-DYrF27mZ.js} (99%) rename dist/{secp256k1-S2RhtMGq.js => secp256k1-DxcrBxlU.js} (99%) diff --git a/dist/index.es.js b/dist/index.es.js index 6e44290..01e0c9b 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -1,4 +1,4 @@ -import { f as o, C as n, d as e, a as C, u as s } from "./main-DfEBGh6l.js"; +import { f as o, C as n, d as e, a as C, u as s } from "./main-DYrF27mZ.js"; export { o as CodattaConnect, n as CodattaConnectContextProvider, diff --git a/dist/index.umd.js b/dist/index.umd.js index f45b274..ef74835 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -250,4 +250,4 @@ ${D}`}const cZ=/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(: OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */function kZ(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new Ut("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new Ut("Delay aborted"))})})})}function As(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function fh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=As(e==null?void 0:e.signal);if(typeof t!="function")throw new Ut(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=g??null,o==null||o.abort(),o=As(g),o.signal.aborted)throw new Ut("Resource creation was aborted");n=y??null;const A=t(o.signal,...y);i=A;const P=yield A;if(i!==A&&P!==r)throw yield e(P),new Ut("Resource creation was aborted by a new resource creation");return r=P,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const g=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([g?e(g):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:g=>Pt(this,void 0,void 0,function*(){const y=r,A=i,P=n,O=s;if(yield j7(g),y===r&&A===i&&P===n&&O===s)return yield a(s,...P??[]);throw new Ut("Resource recreation was aborted by a new resource creation")})}}function GZ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=As(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new Ut("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new Ut(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new Ut("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class kb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=VZ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield YZ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new qZ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(F7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=k7.encode(e);yield fh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new Ut(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Uo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Uo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new Ut(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new Ut("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),Sn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Ut("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new Ut(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function YZ(t){return Pt(this,void 0,void 0,function*(){return yield GZ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=As(n.signal).signal;if(o.aborted){r(new Ut("Bridge connection aborted"));return}const a=new URL(F7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new Ut("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}try{const g=yield t.errorHandler(l,d);g!==l&&l.close(),g&&g!==l&&e(g)}catch(g){l.close(),r(g)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new Ut("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function lh(t){return!("connectEvent"in t)}class hh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!lh(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Rb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Rb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");if(!lh(e))throw new Ut("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new Ut("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!lh(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const U7=2;class dh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new hh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getHttpConnection();return lh(n)?new dh(e,n.connectionSource):new dh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=As(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Rb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield fh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(lh(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new Ut("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new kb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield fh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Ut("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),Y0(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=As(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){Sn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(k7.decode(e.message).toUint8Array(),Y0(e.from)));if(Sn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){Sn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Uo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(Sn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new Ut(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return HZ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",U7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+WZ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new kb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>fh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new kb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function q7(t,e){return z7(t,[e])}function z7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function JZ(t){try{return!q7(t,"tonconnect")||!q7(t.tonconnect,"walletInfo")?!1:z7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Ju{constructor(){this.storage={}}static getInstance(){return Ju.instance||(Ju.instance=new Ju),Ju.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function np(){if(!(typeof window>"u"))return window}function XZ(){const t=np();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function ZZ(){if(!(typeof document>"u"))return document}function QZ(){var t;const e=(t=np())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function eQ(){if(tQ())return localStorage;if(rQ())throw new Ut("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Ju.getInstance()}function tQ(){try{return typeof localStorage<"u"}catch{return!1}}function rQ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class xi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=xi.window;if(!xi.isWindowContainsWallet(n,r))throw new Nb;this.connectionStorage=new hh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getInjectedConnection();return new xi(e,n.jsBridgeKey)})}static isWalletInjected(e){return xi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return xi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?XZ().filter(([n,i])=>JZ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(U7,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{Sn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();Sn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){Sn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>Sn("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{Sn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);Sn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){Sn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{Sn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}xi.window=np();class nQ{constructor(){this.localStorage=eQ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function H7(t){return sQ(t)&&t.injected}function iQ(t){return H7(t)&&t.embedded}function sQ(t){return"jsBridgeKey"in t}const oQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class Bb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(iQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new Lb("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Uo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Uo(n),e=oQ}let r=[];try{r=xi.getCurrentlyInjectedWallets()}catch(n){Uo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=xi.isWalletInjected(o),i.embedded=xi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class ip extends Ut{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,ip.prototype)}}function aQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new ip("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function mQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Zu(t,e)),$b(e,r))}function vQ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Zu(t,e)),$b(e,r))}function bQ(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Zu(t,e)),$b(e,r))}function yQ(t,e,r){return Object.assign({type:"disconnection",scope:r},Zu(t,e))}class wQ{constructor(){this.window=np()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class xQ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new wQ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Xu({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",uQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",cQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=fQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=lQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=hQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=dQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=pQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=gQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=yQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=mQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=vQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=bQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const _Q="3.0.5";class ph{constructor(e){if(this.walletsList=new Bb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||QZ(),storage:(e==null?void 0:e.storage)||new nQ},this.walletsList=new Bb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new xQ({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:_Q}),!this.dappSettings.manifestUrl)throw new Db("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new hh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Ob;const o=As(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new Ut("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield dh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield xi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Uo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=fh(g=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:g.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(g=>setTimeout(()=>g(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=As(n==null?void 0:n.signal);if(i.signal.aborted)throw new Ut("Transaction sending was aborted");this.checkConnection(),aQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=kZ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(rp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(rp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),rp.parseAndThrowError(l);const d=rp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new Z0;const n=As(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Ut("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=ZZ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Uo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&BZ(e)?r=new xi(this.dappSettings.storage,e.jsBridgeKey):r=new dh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new Ut("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=FZ.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),Sn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof X0||r instanceof J0)throw Uo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new Z0}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}ph.walletsList=new Bb,ph.isWalletInjected=t=>xi.isWalletInjected(t),ph.isInsideWalletBrowser=t=>xi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function Fb(t){const{children:e,onClick:r}=t;return le.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function W7(t){const{wallet:e,connector:r,loading:n}=t,i=Se.useRef(null),s=Se.useRef(),[o,a]=Se.useState(),[u,l]=Se.useState(),[d,g]=Se.useState("connect"),[y,A]=Se.useState(!1),[P,O]=Se.useState();function D(z){var ue;(ue=s.current)==null||ue.update({data:z})}async function k(){A(!0);try{a("");const z=await No.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ue=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:z}});if(!ue)return;O(ue),D(ue),l(z)}}catch(z){a(z.message)}A(!1)}function B(){s.current=new _7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function j(){r.connect(e,{request:{tonProof:u}})}function U(){if("deepLink"in e){if(!e.deepLink||!P)return;const z=new URL(P),ue=`${e.deepLink}${z.search}`;window.open(ue)}}function K(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(P)}const J=Se.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),T=Se.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Se.useEffect(()=>{B(),k()},[]),le.jsxs(ro,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Ac,{title:"Connect wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-text-center xc-mb-6",children:[le.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[le.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),le.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?le.jsx(ya,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):le.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),le.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),le.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&le.jsx(ya,{className:"xc-animate-spin"}),!y&&!n&&le.jsxs(le.Fragment,{children:[H7(e)&&le.jsxs(Fb,{onClick:j,children:[le.jsx(kK,{className:"xc-opacity-80"}),"Extension"]}),J&&le.jsxs(Fb,{onClick:U,children:[le.jsx(l8,{className:"xc-opacity-80"}),"Desktop"]}),T&&le.jsx(Fb,{onClick:K,children:"Telegram Mini App"})]})]})]})}function EQ(t){const[e,r]=Se.useState(""),[n,i]=Se.useState(),[s,o]=Se.useState(),a=Cb(),[u,l]=Se.useState(!1);async function d(y){var P,O;if(!y||!((P=y.connectItems)!=null&&P.tonProof))return;l(!0);const A=await No.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(O=y.connectItems)==null?void 0:O.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(A.data),l(!1)}Se.useEffect(()=>{const y=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),A=y.onStatusChange(d);return o(y),r("select"),A},[]);function g(y){r("connect"),i(y)}return le.jsxs(ro,{children:[e==="select"&&le.jsx(C7,{connector:s,onSelect:g,onBack:t.onBack}),e==="connect"&&le.jsx(W7,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function K7(t){const{children:e,className:r}=t,n=Se.useRef(null),[i,s]=Se.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Se.useEffect(()=>{console.log("maxHeight",i)},[i]),le.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function SQ(){return le.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[le.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),le.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function V7(t){const{wallets:e}=Kl(),[r,n]=Se.useState(),i=Se.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return le.jsxs(ro,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Ac,{title:"Select wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[le.jsx(d8,{className:"xc-shrink-0 xc-opacity-50"}),le.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),le.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>le.jsx(r7,{wallet:a,onClick:s},`feature-${a.key}`)):le.jsx(SQ,{})})]})}function AQ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Se.useState(""),[l,d]=Se.useState(null),[g,y]=Se.useState("");function A(k){d(k),u("evm-wallet")}function P(k){u("email"),y(k)}async function O(k){await e(k)}function D(){u("ton-wallet")}return Se.useEffect(()=>{u("index")},[]),le.jsx(iZ,{config:t.config,children:le.jsxs(K7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&le.jsx(PZ,{onBack:()=>u("index"),onLogin:O,wallet:l}),a==="ton-wallet"&&le.jsx(EQ,{onBack:()=>u("index"),onLogin:O}),a==="email"&&le.jsx(sZ,{email:g,onBack:()=>u("index"),onLogin:O}),a==="index"&&le.jsx(h7,{header:r,onEmailConfirm:P,onSelectWallet:A,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&le.jsx(V7,{onBack:()=>u("index"),onSelectWallet:A})]})})}function PQ(t){const{wallet:e,onConnect:r}=t,[n,i]=Se.useState(e.installed?"connect":"qr");async function s(o,a){r(o,a)}return le.jsxs(ro,{children:[le.jsx("div",{className:"mb-6",children:le.jsx(Ac,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&le.jsx(P7,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&le.jsx(M7,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&le.jsx(I7,{wallet:e})]})}function MQ(t){const{email:e}=t,[r,n]=Se.useState(0),[i,s]=Se.useState(!1),[o,a]=Se.useState(!1),[u,l]=Se.useState(""),[d,g]=Se.useState("");async function y(){n(60);const O=setInterval(()=>{n(D=>D===0?(clearInterval(O),0):D-1)},1e3)}async function A(O){a(!0);try{l(""),await No.getEmailCode({account_type:"email",email:O}),y()}catch(D){l(D.message)}a(!1)}Se.useEffect(()=>{e&&A(e)},[e]);async function P(O){if(g(""),!(O.length<6)){s(!0);try{await t.onInputCode(e,O)}catch(D){g(D.message)}s(!1)}}return le.jsxs(ro,{children:[le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[le.jsx(h8,{className:"xc-mb-4",size:60}),le.jsx("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:u?le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{className:"xc-px-8",children:u})}):o?le.jsx(ya,{className:"xc-animate-spin"}):le.jsxs(le.Fragment,{children:[le.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),le.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]})}),le.jsx("div",{className:"xc-mb-2 xc-h-12",children:le.jsx(y7,{spinning:i,className:"xc-rounded-xl",children:le.jsx(Mb,{maxLength:6,onChange:P,disabled:i,className:"disabled:xc-opacity-20",children:le.jsx(Ib,{children:le.jsxs("div",{className:no("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[le.jsx(Li,{index:0}),le.jsx(Li,{index:1}),le.jsx(Li,{index:2}),le.jsx(Li,{index:3}),le.jsx(Li,{index:4}),le.jsx(Li,{index:5})]})})})})}),d&&le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{children:d})})]}),le.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Recend in ${r}s`:le.jsx("button",{onClick:()=>A(e),children:"Send again"})]})]})}function IQ(t){const{email:e}=t;return le.jsxs(ro,{children:[le.jsx("div",{className:"xc-mb-12",children:le.jsx(Ac,{title:"Sign in with email",onBack:t.onBack})}),le.jsx(MQ,{email:e,onInputCode:t.onInputCode})]})}function CQ(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Se.useState(""),[a,u]=Se.useState(),[l,d]=Se.useState(),g=Se.useRef(),[y,A]=Se.useState("");function P(j){u(j),o("evm-wallet-connect")}function O(j){A(j),o("email-connect")}async function D(j,U){await e({chain_type:"eip155",client:j.client,connect_info:U}),o("index")}function k(j){d(j),o("ton-wallet-connect")}async function B(j){j&&await r({chain_type:"ton",client:g.current,connect_info:j})}return Se.useEffect(()=>{g.current=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const j=g.current.onStatusChange(B);return o("index"),j},[]),le.jsxs(K7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&le.jsx(V7,{onBack:()=>o("index"),onSelectWallet:P}),s==="evm-wallet-connect"&&le.jsx(PQ,{onBack:()=>o("index"),onConnect:D,wallet:a}),s==="ton-wallet-select"&&le.jsx(C7,{connector:g.current,onSelect:k,onBack:()=>o("index")}),s==="ton-wallet-connect"&&le.jsx(W7,{connector:g.current,wallet:l,onBack:()=>o("index")}),s==="email-connect"&&le.jsx(IQ,{email:y,onBack:()=>o("index"),onInputCode:n}),s==="index"&&le.jsx(h7,{onEmailConfirm:O,onSelectWallet:P,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Fn.CodattaConnect=CQ,Fn.CodattaConnectContextProvider=IK,Fn.CodattaSignin=AQ,Fn.coinbaseWallet=a8,Fn.useCodattaConnectContext=Kl,Object.defineProperty(Fn,Symbol.toStringTag,{value:"Module"})}); +`+e:""}`,Object.setPrototypeOf(this,Ut.prototype)}get info(){return""}}Ut.prefix="[TON_CONNECT_SDK_ERROR]";class Db extends Ut{get info(){return"Passed DappMetadata is in incorrect format."}constructor(...e){super(...e),Object.setPrototypeOf(this,Db.prototype)}}class J0 extends Ut{get info(){return"Passed `tonconnect-manifest.json` contains errors. Check format of your manifest. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,J0.prototype)}}class X0 extends Ut{get info(){return"Manifest not found. Make sure you added `tonconnect-manifest.json` to the root of your app or passed correct manifestUrl. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,X0.prototype)}}class Ob extends Ut{get info(){return"Wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection."}constructor(...e){super(...e),Object.setPrototypeOf(this,Ob.prototype)}}class Z0 extends Ut{get info(){return"Send transaction or other protocol methods called while wallet is not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,Z0.prototype)}}function BZ(t){return"jsBridgeKey"in t}class Q0 extends Ut{get info(){return"User rejects the action in the wallet."}constructor(...e){super(...e),Object.setPrototypeOf(this,Q0.prototype)}}class ep extends Ut{get info(){return"Request to the wallet contains errors."}constructor(...e){super(...e),Object.setPrototypeOf(this,ep.prototype)}}class tp extends Ut{get info(){return"App tries to send rpc request to the injected wallet while not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,tp.prototype)}}class Nb extends Ut{get info(){return"There is an attempt to connect to the injected wallet while it is not exists in the webpage."}constructor(...e){super(...e),Object.setPrototypeOf(this,Nb.prototype)}}class Lb extends Ut{get info(){return"An error occurred while fetching the wallets list."}constructor(...e){super(...e),Object.setPrototypeOf(this,Lb.prototype)}}class Ca extends Ut{constructor(...e){super(...e),Object.setPrototypeOf(this,Ca.prototype)}}const B7={[Ia.UNKNOWN_ERROR]:Ca,[Ia.USER_REJECTS_ERROR]:Q0,[Ia.BAD_REQUEST_ERROR]:ep,[Ia.UNKNOWN_APP_ERROR]:tp,[Ia.MANIFEST_NOT_FOUND_ERROR]:X0,[Ia.MANIFEST_CONTENT_ERROR]:J0};class $Z{parseError(e){let r=Ca;return e.code in B7&&(r=B7[e.code]||Ca),new r(e.message)}}const FZ=new $Z;class jZ{isError(e){return"error"in e}}const $7={[Yu.UNKNOWN_ERROR]:Ca,[Yu.USER_REJECTS_ERROR]:Q0,[Yu.BAD_REQUEST_ERROR]:ep,[Yu.UNKNOWN_APP_ERROR]:tp};class UZ extends jZ{convertToRpcRequest(e){return{method:"sendTransaction",params:[JSON.stringify(e)]}}parseAndThrowError(e){let r=Ca;throw e.error.code in $7&&(r=$7[e.error.code]||Ca),new r(e.error.message)}convertFromRpcResponse(e){return{boc:e.result}}}const rp=new UZ;class qZ{constructor(e,r){this.storage=e,this.storeKey="ton-connect-storage_http-bridge-gateway::"+r}storeLastEventId(e){return Pt(this,void 0,void 0,function*(){return this.storage.setItem(this.storeKey,e)})}removeLastEventId(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getLastEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e||null})}}function zZ(t){return t.slice(-1)==="/"?t.slice(0,-1):t}function F7(t,e){return zZ(t)+"/"+e}function HZ(t){if(!t)return!1;const e=new URL(t);return e.protocol==="tg:"||e.hostname==="t.me"}function WZ(t){return t.replaceAll(".","%2E").replaceAll("-","%2D").replaceAll("_","%5F").replaceAll("&","-").replaceAll("=","__").replaceAll("%","--")}function j7(t,e){return Pt(this,void 0,void 0,function*(){return new Promise((r,n)=>{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new Ut("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new Ut("Delay aborted"))})})})}function As(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function fh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=As(e==null?void 0:e.signal);if(typeof t!="function")throw new Ut(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=g??null,o==null||o.abort(),o=As(g),o.signal.aborted)throw new Ut("Resource creation was aborted");n=y??null;const A=t(o.signal,...y);i=A;const P=yield A;if(i!==A&&P!==r)throw yield e(P),new Ut("Resource creation was aborted by a new resource creation");return r=P,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const g=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([g?e(g):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:g=>Pt(this,void 0,void 0,function*(){const y=r,A=i,P=n,O=s;if(yield j7(g),y===r&&A===i&&P===n&&O===s)return yield a(s,...P??[]);throw new Ut("Resource recreation was aborted by a new resource creation")})}}function GZ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=As(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new Ut("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new Ut(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new Ut("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class kb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=VZ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield YZ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new qZ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(F7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=k7.encode(e);yield fh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new Ut(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Uo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Uo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new Ut(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new Ut("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),Sn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Ut("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new Ut(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function YZ(t){return Pt(this,void 0,void 0,function*(){return yield GZ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=As(n.signal).signal;if(o.aborted){r(new Ut("Bridge connection aborted"));return}const a=new URL(F7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new Ut("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}try{const g=yield t.errorHandler(l,d);g!==l&&l.close(),g&&g!==l&&e(g)}catch(g){l.close(),r(g)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new Ut("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function lh(t){return!("connectEvent"in t)}class hh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!lh(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Rb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Rb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");if(!lh(e))throw new Ut("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new Ut("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!lh(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const U7=2;class dh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new hh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getHttpConnection();return lh(n)?new dh(e,n.connectionSource):new dh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=As(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Rb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield fh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(lh(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new Ut("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new kb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield fh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Ut("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),Y0(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=As(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){Sn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(k7.decode(e.message).toUint8Array(),Y0(e.from)));if(Sn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){Sn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Uo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(Sn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new Ut(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return HZ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",U7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+WZ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new kb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>fh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new kb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function q7(t,e){return z7(t,[e])}function z7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function JZ(t){try{return!q7(t,"tonconnect")||!q7(t.tonconnect,"walletInfo")?!1:z7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Ju{constructor(){this.storage={}}static getInstance(){return Ju.instance||(Ju.instance=new Ju),Ju.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function np(){if(!(typeof window>"u"))return window}function XZ(){const t=np();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function ZZ(){if(!(typeof document>"u"))return document}function QZ(){var t;const e=(t=np())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function eQ(){if(tQ())return localStorage;if(rQ())throw new Ut("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Ju.getInstance()}function tQ(){try{return typeof localStorage<"u"}catch{return!1}}function rQ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class xi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=xi.window;if(!xi.isWindowContainsWallet(n,r))throw new Nb;this.connectionStorage=new hh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getInjectedConnection();return new xi(e,n.jsBridgeKey)})}static isWalletInjected(e){return xi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return xi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?XZ().filter(([n,i])=>JZ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(U7,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{Sn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();Sn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){Sn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>Sn("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{Sn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);Sn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){Sn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{Sn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}xi.window=np();class nQ{constructor(){this.localStorage=eQ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function H7(t){return sQ(t)&&t.injected}function iQ(t){return H7(t)&&t.embedded}function sQ(t){return"jsBridgeKey"in t}const oQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class Bb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(iQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new Lb("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Uo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Uo(n),e=oQ}let r=[];try{r=xi.getCurrentlyInjectedWallets()}catch(n){Uo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=xi.isWalletInjected(o),i.embedded=xi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class ip extends Ut{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,ip.prototype)}}function aQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new ip("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function mQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Zu(t,e)),$b(e,r))}function vQ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Zu(t,e)),$b(e,r))}function bQ(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Zu(t,e)),$b(e,r))}function yQ(t,e,r){return Object.assign({type:"disconnection",scope:r},Zu(t,e))}class wQ{constructor(){this.window=np()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class xQ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new wQ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Xu({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",uQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",cQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=fQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=lQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=hQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=dQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=pQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=gQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=yQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=mQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=vQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=bQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const _Q="3.0.5";class ph{constructor(e){if(this.walletsList=new Bb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||QZ(),storage:(e==null?void 0:e.storage)||new nQ},this.walletsList=new Bb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new xQ({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:_Q}),!this.dappSettings.manifestUrl)throw new Db("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new hh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Ob;const o=As(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new Ut("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield dh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield xi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Uo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=fh(g=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:g.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(g=>setTimeout(()=>g(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=As(n==null?void 0:n.signal);if(i.signal.aborted)throw new Ut("Transaction sending was aborted");this.checkConnection(),aQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=kZ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(rp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(rp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),rp.parseAndThrowError(l);const d=rp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new Z0;const n=As(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Ut("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=ZZ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Uo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&BZ(e)?r=new xi(this.dappSettings.storage,e.jsBridgeKey):r=new dh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new Ut("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=FZ.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),Sn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof X0||r instanceof J0)throw Uo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new Z0}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}ph.walletsList=new Bb,ph.isWalletInjected=t=>xi.isWalletInjected(t),ph.isInsideWalletBrowser=t=>xi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function Fb(t){const{children:e,onClick:r}=t;return le.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function W7(t){const{wallet:e,connector:r,loading:n}=t,i=Se.useRef(null),s=Se.useRef(),[o,a]=Se.useState(),[u,l]=Se.useState(),[d,g]=Se.useState("connect"),[y,A]=Se.useState(!1),[P,O]=Se.useState();function D(z){var ue;(ue=s.current)==null||ue.update({data:z})}async function k(){A(!0);try{a("");const z=await No.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ue=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:z}});if(!ue)return;O(ue),D(ue),l(z)}}catch(z){a(z.message)}A(!1)}function B(){s.current=new _7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function j(){r.connect(e,{request:{tonProof:u}})}function U(){if("deepLink"in e){if(!e.deepLink||!P)return;const z=new URL(P),ue=`${e.deepLink}${z.search}`;window.open(ue)}}function K(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(P)}const J=Se.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),T=Se.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Se.useEffect(()=>{B(),k()},[]),le.jsxs(ro,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Ac,{title:"Connect wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-text-center xc-mb-6",children:[le.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[le.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),le.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?le.jsx(ya,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):le.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),le.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),le.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&le.jsx(ya,{className:"xc-animate-spin"}),!y&&!n&&le.jsxs(le.Fragment,{children:[H7(e)&&le.jsxs(Fb,{onClick:j,children:[le.jsx(kK,{className:"xc-opacity-80"}),"Extension"]}),J&&le.jsxs(Fb,{onClick:U,children:[le.jsx(l8,{className:"xc-opacity-80"}),"Desktop"]}),T&&le.jsx(Fb,{onClick:K,children:"Telegram Mini App"})]})]})]})}function EQ(t){const[e,r]=Se.useState(""),[n,i]=Se.useState(),[s,o]=Se.useState(),a=Cb(),[u,l]=Se.useState(!1);async function d(y){var P,O;if(!y||!((P=y.connectItems)!=null&&P.tonProof))return;l(!0);const A=await No.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(O=y.connectItems)==null?void 0:O.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(A.data),l(!1)}Se.useEffect(()=>{const y=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),A=y.onStatusChange(d);return o(y),r("select"),A},[]);function g(y){r("connect"),i(y)}return le.jsxs(ro,{children:[e==="select"&&le.jsx(C7,{connector:s,onSelect:g,onBack:t.onBack}),e==="connect"&&le.jsx(W7,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function K7(t){const{children:e,className:r}=t,n=Se.useRef(null),[i,s]=Se.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Se.useEffect(()=>{console.log("maxHeight",i)},[i]),le.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function SQ(){return le.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[le.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),le.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function V7(t){const{wallets:e}=Kl(),[r,n]=Se.useState(),i=Se.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return le.jsxs(ro,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Ac,{title:"Select wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[le.jsx(d8,{className:"xc-shrink-0 xc-opacity-50"}),le.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),le.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>le.jsx(r7,{wallet:a,onClick:s},`feature-${a.key}`)):le.jsx(SQ,{})})]})}function AQ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Se.useState(""),[l,d]=Se.useState(null),[g,y]=Se.useState("");function A(k){d(k),u("evm-wallet")}function P(k){u("email"),y(k)}async function O(k){await e(k)}function D(){u("ton-wallet")}return Se.useEffect(()=>{u("index")},[]),le.jsx(iZ,{config:t.config,children:le.jsxs(K7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&le.jsx(PZ,{onBack:()=>u("index"),onLogin:O,wallet:l}),a==="ton-wallet"&&le.jsx(EQ,{onBack:()=>u("index"),onLogin:O}),a==="email"&&le.jsx(sZ,{email:g,onBack:()=>u("index"),onLogin:O}),a==="index"&&le.jsx(h7,{header:r,onEmailConfirm:P,onSelectWallet:A,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&le.jsx(V7,{onBack:()=>u("index"),onSelectWallet:A})]})})}function PQ(t){const{wallet:e,onConnect:r}=t,[n,i]=Se.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return le.jsxs(ro,{children:[le.jsx("div",{className:"mb-6",children:le.jsx(Ac,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&le.jsx(P7,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&le.jsx(M7,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&le.jsx(I7,{wallet:e})]})}function MQ(t){const{email:e}=t,[r,n]=Se.useState(0),[i,s]=Se.useState(!1),[o,a]=Se.useState(!1),[u,l]=Se.useState(""),[d,g]=Se.useState("");async function y(){n(60);const O=setInterval(()=>{n(D=>D===0?(clearInterval(O),0):D-1)},1e3)}async function A(O){a(!0);try{l(""),await No.getEmailCode({account_type:"email",email:O}),y()}catch(D){l(D.message)}a(!1)}Se.useEffect(()=>{e&&A(e)},[e]);async function P(O){if(g(""),!(O.length<6)){s(!0);try{await t.onInputCode(e,O)}catch(D){g(D.message)}s(!1)}}return le.jsxs(ro,{children:[le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[le.jsx(h8,{className:"xc-mb-4",size:60}),le.jsx("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:u?le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{className:"xc-px-8",children:u})}):o?le.jsx(ya,{className:"xc-animate-spin"}):le.jsxs(le.Fragment,{children:[le.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),le.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]})}),le.jsx("div",{className:"xc-mb-2 xc-h-12",children:le.jsx(y7,{spinning:i,className:"xc-rounded-xl",children:le.jsx(Mb,{maxLength:6,onChange:P,disabled:i,className:"disabled:xc-opacity-20",children:le.jsx(Ib,{children:le.jsxs("div",{className:no("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[le.jsx(Li,{index:0}),le.jsx(Li,{index:1}),le.jsx(Li,{index:2}),le.jsx(Li,{index:3}),le.jsx(Li,{index:4}),le.jsx(Li,{index:5})]})})})})}),d&&le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{children:d})})]}),le.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Recend in ${r}s`:le.jsx("button",{onClick:()=>A(e),children:"Send again"})]})]})}function IQ(t){const{email:e}=t;return le.jsxs(ro,{children:[le.jsx("div",{className:"xc-mb-12",children:le.jsx(Ac,{title:"Sign in with email",onBack:t.onBack})}),le.jsx(MQ,{email:e,onInputCode:t.onInputCode})]})}function CQ(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Se.useState(""),[a,u]=Se.useState(),[l,d]=Se.useState(),g=Se.useRef(),[y,A]=Se.useState("");function P(j){u(j),o("evm-wallet-connect")}function O(j){A(j),o("email-connect")}async function D(j,U){await e({chain_type:"eip155",client:j.client,connect_info:U}),o("index")}function k(j){d(j),o("ton-wallet-connect")}async function B(j){j&&await r({chain_type:"ton",client:g.current,connect_info:j})}return Se.useEffect(()=>{g.current=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const j=g.current.onStatusChange(B);return o("index"),j},[]),le.jsxs(K7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&le.jsx(V7,{onBack:()=>o("index"),onSelectWallet:P}),s==="evm-wallet-connect"&&le.jsx(PQ,{onBack:()=>o("index"),onConnect:D,wallet:a}),s==="ton-wallet-select"&&le.jsx(C7,{connector:g.current,onSelect:k,onBack:()=>o("index")}),s==="ton-wallet-connect"&&le.jsx(W7,{connector:g.current,wallet:l,onBack:()=>o("index")}),s==="email-connect"&&le.jsx(IQ,{email:y,onBack:()=>o("index"),onInputCode:n}),s==="index"&&le.jsx(h7,{onEmailConfirm:O,onSelectWallet:P,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Fn.CodattaConnect=CQ,Fn.CodattaConnectContextProvider=IK,Fn.CodattaSignin=AQ,Fn.coinbaseWallet=a8,Fn.useCodattaConnectContext=Kl,Object.defineProperty(Fn,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/main-DfEBGh6l.js b/dist/main-DYrF27mZ.js similarity index 99% rename from dist/main-DfEBGh6l.js rename to dist/main-DYrF27mZ.js index 197abff..88dac93 100644 --- a/dist/main-DfEBGh6l.js +++ b/dist/main-DYrF27mZ.js @@ -2850,7 +2850,7 @@ function jO(t) { return Bl(`0x${e}`); } async function UO({ hash: t, signature: e }) { - const r = ya(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-S2RhtMGq.js"); + const r = ya(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-DxcrBxlU.js"); return `0x${(() => { if (typeof e == "object" && "r" in e && "s" in e) { const { r: l, s: d, v: p, yParity: w } = e, A = Number(w ?? p), P = T2(A); @@ -43210,7 +43210,7 @@ function voe(t) { function ose(t) { const { wallet: e, onConnect: r } = t, [n, i] = Gt(e.installed ? "connect" : "qr"); async function s(o, a) { - r(o, a); + await r(o, a); } return /* @__PURE__ */ fe.jsxs(so, { children: [ /* @__PURE__ */ fe.jsx("div", { className: "mb-6", children: /* @__PURE__ */ fe.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), diff --git a/dist/secp256k1-S2RhtMGq.js b/dist/secp256k1-DxcrBxlU.js similarity index 99% rename from dist/secp256k1-S2RhtMGq.js rename to dist/secp256k1-DxcrBxlU.js index bfa472a..fdaaab4 100644 --- a/dist/secp256k1-S2RhtMGq.js +++ b/dist/secp256k1-DxcrBxlU.js @@ -1,4 +1,4 @@ -import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-DfEBGh6l.js"; +import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-DYrF27mZ.js"; class Kt extends ee { constructor(n, t) { super(), this.finished = !1, this.destroyed = !1, ne(n); From d3733e55970472179a92b2ff0cda297f38ad9abd Mon Sep 17 00:00:00 2001 From: markof Date: Tue, 24 Dec 2024 19:59:00 +0800 Subject: [PATCH 05/25] feat: release 2.3 --- dist/api/account.api.d.ts | 2 +- dist/components/email-captcha.d.ts | 4 + dist/components/email-connect.d.ts | 1 + dist/components/email-login.d.ts | 6 - dist/index.es.js | 2 +- dist/index.umd.js | 153 +- dist/{main-DYrF27mZ.js => main-CpxLUVHd.js} | 14663 ++++++++-------- ...56k1-DxcrBxlU.js => secp256k1-ChY4PDp8.js} | 2 +- lib/api/account.api.ts | 6 +- lib/api/request.ts | 19 + lib/codatta-connect-context-provider.tsx | 2 +- lib/codatta-signin.tsx | 2 +- lib/components/email-captcha.tsx | 78 + lib/components/email-connect-widget.tsx | 7 +- lib/components/email-connect.tsx | 45 +- lib/components/email-login-widget.tsx | 6 +- lib/components/signin-index.tsx | 60 +- lib/components/wallet-connect-widget.tsx | 2 +- lib/components/wallet-connect.tsx | 4 +- lib/vite-env.d.ts | 5 + package.json | 2 +- src/views/login-view.tsx | 12 +- 22 files changed, 7608 insertions(+), 7475 deletions(-) create mode 100644 dist/components/email-captcha.d.ts delete mode 100644 dist/components/email-login.d.ts rename dist/{main-DYrF27mZ.js => main-CpxLUVHd.js} (80%) rename dist/{secp256k1-DxcrBxlU.js => secp256k1-ChY4PDp8.js} (99%) create mode 100644 lib/components/email-captcha.tsx create mode 100644 lib/vite-env.d.ts diff --git a/dist/api/account.api.d.ts b/dist/api/account.api.d.ts index 7847582..2f011fa 100644 --- a/dist/api/account.api.d.ts +++ b/dist/api/account.api.d.ts @@ -92,7 +92,7 @@ declare class AccountApi { getEmailCode(props: { account_type: TAccountType; email: string; - }): Promise; + }, captcha: string): Promise; emailLogin(props: IEmailLoginParams): Promise<{ data: ILoginResponse; }>; diff --git a/dist/components/email-captcha.d.ts b/dist/components/email-captcha.d.ts new file mode 100644 index 0000000..ca698d5 --- /dev/null +++ b/dist/components/email-captcha.d.ts @@ -0,0 +1,4 @@ +export default function EmailCaptcha(props: { + email: string; + onCodeSend: () => void; +}): import("react/jsx-runtime").JSX.Element; diff --git a/dist/components/email-connect.d.ts b/dist/components/email-connect.d.ts index 60c53e9..281027f 100644 --- a/dist/components/email-connect.d.ts +++ b/dist/components/email-connect.d.ts @@ -1,4 +1,5 @@ export default function EmailConnect(props: { email: string; onInputCode: (email: string, code: string) => Promise; + onResendCode: () => void; }): import("react/jsx-runtime").JSX.Element; diff --git a/dist/components/email-login.d.ts b/dist/components/email-login.d.ts deleted file mode 100644 index c1e13a4..0000000 --- a/dist/components/email-login.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { ILoginResponse } from '../api/account.api'; -export default function EmailLoginWidget(props: { - email: string; - onLogin: (res: ILoginResponse) => void; - onBack: () => void; -}): import("react/jsx-runtime").JSX.Element; diff --git a/dist/index.es.js b/dist/index.es.js index 01e0c9b..d8c11b4 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -1,4 +1,4 @@ -import { f as o, C as n, d as e, a as C, u as s } from "./main-DYrF27mZ.js"; +import { f as o, C as n, d as e, a as C, u as s } from "./main-CpxLUVHd.js"; export { o as CodattaConnect, n as CodattaConnectContextProvider, diff --git a/dist/index.umd.js b/dist/index.umd.js index ef74835..e0fb1bc 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -1,4 +1,4 @@ -(function(Fn,Se){typeof exports=="object"&&typeof module<"u"?Se(exports,require("react"),require("https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js")):typeof define=="function"&&define.amd?define(["exports","react","https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"],Se):(Fn=typeof globalThis<"u"?globalThis:Fn||self,Se(Fn["xny-connect"]={},Fn.React))})(this,function(Fn,Se){"use strict";var aoe=Object.defineProperty;var coe=(Fn,Se,kc)=>Se in Fn?aoe(Fn,Se,{enumerable:!0,configurable:!0,writable:!0,value:kc}):Fn[Se]=kc;var co=(Fn,Se,kc)=>coe(Fn,typeof Se!="symbol"?Se+"":Se,kc);function kc(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const Yt=kc(Se);var nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ui(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Jp(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Xp={exports:{}},gf={};/** +(function(Fn,Se){typeof exports=="object"&&typeof module<"u"?Se(exports,require("react"),require("https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js")):typeof define=="function"&&define.amd?define(["exports","react","https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"],Se):(Fn=typeof globalThis<"u"?globalThis:Fn||self,Se(Fn["xny-connect"]={},Fn.React))})(this,function(Fn,Se){"use strict";var foe=Object.defineProperty;var loe=(Fn,Se,kc)=>Se in Fn?foe(Fn,Se,{enumerable:!0,configurable:!0,writable:!0,value:kc}):Fn[Se]=kc;var oo=(Fn,Se,kc)=>loe(Fn,typeof Se!="symbol"?Se+"":Se,kc);function kc(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const Yt=kc(Se);var nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ji(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Jp(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Xp={exports:{}},gf={};/** * @license React * react-jsx-runtime.production.min.js * @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Vy;function JA(){if(Vy)return gf;Vy=1;var t=Se,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,u,l){var d,g={},y=null,A=null;l!==void 0&&(y=""+l),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(A=u.ref);for(d in u)n.call(u,d)&&!s.hasOwnProperty(d)&&(g[d]=u[d]);if(a&&a.defaultProps)for(d in u=a.defaultProps,u)g[d]===void 0&&(g[d]=u[d]);return{$$typeof:e,type:a,key:y,ref:A,props:g,_owner:i.current}}return gf.Fragment=r,gf.jsx=o,gf.jsxs=o,gf}var mf={};/** + */var Wy;function XA(){if(Wy)return gf;Wy=1;var t=Se,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,u,l){var d,g={},y=null,A=null;l!==void 0&&(y=""+l),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(A=u.ref);for(d in u)n.call(u,d)&&!s.hasOwnProperty(d)&&(g[d]=u[d]);if(a&&a.defaultProps)for(d in u=a.defaultProps,u)g[d]===void 0&&(g[d]=u[d]);return{$$typeof:e,type:a,key:y,ref:A,props:g,_owner:i.current}}return gf.Fragment=r,gf.jsx=o,gf.jsxs=o,gf}var mf={};/** * @license React * react-jsx-runtime.development.js * @@ -14,42 +14,42 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Gy;function XA(){return Gy||(Gy=1,process.env.NODE_ENV!=="production"&&function(){var t=Se,e=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),A=Symbol.for("react.offscreen"),P=Symbol.iterator,O="@@iterator";function D(q){if(q===null||typeof q!="object")return null;var oe=P&&q[P]||q[O];return typeof oe=="function"?oe:null}var k=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function B(q){{for(var oe=arguments.length,ge=new Array(oe>1?oe-1:0),xe=1;xe1?oe-1:0),xe=1;xe=1&&tt>=0&&Ue[st]!==gt[tt];)tt--;for(;st>=1&&tt>=0;st--,tt--)if(Ue[st]!==gt[tt]){if(st!==1||tt!==1)do if(st--,tt--,tt<0||Ue[st]!==gt[tt]){var At=` -`+Ue[st].replace(" at new "," at ");return q.displayName&&At.includes("")&&(At=At.replace("",q.displayName)),typeof q=="function"&&R.set(q,At),At}while(st>=1&&tt>=0);break}}}finally{Q=!1,se.current=De,N(),Error.prepareStackTrace=Re}var Rt=q?q.displayName||q.name:"",Mt=Rt?X(Rt):"";return typeof q=="function"&&R.set(q,Mt),Mt}function he(q,oe,ge){return te(q,!1)}function ie(q){var oe=q.prototype;return!!(oe&&oe.isReactComponent)}function fe(q,oe,ge){if(q==null)return"";if(typeof q=="function")return te(q,ie(q));if(typeof q=="string")return X(q);switch(q){case l:return X("Suspense");case d:return X("SuspenseList")}if(typeof q=="object")switch(q.$$typeof){case u:return he(q.render);case g:return fe(q.type,oe,ge);case y:{var xe=q,Re=xe._payload,De=xe._init;try{return fe(De(Re),oe,ge)}catch{}}}return""}var ve=Object.prototype.hasOwnProperty,Me={},Ne=k.ReactDebugCurrentFrame;function Te(q){if(q){var oe=q._owner,ge=fe(q.type,q._source,oe?oe.type:null);Ne.setExtraStackFrame(ge)}else Ne.setExtraStackFrame(null)}function $e(q,oe,ge,xe,Re){{var De=Function.call.bind(ve);for(var it in q)if(De(q,it)){var Ue=void 0;try{if(typeof q[it]!="function"){var gt=Error((xe||"React class")+": "+ge+" type `"+it+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof q[it]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw gt.name="Invariant Violation",gt}Ue=q[it](oe,it,xe,ge,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(st){Ue=st}Ue&&!(Ue instanceof Error)&&(Te(Re),B("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",xe||"React class",ge,it,typeof Ue),Te(null)),Ue instanceof Error&&!(Ue.message in Me)&&(Me[Ue.message]=!0,Te(Re),B("Failed %s type: %s",ge,Ue.message),Te(null))}}}var Ie=Array.isArray;function Le(q){return Ie(q)}function Ve(q){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,ge=oe&&q[Symbol.toStringTag]||q.constructor.name||"Object";return ge}}function ke(q){try{return ze(q),!1}catch{return!0}}function ze(q){return""+q}function He(q){if(ke(q))return B("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ve(q)),ze(q)}var Ee=k.ReactCurrentOwner,Qe={key:!0,ref:!0,__self:!0,__source:!0},ct,Be,et;et={};function rt(q){if(ve.call(q,"ref")){var oe=Object.getOwnPropertyDescriptor(q,"ref").get;if(oe&&oe.isReactWarning)return!1}return q.ref!==void 0}function Je(q){if(ve.call(q,"key")){var oe=Object.getOwnPropertyDescriptor(q,"key").get;if(oe&&oe.isReactWarning)return!1}return q.key!==void 0}function pt(q,oe){if(typeof q.ref=="string"&&Ee.current&&oe&&Ee.current.stateNode!==oe){var ge=m(Ee.current.type);et[ge]||(B('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',m(Ee.current.type),q.ref),et[ge]=!0)}}function ht(q,oe){{var ge=function(){ct||(ct=!0,B("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};ge.isReactWarning=!0,Object.defineProperty(q,"key",{get:ge,configurable:!0})}}function ft(q,oe){{var ge=function(){Be||(Be=!0,B("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};ge.isReactWarning=!0,Object.defineProperty(q,"ref",{get:ge,configurable:!0})}}var Ht=function(q,oe,ge,xe,Re,De,it){var Ue={$$typeof:e,type:q,key:oe,ref:ge,props:it,_owner:De};return Ue._store={},Object.defineProperty(Ue._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ue,"_self",{configurable:!1,enumerable:!1,writable:!1,value:xe}),Object.defineProperty(Ue,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Re}),Object.freeze&&(Object.freeze(Ue.props),Object.freeze(Ue)),Ue};function Jt(q,oe,ge,xe,Re){{var De,it={},Ue=null,gt=null;ge!==void 0&&(He(ge),Ue=""+ge),Je(oe)&&(He(oe.key),Ue=""+oe.key),rt(oe)&&(gt=oe.ref,pt(oe,Re));for(De in oe)ve.call(oe,De)&&!Qe.hasOwnProperty(De)&&(it[De]=oe[De]);if(q&&q.defaultProps){var st=q.defaultProps;for(De in st)it[De]===void 0&&(it[De]=st[De])}if(Ue||gt){var tt=typeof q=="function"?q.displayName||q.name||"Unknown":q;Ue&&ht(it,tt),gt&&ft(it,tt)}return Ht(q,Ue,gt,Re,xe,Ee.current,it)}}var St=k.ReactCurrentOwner,er=k.ReactDebugCurrentFrame;function Xt(q){if(q){var oe=q._owner,ge=fe(q.type,q._source,oe?oe.type:null);er.setExtraStackFrame(ge)}else er.setExtraStackFrame(null)}var Ot;Ot=!1;function Bt(q){return typeof q=="object"&&q!==null&&q.$$typeof===e}function Tt(){{if(St.current){var q=m(St.current.type);if(q)return` +`+Ue[st].replace(" at new "," at ");return q.displayName&&At.includes("")&&(At=At.replace("",q.displayName)),typeof q=="function"&&R.set(q,At),At}while(st>=1&&tt>=0);break}}}finally{Q=!1,se.current=De,O(),Error.prepareStackTrace=Re}var Rt=q?q.displayName||q.name:"",Mt=Rt?X(Rt):"";return typeof q=="function"&&R.set(q,Mt),Mt}function le(q,oe,pe){return te(q,!1)}function ie(q){var oe=q.prototype;return!!(oe&&oe.isReactComponent)}function fe(q,oe,pe){if(q==null)return"";if(typeof q=="function")return te(q,ie(q));if(typeof q=="string")return X(q);switch(q){case l:return X("Suspense");case d:return X("SuspenseList")}if(typeof q=="object")switch(q.$$typeof){case u:return le(q.render);case g:return fe(q.type,oe,pe);case y:{var xe=q,Re=xe._payload,De=xe._init;try{return fe(De(Re),oe,pe)}catch{}}}return""}var ve=Object.prototype.hasOwnProperty,Me={},Ne=k.ReactDebugCurrentFrame;function Te(q){if(q){var oe=q._owner,pe=fe(q.type,q._source,oe?oe.type:null);Ne.setExtraStackFrame(pe)}else Ne.setExtraStackFrame(null)}function $e(q,oe,pe,xe,Re){{var De=Function.call.bind(ve);for(var it in q)if(De(q,it)){var Ue=void 0;try{if(typeof q[it]!="function"){var gt=Error((xe||"React class")+": "+pe+" type `"+it+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof q[it]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw gt.name="Invariant Violation",gt}Ue=q[it](oe,it,xe,pe,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(st){Ue=st}Ue&&!(Ue instanceof Error)&&(Te(Re),B("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",xe||"React class",pe,it,typeof Ue),Te(null)),Ue instanceof Error&&!(Ue.message in Me)&&(Me[Ue.message]=!0,Te(Re),B("Failed %s type: %s",pe,Ue.message),Te(null))}}}var Ie=Array.isArray;function Le(q){return Ie(q)}function Ve(q){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,pe=oe&&q[Symbol.toStringTag]||q.constructor.name||"Object";return pe}}function ke(q){try{return ze(q),!1}catch{return!0}}function ze(q){return""+q}function He(q){if(ke(q))return B("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ve(q)),ze(q)}var Ee=k.ReactCurrentOwner,Qe={key:!0,ref:!0,__self:!0,__source:!0},ct,Be,et;et={};function rt(q){if(ve.call(q,"ref")){var oe=Object.getOwnPropertyDescriptor(q,"ref").get;if(oe&&oe.isReactWarning)return!1}return q.ref!==void 0}function Je(q){if(ve.call(q,"key")){var oe=Object.getOwnPropertyDescriptor(q,"key").get;if(oe&&oe.isReactWarning)return!1}return q.key!==void 0}function pt(q,oe){if(typeof q.ref=="string"&&Ee.current&&oe&&Ee.current.stateNode!==oe){var pe=m(Ee.current.type);et[pe]||(B('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',m(Ee.current.type),q.ref),et[pe]=!0)}}function ht(q,oe){{var pe=function(){ct||(ct=!0,B("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};pe.isReactWarning=!0,Object.defineProperty(q,"key",{get:pe,configurable:!0})}}function ft(q,oe){{var pe=function(){Be||(Be=!0,B("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};pe.isReactWarning=!0,Object.defineProperty(q,"ref",{get:pe,configurable:!0})}}var Ht=function(q,oe,pe,xe,Re,De,it){var Ue={$$typeof:e,type:q,key:oe,ref:pe,props:it,_owner:De};return Ue._store={},Object.defineProperty(Ue._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ue,"_self",{configurable:!1,enumerable:!1,writable:!1,value:xe}),Object.defineProperty(Ue,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Re}),Object.freeze&&(Object.freeze(Ue.props),Object.freeze(Ue)),Ue};function Jt(q,oe,pe,xe,Re){{var De,it={},Ue=null,gt=null;pe!==void 0&&(He(pe),Ue=""+pe),Je(oe)&&(He(oe.key),Ue=""+oe.key),rt(oe)&&(gt=oe.ref,pt(oe,Re));for(De in oe)ve.call(oe,De)&&!Qe.hasOwnProperty(De)&&(it[De]=oe[De]);if(q&&q.defaultProps){var st=q.defaultProps;for(De in st)it[De]===void 0&&(it[De]=st[De])}if(Ue||gt){var tt=typeof q=="function"?q.displayName||q.name||"Unknown":q;Ue&&ht(it,tt),gt&&ft(it,tt)}return Ht(q,Ue,gt,Re,xe,Ee.current,it)}}var St=k.ReactCurrentOwner,er=k.ReactDebugCurrentFrame;function Xt(q){if(q){var oe=q._owner,pe=fe(q.type,q._source,oe?oe.type:null);er.setExtraStackFrame(pe)}else er.setExtraStackFrame(null)}var Ot;Ot=!1;function Bt(q){return typeof q=="object"&&q!==null&&q.$$typeof===e}function Tt(){{if(St.current){var q=m(St.current.type);if(q)return` -Check the render method of \``+q+"`."}return""}}function vt(q){return""}var Dt={};function Lt(q){{var oe=Tt();if(!oe){var ge=typeof q=="string"?q:q.displayName||q.name;ge&&(oe=` +Check the render method of \``+q+"`."}return""}}function vt(q){return""}var Dt={};function Lt(q){{var oe=Tt();if(!oe){var pe=typeof q=="string"?q:q.displayName||q.name;pe&&(oe=` -Check the top-level render call using <`+ge+">.")}return oe}}function bt(q,oe){{if(!q._store||q._store.validated||q.key!=null)return;q._store.validated=!0;var ge=Lt(oe);if(Dt[ge])return;Dt[ge]=!0;var xe="";q&&q._owner&&q._owner!==St.current&&(xe=" It was passed a child from "+m(q._owner.type)+"."),Xt(q),B('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ge,xe),Xt(null)}}function $t(q,oe){{if(typeof q!="object")return;if(Le(q))for(var ge=0;ge",Ue=" Did you accidentally export a JSX literal instead of a component?"):st=typeof q,B("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",st,Ue)}var tt=Jt(q,oe,ge,Re,De);if(tt==null)return tt;if(it){var At=oe.children;if(At!==void 0)if(xe)if(Le(At)){for(var Rt=0;Rt0?"{key: someKey, "+Et.join(": ..., ")+": ...}":"{key: someKey}";if(!Ft[Mt+dt]){var _t=Et.length>0?"{"+Et.join(": ..., ")+": ...}":"{}";B(`A props object containing a "key" prop is being spread into JSX: +Check the top-level render call using <`+pe+">.")}return oe}}function bt(q,oe){{if(!q._store||q._store.validated||q.key!=null)return;q._store.validated=!0;var pe=Lt(oe);if(Dt[pe])return;Dt[pe]=!0;var xe="";q&&q._owner&&q._owner!==St.current&&(xe=" It was passed a child from "+m(q._owner.type)+"."),Xt(q),B('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',pe,xe),Xt(null)}}function $t(q,oe){{if(typeof q!="object")return;if(Le(q))for(var pe=0;pe",Ue=" Did you accidentally export a JSX literal instead of a component?"):st=typeof q,B("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",st,Ue)}var tt=Jt(q,oe,pe,Re,De);if(tt==null)return tt;if(it){var At=oe.children;if(At!==void 0)if(xe)if(Le(At)){for(var Rt=0;Rt0?"{key: someKey, "+Et.join(": ..., ")+": ...}":"{key: someKey}";if(!Ft[Mt+dt]){var _t=Et.length>0?"{"+Et.join(": ..., ")+": ...}":"{}";B(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; - <%s key={someKey} {...props} />`,dt,Mt,_t,Mt),Ft[Mt+dt]=!0}}return q===n?nt(tt):jt(tt),tt}}function H(q,oe,ge){return $(q,oe,ge,!0)}function V(q,oe,ge){return $(q,oe,ge,!1)}var C=V,Y=H;mf.Fragment=n,mf.jsx=C,mf.jsxs=Y}()),mf}process.env.NODE_ENV==="production"?Xp.exports=JA():Xp.exports=XA();var le=Xp.exports;const Rs="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2",ZA=[{featured:!0,name:"MetaMask",rdns:"io.metamask",image:`${Rs}#metamask`,getWallet:{chrome_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",brave_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",edge_addon_id:"ejbalbakoplchlghecdalmeeeajnimhm",firefox_addon_id:"ether-metamask",play_store_id:"io.metamask",app_store_id:"id1438144202"},deep_link:"metamask://wc",universal_link:"https://metamask.app.link/wc"},{featured:!0,name:"OKX Wallet",rdns:"com.okex.wallet",image:`${Rs}#okx`,getWallet:{chrome_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",brave_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",edge_addon_id:"pbpjkcldjiffchgbbndmhojiacbgflha",play_store_id:"com.okinc.okex.gp",app_store_id:"id1327268470"},deep_link:"okex://main/wc",universal_link:"okex://main/wc"},{featured:!0,name:"WalletConnect",image:`${Rs}#walletconnect`},{featured:!1,name:"Coinbase Wallet",image:`${Rs}#coinbase`},{featured:!1,name:"GateWallet",rdns:"io.gate.wallet",image:`${Rs}#6e528abf-7a7d-47bd-d84d-481f169b1200`,getWallet:{chrome_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",brave_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",play_store_id:"com.gateio.gateio",app_store_id:"id1294998195",mac_app_store_id:"id1609559473"},deep_link:"https://www.gate.io/mobileapp",universal_link:"https://www.gate.io/mobileapp"},{featured:!1,name:"Onekey",rdns:"so.onekey.app.wallet",image:`${Rs}#onekey`,getWallet:{chrome_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",brave_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",play_store_id:"so.onekey.app.wallet",app_store_id:"id1609559473"},deep_link:"onekey-wallet://",universal_link:"onekey://wc"},{featured:!1,name:"Infinity Wallet",image:`${Rs}#9f259366-0bcd-4817-0af9-f78773e41900`,desktop_link:"infinity://wc"},{name:"Rabby Wallet",rdns:"io.rabby",featured:!1,image:`${Rs}#rabby`,getWallet:{chrome_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",brave_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",play_store_id:"com.debank.rabbymobile",app_store_id:"id6474381673"}},{name:"Binance Web3 Wallet",featured:!1,image:`${Rs}#ebac7b39-688c-41e3-7912-a4fefba74600`,getWallet:{play_store_id:"com.binance.dev",app_store_id:"id1436799971"}},{name:"Rainbow Wallet",rdns:"me.rainbow",featured:!1,image:`${Rs}#rainbow`,getWallet:{chrome_store_id:"opfgelmcmbiajamepnmloijbpoleiama",edge_addon_id:"cpojfbodiccabbabgimdeohkkpjfpbnf",firefox_addon_id:"rainbow-extension",app_store_id:"id1457119021",play_store_id:"me.rainbow"}}];function QA(t,e){const r=t.exec(e);return r==null?void 0:r.groups}const Yy=/^tuple(?(\[(\d*)\])*)$/;function Zp(t){let e=t.type;if(Yy.test(t.type)&&"components"in t){e="(";const r=t.components.length;for(let i=0;ie(t,s)}function Bc(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new hP(t.type);return`${t.name}(${Qp(t.inputs,{includeName:e})})`}function Qp(t,{includeName:e=!1}={}){return t?t.map(r=>tP(r,{includeName:e})).join(e?", ":","):""}function tP(t,{includeName:e}){return t.type.startsWith("tuple")?`(${Qp(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}function Zo(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function _n(t){return Zo(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const Jy="2.21.45";let bf={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${Jy}`};class yt extends Error{constructor(e,r={}){var a;const n=(()=>{var u;return r.cause instanceof yt?r.cause.details:(u=r.cause)!=null&&u.message?r.cause.message:r.details})(),i=r.cause instanceof yt&&r.cause.docsPath||r.docsPath,s=(a=bf.getDocsUrl)==null?void 0:a.call(bf,{...r,docsPath:i}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...bf.version?[`Version: ${bf.version}`]:[]].join(` -`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=Jy}walk(e){return Xy(this,e)}}function Xy(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?Xy(t.cause,e):e?null:t}class rP extends yt{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` -`),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class Zy extends yt{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` -`),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class nP extends yt{constructor({data:e,params:r,size:n}){super([`Data size of ${n} bytes is too small for given parameters.`].join(` -`),{metaMessages:[`Params: (${Qp(r,{includeName:!0})})`,`Data: ${e} (${n} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=r,this.size=n}}class eg extends yt{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class iP extends yt{constructor({expectedLength:e,givenLength:r,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${e}`,`Given length: ${r}`].join(` -`),{name:"AbiEncodingArrayLengthMismatchError"})}}class sP extends yt{constructor({expectedSize:e,value:r}){super(`Size of bytes "${r}" (bytes${_n(r)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class oP extends yt{constructor({expectedLength:e,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${r}`].join(` -`),{name:"AbiEncodingLengthMismatchError"})}}class Qy extends yt{constructor(e,{docsPath:r}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(` -`),{docsPath:r,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class ew extends yt{constructor(e,{docsPath:r}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` -`),{docsPath:r,name:"AbiFunctionNotFoundError"})}}class aP extends yt{constructor(e,r){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${Bc(e.abiItem)}\`, and`,`\`${r.type}\` in \`${Bc(r.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class cP extends yt{constructor({expectedSize:e,givenSize:r}){super(`Expected bytes${e}, got bytes${r}.`,{name:"BytesSizeMismatchError"})}}class uP extends yt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(` -`),{docsPath:r,name:"InvalidAbiEncodingType"})}}class fP extends yt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` -`),{docsPath:r,name:"InvalidAbiDecodingType"})}}class lP extends yt{constructor(e){super([`Value "${e}" is not a valid array.`].join(` -`),{name:"InvalidArrayError"})}}class hP extends yt{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` -`),{name:"InvalidDefinitionTypeError"})}}class tw extends yt{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}class rw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}class nw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function $c(t,{dir:e,size:r=32}={}){return typeof t=="string"?Qo(t,{dir:e,size:r}):dP(t,{dir:e,size:r})}function Qo(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new rw({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function dP(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new rw({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie)throw new mP({givenSize:_n(t),maxSize:e})}function yf(t,e={}){const{signed:r}=e;e.size&&Ds(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<e.toString(16).padStart(2,"0"));function Dh(t,e={}){return typeof t=="number"||typeof t=="bigint"?Pr(t,e):typeof t=="string"?Oh(t,e):typeof t=="boolean"?iw(t,e):li(t,e)}function iw(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(Ds(r,{size:e.size}),$c(r,{size:e.size})):r}function li(t,e={}){let r="";for(let i=0;is||i=uo.zero&&t<=uo.nine)return t-uo.zero;if(t>=uo.A&&t<=uo.F)return t-(uo.A-10);if(t>=uo.a&&t<=uo.f)return t-(uo.a-10)}function fo(t,e={}){let r=t;e.size&&(Ds(r,{size:e.size}),r=$c(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function EP(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Nh(t.outputLen),Nh(t.blockLen)}function Uc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function aw(t,e){jc(t);const r=e.outputLen;if(t.length>cw&Lh)}:{h:Number(t>>cw&Lh)|0,l:Number(t&Lh)|0}}function AP(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;it<>>32-r,MP=(t,e,r)=>e<>>32-r,IP=(t,e,r)=>e<>>64-r,CP=(t,e,r)=>t<>>64-r,qc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const TP=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),ng=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Os=(t,e)=>t<<32-e|t>>>e,uw=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,RP=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function fw(t){for(let e=0;ee.toString(16).padStart(2,"0"));function OP(t){jc(t);let e="";for(let r=0;rt().update(wf(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function kP(t){const e=(n,i)=>t(i).update(wf(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function BP(t=32){if(qc&&typeof qc.getRandomValues=="function")return qc.getRandomValues(new Uint8Array(t));if(qc&&typeof qc.randomBytes=="function")return qc.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const hw=[],dw=[],pw=[],$P=BigInt(0),xf=BigInt(1),FP=BigInt(2),jP=BigInt(7),UP=BigInt(256),qP=BigInt(113);for(let t=0,e=xf,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],hw.push(2*(5*n+r)),dw.push((t+1)*(t+2)/2%64);let i=$P;for(let s=0;s<7;s++)e=(e<>jP)*qP)%UP,e&FP&&(i^=xf<<(xf<r>32?IP(t,e,r):PP(t,e,r),mw=(t,e,r)=>r>32?CP(t,e,r):MP(t,e,r);function vw(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,u=(o+2)%10,l=r[u],d=r[u+1],g=gw(l,d,1)^r[a],y=mw(l,d,1)^r[a+1];for(let A=0;A<50;A+=10)t[o+A]^=g,t[o+A+1]^=y}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=dw[o],u=gw(i,s,a),l=mw(i,s,a),d=hw[o];i=t[d],s=t[d+1],t[d]=u,t[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=zP[n],t[1]^=HP[n]}r.fill(0)}class _f extends ig{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Nh(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=TP(this.state)}keccak(){uw||fw(this.state32),vw(this.state32,this.rounds),uw||fw(this.state32),this.posOut=0,this.pos=0}update(e){Uc(this);const{blockLen:r,state:n}=this;e=wf(e);const i=e.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Nh(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(aw(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new _f(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const ea=(t,e,r)=>lw(()=>new _f(e,t,r)),WP=ea(6,144,224/8),KP=ea(6,136,256/8),VP=ea(6,104,384/8),GP=ea(6,72,512/8),YP=ea(1,144,224/8),bw=ea(1,136,256/8),JP=ea(1,104,384/8),XP=ea(1,72,512/8),yw=(t,e,r)=>kP((n={})=>new _f(e,t,n.dkLen===void 0?r:n.dkLen,!0)),ZP=yw(31,168,128/8),QP=yw(31,136,256/8),eM=Object.freeze(Object.defineProperty({__proto__:null,Keccak:_f,keccakP:vw,keccak_224:YP,keccak_256:bw,keccak_384:JP,keccak_512:XP,sha3_224:WP,sha3_256:KP,sha3_384:VP,sha3_512:GP,shake128:ZP,shake256:QP},Symbol.toStringTag,{value:"Module"}));function Ef(t,e){const r=e||"hex",n=bw(Zo(t,{strict:!1})?rg(t):t);return r==="bytes"?n:Dh(n)}const tM=t=>Ef(rg(t));function rM(t){return tM(t)}function nM(t){let e=!0,r="",n=0,i="",s=!1;for(let o=0;o{const e=typeof t=="string"?t:eP(t);return nM(e)};function ww(t){return rM(iM(t))}const sM=ww;class zc extends yt{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class kh extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const sg=new kh(8192);function Sf(t,e){if(sg.has(`${t}.${e}`))return sg.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=Ef(ow(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return sg.set(`${t}.${e}`,s),s}function og(t,e){if(!lo(t,{strict:!1}))throw new zc({address:t});return Sf(t,e)}const oM=/^0x[a-fA-F0-9]{40}$/,ag=new kh(8192);function lo(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(ag.has(n))return ag.get(n);const i=oM.test(t)?t.toLowerCase()===t?!0:r?Sf(t)===t:!0:!1;return ag.set(n,i),i}function Hc(t){return typeof t[0]=="string"?Bh(t):aM(t)}function aM(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function Bh(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}function $h(t,e,r,{strict:n}={}){return Zo(t,{strict:!1})?cM(t,e,r,{strict:n}):Ew(t,e,r,{strict:n})}function xw(t,e){if(typeof e=="number"&&e>0&&e>_n(t)-1)throw new tw({offset:e,position:"start",size:_n(t)})}function _w(t,e,r){if(typeof e=="number"&&typeof r=="number"&&_n(t)!==r-e)throw new tw({offset:r,position:"end",size:_n(t)})}function Ew(t,e,r,{strict:n}={}){xw(t,e);const i=t.slice(e,r);return n&&_w(i,e,r),i}function cM(t,e,r,{strict:n}={}){xw(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&_w(i,e,r),i}function Sw(t,e){if(t.length!==e.length)throw new oP({expectedLength:t.length,givenLength:e.length});const r=uM({params:t,values:e}),n=ug(r);return n.length===0?"0x":n}function uM({params:t,values:e}){const r=[];for(let n=0;n0?Hc([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:Hc(s.map(({encoded:o})=>o))}}function hM(t,{param:e}){const[,r]=e.type.split("bytes"),n=_n(t);if(!r){let i=t;return n%32!==0&&(i=Qo(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:Hc([Qo(Pr(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new sP({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:Qo(t,{dir:"right"})}}function dM(t){if(typeof t!="boolean")throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Qo(iw(t))}}function pM(t,{signed:e}){return{dynamic:!1,encoded:Pr(t,{size:32,signed:e})}}function gM(t){const e=Oh(t),r=Math.ceil(_n(e)/32),n=[];for(let i=0;ii))}}function fg(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const lg=t=>$h(ww(t),0,4);function Aw(t){const{abi:e,args:r=[],name:n}=t,i=Zo(n,{strict:!1}),s=e.filter(a=>i?a.type==="function"?lg(a)===n:a.type==="event"?sM(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((l,d)=>{const g="inputs"in a&&a.inputs[d];return g?hg(l,g):!1})){if(o&&"inputs"in o&&o.inputs){const l=Pw(a.inputs,o.inputs,r);if(l)throw new aP({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||s[0]}function hg(t,e){const r=typeof t,n=e.type;switch(n){case"address":return lo(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>hg(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>hg(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Pw(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return Pw(i.components,s.components,r[n]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?lo(r[n],{strict:!1}):o.includes("address")&&o.includes("bytes")?lo(r[n],{strict:!1}):!1)return o}}function ho(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const Mw="/docs/contract/encodeFunctionData";function vM(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=Aw({abi:e,args:r,name:n});if(!s)throw new ew(n,{docsPath:Mw});i=s}if(i.type!=="function")throw new ew(void 0,{docsPath:Mw});return{abi:[i],functionName:lg(Bc(i))}}function bM(t){const{args:e}=t,{abi:r,functionName:n}=(()=>{var a;return t.abi.length===1&&((a=t.functionName)!=null&&a.startsWith("0x"))?t:vM(t)})(),i=r[0],s=n,o="inputs"in i&&i.inputs?Sw(i.inputs,e??[]):void 0;return Bh([s,o??"0x"])}const yM={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},wM={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},xM={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Iw extends yt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class _M extends yt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class EM extends yt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const SM={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new EM({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new _M({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Iw({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Iw({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function dg(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(SM);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function AM(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return yf(r,e)}function PM(t,e={}){let r=t;if(typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r)),r.length>1||r[0]>1)throw new gP(r);return!!r[0]}function po(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return Fc(r,e)}function MM(t,e={}){let r=t;return typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r,{dir:"right"})),new TextDecoder().decode(r)}function IM(t,e){const r=typeof e=="string"?fo(e):e,n=dg(r);if(_n(r)===0&&t.length>0)throw new eg;if(_n(e)&&_n(e)<32)throw new nP({data:typeof e=="string"?e:li(e),params:t,size:_n(e)});let i=0;const s=[];for(let o=0;o48?AM(i,{signed:r}):po(i,{signed:r}),32]}function NM(t,e,{staticPosition:r}){const n=e.components.length===0||e.components.some(({name:o})=>!o),i=n?[]:{};let s=0;if(Af(e)){const o=po(t.readBytes(pg)),a=r+o;for(let u=0;uo.type==="error"&&n===lg(Bc(o)));if(!s)throw new Qy(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?IM(s.inputs,$h(r,4)):void 0,errorName:s.name}}const Kc=(t,e,r)=>JSON.stringify(t,(n,i)=>typeof i=="bigint"?i.toString():i,r);function Tw({abiItem:t,args:e,includeFunctionName:r=!0,includeName:n=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${r?t.name:""}(${t.inputs.map((i,s)=>`${n&&i.name?`${i.name}: `:""}${typeof e[s]=="object"?Kc(e[s]):e[s]}`).join(", ")})`}const BM={gwei:9,wei:18},$M={ether:-9,wei:9};function Rw(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}function Dw(t,e="wei"){return Rw(t,BM[e])}function hs(t,e="wei"){return Rw(t,$M[e])}class FM extends yt{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class jM extends yt{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Fh(t){const e=Object.entries(t).map(([n,i])=>i===void 0||i===!1?null:[n,i]).filter(Boolean),r=e.reduce((n,[i])=>Math.max(n,i.length),0);return e.map(([n,i])=>` ${`${n}:`.padEnd(r+1)} ${i}`).join(` -`)}class UM extends yt{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(` -`),{name:"FeeConflictError"})}}class qM extends yt{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Fh(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class zM extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:g,value:y}){var P;const A=Fh({chain:i&&`${i==null?void 0:i.name} (id: ${i==null?void 0:i.id})`,from:r==null?void 0:r.address,to:g,value:typeof y<"u"&&`${Dw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",A].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const HM=t=>t,Ow=t=>t;class WM extends yt{constructor(e,{abi:r,args:n,contractAddress:i,docsPath:s,functionName:o,sender:a}){const u=Aw({abi:r,args:n,name:o}),l=u?Tw({abiItem:u,args:n,includeFunctionName:!1,includeName:!1}):void 0,d=u?Bc(u,{includeName:!0}):void 0,g=Fh({address:i&&HM(i),function:d,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:s,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],g&&"Contract Call:",g].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=e,this.contractAddress=i,this.functionName=o,this.sender=a}}class KM extends yt{constructor({abi:e,data:r,functionName:n,message:i}){let s,o,a,u;if(r&&r!=="0x")try{o=kM({abi:e,data:r});const{abiItem:d,errorName:g,args:y}=o;if(g==="Error")u=y[0];else if(g==="Panic"){const[A]=y;u=yM[A]}else{const A=d?Bc(d,{includeName:!0}):void 0,P=d&&y?Tw({abiItem:d,args:y,includeFunctionName:!1,includeName:!1}):void 0;a=[A?`Error: ${A}`:"",P&&P!=="()"?` ${[...Array((g==null?void 0:g.length)??0).keys()].map(()=>" ").join("")}${P}`:""]}}catch(d){s=d}else i&&(u=i);let l;s instanceof Qy&&(l=s.signature,a=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(u&&u!=="execution reverted"||l?[`The contract function "${n}" reverted with the following ${l?"signature":"reason"}:`,u||l].join(` -`):`The contract function "${n}" reverted.`,{cause:s,metaMessages:a,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.reason=u,this.signature=l}}class VM extends yt{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class GM extends yt{constructor({data:e,message:r}){super(r||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}class Nw extends yt{constructor({body:e,cause:r,details:n,headers:i,status:s,url:o}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${Ow(o)}`,e&&`Request body: ${Kc(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=i,this.status=s,this.url=o}}class YM extends yt{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${Ow(n)}`,`Request body: ${Kc(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code}}const JM=-1;class hi extends yt{constructor(e,{code:r,docsPath:n,metaMessages:i,name:s,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:i||(e==null?void 0:e.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||e.name,this.code=e instanceof YM?e.code:r??JM}}class Vc extends hi{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class Pf extends hi{constructor(e){super(e,{code:Pf.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Pf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Mf extends hi{constructor(e){super(e,{code:Mf.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Mf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class If extends hi{constructor(e,{method:r}={}){super(e,{code:If.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(If,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Cf extends hi{constructor(e){super(e,{code:Cf.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` -`)})}}Object.defineProperty(Cf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Fa extends hi{constructor(e){super(e,{code:Fa.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Fa,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Tf extends hi{constructor(e){super(e,{code:Tf.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` -`)})}}Object.defineProperty(Tf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Rf extends hi{constructor(e){super(e,{code:Rf.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Rf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Df extends hi{constructor(e){super(e,{code:Df.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Df,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Of extends hi{constructor(e){super(e,{code:Of.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Of,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Nf extends hi{constructor(e,{method:r}={}){super(e,{code:Nf.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not implemented.`})}}Object.defineProperty(Nf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Gc extends hi{constructor(e){super(e,{code:Gc.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Gc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Lf extends hi{constructor(e){super(e,{code:Lf.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Lf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Yc extends Vc{constructor(e){super(e,{code:Yc.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Yc,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class kf extends Vc{constructor(e){super(e,{code:kf.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(kf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Bf extends Vc{constructor(e,{method:r}={}){super(e,{code:Bf.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(Bf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class $f extends Vc{constructor(e){super(e,{code:$f.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty($f,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Ff extends Vc{constructor(e){super(e,{code:Ff.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Ff,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class jf extends Vc{constructor(e){super(e,{code:jf.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(jf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class XM extends hi{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const ZM=3;function QM(t,{abi:e,address:r,args:n,docsPath:i,functionName:s,sender:o}){const{code:a,data:u,message:l,shortMessage:d}=t instanceof GM?t:t instanceof yt?t.walk(y=>"data"in y)||t.walk():{},g=t instanceof eg?new VM({functionName:s}):[ZM,Fa.code].includes(a)&&(u||l||d)?new KM({abi:e,data:typeof u=="object"?u.data:u,functionName:s,message:d??l}):t;return new WM(g,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:o})}function eI(t){const e=Ef(`0x${t.substring(4)}`).substring(26);return Sf(`0x${e}`)}async function tI({hash:t,signature:e}){const r=Zo(t)?t:Dh(t),{secp256k1:n}=await Promise.resolve().then(()=>jC);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:d,v:g,yParity:y}=e,A=Number(y??g),P=Lw(A);return new n.Signature(yf(l),yf(d)).addRecoveryBit(P)}const o=Zo(e)?e:Dh(e),a=Fc(`0x${o.slice(130)}`),u=Lw(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Lw(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function rI({hash:t,signature:e}){return eI(await tI({hash:t,signature:e}))}function nI(t,e="hex"){const r=kw(t),n=dg(new Uint8Array(r.length));return r.encode(n),e==="hex"?li(n.bytes):n.bytes}function kw(t){return Array.isArray(t)?iI(t.map(e=>kw(e))):sI(t)}function iI(t){const e=t.reduce((i,s)=>i+s.length,0),r=Bw(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function sI(t){const e=typeof t=="string"?fo(t):t,r=Bw(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function Bw(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new yt("Length is too large.")}function oI(t){const{chainId:e,contractAddress:r,nonce:n,to:i}=t,s=Ef(Bh(["0x05",nI([e?Pr(e):"0x",r,n?Pr(n):"0x"])]));return i==="bytes"?fo(s):s}async function $w(t){const{authorization:e,signature:r}=t;return rI({hash:oI(e),signature:r??e})}class aI extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:g,value:y}){var P;const A=Fh({from:r==null?void 0:r.address,to:g,value:typeof y<"u"&&`${Dw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",A].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class Jc extends yt{constructor({cause:e,message:r}={}){var i;const n=(i=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(Jc,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Jc,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class jh extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(jh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class gg extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(gg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class mg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(mg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class vg extends yt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` + <%s key={someKey} {...props} />`,dt,Mt,_t,Mt),Ft[Mt+dt]=!0}}return q===n?nt(tt):jt(tt),tt}}function H(q,oe,pe){return $(q,oe,pe,!0)}function V(q,oe,pe){return $(q,oe,pe,!1)}var C=V,Y=H;mf.Fragment=n,mf.jsx=C,mf.jsxs=Y}()),mf}process.env.NODE_ENV==="production"?Xp.exports=XA():Xp.exports=ZA();var ge=Xp.exports;const Rs="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2",QA=[{featured:!0,name:"MetaMask",rdns:"io.metamask",image:`${Rs}#metamask`,getWallet:{chrome_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",brave_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",edge_addon_id:"ejbalbakoplchlghecdalmeeeajnimhm",firefox_addon_id:"ether-metamask",play_store_id:"io.metamask",app_store_id:"id1438144202"},deep_link:"metamask://wc",universal_link:"https://metamask.app.link/wc"},{featured:!0,name:"OKX Wallet",rdns:"com.okex.wallet",image:`${Rs}#okx`,getWallet:{chrome_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",brave_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",edge_addon_id:"pbpjkcldjiffchgbbndmhojiacbgflha",play_store_id:"com.okinc.okex.gp",app_store_id:"id1327268470"},deep_link:"okex://main/wc",universal_link:"okex://main/wc"},{featured:!0,name:"WalletConnect",image:`${Rs}#walletconnect`},{featured:!1,name:"Coinbase Wallet",image:`${Rs}#coinbase`},{featured:!1,name:"GateWallet",rdns:"io.gate.wallet",image:`${Rs}#6e528abf-7a7d-47bd-d84d-481f169b1200`,getWallet:{chrome_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",brave_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",play_store_id:"com.gateio.gateio",app_store_id:"id1294998195",mac_app_store_id:"id1609559473"},deep_link:"https://www.gate.io/mobileapp",universal_link:"https://www.gate.io/mobileapp"},{featured:!1,name:"Onekey",rdns:"so.onekey.app.wallet",image:`${Rs}#onekey`,getWallet:{chrome_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",brave_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",play_store_id:"so.onekey.app.wallet",app_store_id:"id1609559473"},deep_link:"onekey-wallet://",universal_link:"onekey://wc"},{featured:!1,name:"Infinity Wallet",image:`${Rs}#9f259366-0bcd-4817-0af9-f78773e41900`,desktop_link:"infinity://wc"},{name:"Rabby Wallet",rdns:"io.rabby",featured:!1,image:`${Rs}#rabby`,getWallet:{chrome_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",brave_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",play_store_id:"com.debank.rabbymobile",app_store_id:"id6474381673"}},{name:"Binance Web3 Wallet",featured:!1,image:`${Rs}#ebac7b39-688c-41e3-7912-a4fefba74600`,getWallet:{play_store_id:"com.binance.dev",app_store_id:"id1436799971"}},{name:"Rainbow Wallet",rdns:"me.rainbow",featured:!1,image:`${Rs}#rainbow`,getWallet:{chrome_store_id:"opfgelmcmbiajamepnmloijbpoleiama",edge_addon_id:"cpojfbodiccabbabgimdeohkkpjfpbnf",firefox_addon_id:"rainbow-extension",app_store_id:"id1457119021",play_store_id:"me.rainbow"}}];function eP(t,e){const r=t.exec(e);return r==null?void 0:r.groups}const Vy=/^tuple(?(\[(\d*)\])*)$/;function Zp(t){let e=t.type;if(Vy.test(t.type)&&"components"in t){e="(";const r=t.components.length;for(let i=0;ie(t,s)}function Bc(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new dP(t.type);return`${t.name}(${Qp(t.inputs,{includeName:e})})`}function Qp(t,{includeName:e=!1}={}){return t?t.map(r=>rP(r,{includeName:e})).join(e?", ":","):""}function rP(t,{includeName:e}){return t.type.startsWith("tuple")?`(${Qp(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}function Jo(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function _n(t){return Jo(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const Gy="2.21.45";let bf={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${Gy}`};class yt extends Error{constructor(e,r={}){var a;const n=(()=>{var u;return r.cause instanceof yt?r.cause.details:(u=r.cause)!=null&&u.message?r.cause.message:r.details})(),i=r.cause instanceof yt&&r.cause.docsPath||r.docsPath,s=(a=bf.getDocsUrl)==null?void 0:a.call(bf,{...r,docsPath:i}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...bf.version?[`Version: ${bf.version}`]:[]].join(` +`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=Gy}walk(e){return Yy(this,e)}}function Yy(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?Yy(t.cause,e):e?null:t}class nP extends yt{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` +`),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class Jy extends yt{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` +`),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class iP extends yt{constructor({data:e,params:r,size:n}){super([`Data size of ${n} bytes is too small for given parameters.`].join(` +`),{metaMessages:[`Params: (${Qp(r,{includeName:!0})})`,`Data: ${e} (${n} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=r,this.size=n}}class eg extends yt{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class sP extends yt{constructor({expectedLength:e,givenLength:r,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${e}`,`Given length: ${r}`].join(` +`),{name:"AbiEncodingArrayLengthMismatchError"})}}class oP extends yt{constructor({expectedSize:e,value:r}){super(`Size of bytes "${r}" (bytes${_n(r)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class aP extends yt{constructor({expectedLength:e,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${r}`].join(` +`),{name:"AbiEncodingLengthMismatchError"})}}class Xy extends yt{constructor(e,{docsPath:r}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(` +`),{docsPath:r,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class Zy extends yt{constructor(e,{docsPath:r}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` +`),{docsPath:r,name:"AbiFunctionNotFoundError"})}}class cP extends yt{constructor(e,r){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${Bc(e.abiItem)}\`, and`,`\`${r.type}\` in \`${Bc(r.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class uP extends yt{constructor({expectedSize:e,givenSize:r}){super(`Expected bytes${e}, got bytes${r}.`,{name:"BytesSizeMismatchError"})}}class fP extends yt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(` +`),{docsPath:r,name:"InvalidAbiEncodingType"})}}class lP extends yt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` +`),{docsPath:r,name:"InvalidAbiDecodingType"})}}class hP extends yt{constructor(e){super([`Value "${e}" is not a valid array.`].join(` +`),{name:"InvalidArrayError"})}}class dP extends yt{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` +`),{name:"InvalidDefinitionTypeError"})}}class Qy extends yt{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}class ew extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}class tw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function $c(t,{dir:e,size:r=32}={}){return typeof t=="string"?Xo(t,{dir:e,size:r}):pP(t,{dir:e,size:r})}function Xo(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new ew({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function pP(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new ew({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie)throw new vP({givenSize:_n(t),maxSize:e})}function yf(t,e={}){const{signed:r}=e;e.size&&Ds(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<e.toString(16).padStart(2,"0"));function Dh(t,e={}){return typeof t=="number"||typeof t=="bigint"?Pr(t,e):typeof t=="string"?Oh(t,e):typeof t=="boolean"?rw(t,e):li(t,e)}function rw(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(Ds(r,{size:e.size}),$c(r,{size:e.size})):r}function li(t,e={}){let r="";for(let i=0;is||i=ao.zero&&t<=ao.nine)return t-ao.zero;if(t>=ao.A&&t<=ao.F)return t-(ao.A-10);if(t>=ao.a&&t<=ao.f)return t-(ao.a-10)}function co(t,e={}){let r=t;e.size&&(Ds(r,{size:e.size}),r=$c(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function SP(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Nh(t.outputLen),Nh(t.blockLen)}function Uc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function sw(t,e){jc(t);const r=e.outputLen;if(t.length>ow&Lh)}:{h:Number(t>>ow&Lh)|0,l:Number(t&Lh)|0}}function PP(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;it<>>32-r,IP=(t,e,r)=>e<>>32-r,CP=(t,e,r)=>e<>>64-r,TP=(t,e,r)=>t<>>64-r,qc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const RP=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),ng=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Os=(t,e)=>t<<32-e|t>>>e,aw=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,DP=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function cw(t){for(let e=0;ee.toString(16).padStart(2,"0"));function NP(t){jc(t);let e="";for(let r=0;rt().update(wf(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function BP(t){const e=(n,i)=>t(i).update(wf(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function $P(t=32){if(qc&&typeof qc.getRandomValues=="function")return qc.getRandomValues(new Uint8Array(t));if(qc&&typeof qc.randomBytes=="function")return qc.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const fw=[],lw=[],hw=[],FP=BigInt(0),xf=BigInt(1),jP=BigInt(2),UP=BigInt(7),qP=BigInt(256),zP=BigInt(113);for(let t=0,e=xf,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],fw.push(2*(5*n+r)),lw.push((t+1)*(t+2)/2%64);let i=FP;for(let s=0;s<7;s++)e=(e<>UP)*zP)%qP,e&jP&&(i^=xf<<(xf<r>32?CP(t,e,r):MP(t,e,r),pw=(t,e,r)=>r>32?TP(t,e,r):IP(t,e,r);function gw(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,u=(o+2)%10,l=r[u],d=r[u+1],g=dw(l,d,1)^r[a],y=pw(l,d,1)^r[a+1];for(let A=0;A<50;A+=10)t[o+A]^=g,t[o+A+1]^=y}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=lw[o],u=dw(i,s,a),l=pw(i,s,a),d=fw[o];i=t[d],s=t[d+1],t[d]=u,t[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=HP[n],t[1]^=WP[n]}r.fill(0)}class _f extends ig{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Nh(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=RP(this.state)}keccak(){aw||cw(this.state32),gw(this.state32,this.rounds),aw||cw(this.state32),this.posOut=0,this.pos=0}update(e){Uc(this);const{blockLen:r,state:n}=this;e=wf(e);const i=e.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Nh(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(sw(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new _f(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Zo=(t,e,r)=>uw(()=>new _f(e,t,r)),KP=Zo(6,144,224/8),VP=Zo(6,136,256/8),GP=Zo(6,104,384/8),YP=Zo(6,72,512/8),JP=Zo(1,144,224/8),mw=Zo(1,136,256/8),XP=Zo(1,104,384/8),ZP=Zo(1,72,512/8),vw=(t,e,r)=>BP((n={})=>new _f(e,t,n.dkLen===void 0?r:n.dkLen,!0)),QP=vw(31,168,128/8),eM=vw(31,136,256/8),tM=Object.freeze(Object.defineProperty({__proto__:null,Keccak:_f,keccakP:gw,keccak_224:JP,keccak_256:mw,keccak_384:XP,keccak_512:ZP,sha3_224:KP,sha3_256:VP,sha3_384:GP,sha3_512:YP,shake128:QP,shake256:eM},Symbol.toStringTag,{value:"Module"}));function Ef(t,e){const r=e||"hex",n=mw(Jo(t,{strict:!1})?rg(t):t);return r==="bytes"?n:Dh(n)}const rM=t=>Ef(rg(t));function nM(t){return rM(t)}function iM(t){let e=!0,r="",n=0,i="",s=!1;for(let o=0;o{const e=typeof t=="string"?t:tP(t);return iM(e)};function bw(t){return nM(sM(t))}const oM=bw;class zc extends yt{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class kh extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const sg=new kh(8192);function Sf(t,e){if(sg.has(`${t}.${e}`))return sg.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=Ef(iw(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return sg.set(`${t}.${e}`,s),s}function og(t,e){if(!uo(t,{strict:!1}))throw new zc({address:t});return Sf(t,e)}const aM=/^0x[a-fA-F0-9]{40}$/,ag=new kh(8192);function uo(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(ag.has(n))return ag.get(n);const i=aM.test(t)?t.toLowerCase()===t?!0:r?Sf(t)===t:!0:!1;return ag.set(n,i),i}function Hc(t){return typeof t[0]=="string"?Bh(t):cM(t)}function cM(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function Bh(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}function $h(t,e,r,{strict:n}={}){return Jo(t,{strict:!1})?uM(t,e,r,{strict:n}):xw(t,e,r,{strict:n})}function yw(t,e){if(typeof e=="number"&&e>0&&e>_n(t)-1)throw new Qy({offset:e,position:"start",size:_n(t)})}function ww(t,e,r){if(typeof e=="number"&&typeof r=="number"&&_n(t)!==r-e)throw new Qy({offset:r,position:"end",size:_n(t)})}function xw(t,e,r,{strict:n}={}){yw(t,e);const i=t.slice(e,r);return n&&ww(i,e,r),i}function uM(t,e,r,{strict:n}={}){yw(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&ww(i,e,r),i}function _w(t,e){if(t.length!==e.length)throw new aP({expectedLength:t.length,givenLength:e.length});const r=fM({params:t,values:e}),n=ug(r);return n.length===0?"0x":n}function fM({params:t,values:e}){const r=[];for(let n=0;n0?Hc([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:Hc(s.map(({encoded:o})=>o))}}function dM(t,{param:e}){const[,r]=e.type.split("bytes"),n=_n(t);if(!r){let i=t;return n%32!==0&&(i=Xo(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:Hc([Xo(Pr(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new oP({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:Xo(t,{dir:"right"})}}function pM(t){if(typeof t!="boolean")throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Xo(rw(t))}}function gM(t,{signed:e}){return{dynamic:!1,encoded:Pr(t,{size:32,signed:e})}}function mM(t){const e=Oh(t),r=Math.ceil(_n(e)/32),n=[];for(let i=0;ii))}}function fg(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const lg=t=>$h(bw(t),0,4);function Ew(t){const{abi:e,args:r=[],name:n}=t,i=Jo(n,{strict:!1}),s=e.filter(a=>i?a.type==="function"?lg(a)===n:a.type==="event"?oM(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((l,d)=>{const g="inputs"in a&&a.inputs[d];return g?hg(l,g):!1})){if(o&&"inputs"in o&&o.inputs){const l=Sw(a.inputs,o.inputs,r);if(l)throw new cP({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||s[0]}function hg(t,e){const r=typeof t,n=e.type;switch(n){case"address":return uo(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>hg(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>hg(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Sw(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return Sw(i.components,s.components,r[n]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?uo(r[n],{strict:!1}):o.includes("address")&&o.includes("bytes")?uo(r[n],{strict:!1}):!1)return o}}function fo(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const Aw="/docs/contract/encodeFunctionData";function bM(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=Ew({abi:e,args:r,name:n});if(!s)throw new Zy(n,{docsPath:Aw});i=s}if(i.type!=="function")throw new Zy(void 0,{docsPath:Aw});return{abi:[i],functionName:lg(Bc(i))}}function yM(t){const{args:e}=t,{abi:r,functionName:n}=(()=>{var a;return t.abi.length===1&&((a=t.functionName)!=null&&a.startsWith("0x"))?t:bM(t)})(),i=r[0],s=n,o="inputs"in i&&i.inputs?_w(i.inputs,e??[]):void 0;return Bh([s,o??"0x"])}const wM={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},xM={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},_M={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Pw extends yt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class EM extends yt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class SM extends yt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const AM={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new SM({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new EM({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Pw({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Pw({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function dg(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(AM);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function PM(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return yf(r,e)}function MM(t,e={}){let r=t;if(typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r)),r.length>1||r[0]>1)throw new mP(r);return!!r[0]}function lo(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return Fc(r,e)}function IM(t,e={}){let r=t;return typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r,{dir:"right"})),new TextDecoder().decode(r)}function CM(t,e){const r=typeof e=="string"?co(e):e,n=dg(r);if(_n(r)===0&&t.length>0)throw new eg;if(_n(e)&&_n(e)<32)throw new iP({data:typeof e=="string"?e:li(e),params:t,size:_n(e)});let i=0;const s=[];for(let o=0;o48?PM(i,{signed:r}):lo(i,{signed:r}),32]}function LM(t,e,{staticPosition:r}){const n=e.components.length===0||e.components.some(({name:o})=>!o),i=n?[]:{};let s=0;if(Af(e)){const o=lo(t.readBytes(pg)),a=r+o;for(let u=0;uo.type==="error"&&n===lg(Bc(o)));if(!s)throw new Xy(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?CM(s.inputs,$h(r,4)):void 0,errorName:s.name}}const Kc=(t,e,r)=>JSON.stringify(t,(n,i)=>typeof i=="bigint"?i.toString():i,r);function Iw({abiItem:t,args:e,includeFunctionName:r=!0,includeName:n=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${r?t.name:""}(${t.inputs.map((i,s)=>`${n&&i.name?`${i.name}: `:""}${typeof e[s]=="object"?Kc(e[s]):e[s]}`).join(", ")})`}const $M={gwei:9,wei:18},FM={ether:-9,wei:9};function Cw(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}function Tw(t,e="wei"){return Cw(t,$M[e])}function hs(t,e="wei"){return Cw(t,FM[e])}class jM extends yt{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class UM extends yt{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Fh(t){const e=Object.entries(t).map(([n,i])=>i===void 0||i===!1?null:[n,i]).filter(Boolean),r=e.reduce((n,[i])=>Math.max(n,i.length),0);return e.map(([n,i])=>` ${`${n}:`.padEnd(r+1)} ${i}`).join(` +`)}class qM extends yt{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(` +`),{name:"FeeConflictError"})}}class zM extends yt{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Fh(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class HM extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:g,value:y}){var P;const A=Fh({chain:i&&`${i==null?void 0:i.name} (id: ${i==null?void 0:i.id})`,from:r==null?void 0:r.address,to:g,value:typeof y<"u"&&`${Tw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",A].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const WM=t=>t,Rw=t=>t;class KM extends yt{constructor(e,{abi:r,args:n,contractAddress:i,docsPath:s,functionName:o,sender:a}){const u=Ew({abi:r,args:n,name:o}),l=u?Iw({abiItem:u,args:n,includeFunctionName:!1,includeName:!1}):void 0,d=u?Bc(u,{includeName:!0}):void 0,g=Fh({address:i&&WM(i),function:d,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:s,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],g&&"Contract Call:",g].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=e,this.contractAddress=i,this.functionName=o,this.sender=a}}class VM extends yt{constructor({abi:e,data:r,functionName:n,message:i}){let s,o,a,u;if(r&&r!=="0x")try{o=BM({abi:e,data:r});const{abiItem:d,errorName:g,args:y}=o;if(g==="Error")u=y[0];else if(g==="Panic"){const[A]=y;u=wM[A]}else{const A=d?Bc(d,{includeName:!0}):void 0,P=d&&y?Iw({abiItem:d,args:y,includeFunctionName:!1,includeName:!1}):void 0;a=[A?`Error: ${A}`:"",P&&P!=="()"?` ${[...Array((g==null?void 0:g.length)??0).keys()].map(()=>" ").join("")}${P}`:""]}}catch(d){s=d}else i&&(u=i);let l;s instanceof Xy&&(l=s.signature,a=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(u&&u!=="execution reverted"||l?[`The contract function "${n}" reverted with the following ${l?"signature":"reason"}:`,u||l].join(` +`):`The contract function "${n}" reverted.`,{cause:s,metaMessages:a,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.reason=u,this.signature=l}}class GM extends yt{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class YM extends yt{constructor({data:e,message:r}){super(r||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}class Dw extends yt{constructor({body:e,cause:r,details:n,headers:i,status:s,url:o}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${Rw(o)}`,e&&`Request body: ${Kc(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=i,this.status=s,this.url=o}}class JM extends yt{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${Rw(n)}`,`Request body: ${Kc(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code}}const XM=-1;class hi extends yt{constructor(e,{code:r,docsPath:n,metaMessages:i,name:s,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:i||(e==null?void 0:e.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||e.name,this.code=e instanceof JM?e.code:r??XM}}class Vc extends hi{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class Pf extends hi{constructor(e){super(e,{code:Pf.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Pf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Mf extends hi{constructor(e){super(e,{code:Mf.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Mf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class If extends hi{constructor(e,{method:r}={}){super(e,{code:If.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(If,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Cf extends hi{constructor(e){super(e,{code:Cf.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` +`)})}}Object.defineProperty(Cf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Ba extends hi{constructor(e){super(e,{code:Ba.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Ba,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Tf extends hi{constructor(e){super(e,{code:Tf.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` +`)})}}Object.defineProperty(Tf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Rf extends hi{constructor(e){super(e,{code:Rf.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Rf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Df extends hi{constructor(e){super(e,{code:Df.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Df,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Of extends hi{constructor(e){super(e,{code:Of.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Of,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Nf extends hi{constructor(e,{method:r}={}){super(e,{code:Nf.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not implemented.`})}}Object.defineProperty(Nf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Gc extends hi{constructor(e){super(e,{code:Gc.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Gc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Lf extends hi{constructor(e){super(e,{code:Lf.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Lf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Yc extends Vc{constructor(e){super(e,{code:Yc.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Yc,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class kf extends Vc{constructor(e){super(e,{code:kf.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(kf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Bf extends Vc{constructor(e,{method:r}={}){super(e,{code:Bf.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(Bf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class $f extends Vc{constructor(e){super(e,{code:$f.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty($f,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Ff extends Vc{constructor(e){super(e,{code:Ff.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Ff,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class jf extends Vc{constructor(e){super(e,{code:jf.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(jf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ZM extends hi{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const QM=3;function eI(t,{abi:e,address:r,args:n,docsPath:i,functionName:s,sender:o}){const{code:a,data:u,message:l,shortMessage:d}=t instanceof YM?t:t instanceof yt?t.walk(y=>"data"in y)||t.walk():{},g=t instanceof eg?new GM({functionName:s}):[QM,Ba.code].includes(a)&&(u||l||d)?new VM({abi:e,data:typeof u=="object"?u.data:u,functionName:s,message:d??l}):t;return new KM(g,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:o})}function tI(t){const e=Ef(`0x${t.substring(4)}`).substring(26);return Sf(`0x${e}`)}async function rI({hash:t,signature:e}){const r=Jo(t)?t:Dh(t),{secp256k1:n}=await Promise.resolve().then(()=>UC);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:d,v:g,yParity:y}=e,A=Number(y??g),P=Ow(A);return new n.Signature(yf(l),yf(d)).addRecoveryBit(P)}const o=Jo(e)?e:Dh(e),a=Fc(`0x${o.slice(130)}`),u=Ow(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Ow(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function nI({hash:t,signature:e}){return tI(await rI({hash:t,signature:e}))}function iI(t,e="hex"){const r=Nw(t),n=dg(new Uint8Array(r.length));return r.encode(n),e==="hex"?li(n.bytes):n.bytes}function Nw(t){return Array.isArray(t)?sI(t.map(e=>Nw(e))):oI(t)}function sI(t){const e=t.reduce((i,s)=>i+s.length,0),r=Lw(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function oI(t){const e=typeof t=="string"?co(t):t,r=Lw(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function Lw(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new yt("Length is too large.")}function aI(t){const{chainId:e,contractAddress:r,nonce:n,to:i}=t,s=Ef(Bh(["0x05",iI([e?Pr(e):"0x",r,n?Pr(n):"0x"])]));return i==="bytes"?co(s):s}async function kw(t){const{authorization:e,signature:r}=t;return nI({hash:aI(e),signature:r??e})}class cI extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:g,value:y}){var P;const A=Fh({from:r==null?void 0:r.address,to:g,value:typeof y<"u"&&`${Tw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",A].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class Jc extends yt{constructor({cause:e,message:r}={}){var i;const n=(i=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(Jc,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Jc,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class jh extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(jh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class gg extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(gg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class mg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(mg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class vg extends yt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` `),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(vg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class bg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(bg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class yg extends yt{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` `),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(yg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class wg extends yt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(wg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class xg extends yt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(xg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class _g extends yt{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(_g,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Uh extends yt{constructor({cause:e,maxPriorityFeePerGas:r,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${r?` = ${hs(r)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${hs(n)} gwei`:""}).`].join(` -`),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(Uh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Eg extends yt{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function Fw(t,e){const r=(t.details||"").toLowerCase(),n=t instanceof yt?t.walk(i=>(i==null?void 0:i.code)===Jc.code):t;return n instanceof yt?new Jc({cause:t,message:n.details}):Jc.nodeMessage.test(r)?new Jc({cause:t,message:t.details}):jh.nodeMessage.test(r)?new jh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):gg.nodeMessage.test(r)?new gg({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):mg.nodeMessage.test(r)?new mg({cause:t,nonce:e==null?void 0:e.nonce}):vg.nodeMessage.test(r)?new vg({cause:t,nonce:e==null?void 0:e.nonce}):bg.nodeMessage.test(r)?new bg({cause:t,nonce:e==null?void 0:e.nonce}):yg.nodeMessage.test(r)?new yg({cause:t}):wg.nodeMessage.test(r)?new wg({cause:t,gas:e==null?void 0:e.gas}):xg.nodeMessage.test(r)?new xg({cause:t,gas:e==null?void 0:e.gas}):_g.nodeMessage.test(r)?new _g({cause:t}):Uh.nodeMessage.test(r)?new Uh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new Eg({cause:t})}function cI(t,{docsPath:e,...r}){const n=(()=>{const i=Fw(t,r);return i instanceof Eg?t:i})();return new aI(n,{docsPath:e,...r})}function jw(t,{format:e}){if(!e)return{};const r={};function n(s){const o=Object.keys(s);for(const a of o)a in t&&(r[a]=t[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}const i=e(t||{});return n(i),r}const uI={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Sg(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=fI(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(r=>li(r)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=Pr(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=Pr(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=Pr(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=Pr(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=Pr(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=Pr(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=uI[t.type]),typeof t.value<"u"&&(e.value=Pr(t.value)),e}function fI(t){return t.map(e=>({address:e.contractAddress,r:e.r,s:e.s,chainId:Pr(e.chainId),nonce:Pr(e.nonce),...typeof e.yParity<"u"?{yParity:Pr(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:Pr(e.v)}:{}}))}function Uw(t){if(!(!t||t.length===0))return t.reduce((e,{slot:r,value:n})=>{if(r.length!==66)throw new nw({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new nw({size:n.length,targetSize:66,type:"hex"});return e[r]=n,e},{})}function lI(t){const{balance:e,nonce:r,state:n,stateDiff:i,code:s}=t,o={};if(s!==void 0&&(o.code=s),e!==void 0&&(o.balance=Pr(e)),r!==void 0&&(o.nonce=Pr(r)),n!==void 0&&(o.state=Uw(n)),i!==void 0){if(o.state)throw new jM;o.stateDiff=Uw(i)}return o}function hI(t){if(!t)return;const e={};for(const{address:r,...n}of t){if(!lo(r,{strict:!1}))throw new zc({address:r});if(e[r])throw new FM({address:r});e[r]=lI(n)}return e}const dI=2n**256n-1n;function qh(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?ho(e):void 0;if(o&&!lo(o.address))throw new zc({address:o.address});if(s&&!lo(s))throw new zc({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new UM;if(n&&n>dI)throw new jh({maxFeePerGas:n});if(i&&n&&i>n)throw new Uh({maxFeePerGas:n,maxPriorityFeePerGas:i})}class pI extends yt{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Ag extends yt{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class gI extends yt{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${hs(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class mI extends yt{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}const vI={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function bI(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?Fc(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?Fc(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?vI[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=yI(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function yI(t){return t.map(e=>({contractAddress:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function wI(t){const e=(t.transactions??[]).map(r=>typeof r=="string"?r:bI(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function zh(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){var d,g,y;const s=n??"latest",o=i??!1,a=r!==void 0?Pr(r):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,o]},{dedupe:!0}):u=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]},{dedupe:!!a}),!u)throw new mI({blockHash:e,blockNumber:r});return(((y=(g=(d=t.chain)==null?void 0:d.formatters)==null?void 0:g.block)==null?void 0:y.format)||wI)(u)}async function qw(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function xI(t,e){var s,o;const{block:r,chain:n=t.chain,request:i}=e||{};try{const a=((s=n==null?void 0:n.fees)==null?void 0:s.maxPriorityFeePerGas)??((o=n==null?void 0:n.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=r||await fi(t,zh,"getBlock")({}),d=await a({block:l,client:t,request:i});if(d===null)throw new Error;return d}if(typeof a<"u")return a;const u=await t.request({method:"eth_maxPriorityFeePerGas"});return yf(u)}catch{const[a,u]=await Promise.all([r?Promise.resolve(r):fi(t,zh,"getBlock")({}),fi(t,qw,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new Ag;const l=u-a.baseFeePerGas;return l<0n?0n:l}}async function zw(t,e){var y,A;const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>{var P,O;return typeof((P=n==null?void 0:n.fees)==null?void 0:P.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):((O=n==null?void 0:n.fees)==null?void 0:O.baseFeeMultiplier)??1.2})();if(o<1)throw new pI;const u=10**(((y=o.toString().split(".")[1])==null?void 0:y.length)??0),l=P=>P*BigInt(Math.ceil(o*u))/BigInt(u),d=r||await fi(t,zh,"getBlock")({});if(typeof((A=n==null?void 0:n.fees)==null?void 0:A.estimateFeesPerGas)=="function"){const P=await n.fees.estimateFeesPerGas({block:r,client:t,multiply:l,request:i,type:s});if(P!==null)return P}if(s==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new Ag;const P=typeof(i==null?void 0:i.maxPriorityFeePerGas)=="bigint"?i.maxPriorityFeePerGas:await xI(t,{block:d,chain:n,request:i}),O=l(d.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??O+P,maxPriorityFeePerGas:P}}return{gasPrice:(i==null?void 0:i.gasPrice)??l(await fi(t,qw,"getGasPrice")({}))}}async function _I(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,n?Pr(n):r]},{dedupe:!!n});return Fc(i)}function Hw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(s=>fo(s)):t.blobs,i=[];for(const s of n)i.push(Uint8Array.from(e.blobToKzgCommitment(s)));return r==="bytes"?i:i.map(s=>li(s))}function Ww(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>fo(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>fo(o)):t.commitments,s=[];for(let o=0;oli(o))}function EI(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),u=n?4:0,l=n?0:4;t.setUint32(e+u,o,n),t.setUint32(e+l,a,n)}const SI=(t,e,r)=>t&e^~t&r,AI=(t,e,r)=>t&e^t&r^e&r;class PI extends ig{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ng(this.buffer)}update(e){Uc(this);const{view:r,buffer:n,blockLen:i}=this;e=wf(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let g=o;gd.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g>>3,O=Os(A,17)^Os(A,19)^A>>>10;ra[g]=O+ra[g-7]+P+ra[g-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:u,G:l,H:d}=this;for(let g=0;g<64;g++){const y=Os(a,6)^Os(a,11)^Os(a,25),A=d+y+SI(a,u,l)+MI[g]+ra[g]|0,O=(Os(n,2)^Os(n,13)^Os(n,22))+AI(n,i,s)|0;d=l,l=u,u=a,a=o+A|0,o=s,s=i,i=n,n=A+O|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(n,i,s,o,a,u,l,d)}roundClean(){ra.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Pg=lw(()=>new II);function CI(t,e){return Pg(Zo(t,{strict:!1})?rg(t):t)}function TI(t){const{commitment:e,version:r=1}=t,n=t.to??(typeof e=="string"?"hex":"bytes"),i=CI(e);return i.set([r],0),n==="bytes"?i:li(i)}function RI(t){const{commitments:e,version:r}=t,n=t.to??(typeof e[0]=="string"?"hex":"bytes"),i=[];for(const s of e)i.push(TI({commitment:s,to:n,version:r}));return i}const Kw=6,Vw=32,Mg=4096,Gw=Vw*Mg,Yw=Gw*Kw-1-1*Mg*Kw;class DI extends yt{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class OI extends yt{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function NI(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),r=typeof t.data=="string"?fo(t.data):t.data,n=_n(r);if(!n)throw new OI;if(n>Yw)throw new DI({maxSize:Yw,size:n});const i=[];let s=!0,o=0;for(;s;){const a=dg(new Uint8Array(Gw));let u=0;for(;ua.bytes):i.map(a=>li(a.bytes))}function LI(t){const{data:e,kzg:r,to:n}=t,i=t.blobs??NI({data:e,to:n}),s=t.commitments??Hw({blobs:i,kzg:r,to:n}),o=t.proofs??Ww({blobs:i,commitments:s,kzg:r,to:n}),a=[];for(let u=0;u"u"&&g)if(u){const k=await D();y.nonce=await u.consume({address:g.address,chainId:k,client:t})}else y.nonce=await fi(t,_I,"getTransactionCount")({address:g.address,blockTag:"pending"});if((l.includes("fees")||l.includes("type"))&&typeof d>"u")try{y.type=kI(y)}catch{const k=await P();y.type=typeof(k==null?void 0:k.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(l.includes("fees"))if(y.type!=="legacy"&&y.type!=="eip2930"){if(typeof y.maxFeePerGas>"u"||typeof y.maxPriorityFeePerGas>"u"){const k=await P(),{maxFeePerGas:B,maxPriorityFeePerGas:j}=await zw(t,{block:k,chain:i,request:y});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(y.gas=await fi(t,$I,"estimateGas")({...y,account:g&&{address:g.address,type:"json-rpc"}})),qh(y),delete y.parameters,y}async function BI(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=r?Pr(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function $I(t,e){var i,s,o;const{account:r=t.account}=e,n=r?ho(r):void 0;try{let f=function(v){const{block:x,request:_,rpcStateOverride:S}=v;return t.request({method:"eth_estimateGas",params:S?[_,x??"latest",S]:x?[_,x]:[_]})};const{accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,blockNumber:g,blockTag:y,data:A,gas:P,gasPrice:O,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:j,value:U,stateOverride:K,...J}=await Ig(t,{...e,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),z=(g?Pr(g):void 0)||y,ue=hI(K),_e=await(async()=>{if(J.to)return J.to;if(u&&u.length>0)return await $w({authorization:u[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`")})})();qh(e);const G=(o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:o.format,m=(G||Sg)({...jw(J,{format:G}),from:n==null?void 0:n.address,accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,data:A,gas:P,gasPrice:O,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:j,to:_e,value:U});let p=BigInt(await f({block:z,request:m,rpcStateOverride:ue}));if(u){const v=await BI(t,{address:m.from}),x=await Promise.all(u.map(async _=>{const{contractAddress:S}=_,b=await f({block:z,request:{authorizationList:void 0,data:A,from:n==null?void 0:n.address,to:S,value:Pr(v)},rpcStateOverride:ue}).catch(()=>100000n);return 2n*BigInt(b)}));p+=x.reduce((_,S)=>_+S,0n)}return p}catch(a){throw cI(a,{...e,account:n,chain:t.chain})}}class FI extends yt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class jI extends yt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` -`),{name:"ChainNotFoundError"})}}const Cg="/docs/contract/encodeDeployData";function UI(t){const{abi:e,args:r,bytecode:n}=t;if(!r||r.length===0)return n;const i=e.find(o=>"type"in o&&o.type==="constructor");if(!i)throw new rP({docsPath:Cg});if(!("inputs"in i))throw new Zy({docsPath:Cg});if(!i.inputs||i.inputs.length===0)throw new Zy({docsPath:Cg});const s=Sw(i.inputs,r);return Bh([n,s])}async function qI(t){return new Promise(e=>setTimeout(e,t))}class Uf extends yt{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` -`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class Tg extends yt{constructor({docsPath:e,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:e,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function Xw({chain:t,currentChainId:e}){if(!t)throw new jI;if(e!==t.id)throw new FI({chain:t,currentChainId:e})}function zI(t,{docsPath:e,...r}){const n=(()=>{const i=Fw(t,r);return i instanceof Eg?t:i})();return new zM(n,{docsPath:e,...r})}async function Zw(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const Rg=new kh(128);async function Dg(t,e){var k,B,j,U;const{account:r=t.account,chain:n=t.chain,accessList:i,authorizationList:s,blobs:o,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,value:P,...O}=e;if(typeof r>"u")throw new Uf({docsPath:"/docs/actions/wallet/sendTransaction"});const D=r?ho(r):null;try{qh(e);const K=await(async()=>{if(e.to)return e.to;if(s&&s.length>0)return await $w({authorization:s[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`.")})})();if((D==null?void 0:D.type)==="json-rpc"||D===null){let J;n!==null&&(J=await fi(t,Hh,"getChainId")({}),Xw({currentChainId:J,chain:n}));const T=(j=(B=(k=t.chain)==null?void 0:k.formatters)==null?void 0:B.transactionRequest)==null?void 0:j.format,ue=(T||Sg)({...jw(O,{format:T}),accessList:i,authorizationList:s,blobs:o,chainId:J,data:a,from:D==null?void 0:D.address,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,to:K,value:P}),_e=Rg.get(t.uid),G=_e?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:G,params:[ue]},{retryCount:0})}catch(E){if(_e===!1)throw E;const m=E;if(m.name==="InvalidInputRpcError"||m.name==="InvalidParamsRpcError"||m.name==="MethodNotFoundRpcError"||m.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[ue]},{retryCount:0}).then(f=>(Rg.set(t.uid,!0),f)).catch(f=>{const p=f;throw p.name==="MethodNotFoundRpcError"||p.name==="MethodNotSupportedRpcError"?(Rg.set(t.uid,!1),m):p});throw m}}if((D==null?void 0:D.type)==="local"){const J=await fi(t,Ig,"prepareTransactionRequest")({account:D,accessList:i,authorizationList:s,blobs:o,chain:n,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,nonceManager:D.nonceManager,parameters:[...Jw,"sidecars"],value:P,...O,to:K}),T=(U=n==null?void 0:n.serializers)==null?void 0:U.transaction,z=await D.signTransaction(J,{serializer:T});return await fi(t,Zw,"sendRawTransaction")({serializedTransaction:z})}throw(D==null?void 0:D.type)==="smart"?new Tg({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Tg({docsPath:"/docs/actions/wallet/sendTransaction",type:D==null?void 0:D.type})}catch(K){throw K instanceof Tg?K:zI(K,{...e,account:D,chain:e.chain||void 0})}}async function HI(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:o,functionName:a,...u}=e;if(typeof n>"u")throw new Uf({docsPath:"/docs/contract/writeContract"});const l=n?ho(n):null,d=bM({abi:r,args:s,functionName:a});try{return await fi(t,Dg,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:i,account:l,...u})}catch(g){throw QM(g,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:a,sender:l==null?void 0:l.address})}}async function WI(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:Pr(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}const Og=256;let Wh=Og,Kh;function Qw(t=11){if(!Kh||Wh+t>Og*2){Kh="",Wh=0;for(let e=0;e{const B=k(D);for(const U in P)delete B[U];const j={...D,...B};return Object.assign(j,{extend:O(j)})}}return Object.assign(P,{extend:O(P)})}const Vh=new kh(8192);function VI(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(Vh.get(r))return Vh.get(r);const n=t().finally(()=>Vh.delete(r));return Vh.set(r,n),n}function GI(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const u=async({error:l})=>{const d=typeof e=="function"?e({count:a,error:l}):e;d&&await qI(d),o({count:a+1})};try{const l=await t();i(l)}catch(l){if(a{const{dedupe:i=!1,retryDelay:s=150,retryCount:o=3,uid:a}={...e,...n},u=i?Ef(Oh(`${a}.${Kc(r)}`)):void 0;return VI(()=>GI(async()=>{try{return await t(r)}catch(l){const d=l;switch(d.code){case Pf.code:throw new Pf(d);case Mf.code:throw new Mf(d);case If.code:throw new If(d,{method:r.method});case Cf.code:throw new Cf(d);case Fa.code:throw new Fa(d);case Tf.code:throw new Tf(d);case Rf.code:throw new Rf(d);case Df.code:throw new Df(d);case Of.code:throw new Of(d);case Nf.code:throw new Nf(d,{method:r.method});case Gc.code:throw new Gc(d);case Lf.code:throw new Lf(d);case Yc.code:throw new Yc(d);case kf.code:throw new kf(d);case Bf.code:throw new Bf(d);case $f.code:throw new $f(d);case Ff.code:throw new Ff(d);case jf.code:throw new jf(d);case 5e3:throw new Yc(d);default:throw l instanceof yt?l:new XM(d)}}},{delay:({count:l,error:d})=>{var g;if(d&&d instanceof Nw){const y=(g=d==null?void 0:d.headers)==null?void 0:g.get("Retry-After");if(y!=null&&y.match(/\d/))return Number.parseInt(y)*1e3}return~~(1<JI(l)}),{enabled:i,id:u})}}function JI(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Gc.code||t.code===Fa.code:t instanceof Nw&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function XI({key:t,name:e,request:r,retryCount:n=3,retryDelay:i=150,timeout:s,type:o},a){const u=Qw();return{config:{key:t,name:e,request:r,retryCount:n,retryDelay:i,timeout:s,type:o},request:YI(r,{retryCount:n,retryDelay:i,uid:u}),value:a}}function ZI(t,e={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=e;return({retryCount:s})=>XI({key:r,name:n,request:t.request.bind(t),retryCount:e.retryCount??s,retryDelay:i,type:"custom"})}const QI=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,eC=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;class tC extends yt{constructor({domain:e}){super(`Invalid domain "${Kc(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class rC extends yt{constructor({primaryType:e,types:r}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class nC extends yt{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function iC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(u,l)=>{const d={...l};for(const g of u){const{name:y,type:A}=g;A==="address"&&(d[y]=d[y].toLowerCase())}return d},o=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return Kc({domain:o,message:a,primaryType:n,types:i})}function sC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(o,a)=>{for(const u of o){const{name:l,type:d}=u,g=a[l],y=d.match(eC);if(y&&(typeof g=="number"||typeof g=="bigint")){const[O,D,k]=y;Pr(g,{signed:D==="int",size:Number.parseInt(k)/8})}if(d==="address"&&typeof g=="string"&&!lo(g))throw new zc({address:g});const A=d.match(QI);if(A){const[O,D]=A;if(D&&_n(g)!==Number.parseInt(D))throw new cP({expectedSize:Number.parseInt(D),givenSize:_n(g)})}const P=i[d];P&&(aC(d),s(P,g))}};if(i.EIP712Domain&&e){if(typeof e!="object")throw new tC({domain:e});s(i.EIP712Domain,e)}if(n!=="EIP712Domain")if(i[n])s(i[n],r);else throw new rC({primaryType:n,types:i})}function oC({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},typeof(t==null?void 0:t.chainId)=="number"&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function aC(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new nC({type:t})}let e2=class extends ig{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,EP(e);const n=wf(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew e2(t,e).update(r).digest();t2.create=(t,e)=>new e2(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ng=BigInt(0),Gh=BigInt(1),cC=BigInt(2);function ja(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function qf(t){if(!ja(t))throw new Error("Uint8Array expected")}function Xc(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)}const uC=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Zc(t){qf(t);let e="";for(let r=0;r=go._0&&t<=go._9)return t-go._0;if(t>=go._A&&t<=go._F)return t-(go._A-10);if(t>=go._a&&t<=go._f)return t-(go._a-10)}function eu(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;itypeof t=="bigint"&&Ng<=t;function Yh(t,e,r){return $g(t)&&$g(e)&&$g(r)&&e<=t&&tNg;t>>=Gh,e+=1);return e}function dC(t,e){return t>>BigInt(e)&Gh}function pC(t,e,r){return t|(r?Gh:Ng)<(cC<new Uint8Array(t),i2=t=>Uint8Array.from(t);function s2(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=jg(t),i=jg(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...g)=>r(i,n,...g),u=(g=jg())=>{i=a(i2([0]),g),n=a(),g.length!==0&&(i=a(i2([1]),g),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let g=0;const y=[];for(;g{o(),u(g);let A;for(;!(A=y(l()));)u();return o(),A}}const gC={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||ja(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Hf(t,e,r={}){const n=(i,s,o)=>{const a=gC[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const u=t[i];if(!(o&&u===void 0)&&!a(u,t))throw new Error(`Invalid param ${String(i)}=${u} (${typeof u}), expected ${s}`)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const mC=()=>{throw new Error("not implemented")};function Ug(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}const vC=Object.freeze(Object.defineProperty({__proto__:null,aInRange:qa,abool:Xc,abytes:qf,bitGet:dC,bitLen:n2,bitMask:Fg,bitSet:pC,bytesToHex:Zc,bytesToNumberBE:Ua,bytesToNumberLE:kg,concatBytes:zf,createHmacDrbg:s2,ensureBytes:ds,equalBytes:lC,hexToBytes:eu,hexToNumber:Lg,inRange:Yh,isBytes:ja,memoized:Ug,notImplemented:mC,numberToBytesBE:tu,numberToBytesLE:Bg,numberToHexUnpadded:Qc,numberToVarBytesBE:fC,utf8ToBytes:hC,validateObject:Hf},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mn=BigInt(0),sn=BigInt(1),za=BigInt(2),bC=BigInt(3),qg=BigInt(4),o2=BigInt(5),a2=BigInt(8);BigInt(9),BigInt(16);function di(t,e){const r=t%e;return r>=Mn?r:e+r}function yC(t,e,r){if(r<=Mn||e 0");if(r===sn)return Mn;let n=sn;for(;e>Mn;)e&sn&&(n=n*t%r),t=t*t%r,e>>=sn;return n}function qi(t,e,r){let n=t;for(;e-- >Mn;)n*=n,n%=r;return n}function zg(t,e){if(t===Mn||e<=Mn)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=di(t,e),n=e,i=Mn,s=sn;for(;r!==Mn;){const a=n/r,u=n%r,l=i-s*a;n=r,r=u,i=s,s=l}if(n!==sn)throw new Error("invert: does not exist");return di(i,e)}function wC(t){const e=(t-sn)/za;let r,n,i;for(r=t-sn,n=0;r%za===Mn;r/=za,n++);for(i=za;i(n[i]="function",n),e);return Hf(t,r)}function SC(t,e,r){if(r 0");if(r===Mn)return t.ONE;if(r===sn)return e;let n=t.ONE,i=e;for(;r>Mn;)r&sn&&(n=t.mul(n,i)),i=t.sqr(i),r>>=sn;return n}function AC(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function c2(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function u2(t,e,r=!1,n={}){if(t<=Mn)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=c2(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=xC(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:Fg(i),ZERO:Mn,ONE:sn,create:u=>di(u,t),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return Mn<=u&&uu===Mn,isOdd:u=>(u&sn)===sn,neg:u=>di(-u,t),eql:(u,l)=>u===l,sqr:u=>di(u*u,t),add:(u,l)=>di(u+l,t),sub:(u,l)=>di(u-l,t),mul:(u,l)=>di(u*l,t),pow:(u,l)=>SC(a,u,l),div:(u,l)=>di(u*zg(l,t),t),sqrN:u=>u*u,addN:(u,l)=>u+l,subN:(u,l)=>u-l,mulN:(u,l)=>u*l,inv:u=>zg(u,t),sqrt:n.sqrt||(u=>o(a,u)),invertBatch:u=>AC(a,u),cmov:(u,l,d)=>d?l:u,toBytes:u=>r?Bg(u,s):tu(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return r?kg(u):Ua(u)}});return Object.freeze(a)}function f2(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function l2(t){const e=f2(t);return e+Math.ceil(e/2)}function PC(t,e,r=!1){const n=t.length,i=f2(e),s=l2(e);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?Ua(t):kg(t),a=di(o,e-sn)+sn;return r?Bg(a,i):tu(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const MC=BigInt(0),Hg=BigInt(1),Wg=new WeakMap,h2=new WeakMap;function IC(t,e){const r=(s,o)=>{const a=o.negate();return s?a:o},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>e)throw new Error(`Wrong window size=${s}, should be [1..${e}]`)},i=s=>{n(s);const o=Math.ceil(e/s)+1,a=2**(s-1);return{windows:o,windowSize:a}};return{constTimeNegate:r,unsafeLadder(s,o){let a=t.ZERO,u=s;for(;o>MC;)o&Hg&&(a=a.add(u)),u=u.double(),o>>=Hg;return a},precomputeWindow(s,o){const{windows:a,windowSize:u}=i(o),l=[];let d=s,g=d;for(let y=0;y>=P,k>l&&(k-=A,a+=Hg);const B=D,j=D+Math.abs(k)-1,U=O%2!==0,K=k<0;k===0?g=g.add(r(U,o[B])):d=d.add(r(K,o[j]))}return{p:d,f:g}},wNAFCached(s,o,a){const u=h2.get(s)||1;let l=Wg.get(s);return l||(l=this.precomputeWindow(s,u),u!==1&&Wg.set(s,a(l))),this.wNAF(u,l,o)},setWindowSize(s,o){n(o),h2.set(s,o),Wg.delete(s)}}}function CC(t,e,r,n){if(!Array.isArray(r)||!Array.isArray(n)||n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((d,g)=>{if(!e.isValid(d))throw new Error(`wrong scalar at index ${g}`)}),r.forEach((d,g)=>{if(!(d instanceof t))throw new Error(`wrong point at index ${g}`)});const i=n2(BigInt(r.length)),s=i>12?i-3:i>4?i-2:i?2:1,o=(1<=0;d-=s){a.fill(t.ZERO);for(let y=0;y>BigInt(d)&BigInt(o));a[P]=a[P].add(r[y])}let g=t.ZERO;for(let y=a.length-1,A=t.ZERO;y>0;y--)A=A.add(a[y]),g=g.add(A);if(l=l.add(g),d!==0)for(let y=0;y{const{Err:r}=mo;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=Qc(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?Qc(i.length/2|128):"";return`${Qc(t)}${s}${i}${e}`},decode(t,e){const{Err:r}=mo;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");const l=e.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const d of l)o=o<<8|d;if(n+=u,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=mo;if(t{const B=D.toAffine();return zf(Uint8Array.from([4]),r.toBytes(B.x),r.toBytes(B.y))}),s=e.fromBytes||(O=>{const D=O.subarray(1),k=r.fromBytes(D.subarray(0,r.BYTES)),B=r.fromBytes(D.subarray(r.BYTES,2*r.BYTES));return{x:k,y:B}});function o(O){const{a:D,b:k}=e,B=r.sqr(O),j=r.mul(B,O);return r.add(r.add(j,r.mul(O,D)),k)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(O){return Yh(O,In,e.n)}function u(O){const{allowedPrivateKeyLengths:D,nByteLength:k,wrapPrivateKey:B,n:j}=e;if(D&&typeof O!="bigint"){if(ja(O)&&(O=Zc(O)),typeof O!="string"||!D.includes(O.length))throw new Error("Invalid key");O=O.padStart(k*2,"0")}let U;try{U=typeof O=="bigint"?O:Ua(ds("private key",O,k))}catch{throw new Error(`private key must be ${k} bytes, hex or bigint, not ${typeof O}`)}return B&&(U=di(U,j)),qa("private key",U,In,j),U}function l(O){if(!(O instanceof y))throw new Error("ProjectivePoint expected")}const d=Ug((O,D)=>{const{px:k,py:B,pz:j}=O;if(r.eql(j,r.ONE))return{x:k,y:B};const U=O.is0();D==null&&(D=U?r.ONE:r.inv(j));const K=r.mul(k,D),J=r.mul(B,D),T=r.mul(j,D);if(U)return{x:r.ZERO,y:r.ZERO};if(!r.eql(T,r.ONE))throw new Error("invZ was invalid");return{x:K,y:J}}),g=Ug(O=>{if(O.is0()){if(e.allowInfinityPoint&&!r.is0(O.py))return;throw new Error("bad point: ZERO")}const{x:D,y:k}=O.toAffine();if(!r.isValid(D)||!r.isValid(k))throw new Error("bad point: x or y not FE");const B=r.sqr(k),j=o(D);if(!r.eql(B,j))throw new Error("bad point: equation left != right");if(!O.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(D,k,B){if(this.px=D,this.py=k,this.pz=B,D==null||!r.isValid(D))throw new Error("x required");if(k==null||!r.isValid(k))throw new Error("y required");if(B==null||!r.isValid(B))throw new Error("z required");Object.freeze(this)}static fromAffine(D){const{x:k,y:B}=D||{};if(!D||!r.isValid(k)||!r.isValid(B))throw new Error("invalid affine point");if(D instanceof y)throw new Error("projective point not allowed");const j=U=>r.eql(U,r.ZERO);return j(k)&&j(B)?y.ZERO:new y(k,B,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(D){const k=r.invertBatch(D.map(B=>B.pz));return D.map((B,j)=>B.toAffine(k[j])).map(y.fromAffine)}static fromHex(D){const k=y.fromAffine(s(ds("pointHex",D)));return k.assertValidity(),k}static fromPrivateKey(D){return y.BASE.multiply(u(D))}static msm(D,k){return CC(y,n,D,k)}_setWindowSize(D){P.setWindowSize(this,D)}assertValidity(){g(this)}hasEvenY(){const{y:D}=this.toAffine();if(r.isOdd)return!r.isOdd(D);throw new Error("Field doesn't support isOdd")}equals(D){l(D);const{px:k,py:B,pz:j}=this,{px:U,py:K,pz:J}=D,T=r.eql(r.mul(k,J),r.mul(U,j)),z=r.eql(r.mul(B,J),r.mul(K,j));return T&&z}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){const{a:D,b:k}=e,B=r.mul(k,g2),{px:j,py:U,pz:K}=this;let J=r.ZERO,T=r.ZERO,z=r.ZERO,ue=r.mul(j,j),_e=r.mul(U,U),G=r.mul(K,K),E=r.mul(j,U);return E=r.add(E,E),z=r.mul(j,K),z=r.add(z,z),J=r.mul(D,z),T=r.mul(B,G),T=r.add(J,T),J=r.sub(_e,T),T=r.add(_e,T),T=r.mul(J,T),J=r.mul(E,J),z=r.mul(B,z),G=r.mul(D,G),E=r.sub(ue,G),E=r.mul(D,E),E=r.add(E,z),z=r.add(ue,ue),ue=r.add(z,ue),ue=r.add(ue,G),ue=r.mul(ue,E),T=r.add(T,ue),G=r.mul(U,K),G=r.add(G,G),ue=r.mul(G,E),J=r.sub(J,ue),z=r.mul(G,_e),z=r.add(z,z),z=r.add(z,z),new y(J,T,z)}add(D){l(D);const{px:k,py:B,pz:j}=this,{px:U,py:K,pz:J}=D;let T=r.ZERO,z=r.ZERO,ue=r.ZERO;const _e=e.a,G=r.mul(e.b,g2);let E=r.mul(k,U),m=r.mul(B,K),f=r.mul(j,J),p=r.add(k,B),v=r.add(U,K);p=r.mul(p,v),v=r.add(E,m),p=r.sub(p,v),v=r.add(k,j);let x=r.add(U,J);return v=r.mul(v,x),x=r.add(E,f),v=r.sub(v,x),x=r.add(B,j),T=r.add(K,J),x=r.mul(x,T),T=r.add(m,f),x=r.sub(x,T),ue=r.mul(_e,v),T=r.mul(G,f),ue=r.add(T,ue),T=r.sub(m,ue),ue=r.add(m,ue),z=r.mul(T,ue),m=r.add(E,E),m=r.add(m,E),f=r.mul(_e,f),v=r.mul(G,v),m=r.add(m,f),f=r.sub(E,f),f=r.mul(_e,f),v=r.add(v,f),E=r.mul(m,v),z=r.add(z,E),E=r.mul(x,v),T=r.mul(p,T),T=r.sub(T,E),E=r.mul(p,m),ue=r.mul(x,ue),ue=r.add(ue,E),new y(T,z,ue)}subtract(D){return this.add(D.negate())}is0(){return this.equals(y.ZERO)}wNAF(D){return P.wNAFCached(this,D,y.normalizeZ)}multiplyUnsafe(D){qa("scalar",D,vo,e.n);const k=y.ZERO;if(D===vo)return k;if(D===In)return this;const{endo:B}=e;if(!B)return P.unsafeLadder(this,D);let{k1neg:j,k1:U,k2neg:K,k2:J}=B.splitScalar(D),T=k,z=k,ue=this;for(;U>vo||J>vo;)U&In&&(T=T.add(ue)),J&In&&(z=z.add(ue)),ue=ue.double(),U>>=In,J>>=In;return j&&(T=T.negate()),K&&(z=z.negate()),z=new y(r.mul(z.px,B.beta),z.py,z.pz),T.add(z)}multiply(D){const{endo:k,n:B}=e;qa("scalar",D,In,B);let j,U;if(k){const{k1neg:K,k1:J,k2neg:T,k2:z}=k.splitScalar(D);let{p:ue,f:_e}=this.wNAF(J),{p:G,f:E}=this.wNAF(z);ue=P.constTimeNegate(K,ue),G=P.constTimeNegate(T,G),G=new y(r.mul(G.px,k.beta),G.py,G.pz),j=ue.add(G),U=_e.add(E)}else{const{p:K,f:J}=this.wNAF(D);j=K,U=J}return y.normalizeZ([j,U])[0]}multiplyAndAddUnsafe(D,k,B){const j=y.BASE,U=(J,T)=>T===vo||T===In||!J.equals(j)?J.multiplyUnsafe(T):J.multiply(T),K=U(this,k).add(U(D,B));return K.is0()?void 0:K}toAffine(D){return d(this,D)}isTorsionFree(){const{h:D,isTorsionFree:k}=e;if(D===In)return!0;if(k)return k(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:D,clearCofactor:k}=e;return D===In?this:k?k(y,this):this.multiplyUnsafe(e.h)}toRawBytes(D=!0){return Xc("isCompressed",D),this.assertValidity(),i(y,this,D)}toHex(D=!0){return Xc("isCompressed",D),Zc(this.toRawBytes(D))}}y.BASE=new y(e.Gx,e.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);const A=e.nBitLength,P=IC(y,e.endo?Math.ceil(A/2):A);return{CURVE:e,ProjectivePoint:y,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:a}}function NC(t){const e=d2(t);return Hf(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function LC(t){const e=NC(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(f){return di(f,n)}function a(f){return zg(f,n)}const{ProjectivePoint:u,normPrivateKeyToScalar:l,weierstrassEquation:d,isWithinCurveOrder:g}=OC({...e,toBytes(f,p,v){const x=p.toAffine(),_=r.toBytes(x.x),S=zf;return Xc("isCompressed",v),v?S(Uint8Array.from([p.hasEvenY()?2:3]),_):S(Uint8Array.from([4]),_,r.toBytes(x.y))},fromBytes(f){const p=f.length,v=f[0],x=f.subarray(1);if(p===i&&(v===2||v===3)){const _=Ua(x);if(!Yh(_,In,r.ORDER))throw new Error("Point is not on curve");const S=d(_);let b;try{b=r.sqrt(S)}catch(F){const ae=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+ae)}const M=(b&In)===In;return(v&1)===1!==M&&(b=r.neg(b)),{x:_,y:b}}else if(p===s&&v===4){const _=r.fromBytes(x.subarray(0,r.BYTES)),S=r.fromBytes(x.subarray(r.BYTES,2*r.BYTES));return{x:_,y:S}}else throw new Error(`Point of length ${p} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`)}}),y=f=>Zc(tu(f,e.nByteLength));function A(f){const p=n>>In;return f>p}function P(f){return A(f)?o(-f):f}const O=(f,p,v)=>Ua(f.slice(p,v));class D{constructor(p,v,x){this.r=p,this.s=v,this.recovery=x,this.assertValidity()}static fromCompact(p){const v=e.nByteLength;return p=ds("compactSignature",p,v*2),new D(O(p,0,v),O(p,v,2*v))}static fromDER(p){const{r:v,s:x}=mo.toSig(ds("DER",p));return new D(v,x)}assertValidity(){qa("r",this.r,In,n),qa("s",this.s,In,n)}addRecoveryBit(p){return new D(this.r,this.s,p)}recoverPublicKey(p){const{r:v,s:x,recovery:_}=this,S=J(ds("msgHash",p));if(_==null||![0,1,2,3].includes(_))throw new Error("recovery id invalid");const b=_===2||_===3?v+e.n:v;if(b>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const M=_&1?"03":"02",I=u.fromHex(M+y(b)),F=a(b),ae=o(-S*F),N=o(x*F),se=u.BASE.multiplyAndAddUnsafe(I,ae,N);if(!se)throw new Error("point at infinify");return se.assertValidity(),se}hasHighS(){return A(this.s)}normalizeS(){return this.hasHighS()?new D(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return eu(this.toDERHex())}toDERHex(){return mo.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return eu(this.toCompactHex())}toCompactHex(){return y(this.r)+y(this.s)}}const k={isValidPrivateKey(f){try{return l(f),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const f=l2(e.n);return PC(e.randomBytes(f),e.n)},precompute(f=8,p=u.BASE){return p._setWindowSize(f),p.multiply(BigInt(3)),p}};function B(f,p=!0){return u.fromPrivateKey(f).toRawBytes(p)}function j(f){const p=ja(f),v=typeof f=="string",x=(p||v)&&f.length;return p?x===i||x===s:v?x===2*i||x===2*s:f instanceof u}function U(f,p,v=!0){if(j(f))throw new Error("first arg must be private key");if(!j(p))throw new Error("second arg must be public key");return u.fromHex(p).multiply(l(f)).toRawBytes(v)}const K=e.bits2int||function(f){const p=Ua(f),v=f.length*8-e.nBitLength;return v>0?p>>BigInt(v):p},J=e.bits2int_modN||function(f){return o(K(f))},T=Fg(e.nBitLength);function z(f){return qa(`num < 2^${e.nBitLength}`,f,vo,T),tu(f,e.nByteLength)}function ue(f,p,v=_e){if(["recovered","canonical"].some(X=>X in v))throw new Error("sign() legacy options not supported");const{hash:x,randomBytes:_}=e;let{lowS:S,prehash:b,extraEntropy:M}=v;S==null&&(S=!0),f=ds("msgHash",f),p2(v),b&&(f=ds("prehashed msgHash",x(f)));const I=J(f),F=l(p),ae=[z(F),z(I)];if(M!=null&&M!==!1){const X=M===!0?_(r.BYTES):M;ae.push(ds("extraEntropy",X))}const N=zf(...ae),se=I;function ee(X){const Q=K(X);if(!g(Q))return;const R=a(Q),Z=u.BASE.multiply(Q).toAffine(),te=o(Z.x);if(te===vo)return;const he=o(R*o(se+te*F));if(he===vo)return;let ie=(Z.x===te?0:2)|Number(Z.y&In),fe=he;return S&&A(he)&&(fe=P(he),ie^=1),new D(te,fe,ie)}return{seed:N,k2sig:ee}}const _e={lowS:e.lowS,prehash:!1},G={lowS:e.lowS,prehash:!1};function E(f,p,v=_e){const{seed:x,k2sig:_}=ue(f,p,v),S=e;return s2(S.hash.outputLen,S.nByteLength,S.hmac)(x,_)}u.BASE._setWindowSize(8);function m(f,p,v,x=G){var Z;const _=f;if(p=ds("msgHash",p),v=ds("publicKey",v),"strict"in x)throw new Error("options.strict was renamed to lowS");p2(x);const{lowS:S,prehash:b}=x;let M,I;try{if(typeof _=="string"||ja(_))try{M=D.fromDER(_)}catch(te){if(!(te instanceof mo.Err))throw te;M=D.fromCompact(_)}else if(typeof _=="object"&&typeof _.r=="bigint"&&typeof _.s=="bigint"){const{r:te,s:he}=_;M=new D(te,he)}else throw new Error("PARSE");I=u.fromHex(v)}catch(te){if(te.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(S&&M.hasHighS())return!1;b&&(p=e.hash(p));const{r:F,s:ae}=M,N=J(p),se=a(ae),ee=o(N*se),X=o(F*se),Q=(Z=u.BASE.multiplyAndAddUnsafe(I,ee,X))==null?void 0:Z.toAffine();return Q?o(Q.x)===F:!1}return{CURVE:e,getPublicKey:B,getSharedSecret:U,sign:E,verify:m,ProjectivePoint:u,Signature:D,utils:k}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function kC(t){return{hash:t,hmac:(e,...r)=>t2(t,e,LP(...r)),randomBytes:BP}}function BC(t,e){const r=n=>LC({...t,...kC(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const m2=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),v2=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),$C=BigInt(1),Kg=BigInt(2),b2=(t,e)=>(t+e/Kg)/e;function FC(t){const e=m2,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),u=BigInt(88),l=t*t*t%e,d=l*l*t%e,g=qi(d,r,e)*d%e,y=qi(g,r,e)*d%e,A=qi(y,Kg,e)*l%e,P=qi(A,i,e)*A%e,O=qi(P,s,e)*P%e,D=qi(O,a,e)*O%e,k=qi(D,u,e)*D%e,B=qi(k,a,e)*O%e,j=qi(B,r,e)*d%e,U=qi(j,o,e)*P%e,K=qi(U,n,e)*l%e,J=qi(K,Kg,e);if(!Vg.eql(Vg.sqr(J),t))throw new Error("Cannot find square root");return J}const Vg=u2(m2,void 0,void 0,{sqrt:FC}),y2=BC({a:BigInt(0),b:BigInt(7),Fp:Vg,n:v2,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=v2,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-$C*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=b2(s*t,e),u=b2(-n*t,e);let l=di(t-a*r-u*i,e),d=di(-a*n-u*s,e);const g=l>o,y=d>o;if(g&&(l=e-l),y&&(d=e-d),l>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:g,k1:l,k2neg:y,k2:d}}}},Pg);BigInt(0),y2.ProjectivePoint;const jC=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:y2},Symbol.toStringTag,{value:"Module"}));function UC(t,e){const{abi:r,args:n,bytecode:i,...s}=e,o=UI({abi:r,args:n,bytecode:i});return Dg(t,{...s,data:o})}async function qC(t){var r;return((r=t.account)==null?void 0:r.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(n=>Sf(n))}async function zC(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}async function HC(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>og(r))}async function WC(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function KC(t,{account:e=t.account,message:r}){if(!e)throw new Uf({docsPath:"/docs/actions/wallet/signMessage"});const n=ho(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Oh(r):r.raw instanceof Uint8Array?Dh(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function VC(t,e){var l,d,g,y;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTransaction"});const s=ho(r);qh({account:s,...e});const o=await fi(t,Hh,"getChainId")({});n!==null&&Xw({currentChainId:o,chain:n});const a=(n==null?void 0:n.formatters)||((l=t.chain)==null?void 0:l.formatters),u=((d=a==null?void 0:a.transactionRequest)==null?void 0:d.format)||Sg;return s.signTransaction?s.signTransaction({...i,chainId:o},{serializer:(y=(g=t.chain)==null?void 0:g.serializers)==null?void 0:y.transaction}):await t.request({method:"eth_signTransaction",params:[{...u(i),chainId:Pr(o),from:s.address}]},{retryCount:0})}async function GC(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTypedData"});const o=ho(r),a={EIP712Domain:oC({domain:n}),...e.types};if(sC({domain:n,message:i,primaryType:s,types:a}),o.signTypedData)return o.signTypedData({domain:n,message:i,primaryType:s,types:a});const u=iC({domain:n,message:i,primaryType:s,types:a});return t.request({method:"eth_signTypedData_v4",params:[o.address,u]},{retryCount:0})}async function YC(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:Pr(e)}]},{retryCount:0})}async function JC(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}function XC(t){return{addChain:e=>WI(t,e),deployContract:e=>UC(t,e),getAddresses:()=>qC(t),getChainId:()=>Hh(t),getPermissions:()=>zC(t),prepareTransactionRequest:e=>Ig(t,e),requestAddresses:()=>HC(t),requestPermissions:e=>WC(t,e),sendRawTransaction:e=>Zw(t,e),sendTransaction:e=>Dg(t,e),signMessage:e=>KC(t,e),signTransaction:e=>VC(t,e),signTypedData:e=>GC(t,e),switchChain:e=>YC(t,e),watchAsset:e=>JC(t,e),writeContract:e=>HI(t,e)}}function ZC(t){const{key:e="wallet",name:r="Wallet Client",transport:n}=t;return KI({...t,key:e,name:r,transport:n,type:"walletClient"}).extend(XC)}class Wf{constructor(e){co(this,"_key");co(this,"_config",null);co(this,"_provider",null);co(this,"_connected",!1);co(this,"_address",null);co(this,"_fatured",!1);co(this,"_installed",!1);co(this,"lastUsed",!1);var r;if("name"in e&&"image"in e)this._key=e.name,this._config=e,this._fatured=e.featured;else if("session"in e){if(!e.session)throw new Error("session is null");this._key=(r=e.session)==null?void 0:r.peer.metadata.name,this._provider=e,this._config={name:e.session.peer.metadata.name,image:e.session.peer.metadata.icons[0],featured:!1}}else if("info"in e)console.log(e.info,"installed"),this._key=e.info.name,this._provider=e.provider,this._installed=!0,this._config={name:e.info.name,image:e.info.icon,featured:!1},this.testConnect();else throw new Error("unknown params")}get address(){return this._address}get connected(){return this._connected}get featured(){return this._fatured}get key(){return this._key}get installed(){return this._installed}get client(){return this._provider?ZC({transport:ZI(this._provider)}):null}get config(){return this._config}static fromWalletConfig(e){return new Wf(e)}EIP6963Detected(e){this._provider=e.provider,this._installed=!0,this._provider.on("disconnect",this.disconnect),this._provider.on("accountsChanged",r=>{this._address=r[0],this._connected=!0}),this.testConnect()}setUniversalProvider(e){this._provider=e,this.testConnect()}async testConnect(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());e&&e.length>0?(this._address=e[0],this._connected=!0):(this._address=null,this._connected=!1)}async connect(){var r;const e=await((r=this.client)==null?void 0:r.request({method:"eth_requestAccounts",params:void 0}));if(!e)throw new Error("connect failed");return e}async getAddress(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());if(!e)throw new Error("get address failed");return e[0]}async getChain(){var r;const e=await((r=this.client)==null?void 0:r.getChainId());if(!e)throw new Error("get chain failed");return e}async signMessage(e,r){var i;return await((i=this.client)==null?void 0:i.signMessage({message:e,account:r}))}async disconnect(){this._provider&&"session"in this._provider&&await this._provider.disconnect(),this._connected=!1,this._address=null}}var Gg={exports:{}},ru=typeof Reflect=="object"?Reflect:null,w2=ru&&typeof ru.apply=="function"?ru.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Jh;ru&&typeof ru.ownKeys=="function"?Jh=ru.ownKeys:Object.getOwnPropertySymbols?Jh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Jh=function(e){return Object.getOwnPropertyNames(e)};function QC(t){console&&console.warn&&console.warn(t)}var x2=Number.isNaN||function(e){return e!==e};function Rr(){Rr.init.call(this)}Gg.exports=Rr,Gg.exports.once=nT,Rr.EventEmitter=Rr,Rr.prototype._events=void 0,Rr.prototype._eventsCount=0,Rr.prototype._maxListeners=void 0;var _2=10;function Xh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Rr,"defaultMaxListeners",{enumerable:!0,get:function(){return _2},set:function(t){if(typeof t!="number"||t<0||x2(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");_2=t}}),Rr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Rr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||x2(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function E2(t){return t._maxListeners===void 0?Rr.defaultMaxListeners:t._maxListeners}Rr.prototype.getMaxListeners=function(){return E2(this)},Rr.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")w2(u,this,r);else for(var l=u.length,d=I2(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,QC(a)}return t}Rr.prototype.addListener=function(e,r){return S2(this,e,r,!1)},Rr.prototype.on=Rr.prototype.addListener,Rr.prototype.prependListener=function(e,r){return S2(this,e,r,!0)};function eT(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function A2(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=eT.bind(n);return i.listener=r,n.wrapFn=i,i}Rr.prototype.once=function(e,r){return Xh(r),this.on(e,A2(this,e,r)),this},Rr.prototype.prependOnceListener=function(e,r){return Xh(r),this.prependListener(e,A2(this,e,r)),this},Rr.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Xh(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():tT(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Rr.prototype.off=Rr.prototype.removeListener,Rr.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function P2(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?rT(i):I2(i,i.length)}Rr.prototype.listeners=function(e){return P2(this,e,!0)},Rr.prototype.rawListeners=function(e){return P2(this,e,!1)},Rr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):M2.call(t,e)},Rr.prototype.listenerCount=M2;function M2(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Rr.prototype.eventNames=function(){return this._eventsCount>0?Jh(this._events):[]};function I2(t,e){for(var r=new Array(e),n=0;n(i==null?void 0:i.code)===Jc.code):t;return n instanceof yt?new Jc({cause:t,message:n.details}):Jc.nodeMessage.test(r)?new Jc({cause:t,message:t.details}):jh.nodeMessage.test(r)?new jh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):gg.nodeMessage.test(r)?new gg({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):mg.nodeMessage.test(r)?new mg({cause:t,nonce:e==null?void 0:e.nonce}):vg.nodeMessage.test(r)?new vg({cause:t,nonce:e==null?void 0:e.nonce}):bg.nodeMessage.test(r)?new bg({cause:t,nonce:e==null?void 0:e.nonce}):yg.nodeMessage.test(r)?new yg({cause:t}):wg.nodeMessage.test(r)?new wg({cause:t,gas:e==null?void 0:e.gas}):xg.nodeMessage.test(r)?new xg({cause:t,gas:e==null?void 0:e.gas}):_g.nodeMessage.test(r)?new _g({cause:t}):Uh.nodeMessage.test(r)?new Uh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new Eg({cause:t})}function uI(t,{docsPath:e,...r}){const n=(()=>{const i=Bw(t,r);return i instanceof Eg?t:i})();return new cI(n,{docsPath:e,...r})}function $w(t,{format:e}){if(!e)return{};const r={};function n(s){const o=Object.keys(s);for(const a of o)a in t&&(r[a]=t[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}const i=e(t||{});return n(i),r}const fI={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Sg(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=lI(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(r=>li(r)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=Pr(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=Pr(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=Pr(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=Pr(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=Pr(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=Pr(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=fI[t.type]),typeof t.value<"u"&&(e.value=Pr(t.value)),e}function lI(t){return t.map(e=>({address:e.contractAddress,r:e.r,s:e.s,chainId:Pr(e.chainId),nonce:Pr(e.nonce),...typeof e.yParity<"u"?{yParity:Pr(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:Pr(e.v)}:{}}))}function Fw(t){if(!(!t||t.length===0))return t.reduce((e,{slot:r,value:n})=>{if(r.length!==66)throw new tw({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new tw({size:n.length,targetSize:66,type:"hex"});return e[r]=n,e},{})}function hI(t){const{balance:e,nonce:r,state:n,stateDiff:i,code:s}=t,o={};if(s!==void 0&&(o.code=s),e!==void 0&&(o.balance=Pr(e)),r!==void 0&&(o.nonce=Pr(r)),n!==void 0&&(o.state=Fw(n)),i!==void 0){if(o.state)throw new UM;o.stateDiff=Fw(i)}return o}function dI(t){if(!t)return;const e={};for(const{address:r,...n}of t){if(!uo(r,{strict:!1}))throw new zc({address:r});if(e[r])throw new jM({address:r});e[r]=hI(n)}return e}const pI=2n**256n-1n;function qh(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?fo(e):void 0;if(o&&!uo(o.address))throw new zc({address:o.address});if(s&&!uo(s))throw new zc({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new qM;if(n&&n>pI)throw new jh({maxFeePerGas:n});if(i&&n&&i>n)throw new Uh({maxFeePerGas:n,maxPriorityFeePerGas:i})}class gI extends yt{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Ag extends yt{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class mI extends yt{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${hs(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class vI extends yt{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}const bI={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function yI(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?Fc(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?Fc(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?bI[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=wI(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function wI(t){return t.map(e=>({contractAddress:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function xI(t){const e=(t.transactions??[]).map(r=>typeof r=="string"?r:yI(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function zh(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){var d,g,y;const s=n??"latest",o=i??!1,a=r!==void 0?Pr(r):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,o]},{dedupe:!0}):u=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]},{dedupe:!!a}),!u)throw new vI({blockHash:e,blockNumber:r});return(((y=(g=(d=t.chain)==null?void 0:d.formatters)==null?void 0:g.block)==null?void 0:y.format)||xI)(u)}async function jw(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function _I(t,e){var s,o;const{block:r,chain:n=t.chain,request:i}=e||{};try{const a=((s=n==null?void 0:n.fees)==null?void 0:s.maxPriorityFeePerGas)??((o=n==null?void 0:n.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=r||await fi(t,zh,"getBlock")({}),d=await a({block:l,client:t,request:i});if(d===null)throw new Error;return d}if(typeof a<"u")return a;const u=await t.request({method:"eth_maxPriorityFeePerGas"});return yf(u)}catch{const[a,u]=await Promise.all([r?Promise.resolve(r):fi(t,zh,"getBlock")({}),fi(t,jw,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new Ag;const l=u-a.baseFeePerGas;return l<0n?0n:l}}async function Uw(t,e){var y,A;const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>{var P,N;return typeof((P=n==null?void 0:n.fees)==null?void 0:P.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):((N=n==null?void 0:n.fees)==null?void 0:N.baseFeeMultiplier)??1.2})();if(o<1)throw new gI;const u=10**(((y=o.toString().split(".")[1])==null?void 0:y.length)??0),l=P=>P*BigInt(Math.ceil(o*u))/BigInt(u),d=r||await fi(t,zh,"getBlock")({});if(typeof((A=n==null?void 0:n.fees)==null?void 0:A.estimateFeesPerGas)=="function"){const P=await n.fees.estimateFeesPerGas({block:r,client:t,multiply:l,request:i,type:s});if(P!==null)return P}if(s==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new Ag;const P=typeof(i==null?void 0:i.maxPriorityFeePerGas)=="bigint"?i.maxPriorityFeePerGas:await _I(t,{block:d,chain:n,request:i}),N=l(d.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??N+P,maxPriorityFeePerGas:P}}return{gasPrice:(i==null?void 0:i.gasPrice)??l(await fi(t,jw,"getGasPrice")({}))}}async function EI(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,n?Pr(n):r]},{dedupe:!!n});return Fc(i)}function qw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(s=>co(s)):t.blobs,i=[];for(const s of n)i.push(Uint8Array.from(e.blobToKzgCommitment(s)));return r==="bytes"?i:i.map(s=>li(s))}function zw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>co(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>co(o)):t.commitments,s=[];for(let o=0;oli(o))}function SI(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),u=n?4:0,l=n?0:4;t.setUint32(e+u,o,n),t.setUint32(e+l,a,n)}const AI=(t,e,r)=>t&e^~t&r,PI=(t,e,r)=>t&e^t&r^e&r;class MI extends ig{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ng(this.buffer)}update(e){Uc(this);const{view:r,buffer:n,blockLen:i}=this;e=wf(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let g=o;gd.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g>>3,N=Os(A,17)^Os(A,19)^A>>>10;ea[g]=N+ea[g-7]+P+ea[g-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:u,G:l,H:d}=this;for(let g=0;g<64;g++){const y=Os(a,6)^Os(a,11)^Os(a,25),A=d+y+AI(a,u,l)+II[g]+ea[g]|0,N=(Os(n,2)^Os(n,13)^Os(n,22))+PI(n,i,s)|0;d=l,l=u,u=a,a=o+A|0,o=s,s=i,i=n,n=A+N|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(n,i,s,o,a,u,l,d)}roundClean(){ea.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Pg=uw(()=>new CI);function TI(t,e){return Pg(Jo(t,{strict:!1})?rg(t):t)}function RI(t){const{commitment:e,version:r=1}=t,n=t.to??(typeof e=="string"?"hex":"bytes"),i=TI(e);return i.set([r],0),n==="bytes"?i:li(i)}function DI(t){const{commitments:e,version:r}=t,n=t.to??(typeof e[0]=="string"?"hex":"bytes"),i=[];for(const s of e)i.push(RI({commitment:s,to:n,version:r}));return i}const Hw=6,Ww=32,Mg=4096,Kw=Ww*Mg,Vw=Kw*Hw-1-1*Mg*Hw;class OI extends yt{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class NI extends yt{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function LI(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),r=typeof t.data=="string"?co(t.data):t.data,n=_n(r);if(!n)throw new NI;if(n>Vw)throw new OI({maxSize:Vw,size:n});const i=[];let s=!0,o=0;for(;s;){const a=dg(new Uint8Array(Kw));let u=0;for(;ua.bytes):i.map(a=>li(a.bytes))}function kI(t){const{data:e,kzg:r,to:n}=t,i=t.blobs??LI({data:e,to:n}),s=t.commitments??qw({blobs:i,kzg:r,to:n}),o=t.proofs??zw({blobs:i,commitments:s,kzg:r,to:n}),a=[];for(let u=0;u"u"&&g)if(u){const k=await D();y.nonce=await u.consume({address:g.address,chainId:k,client:t})}else y.nonce=await fi(t,EI,"getTransactionCount")({address:g.address,blockTag:"pending"});if((l.includes("fees")||l.includes("type"))&&typeof d>"u")try{y.type=BI(y)}catch{const k=await P();y.type=typeof(k==null?void 0:k.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(l.includes("fees"))if(y.type!=="legacy"&&y.type!=="eip2930"){if(typeof y.maxFeePerGas>"u"||typeof y.maxPriorityFeePerGas>"u"){const k=await P(),{maxFeePerGas:B,maxPriorityFeePerGas:j}=await Uw(t,{block:k,chain:i,request:y});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(y.gas=await fi(t,FI,"estimateGas")({...y,account:g&&{address:g.address,type:"json-rpc"}})),qh(y),delete y.parameters,y}async function $I(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=r?Pr(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function FI(t,e){var i,s,o;const{account:r=t.account}=e,n=r?fo(r):void 0;try{let f=function(v){const{block:x,request:_,rpcStateOverride:S}=v;return t.request({method:"eth_estimateGas",params:S?[_,x??"latest",S]:x?[_,x]:[_]})};const{accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,blockNumber:g,blockTag:y,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:j,value:U,stateOverride:K,...J}=await Ig(t,{...e,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),z=(g?Pr(g):void 0)||y,ue=dI(K),_e=await(async()=>{if(J.to)return J.to;if(u&&u.length>0)return await kw({authorization:u[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`")})})();qh(e);const G=(o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:o.format,m=(G||Sg)({...$w(J,{format:G}),from:n==null?void 0:n.address,accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:j,to:_e,value:U});let p=BigInt(await f({block:z,request:m,rpcStateOverride:ue}));if(u){const v=await $I(t,{address:m.from}),x=await Promise.all(u.map(async _=>{const{contractAddress:S}=_,b=await f({block:z,request:{authorizationList:void 0,data:A,from:n==null?void 0:n.address,to:S,value:Pr(v)},rpcStateOverride:ue}).catch(()=>100000n);return 2n*BigInt(b)}));p+=x.reduce((_,S)=>_+S,0n)}return p}catch(a){throw uI(a,{...e,account:n,chain:t.chain})}}class jI extends yt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class UI extends yt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` +`),{name:"ChainNotFoundError"})}}const Cg="/docs/contract/encodeDeployData";function qI(t){const{abi:e,args:r,bytecode:n}=t;if(!r||r.length===0)return n;const i=e.find(o=>"type"in o&&o.type==="constructor");if(!i)throw new nP({docsPath:Cg});if(!("inputs"in i))throw new Jy({docsPath:Cg});if(!i.inputs||i.inputs.length===0)throw new Jy({docsPath:Cg});const s=_w(i.inputs,r);return Bh([n,s])}async function zI(t){return new Promise(e=>setTimeout(e,t))}class Uf extends yt{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` +`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class Tg extends yt{constructor({docsPath:e,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:e,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function Yw({chain:t,currentChainId:e}){if(!t)throw new UI;if(e!==t.id)throw new jI({chain:t,currentChainId:e})}function HI(t,{docsPath:e,...r}){const n=(()=>{const i=Bw(t,r);return i instanceof Eg?t:i})();return new HM(n,{docsPath:e,...r})}async function Jw(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const Rg=new kh(128);async function Dg(t,e){var k,B,j,U;const{account:r=t.account,chain:n=t.chain,accessList:i,authorizationList:s,blobs:o,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,value:P,...N}=e;if(typeof r>"u")throw new Uf({docsPath:"/docs/actions/wallet/sendTransaction"});const D=r?fo(r):null;try{qh(e);const K=await(async()=>{if(e.to)return e.to;if(s&&s.length>0)return await kw({authorization:s[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`.")})})();if((D==null?void 0:D.type)==="json-rpc"||D===null){let J;n!==null&&(J=await fi(t,Hh,"getChainId")({}),Yw({currentChainId:J,chain:n}));const T=(j=(B=(k=t.chain)==null?void 0:k.formatters)==null?void 0:B.transactionRequest)==null?void 0:j.format,ue=(T||Sg)({...$w(N,{format:T}),accessList:i,authorizationList:s,blobs:o,chainId:J,data:a,from:D==null?void 0:D.address,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,to:K,value:P}),_e=Rg.get(t.uid),G=_e?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:G,params:[ue]},{retryCount:0})}catch(E){if(_e===!1)throw E;const m=E;if(m.name==="InvalidInputRpcError"||m.name==="InvalidParamsRpcError"||m.name==="MethodNotFoundRpcError"||m.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[ue]},{retryCount:0}).then(f=>(Rg.set(t.uid,!0),f)).catch(f=>{const p=f;throw p.name==="MethodNotFoundRpcError"||p.name==="MethodNotSupportedRpcError"?(Rg.set(t.uid,!1),m):p});throw m}}if((D==null?void 0:D.type)==="local"){const J=await fi(t,Ig,"prepareTransactionRequest")({account:D,accessList:i,authorizationList:s,blobs:o,chain:n,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,nonceManager:D.nonceManager,parameters:[...Gw,"sidecars"],value:P,...N,to:K}),T=(U=n==null?void 0:n.serializers)==null?void 0:U.transaction,z=await D.signTransaction(J,{serializer:T});return await fi(t,Jw,"sendRawTransaction")({serializedTransaction:z})}throw(D==null?void 0:D.type)==="smart"?new Tg({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Tg({docsPath:"/docs/actions/wallet/sendTransaction",type:D==null?void 0:D.type})}catch(K){throw K instanceof Tg?K:HI(K,{...e,account:D,chain:e.chain||void 0})}}async function WI(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:o,functionName:a,...u}=e;if(typeof n>"u")throw new Uf({docsPath:"/docs/contract/writeContract"});const l=n?fo(n):null,d=yM({abi:r,args:s,functionName:a});try{return await fi(t,Dg,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:i,account:l,...u})}catch(g){throw eI(g,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:a,sender:l==null?void 0:l.address})}}async function KI(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:Pr(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}const Og=256;let Wh=Og,Kh;function Xw(t=11){if(!Kh||Wh+t>Og*2){Kh="",Wh=0;for(let e=0;e{const B=k(D);for(const U in P)delete B[U];const j={...D,...B};return Object.assign(j,{extend:N(j)})}}return Object.assign(P,{extend:N(P)})}const Vh=new kh(8192);function GI(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(Vh.get(r))return Vh.get(r);const n=t().finally(()=>Vh.delete(r));return Vh.set(r,n),n}function YI(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const u=async({error:l})=>{const d=typeof e=="function"?e({count:a,error:l}):e;d&&await zI(d),o({count:a+1})};try{const l=await t();i(l)}catch(l){if(a{const{dedupe:i=!1,retryDelay:s=150,retryCount:o=3,uid:a}={...e,...n},u=i?Ef(Oh(`${a}.${Kc(r)}`)):void 0;return GI(()=>YI(async()=>{try{return await t(r)}catch(l){const d=l;switch(d.code){case Pf.code:throw new Pf(d);case Mf.code:throw new Mf(d);case If.code:throw new If(d,{method:r.method});case Cf.code:throw new Cf(d);case Ba.code:throw new Ba(d);case Tf.code:throw new Tf(d);case Rf.code:throw new Rf(d);case Df.code:throw new Df(d);case Of.code:throw new Of(d);case Nf.code:throw new Nf(d,{method:r.method});case Gc.code:throw new Gc(d);case Lf.code:throw new Lf(d);case Yc.code:throw new Yc(d);case kf.code:throw new kf(d);case Bf.code:throw new Bf(d);case $f.code:throw new $f(d);case Ff.code:throw new Ff(d);case jf.code:throw new jf(d);case 5e3:throw new Yc(d);default:throw l instanceof yt?l:new ZM(d)}}},{delay:({count:l,error:d})=>{var g;if(d&&d instanceof Dw){const y=(g=d==null?void 0:d.headers)==null?void 0:g.get("Retry-After");if(y!=null&&y.match(/\d/))return Number.parseInt(y)*1e3}return~~(1<XI(l)}),{enabled:i,id:u})}}function XI(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Gc.code||t.code===Ba.code:t instanceof Dw&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function ZI({key:t,name:e,request:r,retryCount:n=3,retryDelay:i=150,timeout:s,type:o},a){const u=Xw();return{config:{key:t,name:e,request:r,retryCount:n,retryDelay:i,timeout:s,type:o},request:JI(r,{retryCount:n,retryDelay:i,uid:u}),value:a}}function QI(t,e={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=e;return({retryCount:s})=>ZI({key:r,name:n,request:t.request.bind(t),retryCount:e.retryCount??s,retryDelay:i,type:"custom"})}const eC=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,tC=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;class rC extends yt{constructor({domain:e}){super(`Invalid domain "${Kc(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class nC extends yt{constructor({primaryType:e,types:r}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class iC extends yt{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function sC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(u,l)=>{const d={...l};for(const g of u){const{name:y,type:A}=g;A==="address"&&(d[y]=d[y].toLowerCase())}return d},o=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return Kc({domain:o,message:a,primaryType:n,types:i})}function oC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(o,a)=>{for(const u of o){const{name:l,type:d}=u,g=a[l],y=d.match(tC);if(y&&(typeof g=="number"||typeof g=="bigint")){const[N,D,k]=y;Pr(g,{signed:D==="int",size:Number.parseInt(k)/8})}if(d==="address"&&typeof g=="string"&&!uo(g))throw new zc({address:g});const A=d.match(eC);if(A){const[N,D]=A;if(D&&_n(g)!==Number.parseInt(D))throw new uP({expectedSize:Number.parseInt(D),givenSize:_n(g)})}const P=i[d];P&&(cC(d),s(P,g))}};if(i.EIP712Domain&&e){if(typeof e!="object")throw new rC({domain:e});s(i.EIP712Domain,e)}if(n!=="EIP712Domain")if(i[n])s(i[n],r);else throw new nC({primaryType:n,types:i})}function aC({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},typeof(t==null?void 0:t.chainId)=="number"&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function cC(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new iC({type:t})}let Zw=class extends ig{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,SP(e);const n=wf(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew Zw(t,e).update(r).digest();Qw.create=(t,e)=>new Zw(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ng=BigInt(0),Gh=BigInt(1),uC=BigInt(2);function $a(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function qf(t){if(!$a(t))throw new Error("Uint8Array expected")}function Xc(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)}const fC=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Zc(t){qf(t);let e="";for(let r=0;r=ho._0&&t<=ho._9)return t-ho._0;if(t>=ho._A&&t<=ho._F)return t-(ho._A-10);if(t>=ho._a&&t<=ho._f)return t-(ho._a-10)}function eu(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;itypeof t=="bigint"&&Ng<=t;function Yh(t,e,r){return $g(t)&&$g(e)&&$g(r)&&e<=t&&tNg;t>>=Gh,e+=1);return e}function pC(t,e){return t>>BigInt(e)&Gh}function gC(t,e,r){return t|(r?Gh:Ng)<(uC<new Uint8Array(t),r2=t=>Uint8Array.from(t);function n2(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=jg(t),i=jg(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...g)=>r(i,n,...g),u=(g=jg())=>{i=a(r2([0]),g),n=a(),g.length!==0&&(i=a(r2([1]),g),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let g=0;const y=[];for(;g{o(),u(g);let A;for(;!(A=y(l()));)u();return o(),A}}const mC={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||$a(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Hf(t,e,r={}){const n=(i,s,o)=>{const a=mC[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const u=t[i];if(!(o&&u===void 0)&&!a(u,t))throw new Error(`Invalid param ${String(i)}=${u} (${typeof u}), expected ${s}`)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const vC=()=>{throw new Error("not implemented")};function Ug(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}const bC=Object.freeze(Object.defineProperty({__proto__:null,aInRange:ja,abool:Xc,abytes:qf,bitGet:pC,bitLen:t2,bitMask:Fg,bitSet:gC,bytesToHex:Zc,bytesToNumberBE:Fa,bytesToNumberLE:kg,concatBytes:zf,createHmacDrbg:n2,ensureBytes:ds,equalBytes:hC,hexToBytes:eu,hexToNumber:Lg,inRange:Yh,isBytes:$a,memoized:Ug,notImplemented:vC,numberToBytesBE:tu,numberToBytesLE:Bg,numberToHexUnpadded:Qc,numberToVarBytesBE:lC,utf8ToBytes:dC,validateObject:Hf},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mn=BigInt(0),sn=BigInt(1),Ua=BigInt(2),yC=BigInt(3),qg=BigInt(4),i2=BigInt(5),s2=BigInt(8);BigInt(9),BigInt(16);function di(t,e){const r=t%e;return r>=Mn?r:e+r}function wC(t,e,r){if(r<=Mn||e 0");if(r===sn)return Mn;let n=sn;for(;e>Mn;)e&sn&&(n=n*t%r),t=t*t%r,e>>=sn;return n}function Ui(t,e,r){let n=t;for(;e-- >Mn;)n*=n,n%=r;return n}function zg(t,e){if(t===Mn||e<=Mn)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=di(t,e),n=e,i=Mn,s=sn;for(;r!==Mn;){const a=n/r,u=n%r,l=i-s*a;n=r,r=u,i=s,s=l}if(n!==sn)throw new Error("invert: does not exist");return di(i,e)}function xC(t){const e=(t-sn)/Ua;let r,n,i;for(r=t-sn,n=0;r%Ua===Mn;r/=Ua,n++);for(i=Ua;i(n[i]="function",n),e);return Hf(t,r)}function AC(t,e,r){if(r 0");if(r===Mn)return t.ONE;if(r===sn)return e;let n=t.ONE,i=e;for(;r>Mn;)r&sn&&(n=t.mul(n,i)),i=t.sqr(i),r>>=sn;return n}function PC(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function o2(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function a2(t,e,r=!1,n={}){if(t<=Mn)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=o2(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=_C(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:Fg(i),ZERO:Mn,ONE:sn,create:u=>di(u,t),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return Mn<=u&&uu===Mn,isOdd:u=>(u&sn)===sn,neg:u=>di(-u,t),eql:(u,l)=>u===l,sqr:u=>di(u*u,t),add:(u,l)=>di(u+l,t),sub:(u,l)=>di(u-l,t),mul:(u,l)=>di(u*l,t),pow:(u,l)=>AC(a,u,l),div:(u,l)=>di(u*zg(l,t),t),sqrN:u=>u*u,addN:(u,l)=>u+l,subN:(u,l)=>u-l,mulN:(u,l)=>u*l,inv:u=>zg(u,t),sqrt:n.sqrt||(u=>o(a,u)),invertBatch:u=>PC(a,u),cmov:(u,l,d)=>d?l:u,toBytes:u=>r?Bg(u,s):tu(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return r?kg(u):Fa(u)}});return Object.freeze(a)}function c2(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function u2(t){const e=c2(t);return e+Math.ceil(e/2)}function MC(t,e,r=!1){const n=t.length,i=c2(e),s=u2(e);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?Fa(t):kg(t),a=di(o,e-sn)+sn;return r?Bg(a,i):tu(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const IC=BigInt(0),Hg=BigInt(1),Wg=new WeakMap,f2=new WeakMap;function CC(t,e){const r=(s,o)=>{const a=o.negate();return s?a:o},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>e)throw new Error(`Wrong window size=${s}, should be [1..${e}]`)},i=s=>{n(s);const o=Math.ceil(e/s)+1,a=2**(s-1);return{windows:o,windowSize:a}};return{constTimeNegate:r,unsafeLadder(s,o){let a=t.ZERO,u=s;for(;o>IC;)o&Hg&&(a=a.add(u)),u=u.double(),o>>=Hg;return a},precomputeWindow(s,o){const{windows:a,windowSize:u}=i(o),l=[];let d=s,g=d;for(let y=0;y>=P,k>l&&(k-=A,a+=Hg);const B=D,j=D+Math.abs(k)-1,U=N%2!==0,K=k<0;k===0?g=g.add(r(U,o[B])):d=d.add(r(K,o[j]))}return{p:d,f:g}},wNAFCached(s,o,a){const u=f2.get(s)||1;let l=Wg.get(s);return l||(l=this.precomputeWindow(s,u),u!==1&&Wg.set(s,a(l))),this.wNAF(u,l,o)},setWindowSize(s,o){n(o),f2.set(s,o),Wg.delete(s)}}}function TC(t,e,r,n){if(!Array.isArray(r)||!Array.isArray(n)||n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((d,g)=>{if(!e.isValid(d))throw new Error(`wrong scalar at index ${g}`)}),r.forEach((d,g)=>{if(!(d instanceof t))throw new Error(`wrong point at index ${g}`)});const i=t2(BigInt(r.length)),s=i>12?i-3:i>4?i-2:i?2:1,o=(1<=0;d-=s){a.fill(t.ZERO);for(let y=0;y>BigInt(d)&BigInt(o));a[P]=a[P].add(r[y])}let g=t.ZERO;for(let y=a.length-1,A=t.ZERO;y>0;y--)A=A.add(a[y]),g=g.add(A);if(l=l.add(g),d!==0)for(let y=0;y{const{Err:r}=po;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=Qc(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?Qc(i.length/2|128):"";return`${Qc(t)}${s}${i}${e}`},decode(t,e){const{Err:r}=po;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");const l=e.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const d of l)o=o<<8|d;if(n+=u,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=po;if(t{const B=D.toAffine();return zf(Uint8Array.from([4]),r.toBytes(B.x),r.toBytes(B.y))}),s=e.fromBytes||(N=>{const D=N.subarray(1),k=r.fromBytes(D.subarray(0,r.BYTES)),B=r.fromBytes(D.subarray(r.BYTES,2*r.BYTES));return{x:k,y:B}});function o(N){const{a:D,b:k}=e,B=r.sqr(N),j=r.mul(B,N);return r.add(r.add(j,r.mul(N,D)),k)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(N){return Yh(N,In,e.n)}function u(N){const{allowedPrivateKeyLengths:D,nByteLength:k,wrapPrivateKey:B,n:j}=e;if(D&&typeof N!="bigint"){if($a(N)&&(N=Zc(N)),typeof N!="string"||!D.includes(N.length))throw new Error("Invalid key");N=N.padStart(k*2,"0")}let U;try{U=typeof N=="bigint"?N:Fa(ds("private key",N,k))}catch{throw new Error(`private key must be ${k} bytes, hex or bigint, not ${typeof N}`)}return B&&(U=di(U,j)),ja("private key",U,In,j),U}function l(N){if(!(N instanceof y))throw new Error("ProjectivePoint expected")}const d=Ug((N,D)=>{const{px:k,py:B,pz:j}=N;if(r.eql(j,r.ONE))return{x:k,y:B};const U=N.is0();D==null&&(D=U?r.ONE:r.inv(j));const K=r.mul(k,D),J=r.mul(B,D),T=r.mul(j,D);if(U)return{x:r.ZERO,y:r.ZERO};if(!r.eql(T,r.ONE))throw new Error("invZ was invalid");return{x:K,y:J}}),g=Ug(N=>{if(N.is0()){if(e.allowInfinityPoint&&!r.is0(N.py))return;throw new Error("bad point: ZERO")}const{x:D,y:k}=N.toAffine();if(!r.isValid(D)||!r.isValid(k))throw new Error("bad point: x or y not FE");const B=r.sqr(k),j=o(D);if(!r.eql(B,j))throw new Error("bad point: equation left != right");if(!N.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(D,k,B){if(this.px=D,this.py=k,this.pz=B,D==null||!r.isValid(D))throw new Error("x required");if(k==null||!r.isValid(k))throw new Error("y required");if(B==null||!r.isValid(B))throw new Error("z required");Object.freeze(this)}static fromAffine(D){const{x:k,y:B}=D||{};if(!D||!r.isValid(k)||!r.isValid(B))throw new Error("invalid affine point");if(D instanceof y)throw new Error("projective point not allowed");const j=U=>r.eql(U,r.ZERO);return j(k)&&j(B)?y.ZERO:new y(k,B,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(D){const k=r.invertBatch(D.map(B=>B.pz));return D.map((B,j)=>B.toAffine(k[j])).map(y.fromAffine)}static fromHex(D){const k=y.fromAffine(s(ds("pointHex",D)));return k.assertValidity(),k}static fromPrivateKey(D){return y.BASE.multiply(u(D))}static msm(D,k){return TC(y,n,D,k)}_setWindowSize(D){P.setWindowSize(this,D)}assertValidity(){g(this)}hasEvenY(){const{y:D}=this.toAffine();if(r.isOdd)return!r.isOdd(D);throw new Error("Field doesn't support isOdd")}equals(D){l(D);const{px:k,py:B,pz:j}=this,{px:U,py:K,pz:J}=D,T=r.eql(r.mul(k,J),r.mul(U,j)),z=r.eql(r.mul(B,J),r.mul(K,j));return T&&z}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){const{a:D,b:k}=e,B=r.mul(k,d2),{px:j,py:U,pz:K}=this;let J=r.ZERO,T=r.ZERO,z=r.ZERO,ue=r.mul(j,j),_e=r.mul(U,U),G=r.mul(K,K),E=r.mul(j,U);return E=r.add(E,E),z=r.mul(j,K),z=r.add(z,z),J=r.mul(D,z),T=r.mul(B,G),T=r.add(J,T),J=r.sub(_e,T),T=r.add(_e,T),T=r.mul(J,T),J=r.mul(E,J),z=r.mul(B,z),G=r.mul(D,G),E=r.sub(ue,G),E=r.mul(D,E),E=r.add(E,z),z=r.add(ue,ue),ue=r.add(z,ue),ue=r.add(ue,G),ue=r.mul(ue,E),T=r.add(T,ue),G=r.mul(U,K),G=r.add(G,G),ue=r.mul(G,E),J=r.sub(J,ue),z=r.mul(G,_e),z=r.add(z,z),z=r.add(z,z),new y(J,T,z)}add(D){l(D);const{px:k,py:B,pz:j}=this,{px:U,py:K,pz:J}=D;let T=r.ZERO,z=r.ZERO,ue=r.ZERO;const _e=e.a,G=r.mul(e.b,d2);let E=r.mul(k,U),m=r.mul(B,K),f=r.mul(j,J),p=r.add(k,B),v=r.add(U,K);p=r.mul(p,v),v=r.add(E,m),p=r.sub(p,v),v=r.add(k,j);let x=r.add(U,J);return v=r.mul(v,x),x=r.add(E,f),v=r.sub(v,x),x=r.add(B,j),T=r.add(K,J),x=r.mul(x,T),T=r.add(m,f),x=r.sub(x,T),ue=r.mul(_e,v),T=r.mul(G,f),ue=r.add(T,ue),T=r.sub(m,ue),ue=r.add(m,ue),z=r.mul(T,ue),m=r.add(E,E),m=r.add(m,E),f=r.mul(_e,f),v=r.mul(G,v),m=r.add(m,f),f=r.sub(E,f),f=r.mul(_e,f),v=r.add(v,f),E=r.mul(m,v),z=r.add(z,E),E=r.mul(x,v),T=r.mul(p,T),T=r.sub(T,E),E=r.mul(p,m),ue=r.mul(x,ue),ue=r.add(ue,E),new y(T,z,ue)}subtract(D){return this.add(D.negate())}is0(){return this.equals(y.ZERO)}wNAF(D){return P.wNAFCached(this,D,y.normalizeZ)}multiplyUnsafe(D){ja("scalar",D,go,e.n);const k=y.ZERO;if(D===go)return k;if(D===In)return this;const{endo:B}=e;if(!B)return P.unsafeLadder(this,D);let{k1neg:j,k1:U,k2neg:K,k2:J}=B.splitScalar(D),T=k,z=k,ue=this;for(;U>go||J>go;)U&In&&(T=T.add(ue)),J&In&&(z=z.add(ue)),ue=ue.double(),U>>=In,J>>=In;return j&&(T=T.negate()),K&&(z=z.negate()),z=new y(r.mul(z.px,B.beta),z.py,z.pz),T.add(z)}multiply(D){const{endo:k,n:B}=e;ja("scalar",D,In,B);let j,U;if(k){const{k1neg:K,k1:J,k2neg:T,k2:z}=k.splitScalar(D);let{p:ue,f:_e}=this.wNAF(J),{p:G,f:E}=this.wNAF(z);ue=P.constTimeNegate(K,ue),G=P.constTimeNegate(T,G),G=new y(r.mul(G.px,k.beta),G.py,G.pz),j=ue.add(G),U=_e.add(E)}else{const{p:K,f:J}=this.wNAF(D);j=K,U=J}return y.normalizeZ([j,U])[0]}multiplyAndAddUnsafe(D,k,B){const j=y.BASE,U=(J,T)=>T===go||T===In||!J.equals(j)?J.multiplyUnsafe(T):J.multiply(T),K=U(this,k).add(U(D,B));return K.is0()?void 0:K}toAffine(D){return d(this,D)}isTorsionFree(){const{h:D,isTorsionFree:k}=e;if(D===In)return!0;if(k)return k(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:D,clearCofactor:k}=e;return D===In?this:k?k(y,this):this.multiplyUnsafe(e.h)}toRawBytes(D=!0){return Xc("isCompressed",D),this.assertValidity(),i(y,this,D)}toHex(D=!0){return Xc("isCompressed",D),Zc(this.toRawBytes(D))}}y.BASE=new y(e.Gx,e.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);const A=e.nBitLength,P=CC(y,e.endo?Math.ceil(A/2):A);return{CURVE:e,ProjectivePoint:y,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:a}}function LC(t){const e=l2(t);return Hf(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function kC(t){const e=LC(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(f){return di(f,n)}function a(f){return zg(f,n)}const{ProjectivePoint:u,normPrivateKeyToScalar:l,weierstrassEquation:d,isWithinCurveOrder:g}=NC({...e,toBytes(f,p,v){const x=p.toAffine(),_=r.toBytes(x.x),S=zf;return Xc("isCompressed",v),v?S(Uint8Array.from([p.hasEvenY()?2:3]),_):S(Uint8Array.from([4]),_,r.toBytes(x.y))},fromBytes(f){const p=f.length,v=f[0],x=f.subarray(1);if(p===i&&(v===2||v===3)){const _=Fa(x);if(!Yh(_,In,r.ORDER))throw new Error("Point is not on curve");const S=d(_);let b;try{b=r.sqrt(S)}catch(F){const ae=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+ae)}const M=(b&In)===In;return(v&1)===1!==M&&(b=r.neg(b)),{x:_,y:b}}else if(p===s&&v===4){const _=r.fromBytes(x.subarray(0,r.BYTES)),S=r.fromBytes(x.subarray(r.BYTES,2*r.BYTES));return{x:_,y:S}}else throw new Error(`Point of length ${p} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`)}}),y=f=>Zc(tu(f,e.nByteLength));function A(f){const p=n>>In;return f>p}function P(f){return A(f)?o(-f):f}const N=(f,p,v)=>Fa(f.slice(p,v));class D{constructor(p,v,x){this.r=p,this.s=v,this.recovery=x,this.assertValidity()}static fromCompact(p){const v=e.nByteLength;return p=ds("compactSignature",p,v*2),new D(N(p,0,v),N(p,v,2*v))}static fromDER(p){const{r:v,s:x}=po.toSig(ds("DER",p));return new D(v,x)}assertValidity(){ja("r",this.r,In,n),ja("s",this.s,In,n)}addRecoveryBit(p){return new D(this.r,this.s,p)}recoverPublicKey(p){const{r:v,s:x,recovery:_}=this,S=J(ds("msgHash",p));if(_==null||![0,1,2,3].includes(_))throw new Error("recovery id invalid");const b=_===2||_===3?v+e.n:v;if(b>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const M=_&1?"03":"02",I=u.fromHex(M+y(b)),F=a(b),ae=o(-S*F),O=o(x*F),se=u.BASE.multiplyAndAddUnsafe(I,ae,O);if(!se)throw new Error("point at infinify");return se.assertValidity(),se}hasHighS(){return A(this.s)}normalizeS(){return this.hasHighS()?new D(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return eu(this.toDERHex())}toDERHex(){return po.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return eu(this.toCompactHex())}toCompactHex(){return y(this.r)+y(this.s)}}const k={isValidPrivateKey(f){try{return l(f),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const f=u2(e.n);return MC(e.randomBytes(f),e.n)},precompute(f=8,p=u.BASE){return p._setWindowSize(f),p.multiply(BigInt(3)),p}};function B(f,p=!0){return u.fromPrivateKey(f).toRawBytes(p)}function j(f){const p=$a(f),v=typeof f=="string",x=(p||v)&&f.length;return p?x===i||x===s:v?x===2*i||x===2*s:f instanceof u}function U(f,p,v=!0){if(j(f))throw new Error("first arg must be private key");if(!j(p))throw new Error("second arg must be public key");return u.fromHex(p).multiply(l(f)).toRawBytes(v)}const K=e.bits2int||function(f){const p=Fa(f),v=f.length*8-e.nBitLength;return v>0?p>>BigInt(v):p},J=e.bits2int_modN||function(f){return o(K(f))},T=Fg(e.nBitLength);function z(f){return ja(`num < 2^${e.nBitLength}`,f,go,T),tu(f,e.nByteLength)}function ue(f,p,v=_e){if(["recovered","canonical"].some(X=>X in v))throw new Error("sign() legacy options not supported");const{hash:x,randomBytes:_}=e;let{lowS:S,prehash:b,extraEntropy:M}=v;S==null&&(S=!0),f=ds("msgHash",f),h2(v),b&&(f=ds("prehashed msgHash",x(f)));const I=J(f),F=l(p),ae=[z(F),z(I)];if(M!=null&&M!==!1){const X=M===!0?_(r.BYTES):M;ae.push(ds("extraEntropy",X))}const O=zf(...ae),se=I;function ee(X){const Q=K(X);if(!g(Q))return;const R=a(Q),Z=u.BASE.multiply(Q).toAffine(),te=o(Z.x);if(te===go)return;const le=o(R*o(se+te*F));if(le===go)return;let ie=(Z.x===te?0:2)|Number(Z.y&In),fe=le;return S&&A(le)&&(fe=P(le),ie^=1),new D(te,fe,ie)}return{seed:O,k2sig:ee}}const _e={lowS:e.lowS,prehash:!1},G={lowS:e.lowS,prehash:!1};function E(f,p,v=_e){const{seed:x,k2sig:_}=ue(f,p,v),S=e;return n2(S.hash.outputLen,S.nByteLength,S.hmac)(x,_)}u.BASE._setWindowSize(8);function m(f,p,v,x=G){var Z;const _=f;if(p=ds("msgHash",p),v=ds("publicKey",v),"strict"in x)throw new Error("options.strict was renamed to lowS");h2(x);const{lowS:S,prehash:b}=x;let M,I;try{if(typeof _=="string"||$a(_))try{M=D.fromDER(_)}catch(te){if(!(te instanceof po.Err))throw te;M=D.fromCompact(_)}else if(typeof _=="object"&&typeof _.r=="bigint"&&typeof _.s=="bigint"){const{r:te,s:le}=_;M=new D(te,le)}else throw new Error("PARSE");I=u.fromHex(v)}catch(te){if(te.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(S&&M.hasHighS())return!1;b&&(p=e.hash(p));const{r:F,s:ae}=M,O=J(p),se=a(ae),ee=o(O*se),X=o(F*se),Q=(Z=u.BASE.multiplyAndAddUnsafe(I,ee,X))==null?void 0:Z.toAffine();return Q?o(Q.x)===F:!1}return{CURVE:e,getPublicKey:B,getSharedSecret:U,sign:E,verify:m,ProjectivePoint:u,Signature:D,utils:k}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function BC(t){return{hash:t,hmac:(e,...r)=>Qw(t,e,kP(...r)),randomBytes:$P}}function $C(t,e){const r=n=>kC({...t,...BC(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const p2=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),g2=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),FC=BigInt(1),Kg=BigInt(2),m2=(t,e)=>(t+e/Kg)/e;function jC(t){const e=p2,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),u=BigInt(88),l=t*t*t%e,d=l*l*t%e,g=Ui(d,r,e)*d%e,y=Ui(g,r,e)*d%e,A=Ui(y,Kg,e)*l%e,P=Ui(A,i,e)*A%e,N=Ui(P,s,e)*P%e,D=Ui(N,a,e)*N%e,k=Ui(D,u,e)*D%e,B=Ui(k,a,e)*N%e,j=Ui(B,r,e)*d%e,U=Ui(j,o,e)*P%e,K=Ui(U,n,e)*l%e,J=Ui(K,Kg,e);if(!Vg.eql(Vg.sqr(J),t))throw new Error("Cannot find square root");return J}const Vg=a2(p2,void 0,void 0,{sqrt:jC}),v2=$C({a:BigInt(0),b:BigInt(7),Fp:Vg,n:g2,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=g2,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-FC*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=m2(s*t,e),u=m2(-n*t,e);let l=di(t-a*r-u*i,e),d=di(-a*n-u*s,e);const g=l>o,y=d>o;if(g&&(l=e-l),y&&(d=e-d),l>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:g,k1:l,k2neg:y,k2:d}}}},Pg);BigInt(0),v2.ProjectivePoint;const UC=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:v2},Symbol.toStringTag,{value:"Module"}));function qC(t,e){const{abi:r,args:n,bytecode:i,...s}=e,o=qI({abi:r,args:n,bytecode:i});return Dg(t,{...s,data:o})}async function zC(t){var r;return((r=t.account)==null?void 0:r.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(n=>Sf(n))}async function HC(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}async function WC(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>og(r))}async function KC(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function VC(t,{account:e=t.account,message:r}){if(!e)throw new Uf({docsPath:"/docs/actions/wallet/signMessage"});const n=fo(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Oh(r):r.raw instanceof Uint8Array?Dh(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function GC(t,e){var l,d,g,y;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTransaction"});const s=fo(r);qh({account:s,...e});const o=await fi(t,Hh,"getChainId")({});n!==null&&Yw({currentChainId:o,chain:n});const a=(n==null?void 0:n.formatters)||((l=t.chain)==null?void 0:l.formatters),u=((d=a==null?void 0:a.transactionRequest)==null?void 0:d.format)||Sg;return s.signTransaction?s.signTransaction({...i,chainId:o},{serializer:(y=(g=t.chain)==null?void 0:g.serializers)==null?void 0:y.transaction}):await t.request({method:"eth_signTransaction",params:[{...u(i),chainId:Pr(o),from:s.address}]},{retryCount:0})}async function YC(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTypedData"});const o=fo(r),a={EIP712Domain:aC({domain:n}),...e.types};if(oC({domain:n,message:i,primaryType:s,types:a}),o.signTypedData)return o.signTypedData({domain:n,message:i,primaryType:s,types:a});const u=sC({domain:n,message:i,primaryType:s,types:a});return t.request({method:"eth_signTypedData_v4",params:[o.address,u]},{retryCount:0})}async function JC(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:Pr(e)}]},{retryCount:0})}async function XC(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}function ZC(t){return{addChain:e=>KI(t,e),deployContract:e=>qC(t,e),getAddresses:()=>zC(t),getChainId:()=>Hh(t),getPermissions:()=>HC(t),prepareTransactionRequest:e=>Ig(t,e),requestAddresses:()=>WC(t),requestPermissions:e=>KC(t,e),sendRawTransaction:e=>Jw(t,e),sendTransaction:e=>Dg(t,e),signMessage:e=>VC(t,e),signTransaction:e=>GC(t,e),signTypedData:e=>YC(t,e),switchChain:e=>JC(t,e),watchAsset:e=>XC(t,e),writeContract:e=>WI(t,e)}}function QC(t){const{key:e="wallet",name:r="Wallet Client",transport:n}=t;return VI({...t,key:e,name:r,transport:n,type:"walletClient"}).extend(ZC)}class Wf{constructor(e){oo(this,"_key");oo(this,"_config",null);oo(this,"_provider",null);oo(this,"_connected",!1);oo(this,"_address",null);oo(this,"_fatured",!1);oo(this,"_installed",!1);oo(this,"lastUsed",!1);var r;if("name"in e&&"image"in e)this._key=e.name,this._config=e,this._fatured=e.featured;else if("session"in e){if(!e.session)throw new Error("session is null");this._key=(r=e.session)==null?void 0:r.peer.metadata.name,this._provider=e,this._config={name:e.session.peer.metadata.name,image:e.session.peer.metadata.icons[0],featured:!1}}else if("info"in e)console.log(e.info,"installed"),this._key=e.info.name,this._provider=e.provider,this._installed=!0,this._config={name:e.info.name,image:e.info.icon,featured:!1},this.testConnect();else throw new Error("unknown params")}get address(){return this._address}get connected(){return this._connected}get featured(){return this._fatured}get key(){return this._key}get installed(){return this._installed}get client(){return this._provider?QC({transport:QI(this._provider)}):null}get config(){return this._config}static fromWalletConfig(e){return new Wf(e)}EIP6963Detected(e){this._provider=e.provider,this._installed=!0,this._provider.on("disconnect",this.disconnect),this._provider.on("accountsChanged",r=>{this._address=r[0],this._connected=!0}),this.testConnect()}setUniversalProvider(e){this._provider=e,this.testConnect()}async testConnect(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());e&&e.length>0?(this._address=e[0],this._connected=!0):(this._address=null,this._connected=!1)}async connect(){var r;const e=await((r=this.client)==null?void 0:r.request({method:"eth_requestAccounts",params:void 0}));if(!e)throw new Error("connect failed");return e}async getAddress(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());if(!e)throw new Error("get address failed");return e[0]}async getChain(){var r;const e=await((r=this.client)==null?void 0:r.getChainId());if(!e)throw new Error("get chain failed");return e}async signMessage(e,r){var i;return await((i=this.client)==null?void 0:i.signMessage({message:e,account:r}))}async disconnect(){this._provider&&"session"in this._provider&&await this._provider.disconnect(),this._connected=!1,this._address=null}}var Gg={exports:{}},ru=typeof Reflect=="object"?Reflect:null,b2=ru&&typeof ru.apply=="function"?ru.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Jh;ru&&typeof ru.ownKeys=="function"?Jh=ru.ownKeys:Object.getOwnPropertySymbols?Jh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Jh=function(e){return Object.getOwnPropertyNames(e)};function eT(t){console&&console.warn&&console.warn(t)}var y2=Number.isNaN||function(e){return e!==e};function Rr(){Rr.init.call(this)}Gg.exports=Rr,Gg.exports.once=iT,Rr.EventEmitter=Rr,Rr.prototype._events=void 0,Rr.prototype._eventsCount=0,Rr.prototype._maxListeners=void 0;var w2=10;function Xh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Rr,"defaultMaxListeners",{enumerable:!0,get:function(){return w2},set:function(t){if(typeof t!="number"||t<0||y2(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");w2=t}}),Rr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Rr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||y2(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function x2(t){return t._maxListeners===void 0?Rr.defaultMaxListeners:t._maxListeners}Rr.prototype.getMaxListeners=function(){return x2(this)},Rr.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")b2(u,this,r);else for(var l=u.length,d=P2(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,eT(a)}return t}Rr.prototype.addListener=function(e,r){return _2(this,e,r,!1)},Rr.prototype.on=Rr.prototype.addListener,Rr.prototype.prependListener=function(e,r){return _2(this,e,r,!0)};function tT(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function E2(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=tT.bind(n);return i.listener=r,n.wrapFn=i,i}Rr.prototype.once=function(e,r){return Xh(r),this.on(e,E2(this,e,r)),this},Rr.prototype.prependOnceListener=function(e,r){return Xh(r),this.prependListener(e,E2(this,e,r)),this},Rr.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Xh(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():rT(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Rr.prototype.off=Rr.prototype.removeListener,Rr.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function S2(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?nT(i):P2(i,i.length)}Rr.prototype.listeners=function(e){return S2(this,e,!0)},Rr.prototype.rawListeners=function(e){return S2(this,e,!1)},Rr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):A2.call(t,e)},Rr.prototype.listenerCount=A2;function A2(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Rr.prototype.eventNames=function(){return this._eventsCount>0?Jh(this._events):[]};function P2(t,e){for(var r=new Array(e),n=0;n=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function cT(t,e){return function(r,n){e(r,n,t)}}function uT(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function fT(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(d){try{l(n.next(d))}catch(g){o(g)}}function u(d){try{l(n.throw(d))}catch(g){o(g)}}function l(d){d.done?s(d.value):i(d.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function lT(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return u([l,d])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function T2(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function pT(){for(var t=[],e=0;e1||a(y,A)})})}function a(y,A){try{u(n[y](A))}catch(P){g(s[0][3],P)}}function u(y){y.value instanceof Kf?Promise.resolve(y.value.v).then(l,d):g(s[0][2],y)}function l(y){a("next",y)}function d(y){a("throw",y)}function g(y,A){y(A),s.shift(),s.length&&a(s[0][0],s[0][1])}}function vT(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Kf(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function bT(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Zg=="function"?Zg(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function yT(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function wT(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function xT(t){return t&&t.__esModule?t:{default:t}}function _T(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function ET(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const Vf=Jp(Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Xg},__asyncDelegator:vT,__asyncGenerator:mT,__asyncValues:bT,__await:Kf,__awaiter:fT,__classPrivateFieldGet:_T,__classPrivateFieldSet:ET,__createBinding:hT,__decorate:aT,__exportStar:dT,__extends:sT,__generator:lT,__importDefault:xT,__importStar:wT,__makeTemplateObject:yT,__metadata:uT,__param:cT,__read:T2,__rest:oT,__spread:pT,__spreadArrays:gT,__values:Zg},Symbol.toStringTag,{value:"Module"})));var Qg={},Gf={},R2;function ST(){if(R2)return Gf;R2=1,Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Gf.delay=t,Gf}var Ha={},em={},Wa={},D2;function AT(){return D2||(D2=1,Object.defineProperty(Wa,"__esModule",{value:!0}),Wa.ONE_THOUSAND=Wa.ONE_HUNDRED=void 0,Wa.ONE_HUNDRED=100,Wa.ONE_THOUSAND=1e3),Wa}var tm={},O2;function PT(){return O2||(O2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(tm)),tm}var N2;function L2(){return N2||(N2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(AT(),t),e.__exportStar(PT(),t)}(em)),em}var k2;function MT(){if(k2)return Ha;k2=1,Object.defineProperty(Ha,"__esModule",{value:!0}),Ha.fromMiliseconds=Ha.toMiliseconds=void 0;const t=L2();function e(n){return n*t.ONE_THOUSAND}Ha.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return Ha.fromMiliseconds=r,Ha}var B2;function IT(){return B2||(B2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(ST(),t),e.__exportStar(MT(),t)}(Qg)),Qg}var nu={},$2;function CT(){if($2)return nu;$2=1,Object.defineProperty(nu,"__esModule",{value:!0}),nu.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return nu.Watch=t,nu.default=t,nu}var rm={},Yf={},F2;function TT(){if(F2)return Yf;F2=1,Object.defineProperty(Yf,"__esModule",{value:!0}),Yf.IWatch=void 0;class t{}return Yf.IWatch=t,Yf}var j2;function RT(){return j2||(j2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Vf.__exportStar(TT(),t)}(rm)),rm}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(IT(),t),e.__exportStar(CT(),t),e.__exportStar(RT(),t),e.__exportStar(L2(),t)})(mt);class Ka{}let DT=class extends Ka{constructor(e){super()}};const U2=mt.FIVE_SECONDS,iu={pulse:"heartbeat_pulse"};let OT=class VA extends DT{constructor(e){super(e),this.events=new zi.EventEmitter,this.interval=U2,this.interval=(e==null?void 0:e.interval)||U2}static async init(e){const r=new VA(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),mt.toMiliseconds(this.interval))}pulse(){this.events.emit(iu.pulse)}};const NT=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,LT=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,kT=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function BT(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){$T(t);return}return e}function $T(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Zh(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!kT.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(NT.test(t)||LT.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,BT)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function FT(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Cn(t,...e){try{return FT(t(...e))}catch(r){return Promise.reject(r)}}function jT(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function UT(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Qh(t){if(jT(t))return String(t);if(UT(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Qh(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function q2(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const nm="base64:";function qT(t){if(typeof t=="string")return t;q2();const e=Buffer.from(t).toString("base64");return nm+e}function zT(t){return typeof t!="string"||!t.startsWith(nm)?t:(q2(),Buffer.from(t.slice(nm.length),"base64"))}function pi(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function HT(...t){return pi(t.join(":"))}function ed(t){return t=pi(t),t?t+":":""}function foe(t){return t}const WT="memory",KT=()=>{const t=new Map;return{name:WT,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function VT(t={}){const e={mounts:{"":t.driver||KT()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const d of e.mountpoints)if(l.startsWith(d))return{base:d,relativeKey:l.slice(d.length),driver:e.mounts[d]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,d)=>e.mountpoints.filter(g=>g.startsWith(l)||d&&l.startsWith(g)).map(g=>({relativeBase:l.length>g.length?l.slice(g.length):void 0,mountpoint:g,driver:e.mounts[g]})),i=(l,d)=>{if(e.watching){d=pi(d);for(const g of e.watchListeners)g(l,d)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await z2(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,d,g)=>{const y=new Map,A=P=>{let O=y.get(P.base);return O||(O={driver:P.driver,base:P.base,items:[]},y.set(P.base,O)),O};for(const P of l){const O=typeof P=="string",D=pi(O?P:P.key),k=O?void 0:P.value,B=O||!P.options?d:{...d,...P.options},j=r(D);A(j).items.push({key:D,value:k,relativeKey:j.relativeKey,options:B})}return Promise.all([...y.values()].map(P=>g(P))).then(P=>P.flat())},u={hasItem(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return Cn(y.hasItem,g,d)},getItem(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return Cn(y.getItem,g,d).then(A=>Zh(A))},getItems(l,d){return a(l,d,g=>g.driver.getItems?Cn(g.driver.getItems,g.items.map(y=>({key:y.relativeKey,options:y.options})),d).then(y=>y.map(A=>({key:HT(g.base,A.key),value:Zh(A.value)}))):Promise.all(g.items.map(y=>Cn(g.driver.getItem,y.relativeKey,y.options).then(A=>({key:y.key,value:Zh(A)})))))},getItemRaw(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return y.getItemRaw?Cn(y.getItemRaw,g,d):Cn(y.getItem,g,d).then(A=>zT(A))},async setItem(l,d,g={}){if(d===void 0)return u.removeItem(l);l=pi(l);const{relativeKey:y,driver:A}=r(l);A.setItem&&(await Cn(A.setItem,y,Qh(d),g),A.watch||i("update",l))},async setItems(l,d){await a(l,d,async g=>{if(g.driver.setItems)return Cn(g.driver.setItems,g.items.map(y=>({key:y.relativeKey,value:Qh(y.value),options:y.options})),d);g.driver.setItem&&await Promise.all(g.items.map(y=>Cn(g.driver.setItem,y.relativeKey,Qh(y.value),y.options)))})},async setItemRaw(l,d,g={}){if(d===void 0)return u.removeItem(l,g);l=pi(l);const{relativeKey:y,driver:A}=r(l);if(A.setItemRaw)await Cn(A.setItemRaw,y,d,g);else if(A.setItem)await Cn(A.setItem,y,qT(d),g);else return;A.watch||i("update",l)},async removeItem(l,d={}){typeof d=="boolean"&&(d={removeMeta:d}),l=pi(l);const{relativeKey:g,driver:y}=r(l);y.removeItem&&(await Cn(y.removeItem,g,d),(d.removeMeta||d.removeMata)&&await Cn(y.removeItem,g+"$",d),y.watch||i("remove",l))},async getMeta(l,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),l=pi(l);const{relativeKey:g,driver:y}=r(l),A=Object.create(null);if(y.getMeta&&Object.assign(A,await Cn(y.getMeta,g,d)),!d.nativeOnly){const P=await Cn(y.getItem,g+"$",d).then(O=>Zh(O));P&&typeof P=="object"&&(typeof P.atime=="string"&&(P.atime=new Date(P.atime)),typeof P.mtime=="string"&&(P.mtime=new Date(P.mtime)),Object.assign(A,P))}return A},setMeta(l,d,g={}){return this.setItem(l+"$",d,g)},removeMeta(l,d={}){return this.removeItem(l+"$",d)},async getKeys(l,d={}){l=ed(l);const g=n(l,!0);let y=[];const A=[];for(const P of g){const O=await Cn(P.driver.getKeys,P.relativeBase,d);for(const D of O){const k=P.mountpoint+pi(D);y.some(B=>k.startsWith(B))||A.push(k)}y=[P.mountpoint,...y.filter(D=>!D.startsWith(P.mountpoint))]}return l?A.filter(P=>P.startsWith(l)&&P[P.length-1]!=="$"):A.filter(P=>P[P.length-1]!=="$")},async clear(l,d={}){l=ed(l),await Promise.all(n(l,!1).map(async g=>{if(g.driver.clear)return Cn(g.driver.clear,g.relativeBase,d);if(g.driver.removeItem){const y=await g.driver.getKeys(g.relativeBase||"",d);return Promise.all(y.map(A=>g.driver.removeItem(A,d)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>H2(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(d=>d!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,d){if(l=ed(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((g,y)=>y.length-g.length)),e.mounts[l]=d,e.watching&&Promise.resolve(z2(d,i,l)).then(g=>{e.unwatch[l]=g}).catch(console.error),u},async unmount(l,d=!0){l=ed(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),d&&await H2(e.mounts[l]),e.mountpoints=e.mountpoints.filter(g=>g!==l),delete e.mounts[l])},getMount(l=""){l=pi(l)+":";const d=r(l);return{driver:d.driver,base:d.base}},getMounts(l="",d={}){return l=pi(l),n(l,d.parents).map(y=>({driver:y.driver,base:y.mountpoint}))},keys:(l,d={})=>u.getKeys(l,d),get:(l,d={})=>u.getItem(l,d),set:(l,d,g={})=>u.setItem(l,d,g),has:(l,d={})=>u.hasItem(l,d),del:(l,d={})=>u.removeItem(l,d),remove:(l,d={})=>u.removeItem(l,d)};return u}function z2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function H2(t){typeof t.dispose=="function"&&await Cn(t.dispose)}function Va(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function W2(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Va(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let im;function Jf(){return im||(im=W2("keyval-store","keyval")),im}function K2(t,e=Jf()){return e("readonly",r=>Va(r.get(t)))}function GT(t,e,r=Jf()){return r("readwrite",n=>(n.put(e,t),Va(n.transaction)))}function YT(t,e=Jf()){return e("readwrite",r=>(r.delete(t),Va(r.transaction)))}function JT(t=Jf()){return t("readwrite",e=>(e.clear(),Va(e.transaction)))}function XT(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Va(t.transaction)}function ZT(t=Jf()){return t("readonly",e=>{if(e.getAllKeys)return Va(e.getAllKeys());const r=[];return XT(e,n=>r.push(n.key)).then(()=>r)})}const QT=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),eR=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Ga(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return eR(t)}catch{return t}}function bo(t){return typeof t=="string"?t:QT(t)||""}const tR="idb-keyval";var rR=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=W2(t.dbName,t.storeName)),{name:tR,options:t,async hasItem(i){return!(typeof await K2(r(i),n)>"u")},async getItem(i){return await K2(r(i),n)??null},setItem(i,s){return GT(r(i),s,n)},removeItem(i){return YT(r(i),n)},getKeys(){return ZT(n)},clear(){return JT(n)}}};const nR="WALLET_CONNECT_V2_INDEXED_DB",iR="keyvaluestorage";let sR=class{constructor(){this.indexedDb=VT({driver:rR({dbName:nR,storeName:iR})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,bo(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var sm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},td={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof sm<"u"&&sm.localStorage?td.exports=sm.localStorage:typeof window<"u"&&window.localStorage?td.exports=window.localStorage:td.exports=new e})();function oR(t){var e;return[t[0],Ga((e=t[1])!=null?e:"")]}let aR=class{constructor(){this.localStorage=td.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(oR)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Ga(r)}async setItem(e,r){this.localStorage.setItem(e,bo(r))}async removeItem(e){this.localStorage.removeItem(e)}};const cR="wc_storage_version",V2=1,uR=async(t,e,r)=>{const n=cR,i=await e.getItem(n);if(i&&i>=V2){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,V2),r(e),fR(t,o)},fR=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let lR=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new aR;this.storage=e;try{const r=new sR;uR(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function hR(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var dR=pR;function pR(t,e,r){var n=r&&r.stringify||hR,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?g:0,t.charCodeAt(A+1)){case 100:case 102:if(d>=u||e[d]==null)break;g=u||e[d]==null)break;g=u||e[d]===void 0)break;g",g=A+2,A++;break}l+=n(e[d]),g=A+2,A++;break;case 115:if(d>=u)break;g-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",u=Object.create(r);u.log||(u.log=Zf),Object.defineProperty(u,"levelVal",{get:d}),Object.defineProperty(u,"level",{get:g,set:y});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:xR(t)};u.levels=yo.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Zf,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=A,e&&(u._logEvent=om());function d(){return this.level==="silent"?1/0:this.levels.values[this.level]}function g(){return this._level}function y(P){if(P!=="silent"&&!this.levels.values[P])throw Error("unknown level "+P);this._level=P,ou(l,u,"error","log"),ou(l,u,"fatal","error"),ou(l,u,"warn","error"),ou(l,u,"info","log"),ou(l,u,"debug","log"),ou(l,u,"trace","log")}function A(P,O){if(!P)throw new Error("missing bindings for child Pino");O=O||{},i&&P.serializers&&(O.serializers=P.serializers);const D=O.serializers;if(i&&D){var k=Object.assign({},n,D),B=t.browser.serialize===!0?Object.keys(k):i;delete P.serializers,rd([P],B,k,this._stdErrSerialize)}function j(U){this._childLevel=(U._childLevel|0)+1,this.error=au(U,P,"error"),this.fatal=au(U,P,"fatal"),this.warn=au(U,P,"warn"),this.info=au(U,P,"info"),this.debug=au(U,P,"debug"),this.trace=au(U,P,"trace"),k&&(this.serializers=k,this._serialize=B),e&&(this._logEvent=om([].concat(U._logEvent.bindings,P)))}return j.prototype=this,new j(this)}return u}yo.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},yo.stdSerializers=gR,yo.stdTimeFunctions=Object.assign({},{nullTime:Y2,epochTime:J2,unixTime:_R,isoTime:ER});function ou(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Zf:i[r]?i[r]:Xf[r]||Xf[n]||Zf,vR(t,e,r)}function vR(t,e,r){!t.transmit&&e[r]===Zf||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Xf?Xf:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function au(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},Z2=class{constructor(e,r=cm){this.level=e??"error",this.levelValue=su.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new X2(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===su.levels.values.error?console.error(e):r===su.levels.values.warn?console.warn(e):r===su.levels.values.debug?console.debug(e):r===su.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(bo({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new X2(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(bo({extraMetadata:e})),new Blob(r,{type:"application/json"})}},MR=class{constructor(e,r=cm){this.baseChunkLogger=new Z2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},IR=class{constructor(e,r=cm){this.baseChunkLogger=new Z2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var CR=Object.defineProperty,TR=Object.defineProperties,RR=Object.getOwnPropertyDescriptors,Q2=Object.getOwnPropertySymbols,DR=Object.prototype.hasOwnProperty,OR=Object.prototype.propertyIsEnumerable,ex=(t,e,r)=>e in t?CR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,id=(t,e)=>{for(var r in e||(e={}))DR.call(e,r)&&ex(t,r,e[r]);if(Q2)for(var r of Q2(e))OR.call(e,r)&&ex(t,r,e[r]);return t},sd=(t,e)=>TR(t,RR(e));function od(t){return sd(id({},t),{level:(t==null?void 0:t.level)||AR.level})}function NR(t,e=el){return t[e]||""}function LR(t,e,r=el){return t[r]=e,t}function gi(t,e=el){let r="";return typeof t.bindings>"u"?r=NR(t,e):r=t.bindings().context||"",r}function kR(t,e,r=el){const n=gi(t,r);return n.trim()?`${n}/${e}`:e}function ri(t,e,r=el){const n=kR(t,e,r),i=t.child({context:n});return LR(i,n,r)}function BR(t){var e,r;const n=new MR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace",browser:sd(id({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function $R(t){var e;const r=new IR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function FR(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?BR(t):$R(t)}let jR=class extends Ka{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},UR=class extends Ka{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},qR=class{constructor(e,r){this.logger=e,this.core=r}},zR=class extends Ka{constructor(e,r){super(),this.relayer=e,this.logger=r}},HR=class extends Ka{constructor(e){super()}},WR=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},KR=class extends Ka{constructor(e,r){super(),this.relayer=e,this.logger=r}},VR=class extends Ka{constructor(e,r){super(),this.core=e,this.logger=r}},GR=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},YR=class{constructor(e,r){this.projectId=e,this.logger=r}},JR=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},XR=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},ZR=class{constructor(e){this.client=e}};var um={},na={},ad={},cd={};Object.defineProperty(cd,"__esModule",{value:!0}),cd.BrowserRandomSource=void 0;const tx=65536;class QR{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let n=0;n>>16&65535,d=a&65535,g=u>>>16&65535,y=u&65535;return d*y+(l*y+d*g<<16>>>0)|0}t.mul=Math.imul||e;function r(a,u){return a+u|0}t.add=r;function n(a,u){return a-u|0}t.sub=n;function i(a,u){return a<>>32-u}t.rotl=i;function s(a,u){return a<<32-u|a>>>u}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(nx),Object.defineProperty(or,"__esModule",{value:!0});var ix=nx;function oD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}or.readInt16BE=oD;function aD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}or.readUint16BE=aD;function cD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}or.readInt16LE=cD;function uD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}or.readUint16LE=uD;function sx(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}or.writeUint16BE=sx,or.writeInt16BE=sx;function ox(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}or.writeUint16LE=ox,or.writeInt16LE=ox;function fm(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}or.readInt32BE=fm;function lm(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}or.readUint32BE=lm;function hm(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}or.readInt32LE=hm;function dm(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}or.readUint32LE=dm;function fd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}or.writeUint32BE=fd,or.writeInt32BE=fd;function ld(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}or.writeUint32LE=ld,or.writeInt32LE=ld;function fD(t,e){e===void 0&&(e=0);var r=fm(t,e),n=fm(t,e+4);return r*4294967296+n-(n>>31)*4294967296}or.readInt64BE=fD;function lD(t,e){e===void 0&&(e=0);var r=lm(t,e),n=lm(t,e+4);return r*4294967296+n}or.readUint64BE=lD;function hD(t,e){e===void 0&&(e=0);var r=hm(t,e),n=hm(t,e+4);return n*4294967296+r-(r>>31)*4294967296}or.readInt64LE=hD;function dD(t,e){e===void 0&&(e=0);var r=dm(t,e),n=dm(t,e+4);return n*4294967296+r}or.readUint64LE=dD;function ax(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fd(t/4294967296>>>0,e,r),fd(t>>>0,e,r+4),e}or.writeUint64BE=ax,or.writeInt64BE=ax;function cx(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ld(t>>>0,e,r),ld(t/4294967296>>>0,e,r+4),e}or.writeUint64LE=cx,or.writeInt64LE=cx;function pD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}or.readUintBE=pD;function gD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}or.writeUintBE=mD;function vD(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!ix.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s256)throw new Error("randomString charset is too long");let y="";const A=d.length,P=256-256%A;for(;l>0;){const O=i(Math.ceil(l*256/P),g);for(let D=0;D0;D++){const k=O[D];k0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,g=l/536870912|0,y=l<<3,A=l%128<112?128:256;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._stateHi.set(u.stateHi),this._stateLo.set(u.stateLo),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.stateHi),r.wipe(u.stateLo),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,u,l,d,g,y,A){for(var P=l[0],O=l[1],D=l[2],k=l[3],B=l[4],j=l[5],U=l[6],K=l[7],J=d[0],T=d[1],z=d[2],ue=d[3],_e=d[4],G=d[5],E=d[6],m=d[7],f,p,v,x,_,S,b,M;A>=128;){for(var I=0;I<16;I++){var F=8*I+y;a[I]=e.readUint32BE(g,F),u[I]=e.readUint32BE(g,F+4)}for(var I=0;I<80;I++){var ae=P,N=O,se=D,ee=k,X=B,Q=j,R=U,Z=K,te=J,he=T,ie=z,fe=ue,ve=_e,Me=G,Ne=E,Te=m;if(f=K,p=m,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=(B>>>14|_e<<18)^(B>>>18|_e<<14)^(_e>>>9|B<<23),p=(_e>>>14|B<<18)^(_e>>>18|B<<14)^(B>>>9|_e<<23),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=B&j^~B&U,p=_e&G^~_e&E,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=i[I*2],p=i[I*2+1],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=a[I%16],p=u[I%16],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,v=b&65535|M<<16,x=_&65535|S<<16,f=v,p=x,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=(P>>>28|J<<4)^(J>>>2|P<<30)^(J>>>7|P<<25),p=(J>>>28|P<<4)^(P>>>2|J<<30)^(P>>>7|J<<25),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=P&O^P&D^O&D,p=J&T^J&z^T&z,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,Z=b&65535|M<<16,Te=_&65535|S<<16,f=ee,p=fe,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=v,p=x,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,ee=b&65535|M<<16,fe=_&65535|S<<16,O=ae,D=N,k=se,B=ee,j=X,U=Q,K=R,P=Z,T=te,z=he,ue=ie,_e=fe,G=ve,E=Me,m=Ne,J=Te,I%16===15)for(var F=0;F<16;F++)f=a[F],p=u[F],_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=a[(F+9)%16],p=u[(F+9)%16],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,v=a[(F+1)%16],x=u[(F+1)%16],f=(v>>>1|x<<31)^(v>>>8|x<<24)^v>>>7,p=(x>>>1|v<<31)^(x>>>8|v<<24)^(x>>>7|v<<25),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,v=a[(F+14)%16],x=u[(F+14)%16],f=(v>>>19|x<<13)^(x>>>29|v<<3)^v>>>6,p=(x>>>19|v<<13)^(v>>>29|x<<3)^(x>>>6|v<<26),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,a[F]=b&65535|M<<16,u[F]=_&65535|S<<16}f=P,p=J,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[0],p=d[0],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[0]=P=b&65535|M<<16,d[0]=J=_&65535|S<<16,f=O,p=T,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[1],p=d[1],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[1]=O=b&65535|M<<16,d[1]=T=_&65535|S<<16,f=D,p=z,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[2],p=d[2],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[2]=D=b&65535|M<<16,d[2]=z=_&65535|S<<16,f=k,p=ue,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[3],p=d[3],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[3]=k=b&65535|M<<16,d[3]=ue=_&65535|S<<16,f=B,p=_e,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[4],p=d[4],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[4]=B=b&65535|M<<16,d[4]=_e=_&65535|S<<16,f=j,p=G,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[5],p=d[5],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[5]=j=b&65535|M<<16,d[5]=G=_&65535|S<<16,f=U,p=E,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[6],p=d[6],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[6]=U=b&65535|M<<16,d[6]=E=_&65535|S<<16,f=K,p=m,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[7],p=d[7],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[7]=K=b&65535|M<<16,d[7]=m=_&65535|S<<16,y+=128,A-=128}return y}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ux),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=na,r=ux,n=Mi;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(ee){const X=new Float64Array(16);if(ee)for(let Q=0;Q>16&1),Q[he-1]&=65535;Q[15]=R[15]-32767-(Q[14]>>16&1);const te=Q[15]>>16&1;Q[14]&=65535,O(R,Q,1-te)}for(let Z=0;Z<16;Z++)ee[2*Z]=R[Z]&255,ee[2*Z+1]=R[Z]>>8}function k(ee,X){let Q=0;for(let R=0;R<32;R++)Q|=ee[R]^X[R];return(1&Q-1>>>8)-1}function B(ee,X){const Q=new Uint8Array(32),R=new Uint8Array(32);return D(Q,ee),D(R,X),k(Q,R)}function j(ee){const X=new Uint8Array(32);return D(X,ee),X[0]&1}function U(ee,X){for(let Q=0;Q<16;Q++)ee[Q]=X[2*Q]+(X[2*Q+1]<<8);ee[15]&=32767}function K(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]+Q[R]}function J(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]-Q[R]}function T(ee,X,Q){let R,Z,te=0,he=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=0,Ie=0,Le=0,Ve=0,ke=0,ze=0,He=0,Ee=0,Qe=0,ct=0,Be=0,et=0,rt=0,Je=0,pt=0,ht=0,ft=0,Ht=0,Jt=0,St=0,er=0,Xt=0,Ot=0,Bt=Q[0],Tt=Q[1],vt=Q[2],Dt=Q[3],Lt=Q[4],bt=Q[5],$t=Q[6],jt=Q[7],nt=Q[8],Ft=Q[9],$=Q[10],H=Q[11],V=Q[12],C=Q[13],Y=Q[14],q=Q[15];R=X[0],te+=R*Bt,he+=R*Tt,ie+=R*vt,fe+=R*Dt,ve+=R*Lt,Me+=R*bt,Ne+=R*$t,Te+=R*jt,$e+=R*nt,Ie+=R*Ft,Le+=R*$,Ve+=R*H,ke+=R*V,ze+=R*C,He+=R*Y,Ee+=R*q,R=X[1],he+=R*Bt,ie+=R*Tt,fe+=R*vt,ve+=R*Dt,Me+=R*Lt,Ne+=R*bt,Te+=R*$t,$e+=R*jt,Ie+=R*nt,Le+=R*Ft,Ve+=R*$,ke+=R*H,ze+=R*V,He+=R*C,Ee+=R*Y,Qe+=R*q,R=X[2],ie+=R*Bt,fe+=R*Tt,ve+=R*vt,Me+=R*Dt,Ne+=R*Lt,Te+=R*bt,$e+=R*$t,Ie+=R*jt,Le+=R*nt,Ve+=R*Ft,ke+=R*$,ze+=R*H,He+=R*V,Ee+=R*C,Qe+=R*Y,ct+=R*q,R=X[3],fe+=R*Bt,ve+=R*Tt,Me+=R*vt,Ne+=R*Dt,Te+=R*Lt,$e+=R*bt,Ie+=R*$t,Le+=R*jt,Ve+=R*nt,ke+=R*Ft,ze+=R*$,He+=R*H,Ee+=R*V,Qe+=R*C,ct+=R*Y,Be+=R*q,R=X[4],ve+=R*Bt,Me+=R*Tt,Ne+=R*vt,Te+=R*Dt,$e+=R*Lt,Ie+=R*bt,Le+=R*$t,Ve+=R*jt,ke+=R*nt,ze+=R*Ft,He+=R*$,Ee+=R*H,Qe+=R*V,ct+=R*C,Be+=R*Y,et+=R*q,R=X[5],Me+=R*Bt,Ne+=R*Tt,Te+=R*vt,$e+=R*Dt,Ie+=R*Lt,Le+=R*bt,Ve+=R*$t,ke+=R*jt,ze+=R*nt,He+=R*Ft,Ee+=R*$,Qe+=R*H,ct+=R*V,Be+=R*C,et+=R*Y,rt+=R*q,R=X[6],Ne+=R*Bt,Te+=R*Tt,$e+=R*vt,Ie+=R*Dt,Le+=R*Lt,Ve+=R*bt,ke+=R*$t,ze+=R*jt,He+=R*nt,Ee+=R*Ft,Qe+=R*$,ct+=R*H,Be+=R*V,et+=R*C,rt+=R*Y,Je+=R*q,R=X[7],Te+=R*Bt,$e+=R*Tt,Ie+=R*vt,Le+=R*Dt,Ve+=R*Lt,ke+=R*bt,ze+=R*$t,He+=R*jt,Ee+=R*nt,Qe+=R*Ft,ct+=R*$,Be+=R*H,et+=R*V,rt+=R*C,Je+=R*Y,pt+=R*q,R=X[8],$e+=R*Bt,Ie+=R*Tt,Le+=R*vt,Ve+=R*Dt,ke+=R*Lt,ze+=R*bt,He+=R*$t,Ee+=R*jt,Qe+=R*nt,ct+=R*Ft,Be+=R*$,et+=R*H,rt+=R*V,Je+=R*C,pt+=R*Y,ht+=R*q,R=X[9],Ie+=R*Bt,Le+=R*Tt,Ve+=R*vt,ke+=R*Dt,ze+=R*Lt,He+=R*bt,Ee+=R*$t,Qe+=R*jt,ct+=R*nt,Be+=R*Ft,et+=R*$,rt+=R*H,Je+=R*V,pt+=R*C,ht+=R*Y,ft+=R*q,R=X[10],Le+=R*Bt,Ve+=R*Tt,ke+=R*vt,ze+=R*Dt,He+=R*Lt,Ee+=R*bt,Qe+=R*$t,ct+=R*jt,Be+=R*nt,et+=R*Ft,rt+=R*$,Je+=R*H,pt+=R*V,ht+=R*C,ft+=R*Y,Ht+=R*q,R=X[11],Ve+=R*Bt,ke+=R*Tt,ze+=R*vt,He+=R*Dt,Ee+=R*Lt,Qe+=R*bt,ct+=R*$t,Be+=R*jt,et+=R*nt,rt+=R*Ft,Je+=R*$,pt+=R*H,ht+=R*V,ft+=R*C,Ht+=R*Y,Jt+=R*q,R=X[12],ke+=R*Bt,ze+=R*Tt,He+=R*vt,Ee+=R*Dt,Qe+=R*Lt,ct+=R*bt,Be+=R*$t,et+=R*jt,rt+=R*nt,Je+=R*Ft,pt+=R*$,ht+=R*H,ft+=R*V,Ht+=R*C,Jt+=R*Y,St+=R*q,R=X[13],ze+=R*Bt,He+=R*Tt,Ee+=R*vt,Qe+=R*Dt,ct+=R*Lt,Be+=R*bt,et+=R*$t,rt+=R*jt,Je+=R*nt,pt+=R*Ft,ht+=R*$,ft+=R*H,Ht+=R*V,Jt+=R*C,St+=R*Y,er+=R*q,R=X[14],He+=R*Bt,Ee+=R*Tt,Qe+=R*vt,ct+=R*Dt,Be+=R*Lt,et+=R*bt,rt+=R*$t,Je+=R*jt,pt+=R*nt,ht+=R*Ft,ft+=R*$,Ht+=R*H,Jt+=R*V,St+=R*C,er+=R*Y,Xt+=R*q,R=X[15],Ee+=R*Bt,Qe+=R*Tt,ct+=R*vt,Be+=R*Dt,et+=R*Lt,rt+=R*bt,Je+=R*$t,pt+=R*jt,ht+=R*nt,ft+=R*Ft,Ht+=R*$,Jt+=R*H,St+=R*V,er+=R*C,Xt+=R*Y,Ot+=R*q,te+=38*Qe,he+=38*ct,ie+=38*Be,fe+=38*et,ve+=38*rt,Me+=38*Je,Ne+=38*pt,Te+=38*ht,$e+=38*ft,Ie+=38*Ht,Le+=38*Jt,Ve+=38*St,ke+=38*er,ze+=38*Xt,He+=38*Ot,Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=he+Z+65535,Z=Math.floor(R/65536),he=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=he+Z+65535,Z=Math.floor(R/65536),he=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),ee[0]=te,ee[1]=he,ee[2]=ie,ee[3]=fe,ee[4]=ve,ee[5]=Me,ee[6]=Ne,ee[7]=Te,ee[8]=$e,ee[9]=Ie,ee[10]=Le,ee[11]=Ve,ee[12]=ke,ee[13]=ze,ee[14]=He,ee[15]=Ee}function z(ee,X){T(ee,X,X)}function ue(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=253;R>=0;R--)z(Q,Q),R!==2&&R!==4&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function _e(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=250;R>=0;R--)z(Q,Q),R!==1&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function G(ee,X){const Q=i(),R=i(),Z=i(),te=i(),he=i(),ie=i(),fe=i(),ve=i(),Me=i();J(Q,ee[1],ee[0]),J(Me,X[1],X[0]),T(Q,Q,Me),K(R,ee[0],ee[1]),K(Me,X[0],X[1]),T(R,R,Me),T(Z,ee[3],X[3]),T(Z,Z,l),T(te,ee[2],X[2]),K(te,te,te),J(he,R,Q),J(ie,te,Z),K(fe,te,Z),K(ve,R,Q),T(ee[0],he,ie),T(ee[1],ve,fe),T(ee[2],fe,ie),T(ee[3],he,ve)}function E(ee,X,Q){for(let R=0;R<4;R++)O(ee[R],X[R],Q)}function m(ee,X){const Q=i(),R=i(),Z=i();ue(Z,X[2]),T(Q,X[0],Z),T(R,X[1],Z),D(ee,R),ee[31]^=j(Q)<<7}function f(ee,X,Q){A(ee[0],o),A(ee[1],a),A(ee[2],a),A(ee[3],o);for(let R=255;R>=0;--R){const Z=Q[R/8|0]>>(R&7)&1;E(ee,X,Z),G(X,ee),G(ee,ee),E(ee,X,Z)}}function p(ee,X){const Q=[i(),i(),i(),i()];A(Q[0],d),A(Q[1],g),A(Q[2],a),T(Q[3],d,g),f(ee,Q,X)}function v(ee){if(ee.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const X=(0,r.hash)(ee);X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(32),R=[i(),i(),i(),i()];p(R,X),m(Q,R);const Z=new Uint8Array(64);return Z.set(ee),Z.set(Q,32),{publicKey:Q,secretKey:Z}}t.generateKeyPairFromSeed=v;function x(ee){const X=(0,e.randomBytes)(32,ee),Q=v(X);return(0,n.wipe)(X),Q}t.generateKeyPair=x;function _(ee){if(ee.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(ee.subarray(32))}t.extractPublicKeyFromSecretKey=_;const S=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function b(ee,X){let Q,R,Z,te;for(R=63;R>=32;--R){for(Q=0,Z=R-32,te=R-12;Z>4)*S[Z],Q=X[Z]>>8,X[Z]&=255;for(Z=0;Z<32;Z++)X[Z]-=Q*S[Z];for(R=0;R<32;R++)X[R+1]+=X[R]>>8,ee[R]=X[R]&255}function M(ee){const X=new Float64Array(64);for(let Q=0;Q<64;Q++)X[Q]=ee[Q];for(let Q=0;Q<64;Q++)ee[Q]=0;b(ee,X)}function I(ee,X){const Q=new Float64Array(64),R=[i(),i(),i(),i()],Z=(0,r.hash)(ee.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(64);te.set(Z.subarray(32),32);const he=new r.SHA512;he.update(te.subarray(32)),he.update(X);const ie=he.digest();he.clean(),M(ie),p(R,ie),m(te,R),he.reset(),he.update(te.subarray(0,32)),he.update(ee.subarray(32)),he.update(X);const fe=he.digest();M(fe);for(let ve=0;ve<32;ve++)Q[ve]=ie[ve];for(let ve=0;ve<32;ve++)for(let Me=0;Me<32;Me++)Q[ve+Me]+=fe[ve]*Z[Me];return b(te.subarray(32),Q),te}t.sign=I;function F(ee,X){const Q=i(),R=i(),Z=i(),te=i(),he=i(),ie=i(),fe=i();return A(ee[2],a),U(ee[1],X),z(Z,ee[1]),T(te,Z,u),J(Z,Z,ee[2]),K(te,ee[2],te),z(he,te),z(ie,he),T(fe,ie,he),T(Q,fe,Z),T(Q,Q,te),_e(Q,Q),T(Q,Q,Z),T(Q,Q,te),T(Q,Q,te),T(ee[0],Q,te),z(R,ee[0]),T(R,R,te),B(R,Z)&&T(ee[0],ee[0],y),z(R,ee[0]),T(R,R,te),B(R,Z)?-1:(j(ee[0])===X[31]>>7&&J(ee[0],o,ee[0]),T(ee[3],ee[0],ee[1]),0)}function ae(ee,X,Q){const R=new Uint8Array(32),Z=[i(),i(),i(),i()],te=[i(),i(),i(),i()];if(Q.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(F(te,ee))return!1;const he=new r.SHA512;he.update(Q.subarray(0,32)),he.update(ee),he.update(X);const ie=he.digest();return M(ie),f(Z,te,ie),p(te,Q.subarray(32)),G(Z,te),m(R,Z),!k(Q,R)}t.verify=ae;function N(ee){let X=[i(),i(),i(),i()];if(F(X,ee))throw new Error("Ed25519: invalid public key");let Q=i(),R=i(),Z=X[1];K(Q,a,Z),J(R,a,Z),ue(R,R),T(Q,Q,R);let te=new Uint8Array(32);return D(te,Q),te}t.convertPublicKeyToX25519=N;function se(ee){const X=(0,r.hash)(ee.subarray(0,32));X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(X.subarray(0,32));return(0,n.wipe)(X),Q}t.convertSecretKeyToX25519=se}(um);const PD="EdDSA",MD="JWT",hd=".",dd="base64url",fx="utf8",lx="utf8",ID=":",CD="did",TD="key",hx="base58btc",RD="z",DD="K36",OD=32;function dx(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function pd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=dx(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function ND(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(j);k!==B;){for(var K=P[k],J=0,T=j-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=j-D;z!==j&&U[z]===0;)z++;for(var ue=u.repeat(O);z>>0,j=new Uint8Array(B);P[O];){var U=r[P.charCodeAt(O)];if(U===255)return;for(var K=0,J=B-1;(U!==0||K>>0,j[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,O++}if(P[O]!==" "){for(var T=B-k;T!==B&&j[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=j[T++];return z}}}function A(P){var O=y(P);if(O)return O;throw new Error(`Non-${e} character`)}return{encode:g,decodeUnsafe:y,decode:A}}var LD=ND,kD=LD;const BD=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},$D=t=>new TextEncoder().encode(t),FD=t=>new TextDecoder().decode(t);class jD{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class UD{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return px(this,e)}}class qD{constructor(e){this.decoders=e}or(e){return px(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const px=(t,e)=>new qD({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class zD{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new jD(e,r,n),this.decoder=new UD(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const gd=({name:t,prefix:e,encode:r,decode:n})=>new zD(t,e,r,n),rl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=kD(r,e);return gd({prefix:t,name:e,encode:n,decode:s=>BD(i(s))})},HD=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},WD=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<gd({prefix:e,name:t,encode(i){return WD(i,n,r)},decode(i){return HD(i,n,r,t)}}),KD=gd({prefix:"\0",name:"identity",encode:t=>FD(t),decode:t=>$D(t)}),VD=Object.freeze(Object.defineProperty({__proto__:null,identity:KD},Symbol.toStringTag,{value:"Module"})),GD=jn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),YD=Object.freeze(Object.defineProperty({__proto__:null,base2:GD},Symbol.toStringTag,{value:"Module"})),JD=jn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),XD=Object.freeze(Object.defineProperty({__proto__:null,base8:JD},Symbol.toStringTag,{value:"Module"})),ZD=rl({prefix:"9",name:"base10",alphabet:"0123456789"}),QD=Object.freeze(Object.defineProperty({__proto__:null,base10:ZD},Symbol.toStringTag,{value:"Module"})),eO=jn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),tO=jn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),rO=Object.freeze(Object.defineProperty({__proto__:null,base16:eO,base16upper:tO},Symbol.toStringTag,{value:"Module"})),nO=jn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),iO=jn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),sO=jn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),oO=jn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),aO=jn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),cO=jn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),uO=jn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),fO=jn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),lO=jn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),hO=Object.freeze(Object.defineProperty({__proto__:null,base32:nO,base32hex:aO,base32hexpad:uO,base32hexpadupper:fO,base32hexupper:cO,base32pad:sO,base32padupper:oO,base32upper:iO,base32z:lO},Symbol.toStringTag,{value:"Module"})),dO=rl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),pO=rl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),gO=Object.freeze(Object.defineProperty({__proto__:null,base36:dO,base36upper:pO},Symbol.toStringTag,{value:"Module"})),mO=rl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),vO=rl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),bO=Object.freeze(Object.defineProperty({__proto__:null,base58btc:mO,base58flickr:vO},Symbol.toStringTag,{value:"Module"})),yO=jn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),wO=jn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),xO=jn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),_O=jn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),EO=Object.freeze(Object.defineProperty({__proto__:null,base64:yO,base64pad:wO,base64url:xO,base64urlpad:_O},Symbol.toStringTag,{value:"Module"})),gx=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),SO=gx.reduce((t,e,r)=>(t[r]=e,t),[]),AO=gx.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function PO(t){return t.reduce((e,r)=>(e+=SO[r],e),"")}function MO(t){const e=[];for(const r of t){const n=AO[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const IO=gd({prefix:"🚀",name:"base256emoji",encode:PO,decode:MO}),CO=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:IO},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const mx={...VD,...YD,...XD,...QD,...rO,...hO,...gO,...bO,...EO,...CO};function vx(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const bx=vx("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),pm=vx("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=dx(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new FO:typeof navigator<"u"?WO(navigator.userAgent):VO()}function HO(t){return t!==""&&qO.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function WO(t){var e=HO(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new $O;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length-1){const D=P.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let k=e.protocol+"//"+e.host;if(D.indexOf("/")===0)k+=D;else{const B=e.pathname.split("/");B.pop();const j=B.join("/");k+=j+"/"+D}y.push(k)}else if(D.indexOf("//")===0){const k=e.protocol+D;y.push(k)}else y.push(D)}}return y}function n(...g){const y=t.getElementsByTagName("meta");for(let A=0;AP.getAttribute(D)).filter(D=>D?g.includes(D):!1);if(O.length&&O){const D=P.getAttribute("content");if(D)return D}}return""}function i(){let g=n("name","og:site_name","og:title","twitter:title");return g||(g=t.title),g}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}Mx=vm.getWindowMetadata=sN;var il={},oN=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Cx="%[a-f0-9]{2}",Tx=new RegExp("("+Cx+")|([^%]+?)","gi"),Rx=new RegExp("("+Cx+")+","gi");function bm(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],bm(r),bm(n))}function aN(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(Tx)||[],r=1;r{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},lN=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;sB==null,o=Symbol("encodeFragmentIdentifier");function a(B){switch(B.arrayFormat){case"index":return j=>(U,K)=>{const J=U.length;return K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),"[",J,"]"].join("")]:[...U,[d(j,B),"[",d(J,B),"]=",d(K,B)].join("")]};case"bracket":return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),"[]"].join("")]:[...U,[d(j,B),"[]=",d(K,B)].join("")];case"colon-list-separator":return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),":list="].join("")]:[...U,[d(j,B),":list=",d(K,B)].join("")];case"comma":case"separator":case"bracket-separator":{const j=B.arrayFormat==="bracket-separator"?"[]=":"=";return U=>(K,J)=>J===void 0||B.skipNull&&J===null||B.skipEmptyString&&J===""?K:(J=J===null?"":J,K.length===0?[[d(U,B),j,d(J,B)].join("")]:[[K,d(J,B)].join(B.arrayFormatSeparator)])}default:return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,d(j,B)]:[...U,[d(j,B),"=",d(K,B)].join("")]}}function u(B){let j;switch(B.arrayFormat){case"index":return(U,K,J)=>{if(j=/\[(\d*)\]$/.exec(U),U=U.replace(/\[\d*\]$/,""),!j){J[U]=K;return}J[U]===void 0&&(J[U]={}),J[U][j[1]]=K};case"bracket":return(U,K,J)=>{if(j=/(\[\])$/.exec(U),U=U.replace(/\[\]$/,""),!j){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"colon-list-separator":return(U,K,J)=>{if(j=/(:list)$/.exec(U),U=U.replace(/:list$/,""),!j){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"comma":case"separator":return(U,K,J)=>{const T=typeof K=="string"&&K.includes(B.arrayFormatSeparator),z=typeof K=="string"&&!T&&g(K,B).includes(B.arrayFormatSeparator);K=z?g(K,B):K;const ue=T||z?K.split(B.arrayFormatSeparator).map(_e=>g(_e,B)):K===null?K:g(K,B);J[U]=ue};case"bracket-separator":return(U,K,J)=>{const T=/(\[\])$/.test(U);if(U=U.replace(/\[\]$/,""),!T){J[U]=K&&g(K,B);return}const z=K===null?[]:K.split(B.arrayFormatSeparator).map(ue=>g(ue,B));if(J[U]===void 0){J[U]=z;return}J[U]=[].concat(J[U],z)};default:return(U,K,J)=>{if(J[U]===void 0){J[U]=K;return}J[U]=[].concat(J[U],K)}}}function l(B){if(typeof B!="string"||B.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function d(B,j){return j.encode?j.strict?e(B):encodeURIComponent(B):B}function g(B,j){return j.decode?r(B):B}function y(B){return Array.isArray(B)?B.sort():typeof B=="object"?y(Object.keys(B)).sort((j,U)=>Number(j)-Number(U)).map(j=>B[j]):B}function A(B){const j=B.indexOf("#");return j!==-1&&(B=B.slice(0,j)),B}function P(B){let j="";const U=B.indexOf("#");return U!==-1&&(j=B.slice(U)),j}function O(B){B=A(B);const j=B.indexOf("?");return j===-1?"":B.slice(j+1)}function D(B,j){return j.parseNumbers&&!Number.isNaN(Number(B))&&typeof B=="string"&&B.trim()!==""?B=Number(B):j.parseBooleans&&B!==null&&(B.toLowerCase()==="true"||B.toLowerCase()==="false")&&(B=B.toLowerCase()==="true"),B}function k(B,j){j=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},j),l(j.arrayFormatSeparator);const U=u(j),K=Object.create(null);if(typeof B!="string"||(B=B.trim().replace(/^[?#&]/,""),!B))return K;for(const J of B.split("&")){if(J==="")continue;let[T,z]=n(j.decode?J.replace(/\+/g," "):J,"=");z=z===void 0?null:["comma","separator","bracket-separator"].includes(j.arrayFormat)?z:g(z,j),U(g(T,j),z,K)}for(const J of Object.keys(K)){const T=K[J];if(typeof T=="object"&&T!==null)for(const z of Object.keys(T))T[z]=D(T[z],j);else K[J]=D(T,j)}return j.sort===!1?K:(j.sort===!0?Object.keys(K).sort():Object.keys(K).sort(j.sort)).reduce((J,T)=>{const z=K[T];return z&&typeof z=="object"&&!Array.isArray(z)?J[T]=y(z):J[T]=z,J},Object.create(null))}t.extract=O,t.parse=k,t.stringify=(B,j)=>{if(!B)return"";j=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},j),l(j.arrayFormatSeparator);const U=z=>j.skipNull&&s(B[z])||j.skipEmptyString&&B[z]==="",K=a(j),J={};for(const z of Object.keys(B))U(z)||(J[z]=B[z]);const T=Object.keys(J);return j.sort!==!1&&T.sort(j.sort),T.map(z=>{const ue=B[z];return ue===void 0?"":ue===null?d(z,j):Array.isArray(ue)?ue.length===0&&j.arrayFormat==="bracket-separator"?d(z,j)+"[]":ue.reduce(K(z),[]).join("&"):d(z,j)+"="+d(ue,j)}).filter(z=>z.length>0).join("&")},t.parseUrl=(B,j)=>{j=Object.assign({decode:!0},j);const[U,K]=n(B,"#");return Object.assign({url:U.split("?")[0]||"",query:k(O(B),j)},j&&j.parseFragmentIdentifier&&K?{fragmentIdentifier:g(K,j)}:{})},t.stringifyUrl=(B,j)=>{j=Object.assign({encode:!0,strict:!0,[o]:!0},j);const U=A(B.url).split("?")[0]||"",K=t.extract(B.url),J=t.parse(K,{sort:!1}),T=Object.assign(J,B.query);let z=t.stringify(T,j);z&&(z=`?${z}`);let ue=P(B.url);return B.fragmentIdentifier&&(ue=`#${j[o]?d(B.fragmentIdentifier,j):B.fragmentIdentifier}`),`${U}${z}${ue}`},t.pick=(B,j,U)=>{U=Object.assign({parseFragmentIdentifier:!0,[o]:!1},U);const{url:K,query:J,fragmentIdentifier:T}=t.parseUrl(B,U);return t.stringifyUrl({url:K,query:i(J,j),fragmentIdentifier:T},U)},t.exclude=(B,j,U)=>{const K=Array.isArray(j)?J=>!j.includes(J):(J,T)=>!j(J,T);return t.pick(B,K,U)}})(il);var Dx={exports:{}};/** + ***************************************************************************** */var Jg=function(t,e){return Jg=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Jg(t,e)};function oT(t,e){Jg(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Xg=function(){return Xg=Object.assign||function(e){for(var r,n=1,i=arguments.length;n=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function uT(t,e){return function(r,n){e(r,n,t)}}function fT(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function lT(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(d){try{l(n.next(d))}catch(g){o(g)}}function u(d){try{l(n.throw(d))}catch(g){o(g)}}function l(d){d.done?s(d.value):i(d.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function hT(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return u([l,d])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function I2(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function gT(){for(var t=[],e=0;e1||a(y,A)})})}function a(y,A){try{u(n[y](A))}catch(P){g(s[0][3],P)}}function u(y){y.value instanceof Kf?Promise.resolve(y.value.v).then(l,d):g(s[0][2],y)}function l(y){a("next",y)}function d(y){a("throw",y)}function g(y,A){y(A),s.shift(),s.length&&a(s[0][0],s[0][1])}}function bT(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Kf(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function yT(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Zg=="function"?Zg(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function wT(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function xT(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function _T(t){return t&&t.__esModule?t:{default:t}}function ET(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function ST(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const Vf=Jp(Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Xg},__asyncDelegator:bT,__asyncGenerator:vT,__asyncValues:yT,__await:Kf,__awaiter:lT,__classPrivateFieldGet:ET,__classPrivateFieldSet:ST,__createBinding:dT,__decorate:cT,__exportStar:pT,__extends:oT,__generator:hT,__importDefault:_T,__importStar:xT,__makeTemplateObject:wT,__metadata:fT,__param:uT,__read:I2,__rest:aT,__spread:gT,__spreadArrays:mT,__values:Zg},Symbol.toStringTag,{value:"Module"})));var Qg={},Gf={},C2;function AT(){if(C2)return Gf;C2=1,Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Gf.delay=t,Gf}var qa={},em={},za={},T2;function PT(){return T2||(T2=1,Object.defineProperty(za,"__esModule",{value:!0}),za.ONE_THOUSAND=za.ONE_HUNDRED=void 0,za.ONE_HUNDRED=100,za.ONE_THOUSAND=1e3),za}var tm={},R2;function MT(){return R2||(R2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(tm)),tm}var D2;function O2(){return D2||(D2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(PT(),t),e.__exportStar(MT(),t)}(em)),em}var N2;function IT(){if(N2)return qa;N2=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.fromMiliseconds=qa.toMiliseconds=void 0;const t=O2();function e(n){return n*t.ONE_THOUSAND}qa.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return qa.fromMiliseconds=r,qa}var L2;function CT(){return L2||(L2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(AT(),t),e.__exportStar(IT(),t)}(Qg)),Qg}var nu={},k2;function TT(){if(k2)return nu;k2=1,Object.defineProperty(nu,"__esModule",{value:!0}),nu.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return nu.Watch=t,nu.default=t,nu}var rm={},Yf={},B2;function RT(){if(B2)return Yf;B2=1,Object.defineProperty(Yf,"__esModule",{value:!0}),Yf.IWatch=void 0;class t{}return Yf.IWatch=t,Yf}var $2;function DT(){return $2||($2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Vf.__exportStar(RT(),t)}(rm)),rm}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(CT(),t),e.__exportStar(TT(),t),e.__exportStar(DT(),t),e.__exportStar(O2(),t)})(mt);class Ha{}let OT=class extends Ha{constructor(e){super()}};const F2=mt.FIVE_SECONDS,iu={pulse:"heartbeat_pulse"};let NT=class GA extends OT{constructor(e){super(e),this.events=new qi.EventEmitter,this.interval=F2,this.interval=(e==null?void 0:e.interval)||F2}static async init(e){const r=new GA(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),mt.toMiliseconds(this.interval))}pulse(){this.events.emit(iu.pulse)}};const LT=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,kT=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,BT=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function $T(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){FT(t);return}return e}function FT(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Zh(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!BT.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(LT.test(t)||kT.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,$T)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function jT(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Cn(t,...e){try{return jT(t(...e))}catch(r){return Promise.reject(r)}}function UT(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function qT(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Qh(t){if(UT(t))return String(t);if(qT(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Qh(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function j2(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const nm="base64:";function zT(t){if(typeof t=="string")return t;j2();const e=Buffer.from(t).toString("base64");return nm+e}function HT(t){return typeof t!="string"||!t.startsWith(nm)?t:(j2(),Buffer.from(t.slice(nm.length),"base64"))}function pi(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function WT(...t){return pi(t.join(":"))}function ed(t){return t=pi(t),t?t+":":""}function doe(t){return t}const KT="memory",VT=()=>{const t=new Map;return{name:KT,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function GT(t={}){const e={mounts:{"":t.driver||VT()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const d of e.mountpoints)if(l.startsWith(d))return{base:d,relativeKey:l.slice(d.length),driver:e.mounts[d]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,d)=>e.mountpoints.filter(g=>g.startsWith(l)||d&&l.startsWith(g)).map(g=>({relativeBase:l.length>g.length?l.slice(g.length):void 0,mountpoint:g,driver:e.mounts[g]})),i=(l,d)=>{if(e.watching){d=pi(d);for(const g of e.watchListeners)g(l,d)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await U2(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,d,g)=>{const y=new Map,A=P=>{let N=y.get(P.base);return N||(N={driver:P.driver,base:P.base,items:[]},y.set(P.base,N)),N};for(const P of l){const N=typeof P=="string",D=pi(N?P:P.key),k=N?void 0:P.value,B=N||!P.options?d:{...d,...P.options},j=r(D);A(j).items.push({key:D,value:k,relativeKey:j.relativeKey,options:B})}return Promise.all([...y.values()].map(P=>g(P))).then(P=>P.flat())},u={hasItem(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return Cn(y.hasItem,g,d)},getItem(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return Cn(y.getItem,g,d).then(A=>Zh(A))},getItems(l,d){return a(l,d,g=>g.driver.getItems?Cn(g.driver.getItems,g.items.map(y=>({key:y.relativeKey,options:y.options})),d).then(y=>y.map(A=>({key:WT(g.base,A.key),value:Zh(A.value)}))):Promise.all(g.items.map(y=>Cn(g.driver.getItem,y.relativeKey,y.options).then(A=>({key:y.key,value:Zh(A)})))))},getItemRaw(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return y.getItemRaw?Cn(y.getItemRaw,g,d):Cn(y.getItem,g,d).then(A=>HT(A))},async setItem(l,d,g={}){if(d===void 0)return u.removeItem(l);l=pi(l);const{relativeKey:y,driver:A}=r(l);A.setItem&&(await Cn(A.setItem,y,Qh(d),g),A.watch||i("update",l))},async setItems(l,d){await a(l,d,async g=>{if(g.driver.setItems)return Cn(g.driver.setItems,g.items.map(y=>({key:y.relativeKey,value:Qh(y.value),options:y.options})),d);g.driver.setItem&&await Promise.all(g.items.map(y=>Cn(g.driver.setItem,y.relativeKey,Qh(y.value),y.options)))})},async setItemRaw(l,d,g={}){if(d===void 0)return u.removeItem(l,g);l=pi(l);const{relativeKey:y,driver:A}=r(l);if(A.setItemRaw)await Cn(A.setItemRaw,y,d,g);else if(A.setItem)await Cn(A.setItem,y,zT(d),g);else return;A.watch||i("update",l)},async removeItem(l,d={}){typeof d=="boolean"&&(d={removeMeta:d}),l=pi(l);const{relativeKey:g,driver:y}=r(l);y.removeItem&&(await Cn(y.removeItem,g,d),(d.removeMeta||d.removeMata)&&await Cn(y.removeItem,g+"$",d),y.watch||i("remove",l))},async getMeta(l,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),l=pi(l);const{relativeKey:g,driver:y}=r(l),A=Object.create(null);if(y.getMeta&&Object.assign(A,await Cn(y.getMeta,g,d)),!d.nativeOnly){const P=await Cn(y.getItem,g+"$",d).then(N=>Zh(N));P&&typeof P=="object"&&(typeof P.atime=="string"&&(P.atime=new Date(P.atime)),typeof P.mtime=="string"&&(P.mtime=new Date(P.mtime)),Object.assign(A,P))}return A},setMeta(l,d,g={}){return this.setItem(l+"$",d,g)},removeMeta(l,d={}){return this.removeItem(l+"$",d)},async getKeys(l,d={}){l=ed(l);const g=n(l,!0);let y=[];const A=[];for(const P of g){const N=await Cn(P.driver.getKeys,P.relativeBase,d);for(const D of N){const k=P.mountpoint+pi(D);y.some(B=>k.startsWith(B))||A.push(k)}y=[P.mountpoint,...y.filter(D=>!D.startsWith(P.mountpoint))]}return l?A.filter(P=>P.startsWith(l)&&P[P.length-1]!=="$"):A.filter(P=>P[P.length-1]!=="$")},async clear(l,d={}){l=ed(l),await Promise.all(n(l,!1).map(async g=>{if(g.driver.clear)return Cn(g.driver.clear,g.relativeBase,d);if(g.driver.removeItem){const y=await g.driver.getKeys(g.relativeBase||"",d);return Promise.all(y.map(A=>g.driver.removeItem(A,d)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>q2(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(d=>d!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,d){if(l=ed(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((g,y)=>y.length-g.length)),e.mounts[l]=d,e.watching&&Promise.resolve(U2(d,i,l)).then(g=>{e.unwatch[l]=g}).catch(console.error),u},async unmount(l,d=!0){l=ed(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),d&&await q2(e.mounts[l]),e.mountpoints=e.mountpoints.filter(g=>g!==l),delete e.mounts[l])},getMount(l=""){l=pi(l)+":";const d=r(l);return{driver:d.driver,base:d.base}},getMounts(l="",d={}){return l=pi(l),n(l,d.parents).map(y=>({driver:y.driver,base:y.mountpoint}))},keys:(l,d={})=>u.getKeys(l,d),get:(l,d={})=>u.getItem(l,d),set:(l,d,g={})=>u.setItem(l,d,g),has:(l,d={})=>u.hasItem(l,d),del:(l,d={})=>u.removeItem(l,d),remove:(l,d={})=>u.removeItem(l,d)};return u}function U2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function q2(t){typeof t.dispose=="function"&&await Cn(t.dispose)}function Wa(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function z2(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Wa(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let im;function Jf(){return im||(im=z2("keyval-store","keyval")),im}function H2(t,e=Jf()){return e("readonly",r=>Wa(r.get(t)))}function YT(t,e,r=Jf()){return r("readwrite",n=>(n.put(e,t),Wa(n.transaction)))}function JT(t,e=Jf()){return e("readwrite",r=>(r.delete(t),Wa(r.transaction)))}function XT(t=Jf()){return t("readwrite",e=>(e.clear(),Wa(e.transaction)))}function ZT(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Wa(t.transaction)}function QT(t=Jf()){return t("readonly",e=>{if(e.getAllKeys)return Wa(e.getAllKeys());const r=[];return ZT(e,n=>r.push(n.key)).then(()=>r)})}const eR=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),tR=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Ka(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return tR(t)}catch{return t}}function mo(t){return typeof t=="string"?t:eR(t)||""}const rR="idb-keyval";var nR=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=z2(t.dbName,t.storeName)),{name:rR,options:t,async hasItem(i){return!(typeof await H2(r(i),n)>"u")},async getItem(i){return await H2(r(i),n)??null},setItem(i,s){return YT(r(i),s,n)},removeItem(i){return JT(r(i),n)},getKeys(){return QT(n)},clear(){return XT(n)}}};const iR="WALLET_CONNECT_V2_INDEXED_DB",sR="keyvaluestorage";let oR=class{constructor(){this.indexedDb=GT({driver:nR({dbName:iR,storeName:sR})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,mo(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var sm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},td={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof sm<"u"&&sm.localStorage?td.exports=sm.localStorage:typeof window<"u"&&window.localStorage?td.exports=window.localStorage:td.exports=new e})();function aR(t){var e;return[t[0],Ka((e=t[1])!=null?e:"")]}let cR=class{constructor(){this.localStorage=td.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(aR)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Ka(r)}async setItem(e,r){this.localStorage.setItem(e,mo(r))}async removeItem(e){this.localStorage.removeItem(e)}};const uR="wc_storage_version",W2=1,fR=async(t,e,r)=>{const n=uR,i=await e.getItem(n);if(i&&i>=W2){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,W2),r(e),lR(t,o)},lR=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let hR=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new cR;this.storage=e;try{const r=new oR;fR(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function dR(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var pR=gR;function gR(t,e,r){var n=r&&r.stringify||dR,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?g:0,t.charCodeAt(A+1)){case 100:case 102:if(d>=u||e[d]==null)break;g=u||e[d]==null)break;g=u||e[d]===void 0)break;g",g=A+2,A++;break}l+=n(e[d]),g=A+2,A++;break;case 115:if(d>=u)break;g-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",u=Object.create(r);u.log||(u.log=Zf),Object.defineProperty(u,"levelVal",{get:d}),Object.defineProperty(u,"level",{get:g,set:y});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:_R(t)};u.levels=vo.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Zf,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=A,e&&(u._logEvent=om());function d(){return this.level==="silent"?1/0:this.levels.values[this.level]}function g(){return this._level}function y(P){if(P!=="silent"&&!this.levels.values[P])throw Error("unknown level "+P);this._level=P,ou(l,u,"error","log"),ou(l,u,"fatal","error"),ou(l,u,"warn","error"),ou(l,u,"info","log"),ou(l,u,"debug","log"),ou(l,u,"trace","log")}function A(P,N){if(!P)throw new Error("missing bindings for child Pino");N=N||{},i&&P.serializers&&(N.serializers=P.serializers);const D=N.serializers;if(i&&D){var k=Object.assign({},n,D),B=t.browser.serialize===!0?Object.keys(k):i;delete P.serializers,rd([P],B,k,this._stdErrSerialize)}function j(U){this._childLevel=(U._childLevel|0)+1,this.error=au(U,P,"error"),this.fatal=au(U,P,"fatal"),this.warn=au(U,P,"warn"),this.info=au(U,P,"info"),this.debug=au(U,P,"debug"),this.trace=au(U,P,"trace"),k&&(this.serializers=k,this._serialize=B),e&&(this._logEvent=om([].concat(U._logEvent.bindings,P)))}return j.prototype=this,new j(this)}return u}vo.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},vo.stdSerializers=mR,vo.stdTimeFunctions=Object.assign({},{nullTime:V2,epochTime:G2,unixTime:ER,isoTime:SR});function ou(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Zf:i[r]?i[r]:Xf[r]||Xf[n]||Zf,bR(t,e,r)}function bR(t,e,r){!t.transmit&&e[r]===Zf||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Xf?Xf:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function au(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},J2=class{constructor(e,r=cm){this.level=e??"error",this.levelValue=su.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Y2(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===su.levels.values.error?console.error(e):r===su.levels.values.warn?console.warn(e):r===su.levels.values.debug?console.debug(e):r===su.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(mo({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new Y2(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(mo({extraMetadata:e})),new Blob(r,{type:"application/json"})}},IR=class{constructor(e,r=cm){this.baseChunkLogger=new J2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},CR=class{constructor(e,r=cm){this.baseChunkLogger=new J2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var TR=Object.defineProperty,RR=Object.defineProperties,DR=Object.getOwnPropertyDescriptors,X2=Object.getOwnPropertySymbols,OR=Object.prototype.hasOwnProperty,NR=Object.prototype.propertyIsEnumerable,Z2=(t,e,r)=>e in t?TR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,id=(t,e)=>{for(var r in e||(e={}))OR.call(e,r)&&Z2(t,r,e[r]);if(X2)for(var r of X2(e))NR.call(e,r)&&Z2(t,r,e[r]);return t},sd=(t,e)=>RR(t,DR(e));function od(t){return sd(id({},t),{level:(t==null?void 0:t.level)||PR.level})}function LR(t,e=el){return t[e]||""}function kR(t,e,r=el){return t[r]=e,t}function gi(t,e=el){let r="";return typeof t.bindings>"u"?r=LR(t,e):r=t.bindings().context||"",r}function BR(t,e,r=el){const n=gi(t,r);return n.trim()?`${n}/${e}`:e}function ri(t,e,r=el){const n=BR(t,e,r),i=t.child({context:n});return kR(i,n,r)}function $R(t){var e,r;const n=new IR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace",browser:sd(id({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function FR(t){var e;const r=new CR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function jR(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?$R(t):FR(t)}let UR=class extends Ha{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},qR=class extends Ha{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},zR=class{constructor(e,r){this.logger=e,this.core=r}},HR=class extends Ha{constructor(e,r){super(),this.relayer=e,this.logger=r}},WR=class extends Ha{constructor(e){super()}},KR=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},VR=class extends Ha{constructor(e,r){super(),this.relayer=e,this.logger=r}},GR=class extends Ha{constructor(e,r){super(),this.core=e,this.logger=r}},YR=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},JR=class{constructor(e,r){this.projectId=e,this.logger=r}},XR=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},ZR=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},QR=class{constructor(e){this.client=e}};var um={},ta={},ad={},cd={};Object.defineProperty(cd,"__esModule",{value:!0}),cd.BrowserRandomSource=void 0;const Q2=65536;class eD{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let n=0;n>>16&65535,d=a&65535,g=u>>>16&65535,y=u&65535;return d*y+(l*y+d*g<<16>>>0)|0}t.mul=Math.imul||e;function r(a,u){return a+u|0}t.add=r;function n(a,u){return a-u|0}t.sub=n;function i(a,u){return a<>>32-u}t.rotl=i;function s(a,u){return a<<32-u|a>>>u}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(tx),Object.defineProperty(or,"__esModule",{value:!0});var rx=tx;function aD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}or.readInt16BE=aD;function cD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}or.readUint16BE=cD;function uD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}or.readInt16LE=uD;function fD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}or.readUint16LE=fD;function nx(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}or.writeUint16BE=nx,or.writeInt16BE=nx;function ix(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}or.writeUint16LE=ix,or.writeInt16LE=ix;function fm(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}or.readInt32BE=fm;function lm(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}or.readUint32BE=lm;function hm(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}or.readInt32LE=hm;function dm(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}or.readUint32LE=dm;function fd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}or.writeUint32BE=fd,or.writeInt32BE=fd;function ld(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}or.writeUint32LE=ld,or.writeInt32LE=ld;function lD(t,e){e===void 0&&(e=0);var r=fm(t,e),n=fm(t,e+4);return r*4294967296+n-(n>>31)*4294967296}or.readInt64BE=lD;function hD(t,e){e===void 0&&(e=0);var r=lm(t,e),n=lm(t,e+4);return r*4294967296+n}or.readUint64BE=hD;function dD(t,e){e===void 0&&(e=0);var r=hm(t,e),n=hm(t,e+4);return n*4294967296+r-(r>>31)*4294967296}or.readInt64LE=dD;function pD(t,e){e===void 0&&(e=0);var r=dm(t,e),n=dm(t,e+4);return n*4294967296+r}or.readUint64LE=pD;function sx(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fd(t/4294967296>>>0,e,r),fd(t>>>0,e,r+4),e}or.writeUint64BE=sx,or.writeInt64BE=sx;function ox(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ld(t>>>0,e,r),ld(t/4294967296>>>0,e,r+4),e}or.writeUint64LE=ox,or.writeInt64LE=ox;function gD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}or.readUintBE=gD;function mD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}or.writeUintBE=vD;function bD(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!rx.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s256)throw new Error("randomString charset is too long");let y="";const A=d.length,P=256-256%A;for(;l>0;){const N=i(Math.ceil(l*256/P),g);for(let D=0;D0;D++){const k=N[D];k0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,g=l/536870912|0,y=l<<3,A=l%128<112?128:256;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._stateHi.set(u.stateHi),this._stateLo.set(u.stateLo),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.stateHi),r.wipe(u.stateLo),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,u,l,d,g,y,A){for(var P=l[0],N=l[1],D=l[2],k=l[3],B=l[4],j=l[5],U=l[6],K=l[7],J=d[0],T=d[1],z=d[2],ue=d[3],_e=d[4],G=d[5],E=d[6],m=d[7],f,p,v,x,_,S,b,M;A>=128;){for(var I=0;I<16;I++){var F=8*I+y;a[I]=e.readUint32BE(g,F),u[I]=e.readUint32BE(g,F+4)}for(var I=0;I<80;I++){var ae=P,O=N,se=D,ee=k,X=B,Q=j,R=U,Z=K,te=J,le=T,ie=z,fe=ue,ve=_e,Me=G,Ne=E,Te=m;if(f=K,p=m,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=(B>>>14|_e<<18)^(B>>>18|_e<<14)^(_e>>>9|B<<23),p=(_e>>>14|B<<18)^(_e>>>18|B<<14)^(B>>>9|_e<<23),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=B&j^~B&U,p=_e&G^~_e&E,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=i[I*2],p=i[I*2+1],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=a[I%16],p=u[I%16],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,v=b&65535|M<<16,x=_&65535|S<<16,f=v,p=x,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=(P>>>28|J<<4)^(J>>>2|P<<30)^(J>>>7|P<<25),p=(J>>>28|P<<4)^(P>>>2|J<<30)^(P>>>7|J<<25),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=P&N^P&D^N&D,p=J&T^J&z^T&z,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,Z=b&65535|M<<16,Te=_&65535|S<<16,f=ee,p=fe,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=v,p=x,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,ee=b&65535|M<<16,fe=_&65535|S<<16,N=ae,D=O,k=se,B=ee,j=X,U=Q,K=R,P=Z,T=te,z=le,ue=ie,_e=fe,G=ve,E=Me,m=Ne,J=Te,I%16===15)for(var F=0;F<16;F++)f=a[F],p=u[F],_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=a[(F+9)%16],p=u[(F+9)%16],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,v=a[(F+1)%16],x=u[(F+1)%16],f=(v>>>1|x<<31)^(v>>>8|x<<24)^v>>>7,p=(x>>>1|v<<31)^(x>>>8|v<<24)^(x>>>7|v<<25),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,v=a[(F+14)%16],x=u[(F+14)%16],f=(v>>>19|x<<13)^(x>>>29|v<<3)^v>>>6,p=(x>>>19|v<<13)^(v>>>29|x<<3)^(x>>>6|v<<26),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,a[F]=b&65535|M<<16,u[F]=_&65535|S<<16}f=P,p=J,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[0],p=d[0],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[0]=P=b&65535|M<<16,d[0]=J=_&65535|S<<16,f=N,p=T,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[1],p=d[1],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[1]=N=b&65535|M<<16,d[1]=T=_&65535|S<<16,f=D,p=z,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[2],p=d[2],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[2]=D=b&65535|M<<16,d[2]=z=_&65535|S<<16,f=k,p=ue,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[3],p=d[3],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[3]=k=b&65535|M<<16,d[3]=ue=_&65535|S<<16,f=B,p=_e,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[4],p=d[4],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[4]=B=b&65535|M<<16,d[4]=_e=_&65535|S<<16,f=j,p=G,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[5],p=d[5],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[5]=j=b&65535|M<<16,d[5]=G=_&65535|S<<16,f=U,p=E,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[6],p=d[6],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[6]=U=b&65535|M<<16,d[6]=E=_&65535|S<<16,f=K,p=m,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[7],p=d[7],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[7]=K=b&65535|M<<16,d[7]=m=_&65535|S<<16,y+=128,A-=128}return y}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ax),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=ta,r=ax,n=Mi;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(ee){const X=new Float64Array(16);if(ee)for(let Q=0;Q>16&1),Q[le-1]&=65535;Q[15]=R[15]-32767-(Q[14]>>16&1);const te=Q[15]>>16&1;Q[14]&=65535,N(R,Q,1-te)}for(let Z=0;Z<16;Z++)ee[2*Z]=R[Z]&255,ee[2*Z+1]=R[Z]>>8}function k(ee,X){let Q=0;for(let R=0;R<32;R++)Q|=ee[R]^X[R];return(1&Q-1>>>8)-1}function B(ee,X){const Q=new Uint8Array(32),R=new Uint8Array(32);return D(Q,ee),D(R,X),k(Q,R)}function j(ee){const X=new Uint8Array(32);return D(X,ee),X[0]&1}function U(ee,X){for(let Q=0;Q<16;Q++)ee[Q]=X[2*Q]+(X[2*Q+1]<<8);ee[15]&=32767}function K(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]+Q[R]}function J(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]-Q[R]}function T(ee,X,Q){let R,Z,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=0,Ie=0,Le=0,Ve=0,ke=0,ze=0,He=0,Ee=0,Qe=0,ct=0,Be=0,et=0,rt=0,Je=0,pt=0,ht=0,ft=0,Ht=0,Jt=0,St=0,er=0,Xt=0,Ot=0,Bt=Q[0],Tt=Q[1],vt=Q[2],Dt=Q[3],Lt=Q[4],bt=Q[5],$t=Q[6],jt=Q[7],nt=Q[8],Ft=Q[9],$=Q[10],H=Q[11],V=Q[12],C=Q[13],Y=Q[14],q=Q[15];R=X[0],te+=R*Bt,le+=R*Tt,ie+=R*vt,fe+=R*Dt,ve+=R*Lt,Me+=R*bt,Ne+=R*$t,Te+=R*jt,$e+=R*nt,Ie+=R*Ft,Le+=R*$,Ve+=R*H,ke+=R*V,ze+=R*C,He+=R*Y,Ee+=R*q,R=X[1],le+=R*Bt,ie+=R*Tt,fe+=R*vt,ve+=R*Dt,Me+=R*Lt,Ne+=R*bt,Te+=R*$t,$e+=R*jt,Ie+=R*nt,Le+=R*Ft,Ve+=R*$,ke+=R*H,ze+=R*V,He+=R*C,Ee+=R*Y,Qe+=R*q,R=X[2],ie+=R*Bt,fe+=R*Tt,ve+=R*vt,Me+=R*Dt,Ne+=R*Lt,Te+=R*bt,$e+=R*$t,Ie+=R*jt,Le+=R*nt,Ve+=R*Ft,ke+=R*$,ze+=R*H,He+=R*V,Ee+=R*C,Qe+=R*Y,ct+=R*q,R=X[3],fe+=R*Bt,ve+=R*Tt,Me+=R*vt,Ne+=R*Dt,Te+=R*Lt,$e+=R*bt,Ie+=R*$t,Le+=R*jt,Ve+=R*nt,ke+=R*Ft,ze+=R*$,He+=R*H,Ee+=R*V,Qe+=R*C,ct+=R*Y,Be+=R*q,R=X[4],ve+=R*Bt,Me+=R*Tt,Ne+=R*vt,Te+=R*Dt,$e+=R*Lt,Ie+=R*bt,Le+=R*$t,Ve+=R*jt,ke+=R*nt,ze+=R*Ft,He+=R*$,Ee+=R*H,Qe+=R*V,ct+=R*C,Be+=R*Y,et+=R*q,R=X[5],Me+=R*Bt,Ne+=R*Tt,Te+=R*vt,$e+=R*Dt,Ie+=R*Lt,Le+=R*bt,Ve+=R*$t,ke+=R*jt,ze+=R*nt,He+=R*Ft,Ee+=R*$,Qe+=R*H,ct+=R*V,Be+=R*C,et+=R*Y,rt+=R*q,R=X[6],Ne+=R*Bt,Te+=R*Tt,$e+=R*vt,Ie+=R*Dt,Le+=R*Lt,Ve+=R*bt,ke+=R*$t,ze+=R*jt,He+=R*nt,Ee+=R*Ft,Qe+=R*$,ct+=R*H,Be+=R*V,et+=R*C,rt+=R*Y,Je+=R*q,R=X[7],Te+=R*Bt,$e+=R*Tt,Ie+=R*vt,Le+=R*Dt,Ve+=R*Lt,ke+=R*bt,ze+=R*$t,He+=R*jt,Ee+=R*nt,Qe+=R*Ft,ct+=R*$,Be+=R*H,et+=R*V,rt+=R*C,Je+=R*Y,pt+=R*q,R=X[8],$e+=R*Bt,Ie+=R*Tt,Le+=R*vt,Ve+=R*Dt,ke+=R*Lt,ze+=R*bt,He+=R*$t,Ee+=R*jt,Qe+=R*nt,ct+=R*Ft,Be+=R*$,et+=R*H,rt+=R*V,Je+=R*C,pt+=R*Y,ht+=R*q,R=X[9],Ie+=R*Bt,Le+=R*Tt,Ve+=R*vt,ke+=R*Dt,ze+=R*Lt,He+=R*bt,Ee+=R*$t,Qe+=R*jt,ct+=R*nt,Be+=R*Ft,et+=R*$,rt+=R*H,Je+=R*V,pt+=R*C,ht+=R*Y,ft+=R*q,R=X[10],Le+=R*Bt,Ve+=R*Tt,ke+=R*vt,ze+=R*Dt,He+=R*Lt,Ee+=R*bt,Qe+=R*$t,ct+=R*jt,Be+=R*nt,et+=R*Ft,rt+=R*$,Je+=R*H,pt+=R*V,ht+=R*C,ft+=R*Y,Ht+=R*q,R=X[11],Ve+=R*Bt,ke+=R*Tt,ze+=R*vt,He+=R*Dt,Ee+=R*Lt,Qe+=R*bt,ct+=R*$t,Be+=R*jt,et+=R*nt,rt+=R*Ft,Je+=R*$,pt+=R*H,ht+=R*V,ft+=R*C,Ht+=R*Y,Jt+=R*q,R=X[12],ke+=R*Bt,ze+=R*Tt,He+=R*vt,Ee+=R*Dt,Qe+=R*Lt,ct+=R*bt,Be+=R*$t,et+=R*jt,rt+=R*nt,Je+=R*Ft,pt+=R*$,ht+=R*H,ft+=R*V,Ht+=R*C,Jt+=R*Y,St+=R*q,R=X[13],ze+=R*Bt,He+=R*Tt,Ee+=R*vt,Qe+=R*Dt,ct+=R*Lt,Be+=R*bt,et+=R*$t,rt+=R*jt,Je+=R*nt,pt+=R*Ft,ht+=R*$,ft+=R*H,Ht+=R*V,Jt+=R*C,St+=R*Y,er+=R*q,R=X[14],He+=R*Bt,Ee+=R*Tt,Qe+=R*vt,ct+=R*Dt,Be+=R*Lt,et+=R*bt,rt+=R*$t,Je+=R*jt,pt+=R*nt,ht+=R*Ft,ft+=R*$,Ht+=R*H,Jt+=R*V,St+=R*C,er+=R*Y,Xt+=R*q,R=X[15],Ee+=R*Bt,Qe+=R*Tt,ct+=R*vt,Be+=R*Dt,et+=R*Lt,rt+=R*bt,Je+=R*$t,pt+=R*jt,ht+=R*nt,ft+=R*Ft,Ht+=R*$,Jt+=R*H,St+=R*V,er+=R*C,Xt+=R*Y,Ot+=R*q,te+=38*Qe,le+=38*ct,ie+=38*Be,fe+=38*et,ve+=38*rt,Me+=38*Je,Ne+=38*pt,Te+=38*ht,$e+=38*ft,Ie+=38*Ht,Le+=38*Jt,Ve+=38*St,ke+=38*er,ze+=38*Xt,He+=38*Ot,Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),ee[0]=te,ee[1]=le,ee[2]=ie,ee[3]=fe,ee[4]=ve,ee[5]=Me,ee[6]=Ne,ee[7]=Te,ee[8]=$e,ee[9]=Ie,ee[10]=Le,ee[11]=Ve,ee[12]=ke,ee[13]=ze,ee[14]=He,ee[15]=Ee}function z(ee,X){T(ee,X,X)}function ue(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=253;R>=0;R--)z(Q,Q),R!==2&&R!==4&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function _e(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=250;R>=0;R--)z(Q,Q),R!==1&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function G(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i(),ve=i(),Me=i();J(Q,ee[1],ee[0]),J(Me,X[1],X[0]),T(Q,Q,Me),K(R,ee[0],ee[1]),K(Me,X[0],X[1]),T(R,R,Me),T(Z,ee[3],X[3]),T(Z,Z,l),T(te,ee[2],X[2]),K(te,te,te),J(le,R,Q),J(ie,te,Z),K(fe,te,Z),K(ve,R,Q),T(ee[0],le,ie),T(ee[1],ve,fe),T(ee[2],fe,ie),T(ee[3],le,ve)}function E(ee,X,Q){for(let R=0;R<4;R++)N(ee[R],X[R],Q)}function m(ee,X){const Q=i(),R=i(),Z=i();ue(Z,X[2]),T(Q,X[0],Z),T(R,X[1],Z),D(ee,R),ee[31]^=j(Q)<<7}function f(ee,X,Q){A(ee[0],o),A(ee[1],a),A(ee[2],a),A(ee[3],o);for(let R=255;R>=0;--R){const Z=Q[R/8|0]>>(R&7)&1;E(ee,X,Z),G(X,ee),G(ee,ee),E(ee,X,Z)}}function p(ee,X){const Q=[i(),i(),i(),i()];A(Q[0],d),A(Q[1],g),A(Q[2],a),T(Q[3],d,g),f(ee,Q,X)}function v(ee){if(ee.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const X=(0,r.hash)(ee);X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(32),R=[i(),i(),i(),i()];p(R,X),m(Q,R);const Z=new Uint8Array(64);return Z.set(ee),Z.set(Q,32),{publicKey:Q,secretKey:Z}}t.generateKeyPairFromSeed=v;function x(ee){const X=(0,e.randomBytes)(32,ee),Q=v(X);return(0,n.wipe)(X),Q}t.generateKeyPair=x;function _(ee){if(ee.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(ee.subarray(32))}t.extractPublicKeyFromSecretKey=_;const S=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function b(ee,X){let Q,R,Z,te;for(R=63;R>=32;--R){for(Q=0,Z=R-32,te=R-12;Z>4)*S[Z],Q=X[Z]>>8,X[Z]&=255;for(Z=0;Z<32;Z++)X[Z]-=Q*S[Z];for(R=0;R<32;R++)X[R+1]+=X[R]>>8,ee[R]=X[R]&255}function M(ee){const X=new Float64Array(64);for(let Q=0;Q<64;Q++)X[Q]=ee[Q];for(let Q=0;Q<64;Q++)ee[Q]=0;b(ee,X)}function I(ee,X){const Q=new Float64Array(64),R=[i(),i(),i(),i()],Z=(0,r.hash)(ee.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(64);te.set(Z.subarray(32),32);const le=new r.SHA512;le.update(te.subarray(32)),le.update(X);const ie=le.digest();le.clean(),M(ie),p(R,ie),m(te,R),le.reset(),le.update(te.subarray(0,32)),le.update(ee.subarray(32)),le.update(X);const fe=le.digest();M(fe);for(let ve=0;ve<32;ve++)Q[ve]=ie[ve];for(let ve=0;ve<32;ve++)for(let Me=0;Me<32;Me++)Q[ve+Me]+=fe[ve]*Z[Me];return b(te.subarray(32),Q),te}t.sign=I;function F(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i();return A(ee[2],a),U(ee[1],X),z(Z,ee[1]),T(te,Z,u),J(Z,Z,ee[2]),K(te,ee[2],te),z(le,te),z(ie,le),T(fe,ie,le),T(Q,fe,Z),T(Q,Q,te),_e(Q,Q),T(Q,Q,Z),T(Q,Q,te),T(Q,Q,te),T(ee[0],Q,te),z(R,ee[0]),T(R,R,te),B(R,Z)&&T(ee[0],ee[0],y),z(R,ee[0]),T(R,R,te),B(R,Z)?-1:(j(ee[0])===X[31]>>7&&J(ee[0],o,ee[0]),T(ee[3],ee[0],ee[1]),0)}function ae(ee,X,Q){const R=new Uint8Array(32),Z=[i(),i(),i(),i()],te=[i(),i(),i(),i()];if(Q.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(F(te,ee))return!1;const le=new r.SHA512;le.update(Q.subarray(0,32)),le.update(ee),le.update(X);const ie=le.digest();return M(ie),f(Z,te,ie),p(te,Q.subarray(32)),G(Z,te),m(R,Z),!k(Q,R)}t.verify=ae;function O(ee){let X=[i(),i(),i(),i()];if(F(X,ee))throw new Error("Ed25519: invalid public key");let Q=i(),R=i(),Z=X[1];K(Q,a,Z),J(R,a,Z),ue(R,R),T(Q,Q,R);let te=new Uint8Array(32);return D(te,Q),te}t.convertPublicKeyToX25519=O;function se(ee){const X=(0,r.hash)(ee.subarray(0,32));X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(X.subarray(0,32));return(0,n.wipe)(X),Q}t.convertSecretKeyToX25519=se}(um);const MD="EdDSA",ID="JWT",hd=".",dd="base64url",cx="utf8",ux="utf8",CD=":",TD="did",RD="key",fx="base58btc",DD="z",OD="K36",ND=32;function lx(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function pd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=lx(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function LD(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(j);k!==B;){for(var K=P[k],J=0,T=j-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=j-D;z!==j&&U[z]===0;)z++;for(var ue=u.repeat(N);z>>0,j=new Uint8Array(B);P[N];){var U=r[P.charCodeAt(N)];if(U===255)return;for(var K=0,J=B-1;(U!==0||K>>0,j[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,N++}if(P[N]!==" "){for(var T=B-k;T!==B&&j[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=j[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:g,decodeUnsafe:y,decode:A}}var kD=LD,BD=kD;const $D=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},FD=t=>new TextEncoder().encode(t),jD=t=>new TextDecoder().decode(t);class UD{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class qD{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return hx(this,e)}}class zD{constructor(e){this.decoders=e}or(e){return hx(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const hx=(t,e)=>new zD({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class HD{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new UD(e,r,n),this.decoder=new qD(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const gd=({name:t,prefix:e,encode:r,decode:n})=>new HD(t,e,r,n),rl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=BD(r,e);return gd({prefix:t,name:e,encode:n,decode:s=>$D(i(s))})},WD=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},KD=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<gd({prefix:e,name:t,encode(i){return KD(i,n,r)},decode(i){return WD(i,n,r,t)}}),VD=gd({prefix:"\0",name:"identity",encode:t=>jD(t),decode:t=>FD(t)}),GD=Object.freeze(Object.defineProperty({__proto__:null,identity:VD},Symbol.toStringTag,{value:"Module"})),YD=jn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),JD=Object.freeze(Object.defineProperty({__proto__:null,base2:YD},Symbol.toStringTag,{value:"Module"})),XD=jn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),ZD=Object.freeze(Object.defineProperty({__proto__:null,base8:XD},Symbol.toStringTag,{value:"Module"})),QD=rl({prefix:"9",name:"base10",alphabet:"0123456789"}),eO=Object.freeze(Object.defineProperty({__proto__:null,base10:QD},Symbol.toStringTag,{value:"Module"})),tO=jn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),rO=jn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),nO=Object.freeze(Object.defineProperty({__proto__:null,base16:tO,base16upper:rO},Symbol.toStringTag,{value:"Module"})),iO=jn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),sO=jn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),oO=jn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),aO=jn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),cO=jn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),uO=jn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),fO=jn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),lO=jn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),hO=jn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),dO=Object.freeze(Object.defineProperty({__proto__:null,base32:iO,base32hex:cO,base32hexpad:fO,base32hexpadupper:lO,base32hexupper:uO,base32pad:oO,base32padupper:aO,base32upper:sO,base32z:hO},Symbol.toStringTag,{value:"Module"})),pO=rl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),gO=rl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),mO=Object.freeze(Object.defineProperty({__proto__:null,base36:pO,base36upper:gO},Symbol.toStringTag,{value:"Module"})),vO=rl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),bO=rl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),yO=Object.freeze(Object.defineProperty({__proto__:null,base58btc:vO,base58flickr:bO},Symbol.toStringTag,{value:"Module"})),wO=jn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),xO=jn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),_O=jn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),EO=jn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),SO=Object.freeze(Object.defineProperty({__proto__:null,base64:wO,base64pad:xO,base64url:_O,base64urlpad:EO},Symbol.toStringTag,{value:"Module"})),dx=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),AO=dx.reduce((t,e,r)=>(t[r]=e,t),[]),PO=dx.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function MO(t){return t.reduce((e,r)=>(e+=AO[r],e),"")}function IO(t){const e=[];for(const r of t){const n=PO[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const CO=gd({prefix:"🚀",name:"base256emoji",encode:MO,decode:IO}),TO=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:CO},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const px={...GD,...JD,...ZD,...eO,...nO,...dO,...mO,...yO,...SO,...TO};function gx(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const mx=gx("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),pm=gx("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=lx(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new jO:typeof navigator<"u"?KO(navigator.userAgent):GO()}function WO(t){return t!==""&&zO.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function KO(t){var e=WO(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new FO;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<_x&&(i=xx(xx([],i,!0),YO(_x-i.length),!0)):i=[];var s=i.join("."),o=VO(t),a=qO.exec(t);return a&&a[1]?new $O(r,s,o,a[1]):new kO(r,s,o)}function VO(t){for(var e=0,r=Ex.length;e-1){const D=P.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let k=e.protocol+"//"+e.host;if(D.indexOf("/")===0)k+=D;else{const B=e.pathname.split("/");B.pop();const j=B.join("/");k+=j+"/"+D}y.push(k)}else if(D.indexOf("//")===0){const k=e.protocol+D;y.push(k)}else y.push(D)}}return y}function n(...g){const y=t.getElementsByTagName("meta");for(let A=0;AP.getAttribute(D)).filter(D=>D?g.includes(D):!1);if(N.length&&N){const D=P.getAttribute("content");if(D)return D}}return""}function i(){let g=n("name","og:site_name","og:title","twitter:title");return g||(g=t.title),g}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}Ax=vm.getWindowMetadata=oN;var il={},aN=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Mx="%[a-f0-9]{2}",Ix=new RegExp("("+Mx+")|([^%]+?)","gi"),Cx=new RegExp("("+Mx+")+","gi");function bm(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],bm(r),bm(n))}function cN(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(Ix)||[],r=1;r{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},hN=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;sB==null,o=Symbol("encodeFragmentIdentifier");function a(B){switch(B.arrayFormat){case"index":return j=>(U,K)=>{const J=U.length;return K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),"[",J,"]"].join("")]:[...U,[d(j,B),"[",d(J,B),"]=",d(K,B)].join("")]};case"bracket":return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),"[]"].join("")]:[...U,[d(j,B),"[]=",d(K,B)].join("")];case"colon-list-separator":return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),":list="].join("")]:[...U,[d(j,B),":list=",d(K,B)].join("")];case"comma":case"separator":case"bracket-separator":{const j=B.arrayFormat==="bracket-separator"?"[]=":"=";return U=>(K,J)=>J===void 0||B.skipNull&&J===null||B.skipEmptyString&&J===""?K:(J=J===null?"":J,K.length===0?[[d(U,B),j,d(J,B)].join("")]:[[K,d(J,B)].join(B.arrayFormatSeparator)])}default:return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,d(j,B)]:[...U,[d(j,B),"=",d(K,B)].join("")]}}function u(B){let j;switch(B.arrayFormat){case"index":return(U,K,J)=>{if(j=/\[(\d*)\]$/.exec(U),U=U.replace(/\[\d*\]$/,""),!j){J[U]=K;return}J[U]===void 0&&(J[U]={}),J[U][j[1]]=K};case"bracket":return(U,K,J)=>{if(j=/(\[\])$/.exec(U),U=U.replace(/\[\]$/,""),!j){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"colon-list-separator":return(U,K,J)=>{if(j=/(:list)$/.exec(U),U=U.replace(/:list$/,""),!j){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"comma":case"separator":return(U,K,J)=>{const T=typeof K=="string"&&K.includes(B.arrayFormatSeparator),z=typeof K=="string"&&!T&&g(K,B).includes(B.arrayFormatSeparator);K=z?g(K,B):K;const ue=T||z?K.split(B.arrayFormatSeparator).map(_e=>g(_e,B)):K===null?K:g(K,B);J[U]=ue};case"bracket-separator":return(U,K,J)=>{const T=/(\[\])$/.test(U);if(U=U.replace(/\[\]$/,""),!T){J[U]=K&&g(K,B);return}const z=K===null?[]:K.split(B.arrayFormatSeparator).map(ue=>g(ue,B));if(J[U]===void 0){J[U]=z;return}J[U]=[].concat(J[U],z)};default:return(U,K,J)=>{if(J[U]===void 0){J[U]=K;return}J[U]=[].concat(J[U],K)}}}function l(B){if(typeof B!="string"||B.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function d(B,j){return j.encode?j.strict?e(B):encodeURIComponent(B):B}function g(B,j){return j.decode?r(B):B}function y(B){return Array.isArray(B)?B.sort():typeof B=="object"?y(Object.keys(B)).sort((j,U)=>Number(j)-Number(U)).map(j=>B[j]):B}function A(B){const j=B.indexOf("#");return j!==-1&&(B=B.slice(0,j)),B}function P(B){let j="";const U=B.indexOf("#");return U!==-1&&(j=B.slice(U)),j}function N(B){B=A(B);const j=B.indexOf("?");return j===-1?"":B.slice(j+1)}function D(B,j){return j.parseNumbers&&!Number.isNaN(Number(B))&&typeof B=="string"&&B.trim()!==""?B=Number(B):j.parseBooleans&&B!==null&&(B.toLowerCase()==="true"||B.toLowerCase()==="false")&&(B=B.toLowerCase()==="true"),B}function k(B,j){j=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},j),l(j.arrayFormatSeparator);const U=u(j),K=Object.create(null);if(typeof B!="string"||(B=B.trim().replace(/^[?#&]/,""),!B))return K;for(const J of B.split("&")){if(J==="")continue;let[T,z]=n(j.decode?J.replace(/\+/g," "):J,"=");z=z===void 0?null:["comma","separator","bracket-separator"].includes(j.arrayFormat)?z:g(z,j),U(g(T,j),z,K)}for(const J of Object.keys(K)){const T=K[J];if(typeof T=="object"&&T!==null)for(const z of Object.keys(T))T[z]=D(T[z],j);else K[J]=D(T,j)}return j.sort===!1?K:(j.sort===!0?Object.keys(K).sort():Object.keys(K).sort(j.sort)).reduce((J,T)=>{const z=K[T];return z&&typeof z=="object"&&!Array.isArray(z)?J[T]=y(z):J[T]=z,J},Object.create(null))}t.extract=N,t.parse=k,t.stringify=(B,j)=>{if(!B)return"";j=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},j),l(j.arrayFormatSeparator);const U=z=>j.skipNull&&s(B[z])||j.skipEmptyString&&B[z]==="",K=a(j),J={};for(const z of Object.keys(B))U(z)||(J[z]=B[z]);const T=Object.keys(J);return j.sort!==!1&&T.sort(j.sort),T.map(z=>{const ue=B[z];return ue===void 0?"":ue===null?d(z,j):Array.isArray(ue)?ue.length===0&&j.arrayFormat==="bracket-separator"?d(z,j)+"[]":ue.reduce(K(z),[]).join("&"):d(z,j)+"="+d(ue,j)}).filter(z=>z.length>0).join("&")},t.parseUrl=(B,j)=>{j=Object.assign({decode:!0},j);const[U,K]=n(B,"#");return Object.assign({url:U.split("?")[0]||"",query:k(N(B),j)},j&&j.parseFragmentIdentifier&&K?{fragmentIdentifier:g(K,j)}:{})},t.stringifyUrl=(B,j)=>{j=Object.assign({encode:!0,strict:!0,[o]:!0},j);const U=A(B.url).split("?")[0]||"",K=t.extract(B.url),J=t.parse(K,{sort:!1}),T=Object.assign(J,B.query);let z=t.stringify(T,j);z&&(z=`?${z}`);let ue=P(B.url);return B.fragmentIdentifier&&(ue=`#${j[o]?d(B.fragmentIdentifier,j):B.fragmentIdentifier}`),`${U}${z}${ue}`},t.pick=(B,j,U)=>{U=Object.assign({parseFragmentIdentifier:!0,[o]:!1},U);const{url:K,query:J,fragmentIdentifier:T}=t.parseUrl(B,U);return t.stringifyUrl({url:K,query:i(J,j),fragmentIdentifier:T},U)},t.exclude=(B,j,U)=>{const K=Array.isArray(j)?J=>!j.includes(J):(J,T)=>!j(J,T);return t.pick(B,K,U)}})(il);var Tx={exports:{}};/** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.8.0 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT - */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=nn:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],g=[4,1024,262144,67108864],y=[1,256,65536,16777216],A=[6,1536,393216,100663296],P=[0,8,16,24],O=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],D=[224,256,384,512],k=[128,256],B=["hex","buffer","arrayBuffer","array","digest"],j={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(N){return Object.prototype.toString.call(N)==="[object Array]"}),u&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(N){return typeof N=="object"&&N.buffer&&N.buffer.constructor===ArrayBuffer});for(var U=function(N,se,ee){return function(X){return new I(N,se,N).update(X)[ee]()}},K=function(N,se,ee){return function(X,Q){return new I(N,se,Q).update(X)[ee]()}},J=function(N,se,ee){return function(X,Q,R,Z){return f["cshake"+N].update(X,Q,R,Z)[ee]()}},T=function(N,se,ee){return function(X,Q,R,Z){return f["kmac"+N].update(X,Q,R,Z)[ee]()}},z=function(N,se,ee,X){for(var Q=0;Q>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ee>>5,this.extraBytes=(ee&31)>>3;for(var X=0;X<50;++X)this.s[X]=0}I.prototype.update=function(N){if(this.finalized)throw new Error(r);var se,ee=typeof N;if(ee!=="string"){if(ee==="object"){if(N===null)throw new Error(e);if(u&&N.constructor===ArrayBuffer)N=new Uint8Array(N);else if(!Array.isArray(N)&&(!u||!ArrayBuffer.isView(N)))throw new Error(e)}else throw new Error(e);se=!0}for(var X=this.blocks,Q=this.byteCount,R=N.length,Z=this.blockCount,te=0,he=this.s,ie,fe;te>2]|=N[te]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(X[ie>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=Q){for(this.start=ie-Q,this.block=X[Z],ie=0;ie>8,ee=N&255;ee>0;)Q.unshift(ee),N=N>>8,ee=N&255,++X;return se?Q.push(X):Q.unshift(X),this.update(Q),Q.length},I.prototype.encodeString=function(N){var se,ee=typeof N;if(ee!=="string"){if(ee==="object"){if(N===null)throw new Error(e);if(u&&N.constructor===ArrayBuffer)N=new Uint8Array(N);else if(!Array.isArray(N)&&(!u||!ArrayBuffer.isView(N)))throw new Error(e)}else throw new Error(e);se=!0}var X=0,Q=N.length;if(se)X=Q;else for(var R=0;R=57344?X+=3:(Z=65536+((Z&1023)<<10|N.charCodeAt(++R)&1023),X+=4)}return X+=this.encode(X*8),this.update(N),X},I.prototype.bytepad=function(N,se){for(var ee=this.encode(se),X=0;X>2]|=this.padding[se&3],this.lastByteIndex===this.byteCount)for(N[0]=N[ee],se=1;se>4&15]+l[te&15]+l[te>>12&15]+l[te>>8&15]+l[te>>20&15]+l[te>>16&15]+l[te>>28&15]+l[te>>24&15];R%N===0&&(ae(se),Q=0)}return X&&(te=se[Q],Z+=l[te>>4&15]+l[te&15],X>1&&(Z+=l[te>>12&15]+l[te>>8&15]),X>2&&(Z+=l[te>>20&15]+l[te>>16&15])),Z},I.prototype.arrayBuffer=function(){this.finalize();var N=this.blockCount,se=this.s,ee=this.outputBlocks,X=this.extraBytes,Q=0,R=0,Z=this.outputBits>>3,te;X?te=new ArrayBuffer(ee+1<<2):te=new ArrayBuffer(Z);for(var he=new Uint32Array(te);R>8&255,Z[te+2]=he>>16&255,Z[te+3]=he>>24&255;R%N===0&&ae(se)}return X&&(te=R<<2,he=se[Q],Z[te]=he&255,X>1&&(Z[te+1]=he>>8&255),X>2&&(Z[te+2]=he>>16&255)),Z};function F(N,se,ee){I.call(this,N,se,ee)}F.prototype=new I,F.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var ae=function(N){var se,ee,X,Q,R,Z,te,he,ie,fe,ve,Me,Ne,Te,$e,Ie,Le,Ve,ke,ze,He,Ee,Qe,ct,Be,et,rt,Je,pt,ht,ft,Ht,Jt,St,er,Xt,Ot,Bt,Tt,vt,Dt,Lt,bt,$t,jt,nt,Ft,$,H,V,C,Y,q,oe,ge,xe,Re,De,it,Ue,gt,st,tt;for(X=0;X<48;X+=2)Q=N[0]^N[10]^N[20]^N[30]^N[40],R=N[1]^N[11]^N[21]^N[31]^N[41],Z=N[2]^N[12]^N[22]^N[32]^N[42],te=N[3]^N[13]^N[23]^N[33]^N[43],he=N[4]^N[14]^N[24]^N[34]^N[44],ie=N[5]^N[15]^N[25]^N[35]^N[45],fe=N[6]^N[16]^N[26]^N[36]^N[46],ve=N[7]^N[17]^N[27]^N[37]^N[47],Me=N[8]^N[18]^N[28]^N[38]^N[48],Ne=N[9]^N[19]^N[29]^N[39]^N[49],se=Me^(Z<<1|te>>>31),ee=Ne^(te<<1|Z>>>31),N[0]^=se,N[1]^=ee,N[10]^=se,N[11]^=ee,N[20]^=se,N[21]^=ee,N[30]^=se,N[31]^=ee,N[40]^=se,N[41]^=ee,se=Q^(he<<1|ie>>>31),ee=R^(ie<<1|he>>>31),N[2]^=se,N[3]^=ee,N[12]^=se,N[13]^=ee,N[22]^=se,N[23]^=ee,N[32]^=se,N[33]^=ee,N[42]^=se,N[43]^=ee,se=Z^(fe<<1|ve>>>31),ee=te^(ve<<1|fe>>>31),N[4]^=se,N[5]^=ee,N[14]^=se,N[15]^=ee,N[24]^=se,N[25]^=ee,N[34]^=se,N[35]^=ee,N[44]^=se,N[45]^=ee,se=he^(Me<<1|Ne>>>31),ee=ie^(Ne<<1|Me>>>31),N[6]^=se,N[7]^=ee,N[16]^=se,N[17]^=ee,N[26]^=se,N[27]^=ee,N[36]^=se,N[37]^=ee,N[46]^=se,N[47]^=ee,se=fe^(Q<<1|R>>>31),ee=ve^(R<<1|Q>>>31),N[8]^=se,N[9]^=ee,N[18]^=se,N[19]^=ee,N[28]^=se,N[29]^=ee,N[38]^=se,N[39]^=ee,N[48]^=se,N[49]^=ee,Te=N[0],$e=N[1],nt=N[11]<<4|N[10]>>>28,Ft=N[10]<<4|N[11]>>>28,Je=N[20]<<3|N[21]>>>29,pt=N[21]<<3|N[20]>>>29,Ue=N[31]<<9|N[30]>>>23,gt=N[30]<<9|N[31]>>>23,Lt=N[40]<<18|N[41]>>>14,bt=N[41]<<18|N[40]>>>14,St=N[2]<<1|N[3]>>>31,er=N[3]<<1|N[2]>>>31,Ie=N[13]<<12|N[12]>>>20,Le=N[12]<<12|N[13]>>>20,$=N[22]<<10|N[23]>>>22,H=N[23]<<10|N[22]>>>22,ht=N[33]<<13|N[32]>>>19,ft=N[32]<<13|N[33]>>>19,st=N[42]<<2|N[43]>>>30,tt=N[43]<<2|N[42]>>>30,oe=N[5]<<30|N[4]>>>2,ge=N[4]<<30|N[5]>>>2,Xt=N[14]<<6|N[15]>>>26,Ot=N[15]<<6|N[14]>>>26,Ve=N[25]<<11|N[24]>>>21,ke=N[24]<<11|N[25]>>>21,V=N[34]<<15|N[35]>>>17,C=N[35]<<15|N[34]>>>17,Ht=N[45]<<29|N[44]>>>3,Jt=N[44]<<29|N[45]>>>3,ct=N[6]<<28|N[7]>>>4,Be=N[7]<<28|N[6]>>>4,xe=N[17]<<23|N[16]>>>9,Re=N[16]<<23|N[17]>>>9,Bt=N[26]<<25|N[27]>>>7,Tt=N[27]<<25|N[26]>>>7,ze=N[36]<<21|N[37]>>>11,He=N[37]<<21|N[36]>>>11,Y=N[47]<<24|N[46]>>>8,q=N[46]<<24|N[47]>>>8,$t=N[8]<<27|N[9]>>>5,jt=N[9]<<27|N[8]>>>5,et=N[18]<<20|N[19]>>>12,rt=N[19]<<20|N[18]>>>12,De=N[29]<<7|N[28]>>>25,it=N[28]<<7|N[29]>>>25,vt=N[38]<<8|N[39]>>>24,Dt=N[39]<<8|N[38]>>>24,Ee=N[48]<<14|N[49]>>>18,Qe=N[49]<<14|N[48]>>>18,N[0]=Te^~Ie&Ve,N[1]=$e^~Le&ke,N[10]=ct^~et&Je,N[11]=Be^~rt&pt,N[20]=St^~Xt&Bt,N[21]=er^~Ot&Tt,N[30]=$t^~nt&$,N[31]=jt^~Ft&H,N[40]=oe^~xe&De,N[41]=ge^~Re&it,N[2]=Ie^~Ve&ze,N[3]=Le^~ke&He,N[12]=et^~Je&ht,N[13]=rt^~pt&ft,N[22]=Xt^~Bt&vt,N[23]=Ot^~Tt&Dt,N[32]=nt^~$&V,N[33]=Ft^~H&C,N[42]=xe^~De&Ue,N[43]=Re^~it>,N[4]=Ve^~ze&Ee,N[5]=ke^~He&Qe,N[14]=Je^~ht&Ht,N[15]=pt^~ft&Jt,N[24]=Bt^~vt&Lt,N[25]=Tt^~Dt&bt,N[34]=$^~V&Y,N[35]=H^~C&q,N[44]=De^~Ue&st,N[45]=it^~gt&tt,N[6]=ze^~Ee&Te,N[7]=He^~Qe&$e,N[16]=ht^~Ht&ct,N[17]=ft^~Jt&Be,N[26]=vt^~Lt&St,N[27]=Dt^~bt&er,N[36]=V^~Y&$t,N[37]=C^~q&jt,N[46]=Ue^~st&oe,N[47]=gt^~tt&ge,N[8]=Ee^~Te&Ie,N[9]=Qe^~$e&Le,N[18]=Ht^~ct&et,N[19]=Jt^~Be&rt,N[28]=Lt^~St&Xt,N[29]=bt^~er&Ot,N[38]=Y^~$t&nt,N[39]=q^~jt&Ft,N[48]=st^~oe&xe,N[49]=tt^~ge&Re,N[0]^=O[X],N[1]^=O[X+1]};if(a)t.exports=f;else for(v=0;v{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const kx=gN();var wm;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(wm||(wm={}));var ps;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(ps||(ps={}));const Bx="0123456789abcdef";class Kr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();vd[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Lx>vd[n])&&console.log.apply(console,r)}debug(...e){this._log(Kr.levels.DEBUG,e)}info(...e){this._log(Kr.levels.INFO,e)}warn(...e){this._log(Kr.levels.WARNING,e)}makeError(e,r,n){if(Nx)return this.makeError("censored error",r,{});r||(r=Kr.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(u=>{const l=n[u];try{if(l instanceof Uint8Array){let d="";for(let g=0;g>4],d+=Bx[l[g]&15];i.push(u+"=Uint8Array(0x"+d+")")}else i.push(u+"="+JSON.stringify(l))}catch{i.push(u+"="+JSON.stringify(n[u].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case ps.NUMERIC_FAULT:{o="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case ps.CALL_EXCEPTION:case ps.INSUFFICIENT_FUNDS:case ps.MISSING_NEW:case ps.NONCE_EXPIRED:case ps.REPLACEMENT_UNDERPRICED:case ps.TRANSACTION_REPLACED:case ps.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(u){a[u]=n[u]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Kr.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){kx&&this.throwError("platform missing String.prototype.normalize",Kr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:kx})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Kr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Kr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return ym||(ym=new Kr(pN)),ym}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Ox){if(!e)return;this.globalLogger().throwError("error censorship permanent",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Nx=!!e,Ox=!!r}static setLogLevel(e){const r=vd[e.toLowerCase()];if(r==null){Kr.globalLogger().warn("invalid log level - "+e);return}Lx=r}static from(e){return new Kr(e)}}Kr.errors=ps,Kr.levels=wm;const mN="bytes/5.7.0",on=new Kr(mN);function $x(t){return!!t.toHexString}function uu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return uu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function vN(t){return Ns(t)&&!(t.length%2)||xm(t)}function Fx(t){return typeof t=="number"&&t==t&&t%1===0}function xm(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!Fx(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function bn(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),uu(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),$x(t)&&(t=t.toHexString()),Ns(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":on.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ibn(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),uu(n)}function yN(t,e){t=bn(t),t.length>e&&on.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),uu(r)}function Ns(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const _m="0123456789abcdef";function Ii(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=_m[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),$x(t))return t.toHexString();if(Ns(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":on.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(xm(t)){let r="0x";for(let n=0;n>4]+_m[i&15]}return r}return on.throwArgumentError("invalid hexlify value","value",t)}function wN(t){if(typeof t!="string")t=Ii(t);else if(!Ns(t)||t.length%2)return null;return(t.length-2)/2}function jx(t,e,r){return typeof t!="string"?t=Ii(t):(!Ns(t)||t.length%2)&&on.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function fu(t,e){for(typeof t!="string"?t=Ii(t):Ns(t)||on.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&on.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Ux(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(vN(t)){let r=bn(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64))):r.length===65?(e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64)),e.v=r[64]):on.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:on.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Ii(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=yN(bn(e._vs),32);e._vs=Ii(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&on.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=Ii(i);e.s==null?e.s=o:e.s!==o&&on.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?on.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&on.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Ns(e.r)?on.throwArgumentError("signature missing or invalid r","signature",t):e.r=fu(e.r,32),e.s==null||!Ns(e.s)?on.throwArgumentError("signature missing or invalid s","signature",t):e.s=fu(e.s,32);const r=bn(e.s);r[0]>=128&&on.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=Ii(r);e._vs&&(Ns(e._vs)||on.throwArgumentError("signature invalid _vs","signature",t),e._vs=fu(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&on.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Em(t){return"0x"+dN.keccak_256(bn(t))}var Sm={exports:{}};Sm.exports,function(t){(function(e,r){function n(m,f){if(!m)throw new Error(f||"Assertion failed")}function i(m,f){m.super_=f;var p=function(){};p.prototype=f.prototype,m.prototype=new p,m.prototype.constructor=m}function s(m,f,p){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((f==="le"||f==="be")&&(p=f,f=10),this._init(m||0,f||10,p||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,p){return f.cmp(p)>0?f:p},s.min=function(f,p){return f.cmp(p)<0?f:p},s.prototype._init=function(f,p,v){if(typeof f=="number")return this._initNumber(f,p,v);if(typeof f=="object")return this._initArray(f,p,v);p==="hex"&&(p=16),n(p===(p|0)&&p>=2&&p<=36),f=f.toString().replace(/\s+/g,"");var x=0;f[0]==="-"&&(x++,this.negative=1),x=0;x-=3)S=f[x]|f[x-1]<<8|f[x-2]<<16,this.words[_]|=S<>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);else if(v==="le")for(x=0,_=0;x>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);return this._strip()};function a(m,f){var p=m.charCodeAt(f);if(p>=48&&p<=57)return p-48;if(p>=65&&p<=70)return p-55;if(p>=97&&p<=102)return p-87;n(!1,"Invalid character in "+m)}function u(m,f,p){var v=a(m,p);return p-1>=f&&(v|=a(m,p-1)<<4),v}s.prototype._parseHex=function(f,p,v){this.length=Math.ceil((f.length-p)/6),this.words=new Array(this.length);for(var x=0;x=p;x-=2)b=u(f,p,x)<<_,this.words[S]|=b&67108863,_>=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8;else{var M=f.length-p;for(x=M%2===0?p+1:p;x=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8}this._strip()};function l(m,f,p,v){for(var x=0,_=0,S=Math.min(m.length,p),b=f;b=49?_=M-49+10:M>=17?_=M-17+10:_=M,n(M>=0&&_1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=g}catch{s.prototype.inspect=g}else s.prototype.inspect=g;function g(){return(this.red?""}var y=["","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"],A=[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,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(f,p){f=f||10,p=p|0||1;var v;if(f===16||f==="hex"){v="";for(var x=0,_=0,S=0;S>>24-x&16777215,x+=2,x>=26&&(x-=26,S--),_!==0||S!==this.length-1?v=y[6-M.length]+M+v:v=M+v}for(_!==0&&(v=_.toString(16)+v);v.length%p!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(f===(f|0)&&f>=2&&f<=36){var I=A[f],F=P[f];v="";var ae=this.clone();for(ae.negative=0;!ae.isZero();){var N=ae.modrn(F).toString(f);ae=ae.idivn(F),ae.isZero()?v=N+v:v=y[I-N.length]+N+v}for(this.isZero()&&(v="0"+v);v.length%p!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,p){return this.toArrayLike(o,f,p)}),s.prototype.toArray=function(f,p){return this.toArrayLike(Array,f,p)};var O=function(f,p){return f.allocUnsafe?f.allocUnsafe(p):new f(p)};s.prototype.toArrayLike=function(f,p,v){this._strip();var x=this.byteLength(),_=v||Math.max(1,x);n(x<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var S=O(f,_),b=p==="le"?"LE":"BE";return this["_toArrayLike"+b](S,x),S},s.prototype._toArrayLikeLE=function(f,p){for(var v=0,x=0,_=0,S=0;_>8&255),v>16&255),S===6?(v>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v=0&&(f[v--]=b>>8&255),v>=0&&(f[v--]=b>>16&255),S===6?(v>=0&&(f[v--]=b>>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v>=0)for(f[v--]=x;v>=0;)f[v--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var p=f,v=0;return p>=4096&&(v+=13,p>>>=13),p>=64&&(v+=7,p>>>=7),p>=8&&(v+=4,p>>>=4),p>=2&&(v+=2,p>>>=2),v+p},s.prototype._zeroBits=function(f){if(f===0)return 26;var p=f,v=0;return p&8191||(v+=13,p>>>=13),p&127||(v+=7,p>>>=7),p&15||(v+=4,p>>>=4),p&3||(v+=2,p>>>=2),p&1||v++,v},s.prototype.bitLength=function(){var f=this.words[this.length-1],p=this._countBits(f);return(this.length-1)*26+p};function D(m){for(var f=new Array(m.bitLength()),p=0;p>>x&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,p=0;pf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var p;this.length>f.length?p=f:p=this;for(var v=0;vf.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var p,v;this.length>f.length?(p=this,v=f):(p=f,v=this);for(var x=0;xf.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var p=Math.ceil(f/26)|0,v=f%26;this._expand(p),v>0&&p--;for(var x=0;x0&&(this.words[x]=~this.words[x]&67108863>>26-v),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,p){n(typeof f=="number"&&f>=0);var v=f/26|0,x=f%26;return this._expand(v+1),p?this.words[v]=this.words[v]|1<f.length?(v=this,x=f):(v=f,x=this);for(var _=0,S=0;S>>26;for(;_!==0&&S>>26;if(this.length=v.length,_!==0)this.words[this.length]=_,this.length++;else if(v!==this)for(;Sf.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var p=this.iadd(f);return f.negative=1,p._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var v=this.cmp(f);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,_;v>0?(x=this,_=f):(x=f,_=this);for(var S=0,b=0;b<_.length;b++)p=(x.words[b]|0)-(_.words[b]|0)+S,S=p>>26,this.words[b]=p&67108863;for(;S!==0&&b>26,this.words[b]=p&67108863;if(S===0&&b>>26,ae=M&67108863,N=Math.min(I,f.length-1),se=Math.max(0,I-m.length+1);se<=N;se++){var ee=I-se|0;x=m.words[ee]|0,_=f.words[se]|0,S=x*_+ae,F+=S/67108864|0,ae=S&67108863}p.words[I]=ae|0,M=F|0}return M!==0?p.words[I]=M|0:p.length--,p._strip()}var B=function(f,p,v){var x=f.words,_=p.words,S=v.words,b=0,M,I,F,ae=x[0]|0,N=ae&8191,se=ae>>>13,ee=x[1]|0,X=ee&8191,Q=ee>>>13,R=x[2]|0,Z=R&8191,te=R>>>13,he=x[3]|0,ie=he&8191,fe=he>>>13,ve=x[4]|0,Me=ve&8191,Ne=ve>>>13,Te=x[5]|0,$e=Te&8191,Ie=Te>>>13,Le=x[6]|0,Ve=Le&8191,ke=Le>>>13,ze=x[7]|0,He=ze&8191,Ee=ze>>>13,Qe=x[8]|0,ct=Qe&8191,Be=Qe>>>13,et=x[9]|0,rt=et&8191,Je=et>>>13,pt=_[0]|0,ht=pt&8191,ft=pt>>>13,Ht=_[1]|0,Jt=Ht&8191,St=Ht>>>13,er=_[2]|0,Xt=er&8191,Ot=er>>>13,Bt=_[3]|0,Tt=Bt&8191,vt=Bt>>>13,Dt=_[4]|0,Lt=Dt&8191,bt=Dt>>>13,$t=_[5]|0,jt=$t&8191,nt=$t>>>13,Ft=_[6]|0,$=Ft&8191,H=Ft>>>13,V=_[7]|0,C=V&8191,Y=V>>>13,q=_[8]|0,oe=q&8191,ge=q>>>13,xe=_[9]|0,Re=xe&8191,De=xe>>>13;v.negative=f.negative^p.negative,v.length=19,M=Math.imul(N,ht),I=Math.imul(N,ft),I=I+Math.imul(se,ht)|0,F=Math.imul(se,ft);var it=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(it>>>26)|0,it&=67108863,M=Math.imul(X,ht),I=Math.imul(X,ft),I=I+Math.imul(Q,ht)|0,F=Math.imul(Q,ft),M=M+Math.imul(N,Jt)|0,I=I+Math.imul(N,St)|0,I=I+Math.imul(se,Jt)|0,F=F+Math.imul(se,St)|0;var Ue=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,M=Math.imul(Z,ht),I=Math.imul(Z,ft),I=I+Math.imul(te,ht)|0,F=Math.imul(te,ft),M=M+Math.imul(X,Jt)|0,I=I+Math.imul(X,St)|0,I=I+Math.imul(Q,Jt)|0,F=F+Math.imul(Q,St)|0,M=M+Math.imul(N,Xt)|0,I=I+Math.imul(N,Ot)|0,I=I+Math.imul(se,Xt)|0,F=F+Math.imul(se,Ot)|0;var gt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(gt>>>26)|0,gt&=67108863,M=Math.imul(ie,ht),I=Math.imul(ie,ft),I=I+Math.imul(fe,ht)|0,F=Math.imul(fe,ft),M=M+Math.imul(Z,Jt)|0,I=I+Math.imul(Z,St)|0,I=I+Math.imul(te,Jt)|0,F=F+Math.imul(te,St)|0,M=M+Math.imul(X,Xt)|0,I=I+Math.imul(X,Ot)|0,I=I+Math.imul(Q,Xt)|0,F=F+Math.imul(Q,Ot)|0,M=M+Math.imul(N,Tt)|0,I=I+Math.imul(N,vt)|0,I=I+Math.imul(se,Tt)|0,F=F+Math.imul(se,vt)|0;var st=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(st>>>26)|0,st&=67108863,M=Math.imul(Me,ht),I=Math.imul(Me,ft),I=I+Math.imul(Ne,ht)|0,F=Math.imul(Ne,ft),M=M+Math.imul(ie,Jt)|0,I=I+Math.imul(ie,St)|0,I=I+Math.imul(fe,Jt)|0,F=F+Math.imul(fe,St)|0,M=M+Math.imul(Z,Xt)|0,I=I+Math.imul(Z,Ot)|0,I=I+Math.imul(te,Xt)|0,F=F+Math.imul(te,Ot)|0,M=M+Math.imul(X,Tt)|0,I=I+Math.imul(X,vt)|0,I=I+Math.imul(Q,Tt)|0,F=F+Math.imul(Q,vt)|0,M=M+Math.imul(N,Lt)|0,I=I+Math.imul(N,bt)|0,I=I+Math.imul(se,Lt)|0,F=F+Math.imul(se,bt)|0;var tt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(tt>>>26)|0,tt&=67108863,M=Math.imul($e,ht),I=Math.imul($e,ft),I=I+Math.imul(Ie,ht)|0,F=Math.imul(Ie,ft),M=M+Math.imul(Me,Jt)|0,I=I+Math.imul(Me,St)|0,I=I+Math.imul(Ne,Jt)|0,F=F+Math.imul(Ne,St)|0,M=M+Math.imul(ie,Xt)|0,I=I+Math.imul(ie,Ot)|0,I=I+Math.imul(fe,Xt)|0,F=F+Math.imul(fe,Ot)|0,M=M+Math.imul(Z,Tt)|0,I=I+Math.imul(Z,vt)|0,I=I+Math.imul(te,Tt)|0,F=F+Math.imul(te,vt)|0,M=M+Math.imul(X,Lt)|0,I=I+Math.imul(X,bt)|0,I=I+Math.imul(Q,Lt)|0,F=F+Math.imul(Q,bt)|0,M=M+Math.imul(N,jt)|0,I=I+Math.imul(N,nt)|0,I=I+Math.imul(se,jt)|0,F=F+Math.imul(se,nt)|0;var At=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(At>>>26)|0,At&=67108863,M=Math.imul(Ve,ht),I=Math.imul(Ve,ft),I=I+Math.imul(ke,ht)|0,F=Math.imul(ke,ft),M=M+Math.imul($e,Jt)|0,I=I+Math.imul($e,St)|0,I=I+Math.imul(Ie,Jt)|0,F=F+Math.imul(Ie,St)|0,M=M+Math.imul(Me,Xt)|0,I=I+Math.imul(Me,Ot)|0,I=I+Math.imul(Ne,Xt)|0,F=F+Math.imul(Ne,Ot)|0,M=M+Math.imul(ie,Tt)|0,I=I+Math.imul(ie,vt)|0,I=I+Math.imul(fe,Tt)|0,F=F+Math.imul(fe,vt)|0,M=M+Math.imul(Z,Lt)|0,I=I+Math.imul(Z,bt)|0,I=I+Math.imul(te,Lt)|0,F=F+Math.imul(te,bt)|0,M=M+Math.imul(X,jt)|0,I=I+Math.imul(X,nt)|0,I=I+Math.imul(Q,jt)|0,F=F+Math.imul(Q,nt)|0,M=M+Math.imul(N,$)|0,I=I+Math.imul(N,H)|0,I=I+Math.imul(se,$)|0,F=F+Math.imul(se,H)|0;var Rt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,M=Math.imul(He,ht),I=Math.imul(He,ft),I=I+Math.imul(Ee,ht)|0,F=Math.imul(Ee,ft),M=M+Math.imul(Ve,Jt)|0,I=I+Math.imul(Ve,St)|0,I=I+Math.imul(ke,Jt)|0,F=F+Math.imul(ke,St)|0,M=M+Math.imul($e,Xt)|0,I=I+Math.imul($e,Ot)|0,I=I+Math.imul(Ie,Xt)|0,F=F+Math.imul(Ie,Ot)|0,M=M+Math.imul(Me,Tt)|0,I=I+Math.imul(Me,vt)|0,I=I+Math.imul(Ne,Tt)|0,F=F+Math.imul(Ne,vt)|0,M=M+Math.imul(ie,Lt)|0,I=I+Math.imul(ie,bt)|0,I=I+Math.imul(fe,Lt)|0,F=F+Math.imul(fe,bt)|0,M=M+Math.imul(Z,jt)|0,I=I+Math.imul(Z,nt)|0,I=I+Math.imul(te,jt)|0,F=F+Math.imul(te,nt)|0,M=M+Math.imul(X,$)|0,I=I+Math.imul(X,H)|0,I=I+Math.imul(Q,$)|0,F=F+Math.imul(Q,H)|0,M=M+Math.imul(N,C)|0,I=I+Math.imul(N,Y)|0,I=I+Math.imul(se,C)|0,F=F+Math.imul(se,Y)|0;var Mt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,M=Math.imul(ct,ht),I=Math.imul(ct,ft),I=I+Math.imul(Be,ht)|0,F=Math.imul(Be,ft),M=M+Math.imul(He,Jt)|0,I=I+Math.imul(He,St)|0,I=I+Math.imul(Ee,Jt)|0,F=F+Math.imul(Ee,St)|0,M=M+Math.imul(Ve,Xt)|0,I=I+Math.imul(Ve,Ot)|0,I=I+Math.imul(ke,Xt)|0,F=F+Math.imul(ke,Ot)|0,M=M+Math.imul($e,Tt)|0,I=I+Math.imul($e,vt)|0,I=I+Math.imul(Ie,Tt)|0,F=F+Math.imul(Ie,vt)|0,M=M+Math.imul(Me,Lt)|0,I=I+Math.imul(Me,bt)|0,I=I+Math.imul(Ne,Lt)|0,F=F+Math.imul(Ne,bt)|0,M=M+Math.imul(ie,jt)|0,I=I+Math.imul(ie,nt)|0,I=I+Math.imul(fe,jt)|0,F=F+Math.imul(fe,nt)|0,M=M+Math.imul(Z,$)|0,I=I+Math.imul(Z,H)|0,I=I+Math.imul(te,$)|0,F=F+Math.imul(te,H)|0,M=M+Math.imul(X,C)|0,I=I+Math.imul(X,Y)|0,I=I+Math.imul(Q,C)|0,F=F+Math.imul(Q,Y)|0,M=M+Math.imul(N,oe)|0,I=I+Math.imul(N,ge)|0,I=I+Math.imul(se,oe)|0,F=F+Math.imul(se,ge)|0;var Et=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Et>>>26)|0,Et&=67108863,M=Math.imul(rt,ht),I=Math.imul(rt,ft),I=I+Math.imul(Je,ht)|0,F=Math.imul(Je,ft),M=M+Math.imul(ct,Jt)|0,I=I+Math.imul(ct,St)|0,I=I+Math.imul(Be,Jt)|0,F=F+Math.imul(Be,St)|0,M=M+Math.imul(He,Xt)|0,I=I+Math.imul(He,Ot)|0,I=I+Math.imul(Ee,Xt)|0,F=F+Math.imul(Ee,Ot)|0,M=M+Math.imul(Ve,Tt)|0,I=I+Math.imul(Ve,vt)|0,I=I+Math.imul(ke,Tt)|0,F=F+Math.imul(ke,vt)|0,M=M+Math.imul($e,Lt)|0,I=I+Math.imul($e,bt)|0,I=I+Math.imul(Ie,Lt)|0,F=F+Math.imul(Ie,bt)|0,M=M+Math.imul(Me,jt)|0,I=I+Math.imul(Me,nt)|0,I=I+Math.imul(Ne,jt)|0,F=F+Math.imul(Ne,nt)|0,M=M+Math.imul(ie,$)|0,I=I+Math.imul(ie,H)|0,I=I+Math.imul(fe,$)|0,F=F+Math.imul(fe,H)|0,M=M+Math.imul(Z,C)|0,I=I+Math.imul(Z,Y)|0,I=I+Math.imul(te,C)|0,F=F+Math.imul(te,Y)|0,M=M+Math.imul(X,oe)|0,I=I+Math.imul(X,ge)|0,I=I+Math.imul(Q,oe)|0,F=F+Math.imul(Q,ge)|0,M=M+Math.imul(N,Re)|0,I=I+Math.imul(N,De)|0,I=I+Math.imul(se,Re)|0,F=F+Math.imul(se,De)|0;var dt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(dt>>>26)|0,dt&=67108863,M=Math.imul(rt,Jt),I=Math.imul(rt,St),I=I+Math.imul(Je,Jt)|0,F=Math.imul(Je,St),M=M+Math.imul(ct,Xt)|0,I=I+Math.imul(ct,Ot)|0,I=I+Math.imul(Be,Xt)|0,F=F+Math.imul(Be,Ot)|0,M=M+Math.imul(He,Tt)|0,I=I+Math.imul(He,vt)|0,I=I+Math.imul(Ee,Tt)|0,F=F+Math.imul(Ee,vt)|0,M=M+Math.imul(Ve,Lt)|0,I=I+Math.imul(Ve,bt)|0,I=I+Math.imul(ke,Lt)|0,F=F+Math.imul(ke,bt)|0,M=M+Math.imul($e,jt)|0,I=I+Math.imul($e,nt)|0,I=I+Math.imul(Ie,jt)|0,F=F+Math.imul(Ie,nt)|0,M=M+Math.imul(Me,$)|0,I=I+Math.imul(Me,H)|0,I=I+Math.imul(Ne,$)|0,F=F+Math.imul(Ne,H)|0,M=M+Math.imul(ie,C)|0,I=I+Math.imul(ie,Y)|0,I=I+Math.imul(fe,C)|0,F=F+Math.imul(fe,Y)|0,M=M+Math.imul(Z,oe)|0,I=I+Math.imul(Z,ge)|0,I=I+Math.imul(te,oe)|0,F=F+Math.imul(te,ge)|0,M=M+Math.imul(X,Re)|0,I=I+Math.imul(X,De)|0,I=I+Math.imul(Q,Re)|0,F=F+Math.imul(Q,De)|0;var _t=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(_t>>>26)|0,_t&=67108863,M=Math.imul(rt,Xt),I=Math.imul(rt,Ot),I=I+Math.imul(Je,Xt)|0,F=Math.imul(Je,Ot),M=M+Math.imul(ct,Tt)|0,I=I+Math.imul(ct,vt)|0,I=I+Math.imul(Be,Tt)|0,F=F+Math.imul(Be,vt)|0,M=M+Math.imul(He,Lt)|0,I=I+Math.imul(He,bt)|0,I=I+Math.imul(Ee,Lt)|0,F=F+Math.imul(Ee,bt)|0,M=M+Math.imul(Ve,jt)|0,I=I+Math.imul(Ve,nt)|0,I=I+Math.imul(ke,jt)|0,F=F+Math.imul(ke,nt)|0,M=M+Math.imul($e,$)|0,I=I+Math.imul($e,H)|0,I=I+Math.imul(Ie,$)|0,F=F+Math.imul(Ie,H)|0,M=M+Math.imul(Me,C)|0,I=I+Math.imul(Me,Y)|0,I=I+Math.imul(Ne,C)|0,F=F+Math.imul(Ne,Y)|0,M=M+Math.imul(ie,oe)|0,I=I+Math.imul(ie,ge)|0,I=I+Math.imul(fe,oe)|0,F=F+Math.imul(fe,ge)|0,M=M+Math.imul(Z,Re)|0,I=I+Math.imul(Z,De)|0,I=I+Math.imul(te,Re)|0,F=F+Math.imul(te,De)|0;var ot=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(ot>>>26)|0,ot&=67108863,M=Math.imul(rt,Tt),I=Math.imul(rt,vt),I=I+Math.imul(Je,Tt)|0,F=Math.imul(Je,vt),M=M+Math.imul(ct,Lt)|0,I=I+Math.imul(ct,bt)|0,I=I+Math.imul(Be,Lt)|0,F=F+Math.imul(Be,bt)|0,M=M+Math.imul(He,jt)|0,I=I+Math.imul(He,nt)|0,I=I+Math.imul(Ee,jt)|0,F=F+Math.imul(Ee,nt)|0,M=M+Math.imul(Ve,$)|0,I=I+Math.imul(Ve,H)|0,I=I+Math.imul(ke,$)|0,F=F+Math.imul(ke,H)|0,M=M+Math.imul($e,C)|0,I=I+Math.imul($e,Y)|0,I=I+Math.imul(Ie,C)|0,F=F+Math.imul(Ie,Y)|0,M=M+Math.imul(Me,oe)|0,I=I+Math.imul(Me,ge)|0,I=I+Math.imul(Ne,oe)|0,F=F+Math.imul(Ne,ge)|0,M=M+Math.imul(ie,Re)|0,I=I+Math.imul(ie,De)|0,I=I+Math.imul(fe,Re)|0,F=F+Math.imul(fe,De)|0;var wt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(wt>>>26)|0,wt&=67108863,M=Math.imul(rt,Lt),I=Math.imul(rt,bt),I=I+Math.imul(Je,Lt)|0,F=Math.imul(Je,bt),M=M+Math.imul(ct,jt)|0,I=I+Math.imul(ct,nt)|0,I=I+Math.imul(Be,jt)|0,F=F+Math.imul(Be,nt)|0,M=M+Math.imul(He,$)|0,I=I+Math.imul(He,H)|0,I=I+Math.imul(Ee,$)|0,F=F+Math.imul(Ee,H)|0,M=M+Math.imul(Ve,C)|0,I=I+Math.imul(Ve,Y)|0,I=I+Math.imul(ke,C)|0,F=F+Math.imul(ke,Y)|0,M=M+Math.imul($e,oe)|0,I=I+Math.imul($e,ge)|0,I=I+Math.imul(Ie,oe)|0,F=F+Math.imul(Ie,ge)|0,M=M+Math.imul(Me,Re)|0,I=I+Math.imul(Me,De)|0,I=I+Math.imul(Ne,Re)|0,F=F+Math.imul(Ne,De)|0;var lt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(lt>>>26)|0,lt&=67108863,M=Math.imul(rt,jt),I=Math.imul(rt,nt),I=I+Math.imul(Je,jt)|0,F=Math.imul(Je,nt),M=M+Math.imul(ct,$)|0,I=I+Math.imul(ct,H)|0,I=I+Math.imul(Be,$)|0,F=F+Math.imul(Be,H)|0,M=M+Math.imul(He,C)|0,I=I+Math.imul(He,Y)|0,I=I+Math.imul(Ee,C)|0,F=F+Math.imul(Ee,Y)|0,M=M+Math.imul(Ve,oe)|0,I=I+Math.imul(Ve,ge)|0,I=I+Math.imul(ke,oe)|0,F=F+Math.imul(ke,ge)|0,M=M+Math.imul($e,Re)|0,I=I+Math.imul($e,De)|0,I=I+Math.imul(Ie,Re)|0,F=F+Math.imul(Ie,De)|0;var at=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(at>>>26)|0,at&=67108863,M=Math.imul(rt,$),I=Math.imul(rt,H),I=I+Math.imul(Je,$)|0,F=Math.imul(Je,H),M=M+Math.imul(ct,C)|0,I=I+Math.imul(ct,Y)|0,I=I+Math.imul(Be,C)|0,F=F+Math.imul(Be,Y)|0,M=M+Math.imul(He,oe)|0,I=I+Math.imul(He,ge)|0,I=I+Math.imul(Ee,oe)|0,F=F+Math.imul(Ee,ge)|0,M=M+Math.imul(Ve,Re)|0,I=I+Math.imul(Ve,De)|0,I=I+Math.imul(ke,Re)|0,F=F+Math.imul(ke,De)|0;var Ae=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,M=Math.imul(rt,C),I=Math.imul(rt,Y),I=I+Math.imul(Je,C)|0,F=Math.imul(Je,Y),M=M+Math.imul(ct,oe)|0,I=I+Math.imul(ct,ge)|0,I=I+Math.imul(Be,oe)|0,F=F+Math.imul(Be,ge)|0,M=M+Math.imul(He,Re)|0,I=I+Math.imul(He,De)|0,I=I+Math.imul(Ee,Re)|0,F=F+Math.imul(Ee,De)|0;var Pe=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,M=Math.imul(rt,oe),I=Math.imul(rt,ge),I=I+Math.imul(Je,oe)|0,F=Math.imul(Je,ge),M=M+Math.imul(ct,Re)|0,I=I+Math.imul(ct,De)|0,I=I+Math.imul(Be,Re)|0,F=F+Math.imul(Be,De)|0;var Ge=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,M=Math.imul(rt,Re),I=Math.imul(rt,De),I=I+Math.imul(Je,Re)|0,F=Math.imul(Je,De);var je=(b+M|0)+((I&8191)<<13)|0;return b=(F+(I>>>13)|0)+(je>>>26)|0,je&=67108863,S[0]=it,S[1]=Ue,S[2]=gt,S[3]=st,S[4]=tt,S[5]=At,S[6]=Rt,S[7]=Mt,S[8]=Et,S[9]=dt,S[10]=_t,S[11]=ot,S[12]=wt,S[13]=lt,S[14]=at,S[15]=Ae,S[16]=Pe,S[17]=Ge,S[18]=je,b!==0&&(S[19]=b,v.length++),v};Math.imul||(B=k);function j(m,f,p){p.negative=f.negative^m.negative,p.length=m.length+f.length;for(var v=0,x=0,_=0;_>>26)|0,x+=S>>>26,S&=67108863}p.words[_]=b,v=S,S=x}return v!==0?p.words[_]=v:p.length--,p._strip()}function U(m,f,p){return j(m,f,p)}s.prototype.mulTo=function(f,p){var v,x=this.length+f.length;return this.length===10&&f.length===10?v=B(this,f,p):x<63?v=k(this,f,p):x<1024?v=j(this,f,p):v=U(this,f,p),v},s.prototype.mul=function(f){var p=new s(null);return p.words=new Array(this.length+f.length),this.mulTo(f,p)},s.prototype.mulf=function(f){var p=new s(null);return p.words=new Array(this.length+f.length),U(this,f,p)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var p=f<0;p&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var v=0,x=0;x>=26,v+=_/67108864|0,v+=S>>>26,this.words[x]=S&67108863}return v!==0&&(this.words[x]=v,this.length++),p?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var p=D(f);if(p.length===0)return new s(1);for(var v=this,x=0;x=0);var p=f%26,v=(f-p)/26,x=67108863>>>26-p<<26-p,_;if(p!==0){var S=0;for(_=0;_>>26-p}S&&(this.words[_]=S,this.length++)}if(v!==0){for(_=this.length-1;_>=0;_--)this.words[_+v]=this.words[_];for(_=0;_=0);var x;p?x=(p-p%26)/26:x=0;var _=f%26,S=Math.min((f-_)/26,this.length),b=67108863^67108863>>>_<<_,M=v;if(x-=S,x=Math.max(0,x),M){for(var I=0;IS)for(this.length-=S,I=0;I=0&&(F!==0||I>=x);I--){var ae=this.words[I]|0;this.words[I]=F<<26-_|ae>>>_,F=ae&b}return M&&F!==0&&(M.words[M.length++]=F),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,p,v){return n(this.negative===0),this.iushrn(f,p,v)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var p=f%26,v=(f-p)/26,x=1<=0);var p=f%26,v=(f-p)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(p!==0&&v++,this.length=Math.min(v,this.length),p!==0){var x=67108863^67108863>>>p<=67108864;p++)this.words[p]-=67108864,p===this.length-1?this.words[p+1]=1:this.words[p+1]++;return this.length=Math.max(this.length,p+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var p=0;p>26)-(M/67108864|0),this.words[_+v]=S&67108863}for(;_>26,this.words[_+v]=S&67108863;if(b===0)return this._strip();for(n(b===-1),b=0,_=0;_>26,this.words[_]=S&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,p){var v=this.length-f.length,x=this.clone(),_=f,S=_.words[_.length-1]|0,b=this._countBits(S);v=26-b,v!==0&&(_=_.ushln(v),x.iushln(v),S=_.words[_.length-1]|0);var M=x.length-_.length,I;if(p!=="mod"){I=new s(null),I.length=M+1,I.words=new Array(I.length);for(var F=0;F=0;N--){var se=(x.words[_.length+N]|0)*67108864+(x.words[_.length+N-1]|0);for(se=Math.min(se/S|0,67108863),x._ishlnsubmul(_,se,N);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(_,1,N),x.isZero()||(x.negative^=1);I&&(I.words[N]=se)}return I&&I._strip(),x._strip(),p!=="div"&&v!==0&&x.iushrn(v),{div:I||null,mod:x}},s.prototype.divmod=function(f,p,v){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,_,S;return this.negative!==0&&f.negative===0?(S=this.neg().divmod(f,p),p!=="mod"&&(x=S.div.neg()),p!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.iadd(f)),{div:x,mod:_}):this.negative===0&&f.negative!==0?(S=this.divmod(f.neg(),p),p!=="mod"&&(x=S.div.neg()),{div:x,mod:S.mod}):this.negative&f.negative?(S=this.neg().divmod(f.neg(),p),p!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.isub(f)),{div:S.div,mod:_}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?p==="div"?{div:this.divn(f.words[0]),mod:null}:p==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,p)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var p=this.divmod(f);if(p.mod.isZero())return p.div;var v=p.div.negative!==0?p.mod.isub(f):p.mod,x=f.ushrn(1),_=f.andln(1),S=v.cmp(x);return S<0||_===1&&S===0?p.div:p.div.negative!==0?p.div.isubn(1):p.div.iaddn(1)},s.prototype.modrn=function(f){var p=f<0;p&&(f=-f),n(f<=67108863);for(var v=(1<<26)%f,x=0,_=this.length-1;_>=0;_--)x=(v*x+(this.words[_]|0))%f;return p?-x:x},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var p=f<0;p&&(f=-f),n(f<=67108863);for(var v=0,x=this.length-1;x>=0;x--){var _=(this.words[x]|0)+v*67108864;this.words[x]=_/f|0,v=_%f}return this._strip(),p?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var p=this,v=f.clone();p.negative!==0?p=p.umod(f):p=p.clone();for(var x=new s(1),_=new s(0),S=new s(0),b=new s(1),M=0;p.isEven()&&v.isEven();)p.iushrn(1),v.iushrn(1),++M;for(var I=v.clone(),F=p.clone();!p.isZero();){for(var ae=0,N=1;!(p.words[0]&N)&&ae<26;++ae,N<<=1);if(ae>0)for(p.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(I),_.isub(F)),x.iushrn(1),_.iushrn(1);for(var se=0,ee=1;!(v.words[0]&ee)&&se<26;++se,ee<<=1);if(se>0)for(v.iushrn(se);se-- >0;)(S.isOdd()||b.isOdd())&&(S.iadd(I),b.isub(F)),S.iushrn(1),b.iushrn(1);p.cmp(v)>=0?(p.isub(v),x.isub(S),_.isub(b)):(v.isub(p),S.isub(x),b.isub(_))}return{a:S,b,gcd:v.iushln(M)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var p=this,v=f.clone();p.negative!==0?p=p.umod(f):p=p.clone();for(var x=new s(1),_=new s(0),S=v.clone();p.cmpn(1)>0&&v.cmpn(1)>0;){for(var b=0,M=1;!(p.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(p.iushrn(b);b-- >0;)x.isOdd()&&x.iadd(S),x.iushrn(1);for(var I=0,F=1;!(v.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(v.iushrn(I);I-- >0;)_.isOdd()&&_.iadd(S),_.iushrn(1);p.cmp(v)>=0?(p.isub(v),x.isub(_)):(v.isub(p),_.isub(x))}var ae;return p.cmpn(1)===0?ae=x:ae=_,ae.cmpn(0)<0&&ae.iadd(f),ae},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var p=this.clone(),v=f.clone();p.negative=0,v.negative=0;for(var x=0;p.isEven()&&v.isEven();x++)p.iushrn(1),v.iushrn(1);do{for(;p.isEven();)p.iushrn(1);for(;v.isEven();)v.iushrn(1);var _=p.cmp(v);if(_<0){var S=p;p=v,v=S}else if(_===0||v.cmpn(1)===0)break;p.isub(v)}while(!0);return v.iushln(x)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var p=f%26,v=(f-p)/26,x=1<>>26,b&=67108863,this.words[S]=b}return _!==0&&(this.words[S]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var p=f<0;if(this.negative!==0&&!p)return-1;if(this.negative===0&&p)return 1;this._strip();var v;if(this.length>1)v=1;else{p&&(f=-f),n(f<=67108863,"Number is too big");var x=this.words[0]|0;v=x===f?0:xf.length)return 1;if(this.length=0;v--){var x=this.words[v]|0,_=f.words[v]|0;if(x!==_){x<_?p=-1:x>_&&(p=1);break}}return p},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new G(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var K={k256:null,p224:null,p192:null,p25519:null};function J(m,f){this.name=m,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}J.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},J.prototype.ireduce=function(f){var p=f,v;do this.split(p,this.tmp),p=this.imulK(p),p=p.iadd(this.tmp),v=p.bitLength();while(v>this.n);var x=v0?p.isub(this.p):p.strip!==void 0?p.strip():p._strip(),p},J.prototype.split=function(f,p){f.iushrn(this.n,0,p)},J.prototype.imulK=function(f){return f.imul(this.k)};function T(){J.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(T,J),T.prototype.split=function(f,p){for(var v=4194303,x=Math.min(f.length,9),_=0;_>>22,S=b}S>>>=22,f.words[_-10]=S,S===0&&f.length>10?f.length-=10:f.length-=9},T.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var p=0,v=0;v>>=26,f.words[v]=_,p=x}return p!==0&&(f.words[f.length++]=p),f},s._prime=function(f){if(K[f])return K[f];var p;if(f==="k256")p=new T;else if(f==="p224")p=new z;else if(f==="p192")p=new ue;else if(f==="p25519")p=new _e;else throw new Error("Unknown prime "+f);return K[f]=p,p};function G(m){if(typeof m=="string"){var f=s._prime(m);this.m=f.p,this.prime=f}else n(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}G.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},G.prototype._verify2=function(f,p){n((f.negative|p.negative)===0,"red works only with positives"),n(f.red&&f.red===p.red,"red works only with red numbers")},G.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(d(f,f.umod(this.m)._forceRed(this)),f)},G.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},G.prototype.add=function(f,p){this._verify2(f,p);var v=f.add(p);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},G.prototype.iadd=function(f,p){this._verify2(f,p);var v=f.iadd(p);return v.cmp(this.m)>=0&&v.isub(this.m),v},G.prototype.sub=function(f,p){this._verify2(f,p);var v=f.sub(p);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},G.prototype.isub=function(f,p){this._verify2(f,p);var v=f.isub(p);return v.cmpn(0)<0&&v.iadd(this.m),v},G.prototype.shl=function(f,p){return this._verify1(f),this.imod(f.ushln(p))},G.prototype.imul=function(f,p){return this._verify2(f,p),this.imod(f.imul(p))},G.prototype.mul=function(f,p){return this._verify2(f,p),this.imod(f.mul(p))},G.prototype.isqr=function(f){return this.imul(f,f.clone())},G.prototype.sqr=function(f){return this.mul(f,f)},G.prototype.sqrt=function(f){if(f.isZero())return f.clone();var p=this.m.andln(3);if(n(p%2===1),p===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(f,v)}for(var x=this.m.subn(1),_=0;!x.isZero()&&x.andln(1)===0;)_++,x.iushrn(1);n(!x.isZero());var S=new s(1).toRed(this),b=S.redNeg(),M=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,M).cmp(b)!==0;)I.redIAdd(b);for(var F=this.pow(I,x),ae=this.pow(f,x.addn(1).iushrn(1)),N=this.pow(f,x),se=_;N.cmp(S)!==0;){for(var ee=N,X=0;ee.cmp(S)!==0;X++)ee=ee.redSqr();n(X=0;_--){for(var F=p.words[_],ae=I-1;ae>=0;ae--){var N=F>>ae&1;if(S!==x[0]&&(S=this.sqr(S)),N===0&&b===0){M=0;continue}b<<=1,b|=N,M++,!(M!==v&&(_!==0||ae!==0))&&(S=this.mul(S,x[b]),M=0,b=0)}I=26}return S},G.prototype.convertTo=function(f){var p=f.umod(this.m);return p===f?p.clone():p},G.prototype.convertFrom=function(f){var p=f.clone();return p.red=null,p},s.mont=function(f){return new E(f)};function E(m){G.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(E,G),E.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},E.prototype.convertFrom=function(f){var p=this.imod(f.mul(this.rinv));return p.red=null,p},E.prototype.imul=function(f,p){if(f.isZero()||p.isZero())return f.words[0]=0,f.length=1,f;var v=f.imul(p),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.mul=function(f,p){if(f.isZero()||p.isZero())return new s(0)._forceRed(this);var v=f.mul(p),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.invm=function(f){var p=this.imod(f._invmp(this.m).mul(this.r2));return p._forceRed(this)}})(t,nn)}(Sm);var xN=Sm.exports;const rr=Ui(xN);var _N=rr.BN;function EN(t){return new _N(t,36).toString(16)}const SN="strings/5.7.0",AN=new Kr(SN);var bd;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(bd||(bd={}));var qx;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(qx||(qx={}));function Am(t,e=bd.current){e!=bd.current&&(AN.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return bn(r)}const PN=`Ethereum Signed Message: -`;function zx(t){return typeof t=="string"&&(t=Am(t)),Em(bN([Am(PN),Am(String(t.length)),t]))}const MN="address/5.7.0",sl=new Kr(MN);function Hx(t){Ns(t,20)||sl.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=bn(Em(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const IN=9007199254740991;function CN(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const Pm={};for(let t=0;t<10;t++)Pm[String(t)]=String(t);for(let t=0;t<26;t++)Pm[String.fromCharCode(65+t)]=String(10+t);const Wx=Math.floor(CN(IN));function TN(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Pm[n]).join("");for(;e.length>=Wx;){let n=e.substring(0,Wx);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function RN(t){let e=null;if(typeof t!="string"&&sl.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=Hx(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&sl.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==TN(t)&&sl.throwArgumentError("bad icap checksum","address",t),e=EN(t.substring(4));e.length<40;)e="0"+e;e=Hx("0x"+e)}else sl.throwArgumentError("invalid address","address",t);return e}function ol(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var al={},yr={},Ja=Kx;function Kx(t,e){if(!t)throw new Error(e||"Assertion failed")}Kx.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var Mm={exports:{}};typeof Object.create=="function"?Mm.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Mm.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var yd=Mm.exports,DN=Ja,ON=yd;yr.inherits=ON;function NN(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function LN(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):NN(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}yr.htonl=Vx;function BN(t,e){for(var r="",n=0;n>>0}return s}yr.join32=$N;function FN(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}yr.split32=FN;function jN(t,e){return t>>>e|t<<32-e}yr.rotr32=jN;function UN(t,e){return t<>>32-e}yr.rotl32=UN;function qN(t,e){return t+e>>>0}yr.sum32=qN;function zN(t,e,r){return t+e+r>>>0}yr.sum32_3=zN;function HN(t,e,r,n){return t+e+r+n>>>0}yr.sum32_4=HN;function WN(t,e,r,n,i){return t+e+r+n+i>>>0}yr.sum32_5=WN;function KN(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}yr.sum64=KN;function VN(t,e,r,n){var i=e+n>>>0,s=(i>>0}yr.sum64_hi=VN;function GN(t,e,r,n){var i=e+n;return i>>>0}yr.sum64_lo=GN;function YN(t,e,r,n,i,s,o,a){var u=0,l=e;l=l+n>>>0,u+=l>>0,u+=l>>0,u+=l>>0}yr.sum64_4_hi=YN;function JN(t,e,r,n,i,s,o,a){var u=e+n+s+a;return u>>>0}yr.sum64_4_lo=JN;function XN(t,e,r,n,i,s,o,a,u,l){var d=0,g=e;g=g+n>>>0,d+=g>>0,d+=g>>0,d+=g>>0,d+=g>>0}yr.sum64_5_hi=XN;function ZN(t,e,r,n,i,s,o,a,u,l){var d=e+n+s+a+l;return d>>>0}yr.sum64_5_lo=ZN;function QN(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}yr.rotr64_hi=QN;function eL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.rotr64_lo=eL;function tL(t,e,r){return t>>>r}yr.shr64_hi=tL;function rL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.shr64_lo=rL;var lu={},Jx=yr,nL=Ja;function wd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}lu.BlockHash=wd,wd.prototype.update=function(e,r){if(e=Jx.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Jx.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}Ls.g0_256=cL;function uL(t){return ks(t,17)^ks(t,19)^t>>>10}Ls.g1_256=uL;var du=yr,fL=lu,lL=Ls,Im=du.rotl32,cl=du.sum32,hL=du.sum32_5,dL=lL.ft_1,e3=fL.BlockHash,pL=[1518500249,1859775393,2400959708,3395469782];function Bs(){if(!(this instanceof Bs))return new Bs;e3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}du.inherits(Bs,e3);var gL=Bs;Bs.blockSize=512,Bs.outSize=160,Bs.hmacStrength=80,Bs.padLength=64,Bs.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),rk(e.length<=this.blockSize);for(var r=e.length;r>8,y=d&255;g?u.push(g,y):u.push(y)}return u}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",u=0;u(y>>1)-1?O=(y>>1)-D:O=D,A.isubn(O)):O=0,g[P]=O,A.iushrn(1)}return g}r.getNAF=n;function i(u,l){var d=[[],[]];u=u.clone(),l=l.clone();for(var g=0,y=0,A;u.cmpn(-g)>0||l.cmpn(-y)>0;){var P=u.andln(3)+g&3,O=l.andln(3)+y&3;P===3&&(P=-1),O===3&&(O=-1);var D;P&1?(A=u.andln(7)+g&7,(A===3||A===5)&&O===2?D=-P:D=P):D=0,d[0].push(D);var k;O&1?(A=l.andln(7)+y&7,(A===3||A===5)&&P===2?k=-O:k=O):k=0,d[1].push(k),2*g===D+1&&(g=1-g),2*y===k+1&&(y=1-y),u.iushrn(1),l.iushrn(1)}return d}r.getJSF=i;function s(u,l,d){var g="_"+l;u.prototype[l]=function(){return this[g]!==void 0?this[g]:this[g]=d.call(this)}}r.cachedProperty=s;function o(u){return typeof u=="string"?r.toArray(u,"hex"):u}r.parseBytes=o;function a(u){return new rr(u,"hex","le")}r.intFromLE=a}),_d=Ci.getNAF,sk=Ci.getJSF,Ed=Ci.assert;function sa(t,e){this.type=t,this.p=new rr(e.p,16),this.red=e.prime?rr.red(e.prime):rr.mont(this.p),this.zero=new rr(0).toRed(this.red),this.one=new rr(1).toRed(this.red),this.two=new rr(2).toRed(this.red),this.n=e.n&&new rr(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Za=sa;sa.prototype.point=function(){throw new Error("Not implemented")},sa.prototype.validate=function(){throw new Error("Not implemented")},sa.prototype._fixedNafMul=function(e,r){Ed(e.precomputed);var n=e._getDoubles(),i=_d(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),g=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Ed(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},sa.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,g,y;for(d=0;d=1;d-=2){var P=d-1,O=d;if(o[P]!==1||o[O]!==1){u[P]=_d(n[P],o[P],this._bitLength),u[O]=_d(n[O],o[O],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[O].length,l);continue}var D=[r[P],null,null,r[O]];r[P].y.cmp(r[O].y)===0?(D[1]=r[P].add(r[O]),D[2]=r[P].toJ().mixedAdd(r[O].neg())):r[P].y.cmp(r[O].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[O]),D[2]=r[P].add(r[O].neg())):(D[1]=r[P].toJ().mixedAdd(r[O]),D[2]=r[P].toJ().mixedAdd(r[O].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=sk(n[P],n[O]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[O]=new Array(l),g=0;g=0;d--){for(var T=0;d>=0;){var z=!0;for(g=0;g=0&&T++,K=K.dblp(T),d<0)break;for(g=0;g0?y=a[g][ue-1>>1]:ue<0&&(y=a[g][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Hi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),g.negative&&(g=g.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:g,b:y},{a:A,b:P}]},Wi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),g=e.sub(a).sub(u),y=l.add(d).neg();return{k1:g,k2:y}},Wi.prototype.pointFromX=function(e,r){e=new rr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Wi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Wi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Dn.prototype.isInfinity=function(){return this.inf},Dn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Dn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Dn.prototype.getX=function(){return this.x.fromRed()},Dn.prototype.getY=function(){return this.y.fromRed()},Dn.prototype.mul=function(e){return e=new rr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Dn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Dn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Dn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Dn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Dn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Un(t,e,r,n){Za.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new rr(0)):(this.x=new rr(e,16),this.y=new rr(r,16),this.z=new rr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Nm(Un,Za.BasePoint),Wi.prototype.jpoint=function(e,r,n){return new Un(this,e,r,n)},Un.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},Un.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Un.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),g=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(g).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(g)),O=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,O)},Un.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),g=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(g).redISub(g),A=u.redMul(g.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},Un.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},Un.prototype.inspect=function(){return this.isInfinity()?"":""},Un.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Sd=vu(function(t,e){var r=e;r.base=Za,r.short=ak,r.mont=null,r.edwards=null}),Ad=vu(function(t,e){var r=e,n=Ci.assert;function i(a){a.type==="short"?this.curve=new Sd.short(a):a.type==="edwards"?this.curve=new Sd.edwards(a):this.curve=new Sd.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,u){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(u);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:_o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:_o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:_o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:_o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:_o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:_o.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:_o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:_o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function oa(t){if(!(this instanceof oa))return new oa(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=vs.toArray(t.entropy,t.entropyEnc||"hex"),r=vs.toArray(t.nonce,t.nonceEnc||"hex"),n=vs.toArray(t.pers,t.persEnc||"hex");Om(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var g3=oa;oa.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},oa.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=vs.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var ck=Ci.assert;function Pd(t,e){if(t instanceof Pd)return t;this._importDER(t,e)||(ck(t.r&&t.s,"Signature without r or s"),this.r=new rr(t.r,16),this.s=new rr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Md=Pd;function uk(){this.place=0}function Bm(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function m3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Pd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=m3(r),n=m3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];$m(i,r.length),i=i.concat(r),i.push(2),$m(i,n.length);var s=i.concat(n),o=[48];return $m(o,s.length),o=o.concat(s),Ci.encode(o,e)};var fk=function(){throw new Error("unsupported")},v3=Ci.assert;function Ki(t){if(!(this instanceof Ki))return new Ki(t);typeof t=="string"&&(v3(Object.prototype.hasOwnProperty.call(Ad,t),"Unknown curve "+t),t=Ad[t]),t instanceof Ad.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var lk=Ki;Ki.prototype.keyPair=function(e){return new km(this,e)},Ki.prototype.keyFromPrivate=function(e,r){return km.fromPrivate(this,e,r)},Ki.prototype.keyFromPublic=function(e,r){return km.fromPublic(this,e,r)},Ki.prototype.genKeyPair=function(e){e||(e={});for(var r=new g3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||fk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new rr(2));;){var s=new rr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Ki.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Ki.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new rr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new g3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new rr(1)),d=0;;d++){var g=i.k?i.k(d):new rr(u.generate(this.n.byteLength()));if(g=this._truncateToN(g,!0),!(g.cmpn(1)<=0||g.cmp(l)>=0)){var y=this.g.mul(g);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var O=g.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(O=O.umod(this.n),O.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&O.cmp(this.nh)>0&&(O=this.n.sub(O),D^=1),new Md({r:P,s:O,recoveryParam:D})}}}}}},Ki.prototype.verify=function(e,r,n,i){e=this._truncateToN(new rr(e,16)),n=this.keyFromPublic(n,i),r=new Md(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),u=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.eqXToP(s)):(d=this.g.mulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.getX().umod(this.n).cmp(s)===0)},Ki.prototype.recoverPubKey=function(t,e,r,n){v3((3&r)===r,"The recovery param is more than two bits"),e=new Md(e,n);var i=this.n,s=new rr(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),g=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(g,o,y)},Ki.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Md(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var hk=vu(function(t,e){var r=e;r.version="6.5.4",r.utils=Ci,r.rand=function(){throw new Error("unsupported")},r.curve=Sd,r.curves=Ad,r.ec=lk,r.eddsa=null}),dk=hk.ec;const pk="signing-key/5.7.0",Fm=new Kr(pk);let jm=null;function aa(){return jm||(jm=new dk("secp256k1")),jm}class gk{constructor(e){ol(this,"curve","secp256k1"),ol(this,"privateKey",Ii(e)),wN(this.privateKey)!==32&&Fm.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=aa().keyFromPrivate(bn(this.privateKey));ol(this,"publicKey","0x"+r.getPublic(!1,"hex")),ol(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ol(this,"_isSigningKey",!0)}_addPoint(e){const r=aa().keyFromPublic(bn(this.publicKey)),n=aa().keyFromPublic(bn(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=aa().keyFromPrivate(bn(this.privateKey)),n=bn(e);n.length!==32&&Fm.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Ux({recoveryParam:i.recoveryParam,r:fu("0x"+i.r.toString(16),32),s:fu("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=aa().keyFromPrivate(bn(this.privateKey)),n=aa().keyFromPublic(bn(b3(e)));return fu("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function mk(t,e){const r=Ux(e),n={r:bn(r.r),s:bn(r.s)};return"0x"+aa().recoverPubKey(bn(t),n,r.recoveryParam).encode("hex",!1)}function b3(t,e){const r=bn(t);return r.length===32?new gk(r).publicKey:r.length===33?"0x"+aa().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?Ii(r):Fm.throwArgumentError("invalid public or private key","key","[REDACTED]")}var y3;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(y3||(y3={}));function vk(t){const e=b3(t);return RN(jx(Em(jx(e,1)),12))}function bk(t,e){return vk(mk(bn(t),e))}var Um={},Id={};Object.defineProperty(Id,"__esModule",{value:!0});var Yn=or,qm=Mi,yk=20;function wk(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],g=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],P=r[31]<<24|r[30]<<16|r[29]<<8|r[28],O=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],k=e[11]<<24|e[10]<<16|e[9]<<8|e[8],B=e[15]<<24|e[14]<<16|e[13]<<8|e[12],j=n,U=i,K=s,J=o,T=a,z=u,ue=l,_e=d,G=g,E=y,m=A,f=P,p=O,v=D,x=k,_=B,S=0;S>>16|p<<16,G=G+p|0,T^=G,T=T>>>20|T<<12,U=U+z|0,v^=U,v=v>>>16|v<<16,E=E+v|0,z^=E,z=z>>>20|z<<12,K=K+ue|0,x^=K,x=x>>>16|x<<16,m=m+x|0,ue^=m,ue=ue>>>20|ue<<12,J=J+_e|0,_^=J,_=_>>>16|_<<16,f=f+_|0,_e^=f,_e=_e>>>20|_e<<12,K=K+ue|0,x^=K,x=x>>>24|x<<8,m=m+x|0,ue^=m,ue=ue>>>25|ue<<7,J=J+_e|0,_^=J,_=_>>>24|_<<8,f=f+_|0,_e^=f,_e=_e>>>25|_e<<7,U=U+z|0,v^=U,v=v>>>24|v<<8,E=E+v|0,z^=E,z=z>>>25|z<<7,j=j+T|0,p^=j,p=p>>>24|p<<8,G=G+p|0,T^=G,T=T>>>25|T<<7,j=j+z|0,_^=j,_=_>>>16|_<<16,m=m+_|0,z^=m,z=z>>>20|z<<12,U=U+ue|0,p^=U,p=p>>>16|p<<16,f=f+p|0,ue^=f,ue=ue>>>20|ue<<12,K=K+_e|0,v^=K,v=v>>>16|v<<16,G=G+v|0,_e^=G,_e=_e>>>20|_e<<12,J=J+T|0,x^=J,x=x>>>16|x<<16,E=E+x|0,T^=E,T=T>>>20|T<<12,K=K+_e|0,v^=K,v=v>>>24|v<<8,G=G+v|0,_e^=G,_e=_e>>>25|_e<<7,J=J+T|0,x^=J,x=x>>>24|x<<8,E=E+x|0,T^=E,T=T>>>25|T<<7,U=U+ue|0,p^=U,p=p>>>24|p<<8,f=f+p|0,ue^=f,ue=ue>>>25|ue<<7,j=j+z|0,_^=j,_=_>>>24|_<<8,m=m+_|0,z^=m,z=z>>>25|z<<7;Yn.writeUint32LE(j+n|0,t,0),Yn.writeUint32LE(U+i|0,t,4),Yn.writeUint32LE(K+s|0,t,8),Yn.writeUint32LE(J+o|0,t,12),Yn.writeUint32LE(T+a|0,t,16),Yn.writeUint32LE(z+u|0,t,20),Yn.writeUint32LE(ue+l|0,t,24),Yn.writeUint32LE(_e+d|0,t,28),Yn.writeUint32LE(G+g|0,t,32),Yn.writeUint32LE(E+y|0,t,36),Yn.writeUint32LE(m+A|0,t,40),Yn.writeUint32LE(f+P|0,t,44),Yn.writeUint32LE(p+O|0,t,48),Yn.writeUint32LE(v+D|0,t,52),Yn.writeUint32LE(x+k|0,t,56),Yn.writeUint32LE(_+B|0,t,60)}function w3(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var x3={},ca={};Object.defineProperty(ca,"__esModule",{value:!0});function Ek(t,e,r){return~(t-1)&e|t-1&r}ca.select=Ek;function Sk(t,e){return(t|0)-(e|0)-1>>>31&1}ca.lessOrEqual=Sk;function _3(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}ca.compare=_3;function Ak(t,e){return t.length===0||e.length===0?!1:_3(t,e)!==0}ca.equal=Ak,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ca,r=Mi;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var u=a[0]|a[1]<<8;this._r[0]=u&8191;var l=a[2]|a[3]<<8;this._r[1]=(u>>>13|l<<3)&8191;var d=a[4]|a[5]<<8;this._r[2]=(l>>>10|d<<6)&7939;var g=a[6]|a[7]<<8;this._r[3]=(d>>>7|g<<9)&8191;var y=a[8]|a[9]<<8;this._r[4]=(g>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var A=a[10]|a[11]<<8;this._r[6]=(y>>>14|A<<2)&8191;var P=a[12]|a[13]<<8;this._r[7]=(A>>>11|P<<5)&8065;var O=a[14]|a[15]<<8;this._r[8]=(P>>>8|O<<8)&8191,this._r[9]=O>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,u,l){for(var d=this._fin?0:2048,g=this._h[0],y=this._h[1],A=this._h[2],P=this._h[3],O=this._h[4],D=this._h[5],k=this._h[6],B=this._h[7],j=this._h[8],U=this._h[9],K=this._r[0],J=this._r[1],T=this._r[2],z=this._r[3],ue=this._r[4],_e=this._r[5],G=this._r[6],E=this._r[7],m=this._r[8],f=this._r[9];l>=16;){var p=a[u+0]|a[u+1]<<8;g+=p&8191;var v=a[u+2]|a[u+3]<<8;y+=(p>>>13|v<<3)&8191;var x=a[u+4]|a[u+5]<<8;A+=(v>>>10|x<<6)&8191;var _=a[u+6]|a[u+7]<<8;P+=(x>>>7|_<<9)&8191;var S=a[u+8]|a[u+9]<<8;O+=(_>>>4|S<<12)&8191,D+=S>>>1&8191;var b=a[u+10]|a[u+11]<<8;k+=(S>>>14|b<<2)&8191;var M=a[u+12]|a[u+13]<<8;B+=(b>>>11|M<<5)&8191;var I=a[u+14]|a[u+15]<<8;j+=(M>>>8|I<<8)&8191,U+=I>>>5|d;var F=0,ae=F;ae+=g*K,ae+=y*(5*f),ae+=A*(5*m),ae+=P*(5*E),ae+=O*(5*G),F=ae>>>13,ae&=8191,ae+=D*(5*_e),ae+=k*(5*ue),ae+=B*(5*z),ae+=j*(5*T),ae+=U*(5*J),F+=ae>>>13,ae&=8191;var N=F;N+=g*J,N+=y*K,N+=A*(5*f),N+=P*(5*m),N+=O*(5*E),F=N>>>13,N&=8191,N+=D*(5*G),N+=k*(5*_e),N+=B*(5*ue),N+=j*(5*z),N+=U*(5*T),F+=N>>>13,N&=8191;var se=F;se+=g*T,se+=y*J,se+=A*K,se+=P*(5*f),se+=O*(5*m),F=se>>>13,se&=8191,se+=D*(5*E),se+=k*(5*G),se+=B*(5*_e),se+=j*(5*ue),se+=U*(5*z),F+=se>>>13,se&=8191;var ee=F;ee+=g*z,ee+=y*T,ee+=A*J,ee+=P*K,ee+=O*(5*f),F=ee>>>13,ee&=8191,ee+=D*(5*m),ee+=k*(5*E),ee+=B*(5*G),ee+=j*(5*_e),ee+=U*(5*ue),F+=ee>>>13,ee&=8191;var X=F;X+=g*ue,X+=y*z,X+=A*T,X+=P*J,X+=O*K,F=X>>>13,X&=8191,X+=D*(5*f),X+=k*(5*m),X+=B*(5*E),X+=j*(5*G),X+=U*(5*_e),F+=X>>>13,X&=8191;var Q=F;Q+=g*_e,Q+=y*ue,Q+=A*z,Q+=P*T,Q+=O*J,F=Q>>>13,Q&=8191,Q+=D*K,Q+=k*(5*f),Q+=B*(5*m),Q+=j*(5*E),Q+=U*(5*G),F+=Q>>>13,Q&=8191;var R=F;R+=g*G,R+=y*_e,R+=A*ue,R+=P*z,R+=O*T,F=R>>>13,R&=8191,R+=D*J,R+=k*K,R+=B*(5*f),R+=j*(5*m),R+=U*(5*E),F+=R>>>13,R&=8191;var Z=F;Z+=g*E,Z+=y*G,Z+=A*_e,Z+=P*ue,Z+=O*z,F=Z>>>13,Z&=8191,Z+=D*T,Z+=k*J,Z+=B*K,Z+=j*(5*f),Z+=U*(5*m),F+=Z>>>13,Z&=8191;var te=F;te+=g*m,te+=y*E,te+=A*G,te+=P*_e,te+=O*ue,F=te>>>13,te&=8191,te+=D*z,te+=k*T,te+=B*J,te+=j*K,te+=U*(5*f),F+=te>>>13,te&=8191;var he=F;he+=g*f,he+=y*m,he+=A*E,he+=P*G,he+=O*_e,F=he>>>13,he&=8191,he+=D*ue,he+=k*z,he+=B*T,he+=j*J,he+=U*K,F+=he>>>13,he&=8191,F=(F<<2)+F|0,F=F+ae|0,ae=F&8191,F=F>>>13,N+=F,g=ae,y=N,A=se,P=ee,O=X,D=Q,k=R,B=Z,j=te,U=he,u+=16,l-=16}this._h[0]=g,this._h[1]=y,this._h[2]=A,this._h[3]=P,this._h[4]=O,this._h[5]=D,this._h[6]=k,this._h[7]=B,this._h[8]=j,this._h[9]=U},o.prototype.finish=function(a,u){u===void 0&&(u=0);var l=new Uint16Array(10),d,g,y,A;if(this._leftover){for(A=this._leftover,this._buffer[A++]=1;A<16;A++)this._buffer[A]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(d=this._h[1]>>>13,this._h[1]&=8191,A=2;A<10;A++)this._h[A]+=d,d=this._h[A]>>>13,this._h[A]&=8191;for(this._h[0]+=d*5,d=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=d,d=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=d,l[0]=this._h[0]+5,d=l[0]>>>13,l[0]&=8191,A=1;A<10;A++)l[A]=this._h[A]+d,d=l[A]>>>13,l[A]&=8191;for(l[9]-=8192,g=(d^1)-1,A=0;A<10;A++)l[A]&=g;for(g=~g,A=0;A<10;A++)this._h[A]=this._h[A]&g|l[A];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,y=this._h[0]+this._pad[0],this._h[0]=y&65535,A=1;A<8;A++)y=(this._h[A]+this._pad[A]|0)+(y>>>16)|0,this._h[A]=y&65535;return a[u+0]=this._h[0]>>>0,a[u+1]=this._h[0]>>>8,a[u+2]=this._h[1]>>>0,a[u+3]=this._h[1]>>>8,a[u+4]=this._h[2]>>>0,a[u+5]=this._h[2]>>>8,a[u+6]=this._h[3]>>>0,a[u+7]=this._h[3]>>>8,a[u+8]=this._h[4]>>>0,a[u+9]=this._h[4]>>>8,a[u+10]=this._h[5]>>>0,a[u+11]=this._h[5]>>>8,a[u+12]=this._h[6]>>>0,a[u+13]=this._h[6]>>>8,a[u+14]=this._h[7]>>>0,a[u+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var u=0,l=a.length,d;if(this._leftover){d=16-this._leftover,d>l&&(d=l);for(var g=0;g=16&&(d=l-l%16,this._blocks(a,u,d),u+=d,l-=d),l){for(var g=0;g16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var A=new Uint8Array(16);A.set(l,A.length-l.length);var P=new Uint8Array(32);e.stream(this._key,A,P,4);var O=d.length+this.tagLength,D;if(y){if(y.length!==O)throw new Error("ChaCha20Poly1305: incorrect destination length");D=y}else D=new Uint8Array(O);return e.streamXOR(this._key,A,d,D,4),this._authenticate(D.subarray(D.length-this.tagLength,D.length),P,D.subarray(0,D.length-this.tagLength),g),n.wipe(A),D},u.prototype.open=function(l,d,g,y){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(d.length0&&A.update(o.subarray(y.length%16))),A.update(g),g.length%16>0&&A.update(o.subarray(g.length%16));var P=new Uint8Array(8);y&&i.writeUint64LE(y.length,P),A.update(P),i.writeUint64LE(g.length,P),A.update(P);for(var O=A.digest(),D=0;Dthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._temp,this._state,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,g=l/536870912|0,y=l<<3,A=l%64<56?64:128;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._state.set(u.state),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.state),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,u,l,d,g){for(;g>=64;){for(var y=u[0],A=u[1],P=u[2],O=u[3],D=u[4],k=u[5],B=u[6],j=u[7],U=0;U<16;U++){var K=d+U*4;a[U]=e.readUint32BE(l,K)}for(var U=16;U<64;U++){var J=a[U-2],T=(J>>>17|J<<15)^(J>>>19|J<<13)^J>>>10;J=a[U-15];var z=(J>>>7|J<<25)^(J>>>18|J<<14)^J>>>3;a[U]=(T+a[U-7]|0)+(z+a[U-16]|0)}for(var U=0;U<64;U++){var T=(((D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7))+(D&k^~D&B)|0)+(j+(i[U]+a[U]|0)|0)|0,z=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&A^y&P^A&P)|0;j=B,B=k,k=D,D=O+T|0,O=P,P=A,A=y,y=T+z|0}u[0]+=y,u[1]+=A,u[2]+=P,u[3]+=O,u[4]+=D,u[5]+=k,u[6]+=B,u[7]+=j,d+=64,g-=64}return d}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ll);var Hm={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=na,r=Mi;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(U){const K=new Float64Array(16);if(U)for(let J=0;J>16&1),J[_e-1]&=65535;J[15]=T[15]-32767-(J[14]>>16&1);const ue=J[15]>>16&1;J[14]&=65535,a(T,J,1-ue)}for(let z=0;z<16;z++)U[2*z]=T[z]&255,U[2*z+1]=T[z]>>8}function l(U,K){for(let J=0;J<16;J++)U[J]=K[2*J]+(K[2*J+1]<<8);U[15]&=32767}function d(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]+J[T]}function g(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]-J[T]}function y(U,K,J){let T,z,ue=0,_e=0,G=0,E=0,m=0,f=0,p=0,v=0,x=0,_=0,S=0,b=0,M=0,I=0,F=0,ae=0,N=0,se=0,ee=0,X=0,Q=0,R=0,Z=0,te=0,he=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=J[0],Ie=J[1],Le=J[2],Ve=J[3],ke=J[4],ze=J[5],He=J[6],Ee=J[7],Qe=J[8],ct=J[9],Be=J[10],et=J[11],rt=J[12],Je=J[13],pt=J[14],ht=J[15];T=K[0],ue+=T*$e,_e+=T*Ie,G+=T*Le,E+=T*Ve,m+=T*ke,f+=T*ze,p+=T*He,v+=T*Ee,x+=T*Qe,_+=T*ct,S+=T*Be,b+=T*et,M+=T*rt,I+=T*Je,F+=T*pt,ae+=T*ht,T=K[1],_e+=T*$e,G+=T*Ie,E+=T*Le,m+=T*Ve,f+=T*ke,p+=T*ze,v+=T*He,x+=T*Ee,_+=T*Qe,S+=T*ct,b+=T*Be,M+=T*et,I+=T*rt,F+=T*Je,ae+=T*pt,N+=T*ht,T=K[2],G+=T*$e,E+=T*Ie,m+=T*Le,f+=T*Ve,p+=T*ke,v+=T*ze,x+=T*He,_+=T*Ee,S+=T*Qe,b+=T*ct,M+=T*Be,I+=T*et,F+=T*rt,ae+=T*Je,N+=T*pt,se+=T*ht,T=K[3],E+=T*$e,m+=T*Ie,f+=T*Le,p+=T*Ve,v+=T*ke,x+=T*ze,_+=T*He,S+=T*Ee,b+=T*Qe,M+=T*ct,I+=T*Be,F+=T*et,ae+=T*rt,N+=T*Je,se+=T*pt,ee+=T*ht,T=K[4],m+=T*$e,f+=T*Ie,p+=T*Le,v+=T*Ve,x+=T*ke,_+=T*ze,S+=T*He,b+=T*Ee,M+=T*Qe,I+=T*ct,F+=T*Be,ae+=T*et,N+=T*rt,se+=T*Je,ee+=T*pt,X+=T*ht,T=K[5],f+=T*$e,p+=T*Ie,v+=T*Le,x+=T*Ve,_+=T*ke,S+=T*ze,b+=T*He,M+=T*Ee,I+=T*Qe,F+=T*ct,ae+=T*Be,N+=T*et,se+=T*rt,ee+=T*Je,X+=T*pt,Q+=T*ht,T=K[6],p+=T*$e,v+=T*Ie,x+=T*Le,_+=T*Ve,S+=T*ke,b+=T*ze,M+=T*He,I+=T*Ee,F+=T*Qe,ae+=T*ct,N+=T*Be,se+=T*et,ee+=T*rt,X+=T*Je,Q+=T*pt,R+=T*ht,T=K[7],v+=T*$e,x+=T*Ie,_+=T*Le,S+=T*Ve,b+=T*ke,M+=T*ze,I+=T*He,F+=T*Ee,ae+=T*Qe,N+=T*ct,se+=T*Be,ee+=T*et,X+=T*rt,Q+=T*Je,R+=T*pt,Z+=T*ht,T=K[8],x+=T*$e,_+=T*Ie,S+=T*Le,b+=T*Ve,M+=T*ke,I+=T*ze,F+=T*He,ae+=T*Ee,N+=T*Qe,se+=T*ct,ee+=T*Be,X+=T*et,Q+=T*rt,R+=T*Je,Z+=T*pt,te+=T*ht,T=K[9],_+=T*$e,S+=T*Ie,b+=T*Le,M+=T*Ve,I+=T*ke,F+=T*ze,ae+=T*He,N+=T*Ee,se+=T*Qe,ee+=T*ct,X+=T*Be,Q+=T*et,R+=T*rt,Z+=T*Je,te+=T*pt,he+=T*ht,T=K[10],S+=T*$e,b+=T*Ie,M+=T*Le,I+=T*Ve,F+=T*ke,ae+=T*ze,N+=T*He,se+=T*Ee,ee+=T*Qe,X+=T*ct,Q+=T*Be,R+=T*et,Z+=T*rt,te+=T*Je,he+=T*pt,ie+=T*ht,T=K[11],b+=T*$e,M+=T*Ie,I+=T*Le,F+=T*Ve,ae+=T*ke,N+=T*ze,se+=T*He,ee+=T*Ee,X+=T*Qe,Q+=T*ct,R+=T*Be,Z+=T*et,te+=T*rt,he+=T*Je,ie+=T*pt,fe+=T*ht,T=K[12],M+=T*$e,I+=T*Ie,F+=T*Le,ae+=T*Ve,N+=T*ke,se+=T*ze,ee+=T*He,X+=T*Ee,Q+=T*Qe,R+=T*ct,Z+=T*Be,te+=T*et,he+=T*rt,ie+=T*Je,fe+=T*pt,ve+=T*ht,T=K[13],I+=T*$e,F+=T*Ie,ae+=T*Le,N+=T*Ve,se+=T*ke,ee+=T*ze,X+=T*He,Q+=T*Ee,R+=T*Qe,Z+=T*ct,te+=T*Be,he+=T*et,ie+=T*rt,fe+=T*Je,ve+=T*pt,Me+=T*ht,T=K[14],F+=T*$e,ae+=T*Ie,N+=T*Le,se+=T*Ve,ee+=T*ke,X+=T*ze,Q+=T*He,R+=T*Ee,Z+=T*Qe,te+=T*ct,he+=T*Be,ie+=T*et,fe+=T*rt,ve+=T*Je,Me+=T*pt,Ne+=T*ht,T=K[15],ae+=T*$e,N+=T*Ie,se+=T*Le,ee+=T*Ve,X+=T*ke,Q+=T*ze,R+=T*He,Z+=T*Ee,te+=T*Qe,he+=T*ct,ie+=T*Be,fe+=T*et,ve+=T*rt,Me+=T*Je,Ne+=T*pt,Te+=T*ht,ue+=38*N,_e+=38*se,G+=38*ee,E+=38*X,m+=38*Q,f+=38*R,p+=38*Z,v+=38*te,x+=38*he,_+=38*ie,S+=38*fe,b+=38*ve,M+=38*Me,I+=38*Ne,F+=38*Te,z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=p+z+65535,z=Math.floor(T/65536),p=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=p+z+65535,z=Math.floor(T/65536),p=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),U[0]=ue,U[1]=_e,U[2]=G,U[3]=E,U[4]=m,U[5]=f,U[6]=p,U[7]=v,U[8]=x,U[9]=_,U[10]=S,U[11]=b,U[12]=M,U[13]=I,U[14]=F,U[15]=ae}function A(U,K){y(U,K,K)}function P(U,K){const J=n();for(let T=0;T<16;T++)J[T]=K[T];for(let T=253;T>=0;T--)A(J,J),T!==2&&T!==4&&y(J,J,K);for(let T=0;T<16;T++)U[T]=J[T]}function O(U,K){const J=new Uint8Array(32),T=new Float64Array(80),z=n(),ue=n(),_e=n(),G=n(),E=n(),m=n();for(let x=0;x<31;x++)J[x]=U[x];J[31]=U[31]&127|64,J[0]&=248,l(T,K);for(let x=0;x<16;x++)ue[x]=T[x];z[0]=G[0]=1;for(let x=254;x>=0;--x){const _=J[x>>>3]>>>(x&7)&1;a(z,ue,_),a(_e,G,_),d(E,z,_e),g(z,z,_e),d(_e,ue,G),g(ue,ue,G),A(G,E),A(m,z),y(z,_e,z),y(_e,ue,E),d(E,z,_e),g(z,z,_e),A(ue,z),g(_e,G,m),y(z,_e,s),d(z,z,G),y(_e,_e,z),y(z,G,m),y(G,ue,T),A(ue,E),a(z,ue,_),a(_e,G,_)}for(let x=0;x<16;x++)T[x+16]=z[x],T[x+32]=_e[x],T[x+48]=ue[x],T[x+64]=G[x];const f=T.subarray(32),p=T.subarray(16);P(f,f),y(p,p,f);const v=new Uint8Array(32);return u(v,p),v}t.scalarMult=O;function D(U){return O(U,i)}t.scalarMultBase=D;function k(U){if(U.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const K=new Uint8Array(U);return{publicKey:D(K),secretKey:K}}t.generateKeyPairFromSeed=k;function B(U){const K=(0,e.randomBytes)(32,U),J=k(K);return(0,r.wipe)(K),J}t.generateKeyPair=B;function j(U,K,J=!1){if(U.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(K.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const T=O(U,K);if(J){let z=0;for(let ue=0;ue",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}};var Ti={},Wm={exports:{}};Wm.exports,function(t){(function(e,r){function n(G,E){if(!G)throw new Error(E||"Assertion failed")}function i(G,E){G.super_=E;var m=function(){};m.prototype=E.prototype,G.prototype=new m,G.prototype.constructor=G}function s(G,E,m){if(s.isBN(G))return G;this.negative=0,this.words=null,this.length=0,this.red=null,G!==null&&((E==="le"||E==="be")&&(m=E,E=10),this._init(G||0,E||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(E){return E instanceof s?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===s.wordSize&&Array.isArray(E.words)},s.max=function(E,m){return E.cmp(m)>0?E:m},s.min=function(E,m){return E.cmp(m)<0?E:m},s.prototype._init=function(E,m,f){if(typeof E=="number")return this._initNumber(E,m,f);if(typeof E=="object")return this._initArray(E,m,f);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),E=E.toString().replace(/\s+/g,"");var p=0;E[0]==="-"&&(p++,this.negative=1),p=0;p-=3)x=E[p]|E[p-1]<<8|E[p-2]<<16,this.words[v]|=x<<_&67108863,this.words[v+1]=x>>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);else if(f==="le")for(p=0,v=0;p>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);return this.strip()};function a(G,E){var m=G.charCodeAt(E);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function u(G,E,m){var f=a(G,m);return m-1>=E&&(f|=a(G,m-1)<<4),f}s.prototype._parseHex=function(E,m,f){this.length=Math.ceil((E.length-m)/6),this.words=new Array(this.length);for(var p=0;p=m;p-=2)_=u(E,m,p)<=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8;else{var S=E.length-m;for(p=S%2===0?m+1:m;p=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8}this.strip()};function l(G,E,m,f){for(var p=0,v=Math.min(G.length,m),x=E;x=49?p+=_-49+10:_>=17?p+=_-17+10:p+=_}return p}s.prototype._parseBase=function(E,m,f){this.words=[0],this.length=1;for(var p=0,v=1;v<=67108863;v*=m)p++;p--,v=v/m|0;for(var x=E.length-f,_=x%p,S=Math.min(x,x-_)+f,b=0,M=f;M1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var d=["","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"],g=[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],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(E,m){E=E||10,m=m|0||1;var f;if(E===16||E==="hex"){f="";for(var p=0,v=0,x=0;x>>24-p&16777215,p+=2,p>=26&&(p-=26,x--),v!==0||x!==this.length-1?f=d[6-S.length]+S+f:f=S+f}for(v!==0&&(f=v.toString(16)+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(E===(E|0)&&E>=2&&E<=36){var b=g[E],M=y[E];f="";var I=this.clone();for(I.negative=0;!I.isZero();){var F=I.modn(M).toString(E);I=I.idivn(M),I.isZero()?f=F+f:f=d[b-F.length]+F+f}for(this.isZero()&&(f="0"+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(E,m){return n(typeof o<"u"),this.toArrayLike(o,E,m)},s.prototype.toArray=function(E,m){return this.toArrayLike(Array,E,m)},s.prototype.toArrayLike=function(E,m,f){var p=this.byteLength(),v=f||Math.max(1,p);n(p<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var x=m==="le",_=new E(v),S,b,M=this.clone();if(x){for(b=0;!M.isZero();b++)S=M.andln(255),M.iushrn(8),_[b]=S;for(;b=4096&&(f+=13,m>>>=13),m>=64&&(f+=7,m>>>=7),m>=8&&(f+=4,m>>>=4),m>=2&&(f+=2,m>>>=2),f+m},s.prototype._zeroBits=function(E){if(E===0)return 26;var m=E,f=0;return m&8191||(f+=13,m>>>=13),m&127||(f+=7,m>>>=7),m&15||(f+=4,m>>>=4),m&3||(f+=2,m>>>=2),m&1||f++,f},s.prototype.bitLength=function(){var E=this.words[this.length-1],m=this._countBits(E);return(this.length-1)*26+m};function A(G){for(var E=new Array(G.bitLength()),m=0;m>>p}return E}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,m=0;mE.length?this.clone().ior(E):E.clone().ior(this)},s.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},s.prototype.iuand=function(E){var m;this.length>E.length?m=E:m=this;for(var f=0;fE.length?this.clone().iand(E):E.clone().iand(this)},s.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},s.prototype.iuxor=function(E){var m,f;this.length>E.length?(m=this,f=E):(m=E,f=this);for(var p=0;pE.length?this.clone().ixor(E):E.clone().ixor(this)},s.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},s.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var m=Math.ceil(E/26)|0,f=E%26;this._expand(m),f>0&&m--;for(var p=0;p0&&(this.words[p]=~this.words[p]&67108863>>26-f),this.strip()},s.prototype.notn=function(E){return this.clone().inotn(E)},s.prototype.setn=function(E,m){n(typeof E=="number"&&E>=0);var f=E/26|0,p=E%26;return this._expand(f+1),m?this.words[f]=this.words[f]|1<E.length?(f=this,p=E):(f=E,p=this);for(var v=0,x=0;x>>26;for(;v!==0&&x>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;xE.length?this.clone().iadd(E):E.clone().iadd(this)},s.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var m=this.iadd(E);return E.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var f=this.cmp(E);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,v;f>0?(p=this,v=E):(p=E,v=this);for(var x=0,_=0;_>26,this.words[_]=m&67108863;for(;x!==0&&_>26,this.words[_]=m&67108863;if(x===0&&_>>26,I=S&67108863,F=Math.min(b,E.length-1),ae=Math.max(0,b-G.length+1);ae<=F;ae++){var N=b-ae|0;p=G.words[N]|0,v=E.words[ae]|0,x=p*v+I,M+=x/67108864|0,I=x&67108863}m.words[b]=I|0,S=M|0}return S!==0?m.words[b]=S|0:m.length--,m.strip()}var O=function(E,m,f){var p=E.words,v=m.words,x=f.words,_=0,S,b,M,I=p[0]|0,F=I&8191,ae=I>>>13,N=p[1]|0,se=N&8191,ee=N>>>13,X=p[2]|0,Q=X&8191,R=X>>>13,Z=p[3]|0,te=Z&8191,he=Z>>>13,ie=p[4]|0,fe=ie&8191,ve=ie>>>13,Me=p[5]|0,Ne=Me&8191,Te=Me>>>13,$e=p[6]|0,Ie=$e&8191,Le=$e>>>13,Ve=p[7]|0,ke=Ve&8191,ze=Ve>>>13,He=p[8]|0,Ee=He&8191,Qe=He>>>13,ct=p[9]|0,Be=ct&8191,et=ct>>>13,rt=v[0]|0,Je=rt&8191,pt=rt>>>13,ht=v[1]|0,ft=ht&8191,Ht=ht>>>13,Jt=v[2]|0,St=Jt&8191,er=Jt>>>13,Xt=v[3]|0,Ot=Xt&8191,Bt=Xt>>>13,Tt=v[4]|0,vt=Tt&8191,Dt=Tt>>>13,Lt=v[5]|0,bt=Lt&8191,$t=Lt>>>13,jt=v[6]|0,nt=jt&8191,Ft=jt>>>13,$=v[7]|0,H=$&8191,V=$>>>13,C=v[8]|0,Y=C&8191,q=C>>>13,oe=v[9]|0,ge=oe&8191,xe=oe>>>13;f.negative=E.negative^m.negative,f.length=19,S=Math.imul(F,Je),b=Math.imul(F,pt),b=b+Math.imul(ae,Je)|0,M=Math.imul(ae,pt);var Re=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Re>>>26)|0,Re&=67108863,S=Math.imul(se,Je),b=Math.imul(se,pt),b=b+Math.imul(ee,Je)|0,M=Math.imul(ee,pt),S=S+Math.imul(F,ft)|0,b=b+Math.imul(F,Ht)|0,b=b+Math.imul(ae,ft)|0,M=M+Math.imul(ae,Ht)|0;var De=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(De>>>26)|0,De&=67108863,S=Math.imul(Q,Je),b=Math.imul(Q,pt),b=b+Math.imul(R,Je)|0,M=Math.imul(R,pt),S=S+Math.imul(se,ft)|0,b=b+Math.imul(se,Ht)|0,b=b+Math.imul(ee,ft)|0,M=M+Math.imul(ee,Ht)|0,S=S+Math.imul(F,St)|0,b=b+Math.imul(F,er)|0,b=b+Math.imul(ae,St)|0,M=M+Math.imul(ae,er)|0;var it=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(it>>>26)|0,it&=67108863,S=Math.imul(te,Je),b=Math.imul(te,pt),b=b+Math.imul(he,Je)|0,M=Math.imul(he,pt),S=S+Math.imul(Q,ft)|0,b=b+Math.imul(Q,Ht)|0,b=b+Math.imul(R,ft)|0,M=M+Math.imul(R,Ht)|0,S=S+Math.imul(se,St)|0,b=b+Math.imul(se,er)|0,b=b+Math.imul(ee,St)|0,M=M+Math.imul(ee,er)|0,S=S+Math.imul(F,Ot)|0,b=b+Math.imul(F,Bt)|0,b=b+Math.imul(ae,Ot)|0,M=M+Math.imul(ae,Bt)|0;var Ue=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,S=Math.imul(fe,Je),b=Math.imul(fe,pt),b=b+Math.imul(ve,Je)|0,M=Math.imul(ve,pt),S=S+Math.imul(te,ft)|0,b=b+Math.imul(te,Ht)|0,b=b+Math.imul(he,ft)|0,M=M+Math.imul(he,Ht)|0,S=S+Math.imul(Q,St)|0,b=b+Math.imul(Q,er)|0,b=b+Math.imul(R,St)|0,M=M+Math.imul(R,er)|0,S=S+Math.imul(se,Ot)|0,b=b+Math.imul(se,Bt)|0,b=b+Math.imul(ee,Ot)|0,M=M+Math.imul(ee,Bt)|0,S=S+Math.imul(F,vt)|0,b=b+Math.imul(F,Dt)|0,b=b+Math.imul(ae,vt)|0,M=M+Math.imul(ae,Dt)|0;var gt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(gt>>>26)|0,gt&=67108863,S=Math.imul(Ne,Je),b=Math.imul(Ne,pt),b=b+Math.imul(Te,Je)|0,M=Math.imul(Te,pt),S=S+Math.imul(fe,ft)|0,b=b+Math.imul(fe,Ht)|0,b=b+Math.imul(ve,ft)|0,M=M+Math.imul(ve,Ht)|0,S=S+Math.imul(te,St)|0,b=b+Math.imul(te,er)|0,b=b+Math.imul(he,St)|0,M=M+Math.imul(he,er)|0,S=S+Math.imul(Q,Ot)|0,b=b+Math.imul(Q,Bt)|0,b=b+Math.imul(R,Ot)|0,M=M+Math.imul(R,Bt)|0,S=S+Math.imul(se,vt)|0,b=b+Math.imul(se,Dt)|0,b=b+Math.imul(ee,vt)|0,M=M+Math.imul(ee,Dt)|0,S=S+Math.imul(F,bt)|0,b=b+Math.imul(F,$t)|0,b=b+Math.imul(ae,bt)|0,M=M+Math.imul(ae,$t)|0;var st=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(st>>>26)|0,st&=67108863,S=Math.imul(Ie,Je),b=Math.imul(Ie,pt),b=b+Math.imul(Le,Je)|0,M=Math.imul(Le,pt),S=S+Math.imul(Ne,ft)|0,b=b+Math.imul(Ne,Ht)|0,b=b+Math.imul(Te,ft)|0,M=M+Math.imul(Te,Ht)|0,S=S+Math.imul(fe,St)|0,b=b+Math.imul(fe,er)|0,b=b+Math.imul(ve,St)|0,M=M+Math.imul(ve,er)|0,S=S+Math.imul(te,Ot)|0,b=b+Math.imul(te,Bt)|0,b=b+Math.imul(he,Ot)|0,M=M+Math.imul(he,Bt)|0,S=S+Math.imul(Q,vt)|0,b=b+Math.imul(Q,Dt)|0,b=b+Math.imul(R,vt)|0,M=M+Math.imul(R,Dt)|0,S=S+Math.imul(se,bt)|0,b=b+Math.imul(se,$t)|0,b=b+Math.imul(ee,bt)|0,M=M+Math.imul(ee,$t)|0,S=S+Math.imul(F,nt)|0,b=b+Math.imul(F,Ft)|0,b=b+Math.imul(ae,nt)|0,M=M+Math.imul(ae,Ft)|0;var tt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(tt>>>26)|0,tt&=67108863,S=Math.imul(ke,Je),b=Math.imul(ke,pt),b=b+Math.imul(ze,Je)|0,M=Math.imul(ze,pt),S=S+Math.imul(Ie,ft)|0,b=b+Math.imul(Ie,Ht)|0,b=b+Math.imul(Le,ft)|0,M=M+Math.imul(Le,Ht)|0,S=S+Math.imul(Ne,St)|0,b=b+Math.imul(Ne,er)|0,b=b+Math.imul(Te,St)|0,M=M+Math.imul(Te,er)|0,S=S+Math.imul(fe,Ot)|0,b=b+Math.imul(fe,Bt)|0,b=b+Math.imul(ve,Ot)|0,M=M+Math.imul(ve,Bt)|0,S=S+Math.imul(te,vt)|0,b=b+Math.imul(te,Dt)|0,b=b+Math.imul(he,vt)|0,M=M+Math.imul(he,Dt)|0,S=S+Math.imul(Q,bt)|0,b=b+Math.imul(Q,$t)|0,b=b+Math.imul(R,bt)|0,M=M+Math.imul(R,$t)|0,S=S+Math.imul(se,nt)|0,b=b+Math.imul(se,Ft)|0,b=b+Math.imul(ee,nt)|0,M=M+Math.imul(ee,Ft)|0,S=S+Math.imul(F,H)|0,b=b+Math.imul(F,V)|0,b=b+Math.imul(ae,H)|0,M=M+Math.imul(ae,V)|0;var At=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(At>>>26)|0,At&=67108863,S=Math.imul(Ee,Je),b=Math.imul(Ee,pt),b=b+Math.imul(Qe,Je)|0,M=Math.imul(Qe,pt),S=S+Math.imul(ke,ft)|0,b=b+Math.imul(ke,Ht)|0,b=b+Math.imul(ze,ft)|0,M=M+Math.imul(ze,Ht)|0,S=S+Math.imul(Ie,St)|0,b=b+Math.imul(Ie,er)|0,b=b+Math.imul(Le,St)|0,M=M+Math.imul(Le,er)|0,S=S+Math.imul(Ne,Ot)|0,b=b+Math.imul(Ne,Bt)|0,b=b+Math.imul(Te,Ot)|0,M=M+Math.imul(Te,Bt)|0,S=S+Math.imul(fe,vt)|0,b=b+Math.imul(fe,Dt)|0,b=b+Math.imul(ve,vt)|0,M=M+Math.imul(ve,Dt)|0,S=S+Math.imul(te,bt)|0,b=b+Math.imul(te,$t)|0,b=b+Math.imul(he,bt)|0,M=M+Math.imul(he,$t)|0,S=S+Math.imul(Q,nt)|0,b=b+Math.imul(Q,Ft)|0,b=b+Math.imul(R,nt)|0,M=M+Math.imul(R,Ft)|0,S=S+Math.imul(se,H)|0,b=b+Math.imul(se,V)|0,b=b+Math.imul(ee,H)|0,M=M+Math.imul(ee,V)|0,S=S+Math.imul(F,Y)|0,b=b+Math.imul(F,q)|0,b=b+Math.imul(ae,Y)|0,M=M+Math.imul(ae,q)|0;var Rt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,S=Math.imul(Be,Je),b=Math.imul(Be,pt),b=b+Math.imul(et,Je)|0,M=Math.imul(et,pt),S=S+Math.imul(Ee,ft)|0,b=b+Math.imul(Ee,Ht)|0,b=b+Math.imul(Qe,ft)|0,M=M+Math.imul(Qe,Ht)|0,S=S+Math.imul(ke,St)|0,b=b+Math.imul(ke,er)|0,b=b+Math.imul(ze,St)|0,M=M+Math.imul(ze,er)|0,S=S+Math.imul(Ie,Ot)|0,b=b+Math.imul(Ie,Bt)|0,b=b+Math.imul(Le,Ot)|0,M=M+Math.imul(Le,Bt)|0,S=S+Math.imul(Ne,vt)|0,b=b+Math.imul(Ne,Dt)|0,b=b+Math.imul(Te,vt)|0,M=M+Math.imul(Te,Dt)|0,S=S+Math.imul(fe,bt)|0,b=b+Math.imul(fe,$t)|0,b=b+Math.imul(ve,bt)|0,M=M+Math.imul(ve,$t)|0,S=S+Math.imul(te,nt)|0,b=b+Math.imul(te,Ft)|0,b=b+Math.imul(he,nt)|0,M=M+Math.imul(he,Ft)|0,S=S+Math.imul(Q,H)|0,b=b+Math.imul(Q,V)|0,b=b+Math.imul(R,H)|0,M=M+Math.imul(R,V)|0,S=S+Math.imul(se,Y)|0,b=b+Math.imul(se,q)|0,b=b+Math.imul(ee,Y)|0,M=M+Math.imul(ee,q)|0,S=S+Math.imul(F,ge)|0,b=b+Math.imul(F,xe)|0,b=b+Math.imul(ae,ge)|0,M=M+Math.imul(ae,xe)|0;var Mt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,S=Math.imul(Be,ft),b=Math.imul(Be,Ht),b=b+Math.imul(et,ft)|0,M=Math.imul(et,Ht),S=S+Math.imul(Ee,St)|0,b=b+Math.imul(Ee,er)|0,b=b+Math.imul(Qe,St)|0,M=M+Math.imul(Qe,er)|0,S=S+Math.imul(ke,Ot)|0,b=b+Math.imul(ke,Bt)|0,b=b+Math.imul(ze,Ot)|0,M=M+Math.imul(ze,Bt)|0,S=S+Math.imul(Ie,vt)|0,b=b+Math.imul(Ie,Dt)|0,b=b+Math.imul(Le,vt)|0,M=M+Math.imul(Le,Dt)|0,S=S+Math.imul(Ne,bt)|0,b=b+Math.imul(Ne,$t)|0,b=b+Math.imul(Te,bt)|0,M=M+Math.imul(Te,$t)|0,S=S+Math.imul(fe,nt)|0,b=b+Math.imul(fe,Ft)|0,b=b+Math.imul(ve,nt)|0,M=M+Math.imul(ve,Ft)|0,S=S+Math.imul(te,H)|0,b=b+Math.imul(te,V)|0,b=b+Math.imul(he,H)|0,M=M+Math.imul(he,V)|0,S=S+Math.imul(Q,Y)|0,b=b+Math.imul(Q,q)|0,b=b+Math.imul(R,Y)|0,M=M+Math.imul(R,q)|0,S=S+Math.imul(se,ge)|0,b=b+Math.imul(se,xe)|0,b=b+Math.imul(ee,ge)|0,M=M+Math.imul(ee,xe)|0;var Et=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Et>>>26)|0,Et&=67108863,S=Math.imul(Be,St),b=Math.imul(Be,er),b=b+Math.imul(et,St)|0,M=Math.imul(et,er),S=S+Math.imul(Ee,Ot)|0,b=b+Math.imul(Ee,Bt)|0,b=b+Math.imul(Qe,Ot)|0,M=M+Math.imul(Qe,Bt)|0,S=S+Math.imul(ke,vt)|0,b=b+Math.imul(ke,Dt)|0,b=b+Math.imul(ze,vt)|0,M=M+Math.imul(ze,Dt)|0,S=S+Math.imul(Ie,bt)|0,b=b+Math.imul(Ie,$t)|0,b=b+Math.imul(Le,bt)|0,M=M+Math.imul(Le,$t)|0,S=S+Math.imul(Ne,nt)|0,b=b+Math.imul(Ne,Ft)|0,b=b+Math.imul(Te,nt)|0,M=M+Math.imul(Te,Ft)|0,S=S+Math.imul(fe,H)|0,b=b+Math.imul(fe,V)|0,b=b+Math.imul(ve,H)|0,M=M+Math.imul(ve,V)|0,S=S+Math.imul(te,Y)|0,b=b+Math.imul(te,q)|0,b=b+Math.imul(he,Y)|0,M=M+Math.imul(he,q)|0,S=S+Math.imul(Q,ge)|0,b=b+Math.imul(Q,xe)|0,b=b+Math.imul(R,ge)|0,M=M+Math.imul(R,xe)|0;var dt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(dt>>>26)|0,dt&=67108863,S=Math.imul(Be,Ot),b=Math.imul(Be,Bt),b=b+Math.imul(et,Ot)|0,M=Math.imul(et,Bt),S=S+Math.imul(Ee,vt)|0,b=b+Math.imul(Ee,Dt)|0,b=b+Math.imul(Qe,vt)|0,M=M+Math.imul(Qe,Dt)|0,S=S+Math.imul(ke,bt)|0,b=b+Math.imul(ke,$t)|0,b=b+Math.imul(ze,bt)|0,M=M+Math.imul(ze,$t)|0,S=S+Math.imul(Ie,nt)|0,b=b+Math.imul(Ie,Ft)|0,b=b+Math.imul(Le,nt)|0,M=M+Math.imul(Le,Ft)|0,S=S+Math.imul(Ne,H)|0,b=b+Math.imul(Ne,V)|0,b=b+Math.imul(Te,H)|0,M=M+Math.imul(Te,V)|0,S=S+Math.imul(fe,Y)|0,b=b+Math.imul(fe,q)|0,b=b+Math.imul(ve,Y)|0,M=M+Math.imul(ve,q)|0,S=S+Math.imul(te,ge)|0,b=b+Math.imul(te,xe)|0,b=b+Math.imul(he,ge)|0,M=M+Math.imul(he,xe)|0;var _t=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(_t>>>26)|0,_t&=67108863,S=Math.imul(Be,vt),b=Math.imul(Be,Dt),b=b+Math.imul(et,vt)|0,M=Math.imul(et,Dt),S=S+Math.imul(Ee,bt)|0,b=b+Math.imul(Ee,$t)|0,b=b+Math.imul(Qe,bt)|0,M=M+Math.imul(Qe,$t)|0,S=S+Math.imul(ke,nt)|0,b=b+Math.imul(ke,Ft)|0,b=b+Math.imul(ze,nt)|0,M=M+Math.imul(ze,Ft)|0,S=S+Math.imul(Ie,H)|0,b=b+Math.imul(Ie,V)|0,b=b+Math.imul(Le,H)|0,M=M+Math.imul(Le,V)|0,S=S+Math.imul(Ne,Y)|0,b=b+Math.imul(Ne,q)|0,b=b+Math.imul(Te,Y)|0,M=M+Math.imul(Te,q)|0,S=S+Math.imul(fe,ge)|0,b=b+Math.imul(fe,xe)|0,b=b+Math.imul(ve,ge)|0,M=M+Math.imul(ve,xe)|0;var ot=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(ot>>>26)|0,ot&=67108863,S=Math.imul(Be,bt),b=Math.imul(Be,$t),b=b+Math.imul(et,bt)|0,M=Math.imul(et,$t),S=S+Math.imul(Ee,nt)|0,b=b+Math.imul(Ee,Ft)|0,b=b+Math.imul(Qe,nt)|0,M=M+Math.imul(Qe,Ft)|0,S=S+Math.imul(ke,H)|0,b=b+Math.imul(ke,V)|0,b=b+Math.imul(ze,H)|0,M=M+Math.imul(ze,V)|0,S=S+Math.imul(Ie,Y)|0,b=b+Math.imul(Ie,q)|0,b=b+Math.imul(Le,Y)|0,M=M+Math.imul(Le,q)|0,S=S+Math.imul(Ne,ge)|0,b=b+Math.imul(Ne,xe)|0,b=b+Math.imul(Te,ge)|0,M=M+Math.imul(Te,xe)|0;var wt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(wt>>>26)|0,wt&=67108863,S=Math.imul(Be,nt),b=Math.imul(Be,Ft),b=b+Math.imul(et,nt)|0,M=Math.imul(et,Ft),S=S+Math.imul(Ee,H)|0,b=b+Math.imul(Ee,V)|0,b=b+Math.imul(Qe,H)|0,M=M+Math.imul(Qe,V)|0,S=S+Math.imul(ke,Y)|0,b=b+Math.imul(ke,q)|0,b=b+Math.imul(ze,Y)|0,M=M+Math.imul(ze,q)|0,S=S+Math.imul(Ie,ge)|0,b=b+Math.imul(Ie,xe)|0,b=b+Math.imul(Le,ge)|0,M=M+Math.imul(Le,xe)|0;var lt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul(Be,H),b=Math.imul(Be,V),b=b+Math.imul(et,H)|0,M=Math.imul(et,V),S=S+Math.imul(Ee,Y)|0,b=b+Math.imul(Ee,q)|0,b=b+Math.imul(Qe,Y)|0,M=M+Math.imul(Qe,q)|0,S=S+Math.imul(ke,ge)|0,b=b+Math.imul(ke,xe)|0,b=b+Math.imul(ze,ge)|0,M=M+Math.imul(ze,xe)|0;var at=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(at>>>26)|0,at&=67108863,S=Math.imul(Be,Y),b=Math.imul(Be,q),b=b+Math.imul(et,Y)|0,M=Math.imul(et,q),S=S+Math.imul(Ee,ge)|0,b=b+Math.imul(Ee,xe)|0,b=b+Math.imul(Qe,ge)|0,M=M+Math.imul(Qe,xe)|0;var Ae=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,S=Math.imul(Be,ge),b=Math.imul(Be,xe),b=b+Math.imul(et,ge)|0,M=Math.imul(et,xe);var Pe=(_+S|0)+((b&8191)<<13)|0;return _=(M+(b>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,x[0]=Re,x[1]=De,x[2]=it,x[3]=Ue,x[4]=gt,x[5]=st,x[6]=tt,x[7]=At,x[8]=Rt,x[9]=Mt,x[10]=Et,x[11]=dt,x[12]=_t,x[13]=ot,x[14]=wt,x[15]=lt,x[16]=at,x[17]=Ae,x[18]=Pe,_!==0&&(x[19]=_,f.length++),f};Math.imul||(O=P);function D(G,E,m){m.negative=E.negative^G.negative,m.length=G.length+E.length;for(var f=0,p=0,v=0;v>>26)|0,p+=x>>>26,x&=67108863}m.words[v]=_,f=x,x=p}return f!==0?m.words[v]=f:m.length--,m.strip()}function k(G,E,m){var f=new B;return f.mulp(G,E,m)}s.prototype.mulTo=function(E,m){var f,p=this.length+E.length;return this.length===10&&E.length===10?f=O(this,E,m):p<63?f=P(this,E,m):p<1024?f=D(this,E,m):f=k(this,E,m),f};function B(G,E){this.x=G,this.y=E}B.prototype.makeRBT=function(E){for(var m=new Array(E),f=s.prototype._countBits(E)-1,p=0;p>=1;return p},B.prototype.permute=function(E,m,f,p,v,x){for(var _=0;_>>1)v++;return 1<>>13,f[2*x+1]=v&8191,v=v>>>13;for(x=2*m;x>=26,m+=p/67108864|0,m+=v>>>26,this.words[f]=v&67108863}return m!==0&&(this.words[f]=m,this.length++),this},s.prototype.muln=function(E){return this.clone().imuln(E)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(E){var m=A(E);if(m.length===0)return new s(1);for(var f=this,p=0;p=0);var m=E%26,f=(E-m)/26,p=67108863>>>26-m<<26-m,v;if(m!==0){var x=0;for(v=0;v>>26-m}x&&(this.words[v]=x,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var p;m?p=(m-m%26)/26:p=0;var v=E%26,x=Math.min((E-v)/26,this.length),_=67108863^67108863>>>v<x)for(this.length-=x,b=0;b=0&&(M!==0||b>=p);b--){var I=this.words[b]|0;this.words[b]=M<<26-v|I>>>v,M=I&_}return S&&M!==0&&(S.words[S.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(E,m,f){return n(this.negative===0),this.iushrn(E,m,f)},s.prototype.shln=function(E){return this.clone().ishln(E)},s.prototype.ushln=function(E){return this.clone().iushln(E)},s.prototype.shrn=function(E){return this.clone().ishrn(E)},s.prototype.ushrn=function(E){return this.clone().iushrn(E)},s.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var m=E%26,f=(E-m)/26,p=1<=0);var m=E%26,f=(E-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(m!==0&&f++,this.length=Math.min(f,this.length),m!==0){var p=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(S/67108864|0),this.words[v+f]=x&67108863}for(;v>26,this.words[v+f]=x&67108863;if(_===0)return this.strip();for(n(_===-1),_=0,v=0;v>26,this.words[v]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(E,m){var f=this.length-E.length,p=this.clone(),v=E,x=v.words[v.length-1]|0,_=this._countBits(x);f=26-_,f!==0&&(v=v.ushln(f),p.iushln(f),x=v.words[v.length-1]|0);var S=p.length-v.length,b;if(m!=="mod"){b=new s(null),b.length=S+1,b.words=new Array(b.length);for(var M=0;M=0;F--){var ae=(p.words[v.length+F]|0)*67108864+(p.words[v.length+F-1]|0);for(ae=Math.min(ae/x|0,67108863),p._ishlnsubmul(v,ae,F);p.negative!==0;)ae--,p.negative=0,p._ishlnsubmul(v,1,F),p.isZero()||(p.negative^=1);b&&(b.words[F]=ae)}return b&&b.strip(),p.strip(),m!=="div"&&f!==0&&p.iushrn(f),{div:b||null,mod:p}},s.prototype.divmod=function(E,m,f){if(n(!E.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var p,v,x;return this.negative!==0&&E.negative===0?(x=this.neg().divmod(E,m),m!=="mod"&&(p=x.div.neg()),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.iadd(E)),{div:p,mod:v}):this.negative===0&&E.negative!==0?(x=this.divmod(E.neg(),m),m!=="mod"&&(p=x.div.neg()),{div:p,mod:x.mod}):this.negative&E.negative?(x=this.neg().divmod(E.neg(),m),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.isub(E)),{div:x.div,mod:v}):E.length>this.length||this.cmp(E)<0?{div:new s(0),mod:this}:E.length===1?m==="div"?{div:this.divn(E.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new s(this.modn(E.words[0]))}:this._wordDiv(E,m)},s.prototype.div=function(E){return this.divmod(E,"div",!1).div},s.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},s.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},s.prototype.divRound=function(E){var m=this.divmod(E);if(m.mod.isZero())return m.div;var f=m.div.negative!==0?m.mod.isub(E):m.mod,p=E.ushrn(1),v=E.andln(1),x=f.cmp(p);return x<0||v===1&&x===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(E){n(E<=67108863);for(var m=(1<<26)%E,f=0,p=this.length-1;p>=0;p--)f=(m*f+(this.words[p]|0))%E;return f},s.prototype.idivn=function(E){n(E<=67108863);for(var m=0,f=this.length-1;f>=0;f--){var p=(this.words[f]|0)+m*67108864;this.words[f]=p/E|0,m=p%E}return this.strip()},s.prototype.divn=function(E){return this.clone().idivn(E)},s.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var p=new s(1),v=new s(0),x=new s(0),_=new s(1),S=0;m.isEven()&&f.isEven();)m.iushrn(1),f.iushrn(1),++S;for(var b=f.clone(),M=m.clone();!m.isZero();){for(var I=0,F=1;!(m.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(m.iushrn(I);I-- >0;)(p.isOdd()||v.isOdd())&&(p.iadd(b),v.isub(M)),p.iushrn(1),v.iushrn(1);for(var ae=0,N=1;!(f.words[0]&N)&&ae<26;++ae,N<<=1);if(ae>0)for(f.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(b),_.isub(M)),x.iushrn(1),_.iushrn(1);m.cmp(f)>=0?(m.isub(f),p.isub(x),v.isub(_)):(f.isub(m),x.isub(p),_.isub(v))}return{a:x,b:_,gcd:f.iushln(S)}},s.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var p=new s(1),v=new s(0),x=f.clone();m.cmpn(1)>0&&f.cmpn(1)>0;){for(var _=0,S=1;!(m.words[0]&S)&&_<26;++_,S<<=1);if(_>0)for(m.iushrn(_);_-- >0;)p.isOdd()&&p.iadd(x),p.iushrn(1);for(var b=0,M=1;!(f.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(f.iushrn(b);b-- >0;)v.isOdd()&&v.iadd(x),v.iushrn(1);m.cmp(f)>=0?(m.isub(f),p.isub(v)):(f.isub(m),v.isub(p))}var I;return m.cmpn(1)===0?I=p:I=v,I.cmpn(0)<0&&I.iadd(E),I},s.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var m=this.clone(),f=E.clone();m.negative=0,f.negative=0;for(var p=0;m.isEven()&&f.isEven();p++)m.iushrn(1),f.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=m.cmp(f);if(v<0){var x=m;m=f,f=x}else if(v===0||f.cmpn(1)===0)break;m.isub(f)}while(!0);return f.iushln(p)},s.prototype.invm=function(E){return this.egcd(E).a.umod(E)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(E){return this.words[0]&E},s.prototype.bincn=function(E){n(typeof E=="number");var m=E%26,f=(E-m)/26,p=1<>>26,_&=67108863,this.words[x]=_}return v!==0&&(this.words[x]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(E){var m=E<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var f;if(this.length>1)f=1;else{m&&(E=-E),n(E<=67108863,"Number is too big");var p=this.words[0]|0;f=p===E?0:pE.length)return 1;if(this.length=0;f--){var p=this.words[f]|0,v=E.words[f]|0;if(p!==v){pv&&(m=1);break}}return m},s.prototype.gtn=function(E){return this.cmpn(E)===1},s.prototype.gt=function(E){return this.cmp(E)===1},s.prototype.gten=function(E){return this.cmpn(E)>=0},s.prototype.gte=function(E){return this.cmp(E)>=0},s.prototype.ltn=function(E){return this.cmpn(E)===-1},s.prototype.lt=function(E){return this.cmp(E)===-1},s.prototype.lten=function(E){return this.cmpn(E)<=0},s.prototype.lte=function(E){return this.cmp(E)<=0},s.prototype.eqn=function(E){return this.cmpn(E)===0},s.prototype.eq=function(E){return this.cmp(E)===0},s.red=function(E){return new ue(E)},s.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(E){return this.red=E,this},s.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},s.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},s.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},s.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},s.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},s.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},s.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},s.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var j={k256:null,p224:null,p192:null,p25519:null};function U(G,E){this.name=G,this.p=new s(E,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var E=new s(null);return E.words=new Array(Math.ceil(this.n/13)),E},U.prototype.ireduce=function(E){var m=E,f;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),f=m.bitLength();while(f>this.n);var p=f0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},U.prototype.split=function(E,m){E.iushrn(this.n,0,m)},U.prototype.imulK=function(E){return E.imul(this.k)};function K(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(K,U),K.prototype.split=function(E,m){for(var f=4194303,p=Math.min(E.length,9),v=0;v>>22,x=_}x>>>=22,E.words[v-10]=x,x===0&&E.length>10?E.length-=10:E.length-=9},K.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var m=0,f=0;f>>=26,E.words[f]=v,m=p}return m!==0&&(E.words[E.length++]=m),E},s._prime=function(E){if(j[E])return j[E];var m;if(E==="k256")m=new K;else if(E==="p224")m=new J;else if(E==="p192")m=new T;else if(E==="p25519")m=new z;else throw new Error("Unknown prime "+E);return j[E]=m,m};function ue(G){if(typeof G=="string"){var E=s._prime(G);this.m=E.p,this.prime=E}else n(G.gtn(1),"modulus must be greater than 1"),this.m=G,this.prime=null}ue.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},ue.prototype._verify2=function(E,m){n((E.negative|m.negative)===0,"red works only with positives"),n(E.red&&E.red===m.red,"red works only with red numbers")},ue.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},ue.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},ue.prototype.add=function(E,m){this._verify2(E,m);var f=E.add(m);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},ue.prototype.iadd=function(E,m){this._verify2(E,m);var f=E.iadd(m);return f.cmp(this.m)>=0&&f.isub(this.m),f},ue.prototype.sub=function(E,m){this._verify2(E,m);var f=E.sub(m);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},ue.prototype.isub=function(E,m){this._verify2(E,m);var f=E.isub(m);return f.cmpn(0)<0&&f.iadd(this.m),f},ue.prototype.shl=function(E,m){return this._verify1(E),this.imod(E.ushln(m))},ue.prototype.imul=function(E,m){return this._verify2(E,m),this.imod(E.imul(m))},ue.prototype.mul=function(E,m){return this._verify2(E,m),this.imod(E.mul(m))},ue.prototype.isqr=function(E){return this.imul(E,E.clone())},ue.prototype.sqr=function(E){return this.mul(E,E)},ue.prototype.sqrt=function(E){if(E.isZero())return E.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(E,f)}for(var p=this.m.subn(1),v=0;!p.isZero()&&p.andln(1)===0;)v++,p.iushrn(1);n(!p.isZero());var x=new s(1).toRed(this),_=x.redNeg(),S=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new s(2*b*b).toRed(this);this.pow(b,S).cmp(_)!==0;)b.redIAdd(_);for(var M=this.pow(b,p),I=this.pow(E,p.addn(1).iushrn(1)),F=this.pow(E,p),ae=v;F.cmp(x)!==0;){for(var N=F,se=0;N.cmp(x)!==0;se++)N=N.redSqr();n(se=0;v--){for(var M=m.words[v],I=b-1;I>=0;I--){var F=M>>I&1;if(x!==p[0]&&(x=this.sqr(x)),F===0&&_===0){S=0;continue}_<<=1,_|=F,S++,!(S!==f&&(v!==0||I!==0))&&(x=this.mul(x,p[_]),S=0,_=0)}b=26}return x},ue.prototype.convertTo=function(E){var m=E.umod(this.m);return m===E?m.clone():m},ue.prototype.convertFrom=function(E){var m=E.clone();return m.red=null,m},s.mont=function(E){return new _e(E)};function _e(G){ue.call(this,G),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(_e,ue),_e.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},_e.prototype.convertFrom=function(E){var m=this.imod(E.mul(this.rinv));return m.red=null,m},_e.prototype.imul=function(E,m){if(E.isZero()||m.isZero())return E.words[0]=0,E.length=1,E;var f=E.imul(m),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.mul=function(E,m){if(E.isZero()||m.isZero())return new s(0)._forceRed(this);var f=E.mul(m),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.invm=function(E){var m=this.imod(E._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,nn)}(Wm);var Eo=Wm.exports,Km={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var u=0;u>8,g=l&255;d?a.push(d,g):a.push(g)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(O>>1)-1?k=(O>>1)-B:k=B,D.isubn(k)):k=0,A[P]=k,D.iushrn(1)}return A}e.getNAF=s;function o(d,g){var y=[[],[]];d=d.clone(),g=g.clone();for(var A=0,P=0,O;d.cmpn(-A)>0||g.cmpn(-P)>0;){var D=d.andln(3)+A&3,k=g.andln(3)+P&3;D===3&&(D=-1),k===3&&(k=-1);var B;D&1?(O=d.andln(7)+A&7,(O===3||O===5)&&k===2?B=-D:B=D):B=0,y[0].push(B);var j;k&1?(O=g.andln(7)+P&7,(O===3||O===5)&&D===2?j=-k:j=k):j=0,y[1].push(j),2*A===B+1&&(A=1-A),2*P===j+1&&(P=1-P),d.iushrn(1),g.iushrn(1)}return y}e.getJSF=o;function a(d,g,y){var A="_"+g;d.prototype[g]=function(){return this[A]!==void 0?this[A]:this[A]=y.call(this)}}e.cachedProperty=a;function u(d){return typeof d=="string"?e.toArray(d,"hex"):d}e.parseBytes=u;function l(d){return new r(d,"hex","le")}e.intFromLE=l}(Ti);var Vm={exports:{}},Gm;Vm.exports=function(e){return Gm||(Gm=new ua(null)),Gm.generate(e)};function ua(t){this.rand=t}if(Vm.exports.Rand=ua,ua.prototype.generate=function(e){return this._rand(e)},ua.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Rd=fa;fa.prototype.point=function(){throw new Error("Not implemented")},fa.prototype.validate=function(){throw new Error("Not implemented")},fa.prototype._fixedNafMul=function(e,r){Td(e.precomputed);var n=e._getDoubles(),i=Cd(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),g=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Td(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},fa.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,g,y;for(d=0;d=1;d-=2){var P=d-1,O=d;if(o[P]!==1||o[O]!==1){u[P]=Cd(n[P],o[P],this._bitLength),u[O]=Cd(n[O],o[O],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[O].length,l);continue}var D=[r[P],null,null,r[O]];r[P].y.cmp(r[O].y)===0?(D[1]=r[P].add(r[O]),D[2]=r[P].toJ().mixedAdd(r[O].neg())):r[P].y.cmp(r[O].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[O]),D[2]=r[P].add(r[O].neg())):(D[1]=r[P].toJ().mixedAdd(r[O]),D[2]=r[P].toJ().mixedAdd(r[O].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=Ok(n[P],n[O]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[O]=new Array(l),g=0;g=0;d--){for(var T=0;d>=0;){var z=!0;for(g=0;g=0&&T++,K=K.dblp(T),d<0)break;for(g=0;g0?y=a[g][ue-1>>1]:ue<0&&(y=a[g][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Vi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),g.negative&&(g=g.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:g,b:y},{a:A,b:P}]},Gi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),g=e.sub(a).sub(u),y=l.add(d).neg();return{k1:g,k2:y}},Gi.prototype.pointFromX=function(e,r){e=new en(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Gi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Gi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},On.prototype.isInfinity=function(){return this.inf},On.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},On.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},On.prototype.getX=function(){return this.x.fromRed()},On.prototype.getY=function(){return this.y.fromRed()},On.prototype.mul=function(e){return e=new en(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},On.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},On.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},On.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},On.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},On.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function qn(t,e,r,n){bu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new en(0)):(this.x=new en(e,16),this.y=new en(r,16),this.z=new en(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Jm(qn,bu.BasePoint),Gi.prototype.jpoint=function(e,r,n){return new qn(this,e,r,n)},qn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},qn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},qn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),g=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(g).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(g)),O=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,O)},qn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),g=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(g).redISub(g),A=u.redMul(g.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},qn.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},qn.prototype.inspect=function(){return this.isInfinity()?"":""},qn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var yu=Eo,T3=yd,Dd=Rd,Bk=Ti;function wu(t){Dd.call(this,"mont",t),this.a=new yu(t.a,16).toRed(this.red),this.b=new yu(t.b,16).toRed(this.red),this.i4=new yu(4).toRed(this.red).redInvm(),this.two=new yu(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}T3(wu,Dd);var $k=wu;wu.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function Nn(t,e,r){Dd.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new yu(e,16),this.z=new yu(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}T3(Nn,Dd.BasePoint),wu.prototype.decodePoint=function(e,r){return this.point(Bk.toArray(e,r),1)},wu.prototype.point=function(e,r){return new Nn(this,e,r)},wu.prototype.pointFromJSON=function(e){return Nn.fromJSON(this,e)},Nn.prototype.precompute=function(){},Nn.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Nn.fromJSON=function(e,r){return new Nn(e,r[0],r[1]||e.one)},Nn.prototype.inspect=function(){return this.isInfinity()?"":""},Nn.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Nn.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)},Nn.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),u=s.redMul(i),l=r.z.redMul(a.redAdd(u).redSqr()),d=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(l,d)},Nn.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i},Nn.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Nn.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Nn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var Fk=Ti,So=Eo,R3=yd,Od=Rd,jk=Fk.assert;function zs(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Od.call(this,"edwards",t),this.a=new So(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new So(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new So(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),jk(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}R3(zs,Od);var Uk=zs;zs.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},zs.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},zs.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)},zs.prototype.pointFromX=function(e,r){e=new So(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var u=a.fromRed().isOdd();return(r&&!u||!r&&u)&&(a=a.redNeg()),this.point(e,a)},zs.prototype.pointFromY=function(e,r){e=new So(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)},zs.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function Hr(t,e,r,n,i){Od.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new So(e,16),this.y=new So(r,16),this.z=n?new So(n,16):this.curve.one,this.t=i&&new So(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}R3(Hr,Od.BasePoint),zs.prototype.pointFromJSON=function(e){return Hr.fromJSON(this,e)},zs.prototype.point=function(e,r,n,i){return new Hr(this,e,r,n,i)},Hr.fromJSON=function(e,r){return new Hr(e,r[0],r[1],r[2])},Hr.prototype.inspect=function(){return this.isInfinity()?"":""},Hr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Hr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),u=i.redSub(r),l=s.redMul(a),d=o.redMul(u),g=s.redMul(u),y=a.redMul(o);return this.curve.point(l,d,y,g)},Hr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,u,l;if(this.curve.twisted){a=this.curve._mulA(r);var d=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(d.redSub(this.curve.two)),s=d.redMul(a.redSub(n)),o=d.redSqr().redSub(d).redSub(d)):(u=this.z.redSqr(),l=d.redSub(u).redISub(u),i=e.redSub(r).redISub(n).redMul(l),s=d.redMul(a.redSub(n)),o=d.redMul(l))}else a=r.redAdd(n),u=this.curve._mulC(this.z).redSqr(),l=a.redSub(u).redSub(u),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)},Hr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Hr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),u=s.redAdd(i),l=n.redAdd(r),d=o.redMul(a),g=u.redMul(l),y=o.redMul(l),A=a.redMul(u);return this.curve.point(d,g,A,y)},Hr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),u=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),d=r.redMul(a).redMul(l),g,y;return this.curve.twisted?(g=r.redMul(u).redMul(s.redSub(this.curve._mulA(i))),y=a.redMul(u)):(g=r.redMul(u).redMul(s.redSub(i)),y=this.curve._mulC(a).redMul(u)),this.curve.point(d,g,y)},Hr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Hr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Hr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)},Hr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)},Hr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Hr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Hr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Hr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Hr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Hr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Hr.prototype.toP=Hr.prototype.normalize,Hr.prototype.mixedAdd=Hr.prototype.add,function(t){var e=t;e.base=Rd,e.short=kk,e.mont=$k,e.edwards=Uk}(Ym);var Nd={},Xm,D3;function qk(){return D3||(D3=1,Xm={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Xm}(function(t){var e=t,r=al,n=Ym,i=Ti,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,d){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var g=new o(d);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:g}),g}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=qk()}catch{u=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})})(Nd);var zk=al,ec=Km,O3=Ja;function la(t){if(!(this instanceof la))return new la(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ec.toArray(t.entropy,t.entropyEnc||"hex"),r=ec.toArray(t.nonce,t.nonceEnc||"hex"),n=ec.toArray(t.pers,t.persEnc||"hex");O3(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Hk=la;la.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},la.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=ec.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var Ld=Eo,Qm=Ti,Gk=Qm.assert;function kd(t,e){if(t instanceof kd)return t;this._importDER(t,e)||(Gk(t.r&&t.s,"Signature without r or s"),this.r=new Ld(t.r,16),this.s=new Ld(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Yk=kd;function Jk(){this.place=0}function e1(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function N3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}kd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=N3(r),n=N3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];t1(i,r.length),i=i.concat(r),i.push(2),t1(i,n.length);var s=i.concat(n),o=[48];return t1(o,s.length),o=o.concat(s),Qm.encode(o,e)};var Ao=Eo,L3=Hk,Xk=Ti,r1=Nd,Zk=C3,k3=Xk.assert,n1=Vk,Bd=Yk;function Yi(t){if(!(this instanceof Yi))return new Yi(t);typeof t=="string"&&(k3(Object.prototype.hasOwnProperty.call(r1,t),"Unknown curve "+t),t=r1[t]),t instanceof r1.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Qk=Yi;Yi.prototype.keyPair=function(e){return new n1(this,e)},Yi.prototype.keyFromPrivate=function(e,r){return n1.fromPrivate(this,e,r)},Yi.prototype.keyFromPublic=function(e,r){return n1.fromPublic(this,e,r)},Yi.prototype.genKeyPair=function(e){e||(e={});for(var r=new L3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Zk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new Ao(2));;){var s=new Ao(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Yi.prototype._truncateToN=function(e,r,n){var i;if(Ao.isBN(e)||typeof e=="number")e=new Ao(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new Ao(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new Ao(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Yi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new L3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new Ao(1)),d=0;;d++){var g=i.k?i.k(d):new Ao(u.generate(this.n.byteLength()));if(g=this._truncateToN(g,!0),!(g.cmpn(1)<=0||g.cmp(l)>=0)){var y=this.g.mul(g);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var O=g.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(O=O.umod(this.n),O.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&O.cmp(this.nh)>0&&(O=this.n.sub(O),D^=1),new Bd({r:P,s:O,recoveryParam:D})}}}}}},Yi.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new Bd(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),l=u.mul(e).umod(this.n),d=u.mul(o).umod(this.n),g;return this.curve._maxwellTrick?(g=this.g.jmulAdd(l,n.getPublic(),d),g.isInfinity()?!1:g.eqXToP(o)):(g=this.g.mulAdd(l,n.getPublic(),d),g.isInfinity()?!1:g.getX().umod(this.n).cmp(o)===0)},Yi.prototype.recoverPubKey=function(t,e,r,n){k3((3&r)===r,"The recovery param is more than two bits"),e=new Bd(e,n);var i=this.n,s=new Ao(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),g=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(g,o,y)},Yi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Bd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dl=Ti,B3=dl.assert,$3=dl.parseBytes,xu=dl.cachedProperty;function Ln(t,e){this.eddsa=t,this._secret=$3(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=$3(e.pub)}Ln.fromPublic=function(e,r){return r instanceof Ln?r:new Ln(e,{pub:r})},Ln.fromSecret=function(e,r){return r instanceof Ln?r:new Ln(e,{secret:r})},Ln.prototype.secret=function(){return this._secret},xu(Ln,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),xu(Ln,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),xu(Ln,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i}),xu(Ln,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),xu(Ln,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),xu(Ln,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Ln.prototype.sign=function(e){return B3(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Ln.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},Ln.prototype.getSecret=function(e){return B3(this._secret,"KeyPair is public only"),dl.encode(this.secret(),e)},Ln.prototype.getPublic=function(e){return dl.encode(this.pubBytes(),e)};var eB=Ln,tB=Eo,$d=Ti,F3=$d.assert,Fd=$d.cachedProperty,rB=$d.parseBytes;function tc(t,e){this.eddsa=t,typeof e!="object"&&(e=rB(e)),Array.isArray(e)&&(F3(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),F3(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof tB&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Fd(tc,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Fd(tc,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Fd(tc,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Fd(tc,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),tc.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},tc.prototype.toHex=function(){return $d.encode(this.toBytes(),"hex").toUpperCase()};var nB=tc,iB=al,sB=Nd,_u=Ti,oB=_u.assert,j3=_u.parseBytes,U3=eB,q3=nB;function vi(t){if(oB(t==="ed25519","only tested with ed25519 so far"),!(this instanceof vi))return new vi(t);t=sB[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=iB.sha512}var aB=vi;vi.prototype.sign=function(e,r){e=j3(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),u=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:u,Rencoded:o})},vi.prototype.verify=function(e,r,n){if(e=j3(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)},vi.prototype.hashInt=function(){for(var e=this.hash(),r=0;re in t?fB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,K3=(t,e)=>{for(var r in e||(e={}))lB.call(e,r)&&W3(t,r,e[r]);if(H3)for(var r of H3(e))hB.call(e,r)&&W3(t,r,e[r]);return t};const dB="ReactNative",Ri={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},pB="js";function jd(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Su(){return!nl()&&!!mm()&&navigator.product===dB}function pl(){return!jd()&&!!mm()&&!!nl()}function gl(){return Su()?Ri.reactNative:jd()?Ri.node:pl()?Ri.browser:Ri.unknown}function gB(){var t;try{return Su()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function mB(t,e){let r=il.parse(t);return r=K3(K3({},r),e),t=il.stringify(r),t}function V3(){return Mx()||{name:"",description:"",url:"",icons:[""]}}function vB(){if(gl()===Ri.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=zO();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function bB(){var t;const e=gl();return e===Ri.browser?[e,((t=Px())==null?void 0:t.host)||"unknown"].join(":"):e}function G3(t,e,r){const n=vB(),i=bB();return[[t,e].join("-"),[pB,r].join("-"),n,i].join("/")}function yB({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const u=r.split("?"),l=G3(t,e,n),d={auth:i,ua:l,projectId:s,useOnCloseEvent:o,origin:a||void 0},g=mB(u[1]||"",d);return u[0]+"?"+g}function rc(t,e){return t.filter(r=>e.includes(r)).length===t.length}function Y3(t){return Object.fromEntries(t.entries())}function J3(t){return new Map(Object.entries(t))}function nc(t=mt.FIVE_MINUTES,e){const r=mt.toMiliseconds(t||mt.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Au(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function X3(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function wB(t){return X3("topic",t)}function xB(t){return X3("id",t)}function Z3(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function En(t,e){return mt.fromMiliseconds(Date.now()+mt.toMiliseconds(t))}function ha(t){return Date.now()>=mt.toMiliseconds(t)}function vr(t,e){return`${t}${e?`:${e}`:""}`}function Ud(t=[],e=[]){return[...new Set([...t,...e])]}async function _B({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=EB(s,t,e),a=gl();if(a===Ri.browser){if(!((n=nl())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,AB()?"_blank":"_self","noreferrer noopener")}else a===Ri.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function EB(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${PB(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function SB(t,e){let r="";try{if(pl()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function Q3(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function e_(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function i1(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function AB(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function PB(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function t_(t){return Buffer.from(t,"base64").toString("utf-8")}const MB="https://rpc.walletconnect.org/v1";async function IB(t,e,r,n,i,s){switch(r.t){case"eip191":return CB(t,e,r.s);case"eip1271":return await TB(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function CB(t,e,r){return bk(zx(e),r).toLowerCase()===t.toLowerCase()}async function TB(t,e,r,n,i,s){const o=Eu(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",d=r.substring(2),g=zx(e).substring(2),y=a+g+u+l+d,A=await fetch(`${s||MB}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:RB(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:y},"latest"]})}),{result:P}=await A.json();return P?P.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function RB(){return Date.now()+Math.floor(Math.random()*1e3)}var DB=Object.defineProperty,OB=Object.defineProperties,NB=Object.getOwnPropertyDescriptors,r_=Object.getOwnPropertySymbols,LB=Object.prototype.hasOwnProperty,kB=Object.prototype.propertyIsEnumerable,n_=(t,e,r)=>e in t?DB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,BB=(t,e)=>{for(var r in e||(e={}))LB.call(e,r)&&n_(t,r,e[r]);if(r_)for(var r of r_(e))kB.call(e,r)&&n_(t,r,e[r]);return t},$B=(t,e)=>OB(t,NB(e));const FB="did:pkh:",s1=t=>t==null?void 0:t.split(":"),jB=t=>{const e=t&&s1(t);if(e)return t.includes(FB)?e[3]:e[1]},o1=t=>{const e=t&&s1(t);if(e)return e[2]+":"+e[3]},qd=t=>{const e=t&&s1(t);if(e)return e.pop()};async function i_(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=s_(i,i.iss),o=qd(i.iss);return await IB(o,s,n,o1(i.iss),r)}const s_=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=qd(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${jB(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,d=t.exp?`Expiration Time: ${t.exp}`:void 0,g=t.nbf?`Not Before: ${t.nbf}`:void 0,y=t.requestId?`Request ID: ${t.requestId}`:void 0,A=t.resources?`Resources:${t.resources.map(O=>` -- ${O}`).join("")}`:void 0,P=zd(t.resources);if(P){const O=ml(P);i=YB(i,O)}return[r,n,"",i,"",s,o,a,u,l,d,g,y,A].filter(O=>O!=null).join(` -`)};function UB(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function qB(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function ic(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function zB(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:HB(e,r,n)}}}function HB(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function o_(t){return ic(t),`urn:recap:${UB(t).replace(/=/g,"")}`}function ml(t){const e=qB(t.replace("urn:recap:",""));return ic(e),e}function WB(t,e,r){const n=zB(t,e,r);return o_(n)}function KB(t){return t&&t.includes("urn:recap:")}function VB(t,e){const r=ml(t),n=ml(e),i=GB(r,n);return o_(i)}function GB(t,e){ic(t),ic(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,u)=>a.localeCompare(u)).forEach(a=>{var u,l;n.att[i]=$B(BB({},n.att[i]),{[a]:((u=t.att[i])==null?void 0:u[a])||((l=e.att[i])==null?void 0:l[a])})})}),n}function YB(t="",e){ic(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const u=Object.keys(e.att[a]).map(g=>({ability:g.split("/")[0],action:g.split("/")[1]}));u.sort((g,y)=>g.action.localeCompare(y.action));const l={};u.forEach(g=>{l[g.ability]||(l[g.ability]=[]),l[g.ability].push(g.action)});const d=Object.keys(l).map(g=>(i++,`(${i}) '${g}': '${l[g].join("', '")}' for '${a}'.`));n.push(d.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function a_(t){var e;const r=ml(t);ic(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function c_(t){const e=ml(t);ic(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function zd(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return KB(e)?e:void 0}const u_="base10",ni="base16",da="base64pad",vl="base64url",bl="utf8",f_=0,Po=1,yl=2,JB=0,l_=1,wl=12,a1=32;function XB(){const t=Hm.generateKeyPair();return{privateKey:Tn(t.secretKey,ni),publicKey:Tn(t.publicKey,ni)}}function c1(){const t=na.randomBytes(a1);return Tn(t,ni)}function ZB(t,e){const r=Hm.sharedKey(Rn(t,ni),Rn(e,ni),!0),n=new Rk(ll.SHA256,r).expand(a1);return Tn(n,ni)}function Hd(t){const e=ll.hash(Rn(t,ni));return Tn(e,ni)}function Mo(t){const e=ll.hash(Rn(t,bl));return Tn(e,ni)}function h_(t){return Rn(`${t}`,u_)}function sc(t){return Number(Tn(t,u_))}function QB(t){const e=h_(typeof t.type<"u"?t.type:f_);if(sc(e)===Po&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Rn(t.senderPublicKey,ni):void 0,n=typeof t.iv<"u"?Rn(t.iv,ni):na.randomBytes(wl),i=new Um.ChaCha20Poly1305(Rn(t.symKey,ni)).seal(n,Rn(t.message,bl));return d_({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function e$(t,e){const r=h_(yl),n=na.randomBytes(wl),i=Rn(t,bl);return d_({type:r,sealed:i,iv:n,encoding:e})}function t$(t){const e=new Um.ChaCha20Poly1305(Rn(t.symKey,ni)),{sealed:r,iv:n}=xl({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Tn(i,bl)}function r$(t,e){const{sealed:r}=xl({encoded:t,encoding:e});return Tn(r,bl)}function d_(t){const{encoding:e=da}=t;if(sc(t.type)===yl)return Tn(pd([t.type,t.sealed]),e);if(sc(t.type)===Po){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Tn(pd([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return Tn(pd([t.type,t.iv,t.sealed]),e)}function xl(t){const{encoded:e,encoding:r=da}=t,n=Rn(e,r),i=n.slice(JB,l_),s=l_;if(sc(i)===Po){const l=s+a1,d=l+wl,g=n.slice(s,l),y=n.slice(l,d),A=n.slice(d);return{type:i,sealed:A,iv:y,senderPublicKey:g}}if(sc(i)===yl){const l=n.slice(s),d=na.randomBytes(wl);return{type:i,sealed:l,iv:d}}const o=s+wl,a=n.slice(s,o),u=n.slice(o);return{type:i,sealed:u,iv:a}}function n$(t,e){const r=xl({encoded:t,encoding:e==null?void 0:e.encoding});return p_({type:sc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Tn(r.senderPublicKey,ni):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function p_(t){const e=(t==null?void 0:t.type)||f_;if(e===Po){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function g_(t){return t.type===Po&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function m_(t){return t.type===yl}function i$(t){return new M3.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function s$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function o$(t){return Buffer.from(s$(t),"base64")}function a$(t,e){const[r,n,i]=t.split("."),s=o$(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),u=`${r}.${n}`,l=new ll.SHA256().update(Buffer.from(u)).digest(),d=i$(e),g=Buffer.from(l).toString("hex");if(!d.verify(g,{r:o,s:a}))throw new Error("Invalid signature");return gm(t).payload}const c$="irn";function u1(t){return(t==null?void 0:t.relay)||{protocol:c$}}function _l(t){const e=cB[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var u$=Object.defineProperty,f$=Object.defineProperties,l$=Object.getOwnPropertyDescriptors,v_=Object.getOwnPropertySymbols,h$=Object.prototype.hasOwnProperty,d$=Object.prototype.propertyIsEnumerable,b_=(t,e,r)=>e in t?u$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,y_=(t,e)=>{for(var r in e||(e={}))h$.call(e,r)&&b_(t,r,e[r]);if(v_)for(var r of v_(e))d$.call(e,r)&&b_(t,r,e[r]);return t},p$=(t,e)=>f$(t,l$(e));function g$(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function w_(t){if(!t.includes("wc:")){const u=t_(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=il.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:m$(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:g$(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function m$(t){return t.startsWith("//")?t.substring(2):t}function v$(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function x_(t){return`${t.protocol}:${t.topic}@${t.version}?`+il.stringify(y_(p$(y_({symKey:t.symKey},v$(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Wd(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Pu(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function b$(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Pu(r.accounts))}),e}function y$(t,e){const r=[];return Object.values(t).forEach(n=>{Pu(n.accounts).includes(e)&&r.push(...n.methods)}),r}function w$(t,e){const r=[];return Object.values(t).forEach(n=>{Pu(n.accounts).includes(e)&&r.push(...n.events)}),r}function f1(t){return t.includes(":")}function El(t){return f1(t)?t.split(":")[0]:t}function x$(t){const e={};return t==null||t.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function __(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=x$(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=Ud(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const _$={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},E$={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ut(t,e){const{message:r,code:n}=E$[t];return{message:e?`${r} ${e}`:r,code:n}}function Dr(t,e){const{message:r,code:n}=_$[t];return{message:e?`${r} ${e}`:r,code:n}}function oc(t,e){return!!Array.isArray(t)}function Sl(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function bi(t){return typeof t>"u"}function an(t,e){return e&&bi(t)?!0:typeof t=="string"&&!!t.trim().length}function l1(t,e){return typeof t=="number"&&!isNaN(t)}function S$(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return rc(i,n)?(n.forEach(o=>{const{accounts:a,methods:u,events:l}=t.namespaces[o],d=Pu(a),g=r[o];(!rc(z3(o,g),d)||!rc(g.methods,u)||!rc(g.events,l))&&(s=!1)}),s):!1}function Kd(t){return an(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function A$(t){if(an(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Kd(r)}}return!1}function P$(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(an(t,!1)){if(e(t))return!0;const r=t_(t);return e(r)}}catch{}return!1}function M$(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function I$(t){return t==null?void 0:t.topic}function C$(t,e){let r=null;return an(t==null?void 0:t.publicKey,!1)||(r=ut("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function E_(t){let e=!0;return oc(t)?t.length&&(e=t.every(r=>an(r,!1))):e=!1,e}function T$(t,e,r){let n=null;return oc(e)&&e.length?e.forEach(i=>{n||Kd(i)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Kd(t)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function R$(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=T$(i,z3(i,s),`${e} ${r}`);o&&(n=o)}),n}function D$(t,e){let r=null;return oc(t)?t.forEach(n=>{r||A$(n)||(r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function O$(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=D$(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function N$(t,e){let r=null;return E_(t==null?void 0:t.methods)?E_(t==null?void 0:t.events)||(r=Dr("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Dr("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function S_(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=N$(n,`${e}, namespace`);i&&(r=i)}),r}function L$(t,e,r){let n=null;if(t&&Sl(t)){const i=S_(t,e);i&&(n=i);const s=R$(t,e,r);s&&(n=s)}else n=ut("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function h1(t,e){let r=null;if(t&&Sl(t)){const n=S_(t,e);n&&(r=n);const i=O$(t,e);i&&(r=i)}else r=ut("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function A_(t){return an(t.protocol,!0)}function k$(t,e){let r=!1;return t?t&&oc(t)&&t.length&&t.forEach(n=>{r=A_(n)}):r=!0,r}function B$(t){return typeof t=="number"}function yi(t){return typeof t<"u"&&typeof t!==null}function $$(t){return!(!t||typeof t!="object"||!t.code||!l1(t.code)||!t.message||!an(t.message,!1))}function F$(t){return!(bi(t)||!an(t.method,!1))}function j$(t){return!(bi(t)||bi(t.result)&&bi(t.error)||!l1(t.id)||!an(t.jsonrpc,!1))}function U$(t){return!(bi(t)||!an(t.name,!1))}function P_(t,e){return!(!Kd(e)||!b$(t).includes(e))}function q$(t,e,r){return an(r,!1)?y$(t,e).includes(r):!1}function z$(t,e,r){return an(r,!1)?w$(t,e).includes(r):!1}function M_(t,e,r){let n=null;const i=H$(t),s=W$(e),o=Object.keys(i),a=Object.keys(s),u=I_(Object.keys(t)),l=I_(Object.keys(e)),d=u.filter(g=>!l.includes(g));return d.length&&(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. + */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=nn:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],g=[4,1024,262144,67108864],y=[1,256,65536,16777216],A=[6,1536,393216,100663296],P=[0,8,16,24],N=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],D=[224,256,384,512],k=[128,256],B=["hex","buffer","arrayBuffer","array","digest"],j={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(O){return Object.prototype.toString.call(O)==="[object Array]"}),u&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(O){return typeof O=="object"&&O.buffer&&O.buffer.constructor===ArrayBuffer});for(var U=function(O,se,ee){return function(X){return new I(O,se,O).update(X)[ee]()}},K=function(O,se,ee){return function(X,Q){return new I(O,se,Q).update(X)[ee]()}},J=function(O,se,ee){return function(X,Q,R,Z){return f["cshake"+O].update(X,Q,R,Z)[ee]()}},T=function(O,se,ee){return function(X,Q,R,Z){return f["kmac"+O].update(X,Q,R,Z)[ee]()}},z=function(O,se,ee,X){for(var Q=0;Q>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ee>>5,this.extraBytes=(ee&31)>>3;for(var X=0;X<50;++X)this.s[X]=0}I.prototype.update=function(O){if(this.finalized)throw new Error(r);var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}for(var X=this.blocks,Q=this.byteCount,R=O.length,Z=this.blockCount,te=0,le=this.s,ie,fe;te>2]|=O[te]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(X[ie>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=Q){for(this.start=ie-Q,this.block=X[Z],ie=0;ie>8,ee=O&255;ee>0;)Q.unshift(ee),O=O>>8,ee=O&255,++X;return se?Q.push(X):Q.unshift(X),this.update(Q),Q.length},I.prototype.encodeString=function(O){var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}var X=0,Q=O.length;if(se)X=Q;else for(var R=0;R=57344?X+=3:(Z=65536+((Z&1023)<<10|O.charCodeAt(++R)&1023),X+=4)}return X+=this.encode(X*8),this.update(O),X},I.prototype.bytepad=function(O,se){for(var ee=this.encode(se),X=0;X>2]|=this.padding[se&3],this.lastByteIndex===this.byteCount)for(O[0]=O[ee],se=1;se>4&15]+l[te&15]+l[te>>12&15]+l[te>>8&15]+l[te>>20&15]+l[te>>16&15]+l[te>>28&15]+l[te>>24&15];R%O===0&&(ae(se),Q=0)}return X&&(te=se[Q],Z+=l[te>>4&15]+l[te&15],X>1&&(Z+=l[te>>12&15]+l[te>>8&15]),X>2&&(Z+=l[te>>20&15]+l[te>>16&15])),Z},I.prototype.arrayBuffer=function(){this.finalize();var O=this.blockCount,se=this.s,ee=this.outputBlocks,X=this.extraBytes,Q=0,R=0,Z=this.outputBits>>3,te;X?te=new ArrayBuffer(ee+1<<2):te=new ArrayBuffer(Z);for(var le=new Uint32Array(te);R>8&255,Z[te+2]=le>>16&255,Z[te+3]=le>>24&255;R%O===0&&ae(se)}return X&&(te=R<<2,le=se[Q],Z[te]=le&255,X>1&&(Z[te+1]=le>>8&255),X>2&&(Z[te+2]=le>>16&255)),Z};function F(O,se,ee){I.call(this,O,se,ee)}F.prototype=new I,F.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var ae=function(O){var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me,Ne,Te,$e,Ie,Le,Ve,ke,ze,He,Ee,Qe,ct,Be,et,rt,Je,pt,ht,ft,Ht,Jt,St,er,Xt,Ot,Bt,Tt,vt,Dt,Lt,bt,$t,jt,nt,Ft,$,H,V,C,Y,q,oe,pe,xe,Re,De,it,Ue,gt,st,tt;for(X=0;X<48;X+=2)Q=O[0]^O[10]^O[20]^O[30]^O[40],R=O[1]^O[11]^O[21]^O[31]^O[41],Z=O[2]^O[12]^O[22]^O[32]^O[42],te=O[3]^O[13]^O[23]^O[33]^O[43],le=O[4]^O[14]^O[24]^O[34]^O[44],ie=O[5]^O[15]^O[25]^O[35]^O[45],fe=O[6]^O[16]^O[26]^O[36]^O[46],ve=O[7]^O[17]^O[27]^O[37]^O[47],Me=O[8]^O[18]^O[28]^O[38]^O[48],Ne=O[9]^O[19]^O[29]^O[39]^O[49],se=Me^(Z<<1|te>>>31),ee=Ne^(te<<1|Z>>>31),O[0]^=se,O[1]^=ee,O[10]^=se,O[11]^=ee,O[20]^=se,O[21]^=ee,O[30]^=se,O[31]^=ee,O[40]^=se,O[41]^=ee,se=Q^(le<<1|ie>>>31),ee=R^(ie<<1|le>>>31),O[2]^=se,O[3]^=ee,O[12]^=se,O[13]^=ee,O[22]^=se,O[23]^=ee,O[32]^=se,O[33]^=ee,O[42]^=se,O[43]^=ee,se=Z^(fe<<1|ve>>>31),ee=te^(ve<<1|fe>>>31),O[4]^=se,O[5]^=ee,O[14]^=se,O[15]^=ee,O[24]^=se,O[25]^=ee,O[34]^=se,O[35]^=ee,O[44]^=se,O[45]^=ee,se=le^(Me<<1|Ne>>>31),ee=ie^(Ne<<1|Me>>>31),O[6]^=se,O[7]^=ee,O[16]^=se,O[17]^=ee,O[26]^=se,O[27]^=ee,O[36]^=se,O[37]^=ee,O[46]^=se,O[47]^=ee,se=fe^(Q<<1|R>>>31),ee=ve^(R<<1|Q>>>31),O[8]^=se,O[9]^=ee,O[18]^=se,O[19]^=ee,O[28]^=se,O[29]^=ee,O[38]^=se,O[39]^=ee,O[48]^=se,O[49]^=ee,Te=O[0],$e=O[1],nt=O[11]<<4|O[10]>>>28,Ft=O[10]<<4|O[11]>>>28,Je=O[20]<<3|O[21]>>>29,pt=O[21]<<3|O[20]>>>29,Ue=O[31]<<9|O[30]>>>23,gt=O[30]<<9|O[31]>>>23,Lt=O[40]<<18|O[41]>>>14,bt=O[41]<<18|O[40]>>>14,St=O[2]<<1|O[3]>>>31,er=O[3]<<1|O[2]>>>31,Ie=O[13]<<12|O[12]>>>20,Le=O[12]<<12|O[13]>>>20,$=O[22]<<10|O[23]>>>22,H=O[23]<<10|O[22]>>>22,ht=O[33]<<13|O[32]>>>19,ft=O[32]<<13|O[33]>>>19,st=O[42]<<2|O[43]>>>30,tt=O[43]<<2|O[42]>>>30,oe=O[5]<<30|O[4]>>>2,pe=O[4]<<30|O[5]>>>2,Xt=O[14]<<6|O[15]>>>26,Ot=O[15]<<6|O[14]>>>26,Ve=O[25]<<11|O[24]>>>21,ke=O[24]<<11|O[25]>>>21,V=O[34]<<15|O[35]>>>17,C=O[35]<<15|O[34]>>>17,Ht=O[45]<<29|O[44]>>>3,Jt=O[44]<<29|O[45]>>>3,ct=O[6]<<28|O[7]>>>4,Be=O[7]<<28|O[6]>>>4,xe=O[17]<<23|O[16]>>>9,Re=O[16]<<23|O[17]>>>9,Bt=O[26]<<25|O[27]>>>7,Tt=O[27]<<25|O[26]>>>7,ze=O[36]<<21|O[37]>>>11,He=O[37]<<21|O[36]>>>11,Y=O[47]<<24|O[46]>>>8,q=O[46]<<24|O[47]>>>8,$t=O[8]<<27|O[9]>>>5,jt=O[9]<<27|O[8]>>>5,et=O[18]<<20|O[19]>>>12,rt=O[19]<<20|O[18]>>>12,De=O[29]<<7|O[28]>>>25,it=O[28]<<7|O[29]>>>25,vt=O[38]<<8|O[39]>>>24,Dt=O[39]<<8|O[38]>>>24,Ee=O[48]<<14|O[49]>>>18,Qe=O[49]<<14|O[48]>>>18,O[0]=Te^~Ie&Ve,O[1]=$e^~Le&ke,O[10]=ct^~et&Je,O[11]=Be^~rt&pt,O[20]=St^~Xt&Bt,O[21]=er^~Ot&Tt,O[30]=$t^~nt&$,O[31]=jt^~Ft&H,O[40]=oe^~xe&De,O[41]=pe^~Re&it,O[2]=Ie^~Ve&ze,O[3]=Le^~ke&He,O[12]=et^~Je&ht,O[13]=rt^~pt&ft,O[22]=Xt^~Bt&vt,O[23]=Ot^~Tt&Dt,O[32]=nt^~$&V,O[33]=Ft^~H&C,O[42]=xe^~De&Ue,O[43]=Re^~it>,O[4]=Ve^~ze&Ee,O[5]=ke^~He&Qe,O[14]=Je^~ht&Ht,O[15]=pt^~ft&Jt,O[24]=Bt^~vt&Lt,O[25]=Tt^~Dt&bt,O[34]=$^~V&Y,O[35]=H^~C&q,O[44]=De^~Ue&st,O[45]=it^~gt&tt,O[6]=ze^~Ee&Te,O[7]=He^~Qe&$e,O[16]=ht^~Ht&ct,O[17]=ft^~Jt&Be,O[26]=vt^~Lt&St,O[27]=Dt^~bt&er,O[36]=V^~Y&$t,O[37]=C^~q&jt,O[46]=Ue^~st&oe,O[47]=gt^~tt&pe,O[8]=Ee^~Te&Ie,O[9]=Qe^~$e&Le,O[18]=Ht^~ct&et,O[19]=Jt^~Be&rt,O[28]=Lt^~St&Xt,O[29]=bt^~er&Ot,O[38]=Y^~$t&nt,O[39]=q^~jt&Ft,O[48]=st^~oe&xe,O[49]=tt^~pe&Re,O[0]^=N[X],O[1]^=N[X+1]};if(a)t.exports=f;else for(v=0;v{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const Nx=mN();var wm;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(wm||(wm={}));var ps;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(ps||(ps={}));const Lx="0123456789abcdef";class Kr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();vd[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Ox>vd[n])&&console.log.apply(console,r)}debug(...e){this._log(Kr.levels.DEBUG,e)}info(...e){this._log(Kr.levels.INFO,e)}warn(...e){this._log(Kr.levels.WARNING,e)}makeError(e,r,n){if(Dx)return this.makeError("censored error",r,{});r||(r=Kr.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(u=>{const l=n[u];try{if(l instanceof Uint8Array){let d="";for(let g=0;g>4],d+=Lx[l[g]&15];i.push(u+"=Uint8Array(0x"+d+")")}else i.push(u+"="+JSON.stringify(l))}catch{i.push(u+"="+JSON.stringify(n[u].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case ps.NUMERIC_FAULT:{o="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case ps.CALL_EXCEPTION:case ps.INSUFFICIENT_FUNDS:case ps.MISSING_NEW:case ps.NONCE_EXPIRED:case ps.REPLACEMENT_UNDERPRICED:case ps.TRANSACTION_REPLACED:case ps.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(u){a[u]=n[u]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Kr.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){Nx&&this.throwError("platform missing String.prototype.normalize",Kr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Nx})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Kr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Kr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return ym||(ym=new Kr(gN)),ym}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Rx){if(!e)return;this.globalLogger().throwError("error censorship permanent",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Dx=!!e,Rx=!!r}static setLogLevel(e){const r=vd[e.toLowerCase()];if(r==null){Kr.globalLogger().warn("invalid log level - "+e);return}Ox=r}static from(e){return new Kr(e)}}Kr.errors=ps,Kr.levels=wm;const vN="bytes/5.7.0",on=new Kr(vN);function kx(t){return!!t.toHexString}function uu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return uu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function bN(t){return Ns(t)&&!(t.length%2)||xm(t)}function Bx(t){return typeof t=="number"&&t==t&&t%1===0}function xm(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!Bx(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function bn(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),uu(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t)&&(t=t.toHexString()),Ns(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":on.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ibn(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),uu(n)}function wN(t,e){t=bn(t),t.length>e&&on.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),uu(r)}function Ns(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const _m="0123456789abcdef";function Ii(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=_m[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t))return t.toHexString();if(Ns(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":on.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(xm(t)){let r="0x";for(let n=0;n>4]+_m[i&15]}return r}return on.throwArgumentError("invalid hexlify value","value",t)}function xN(t){if(typeof t!="string")t=Ii(t);else if(!Ns(t)||t.length%2)return null;return(t.length-2)/2}function $x(t,e,r){return typeof t!="string"?t=Ii(t):(!Ns(t)||t.length%2)&&on.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function fu(t,e){for(typeof t!="string"?t=Ii(t):Ns(t)||on.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&on.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Fx(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(bN(t)){let r=bn(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64))):r.length===65?(e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64)),e.v=r[64]):on.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:on.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Ii(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=wN(bn(e._vs),32);e._vs=Ii(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&on.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=Ii(i);e.s==null?e.s=o:e.s!==o&&on.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?on.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&on.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Ns(e.r)?on.throwArgumentError("signature missing or invalid r","signature",t):e.r=fu(e.r,32),e.s==null||!Ns(e.s)?on.throwArgumentError("signature missing or invalid s","signature",t):e.s=fu(e.s,32);const r=bn(e.s);r[0]>=128&&on.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=Ii(r);e._vs&&(Ns(e._vs)||on.throwArgumentError("signature invalid _vs","signature",t),e._vs=fu(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&on.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Em(t){return"0x"+pN.keccak_256(bn(t))}var Sm={exports:{}};Sm.exports,function(t){(function(e,r){function n(m,f){if(!m)throw new Error(f||"Assertion failed")}function i(m,f){m.super_=f;var p=function(){};p.prototype=f.prototype,m.prototype=new p,m.prototype.constructor=m}function s(m,f,p){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((f==="le"||f==="be")&&(p=f,f=10),this._init(m||0,f||10,p||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,p){return f.cmp(p)>0?f:p},s.min=function(f,p){return f.cmp(p)<0?f:p},s.prototype._init=function(f,p,v){if(typeof f=="number")return this._initNumber(f,p,v);if(typeof f=="object")return this._initArray(f,p,v);p==="hex"&&(p=16),n(p===(p|0)&&p>=2&&p<=36),f=f.toString().replace(/\s+/g,"");var x=0;f[0]==="-"&&(x++,this.negative=1),x=0;x-=3)S=f[x]|f[x-1]<<8|f[x-2]<<16,this.words[_]|=S<>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);else if(v==="le")for(x=0,_=0;x>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);return this._strip()};function a(m,f){var p=m.charCodeAt(f);if(p>=48&&p<=57)return p-48;if(p>=65&&p<=70)return p-55;if(p>=97&&p<=102)return p-87;n(!1,"Invalid character in "+m)}function u(m,f,p){var v=a(m,p);return p-1>=f&&(v|=a(m,p-1)<<4),v}s.prototype._parseHex=function(f,p,v){this.length=Math.ceil((f.length-p)/6),this.words=new Array(this.length);for(var x=0;x=p;x-=2)b=u(f,p,x)<<_,this.words[S]|=b&67108863,_>=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8;else{var M=f.length-p;for(x=M%2===0?p+1:p;x=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8}this._strip()};function l(m,f,p,v){for(var x=0,_=0,S=Math.min(m.length,p),b=f;b=49?_=M-49+10:M>=17?_=M-17+10:_=M,n(M>=0&&_1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=g}catch{s.prototype.inspect=g}else s.prototype.inspect=g;function g(){return(this.red?""}var y=["","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"],A=[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,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(f,p){f=f||10,p=p|0||1;var v;if(f===16||f==="hex"){v="";for(var x=0,_=0,S=0;S>>24-x&16777215,x+=2,x>=26&&(x-=26,S--),_!==0||S!==this.length-1?v=y[6-M.length]+M+v:v=M+v}for(_!==0&&(v=_.toString(16)+v);v.length%p!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(f===(f|0)&&f>=2&&f<=36){var I=A[f],F=P[f];v="";var ae=this.clone();for(ae.negative=0;!ae.isZero();){var O=ae.modrn(F).toString(f);ae=ae.idivn(F),ae.isZero()?v=O+v:v=y[I-O.length]+O+v}for(this.isZero()&&(v="0"+v);v.length%p!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,p){return this.toArrayLike(o,f,p)}),s.prototype.toArray=function(f,p){return this.toArrayLike(Array,f,p)};var N=function(f,p){return f.allocUnsafe?f.allocUnsafe(p):new f(p)};s.prototype.toArrayLike=function(f,p,v){this._strip();var x=this.byteLength(),_=v||Math.max(1,x);n(x<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var S=N(f,_),b=p==="le"?"LE":"BE";return this["_toArrayLike"+b](S,x),S},s.prototype._toArrayLikeLE=function(f,p){for(var v=0,x=0,_=0,S=0;_>8&255),v>16&255),S===6?(v>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v=0&&(f[v--]=b>>8&255),v>=0&&(f[v--]=b>>16&255),S===6?(v>=0&&(f[v--]=b>>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v>=0)for(f[v--]=x;v>=0;)f[v--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var p=f,v=0;return p>=4096&&(v+=13,p>>>=13),p>=64&&(v+=7,p>>>=7),p>=8&&(v+=4,p>>>=4),p>=2&&(v+=2,p>>>=2),v+p},s.prototype._zeroBits=function(f){if(f===0)return 26;var p=f,v=0;return p&8191||(v+=13,p>>>=13),p&127||(v+=7,p>>>=7),p&15||(v+=4,p>>>=4),p&3||(v+=2,p>>>=2),p&1||v++,v},s.prototype.bitLength=function(){var f=this.words[this.length-1],p=this._countBits(f);return(this.length-1)*26+p};function D(m){for(var f=new Array(m.bitLength()),p=0;p>>x&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,p=0;pf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var p;this.length>f.length?p=f:p=this;for(var v=0;vf.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var p,v;this.length>f.length?(p=this,v=f):(p=f,v=this);for(var x=0;xf.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var p=Math.ceil(f/26)|0,v=f%26;this._expand(p),v>0&&p--;for(var x=0;x0&&(this.words[x]=~this.words[x]&67108863>>26-v),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,p){n(typeof f=="number"&&f>=0);var v=f/26|0,x=f%26;return this._expand(v+1),p?this.words[v]=this.words[v]|1<f.length?(v=this,x=f):(v=f,x=this);for(var _=0,S=0;S>>26;for(;_!==0&&S>>26;if(this.length=v.length,_!==0)this.words[this.length]=_,this.length++;else if(v!==this)for(;Sf.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var p=this.iadd(f);return f.negative=1,p._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var v=this.cmp(f);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,_;v>0?(x=this,_=f):(x=f,_=this);for(var S=0,b=0;b<_.length;b++)p=(x.words[b]|0)-(_.words[b]|0)+S,S=p>>26,this.words[b]=p&67108863;for(;S!==0&&b>26,this.words[b]=p&67108863;if(S===0&&b>>26,ae=M&67108863,O=Math.min(I,f.length-1),se=Math.max(0,I-m.length+1);se<=O;se++){var ee=I-se|0;x=m.words[ee]|0,_=f.words[se]|0,S=x*_+ae,F+=S/67108864|0,ae=S&67108863}p.words[I]=ae|0,M=F|0}return M!==0?p.words[I]=M|0:p.length--,p._strip()}var B=function(f,p,v){var x=f.words,_=p.words,S=v.words,b=0,M,I,F,ae=x[0]|0,O=ae&8191,se=ae>>>13,ee=x[1]|0,X=ee&8191,Q=ee>>>13,R=x[2]|0,Z=R&8191,te=R>>>13,le=x[3]|0,ie=le&8191,fe=le>>>13,ve=x[4]|0,Me=ve&8191,Ne=ve>>>13,Te=x[5]|0,$e=Te&8191,Ie=Te>>>13,Le=x[6]|0,Ve=Le&8191,ke=Le>>>13,ze=x[7]|0,He=ze&8191,Ee=ze>>>13,Qe=x[8]|0,ct=Qe&8191,Be=Qe>>>13,et=x[9]|0,rt=et&8191,Je=et>>>13,pt=_[0]|0,ht=pt&8191,ft=pt>>>13,Ht=_[1]|0,Jt=Ht&8191,St=Ht>>>13,er=_[2]|0,Xt=er&8191,Ot=er>>>13,Bt=_[3]|0,Tt=Bt&8191,vt=Bt>>>13,Dt=_[4]|0,Lt=Dt&8191,bt=Dt>>>13,$t=_[5]|0,jt=$t&8191,nt=$t>>>13,Ft=_[6]|0,$=Ft&8191,H=Ft>>>13,V=_[7]|0,C=V&8191,Y=V>>>13,q=_[8]|0,oe=q&8191,pe=q>>>13,xe=_[9]|0,Re=xe&8191,De=xe>>>13;v.negative=f.negative^p.negative,v.length=19,M=Math.imul(O,ht),I=Math.imul(O,ft),I=I+Math.imul(se,ht)|0,F=Math.imul(se,ft);var it=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(it>>>26)|0,it&=67108863,M=Math.imul(X,ht),I=Math.imul(X,ft),I=I+Math.imul(Q,ht)|0,F=Math.imul(Q,ft),M=M+Math.imul(O,Jt)|0,I=I+Math.imul(O,St)|0,I=I+Math.imul(se,Jt)|0,F=F+Math.imul(se,St)|0;var Ue=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,M=Math.imul(Z,ht),I=Math.imul(Z,ft),I=I+Math.imul(te,ht)|0,F=Math.imul(te,ft),M=M+Math.imul(X,Jt)|0,I=I+Math.imul(X,St)|0,I=I+Math.imul(Q,Jt)|0,F=F+Math.imul(Q,St)|0,M=M+Math.imul(O,Xt)|0,I=I+Math.imul(O,Ot)|0,I=I+Math.imul(se,Xt)|0,F=F+Math.imul(se,Ot)|0;var gt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(gt>>>26)|0,gt&=67108863,M=Math.imul(ie,ht),I=Math.imul(ie,ft),I=I+Math.imul(fe,ht)|0,F=Math.imul(fe,ft),M=M+Math.imul(Z,Jt)|0,I=I+Math.imul(Z,St)|0,I=I+Math.imul(te,Jt)|0,F=F+Math.imul(te,St)|0,M=M+Math.imul(X,Xt)|0,I=I+Math.imul(X,Ot)|0,I=I+Math.imul(Q,Xt)|0,F=F+Math.imul(Q,Ot)|0,M=M+Math.imul(O,Tt)|0,I=I+Math.imul(O,vt)|0,I=I+Math.imul(se,Tt)|0,F=F+Math.imul(se,vt)|0;var st=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(st>>>26)|0,st&=67108863,M=Math.imul(Me,ht),I=Math.imul(Me,ft),I=I+Math.imul(Ne,ht)|0,F=Math.imul(Ne,ft),M=M+Math.imul(ie,Jt)|0,I=I+Math.imul(ie,St)|0,I=I+Math.imul(fe,Jt)|0,F=F+Math.imul(fe,St)|0,M=M+Math.imul(Z,Xt)|0,I=I+Math.imul(Z,Ot)|0,I=I+Math.imul(te,Xt)|0,F=F+Math.imul(te,Ot)|0,M=M+Math.imul(X,Tt)|0,I=I+Math.imul(X,vt)|0,I=I+Math.imul(Q,Tt)|0,F=F+Math.imul(Q,vt)|0,M=M+Math.imul(O,Lt)|0,I=I+Math.imul(O,bt)|0,I=I+Math.imul(se,Lt)|0,F=F+Math.imul(se,bt)|0;var tt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(tt>>>26)|0,tt&=67108863,M=Math.imul($e,ht),I=Math.imul($e,ft),I=I+Math.imul(Ie,ht)|0,F=Math.imul(Ie,ft),M=M+Math.imul(Me,Jt)|0,I=I+Math.imul(Me,St)|0,I=I+Math.imul(Ne,Jt)|0,F=F+Math.imul(Ne,St)|0,M=M+Math.imul(ie,Xt)|0,I=I+Math.imul(ie,Ot)|0,I=I+Math.imul(fe,Xt)|0,F=F+Math.imul(fe,Ot)|0,M=M+Math.imul(Z,Tt)|0,I=I+Math.imul(Z,vt)|0,I=I+Math.imul(te,Tt)|0,F=F+Math.imul(te,vt)|0,M=M+Math.imul(X,Lt)|0,I=I+Math.imul(X,bt)|0,I=I+Math.imul(Q,Lt)|0,F=F+Math.imul(Q,bt)|0,M=M+Math.imul(O,jt)|0,I=I+Math.imul(O,nt)|0,I=I+Math.imul(se,jt)|0,F=F+Math.imul(se,nt)|0;var At=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(At>>>26)|0,At&=67108863,M=Math.imul(Ve,ht),I=Math.imul(Ve,ft),I=I+Math.imul(ke,ht)|0,F=Math.imul(ke,ft),M=M+Math.imul($e,Jt)|0,I=I+Math.imul($e,St)|0,I=I+Math.imul(Ie,Jt)|0,F=F+Math.imul(Ie,St)|0,M=M+Math.imul(Me,Xt)|0,I=I+Math.imul(Me,Ot)|0,I=I+Math.imul(Ne,Xt)|0,F=F+Math.imul(Ne,Ot)|0,M=M+Math.imul(ie,Tt)|0,I=I+Math.imul(ie,vt)|0,I=I+Math.imul(fe,Tt)|0,F=F+Math.imul(fe,vt)|0,M=M+Math.imul(Z,Lt)|0,I=I+Math.imul(Z,bt)|0,I=I+Math.imul(te,Lt)|0,F=F+Math.imul(te,bt)|0,M=M+Math.imul(X,jt)|0,I=I+Math.imul(X,nt)|0,I=I+Math.imul(Q,jt)|0,F=F+Math.imul(Q,nt)|0,M=M+Math.imul(O,$)|0,I=I+Math.imul(O,H)|0,I=I+Math.imul(se,$)|0,F=F+Math.imul(se,H)|0;var Rt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,M=Math.imul(He,ht),I=Math.imul(He,ft),I=I+Math.imul(Ee,ht)|0,F=Math.imul(Ee,ft),M=M+Math.imul(Ve,Jt)|0,I=I+Math.imul(Ve,St)|0,I=I+Math.imul(ke,Jt)|0,F=F+Math.imul(ke,St)|0,M=M+Math.imul($e,Xt)|0,I=I+Math.imul($e,Ot)|0,I=I+Math.imul(Ie,Xt)|0,F=F+Math.imul(Ie,Ot)|0,M=M+Math.imul(Me,Tt)|0,I=I+Math.imul(Me,vt)|0,I=I+Math.imul(Ne,Tt)|0,F=F+Math.imul(Ne,vt)|0,M=M+Math.imul(ie,Lt)|0,I=I+Math.imul(ie,bt)|0,I=I+Math.imul(fe,Lt)|0,F=F+Math.imul(fe,bt)|0,M=M+Math.imul(Z,jt)|0,I=I+Math.imul(Z,nt)|0,I=I+Math.imul(te,jt)|0,F=F+Math.imul(te,nt)|0,M=M+Math.imul(X,$)|0,I=I+Math.imul(X,H)|0,I=I+Math.imul(Q,$)|0,F=F+Math.imul(Q,H)|0,M=M+Math.imul(O,C)|0,I=I+Math.imul(O,Y)|0,I=I+Math.imul(se,C)|0,F=F+Math.imul(se,Y)|0;var Mt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,M=Math.imul(ct,ht),I=Math.imul(ct,ft),I=I+Math.imul(Be,ht)|0,F=Math.imul(Be,ft),M=M+Math.imul(He,Jt)|0,I=I+Math.imul(He,St)|0,I=I+Math.imul(Ee,Jt)|0,F=F+Math.imul(Ee,St)|0,M=M+Math.imul(Ve,Xt)|0,I=I+Math.imul(Ve,Ot)|0,I=I+Math.imul(ke,Xt)|0,F=F+Math.imul(ke,Ot)|0,M=M+Math.imul($e,Tt)|0,I=I+Math.imul($e,vt)|0,I=I+Math.imul(Ie,Tt)|0,F=F+Math.imul(Ie,vt)|0,M=M+Math.imul(Me,Lt)|0,I=I+Math.imul(Me,bt)|0,I=I+Math.imul(Ne,Lt)|0,F=F+Math.imul(Ne,bt)|0,M=M+Math.imul(ie,jt)|0,I=I+Math.imul(ie,nt)|0,I=I+Math.imul(fe,jt)|0,F=F+Math.imul(fe,nt)|0,M=M+Math.imul(Z,$)|0,I=I+Math.imul(Z,H)|0,I=I+Math.imul(te,$)|0,F=F+Math.imul(te,H)|0,M=M+Math.imul(X,C)|0,I=I+Math.imul(X,Y)|0,I=I+Math.imul(Q,C)|0,F=F+Math.imul(Q,Y)|0,M=M+Math.imul(O,oe)|0,I=I+Math.imul(O,pe)|0,I=I+Math.imul(se,oe)|0,F=F+Math.imul(se,pe)|0;var Et=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Et>>>26)|0,Et&=67108863,M=Math.imul(rt,ht),I=Math.imul(rt,ft),I=I+Math.imul(Je,ht)|0,F=Math.imul(Je,ft),M=M+Math.imul(ct,Jt)|0,I=I+Math.imul(ct,St)|0,I=I+Math.imul(Be,Jt)|0,F=F+Math.imul(Be,St)|0,M=M+Math.imul(He,Xt)|0,I=I+Math.imul(He,Ot)|0,I=I+Math.imul(Ee,Xt)|0,F=F+Math.imul(Ee,Ot)|0,M=M+Math.imul(Ve,Tt)|0,I=I+Math.imul(Ve,vt)|0,I=I+Math.imul(ke,Tt)|0,F=F+Math.imul(ke,vt)|0,M=M+Math.imul($e,Lt)|0,I=I+Math.imul($e,bt)|0,I=I+Math.imul(Ie,Lt)|0,F=F+Math.imul(Ie,bt)|0,M=M+Math.imul(Me,jt)|0,I=I+Math.imul(Me,nt)|0,I=I+Math.imul(Ne,jt)|0,F=F+Math.imul(Ne,nt)|0,M=M+Math.imul(ie,$)|0,I=I+Math.imul(ie,H)|0,I=I+Math.imul(fe,$)|0,F=F+Math.imul(fe,H)|0,M=M+Math.imul(Z,C)|0,I=I+Math.imul(Z,Y)|0,I=I+Math.imul(te,C)|0,F=F+Math.imul(te,Y)|0,M=M+Math.imul(X,oe)|0,I=I+Math.imul(X,pe)|0,I=I+Math.imul(Q,oe)|0,F=F+Math.imul(Q,pe)|0,M=M+Math.imul(O,Re)|0,I=I+Math.imul(O,De)|0,I=I+Math.imul(se,Re)|0,F=F+Math.imul(se,De)|0;var dt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(dt>>>26)|0,dt&=67108863,M=Math.imul(rt,Jt),I=Math.imul(rt,St),I=I+Math.imul(Je,Jt)|0,F=Math.imul(Je,St),M=M+Math.imul(ct,Xt)|0,I=I+Math.imul(ct,Ot)|0,I=I+Math.imul(Be,Xt)|0,F=F+Math.imul(Be,Ot)|0,M=M+Math.imul(He,Tt)|0,I=I+Math.imul(He,vt)|0,I=I+Math.imul(Ee,Tt)|0,F=F+Math.imul(Ee,vt)|0,M=M+Math.imul(Ve,Lt)|0,I=I+Math.imul(Ve,bt)|0,I=I+Math.imul(ke,Lt)|0,F=F+Math.imul(ke,bt)|0,M=M+Math.imul($e,jt)|0,I=I+Math.imul($e,nt)|0,I=I+Math.imul(Ie,jt)|0,F=F+Math.imul(Ie,nt)|0,M=M+Math.imul(Me,$)|0,I=I+Math.imul(Me,H)|0,I=I+Math.imul(Ne,$)|0,F=F+Math.imul(Ne,H)|0,M=M+Math.imul(ie,C)|0,I=I+Math.imul(ie,Y)|0,I=I+Math.imul(fe,C)|0,F=F+Math.imul(fe,Y)|0,M=M+Math.imul(Z,oe)|0,I=I+Math.imul(Z,pe)|0,I=I+Math.imul(te,oe)|0,F=F+Math.imul(te,pe)|0,M=M+Math.imul(X,Re)|0,I=I+Math.imul(X,De)|0,I=I+Math.imul(Q,Re)|0,F=F+Math.imul(Q,De)|0;var _t=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(_t>>>26)|0,_t&=67108863,M=Math.imul(rt,Xt),I=Math.imul(rt,Ot),I=I+Math.imul(Je,Xt)|0,F=Math.imul(Je,Ot),M=M+Math.imul(ct,Tt)|0,I=I+Math.imul(ct,vt)|0,I=I+Math.imul(Be,Tt)|0,F=F+Math.imul(Be,vt)|0,M=M+Math.imul(He,Lt)|0,I=I+Math.imul(He,bt)|0,I=I+Math.imul(Ee,Lt)|0,F=F+Math.imul(Ee,bt)|0,M=M+Math.imul(Ve,jt)|0,I=I+Math.imul(Ve,nt)|0,I=I+Math.imul(ke,jt)|0,F=F+Math.imul(ke,nt)|0,M=M+Math.imul($e,$)|0,I=I+Math.imul($e,H)|0,I=I+Math.imul(Ie,$)|0,F=F+Math.imul(Ie,H)|0,M=M+Math.imul(Me,C)|0,I=I+Math.imul(Me,Y)|0,I=I+Math.imul(Ne,C)|0,F=F+Math.imul(Ne,Y)|0,M=M+Math.imul(ie,oe)|0,I=I+Math.imul(ie,pe)|0,I=I+Math.imul(fe,oe)|0,F=F+Math.imul(fe,pe)|0,M=M+Math.imul(Z,Re)|0,I=I+Math.imul(Z,De)|0,I=I+Math.imul(te,Re)|0,F=F+Math.imul(te,De)|0;var ot=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(ot>>>26)|0,ot&=67108863,M=Math.imul(rt,Tt),I=Math.imul(rt,vt),I=I+Math.imul(Je,Tt)|0,F=Math.imul(Je,vt),M=M+Math.imul(ct,Lt)|0,I=I+Math.imul(ct,bt)|0,I=I+Math.imul(Be,Lt)|0,F=F+Math.imul(Be,bt)|0,M=M+Math.imul(He,jt)|0,I=I+Math.imul(He,nt)|0,I=I+Math.imul(Ee,jt)|0,F=F+Math.imul(Ee,nt)|0,M=M+Math.imul(Ve,$)|0,I=I+Math.imul(Ve,H)|0,I=I+Math.imul(ke,$)|0,F=F+Math.imul(ke,H)|0,M=M+Math.imul($e,C)|0,I=I+Math.imul($e,Y)|0,I=I+Math.imul(Ie,C)|0,F=F+Math.imul(Ie,Y)|0,M=M+Math.imul(Me,oe)|0,I=I+Math.imul(Me,pe)|0,I=I+Math.imul(Ne,oe)|0,F=F+Math.imul(Ne,pe)|0,M=M+Math.imul(ie,Re)|0,I=I+Math.imul(ie,De)|0,I=I+Math.imul(fe,Re)|0,F=F+Math.imul(fe,De)|0;var wt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(wt>>>26)|0,wt&=67108863,M=Math.imul(rt,Lt),I=Math.imul(rt,bt),I=I+Math.imul(Je,Lt)|0,F=Math.imul(Je,bt),M=M+Math.imul(ct,jt)|0,I=I+Math.imul(ct,nt)|0,I=I+Math.imul(Be,jt)|0,F=F+Math.imul(Be,nt)|0,M=M+Math.imul(He,$)|0,I=I+Math.imul(He,H)|0,I=I+Math.imul(Ee,$)|0,F=F+Math.imul(Ee,H)|0,M=M+Math.imul(Ve,C)|0,I=I+Math.imul(Ve,Y)|0,I=I+Math.imul(ke,C)|0,F=F+Math.imul(ke,Y)|0,M=M+Math.imul($e,oe)|0,I=I+Math.imul($e,pe)|0,I=I+Math.imul(Ie,oe)|0,F=F+Math.imul(Ie,pe)|0,M=M+Math.imul(Me,Re)|0,I=I+Math.imul(Me,De)|0,I=I+Math.imul(Ne,Re)|0,F=F+Math.imul(Ne,De)|0;var lt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(lt>>>26)|0,lt&=67108863,M=Math.imul(rt,jt),I=Math.imul(rt,nt),I=I+Math.imul(Je,jt)|0,F=Math.imul(Je,nt),M=M+Math.imul(ct,$)|0,I=I+Math.imul(ct,H)|0,I=I+Math.imul(Be,$)|0,F=F+Math.imul(Be,H)|0,M=M+Math.imul(He,C)|0,I=I+Math.imul(He,Y)|0,I=I+Math.imul(Ee,C)|0,F=F+Math.imul(Ee,Y)|0,M=M+Math.imul(Ve,oe)|0,I=I+Math.imul(Ve,pe)|0,I=I+Math.imul(ke,oe)|0,F=F+Math.imul(ke,pe)|0,M=M+Math.imul($e,Re)|0,I=I+Math.imul($e,De)|0,I=I+Math.imul(Ie,Re)|0,F=F+Math.imul(Ie,De)|0;var at=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(at>>>26)|0,at&=67108863,M=Math.imul(rt,$),I=Math.imul(rt,H),I=I+Math.imul(Je,$)|0,F=Math.imul(Je,H),M=M+Math.imul(ct,C)|0,I=I+Math.imul(ct,Y)|0,I=I+Math.imul(Be,C)|0,F=F+Math.imul(Be,Y)|0,M=M+Math.imul(He,oe)|0,I=I+Math.imul(He,pe)|0,I=I+Math.imul(Ee,oe)|0,F=F+Math.imul(Ee,pe)|0,M=M+Math.imul(Ve,Re)|0,I=I+Math.imul(Ve,De)|0,I=I+Math.imul(ke,Re)|0,F=F+Math.imul(ke,De)|0;var Ae=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,M=Math.imul(rt,C),I=Math.imul(rt,Y),I=I+Math.imul(Je,C)|0,F=Math.imul(Je,Y),M=M+Math.imul(ct,oe)|0,I=I+Math.imul(ct,pe)|0,I=I+Math.imul(Be,oe)|0,F=F+Math.imul(Be,pe)|0,M=M+Math.imul(He,Re)|0,I=I+Math.imul(He,De)|0,I=I+Math.imul(Ee,Re)|0,F=F+Math.imul(Ee,De)|0;var Pe=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,M=Math.imul(rt,oe),I=Math.imul(rt,pe),I=I+Math.imul(Je,oe)|0,F=Math.imul(Je,pe),M=M+Math.imul(ct,Re)|0,I=I+Math.imul(ct,De)|0,I=I+Math.imul(Be,Re)|0,F=F+Math.imul(Be,De)|0;var Ge=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,M=Math.imul(rt,Re),I=Math.imul(rt,De),I=I+Math.imul(Je,Re)|0,F=Math.imul(Je,De);var je=(b+M|0)+((I&8191)<<13)|0;return b=(F+(I>>>13)|0)+(je>>>26)|0,je&=67108863,S[0]=it,S[1]=Ue,S[2]=gt,S[3]=st,S[4]=tt,S[5]=At,S[6]=Rt,S[7]=Mt,S[8]=Et,S[9]=dt,S[10]=_t,S[11]=ot,S[12]=wt,S[13]=lt,S[14]=at,S[15]=Ae,S[16]=Pe,S[17]=Ge,S[18]=je,b!==0&&(S[19]=b,v.length++),v};Math.imul||(B=k);function j(m,f,p){p.negative=f.negative^m.negative,p.length=m.length+f.length;for(var v=0,x=0,_=0;_>>26)|0,x+=S>>>26,S&=67108863}p.words[_]=b,v=S,S=x}return v!==0?p.words[_]=v:p.length--,p._strip()}function U(m,f,p){return j(m,f,p)}s.prototype.mulTo=function(f,p){var v,x=this.length+f.length;return this.length===10&&f.length===10?v=B(this,f,p):x<63?v=k(this,f,p):x<1024?v=j(this,f,p):v=U(this,f,p),v},s.prototype.mul=function(f){var p=new s(null);return p.words=new Array(this.length+f.length),this.mulTo(f,p)},s.prototype.mulf=function(f){var p=new s(null);return p.words=new Array(this.length+f.length),U(this,f,p)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var p=f<0;p&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var v=0,x=0;x>=26,v+=_/67108864|0,v+=S>>>26,this.words[x]=S&67108863}return v!==0&&(this.words[x]=v,this.length++),p?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var p=D(f);if(p.length===0)return new s(1);for(var v=this,x=0;x=0);var p=f%26,v=(f-p)/26,x=67108863>>>26-p<<26-p,_;if(p!==0){var S=0;for(_=0;_>>26-p}S&&(this.words[_]=S,this.length++)}if(v!==0){for(_=this.length-1;_>=0;_--)this.words[_+v]=this.words[_];for(_=0;_=0);var x;p?x=(p-p%26)/26:x=0;var _=f%26,S=Math.min((f-_)/26,this.length),b=67108863^67108863>>>_<<_,M=v;if(x-=S,x=Math.max(0,x),M){for(var I=0;IS)for(this.length-=S,I=0;I=0&&(F!==0||I>=x);I--){var ae=this.words[I]|0;this.words[I]=F<<26-_|ae>>>_,F=ae&b}return M&&F!==0&&(M.words[M.length++]=F),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,p,v){return n(this.negative===0),this.iushrn(f,p,v)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var p=f%26,v=(f-p)/26,x=1<=0);var p=f%26,v=(f-p)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(p!==0&&v++,this.length=Math.min(v,this.length),p!==0){var x=67108863^67108863>>>p<=67108864;p++)this.words[p]-=67108864,p===this.length-1?this.words[p+1]=1:this.words[p+1]++;return this.length=Math.max(this.length,p+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var p=0;p>26)-(M/67108864|0),this.words[_+v]=S&67108863}for(;_>26,this.words[_+v]=S&67108863;if(b===0)return this._strip();for(n(b===-1),b=0,_=0;_>26,this.words[_]=S&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,p){var v=this.length-f.length,x=this.clone(),_=f,S=_.words[_.length-1]|0,b=this._countBits(S);v=26-b,v!==0&&(_=_.ushln(v),x.iushln(v),S=_.words[_.length-1]|0);var M=x.length-_.length,I;if(p!=="mod"){I=new s(null),I.length=M+1,I.words=new Array(I.length);for(var F=0;F=0;O--){var se=(x.words[_.length+O]|0)*67108864+(x.words[_.length+O-1]|0);for(se=Math.min(se/S|0,67108863),x._ishlnsubmul(_,se,O);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(_,1,O),x.isZero()||(x.negative^=1);I&&(I.words[O]=se)}return I&&I._strip(),x._strip(),p!=="div"&&v!==0&&x.iushrn(v),{div:I||null,mod:x}},s.prototype.divmod=function(f,p,v){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,_,S;return this.negative!==0&&f.negative===0?(S=this.neg().divmod(f,p),p!=="mod"&&(x=S.div.neg()),p!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.iadd(f)),{div:x,mod:_}):this.negative===0&&f.negative!==0?(S=this.divmod(f.neg(),p),p!=="mod"&&(x=S.div.neg()),{div:x,mod:S.mod}):this.negative&f.negative?(S=this.neg().divmod(f.neg(),p),p!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.isub(f)),{div:S.div,mod:_}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?p==="div"?{div:this.divn(f.words[0]),mod:null}:p==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,p)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var p=this.divmod(f);if(p.mod.isZero())return p.div;var v=p.div.negative!==0?p.mod.isub(f):p.mod,x=f.ushrn(1),_=f.andln(1),S=v.cmp(x);return S<0||_===1&&S===0?p.div:p.div.negative!==0?p.div.isubn(1):p.div.iaddn(1)},s.prototype.modrn=function(f){var p=f<0;p&&(f=-f),n(f<=67108863);for(var v=(1<<26)%f,x=0,_=this.length-1;_>=0;_--)x=(v*x+(this.words[_]|0))%f;return p?-x:x},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var p=f<0;p&&(f=-f),n(f<=67108863);for(var v=0,x=this.length-1;x>=0;x--){var _=(this.words[x]|0)+v*67108864;this.words[x]=_/f|0,v=_%f}return this._strip(),p?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var p=this,v=f.clone();p.negative!==0?p=p.umod(f):p=p.clone();for(var x=new s(1),_=new s(0),S=new s(0),b=new s(1),M=0;p.isEven()&&v.isEven();)p.iushrn(1),v.iushrn(1),++M;for(var I=v.clone(),F=p.clone();!p.isZero();){for(var ae=0,O=1;!(p.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(p.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(I),_.isub(F)),x.iushrn(1),_.iushrn(1);for(var se=0,ee=1;!(v.words[0]&ee)&&se<26;++se,ee<<=1);if(se>0)for(v.iushrn(se);se-- >0;)(S.isOdd()||b.isOdd())&&(S.iadd(I),b.isub(F)),S.iushrn(1),b.iushrn(1);p.cmp(v)>=0?(p.isub(v),x.isub(S),_.isub(b)):(v.isub(p),S.isub(x),b.isub(_))}return{a:S,b,gcd:v.iushln(M)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var p=this,v=f.clone();p.negative!==0?p=p.umod(f):p=p.clone();for(var x=new s(1),_=new s(0),S=v.clone();p.cmpn(1)>0&&v.cmpn(1)>0;){for(var b=0,M=1;!(p.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(p.iushrn(b);b-- >0;)x.isOdd()&&x.iadd(S),x.iushrn(1);for(var I=0,F=1;!(v.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(v.iushrn(I);I-- >0;)_.isOdd()&&_.iadd(S),_.iushrn(1);p.cmp(v)>=0?(p.isub(v),x.isub(_)):(v.isub(p),_.isub(x))}var ae;return p.cmpn(1)===0?ae=x:ae=_,ae.cmpn(0)<0&&ae.iadd(f),ae},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var p=this.clone(),v=f.clone();p.negative=0,v.negative=0;for(var x=0;p.isEven()&&v.isEven();x++)p.iushrn(1),v.iushrn(1);do{for(;p.isEven();)p.iushrn(1);for(;v.isEven();)v.iushrn(1);var _=p.cmp(v);if(_<0){var S=p;p=v,v=S}else if(_===0||v.cmpn(1)===0)break;p.isub(v)}while(!0);return v.iushln(x)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var p=f%26,v=(f-p)/26,x=1<>>26,b&=67108863,this.words[S]=b}return _!==0&&(this.words[S]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var p=f<0;if(this.negative!==0&&!p)return-1;if(this.negative===0&&p)return 1;this._strip();var v;if(this.length>1)v=1;else{p&&(f=-f),n(f<=67108863,"Number is too big");var x=this.words[0]|0;v=x===f?0:xf.length)return 1;if(this.length=0;v--){var x=this.words[v]|0,_=f.words[v]|0;if(x!==_){x<_?p=-1:x>_&&(p=1);break}}return p},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new G(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var K={k256:null,p224:null,p192:null,p25519:null};function J(m,f){this.name=m,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}J.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},J.prototype.ireduce=function(f){var p=f,v;do this.split(p,this.tmp),p=this.imulK(p),p=p.iadd(this.tmp),v=p.bitLength();while(v>this.n);var x=v0?p.isub(this.p):p.strip!==void 0?p.strip():p._strip(),p},J.prototype.split=function(f,p){f.iushrn(this.n,0,p)},J.prototype.imulK=function(f){return f.imul(this.k)};function T(){J.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(T,J),T.prototype.split=function(f,p){for(var v=4194303,x=Math.min(f.length,9),_=0;_>>22,S=b}S>>>=22,f.words[_-10]=S,S===0&&f.length>10?f.length-=10:f.length-=9},T.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var p=0,v=0;v>>=26,f.words[v]=_,p=x}return p!==0&&(f.words[f.length++]=p),f},s._prime=function(f){if(K[f])return K[f];var p;if(f==="k256")p=new T;else if(f==="p224")p=new z;else if(f==="p192")p=new ue;else if(f==="p25519")p=new _e;else throw new Error("Unknown prime "+f);return K[f]=p,p};function G(m){if(typeof m=="string"){var f=s._prime(m);this.m=f.p,this.prime=f}else n(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}G.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},G.prototype._verify2=function(f,p){n((f.negative|p.negative)===0,"red works only with positives"),n(f.red&&f.red===p.red,"red works only with red numbers")},G.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(d(f,f.umod(this.m)._forceRed(this)),f)},G.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},G.prototype.add=function(f,p){this._verify2(f,p);var v=f.add(p);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},G.prototype.iadd=function(f,p){this._verify2(f,p);var v=f.iadd(p);return v.cmp(this.m)>=0&&v.isub(this.m),v},G.prototype.sub=function(f,p){this._verify2(f,p);var v=f.sub(p);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},G.prototype.isub=function(f,p){this._verify2(f,p);var v=f.isub(p);return v.cmpn(0)<0&&v.iadd(this.m),v},G.prototype.shl=function(f,p){return this._verify1(f),this.imod(f.ushln(p))},G.prototype.imul=function(f,p){return this._verify2(f,p),this.imod(f.imul(p))},G.prototype.mul=function(f,p){return this._verify2(f,p),this.imod(f.mul(p))},G.prototype.isqr=function(f){return this.imul(f,f.clone())},G.prototype.sqr=function(f){return this.mul(f,f)},G.prototype.sqrt=function(f){if(f.isZero())return f.clone();var p=this.m.andln(3);if(n(p%2===1),p===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(f,v)}for(var x=this.m.subn(1),_=0;!x.isZero()&&x.andln(1)===0;)_++,x.iushrn(1);n(!x.isZero());var S=new s(1).toRed(this),b=S.redNeg(),M=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,M).cmp(b)!==0;)I.redIAdd(b);for(var F=this.pow(I,x),ae=this.pow(f,x.addn(1).iushrn(1)),O=this.pow(f,x),se=_;O.cmp(S)!==0;){for(var ee=O,X=0;ee.cmp(S)!==0;X++)ee=ee.redSqr();n(X=0;_--){for(var F=p.words[_],ae=I-1;ae>=0;ae--){var O=F>>ae&1;if(S!==x[0]&&(S=this.sqr(S)),O===0&&b===0){M=0;continue}b<<=1,b|=O,M++,!(M!==v&&(_!==0||ae!==0))&&(S=this.mul(S,x[b]),M=0,b=0)}I=26}return S},G.prototype.convertTo=function(f){var p=f.umod(this.m);return p===f?p.clone():p},G.prototype.convertFrom=function(f){var p=f.clone();return p.red=null,p},s.mont=function(f){return new E(f)};function E(m){G.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(E,G),E.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},E.prototype.convertFrom=function(f){var p=this.imod(f.mul(this.rinv));return p.red=null,p},E.prototype.imul=function(f,p){if(f.isZero()||p.isZero())return f.words[0]=0,f.length=1,f;var v=f.imul(p),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.mul=function(f,p){if(f.isZero()||p.isZero())return new s(0)._forceRed(this);var v=f.mul(p),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.invm=function(f){var p=this.imod(f._invmp(this.m).mul(this.r2));return p._forceRed(this)}})(t,nn)}(Sm);var _N=Sm.exports;const rr=ji(_N);var EN=rr.BN;function SN(t){return new EN(t,36).toString(16)}const AN="strings/5.7.0",PN=new Kr(AN);var bd;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(bd||(bd={}));var jx;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(jx||(jx={}));function Am(t,e=bd.current){e!=bd.current&&(PN.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return bn(r)}const MN=`Ethereum Signed Message: +`;function Ux(t){return typeof t=="string"&&(t=Am(t)),Em(yN([Am(MN),Am(String(t.length)),t]))}const IN="address/5.7.0",sl=new Kr(IN);function qx(t){Ns(t,20)||sl.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=bn(Em(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const CN=9007199254740991;function TN(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const Pm={};for(let t=0;t<10;t++)Pm[String(t)]=String(t);for(let t=0;t<26;t++)Pm[String.fromCharCode(65+t)]=String(10+t);const zx=Math.floor(TN(CN));function RN(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Pm[n]).join("");for(;e.length>=zx;){let n=e.substring(0,zx);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function DN(t){let e=null;if(typeof t!="string"&&sl.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=qx(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&sl.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==RN(t)&&sl.throwArgumentError("bad icap checksum","address",t),e=SN(t.substring(4));e.length<40;)e="0"+e;e=qx("0x"+e)}else sl.throwArgumentError("invalid address","address",t);return e}function ol(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var al={},yr={},Ga=Hx;function Hx(t,e){if(!t)throw new Error(e||"Assertion failed")}Hx.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var Mm={exports:{}};typeof Object.create=="function"?Mm.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Mm.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var yd=Mm.exports,ON=Ga,NN=yd;yr.inherits=NN;function LN(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function kN(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):LN(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}yr.htonl=Wx;function $N(t,e){for(var r="",n=0;n>>0}return s}yr.join32=FN;function jN(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}yr.split32=jN;function UN(t,e){return t>>>e|t<<32-e}yr.rotr32=UN;function qN(t,e){return t<>>32-e}yr.rotl32=qN;function zN(t,e){return t+e>>>0}yr.sum32=zN;function HN(t,e,r){return t+e+r>>>0}yr.sum32_3=HN;function WN(t,e,r,n){return t+e+r+n>>>0}yr.sum32_4=WN;function KN(t,e,r,n,i){return t+e+r+n+i>>>0}yr.sum32_5=KN;function VN(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}yr.sum64=VN;function GN(t,e,r,n){var i=e+n>>>0,s=(i>>0}yr.sum64_hi=GN;function YN(t,e,r,n){var i=e+n;return i>>>0}yr.sum64_lo=YN;function JN(t,e,r,n,i,s,o,a){var u=0,l=e;l=l+n>>>0,u+=l>>0,u+=l>>0,u+=l>>0}yr.sum64_4_hi=JN;function XN(t,e,r,n,i,s,o,a){var u=e+n+s+a;return u>>>0}yr.sum64_4_lo=XN;function ZN(t,e,r,n,i,s,o,a,u,l){var d=0,g=e;g=g+n>>>0,d+=g>>0,d+=g>>0,d+=g>>0,d+=g>>0}yr.sum64_5_hi=ZN;function QN(t,e,r,n,i,s,o,a,u,l){var d=e+n+s+a+l;return d>>>0}yr.sum64_5_lo=QN;function eL(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}yr.rotr64_hi=eL;function tL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.rotr64_lo=tL;function rL(t,e,r){return t>>>r}yr.shr64_hi=rL;function nL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.shr64_lo=nL;var lu={},Gx=yr,iL=Ga;function wd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}lu.BlockHash=wd,wd.prototype.update=function(e,r){if(e=Gx.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Gx.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}Ls.g0_256=uL;function fL(t){return ks(t,17)^ks(t,19)^t>>>10}Ls.g1_256=fL;var du=yr,lL=lu,hL=Ls,Im=du.rotl32,cl=du.sum32,dL=du.sum32_5,pL=hL.ft_1,Zx=lL.BlockHash,gL=[1518500249,1859775393,2400959708,3395469782];function Bs(){if(!(this instanceof Bs))return new Bs;Zx.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}du.inherits(Bs,Zx);var mL=Bs;Bs.blockSize=512,Bs.outSize=160,Bs.hmacStrength=80,Bs.padLength=64,Bs.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),nk(e.length<=this.blockSize);for(var r=e.length;r>8,y=d&255;g?u.push(g,y):u.push(y)}return u}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",u=0;u(y>>1)-1?N=(y>>1)-D:N=D,A.isubn(N)):N=0,g[P]=N,A.iushrn(1)}return g}r.getNAF=n;function i(u,l){var d=[[],[]];u=u.clone(),l=l.clone();for(var g=0,y=0,A;u.cmpn(-g)>0||l.cmpn(-y)>0;){var P=u.andln(3)+g&3,N=l.andln(3)+y&3;P===3&&(P=-1),N===3&&(N=-1);var D;P&1?(A=u.andln(7)+g&7,(A===3||A===5)&&N===2?D=-P:D=P):D=0,d[0].push(D);var k;N&1?(A=l.andln(7)+y&7,(A===3||A===5)&&P===2?k=-N:k=N):k=0,d[1].push(k),2*g===D+1&&(g=1-g),2*y===k+1&&(y=1-y),u.iushrn(1),l.iushrn(1)}return d}r.getJSF=i;function s(u,l,d){var g="_"+l;u.prototype[l]=function(){return this[g]!==void 0?this[g]:this[g]=d.call(this)}}r.cachedProperty=s;function o(u){return typeof u=="string"?r.toArray(u,"hex"):u}r.parseBytes=o;function a(u){return new rr(u,"hex","le")}r.intFromLE=a}),_d=Ci.getNAF,ok=Ci.getJSF,Ed=Ci.assert;function na(t,e){this.type=t,this.p=new rr(e.p,16),this.red=e.prime?rr.red(e.prime):rr.mont(this.p),this.zero=new rr(0).toRed(this.red),this.one=new rr(1).toRed(this.red),this.two=new rr(2).toRed(this.red),this.n=e.n&&new rr(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ja=na;na.prototype.point=function(){throw new Error("Not implemented")},na.prototype.validate=function(){throw new Error("Not implemented")},na.prototype._fixedNafMul=function(e,r){Ed(e.precomputed);var n=e._getDoubles(),i=_d(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),g=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Ed(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},na.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,g,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=_d(n[P],o[P],this._bitLength),u[N]=_d(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=ok(n[P],n[N]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[N]=new Array(l),g=0;g=0;d--){for(var T=0;d>=0;){var z=!0;for(g=0;g=0&&T++,K=K.dblp(T),d<0)break;for(g=0;g0?y=a[g][ue-1>>1]:ue<0&&(y=a[g][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},zi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),g.negative&&(g=g.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:g,b:y},{a:A,b:P}]},Hi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),g=e.sub(a).sub(u),y=l.add(d).neg();return{k1:g,k2:y}},Hi.prototype.pointFromX=function(e,r){e=new rr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Hi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Hi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Dn.prototype.isInfinity=function(){return this.inf},Dn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Dn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Dn.prototype.getX=function(){return this.x.fromRed()},Dn.prototype.getY=function(){return this.y.fromRed()},Dn.prototype.mul=function(e){return e=new rr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Dn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Dn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Dn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Dn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Dn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Un(t,e,r,n){Ja.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new rr(0)):(this.x=new rr(e,16),this.y=new rr(r,16),this.z=new rr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Nm(Un,Ja.BasePoint),Hi.prototype.jpoint=function(e,r,n){return new Un(this,e,r,n)},Un.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},Un.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Un.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),g=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(g).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(g)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},Un.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),g=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(g).redISub(g),A=u.redMul(g.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},Un.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},Un.prototype.inspect=function(){return this.isInfinity()?"":""},Un.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Sd=vu(function(t,e){var r=e;r.base=Ja,r.short=ck,r.mont=null,r.edwards=null}),Ad=vu(function(t,e){var r=e,n=Ci.assert;function i(a){a.type==="short"?this.curve=new Sd.short(a):a.type==="edwards"?this.curve=new Sd.edwards(a):this.curve=new Sd.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,u){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(u);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:wo.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:wo.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:wo.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:wo.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:wo.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:wo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function ia(t){if(!(this instanceof ia))return new ia(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=vs.toArray(t.entropy,t.entropyEnc||"hex"),r=vs.toArray(t.nonce,t.nonceEnc||"hex"),n=vs.toArray(t.pers,t.persEnc||"hex");Om(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var d3=ia;ia.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ia.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=vs.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var uk=Ci.assert;function Pd(t,e){if(t instanceof Pd)return t;this._importDER(t,e)||(uk(t.r&&t.s,"Signature without r or s"),this.r=new rr(t.r,16),this.s=new rr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Md=Pd;function fk(){this.place=0}function Bm(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function p3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Pd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=p3(r),n=p3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];$m(i,r.length),i=i.concat(r),i.push(2),$m(i,n.length);var s=i.concat(n),o=[48];return $m(o,s.length),o=o.concat(s),Ci.encode(o,e)};var lk=function(){throw new Error("unsupported")},g3=Ci.assert;function Wi(t){if(!(this instanceof Wi))return new Wi(t);typeof t=="string"&&(g3(Object.prototype.hasOwnProperty.call(Ad,t),"Unknown curve "+t),t=Ad[t]),t instanceof Ad.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var hk=Wi;Wi.prototype.keyPair=function(e){return new km(this,e)},Wi.prototype.keyFromPrivate=function(e,r){return km.fromPrivate(this,e,r)},Wi.prototype.keyFromPublic=function(e,r){return km.fromPublic(this,e,r)},Wi.prototype.genKeyPair=function(e){e||(e={});for(var r=new d3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||lk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new rr(2));;){var s=new rr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Wi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Wi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new rr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new d3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new rr(1)),d=0;;d++){var g=i.k?i.k(d):new rr(u.generate(this.n.byteLength()));if(g=this._truncateToN(g,!0),!(g.cmpn(1)<=0||g.cmp(l)>=0)){var y=this.g.mul(g);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=g.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new Md({r:P,s:N,recoveryParam:D})}}}}}},Wi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new rr(e,16)),n=this.keyFromPublic(n,i),r=new Md(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),u=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.eqXToP(s)):(d=this.g.mulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.getX().umod(this.n).cmp(s)===0)},Wi.prototype.recoverPubKey=function(t,e,r,n){g3((3&r)===r,"The recovery param is more than two bits"),e=new Md(e,n);var i=this.n,s=new rr(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),g=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(g,o,y)},Wi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Md(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dk=vu(function(t,e){var r=e;r.version="6.5.4",r.utils=Ci,r.rand=function(){throw new Error("unsupported")},r.curve=Sd,r.curves=Ad,r.ec=hk,r.eddsa=null}),pk=dk.ec;const gk="signing-key/5.7.0",Fm=new Kr(gk);let jm=null;function sa(){return jm||(jm=new pk("secp256k1")),jm}class mk{constructor(e){ol(this,"curve","secp256k1"),ol(this,"privateKey",Ii(e)),xN(this.privateKey)!==32&&Fm.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=sa().keyFromPrivate(bn(this.privateKey));ol(this,"publicKey","0x"+r.getPublic(!1,"hex")),ol(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ol(this,"_isSigningKey",!0)}_addPoint(e){const r=sa().keyFromPublic(bn(this.publicKey)),n=sa().keyFromPublic(bn(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=sa().keyFromPrivate(bn(this.privateKey)),n=bn(e);n.length!==32&&Fm.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Fx({recoveryParam:i.recoveryParam,r:fu("0x"+i.r.toString(16),32),s:fu("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=sa().keyFromPrivate(bn(this.privateKey)),n=sa().keyFromPublic(bn(m3(e)));return fu("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function vk(t,e){const r=Fx(e),n={r:bn(r.r),s:bn(r.s)};return"0x"+sa().recoverPubKey(bn(t),n,r.recoveryParam).encode("hex",!1)}function m3(t,e){const r=bn(t);return r.length===32?new mk(r).publicKey:r.length===33?"0x"+sa().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?Ii(r):Fm.throwArgumentError("invalid public or private key","key","[REDACTED]")}var v3;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(v3||(v3={}));function bk(t){const e=m3(t);return DN($x(Em($x(e,1)),12))}function yk(t,e){return bk(vk(bn(t),e))}var Um={},Id={};Object.defineProperty(Id,"__esModule",{value:!0});var Yn=or,qm=Mi,wk=20;function xk(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],g=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],P=r[31]<<24|r[30]<<16|r[29]<<8|r[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],k=e[11]<<24|e[10]<<16|e[9]<<8|e[8],B=e[15]<<24|e[14]<<16|e[13]<<8|e[12],j=n,U=i,K=s,J=o,T=a,z=u,ue=l,_e=d,G=g,E=y,m=A,f=P,p=N,v=D,x=k,_=B,S=0;S>>16|p<<16,G=G+p|0,T^=G,T=T>>>20|T<<12,U=U+z|0,v^=U,v=v>>>16|v<<16,E=E+v|0,z^=E,z=z>>>20|z<<12,K=K+ue|0,x^=K,x=x>>>16|x<<16,m=m+x|0,ue^=m,ue=ue>>>20|ue<<12,J=J+_e|0,_^=J,_=_>>>16|_<<16,f=f+_|0,_e^=f,_e=_e>>>20|_e<<12,K=K+ue|0,x^=K,x=x>>>24|x<<8,m=m+x|0,ue^=m,ue=ue>>>25|ue<<7,J=J+_e|0,_^=J,_=_>>>24|_<<8,f=f+_|0,_e^=f,_e=_e>>>25|_e<<7,U=U+z|0,v^=U,v=v>>>24|v<<8,E=E+v|0,z^=E,z=z>>>25|z<<7,j=j+T|0,p^=j,p=p>>>24|p<<8,G=G+p|0,T^=G,T=T>>>25|T<<7,j=j+z|0,_^=j,_=_>>>16|_<<16,m=m+_|0,z^=m,z=z>>>20|z<<12,U=U+ue|0,p^=U,p=p>>>16|p<<16,f=f+p|0,ue^=f,ue=ue>>>20|ue<<12,K=K+_e|0,v^=K,v=v>>>16|v<<16,G=G+v|0,_e^=G,_e=_e>>>20|_e<<12,J=J+T|0,x^=J,x=x>>>16|x<<16,E=E+x|0,T^=E,T=T>>>20|T<<12,K=K+_e|0,v^=K,v=v>>>24|v<<8,G=G+v|0,_e^=G,_e=_e>>>25|_e<<7,J=J+T|0,x^=J,x=x>>>24|x<<8,E=E+x|0,T^=E,T=T>>>25|T<<7,U=U+ue|0,p^=U,p=p>>>24|p<<8,f=f+p|0,ue^=f,ue=ue>>>25|ue<<7,j=j+z|0,_^=j,_=_>>>24|_<<8,m=m+_|0,z^=m,z=z>>>25|z<<7;Yn.writeUint32LE(j+n|0,t,0),Yn.writeUint32LE(U+i|0,t,4),Yn.writeUint32LE(K+s|0,t,8),Yn.writeUint32LE(J+o|0,t,12),Yn.writeUint32LE(T+a|0,t,16),Yn.writeUint32LE(z+u|0,t,20),Yn.writeUint32LE(ue+l|0,t,24),Yn.writeUint32LE(_e+d|0,t,28),Yn.writeUint32LE(G+g|0,t,32),Yn.writeUint32LE(E+y|0,t,36),Yn.writeUint32LE(m+A|0,t,40),Yn.writeUint32LE(f+P|0,t,44),Yn.writeUint32LE(p+N|0,t,48),Yn.writeUint32LE(v+D|0,t,52),Yn.writeUint32LE(x+k|0,t,56),Yn.writeUint32LE(_+B|0,t,60)}function b3(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var y3={},oa={};Object.defineProperty(oa,"__esModule",{value:!0});function Sk(t,e,r){return~(t-1)&e|t-1&r}oa.select=Sk;function Ak(t,e){return(t|0)-(e|0)-1>>>31&1}oa.lessOrEqual=Ak;function w3(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}oa.compare=w3;function Pk(t,e){return t.length===0||e.length===0?!1:w3(t,e)!==0}oa.equal=Pk,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=oa,r=Mi;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var u=a[0]|a[1]<<8;this._r[0]=u&8191;var l=a[2]|a[3]<<8;this._r[1]=(u>>>13|l<<3)&8191;var d=a[4]|a[5]<<8;this._r[2]=(l>>>10|d<<6)&7939;var g=a[6]|a[7]<<8;this._r[3]=(d>>>7|g<<9)&8191;var y=a[8]|a[9]<<8;this._r[4]=(g>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var A=a[10]|a[11]<<8;this._r[6]=(y>>>14|A<<2)&8191;var P=a[12]|a[13]<<8;this._r[7]=(A>>>11|P<<5)&8065;var N=a[14]|a[15]<<8;this._r[8]=(P>>>8|N<<8)&8191,this._r[9]=N>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,u,l){for(var d=this._fin?0:2048,g=this._h[0],y=this._h[1],A=this._h[2],P=this._h[3],N=this._h[4],D=this._h[5],k=this._h[6],B=this._h[7],j=this._h[8],U=this._h[9],K=this._r[0],J=this._r[1],T=this._r[2],z=this._r[3],ue=this._r[4],_e=this._r[5],G=this._r[6],E=this._r[7],m=this._r[8],f=this._r[9];l>=16;){var p=a[u+0]|a[u+1]<<8;g+=p&8191;var v=a[u+2]|a[u+3]<<8;y+=(p>>>13|v<<3)&8191;var x=a[u+4]|a[u+5]<<8;A+=(v>>>10|x<<6)&8191;var _=a[u+6]|a[u+7]<<8;P+=(x>>>7|_<<9)&8191;var S=a[u+8]|a[u+9]<<8;N+=(_>>>4|S<<12)&8191,D+=S>>>1&8191;var b=a[u+10]|a[u+11]<<8;k+=(S>>>14|b<<2)&8191;var M=a[u+12]|a[u+13]<<8;B+=(b>>>11|M<<5)&8191;var I=a[u+14]|a[u+15]<<8;j+=(M>>>8|I<<8)&8191,U+=I>>>5|d;var F=0,ae=F;ae+=g*K,ae+=y*(5*f),ae+=A*(5*m),ae+=P*(5*E),ae+=N*(5*G),F=ae>>>13,ae&=8191,ae+=D*(5*_e),ae+=k*(5*ue),ae+=B*(5*z),ae+=j*(5*T),ae+=U*(5*J),F+=ae>>>13,ae&=8191;var O=F;O+=g*J,O+=y*K,O+=A*(5*f),O+=P*(5*m),O+=N*(5*E),F=O>>>13,O&=8191,O+=D*(5*G),O+=k*(5*_e),O+=B*(5*ue),O+=j*(5*z),O+=U*(5*T),F+=O>>>13,O&=8191;var se=F;se+=g*T,se+=y*J,se+=A*K,se+=P*(5*f),se+=N*(5*m),F=se>>>13,se&=8191,se+=D*(5*E),se+=k*(5*G),se+=B*(5*_e),se+=j*(5*ue),se+=U*(5*z),F+=se>>>13,se&=8191;var ee=F;ee+=g*z,ee+=y*T,ee+=A*J,ee+=P*K,ee+=N*(5*f),F=ee>>>13,ee&=8191,ee+=D*(5*m),ee+=k*(5*E),ee+=B*(5*G),ee+=j*(5*_e),ee+=U*(5*ue),F+=ee>>>13,ee&=8191;var X=F;X+=g*ue,X+=y*z,X+=A*T,X+=P*J,X+=N*K,F=X>>>13,X&=8191,X+=D*(5*f),X+=k*(5*m),X+=B*(5*E),X+=j*(5*G),X+=U*(5*_e),F+=X>>>13,X&=8191;var Q=F;Q+=g*_e,Q+=y*ue,Q+=A*z,Q+=P*T,Q+=N*J,F=Q>>>13,Q&=8191,Q+=D*K,Q+=k*(5*f),Q+=B*(5*m),Q+=j*(5*E),Q+=U*(5*G),F+=Q>>>13,Q&=8191;var R=F;R+=g*G,R+=y*_e,R+=A*ue,R+=P*z,R+=N*T,F=R>>>13,R&=8191,R+=D*J,R+=k*K,R+=B*(5*f),R+=j*(5*m),R+=U*(5*E),F+=R>>>13,R&=8191;var Z=F;Z+=g*E,Z+=y*G,Z+=A*_e,Z+=P*ue,Z+=N*z,F=Z>>>13,Z&=8191,Z+=D*T,Z+=k*J,Z+=B*K,Z+=j*(5*f),Z+=U*(5*m),F+=Z>>>13,Z&=8191;var te=F;te+=g*m,te+=y*E,te+=A*G,te+=P*_e,te+=N*ue,F=te>>>13,te&=8191,te+=D*z,te+=k*T,te+=B*J,te+=j*K,te+=U*(5*f),F+=te>>>13,te&=8191;var le=F;le+=g*f,le+=y*m,le+=A*E,le+=P*G,le+=N*_e,F=le>>>13,le&=8191,le+=D*ue,le+=k*z,le+=B*T,le+=j*J,le+=U*K,F+=le>>>13,le&=8191,F=(F<<2)+F|0,F=F+ae|0,ae=F&8191,F=F>>>13,O+=F,g=ae,y=O,A=se,P=ee,N=X,D=Q,k=R,B=Z,j=te,U=le,u+=16,l-=16}this._h[0]=g,this._h[1]=y,this._h[2]=A,this._h[3]=P,this._h[4]=N,this._h[5]=D,this._h[6]=k,this._h[7]=B,this._h[8]=j,this._h[9]=U},o.prototype.finish=function(a,u){u===void 0&&(u=0);var l=new Uint16Array(10),d,g,y,A;if(this._leftover){for(A=this._leftover,this._buffer[A++]=1;A<16;A++)this._buffer[A]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(d=this._h[1]>>>13,this._h[1]&=8191,A=2;A<10;A++)this._h[A]+=d,d=this._h[A]>>>13,this._h[A]&=8191;for(this._h[0]+=d*5,d=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=d,d=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=d,l[0]=this._h[0]+5,d=l[0]>>>13,l[0]&=8191,A=1;A<10;A++)l[A]=this._h[A]+d,d=l[A]>>>13,l[A]&=8191;for(l[9]-=8192,g=(d^1)-1,A=0;A<10;A++)l[A]&=g;for(g=~g,A=0;A<10;A++)this._h[A]=this._h[A]&g|l[A];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,y=this._h[0]+this._pad[0],this._h[0]=y&65535,A=1;A<8;A++)y=(this._h[A]+this._pad[A]|0)+(y>>>16)|0,this._h[A]=y&65535;return a[u+0]=this._h[0]>>>0,a[u+1]=this._h[0]>>>8,a[u+2]=this._h[1]>>>0,a[u+3]=this._h[1]>>>8,a[u+4]=this._h[2]>>>0,a[u+5]=this._h[2]>>>8,a[u+6]=this._h[3]>>>0,a[u+7]=this._h[3]>>>8,a[u+8]=this._h[4]>>>0,a[u+9]=this._h[4]>>>8,a[u+10]=this._h[5]>>>0,a[u+11]=this._h[5]>>>8,a[u+12]=this._h[6]>>>0,a[u+13]=this._h[6]>>>8,a[u+14]=this._h[7]>>>0,a[u+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var u=0,l=a.length,d;if(this._leftover){d=16-this._leftover,d>l&&(d=l);for(var g=0;g=16&&(d=l-l%16,this._blocks(a,u,d),u+=d,l-=d),l){for(var g=0;g16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var A=new Uint8Array(16);A.set(l,A.length-l.length);var P=new Uint8Array(32);e.stream(this._key,A,P,4);var N=d.length+this.tagLength,D;if(y){if(y.length!==N)throw new Error("ChaCha20Poly1305: incorrect destination length");D=y}else D=new Uint8Array(N);return e.streamXOR(this._key,A,d,D,4),this._authenticate(D.subarray(D.length-this.tagLength,D.length),P,D.subarray(0,D.length-this.tagLength),g),n.wipe(A),D},u.prototype.open=function(l,d,g,y){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(d.length0&&A.update(o.subarray(y.length%16))),A.update(g),g.length%16>0&&A.update(o.subarray(g.length%16));var P=new Uint8Array(8);y&&i.writeUint64LE(y.length,P),A.update(P),i.writeUint64LE(g.length,P),A.update(P);for(var N=A.digest(),D=0;Dthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._temp,this._state,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,g=l/536870912|0,y=l<<3,A=l%64<56?64:128;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._state.set(u.state),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.state),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,u,l,d,g){for(;g>=64;){for(var y=u[0],A=u[1],P=u[2],N=u[3],D=u[4],k=u[5],B=u[6],j=u[7],U=0;U<16;U++){var K=d+U*4;a[U]=e.readUint32BE(l,K)}for(var U=16;U<64;U++){var J=a[U-2],T=(J>>>17|J<<15)^(J>>>19|J<<13)^J>>>10;J=a[U-15];var z=(J>>>7|J<<25)^(J>>>18|J<<14)^J>>>3;a[U]=(T+a[U-7]|0)+(z+a[U-16]|0)}for(var U=0;U<64;U++){var T=(((D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7))+(D&k^~D&B)|0)+(j+(i[U]+a[U]|0)|0)|0,z=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&A^y&P^A&P)|0;j=B,B=k,k=D,D=N+T|0,N=P,P=A,A=y,y=T+z|0}u[0]+=y,u[1]+=A,u[2]+=P,u[3]+=N,u[4]+=D,u[5]+=k,u[6]+=B,u[7]+=j,d+=64,g-=64}return d}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ll);var Hm={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=ta,r=Mi;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(U){const K=new Float64Array(16);if(U)for(let J=0;J>16&1),J[_e-1]&=65535;J[15]=T[15]-32767-(J[14]>>16&1);const ue=J[15]>>16&1;J[14]&=65535,a(T,J,1-ue)}for(let z=0;z<16;z++)U[2*z]=T[z]&255,U[2*z+1]=T[z]>>8}function l(U,K){for(let J=0;J<16;J++)U[J]=K[2*J]+(K[2*J+1]<<8);U[15]&=32767}function d(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]+J[T]}function g(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]-J[T]}function y(U,K,J){let T,z,ue=0,_e=0,G=0,E=0,m=0,f=0,p=0,v=0,x=0,_=0,S=0,b=0,M=0,I=0,F=0,ae=0,O=0,se=0,ee=0,X=0,Q=0,R=0,Z=0,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=J[0],Ie=J[1],Le=J[2],Ve=J[3],ke=J[4],ze=J[5],He=J[6],Ee=J[7],Qe=J[8],ct=J[9],Be=J[10],et=J[11],rt=J[12],Je=J[13],pt=J[14],ht=J[15];T=K[0],ue+=T*$e,_e+=T*Ie,G+=T*Le,E+=T*Ve,m+=T*ke,f+=T*ze,p+=T*He,v+=T*Ee,x+=T*Qe,_+=T*ct,S+=T*Be,b+=T*et,M+=T*rt,I+=T*Je,F+=T*pt,ae+=T*ht,T=K[1],_e+=T*$e,G+=T*Ie,E+=T*Le,m+=T*Ve,f+=T*ke,p+=T*ze,v+=T*He,x+=T*Ee,_+=T*Qe,S+=T*ct,b+=T*Be,M+=T*et,I+=T*rt,F+=T*Je,ae+=T*pt,O+=T*ht,T=K[2],G+=T*$e,E+=T*Ie,m+=T*Le,f+=T*Ve,p+=T*ke,v+=T*ze,x+=T*He,_+=T*Ee,S+=T*Qe,b+=T*ct,M+=T*Be,I+=T*et,F+=T*rt,ae+=T*Je,O+=T*pt,se+=T*ht,T=K[3],E+=T*$e,m+=T*Ie,f+=T*Le,p+=T*Ve,v+=T*ke,x+=T*ze,_+=T*He,S+=T*Ee,b+=T*Qe,M+=T*ct,I+=T*Be,F+=T*et,ae+=T*rt,O+=T*Je,se+=T*pt,ee+=T*ht,T=K[4],m+=T*$e,f+=T*Ie,p+=T*Le,v+=T*Ve,x+=T*ke,_+=T*ze,S+=T*He,b+=T*Ee,M+=T*Qe,I+=T*ct,F+=T*Be,ae+=T*et,O+=T*rt,se+=T*Je,ee+=T*pt,X+=T*ht,T=K[5],f+=T*$e,p+=T*Ie,v+=T*Le,x+=T*Ve,_+=T*ke,S+=T*ze,b+=T*He,M+=T*Ee,I+=T*Qe,F+=T*ct,ae+=T*Be,O+=T*et,se+=T*rt,ee+=T*Je,X+=T*pt,Q+=T*ht,T=K[6],p+=T*$e,v+=T*Ie,x+=T*Le,_+=T*Ve,S+=T*ke,b+=T*ze,M+=T*He,I+=T*Ee,F+=T*Qe,ae+=T*ct,O+=T*Be,se+=T*et,ee+=T*rt,X+=T*Je,Q+=T*pt,R+=T*ht,T=K[7],v+=T*$e,x+=T*Ie,_+=T*Le,S+=T*Ve,b+=T*ke,M+=T*ze,I+=T*He,F+=T*Ee,ae+=T*Qe,O+=T*ct,se+=T*Be,ee+=T*et,X+=T*rt,Q+=T*Je,R+=T*pt,Z+=T*ht,T=K[8],x+=T*$e,_+=T*Ie,S+=T*Le,b+=T*Ve,M+=T*ke,I+=T*ze,F+=T*He,ae+=T*Ee,O+=T*Qe,se+=T*ct,ee+=T*Be,X+=T*et,Q+=T*rt,R+=T*Je,Z+=T*pt,te+=T*ht,T=K[9],_+=T*$e,S+=T*Ie,b+=T*Le,M+=T*Ve,I+=T*ke,F+=T*ze,ae+=T*He,O+=T*Ee,se+=T*Qe,ee+=T*ct,X+=T*Be,Q+=T*et,R+=T*rt,Z+=T*Je,te+=T*pt,le+=T*ht,T=K[10],S+=T*$e,b+=T*Ie,M+=T*Le,I+=T*Ve,F+=T*ke,ae+=T*ze,O+=T*He,se+=T*Ee,ee+=T*Qe,X+=T*ct,Q+=T*Be,R+=T*et,Z+=T*rt,te+=T*Je,le+=T*pt,ie+=T*ht,T=K[11],b+=T*$e,M+=T*Ie,I+=T*Le,F+=T*Ve,ae+=T*ke,O+=T*ze,se+=T*He,ee+=T*Ee,X+=T*Qe,Q+=T*ct,R+=T*Be,Z+=T*et,te+=T*rt,le+=T*Je,ie+=T*pt,fe+=T*ht,T=K[12],M+=T*$e,I+=T*Ie,F+=T*Le,ae+=T*Ve,O+=T*ke,se+=T*ze,ee+=T*He,X+=T*Ee,Q+=T*Qe,R+=T*ct,Z+=T*Be,te+=T*et,le+=T*rt,ie+=T*Je,fe+=T*pt,ve+=T*ht,T=K[13],I+=T*$e,F+=T*Ie,ae+=T*Le,O+=T*Ve,se+=T*ke,ee+=T*ze,X+=T*He,Q+=T*Ee,R+=T*Qe,Z+=T*ct,te+=T*Be,le+=T*et,ie+=T*rt,fe+=T*Je,ve+=T*pt,Me+=T*ht,T=K[14],F+=T*$e,ae+=T*Ie,O+=T*Le,se+=T*Ve,ee+=T*ke,X+=T*ze,Q+=T*He,R+=T*Ee,Z+=T*Qe,te+=T*ct,le+=T*Be,ie+=T*et,fe+=T*rt,ve+=T*Je,Me+=T*pt,Ne+=T*ht,T=K[15],ae+=T*$e,O+=T*Ie,se+=T*Le,ee+=T*Ve,X+=T*ke,Q+=T*ze,R+=T*He,Z+=T*Ee,te+=T*Qe,le+=T*ct,ie+=T*Be,fe+=T*et,ve+=T*rt,Me+=T*Je,Ne+=T*pt,Te+=T*ht,ue+=38*O,_e+=38*se,G+=38*ee,E+=38*X,m+=38*Q,f+=38*R,p+=38*Z,v+=38*te,x+=38*le,_+=38*ie,S+=38*fe,b+=38*ve,M+=38*Me,I+=38*Ne,F+=38*Te,z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=p+z+65535,z=Math.floor(T/65536),p=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=p+z+65535,z=Math.floor(T/65536),p=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),U[0]=ue,U[1]=_e,U[2]=G,U[3]=E,U[4]=m,U[5]=f,U[6]=p,U[7]=v,U[8]=x,U[9]=_,U[10]=S,U[11]=b,U[12]=M,U[13]=I,U[14]=F,U[15]=ae}function A(U,K){y(U,K,K)}function P(U,K){const J=n();for(let T=0;T<16;T++)J[T]=K[T];for(let T=253;T>=0;T--)A(J,J),T!==2&&T!==4&&y(J,J,K);for(let T=0;T<16;T++)U[T]=J[T]}function N(U,K){const J=new Uint8Array(32),T=new Float64Array(80),z=n(),ue=n(),_e=n(),G=n(),E=n(),m=n();for(let x=0;x<31;x++)J[x]=U[x];J[31]=U[31]&127|64,J[0]&=248,l(T,K);for(let x=0;x<16;x++)ue[x]=T[x];z[0]=G[0]=1;for(let x=254;x>=0;--x){const _=J[x>>>3]>>>(x&7)&1;a(z,ue,_),a(_e,G,_),d(E,z,_e),g(z,z,_e),d(_e,ue,G),g(ue,ue,G),A(G,E),A(m,z),y(z,_e,z),y(_e,ue,E),d(E,z,_e),g(z,z,_e),A(ue,z),g(_e,G,m),y(z,_e,s),d(z,z,G),y(_e,_e,z),y(z,G,m),y(G,ue,T),A(ue,E),a(z,ue,_),a(_e,G,_)}for(let x=0;x<16;x++)T[x+16]=z[x],T[x+32]=_e[x],T[x+48]=ue[x],T[x+64]=G[x];const f=T.subarray(32),p=T.subarray(16);P(f,f),y(p,p,f);const v=new Uint8Array(32);return u(v,p),v}t.scalarMult=N;function D(U){return N(U,i)}t.scalarMultBase=D;function k(U){if(U.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const K=new Uint8Array(U);return{publicKey:D(K),secretKey:K}}t.generateKeyPairFromSeed=k;function B(U){const K=(0,e.randomBytes)(32,U),J=k(K);return(0,r.wipe)(K),J}t.generateKeyPair=B;function j(U,K,J=!1){if(U.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(K.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const T=N(U,K);if(J){let z=0;for(let ue=0;ue",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}};var Ti={},Wm={exports:{}};Wm.exports,function(t){(function(e,r){function n(G,E){if(!G)throw new Error(E||"Assertion failed")}function i(G,E){G.super_=E;var m=function(){};m.prototype=E.prototype,G.prototype=new m,G.prototype.constructor=G}function s(G,E,m){if(s.isBN(G))return G;this.negative=0,this.words=null,this.length=0,this.red=null,G!==null&&((E==="le"||E==="be")&&(m=E,E=10),this._init(G||0,E||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(E){return E instanceof s?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===s.wordSize&&Array.isArray(E.words)},s.max=function(E,m){return E.cmp(m)>0?E:m},s.min=function(E,m){return E.cmp(m)<0?E:m},s.prototype._init=function(E,m,f){if(typeof E=="number")return this._initNumber(E,m,f);if(typeof E=="object")return this._initArray(E,m,f);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),E=E.toString().replace(/\s+/g,"");var p=0;E[0]==="-"&&(p++,this.negative=1),p=0;p-=3)x=E[p]|E[p-1]<<8|E[p-2]<<16,this.words[v]|=x<<_&67108863,this.words[v+1]=x>>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);else if(f==="le")for(p=0,v=0;p>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);return this.strip()};function a(G,E){var m=G.charCodeAt(E);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function u(G,E,m){var f=a(G,m);return m-1>=E&&(f|=a(G,m-1)<<4),f}s.prototype._parseHex=function(E,m,f){this.length=Math.ceil((E.length-m)/6),this.words=new Array(this.length);for(var p=0;p=m;p-=2)_=u(E,m,p)<=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8;else{var S=E.length-m;for(p=S%2===0?m+1:m;p=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8}this.strip()};function l(G,E,m,f){for(var p=0,v=Math.min(G.length,m),x=E;x=49?p+=_-49+10:_>=17?p+=_-17+10:p+=_}return p}s.prototype._parseBase=function(E,m,f){this.words=[0],this.length=1;for(var p=0,v=1;v<=67108863;v*=m)p++;p--,v=v/m|0;for(var x=E.length-f,_=x%p,S=Math.min(x,x-_)+f,b=0,M=f;M1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var d=["","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"],g=[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],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(E,m){E=E||10,m=m|0||1;var f;if(E===16||E==="hex"){f="";for(var p=0,v=0,x=0;x>>24-p&16777215,p+=2,p>=26&&(p-=26,x--),v!==0||x!==this.length-1?f=d[6-S.length]+S+f:f=S+f}for(v!==0&&(f=v.toString(16)+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(E===(E|0)&&E>=2&&E<=36){var b=g[E],M=y[E];f="";var I=this.clone();for(I.negative=0;!I.isZero();){var F=I.modn(M).toString(E);I=I.idivn(M),I.isZero()?f=F+f:f=d[b-F.length]+F+f}for(this.isZero()&&(f="0"+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(E,m){return n(typeof o<"u"),this.toArrayLike(o,E,m)},s.prototype.toArray=function(E,m){return this.toArrayLike(Array,E,m)},s.prototype.toArrayLike=function(E,m,f){var p=this.byteLength(),v=f||Math.max(1,p);n(p<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var x=m==="le",_=new E(v),S,b,M=this.clone();if(x){for(b=0;!M.isZero();b++)S=M.andln(255),M.iushrn(8),_[b]=S;for(;b=4096&&(f+=13,m>>>=13),m>=64&&(f+=7,m>>>=7),m>=8&&(f+=4,m>>>=4),m>=2&&(f+=2,m>>>=2),f+m},s.prototype._zeroBits=function(E){if(E===0)return 26;var m=E,f=0;return m&8191||(f+=13,m>>>=13),m&127||(f+=7,m>>>=7),m&15||(f+=4,m>>>=4),m&3||(f+=2,m>>>=2),m&1||f++,f},s.prototype.bitLength=function(){var E=this.words[this.length-1],m=this._countBits(E);return(this.length-1)*26+m};function A(G){for(var E=new Array(G.bitLength()),m=0;m>>p}return E}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,m=0;mE.length?this.clone().ior(E):E.clone().ior(this)},s.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},s.prototype.iuand=function(E){var m;this.length>E.length?m=E:m=this;for(var f=0;fE.length?this.clone().iand(E):E.clone().iand(this)},s.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},s.prototype.iuxor=function(E){var m,f;this.length>E.length?(m=this,f=E):(m=E,f=this);for(var p=0;pE.length?this.clone().ixor(E):E.clone().ixor(this)},s.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},s.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var m=Math.ceil(E/26)|0,f=E%26;this._expand(m),f>0&&m--;for(var p=0;p0&&(this.words[p]=~this.words[p]&67108863>>26-f),this.strip()},s.prototype.notn=function(E){return this.clone().inotn(E)},s.prototype.setn=function(E,m){n(typeof E=="number"&&E>=0);var f=E/26|0,p=E%26;return this._expand(f+1),m?this.words[f]=this.words[f]|1<E.length?(f=this,p=E):(f=E,p=this);for(var v=0,x=0;x>>26;for(;v!==0&&x>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;xE.length?this.clone().iadd(E):E.clone().iadd(this)},s.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var m=this.iadd(E);return E.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var f=this.cmp(E);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,v;f>0?(p=this,v=E):(p=E,v=this);for(var x=0,_=0;_>26,this.words[_]=m&67108863;for(;x!==0&&_>26,this.words[_]=m&67108863;if(x===0&&_>>26,I=S&67108863,F=Math.min(b,E.length-1),ae=Math.max(0,b-G.length+1);ae<=F;ae++){var O=b-ae|0;p=G.words[O]|0,v=E.words[ae]|0,x=p*v+I,M+=x/67108864|0,I=x&67108863}m.words[b]=I|0,S=M|0}return S!==0?m.words[b]=S|0:m.length--,m.strip()}var N=function(E,m,f){var p=E.words,v=m.words,x=f.words,_=0,S,b,M,I=p[0]|0,F=I&8191,ae=I>>>13,O=p[1]|0,se=O&8191,ee=O>>>13,X=p[2]|0,Q=X&8191,R=X>>>13,Z=p[3]|0,te=Z&8191,le=Z>>>13,ie=p[4]|0,fe=ie&8191,ve=ie>>>13,Me=p[5]|0,Ne=Me&8191,Te=Me>>>13,$e=p[6]|0,Ie=$e&8191,Le=$e>>>13,Ve=p[7]|0,ke=Ve&8191,ze=Ve>>>13,He=p[8]|0,Ee=He&8191,Qe=He>>>13,ct=p[9]|0,Be=ct&8191,et=ct>>>13,rt=v[0]|0,Je=rt&8191,pt=rt>>>13,ht=v[1]|0,ft=ht&8191,Ht=ht>>>13,Jt=v[2]|0,St=Jt&8191,er=Jt>>>13,Xt=v[3]|0,Ot=Xt&8191,Bt=Xt>>>13,Tt=v[4]|0,vt=Tt&8191,Dt=Tt>>>13,Lt=v[5]|0,bt=Lt&8191,$t=Lt>>>13,jt=v[6]|0,nt=jt&8191,Ft=jt>>>13,$=v[7]|0,H=$&8191,V=$>>>13,C=v[8]|0,Y=C&8191,q=C>>>13,oe=v[9]|0,pe=oe&8191,xe=oe>>>13;f.negative=E.negative^m.negative,f.length=19,S=Math.imul(F,Je),b=Math.imul(F,pt),b=b+Math.imul(ae,Je)|0,M=Math.imul(ae,pt);var Re=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Re>>>26)|0,Re&=67108863,S=Math.imul(se,Je),b=Math.imul(se,pt),b=b+Math.imul(ee,Je)|0,M=Math.imul(ee,pt),S=S+Math.imul(F,ft)|0,b=b+Math.imul(F,Ht)|0,b=b+Math.imul(ae,ft)|0,M=M+Math.imul(ae,Ht)|0;var De=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(De>>>26)|0,De&=67108863,S=Math.imul(Q,Je),b=Math.imul(Q,pt),b=b+Math.imul(R,Je)|0,M=Math.imul(R,pt),S=S+Math.imul(se,ft)|0,b=b+Math.imul(se,Ht)|0,b=b+Math.imul(ee,ft)|0,M=M+Math.imul(ee,Ht)|0,S=S+Math.imul(F,St)|0,b=b+Math.imul(F,er)|0,b=b+Math.imul(ae,St)|0,M=M+Math.imul(ae,er)|0;var it=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(it>>>26)|0,it&=67108863,S=Math.imul(te,Je),b=Math.imul(te,pt),b=b+Math.imul(le,Je)|0,M=Math.imul(le,pt),S=S+Math.imul(Q,ft)|0,b=b+Math.imul(Q,Ht)|0,b=b+Math.imul(R,ft)|0,M=M+Math.imul(R,Ht)|0,S=S+Math.imul(se,St)|0,b=b+Math.imul(se,er)|0,b=b+Math.imul(ee,St)|0,M=M+Math.imul(ee,er)|0,S=S+Math.imul(F,Ot)|0,b=b+Math.imul(F,Bt)|0,b=b+Math.imul(ae,Ot)|0,M=M+Math.imul(ae,Bt)|0;var Ue=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,S=Math.imul(fe,Je),b=Math.imul(fe,pt),b=b+Math.imul(ve,Je)|0,M=Math.imul(ve,pt),S=S+Math.imul(te,ft)|0,b=b+Math.imul(te,Ht)|0,b=b+Math.imul(le,ft)|0,M=M+Math.imul(le,Ht)|0,S=S+Math.imul(Q,St)|0,b=b+Math.imul(Q,er)|0,b=b+Math.imul(R,St)|0,M=M+Math.imul(R,er)|0,S=S+Math.imul(se,Ot)|0,b=b+Math.imul(se,Bt)|0,b=b+Math.imul(ee,Ot)|0,M=M+Math.imul(ee,Bt)|0,S=S+Math.imul(F,vt)|0,b=b+Math.imul(F,Dt)|0,b=b+Math.imul(ae,vt)|0,M=M+Math.imul(ae,Dt)|0;var gt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(gt>>>26)|0,gt&=67108863,S=Math.imul(Ne,Je),b=Math.imul(Ne,pt),b=b+Math.imul(Te,Je)|0,M=Math.imul(Te,pt),S=S+Math.imul(fe,ft)|0,b=b+Math.imul(fe,Ht)|0,b=b+Math.imul(ve,ft)|0,M=M+Math.imul(ve,Ht)|0,S=S+Math.imul(te,St)|0,b=b+Math.imul(te,er)|0,b=b+Math.imul(le,St)|0,M=M+Math.imul(le,er)|0,S=S+Math.imul(Q,Ot)|0,b=b+Math.imul(Q,Bt)|0,b=b+Math.imul(R,Ot)|0,M=M+Math.imul(R,Bt)|0,S=S+Math.imul(se,vt)|0,b=b+Math.imul(se,Dt)|0,b=b+Math.imul(ee,vt)|0,M=M+Math.imul(ee,Dt)|0,S=S+Math.imul(F,bt)|0,b=b+Math.imul(F,$t)|0,b=b+Math.imul(ae,bt)|0,M=M+Math.imul(ae,$t)|0;var st=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(st>>>26)|0,st&=67108863,S=Math.imul(Ie,Je),b=Math.imul(Ie,pt),b=b+Math.imul(Le,Je)|0,M=Math.imul(Le,pt),S=S+Math.imul(Ne,ft)|0,b=b+Math.imul(Ne,Ht)|0,b=b+Math.imul(Te,ft)|0,M=M+Math.imul(Te,Ht)|0,S=S+Math.imul(fe,St)|0,b=b+Math.imul(fe,er)|0,b=b+Math.imul(ve,St)|0,M=M+Math.imul(ve,er)|0,S=S+Math.imul(te,Ot)|0,b=b+Math.imul(te,Bt)|0,b=b+Math.imul(le,Ot)|0,M=M+Math.imul(le,Bt)|0,S=S+Math.imul(Q,vt)|0,b=b+Math.imul(Q,Dt)|0,b=b+Math.imul(R,vt)|0,M=M+Math.imul(R,Dt)|0,S=S+Math.imul(se,bt)|0,b=b+Math.imul(se,$t)|0,b=b+Math.imul(ee,bt)|0,M=M+Math.imul(ee,$t)|0,S=S+Math.imul(F,nt)|0,b=b+Math.imul(F,Ft)|0,b=b+Math.imul(ae,nt)|0,M=M+Math.imul(ae,Ft)|0;var tt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(tt>>>26)|0,tt&=67108863,S=Math.imul(ke,Je),b=Math.imul(ke,pt),b=b+Math.imul(ze,Je)|0,M=Math.imul(ze,pt),S=S+Math.imul(Ie,ft)|0,b=b+Math.imul(Ie,Ht)|0,b=b+Math.imul(Le,ft)|0,M=M+Math.imul(Le,Ht)|0,S=S+Math.imul(Ne,St)|0,b=b+Math.imul(Ne,er)|0,b=b+Math.imul(Te,St)|0,M=M+Math.imul(Te,er)|0,S=S+Math.imul(fe,Ot)|0,b=b+Math.imul(fe,Bt)|0,b=b+Math.imul(ve,Ot)|0,M=M+Math.imul(ve,Bt)|0,S=S+Math.imul(te,vt)|0,b=b+Math.imul(te,Dt)|0,b=b+Math.imul(le,vt)|0,M=M+Math.imul(le,Dt)|0,S=S+Math.imul(Q,bt)|0,b=b+Math.imul(Q,$t)|0,b=b+Math.imul(R,bt)|0,M=M+Math.imul(R,$t)|0,S=S+Math.imul(se,nt)|0,b=b+Math.imul(se,Ft)|0,b=b+Math.imul(ee,nt)|0,M=M+Math.imul(ee,Ft)|0,S=S+Math.imul(F,H)|0,b=b+Math.imul(F,V)|0,b=b+Math.imul(ae,H)|0,M=M+Math.imul(ae,V)|0;var At=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(At>>>26)|0,At&=67108863,S=Math.imul(Ee,Je),b=Math.imul(Ee,pt),b=b+Math.imul(Qe,Je)|0,M=Math.imul(Qe,pt),S=S+Math.imul(ke,ft)|0,b=b+Math.imul(ke,Ht)|0,b=b+Math.imul(ze,ft)|0,M=M+Math.imul(ze,Ht)|0,S=S+Math.imul(Ie,St)|0,b=b+Math.imul(Ie,er)|0,b=b+Math.imul(Le,St)|0,M=M+Math.imul(Le,er)|0,S=S+Math.imul(Ne,Ot)|0,b=b+Math.imul(Ne,Bt)|0,b=b+Math.imul(Te,Ot)|0,M=M+Math.imul(Te,Bt)|0,S=S+Math.imul(fe,vt)|0,b=b+Math.imul(fe,Dt)|0,b=b+Math.imul(ve,vt)|0,M=M+Math.imul(ve,Dt)|0,S=S+Math.imul(te,bt)|0,b=b+Math.imul(te,$t)|0,b=b+Math.imul(le,bt)|0,M=M+Math.imul(le,$t)|0,S=S+Math.imul(Q,nt)|0,b=b+Math.imul(Q,Ft)|0,b=b+Math.imul(R,nt)|0,M=M+Math.imul(R,Ft)|0,S=S+Math.imul(se,H)|0,b=b+Math.imul(se,V)|0,b=b+Math.imul(ee,H)|0,M=M+Math.imul(ee,V)|0,S=S+Math.imul(F,Y)|0,b=b+Math.imul(F,q)|0,b=b+Math.imul(ae,Y)|0,M=M+Math.imul(ae,q)|0;var Rt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,S=Math.imul(Be,Je),b=Math.imul(Be,pt),b=b+Math.imul(et,Je)|0,M=Math.imul(et,pt),S=S+Math.imul(Ee,ft)|0,b=b+Math.imul(Ee,Ht)|0,b=b+Math.imul(Qe,ft)|0,M=M+Math.imul(Qe,Ht)|0,S=S+Math.imul(ke,St)|0,b=b+Math.imul(ke,er)|0,b=b+Math.imul(ze,St)|0,M=M+Math.imul(ze,er)|0,S=S+Math.imul(Ie,Ot)|0,b=b+Math.imul(Ie,Bt)|0,b=b+Math.imul(Le,Ot)|0,M=M+Math.imul(Le,Bt)|0,S=S+Math.imul(Ne,vt)|0,b=b+Math.imul(Ne,Dt)|0,b=b+Math.imul(Te,vt)|0,M=M+Math.imul(Te,Dt)|0,S=S+Math.imul(fe,bt)|0,b=b+Math.imul(fe,$t)|0,b=b+Math.imul(ve,bt)|0,M=M+Math.imul(ve,$t)|0,S=S+Math.imul(te,nt)|0,b=b+Math.imul(te,Ft)|0,b=b+Math.imul(le,nt)|0,M=M+Math.imul(le,Ft)|0,S=S+Math.imul(Q,H)|0,b=b+Math.imul(Q,V)|0,b=b+Math.imul(R,H)|0,M=M+Math.imul(R,V)|0,S=S+Math.imul(se,Y)|0,b=b+Math.imul(se,q)|0,b=b+Math.imul(ee,Y)|0,M=M+Math.imul(ee,q)|0,S=S+Math.imul(F,pe)|0,b=b+Math.imul(F,xe)|0,b=b+Math.imul(ae,pe)|0,M=M+Math.imul(ae,xe)|0;var Mt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,S=Math.imul(Be,ft),b=Math.imul(Be,Ht),b=b+Math.imul(et,ft)|0,M=Math.imul(et,Ht),S=S+Math.imul(Ee,St)|0,b=b+Math.imul(Ee,er)|0,b=b+Math.imul(Qe,St)|0,M=M+Math.imul(Qe,er)|0,S=S+Math.imul(ke,Ot)|0,b=b+Math.imul(ke,Bt)|0,b=b+Math.imul(ze,Ot)|0,M=M+Math.imul(ze,Bt)|0,S=S+Math.imul(Ie,vt)|0,b=b+Math.imul(Ie,Dt)|0,b=b+Math.imul(Le,vt)|0,M=M+Math.imul(Le,Dt)|0,S=S+Math.imul(Ne,bt)|0,b=b+Math.imul(Ne,$t)|0,b=b+Math.imul(Te,bt)|0,M=M+Math.imul(Te,$t)|0,S=S+Math.imul(fe,nt)|0,b=b+Math.imul(fe,Ft)|0,b=b+Math.imul(ve,nt)|0,M=M+Math.imul(ve,Ft)|0,S=S+Math.imul(te,H)|0,b=b+Math.imul(te,V)|0,b=b+Math.imul(le,H)|0,M=M+Math.imul(le,V)|0,S=S+Math.imul(Q,Y)|0,b=b+Math.imul(Q,q)|0,b=b+Math.imul(R,Y)|0,M=M+Math.imul(R,q)|0,S=S+Math.imul(se,pe)|0,b=b+Math.imul(se,xe)|0,b=b+Math.imul(ee,pe)|0,M=M+Math.imul(ee,xe)|0;var Et=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Et>>>26)|0,Et&=67108863,S=Math.imul(Be,St),b=Math.imul(Be,er),b=b+Math.imul(et,St)|0,M=Math.imul(et,er),S=S+Math.imul(Ee,Ot)|0,b=b+Math.imul(Ee,Bt)|0,b=b+Math.imul(Qe,Ot)|0,M=M+Math.imul(Qe,Bt)|0,S=S+Math.imul(ke,vt)|0,b=b+Math.imul(ke,Dt)|0,b=b+Math.imul(ze,vt)|0,M=M+Math.imul(ze,Dt)|0,S=S+Math.imul(Ie,bt)|0,b=b+Math.imul(Ie,$t)|0,b=b+Math.imul(Le,bt)|0,M=M+Math.imul(Le,$t)|0,S=S+Math.imul(Ne,nt)|0,b=b+Math.imul(Ne,Ft)|0,b=b+Math.imul(Te,nt)|0,M=M+Math.imul(Te,Ft)|0,S=S+Math.imul(fe,H)|0,b=b+Math.imul(fe,V)|0,b=b+Math.imul(ve,H)|0,M=M+Math.imul(ve,V)|0,S=S+Math.imul(te,Y)|0,b=b+Math.imul(te,q)|0,b=b+Math.imul(le,Y)|0,M=M+Math.imul(le,q)|0,S=S+Math.imul(Q,pe)|0,b=b+Math.imul(Q,xe)|0,b=b+Math.imul(R,pe)|0,M=M+Math.imul(R,xe)|0;var dt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(dt>>>26)|0,dt&=67108863,S=Math.imul(Be,Ot),b=Math.imul(Be,Bt),b=b+Math.imul(et,Ot)|0,M=Math.imul(et,Bt),S=S+Math.imul(Ee,vt)|0,b=b+Math.imul(Ee,Dt)|0,b=b+Math.imul(Qe,vt)|0,M=M+Math.imul(Qe,Dt)|0,S=S+Math.imul(ke,bt)|0,b=b+Math.imul(ke,$t)|0,b=b+Math.imul(ze,bt)|0,M=M+Math.imul(ze,$t)|0,S=S+Math.imul(Ie,nt)|0,b=b+Math.imul(Ie,Ft)|0,b=b+Math.imul(Le,nt)|0,M=M+Math.imul(Le,Ft)|0,S=S+Math.imul(Ne,H)|0,b=b+Math.imul(Ne,V)|0,b=b+Math.imul(Te,H)|0,M=M+Math.imul(Te,V)|0,S=S+Math.imul(fe,Y)|0,b=b+Math.imul(fe,q)|0,b=b+Math.imul(ve,Y)|0,M=M+Math.imul(ve,q)|0,S=S+Math.imul(te,pe)|0,b=b+Math.imul(te,xe)|0,b=b+Math.imul(le,pe)|0,M=M+Math.imul(le,xe)|0;var _t=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(_t>>>26)|0,_t&=67108863,S=Math.imul(Be,vt),b=Math.imul(Be,Dt),b=b+Math.imul(et,vt)|0,M=Math.imul(et,Dt),S=S+Math.imul(Ee,bt)|0,b=b+Math.imul(Ee,$t)|0,b=b+Math.imul(Qe,bt)|0,M=M+Math.imul(Qe,$t)|0,S=S+Math.imul(ke,nt)|0,b=b+Math.imul(ke,Ft)|0,b=b+Math.imul(ze,nt)|0,M=M+Math.imul(ze,Ft)|0,S=S+Math.imul(Ie,H)|0,b=b+Math.imul(Ie,V)|0,b=b+Math.imul(Le,H)|0,M=M+Math.imul(Le,V)|0,S=S+Math.imul(Ne,Y)|0,b=b+Math.imul(Ne,q)|0,b=b+Math.imul(Te,Y)|0,M=M+Math.imul(Te,q)|0,S=S+Math.imul(fe,pe)|0,b=b+Math.imul(fe,xe)|0,b=b+Math.imul(ve,pe)|0,M=M+Math.imul(ve,xe)|0;var ot=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(ot>>>26)|0,ot&=67108863,S=Math.imul(Be,bt),b=Math.imul(Be,$t),b=b+Math.imul(et,bt)|0,M=Math.imul(et,$t),S=S+Math.imul(Ee,nt)|0,b=b+Math.imul(Ee,Ft)|0,b=b+Math.imul(Qe,nt)|0,M=M+Math.imul(Qe,Ft)|0,S=S+Math.imul(ke,H)|0,b=b+Math.imul(ke,V)|0,b=b+Math.imul(ze,H)|0,M=M+Math.imul(ze,V)|0,S=S+Math.imul(Ie,Y)|0,b=b+Math.imul(Ie,q)|0,b=b+Math.imul(Le,Y)|0,M=M+Math.imul(Le,q)|0,S=S+Math.imul(Ne,pe)|0,b=b+Math.imul(Ne,xe)|0,b=b+Math.imul(Te,pe)|0,M=M+Math.imul(Te,xe)|0;var wt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(wt>>>26)|0,wt&=67108863,S=Math.imul(Be,nt),b=Math.imul(Be,Ft),b=b+Math.imul(et,nt)|0,M=Math.imul(et,Ft),S=S+Math.imul(Ee,H)|0,b=b+Math.imul(Ee,V)|0,b=b+Math.imul(Qe,H)|0,M=M+Math.imul(Qe,V)|0,S=S+Math.imul(ke,Y)|0,b=b+Math.imul(ke,q)|0,b=b+Math.imul(ze,Y)|0,M=M+Math.imul(ze,q)|0,S=S+Math.imul(Ie,pe)|0,b=b+Math.imul(Ie,xe)|0,b=b+Math.imul(Le,pe)|0,M=M+Math.imul(Le,xe)|0;var lt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul(Be,H),b=Math.imul(Be,V),b=b+Math.imul(et,H)|0,M=Math.imul(et,V),S=S+Math.imul(Ee,Y)|0,b=b+Math.imul(Ee,q)|0,b=b+Math.imul(Qe,Y)|0,M=M+Math.imul(Qe,q)|0,S=S+Math.imul(ke,pe)|0,b=b+Math.imul(ke,xe)|0,b=b+Math.imul(ze,pe)|0,M=M+Math.imul(ze,xe)|0;var at=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(at>>>26)|0,at&=67108863,S=Math.imul(Be,Y),b=Math.imul(Be,q),b=b+Math.imul(et,Y)|0,M=Math.imul(et,q),S=S+Math.imul(Ee,pe)|0,b=b+Math.imul(Ee,xe)|0,b=b+Math.imul(Qe,pe)|0,M=M+Math.imul(Qe,xe)|0;var Ae=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,S=Math.imul(Be,pe),b=Math.imul(Be,xe),b=b+Math.imul(et,pe)|0,M=Math.imul(et,xe);var Pe=(_+S|0)+((b&8191)<<13)|0;return _=(M+(b>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,x[0]=Re,x[1]=De,x[2]=it,x[3]=Ue,x[4]=gt,x[5]=st,x[6]=tt,x[7]=At,x[8]=Rt,x[9]=Mt,x[10]=Et,x[11]=dt,x[12]=_t,x[13]=ot,x[14]=wt,x[15]=lt,x[16]=at,x[17]=Ae,x[18]=Pe,_!==0&&(x[19]=_,f.length++),f};Math.imul||(N=P);function D(G,E,m){m.negative=E.negative^G.negative,m.length=G.length+E.length;for(var f=0,p=0,v=0;v>>26)|0,p+=x>>>26,x&=67108863}m.words[v]=_,f=x,x=p}return f!==0?m.words[v]=f:m.length--,m.strip()}function k(G,E,m){var f=new B;return f.mulp(G,E,m)}s.prototype.mulTo=function(E,m){var f,p=this.length+E.length;return this.length===10&&E.length===10?f=N(this,E,m):p<63?f=P(this,E,m):p<1024?f=D(this,E,m):f=k(this,E,m),f};function B(G,E){this.x=G,this.y=E}B.prototype.makeRBT=function(E){for(var m=new Array(E),f=s.prototype._countBits(E)-1,p=0;p>=1;return p},B.prototype.permute=function(E,m,f,p,v,x){for(var _=0;_>>1)v++;return 1<>>13,f[2*x+1]=v&8191,v=v>>>13;for(x=2*m;x>=26,m+=p/67108864|0,m+=v>>>26,this.words[f]=v&67108863}return m!==0&&(this.words[f]=m,this.length++),this},s.prototype.muln=function(E){return this.clone().imuln(E)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(E){var m=A(E);if(m.length===0)return new s(1);for(var f=this,p=0;p=0);var m=E%26,f=(E-m)/26,p=67108863>>>26-m<<26-m,v;if(m!==0){var x=0;for(v=0;v>>26-m}x&&(this.words[v]=x,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var p;m?p=(m-m%26)/26:p=0;var v=E%26,x=Math.min((E-v)/26,this.length),_=67108863^67108863>>>v<x)for(this.length-=x,b=0;b=0&&(M!==0||b>=p);b--){var I=this.words[b]|0;this.words[b]=M<<26-v|I>>>v,M=I&_}return S&&M!==0&&(S.words[S.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(E,m,f){return n(this.negative===0),this.iushrn(E,m,f)},s.prototype.shln=function(E){return this.clone().ishln(E)},s.prototype.ushln=function(E){return this.clone().iushln(E)},s.prototype.shrn=function(E){return this.clone().ishrn(E)},s.prototype.ushrn=function(E){return this.clone().iushrn(E)},s.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var m=E%26,f=(E-m)/26,p=1<=0);var m=E%26,f=(E-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(m!==0&&f++,this.length=Math.min(f,this.length),m!==0){var p=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(S/67108864|0),this.words[v+f]=x&67108863}for(;v>26,this.words[v+f]=x&67108863;if(_===0)return this.strip();for(n(_===-1),_=0,v=0;v>26,this.words[v]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(E,m){var f=this.length-E.length,p=this.clone(),v=E,x=v.words[v.length-1]|0,_=this._countBits(x);f=26-_,f!==0&&(v=v.ushln(f),p.iushln(f),x=v.words[v.length-1]|0);var S=p.length-v.length,b;if(m!=="mod"){b=new s(null),b.length=S+1,b.words=new Array(b.length);for(var M=0;M=0;F--){var ae=(p.words[v.length+F]|0)*67108864+(p.words[v.length+F-1]|0);for(ae=Math.min(ae/x|0,67108863),p._ishlnsubmul(v,ae,F);p.negative!==0;)ae--,p.negative=0,p._ishlnsubmul(v,1,F),p.isZero()||(p.negative^=1);b&&(b.words[F]=ae)}return b&&b.strip(),p.strip(),m!=="div"&&f!==0&&p.iushrn(f),{div:b||null,mod:p}},s.prototype.divmod=function(E,m,f){if(n(!E.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var p,v,x;return this.negative!==0&&E.negative===0?(x=this.neg().divmod(E,m),m!=="mod"&&(p=x.div.neg()),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.iadd(E)),{div:p,mod:v}):this.negative===0&&E.negative!==0?(x=this.divmod(E.neg(),m),m!=="mod"&&(p=x.div.neg()),{div:p,mod:x.mod}):this.negative&E.negative?(x=this.neg().divmod(E.neg(),m),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.isub(E)),{div:x.div,mod:v}):E.length>this.length||this.cmp(E)<0?{div:new s(0),mod:this}:E.length===1?m==="div"?{div:this.divn(E.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new s(this.modn(E.words[0]))}:this._wordDiv(E,m)},s.prototype.div=function(E){return this.divmod(E,"div",!1).div},s.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},s.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},s.prototype.divRound=function(E){var m=this.divmod(E);if(m.mod.isZero())return m.div;var f=m.div.negative!==0?m.mod.isub(E):m.mod,p=E.ushrn(1),v=E.andln(1),x=f.cmp(p);return x<0||v===1&&x===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(E){n(E<=67108863);for(var m=(1<<26)%E,f=0,p=this.length-1;p>=0;p--)f=(m*f+(this.words[p]|0))%E;return f},s.prototype.idivn=function(E){n(E<=67108863);for(var m=0,f=this.length-1;f>=0;f--){var p=(this.words[f]|0)+m*67108864;this.words[f]=p/E|0,m=p%E}return this.strip()},s.prototype.divn=function(E){return this.clone().idivn(E)},s.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var p=new s(1),v=new s(0),x=new s(0),_=new s(1),S=0;m.isEven()&&f.isEven();)m.iushrn(1),f.iushrn(1),++S;for(var b=f.clone(),M=m.clone();!m.isZero();){for(var I=0,F=1;!(m.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(m.iushrn(I);I-- >0;)(p.isOdd()||v.isOdd())&&(p.iadd(b),v.isub(M)),p.iushrn(1),v.iushrn(1);for(var ae=0,O=1;!(f.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(f.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(b),_.isub(M)),x.iushrn(1),_.iushrn(1);m.cmp(f)>=0?(m.isub(f),p.isub(x),v.isub(_)):(f.isub(m),x.isub(p),_.isub(v))}return{a:x,b:_,gcd:f.iushln(S)}},s.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var p=new s(1),v=new s(0),x=f.clone();m.cmpn(1)>0&&f.cmpn(1)>0;){for(var _=0,S=1;!(m.words[0]&S)&&_<26;++_,S<<=1);if(_>0)for(m.iushrn(_);_-- >0;)p.isOdd()&&p.iadd(x),p.iushrn(1);for(var b=0,M=1;!(f.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(f.iushrn(b);b-- >0;)v.isOdd()&&v.iadd(x),v.iushrn(1);m.cmp(f)>=0?(m.isub(f),p.isub(v)):(f.isub(m),v.isub(p))}var I;return m.cmpn(1)===0?I=p:I=v,I.cmpn(0)<0&&I.iadd(E),I},s.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var m=this.clone(),f=E.clone();m.negative=0,f.negative=0;for(var p=0;m.isEven()&&f.isEven();p++)m.iushrn(1),f.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=m.cmp(f);if(v<0){var x=m;m=f,f=x}else if(v===0||f.cmpn(1)===0)break;m.isub(f)}while(!0);return f.iushln(p)},s.prototype.invm=function(E){return this.egcd(E).a.umod(E)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(E){return this.words[0]&E},s.prototype.bincn=function(E){n(typeof E=="number");var m=E%26,f=(E-m)/26,p=1<>>26,_&=67108863,this.words[x]=_}return v!==0&&(this.words[x]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(E){var m=E<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var f;if(this.length>1)f=1;else{m&&(E=-E),n(E<=67108863,"Number is too big");var p=this.words[0]|0;f=p===E?0:pE.length)return 1;if(this.length=0;f--){var p=this.words[f]|0,v=E.words[f]|0;if(p!==v){pv&&(m=1);break}}return m},s.prototype.gtn=function(E){return this.cmpn(E)===1},s.prototype.gt=function(E){return this.cmp(E)===1},s.prototype.gten=function(E){return this.cmpn(E)>=0},s.prototype.gte=function(E){return this.cmp(E)>=0},s.prototype.ltn=function(E){return this.cmpn(E)===-1},s.prototype.lt=function(E){return this.cmp(E)===-1},s.prototype.lten=function(E){return this.cmpn(E)<=0},s.prototype.lte=function(E){return this.cmp(E)<=0},s.prototype.eqn=function(E){return this.cmpn(E)===0},s.prototype.eq=function(E){return this.cmp(E)===0},s.red=function(E){return new ue(E)},s.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(E){return this.red=E,this},s.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},s.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},s.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},s.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},s.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},s.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},s.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},s.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var j={k256:null,p224:null,p192:null,p25519:null};function U(G,E){this.name=G,this.p=new s(E,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var E=new s(null);return E.words=new Array(Math.ceil(this.n/13)),E},U.prototype.ireduce=function(E){var m=E,f;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),f=m.bitLength();while(f>this.n);var p=f0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},U.prototype.split=function(E,m){E.iushrn(this.n,0,m)},U.prototype.imulK=function(E){return E.imul(this.k)};function K(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(K,U),K.prototype.split=function(E,m){for(var f=4194303,p=Math.min(E.length,9),v=0;v>>22,x=_}x>>>=22,E.words[v-10]=x,x===0&&E.length>10?E.length-=10:E.length-=9},K.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var m=0,f=0;f>>=26,E.words[f]=v,m=p}return m!==0&&(E.words[E.length++]=m),E},s._prime=function(E){if(j[E])return j[E];var m;if(E==="k256")m=new K;else if(E==="p224")m=new J;else if(E==="p192")m=new T;else if(E==="p25519")m=new z;else throw new Error("Unknown prime "+E);return j[E]=m,m};function ue(G){if(typeof G=="string"){var E=s._prime(G);this.m=E.p,this.prime=E}else n(G.gtn(1),"modulus must be greater than 1"),this.m=G,this.prime=null}ue.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},ue.prototype._verify2=function(E,m){n((E.negative|m.negative)===0,"red works only with positives"),n(E.red&&E.red===m.red,"red works only with red numbers")},ue.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},ue.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},ue.prototype.add=function(E,m){this._verify2(E,m);var f=E.add(m);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},ue.prototype.iadd=function(E,m){this._verify2(E,m);var f=E.iadd(m);return f.cmp(this.m)>=0&&f.isub(this.m),f},ue.prototype.sub=function(E,m){this._verify2(E,m);var f=E.sub(m);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},ue.prototype.isub=function(E,m){this._verify2(E,m);var f=E.isub(m);return f.cmpn(0)<0&&f.iadd(this.m),f},ue.prototype.shl=function(E,m){return this._verify1(E),this.imod(E.ushln(m))},ue.prototype.imul=function(E,m){return this._verify2(E,m),this.imod(E.imul(m))},ue.prototype.mul=function(E,m){return this._verify2(E,m),this.imod(E.mul(m))},ue.prototype.isqr=function(E){return this.imul(E,E.clone())},ue.prototype.sqr=function(E){return this.mul(E,E)},ue.prototype.sqrt=function(E){if(E.isZero())return E.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(E,f)}for(var p=this.m.subn(1),v=0;!p.isZero()&&p.andln(1)===0;)v++,p.iushrn(1);n(!p.isZero());var x=new s(1).toRed(this),_=x.redNeg(),S=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new s(2*b*b).toRed(this);this.pow(b,S).cmp(_)!==0;)b.redIAdd(_);for(var M=this.pow(b,p),I=this.pow(E,p.addn(1).iushrn(1)),F=this.pow(E,p),ae=v;F.cmp(x)!==0;){for(var O=F,se=0;O.cmp(x)!==0;se++)O=O.redSqr();n(se=0;v--){for(var M=m.words[v],I=b-1;I>=0;I--){var F=M>>I&1;if(x!==p[0]&&(x=this.sqr(x)),F===0&&_===0){S=0;continue}_<<=1,_|=F,S++,!(S!==f&&(v!==0||I!==0))&&(x=this.mul(x,p[_]),S=0,_=0)}b=26}return x},ue.prototype.convertTo=function(E){var m=E.umod(this.m);return m===E?m.clone():m},ue.prototype.convertFrom=function(E){var m=E.clone();return m.red=null,m},s.mont=function(E){return new _e(E)};function _e(G){ue.call(this,G),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(_e,ue),_e.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},_e.prototype.convertFrom=function(E){var m=this.imod(E.mul(this.rinv));return m.red=null,m},_e.prototype.imul=function(E,m){if(E.isZero()||m.isZero())return E.words[0]=0,E.length=1,E;var f=E.imul(m),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.mul=function(E,m){if(E.isZero()||m.isZero())return new s(0)._forceRed(this);var f=E.mul(m),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.invm=function(E){var m=this.imod(E._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,nn)}(Wm);var xo=Wm.exports,Km={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var u=0;u>8,g=l&255;d?a.push(d,g):a.push(g)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(N>>1)-1?k=(N>>1)-B:k=B,D.isubn(k)):k=0,A[P]=k,D.iushrn(1)}return A}e.getNAF=s;function o(d,g){var y=[[],[]];d=d.clone(),g=g.clone();for(var A=0,P=0,N;d.cmpn(-A)>0||g.cmpn(-P)>0;){var D=d.andln(3)+A&3,k=g.andln(3)+P&3;D===3&&(D=-1),k===3&&(k=-1);var B;D&1?(N=d.andln(7)+A&7,(N===3||N===5)&&k===2?B=-D:B=D):B=0,y[0].push(B);var j;k&1?(N=g.andln(7)+P&7,(N===3||N===5)&&D===2?j=-k:j=k):j=0,y[1].push(j),2*A===B+1&&(A=1-A),2*P===j+1&&(P=1-P),d.iushrn(1),g.iushrn(1)}return y}e.getJSF=o;function a(d,g,y){var A="_"+g;d.prototype[g]=function(){return this[A]!==void 0?this[A]:this[A]=y.call(this)}}e.cachedProperty=a;function u(d){return typeof d=="string"?e.toArray(d,"hex"):d}e.parseBytes=u;function l(d){return new r(d,"hex","le")}e.intFromLE=l}(Ti);var Vm={exports:{}},Gm;Vm.exports=function(e){return Gm||(Gm=new aa(null)),Gm.generate(e)};function aa(t){this.rand=t}if(Vm.exports.Rand=aa,aa.prototype.generate=function(e){return this._rand(e)},aa.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Rd=ca;ca.prototype.point=function(){throw new Error("Not implemented")},ca.prototype.validate=function(){throw new Error("Not implemented")},ca.prototype._fixedNafMul=function(e,r){Td(e.precomputed);var n=e._getDoubles(),i=Cd(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),g=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Td(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},ca.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,g,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=Cd(n[P],o[P],this._bitLength),u[N]=Cd(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=Nk(n[P],n[N]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[N]=new Array(l),g=0;g=0;d--){for(var T=0;d>=0;){var z=!0;for(g=0;g=0&&T++,K=K.dblp(T),d<0)break;for(g=0;g0?y=a[g][ue-1>>1]:ue<0&&(y=a[g][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Ki.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),g.negative&&(g=g.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:g,b:y},{a:A,b:P}]},Vi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),g=e.sub(a).sub(u),y=l.add(d).neg();return{k1:g,k2:y}},Vi.prototype.pointFromX=function(e,r){e=new en(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Vi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Vi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},On.prototype.isInfinity=function(){return this.inf},On.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},On.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},On.prototype.getX=function(){return this.x.fromRed()},On.prototype.getY=function(){return this.y.fromRed()},On.prototype.mul=function(e){return e=new en(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},On.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},On.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},On.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},On.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},On.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function qn(t,e,r,n){bu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new en(0)):(this.x=new en(e,16),this.y=new en(r,16),this.z=new en(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Jm(qn,bu.BasePoint),Vi.prototype.jpoint=function(e,r,n){return new qn(this,e,r,n)},qn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},qn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},qn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),g=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(g).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(g)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},qn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),g=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(g).redISub(g),A=u.redMul(g.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},qn.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},qn.prototype.inspect=function(){return this.isInfinity()?"":""},qn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var yu=xo,I3=yd,Dd=Rd,$k=Ti;function wu(t){Dd.call(this,"mont",t),this.a=new yu(t.a,16).toRed(this.red),this.b=new yu(t.b,16).toRed(this.red),this.i4=new yu(4).toRed(this.red).redInvm(),this.two=new yu(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}I3(wu,Dd);var Fk=wu;wu.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function Nn(t,e,r){Dd.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new yu(e,16),this.z=new yu(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}I3(Nn,Dd.BasePoint),wu.prototype.decodePoint=function(e,r){return this.point($k.toArray(e,r),1)},wu.prototype.point=function(e,r){return new Nn(this,e,r)},wu.prototype.pointFromJSON=function(e){return Nn.fromJSON(this,e)},Nn.prototype.precompute=function(){},Nn.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Nn.fromJSON=function(e,r){return new Nn(e,r[0],r[1]||e.one)},Nn.prototype.inspect=function(){return this.isInfinity()?"":""},Nn.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Nn.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)},Nn.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),u=s.redMul(i),l=r.z.redMul(a.redAdd(u).redSqr()),d=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(l,d)},Nn.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i},Nn.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Nn.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Nn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var jk=Ti,_o=xo,C3=yd,Od=Rd,Uk=jk.assert;function zs(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Od.call(this,"edwards",t),this.a=new _o(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new _o(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new _o(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Uk(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}C3(zs,Od);var qk=zs;zs.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},zs.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},zs.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)},zs.prototype.pointFromX=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var u=a.fromRed().isOdd();return(r&&!u||!r&&u)&&(a=a.redNeg()),this.point(e,a)},zs.prototype.pointFromY=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)},zs.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function Hr(t,e,r,n,i){Od.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new _o(e,16),this.y=new _o(r,16),this.z=n?new _o(n,16):this.curve.one,this.t=i&&new _o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}C3(Hr,Od.BasePoint),zs.prototype.pointFromJSON=function(e){return Hr.fromJSON(this,e)},zs.prototype.point=function(e,r,n,i){return new Hr(this,e,r,n,i)},Hr.fromJSON=function(e,r){return new Hr(e,r[0],r[1],r[2])},Hr.prototype.inspect=function(){return this.isInfinity()?"":""},Hr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Hr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),u=i.redSub(r),l=s.redMul(a),d=o.redMul(u),g=s.redMul(u),y=a.redMul(o);return this.curve.point(l,d,y,g)},Hr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,u,l;if(this.curve.twisted){a=this.curve._mulA(r);var d=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(d.redSub(this.curve.two)),s=d.redMul(a.redSub(n)),o=d.redSqr().redSub(d).redSub(d)):(u=this.z.redSqr(),l=d.redSub(u).redISub(u),i=e.redSub(r).redISub(n).redMul(l),s=d.redMul(a.redSub(n)),o=d.redMul(l))}else a=r.redAdd(n),u=this.curve._mulC(this.z).redSqr(),l=a.redSub(u).redSub(u),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)},Hr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Hr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),u=s.redAdd(i),l=n.redAdd(r),d=o.redMul(a),g=u.redMul(l),y=o.redMul(l),A=a.redMul(u);return this.curve.point(d,g,A,y)},Hr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),u=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),d=r.redMul(a).redMul(l),g,y;return this.curve.twisted?(g=r.redMul(u).redMul(s.redSub(this.curve._mulA(i))),y=a.redMul(u)):(g=r.redMul(u).redMul(s.redSub(i)),y=this.curve._mulC(a).redMul(u)),this.curve.point(d,g,y)},Hr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Hr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Hr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)},Hr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)},Hr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Hr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Hr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Hr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Hr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Hr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Hr.prototype.toP=Hr.prototype.normalize,Hr.prototype.mixedAdd=Hr.prototype.add,function(t){var e=t;e.base=Rd,e.short=Bk,e.mont=Fk,e.edwards=qk}(Ym);var Nd={},Xm,T3;function zk(){return T3||(T3=1,Xm={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Xm}(function(t){var e=t,r=al,n=Ym,i=Ti,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,d){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var g=new o(d);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:g}),g}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=zk()}catch{u=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})})(Nd);var Hk=al,Za=Km,R3=Ga;function ua(t){if(!(this instanceof ua))return new ua(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Za.toArray(t.entropy,t.entropyEnc||"hex"),r=Za.toArray(t.nonce,t.nonceEnc||"hex"),n=Za.toArray(t.pers,t.persEnc||"hex");R3(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Wk=ua;ua.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ua.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Za.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var Ld=xo,Qm=Ti,Yk=Qm.assert;function kd(t,e){if(t instanceof kd)return t;this._importDER(t,e)||(Yk(t.r&&t.s,"Signature without r or s"),this.r=new Ld(t.r,16),this.s=new Ld(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Jk=kd;function Xk(){this.place=0}function e1(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function D3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}kd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=D3(r),n=D3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];t1(i,r.length),i=i.concat(r),i.push(2),t1(i,n.length);var s=i.concat(n),o=[48];return t1(o,s.length),o=o.concat(s),Qm.encode(o,e)};var Eo=xo,O3=Wk,Zk=Ti,r1=Nd,Qk=M3,N3=Zk.assert,n1=Gk,Bd=Jk;function Gi(t){if(!(this instanceof Gi))return new Gi(t);typeof t=="string"&&(N3(Object.prototype.hasOwnProperty.call(r1,t),"Unknown curve "+t),t=r1[t]),t instanceof r1.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var eB=Gi;Gi.prototype.keyPair=function(e){return new n1(this,e)},Gi.prototype.keyFromPrivate=function(e,r){return n1.fromPrivate(this,e,r)},Gi.prototype.keyFromPublic=function(e,r){return n1.fromPublic(this,e,r)},Gi.prototype.genKeyPair=function(e){e||(e={});for(var r=new O3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Qk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new Eo(2));;){var s=new Eo(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Gi.prototype._truncateToN=function(e,r,n){var i;if(Eo.isBN(e)||typeof e=="number")e=new Eo(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new Eo(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new Eo(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Gi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new O3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new Eo(1)),d=0;;d++){var g=i.k?i.k(d):new Eo(u.generate(this.n.byteLength()));if(g=this._truncateToN(g,!0),!(g.cmpn(1)<=0||g.cmp(l)>=0)){var y=this.g.mul(g);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=g.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new Bd({r:P,s:N,recoveryParam:D})}}}}}},Gi.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new Bd(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),l=u.mul(e).umod(this.n),d=u.mul(o).umod(this.n),g;return this.curve._maxwellTrick?(g=this.g.jmulAdd(l,n.getPublic(),d),g.isInfinity()?!1:g.eqXToP(o)):(g=this.g.mulAdd(l,n.getPublic(),d),g.isInfinity()?!1:g.getX().umod(this.n).cmp(o)===0)},Gi.prototype.recoverPubKey=function(t,e,r,n){N3((3&r)===r,"The recovery param is more than two bits"),e=new Bd(e,n);var i=this.n,s=new Eo(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),g=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(g,o,y)},Gi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Bd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dl=Ti,L3=dl.assert,k3=dl.parseBytes,xu=dl.cachedProperty;function Ln(t,e){this.eddsa=t,this._secret=k3(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=k3(e.pub)}Ln.fromPublic=function(e,r){return r instanceof Ln?r:new Ln(e,{pub:r})},Ln.fromSecret=function(e,r){return r instanceof Ln?r:new Ln(e,{secret:r})},Ln.prototype.secret=function(){return this._secret},xu(Ln,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),xu(Ln,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),xu(Ln,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i}),xu(Ln,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),xu(Ln,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),xu(Ln,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Ln.prototype.sign=function(e){return L3(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Ln.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},Ln.prototype.getSecret=function(e){return L3(this._secret,"KeyPair is public only"),dl.encode(this.secret(),e)},Ln.prototype.getPublic=function(e){return dl.encode(this.pubBytes(),e)};var tB=Ln,rB=xo,$d=Ti,B3=$d.assert,Fd=$d.cachedProperty,nB=$d.parseBytes;function Qa(t,e){this.eddsa=t,typeof e!="object"&&(e=nB(e)),Array.isArray(e)&&(B3(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),B3(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof rB&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Fd(Qa,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Fd(Qa,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Fd(Qa,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Fd(Qa,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Qa.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Qa.prototype.toHex=function(){return $d.encode(this.toBytes(),"hex").toUpperCase()};var iB=Qa,sB=al,oB=Nd,_u=Ti,aB=_u.assert,$3=_u.parseBytes,F3=tB,j3=iB;function vi(t){if(aB(t==="ed25519","only tested with ed25519 so far"),!(this instanceof vi))return new vi(t);t=oB[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=sB.sha512}var cB=vi;vi.prototype.sign=function(e,r){e=$3(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),u=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:u,Rencoded:o})},vi.prototype.verify=function(e,r,n){if(e=$3(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)},vi.prototype.hashInt=function(){for(var e=this.hash(),r=0;re in t?lB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,H3=(t,e)=>{for(var r in e||(e={}))hB.call(e,r)&&z3(t,r,e[r]);if(q3)for(var r of q3(e))dB.call(e,r)&&z3(t,r,e[r]);return t};const pB="ReactNative",Ri={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},gB="js";function jd(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Su(){return!nl()&&!!mm()&&navigator.product===pB}function pl(){return!jd()&&!!mm()&&!!nl()}function gl(){return Su()?Ri.reactNative:jd()?Ri.node:pl()?Ri.browser:Ri.unknown}function mB(){var t;try{return Su()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function vB(t,e){let r=il.parse(t);return r=H3(H3({},r),e),t=il.stringify(r),t}function W3(){return Ax()||{name:"",description:"",url:"",icons:[""]}}function bB(){if(gl()===Ri.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=HO();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function yB(){var t;const e=gl();return e===Ri.browser?[e,((t=Sx())==null?void 0:t.host)||"unknown"].join(":"):e}function K3(t,e,r){const n=bB(),i=yB();return[[t,e].join("-"),[gB,r].join("-"),n,i].join("/")}function wB({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const u=r.split("?"),l=K3(t,e,n),d={auth:i,ua:l,projectId:s,useOnCloseEvent:o,origin:a||void 0},g=vB(u[1]||"",d);return u[0]+"?"+g}function ec(t,e){return t.filter(r=>e.includes(r)).length===t.length}function V3(t){return Object.fromEntries(t.entries())}function G3(t){return new Map(Object.entries(t))}function tc(t=mt.FIVE_MINUTES,e){const r=mt.toMiliseconds(t||mt.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Au(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function Y3(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function xB(t){return Y3("topic",t)}function _B(t){return Y3("id",t)}function J3(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function En(t,e){return mt.fromMiliseconds(Date.now()+mt.toMiliseconds(t))}function fa(t){return Date.now()>=mt.toMiliseconds(t)}function vr(t,e){return`${t}${e?`:${e}`:""}`}function Ud(t=[],e=[]){return[...new Set([...t,...e])]}async function EB({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=SB(s,t,e),a=gl();if(a===Ri.browser){if(!((n=nl())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,PB()?"_blank":"_self","noreferrer noopener")}else a===Ri.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function SB(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${MB(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function AB(t,e){let r="";try{if(pl()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function X3(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function Z3(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function i1(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function PB(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function MB(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function Q3(t){return Buffer.from(t,"base64").toString("utf-8")}const IB="https://rpc.walletconnect.org/v1";async function CB(t,e,r,n,i,s){switch(r.t){case"eip191":return TB(t,e,r.s);case"eip1271":return await RB(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function TB(t,e,r){return yk(Ux(e),r).toLowerCase()===t.toLowerCase()}async function RB(t,e,r,n,i,s){const o=Eu(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",d=r.substring(2),g=Ux(e).substring(2),y=a+g+u+l+d,A=await fetch(`${s||IB}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:DB(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:y},"latest"]})}),{result:P}=await A.json();return P?P.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function DB(){return Date.now()+Math.floor(Math.random()*1e3)}var OB=Object.defineProperty,NB=Object.defineProperties,LB=Object.getOwnPropertyDescriptors,e_=Object.getOwnPropertySymbols,kB=Object.prototype.hasOwnProperty,BB=Object.prototype.propertyIsEnumerable,t_=(t,e,r)=>e in t?OB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$B=(t,e)=>{for(var r in e||(e={}))kB.call(e,r)&&t_(t,r,e[r]);if(e_)for(var r of e_(e))BB.call(e,r)&&t_(t,r,e[r]);return t},FB=(t,e)=>NB(t,LB(e));const jB="did:pkh:",s1=t=>t==null?void 0:t.split(":"),UB=t=>{const e=t&&s1(t);if(e)return t.includes(jB)?e[3]:e[1]},o1=t=>{const e=t&&s1(t);if(e)return e[2]+":"+e[3]},qd=t=>{const e=t&&s1(t);if(e)return e.pop()};async function r_(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=n_(i,i.iss),o=qd(i.iss);return await CB(o,s,n,o1(i.iss),r)}const n_=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=qd(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${UB(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,d=t.exp?`Expiration Time: ${t.exp}`:void 0,g=t.nbf?`Not Before: ${t.nbf}`:void 0,y=t.requestId?`Request ID: ${t.requestId}`:void 0,A=t.resources?`Resources:${t.resources.map(N=>` +- ${N}`).join("")}`:void 0,P=zd(t.resources);if(P){const N=ml(P);i=JB(i,N)}return[r,n,"",i,"",s,o,a,u,l,d,g,y,A].filter(N=>N!=null).join(` +`)};function qB(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function zB(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function rc(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function HB(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:WB(e,r,n)}}}function WB(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function i_(t){return rc(t),`urn:recap:${qB(t).replace(/=/g,"")}`}function ml(t){const e=zB(t.replace("urn:recap:",""));return rc(e),e}function KB(t,e,r){const n=HB(t,e,r);return i_(n)}function VB(t){return t&&t.includes("urn:recap:")}function GB(t,e){const r=ml(t),n=ml(e),i=YB(r,n);return i_(i)}function YB(t,e){rc(t),rc(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,u)=>a.localeCompare(u)).forEach(a=>{var u,l;n.att[i]=FB($B({},n.att[i]),{[a]:((u=t.att[i])==null?void 0:u[a])||((l=e.att[i])==null?void 0:l[a])})})}),n}function JB(t="",e){rc(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const u=Object.keys(e.att[a]).map(g=>({ability:g.split("/")[0],action:g.split("/")[1]}));u.sort((g,y)=>g.action.localeCompare(y.action));const l={};u.forEach(g=>{l[g.ability]||(l[g.ability]=[]),l[g.ability].push(g.action)});const d=Object.keys(l).map(g=>(i++,`(${i}) '${g}': '${l[g].join("', '")}' for '${a}'.`));n.push(d.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function s_(t){var e;const r=ml(t);rc(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function o_(t){const e=ml(t);rc(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function zd(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return VB(e)?e:void 0}const a_="base10",ni="base16",la="base64pad",vl="base64url",bl="utf8",c_=0,So=1,yl=2,XB=0,u_=1,wl=12,a1=32;function ZB(){const t=Hm.generateKeyPair();return{privateKey:Tn(t.secretKey,ni),publicKey:Tn(t.publicKey,ni)}}function c1(){const t=ta.randomBytes(a1);return Tn(t,ni)}function QB(t,e){const r=Hm.sharedKey(Rn(t,ni),Rn(e,ni),!0),n=new Dk(ll.SHA256,r).expand(a1);return Tn(n,ni)}function Hd(t){const e=ll.hash(Rn(t,ni));return Tn(e,ni)}function Ao(t){const e=ll.hash(Rn(t,bl));return Tn(e,ni)}function f_(t){return Rn(`${t}`,a_)}function nc(t){return Number(Tn(t,a_))}function e$(t){const e=f_(typeof t.type<"u"?t.type:c_);if(nc(e)===So&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Rn(t.senderPublicKey,ni):void 0,n=typeof t.iv<"u"?Rn(t.iv,ni):ta.randomBytes(wl),i=new Um.ChaCha20Poly1305(Rn(t.symKey,ni)).seal(n,Rn(t.message,bl));return l_({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function t$(t,e){const r=f_(yl),n=ta.randomBytes(wl),i=Rn(t,bl);return l_({type:r,sealed:i,iv:n,encoding:e})}function r$(t){const e=new Um.ChaCha20Poly1305(Rn(t.symKey,ni)),{sealed:r,iv:n}=xl({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Tn(i,bl)}function n$(t,e){const{sealed:r}=xl({encoded:t,encoding:e});return Tn(r,bl)}function l_(t){const{encoding:e=la}=t;if(nc(t.type)===yl)return Tn(pd([t.type,t.sealed]),e);if(nc(t.type)===So){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Tn(pd([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return Tn(pd([t.type,t.iv,t.sealed]),e)}function xl(t){const{encoded:e,encoding:r=la}=t,n=Rn(e,r),i=n.slice(XB,u_),s=u_;if(nc(i)===So){const l=s+a1,d=l+wl,g=n.slice(s,l),y=n.slice(l,d),A=n.slice(d);return{type:i,sealed:A,iv:y,senderPublicKey:g}}if(nc(i)===yl){const l=n.slice(s),d=ta.randomBytes(wl);return{type:i,sealed:l,iv:d}}const o=s+wl,a=n.slice(s,o),u=n.slice(o);return{type:i,sealed:u,iv:a}}function i$(t,e){const r=xl({encoded:t,encoding:e==null?void 0:e.encoding});return h_({type:nc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Tn(r.senderPublicKey,ni):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function h_(t){const e=(t==null?void 0:t.type)||c_;if(e===So){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function d_(t){return t.type===So&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function p_(t){return t.type===yl}function s$(t){return new A3.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function o$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function a$(t){return Buffer.from(o$(t),"base64")}function c$(t,e){const[r,n,i]=t.split("."),s=a$(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),u=`${r}.${n}`,l=new ll.SHA256().update(Buffer.from(u)).digest(),d=s$(e),g=Buffer.from(l).toString("hex");if(!d.verify(g,{r:o,s:a}))throw new Error("Invalid signature");return gm(t).payload}const u$="irn";function u1(t){return(t==null?void 0:t.relay)||{protocol:u$}}function _l(t){const e=uB[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var f$=Object.defineProperty,l$=Object.defineProperties,h$=Object.getOwnPropertyDescriptors,g_=Object.getOwnPropertySymbols,d$=Object.prototype.hasOwnProperty,p$=Object.prototype.propertyIsEnumerable,m_=(t,e,r)=>e in t?f$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v_=(t,e)=>{for(var r in e||(e={}))d$.call(e,r)&&m_(t,r,e[r]);if(g_)for(var r of g_(e))p$.call(e,r)&&m_(t,r,e[r]);return t},g$=(t,e)=>l$(t,h$(e));function m$(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function b_(t){if(!t.includes("wc:")){const u=Q3(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=il.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:v$(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:m$(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function v$(t){return t.startsWith("//")?t.substring(2):t}function b$(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function y_(t){return`${t.protocol}:${t.topic}@${t.version}?`+il.stringify(v_(g$(v_({symKey:t.symKey},b$(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Wd(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Pu(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function y$(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Pu(r.accounts))}),e}function w$(t,e){const r=[];return Object.values(t).forEach(n=>{Pu(n.accounts).includes(e)&&r.push(...n.methods)}),r}function x$(t,e){const r=[];return Object.values(t).forEach(n=>{Pu(n.accounts).includes(e)&&r.push(...n.events)}),r}function f1(t){return t.includes(":")}function El(t){return f1(t)?t.split(":")[0]:t}function _$(t){const e={};return t==null||t.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function w_(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=_$(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=Ud(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const E$={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},S$={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ut(t,e){const{message:r,code:n}=S$[t];return{message:e?`${r} ${e}`:r,code:n}}function Dr(t,e){const{message:r,code:n}=E$[t];return{message:e?`${r} ${e}`:r,code:n}}function ic(t,e){return!!Array.isArray(t)}function Sl(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function bi(t){return typeof t>"u"}function an(t,e){return e&&bi(t)?!0:typeof t=="string"&&!!t.trim().length}function l1(t,e){return typeof t=="number"&&!isNaN(t)}function A$(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return ec(i,n)?(n.forEach(o=>{const{accounts:a,methods:u,events:l}=t.namespaces[o],d=Pu(a),g=r[o];(!ec(U3(o,g),d)||!ec(g.methods,u)||!ec(g.events,l))&&(s=!1)}),s):!1}function Kd(t){return an(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function P$(t){if(an(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Kd(r)}}return!1}function M$(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(an(t,!1)){if(e(t))return!0;const r=Q3(t);return e(r)}}catch{}return!1}function I$(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function C$(t){return t==null?void 0:t.topic}function T$(t,e){let r=null;return an(t==null?void 0:t.publicKey,!1)||(r=ut("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function x_(t){let e=!0;return ic(t)?t.length&&(e=t.every(r=>an(r,!1))):e=!1,e}function R$(t,e,r){let n=null;return ic(e)&&e.length?e.forEach(i=>{n||Kd(i)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Kd(t)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function D$(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=R$(i,U3(i,s),`${e} ${r}`);o&&(n=o)}),n}function O$(t,e){let r=null;return ic(t)?t.forEach(n=>{r||P$(n)||(r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function N$(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=O$(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function L$(t,e){let r=null;return x_(t==null?void 0:t.methods)?x_(t==null?void 0:t.events)||(r=Dr("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Dr("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function __(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=L$(n,`${e}, namespace`);i&&(r=i)}),r}function k$(t,e,r){let n=null;if(t&&Sl(t)){const i=__(t,e);i&&(n=i);const s=D$(t,e,r);s&&(n=s)}else n=ut("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function h1(t,e){let r=null;if(t&&Sl(t)){const n=__(t,e);n&&(r=n);const i=N$(t,e);i&&(r=i)}else r=ut("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function E_(t){return an(t.protocol,!0)}function B$(t,e){let r=!1;return t?t&&ic(t)&&t.length&&t.forEach(n=>{r=E_(n)}):r=!0,r}function $$(t){return typeof t=="number"}function yi(t){return typeof t<"u"&&typeof t!==null}function F$(t){return!(!t||typeof t!="object"||!t.code||!l1(t.code)||!t.message||!an(t.message,!1))}function j$(t){return!(bi(t)||!an(t.method,!1))}function U$(t){return!(bi(t)||bi(t.result)&&bi(t.error)||!l1(t.id)||!an(t.jsonrpc,!1))}function q$(t){return!(bi(t)||!an(t.name,!1))}function S_(t,e){return!(!Kd(e)||!y$(t).includes(e))}function z$(t,e,r){return an(r,!1)?w$(t,e).includes(r):!1}function H$(t,e,r){return an(r,!1)?x$(t,e).includes(r):!1}function A_(t,e,r){let n=null;const i=W$(t),s=K$(e),o=Object.keys(i),a=Object.keys(s),u=P_(Object.keys(t)),l=P_(Object.keys(e)),d=u.filter(g=>!l.includes(g));return d.length&&(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${d.toString()} - Received: ${Object.keys(e).toString()}`)),rc(o,a)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. + Received: ${Object.keys(e).toString()}`)),ec(o,a)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} Approved: ${a.toString()}`)),Object.keys(e).forEach(g=>{if(!g.includes(":")||n)return;const y=Pu(e[g].accounts);y.includes(g)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${g} Required: ${g} - Approved: ${y.toString()}`))}),o.forEach(g=>{n||(rc(i[g].methods,s[g].methods)?rc(i[g].events,s[g].events)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${g}`)):n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${g}`))}),n}function H$(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function I_(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function W$(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Pu(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function K$(t,e){return l1(t)&&t<=e.max&&t>=e.min}function C_(){const t=gl();return new Promise(e=>{switch(t){case Ri.browser:e(V$());break;case Ri.reactNative:e(G$());break;case Ri.node:e(Y$());break;default:e(!0)}})}function V$(){return pl()&&(navigator==null?void 0:navigator.onLine)}async function G$(){if(Su()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function Y$(){return!0}function J$(t){switch(gl()){case Ri.browser:X$(t);break;case Ri.reactNative:Z$(t);break}}function X$(t){!Su()&&pl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function Z$(t){Su()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const d1={};class Al{static get(e){return d1[e]}static set(e,r){d1[e]=r}static delete(e){delete d1[e]}}const Q$="PARSE_ERROR",eF="INVALID_REQUEST",tF="METHOD_NOT_FOUND",rF="INVALID_PARAMS",T_="INTERNAL_ERROR",p1="SERVER_ERROR",nF=[-32700,-32600,-32601,-32602,-32603],Pl={[Q$]:{code:-32700,message:"Parse error"},[eF]:{code:-32600,message:"Invalid Request"},[tF]:{code:-32601,message:"Method not found"},[rF]:{code:-32602,message:"Invalid params"},[T_]:{code:-32603,message:"Internal error"},[p1]:{code:-32e3,message:"Server error"}},R_=p1;function iF(t){return nF.includes(t)}function D_(t){return Object.keys(Pl).includes(t)?Pl[t]:Pl[R_]}function sF(t){const e=Object.values(Pl).find(r=>r.code===t);return e||Pl[R_]}function O_(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var N_={},Io={},L_;function oF(){if(L_)return Io;L_=1,Object.defineProperty(Io,"__esModule",{value:!0}),Io.isBrowserCryptoAvailable=Io.getSubtleCrypto=Io.getBrowerCrypto=void 0;function t(){return(nn==null?void 0:nn.crypto)||(nn==null?void 0:nn.msCrypto)||{}}Io.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Io.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Io.isBrowserCryptoAvailable=r,Io}var Co={},k_;function aF(){if(k_)return Co;k_=1,Object.defineProperty(Co,"__esModule",{value:!0}),Co.isBrowser=Co.isNode=Co.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Co.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Co.isNode=e;function r(){return!t()&&!e()}return Co.isBrowser=r,Co}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(oF(),t),e.__exportStar(aF(),t)})(N_);function pa(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function ac(t=6){return BigInt(pa(t))}function ga(t,e,r){return{id:r||pa(),jsonrpc:"2.0",method:t,params:e}}function Vd(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Gd(t,e,r){return{id:t,jsonrpc:"2.0",error:cF(e)}}function cF(t,e){return typeof t>"u"?D_(T_):(typeof t=="string"&&(t=Object.assign(Object.assign({},D_(p1)),{message:t})),iF(t.code)&&(t=sF(t.code)),t)}let uF=class{},fF=class extends uF{constructor(){super()}},lF=class extends fF{constructor(e){super()}};const hF="^https?:",dF="^wss?:";function pF(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function B_(t,e){const r=pF(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function $_(t){return B_(t,hF)}function F_(t){return B_(t,dF)}function gF(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function j_(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function g1(t){return j_(t)&&"method"in t}function Yd(t){return j_(t)&&(Hs(t)||Ji(t))}function Hs(t){return"result"in t}function Ji(t){return"error"in t}let Xi=class extends lF{constructor(e){super(e),this.events=new zi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(ga(e.method,e.params||[],e.id||ac().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Ji(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Yd(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const mF=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),vF=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",U_=t=>t.split("?")[0],q_=10,bF=mF();let yF=class{constructor(e){if(this.url=e,this.events=new zi.EventEmitter,this.registering=!1,!F_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(bo(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!F_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=N_.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!gF(e)},o=new bF(e,[],s);vF()?o.onerror=a=>{const u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ga(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return O_(e,U_(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>q_&&this.events.setMaxListeners(q_)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${U_(this.url)}`));return this.events.emit("register_error",r),r}};var Jd={exports:{}};Jd.exports,function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",u="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",g="[object Date]",y="[object Error]",A="[object Function]",P="[object GeneratorFunction]",O="[object Map]",D="[object Number]",k="[object Null]",B="[object Object]",j="[object Promise]",U="[object Proxy]",K="[object RegExp]",J="[object Set]",T="[object String]",z="[object Symbol]",ue="[object Undefined]",_e="[object WeakMap]",G="[object ArrayBuffer]",E="[object DataView]",m="[object Float32Array]",f="[object Float64Array]",p="[object Int8Array]",v="[object Int16Array]",x="[object Int32Array]",_="[object Uint8Array]",S="[object Uint8ClampedArray]",b="[object Uint16Array]",M="[object Uint32Array]",I=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,N={};N[m]=N[f]=N[p]=N[v]=N[x]=N[_]=N[S]=N[b]=N[M]=!0,N[a]=N[u]=N[G]=N[d]=N[E]=N[g]=N[y]=N[A]=N[O]=N[D]=N[B]=N[K]=N[J]=N[T]=N[_e]=!1;var se=typeof nn=="object"&&nn&&nn.Object===Object&&nn,ee=typeof self=="object"&&self&&self.Object===Object&&self,X=se||ee||Function("return this")(),Q=e&&!e.nodeType&&e,R=Q&&!0&&t&&!t.nodeType&&t,Z=R&&R.exports===Q,te=Z&&se.process,he=function(){try{return te&&te.binding&&te.binding("util")}catch{}}(),ie=he&&he.isTypedArray;function fe(ce,ye){for(var Ye=-1,It=ce==null?0:ce.length,jr=0,ir=[];++Ye-1}function st(ce,ye){var Ye=this.__data__,It=Xe(Ye,ce);return It<0?(++this.size,Ye.push([ce,ye])):Ye[It][1]=ye,this}Re.prototype.clear=De,Re.prototype.delete=it,Re.prototype.get=Ue,Re.prototype.has=gt,Re.prototype.set=st;function tt(ce){var ye=-1,Ye=ce==null?0:ce.length;for(this.clear();++yewn))return!1;var Ur=ir.get(ce);if(Ur&&ir.get(ye))return Ur==ye;var gn=-1,_i=!0,xn=Ye&s?new _t:void 0;for(ir.set(ce,ye),ir.set(ye,ce);++gn-1&&ce%1==0&&ce-1&&ce%1==0&&ce<=o}function up(ce){var ye=typeof ce;return ce!=null&&(ye=="object"||ye=="function")}function Pc(ce){return ce!=null&&typeof ce=="object"}var fp=ie?Te(ie):dr;function zb(ce){return Ub(ce)?qe(ce):pr(ce)}function Fr(){return[]}function kr(){return!1}t.exports=qb}(Jd,Jd.exports);var wF=Jd.exports;const xF=Ui(wF),z_="wc",H_=2,W_="core",Ws=`${z_}@2:${W_}:`,_F={logger:"error"},EF={database:":memory:"},SF="crypto",K_="client_ed25519_seed",AF=mt.ONE_DAY,PF="keychain",MF="0.3",IF="messages",CF="0.3",TF=mt.SIX_HOURS,RF="publisher",V_="irn",DF="error",G_="wss://relay.walletconnect.org",OF="relayer",ii={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},NF="_subscription",Zi={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},LF=.1,m1="2.17.2",Wr={link_mode:"link_mode",relay:"relay"},kF="0.3",BF="WALLETCONNECT_CLIENT_ID",Y_="WALLETCONNECT_LINK_MODE_APPS",Ks={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},$F="subscription",FF="0.3",jF=mt.FIVE_SECONDS*1e3,UF="pairing",qF="0.3",Ml={wc_pairingDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:0},res:{ttl:mt.ONE_DAY,prompt:!1,tag:0}}},cc={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},bs={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},zF="history",HF="0.3",WF="expirer",Qi={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},KF="0.3",VF="verify-api",GF="https://verify.walletconnect.com",J_="https://verify.walletconnect.org",Il=J_,YF=`${Il}/v3`,JF=[GF,J_],XF="echo",ZF="https://echo.walletconnect.com",Vs={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},To={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},ys={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},uc={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},fc={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Cl={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},QF=.1,ej="event-client",tj=86400,rj="https://pulse.walletconnect.org/batch";function nj(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(j);k!==B;){for(var K=P[k],J=0,T=j-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=j-D;z!==j&&U[z]===0;)z++;for(var ue=u.repeat(O);z>>0,j=new Uint8Array(B);P[O];){var U=r[P.charCodeAt(O)];if(U===255)return;for(var K=0,J=B-1;(U!==0||K>>0,j[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,O++}if(P[O]!==" "){for(var T=B-k;T!==B&&j[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=j[T++];return z}}}function A(P){var O=y(P);if(O)return O;throw new Error(`Non-${e} character`)}return{encode:g,decodeUnsafe:y,decode:A}}var ij=nj,sj=ij;const X_=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},oj=t=>new TextEncoder().encode(t),aj=t=>new TextDecoder().decode(t);class cj{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class uj{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Z_(this,e)}}class fj{constructor(e){this.decoders=e}or(e){return Z_(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Z_=(t,e)=>new fj({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class lj{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new cj(e,r,n),this.decoder=new uj(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Xd=({name:t,prefix:e,encode:r,decode:n})=>new lj(t,e,r,n),Tl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=sj(r,e);return Xd({prefix:t,name:e,encode:n,decode:s=>X_(i(s))})},hj=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},dj=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Xd({prefix:e,name:t,encode(i){return dj(i,n,r)},decode(i){return hj(i,n,r,t)}}),pj=Xd({prefix:"\0",name:"identity",encode:t=>aj(t),decode:t=>oj(t)});var gj=Object.freeze({__proto__:null,identity:pj});const mj=zn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var vj=Object.freeze({__proto__:null,base2:mj});const bj=zn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var yj=Object.freeze({__proto__:null,base8:bj});const wj=Tl({prefix:"9",name:"base10",alphabet:"0123456789"});var xj=Object.freeze({__proto__:null,base10:wj});const _j=zn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ej=zn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Sj=Object.freeze({__proto__:null,base16:_j,base16upper:Ej});const Aj=zn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Pj=zn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Mj=zn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ij=zn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Cj=zn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Tj=zn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Rj=zn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Dj=zn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Oj=zn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Nj=Object.freeze({__proto__:null,base32:Aj,base32upper:Pj,base32pad:Mj,base32padupper:Ij,base32hex:Cj,base32hexupper:Tj,base32hexpad:Rj,base32hexpadupper:Dj,base32z:Oj});const Lj=Tl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),kj=Tl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Bj=Object.freeze({__proto__:null,base36:Lj,base36upper:kj});const $j=Tl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Fj=Tl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var jj=Object.freeze({__proto__:null,base58btc:$j,base58flickr:Fj});const Uj=zn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),qj=zn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),zj=zn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Hj=zn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Wj=Object.freeze({__proto__:null,base64:Uj,base64pad:qj,base64url:zj,base64urlpad:Hj});const Q_=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Kj=Q_.reduce((t,e,r)=>(t[r]=e,t),[]),Vj=Q_.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Gj(t){return t.reduce((e,r)=>(e+=Kj[r],e),"")}function Yj(t){const e=[];for(const r of t){const n=Vj[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const Jj=Xd({prefix:"🚀",name:"base256emoji",encode:Gj,decode:Yj});var Xj=Object.freeze({__proto__:null,base256emoji:Jj}),Zj=t6,e6=128,Qj=127,eU=~Qj,tU=Math.pow(2,31);function t6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=tU;)e[r++]=t&255|e6,t/=128;for(;t&eU;)e[r++]=t&255|e6,t>>>=7;return e[r]=t|0,t6.bytes=r-n+1,e}var rU=v1,nU=128,r6=127;function v1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw v1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&r6)<=nU);return v1.bytes=s-n,r}var iU=Math.pow(2,7),sU=Math.pow(2,14),oU=Math.pow(2,21),aU=Math.pow(2,28),cU=Math.pow(2,35),uU=Math.pow(2,42),fU=Math.pow(2,49),lU=Math.pow(2,56),hU=Math.pow(2,63),dU=function(t){return t(n6.encode(t,e,r),e),s6=t=>n6.encodingLength(t),b1=(t,e)=>{const r=e.byteLength,n=s6(t),i=n+s6(r),s=new Uint8Array(i+r);return i6(t,s,0),i6(r,s,n),s.set(e,i),new gU(t,r,e,s)};class gU{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const o6=({name:t,code:e,encode:r})=>new mU(t,e,r);class mU{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?b1(this.code,r):r.then(n=>b1(this.code,n))}else throw Error("Unknown type, must be binary type")}}const a6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),vU=o6({name:"sha2-256",code:18,encode:a6("SHA-256")}),bU=o6({name:"sha2-512",code:19,encode:a6("SHA-512")});var yU=Object.freeze({__proto__:null,sha256:vU,sha512:bU});const c6=0,wU="identity",u6=X_;var xU=Object.freeze({__proto__:null,identity:{code:c6,name:wU,encode:u6,digest:t=>b1(c6,u6(t))}});new TextEncoder,new TextDecoder;const f6={...gj,...vj,...yj,...xj,...Sj,...Nj,...Bj,...jj,...Wj,...Xj};({...yU,...xU});function _U(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function l6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const h6=l6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),y1=l6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=_U(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=ut("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Y3(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?J3(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}},PU=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=SF,this.randomSessionIdentifier=c1(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=_x(i);return xx(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=XB();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=_x(s),a=this.randomSessionIdentifier;return await NO(a,i,AF,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),u=ZB(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||Hd(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=p_(o),u=bo(s);if(m_(a))return e$(u,o==null?void 0:o.encoding);if(g_(a)){const y=a.senderPublicKey,A=a.receiverPublicKey;i=await this.generateSharedKey(y,A)}const l=this.getSymKey(i),{type:d,senderPublicKey:g}=a;return QB({type:d,symKey:l,message:u,senderPublicKey:g,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=n$(s,o);if(m_(a)){const u=r$(s,o==null?void 0:o.encoding);return Ga(u)}if(g_(a)){const u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{const u=this.getSymKey(i),l=t$({symKey:u,encoded:s,encoding:o==null?void 0:o.encoding});return Ga(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=(i,s=da)=>{const o=xl({encoded:i,encoding:s});return sc(o.type)},this.getPayloadSenderPublicKey=(i,s=da)=>{const o=xl({encoded:i,encoding:s});return o.senderPublicKey?Tn(o.senderPublicKey,ni):void 0},this.core=e,this.logger=ri(r,this.name),this.keychain=n||new AU(this.core,this.logger)}get context(){return gi(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(K_)}catch{e=c1(),await this.keychain.set(K_,e)}return SU(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}};class MU extends qR{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=IF,this.version=CF,this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Mo(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Mo(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=ri(e,this.name),this.core=r}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Y3(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?J3(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class IU extends zR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new zi.EventEmitter,this.name=RF,this.queue=new Map,this.publishTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.failedPublishTimeout=mt.toMiliseconds(mt.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||TF,u=u1(s),l=(s==null?void 0:s.prompt)||!1,d=(s==null?void 0:s.tag)||0,g=(s==null?void 0:s.id)||ac().toString(),y={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:d,id:g,attestation:s==null?void 0:s.attestation}},A=`Failed to publish payload, please try again. id:${g} tag:${d}`,P=Date.now();let O,D=1;try{for(;O===void 0;){if(Date.now()-P>this.publishTimeout)throw new Error(A);this.logger.trace({id:g,attempts:D},`publisher.publish - attempt ${D}`),O=await await Au(this.rpcPublish(n,i,a,u,l,d,g,s==null?void 0:s.attestation).catch(k=>this.logger.warn(k)),this.publishTimeout,A),D++,O||await new Promise(k=>setTimeout(k,this.failedPublishTimeout))}this.relayer.events.emit(ii.publish,y),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:g,topic:n,message:i,opts:s}})}catch(k){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(k),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw k;this.queue.set(g,y)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=ri(r,this.name),this.registerEventListeners()}get context(){return gi(this.logger)}rpcPublish(e,r,n,i,s,o,a,u){var l,d,g,y;const A={method:_l(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:u},id:a};return bi((l=A.params)==null?void 0:l.prompt)&&((d=A.params)==null||delete d.prompt),bi((g=A.params)==null?void 0:g.tag)&&((y=A.params)==null||delete y.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:A}),this.relayer.request(A)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(iu.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ii.connection_stalled);return}this.checkQueue()}),this.relayer.on(ii.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class CU{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var TU=Object.defineProperty,RU=Object.defineProperties,DU=Object.getOwnPropertyDescriptors,d6=Object.getOwnPropertySymbols,OU=Object.prototype.hasOwnProperty,NU=Object.prototype.propertyIsEnumerable,p6=(t,e,r)=>e in t?TU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rl=(t,e)=>{for(var r in e||(e={}))OU.call(e,r)&&p6(t,r,e[r]);if(d6)for(var r of d6(e))NU.call(e,r)&&p6(t,r,e[r]);return t},w1=(t,e)=>RU(t,DU(e));class LU extends KR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new CU,this.events=new zi.EventEmitter,this.name=$F,this.version=FF,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Ws,this.subscribeTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=u1(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new mt.Watch;a.start(i);const u=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(u),a.stop(i),s(!0)),a.elapsed(i)>=jF&&(clearInterval(u),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ri(r,this.name),this.clientId=""}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=u1(n);await this.rpcUnsubscribe(e,r,i);const s=Dr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===Wr.relay&&await this.restartToComplete();const s={method:_l(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=Mo(e+this.clientId);if((n==null?void 0:n.transportType)===Wr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},mt.toMiliseconds(mt.ONE_SECOND)),a;const u=await Au(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return u?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ii.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Au(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Au(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:_l(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,w1(Rl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Rl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Rl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Ks.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Ks.deleted,w1(Rl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Ks.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);oc(r)&&this.onBatchSubscribe(r.map((n,i)=>w1(Rl({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(iu.pulse,async()=>{await this.checkPending()}),this.events.on(Ks.created,async e=>{const r=Ks.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Ks.deleted,async e=>{const r=Ks.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var kU=Object.defineProperty,g6=Object.getOwnPropertySymbols,BU=Object.prototype.hasOwnProperty,$U=Object.prototype.propertyIsEnumerable,m6=(t,e,r)=>e in t?kU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v6=(t,e)=>{for(var r in e||(e={}))BU.call(e,r)&&m6(t,r,e[r]);if(g6)for(var r of g6(e))$U.call(e,r)&&m6(t,r,e[r]);return t};class FU extends HR{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new zi.EventEmitter,this.name=OF,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=mt.toMiliseconds(mt.THIRTY_SECONDS+mt.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||ac().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(u,l)=>{const d=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Zi.disconnect,d);const g=await o;this.provider.off(Zi.disconnect,d),u(g)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(jd())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(ii.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ii.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Zi.payload,this.onPayloadHandler),this.provider.on(Zi.connect,this.onConnectHandler),this.provider.on(Zi.disconnect,this.onDisconnectHandler),this.provider.on(Zi.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ri(e.logger,this.name):Qf(od({level:e.logger||DF})),this.messages=new MU(this.logger,e.core),this.subscriber=new LU(this,this.logger),this.publisher=new IU(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||G_,this.projectId=e.projectId,this.bundleId=gB(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return gi(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Wr.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",u;const l=d=>{d.topic===e&&(this.subscriber.off(Ks.created,l),u())};return await Promise.all([new Promise(d=>{u=d,this.subscriber.on(Ks.created,l)}),new Promise(async(d,g)=>{a=await this.subscriber.subscribe(e,v6({internal:{throwOnFailedPublish:o}},r)).catch(y=>{o&&g(y)})||a,d()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Au(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Zi.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Zi.disconnect,i),await Au(this.provider.connect(),mt.toMiliseconds(mt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await C_())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=En(mt.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(ii.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(jd())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Xi(new yF(yB({sdkVersion:m1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),g1(e)){if(!e.method.endsWith(NF))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:Wr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(v6({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else Yd(e)&&this.events.emit(ii.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ii.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Vd(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Zi.payload,this.onPayloadHandler),this.provider.off(Zi.connect,this.onConnectHandler),this.provider.off(Zi.disconnect,this.onDisconnectHandler),this.provider.off(Zi.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await C_();J$(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(ii.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},mt.toMiliseconds(LF))))}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var jU=Object.defineProperty,b6=Object.getOwnPropertySymbols,UU=Object.prototype.hasOwnProperty,qU=Object.prototype.propertyIsEnumerable,y6=(t,e,r)=>e in t?jU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,w6=(t,e)=>{for(var r in e||(e={}))UU.call(e,r)&&y6(t,r,e[r]);if(b6)for(var r of b6(e))qU.call(e,r)&&y6(t,r,e[r]);return t};class lc extends WR{constructor(e,r,n,i=Ws,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=kF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!bi(o)?this.map.set(this.getKey(o),o):M$(o)?this.map.set(o.id,o):I$(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>xF(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const u=w6(w6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=ri(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class zU{constructor(e,r){this.core=e,this.logger=r,this.name=UF,this.version=qF,this.events=new Yg,this.initialized=!1,this.storagePrefix=Ws,this.ignoredPayloadTypes=[Po],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=c1(),s=await this.core.crypto.setSymKey(i),o=En(mt.FIVE_MINUTES),a={protocol:V_},u={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=x_({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(cc.create,u),this.core.expirer.set(s,o),await this.pairings.set(s,u),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Vs.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:u,methods:l}=w_(n.uri);i.props.properties.topic=s,i.addTrace(Vs.pairing_uri_validation_success),i.addTrace(Vs.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(Vs.existing_pairing),d.active)throw i.setError(To.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Vs.pairing_not_expired)}const g=u||En(mt.FIVE_MINUTES),y={topic:s,relay:a,expiry:g,active:!1,methods:l};this.core.expirer.set(s,g),await this.pairings.set(s,y),i.addTrace(Vs.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(cc.create,y),i.addTrace(Vs.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Vs.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(To.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(A){throw i.setError(To.subscribe_pairing_topic_failure),A}return i.addTrace(Vs.subscribe_pairing_topic_success),y},this.activate=async({topic:n})=>{this.isInitialized();const i=En(mt.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=nc();this.events.once(vr("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Dr("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,u=this.core.crypto.keychain.get(i);return x_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:u,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=ga(i,s),a=await this.core.crypto.encode(n,o),u=Ml[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{const o=Vd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=Gd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method]?Ml[u.request.method].res:Ml.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Dr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>ha(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(cc.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{Hs(i)?this.events.emit(vr("pairing_ping",s),{}):Ji(i)&&this.events.emit(vr("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(cc.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Dr("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Dr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!yi(n)){const{message:a}=ut("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(To.malformed_pairing_uri),new Error(a)}if(!P$(n.uri)){const{message:a}=ut("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(To.malformed_pairing_uri),new Error(a)}const o=w_(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(To.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(To.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&mt.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!an(n,!1)){const{message:i}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ha(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ut("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=ri(r,this.name),this.pairings=new lc(this.core,this.logger,this.name,this.storagePrefix)}get context(){return gi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ii.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===Wr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{g1(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):Yd(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Qi.expired,async e=>{const{topic:r}=Z3(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(cc.expire,{topic:r}))})}}class HU extends UR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new zi.EventEmitter,this.name=zF,this.version=HF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:En(mt.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(bs.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Ji(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(bs.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(bs.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:ga(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(bs.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(bs.created,e=>{const r=bs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.updated,e=>{const r=bs.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.deleted,e=>{const r=bs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(iu.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{mt.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(bs.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class WU extends VR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new zi.EventEmitter,this.name=WF,this.version=KF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Qi.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Qi.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return wB(e);if(typeof e=="number")return xB(e);const{message:r}=ut("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Qi.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;mt.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Qi.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(iu.pulse,()=>this.checkExpirations()),this.events.on(Qi.created,e=>{const r=Qi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Qi.expired,e=>{const r=Qi.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Qi.deleted,e=>{const r=Qi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class KU extends GR{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=VF,this.verifyUrlV3=YF,this.storagePrefix=Ws,this.version=H_,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&mt.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!pl()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,u=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=nl(),d=this.startAbortTimer(mt.ONE_SECOND*5),g=await new Promise((y,A)=>{const P=()=>{window.removeEventListener("message",D),l.body.removeChild(O),A("attestation aborted")};this.abortController.signal.addEventListener("abort",P);const O=l.createElement("iframe");O.src=u,O.style.display="none",O.addEventListener("error",P,{signal:this.abortController.signal});const D=k=>{if(k.data&&typeof k.data=="string")try{const B=JSON.parse(k.data);if(B.type==="verify_attestation"){if(gm(B.attestation).payload.id!==o)return;clearInterval(d),l.body.removeChild(O),this.abortController.signal.removeEventListener("abort",P),window.removeEventListener("message",D),y(B.attestation===null?"":B.attestation)}}catch(B){this.logger.warn(B)}};l.body.appendChild(O),window.addEventListener("message",D,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",g),g}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(gm(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const u=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,u)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(mt.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Il;return JF.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Il}`),s=Il),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(mt.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=a$(i,s.publicKey),a={hasExpired:mt.toMiliseconds(o.exp)this.abortController.abort(),mt.toMiliseconds(e))}}class VU extends YR{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=XF,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${ZF}/${this.projectId}/clients`;await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=ri(r,this.context)}}var GU=Object.defineProperty,x6=Object.getOwnPropertySymbols,YU=Object.prototype.hasOwnProperty,JU=Object.prototype.propertyIsEnumerable,_6=(t,e,r)=>e in t?GU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dl=(t,e)=>{for(var r in e||(e={}))YU.call(e,r)&&_6(t,r,e[r]);if(x6)for(var r of x6(e))JU.call(e,r)&&_6(t,r,e[r]);return t};class XU extends JR{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=ej,this.storagePrefix=Ws,this.storageVersion=QF,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!i1())try{const i={eventId:e_(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:G3(this.core.relayer.protocol,this.core.relayer.version,m1)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:u}}=i,l=e_(),d=this.core.projectId||"",g=Date.now(),y=Dl({eventId:l,timestamp:g,props:{event:s,type:o,properties:{topic:a,trace:u}},bundleId:d,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,y),this.shouldPersist=!0),y},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(u=>u.props.properties.topic===o);if(a)return Dl(Dl({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(iu.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{mt.fromMiliseconds(Date.now())-mt.fromMiliseconds(i.timestamp)>tj&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Dl(Dl({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${rj}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${m1}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>V3().url,this.logger=ri(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var ZU=Object.defineProperty,E6=Object.getOwnPropertySymbols,QU=Object.prototype.hasOwnProperty,eq=Object.prototype.propertyIsEnumerable,S6=(t,e,r)=>e in t?ZU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A6=(t,e)=>{for(var r in e||(e={}))QU.call(e,r)&&S6(t,r,e[r]);if(E6)for(var r of E6(e))eq.call(e,r)&&S6(t,r,e[r]);return t};class x1 extends jR{constructor(e){var r;super(e),this.protocol=z_,this.version=H_,this.name=W_,this.events=new zi.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:u})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:Wr.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||G_,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=od({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:_F.logger}),{logger:i,chunkLoggerController:s}=FR({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ri(i,this.name),this.heartbeat=new OT,this.crypto=new PU(this,this.logger,e==null?void 0:e.keychain),this.history=new HU(this,this.logger),this.expirer=new WU(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new lR(A6(A6({},EF),e==null?void 0:e.storageOptions)),this.relayer=new FU({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new zU(this,this.logger),this.verify=new KU(this,this.logger,this.storage),this.echoClient=new VU(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new XU(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new x1(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(BF,n),r}get context(){return gi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(Y_,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(Y_)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const tq=x1,P6="wc",M6=2,I6="client",_1=`${P6}@${M6}:${I6}:`,E1={name:I6,logger:"error"},C6="WALLETCONNECT_DEEPLINK_CHOICE",rq="proposal",T6="Proposal expired",nq="session",Mu=mt.SEVEN_DAYS,iq="engine",kn={wc_sessionPropose:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:mt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:mt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1119}}},S1={min:mt.FIVE_MINUTES,max:mt.SEVEN_DAYS},Gs={idle:"IDLE",active:"ACTIVE"},sq="request",oq=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],aq="wc",cq="auth",uq="authKeys",fq="pairingTopics",lq="requests",Zd=`${aq}@${1.5}:${cq}:`,Qd=`${Zd}:PUB_KEY`;var hq=Object.defineProperty,dq=Object.defineProperties,pq=Object.getOwnPropertyDescriptors,R6=Object.getOwnPropertySymbols,gq=Object.prototype.hasOwnProperty,mq=Object.prototype.propertyIsEnumerable,D6=(t,e,r)=>e in t?hq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))gq.call(e,r)&&D6(t,r,e[r]);if(R6)for(var r of R6(e))mq.call(e,r)&&D6(t,r,e[r]);return t},ws=(t,e)=>dq(t,pq(e));class vq extends ZR{constructor(e){super(e),this.name=iq,this.events=new Yg,this.initialized=!1,this.requestQueue={state:Gs.idle,queue:[]},this.sessionRequestQueue={state:Gs.idle,queue:[]},this.requestQueueDelay=mt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(kn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=ws(tn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n;let l=i,d,g=!1;try{l&&(g=this.client.core.pairing.pairings.get(l).active)}catch(U){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),U}if(!l||!g){const{topic:U,uri:K}=await this.client.core.pairing.create();l=U,d=K}if(!l){const{message:U}=ut("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(U)}const y=await this.client.core.crypto.generateKeyPair(),A=kn.wc_sessionPropose.req.ttl||mt.FIVE_MINUTES,P=En(A),O=tn({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:V_}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:P,pairingTopic:l},a&&{sessionProperties:a}),{reject:D,resolve:k,done:B}=nc(A,T6);this.events.once(vr("session_connect"),async({error:U,session:K})=>{if(U)D(U);else if(K){K.self.publicKey=y;const J=ws(tn({},K),{pairingTopic:O.pairingTopic,requiredNamespaces:O.requiredNamespaces,optionalNamespaces:O.optionalNamespaces,transportType:Wr.relay});await this.client.session.set(K.topic,J),await this.setExpiry(K.topic,K.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:K.peer.metadata}),this.cleanupDuplicatePairings(J),k(J)}});const j=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:O,throwOnFailedPublish:!0});return await this.setProposal(j,tn({id:j},O)),{uri:d,approval:B}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[ys.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(z){throw o.setError(uc.no_internet_connection),z}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(z){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(uc.proposal_not_found),z}try{await this.isValidApprove(r)}catch(z){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(uc.session_approve_namespace_validation_failure),z}const{id:a,relayProtocol:u,namespaces:l,sessionProperties:d,sessionConfig:g}=r,y=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:A,proposer:P,requiredNamespaces:O,optionalNamespaces:D}=y;let k=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:A});k||(k=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:ys.session_approve_started,properties:{topic:A,trace:[ys.session_approve_started,ys.session_namespaces_validation_success]}}));const B=await this.client.core.crypto.generateKeyPair(),j=P.publicKey,U=await this.client.core.crypto.generateSharedKey(B,j),K=tn(tn({relay:{protocol:u??"irn"},namespaces:l,controller:{publicKey:B,metadata:this.client.metadata},expiry:En(Mu)},d&&{sessionProperties:d}),g&&{sessionConfig:g}),J=Wr.relay;k.addTrace(ys.subscribing_session_topic);try{await this.client.core.relayer.subscribe(U,{transportType:J})}catch(z){throw k.setError(uc.subscribe_session_topic_failure),z}k.addTrace(ys.subscribe_session_topic_success);const T=ws(tn({},K),{topic:U,requiredNamespaces:O,optionalNamespaces:D,pairingTopic:A,acknowledged:!1,self:K.controller,peer:{publicKey:P.publicKey,metadata:P.metadata},controller:B,transportType:Wr.relay});await this.client.session.set(U,T),k.addTrace(ys.store_session);try{k.addTrace(ys.publishing_session_settle),await this.sendRequest({topic:U,method:"wc_sessionSettle",params:K,throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(uc.session_settle_publish_failure),z}),k.addTrace(ys.session_settle_publish_success),k.addTrace(ys.publishing_session_approve),await this.sendResult({id:a,topic:A,result:{relay:{protocol:u??"irn"},responderPublicKey:B},throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(uc.session_approve_publish_failure),z}),k.addTrace(ys.session_approve_publish_success)}catch(z){throw this.client.logger.error(z),this.client.session.delete(U,Dr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(U),z}return this.client.core.eventClient.deleteEvent({eventId:k.eventId}),await this.client.core.pairing.updateMetadata({topic:A,metadata:P.metadata}),await this.client.proposal.delete(a,Dr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:A}),await this.setExpiry(U,En(Mu)),{topic:U,acknowledged:()=>Promise.resolve(this.client.session.get(U))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:kn.wc_sessionPropose.reject}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(g){throw this.client.logger.error("update() -> isValidUpdate() failed"),g}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=nc(),u=pa(),l=ac().toString(),d=this.client.session.get(n).namespaces;return this.events.once(vr("session_update",u),({error:g})=>{g?a(g):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:u,relayRpcId:l}).catch(g=>{this.client.logger.error(g),this.client.session.update(n,{namespaces:d}),a(g)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(u){throw this.client.logger.error("extend() -> isValidExtend() failed"),u}const{topic:n}=r,i=pa(),{done:s,resolve:o,reject:a}=nc();return this.events.once(vr("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,En(Mu)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(u=>{a(u)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(P){throw this.client.logger.error("request() -> isValidRequest() failed"),P}const{chainId:n,request:i,topic:s,expiry:o=kn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=pa(),l=ac().toString(),{done:d,resolve:g,reject:y}=nc(o,"Request expired. Please try again.");this.events.once(vr("session_request",u),({error:P,result:O})=>{P?y(P):g(O)});const A=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return A?(await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:A}).catch(P=>y(P)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),await d()):await Promise.all([new Promise(async P=>{await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(O=>y(O)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),P()}),new Promise(async P=>{var O;if(!((O=a.sessionConfig)!=null&&O.disableDeepLink)){const D=await SB(this.client.core.storage,C6);await _B({id:u,topic:s,wcDeepLink:D})}P()}),d()]).then(P=>P[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);Hs(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Ji(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=pa(),s=ac().toString(),{done:o,resolve:a,reject:u}=nc();this.events.once(vr("session_ping",i),({error:l})=>{l?u(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=ac().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Dr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ut("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>S$(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?Wr.link_mode:Wr.relay;o===Wr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:u="",uri:l,domain:d,nonce:g,type:y,exp:A,nbf:P,methods:O=[],expiry:D}=r,k=[...r.resources||[]],{topic:B,uri:j}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:B,uri:j}});const U=await this.client.core.crypto.generateKeyPair(),K=Hd(U);if(await Promise.all([this.client.auth.authKeys.set(Qd,{responseTopic:K,publicKey:U}),this.client.auth.pairingTopics.set(K,{topic:K,pairingTopic:B})]),await this.client.core.relayer.subscribe(K,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${B}`),O.length>0){const{namespace:_}=Eu(a[0]);let S=WB(_,"request",O);zd(k)&&(S=VB(S,k.pop())),k.push(S)}const J=D&&D>kn.wc_sessionAuthenticate.req.ttl?D:kn.wc_sessionAuthenticate.req.ttl,T={authPayload:{type:y??"caip122",chains:a,statement:u,aud:l,domain:d,version:"1",nonce:g,iat:new Date().toISOString(),exp:A,nbf:P,resources:k},requester:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(J)},z={eip155:{chains:a,methods:[...new Set(["personal_sign",...O])],events:["chainChanged","accountsChanged"]}},ue={requiredNamespaces:{},optionalNamespaces:z,relays:[{protocol:"irn"}],pairingTopic:B,proposer:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(kn.wc_sessionPropose.req.ttl)},{done:_e,resolve:G,reject:E}=nc(J,"Request expired"),m=async({error:_,session:S})=>{if(this.events.off(vr("session_request",p),f),_)E(_);else if(S){S.self.publicKey=U,await this.client.session.set(S.topic,S),await this.setExpiry(S.topic,S.expiry),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:S.peer.metadata});const b=this.client.session.get(S.topic);await this.deleteProposal(v),G({session:b})}},f=async _=>{var S,b,M;if(await this.deletePendingAuthRequest(p,{message:"fulfilled",code:0}),_.error){const X=Dr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return _.error.code===X.code?void 0:(this.events.off(vr("session_connect"),m),E(_.error.message))}await this.deleteProposal(v),this.events.off(vr("session_connect"),m);const{cacaos:I,responder:F}=_.result,ae=[],N=[];for(const X of I){await i_({cacao:X,projectId:this.client.core.projectId})||(this.client.logger.error(X,"Signature verification failed"),E(Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Q}=X,R=zd(Q.resources),Z=[o1(Q.iss)],te=qd(Q.iss);if(R){const he=a_(R),ie=c_(R);ae.push(...he),Z.push(...ie)}for(const he of Z)N.push(`${he}:${te}`)}const se=await this.client.core.crypto.generateSharedKey(U,F.publicKey);let ee;ae.length>0&&(ee={topic:se,acknowledged:!0,self:{publicKey:U,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:En(Mu),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:B,namespaces:__([...new Set(ae)],[...new Set(N)]),transportType:o},await this.client.core.relayer.subscribe(se,{transportType:o}),await this.client.session.set(se,ee),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:F.metadata}),ee=this.client.session.get(se)),(S=this.client.metadata.redirect)!=null&&S.linkMode&&(b=F.metadata.redirect)!=null&&b.linkMode&&(M=F.metadata.redirect)!=null&&M.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(se,{transportType:Wr.link_mode})),G({auths:I,session:ee})},p=pa(),v=pa();this.events.once(vr("session_connect"),m),this.events.once(vr("session_request",p),f);let x;try{if(s){const _=ga("wc_sessionAuthenticate",T,p);this.client.core.history.set(B,_);const S=await this.client.core.crypto.encode("",_,{type:yl,encoding:vl});x=Wd(n,B,S)}else await Promise.all([this.sendRequest({topic:B,method:"wc_sessionAuthenticate",params:T,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:p}),this.sendRequest({topic:B,method:"wc_sessionPropose",params:ue,expiry:kn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:v})])}catch(_){throw this.events.off(vr("session_connect"),m),this.events.off(vr("session_request",p),f),_}return await this.setProposal(v,tn({id:v},ue)),await this.setAuthRequest(p,{request:ws(tn({},T),{verifyContext:{}}),pairingTopic:B,transportType:o}),{uri:x??j,response:_e}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[fc.authenticated_session_approve_started]}});try{this.isInitialized()}catch(D){throw s.setError(Cl.no_internet_connection),D}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Cl.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||Wr.relay;a===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=Hd(u),g={type:Po,receiverPublicKey:u,senderPublicKey:l},y=[],A=[];for(const D of i){if(!await i_({cacao:D,projectId:this.client.core.projectId})){s.setError(Cl.invalid_cacao);const K=Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:K,encodeOpts:g}),new Error(K.message)}s.addTrace(fc.cacaos_verified);const{p:k}=D,B=zd(k.resources),j=[o1(k.iss)],U=qd(k.iss);if(B){const K=a_(B),J=c_(B);y.push(...K),j.push(...J)}for(const K of j)A.push(`${K}:${U}`)}const P=await this.client.core.crypto.generateSharedKey(l,u);s.addTrace(fc.create_authenticated_session_topic);let O;if((y==null?void 0:y.length)>0){O={topic:P,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:u,metadata:o.requester.metadata},controller:u,expiry:En(Mu),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:__([...new Set(y)],[...new Set(A)]),transportType:a},s.addTrace(fc.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(P,{transportType:a})}catch(D){throw s.setError(Cl.subscribe_authenticated_session_topic_failure),D}s.addTrace(fc.subscribe_authenticated_session_topic_success),await this.client.session.set(P,O),s.addTrace(fc.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(fc.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:g,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(D){throw s.setError(Cl.authenticated_session_approve_publish_failure),D}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:O}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),u=Hd(o),l={type:Po,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:u,error:i,encodeOpts:l,rpcOpts:kn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return s_(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:u}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Dr("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(C6).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,Dr("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Gs.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(uc.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Dr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Gs.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,En(kn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=Wr.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||En(kn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l,appLink:d}=r,g=ga(i,s,u);let y;const A=!!d;try{const D=A?vl:da;y=await this.client.core.crypto.encode(n,g,{encoding:D})}catch(D){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),D}let P;if(oq.includes(i)){const D=Mo(JSON.stringify(g)),k=Mo(y);P=await this.client.core.verify.register({id:k,decryptedId:D})}const O=kn[i].req;if(O.attestation=P,o&&(O.ttl=o),a&&(O.id=a),this.client.core.history.set(n,g),A){const D=Wd(d,n,y);await global.Linking.openURL(D,this.client.name)}else{const D=kn[i].req;o&&(D.ttl=o),a&&(D.id=a),l?(D.internal=ws(tn({},D.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,y,D)):this.client.core.relayer.publish(n,y,D).catch(k=>this.client.logger.error(k))}return g.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:u}=r,l=Vd(n,s);let d;const g=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=g?vl:da;d=await this.client.core.crypto.encode(i,l,ws(tn({},a||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),A}if(g){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=kn[y.request.method].res;o?(A.internal=ws(tn({},A.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,A)):this.client.core.relayer.publish(i,d,A).catch(P=>this.client.logger.error(P))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:u}=r,l=Gd(n,s);let d;const g=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=g?vl:da;d=await this.client.core.crypto.encode(i,l,ws(tn({},o||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),A}if(g){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=a||kn[y.request.method].res;this.client.core.relayer.publish(i,d,A)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;ha(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{ha(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Gs.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Gs.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Gs.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,u=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:u}))switch(u){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=ut("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:u}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(tn({},i.params));const d=a.expiryTimestamp||En(kn.wc_sessionPropose.req.ttl),g=tn({id:u,pairingTopic:n,expiryTimestamp:d},a);await this.setProposal(u,g);const y=await this.getVerifyContext({attestationId:s,hash:Mo(JSON.stringify(i)),encryptedId:o,metadata:g.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(To.proposal_listener_not_found)),l==null||l.addTrace(Vs.emit_session_proposal),this.client.events.emit("session_proposal",{id:u,params:g,verifyContext:y})}catch(l){await this.sendError({id:u,topic:n,error:l,rpcOpts:kn.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(Hs(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const u=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const d=await this.client.core.crypto.generateSharedKey(u,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:d});const g=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:g}),await this.client.core.pairing.activate({topic:r})}else if(Ji(n)){await this.client.proposal.delete(s,Dr("USER_DISCONNECTED"));const o=vr("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(vr("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:u,namespaces:l,sessionProperties:d,sessionConfig:g}=n.params,y=ws(tn(tn({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},d&&{sessionProperties:d}),g&&{sessionConfig:g}),{transportType:Wr.relay}),A=vr("session_connect");if(this.events.listenerCount(A)===0)throw new Error(`emitting ${A} without any listeners 997`);this.events.emit(vr("session_connect"),{session:y}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;Hs(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(vr("session_approve",i),{})):Ji(n)&&(await this.client.session.delete(r,Dr("USER_DISCONNECTED")),this.events.emit(vr("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Dr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(tn({topic:r},i));try{Al.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(u){throw Al.delete(o),u}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=vr("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_update",i),{}):Ji(n)&&this.events.emit(vr("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,En(Mu)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=vr("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_extend",i),{}):Ji(n)&&this.events.emit(vr("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=vr("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{Hs(n)?this.events.emit(vr("session_ping",i),{}):Ji(n)&&this.events.emit(vr("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(ii.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Dr("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:u,encryptedId:l,transportType:d}=r,{id:g,params:y}=a;try{await this.isValidRequest(tn({topic:o},y));const A=this.client.session.get(o),P=await this.getVerifyContext({attestationId:u,hash:Mo(JSON.stringify(ga("wc_sessionRequest",y,g))),encryptedId:l,metadata:A.peer.metadata,transportType:d}),O={id:g,topic:o,params:y,verifyContext:P};await this.setPendingSessionRequest(O),d===Wr.link_mode&&(n=A.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=A.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(O):(this.addSessionRequestToSessionRequestQueue(O),this.processSessionRequestQueue())}catch(A){await this.sendError({id:g,topic:o,error:A}),this.client.logger.error(A)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=vr("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Ji(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(tn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Al.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Ji(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:u}=r;try{const{requester:l,authPayload:d,expiryTimestamp:g}=s.params,y=await this.getVerifyContext({attestationId:o,hash:Mo(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:u}),A={requester:l,pairingTopic:i,id:s.id,authPayload:d,verifyContext:y,expiryTimestamp:g};await this.setAuthRequest(s.id,{request:A,pairingTopic:i,transportType:u}),u===Wr.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:y})}catch(l){this.client.logger.error(l);const d=s.params.requester.publicKey,g=await this.client.core.crypto.generateKeyPair(),y=this.getAppLinkIfEnabled(s.params.requester.metadata,u),A={type:Po,receiverPublicKey:d,senderPublicKey:g};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:A,rpcOpts:kn.wc_sessionAuthenticate.autoReject,appLink:y})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Gs.idle,this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=vr("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(vr("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Gs.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Gs.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:ga("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(bi(n)||await this.isValidPairingTopic(n),!k$(a)){const{message:u}=ut("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!bi(i)&&Sl(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!bi(s)&&Sl(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),bi(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=L$(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!yi(r))throw new Error(ut("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),u=h1(i,"approve()");if(u)throw new Error(u.message);const l=M_(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!an(s,!0)){const{message:d}=ut("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}bi(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!yi(r)){const{message:s}=ut("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!$$(i)){const{message:s}=ut("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!yi(r)){const{message:l}=ut("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!A_(n)){const{message:l}=ut("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=C$(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const u=h1(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(ha(o)){const{message:l}=ut("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=h1(i,"update()");if(o)throw new Error(o.message);const a=M_(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!P_(a,s)){const{message:u}=ut("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!F$(i)){const{message:u}=ut("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!q$(a,s,i.method)){const{message:u}=ut("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!K$(o,S1)){const{message:u}=ut("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${S1.min} and ${S1.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!yi(r)){const{message:o}=ut("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!j$(s)){const{message:o}=ut("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!yi(r)){const{message:a}=ut("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!P_(o,s)){const{message:a}=ut("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!U$(i)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!z$(o,s,i.name)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!an(i,!1))throw new Error("uri is required parameter");if(!an(s,!1))throw new Error("domain is required parameter");if(!an(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(u=>Eu(u).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Eu(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,u={verified:{verifyUrl:o.verifyUrl||Il,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Wr.link_mode){const d=this.getAppLinkIfEnabled(o,a);return u.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",u}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(u.verified.origin=l.origin,u.verified.isScam=l.isScam,u.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(u)}`),u},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!an(i,!1)){const{message:s}=ut("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,u,l,d,g,y;return!r||n!==Wr.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(u=this.client.metadata)==null?void 0:u.redirect)==null?void 0:l.universal)!==""&&((d=r==null?void 0:r.redirect)==null?void 0:d.universal)!==void 0&&((g=r==null?void 0:r.redirect)==null?void 0:g.universal)!==""&&((y=r==null?void 0:r.redirect)==null?void 0:y.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=Q3(r,"topic")||"",i=decodeURIComponent(Q3(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:Wr.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(i1()||Su()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ii.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(Qd)?this.client.auth.authKeys.get(Qd):{publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===Wr.link_mode?vl:da});try{g1(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:Mo(n)})):Yd(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(u){this.client.logger.error(u)}}registerExpirerEvents(){this.client.core.expirer.on(Qi.expired,async e=>{const{topic:r,id:n}=Z3(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ut("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,ut("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(cc.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(cc.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(ha(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=ut("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(ha(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=ut("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=ut("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(an(e,!1)){const{message:r}=ut("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=ut("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!B$(e)){const{message:r}=ut("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(ha(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=ut("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class bq extends lc{constructor(e,r){super(e,r,rq,_1),this.core=e,this.logger=r}}let yq=class extends lc{constructor(e,r){super(e,r,nq,_1),this.core=e,this.logger=r}};class wq extends lc{constructor(e,r){super(e,r,sq,_1,n=>n.id),this.core=e,this.logger=r}}class xq extends lc{constructor(e,r){super(e,r,uq,Zd,()=>Qd),this.core=e,this.logger=r}}class _q extends lc{constructor(e,r){super(e,r,fq,Zd),this.core=e,this.logger=r}}class Eq extends lc{constructor(e,r){super(e,r,lq,Zd,n=>n.id),this.core=e,this.logger=r}}class Sq{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new xq(this.core,this.logger),this.pairingTopics=new _q(this.core,this.logger),this.requests=new Eq(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class A1 extends XR{constructor(e){super(e),this.protocol=P6,this.version=M6,this.name=E1.name,this.events=new zi.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||E1.name,this.metadata=(e==null?void 0:e.metadata)||V3(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||E1.logger}));this.core=(e==null?void 0:e.core)||new tq(e),this.logger=ri(r,this.name),this.session=new yq(this.core,this.logger),this.proposal=new bq(this.core,this.logger),this.pendingRequest=new wq(this.core,this.logger),this.engine=new vq(this),this.auth=new Sq(this.core,this.logger)}static async init(e){const r=new A1(e);return await r.initialize(),r}get context(){return gi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var e0={exports:{}};/** + Approved: ${y.toString()}`))}),o.forEach(g=>{n||(ec(i[g].methods,s[g].methods)?ec(i[g].events,s[g].events)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${g}`)):n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${g}`))}),n}function W$(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function P_(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function K$(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Pu(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function V$(t,e){return l1(t)&&t<=e.max&&t>=e.min}function M_(){const t=gl();return new Promise(e=>{switch(t){case Ri.browser:e(G$());break;case Ri.reactNative:e(Y$());break;case Ri.node:e(J$());break;default:e(!0)}})}function G$(){return pl()&&(navigator==null?void 0:navigator.onLine)}async function Y$(){if(Su()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function J$(){return!0}function X$(t){switch(gl()){case Ri.browser:Z$(t);break;case Ri.reactNative:Q$(t);break}}function Z$(t){!Su()&&pl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function Q$(t){Su()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const d1={};class Al{static get(e){return d1[e]}static set(e,r){d1[e]=r}static delete(e){delete d1[e]}}const eF="PARSE_ERROR",tF="INVALID_REQUEST",rF="METHOD_NOT_FOUND",nF="INVALID_PARAMS",I_="INTERNAL_ERROR",p1="SERVER_ERROR",iF=[-32700,-32600,-32601,-32602,-32603],Pl={[eF]:{code:-32700,message:"Parse error"},[tF]:{code:-32600,message:"Invalid Request"},[rF]:{code:-32601,message:"Method not found"},[nF]:{code:-32602,message:"Invalid params"},[I_]:{code:-32603,message:"Internal error"},[p1]:{code:-32e3,message:"Server error"}},C_=p1;function sF(t){return iF.includes(t)}function T_(t){return Object.keys(Pl).includes(t)?Pl[t]:Pl[C_]}function oF(t){const e=Object.values(Pl).find(r=>r.code===t);return e||Pl[C_]}function R_(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var D_={},Po={},O_;function aF(){if(O_)return Po;O_=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.isBrowserCryptoAvailable=Po.getSubtleCrypto=Po.getBrowerCrypto=void 0;function t(){return(nn==null?void 0:nn.crypto)||(nn==null?void 0:nn.msCrypto)||{}}Po.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Po.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Po.isBrowserCryptoAvailable=r,Po}var Mo={},N_;function cF(){if(N_)return Mo;N_=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.isBrowser=Mo.isNode=Mo.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Mo.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Mo.isNode=e;function r(){return!t()&&!e()}return Mo.isBrowser=r,Mo}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(aF(),t),e.__exportStar(cF(),t)})(D_);function ha(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function sc(t=6){return BigInt(ha(t))}function da(t,e,r){return{id:r||ha(),jsonrpc:"2.0",method:t,params:e}}function Vd(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Gd(t,e,r){return{id:t,jsonrpc:"2.0",error:uF(e)}}function uF(t,e){return typeof t>"u"?T_(I_):(typeof t=="string"&&(t=Object.assign(Object.assign({},T_(p1)),{message:t})),sF(t.code)&&(t=oF(t.code)),t)}let fF=class{},lF=class extends fF{constructor(){super()}},hF=class extends lF{constructor(e){super()}};const dF="^https?:",pF="^wss?:";function gF(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function L_(t,e){const r=gF(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function k_(t){return L_(t,dF)}function B_(t){return L_(t,pF)}function mF(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function $_(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function g1(t){return $_(t)&&"method"in t}function Yd(t){return $_(t)&&(Hs(t)||Yi(t))}function Hs(t){return"result"in t}function Yi(t){return"error"in t}let Ji=class extends hF{constructor(e){super(e),this.events=new qi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(da(e.method,e.params||[],e.id||sc().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Yi(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Yd(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const vF=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),bF=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",F_=t=>t.split("?")[0],j_=10,yF=vF();let wF=class{constructor(e){if(this.url=e,this.events=new qi.EventEmitter,this.registering=!1,!B_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(mo(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!B_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=D_.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!mF(e)},o=new yF(e,[],s);bF()?o.onerror=a=>{const u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ka(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return R_(e,F_(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>j_&&this.events.setMaxListeners(j_)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${F_(this.url)}`));return this.events.emit("register_error",r),r}};var Jd={exports:{}};Jd.exports,function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",u="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",g="[object Date]",y="[object Error]",A="[object Function]",P="[object GeneratorFunction]",N="[object Map]",D="[object Number]",k="[object Null]",B="[object Object]",j="[object Promise]",U="[object Proxy]",K="[object RegExp]",J="[object Set]",T="[object String]",z="[object Symbol]",ue="[object Undefined]",_e="[object WeakMap]",G="[object ArrayBuffer]",E="[object DataView]",m="[object Float32Array]",f="[object Float64Array]",p="[object Int8Array]",v="[object Int16Array]",x="[object Int32Array]",_="[object Uint8Array]",S="[object Uint8ClampedArray]",b="[object Uint16Array]",M="[object Uint32Array]",I=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,O={};O[m]=O[f]=O[p]=O[v]=O[x]=O[_]=O[S]=O[b]=O[M]=!0,O[a]=O[u]=O[G]=O[d]=O[E]=O[g]=O[y]=O[A]=O[N]=O[D]=O[B]=O[K]=O[J]=O[T]=O[_e]=!1;var se=typeof nn=="object"&&nn&&nn.Object===Object&&nn,ee=typeof self=="object"&&self&&self.Object===Object&&self,X=se||ee||Function("return this")(),Q=e&&!e.nodeType&&e,R=Q&&!0&&t&&!t.nodeType&&t,Z=R&&R.exports===Q,te=Z&&se.process,le=function(){try{return te&&te.binding&&te.binding("util")}catch{}}(),ie=le&&le.isTypedArray;function fe(ce,ye){for(var Ye=-1,It=ce==null?0:ce.length,jr=0,ir=[];++Ye-1}function st(ce,ye){var Ye=this.__data__,It=Xe(Ye,ce);return It<0?(++this.size,Ye.push([ce,ye])):Ye[It][1]=ye,this}Re.prototype.clear=De,Re.prototype.delete=it,Re.prototype.get=Ue,Re.prototype.has=gt,Re.prototype.set=st;function tt(ce){var ye=-1,Ye=ce==null?0:ce.length;for(this.clear();++yewn))return!1;var Ur=ir.get(ce);if(Ur&&ir.get(ye))return Ur==ye;var gn=-1,_i=!0,xn=Ye&s?new _t:void 0;for(ir.set(ce,ye),ir.set(ye,ce);++gn-1&&ce%1==0&&ce-1&&ce%1==0&&ce<=o}function up(ce){var ye=typeof ce;return ce!=null&&(ye=="object"||ye=="function")}function Pc(ce){return ce!=null&&typeof ce=="object"}var fp=ie?Te(ie):dr;function Ub(ce){return Fb(ce)?qe(ce):pr(ce)}function Fr(){return[]}function kr(){return!1}t.exports=jb}(Jd,Jd.exports);var xF=Jd.exports;const _F=ji(xF),U_="wc",q_=2,z_="core",Ws=`${U_}@2:${z_}:`,EF={logger:"error"},SF={database:":memory:"},AF="crypto",H_="client_ed25519_seed",PF=mt.ONE_DAY,MF="keychain",IF="0.3",CF="messages",TF="0.3",RF=mt.SIX_HOURS,DF="publisher",W_="irn",OF="error",K_="wss://relay.walletconnect.org",NF="relayer",ii={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},LF="_subscription",Xi={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},kF=.1,m1="2.17.2",Wr={link_mode:"link_mode",relay:"relay"},BF="0.3",$F="WALLETCONNECT_CLIENT_ID",V_="WALLETCONNECT_LINK_MODE_APPS",Ks={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},FF="subscription",jF="0.3",UF=mt.FIVE_SECONDS*1e3,qF="pairing",zF="0.3",Ml={wc_pairingDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:0},res:{ttl:mt.ONE_DAY,prompt:!1,tag:0}}},oc={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},bs={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},HF="history",WF="0.3",KF="expirer",Zi={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},VF="0.3",GF="verify-api",YF="https://verify.walletconnect.com",G_="https://verify.walletconnect.org",Il=G_,JF=`${Il}/v3`,XF=[YF,G_],ZF="echo",QF="https://echo.walletconnect.com",Vs={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},Io={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},ys={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},ac={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},cc={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Cl={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},ej=.1,tj="event-client",rj=86400,nj="https://pulse.walletconnect.org/batch";function ij(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(j);k!==B;){for(var K=P[k],J=0,T=j-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=j-D;z!==j&&U[z]===0;)z++;for(var ue=u.repeat(N);z>>0,j=new Uint8Array(B);P[N];){var U=r[P.charCodeAt(N)];if(U===255)return;for(var K=0,J=B-1;(U!==0||K>>0,j[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,N++}if(P[N]!==" "){for(var T=B-k;T!==B&&j[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=j[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:g,decodeUnsafe:y,decode:A}}var sj=ij,oj=sj;const Y_=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},aj=t=>new TextEncoder().encode(t),cj=t=>new TextDecoder().decode(t);class uj{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class fj{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return J_(this,e)}}class lj{constructor(e){this.decoders=e}or(e){return J_(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const J_=(t,e)=>new lj({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class hj{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new uj(e,r,n),this.decoder=new fj(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Xd=({name:t,prefix:e,encode:r,decode:n})=>new hj(t,e,r,n),Tl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=oj(r,e);return Xd({prefix:t,name:e,encode:n,decode:s=>Y_(i(s))})},dj=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},pj=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Xd({prefix:e,name:t,encode(i){return pj(i,n,r)},decode(i){return dj(i,n,r,t)}}),gj=Xd({prefix:"\0",name:"identity",encode:t=>cj(t),decode:t=>aj(t)});var mj=Object.freeze({__proto__:null,identity:gj});const vj=zn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var bj=Object.freeze({__proto__:null,base2:vj});const yj=zn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var wj=Object.freeze({__proto__:null,base8:yj});const xj=Tl({prefix:"9",name:"base10",alphabet:"0123456789"});var _j=Object.freeze({__proto__:null,base10:xj});const Ej=zn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Sj=zn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Aj=Object.freeze({__proto__:null,base16:Ej,base16upper:Sj});const Pj=zn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Mj=zn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ij=zn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Cj=zn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Tj=zn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Rj=zn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Dj=zn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Oj=zn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Nj=zn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Lj=Object.freeze({__proto__:null,base32:Pj,base32upper:Mj,base32pad:Ij,base32padupper:Cj,base32hex:Tj,base32hexupper:Rj,base32hexpad:Dj,base32hexpadupper:Oj,base32z:Nj});const kj=Tl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Bj=Tl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var $j=Object.freeze({__proto__:null,base36:kj,base36upper:Bj});const Fj=Tl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),jj=Tl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Uj=Object.freeze({__proto__:null,base58btc:Fj,base58flickr:jj});const qj=zn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zj=zn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Hj=zn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Wj=zn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Kj=Object.freeze({__proto__:null,base64:qj,base64pad:zj,base64url:Hj,base64urlpad:Wj});const X_=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Vj=X_.reduce((t,e,r)=>(t[r]=e,t),[]),Gj=X_.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Yj(t){return t.reduce((e,r)=>(e+=Vj[r],e),"")}function Jj(t){const e=[];for(const r of t){const n=Gj[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const Xj=Xd({prefix:"🚀",name:"base256emoji",encode:Yj,decode:Jj});var Zj=Object.freeze({__proto__:null,base256emoji:Xj}),Qj=Q_,Z_=128,eU=127,tU=~eU,rU=Math.pow(2,31);function Q_(t,e,r){e=e||[],r=r||0;for(var n=r;t>=rU;)e[r++]=t&255|Z_,t/=128;for(;t&tU;)e[r++]=t&255|Z_,t>>>=7;return e[r]=t|0,Q_.bytes=r-n+1,e}var nU=v1,iU=128,e6=127;function v1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw v1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&e6)<=iU);return v1.bytes=s-n,r}var sU=Math.pow(2,7),oU=Math.pow(2,14),aU=Math.pow(2,21),cU=Math.pow(2,28),uU=Math.pow(2,35),fU=Math.pow(2,42),lU=Math.pow(2,49),hU=Math.pow(2,56),dU=Math.pow(2,63),pU=function(t){return t(t6.encode(t,e,r),e),n6=t=>t6.encodingLength(t),b1=(t,e)=>{const r=e.byteLength,n=n6(t),i=n+n6(r),s=new Uint8Array(i+r);return r6(t,s,0),r6(r,s,n),s.set(e,i),new mU(t,r,e,s)};class mU{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const i6=({name:t,code:e,encode:r})=>new vU(t,e,r);class vU{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?b1(this.code,r):r.then(n=>b1(this.code,n))}else throw Error("Unknown type, must be binary type")}}const s6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),bU=i6({name:"sha2-256",code:18,encode:s6("SHA-256")}),yU=i6({name:"sha2-512",code:19,encode:s6("SHA-512")});var wU=Object.freeze({__proto__:null,sha256:bU,sha512:yU});const o6=0,xU="identity",a6=Y_;var _U=Object.freeze({__proto__:null,identity:{code:o6,name:xU,encode:a6,digest:t=>b1(o6,a6(t))}});new TextEncoder,new TextDecoder;const c6={...mj,...bj,...wj,..._j,...Aj,...Lj,...$j,...Uj,...Kj,...Zj};({...wU,..._U});function EU(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function u6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const f6=u6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),y1=u6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=EU(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=ut("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,V3(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?G3(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}},MU=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=AF,this.randomSessionIdentifier=c1(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=wx(i);return yx(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=ZB();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=wx(s),a=this.randomSessionIdentifier;return await LO(a,i,PF,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),u=QB(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||Hd(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=h_(o),u=mo(s);if(p_(a))return t$(u,o==null?void 0:o.encoding);if(d_(a)){const y=a.senderPublicKey,A=a.receiverPublicKey;i=await this.generateSharedKey(y,A)}const l=this.getSymKey(i),{type:d,senderPublicKey:g}=a;return e$({type:d,symKey:l,message:u,senderPublicKey:g,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=i$(s,o);if(p_(a)){const u=n$(s,o==null?void 0:o.encoding);return Ka(u)}if(d_(a)){const u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{const u=this.getSymKey(i),l=r$({symKey:u,encoded:s,encoding:o==null?void 0:o.encoding});return Ka(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=(i,s=la)=>{const o=xl({encoded:i,encoding:s});return nc(o.type)},this.getPayloadSenderPublicKey=(i,s=la)=>{const o=xl({encoded:i,encoding:s});return o.senderPublicKey?Tn(o.senderPublicKey,ni):void 0},this.core=e,this.logger=ri(r,this.name),this.keychain=n||new PU(this.core,this.logger)}get context(){return gi(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(H_)}catch{e=c1(),await this.keychain.set(H_,e)}return AU(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}};class IU extends zR{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=CF,this.version=TF,this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Ao(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Ao(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=ri(e,this.name),this.core=r}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,V3(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?G3(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class CU extends HR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new qi.EventEmitter,this.name=DF,this.queue=new Map,this.publishTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.failedPublishTimeout=mt.toMiliseconds(mt.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||RF,u=u1(s),l=(s==null?void 0:s.prompt)||!1,d=(s==null?void 0:s.tag)||0,g=(s==null?void 0:s.id)||sc().toString(),y={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:d,id:g,attestation:s==null?void 0:s.attestation}},A=`Failed to publish payload, please try again. id:${g} tag:${d}`,P=Date.now();let N,D=1;try{for(;N===void 0;){if(Date.now()-P>this.publishTimeout)throw new Error(A);this.logger.trace({id:g,attempts:D},`publisher.publish - attempt ${D}`),N=await await Au(this.rpcPublish(n,i,a,u,l,d,g,s==null?void 0:s.attestation).catch(k=>this.logger.warn(k)),this.publishTimeout,A),D++,N||await new Promise(k=>setTimeout(k,this.failedPublishTimeout))}this.relayer.events.emit(ii.publish,y),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:g,topic:n,message:i,opts:s}})}catch(k){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(k),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw k;this.queue.set(g,y)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=ri(r,this.name),this.registerEventListeners()}get context(){return gi(this.logger)}rpcPublish(e,r,n,i,s,o,a,u){var l,d,g,y;const A={method:_l(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:u},id:a};return bi((l=A.params)==null?void 0:l.prompt)&&((d=A.params)==null||delete d.prompt),bi((g=A.params)==null?void 0:g.tag)&&((y=A.params)==null||delete y.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:A}),this.relayer.request(A)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(iu.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ii.connection_stalled);return}this.checkQueue()}),this.relayer.on(ii.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class TU{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var RU=Object.defineProperty,DU=Object.defineProperties,OU=Object.getOwnPropertyDescriptors,l6=Object.getOwnPropertySymbols,NU=Object.prototype.hasOwnProperty,LU=Object.prototype.propertyIsEnumerable,h6=(t,e,r)=>e in t?RU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rl=(t,e)=>{for(var r in e||(e={}))NU.call(e,r)&&h6(t,r,e[r]);if(l6)for(var r of l6(e))LU.call(e,r)&&h6(t,r,e[r]);return t},w1=(t,e)=>DU(t,OU(e));class kU extends VR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new TU,this.events=new qi.EventEmitter,this.name=FF,this.version=jF,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Ws,this.subscribeTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=u1(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new mt.Watch;a.start(i);const u=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(u),a.stop(i),s(!0)),a.elapsed(i)>=UF&&(clearInterval(u),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ri(r,this.name),this.clientId=""}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=u1(n);await this.rpcUnsubscribe(e,r,i);const s=Dr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===Wr.relay&&await this.restartToComplete();const s={method:_l(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=Ao(e+this.clientId);if((n==null?void 0:n.transportType)===Wr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},mt.toMiliseconds(mt.ONE_SECOND)),a;const u=await Au(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return u?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ii.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Au(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Au(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:_l(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,w1(Rl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Rl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Rl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Ks.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Ks.deleted,w1(Rl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Ks.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);ic(r)&&this.onBatchSubscribe(r.map((n,i)=>w1(Rl({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(iu.pulse,async()=>{await this.checkPending()}),this.events.on(Ks.created,async e=>{const r=Ks.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Ks.deleted,async e=>{const r=Ks.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var BU=Object.defineProperty,d6=Object.getOwnPropertySymbols,$U=Object.prototype.hasOwnProperty,FU=Object.prototype.propertyIsEnumerable,p6=(t,e,r)=>e in t?BU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,g6=(t,e)=>{for(var r in e||(e={}))$U.call(e,r)&&p6(t,r,e[r]);if(d6)for(var r of d6(e))FU.call(e,r)&&p6(t,r,e[r]);return t};class jU extends WR{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new qi.EventEmitter,this.name=NF,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=mt.toMiliseconds(mt.THIRTY_SECONDS+mt.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||sc().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(u,l)=>{const d=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Xi.disconnect,d);const g=await o;this.provider.off(Xi.disconnect,d),u(g)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(jd())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(ii.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ii.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Xi.payload,this.onPayloadHandler),this.provider.on(Xi.connect,this.onConnectHandler),this.provider.on(Xi.disconnect,this.onDisconnectHandler),this.provider.on(Xi.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ri(e.logger,this.name):Qf(od({level:e.logger||OF})),this.messages=new IU(this.logger,e.core),this.subscriber=new kU(this,this.logger),this.publisher=new CU(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||K_,this.projectId=e.projectId,this.bundleId=mB(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return gi(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Wr.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",u;const l=d=>{d.topic===e&&(this.subscriber.off(Ks.created,l),u())};return await Promise.all([new Promise(d=>{u=d,this.subscriber.on(Ks.created,l)}),new Promise(async(d,g)=>{a=await this.subscriber.subscribe(e,g6({internal:{throwOnFailedPublish:o}},r)).catch(y=>{o&&g(y)})||a,d()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Au(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Xi.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Xi.disconnect,i),await Au(this.provider.connect(),mt.toMiliseconds(mt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await M_())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=En(mt.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(ii.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(jd())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Ji(new wF(wB({sdkVersion:m1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),g1(e)){if(!e.method.endsWith(LF))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:Wr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(g6({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else Yd(e)&&this.events.emit(ii.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ii.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Vd(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Xi.payload,this.onPayloadHandler),this.provider.off(Xi.connect,this.onConnectHandler),this.provider.off(Xi.disconnect,this.onDisconnectHandler),this.provider.off(Xi.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await M_();X$(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(ii.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},mt.toMiliseconds(kF))))}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var UU=Object.defineProperty,m6=Object.getOwnPropertySymbols,qU=Object.prototype.hasOwnProperty,zU=Object.prototype.propertyIsEnumerable,v6=(t,e,r)=>e in t?UU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b6=(t,e)=>{for(var r in e||(e={}))qU.call(e,r)&&v6(t,r,e[r]);if(m6)for(var r of m6(e))zU.call(e,r)&&v6(t,r,e[r]);return t};class uc extends KR{constructor(e,r,n,i=Ws,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=BF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!bi(o)?this.map.set(this.getKey(o),o):I$(o)?this.map.set(o.id,o):C$(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>_F(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const u=b6(b6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=ri(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class HU{constructor(e,r){this.core=e,this.logger=r,this.name=qF,this.version=zF,this.events=new Yg,this.initialized=!1,this.storagePrefix=Ws,this.ignoredPayloadTypes=[So],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=c1(),s=await this.core.crypto.setSymKey(i),o=En(mt.FIVE_MINUTES),a={protocol:W_},u={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=y_({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(oc.create,u),this.core.expirer.set(s,o),await this.pairings.set(s,u),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Vs.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:u,methods:l}=b_(n.uri);i.props.properties.topic=s,i.addTrace(Vs.pairing_uri_validation_success),i.addTrace(Vs.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(Vs.existing_pairing),d.active)throw i.setError(Io.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Vs.pairing_not_expired)}const g=u||En(mt.FIVE_MINUTES),y={topic:s,relay:a,expiry:g,active:!1,methods:l};this.core.expirer.set(s,g),await this.pairings.set(s,y),i.addTrace(Vs.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(oc.create,y),i.addTrace(Vs.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Vs.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Io.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(A){throw i.setError(Io.subscribe_pairing_topic_failure),A}return i.addTrace(Vs.subscribe_pairing_topic_success),y},this.activate=async({topic:n})=>{this.isInitialized();const i=En(mt.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=tc();this.events.once(vr("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Dr("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,u=this.core.crypto.keychain.get(i);return y_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:u,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=da(i,s),a=await this.core.crypto.encode(n,o),u=Ml[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{const o=Vd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=Gd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method]?Ml[u.request.method].res:Ml.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Dr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>fa(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(oc.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{Hs(i)?this.events.emit(vr("pairing_ping",s),{}):Yi(i)&&this.events.emit(vr("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(oc.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Dr("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Dr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!yi(n)){const{message:a}=ut("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!M$(n.uri)){const{message:a}=ut("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}const o=b_(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&mt.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!an(n,!1)){const{message:i}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(fa(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ut("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=ri(r,this.name),this.pairings=new uc(this.core,this.logger,this.name,this.storagePrefix)}get context(){return gi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ii.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===Wr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{g1(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):Yd(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Zi.expired,async e=>{const{topic:r}=J3(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(oc.expire,{topic:r}))})}}class WU extends qR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new qi.EventEmitter,this.name=HF,this.version=WF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:En(mt.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(bs.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Yi(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(bs.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(bs.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:da(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(bs.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(bs.created,e=>{const r=bs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.updated,e=>{const r=bs.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.deleted,e=>{const r=bs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(iu.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{mt.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(bs.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class KU extends GR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new qi.EventEmitter,this.name=KF,this.version=VF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Zi.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Zi.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return xB(e);if(typeof e=="number")return _B(e);const{message:r}=ut("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Zi.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;mt.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Zi.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(iu.pulse,()=>this.checkExpirations()),this.events.on(Zi.created,e=>{const r=Zi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.expired,e=>{const r=Zi.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.deleted,e=>{const r=Zi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class VU extends YR{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=GF,this.verifyUrlV3=JF,this.storagePrefix=Ws,this.version=q_,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&mt.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!pl()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,u=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=nl(),d=this.startAbortTimer(mt.ONE_SECOND*5),g=await new Promise((y,A)=>{const P=()=>{window.removeEventListener("message",D),l.body.removeChild(N),A("attestation aborted")};this.abortController.signal.addEventListener("abort",P);const N=l.createElement("iframe");N.src=u,N.style.display="none",N.addEventListener("error",P,{signal:this.abortController.signal});const D=k=>{if(k.data&&typeof k.data=="string")try{const B=JSON.parse(k.data);if(B.type==="verify_attestation"){if(gm(B.attestation).payload.id!==o)return;clearInterval(d),l.body.removeChild(N),this.abortController.signal.removeEventListener("abort",P),window.removeEventListener("message",D),y(B.attestation===null?"":B.attestation)}}catch(B){this.logger.warn(B)}};l.body.appendChild(N),window.addEventListener("message",D,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",g),g}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(gm(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const u=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,u)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(mt.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Il;return XF.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Il}`),s=Il),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(mt.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=c$(i,s.publicKey),a={hasExpired:mt.toMiliseconds(o.exp)this.abortController.abort(),mt.toMiliseconds(e))}}class GU extends JR{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=ZF,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${QF}/${this.projectId}/clients`;await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=ri(r,this.context)}}var YU=Object.defineProperty,y6=Object.getOwnPropertySymbols,JU=Object.prototype.hasOwnProperty,XU=Object.prototype.propertyIsEnumerable,w6=(t,e,r)=>e in t?YU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dl=(t,e)=>{for(var r in e||(e={}))JU.call(e,r)&&w6(t,r,e[r]);if(y6)for(var r of y6(e))XU.call(e,r)&&w6(t,r,e[r]);return t};class ZU extends XR{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=tj,this.storagePrefix=Ws,this.storageVersion=ej,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!i1())try{const i={eventId:Z3(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:K3(this.core.relayer.protocol,this.core.relayer.version,m1)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:u}}=i,l=Z3(),d=this.core.projectId||"",g=Date.now(),y=Dl({eventId:l,timestamp:g,props:{event:s,type:o,properties:{topic:a,trace:u}},bundleId:d,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,y),this.shouldPersist=!0),y},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(u=>u.props.properties.topic===o);if(a)return Dl(Dl({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(iu.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{mt.fromMiliseconds(Date.now())-mt.fromMiliseconds(i.timestamp)>rj&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Dl(Dl({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${nj}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${m1}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>W3().url,this.logger=ri(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var QU=Object.defineProperty,x6=Object.getOwnPropertySymbols,eq=Object.prototype.hasOwnProperty,tq=Object.prototype.propertyIsEnumerable,_6=(t,e,r)=>e in t?QU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,E6=(t,e)=>{for(var r in e||(e={}))eq.call(e,r)&&_6(t,r,e[r]);if(x6)for(var r of x6(e))tq.call(e,r)&&_6(t,r,e[r]);return t};class x1 extends UR{constructor(e){var r;super(e),this.protocol=U_,this.version=q_,this.name=z_,this.events=new qi.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:u})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:Wr.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||K_,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=od({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:EF.logger}),{logger:i,chunkLoggerController:s}=jR({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ri(i,this.name),this.heartbeat=new NT,this.crypto=new MU(this,this.logger,e==null?void 0:e.keychain),this.history=new WU(this,this.logger),this.expirer=new KU(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new hR(E6(E6({},SF),e==null?void 0:e.storageOptions)),this.relayer=new jU({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new HU(this,this.logger),this.verify=new VU(this,this.logger,this.storage),this.echoClient=new GU(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new ZU(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new x1(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem($F,n),r}get context(){return gi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(V_,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(V_)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const rq=x1,S6="wc",A6=2,P6="client",_1=`${S6}@${A6}:${P6}:`,E1={name:P6,logger:"error"},M6="WALLETCONNECT_DEEPLINK_CHOICE",nq="proposal",I6="Proposal expired",iq="session",Mu=mt.SEVEN_DAYS,sq="engine",kn={wc_sessionPropose:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:mt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:mt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1119}}},S1={min:mt.FIVE_MINUTES,max:mt.SEVEN_DAYS},Gs={idle:"IDLE",active:"ACTIVE"},oq="request",aq=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],cq="wc",uq="auth",fq="authKeys",lq="pairingTopics",hq="requests",Zd=`${cq}@${1.5}:${uq}:`,Qd=`${Zd}:PUB_KEY`;var dq=Object.defineProperty,pq=Object.defineProperties,gq=Object.getOwnPropertyDescriptors,C6=Object.getOwnPropertySymbols,mq=Object.prototype.hasOwnProperty,vq=Object.prototype.propertyIsEnumerable,T6=(t,e,r)=>e in t?dq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))mq.call(e,r)&&T6(t,r,e[r]);if(C6)for(var r of C6(e))vq.call(e,r)&&T6(t,r,e[r]);return t},ws=(t,e)=>pq(t,gq(e));class bq extends QR{constructor(e){super(e),this.name=sq,this.events=new Yg,this.initialized=!1,this.requestQueue={state:Gs.idle,queue:[]},this.sessionRequestQueue={state:Gs.idle,queue:[]},this.requestQueueDelay=mt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(kn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=ws(tn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n;let l=i,d,g=!1;try{l&&(g=this.client.core.pairing.pairings.get(l).active)}catch(U){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),U}if(!l||!g){const{topic:U,uri:K}=await this.client.core.pairing.create();l=U,d=K}if(!l){const{message:U}=ut("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(U)}const y=await this.client.core.crypto.generateKeyPair(),A=kn.wc_sessionPropose.req.ttl||mt.FIVE_MINUTES,P=En(A),N=tn({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:W_}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:P,pairingTopic:l},a&&{sessionProperties:a}),{reject:D,resolve:k,done:B}=tc(A,I6);this.events.once(vr("session_connect"),async({error:U,session:K})=>{if(U)D(U);else if(K){K.self.publicKey=y;const J=ws(tn({},K),{pairingTopic:N.pairingTopic,requiredNamespaces:N.requiredNamespaces,optionalNamespaces:N.optionalNamespaces,transportType:Wr.relay});await this.client.session.set(K.topic,J),await this.setExpiry(K.topic,K.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:K.peer.metadata}),this.cleanupDuplicatePairings(J),k(J)}});const j=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:N,throwOnFailedPublish:!0});return await this.setProposal(j,tn({id:j},N)),{uri:d,approval:B}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[ys.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(z){throw o.setError(ac.no_internet_connection),z}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(z){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(ac.proposal_not_found),z}try{await this.isValidApprove(r)}catch(z){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(ac.session_approve_namespace_validation_failure),z}const{id:a,relayProtocol:u,namespaces:l,sessionProperties:d,sessionConfig:g}=r,y=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:A,proposer:P,requiredNamespaces:N,optionalNamespaces:D}=y;let k=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:A});k||(k=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:ys.session_approve_started,properties:{topic:A,trace:[ys.session_approve_started,ys.session_namespaces_validation_success]}}));const B=await this.client.core.crypto.generateKeyPair(),j=P.publicKey,U=await this.client.core.crypto.generateSharedKey(B,j),K=tn(tn({relay:{protocol:u??"irn"},namespaces:l,controller:{publicKey:B,metadata:this.client.metadata},expiry:En(Mu)},d&&{sessionProperties:d}),g&&{sessionConfig:g}),J=Wr.relay;k.addTrace(ys.subscribing_session_topic);try{await this.client.core.relayer.subscribe(U,{transportType:J})}catch(z){throw k.setError(ac.subscribe_session_topic_failure),z}k.addTrace(ys.subscribe_session_topic_success);const T=ws(tn({},K),{topic:U,requiredNamespaces:N,optionalNamespaces:D,pairingTopic:A,acknowledged:!1,self:K.controller,peer:{publicKey:P.publicKey,metadata:P.metadata},controller:B,transportType:Wr.relay});await this.client.session.set(U,T),k.addTrace(ys.store_session);try{k.addTrace(ys.publishing_session_settle),await this.sendRequest({topic:U,method:"wc_sessionSettle",params:K,throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(ac.session_settle_publish_failure),z}),k.addTrace(ys.session_settle_publish_success),k.addTrace(ys.publishing_session_approve),await this.sendResult({id:a,topic:A,result:{relay:{protocol:u??"irn"},responderPublicKey:B},throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(ac.session_approve_publish_failure),z}),k.addTrace(ys.session_approve_publish_success)}catch(z){throw this.client.logger.error(z),this.client.session.delete(U,Dr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(U),z}return this.client.core.eventClient.deleteEvent({eventId:k.eventId}),await this.client.core.pairing.updateMetadata({topic:A,metadata:P.metadata}),await this.client.proposal.delete(a,Dr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:A}),await this.setExpiry(U,En(Mu)),{topic:U,acknowledged:()=>Promise.resolve(this.client.session.get(U))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:kn.wc_sessionPropose.reject}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(g){throw this.client.logger.error("update() -> isValidUpdate() failed"),g}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=tc(),u=ha(),l=sc().toString(),d=this.client.session.get(n).namespaces;return this.events.once(vr("session_update",u),({error:g})=>{g?a(g):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:u,relayRpcId:l}).catch(g=>{this.client.logger.error(g),this.client.session.update(n,{namespaces:d}),a(g)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(u){throw this.client.logger.error("extend() -> isValidExtend() failed"),u}const{topic:n}=r,i=ha(),{done:s,resolve:o,reject:a}=tc();return this.events.once(vr("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,En(Mu)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(u=>{a(u)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(P){throw this.client.logger.error("request() -> isValidRequest() failed"),P}const{chainId:n,request:i,topic:s,expiry:o=kn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=ha(),l=sc().toString(),{done:d,resolve:g,reject:y}=tc(o,"Request expired. Please try again.");this.events.once(vr("session_request",u),({error:P,result:N})=>{P?y(P):g(N)});const A=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return A?(await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:A}).catch(P=>y(P)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),await d()):await Promise.all([new Promise(async P=>{await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(N=>y(N)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),P()}),new Promise(async P=>{var N;if(!((N=a.sessionConfig)!=null&&N.disableDeepLink)){const D=await AB(this.client.core.storage,M6);await EB({id:u,topic:s,wcDeepLink:D})}P()}),d()]).then(P=>P[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);Hs(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Yi(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=ha(),s=sc().toString(),{done:o,resolve:a,reject:u}=tc();this.events.once(vr("session_ping",i),({error:l})=>{l?u(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=sc().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Dr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ut("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>A$(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?Wr.link_mode:Wr.relay;o===Wr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:u="",uri:l,domain:d,nonce:g,type:y,exp:A,nbf:P,methods:N=[],expiry:D}=r,k=[...r.resources||[]],{topic:B,uri:j}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:B,uri:j}});const U=await this.client.core.crypto.generateKeyPair(),K=Hd(U);if(await Promise.all([this.client.auth.authKeys.set(Qd,{responseTopic:K,publicKey:U}),this.client.auth.pairingTopics.set(K,{topic:K,pairingTopic:B})]),await this.client.core.relayer.subscribe(K,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${B}`),N.length>0){const{namespace:_}=Eu(a[0]);let S=KB(_,"request",N);zd(k)&&(S=GB(S,k.pop())),k.push(S)}const J=D&&D>kn.wc_sessionAuthenticate.req.ttl?D:kn.wc_sessionAuthenticate.req.ttl,T={authPayload:{type:y??"caip122",chains:a,statement:u,aud:l,domain:d,version:"1",nonce:g,iat:new Date().toISOString(),exp:A,nbf:P,resources:k},requester:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(J)},z={eip155:{chains:a,methods:[...new Set(["personal_sign",...N])],events:["chainChanged","accountsChanged"]}},ue={requiredNamespaces:{},optionalNamespaces:z,relays:[{protocol:"irn"}],pairingTopic:B,proposer:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(kn.wc_sessionPropose.req.ttl)},{done:_e,resolve:G,reject:E}=tc(J,"Request expired"),m=async({error:_,session:S})=>{if(this.events.off(vr("session_request",p),f),_)E(_);else if(S){S.self.publicKey=U,await this.client.session.set(S.topic,S),await this.setExpiry(S.topic,S.expiry),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:S.peer.metadata});const b=this.client.session.get(S.topic);await this.deleteProposal(v),G({session:b})}},f=async _=>{var S,b,M;if(await this.deletePendingAuthRequest(p,{message:"fulfilled",code:0}),_.error){const X=Dr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return _.error.code===X.code?void 0:(this.events.off(vr("session_connect"),m),E(_.error.message))}await this.deleteProposal(v),this.events.off(vr("session_connect"),m);const{cacaos:I,responder:F}=_.result,ae=[],O=[];for(const X of I){await r_({cacao:X,projectId:this.client.core.projectId})||(this.client.logger.error(X,"Signature verification failed"),E(Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Q}=X,R=zd(Q.resources),Z=[o1(Q.iss)],te=qd(Q.iss);if(R){const le=s_(R),ie=o_(R);ae.push(...le),Z.push(...ie)}for(const le of Z)O.push(`${le}:${te}`)}const se=await this.client.core.crypto.generateSharedKey(U,F.publicKey);let ee;ae.length>0&&(ee={topic:se,acknowledged:!0,self:{publicKey:U,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:En(Mu),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:B,namespaces:w_([...new Set(ae)],[...new Set(O)]),transportType:o},await this.client.core.relayer.subscribe(se,{transportType:o}),await this.client.session.set(se,ee),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:F.metadata}),ee=this.client.session.get(se)),(S=this.client.metadata.redirect)!=null&&S.linkMode&&(b=F.metadata.redirect)!=null&&b.linkMode&&(M=F.metadata.redirect)!=null&&M.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(se,{transportType:Wr.link_mode})),G({auths:I,session:ee})},p=ha(),v=ha();this.events.once(vr("session_connect"),m),this.events.once(vr("session_request",p),f);let x;try{if(s){const _=da("wc_sessionAuthenticate",T,p);this.client.core.history.set(B,_);const S=await this.client.core.crypto.encode("",_,{type:yl,encoding:vl});x=Wd(n,B,S)}else await Promise.all([this.sendRequest({topic:B,method:"wc_sessionAuthenticate",params:T,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:p}),this.sendRequest({topic:B,method:"wc_sessionPropose",params:ue,expiry:kn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:v})])}catch(_){throw this.events.off(vr("session_connect"),m),this.events.off(vr("session_request",p),f),_}return await this.setProposal(v,tn({id:v},ue)),await this.setAuthRequest(p,{request:ws(tn({},T),{verifyContext:{}}),pairingTopic:B,transportType:o}),{uri:x??j,response:_e}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[cc.authenticated_session_approve_started]}});try{this.isInitialized()}catch(D){throw s.setError(Cl.no_internet_connection),D}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Cl.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||Wr.relay;a===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=Hd(u),g={type:So,receiverPublicKey:u,senderPublicKey:l},y=[],A=[];for(const D of i){if(!await r_({cacao:D,projectId:this.client.core.projectId})){s.setError(Cl.invalid_cacao);const K=Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:K,encodeOpts:g}),new Error(K.message)}s.addTrace(cc.cacaos_verified);const{p:k}=D,B=zd(k.resources),j=[o1(k.iss)],U=qd(k.iss);if(B){const K=s_(B),J=o_(B);y.push(...K),j.push(...J)}for(const K of j)A.push(`${K}:${U}`)}const P=await this.client.core.crypto.generateSharedKey(l,u);s.addTrace(cc.create_authenticated_session_topic);let N;if((y==null?void 0:y.length)>0){N={topic:P,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:u,metadata:o.requester.metadata},controller:u,expiry:En(Mu),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:w_([...new Set(y)],[...new Set(A)]),transportType:a},s.addTrace(cc.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(P,{transportType:a})}catch(D){throw s.setError(Cl.subscribe_authenticated_session_topic_failure),D}s.addTrace(cc.subscribe_authenticated_session_topic_success),await this.client.session.set(P,N),s.addTrace(cc.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(cc.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:g,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(D){throw s.setError(Cl.authenticated_session_approve_publish_failure),D}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:N}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),u=Hd(o),l={type:So,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:u,error:i,encodeOpts:l,rpcOpts:kn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return n_(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:u}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Dr("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(M6).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,Dr("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Gs.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(ac.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Dr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Gs.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,En(kn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=Wr.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||En(kn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l,appLink:d}=r,g=da(i,s,u);let y;const A=!!d;try{const D=A?vl:la;y=await this.client.core.crypto.encode(n,g,{encoding:D})}catch(D){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),D}let P;if(aq.includes(i)){const D=Ao(JSON.stringify(g)),k=Ao(y);P=await this.client.core.verify.register({id:k,decryptedId:D})}const N=kn[i].req;if(N.attestation=P,o&&(N.ttl=o),a&&(N.id=a),this.client.core.history.set(n,g),A){const D=Wd(d,n,y);await global.Linking.openURL(D,this.client.name)}else{const D=kn[i].req;o&&(D.ttl=o),a&&(D.id=a),l?(D.internal=ws(tn({},D.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,y,D)):this.client.core.relayer.publish(n,y,D).catch(k=>this.client.logger.error(k))}return g.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:u}=r,l=Vd(n,s);let d;const g=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=g?vl:la;d=await this.client.core.crypto.encode(i,l,ws(tn({},a||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),A}if(g){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=kn[y.request.method].res;o?(A.internal=ws(tn({},A.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,A)):this.client.core.relayer.publish(i,d,A).catch(P=>this.client.logger.error(P))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:u}=r,l=Gd(n,s);let d;const g=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=g?vl:la;d=await this.client.core.crypto.encode(i,l,ws(tn({},o||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),A}if(g){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=a||kn[y.request.method].res;this.client.core.relayer.publish(i,d,A)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;fa(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{fa(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Gs.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Gs.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Gs.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,u=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:u}))switch(u){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=ut("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:u}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(tn({},i.params));const d=a.expiryTimestamp||En(kn.wc_sessionPropose.req.ttl),g=tn({id:u,pairingTopic:n,expiryTimestamp:d},a);await this.setProposal(u,g);const y=await this.getVerifyContext({attestationId:s,hash:Ao(JSON.stringify(i)),encryptedId:o,metadata:g.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(Io.proposal_listener_not_found)),l==null||l.addTrace(Vs.emit_session_proposal),this.client.events.emit("session_proposal",{id:u,params:g,verifyContext:y})}catch(l){await this.sendError({id:u,topic:n,error:l,rpcOpts:kn.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(Hs(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const u=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const d=await this.client.core.crypto.generateSharedKey(u,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:d});const g=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:g}),await this.client.core.pairing.activate({topic:r})}else if(Yi(n)){await this.client.proposal.delete(s,Dr("USER_DISCONNECTED"));const o=vr("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(vr("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:u,namespaces:l,sessionProperties:d,sessionConfig:g}=n.params,y=ws(tn(tn({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},d&&{sessionProperties:d}),g&&{sessionConfig:g}),{transportType:Wr.relay}),A=vr("session_connect");if(this.events.listenerCount(A)===0)throw new Error(`emitting ${A} without any listeners 997`);this.events.emit(vr("session_connect"),{session:y}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;Hs(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(vr("session_approve",i),{})):Yi(n)&&(await this.client.session.delete(r,Dr("USER_DISCONNECTED")),this.events.emit(vr("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Dr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(tn({topic:r},i));try{Al.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(u){throw Al.delete(o),u}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=vr("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_update",i),{}):Yi(n)&&this.events.emit(vr("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,En(Mu)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=vr("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_extend",i),{}):Yi(n)&&this.events.emit(vr("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=vr("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{Hs(n)?this.events.emit(vr("session_ping",i),{}):Yi(n)&&this.events.emit(vr("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(ii.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Dr("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:u,encryptedId:l,transportType:d}=r,{id:g,params:y}=a;try{await this.isValidRequest(tn({topic:o},y));const A=this.client.session.get(o),P=await this.getVerifyContext({attestationId:u,hash:Ao(JSON.stringify(da("wc_sessionRequest",y,g))),encryptedId:l,metadata:A.peer.metadata,transportType:d}),N={id:g,topic:o,params:y,verifyContext:P};await this.setPendingSessionRequest(N),d===Wr.link_mode&&(n=A.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=A.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(N):(this.addSessionRequestToSessionRequestQueue(N),this.processSessionRequestQueue())}catch(A){await this.sendError({id:g,topic:o,error:A}),this.client.logger.error(A)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=vr("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(tn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Al.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:u}=r;try{const{requester:l,authPayload:d,expiryTimestamp:g}=s.params,y=await this.getVerifyContext({attestationId:o,hash:Ao(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:u}),A={requester:l,pairingTopic:i,id:s.id,authPayload:d,verifyContext:y,expiryTimestamp:g};await this.setAuthRequest(s.id,{request:A,pairingTopic:i,transportType:u}),u===Wr.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:y})}catch(l){this.client.logger.error(l);const d=s.params.requester.publicKey,g=await this.client.core.crypto.generateKeyPair(),y=this.getAppLinkIfEnabled(s.params.requester.metadata,u),A={type:So,receiverPublicKey:d,senderPublicKey:g};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:A,rpcOpts:kn.wc_sessionAuthenticate.autoReject,appLink:y})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Gs.idle,this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=vr("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(vr("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Gs.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Gs.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:da("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(bi(n)||await this.isValidPairingTopic(n),!B$(a)){const{message:u}=ut("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!bi(i)&&Sl(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!bi(s)&&Sl(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),bi(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=k$(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!yi(r))throw new Error(ut("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),u=h1(i,"approve()");if(u)throw new Error(u.message);const l=A_(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!an(s,!0)){const{message:d}=ut("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}bi(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!yi(r)){const{message:s}=ut("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!F$(i)){const{message:s}=ut("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!yi(r)){const{message:l}=ut("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!E_(n)){const{message:l}=ut("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=T$(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const u=h1(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(fa(o)){const{message:l}=ut("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=h1(i,"update()");if(o)throw new Error(o.message);const a=A_(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!S_(a,s)){const{message:u}=ut("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!j$(i)){const{message:u}=ut("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!z$(a,s,i.method)){const{message:u}=ut("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!V$(o,S1)){const{message:u}=ut("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${S1.min} and ${S1.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!yi(r)){const{message:o}=ut("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!U$(s)){const{message:o}=ut("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!yi(r)){const{message:a}=ut("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!S_(o,s)){const{message:a}=ut("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!q$(i)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!H$(o,s,i.name)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!an(i,!1))throw new Error("uri is required parameter");if(!an(s,!1))throw new Error("domain is required parameter");if(!an(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(u=>Eu(u).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Eu(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,u={verified:{verifyUrl:o.verifyUrl||Il,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Wr.link_mode){const d=this.getAppLinkIfEnabled(o,a);return u.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",u}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(u.verified.origin=l.origin,u.verified.isScam=l.isScam,u.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(u)}`),u},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!an(i,!1)){const{message:s}=ut("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,u,l,d,g,y;return!r||n!==Wr.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(u=this.client.metadata)==null?void 0:u.redirect)==null?void 0:l.universal)!==""&&((d=r==null?void 0:r.redirect)==null?void 0:d.universal)!==void 0&&((g=r==null?void 0:r.redirect)==null?void 0:g.universal)!==""&&((y=r==null?void 0:r.redirect)==null?void 0:y.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=X3(r,"topic")||"",i=decodeURIComponent(X3(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:Wr.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(i1()||Su()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ii.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(Qd)?this.client.auth.authKeys.get(Qd):{publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===Wr.link_mode?vl:la});try{g1(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:Ao(n)})):Yd(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(u){this.client.logger.error(u)}}registerExpirerEvents(){this.client.core.expirer.on(Zi.expired,async e=>{const{topic:r,id:n}=J3(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ut("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,ut("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(oc.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(oc.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=ut("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=ut("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=ut("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(an(e,!1)){const{message:r}=ut("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=ut("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!$$(e)){const{message:r}=ut("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=ut("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class yq extends uc{constructor(e,r){super(e,r,nq,_1),this.core=e,this.logger=r}}let wq=class extends uc{constructor(e,r){super(e,r,iq,_1),this.core=e,this.logger=r}};class xq extends uc{constructor(e,r){super(e,r,oq,_1,n=>n.id),this.core=e,this.logger=r}}class _q extends uc{constructor(e,r){super(e,r,fq,Zd,()=>Qd),this.core=e,this.logger=r}}class Eq extends uc{constructor(e,r){super(e,r,lq,Zd),this.core=e,this.logger=r}}class Sq extends uc{constructor(e,r){super(e,r,hq,Zd,n=>n.id),this.core=e,this.logger=r}}class Aq{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new _q(this.core,this.logger),this.pairingTopics=new Eq(this.core,this.logger),this.requests=new Sq(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class A1 extends ZR{constructor(e){super(e),this.protocol=S6,this.version=A6,this.name=E1.name,this.events=new qi.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||E1.name,this.metadata=(e==null?void 0:e.metadata)||W3(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||E1.logger}));this.core=(e==null?void 0:e.core)||new rq(e),this.logger=ri(r,this.name),this.session=new wq(this.core,this.logger),this.proposal=new yq(this.core,this.logger),this.pendingRequest=new xq(this.core,this.logger),this.engine=new bq(this),this.auth=new Aq(this.core,this.logger)}static async init(e){const r=new A1(e);return await r.initialize(),r}get context(){return gi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var e0={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */e0.exports,function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",l=500,d="__lodash_placeholder__",g=1,y=2,A=4,P=1,O=2,D=1,k=2,B=4,j=8,U=16,K=32,J=64,T=128,z=256,ue=512,_e=30,G="...",E=800,m=16,f=1,p=2,v=3,x=1/0,_=9007199254740991,S=17976931348623157e292,b=NaN,M=4294967295,I=M-1,F=M>>>1,ae=[["ary",T],["bind",D],["bindKey",k],["curry",j],["curryRight",U],["flip",ue],["partial",K],["partialRight",J],["rearg",z]],N="[object Arguments]",se="[object Array]",ee="[object AsyncFunction]",X="[object Boolean]",Q="[object Date]",R="[object DOMException]",Z="[object Error]",te="[object Function]",he="[object GeneratorFunction]",ie="[object Map]",fe="[object Number]",ve="[object Null]",Me="[object Object]",Ne="[object Promise]",Te="[object Proxy]",$e="[object RegExp]",Ie="[object Set]",Le="[object String]",Ve="[object Symbol]",ke="[object Undefined]",ze="[object WeakMap]",He="[object WeakSet]",Ee="[object ArrayBuffer]",Qe="[object DataView]",ct="[object Float32Array]",Be="[object Float64Array]",et="[object Int8Array]",rt="[object Int16Array]",Je="[object Int32Array]",pt="[object Uint8Array]",ht="[object Uint8ClampedArray]",ft="[object Uint16Array]",Ht="[object Uint32Array]",Jt=/\b__p \+= '';/g,St=/\b(__p \+=) '' \+/g,er=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Xt=/&(?:amp|lt|gt|quot|#39);/g,Ot=/[&<>"']/g,Bt=RegExp(Xt.source),Tt=RegExp(Ot.source),vt=/<%-([\s\S]+?)%>/g,Dt=/<%([\s\S]+?)%>/g,Lt=/<%=([\s\S]+?)%>/g,bt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$t=/^\w*$/,jt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(nt.source),$=/^\s+/,H=/\s/,V=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C=/\{\n\/\* \[wrapped with (.+)\] \*/,Y=/,? & /,q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,oe=/[()=,{}\[\]\/\s]/,ge=/\\(\\)?/g,xe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Re=/\w*$/,De=/^[-+]0x[0-9a-f]+$/i,it=/^0b[01]+$/i,Ue=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,st=/^(?:0|[1-9]\d*)$/,tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,Rt=/['\n\r\u2028\u2029\\]/g,Mt="\\ud800-\\udfff",Et="\\u0300-\\u036f",dt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",ot=Et+dt+_t,wt="\\u2700-\\u27bf",lt="a-z\\xdf-\\xf6\\xf8-\\xff",at="\\xac\\xb1\\xd7\\xf7",Ae="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Pe="\\u2000-\\u206f",Ge=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="A-Z\\xc0-\\xd6\\xd8-\\xde",qe="\\ufe0e\\ufe0f",Xe=at+Ae+Pe+Ge,kt="['’]",Wt="["+Mt+"]",Zt="["+Xe+"]",Kt="["+ot+"]",pe="\\d+",nr="["+wt+"]",dr="["+lt+"]",pr="[^"+Mt+Xe+pe+wt+lt+je+"]",Qt="\\ud83c[\\udffb-\\udfff]",gr="(?:"+Kt+"|"+Qt+")",lr="[^"+Mt+"]",Lr="(?:\\ud83c[\\udde6-\\uddff]){2}",mr="[\\ud800-\\udbff][\\udc00-\\udfff]",wr="["+je+"]",Br="\\u200d",$r="(?:"+dr+"|"+pr+")",Ir="(?:"+wr+"|"+pr+")",hn="(?:"+kt+"(?:d|ll|m|re|s|t|ve))?",dn="(?:"+kt+"(?:D|LL|M|RE|S|T|VE))?",pn=gr+"?",sp="["+qe+"]?",jb="(?:"+Br+"(?:"+[lr,Lr,mr].join("|")+")"+sp+pn+")*",qo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",op="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ap=sp+pn+jb,Qu="(?:"+[nr,Lr,mr].join("|")+")"+ap,Ub="(?:"+[lr+Kt+"?",Kt,Lr,mr,Wt].join("|")+")",gh=RegExp(kt,"g"),qb=RegExp(Kt,"g"),ef=RegExp(Qt+"(?="+Qt+")|"+Ub+ap,"g"),cp=RegExp([wr+"?"+dr+"+"+hn+"(?="+[Zt,wr,"$"].join("|")+")",Ir+"+"+dn+"(?="+[Zt,wr+$r,"$"].join("|")+")",wr+"?"+$r+"+"+hn,wr+"+"+dn,op,qo,pe,Qu].join("|"),"g"),up=RegExp("["+Br+Mt+ot+qe+"]"),Pc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],zb=-1,Fr={};Fr[ct]=Fr[Be]=Fr[et]=Fr[rt]=Fr[Je]=Fr[pt]=Fr[ht]=Fr[ft]=Fr[Ht]=!0,Fr[N]=Fr[se]=Fr[Ee]=Fr[X]=Fr[Qe]=Fr[Q]=Fr[Z]=Fr[te]=Fr[ie]=Fr[fe]=Fr[Me]=Fr[$e]=Fr[Ie]=Fr[Le]=Fr[ze]=!1;var kr={};kr[N]=kr[se]=kr[Ee]=kr[Qe]=kr[X]=kr[Q]=kr[ct]=kr[Be]=kr[et]=kr[rt]=kr[Je]=kr[ie]=kr[fe]=kr[Me]=kr[$e]=kr[Ie]=kr[Le]=kr[Ve]=kr[pt]=kr[ht]=kr[ft]=kr[Ht]=!0,kr[Z]=kr[te]=kr[ze]=!1;var ce={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ye={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye={"&":"&","<":"<",">":">",""":'"',"'":"'"},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},jr=parseFloat,ir=parseInt,Yr=typeof nn=="object"&&nn&&nn.Object===Object&&nn,wn=typeof self=="object"&&self&&self.Object===Object&&self,_r=Yr||wn||Function("return this")(),Ur=e&&!e.nodeType&&e,gn=Ur&&!0&&t&&!t.nodeType&&t,_i=gn&&gn.exports===Ur,xn=_i&&Yr.process,Jr=function(){try{var be=gn&&gn.require&&gn.require("util").types;return be||xn&&xn.binding&&xn.binding("util")}catch{}}(),oi=Jr&&Jr.isArrayBuffer,Ps=Jr&&Jr.isDate,is=Jr&&Jr.isMap,io=Jr&&Jr.isRegExp,mh=Jr&&Jr.isSet,Mc=Jr&&Jr.isTypedArray;function Bn(be,Fe,Ce){switch(Ce.length){case 0:return be.call(Fe);case 1:return be.call(Fe,Ce[0]);case 2:return be.call(Fe,Ce[0],Ce[1]);case 3:return be.call(Fe,Ce[0],Ce[1],Ce[2])}return be.apply(Fe,Ce)}function TQ(be,Fe,Ce,Ct){for(var tr=-1,Mr=be==null?0:be.length;++tr-1}function Hb(be,Fe,Ce){for(var Ct=-1,tr=be==null?0:be.length;++Ct-1;);return Ce}function t9(be,Fe){for(var Ce=be.length;Ce--&&tf(Fe,be[Ce],0)>-1;);return Ce}function FQ(be,Fe){for(var Ce=be.length,Ct=0;Ce--;)be[Ce]===Fe&&++Ct;return Ct}var jQ=Gb(ce),UQ=Gb(ye);function qQ(be){return"\\"+It[be]}function zQ(be,Fe){return be==null?r:be[Fe]}function rf(be){return up.test(be)}function HQ(be){return Pc.test(be)}function WQ(be){for(var Fe,Ce=[];!(Fe=be.next()).done;)Ce.push(Fe.value);return Ce}function Zb(be){var Fe=-1,Ce=Array(be.size);return be.forEach(function(Ct,tr){Ce[++Fe]=[tr,Ct]}),Ce}function r9(be,Fe){return function(Ce){return be(Fe(Ce))}}function Da(be,Fe){for(var Ce=-1,Ct=be.length,tr=0,Mr=[];++Ce-1}function Dee(c,h){var w=this.__data__,L=Ip(w,c);return L<0?(++this.size,w.push([c,h])):w[L][1]=h,this}zo.prototype.clear=Iee,zo.prototype.delete=Cee,zo.prototype.get=Tee,zo.prototype.has=Ree,zo.prototype.set=Dee;function Ho(c){var h=-1,w=c==null?0:c.length;for(this.clear();++h=h?c:h)),c}function cs(c,h,w,L,W,ne){var de,me=h&g,we=h&y,We=h&A;if(w&&(de=W?w(c,L,W,ne):w(c)),de!==r)return de;if(!Qr(c))return c;var Ke=sr(c);if(Ke){if(de=kte(c),!me)return Ei(c,de)}else{var Ze=ti(c),xt=Ze==te||Ze==he;if($a(c))return $9(c,me);if(Ze==Me||Ze==N||xt&&!W){if(de=we||xt?{}:nA(c),!me)return we?Ate(c,Gee(de,c)):Ste(c,p9(de,c))}else{if(!kr[Ze])return W?c:{};de=Bte(c,Ze,me)}}ne||(ne=new Is);var Nt=ne.get(c);if(Nt)return Nt;ne.set(c,de),DA(c)?c.forEach(function(Gt){de.add(cs(Gt,h,w,Gt,c,ne))}):TA(c)&&c.forEach(function(Gt,br){de.set(br,cs(Gt,h,w,br,c,ne))});var Vt=We?we?Sy:Ey:we?Ai:$n,fr=Ke?r:Vt(c);return ss(fr||c,function(Gt,br){fr&&(br=Gt,Gt=c[br]),Eh(de,br,cs(Gt,h,w,br,c,ne))}),de}function Yee(c){var h=$n(c);return function(w){return g9(w,c,h)}}function g9(c,h,w){var L=w.length;if(c==null)return!L;for(c=qr(c);L--;){var W=w[L],ne=h[W],de=c[W];if(de===r&&!(W in c)||!ne(de))return!1}return!0}function m9(c,h,w){if(typeof c!="function")throw new os(o);return Th(function(){c.apply(r,w)},h)}function Sh(c,h,w,L){var W=-1,ne=lp,de=!0,me=c.length,we=[],We=h.length;if(!me)return we;w&&(h=Xr(h,ki(w))),L?(ne=Hb,de=!1):h.length>=i&&(ne=vh,de=!1,h=new Tc(h));e:for(;++WW?0:W+w),L=L===r||L>W?W:ur(L),L<0&&(L+=W),L=w>L?0:NA(L);w0&&w(me)?h>1?Vn(me,h-1,w,L,W):Ra(W,me):L||(W[W.length]=me)}return W}var sy=H9(),y9=H9(!0);function so(c,h){return c&&sy(c,h,$n)}function oy(c,h){return c&&y9(c,h,$n)}function Tp(c,h){return Ta(h,function(w){return Yo(c[w])})}function Dc(c,h){h=ka(h,c);for(var w=0,L=h.length;c!=null&&wh}function Zee(c,h){return c!=null&&Tr.call(c,h)}function Qee(c,h){return c!=null&&h in qr(c)}function ete(c,h,w){return c>=ei(h,w)&&c=120&&Ke.length>=120)?new Tc(de&&Ke):r}Ke=c[0];var Ze=-1,xt=me[0];e:for(;++Ze-1;)me!==c&&xp.call(me,we,1),xp.call(c,we,1);return c}function T9(c,h){for(var w=c?h.length:0,L=w-1;w--;){var W=h[w];if(w==L||W!==ne){var ne=W;Go(W)?xp.call(c,W,1):my(c,W)}}return c}function dy(c,h){return c+Sp(f9()*(h-c+1))}function dte(c,h,w,L){for(var W=-1,ne=Pn(Ep((h-c)/(w||1)),0),de=Ce(ne);ne--;)de[L?ne:++W]=c,c+=w;return de}function py(c,h){var w="";if(!c||h<1||h>_)return w;do h%2&&(w+=c),h=Sp(h/2),h&&(c+=c);while(h);return w}function hr(c,h){return Ry(oA(c,h,Pi),c+"")}function pte(c){return d9(pf(c))}function gte(c,h){var w=pf(c);return Up(w,Rc(h,0,w.length))}function Mh(c,h,w,L){if(!Qr(c))return c;h=ka(h,c);for(var W=-1,ne=h.length,de=ne-1,me=c;me!=null&&++WW?0:W+h),w=w>W?W:w,w<0&&(w+=W),W=h>w?0:w-h>>>0,h>>>=0;for(var ne=Ce(W);++L>>1,de=c[ne];de!==null&&!$i(de)&&(w?de<=h:de=i){var We=h?null:Cte(c);if(We)return dp(We);de=!1,W=vh,we=new Tc}else we=h?[]:me;e:for(;++L=L?c:us(c,h,w)}var B9=oee||function(c){return _r.clearTimeout(c)};function $9(c,h){if(h)return c.slice();var w=c.length,L=s9?s9(w):new c.constructor(w);return c.copy(L),L}function wy(c){var h=new c.constructor(c.byteLength);return new yp(h).set(new yp(c)),h}function wte(c,h){var w=h?wy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.byteLength)}function xte(c){var h=new c.constructor(c.source,Re.exec(c));return h.lastIndex=c.lastIndex,h}function _te(c){return _h?qr(_h.call(c)):{}}function F9(c,h){var w=h?wy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.length)}function j9(c,h){if(c!==h){var w=c!==r,L=c===null,W=c===c,ne=$i(c),de=h!==r,me=h===null,we=h===h,We=$i(h);if(!me&&!We&&!ne&&c>h||ne&&de&&we&&!me&&!We||L&&de&&we||!w&&we||!W)return 1;if(!L&&!ne&&!We&&c=me)return we;var We=w[L];return we*(We=="desc"?-1:1)}}return c.index-h.index}function U9(c,h,w,L){for(var W=-1,ne=c.length,de=w.length,me=-1,we=h.length,We=Pn(ne-de,0),Ke=Ce(we+We),Ze=!L;++me1?w[W-1]:r,de=W>2?w[2]:r;for(ne=c.length>3&&typeof ne=="function"?(W--,ne):r,de&&ci(w[0],w[1],de)&&(ne=W<3?r:ne,W=1),h=qr(h);++L-1?W[ne?h[de]:de]:r}}function V9(c){return Vo(function(h){var w=h.length,L=w,W=as.prototype.thru;for(c&&h.reverse();L--;){var ne=h[L];if(typeof ne!="function")throw new os(o);if(W&&!de&&Fp(ne)=="wrapper")var de=new as([],!0)}for(L=de?L:w;++L1&&Er.reverse(),Ke&&weme))return!1;var We=ne.get(c),Ke=ne.get(h);if(We&&Ke)return We==h&&Ke==c;var Ze=-1,xt=!0,Nt=w&O?new Tc:r;for(ne.set(c,h),ne.set(h,c);++Ze1?"& ":"")+h[L],h=h.join(w>2?", ":" "),c.replace(V,`{ + */e0.exports,function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",l=500,d="__lodash_placeholder__",g=1,y=2,A=4,P=1,N=2,D=1,k=2,B=4,j=8,U=16,K=32,J=64,T=128,z=256,ue=512,_e=30,G="...",E=800,m=16,f=1,p=2,v=3,x=1/0,_=9007199254740991,S=17976931348623157e292,b=NaN,M=4294967295,I=M-1,F=M>>>1,ae=[["ary",T],["bind",D],["bindKey",k],["curry",j],["curryRight",U],["flip",ue],["partial",K],["partialRight",J],["rearg",z]],O="[object Arguments]",se="[object Array]",ee="[object AsyncFunction]",X="[object Boolean]",Q="[object Date]",R="[object DOMException]",Z="[object Error]",te="[object Function]",le="[object GeneratorFunction]",ie="[object Map]",fe="[object Number]",ve="[object Null]",Me="[object Object]",Ne="[object Promise]",Te="[object Proxy]",$e="[object RegExp]",Ie="[object Set]",Le="[object String]",Ve="[object Symbol]",ke="[object Undefined]",ze="[object WeakMap]",He="[object WeakSet]",Ee="[object ArrayBuffer]",Qe="[object DataView]",ct="[object Float32Array]",Be="[object Float64Array]",et="[object Int8Array]",rt="[object Int16Array]",Je="[object Int32Array]",pt="[object Uint8Array]",ht="[object Uint8ClampedArray]",ft="[object Uint16Array]",Ht="[object Uint32Array]",Jt=/\b__p \+= '';/g,St=/\b(__p \+=) '' \+/g,er=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Xt=/&(?:amp|lt|gt|quot|#39);/g,Ot=/[&<>"']/g,Bt=RegExp(Xt.source),Tt=RegExp(Ot.source),vt=/<%-([\s\S]+?)%>/g,Dt=/<%([\s\S]+?)%>/g,Lt=/<%=([\s\S]+?)%>/g,bt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$t=/^\w*$/,jt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(nt.source),$=/^\s+/,H=/\s/,V=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C=/\{\n\/\* \[wrapped with (.+)\] \*/,Y=/,? & /,q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,oe=/[()=,{}\[\]\/\s]/,pe=/\\(\\)?/g,xe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Re=/\w*$/,De=/^[-+]0x[0-9a-f]+$/i,it=/^0b[01]+$/i,Ue=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,st=/^(?:0|[1-9]\d*)$/,tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,Rt=/['\n\r\u2028\u2029\\]/g,Mt="\\ud800-\\udfff",Et="\\u0300-\\u036f",dt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",ot=Et+dt+_t,wt="\\u2700-\\u27bf",lt="a-z\\xdf-\\xf6\\xf8-\\xff",at="\\xac\\xb1\\xd7\\xf7",Ae="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Pe="\\u2000-\\u206f",Ge=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="A-Z\\xc0-\\xd6\\xd8-\\xde",qe="\\ufe0e\\ufe0f",Xe=at+Ae+Pe+Ge,kt="['’]",Wt="["+Mt+"]",Zt="["+Xe+"]",Kt="["+ot+"]",de="\\d+",nr="["+wt+"]",dr="["+lt+"]",pr="[^"+Mt+Xe+de+wt+lt+je+"]",Qt="\\ud83c[\\udffb-\\udfff]",gr="(?:"+Kt+"|"+Qt+")",lr="[^"+Mt+"]",Lr="(?:\\ud83c[\\udde6-\\uddff]){2}",mr="[\\ud800-\\udbff][\\udc00-\\udfff]",wr="["+je+"]",Br="\\u200d",$r="(?:"+dr+"|"+pr+")",Ir="(?:"+wr+"|"+pr+")",hn="(?:"+kt+"(?:d|ll|m|re|s|t|ve))?",dn="(?:"+kt+"(?:D|LL|M|RE|S|T|VE))?",pn=gr+"?",sp="["+qe+"]?",$b="(?:"+Br+"(?:"+[lr,Lr,mr].join("|")+")"+sp+pn+")*",jo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",op="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ap=sp+pn+$b,Qu="(?:"+[nr,Lr,mr].join("|")+")"+ap,Fb="(?:"+[lr+Kt+"?",Kt,Lr,mr,Wt].join("|")+")",gh=RegExp(kt,"g"),jb=RegExp(Kt,"g"),ef=RegExp(Qt+"(?="+Qt+")|"+Fb+ap,"g"),cp=RegExp([wr+"?"+dr+"+"+hn+"(?="+[Zt,wr,"$"].join("|")+")",Ir+"+"+dn+"(?="+[Zt,wr+$r,"$"].join("|")+")",wr+"?"+$r+"+"+hn,wr+"+"+dn,op,jo,de,Qu].join("|"),"g"),up=RegExp("["+Br+Mt+ot+qe+"]"),Pc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ub=-1,Fr={};Fr[ct]=Fr[Be]=Fr[et]=Fr[rt]=Fr[Je]=Fr[pt]=Fr[ht]=Fr[ft]=Fr[Ht]=!0,Fr[O]=Fr[se]=Fr[Ee]=Fr[X]=Fr[Qe]=Fr[Q]=Fr[Z]=Fr[te]=Fr[ie]=Fr[fe]=Fr[Me]=Fr[$e]=Fr[Ie]=Fr[Le]=Fr[ze]=!1;var kr={};kr[O]=kr[se]=kr[Ee]=kr[Qe]=kr[X]=kr[Q]=kr[ct]=kr[Be]=kr[et]=kr[rt]=kr[Je]=kr[ie]=kr[fe]=kr[Me]=kr[$e]=kr[Ie]=kr[Le]=kr[Ve]=kr[pt]=kr[ht]=kr[ft]=kr[Ht]=!0,kr[Z]=kr[te]=kr[ze]=!1;var ce={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ye={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye={"&":"&","<":"<",">":">",""":'"',"'":"'"},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},jr=parseFloat,ir=parseInt,Yr=typeof nn=="object"&&nn&&nn.Object===Object&&nn,wn=typeof self=="object"&&self&&self.Object===Object&&self,_r=Yr||wn||Function("return this")(),Ur=e&&!e.nodeType&&e,gn=Ur&&!0&&t&&!t.nodeType&&t,_i=gn&&gn.exports===Ur,xn=_i&&Yr.process,Jr=function(){try{var be=gn&&gn.require&&gn.require("util").types;return be||xn&&xn.binding&&xn.binding("util")}catch{}}(),oi=Jr&&Jr.isArrayBuffer,Ps=Jr&&Jr.isDate,is=Jr&&Jr.isMap,ro=Jr&&Jr.isRegExp,mh=Jr&&Jr.isSet,Mc=Jr&&Jr.isTypedArray;function Bn(be,Fe,Ce){switch(Ce.length){case 0:return be.call(Fe);case 1:return be.call(Fe,Ce[0]);case 2:return be.call(Fe,Ce[0],Ce[1]);case 3:return be.call(Fe,Ce[0],Ce[1],Ce[2])}return be.apply(Fe,Ce)}function OQ(be,Fe,Ce,Ct){for(var tr=-1,Mr=be==null?0:be.length;++tr-1}function qb(be,Fe,Ce){for(var Ct=-1,tr=be==null?0:be.length;++Ct-1;);return Ce}function r9(be,Fe){for(var Ce=be.length;Ce--&&tf(Fe,be[Ce],0)>-1;);return Ce}function qQ(be,Fe){for(var Ce=be.length,Ct=0;Ce--;)be[Ce]===Fe&&++Ct;return Ct}var zQ=Kb(ce),HQ=Kb(ye);function WQ(be){return"\\"+It[be]}function KQ(be,Fe){return be==null?r:be[Fe]}function rf(be){return up.test(be)}function VQ(be){return Pc.test(be)}function GQ(be){for(var Fe,Ce=[];!(Fe=be.next()).done;)Ce.push(Fe.value);return Ce}function Jb(be){var Fe=-1,Ce=Array(be.size);return be.forEach(function(Ct,tr){Ce[++Fe]=[tr,Ct]}),Ce}function n9(be,Fe){return function(Ce){return be(Fe(Ce))}}function Ta(be,Fe){for(var Ce=-1,Ct=be.length,tr=0,Mr=[];++Ce-1}function Lee(c,h){var w=this.__data__,L=Ip(w,c);return L<0?(++this.size,w.push([c,h])):w[L][1]=h,this}Uo.prototype.clear=Ree,Uo.prototype.delete=Dee,Uo.prototype.get=Oee,Uo.prototype.has=Nee,Uo.prototype.set=Lee;function qo(c){var h=-1,w=c==null?0:c.length;for(this.clear();++h=h?c:h)),c}function cs(c,h,w,L,W,ne){var he,me=h&g,we=h&y,We=h&A;if(w&&(he=W?w(c,L,W,ne):w(c)),he!==r)return he;if(!Qr(c))return c;var Ke=sr(c);if(Ke){if(he=Fte(c),!me)return Ei(c,he)}else{var Ze=ti(c),xt=Ze==te||Ze==le;if(ka(c))return F9(c,me);if(Ze==Me||Ze==O||xt&&!W){if(he=we||xt?{}:iA(c),!me)return we?Ite(c,Xee(he,c)):Mte(c,g9(he,c))}else{if(!kr[Ze])return W?c:{};he=jte(c,Ze,me)}}ne||(ne=new Is);var Nt=ne.get(c);if(Nt)return Nt;ne.set(c,he),OA(c)?c.forEach(function(Gt){he.add(cs(Gt,h,w,Gt,c,ne))}):RA(c)&&c.forEach(function(Gt,br){he.set(br,cs(Gt,h,w,br,c,ne))});var Vt=We?we?_y:xy:we?Ai:$n,fr=Ke?r:Vt(c);return ss(fr||c,function(Gt,br){fr&&(br=Gt,Gt=c[br]),Eh(he,br,cs(Gt,h,w,br,c,ne))}),he}function Zee(c){var h=$n(c);return function(w){return m9(w,c,h)}}function m9(c,h,w){var L=w.length;if(c==null)return!L;for(c=qr(c);L--;){var W=w[L],ne=h[W],he=c[W];if(he===r&&!(W in c)||!ne(he))return!1}return!0}function v9(c,h,w){if(typeof c!="function")throw new os(o);return Th(function(){c.apply(r,w)},h)}function Sh(c,h,w,L){var W=-1,ne=lp,he=!0,me=c.length,we=[],We=h.length;if(!me)return we;w&&(h=Xr(h,Li(w))),L?(ne=qb,he=!1):h.length>=i&&(ne=vh,he=!1,h=new Tc(h));e:for(;++WW?0:W+w),L=L===r||L>W?W:ur(L),L<0&&(L+=W),L=w>L?0:LA(L);w0&&w(me)?h>1?Vn(me,h-1,w,L,W):Ca(W,me):L||(W[W.length]=me)}return W}var ny=W9(),w9=W9(!0);function no(c,h){return c&&ny(c,h,$n)}function iy(c,h){return c&&w9(c,h,$n)}function Tp(c,h){return Ia(h,function(w){return Vo(c[w])})}function Dc(c,h){h=Na(h,c);for(var w=0,L=h.length;c!=null&&wh}function tte(c,h){return c!=null&&Tr.call(c,h)}function rte(c,h){return c!=null&&h in qr(c)}function nte(c,h,w){return c>=ei(h,w)&&c=120&&Ke.length>=120)?new Tc(he&&Ke):r}Ke=c[0];var Ze=-1,xt=me[0];e:for(;++Ze-1;)me!==c&&xp.call(me,we,1),xp.call(c,we,1);return c}function R9(c,h){for(var w=c?h.length:0,L=w-1;w--;){var W=h[w];if(w==L||W!==ne){var ne=W;Ko(W)?xp.call(c,W,1):py(c,W)}}return c}function ly(c,h){return c+Sp(l9()*(h-c+1))}function mte(c,h,w,L){for(var W=-1,ne=Pn(Ep((h-c)/(w||1)),0),he=Ce(ne);ne--;)he[L?ne:++W]=c,c+=w;return he}function hy(c,h){var w="";if(!c||h<1||h>_)return w;do h%2&&(w+=c),h=Sp(h/2),h&&(c+=c);while(h);return w}function hr(c,h){return Cy(aA(c,h,Pi),c+"")}function vte(c){return p9(pf(c))}function bte(c,h){var w=pf(c);return Up(w,Rc(h,0,w.length))}function Mh(c,h,w,L){if(!Qr(c))return c;h=Na(h,c);for(var W=-1,ne=h.length,he=ne-1,me=c;me!=null&&++WW?0:W+h),w=w>W?W:w,w<0&&(w+=W),W=h>w?0:w-h>>>0,h>>>=0;for(var ne=Ce(W);++L>>1,he=c[ne];he!==null&&!Bi(he)&&(w?he<=h:he=i){var We=h?null:Dte(c);if(We)return dp(We);he=!1,W=vh,we=new Tc}else we=h?[]:me;e:for(;++L=L?c:us(c,h,w)}var $9=uee||function(c){return _r.clearTimeout(c)};function F9(c,h){if(h)return c.slice();var w=c.length,L=o9?o9(w):new c.constructor(w);return c.copy(L),L}function by(c){var h=new c.constructor(c.byteLength);return new yp(h).set(new yp(c)),h}function Ete(c,h){var w=h?by(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.byteLength)}function Ste(c){var h=new c.constructor(c.source,Re.exec(c));return h.lastIndex=c.lastIndex,h}function Ate(c){return _h?qr(_h.call(c)):{}}function j9(c,h){var w=h?by(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.length)}function U9(c,h){if(c!==h){var w=c!==r,L=c===null,W=c===c,ne=Bi(c),he=h!==r,me=h===null,we=h===h,We=Bi(h);if(!me&&!We&&!ne&&c>h||ne&&he&&we&&!me&&!We||L&&he&&we||!w&&we||!W)return 1;if(!L&&!ne&&!We&&c=me)return we;var We=w[L];return we*(We=="desc"?-1:1)}}return c.index-h.index}function q9(c,h,w,L){for(var W=-1,ne=c.length,he=w.length,me=-1,we=h.length,We=Pn(ne-he,0),Ke=Ce(we+We),Ze=!L;++me1?w[W-1]:r,he=W>2?w[2]:r;for(ne=c.length>3&&typeof ne=="function"?(W--,ne):r,he&&ci(w[0],w[1],he)&&(ne=W<3?r:ne,W=1),h=qr(h);++L-1?W[ne?h[he]:he]:r}}function G9(c){return Wo(function(h){var w=h.length,L=w,W=as.prototype.thru;for(c&&h.reverse();L--;){var ne=h[L];if(typeof ne!="function")throw new os(o);if(W&&!he&&Fp(ne)=="wrapper")var he=new as([],!0)}for(L=he?L:w;++L1&&Er.reverse(),Ke&&weme))return!1;var We=ne.get(c),Ke=ne.get(h);if(We&&Ke)return We==h&&Ke==c;var Ze=-1,xt=!0,Nt=w&N?new Tc:r;for(ne.set(c,h),ne.set(h,c);++Ze1?"& ":"")+h[L],h=h.join(w>2?", ":" "),c.replace(V,`{ /* [wrapped with `+h+`] */ -`)}function Fte(c){return sr(c)||Lc(c)||!!(c9&&c&&c[c9])}function Go(c,h){var w=typeof c;return h=h??_,!!h&&(w=="number"||w!="symbol"&&st.test(c))&&c>-1&&c%1==0&&c0){if(++h>=E)return arguments[0]}else h=0;return c.apply(r,arguments)}}function Up(c,h){var w=-1,L=c.length,W=L-1;for(h=h===r?L:h;++w1?c[h-1]:r;return w=typeof w=="function"?(c.pop(),w):r,bA(c,w)});function yA(c){var h=re(c);return h.__chain__=!0,h}function Jre(c,h){return h(c),c}function qp(c,h){return h(c)}var Xre=Vo(function(c){var h=c.length,w=h?c[0]:0,L=this.__wrapped__,W=function(ne){return iy(ne,c)};return h>1||this.__actions__.length||!(L instanceof xr)||!Go(w)?this.thru(W):(L=L.slice(w,+w+(h?1:0)),L.__actions__.push({func:qp,args:[W],thisArg:r}),new as(L,this.__chain__).thru(function(ne){return h&&!ne.length&&ne.push(r),ne}))});function Zre(){return yA(this)}function Qre(){return new as(this.value(),this.__chain__)}function ene(){this.__values__===r&&(this.__values__=OA(this.value()));var c=this.__index__>=this.__values__.length,h=c?r:this.__values__[this.__index__++];return{done:c,value:h}}function tne(){return this}function rne(c){for(var h,w=this;w instanceof Mp;){var L=hA(w);L.__index__=0,L.__values__=r,h?W.__wrapped__=L:h=L;var W=L;w=w.__wrapped__}return W.__wrapped__=c,h}function nne(){var c=this.__wrapped__;if(c instanceof xr){var h=c;return this.__actions__.length&&(h=new xr(this)),h=h.reverse(),h.__actions__.push({func:qp,args:[Dy],thisArg:r}),new as(h,this.__chain__)}return this.thru(Dy)}function ine(){return L9(this.__wrapped__,this.__actions__)}var sne=Np(function(c,h,w){Tr.call(c,w)?++c[w]:Wo(c,w,1)});function one(c,h,w){var L=sr(c)?G7:Jee;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}function ane(c,h){var w=sr(c)?Ta:b9;return w(c,qt(h,3))}var cne=K9(dA),une=K9(pA);function fne(c,h){return Vn(zp(c,h),1)}function lne(c,h){return Vn(zp(c,h),x)}function hne(c,h,w){return w=w===r?1:ur(w),Vn(zp(c,h),w)}function wA(c,h){var w=sr(c)?ss:Na;return w(c,qt(h,3))}function xA(c,h){var w=sr(c)?RQ:v9;return w(c,qt(h,3))}var dne=Np(function(c,h,w){Tr.call(c,w)?c[w].push(h):Wo(c,w,[h])});function pne(c,h,w,L){c=Si(c)?c:pf(c),w=w&&!L?ur(w):0;var W=c.length;return w<0&&(w=Pn(W+w,0)),Gp(c)?w<=W&&c.indexOf(h,w)>-1:!!W&&tf(c,h,w)>-1}var gne=hr(function(c,h,w){var L=-1,W=typeof h=="function",ne=Si(c)?Ce(c.length):[];return Na(c,function(de){ne[++L]=W?Bn(h,de,w):Ah(de,h,w)}),ne}),mne=Np(function(c,h,w){Wo(c,w,h)});function zp(c,h){var w=sr(c)?Xr:S9;return w(c,qt(h,3))}function vne(c,h,w,L){return c==null?[]:(sr(h)||(h=h==null?[]:[h]),w=L?r:w,sr(w)||(w=w==null?[]:[w]),I9(c,h,w))}var bne=Np(function(c,h,w){c[w?0:1].push(h)},function(){return[[],[]]});function yne(c,h,w){var L=sr(c)?Wb:Z7,W=arguments.length<3;return L(c,qt(h,4),w,W,Na)}function wne(c,h,w){var L=sr(c)?DQ:Z7,W=arguments.length<3;return L(c,qt(h,4),w,W,v9)}function xne(c,h){var w=sr(c)?Ta:b9;return w(c,Kp(qt(h,3)))}function _ne(c){var h=sr(c)?d9:pte;return h(c)}function Ene(c,h,w){(w?ci(c,h,w):h===r)?h=1:h=ur(h);var L=sr(c)?Wee:gte;return L(c,h)}function Sne(c){var h=sr(c)?Kee:vte;return h(c)}function Ane(c){if(c==null)return 0;if(Si(c))return Gp(c)?nf(c):c.length;var h=ti(c);return h==ie||h==Ie?c.size:fy(c).length}function Pne(c,h,w){var L=sr(c)?Kb:bte;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}var Mne=hr(function(c,h){if(c==null)return[];var w=h.length;return w>1&&ci(c,h[0],h[1])?h=[]:w>2&&ci(h[0],h[1],h[2])&&(h=[h[0]]),I9(c,Vn(h,1),[])}),Hp=aee||function(){return _r.Date.now()};function Ine(c,h){if(typeof h!="function")throw new os(o);return c=ur(c),function(){if(--c<1)return h.apply(this,arguments)}}function _A(c,h,w){return h=w?r:h,h=c&&h==null?c.length:h,Ko(c,T,r,r,r,r,h)}function EA(c,h){var w;if(typeof h!="function")throw new os(o);return c=ur(c),function(){return--c>0&&(w=h.apply(this,arguments)),c<=1&&(h=r),w}}var Ny=hr(function(c,h,w){var L=D;if(w.length){var W=Da(w,hf(Ny));L|=K}return Ko(c,L,h,w,W)}),SA=hr(function(c,h,w){var L=D|k;if(w.length){var W=Da(w,hf(SA));L|=K}return Ko(h,L,c,w,W)});function AA(c,h,w){h=w?r:h;var L=Ko(c,j,r,r,r,r,r,h);return L.placeholder=AA.placeholder,L}function PA(c,h,w){h=w?r:h;var L=Ko(c,U,r,r,r,r,r,h);return L.placeholder=PA.placeholder,L}function MA(c,h,w){var L,W,ne,de,me,we,We=0,Ke=!1,Ze=!1,xt=!0;if(typeof c!="function")throw new os(o);h=ls(h)||0,Qr(w)&&(Ke=!!w.leading,Ze="maxWait"in w,ne=Ze?Pn(ls(w.maxWait)||0,h):ne,xt="trailing"in w?!!w.trailing:xt);function Nt(vn){var Ts=L,Xo=W;return L=W=r,We=vn,de=c.apply(Xo,Ts),de}function Vt(vn){return We=vn,me=Th(br,h),Ke?Nt(vn):de}function fr(vn){var Ts=vn-we,Xo=vn-We,KA=h-Ts;return Ze?ei(KA,ne-Xo):KA}function Gt(vn){var Ts=vn-we,Xo=vn-We;return we===r||Ts>=h||Ts<0||Ze&&Xo>=ne}function br(){var vn=Hp();if(Gt(vn))return Er(vn);me=Th(br,fr(vn))}function Er(vn){return me=r,xt&&L?Nt(vn):(L=W=r,de)}function Fi(){me!==r&&B9(me),We=0,L=we=W=me=r}function ui(){return me===r?de:Er(Hp())}function ji(){var vn=Hp(),Ts=Gt(vn);if(L=arguments,W=this,we=vn,Ts){if(me===r)return Vt(we);if(Ze)return B9(me),me=Th(br,h),Nt(we)}return me===r&&(me=Th(br,h)),de}return ji.cancel=Fi,ji.flush=ui,ji}var Cne=hr(function(c,h){return m9(c,1,h)}),Tne=hr(function(c,h,w){return m9(c,ls(h)||0,w)});function Rne(c){return Ko(c,ue)}function Wp(c,h){if(typeof c!="function"||h!=null&&typeof h!="function")throw new os(o);var w=function(){var L=arguments,W=h?h.apply(this,L):L[0],ne=w.cache;if(ne.has(W))return ne.get(W);var de=c.apply(this,L);return w.cache=ne.set(W,de)||ne,de};return w.cache=new(Wp.Cache||Ho),w}Wp.Cache=Ho;function Kp(c){if(typeof c!="function")throw new os(o);return function(){var h=arguments;switch(h.length){case 0:return!c.call(this);case 1:return!c.call(this,h[0]);case 2:return!c.call(this,h[0],h[1]);case 3:return!c.call(this,h[0],h[1],h[2])}return!c.apply(this,h)}}function Dne(c){return EA(2,c)}var One=yte(function(c,h){h=h.length==1&&sr(h[0])?Xr(h[0],ki(qt())):Xr(Vn(h,1),ki(qt()));var w=h.length;return hr(function(L){for(var W=-1,ne=ei(L.length,w);++W=h}),Lc=x9(function(){return arguments}())?x9:function(c){return rn(c)&&Tr.call(c,"callee")&&!a9.call(c,"callee")},sr=Ce.isArray,Gne=oi?ki(oi):rte;function Si(c){return c!=null&&Vp(c.length)&&!Yo(c)}function mn(c){return rn(c)&&Si(c)}function Yne(c){return c===!0||c===!1||rn(c)&&ai(c)==X}var $a=uee||Ky,Jne=Ps?ki(Ps):nte;function Xne(c){return rn(c)&&c.nodeType===1&&!Rh(c)}function Zne(c){if(c==null)return!0;if(Si(c)&&(sr(c)||typeof c=="string"||typeof c.splice=="function"||$a(c)||df(c)||Lc(c)))return!c.length;var h=ti(c);if(h==ie||h==Ie)return!c.size;if(Ch(c))return!fy(c).length;for(var w in c)if(Tr.call(c,w))return!1;return!0}function Qne(c,h){return Ph(c,h)}function eie(c,h,w){w=typeof w=="function"?w:r;var L=w?w(c,h):r;return L===r?Ph(c,h,r,w):!!L}function ky(c){if(!rn(c))return!1;var h=ai(c);return h==Z||h==R||typeof c.message=="string"&&typeof c.name=="string"&&!Rh(c)}function tie(c){return typeof c=="number"&&u9(c)}function Yo(c){if(!Qr(c))return!1;var h=ai(c);return h==te||h==he||h==ee||h==Te}function CA(c){return typeof c=="number"&&c==ur(c)}function Vp(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=_}function Qr(c){var h=typeof c;return c!=null&&(h=="object"||h=="function")}function rn(c){return c!=null&&typeof c=="object"}var TA=is?ki(is):ste;function rie(c,h){return c===h||uy(c,h,Py(h))}function nie(c,h,w){return w=typeof w=="function"?w:r,uy(c,h,Py(h),w)}function iie(c){return RA(c)&&c!=+c}function sie(c){if(qte(c))throw new tr(s);return _9(c)}function oie(c){return c===null}function aie(c){return c==null}function RA(c){return typeof c=="number"||rn(c)&&ai(c)==fe}function Rh(c){if(!rn(c)||ai(c)!=Me)return!1;var h=wp(c);if(h===null)return!0;var w=Tr.call(h,"constructor")&&h.constructor;return typeof w=="function"&&w instanceof w&&mp.call(w)==nee}var By=io?ki(io):ote;function cie(c){return CA(c)&&c>=-_&&c<=_}var DA=mh?ki(mh):ate;function Gp(c){return typeof c=="string"||!sr(c)&&rn(c)&&ai(c)==Le}function $i(c){return typeof c=="symbol"||rn(c)&&ai(c)==Ve}var df=Mc?ki(Mc):cte;function uie(c){return c===r}function fie(c){return rn(c)&&ti(c)==ze}function lie(c){return rn(c)&&ai(c)==He}var hie=$p(ly),die=$p(function(c,h){return c<=h});function OA(c){if(!c)return[];if(Si(c))return Gp(c)?Ms(c):Ei(c);if(bh&&c[bh])return WQ(c[bh]());var h=ti(c),w=h==ie?Zb:h==Ie?dp:pf;return w(c)}function Jo(c){if(!c)return c===0?c:0;if(c=ls(c),c===x||c===-x){var h=c<0?-1:1;return h*S}return c===c?c:0}function ur(c){var h=Jo(c),w=h%1;return h===h?w?h-w:h:0}function NA(c){return c?Rc(ur(c),0,M):0}function ls(c){if(typeof c=="number")return c;if($i(c))return b;if(Qr(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=Qr(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=Q7(c);var w=it.test(c);return w||gt.test(c)?ir(c.slice(2),w?2:8):De.test(c)?b:+c}function LA(c){return oo(c,Ai(c))}function pie(c){return c?Rc(ur(c),-_,_):c===0?c:0}function Cr(c){return c==null?"":Bi(c)}var gie=ff(function(c,h){if(Ch(h)||Si(h)){oo(h,$n(h),c);return}for(var w in h)Tr.call(h,w)&&Eh(c,w,h[w])}),kA=ff(function(c,h){oo(h,Ai(h),c)}),Yp=ff(function(c,h,w,L){oo(h,Ai(h),c,L)}),mie=ff(function(c,h,w,L){oo(h,$n(h),c,L)}),vie=Vo(iy);function bie(c,h){var w=uf(c);return h==null?w:p9(w,h)}var yie=hr(function(c,h){c=qr(c);var w=-1,L=h.length,W=L>2?h[2]:r;for(W&&ci(h[0],h[1],W)&&(L=1);++w1),ne}),oo(c,Sy(c),w),L&&(w=cs(w,g|y|A,Tte));for(var W=h.length;W--;)my(w,h[W]);return w});function Bie(c,h){return $A(c,Kp(qt(h)))}var $ie=Vo(function(c,h){return c==null?{}:lte(c,h)});function $A(c,h){if(c==null)return{};var w=Xr(Sy(c),function(L){return[L]});return h=qt(h),C9(c,w,function(L,W){return h(L,W[0])})}function Fie(c,h,w){h=ka(h,c);var L=-1,W=h.length;for(W||(W=1,c=r);++Lh){var L=c;c=h,h=L}if(w||c%1||h%1){var W=f9();return ei(c+W*(h-c+jr("1e-"+((W+"").length-1))),h)}return dy(c,h)}var Jie=lf(function(c,h,w){return h=h.toLowerCase(),c+(w?UA(h):h)});function UA(c){return jy(Cr(c).toLowerCase())}function qA(c){return c=Cr(c),c&&c.replace(tt,jQ).replace(qb,"")}function Xie(c,h,w){c=Cr(c),h=Bi(h);var L=c.length;w=w===r?L:Rc(ur(w),0,L);var W=w;return w-=h.length,w>=0&&c.slice(w,W)==h}function Zie(c){return c=Cr(c),c&&Tt.test(c)?c.replace(Ot,UQ):c}function Qie(c){return c=Cr(c),c&&Ft.test(c)?c.replace(nt,"\\$&"):c}var ese=lf(function(c,h,w){return c+(w?"-":"")+h.toLowerCase()}),tse=lf(function(c,h,w){return c+(w?" ":"")+h.toLowerCase()}),rse=W9("toLowerCase");function nse(c,h,w){c=Cr(c),h=ur(h);var L=h?nf(c):0;if(!h||L>=h)return c;var W=(h-L)/2;return Bp(Sp(W),w)+c+Bp(Ep(W),w)}function ise(c,h,w){c=Cr(c),h=ur(h);var L=h?nf(c):0;return h&&L>>0,w?(c=Cr(c),c&&(typeof h=="string"||h!=null&&!By(h))&&(h=Bi(h),!h&&rf(c))?Ba(Ms(c),0,w):c.split(h,w)):[]}var lse=lf(function(c,h,w){return c+(w?" ":"")+jy(h)});function hse(c,h,w){return c=Cr(c),w=w==null?0:Rc(ur(w),0,c.length),h=Bi(h),c.slice(w,w+h.length)==h}function dse(c,h,w){var L=re.templateSettings;w&&ci(c,h,w)&&(h=r),c=Cr(c),h=Yp({},h,L,Z9);var W=Yp({},h.imports,L.imports,Z9),ne=$n(W),de=Xb(W,ne),me,we,We=0,Ke=h.interpolate||At,Ze="__p += '",xt=Qb((h.escape||At).source+"|"+Ke.source+"|"+(Ke===Lt?xe:At).source+"|"+(h.evaluate||At).source+"|$","g"),Nt="//# sourceURL="+(Tr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++zb+"]")+` -`;c.replace(xt,function(Gt,br,Er,Fi,ui,ji){return Er||(Er=Fi),Ze+=c.slice(We,ji).replace(Rt,qQ),br&&(me=!0,Ze+=`' + +`)}function qte(c){return sr(c)||Lc(c)||!!(u9&&c&&c[u9])}function Ko(c,h){var w=typeof c;return h=h??_,!!h&&(w=="number"||w!="symbol"&&st.test(c))&&c>-1&&c%1==0&&c0){if(++h>=E)return arguments[0]}else h=0;return c.apply(r,arguments)}}function Up(c,h){var w=-1,L=c.length,W=L-1;for(h=h===r?L:h;++w1?c[h-1]:r;return w=typeof w=="function"?(c.pop(),w):r,yA(c,w)});function wA(c){var h=re(c);return h.__chain__=!0,h}function Qre(c,h){return h(c),c}function qp(c,h){return h(c)}var ene=Wo(function(c){var h=c.length,w=h?c[0]:0,L=this.__wrapped__,W=function(ne){return ry(ne,c)};return h>1||this.__actions__.length||!(L instanceof xr)||!Ko(w)?this.thru(W):(L=L.slice(w,+w+(h?1:0)),L.__actions__.push({func:qp,args:[W],thisArg:r}),new as(L,this.__chain__).thru(function(ne){return h&&!ne.length&&ne.push(r),ne}))});function tne(){return wA(this)}function rne(){return new as(this.value(),this.__chain__)}function nne(){this.__values__===r&&(this.__values__=NA(this.value()));var c=this.__index__>=this.__values__.length,h=c?r:this.__values__[this.__index__++];return{done:c,value:h}}function ine(){return this}function sne(c){for(var h,w=this;w instanceof Mp;){var L=dA(w);L.__index__=0,L.__values__=r,h?W.__wrapped__=L:h=L;var W=L;w=w.__wrapped__}return W.__wrapped__=c,h}function one(){var c=this.__wrapped__;if(c instanceof xr){var h=c;return this.__actions__.length&&(h=new xr(this)),h=h.reverse(),h.__actions__.push({func:qp,args:[Ty],thisArg:r}),new as(h,this.__chain__)}return this.thru(Ty)}function ane(){return k9(this.__wrapped__,this.__actions__)}var cne=Np(function(c,h,w){Tr.call(c,w)?++c[w]:zo(c,w,1)});function une(c,h,w){var L=sr(c)?Y7:Qee;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}function fne(c,h){var w=sr(c)?Ia:y9;return w(c,qt(h,3))}var lne=V9(pA),hne=V9(gA);function dne(c,h){return Vn(zp(c,h),1)}function pne(c,h){return Vn(zp(c,h),x)}function gne(c,h,w){return w=w===r?1:ur(w),Vn(zp(c,h),w)}function xA(c,h){var w=sr(c)?ss:Da;return w(c,qt(h,3))}function _A(c,h){var w=sr(c)?NQ:b9;return w(c,qt(h,3))}var mne=Np(function(c,h,w){Tr.call(c,w)?c[w].push(h):zo(c,w,[h])});function vne(c,h,w,L){c=Si(c)?c:pf(c),w=w&&!L?ur(w):0;var W=c.length;return w<0&&(w=Pn(W+w,0)),Gp(c)?w<=W&&c.indexOf(h,w)>-1:!!W&&tf(c,h,w)>-1}var bne=hr(function(c,h,w){var L=-1,W=typeof h=="function",ne=Si(c)?Ce(c.length):[];return Da(c,function(he){ne[++L]=W?Bn(h,he,w):Ah(he,h,w)}),ne}),yne=Np(function(c,h,w){zo(c,w,h)});function zp(c,h){var w=sr(c)?Xr:A9;return w(c,qt(h,3))}function wne(c,h,w,L){return c==null?[]:(sr(h)||(h=h==null?[]:[h]),w=L?r:w,sr(w)||(w=w==null?[]:[w]),C9(c,h,w))}var xne=Np(function(c,h,w){c[w?0:1].push(h)},function(){return[[],[]]});function _ne(c,h,w){var L=sr(c)?zb:Q7,W=arguments.length<3;return L(c,qt(h,4),w,W,Da)}function Ene(c,h,w){var L=sr(c)?LQ:Q7,W=arguments.length<3;return L(c,qt(h,4),w,W,b9)}function Sne(c,h){var w=sr(c)?Ia:y9;return w(c,Kp(qt(h,3)))}function Ane(c){var h=sr(c)?p9:vte;return h(c)}function Pne(c,h,w){(w?ci(c,h,w):h===r)?h=1:h=ur(h);var L=sr(c)?Gee:bte;return L(c,h)}function Mne(c){var h=sr(c)?Yee:wte;return h(c)}function Ine(c){if(c==null)return 0;if(Si(c))return Gp(c)?nf(c):c.length;var h=ti(c);return h==ie||h==Ie?c.size:cy(c).length}function Cne(c,h,w){var L=sr(c)?Hb:xte;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}var Tne=hr(function(c,h){if(c==null)return[];var w=h.length;return w>1&&ci(c,h[0],h[1])?h=[]:w>2&&ci(h[0],h[1],h[2])&&(h=[h[0]]),C9(c,Vn(h,1),[])}),Hp=fee||function(){return _r.Date.now()};function Rne(c,h){if(typeof h!="function")throw new os(o);return c=ur(c),function(){if(--c<1)return h.apply(this,arguments)}}function EA(c,h,w){return h=w?r:h,h=c&&h==null?c.length:h,Ho(c,T,r,r,r,r,h)}function SA(c,h){var w;if(typeof h!="function")throw new os(o);return c=ur(c),function(){return--c>0&&(w=h.apply(this,arguments)),c<=1&&(h=r),w}}var Dy=hr(function(c,h,w){var L=D;if(w.length){var W=Ta(w,hf(Dy));L|=K}return Ho(c,L,h,w,W)}),AA=hr(function(c,h,w){var L=D|k;if(w.length){var W=Ta(w,hf(AA));L|=K}return Ho(h,L,c,w,W)});function PA(c,h,w){h=w?r:h;var L=Ho(c,j,r,r,r,r,r,h);return L.placeholder=PA.placeholder,L}function MA(c,h,w){h=w?r:h;var L=Ho(c,U,r,r,r,r,r,h);return L.placeholder=MA.placeholder,L}function IA(c,h,w){var L,W,ne,he,me,we,We=0,Ke=!1,Ze=!1,xt=!0;if(typeof c!="function")throw new os(o);h=ls(h)||0,Qr(w)&&(Ke=!!w.leading,Ze="maxWait"in w,ne=Ze?Pn(ls(w.maxWait)||0,h):ne,xt="trailing"in w?!!w.trailing:xt);function Nt(vn){var Ts=L,Yo=W;return L=W=r,We=vn,he=c.apply(Yo,Ts),he}function Vt(vn){return We=vn,me=Th(br,h),Ke?Nt(vn):he}function fr(vn){var Ts=vn-we,Yo=vn-We,VA=h-Ts;return Ze?ei(VA,ne-Yo):VA}function Gt(vn){var Ts=vn-we,Yo=vn-We;return we===r||Ts>=h||Ts<0||Ze&&Yo>=ne}function br(){var vn=Hp();if(Gt(vn))return Er(vn);me=Th(br,fr(vn))}function Er(vn){return me=r,xt&&L?Nt(vn):(L=W=r,he)}function $i(){me!==r&&$9(me),We=0,L=we=W=me=r}function ui(){return me===r?he:Er(Hp())}function Fi(){var vn=Hp(),Ts=Gt(vn);if(L=arguments,W=this,we=vn,Ts){if(me===r)return Vt(we);if(Ze)return $9(me),me=Th(br,h),Nt(we)}return me===r&&(me=Th(br,h)),he}return Fi.cancel=$i,Fi.flush=ui,Fi}var Dne=hr(function(c,h){return v9(c,1,h)}),One=hr(function(c,h,w){return v9(c,ls(h)||0,w)});function Nne(c){return Ho(c,ue)}function Wp(c,h){if(typeof c!="function"||h!=null&&typeof h!="function")throw new os(o);var w=function(){var L=arguments,W=h?h.apply(this,L):L[0],ne=w.cache;if(ne.has(W))return ne.get(W);var he=c.apply(this,L);return w.cache=ne.set(W,he)||ne,he};return w.cache=new(Wp.Cache||qo),w}Wp.Cache=qo;function Kp(c){if(typeof c!="function")throw new os(o);return function(){var h=arguments;switch(h.length){case 0:return!c.call(this);case 1:return!c.call(this,h[0]);case 2:return!c.call(this,h[0],h[1]);case 3:return!c.call(this,h[0],h[1],h[2])}return!c.apply(this,h)}}function Lne(c){return SA(2,c)}var kne=_te(function(c,h){h=h.length==1&&sr(h[0])?Xr(h[0],Li(qt())):Xr(Vn(h,1),Li(qt()));var w=h.length;return hr(function(L){for(var W=-1,ne=ei(L.length,w);++W=h}),Lc=_9(function(){return arguments}())?_9:function(c){return rn(c)&&Tr.call(c,"callee")&&!c9.call(c,"callee")},sr=Ce.isArray,Xne=oi?Li(oi):ste;function Si(c){return c!=null&&Vp(c.length)&&!Vo(c)}function mn(c){return rn(c)&&Si(c)}function Zne(c){return c===!0||c===!1||rn(c)&&ai(c)==X}var ka=hee||Hy,Qne=Ps?Li(Ps):ote;function eie(c){return rn(c)&&c.nodeType===1&&!Rh(c)}function tie(c){if(c==null)return!0;if(Si(c)&&(sr(c)||typeof c=="string"||typeof c.splice=="function"||ka(c)||df(c)||Lc(c)))return!c.length;var h=ti(c);if(h==ie||h==Ie)return!c.size;if(Ch(c))return!cy(c).length;for(var w in c)if(Tr.call(c,w))return!1;return!0}function rie(c,h){return Ph(c,h)}function nie(c,h,w){w=typeof w=="function"?w:r;var L=w?w(c,h):r;return L===r?Ph(c,h,r,w):!!L}function Ny(c){if(!rn(c))return!1;var h=ai(c);return h==Z||h==R||typeof c.message=="string"&&typeof c.name=="string"&&!Rh(c)}function iie(c){return typeof c=="number"&&f9(c)}function Vo(c){if(!Qr(c))return!1;var h=ai(c);return h==te||h==le||h==ee||h==Te}function TA(c){return typeof c=="number"&&c==ur(c)}function Vp(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=_}function Qr(c){var h=typeof c;return c!=null&&(h=="object"||h=="function")}function rn(c){return c!=null&&typeof c=="object"}var RA=is?Li(is):cte;function sie(c,h){return c===h||ay(c,h,Sy(h))}function oie(c,h,w){return w=typeof w=="function"?w:r,ay(c,h,Sy(h),w)}function aie(c){return DA(c)&&c!=+c}function cie(c){if(Wte(c))throw new tr(s);return E9(c)}function uie(c){return c===null}function fie(c){return c==null}function DA(c){return typeof c=="number"||rn(c)&&ai(c)==fe}function Rh(c){if(!rn(c)||ai(c)!=Me)return!1;var h=wp(c);if(h===null)return!0;var w=Tr.call(h,"constructor")&&h.constructor;return typeof w=="function"&&w instanceof w&&mp.call(w)==oee}var Ly=ro?Li(ro):ute;function lie(c){return TA(c)&&c>=-_&&c<=_}var OA=mh?Li(mh):fte;function Gp(c){return typeof c=="string"||!sr(c)&&rn(c)&&ai(c)==Le}function Bi(c){return typeof c=="symbol"||rn(c)&&ai(c)==Ve}var df=Mc?Li(Mc):lte;function hie(c){return c===r}function die(c){return rn(c)&&ti(c)==ze}function pie(c){return rn(c)&&ai(c)==He}var gie=$p(uy),mie=$p(function(c,h){return c<=h});function NA(c){if(!c)return[];if(Si(c))return Gp(c)?Ms(c):Ei(c);if(bh&&c[bh])return GQ(c[bh]());var h=ti(c),w=h==ie?Jb:h==Ie?dp:pf;return w(c)}function Go(c){if(!c)return c===0?c:0;if(c=ls(c),c===x||c===-x){var h=c<0?-1:1;return h*S}return c===c?c:0}function ur(c){var h=Go(c),w=h%1;return h===h?w?h-w:h:0}function LA(c){return c?Rc(ur(c),0,M):0}function ls(c){if(typeof c=="number")return c;if(Bi(c))return b;if(Qr(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=Qr(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=e9(c);var w=it.test(c);return w||gt.test(c)?ir(c.slice(2),w?2:8):De.test(c)?b:+c}function kA(c){return io(c,Ai(c))}function vie(c){return c?Rc(ur(c),-_,_):c===0?c:0}function Cr(c){return c==null?"":ki(c)}var bie=ff(function(c,h){if(Ch(h)||Si(h)){io(h,$n(h),c);return}for(var w in h)Tr.call(h,w)&&Eh(c,w,h[w])}),BA=ff(function(c,h){io(h,Ai(h),c)}),Yp=ff(function(c,h,w,L){io(h,Ai(h),c,L)}),yie=ff(function(c,h,w,L){io(h,$n(h),c,L)}),wie=Wo(ry);function xie(c,h){var w=uf(c);return h==null?w:g9(w,h)}var _ie=hr(function(c,h){c=qr(c);var w=-1,L=h.length,W=L>2?h[2]:r;for(W&&ci(h[0],h[1],W)&&(L=1);++w1),ne}),io(c,_y(c),w),L&&(w=cs(w,g|y|A,Ote));for(var W=h.length;W--;)py(w,h[W]);return w});function jie(c,h){return FA(c,Kp(qt(h)))}var Uie=Wo(function(c,h){return c==null?{}:pte(c,h)});function FA(c,h){if(c==null)return{};var w=Xr(_y(c),function(L){return[L]});return h=qt(h),T9(c,w,function(L,W){return h(L,W[0])})}function qie(c,h,w){h=Na(h,c);var L=-1,W=h.length;for(W||(W=1,c=r);++Lh){var L=c;c=h,h=L}if(w||c%1||h%1){var W=l9();return ei(c+W*(h-c+jr("1e-"+((W+"").length-1))),h)}return ly(c,h)}var Qie=lf(function(c,h,w){return h=h.toLowerCase(),c+(w?qA(h):h)});function qA(c){return $y(Cr(c).toLowerCase())}function zA(c){return c=Cr(c),c&&c.replace(tt,zQ).replace(jb,"")}function ese(c,h,w){c=Cr(c),h=ki(h);var L=c.length;w=w===r?L:Rc(ur(w),0,L);var W=w;return w-=h.length,w>=0&&c.slice(w,W)==h}function tse(c){return c=Cr(c),c&&Tt.test(c)?c.replace(Ot,HQ):c}function rse(c){return c=Cr(c),c&&Ft.test(c)?c.replace(nt,"\\$&"):c}var nse=lf(function(c,h,w){return c+(w?"-":"")+h.toLowerCase()}),ise=lf(function(c,h,w){return c+(w?" ":"")+h.toLowerCase()}),sse=K9("toLowerCase");function ose(c,h,w){c=Cr(c),h=ur(h);var L=h?nf(c):0;if(!h||L>=h)return c;var W=(h-L)/2;return Bp(Sp(W),w)+c+Bp(Ep(W),w)}function ase(c,h,w){c=Cr(c),h=ur(h);var L=h?nf(c):0;return h&&L>>0,w?(c=Cr(c),c&&(typeof h=="string"||h!=null&&!Ly(h))&&(h=ki(h),!h&&rf(c))?La(Ms(c),0,w):c.split(h,w)):[]}var pse=lf(function(c,h,w){return c+(w?" ":"")+$y(h)});function gse(c,h,w){return c=Cr(c),w=w==null?0:Rc(ur(w),0,c.length),h=ki(h),c.slice(w,w+h.length)==h}function mse(c,h,w){var L=re.templateSettings;w&&ci(c,h,w)&&(h=r),c=Cr(c),h=Yp({},h,L,Q9);var W=Yp({},h.imports,L.imports,Q9),ne=$n(W),he=Yb(W,ne),me,we,We=0,Ke=h.interpolate||At,Ze="__p += '",xt=Xb((h.escape||At).source+"|"+Ke.source+"|"+(Ke===Lt?xe:At).source+"|"+(h.evaluate||At).source+"|$","g"),Nt="//# sourceURL="+(Tr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ub+"]")+` +`;c.replace(xt,function(Gt,br,Er,$i,ui,Fi){return Er||(Er=$i),Ze+=c.slice(We,Fi).replace(Rt,WQ),br&&(me=!0,Ze+=`' + __e(`+br+`) + '`),ui&&(we=!0,Ze+=`'; `+ui+`; __p += '`),Er&&(Ze+=`' + ((__t = (`+Er+`)) == null ? '' : __t) + -'`),We=ji+Gt.length,Gt}),Ze+=`'; +'`),We=Fi+Gt.length,Gt}),Ze+=`'; `;var Vt=Tr.call(h,"variable")&&h.variable;if(!Vt)Ze=`with (obj) { `+Ze+` } @@ -104,89 +104,94 @@ __p += '`),Er&&(Ze+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+Ze+`return __p -}`;var fr=HA(function(){return Mr(ne,Nt+"return "+Ze).apply(r,de)});if(fr.source=Ze,ky(fr))throw fr;return fr}function pse(c){return Cr(c).toLowerCase()}function gse(c){return Cr(c).toUpperCase()}function mse(c,h,w){if(c=Cr(c),c&&(w||h===r))return Q7(c);if(!c||!(h=Bi(h)))return c;var L=Ms(c),W=Ms(h),ne=e9(L,W),de=t9(L,W)+1;return Ba(L,ne,de).join("")}function vse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.slice(0,n9(c)+1);if(!c||!(h=Bi(h)))return c;var L=Ms(c),W=t9(L,Ms(h))+1;return Ba(L,0,W).join("")}function bse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.replace($,"");if(!c||!(h=Bi(h)))return c;var L=Ms(c),W=e9(L,Ms(h));return Ba(L,W).join("")}function yse(c,h){var w=_e,L=G;if(Qr(h)){var W="separator"in h?h.separator:W;w="length"in h?ur(h.length):w,L="omission"in h?Bi(h.omission):L}c=Cr(c);var ne=c.length;if(rf(c)){var de=Ms(c);ne=de.length}if(w>=ne)return c;var me=w-nf(L);if(me<1)return L;var we=de?Ba(de,0,me).join(""):c.slice(0,me);if(W===r)return we+L;if(de&&(me+=we.length-me),By(W)){if(c.slice(me).search(W)){var We,Ke=we;for(W.global||(W=Qb(W.source,Cr(Re.exec(W))+"g")),W.lastIndex=0;We=W.exec(Ke);)var Ze=We.index;we=we.slice(0,Ze===r?me:Ze)}}else if(c.indexOf(Bi(W),me)!=me){var xt=we.lastIndexOf(W);xt>-1&&(we=we.slice(0,xt))}return we+L}function wse(c){return c=Cr(c),c&&Bt.test(c)?c.replace(Xt,YQ):c}var xse=lf(function(c,h,w){return c+(w?" ":"")+h.toUpperCase()}),jy=W9("toUpperCase");function zA(c,h,w){return c=Cr(c),h=w?r:h,h===r?HQ(c)?ZQ(c):LQ(c):c.match(h)||[]}var HA=hr(function(c,h){try{return Bn(c,r,h)}catch(w){return ky(w)?w:new tr(w)}}),_se=Vo(function(c,h){return ss(h,function(w){w=ao(w),Wo(c,w,Ny(c[w],c))}),c});function Ese(c){var h=c==null?0:c.length,w=qt();return c=h?Xr(c,function(L){if(typeof L[1]!="function")throw new os(o);return[w(L[0]),L[1]]}):[],hr(function(L){for(var W=-1;++W_)return[];var w=M,L=ei(c,M);h=qt(h),c-=M;for(var W=Jb(L,h);++w0||h<0)?new xr(w):(c<0?w=w.takeRight(-c):c&&(w=w.drop(c)),h!==r&&(h=ur(h),w=h<0?w.dropRight(-h):w.take(h-c)),w)},xr.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},xr.prototype.toArray=function(){return this.take(M)},so(xr.prototype,function(c,h){var w=/^(?:filter|find|map|reject)|While$/.test(h),L=/^(?:head|last)$/.test(h),W=re[L?"take"+(h=="last"?"Right":""):h],ne=L||/^find/.test(h);W&&(re.prototype[h]=function(){var de=this.__wrapped__,me=L?[1]:arguments,we=de instanceof xr,We=me[0],Ke=we||sr(de),Ze=function(br){var Er=W.apply(re,Ra([br],me));return L&&xt?Er[0]:Er};Ke&&w&&typeof We=="function"&&We.length!=1&&(we=Ke=!1);var xt=this.__chain__,Nt=!!this.__actions__.length,Vt=ne&&!xt,fr=we&&!Nt;if(!ne&&Ke){de=fr?de:new xr(this);var Gt=c.apply(de,me);return Gt.__actions__.push({func:qp,args:[Ze],thisArg:r}),new as(Gt,xt)}return Vt&&fr?c.apply(this,me):(Gt=this.thru(Ze),Vt?L?Gt.value()[0]:Gt.value():Gt)})}),ss(["pop","push","shift","sort","splice","unshift"],function(c){var h=pp[c],w=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",L=/^(?:pop|shift)$/.test(c);re.prototype[c]=function(){var W=arguments;if(L&&!this.__chain__){var ne=this.value();return h.apply(sr(ne)?ne:[],W)}return this[w](function(de){return h.apply(sr(de)?de:[],W)})}}),so(xr.prototype,function(c,h){var w=re[h];if(w){var L=w.name+"";Tr.call(cf,L)||(cf[L]=[]),cf[L].push({name:h,func:w})}}),cf[Lp(r,k).name]=[{name:"wrapper",func:r}],xr.prototype.clone=wee,xr.prototype.reverse=xee,xr.prototype.value=_ee,re.prototype.at=Xre,re.prototype.chain=Zre,re.prototype.commit=Qre,re.prototype.next=ene,re.prototype.plant=rne,re.prototype.reverse=nne,re.prototype.toJSON=re.prototype.valueOf=re.prototype.value=ine,re.prototype.first=re.prototype.head,bh&&(re.prototype[bh]=tne),re},sf=QQ();gn?((gn.exports=sf)._=sf,Ur._=sf):_r._=sf}).call(nn)}(e0,e0.exports);var Aq=e0.exports,P1={exports:{}};(function(t,e){var r=typeof self<"u"?self:nn,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function u(f){return f&&DataView.prototype.isPrototypeOf(f)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(f){return f&&l.indexOf(Object.prototype.toString.call(f))>-1};function g(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function y(f){return typeof f!="string"&&(f=String(f)),f}function A(f){var p={next:function(){var v=f.shift();return{done:v===void 0,value:v}}};return a.iterable&&(p[Symbol.iterator]=function(){return p}),p}function P(f){this.map={},f instanceof P?f.forEach(function(p,v){this.append(v,p)},this):Array.isArray(f)?f.forEach(function(p){this.append(p[0],p[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(p){this.append(p,f[p])},this)}P.prototype.append=function(f,p){f=g(f),p=y(p);var v=this.map[f];this.map[f]=v?v+", "+p:p},P.prototype.delete=function(f){delete this.map[g(f)]},P.prototype.get=function(f){return f=g(f),this.has(f)?this.map[f]:null},P.prototype.has=function(f){return this.map.hasOwnProperty(g(f))},P.prototype.set=function(f,p){this.map[g(f)]=y(p)},P.prototype.forEach=function(f,p){for(var v in this.map)this.map.hasOwnProperty(v)&&f.call(p,this.map[v],v,this)},P.prototype.keys=function(){var f=[];return this.forEach(function(p,v){f.push(v)}),A(f)},P.prototype.values=function(){var f=[];return this.forEach(function(p){f.push(p)}),A(f)},P.prototype.entries=function(){var f=[];return this.forEach(function(p,v){f.push([v,p])}),A(f)},a.iterable&&(P.prototype[Symbol.iterator]=P.prototype.entries);function O(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function D(f){return new Promise(function(p,v){f.onload=function(){p(f.result)},f.onerror=function(){v(f.error)}})}function k(f){var p=new FileReader,v=D(p);return p.readAsArrayBuffer(f),v}function B(f){var p=new FileReader,v=D(p);return p.readAsText(f),v}function j(f){for(var p=new Uint8Array(f),v=new Array(p.length),x=0;x-1?p:f}function z(f,p){p=p||{};var v=p.body;if(f instanceof z){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,p.headers||(this.headers=new P(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!v&&f._bodyInit!=null&&(v=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=p.credentials||this.credentials||"same-origin",(p.headers||!this.headers)&&(this.headers=new P(p.headers)),this.method=T(p.method||this.method||"GET"),this.mode=p.mode||this.mode||null,this.signal=p.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(v)}z.prototype.clone=function(){return new z(this,{body:this._bodyInit})};function ue(f){var p=new FormData;return f.trim().split("&").forEach(function(v){if(v){var x=v.split("="),_=x.shift().replace(/\+/g," "),S=x.join("=").replace(/\+/g," ");p.append(decodeURIComponent(_),decodeURIComponent(S))}}),p}function _e(f){var p=new P,v=f.replace(/\r?\n[\t ]+/g," ");return v.split(/\r?\n/).forEach(function(x){var _=x.split(":"),S=_.shift().trim();if(S){var b=_.join(":").trim();p.append(S,b)}}),p}K.call(z.prototype);function G(f,p){p||(p={}),this.type="default",this.status=p.status===void 0?200:p.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in p?p.statusText:"OK",this.headers=new P(p.headers),this.url=p.url||"",this._initBody(f)}K.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new P(this.headers),url:this.url})},G.error=function(){var f=new G(null,{status:0,statusText:""});return f.type="error",f};var E=[301,302,303,307,308];G.redirect=function(f,p){if(E.indexOf(p)===-1)throw new RangeError("Invalid status code");return new G(null,{status:p,headers:{location:f}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(p,v){this.message=p,this.name=v;var x=Error(p);this.stack=x.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function m(f,p){return new Promise(function(v,x){var _=new z(f,p);if(_.signal&&_.signal.aborted)return x(new o.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function b(){S.abort()}S.onload=function(){var M={status:S.status,statusText:S.statusText,headers:_e(S.getAllResponseHeaders()||"")};M.url="responseURL"in S?S.responseURL:M.headers.get("X-Request-URL");var I="response"in S?S.response:S.responseText;v(new G(I,M))},S.onerror=function(){x(new TypeError("Network request failed"))},S.ontimeout=function(){x(new TypeError("Network request failed"))},S.onabort=function(){x(new o.DOMException("Aborted","AbortError"))},S.open(_.method,_.url,!0),_.credentials==="include"?S.withCredentials=!0:_.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&a.blob&&(S.responseType="blob"),_.headers.forEach(function(M,I){S.setRequestHeader(I,M)}),_.signal&&(_.signal.addEventListener("abort",b),S.onreadystatechange=function(){S.readyState===4&&_.signal.removeEventListener("abort",b)}),S.send(typeof _._bodyInit>"u"?null:_._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=P,s.Request=z,s.Response=G),o.Headers=P,o.Request=z,o.Response=G,o.fetch=m,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(P1,P1.exports);var Pq=P1.exports;const O6=Ui(Pq);var Mq=Object.defineProperty,Iq=Object.defineProperties,Cq=Object.getOwnPropertyDescriptors,N6=Object.getOwnPropertySymbols,Tq=Object.prototype.hasOwnProperty,Rq=Object.prototype.propertyIsEnumerable,L6=(t,e,r)=>e in t?Mq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,k6=(t,e)=>{for(var r in e||(e={}))Tq.call(e,r)&&L6(t,r,e[r]);if(N6)for(var r of N6(e))Rq.call(e,r)&&L6(t,r,e[r]);return t},B6=(t,e)=>Iq(t,Cq(e));const Dq={Accept:"application/json","Content-Type":"application/json"},Oq="POST",$6={headers:Dq,method:Oq},F6=10;let xs=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new zi.EventEmitter,this.isAvailable=!1,this.registering=!1,!$_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=bo(e),n=await(await O6(this.url,B6(k6({},$6),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!$_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=bo({id:1,jsonrpc:"2.0",method:"test",params:[]});await O6(e,B6(k6({},$6),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ga(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return O_(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>F6&&this.events.setMaxListeners(F6)}};const j6="error",Nq="wss://relay.walletconnect.org",Lq="wc",kq="universal_provider",U6=`${Lq}@2:${kq}:`,q6="https://rpc.walletconnect.org/v1/",Iu="generic",Bq=`${q6}bundler`,es={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var $q=Object.defineProperty,Fq=Object.defineProperties,jq=Object.getOwnPropertyDescriptors,z6=Object.getOwnPropertySymbols,Uq=Object.prototype.hasOwnProperty,qq=Object.prototype.propertyIsEnumerable,H6=(t,e,r)=>e in t?$q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,t0=(t,e)=>{for(var r in e||(e={}))Uq.call(e,r)&&H6(t,r,e[r]);if(z6)for(var r of z6(e))qq.call(e,r)&&H6(t,r,e[r]);return t},zq=(t,e)=>Fq(t,jq(e));function Di(t,e,r){var n;const i=Eu(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${q6}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function hc(t){return t.includes(":")?t.split(":")[1]:t}function W6(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Hq(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function M1(t={},e={}){const r=K6(t),n=K6(e);return Aq.merge(r,n)}function K6(t){var e,r,n,i;const s={};if(!Sl(t))return s;for(const[o,a]of Object.entries(t)){const u=f1(o)?[o]:a.chains,l=a.methods||[],d=a.events||[],g=a.rpcMap||{},y=El(o);s[y]=zq(t0(t0({},s[y]),a),{chains:Ud(u,(e=s[y])==null?void 0:e.chains),methods:Ud(l,(r=s[y])==null?void 0:r.methods),events:Ud(d,(n=s[y])==null?void 0:n.events),rpcMap:t0(t0({},g),(i=s[y])==null?void 0:i.rpcMap)})}return s}function Wq(t){return t.includes(":")?t.split(":")[2]:t}function V6(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=f1(r)?[r]:n.chains?n.chains:W6(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function I1(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const G6={},Ar=t=>G6[t],C1=(t,e)=>{G6[t]=e};class Kq{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=hc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Xi(new xs(n,Ar("disableProviderPing")))}}var Vq=Object.defineProperty,Gq=Object.defineProperties,Yq=Object.getOwnPropertyDescriptors,Y6=Object.getOwnPropertySymbols,Jq=Object.prototype.hasOwnProperty,Xq=Object.prototype.propertyIsEnumerable,J6=(t,e,r)=>e in t?Vq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,X6=(t,e)=>{for(var r in e||(e={}))Jq.call(e,r)&&J6(t,r,e[r]);if(Y6)for(var r of Y6(e))Xq.call(e,r)&&J6(t,r,e[r]);return t},Z6=(t,e)=>Gq(t,Yq(e));class Zq{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Xi(new xs(n,Ar("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(hc(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const u=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:Z6(X6({},o.sessionProperties||{}),{capabilities:Z6(X6({},a||{}),{[s]:u})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return u}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ga("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${Bq}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class Qq{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=hc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Xi(new xs(n,Ar("disableProviderPing")))}}let ez=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=hc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Xi(new xs(n,Ar("disableProviderPing")))}},tz=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Xi(new xs(n,Ar("disableProviderPing")))}},rz=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=hc(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Xi(new xs(n,Ar("disableProviderPing")))}},nz=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=hc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Xi(new xs(n,Ar("disableProviderPing")))}};class iz{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=hc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Xi(new xs(n,Ar("disableProviderPing")))}}let sz=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Xi(new xs(n,Ar("disableProviderPing")))}};class oz{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Xi(new xs(n))}}class az{constructor(e){this.name=Iu,this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(es.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=Eu(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Xi(new xs(n,Ar("disableProviderPing")))}}var cz=Object.defineProperty,uz=Object.defineProperties,fz=Object.getOwnPropertyDescriptors,Q6=Object.getOwnPropertySymbols,lz=Object.prototype.hasOwnProperty,hz=Object.prototype.propertyIsEnumerable,e5=(t,e,r)=>e in t?cz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,r0=(t,e)=>{for(var r in e||(e={}))lz.call(e,r)&&e5(t,r,e[r]);if(Q6)for(var r of Q6(e))hz.call(e,r)&&e5(t,r,e[r]);return t},T1=(t,e)=>uz(t,fz(e));let t5=class GA{constructor(e){this.events=new Yg,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||j6})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new GA(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:r0({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,Vd(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Dr("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=V6(this.session.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=V6(s.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==T6)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Iu?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(oc(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await A1.init({core:this.providerOpts.core,logger:this.providerOpts.logger||j6,relayUrl:this.providerOpts.relayUrl||Nq,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>El(r)))];C1("client",this.client),C1("events",this.events),C1("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Hq(r,this.session),i=W6(n),s=M1(this.namespaces,this.optionalNamespaces),o=T1(r0({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new Zq({namespace:o});break;case"algorand":this.rpcProviders[r]=new tz({namespace:o});break;case"solana":this.rpcProviders[r]=new Qq({namespace:o});break;case"cosmos":this.rpcProviders[r]=new ez({namespace:o});break;case"polkadot":this.rpcProviders[r]=new Kq({namespace:o});break;case"cip34":this.rpcProviders[r]=new rz({namespace:o});break;case"elrond":this.rpcProviders[r]=new nz({namespace:o});break;case"multiversx":this.rpcProviders[r]=new iz({namespace:o});break;case"near":this.rpcProviders[r]=new sz({namespace:o});break;case"tezos":this.rpcProviders[r]=new oz({namespace:o});break;default:this.rpcProviders[Iu]?this.rpcProviders[Iu].updateNamespace(o):this.rpcProviders[Iu]=new az({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&oc(i)&&this.events.emit("accountsChanged",i.map(Wq))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=El(i),a=I1(i)!==I1(s)?`${o}:${I1(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=T1(r0({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",T1(r0({},Dr("USER_DISCONNECTED")),{data:e.topic}))}),this.on(es.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Iu]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>El(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=El(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${U6}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${U6}/${e}`)}};const dz=t5;function pz(){return new Promise(t=>{const e=[];let r;window.addEventListener("eip6963:announceProvider",n=>{const{detail:i}=n;r&&clearTimeout(r),e.push(i),r=setTimeout(()=>t(e),200)}),r=setTimeout(()=>t(e),200),window.dispatchEvent(new Event("eip6963:requestProvider"))})}class Ys{constructor(e,r){this.scope=e,this.module=r}storeObject(e,r){this.setItem(e,JSON.stringify(r))}loadObject(e){const r=this.getItem(e);return r?JSON.parse(r):void 0}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new Ys("CBWSDK").clear(),new Ys("walletlink").clear()}}const cn={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},R1={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},r5="Unspecified error message.",gz="Unspecified server error.";function D1(t,e=r5){if(t&&Number.isInteger(t)){const r=t.toString();if(O1(R1,r))return R1[r].message;if(n5(t))return gz}return e}function mz(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(R1[e]||n5(t))}function vz(t,{shouldIncludeStack:e=!1}={}){const r={};if(t&&typeof t=="object"&&!Array.isArray(t)&&O1(t,"code")&&mz(t.code)){const n=t;r.code=n.code,n.message&&typeof n.message=="string"?(r.message=n.message,O1(n,"data")&&(r.data=n.data)):(r.message=D1(r.code),r.data={originalError:i5(t)})}else r.code=cn.rpc.internal,r.message=s5(t,"message")?t.message:r5,r.data={originalError:i5(t)};return e&&(r.stack=s5(t,"stack")?t.stack:void 0),r}function n5(t){return t>=-32099&&t<=-32e3}function i5(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function O1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function s5(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const Sr={rpc:{parse:t=>ts(cn.rpc.parse,t),invalidRequest:t=>ts(cn.rpc.invalidRequest,t),invalidParams:t=>ts(cn.rpc.invalidParams,t),methodNotFound:t=>ts(cn.rpc.methodNotFound,t),internal:t=>ts(cn.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return ts(e,t)},invalidInput:t=>ts(cn.rpc.invalidInput,t),resourceNotFound:t=>ts(cn.rpc.resourceNotFound,t),resourceUnavailable:t=>ts(cn.rpc.resourceUnavailable,t),transactionRejected:t=>ts(cn.rpc.transactionRejected,t),methodNotSupported:t=>ts(cn.rpc.methodNotSupported,t),limitExceeded:t=>ts(cn.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Cu(cn.provider.userRejectedRequest,t),unauthorized:t=>Cu(cn.provider.unauthorized,t),unsupportedMethod:t=>Cu(cn.provider.unsupportedMethod,t),disconnected:t=>Cu(cn.provider.disconnected,t),chainDisconnected:t=>Cu(cn.provider.chainDisconnected,t),unsupportedChain:t=>Cu(cn.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new c5(e,r,n)}}};function ts(t,e){const[r,n]=o5(e);return new a5(t,r||D1(t),n)}function Cu(t,e){const[r,n]=o5(e);return new c5(t,r||D1(t),n)}function o5(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}class a5 extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}}class c5 extends a5{constructor(e,r,n){if(!bz(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}function bz(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function N1(){return t=>t}const Ol=N1(),yz=N1(),wz=N1();function Ro(t){return Math.floor(t)}const u5=/^[0-9]*$/,f5=/^[a-f0-9]*$/;function dc(t){return L1(crypto.getRandomValues(new Uint8Array(t)))}function L1(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function n0(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function Nl(t,e=!1){const r=t.toString("hex");return Ol(e?`0x${r}`:r)}function k1(t){return Nl(F1(t),!0)}function Js(t){return wz(t.toString(10))}function ma(t){return Ol(`0x${BigInt(t).toString(16)}`)}function l5(t){return t.startsWith("0x")||t.startsWith("0X")}function B1(t){return l5(t)?t.slice(2):t}function h5(t){return l5(t)?`0x${t.slice(2)}`:`0x${t}`}function i0(t){if(typeof t!="string")return!1;const e=B1(t).toLowerCase();return f5.test(e)}function xz(t,e=!1){if(typeof t=="string"){const r=B1(t).toLowerCase();if(f5.test(r))return Ol(e?`0x${r}`:r)}throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function $1(t,e=!1){let r=xz(t,!1);return r.length%2===1&&(r=Ol(`0${r}`)),e?Ol(`0x${r}`):r}function va(t){if(typeof t=="string"){const e=B1(t).toLowerCase();if(i0(e)&&e.length===40)return yz(h5(e))}throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function F1(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(i0(t)){const e=$1(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Sr.rpc.invalidParams(`Not binary data: ${String(t)}`)}function Ll(t){if(typeof t=="number"&&Number.isInteger(t))return Ro(t);if(typeof t=="string"){if(u5.test(t))return Ro(Number(t));if(i0(t))return Ro(Number(BigInt($1(t,!0))))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function kl(t){if(t!==null&&(typeof t=="bigint"||Ez(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(Ll(t));if(typeof t=="string"){if(u5.test(t))return BigInt(t);if(i0(t))return BigInt($1(t,!0))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function _z(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Sr.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function Ez(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function Sz(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function Az(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Pz(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,new TextEncoder().encode(e));return{iv:r,cipherText:n}}async function Mz(t,{iv:e,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return new TextDecoder().decode(n)}function d5(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function p5(t,e){const r=d5(t),n=await crypto.subtle.exportKey(r,e);return L1(new Uint8Array(n))}async function g5(t,e){const r=d5(t),n=n0(e).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function Iz(t,e){const r=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return Pz(e,r)}async function Cz(t,e){return JSON.parse(await Mz(e,t))}const j1={storageKey:"ownPrivateKey",keyType:"private"},U1={storageKey:"ownPublicKey",keyType:"public"},q1={storageKey:"peerPublicKey",keyType:"public"};class Tz{constructor(){this.storage=new Ys("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(q1,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(U1.storageKey),this.storage.removeItem(j1.storageKey),this.storage.removeItem(q1.storageKey)}async generateKeyPair(){const e=await Sz();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(j1,e.privateKey),await this.storeKey(U1,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(j1)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(U1)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(q1)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await Az(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const r=this.storage.getItem(e.storageKey);return r?g5(e.keyType,r):null}async storeKey(e,r){const n=await p5(e.keyType,r);this.storage.setItem(e.storageKey,n)}}const Bl="4.2.4",m5="@coinbase/wallet-sdk";async function v5(t,e){const r=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":Bl,"X-Cbw-Sdk-Platform":m5}}),{result:i,error:s}=await n.json();if(s)throw s;return i}function Rz(){return globalThis.coinbaseWalletExtension}function Dz(){var t,e;try{const r=globalThis;return(t=r.ethereum)!==null&&t!==void 0?t:(e=r.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Oz({metadata:t,preference:e}){var r,n;const{appName:i,appLogoUrl:s,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const u=Rz();if(u)return(r=u.setAppInfo)===null||r===void 0||r.call(u,i,s,o,e),u}const a=Dz();if(a!=null&&a.isCoinbaseBrowser)return(n=a.setAppInfo)===null||n===void 0||n.call(a,i,s,o,e),a}function Nz(t){if(!t||typeof t!="object"||Array.isArray(t))throw Sr.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:r}=t;if(typeof e!="string"||e.length===0)throw Sr.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Sr.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw Sr.provider.unsupportedMethod()}}const b5="accounts",y5="activeChain",w5="availableChains",x5="walletCapabilities";class Lz{constructor(e){var r,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new Tz,this.storage=new Ys("CBWSDK","SCWStateManager"),this.accounts=(r=this.storage.loadObject(b5))!==null&&r!==void 0?r:[],this.chain=this.storage.loadObject(y5)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var r,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(r=e.params)!==null&&r!==void 0?r:{})}}),s=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in s.content)throw s.content.failure;const o=await g5("public",s.sender);await this.keyManager.setPeerPublicKey(o);const u=(await this.decryptResponseMessage(s)).result;if("error"in u)throw u.error;const l=u.value;this.accounts=l,this.storage.storeObject(b5,l),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",l)}async request(e){var r;if(this.accounts.length===0)throw Sr.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:ma(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return ma(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(x5);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return v5(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var r,n;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const i=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(i)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,r;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(r=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&r!==void 0?r:1}}async handleSwitchChainRequest(e){var r;const n=e.params;if(!n||!(!((r=n[0])===null||r===void 0)&&r.chainId))throw Sr.rpc.invalidParams();const i=Ll(n[0].chainId);if(this.updateChain(i))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(i),o}async sendEncryptedRequest(e){const r=await this.keyManager.getSharedSecret();if(!r)throw Sr.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await Iz({action:e,chainId:this.chain.id},r),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const r=await p5("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:r,content:e,timestamp:new Date}}async decryptResponseMessage(e){var r,n;const i=e.content;if("failure"in i)throw i.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw Sr.provider.unauthorized("Invalid session");const o=await Cz(i.encrypted,s),a=(r=o.data)===null||r===void 0?void 0:r.chains;if(a){const l=Object.entries(a).map(([d,g])=>({id:Number(d),rpcUrl:g}));this.storage.storeObject(w5,l),this.updateChain(this.chain.id,l)}const u=(n=o.data)===null||n===void 0?void 0:n.capabilities;return u&&this.storage.storeObject(x5,u),o}updateChain(e,r){var n;const i=r??this.storage.loadObject(w5),s=i==null?void 0:i.find(o=>o.id===e);return s?(s!==this.chain&&(this.chain=s,this.storage.storeObject(y5,s),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",ma(s.id))),!0):!1}}const kz=Jp(eM),{keccak_256:Bz}=kz;function _5(t){return Buffer.allocUnsafe(t).fill(0)}function $z(t){return t.toString(2).length}function E5(t,e){let r=t.toString(16);r.length%2!==0&&(r="0"+r);const n=r.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(r=T5(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(Xs(t,e[s]));if(r==="dynamic"){var o=Xs("uint256",e.length);i.unshift(o)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([Xs("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,si.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Tu(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return si.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Tu(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=pc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+a);if(n<0)throw new Error("Supplied uint is negative");return si.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(r=Tu(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=pc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied int exceeds width: "+r+" vs "+a);const u=si.twosFromBigInt(n,256);return si.bufferBEFromBigInt(u,32)}else if(t.startsWith("ufixed")){if(r=C5(t),n=pc(e),n<0)throw new Error("Supplied ufixed is negative");return Xs("uint256",n*BigInt(2)**BigInt(r[1]))}else if(t.startsWith("fixed"))return r=C5(t),Xs("int256",pc(e)*BigInt(2)**BigInt(r[1]))}throw new Error("Unsupported or invalid type: "+t)}function Hz(t){return t==="string"||t==="bytes"||T5(t)==="dynamic"}function Wz(t){return t.lastIndexOf("]")===t.length-1}function Kz(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var o=I5(t[s]),a=e[s],u=Xs(o,a);Hz(o)?(r.push(Xs("uint256",i)),n.push(u),i+=u.length):r.push(u)}return Buffer.concat(r.concat(n))}function R5(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(si.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=Tu(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=pc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+u);i.push(si.bufferBEFromBigInt(n,r/8))}else if(o.startsWith("int")){if(r=Tu(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=pc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied int exceeds width: "+r+" vs "+u);const l=si.twosFromBigInt(n,r);i.push(si.bufferBEFromBigInt(l,r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function Vz(t,e){return si.keccak(R5(t,e))}var Gz={rawEncode:Kz,solidityPack:R5,soliditySHA3:Vz};const _s=M5,$l=Gz,D5={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},z1={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const o=(a,u,l)=>{if(r[u]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":_s.keccak(this.encodeData(u,l,r,n))];if(l===void 0)throw new Error(`missing value for field ${a} of type ${u}`);if(u==="bytes")return["bytes32",_s.keccak(l)];if(u==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",_s.keccak(l)];if(u.lastIndexOf("]")===u.length-1){const d=u.slice(0,u.lastIndexOf("[")),g=l.map(y=>o(a,d,y));return["bytes32",_s.keccak($l.rawEncode(g.map(([y])=>y),g.map(([,y])=>y)))]}return[u,l]};for(const a of r[t]){const[u,l]=o(a.name,a.type,e[a.name]);i.push(u),s.push(l)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=_s.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=_s.keccak(a),s.push(a);else if(r[o.type]!==void 0)i.push("bytes32"),a=_s.keccak(this.encodeData(o.type,a,r,n)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return $l.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return _s.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return _s.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in D5.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),_s.keccak(Buffer.concat(n))}};var Yz={TYPED_MESSAGE_SCHEMA:D5,TypedDataUtils:z1,hashForSignTypedDataLegacy:function(t){return Jz(t.data)},hashForSignTypedData_v3:function(t){return z1.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return z1.hash(t.data)}};function Jz(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?_s.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return $l.soliditySHA3(["bytes32","bytes32"],[$l.soliditySHA3(new Array(t.length).fill("string"),i),$l.soliditySHA3(n,r)])}const o0=Ui(Yz),Xz="walletUsername",H1="Addresses",Zz="AppVersion";function Hn(t){return t.errorMessage!==void 0}class Qz{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),a=16,u=o.slice(o.byteLength-a),l=o.slice(0,o.byteLength-a),d=new Uint8Array(u),g=new Uint8Array(l),y=new Uint8Array([...n,...d,...g]);return L1(y)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=n0(e),a=o.slice(0,12),u=o.slice(12,28),l=o.slice(28),d=new Uint8Array([...l,...u]),g={name:"AES-GCM",iv:new Uint8Array(a)};try{const y=await window.crypto.subtle.decrypt(g,s,d),A=new TextDecoder;n(A.decode(y))}catch(y){i(y)}})()})}}class eH{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}var Do;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(Do||(Do={}));class tH{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,Do.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,Do.DISCONNECTED)},i.onopen=s=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,Do.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(u=>this.sendData(u)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const u=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,u)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,Do.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const O5=1e4,rH=6e4;class nH{constructor({session:e,linkAPIUrl:r,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Ro(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,u)=>{const l=s[u];l!==void 0&&a(l)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,u)},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(Xz,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(Zz,s)},this.handleChainUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(s),l=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(u,l)},this.session=e,this.cipher=new Qz(e.secret),this.listener=n;const i=new tH(`${r}/rpc`,WebSocket);i.setConnectionStateListener(async s=>{let o=!1;switch(s){case Do.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(u=>setTimeout(u,5e3)),this.destroyed||i.connect().catch(()=>{a()})};a()}break;case Do.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},O5),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case Do.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(s=>{var o;switch(s.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=s.type==="IsLinkedOK"?s.linked:void 0;this.linked=a||s.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(s.metadata);break}case"Event":{this.handleIncomingEvent(s);break}}s.id!==void 0&&((o=this.requestResolutions.get(s.id))===null||o===void 0||o(s))}),this.ws=i,this.http=new eH(r,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Ro(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:s,response:o}=i;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s,o)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Ro(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>O5*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r={timeout:rH}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r.timeout)}),new Promise(s=>{this.requestResolutions.set(n,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Ro(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Ro(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Ro(this.nextReqId++),sessionId:this.session.id}),!0)}}class iH{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=h5(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}const N5="session:id",L5="session:secret",k5="session:linked";class Ru{constructor(e,r,n,i=!1){this.storage=e,this.id=r,this.secret=n,this.key=OP(Pg(`${r}, ${n} WalletLink`)),this._linked=!!i}static create(e){const r=dc(16),n=dc(32);return new Ru(e,r,n).save()}static load(e){const r=e.getItem(N5),n=e.getItem(k5),i=e.getItem(L5);return r&&i?new Ru(e,r,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(N5,this.id),this.storage.setItem(L5,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(k5,this._linked?"1":"0")}}function sH(){try{return window.frameElement!==null}catch{return!1}}function oH(){try{return sH()&&window.top?window.top.location:window.location}catch{return window.location}}function aH(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function B5(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const cH='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function $5(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(cH)),document.documentElement.appendChild(t)}function F5(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e2&&(o.children=arguments.length>3?a0.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return c0(t,o,n,i,null)}function c0(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++j5,__i:-1,__u:0};return i==null&&Vr.vnode!=null&&Vr.vnode(s),s}function Ul(t){return t.children}function u0(t,e){this.props=t,this.context=e}function Du(t,e){if(e==null)return t.__?Du(t.__,t.__i+1):null;for(var r;ee&&gc.sort(W1));f0.__r=0}function V5(t,e,r,n,i,s,o,a,u,l,d){var g,y,A,P,O,D,k=n&&n.__k||H5,B=e.length;for(u=fH(r,e,k,u),g=0;g0?c0(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,(u=s.__i=lH(s,r,a,g))!==-1&&(g--,(o=r[u])&&(o.__u|=2)),o==null||o.__v===null?(u==-1&&y--,typeof s.type!="function"&&(s.__u|=4)):u!==a&&(u==a-1?y--:u==a+1?y++:(u>a?y--:y++,s.__u|=4))):s=t.__k[i]=null;if(g)for(i=0;i(u!=null&&!(2&u.__u)?1:0))for(;o>=0||a=0){if((u=e[o])&&!(2&u.__u)&&i==u.key&&s===u.type)return o;o--}if(a=r.__.length&&r.__.push({}),r.__[t]}function c4(t){return tv=1,pH(f4,t)}function pH(t,e,r){var n=a4(h0++,2);if(n.t=t,!n.__c&&(n.__=[f4(void 0,e),function(a){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,a);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=un,!un.u)){var i=function(a,u,l){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(y){return!!y.__c});if(d.every(function(y){return!y.__N}))return!s||s.call(this,a,u,l);var g=n.__c.props!==a;return d.forEach(function(y){if(y.__N){var A=y.__[0];y.__=y.__N,y.__N=void 0,A!==y.__[0]&&(g=!0)}}),s&&s.call(this,a,u,l)||g};un.u=!0;var s=un.shouldComponentUpdate,o=un.componentWillUpdate;un.componentWillUpdate=function(a,u,l){if(this.__e){var d=s;s=void 0,i(a,u,l),s=d}o&&o.call(this,a,u,l)},un.shouldComponentUpdate=i}return n.__N||n.__}function gH(t,e){var r=a4(h0++,3);!yn.__s&&bH(r.__H,e)&&(r.__=t,r.i=e,un.__H.__h.push(r))}function mH(){for(var t;t=e4.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(d0),t.__H.__h.forEach(rv),t.__H.__h=[]}catch(e){t.__H.__h=[],yn.__e(e,t.__v)}}yn.__b=function(t){un=null,t4&&t4(t)},yn.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),o4&&o4(t,e)},yn.__r=function(t){r4&&r4(t),h0=0;var e=(un=t.__c).__H;e&&(ev===un?(e.__h=[],un.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(d0),e.__h.forEach(rv),e.__h=[],h0=0)),ev=un},yn.diffed=function(t){n4&&n4(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(e4.push(e)!==1&&Q5===yn.requestAnimationFrame||((Q5=yn.requestAnimationFrame)||vH)(mH)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),ev=un=null},yn.__c=function(t,e){e.some(function(r){try{r.__h.forEach(d0),r.__h=r.__h.filter(function(n){return!n.__||rv(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],yn.__e(n,r.__v)}}),i4&&i4(t,e)},yn.unmount=function(t){s4&&s4(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{d0(n)}catch(i){e=i}}),r.__H=void 0,e&&yn.__e(e,r.__v))};var u4=typeof requestAnimationFrame=="function";function vH(t){var e,r=function(){clearTimeout(n),u4&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);u4&&(e=requestAnimationFrame(r))}function d0(t){var e=un,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),un=e}function rv(t){var e=un;t.__c=t.__(),un=e}function bH(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function f4(t,e){return typeof e=="function"?e(t):e}const yH=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",wH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",xH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class _H{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=B5()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const r=this.nextItemKey++;return this.items.set(r,e),this.render(),()=>{this.items.delete(r),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&Q1(Or("div",null,Or(l4,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,r])=>Or(EH,Object.assign({},r,{key:e}))))),this.root)}}const l4=t=>Or("div",{class:Fl("-cbwsdk-snackbar-container")},Or("style",null,yH),Or("div",{class:"-cbwsdk-snackbar"},t.children)),EH=({autoExpand:t,message:e,menuItems:r})=>{const[n,i]=c4(!0),[s,o]=c4(t??!1);gH(()=>{const u=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{u.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return Or("div",{class:Fl("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},Or("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},Or("img",{src:wH,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",Or("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),Or("div",{class:"-gear-container"},!s&&Or("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),Or("img",{src:xH,class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&Or("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((u,l)=>Or("div",{class:Fl("-cbwsdk-snackbar-instance-menu-item",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:u.onClick,key:l},Or("svg",{width:u.svgWidth,height:u.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("path",{"fill-rule":u.defaultFillRule,"clip-rule":u.defaultClipRule,d:u.path,fill:"#AAAAAA"})),Or("span",{class:Fl("-cbwsdk-snackbar-instance-menu-item-info",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},u.info)))))};class SH{constructor(){this.attached=!1,this.snackbar=new _H}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.snackbar.attach(r),this.attached=!0,$5()}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}}const AH=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class PH{constructor(){this.root=null,this.darkMode=B5()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),$5()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(Q1(null,this.root),e&&Q1(Or(MH,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const MH=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return Or(l4,{darkMode:r},Or("div",{class:"-cbwsdk-redirect-dialog"},Or("style",null,AH),Or("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),Or("div",{class:Fl("-cbwsdk-redirect-dialog-box",s)},Or("p",null,t),Or("button",{onClick:n},e))))},IH="https://keys.coinbase.com/connect",h4="https://www.walletlink.org",CH="https://go.cb-w.com/walletlink";class d4{constructor(){this.attached=!1,this.redirectDialog=new PH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const r=new URL(CH);r.searchParams.append("redirect_url",oH().href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class Oo{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=aH(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(H1);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!u&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),Oo.accountRequestCallbackIds.size>0&&(Array.from(Oo.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),Oo.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new iH,this.ui=n,this.ui.attach()}subscribe(){const e=Ru.load(this.storage)||Ru.create(this.storage),{linkAPIUrl:r}=this,n=new nH({session:e,linkAPIUrl:r,listener:this}),i=this.isMobileWeb?new d4:new SH;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=Ru.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Ys.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?Js(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?Js(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Nl(e,!0),chainId:r}})}getWalletLinkSession(){return this._session}sendRequest(e){let r=null;const n=dc(8),i=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,s),r==null||r()};return new Promise((s,o)=>{r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,a=>{if(r==null||r(),Hn(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,r){const n={type:"WEB3_REQUEST",id:e,request:r};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:r.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(r.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof d4)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e,r){if(r.method==="requestEthereumAccounts"){Oo.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,r)),Oo.accountRequestCallbackIds.clear();return}this.invokeCallback(e,r)}handleErrorResponse(e,r,n){var i;const s=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:r,errorMessage:s})}invokeCallback(e,r){const n=this.relayEventManager.callbacks.get(e);n&&(n(r),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:r}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:r}},i=dc(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(Hn(a))return o(new Error(a.errorMessage));s(a)}),Oo.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,r,n,i,s,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:o}};let u=null;const l=dc(8),d=g=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,g),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((g,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));g(A)}),this.publishWeb3RequestEvent(l,a)})}addEthereumChain(e,r,n,i,s,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:o}};let u=null;const l=dc(8),d=g=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,g),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((g,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));g(A)}),this.publishWeb3RequestEvent(l,a)})}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})};let i=null;const s=dc(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,u)=>{this.relayEventManager.callbacks.set(s,l=>{if(i==null||i(),Hn(l)&&l.errorCode)return u(Sr.provider.custom({code:l.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(Hn(l))return u(new Error(l.errorMessage));a(l)}),this.publishWeb3RequestEvent(s,n)})}}Oo.accountRequestCallbackIds=new Set;const p4="DefaultChainId",g4="DefaultJsonRpcUrl";class m4{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new Ys("walletlink",h4),this.callback=e.callback||null;const r=this._storage.getItem(H1);if(r){const n=r.split(" ");n[0]!==""&&(this._addresses=n.map(i=>va(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:r,secret:n}=e.getWalletLinkSession();return{id:r,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(g4))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(g4,e)}updateProviderInfo(e,r){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(p4,r.toString(10)),Ll(r)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",ma(r)))}async watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw Sr.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw Sr.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw Sr.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw Sr.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=r.options,l=await this.initializeRelay().watchAsset(r.type,i,s,a,o,n==null?void 0:n.toString());return Hn(l)?!1:!!l.result}async addEthereumChain(e){var r,n;const i=e[0];if(((r=i.rpcUrls)===null||r===void 0?void 0:r.length)===0)throw Sr.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw Sr.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw Sr.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:u=[],chainName:l,iconUrls:d=[],nativeCurrency:g}=i,y=await o.addEthereumChain(s.toString(),a,d,u,l,g);if(Hn(y))return!1;if(((n=y.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw Sr.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const r=e[0],n=Number.parseInt(r.chainId,16),s=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(Hn(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,r){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(s=>va(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(H1,i.join(" ")))}async request(e){const r=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return ma(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(r);case"wallet_switchEthereumChain":return this.switchEthereumChain(r);case"wallet_watchAsset":return this.watchAsset(r);default:if(!this.jsonRpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return v5(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const r=va(e);if(!this._addresses.map(i=>va(i)).includes(r))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?va(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?va(e.to):null,i=e.value!=null?kl(e.value):BigInt(0),s=e.data?F1(e.data):Buffer.alloc(0),o=e.nonce!=null?Ll(e.nonce):null,a=e.gasPrice!=null?kl(e.gasPrice):null,u=e.maxFeePerGas!=null?kl(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?kl(e.maxPriorityFeePerGas):null,d=e.gas!=null?kl(e.gas):null,g=e.chainId?Ll(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:u,maxPriorityFeePerGas:l,gasLimit:d,chainId:g}}async ecRecover(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:k1(n[0]),signature:k1(n[1]),addPrefix:r==="personal_ecRecover"}});if(Hn(s))throw s;return s.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(p4))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,r;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:ma(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(Hn(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:ma(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw Sr.rpc.invalidParams();const r=e[1],n=e[0];this._ensureKnownAddress(r);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:va(r),message:k1(n),addPrefix:!0,typedDataJson:null}});if(Hn(s))throw s;return s.result}async _eth_signTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(r);if(Hn(i))throw i;return i.result}async _eth_sendRawTransaction(e){const r=F1(e[0]),i=await this.initializeRelay().submitEthereumTransaction(r,this.getChainId());if(Hn(i))throw i;return i.result}async _eth_sendTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(r);if(Hn(i))throw i;return i.result}async signTypedData(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const i=l=>{const d={eth_signTypedData_v1:o0.hashForSignTypedDataLegacy,eth_signTypedData_v3:o0.hashForSignTypedData_v3,eth_signTypedData_v4:o0.hashForSignTypedData_v4,eth_signTypedData:o0.hashForSignTypedData_v4};return Nl(d[r]({data:_z(l)}),!0)},s=n[r==="eth_signTypedData_v1"?1:0],o=n[r==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const u=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:va(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(Hn(u))throw u;return u.result}initializeRelay(){return this._relay||(this._relay=new Oo({linkAPIUrl:h4,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const v4="SignerType",b4=new Ys("CBWSDK","SignerConfigurator");function TH(){return b4.getItem(v4)}function RH(t){b4.setItem(v4,t)}async function DH(t){const{communicator:e,metadata:r,handshakeRequest:n,callback:i}=t;NH(e,r,i).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:o}=await e.postRequestAndWaitForResponse(s);return o}function OH(t){const{signerType:e,metadata:r,communicator:n,callback:i}=t;switch(e){case"scw":return new Lz({metadata:r,callback:i,communicator:n});case"walletlink":return new m4({metadata:r,callback:i})}}async function NH(t,e,r){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new m4({metadata:e,callback:r});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const LH=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. +}`;var fr=WA(function(){return Mr(ne,Nt+"return "+Ze).apply(r,he)});if(fr.source=Ze,Ny(fr))throw fr;return fr}function vse(c){return Cr(c).toLowerCase()}function bse(c){return Cr(c).toUpperCase()}function yse(c,h,w){if(c=Cr(c),c&&(w||h===r))return e9(c);if(!c||!(h=ki(h)))return c;var L=Ms(c),W=Ms(h),ne=t9(L,W),he=r9(L,W)+1;return La(L,ne,he).join("")}function wse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.slice(0,i9(c)+1);if(!c||!(h=ki(h)))return c;var L=Ms(c),W=r9(L,Ms(h))+1;return La(L,0,W).join("")}function xse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.replace($,"");if(!c||!(h=ki(h)))return c;var L=Ms(c),W=t9(L,Ms(h));return La(L,W).join("")}function _se(c,h){var w=_e,L=G;if(Qr(h)){var W="separator"in h?h.separator:W;w="length"in h?ur(h.length):w,L="omission"in h?ki(h.omission):L}c=Cr(c);var ne=c.length;if(rf(c)){var he=Ms(c);ne=he.length}if(w>=ne)return c;var me=w-nf(L);if(me<1)return L;var we=he?La(he,0,me).join(""):c.slice(0,me);if(W===r)return we+L;if(he&&(me+=we.length-me),Ly(W)){if(c.slice(me).search(W)){var We,Ke=we;for(W.global||(W=Xb(W.source,Cr(Re.exec(W))+"g")),W.lastIndex=0;We=W.exec(Ke);)var Ze=We.index;we=we.slice(0,Ze===r?me:Ze)}}else if(c.indexOf(ki(W),me)!=me){var xt=we.lastIndexOf(W);xt>-1&&(we=we.slice(0,xt))}return we+L}function Ese(c){return c=Cr(c),c&&Bt.test(c)?c.replace(Xt,ZQ):c}var Sse=lf(function(c,h,w){return c+(w?" ":"")+h.toUpperCase()}),$y=K9("toUpperCase");function HA(c,h,w){return c=Cr(c),h=w?r:h,h===r?VQ(c)?tee(c):$Q(c):c.match(h)||[]}var WA=hr(function(c,h){try{return Bn(c,r,h)}catch(w){return Ny(w)?w:new tr(w)}}),Ase=Wo(function(c,h){return ss(h,function(w){w=so(w),zo(c,w,Dy(c[w],c))}),c});function Pse(c){var h=c==null?0:c.length,w=qt();return c=h?Xr(c,function(L){if(typeof L[1]!="function")throw new os(o);return[w(L[0]),L[1]]}):[],hr(function(L){for(var W=-1;++W_)return[];var w=M,L=ei(c,M);h=qt(h),c-=M;for(var W=Gb(L,h);++w0||h<0)?new xr(w):(c<0?w=w.takeRight(-c):c&&(w=w.drop(c)),h!==r&&(h=ur(h),w=h<0?w.dropRight(-h):w.take(h-c)),w)},xr.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},xr.prototype.toArray=function(){return this.take(M)},no(xr.prototype,function(c,h){var w=/^(?:filter|find|map|reject)|While$/.test(h),L=/^(?:head|last)$/.test(h),W=re[L?"take"+(h=="last"?"Right":""):h],ne=L||/^find/.test(h);W&&(re.prototype[h]=function(){var he=this.__wrapped__,me=L?[1]:arguments,we=he instanceof xr,We=me[0],Ke=we||sr(he),Ze=function(br){var Er=W.apply(re,Ca([br],me));return L&&xt?Er[0]:Er};Ke&&w&&typeof We=="function"&&We.length!=1&&(we=Ke=!1);var xt=this.__chain__,Nt=!!this.__actions__.length,Vt=ne&&!xt,fr=we&&!Nt;if(!ne&&Ke){he=fr?he:new xr(this);var Gt=c.apply(he,me);return Gt.__actions__.push({func:qp,args:[Ze],thisArg:r}),new as(Gt,xt)}return Vt&&fr?c.apply(this,me):(Gt=this.thru(Ze),Vt?L?Gt.value()[0]:Gt.value():Gt)})}),ss(["pop","push","shift","sort","splice","unshift"],function(c){var h=pp[c],w=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",L=/^(?:pop|shift)$/.test(c);re.prototype[c]=function(){var W=arguments;if(L&&!this.__chain__){var ne=this.value();return h.apply(sr(ne)?ne:[],W)}return this[w](function(he){return h.apply(sr(he)?he:[],W)})}}),no(xr.prototype,function(c,h){var w=re[h];if(w){var L=w.name+"";Tr.call(cf,L)||(cf[L]=[]),cf[L].push({name:h,func:w})}}),cf[Lp(r,k).name]=[{name:"wrapper",func:r}],xr.prototype.clone=Eee,xr.prototype.reverse=See,xr.prototype.value=Aee,re.prototype.at=ene,re.prototype.chain=tne,re.prototype.commit=rne,re.prototype.next=nne,re.prototype.plant=sne,re.prototype.reverse=one,re.prototype.toJSON=re.prototype.valueOf=re.prototype.value=ane,re.prototype.first=re.prototype.head,bh&&(re.prototype[bh]=ine),re},sf=ree();gn?((gn.exports=sf)._=sf,Ur._=sf):_r._=sf}).call(nn)}(e0,e0.exports);var Pq=e0.exports,P1={exports:{}};(function(t,e){var r=typeof self<"u"?self:nn,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function u(f){return f&&DataView.prototype.isPrototypeOf(f)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(f){return f&&l.indexOf(Object.prototype.toString.call(f))>-1};function g(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function y(f){return typeof f!="string"&&(f=String(f)),f}function A(f){var p={next:function(){var v=f.shift();return{done:v===void 0,value:v}}};return a.iterable&&(p[Symbol.iterator]=function(){return p}),p}function P(f){this.map={},f instanceof P?f.forEach(function(p,v){this.append(v,p)},this):Array.isArray(f)?f.forEach(function(p){this.append(p[0],p[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(p){this.append(p,f[p])},this)}P.prototype.append=function(f,p){f=g(f),p=y(p);var v=this.map[f];this.map[f]=v?v+", "+p:p},P.prototype.delete=function(f){delete this.map[g(f)]},P.prototype.get=function(f){return f=g(f),this.has(f)?this.map[f]:null},P.prototype.has=function(f){return this.map.hasOwnProperty(g(f))},P.prototype.set=function(f,p){this.map[g(f)]=y(p)},P.prototype.forEach=function(f,p){for(var v in this.map)this.map.hasOwnProperty(v)&&f.call(p,this.map[v],v,this)},P.prototype.keys=function(){var f=[];return this.forEach(function(p,v){f.push(v)}),A(f)},P.prototype.values=function(){var f=[];return this.forEach(function(p){f.push(p)}),A(f)},P.prototype.entries=function(){var f=[];return this.forEach(function(p,v){f.push([v,p])}),A(f)},a.iterable&&(P.prototype[Symbol.iterator]=P.prototype.entries);function N(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function D(f){return new Promise(function(p,v){f.onload=function(){p(f.result)},f.onerror=function(){v(f.error)}})}function k(f){var p=new FileReader,v=D(p);return p.readAsArrayBuffer(f),v}function B(f){var p=new FileReader,v=D(p);return p.readAsText(f),v}function j(f){for(var p=new Uint8Array(f),v=new Array(p.length),x=0;x-1?p:f}function z(f,p){p=p||{};var v=p.body;if(f instanceof z){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,p.headers||(this.headers=new P(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!v&&f._bodyInit!=null&&(v=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=p.credentials||this.credentials||"same-origin",(p.headers||!this.headers)&&(this.headers=new P(p.headers)),this.method=T(p.method||this.method||"GET"),this.mode=p.mode||this.mode||null,this.signal=p.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(v)}z.prototype.clone=function(){return new z(this,{body:this._bodyInit})};function ue(f){var p=new FormData;return f.trim().split("&").forEach(function(v){if(v){var x=v.split("="),_=x.shift().replace(/\+/g," "),S=x.join("=").replace(/\+/g," ");p.append(decodeURIComponent(_),decodeURIComponent(S))}}),p}function _e(f){var p=new P,v=f.replace(/\r?\n[\t ]+/g," ");return v.split(/\r?\n/).forEach(function(x){var _=x.split(":"),S=_.shift().trim();if(S){var b=_.join(":").trim();p.append(S,b)}}),p}K.call(z.prototype);function G(f,p){p||(p={}),this.type="default",this.status=p.status===void 0?200:p.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in p?p.statusText:"OK",this.headers=new P(p.headers),this.url=p.url||"",this._initBody(f)}K.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new P(this.headers),url:this.url})},G.error=function(){var f=new G(null,{status:0,statusText:""});return f.type="error",f};var E=[301,302,303,307,308];G.redirect=function(f,p){if(E.indexOf(p)===-1)throw new RangeError("Invalid status code");return new G(null,{status:p,headers:{location:f}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(p,v){this.message=p,this.name=v;var x=Error(p);this.stack=x.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function m(f,p){return new Promise(function(v,x){var _=new z(f,p);if(_.signal&&_.signal.aborted)return x(new o.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function b(){S.abort()}S.onload=function(){var M={status:S.status,statusText:S.statusText,headers:_e(S.getAllResponseHeaders()||"")};M.url="responseURL"in S?S.responseURL:M.headers.get("X-Request-URL");var I="response"in S?S.response:S.responseText;v(new G(I,M))},S.onerror=function(){x(new TypeError("Network request failed"))},S.ontimeout=function(){x(new TypeError("Network request failed"))},S.onabort=function(){x(new o.DOMException("Aborted","AbortError"))},S.open(_.method,_.url,!0),_.credentials==="include"?S.withCredentials=!0:_.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&a.blob&&(S.responseType="blob"),_.headers.forEach(function(M,I){S.setRequestHeader(I,M)}),_.signal&&(_.signal.addEventListener("abort",b),S.onreadystatechange=function(){S.readyState===4&&_.signal.removeEventListener("abort",b)}),S.send(typeof _._bodyInit>"u"?null:_._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=P,s.Request=z,s.Response=G),o.Headers=P,o.Request=z,o.Response=G,o.fetch=m,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(P1,P1.exports);var Mq=P1.exports;const R6=ji(Mq);var Iq=Object.defineProperty,Cq=Object.defineProperties,Tq=Object.getOwnPropertyDescriptors,D6=Object.getOwnPropertySymbols,Rq=Object.prototype.hasOwnProperty,Dq=Object.prototype.propertyIsEnumerable,O6=(t,e,r)=>e in t?Iq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,N6=(t,e)=>{for(var r in e||(e={}))Rq.call(e,r)&&O6(t,r,e[r]);if(D6)for(var r of D6(e))Dq.call(e,r)&&O6(t,r,e[r]);return t},L6=(t,e)=>Cq(t,Tq(e));const Oq={Accept:"application/json","Content-Type":"application/json"},Nq="POST",k6={headers:Oq,method:Nq},B6=10;let xs=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new qi.EventEmitter,this.isAvailable=!1,this.registering=!1,!k_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=mo(e),n=await(await R6(this.url,L6(N6({},k6),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!k_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=mo({id:1,jsonrpc:"2.0",method:"test",params:[]});await R6(e,L6(N6({},k6),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ka(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return R_(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>B6&&this.events.setMaxListeners(B6)}};const $6="error",Lq="wss://relay.walletconnect.org",kq="wc",Bq="universal_provider",F6=`${kq}@2:${Bq}:`,j6="https://rpc.walletconnect.org/v1/",Iu="generic",$q=`${j6}bundler`,Qi={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Fq=Object.defineProperty,jq=Object.defineProperties,Uq=Object.getOwnPropertyDescriptors,U6=Object.getOwnPropertySymbols,qq=Object.prototype.hasOwnProperty,zq=Object.prototype.propertyIsEnumerable,q6=(t,e,r)=>e in t?Fq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,t0=(t,e)=>{for(var r in e||(e={}))qq.call(e,r)&&q6(t,r,e[r]);if(U6)for(var r of U6(e))zq.call(e,r)&&q6(t,r,e[r]);return t},Hq=(t,e)=>jq(t,Uq(e));function Di(t,e,r){var n;const i=Eu(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${j6}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function fc(t){return t.includes(":")?t.split(":")[1]:t}function z6(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Wq(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function M1(t={},e={}){const r=H6(t),n=H6(e);return Pq.merge(r,n)}function H6(t){var e,r,n,i;const s={};if(!Sl(t))return s;for(const[o,a]of Object.entries(t)){const u=f1(o)?[o]:a.chains,l=a.methods||[],d=a.events||[],g=a.rpcMap||{},y=El(o);s[y]=Hq(t0(t0({},s[y]),a),{chains:Ud(u,(e=s[y])==null?void 0:e.chains),methods:Ud(l,(r=s[y])==null?void 0:r.methods),events:Ud(d,(n=s[y])==null?void 0:n.events),rpcMap:t0(t0({},g),(i=s[y])==null?void 0:i.rpcMap)})}return s}function Kq(t){return t.includes(":")?t.split(":")[2]:t}function W6(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=f1(r)?[r]:n.chains?n.chains:z6(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function I1(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const K6={},Ar=t=>K6[t],C1=(t,e)=>{K6[t]=e};class Vq{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}var Gq=Object.defineProperty,Yq=Object.defineProperties,Jq=Object.getOwnPropertyDescriptors,V6=Object.getOwnPropertySymbols,Xq=Object.prototype.hasOwnProperty,Zq=Object.prototype.propertyIsEnumerable,G6=(t,e,r)=>e in t?Gq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Y6=(t,e)=>{for(var r in e||(e={}))Xq.call(e,r)&&G6(t,r,e[r]);if(V6)for(var r of V6(e))Zq.call(e,r)&&G6(t,r,e[r]);return t},J6=(t,e)=>Yq(t,Jq(e));class Qq{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(fc(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const u=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:J6(Y6({},o.sessionProperties||{}),{capabilities:J6(Y6({},a||{}),{[s]:u})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return u}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(da("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${$q}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class ez{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}let tz=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}},rz=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ji(new xs(n,Ar("disableProviderPing")))}},nz=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=fc(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}},iz=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}};class sz{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}let oz=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new xs(n,Ar("disableProviderPing")))}};class az{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new xs(n))}}class cz{constructor(e){this.name=Iu,this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=Eu(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}var uz=Object.defineProperty,fz=Object.defineProperties,lz=Object.getOwnPropertyDescriptors,X6=Object.getOwnPropertySymbols,hz=Object.prototype.hasOwnProperty,dz=Object.prototype.propertyIsEnumerable,Z6=(t,e,r)=>e in t?uz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,r0=(t,e)=>{for(var r in e||(e={}))hz.call(e,r)&&Z6(t,r,e[r]);if(X6)for(var r of X6(e))dz.call(e,r)&&Z6(t,r,e[r]);return t},T1=(t,e)=>fz(t,lz(e));let Q6=class YA{constructor(e){this.events=new Yg,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||$6})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new YA(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:r0({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,Vd(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Dr("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=W6(this.session.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=W6(s.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==I6)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Iu?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(ic(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await A1.init({core:this.providerOpts.core,logger:this.providerOpts.logger||$6,relayUrl:this.providerOpts.relayUrl||Lq,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>El(r)))];C1("client",this.client),C1("events",this.events),C1("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Wq(r,this.session),i=z6(n),s=M1(this.namespaces,this.optionalNamespaces),o=T1(r0({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new Qq({namespace:o});break;case"algorand":this.rpcProviders[r]=new rz({namespace:o});break;case"solana":this.rpcProviders[r]=new ez({namespace:o});break;case"cosmos":this.rpcProviders[r]=new tz({namespace:o});break;case"polkadot":this.rpcProviders[r]=new Vq({namespace:o});break;case"cip34":this.rpcProviders[r]=new nz({namespace:o});break;case"elrond":this.rpcProviders[r]=new iz({namespace:o});break;case"multiversx":this.rpcProviders[r]=new sz({namespace:o});break;case"near":this.rpcProviders[r]=new oz({namespace:o});break;case"tezos":this.rpcProviders[r]=new az({namespace:o});break;default:this.rpcProviders[Iu]?this.rpcProviders[Iu].updateNamespace(o):this.rpcProviders[Iu]=new cz({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&ic(i)&&this.events.emit("accountsChanged",i.map(Kq))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=El(i),a=I1(i)!==I1(s)?`${o}:${I1(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=T1(r0({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",T1(r0({},Dr("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Qi.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Iu]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>El(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=El(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${F6}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${F6}/${e}`)}};const pz=Q6;function gz(){return new Promise(t=>{const e=[];let r;window.addEventListener("eip6963:announceProvider",n=>{const{detail:i}=n;r&&clearTimeout(r),e.push(i),r=setTimeout(()=>t(e),200)}),r=setTimeout(()=>t(e),200),window.dispatchEvent(new Event("eip6963:requestProvider"))})}class Ys{constructor(e,r){this.scope=e,this.module=r}storeObject(e,r){this.setItem(e,JSON.stringify(r))}loadObject(e){const r=this.getItem(e);return r?JSON.parse(r):void 0}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new Ys("CBWSDK").clear(),new Ys("walletlink").clear()}}const cn={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},R1={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},e5="Unspecified error message.",mz="Unspecified server error.";function D1(t,e=e5){if(t&&Number.isInteger(t)){const r=t.toString();if(O1(R1,r))return R1[r].message;if(t5(t))return mz}return e}function vz(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(R1[e]||t5(t))}function bz(t,{shouldIncludeStack:e=!1}={}){const r={};if(t&&typeof t=="object"&&!Array.isArray(t)&&O1(t,"code")&&vz(t.code)){const n=t;r.code=n.code,n.message&&typeof n.message=="string"?(r.message=n.message,O1(n,"data")&&(r.data=n.data)):(r.message=D1(r.code),r.data={originalError:r5(t)})}else r.code=cn.rpc.internal,r.message=n5(t,"message")?t.message:e5,r.data={originalError:r5(t)};return e&&(r.stack=n5(t,"stack")?t.stack:void 0),r}function t5(t){return t>=-32099&&t<=-32e3}function r5(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function O1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function n5(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const Sr={rpc:{parse:t=>es(cn.rpc.parse,t),invalidRequest:t=>es(cn.rpc.invalidRequest,t),invalidParams:t=>es(cn.rpc.invalidParams,t),methodNotFound:t=>es(cn.rpc.methodNotFound,t),internal:t=>es(cn.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return es(e,t)},invalidInput:t=>es(cn.rpc.invalidInput,t),resourceNotFound:t=>es(cn.rpc.resourceNotFound,t),resourceUnavailable:t=>es(cn.rpc.resourceUnavailable,t),transactionRejected:t=>es(cn.rpc.transactionRejected,t),methodNotSupported:t=>es(cn.rpc.methodNotSupported,t),limitExceeded:t=>es(cn.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Cu(cn.provider.userRejectedRequest,t),unauthorized:t=>Cu(cn.provider.unauthorized,t),unsupportedMethod:t=>Cu(cn.provider.unsupportedMethod,t),disconnected:t=>Cu(cn.provider.disconnected,t),chainDisconnected:t=>Cu(cn.provider.chainDisconnected,t),unsupportedChain:t=>Cu(cn.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new o5(e,r,n)}}};function es(t,e){const[r,n]=i5(e);return new s5(t,r||D1(t),n)}function Cu(t,e){const[r,n]=i5(e);return new o5(t,r||D1(t),n)}function i5(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}class s5 extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}}class o5 extends s5{constructor(e,r,n){if(!yz(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}function yz(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function N1(){return t=>t}const Ol=N1(),wz=N1(),xz=N1();function Co(t){return Math.floor(t)}const a5=/^[0-9]*$/,c5=/^[a-f0-9]*$/;function lc(t){return L1(crypto.getRandomValues(new Uint8Array(t)))}function L1(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function n0(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function Nl(t,e=!1){const r=t.toString("hex");return Ol(e?`0x${r}`:r)}function k1(t){return Nl(F1(t),!0)}function Js(t){return xz(t.toString(10))}function pa(t){return Ol(`0x${BigInt(t).toString(16)}`)}function u5(t){return t.startsWith("0x")||t.startsWith("0X")}function B1(t){return u5(t)?t.slice(2):t}function f5(t){return u5(t)?`0x${t.slice(2)}`:`0x${t}`}function i0(t){if(typeof t!="string")return!1;const e=B1(t).toLowerCase();return c5.test(e)}function _z(t,e=!1){if(typeof t=="string"){const r=B1(t).toLowerCase();if(c5.test(r))return Ol(e?`0x${r}`:r)}throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function $1(t,e=!1){let r=_z(t,!1);return r.length%2===1&&(r=Ol(`0${r}`)),e?Ol(`0x${r}`):r}function ga(t){if(typeof t=="string"){const e=B1(t).toLowerCase();if(i0(e)&&e.length===40)return wz(f5(e))}throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function F1(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(i0(t)){const e=$1(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Sr.rpc.invalidParams(`Not binary data: ${String(t)}`)}function Ll(t){if(typeof t=="number"&&Number.isInteger(t))return Co(t);if(typeof t=="string"){if(a5.test(t))return Co(Number(t));if(i0(t))return Co(Number(BigInt($1(t,!0))))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function kl(t){if(t!==null&&(typeof t=="bigint"||Sz(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(Ll(t));if(typeof t=="string"){if(a5.test(t))return BigInt(t);if(i0(t))return BigInt($1(t,!0))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function Ez(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Sr.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function Sz(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function Az(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function Pz(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Mz(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,new TextEncoder().encode(e));return{iv:r,cipherText:n}}async function Iz(t,{iv:e,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return new TextDecoder().decode(n)}function l5(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function h5(t,e){const r=l5(t),n=await crypto.subtle.exportKey(r,e);return L1(new Uint8Array(n))}async function d5(t,e){const r=l5(t),n=n0(e).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function Cz(t,e){const r=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return Mz(e,r)}async function Tz(t,e){return JSON.parse(await Iz(e,t))}const j1={storageKey:"ownPrivateKey",keyType:"private"},U1={storageKey:"ownPublicKey",keyType:"public"},q1={storageKey:"peerPublicKey",keyType:"public"};class Rz{constructor(){this.storage=new Ys("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(q1,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(U1.storageKey),this.storage.removeItem(j1.storageKey),this.storage.removeItem(q1.storageKey)}async generateKeyPair(){const e=await Az();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(j1,e.privateKey),await this.storeKey(U1,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(j1)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(U1)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(q1)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await Pz(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const r=this.storage.getItem(e.storageKey);return r?d5(e.keyType,r):null}async storeKey(e,r){const n=await h5(e.keyType,r);this.storage.setItem(e.storageKey,n)}}const Bl="4.2.4",p5="@coinbase/wallet-sdk";async function g5(t,e){const r=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":Bl,"X-Cbw-Sdk-Platform":p5}}),{result:i,error:s}=await n.json();if(s)throw s;return i}function Dz(){return globalThis.coinbaseWalletExtension}function Oz(){var t,e;try{const r=globalThis;return(t=r.ethereum)!==null&&t!==void 0?t:(e=r.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Nz({metadata:t,preference:e}){var r,n;const{appName:i,appLogoUrl:s,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const u=Dz();if(u)return(r=u.setAppInfo)===null||r===void 0||r.call(u,i,s,o,e),u}const a=Oz();if(a!=null&&a.isCoinbaseBrowser)return(n=a.setAppInfo)===null||n===void 0||n.call(a,i,s,o,e),a}function Lz(t){if(!t||typeof t!="object"||Array.isArray(t))throw Sr.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:r}=t;if(typeof e!="string"||e.length===0)throw Sr.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Sr.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw Sr.provider.unsupportedMethod()}}const m5="accounts",v5="activeChain",b5="availableChains",y5="walletCapabilities";class kz{constructor(e){var r,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new Rz,this.storage=new Ys("CBWSDK","SCWStateManager"),this.accounts=(r=this.storage.loadObject(m5))!==null&&r!==void 0?r:[],this.chain=this.storage.loadObject(v5)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var r,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(r=e.params)!==null&&r!==void 0?r:{})}}),s=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in s.content)throw s.content.failure;const o=await d5("public",s.sender);await this.keyManager.setPeerPublicKey(o);const u=(await this.decryptResponseMessage(s)).result;if("error"in u)throw u.error;const l=u.value;this.accounts=l,this.storage.storeObject(m5,l),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",l)}async request(e){var r;if(this.accounts.length===0)throw Sr.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:pa(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return pa(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(y5);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var r,n;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const i=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(i)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,r;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(r=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&r!==void 0?r:1}}async handleSwitchChainRequest(e){var r;const n=e.params;if(!n||!(!((r=n[0])===null||r===void 0)&&r.chainId))throw Sr.rpc.invalidParams();const i=Ll(n[0].chainId);if(this.updateChain(i))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(i),o}async sendEncryptedRequest(e){const r=await this.keyManager.getSharedSecret();if(!r)throw Sr.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await Cz({action:e,chainId:this.chain.id},r),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const r=await h5("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:r,content:e,timestamp:new Date}}async decryptResponseMessage(e){var r,n;const i=e.content;if("failure"in i)throw i.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw Sr.provider.unauthorized("Invalid session");const o=await Tz(i.encrypted,s),a=(r=o.data)===null||r===void 0?void 0:r.chains;if(a){const l=Object.entries(a).map(([d,g])=>({id:Number(d),rpcUrl:g}));this.storage.storeObject(b5,l),this.updateChain(this.chain.id,l)}const u=(n=o.data)===null||n===void 0?void 0:n.capabilities;return u&&this.storage.storeObject(y5,u),o}updateChain(e,r){var n;const i=r??this.storage.loadObject(b5),s=i==null?void 0:i.find(o=>o.id===e);return s?(s!==this.chain&&(this.chain=s,this.storage.storeObject(v5,s),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",pa(s.id))),!0):!1}}const Bz=Jp(tM),{keccak_256:$z}=Bz;function w5(t){return Buffer.allocUnsafe(t).fill(0)}function Fz(t){return t.toString(2).length}function x5(t,e){let r=t.toString(16);r.length%2!==0&&(r="0"+r);const n=r.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(r=I5(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(Xs(t,e[s]));if(r==="dynamic"){var o=Xs("uint256",e.length);i.unshift(o)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([Xs("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,si.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Tu(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return si.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Tu(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=hc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+a);if(n<0)throw new Error("Supplied uint is negative");return si.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(r=Tu(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=hc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied int exceeds width: "+r+" vs "+a);const u=si.twosFromBigInt(n,256);return si.bufferBEFromBigInt(u,32)}else if(t.startsWith("ufixed")){if(r=M5(t),n=hc(e),n<0)throw new Error("Supplied ufixed is negative");return Xs("uint256",n*BigInt(2)**BigInt(r[1]))}else if(t.startsWith("fixed"))return r=M5(t),Xs("int256",hc(e)*BigInt(2)**BigInt(r[1]))}throw new Error("Unsupported or invalid type: "+t)}function Wz(t){return t==="string"||t==="bytes"||I5(t)==="dynamic"}function Kz(t){return t.lastIndexOf("]")===t.length-1}function Vz(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var o=P5(t[s]),a=e[s],u=Xs(o,a);Wz(o)?(r.push(Xs("uint256",i)),n.push(u),i+=u.length):r.push(u)}return Buffer.concat(r.concat(n))}function C5(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(si.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=Tu(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=hc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+u);i.push(si.bufferBEFromBigInt(n,r/8))}else if(o.startsWith("int")){if(r=Tu(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=hc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied int exceeds width: "+r+" vs "+u);const l=si.twosFromBigInt(n,r);i.push(si.bufferBEFromBigInt(l,r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function Gz(t,e){return si.keccak(C5(t,e))}var Yz={rawEncode:Vz,solidityPack:C5,soliditySHA3:Gz};const _s=A5,$l=Yz,T5={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},z1={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const o=(a,u,l)=>{if(r[u]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":_s.keccak(this.encodeData(u,l,r,n))];if(l===void 0)throw new Error(`missing value for field ${a} of type ${u}`);if(u==="bytes")return["bytes32",_s.keccak(l)];if(u==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",_s.keccak(l)];if(u.lastIndexOf("]")===u.length-1){const d=u.slice(0,u.lastIndexOf("[")),g=l.map(y=>o(a,d,y));return["bytes32",_s.keccak($l.rawEncode(g.map(([y])=>y),g.map(([,y])=>y)))]}return[u,l]};for(const a of r[t]){const[u,l]=o(a.name,a.type,e[a.name]);i.push(u),s.push(l)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=_s.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=_s.keccak(a),s.push(a);else if(r[o.type]!==void 0)i.push("bytes32"),a=_s.keccak(this.encodeData(o.type,a,r,n)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return $l.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return _s.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return _s.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in T5.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),_s.keccak(Buffer.concat(n))}};var Jz={TYPED_MESSAGE_SCHEMA:T5,TypedDataUtils:z1,hashForSignTypedDataLegacy:function(t){return Xz(t.data)},hashForSignTypedData_v3:function(t){return z1.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return z1.hash(t.data)}};function Xz(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?_s.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return $l.soliditySHA3(["bytes32","bytes32"],[$l.soliditySHA3(new Array(t.length).fill("string"),i),$l.soliditySHA3(n,r)])}const o0=ji(Jz),Zz="walletUsername",H1="Addresses",Qz="AppVersion";function Hn(t){return t.errorMessage!==void 0}class eH{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),a=16,u=o.slice(o.byteLength-a),l=o.slice(0,o.byteLength-a),d=new Uint8Array(u),g=new Uint8Array(l),y=new Uint8Array([...n,...d,...g]);return L1(y)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=n0(e),a=o.slice(0,12),u=o.slice(12,28),l=o.slice(28),d=new Uint8Array([...l,...u]),g={name:"AES-GCM",iv:new Uint8Array(a)};try{const y=await window.crypto.subtle.decrypt(g,s,d),A=new TextDecoder;n(A.decode(y))}catch(y){i(y)}})()})}}class tH{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}var To;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(To||(To={}));class rH{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,To.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.DISCONNECTED)},i.onopen=s=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(u=>this.sendData(u)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const u=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,u)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,To.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const R5=1e4,nH=6e4;class iH{constructor({session:e,linkAPIUrl:r,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Co(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,u)=>{const l=s[u];l!==void 0&&a(l)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,u)},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(Zz,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(Qz,s)},this.handleChainUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(s),l=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(u,l)},this.session=e,this.cipher=new eH(e.secret),this.listener=n;const i=new rH(`${r}/rpc`,WebSocket);i.setConnectionStateListener(async s=>{let o=!1;switch(s){case To.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(u=>setTimeout(u,5e3)),this.destroyed||i.connect().catch(()=>{a()})};a()}break;case To.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},R5),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case To.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(s=>{var o;switch(s.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=s.type==="IsLinkedOK"?s.linked:void 0;this.linked=a||s.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(s.metadata);break}case"Event":{this.handleIncomingEvent(s);break}}s.id!==void 0&&((o=this.requestResolutions.get(s.id))===null||o===void 0||o(s))}),this.ws=i,this.http=new tH(r,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:s,response:o}=i;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s,o)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Co(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>R5*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r={timeout:nH}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r.timeout)}),new Promise(s=>{this.requestResolutions.set(n,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Co(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Co(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id}),!0)}}class sH{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=f5(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}const D5="session:id",O5="session:secret",N5="session:linked";class Ru{constructor(e,r,n,i=!1){this.storage=e,this.id=r,this.secret=n,this.key=NP(Pg(`${r}, ${n} WalletLink`)),this._linked=!!i}static create(e){const r=lc(16),n=lc(32);return new Ru(e,r,n).save()}static load(e){const r=e.getItem(D5),n=e.getItem(N5),i=e.getItem(O5);return r&&i?new Ru(e,r,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(D5,this.id),this.storage.setItem(O5,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(N5,this._linked?"1":"0")}}function oH(){try{return window.frameElement!==null}catch{return!1}}function aH(){try{return oH()&&window.top?window.top.location:window.location}catch{return window.location}}function cH(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function L5(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const uH='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function k5(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(uH)),document.documentElement.appendChild(t)}function B5(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e2&&(o.children=arguments.length>3?a0.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return c0(t,o,n,i,null)}function c0(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++$5,__i:-1,__u:0};return i==null&&Vr.vnode!=null&&Vr.vnode(s),s}function Ul(t){return t.children}function u0(t,e){this.props=t,this.context=e}function Du(t,e){if(e==null)return t.__?Du(t.__,t.__i+1):null;for(var r;ee&&dc.sort(W1));f0.__r=0}function W5(t,e,r,n,i,s,o,a,u,l,d){var g,y,A,P,N,D,k=n&&n.__k||q5,B=e.length;for(u=lH(r,e,k,u),g=0;g0?c0(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,(u=s.__i=hH(s,r,a,g))!==-1&&(g--,(o=r[u])&&(o.__u|=2)),o==null||o.__v===null?(u==-1&&y--,typeof s.type!="function"&&(s.__u|=4)):u!==a&&(u==a-1?y--:u==a+1?y++:(u>a?y--:y++,s.__u|=4))):s=t.__k[i]=null;if(g)for(i=0;i(u!=null&&!(2&u.__u)?1:0))for(;o>=0||a=0){if((u=e[o])&&!(2&u.__u)&&i==u.key&&s===u.type)return o;o--}if(a=r.__.length&&r.__.push({}),r.__[t]}function o4(t){return tv=1,gH(c4,t)}function gH(t,e,r){var n=s4(h0++,2);if(n.t=t,!n.__c&&(n.__=[c4(void 0,e),function(a){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,a);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=un,!un.u)){var i=function(a,u,l){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(y){return!!y.__c});if(d.every(function(y){return!y.__N}))return!s||s.call(this,a,u,l);var g=n.__c.props!==a;return d.forEach(function(y){if(y.__N){var A=y.__[0];y.__=y.__N,y.__N=void 0,A!==y.__[0]&&(g=!0)}}),s&&s.call(this,a,u,l)||g};un.u=!0;var s=un.shouldComponentUpdate,o=un.componentWillUpdate;un.componentWillUpdate=function(a,u,l){if(this.__e){var d=s;s=void 0,i(a,u,l),s=d}o&&o.call(this,a,u,l)},un.shouldComponentUpdate=i}return n.__N||n.__}function mH(t,e){var r=s4(h0++,3);!yn.__s&&yH(r.__H,e)&&(r.__=t,r.i=e,un.__H.__h.push(r))}function vH(){for(var t;t=Z5.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(d0),t.__H.__h.forEach(rv),t.__H.__h=[]}catch(e){t.__H.__h=[],yn.__e(e,t.__v)}}yn.__b=function(t){un=null,Q5&&Q5(t)},yn.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),i4&&i4(t,e)},yn.__r=function(t){e4&&e4(t),h0=0;var e=(un=t.__c).__H;e&&(ev===un?(e.__h=[],un.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(d0),e.__h.forEach(rv),e.__h=[],h0=0)),ev=un},yn.diffed=function(t){t4&&t4(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Z5.push(e)!==1&&X5===yn.requestAnimationFrame||((X5=yn.requestAnimationFrame)||bH)(vH)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),ev=un=null},yn.__c=function(t,e){e.some(function(r){try{r.__h.forEach(d0),r.__h=r.__h.filter(function(n){return!n.__||rv(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],yn.__e(n,r.__v)}}),r4&&r4(t,e)},yn.unmount=function(t){n4&&n4(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{d0(n)}catch(i){e=i}}),r.__H=void 0,e&&yn.__e(e,r.__v))};var a4=typeof requestAnimationFrame=="function";function bH(t){var e,r=function(){clearTimeout(n),a4&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);a4&&(e=requestAnimationFrame(r))}function d0(t){var e=un,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),un=e}function rv(t){var e=un;t.__c=t.__(),un=e}function yH(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function c4(t,e){return typeof e=="function"?e(t):e}const wH=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",xH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",_H="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class EH{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=L5()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const r=this.nextItemKey++;return this.items.set(r,e),this.render(),()=>{this.items.delete(r),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&Q1(Or("div",null,Or(u4,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,r])=>Or(SH,Object.assign({},r,{key:e}))))),this.root)}}const u4=t=>Or("div",{class:Fl("-cbwsdk-snackbar-container")},Or("style",null,wH),Or("div",{class:"-cbwsdk-snackbar"},t.children)),SH=({autoExpand:t,message:e,menuItems:r})=>{const[n,i]=o4(!0),[s,o]=o4(t??!1);mH(()=>{const u=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{u.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return Or("div",{class:Fl("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},Or("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},Or("img",{src:xH,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",Or("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),Or("div",{class:"-gear-container"},!s&&Or("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),Or("img",{src:_H,class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&Or("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((u,l)=>Or("div",{class:Fl("-cbwsdk-snackbar-instance-menu-item",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:u.onClick,key:l},Or("svg",{width:u.svgWidth,height:u.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("path",{"fill-rule":u.defaultFillRule,"clip-rule":u.defaultClipRule,d:u.path,fill:"#AAAAAA"})),Or("span",{class:Fl("-cbwsdk-snackbar-instance-menu-item-info",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},u.info)))))};class AH{constructor(){this.attached=!1,this.snackbar=new EH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.snackbar.attach(r),this.attached=!0,k5()}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}}const PH=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class MH{constructor(){this.root=null,this.darkMode=L5()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),k5()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(Q1(null,this.root),e&&Q1(Or(IH,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const IH=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return Or(u4,{darkMode:r},Or("div",{class:"-cbwsdk-redirect-dialog"},Or("style",null,PH),Or("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),Or("div",{class:Fl("-cbwsdk-redirect-dialog-box",s)},Or("p",null,t),Or("button",{onClick:n},e))))},CH="https://keys.coinbase.com/connect",f4="https://www.walletlink.org",TH="https://go.cb-w.com/walletlink";class l4{constructor(){this.attached=!1,this.redirectDialog=new MH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const r=new URL(TH);r.searchParams.append("redirect_url",aH().href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class Ro{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=cH(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(H1);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!u&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),Ro.accountRequestCallbackIds.size>0&&(Array.from(Ro.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),Ro.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new sH,this.ui=n,this.ui.attach()}subscribe(){const e=Ru.load(this.storage)||Ru.create(this.storage),{linkAPIUrl:r}=this,n=new iH({session:e,linkAPIUrl:r,listener:this}),i=this.isMobileWeb?new l4:new AH;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=Ru.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Ys.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?Js(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?Js(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Nl(e,!0),chainId:r}})}getWalletLinkSession(){return this._session}sendRequest(e){let r=null;const n=lc(8),i=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,s),r==null||r()};return new Promise((s,o)=>{r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,a=>{if(r==null||r(),Hn(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,r){const n={type:"WEB3_REQUEST",id:e,request:r};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:r.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(r.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof l4)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e,r){if(r.method==="requestEthereumAccounts"){Ro.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,r)),Ro.accountRequestCallbackIds.clear();return}this.invokeCallback(e,r)}handleErrorResponse(e,r,n){var i;const s=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:r,errorMessage:s})}invokeCallback(e,r){const n=this.relayEventManager.callbacks.get(e);n&&(n(r),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:r}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:r}},i=lc(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(Hn(a))return o(new Error(a.errorMessage));s(a)}),Ro.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,r,n,i,s,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:o}};let u=null;const l=lc(8),d=g=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,g),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((g,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));g(A)}),this.publishWeb3RequestEvent(l,a)})}addEthereumChain(e,r,n,i,s,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:o}};let u=null;const l=lc(8),d=g=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,g),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((g,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));g(A)}),this.publishWeb3RequestEvent(l,a)})}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})};let i=null;const s=lc(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,u)=>{this.relayEventManager.callbacks.set(s,l=>{if(i==null||i(),Hn(l)&&l.errorCode)return u(Sr.provider.custom({code:l.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(Hn(l))return u(new Error(l.errorMessage));a(l)}),this.publishWeb3RequestEvent(s,n)})}}Ro.accountRequestCallbackIds=new Set;const h4="DefaultChainId",d4="DefaultJsonRpcUrl";class p4{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new Ys("walletlink",f4),this.callback=e.callback||null;const r=this._storage.getItem(H1);if(r){const n=r.split(" ");n[0]!==""&&(this._addresses=n.map(i=>ga(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:r,secret:n}=e.getWalletLinkSession();return{id:r,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(d4))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(d4,e)}updateProviderInfo(e,r){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(h4,r.toString(10)),Ll(r)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",pa(r)))}async watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw Sr.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw Sr.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw Sr.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw Sr.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=r.options,l=await this.initializeRelay().watchAsset(r.type,i,s,a,o,n==null?void 0:n.toString());return Hn(l)?!1:!!l.result}async addEthereumChain(e){var r,n;const i=e[0];if(((r=i.rpcUrls)===null||r===void 0?void 0:r.length)===0)throw Sr.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw Sr.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw Sr.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:u=[],chainName:l,iconUrls:d=[],nativeCurrency:g}=i,y=await o.addEthereumChain(s.toString(),a,d,u,l,g);if(Hn(y))return!1;if(((n=y.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw Sr.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const r=e[0],n=Number.parseInt(r.chainId,16),s=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(Hn(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,r){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(s=>ga(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(H1,i.join(" ")))}async request(e){const r=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return pa(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(r);case"wallet_switchEthereumChain":return this.switchEthereumChain(r);case"wallet_watchAsset":return this.watchAsset(r);default:if(!this.jsonRpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const r=ga(e);if(!this._addresses.map(i=>ga(i)).includes(r))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?ga(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?ga(e.to):null,i=e.value!=null?kl(e.value):BigInt(0),s=e.data?F1(e.data):Buffer.alloc(0),o=e.nonce!=null?Ll(e.nonce):null,a=e.gasPrice!=null?kl(e.gasPrice):null,u=e.maxFeePerGas!=null?kl(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?kl(e.maxPriorityFeePerGas):null,d=e.gas!=null?kl(e.gas):null,g=e.chainId?Ll(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:u,maxPriorityFeePerGas:l,gasLimit:d,chainId:g}}async ecRecover(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:k1(n[0]),signature:k1(n[1]),addPrefix:r==="personal_ecRecover"}});if(Hn(s))throw s;return s.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(h4))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,r;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:pa(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(Hn(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:pa(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw Sr.rpc.invalidParams();const r=e[1],n=e[0];this._ensureKnownAddress(r);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ga(r),message:k1(n),addPrefix:!0,typedDataJson:null}});if(Hn(s))throw s;return s.result}async _eth_signTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(r);if(Hn(i))throw i;return i.result}async _eth_sendRawTransaction(e){const r=F1(e[0]),i=await this.initializeRelay().submitEthereumTransaction(r,this.getChainId());if(Hn(i))throw i;return i.result}async _eth_sendTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(r);if(Hn(i))throw i;return i.result}async signTypedData(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const i=l=>{const d={eth_signTypedData_v1:o0.hashForSignTypedDataLegacy,eth_signTypedData_v3:o0.hashForSignTypedData_v3,eth_signTypedData_v4:o0.hashForSignTypedData_v4,eth_signTypedData:o0.hashForSignTypedData_v4};return Nl(d[r]({data:Ez(l)}),!0)},s=n[r==="eth_signTypedData_v1"?1:0],o=n[r==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const u=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ga(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(Hn(u))throw u;return u.result}initializeRelay(){return this._relay||(this._relay=new Ro({linkAPIUrl:f4,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const g4="SignerType",m4=new Ys("CBWSDK","SignerConfigurator");function RH(){return m4.getItem(g4)}function DH(t){m4.setItem(g4,t)}async function OH(t){const{communicator:e,metadata:r,handshakeRequest:n,callback:i}=t;LH(e,r,i).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:o}=await e.postRequestAndWaitForResponse(s);return o}function NH(t){const{signerType:e,metadata:r,communicator:n,callback:i}=t;switch(e){case"scw":return new kz({metadata:r,callback:i,communicator:n});case"walletlink":return new p4({metadata:r,callback:i})}}async function LH(t,e,r){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new p4({metadata:e,callback:r});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const kH=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. -Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,kH=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,r=await fetch(e,{method:"HEAD"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const n=r.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(LH)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:BH,getCrossOriginOpenerPolicy:$H}=kH(),y4=420,w4=540;function FH(t){const e=(window.innerWidth-y4)/2+window.screenX,r=(window.innerHeight-w4)/2+window.screenY;UH(t);const n=window.open(t,"Smart Wallet",`width=${y4}, height=${w4}, left=${e}, top=${r}`);if(n==null||n.focus(),!n)throw Sr.rpc.internal("Pop up window failed to open");return n}function jH(t){t&&!t.closed&&t.close()}function UH(t){const e={sdkName:m5,sdkVersion:Bl,origin:window.location.origin,coop:$H()};for(const[r,n]of Object.entries(e))t.searchParams.append(r,n.toString())}class qH{constructor({url:e=IH,metadata:r,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=u=>{if(u.origin!==this.url.origin)return;const l=u.data;i(l)&&(s(l),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{jH(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(Sr.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=FH(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:Bl,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw Sr.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=r,this.preference=n}}function zH(t){const e=vz(HH(t),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",Bl),r.searchParams.set("code",e.code.toString()),r.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:r.href})}function HH(t){var e;if(typeof t=="string")return{message:t,code:cn.rpc.internal};if(Hn(t)){const r=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:r.match(/(denied|rejected)/i)?cn.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:r,code:n,data:{method:t.method}})}return t}var x4={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,l,d){this.fn=u,this.context=l,this.once=d||!1}function s(u,l,d,g,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var A=new i(d,g||u,y),P=r?r+l:l;return u._events[P]?u._events[P].fn?u._events[P]=[u._events[P],A]:u._events[P].push(A):(u._events[P]=A,u._eventsCount++),u}function o(u,l){--u._eventsCount===0?u._events=new n:delete u._events[l]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,g;if(this._eventsCount===0)return l;for(g in d=this._events)e.call(d,g)&&l.push(r?g.slice(1):g);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=r?r+l:l,g=this._events[d];if(!g)return[];if(g.fn)return[g.fn];for(var y=0,A=g.length,P=new Array(A);y(i||(i=XH(n)),i)}}function _4(t,e){return function(){return t.apply(e,arguments)}}const{toString:eW}=Object.prototype,{getPrototypeOf:nv}=Object,p0=(t=>e=>{const r=eW.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Es=t=>(t=t.toLowerCase(),e=>p0(e)===t),g0=t=>e=>typeof e===t,{isArray:Ou}=Array,ql=g0("undefined");function tW(t){return t!==null&&!ql(t)&&t.constructor!==null&&!ql(t.constructor)&&Oi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const E4=Es("ArrayBuffer");function rW(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&E4(t.buffer),e}const nW=g0("string"),Oi=g0("function"),S4=g0("number"),m0=t=>t!==null&&typeof t=="object",iW=t=>t===!0||t===!1,v0=t=>{if(p0(t)!=="object")return!1;const e=nv(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},sW=Es("Date"),oW=Es("File"),aW=Es("Blob"),cW=Es("FileList"),uW=t=>m0(t)&&Oi(t.pipe),fW=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Oi(t.append)&&((e=p0(t))==="formdata"||e==="object"&&Oi(t.toString)&&t.toString()==="[object FormData]"))},lW=Es("URLSearchParams"),[hW,dW,pW,gW]=["ReadableStream","Request","Response","Headers"].map(Es),mW=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function zl(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Ou(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const mc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,P4=t=>!ql(t)&&t!==mc;function iv(){const{caseless:t}=P4(this)&&this||{},e={},r=(n,i)=>{const s=t&&A4(e,i)||i;v0(e[s])&&v0(n)?e[s]=iv(e[s],n):v0(n)?e[s]=iv({},n):Ou(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(zl(e,(i,s)=>{r&&Oi(i)?t[s]=_4(i,r):t[s]=i},{allOwnKeys:n}),t),bW=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),yW=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},wW=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&nv(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},xW=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},_W=t=>{if(!t)return null;if(Ou(t))return t;let e=t.length;if(!S4(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},EW=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&nv(Uint8Array)),SW=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},AW=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},PW=Es("HTMLFormElement"),MW=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),M4=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),IW=Es("RegExp"),I4=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};zl(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},CW=t=>{I4(t,(e,r)=>{if(Oi(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Oi(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},TW=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Ou(t)?n(t):n(String(t).split(e)),r},RW=()=>{},DW=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,sv="abcdefghijklmnopqrstuvwxyz",C4="0123456789",T4={DIGIT:C4,ALPHA:sv,ALPHA_DIGIT:sv+sv.toUpperCase()+C4},OW=(t=16,e=T4.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function NW(t){return!!(t&&Oi(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const LW=t=>{const e=new Array(10),r=(n,i)=>{if(m0(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Ou(n)?[]:{};return zl(n,(o,a)=>{const u=r(o,i+1);!ql(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},kW=Es("AsyncFunction"),BW=t=>t&&(m0(t)||Oi(t))&&Oi(t.then)&&Oi(t.catch),R4=((t,e)=>t?setImmediate:e?((r,n)=>(mc.addEventListener("message",({source:i,data:s})=>{i===mc&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),mc.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Oi(mc.postMessage)),$W=typeof queueMicrotask<"u"?queueMicrotask.bind(mc):typeof process<"u"&&process.nextTick||R4,Oe={isArray:Ou,isArrayBuffer:E4,isBuffer:tW,isFormData:fW,isArrayBufferView:rW,isString:nW,isNumber:S4,isBoolean:iW,isObject:m0,isPlainObject:v0,isReadableStream:hW,isRequest:dW,isResponse:pW,isHeaders:gW,isUndefined:ql,isDate:sW,isFile:oW,isBlob:aW,isRegExp:IW,isFunction:Oi,isStream:uW,isURLSearchParams:lW,isTypedArray:EW,isFileList:cW,forEach:zl,merge:iv,extend:vW,trim:mW,stripBOM:bW,inherits:yW,toFlatObject:wW,kindOf:p0,kindOfTest:Es,endsWith:xW,toArray:_W,forEachEntry:SW,matchAll:AW,isHTMLForm:PW,hasOwnProperty:M4,hasOwnProp:M4,reduceDescriptors:I4,freezeMethods:CW,toObjectSet:TW,toCamelCase:MW,noop:RW,toFiniteNumber:DW,findKey:A4,global:mc,isContextDefined:P4,ALPHABET:T4,generateString:OW,isSpecCompliantForm:NW,toJSONObject:LW,isAsyncFn:kW,isThenable:BW,setImmediate:R4,asap:$W};function ar(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Oe.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const D4=ar.prototype,O4={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{O4[t]={value:t}}),Object.defineProperties(ar,O4),Object.defineProperty(D4,"isAxiosError",{value:!0}),ar.from=(t,e,r,n,i,s)=>{const o=Object.create(D4);return Oe.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),ar.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const FW=null;function ov(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function N4(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function L4(t,e,r){return t?t.concat(e).map(function(i,s){return i=N4(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function jW(t){return Oe.isArray(t)&&!t.some(ov)}const UW=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function b0(t,e,r){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Oe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(O,D){return!Oe.isUndefined(D[O])});const n=r.metaTokens,i=r.visitor||d,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(i))throw new TypeError("visitor must be a function");function l(P){if(P===null)return"";if(Oe.isDate(P))return P.toISOString();if(!u&&Oe.isBlob(P))throw new ar("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(P)||Oe.isTypedArray(P)?u&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function d(P,O,D){let k=P;if(P&&!D&&typeof P=="object"){if(Oe.endsWith(O,"{}"))O=n?O:O.slice(0,-2),P=JSON.stringify(P);else if(Oe.isArray(P)&&jW(P)||(Oe.isFileList(P)||Oe.endsWith(O,"[]"))&&(k=Oe.toArray(P)))return O=N4(O),k.forEach(function(j,U){!(Oe.isUndefined(j)||j===null)&&e.append(o===!0?L4([O],U,s):o===null?O:O+"[]",l(j))}),!1}return ov(P)?!0:(e.append(L4(D,O,s),l(P)),!1)}const g=[],y=Object.assign(UW,{defaultVisitor:d,convertValue:l,isVisitable:ov});function A(P,O){if(!Oe.isUndefined(P)){if(g.indexOf(P)!==-1)throw Error("Circular reference detected in "+O.join("."));g.push(P),Oe.forEach(P,function(k,B){(!(Oe.isUndefined(k)||k===null)&&i.call(e,k,Oe.isString(B)?B.trim():B,O,y))===!0&&A(k,O?O.concat(B):[B])}),g.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return A(t),e}function k4(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function av(t,e){this._pairs=[],t&&b0(t,this,e)}const B4=av.prototype;B4.append=function(e,r){this._pairs.push([e,r])},B4.toString=function(e){const r=e?function(n){return e.call(this,n,k4)}:k4;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function qW(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function $4(t,e,r){if(!e)return t;const n=r&&r.encode||qW;Oe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(e,r):s=Oe.isURLSearchParams(e)?e.toString():new av(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class F4{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(n){n!==null&&e(n)})}}const j4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},zW={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:av,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},cv=typeof window<"u"&&typeof document<"u",uv=typeof navigator=="object"&&navigator||void 0,HW=cv&&(!uv||["ReactNative","NativeScript","NS"].indexOf(uv.product)<0),WW=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",KW=cv&&window.location.href||"http://localhost",Xn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:cv,hasStandardBrowserEnv:HW,hasStandardBrowserWebWorkerEnv:WW,navigator:uv,origin:KW},Symbol.toStringTag,{value:"Module"})),...zW};function VW(t,e){return b0(t,new Xn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Xn.isNode&&Oe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function GW(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function YW(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&Oe.isArray(i)?i.length:o,u?(Oe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Oe.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Oe.isArray(i[o])&&(i[o]=YW(i[o])),!a)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const r={};return Oe.forEachEntry(t,(n,i)=>{e(GW(n),i,r,0)}),r}return null}function JW(t,e,r){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const Hl={transitional:j4,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Oe.isObject(e);if(s&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return i?JSON.stringify(U4(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return VW(e,this.formSerializer).toString();if((a=Oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return b0(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),JW(e)):e}],transformResponse:[function(e){const r=this.transitional||Hl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ar.from(a,ar.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xn.classes.FormData,Blob:Xn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{Hl.headers[t]={}});const XW=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ZW=t=>{const e={};let r,n,i;return t&&t.split(` -`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&XW[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},q4=Symbol("internals");function Wl(t){return t&&String(t).trim().toLowerCase()}function y0(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(y0):String(t)}function QW(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const eK=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function fv(t,e,r,n,i){if(Oe.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Oe.isString(e)){if(Oe.isString(n))return e.indexOf(n)!==-1;if(Oe.isRegExp(n))return n.test(e)}}function tK(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function rK(t,e){const r=Oe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}let wi=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,u,l){const d=Wl(u);if(!d)throw new Error("header name must be a non-empty string");const g=Oe.findKey(i,d);(!g||i[g]===void 0||l===!0||l===void 0&&i[g]!==!1)&&(i[g||u]=y0(a))}const o=(a,u)=>Oe.forEach(a,(l,d)=>s(l,d,u));if(Oe.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(Oe.isString(e)&&(e=e.trim())&&!eK(e))o(ZW(e),r);else if(Oe.isHeaders(e))for(const[a,u]of e.entries())s(u,a,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return QW(i);if(Oe.isFunction(r))return r.call(this,i,n);if(Oe.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||fv(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=Wl(o),o){const a=Oe.findKey(n,o);a&&(!r||fv(n,n[a],a,r))&&(delete n[a],i=!0)}}return Oe.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||fv(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Oe.forEach(this,(i,s)=>{const o=Oe.findKey(n,s);if(o){r[o]=y0(i),delete r[s];return}const a=e?tK(s):String(s).trim();a!==s&&delete r[s],r[a]=y0(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Oe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Oe.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[q4]=this[q4]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Wl(o);n[a]||(rK(i,o),n[a]=!0)}return Oe.isArray(e)?e.forEach(s):s(e),this}};wi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Oe.reduceDescriptors(wi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),Oe.freezeMethods(wi);function lv(t,e){const r=this||Hl,n=e||r,i=wi.from(n.headers);let s=n.data;return Oe.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function z4(t){return!!(t&&t.__CANCEL__)}function Nu(t,e,r){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,r),this.name="CanceledError"}Oe.inherits(Nu,ar,{__CANCEL__:!0});function H4(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new ar("Request failed with status code "+r.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function nK(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function iK(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),d=n[s];o||(o=l),r[i]=u,n[i]=l;let g=s,y=0;for(;g!==i;)y+=r[g++],g=g%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),l-o{r=d,i=null,s&&(clearTimeout(s),s=null),t.apply(null,l)};return[(...l)=>{const d=Date.now(),g=d-r;g>=n?o(l,d):(i=l,s||(s=setTimeout(()=>{s=null,o(i)},n-g)))},()=>i&&o(i)]}const w0=(t,e,r=3)=>{let n=0;const i=iK(50,250);return sK(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,u=o-n,l=i(u),d=o<=a;n=o;const g={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:l||void 0,estimated:l&&a&&d?(a-o)/l:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(g)},r)},W4=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},K4=t=>(...e)=>Oe.asap(()=>t(...e)),oK=Xn.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Xn.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Xn.origin),Xn.navigator&&/(msie|trident)/i.test(Xn.navigator.userAgent)):()=>!0,aK=Xn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];Oe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Oe.isString(n)&&o.push("path="+n),Oe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function cK(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function uK(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function V4(t,e){return t&&!cK(e)?uK(t,e):e}const G4=t=>t instanceof wi?{...t}:t;function vc(t,e){e=e||{};const r={};function n(l,d,g,y){return Oe.isPlainObject(l)&&Oe.isPlainObject(d)?Oe.merge.call({caseless:y},l,d):Oe.isPlainObject(d)?Oe.merge({},d):Oe.isArray(d)?d.slice():d}function i(l,d,g,y){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l,g,y)}else return n(l,d,g,y)}function s(l,d){if(!Oe.isUndefined(d))return n(void 0,d)}function o(l,d){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l)}else return n(void 0,d)}function a(l,d,g){if(g in e)return n(l,d);if(g in t)return n(void 0,l)}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,d,g)=>i(G4(l),G4(d),g,!0)};return Oe.forEach(Object.keys(Object.assign({},t,e)),function(d){const g=u[d]||i,y=g(t[d],e[d],d);Oe.isUndefined(y)&&g!==a||(r[d]=y)}),r}const Y4=t=>{const e=vc({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=wi.from(o),e.url=$4(V4(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(Oe.isFormData(r)){if(Xn.hasStandardBrowserEnv||Xn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[l,...d]=u?u.split(";").map(g=>g.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...d].join("; "))}}if(Xn.hasStandardBrowserEnv&&(n&&Oe.isFunction(n)&&(n=n(e)),n||n!==!1&&oK(e.url))){const l=i&&s&&aK.read(s);l&&o.set(i,l)}return e},fK=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=Y4(t);let s=i.data;const o=wi.from(i.headers).normalize();let{responseType:a,onUploadProgress:u,onDownloadProgress:l}=i,d,g,y,A,P;function O(){A&&A(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let D=new XMLHttpRequest;D.open(i.method.toUpperCase(),i.url,!0),D.timeout=i.timeout;function k(){if(!D)return;const j=wi.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),K={data:!a||a==="text"||a==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:j,config:t,request:D};H4(function(T){r(T),O()},function(T){n(T),O()},K),D=null}"onloadend"in D?D.onloadend=k:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(k)},D.onabort=function(){D&&(n(new ar("Request aborted",ar.ECONNABORTED,t,D)),D=null)},D.onerror=function(){n(new ar("Network Error",ar.ERR_NETWORK,t,D)),D=null},D.ontimeout=function(){let U=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const K=i.transitional||j4;i.timeoutErrorMessage&&(U=i.timeoutErrorMessage),n(new ar(U,K.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,D)),D=null},s===void 0&&o.setContentType(null),"setRequestHeader"in D&&Oe.forEach(o.toJSON(),function(U,K){D.setRequestHeader(K,U)}),Oe.isUndefined(i.withCredentials)||(D.withCredentials=!!i.withCredentials),a&&a!=="json"&&(D.responseType=i.responseType),l&&([y,P]=w0(l,!0),D.addEventListener("progress",y)),u&&D.upload&&([g,A]=w0(u),D.upload.addEventListener("progress",g),D.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(d=j=>{D&&(n(!j||j.type?new Nu(null,t,D):j),D.abort(),D=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const B=nK(i.url);if(B&&Xn.protocols.indexOf(B)===-1){n(new ar("Unsupported protocol "+B+":",ar.ERR_BAD_REQUEST,t));return}D.send(s||null)})},lK=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i;const s=function(l){if(!i){i=!0,a();const d=l instanceof Error?l:this.reason;n.abort(d instanceof ar?d:new Nu(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,s(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),t=null)};t.forEach(l=>l.addEventListener("abort",s));const{signal:u}=n;return u.unsubscribe=()=>Oe.asap(a),u}},hK=function*(t,e){let r=t.byteLength;if(r{const i=dK(t,e);let s=0,o,a=u=>{o||(o=!0,n&&n(u))};return new ReadableStream({async pull(u){try{const{done:l,value:d}=await i.next();if(l){a(),u.close();return}let g=d.byteLength;if(r){let y=s+=g;r(y)}u.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(u){return a(u),i.return()}},{highWaterMark:2})},x0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",X4=x0&&typeof ReadableStream=="function",gK=x0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),Z4=(t,...e)=>{try{return!!t(...e)}catch{return!1}},mK=X4&&Z4(()=>{let t=!1;const e=new Request(Xn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Q4=64*1024,hv=X4&&Z4(()=>Oe.isReadableStream(new Response("").body)),_0={stream:hv&&(t=>t.body)};x0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!_0[e]&&(_0[e]=Oe.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,n)})})})(new Response);const vK=async t=>{if(t==null)return 0;if(Oe.isBlob(t))return t.size;if(Oe.isSpecCompliantForm(t))return(await new Request(Xn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(t)||Oe.isArrayBuffer(t))return t.byteLength;if(Oe.isURLSearchParams(t)&&(t=t+""),Oe.isString(t))return(await gK(t)).byteLength},bK=async(t,e)=>{const r=Oe.toFiniteNumber(t.getContentLength());return r??vK(e)},dv={http:FW,xhr:fK,fetch:x0&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:l,headers:d,withCredentials:g="same-origin",fetchOptions:y}=Y4(t);l=l?(l+"").toLowerCase():"text";let A=lK([i,s&&s.toAbortSignal()],o),P;const O=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let D;try{if(u&&mK&&r!=="get"&&r!=="head"&&(D=await bK(d,n))!==0){let K=new Request(e,{method:"POST",body:n,duplex:"half"}),J;if(Oe.isFormData(n)&&(J=K.headers.get("content-type"))&&d.setContentType(J),K.body){const[T,z]=W4(D,w0(K4(u)));n=J4(K.body,Q4,T,z)}}Oe.isString(g)||(g=g?"include":"omit");const k="credentials"in Request.prototype;P=new Request(e,{...y,signal:A,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:k?g:void 0});let B=await fetch(P);const j=hv&&(l==="stream"||l==="response");if(hv&&(a||j&&O)){const K={};["status","statusText","headers"].forEach(ue=>{K[ue]=B[ue]});const J=Oe.toFiniteNumber(B.headers.get("content-length")),[T,z]=a&&W4(J,w0(K4(a),!0))||[];B=new Response(J4(B.body,Q4,T,()=>{z&&z(),O&&O()}),K)}l=l||"text";let U=await _0[Oe.findKey(_0,l)||"text"](B,t);return!j&&O&&O(),await new Promise((K,J)=>{H4(K,J,{data:U,headers:wi.from(B.headers),status:B.status,statusText:B.statusText,config:t,request:P})})}catch(k){throw O&&O(),k&&k.name==="TypeError"&&/fetch/i.test(k.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,P),{cause:k.cause||k}):ar.from(k,k&&k.code,t,P)}})};Oe.forEach(dv,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const e8=t=>`- ${t}`,yK=t=>Oe.isFunction(t)||t===null||t===!1,t8={getAdapter:t=>{t=Oe.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : -`+s.map(e8).join(` -`):" "+e8(s[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:dv};function pv(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Nu(null,t)}function r8(t){return pv(t),t.headers=wi.from(t.headers),t.data=lv.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),t8.getAdapter(t.adapter||Hl.adapter)(t).then(function(n){return pv(t),n.data=lv.call(t,t.transformResponse,n),n.headers=wi.from(n.headers),n},function(n){return z4(n)||(pv(t),n&&n.response&&(n.response.data=lv.call(t,t.transformResponse,n.response),n.response.headers=wi.from(n.response.headers))),Promise.reject(n)})}const n8="1.7.8",E0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{E0[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const i8={};E0.transitional=function(e,r,n){function i(s,o){return"[Axios v"+n8+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new ar(i(o," has been removed"+(r?" in "+r:"")),ar.ERR_DEPRECATED);return r&&!i8[o]&&(i8[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}},E0.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function wK(t,e,r){if(typeof t!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new ar("option "+s+" must be "+u,ar.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ar("Unknown option "+s,ar.ERR_BAD_OPTION)}}const S0={assertOptions:wK,validators:E0},Zs=S0.validators;let bc=class{constructor(e){this.defaults=e,this.interceptors={request:new F4,response:new F4}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` -`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=vc(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&S0.assertOptions(n,{silentJSONParsing:Zs.transitional(Zs.boolean),forcedJSONParsing:Zs.transitional(Zs.boolean),clarifyTimeoutError:Zs.transitional(Zs.boolean)},!1),i!=null&&(Oe.isFunction(i)?r.paramsSerializer={serialize:i}:S0.assertOptions(i,{encode:Zs.function,serialize:Zs.function},!0)),S0.assertOptions(r,{baseUrl:Zs.spelling("baseURL"),withXsrfToken:Zs.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Oe.merge(s.common,s[r.method]);s&&Oe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete s[P]}),r.headers=wi.concat(o,s);const a=[];let u=!0;this.interceptors.request.forEach(function(O){typeof O.runWhen=="function"&&O.runWhen(r)===!1||(u=u&&O.synchronous,a.unshift(O.fulfilled,O.rejected))});const l=[];this.interceptors.response.forEach(function(O){l.push(O.fulfilled,O.rejected)});let d,g=0,y;if(!u){const P=[r8.bind(this),void 0];for(P.unshift.apply(P,a),P.push.apply(P,l),y=P.length,d=Promise.resolve(r);g{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new Nu(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new YA(function(i){e=i}),cancel:e}}};function _K(t){return function(r){return t.apply(null,r)}}function EK(t){return Oe.isObject(t)&&t.isAxiosError===!0}const gv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(gv).forEach(([t,e])=>{gv[e]=t});function s8(t){const e=new bc(t),r=_4(bc.prototype.request,e);return Oe.extend(r,bc.prototype,e,{allOwnKeys:!0}),Oe.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return s8(vc(t,i))},r}const fn=s8(Hl);fn.Axios=bc,fn.CanceledError=Nu,fn.CancelToken=xK,fn.isCancel=z4,fn.VERSION=n8,fn.toFormData=b0,fn.AxiosError=ar,fn.Cancel=fn.CanceledError,fn.all=function(e){return Promise.all(e)},fn.spread=_K,fn.isAxiosError=EK,fn.mergeConfig=vc,fn.AxiosHeaders=wi,fn.formToJSON=t=>U4(Oe.isHTMLForm(t)?new FormData(t):t),fn.getAdapter=t8.getAdapter,fn.HttpStatusCode=gv,fn.default=fn;const{Axios:Loe,AxiosError:SK,CanceledError:koe,isCancel:Boe,CancelToken:$oe,VERSION:Foe,all:joe,Cancel:Uoe,isAxiosError:qoe,spread:zoe,toFormData:Hoe,AxiosHeaders:Woe,HttpStatusCode:Koe,formToJSON:Voe,getAdapter:Goe,mergeConfig:Yoe}=fn,o8=fn.create({timeout:6e4,headers:{"Content-Type":"application/json",token:localStorage.getItem("auth")}});function AK(t){var e,r,n;if(((e=t.data)==null?void 0:e.success)!==!0){const i=new SK((r=t.data)==null?void 0:r.errorMessage,(n=t.data)==null?void 0:n.errorCode,t.config,t.request,t);return Promise.reject(i)}else return t}o8.interceptors.response.use(AK);class PK{constructor(e){co(this,"_apiBase","");this.request=e}setApiBase(e){this._apiBase=e||""}async getNonce(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/nonce`,e);return r.data}async getEmailCode(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/get_code`,e);return r.data}async emailLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async walletLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async tonLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async bindEmail(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindTonWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindEvmWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}}const No=new PK(o8),MK={projectId:"7a4434fefbcc9af474fb5c995e47d286",metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},a8=QH({appName:"codatta",appLogoUrl:"https://avatars.githubusercontent.com/u/171659315"}),c8=Se.createContext({saveLastUsedWallet:()=>{},lastUsedWallet:null,wallets:[],initialized:!1,featuredWallets:[]});function Kl(){return Se.useContext(c8)}function IK(t){const{apiBaseUrl:e}=t,[r,n]=Se.useState([]),[i,s]=Se.useState([]),[o,a]=Se.useState(null),[u,l]=Se.useState(!1),d=A=>{console.log("saveLastUsedWallet",A)};function g(A){const P=A.filter(k=>k.featured||k.installed),O=A.filter(k=>!k.featured&&!k.installed),D=[...P,...O];n(D),s(P)}async function y(){const A=[],P=new Map;ZA.forEach(D=>{const k=new Wf(D);D.name==="Coinbase Wallet"&&k.EIP6963Detected({info:{name:"Coinbase Wallet",uuid:"coinbase",icon:D.image,rdns:"coinbase"},provider:a8.getProvider()}),P.set(k.key,k),A.push(k)}),(await pz()).forEach(D=>{const k=P.get(D.info.name);if(k)k.EIP6963Detected(D);else{const B=new Wf(D);P.set(B.key,B),A.push(B)}});try{const D=JSON.parse(localStorage.getItem("xn-last-used-info")||"{}"),k=P.get(D.key);if(k){if(k.lastUsed=!0,D.provider==="UniversalProvider"){const B=await t5.init(MK);B.session&&k.setUniversalProvider(B)}a(k)}}catch(D){console.log(D)}g(A),l(!0)}return Se.useEffect(()=>{y(),No.setApiBase(e)},[]),le.jsx(c8.Provider,{value:{saveLastUsedWallet:d,wallets:r,initialized:u,lastUsedWallet:o,featuredWallets:i},children:t.children})}/** +Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,BH=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,r=await fetch(e,{method:"HEAD"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const n=r.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(kH)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:$H,getCrossOriginOpenerPolicy:FH}=BH(),v4=420,b4=540;function jH(t){const e=(window.innerWidth-v4)/2+window.screenX,r=(window.innerHeight-b4)/2+window.screenY;qH(t);const n=window.open(t,"Smart Wallet",`width=${v4}, height=${b4}, left=${e}, top=${r}`);if(n==null||n.focus(),!n)throw Sr.rpc.internal("Pop up window failed to open");return n}function UH(t){t&&!t.closed&&t.close()}function qH(t){const e={sdkName:p5,sdkVersion:Bl,origin:window.location.origin,coop:FH()};for(const[r,n]of Object.entries(e))t.searchParams.append(r,n.toString())}class zH{constructor({url:e=CH,metadata:r,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=u=>{if(u.origin!==this.url.origin)return;const l=u.data;i(l)&&(s(l),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{UH(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(Sr.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=jH(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:Bl,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw Sr.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=r,this.preference=n}}function HH(t){const e=bz(WH(t),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",Bl),r.searchParams.set("code",e.code.toString()),r.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:r.href})}function WH(t){var e;if(typeof t=="string")return{message:t,code:cn.rpc.internal};if(Hn(t)){const r=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:r.match(/(denied|rejected)/i)?cn.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:r,code:n,data:{method:t.method}})}return t}var y4={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,l,d){this.fn=u,this.context=l,this.once=d||!1}function s(u,l,d,g,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var A=new i(d,g||u,y),P=r?r+l:l;return u._events[P]?u._events[P].fn?u._events[P]=[u._events[P],A]:u._events[P].push(A):(u._events[P]=A,u._eventsCount++),u}function o(u,l){--u._eventsCount===0?u._events=new n:delete u._events[l]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,g;if(this._eventsCount===0)return l;for(g in d=this._events)e.call(d,g)&&l.push(r?g.slice(1):g);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=r?r+l:l,g=this._events[d];if(!g)return[];if(g.fn)return[g.fn];for(var y=0,A=g.length,P=new Array(A);y(i||(i=ZH(n)),i)}}function w4(t,e){return function(){return t.apply(e,arguments)}}const{toString:tW}=Object.prototype,{getPrototypeOf:nv}=Object,p0=(t=>e=>{const r=tW.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Es=t=>(t=t.toLowerCase(),e=>p0(e)===t),g0=t=>e=>typeof e===t,{isArray:Ou}=Array,ql=g0("undefined");function rW(t){return t!==null&&!ql(t)&&t.constructor!==null&&!ql(t.constructor)&&Oi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const x4=Es("ArrayBuffer");function nW(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&x4(t.buffer),e}const iW=g0("string"),Oi=g0("function"),_4=g0("number"),m0=t=>t!==null&&typeof t=="object",sW=t=>t===!0||t===!1,v0=t=>{if(p0(t)!=="object")return!1;const e=nv(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},oW=Es("Date"),aW=Es("File"),cW=Es("Blob"),uW=Es("FileList"),fW=t=>m0(t)&&Oi(t.pipe),lW=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Oi(t.append)&&((e=p0(t))==="formdata"||e==="object"&&Oi(t.toString)&&t.toString()==="[object FormData]"))},hW=Es("URLSearchParams"),[dW,pW,gW,mW]=["ReadableStream","Request","Response","Headers"].map(Es),vW=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function zl(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Ou(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const pc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,S4=t=>!ql(t)&&t!==pc;function iv(){const{caseless:t}=S4(this)&&this||{},e={},r=(n,i)=>{const s=t&&E4(e,i)||i;v0(e[s])&&v0(n)?e[s]=iv(e[s],n):v0(n)?e[s]=iv({},n):Ou(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(zl(e,(i,s)=>{r&&Oi(i)?t[s]=w4(i,r):t[s]=i},{allOwnKeys:n}),t),yW=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),wW=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},xW=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&nv(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},_W=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},EW=t=>{if(!t)return null;if(Ou(t))return t;let e=t.length;if(!_4(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},SW=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&nv(Uint8Array)),AW=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},PW=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},MW=Es("HTMLFormElement"),IW=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),A4=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),CW=Es("RegExp"),P4=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};zl(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},TW=t=>{P4(t,(e,r)=>{if(Oi(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Oi(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},RW=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Ou(t)?n(t):n(String(t).split(e)),r},DW=()=>{},OW=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,sv="abcdefghijklmnopqrstuvwxyz",M4="0123456789",I4={DIGIT:M4,ALPHA:sv,ALPHA_DIGIT:sv+sv.toUpperCase()+M4},NW=(t=16,e=I4.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function LW(t){return!!(t&&Oi(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const kW=t=>{const e=new Array(10),r=(n,i)=>{if(m0(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Ou(n)?[]:{};return zl(n,(o,a)=>{const u=r(o,i+1);!ql(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},BW=Es("AsyncFunction"),$W=t=>t&&(m0(t)||Oi(t))&&Oi(t.then)&&Oi(t.catch),C4=((t,e)=>t?setImmediate:e?((r,n)=>(pc.addEventListener("message",({source:i,data:s})=>{i===pc&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),pc.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Oi(pc.postMessage)),FW=typeof queueMicrotask<"u"?queueMicrotask.bind(pc):typeof process<"u"&&process.nextTick||C4,Oe={isArray:Ou,isArrayBuffer:x4,isBuffer:rW,isFormData:lW,isArrayBufferView:nW,isString:iW,isNumber:_4,isBoolean:sW,isObject:m0,isPlainObject:v0,isReadableStream:dW,isRequest:pW,isResponse:gW,isHeaders:mW,isUndefined:ql,isDate:oW,isFile:aW,isBlob:cW,isRegExp:CW,isFunction:Oi,isStream:fW,isURLSearchParams:hW,isTypedArray:SW,isFileList:uW,forEach:zl,merge:iv,extend:bW,trim:vW,stripBOM:yW,inherits:wW,toFlatObject:xW,kindOf:p0,kindOfTest:Es,endsWith:_W,toArray:EW,forEachEntry:AW,matchAll:PW,isHTMLForm:MW,hasOwnProperty:A4,hasOwnProp:A4,reduceDescriptors:P4,freezeMethods:TW,toObjectSet:RW,toCamelCase:IW,noop:DW,toFiniteNumber:OW,findKey:E4,global:pc,isContextDefined:S4,ALPHABET:I4,generateString:NW,isSpecCompliantForm:LW,toJSONObject:kW,isAsyncFn:BW,isThenable:$W,setImmediate:C4,asap:FW};function ar(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Oe.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const T4=ar.prototype,R4={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{R4[t]={value:t}}),Object.defineProperties(ar,R4),Object.defineProperty(T4,"isAxiosError",{value:!0}),ar.from=(t,e,r,n,i,s)=>{const o=Object.create(T4);return Oe.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),ar.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const jW=null;function ov(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function D4(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function O4(t,e,r){return t?t.concat(e).map(function(i,s){return i=D4(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function UW(t){return Oe.isArray(t)&&!t.some(ov)}const qW=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function b0(t,e,r){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Oe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(N,D){return!Oe.isUndefined(D[N])});const n=r.metaTokens,i=r.visitor||d,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(i))throw new TypeError("visitor must be a function");function l(P){if(P===null)return"";if(Oe.isDate(P))return P.toISOString();if(!u&&Oe.isBlob(P))throw new ar("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(P)||Oe.isTypedArray(P)?u&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function d(P,N,D){let k=P;if(P&&!D&&typeof P=="object"){if(Oe.endsWith(N,"{}"))N=n?N:N.slice(0,-2),P=JSON.stringify(P);else if(Oe.isArray(P)&&UW(P)||(Oe.isFileList(P)||Oe.endsWith(N,"[]"))&&(k=Oe.toArray(P)))return N=D4(N),k.forEach(function(j,U){!(Oe.isUndefined(j)||j===null)&&e.append(o===!0?O4([N],U,s):o===null?N:N+"[]",l(j))}),!1}return ov(P)?!0:(e.append(O4(D,N,s),l(P)),!1)}const g=[],y=Object.assign(qW,{defaultVisitor:d,convertValue:l,isVisitable:ov});function A(P,N){if(!Oe.isUndefined(P)){if(g.indexOf(P)!==-1)throw Error("Circular reference detected in "+N.join("."));g.push(P),Oe.forEach(P,function(k,B){(!(Oe.isUndefined(k)||k===null)&&i.call(e,k,Oe.isString(B)?B.trim():B,N,y))===!0&&A(k,N?N.concat(B):[B])}),g.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return A(t),e}function N4(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function av(t,e){this._pairs=[],t&&b0(t,this,e)}const L4=av.prototype;L4.append=function(e,r){this._pairs.push([e,r])},L4.toString=function(e){const r=e?function(n){return e.call(this,n,N4)}:N4;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function zW(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function k4(t,e,r){if(!e)return t;const n=r&&r.encode||zW;Oe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(e,r):s=Oe.isURLSearchParams(e)?e.toString():new av(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class B4{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(n){n!==null&&e(n)})}}const $4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},HW={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:av,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},cv=typeof window<"u"&&typeof document<"u",uv=typeof navigator=="object"&&navigator||void 0,WW=cv&&(!uv||["ReactNative","NativeScript","NS"].indexOf(uv.product)<0),KW=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",VW=cv&&window.location.href||"http://localhost",Xn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:cv,hasStandardBrowserEnv:WW,hasStandardBrowserWebWorkerEnv:KW,navigator:uv,origin:VW},Symbol.toStringTag,{value:"Module"})),...HW};function GW(t,e){return b0(t,new Xn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Xn.isNode&&Oe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function YW(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function JW(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&Oe.isArray(i)?i.length:o,u?(Oe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Oe.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Oe.isArray(i[o])&&(i[o]=JW(i[o])),!a)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const r={};return Oe.forEachEntry(t,(n,i)=>{e(YW(n),i,r,0)}),r}return null}function XW(t,e,r){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const Hl={transitional:$4,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Oe.isObject(e);if(s&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return i?JSON.stringify(F4(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return GW(e,this.formSerializer).toString();if((a=Oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return b0(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),XW(e)):e}],transformResponse:[function(e){const r=this.transitional||Hl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ar.from(a,ar.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xn.classes.FormData,Blob:Xn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{Hl.headers[t]={}});const ZW=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),QW=t=>{const e={};let r,n,i;return t&&t.split(` +`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&ZW[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},j4=Symbol("internals");function Wl(t){return t&&String(t).trim().toLowerCase()}function y0(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(y0):String(t)}function eK(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const tK=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function fv(t,e,r,n,i){if(Oe.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Oe.isString(e)){if(Oe.isString(n))return e.indexOf(n)!==-1;if(Oe.isRegExp(n))return n.test(e)}}function rK(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function nK(t,e){const r=Oe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}let wi=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,u,l){const d=Wl(u);if(!d)throw new Error("header name must be a non-empty string");const g=Oe.findKey(i,d);(!g||i[g]===void 0||l===!0||l===void 0&&i[g]!==!1)&&(i[g||u]=y0(a))}const o=(a,u)=>Oe.forEach(a,(l,d)=>s(l,d,u));if(Oe.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(Oe.isString(e)&&(e=e.trim())&&!tK(e))o(QW(e),r);else if(Oe.isHeaders(e))for(const[a,u]of e.entries())s(u,a,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return eK(i);if(Oe.isFunction(r))return r.call(this,i,n);if(Oe.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||fv(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=Wl(o),o){const a=Oe.findKey(n,o);a&&(!r||fv(n,n[a],a,r))&&(delete n[a],i=!0)}}return Oe.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||fv(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Oe.forEach(this,(i,s)=>{const o=Oe.findKey(n,s);if(o){r[o]=y0(i),delete r[s];return}const a=e?rK(s):String(s).trim();a!==s&&delete r[s],r[a]=y0(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Oe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Oe.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[j4]=this[j4]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Wl(o);n[a]||(nK(i,o),n[a]=!0)}return Oe.isArray(e)?e.forEach(s):s(e),this}};wi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Oe.reduceDescriptors(wi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),Oe.freezeMethods(wi);function lv(t,e){const r=this||Hl,n=e||r,i=wi.from(n.headers);let s=n.data;return Oe.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function U4(t){return!!(t&&t.__CANCEL__)}function Nu(t,e,r){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,r),this.name="CanceledError"}Oe.inherits(Nu,ar,{__CANCEL__:!0});function q4(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new ar("Request failed with status code "+r.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function iK(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function sK(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),d=n[s];o||(o=l),r[i]=u,n[i]=l;let g=s,y=0;for(;g!==i;)y+=r[g++],g=g%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),l-o{r=d,i=null,s&&(clearTimeout(s),s=null),t.apply(null,l)};return[(...l)=>{const d=Date.now(),g=d-r;g>=n?o(l,d):(i=l,s||(s=setTimeout(()=>{s=null,o(i)},n-g)))},()=>i&&o(i)]}const w0=(t,e,r=3)=>{let n=0;const i=sK(50,250);return oK(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,u=o-n,l=i(u),d=o<=a;n=o;const g={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:l||void 0,estimated:l&&a&&d?(a-o)/l:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(g)},r)},z4=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},H4=t=>(...e)=>Oe.asap(()=>t(...e)),aK=Xn.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Xn.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Xn.origin),Xn.navigator&&/(msie|trident)/i.test(Xn.navigator.userAgent)):()=>!0,cK=Xn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];Oe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Oe.isString(n)&&o.push("path="+n),Oe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function uK(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function fK(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function W4(t,e){return t&&!uK(e)?fK(t,e):e}const K4=t=>t instanceof wi?{...t}:t;function gc(t,e){e=e||{};const r={};function n(l,d,g,y){return Oe.isPlainObject(l)&&Oe.isPlainObject(d)?Oe.merge.call({caseless:y},l,d):Oe.isPlainObject(d)?Oe.merge({},d):Oe.isArray(d)?d.slice():d}function i(l,d,g,y){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l,g,y)}else return n(l,d,g,y)}function s(l,d){if(!Oe.isUndefined(d))return n(void 0,d)}function o(l,d){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l)}else return n(void 0,d)}function a(l,d,g){if(g in e)return n(l,d);if(g in t)return n(void 0,l)}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,d,g)=>i(K4(l),K4(d),g,!0)};return Oe.forEach(Object.keys(Object.assign({},t,e)),function(d){const g=u[d]||i,y=g(t[d],e[d],d);Oe.isUndefined(y)&&g!==a||(r[d]=y)}),r}const V4=t=>{const e=gc({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=wi.from(o),e.url=k4(W4(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(Oe.isFormData(r)){if(Xn.hasStandardBrowserEnv||Xn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[l,...d]=u?u.split(";").map(g=>g.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...d].join("; "))}}if(Xn.hasStandardBrowserEnv&&(n&&Oe.isFunction(n)&&(n=n(e)),n||n!==!1&&aK(e.url))){const l=i&&s&&cK.read(s);l&&o.set(i,l)}return e},lK=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=V4(t);let s=i.data;const o=wi.from(i.headers).normalize();let{responseType:a,onUploadProgress:u,onDownloadProgress:l}=i,d,g,y,A,P;function N(){A&&A(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let D=new XMLHttpRequest;D.open(i.method.toUpperCase(),i.url,!0),D.timeout=i.timeout;function k(){if(!D)return;const j=wi.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),K={data:!a||a==="text"||a==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:j,config:t,request:D};q4(function(T){r(T),N()},function(T){n(T),N()},K),D=null}"onloadend"in D?D.onloadend=k:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(k)},D.onabort=function(){D&&(n(new ar("Request aborted",ar.ECONNABORTED,t,D)),D=null)},D.onerror=function(){n(new ar("Network Error",ar.ERR_NETWORK,t,D)),D=null},D.ontimeout=function(){let U=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const K=i.transitional||$4;i.timeoutErrorMessage&&(U=i.timeoutErrorMessage),n(new ar(U,K.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,D)),D=null},s===void 0&&o.setContentType(null),"setRequestHeader"in D&&Oe.forEach(o.toJSON(),function(U,K){D.setRequestHeader(K,U)}),Oe.isUndefined(i.withCredentials)||(D.withCredentials=!!i.withCredentials),a&&a!=="json"&&(D.responseType=i.responseType),l&&([y,P]=w0(l,!0),D.addEventListener("progress",y)),u&&D.upload&&([g,A]=w0(u),D.upload.addEventListener("progress",g),D.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(d=j=>{D&&(n(!j||j.type?new Nu(null,t,D):j),D.abort(),D=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const B=iK(i.url);if(B&&Xn.protocols.indexOf(B)===-1){n(new ar("Unsupported protocol "+B+":",ar.ERR_BAD_REQUEST,t));return}D.send(s||null)})},hK=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i;const s=function(l){if(!i){i=!0,a();const d=l instanceof Error?l:this.reason;n.abort(d instanceof ar?d:new Nu(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,s(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),t=null)};t.forEach(l=>l.addEventListener("abort",s));const{signal:u}=n;return u.unsubscribe=()=>Oe.asap(a),u}},dK=function*(t,e){let r=t.byteLength;if(r{const i=pK(t,e);let s=0,o,a=u=>{o||(o=!0,n&&n(u))};return new ReadableStream({async pull(u){try{const{done:l,value:d}=await i.next();if(l){a(),u.close();return}let g=d.byteLength;if(r){let y=s+=g;r(y)}u.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(u){return a(u),i.return()}},{highWaterMark:2})},x0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Y4=x0&&typeof ReadableStream=="function",mK=x0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),J4=(t,...e)=>{try{return!!t(...e)}catch{return!1}},vK=Y4&&J4(()=>{let t=!1;const e=new Request(Xn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),X4=64*1024,hv=Y4&&J4(()=>Oe.isReadableStream(new Response("").body)),_0={stream:hv&&(t=>t.body)};x0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!_0[e]&&(_0[e]=Oe.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,n)})})})(new Response);const bK=async t=>{if(t==null)return 0;if(Oe.isBlob(t))return t.size;if(Oe.isSpecCompliantForm(t))return(await new Request(Xn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(t)||Oe.isArrayBuffer(t))return t.byteLength;if(Oe.isURLSearchParams(t)&&(t=t+""),Oe.isString(t))return(await mK(t)).byteLength},yK=async(t,e)=>{const r=Oe.toFiniteNumber(t.getContentLength());return r??bK(e)},dv={http:jW,xhr:lK,fetch:x0&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:l,headers:d,withCredentials:g="same-origin",fetchOptions:y}=V4(t);l=l?(l+"").toLowerCase():"text";let A=hK([i,s&&s.toAbortSignal()],o),P;const N=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let D;try{if(u&&vK&&r!=="get"&&r!=="head"&&(D=await yK(d,n))!==0){let K=new Request(e,{method:"POST",body:n,duplex:"half"}),J;if(Oe.isFormData(n)&&(J=K.headers.get("content-type"))&&d.setContentType(J),K.body){const[T,z]=z4(D,w0(H4(u)));n=G4(K.body,X4,T,z)}}Oe.isString(g)||(g=g?"include":"omit");const k="credentials"in Request.prototype;P=new Request(e,{...y,signal:A,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:k?g:void 0});let B=await fetch(P);const j=hv&&(l==="stream"||l==="response");if(hv&&(a||j&&N)){const K={};["status","statusText","headers"].forEach(ue=>{K[ue]=B[ue]});const J=Oe.toFiniteNumber(B.headers.get("content-length")),[T,z]=a&&z4(J,w0(H4(a),!0))||[];B=new Response(G4(B.body,X4,T,()=>{z&&z(),N&&N()}),K)}l=l||"text";let U=await _0[Oe.findKey(_0,l)||"text"](B,t);return!j&&N&&N(),await new Promise((K,J)=>{q4(K,J,{data:U,headers:wi.from(B.headers),status:B.status,statusText:B.statusText,config:t,request:P})})}catch(k){throw N&&N(),k&&k.name==="TypeError"&&/fetch/i.test(k.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,P),{cause:k.cause||k}):ar.from(k,k&&k.code,t,P)}})};Oe.forEach(dv,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Z4=t=>`- ${t}`,wK=t=>Oe.isFunction(t)||t===null||t===!1,Q4={getAdapter:t=>{t=Oe.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : +`+s.map(Z4).join(` +`):" "+Z4(s[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:dv};function pv(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Nu(null,t)}function e8(t){return pv(t),t.headers=wi.from(t.headers),t.data=lv.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Q4.getAdapter(t.adapter||Hl.adapter)(t).then(function(n){return pv(t),n.data=lv.call(t,t.transformResponse,n),n.headers=wi.from(n.headers),n},function(n){return U4(n)||(pv(t),n&&n.response&&(n.response.data=lv.call(t,t.transformResponse,n.response),n.response.headers=wi.from(n.response.headers))),Promise.reject(n)})}const t8="1.7.8",E0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{E0[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const r8={};E0.transitional=function(e,r,n){function i(s,o){return"[Axios v"+t8+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new ar(i(o," has been removed"+(r?" in "+r:"")),ar.ERR_DEPRECATED);return r&&!r8[o]&&(r8[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}},E0.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function xK(t,e,r){if(typeof t!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new ar("option "+s+" must be "+u,ar.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ar("Unknown option "+s,ar.ERR_BAD_OPTION)}}const S0={assertOptions:xK,validators:E0},Zs=S0.validators;let mc=class{constructor(e){this.defaults=e,this.interceptors={request:new B4,response:new B4}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` +`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=gc(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&S0.assertOptions(n,{silentJSONParsing:Zs.transitional(Zs.boolean),forcedJSONParsing:Zs.transitional(Zs.boolean),clarifyTimeoutError:Zs.transitional(Zs.boolean)},!1),i!=null&&(Oe.isFunction(i)?r.paramsSerializer={serialize:i}:S0.assertOptions(i,{encode:Zs.function,serialize:Zs.function},!0)),S0.assertOptions(r,{baseUrl:Zs.spelling("baseURL"),withXsrfToken:Zs.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Oe.merge(s.common,s[r.method]);s&&Oe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete s[P]}),r.headers=wi.concat(o,s);const a=[];let u=!0;this.interceptors.request.forEach(function(N){typeof N.runWhen=="function"&&N.runWhen(r)===!1||(u=u&&N.synchronous,a.unshift(N.fulfilled,N.rejected))});const l=[];this.interceptors.response.forEach(function(N){l.push(N.fulfilled,N.rejected)});let d,g=0,y;if(!u){const P=[e8.bind(this),void 0];for(P.unshift.apply(P,a),P.push.apply(P,l),y=P.length,d=Promise.resolve(r);g{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new Nu(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new JA(function(i){e=i}),cancel:e}}};function EK(t){return function(r){return t.apply(null,r)}}function SK(t){return Oe.isObject(t)&&t.isAxiosError===!0}const gv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(gv).forEach(([t,e])=>{gv[e]=t});function n8(t){const e=new mc(t),r=w4(mc.prototype.request,e);return Oe.extend(r,mc.prototype,e,{allOwnKeys:!0}),Oe.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return n8(gc(t,i))},r}const fn=n8(Hl);fn.Axios=mc,fn.CanceledError=Nu,fn.CancelToken=_K,fn.isCancel=U4,fn.VERSION=t8,fn.toFormData=b0,fn.AxiosError=ar,fn.Cancel=fn.CanceledError,fn.all=function(e){return Promise.all(e)},fn.spread=EK,fn.isAxiosError=SK,fn.mergeConfig=gc,fn.AxiosHeaders=wi,fn.formToJSON=t=>F4(Oe.isHTMLForm(t)?new FormData(t):t),fn.getAdapter=Q4.getAdapter,fn.HttpStatusCode=gv,fn.default=fn;const{Axios:$oe,AxiosError:i8,CanceledError:Foe,isCancel:joe,CancelToken:Uoe,VERSION:qoe,all:zoe,Cancel:Hoe,isAxiosError:Woe,spread:Koe,toFormData:Voe,AxiosHeaders:Goe,HttpStatusCode:Yoe,formToJSON:Joe,getAdapter:Xoe,mergeConfig:Zoe}=fn,s8=fn.create({timeout:6e4,headers:{"Content-Type":"application/json",token:localStorage.getItem("auth")}});function AK(t){var e,r,n;if(((e=t.data)==null?void 0:e.success)!==!0){const i=new i8((r=t.data)==null?void 0:r.errorMessage,(n=t.data)==null?void 0:n.errorCode,t.config,t.request,t);return Promise.reject(i)}else return t}function PK(t){var r;console.log(t);const e=(r=t.response)==null?void 0:r.data;if(e){console.log(e,"responseData");const n=new i8(e.errorMessage,t.code,t.config,t.request,t.response);return Promise.reject(n)}else return Promise.reject(t)}s8.interceptors.response.use(AK,PK);class MK{constructor(e){oo(this,"_apiBase","");this.request=e}setApiBase(e){this._apiBase=e||""}async getNonce(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/nonce`,e);return r.data}async getEmailCode(e,r){const{data:n}=await this.request.post(`${this._apiBase}/api/v2/user/get_code`,e,{headers:{"Captcha-Param":r}});return n.data}async emailLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async walletLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async tonLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async bindEmail(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindTonWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindEvmWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}}const va=new MK(s8),IK={projectId:"7a4434fefbcc9af474fb5c995e47d286",metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},o8=eW({appName:"codatta",appLogoUrl:"https://avatars.githubusercontent.com/u/171659315"}),a8=Se.createContext({saveLastUsedWallet:()=>{},lastUsedWallet:null,wallets:[],initialized:!1,featuredWallets:[]});function Kl(){return Se.useContext(a8)}function CK(t){const{apiBaseUrl:e}=t,[r,n]=Se.useState([]),[i,s]=Se.useState([]),[o,a]=Se.useState(null),[u,l]=Se.useState(!1),d=A=>{console.log("saveLastUsedWallet",A)};function g(A){const P=A.filter(k=>k.featured||k.installed),N=A.filter(k=>!k.featured&&!k.installed),D=[...P,...N];n(D),s(P)}async function y(){const A=[],P=new Map;QA.forEach(D=>{const k=new Wf(D);D.name==="Coinbase Wallet"&&k.EIP6963Detected({info:{name:"Coinbase Wallet",uuid:"coinbase",icon:D.image,rdns:"coinbase"},provider:o8.getProvider()}),P.set(k.key,k),A.push(k)}),(await gz()).forEach(D=>{const k=P.get(D.info.name);if(k)k.EIP6963Detected(D);else{const B=new Wf(D);P.set(B.key,B),A.push(B)}});try{const D=JSON.parse(localStorage.getItem("xn-last-used-info")||"{}"),k=P.get(D.key);if(k){if(k.lastUsed=!0,D.provider==="UniversalProvider"){const B=await Q6.init(IK);B.session&&k.setUniversalProvider(B)}a(k)}}catch(D){console.log(D)}g(A),l(!0)}return Se.useEffect(()=>{y(),va.setApiBase(e)},[]),ge.jsx(a8.Provider,{value:{saveLastUsedWallet:d,wallets:r,initialized:u,lastUsedWallet:o,featuredWallets:i},children:t.children})}/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const CK=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),u8=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/** + */const TK=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),c8=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */var TK={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + */var RK={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const RK=Se.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:s,iconNode:o,...a},u)=>Se.createElement("svg",{ref:u,...TK,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:u8("lucide",i),...a},[...o.map(([l,d])=>Se.createElement(l,d)),...Array.isArray(s)?s:[s]]));/** + */const DK=Se.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:s,iconNode:o,...a},u)=>Se.createElement("svg",{ref:u,...RK,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:c8("lucide",i),...a},[...o.map(([l,d])=>Se.createElement(l,d)),...Array.isArray(s)?s:[s]]));/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ss=(t,e)=>{const r=Se.forwardRef(({className:n,...i},s)=>Se.createElement(RK,{ref:s,iconNode:e,className:u8(`lucide-${CK(t)}`,n),...i}));return r.displayName=`${t}`,r};/** + */const ts=(t,e)=>{const r=Se.forwardRef(({className:n,...i},s)=>Se.createElement(DK,{ref:s,iconNode:e,className:c8(`lucide-${TK(t)}`,n),...i}));return r.displayName=`${t}`,r};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const DK=Ss("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + */const OK=ts("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const f8=Ss("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + */const u8=ts("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const OK=Ss("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const NK=ts("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const NK=Ss("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** + */const LK=ts("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const LK=Ss("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + */const kK=ts("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kK=Ss("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** + */const BK=ts("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const l8=Ss("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** + */const f8=ts("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const BK=Ss("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** + */const $K=ts("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ya=Ss("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + */const vc=ts("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const h8=Ss("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** + */const FK=ts("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const d8=Ss("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),p8=new Set;function A0(t,e,r){t||p8.has(e)||(console.warn(e),p8.add(e))}function $K(t){if(typeof Proxy>"u")return t;const e=new Map,r=(...n)=>(process.env.NODE_ENV!=="production"&&A0(!1,"motion() is deprecated. Use motion.create() instead."),t(...n));return new Proxy(r,{get:(n,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}function P0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const mv=t=>Array.isArray(t);function g8(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function vv(t,e,r,n){if(typeof e=="function"){const[i,s]=m8(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=m8(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function M0(t,e,r){const n=t.getProps();return vv(n,e,r!==void 0?r:n.custom,t)}const bv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],yv=["initial",...bv],Gl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],yc=new Set(Gl),Qs=t=>t*1e3,Lo=t=>t/1e3,FK={type:"spring",stiffness:500,damping:25,restSpeed:10},jK=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),UK={type:"keyframes",duration:.8},qK={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},zK=(t,{keyframes:e})=>e.length>2?UK:yc.has(t)?t.startsWith("scale")?jK(e[1]):FK:qK;function wv(t,e){return t?t[e]||t.default||t:void 0}const HK={useManualTiming:!1},WK=t=>t!==null;function I0(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(WK),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const Wn=t=>t;function KK(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){s.has(l)&&(u.schedule(l),t()),l(o)}const u={schedule:(l,d=!1,g=!1)=>{const A=g&&n?e:r;return d&&s.add(l),A.has(l)||A.add(l),l},cancel:l=>{r.delete(l),s.delete(l)},process:l=>{if(o=l,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,u.process(l))}};return u}const C0=["read","resolveKeyframes","update","preRender","render","postRender"],VK=40;function v8(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=C0.reduce((k,B)=>(k[B]=KK(s),k),{}),{read:a,resolveKeyframes:u,update:l,preRender:d,render:g,postRender:y}=o,A=()=>{const k=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(k-i.timestamp,VK),1),i.timestamp=k,i.isProcessing=!0,a.process(i),u.process(i),l.process(i),d.process(i),g.process(i),y.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(A))},P=()=>{r=!0,n=!0,i.isProcessing||t(A)};return{schedule:C0.reduce((k,B)=>{const j=o[B];return k[B]=(U,K=!1,J=!1)=>(r||P(),j.schedule(U,K,J)),k},{}),cancel:k=>{for(let B=0;B(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,GK=1e-7,YK=12;function JK(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=b8(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>GK&&++aJK(s,0,1,t,r);return s=>s===0||s===1?s:b8(i(s),e,n)}const y8=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,w8=t=>e=>1-t(1-e),x8=Yl(.33,1.53,.69,.99),_v=w8(x8),_8=y8(_v),E8=t=>(t*=2)<1?.5*_v(t):.5*(2-Math.pow(2,-10*(t-1))),Ev=t=>1-Math.sin(Math.acos(t)),S8=w8(Ev),A8=y8(Ev),P8=t=>/^0[^.\s]+$/u.test(t);function XK(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||P8(t):!0}let Lu=Wn,ko=Wn;process.env.NODE_ENV!=="production"&&(Lu=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},ko=(t,e)=>{if(!t)throw new Error(e)});const M8=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),I8=t=>e=>typeof e=="string"&&e.startsWith(t),C8=I8("--"),ZK=I8("var(--"),Sv=t=>ZK(t)?QK.test(t.split("/*")[0].trim()):!1,QK=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,eV=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function tV(t){const e=eV.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}const rV=4;function T8(t,e,r=1){ko(r<=rV,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[n,i]=tV(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return M8(o)?parseFloat(o):o}return Sv(i)?T8(i,e,r+1):i}const xa=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},Jl={...ku,transform:t=>xa(0,1,t)},T0={...ku,default:1},Xl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),_a=Xl("deg"),eo=Xl("%"),zt=Xl("px"),nV=Xl("vh"),iV=Xl("vw"),R8={...eo,parse:t=>eo.parse(t)/100,transform:t=>eo.transform(t*100)},sV=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),D8=t=>t===ku||t===zt,O8=(t,e)=>parseFloat(t.split(", ")[e]),N8=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return O8(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?O8(s[1],t):0}},oV=new Set(["x","y","z"]),aV=Gl.filter(t=>!oV.has(t));function cV(t){const e=[];return aV.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const Bu={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:N8(4,13),y:N8(5,14)};Bu.translateX=Bu.x,Bu.translateY=Bu.y;const L8=t=>e=>e.test(t),k8=[ku,zt,eo,_a,iV,nV,{test:t=>t==="auto",parse:t=>t}],B8=t=>k8.find(L8(t)),wc=new Set;let Av=!1,Pv=!1;function $8(){if(Pv){const t=Array.from(wc).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=cV(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}Pv=!1,Av=!1,wc.forEach(t=>t.complete()),wc.clear()}function F8(){wc.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Pv=!0)})}function uV(){F8(),$8()}class Mv{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(wc.add(this),Av||(Av=!0,Nr.read(F8),Nr.resolveKeyframes($8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sMath.round(t*1e5)/1e5,Iv=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function fV(t){return t==null}const lV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Cv=(t,e)=>r=>!!(typeof r=="string"&&lV.test(r)&&r.startsWith(t)||e&&!fV(r)&&Object.prototype.hasOwnProperty.call(r,e)),j8=(t,e,r)=>n=>{if(typeof n!="string")return n;const[i,s,o,a]=n.match(Iv);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},hV=t=>xa(0,255,t),Tv={...ku,transform:t=>Math.round(hV(t))},xc={test:Cv("rgb","red"),parse:j8("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+Tv.transform(t)+", "+Tv.transform(e)+", "+Tv.transform(r)+", "+Zl(Jl.transform(n))+")"};function dV(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const Rv={test:Cv("#"),parse:dV,transform:xc.transform},$u={test:Cv("hsl","hue"),parse:j8("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+eo.transform(Zl(e))+", "+eo.transform(Zl(r))+", "+Zl(Jl.transform(n))+")"},Zn={test:t=>xc.test(t)||Rv.test(t)||$u.test(t),parse:t=>xc.test(t)?xc.parse(t):$u.test(t)?$u.parse(t):Rv.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?xc.transform(t):$u.transform(t)},pV=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function gV(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Iv))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(pV))===null||r===void 0?void 0:r.length)||0)>0}const U8="number",q8="color",mV="var",vV="var(",z8="${}",bV=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ql(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(bV,u=>(Zn.test(u)?(n.color.push(s),i.push(q8),r.push(Zn.parse(u))):u.startsWith(vV)?(n.var.push(s),i.push(mV),r.push(u)):(n.number.push(s),i.push(U8),r.push(parseFloat(u))),++s,z8)).split(z8);return{values:r,split:a,indexes:n,types:i}}function H8(t){return Ql(t).values}function W8(t){const{split:e,types:r}=Ql(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function wV(t){const e=H8(t);return W8(t)(e.map(yV))}const Ea={test:gV,parse:H8,createTransformer:W8,getAnimatableNone:wV},xV=new Set(["brightness","contrast","saturate","opacity"]);function _V(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(Iv)||[];if(!n)return t;const i=r.replace(n,"");let s=xV.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const EV=/\b([a-z-]*)\(.*?\)/gu,Dv={...Ea,getAnimatableNone:t=>{const e=t.match(EV);return e?e.map(_V).join(" "):t}},SV={borderWidth:zt,borderTopWidth:zt,borderRightWidth:zt,borderBottomWidth:zt,borderLeftWidth:zt,borderRadius:zt,radius:zt,borderTopLeftRadius:zt,borderTopRightRadius:zt,borderBottomRightRadius:zt,borderBottomLeftRadius:zt,width:zt,maxWidth:zt,height:zt,maxHeight:zt,top:zt,right:zt,bottom:zt,left:zt,padding:zt,paddingTop:zt,paddingRight:zt,paddingBottom:zt,paddingLeft:zt,margin:zt,marginTop:zt,marginRight:zt,marginBottom:zt,marginLeft:zt,backgroundPositionX:zt,backgroundPositionY:zt},AV={rotate:_a,rotateX:_a,rotateY:_a,rotateZ:_a,scale:T0,scaleX:T0,scaleY:T0,scaleZ:T0,skew:_a,skewX:_a,skewY:_a,distance:zt,translateX:zt,translateY:zt,translateZ:zt,x:zt,y:zt,z:zt,perspective:zt,transformPerspective:zt,opacity:Jl,originX:R8,originY:R8,originZ:zt},K8={...ku,transform:Math.round},Ov={...SV,...AV,zIndex:K8,size:zt,fillOpacity:Jl,strokeOpacity:Jl,numOctaves:K8},PV={...Ov,color:Zn,backgroundColor:Zn,outlineColor:Zn,fill:Zn,stroke:Zn,borderColor:Zn,borderTopColor:Zn,borderRightColor:Zn,borderBottomColor:Zn,borderLeftColor:Zn,filter:Dv,WebkitFilter:Dv},Nv=t=>PV[t];function V8(t,e){let r=Nv(t);return r!==Dv&&(r=Ea),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const MV=new Set(["auto","none","0"]);function IV(t,e,r){let n=0,i;for(;n{r.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function Lv(t){return typeof t=="function"}let R0;function CV(){R0=void 0}const to={now:()=>(R0===void 0&&to.set(Kn.isProcessing||HK.useManualTiming?Kn.timestamp:performance.now()),R0),set:t=>{R0=t,queueMicrotask(CV)}},Y8=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Ea.test(t)||t==="0")&&!t.startsWith("url("));function TV(t){const e=t[0];if(t.length===1)return!0;for(let r=0;rDV?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&uV(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=to.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:u,isGenerator:l}=this.options;if(!l&&!RV(e,n,i,s))if(o)this.options.duration=0;else{u==null||u(I0(e,this.options,r)),a==null||a(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,r);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...d},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function X8(t,e){return e?t*(1e3/e):0}const OV=5;function Z8(t,e,r){const n=Math.max(e-OV,0);return X8(r-t(n),e-n)}const kv=.001,NV=.01,Q8=10,LV=.05,kV=1;function BV({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;Lu(t<=Qs(Q8),"Spring duration must be 10 seconds or less");let o=1-e;o=xa(LV,kV,o),t=xa(NV,Q8,Lo(t)),o<1?(i=l=>{const d=l*o,g=d*t,y=d-r,A=Bv(l,o),P=Math.exp(-g);return kv-y/A*P},s=l=>{const g=l*o*t,y=g*r+r,A=Math.pow(o,2)*Math.pow(l,2)*t,P=Math.exp(-g),O=Bv(Math.pow(l,2),o);return(-i(l)+kv>0?-1:1)*((y-A)*P)/O}):(i=l=>{const d=Math.exp(-l*t),g=(l-r)*t+1;return-kv+d*g},s=l=>{const d=Math.exp(-l*t),g=(r-l)*(t*t);return d*g});const a=5/t,u=FV(i,s,a);if(t=Qs(t),isNaN(u))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(u,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:t}}}const $V=12;function FV(t,e,r){let n=r;for(let i=1;i<$V;i++)n=n-t(n)/e(n);return n}function Bv(t,e){return t*Math.sqrt(1-e*e)}const jV=["duration","bounce"],UV=["stiffness","damping","mass"];function eE(t,e){return e.some(r=>t[r]!==void 0)}function qV(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!eE(t,UV)&&eE(t,jV)){const r=BV(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function tE({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:u,mass:l,duration:d,velocity:g,isResolvedFromDuration:y}=qV({...n,velocity:-Lo(n.velocity||0)}),A=g||0,P=u/(2*Math.sqrt(a*l)),O=s-i,D=Lo(Math.sqrt(a/l)),k=Math.abs(O)<5;r||(r=k?.01:2),e||(e=k?.005:.5);let B;if(P<1){const j=Bv(D,P);B=U=>{const K=Math.exp(-P*D*U);return s-K*((A+P*D*O)/j*Math.sin(j*U)+O*Math.cos(j*U))}}else if(P===1)B=j=>s-Math.exp(-D*j)*(O+(A+D*O)*j);else{const j=D*Math.sqrt(P*P-1);B=U=>{const K=Math.exp(-P*D*U),J=Math.min(j*U,300);return s-K*((A+P*D*O)*Math.sinh(J)+j*O*Math.cosh(J))/j}}return{calculatedDuration:y&&d||null,next:j=>{const U=B(j);if(y)o.done=j>=d;else{let K=0;P<1&&(K=j===0?Qs(A):Z8(B,j,U));const J=Math.abs(K)<=r,T=Math.abs(s-U)<=e;o.done=J&&T}return o.value=o.done?s:U,o}}}function rE({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:d}){const g=t[0],y={done:!1,value:g},A=z=>a!==void 0&&zu,P=z=>a===void 0?u:u===void 0||Math.abs(a-z)-O*Math.exp(-z/n),j=z=>k+B(z),U=z=>{const ue=B(z),_e=j(z);y.done=Math.abs(ue)<=l,y.value=y.done?k:_e};let K,J;const T=z=>{A(y.value)&&(K=z,J=tE({keyframes:[y.value,P(y.value)],velocity:Z8(j,z,y.value),damping:i,stiffness:s,restDelta:l,restSpeed:d}))};return T(0),{calculatedDuration:null,next:z=>{let ue=!1;return!J&&K===void 0&&(ue=!0,U(z),T(z)),K!==void 0&&z>=K?J.next(z-K):(!ue&&U(z),y)}}}const zV=Yl(.42,0,1,1),HV=Yl(0,0,.58,1),nE=Yl(.42,0,.58,1),WV=t=>Array.isArray(t)&&typeof t[0]!="number",$v=t=>Array.isArray(t)&&typeof t[0]=="number",iE={linear:Wn,easeIn:zV,easeInOut:nE,easeOut:HV,circIn:Ev,circInOut:A8,circOut:S8,backIn:_v,backInOut:_8,backOut:x8,anticipate:E8},sE=t=>{if($v(t)){ko(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,r,n,i]=t;return Yl(e,r,n,i)}else if(typeof t=="string")return ko(iE[t]!==void 0,`Invalid easing type '${t}'`),iE[t];return t},KV=(t,e)=>r=>e(t(r)),Bo=(...t)=>t.reduce(KV),Fu=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},Zr=(t,e,r)=>t+(e-t)*r;function Fv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function VV({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,u=2*r-a;i=Fv(u,a,t+1/3),s=Fv(u,a,t),o=Fv(u,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function D0(t,e){return r=>r>0?e:t}const jv=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},GV=[Rv,xc,$u],YV=t=>GV.find(e=>e.test(t));function oE(t){const e=YV(t);if(Lu(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let r=e.parse(t);return e===$u&&(r=VV(r)),r}const aE=(t,e)=>{const r=oE(t),n=oE(e);if(!r||!n)return D0(t,e);const i={...r};return s=>(i.red=jv(r.red,n.red,s),i.green=jv(r.green,n.green,s),i.blue=jv(r.blue,n.blue,s),i.alpha=Zr(r.alpha,n.alpha,s),xc.transform(i))},Uv=new Set(["none","hidden"]);function JV(t,e){return Uv.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function XV(t,e){return r=>Zr(t,e,r)}function qv(t){return typeof t=="number"?XV:typeof t=="string"?Sv(t)?D0:Zn.test(t)?aE:eG:Array.isArray(t)?cE:typeof t=="object"?Zn.test(t)?aE:ZV:D0}function cE(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>qv(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function QV(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=Ea.createTransformer(e),n=Ql(t),i=Ql(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?Uv.has(t)&&!i.values.length||Uv.has(e)&&!n.values.length?JV(t,e):Bo(cE(QV(n,i),i.values),r):(Lu(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),D0(t,e))};function uE(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Zr(t,e,r):qv(t)(t,e)}function tG(t,e,r){const n=[],i=r||uE,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=tG(e,n,i),a=o.length,u=l=>{let d=0;if(a>1)for(;du(xa(t[0],t[s-1],l)):u}function nG(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=Fu(0,e,n);t.push(Zr(r,1,i))}}function iG(t){const e=[0];return nG(e,t.length-1),e}function sG(t,e){return t.map(r=>r*e)}function oG(t,e){return t.map(()=>e||nE).splice(0,t.length-1)}function O0({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=WV(n)?n.map(sE):sE(n),s={done:!1,value:e[0]},o=sG(r&&r.length===e.length?r:iG(e),t),a=rG(o,e,{ease:Array.isArray(i)?i:oG(e,i)});return{calculatedDuration:t,next:u=>(s.value=a(u),s.done=u>=t,s)}}const fE=2e4;function aG(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=fE?1/0:e}const cG=t=>{const e=({timestamp:r})=>t(r);return{start:()=>Nr.update(e,!0),stop:()=>wa(e),now:()=>Kn.isProcessing?Kn.timestamp:to.now()}},uG={decay:rE,inertia:rE,tween:O0,keyframes:O0,spring:tE},fG=t=>t/100;class zv extends J8{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:u}=this.options;u&&u()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Mv,a=(u,l)=>this.onKeyframesResolved(u,l);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=Lv(r)?r:uG[r]||O0;let u,l;a!==O0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&ko(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),u=Bo(fG,uE(e[0],e[1])),e=[0,100]);const d=a({...this.options,keyframes:e});s==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=aG(d));const{calculatedDuration:g}=d,y=g+i,A=y*(n+1)-i;return{generator:d,mirroredGenerator:l,mapPercentToKeyframes:u,calculatedDuration:g,resolvedDuration:y,totalDuration:A}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:z}=this.options;return{done:!0,value:z[z.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:u,calculatedDuration:l,totalDuration:d,resolvedDuration:g}=n;if(this.startTime===null)return s.next(0);const{delay:y,repeat:A,repeatType:P,repeatDelay:O,onUpdate:D}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const k=this.currentTime-y*(this.speed>=0?1:-1),B=this.speed>=0?k<0:k>d;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let j=this.currentTime,U=s;if(A){const z=Math.min(this.currentTime,d)/g;let ue=Math.floor(z),_e=z%1;!_e&&z>=1&&(_e=1),_e===1&&ue--,ue=Math.min(ue,A+1),!!(ue%2)&&(P==="reverse"?(_e=1-_e,O&&(_e-=O/g)):P==="mirror"&&(U=o)),j=xa(0,1,_e)*g}const K=B?{done:!1,value:u[0]}:U.next(j);a&&(K.value=a(K.value));let{done:J}=K;!B&&l!==null&&(J=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&J);return T&&i!==void 0&&(K.value=I0(u,this.options,i)),D&&D(K.value),T&&this.finish(),K}get duration(){const{resolved:e}=this;return e?Lo(e.calculatedDuration):0}get time(){return Lo(this.currentTime)}set time(e){e=Qs(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=Lo(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=cG,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const lG=new Set(["opacity","clipPath","filter","transform"]),hG=10,dG=(t,e)=>{let r="";const n=Math.max(Math.round(e/hG),2);for(let i=0;i(e===void 0&&(e=t()),e)}const pG={linearEasing:void 0};function gG(t,e){const r=Hv(t);return()=>{var n;return(n=pG[e])!==null&&n!==void 0?n:r()}}const N0=gG(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function lE(t){return!!(typeof t=="function"&&N0()||!t||typeof t=="string"&&(t in Wv||N0())||$v(t)||Array.isArray(t)&&t.every(lE))}const eh=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,Wv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:eh([0,.65,.55,1]),circOut:eh([.55,0,1,.45]),backIn:eh([.31,.01,.66,-.59]),backOut:eh([.33,1.53,.69,.99])};function hE(t,e){if(t)return typeof t=="function"&&N0()?dG(t,e):$v(t)?eh(t):Array.isArray(t)?t.map(r=>hE(r,e)||Wv.easeOut):Wv[t]}function mG(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:u}={}){const l={[e]:r};u&&(l.offset=u);const d=hE(a,i);return Array.isArray(d)&&(l.easing=d),t.animate(l,{delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function dE(t,e){t.timeline=e,t.onfinish=null}const vG=Hv(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),L0=10,bG=2e4;function yG(t){return Lv(t.type)||t.type==="spring"||!lE(t.ease)}function wG(t,e){const r=new zv({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&sthis.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:u,name:l,startTime:d}=this.options;if(!(!((n=u.owner)===null||n===void 0)&&n.current))return!1;if(typeof o=="string"&&N0()&&xG(o)&&(o=pE[o]),yG(this.options)){const{onComplete:y,onUpdate:A,motionValue:P,element:O,...D}=this.options,k=wG(e,D);e=k.keyframes,e.length===1&&(e[1]=e[0]),i=k.duration,s=k.times,o=k.ease,a="keyframes"}const g=mG(u.owner.current,l,e,{...this.options,duration:i,times:s,ease:o});return g.startTime=d??this.calcStartTime(),this.pendingTimeline?(dE(g,this.pendingTimeline),this.pendingTimeline=void 0):g.onfinish=()=>{const{onComplete:y}=this.options;u.set(I0(e,this.options,r)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:g,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return Lo(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return Lo(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=Qs(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return Wn;const{animation:n}=r;dE(n,e)}return Wn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:d,onComplete:g,element:y,...A}=this.options,P=new zv({...A,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),O=Qs(this.time);l.setWithVelocity(P.sample(O-L0).value,P.sample(O).value,L0)}const{onStop:u}=this.options;u&&u(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return vG()&&n&&lG.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}const _G=Hv(()=>window.ScrollTimeline!==void 0);class EG{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;n_G()&&i.attachTimeline?i.attachTimeline(e):r(i));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function SG({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:u,elapsed:l,...d}){return!!Object.keys(d).length}const Kv=(t,e,r,n={},i,s)=>o=>{const a=wv(n,t)||{},u=a.delay||n.delay||0;let{elapsed:l=0}=n;l=l-Qs(u);let d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:y=>{e.set(y),a.onUpdate&&a.onUpdate(y)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:i};SG(a)||(d={...d,...zK(t,d)}),d.duration&&(d.duration=Qs(d.duration)),d.repeatDelay&&(d.repeatDelay=Qs(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let g=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(g=!0)),g&&!s&&e.get()!==void 0){const y=I0(d.keyframes,a);if(y!==void 0)return Nr.update(()=>{d.onUpdate(y),d.onComplete()}),new EG([])}return!s&&gE.supports(d)?new gE(d):new zv(d)},AG=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),PG=t=>mv(t)?t[t.length-1]||0:t;function Vv(t,e){t.indexOf(e)===-1&&t.push(e)}function Gv(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class Yv{constructor(){this.subscriptions=[]}add(e){return Vv(this.subscriptions,e),()=>Gv(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class IG{constructor(e,r={}){this.version="11.11.17",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=to.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=to.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=MG(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&A0(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new Yv);const n=this.events[e].add(r);return e==="change"?()=>{n(),Nr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=to.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>mE)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,mE);return X8(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function th(t,e){return new IG(t,e)}function CG(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,th(r))}function TG(t,e){const r=M0(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=PG(s[o]);CG(t,o,a)}}const Jv=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),vE="data-"+Jv("framerAppearId");function bE(t){return t.props[vE]}const Qn=t=>!!(t&&t.getVelocity);function RG(t){return!!(Qn(t)&&t.add)}function Xv(t,e){const r=t.getValue("willChange");if(RG(r))return r.add(e)}function DG({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function yE(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...u}=e;n&&(o=n);const l=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const g in u){const y=t.getValue(g,(s=t.latestValues[g])!==null&&s!==void 0?s:null),A=u[g];if(A===void 0||d&&DG(d,g))continue;const P={delay:r,...wv(o||{},g)};let O=!1;if(window.MotionHandoffAnimation){const k=bE(t);if(k){const B=window.MotionHandoffAnimation(k,g,Nr);B!==null&&(P.startTime=B,O=!0)}}Xv(t,g),y.start(Kv(g,y,A,t.shouldReduceMotion&&yc.has(g)?{type:!1}:P,t,O));const D=y.animation;D&&l.push(D)}return a&&Promise.all(l).then(()=>{Nr.update(()=>{a&&TG(t,a)})}),l}function Zv(t,e,r={}){var n;const i=M0(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(yE(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:g,staggerDirection:y}=s;return OG(t,e,d+l,g,y,r)}:()=>Promise.resolve(),{when:u}=s;if(u){const[l,d]=u==="beforeChildren"?[o,a]:[a,o];return l().then(()=>d())}else return Promise.all([o(),a(r.delay)])}function OG(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,u=i===1?(l=0)=>l*n:(l=0)=>a-l*n;return Array.from(t.variantChildren).sort(NG).forEach((l,d)=>{l.notify("AnimationStart",e),o.push(Zv(l,e,{...s,delay:r+u(d)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function NG(t,e){return t.sortNodePosition(e)}function LG(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>Zv(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=Zv(t,e,r);else{const i=typeof e=="function"?M0(t,e,r.custom):e;n=Promise.all(yE(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const kG=yv.length;function wE(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?wE(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;rPromise.all(e.map(({animation:r,options:n})=>LG(t,r,n)))}function jG(t){let e=FG(t),r=xE(),n=!0;const i=u=>(l,d)=>{var g;const y=M0(t,d,u==="exit"?(g=t.presenceContext)===null||g===void 0?void 0:g.custom:void 0);if(y){const{transition:A,transitionEnd:P,...O}=y;l={...l,...O,...P}}return l};function s(u){e=u(t)}function o(u){const{props:l}=t,d=wE(t.parent)||{},g=[],y=new Set;let A={},P=1/0;for(let D=0;D<$G;D++){const k=BG[D],B=r[k],j=l[k]!==void 0?l[k]:d[k],U=Vl(j),K=k===u?B.isActive:null;K===!1&&(P=D);let J=j===d[k]&&j!==l[k]&&U;if(J&&n&&t.manuallyAnimateOnMount&&(J=!1),B.protectedKeys={...A},!B.isActive&&K===null||!j&&!B.prevProp||P0(j)||typeof j=="boolean")continue;const T=UG(B.prevProp,j);let z=T||k===u&&B.isActive&&!J&&U||D>P&&U,ue=!1;const _e=Array.isArray(j)?j:[j];let G=_e.reduce(i(k),{});K===!1&&(G={});const{prevResolvedValues:E={}}=B,m={...E,...G},f=x=>{z=!0,y.has(x)&&(ue=!0,y.delete(x)),B.needsAnimating[x]=!0;const _=t.getValue(x);_&&(_.liveStyle=!1)};for(const x in m){const _=G[x],S=E[x];if(A.hasOwnProperty(x))continue;let b=!1;mv(_)&&mv(S)?b=!g8(_,S):b=_!==S,b?_!=null?f(x):y.add(x):_!==void 0&&y.has(x)?f(x):B.protectedKeys[x]=!0}B.prevProp=j,B.prevResolvedValues=G,B.isActive&&(A={...A,...G}),n&&t.blockInitialAnimation&&(z=!1),z&&(!(J&&T)||ue)&&g.push(..._e.map(x=>({animation:x,options:{type:k}})))}if(y.size){const D={};y.forEach(k=>{const B=t.getBaseTarget(k),j=t.getValue(k);j&&(j.liveStyle=!0),D[k]=B??null}),g.push({animation:D})}let O=!!g.length;return n&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(O=!1),n=!1,O?e(g):Promise.resolve()}function a(u,l){var d;if(r[u].isActive===l)return Promise.resolve();(d=t.variantChildren)===null||d===void 0||d.forEach(y=>{var A;return(A=y.animationState)===null||A===void 0?void 0:A.setActive(u,l)}),r[u].isActive=l;const g=o(u);for(const y in r)r[y].protectedKeys={};return g}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=xE(),n=!0}}}function UG(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!g8(e,t):!1}function _c(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function xE(){return{animate:_c(!0),whileInView:_c(),whileHover:_c(),whileTap:_c(),whileDrag:_c(),whileFocus:_c(),exit:_c()}}class Sa{constructor(e){this.isMounted=!1,this.node=e}update(){}}class qG extends Sa{constructor(e){super(e),e.animationState||(e.animationState=jG(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();P0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let zG=0;class HG extends Sa{constructor(){super(...arguments),this.id=zG++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const WG={animation:{Feature:qG},exit:{Feature:HG}},_E=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function k0(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const KG=t=>e=>_E(e)&&t(e,k0(e));function $o(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function Fo(t,e,r,n){return $o(t,e,KG(r),n)}const EE=(t,e)=>Math.abs(t-e);function VG(t,e){const r=EE(t.x,e.x),n=EE(t.y,e.y);return Math.sqrt(r**2+n**2)}class SE{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=eb(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,A=VG(g.offset,{x:0,y:0})>=3;if(!y&&!A)return;const{point:P}=g,{timestamp:O}=Kn;this.history.push({...P,timestamp:O});const{onStart:D,onMove:k}=this.handlers;y||(D&&D(this.lastMoveEvent,g),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,g)},this.handlePointerMove=(g,y)=>{this.lastMoveEvent=g,this.lastMoveEventInfo=Qv(y,this.transformPagePoint),Nr.update(this.updatePoint,!0)},this.handlePointerUp=(g,y)=>{this.end();const{onEnd:A,onSessionEnd:P,resumeAnimation:O}=this.handlers;if(this.dragSnapToOrigin&&O&&O(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=eb(g.type==="pointercancel"?this.lastMoveEventInfo:Qv(y,this.transformPagePoint),this.history);this.startEvent&&A&&A(g,D),P&&P(g,D)},!_E(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=k0(e),a=Qv(o,this.transformPagePoint),{point:u}=a,{timestamp:l}=Kn;this.history=[{...u,timestamp:l}];const{onSessionStart:d}=r;d&&d(e,eb(a,this.history)),this.removeListeners=Bo(Fo(this.contextWindow,"pointermove",this.handlePointerMove),Fo(this.contextWindow,"pointerup",this.handlePointerUp),Fo(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),wa(this.updatePoint)}}function Qv(t,e){return e?{point:e(t.point)}:t}function AE(t,e){return{x:t.x-e.x,y:t.y-e.y}}function eb({point:t},e){return{point:t,delta:AE(t,PE(e)),offset:AE(t,GG(e)),velocity:YG(e,.1)}}function GG(t){return t[0]}function PE(t){return t[t.length-1]}function YG(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=PE(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>Qs(e)));)r--;if(!n)return{x:0,y:0};const s=Lo(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function ME(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const IE=ME("dragHorizontal"),CE=ME("dragVertical");function TE(t){let e=!1;if(t==="y")e=CE();else if(t==="x")e=IE();else{const r=IE(),n=CE();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function RE(){const t=TE(!0);return t?(t(),!1):!0}function ju(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const DE=1e-4,JG=1-DE,XG=1+DE,OE=.01,ZG=0-OE,QG=0+OE;function Ni(t){return t.max-t.min}function eY(t,e,r){return Math.abs(t-e)<=r}function NE(t,e,r,n=.5){t.origin=n,t.originPoint=Zr(e.min,e.max,t.origin),t.scale=Ni(r)/Ni(e),t.translate=Zr(r.min,r.max,t.origin)-t.originPoint,(t.scale>=JG&&t.scale<=XG||isNaN(t.scale))&&(t.scale=1),(t.translate>=ZG&&t.translate<=QG||isNaN(t.translate))&&(t.translate=0)}function rh(t,e,r,n){NE(t.x,e.x,r.x,n?n.originX:void 0),NE(t.y,e.y,r.y,n?n.originY:void 0)}function LE(t,e,r){t.min=r.min+e.min,t.max=t.min+Ni(e)}function tY(t,e,r){LE(t.x,e.x,r.x),LE(t.y,e.y,r.y)}function kE(t,e,r){t.min=e.min-r.min,t.max=t.min+Ni(e)}function nh(t,e,r){kE(t.x,e.x,r.x),kE(t.y,e.y,r.y)}function rY(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?Zr(r,t,n.max):Math.min(t,r)),t}function BE(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function nY(t,{top:e,left:r,bottom:n,right:i}){return{x:BE(t.x,r,i),y:BE(t.y,e,n)}}function $E(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=Fu(e.min,e.max-n,t.min):n>i&&(r=Fu(t.min,t.max-i,e.min)),xa(0,1,r)}function oY(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const tb=.35;function aY(t=tb){return t===!1?t=0:t===!0&&(t=tb),{x:FE(t,"left","right"),y:FE(t,"top","bottom")}}function FE(t,e,r){return{min:jE(t,e),max:jE(t,r)}}function jE(t,e){return typeof t=="number"?t:t[e]||0}const UE=()=>({translate:0,scale:1,origin:0,originPoint:0}),Uu=()=>({x:UE(),y:UE()}),qE=()=>({min:0,max:0}),ln=()=>({x:qE(),y:qE()});function rs(t){return[t("x"),t("y")]}function zE({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function cY({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function uY(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function rb(t){return t===void 0||t===1}function nb({scale:t,scaleX:e,scaleY:r}){return!rb(t)||!rb(e)||!rb(r)}function Ec(t){return nb(t)||HE(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function HE(t){return WE(t.x)||WE(t.y)}function WE(t){return t&&t!=="0%"}function B0(t,e,r){const n=t-r,i=e*n;return r+i}function KE(t,e,r,n,i){return i!==void 0&&(t=B0(t,i,n)),B0(t,r,n)+e}function ib(t,e=0,r=1,n,i){t.min=KE(t.min,e,r,n,i),t.max=KE(t.max,e,r,n,i)}function VE(t,{x:e,y:r}){ib(t.x,e.translate,e.scale,e.originPoint),ib(t.y,r.translate,r.scale,r.originPoint)}const GE=.999999999999,YE=1.0000000000001;function fY(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;aGE&&(e.x=1),e.yGE&&(e.y=1)}function qu(t,e){t.min=t.min+e,t.max=t.max+e}function JE(t,e,r,n,i=.5){const s=Zr(t.min,t.max,i);ib(t,e,r,s,n)}function zu(t,e){JE(t.x,e.x,e.scaleX,e.scale,e.originX),JE(t.y,e.y,e.scaleY,e.scale,e.originY)}function XE(t,e){return zE(uY(t.getBoundingClientRect(),e))}function lY(t,e,r){const n=XE(t,r),{scroll:i}=e;return i&&(qu(n.x,i.offset.x),qu(n.y,i.offset.y)),n}const ZE=({current:t})=>t?t.ownerDocument.defaultView:null,hY=new WeakMap;class dY{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ln(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:g}=this.getProps();g?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(k0(d,"page").point)},s=(d,g)=>{const{drag:y,dragPropagation:A,onDragStart:P}=this.getProps();if(y&&!A&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=TE(y),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),rs(D=>{let k=this.getAxisMotionValue(D).get()||0;if(eo.test(k)){const{projection:B}=this.visualElement;if(B&&B.layout){const j=B.layout.layoutBox[D];j&&(k=Ni(j)*(parseFloat(k)/100))}}this.originPoint[D]=k}),P&&Nr.postRender(()=>P(d,g)),Xv(this.visualElement,"transform");const{animationState:O}=this.visualElement;O&&O.setActive("whileDrag",!0)},o=(d,g)=>{const{dragPropagation:y,dragDirectionLock:A,onDirectionLock:P,onDrag:O}=this.getProps();if(!y&&!this.openGlobalLock)return;const{offset:D}=g;if(A&&this.currentDirection===null){this.currentDirection=pY(D),this.currentDirection!==null&&P&&P(this.currentDirection);return}this.updateAxis("x",g.point,D),this.updateAxis("y",g.point,D),this.visualElement.render(),O&&O(d,g)},a=(d,g)=>this.stop(d,g),u=()=>rs(d=>{var g;return this.getAnimationState(d)==="paused"&&((g=this.getAxisMotionValue(d).animation)===null||g===void 0?void 0:g.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new SE(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:ZE(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Nr.postRender(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!$0(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=rY(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&ju(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=nY(i.layoutBox,r):this.constraints=!1,this.elastic=aY(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&rs(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=oY(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!ju(e))return!1;const n=e.current;ko(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=lY(n,i.root,this.visualElement.getTransformPagePoint());let o=iY(i.layout.layoutBox,s);if(r){const a=r(cY(o));this.hasMutatedConstraints=!!a,a&&(o=zE(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),u=this.constraints||{},l=rs(d=>{if(!$0(d,r,this.currentDirection))return;let g=u&&u[d]||{};o&&(g={min:0,max:0});const y=i?200:1e6,A=i?40:1e7,P={type:"inertia",velocity:n?e[d]:0,bounceStiffness:y,bounceDamping:A,timeConstant:750,restDelta:1,restSpeed:10,...s,...g};return this.startAxisValueAnimation(d,P)});return Promise.all(l).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return Xv(this.visualElement,e),n.start(Kv(e,n,0,r,this.visualElement,!1))}stopAnimation(){rs(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){rs(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){rs(r=>{const{drag:n}=this.getProps();if(!$0(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-Zr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!ju(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};rs(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const u=a.get();i[o]=sY({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),rs(o=>{if(!$0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:u,max:l}=this.constraints[o];a.set(Zr(u,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;hY.set(this.visualElement,this);const e=this.visualElement.current,r=Fo(e,"pointerdown",u=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();ju(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Nr.read(n);const o=$o(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(rs(d=>{const g=this.getAxisMotionValue(d);g&&(this.originPoint[d]+=u[d].translate,g.set(g.get()+u[d].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=tb,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function $0(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function pY(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class gY extends Sa{constructor(e){super(e),this.removeGroupControls=Wn,this.removeListeners=Wn,this.controls=new dY(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Wn}unmount(){this.removeGroupControls(),this.removeListeners()}}const QE=t=>(e,r)=>{t&&Nr.postRender(()=>t(e,r))};class mY extends Sa{constructor(){super(...arguments),this.removePointerDownListener=Wn}onPointerDown(e){this.session=new SE(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:ZE(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:QE(e),onStart:QE(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&Nr.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=Fo(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const F0=Se.createContext(null);function vY(){const t=Se.useContext(F0);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=Se.useId();Se.useEffect(()=>n(i),[]);const s=Se.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const sb=Se.createContext({}),eS=Se.createContext({}),j0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function tS(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ih={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(zt.test(t))t=parseFloat(t);else return t;const r=tS(t,e.target.x),n=tS(t,e.target.y);return`${r}% ${n}%`}},bY={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=Ea.parse(t);if(i.length>5)return n;const s=Ea.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,u=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=u;const l=Zr(a,u,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),s(i)}},U0={};function yY(t){Object.assign(U0,t)}const{schedule:ob}=v8(queueMicrotask,!1);class wY extends Se.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;yY(xY),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),j0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Nr.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ob.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function rS(t){const[e,r]=vY(),n=Se.useContext(sb);return le.jsx(wY,{...t,layoutGroup:n,switchLayoutGroup:Se.useContext(eS),isPresent:e,safeToRemove:r})}const xY={borderRadius:{...ih,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ih,borderTopRightRadius:ih,borderBottomLeftRadius:ih,borderBottomRightRadius:ih,boxShadow:bY},nS=["TopLeft","TopRight","BottomLeft","BottomRight"],_Y=nS.length,iS=t=>typeof t=="string"?parseFloat(t):t,sS=t=>typeof t=="number"||zt.test(t);function EY(t,e,r,n,i,s){i?(t.opacity=Zr(0,r.opacity!==void 0?r.opacity:1,SY(n)),t.opacityExit=Zr(e.opacity!==void 0?e.opacity:1,0,AY(n))):s&&(t.opacity=Zr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;o<_Y;o++){const a=`border${nS[o]}Radius`;let u=oS(e,a),l=oS(r,a);if(u===void 0&&l===void 0)continue;u||(u=0),l||(l=0),u===0||l===0||sS(u)===sS(l)?(t[a]=Math.max(Zr(iS(u),iS(l),n),0),(eo.test(l)||eo.test(u))&&(t[a]+="%")):t[a]=l}(e.rotate||r.rotate)&&(t.rotate=Zr(e.rotate||0,r.rotate||0,n))}function oS(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const SY=aS(0,.5,S8),AY=aS(.5,.95,Wn);function aS(t,e,r){return n=>ne?1:r(Fu(t,e,n))}function cS(t,e){t.min=e.min,t.max=e.max}function ns(t,e){cS(t.x,e.x),cS(t.y,e.y)}function uS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function fS(t,e,r,n,i){return t-=e,t=B0(t,1/r,n),i!==void 0&&(t=B0(t,1/i,n)),t}function PY(t,e=0,r=1,n=.5,i,s=t,o=t){if(eo.test(e)&&(e=parseFloat(e),e=Zr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Zr(s.min,s.max,n);t===s&&(a-=e),t.min=fS(t.min,e,r,a,i),t.max=fS(t.max,e,r,a,i)}function lS(t,e,[r,n,i],s,o){PY(t,e[r],e[n],e[i],e.scale,s,o)}const MY=["x","scaleX","originX"],IY=["y","scaleY","originY"];function hS(t,e,r,n){lS(t.x,e,MY,r?r.x:void 0,n?n.x:void 0),lS(t.y,e,IY,r?r.y:void 0,n?n.y:void 0)}function dS(t){return t.translate===0&&t.scale===1}function pS(t){return dS(t.x)&&dS(t.y)}function gS(t,e){return t.min===e.min&&t.max===e.max}function CY(t,e){return gS(t.x,e.x)&&gS(t.y,e.y)}function mS(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function vS(t,e){return mS(t.x,e.x)&&mS(t.y,e.y)}function bS(t){return Ni(t.x)/Ni(t.y)}function yS(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class TY{constructor(){this.members=[]}add(e){Vv(this.members,e),e.scheduleRender()}remove(e){if(Gv(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function RY(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:l,rotate:d,rotateX:g,rotateY:y,skewX:A,skewY:P}=r;l&&(n=`perspective(${l}px) ${n}`),d&&(n+=`rotate(${d}deg) `),g&&(n+=`rotateX(${g}deg) `),y&&(n+=`rotateY(${y}deg) `),A&&(n+=`skewX(${A}deg) `),P&&(n+=`skewY(${P}deg) `)}const a=t.x.scale*e.x,u=t.y.scale*e.y;return(a!==1||u!==1)&&(n+=`scale(${a}, ${u})`),n||"none"}const DY=(t,e)=>t.depth-e.depth;class OY{constructor(){this.children=[],this.isDirty=!1}add(e){Vv(this.children,e),this.isDirty=!0}remove(e){Gv(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(DY),this.isDirty=!1,this.children.forEach(e)}}function q0(t){const e=Qn(t)?t.get():t;return AG(e)?e.toValue():e}function NY(t,e){const r=to.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(wa(n),t(s-e))};return Nr.read(n,!0),()=>wa(n)}function LY(t){return t instanceof SVGElement&&t.tagName!=="svg"}function kY(t,e,r){const n=Qn(t)?t:th(t);return n.start(Kv("",n,e,r)),n.animation}const Sc={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},sh=typeof window<"u"&&window.MotionDebug!==void 0,ab=["","X","Y","Z"],BY={visibility:"hidden"},wS=1e3;let $Y=0;function cb(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function xS(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=bE(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Nr,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&xS(n)}function _S({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=$Y++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,sh&&(Sc.totalNodes=Sc.resolvedTargetDeltas=Sc.recalculatedProjection=0),this.nodes.forEach(UY),this.nodes.forEach(KY),this.nodes.forEach(VY),this.nodes.forEach(qY),sh&&window.MotionDebug.record(Sc)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let u=0;uthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,g&&g(),g=NY(y,250),j0.hasAnimatedSinceResize&&(j0.hasAnimatedSinceResize=!1,this.nodes.forEach(SS))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&d&&(u||l)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:y,hasRelativeTargetChanged:A,layout:P})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const O=this.options.transition||d.getDefaultTransition()||ZY,{onLayoutAnimationStart:D,onLayoutAnimationComplete:k}=d.getProps(),B=!this.targetLayout||!vS(this.targetLayout,P)||A,j=!y&&A;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||j||y&&(B||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(g,j);const U={...wv(O,"layout"),onPlay:D,onComplete:k};(d.shouldReduceMotion||this.options.layoutRoot)&&(U.delay=0,U.type=!1),this.startAnimation(U)}else y||SS(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=P})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,wa(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(GY),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&xS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u{const K=U/1e3;AS(g.x,o.x,K),AS(g.y,o.y,K),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(nh(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),JY(this.relativeTarget,this.relativeTargetOrigin,y,K),j&&CY(this.relativeTarget,j)&&(this.isProjectionDirty=!1),j||(j=ln()),ns(j,this.relativeTarget)),O&&(this.animationValues=d,EY(d,l,this.latestValues,K,B,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=K},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(wa(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nr.update(()=>{j0.hasAnimatedSinceResize=!0,this.currentAnimation=kY(0,wS,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(wS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:u,layout:l,latestValues:d}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&TS(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||ln();const g=Ni(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+g;const y=Ni(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+y}ns(a,u),zu(a,d),rh(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new TY),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(a=!0),!a)return;const l={};u.z&&cb("z",o,l,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(ES),this.root.sharedNodes.clear()}}}function FY(t){t.updateLayout()}function jY(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?rs(g=>{const y=o?r.measuredBox[g]:r.layoutBox[g],A=Ni(y);y.min=n[g].min,y.max=y.min+A}):TS(s,r.layoutBox,n)&&rs(g=>{const y=o?r.measuredBox[g]:r.layoutBox[g],A=Ni(n[g]);y.max=y.min+A,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[g].max=t.relativeTarget[g].min+A)});const a=Uu();rh(a,n,r.layoutBox);const u=Uu();o?rh(u,t.applyTransform(i,!0),r.measuredBox):rh(u,n,r.layoutBox);const l=!pS(a);let d=!1;if(!t.resumeFrom){const g=t.getClosestProjectingParent();if(g&&!g.resumeFrom){const{snapshot:y,layout:A}=g;if(y&&A){const P=ln();nh(P,r.layoutBox,y.layoutBox);const O=ln();nh(O,n,A.layoutBox),vS(P,O)||(d=!0),g.options.layoutRoot&&(t.relativeTarget=O,t.relativeTargetOrigin=P,t.relativeParent=g)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:u,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function UY(t){sh&&Sc.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function qY(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function zY(t){t.clearSnapshot()}function ES(t){t.clearMeasurements()}function HY(t){t.isLayoutDirty=!1}function WY(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function SS(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function KY(t){t.resolveTargetDelta()}function VY(t){t.calcProjection()}function GY(t){t.resetSkewAndRotation()}function YY(t){t.removeLeadSnapshot()}function AS(t,e,r){t.translate=Zr(e.translate,0,r),t.scale=Zr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function PS(t,e,r,n){t.min=Zr(e.min,r.min,n),t.max=Zr(e.max,r.max,n)}function JY(t,e,r,n){PS(t.x,e.x,r.x,n),PS(t.y,e.y,r.y,n)}function XY(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const ZY={duration:.45,ease:[.4,0,.1,1]},MS=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),IS=MS("applewebkit/")&&!MS("chrome/")?Math.round:Wn;function CS(t){t.min=IS(t.min),t.max=IS(t.max)}function QY(t){CS(t.x),CS(t.y)}function TS(t,e,r){return t==="position"||t==="preserve-aspect"&&!eY(bS(e),bS(r),.2)}function eJ(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const tJ=_S({attachResizeListener:(t,e)=>$o(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ub={current:void 0},RS=_S({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!ub.current){const t=new tJ({});t.mount(window),t.setOptions({layoutScroll:!0}),ub.current=t}return ub.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),rJ={pan:{Feature:mY},drag:{Feature:gY,ProjectionNode:RS,MeasureLayout:rS}};function DS(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||RE())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const u=a[n];u&&Nr.postRender(()=>u(s,o))};return Fo(t.current,r,i,{passive:!t.getProps()[n]})}class nJ extends Sa{mount(){this.unmount=Bo(DS(this.node,!0),DS(this.node,!1))}unmount(){}}class iJ extends Sa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Bo($o(this.node.current,"focus",()=>this.onFocus()),$o(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const OS=(t,e)=>e?t===e?!0:OS(t,e.parentElement):!1;function fb(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,k0(r))}class sJ extends Sa{constructor(){super(...arguments),this.removeStartListeners=Wn,this.removeEndListeners=Wn,this.removeAccessibleListeners=Wn,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=Fo(window,"pointerup",(a,u)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:d,globalTapTarget:g}=this.node.getProps(),y=!g&&!OS(this.node.current,a.target)?d:l;y&&Nr.update(()=>y(a,u))},{passive:!(n.onTap||n.onPointerUp)}),o=Fo(window,"pointercancel",(a,u)=>this.cancelPress(a,u),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=Bo(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||fb("up",(u,l)=>{const{onTap:d}=this.node.getProps();d&&Nr.postRender(()=>d(u,l))})};this.removeEndListeners(),this.removeEndListeners=$o(this.node.current,"keyup",o),fb("down",(a,u)=>{this.startPress(a,u)})},r=$o(this.node.current,"keydown",e),n=()=>{this.isPressing&&fb("cancel",(s,o)=>this.cancelPress(s,o))},i=$o(this.node.current,"blur",n);this.removeAccessibleListeners=Bo(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Nr.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!RE()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Nr.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=Fo(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=$o(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Bo(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const lb=new WeakMap,hb=new WeakMap,oJ=t=>{const e=lb.get(t.target);e&&e(t)},aJ=t=>{t.forEach(oJ)};function cJ({root:t,...e}){const r=t||document;hb.has(r)||hb.set(r,{});const n=hb.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(aJ,{root:t,...e})),n[i]}function uJ(t,e,r){const n=cJ(e);return lb.set(t,r),n.observe(t),()=>{lb.delete(t),n.unobserve(t)}}const fJ={some:0,all:1};class lJ extends Sa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:fJ[i]},a=u=>{const{isIntersecting:l}=u;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:g}=this.node.getProps(),y=l?d:g;y&&y(u)};return uJ(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(hJ(e,r))&&this.startObserver()}unmount(){}}function hJ({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const dJ={inView:{Feature:lJ},tap:{Feature:sJ},focus:{Feature:iJ},hover:{Feature:nJ}},pJ={layout:{ProjectionNode:RS,MeasureLayout:rS}},db=Se.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),z0=Se.createContext({}),pb=typeof window<"u",NS=pb?Se.useLayoutEffect:Se.useEffect,LS=Se.createContext({strict:!1});function gJ(t,e,r,n,i){var s,o;const{visualElement:a}=Se.useContext(z0),u=Se.useContext(LS),l=Se.useContext(F0),d=Se.useContext(db).reducedMotion,g=Se.useRef();n=n||u.renderer,!g.current&&n&&(g.current=n(t,{visualState:e,parent:a,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d}));const y=g.current,A=Se.useContext(eS);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&mJ(g.current,r,i,A);const P=Se.useRef(!1);Se.useInsertionEffect(()=>{y&&P.current&&y.update(r,l)});const O=r[vE],D=Se.useRef(!!O&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,O))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,O)));return NS(()=>{y&&(P.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),ob.render(y.render),D.current&&y.animationState&&y.animationState.animateChanges())}),Se.useEffect(()=>{y&&(!D.current&&y.animationState&&y.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{var k;(k=window.MotionHandoffMarkAsComplete)===null||k===void 0||k.call(window,O)}),D.current=!1))}),y}function mJ(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:u,layoutRoot:l}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:kS(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&ju(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:u,layoutRoot:l})}function kS(t){if(t)return t.options.allowProjection!==!1?t.projection:kS(t.parent)}function vJ(t,e,r){return Se.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):ju(r)&&(r.current=n))},[e])}function H0(t){return P0(t.animate)||yv.some(e=>Vl(t[e]))}function BS(t){return!!(H0(t)||t.variants)}function bJ(t,e){if(H0(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Vl(r)?r:void 0,animate:Vl(n)?n:void 0}}return t.inherit!==!1?e:{}}function yJ(t){const{initial:e,animate:r}=bJ(t,Se.useContext(z0));return Se.useMemo(()=>({initial:e,animate:r}),[$S(e),$S(r)])}function $S(t){return Array.isArray(t)?t.join(" "):t}const FS={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Hu={};for(const t in FS)Hu[t]={isEnabled:e=>FS[t].some(r=>!!e[r])};function wJ(t){for(const e in t)Hu[e]={...Hu[e],...t[e]}}const xJ=Symbol.for("motionComponentSymbol");function _J({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&wJ(t);function s(a,u){let l;const d={...Se.useContext(db),...a,layoutId:EJ(a)},{isStatic:g}=d,y=yJ(a),A=n(a,g);if(!g&&pb){SJ(d,t);const P=AJ(d);l=P.MeasureLayout,y.visualElement=gJ(i,A,d,e,P.ProjectionNode)}return le.jsxs(z0.Provider,{value:y,children:[l&&y.visualElement?le.jsx(l,{visualElement:y.visualElement,...d}):null,r(i,a,vJ(A,y.visualElement,u),A,g,y.visualElement)]})}const o=Se.forwardRef(s);return o[xJ]=i,o}function EJ({layoutId:t}){const e=Se.useContext(sb).id;return e&&t!==void 0?e+"-"+t:t}function SJ(t,e){const r=Se.useContext(LS).strict;if(process.env.NODE_ENV!=="production"&&e&&r){const n="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?Lu(!1,n):ko(!1,n)}}function AJ(t){const{drag:e,layout:r}=Hu;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const PJ=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function gb(t){return typeof t!="string"||t.includes("-")?!1:!!(PJ.indexOf(t)>-1||/[A-Z]/u.test(t))}function jS(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const US=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function qS(t,e,r,n){jS(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(US.has(i)?i:Jv(i),e.attrs[i])}function zS(t,{layout:e,layoutId:r}){return yc.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!U0[t]||t==="opacity")}function mb(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(Qn(i[o])||e.style&&Qn(e.style[o])||zS(o,t)||((n=r==null?void 0:r.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function HS(t,e,r){const n=mb(t,e,r);for(const i in t)if(Qn(t[i])||Qn(e[i])){const s=Gl.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function vb(t){const e=Se.useRef(null);return e.current===null&&(e.current=t()),e.current}function MJ({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:IJ(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const WS=t=>(e,r)=>{const n=Se.useContext(z0),i=Se.useContext(F0),s=()=>MJ(t,e,n,i);return r?s():vb(s)};function IJ(t,e,r,n){const i={},s=n(t,{});for(const y in s)i[y]=q0(s[y]);let{initial:o,animate:a}=t;const u=H0(t),l=BS(t);e&&l&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const g=d?a:o;if(g&&typeof g!="boolean"&&!P0(g)){const y=Array.isArray(g)?g:[g];for(let A=0;A({style:{},transform:{},transformOrigin:{},vars:{}}),KS=()=>({...bb(),attrs:{}}),VS=(t,e)=>e&&typeof t=="number"?e.transform(t):t,CJ={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},TJ=Gl.length;function RJ(t,e,r){let n="",i=!0;for(let s=0;stypeof t=="string"&&t.toLowerCase()==="svg",kJ={useVisualState:WS({scrapeMotionValuesFromProps:HS,createRenderState:KS,onMount:(t,e,{renderState:r,latestValues:n})=>{Nr.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),Nr.render(()=>{wb(r,n,xb(e.tagName),t.transformTemplate),qS(e,r)})}})},BJ={useVisualState:WS({scrapeMotionValuesFromProps:mb,createRenderState:bb})};function YS(t,e,r){for(const n in e)!Qn(e[n])&&!zS(n,r)&&(t[n]=e[n])}function $J({transformTemplate:t},e){return Se.useMemo(()=>{const r=bb();return yb(r,e,t),Object.assign({},r.vars,r.style)},[e])}function FJ(t,e){const r=t.style||{},n={};return YS(n,r,t),Object.assign(n,$J(t,e)),n}function jJ(t,e){const r={},n=FJ(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const UJ=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function W0(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||UJ.has(t)}let JS=t=>!W0(t);function qJ(t){t&&(JS=e=>e.startsWith("on")?!W0(e):t(e))}try{qJ(require("@emotion/is-prop-valid").default)}catch{}function zJ(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(JS(i)||r===!0&&W0(i)||!e&&!W0(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function HJ(t,e,r,n){const i=Se.useMemo(()=>{const s=KS();return wb(s,e,xb(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};YS(s,t.style,t),i.style={...s,...i.style}}return i}function WJ(t=!1){return(r,n,i,{latestValues:s},o)=>{const u=(gb(r)?HJ:jJ)(n,s,o,r),l=zJ(n,typeof r=="string",t),d=r!==Se.Fragment?{...l,...u,ref:i}:{},{children:g}=n,y=Se.useMemo(()=>Qn(g)?g.get():g,[g]);return Se.createElement(r,{...d,children:y})}}function KJ(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...gb(n)?kJ:BJ,preloadedFeatures:t,useRender:WJ(i),createVisualElement:e,Component:n};return _J(o)}}const _b={current:null},XS={current:!1};function VJ(){if(XS.current=!0,!!pb)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>_b.current=t.matches;t.addListener(e),e()}else _b.current=!1}function GJ(t,e,r){for(const n in e){const i=e[n],s=r[n];if(Qn(i))t.addValue(n,i),process.env.NODE_ENV==="development"&&A0(i.version==="11.11.17",`Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`);else if(Qn(s))t.addValue(n,th(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,th(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const ZS=new WeakMap,YJ=[...k8,Zn,Ea],JJ=t=>YJ.find(L8(t)),QS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class XJ{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Mv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=to.now();this.renderScheduledAtthis.bindToMotionValue(n,r)),XS.current||VJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:_b.current,process.env.NODE_ENV!=="production"&&A0(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){ZS.delete(this.current),this.projection&&this.projection.unmount(),wa(this.notifyUpdate),wa(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=yc.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Nr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Hu){const r=Hu[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ln()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=th(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(M8(i)||P8(i))?i=parseFloat(i):!JJ(i)&&Ea.test(r)&&(i=V8(e,r)),this.setBaseTarget(e,Qn(i)?i.get():i)),Qn(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=vv(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Qn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new Yv),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class e7 extends XJ{constructor(){super(...arguments),this.KeyframeResolver=G8}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function ZJ(t){return window.getComputedStyle(t)}class QJ extends e7{constructor(){super(...arguments),this.type="html",this.renderInstance=jS}readValueFromInstance(e,r){if(yc.has(r)){const n=Nv(r);return n&&n.default||0}else{const n=ZJ(e),i=(C8(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return XE(e,r)}build(e,r,n){yb(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return mb(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Qn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class eX extends e7{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ln}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(yc.has(r)){const n=Nv(r);return n&&n.default||0}return r=US.has(r)?r:Jv(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return HS(e,r,n)}build(e,r,n){wb(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){qS(e,r,n,i)}mount(e){this.isSVGTag=xb(e.tagName),super.mount(e)}}const tX=(t,e)=>gb(t)?new eX(e):new QJ(e,{allowProjection:t!==Se.Fragment}),rX=KJ({...WG,...dJ,...rJ,...pJ},tX),nX=$K(rX);class iX extends Yt.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function sX({children:t,isPresent:e}){const r=Se.useId(),n=Se.useRef(null),i=Se.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=Se.useContext(db);return Se.useInsertionEffect(()=>{const{width:o,height:a,top:u,left:l}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` + */const l8=ts("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jK=ts("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]),h8=new Set;function A0(t,e,r){t||h8.has(e)||(console.warn(e),h8.add(e))}function UK(t){if(typeof Proxy>"u")return t;const e=new Map,r=(...n)=>(process.env.NODE_ENV!=="production"&&A0(!1,"motion() is deprecated. Use motion.create() instead."),t(...n));return new Proxy(r,{get:(n,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}function P0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const mv=t=>Array.isArray(t);function d8(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function vv(t,e,r,n){if(typeof e=="function"){const[i,s]=p8(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=p8(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function M0(t,e,r){const n=t.getProps();return vv(n,e,r!==void 0?r:n.custom,t)}const bv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],yv=["initial",...bv],Gl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],bc=new Set(Gl),Qs=t=>t*1e3,Do=t=>t/1e3,qK={type:"spring",stiffness:500,damping:25,restSpeed:10},zK=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),HK={type:"keyframes",duration:.8},WK={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},KK=(t,{keyframes:e})=>e.length>2?HK:bc.has(t)?t.startsWith("scale")?zK(e[1]):qK:WK;function wv(t,e){return t?t[e]||t.default||t:void 0}const VK={useManualTiming:!1},GK=t=>t!==null;function I0(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(GK),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const Wn=t=>t;function YK(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){s.has(l)&&(u.schedule(l),t()),l(o)}const u={schedule:(l,d=!1,g=!1)=>{const A=g&&n?e:r;return d&&s.add(l),A.has(l)||A.add(l),l},cancel:l=>{r.delete(l),s.delete(l)},process:l=>{if(o=l,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,u.process(l))}};return u}const C0=["read","resolveKeyframes","update","preRender","render","postRender"],JK=40;function g8(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=C0.reduce((k,B)=>(k[B]=YK(s),k),{}),{read:a,resolveKeyframes:u,update:l,preRender:d,render:g,postRender:y}=o,A=()=>{const k=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(k-i.timestamp,JK),1),i.timestamp=k,i.isProcessing=!0,a.process(i),u.process(i),l.process(i),d.process(i),g.process(i),y.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(A))},P=()=>{r=!0,n=!0,i.isProcessing||t(A)};return{schedule:C0.reduce((k,B)=>{const j=o[B];return k[B]=(U,K=!1,J=!1)=>(r||P(),j.schedule(U,K,J)),k},{}),cancel:k=>{for(let B=0;B(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,XK=1e-7,ZK=12;function QK(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=m8(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>XK&&++aQK(s,0,1,t,r);return s=>s===0||s===1?s:m8(i(s),e,n)}const v8=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,b8=t=>e=>1-t(1-e),y8=Yl(.33,1.53,.69,.99),_v=b8(y8),w8=v8(_v),x8=t=>(t*=2)<1?.5*_v(t):.5*(2-Math.pow(2,-10*(t-1))),Ev=t=>1-Math.sin(Math.acos(t)),_8=b8(Ev),E8=v8(Ev),S8=t=>/^0[^.\s]+$/u.test(t);function eV(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||S8(t):!0}let Lu=Wn,Oo=Wn;process.env.NODE_ENV!=="production"&&(Lu=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},Oo=(t,e)=>{if(!t)throw new Error(e)});const A8=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),P8=t=>e=>typeof e=="string"&&e.startsWith(t),M8=P8("--"),tV=P8("var(--"),Sv=t=>tV(t)?rV.test(t.split("/*")[0].trim()):!1,rV=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,nV=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function iV(t){const e=nV.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}const sV=4;function I8(t,e,r=1){Oo(r<=sV,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[n,i]=iV(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return A8(o)?parseFloat(o):o}return Sv(i)?I8(i,e,r+1):i}const ya=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},Jl={...ku,transform:t=>ya(0,1,t)},T0={...ku,default:1},Xl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),wa=Xl("deg"),eo=Xl("%"),zt=Xl("px"),oV=Xl("vh"),aV=Xl("vw"),C8={...eo,parse:t=>eo.parse(t)/100,transform:t=>eo.transform(t*100)},cV=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),T8=t=>t===ku||t===zt,R8=(t,e)=>parseFloat(t.split(", ")[e]),D8=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return R8(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?R8(s[1],t):0}},uV=new Set(["x","y","z"]),fV=Gl.filter(t=>!uV.has(t));function lV(t){const e=[];return fV.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const Bu={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:D8(4,13),y:D8(5,14)};Bu.translateX=Bu.x,Bu.translateY=Bu.y;const O8=t=>e=>e.test(t),N8=[ku,zt,eo,wa,aV,oV,{test:t=>t==="auto",parse:t=>t}],L8=t=>N8.find(O8(t)),yc=new Set;let Av=!1,Pv=!1;function k8(){if(Pv){const t=Array.from(yc).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=lV(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}Pv=!1,Av=!1,yc.forEach(t=>t.complete()),yc.clear()}function B8(){yc.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Pv=!0)})}function hV(){B8(),k8()}class Mv{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(yc.add(this),Av||(Av=!0,Nr.read(B8),Nr.resolveKeyframes(k8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sMath.round(t*1e5)/1e5,Iv=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function dV(t){return t==null}const pV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Cv=(t,e)=>r=>!!(typeof r=="string"&&pV.test(r)&&r.startsWith(t)||e&&!dV(r)&&Object.prototype.hasOwnProperty.call(r,e)),$8=(t,e,r)=>n=>{if(typeof n!="string")return n;const[i,s,o,a]=n.match(Iv);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},gV=t=>ya(0,255,t),Tv={...ku,transform:t=>Math.round(gV(t))},wc={test:Cv("rgb","red"),parse:$8("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+Tv.transform(t)+", "+Tv.transform(e)+", "+Tv.transform(r)+", "+Zl(Jl.transform(n))+")"};function mV(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const Rv={test:Cv("#"),parse:mV,transform:wc.transform},$u={test:Cv("hsl","hue"),parse:$8("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+eo.transform(Zl(e))+", "+eo.transform(Zl(r))+", "+Zl(Jl.transform(n))+")"},Zn={test:t=>wc.test(t)||Rv.test(t)||$u.test(t),parse:t=>wc.test(t)?wc.parse(t):$u.test(t)?$u.parse(t):Rv.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?wc.transform(t):$u.transform(t)},vV=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function bV(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Iv))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(vV))===null||r===void 0?void 0:r.length)||0)>0}const F8="number",j8="color",yV="var",wV="var(",U8="${}",xV=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ql(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(xV,u=>(Zn.test(u)?(n.color.push(s),i.push(j8),r.push(Zn.parse(u))):u.startsWith(wV)?(n.var.push(s),i.push(yV),r.push(u)):(n.number.push(s),i.push(F8),r.push(parseFloat(u))),++s,U8)).split(U8);return{values:r,split:a,indexes:n,types:i}}function q8(t){return Ql(t).values}function z8(t){const{split:e,types:r}=Ql(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function EV(t){const e=q8(t);return z8(t)(e.map(_V))}const xa={test:bV,parse:q8,createTransformer:z8,getAnimatableNone:EV},SV=new Set(["brightness","contrast","saturate","opacity"]);function AV(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(Iv)||[];if(!n)return t;const i=r.replace(n,"");let s=SV.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const PV=/\b([a-z-]*)\(.*?\)/gu,Dv={...xa,getAnimatableNone:t=>{const e=t.match(PV);return e?e.map(AV).join(" "):t}},MV={borderWidth:zt,borderTopWidth:zt,borderRightWidth:zt,borderBottomWidth:zt,borderLeftWidth:zt,borderRadius:zt,radius:zt,borderTopLeftRadius:zt,borderTopRightRadius:zt,borderBottomRightRadius:zt,borderBottomLeftRadius:zt,width:zt,maxWidth:zt,height:zt,maxHeight:zt,top:zt,right:zt,bottom:zt,left:zt,padding:zt,paddingTop:zt,paddingRight:zt,paddingBottom:zt,paddingLeft:zt,margin:zt,marginTop:zt,marginRight:zt,marginBottom:zt,marginLeft:zt,backgroundPositionX:zt,backgroundPositionY:zt},IV={rotate:wa,rotateX:wa,rotateY:wa,rotateZ:wa,scale:T0,scaleX:T0,scaleY:T0,scaleZ:T0,skew:wa,skewX:wa,skewY:wa,distance:zt,translateX:zt,translateY:zt,translateZ:zt,x:zt,y:zt,z:zt,perspective:zt,transformPerspective:zt,opacity:Jl,originX:C8,originY:C8,originZ:zt},H8={...ku,transform:Math.round},Ov={...MV,...IV,zIndex:H8,size:zt,fillOpacity:Jl,strokeOpacity:Jl,numOctaves:H8},CV={...Ov,color:Zn,backgroundColor:Zn,outlineColor:Zn,fill:Zn,stroke:Zn,borderColor:Zn,borderTopColor:Zn,borderRightColor:Zn,borderBottomColor:Zn,borderLeftColor:Zn,filter:Dv,WebkitFilter:Dv},Nv=t=>CV[t];function W8(t,e){let r=Nv(t);return r!==Dv&&(r=xa),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const TV=new Set(["auto","none","0"]);function RV(t,e,r){let n=0,i;for(;n{r.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function Lv(t){return typeof t=="function"}let R0;function DV(){R0=void 0}const to={now:()=>(R0===void 0&&to.set(Kn.isProcessing||VK.useManualTiming?Kn.timestamp:performance.now()),R0),set:t=>{R0=t,queueMicrotask(DV)}},V8=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(xa.test(t)||t==="0")&&!t.startsWith("url("));function OV(t){const e=t[0];if(t.length===1)return!0;for(let r=0;rLV?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&hV(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=to.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:u,isGenerator:l}=this.options;if(!l&&!NV(e,n,i,s))if(o)this.options.duration=0;else{u==null||u(I0(e,this.options,r)),a==null||a(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,r);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...d},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function Y8(t,e){return e?t*(1e3/e):0}const kV=5;function J8(t,e,r){const n=Math.max(e-kV,0);return Y8(r-t(n),e-n)}const kv=.001,BV=.01,X8=10,$V=.05,FV=1;function jV({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;Lu(t<=Qs(X8),"Spring duration must be 10 seconds or less");let o=1-e;o=ya($V,FV,o),t=ya(BV,X8,Do(t)),o<1?(i=l=>{const d=l*o,g=d*t,y=d-r,A=Bv(l,o),P=Math.exp(-g);return kv-y/A*P},s=l=>{const g=l*o*t,y=g*r+r,A=Math.pow(o,2)*Math.pow(l,2)*t,P=Math.exp(-g),N=Bv(Math.pow(l,2),o);return(-i(l)+kv>0?-1:1)*((y-A)*P)/N}):(i=l=>{const d=Math.exp(-l*t),g=(l-r)*t+1;return-kv+d*g},s=l=>{const d=Math.exp(-l*t),g=(r-l)*(t*t);return d*g});const a=5/t,u=qV(i,s,a);if(t=Qs(t),isNaN(u))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(u,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:t}}}const UV=12;function qV(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function WV(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!Z8(t,HV)&&Z8(t,zV)){const r=jV(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function Q8({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:u,mass:l,duration:d,velocity:g,isResolvedFromDuration:y}=WV({...n,velocity:-Do(n.velocity||0)}),A=g||0,P=u/(2*Math.sqrt(a*l)),N=s-i,D=Do(Math.sqrt(a/l)),k=Math.abs(N)<5;r||(r=k?.01:2),e||(e=k?.005:.5);let B;if(P<1){const j=Bv(D,P);B=U=>{const K=Math.exp(-P*D*U);return s-K*((A+P*D*N)/j*Math.sin(j*U)+N*Math.cos(j*U))}}else if(P===1)B=j=>s-Math.exp(-D*j)*(N+(A+D*N)*j);else{const j=D*Math.sqrt(P*P-1);B=U=>{const K=Math.exp(-P*D*U),J=Math.min(j*U,300);return s-K*((A+P*D*N)*Math.sinh(J)+j*N*Math.cosh(J))/j}}return{calculatedDuration:y&&d||null,next:j=>{const U=B(j);if(y)o.done=j>=d;else{let K=0;P<1&&(K=j===0?Qs(A):J8(B,j,U));const J=Math.abs(K)<=r,T=Math.abs(s-U)<=e;o.done=J&&T}return o.value=o.done?s:U,o}}}function eE({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:d}){const g=t[0],y={done:!1,value:g},A=z=>a!==void 0&&zu,P=z=>a===void 0?u:u===void 0||Math.abs(a-z)-N*Math.exp(-z/n),j=z=>k+B(z),U=z=>{const ue=B(z),_e=j(z);y.done=Math.abs(ue)<=l,y.value=y.done?k:_e};let K,J;const T=z=>{A(y.value)&&(K=z,J=Q8({keyframes:[y.value,P(y.value)],velocity:J8(j,z,y.value),damping:i,stiffness:s,restDelta:l,restSpeed:d}))};return T(0),{calculatedDuration:null,next:z=>{let ue=!1;return!J&&K===void 0&&(ue=!0,U(z),T(z)),K!==void 0&&z>=K?J.next(z-K):(!ue&&U(z),y)}}}const KV=Yl(.42,0,1,1),VV=Yl(0,0,.58,1),tE=Yl(.42,0,.58,1),GV=t=>Array.isArray(t)&&typeof t[0]!="number",$v=t=>Array.isArray(t)&&typeof t[0]=="number",rE={linear:Wn,easeIn:KV,easeInOut:tE,easeOut:VV,circIn:Ev,circInOut:E8,circOut:_8,backIn:_v,backInOut:w8,backOut:y8,anticipate:x8},nE=t=>{if($v(t)){Oo(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,r,n,i]=t;return Yl(e,r,n,i)}else if(typeof t=="string")return Oo(rE[t]!==void 0,`Invalid easing type '${t}'`),rE[t];return t},YV=(t,e)=>r=>e(t(r)),No=(...t)=>t.reduce(YV),Fu=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},Zr=(t,e,r)=>t+(e-t)*r;function Fv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function JV({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,u=2*r-a;i=Fv(u,a,t+1/3),s=Fv(u,a,t),o=Fv(u,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function D0(t,e){return r=>r>0?e:t}const jv=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},XV=[Rv,wc,$u],ZV=t=>XV.find(e=>e.test(t));function iE(t){const e=ZV(t);if(Lu(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let r=e.parse(t);return e===$u&&(r=JV(r)),r}const sE=(t,e)=>{const r=iE(t),n=iE(e);if(!r||!n)return D0(t,e);const i={...r};return s=>(i.red=jv(r.red,n.red,s),i.green=jv(r.green,n.green,s),i.blue=jv(r.blue,n.blue,s),i.alpha=Zr(r.alpha,n.alpha,s),wc.transform(i))},Uv=new Set(["none","hidden"]);function QV(t,e){return Uv.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function eG(t,e){return r=>Zr(t,e,r)}function qv(t){return typeof t=="number"?eG:typeof t=="string"?Sv(t)?D0:Zn.test(t)?sE:nG:Array.isArray(t)?oE:typeof t=="object"?Zn.test(t)?sE:tG:D0}function oE(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>qv(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function rG(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=xa.createTransformer(e),n=Ql(t),i=Ql(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?Uv.has(t)&&!i.values.length||Uv.has(e)&&!n.values.length?QV(t,e):No(oE(rG(n,i),i.values),r):(Lu(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),D0(t,e))};function aE(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Zr(t,e,r):qv(t)(t,e)}function iG(t,e,r){const n=[],i=r||aE,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=iG(e,n,i),a=o.length,u=l=>{let d=0;if(a>1)for(;du(ya(t[0],t[s-1],l)):u}function oG(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=Fu(0,e,n);t.push(Zr(r,1,i))}}function aG(t){const e=[0];return oG(e,t.length-1),e}function cG(t,e){return t.map(r=>r*e)}function uG(t,e){return t.map(()=>e||tE).splice(0,t.length-1)}function O0({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=GV(n)?n.map(nE):nE(n),s={done:!1,value:e[0]},o=cG(r&&r.length===e.length?r:aG(e),t),a=sG(o,e,{ease:Array.isArray(i)?i:uG(e,i)});return{calculatedDuration:t,next:u=>(s.value=a(u),s.done=u>=t,s)}}const cE=2e4;function fG(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=cE?1/0:e}const lG=t=>{const e=({timestamp:r})=>t(r);return{start:()=>Nr.update(e,!0),stop:()=>ba(e),now:()=>Kn.isProcessing?Kn.timestamp:to.now()}},hG={decay:eE,inertia:eE,tween:O0,keyframes:O0,spring:Q8},dG=t=>t/100;class zv extends G8{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:u}=this.options;u&&u()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Mv,a=(u,l)=>this.onKeyframesResolved(u,l);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=Lv(r)?r:hG[r]||O0;let u,l;a!==O0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&Oo(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),u=No(dG,aE(e[0],e[1])),e=[0,100]);const d=a({...this.options,keyframes:e});s==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=fG(d));const{calculatedDuration:g}=d,y=g+i,A=y*(n+1)-i;return{generator:d,mirroredGenerator:l,mapPercentToKeyframes:u,calculatedDuration:g,resolvedDuration:y,totalDuration:A}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:z}=this.options;return{done:!0,value:z[z.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:u,calculatedDuration:l,totalDuration:d,resolvedDuration:g}=n;if(this.startTime===null)return s.next(0);const{delay:y,repeat:A,repeatType:P,repeatDelay:N,onUpdate:D}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const k=this.currentTime-y*(this.speed>=0?1:-1),B=this.speed>=0?k<0:k>d;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let j=this.currentTime,U=s;if(A){const z=Math.min(this.currentTime,d)/g;let ue=Math.floor(z),_e=z%1;!_e&&z>=1&&(_e=1),_e===1&&ue--,ue=Math.min(ue,A+1),!!(ue%2)&&(P==="reverse"?(_e=1-_e,N&&(_e-=N/g)):P==="mirror"&&(U=o)),j=ya(0,1,_e)*g}const K=B?{done:!1,value:u[0]}:U.next(j);a&&(K.value=a(K.value));let{done:J}=K;!B&&l!==null&&(J=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&J);return T&&i!==void 0&&(K.value=I0(u,this.options,i)),D&&D(K.value),T&&this.finish(),K}get duration(){const{resolved:e}=this;return e?Do(e.calculatedDuration):0}get time(){return Do(this.currentTime)}set time(e){e=Qs(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=Do(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=lG,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const pG=new Set(["opacity","clipPath","filter","transform"]),gG=10,mG=(t,e)=>{let r="";const n=Math.max(Math.round(e/gG),2);for(let i=0;i(e===void 0&&(e=t()),e)}const vG={linearEasing:void 0};function bG(t,e){const r=Hv(t);return()=>{var n;return(n=vG[e])!==null&&n!==void 0?n:r()}}const N0=bG(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function uE(t){return!!(typeof t=="function"&&N0()||!t||typeof t=="string"&&(t in Wv||N0())||$v(t)||Array.isArray(t)&&t.every(uE))}const eh=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,Wv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:eh([0,.65,.55,1]),circOut:eh([.55,0,1,.45]),backIn:eh([.31,.01,.66,-.59]),backOut:eh([.33,1.53,.69,.99])};function fE(t,e){if(t)return typeof t=="function"&&N0()?mG(t,e):$v(t)?eh(t):Array.isArray(t)?t.map(r=>fE(r,e)||Wv.easeOut):Wv[t]}function yG(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:u}={}){const l={[e]:r};u&&(l.offset=u);const d=fE(a,i);return Array.isArray(d)&&(l.easing=d),t.animate(l,{delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function lE(t,e){t.timeline=e,t.onfinish=null}const wG=Hv(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),L0=10,xG=2e4;function _G(t){return Lv(t.type)||t.type==="spring"||!uE(t.ease)}function EG(t,e){const r=new zv({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&sthis.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:u,name:l,startTime:d}=this.options;if(!(!((n=u.owner)===null||n===void 0)&&n.current))return!1;if(typeof o=="string"&&N0()&&SG(o)&&(o=hE[o]),_G(this.options)){const{onComplete:y,onUpdate:A,motionValue:P,element:N,...D}=this.options,k=EG(e,D);e=k.keyframes,e.length===1&&(e[1]=e[0]),i=k.duration,s=k.times,o=k.ease,a="keyframes"}const g=yG(u.owner.current,l,e,{...this.options,duration:i,times:s,ease:o});return g.startTime=d??this.calcStartTime(),this.pendingTimeline?(lE(g,this.pendingTimeline),this.pendingTimeline=void 0):g.onfinish=()=>{const{onComplete:y}=this.options;u.set(I0(e,this.options,r)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:g,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return Do(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return Do(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=Qs(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return Wn;const{animation:n}=r;lE(n,e)}return Wn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:d,onComplete:g,element:y,...A}=this.options,P=new zv({...A,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),N=Qs(this.time);l.setWithVelocity(P.sample(N-L0).value,P.sample(N).value,L0)}const{onStop:u}=this.options;u&&u(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return wG()&&n&&pG.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}const AG=Hv(()=>window.ScrollTimeline!==void 0);class PG{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;nAG()&&i.attachTimeline?i.attachTimeline(e):r(i));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function MG({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:u,elapsed:l,...d}){return!!Object.keys(d).length}const Kv=(t,e,r,n={},i,s)=>o=>{const a=wv(n,t)||{},u=a.delay||n.delay||0;let{elapsed:l=0}=n;l=l-Qs(u);let d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:y=>{e.set(y),a.onUpdate&&a.onUpdate(y)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:i};MG(a)||(d={...d,...KK(t,d)}),d.duration&&(d.duration=Qs(d.duration)),d.repeatDelay&&(d.repeatDelay=Qs(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let g=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(g=!0)),g&&!s&&e.get()!==void 0){const y=I0(d.keyframes,a);if(y!==void 0)return Nr.update(()=>{d.onUpdate(y),d.onComplete()}),new PG([])}return!s&&dE.supports(d)?new dE(d):new zv(d)},IG=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),CG=t=>mv(t)?t[t.length-1]||0:t;function Vv(t,e){t.indexOf(e)===-1&&t.push(e)}function Gv(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class Yv{constructor(){this.subscriptions=[]}add(e){return Vv(this.subscriptions,e),()=>Gv(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class RG{constructor(e,r={}){this.version="11.11.17",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=to.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=to.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=TG(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&A0(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new Yv);const n=this.events[e].add(r);return e==="change"?()=>{n(),Nr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=to.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>pE)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,pE);return Y8(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function th(t,e){return new RG(t,e)}function DG(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,th(r))}function OG(t,e){const r=M0(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=CG(s[o]);DG(t,o,a)}}const Jv=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),gE="data-"+Jv("framerAppearId");function mE(t){return t.props[gE]}const Qn=t=>!!(t&&t.getVelocity);function NG(t){return!!(Qn(t)&&t.add)}function Xv(t,e){const r=t.getValue("willChange");if(NG(r))return r.add(e)}function LG({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function vE(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...u}=e;n&&(o=n);const l=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const g in u){const y=t.getValue(g,(s=t.latestValues[g])!==null&&s!==void 0?s:null),A=u[g];if(A===void 0||d&&LG(d,g))continue;const P={delay:r,...wv(o||{},g)};let N=!1;if(window.MotionHandoffAnimation){const k=mE(t);if(k){const B=window.MotionHandoffAnimation(k,g,Nr);B!==null&&(P.startTime=B,N=!0)}}Xv(t,g),y.start(Kv(g,y,A,t.shouldReduceMotion&&bc.has(g)?{type:!1}:P,t,N));const D=y.animation;D&&l.push(D)}return a&&Promise.all(l).then(()=>{Nr.update(()=>{a&&OG(t,a)})}),l}function Zv(t,e,r={}){var n;const i=M0(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(vE(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:g,staggerDirection:y}=s;return kG(t,e,d+l,g,y,r)}:()=>Promise.resolve(),{when:u}=s;if(u){const[l,d]=u==="beforeChildren"?[o,a]:[a,o];return l().then(()=>d())}else return Promise.all([o(),a(r.delay)])}function kG(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,u=i===1?(l=0)=>l*n:(l=0)=>a-l*n;return Array.from(t.variantChildren).sort(BG).forEach((l,d)=>{l.notify("AnimationStart",e),o.push(Zv(l,e,{...s,delay:r+u(d)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function BG(t,e){return t.sortNodePosition(e)}function $G(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>Zv(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=Zv(t,e,r);else{const i=typeof e=="function"?M0(t,e,r.custom):e;n=Promise.all(vE(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const FG=yv.length;function bE(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?bE(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;rPromise.all(e.map(({animation:r,options:n})=>$G(t,r,n)))}function zG(t){let e=qG(t),r=yE(),n=!0;const i=u=>(l,d)=>{var g;const y=M0(t,d,u==="exit"?(g=t.presenceContext)===null||g===void 0?void 0:g.custom:void 0);if(y){const{transition:A,transitionEnd:P,...N}=y;l={...l,...N,...P}}return l};function s(u){e=u(t)}function o(u){const{props:l}=t,d=bE(t.parent)||{},g=[],y=new Set;let A={},P=1/0;for(let D=0;DP&&U,ue=!1;const _e=Array.isArray(j)?j:[j];let G=_e.reduce(i(k),{});K===!1&&(G={});const{prevResolvedValues:E={}}=B,m={...E,...G},f=x=>{z=!0,y.has(x)&&(ue=!0,y.delete(x)),B.needsAnimating[x]=!0;const _=t.getValue(x);_&&(_.liveStyle=!1)};for(const x in m){const _=G[x],S=E[x];if(A.hasOwnProperty(x))continue;let b=!1;mv(_)&&mv(S)?b=!d8(_,S):b=_!==S,b?_!=null?f(x):y.add(x):_!==void 0&&y.has(x)?f(x):B.protectedKeys[x]=!0}B.prevProp=j,B.prevResolvedValues=G,B.isActive&&(A={...A,...G}),n&&t.blockInitialAnimation&&(z=!1),z&&(!(J&&T)||ue)&&g.push(..._e.map(x=>({animation:x,options:{type:k}})))}if(y.size){const D={};y.forEach(k=>{const B=t.getBaseTarget(k),j=t.getValue(k);j&&(j.liveStyle=!0),D[k]=B??null}),g.push({animation:D})}let N=!!g.length;return n&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(N=!1),n=!1,N?e(g):Promise.resolve()}function a(u,l){var d;if(r[u].isActive===l)return Promise.resolve();(d=t.variantChildren)===null||d===void 0||d.forEach(y=>{var A;return(A=y.animationState)===null||A===void 0?void 0:A.setActive(u,l)}),r[u].isActive=l;const g=o(u);for(const y in r)r[y].protectedKeys={};return g}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=yE(),n=!0}}}function HG(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!d8(e,t):!1}function xc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function yE(){return{animate:xc(!0),whileInView:xc(),whileHover:xc(),whileTap:xc(),whileDrag:xc(),whileFocus:xc(),exit:xc()}}class _a{constructor(e){this.isMounted=!1,this.node=e}update(){}}class WG extends _a{constructor(e){super(e),e.animationState||(e.animationState=zG(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();P0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let KG=0;class VG extends _a{constructor(){super(...arguments),this.id=KG++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const GG={animation:{Feature:WG},exit:{Feature:VG}},wE=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function k0(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const YG=t=>e=>wE(e)&&t(e,k0(e));function Lo(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function ko(t,e,r,n){return Lo(t,e,YG(r),n)}const xE=(t,e)=>Math.abs(t-e);function JG(t,e){const r=xE(t.x,e.x),n=xE(t.y,e.y);return Math.sqrt(r**2+n**2)}class _E{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=eb(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,A=JG(g.offset,{x:0,y:0})>=3;if(!y&&!A)return;const{point:P}=g,{timestamp:N}=Kn;this.history.push({...P,timestamp:N});const{onStart:D,onMove:k}=this.handlers;y||(D&&D(this.lastMoveEvent,g),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,g)},this.handlePointerMove=(g,y)=>{this.lastMoveEvent=g,this.lastMoveEventInfo=Qv(y,this.transformPagePoint),Nr.update(this.updatePoint,!0)},this.handlePointerUp=(g,y)=>{this.end();const{onEnd:A,onSessionEnd:P,resumeAnimation:N}=this.handlers;if(this.dragSnapToOrigin&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=eb(g.type==="pointercancel"?this.lastMoveEventInfo:Qv(y,this.transformPagePoint),this.history);this.startEvent&&A&&A(g,D),P&&P(g,D)},!wE(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=k0(e),a=Qv(o,this.transformPagePoint),{point:u}=a,{timestamp:l}=Kn;this.history=[{...u,timestamp:l}];const{onSessionStart:d}=r;d&&d(e,eb(a,this.history)),this.removeListeners=No(ko(this.contextWindow,"pointermove",this.handlePointerMove),ko(this.contextWindow,"pointerup",this.handlePointerUp),ko(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),ba(this.updatePoint)}}function Qv(t,e){return e?{point:e(t.point)}:t}function EE(t,e){return{x:t.x-e.x,y:t.y-e.y}}function eb({point:t},e){return{point:t,delta:EE(t,SE(e)),offset:EE(t,XG(e)),velocity:ZG(e,.1)}}function XG(t){return t[0]}function SE(t){return t[t.length-1]}function ZG(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=SE(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>Qs(e)));)r--;if(!n)return{x:0,y:0};const s=Do(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function AE(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const PE=AE("dragHorizontal"),ME=AE("dragVertical");function IE(t){let e=!1;if(t==="y")e=ME();else if(t==="x")e=PE();else{const r=PE(),n=ME();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function CE(){const t=IE(!0);return t?(t(),!1):!0}function ju(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const TE=1e-4,QG=1-TE,eY=1+TE,RE=.01,tY=0-RE,rY=0+RE;function Ni(t){return t.max-t.min}function nY(t,e,r){return Math.abs(t-e)<=r}function DE(t,e,r,n=.5){t.origin=n,t.originPoint=Zr(e.min,e.max,t.origin),t.scale=Ni(r)/Ni(e),t.translate=Zr(r.min,r.max,t.origin)-t.originPoint,(t.scale>=QG&&t.scale<=eY||isNaN(t.scale))&&(t.scale=1),(t.translate>=tY&&t.translate<=rY||isNaN(t.translate))&&(t.translate=0)}function rh(t,e,r,n){DE(t.x,e.x,r.x,n?n.originX:void 0),DE(t.y,e.y,r.y,n?n.originY:void 0)}function OE(t,e,r){t.min=r.min+e.min,t.max=t.min+Ni(e)}function iY(t,e,r){OE(t.x,e.x,r.x),OE(t.y,e.y,r.y)}function NE(t,e,r){t.min=e.min-r.min,t.max=t.min+Ni(e)}function nh(t,e,r){NE(t.x,e.x,r.x),NE(t.y,e.y,r.y)}function sY(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?Zr(r,t,n.max):Math.min(t,r)),t}function LE(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function oY(t,{top:e,left:r,bottom:n,right:i}){return{x:LE(t.x,r,i),y:LE(t.y,e,n)}}function kE(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=Fu(e.min,e.max-n,t.min):n>i&&(r=Fu(t.min,t.max-i,e.min)),ya(0,1,r)}function uY(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const tb=.35;function fY(t=tb){return t===!1?t=0:t===!0&&(t=tb),{x:BE(t,"left","right"),y:BE(t,"top","bottom")}}function BE(t,e,r){return{min:$E(t,e),max:$E(t,r)}}function $E(t,e){return typeof t=="number"?t:t[e]||0}const FE=()=>({translate:0,scale:1,origin:0,originPoint:0}),Uu=()=>({x:FE(),y:FE()}),jE=()=>({min:0,max:0}),ln=()=>({x:jE(),y:jE()});function rs(t){return[t("x"),t("y")]}function UE({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function lY({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function hY(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function rb(t){return t===void 0||t===1}function nb({scale:t,scaleX:e,scaleY:r}){return!rb(t)||!rb(e)||!rb(r)}function _c(t){return nb(t)||qE(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function qE(t){return zE(t.x)||zE(t.y)}function zE(t){return t&&t!=="0%"}function B0(t,e,r){const n=t-r,i=e*n;return r+i}function HE(t,e,r,n,i){return i!==void 0&&(t=B0(t,i,n)),B0(t,r,n)+e}function ib(t,e=0,r=1,n,i){t.min=HE(t.min,e,r,n,i),t.max=HE(t.max,e,r,n,i)}function WE(t,{x:e,y:r}){ib(t.x,e.translate,e.scale,e.originPoint),ib(t.y,r.translate,r.scale,r.originPoint)}const KE=.999999999999,VE=1.0000000000001;function dY(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;aKE&&(e.x=1),e.yKE&&(e.y=1)}function qu(t,e){t.min=t.min+e,t.max=t.max+e}function GE(t,e,r,n,i=.5){const s=Zr(t.min,t.max,i);ib(t,e,r,s,n)}function zu(t,e){GE(t.x,e.x,e.scaleX,e.scale,e.originX),GE(t.y,e.y,e.scaleY,e.scale,e.originY)}function YE(t,e){return UE(hY(t.getBoundingClientRect(),e))}function pY(t,e,r){const n=YE(t,r),{scroll:i}=e;return i&&(qu(n.x,i.offset.x),qu(n.y,i.offset.y)),n}const JE=({current:t})=>t?t.ownerDocument.defaultView:null,gY=new WeakMap;class mY{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ln(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:g}=this.getProps();g?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(k0(d,"page").point)},s=(d,g)=>{const{drag:y,dragPropagation:A,onDragStart:P}=this.getProps();if(y&&!A&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=IE(y),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),rs(D=>{let k=this.getAxisMotionValue(D).get()||0;if(eo.test(k)){const{projection:B}=this.visualElement;if(B&&B.layout){const j=B.layout.layoutBox[D];j&&(k=Ni(j)*(parseFloat(k)/100))}}this.originPoint[D]=k}),P&&Nr.postRender(()=>P(d,g)),Xv(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},o=(d,g)=>{const{dragPropagation:y,dragDirectionLock:A,onDirectionLock:P,onDrag:N}=this.getProps();if(!y&&!this.openGlobalLock)return;const{offset:D}=g;if(A&&this.currentDirection===null){this.currentDirection=vY(D),this.currentDirection!==null&&P&&P(this.currentDirection);return}this.updateAxis("x",g.point,D),this.updateAxis("y",g.point,D),this.visualElement.render(),N&&N(d,g)},a=(d,g)=>this.stop(d,g),u=()=>rs(d=>{var g;return this.getAnimationState(d)==="paused"&&((g=this.getAxisMotionValue(d).animation)===null||g===void 0?void 0:g.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new _E(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:JE(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Nr.postRender(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!$0(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=sY(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&ju(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=oY(i.layoutBox,r):this.constraints=!1,this.elastic=fY(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&rs(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=uY(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!ju(e))return!1;const n=e.current;Oo(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=pY(n,i.root,this.visualElement.getTransformPagePoint());let o=aY(i.layout.layoutBox,s);if(r){const a=r(lY(o));this.hasMutatedConstraints=!!a,a&&(o=UE(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),u=this.constraints||{},l=rs(d=>{if(!$0(d,r,this.currentDirection))return;let g=u&&u[d]||{};o&&(g={min:0,max:0});const y=i?200:1e6,A=i?40:1e7,P={type:"inertia",velocity:n?e[d]:0,bounceStiffness:y,bounceDamping:A,timeConstant:750,restDelta:1,restSpeed:10,...s,...g};return this.startAxisValueAnimation(d,P)});return Promise.all(l).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return Xv(this.visualElement,e),n.start(Kv(e,n,0,r,this.visualElement,!1))}stopAnimation(){rs(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){rs(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){rs(r=>{const{drag:n}=this.getProps();if(!$0(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-Zr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!ju(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};rs(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const u=a.get();i[o]=cY({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),rs(o=>{if(!$0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:u,max:l}=this.constraints[o];a.set(Zr(u,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;gY.set(this.visualElement,this);const e=this.visualElement.current,r=ko(e,"pointerdown",u=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();ju(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Nr.read(n);const o=Lo(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(rs(d=>{const g=this.getAxisMotionValue(d);g&&(this.originPoint[d]+=u[d].translate,g.set(g.get()+u[d].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=tb,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function $0(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function vY(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class bY extends _a{constructor(e){super(e),this.removeGroupControls=Wn,this.removeListeners=Wn,this.controls=new mY(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Wn}unmount(){this.removeGroupControls(),this.removeListeners()}}const XE=t=>(e,r)=>{t&&Nr.postRender(()=>t(e,r))};class yY extends _a{constructor(){super(...arguments),this.removePointerDownListener=Wn}onPointerDown(e){this.session=new _E(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:JE(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:XE(e),onStart:XE(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&Nr.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=ko(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const F0=Se.createContext(null);function wY(){const t=Se.useContext(F0);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=Se.useId();Se.useEffect(()=>n(i),[]);const s=Se.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const sb=Se.createContext({}),ZE=Se.createContext({}),j0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function QE(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ih={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(zt.test(t))t=parseFloat(t);else return t;const r=QE(t,e.target.x),n=QE(t,e.target.y);return`${r}% ${n}%`}},xY={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=xa.parse(t);if(i.length>5)return n;const s=xa.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,u=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=u;const l=Zr(a,u,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),s(i)}},U0={};function _Y(t){Object.assign(U0,t)}const{schedule:ob}=g8(queueMicrotask,!1);class EY extends Se.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;_Y(SY),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),j0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Nr.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ob.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function eS(t){const[e,r]=wY(),n=Se.useContext(sb);return ge.jsx(EY,{...t,layoutGroup:n,switchLayoutGroup:Se.useContext(ZE),isPresent:e,safeToRemove:r})}const SY={borderRadius:{...ih,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ih,borderTopRightRadius:ih,borderBottomLeftRadius:ih,borderBottomRightRadius:ih,boxShadow:xY},tS=["TopLeft","TopRight","BottomLeft","BottomRight"],AY=tS.length,rS=t=>typeof t=="string"?parseFloat(t):t,nS=t=>typeof t=="number"||zt.test(t);function PY(t,e,r,n,i,s){i?(t.opacity=Zr(0,r.opacity!==void 0?r.opacity:1,MY(n)),t.opacityExit=Zr(e.opacity!==void 0?e.opacity:1,0,IY(n))):s&&(t.opacity=Zr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(Fu(t,e,n))}function oS(t,e){t.min=e.min,t.max=e.max}function ns(t,e){oS(t.x,e.x),oS(t.y,e.y)}function aS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function cS(t,e,r,n,i){return t-=e,t=B0(t,1/r,n),i!==void 0&&(t=B0(t,1/i,n)),t}function CY(t,e=0,r=1,n=.5,i,s=t,o=t){if(eo.test(e)&&(e=parseFloat(e),e=Zr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Zr(s.min,s.max,n);t===s&&(a-=e),t.min=cS(t.min,e,r,a,i),t.max=cS(t.max,e,r,a,i)}function uS(t,e,[r,n,i],s,o){CY(t,e[r],e[n],e[i],e.scale,s,o)}const TY=["x","scaleX","originX"],RY=["y","scaleY","originY"];function fS(t,e,r,n){uS(t.x,e,TY,r?r.x:void 0,n?n.x:void 0),uS(t.y,e,RY,r?r.y:void 0,n?n.y:void 0)}function lS(t){return t.translate===0&&t.scale===1}function hS(t){return lS(t.x)&&lS(t.y)}function dS(t,e){return t.min===e.min&&t.max===e.max}function DY(t,e){return dS(t.x,e.x)&&dS(t.y,e.y)}function pS(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function gS(t,e){return pS(t.x,e.x)&&pS(t.y,e.y)}function mS(t){return Ni(t.x)/Ni(t.y)}function vS(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class OY{constructor(){this.members=[]}add(e){Vv(this.members,e),e.scheduleRender()}remove(e){if(Gv(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function NY(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:l,rotate:d,rotateX:g,rotateY:y,skewX:A,skewY:P}=r;l&&(n=`perspective(${l}px) ${n}`),d&&(n+=`rotate(${d}deg) `),g&&(n+=`rotateX(${g}deg) `),y&&(n+=`rotateY(${y}deg) `),A&&(n+=`skewX(${A}deg) `),P&&(n+=`skewY(${P}deg) `)}const a=t.x.scale*e.x,u=t.y.scale*e.y;return(a!==1||u!==1)&&(n+=`scale(${a}, ${u})`),n||"none"}const LY=(t,e)=>t.depth-e.depth;class kY{constructor(){this.children=[],this.isDirty=!1}add(e){Vv(this.children,e),this.isDirty=!0}remove(e){Gv(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(LY),this.isDirty=!1,this.children.forEach(e)}}function q0(t){const e=Qn(t)?t.get():t;return IG(e)?e.toValue():e}function BY(t,e){const r=to.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(ba(n),t(s-e))};return Nr.read(n,!0),()=>ba(n)}function $Y(t){return t instanceof SVGElement&&t.tagName!=="svg"}function FY(t,e,r){const n=Qn(t)?t:th(t);return n.start(Kv("",n,e,r)),n.animation}const Ec={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},sh=typeof window<"u"&&window.MotionDebug!==void 0,ab=["","X","Y","Z"],jY={visibility:"hidden"},bS=1e3;let UY=0;function cb(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function yS(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=mE(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Nr,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&yS(n)}function wS({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=UY++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,sh&&(Ec.totalNodes=Ec.resolvedTargetDeltas=Ec.recalculatedProjection=0),this.nodes.forEach(HY),this.nodes.forEach(YY),this.nodes.forEach(JY),this.nodes.forEach(WY),sh&&window.MotionDebug.record(Ec)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let u=0;uthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,g&&g(),g=BY(y,250),j0.hasAnimatedSinceResize&&(j0.hasAnimatedSinceResize=!1,this.nodes.forEach(_S))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&d&&(u||l)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:y,hasRelativeTargetChanged:A,layout:P})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const N=this.options.transition||d.getDefaultTransition()||tJ,{onLayoutAnimationStart:D,onLayoutAnimationComplete:k}=d.getProps(),B=!this.targetLayout||!gS(this.targetLayout,P)||A,j=!y&&A;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||j||y&&(B||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(g,j);const U={...wv(N,"layout"),onPlay:D,onComplete:k};(d.shouldReduceMotion||this.options.layoutRoot)&&(U.delay=0,U.type=!1),this.startAnimation(U)}else y||_S(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=P})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,ba(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(XY),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&yS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u{const K=U/1e3;ES(g.x,o.x,K),ES(g.y,o.y,K),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(nh(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),QY(this.relativeTarget,this.relativeTargetOrigin,y,K),j&&DY(this.relativeTarget,j)&&(this.isProjectionDirty=!1),j||(j=ln()),ns(j,this.relativeTarget)),N&&(this.animationValues=d,PY(d,l,this.latestValues,K,B,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=K},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(ba(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nr.update(()=>{j0.hasAnimatedSinceResize=!0,this.currentAnimation=FY(0,bS,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(bS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:u,layout:l,latestValues:d}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&IS(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||ln();const g=Ni(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+g;const y=Ni(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+y}ns(a,u),zu(a,d),rh(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new OY),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(a=!0),!a)return;const l={};u.z&&cb("z",o,l,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(xS),this.root.sharedNodes.clear()}}}function qY(t){t.updateLayout()}function zY(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?rs(g=>{const y=o?r.measuredBox[g]:r.layoutBox[g],A=Ni(y);y.min=n[g].min,y.max=y.min+A}):IS(s,r.layoutBox,n)&&rs(g=>{const y=o?r.measuredBox[g]:r.layoutBox[g],A=Ni(n[g]);y.max=y.min+A,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[g].max=t.relativeTarget[g].min+A)});const a=Uu();rh(a,n,r.layoutBox);const u=Uu();o?rh(u,t.applyTransform(i,!0),r.measuredBox):rh(u,n,r.layoutBox);const l=!hS(a);let d=!1;if(!t.resumeFrom){const g=t.getClosestProjectingParent();if(g&&!g.resumeFrom){const{snapshot:y,layout:A}=g;if(y&&A){const P=ln();nh(P,r.layoutBox,y.layoutBox);const N=ln();nh(N,n,A.layoutBox),gS(P,N)||(d=!0),g.options.layoutRoot&&(t.relativeTarget=N,t.relativeTargetOrigin=P,t.relativeParent=g)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:u,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function HY(t){sh&&Ec.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function WY(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function KY(t){t.clearSnapshot()}function xS(t){t.clearMeasurements()}function VY(t){t.isLayoutDirty=!1}function GY(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function _S(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function YY(t){t.resolveTargetDelta()}function JY(t){t.calcProjection()}function XY(t){t.resetSkewAndRotation()}function ZY(t){t.removeLeadSnapshot()}function ES(t,e,r){t.translate=Zr(e.translate,0,r),t.scale=Zr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function SS(t,e,r,n){t.min=Zr(e.min,r.min,n),t.max=Zr(e.max,r.max,n)}function QY(t,e,r,n){SS(t.x,e.x,r.x,n),SS(t.y,e.y,r.y,n)}function eJ(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const tJ={duration:.45,ease:[.4,0,.1,1]},AS=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),PS=AS("applewebkit/")&&!AS("chrome/")?Math.round:Wn;function MS(t){t.min=PS(t.min),t.max=PS(t.max)}function rJ(t){MS(t.x),MS(t.y)}function IS(t,e,r){return t==="position"||t==="preserve-aspect"&&!nY(mS(e),mS(r),.2)}function nJ(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const iJ=wS({attachResizeListener:(t,e)=>Lo(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ub={current:void 0},CS=wS({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!ub.current){const t=new iJ({});t.mount(window),t.setOptions({layoutScroll:!0}),ub.current=t}return ub.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),sJ={pan:{Feature:yY},drag:{Feature:bY,ProjectionNode:CS,MeasureLayout:eS}};function TS(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||CE())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const u=a[n];u&&Nr.postRender(()=>u(s,o))};return ko(t.current,r,i,{passive:!t.getProps()[n]})}class oJ extends _a{mount(){this.unmount=No(TS(this.node,!0),TS(this.node,!1))}unmount(){}}class aJ extends _a{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=No(Lo(this.node.current,"focus",()=>this.onFocus()),Lo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const RS=(t,e)=>e?t===e?!0:RS(t,e.parentElement):!1;function fb(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,k0(r))}class cJ extends _a{constructor(){super(...arguments),this.removeStartListeners=Wn,this.removeEndListeners=Wn,this.removeAccessibleListeners=Wn,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=ko(window,"pointerup",(a,u)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:d,globalTapTarget:g}=this.node.getProps(),y=!g&&!RS(this.node.current,a.target)?d:l;y&&Nr.update(()=>y(a,u))},{passive:!(n.onTap||n.onPointerUp)}),o=ko(window,"pointercancel",(a,u)=>this.cancelPress(a,u),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=No(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||fb("up",(u,l)=>{const{onTap:d}=this.node.getProps();d&&Nr.postRender(()=>d(u,l))})};this.removeEndListeners(),this.removeEndListeners=Lo(this.node.current,"keyup",o),fb("down",(a,u)=>{this.startPress(a,u)})},r=Lo(this.node.current,"keydown",e),n=()=>{this.isPressing&&fb("cancel",(s,o)=>this.cancelPress(s,o))},i=Lo(this.node.current,"blur",n);this.removeAccessibleListeners=No(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Nr.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!CE()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Nr.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=ko(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=Lo(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=No(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const lb=new WeakMap,hb=new WeakMap,uJ=t=>{const e=lb.get(t.target);e&&e(t)},fJ=t=>{t.forEach(uJ)};function lJ({root:t,...e}){const r=t||document;hb.has(r)||hb.set(r,{});const n=hb.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(fJ,{root:t,...e})),n[i]}function hJ(t,e,r){const n=lJ(e);return lb.set(t,r),n.observe(t),()=>{lb.delete(t),n.unobserve(t)}}const dJ={some:0,all:1};class pJ extends _a{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:dJ[i]},a=u=>{const{isIntersecting:l}=u;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:g}=this.node.getProps(),y=l?d:g;y&&y(u)};return hJ(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(gJ(e,r))&&this.startObserver()}unmount(){}}function gJ({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const mJ={inView:{Feature:pJ},tap:{Feature:cJ},focus:{Feature:aJ},hover:{Feature:oJ}},vJ={layout:{ProjectionNode:CS,MeasureLayout:eS}},db=Se.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),z0=Se.createContext({}),pb=typeof window<"u",DS=pb?Se.useLayoutEffect:Se.useEffect,OS=Se.createContext({strict:!1});function bJ(t,e,r,n,i){var s,o;const{visualElement:a}=Se.useContext(z0),u=Se.useContext(OS),l=Se.useContext(F0),d=Se.useContext(db).reducedMotion,g=Se.useRef();n=n||u.renderer,!g.current&&n&&(g.current=n(t,{visualState:e,parent:a,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d}));const y=g.current,A=Se.useContext(ZE);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&yJ(g.current,r,i,A);const P=Se.useRef(!1);Se.useInsertionEffect(()=>{y&&P.current&&y.update(r,l)});const N=r[gE],D=Se.useRef(!!N&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,N))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,N)));return DS(()=>{y&&(P.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),ob.render(y.render),D.current&&y.animationState&&y.animationState.animateChanges())}),Se.useEffect(()=>{y&&(!D.current&&y.animationState&&y.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{var k;(k=window.MotionHandoffMarkAsComplete)===null||k===void 0||k.call(window,N)}),D.current=!1))}),y}function yJ(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:u,layoutRoot:l}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:NS(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&ju(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:u,layoutRoot:l})}function NS(t){if(t)return t.options.allowProjection!==!1?t.projection:NS(t.parent)}function wJ(t,e,r){return Se.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):ju(r)&&(r.current=n))},[e])}function H0(t){return P0(t.animate)||yv.some(e=>Vl(t[e]))}function LS(t){return!!(H0(t)||t.variants)}function xJ(t,e){if(H0(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Vl(r)?r:void 0,animate:Vl(n)?n:void 0}}return t.inherit!==!1?e:{}}function _J(t){const{initial:e,animate:r}=xJ(t,Se.useContext(z0));return Se.useMemo(()=>({initial:e,animate:r}),[kS(e),kS(r)])}function kS(t){return Array.isArray(t)?t.join(" "):t}const BS={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Hu={};for(const t in BS)Hu[t]={isEnabled:e=>BS[t].some(r=>!!e[r])};function EJ(t){for(const e in t)Hu[e]={...Hu[e],...t[e]}}const SJ=Symbol.for("motionComponentSymbol");function AJ({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&EJ(t);function s(a,u){let l;const d={...Se.useContext(db),...a,layoutId:PJ(a)},{isStatic:g}=d,y=_J(a),A=n(a,g);if(!g&&pb){MJ(d,t);const P=IJ(d);l=P.MeasureLayout,y.visualElement=bJ(i,A,d,e,P.ProjectionNode)}return ge.jsxs(z0.Provider,{value:y,children:[l&&y.visualElement?ge.jsx(l,{visualElement:y.visualElement,...d}):null,r(i,a,wJ(A,y.visualElement,u),A,g,y.visualElement)]})}const o=Se.forwardRef(s);return o[SJ]=i,o}function PJ({layoutId:t}){const e=Se.useContext(sb).id;return e&&t!==void 0?e+"-"+t:t}function MJ(t,e){const r=Se.useContext(OS).strict;if(process.env.NODE_ENV!=="production"&&e&&r){const n="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?Lu(!1,n):Oo(!1,n)}}function IJ(t){const{drag:e,layout:r}=Hu;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const CJ=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function gb(t){return typeof t!="string"||t.includes("-")?!1:!!(CJ.indexOf(t)>-1||/[A-Z]/u.test(t))}function $S(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const FS=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function jS(t,e,r,n){$S(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(FS.has(i)?i:Jv(i),e.attrs[i])}function US(t,{layout:e,layoutId:r}){return bc.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!U0[t]||t==="opacity")}function mb(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(Qn(i[o])||e.style&&Qn(e.style[o])||US(o,t)||((n=r==null?void 0:r.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function qS(t,e,r){const n=mb(t,e,r);for(const i in t)if(Qn(t[i])||Qn(e[i])){const s=Gl.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function vb(t){const e=Se.useRef(null);return e.current===null&&(e.current=t()),e.current}function TJ({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:RJ(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const zS=t=>(e,r)=>{const n=Se.useContext(z0),i=Se.useContext(F0),s=()=>TJ(t,e,n,i);return r?s():vb(s)};function RJ(t,e,r,n){const i={},s=n(t,{});for(const y in s)i[y]=q0(s[y]);let{initial:o,animate:a}=t;const u=H0(t),l=LS(t);e&&l&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const g=d?a:o;if(g&&typeof g!="boolean"&&!P0(g)){const y=Array.isArray(g)?g:[g];for(let A=0;A({style:{},transform:{},transformOrigin:{},vars:{}}),HS=()=>({...bb(),attrs:{}}),WS=(t,e)=>e&&typeof t=="number"?e.transform(t):t,DJ={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},OJ=Gl.length;function NJ(t,e,r){let n="",i=!0;for(let s=0;stypeof t=="string"&&t.toLowerCase()==="svg",FJ={useVisualState:zS({scrapeMotionValuesFromProps:qS,createRenderState:HS,onMount:(t,e,{renderState:r,latestValues:n})=>{Nr.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),Nr.render(()=>{wb(r,n,xb(e.tagName),t.transformTemplate),jS(e,r)})}})},jJ={useVisualState:zS({scrapeMotionValuesFromProps:mb,createRenderState:bb})};function VS(t,e,r){for(const n in e)!Qn(e[n])&&!US(n,r)&&(t[n]=e[n])}function UJ({transformTemplate:t},e){return Se.useMemo(()=>{const r=bb();return yb(r,e,t),Object.assign({},r.vars,r.style)},[e])}function qJ(t,e){const r=t.style||{},n={};return VS(n,r,t),Object.assign(n,UJ(t,e)),n}function zJ(t,e){const r={},n=qJ(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const HJ=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function W0(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||HJ.has(t)}let GS=t=>!W0(t);function WJ(t){t&&(GS=e=>e.startsWith("on")?!W0(e):t(e))}try{WJ(require("@emotion/is-prop-valid").default)}catch{}function KJ(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(GS(i)||r===!0&&W0(i)||!e&&!W0(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function VJ(t,e,r,n){const i=Se.useMemo(()=>{const s=HS();return wb(s,e,xb(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};VS(s,t.style,t),i.style={...s,...i.style}}return i}function GJ(t=!1){return(r,n,i,{latestValues:s},o)=>{const u=(gb(r)?VJ:zJ)(n,s,o,r),l=KJ(n,typeof r=="string",t),d=r!==Se.Fragment?{...l,...u,ref:i}:{},{children:g}=n,y=Se.useMemo(()=>Qn(g)?g.get():g,[g]);return Se.createElement(r,{...d,children:y})}}function YJ(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...gb(n)?FJ:jJ,preloadedFeatures:t,useRender:GJ(i),createVisualElement:e,Component:n};return AJ(o)}}const _b={current:null},YS={current:!1};function JJ(){if(YS.current=!0,!!pb)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>_b.current=t.matches;t.addListener(e),e()}else _b.current=!1}function XJ(t,e,r){for(const n in e){const i=e[n],s=r[n];if(Qn(i))t.addValue(n,i),process.env.NODE_ENV==="development"&&A0(i.version==="11.11.17",`Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`);else if(Qn(s))t.addValue(n,th(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,th(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const JS=new WeakMap,ZJ=[...N8,Zn,xa],QJ=t=>ZJ.find(O8(t)),XS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class eX{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Mv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=to.now();this.renderScheduledAtthis.bindToMotionValue(n,r)),YS.current||JJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:_b.current,process.env.NODE_ENV!=="production"&&A0(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){JS.delete(this.current),this.projection&&this.projection.unmount(),ba(this.notifyUpdate),ba(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=bc.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Nr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Hu){const r=Hu[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ln()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=th(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(A8(i)||S8(i))?i=parseFloat(i):!QJ(i)&&xa.test(r)&&(i=W8(e,r)),this.setBaseTarget(e,Qn(i)?i.get():i)),Qn(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=vv(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Qn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new Yv),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class ZS extends eX{constructor(){super(...arguments),this.KeyframeResolver=K8}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function tX(t){return window.getComputedStyle(t)}class rX extends ZS{constructor(){super(...arguments),this.type="html",this.renderInstance=$S}readValueFromInstance(e,r){if(bc.has(r)){const n=Nv(r);return n&&n.default||0}else{const n=tX(e),i=(M8(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return YE(e,r)}build(e,r,n){yb(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return mb(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Qn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class nX extends ZS{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ln}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(bc.has(r)){const n=Nv(r);return n&&n.default||0}return r=FS.has(r)?r:Jv(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return qS(e,r,n)}build(e,r,n){wb(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){jS(e,r,n,i)}mount(e){this.isSVGTag=xb(e.tagName),super.mount(e)}}const iX=(t,e)=>gb(t)?new nX(e):new rX(e,{allowProjection:t!==Se.Fragment}),sX=YJ({...GG,...mJ,...sJ,...vJ},iX),oX=UK(sX);class aX extends Yt.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function cX({children:t,isPresent:e}){const r=Se.useId(),n=Se.useRef(null),i=Se.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=Se.useContext(db);return Se.useInsertionEffect(()=>{const{width:o,height:a,top:u,left:l}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` [data-motion-pop-id="${r}"] { position: absolute !important; width: ${o}px !important; @@ -194,7 +199,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene top: ${u}px !important; left: ${l}px !important; } - `),()=>{document.head.removeChild(d)}},[e]),le.jsx(iX,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const oX=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=vb(aX),u=Se.useId(),l=Se.useCallback(g=>{a.set(g,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Se.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:g=>(a.set(g,!1),()=>a.delete(g))}),s?[Math.random(),l]:[r,l]);return Se.useMemo(()=>{a.forEach((g,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=le.jsx(sX,{isPresent:r,children:t})),le.jsx(F0.Provider,{value:d,children:t})};function aX(){return new Map}const K0=t=>t.key||"";function t7(t){const e=[];return Se.Children.forEach(t,r=>{Se.isValidElement(r)&&e.push(r)}),e}const cX=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{ko(!e,"Replace exitBeforeEnter with mode='wait'");const a=Se.useMemo(()=>t7(t),[t]),u=a.map(K0),l=Se.useRef(!0),d=Se.useRef(a),g=vb(()=>new Map),[y,A]=Se.useState(a),[P,O]=Se.useState(a);NS(()=>{l.current=!1,d.current=a;for(let B=0;B1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=Se.useContext(sb);return le.jsx(le.Fragment,{children:P.map(B=>{const j=K0(B),U=a===P||u.includes(j),K=()=>{if(g.has(j))g.set(j,!0);else return;let J=!0;g.forEach(T=>{T||(J=!1)}),J&&(k==null||k(),O(d.current),i&&i())};return le.jsx(oX,{isPresent:U,initial:!l.current||n?void 0:!1,custom:U?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:U?void 0:K,children:B},j)})})},ro=t=>le.jsx(cX,{children:le.jsx(nX.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Eb(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return le.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,le.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[le.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),le.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:le.jsx(OK,{})})]})]})}function uX(t){return t.lastUsed?le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[le.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[le.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function r7(t){var o,a;const{wallet:e,onClick:r}=t,n=le.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Se.useMemo(()=>uX(e),[e]);return le.jsx(Eb,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function n7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=pX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Sb);return a[0]===""&&a.length!==1&&a.shift(),i7(a,e)||dX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},i7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?i7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Sb);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},s7=/^\[(.+)\]$/,dX=t=>{if(s7.test(t)){const e=s7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},pX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return mX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Ab(o,n,s,e)}),n},Ab=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:o7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(gX(i)){Ab(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Ab(o,o7(e,s),r,n)})})},o7=(t,e)=>{let r=t;return e.split(Sb).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},gX=t=>t.isThemeGetter,mX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,vX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},a7="!",bX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,g;for(let D=0;Dd?g-d:void 0;return{modifiers:u,hasImportantModifier:A,baseClassName:P,maybePostfixModifierPosition:O}};return r?a=>r({className:a,parseClassName:o}):o},yX=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},wX=t=>({cache:vX(t.cacheSize),parseClassName:bX(t),...hX(t)}),xX=/\s+/,_X=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(xX);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:A}=r(l);let P=!!A,O=n(P?y.substring(0,A):y);if(!O){if(!P){a=l+(a.length>0?" "+a:a);continue}if(O=n(y),!O){a=l+(a.length>0?" "+a:a);continue}P=!1}const D=yX(d).join(":"),k=g?D+a7:D,B=k+O;if(s.includes(B))continue;s.push(B);const j=i(O,P);for(let U=0;U0?" "+a:a)}return a};function EX(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;ng(d),t());return r=wX(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=_X(u,r);return i(u,d),d}return function(){return s(EX.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},u7=/^\[(?:([a-z-]+):)?(.+)\]$/i,AX=/^\d+\/\d+$/,PX=new Set(["px","full","screen"]),MX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,IX=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,CX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,TX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,RX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,jo=t=>Wu(t)||PX.has(t)||AX.test(t),Aa=t=>Ku(t,"length",FX),Wu=t=>!!t&&!Number.isNaN(Number(t)),Pb=t=>Ku(t,"number",Wu),oh=t=>!!t&&Number.isInteger(Number(t)),DX=t=>t.endsWith("%")&&Wu(t.slice(0,-1)),cr=t=>u7.test(t),Pa=t=>MX.test(t),OX=new Set(["length","size","percentage"]),NX=t=>Ku(t,OX,f7),LX=t=>Ku(t,"position",f7),kX=new Set(["image","url"]),BX=t=>Ku(t,kX,UX),$X=t=>Ku(t,"",jX),ah=()=>!0,Ku=(t,e,r)=>{const n=u7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},FX=t=>IX.test(t)&&!CX.test(t),f7=()=>!1,jX=t=>TX.test(t),UX=t=>RX.test(t),qX=SX(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),g=Gr("invert"),y=Gr("gap"),A=Gr("gradientColorStops"),P=Gr("gradientColorStopPositions"),O=Gr("inset"),D=Gr("margin"),k=Gr("opacity"),B=Gr("padding"),j=Gr("saturate"),U=Gr("scale"),K=Gr("sepia"),J=Gr("skew"),T=Gr("space"),z=Gr("translate"),ue=()=>["auto","contain","none"],_e=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",jo,Aa],f=()=>["auto",Wu,cr],p=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],S=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Wu,cr];return{cacheSize:500,separator:":",theme:{colors:[ah],spacing:[jo,Aa],blur:["none","",Pa,cr],brightness:M(),borderColor:[t],borderRadius:["none","","full",Pa,cr],borderSpacing:E(),borderWidth:m(),contrast:M(),grayscale:S(),hueRotate:M(),invert:S(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[DX,Aa],inset:G(),margin:G(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:S(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Pa]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...p(),cr]}],overflow:[{overflow:_e()}],"overflow-x":[{"overflow-x":_e()}],"overflow-y":[{"overflow-y":_e()}],overscroll:[{overscroll:ue()}],"overscroll-x":[{"overscroll-x":ue()}],"overscroll-y":[{"overscroll-y":ue()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[O]}],"inset-x":[{"inset-x":[O]}],"inset-y":[{"inset-y":[O]}],start:[{start:[O]}],end:[{end:[O]}],top:[{top:[O]}],right:[{right:[O]}],bottom:[{bottom:[O]}],left:[{left:[O]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",oh,cr]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",oh,cr]}],"grid-cols":[{"grid-cols":[ah]}],"col-start-end":[{col:["auto",{span:["full",oh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[ah]}],"row-start-end":[{row:["auto",{span:[oh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[B]}],px:[{px:[B]}],py:[{py:[B]}],ps:[{ps:[B]}],pe:[{pe:[B]}],pt:[{pt:[B]}],pr:[{pr:[B]}],pb:[{pb:[B]}],pl:[{pl:[B]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Pa]},Pa]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Pa,Aa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Pb]}],"font-family":[{font:[ah]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Wu,Pb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",jo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",jo,Aa]}],"underline-offset":[{"underline-offset":["auto",jo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...p(),LX]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",NX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},BX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[A]}],"gradient-via":[{via:[A]}],"gradient-to":[{to:[A]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[jo,cr]}],"outline-w":[{outline:[jo,Aa]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[jo,Aa]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Pa,$X]}],"shadow-color":[{shadow:[ah]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Pa,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[g]}],saturate:[{saturate:[j]}],sepia:[{sepia:[K]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[j]}],"backdrop-sepia":[{"backdrop-sepia":[K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[U]}],"scale-x":[{"scale-x":[U]}],"scale-y":[{"scale-y":[U]}],rotate:[{rotate:[oh,cr]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[J]}],"skew-y":[{"skew-y":[J]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[jo,Aa,Pb]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function no(...t){return qX(lX(t))}function l7(t){const{className:e}=t;return le.jsxs("div",{className:no("xc-flex xc-items-center xc-gap-2"),children:[le.jsx("hr",{className:no("xc-flex-1 xc-border-gray-200",e)}),le.jsx("div",{className:"xc-shrink-0",children:t.children}),le.jsx("hr",{className:no("xc-flex-1 xc-border-gray-200",e)})]})}const zX="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function HX(t){const{onClick:e}=t;function r(){e&&e()}return le.jsx(l7,{className:"xc-opacity-20",children:le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[le.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),le.jsx(f8,{size:16})]})})}function h7(t){const[e,r]=Se.useState(""),{featuredWallets:n,initialized:i}=Kl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Se.useMemo(()=>{const O=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!O.test(e)&&D.test(e)},[e]);function g(O){o(O)}function y(O){r(O.target.value)}async function A(){s(e)}function P(O){O.key==="Enter"&&d&&A()}return le.jsx(ro,{children:i&&le.jsxs(le.Fragment,{children:[t.header||le.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),l.showEmailSignIn&&le.jsxs("div",{className:"xc-mb-4",children:[le.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:y,onKeyDown:P}),le.jsx("button",{disabled:!d,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:A,children:"Continue"})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&le.jsx("div",{className:"xc-mb-4",children:le.jsxs(l7,{className:"xc-opacity-20",children:[" ",le.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),le.jsxs("div",{children:[le.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(O=>le.jsx(r7,{wallet:O,onClick:g},`feature-${O.key}`)),l.showTonConnect&&le.jsx(Eb,{icon:le.jsx("img",{className:"xc-h-5 xc-w-5",src:zX}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&le.jsx(HX,{onClick:a})]})]})})}function Ac(t){const{title:e}=t;return le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[le.jsx(DK,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),le.jsx("span",{children:e})]})}var WX=Object.defineProperty,KX=Object.defineProperties,VX=Object.getOwnPropertyDescriptors,V0=Object.getOwnPropertySymbols,d7=Object.prototype.hasOwnProperty,p7=Object.prototype.propertyIsEnumerable,g7=(t,e,r)=>e in t?WX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,GX=(t,e)=>{for(var r in e||(e={}))d7.call(e,r)&&g7(t,r,e[r]);if(V0)for(var r of V0(e))p7.call(e,r)&&g7(t,r,e[r]);return t},YX=(t,e)=>KX(t,VX(e)),JX=(t,e)=>{var r={};for(var n in t)d7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&V0)for(var n of V0(t))e.indexOf(n)<0&&p7.call(t,n)&&(r[n]=t[n]);return r};function XX(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function ZX(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var QX=18,m7=40,eZ=`${m7}px`,tZ=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function rZ({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),g=Yt.useCallback(()=>{let y=t.current,A=e.current;if(!y||!A||u||r==="none")return;let P=y,O=P.getBoundingClientRect().left+P.offsetWidth,D=P.getBoundingClientRect().top+P.offsetHeight/2,k=O-QX,B=D;document.querySelectorAll(tZ).length===0&&document.elementFromPoint(k,B)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function A(){let O=window.innerWidth-y.getBoundingClientRect().right;a(O>=m7)}A();let P=setInterval(A,1e3);return()=>{clearInterval(P)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let A=setTimeout(g,0),P=setTimeout(g,2e3),O=setTimeout(g,5e3),D=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(A),clearTimeout(P),clearTimeout(O),clearTimeout(D)}},[e,n,r,g]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:eZ}}var v7=Yt.createContext({}),b7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:g="increase-width",pasteTransformer:y,containerClassName:A,noScriptCSSFallback:P=nZ,render:O,children:D}=r,k=JX(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),B,j,U,K,J;let[T,z]=Yt.useState(typeof k.defaultValue=="string"?k.defaultValue:""),ue=n??T,_e=ZX(ue),G=Yt.useCallback(ie=>{i==null||i(ie),z(ie)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),p=Yt.useRef({value:ue,onChange:G,isIOS:typeof window<"u"&&((j=(B=window==null?void 0:window.CSS)==null?void 0:B.supports)==null?void 0:j.call(B,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(U=m.current)==null?void 0:U.selectionStart,(K=m.current)==null?void 0:K.selectionEnd,(J=m.current)==null?void 0:J.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let ie=m.current,fe=f.current;if(!ie||!fe)return;p.current.value!==ie.value&&p.current.onChange(ie.value),v.current.prev=[ie.selectionStart,ie.selectionEnd,ie.selectionDirection];function ve(){if(document.activeElement!==ie){I(null),ae(null);return}let Te=ie.selectionStart,$e=ie.selectionEnd,Ie=ie.selectionDirection,Le=ie.maxLength,Ve=ie.value,ke=v.current.prev,ze=-1,He=-1,Ee;if(Ve.length!==0&&Te!==null&&$e!==null){let et=Te===$e,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let pt=0;if(ke[0]!==null&&ke[1]!==null){Ee=Je{fe&&fe.style.setProperty("--root-height",`${ie.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(ie),()=>{document.removeEventListener("selectionchange",ve,{capture:!0}),Ne.disconnect()}},[]);let[x,_]=Yt.useState(!1),[S,b]=Yt.useState(!1),[M,I]=Yt.useState(null),[F,ae]=Yt.useState(null);Yt.useEffect(()=>{XX(()=>{var ie,fe,ve,Me;(ie=m.current)==null||ie.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(ve=m.current)==null?void 0:ve.selectionEnd,$e=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ae(Te),v.current.prev=[Ne,Te,$e])})},[ue,S]),Yt.useEffect(()=>{_e!==void 0&&ue!==_e&&_e.length{let fe=ie.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){ie.preventDefault();return}typeof _e=="string"&&fe.length<_e.length&&document.dispatchEvent(new Event("selectionchange")),G(fe)},[s,G,_e,E]),ee=Yt.useCallback(()=>{var ie;if(m.current){let fe=Math.min(m.current.value.length,s-1),ve=m.current.value.length;(ie=m.current)==null||ie.setSelectionRange(fe,ve),I(fe),ae(ve)}b(!0)},[s]),X=Yt.useCallback(ie=>{var fe,ve;let Me=m.current;if(!y&&(!p.current.isIOS||!ie.clipboardData||!Me))return;let Ne=ie.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),ie.preventDefault();let $e=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(ve=m.current)==null?void 0:ve.selectionEnd,Le=($e!==Ie?ue.slice(0,$e)+Te+ue.slice(Ie):ue.slice(0,$e)+Te+ue.slice($e)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,G(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ae(ke)},[s,G,E,ue]),Q=Yt.useMemo(()=>({position:"relative",cursor:k.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[k.disabled]),R=Yt.useMemo(()=>({position:"absolute",inset:0,width:N.willPushPWMBadge?`calc(100% + ${N.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:N.willPushPWMBadge?`inset(0 ${N.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[N.PWM_BADGE_SPACE_WIDTH,N.willPushPWMBadge,o]),Z=Yt.useMemo(()=>Yt.createElement("input",YX(GX({autoComplete:k.autoComplete||"one-time-code"},k),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ue.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:R,maxLength:s,value:ue,ref:m,onPaste:ie=>{var fe;X(ie),(fe=k.onPaste)==null||fe.call(k,ie)},onChange:se,onMouseOver:ie=>{var fe;_(!0),(fe=k.onMouseOver)==null||fe.call(k,ie)},onMouseLeave:ie=>{var fe;_(!1),(fe=k.onMouseLeave)==null||fe.call(k,ie)},onFocus:ie=>{var fe;ee(),(fe=k.onFocus)==null||fe.call(k,ie)},onBlur:ie=>{var fe;b(!1),(fe=k.onBlur)==null||fe.call(k,ie)}})),[se,ee,X,l,R,s,F,M,k,E==null?void 0:E.source,ue]),te=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ie,fe)=>{var ve;let Me=S&&M!==null&&F!==null&&(M===F&&fe===M||fe>=M&&feO?O(te):Yt.createElement(v7.Provider,{value:te},D),[D,te,O]);return Yt.createElement(Yt.Fragment,null,P!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,P)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:A},he,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Z)))});b7.displayName="Input";function ch(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var nZ=` + `),()=>{document.head.removeChild(d)}},[e]),ge.jsx(aX,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const uX=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=vb(fX),u=Se.useId(),l=Se.useCallback(g=>{a.set(g,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Se.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:g=>(a.set(g,!1),()=>a.delete(g))}),s?[Math.random(),l]:[r,l]);return Se.useMemo(()=>{a.forEach((g,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=ge.jsx(cX,{isPresent:r,children:t})),ge.jsx(F0.Provider,{value:d,children:t})};function fX(){return new Map}const K0=t=>t.key||"";function QS(t){const e=[];return Se.Children.forEach(t,r=>{Se.isValidElement(r)&&e.push(r)}),e}const lX=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Oo(!e,"Replace exitBeforeEnter with mode='wait'");const a=Se.useMemo(()=>QS(t),[t]),u=a.map(K0),l=Se.useRef(!0),d=Se.useRef(a),g=vb(()=>new Map),[y,A]=Se.useState(a),[P,N]=Se.useState(a);DS(()=>{l.current=!1,d.current=a;for(let B=0;B1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=Se.useContext(sb);return ge.jsx(ge.Fragment,{children:P.map(B=>{const j=K0(B),U=a===P||u.includes(j),K=()=>{if(g.has(j))g.set(j,!0);else return;let J=!0;g.forEach(T=>{T||(J=!1)}),J&&(k==null||k(),N(d.current),i&&i())};return ge.jsx(uX,{isPresent:U,initial:!l.current||n?void 0:!1,custom:U?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:U?void 0:K,children:B},j)})})},Ss=t=>ge.jsx(lX,{children:ge.jsx(oX.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Eb(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return ge.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,ge.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[ge.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),ge.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:ge.jsx(NK,{})})]})]})}function hX(t){return t.lastUsed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function e7(t){var o,a;const{wallet:e,onClick:r}=t,n=ge.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Se.useMemo(()=>hX(e),[e]);return ge.jsx(Eb,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function t7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=vX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Sb);return a[0]===""&&a.length!==1&&a.shift(),r7(a,e)||mX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},r7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?r7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Sb);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},n7=/^\[(.+)\]$/,mX=t=>{if(n7.test(t)){const e=n7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},vX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return yX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Ab(o,n,s,e)}),n},Ab=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:i7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(bX(i)){Ab(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Ab(o,i7(e,s),r,n)})})},i7=(t,e)=>{let r=t;return e.split(Sb).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},bX=t=>t.isThemeGetter,yX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,wX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},s7="!",xX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,g;for(let D=0;Dd?g-d:void 0;return{modifiers:u,hasImportantModifier:A,baseClassName:P,maybePostfixModifierPosition:N}};return r?a=>r({className:a,parseClassName:o}):o},_X=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},EX=t=>({cache:wX(t.cacheSize),parseClassName:xX(t),...gX(t)}),SX=/\s+/,AX=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(SX);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:A}=r(l);let P=!!A,N=n(P?y.substring(0,A):y);if(!N){if(!P){a=l+(a.length>0?" "+a:a);continue}if(N=n(y),!N){a=l+(a.length>0?" "+a:a);continue}P=!1}const D=_X(d).join(":"),k=g?D+s7:D,B=k+N;if(s.includes(B))continue;s.push(B);const j=i(N,P);for(let U=0;U0?" "+a:a)}return a};function PX(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;ng(d),t());return r=EX(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=AX(u,r);return i(u,d),d}return function(){return s(PX.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},a7=/^\[(?:([a-z-]+):)?(.+)\]$/i,IX=/^\d+\/\d+$/,CX=new Set(["px","full","screen"]),TX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RX=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,DX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,OX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bo=t=>Wu(t)||CX.has(t)||IX.test(t),Ea=t=>Ku(t,"length",qX),Wu=t=>!!t&&!Number.isNaN(Number(t)),Pb=t=>Ku(t,"number",Wu),oh=t=>!!t&&Number.isInteger(Number(t)),LX=t=>t.endsWith("%")&&Wu(t.slice(0,-1)),cr=t=>a7.test(t),Sa=t=>TX.test(t),kX=new Set(["length","size","percentage"]),BX=t=>Ku(t,kX,c7),$X=t=>Ku(t,"position",c7),FX=new Set(["image","url"]),jX=t=>Ku(t,FX,HX),UX=t=>Ku(t,"",zX),ah=()=>!0,Ku=(t,e,r)=>{const n=a7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},qX=t=>RX.test(t)&&!DX.test(t),c7=()=>!1,zX=t=>OX.test(t),HX=t=>NX.test(t),WX=MX(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),g=Gr("invert"),y=Gr("gap"),A=Gr("gradientColorStops"),P=Gr("gradientColorStopPositions"),N=Gr("inset"),D=Gr("margin"),k=Gr("opacity"),B=Gr("padding"),j=Gr("saturate"),U=Gr("scale"),K=Gr("sepia"),J=Gr("skew"),T=Gr("space"),z=Gr("translate"),ue=()=>["auto","contain","none"],_e=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",Bo,Ea],f=()=>["auto",Wu,cr],p=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],S=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Wu,cr];return{cacheSize:500,separator:":",theme:{colors:[ah],spacing:[Bo,Ea],blur:["none","",Sa,cr],brightness:M(),borderColor:[t],borderRadius:["none","","full",Sa,cr],borderSpacing:E(),borderWidth:m(),contrast:M(),grayscale:S(),hueRotate:M(),invert:S(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[LX,Ea],inset:G(),margin:G(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:S(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Sa]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...p(),cr]}],overflow:[{overflow:_e()}],"overflow-x":[{"overflow-x":_e()}],"overflow-y":[{"overflow-y":_e()}],overscroll:[{overscroll:ue()}],"overscroll-x":[{"overscroll-x":ue()}],"overscroll-y":[{"overscroll-y":ue()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",oh,cr]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",oh,cr]}],"grid-cols":[{"grid-cols":[ah]}],"col-start-end":[{col:["auto",{span:["full",oh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[ah]}],"row-start-end":[{row:["auto",{span:[oh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[B]}],px:[{px:[B]}],py:[{py:[B]}],ps:[{ps:[B]}],pe:[{pe:[B]}],pt:[{pt:[B]}],pr:[{pr:[B]}],pb:[{pb:[B]}],pl:[{pl:[B]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Sa]},Sa]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Sa,Ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Pb]}],"font-family":[{font:[ah]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Wu,Pb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Bo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Bo,Ea]}],"underline-offset":[{"underline-offset":["auto",Bo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...p(),$X]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",BX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},jX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[A]}],"gradient-via":[{via:[A]}],"gradient-to":[{to:[A]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[Bo,cr]}],"outline-w":[{outline:[Bo,Ea]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Bo,Ea]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Sa,UX]}],"shadow-color":[{shadow:[ah]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Sa,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[g]}],saturate:[{saturate:[j]}],sepia:[{sepia:[K]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[j]}],"backdrop-sepia":[{"backdrop-sepia":[K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[U]}],"scale-x":[{"scale-x":[U]}],"scale-y":[{"scale-y":[U]}],rotate:[{rotate:[oh,cr]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[J]}],"skew-y":[{"skew-y":[J]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Bo,Ea,Pb]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function $o(...t){return WX(pX(t))}function u7(t){const{className:e}=t;return ge.jsxs("div",{className:$o("xc-flex xc-items-center xc-gap-2"),children:[ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)}),ge.jsx("div",{className:"xc-shrink-0",children:t.children}),ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)})]})}const KX="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function VX(t){const{onClick:e}=t;function r(){e&&e()}return ge.jsx(u7,{className:"xc-opacity-20",children:ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[ge.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),ge.jsx(u8,{size:16})]})})}function f7(t){const[e,r]=Se.useState(""),{featuredWallets:n,initialized:i}=Kl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Se.useMemo(()=>{const N=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!N.test(e)&&D.test(e)},[e]);function g(N){o(N)}function y(N){r(N.target.value)}async function A(){s(e)}function P(N){N.key==="Enter"&&d&&A()}return ge.jsx(Ss,{children:i&&ge.jsxs(ge.Fragment,{children:[t.header||ge.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),l.showEmailSignIn&&ge.jsxs("div",{className:"xc-mb-4",children:[ge.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:y,onKeyDown:P}),ge.jsx("button",{disabled:!d,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:A,children:"Continue"})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&ge.jsx("div",{className:"xc-mb-4",children:ge.jsxs(u7,{className:"xc-opacity-20",children:[" ",ge.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),ge.jsxs("div",{children:[ge.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(N=>ge.jsx(e7,{wallet:N,onClick:g},`feature-${N.key}`)),l.showTonConnect&&ge.jsx(Eb,{icon:ge.jsx("img",{className:"xc-h-5 xc-w-5",src:KX}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&ge.jsx(VX,{onClick:a})]})]})})}function Sc(t){const{title:e}=t;return ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[ge.jsx(OK,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),ge.jsx("span",{children:e})]})}const l7=Se.createContext({channel:"",device:"WEB",app:"",inviterCode:""});function Mb(){return Se.useContext(l7)}function GX(t){const{config:e}=t,[r,n]=Se.useState(e.channel),[i,s]=Se.useState(e.device),[o,a]=Se.useState(e.app),[u,l]=Se.useState(e.inviterCode);return Se.useEffect(()=>{n(e.channel),s(e.device),a(e.app),l(e.inviterCode)},[e]),ge.jsx(l7.Provider,{value:{channel:r,device:i,app:o,inviterCode:u},children:t.children})}var YX=Object.defineProperty,JX=Object.defineProperties,XX=Object.getOwnPropertyDescriptors,V0=Object.getOwnPropertySymbols,h7=Object.prototype.hasOwnProperty,d7=Object.prototype.propertyIsEnumerable,p7=(t,e,r)=>e in t?YX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ZX=(t,e)=>{for(var r in e||(e={}))h7.call(e,r)&&p7(t,r,e[r]);if(V0)for(var r of V0(e))d7.call(e,r)&&p7(t,r,e[r]);return t},QX=(t,e)=>JX(t,XX(e)),eZ=(t,e)=>{var r={};for(var n in t)h7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&V0)for(var n of V0(t))e.indexOf(n)<0&&d7.call(t,n)&&(r[n]=t[n]);return r};function tZ(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function rZ(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var nZ=18,g7=40,iZ=`${g7}px`,sZ=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function oZ({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),g=Yt.useCallback(()=>{let y=t.current,A=e.current;if(!y||!A||u||r==="none")return;let P=y,N=P.getBoundingClientRect().left+P.offsetWidth,D=P.getBoundingClientRect().top+P.offsetHeight/2,k=N-nZ,B=D;document.querySelectorAll(sZ).length===0&&document.elementFromPoint(k,B)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function A(){let N=window.innerWidth-y.getBoundingClientRect().right;a(N>=g7)}A();let P=setInterval(A,1e3);return()=>{clearInterval(P)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let A=setTimeout(g,0),P=setTimeout(g,2e3),N=setTimeout(g,5e3),D=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(A),clearTimeout(P),clearTimeout(N),clearTimeout(D)}},[e,n,r,g]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:iZ}}var m7=Yt.createContext({}),v7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:g="increase-width",pasteTransformer:y,containerClassName:A,noScriptCSSFallback:P=aZ,render:N,children:D}=r,k=eZ(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),B,j,U,K,J;let[T,z]=Yt.useState(typeof k.defaultValue=="string"?k.defaultValue:""),ue=n??T,_e=rZ(ue),G=Yt.useCallback(ie=>{i==null||i(ie),z(ie)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),p=Yt.useRef({value:ue,onChange:G,isIOS:typeof window<"u"&&((j=(B=window==null?void 0:window.CSS)==null?void 0:B.supports)==null?void 0:j.call(B,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(U=m.current)==null?void 0:U.selectionStart,(K=m.current)==null?void 0:K.selectionEnd,(J=m.current)==null?void 0:J.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let ie=m.current,fe=f.current;if(!ie||!fe)return;p.current.value!==ie.value&&p.current.onChange(ie.value),v.current.prev=[ie.selectionStart,ie.selectionEnd,ie.selectionDirection];function ve(){if(document.activeElement!==ie){I(null),ae(null);return}let Te=ie.selectionStart,$e=ie.selectionEnd,Ie=ie.selectionDirection,Le=ie.maxLength,Ve=ie.value,ke=v.current.prev,ze=-1,He=-1,Ee;if(Ve.length!==0&&Te!==null&&$e!==null){let et=Te===$e,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let pt=0;if(ke[0]!==null&&ke[1]!==null){Ee=Je{fe&&fe.style.setProperty("--root-height",`${ie.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(ie),()=>{document.removeEventListener("selectionchange",ve,{capture:!0}),Ne.disconnect()}},[]);let[x,_]=Yt.useState(!1),[S,b]=Yt.useState(!1),[M,I]=Yt.useState(null),[F,ae]=Yt.useState(null);Yt.useEffect(()=>{tZ(()=>{var ie,fe,ve,Me;(ie=m.current)==null||ie.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(ve=m.current)==null?void 0:ve.selectionEnd,$e=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ae(Te),v.current.prev=[Ne,Te,$e])})},[ue,S]),Yt.useEffect(()=>{_e!==void 0&&ue!==_e&&_e.length{let fe=ie.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){ie.preventDefault();return}typeof _e=="string"&&fe.length<_e.length&&document.dispatchEvent(new Event("selectionchange")),G(fe)},[s,G,_e,E]),ee=Yt.useCallback(()=>{var ie;if(m.current){let fe=Math.min(m.current.value.length,s-1),ve=m.current.value.length;(ie=m.current)==null||ie.setSelectionRange(fe,ve),I(fe),ae(ve)}b(!0)},[s]),X=Yt.useCallback(ie=>{var fe,ve;let Me=m.current;if(!y&&(!p.current.isIOS||!ie.clipboardData||!Me))return;let Ne=ie.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),ie.preventDefault();let $e=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(ve=m.current)==null?void 0:ve.selectionEnd,Le=($e!==Ie?ue.slice(0,$e)+Te+ue.slice(Ie):ue.slice(0,$e)+Te+ue.slice($e)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,G(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ae(ke)},[s,G,E,ue]),Q=Yt.useMemo(()=>({position:"relative",cursor:k.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[k.disabled]),R=Yt.useMemo(()=>({position:"absolute",inset:0,width:O.willPushPWMBadge?`calc(100% + ${O.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:O.willPushPWMBadge?`inset(0 ${O.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[O.PWM_BADGE_SPACE_WIDTH,O.willPushPWMBadge,o]),Z=Yt.useMemo(()=>Yt.createElement("input",QX(ZX({autoComplete:k.autoComplete||"one-time-code"},k),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ue.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:R,maxLength:s,value:ue,ref:m,onPaste:ie=>{var fe;X(ie),(fe=k.onPaste)==null||fe.call(k,ie)},onChange:se,onMouseOver:ie=>{var fe;_(!0),(fe=k.onMouseOver)==null||fe.call(k,ie)},onMouseLeave:ie=>{var fe;_(!1),(fe=k.onMouseLeave)==null||fe.call(k,ie)},onFocus:ie=>{var fe;ee(),(fe=k.onFocus)==null||fe.call(k,ie)},onBlur:ie=>{var fe;b(!1),(fe=k.onBlur)==null||fe.call(k,ie)}})),[se,ee,X,l,R,s,F,M,k,E==null?void 0:E.source,ue]),te=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ie,fe)=>{var ve;let Me=S&&M!==null&&F!==null&&(M===F&&fe===M||fe>=M&&feN?N(te):Yt.createElement(m7.Provider,{value:te},D),[D,te,N]);return Yt.createElement(Yt.Fragment,null,P!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,P)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:A},le,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Z)))});v7.displayName="Input";function ch(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var aZ=` [data-input-otp] { --nojs-bg: white !important; --nojs-fg: black !important; @@ -213,13 +218,13 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene --nojs-bg: black !important; --nojs-fg: white !important; } -}`;const Mb=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>le.jsx(b7,{ref:n,containerClassName:no("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:no("disabled:xc-cursor-not-allowed",t),...r}));Mb.displayName="InputOTP";const Ib=Yt.forwardRef(({className:t,...e},r)=>le.jsx("div",{ref:r,className:no("xc-flex xc-items-center",t),...e}));Ib.displayName="InputOTPGroup";const Li=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(v7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return le.jsxs("div",{ref:n,className:no("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&le.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:le.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Li.displayName="InputOTPSlot";function y7(t){const{spinning:e,children:r,className:n}=t;return le.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&le.jsx("div",{className:no("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:le.jsx(ya,{className:"xc-animate-spin"})})]})}const w7=Se.createContext({channel:"",device:"WEB",app:"",inviterCode:""});function Cb(){return Se.useContext(w7)}function iZ(t){const{config:e}=t,[r,n]=Se.useState(e.channel),[i,s]=Se.useState(e.device),[o,a]=Se.useState(e.app),[u,l]=Se.useState(e.inviterCode);return Se.useEffect(()=>{n(e.channel),s(e.device),a(e.app),l(e.inviterCode)},[e]),le.jsx(w7.Provider,{value:{channel:r,device:i,app:o,inviterCode:u},children:t.children})}function sZ(t){const{email:e}=t,[r,n]=Se.useState(0),[i,s]=Se.useState(!1),[o,a]=Se.useState(!1),[u,l]=Se.useState(""),[d,g]=Se.useState(""),y=Cb();async function A(){n(60);const D=setInterval(()=>{n(k=>k===0?(clearInterval(D),0):k-1)},1e3)}async function P(D){a(!0);try{l(""),await No.getEmailCode({account_type:"email",email:D}),A()}catch(k){l(k.message)}a(!1)}Se.useEffect(()=>{e&&P(e)},[e]);async function O(D){if(g(""),!(D.length<6)){s(!0);try{const k=await No.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:D,email:e,inviter_code:y.inviterCode,source:{device:y.device,channel:y.channel,app:y.app}});t.onLogin(k.data)}catch(k){g(k.message)}s(!1)}}return le.jsxs(ro,{children:[le.jsx("div",{className:"xc-mb-12",children:le.jsx(Ac,{title:"Sign in with email",onBack:t.onBack})}),le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[le.jsx(h8,{className:"xc-mb-4",size:60}),le.jsx("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:u?le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{className:"xc-px-8",children:u})}):o?le.jsx(ya,{className:"xc-animate-spin"}):le.jsxs(le.Fragment,{children:[le.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),le.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]})}),le.jsx("div",{className:"xc-mb-2 xc-h-12",children:le.jsx(y7,{spinning:i,className:"xc-rounded-xl",children:le.jsx(Mb,{maxLength:6,onChange:O,disabled:i,className:"disabled:xc-opacity-20",children:le.jsx(Ib,{children:le.jsxs("div",{className:no("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[le.jsx(Li,{index:0}),le.jsx(Li,{index:1}),le.jsx(Li,{index:2}),le.jsx(Li,{index:3}),le.jsx(Li,{index:4}),le.jsx(Li,{index:5})]})})})})}),d&&le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{children:d})})]}),le.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Recend in ${r}s`:le.jsx("button",{onClick:()=>P(e),children:"Send again"})]})]})}var x7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var g=function(f,p){var v=f,x=k[p],_=null,S=0,b=null,M=[],I={},F=function(te,he){_=function(ie){for(var fe=new Array(ie),ve=0;ve=7&&ee(te),b==null&&(b=R(v,x,M)),Q(b,he)},ae=function(te,he){for(var ie=-1;ie<=7;ie+=1)if(!(te+ie<=-1||S<=te+ie))for(var fe=-1;fe<=7;fe+=1)he+fe<=-1||S<=he+fe||(_[te+ie][he+fe]=0<=ie&&ie<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(ie==0||ie==6)||2<=ie&&ie<=4&&2<=fe&&fe<=4)},N=function(){for(var te=8;te>ie&1)==1;_[Math.floor(ie/3)][ie%3+S-8-3]=fe}for(ie=0;ie<18;ie+=1)fe=!te&&(he>>ie&1)==1,_[ie%3+S-8-3][Math.floor(ie/3)]=fe},X=function(te,he){for(var ie=x<<3|he,fe=B.getBCHTypeInfo(ie),ve=0;ve<15;ve+=1){var Me=!te&&(fe>>ve&1)==1;ve<6?_[ve][8]=Me:ve<8?_[ve+1][8]=Me:_[S-15+ve][8]=Me}for(ve=0;ve<15;ve+=1)Me=!te&&(fe>>ve&1)==1,ve<8?_[8][S-ve-1]=Me:ve<9?_[8][15-ve-1+1]=Me:_[8][15-ve-1]=Me;_[S-8][8]=!te},Q=function(te,he){for(var ie=-1,fe=S-1,ve=7,Me=0,Ne=B.getMaskFunction(he),Te=S-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var $e=0;$e<2;$e+=1)if(_[fe][Te-$e]==null){var Ie=!1;Me>>ve&1)==1),Ne(fe,Te-$e)&&(Ie=!Ie),_[fe][Te-$e]=Ie,(ve-=1)==-1&&(Me+=1,ve=7)}if((fe+=ie)<0||S<=fe){fe-=ie,ie=-ie;break}}},R=function(te,he,ie){for(var fe=K.getRSBlocks(te,he),ve=J(),Me=0;Me8*Te)throw"code length overflow. ("+ve.getLengthInBits()+">"+8*Te+")";for(ve.getLengthInBits()+4<=8*Te&&ve.put(0,4);ve.getLengthInBits()%8!=0;)ve.putBit(!1);for(;!(ve.getLengthInBits()>=8*Te||(ve.put(236,8),ve.getLengthInBits()>=8*Te));)ve.put(17,8);return function($e,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Ee=0;Ee=0?rt.getAt(Je):0}}var pt=0;for(Be=0;BeIe)&&(Ne=Ie,Te=$e)}return Te}())},I.createTableTag=function(te,he){te=te||2;var ie="";ie+='
";for(var ve=0;ve';ie+=""}return(ie+="")+"
"},I.createSvgTag=function(te,he,ie,fe){var ve={};typeof arguments[0]=="object"&&(te=(ve=arguments[0]).cellSize,he=ve.margin,ie=ve.alt,fe=ve.title),te=te||2,he=he===void 0?4*te:he,(ie=typeof ie=="string"?{text:ie}:ie||{}).text=ie.text||null,ie.id=ie.text?ie.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*te+2*he,Le="";for($e="l"+te+",0 0,"+te+" -"+te+",0 0,-"+te+"z ",Le+=''+Z(fe.text)+"":"",Le+=ie.text?''+Z(ie.text)+"":"",Le+='',Le+='"},I.createDataURL=function(te,he){te=te||2,he=he===void 0?4*te:he;var ie=I.getModuleCount()*te+2*he,fe=he,ve=ie-he;return m(ie,ie,function(Me,Ne){if(fe<=Me&&Me"};var Z=function(te){for(var he="",ie=0;ie":he+=">";break;case"&":he+="&";break;case'"':he+=""";break;default:he+=fe}}return he};return I.createASCII=function(te,he){if((te=te||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Ee,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:pt[Be];ft+=` -`}return et%2&&ze>0?ft.substring(0,ft.length-et-1)+Array(et+1).join("▀"):ft.substring(0,ft.length-1)}(he);te-=1,he=he===void 0?2*te:he;var ie,fe,ve,Me,Ne=I.getModuleCount()*te+2*he,Te=he,$e=Ne-he,Ie=Array(te+1).join("██"),Le=Array(te+1).join(" "),Ve="",ke="";for(ie=0;ie>>8),S.push(255&I)):S.push(x)}}return S}};var y,A,P,O,D,k={L:1,M:0,Q:3,H:2},B=(y=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],A=1335,P=7973,D=function(f){for(var p=0;f!=0;)p+=1,f>>>=1;return p},(O={}).getBCHTypeInfo=function(f){for(var p=f<<10;D(p)-D(A)>=0;)p^=A<=0;)p^=P<5&&(v+=3+S-5)}for(x=0;x=256;)x-=255;return f[x]}}}();function U(f,p){if(f.length===void 0)throw f.length+"/"+p;var v=function(){for(var _=0;_>>7-x%8&1)==1},put:function(x,_){for(var S=0;S<_;S+=1)v.putBit((x>>>_-S-1&1)==1)},getLengthInBits:function(){return p},putBit:function(x){var _=Math.floor(p/8);f.length<=_&&f.push(0),x&&(f[_]|=128>>>p%8),p+=1}};return v},T=function(f){var p=f,v={getMode:function(){return 1},getLength:function(S){return p.length},write:function(S){for(var b=p,M=0;M+2>>8&255)+(255&M),_.put(M,13),b+=2}if(b>>8)},writeBytes:function(v,x,_){x=x||0,_=_||v.length;for(var S=0;S<_;S+=1)p.writeByte(v[S+x])},writeString:function(v){for(var x=0;x0&&(v+=","),v+=f[x];return v+"]"}};return p},E=function(f){var p=f,v=0,x=0,_=0,S={read:function(){for(;_<8;){if(v>=p.length){if(_==0)return-1;throw"unexpected end of file./"+_}var M=p.charAt(v);if(v+=1,M=="=")return _=0,-1;M.match(/^\s$/)||(x=x<<6|b(M.charCodeAt(0)),_+=6)}var I=x>>>_-8&255;return _-=8,I}},b=function(M){if(65<=M&&M<=90)return M-65;if(97<=M&&M<=122)return M-97+26;if(48<=M&&M<=57)return M-48+52;if(M==43)return 62;if(M==47)return 63;throw"c:"+M};return S},m=function(f,p,v){for(var x=function(ae,N){var se=ae,ee=N,X=new Array(ae*N),Q={setPixel:function(te,he,ie){X[he*se+te]=ie},write:function(te){te.writeString("GIF87a"),te.writeShort(se),te.writeShort(ee),te.writeByte(128),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(255),te.writeByte(255),te.writeByte(255),te.writeString(","),te.writeShort(0),te.writeShort(0),te.writeShort(se),te.writeShort(ee),te.writeByte(0);var he=R(2);te.writeByte(2);for(var ie=0;he.length-ie>255;)te.writeByte(255),te.writeBytes(he,ie,255),ie+=255;te.writeByte(he.length-ie),te.writeBytes(he,ie,he.length-ie),te.writeByte(0),te.writeString(";")}},R=function(te){for(var he=1<>>Ee)throw"length over";for(;Te+Ee>=8;)Ne.writeByte(255&(He<>>=8-Te,$e=0,Te=0;$e|=He<0&&Ne.writeByte($e)}});Le.write(he,fe);var Ve=0,ke=String.fromCharCode(X[Ve]);for(Ve+=1;Ve=6;)Q(ae>>>N-6),N-=6},X.flush=function(){if(N>0&&(Q(ae<<6-N),ae=0,N=0),se%3!=0)for(var Z=3-se%3,te=0;te>6,128|63&O):O<55296||O>=57344?A.push(224|O>>12,128|O>>6&63,128|63&O):(P++,O=65536+((1023&O)<<10|1023&y.charCodeAt(P)),A.push(240|O>>18,128|O>>12&63,128|O>>6&63,128|63&O))}return A}(g)},(l=typeof(u=function(){return d})=="function"?u.apply(a,[]):u)===void 0||(o.exports=l)}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var u=n[o]={exports:{}};return r[o](u,u.exports,i),u.exports}i.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return i.d(a,{a}),a},i.d=(o,a)=>{for(var u in a)i.o(a,u)&&!i.o(o,u)&&Object.defineProperty(o,u,{enumerable:!0,get:a[u]})},i.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a);var s={};return(()=>{i.d(s,{default:()=>G});const o=E=>!!E&&typeof E=="object"&&!Array.isArray(E);function a(E,...m){if(!m.length)return E;const f=m.shift();return f!==void 0&&o(E)&&o(f)?(E=Object.assign({},E),Object.keys(f).forEach(p=>{const v=E[p],x=f[p];Array.isArray(v)&&Array.isArray(x)?E[p]=x:o(v)&&o(x)?E[p]=a(Object.assign({},v),x):E[p]=x}),a(E,...m)):E}function u(E,m){const f=document.createElement("a");f.download=m,f.href=E,document.body.appendChild(f),f.click(),document.body.removeChild(f)}const l={L:.07,M:.15,Q:.25,H:.3};class d{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;switch(this._type){case"dots":x=this._drawDot;break;case"classy":x=this._drawClassy;break;case"classy-rounded":x=this._drawClassyRounded;break;case"rounded":x=this._drawRounded;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawSquare}x.call(this,{x:m,y:f,size:p,getNeighbor:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(p+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(p)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_basicSideRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, 0 ${-f}`)}}))}_basicCornerRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}v `+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_basicCornerExtraRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`)}}))}_basicCornersRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${f/2} ${f/2}h `+f/2+"v "+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_drawDot({x:m,y:f,size:p}){this._basicDot({x:m,y:f,size:p,rotation:0})}_drawSquare({x:m,y:f,size:p}){this._basicSquare({x:m,y:f,size:p,rotation:0})}_drawRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:p,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerRounded({x:m,y:f,size:p,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:p,rotation:I})}}else this._basicDot({x:m,y:f,size:p,rotation:0})}_drawExtraRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:p,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:p,rotation:I})}}else this._basicDot({x:m,y:f,size:p,rotation:0})}_drawClassy({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:p,rotation:0}):this._basicCornerRounded({x:m,y:f,size:p,rotation:Math.PI/2}):this._basicCornerRounded({x:m,y:f,size:p,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:p,rotation:Math.PI/2})}_drawClassyRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:p,rotation:0}):this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:p,rotation:Math.PI/2})}}class g{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;switch(this._type){case"square":x=this._drawSquare;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawDot}x.call(this,{x:m,y:f,size:p,rotation:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p+f/2} ${v}a ${f/2} ${f/2} 0 1 0 0.1 0zm 0 ${x}a ${f/2-x} ${f/2-x} 0 1 1 -0.1 0Z`)}}))}_basicSquare(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}v `+-f+`zM ${p+x} ${v+x}h `+(f-2*x)+"v "+(f-2*x)+"h "+(2*x-f)+"z")}}))}_basicExtraRounded(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p} ${v+2.5*x}v `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*x}h `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*-x}v `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*-x}h `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*x}M ${p+2.5*x} ${v+x}h `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*x}v `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*x}h `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*-x}v `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*-x}`)}}))}_drawDot({x:m,y:f,size:p,rotation:v}){this._basicDot({x:m,y:f,size:p,rotation:v})}_drawSquare({x:m,y:f,size:p,rotation:v}){this._basicSquare({x:m,y:f,size:p,rotation:v})}_drawExtraRounded({x:m,y:f,size:p,rotation:v}){this._basicExtraRounded({x:m,y:f,size:p,rotation:v})}}class y{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;x=this._type==="square"?this._drawSquare:this._drawDot,x.call(this,{x:m,y:f,size:p,rotation:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(p+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(p)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_drawDot({x:m,y:f,size:p,rotation:v}){this._basicDot({x:m,y:f,size:p,rotation:v})}_drawSquare({x:m,y:f,size:p,rotation:v}){this._basicSquare({x:m,y:f,size:p,rotation:v})}}const A="circle",P=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],O=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class D{constructor(m,f){this._roundSize=p=>this._options.dotsOptions.roundSize?Math.floor(p):p,this._window=f,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(m.width)),this._element.setAttribute("height",String(m.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),m.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=m.image,this._instanceId=D.instanceCount++,this._options=m}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(m){const f=m.getModuleCount(),p=Math.min(this._options.width,this._options.height)-2*this._options.margin,v=this._options.shape===A?p/Math.sqrt(2):p,x=this._roundSize(v/f);let _={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=m,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:S,qrOptions:b}=this._options,M=S.imageSize*l[b.errorCorrectionLevel],I=Math.floor(M*f*f);_=function({originalHeight:F,originalWidth:ae,maxHiddenDots:N,maxHiddenAxisDots:se,dotSize:ee}){const X={x:0,y:0},Q={x:0,y:0};if(F<=0||ae<=0||N<=0||ee<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const R=F/ae;return X.x=Math.floor(Math.sqrt(N/R)),X.x<=0&&(X.x=1),se&&seN||se&&se{var M,I,F,ae,N,se;return!(this._options.imageOptions.hideBackgroundDots&&S>=(f-_.hideYDots)/2&&S<(f+_.hideYDots)/2&&b>=(f-_.hideXDots)/2&&b<(f+_.hideXDots)/2||!((M=P[S])===null||M===void 0)&&M[b]||!((I=P[S-f+7])===null||I===void 0)&&I[b]||!((F=P[S])===null||F===void 0)&&F[b-f+7]||!((ae=O[S])===null||ae===void 0)&&ae[b]||!((N=O[S-f+7])===null||N===void 0)&&N[b]||!((se=O[S])===null||se===void 0)&&se[b-f+7])}),this.drawCorners(),this._options.image&&await this.drawImage({width:_.width,height:_.height,count:f,dotSize:x})}drawBackground(){var m,f,p;const v=this._element,x=this._options;if(v){const _=(m=x.backgroundOptions)===null||m===void 0?void 0:m.gradient,S=(f=x.backgroundOptions)===null||f===void 0?void 0:f.color;let b=x.height,M=x.width;if(_||S){const I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((p=x.backgroundOptions)===null||p===void 0)&&p.round&&(b=M=Math.min(x.width,x.height),I.setAttribute("rx",String(b/2*x.backgroundOptions.round))),I.setAttribute("x",String(this._roundSize((x.width-M)/2))),I.setAttribute("y",String(this._roundSize((x.height-b)/2))),I.setAttribute("width",String(M)),I.setAttribute("height",String(b)),this._backgroundClipPath.appendChild(I),this._createColor({options:_,color:S,additionalRotation:0,x:0,y:0,height:x.height,width:x.width,name:`background-color-${this._instanceId}`})}}}drawDots(m){var f,p;if(!this._qr)throw"QR code is not defined";const v=this._options,x=this._qr.getModuleCount();if(x>v.width||x>v.height)throw"The canvas is too small.";const _=Math.min(v.width,v.height)-2*v.margin,S=v.shape===A?_/Math.sqrt(2):_,b=this._roundSize(S/x),M=this._roundSize((v.width-x*b)/2),I=this._roundSize((v.height-x*b)/2),F=new d({svg:this._element,type:v.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(f=v.dotsOptions)===null||f===void 0?void 0:f.gradient,color:v.dotsOptions.color,additionalRotation:0,x:0,y:0,height:v.height,width:v.width,name:`dot-color-${this._instanceId}`});for(let ae=0;ae!(N+se<0||ae+ee<0||N+se>=x||ae+ee>=x)&&!(m&&!m(ae+ee,N+se))&&!!this._qr&&this._qr.isDark(ae+ee,N+se)),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element));if(v.shape===A){const ae=this._roundSize((_/b-x)/2),N=x+2*ae,se=M-ae*b,ee=I-ae*b,X=[],Q=this._roundSize(N/2);for(let R=0;R=ae-1&&R<=N-ae&&Z>=ae-1&&Z<=N-ae||Math.sqrt((R-Q)*(R-Q)+(Z-Q)*(Z-Q))>Q?X[R][Z]=0:X[R][Z]=this._qr.isDark(Z-2*ae<0?Z:Z>=x?Z-2*ae:Z-ae,R-2*ae<0?R:R>=x?R-2*ae:R-ae)?1:0}for(let R=0;R{var ie;return!!(!((ie=X[R+he])===null||ie===void 0)&&ie[Z+te])}),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const m=this._element,f=this._options;if(!m)throw"Element code is not defined";const p=this._qr.getModuleCount(),v=Math.min(f.width,f.height)-2*f.margin,x=f.shape===A?v/Math.sqrt(2):v,_=this._roundSize(x/p),S=7*_,b=3*_,M=this._roundSize((f.width-p*_)/2),I=this._roundSize((f.height-p*_)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([F,ae,N])=>{var se,ee,X,Q,R,Z,te,he,ie,fe,ve,Me;const Ne=M+F*_*(p-7),Te=I+ae*_*(p-7);let $e=this._dotsClipPath,Ie=this._dotsClipPath;if((!((se=f.cornersSquareOptions)===null||se===void 0)&&se.gradient||!((ee=f.cornersSquareOptions)===null||ee===void 0)&&ee.color)&&($e=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),$e.setAttribute("id",`clip-path-corners-square-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild($e),this._cornersSquareClipPath=this._cornersDotClipPath=Ie=$e,this._createColor({options:(X=f.cornersSquareOptions)===null||X===void 0?void 0:X.gradient,color:(Q=f.cornersSquareOptions)===null||Q===void 0?void 0:Q.color,additionalRotation:N,x:Ne,y:Te,height:S,width:S,name:`corners-square-color-${F}-${ae}-${this._instanceId}`})),(R=f.cornersSquareOptions)===null||R===void 0?void 0:R.type){const Le=new g({svg:this._element,type:f.cornersSquareOptions.type,window:this._window});Le.draw(Ne,Te,S,N),Le._element&&$e&&$e.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=P[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&$e&&$e.appendChild(Le._element))}if((!((te=f.cornersDotOptions)===null||te===void 0)&&te.gradient||!((he=f.cornersDotOptions)===null||he===void 0)&&he.color)&&(Ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Ie.setAttribute("id",`clip-path-corners-dot-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild(Ie),this._cornersDotClipPath=Ie,this._createColor({options:(ie=f.cornersDotOptions)===null||ie===void 0?void 0:ie.gradient,color:(fe=f.cornersDotOptions)===null||fe===void 0?void 0:fe.color,additionalRotation:N,x:Ne+2*_,y:Te+2*_,height:b,width:b,name:`corners-dot-color-${F}-${ae}-${this._instanceId}`})),(ve=f.cornersDotOptions)===null||ve===void 0?void 0:ve.type){const Le=new y({svg:this._element,type:f.cornersDotOptions.type,window:this._window});Le.draw(Ne+2*_,Te+2*_,b,N),Le._element&&Ie&&Ie.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=O[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&Ie&&Ie.appendChild(Le._element))}})}loadImage(){return new Promise((m,f)=>{var p;const v=this._options;if(!v.image)return f("Image is not defined");if(!((p=v.nodeCanvas)===null||p===void 0)&&p.loadImage)v.nodeCanvas.loadImage(v.image).then(x=>{var _,S;if(this._image=x,this._options.imageOptions.saveAsBlob){const b=(_=v.nodeCanvas)===null||_===void 0?void 0:_.createCanvas(this._image.width,this._image.height);(S=b==null?void 0:b.getContext("2d"))===null||S===void 0||S.drawImage(x,0,0),this._imageUri=b==null?void 0:b.toDataURL()}m()}).catch(f);else{const x=new this._window.Image;typeof v.imageOptions.crossOrigin=="string"&&(x.crossOrigin=v.imageOptions.crossOrigin),this._image=x,x.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await async function(_,S){return new Promise(b=>{const M=new S.XMLHttpRequest;M.onload=function(){const I=new S.FileReader;I.onloadend=function(){b(I.result)},I.readAsDataURL(M.response)},M.open("GET",_),M.responseType="blob",M.send()})}(v.image||"",this._window)),m()},x.src=v.image}})}async drawImage({width:m,height:f,count:p,dotSize:v}){const x=this._options,_=this._roundSize((x.width-p*v)/2),S=this._roundSize((x.height-p*v)/2),b=_+this._roundSize(x.imageOptions.margin+(p*v-m)/2),M=S+this._roundSize(x.imageOptions.margin+(p*v-f)/2),I=m-2*x.imageOptions.margin,F=f-2*x.imageOptions.margin,ae=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");ae.setAttribute("href",this._imageUri||""),ae.setAttribute("x",String(b)),ae.setAttribute("y",String(M)),ae.setAttribute("width",`${I}px`),ae.setAttribute("height",`${F}px`),this._element.appendChild(ae)}_createColor({options:m,color:f,additionalRotation:p,x:v,y:x,height:_,width:S,name:b}){const M=S>_?S:_,I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(I.setAttribute("x",String(v)),I.setAttribute("y",String(x)),I.setAttribute("height",String(_)),I.setAttribute("width",String(S)),I.setAttribute("clip-path",`url('#clip-path-${b}')`),m){let F;if(m.type==="radial")F=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("fx",String(v+S/2)),F.setAttribute("fy",String(x+_/2)),F.setAttribute("cx",String(v+S/2)),F.setAttribute("cy",String(x+_/2)),F.setAttribute("r",String(M/2));else{const ae=((m.rotation||0)+p)%(2*Math.PI),N=(ae+2*Math.PI)%(2*Math.PI);let se=v+S/2,ee=x+_/2,X=v+S/2,Q=x+_/2;N>=0&&N<=.25*Math.PI||N>1.75*Math.PI&&N<=2*Math.PI?(se-=S/2,ee-=_/2*Math.tan(ae),X+=S/2,Q+=_/2*Math.tan(ae)):N>.25*Math.PI&&N<=.75*Math.PI?(ee-=_/2,se-=S/2/Math.tan(ae),Q+=_/2,X+=S/2/Math.tan(ae)):N>.75*Math.PI&&N<=1.25*Math.PI?(se+=S/2,ee+=_/2*Math.tan(ae),X-=S/2,Q-=_/2*Math.tan(ae)):N>1.25*Math.PI&&N<=1.75*Math.PI&&(ee+=_/2,se+=S/2/Math.tan(ae),Q-=_/2,X-=S/2/Math.tan(ae)),F=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("x1",String(Math.round(se))),F.setAttribute("y1",String(Math.round(ee))),F.setAttribute("x2",String(Math.round(X))),F.setAttribute("y2",String(Math.round(Q)))}m.colorStops.forEach(({offset:ae,color:N})=>{const se=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");se.setAttribute("offset",100*ae+"%"),se.setAttribute("stop-color",N),F.appendChild(se)}),I.setAttribute("fill",`url('#${b}')`),this._defs.appendChild(F)}else f&&I.setAttribute("fill",f);this._element.appendChild(I)}}D.instanceCount=0;const k=D,B="canvas",j={};for(let E=0;E<=40;E++)j[E]=E;const U={type:B,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:j[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function K(E){const m=Object.assign({},E);if(!m.colorStops||!m.colorStops.length)throw"Field 'colorStops' is required in gradient";return m.rotation?m.rotation=Number(m.rotation):m.rotation=0,m.colorStops=m.colorStops.map(f=>Object.assign(Object.assign({},f),{offset:Number(f.offset)})),m}function J(E){const m=Object.assign({},E);return m.width=Number(m.width),m.height=Number(m.height),m.margin=Number(m.margin),m.imageOptions=Object.assign(Object.assign({},m.imageOptions),{hideBackgroundDots:!!m.imageOptions.hideBackgroundDots,imageSize:Number(m.imageOptions.imageSize),margin:Number(m.imageOptions.margin)}),m.margin>Math.min(m.width,m.height)&&(m.margin=Math.min(m.width,m.height)),m.dotsOptions=Object.assign({},m.dotsOptions),m.dotsOptions.gradient&&(m.dotsOptions.gradient=K(m.dotsOptions.gradient)),m.cornersSquareOptions&&(m.cornersSquareOptions=Object.assign({},m.cornersSquareOptions),m.cornersSquareOptions.gradient&&(m.cornersSquareOptions.gradient=K(m.cornersSquareOptions.gradient))),m.cornersDotOptions&&(m.cornersDotOptions=Object.assign({},m.cornersDotOptions),m.cornersDotOptions.gradient&&(m.cornersDotOptions.gradient=K(m.cornersDotOptions.gradient))),m.backgroundOptions&&(m.backgroundOptions=Object.assign({},m.backgroundOptions),m.backgroundOptions.gradient&&(m.backgroundOptions.gradient=K(m.backgroundOptions.gradient))),m}var T=i(873),z=i.n(T);function ue(E){if(!E)throw new Error("Extension must be defined");E[0]==="."&&(E=E.substring(1));const m={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[E.toLowerCase()];if(!m)throw new Error(`Extension "${E}" is not supported`);return m}class _e{constructor(m){m!=null&&m.jsdom?this._window=new m.jsdom("",{resources:"usable"}).window:this._window=window,this._options=m?J(a(U,m)):U,this.update()}static _clearContainer(m){m&&(m.innerHTML="")}_setupSvg(){if(!this._qr)return;const m=new k(this._options,this._window);this._svg=m.getElement(),this._svgDrawingPromise=m.drawQR(this._qr).then(()=>{var f;this._svg&&((f=this._extension)===null||f===void 0||f.call(this,m.getElement(),this._options))})}_setupCanvas(){var m,f;this._qr&&(!((m=this._options.nodeCanvas)===null||m===void 0)&&m.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(f=this._svgDrawingPromise)===null||f===void 0?void 0:f.then(()=>{var p;if(!this._svg)return;const v=this._svg,x=new this._window.XMLSerializer().serializeToString(v),_=btoa(x),S=`data:${ue("svg")};base64,${_}`;if(!((p=this._options.nodeCanvas)===null||p===void 0)&&p.loadImage)return this._options.nodeCanvas.loadImage(S).then(b=>{var M,I;b.width=this._options.width,b.height=this._options.height,(I=(M=this._nodeCanvas)===null||M===void 0?void 0:M.getContext("2d"))===null||I===void 0||I.drawImage(b,0,0)});{const b=new this._window.Image;return new Promise(M=>{b.onload=()=>{var I,F;(F=(I=this._domCanvas)===null||I===void 0?void 0:I.getContext("2d"))===null||F===void 0||F.drawImage(b,0,0),M()},b.src=S})}}))}async _getElement(m="png"){if(!this._qr)throw"QR code is empty";return m.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(m){_e._clearContainer(this._container),this._options=m?J(a(this._options,m)):this._options,this._options.data&&(this._qr=z()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(f){switch(!0){case/^[0-9]*$/.test(f):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(f):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===B?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(m){if(m){if(typeof m.appendChild!="function")throw"Container should be a single DOM node";this._options.type===B?this._domCanvas&&m.appendChild(this._domCanvas):this._svg&&m.appendChild(this._svg),this._container=m}}applyExtension(m){if(!m)throw"Extension function should be defined.";this._extension=m,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(m="png"){if(!this._qr)throw"QR code is empty";const f=await this._getElement(m),p=ue(m);if(!f)return null;if(m.toLowerCase()==="svg"){const v=`\r +}`;const b7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>ge.jsx(v7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));b7.displayName="InputOTP";const y7=Yt.forwardRef(({className:t,...e},r)=>ge.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));y7.displayName="InputOTPGroup";const Ac=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(m7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return ge.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&ge.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:ge.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Ac.displayName="InputOTPSlot";function cZ(t){const{spinning:e,children:r,className:n}=t;return ge.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&ge.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:ge.jsx(vc,{className:"xc-animate-spin"})})]})}function w7(t){const{email:e}=t,[r,n]=Se.useState(0),[i,s]=Se.useState(!1),[o,a]=Se.useState(""),u=Se.useRef(null);async function l(){n(60);const g=setInterval(()=>{n(y=>y===0?(clearInterval(g),0):y-1)},1e3)}async function d(g){if(a(""),!(g.length<6)){s(!0);try{await t.onInputCode(e,g)}catch(y){a(y.message)}s(!1)}}return Se.useEffect(()=>{l()},[]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(FK,{className:"xc-mb-4",size:60}),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:[ge.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),ge.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]}),ge.jsx("div",{className:"xc-mb-2 xc-h-12",children:ge.jsx(cZ,{spinning:i,className:"xc-rounded-xl",children:ge.jsx(b7,{maxLength:6,onChange:d,disabled:i,className:"disabled:xc-opacity-20",children:ge.jsx(y7,{children:ge.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[ge.jsx(Ac,{index:0}),ge.jsx(Ac,{index:1}),ge.jsx(Ac,{index:2}),ge.jsx(Ac,{index:3}),ge.jsx(Ac,{index:4}),ge.jsx(Ac,{index:5})]})})})})}),o&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:o})})]}),ge.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Recend in ${r}s`:ge.jsx("button",{id:"sendCodeButton",ref:u,children:"Send again"})]}),ge.jsx("div",{id:"captcha-element"})]})}function x7(t){const{email:e}=t,[r,n]=Se.useState(!1),[i,s]=Se.useState(""),o=Se.useMemo(()=>`xn-btn-${new Date().getTime()}`,[e]);async function a(y,A){n(!0);try{s(""),await va.getEmailCode({account_type:"email",email:y},A)}catch(P){s(P.message)}n(!1)}async function u(y){try{return await a(e,JSON.stringify(y)),{captchaResult:!0,bizResult:!0}}catch(A){return s(A.message),{captchaResult:!1,bizResult:!1}}}async function l(y){y&&t.onCodeSend()}const d=Se.useRef();function g(y){d.current=y}return Se.useEffect(()=>{if(e)return window.initAliyunCaptcha({SceneId:"tqyu8129d",prefix:"1mfsn5f",mode:"popup",element:"#captcha-element",button:`#${o}`,captchaVerifyCallback:u,onBizResultCallback:l,getInstance:g,slideStyle:{width:360,height:40},language:"en",region:"cn"}),()=>{var y,A;(y=document.getElementById("aliyunCaptcha-mask"))==null||y.remove(),(A=document.getElementById("aliyunCaptcha-window-popup"))==null||A.remove()}},[e]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(jK,{className:"xc-mb-4",size:60}),ge.jsx("button",{className:"xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2",id:o,children:r?ge.jsx(vc,{className:"xc-animate-spin"}):"I'm not a robot"})]}),i&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:i})})]})}function uZ(t){const{email:e}=t,r=Mb(),[n,i]=Se.useState("captcha");async function s(o,a){const u=await va.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:a,email:o,inviter_code:r.inviterCode,source:{device:r.device,channel:r.channel,app:r.app}});t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),n==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>i("verify-email")}),n==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:s,onResendCode:()=>i("captcha")})]})}var _7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var g=function(f,p){var v=f,x=k[p],_=null,S=0,b=null,M=[],I={},F=function(te,le){_=function(ie){for(var fe=new Array(ie),ve=0;ve=7&&ee(te),b==null&&(b=R(v,x,M)),Q(b,le)},ae=function(te,le){for(var ie=-1;ie<=7;ie+=1)if(!(te+ie<=-1||S<=te+ie))for(var fe=-1;fe<=7;fe+=1)le+fe<=-1||S<=le+fe||(_[te+ie][le+fe]=0<=ie&&ie<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(ie==0||ie==6)||2<=ie&&ie<=4&&2<=fe&&fe<=4)},O=function(){for(var te=8;te>ie&1)==1;_[Math.floor(ie/3)][ie%3+S-8-3]=fe}for(ie=0;ie<18;ie+=1)fe=!te&&(le>>ie&1)==1,_[ie%3+S-8-3][Math.floor(ie/3)]=fe},X=function(te,le){for(var ie=x<<3|le,fe=B.getBCHTypeInfo(ie),ve=0;ve<15;ve+=1){var Me=!te&&(fe>>ve&1)==1;ve<6?_[ve][8]=Me:ve<8?_[ve+1][8]=Me:_[S-15+ve][8]=Me}for(ve=0;ve<15;ve+=1)Me=!te&&(fe>>ve&1)==1,ve<8?_[8][S-ve-1]=Me:ve<9?_[8][15-ve-1+1]=Me:_[8][15-ve-1]=Me;_[S-8][8]=!te},Q=function(te,le){for(var ie=-1,fe=S-1,ve=7,Me=0,Ne=B.getMaskFunction(le),Te=S-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var $e=0;$e<2;$e+=1)if(_[fe][Te-$e]==null){var Ie=!1;Me>>ve&1)==1),Ne(fe,Te-$e)&&(Ie=!Ie),_[fe][Te-$e]=Ie,(ve-=1)==-1&&(Me+=1,ve=7)}if((fe+=ie)<0||S<=fe){fe-=ie,ie=-ie;break}}},R=function(te,le,ie){for(var fe=K.getRSBlocks(te,le),ve=J(),Me=0;Me8*Te)throw"code length overflow. ("+ve.getLengthInBits()+">"+8*Te+")";for(ve.getLengthInBits()+4<=8*Te&&ve.put(0,4);ve.getLengthInBits()%8!=0;)ve.putBit(!1);for(;!(ve.getLengthInBits()>=8*Te||(ve.put(236,8),ve.getLengthInBits()>=8*Te));)ve.put(17,8);return function($e,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Ee=0;Ee=0?rt.getAt(Je):0}}var pt=0;for(Be=0;BeIe)&&(Ne=Ie,Te=$e)}return Te}())},I.createTableTag=function(te,le){te=te||2;var ie="";ie+='";for(var ve=0;ve';ie+=""}return(ie+="")+"
"},I.createSvgTag=function(te,le,ie,fe){var ve={};typeof arguments[0]=="object"&&(te=(ve=arguments[0]).cellSize,le=ve.margin,ie=ve.alt,fe=ve.title),te=te||2,le=le===void 0?4*te:le,(ie=typeof ie=="string"?{text:ie}:ie||{}).text=ie.text||null,ie.id=ie.text?ie.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*te+2*le,Le="";for($e="l"+te+",0 0,"+te+" -"+te+",0 0,-"+te+"z ",Le+=''+Z(fe.text)+"":"",Le+=ie.text?''+Z(ie.text)+"":"",Le+='',Le+='"},I.createDataURL=function(te,le){te=te||2,le=le===void 0?4*te:le;var ie=I.getModuleCount()*te+2*le,fe=le,ve=ie-le;return m(ie,ie,function(Me,Ne){if(fe<=Me&&Me"};var Z=function(te){for(var le="",ie=0;ie":le+=">";break;case"&":le+="&";break;case'"':le+=""";break;default:le+=fe}}return le};return I.createASCII=function(te,le){if((te=te||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Ee,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:pt[Be];ft+=` +`}return et%2&&ze>0?ft.substring(0,ft.length-et-1)+Array(et+1).join("▀"):ft.substring(0,ft.length-1)}(le);te-=1,le=le===void 0?2*te:le;var ie,fe,ve,Me,Ne=I.getModuleCount()*te+2*le,Te=le,$e=Ne-le,Ie=Array(te+1).join("██"),Le=Array(te+1).join(" "),Ve="",ke="";for(ie=0;ie>>8),S.push(255&I)):S.push(x)}}return S}};var y,A,P,N,D,k={L:1,M:0,Q:3,H:2},B=(y=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],A=1335,P=7973,D=function(f){for(var p=0;f!=0;)p+=1,f>>>=1;return p},(N={}).getBCHTypeInfo=function(f){for(var p=f<<10;D(p)-D(A)>=0;)p^=A<=0;)p^=P<5&&(v+=3+S-5)}for(x=0;x=256;)x-=255;return f[x]}}}();function U(f,p){if(f.length===void 0)throw f.length+"/"+p;var v=function(){for(var _=0;_>>7-x%8&1)==1},put:function(x,_){for(var S=0;S<_;S+=1)v.putBit((x>>>_-S-1&1)==1)},getLengthInBits:function(){return p},putBit:function(x){var _=Math.floor(p/8);f.length<=_&&f.push(0),x&&(f[_]|=128>>>p%8),p+=1}};return v},T=function(f){var p=f,v={getMode:function(){return 1},getLength:function(S){return p.length},write:function(S){for(var b=p,M=0;M+2>>8&255)+(255&M),_.put(M,13),b+=2}if(b>>8)},writeBytes:function(v,x,_){x=x||0,_=_||v.length;for(var S=0;S<_;S+=1)p.writeByte(v[S+x])},writeString:function(v){for(var x=0;x0&&(v+=","),v+=f[x];return v+"]"}};return p},E=function(f){var p=f,v=0,x=0,_=0,S={read:function(){for(;_<8;){if(v>=p.length){if(_==0)return-1;throw"unexpected end of file./"+_}var M=p.charAt(v);if(v+=1,M=="=")return _=0,-1;M.match(/^\s$/)||(x=x<<6|b(M.charCodeAt(0)),_+=6)}var I=x>>>_-8&255;return _-=8,I}},b=function(M){if(65<=M&&M<=90)return M-65;if(97<=M&&M<=122)return M-97+26;if(48<=M&&M<=57)return M-48+52;if(M==43)return 62;if(M==47)return 63;throw"c:"+M};return S},m=function(f,p,v){for(var x=function(ae,O){var se=ae,ee=O,X=new Array(ae*O),Q={setPixel:function(te,le,ie){X[le*se+te]=ie},write:function(te){te.writeString("GIF87a"),te.writeShort(se),te.writeShort(ee),te.writeByte(128),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(255),te.writeByte(255),te.writeByte(255),te.writeString(","),te.writeShort(0),te.writeShort(0),te.writeShort(se),te.writeShort(ee),te.writeByte(0);var le=R(2);te.writeByte(2);for(var ie=0;le.length-ie>255;)te.writeByte(255),te.writeBytes(le,ie,255),ie+=255;te.writeByte(le.length-ie),te.writeBytes(le,ie,le.length-ie),te.writeByte(0),te.writeString(";")}},R=function(te){for(var le=1<>>Ee)throw"length over";for(;Te+Ee>=8;)Ne.writeByte(255&(He<>>=8-Te,$e=0,Te=0;$e|=He<0&&Ne.writeByte($e)}});Le.write(le,fe);var Ve=0,ke=String.fromCharCode(X[Ve]);for(Ve+=1;Ve=6;)Q(ae>>>O-6),O-=6},X.flush=function(){if(O>0&&(Q(ae<<6-O),ae=0,O=0),se%3!=0)for(var Z=3-se%3,te=0;te>6,128|63&N):N<55296||N>=57344?A.push(224|N>>12,128|N>>6&63,128|63&N):(P++,N=65536+((1023&N)<<10|1023&y.charCodeAt(P)),A.push(240|N>>18,128|N>>12&63,128|N>>6&63,128|63&N))}return A}(g)},(l=typeof(u=function(){return d})=="function"?u.apply(a,[]):u)===void 0||(o.exports=l)}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var u=n[o]={exports:{}};return r[o](u,u.exports,i),u.exports}i.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return i.d(a,{a}),a},i.d=(o,a)=>{for(var u in a)i.o(a,u)&&!i.o(o,u)&&Object.defineProperty(o,u,{enumerable:!0,get:a[u]})},i.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a);var s={};return(()=>{i.d(s,{default:()=>G});const o=E=>!!E&&typeof E=="object"&&!Array.isArray(E);function a(E,...m){if(!m.length)return E;const f=m.shift();return f!==void 0&&o(E)&&o(f)?(E=Object.assign({},E),Object.keys(f).forEach(p=>{const v=E[p],x=f[p];Array.isArray(v)&&Array.isArray(x)?E[p]=x:o(v)&&o(x)?E[p]=a(Object.assign({},v),x):E[p]=x}),a(E,...m)):E}function u(E,m){const f=document.createElement("a");f.download=m,f.href=E,document.body.appendChild(f),f.click(),document.body.removeChild(f)}const l={L:.07,M:.15,Q:.25,H:.3};class d{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;switch(this._type){case"dots":x=this._drawDot;break;case"classy":x=this._drawClassy;break;case"classy-rounded":x=this._drawClassyRounded;break;case"rounded":x=this._drawRounded;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawSquare}x.call(this,{x:m,y:f,size:p,getNeighbor:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(p+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(p)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_basicSideRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, 0 ${-f}`)}}))}_basicCornerRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}v `+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_basicCornerExtraRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`)}}))}_basicCornersRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${f/2} ${f/2}h `+f/2+"v "+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_drawDot({x:m,y:f,size:p}){this._basicDot({x:m,y:f,size:p,rotation:0})}_drawSquare({x:m,y:f,size:p}){this._basicSquare({x:m,y:f,size:p,rotation:0})}_drawRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:p,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerRounded({x:m,y:f,size:p,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:p,rotation:I})}}else this._basicDot({x:m,y:f,size:p,rotation:0})}_drawExtraRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:p,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:p,rotation:I})}}else this._basicDot({x:m,y:f,size:p,rotation:0})}_drawClassy({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:p,rotation:0}):this._basicCornerRounded({x:m,y:f,size:p,rotation:Math.PI/2}):this._basicCornerRounded({x:m,y:f,size:p,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:p,rotation:Math.PI/2})}_drawClassyRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:p,rotation:0}):this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:p,rotation:Math.PI/2})}}class g{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;switch(this._type){case"square":x=this._drawSquare;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawDot}x.call(this,{x:m,y:f,size:p,rotation:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p+f/2} ${v}a ${f/2} ${f/2} 0 1 0 0.1 0zm 0 ${x}a ${f/2-x} ${f/2-x} 0 1 1 -0.1 0Z`)}}))}_basicSquare(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}v `+-f+`zM ${p+x} ${v+x}h `+(f-2*x)+"v "+(f-2*x)+"h "+(2*x-f)+"z")}}))}_basicExtraRounded(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p} ${v+2.5*x}v `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*x}h `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*-x}v `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*-x}h `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*x}M ${p+2.5*x} ${v+x}h `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*x}v `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*x}h `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*-x}v `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*-x}`)}}))}_drawDot({x:m,y:f,size:p,rotation:v}){this._basicDot({x:m,y:f,size:p,rotation:v})}_drawSquare({x:m,y:f,size:p,rotation:v}){this._basicSquare({x:m,y:f,size:p,rotation:v})}_drawExtraRounded({x:m,y:f,size:p,rotation:v}){this._basicExtraRounded({x:m,y:f,size:p,rotation:v})}}class y{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;x=this._type==="square"?this._drawSquare:this._drawDot,x.call(this,{x:m,y:f,size:p,rotation:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(p+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(p)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_drawDot({x:m,y:f,size:p,rotation:v}){this._basicDot({x:m,y:f,size:p,rotation:v})}_drawSquare({x:m,y:f,size:p,rotation:v}){this._basicSquare({x:m,y:f,size:p,rotation:v})}}const A="circle",P=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],N=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class D{constructor(m,f){this._roundSize=p=>this._options.dotsOptions.roundSize?Math.floor(p):p,this._window=f,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(m.width)),this._element.setAttribute("height",String(m.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),m.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=m.image,this._instanceId=D.instanceCount++,this._options=m}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(m){const f=m.getModuleCount(),p=Math.min(this._options.width,this._options.height)-2*this._options.margin,v=this._options.shape===A?p/Math.sqrt(2):p,x=this._roundSize(v/f);let _={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=m,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:S,qrOptions:b}=this._options,M=S.imageSize*l[b.errorCorrectionLevel],I=Math.floor(M*f*f);_=function({originalHeight:F,originalWidth:ae,maxHiddenDots:O,maxHiddenAxisDots:se,dotSize:ee}){const X={x:0,y:0},Q={x:0,y:0};if(F<=0||ae<=0||O<=0||ee<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const R=F/ae;return X.x=Math.floor(Math.sqrt(O/R)),X.x<=0&&(X.x=1),se&&seO||se&&se{var M,I,F,ae,O,se;return!(this._options.imageOptions.hideBackgroundDots&&S>=(f-_.hideYDots)/2&&S<(f+_.hideYDots)/2&&b>=(f-_.hideXDots)/2&&b<(f+_.hideXDots)/2||!((M=P[S])===null||M===void 0)&&M[b]||!((I=P[S-f+7])===null||I===void 0)&&I[b]||!((F=P[S])===null||F===void 0)&&F[b-f+7]||!((ae=N[S])===null||ae===void 0)&&ae[b]||!((O=N[S-f+7])===null||O===void 0)&&O[b]||!((se=N[S])===null||se===void 0)&&se[b-f+7])}),this.drawCorners(),this._options.image&&await this.drawImage({width:_.width,height:_.height,count:f,dotSize:x})}drawBackground(){var m,f,p;const v=this._element,x=this._options;if(v){const _=(m=x.backgroundOptions)===null||m===void 0?void 0:m.gradient,S=(f=x.backgroundOptions)===null||f===void 0?void 0:f.color;let b=x.height,M=x.width;if(_||S){const I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((p=x.backgroundOptions)===null||p===void 0)&&p.round&&(b=M=Math.min(x.width,x.height),I.setAttribute("rx",String(b/2*x.backgroundOptions.round))),I.setAttribute("x",String(this._roundSize((x.width-M)/2))),I.setAttribute("y",String(this._roundSize((x.height-b)/2))),I.setAttribute("width",String(M)),I.setAttribute("height",String(b)),this._backgroundClipPath.appendChild(I),this._createColor({options:_,color:S,additionalRotation:0,x:0,y:0,height:x.height,width:x.width,name:`background-color-${this._instanceId}`})}}}drawDots(m){var f,p;if(!this._qr)throw"QR code is not defined";const v=this._options,x=this._qr.getModuleCount();if(x>v.width||x>v.height)throw"The canvas is too small.";const _=Math.min(v.width,v.height)-2*v.margin,S=v.shape===A?_/Math.sqrt(2):_,b=this._roundSize(S/x),M=this._roundSize((v.width-x*b)/2),I=this._roundSize((v.height-x*b)/2),F=new d({svg:this._element,type:v.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(f=v.dotsOptions)===null||f===void 0?void 0:f.gradient,color:v.dotsOptions.color,additionalRotation:0,x:0,y:0,height:v.height,width:v.width,name:`dot-color-${this._instanceId}`});for(let ae=0;ae!(O+se<0||ae+ee<0||O+se>=x||ae+ee>=x)&&!(m&&!m(ae+ee,O+se))&&!!this._qr&&this._qr.isDark(ae+ee,O+se)),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element));if(v.shape===A){const ae=this._roundSize((_/b-x)/2),O=x+2*ae,se=M-ae*b,ee=I-ae*b,X=[],Q=this._roundSize(O/2);for(let R=0;R=ae-1&&R<=O-ae&&Z>=ae-1&&Z<=O-ae||Math.sqrt((R-Q)*(R-Q)+(Z-Q)*(Z-Q))>Q?X[R][Z]=0:X[R][Z]=this._qr.isDark(Z-2*ae<0?Z:Z>=x?Z-2*ae:Z-ae,R-2*ae<0?R:R>=x?R-2*ae:R-ae)?1:0}for(let R=0;R{var ie;return!!(!((ie=X[R+le])===null||ie===void 0)&&ie[Z+te])}),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const m=this._element,f=this._options;if(!m)throw"Element code is not defined";const p=this._qr.getModuleCount(),v=Math.min(f.width,f.height)-2*f.margin,x=f.shape===A?v/Math.sqrt(2):v,_=this._roundSize(x/p),S=7*_,b=3*_,M=this._roundSize((f.width-p*_)/2),I=this._roundSize((f.height-p*_)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([F,ae,O])=>{var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me;const Ne=M+F*_*(p-7),Te=I+ae*_*(p-7);let $e=this._dotsClipPath,Ie=this._dotsClipPath;if((!((se=f.cornersSquareOptions)===null||se===void 0)&&se.gradient||!((ee=f.cornersSquareOptions)===null||ee===void 0)&&ee.color)&&($e=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),$e.setAttribute("id",`clip-path-corners-square-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild($e),this._cornersSquareClipPath=this._cornersDotClipPath=Ie=$e,this._createColor({options:(X=f.cornersSquareOptions)===null||X===void 0?void 0:X.gradient,color:(Q=f.cornersSquareOptions)===null||Q===void 0?void 0:Q.color,additionalRotation:O,x:Ne,y:Te,height:S,width:S,name:`corners-square-color-${F}-${ae}-${this._instanceId}`})),(R=f.cornersSquareOptions)===null||R===void 0?void 0:R.type){const Le=new g({svg:this._element,type:f.cornersSquareOptions.type,window:this._window});Le.draw(Ne,Te,S,O),Le._element&&$e&&$e.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=P[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&$e&&$e.appendChild(Le._element))}if((!((te=f.cornersDotOptions)===null||te===void 0)&&te.gradient||!((le=f.cornersDotOptions)===null||le===void 0)&&le.color)&&(Ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Ie.setAttribute("id",`clip-path-corners-dot-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild(Ie),this._cornersDotClipPath=Ie,this._createColor({options:(ie=f.cornersDotOptions)===null||ie===void 0?void 0:ie.gradient,color:(fe=f.cornersDotOptions)===null||fe===void 0?void 0:fe.color,additionalRotation:O,x:Ne+2*_,y:Te+2*_,height:b,width:b,name:`corners-dot-color-${F}-${ae}-${this._instanceId}`})),(ve=f.cornersDotOptions)===null||ve===void 0?void 0:ve.type){const Le=new y({svg:this._element,type:f.cornersDotOptions.type,window:this._window});Le.draw(Ne+2*_,Te+2*_,b,O),Le._element&&Ie&&Ie.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=N[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&Ie&&Ie.appendChild(Le._element))}})}loadImage(){return new Promise((m,f)=>{var p;const v=this._options;if(!v.image)return f("Image is not defined");if(!((p=v.nodeCanvas)===null||p===void 0)&&p.loadImage)v.nodeCanvas.loadImage(v.image).then(x=>{var _,S;if(this._image=x,this._options.imageOptions.saveAsBlob){const b=(_=v.nodeCanvas)===null||_===void 0?void 0:_.createCanvas(this._image.width,this._image.height);(S=b==null?void 0:b.getContext("2d"))===null||S===void 0||S.drawImage(x,0,0),this._imageUri=b==null?void 0:b.toDataURL()}m()}).catch(f);else{const x=new this._window.Image;typeof v.imageOptions.crossOrigin=="string"&&(x.crossOrigin=v.imageOptions.crossOrigin),this._image=x,x.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await async function(_,S){return new Promise(b=>{const M=new S.XMLHttpRequest;M.onload=function(){const I=new S.FileReader;I.onloadend=function(){b(I.result)},I.readAsDataURL(M.response)},M.open("GET",_),M.responseType="blob",M.send()})}(v.image||"",this._window)),m()},x.src=v.image}})}async drawImage({width:m,height:f,count:p,dotSize:v}){const x=this._options,_=this._roundSize((x.width-p*v)/2),S=this._roundSize((x.height-p*v)/2),b=_+this._roundSize(x.imageOptions.margin+(p*v-m)/2),M=S+this._roundSize(x.imageOptions.margin+(p*v-f)/2),I=m-2*x.imageOptions.margin,F=f-2*x.imageOptions.margin,ae=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");ae.setAttribute("href",this._imageUri||""),ae.setAttribute("x",String(b)),ae.setAttribute("y",String(M)),ae.setAttribute("width",`${I}px`),ae.setAttribute("height",`${F}px`),this._element.appendChild(ae)}_createColor({options:m,color:f,additionalRotation:p,x:v,y:x,height:_,width:S,name:b}){const M=S>_?S:_,I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(I.setAttribute("x",String(v)),I.setAttribute("y",String(x)),I.setAttribute("height",String(_)),I.setAttribute("width",String(S)),I.setAttribute("clip-path",`url('#clip-path-${b}')`),m){let F;if(m.type==="radial")F=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("fx",String(v+S/2)),F.setAttribute("fy",String(x+_/2)),F.setAttribute("cx",String(v+S/2)),F.setAttribute("cy",String(x+_/2)),F.setAttribute("r",String(M/2));else{const ae=((m.rotation||0)+p)%(2*Math.PI),O=(ae+2*Math.PI)%(2*Math.PI);let se=v+S/2,ee=x+_/2,X=v+S/2,Q=x+_/2;O>=0&&O<=.25*Math.PI||O>1.75*Math.PI&&O<=2*Math.PI?(se-=S/2,ee-=_/2*Math.tan(ae),X+=S/2,Q+=_/2*Math.tan(ae)):O>.25*Math.PI&&O<=.75*Math.PI?(ee-=_/2,se-=S/2/Math.tan(ae),Q+=_/2,X+=S/2/Math.tan(ae)):O>.75*Math.PI&&O<=1.25*Math.PI?(se+=S/2,ee+=_/2*Math.tan(ae),X-=S/2,Q-=_/2*Math.tan(ae)):O>1.25*Math.PI&&O<=1.75*Math.PI&&(ee+=_/2,se+=S/2/Math.tan(ae),Q-=_/2,X-=S/2/Math.tan(ae)),F=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("x1",String(Math.round(se))),F.setAttribute("y1",String(Math.round(ee))),F.setAttribute("x2",String(Math.round(X))),F.setAttribute("y2",String(Math.round(Q)))}m.colorStops.forEach(({offset:ae,color:O})=>{const se=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");se.setAttribute("offset",100*ae+"%"),se.setAttribute("stop-color",O),F.appendChild(se)}),I.setAttribute("fill",`url('#${b}')`),this._defs.appendChild(F)}else f&&I.setAttribute("fill",f);this._element.appendChild(I)}}D.instanceCount=0;const k=D,B="canvas",j={};for(let E=0;E<=40;E++)j[E]=E;const U={type:B,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:j[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function K(E){const m=Object.assign({},E);if(!m.colorStops||!m.colorStops.length)throw"Field 'colorStops' is required in gradient";return m.rotation?m.rotation=Number(m.rotation):m.rotation=0,m.colorStops=m.colorStops.map(f=>Object.assign(Object.assign({},f),{offset:Number(f.offset)})),m}function J(E){const m=Object.assign({},E);return m.width=Number(m.width),m.height=Number(m.height),m.margin=Number(m.margin),m.imageOptions=Object.assign(Object.assign({},m.imageOptions),{hideBackgroundDots:!!m.imageOptions.hideBackgroundDots,imageSize:Number(m.imageOptions.imageSize),margin:Number(m.imageOptions.margin)}),m.margin>Math.min(m.width,m.height)&&(m.margin=Math.min(m.width,m.height)),m.dotsOptions=Object.assign({},m.dotsOptions),m.dotsOptions.gradient&&(m.dotsOptions.gradient=K(m.dotsOptions.gradient)),m.cornersSquareOptions&&(m.cornersSquareOptions=Object.assign({},m.cornersSquareOptions),m.cornersSquareOptions.gradient&&(m.cornersSquareOptions.gradient=K(m.cornersSquareOptions.gradient))),m.cornersDotOptions&&(m.cornersDotOptions=Object.assign({},m.cornersDotOptions),m.cornersDotOptions.gradient&&(m.cornersDotOptions.gradient=K(m.cornersDotOptions.gradient))),m.backgroundOptions&&(m.backgroundOptions=Object.assign({},m.backgroundOptions),m.backgroundOptions.gradient&&(m.backgroundOptions.gradient=K(m.backgroundOptions.gradient))),m}var T=i(873),z=i.n(T);function ue(E){if(!E)throw new Error("Extension must be defined");E[0]==="."&&(E=E.substring(1));const m={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[E.toLowerCase()];if(!m)throw new Error(`Extension "${E}" is not supported`);return m}class _e{constructor(m){m!=null&&m.jsdom?this._window=new m.jsdom("",{resources:"usable"}).window:this._window=window,this._options=m?J(a(U,m)):U,this.update()}static _clearContainer(m){m&&(m.innerHTML="")}_setupSvg(){if(!this._qr)return;const m=new k(this._options,this._window);this._svg=m.getElement(),this._svgDrawingPromise=m.drawQR(this._qr).then(()=>{var f;this._svg&&((f=this._extension)===null||f===void 0||f.call(this,m.getElement(),this._options))})}_setupCanvas(){var m,f;this._qr&&(!((m=this._options.nodeCanvas)===null||m===void 0)&&m.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(f=this._svgDrawingPromise)===null||f===void 0?void 0:f.then(()=>{var p;if(!this._svg)return;const v=this._svg,x=new this._window.XMLSerializer().serializeToString(v),_=btoa(x),S=`data:${ue("svg")};base64,${_}`;if(!((p=this._options.nodeCanvas)===null||p===void 0)&&p.loadImage)return this._options.nodeCanvas.loadImage(S).then(b=>{var M,I;b.width=this._options.width,b.height=this._options.height,(I=(M=this._nodeCanvas)===null||M===void 0?void 0:M.getContext("2d"))===null||I===void 0||I.drawImage(b,0,0)});{const b=new this._window.Image;return new Promise(M=>{b.onload=()=>{var I,F;(F=(I=this._domCanvas)===null||I===void 0?void 0:I.getContext("2d"))===null||F===void 0||F.drawImage(b,0,0),M()},b.src=S})}}))}async _getElement(m="png"){if(!this._qr)throw"QR code is empty";return m.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(m){_e._clearContainer(this._container),this._options=m?J(a(this._options,m)):this._options,this._options.data&&(this._qr=z()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(f){switch(!0){case/^[0-9]*$/.test(f):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(f):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===B?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(m){if(m){if(typeof m.appendChild!="function")throw"Container should be a single DOM node";this._options.type===B?this._domCanvas&&m.appendChild(this._domCanvas):this._svg&&m.appendChild(this._svg),this._container=m}}applyExtension(m){if(!m)throw"Extension function should be defined.";this._extension=m,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(m="png"){if(!this._qr)throw"QR code is empty";const f=await this._getElement(m),p=ue(m);if(!f)return null;if(m.toLowerCase()==="svg"){const v=`\r ${new this._window.XMLSerializer().serializeToString(f)}`;return typeof Blob>"u"||this._options.jsdom?Buffer.from(v):new Blob([v],{type:p})}return new Promise(v=>{const x=f;if("toBuffer"in x)if(p==="image/png")v(x.toBuffer(p));else if(p==="image/jpeg")v(x.toBuffer(p));else{if(p!=="application/pdf")throw Error("Unsupported extension");v(x.toBuffer(p))}else"toBlob"in x&&x.toBlob(v,p,1)})}async download(m){if(!this._qr)throw"QR code is empty";if(typeof Blob>"u")throw"Cannot download in Node.js, call getRawData instead.";let f="png",p="qr";typeof m=="string"?(f=m,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):typeof m=="object"&&m!==null&&(m.name&&(p=m.name),m.extension&&(f=m.extension));const v=await this._getElement(f);if(v)if(f.toLowerCase()==="svg"){let x=new XMLSerializer().serializeToString(v);x=`\r -`+x,u(`data:${ue(f)};charset=utf-8,${encodeURIComponent(x)}`,`${p}.svg`)}else u(v.toDataURL(ue(f)),`${p}.${f}`)}}const G=_e})(),s.default})())})(x7);var oZ=x7.exports;const _7=Ui(oZ);class Ma extends yt{constructor(e){const{docsPath:r,field:n,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${n}".`,{docsPath:r,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}function E7(t){if(/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t)||/%[^0-9a-f]/i.test(t)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(t))return!1;const e=aZ(t),r=e[1],n=e[2],i=e[3],s=e[4],o=e[5];if(!(r!=null&&r.length&&i.length>=0))return!1;if(n!=null&&n.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9\+\-\.]*$/.test(r.toLowerCase()))return!1;let a="";return a+=`${r}:`,n!=null&&n.length&&(a+=`//${n}`),a+=i,s!=null&&s.length&&(a+=`?${s}`),o!=null&&o.length&&(a+=`#${o}`),a}function aZ(t){return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}function S7(t){const{chainId:e,domain:r,expirationTime:n,issuedAt:i=new Date,nonce:s,notBefore:o,requestId:a,resources:u,scheme:l,uri:d,version:g}=t;{if(e!==Math.floor(e))throw new Ma({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${e}`]});if(!(cZ.test(r)||uZ.test(r)||fZ.test(r)))throw new Ma({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${r}`]});if(!lZ.test(s))throw new Ma({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${s}`]});if(!E7(d))throw new Ma({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${d}`]});if(g!=="1")throw new Ma({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${g}`]});if(l&&!hZ.test(l))throw new Ma({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${l}`]});const k=t.statement;if(k!=null&&k.includes(` -`))throw new Ma({field:"statement",metaMessages:["- Statement must not include '\\n'.","",`Provided value: ${k}`]})}const y=og(t.address),A=l?`${l}://${r}`:r,P=t.statement?`${t.statement} -`:"",O=`${A} wants you to sign in with your Ethereum account: +`+x,u(`data:${ue(f)};charset=utf-8,${encodeURIComponent(x)}`,`${p}.svg`)}else u(v.toDataURL(ue(f)),`${p}.${f}`)}}const G=_e})(),s.default})())})(_7);var fZ=_7.exports;const E7=ji(fZ);class Aa extends yt{constructor(e){const{docsPath:r,field:n,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${n}".`,{docsPath:r,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}function S7(t){if(/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t)||/%[^0-9a-f]/i.test(t)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(t))return!1;const e=lZ(t),r=e[1],n=e[2],i=e[3],s=e[4],o=e[5];if(!(r!=null&&r.length&&i.length>=0))return!1;if(n!=null&&n.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9\+\-\.]*$/.test(r.toLowerCase()))return!1;let a="";return a+=`${r}:`,n!=null&&n.length&&(a+=`//${n}`),a+=i,s!=null&&s.length&&(a+=`?${s}`),o!=null&&o.length&&(a+=`#${o}`),a}function lZ(t){return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}function A7(t){const{chainId:e,domain:r,expirationTime:n,issuedAt:i=new Date,nonce:s,notBefore:o,requestId:a,resources:u,scheme:l,uri:d,version:g}=t;{if(e!==Math.floor(e))throw new Aa({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${e}`]});if(!(hZ.test(r)||dZ.test(r)||pZ.test(r)))throw new Aa({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${r}`]});if(!gZ.test(s))throw new Aa({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${s}`]});if(!S7(d))throw new Aa({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${d}`]});if(g!=="1")throw new Aa({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${g}`]});if(l&&!mZ.test(l))throw new Aa({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${l}`]});const k=t.statement;if(k!=null&&k.includes(` +`))throw new Aa({field:"statement",metaMessages:["- Statement must not include '\\n'.","",`Provided value: ${k}`]})}const y=og(t.address),A=l?`${l}://${r}`:r,P=t.statement?`${t.statement} +`:"",N=`${A} wants you to sign in with your Ethereum account: ${y} ${P}`;let D=`URI: ${d} @@ -230,13 +235,13 @@ Issued At: ${i.toISOString()}`;if(n&&(D+=` Expiration Time: ${n.toISOString()}`),o&&(D+=` Not Before: ${o.toISOString()}`),a&&(D+=` Request ID: ${a}`),u){let k=` -Resources:`;for(const B of u){if(!E7(B))throw new Ma({field:"resources",metaMessages:["- Every resource must be a RFC 3986 URI.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${B}`]});k+=` -- ${B}`}D+=k}return`${O} -${D}`}const cZ=/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/,uZ=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/,fZ=/^localhost(:[0-9]{1,5})?$/,lZ=/^[a-zA-Z0-9]{8,}$/,hZ=/^([a-zA-Z][a-zA-Z0-9+-.]*)$/,A7="7a4434fefbcc9af474fb5c995e47d286",dZ={projectId:A7,metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},pZ={namespaces:{eip155:{methods:["eth_sendTransaction","eth_signTransaction","eth_sign","personal_sign","eth_signTypedData"],chains:["eip155:1"],events:["chainChanged","accountsChanged","disconnect"],rpcMap:{1:`https://rpc.walletconnect.com?chainId=eip155:1&projectId=${A7}`}}},skipPairing:!1};function gZ(t,e){const r=window.location.host,n=window.location.href;return S7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function P7(t){var ue,_e,G;const e=Se.useRef(null),{wallet:r,onGetExtension:n,onSignFinish:i}=t,[s,o]=Se.useState(""),[a,u]=Se.useState(!1),[l,d]=Se.useState(""),[g,y]=Se.useState("scan"),A=Se.useRef(),[P,O]=Se.useState((ue=r.config)==null?void 0:ue.image),[D,k]=Se.useState(!1),{saveLastUsedWallet:B}=Kl();async function j(E){var f,p,v,x;u(!0);const m=await dz.init(dZ);m.session&&await m.disconnect();try{if(y("scan"),m.on("display_uri",ae=>{console.log("display_uri",ae),o(ae),u(!1),y("scan")}),m.on("error",ae=>{console.log(ae)}),m.on("session_update",ae=>{console.log("session_update",ae)}),!await m.connect(pZ))throw new Error("Walletconnect init failed");const S=new Wf(m);O(((f=S.config)==null?void 0:f.image)||((p=E.config)==null?void 0:p.image));const b=await S.getAddress(),M=await No.getNonce({account_type:"block_chain"});console.log("get nonce",M);const I=gZ(b,M);y("sign");const F=await S.signMessage(I,b);y("waiting"),await i(S,{message:I,nonce:M,signature:F,address:b,wallet_name:((v=S.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),B(S)}catch(_){console.log("err",_),d(_.details||_.message)}}function U(){A.current=new _7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),A.current.append(e.current)}function K(E){var m;console.log(A.current),(m=A.current)==null||m.update({data:E})}Se.useEffect(()=>{s&&K(s)},[s]),Se.useEffect(()=>{j(r)},[r]),Se.useEffect(()=>{U()},[]);function J(){d(""),K(""),j(r)}function T(){k(!0),navigator.clipboard.writeText(s),setTimeout(()=>{k(!1)},2500)}function z(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return le.jsxs("div",{children:[le.jsx("div",{className:"xc-text-center",children:le.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[le.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),le.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?le.jsx(ya,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):le.jsx("img",{className:"xc-h-10 xc-w-10",src:P})})]})}),le.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[le.jsx("button",{disabled:!s,onClick:T,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:D?le.jsxs(le.Fragment,{children:[" ",le.jsx(NK,{})," Copied!"]}):le.jsxs(le.Fragment,{children:[le.jsx(BK,{}),"Copy QR URL"]})}),((_e=r.config)==null?void 0:_e.getWallet)&&le.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[le.jsx(LK,{}),"Get Extension"]}),((G=r.config)==null?void 0:G.desktop_link)&&le.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:z,children:[le.jsx(l8,{}),"Desktop"]})]}),le.jsx("div",{className:"xc-text-center",children:l?le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),le.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:J,children:"Retry"})]}):le.jsxs(le.Fragment,{children:[g==="scan"&&le.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),g==="connect"&&le.jsx("p",{children:"Click connect in your wallet app"}),g==="sign"&&le.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),g==="waiting"&&le.jsx("div",{className:"xc-text-center",children:le.jsx(ya,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const mZ="Accept connection request in the wallet",vZ="Accept sign-in request in your wallet";function bZ(t,e){const r=window.location.host,n=window.location.href;return S7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function M7(t){var g;const[e,r]=Se.useState(),{wallet:n,onSignFinish:i}=t,s=Se.useRef(),[o,a]=Se.useState("connect"),{saveLastUsedWallet:u}=Kl();async function l(y){var A;try{a("connect");const P=await n.connect();if(!P||P.length===0)throw new Error("Wallet connect error");const O=og(P[0]),D=bZ(O,y);a("sign");const k=await n.signMessage(D,O);if(!k||k.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:O,signature:k,message:D,nonce:y,wallet_name:((A=n.config)==null?void 0:A.name)||""}),u(n)}catch(P){console.log(P.details),r(P.details||P.message)}}async function d(){try{r("");const y=await No.getNonce({account_type:"block_chain"});s.current=y,l(s.current)}catch(y){console.log(y.details),r(y.message)}}return Se.useEffect(()=>{d()},[]),le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[le.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(g=n.config)==null?void 0:g.image,alt:""}),e&&le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),le.jsx("div",{className:"xc-flex xc-gap-2",children:le.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:d,children:"Retry"})})]}),!e&&le.jsxs(le.Fragment,{children:[o==="connect"&&le.jsx("span",{className:"xc-text-center",children:mZ}),o==="sign"&&le.jsx("span",{className:"xc-text-center",children:vZ}),o==="waiting"&&le.jsx("span",{className:"xc-text-center",children:le.jsx(ya,{className:"xc-animate-spin"})})]})]})}const Vu="https://static.codatta.io/codatta-connect/wallet-icons.svg",yZ="https://itunes.apple.com/app/",wZ="https://play.google.com/store/apps/details?id=",xZ="https://chromewebstore.google.com/detail/",_Z="https://chromewebstore.google.com/detail/",EZ="https://addons.mozilla.org/en-US/firefox/addon/",SZ="https://microsoftedge.microsoft.com/addons/detail/";function Gu(t){const{icon:e,title:r,link:n}=t;return le.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[le.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,le.jsx(f8,{className:"xc-ml-auto xc-text-gray-400"})]})}function AZ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${yZ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${wZ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${xZ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${_Z}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${EZ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${SZ}${t.edge_addon_id}`),e}function I7(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=AZ(r);return le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),le.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),le.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),le.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&le.jsx(Gu,{link:n.chromeStoreLink,icon:`${Vu}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&le.jsx(Gu,{link:n.appStoreLink,icon:`${Vu}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&le.jsx(Gu,{link:n.playStoreLink,icon:`${Vu}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&le.jsx(Gu,{link:n.edgeStoreLink,icon:`${Vu}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&le.jsx(Gu,{link:n.braveStoreLink,icon:`${Vu}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&le.jsx(Gu,{link:n.firefoxStoreLink,icon:`${Vu}#firefox`,title:"Mozilla Firefox"})]})]})}function PZ(t){const{wallet:e}=t,[r,n]=Se.useState(e.installed?"connect":"qr"),i=Cb();async function s(o,a){var l;const u=await No.walletLogin({account_type:"block_chain",account_enum:"C",connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return le.jsxs(ro,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Ac,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&le.jsx(P7,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&le.jsx(M7,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&le.jsx(I7,{wallet:e})]})}function MZ(t){const{wallet:e,onClick:r}=t,n=le.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return le.jsx(Eb,{icon:n,title:i,onClick:()=>r(e)})}function C7(t){const{connector:e}=t,[r,n]=Se.useState(),[i,s]=Se.useState([]),o=Se.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d),console.log(d)}Se.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return le.jsxs(ro,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Ac,{title:"Select wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[le.jsx(d8,{className:"xc-shrink-0 xc-opacity-50"}),le.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),le.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>le.jsx(MZ,{wallet:d,onClick:l},d.name))})]})}var T7={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,$[H+1]=V>>16&255,$[H+2]=V>>8&255,$[H+3]=V&255,$[H+4]=C>>24&255,$[H+5]=C>>16&255,$[H+6]=C>>8&255,$[H+7]=C&255}function O($,H,V,C,Y){var q,oe=0;for(q=0;q>>8)-1}function D($,H,V,C){return O($,H,V,C,16)}function k($,H,V,C){return O($,H,V,C,32)}function B($,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,ge=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,Ue=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=oe,wt=ge,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,pe,nr=0;nr<20;nr+=2)pe=dt+kt|0,lt^=pe<<7|pe>>>25,pe=lt+dt|0,Ge^=pe<<9|pe>>>23,pe=Ge+lt|0,kt^=pe<<13|pe>>>19,pe=kt+Ge|0,dt^=pe<<18|pe>>>14,pe=at+_t|0,je^=pe<<7|pe>>>25,pe=je+at|0,Wt^=pe<<9|pe>>>23,pe=Wt+je|0,_t^=pe<<13|pe>>>19,pe=_t+Wt|0,at^=pe<<18|pe>>>14,pe=qe+Ae|0,Zt^=pe<<7|pe>>>25,pe=Zt+qe|0,ot^=pe<<9|pe>>>23,pe=ot+Zt|0,Ae^=pe<<13|pe>>>19,pe=Ae+ot|0,qe^=pe<<18|pe>>>14,pe=Kt+Xe|0,wt^=pe<<7|pe>>>25,pe=wt+Kt|0,Pe^=pe<<9|pe>>>23,pe=Pe+wt|0,Xe^=pe<<13|pe>>>19,pe=Xe+Pe|0,Kt^=pe<<18|pe>>>14,pe=dt+wt|0,_t^=pe<<7|pe>>>25,pe=_t+dt|0,ot^=pe<<9|pe>>>23,pe=ot+_t|0,wt^=pe<<13|pe>>>19,pe=wt+ot|0,dt^=pe<<18|pe>>>14,pe=at+lt|0,Ae^=pe<<7|pe>>>25,pe=Ae+at|0,Pe^=pe<<9|pe>>>23,pe=Pe+Ae|0,lt^=pe<<13|pe>>>19,pe=lt+Pe|0,at^=pe<<18|pe>>>14,pe=qe+je|0,Xe^=pe<<7|pe>>>25,pe=Xe+qe|0,Ge^=pe<<9|pe>>>23,pe=Ge+Xe|0,je^=pe<<13|pe>>>19,pe=je+Ge|0,qe^=pe<<18|pe>>>14,pe=Kt+Zt|0,kt^=pe<<7|pe>>>25,pe=kt+Kt|0,Wt^=pe<<9|pe>>>23,pe=Wt+kt|0,Zt^=pe<<13|pe>>>19,pe=Zt+Wt|0,Kt^=pe<<18|pe>>>14;dt=dt+Y|0,_t=_t+q|0,ot=ot+oe|0,wt=wt+ge|0,lt=lt+xe|0,at=at+Re|0,Ae=Ae+De|0,Pe=Pe+it|0,Ge=Ge+Ue|0,je=je+gt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=_t>>>0&255,$[5]=_t>>>8&255,$[6]=_t>>>16&255,$[7]=_t>>>24&255,$[8]=ot>>>0&255,$[9]=ot>>>8&255,$[10]=ot>>>16&255,$[11]=ot>>>24&255,$[12]=wt>>>0&255,$[13]=wt>>>8&255,$[14]=wt>>>16&255,$[15]=wt>>>24&255,$[16]=lt>>>0&255,$[17]=lt>>>8&255,$[18]=lt>>>16&255,$[19]=lt>>>24&255,$[20]=at>>>0&255,$[21]=at>>>8&255,$[22]=at>>>16&255,$[23]=at>>>24&255,$[24]=Ae>>>0&255,$[25]=Ae>>>8&255,$[26]=Ae>>>16&255,$[27]=Ae>>>24&255,$[28]=Pe>>>0&255,$[29]=Pe>>>8&255,$[30]=Pe>>>16&255,$[31]=Pe>>>24&255,$[32]=Ge>>>0&255,$[33]=Ge>>>8&255,$[34]=Ge>>>16&255,$[35]=Ge>>>24&255,$[36]=je>>>0&255,$[37]=je>>>8&255,$[38]=je>>>16&255,$[39]=je>>>24&255,$[40]=qe>>>0&255,$[41]=qe>>>8&255,$[42]=qe>>>16&255,$[43]=qe>>>24&255,$[44]=Xe>>>0&255,$[45]=Xe>>>8&255,$[46]=Xe>>>16&255,$[47]=Xe>>>24&255,$[48]=kt>>>0&255,$[49]=kt>>>8&255,$[50]=kt>>>16&255,$[51]=kt>>>24&255,$[52]=Wt>>>0&255,$[53]=Wt>>>8&255,$[54]=Wt>>>16&255,$[55]=Wt>>>24&255,$[56]=Zt>>>0&255,$[57]=Zt>>>8&255,$[58]=Zt>>>16&255,$[59]=Zt>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255}function j($,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,ge=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,Ue=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=oe,wt=ge,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,pe,nr=0;nr<20;nr+=2)pe=dt+kt|0,lt^=pe<<7|pe>>>25,pe=lt+dt|0,Ge^=pe<<9|pe>>>23,pe=Ge+lt|0,kt^=pe<<13|pe>>>19,pe=kt+Ge|0,dt^=pe<<18|pe>>>14,pe=at+_t|0,je^=pe<<7|pe>>>25,pe=je+at|0,Wt^=pe<<9|pe>>>23,pe=Wt+je|0,_t^=pe<<13|pe>>>19,pe=_t+Wt|0,at^=pe<<18|pe>>>14,pe=qe+Ae|0,Zt^=pe<<7|pe>>>25,pe=Zt+qe|0,ot^=pe<<9|pe>>>23,pe=ot+Zt|0,Ae^=pe<<13|pe>>>19,pe=Ae+ot|0,qe^=pe<<18|pe>>>14,pe=Kt+Xe|0,wt^=pe<<7|pe>>>25,pe=wt+Kt|0,Pe^=pe<<9|pe>>>23,pe=Pe+wt|0,Xe^=pe<<13|pe>>>19,pe=Xe+Pe|0,Kt^=pe<<18|pe>>>14,pe=dt+wt|0,_t^=pe<<7|pe>>>25,pe=_t+dt|0,ot^=pe<<9|pe>>>23,pe=ot+_t|0,wt^=pe<<13|pe>>>19,pe=wt+ot|0,dt^=pe<<18|pe>>>14,pe=at+lt|0,Ae^=pe<<7|pe>>>25,pe=Ae+at|0,Pe^=pe<<9|pe>>>23,pe=Pe+Ae|0,lt^=pe<<13|pe>>>19,pe=lt+Pe|0,at^=pe<<18|pe>>>14,pe=qe+je|0,Xe^=pe<<7|pe>>>25,pe=Xe+qe|0,Ge^=pe<<9|pe>>>23,pe=Ge+Xe|0,je^=pe<<13|pe>>>19,pe=je+Ge|0,qe^=pe<<18|pe>>>14,pe=Kt+Zt|0,kt^=pe<<7|pe>>>25,pe=kt+Kt|0,Wt^=pe<<9|pe>>>23,pe=Wt+kt|0,Zt^=pe<<13|pe>>>19,pe=Zt+Wt|0,Kt^=pe<<18|pe>>>14;$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=at>>>0&255,$[5]=at>>>8&255,$[6]=at>>>16&255,$[7]=at>>>24&255,$[8]=qe>>>0&255,$[9]=qe>>>8&255,$[10]=qe>>>16&255,$[11]=qe>>>24&255,$[12]=Kt>>>0&255,$[13]=Kt>>>8&255,$[14]=Kt>>>16&255,$[15]=Kt>>>24&255,$[16]=Ae>>>0&255,$[17]=Ae>>>8&255,$[18]=Ae>>>16&255,$[19]=Ae>>>24&255,$[20]=Pe>>>0&255,$[21]=Pe>>>8&255,$[22]=Pe>>>16&255,$[23]=Pe>>>24&255,$[24]=Ge>>>0&255,$[25]=Ge>>>8&255,$[26]=Ge>>>16&255,$[27]=Ge>>>24&255,$[28]=je>>>0&255,$[29]=je>>>8&255,$[30]=je>>>16&255,$[31]=je>>>24&255}function U($,H,V,C){B($,H,V,C)}function K($,H,V,C){j($,H,V,C)}var J=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T($,H,V,C,Y,q,oe){var ge=new Uint8Array(16),xe=new Uint8Array(64),Re,De;for(De=0;De<16;De++)ge[De]=0;for(De=0;De<8;De++)ge[De]=q[De];for(;Y>=64;){for(U(xe,ge,oe,J),De=0;De<64;De++)$[H+De]=V[C+De]^xe[De];for(Re=1,De=8;De<16;De++)Re=Re+(ge[De]&255)|0,ge[De]=Re&255,Re>>>=8;Y-=64,H+=64,C+=64}if(Y>0)for(U(xe,ge,oe,J),De=0;De=64;){for(U(oe,q,Y,J),xe=0;xe<64;xe++)$[H+xe]=oe[xe];for(ge=1,xe=8;xe<16;xe++)ge=ge+(q[xe]&255)|0,q[xe]=ge&255,ge>>>=8;V-=64,H+=64}if(V>0)for(U(oe,q,Y,J),xe=0;xe>>13|V<<3)&8191,C=$[4]&255|($[5]&255)<<8,this.r[2]=(V>>>10|C<<6)&7939,Y=$[6]&255|($[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,q=$[8]&255|($[9]&255)<<8,this.r[4]=(Y>>>4|q<<12)&255,this.r[5]=q>>>1&8190,oe=$[10]&255|($[11]&255)<<8,this.r[6]=(q>>>14|oe<<2)&8191,ge=$[12]&255|($[13]&255)<<8,this.r[7]=(oe>>>11|ge<<5)&8065,xe=$[14]&255|($[15]&255)<<8,this.r[8]=(ge>>>8|xe<<8)&8191,this.r[9]=xe>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};G.prototype.blocks=function($,H,V){for(var C=this.fin?0:2048,Y,q,oe,ge,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Ae=this.h[3],Pe=this.h[4],Ge=this.h[5],je=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],pe=this.r[3],nr=this.r[4],dr=this.r[5],pr=this.r[6],Qt=this.r[7],gr=this.r[8],lr=this.r[9];V>=16;)Y=$[H+0]&255|($[H+1]&255)<<8,wt+=Y&8191,q=$[H+2]&255|($[H+3]&255)<<8,lt+=(Y>>>13|q<<3)&8191,oe=$[H+4]&255|($[H+5]&255)<<8,at+=(q>>>10|oe<<6)&8191,ge=$[H+6]&255|($[H+7]&255)<<8,Ae+=(oe>>>7|ge<<9)&8191,xe=$[H+8]&255|($[H+9]&255)<<8,Pe+=(ge>>>4|xe<<12)&8191,Ge+=xe>>>1&8191,Re=$[H+10]&255|($[H+11]&255)<<8,je+=(xe>>>14|Re<<2)&8191,De=$[H+12]&255|($[H+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=$[H+14]&255|($[H+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,Ue=0,gt=Ue,gt+=wt*Wt,gt+=lt*(5*lr),gt+=at*(5*gr),gt+=Ae*(5*Qt),gt+=Pe*(5*pr),Ue=gt>>>13,gt&=8191,gt+=Ge*(5*dr),gt+=je*(5*nr),gt+=qe*(5*pe),gt+=Xe*(5*Kt),gt+=kt*(5*Zt),Ue+=gt>>>13,gt&=8191,st=Ue,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Ae*(5*gr),st+=Pe*(5*Qt),Ue=st>>>13,st&=8191,st+=Ge*(5*pr),st+=je*(5*dr),st+=qe*(5*nr),st+=Xe*(5*pe),st+=kt*(5*Kt),Ue+=st>>>13,st&=8191,tt=Ue,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Ae*(5*lr),tt+=Pe*(5*gr),Ue=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=je*(5*pr),tt+=qe*(5*dr),tt+=Xe*(5*nr),tt+=kt*(5*pe),Ue+=tt>>>13,tt&=8191,At=Ue,At+=wt*pe,At+=lt*Kt,At+=at*Zt,At+=Ae*Wt,At+=Pe*(5*lr),Ue=At>>>13,At&=8191,At+=Ge*(5*gr),At+=je*(5*Qt),At+=qe*(5*pr),At+=Xe*(5*dr),At+=kt*(5*nr),Ue+=At>>>13,At&=8191,Rt=Ue,Rt+=wt*nr,Rt+=lt*pe,Rt+=at*Kt,Rt+=Ae*Zt,Rt+=Pe*Wt,Ue=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=je*(5*gr),Rt+=qe*(5*Qt),Rt+=Xe*(5*pr),Rt+=kt*(5*dr),Ue+=Rt>>>13,Rt&=8191,Mt=Ue,Mt+=wt*dr,Mt+=lt*nr,Mt+=at*pe,Mt+=Ae*Kt,Mt+=Pe*Zt,Ue=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=je*(5*lr),Mt+=qe*(5*gr),Mt+=Xe*(5*Qt),Mt+=kt*(5*pr),Ue+=Mt>>>13,Mt&=8191,Et=Ue,Et+=wt*pr,Et+=lt*dr,Et+=at*nr,Et+=Ae*pe,Et+=Pe*Kt,Ue=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=je*Wt,Et+=qe*(5*lr),Et+=Xe*(5*gr),Et+=kt*(5*Qt),Ue+=Et>>>13,Et&=8191,dt=Ue,dt+=wt*Qt,dt+=lt*pr,dt+=at*dr,dt+=Ae*nr,dt+=Pe*pe,Ue=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=je*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*gr),Ue+=dt>>>13,dt&=8191,_t=Ue,_t+=wt*gr,_t+=lt*Qt,_t+=at*pr,_t+=Ae*dr,_t+=Pe*nr,Ue=_t>>>13,_t&=8191,_t+=Ge*pe,_t+=je*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),Ue+=_t>>>13,_t&=8191,ot=Ue,ot+=wt*lr,ot+=lt*gr,ot+=at*Qt,ot+=Ae*pr,ot+=Pe*dr,Ue=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=je*pe,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,Ue+=ot>>>13,ot&=8191,Ue=(Ue<<2)+Ue|0,Ue=Ue+gt|0,gt=Ue&8191,Ue=Ue>>>13,st+=Ue,wt=gt,lt=st,at=tt,Ae=At,Pe=Rt,Ge=Mt,je=Et,qe=dt,Xe=_t,kt=ot,H+=16,V-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Ae,this.h[4]=Pe,this.h[5]=Ge,this.h[6]=je,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},G.prototype.finish=function($,H){var V=new Uint16Array(10),C,Y,q,oe;if(this.leftover){for(oe=this.leftover,this.buffer[oe++]=1;oe<16;oe++)this.buffer[oe]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,oe=2;oe<10;oe++)this.h[oe]+=C,C=this.h[oe]>>>13,this.h[oe]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,V[0]=this.h[0]+5,C=V[0]>>>13,V[0]&=8191,oe=1;oe<10;oe++)V[oe]=this.h[oe]+C,C=V[oe]>>>13,V[oe]&=8191;for(V[9]-=8192,Y=(C^1)-1,oe=0;oe<10;oe++)V[oe]&=Y;for(Y=~Y,oe=0;oe<10;oe++)this.h[oe]=this.h[oe]&Y|V[oe];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,q=this.h[0]+this.pad[0],this.h[0]=q&65535,oe=1;oe<8;oe++)q=(this.h[oe]+this.pad[oe]|0)+(q>>>16)|0,this.h[oe]=q&65535;$[H+0]=this.h[0]>>>0&255,$[H+1]=this.h[0]>>>8&255,$[H+2]=this.h[1]>>>0&255,$[H+3]=this.h[1]>>>8&255,$[H+4]=this.h[2]>>>0&255,$[H+5]=this.h[2]>>>8&255,$[H+6]=this.h[3]>>>0&255,$[H+7]=this.h[3]>>>8&255,$[H+8]=this.h[4]>>>0&255,$[H+9]=this.h[4]>>>8&255,$[H+10]=this.h[5]>>>0&255,$[H+11]=this.h[5]>>>8&255,$[H+12]=this.h[6]>>>0&255,$[H+13]=this.h[6]>>>8&255,$[H+14]=this.h[7]>>>0&255,$[H+15]=this.h[7]>>>8&255},G.prototype.update=function($,H,V){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>V&&(Y=V),C=0;C=16&&(Y=V-V%16,this.blocks($,H,Y),H+=Y,V-=Y),V){for(C=0;C>16&1),q[V-1]&=65535;q[15]=oe[15]-32767-(q[14]>>16&1),Y=q[15]>>16&1,q[14]&=65535,_(oe,q,1-Y)}for(V=0;V<16;V++)$[2*V]=oe[V]&255,$[2*V+1]=oe[V]>>8}function b($,H){var V=new Uint8Array(32),C=new Uint8Array(32);return S(V,$),S(C,H),k(V,0,C,0)}function M($){var H=new Uint8Array(32);return S(H,$),H[0]&1}function I($,H){var V;for(V=0;V<16;V++)$[V]=H[2*V]+(H[2*V+1]<<8);$[15]&=32767}function F($,H,V){for(var C=0;C<16;C++)$[C]=H[C]+V[C]}function ae($,H,V){for(var C=0;C<16;C++)$[C]=H[C]-V[C]}function N($,H,V){var C,Y,q=0,oe=0,ge=0,xe=0,Re=0,De=0,it=0,Ue=0,gt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Ae=0,Pe=0,Ge=0,je=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,pe=V[0],nr=V[1],dr=V[2],pr=V[3],Qt=V[4],gr=V[5],lr=V[6],Lr=V[7],mr=V[8],wr=V[9],Br=V[10],$r=V[11],Ir=V[12],hn=V[13],dn=V[14],pn=V[15];C=H[0],q+=C*pe,oe+=C*nr,ge+=C*dr,xe+=C*pr,Re+=C*Qt,De+=C*gr,it+=C*lr,Ue+=C*Lr,gt+=C*mr,st+=C*wr,tt+=C*Br,At+=C*$r,Rt+=C*Ir,Mt+=C*hn,Et+=C*dn,dt+=C*pn,C=H[1],oe+=C*pe,ge+=C*nr,xe+=C*dr,Re+=C*pr,De+=C*Qt,it+=C*gr,Ue+=C*lr,gt+=C*Lr,st+=C*mr,tt+=C*wr,At+=C*Br,Rt+=C*$r,Mt+=C*Ir,Et+=C*hn,dt+=C*dn,_t+=C*pn,C=H[2],ge+=C*pe,xe+=C*nr,Re+=C*dr,De+=C*pr,it+=C*Qt,Ue+=C*gr,gt+=C*lr,st+=C*Lr,tt+=C*mr,At+=C*wr,Rt+=C*Br,Mt+=C*$r,Et+=C*Ir,dt+=C*hn,_t+=C*dn,ot+=C*pn,C=H[3],xe+=C*pe,Re+=C*nr,De+=C*dr,it+=C*pr,Ue+=C*Qt,gt+=C*gr,st+=C*lr,tt+=C*Lr,At+=C*mr,Rt+=C*wr,Mt+=C*Br,Et+=C*$r,dt+=C*Ir,_t+=C*hn,ot+=C*dn,wt+=C*pn,C=H[4],Re+=C*pe,De+=C*nr,it+=C*dr,Ue+=C*pr,gt+=C*Qt,st+=C*gr,tt+=C*lr,At+=C*Lr,Rt+=C*mr,Mt+=C*wr,Et+=C*Br,dt+=C*$r,_t+=C*Ir,ot+=C*hn,wt+=C*dn,lt+=C*pn,C=H[5],De+=C*pe,it+=C*nr,Ue+=C*dr,gt+=C*pr,st+=C*Qt,tt+=C*gr,At+=C*lr,Rt+=C*Lr,Mt+=C*mr,Et+=C*wr,dt+=C*Br,_t+=C*$r,ot+=C*Ir,wt+=C*hn,lt+=C*dn,at+=C*pn,C=H[6],it+=C*pe,Ue+=C*nr,gt+=C*dr,st+=C*pr,tt+=C*Qt,At+=C*gr,Rt+=C*lr,Mt+=C*Lr,Et+=C*mr,dt+=C*wr,_t+=C*Br,ot+=C*$r,wt+=C*Ir,lt+=C*hn,at+=C*dn,Ae+=C*pn,C=H[7],Ue+=C*pe,gt+=C*nr,st+=C*dr,tt+=C*pr,At+=C*Qt,Rt+=C*gr,Mt+=C*lr,Et+=C*Lr,dt+=C*mr,_t+=C*wr,ot+=C*Br,wt+=C*$r,lt+=C*Ir,at+=C*hn,Ae+=C*dn,Pe+=C*pn,C=H[8],gt+=C*pe,st+=C*nr,tt+=C*dr,At+=C*pr,Rt+=C*Qt,Mt+=C*gr,Et+=C*lr,dt+=C*Lr,_t+=C*mr,ot+=C*wr,wt+=C*Br,lt+=C*$r,at+=C*Ir,Ae+=C*hn,Pe+=C*dn,Ge+=C*pn,C=H[9],st+=C*pe,tt+=C*nr,At+=C*dr,Rt+=C*pr,Mt+=C*Qt,Et+=C*gr,dt+=C*lr,_t+=C*Lr,ot+=C*mr,wt+=C*wr,lt+=C*Br,at+=C*$r,Ae+=C*Ir,Pe+=C*hn,Ge+=C*dn,je+=C*pn,C=H[10],tt+=C*pe,At+=C*nr,Rt+=C*dr,Mt+=C*pr,Et+=C*Qt,dt+=C*gr,_t+=C*lr,ot+=C*Lr,wt+=C*mr,lt+=C*wr,at+=C*Br,Ae+=C*$r,Pe+=C*Ir,Ge+=C*hn,je+=C*dn,qe+=C*pn,C=H[11],At+=C*pe,Rt+=C*nr,Mt+=C*dr,Et+=C*pr,dt+=C*Qt,_t+=C*gr,ot+=C*lr,wt+=C*Lr,lt+=C*mr,at+=C*wr,Ae+=C*Br,Pe+=C*$r,Ge+=C*Ir,je+=C*hn,qe+=C*dn,Xe+=C*pn,C=H[12],Rt+=C*pe,Mt+=C*nr,Et+=C*dr,dt+=C*pr,_t+=C*Qt,ot+=C*gr,wt+=C*lr,lt+=C*Lr,at+=C*mr,Ae+=C*wr,Pe+=C*Br,Ge+=C*$r,je+=C*Ir,qe+=C*hn,Xe+=C*dn,kt+=C*pn,C=H[13],Mt+=C*pe,Et+=C*nr,dt+=C*dr,_t+=C*pr,ot+=C*Qt,wt+=C*gr,lt+=C*lr,at+=C*Lr,Ae+=C*mr,Pe+=C*wr,Ge+=C*Br,je+=C*$r,qe+=C*Ir,Xe+=C*hn,kt+=C*dn,Wt+=C*pn,C=H[14],Et+=C*pe,dt+=C*nr,_t+=C*dr,ot+=C*pr,wt+=C*Qt,lt+=C*gr,at+=C*lr,Ae+=C*Lr,Pe+=C*mr,Ge+=C*wr,je+=C*Br,qe+=C*$r,Xe+=C*Ir,kt+=C*hn,Wt+=C*dn,Zt+=C*pn,C=H[15],dt+=C*pe,_t+=C*nr,ot+=C*dr,wt+=C*pr,lt+=C*Qt,at+=C*gr,Ae+=C*lr,Pe+=C*Lr,Ge+=C*mr,je+=C*wr,qe+=C*Br,Xe+=C*$r,kt+=C*Ir,Wt+=C*hn,Zt+=C*dn,Kt+=C*pn,q+=38*_t,oe+=38*ot,ge+=38*wt,xe+=38*lt,Re+=38*at,De+=38*Ae,it+=38*Pe,Ue+=38*Ge,gt+=38*je,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=ge+Y+65535,Y=Math.floor(C/65536),ge=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=ge+Y+65535,Y=Math.floor(C/65536),ge=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),$[0]=q,$[1]=oe,$[2]=ge,$[3]=xe,$[4]=Re,$[5]=De,$[6]=it,$[7]=Ue,$[8]=gt,$[9]=st,$[10]=tt,$[11]=At,$[12]=Rt,$[13]=Mt,$[14]=Et,$[15]=dt}function se($,H){N($,H,H)}function ee($,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=253;C>=0;C--)se(V,V),C!==2&&C!==4&&N(V,V,H);for(C=0;C<16;C++)$[C]=V[C]}function X($,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=250;C>=0;C--)se(V,V),C!==1&&N(V,V,H);for(C=0;C<16;C++)$[C]=V[C]}function Q($,H,V){var C=new Uint8Array(32),Y=new Float64Array(80),q,oe,ge=r(),xe=r(),Re=r(),De=r(),it=r(),Ue=r();for(oe=0;oe<31;oe++)C[oe]=H[oe];for(C[31]=H[31]&127|64,C[0]&=248,I(Y,V),oe=0;oe<16;oe++)xe[oe]=Y[oe],De[oe]=ge[oe]=Re[oe]=0;for(ge[0]=De[0]=1,oe=254;oe>=0;--oe)q=C[oe>>>3]>>>(oe&7)&1,_(ge,xe,q),_(Re,De,q),F(it,ge,Re),ae(ge,ge,Re),F(Re,xe,De),ae(xe,xe,De),se(De,it),se(Ue,ge),N(ge,Re,ge),N(Re,xe,it),F(it,ge,Re),ae(ge,ge,Re),se(xe,ge),ae(Re,De,Ue),N(ge,Re,u),F(ge,ge,De),N(Re,Re,ge),N(ge,De,Ue),N(De,xe,Y),se(xe,it),_(ge,xe,q),_(Re,De,q);for(oe=0;oe<16;oe++)Y[oe+16]=ge[oe],Y[oe+32]=Re[oe],Y[oe+48]=xe[oe],Y[oe+64]=De[oe];var gt=Y.subarray(32),st=Y.subarray(16);return ee(gt,gt),N(st,st,gt),S($,st),0}function R($,H){return Q($,H,s)}function Z($,H){return n(H,32),R($,H)}function te($,H,V){var C=new Uint8Array(32);return Q(C,V,H),K($,i,C,J)}var he=f,ie=p;function fe($,H,V,C,Y,q){var oe=new Uint8Array(32);return te(oe,Y,q),he($,H,V,C,oe)}function ve($,H,V,C,Y,q){var oe=new Uint8Array(32);return te(oe,Y,q),ie($,H,V,C,oe)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne($,H,V,C){for(var Y=new Int32Array(16),q=new Int32Array(16),oe,ge,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Ae,Pe,Ge,je,qe,Xe,kt=$[0],Wt=$[1],Zt=$[2],Kt=$[3],pe=$[4],nr=$[5],dr=$[6],pr=$[7],Qt=H[0],gr=H[1],lr=H[2],Lr=H[3],mr=H[4],wr=H[5],Br=H[6],$r=H[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=V[at+0]<<24|V[at+1]<<16|V[at+2]<<8|V[at+3],q[lt]=V[at+4]<<24|V[at+5]<<16|V[at+6]<<8|V[at+7];for(lt=0;lt<80;lt++)if(oe=kt,ge=Wt,xe=Zt,Re=Kt,De=pe,it=nr,Ue=dr,gt=pr,st=Qt,tt=gr,At=lr,Rt=Lr,Mt=mr,Et=wr,dt=Br,_t=$r,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(pe>>>14|mr<<18)^(pe>>>18|mr<<14)^(mr>>>9|pe<<23),Pe=(mr>>>14|pe<<18)^(mr>>>18|pe<<14)^(pe>>>9|mr<<23),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=pe&nr^~pe&dr,Pe=mr&wr^~mr&Br,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Me[lt*2],Pe=Me[lt*2+1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Y[lt%16],Pe=q[lt%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|je<<16,Ae=ot,Pe=wt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Pe=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=kt&Wt^kt&Zt^Wt&Zt,Pe=Qt&gr^Qt&lr^gr&lr,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,gt=qe&65535|Xe<<16,_t=Ge&65535|je<<16,Ae=Re,Pe=Rt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=ot,Pe=wt,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|je<<16,Wt=oe,Zt=ge,Kt=xe,pe=Re,nr=De,dr=it,pr=Ue,kt=gt,gr=st,lr=tt,Lr=At,mr=Rt,wr=Mt,Br=Et,$r=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Ae=Y[at],Pe=q[at],Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=Y[(at+9)%16],Pe=q[(at+9)%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+1)%16],wt=q[(at+1)%16],Ae=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Pe=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+14)%16],wt=q[(at+14)%16],Ae=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Pe=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,q[at]=Ge&65535|je<<16;Ae=kt,Pe=Qt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[0],Pe=H[0],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[0]=kt=qe&65535|Xe<<16,H[0]=Qt=Ge&65535|je<<16,Ae=Wt,Pe=gr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[1],Pe=H[1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[1]=Wt=qe&65535|Xe<<16,H[1]=gr=Ge&65535|je<<16,Ae=Zt,Pe=lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[2],Pe=H[2],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[2]=Zt=qe&65535|Xe<<16,H[2]=lr=Ge&65535|je<<16,Ae=Kt,Pe=Lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[3],Pe=H[3],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[3]=Kt=qe&65535|Xe<<16,H[3]=Lr=Ge&65535|je<<16,Ae=pe,Pe=mr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[4],Pe=H[4],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[4]=pe=qe&65535|Xe<<16,H[4]=mr=Ge&65535|je<<16,Ae=nr,Pe=wr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[5],Pe=H[5],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[5]=nr=qe&65535|Xe<<16,H[5]=wr=Ge&65535|je<<16,Ae=dr,Pe=Br,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[6],Pe=H[6],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[6]=dr=qe&65535|Xe<<16,H[6]=Br=Ge&65535|je<<16,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[7],Pe=H[7],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[7]=pr=qe&65535|Xe<<16,H[7]=$r=Ge&65535|je<<16,Ir+=128,C-=128}return C}function Te($,H,V){var C=new Int32Array(8),Y=new Int32Array(8),q=new Uint8Array(256),oe,ge=V;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,H,V),V%=128,oe=0;oe=0;--Y)C=V[Y/8|0]>>(Y&7)&1,Ie($,H,C),$e(H,$),$e($,$),Ie($,H,C)}function ke($,H){var V=[r(),r(),r(),r()];v(V[0],g),v(V[1],y),v(V[2],a),N(V[3],g,y),Ve($,V,H)}function ze($,H,V){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],q;for(V||n(H,32),Te(C,H,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le($,Y),q=0;q<32;q++)H[q+32]=$[q];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Ee($,H){var V,C,Y,q;for(C=63;C>=32;--C){for(V=0,Y=C-32,q=C-12;Y>4)*He[Y],V=H[Y]>>8,H[Y]&=255;for(Y=0;Y<32;Y++)H[Y]-=V*He[Y];for(C=0;C<32;C++)H[C+1]+=H[C]>>8,$[C]=H[C]&255}function Qe($){var H=new Float64Array(64),V;for(V=0;V<64;V++)H[V]=$[V];for(V=0;V<64;V++)$[V]=0;Ee($,H)}function ct($,H,V,C){var Y=new Uint8Array(64),q=new Uint8Array(64),oe=new Uint8Array(64),ge,xe,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=V+64;for(ge=0;ge>7&&ae($[0],o,$[0]),N($[3],$[0],$[1]),0)}function et($,H,V,C){var Y,q=new Uint8Array(32),oe=new Uint8Array(64),ge=[r(),r(),r(),r()],xe=[r(),r(),r(),r()];if(V<64||Be(xe,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var $=new Uint8Array(vt),H=new Uint8Array(Dt);return ze($,H),{publicKey:$,secretKey:H}},e.sign.keyPair.fromSecretKey=function($){if(nt($),$.length!==Dt)throw new Error("bad secret key size");for(var H=new Uint8Array(vt),V=0;V=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function Tb(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function Y0(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{console.log("display_uri",ae),o(ae),u(!1),y("scan")}),m.on("error",ae=>{console.log(ae)}),m.on("session_update",ae=>{console.log("session_update",ae)}),!await m.connect(bZ))throw new Error("Walletconnect init failed");const S=new Wf(m);N(((f=S.config)==null?void 0:f.image)||((p=E.config)==null?void 0:p.image));const b=await S.getAddress(),M=await va.getNonce({account_type:"block_chain"});console.log("get nonce",M);const I=yZ(b,M);y("sign");const F=await S.signMessage(I,b);y("waiting"),await i(S,{message:I,nonce:M,signature:F,address:b,wallet_name:((v=S.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),B(S)}catch(_){console.log("err",_),d(_.details||_.message)}}function U(){A.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),A.current.append(e.current)}function K(E){var m;console.log(A.current),(m=A.current)==null||m.update({data:E})}Se.useEffect(()=>{s&&K(s)},[s]),Se.useEffect(()=>{j(r)},[r]),Se.useEffect(()=>{U()},[]);function J(){d(""),K(""),j(r)}function T(){k(!0),navigator.clipboard.writeText(s),setTimeout(()=>{k(!1)},2500)}function z(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return ge.jsxs("div",{children:[ge.jsx("div",{className:"xc-text-center",children:ge.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[ge.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),ge.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?ge.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):ge.jsx("img",{className:"xc-h-10 xc-w-10",src:P})})]})}),ge.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[ge.jsx("button",{disabled:!s,onClick:T,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:D?ge.jsxs(ge.Fragment,{children:[" ",ge.jsx(LK,{})," Copied!"]}):ge.jsxs(ge.Fragment,{children:[ge.jsx($K,{}),"Copy QR URL"]})}),((_e=r.config)==null?void 0:_e.getWallet)&&ge.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[ge.jsx(kK,{}),"Get Extension"]}),((G=r.config)==null?void 0:G.desktop_link)&&ge.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:z,children:[ge.jsx(f8,{}),"Desktop"]})]}),ge.jsx("div",{className:"xc-text-center",children:l?ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),ge.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:J,children:"Retry"})]}):ge.jsxs(ge.Fragment,{children:[g==="scan"&&ge.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),g==="connect"&&ge.jsx("p",{children:"Click connect in your wallet app"}),g==="sign"&&ge.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),g==="waiting"&&ge.jsx("div",{className:"xc-text-center",children:ge.jsx(vc,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const wZ="Accept connection request in the wallet",xZ="Accept sign-in request in your wallet";function _Z(t,e){const r=window.location.host,n=window.location.href;return A7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function I7(t){var g;const[e,r]=Se.useState(),{wallet:n,onSignFinish:i}=t,s=Se.useRef(),[o,a]=Se.useState("connect"),{saveLastUsedWallet:u}=Kl();async function l(y){var A;try{a("connect");const P=await n.connect();if(!P||P.length===0)throw new Error("Wallet connect error");const N=og(P[0]),D=_Z(N,y);a("sign");const k=await n.signMessage(D,N);if(!k||k.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:N,signature:k,message:D,nonce:y,wallet_name:((A=n.config)==null?void 0:A.name)||""}),u(n)}catch(P){console.log(P.details),r(P.details||P.message)}}async function d(){try{r("");const y=await va.getNonce({account_type:"block_chain"});s.current=y,l(s.current)}catch(y){console.log(y.details),r(y.message)}}return Se.useEffect(()=>{d()},[]),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[ge.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(g=n.config)==null?void 0:g.image,alt:""}),e&&ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),ge.jsx("div",{className:"xc-flex xc-gap-2",children:ge.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:d,children:"Retry"})})]}),!e&&ge.jsxs(ge.Fragment,{children:[o==="connect"&&ge.jsx("span",{className:"xc-text-center",children:wZ}),o==="sign"&&ge.jsx("span",{className:"xc-text-center",children:xZ}),o==="waiting"&&ge.jsx("span",{className:"xc-text-center",children:ge.jsx(vc,{className:"xc-animate-spin"})})]})]})}const Vu="https://static.codatta.io/codatta-connect/wallet-icons.svg",EZ="https://itunes.apple.com/app/",SZ="https://play.google.com/store/apps/details?id=",AZ="https://chromewebstore.google.com/detail/",PZ="https://chromewebstore.google.com/detail/",MZ="https://addons.mozilla.org/en-US/firefox/addon/",IZ="https://microsoftedge.microsoft.com/addons/detail/";function Gu(t){const{icon:e,title:r,link:n}=t;return ge.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[ge.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,ge.jsx(u8,{className:"xc-ml-auto xc-text-gray-400"})]})}function CZ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${EZ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${SZ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${AZ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${PZ}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${MZ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${IZ}${t.edge_addon_id}`),e}function C7(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=CZ(r);return ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),ge.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),ge.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),ge.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&ge.jsx(Gu,{link:n.chromeStoreLink,icon:`${Vu}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&ge.jsx(Gu,{link:n.appStoreLink,icon:`${Vu}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&ge.jsx(Gu,{link:n.playStoreLink,icon:`${Vu}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&ge.jsx(Gu,{link:n.edgeStoreLink,icon:`${Vu}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&ge.jsx(Gu,{link:n.braveStoreLink,icon:`${Vu}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&ge.jsx(Gu,{link:n.firefoxStoreLink,icon:`${Vu}#firefox`,title:"Mozilla Firefox"})]})]})}function TZ(t){const{wallet:e}=t,[r,n]=Se.useState(e.installed?"connect":"qr"),i=Mb();async function s(o,a){var l;const u=await va.walletLogin({account_type:"block_chain",account_enum:"C",connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&ge.jsx(M7,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&ge.jsx(I7,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&ge.jsx(C7,{wallet:e})]})}function RZ(t){const{wallet:e,onClick:r}=t,n=ge.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return ge.jsx(Eb,{icon:n,title:i,onClick:()=>r(e)})}function T7(t){const{connector:e}=t,[r,n]=Se.useState(),[i,s]=Se.useState([]),o=Se.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d),console.log(d)}Se.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[ge.jsx(l8,{className:"xc-shrink-0 xc-opacity-50"}),ge.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),ge.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>ge.jsx(RZ,{wallet:d,onClick:l},d.name))})]})}var R7={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,$[H+1]=V>>16&255,$[H+2]=V>>8&255,$[H+3]=V&255,$[H+4]=C>>24&255,$[H+5]=C>>16&255,$[H+6]=C>>8&255,$[H+7]=C&255}function N($,H,V,C,Y){var q,oe=0;for(q=0;q>>8)-1}function D($,H,V,C){return N($,H,V,C,16)}function k($,H,V,C){return N($,H,V,C,32)}function B($,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,Ue=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=oe,wt=pe,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;dt=dt+Y|0,_t=_t+q|0,ot=ot+oe|0,wt=wt+pe|0,lt=lt+xe|0,at=at+Re|0,Ae=Ae+De|0,Pe=Pe+it|0,Ge=Ge+Ue|0,je=je+gt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=_t>>>0&255,$[5]=_t>>>8&255,$[6]=_t>>>16&255,$[7]=_t>>>24&255,$[8]=ot>>>0&255,$[9]=ot>>>8&255,$[10]=ot>>>16&255,$[11]=ot>>>24&255,$[12]=wt>>>0&255,$[13]=wt>>>8&255,$[14]=wt>>>16&255,$[15]=wt>>>24&255,$[16]=lt>>>0&255,$[17]=lt>>>8&255,$[18]=lt>>>16&255,$[19]=lt>>>24&255,$[20]=at>>>0&255,$[21]=at>>>8&255,$[22]=at>>>16&255,$[23]=at>>>24&255,$[24]=Ae>>>0&255,$[25]=Ae>>>8&255,$[26]=Ae>>>16&255,$[27]=Ae>>>24&255,$[28]=Pe>>>0&255,$[29]=Pe>>>8&255,$[30]=Pe>>>16&255,$[31]=Pe>>>24&255,$[32]=Ge>>>0&255,$[33]=Ge>>>8&255,$[34]=Ge>>>16&255,$[35]=Ge>>>24&255,$[36]=je>>>0&255,$[37]=je>>>8&255,$[38]=je>>>16&255,$[39]=je>>>24&255,$[40]=qe>>>0&255,$[41]=qe>>>8&255,$[42]=qe>>>16&255,$[43]=qe>>>24&255,$[44]=Xe>>>0&255,$[45]=Xe>>>8&255,$[46]=Xe>>>16&255,$[47]=Xe>>>24&255,$[48]=kt>>>0&255,$[49]=kt>>>8&255,$[50]=kt>>>16&255,$[51]=kt>>>24&255,$[52]=Wt>>>0&255,$[53]=Wt>>>8&255,$[54]=Wt>>>16&255,$[55]=Wt>>>24&255,$[56]=Zt>>>0&255,$[57]=Zt>>>8&255,$[58]=Zt>>>16&255,$[59]=Zt>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255}function j($,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,Ue=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=oe,wt=pe,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=at>>>0&255,$[5]=at>>>8&255,$[6]=at>>>16&255,$[7]=at>>>24&255,$[8]=qe>>>0&255,$[9]=qe>>>8&255,$[10]=qe>>>16&255,$[11]=qe>>>24&255,$[12]=Kt>>>0&255,$[13]=Kt>>>8&255,$[14]=Kt>>>16&255,$[15]=Kt>>>24&255,$[16]=Ae>>>0&255,$[17]=Ae>>>8&255,$[18]=Ae>>>16&255,$[19]=Ae>>>24&255,$[20]=Pe>>>0&255,$[21]=Pe>>>8&255,$[22]=Pe>>>16&255,$[23]=Pe>>>24&255,$[24]=Ge>>>0&255,$[25]=Ge>>>8&255,$[26]=Ge>>>16&255,$[27]=Ge>>>24&255,$[28]=je>>>0&255,$[29]=je>>>8&255,$[30]=je>>>16&255,$[31]=je>>>24&255}function U($,H,V,C){B($,H,V,C)}function K($,H,V,C){j($,H,V,C)}var J=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T($,H,V,C,Y,q,oe){var pe=new Uint8Array(16),xe=new Uint8Array(64),Re,De;for(De=0;De<16;De++)pe[De]=0;for(De=0;De<8;De++)pe[De]=q[De];for(;Y>=64;){for(U(xe,pe,oe,J),De=0;De<64;De++)$[H+De]=V[C+De]^xe[De];for(Re=1,De=8;De<16;De++)Re=Re+(pe[De]&255)|0,pe[De]=Re&255,Re>>>=8;Y-=64,H+=64,C+=64}if(Y>0)for(U(xe,pe,oe,J),De=0;De=64;){for(U(oe,q,Y,J),xe=0;xe<64;xe++)$[H+xe]=oe[xe];for(pe=1,xe=8;xe<16;xe++)pe=pe+(q[xe]&255)|0,q[xe]=pe&255,pe>>>=8;V-=64,H+=64}if(V>0)for(U(oe,q,Y,J),xe=0;xe>>13|V<<3)&8191,C=$[4]&255|($[5]&255)<<8,this.r[2]=(V>>>10|C<<6)&7939,Y=$[6]&255|($[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,q=$[8]&255|($[9]&255)<<8,this.r[4]=(Y>>>4|q<<12)&255,this.r[5]=q>>>1&8190,oe=$[10]&255|($[11]&255)<<8,this.r[6]=(q>>>14|oe<<2)&8191,pe=$[12]&255|($[13]&255)<<8,this.r[7]=(oe>>>11|pe<<5)&8065,xe=$[14]&255|($[15]&255)<<8,this.r[8]=(pe>>>8|xe<<8)&8191,this.r[9]=xe>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};G.prototype.blocks=function($,H,V){for(var C=this.fin?0:2048,Y,q,oe,pe,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Ae=this.h[3],Pe=this.h[4],Ge=this.h[5],je=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],de=this.r[3],nr=this.r[4],dr=this.r[5],pr=this.r[6],Qt=this.r[7],gr=this.r[8],lr=this.r[9];V>=16;)Y=$[H+0]&255|($[H+1]&255)<<8,wt+=Y&8191,q=$[H+2]&255|($[H+3]&255)<<8,lt+=(Y>>>13|q<<3)&8191,oe=$[H+4]&255|($[H+5]&255)<<8,at+=(q>>>10|oe<<6)&8191,pe=$[H+6]&255|($[H+7]&255)<<8,Ae+=(oe>>>7|pe<<9)&8191,xe=$[H+8]&255|($[H+9]&255)<<8,Pe+=(pe>>>4|xe<<12)&8191,Ge+=xe>>>1&8191,Re=$[H+10]&255|($[H+11]&255)<<8,je+=(xe>>>14|Re<<2)&8191,De=$[H+12]&255|($[H+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=$[H+14]&255|($[H+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,Ue=0,gt=Ue,gt+=wt*Wt,gt+=lt*(5*lr),gt+=at*(5*gr),gt+=Ae*(5*Qt),gt+=Pe*(5*pr),Ue=gt>>>13,gt&=8191,gt+=Ge*(5*dr),gt+=je*(5*nr),gt+=qe*(5*de),gt+=Xe*(5*Kt),gt+=kt*(5*Zt),Ue+=gt>>>13,gt&=8191,st=Ue,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Ae*(5*gr),st+=Pe*(5*Qt),Ue=st>>>13,st&=8191,st+=Ge*(5*pr),st+=je*(5*dr),st+=qe*(5*nr),st+=Xe*(5*de),st+=kt*(5*Kt),Ue+=st>>>13,st&=8191,tt=Ue,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Ae*(5*lr),tt+=Pe*(5*gr),Ue=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=je*(5*pr),tt+=qe*(5*dr),tt+=Xe*(5*nr),tt+=kt*(5*de),Ue+=tt>>>13,tt&=8191,At=Ue,At+=wt*de,At+=lt*Kt,At+=at*Zt,At+=Ae*Wt,At+=Pe*(5*lr),Ue=At>>>13,At&=8191,At+=Ge*(5*gr),At+=je*(5*Qt),At+=qe*(5*pr),At+=Xe*(5*dr),At+=kt*(5*nr),Ue+=At>>>13,At&=8191,Rt=Ue,Rt+=wt*nr,Rt+=lt*de,Rt+=at*Kt,Rt+=Ae*Zt,Rt+=Pe*Wt,Ue=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=je*(5*gr),Rt+=qe*(5*Qt),Rt+=Xe*(5*pr),Rt+=kt*(5*dr),Ue+=Rt>>>13,Rt&=8191,Mt=Ue,Mt+=wt*dr,Mt+=lt*nr,Mt+=at*de,Mt+=Ae*Kt,Mt+=Pe*Zt,Ue=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=je*(5*lr),Mt+=qe*(5*gr),Mt+=Xe*(5*Qt),Mt+=kt*(5*pr),Ue+=Mt>>>13,Mt&=8191,Et=Ue,Et+=wt*pr,Et+=lt*dr,Et+=at*nr,Et+=Ae*de,Et+=Pe*Kt,Ue=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=je*Wt,Et+=qe*(5*lr),Et+=Xe*(5*gr),Et+=kt*(5*Qt),Ue+=Et>>>13,Et&=8191,dt=Ue,dt+=wt*Qt,dt+=lt*pr,dt+=at*dr,dt+=Ae*nr,dt+=Pe*de,Ue=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=je*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*gr),Ue+=dt>>>13,dt&=8191,_t=Ue,_t+=wt*gr,_t+=lt*Qt,_t+=at*pr,_t+=Ae*dr,_t+=Pe*nr,Ue=_t>>>13,_t&=8191,_t+=Ge*de,_t+=je*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),Ue+=_t>>>13,_t&=8191,ot=Ue,ot+=wt*lr,ot+=lt*gr,ot+=at*Qt,ot+=Ae*pr,ot+=Pe*dr,Ue=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=je*de,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,Ue+=ot>>>13,ot&=8191,Ue=(Ue<<2)+Ue|0,Ue=Ue+gt|0,gt=Ue&8191,Ue=Ue>>>13,st+=Ue,wt=gt,lt=st,at=tt,Ae=At,Pe=Rt,Ge=Mt,je=Et,qe=dt,Xe=_t,kt=ot,H+=16,V-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Ae,this.h[4]=Pe,this.h[5]=Ge,this.h[6]=je,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},G.prototype.finish=function($,H){var V=new Uint16Array(10),C,Y,q,oe;if(this.leftover){for(oe=this.leftover,this.buffer[oe++]=1;oe<16;oe++)this.buffer[oe]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,oe=2;oe<10;oe++)this.h[oe]+=C,C=this.h[oe]>>>13,this.h[oe]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,V[0]=this.h[0]+5,C=V[0]>>>13,V[0]&=8191,oe=1;oe<10;oe++)V[oe]=this.h[oe]+C,C=V[oe]>>>13,V[oe]&=8191;for(V[9]-=8192,Y=(C^1)-1,oe=0;oe<10;oe++)V[oe]&=Y;for(Y=~Y,oe=0;oe<10;oe++)this.h[oe]=this.h[oe]&Y|V[oe];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,q=this.h[0]+this.pad[0],this.h[0]=q&65535,oe=1;oe<8;oe++)q=(this.h[oe]+this.pad[oe]|0)+(q>>>16)|0,this.h[oe]=q&65535;$[H+0]=this.h[0]>>>0&255,$[H+1]=this.h[0]>>>8&255,$[H+2]=this.h[1]>>>0&255,$[H+3]=this.h[1]>>>8&255,$[H+4]=this.h[2]>>>0&255,$[H+5]=this.h[2]>>>8&255,$[H+6]=this.h[3]>>>0&255,$[H+7]=this.h[3]>>>8&255,$[H+8]=this.h[4]>>>0&255,$[H+9]=this.h[4]>>>8&255,$[H+10]=this.h[5]>>>0&255,$[H+11]=this.h[5]>>>8&255,$[H+12]=this.h[6]>>>0&255,$[H+13]=this.h[6]>>>8&255,$[H+14]=this.h[7]>>>0&255,$[H+15]=this.h[7]>>>8&255},G.prototype.update=function($,H,V){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>V&&(Y=V),C=0;C=16&&(Y=V-V%16,this.blocks($,H,Y),H+=Y,V-=Y),V){for(C=0;C>16&1),q[V-1]&=65535;q[15]=oe[15]-32767-(q[14]>>16&1),Y=q[15]>>16&1,q[14]&=65535,_(oe,q,1-Y)}for(V=0;V<16;V++)$[2*V]=oe[V]&255,$[2*V+1]=oe[V]>>8}function b($,H){var V=new Uint8Array(32),C=new Uint8Array(32);return S(V,$),S(C,H),k(V,0,C,0)}function M($){var H=new Uint8Array(32);return S(H,$),H[0]&1}function I($,H){var V;for(V=0;V<16;V++)$[V]=H[2*V]+(H[2*V+1]<<8);$[15]&=32767}function F($,H,V){for(var C=0;C<16;C++)$[C]=H[C]+V[C]}function ae($,H,V){for(var C=0;C<16;C++)$[C]=H[C]-V[C]}function O($,H,V){var C,Y,q=0,oe=0,pe=0,xe=0,Re=0,De=0,it=0,Ue=0,gt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Ae=0,Pe=0,Ge=0,je=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,de=V[0],nr=V[1],dr=V[2],pr=V[3],Qt=V[4],gr=V[5],lr=V[6],Lr=V[7],mr=V[8],wr=V[9],Br=V[10],$r=V[11],Ir=V[12],hn=V[13],dn=V[14],pn=V[15];C=H[0],q+=C*de,oe+=C*nr,pe+=C*dr,xe+=C*pr,Re+=C*Qt,De+=C*gr,it+=C*lr,Ue+=C*Lr,gt+=C*mr,st+=C*wr,tt+=C*Br,At+=C*$r,Rt+=C*Ir,Mt+=C*hn,Et+=C*dn,dt+=C*pn,C=H[1],oe+=C*de,pe+=C*nr,xe+=C*dr,Re+=C*pr,De+=C*Qt,it+=C*gr,Ue+=C*lr,gt+=C*Lr,st+=C*mr,tt+=C*wr,At+=C*Br,Rt+=C*$r,Mt+=C*Ir,Et+=C*hn,dt+=C*dn,_t+=C*pn,C=H[2],pe+=C*de,xe+=C*nr,Re+=C*dr,De+=C*pr,it+=C*Qt,Ue+=C*gr,gt+=C*lr,st+=C*Lr,tt+=C*mr,At+=C*wr,Rt+=C*Br,Mt+=C*$r,Et+=C*Ir,dt+=C*hn,_t+=C*dn,ot+=C*pn,C=H[3],xe+=C*de,Re+=C*nr,De+=C*dr,it+=C*pr,Ue+=C*Qt,gt+=C*gr,st+=C*lr,tt+=C*Lr,At+=C*mr,Rt+=C*wr,Mt+=C*Br,Et+=C*$r,dt+=C*Ir,_t+=C*hn,ot+=C*dn,wt+=C*pn,C=H[4],Re+=C*de,De+=C*nr,it+=C*dr,Ue+=C*pr,gt+=C*Qt,st+=C*gr,tt+=C*lr,At+=C*Lr,Rt+=C*mr,Mt+=C*wr,Et+=C*Br,dt+=C*$r,_t+=C*Ir,ot+=C*hn,wt+=C*dn,lt+=C*pn,C=H[5],De+=C*de,it+=C*nr,Ue+=C*dr,gt+=C*pr,st+=C*Qt,tt+=C*gr,At+=C*lr,Rt+=C*Lr,Mt+=C*mr,Et+=C*wr,dt+=C*Br,_t+=C*$r,ot+=C*Ir,wt+=C*hn,lt+=C*dn,at+=C*pn,C=H[6],it+=C*de,Ue+=C*nr,gt+=C*dr,st+=C*pr,tt+=C*Qt,At+=C*gr,Rt+=C*lr,Mt+=C*Lr,Et+=C*mr,dt+=C*wr,_t+=C*Br,ot+=C*$r,wt+=C*Ir,lt+=C*hn,at+=C*dn,Ae+=C*pn,C=H[7],Ue+=C*de,gt+=C*nr,st+=C*dr,tt+=C*pr,At+=C*Qt,Rt+=C*gr,Mt+=C*lr,Et+=C*Lr,dt+=C*mr,_t+=C*wr,ot+=C*Br,wt+=C*$r,lt+=C*Ir,at+=C*hn,Ae+=C*dn,Pe+=C*pn,C=H[8],gt+=C*de,st+=C*nr,tt+=C*dr,At+=C*pr,Rt+=C*Qt,Mt+=C*gr,Et+=C*lr,dt+=C*Lr,_t+=C*mr,ot+=C*wr,wt+=C*Br,lt+=C*$r,at+=C*Ir,Ae+=C*hn,Pe+=C*dn,Ge+=C*pn,C=H[9],st+=C*de,tt+=C*nr,At+=C*dr,Rt+=C*pr,Mt+=C*Qt,Et+=C*gr,dt+=C*lr,_t+=C*Lr,ot+=C*mr,wt+=C*wr,lt+=C*Br,at+=C*$r,Ae+=C*Ir,Pe+=C*hn,Ge+=C*dn,je+=C*pn,C=H[10],tt+=C*de,At+=C*nr,Rt+=C*dr,Mt+=C*pr,Et+=C*Qt,dt+=C*gr,_t+=C*lr,ot+=C*Lr,wt+=C*mr,lt+=C*wr,at+=C*Br,Ae+=C*$r,Pe+=C*Ir,Ge+=C*hn,je+=C*dn,qe+=C*pn,C=H[11],At+=C*de,Rt+=C*nr,Mt+=C*dr,Et+=C*pr,dt+=C*Qt,_t+=C*gr,ot+=C*lr,wt+=C*Lr,lt+=C*mr,at+=C*wr,Ae+=C*Br,Pe+=C*$r,Ge+=C*Ir,je+=C*hn,qe+=C*dn,Xe+=C*pn,C=H[12],Rt+=C*de,Mt+=C*nr,Et+=C*dr,dt+=C*pr,_t+=C*Qt,ot+=C*gr,wt+=C*lr,lt+=C*Lr,at+=C*mr,Ae+=C*wr,Pe+=C*Br,Ge+=C*$r,je+=C*Ir,qe+=C*hn,Xe+=C*dn,kt+=C*pn,C=H[13],Mt+=C*de,Et+=C*nr,dt+=C*dr,_t+=C*pr,ot+=C*Qt,wt+=C*gr,lt+=C*lr,at+=C*Lr,Ae+=C*mr,Pe+=C*wr,Ge+=C*Br,je+=C*$r,qe+=C*Ir,Xe+=C*hn,kt+=C*dn,Wt+=C*pn,C=H[14],Et+=C*de,dt+=C*nr,_t+=C*dr,ot+=C*pr,wt+=C*Qt,lt+=C*gr,at+=C*lr,Ae+=C*Lr,Pe+=C*mr,Ge+=C*wr,je+=C*Br,qe+=C*$r,Xe+=C*Ir,kt+=C*hn,Wt+=C*dn,Zt+=C*pn,C=H[15],dt+=C*de,_t+=C*nr,ot+=C*dr,wt+=C*pr,lt+=C*Qt,at+=C*gr,Ae+=C*lr,Pe+=C*Lr,Ge+=C*mr,je+=C*wr,qe+=C*Br,Xe+=C*$r,kt+=C*Ir,Wt+=C*hn,Zt+=C*dn,Kt+=C*pn,q+=38*_t,oe+=38*ot,pe+=38*wt,xe+=38*lt,Re+=38*at,De+=38*Ae,it+=38*Pe,Ue+=38*Ge,gt+=38*je,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),$[0]=q,$[1]=oe,$[2]=pe,$[3]=xe,$[4]=Re,$[5]=De,$[6]=it,$[7]=Ue,$[8]=gt,$[9]=st,$[10]=tt,$[11]=At,$[12]=Rt,$[13]=Mt,$[14]=Et,$[15]=dt}function se($,H){O($,H,H)}function ee($,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=253;C>=0;C--)se(V,V),C!==2&&C!==4&&O(V,V,H);for(C=0;C<16;C++)$[C]=V[C]}function X($,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=250;C>=0;C--)se(V,V),C!==1&&O(V,V,H);for(C=0;C<16;C++)$[C]=V[C]}function Q($,H,V){var C=new Uint8Array(32),Y=new Float64Array(80),q,oe,pe=r(),xe=r(),Re=r(),De=r(),it=r(),Ue=r();for(oe=0;oe<31;oe++)C[oe]=H[oe];for(C[31]=H[31]&127|64,C[0]&=248,I(Y,V),oe=0;oe<16;oe++)xe[oe]=Y[oe],De[oe]=pe[oe]=Re[oe]=0;for(pe[0]=De[0]=1,oe=254;oe>=0;--oe)q=C[oe>>>3]>>>(oe&7)&1,_(pe,xe,q),_(Re,De,q),F(it,pe,Re),ae(pe,pe,Re),F(Re,xe,De),ae(xe,xe,De),se(De,it),se(Ue,pe),O(pe,Re,pe),O(Re,xe,it),F(it,pe,Re),ae(pe,pe,Re),se(xe,pe),ae(Re,De,Ue),O(pe,Re,u),F(pe,pe,De),O(Re,Re,pe),O(pe,De,Ue),O(De,xe,Y),se(xe,it),_(pe,xe,q),_(Re,De,q);for(oe=0;oe<16;oe++)Y[oe+16]=pe[oe],Y[oe+32]=Re[oe],Y[oe+48]=xe[oe],Y[oe+64]=De[oe];var gt=Y.subarray(32),st=Y.subarray(16);return ee(gt,gt),O(st,st,gt),S($,st),0}function R($,H){return Q($,H,s)}function Z($,H){return n(H,32),R($,H)}function te($,H,V){var C=new Uint8Array(32);return Q(C,V,H),K($,i,C,J)}var le=f,ie=p;function fe($,H,V,C,Y,q){var oe=new Uint8Array(32);return te(oe,Y,q),le($,H,V,C,oe)}function ve($,H,V,C,Y,q){var oe=new Uint8Array(32);return te(oe,Y,q),ie($,H,V,C,oe)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne($,H,V,C){for(var Y=new Int32Array(16),q=new Int32Array(16),oe,pe,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Ae,Pe,Ge,je,qe,Xe,kt=$[0],Wt=$[1],Zt=$[2],Kt=$[3],de=$[4],nr=$[5],dr=$[6],pr=$[7],Qt=H[0],gr=H[1],lr=H[2],Lr=H[3],mr=H[4],wr=H[5],Br=H[6],$r=H[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=V[at+0]<<24|V[at+1]<<16|V[at+2]<<8|V[at+3],q[lt]=V[at+4]<<24|V[at+5]<<16|V[at+6]<<8|V[at+7];for(lt=0;lt<80;lt++)if(oe=kt,pe=Wt,xe=Zt,Re=Kt,De=de,it=nr,Ue=dr,gt=pr,st=Qt,tt=gr,At=lr,Rt=Lr,Mt=mr,Et=wr,dt=Br,_t=$r,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(de>>>14|mr<<18)^(de>>>18|mr<<14)^(mr>>>9|de<<23),Pe=(mr>>>14|de<<18)^(mr>>>18|de<<14)^(de>>>9|mr<<23),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=de&nr^~de&dr,Pe=mr&wr^~mr&Br,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Me[lt*2],Pe=Me[lt*2+1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Y[lt%16],Pe=q[lt%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|je<<16,Ae=ot,Pe=wt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Pe=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=kt&Wt^kt&Zt^Wt&Zt,Pe=Qt&gr^Qt&lr^gr&lr,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,gt=qe&65535|Xe<<16,_t=Ge&65535|je<<16,Ae=Re,Pe=Rt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=ot,Pe=wt,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|je<<16,Wt=oe,Zt=pe,Kt=xe,de=Re,nr=De,dr=it,pr=Ue,kt=gt,gr=st,lr=tt,Lr=At,mr=Rt,wr=Mt,Br=Et,$r=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Ae=Y[at],Pe=q[at],Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=Y[(at+9)%16],Pe=q[(at+9)%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+1)%16],wt=q[(at+1)%16],Ae=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Pe=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+14)%16],wt=q[(at+14)%16],Ae=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Pe=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,q[at]=Ge&65535|je<<16;Ae=kt,Pe=Qt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[0],Pe=H[0],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[0]=kt=qe&65535|Xe<<16,H[0]=Qt=Ge&65535|je<<16,Ae=Wt,Pe=gr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[1],Pe=H[1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[1]=Wt=qe&65535|Xe<<16,H[1]=gr=Ge&65535|je<<16,Ae=Zt,Pe=lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[2],Pe=H[2],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[2]=Zt=qe&65535|Xe<<16,H[2]=lr=Ge&65535|je<<16,Ae=Kt,Pe=Lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[3],Pe=H[3],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[3]=Kt=qe&65535|Xe<<16,H[3]=Lr=Ge&65535|je<<16,Ae=de,Pe=mr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[4],Pe=H[4],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[4]=de=qe&65535|Xe<<16,H[4]=mr=Ge&65535|je<<16,Ae=nr,Pe=wr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[5],Pe=H[5],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[5]=nr=qe&65535|Xe<<16,H[5]=wr=Ge&65535|je<<16,Ae=dr,Pe=Br,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[6],Pe=H[6],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[6]=dr=qe&65535|Xe<<16,H[6]=Br=Ge&65535|je<<16,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[7],Pe=H[7],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[7]=pr=qe&65535|Xe<<16,H[7]=$r=Ge&65535|je<<16,Ir+=128,C-=128}return C}function Te($,H,V){var C=new Int32Array(8),Y=new Int32Array(8),q=new Uint8Array(256),oe,pe=V;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,H,V),V%=128,oe=0;oe=0;--Y)C=V[Y/8|0]>>(Y&7)&1,Ie($,H,C),$e(H,$),$e($,$),Ie($,H,C)}function ke($,H){var V=[r(),r(),r(),r()];v(V[0],g),v(V[1],y),v(V[2],a),O(V[3],g,y),Ve($,V,H)}function ze($,H,V){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],q;for(V||n(H,32),Te(C,H,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le($,Y),q=0;q<32;q++)H[q+32]=$[q];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Ee($,H){var V,C,Y,q;for(C=63;C>=32;--C){for(V=0,Y=C-32,q=C-12;Y>4)*He[Y],V=H[Y]>>8,H[Y]&=255;for(Y=0;Y<32;Y++)H[Y]-=V*He[Y];for(C=0;C<32;C++)H[C+1]+=H[C]>>8,$[C]=H[C]&255}function Qe($){var H=new Float64Array(64),V;for(V=0;V<64;V++)H[V]=$[V];for(V=0;V<64;V++)$[V]=0;Ee($,H)}function ct($,H,V,C){var Y=new Uint8Array(64),q=new Uint8Array(64),oe=new Uint8Array(64),pe,xe,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=V+64;for(pe=0;pe>7&&ae($[0],o,$[0]),O($[3],$[0],$[1]),0)}function et($,H,V,C){var Y,q=new Uint8Array(32),oe=new Uint8Array(64),pe=[r(),r(),r(),r()],xe=[r(),r(),r(),r()];if(V<64||Be(xe,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var $=new Uint8Array(vt),H=new Uint8Array(Dt);return ze($,H),{publicKey:$,secretKey:H}},e.sign.keyPair.fromSecretKey=function($){if(nt($),$.length!==Dt)throw new Error("bad secret key size");for(var H=new Uint8Array(vt),V=0;V=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function Ib(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function Y0(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new Ut("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new Ut("Delay aborted"))})})})}function As(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function fh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=As(e==null?void 0:e.signal);if(typeof t!="function")throw new Ut(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=g??null,o==null||o.abort(),o=As(g),o.signal.aborted)throw new Ut("Resource creation was aborted");n=y??null;const A=t(o.signal,...y);i=A;const P=yield A;if(i!==A&&P!==r)throw yield e(P),new Ut("Resource creation was aborted by a new resource creation");return r=P,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const g=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([g?e(g):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:g=>Pt(this,void 0,void 0,function*(){const y=r,A=i,P=n,O=s;if(yield j7(g),y===r&&A===i&&P===n&&O===s)return yield a(s,...P??[]);throw new Ut("Resource recreation was aborted by a new resource creation")})}}function GZ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=As(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new Ut("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new Ut(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new Ut("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class kb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=VZ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield YZ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new qZ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(F7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=k7.encode(e);yield fh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new Ut(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Uo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Uo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new Ut(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new Ut("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),Sn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Ut("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new Ut(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function YZ(t){return Pt(this,void 0,void 0,function*(){return yield GZ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=As(n.signal).signal;if(o.aborted){r(new Ut("Bridge connection aborted"));return}const a=new URL(F7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new Ut("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}try{const g=yield t.errorHandler(l,d);g!==l&&l.close(),g&&g!==l&&e(g)}catch(g){l.close(),r(g)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new Ut("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function lh(t){return!("connectEvent"in t)}class hh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!lh(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Rb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Rb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");if(!lh(e))throw new Ut("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new Ut("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!lh(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const U7=2;class dh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new hh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getHttpConnection();return lh(n)?new dh(e,n.connectionSource):new dh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=As(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Rb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield fh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(lh(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new Ut("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new kb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield fh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Ut("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),Y0(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=As(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){Sn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(k7.decode(e.message).toUint8Array(),Y0(e.from)));if(Sn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){Sn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Uo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(Sn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new Ut(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return HZ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",U7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+WZ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new kb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>fh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new kb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function q7(t,e){return z7(t,[e])}function z7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function JZ(t){try{return!q7(t,"tonconnect")||!q7(t.tonconnect,"walletInfo")?!1:z7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Ju{constructor(){this.storage={}}static getInstance(){return Ju.instance||(Ju.instance=new Ju),Ju.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function np(){if(!(typeof window>"u"))return window}function XZ(){const t=np();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function ZZ(){if(!(typeof document>"u"))return document}function QZ(){var t;const e=(t=np())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function eQ(){if(tQ())return localStorage;if(rQ())throw new Ut("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Ju.getInstance()}function tQ(){try{return typeof localStorage<"u"}catch{return!1}}function rQ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class xi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=xi.window;if(!xi.isWindowContainsWallet(n,r))throw new Nb;this.connectionStorage=new hh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getInjectedConnection();return new xi(e,n.jsBridgeKey)})}static isWalletInjected(e){return xi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return xi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?XZ().filter(([n,i])=>JZ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(U7,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{Sn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();Sn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){Sn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>Sn("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{Sn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);Sn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){Sn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{Sn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}xi.window=np();class nQ{constructor(){this.localStorage=eQ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function H7(t){return sQ(t)&&t.injected}function iQ(t){return H7(t)&&t.embedded}function sQ(t){return"jsBridgeKey"in t}const oQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class Bb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(iQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new Lb("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Uo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Uo(n),e=oQ}let r=[];try{r=xi.getCurrentlyInjectedWallets()}catch(n){Uo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=xi.isWalletInjected(o),i.embedded=xi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class ip extends Ut{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,ip.prototype)}}function aQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new ip("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function mQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Zu(t,e)),$b(e,r))}function vQ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Zu(t,e)),$b(e,r))}function bQ(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Zu(t,e)),$b(e,r))}function yQ(t,e,r){return Object.assign({type:"disconnection",scope:r},Zu(t,e))}class wQ{constructor(){this.window=np()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class xQ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new wQ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Xu({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",uQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",cQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=fQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=lQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=hQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=dQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=pQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=gQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=yQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=mQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=vQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=bQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const _Q="3.0.5";class ph{constructor(e){if(this.walletsList=new Bb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||QZ(),storage:(e==null?void 0:e.storage)||new nQ},this.walletsList=new Bb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new xQ({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:_Q}),!this.dappSettings.manifestUrl)throw new Db("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new hh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Ob;const o=As(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new Ut("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield dh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield xi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Uo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=fh(g=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:g.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(g=>setTimeout(()=>g(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=As(n==null?void 0:n.signal);if(i.signal.aborted)throw new Ut("Transaction sending was aborted");this.checkConnection(),aQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=kZ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(rp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(rp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),rp.parseAndThrowError(l);const d=rp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new Z0;const n=As(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Ut("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=ZZ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Uo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&BZ(e)?r=new xi(this.dappSettings.storage,e.jsBridgeKey):r=new dh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new Ut("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=FZ.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),Sn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof X0||r instanceof J0)throw Uo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new Z0}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}ph.walletsList=new Bb,ph.isWalletInjected=t=>xi.isWalletInjected(t),ph.isInsideWalletBrowser=t=>xi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function Fb(t){const{children:e,onClick:r}=t;return le.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function W7(t){const{wallet:e,connector:r,loading:n}=t,i=Se.useRef(null),s=Se.useRef(),[o,a]=Se.useState(),[u,l]=Se.useState(),[d,g]=Se.useState("connect"),[y,A]=Se.useState(!1),[P,O]=Se.useState();function D(z){var ue;(ue=s.current)==null||ue.update({data:z})}async function k(){A(!0);try{a("");const z=await No.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ue=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:z}});if(!ue)return;O(ue),D(ue),l(z)}}catch(z){a(z.message)}A(!1)}function B(){s.current=new _7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function j(){r.connect(e,{request:{tonProof:u}})}function U(){if("deepLink"in e){if(!e.deepLink||!P)return;const z=new URL(P),ue=`${e.deepLink}${z.search}`;window.open(ue)}}function K(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(P)}const J=Se.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),T=Se.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Se.useEffect(()=>{B(),k()},[]),le.jsxs(ro,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Ac,{title:"Connect wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-text-center xc-mb-6",children:[le.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[le.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),le.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?le.jsx(ya,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):le.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),le.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),le.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&le.jsx(ya,{className:"xc-animate-spin"}),!y&&!n&&le.jsxs(le.Fragment,{children:[H7(e)&&le.jsxs(Fb,{onClick:j,children:[le.jsx(kK,{className:"xc-opacity-80"}),"Extension"]}),J&&le.jsxs(Fb,{onClick:U,children:[le.jsx(l8,{className:"xc-opacity-80"}),"Desktop"]}),T&&le.jsx(Fb,{onClick:K,children:"Telegram Mini App"})]})]})]})}function EQ(t){const[e,r]=Se.useState(""),[n,i]=Se.useState(),[s,o]=Se.useState(),a=Cb(),[u,l]=Se.useState(!1);async function d(y){var P,O;if(!y||!((P=y.connectItems)!=null&&P.tonProof))return;l(!0);const A=await No.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(O=y.connectItems)==null?void 0:O.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(A.data),l(!1)}Se.useEffect(()=>{const y=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),A=y.onStatusChange(d);return o(y),r("select"),A},[]);function g(y){r("connect"),i(y)}return le.jsxs(ro,{children:[e==="select"&&le.jsx(C7,{connector:s,onSelect:g,onBack:t.onBack}),e==="connect"&&le.jsx(W7,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function K7(t){const{children:e,className:r}=t,n=Se.useRef(null),[i,s]=Se.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Se.useEffect(()=>{console.log("maxHeight",i)},[i]),le.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function SQ(){return le.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[le.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),le.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function V7(t){const{wallets:e}=Kl(),[r,n]=Se.useState(),i=Se.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return le.jsxs(ro,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Ac,{title:"Select wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[le.jsx(d8,{className:"xc-shrink-0 xc-opacity-50"}),le.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),le.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>le.jsx(r7,{wallet:a,onClick:s},`feature-${a.key}`)):le.jsx(SQ,{})})]})}function AQ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Se.useState(""),[l,d]=Se.useState(null),[g,y]=Se.useState("");function A(k){d(k),u("evm-wallet")}function P(k){u("email"),y(k)}async function O(k){await e(k)}function D(){u("ton-wallet")}return Se.useEffect(()=>{u("index")},[]),le.jsx(iZ,{config:t.config,children:le.jsxs(K7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&le.jsx(PZ,{onBack:()=>u("index"),onLogin:O,wallet:l}),a==="ton-wallet"&&le.jsx(EQ,{onBack:()=>u("index"),onLogin:O}),a==="email"&&le.jsx(sZ,{email:g,onBack:()=>u("index"),onLogin:O}),a==="index"&&le.jsx(h7,{header:r,onEmailConfirm:P,onSelectWallet:A,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&le.jsx(V7,{onBack:()=>u("index"),onSelectWallet:A})]})})}function PQ(t){const{wallet:e,onConnect:r}=t,[n,i]=Se.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return le.jsxs(ro,{children:[le.jsx("div",{className:"mb-6",children:le.jsx(Ac,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&le.jsx(P7,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&le.jsx(M7,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&le.jsx(I7,{wallet:e})]})}function MQ(t){const{email:e}=t,[r,n]=Se.useState(0),[i,s]=Se.useState(!1),[o,a]=Se.useState(!1),[u,l]=Se.useState(""),[d,g]=Se.useState("");async function y(){n(60);const O=setInterval(()=>{n(D=>D===0?(clearInterval(O),0):D-1)},1e3)}async function A(O){a(!0);try{l(""),await No.getEmailCode({account_type:"email",email:O}),y()}catch(D){l(D.message)}a(!1)}Se.useEffect(()=>{e&&A(e)},[e]);async function P(O){if(g(""),!(O.length<6)){s(!0);try{await t.onInputCode(e,O)}catch(D){g(D.message)}s(!1)}}return le.jsxs(ro,{children:[le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[le.jsx(h8,{className:"xc-mb-4",size:60}),le.jsx("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:u?le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{className:"xc-px-8",children:u})}):o?le.jsx(ya,{className:"xc-animate-spin"}):le.jsxs(le.Fragment,{children:[le.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),le.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]})}),le.jsx("div",{className:"xc-mb-2 xc-h-12",children:le.jsx(y7,{spinning:i,className:"xc-rounded-xl",children:le.jsx(Mb,{maxLength:6,onChange:P,disabled:i,className:"disabled:xc-opacity-20",children:le.jsx(Ib,{children:le.jsxs("div",{className:no("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[le.jsx(Li,{index:0}),le.jsx(Li,{index:1}),le.jsx(Li,{index:2}),le.jsx(Li,{index:3}),le.jsx(Li,{index:4}),le.jsx(Li,{index:5})]})})})})}),d&&le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{children:d})})]}),le.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Recend in ${r}s`:le.jsx("button",{onClick:()=>A(e),children:"Send again"})]})]})}function IQ(t){const{email:e}=t;return le.jsxs(ro,{children:[le.jsx("div",{className:"xc-mb-12",children:le.jsx(Ac,{title:"Sign in with email",onBack:t.onBack})}),le.jsx(MQ,{email:e,onInputCode:t.onInputCode})]})}function CQ(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Se.useState(""),[a,u]=Se.useState(),[l,d]=Se.useState(),g=Se.useRef(),[y,A]=Se.useState("");function P(j){u(j),o("evm-wallet-connect")}function O(j){A(j),o("email-connect")}async function D(j,U){await e({chain_type:"eip155",client:j.client,connect_info:U}),o("index")}function k(j){d(j),o("ton-wallet-connect")}async function B(j){j&&await r({chain_type:"ton",client:g.current,connect_info:j})}return Se.useEffect(()=>{g.current=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const j=g.current.onStatusChange(B);return o("index"),j},[]),le.jsxs(K7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&le.jsx(V7,{onBack:()=>o("index"),onSelectWallet:P}),s==="evm-wallet-connect"&&le.jsx(PQ,{onBack:()=>o("index"),onConnect:D,wallet:a}),s==="ton-wallet-select"&&le.jsx(C7,{connector:g.current,onSelect:k,onBack:()=>o("index")}),s==="ton-wallet-connect"&&le.jsx(W7,{connector:g.current,wallet:l,onBack:()=>o("index")}),s==="email-connect"&&le.jsx(IQ,{email:y,onBack:()=>o("index"),onInputCode:n}),s==="index"&&le.jsx(h7,{onEmailConfirm:O,onSelectWallet:P,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Fn.CodattaConnect=CQ,Fn.CodattaConnectContextProvider=IK,Fn.CodattaSignin=AQ,Fn.coinbaseWallet=a8,Fn.useCodattaConnectContext=Kl,Object.defineProperty(Fn,Symbol.toStringTag,{value:"Module"})}); + ***************************************************************************** */function jZ(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new Ut("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new Ut("Delay aborted"))})})})}function As(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function fh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=As(e==null?void 0:e.signal);if(typeof t!="function")throw new Ut(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=g??null,o==null||o.abort(),o=As(g),o.signal.aborted)throw new Ut("Resource creation was aborted");n=y??null;const A=t(o.signal,...y);i=A;const P=yield A;if(i!==A&&P!==r)throw yield e(P),new Ut("Resource creation was aborted by a new resource creation");return r=P,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const g=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([g?e(g):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:g=>Pt(this,void 0,void 0,function*(){const y=r,A=i,P=n,N=s;if(yield U7(g),y===r&&A===i&&P===n&&N===s)return yield a(s,...P??[]);throw new Ut("Resource recreation was aborted by a new resource creation")})}}function ZZ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=As(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new Ut("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new Ut(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new Ut("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class Nb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=XZ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield QZ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new KZ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(j7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=B7.encode(e);yield fh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new Ut(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Fo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Fo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new Ut(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new Ut("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),Sn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Ut("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new Ut(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function QZ(t){return Pt(this,void 0,void 0,function*(){return yield ZZ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=As(n.signal).signal;if(o.aborted){r(new Ut("Bridge connection aborted"));return}const a=new URL(j7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new Ut("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}try{const g=yield t.errorHandler(l,d);g!==l&&l.close(),g&&g!==l&&e(g)}catch(g){l.close(),r(g)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new Ut("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function lh(t){return!("connectEvent"in t)}class hh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!lh(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Cb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Cb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");if(!lh(e))throw new Ut("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new Ut("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!lh(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const q7=2;class dh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new hh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getHttpConnection();return lh(n)?new dh(e,n.connectionSource):new dh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=As(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Cb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield fh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(lh(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new Ut("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Nb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield fh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Ut("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),Y0(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=As(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){Sn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(B7.decode(e.message).toUint8Array(),Y0(e.from)));if(Sn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){Sn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Fo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(Sn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new Ut(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return GZ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",q7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+YZ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new Nb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>fh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Nb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function z7(t,e){return H7(t,[e])}function H7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function eQ(t){try{return!z7(t,"tonconnect")||!z7(t.tonconnect,"walletInfo")?!1:H7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Ju{constructor(){this.storage={}}static getInstance(){return Ju.instance||(Ju.instance=new Ju),Ju.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function np(){if(!(typeof window>"u"))return window}function tQ(){const t=np();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function rQ(){if(!(typeof document>"u"))return document}function nQ(){var t;const e=(t=np())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function iQ(){if(sQ())return localStorage;if(oQ())throw new Ut("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Ju.getInstance()}function sQ(){try{return typeof localStorage<"u"}catch{return!1}}function oQ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class xi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=xi.window;if(!xi.isWindowContainsWallet(n,r))throw new Db;this.connectionStorage=new hh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getInjectedConnection();return new xi(e,n.jsBridgeKey)})}static isWalletInjected(e){return xi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return xi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?tQ().filter(([n,i])=>eQ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(q7,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{Sn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();Sn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){Sn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>Sn("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{Sn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);Sn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){Sn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{Sn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}xi.window=np();class aQ{constructor(){this.localStorage=iQ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function W7(t){return uQ(t)&&t.injected}function cQ(t){return W7(t)&&t.embedded}function uQ(t){return"jsBridgeKey"in t}const fQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class Lb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(cQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new Ob("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Fo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Fo(n),e=fQ}let r=[];try{r=xi.getCurrentlyInjectedWallets()}catch(n){Fo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=xi.isWalletInjected(o),i.embedded=xi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class ip extends Ut{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,ip.prototype)}}function lQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new ip("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function wQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Zu(t,e)),kb(e,r))}function xQ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Zu(t,e)),kb(e,r))}function _Q(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Zu(t,e)),kb(e,r))}function EQ(t,e,r){return Object.assign({type:"disconnection",scope:r},Zu(t,e))}class SQ{constructor(){this.window=np()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class AQ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new SQ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Xu({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",dQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",hQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=pQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=gQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=mQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=vQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=bQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=yQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=EQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=wQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=xQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=_Q(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const PQ="3.0.5";class ph{constructor(e){if(this.walletsList=new Lb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||nQ(),storage:(e==null?void 0:e.storage)||new aQ},this.walletsList=new Lb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new AQ({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:PQ}),!this.dappSettings.manifestUrl)throw new Tb("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new hh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Rb;const o=As(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new Ut("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield dh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield xi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Fo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=fh(g=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:g.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(g=>setTimeout(()=>g(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=As(n==null?void 0:n.signal);if(i.signal.aborted)throw new Ut("Transaction sending was aborted");this.checkConnection(),lQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=jZ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(rp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(rp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),rp.parseAndThrowError(l);const d=rp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new Z0;const n=As(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Ut("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=rQ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Fo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&UZ(e)?r=new xi(this.dappSettings.storage,e.jsBridgeKey):r=new dh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new Ut("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=zZ.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),Sn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof X0||r instanceof J0)throw Fo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new Z0}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}ph.walletsList=new Lb,ph.isWalletInjected=t=>xi.isWalletInjected(t),ph.isInsideWalletBrowser=t=>xi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function Bb(t){const{children:e,onClick:r}=t;return ge.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function K7(t){const{wallet:e,connector:r,loading:n}=t,i=Se.useRef(null),s=Se.useRef(),[o,a]=Se.useState(),[u,l]=Se.useState(),[d,g]=Se.useState("connect"),[y,A]=Se.useState(!1),[P,N]=Se.useState();function D(z){var ue;(ue=s.current)==null||ue.update({data:z})}async function k(){A(!0);try{a("");const z=await va.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ue=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:z}});if(!ue)return;N(ue),D(ue),l(z)}}catch(z){a(z.message)}A(!1)}function B(){s.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function j(){r.connect(e,{request:{tonProof:u}})}function U(){if("deepLink"in e){if(!e.deepLink||!P)return;const z=new URL(P),ue=`${e.deepLink}${z.search}`;window.open(ue)}}function K(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(P)}const J=Se.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),T=Se.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Se.useEffect(()=>{B(),k()},[]),ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-text-center xc-mb-6",children:[ge.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[ge.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),ge.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?ge.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):ge.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),ge.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),ge.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&ge.jsx(vc,{className:"xc-animate-spin"}),!y&&!n&&ge.jsxs(ge.Fragment,{children:[W7(e)&&ge.jsxs(Bb,{onClick:j,children:[ge.jsx(BK,{className:"xc-opacity-80"}),"Extension"]}),J&&ge.jsxs(Bb,{onClick:U,children:[ge.jsx(f8,{className:"xc-opacity-80"}),"Desktop"]}),T&&ge.jsx(Bb,{onClick:K,children:"Telegram Mini App"})]})]})]})}function MQ(t){const[e,r]=Se.useState(""),[n,i]=Se.useState(),[s,o]=Se.useState(),a=Mb(),[u,l]=Se.useState(!1);async function d(y){var P,N;if(!y||!((P=y.connectItems)!=null&&P.tonProof))return;l(!0);const A=await va.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(N=y.connectItems)==null?void 0:N.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(A.data),l(!1)}Se.useEffect(()=>{const y=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),A=y.onStatusChange(d);return o(y),r("select"),A},[]);function g(y){r("connect"),i(y)}return ge.jsxs(Ss,{children:[e==="select"&&ge.jsx(T7,{connector:s,onSelect:g,onBack:t.onBack}),e==="connect"&&ge.jsx(K7,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function V7(t){const{children:e,className:r}=t,n=Se.useRef(null),[i,s]=Se.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Se.useEffect(()=>{console.log("maxHeight",i)},[i]),ge.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function IQ(){return ge.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ge.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),ge.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function G7(t){const{wallets:e}=Kl(),[r,n]=Se.useState(),i=Se.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[ge.jsx(l8,{className:"xc-shrink-0 xc-opacity-50"}),ge.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),ge.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>ge.jsx(e7,{wallet:a,onClick:s},`feature-${a.key}`)):ge.jsx(IQ,{})})]})}function CQ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Se.useState(""),[l,d]=Se.useState(null),[g,y]=Se.useState("");function A(k){d(k),u("evm-wallet")}function P(k){u("email"),y(k)}async function N(k){await e(k)}function D(){u("ton-wallet")}return Se.useEffect(()=>{u("index")},[]),ge.jsx(GX,{config:t.config,children:ge.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&ge.jsx(TZ,{onBack:()=>u("index"),onLogin:N,wallet:l}),a==="ton-wallet"&&ge.jsx(MQ,{onBack:()=>u("index"),onLogin:N}),a==="email"&&ge.jsx(uZ,{email:g,onBack:()=>u("index"),onLogin:N}),a==="index"&&ge.jsx(f7,{header:r,onEmailConfirm:P,onSelectWallet:A,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&ge.jsx(G7,{onBack:()=>u("index"),onSelectWallet:A})]})})}function TQ(t){const{wallet:e,onConnect:r}=t,[n,i]=Se.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&ge.jsx(M7,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&ge.jsx(I7,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&ge.jsx(C7,{wallet:e})]})}function RQ(t){const{email:e}=t,[r,n]=Se.useState("captcha");return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),r==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>n("verify-email")}),r==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:t.onInputCode,onResendCode:()=>n("captcha")})]})}function DQ(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Se.useState(""),[a,u]=Se.useState(),[l,d]=Se.useState(),g=Se.useRef(),[y,A]=Se.useState("");function P(j){u(j),o("evm-wallet-connect")}function N(j){A(j),o("email-connect")}async function D(j,U){await e({chain_type:"eip155",client:j.client,connect_info:U}),o("index")}function k(j){d(j),o("ton-wallet-connect")}async function B(j){j&&await r({chain_type:"ton",client:g.current,connect_info:j})}return Se.useEffect(()=>{g.current=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const j=g.current.onStatusChange(B);return o("index"),j},[]),ge.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&ge.jsx(G7,{onBack:()=>o("index"),onSelectWallet:P}),s==="evm-wallet-connect"&&ge.jsx(TQ,{onBack:()=>o("index"),onConnect:D,wallet:a}),s==="ton-wallet-select"&&ge.jsx(T7,{connector:g.current,onSelect:k,onBack:()=>o("index")}),s==="ton-wallet-connect"&&ge.jsx(K7,{connector:g.current,wallet:l,onBack:()=>o("index")}),s==="email-connect"&&ge.jsx(RQ,{email:y,onBack:()=>o("index"),onInputCode:n}),s==="index"&&ge.jsx(f7,{onEmailConfirm:N,onSelectWallet:P,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Fn.CodattaConnect=DQ,Fn.CodattaConnectContextProvider=CK,Fn.CodattaSignin=CQ,Fn.coinbaseWallet=o8,Fn.useCodattaConnectContext=Kl,Object.defineProperty(Fn,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/main-DYrF27mZ.js b/dist/main-CpxLUVHd.js similarity index 80% rename from dist/main-DYrF27mZ.js rename to dist/main-CpxLUVHd.js index 88dac93..eb565da 100644 --- a/dist/main-DYrF27mZ.js +++ b/dist/main-CpxLUVHd.js @@ -1,11 +1,11 @@ -var OR = Object.defineProperty; -var NR = (t, e, r) => e in t ? OR(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; -var Ds = (t, e, r) => NR(t, typeof e != "symbol" ? e + "" : e, r); -import * as Yt from "react"; -import pv, { createContext as Ma, useContext as Tn, useState as Gt, useEffect as Dn, forwardRef as gv, createElement as qd, useId as mv, useCallback as vv, Component as LR, useLayoutEffect as kR, useRef as oi, useInsertionEffect as w5, useMemo as Ni, Fragment as x5, Children as $R, isValidElement as BR } from "react"; +var NR = Object.defineProperty; +var LR = (t, e, r) => e in t ? NR(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; +var Ds = (t, e, r) => LR(t, typeof e != "symbol" ? e + "" : e, r); +import * as Gt from "react"; +import pv, { createContext as Sa, useContext as Tn, useState as Qt, useEffect as Dn, forwardRef as gv, createElement as qd, useId as mv, useCallback as vv, Component as kR, useLayoutEffect as $R, useRef as Un, useInsertionEffect as b5, useMemo as wi, Fragment as y5, Children as BR, isValidElement as FR } from "react"; import "https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"; var gn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; -function rs(t) { +function ts(t) { return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; } function bv(t) { @@ -37,10 +37,10 @@ var Ym = { exports: {} }, gf = {}; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -var g2; -function FR() { - if (g2) return gf; - g2 = 1; +var d2; +function jR() { + if (d2) return gf; + d2 = 1; var t = pv, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 }; function o(a, u, l) { var d, p = {}, w = null, A = null; @@ -61,29 +61,29 @@ var mf = {}; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -var m2; -function jR() { - return m2 || (m2 = 1, process.env.NODE_ENV !== "production" && function() { - var t = pv, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), a = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), P = Symbol.iterator, N = "@@iterator"; +var p2; +function UR() { + return p2 || (p2 = 1, process.env.NODE_ENV !== "production" && function() { + var t = pv, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), a = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), M = Symbol.iterator, N = "@@iterator"; function L(j) { if (j === null || typeof j != "object") return null; - var se = P && j[P] || j[N]; + var se = M && j[M] || j[N]; return typeof se == "function" ? se : null; } - var $ = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - function B(j) { + var B = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + function $(j) { { - for (var se = arguments.length, de = new Array(se > 1 ? se - 1 : 0), xe = 1; xe < se; xe++) - de[xe - 1] = arguments[xe]; - H("error", j, de); + for (var se = arguments.length, he = new Array(se > 1 ? se - 1 : 0), xe = 1; xe < se; xe++) + he[xe - 1] = arguments[xe]; + H("error", j, he); } } - function H(j, se, de) { + function H(j, se, he) { { - var xe = $.ReactDebugCurrentFrame, Te = xe.getStackAddendum(); - Te !== "" && (se += "%s", de = de.concat([Te])); - var Re = de.map(function(nt) { + var xe = B.ReactDebugCurrentFrame, Te = xe.getStackAddendum(); + Te !== "" && (se += "%s", he = he.concat([Te])); + var Re = he.map(function(nt) { return String(nt); }); Re.unshift("Warning: " + se), Function.prototype.apply.call(console[j], console, Re); @@ -98,12 +98,12 @@ function jR() { // with. j.$$typeof === ge || j.getModuleId !== void 0)); } - function Y(j, se, de) { + function Y(j, se, he) { var xe = j.displayName; if (xe) return xe; var Te = se.displayName || se.name || ""; - return Te !== "" ? de + "(" + Te + ")" : de; + return Te !== "" ? he + "(" + Te + ")" : he; } function S(j) { return j.displayName || "Context"; @@ -111,7 +111,7 @@ function jR() { function m(j) { if (j == null) return null; - if (typeof j.tag == "number" && B("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof j == "function") + if (typeof j.tag == "number" && $("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof j == "function") return j.displayName || j.name || null; if (typeof j == "string") return j; @@ -135,8 +135,8 @@ function jR() { var se = j; return S(se) + ".Consumer"; case o: - var de = j; - return S(de._context) + ".Provider"; + var he = j; + return S(he._context) + ".Provider"; case u: return Y(j, j.render, "ForwardRef"); case p: @@ -153,14 +153,14 @@ function jR() { } return null; } - var f = Object.assign, g = 0, b, x, _, E, v, M, I; + var f = Object.assign, g = 0, b, x, _, E, v, P, I; function F() { } F.__reactDisabledLog = !0; function ce() { { if (g === 0) { - b = console.log, x = console.info, _ = console.warn, E = console.error, v = console.group, M = console.groupCollapsed, I = console.groupEnd; + b = console.log, x = console.info, _ = console.warn, E = console.error, v = console.group, P = console.groupCollapsed, I = console.groupEnd; var j = { configurable: !0, enumerable: !0, @@ -205,18 +205,18 @@ function jR() { value: v }), groupCollapsed: f({}, j, { - value: M + value: P }), groupEnd: f({}, j, { value: I }) }); } - g < 0 && B("disabledDepth fell below zero. This is a bug in React. Please file an issue."); + g < 0 && $("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } - var oe = $.ReactCurrentDispatcher, Z; - function J(j, se, de) { + var oe = B.ReactCurrentDispatcher, Z; + function J(j, se, he) { { if (Z === void 0) try { @@ -238,9 +238,9 @@ function jR() { if (!j || Q) return ""; { - var de = T.get(j); - if (de !== void 0) - return de; + var he = T.get(j); + if (he !== void 0) + return he; } var xe; Q = !0; @@ -305,14 +305,14 @@ function jR() { var Tt = j ? j.displayName || j.name : "", At = Tt ? J(Tt) : ""; return typeof j == "function" && T.set(j, At), At; } - function pe(j, se, de) { + function de(j, se, he) { return re(j, !1); } function ie(j) { var se = j.prototype; return !!(se && se.isReactComponent); } - function ue(j, se, de) { + function ue(j, se, he) { if (j == null) return ""; if (typeof j == "function") @@ -328,28 +328,28 @@ function jR() { if (typeof j == "object") switch (j.$$typeof) { case u: - return pe(j.render); + return de(j.render); case p: - return ue(j.type, se, de); + return ue(j.type, se, he); case w: { var xe = j, Te = xe._payload, Re = xe._init; try { - return ue(Re(Te), se, de); + return ue(Re(Te), se, he); } catch { } } } return ""; } - var ve = Object.prototype.hasOwnProperty, Pe = {}, De = $.ReactDebugCurrentFrame; + var ve = Object.prototype.hasOwnProperty, Pe = {}, De = B.ReactDebugCurrentFrame; function Ce(j) { if (j) { - var se = j._owner, de = ue(j.type, j._source, se ? se.type : null); - De.setExtraStackFrame(de); + var se = j._owner, he = ue(j.type, j._source, se ? se.type : null); + De.setExtraStackFrame(he); } else De.setExtraStackFrame(null); } - function $e(j, se, de, xe, Te) { + function $e(j, se, he, xe, Te) { { var Re = Function.call.bind(ve); for (var nt in j) @@ -357,14 +357,14 @@ function jR() { var je = void 0; try { if (typeof j[nt] != "function") { - var pt = Error((xe || "React class") + ": " + de + " type `" + nt + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof j[nt] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); + var pt = Error((xe || "React class") + ": " + he + " type `" + nt + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof j[nt] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw pt.name = "Invariant Violation", pt; } - je = j[nt](se, nt, xe, de, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); + je = j[nt](se, nt, xe, he, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (it) { je = it; } - je && !(je instanceof Error) && (Ce(Te), B("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", xe || "React class", de, nt, typeof je), Ce(null)), je instanceof Error && !(je.message in Pe) && (Pe[je.message] = !0, Ce(Te), B("Failed %s type: %s", de, je.message), Ce(null)); + je && !(je instanceof Error) && (Ce(Te), $("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", xe || "React class", he, nt, typeof je), Ce(null)), je instanceof Error && !(je.message in Pe) && (Pe[je.message] = !0, Ce(Te), $("Failed %s type: %s", he, je.message), Ce(null)); } } } @@ -374,8 +374,8 @@ function jR() { } function Ke(j) { { - var se = typeof Symbol == "function" && Symbol.toStringTag, de = se && j[Symbol.toStringTag] || j.constructor.name || "Object"; - return de; + var se = typeof Symbol == "function" && Symbol.toStringTag, he = se && j[Symbol.toStringTag] || j.constructor.name || "Object"; + return he; } } function Le(j) { @@ -390,9 +390,9 @@ function jR() { } function ze(j) { if (Le(j)) - return B("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(j)), qe(j); + return $("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(j)), qe(j); } - var _e = $.ReactCurrentOwner, Ze = { + var _e = B.ReactCurrentOwner, Ze = { key: !0, ref: !0, __self: !0, @@ -417,40 +417,40 @@ function jR() { } function dt(j, se) { if (typeof j.ref == "string" && _e.current && se && _e.current.stateNode !== se) { - var de = m(_e.current.type); - Qe[de] || (B('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', m(_e.current.type), j.ref), Qe[de] = !0); + var he = m(_e.current.type); + Qe[he] || ($('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', m(_e.current.type), j.ref), Qe[he] = !0); } } function lt(j, se) { { - var de = function() { - at || (at = !0, B("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); + var he = function() { + at || (at = !0, $("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); }; - de.isReactWarning = !0, Object.defineProperty(j, "key", { - get: de, + he.isReactWarning = !0, Object.defineProperty(j, "key", { + get: he, configurable: !0 }); } } function ct(j, se) { { - var de = function() { - ke || (ke = !0, B("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); + var he = function() { + ke || (ke = !0, $("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); }; - de.isReactWarning = !0, Object.defineProperty(j, "ref", { - get: de, + he.isReactWarning = !0, Object.defineProperty(j, "ref", { + get: he, configurable: !0 }); } } - var qt = function(j, se, de, xe, Te, Re, nt) { + var qt = function(j, se, he, xe, Te, Re, nt) { var je = { // This tag allows us to uniquely identify this as a React Element $$typeof: e, // Built-in properties that belong on the element type: j, key: se, - ref: de, + ref: he, props: nt, // Record the component responsible for creating this element. _owner: Re @@ -472,10 +472,10 @@ function jR() { value: Te }), Object.freeze && (Object.freeze(je.props), Object.freeze(je)), je; }; - function Jt(j, se, de, xe, Te) { + function Yt(j, se, he, xe, Te) { { var Re, nt = {}, je = null, pt = null; - de !== void 0 && (ze(de), je = "" + de), Ye(se) && (ze(se.key), je = "" + se.key), tt(se) && (pt = se.ref, dt(se, Te)); + he !== void 0 && (ze(he), je = "" + he), Ye(se) && (ze(se.key), je = "" + se.key), tt(se) && (pt = se.ref, dt(se, Te)); for (Re in se) ve.call(se, Re) && !Ze.hasOwnProperty(Re) && (nt[Re] = se[Re]); if (j && j.defaultProps) { @@ -490,11 +490,11 @@ function jR() { return qt(j, je, pt, Te, xe, _e.current, nt); } } - var Et = $.ReactCurrentOwner, er = $.ReactDebugCurrentFrame; - function Xt(j) { + var Et = B.ReactCurrentOwner, er = B.ReactDebugCurrentFrame; + function Jt(j) { if (j) { - var se = j._owner, de = ue(j.type, j._source, se ? se.type : null); - er.setExtraStackFrame(de); + var se = j._owner, he = ue(j.type, j._source, se ? se.type : null); + er.setExtraStackFrame(he); } else er.setExtraStackFrame(null); } @@ -523,10 +523,10 @@ Check the render method of \`` + j + "`."; { var se = Ct(); if (!se) { - var de = typeof j == "string" ? j : j.displayName || j.name; - de && (se = ` + var he = typeof j == "string" ? j : j.displayName || j.name; + he && (se = ` -Check the top-level render call using <` + de + ">."); +Check the top-level render call using <` + he + ">."); } return se; } @@ -536,12 +536,12 @@ Check the top-level render call using <` + de + ">."); if (!j._store || j._store.validated || j.key != null) return; j._store.validated = !0; - var de = Nt(se); - if (Rt[de]) + var he = Nt(se); + if (Rt[he]) return; - Rt[de] = !0; + Rt[he] = !0; var xe = ""; - j && j._owner && j._owner !== Et.current && (xe = " It was passed a child from " + m(j._owner.type) + "."), Xt(j), B('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', de, xe), Xt(null); + j && j._owner && j._owner !== Et.current && (xe = " It was passed a child from " + m(j._owner.type) + "."), Jt(j), $('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', he, xe), Jt(null); } } function $t(j, se) { @@ -549,8 +549,8 @@ Check the top-level render call using <` + de + ">."); if (typeof j != "object") return; if (Ne(j)) - for (var de = 0; de < j.length; de++) { - var xe = j[de]; + for (var he = 0; he < j.length; he++) { + var xe = j[he]; kt(xe) && vt(xe, se); } else if (kt(j)) @@ -568,40 +568,40 @@ Check the top-level render call using <` + de + ">."); var se = j.type; if (se == null || typeof se == "string") return; - var de; + var he; if (typeof se == "function") - de = se.propTypes; + he = se.propTypes; else if (typeof se == "object" && (se.$$typeof === u || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. se.$$typeof === p)) - de = se.propTypes; + he = se.propTypes; else return; - if (de) { + if (he) { var xe = m(se); - $e(de, j.props, "prop", xe, j); + $e(he, j.props, "prop", xe, j); } else if (se.PropTypes !== void 0 && !Dt) { Dt = !0; var Te = m(se); - B("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Te || "Unknown"); + $("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Te || "Unknown"); } - typeof se.getDefaultProps == "function" && !se.getDefaultProps.isReactClassApproved && B("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); + typeof se.getDefaultProps == "function" && !se.getDefaultProps.isReactClassApproved && $("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function rt(j) { { - for (var se = Object.keys(j.props), de = 0; de < se.length; de++) { - var xe = se[de]; + for (var se = Object.keys(j.props), he = 0; he < se.length; he++) { + var xe = se[he]; if (xe !== "children" && xe !== "key") { - Xt(j), B("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", xe), Xt(null); + Jt(j), $("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", xe), Jt(null); break; } } - j.ref !== null && (Xt(j), B("Invalid attribute `ref` supplied to `React.Fragment`."), Xt(null)); + j.ref !== null && (Jt(j), $("Invalid attribute `ref` supplied to `React.Fragment`."), Jt(null)); } } var Bt = {}; - function k(j, se, de, xe, Te, Re) { + function k(j, se, he, xe, Te, Re) { { var nt = Ee(j); if (!nt) { @@ -610,9 +610,9 @@ Check the top-level render call using <` + de + ">."); var pt = gt(); pt ? je += pt : je += Ct(); var it; - j === null ? it = "null" : Ne(j) ? it = "array" : j !== void 0 && j.$$typeof === e ? (it = "<" + (m(j.type) || "Unknown") + " />", je = " Did you accidentally export a JSX literal instead of a component?") : it = typeof j, B("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", it, je); + j === null ? it = "null" : Ne(j) ? it = "array" : j !== void 0 && j.$$typeof === e ? (it = "<" + (m(j.type) || "Unknown") + " />", je = " Did you accidentally export a JSX literal instead of a component?") : it = typeof j, $("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", it, je); } - var et = Jt(j, se, de, Te, Re); + var et = Yt(j, se, he, Te, Re); if (et == null) return et; if (nt) { @@ -624,7 +624,7 @@ Check the top-level render call using <` + de + ">."); $t(St[Tt], j); Object.freeze && Object.freeze(St); } else - B("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); + $("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else $t(St, j); } @@ -634,7 +634,7 @@ Check the top-level render call using <` + de + ">."); }), ht = _t.length > 0 ? "{key: someKey, " + _t.join(": ..., ") + ": ...}" : "{key: someKey}"; if (!Bt[At + ht]) { var xt = _t.length > 0 ? "{" + _t.join(": ..., ") + ": ...}" : "{}"; - B(`A props object containing a "key" prop is being spread into JSX: + $(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: @@ -645,19 +645,19 @@ React keys must be passed directly to JSX without using spread: return j === n ? rt(et) : Ft(et), et; } } - function U(j, se, de) { - return k(j, se, de, !0); + function U(j, se, he) { + return k(j, se, he, !0); } - function z(j, se, de) { - return k(j, se, de, !1); + function z(j, se, he) { + return k(j, se, he, !1); } var C = z, G = U; mf.Fragment = n, mf.jsx = C, mf.jsxs = G; }()), mf; } -process.env.NODE_ENV === "production" ? Ym.exports = FR() : Ym.exports = jR(); -var fe = Ym.exports; -const Os = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", UR = [ +process.env.NODE_ENV === "production" ? Ym.exports = jR() : Ym.exports = UR(); +var pe = Ym.exports; +const Os = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", qR = [ { featured: !0, name: "MetaMask", @@ -769,21 +769,21 @@ const Os = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", UR } } ]; -function qR(t, e) { +function zR(t, e) { const r = t.exec(e); return r == null ? void 0 : r.groups; } -const v2 = /^tuple(?(\[(\d*)\])*)$/; +const g2 = /^tuple(?(\[(\d*)\])*)$/; function Jm(t) { let e = t.type; - if (v2.test(t.type) && "components" in t) { + if (g2.test(t.type) && "components" in t) { e = "("; const r = t.components.length; for (let i = 0; i < r; i++) { const s = t.components[i]; e += Jm(s), i < r - 1 && (e += ", "); } - const n = qR(v2, t.type); + const n = zR(g2, t.type); return e += `)${(n == null ? void 0 : n.array) ?? ""}`, Jm({ ...t, type: e @@ -800,7 +800,7 @@ function vf(t) { } return e; } -function zR(t) { +function WR(t) { return t.type === "function" ? `function ${t.name}(${vf(t.inputs)})${t.stateMutability && t.stateMutability !== "nonpayable" ? ` ${t.stateMutability}` : ""}${t.outputs.length ? ` returns (${vf(t.outputs)})` : ""}` : t.type === "event" ? `event ${t.name}(${vf(t.inputs)})` : t.type === "error" ? `error ${t.name}(${vf(t.inputs)})` : t.type === "constructor" ? `constructor(${vf(t.inputs)})${t.stateMutability === "payable" ? " payable" : ""}` : t.type === "fallback" ? "fallback()" : "receive() external payable"; } function bi(t, e, r) { @@ -812,25 +812,25 @@ function bi(t, e, r) { } function vu(t, { includeName: e = !1 } = {}) { if (t.type !== "function" && t.type !== "event" && t.type !== "error") - throw new tD(t.type); + throw new rD(t.type); return `${t.name}(${yv(t.inputs, { includeName: e })})`; } function yv(t, { includeName: e = !1 } = {}) { - return t ? t.map((r) => WR(r, { includeName: e })).join(e ? ", " : ",") : ""; + return t ? t.map((r) => HR(r, { includeName: e })).join(e ? ", " : ",") : ""; } -function WR(t, { includeName: e }) { +function HR(t, { includeName: e }) { return t.type.startsWith("tuple") ? `(${yv(t.components, { includeName: e })})${t.type.slice(5)}` : t.type + (e && t.name ? ` ${t.name}` : ""); } -function ya(t, { strict: e = !0 } = {}) { +function va(t, { strict: e = !0 } = {}) { return !t || typeof t != "string" ? !1 : e ? /^0x[0-9a-fA-F]*$/.test(t) : t.startsWith("0x"); } function An(t) { - return ya(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length; + return va(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length; } -const _5 = "2.21.45"; +const w5 = "2.21.45"; let bf = { getDocsUrl: ({ docsBaseUrl: t, docsPath: e = "", docsSlug: r }) => e ? `${t ?? "https://viem.sh"}${e}${r ? `#${r}` : ""}` : void 0, - version: `viem@${_5}` + version: `viem@${w5}` }; class yt extends Error { constructor(e, r = {}) { @@ -877,16 +877,16 @@ class yt extends Error { configurable: !0, writable: !0, value: "BaseError" - }), this.details = n, this.docsPath = i, this.metaMessages = r.metaMessages, this.name = r.name ?? this.name, this.shortMessage = e, this.version = _5; + }), this.details = n, this.docsPath = i, this.metaMessages = r.metaMessages, this.name = r.name ?? this.name, this.shortMessage = e, this.version = w5; } walk(e) { - return E5(this, e); + return x5(this, e); } } -function E5(t, e) { - return e != null && e(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ? E5(t.cause, e) : e ? null : t; +function x5(t, e) { + return e != null && e(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ? x5(t.cause, e) : e ? null : t; } -class HR extends yt { +class KR extends yt { constructor({ docsPath: e }) { super([ "A constructor was not found on the ABI.", @@ -898,7 +898,7 @@ class HR extends yt { }); } } -class b2 extends yt { +class m2 extends yt { constructor({ docsPath: e }) { super([ "Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.", @@ -910,7 +910,7 @@ class b2 extends yt { }); } } -class KR extends yt { +class VR extends yt { constructor({ data: e, params: r, size: n }) { super([`Data size of ${n} bytes is too small for given parameters.`].join(` `), { @@ -944,7 +944,7 @@ class wv extends yt { }); } } -class VR extends yt { +class GR extends yt { constructor({ expectedLength: e, givenLength: r, type: n }) { super([ `ABI encoding array length mismatch for type ${n}.`, @@ -954,12 +954,12 @@ class VR extends yt { `), { name: "AbiEncodingArrayLengthMismatchError" }); } } -class GR extends yt { +class YR extends yt { constructor({ expectedSize: e, value: r }) { super(`Size of bytes "${r}" (bytes${An(r)}) does not match expected size (bytes${e}).`, { name: "AbiEncodingBytesSizeMismatchError" }); } } -class YR extends yt { +class JR extends yt { constructor({ expectedLength: e, givenLength: r }) { super([ "ABI encoding params/values length mismatch.", @@ -969,7 +969,7 @@ class YR extends yt { `), { name: "AbiEncodingLengthMismatchError" }); } } -class S5 extends yt { +class _5 extends yt { constructor(e, { docsPath: r }) { super([ `Encoded error signature "${e}" not found on ABI.`, @@ -987,7 +987,7 @@ class S5 extends yt { }), this.signature = e; } } -class y2 extends yt { +class v2 extends yt { constructor(e, { docsPath: r } = {}) { super([ `Function ${e ? `"${e}" ` : ""}not found on ABI.`, @@ -999,7 +999,7 @@ class y2 extends yt { }); } } -class JR extends yt { +class XR extends yt { constructor(e, r) { super("Found ambiguous types in overloaded ABI items.", { metaMessages: [ @@ -1013,14 +1013,14 @@ class JR extends yt { }); } } -class XR extends yt { +class ZR extends yt { constructor({ expectedSize: e, givenSize: r }) { super(`Expected bytes${e}, got bytes${r}.`, { name: "BytesSizeMismatchError" }); } } -class ZR extends yt { +class QR extends yt { constructor(e, { docsPath: r }) { super([ `Type "${e}" is not a valid encoding type.`, @@ -1029,7 +1029,7 @@ class ZR extends yt { `), { docsPath: r, name: "InvalidAbiEncodingType" }); } } -class QR extends yt { +class eD extends yt { constructor(e, { docsPath: r }) { super([ `Type "${e}" is not a valid decoding type.`, @@ -1038,7 +1038,7 @@ class QR extends yt { `), { docsPath: r, name: "InvalidAbiDecodingType" }); } } -class eD extends yt { +class tD extends yt { constructor(e) { super([`Value "${e}" is not a valid array.`].join(` `), { @@ -1046,7 +1046,7 @@ class eD extends yt { }); } } -class tD extends yt { +class rD extends yt { constructor(e) { super([ `"${e}" is not a valid definition type.`, @@ -1055,41 +1055,41 @@ class tD extends yt { `), { name: "InvalidDefinitionTypeError" }); } } -class A5 extends yt { +class E5 extends yt { constructor({ offset: e, position: r, size: n }) { super(`Slice ${r === "start" ? "starting" : "ending"} at offset "${e}" is out-of-bounds (size: ${n}).`, { name: "SliceOffsetOutOfBoundsError" }); } } -class P5 extends yt { +class S5 extends yt { constructor({ size: e, targetSize: r, type: n }) { super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`, { name: "SizeExceedsPaddingSizeError" }); } } -class w2 extends yt { +class b2 extends yt { constructor({ size: e, targetSize: r, type: n }) { super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`, { name: "InvalidBytesLengthError" }); } } function Tu(t, { dir: e, size: r = 32 } = {}) { - return typeof t == "string" ? ba(t, { dir: e, size: r }) : rD(t, { dir: e, size: r }); + return typeof t == "string" ? ma(t, { dir: e, size: r }) : nD(t, { dir: e, size: r }); } -function ba(t, { dir: e, size: r = 32 } = {}) { +function ma(t, { dir: e, size: r = 32 } = {}) { if (r === null) return t; const n = t.replace("0x", ""); if (n.length > r * 2) - throw new P5({ + throw new S5({ size: Math.ceil(n.length / 2), targetSize: r, type: "hex" }); return `0x${n[e === "right" ? "padEnd" : "padStart"](r * 2, "0")}`; } -function rD(t, { dir: e, size: r = 32 } = {}) { +function nD(t, { dir: e, size: r = 32 } = {}) { if (r === null) return t; if (t.length > r) - throw new P5({ + throw new S5({ size: t.length, targetSize: r, type: "bytes" @@ -1101,19 +1101,19 @@ function rD(t, { dir: e, size: r = 32 } = {}) { } return n; } -class nD extends yt { +class iD extends yt { constructor({ max: e, min: r, signed: n, size: i, value: s }) { super(`Number "${s}" is not in safe ${i ? `${i * 8}-bit ${n ? "signed" : "unsigned"} ` : ""}integer range ${e ? `(${r} to ${e})` : `(above ${r})`}`, { name: "IntegerOutOfRangeError" }); } } -class iD extends yt { +class sD extends yt { constructor(e) { super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, { name: "InvalidBytesBooleanError" }); } } -class sD extends yt { +class oD extends yt { constructor({ givenSize: e, maxSize: r }) { super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" }); } @@ -1124,16 +1124,16 @@ function xv(t, { dir: e = "left" } = {}) { n++; return r = e === "left" ? r.slice(n) : r.slice(0, r.length - n), typeof t == "string" ? (r.length === 1 && e === "right" && (r = `${r}0`), `0x${r.length % 2 === 1 ? `0${r}` : r}`) : r; } -function ro(t, { size: e }) { +function to(t, { size: e }) { if (An(t) > e) - throw new sD({ + throw new oD({ givenSize: An(t), maxSize: e }); } function el(t, e = {}) { const { signed: r } = e; - e.size && ro(t, { size: e.size }); + e.size && to(t, { size: e.size }); const n = BigInt(t); if (!r) return n; @@ -1143,20 +1143,20 @@ function el(t, e = {}) { function bu(t, e = {}) { return Number(el(t, e)); } -const oD = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); +const aD = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); function zd(t, e = {}) { - return typeof t == "number" || typeof t == "bigint" ? Mr(t, e) : typeof t == "string" ? I0(t, e) : typeof t == "boolean" ? M5(t, e) : wi(t, e); + return typeof t == "number" || typeof t == "bigint" ? Mr(t, e) : typeof t == "string" ? I0(t, e) : typeof t == "boolean" ? A5(t, e) : xi(t, e); } -function M5(t, e = {}) { +function A5(t, e = {}) { const r = `0x${Number(t)}`; - return typeof e.size == "number" ? (ro(r, { size: e.size }), Tu(r, { size: e.size })) : r; + return typeof e.size == "number" ? (to(r, { size: e.size }), Tu(r, { size: e.size })) : r; } -function wi(t, e = {}) { +function xi(t, e = {}) { let r = ""; for (let i = 0; i < t.length; i++) - r += oD[t[i]]; + r += aD[t[i]]; const n = `0x${r}`; - return typeof e.size == "number" ? (ro(n, { size: e.size }), Tu(n, { dir: "right", size: e.size })) : n; + return typeof e.size == "number" ? (to(n, { size: e.size }), Tu(n, { dir: "right", size: e.size })) : n; } function Mr(t, e = {}) { const { signed: r, size: n } = e, i = BigInt(t); @@ -1165,7 +1165,7 @@ function Mr(t, e = {}) { const o = typeof s == "bigint" && r ? -s - 1n : 0; if (s && i > s || i < o) { const u = typeof t == "bigint" ? "n" : ""; - throw new nD({ + throw new iD({ max: s ? `${s}${u}` : void 0, min: `${o}${u}`, signed: r, @@ -1176,20 +1176,20 @@ function Mr(t, e = {}) { const a = `0x${(r && i < 0 ? (1n << BigInt(n * 8)) + BigInt(i) : i).toString(16)}`; return n ? Tu(a, { size: n }) : a; } -const aD = /* @__PURE__ */ new TextEncoder(); +const cD = /* @__PURE__ */ new TextEncoder(); function I0(t, e = {}) { - const r = aD.encode(t); - return wi(r, e); + const r = cD.encode(t); + return xi(r, e); } -const cD = /* @__PURE__ */ new TextEncoder(); +const uD = /* @__PURE__ */ new TextEncoder(); function _v(t, e = {}) { - return typeof t == "number" || typeof t == "bigint" ? fD(t, e) : typeof t == "boolean" ? uD(t, e) : ya(t) ? ko(t, e) : I5(t, e); + return typeof t == "number" || typeof t == "bigint" ? lD(t, e) : typeof t == "boolean" ? fD(t, e) : va(t) ? Lo(t, e) : P5(t, e); } -function uD(t, e = {}) { +function fD(t, e = {}) { const r = new Uint8Array(1); - return r[0] = Number(t), typeof e.size == "number" ? (ro(r, { size: e.size }), Tu(r, { size: e.size })) : r; + return r[0] = Number(t), typeof e.size == "number" ? (to(r, { size: e.size }), Tu(r, { size: e.size })) : r; } -const vo = { +const go = { zero: 48, nine: 57, A: 65, @@ -1197,50 +1197,50 @@ const vo = { a: 97, f: 102 }; -function x2(t) { - if (t >= vo.zero && t <= vo.nine) - return t - vo.zero; - if (t >= vo.A && t <= vo.F) - return t - (vo.A - 10); - if (t >= vo.a && t <= vo.f) - return t - (vo.a - 10); +function y2(t) { + if (t >= go.zero && t <= go.nine) + return t - go.zero; + if (t >= go.A && t <= go.F) + return t - (go.A - 10); + if (t >= go.a && t <= go.f) + return t - (go.a - 10); } -function ko(t, e = {}) { +function Lo(t, e = {}) { let r = t; - e.size && (ro(r, { size: e.size }), r = Tu(r, { dir: "right", size: e.size })); + e.size && (to(r, { size: e.size }), r = Tu(r, { dir: "right", size: e.size })); let n = r.slice(2); n.length % 2 && (n = `0${n}`); const i = n.length / 2, s = new Uint8Array(i); for (let o = 0, a = 0; o < i; o++) { - const u = x2(n.charCodeAt(a++)), l = x2(n.charCodeAt(a++)); + const u = y2(n.charCodeAt(a++)), l = y2(n.charCodeAt(a++)); if (u === void 0 || l === void 0) throw new yt(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`); s[o] = u * 16 + l; } return s; } -function fD(t, e) { +function lD(t, e) { const r = Mr(t, e); - return ko(r); + return Lo(r); } -function I5(t, e = {}) { - const r = cD.encode(t); - return typeof e.size == "number" ? (ro(r, { size: e.size }), Tu(r, { dir: "right", size: e.size })) : r; +function P5(t, e = {}) { + const r = uD.encode(t); + return typeof e.size == "number" ? (to(r, { size: e.size }), Tu(r, { dir: "right", size: e.size })) : r; } function Wd(t) { if (!Number.isSafeInteger(t) || t < 0) throw new Error(`positive integer expected, not ${t}`); } -function lD(t) { +function hD(t) { return t instanceof Uint8Array || t != null && typeof t == "object" && t.constructor.name === "Uint8Array"; } function Ll(t, ...e) { - if (!lD(t)) + if (!hD(t)) throw new Error("Uint8Array expected"); if (e.length > 0 && !e.includes(t.length)) throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`); } -function hse(t) { +function gse(t) { if (typeof t != "function" || typeof t.create != "function") throw new Error("Hash should be wrapped by utils.wrapConstructor"); Wd(t.outputLen), Wd(t.blockLen); @@ -1251,48 +1251,48 @@ function Hd(t, e = !0) { if (e && t.finished) throw new Error("Hash#digest() has already been called"); } -function C5(t, e) { +function M5(t, e) { Ll(t); const r = e.outputLen; if (t.length < r) throw new Error(`digestInto() expects output buffer of length at least ${r}`); } -const rd = /* @__PURE__ */ BigInt(2 ** 32 - 1), _2 = /* @__PURE__ */ BigInt(32); -function hD(t, e = !1) { - return e ? { h: Number(t & rd), l: Number(t >> _2 & rd) } : { h: Number(t >> _2 & rd) | 0, l: Number(t & rd) | 0 }; -} +const rd = /* @__PURE__ */ BigInt(2 ** 32 - 1), w2 = /* @__PURE__ */ BigInt(32); function dD(t, e = !1) { + return e ? { h: Number(t & rd), l: Number(t >> w2 & rd) } : { h: Number(t >> w2 & rd) | 0, l: Number(t & rd) | 0 }; +} +function pD(t, e = !1) { let r = new Uint32Array(t.length), n = new Uint32Array(t.length); for (let i = 0; i < t.length; i++) { - const { h: s, l: o } = hD(t[i], e); + const { h: s, l: o } = dD(t[i], e); [r[i], n[i]] = [s, o]; } return [r, n]; } -const pD = (t, e, r) => t << r | e >>> 32 - r, gD = (t, e, r) => e << r | t >>> 32 - r, mD = (t, e, r) => e << r - 32 | t >>> 64 - r, vD = (t, e, r) => t << r - 32 | e >>> 64 - r, qc = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0; +const gD = (t, e, r) => t << r | e >>> 32 - r, mD = (t, e, r) => e << r | t >>> 32 - r, vD = (t, e, r) => e << r - 32 | t >>> 64 - r, bD = (t, e, r) => t << r - 32 | e >>> 64 - r, qc = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0; /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -const bD = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), Bg = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), Ns = (t, e) => t << 32 - e | t >>> e, E2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, yD = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255; -function S2(t) { +const yD = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), Bg = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), Ns = (t, e) => t << 32 - e | t >>> e, x2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, wD = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255; +function _2(t) { for (let e = 0; e < t.length; e++) - t[e] = yD(t[e]); + t[e] = wD(t[e]); } -const wD = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); -function xD(t) { +const xD = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); +function _D(t) { Ll(t); let e = ""; for (let r = 0; r < t.length; r++) - e += wD[t[r]]; + e += xD[t[r]]; return e; } -function _D(t) { +function ED(t) { if (typeof t != "string") throw new Error(`utf8ToBytes expected string, got ${typeof t}`); return new Uint8Array(new TextEncoder().encode(t)); } function C0(t) { - return typeof t == "string" && (t = _D(t)), Ll(t), t; + return typeof t == "string" && (t = ED(t)), Ll(t), t; } -function dse(...t) { +function mse(...t) { let e = 0; for (let n = 0; n < t.length; n++) { const i = t[n]; @@ -1305,49 +1305,49 @@ function dse(...t) { } return r; } -class T5 { +class I5 { // Safe version that clones internal state clone() { return this._cloneInto(); } } -function R5(t) { +function C5(t) { const e = (n) => t().update(C0(n)).digest(), r = t(); return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = () => t(), e; } -function ED(t) { +function SD(t) { const e = (n, i) => t(i).update(C0(n)).digest(), r = t({}); return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = (n) => t(n), e; } -function pse(t = 32) { +function vse(t = 32) { if (qc && typeof qc.getRandomValues == "function") return qc.getRandomValues(new Uint8Array(t)); if (qc && typeof qc.randomBytes == "function") return qc.randomBytes(t); throw new Error("crypto.getRandomValues must be defined"); } -const D5 = [], O5 = [], N5 = [], SD = /* @__PURE__ */ BigInt(0), yf = /* @__PURE__ */ BigInt(1), AD = /* @__PURE__ */ BigInt(2), PD = /* @__PURE__ */ BigInt(7), MD = /* @__PURE__ */ BigInt(256), ID = /* @__PURE__ */ BigInt(113); +const T5 = [], R5 = [], D5 = [], AD = /* @__PURE__ */ BigInt(0), yf = /* @__PURE__ */ BigInt(1), PD = /* @__PURE__ */ BigInt(2), MD = /* @__PURE__ */ BigInt(7), ID = /* @__PURE__ */ BigInt(256), CD = /* @__PURE__ */ BigInt(113); for (let t = 0, e = yf, r = 1, n = 0; t < 24; t++) { - [r, n] = [n, (2 * r + 3 * n) % 5], D5.push(2 * (5 * n + r)), O5.push((t + 1) * (t + 2) / 2 % 64); - let i = SD; + [r, n] = [n, (2 * r + 3 * n) % 5], T5.push(2 * (5 * n + r)), R5.push((t + 1) * (t + 2) / 2 % 64); + let i = AD; for (let s = 0; s < 7; s++) - e = (e << yf ^ (e >> PD) * ID) % MD, e & AD && (i ^= yf << (yf << /* @__PURE__ */ BigInt(s)) - yf); - N5.push(i); + e = (e << yf ^ (e >> MD) * CD) % ID, e & PD && (i ^= yf << (yf << /* @__PURE__ */ BigInt(s)) - yf); + D5.push(i); } -const [CD, TD] = /* @__PURE__ */ dD(N5, !0), A2 = (t, e, r) => r > 32 ? mD(t, e, r) : pD(t, e, r), P2 = (t, e, r) => r > 32 ? vD(t, e, r) : gD(t, e, r); -function L5(t, e = 24) { +const [TD, RD] = /* @__PURE__ */ pD(D5, !0), E2 = (t, e, r) => r > 32 ? vD(t, e, r) : gD(t, e, r), S2 = (t, e, r) => r > 32 ? bD(t, e, r) : mD(t, e, r); +function O5(t, e = 24) { const r = new Uint32Array(10); for (let n = 24 - e; n < 24; n++) { for (let o = 0; o < 10; o++) r[o] = t[o] ^ t[o + 10] ^ t[o + 20] ^ t[o + 30] ^ t[o + 40]; for (let o = 0; o < 10; o += 2) { - const a = (o + 8) % 10, u = (o + 2) % 10, l = r[u], d = r[u + 1], p = A2(l, d, 1) ^ r[a], w = P2(l, d, 1) ^ r[a + 1]; + const a = (o + 8) % 10, u = (o + 2) % 10, l = r[u], d = r[u + 1], p = E2(l, d, 1) ^ r[a], w = S2(l, d, 1) ^ r[a + 1]; for (let A = 0; A < 50; A += 10) t[o + A] ^= p, t[o + A + 1] ^= w; } let i = t[2], s = t[3]; for (let o = 0; o < 24; o++) { - const a = O5[o], u = A2(i, s, a), l = P2(i, s, a), d = D5[o]; + const a = R5[o], u = E2(i, s, a), l = S2(i, s, a), d = T5[o]; i = t[d], s = t[d + 1], t[d] = u, t[d + 1] = l; } for (let o = 0; o < 50; o += 10) { @@ -1356,19 +1356,19 @@ function L5(t, e = 24) { for (let a = 0; a < 10; a++) t[o + a] ^= ~r[(a + 2) % 10] & r[(a + 4) % 10]; } - t[0] ^= CD[n], t[1] ^= TD[n]; + t[0] ^= TD[n], t[1] ^= RD[n]; } r.fill(0); } -class kl extends T5 { +class kl extends I5 { // NOTE: we accept arguments in bytes instead of bits here. constructor(e, r, n, i = !1, s = 24) { if (super(), this.blockLen = e, this.suffix = r, this.outputLen = n, this.enableXOF = i, this.rounds = s, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, Wd(n), 0 >= this.blockLen || this.blockLen >= 200) throw new Error("Sha3 supports only keccak-f1600 function"); - this.state = new Uint8Array(200), this.state32 = bD(this.state); + this.state = new Uint8Array(200), this.state32 = yD(this.state); } keccak() { - E2 || S2(this.state32), L5(this.state32, this.rounds), E2 || S2(this.state32), this.posOut = 0, this.pos = 0; + x2 || _2(this.state32), O5(this.state32, this.rounds), x2 || _2(this.state32), this.posOut = 0, this.pos = 0; } update(e) { Hd(this); @@ -1409,7 +1409,7 @@ class kl extends T5 { return Wd(e), this.xofInto(new Uint8Array(e)); } digestInto(e) { - if (C5(e, this), this.finished) + if (M5(e, this), this.finished) throw new Error("digest() was already called"); return this.writeInto(e), this.destroy(), e; } @@ -1424,30 +1424,30 @@ class kl extends T5 { return e || (e = new kl(r, n, i, o, s)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = s, e.suffix = n, e.outputLen = i, e.enableXOF = o, e.destroyed = this.destroyed, e; } } -const Ia = (t, e, r) => R5(() => new kl(e, t, r)), RD = /* @__PURE__ */ Ia(6, 144, 224 / 8), DD = /* @__PURE__ */ Ia(6, 136, 256 / 8), OD = /* @__PURE__ */ Ia(6, 104, 384 / 8), ND = /* @__PURE__ */ Ia(6, 72, 512 / 8), LD = /* @__PURE__ */ Ia(1, 144, 224 / 8), k5 = /* @__PURE__ */ Ia(1, 136, 256 / 8), kD = /* @__PURE__ */ Ia(1, 104, 384 / 8), $D = /* @__PURE__ */ Ia(1, 72, 512 / 8), $5 = (t, e, r) => ED((n = {}) => new kl(e, t, n.dkLen === void 0 ? r : n.dkLen, !0)), BD = /* @__PURE__ */ $5(31, 168, 128 / 8), FD = /* @__PURE__ */ $5(31, 136, 256 / 8), jD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +const Aa = (t, e, r) => C5(() => new kl(e, t, r)), DD = /* @__PURE__ */ Aa(6, 144, 224 / 8), OD = /* @__PURE__ */ Aa(6, 136, 256 / 8), ND = /* @__PURE__ */ Aa(6, 104, 384 / 8), LD = /* @__PURE__ */ Aa(6, 72, 512 / 8), kD = /* @__PURE__ */ Aa(1, 144, 224 / 8), N5 = /* @__PURE__ */ Aa(1, 136, 256 / 8), $D = /* @__PURE__ */ Aa(1, 104, 384 / 8), BD = /* @__PURE__ */ Aa(1, 72, 512 / 8), L5 = (t, e, r) => SD((n = {}) => new kl(e, t, n.dkLen === void 0 ? r : n.dkLen, !0)), FD = /* @__PURE__ */ L5(31, 168, 128 / 8), jD = /* @__PURE__ */ L5(31, 136, 256 / 8), UD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, Keccak: kl, - keccakP: L5, - keccak_224: LD, - keccak_256: k5, - keccak_384: kD, - keccak_512: $D, - sha3_224: RD, - sha3_256: DD, - sha3_384: OD, - sha3_512: ND, - shake128: BD, - shake256: FD + keccakP: O5, + keccak_224: kD, + keccak_256: N5, + keccak_384: $D, + keccak_512: BD, + sha3_224: DD, + sha3_256: OD, + sha3_384: ND, + sha3_512: LD, + shake128: FD, + shake256: jD }, Symbol.toStringTag, { value: "Module" })); function $l(t, e) { - const r = e || "hex", n = k5(ya(t, { strict: !1 }) ? _v(t) : t); + const r = e || "hex", n = N5(va(t, { strict: !1 }) ? _v(t) : t); return r === "bytes" ? n : zd(n); } -const UD = (t) => $l(_v(t)); -function qD(t) { - return UD(t); -} +const qD = (t) => $l(_v(t)); function zD(t) { + return qD(t); +} +function WD(t) { let e = !0, r = "", n = 0, i = "", s = !1; for (let o = 0; o < t.length; o++) { const a = t[o]; @@ -1472,14 +1472,14 @@ function zD(t) { throw new yt("Unable to normalize signature."); return i; } -const WD = (t) => { - const e = typeof t == "string" ? t : zR(t); - return zD(e); +const HD = (t) => { + const e = typeof t == "string" ? t : WR(t); + return WD(e); }; -function B5(t) { - return qD(WD(t)); +function k5(t) { + return zD(HD(t)); } -const HD = B5; +const KD = k5; class yu extends yt { constructor({ address: e }) { super(`Address "${e}" is invalid.`, { @@ -1516,29 +1516,29 @@ const Fg = /* @__PURE__ */ new T0(8192); function Bl(t, e) { if (Fg.has(`${t}.${e}`)) return Fg.get(`${t}.${e}`); - const r = t.substring(2).toLowerCase(), n = $l(I5(r), "bytes"), i = r.split(""); + const r = t.substring(2).toLowerCase(), n = $l(P5(r), "bytes"), i = r.split(""); for (let o = 0; o < 40; o += 2) n[o >> 1] >> 4 >= 8 && i[o] && (i[o] = i[o].toUpperCase()), (n[o >> 1] & 15) >= 8 && i[o + 1] && (i[o + 1] = i[o + 1].toUpperCase()); const s = `0x${i.join("")}`; return Fg.set(`${t}.${e}`, s), s; } function Ev(t, e) { - if (!$o(t, { strict: !1 })) + if (!ko(t, { strict: !1 })) throw new yu({ address: t }); return Bl(t, e); } -const KD = /^0x[a-fA-F0-9]{40}$/, jg = /* @__PURE__ */ new T0(8192); -function $o(t, e) { +const VD = /^0x[a-fA-F0-9]{40}$/, jg = /* @__PURE__ */ new T0(8192); +function ko(t, e) { const { strict: r = !0 } = e ?? {}, n = `${t}.${r}`; if (jg.has(n)) return jg.get(n); - const i = KD.test(t) ? t.toLowerCase() === t ? !0 : r ? Bl(t) === t : !0 : !1; + const i = VD.test(t) ? t.toLowerCase() === t ? !0 : r ? Bl(t) === t : !0 : !1; return jg.set(n, i), i; } function wu(t) { - return typeof t[0] == "string" ? R0(t) : VD(t); + return typeof t[0] == "string" ? R0(t) : GD(t); } -function VD(t) { +function GD(t) { let e = 0; for (const i of t) e += i.length; @@ -1552,51 +1552,51 @@ function R0(t) { return `0x${t.reduce((e, r) => e + r.replace("0x", ""), "")}`; } function Kd(t, e, r, { strict: n } = {}) { - return ya(t, { strict: !1 }) ? GD(t, e, r, { + return va(t, { strict: !1 }) ? YD(t, e, r, { strict: n - }) : U5(t, e, r, { + }) : F5(t, e, r, { strict: n }); } -function F5(t, e) { +function $5(t, e) { if (typeof e == "number" && e > 0 && e > An(t) - 1) - throw new A5({ + throw new E5({ offset: e, position: "start", size: An(t) }); } -function j5(t, e, r) { +function B5(t, e, r) { if (typeof e == "number" && typeof r == "number" && An(t) !== r - e) - throw new A5({ + throw new E5({ offset: r, position: "end", size: An(t) }); } -function U5(t, e, r, { strict: n } = {}) { - F5(t, e); +function F5(t, e, r, { strict: n } = {}) { + $5(t, e); const i = t.slice(e, r); - return n && j5(i, e, r), i; + return n && B5(i, e, r), i; } -function GD(t, e, r, { strict: n } = {}) { - F5(t, e); +function YD(t, e, r, { strict: n } = {}) { + $5(t, e); const i = `0x${t.replace("0x", "").slice((e ?? 0) * 2, (r ?? t.length) * 2)}`; - return n && j5(i, e, r), i; + return n && B5(i, e, r), i; } -function q5(t, e) { +function j5(t, e) { if (t.length !== e.length) - throw new YR({ + throw new JR({ expectedLength: t.length, givenLength: e.length }); - const r = YD({ + const r = JD({ params: t, values: e }), n = Av(r); return n.length === 0 ? "0x" : n; } -function YD({ params: t, values: e }) { +function JD({ params: t, values: e }) { const r = []; for (let n = 0; n < t.length; n++) r.push(Sv({ param: t[n], value: e[n] })); @@ -1606,25 +1606,25 @@ function Sv({ param: t, value: e }) { const r = Pv(t.type); if (r) { const [n, i] = r; - return XD(e, { length: n, param: { ...t, type: i } }); + return ZD(e, { length: n, param: { ...t, type: i } }); } if (t.type === "tuple") - return rO(e, { + return nO(e, { param: t }); if (t.type === "address") - return JD(e); + return XD(e); if (t.type === "bool") - return QD(e); + return eO(e); if (t.type.startsWith("uint") || t.type.startsWith("int")) { const n = t.type.startsWith("int"); - return eO(e, { signed: n }); + return tO(e, { signed: n }); } if (t.type.startsWith("bytes")) - return ZD(e, { param: t }); + return QD(e, { param: t }); if (t.type === "string") - return tO(e); - throw new ZR(t.type, { + return rO(e); + throw new QR(t.type, { docsPath: "/docs/contract/encodeAbiParameters" }); } @@ -1642,17 +1642,17 @@ function Av(t) { } return wu([...r, ...n]); } -function JD(t) { - if (!$o(t)) +function XD(t) { + if (!ko(t)) throw new yu({ address: t }); - return { dynamic: !1, encoded: ba(t.toLowerCase()) }; + return { dynamic: !1, encoded: ma(t.toLowerCase()) }; } -function XD(t, { length: e, param: r }) { +function ZD(t, { length: e, param: r }) { const n = e === null; if (!Array.isArray(t)) - throw new eD(t); + throw new tD(t); if (!n && t.length !== e) - throw new VR({ + throw new GR({ expectedLength: e, givenLength: t.length, type: `${r.type}[${e}]` @@ -1680,31 +1680,31 @@ function XD(t, { length: e, param: r }) { encoded: wu(s.map(({ encoded: o }) => o)) }; } -function ZD(t, { param: e }) { +function QD(t, { param: e }) { const [, r] = e.type.split("bytes"), n = An(t); if (!r) { let i = t; - return n % 32 !== 0 && (i = ba(i, { + return n % 32 !== 0 && (i = ma(i, { dir: "right", size: Math.ceil((t.length - 2) / 2 / 32) * 32 })), { dynamic: !0, - encoded: wu([ba(Mr(n, { size: 32 })), i]) + encoded: wu([ma(Mr(n, { size: 32 })), i]) }; } if (n !== Number.parseInt(r)) - throw new GR({ + throw new YR({ expectedSize: Number.parseInt(r), value: t }); - return { dynamic: !1, encoded: ba(t, { dir: "right" }) }; + return { dynamic: !1, encoded: ma(t, { dir: "right" }) }; } -function QD(t) { +function eO(t) { if (typeof t != "boolean") throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`); - return { dynamic: !1, encoded: ba(M5(t)) }; + return { dynamic: !1, encoded: ma(A5(t)) }; } -function eO(t, { signed: e }) { +function tO(t, { signed: e }) { return { dynamic: !1, encoded: Mr(t, { @@ -1713,21 +1713,21 @@ function eO(t, { signed: e }) { }) }; } -function tO(t) { +function rO(t) { const e = I0(t), r = Math.ceil(An(e) / 32), n = []; for (let i = 0; i < r; i++) - n.push(ba(Kd(e, i * 32, (i + 1) * 32), { + n.push(ma(Kd(e, i * 32, (i + 1) * 32), { dir: "right" })); return { dynamic: !0, encoded: wu([ - ba(Mr(An(e), { size: 32 })), + ma(Mr(An(e), { size: 32 })), ...n ]) }; } -function rO(t, { param: e }) { +function nO(t, { param: e }) { let r = !1; const n = []; for (let i = 0; i < e.components.length; i++) { @@ -1749,9 +1749,9 @@ function Pv(t) { [e[2] ? Number(e[2]) : null, e[1]] ) : void 0; } -const Mv = (t) => Kd(B5(t), 0, 4); -function z5(t) { - const { abi: e, args: r = [], name: n } = t, i = ya(n, { strict: !1 }), s = e.filter((a) => i ? a.type === "function" ? Mv(a) === n : a.type === "event" ? HD(a) === n : !1 : "name" in a && a.name === n); +const Mv = (t) => Kd(k5(t), 0, 4); +function U5(t) { + const { abi: e, args: r = [], name: n } = t, i = va(n, { strict: !1 }), s = e.filter((a) => i ? a.type === "function" ? Mv(a) === n : a.type === "event" ? KD(a) === n : !1 : "name" in a && a.name === n); if (s.length === 0) return; if (s.length === 1) @@ -1772,9 +1772,9 @@ function z5(t) { return p ? Xm(l, p) : !1; })) { if (o && "inputs" in o && o.inputs) { - const l = W5(a.inputs, o.inputs, r); + const l = q5(a.inputs, o.inputs, r); if (l) - throw new JR({ + throw new XR({ abiItem: a, type: l[0] }, { @@ -1791,7 +1791,7 @@ function Xm(t, e) { const r = typeof t, n = e.type; switch (n) { case "address": - return $o(t, { strict: !1 }); + return ko(t, { strict: !1 }); case "bool": return r === "boolean"; case "function": @@ -1806,48 +1806,48 @@ function Xm(t, e) { })) : !1; } } -function W5(t, e, r) { +function q5(t, e, r) { for (const n in t) { const i = t[n], s = e[n]; if (i.type === "tuple" && s.type === "tuple" && "components" in i && "components" in s) - return W5(i.components, s.components, r[n]); + return q5(i.components, s.components, r[n]); const o = [i.type, s.type]; - if (o.includes("address") && o.includes("bytes20") ? !0 : o.includes("address") && o.includes("string") ? $o(r[n], { strict: !1 }) : o.includes("address") && o.includes("bytes") ? $o(r[n], { strict: !1 }) : !1) + if (o.includes("address") && o.includes("bytes20") ? !0 : o.includes("address") && o.includes("string") ? ko(r[n], { strict: !1 }) : o.includes("address") && o.includes("bytes") ? ko(r[n], { strict: !1 }) : !1) return o; } } -function Wo(t) { +function qo(t) { return typeof t == "string" ? { address: t, type: "json-rpc" } : t; } -const M2 = "/docs/contract/encodeFunctionData"; -function nO(t) { +const A2 = "/docs/contract/encodeFunctionData"; +function iO(t) { const { abi: e, args: r, functionName: n } = t; let i = e[0]; if (n) { - const s = z5({ + const s = U5({ abi: e, args: r, name: n }); if (!s) - throw new y2(n, { docsPath: M2 }); + throw new v2(n, { docsPath: A2 }); i = s; } if (i.type !== "function") - throw new y2(void 0, { docsPath: M2 }); + throw new v2(void 0, { docsPath: A2 }); return { abi: [i], functionName: Mv(vu(i)) }; } -function iO(t) { +function sO(t) { const { args: e } = t, { abi: r, functionName: n } = (() => { var a; - return t.abi.length === 1 && ((a = t.functionName) != null && a.startsWith("0x")) ? t : nO(t); - })(), i = r[0], s = n, o = "inputs" in i && i.inputs ? q5(i.inputs, e ?? []) : void 0; + return t.abi.length === 1 && ((a = t.functionName) != null && a.startsWith("0x")) ? t : iO(t); + })(), i = r[0], s = n, o = "inputs" in i && i.inputs ? j5(i.inputs, e ?? []) : void 0; return R0([s, o ?? "0x"]); } -const sO = { +const oO = { 1: "An `assert` condition failed.", 17: "Arithmetic operation resulted in underflow or overflow.", 18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).", @@ -1857,7 +1857,7 @@ const sO = { 50: "Array index is out of bounds.", 65: "Allocated too much memory or created an array which is too large.", 81: "Attempted to call a zero-initialized variable of internal function type." -}, oO = { +}, aO = { inputs: [ { name: "message", @@ -1866,7 +1866,7 @@ const sO = { ], name: "Error", type: "error" -}, aO = { +}, cO = { inputs: [ { name: "reason", @@ -1876,24 +1876,24 @@ const sO = { name: "Panic", type: "error" }; -class I2 extends yt { +class P2 extends yt { constructor({ offset: e }) { super(`Offset \`${e}\` cannot be negative.`, { name: "NegativeOffsetError" }); } } -class cO extends yt { +class uO extends yt { constructor({ length: e, position: r }) { super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`, { name: "PositionOutOfBoundsError" }); } } -class uO extends yt { +class fO extends yt { constructor({ count: e, limit: r }) { super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`, { name: "RecursiveReadLimitExceededError" }); } } -const fO = { +const lO = { bytes: new Uint8Array(), dataView: new DataView(new ArrayBuffer(0)), position: 0, @@ -1902,21 +1902,21 @@ const fO = { recursiveReadLimit: Number.POSITIVE_INFINITY, assertReadLimit() { if (this.recursiveReadCount >= this.recursiveReadLimit) - throw new uO({ + throw new fO({ count: this.recursiveReadCount + 1, limit: this.recursiveReadLimit }); }, assertPosition(t) { if (t < 0 || t > this.bytes.length - 1) - throw new cO({ + throw new uO({ length: this.bytes.length, position: t }); }, decrementPosition(t) { if (t < 0) - throw new I2({ offset: t }); + throw new P2({ offset: t }); const e = this.position - t; this.assertPosition(e), this.position = e; }, @@ -1925,7 +1925,7 @@ const fO = { }, incrementPosition(t) { if (t < 0) - throw new I2({ offset: t }); + throw new P2({ offset: t }); const e = this.position + t; this.assertPosition(e), this.position = e; }, @@ -2016,36 +2016,36 @@ const fO = { } }; function Iv(t, { recursiveReadLimit: e = 8192 } = {}) { - const r = Object.create(fO); + const r = Object.create(lO); return r.bytes = t, r.dataView = new DataView(t.buffer, t.byteOffset, t.byteLength), r.positionReadCount = /* @__PURE__ */ new Map(), r.recursiveReadLimit = e, r; } -function lO(t, e = {}) { - typeof e.size < "u" && ro(t, { size: e.size }); - const r = wi(t, e); +function hO(t, e = {}) { + typeof e.size < "u" && to(t, { size: e.size }); + const r = xi(t, e); return el(r, e); } -function hO(t, e = {}) { +function dO(t, e = {}) { let r = t; - if (typeof e.size < "u" && (ro(r, { size: e.size }), r = xv(r)), r.length > 1 || r[0] > 1) - throw new iD(r); + if (typeof e.size < "u" && (to(r, { size: e.size }), r = xv(r)), r.length > 1 || r[0] > 1) + throw new sD(r); return !!r[0]; } -function To(t, e = {}) { - typeof e.size < "u" && ro(t, { size: e.size }); - const r = wi(t, e); +function Io(t, e = {}) { + typeof e.size < "u" && to(t, { size: e.size }); + const r = xi(t, e); return bu(r, e); } -function dO(t, e = {}) { +function pO(t, e = {}) { let r = t; - return typeof e.size < "u" && (ro(r, { size: e.size }), r = xv(r, { dir: "right" })), new TextDecoder().decode(r); + return typeof e.size < "u" && (to(r, { size: e.size }), r = xv(r, { dir: "right" })), new TextDecoder().decode(r); } -function pO(t, e) { - const r = typeof e == "string" ? ko(e) : e, n = Iv(r); +function gO(t, e) { + const r = typeof e == "string" ? Lo(e) : e, n = Iv(r); if (An(r) === 0 && t.length > 0) throw new wv(); if (An(e) && An(e) < 32) - throw new KR({ - data: typeof e == "string" ? e : wi(e), + throw new VR({ + data: typeof e == "string" ? e : xi(e), params: t, size: An(e) }); @@ -2065,47 +2065,47 @@ function au(t, e, { staticPosition: r }) { const n = Pv(e.type); if (n) { const [i, s] = n; - return mO(t, { ...e, type: s }, { length: i, staticPosition: r }); + return vO(t, { ...e, type: s }, { length: i, staticPosition: r }); } if (e.type === "tuple") - return wO(t, e, { staticPosition: r }); + return xO(t, e, { staticPosition: r }); if (e.type === "address") - return gO(t); + return mO(t); if (e.type === "bool") - return vO(t); + return bO(t); if (e.type.startsWith("bytes")) - return bO(t, e, { staticPosition: r }); + return yO(t, e, { staticPosition: r }); if (e.type.startsWith("uint") || e.type.startsWith("int")) - return yO(t, e); + return wO(t, e); if (e.type === "string") - return xO(t, { staticPosition: r }); - throw new QR(e.type, { + return _O(t, { staticPosition: r }); + throw new eD(e.type, { docsPath: "/docs/contract/decodeAbiParameters" }); } -const C2 = 32, Zm = 32; -function gO(t) { +const M2 = 32, Zm = 32; +function mO(t) { const e = t.readBytes(32); - return [Bl(wi(U5(e, -20))), 32]; + return [Bl(xi(F5(e, -20))), 32]; } -function mO(t, e, { length: r, staticPosition: n }) { +function vO(t, e, { length: r, staticPosition: n }) { if (!r) { - const o = To(t.readBytes(Zm)), a = n + o, u = a + C2; + const o = Io(t.readBytes(Zm)), a = n + o, u = a + M2; t.setPosition(a); - const l = To(t.readBytes(C2)), d = tl(e); + const l = Io(t.readBytes(M2)), d = tl(e); let p = 0; const w = []; for (let A = 0; A < l; ++A) { t.setPosition(u + (d ? A * 32 : p)); - const [P, N] = au(t, e, { + const [M, N] = au(t, e, { staticPosition: u }); - p += N, w.push(P); + p += N, w.push(M); } return t.setPosition(n + 32), [w, 32]; } if (tl(e)) { - const o = To(t.readBytes(Zm)), a = n + o, u = []; + const o = Io(t.readBytes(Zm)), a = n + o, u = []; for (let l = 0; l < r; ++l) { t.setPosition(a + l * 32); const [d] = au(t, e, { @@ -2125,34 +2125,34 @@ function mO(t, e, { length: r, staticPosition: n }) { } return [s, i]; } -function vO(t) { - return [hO(t.readBytes(32), { size: 32 }), 32]; +function bO(t) { + return [dO(t.readBytes(32), { size: 32 }), 32]; } -function bO(t, e, { staticPosition: r }) { +function yO(t, e, { staticPosition: r }) { const [n, i] = e.type.split("bytes"); if (!i) { - const o = To(t.readBytes(32)); + const o = Io(t.readBytes(32)); t.setPosition(r + o); - const a = To(t.readBytes(32)); + const a = Io(t.readBytes(32)); if (a === 0) return t.setPosition(r + 32), ["0x", 32]; const u = t.readBytes(a); - return t.setPosition(r + 32), [wi(u), 32]; + return t.setPosition(r + 32), [xi(u), 32]; } - return [wi(t.readBytes(Number.parseInt(i), 32)), 32]; + return [xi(t.readBytes(Number.parseInt(i), 32)), 32]; } -function yO(t, e) { +function wO(t, e) { const r = e.type.startsWith("int"), n = Number.parseInt(e.type.split("int")[1] || "256"), i = t.readBytes(32); return [ - n > 48 ? lO(i, { signed: r }) : To(i, { signed: r }), + n > 48 ? hO(i, { signed: r }) : Io(i, { signed: r }), 32 ]; } -function wO(t, e, { staticPosition: r }) { +function xO(t, e, { staticPosition: r }) { const n = e.components.length === 0 || e.components.some(({ name: o }) => !o), i = n ? [] : {}; let s = 0; if (tl(e)) { - const o = To(t.readBytes(Zm)), a = r + o; + const o = Io(t.readBytes(Zm)), a = r + o; for (let u = 0; u < e.components.length; ++u) { const l = e.components[u]; t.setPosition(a + s); @@ -2171,13 +2171,13 @@ function wO(t, e, { staticPosition: r }) { } return [i, s]; } -function xO(t, { staticPosition: e }) { - const r = To(t.readBytes(32)), n = e + r; +function _O(t, { staticPosition: e }) { + const r = Io(t.readBytes(32)), n = e + r; t.setPosition(n); - const i = To(t.readBytes(32)); + const i = Io(t.readBytes(32)); if (i === 0) return t.setPosition(e + 32), ["", 32]; - const s = t.readBytes(i, 32), o = dO(xv(s)); + const s = t.readBytes(i, 32), o = pO(xv(s)); return t.setPosition(e + 32), [o, 32]; } function tl(t) { @@ -2190,34 +2190,34 @@ function tl(t) { const r = Pv(t.type); return !!(r && tl({ ...t, type: r[1] })); } -function _O(t) { +function EO(t) { const { abi: e, data: r } = t, n = Kd(r, 0, 4); if (n === "0x") throw new wv(); - const s = [...e || [], oO, aO].find((o) => o.type === "error" && n === Mv(vu(o))); + const s = [...e || [], aO, cO].find((o) => o.type === "error" && n === Mv(vu(o))); if (!s) - throw new S5(n, { + throw new _5(n, { docsPath: "/docs/contract/decodeErrorResult" }); return { abiItem: s, - args: "inputs" in s && s.inputs && s.inputs.length > 0 ? pO(s.inputs, Kd(r, 4)) : void 0, + args: "inputs" in s && s.inputs && s.inputs.length > 0 ? gO(s.inputs, Kd(r, 4)) : void 0, errorName: s.name }; } const Ru = (t, e, r) => JSON.stringify(t, (n, i) => typeof i == "bigint" ? i.toString() : i, r); -function H5({ abiItem: t, args: e, includeFunctionName: r = !0, includeName: n = !1 }) { +function z5({ abiItem: t, args: e, includeFunctionName: r = !0, includeName: n = !1 }) { if ("name" in t && "inputs" in t && t.inputs) return `${r ? t.name : ""}(${t.inputs.map((i, s) => `${n && i.name ? `${i.name}: ` : ""}${typeof e[s] == "object" ? Ru(e[s]) : e[s]}`).join(", ")})`; } -const EO = { +const SO = { gwei: 9, wei: 18 -}, SO = { +}, AO = { ether: -9, wei: 9 }; -function K5(t, e) { +function W5(t, e) { let r = t.toString(); const n = r.startsWith("-"); n && (r = r.slice(1)), r = r.padStart(e, "0"); @@ -2227,20 +2227,20 @@ function K5(t, e) { ]; return s = s.replace(/(0+)$/, ""), `${n ? "-" : ""}${i || "0"}${s ? `.${s}` : ""}`; } -function V5(t, e = "wei") { - return K5(t, EO[e]); +function H5(t, e = "wei") { + return W5(t, SO[e]); } function Es(t, e = "wei") { - return K5(t, SO[e]); + return W5(t, AO[e]); } -class AO extends yt { +class PO extends yt { constructor({ address: e }) { super(`State for account "${e}" is set multiple times.`, { name: "AccountStateConflictError" }); } } -class PO extends yt { +class MO extends yt { constructor() { super("state and stateDiff are set on the same account.", { name: "StateAssignmentConflictError" @@ -2252,7 +2252,7 @@ function D0(t) { return e.map(([n, i]) => ` ${`${n}:`.padEnd(r + 1)} ${i}`).join(` `); } -class MO extends yt { +class IO extends yt { constructor() { super([ "Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.", @@ -2261,7 +2261,7 @@ class MO extends yt { `), { name: "FeeConflictError" }); } } -class IO extends yt { +class CO extends yt { constructor({ transaction: e }) { super("Cannot infer a transaction type from provided transaction.", { metaMessages: [ @@ -2282,14 +2282,14 @@ class IO extends yt { }); } } -class CO extends yt { +class TO extends yt { constructor(e, { account: r, docsPath: n, chain: i, data: s, gas: o, gasPrice: a, maxFeePerGas: u, maxPriorityFeePerGas: l, nonce: d, to: p, value: w }) { - var P; + var M; const A = D0({ chain: i && `${i == null ? void 0 : i.name} (id: ${i == null ? void 0 : i.id})`, from: r == null ? void 0 : r.address, to: p, - value: typeof w < "u" && `${V5(w)} ${((P = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : P.symbol) || "ETH"}`, + value: typeof w < "u" && `${H5(w)} ${((M = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : M.symbol) || "ETH"}`, data: s, gas: o, gasPrice: typeof a < "u" && `${Es(a)} gwei`, @@ -2314,16 +2314,16 @@ class CO extends yt { }), this.cause = e; } } -const TO = (t) => t, G5 = (t) => t; -class RO extends yt { +const RO = (t) => t, K5 = (t) => t; +class DO extends yt { constructor(e, { abi: r, args: n, contractAddress: i, docsPath: s, functionName: o, sender: a }) { - const u = z5({ abi: r, args: n, name: o }), l = u ? H5({ + const u = U5({ abi: r, args: n, name: o }), l = u ? z5({ abiItem: u, args: n, includeFunctionName: !1, includeName: !1 }) : void 0, d = u ? vu(u, { includeName: !0 }) : void 0, p = D0({ - address: i && TO(i), + address: i && RO(i), function: d, args: l && l !== "()" && `${[...Array((o == null ? void 0 : o.length) ?? 0).keys()].map(() => " ").join("")}${l}`, sender: a @@ -2375,20 +2375,20 @@ class RO extends yt { }), this.abi = r, this.args = n, this.cause = e, this.contractAddress = i, this.functionName = o, this.sender = a; } } -class DO extends yt { +class OO extends yt { constructor({ abi: e, data: r, functionName: n, message: i }) { let s, o, a, u; if (r && r !== "0x") try { - o = _O({ abi: e, data: r }); + o = EO({ abi: e, data: r }); const { abiItem: d, errorName: p, args: w } = o; if (p === "Error") u = w[0]; else if (p === "Panic") { const [A] = w; - u = sO[A]; + u = oO[A]; } else { - const A = d ? vu(d, { includeName: !0 }) : void 0, P = d && w ? H5({ + const A = d ? vu(d, { includeName: !0 }) : void 0, M = d && w ? z5({ abiItem: d, args: w, includeFunctionName: !1, @@ -2396,7 +2396,7 @@ class DO extends yt { }) : void 0; a = [ A ? `Error: ${A}` : "", - P && P !== "()" ? ` ${[...Array((p == null ? void 0 : p.length) ?? 0).keys()].map(() => " ").join("")}${P}` : "" + M && M !== "()" ? ` ${[...Array((p == null ? void 0 : p.length) ?? 0).keys()].map(() => " ").join("")}${M}` : "" ]; } } catch (d) { @@ -2404,7 +2404,7 @@ class DO extends yt { } else i && (u = i); let l; - s instanceof S5 && (l = s.signature, a = [ + s instanceof _5 && (l = s.signature, a = [ `Unable to decode signature "${l}" as it was not found on the provided ABI.`, "Make sure you are using the correct ABI and that the error exists on it.", `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.` @@ -2434,7 +2434,7 @@ class DO extends yt { }), this.data = o, this.reason = u, this.signature = l; } } -class OO extends yt { +class NO extends yt { constructor({ functionName: e }) { super(`The contract function "${e}" returned no data ("0x").`, { metaMessages: [ @@ -2447,7 +2447,7 @@ class OO extends yt { }); } } -class NO extends yt { +class LO extends yt { constructor({ data: e, message: r }) { super(r || "", { name: "RawContractError" }), Object.defineProperty(this, "code", { enumerable: !0, @@ -2462,14 +2462,14 @@ class NO extends yt { }), this.data = e; } } -class Y5 extends yt { +class V5 extends yt { constructor({ body: e, cause: r, details: n, headers: i, status: s, url: o }) { super("HTTP request failed.", { cause: r, details: n, metaMessages: [ s && `Status: ${s}`, - `URL: ${G5(o)}`, + `URL: ${K5(o)}`, e && `Request body: ${Ru(e)}` ].filter(Boolean), name: "HttpRequestError" @@ -2496,12 +2496,12 @@ class Y5 extends yt { }), this.body = e, this.headers = i, this.status = s, this.url = o; } } -class LO extends yt { +class kO extends yt { constructor({ body: e, error: r, url: n }) { super("RPC Request failed.", { cause: r, details: r.message, - metaMessages: [`URL: ${G5(n)}`, `Request body: ${Ru(e)}`], + metaMessages: [`URL: ${K5(n)}`, `Request body: ${Ru(e)}`], name: "RpcRequestError" }), Object.defineProperty(this, "code", { enumerable: !0, @@ -2511,8 +2511,8 @@ class LO extends yt { }), this.code = r.code; } } -const kO = -1; -class Ei extends yt { +const $O = -1; +class Si extends yt { constructor(e, { code: r, docsPath: n, metaMessages: i, name: s, shortMessage: o }) { super(o, { cause: e, @@ -2524,10 +2524,10 @@ class Ei extends yt { configurable: !0, writable: !0, value: void 0 - }), this.name = s || e.name, this.code = e instanceof LO ? e.code : r ?? kO; + }), this.name = s || e.name, this.code = e instanceof kO ? e.code : r ?? $O; } } -class Du extends Ei { +class Du extends Si { constructor(e, r) { super(e, r), Object.defineProperty(this, "data", { enumerable: !0, @@ -2537,7 +2537,7 @@ class Du extends Ei { }), this.data = r.data; } } -class rl extends Ei { +class rl extends Si { constructor(e) { super(e, { code: rl.code, @@ -2552,7 +2552,7 @@ Object.defineProperty(rl, "code", { writable: !0, value: -32700 }); -class nl extends Ei { +class nl extends Si { constructor(e) { super(e, { code: nl.code, @@ -2567,7 +2567,7 @@ Object.defineProperty(nl, "code", { writable: !0, value: -32600 }); -class il extends Ei { +class il extends Si { constructor(e, { method: r } = {}) { super(e, { code: il.code, @@ -2582,7 +2582,7 @@ Object.defineProperty(il, "code", { writable: !0, value: -32601 }); -class sl extends Ei { +class sl extends Si { constructor(e) { super(e, { code: sl.code, @@ -2601,22 +2601,22 @@ Object.defineProperty(sl, "code", { writable: !0, value: -32602 }); -class fc extends Ei { +class uc extends Si { constructor(e) { super(e, { - code: fc.code, + code: uc.code, name: "InternalRpcError", shortMessage: "An internal error was received." }); } } -Object.defineProperty(fc, "code", { +Object.defineProperty(uc, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32603 }); -class ol extends Ei { +class ol extends Si { constructor(e) { super(e, { code: ol.code, @@ -2635,7 +2635,7 @@ Object.defineProperty(ol, "code", { writable: !0, value: -32e3 }); -class al extends Ei { +class al extends Si { constructor(e) { super(e, { code: al.code, @@ -2655,7 +2655,7 @@ Object.defineProperty(al, "code", { writable: !0, value: -32001 }); -class cl extends Ei { +class cl extends Si { constructor(e) { super(e, { code: cl.code, @@ -2670,7 +2670,7 @@ Object.defineProperty(cl, "code", { writable: !0, value: -32002 }); -class ul extends Ei { +class ul extends Si { constructor(e) { super(e, { code: ul.code, @@ -2685,7 +2685,7 @@ Object.defineProperty(ul, "code", { writable: !0, value: -32003 }); -class fl extends Ei { +class fl extends Si { constructor(e, { method: r } = {}) { super(e, { code: fl.code, @@ -2700,7 +2700,7 @@ Object.defineProperty(fl, "code", { writable: !0, value: -32004 }); -class xu extends Ei { +class xu extends Si { constructor(e) { super(e, { code: xu.code, @@ -2715,7 +2715,7 @@ Object.defineProperty(xu, "code", { writable: !0, value: -32005 }); -class ll extends Ei { +class ll extends Si { constructor(e) { super(e, { code: ll.code, @@ -2820,7 +2820,7 @@ Object.defineProperty(ml, "code", { writable: !0, value: 4902 }); -class $O extends Ei { +class BO extends Si { constructor(e) { super(e, { name: "UnknownRpcError", @@ -2828,15 +2828,15 @@ class $O extends Ei { }); } } -const BO = 3; -function FO(t, { abi: e, address: r, args: n, docsPath: i, functionName: s, sender: o }) { - const { code: a, data: u, message: l, shortMessage: d } = t instanceof NO ? t : t instanceof yt ? t.walk((w) => "data" in w) || t.walk() : {}, p = t instanceof wv ? new OO({ functionName: s }) : [BO, fc.code].includes(a) && (u || l || d) ? new DO({ +const FO = 3; +function jO(t, { abi: e, address: r, args: n, docsPath: i, functionName: s, sender: o }) { + const { code: a, data: u, message: l, shortMessage: d } = t instanceof LO ? t : t instanceof yt ? t.walk((w) => "data" in w) || t.walk() : {}, p = t instanceof wv ? new NO({ functionName: s }) : [FO, uc.code].includes(a) && (u || l || d) ? new OO({ abi: e, data: typeof u == "object" ? u.data : u, functionName: s, message: d ?? l }) : t; - return new RO(p, { + return new DO(p, { abi: e, args: n, contractAddress: r, @@ -2845,22 +2845,22 @@ function FO(t, { abi: e, address: r, args: n, docsPath: i, functionName: s, send sender: o }); } -function jO(t) { +function UO(t) { const e = $l(`0x${t.substring(4)}`).substring(26); return Bl(`0x${e}`); } -async function UO({ hash: t, signature: e }) { - const r = ya(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-DxcrBxlU.js"); +async function qO({ hash: t, signature: e }) { + const r = va(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-ChY4PDp8.js"); return `0x${(() => { if (typeof e == "object" && "r" in e && "s" in e) { - const { r: l, s: d, v: p, yParity: w } = e, A = Number(w ?? p), P = T2(A); - return new n.Signature(el(l), el(d)).addRecoveryBit(P); + const { r: l, s: d, v: p, yParity: w } = e, A = Number(w ?? p), M = I2(A); + return new n.Signature(el(l), el(d)).addRecoveryBit(M); } - const o = ya(e) ? e : zd(e), a = bu(`0x${o.slice(130)}`), u = T2(a); + const o = va(e) ? e : zd(e), a = bu(`0x${o.slice(130)}`), u = I2(a); return n.Signature.fromCompact(o.substring(2, 130)).addRecoveryBit(u); })().recoverPublicKey(r.substring(2)).toHex(!1)}`; } -function T2(t) { +function I2(t) { if (t === 0 || t === 1) return t; if (t === 27) @@ -2869,18 +2869,18 @@ function T2(t) { return 1; throw new Error("Invalid yParityOrV value"); } -async function qO({ hash: t, signature: e }) { - return jO(await UO({ hash: t, signature: e })); +async function zO({ hash: t, signature: e }) { + return UO(await qO({ hash: t, signature: e })); } -function zO(t, e = "hex") { - const r = J5(t), n = Iv(new Uint8Array(r.length)); - return r.encode(n), e === "hex" ? wi(n.bytes) : n.bytes; +function WO(t, e = "hex") { + const r = G5(t), n = Iv(new Uint8Array(r.length)); + return r.encode(n), e === "hex" ? xi(n.bytes) : n.bytes; } -function J5(t) { - return Array.isArray(t) ? WO(t.map((e) => J5(e))) : HO(t); +function G5(t) { + return Array.isArray(t) ? HO(t.map((e) => G5(e))) : KO(t); } -function WO(t) { - const e = t.reduce((i, s) => i + s.length, 0), r = X5(e); +function HO(t) { + const e = t.reduce((i, s) => i + s.length, 0), r = Y5(e); return { length: e <= 55 ? 1 + e : 1 + r + e, encode(i) { @@ -2890,8 +2890,8 @@ function WO(t) { } }; } -function HO(t) { - const e = typeof t == "string" ? ko(t) : t, r = X5(e.length); +function KO(t) { + const e = typeof t == "string" ? Lo(t) : t, r = Y5(e.length); return { length: e.length === 1 && e[0] < 128 ? 1 : e.length <= 55 ? 1 + e.length : 1 + r + e.length, encode(i) { @@ -2899,7 +2899,7 @@ function HO(t) { } }; } -function X5(t) { +function Y5(t) { if (t < 2 ** 8) return 1; if (t < 2 ** 16) @@ -2910,31 +2910,31 @@ function X5(t) { return 4; throw new yt("Length is too large."); } -function KO(t) { +function VO(t) { const { chainId: e, contractAddress: r, nonce: n, to: i } = t, s = $l(R0([ "0x05", - zO([ + WO([ e ? Mr(e) : "0x", r, n ? Mr(n) : "0x" ]) ])); - return i === "bytes" ? ko(s) : s; + return i === "bytes" ? Lo(s) : s; } -async function Z5(t) { +async function J5(t) { const { authorization: e, signature: r } = t; - return qO({ - hash: KO(e), + return zO({ + hash: VO(e), signature: r ?? e }); } -class VO extends yt { +class GO extends yt { constructor(e, { account: r, docsPath: n, chain: i, data: s, gas: o, gasPrice: a, maxFeePerGas: u, maxPriorityFeePerGas: l, nonce: d, to: p, value: w }) { - var P; + var M; const A = D0({ from: r == null ? void 0 : r.address, to: p, - value: typeof w < "u" && `${V5(w)} ${((P = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : P.symbol) || "ETH"}`, + value: typeof w < "u" && `${H5(w)} ${((M = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : M.symbol) || "ETH"}`, data: s, gas: o, gasPrice: typeof a < "u" && `${Es(a)} gwei`, @@ -3140,7 +3140,7 @@ class Cv extends yt { }); } } -function Q5(t, e) { +function X5(t, e) { const r = (t.details || "").toLowerCase(), n = t instanceof yt ? t.walk((i) => (i == null ? void 0 : i.code) === Zc.code) : t; return n instanceof yt ? new Zc({ cause: t, @@ -3162,17 +3162,17 @@ function Q5(t, e) { cause: t }); } -function GO(t, { docsPath: e, ...r }) { +function YO(t, { docsPath: e, ...r }) { const n = (() => { - const i = Q5(t, r); + const i = X5(t, r); return i instanceof Cv ? t : i; })(); - return new VO(n, { + return new GO(n, { docsPath: e, ...r }); } -function e4(t, { format: e }) { +function Z5(t, { format: e }) { if (!e) return {}; const r = {}; @@ -3184,7 +3184,7 @@ function e4(t, { format: e }) { const i = e(t || {}); return n(i), r; } -const YO = { +const JO = { legacy: "0x0", eip2930: "0x1", eip1559: "0x2", @@ -3193,9 +3193,9 @@ const YO = { }; function Tv(t) { const e = {}; - return typeof t.authorizationList < "u" && (e.authorizationList = JO(t.authorizationList)), typeof t.accessList < "u" && (e.accessList = t.accessList), typeof t.blobVersionedHashes < "u" && (e.blobVersionedHashes = t.blobVersionedHashes), typeof t.blobs < "u" && (typeof t.blobs[0] != "string" ? e.blobs = t.blobs.map((r) => wi(r)) : e.blobs = t.blobs), typeof t.data < "u" && (e.data = t.data), typeof t.from < "u" && (e.from = t.from), typeof t.gas < "u" && (e.gas = Mr(t.gas)), typeof t.gasPrice < "u" && (e.gasPrice = Mr(t.gasPrice)), typeof t.maxFeePerBlobGas < "u" && (e.maxFeePerBlobGas = Mr(t.maxFeePerBlobGas)), typeof t.maxFeePerGas < "u" && (e.maxFeePerGas = Mr(t.maxFeePerGas)), typeof t.maxPriorityFeePerGas < "u" && (e.maxPriorityFeePerGas = Mr(t.maxPriorityFeePerGas)), typeof t.nonce < "u" && (e.nonce = Mr(t.nonce)), typeof t.to < "u" && (e.to = t.to), typeof t.type < "u" && (e.type = YO[t.type]), typeof t.value < "u" && (e.value = Mr(t.value)), e; + return typeof t.authorizationList < "u" && (e.authorizationList = XO(t.authorizationList)), typeof t.accessList < "u" && (e.accessList = t.accessList), typeof t.blobVersionedHashes < "u" && (e.blobVersionedHashes = t.blobVersionedHashes), typeof t.blobs < "u" && (typeof t.blobs[0] != "string" ? e.blobs = t.blobs.map((r) => xi(r)) : e.blobs = t.blobs), typeof t.data < "u" && (e.data = t.data), typeof t.from < "u" && (e.from = t.from), typeof t.gas < "u" && (e.gas = Mr(t.gas)), typeof t.gasPrice < "u" && (e.gasPrice = Mr(t.gasPrice)), typeof t.maxFeePerBlobGas < "u" && (e.maxFeePerBlobGas = Mr(t.maxFeePerBlobGas)), typeof t.maxFeePerGas < "u" && (e.maxFeePerGas = Mr(t.maxFeePerGas)), typeof t.maxPriorityFeePerGas < "u" && (e.maxPriorityFeePerGas = Mr(t.maxPriorityFeePerGas)), typeof t.nonce < "u" && (e.nonce = Mr(t.nonce)), typeof t.to < "u" && (e.to = t.to), typeof t.type < "u" && (e.type = JO[t.type]), typeof t.value < "u" && (e.value = Mr(t.value)), e; } -function JO(t) { +function XO(t) { return t.map((e) => ({ address: e.contractAddress, r: e.r, @@ -3206,17 +3206,17 @@ function JO(t) { ...typeof e.v < "u" && typeof e.yParity > "u" ? { v: Mr(e.v) } : {} })); } -function R2(t) { +function C2(t) { if (!(!t || t.length === 0)) return t.reduce((e, { slot: r, value: n }) => { if (r.length !== 66) - throw new w2({ + throw new b2({ size: r.length, targetSize: 66, type: "hex" }); if (n.length !== 66) - throw new w2({ + throw new b2({ size: n.length, targetSize: 66, type: "hex" @@ -3224,43 +3224,43 @@ function R2(t) { return e[r] = n, e; }, {}); } -function XO(t) { +function ZO(t) { const { balance: e, nonce: r, state: n, stateDiff: i, code: s } = t, o = {}; - if (s !== void 0 && (o.code = s), e !== void 0 && (o.balance = Mr(e)), r !== void 0 && (o.nonce = Mr(r)), n !== void 0 && (o.state = R2(n)), i !== void 0) { + if (s !== void 0 && (o.code = s), e !== void 0 && (o.balance = Mr(e)), r !== void 0 && (o.nonce = Mr(r)), n !== void 0 && (o.state = C2(n)), i !== void 0) { if (o.state) - throw new PO(); - o.stateDiff = R2(i); + throw new MO(); + o.stateDiff = C2(i); } return o; } -function ZO(t) { +function QO(t) { if (!t) return; const e = {}; for (const { address: r, ...n } of t) { - if (!$o(r, { strict: !1 })) + if (!ko(r, { strict: !1 })) throw new yu({ address: r }); if (e[r]) - throw new AO({ address: r }); - e[r] = XO(n); + throw new PO({ address: r }); + e[r] = ZO(n); } return e; } -const QO = 2n ** 256n - 1n; +const eN = 2n ** 256n - 1n; function O0(t) { - const { account: e, gasPrice: r, maxFeePerGas: n, maxPriorityFeePerGas: i, to: s } = t, o = e ? Wo(e) : void 0; - if (o && !$o(o.address)) + const { account: e, gasPrice: r, maxFeePerGas: n, maxPriorityFeePerGas: i, to: s } = t, o = e ? qo(e) : void 0; + if (o && !ko(o.address)) throw new yu({ address: o.address }); - if (s && !$o(s)) + if (s && !ko(s)) throw new yu({ address: s }); if (typeof r < "u" && (typeof n < "u" || typeof i < "u")) - throw new MO(); - if (n && n > QO) + throw new IO(); + if (n && n > eN) throw new Vd({ maxFeePerGas: n }); if (i && n && i > n) throw new Gd({ maxFeePerGas: n, maxPriorityFeePerGas: i }); } -class eN extends yt { +class tN extends yt { constructor() { super("`baseFeeMultiplier` must be greater than 1.", { name: "BaseFeeScalarError" @@ -3274,25 +3274,25 @@ class Rv extends yt { }); } } -class tN extends yt { +class rN extends yt { constructor({ maxPriorityFeePerGas: e }) { super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Es(e)} gwei).`, { name: "MaxFeePerGasTooLowError" }); } } -class rN extends yt { +class nN extends yt { constructor({ blockHash: e, blockNumber: r }) { let n = "Block"; e && (n = `Block at hash "${e}"`), r && (n = `Block at number "${r}"`), super(`${n} could not be found.`, { name: "BlockNotFoundError" }); } } -const nN = { +const iN = { "0x0": "legacy", "0x1": "eip2930", "0x2": "eip1559", "0x3": "eip4844", "0x4": "eip7702" }; -function iN(t) { +function sN(t) { const e = { ...t, blockHash: t.blockHash ? t.blockHash : null, @@ -3306,12 +3306,12 @@ function iN(t) { nonce: t.nonce ? bu(t.nonce) : void 0, to: t.to ? t.to : null, transactionIndex: t.transactionIndex ? Number(t.transactionIndex) : null, - type: t.type ? nN[t.type] : void 0, + type: t.type ? iN[t.type] : void 0, typeHex: t.type ? t.type : void 0, value: t.value ? BigInt(t.value) : void 0, v: t.v ? BigInt(t.v) : void 0 }; - return t.authorizationList && (e.authorizationList = sN(t.authorizationList)), e.yParity = (() => { + return t.authorizationList && (e.authorizationList = oN(t.authorizationList)), e.yParity = (() => { if (t.yParity) return Number(t.yParity); if (typeof e.v == "bigint") { @@ -3324,7 +3324,7 @@ function iN(t) { } })(), e.type === "legacy" && (delete e.accessList, delete e.maxFeePerBlobGas, delete e.maxFeePerGas, delete e.maxPriorityFeePerGas, delete e.yParity), e.type === "eip2930" && (delete e.maxFeePerBlobGas, delete e.maxFeePerGas, delete e.maxPriorityFeePerGas), e.type === "eip1559" && delete e.maxFeePerBlobGas, e; } -function sN(t) { +function oN(t) { return t.map((e) => ({ contractAddress: e.address, chainId: Number(e.chainId), @@ -3334,8 +3334,8 @@ function sN(t) { yParity: Number(e.yParity) })); } -function oN(t) { - const e = (t.transactions ?? []).map((r) => typeof r == "string" ? r : iN(r)); +function aN(t) { + const e = (t.transactions ?? []).map((r) => typeof r == "string" ? r : sN(r)); return { ...t, baseFeePerGas: t.baseFeePerGas ? BigInt(t.baseFeePerGas) : null, @@ -3365,16 +3365,16 @@ async function Yd(t, { blockHash: e, blockNumber: r, blockTag: n, includeTransac method: "eth_getBlockByNumber", params: [a || s, o] }, { dedupe: !!a }), !u) - throw new rN({ blockHash: e, blockNumber: r }); - return (((w = (p = (d = t.chain) == null ? void 0 : d.formatters) == null ? void 0 : p.block) == null ? void 0 : w.format) || oN)(u); + throw new nN({ blockHash: e, blockNumber: r }); + return (((w = (p = (d = t.chain) == null ? void 0 : d.formatters) == null ? void 0 : p.block) == null ? void 0 : w.format) || aN)(u); } -async function t4(t) { +async function Q5(t) { const e = await t.request({ method: "eth_gasPrice" }); return BigInt(e); } -async function aN(t, e) { +async function cN(t, e) { var s, o; const { block: r, chain: n = t.chain, request: i } = e || {}; try { @@ -3398,7 +3398,7 @@ async function aN(t, e) { } catch { const [a, u] = await Promise.all([ r ? Promise.resolve(r) : bi(t, Yd, "getBlock")({}), - bi(t, t4, "getGasPrice")({}) + bi(t, Q5, "getGasPrice")({}) ]); if (typeof a.baseFeePerGas != "bigint") throw new Rv(); @@ -3406,76 +3406,76 @@ async function aN(t, e) { return l < 0n ? 0n : l; } } -async function D2(t, e) { +async function T2(t, e) { var w, A; const { block: r, chain: n = t.chain, request: i, type: s = "eip1559" } = e || {}, o = await (async () => { - var P, N; - return typeof ((P = n == null ? void 0 : n.fees) == null ? void 0 : P.baseFeeMultiplier) == "function" ? n.fees.baseFeeMultiplier({ + var M, N; + return typeof ((M = n == null ? void 0 : n.fees) == null ? void 0 : M.baseFeeMultiplier) == "function" ? n.fees.baseFeeMultiplier({ block: r, client: t, request: i }) : ((N = n == null ? void 0 : n.fees) == null ? void 0 : N.baseFeeMultiplier) ?? 1.2; })(); if (o < 1) - throw new eN(); - const u = 10 ** (((w = o.toString().split(".")[1]) == null ? void 0 : w.length) ?? 0), l = (P) => P * BigInt(Math.ceil(o * u)) / BigInt(u), d = r || await bi(t, Yd, "getBlock")({}); + throw new tN(); + const u = 10 ** (((w = o.toString().split(".")[1]) == null ? void 0 : w.length) ?? 0), l = (M) => M * BigInt(Math.ceil(o * u)) / BigInt(u), d = r || await bi(t, Yd, "getBlock")({}); if (typeof ((A = n == null ? void 0 : n.fees) == null ? void 0 : A.estimateFeesPerGas) == "function") { - const P = await n.fees.estimateFeesPerGas({ + const M = await n.fees.estimateFeesPerGas({ block: r, client: t, multiply: l, request: i, type: s }); - if (P !== null) - return P; + if (M !== null) + return M; } if (s === "eip1559") { if (typeof d.baseFeePerGas != "bigint") throw new Rv(); - const P = typeof (i == null ? void 0 : i.maxPriorityFeePerGas) == "bigint" ? i.maxPriorityFeePerGas : await aN(t, { + const M = typeof (i == null ? void 0 : i.maxPriorityFeePerGas) == "bigint" ? i.maxPriorityFeePerGas : await cN(t, { block: d, chain: n, request: i }), N = l(d.baseFeePerGas); return { - maxFeePerGas: (i == null ? void 0 : i.maxFeePerGas) ?? N + P, - maxPriorityFeePerGas: P + maxFeePerGas: (i == null ? void 0 : i.maxFeePerGas) ?? N + M, + maxPriorityFeePerGas: M }; } return { - gasPrice: (i == null ? void 0 : i.gasPrice) ?? l(await bi(t, t4, "getGasPrice")({})) + gasPrice: (i == null ? void 0 : i.gasPrice) ?? l(await bi(t, Q5, "getGasPrice")({})) }; } -async function cN(t, { address: e, blockTag: r = "latest", blockNumber: n }) { +async function uN(t, { address: e, blockTag: r = "latest", blockNumber: n }) { const i = await t.request({ method: "eth_getTransactionCount", params: [e, n ? Mr(n) : r] }, { dedupe: !!n }); return bu(i); } -function r4(t) { - const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((s) => ko(s)) : t.blobs, i = []; +function e4(t) { + const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((s) => Lo(s)) : t.blobs, i = []; for (const s of n) i.push(Uint8Array.from(e.blobToKzgCommitment(s))); - return r === "bytes" ? i : i.map((s) => wi(s)); + return r === "bytes" ? i : i.map((s) => xi(s)); } -function n4(t) { - const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((o) => ko(o)) : t.blobs, i = typeof t.commitments[0] == "string" ? t.commitments.map((o) => ko(o)) : t.commitments, s = []; +function t4(t) { + const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((o) => Lo(o)) : t.blobs, i = typeof t.commitments[0] == "string" ? t.commitments.map((o) => Lo(o)) : t.commitments, s = []; for (let o = 0; o < n.length; o++) { const a = n[o], u = i[o]; s.push(Uint8Array.from(e.computeBlobKzgProof(a, u))); } - return r === "bytes" ? s : s.map((o) => wi(o)); + return r === "bytes" ? s : s.map((o) => xi(o)); } -function uN(t, e, r, n) { +function fN(t, e, r, n) { if (typeof t.setBigUint64 == "function") return t.setBigUint64(e, r, n); const i = BigInt(32), s = BigInt(4294967295), o = Number(r >> i & s), a = Number(r & s), u = n ? 4 : 0, l = n ? 0 : 4; t.setUint32(e + u, o, n), t.setUint32(e + l, a, n); } -const fN = (t, e, r) => t & e ^ ~t & r, lN = (t, e, r) => t & e ^ t & r ^ e & r; -class hN extends T5 { +const lN = (t, e, r) => t & e ^ ~t & r, hN = (t, e, r) => t & e ^ t & r ^ e & r; +class dN extends I5 { constructor(e, r, n, i) { super(), this.blockLen = e, this.outputLen = r, this.padOffset = n, this.isLE = i, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(e), this.view = Bg(this.buffer); } @@ -3497,13 +3497,13 @@ class hN extends T5 { return this.length += e.length, this.roundClean(), this; } digestInto(e) { - Hd(this), C5(e, this), this.finished = !0; + Hd(this), M5(e, this), this.finished = !0; const { buffer: r, view: n, blockLen: i, isLE: s } = this; let { pos: o } = this; r[o++] = 128, this.buffer.subarray(o).fill(0), this.padOffset > i - o && (this.process(n, 0), o = 0); for (let p = o; p < i; p++) r[p] = 0; - uN(n, i - 8, BigInt(this.length * 8), s), this.process(n, 0); + fN(n, i - 8, BigInt(this.length * 8), s), this.process(n, 0); const a = Bg(e), u = this.outputLen; if (u % 4) throw new Error("_sha2: outputLen should be aligned to 32bit"); @@ -3525,7 +3525,7 @@ class hN extends T5 { return e.length = i, e.pos = a, e.finished = s, e.destroyed = o, i % r && e.buffer.set(n), e; } } -const dN = /* @__PURE__ */ new Uint32Array([ +const pN = /* @__PURE__ */ new Uint32Array([ 1116352408, 1899447441, 3049323471, @@ -3590,7 +3590,7 @@ const dN = /* @__PURE__ */ new Uint32Array([ 2756734187, 3204031479, 3329325298 -]), ta = /* @__PURE__ */ new Uint32Array([ +]), Qo = /* @__PURE__ */ new Uint32Array([ 1779033703, 3144134277, 1013904242, @@ -3599,10 +3599,10 @@ const dN = /* @__PURE__ */ new Uint32Array([ 2600822924, 528734635, 1541459225 -]), ra = /* @__PURE__ */ new Uint32Array(64); -let pN = class extends hN { +]), ea = /* @__PURE__ */ new Uint32Array(64); +let gN = class extends dN { constructor() { - super(64, 32, 8, !1), this.A = ta[0] | 0, this.B = ta[1] | 0, this.C = ta[2] | 0, this.D = ta[3] | 0, this.E = ta[4] | 0, this.F = ta[5] | 0, this.G = ta[6] | 0, this.H = ta[7] | 0; + super(64, 32, 8, !1), this.A = Qo[0] | 0, this.B = Qo[1] | 0, this.C = Qo[2] | 0, this.D = Qo[3] | 0, this.E = Qo[4] | 0, this.F = Qo[5] | 0, this.G = Qo[6] | 0, this.H = Qo[7] | 0; } get() { const { A: e, B: r, C: n, D: i, E: s, F: o, G: a, H: u } = this; @@ -3614,47 +3614,47 @@ let pN = class extends hN { } process(e, r) { for (let p = 0; p < 16; p++, r += 4) - ra[p] = e.getUint32(r, !1); + ea[p] = e.getUint32(r, !1); for (let p = 16; p < 64; p++) { - const w = ra[p - 15], A = ra[p - 2], P = Ns(w, 7) ^ Ns(w, 18) ^ w >>> 3, N = Ns(A, 17) ^ Ns(A, 19) ^ A >>> 10; - ra[p] = N + ra[p - 7] + P + ra[p - 16] | 0; + const w = ea[p - 15], A = ea[p - 2], M = Ns(w, 7) ^ Ns(w, 18) ^ w >>> 3, N = Ns(A, 17) ^ Ns(A, 19) ^ A >>> 10; + ea[p] = N + ea[p - 7] + M + ea[p - 16] | 0; } let { A: n, B: i, C: s, D: o, E: a, F: u, G: l, H: d } = this; for (let p = 0; p < 64; p++) { - const w = Ns(a, 6) ^ Ns(a, 11) ^ Ns(a, 25), A = d + w + fN(a, u, l) + dN[p] + ra[p] | 0, N = (Ns(n, 2) ^ Ns(n, 13) ^ Ns(n, 22)) + lN(n, i, s) | 0; + const w = Ns(a, 6) ^ Ns(a, 11) ^ Ns(a, 25), A = d + w + lN(a, u, l) + pN[p] + ea[p] | 0, N = (Ns(n, 2) ^ Ns(n, 13) ^ Ns(n, 22)) + hN(n, i, s) | 0; d = l, l = u, u = a, a = o + A | 0, o = s, s = i, i = n, n = A + N | 0; } n = n + this.A | 0, i = i + this.B | 0, s = s + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, u = u + this.F | 0, l = l + this.G | 0, d = d + this.H | 0, this.set(n, i, s, o, a, u, l, d); } roundClean() { - ra.fill(0); + ea.fill(0); } destroy() { this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0); } }; -const i4 = /* @__PURE__ */ R5(() => new pN()); -function gN(t, e) { - return i4(ya(t, { strict: !1 }) ? _v(t) : t); -} -function mN(t) { - const { commitment: e, version: r = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), i = gN(e); - return i.set([r], 0), n === "bytes" ? i : wi(i); +const r4 = /* @__PURE__ */ C5(() => new gN()); +function mN(t, e) { + return r4(va(t, { strict: !1 }) ? _v(t) : t); } function vN(t) { + const { commitment: e, version: r = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), i = mN(e); + return i.set([r], 0), n === "bytes" ? i : xi(i); +} +function bN(t) { const { commitments: e, version: r } = t, n = t.to ?? (typeof e[0] == "string" ? "hex" : "bytes"), i = []; for (const s of e) - i.push(mN({ + i.push(vN({ commitment: s, to: n, version: r })); return i; } -const O2 = 6, s4 = 32, Dv = 4096, o4 = s4 * Dv, N2 = o4 * O2 - // terminator byte (0x80). +const R2 = 6, n4 = 32, Dv = 4096, i4 = n4 * Dv, D2 = i4 * R2 - // terminator byte (0x80). 1 - // zero byte (0x00) appended to each field element. -1 * Dv * O2; -class bN extends yt { +1 * Dv * R2; +class yN extends yt { constructor({ maxSize: e, size: r }) { super("Blob size is too large.", { metaMessages: [`Max: ${e} bytes`, `Given: ${r} bytes`], @@ -3662,27 +3662,27 @@ class bN extends yt { }); } } -class yN extends yt { +class wN extends yt { constructor() { super("Blob data must not be empty.", { name: "EmptyBlobError" }); } } -function wN(t) { - const e = t.to ?? (typeof t.data == "string" ? "hex" : "bytes"), r = typeof t.data == "string" ? ko(t.data) : t.data, n = An(r); +function xN(t) { + const e = t.to ?? (typeof t.data == "string" ? "hex" : "bytes"), r = typeof t.data == "string" ? Lo(t.data) : t.data, n = An(r); if (!n) - throw new yN(); - if (n > N2) - throw new bN({ - maxSize: N2, + throw new wN(); + if (n > D2) + throw new yN({ + maxSize: D2, size: n }); const i = []; let s = !0, o = 0; for (; s; ) { - const a = Iv(new Uint8Array(o4)); + const a = Iv(new Uint8Array(i4)); let u = 0; for (; u < Dv; ) { - const l = r.slice(o, o + (s4 - 1)); + const l = r.slice(o, o + (n4 - 1)); if (a.pushByte(0), a.pushBytes(l), l.length < 31) { a.pushByte(128), s = !1; break; @@ -3691,10 +3691,10 @@ function wN(t) { } i.push(a); } - return e === "bytes" ? i.map((a) => a.bytes) : i.map((a) => wi(a.bytes)); + return e === "bytes" ? i.map((a) => a.bytes) : i.map((a) => xi(a.bytes)); } -function xN(t) { - const { data: e, kzg: r, to: n } = t, i = t.blobs ?? wN({ data: e, to: n }), s = t.commitments ?? r4({ blobs: i, kzg: r, to: n }), o = t.proofs ?? n4({ blobs: i, commitments: s, kzg: r, to: n }), a = []; +function _N(t) { + const { data: e, kzg: r, to: n } = t, i = t.blobs ?? xN({ data: e, to: n }), s = t.commitments ?? e4({ blobs: i, kzg: r, to: n }), o = t.proofs ?? t4({ blobs: i, commitments: s, kzg: r, to: n }), a = []; for (let u = 0; u < i.length; u++) a.push({ blob: i[u], @@ -3703,7 +3703,7 @@ function xN(t) { }); return a; } -function _N(t) { +function EN(t) { if (t.type) return t.type; if (typeof t.authorizationList < "u") @@ -3714,7 +3714,7 @@ function _N(t) { return "eip1559"; if (typeof t.gasPrice < "u") return typeof t.accessList < "u" ? "eip2930" : "legacy"; - throw new IO({ transaction: t }); + throw new CO({ transaction: t }); } async function N0(t) { const e = await t.request({ @@ -3722,7 +3722,7 @@ async function N0(t) { }, { dedupe: !0 }); return bu(e); } -const a4 = [ +const s4 = [ "blobVersionedHashes", "chainId", "fees", @@ -3731,9 +3731,9 @@ const a4 = [ "type" ]; async function Ov(t, e) { - const { account: r = t.account, blobs: n, chain: i, gas: s, kzg: o, nonce: a, nonceManager: u, parameters: l = a4, type: d } = e, p = r && Wo(r), w = { ...e, ...p ? { from: p == null ? void 0 : p.address } : {} }; + const { account: r = t.account, blobs: n, chain: i, gas: s, kzg: o, nonce: a, nonceManager: u, parameters: l = s4, type: d } = e, p = r && qo(r), w = { ...e, ...p ? { from: p == null ? void 0 : p.address } : {} }; let A; - async function P() { + async function M() { return A || (A = await bi(t, Yd, "getBlock")({ blockTag: "latest" }), A); } let N; @@ -3741,19 +3741,19 @@ async function Ov(t, e) { return N || (i ? i.id : typeof e.chainId < "u" ? e.chainId : (N = await bi(t, N0, "getChainId")({}), N)); } if ((l.includes("blobVersionedHashes") || l.includes("sidecars")) && n && o) { - const $ = r4({ blobs: n, kzg: o }); + const B = e4({ blobs: n, kzg: o }); if (l.includes("blobVersionedHashes")) { - const B = vN({ - commitments: $, + const $ = bN({ + commitments: B, to: "hex" }); - w.blobVersionedHashes = B; + w.blobVersionedHashes = $; } if (l.includes("sidecars")) { - const B = n4({ blobs: n, commitments: $, kzg: o }), H = xN({ + const $ = t4({ blobs: n, commitments: B, kzg: o }), H = _N({ blobs: n, - commitments: $, - proofs: B, + commitments: B, + proofs: $, to: "hex" }); w.sidecars = H; @@ -3761,64 +3761,64 @@ async function Ov(t, e) { } if (l.includes("chainId") && (w.chainId = await L()), l.includes("nonce") && typeof a > "u" && p) if (u) { - const $ = await L(); + const B = await L(); w.nonce = await u.consume({ address: p.address, - chainId: $, + chainId: B, client: t }); } else - w.nonce = await bi(t, cN, "getTransactionCount")({ + w.nonce = await bi(t, uN, "getTransactionCount")({ address: p.address, blockTag: "pending" }); if ((l.includes("fees") || l.includes("type")) && typeof d > "u") try { - w.type = _N(w); + w.type = EN(w); } catch { - const $ = await P(); - w.type = typeof ($ == null ? void 0 : $.baseFeePerGas) == "bigint" ? "eip1559" : "legacy"; + const B = await M(); + w.type = typeof (B == null ? void 0 : B.baseFeePerGas) == "bigint" ? "eip1559" : "legacy"; } if (l.includes("fees")) if (w.type !== "legacy" && w.type !== "eip2930") { if (typeof w.maxFeePerGas > "u" || typeof w.maxPriorityFeePerGas > "u") { - const $ = await P(), { maxFeePerGas: B, maxPriorityFeePerGas: H } = await D2(t, { - block: $, + const B = await M(), { maxFeePerGas: $, maxPriorityFeePerGas: H } = await T2(t, { + block: B, chain: i, request: w }); if (typeof e.maxPriorityFeePerGas > "u" && e.maxFeePerGas && e.maxFeePerGas < H) - throw new tN({ + throw new rN({ maxPriorityFeePerGas: H }); - w.maxPriorityFeePerGas = H, w.maxFeePerGas = B; + w.maxPriorityFeePerGas = H, w.maxFeePerGas = $; } } else { if (typeof e.maxFeePerGas < "u" || typeof e.maxPriorityFeePerGas < "u") throw new Rv(); - const $ = await P(), { gasPrice: B } = await D2(t, { - block: $, + const B = await M(), { gasPrice: $ } = await T2(t, { + block: B, chain: i, request: w, type: "legacy" }); - w.gasPrice = B; + w.gasPrice = $; } - return l.includes("gas") && typeof s > "u" && (w.gas = await bi(t, SN, "estimateGas")({ + return l.includes("gas") && typeof s > "u" && (w.gas = await bi(t, AN, "estimateGas")({ ...w, account: p && { address: p.address, type: "json-rpc" } })), O0(w), delete w.parameters, w; } -async function EN(t, { address: e, blockNumber: r, blockTag: n = "latest" }) { +async function SN(t, { address: e, blockNumber: r, blockTag: n = "latest" }) { const i = r ? Mr(r) : void 0, s = await t.request({ method: "eth_getBalance", params: [e, i || n] }); return BigInt(s); } -async function SN(t, e) { +async function AN(t, e) { var i, s, o; - const { account: r = t.account } = e, n = r ? Wo(r) : void 0; + const { account: r = t.account } = e, n = r ? qo(r) : void 0; try { let f = function(b) { const { block: x, request: _, rpcStateOverride: E } = b; @@ -3827,18 +3827,18 @@ async function SN(t, e) { params: E ? [_, x ?? "latest", E] : x ? [_, x] : [_] }); }; - const { accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, blockNumber: p, blockTag: w, data: A, gas: P, gasPrice: N, maxFeePerBlobGas: L, maxFeePerGas: $, maxPriorityFeePerGas: B, nonce: H, value: W, stateOverride: V, ...te } = await Ov(t, { + const { accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, blockNumber: p, blockTag: w, data: A, gas: M, gasPrice: N, maxFeePerBlobGas: L, maxFeePerGas: B, maxPriorityFeePerGas: $, nonce: H, value: W, stateOverride: V, ...te } = await Ov(t, { ...e, parameters: ( // Some RPC Providers do not compute versioned hashes from blobs. We will need // to compute them. (n == null ? void 0 : n.type) === "local" ? void 0 : ["blobVersionedHashes"] ) - }), K = (p ? Mr(p) : void 0) || w, ge = ZO(V), Ee = await (async () => { + }), K = (p ? Mr(p) : void 0) || w, ge = QO(V), Ee = await (async () => { if (te.to) return te.to; if (u && u.length > 0) - return await Z5({ + return await J5({ authorization: u[0] }).catch(() => { throw new yt("`to` is required. Could not infer from `authorizationList`"); @@ -3847,25 +3847,25 @@ async function SN(t, e) { O0(e); const Y = (o = (s = (i = t.chain) == null ? void 0 : i.formatters) == null ? void 0 : s.transactionRequest) == null ? void 0 : o.format, m = (Y || Tv)({ // Pick out extra data that might exist on the chain's transaction request type. - ...e4(te, { format: Y }), + ...Z5(te, { format: Y }), from: n == null ? void 0 : n.address, accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, data: A, - gas: P, + gas: M, gasPrice: N, maxFeePerBlobGas: L, - maxFeePerGas: $, - maxPriorityFeePerGas: B, + maxFeePerGas: B, + maxPriorityFeePerGas: $, nonce: H, to: Ee, value: W }); let g = BigInt(await f({ block: K, request: m, rpcStateOverride: ge })); if (u) { - const b = await EN(t, { address: m.from }), x = await Promise.all(u.map(async (_) => { + const b = await SN(t, { address: m.from }), x = await Promise.all(u.map(async (_) => { const { contractAddress: E } = _, v = await f({ block: K, request: { @@ -3883,14 +3883,14 @@ async function SN(t, e) { } return g; } catch (a) { - throw GO(a, { + throw YO(a, { ...e, account: n, chain: t.chain }); } } -class AN extends yt { +class PN extends yt { constructor({ chain: e, currentChainId: r }) { super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`, { metaMessages: [ @@ -3901,7 +3901,7 @@ class AN extends yt { }); } } -class PN extends yt { +class MN extends yt { constructor() { super([ "No chain was provided to the request.", @@ -3913,21 +3913,21 @@ class PN extends yt { } } const Ug = "/docs/contract/encodeDeployData"; -function MN(t) { +function IN(t) { const { abi: e, args: r, bytecode: n } = t; if (!r || r.length === 0) return n; const i = e.find((o) => "type" in o && o.type === "constructor"); if (!i) - throw new HR({ docsPath: Ug }); + throw new KR({ docsPath: Ug }); if (!("inputs" in i)) - throw new b2({ docsPath: Ug }); + throw new m2({ docsPath: Ug }); if (!i.inputs || i.inputs.length === 0) - throw new b2({ docsPath: Ug }); - const s = q5(i.inputs, r); + throw new m2({ docsPath: Ug }); + const s = j5(i.inputs, r); return R0([n, s]); } -async function IN(t) { +async function CN(t) { return new Promise((e) => setTimeout(e, t)); } class Fl extends yt { @@ -3952,23 +3952,23 @@ class qg extends yt { }); } } -function c4({ chain: t, currentChainId: e }) { +function o4({ chain: t, currentChainId: e }) { if (!t) - throw new PN(); + throw new MN(); if (e !== t.id) - throw new AN({ chain: t, currentChainId: e }); + throw new PN({ chain: t, currentChainId: e }); } -function CN(t, { docsPath: e, ...r }) { +function TN(t, { docsPath: e, ...r }) { const n = (() => { - const i = Q5(t, r); + const i = X5(t, r); return i instanceof Cv ? t : i; })(); - return new CO(n, { + return new TO(n, { docsPath: e, ...r }); } -async function u4(t, { serializedTransaction: e }) { +async function a4(t, { serializedTransaction: e }) { return t.request({ method: "eth_sendRawTransaction", params: [e] @@ -3976,20 +3976,20 @@ async function u4(t, { serializedTransaction: e }) { } const zg = new T0(128); async function Nv(t, e) { - var $, B, H, W; - const { account: r = t.account, chain: n = t.chain, accessList: i, authorizationList: s, blobs: o, data: a, gas: u, gasPrice: l, maxFeePerBlobGas: d, maxFeePerGas: p, maxPriorityFeePerGas: w, nonce: A, value: P, ...N } = e; + var B, $, H, W; + const { account: r = t.account, chain: n = t.chain, accessList: i, authorizationList: s, blobs: o, data: a, gas: u, gasPrice: l, maxFeePerBlobGas: d, maxFeePerGas: p, maxPriorityFeePerGas: w, nonce: A, value: M, ...N } = e; if (typeof r > "u") throw new Fl({ docsPath: "/docs/actions/wallet/sendTransaction" }); - const L = r ? Wo(r) : null; + const L = r ? qo(r) : null; try { O0(e); const V = await (async () => { if (e.to) return e.to; if (s && s.length > 0) - return await Z5({ + return await J5({ authorization: s[0] }).catch(() => { throw new yt("`to` is required. Could not infer from `authorizationList`."); @@ -3997,13 +3997,13 @@ async function Nv(t, e) { })(); if ((L == null ? void 0 : L.type) === "json-rpc" || L === null) { let te; - n !== null && (te = await bi(t, N0, "getChainId")({}), c4({ + n !== null && (te = await bi(t, N0, "getChainId")({}), o4({ currentChainId: te, chain: n })); - const R = (H = (B = ($ = t.chain) == null ? void 0 : $.formatters) == null ? void 0 : B.transactionRequest) == null ? void 0 : H.format, ge = (R || Tv)({ + const R = (H = ($ = (B = t.chain) == null ? void 0 : B.formatters) == null ? void 0 : $.transactionRequest) == null ? void 0 : H.format, ge = (R || Tv)({ // Pick out extra data that might exist on the chain's transaction request type. - ...e4(N, { format: R }), + ...Z5(N, { format: R }), accessList: i, authorizationList: s, blobs: o, @@ -4017,7 +4017,7 @@ async function Nv(t, e) { maxPriorityFeePerGas: w, nonce: A, to: V, - value: P + value: M }), Ee = zg.get(t.uid), Y = Ee ? "wallet_sendTransaction" : "eth_sendTransaction"; try { return await t.request({ @@ -4054,14 +4054,14 @@ async function Nv(t, e) { maxPriorityFeePerGas: w, nonce: A, nonceManager: L.nonceManager, - parameters: [...a4, "sidecars"], - value: P, + parameters: [...s4, "sidecars"], + value: M, ...N, to: V }), R = (W = n == null ? void 0 : n.serializers) == null ? void 0 : W.transaction, K = await L.signTransaction(te, { serializer: R }); - return await bi(t, u4, "sendRawTransaction")({ + return await bi(t, a4, "sendRawTransaction")({ serializedTransaction: K }); } @@ -4076,20 +4076,20 @@ async function Nv(t, e) { type: L == null ? void 0 : L.type }); } catch (V) { - throw V instanceof qg ? V : CN(V, { + throw V instanceof qg ? V : TN(V, { ...e, account: L, chain: e.chain || void 0 }); } } -async function TN(t, e) { +async function RN(t, e) { const { abi: r, account: n = t.account, address: i, args: s, dataSuffix: o, functionName: a, ...u } = e; if (typeof n > "u") throw new Fl({ docsPath: "/docs/contract/writeContract" }); - const l = n ? Wo(n) : null, d = iO({ + const l = n ? qo(n) : null, d = sO({ abi: r, args: s, functionName: a @@ -4102,7 +4102,7 @@ async function TN(t, e) { ...u }); } catch (p) { - throw FO(p, { + throw jO(p, { abi: r, address: i, args: s, @@ -4112,7 +4112,7 @@ async function TN(t, e) { }); } } -async function RN(t, { chain: e }) { +async function DN(t, { chain: e }) { const { id: r, name: n, nativeCurrency: i, rpcUrls: s, blockExplorers: o } = e; await t.request({ method: "wallet_addEthereumChain", @@ -4129,7 +4129,7 @@ async function RN(t, { chain: e }) { } const a1 = 256; let nd = a1, id; -function f4(t = 11) { +function c4(t = 11) { if (!id || nd + t > a1 * 2) { id = "", nd = 0; for (let e = 0; e < a1; e++) @@ -4137,11 +4137,11 @@ function f4(t = 11) { } return id.substring(nd, nd++ + t); } -function DN(t) { - const { batch: e, cacheTime: r = t.pollingInterval ?? 4e3, ccipRead: n, key: i = "base", name: s = "Base Client", pollingInterval: o = 4e3, type: a = "base" } = t, u = t.chain, l = t.account ? Wo(t.account) : void 0, { config: d, request: p, value: w } = t.transport({ +function ON(t) { + const { batch: e, cacheTime: r = t.pollingInterval ?? 4e3, ccipRead: n, key: i = "base", name: s = "Base Client", pollingInterval: o = 4e3, type: a = "base" } = t, u = t.chain, l = t.account ? qo(t.account) : void 0, { config: d, request: p, value: w } = t.transport({ chain: u, pollingInterval: o - }), A = { ...d, ...w }, P = { + }), A = { ...d, ...w }, M = { account: l, batch: e, cacheTime: r, @@ -4153,21 +4153,21 @@ function DN(t) { request: p, transport: A, type: a, - uid: f4() + uid: c4() }; function N(L) { - return ($) => { - const B = $(L); - for (const W in P) - delete B[W]; - const H = { ...L, ...B }; + return (B) => { + const $ = B(L); + for (const W in M) + delete $[W]; + const H = { ...L, ...$ }; return Object.assign(H, { extend: N(H) }); }; } - return Object.assign(P, { extend: N(P) }); + return Object.assign(M, { extend: N(M) }); } const sd = /* @__PURE__ */ new T0(8192); -function ON(t, { enabled: e = !0, id: r }) { +function NN(t, { enabled: e = !0, id: r }) { if (!e || !r) return t(); if (sd.get(r)) @@ -4175,12 +4175,12 @@ function ON(t, { enabled: e = !0, id: r }) { const n = t().finally(() => sd.delete(r)); return sd.set(r, n), n; } -function NN(t, { delay: e = 100, retryCount: r = 2, shouldRetry: n = () => !0 } = {}) { +function LN(t, { delay: e = 100, retryCount: r = 2, shouldRetry: n = () => !0 } = {}) { return new Promise((i, s) => { const o = async ({ count: a = 0 } = {}) => { const u = async ({ error: l }) => { const d = typeof e == "function" ? e({ count: a, error: l }) : e; - d && await IN(d), o({ count: a + 1 }); + d && await CN(d), o({ count: a + 1 }); }; try { const l = await t(); @@ -4194,13 +4194,13 @@ function NN(t, { delay: e = 100, retryCount: r = 2, shouldRetry: n = () => !0 } o(); }); } -function LN(t, e = {}) { +function kN(t, e = {}) { return async (r, n = {}) => { const { dedupe: i = !1, retryDelay: s = 150, retryCount: o = 3, uid: a } = { ...e, ...n }, u = i ? $l(I0(`${a}.${Ru(r)}`)) : void 0; - return ON(() => NN(async () => { + return NN(() => LN(async () => { try { return await t(r); } catch (l) { @@ -4214,8 +4214,8 @@ function LN(t, e = {}) { throw new il(d, { method: r.method }); case sl.code: throw new sl(d); - case fc.code: - throw new fc(d); + case uc.code: + throw new uc(d); case ol.code: throw new ol(d); case al.code: @@ -4247,13 +4247,13 @@ function LN(t, e = {}) { case 5e3: throw new cu(d); default: - throw l instanceof yt ? l : new $O(d); + throw l instanceof yt ? l : new BO(d); } } }, { delay: ({ count: l, error: d }) => { var p; - if (d && d instanceof Y5) { + if (d && d instanceof V5) { const w = (p = d == null ? void 0 : d.headers) == null ? void 0 : p.get("Retry-After"); if (w != null && w.match(/\d/)) return Number.parseInt(w) * 1e3; @@ -4261,15 +4261,15 @@ function LN(t, e = {}) { return ~~(1 << l) * s; }, retryCount: o, - shouldRetry: ({ error: l }) => kN(l) + shouldRetry: ({ error: l }) => $N(l) }), { enabled: i, id: u }); }; } -function kN(t) { - return "code" in t && typeof t.code == "number" ? t.code === -1 || t.code === xu.code || t.code === fc.code : t instanceof Y5 && t.status ? t.status === 403 || t.status === 408 || t.status === 413 || t.status === 429 || t.status === 500 || t.status === 502 || t.status === 503 || t.status === 504 : !0; +function $N(t) { + return "code" in t && typeof t.code == "number" ? t.code === -1 || t.code === xu.code || t.code === uc.code : t instanceof V5 && t.status ? t.status === 403 || t.status === 408 || t.status === 413 || t.status === 429 || t.status === 500 || t.status === 502 || t.status === 503 || t.status === 504 : !0; } -function $N({ key: t, name: e, request: r, retryCount: n = 3, retryDelay: i = 150, timeout: s, type: o }, a) { - const u = f4(); +function BN({ key: t, name: e, request: r, retryCount: n = 3, retryDelay: i = 150, timeout: s, type: o }, a) { + const u = c4(); return { config: { key: t, @@ -4280,13 +4280,13 @@ function $N({ key: t, name: e, request: r, retryCount: n = 3, retryDelay: i = 15 timeout: s, type: o }, - request: LN(r, { retryCount: n, retryDelay: i, uid: u }), + request: kN(r, { retryCount: n, retryDelay: i, uid: u }), value: a }; } -function BN(t, e = {}) { +function FN(t, e = {}) { const { key: r = "custom", name: n = "Custom Provider", retryDelay: i } = e; - return ({ retryCount: s }) => $N({ + return ({ retryCount: s }) => BN({ key: r, name: n, request: t.request.bind(t), @@ -4295,15 +4295,15 @@ function BN(t, e = {}) { type: "custom" }); } -const FN = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, jN = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/; -class UN extends yt { +const jN = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, UN = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/; +class qN extends yt { constructor({ domain: e }) { super(`Invalid domain "${Ru(e)}".`, { metaMessages: ["Must be a valid EIP-712 domain."] }); } } -class qN extends yt { +class zN extends yt { constructor({ primaryType: e, types: r }) { super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`, { docsPath: "/api/glossary/Errors#typeddatainvalidprimarytypeerror", @@ -4311,7 +4311,7 @@ class qN extends yt { }); } } -class zN extends yt { +class WN extends yt { constructor({ type: e }) { super(`Struct type "${e}" is invalid.`, { metaMessages: ["Struct type must not be a Solidity type."], @@ -4319,7 +4319,7 @@ class zN extends yt { }); } } -function WN(t) { +function HN(t) { const { domain: e, message: r, primaryType: n, types: i } = t, s = (u, l) => { const d = { ...l }; for (const p of u) { @@ -4333,44 +4333,44 @@ function WN(t) { })(); return Ru({ domain: o, message: a, primaryType: n, types: i }); } -function HN(t) { +function KN(t) { const { domain: e, message: r, primaryType: n, types: i } = t, s = (o, a) => { for (const u of o) { - const { name: l, type: d } = u, p = a[l], w = d.match(jN); + const { name: l, type: d } = u, p = a[l], w = d.match(UN); if (w && (typeof p == "number" || typeof p == "bigint")) { - const [N, L, $] = w; + const [N, L, B] = w; Mr(p, { signed: L === "int", - size: Number.parseInt($) / 8 + size: Number.parseInt(B) / 8 }); } - if (d === "address" && typeof p == "string" && !$o(p)) + if (d === "address" && typeof p == "string" && !ko(p)) throw new yu({ address: p }); - const A = d.match(FN); + const A = d.match(jN); if (A) { const [N, L] = A; if (L && An(p) !== Number.parseInt(L)) - throw new XR({ + throw new ZR({ expectedSize: Number.parseInt(L), givenSize: An(p) }); } - const P = i[d]; - P && (VN(d), s(P, p)); + const M = i[d]; + M && (GN(d), s(M, p)); } }; if (i.EIP712Domain && e) { if (typeof e != "object") - throw new UN({ domain: e }); + throw new qN({ domain: e }); s(i.EIP712Domain, e); } if (n !== "EIP712Domain") if (i[n]) s(i[n], r); else - throw new qN({ primaryType: n, types: i }); + throw new zN({ primaryType: n, types: i }); } -function KN({ domain: t }) { +function VN({ domain: t }) { return [ typeof (t == null ? void 0 : t.name) == "string" && { name: "name", type: "string" }, (t == null ? void 0 : t.version) && { name: "version", type: "string" }, @@ -4385,39 +4385,39 @@ function KN({ domain: t }) { (t == null ? void 0 : t.salt) && { name: "salt", type: "bytes32" } ].filter(Boolean); } -function VN(t) { +function GN(t) { if (t === "address" || t === "bool" || t === "string" || t.startsWith("bytes") || t.startsWith("uint") || t.startsWith("int")) - throw new zN({ type: t }); + throw new WN({ type: t }); } -function GN(t, e) { - const { abi: r, args: n, bytecode: i, ...s } = e, o = MN({ abi: r, args: n, bytecode: i }); +function YN(t, e) { + const { abi: r, args: n, bytecode: i, ...s } = e, o = IN({ abi: r, args: n, bytecode: i }); return Nv(t, { ...s, data: o }); } -async function YN(t) { +async function JN(t) { var r; return ((r = t.account) == null ? void 0 : r.type) === "local" ? [t.account.address] : (await t.request({ method: "eth_accounts" }, { dedupe: !0 })).map((n) => Bl(n)); } -async function JN(t) { +async function XN(t) { return await t.request({ method: "wallet_getPermissions" }, { dedupe: !0 }); } -async function XN(t) { +async function ZN(t) { return (await t.request({ method: "eth_requestAccounts" }, { dedupe: !0, retryCount: 0 })).map((r) => Ev(r)); } -async function ZN(t, e) { +async function QN(t, e) { return t.request({ method: "wallet_requestPermissions", params: [e] }, { retryCount: 0 }); } -async function QN(t, { account: e = t.account, message: r }) { +async function eL(t, { account: e = t.account, message: r }) { if (!e) throw new Fl({ docsPath: "/docs/actions/wallet/signMessage" }); - const n = Wo(e); + const n = qo(e); if (n.signMessage) return n.signMessage({ message: r }); const i = typeof r == "string" ? I0(r) : r.raw instanceof Uint8Array ? zd(r.raw) : r.raw; @@ -4426,20 +4426,20 @@ async function QN(t, { account: e = t.account, message: r }) { params: [i, n.address] }, { retryCount: 0 }); } -async function eL(t, e) { +async function tL(t, e) { var l, d, p, w; const { account: r = t.account, chain: n = t.chain, ...i } = e; if (!r) throw new Fl({ docsPath: "/docs/actions/wallet/signTransaction" }); - const s = Wo(r); + const s = qo(r); O0({ account: s, ...e }); const o = await bi(t, N0, "getChainId")({}); - n !== null && c4({ + n !== null && o4({ currentChainId: o, chain: n }); @@ -4458,25 +4458,25 @@ async function eL(t, e) { ] }, { retryCount: 0 }); } -async function tL(t, e) { +async function rL(t, e) { const { account: r = t.account, domain: n, message: i, primaryType: s } = e; if (!r) throw new Fl({ docsPath: "/docs/actions/wallet/signTypedData" }); - const o = Wo(r), a = { - EIP712Domain: KN({ domain: n }), + const o = qo(r), a = { + EIP712Domain: VN({ domain: n }), ...e.types }; - if (HN({ domain: n, message: i, primaryType: s, types: a }), o.signTypedData) + if (KN({ domain: n, message: i, primaryType: s, types: a }), o.signTypedData) return o.signTypedData({ domain: n, message: i, primaryType: s, types: a }); - const u = WN({ domain: n, message: i, primaryType: s, types: a }); + const u = HN({ domain: n, message: i, primaryType: s, types: a }); return t.request({ method: "eth_signTypedData_v4", params: [o.address, u] }, { retryCount: 0 }); } -async function rL(t, { id: e }) { +async function nL(t, { id: e }) { await t.request({ method: "wallet_switchEthereumChain", params: [ @@ -4486,41 +4486,41 @@ async function rL(t, { id: e }) { ] }, { retryCount: 0 }); } -async function nL(t, e) { +async function iL(t, e) { return await t.request({ method: "wallet_watchAsset", params: e }, { retryCount: 0 }); } -function iL(t) { +function sL(t) { return { - addChain: (e) => RN(t, e), - deployContract: (e) => GN(t, e), - getAddresses: () => YN(t), + addChain: (e) => DN(t, e), + deployContract: (e) => YN(t, e), + getAddresses: () => JN(t), getChainId: () => N0(t), - getPermissions: () => JN(t), + getPermissions: () => XN(t), prepareTransactionRequest: (e) => Ov(t, e), - requestAddresses: () => XN(t), - requestPermissions: (e) => ZN(t, e), - sendRawTransaction: (e) => u4(t, e), + requestAddresses: () => ZN(t), + requestPermissions: (e) => QN(t, e), + sendRawTransaction: (e) => a4(t, e), sendTransaction: (e) => Nv(t, e), - signMessage: (e) => QN(t, e), - signTransaction: (e) => eL(t, e), - signTypedData: (e) => tL(t, e), - switchChain: (e) => rL(t, e), - watchAsset: (e) => nL(t, e), - writeContract: (e) => TN(t, e) + signMessage: (e) => eL(t, e), + signTransaction: (e) => tL(t, e), + signTypedData: (e) => rL(t, e), + switchChain: (e) => nL(t, e), + watchAsset: (e) => iL(t, e), + writeContract: (e) => RN(t, e) }; } -function sL(t) { +function oL(t) { const { key: e = "wallet", name: r = "Wallet Client", transport: n } = t; - return DN({ + return ON({ ...t, key: e, name: r, transport: n, type: "walletClient" - }).extend(iL); + }).extend(sL); } class vl { constructor(e) { @@ -4567,7 +4567,7 @@ class vl { return this._installed; } get client() { - return this._provider ? sL({ transport: BN(this._provider) }) : null; + return this._provider ? oL({ transport: FN(this._provider) }) : null; } get config() { return this._config; @@ -4614,7 +4614,7 @@ class vl { this._provider && "session" in this._provider && await this._provider.disconnect(), this._connected = !1, this._address = null; } } -var Lv = { exports: {} }, uu = typeof Reflect == "object" ? Reflect : null, L2 = uu && typeof uu.apply == "function" ? uu.apply : function(e, r, n) { +var Lv = { exports: {} }, uu = typeof Reflect == "object" ? Reflect : null, O2 = uu && typeof uu.apply == "function" ? uu.apply : function(e, r, n) { return Function.prototype.apply.call(e, r, n); }, xd; uu && typeof uu.ownKeys == "function" ? xd = uu.ownKeys : Object.getOwnPropertySymbols ? xd = function(e) { @@ -4622,22 +4622,22 @@ uu && typeof uu.ownKeys == "function" ? xd = uu.ownKeys : Object.getOwnPropertyS } : xd = function(e) { return Object.getOwnPropertyNames(e); }; -function oL(t) { +function aL(t) { console && console.warn && console.warn(t); } -var l4 = Number.isNaN || function(e) { +var u4 = Number.isNaN || function(e) { return e !== e; }; function kr() { kr.init.call(this); } Lv.exports = kr; -Lv.exports.once = fL; +Lv.exports.once = lL; kr.EventEmitter = kr; kr.prototype._events = void 0; kr.prototype._eventsCount = 0; kr.prototype._maxListeners = void 0; -var k2 = 10; +var N2 = 10; function L0(t) { if (typeof t != "function") throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof t); @@ -4645,27 +4645,27 @@ function L0(t) { Object.defineProperty(kr, "defaultMaxListeners", { enumerable: !0, get: function() { - return k2; + return N2; }, set: function(t) { - if (typeof t != "number" || t < 0 || l4(t)) + if (typeof t != "number" || t < 0 || u4(t)) throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + t + "."); - k2 = t; + N2 = t; } }); kr.init = function() { (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0; }; kr.prototype.setMaxListeners = function(e) { - if (typeof e != "number" || e < 0 || l4(e)) + if (typeof e != "number" || e < 0 || u4(e)) throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + "."); return this._maxListeners = e, this; }; -function h4(t) { +function f4(t) { return t._maxListeners === void 0 ? kr.defaultMaxListeners : t._maxListeners; } kr.prototype.getMaxListeners = function() { - return h4(this); + return f4(this); }; kr.prototype.emit = function(e) { for (var r = [], n = 1; n < arguments.length; n++) r.push(arguments[n]); @@ -4685,13 +4685,13 @@ kr.prototype.emit = function(e) { if (u === void 0) return !1; if (typeof u == "function") - L2(u, this, r); + O2(u, this, r); else - for (var l = u.length, d = v4(u, l), n = 0; n < l; ++n) - L2(d[n], this, r); + for (var l = u.length, d = g4(u, l), n = 0; n < l; ++n) + O2(d[n], this, r); return !0; }; -function d4(t, e, r, n) { +function l4(t, e, r, n) { var i, s, o; if (L0(r), s = t._events, s === void 0 ? (s = t._events = /* @__PURE__ */ Object.create(null), t._eventsCount = 0) : (s.newListener !== void 0 && (t.emit( "newListener", @@ -4699,33 +4699,33 @@ function d4(t, e, r, n) { r.listener ? r.listener : r ), s = t._events), o = s[e]), o === void 0) o = s[e] = r, ++t._eventsCount; - else if (typeof o == "function" ? o = s[e] = n ? [r, o] : [o, r] : n ? o.unshift(r) : o.push(r), i = h4(t), i > 0 && o.length > i && !o.warned) { + else if (typeof o == "function" ? o = s[e] = n ? [r, o] : [o, r] : n ? o.unshift(r) : o.push(r), i = f4(t), i > 0 && o.length > i && !o.warned) { o.warned = !0; var a = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit"); - a.name = "MaxListenersExceededWarning", a.emitter = t, a.type = e, a.count = o.length, oL(a); + a.name = "MaxListenersExceededWarning", a.emitter = t, a.type = e, a.count = o.length, aL(a); } return t; } kr.prototype.addListener = function(e, r) { - return d4(this, e, r, !1); + return l4(this, e, r, !1); }; kr.prototype.on = kr.prototype.addListener; kr.prototype.prependListener = function(e, r) { - return d4(this, e, r, !0); + return l4(this, e, r, !0); }; -function aL() { +function cL() { if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments); } -function p4(t, e, r) { - var n = { fired: !1, wrapFn: void 0, target: t, type: e, listener: r }, i = aL.bind(n); +function h4(t, e, r) { + var n = { fired: !1, wrapFn: void 0, target: t, type: e, listener: r }, i = cL.bind(n); return i.listener = r, n.wrapFn = i, i; } kr.prototype.once = function(e, r) { - return L0(r), this.on(e, p4(this, e, r)), this; + return L0(r), this.on(e, h4(this, e, r)), this; }; kr.prototype.prependOnceListener = function(e, r) { - return L0(r), this.prependListener(e, p4(this, e, r)), this; + return L0(r), this.prependListener(e, h4(this, e, r)), this; }; kr.prototype.removeListener = function(e, r) { var n, i, s, o, a; @@ -4743,7 +4743,7 @@ kr.prototype.removeListener = function(e, r) { } if (s < 0) return this; - s === 0 ? n.shift() : cL(n, s), n.length === 1 && (i[e] = n[0]), i.removeListener !== void 0 && this.emit("removeListener", e, a || r); + s === 0 ? n.shift() : uL(n, s), n.length === 1 && (i[e] = n[0]), i.removeListener !== void 0 && this.emit("removeListener", e, a || r); } return this; }; @@ -4767,24 +4767,24 @@ kr.prototype.removeAllListeners = function(e) { this.removeListener(e, r[i]); return this; }; -function g4(t, e, r) { +function d4(t, e, r) { var n = t._events; if (n === void 0) return []; var i = n[e]; - return i === void 0 ? [] : typeof i == "function" ? r ? [i.listener || i] : [i] : r ? uL(i) : v4(i, i.length); + return i === void 0 ? [] : typeof i == "function" ? r ? [i.listener || i] : [i] : r ? fL(i) : g4(i, i.length); } kr.prototype.listeners = function(e) { - return g4(this, e, !0); + return d4(this, e, !0); }; kr.prototype.rawListeners = function(e) { - return g4(this, e, !1); + return d4(this, e, !1); }; kr.listenerCount = function(t, e) { - return typeof t.listenerCount == "function" ? t.listenerCount(e) : m4.call(t, e); + return typeof t.listenerCount == "function" ? t.listenerCount(e) : p4.call(t, e); }; -kr.prototype.listenerCount = m4; -function m4(t) { +kr.prototype.listenerCount = p4; +function p4(t) { var e = this._events; if (e !== void 0) { var r = e[t]; @@ -4798,22 +4798,22 @@ function m4(t) { kr.prototype.eventNames = function() { return this._eventsCount > 0 ? xd(this._events) : []; }; -function v4(t, e) { +function g4(t, e) { for (var r = new Array(e), n = 0; n < e; ++n) r[n] = t[n]; return r; } -function cL(t, e) { +function uL(t, e) { for (; e + 1 < t.length; e++) t[e] = t[e + 1]; t.pop(); } -function uL(t) { +function fL(t) { for (var e = new Array(t.length), r = 0; r < e.length; ++r) e[r] = t[r].listener || t[r]; return e; } -function fL(t, e) { +function lL(t, e) { return new Promise(function(r, n) { function i(o) { t.removeListener(e, s), n(o); @@ -4821,13 +4821,13 @@ function fL(t, e) { function s() { typeof t.removeListener == "function" && t.removeListener("error", i), r([].slice.call(arguments)); } - b4(t, e, s, { once: !0 }), e !== "error" && lL(t, i, { once: !0 }); + m4(t, e, s, { once: !0 }), e !== "error" && hL(t, i, { once: !0 }); }); } -function lL(t, e, r) { - typeof t.on == "function" && b4(t, "error", e, r); +function hL(t, e, r) { + typeof t.on == "function" && m4(t, "error", e, r); } -function b4(t, e, r, n) { +function m4(t, e, r, n) { if (typeof t.on == "function") n.once ? t.once(e, r) : t.on(e, r); else if (typeof t.addEventListener == "function") @@ -4837,8 +4837,8 @@ function b4(t, e, r, n) { else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof t); } -var ns = Lv.exports; -const kv = /* @__PURE__ */ rs(ns); +var rs = Lv.exports; +const kv = /* @__PURE__ */ ts(rs); var mt = {}; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. @@ -4861,7 +4861,7 @@ var c1 = function(t, e) { for (var i in n) n.hasOwnProperty(i) && (r[i] = n[i]); }, c1(t, e); }; -function hL(t, e) { +function dL(t, e) { c1(t, e); function r() { this.constructor = t; @@ -4877,7 +4877,7 @@ var u1 = function() { return e; }, u1.apply(this, arguments); }; -function dL(t, e) { +function pL(t, e) { var r = {}; for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); if (t != null && typeof Object.getOwnPropertySymbols == "function") @@ -4885,21 +4885,21 @@ function dL(t, e) { e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]); return r; } -function pL(t, e, r, n) { +function gL(t, e, r, n) { var i = arguments.length, s = i < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, r) : n, o; if (typeof Reflect == "object" && typeof Reflect.decorate == "function") s = Reflect.decorate(t, e, r, n); else for (var a = t.length - 1; a >= 0; a--) (o = t[a]) && (s = (i < 3 ? o(s) : i > 3 ? o(e, r, s) : o(e, r)) || s); return i > 3 && s && Object.defineProperty(e, r, s), s; } -function gL(t, e) { +function mL(t, e) { return function(r, n) { e(r, n, t); }; } -function mL(t, e) { +function vL(t, e) { if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(t, e); } -function vL(t, e, r, n) { +function bL(t, e, r, n) { function i(s) { return s instanceof r ? s : new r(function(o) { o(s); @@ -4926,7 +4926,7 @@ function vL(t, e, r, n) { l((n = n.apply(t, e || [])).next()); }); } -function bL(t, e) { +function yL(t, e) { var r = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; @@ -4986,10 +4986,10 @@ function bL(t, e) { return { value: l[0] ? l[1] : void 0, done: !0 }; } } -function yL(t, e, r, n) { +function wL(t, e, r, n) { n === void 0 && (n = r), t[n] = e[r]; } -function wL(t, e) { +function xL(t, e) { for (var r in t) r !== "default" && !e.hasOwnProperty(r) && (e[r] = t[r]); } function f1(t) { @@ -5002,7 +5002,7 @@ function f1(t) { }; throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined."); } -function y4(t, e) { +function v4(t, e) { var r = typeof Symbol == "function" && t[Symbol.iterator]; if (!r) return t; var n = r.call(t), i, s = [], o; @@ -5019,12 +5019,12 @@ function y4(t, e) { } return s; } -function xL() { +function _L() { for (var t = [], e = 0; e < arguments.length; e++) - t = t.concat(y4(arguments[e])); + t = t.concat(v4(arguments[e])); return t; } -function _L() { +function EL() { for (var t = 0, e = 0, r = arguments.length; e < r; e++) t += arguments[e].length; for (var n = Array(t), i = 0, e = 0; e < r; e++) for (var s = arguments[e], o = 0, a = s.length; o < a; o++, i++) @@ -5034,7 +5034,7 @@ function _L() { function bl(t) { return this instanceof bl ? (this.v = t, this) : new bl(t); } -function EL(t, e, r) { +function SL(t, e, r) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var n = r.apply(t, e || []), i, s = []; return i = {}, o("next"), o("throw"), o("return"), i[Symbol.asyncIterator] = function() { @@ -5042,16 +5042,16 @@ function EL(t, e, r) { }, i; function o(w) { n[w] && (i[w] = function(A) { - return new Promise(function(P, N) { - s.push([w, A, P, N]) > 1 || a(w, A); + return new Promise(function(M, N) { + s.push([w, A, M, N]) > 1 || a(w, A); }); }); } function a(w, A) { try { u(n[w](A)); - } catch (P) { - p(s[0][3], P); + } catch (M) { + p(s[0][3], M); } } function u(w) { @@ -5067,7 +5067,7 @@ function EL(t, e, r) { w(A), s.shift(), s.length && a(s[0][0], s[0][1]); } } -function SL(t) { +function AL(t) { var e, r; return e = {}, n("next"), n("throw", function(i) { throw i; @@ -5080,7 +5080,7 @@ function SL(t) { } : s; } } -function AL(t) { +function PL(t) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var e = t[Symbol.asyncIterator], r; return e ? e.call(t) : (t = typeof f1 == "function" ? f1(t) : t[Symbol.iterator](), r = {}, n("next"), n("throw"), n("return"), r[Symbol.asyncIterator] = function() { @@ -5099,60 +5099,60 @@ function AL(t) { }, o); } } -function PL(t, e) { +function ML(t, e) { return Object.defineProperty ? Object.defineProperty(t, "raw", { value: e }) : t.raw = e, t; } -function ML(t) { +function IL(t) { if (t && t.__esModule) return t; var e = {}; if (t != null) for (var r in t) Object.hasOwnProperty.call(t, r) && (e[r] = t[r]); return e.default = t, e; } -function IL(t) { +function CL(t) { return t && t.__esModule ? t : { default: t }; } -function CL(t, e) { +function TL(t, e) { if (!e.has(t)) throw new TypeError("attempted to get private field on non-instance"); return e.get(t); } -function TL(t, e, r) { +function RL(t, e, r) { if (!e.has(t)) throw new TypeError("attempted to set private field on non-instance"); return e.set(t, r), r; } -const RL = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +const DL = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, get __assign() { return u1; }, - __asyncDelegator: SL, - __asyncGenerator: EL, - __asyncValues: AL, + __asyncDelegator: AL, + __asyncGenerator: SL, + __asyncValues: PL, __await: bl, - __awaiter: vL, - __classPrivateFieldGet: CL, - __classPrivateFieldSet: TL, - __createBinding: yL, - __decorate: pL, - __exportStar: wL, - __extends: hL, - __generator: bL, - __importDefault: IL, - __importStar: ML, - __makeTemplateObject: PL, - __metadata: mL, - __param: gL, - __read: y4, - __rest: dL, - __spread: xL, - __spreadArrays: _L, + __awaiter: bL, + __classPrivateFieldGet: TL, + __classPrivateFieldSet: RL, + __createBinding: wL, + __decorate: gL, + __exportStar: xL, + __extends: dL, + __generator: yL, + __importDefault: CL, + __importStar: IL, + __makeTemplateObject: ML, + __metadata: vL, + __param: mL, + __read: v4, + __rest: pL, + __spread: _L, + __spreadArrays: EL, __values: f1 -}, Symbol.toStringTag, { value: "Module" })), jl = /* @__PURE__ */ bv(RL); -var Wg = {}, wf = {}, $2; -function DL() { - if ($2) return wf; - $2 = 1, Object.defineProperty(wf, "__esModule", { value: !0 }), wf.delay = void 0; +}, Symbol.toStringTag, { value: "Module" })), jl = /* @__PURE__ */ bv(DL); +var Wg = {}, wf = {}, L2; +function OL() { + if (L2) return wf; + L2 = 1, Object.defineProperty(wf, "__esModule", { value: !0 }), wf.delay = void 0; function t(e) { return new Promise((r) => { setTimeout(() => { @@ -5162,50 +5162,50 @@ function DL() { } return wf.delay = t, wf; } -var Wa = {}, Hg = {}, Ha = {}, B2; -function OL() { - return B2 || (B2 = 1, Object.defineProperty(Ha, "__esModule", { value: !0 }), Ha.ONE_THOUSAND = Ha.ONE_HUNDRED = void 0, Ha.ONE_HUNDRED = 100, Ha.ONE_THOUSAND = 1e3), Ha; -} -var Kg = {}, F2; +var qa = {}, Hg = {}, za = {}, k2; function NL() { - return F2 || (F2 = 1, function(t) { + return k2 || (k2 = 1, Object.defineProperty(za, "__esModule", { value: !0 }), za.ONE_THOUSAND = za.ONE_HUNDRED = void 0, za.ONE_HUNDRED = 100, za.ONE_THOUSAND = 1e3), za; +} +var Kg = {}, $2; +function LL() { + return $2 || ($2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.ONE_YEAR = t.FOUR_WEEKS = t.THREE_WEEKS = t.TWO_WEEKS = t.ONE_WEEK = t.THIRTY_DAYS = t.SEVEN_DAYS = t.FIVE_DAYS = t.THREE_DAYS = t.ONE_DAY = t.TWENTY_FOUR_HOURS = t.TWELVE_HOURS = t.SIX_HOURS = t.THREE_HOURS = t.ONE_HOUR = t.SIXTY_MINUTES = t.THIRTY_MINUTES = t.TEN_MINUTES = t.FIVE_MINUTES = t.ONE_MINUTE = t.SIXTY_SECONDS = t.THIRTY_SECONDS = t.TEN_SECONDS = t.FIVE_SECONDS = t.ONE_SECOND = void 0, t.ONE_SECOND = 1, t.FIVE_SECONDS = 5, t.TEN_SECONDS = 10, t.THIRTY_SECONDS = 30, t.SIXTY_SECONDS = 60, t.ONE_MINUTE = t.SIXTY_SECONDS, t.FIVE_MINUTES = t.ONE_MINUTE * 5, t.TEN_MINUTES = t.ONE_MINUTE * 10, t.THIRTY_MINUTES = t.ONE_MINUTE * 30, t.SIXTY_MINUTES = t.ONE_MINUTE * 60, t.ONE_HOUR = t.SIXTY_MINUTES, t.THREE_HOURS = t.ONE_HOUR * 3, t.SIX_HOURS = t.ONE_HOUR * 6, t.TWELVE_HOURS = t.ONE_HOUR * 12, t.TWENTY_FOUR_HOURS = t.ONE_HOUR * 24, t.ONE_DAY = t.TWENTY_FOUR_HOURS, t.THREE_DAYS = t.ONE_DAY * 3, t.FIVE_DAYS = t.ONE_DAY * 5, t.SEVEN_DAYS = t.ONE_DAY * 7, t.THIRTY_DAYS = t.ONE_DAY * 30, t.ONE_WEEK = t.SEVEN_DAYS, t.TWO_WEEKS = t.ONE_WEEK * 2, t.THREE_WEEKS = t.ONE_WEEK * 3, t.FOUR_WEEKS = t.ONE_WEEK * 4, t.ONE_YEAR = t.ONE_DAY * 365; }(Kg)), Kg; } -var j2; -function w4() { - return j2 || (j2 = 1, function(t) { +var B2; +function b4() { + return B2 || (B2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); const e = jl; - e.__exportStar(OL(), t), e.__exportStar(NL(), t); + e.__exportStar(NL(), t), e.__exportStar(LL(), t); }(Hg)), Hg; } -var U2; -function LL() { - if (U2) return Wa; - U2 = 1, Object.defineProperty(Wa, "__esModule", { value: !0 }), Wa.fromMiliseconds = Wa.toMiliseconds = void 0; - const t = w4(); +var F2; +function kL() { + if (F2) return qa; + F2 = 1, Object.defineProperty(qa, "__esModule", { value: !0 }), qa.fromMiliseconds = qa.toMiliseconds = void 0; + const t = b4(); function e(n) { return n * t.ONE_THOUSAND; } - Wa.toMiliseconds = e; + qa.toMiliseconds = e; function r(n) { return Math.floor(n / t.ONE_THOUSAND); } - return Wa.fromMiliseconds = r, Wa; + return qa.fromMiliseconds = r, qa; } -var q2; -function kL() { - return q2 || (q2 = 1, function(t) { +var j2; +function $L() { + return j2 || (j2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); const e = jl; - e.__exportStar(DL(), t), e.__exportStar(LL(), t); + e.__exportStar(OL(), t), e.__exportStar(kL(), t); }(Wg)), Wg; } -var zc = {}, z2; -function $L() { - if (z2) return zc; - z2 = 1, Object.defineProperty(zc, "__esModule", { value: !0 }), zc.Watch = void 0; +var zc = {}, U2; +function BL() { + if (U2) return zc; + U2 = 1, Object.defineProperty(zc, "__esModule", { value: !0 }), zc.Watch = void 0; class t { constructor() { this.timestamps = /* @__PURE__ */ new Map(); @@ -5235,39 +5235,39 @@ function $L() { } return zc.Watch = t, zc.default = t, zc; } -var Vg = {}, xf = {}, W2; -function BL() { - if (W2) return xf; - W2 = 1, Object.defineProperty(xf, "__esModule", { value: !0 }), xf.IWatch = void 0; +var Vg = {}, xf = {}, q2; +function FL() { + if (q2) return xf; + q2 = 1, Object.defineProperty(xf, "__esModule", { value: !0 }), xf.IWatch = void 0; class t { } return xf.IWatch = t, xf; } -var H2; -function FL() { - return H2 || (H2 = 1, function(t) { - Object.defineProperty(t, "__esModule", { value: !0 }), jl.__exportStar(BL(), t); +var z2; +function jL() { + return z2 || (z2 = 1, function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }), jl.__exportStar(FL(), t); }(Vg)), Vg; } (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); const e = jl; - e.__exportStar(kL(), t), e.__exportStar($L(), t), e.__exportStar(FL(), t), e.__exportStar(w4(), t); + e.__exportStar($L(), t), e.__exportStar(BL(), t), e.__exportStar(jL(), t), e.__exportStar(b4(), t); })(mt); class vc { } -let jL = class extends vc { +let UL = class extends vc { constructor(e) { super(); } }; -const K2 = mt.FIVE_SECONDS, Ou = { pulse: "heartbeat_pulse" }; -let UL = class x4 extends jL { +const W2 = mt.FIVE_SECONDS, Ou = { pulse: "heartbeat_pulse" }; +let qL = class y4 extends UL { constructor(e) { - super(e), this.events = new ns.EventEmitter(), this.interval = K2, this.interval = (e == null ? void 0 : e.interval) || K2; + super(e), this.events = new rs.EventEmitter(), this.interval = W2, this.interval = (e == null ? void 0 : e.interval) || W2; } static async init(e) { - const r = new x4(e); + const r = new y4(e); return await r.init(), r; } async init() { @@ -5295,15 +5295,15 @@ let UL = class x4 extends jL { this.events.emit(Ou.pulse); } }; -const qL = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/, zL = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/, WL = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/; -function HL(t, e) { +const zL = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/, WL = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/, HL = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/; +function KL(t, e) { if (t === "__proto__" || t === "constructor" && e && typeof e == "object" && "prototype" in e) { - KL(t); + VL(t); return; } return e; } -function KL(t) { +function VL(t) { console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`); } function od(t, e = {}) { @@ -5332,16 +5332,16 @@ function od(t, e = {}) { if (n === "-infinity") return Number.NEGATIVE_INFINITY; } - if (!WL.test(t)) { + if (!HL.test(t)) { if (e.strict) throw new SyntaxError("[destr] Invalid JSON"); return t; } try { - if (qL.test(t) || zL.test(t)) { + if (zL.test(t) || WL.test(t)) { if (e.strict) throw new Error("[destr] Possible prototype pollution"); - return JSON.parse(t, HL); + return JSON.parse(t, KL); } return JSON.parse(t); } catch (n) { @@ -5350,61 +5350,61 @@ function od(t, e = {}) { return t; } } -function VL(t) { +function GL(t) { return !t || typeof t.then != "function" ? Promise.resolve(t) : t; } function Cn(t, ...e) { try { - return VL(t(...e)); + return GL(t(...e)); } catch (r) { return Promise.reject(r); } } -function GL(t) { +function YL(t) { const e = typeof t; return t === null || e !== "object" && e !== "function"; } -function YL(t) { +function JL(t) { const e = Object.getPrototypeOf(t); return !e || e.isPrototypeOf(Object); } function _d(t) { - if (GL(t)) + if (YL(t)) return String(t); - if (YL(t) || Array.isArray(t)) + if (JL(t) || Array.isArray(t)) return JSON.stringify(t); if (typeof t.toJSON == "function") return _d(t.toJSON()); throw new Error("[unstorage] Cannot stringify value!"); } -function _4() { +function w4() { if (typeof Buffer > "u") throw new TypeError("[unstorage] Buffer is not supported!"); } const l1 = "base64:"; -function JL(t) { +function XL(t) { if (typeof t == "string") return t; - _4(); + w4(); const e = Buffer.from(t).toString("base64"); return l1 + e; } -function XL(t) { - return typeof t != "string" || !t.startsWith(l1) ? t : (_4(), Buffer.from(t.slice(l1.length), "base64")); +function ZL(t) { + return typeof t != "string" || !t.startsWith(l1) ? t : (w4(), Buffer.from(t.slice(l1.length), "base64")); } function pi(t) { return t ? t.split("?")[0].replace(/[/\\]/g, ":").replace(/:+/g, ":").replace(/^:|:$/g, "") : ""; } -function ZL(...t) { +function QL(...t) { return pi(t.join(":")); } function ad(t) { return t = pi(t), t ? t + ":" : ""; } -const QL = "memory", ek = () => { +const ek = "memory", tk = () => { const t = /* @__PURE__ */ new Map(); return { - name: QL, + name: ek, getInstance: () => t, hasItem(e) { return t.has(e); @@ -5435,9 +5435,9 @@ const QL = "memory", ek = () => { } }; }; -function tk(t = {}) { +function rk(t = {}) { const e = { - mounts: { "": t.driver || ek() }, + mounts: { "": t.driver || tk() }, mountpoints: [""], watching: !1, watchListeners: [], @@ -5471,7 +5471,7 @@ function tk(t = {}) { if (!e.watching) { e.watching = !0; for (const l in e.mounts) - e.unwatch[l] = await V2( + e.unwatch[l] = await H2( e.mounts[l], i, l @@ -5484,25 +5484,25 @@ function tk(t = {}) { e.unwatch = {}, e.watching = !1; } }, a = (l, d, p) => { - const w = /* @__PURE__ */ new Map(), A = (P) => { - let N = w.get(P.base); + const w = /* @__PURE__ */ new Map(), A = (M) => { + let N = w.get(M.base); return N || (N = { - driver: P.driver, - base: P.base, + driver: M.driver, + base: M.base, items: [] - }, w.set(P.base, N)), N; + }, w.set(M.base, N)), N; }; - for (const P of l) { - const N = typeof P == "string", L = pi(N ? P : P.key), $ = N ? void 0 : P.value, B = N || !P.options ? d : { ...d, ...P.options }, H = r(L); + for (const M of l) { + const N = typeof M == "string", L = pi(N ? M : M.key), B = N ? void 0 : M.value, $ = N || !M.options ? d : { ...d, ...M.options }, H = r(L); A(H).items.push({ key: L, - value: $, + value: B, relativeKey: H.relativeKey, - options: B + options: $ }); } - return Promise.all([...w.values()].map((P) => p(P))).then( - (P) => P.flat() + return Promise.all([...w.values()].map((M) => p(M))).then( + (M) => M.flat() ); }, u = { // Item @@ -5528,7 +5528,7 @@ function tk(t = {}) { d ).then( (w) => w.map((A) => ({ - key: ZL(p.base, A.key), + key: QL(p.base, A.key), value: od(A.value) })) ) : Promise.all( @@ -5546,7 +5546,7 @@ function tk(t = {}) { l = pi(l); const { relativeKey: p, driver: w } = r(l); return w.getItemRaw ? Cn(w.getItemRaw, p, d) : Cn(w.getItem, p, d).then( - (A) => XL(A) + (A) => ZL(A) ); }, async setItem(l, d, p = {}) { @@ -5586,7 +5586,7 @@ function tk(t = {}) { if (A.setItemRaw) await Cn(A.setItemRaw, w, d, p); else if (A.setItem) - await Cn(A.setItem, w, JL(d), p); + await Cn(A.setItem, w, XL(d), p); else return; A.watch || i("update", l); @@ -5601,12 +5601,12 @@ function tk(t = {}) { typeof d == "boolean" && (d = { nativeOnly: d }), l = pi(l); const { relativeKey: p, driver: w } = r(l), A = /* @__PURE__ */ Object.create(null); if (w.getMeta && Object.assign(A, await Cn(w.getMeta, p, d)), !d.nativeOnly) { - const P = await Cn( + const M = await Cn( w.getItem, p + "$", d ).then((N) => od(N)); - P && typeof P == "object" && (typeof P.atime == "string" && (P.atime = new Date(P.atime)), typeof P.mtime == "string" && (P.mtime = new Date(P.mtime)), Object.assign(A, P)); + M && typeof M == "object" && (typeof M.atime == "string" && (M.atime = new Date(M.atime)), typeof M.mtime == "string" && (M.mtime = new Date(M.mtime)), Object.assign(A, M)); } return A; }, @@ -5622,24 +5622,24 @@ function tk(t = {}) { const p = n(l, !0); let w = []; const A = []; - for (const P of p) { + for (const M of p) { const N = await Cn( - P.driver.getKeys, - P.relativeBase, + M.driver.getKeys, + M.relativeBase, d ); for (const L of N) { - const $ = P.mountpoint + pi(L); - w.some((B) => $.startsWith(B)) || A.push($); + const B = M.mountpoint + pi(L); + w.some(($) => B.startsWith($)) || A.push(B); } w = [ - P.mountpoint, - ...w.filter((L) => !L.startsWith(P.mountpoint)) + M.mountpoint, + ...w.filter((L) => !L.startsWith(M.mountpoint)) ]; } return l ? A.filter( - (P) => P.startsWith(l) && P[P.length - 1] !== "$" - ) : A.filter((P) => P[P.length - 1] !== "$"); + (M) => M.startsWith(l) && M[M.length - 1] !== "$" + ) : A.filter((M) => M[M.length - 1] !== "$"); }, // Utils async clear(l, d = {}) { @@ -5658,7 +5658,7 @@ function tk(t = {}) { }, async dispose() { await Promise.all( - Object.values(e.mounts).map((l) => G2(l)) + Object.values(e.mounts).map((l) => K2(l)) ); }, async watch(l) { @@ -5675,12 +5675,12 @@ function tk(t = {}) { mount(l, d) { if (l = ad(l), l && e.mounts[l]) throw new Error(`already mounted at ${l}`); - return l && (e.mountpoints.push(l), e.mountpoints.sort((p, w) => w.length - p.length)), e.mounts[l] = d, e.watching && Promise.resolve(V2(d, i, l)).then((p) => { + return l && (e.mountpoints.push(l), e.mountpoints.sort((p, w) => w.length - p.length)), e.mounts[l] = d, e.watching && Promise.resolve(H2(d, i, l)).then((p) => { e.unwatch[l] = p; }).catch(console.error), u; }, async unmount(l, d = !0) { - l = ad(l), !(!l || !e.mounts[l]) && (e.watching && l in e.unwatch && (e.unwatch[l](), delete e.unwatch[l]), d && await G2(e.mounts[l]), e.mountpoints = e.mountpoints.filter((p) => p !== l), delete e.mounts[l]); + l = ad(l), !(!l || !e.mounts[l]) && (e.watching && l in e.unwatch && (e.unwatch[l](), delete e.unwatch[l]), d && await K2(e.mounts[l]), e.mountpoints = e.mountpoints.filter((p) => p !== l), delete e.mounts[l]); }, getMount(l = "") { l = pi(l) + ":"; @@ -5706,11 +5706,11 @@ function tk(t = {}) { }; return u; } -function V2(t, e, r) { +function H2(t, e, r) { return t.watch ? t.watch((n, i) => e(n, r + i)) : () => { }; } -async function G2(t) { +async function K2(t) { typeof t.dispose == "function" && await Cn(t.dispose); } function bc(t) { @@ -5718,7 +5718,7 @@ function bc(t) { t.oncomplete = t.onsuccess = () => e(t.result), t.onabort = t.onerror = () => r(t.error); }); } -function E4(t, e) { +function x4(t, e) { const r = indexedDB.open(t); r.onupgradeneeded = () => r.result.createObjectStore(e); const n = bc(r); @@ -5726,71 +5726,71 @@ function E4(t, e) { } let Gg; function Ul() { - return Gg || (Gg = E4("keyval-store", "keyval")), Gg; + return Gg || (Gg = x4("keyval-store", "keyval")), Gg; } -function Y2(t, e = Ul()) { +function V2(t, e = Ul()) { return e("readonly", (r) => bc(r.get(t))); } -function rk(t, e, r = Ul()) { +function nk(t, e, r = Ul()) { return r("readwrite", (n) => (n.put(e, t), bc(n.transaction))); } -function nk(t, e = Ul()) { +function ik(t, e = Ul()) { return e("readwrite", (r) => (r.delete(t), bc(r.transaction))); } -function ik(t = Ul()) { +function sk(t = Ul()) { return t("readwrite", (e) => (e.clear(), bc(e.transaction))); } -function sk(t, e) { +function ok(t, e) { return t.openCursor().onsuccess = function() { this.result && (e(this.result), this.result.continue()); }, bc(t.transaction); } -function ok(t = Ul()) { +function ak(t = Ul()) { return t("readonly", (e) => { if (e.getAllKeys) return bc(e.getAllKeys()); const r = []; - return sk(e, (n) => r.push(n.key)).then(() => r); + return ok(e, (n) => r.push(n.key)).then(() => r); }); } -const ak = (t) => JSON.stringify(t, (e, r) => typeof r == "bigint" ? r.toString() + "n" : r), ck = (t) => { +const ck = (t) => JSON.stringify(t, (e, r) => typeof r == "bigint" ? r.toString() + "n" : r), uk = (t) => { const e = /([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g, r = t.replace(e, '$1"$2n"$3'); return JSON.parse(r, (n, i) => typeof i == "string" && i.match(/^\d+n$/) ? BigInt(i.substring(0, i.length - 1)) : i); }; -function lc(t) { +function fc(t) { if (typeof t != "string") throw new Error(`Cannot safe json parse value of type ${typeof t}`); try { - return ck(t); + return uk(t); } catch { return t; } } -function Bo(t) { - return typeof t == "string" ? t : ak(t) || ""; +function $o(t) { + return typeof t == "string" ? t : ck(t) || ""; } -const uk = "idb-keyval"; -var fk = (t = {}) => { +const fk = "idb-keyval"; +var lk = (t = {}) => { const e = t.base && t.base.length > 0 ? `${t.base}:` : "", r = (i) => e + i; let n; - return t.dbName && t.storeName && (n = E4(t.dbName, t.storeName)), { name: uk, options: t, async hasItem(i) { - return !(typeof await Y2(r(i), n) > "u"); + return t.dbName && t.storeName && (n = x4(t.dbName, t.storeName)), { name: fk, options: t, async hasItem(i) { + return !(typeof await V2(r(i), n) > "u"); }, async getItem(i) { - return await Y2(r(i), n) ?? null; + return await V2(r(i), n) ?? null; }, setItem(i, s) { - return rk(r(i), s, n); + return nk(r(i), s, n); }, removeItem(i) { - return nk(r(i), n); + return ik(r(i), n); }, getKeys() { - return ok(n); + return ak(n); }, clear() { - return ik(n); + return sk(n); } }; }; -const lk = "WALLET_CONNECT_V2_INDEXED_DB", hk = "keyvaluestorage"; -let dk = class { +const hk = "WALLET_CONNECT_V2_INDEXED_DB", dk = "keyvaluestorage"; +let pk = class { constructor() { - this.indexedDb = tk({ driver: fk({ dbName: lk, storeName: hk }) }); + this.indexedDb = rk({ driver: lk({ dbName: hk, storeName: dk }) }); } async getKeys() { return this.indexedDb.getKeys(); @@ -5803,7 +5803,7 @@ let dk = class { if (r !== null) return r; } async setItem(e, r) { - await this.indexedDb.setItem(e, Bo(r)); + await this.indexedDb.setItem(e, $o(r)); } async removeItem(e) { await this.indexedDb.removeItem(e); @@ -5831,11 +5831,11 @@ var Yg = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t return Object.keys(this).length; }), typeof Yg < "u" && Yg.localStorage ? Ed.exports = Yg.localStorage : typeof window < "u" && window.localStorage ? Ed.exports = window.localStorage : Ed.exports = new e(); })(); -function pk(t) { +function gk(t) { var e; - return [t[0], lc((e = t[1]) != null ? e : "")]; + return [t[0], fc((e = t[1]) != null ? e : "")]; } -let gk = class { +let mk = class { constructor() { this.localStorage = Ed.exports; } @@ -5843,22 +5843,22 @@ let gk = class { return Object.keys(this.localStorage); } async getEntries() { - return Object.entries(this.localStorage).map(pk); + return Object.entries(this.localStorage).map(gk); } async getItem(e) { const r = this.localStorage.getItem(e); - if (r !== null) return lc(r); + if (r !== null) return fc(r); } async setItem(e, r) { - this.localStorage.setItem(e, Bo(r)); + this.localStorage.setItem(e, $o(r)); } async removeItem(e) { this.localStorage.removeItem(e); } }; -const mk = "wc_storage_version", J2 = 1, vk = async (t, e, r) => { - const n = mk, i = await e.getItem(n); - if (i && i >= J2) { +const vk = "wc_storage_version", G2 = 1, bk = async (t, e, r) => { + const n = vk, i = await e.getItem(n); + if (i && i >= G2) { r(e); return; } @@ -5877,22 +5877,22 @@ const mk = "wc_storage_version", J2 = 1, vk = async (t, e, r) => { await e.setItem(a, l), o.push(a); } } - await e.setItem(n, J2), r(e), bk(t, o); -}, bk = async (t, e) => { + await e.setItem(n, G2), r(e), yk(t, o); +}, yk = async (t, e) => { e.length && e.forEach(async (r) => { await t.removeItem(r); }); }; -let yk = class { +let wk = class { constructor() { this.initialized = !1, this.setInitialized = (r) => { this.storage = r, this.initialized = !0; }; - const e = new gk(); + const e = new mk(); this.storage = e; try { - const r = new dk(); - vk(e, r, this.setInitialized); + const r = new pk(); + bk(e, r, this.setInitialized); } catch { this.initialized = !0; } @@ -5920,16 +5920,16 @@ let yk = class { }); } }; -function wk(t) { +function xk(t) { try { return JSON.stringify(t); } catch { return '"[Circular]"'; } } -var xk = _k; -function _k(t, e, r) { - var n = r && r.stringify || wk, i = 1; +var _k = Ek; +function Ek(t, e, r) { + var n = r && r.stringify || xk, i = 1; if (typeof t == "object" && t !== null) { var s = e.length + i; if (s === 1) return t; @@ -5960,12 +5960,12 @@ function _k(t, e, r) { case 106: if (d >= u || e[d] === void 0) break; p < A && (l += t.slice(p, A)); - var P = typeof e[d]; - if (P === "string") { + var M = typeof e[d]; + if (M === "string") { l += "'" + e[d] + "'", p = A + 2, A++; break; } - if (P === "function") { + if (M === "function") { l += e[d].name || "", p = A + 2, A++; break; } @@ -5986,9 +5986,9 @@ function _k(t, e, r) { } return p === -1 ? t : (p < w && (l += t.slice(p)), l); } -const X2 = xk; -var Jc = Fo; -const yl = Dk().console || {}, Ek = { +const Y2 = _k; +var Jc = Bo; +const yl = Ok().console || {}, Sk = { mapHttpRequest: cd, mapHttpResponse: cd, wrapRequestSerializer: Jg, @@ -5996,21 +5996,21 @@ const yl = Dk().console || {}, Ek = { wrapErrorSerializer: Jg, req: cd, res: cd, - err: Ik + err: Ck }; -function Sk(t, e) { +function Ak(t, e) { return Array.isArray(t) ? t.filter(function(n) { return n !== "!stdSerializers.err"; }) : t === !0 ? Object.keys(e) : !1; } -function Fo(t) { +function Bo(t) { t = t || {}, t.browser = t.browser || {}; const e = t.browser.transmit; if (e && typeof e.send != "function") throw Error("pino: transmit option must have a send function"); const r = t.browser.write || yl; t.browser.write && (t.browser.asObject = !0); - const n = t.serializers || {}, i = Sk(t.browser.serialize, n); + const n = t.serializers || {}, i = Ak(t.browser.serialize, n); let s = t.browser.serialize; Array.isArray(t.browser.serialize) && t.browser.serialize.indexOf("!stdSerializers.err") > -1 && (s = !1); const o = ["error", "fatal", "warn", "info", "debug", "trace"]; @@ -6027,39 +6027,39 @@ function Fo(t) { serialize: i, asObject: t.browser.asObject, levels: o, - timestamp: Ck(t) + timestamp: Tk(t) }; - u.levels = Fo.levels, u.level = a, u.setMaxListeners = u.getMaxListeners = u.emit = u.addListener = u.on = u.prependListener = u.once = u.prependOnceListener = u.removeListener = u.removeAllListeners = u.listeners = u.listenerCount = u.eventNames = u.write = u.flush = wl, u.serializers = n, u._serialize = i, u._stdErrSerialize = s, u.child = A, e && (u._logEvent = h1()); + u.levels = Bo.levels, u.level = a, u.setMaxListeners = u.getMaxListeners = u.emit = u.addListener = u.on = u.prependListener = u.once = u.prependOnceListener = u.removeListener = u.removeAllListeners = u.listeners = u.listenerCount = u.eventNames = u.write = u.flush = wl, u.serializers = n, u._serialize = i, u._stdErrSerialize = s, u.child = A, e && (u._logEvent = h1()); function d() { return this.level === "silent" ? 1 / 0 : this.levels.values[this.level]; } function p() { return this._level; } - function w(P) { - if (P !== "silent" && !this.levels.values[P]) - throw Error("unknown level " + P); - this._level = P, Wc(l, u, "error", "log"), Wc(l, u, "fatal", "error"), Wc(l, u, "warn", "error"), Wc(l, u, "info", "log"), Wc(l, u, "debug", "log"), Wc(l, u, "trace", "log"); + function w(M) { + if (M !== "silent" && !this.levels.values[M]) + throw Error("unknown level " + M); + this._level = M, Wc(l, u, "error", "log"), Wc(l, u, "fatal", "error"), Wc(l, u, "warn", "error"), Wc(l, u, "info", "log"), Wc(l, u, "debug", "log"), Wc(l, u, "trace", "log"); } - function A(P, N) { - if (!P) + function A(M, N) { + if (!M) throw new Error("missing bindings for child Pino"); - N = N || {}, i && P.serializers && (N.serializers = P.serializers); + N = N || {}, i && M.serializers && (N.serializers = M.serializers); const L = N.serializers; if (i && L) { - var $ = Object.assign({}, n, L), B = t.browser.serialize === !0 ? Object.keys($) : i; - delete P.serializers, k0([P], B, $, this._stdErrSerialize); + var B = Object.assign({}, n, L), $ = t.browser.serialize === !0 ? Object.keys(B) : i; + delete M.serializers, k0([M], $, B, this._stdErrSerialize); } function H(W) { - this._childLevel = (W._childLevel | 0) + 1, this.error = Hc(W, P, "error"), this.fatal = Hc(W, P, "fatal"), this.warn = Hc(W, P, "warn"), this.info = Hc(W, P, "info"), this.debug = Hc(W, P, "debug"), this.trace = Hc(W, P, "trace"), $ && (this.serializers = $, this._serialize = B), e && (this._logEvent = h1( - [].concat(W._logEvent.bindings, P) + this._childLevel = (W._childLevel | 0) + 1, this.error = Hc(W, M, "error"), this.fatal = Hc(W, M, "fatal"), this.warn = Hc(W, M, "warn"), this.info = Hc(W, M, "info"), this.debug = Hc(W, M, "debug"), this.trace = Hc(W, M, "trace"), B && (this.serializers = B, this._serialize = $), e && (this._logEvent = h1( + [].concat(W._logEvent.bindings, M) )); } return H.prototype = this, new H(this); } return u; } -Fo.levels = { +Bo.levels = { values: { fatal: 60, error: 50, @@ -6077,21 +6077,21 @@ Fo.levels = { 60: "fatal" } }; -Fo.stdSerializers = Ek; -Fo.stdTimeFunctions = Object.assign({}, { nullTime: S4, epochTime: A4, unixTime: Tk, isoTime: Rk }); +Bo.stdSerializers = Sk; +Bo.stdTimeFunctions = Object.assign({}, { nullTime: _4, epochTime: E4, unixTime: Rk, isoTime: Dk }); function Wc(t, e, r, n) { const i = Object.getPrototypeOf(e); - e[r] = e.levelVal > e.levels.values[r] ? wl : i[r] ? i[r] : yl[r] || yl[n] || wl, Ak(t, e, r); + e[r] = e.levelVal > e.levels.values[r] ? wl : i[r] ? i[r] : yl[r] || yl[n] || wl, Pk(t, e, r); } -function Ak(t, e, r) { +function Pk(t, e, r) { !t.transmit && e[r] === wl || (e[r] = /* @__PURE__ */ function(n) { return function() { const s = t.timestamp(), o = new Array(arguments.length), a = Object.getPrototypeOf && Object.getPrototypeOf(this) === yl ? yl : this; for (var u = 0; u < o.length; u++) o[u] = arguments[u]; - if (t.serialize && !t.asObject && k0(o, this._serialize, this.serializers, this._stdErrSerialize), t.asObject ? n.call(a, Pk(this, r, o, s)) : n.apply(a, o), t.transmit) { - const l = t.transmit.level || e.level, d = Fo.levels.values[l], p = Fo.levels.values[r]; + if (t.serialize && !t.asObject && k0(o, this._serialize, this.serializers, this._stdErrSerialize), t.asObject ? n.call(a, Mk(this, r, o, s)) : n.apply(a, o), t.transmit) { + const l = t.transmit.level || e.level, d = Bo.levels.values[l], p = Bo.levels.values[r]; if (p < d) return; - Mk(this, { + Ik(this, { ts: s, methodLevel: r, methodValue: p, @@ -6102,24 +6102,24 @@ function Ak(t, e, r) { }; }(e[r])); } -function Pk(t, e, r, n) { +function Mk(t, e, r, n) { t._serialize && k0(r, t._serialize, t.serializers, t._stdErrSerialize); const i = r.slice(); let s = i[0]; const o = {}; - n && (o.time = n), o.level = Fo.levels.values[e]; + n && (o.time = n), o.level = Bo.levels.values[e]; let a = (t._childLevel | 0) + 1; if (a < 1 && (a = 1), s !== null && typeof s == "object") { for (; a-- && typeof i[0] == "object"; ) Object.assign(o, i.shift()); - s = i.length ? X2(i.shift(), i) : void 0; - } else typeof s == "string" && (s = X2(i.shift(), i)); + s = i.length ? Y2(i.shift(), i) : void 0; + } else typeof s == "string" && (s = Y2(i.shift(), i)); return s !== void 0 && (o.msg = s), o; } function k0(t, e, r, n) { for (const i in t) if (n && t[i] instanceof Error) - t[i] = Fo.stdSerializers.err(t[i]); + t[i] = Bo.stdSerializers.err(t[i]); else if (typeof t[i] == "object" && !Array.isArray(t[i])) for (const s in t[i]) e && e.indexOf(s) > -1 && s in r && (t[i][s] = r[s](t[i][s])); @@ -6133,7 +6133,7 @@ function Hc(t, e, r) { return t[r].apply(this, n); }; } -function Mk(t, e, r) { +function Ik(t, e, r) { const n = e.send, i = e.ts, s = e.methodLevel, o = e.methodValue, a = e.val, u = t._logEvent.bindings; k0( r, @@ -6152,7 +6152,7 @@ function h1(t) { level: { label: "", value: 0 } }; } -function Ik(t) { +function Ck(t) { const e = { type: t.constructor.name, msg: t.message, @@ -6162,8 +6162,8 @@ function Ik(t) { e[r] === void 0 && (e[r] = t[r]); return e; } -function Ck(t) { - return typeof t.timestamp == "function" ? t.timestamp : t.timestamp === !1 ? S4 : A4; +function Tk(t) { + return typeof t.timestamp == "function" ? t.timestamp : t.timestamp === !1 ? _4 : E4; } function cd() { return {}; @@ -6173,19 +6173,19 @@ function Jg(t) { } function wl() { } -function S4() { +function _4() { return !1; } -function A4() { +function E4() { return Date.now(); } -function Tk() { +function Rk() { return Math.round(Date.now() / 1e3); } -function Rk() { +function Dk() { return new Date(Date.now()).toISOString(); } -function Dk() { +function Ok() { function t(e) { return typeof e < "u" && e; } @@ -6200,8 +6200,8 @@ function Dk() { return t(self) || t(window) || t(this) || {}; } } -const ql = /* @__PURE__ */ rs(Jc), Ok = { level: "info" }, zl = "custom_context", $v = 1e3 * 1024; -let Nk = class { +const ql = /* @__PURE__ */ ts(Jc), Nk = { level: "info" }, zl = "custom_context", $v = 1e3 * 1024; +let Lk = class { constructor(e) { this.nodeValue = e, this.sizeInBytes = new TextEncoder().encode(this.nodeValue).length, this.next = null; } @@ -6211,12 +6211,12 @@ let Nk = class { get size() { return this.sizeInBytes; } -}, Z2 = class { +}, J2 = class { constructor(e) { this.head = null, this.tail = null, this.lengthInNodes = 0, this.maxSizeInBytes = e, this.sizeInBytes = 0; } append(e) { - const r = new Nk(e); + const r = new Lk(e); if (r.size > this.maxSizeInBytes) throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`); for (; this.size + r.size > this.maxSizeInBytes; ) this.shift(); this.head ? (this.tail && (this.tail.next = r), this.tail = r) : (this.head = r, this.tail = r), this.lengthInNodes++, this.sizeInBytes += r.size; @@ -6249,15 +6249,15 @@ let Nk = class { return e = e.next, { done: !1, value: r }; } }; } -}, P4 = class { +}, S4 = class { constructor(e, r = $v) { - this.level = e ?? "error", this.levelValue = Jc.levels.values[this.level], this.MAX_LOG_SIZE_IN_BYTES = r, this.logs = new Z2(this.MAX_LOG_SIZE_IN_BYTES); + this.level = e ?? "error", this.levelValue = Jc.levels.values[this.level], this.MAX_LOG_SIZE_IN_BYTES = r, this.logs = new J2(this.MAX_LOG_SIZE_IN_BYTES); } forwardToConsole(e, r) { r === Jc.levels.values.error ? console.error(e) : r === Jc.levels.values.warn ? console.warn(e) : r === Jc.levels.values.debug ? console.debug(e) : r === Jc.levels.values.trace ? console.trace(e) : console.log(e); } appendToLogs(e) { - this.logs.append(Bo({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), log: e })); + this.logs.append($o({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), log: e })); const r = typeof e == "string" ? JSON.parse(e).level : e.level; r >= this.levelValue && this.forwardToConsole(e, r); } @@ -6265,18 +6265,18 @@ let Nk = class { return this.logs; } clearLogs() { - this.logs = new Z2(this.MAX_LOG_SIZE_IN_BYTES); + this.logs = new J2(this.MAX_LOG_SIZE_IN_BYTES); } getLogArray() { return Array.from(this.logs); } logsToBlob(e) { const r = this.getLogArray(); - return r.push(Bo({ extraMetadata: e })), new Blob(r, { type: "application/json" }); + return r.push($o({ extraMetadata: e })), new Blob(r, { type: "application/json" }); } -}, Lk = class { +}, kk = class { constructor(e, r = $v) { - this.baseChunkLogger = new P4(e, r); + this.baseChunkLogger = new S4(e, r); } write(e) { this.baseChunkLogger.appendToLogs(e); @@ -6297,9 +6297,9 @@ let Nk = class { const r = URL.createObjectURL(this.logsToBlob(e)), n = document.createElement("a"); n.href = r, n.download = `walletconnect-logs-${(/* @__PURE__ */ new Date()).toISOString()}.txt`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(r); } -}, kk = class { +}, $k = class { constructor(e, r = $v) { - this.baseChunkLogger = new P4(e, r); + this.baseChunkLogger = new S4(e, r); } write(e) { this.baseChunkLogger.appendToLogs(e); @@ -6317,103 +6317,103 @@ let Nk = class { return this.baseChunkLogger.logsToBlob(e); } }; -var $k = Object.defineProperty, Bk = Object.defineProperties, Fk = Object.getOwnPropertyDescriptors, Q2 = Object.getOwnPropertySymbols, jk = Object.prototype.hasOwnProperty, Uk = Object.prototype.propertyIsEnumerable, ex = (t, e, r) => e in t ? $k(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Jd = (t, e) => { - for (var r in e || (e = {})) jk.call(e, r) && ex(t, r, e[r]); - if (Q2) for (var r of Q2(e)) Uk.call(e, r) && ex(t, r, e[r]); +var Bk = Object.defineProperty, Fk = Object.defineProperties, jk = Object.getOwnPropertyDescriptors, X2 = Object.getOwnPropertySymbols, Uk = Object.prototype.hasOwnProperty, qk = Object.prototype.propertyIsEnumerable, Z2 = (t, e, r) => e in t ? Bk(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Jd = (t, e) => { + for (var r in e || (e = {})) Uk.call(e, r) && Z2(t, r, e[r]); + if (X2) for (var r of X2(e)) qk.call(e, r) && Z2(t, r, e[r]); return t; -}, Xd = (t, e) => Bk(t, Fk(e)); +}, Xd = (t, e) => Fk(t, jk(e)); function $0(t) { - return Xd(Jd({}, t), { level: (t == null ? void 0 : t.level) || Ok.level }); + return Xd(Jd({}, t), { level: (t == null ? void 0 : t.level) || Nk.level }); } -function qk(t, e = zl) { +function zk(t, e = zl) { return t[e] || ""; } -function zk(t, e, r = zl) { +function Wk(t, e, r = zl) { return t[r] = e, t; } -function Si(t, e = zl) { +function Ai(t, e = zl) { let r = ""; - return typeof t.bindings > "u" ? r = qk(t, e) : r = t.bindings().context || "", r; + return typeof t.bindings > "u" ? r = zk(t, e) : r = t.bindings().context || "", r; } -function Wk(t, e, r = zl) { - const n = Si(t, r); +function Hk(t, e, r = zl) { + const n = Ai(t, r); return n.trim() ? `${n}/${e}` : e; } function ci(t, e, r = zl) { - const n = Wk(t, e, r), i = t.child({ context: n }); - return zk(i, n, r); + const n = Hk(t, e, r), i = t.child({ context: n }); + return Wk(i, n, r); } -function Hk(t) { +function Kk(t) { var e, r; - const n = new Lk((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); + const n = new kk((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); return { logger: ql(Xd(Jd({}, t.opts), { level: "trace", browser: Xd(Jd({}, (r = t.opts) == null ? void 0 : r.browser), { write: (i) => n.write(i) }) })), chunkLoggerController: n }; } -function Kk(t) { +function Vk(t) { var e; - const r = new kk((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); + const r = new $k((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); return { logger: ql(Xd(Jd({}, t.opts), { level: "trace" }), r), chunkLoggerController: r }; } -function Vk(t) { - return typeof t.loggerOverride < "u" && typeof t.loggerOverride != "string" ? { logger: t.loggerOverride, chunkLoggerController: null } : typeof window < "u" ? Hk(t) : Kk(t); +function Gk(t) { + return typeof t.loggerOverride < "u" && typeof t.loggerOverride != "string" ? { logger: t.loggerOverride, chunkLoggerController: null } : typeof window < "u" ? Kk(t) : Vk(t); } -let Gk = class extends vc { +let Yk = class extends vc { constructor(e) { super(), this.opts = e, this.protocol = "wc", this.version = 2; } -}, Yk = class extends vc { +}, Jk = class extends vc { constructor(e, r) { super(), this.core = e, this.logger = r, this.records = /* @__PURE__ */ new Map(); } -}, Jk = class { +}, Xk = class { constructor(e, r) { this.logger = e, this.core = r; } -}, Xk = class extends vc { +}, Zk = class extends vc { constructor(e, r) { super(), this.relayer = e, this.logger = r; } -}, Zk = class extends vc { +}, Qk = class extends vc { constructor(e) { super(); } -}, Qk = class { +}, e$ = class { constructor(e, r, n, i) { this.core = e, this.logger = r, this.name = n; } -}, e$ = class extends vc { +}, t$ = class extends vc { constructor(e, r) { super(), this.relayer = e, this.logger = r; } -}, t$ = class extends vc { +}, r$ = class extends vc { constructor(e, r) { super(), this.core = e, this.logger = r; } -}, r$ = class { +}, n$ = class { constructor(e, r, n) { this.core = e, this.logger = r, this.store = n; } -}, n$ = class { +}, i$ = class { constructor(e, r) { this.projectId = e, this.logger = r; } -}, i$ = class { +}, s$ = class { constructor(e, r, n) { this.core = e, this.logger = r, this.telemetryEnabled = n; } -}, s$ = class { +}, o$ = class { constructor(e) { this.opts = e, this.protocol = "wc", this.version = 2; } -}, o$ = class { +}, a$ = class { constructor(e) { this.client = e; } }; -var Bv = {}, Ca = {}, B0 = {}, F0 = {}; +var Bv = {}, Pa = {}, B0 = {}, F0 = {}; Object.defineProperty(F0, "__esModule", { value: !0 }); F0.BrowserRandomSource = void 0; -const tx = 65536; -class a$ { +const Q2 = 65536; +class c$ { constructor() { this.isAvailable = !1, this.isInstantiated = !1; const e = typeof self < "u" ? self.crypto || self.msCrypto : null; @@ -6423,33 +6423,33 @@ class a$ { if (!this.isAvailable || !this._crypto) throw new Error("Browser random byte generator is not available."); const r = new Uint8Array(e); - for (let n = 0; n < r.length; n += tx) - this._crypto.getRandomValues(r.subarray(n, n + Math.min(r.length - n, tx))); + for (let n = 0; n < r.length; n += Q2) + this._crypto.getRandomValues(r.subarray(n, n + Math.min(r.length - n, Q2))); return r; } } -F0.BrowserRandomSource = a$; -function M4(t) { +F0.BrowserRandomSource = c$; +function A4(t) { throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } -var j0 = {}, $i = {}; -Object.defineProperty($i, "__esModule", { value: !0 }); -function c$(t) { +var j0 = {}, ki = {}; +Object.defineProperty(ki, "__esModule", { value: !0 }); +function u$(t) { for (var e = 0; e < t.length; e++) t[e] = 0; return t; } -$i.wipe = c$; -const u$ = {}, f$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +ki.wipe = u$; +const f$ = {}, l$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - default: u$ -}, Symbol.toStringTag, { value: "Module" })), Wl = /* @__PURE__ */ bv(f$); + default: f$ +}, Symbol.toStringTag, { value: "Module" })), Wl = /* @__PURE__ */ bv(l$); Object.defineProperty(j0, "__esModule", { value: !0 }); j0.NodeRandomSource = void 0; -const l$ = $i; -class h$ { +const h$ = ki; +class d$ { constructor() { - if (this.isAvailable = !1, this.isInstantiated = !1, typeof M4 < "u") { + if (this.isAvailable = !1, this.isInstantiated = !1, typeof A4 < "u") { const e = Wl; e && e.randomBytes && (this._crypto = e, this.isAvailable = !0, this.isInstantiated = !0); } @@ -6463,20 +6463,20 @@ class h$ { const n = new Uint8Array(e); for (let i = 0; i < n.length; i++) n[i] = r[i]; - return (0, l$.wipe)(r), n; + return (0, h$.wipe)(r), n; } } -j0.NodeRandomSource = h$; +j0.NodeRandomSource = d$; Object.defineProperty(B0, "__esModule", { value: !0 }); B0.SystemRandomSource = void 0; -const d$ = F0, p$ = j0; -class g$ { +const p$ = F0, g$ = j0; +class m$ { constructor() { - if (this.isAvailable = !1, this.name = "", this._source = new d$.BrowserRandomSource(), this._source.isAvailable) { + if (this.isAvailable = !1, this.name = "", this._source = new p$.BrowserRandomSource(), this._source.isAvailable) { this.isAvailable = !0, this.name = "Browser"; return; } - if (this._source = new p$.NodeRandomSource(), this._source.isAvailable) { + if (this._source = new g$.NodeRandomSource(), this._source.isAvailable) { this.isAvailable = !0, this.name = "Node"; return; } @@ -6487,8 +6487,8 @@ class g$ { return this._source.randomBytes(e); } } -B0.SystemRandomSource = g$; -var ar = {}, I4 = {}; +B0.SystemRandomSource = m$; +var ar = {}, P4 = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); function e(a, u) { @@ -6518,35 +6518,35 @@ var ar = {}, I4 = {}; t.isInteger = Number.isInteger || o, t.MAX_SAFE_INTEGER = 9007199254740991, t.isSafeInteger = function(a) { return t.isInteger(a) && a >= -t.MAX_SAFE_INTEGER && a <= t.MAX_SAFE_INTEGER; }; -})(I4); +})(P4); Object.defineProperty(ar, "__esModule", { value: !0 }); -var C4 = I4; -function m$(t, e) { +var M4 = P4; +function v$(t, e) { return e === void 0 && (e = 0), (t[e + 0] << 8 | t[e + 1]) << 16 >> 16; } -ar.readInt16BE = m$; -function v$(t, e) { +ar.readInt16BE = v$; +function b$(t, e) { return e === void 0 && (e = 0), (t[e + 0] << 8 | t[e + 1]) >>> 0; } -ar.readUint16BE = v$; -function b$(t, e) { +ar.readUint16BE = b$; +function y$(t, e) { return e === void 0 && (e = 0), (t[e + 1] << 8 | t[e]) << 16 >> 16; } -ar.readInt16LE = b$; -function y$(t, e) { +ar.readInt16LE = y$; +function w$(t, e) { return e === void 0 && (e = 0), (t[e + 1] << 8 | t[e]) >>> 0; } -ar.readUint16LE = y$; -function T4(t, e, r) { +ar.readUint16LE = w$; +function I4(t, e, r) { return e === void 0 && (e = new Uint8Array(2)), r === void 0 && (r = 0), e[r + 0] = t >>> 8, e[r + 1] = t >>> 0, e; } -ar.writeUint16BE = T4; -ar.writeInt16BE = T4; -function R4(t, e, r) { +ar.writeUint16BE = I4; +ar.writeInt16BE = I4; +function C4(t, e, r) { return e === void 0 && (e = new Uint8Array(2)), r === void 0 && (r = 0), e[r + 0] = t >>> 0, e[r + 1] = t >>> 8, e; } -ar.writeUint16LE = R4; -ar.writeInt16LE = R4; +ar.writeUint16LE = C4; +ar.writeInt16LE = C4; function d1(t, e) { return e === void 0 && (e = 0), t[e] << 24 | t[e + 1] << 16 | t[e + 2] << 8 | t[e + 3]; } @@ -6573,41 +6573,41 @@ function Qd(t, e, r) { } ar.writeUint32LE = Qd; ar.writeInt32LE = Qd; -function w$(t, e) { +function x$(t, e) { e === void 0 && (e = 0); var r = d1(t, e), n = d1(t, e + 4); return r * 4294967296 + n - (n >> 31) * 4294967296; } -ar.readInt64BE = w$; -function x$(t, e) { +ar.readInt64BE = x$; +function _$(t, e) { e === void 0 && (e = 0); var r = p1(t, e), n = p1(t, e + 4); return r * 4294967296 + n; } -ar.readUint64BE = x$; -function _$(t, e) { +ar.readUint64BE = _$; +function E$(t, e) { e === void 0 && (e = 0); var r = g1(t, e), n = g1(t, e + 4); return n * 4294967296 + r - (r >> 31) * 4294967296; } -ar.readInt64LE = _$; -function E$(t, e) { +ar.readInt64LE = E$; +function S$(t, e) { e === void 0 && (e = 0); var r = m1(t, e), n = m1(t, e + 4); return n * 4294967296 + r; } -ar.readUint64LE = E$; -function D4(t, e, r) { +ar.readUint64LE = S$; +function T4(t, e, r) { return e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0), Zd(t / 4294967296 >>> 0, e, r), Zd(t >>> 0, e, r + 4), e; } -ar.writeUint64BE = D4; -ar.writeInt64BE = D4; -function O4(t, e, r) { +ar.writeUint64BE = T4; +ar.writeInt64BE = T4; +function R4(t, e, r) { return e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0), Qd(t >>> 0, e, r), Qd(t / 4294967296 >>> 0, e, r + 4), e; } -ar.writeUint64LE = O4; -ar.writeInt64LE = O4; -function S$(t, e, r) { +ar.writeUint64LE = R4; +ar.writeInt64LE = R4; +function A$(t, e, r) { if (r === void 0 && (r = 0), t % 8 !== 0) throw new Error("readUintBE supports only bitLengths divisible by 8"); if (t / 8 > e.length - r) @@ -6616,8 +6616,8 @@ function S$(t, e, r) { n += e[s] * i, i *= 256; return n; } -ar.readUintBE = S$; -function A$(t, e, r) { +ar.readUintBE = A$; +function P$(t, e, r) { if (r === void 0 && (r = 0), t % 8 !== 0) throw new Error("readUintLE supports only bitLengths divisible by 8"); if (t / 8 > e.length - r) @@ -6626,78 +6626,78 @@ function A$(t, e, r) { n += e[s] * i, i *= 256; return n; } -ar.readUintLE = A$; -function P$(t, e, r, n) { +ar.readUintLE = P$; +function M$(t, e, r, n) { if (r === void 0 && (r = new Uint8Array(t / 8)), n === void 0 && (n = 0), t % 8 !== 0) throw new Error("writeUintBE supports only bitLengths divisible by 8"); - if (!C4.isSafeInteger(e)) + if (!M4.isSafeInteger(e)) throw new Error("writeUintBE value must be an integer"); for (var i = 1, s = t / 8 + n - 1; s >= n; s--) r[s] = e / i & 255, i *= 256; return r; } -ar.writeUintBE = P$; -function M$(t, e, r, n) { +ar.writeUintBE = M$; +function I$(t, e, r, n) { if (r === void 0 && (r = new Uint8Array(t / 8)), n === void 0 && (n = 0), t % 8 !== 0) throw new Error("writeUintLE supports only bitLengths divisible by 8"); - if (!C4.isSafeInteger(e)) + if (!M4.isSafeInteger(e)) throw new Error("writeUintLE value must be an integer"); for (var i = 1, s = n; s < n + t / 8; s++) r[s] = e / i & 255, i *= 256; return r; } -ar.writeUintLE = M$; -function I$(t, e) { +ar.writeUintLE = I$; +function C$(t, e) { e === void 0 && (e = 0); var r = new DataView(t.buffer, t.byteOffset, t.byteLength); return r.getFloat32(e); } -ar.readFloat32BE = I$; -function C$(t, e) { +ar.readFloat32BE = C$; +function T$(t, e) { e === void 0 && (e = 0); var r = new DataView(t.buffer, t.byteOffset, t.byteLength); return r.getFloat32(e, !0); } -ar.readFloat32LE = C$; -function T$(t, e) { +ar.readFloat32LE = T$; +function R$(t, e) { e === void 0 && (e = 0); var r = new DataView(t.buffer, t.byteOffset, t.byteLength); return r.getFloat64(e); } -ar.readFloat64BE = T$; -function R$(t, e) { +ar.readFloat64BE = R$; +function D$(t, e) { e === void 0 && (e = 0); var r = new DataView(t.buffer, t.byteOffset, t.byteLength); return r.getFloat64(e, !0); } -ar.readFloat64LE = R$; -function D$(t, e, r) { +ar.readFloat64LE = D$; +function O$(t, e, r) { e === void 0 && (e = new Uint8Array(4)), r === void 0 && (r = 0); var n = new DataView(e.buffer, e.byteOffset, e.byteLength); return n.setFloat32(r, t), e; } -ar.writeFloat32BE = D$; -function O$(t, e, r) { +ar.writeFloat32BE = O$; +function N$(t, e, r) { e === void 0 && (e = new Uint8Array(4)), r === void 0 && (r = 0); var n = new DataView(e.buffer, e.byteOffset, e.byteLength); return n.setFloat32(r, t, !0), e; } -ar.writeFloat32LE = O$; -function N$(t, e, r) { +ar.writeFloat32LE = N$; +function L$(t, e, r) { e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0); var n = new DataView(e.buffer, e.byteOffset, e.byteLength); return n.setFloat64(r, t), e; } -ar.writeFloat64BE = N$; -function L$(t, e, r) { +ar.writeFloat64BE = L$; +function k$(t, e, r) { e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0); var n = new DataView(e.buffer, e.byteOffset, e.byteLength); return n.setFloat64(r, t, !0), e; } -ar.writeFloat64LE = L$; +ar.writeFloat64LE = k$; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.randomStringForEntropy = t.randomString = t.randomUint32 = t.randomBytes = t.defaultRandomSource = void 0; - const e = B0, r = ar, n = $i; + const e = B0, r = ar, n = ki; t.defaultRandomSource = new e.SystemRandomSource(); function i(l, d = t.defaultRandomSource) { return d.randomBytes(l); @@ -6715,12 +6715,12 @@ ar.writeFloat64LE = L$; if (d.length > 256) throw new Error("randomString charset is too long"); let w = ""; - const A = d.length, P = 256 - 256 % A; + const A = d.length, M = 256 - 256 % A; for (; l > 0; ) { - const N = i(Math.ceil(l * 256 / P), p); + const N = i(Math.ceil(l * 256 / M), p); for (let L = 0; L < N.length && l > 0; L++) { - const $ = N[L]; - $ < P && (w += d.charAt($ % A), l--); + const B = N[L]; + B < M && (w += d.charAt(B % A), l--); } (0, n.wipe)(N); } @@ -6732,11 +6732,11 @@ ar.writeFloat64LE = L$; return a(w, d, p); } t.randomStringForEntropy = u; -})(Ca); -var N4 = {}; +})(Pa); +var D4 = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - var e = ar, r = $i; + var e = ar, r = ki; t.DIGEST_LENGTH = 64, t.BLOCK_SIZE = 128; var n = ( /** @class */ @@ -6766,12 +6766,12 @@ var N4 = {}; if (!this._finished) { var l = this._bytesHashed, d = this._bufferLength, p = l / 536870912 | 0, w = l << 3, A = l % 128 < 112 ? 128 : 256; this._buffer[d] = 128; - for (var P = d + 1; P < A - 8; P++) - this._buffer[P] = 0; + for (var M = d + 1; M < A - 8; M++) + this._buffer[M] = 0; e.writeUint32BE(p, this._buffer, A - 8), e.writeUint32BE(w, this._buffer, A - 4), s(this._tempHi, this._tempLo, this._stateHi, this._stateLo, this._buffer, 0, A), this._finished = !0; } - for (var P = 0; P < this.digestLength / 8; P++) - e.writeUint32BE(this._stateHi[P], u, P * 8), e.writeUint32BE(this._stateLo[P], u, P * 8 + 4); + for (var M = 0; M < this.digestLength / 8; M++) + e.writeUint32BE(this._stateHi[M], u, M * 8), e.writeUint32BE(this._stateLo[M], u, M * 8 + 4); return this; }, a.prototype.digest = function() { var u = new Uint8Array(this.digestLength); @@ -6957,18 +6957,18 @@ var N4 = {}; 1246189591 ]); function s(a, u, l, d, p, w, A) { - for (var P = l[0], N = l[1], L = l[2], $ = l[3], B = l[4], H = l[5], W = l[6], V = l[7], te = d[0], R = d[1], K = d[2], ge = d[3], Ee = d[4], Y = d[5], S = d[6], m = d[7], f, g, b, x, _, E, v, M; A >= 128; ) { + for (var M = l[0], N = l[1], L = l[2], B = l[3], $ = l[4], H = l[5], W = l[6], V = l[7], te = d[0], R = d[1], K = d[2], ge = d[3], Ee = d[4], Y = d[5], S = d[6], m = d[7], f, g, b, x, _, E, v, P; A >= 128; ) { for (var I = 0; I < 16; I++) { var F = 8 * I + w; a[I] = e.readUint32BE(p, F), u[I] = e.readUint32BE(p, F + 4); } for (var I = 0; I < 80; I++) { - var ce = P, D = N, oe = L, Z = $, J = B, Q = H, T = W, X = V, re = te, pe = R, ie = K, ue = ge, ve = Ee, Pe = Y, De = S, Ce = m; - if (f = V, g = m, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = (B >>> 14 | Ee << 18) ^ (B >>> 18 | Ee << 14) ^ (Ee >>> 9 | B << 23), g = (Ee >>> 14 | B << 18) ^ (Ee >>> 18 | B << 14) ^ (B >>> 9 | Ee << 23), _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, f = B & H ^ ~B & W, g = Ee & Y ^ ~Ee & S, _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, f = i[I * 2], g = i[I * 2 + 1], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, f = a[I % 16], g = u[I % 16], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, b = v & 65535 | M << 16, x = _ & 65535 | E << 16, f = b, g = x, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = (P >>> 28 | te << 4) ^ (te >>> 2 | P << 30) ^ (te >>> 7 | P << 25), g = (te >>> 28 | P << 4) ^ (P >>> 2 | te << 30) ^ (P >>> 7 | te << 25), _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, f = P & N ^ P & L ^ N & L, g = te & R ^ te & K ^ R & K, _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, X = v & 65535 | M << 16, Ce = _ & 65535 | E << 16, f = Z, g = ue, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = b, g = x, _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, Z = v & 65535 | M << 16, ue = _ & 65535 | E << 16, N = ce, L = D, $ = oe, B = Z, H = J, W = Q, V = T, P = X, R = re, K = pe, ge = ie, Ee = ue, Y = ve, S = Pe, m = De, te = Ce, I % 16 === 15) + var ce = M, D = N, oe = L, Z = B, J = $, Q = H, T = W, X = V, re = te, de = R, ie = K, ue = ge, ve = Ee, Pe = Y, De = S, Ce = m; + if (f = V, g = m, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = ($ >>> 14 | Ee << 18) ^ ($ >>> 18 | Ee << 14) ^ (Ee >>> 9 | $ << 23), g = (Ee >>> 14 | $ << 18) ^ (Ee >>> 18 | $ << 14) ^ ($ >>> 9 | Ee << 23), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = $ & H ^ ~$ & W, g = Ee & Y ^ ~Ee & S, _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = i[I * 2], g = i[I * 2 + 1], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = a[I % 16], g = u[I % 16], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, b = v & 65535 | P << 16, x = _ & 65535 | E << 16, f = b, g = x, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = (M >>> 28 | te << 4) ^ (te >>> 2 | M << 30) ^ (te >>> 7 | M << 25), g = (te >>> 28 | M << 4) ^ (M >>> 2 | te << 30) ^ (M >>> 7 | te << 25), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = M & N ^ M & L ^ N & L, g = te & R ^ te & K ^ R & K, _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, X = v & 65535 | P << 16, Ce = _ & 65535 | E << 16, f = Z, g = ue, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = b, g = x, _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, Z = v & 65535 | P << 16, ue = _ & 65535 | E << 16, N = ce, L = D, B = oe, $ = Z, H = J, W = Q, V = T, M = X, R = re, K = de, ge = ie, Ee = ue, Y = ve, S = Pe, m = De, te = Ce, I % 16 === 15) for (var F = 0; F < 16; F++) - f = a[F], g = u[F], _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = a[(F + 9) % 16], g = u[(F + 9) % 16], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, b = a[(F + 1) % 16], x = u[(F + 1) % 16], f = (b >>> 1 | x << 31) ^ (b >>> 8 | x << 24) ^ b >>> 7, g = (x >>> 1 | b << 31) ^ (x >>> 8 | b << 24) ^ (x >>> 7 | b << 25), _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, b = a[(F + 14) % 16], x = u[(F + 14) % 16], f = (b >>> 19 | x << 13) ^ (x >>> 29 | b << 3) ^ b >>> 6, g = (x >>> 19 | b << 13) ^ (b >>> 29 | x << 3) ^ (x >>> 6 | b << 26), _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, a[F] = v & 65535 | M << 16, u[F] = _ & 65535 | E << 16; + f = a[F], g = u[F], _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = a[(F + 9) % 16], g = u[(F + 9) % 16], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, b = a[(F + 1) % 16], x = u[(F + 1) % 16], f = (b >>> 1 | x << 31) ^ (b >>> 8 | x << 24) ^ b >>> 7, g = (x >>> 1 | b << 31) ^ (x >>> 8 | b << 24) ^ (x >>> 7 | b << 25), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, b = a[(F + 14) % 16], x = u[(F + 14) % 16], f = (b >>> 19 | x << 13) ^ (x >>> 29 | b << 3) ^ b >>> 6, g = (x >>> 19 | b << 13) ^ (b >>> 29 | x << 3) ^ (x >>> 6 | b << 26), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, a[F] = v & 65535 | P << 16, u[F] = _ & 65535 | E << 16; } - f = P, g = te, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = l[0], g = d[0], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, l[0] = P = v & 65535 | M << 16, d[0] = te = _ & 65535 | E << 16, f = N, g = R, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = l[1], g = d[1], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, l[1] = N = v & 65535 | M << 16, d[1] = R = _ & 65535 | E << 16, f = L, g = K, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = l[2], g = d[2], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, l[2] = L = v & 65535 | M << 16, d[2] = K = _ & 65535 | E << 16, f = $, g = ge, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = l[3], g = d[3], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, l[3] = $ = v & 65535 | M << 16, d[3] = ge = _ & 65535 | E << 16, f = B, g = Ee, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = l[4], g = d[4], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, l[4] = B = v & 65535 | M << 16, d[4] = Ee = _ & 65535 | E << 16, f = H, g = Y, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = l[5], g = d[5], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, l[5] = H = v & 65535 | M << 16, d[5] = Y = _ & 65535 | E << 16, f = W, g = S, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = l[6], g = d[6], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, l[6] = W = v & 65535 | M << 16, d[6] = S = _ & 65535 | E << 16, f = V, g = m, _ = g & 65535, E = g >>> 16, v = f & 65535, M = f >>> 16, f = l[7], g = d[7], _ += g & 65535, E += g >>> 16, v += f & 65535, M += f >>> 16, E += _ >>> 16, v += E >>> 16, M += v >>> 16, l[7] = V = v & 65535 | M << 16, d[7] = m = _ & 65535 | E << 16, w += 128, A -= 128; + f = M, g = te, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[0], g = d[0], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[0] = M = v & 65535 | P << 16, d[0] = te = _ & 65535 | E << 16, f = N, g = R, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[1], g = d[1], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[1] = N = v & 65535 | P << 16, d[1] = R = _ & 65535 | E << 16, f = L, g = K, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[2], g = d[2], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[2] = L = v & 65535 | P << 16, d[2] = K = _ & 65535 | E << 16, f = B, g = ge, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[3], g = d[3], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[3] = B = v & 65535 | P << 16, d[3] = ge = _ & 65535 | E << 16, f = $, g = Ee, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[4], g = d[4], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[4] = $ = v & 65535 | P << 16, d[4] = Ee = _ & 65535 | E << 16, f = H, g = Y, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[5], g = d[5], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[5] = H = v & 65535 | P << 16, d[5] = Y = _ & 65535 | E << 16, f = W, g = S, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[6], g = d[6], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[6] = W = v & 65535 | P << 16, d[6] = S = _ & 65535 | E << 16, f = V, g = m, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[7], g = d[7], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[7] = V = v & 65535 | P << 16, d[7] = m = _ & 65535 | E << 16, w += 128, A -= 128; } return w; } @@ -6979,10 +6979,10 @@ var N4 = {}; return u.clean(), l; } t.hash = o; -})(N4); +})(D4); (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.convertSecretKeyToX25519 = t.convertPublicKeyToX25519 = t.verify = t.sign = t.extractPublicKeyFromSecretKey = t.generateKeyPair = t.generateKeyPairFromSeed = t.SEED_LENGTH = t.SECRET_KEY_LENGTH = t.PUBLIC_KEY_LENGTH = t.SIGNATURE_LENGTH = void 0; - const e = Ca, r = N4, n = $i; + const e = Pa, r = D4, n = ki; t.SIGNATURE_LENGTH = 64, t.PUBLIC_KEY_LENGTH = 32, t.SECRET_KEY_LENGTH = 64, t.SEED_LENGTH = 32; function i(Z) { const J = new Float64Array(16); @@ -7083,7 +7083,7 @@ var N4 = {}; for (let Q = 0; Q < 16; Q++) Z[Q] = J[Q] | 0; } - function P(Z) { + function M(Z) { let J = 1; for (let Q = 0; Q < 16; Q++) { let T = Z[Q] + J + 65535; @@ -7102,11 +7102,11 @@ var N4 = {}; const Q = i(), T = i(); for (let X = 0; X < 16; X++) T[X] = J[X]; - P(T), P(T), P(T); + M(T), M(T), M(T); for (let X = 0; X < 2; X++) { Q[0] = T[0] - 65517; - for (let pe = 1; pe < 15; pe++) - Q[pe] = T[pe] - 65535 - (Q[pe - 1] >> 16 & 1), Q[pe - 1] &= 65535; + for (let de = 1; de < 15; de++) + Q[de] = T[de] - 65535 - (Q[de - 1] >> 16 & 1), Q[de - 1] &= 65535; Q[15] = T[15] - 32767 - (Q[14] >> 16 & 1); const re = Q[15] >> 16 & 1; Q[14] &= 65535, N(T, Q, 1 - re); @@ -7114,15 +7114,15 @@ var N4 = {}; for (let X = 0; X < 16; X++) Z[2 * X] = T[X] & 255, Z[2 * X + 1] = T[X] >> 8; } - function $(Z, J) { + function B(Z, J) { let Q = 0; for (let T = 0; T < 32; T++) Q |= Z[T] ^ J[T]; return (1 & Q - 1 >>> 8) - 1; } - function B(Z, J) { + function $(Z, J) { const Q = new Uint8Array(32), T = new Uint8Array(32); - return L(Q, Z), L(T, J), $(Q, T); + return L(Q, Z), L(T, J), B(Q, T); } function H(Z) { const J = new Uint8Array(32); @@ -7142,8 +7142,8 @@ var N4 = {}; Z[T] = J[T] - Q[T]; } function R(Z, J, Q) { - let T, X, re = 0, pe = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = 0, Me = 0, Ne = 0, Ke = 0, Le = 0, qe = 0, ze = 0, _e = 0, Ze = 0, at = 0, ke = 0, Qe = 0, tt = 0, Ye = 0, dt = 0, lt = 0, ct = 0, qt = 0, Jt = 0, Et = 0, er = 0, Xt = 0, Dt = 0, kt = Q[0], Ct = Q[1], gt = Q[2], Rt = Q[3], Nt = Q[4], vt = Q[5], $t = Q[6], Ft = Q[7], rt = Q[8], Bt = Q[9], k = Q[10], U = Q[11], z = Q[12], C = Q[13], G = Q[14], j = Q[15]; - T = J[0], re += T * kt, pe += T * Ct, ie += T * gt, ue += T * Rt, ve += T * Nt, Pe += T * vt, De += T * $t, Ce += T * Ft, $e += T * rt, Me += T * Bt, Ne += T * k, Ke += T * U, Le += T * z, qe += T * C, ze += T * G, _e += T * j, T = J[1], pe += T * kt, ie += T * Ct, ue += T * gt, ve += T * Rt, Pe += T * Nt, De += T * vt, Ce += T * $t, $e += T * Ft, Me += T * rt, Ne += T * Bt, Ke += T * k, Le += T * U, qe += T * z, ze += T * C, _e += T * G, Ze += T * j, T = J[2], ie += T * kt, ue += T * Ct, ve += T * gt, Pe += T * Rt, De += T * Nt, Ce += T * vt, $e += T * $t, Me += T * Ft, Ne += T * rt, Ke += T * Bt, Le += T * k, qe += T * U, ze += T * z, _e += T * C, Ze += T * G, at += T * j, T = J[3], ue += T * kt, ve += T * Ct, Pe += T * gt, De += T * Rt, Ce += T * Nt, $e += T * vt, Me += T * $t, Ne += T * Ft, Ke += T * rt, Le += T * Bt, qe += T * k, ze += T * U, _e += T * z, Ze += T * C, at += T * G, ke += T * j, T = J[4], ve += T * kt, Pe += T * Ct, De += T * gt, Ce += T * Rt, $e += T * Nt, Me += T * vt, Ne += T * $t, Ke += T * Ft, Le += T * rt, qe += T * Bt, ze += T * k, _e += T * U, Ze += T * z, at += T * C, ke += T * G, Qe += T * j, T = J[5], Pe += T * kt, De += T * Ct, Ce += T * gt, $e += T * Rt, Me += T * Nt, Ne += T * vt, Ke += T * $t, Le += T * Ft, qe += T * rt, ze += T * Bt, _e += T * k, Ze += T * U, at += T * z, ke += T * C, Qe += T * G, tt += T * j, T = J[6], De += T * kt, Ce += T * Ct, $e += T * gt, Me += T * Rt, Ne += T * Nt, Ke += T * vt, Le += T * $t, qe += T * Ft, ze += T * rt, _e += T * Bt, Ze += T * k, at += T * U, ke += T * z, Qe += T * C, tt += T * G, Ye += T * j, T = J[7], Ce += T * kt, $e += T * Ct, Me += T * gt, Ne += T * Rt, Ke += T * Nt, Le += T * vt, qe += T * $t, ze += T * Ft, _e += T * rt, Ze += T * Bt, at += T * k, ke += T * U, Qe += T * z, tt += T * C, Ye += T * G, dt += T * j, T = J[8], $e += T * kt, Me += T * Ct, Ne += T * gt, Ke += T * Rt, Le += T * Nt, qe += T * vt, ze += T * $t, _e += T * Ft, Ze += T * rt, at += T * Bt, ke += T * k, Qe += T * U, tt += T * z, Ye += T * C, dt += T * G, lt += T * j, T = J[9], Me += T * kt, Ne += T * Ct, Ke += T * gt, Le += T * Rt, qe += T * Nt, ze += T * vt, _e += T * $t, Ze += T * Ft, at += T * rt, ke += T * Bt, Qe += T * k, tt += T * U, Ye += T * z, dt += T * C, lt += T * G, ct += T * j, T = J[10], Ne += T * kt, Ke += T * Ct, Le += T * gt, qe += T * Rt, ze += T * Nt, _e += T * vt, Ze += T * $t, at += T * Ft, ke += T * rt, Qe += T * Bt, tt += T * k, Ye += T * U, dt += T * z, lt += T * C, ct += T * G, qt += T * j, T = J[11], Ke += T * kt, Le += T * Ct, qe += T * gt, ze += T * Rt, _e += T * Nt, Ze += T * vt, at += T * $t, ke += T * Ft, Qe += T * rt, tt += T * Bt, Ye += T * k, dt += T * U, lt += T * z, ct += T * C, qt += T * G, Jt += T * j, T = J[12], Le += T * kt, qe += T * Ct, ze += T * gt, _e += T * Rt, Ze += T * Nt, at += T * vt, ke += T * $t, Qe += T * Ft, tt += T * rt, Ye += T * Bt, dt += T * k, lt += T * U, ct += T * z, qt += T * C, Jt += T * G, Et += T * j, T = J[13], qe += T * kt, ze += T * Ct, _e += T * gt, Ze += T * Rt, at += T * Nt, ke += T * vt, Qe += T * $t, tt += T * Ft, Ye += T * rt, dt += T * Bt, lt += T * k, ct += T * U, qt += T * z, Jt += T * C, Et += T * G, er += T * j, T = J[14], ze += T * kt, _e += T * Ct, Ze += T * gt, at += T * Rt, ke += T * Nt, Qe += T * vt, tt += T * $t, Ye += T * Ft, dt += T * rt, lt += T * Bt, ct += T * k, qt += T * U, Jt += T * z, Et += T * C, er += T * G, Xt += T * j, T = J[15], _e += T * kt, Ze += T * Ct, at += T * gt, ke += T * Rt, Qe += T * Nt, tt += T * vt, Ye += T * $t, dt += T * Ft, lt += T * rt, ct += T * Bt, qt += T * k, Jt += T * U, Et += T * z, er += T * C, Xt += T * G, Dt += T * j, re += 38 * Ze, pe += 38 * at, ie += 38 * ke, ue += 38 * Qe, ve += 38 * tt, Pe += 38 * Ye, De += 38 * dt, Ce += 38 * lt, $e += 38 * ct, Me += 38 * qt, Ne += 38 * Jt, Ke += 38 * Et, Le += 38 * er, qe += 38 * Xt, ze += 38 * Dt, X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = pe + X + 65535, X = Math.floor(T / 65536), pe = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = pe + X + 65535, X = Math.floor(T / 65536), pe = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), Z[0] = re, Z[1] = pe, Z[2] = ie, Z[3] = ue, Z[4] = ve, Z[5] = Pe, Z[6] = De, Z[7] = Ce, Z[8] = $e, Z[9] = Me, Z[10] = Ne, Z[11] = Ke, Z[12] = Le, Z[13] = qe, Z[14] = ze, Z[15] = _e; + let T, X, re = 0, de = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = 0, Me = 0, Ne = 0, Ke = 0, Le = 0, qe = 0, ze = 0, _e = 0, Ze = 0, at = 0, ke = 0, Qe = 0, tt = 0, Ye = 0, dt = 0, lt = 0, ct = 0, qt = 0, Yt = 0, Et = 0, er = 0, Jt = 0, Dt = 0, kt = Q[0], Ct = Q[1], gt = Q[2], Rt = Q[3], Nt = Q[4], vt = Q[5], $t = Q[6], Ft = Q[7], rt = Q[8], Bt = Q[9], k = Q[10], U = Q[11], z = Q[12], C = Q[13], G = Q[14], j = Q[15]; + T = J[0], re += T * kt, de += T * Ct, ie += T * gt, ue += T * Rt, ve += T * Nt, Pe += T * vt, De += T * $t, Ce += T * Ft, $e += T * rt, Me += T * Bt, Ne += T * k, Ke += T * U, Le += T * z, qe += T * C, ze += T * G, _e += T * j, T = J[1], de += T * kt, ie += T * Ct, ue += T * gt, ve += T * Rt, Pe += T * Nt, De += T * vt, Ce += T * $t, $e += T * Ft, Me += T * rt, Ne += T * Bt, Ke += T * k, Le += T * U, qe += T * z, ze += T * C, _e += T * G, Ze += T * j, T = J[2], ie += T * kt, ue += T * Ct, ve += T * gt, Pe += T * Rt, De += T * Nt, Ce += T * vt, $e += T * $t, Me += T * Ft, Ne += T * rt, Ke += T * Bt, Le += T * k, qe += T * U, ze += T * z, _e += T * C, Ze += T * G, at += T * j, T = J[3], ue += T * kt, ve += T * Ct, Pe += T * gt, De += T * Rt, Ce += T * Nt, $e += T * vt, Me += T * $t, Ne += T * Ft, Ke += T * rt, Le += T * Bt, qe += T * k, ze += T * U, _e += T * z, Ze += T * C, at += T * G, ke += T * j, T = J[4], ve += T * kt, Pe += T * Ct, De += T * gt, Ce += T * Rt, $e += T * Nt, Me += T * vt, Ne += T * $t, Ke += T * Ft, Le += T * rt, qe += T * Bt, ze += T * k, _e += T * U, Ze += T * z, at += T * C, ke += T * G, Qe += T * j, T = J[5], Pe += T * kt, De += T * Ct, Ce += T * gt, $e += T * Rt, Me += T * Nt, Ne += T * vt, Ke += T * $t, Le += T * Ft, qe += T * rt, ze += T * Bt, _e += T * k, Ze += T * U, at += T * z, ke += T * C, Qe += T * G, tt += T * j, T = J[6], De += T * kt, Ce += T * Ct, $e += T * gt, Me += T * Rt, Ne += T * Nt, Ke += T * vt, Le += T * $t, qe += T * Ft, ze += T * rt, _e += T * Bt, Ze += T * k, at += T * U, ke += T * z, Qe += T * C, tt += T * G, Ye += T * j, T = J[7], Ce += T * kt, $e += T * Ct, Me += T * gt, Ne += T * Rt, Ke += T * Nt, Le += T * vt, qe += T * $t, ze += T * Ft, _e += T * rt, Ze += T * Bt, at += T * k, ke += T * U, Qe += T * z, tt += T * C, Ye += T * G, dt += T * j, T = J[8], $e += T * kt, Me += T * Ct, Ne += T * gt, Ke += T * Rt, Le += T * Nt, qe += T * vt, ze += T * $t, _e += T * Ft, Ze += T * rt, at += T * Bt, ke += T * k, Qe += T * U, tt += T * z, Ye += T * C, dt += T * G, lt += T * j, T = J[9], Me += T * kt, Ne += T * Ct, Ke += T * gt, Le += T * Rt, qe += T * Nt, ze += T * vt, _e += T * $t, Ze += T * Ft, at += T * rt, ke += T * Bt, Qe += T * k, tt += T * U, Ye += T * z, dt += T * C, lt += T * G, ct += T * j, T = J[10], Ne += T * kt, Ke += T * Ct, Le += T * gt, qe += T * Rt, ze += T * Nt, _e += T * vt, Ze += T * $t, at += T * Ft, ke += T * rt, Qe += T * Bt, tt += T * k, Ye += T * U, dt += T * z, lt += T * C, ct += T * G, qt += T * j, T = J[11], Ke += T * kt, Le += T * Ct, qe += T * gt, ze += T * Rt, _e += T * Nt, Ze += T * vt, at += T * $t, ke += T * Ft, Qe += T * rt, tt += T * Bt, Ye += T * k, dt += T * U, lt += T * z, ct += T * C, qt += T * G, Yt += T * j, T = J[12], Le += T * kt, qe += T * Ct, ze += T * gt, _e += T * Rt, Ze += T * Nt, at += T * vt, ke += T * $t, Qe += T * Ft, tt += T * rt, Ye += T * Bt, dt += T * k, lt += T * U, ct += T * z, qt += T * C, Yt += T * G, Et += T * j, T = J[13], qe += T * kt, ze += T * Ct, _e += T * gt, Ze += T * Rt, at += T * Nt, ke += T * vt, Qe += T * $t, tt += T * Ft, Ye += T * rt, dt += T * Bt, lt += T * k, ct += T * U, qt += T * z, Yt += T * C, Et += T * G, er += T * j, T = J[14], ze += T * kt, _e += T * Ct, Ze += T * gt, at += T * Rt, ke += T * Nt, Qe += T * vt, tt += T * $t, Ye += T * Ft, dt += T * rt, lt += T * Bt, ct += T * k, qt += T * U, Yt += T * z, Et += T * C, er += T * G, Jt += T * j, T = J[15], _e += T * kt, Ze += T * Ct, at += T * gt, ke += T * Rt, Qe += T * Nt, tt += T * vt, Ye += T * $t, dt += T * Ft, lt += T * rt, ct += T * Bt, qt += T * k, Yt += T * U, Et += T * z, er += T * C, Jt += T * G, Dt += T * j, re += 38 * Ze, de += 38 * at, ie += 38 * ke, ue += 38 * Qe, ve += 38 * tt, Pe += 38 * Ye, De += 38 * dt, Ce += 38 * lt, $e += 38 * ct, Me += 38 * qt, Ne += 38 * Yt, Ke += 38 * Et, Le += 38 * er, qe += 38 * Jt, ze += 38 * Dt, X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = de + X + 65535, X = Math.floor(T / 65536), de = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = de + X + 65535, X = Math.floor(T / 65536), de = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), Z[0] = re, Z[1] = de, Z[2] = ie, Z[3] = ue, Z[4] = ve, Z[5] = Pe, Z[6] = De, Z[7] = Ce, Z[8] = $e, Z[9] = Me, Z[10] = Ne, Z[11] = Ke, Z[12] = Le, Z[13] = qe, Z[14] = ze, Z[15] = _e; } function K(Z, J) { R(Z, J, J); @@ -7169,8 +7169,8 @@ var N4 = {}; Z[T] = Q[T]; } function Y(Z, J) { - const Q = i(), T = i(), X = i(), re = i(), pe = i(), ie = i(), ue = i(), ve = i(), Pe = i(); - te(Q, Z[1], Z[0]), te(Pe, J[1], J[0]), R(Q, Q, Pe), V(T, Z[0], Z[1]), V(Pe, J[0], J[1]), R(T, T, Pe), R(X, Z[3], J[3]), R(X, X, l), R(re, Z[2], J[2]), V(re, re, re), te(pe, T, Q), te(ie, re, X), V(ue, re, X), V(ve, T, Q), R(Z[0], pe, ie), R(Z[1], ve, ue), R(Z[2], ue, ie), R(Z[3], pe, ve); + const Q = i(), T = i(), X = i(), re = i(), de = i(), ie = i(), ue = i(), ve = i(), Pe = i(); + te(Q, Z[1], Z[0]), te(Pe, J[1], J[0]), R(Q, Q, Pe), V(T, Z[0], Z[1]), V(Pe, J[0], J[1]), R(T, T, Pe), R(X, Z[3], J[3]), R(X, X, l), R(re, Z[2], J[2]), V(re, re, re), te(de, T, Q), te(ie, re, X), V(ue, re, X), V(ve, T, Q), R(Z[0], de, ie), R(Z[1], ve, ue), R(Z[2], ue, ie), R(Z[3], de, ve); } function S(Z, J, Q) { for (let T = 0; T < 4; T++) @@ -7264,7 +7264,7 @@ var N4 = {}; for (T = 0; T < 32; T++) J[T + 1] += J[T] >> 8, Z[T] = J[T] & 255; } - function M(Z) { + function P(Z) { const J = new Float64Array(64); for (let Q = 0; Q < 64; Q++) J[Q] = Z[Q]; @@ -7277,12 +7277,12 @@ var N4 = {}; X[0] &= 248, X[31] &= 127, X[31] |= 64; const re = new Uint8Array(64); re.set(X.subarray(32), 32); - const pe = new r.SHA512(); - pe.update(re.subarray(32)), pe.update(J); - const ie = pe.digest(); - pe.clean(), M(ie), g(T, ie), m(re, T), pe.reset(), pe.update(re.subarray(0, 32)), pe.update(Z.subarray(32)), pe.update(J); - const ue = pe.digest(); - M(ue); + const de = new r.SHA512(); + de.update(re.subarray(32)), de.update(J); + const ie = de.digest(); + de.clean(), P(ie), g(T, ie), m(re, T), de.reset(), de.update(re.subarray(0, 32)), de.update(Z.subarray(32)), de.update(J); + const ue = de.digest(); + P(ue); for (let ve = 0; ve < 32; ve++) Q[ve] = ie[ve]; for (let ve = 0; ve < 32; ve++) @@ -7292,8 +7292,8 @@ var N4 = {}; } t.sign = I; function F(Z, J) { - const Q = i(), T = i(), X = i(), re = i(), pe = i(), ie = i(), ue = i(); - return A(Z[2], a), W(Z[1], J), K(X, Z[1]), R(re, X, u), te(X, X, Z[2]), V(re, Z[2], re), K(pe, re), K(ie, pe), R(ue, ie, pe), R(Q, ue, X), R(Q, Q, re), Ee(Q, Q), R(Q, Q, X), R(Q, Q, re), R(Q, Q, re), R(Z[0], Q, re), K(T, Z[0]), R(T, T, re), B(T, X) && R(Z[0], Z[0], w), K(T, Z[0]), R(T, T, re), B(T, X) ? -1 : (H(Z[0]) === J[31] >> 7 && te(Z[0], o, Z[0]), R(Z[3], Z[0], Z[1]), 0); + const Q = i(), T = i(), X = i(), re = i(), de = i(), ie = i(), ue = i(); + return A(Z[2], a), W(Z[1], J), K(X, Z[1]), R(re, X, u), te(X, X, Z[2]), V(re, Z[2], re), K(de, re), K(ie, de), R(ue, ie, de), R(Q, ue, X), R(Q, Q, re), Ee(Q, Q), R(Q, Q, X), R(Q, Q, re), R(Q, Q, re), R(Z[0], Q, re), K(T, Z[0]), R(T, T, re), $(T, X) && R(Z[0], Z[0], w), K(T, Z[0]), R(T, T, re), $(T, X) ? -1 : (H(Z[0]) === J[31] >> 7 && te(Z[0], o, Z[0]), R(Z[3], Z[0], Z[1]), 0); } function ce(Z, J, Q) { const T = new Uint8Array(32), X = [i(), i(), i(), i()], re = [i(), i(), i(), i()]; @@ -7301,10 +7301,10 @@ var N4 = {}; throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`); if (F(re, Z)) return !1; - const pe = new r.SHA512(); - pe.update(Q.subarray(0, 32)), pe.update(Z), pe.update(J); - const ie = pe.digest(); - return M(ie), f(X, re, ie), g(re, Q.subarray(32)), Y(X, re), m(T, X), !$(Q, T); + const de = new r.SHA512(); + de.update(Q.subarray(0, 32)), de.update(Z), de.update(J); + const ie = de.digest(); + return P(ie), f(X, re, ie), g(re, Q.subarray(32)), Y(X, re), m(T, X), !B(Q, T); } t.verify = ce; function D(Z) { @@ -7325,19 +7325,19 @@ var N4 = {}; } t.convertSecretKeyToX25519 = oe; })(Bv); -const k$ = "EdDSA", $$ = "JWT", e0 = ".", U0 = "base64url", L4 = "utf8", k4 = "utf8", B$ = ":", F$ = "did", j$ = "key", rx = "base58btc", U$ = "z", q$ = "K36", z$ = 32; -function $4(t = 0) { +const $$ = "EdDSA", B$ = "JWT", e0 = ".", U0 = "base64url", O4 = "utf8", N4 = "utf8", F$ = ":", j$ = "did", U$ = "key", ex = "base58btc", q$ = "z", z$ = "K36", W$ = 32; +function L4(t = 0) { return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); } function Sd(t, e) { e || (e = t.reduce((i, s) => i + s.length, 0)); - const r = $4(e); + const r = L4(e); let n = 0; for (const i of t) r.set(i, n), n += i.length; return r; } -function W$(t, e) { +function H$(t, e) { if (t.length >= 255) throw new TypeError("Alphabet too long"); for (var r = new Uint8Array(256), n = 0; n < r.length; n++) @@ -7349,19 +7349,19 @@ function W$(t, e) { r[o] = i; } var a = t.length, u = t.charAt(0), l = Math.log(a) / Math.log(256), d = Math.log(256) / Math.log(a); - function p(P) { - if (P instanceof Uint8Array || (ArrayBuffer.isView(P) ? P = new Uint8Array(P.buffer, P.byteOffset, P.byteLength) : Array.isArray(P) && (P = Uint8Array.from(P))), !(P instanceof Uint8Array)) + function p(M) { + if (M instanceof Uint8Array || (ArrayBuffer.isView(M) ? M = new Uint8Array(M.buffer, M.byteOffset, M.byteLength) : Array.isArray(M) && (M = Uint8Array.from(M))), !(M instanceof Uint8Array)) throw new TypeError("Expected Uint8Array"); - if (P.length === 0) + if (M.length === 0) return ""; - for (var N = 0, L = 0, $ = 0, B = P.length; $ !== B && P[$] === 0; ) - $++, N++; - for (var H = (B - $) * d + 1 >>> 0, W = new Uint8Array(H); $ !== B; ) { - for (var V = P[$], te = 0, R = H - 1; (V !== 0 || te < L) && R !== -1; R--, te++) + for (var N = 0, L = 0, B = 0, $ = M.length; B !== $ && M[B] === 0; ) + B++, N++; + for (var H = ($ - B) * d + 1 >>> 0, W = new Uint8Array(H); B !== $; ) { + for (var V = M[B], te = 0, R = H - 1; (V !== 0 || te < L) && R !== -1; R--, te++) V += 256 * W[R] >>> 0, W[R] = V % a >>> 0, V = V / a >>> 0; if (V !== 0) throw new Error("Non-zero carry"); - L = te, $++; + L = te, B++; } for (var K = H - L; K !== H && W[K] === 0; ) K++; @@ -7369,36 +7369,36 @@ function W$(t, e) { ge += t.charAt(W[K]); return ge; } - function w(P) { - if (typeof P != "string") + function w(M) { + if (typeof M != "string") throw new TypeError("Expected String"); - if (P.length === 0) + if (M.length === 0) return new Uint8Array(); var N = 0; - if (P[N] !== " ") { - for (var L = 0, $ = 0; P[N] === u; ) + if (M[N] !== " ") { + for (var L = 0, B = 0; M[N] === u; ) L++, N++; - for (var B = (P.length - N) * l + 1 >>> 0, H = new Uint8Array(B); P[N]; ) { - var W = r[P.charCodeAt(N)]; + for (var $ = (M.length - N) * l + 1 >>> 0, H = new Uint8Array($); M[N]; ) { + var W = r[M.charCodeAt(N)]; if (W === 255) return; - for (var V = 0, te = B - 1; (W !== 0 || V < $) && te !== -1; te--, V++) + for (var V = 0, te = $ - 1; (W !== 0 || V < B) && te !== -1; te--, V++) W += a * H[te] >>> 0, H[te] = W % 256 >>> 0, W = W / 256 >>> 0; if (W !== 0) throw new Error("Non-zero carry"); - $ = V, N++; + B = V, N++; } - if (P[N] !== " ") { - for (var R = B - $; R !== B && H[R] === 0; ) + if (M[N] !== " ") { + for (var R = $ - B; R !== $ && H[R] === 0; ) R++; - for (var K = new Uint8Array(L + (B - R)), ge = L; R !== B; ) + for (var K = new Uint8Array(L + ($ - R)), ge = L; R !== $; ) K[ge++] = H[R++]; return K; } } } - function A(P) { - var N = w(P); + function A(M) { + var N = w(M); if (N) return N; throw new Error(`Non-${e} character`); @@ -7409,8 +7409,8 @@ function W$(t, e) { decode: A }; } -var H$ = W$, K$ = H$; -const V$ = (t) => { +var K$ = H$, V$ = K$; +const G$ = (t) => { if (t instanceof Uint8Array && t.constructor.name === "Uint8Array") return t; if (t instanceof ArrayBuffer) @@ -7418,8 +7418,8 @@ const V$ = (t) => { if (ArrayBuffer.isView(t)) return new Uint8Array(t.buffer, t.byteOffset, t.byteLength); throw new Error("Unknown type, must be binary type"); -}, G$ = (t) => new TextEncoder().encode(t), Y$ = (t) => new TextDecoder().decode(t); -class J$ { +}, Y$ = (t) => new TextEncoder().encode(t), J$ = (t) => new TextDecoder().decode(t); +class X$ { constructor(e, r, n) { this.name = e, this.prefix = r, this.baseEncode = n; } @@ -7429,7 +7429,7 @@ class J$ { throw Error("Unknown type, must be binary type"); } } -class X$ { +class Z$ { constructor(e, r, n) { if (this.name = e, this.prefix = r, r.codePointAt(0) === void 0) throw new Error("Invalid prefix character"); @@ -7444,15 +7444,15 @@ class X$ { throw Error("Can only multibase decode strings"); } or(e) { - return B4(this, e); + return k4(this, e); } } -class Z$ { +class Q$ { constructor(e) { this.decoders = e; } or(e) { - return B4(this, e); + return k4(this, e); } decode(e) { const r = e[0], n = this.decoders[r]; @@ -7461,13 +7461,13 @@ class Z$ { throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`); } } -const B4 = (t, e) => new Z$({ +const k4 = (t, e) => new Q$({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); -class Q$ { +class eB { constructor(e, r, n, i) { - this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new J$(e, r, n), this.decoder = new X$(e, r, i); + this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new X$(e, r, n), this.decoder = new Z$(e, r, i); } encode(e) { return this.encoder.encode(e); @@ -7476,15 +7476,15 @@ class Q$ { return this.decoder.decode(e); } } -const q0 = ({ name: t, prefix: e, encode: r, decode: n }) => new Q$(t, e, r, n), Hl = ({ prefix: t, name: e, alphabet: r }) => { - const { encode: n, decode: i } = K$(r, e); +const q0 = ({ name: t, prefix: e, encode: r, decode: n }) => new eB(t, e, r, n), Hl = ({ prefix: t, name: e, alphabet: r }) => { + const { encode: n, decode: i } = V$(r, e); return q0({ prefix: t, name: e, encode: n, - decode: (s) => V$(i(s)) + decode: (s) => G$(i(s)) }); -}, eB = (t, e, r, n) => { +}, tB = (t, e, r, n) => { const i = {}; for (let d = 0; d < e.length; ++d) i[e[d]] = d; @@ -7502,7 +7502,7 @@ const q0 = ({ name: t, prefix: e, encode: r, decode: n }) => new Q$(t, e, r, n), if (a >= r || 255 & u << 8 - a) throw new SyntaxError("Unexpected end of data"); return o; -}, tB = (t, e, r) => { +}, rB = (t, e, r) => { const n = e[e.length - 1] === "=", i = (1 << r) - 1; let s = "", o = 0, a = 0; for (let u = 0; u < t.length; ++u) @@ -7512,204 +7512,204 @@ const q0 = ({ name: t, prefix: e, encode: r, decode: n }) => new Q$(t, e, r, n), for (; s.length * r & 7; ) s += "="; return s; -}, qn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => q0({ +}, zn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => q0({ prefix: e, name: t, encode(i) { - return tB(i, n, r); + return rB(i, n, r); }, decode(i) { - return eB(i, n, r, t); + return tB(i, n, r, t); } -}), rB = q0({ +}), nB = q0({ prefix: "\0", name: "identity", - encode: (t) => Y$(t), - decode: (t) => G$(t) -}), nB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + encode: (t) => J$(t), + decode: (t) => Y$(t) +}), iB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - identity: rB -}, Symbol.toStringTag, { value: "Module" })), iB = qn({ + identity: nB +}, Symbol.toStringTag, { value: "Module" })), sB = zn({ prefix: "0", name: "base2", alphabet: "01", bitsPerChar: 1 -}), sB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), oB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base2: iB -}, Symbol.toStringTag, { value: "Module" })), oB = qn({ + base2: sB +}, Symbol.toStringTag, { value: "Module" })), aB = zn({ prefix: "7", name: "base8", alphabet: "01234567", bitsPerChar: 3 -}), aB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), cB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base8: oB -}, Symbol.toStringTag, { value: "Module" })), cB = Hl({ + base8: aB +}, Symbol.toStringTag, { value: "Module" })), uB = Hl({ prefix: "9", name: "base10", alphabet: "0123456789" -}), uB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), fB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base10: cB -}, Symbol.toStringTag, { value: "Module" })), fB = qn({ + base10: uB +}, Symbol.toStringTag, { value: "Module" })), lB = zn({ prefix: "f", name: "base16", alphabet: "0123456789abcdef", bitsPerChar: 4 -}), lB = qn({ +}), hB = zn({ prefix: "F", name: "base16upper", alphabet: "0123456789ABCDEF", bitsPerChar: 4 -}), hB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), dB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base16: fB, - base16upper: lB -}, Symbol.toStringTag, { value: "Module" })), dB = qn({ + base16: lB, + base16upper: hB +}, Symbol.toStringTag, { value: "Module" })), pB = zn({ prefix: "b", name: "base32", alphabet: "abcdefghijklmnopqrstuvwxyz234567", bitsPerChar: 5 -}), pB = qn({ +}), gB = zn({ prefix: "B", name: "base32upper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", bitsPerChar: 5 -}), gB = qn({ +}), mB = zn({ prefix: "c", name: "base32pad", alphabet: "abcdefghijklmnopqrstuvwxyz234567=", bitsPerChar: 5 -}), mB = qn({ +}), vB = zn({ prefix: "C", name: "base32padupper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", bitsPerChar: 5 -}), vB = qn({ +}), bB = zn({ prefix: "v", name: "base32hex", alphabet: "0123456789abcdefghijklmnopqrstuv", bitsPerChar: 5 -}), bB = qn({ +}), yB = zn({ prefix: "V", name: "base32hexupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", bitsPerChar: 5 -}), yB = qn({ +}), wB = zn({ prefix: "t", name: "base32hexpad", alphabet: "0123456789abcdefghijklmnopqrstuv=", bitsPerChar: 5 -}), wB = qn({ +}), xB = zn({ prefix: "T", name: "base32hexpadupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=", bitsPerChar: 5 -}), xB = qn({ +}), _B = zn({ prefix: "h", name: "base32z", alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769", bitsPerChar: 5 -}), _B = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), EB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base32: dB, - base32hex: vB, - base32hexpad: yB, - base32hexpadupper: wB, - base32hexupper: bB, - base32pad: gB, - base32padupper: mB, - base32upper: pB, - base32z: xB -}, Symbol.toStringTag, { value: "Module" })), EB = Hl({ + base32: pB, + base32hex: bB, + base32hexpad: wB, + base32hexpadupper: xB, + base32hexupper: yB, + base32pad: mB, + base32padupper: vB, + base32upper: gB, + base32z: _B +}, Symbol.toStringTag, { value: "Module" })), SB = Hl({ prefix: "k", name: "base36", alphabet: "0123456789abcdefghijklmnopqrstuvwxyz" -}), SB = Hl({ +}), AB = Hl({ prefix: "K", name: "base36upper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" -}), AB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), PB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base36: EB, - base36upper: SB -}, Symbol.toStringTag, { value: "Module" })), PB = Hl({ + base36: SB, + base36upper: AB +}, Symbol.toStringTag, { value: "Module" })), MB = Hl({ name: "base58btc", prefix: "z", alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" -}), MB = Hl({ +}), IB = Hl({ name: "base58flickr", prefix: "Z", alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" -}), IB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), CB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base58btc: PB, - base58flickr: MB -}, Symbol.toStringTag, { value: "Module" })), CB = qn({ + base58btc: MB, + base58flickr: IB +}, Symbol.toStringTag, { value: "Module" })), TB = zn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 -}), TB = qn({ +}), RB = zn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 -}), RB = qn({ +}), DB = zn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 -}), DB = qn({ +}), OB = zn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", bitsPerChar: 6 -}), OB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), NB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base64: CB, - base64pad: TB, - base64url: RB, - base64urlpad: DB -}, Symbol.toStringTag, { value: "Module" })), F4 = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), NB = F4.reduce((t, e, r) => (t[r] = e, t), []), LB = F4.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); -function kB(t) { - return t.reduce((e, r) => (e += NB[r], e), ""); -} + base64: TB, + base64pad: RB, + base64url: DB, + base64urlpad: OB +}, Symbol.toStringTag, { value: "Module" })), $4 = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), LB = $4.reduce((t, e, r) => (t[r] = e, t), []), kB = $4.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); function $B(t) { + return t.reduce((e, r) => (e += LB[r], e), ""); +} +function BB(t) { const e = []; for (const r of t) { - const n = LB[r.codePointAt(0)]; + const n = kB[r.codePointAt(0)]; if (n === void 0) throw new Error(`Non-base256emoji character: ${r}`); e.push(n); } return new Uint8Array(e); } -const BB = q0({ +const FB = q0({ prefix: "🚀", name: "base256emoji", - encode: kB, - decode: $B -}), FB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + encode: $B, + decode: BB +}), jB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base256emoji: BB + base256emoji: FB }, Symbol.toStringTag, { value: "Module" })); new TextEncoder(); new TextDecoder(); -const nx = { - ...nB, - ...sB, - ...aB, - ...uB, - ...hB, - ..._B, - ...AB, - ...IB, - ...OB, - ...FB -}; -function j4(t, e, r, n) { +const tx = { + ...iB, + ...oB, + ...cB, + ...fB, + ...dB, + ...EB, + ...PB, + ...CB, + ...NB, + ...jB +}; +function B4(t, e, r, n) { return { name: t, prefix: e, @@ -7721,80 +7721,80 @@ function j4(t, e, r, n) { decoder: { decode: n } }; } -const ix = j4("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), Xg = j4("ascii", "a", (t) => { +const rx = B4("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), Xg = B4("ascii", "a", (t) => { let e = "a"; for (let r = 0; r < t.length; r++) e += String.fromCharCode(t[r]); return e; }, (t) => { t = t.substring(1); - const e = $4(t.length); + const e = L4(t.length); for (let r = 0; r < t.length; r++) e[r] = t.charCodeAt(r); return e; -}), U4 = { - utf8: ix, - "utf-8": ix, - hex: nx.base16, +}), F4 = { + utf8: rx, + "utf-8": rx, + hex: tx.base16, latin1: Xg, ascii: Xg, binary: Xg, - ...nx + ...tx }; function On(t, e = "utf8") { - const r = U4[e]; + const r = F4[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t.buffer, t.byteOffset, t.byteLength).toString("utf8") : r.encoder.encode(t).substring(1); } function Rn(t, e = "utf8") { - const r = U4[e]; + const r = F4[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t, "utf8") : r.decoder.decode(`${r.prefix}${t}`); } -function sx(t) { - return lc(On(Rn(t, U0), L4)); +function nx(t) { + return fc(On(Rn(t, U0), O4)); } function t0(t) { - return On(Rn(Bo(t), L4), U0); + return On(Rn($o(t), O4), U0); } -function q4(t) { - const e = Rn(q$, rx), r = U$ + On(Sd([e, t]), rx); - return [F$, j$, r].join(B$); -} -function jB(t) { - return On(t, U0); +function j4(t) { + const e = Rn(z$, ex), r = q$ + On(Sd([e, t]), ex); + return [j$, U$, r].join(F$); } function UB(t) { - return Rn(t, U0); + return On(t, U0); } function qB(t) { - return Rn([t0(t.header), t0(t.payload)].join(e0), k4); + return Rn(t, U0); } function zB(t) { + return Rn([t0(t.header), t0(t.payload)].join(e0), N4); +} +function WB(t) { return [ t0(t.header), t0(t.payload), - jB(t.signature) + UB(t.signature) ].join(e0); } function v1(t) { - const e = t.split(e0), r = sx(e[0]), n = sx(e[1]), i = UB(e[2]), s = Rn(e.slice(0, 2).join(e0), k4); + const e = t.split(e0), r = nx(e[0]), n = nx(e[1]), i = qB(e[2]), s = Rn(e.slice(0, 2).join(e0), N4); return { header: r, payload: n, signature: i, data: s }; } -function ox(t = Ca.randomBytes(z$)) { +function ix(t = Pa.randomBytes(W$)) { return Bv.generateKeyPairFromSeed(t); } -async function WB(t, e, r, n, i = mt.fromMiliseconds(Date.now())) { - const s = { alg: k$, typ: $$ }, o = q4(n.publicKey), a = i + r, u = { iss: o, sub: t, aud: e, iat: i, exp: a }, l = qB({ header: s, payload: u }), d = Bv.sign(n.secretKey, l); - return zB({ header: s, payload: u, signature: d }); +async function HB(t, e, r, n, i = mt.fromMiliseconds(Date.now())) { + const s = { alg: $$, typ: B$ }, o = j4(n.publicKey), a = i + r, u = { iss: o, sub: t, aud: e, iat: i, exp: a }, l = zB({ header: s, payload: u }), d = Bv.sign(n.secretKey, l); + return WB({ header: s, payload: u, signature: d }); } -var ax = function(t, e, r) { +var sx = function(t, e, r) { if (r || arguments.length === 2) for (var n = 0, i = e.length, s; n < i; n++) (s || !(n in e)) && (s || (s = Array.prototype.slice.call(e, 0, n)), s[n] = e[n]); return t.concat(s || Array.prototype.slice.call(e)); -}, HB = ( +}, KB = ( /** @class */ /* @__PURE__ */ function() { function t(e, r, n) { @@ -7802,7 +7802,7 @@ var ax = function(t, e, r) { } return t; }() -), KB = ( +), VB = ( /** @class */ /* @__PURE__ */ function() { function t(e) { @@ -7810,7 +7810,7 @@ var ax = function(t, e, r) { } return t; }() -), VB = ( +), GB = ( /** @class */ /* @__PURE__ */ function() { function t(e, r, n, i) { @@ -7818,7 +7818,7 @@ var ax = function(t, e, r) { } return t; }() -), GB = ( +), YB = ( /** @class */ /* @__PURE__ */ function() { function t() { @@ -7826,7 +7826,7 @@ var ax = function(t, e, r) { } return t; }() -), YB = ( +), JB = ( /** @class */ /* @__PURE__ */ function() { function t() { @@ -7834,7 +7834,7 @@ var ax = function(t, e, r) { } return t; }() -), JB = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/, XB = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, cx = 3, ZB = [ +), XB = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/, ZB = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, ox = 3, QB = [ ["aol", /AOLShield\/([0-9\._]+)/], ["edge", /Edge\/([0-9\._]+)/], ["edge-ios", /EdgiOS\/([0-9\._]+)/], @@ -7872,8 +7872,8 @@ var ax = function(t, e, r) { ["ios-webview", /AppleWebKit\/([0-9\.]+).*Mobile/], ["ios-webview", /AppleWebKit\/([0-9\.]+).*Gecko\)$/], ["curl", /^curl\/([0-9\.]+)$/], - ["searchbot", JB] -], ux = [ + ["searchbot", XB] +], ax = [ ["iOS", /iP(hone|od|ad)/], ["Android OS", /Android/], ["BlackBerry OS", /BlackBerry|BB10/], @@ -7901,11 +7901,11 @@ var ax = function(t, e, r) { ["BeOS", /BeOS/], ["OS/2", /OS\/2/] ]; -function QB(t) { - return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative" ? new YB() : typeof navigator < "u" ? tF(navigator.userAgent) : nF(); -} function eF(t) { - return t !== "" && ZB.reduce(function(e, r) { + return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative" ? new JB() : typeof navigator < "u" ? rF(navigator.userAgent) : iF(); +} +function tF(t) { + return t !== "" && QB.reduce(function(e, r) { var n = r[0], i = r[1]; if (e) return e; @@ -7913,38 +7913,38 @@ function eF(t) { return !!s && [n, s]; }, !1); } -function tF(t) { - var e = eF(t); +function rF(t) { + var e = tF(t); if (!e) return null; var r = e[0], n = e[1]; if (r === "searchbot") - return new GB(); + return new YB(); var i = n[1] && n[1].split(".").join("_").split("_").slice(0, 3); - i ? i.length < cx && (i = ax(ax([], i, !0), iF(cx - i.length), !0)) : i = []; - var s = i.join("."), o = rF(t), a = XB.exec(t); - return a && a[1] ? new VB(r, s, o, a[1]) : new HB(r, s, o); + i ? i.length < ox && (i = sx(sx([], i, !0), sF(ox - i.length), !0)) : i = []; + var s = i.join("."), o = nF(t), a = ZB.exec(t); + return a && a[1] ? new GB(r, s, o, a[1]) : new KB(r, s, o); } -function rF(t) { - for (var e = 0, r = ux.length; e < r; e++) { - var n = ux[e], i = n[0], s = n[1], o = s.exec(t); +function nF(t) { + for (var e = 0, r = ax.length; e < r; e++) { + var n = ax[e], i = n[0], s = n[1], o = s.exec(t); if (o) return i; } return null; } -function nF() { +function iF() { var t = typeof process < "u" && process.version; - return t ? new KB(process.version.slice(1)) : null; + return t ? new VB(process.version.slice(1)) : null; } -function iF(t) { +function sF(t) { for (var e = [], r = 0; r < t; r++) e.push("0"); return e; } var Wr = {}; Object.defineProperty(Wr, "__esModule", { value: !0 }); -Wr.getLocalStorage = Wr.getLocalStorageOrThrow = Wr.getCrypto = Wr.getCryptoOrThrow = z4 = Wr.getLocation = Wr.getLocationOrThrow = Fv = Wr.getNavigator = Wr.getNavigatorOrThrow = Kl = Wr.getDocument = Wr.getDocumentOrThrow = Wr.getFromWindowOrThrow = Wr.getFromWindow = void 0; +Wr.getLocalStorage = Wr.getLocalStorageOrThrow = Wr.getCrypto = Wr.getCryptoOrThrow = U4 = Wr.getLocation = Wr.getLocationOrThrow = Fv = Wr.getNavigator = Wr.getNavigatorOrThrow = Kl = Wr.getDocument = Wr.getDocumentOrThrow = Wr.getFromWindowOrThrow = Wr.getFromWindow = void 0; function yc(t) { let e; return typeof window < "u" && typeof window[t] < "u" && (e = window[t]), e; @@ -7957,78 +7957,78 @@ function Nu(t) { return e; } Wr.getFromWindowOrThrow = Nu; -function sF() { +function oF() { return Nu("document"); } -Wr.getDocumentOrThrow = sF; -function oF() { +Wr.getDocumentOrThrow = oF; +function aF() { return yc("document"); } -var Kl = Wr.getDocument = oF; -function aF() { +var Kl = Wr.getDocument = aF; +function cF() { return Nu("navigator"); } -Wr.getNavigatorOrThrow = aF; -function cF() { +Wr.getNavigatorOrThrow = cF; +function uF() { return yc("navigator"); } -var Fv = Wr.getNavigator = cF; -function uF() { +var Fv = Wr.getNavigator = uF; +function fF() { return Nu("location"); } -Wr.getLocationOrThrow = uF; -function fF() { +Wr.getLocationOrThrow = fF; +function lF() { return yc("location"); } -var z4 = Wr.getLocation = fF; -function lF() { +var U4 = Wr.getLocation = lF; +function hF() { return Nu("crypto"); } -Wr.getCryptoOrThrow = lF; -function hF() { +Wr.getCryptoOrThrow = hF; +function dF() { return yc("crypto"); } -Wr.getCrypto = hF; -function dF() { +Wr.getCrypto = dF; +function pF() { return Nu("localStorage"); } -Wr.getLocalStorageOrThrow = dF; -function pF() { +Wr.getLocalStorageOrThrow = pF; +function gF() { return yc("localStorage"); } -Wr.getLocalStorage = pF; +Wr.getLocalStorage = gF; var jv = {}; Object.defineProperty(jv, "__esModule", { value: !0 }); -var W4 = jv.getWindowMetadata = void 0; -const fx = Wr; -function gF() { +var q4 = jv.getWindowMetadata = void 0; +const cx = Wr; +function mF() { let t, e; try { - t = fx.getDocumentOrThrow(), e = fx.getLocationOrThrow(); + t = cx.getDocumentOrThrow(), e = cx.getLocationOrThrow(); } catch { return null; } function r() { const p = t.getElementsByTagName("link"), w = []; for (let A = 0; A < p.length; A++) { - const P = p[A], N = P.getAttribute("rel"); + const M = p[A], N = M.getAttribute("rel"); if (N && N.toLowerCase().indexOf("icon") > -1) { - const L = P.getAttribute("href"); + const L = M.getAttribute("href"); if (L) if (L.toLowerCase().indexOf("https:") === -1 && L.toLowerCase().indexOf("http:") === -1 && L.indexOf("//") !== 0) { - let $ = e.protocol + "//" + e.host; + let B = e.protocol + "//" + e.host; if (L.indexOf("/") === 0) - $ += L; + B += L; else { - const B = e.pathname.split("/"); - B.pop(); - const H = B.join("/"); - $ += H + "/" + L; + const $ = e.pathname.split("/"); + $.pop(); + const H = $.join("/"); + B += H + "/" + L; } - w.push($); + w.push(B); } else if (L.indexOf("//") === 0) { - const $ = e.protocol + L; - w.push($); + const B = e.protocol + L; + w.push(B); } else w.push(L); } @@ -8038,9 +8038,9 @@ function gF() { function n(...p) { const w = t.getElementsByTagName("meta"); for (let A = 0; A < w.length; A++) { - const P = w[A], N = ["itemprop", "property", "name"].map((L) => P.getAttribute(L)).filter((L) => L ? p.includes(L) : !1); + const M = w[A], N = ["itemprop", "property", "name"].map((L) => M.getAttribute(L)).filter((L) => L ? p.includes(L) : !1); if (N.length && N) { - const L = P.getAttribute("content"); + const L = M.getAttribute("content"); if (L) return L; } @@ -8062,8 +8062,8 @@ function gF() { name: o }; } -W4 = jv.getWindowMetadata = gF; -var xl = {}, mF = (t) => encodeURIComponent(t).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), H4 = "%[a-f0-9]{2}", lx = new RegExp("(" + H4 + ")|([^%]+?)", "gi"), hx = new RegExp("(" + H4 + ")+", "gi"); +q4 = jv.getWindowMetadata = mF; +var xl = {}, vF = (t) => encodeURIComponent(t).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), z4 = "%[a-f0-9]{2}", ux = new RegExp("(" + z4 + ")|([^%]+?)", "gi"), fx = new RegExp("(" + z4 + ")+", "gi"); function b1(t, e) { try { return [decodeURIComponent(t.join(""))]; @@ -8075,27 +8075,27 @@ function b1(t, e) { var r = t.slice(0, e), n = t.slice(e); return Array.prototype.concat.call([], b1(r), b1(n)); } -function vF(t) { +function bF(t) { try { return decodeURIComponent(t); } catch { - for (var e = t.match(lx) || [], r = 1; r < e.length; r++) - t = b1(e, r).join(""), e = t.match(lx) || []; + for (var e = t.match(ux) || [], r = 1; r < e.length; r++) + t = b1(e, r).join(""), e = t.match(ux) || []; return t; } } -function bF(t) { +function yF(t) { for (var e = { "%FE%FF": "��", "%FF%FE": "��" - }, r = hx.exec(t); r; ) { + }, r = fx.exec(t); r; ) { try { e[r[0]] = decodeURIComponent(r[0]); } catch { - var n = vF(r[0]); + var n = bF(r[0]); n !== r[0] && (e[r[0]] = n); } - r = hx.exec(t); + r = fx.exec(t); } e["%C2"] = "�"; for (var i = Object.keys(e), s = 0; s < i.length; s++) { @@ -8104,15 +8104,15 @@ function bF(t) { } return t; } -var yF = function(t) { +var wF = function(t) { if (typeof t != "string") throw new TypeError("Expected `encodedURI` to be of type `string`, got `" + typeof t + "`"); try { return t = t.replace(/\+/g, " "), decodeURIComponent(t); } catch { - return bF(t); + return yF(t); } -}, wF = (t, e) => { +}, xF = (t, e) => { if (!(typeof t == "string" && typeof e == "string")) throw new TypeError("Expected the arguments to be of type `string`"); if (e === "") @@ -8122,7 +8122,7 @@ var yF = function(t) { t.slice(0, r), t.slice(r + e.length) ]; -}, xF = function(t, e) { +}, _F = function(t, e) { for (var r = {}, n = Object.keys(t), i = Array.isArray(e), s = 0; s < n.length; s++) { var o = n[s], a = t[o]; (i ? e.indexOf(o) !== -1 : e(o, a, t)) && (r[o] = a); @@ -8130,34 +8130,34 @@ var yF = function(t) { return r; }; (function(t) { - const e = mF, r = yF, n = wF, i = xF, s = (B) => B == null, o = Symbol("encodeFragmentIdentifier"); - function a(B) { - switch (B.arrayFormat) { + const e = vF, r = wF, n = xF, i = _F, s = ($) => $ == null, o = Symbol("encodeFragmentIdentifier"); + function a($) { + switch ($.arrayFormat) { case "index": return (H) => (W, V) => { const te = W.length; - return V === void 0 || B.skipNull && V === null || B.skipEmptyString && V === "" ? W : V === null ? [...W, [d(H, B), "[", te, "]"].join("")] : [ + return V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? W : V === null ? [...W, [d(H, $), "[", te, "]"].join("")] : [ ...W, - [d(H, B), "[", d(te, B), "]=", d(V, B)].join("") + [d(H, $), "[", d(te, $), "]=", d(V, $)].join("") ]; }; case "bracket": - return (H) => (W, V) => V === void 0 || B.skipNull && V === null || B.skipEmptyString && V === "" ? W : V === null ? [...W, [d(H, B), "[]"].join("")] : [...W, [d(H, B), "[]=", d(V, B)].join("")]; + return (H) => (W, V) => V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? W : V === null ? [...W, [d(H, $), "[]"].join("")] : [...W, [d(H, $), "[]=", d(V, $)].join("")]; case "colon-list-separator": - return (H) => (W, V) => V === void 0 || B.skipNull && V === null || B.skipEmptyString && V === "" ? W : V === null ? [...W, [d(H, B), ":list="].join("")] : [...W, [d(H, B), ":list=", d(V, B)].join("")]; + return (H) => (W, V) => V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? W : V === null ? [...W, [d(H, $), ":list="].join("")] : [...W, [d(H, $), ":list=", d(V, $)].join("")]; case "comma": case "separator": case "bracket-separator": { - const H = B.arrayFormat === "bracket-separator" ? "[]=" : "="; - return (W) => (V, te) => te === void 0 || B.skipNull && te === null || B.skipEmptyString && te === "" ? V : (te = te === null ? "" : te, V.length === 0 ? [[d(W, B), H, d(te, B)].join("")] : [[V, d(te, B)].join(B.arrayFormatSeparator)]); + const H = $.arrayFormat === "bracket-separator" ? "[]=" : "="; + return (W) => (V, te) => te === void 0 || $.skipNull && te === null || $.skipEmptyString && te === "" ? V : (te = te === null ? "" : te, V.length === 0 ? [[d(W, $), H, d(te, $)].join("")] : [[V, d(te, $)].join($.arrayFormatSeparator)]); } default: - return (H) => (W, V) => V === void 0 || B.skipNull && V === null || B.skipEmptyString && V === "" ? W : V === null ? [...W, d(H, B)] : [...W, [d(H, B), "=", d(V, B)].join("")]; + return (H) => (W, V) => V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? W : V === null ? [...W, d(H, $)] : [...W, [d(H, $), "=", d(V, $)].join("")]; } } - function u(B) { + function u($) { let H; - switch (B.arrayFormat) { + switch ($.arrayFormat) { case "index": return (W, V, te) => { if (H = /\[(\d*)\]$/.exec(W), W = W.replace(/\[\d*\]$/, ""), !H) { @@ -8193,19 +8193,19 @@ var yF = function(t) { case "comma": case "separator": return (W, V, te) => { - const R = typeof V == "string" && V.includes(B.arrayFormatSeparator), K = typeof V == "string" && !R && p(V, B).includes(B.arrayFormatSeparator); - V = K ? p(V, B) : V; - const ge = R || K ? V.split(B.arrayFormatSeparator).map((Ee) => p(Ee, B)) : V === null ? V : p(V, B); + const R = typeof V == "string" && V.includes($.arrayFormatSeparator), K = typeof V == "string" && !R && p(V, $).includes($.arrayFormatSeparator); + V = K ? p(V, $) : V; + const ge = R || K ? V.split($.arrayFormatSeparator).map((Ee) => p(Ee, $)) : V === null ? V : p(V, $); te[W] = ge; }; case "bracket-separator": return (W, V, te) => { const R = /(\[\])$/.test(W); if (W = W.replace(/\[\]$/, ""), !R) { - te[W] = V && p(V, B); + te[W] = V && p(V, $); return; } - const K = V === null ? [] : V.split(B.arrayFormatSeparator).map((ge) => p(ge, B)); + const K = V === null ? [] : V.split($.arrayFormatSeparator).map((ge) => p(ge, $)); if (te[W] === void 0) { te[W] = K; return; @@ -8222,37 +8222,37 @@ var yF = function(t) { }; } } - function l(B) { - if (typeof B != "string" || B.length !== 1) + function l($) { + if (typeof $ != "string" || $.length !== 1) throw new TypeError("arrayFormatSeparator must be single character string"); } - function d(B, H) { - return H.encode ? H.strict ? e(B) : encodeURIComponent(B) : B; + function d($, H) { + return H.encode ? H.strict ? e($) : encodeURIComponent($) : $; } - function p(B, H) { - return H.decode ? r(B) : B; + function p($, H) { + return H.decode ? r($) : $; } - function w(B) { - return Array.isArray(B) ? B.sort() : typeof B == "object" ? w(Object.keys(B)).sort((H, W) => Number(H) - Number(W)).map((H) => B[H]) : B; + function w($) { + return Array.isArray($) ? $.sort() : typeof $ == "object" ? w(Object.keys($)).sort((H, W) => Number(H) - Number(W)).map((H) => $[H]) : $; } - function A(B) { - const H = B.indexOf("#"); - return H !== -1 && (B = B.slice(0, H)), B; + function A($) { + const H = $.indexOf("#"); + return H !== -1 && ($ = $.slice(0, H)), $; } - function P(B) { + function M($) { let H = ""; - const W = B.indexOf("#"); - return W !== -1 && (H = B.slice(W)), H; + const W = $.indexOf("#"); + return W !== -1 && (H = $.slice(W)), H; } - function N(B) { - B = A(B); - const H = B.indexOf("?"); - return H === -1 ? "" : B.slice(H + 1); + function N($) { + $ = A($); + const H = $.indexOf("?"); + return H === -1 ? "" : $.slice(H + 1); } - function L(B, H) { - return H.parseNumbers && !Number.isNaN(Number(B)) && typeof B == "string" && B.trim() !== "" ? B = Number(B) : H.parseBooleans && B !== null && (B.toLowerCase() === "true" || B.toLowerCase() === "false") && (B = B.toLowerCase() === "true"), B; + function L($, H) { + return H.parseNumbers && !Number.isNaN(Number($)) && typeof $ == "string" && $.trim() !== "" ? $ = Number($) : H.parseBooleans && $ !== null && ($.toLowerCase() === "true" || $.toLowerCase() === "false") && ($ = $.toLowerCase() === "true"), $; } - function $(B, H) { + function B($, H) { H = Object.assign({ decode: !0, sort: !0, @@ -8262,9 +8262,9 @@ var yF = function(t) { parseBooleans: !1 }, H), l(H.arrayFormatSeparator); const W = u(H), V = /* @__PURE__ */ Object.create(null); - if (typeof B != "string" || (B = B.trim().replace(/^[?#&]/, ""), !B)) + if (typeof $ != "string" || ($ = $.trim().replace(/^[?#&]/, ""), !$)) return V; - for (const te of B.split("&")) { + for (const te of $.split("&")) { if (te === "") continue; let [R, K] = n(H.decode ? te.replace(/\+/g, " ") : te, "="); @@ -8283,8 +8283,8 @@ var yF = function(t) { return K && typeof K == "object" && !Array.isArray(K) ? te[R] = w(K) : te[R] = K, te; }, /* @__PURE__ */ Object.create(null)); } - t.extract = N, t.parse = $, t.stringify = (B, H) => { - if (!B) + t.extract = N, t.parse = B, t.stringify = ($, H) => { + if (!$) return ""; H = Object.assign({ encode: !0, @@ -8292,54 +8292,54 @@ var yF = function(t) { arrayFormat: "none", arrayFormatSeparator: "," }, H), l(H.arrayFormatSeparator); - const W = (K) => H.skipNull && s(B[K]) || H.skipEmptyString && B[K] === "", V = a(H), te = {}; - for (const K of Object.keys(B)) - W(K) || (te[K] = B[K]); + const W = (K) => H.skipNull && s($[K]) || H.skipEmptyString && $[K] === "", V = a(H), te = {}; + for (const K of Object.keys($)) + W(K) || (te[K] = $[K]); const R = Object.keys(te); return H.sort !== !1 && R.sort(H.sort), R.map((K) => { - const ge = B[K]; + const ge = $[K]; return ge === void 0 ? "" : ge === null ? d(K, H) : Array.isArray(ge) ? ge.length === 0 && H.arrayFormat === "bracket-separator" ? d(K, H) + "[]" : ge.reduce(V(K), []).join("&") : d(K, H) + "=" + d(ge, H); }).filter((K) => K.length > 0).join("&"); - }, t.parseUrl = (B, H) => { + }, t.parseUrl = ($, H) => { H = Object.assign({ decode: !0 }, H); - const [W, V] = n(B, "#"); + const [W, V] = n($, "#"); return Object.assign( { url: W.split("?")[0] || "", - query: $(N(B), H) + query: B(N($), H) }, H && H.parseFragmentIdentifier && V ? { fragmentIdentifier: p(V, H) } : {} ); - }, t.stringifyUrl = (B, H) => { + }, t.stringifyUrl = ($, H) => { H = Object.assign({ encode: !0, strict: !0, [o]: !0 }, H); - const W = A(B.url).split("?")[0] || "", V = t.extract(B.url), te = t.parse(V, { sort: !1 }), R = Object.assign(te, B.query); + const W = A($.url).split("?")[0] || "", V = t.extract($.url), te = t.parse(V, { sort: !1 }), R = Object.assign(te, $.query); let K = t.stringify(R, H); K && (K = `?${K}`); - let ge = P(B.url); - return B.fragmentIdentifier && (ge = `#${H[o] ? d(B.fragmentIdentifier, H) : B.fragmentIdentifier}`), `${W}${K}${ge}`; - }, t.pick = (B, H, W) => { + let ge = M($.url); + return $.fragmentIdentifier && (ge = `#${H[o] ? d($.fragmentIdentifier, H) : $.fragmentIdentifier}`), `${W}${K}${ge}`; + }, t.pick = ($, H, W) => { W = Object.assign({ parseFragmentIdentifier: !0, [o]: !1 }, W); - const { url: V, query: te, fragmentIdentifier: R } = t.parseUrl(B, W); + const { url: V, query: te, fragmentIdentifier: R } = t.parseUrl($, W); return t.stringifyUrl({ url: V, query: i(te, H), fragmentIdentifier: R }, W); - }, t.exclude = (B, H, W) => { + }, t.exclude = ($, H, W) => { const V = Array.isArray(H) ? (te) => !H.includes(te) : (te, R) => !H(te, R); - return t.pick(B, V, W); + return t.pick($, V, W); }; })(xl); -var K4 = { exports: {} }; +var W4 = { exports: {} }; /** * [js-sha3]{@link https://github.com/emn178/js-sha3} * @@ -8354,7 +8354,7 @@ var K4 = { exports: {} }; i.JS_SHA3_NO_WINDOW && (n = !1); var s = !n && typeof self == "object", o = !i.JS_SHA3_NO_NODE_JS && typeof process == "object" && process.versions && process.versions.node; o ? i = gn : s && (i = self); - var a = !i.JS_SHA3_NO_COMMON_JS && !0 && t.exports, u = !i.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", l = "0123456789abcdef".split(""), d = [31, 7936, 2031616, 520093696], p = [4, 1024, 262144, 67108864], w = [1, 256, 65536, 16777216], A = [6, 1536, 393216, 100663296], P = [0, 8, 16, 24], N = [ + var a = !i.JS_SHA3_NO_COMMON_JS && !0 && t.exports, u = !i.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", l = "0123456789abcdef".split(""), d = [31, 7936, 2031616, 520093696], p = [4, 1024, 262144, 67108864], w = [1, 256, 65536, 16777216], A = [6, 1536, 393216, 100663296], M = [0, 8, 16, 24], N = [ 1, 0, 32898, @@ -8403,7 +8403,7 @@ var K4 = { exports: {} }; 0, 2147516424, 2147483648 - ], L = [224, 256, 384, 512], $ = [128, 256], B = ["hex", "buffer", "arrayBuffer", "array", "digest"], H = { + ], L = [224, 256, 384, 512], B = [128, 256], $ = ["hex", "buffer", "arrayBuffer", "array", "digest"], H = { 128: 168, 256: 136 }; @@ -8429,8 +8429,8 @@ var K4 = { exports: {} }; return f["kmac" + D].update(J, Q, T, X)[Z](); }; }, K = function(D, oe, Z, J) { - for (var Q = 0; Q < B.length; ++Q) { - var T = B[Q]; + for (var Q = 0; Q < $.length; ++Q) { + var T = $[Q]; D[T] = oe(Z, J, T); } return D; @@ -8465,15 +8465,15 @@ var K4 = { exports: {} }; }, m = [ { name: "keccak", padding: w, bits: L, createMethod: ge }, { name: "sha3", padding: A, bits: L, createMethod: ge }, - { name: "shake", padding: d, bits: $, createMethod: Ee }, - { name: "cshake", padding: p, bits: $, createMethod: Y }, - { name: "kmac", padding: p, bits: $, createMethod: S } + { name: "shake", padding: d, bits: B, createMethod: Ee }, + { name: "cshake", padding: p, bits: B, createMethod: Y }, + { name: "kmac", padding: p, bits: B, createMethod: S } ], f = {}, g = [], b = 0; b < m.length; ++b) for (var x = m[b], _ = x.bits, E = 0; E < _.length; ++E) { var v = x.name + "_" + _[E]; if (g.push(v), f[v] = x.createMethod(_[E], x.padding), x.name !== "sha3") { - var M = x.name + _[E]; - g.push(M), f[M] = f[v]; + var P = x.name + _[E]; + g.push(P), f[P] = f[v]; } } function I(D, oe, Z) { @@ -8497,20 +8497,20 @@ var K4 = { exports: {} }; throw new Error(e); oe = !0; } - for (var J = this.blocks, Q = this.byteCount, T = D.length, X = this.blockCount, re = 0, pe = this.s, ie, ue; re < T; ) { + for (var J = this.blocks, Q = this.byteCount, T = D.length, X = this.blockCount, re = 0, de = this.s, ie, ue; re < T; ) { if (this.reset) for (this.reset = !1, J[0] = this.block, ie = 1; ie < X + 1; ++ie) J[ie] = 0; if (oe) for (ie = this.start; re < T && ie < Q; ++re) - J[ie >> 2] |= D[re] << P[ie++ & 3]; + J[ie >> 2] |= D[re] << M[ie++ & 3]; else for (ie = this.start; re < T && ie < Q; ++re) - ue = D.charCodeAt(re), ue < 128 ? J[ie >> 2] |= ue << P[ie++ & 3] : ue < 2048 ? (J[ie >> 2] |= (192 | ue >> 6) << P[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << P[ie++ & 3]) : ue < 55296 || ue >= 57344 ? (J[ie >> 2] |= (224 | ue >> 12) << P[ie++ & 3], J[ie >> 2] |= (128 | ue >> 6 & 63) << P[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << P[ie++ & 3]) : (ue = 65536 + ((ue & 1023) << 10 | D.charCodeAt(++re) & 1023), J[ie >> 2] |= (240 | ue >> 18) << P[ie++ & 3], J[ie >> 2] |= (128 | ue >> 12 & 63) << P[ie++ & 3], J[ie >> 2] |= (128 | ue >> 6 & 63) << P[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << P[ie++ & 3]); + ue = D.charCodeAt(re), ue < 128 ? J[ie >> 2] |= ue << M[ie++ & 3] : ue < 2048 ? (J[ie >> 2] |= (192 | ue >> 6) << M[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << M[ie++ & 3]) : ue < 55296 || ue >= 57344 ? (J[ie >> 2] |= (224 | ue >> 12) << M[ie++ & 3], J[ie >> 2] |= (128 | ue >> 6 & 63) << M[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << M[ie++ & 3]) : (ue = 65536 + ((ue & 1023) << 10 | D.charCodeAt(++re) & 1023), J[ie >> 2] |= (240 | ue >> 18) << M[ie++ & 3], J[ie >> 2] |= (128 | ue >> 12 & 63) << M[ie++ & 3], J[ie >> 2] |= (128 | ue >> 6 & 63) << M[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << M[ie++ & 3]); if (this.lastByteIndex = ie, ie >= Q) { for (this.start = ie - Q, this.block = J[X], ie = 0; ie < X; ++ie) - pe[ie] ^= J[ie]; - ce(pe), this.reset = !0; + de[ie] ^= J[ie]; + ce(de), this.reset = !0; } else this.start = ie; } @@ -8571,20 +8571,20 @@ var K4 = { exports: {} }; this.finalize(); var D = this.blockCount, oe = this.s, Z = this.outputBlocks, J = this.extraBytes, Q = 0, T = 0, X = this.outputBits >> 3, re; J ? re = new ArrayBuffer(Z + 1 << 2) : re = new ArrayBuffer(X); - for (var pe = new Uint32Array(re); T < Z; ) { + for (var de = new Uint32Array(re); T < Z; ) { for (Q = 0; Q < D && T < Z; ++Q, ++T) - pe[T] = oe[Q]; + de[T] = oe[Q]; T % D === 0 && ce(oe); } - return J && (pe[Q] = oe[Q], re = re.slice(0, X)), re; + return J && (de[Q] = oe[Q], re = re.slice(0, X)), re; }, I.prototype.buffer = I.prototype.arrayBuffer, I.prototype.digest = I.prototype.array = function() { this.finalize(); - for (var D = this.blockCount, oe = this.s, Z = this.outputBlocks, J = this.extraBytes, Q = 0, T = 0, X = [], re, pe; T < Z; ) { + for (var D = this.blockCount, oe = this.s, Z = this.outputBlocks, J = this.extraBytes, Q = 0, T = 0, X = [], re, de; T < Z; ) { for (Q = 0; Q < D && T < Z; ++Q, ++T) - re = T << 2, pe = oe[Q], X[re] = pe & 255, X[re + 1] = pe >> 8 & 255, X[re + 2] = pe >> 16 & 255, X[re + 3] = pe >> 24 & 255; + re = T << 2, de = oe[Q], X[re] = de & 255, X[re + 1] = de >> 8 & 255, X[re + 2] = de >> 16 & 255, X[re + 3] = de >> 24 & 255; T % D === 0 && ce(oe); } - return J && (re = T << 2, pe = oe[Q], X[re] = pe & 255, J > 1 && (X[re + 1] = pe >> 8 & 255), J > 2 && (X[re + 2] = pe >> 16 & 255)), X; + return J && (re = T << 2, de = oe[Q], X[re] = de & 255, J > 1 && (X[re + 1] = de >> 8 & 255), J > 2 && (X[re + 2] = de >> 16 & 255)), X; }; function F(D, oe, Z) { I.call(this, D, oe, Z); @@ -8593,9 +8593,9 @@ var K4 = { exports: {} }; return this.encode(this.outputBits, !0), I.prototype.finalize.call(this); }; var ce = function(D) { - var oe, Z, J, Q, T, X, re, pe, ie, ue, ve, Pe, De, Ce, $e, Me, Ne, Ke, Le, qe, ze, _e, Ze, at, ke, Qe, tt, Ye, dt, lt, ct, qt, Jt, Et, er, Xt, Dt, kt, Ct, gt, Rt, Nt, vt, $t, Ft, rt, Bt, k, U, z, C, G, j, se, de, xe, Te, Re, nt, je, pt, it, et; + var oe, Z, J, Q, T, X, re, de, ie, ue, ve, Pe, De, Ce, $e, Me, Ne, Ke, Le, qe, ze, _e, Ze, at, ke, Qe, tt, Ye, dt, lt, ct, qt, Yt, Et, er, Jt, Dt, kt, Ct, gt, Rt, Nt, vt, $t, Ft, rt, Bt, k, U, z, C, G, j, se, he, xe, Te, Re, nt, je, pt, it, et; for (J = 0; J < 48; J += 2) - Q = D[0] ^ D[10] ^ D[20] ^ D[30] ^ D[40], T = D[1] ^ D[11] ^ D[21] ^ D[31] ^ D[41], X = D[2] ^ D[12] ^ D[22] ^ D[32] ^ D[42], re = D[3] ^ D[13] ^ D[23] ^ D[33] ^ D[43], pe = D[4] ^ D[14] ^ D[24] ^ D[34] ^ D[44], ie = D[5] ^ D[15] ^ D[25] ^ D[35] ^ D[45], ue = D[6] ^ D[16] ^ D[26] ^ D[36] ^ D[46], ve = D[7] ^ D[17] ^ D[27] ^ D[37] ^ D[47], Pe = D[8] ^ D[18] ^ D[28] ^ D[38] ^ D[48], De = D[9] ^ D[19] ^ D[29] ^ D[39] ^ D[49], oe = Pe ^ (X << 1 | re >>> 31), Z = De ^ (re << 1 | X >>> 31), D[0] ^= oe, D[1] ^= Z, D[10] ^= oe, D[11] ^= Z, D[20] ^= oe, D[21] ^= Z, D[30] ^= oe, D[31] ^= Z, D[40] ^= oe, D[41] ^= Z, oe = Q ^ (pe << 1 | ie >>> 31), Z = T ^ (ie << 1 | pe >>> 31), D[2] ^= oe, D[3] ^= Z, D[12] ^= oe, D[13] ^= Z, D[22] ^= oe, D[23] ^= Z, D[32] ^= oe, D[33] ^= Z, D[42] ^= oe, D[43] ^= Z, oe = X ^ (ue << 1 | ve >>> 31), Z = re ^ (ve << 1 | ue >>> 31), D[4] ^= oe, D[5] ^= Z, D[14] ^= oe, D[15] ^= Z, D[24] ^= oe, D[25] ^= Z, D[34] ^= oe, D[35] ^= Z, D[44] ^= oe, D[45] ^= Z, oe = pe ^ (Pe << 1 | De >>> 31), Z = ie ^ (De << 1 | Pe >>> 31), D[6] ^= oe, D[7] ^= Z, D[16] ^= oe, D[17] ^= Z, D[26] ^= oe, D[27] ^= Z, D[36] ^= oe, D[37] ^= Z, D[46] ^= oe, D[47] ^= Z, oe = ue ^ (Q << 1 | T >>> 31), Z = ve ^ (T << 1 | Q >>> 31), D[8] ^= oe, D[9] ^= Z, D[18] ^= oe, D[19] ^= Z, D[28] ^= oe, D[29] ^= Z, D[38] ^= oe, D[39] ^= Z, D[48] ^= oe, D[49] ^= Z, Ce = D[0], $e = D[1], rt = D[11] << 4 | D[10] >>> 28, Bt = D[10] << 4 | D[11] >>> 28, Ye = D[20] << 3 | D[21] >>> 29, dt = D[21] << 3 | D[20] >>> 29, je = D[31] << 9 | D[30] >>> 23, pt = D[30] << 9 | D[31] >>> 23, Nt = D[40] << 18 | D[41] >>> 14, vt = D[41] << 18 | D[40] >>> 14, Et = D[2] << 1 | D[3] >>> 31, er = D[3] << 1 | D[2] >>> 31, Me = D[13] << 12 | D[12] >>> 20, Ne = D[12] << 12 | D[13] >>> 20, k = D[22] << 10 | D[23] >>> 22, U = D[23] << 10 | D[22] >>> 22, lt = D[33] << 13 | D[32] >>> 19, ct = D[32] << 13 | D[33] >>> 19, it = D[42] << 2 | D[43] >>> 30, et = D[43] << 2 | D[42] >>> 30, se = D[5] << 30 | D[4] >>> 2, de = D[4] << 30 | D[5] >>> 2, Xt = D[14] << 6 | D[15] >>> 26, Dt = D[15] << 6 | D[14] >>> 26, Ke = D[25] << 11 | D[24] >>> 21, Le = D[24] << 11 | D[25] >>> 21, z = D[34] << 15 | D[35] >>> 17, C = D[35] << 15 | D[34] >>> 17, qt = D[45] << 29 | D[44] >>> 3, Jt = D[44] << 29 | D[45] >>> 3, at = D[6] << 28 | D[7] >>> 4, ke = D[7] << 28 | D[6] >>> 4, xe = D[17] << 23 | D[16] >>> 9, Te = D[16] << 23 | D[17] >>> 9, kt = D[26] << 25 | D[27] >>> 7, Ct = D[27] << 25 | D[26] >>> 7, qe = D[36] << 21 | D[37] >>> 11, ze = D[37] << 21 | D[36] >>> 11, G = D[47] << 24 | D[46] >>> 8, j = D[46] << 24 | D[47] >>> 8, $t = D[8] << 27 | D[9] >>> 5, Ft = D[9] << 27 | D[8] >>> 5, Qe = D[18] << 20 | D[19] >>> 12, tt = D[19] << 20 | D[18] >>> 12, Re = D[29] << 7 | D[28] >>> 25, nt = D[28] << 7 | D[29] >>> 25, gt = D[38] << 8 | D[39] >>> 24, Rt = D[39] << 8 | D[38] >>> 24, _e = D[48] << 14 | D[49] >>> 18, Ze = D[49] << 14 | D[48] >>> 18, D[0] = Ce ^ ~Me & Ke, D[1] = $e ^ ~Ne & Le, D[10] = at ^ ~Qe & Ye, D[11] = ke ^ ~tt & dt, D[20] = Et ^ ~Xt & kt, D[21] = er ^ ~Dt & Ct, D[30] = $t ^ ~rt & k, D[31] = Ft ^ ~Bt & U, D[40] = se ^ ~xe & Re, D[41] = de ^ ~Te & nt, D[2] = Me ^ ~Ke & qe, D[3] = Ne ^ ~Le & ze, D[12] = Qe ^ ~Ye & lt, D[13] = tt ^ ~dt & ct, D[22] = Xt ^ ~kt & gt, D[23] = Dt ^ ~Ct & Rt, D[32] = rt ^ ~k & z, D[33] = Bt ^ ~U & C, D[42] = xe ^ ~Re & je, D[43] = Te ^ ~nt & pt, D[4] = Ke ^ ~qe & _e, D[5] = Le ^ ~ze & Ze, D[14] = Ye ^ ~lt & qt, D[15] = dt ^ ~ct & Jt, D[24] = kt ^ ~gt & Nt, D[25] = Ct ^ ~Rt & vt, D[34] = k ^ ~z & G, D[35] = U ^ ~C & j, D[44] = Re ^ ~je & it, D[45] = nt ^ ~pt & et, D[6] = qe ^ ~_e & Ce, D[7] = ze ^ ~Ze & $e, D[16] = lt ^ ~qt & at, D[17] = ct ^ ~Jt & ke, D[26] = gt ^ ~Nt & Et, D[27] = Rt ^ ~vt & er, D[36] = z ^ ~G & $t, D[37] = C ^ ~j & Ft, D[46] = je ^ ~it & se, D[47] = pt ^ ~et & de, D[8] = _e ^ ~Ce & Me, D[9] = Ze ^ ~$e & Ne, D[18] = qt ^ ~at & Qe, D[19] = Jt ^ ~ke & tt, D[28] = Nt ^ ~Et & Xt, D[29] = vt ^ ~er & Dt, D[38] = G ^ ~$t & rt, D[39] = j ^ ~Ft & Bt, D[48] = it ^ ~se & xe, D[49] = et ^ ~de & Te, D[0] ^= N[J], D[1] ^= N[J + 1]; + Q = D[0] ^ D[10] ^ D[20] ^ D[30] ^ D[40], T = D[1] ^ D[11] ^ D[21] ^ D[31] ^ D[41], X = D[2] ^ D[12] ^ D[22] ^ D[32] ^ D[42], re = D[3] ^ D[13] ^ D[23] ^ D[33] ^ D[43], de = D[4] ^ D[14] ^ D[24] ^ D[34] ^ D[44], ie = D[5] ^ D[15] ^ D[25] ^ D[35] ^ D[45], ue = D[6] ^ D[16] ^ D[26] ^ D[36] ^ D[46], ve = D[7] ^ D[17] ^ D[27] ^ D[37] ^ D[47], Pe = D[8] ^ D[18] ^ D[28] ^ D[38] ^ D[48], De = D[9] ^ D[19] ^ D[29] ^ D[39] ^ D[49], oe = Pe ^ (X << 1 | re >>> 31), Z = De ^ (re << 1 | X >>> 31), D[0] ^= oe, D[1] ^= Z, D[10] ^= oe, D[11] ^= Z, D[20] ^= oe, D[21] ^= Z, D[30] ^= oe, D[31] ^= Z, D[40] ^= oe, D[41] ^= Z, oe = Q ^ (de << 1 | ie >>> 31), Z = T ^ (ie << 1 | de >>> 31), D[2] ^= oe, D[3] ^= Z, D[12] ^= oe, D[13] ^= Z, D[22] ^= oe, D[23] ^= Z, D[32] ^= oe, D[33] ^= Z, D[42] ^= oe, D[43] ^= Z, oe = X ^ (ue << 1 | ve >>> 31), Z = re ^ (ve << 1 | ue >>> 31), D[4] ^= oe, D[5] ^= Z, D[14] ^= oe, D[15] ^= Z, D[24] ^= oe, D[25] ^= Z, D[34] ^= oe, D[35] ^= Z, D[44] ^= oe, D[45] ^= Z, oe = de ^ (Pe << 1 | De >>> 31), Z = ie ^ (De << 1 | Pe >>> 31), D[6] ^= oe, D[7] ^= Z, D[16] ^= oe, D[17] ^= Z, D[26] ^= oe, D[27] ^= Z, D[36] ^= oe, D[37] ^= Z, D[46] ^= oe, D[47] ^= Z, oe = ue ^ (Q << 1 | T >>> 31), Z = ve ^ (T << 1 | Q >>> 31), D[8] ^= oe, D[9] ^= Z, D[18] ^= oe, D[19] ^= Z, D[28] ^= oe, D[29] ^= Z, D[38] ^= oe, D[39] ^= Z, D[48] ^= oe, D[49] ^= Z, Ce = D[0], $e = D[1], rt = D[11] << 4 | D[10] >>> 28, Bt = D[10] << 4 | D[11] >>> 28, Ye = D[20] << 3 | D[21] >>> 29, dt = D[21] << 3 | D[20] >>> 29, je = D[31] << 9 | D[30] >>> 23, pt = D[30] << 9 | D[31] >>> 23, Nt = D[40] << 18 | D[41] >>> 14, vt = D[41] << 18 | D[40] >>> 14, Et = D[2] << 1 | D[3] >>> 31, er = D[3] << 1 | D[2] >>> 31, Me = D[13] << 12 | D[12] >>> 20, Ne = D[12] << 12 | D[13] >>> 20, k = D[22] << 10 | D[23] >>> 22, U = D[23] << 10 | D[22] >>> 22, lt = D[33] << 13 | D[32] >>> 19, ct = D[32] << 13 | D[33] >>> 19, it = D[42] << 2 | D[43] >>> 30, et = D[43] << 2 | D[42] >>> 30, se = D[5] << 30 | D[4] >>> 2, he = D[4] << 30 | D[5] >>> 2, Jt = D[14] << 6 | D[15] >>> 26, Dt = D[15] << 6 | D[14] >>> 26, Ke = D[25] << 11 | D[24] >>> 21, Le = D[24] << 11 | D[25] >>> 21, z = D[34] << 15 | D[35] >>> 17, C = D[35] << 15 | D[34] >>> 17, qt = D[45] << 29 | D[44] >>> 3, Yt = D[44] << 29 | D[45] >>> 3, at = D[6] << 28 | D[7] >>> 4, ke = D[7] << 28 | D[6] >>> 4, xe = D[17] << 23 | D[16] >>> 9, Te = D[16] << 23 | D[17] >>> 9, kt = D[26] << 25 | D[27] >>> 7, Ct = D[27] << 25 | D[26] >>> 7, qe = D[36] << 21 | D[37] >>> 11, ze = D[37] << 21 | D[36] >>> 11, G = D[47] << 24 | D[46] >>> 8, j = D[46] << 24 | D[47] >>> 8, $t = D[8] << 27 | D[9] >>> 5, Ft = D[9] << 27 | D[8] >>> 5, Qe = D[18] << 20 | D[19] >>> 12, tt = D[19] << 20 | D[18] >>> 12, Re = D[29] << 7 | D[28] >>> 25, nt = D[28] << 7 | D[29] >>> 25, gt = D[38] << 8 | D[39] >>> 24, Rt = D[39] << 8 | D[38] >>> 24, _e = D[48] << 14 | D[49] >>> 18, Ze = D[49] << 14 | D[48] >>> 18, D[0] = Ce ^ ~Me & Ke, D[1] = $e ^ ~Ne & Le, D[10] = at ^ ~Qe & Ye, D[11] = ke ^ ~tt & dt, D[20] = Et ^ ~Jt & kt, D[21] = er ^ ~Dt & Ct, D[30] = $t ^ ~rt & k, D[31] = Ft ^ ~Bt & U, D[40] = se ^ ~xe & Re, D[41] = he ^ ~Te & nt, D[2] = Me ^ ~Ke & qe, D[3] = Ne ^ ~Le & ze, D[12] = Qe ^ ~Ye & lt, D[13] = tt ^ ~dt & ct, D[22] = Jt ^ ~kt & gt, D[23] = Dt ^ ~Ct & Rt, D[32] = rt ^ ~k & z, D[33] = Bt ^ ~U & C, D[42] = xe ^ ~Re & je, D[43] = Te ^ ~nt & pt, D[4] = Ke ^ ~qe & _e, D[5] = Le ^ ~ze & Ze, D[14] = Ye ^ ~lt & qt, D[15] = dt ^ ~ct & Yt, D[24] = kt ^ ~gt & Nt, D[25] = Ct ^ ~Rt & vt, D[34] = k ^ ~z & G, D[35] = U ^ ~C & j, D[44] = Re ^ ~je & it, D[45] = nt ^ ~pt & et, D[6] = qe ^ ~_e & Ce, D[7] = ze ^ ~Ze & $e, D[16] = lt ^ ~qt & at, D[17] = ct ^ ~Yt & ke, D[26] = gt ^ ~Nt & Et, D[27] = Rt ^ ~vt & er, D[36] = z ^ ~G & $t, D[37] = C ^ ~j & Ft, D[46] = je ^ ~it & se, D[47] = pt ^ ~et & he, D[8] = _e ^ ~Ce & Me, D[9] = Ze ^ ~$e & Ne, D[18] = qt ^ ~at & Qe, D[19] = Yt ^ ~ke & tt, D[28] = Nt ^ ~Et & Jt, D[29] = vt ^ ~er & Dt, D[38] = G ^ ~$t & rt, D[39] = j ^ ~Ft & Bt, D[48] = it ^ ~se & xe, D[49] = et ^ ~he & Te, D[0] ^= N[J], D[1] ^= N[J + 1]; }; if (a) t.exports = f; @@ -8603,13 +8603,13 @@ var K4 = { exports: {} }; for (b = 0; b < g.length; ++b) i[g[b]] = f[g[b]]; })(); -})(K4); -var _F = K4.exports; -const EF = /* @__PURE__ */ rs(_F), SF = "logger/5.7.0"; -let dx = !1, px = !1; +})(W4); +var EF = W4.exports; +const SF = /* @__PURE__ */ ts(EF), AF = "logger/5.7.0"; +let lx = !1, hx = !1; const Ad = { debug: 1, default: 2, info: 2, warning: 3, error: 4, off: 5 }; -let gx = Ad.default, Zg = null; -function AF() { +let dx = Ad.default, Zg = null; +function PF() { try { const t = []; if (["NFD", "NFC", "NFKD", "NFKC"].forEach((e) => { @@ -8628,7 +8628,7 @@ function AF() { } return null; } -const mx = AF(); +const px = PF(); var y1; (function(t) { t.DEBUG = "DEBUG", t.INFO = "INFO", t.WARNING = "WARNING", t.ERROR = "ERROR", t.OFF = "OFF"; @@ -8637,7 +8637,7 @@ var ws; (function(t) { t.UNKNOWN_ERROR = "UNKNOWN_ERROR", t.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", t.UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION", t.NETWORK_ERROR = "NETWORK_ERROR", t.SERVER_ERROR = "SERVER_ERROR", t.TIMEOUT = "TIMEOUT", t.BUFFER_OVERRUN = "BUFFER_OVERRUN", t.NUMERIC_FAULT = "NUMERIC_FAULT", t.MISSING_NEW = "MISSING_NEW", t.INVALID_ARGUMENT = "INVALID_ARGUMENT", t.MISSING_ARGUMENT = "MISSING_ARGUMENT", t.UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT", t.CALL_EXCEPTION = "CALL_EXCEPTION", t.INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS", t.NONCE_EXPIRED = "NONCE_EXPIRED", t.REPLACEMENT_UNDERPRICED = "REPLACEMENT_UNDERPRICED", t.UNPREDICTABLE_GAS_LIMIT = "UNPREDICTABLE_GAS_LIMIT", t.TRANSACTION_REPLACED = "TRANSACTION_REPLACED", t.ACTION_REJECTED = "ACTION_REJECTED"; })(ws || (ws = {})); -const vx = "0123456789abcdef"; +const gx = "0123456789abcdef"; class Yr { constructor(e) { Object.defineProperty(this, "version", { @@ -8648,7 +8648,7 @@ class Yr { } _log(e, r) { const n = e.toLowerCase(); - Ad[n] == null && this.throwArgumentError("invalid log level name", "logLevel", e), !(gx > Ad[n]) && console.log.apply(console, r); + Ad[n] == null && this.throwArgumentError("invalid log level name", "logLevel", e), !(dx > Ad[n]) && console.log.apply(console, r); } debug(...e) { this._log(Yr.levels.DEBUG, e); @@ -8660,7 +8660,7 @@ class Yr { this._log(Yr.levels.WARNING, e); } makeError(e, r, n) { - if (px) + if (hx) return this.makeError("censored error", r, {}); r || (r = Yr.errors.UNKNOWN_ERROR), n || (n = {}); const i = []; @@ -8670,7 +8670,7 @@ class Yr { if (l instanceof Uint8Array) { let d = ""; for (let p = 0; p < l.length; p++) - d += vx[l[p] >> 4], d += vx[l[p] & 15]; + d += gx[l[p] >> 4], d += gx[l[p] & 15]; i.push(u + "=Uint8Array(0x" + d + ")"); } else i.push(u + "=" + JSON.stringify(l)); @@ -8732,9 +8732,9 @@ class Yr { e || this.throwArgumentError(r, n, i); } checkNormalize(e) { - mx && this.throwError("platform missing String.prototype.normalize", Yr.errors.UNSUPPORTED_OPERATION, { + px && this.throwError("platform missing String.prototype.normalize", Yr.errors.UNSUPPORTED_OPERATION, { operation: "String.prototype.normalize", - form: mx + form: px }); } checkSafeUint53(e, r) { @@ -8764,19 +8764,19 @@ class Yr { e === r ? this.throwError("cannot instantiate abstract class " + JSON.stringify(r.name) + " directly; use a sub-class", Yr.errors.UNSUPPORTED_OPERATION, { name: e.name, operation: "new" }) : (e === Object || e == null) && this.throwError("missing new", Yr.errors.MISSING_NEW, { name: r.name }); } static globalLogger() { - return Zg || (Zg = new Yr(SF)), Zg; + return Zg || (Zg = new Yr(AF)), Zg; } static setCensorship(e, r) { if (!e && r && this.globalLogger().throwError("cannot permanently disable censorship", Yr.errors.UNSUPPORTED_OPERATION, { operation: "setCensorship" - }), dx) { + }), lx) { if (!e) return; this.globalLogger().throwError("error censorship permanent", Yr.errors.UNSUPPORTED_OPERATION, { operation: "setCensorship" }); } - px = !!e, dx = !!r; + hx = !!e, lx = !!r; } static setLogLevel(e) { const r = Ad[e.toLowerCase()]; @@ -8784,7 +8784,7 @@ class Yr { Yr.globalLogger().warn("invalid log level - " + e); return; } - gx = r; + dx = r; } static from(e) { return new Yr(e); @@ -8792,8 +8792,8 @@ class Yr { } Yr.errors = ws; Yr.levels = y1; -const PF = "bytes/5.7.0", hn = new Yr(PF); -function V4(t) { +const MF = "bytes/5.7.0", hn = new Yr(MF); +function H4(t) { return !!t.toHexString; } function fu(t) { @@ -8802,10 +8802,10 @@ function fu(t) { return fu(new Uint8Array(Array.prototype.slice.apply(t, e))); }), t; } -function MF(t) { +function IF(t) { return zs(t) && !(t.length % 2) || Uv(t); } -function bx(t) { +function mx(t) { return typeof t == "number" && t == t && t % 1 === 0; } function Uv(t) { @@ -8813,11 +8813,11 @@ function Uv(t) { return !1; if (t.constructor === Uint8Array) return !0; - if (typeof t == "string" || !bx(t.length) || t.length < 0) + if (typeof t == "string" || !mx(t.length) || t.length < 0) return !1; for (let e = 0; e < t.length; e++) { const r = t[e]; - if (!bx(r) || r < 0 || r >= 256) + if (!mx(r) || r < 0 || r >= 256) return !1; } return !0; @@ -8830,7 +8830,7 @@ function wn(t, e) { r.unshift(t & 255), t = parseInt(String(t / 256)); return r.length === 0 && r.push(0), fu(new Uint8Array(r)); } - if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), V4(t) && (t = t.toHexString()), zs(t)) { + if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), H4(t) && (t = t.toHexString()), zs(t)) { let r = t.substring(2); r.length % 2 && (e.hexPad === "left" ? r = "0" + r : e.hexPad === "right" ? r += "0" : hn.throwArgumentError("hex data is odd-length", "value", t)); const n = []; @@ -8840,11 +8840,11 @@ function wn(t, e) { } return Uv(t) ? fu(new Uint8Array(t)) : hn.throwArgumentError("invalid arrayify value", "value", t); } -function IF(t) { +function CF(t) { const e = t.map((i) => wn(i)), r = e.reduce((i, s) => i + s.length, 0), n = new Uint8Array(r); return e.reduce((i, s) => (n.set(s, i), i + s.length), 0), fu(n); } -function CF(t, e) { +function TF(t, e) { t = wn(t), t.length > e && hn.throwArgumentError("value out of range", "value", arguments[0]); const r = new Uint8Array(e); return r.set(t, e - t.length), fu(r); @@ -8853,7 +8853,7 @@ function zs(t, e) { return !(typeof t != "string" || !t.match(/^0x[0-9A-Fa-f]*$/) || e && t.length !== 2 + 2 * e); } const Qg = "0123456789abcdef"; -function Ti(t, e) { +function Ri(t, e) { if (e || (e = {}), typeof t == "number") { hn.checkSafeUint53(t, "invalid hexlify value"); let r = ""; @@ -8863,7 +8863,7 @@ function Ti(t, e) { } if (typeof t == "bigint") return t = t.toString(16), t.length % 2 ? "0x0" + t : "0x" + t; - if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), V4(t)) + if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), H4(t)) return t.toHexString(); if (zs(t)) return t.length % 2 && (e.hexPad === "left" ? t = "0x0" + t.substring(2) : e.hexPad === "right" ? t += "0" : hn.throwArgumentError("hex data is odd-length", "value", t)), t.toLowerCase(); @@ -8877,22 +8877,22 @@ function Ti(t, e) { } return hn.throwArgumentError("invalid hexlify value", "value", t); } -function TF(t) { +function RF(t) { if (typeof t != "string") - t = Ti(t); + t = Ri(t); else if (!zs(t) || t.length % 2) return null; return (t.length - 2) / 2; } -function yx(t, e, r) { - return typeof t != "string" ? t = Ti(t) : (!zs(t) || t.length % 2) && hn.throwArgumentError("invalid hexData", "value", t), e = 2 + 2 * e, "0x" + t.substring(e); +function vx(t, e, r) { + return typeof t != "string" ? t = Ri(t) : (!zs(t) || t.length % 2) && hn.throwArgumentError("invalid hexData", "value", t), e = 2 + 2 * e, "0x" + t.substring(e); } function lu(t, e) { - for (typeof t != "string" ? t = Ti(t) : zs(t) || hn.throwArgumentError("invalid hex string", "value", t), t.length > 2 * e + 2 && hn.throwArgumentError("value out of range", "value", arguments[1]); t.length < 2 * e + 2; ) + for (typeof t != "string" ? t = Ri(t) : zs(t) || hn.throwArgumentError("invalid hex string", "value", t), t.length > 2 * e + 2 && hn.throwArgumentError("value out of range", "value", arguments[1]); t.length < 2 * e + 2; ) t = "0x0" + t.substring(2); return t; } -function G4(t) { +function K4(t) { const e = { r: "0x", s: "0x", @@ -8902,16 +8902,16 @@ function G4(t) { yParityAndS: "0x", compact: "0x" }; - if (MF(t)) { + if (IF(t)) { let r = wn(t); - r.length === 64 ? (e.v = 27 + (r[32] >> 7), r[32] &= 127, e.r = Ti(r.slice(0, 32)), e.s = Ti(r.slice(32, 64))) : r.length === 65 ? (e.r = Ti(r.slice(0, 32)), e.s = Ti(r.slice(32, 64)), e.v = r[64]) : hn.throwArgumentError("invalid signature string", "signature", t), e.v < 27 && (e.v === 0 || e.v === 1 ? e.v += 27 : hn.throwArgumentError("signature invalid v byte", "signature", t)), e.recoveryParam = 1 - e.v % 2, e.recoveryParam && (r[32] |= 128), e._vs = Ti(r.slice(32, 64)); + r.length === 64 ? (e.v = 27 + (r[32] >> 7), r[32] &= 127, e.r = Ri(r.slice(0, 32)), e.s = Ri(r.slice(32, 64))) : r.length === 65 ? (e.r = Ri(r.slice(0, 32)), e.s = Ri(r.slice(32, 64)), e.v = r[64]) : hn.throwArgumentError("invalid signature string", "signature", t), e.v < 27 && (e.v === 0 || e.v === 1 ? e.v += 27 : hn.throwArgumentError("signature invalid v byte", "signature", t)), e.recoveryParam = 1 - e.v % 2, e.recoveryParam && (r[32] |= 128), e._vs = Ri(r.slice(32, 64)); } else { if (e.r = t.r, e.s = t.s, e.v = t.v, e.recoveryParam = t.recoveryParam, e._vs = t._vs, e._vs != null) { - const i = CF(wn(e._vs), 32); - e._vs = Ti(i); + const i = TF(wn(e._vs), 32); + e._vs = Ri(i); const s = i[0] >= 128 ? 1 : 0; e.recoveryParam == null ? e.recoveryParam = s : e.recoveryParam !== s && hn.throwArgumentError("signature recoveryParam mismatch _vs", "signature", t), i[0] &= 127; - const o = Ti(i); + const o = Ri(i); e.s == null ? e.s = o : e.s !== o && hn.throwArgumentError("signature v mismatch _vs", "signature", t); } if (e.recoveryParam == null) @@ -8925,13 +8925,13 @@ function G4(t) { e.r == null || !zs(e.r) ? hn.throwArgumentError("signature missing or invalid r", "signature", t) : e.r = lu(e.r, 32), e.s == null || !zs(e.s) ? hn.throwArgumentError("signature missing or invalid s", "signature", t) : e.s = lu(e.s, 32); const r = wn(e.s); r[0] >= 128 && hn.throwArgumentError("signature s out of range", "signature", t), e.recoveryParam && (r[0] |= 128); - const n = Ti(r); + const n = Ri(r); e._vs && (zs(e._vs) || hn.throwArgumentError("signature invalid _vs", "signature", t), e._vs = lu(e._vs, 32)), e._vs == null ? e._vs = n : e._vs !== n && hn.throwArgumentError("signature _vs mismatch v and s", "signature", t); } return e.yParityAndS = e._vs, e.compact = e.r + e.yParityAndS.substring(2), e; } function qv(t) { - return "0x" + EF.keccak_256(wn(t)); + return "0x" + SF.keccak_256(wn(t)); } var zv = { exports: {} }; zv.exports; @@ -9018,16 +9018,16 @@ zv.exports; for (x = f.length - 1; x >= g; x -= 2) v = u(f, g, x) << _, this.words[E] |= v & 67108863, _ >= 18 ? (_ -= 18, E += 1, this.words[E] |= v >>> 26) : _ += 8; else { - var M = f.length - g; - for (x = M % 2 === 0 ? g + 1 : g; x < f.length; x += 2) + var P = f.length - g; + for (x = P % 2 === 0 ? g + 1 : g; x < f.length; x += 2) v = u(f, g, x) << _, this.words[E] |= v & 67108863, _ >= 18 ? (_ -= 18, E += 1, this.words[E] |= v >>> 26) : _ += 8; } this._strip(); }; function l(m, f, g, b) { for (var x = 0, _ = 0, E = Math.min(m.length, g), v = f; v < E; v++) { - var M = m.charCodeAt(v) - 48; - x *= b, M >= 49 ? _ = M - 49 + 10 : M >= 17 ? _ = M - 17 + 10 : _ = M, n(M >= 0 && _ < b, "Invalid character"), x += _; + var P = m.charCodeAt(v) - 48; + x *= b, P >= 49 ? _ = P - 49 + 10 : P >= 17 ? _ = P - 17 + 10 : _ = P, n(P >= 0 && _ < b, "Invalid character"), x += _; } return x; } @@ -9036,7 +9036,7 @@ zv.exports; for (var x = 0, _ = 1; _ <= 67108863; _ *= g) x++; x--, _ = _ / g | 0; - for (var E = f.length - b, v = E % x, M = Math.min(E, E - v) + b, I = 0, F = b; F < M; F += x) + for (var E = f.length - b, v = E % x, P = Math.min(E, E - v) + b, I = 0, F = b; F < P; F += x) I = l(f, F, F + x, g), this.imuln(_), this.words[0] + I < 67108864 ? this.words[0] += I : this._iaddn(I); if (v !== 0) { var ce = 1; @@ -9145,7 +9145,7 @@ zv.exports; 5, 5, 5 - ], P = [ + ], M = [ 0, 0, 33554432, @@ -9190,15 +9190,15 @@ zv.exports; if (f === 16 || f === "hex") { b = ""; for (var x = 0, _ = 0, E = 0; E < this.length; E++) { - var v = this.words[E], M = ((v << x | _) & 16777215).toString(16); - _ = v >>> 24 - x & 16777215, x += 2, x >= 26 && (x -= 26, E--), _ !== 0 || E !== this.length - 1 ? b = w[6 - M.length] + M + b : b = M + b; + var v = this.words[E], P = ((v << x | _) & 16777215).toString(16); + _ = v >>> 24 - x & 16777215, x += 2, x >= 26 && (x -= 26, E--), _ !== 0 || E !== this.length - 1 ? b = w[6 - P.length] + P + b : b = P + b; } for (_ !== 0 && (b = _.toString(16) + b); b.length % g !== 0; ) b = "0" + b; return this.negative !== 0 && (b = "-" + b), b; } if (f === (f | 0) && f >= 2 && f <= 36) { - var I = A[f], F = P[f]; + var I = A[f], F = M[f]; b = ""; var ce = this.clone(); for (ce.negative = 0; !ce.isZero(); ) { @@ -9380,70 +9380,70 @@ zv.exports; }, s.prototype.sub = function(f) { return this.clone().isub(f); }; - function $(m, f, g) { + function B(m, f, g) { g.negative = f.negative ^ m.negative; var b = m.length + f.length | 0; g.length = b, b = b - 1 | 0; - var x = m.words[0] | 0, _ = f.words[0] | 0, E = x * _, v = E & 67108863, M = E / 67108864 | 0; + var x = m.words[0] | 0, _ = f.words[0] | 0, E = x * _, v = E & 67108863, P = E / 67108864 | 0; g.words[0] = v; for (var I = 1; I < b; I++) { - for (var F = M >>> 26, ce = M & 67108863, D = Math.min(I, f.length - 1), oe = Math.max(0, I - m.length + 1); oe <= D; oe++) { + for (var F = P >>> 26, ce = P & 67108863, D = Math.min(I, f.length - 1), oe = Math.max(0, I - m.length + 1); oe <= D; oe++) { var Z = I - oe | 0; x = m.words[Z] | 0, _ = f.words[oe] | 0, E = x * _ + ce, F += E / 67108864 | 0, ce = E & 67108863; } - g.words[I] = ce | 0, M = F | 0; - } - return M !== 0 ? g.words[I] = M | 0 : g.length--, g._strip(); - } - var B = function(f, g, b) { - var x = f.words, _ = g.words, E = b.words, v = 0, M, I, F, ce = x[0] | 0, D = ce & 8191, oe = ce >>> 13, Z = x[1] | 0, J = Z & 8191, Q = Z >>> 13, T = x[2] | 0, X = T & 8191, re = T >>> 13, pe = x[3] | 0, ie = pe & 8191, ue = pe >>> 13, ve = x[4] | 0, Pe = ve & 8191, De = ve >>> 13, Ce = x[5] | 0, $e = Ce & 8191, Me = Ce >>> 13, Ne = x[6] | 0, Ke = Ne & 8191, Le = Ne >>> 13, qe = x[7] | 0, ze = qe & 8191, _e = qe >>> 13, Ze = x[8] | 0, at = Ze & 8191, ke = Ze >>> 13, Qe = x[9] | 0, tt = Qe & 8191, Ye = Qe >>> 13, dt = _[0] | 0, lt = dt & 8191, ct = dt >>> 13, qt = _[1] | 0, Jt = qt & 8191, Et = qt >>> 13, er = _[2] | 0, Xt = er & 8191, Dt = er >>> 13, kt = _[3] | 0, Ct = kt & 8191, gt = kt >>> 13, Rt = _[4] | 0, Nt = Rt & 8191, vt = Rt >>> 13, $t = _[5] | 0, Ft = $t & 8191, rt = $t >>> 13, Bt = _[6] | 0, k = Bt & 8191, U = Bt >>> 13, z = _[7] | 0, C = z & 8191, G = z >>> 13, j = _[8] | 0, se = j & 8191, de = j >>> 13, xe = _[9] | 0, Te = xe & 8191, Re = xe >>> 13; - b.negative = f.negative ^ g.negative, b.length = 19, M = Math.imul(D, lt), I = Math.imul(D, ct), I = I + Math.imul(oe, lt) | 0, F = Math.imul(oe, ct); - var nt = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, M = Math.imul(J, lt), I = Math.imul(J, ct), I = I + Math.imul(Q, lt) | 0, F = Math.imul(Q, ct), M = M + Math.imul(D, Jt) | 0, I = I + Math.imul(D, Et) | 0, I = I + Math.imul(oe, Jt) | 0, F = F + Math.imul(oe, Et) | 0; - var je = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (je >>> 26) | 0, je &= 67108863, M = Math.imul(X, lt), I = Math.imul(X, ct), I = I + Math.imul(re, lt) | 0, F = Math.imul(re, ct), M = M + Math.imul(J, Jt) | 0, I = I + Math.imul(J, Et) | 0, I = I + Math.imul(Q, Jt) | 0, F = F + Math.imul(Q, Et) | 0, M = M + Math.imul(D, Xt) | 0, I = I + Math.imul(D, Dt) | 0, I = I + Math.imul(oe, Xt) | 0, F = F + Math.imul(oe, Dt) | 0; - var pt = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (pt >>> 26) | 0, pt &= 67108863, M = Math.imul(ie, lt), I = Math.imul(ie, ct), I = I + Math.imul(ue, lt) | 0, F = Math.imul(ue, ct), M = M + Math.imul(X, Jt) | 0, I = I + Math.imul(X, Et) | 0, I = I + Math.imul(re, Jt) | 0, F = F + Math.imul(re, Et) | 0, M = M + Math.imul(J, Xt) | 0, I = I + Math.imul(J, Dt) | 0, I = I + Math.imul(Q, Xt) | 0, F = F + Math.imul(Q, Dt) | 0, M = M + Math.imul(D, Ct) | 0, I = I + Math.imul(D, gt) | 0, I = I + Math.imul(oe, Ct) | 0, F = F + Math.imul(oe, gt) | 0; - var it = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, M = Math.imul(Pe, lt), I = Math.imul(Pe, ct), I = I + Math.imul(De, lt) | 0, F = Math.imul(De, ct), M = M + Math.imul(ie, Jt) | 0, I = I + Math.imul(ie, Et) | 0, I = I + Math.imul(ue, Jt) | 0, F = F + Math.imul(ue, Et) | 0, M = M + Math.imul(X, Xt) | 0, I = I + Math.imul(X, Dt) | 0, I = I + Math.imul(re, Xt) | 0, F = F + Math.imul(re, Dt) | 0, M = M + Math.imul(J, Ct) | 0, I = I + Math.imul(J, gt) | 0, I = I + Math.imul(Q, Ct) | 0, F = F + Math.imul(Q, gt) | 0, M = M + Math.imul(D, Nt) | 0, I = I + Math.imul(D, vt) | 0, I = I + Math.imul(oe, Nt) | 0, F = F + Math.imul(oe, vt) | 0; - var et = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, M = Math.imul($e, lt), I = Math.imul($e, ct), I = I + Math.imul(Me, lt) | 0, F = Math.imul(Me, ct), M = M + Math.imul(Pe, Jt) | 0, I = I + Math.imul(Pe, Et) | 0, I = I + Math.imul(De, Jt) | 0, F = F + Math.imul(De, Et) | 0, M = M + Math.imul(ie, Xt) | 0, I = I + Math.imul(ie, Dt) | 0, I = I + Math.imul(ue, Xt) | 0, F = F + Math.imul(ue, Dt) | 0, M = M + Math.imul(X, Ct) | 0, I = I + Math.imul(X, gt) | 0, I = I + Math.imul(re, Ct) | 0, F = F + Math.imul(re, gt) | 0, M = M + Math.imul(J, Nt) | 0, I = I + Math.imul(J, vt) | 0, I = I + Math.imul(Q, Nt) | 0, F = F + Math.imul(Q, vt) | 0, M = M + Math.imul(D, Ft) | 0, I = I + Math.imul(D, rt) | 0, I = I + Math.imul(oe, Ft) | 0, F = F + Math.imul(oe, rt) | 0; - var St = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, M = Math.imul(Ke, lt), I = Math.imul(Ke, ct), I = I + Math.imul(Le, lt) | 0, F = Math.imul(Le, ct), M = M + Math.imul($e, Jt) | 0, I = I + Math.imul($e, Et) | 0, I = I + Math.imul(Me, Jt) | 0, F = F + Math.imul(Me, Et) | 0, M = M + Math.imul(Pe, Xt) | 0, I = I + Math.imul(Pe, Dt) | 0, I = I + Math.imul(De, Xt) | 0, F = F + Math.imul(De, Dt) | 0, M = M + Math.imul(ie, Ct) | 0, I = I + Math.imul(ie, gt) | 0, I = I + Math.imul(ue, Ct) | 0, F = F + Math.imul(ue, gt) | 0, M = M + Math.imul(X, Nt) | 0, I = I + Math.imul(X, vt) | 0, I = I + Math.imul(re, Nt) | 0, F = F + Math.imul(re, vt) | 0, M = M + Math.imul(J, Ft) | 0, I = I + Math.imul(J, rt) | 0, I = I + Math.imul(Q, Ft) | 0, F = F + Math.imul(Q, rt) | 0, M = M + Math.imul(D, k) | 0, I = I + Math.imul(D, U) | 0, I = I + Math.imul(oe, k) | 0, F = F + Math.imul(oe, U) | 0; - var Tt = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, M = Math.imul(ze, lt), I = Math.imul(ze, ct), I = I + Math.imul(_e, lt) | 0, F = Math.imul(_e, ct), M = M + Math.imul(Ke, Jt) | 0, I = I + Math.imul(Ke, Et) | 0, I = I + Math.imul(Le, Jt) | 0, F = F + Math.imul(Le, Et) | 0, M = M + Math.imul($e, Xt) | 0, I = I + Math.imul($e, Dt) | 0, I = I + Math.imul(Me, Xt) | 0, F = F + Math.imul(Me, Dt) | 0, M = M + Math.imul(Pe, Ct) | 0, I = I + Math.imul(Pe, gt) | 0, I = I + Math.imul(De, Ct) | 0, F = F + Math.imul(De, gt) | 0, M = M + Math.imul(ie, Nt) | 0, I = I + Math.imul(ie, vt) | 0, I = I + Math.imul(ue, Nt) | 0, F = F + Math.imul(ue, vt) | 0, M = M + Math.imul(X, Ft) | 0, I = I + Math.imul(X, rt) | 0, I = I + Math.imul(re, Ft) | 0, F = F + Math.imul(re, rt) | 0, M = M + Math.imul(J, k) | 0, I = I + Math.imul(J, U) | 0, I = I + Math.imul(Q, k) | 0, F = F + Math.imul(Q, U) | 0, M = M + Math.imul(D, C) | 0, I = I + Math.imul(D, G) | 0, I = I + Math.imul(oe, C) | 0, F = F + Math.imul(oe, G) | 0; - var At = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, M = Math.imul(at, lt), I = Math.imul(at, ct), I = I + Math.imul(ke, lt) | 0, F = Math.imul(ke, ct), M = M + Math.imul(ze, Jt) | 0, I = I + Math.imul(ze, Et) | 0, I = I + Math.imul(_e, Jt) | 0, F = F + Math.imul(_e, Et) | 0, M = M + Math.imul(Ke, Xt) | 0, I = I + Math.imul(Ke, Dt) | 0, I = I + Math.imul(Le, Xt) | 0, F = F + Math.imul(Le, Dt) | 0, M = M + Math.imul($e, Ct) | 0, I = I + Math.imul($e, gt) | 0, I = I + Math.imul(Me, Ct) | 0, F = F + Math.imul(Me, gt) | 0, M = M + Math.imul(Pe, Nt) | 0, I = I + Math.imul(Pe, vt) | 0, I = I + Math.imul(De, Nt) | 0, F = F + Math.imul(De, vt) | 0, M = M + Math.imul(ie, Ft) | 0, I = I + Math.imul(ie, rt) | 0, I = I + Math.imul(ue, Ft) | 0, F = F + Math.imul(ue, rt) | 0, M = M + Math.imul(X, k) | 0, I = I + Math.imul(X, U) | 0, I = I + Math.imul(re, k) | 0, F = F + Math.imul(re, U) | 0, M = M + Math.imul(J, C) | 0, I = I + Math.imul(J, G) | 0, I = I + Math.imul(Q, C) | 0, F = F + Math.imul(Q, G) | 0, M = M + Math.imul(D, se) | 0, I = I + Math.imul(D, de) | 0, I = I + Math.imul(oe, se) | 0, F = F + Math.imul(oe, de) | 0; - var _t = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, M = Math.imul(tt, lt), I = Math.imul(tt, ct), I = I + Math.imul(Ye, lt) | 0, F = Math.imul(Ye, ct), M = M + Math.imul(at, Jt) | 0, I = I + Math.imul(at, Et) | 0, I = I + Math.imul(ke, Jt) | 0, F = F + Math.imul(ke, Et) | 0, M = M + Math.imul(ze, Xt) | 0, I = I + Math.imul(ze, Dt) | 0, I = I + Math.imul(_e, Xt) | 0, F = F + Math.imul(_e, Dt) | 0, M = M + Math.imul(Ke, Ct) | 0, I = I + Math.imul(Ke, gt) | 0, I = I + Math.imul(Le, Ct) | 0, F = F + Math.imul(Le, gt) | 0, M = M + Math.imul($e, Nt) | 0, I = I + Math.imul($e, vt) | 0, I = I + Math.imul(Me, Nt) | 0, F = F + Math.imul(Me, vt) | 0, M = M + Math.imul(Pe, Ft) | 0, I = I + Math.imul(Pe, rt) | 0, I = I + Math.imul(De, Ft) | 0, F = F + Math.imul(De, rt) | 0, M = M + Math.imul(ie, k) | 0, I = I + Math.imul(ie, U) | 0, I = I + Math.imul(ue, k) | 0, F = F + Math.imul(ue, U) | 0, M = M + Math.imul(X, C) | 0, I = I + Math.imul(X, G) | 0, I = I + Math.imul(re, C) | 0, F = F + Math.imul(re, G) | 0, M = M + Math.imul(J, se) | 0, I = I + Math.imul(J, de) | 0, I = I + Math.imul(Q, se) | 0, F = F + Math.imul(Q, de) | 0, M = M + Math.imul(D, Te) | 0, I = I + Math.imul(D, Re) | 0, I = I + Math.imul(oe, Te) | 0, F = F + Math.imul(oe, Re) | 0; - var ht = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, M = Math.imul(tt, Jt), I = Math.imul(tt, Et), I = I + Math.imul(Ye, Jt) | 0, F = Math.imul(Ye, Et), M = M + Math.imul(at, Xt) | 0, I = I + Math.imul(at, Dt) | 0, I = I + Math.imul(ke, Xt) | 0, F = F + Math.imul(ke, Dt) | 0, M = M + Math.imul(ze, Ct) | 0, I = I + Math.imul(ze, gt) | 0, I = I + Math.imul(_e, Ct) | 0, F = F + Math.imul(_e, gt) | 0, M = M + Math.imul(Ke, Nt) | 0, I = I + Math.imul(Ke, vt) | 0, I = I + Math.imul(Le, Nt) | 0, F = F + Math.imul(Le, vt) | 0, M = M + Math.imul($e, Ft) | 0, I = I + Math.imul($e, rt) | 0, I = I + Math.imul(Me, Ft) | 0, F = F + Math.imul(Me, rt) | 0, M = M + Math.imul(Pe, k) | 0, I = I + Math.imul(Pe, U) | 0, I = I + Math.imul(De, k) | 0, F = F + Math.imul(De, U) | 0, M = M + Math.imul(ie, C) | 0, I = I + Math.imul(ie, G) | 0, I = I + Math.imul(ue, C) | 0, F = F + Math.imul(ue, G) | 0, M = M + Math.imul(X, se) | 0, I = I + Math.imul(X, de) | 0, I = I + Math.imul(re, se) | 0, F = F + Math.imul(re, de) | 0, M = M + Math.imul(J, Te) | 0, I = I + Math.imul(J, Re) | 0, I = I + Math.imul(Q, Te) | 0, F = F + Math.imul(Q, Re) | 0; - var xt = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, M = Math.imul(tt, Xt), I = Math.imul(tt, Dt), I = I + Math.imul(Ye, Xt) | 0, F = Math.imul(Ye, Dt), M = M + Math.imul(at, Ct) | 0, I = I + Math.imul(at, gt) | 0, I = I + Math.imul(ke, Ct) | 0, F = F + Math.imul(ke, gt) | 0, M = M + Math.imul(ze, Nt) | 0, I = I + Math.imul(ze, vt) | 0, I = I + Math.imul(_e, Nt) | 0, F = F + Math.imul(_e, vt) | 0, M = M + Math.imul(Ke, Ft) | 0, I = I + Math.imul(Ke, rt) | 0, I = I + Math.imul(Le, Ft) | 0, F = F + Math.imul(Le, rt) | 0, M = M + Math.imul($e, k) | 0, I = I + Math.imul($e, U) | 0, I = I + Math.imul(Me, k) | 0, F = F + Math.imul(Me, U) | 0, M = M + Math.imul(Pe, C) | 0, I = I + Math.imul(Pe, G) | 0, I = I + Math.imul(De, C) | 0, F = F + Math.imul(De, G) | 0, M = M + Math.imul(ie, se) | 0, I = I + Math.imul(ie, de) | 0, I = I + Math.imul(ue, se) | 0, F = F + Math.imul(ue, de) | 0, M = M + Math.imul(X, Te) | 0, I = I + Math.imul(X, Re) | 0, I = I + Math.imul(re, Te) | 0, F = F + Math.imul(re, Re) | 0; - var st = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, M = Math.imul(tt, Ct), I = Math.imul(tt, gt), I = I + Math.imul(Ye, Ct) | 0, F = Math.imul(Ye, gt), M = M + Math.imul(at, Nt) | 0, I = I + Math.imul(at, vt) | 0, I = I + Math.imul(ke, Nt) | 0, F = F + Math.imul(ke, vt) | 0, M = M + Math.imul(ze, Ft) | 0, I = I + Math.imul(ze, rt) | 0, I = I + Math.imul(_e, Ft) | 0, F = F + Math.imul(_e, rt) | 0, M = M + Math.imul(Ke, k) | 0, I = I + Math.imul(Ke, U) | 0, I = I + Math.imul(Le, k) | 0, F = F + Math.imul(Le, U) | 0, M = M + Math.imul($e, C) | 0, I = I + Math.imul($e, G) | 0, I = I + Math.imul(Me, C) | 0, F = F + Math.imul(Me, G) | 0, M = M + Math.imul(Pe, se) | 0, I = I + Math.imul(Pe, de) | 0, I = I + Math.imul(De, se) | 0, F = F + Math.imul(De, de) | 0, M = M + Math.imul(ie, Te) | 0, I = I + Math.imul(ie, Re) | 0, I = I + Math.imul(ue, Te) | 0, F = F + Math.imul(ue, Re) | 0; - var bt = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, M = Math.imul(tt, Nt), I = Math.imul(tt, vt), I = I + Math.imul(Ye, Nt) | 0, F = Math.imul(Ye, vt), M = M + Math.imul(at, Ft) | 0, I = I + Math.imul(at, rt) | 0, I = I + Math.imul(ke, Ft) | 0, F = F + Math.imul(ke, rt) | 0, M = M + Math.imul(ze, k) | 0, I = I + Math.imul(ze, U) | 0, I = I + Math.imul(_e, k) | 0, F = F + Math.imul(_e, U) | 0, M = M + Math.imul(Ke, C) | 0, I = I + Math.imul(Ke, G) | 0, I = I + Math.imul(Le, C) | 0, F = F + Math.imul(Le, G) | 0, M = M + Math.imul($e, se) | 0, I = I + Math.imul($e, de) | 0, I = I + Math.imul(Me, se) | 0, F = F + Math.imul(Me, de) | 0, M = M + Math.imul(Pe, Te) | 0, I = I + Math.imul(Pe, Re) | 0, I = I + Math.imul(De, Te) | 0, F = F + Math.imul(De, Re) | 0; - var ut = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, M = Math.imul(tt, Ft), I = Math.imul(tt, rt), I = I + Math.imul(Ye, Ft) | 0, F = Math.imul(Ye, rt), M = M + Math.imul(at, k) | 0, I = I + Math.imul(at, U) | 0, I = I + Math.imul(ke, k) | 0, F = F + Math.imul(ke, U) | 0, M = M + Math.imul(ze, C) | 0, I = I + Math.imul(ze, G) | 0, I = I + Math.imul(_e, C) | 0, F = F + Math.imul(_e, G) | 0, M = M + Math.imul(Ke, se) | 0, I = I + Math.imul(Ke, de) | 0, I = I + Math.imul(Le, se) | 0, F = F + Math.imul(Le, de) | 0, M = M + Math.imul($e, Te) | 0, I = I + Math.imul($e, Re) | 0, I = I + Math.imul(Me, Te) | 0, F = F + Math.imul(Me, Re) | 0; - var ot = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, M = Math.imul(tt, k), I = Math.imul(tt, U), I = I + Math.imul(Ye, k) | 0, F = Math.imul(Ye, U), M = M + Math.imul(at, C) | 0, I = I + Math.imul(at, G) | 0, I = I + Math.imul(ke, C) | 0, F = F + Math.imul(ke, G) | 0, M = M + Math.imul(ze, se) | 0, I = I + Math.imul(ze, de) | 0, I = I + Math.imul(_e, se) | 0, F = F + Math.imul(_e, de) | 0, M = M + Math.imul(Ke, Te) | 0, I = I + Math.imul(Ke, Re) | 0, I = I + Math.imul(Le, Te) | 0, F = F + Math.imul(Le, Re) | 0; - var Se = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, M = Math.imul(tt, C), I = Math.imul(tt, G), I = I + Math.imul(Ye, C) | 0, F = Math.imul(Ye, G), M = M + Math.imul(at, se) | 0, I = I + Math.imul(at, de) | 0, I = I + Math.imul(ke, se) | 0, F = F + Math.imul(ke, de) | 0, M = M + Math.imul(ze, Te) | 0, I = I + Math.imul(ze, Re) | 0, I = I + Math.imul(_e, Te) | 0, F = F + Math.imul(_e, Re) | 0; - var Ae = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, M = Math.imul(tt, se), I = Math.imul(tt, de), I = I + Math.imul(Ye, se) | 0, F = Math.imul(Ye, de), M = M + Math.imul(at, Te) | 0, I = I + Math.imul(at, Re) | 0, I = I + Math.imul(ke, Te) | 0, F = F + Math.imul(ke, Re) | 0; - var Ve = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (Ve >>> 26) | 0, Ve &= 67108863, M = Math.imul(tt, Te), I = Math.imul(tt, Re), I = I + Math.imul(Ye, Te) | 0, F = Math.imul(Ye, Re); - var Fe = (v + M | 0) + ((I & 8191) << 13) | 0; + g.words[I] = ce | 0, P = F | 0; + } + return P !== 0 ? g.words[I] = P | 0 : g.length--, g._strip(); + } + var $ = function(f, g, b) { + var x = f.words, _ = g.words, E = b.words, v = 0, P, I, F, ce = x[0] | 0, D = ce & 8191, oe = ce >>> 13, Z = x[1] | 0, J = Z & 8191, Q = Z >>> 13, T = x[2] | 0, X = T & 8191, re = T >>> 13, de = x[3] | 0, ie = de & 8191, ue = de >>> 13, ve = x[4] | 0, Pe = ve & 8191, De = ve >>> 13, Ce = x[5] | 0, $e = Ce & 8191, Me = Ce >>> 13, Ne = x[6] | 0, Ke = Ne & 8191, Le = Ne >>> 13, qe = x[7] | 0, ze = qe & 8191, _e = qe >>> 13, Ze = x[8] | 0, at = Ze & 8191, ke = Ze >>> 13, Qe = x[9] | 0, tt = Qe & 8191, Ye = Qe >>> 13, dt = _[0] | 0, lt = dt & 8191, ct = dt >>> 13, qt = _[1] | 0, Yt = qt & 8191, Et = qt >>> 13, er = _[2] | 0, Jt = er & 8191, Dt = er >>> 13, kt = _[3] | 0, Ct = kt & 8191, gt = kt >>> 13, Rt = _[4] | 0, Nt = Rt & 8191, vt = Rt >>> 13, $t = _[5] | 0, Ft = $t & 8191, rt = $t >>> 13, Bt = _[6] | 0, k = Bt & 8191, U = Bt >>> 13, z = _[7] | 0, C = z & 8191, G = z >>> 13, j = _[8] | 0, se = j & 8191, he = j >>> 13, xe = _[9] | 0, Te = xe & 8191, Re = xe >>> 13; + b.negative = f.negative ^ g.negative, b.length = 19, P = Math.imul(D, lt), I = Math.imul(D, ct), I = I + Math.imul(oe, lt) | 0, F = Math.imul(oe, ct); + var nt = (v + P | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, P = Math.imul(J, lt), I = Math.imul(J, ct), I = I + Math.imul(Q, lt) | 0, F = Math.imul(Q, ct), P = P + Math.imul(D, Yt) | 0, I = I + Math.imul(D, Et) | 0, I = I + Math.imul(oe, Yt) | 0, F = F + Math.imul(oe, Et) | 0; + var je = (v + P | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (je >>> 26) | 0, je &= 67108863, P = Math.imul(X, lt), I = Math.imul(X, ct), I = I + Math.imul(re, lt) | 0, F = Math.imul(re, ct), P = P + Math.imul(J, Yt) | 0, I = I + Math.imul(J, Et) | 0, I = I + Math.imul(Q, Yt) | 0, F = F + Math.imul(Q, Et) | 0, P = P + Math.imul(D, Jt) | 0, I = I + Math.imul(D, Dt) | 0, I = I + Math.imul(oe, Jt) | 0, F = F + Math.imul(oe, Dt) | 0; + var pt = (v + P | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (pt >>> 26) | 0, pt &= 67108863, P = Math.imul(ie, lt), I = Math.imul(ie, ct), I = I + Math.imul(ue, lt) | 0, F = Math.imul(ue, ct), P = P + Math.imul(X, Yt) | 0, I = I + Math.imul(X, Et) | 0, I = I + Math.imul(re, Yt) | 0, F = F + Math.imul(re, Et) | 0, P = P + Math.imul(J, Jt) | 0, I = I + Math.imul(J, Dt) | 0, I = I + Math.imul(Q, Jt) | 0, F = F + Math.imul(Q, Dt) | 0, P = P + Math.imul(D, Ct) | 0, I = I + Math.imul(D, gt) | 0, I = I + Math.imul(oe, Ct) | 0, F = F + Math.imul(oe, gt) | 0; + var it = (v + P | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, P = Math.imul(Pe, lt), I = Math.imul(Pe, ct), I = I + Math.imul(De, lt) | 0, F = Math.imul(De, ct), P = P + Math.imul(ie, Yt) | 0, I = I + Math.imul(ie, Et) | 0, I = I + Math.imul(ue, Yt) | 0, F = F + Math.imul(ue, Et) | 0, P = P + Math.imul(X, Jt) | 0, I = I + Math.imul(X, Dt) | 0, I = I + Math.imul(re, Jt) | 0, F = F + Math.imul(re, Dt) | 0, P = P + Math.imul(J, Ct) | 0, I = I + Math.imul(J, gt) | 0, I = I + Math.imul(Q, Ct) | 0, F = F + Math.imul(Q, gt) | 0, P = P + Math.imul(D, Nt) | 0, I = I + Math.imul(D, vt) | 0, I = I + Math.imul(oe, Nt) | 0, F = F + Math.imul(oe, vt) | 0; + var et = (v + P | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, P = Math.imul($e, lt), I = Math.imul($e, ct), I = I + Math.imul(Me, lt) | 0, F = Math.imul(Me, ct), P = P + Math.imul(Pe, Yt) | 0, I = I + Math.imul(Pe, Et) | 0, I = I + Math.imul(De, Yt) | 0, F = F + Math.imul(De, Et) | 0, P = P + Math.imul(ie, Jt) | 0, I = I + Math.imul(ie, Dt) | 0, I = I + Math.imul(ue, Jt) | 0, F = F + Math.imul(ue, Dt) | 0, P = P + Math.imul(X, Ct) | 0, I = I + Math.imul(X, gt) | 0, I = I + Math.imul(re, Ct) | 0, F = F + Math.imul(re, gt) | 0, P = P + Math.imul(J, Nt) | 0, I = I + Math.imul(J, vt) | 0, I = I + Math.imul(Q, Nt) | 0, F = F + Math.imul(Q, vt) | 0, P = P + Math.imul(D, Ft) | 0, I = I + Math.imul(D, rt) | 0, I = I + Math.imul(oe, Ft) | 0, F = F + Math.imul(oe, rt) | 0; + var St = (v + P | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, P = Math.imul(Ke, lt), I = Math.imul(Ke, ct), I = I + Math.imul(Le, lt) | 0, F = Math.imul(Le, ct), P = P + Math.imul($e, Yt) | 0, I = I + Math.imul($e, Et) | 0, I = I + Math.imul(Me, Yt) | 0, F = F + Math.imul(Me, Et) | 0, P = P + Math.imul(Pe, Jt) | 0, I = I + Math.imul(Pe, Dt) | 0, I = I + Math.imul(De, Jt) | 0, F = F + Math.imul(De, Dt) | 0, P = P + Math.imul(ie, Ct) | 0, I = I + Math.imul(ie, gt) | 0, I = I + Math.imul(ue, Ct) | 0, F = F + Math.imul(ue, gt) | 0, P = P + Math.imul(X, Nt) | 0, I = I + Math.imul(X, vt) | 0, I = I + Math.imul(re, Nt) | 0, F = F + Math.imul(re, vt) | 0, P = P + Math.imul(J, Ft) | 0, I = I + Math.imul(J, rt) | 0, I = I + Math.imul(Q, Ft) | 0, F = F + Math.imul(Q, rt) | 0, P = P + Math.imul(D, k) | 0, I = I + Math.imul(D, U) | 0, I = I + Math.imul(oe, k) | 0, F = F + Math.imul(oe, U) | 0; + var Tt = (v + P | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, P = Math.imul(ze, lt), I = Math.imul(ze, ct), I = I + Math.imul(_e, lt) | 0, F = Math.imul(_e, ct), P = P + Math.imul(Ke, Yt) | 0, I = I + Math.imul(Ke, Et) | 0, I = I + Math.imul(Le, Yt) | 0, F = F + Math.imul(Le, Et) | 0, P = P + Math.imul($e, Jt) | 0, I = I + Math.imul($e, Dt) | 0, I = I + Math.imul(Me, Jt) | 0, F = F + Math.imul(Me, Dt) | 0, P = P + Math.imul(Pe, Ct) | 0, I = I + Math.imul(Pe, gt) | 0, I = I + Math.imul(De, Ct) | 0, F = F + Math.imul(De, gt) | 0, P = P + Math.imul(ie, Nt) | 0, I = I + Math.imul(ie, vt) | 0, I = I + Math.imul(ue, Nt) | 0, F = F + Math.imul(ue, vt) | 0, P = P + Math.imul(X, Ft) | 0, I = I + Math.imul(X, rt) | 0, I = I + Math.imul(re, Ft) | 0, F = F + Math.imul(re, rt) | 0, P = P + Math.imul(J, k) | 0, I = I + Math.imul(J, U) | 0, I = I + Math.imul(Q, k) | 0, F = F + Math.imul(Q, U) | 0, P = P + Math.imul(D, C) | 0, I = I + Math.imul(D, G) | 0, I = I + Math.imul(oe, C) | 0, F = F + Math.imul(oe, G) | 0; + var At = (v + P | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, P = Math.imul(at, lt), I = Math.imul(at, ct), I = I + Math.imul(ke, lt) | 0, F = Math.imul(ke, ct), P = P + Math.imul(ze, Yt) | 0, I = I + Math.imul(ze, Et) | 0, I = I + Math.imul(_e, Yt) | 0, F = F + Math.imul(_e, Et) | 0, P = P + Math.imul(Ke, Jt) | 0, I = I + Math.imul(Ke, Dt) | 0, I = I + Math.imul(Le, Jt) | 0, F = F + Math.imul(Le, Dt) | 0, P = P + Math.imul($e, Ct) | 0, I = I + Math.imul($e, gt) | 0, I = I + Math.imul(Me, Ct) | 0, F = F + Math.imul(Me, gt) | 0, P = P + Math.imul(Pe, Nt) | 0, I = I + Math.imul(Pe, vt) | 0, I = I + Math.imul(De, Nt) | 0, F = F + Math.imul(De, vt) | 0, P = P + Math.imul(ie, Ft) | 0, I = I + Math.imul(ie, rt) | 0, I = I + Math.imul(ue, Ft) | 0, F = F + Math.imul(ue, rt) | 0, P = P + Math.imul(X, k) | 0, I = I + Math.imul(X, U) | 0, I = I + Math.imul(re, k) | 0, F = F + Math.imul(re, U) | 0, P = P + Math.imul(J, C) | 0, I = I + Math.imul(J, G) | 0, I = I + Math.imul(Q, C) | 0, F = F + Math.imul(Q, G) | 0, P = P + Math.imul(D, se) | 0, I = I + Math.imul(D, he) | 0, I = I + Math.imul(oe, se) | 0, F = F + Math.imul(oe, he) | 0; + var _t = (v + P | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, P = Math.imul(tt, lt), I = Math.imul(tt, ct), I = I + Math.imul(Ye, lt) | 0, F = Math.imul(Ye, ct), P = P + Math.imul(at, Yt) | 0, I = I + Math.imul(at, Et) | 0, I = I + Math.imul(ke, Yt) | 0, F = F + Math.imul(ke, Et) | 0, P = P + Math.imul(ze, Jt) | 0, I = I + Math.imul(ze, Dt) | 0, I = I + Math.imul(_e, Jt) | 0, F = F + Math.imul(_e, Dt) | 0, P = P + Math.imul(Ke, Ct) | 0, I = I + Math.imul(Ke, gt) | 0, I = I + Math.imul(Le, Ct) | 0, F = F + Math.imul(Le, gt) | 0, P = P + Math.imul($e, Nt) | 0, I = I + Math.imul($e, vt) | 0, I = I + Math.imul(Me, Nt) | 0, F = F + Math.imul(Me, vt) | 0, P = P + Math.imul(Pe, Ft) | 0, I = I + Math.imul(Pe, rt) | 0, I = I + Math.imul(De, Ft) | 0, F = F + Math.imul(De, rt) | 0, P = P + Math.imul(ie, k) | 0, I = I + Math.imul(ie, U) | 0, I = I + Math.imul(ue, k) | 0, F = F + Math.imul(ue, U) | 0, P = P + Math.imul(X, C) | 0, I = I + Math.imul(X, G) | 0, I = I + Math.imul(re, C) | 0, F = F + Math.imul(re, G) | 0, P = P + Math.imul(J, se) | 0, I = I + Math.imul(J, he) | 0, I = I + Math.imul(Q, se) | 0, F = F + Math.imul(Q, he) | 0, P = P + Math.imul(D, Te) | 0, I = I + Math.imul(D, Re) | 0, I = I + Math.imul(oe, Te) | 0, F = F + Math.imul(oe, Re) | 0; + var ht = (v + P | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, P = Math.imul(tt, Yt), I = Math.imul(tt, Et), I = I + Math.imul(Ye, Yt) | 0, F = Math.imul(Ye, Et), P = P + Math.imul(at, Jt) | 0, I = I + Math.imul(at, Dt) | 0, I = I + Math.imul(ke, Jt) | 0, F = F + Math.imul(ke, Dt) | 0, P = P + Math.imul(ze, Ct) | 0, I = I + Math.imul(ze, gt) | 0, I = I + Math.imul(_e, Ct) | 0, F = F + Math.imul(_e, gt) | 0, P = P + Math.imul(Ke, Nt) | 0, I = I + Math.imul(Ke, vt) | 0, I = I + Math.imul(Le, Nt) | 0, F = F + Math.imul(Le, vt) | 0, P = P + Math.imul($e, Ft) | 0, I = I + Math.imul($e, rt) | 0, I = I + Math.imul(Me, Ft) | 0, F = F + Math.imul(Me, rt) | 0, P = P + Math.imul(Pe, k) | 0, I = I + Math.imul(Pe, U) | 0, I = I + Math.imul(De, k) | 0, F = F + Math.imul(De, U) | 0, P = P + Math.imul(ie, C) | 0, I = I + Math.imul(ie, G) | 0, I = I + Math.imul(ue, C) | 0, F = F + Math.imul(ue, G) | 0, P = P + Math.imul(X, se) | 0, I = I + Math.imul(X, he) | 0, I = I + Math.imul(re, se) | 0, F = F + Math.imul(re, he) | 0, P = P + Math.imul(J, Te) | 0, I = I + Math.imul(J, Re) | 0, I = I + Math.imul(Q, Te) | 0, F = F + Math.imul(Q, Re) | 0; + var xt = (v + P | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, P = Math.imul(tt, Jt), I = Math.imul(tt, Dt), I = I + Math.imul(Ye, Jt) | 0, F = Math.imul(Ye, Dt), P = P + Math.imul(at, Ct) | 0, I = I + Math.imul(at, gt) | 0, I = I + Math.imul(ke, Ct) | 0, F = F + Math.imul(ke, gt) | 0, P = P + Math.imul(ze, Nt) | 0, I = I + Math.imul(ze, vt) | 0, I = I + Math.imul(_e, Nt) | 0, F = F + Math.imul(_e, vt) | 0, P = P + Math.imul(Ke, Ft) | 0, I = I + Math.imul(Ke, rt) | 0, I = I + Math.imul(Le, Ft) | 0, F = F + Math.imul(Le, rt) | 0, P = P + Math.imul($e, k) | 0, I = I + Math.imul($e, U) | 0, I = I + Math.imul(Me, k) | 0, F = F + Math.imul(Me, U) | 0, P = P + Math.imul(Pe, C) | 0, I = I + Math.imul(Pe, G) | 0, I = I + Math.imul(De, C) | 0, F = F + Math.imul(De, G) | 0, P = P + Math.imul(ie, se) | 0, I = I + Math.imul(ie, he) | 0, I = I + Math.imul(ue, se) | 0, F = F + Math.imul(ue, he) | 0, P = P + Math.imul(X, Te) | 0, I = I + Math.imul(X, Re) | 0, I = I + Math.imul(re, Te) | 0, F = F + Math.imul(re, Re) | 0; + var st = (v + P | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, P = Math.imul(tt, Ct), I = Math.imul(tt, gt), I = I + Math.imul(Ye, Ct) | 0, F = Math.imul(Ye, gt), P = P + Math.imul(at, Nt) | 0, I = I + Math.imul(at, vt) | 0, I = I + Math.imul(ke, Nt) | 0, F = F + Math.imul(ke, vt) | 0, P = P + Math.imul(ze, Ft) | 0, I = I + Math.imul(ze, rt) | 0, I = I + Math.imul(_e, Ft) | 0, F = F + Math.imul(_e, rt) | 0, P = P + Math.imul(Ke, k) | 0, I = I + Math.imul(Ke, U) | 0, I = I + Math.imul(Le, k) | 0, F = F + Math.imul(Le, U) | 0, P = P + Math.imul($e, C) | 0, I = I + Math.imul($e, G) | 0, I = I + Math.imul(Me, C) | 0, F = F + Math.imul(Me, G) | 0, P = P + Math.imul(Pe, se) | 0, I = I + Math.imul(Pe, he) | 0, I = I + Math.imul(De, se) | 0, F = F + Math.imul(De, he) | 0, P = P + Math.imul(ie, Te) | 0, I = I + Math.imul(ie, Re) | 0, I = I + Math.imul(ue, Te) | 0, F = F + Math.imul(ue, Re) | 0; + var bt = (v + P | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, P = Math.imul(tt, Nt), I = Math.imul(tt, vt), I = I + Math.imul(Ye, Nt) | 0, F = Math.imul(Ye, vt), P = P + Math.imul(at, Ft) | 0, I = I + Math.imul(at, rt) | 0, I = I + Math.imul(ke, Ft) | 0, F = F + Math.imul(ke, rt) | 0, P = P + Math.imul(ze, k) | 0, I = I + Math.imul(ze, U) | 0, I = I + Math.imul(_e, k) | 0, F = F + Math.imul(_e, U) | 0, P = P + Math.imul(Ke, C) | 0, I = I + Math.imul(Ke, G) | 0, I = I + Math.imul(Le, C) | 0, F = F + Math.imul(Le, G) | 0, P = P + Math.imul($e, se) | 0, I = I + Math.imul($e, he) | 0, I = I + Math.imul(Me, se) | 0, F = F + Math.imul(Me, he) | 0, P = P + Math.imul(Pe, Te) | 0, I = I + Math.imul(Pe, Re) | 0, I = I + Math.imul(De, Te) | 0, F = F + Math.imul(De, Re) | 0; + var ut = (v + P | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, P = Math.imul(tt, Ft), I = Math.imul(tt, rt), I = I + Math.imul(Ye, Ft) | 0, F = Math.imul(Ye, rt), P = P + Math.imul(at, k) | 0, I = I + Math.imul(at, U) | 0, I = I + Math.imul(ke, k) | 0, F = F + Math.imul(ke, U) | 0, P = P + Math.imul(ze, C) | 0, I = I + Math.imul(ze, G) | 0, I = I + Math.imul(_e, C) | 0, F = F + Math.imul(_e, G) | 0, P = P + Math.imul(Ke, se) | 0, I = I + Math.imul(Ke, he) | 0, I = I + Math.imul(Le, se) | 0, F = F + Math.imul(Le, he) | 0, P = P + Math.imul($e, Te) | 0, I = I + Math.imul($e, Re) | 0, I = I + Math.imul(Me, Te) | 0, F = F + Math.imul(Me, Re) | 0; + var ot = (v + P | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, P = Math.imul(tt, k), I = Math.imul(tt, U), I = I + Math.imul(Ye, k) | 0, F = Math.imul(Ye, U), P = P + Math.imul(at, C) | 0, I = I + Math.imul(at, G) | 0, I = I + Math.imul(ke, C) | 0, F = F + Math.imul(ke, G) | 0, P = P + Math.imul(ze, se) | 0, I = I + Math.imul(ze, he) | 0, I = I + Math.imul(_e, se) | 0, F = F + Math.imul(_e, he) | 0, P = P + Math.imul(Ke, Te) | 0, I = I + Math.imul(Ke, Re) | 0, I = I + Math.imul(Le, Te) | 0, F = F + Math.imul(Le, Re) | 0; + var Se = (v + P | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, P = Math.imul(tt, C), I = Math.imul(tt, G), I = I + Math.imul(Ye, C) | 0, F = Math.imul(Ye, G), P = P + Math.imul(at, se) | 0, I = I + Math.imul(at, he) | 0, I = I + Math.imul(ke, se) | 0, F = F + Math.imul(ke, he) | 0, P = P + Math.imul(ze, Te) | 0, I = I + Math.imul(ze, Re) | 0, I = I + Math.imul(_e, Te) | 0, F = F + Math.imul(_e, Re) | 0; + var Ae = (v + P | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, P = Math.imul(tt, se), I = Math.imul(tt, he), I = I + Math.imul(Ye, se) | 0, F = Math.imul(Ye, he), P = P + Math.imul(at, Te) | 0, I = I + Math.imul(at, Re) | 0, I = I + Math.imul(ke, Te) | 0, F = F + Math.imul(ke, Re) | 0; + var Ve = (v + P | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (Ve >>> 26) | 0, Ve &= 67108863, P = Math.imul(tt, Te), I = Math.imul(tt, Re), I = I + Math.imul(Ye, Te) | 0, F = Math.imul(Ye, Re); + var Fe = (v + P | 0) + ((I & 8191) << 13) | 0; return v = (F + (I >>> 13) | 0) + (Fe >>> 26) | 0, Fe &= 67108863, E[0] = nt, E[1] = je, E[2] = pt, E[3] = it, E[4] = et, E[5] = St, E[6] = Tt, E[7] = At, E[8] = _t, E[9] = ht, E[10] = xt, E[11] = st, E[12] = bt, E[13] = ut, E[14] = ot, E[15] = Se, E[16] = Ae, E[17] = Ve, E[18] = Fe, v !== 0 && (E[19] = v, b.length++), b; }; - Math.imul || (B = $); + Math.imul || ($ = B); function H(m, f, g) { g.negative = f.negative ^ m.negative, g.length = m.length + f.length; for (var b = 0, x = 0, _ = 0; _ < g.length - 1; _++) { var E = x; x = 0; - for (var v = b & 67108863, M = Math.min(_, f.length - 1), I = Math.max(0, _ - m.length + 1); I <= M; I++) { + for (var v = b & 67108863, P = Math.min(_, f.length - 1), I = Math.max(0, _ - m.length + 1); I <= P; I++) { var F = _ - I, ce = m.words[F] | 0, D = f.words[I] | 0, oe = ce * D, Z = oe & 67108863; E = E + (oe / 67108864 | 0) | 0, Z = Z + v | 0, v = Z & 67108863, E = E + (Z >>> 26) | 0, x += E >>> 26, E &= 67108863; } @@ -9456,7 +9456,7 @@ zv.exports; } s.prototype.mulTo = function(f, g) { var b, x = this.length + f.length; - return this.length === 10 && f.length === 10 ? b = B(this, f, g) : x < 63 ? b = $(this, f, g) : x < 1024 ? b = H(this, f, g) : b = W(this, f, g), b; + return this.length === 10 && f.length === 10 ? b = $(this, f, g) : x < 63 ? b = B(this, f, g) : x < 1024 ? b = H(this, f, g) : b = W(this, f, g), b; }, s.prototype.mul = function(f) { var g = new s(null); return g.words = new Array(this.length + f.length), this.mulTo(f, g); @@ -9494,8 +9494,8 @@ zv.exports; if (g !== 0) { var E = 0; for (_ = 0; _ < this.length; _++) { - var v = this.words[_] & x, M = (this.words[_] | 0) - v << g; - this.words[_] = M | E, E = v >>> 26 - g; + var v = this.words[_] & x, P = (this.words[_] | 0) - v << g; + this.words[_] = P | E, E = v >>> 26 - g; } E && (this.words[_] = E, this.length++); } @@ -9513,11 +9513,11 @@ zv.exports; n(typeof f == "number" && f >= 0); var x; g ? x = (g - g % 26) / 26 : x = 0; - var _ = f % 26, E = Math.min((f - _) / 26, this.length), v = 67108863 ^ 67108863 >>> _ << _, M = b; - if (x -= E, x = Math.max(0, x), M) { + var _ = f % 26, E = Math.min((f - _) / 26, this.length), v = 67108863 ^ 67108863 >>> _ << _, P = b; + if (x -= E, x = Math.max(0, x), P) { for (var I = 0; I < E; I++) - M.words[I] = this.words[I]; - M.length = E; + P.words[I] = this.words[I]; + P.length = E; } if (E !== 0) if (this.length > E) for (this.length -= E, I = 0; I < this.length; I++) @@ -9529,7 +9529,7 @@ zv.exports; var ce = this.words[I] | 0; this.words[I] = F << 26 - _ | ce >>> _, F = ce & v; } - return M && F !== 0 && (M.words[M.length++] = F), this.length === 0 && (this.words[0] = 0, this.length = 1), this._strip(); + return P && F !== 0 && (P.words[P.length++] = F), this.length === 0 && (this.words[0] = 0, this.length = 1), this._strip(); }, s.prototype.ishrn = function(f, g, b) { return n(this.negative === 0), this.iushrn(f, g, b); }, s.prototype.shln = function(f) { @@ -9589,8 +9589,8 @@ zv.exports; var E, v = 0; for (_ = 0; _ < f.length; _++) { E = (this.words[_ + b] | 0) + v; - var M = (f.words[_] | 0) * g; - E -= M & 67108863, v = (E >> 26) - (M / 67108864 | 0), this.words[_ + b] = E & 67108863; + var P = (f.words[_] | 0) * g; + E -= P & 67108863, v = (E >> 26) - (P / 67108864 | 0), this.words[_ + b] = E & 67108863; } for (; _ < this.length - b; _++) E = (this.words[_ + b] | 0) + v, v = E >> 26, this.words[_ + b] = E & 67108863; @@ -9601,15 +9601,15 @@ zv.exports; }, s.prototype._wordDiv = function(f, g) { var b = this.length - f.length, x = this.clone(), _ = f, E = _.words[_.length - 1] | 0, v = this._countBits(E); b = 26 - v, b !== 0 && (_ = _.ushln(b), x.iushln(b), E = _.words[_.length - 1] | 0); - var M = x.length - _.length, I; + var P = x.length - _.length, I; if (g !== "mod") { - I = new s(null), I.length = M + 1, I.words = new Array(I.length); + I = new s(null), I.length = P + 1, I.words = new Array(I.length); for (var F = 0; F < I.length; F++) I.words[F] = 0; } - var ce = x.clone()._ishlnsubmul(_, 1, M); - ce.negative === 0 && (x = ce, I && (I.words[M] = 1)); - for (var D = M - 1; D >= 0; D--) { + var ce = x.clone()._ishlnsubmul(_, 1, P); + ce.negative === 0 && (x = ce, I && (I.words[P] = 1)); + for (var D = P - 1; D >= 0; D--) { var oe = (x.words[_.length + D] | 0) * 67108864 + (x.words[_.length + D - 1] | 0); for (oe = Math.min(oe / E | 0, 67108863), x._ishlnsubmul(_, oe, D); x.negative !== 0; ) oe--, x.negative = 0, x._ishlnsubmul(_, 1, D), x.isZero() || (x.negative ^= 1); @@ -9681,8 +9681,8 @@ zv.exports; n(f.negative === 0), n(!f.isZero()); var g = this, b = f.clone(); g.negative !== 0 ? g = g.umod(f) : g = g.clone(); - for (var x = new s(1), _ = new s(0), E = new s(0), v = new s(1), M = 0; g.isEven() && b.isEven(); ) - g.iushrn(1), b.iushrn(1), ++M; + for (var x = new s(1), _ = new s(0), E = new s(0), v = new s(1), P = 0; g.isEven() && b.isEven(); ) + g.iushrn(1), b.iushrn(1), ++P; for (var I = b.clone(), F = g.clone(); !g.isZero(); ) { for (var ce = 0, D = 1; !(g.words[0] & D) && ce < 26; ++ce, D <<= 1) ; if (ce > 0) @@ -9697,14 +9697,14 @@ zv.exports; return { a: E, b: v, - gcd: b.iushln(M) + gcd: b.iushln(P) }; }, s.prototype._invmp = function(f) { n(f.negative === 0), n(!f.isZero()); var g = this, b = f.clone(); g.negative !== 0 ? g = g.umod(f) : g = g.clone(); for (var x = new s(1), _ = new s(0), E = b.clone(); g.cmpn(1) > 0 && b.cmpn(1) > 0; ) { - for (var v = 0, M = 1; !(g.words[0] & M) && v < 26; ++v, M <<= 1) ; + for (var v = 0, P = 1; !(g.words[0] & P) && v < 26; ++v, P <<= 1) ; if (v > 0) for (g.iushrn(v); v-- > 0; ) x.isOdd() && x.iadd(E), x.iushrn(1); @@ -9994,8 +9994,8 @@ zv.exports; for (var x = this.m.subn(1), _ = 0; !x.isZero() && x.andln(1) === 0; ) _++, x.iushrn(1); n(!x.isZero()); - var E = new s(1).toRed(this), v = E.redNeg(), M = this.m.subn(1).iushrn(1), I = this.m.bitLength(); - for (I = new s(2 * I * I).toRed(this); this.pow(I, M).cmp(v) !== 0; ) + var E = new s(1).toRed(this), v = E.redNeg(), P = this.m.subn(1).iushrn(1), I = this.m.bitLength(); + for (I = new s(2 * I * I).toRed(this); this.pow(I, P).cmp(v) !== 0; ) I.redIAdd(v); for (var F = this.pow(I, x), ce = this.pow(f, x.addn(1).iushrn(1)), D = this.pow(f, x), oe = _; D.cmp(E) !== 0; ) { for (var Z = D, J = 0; Z.cmp(E) !== 0; J++) @@ -10015,15 +10015,15 @@ zv.exports; x[0] = new s(1).toRed(this), x[1] = f; for (var _ = 2; _ < x.length; _++) x[_] = this.mul(x[_ - 1], f); - var E = x[0], v = 0, M = 0, I = g.bitLength() % 26; + var E = x[0], v = 0, P = 0, I = g.bitLength() % 26; for (I === 0 && (I = 26), _ = g.length - 1; _ >= 0; _--) { for (var F = g.words[_], ce = I - 1; ce >= 0; ce--) { var D = F >> ce & 1; if (E !== x[0] && (E = this.sqr(E)), D === 0 && v === 0) { - M = 0; + P = 0; continue; } - v <<= 1, v |= D, M++, !(M !== b && (_ !== 0 || ce !== 0)) && (E = this.mul(E, x[v]), M = 0, v = 0); + v <<= 1, v |= D, P++, !(P !== b && (_ !== 0 || ce !== 0)) && (E = this.mul(E, x[v]), P = 0, v = 0); } I = 26; } @@ -10060,23 +10060,23 @@ zv.exports; }; })(t, gn); })(zv); -var RF = zv.exports; -const sr = /* @__PURE__ */ rs(RF); -var DF = sr.BN; -function OF(t) { - return new DF(t, 36).toString(16); +var DF = zv.exports; +const sr = /* @__PURE__ */ ts(DF); +var OF = sr.BN; +function NF(t) { + return new OF(t, 36).toString(16); } -const NF = "strings/5.7.0", LF = new Yr(NF); +const LF = "strings/5.7.0", kF = new Yr(LF); var r0; (function(t) { t.current = "", t.NFC = "NFC", t.NFD = "NFD", t.NFKC = "NFKC", t.NFKD = "NFKD"; })(r0 || (r0 = {})); -var wx; +var bx; (function(t) { t.UNEXPECTED_CONTINUE = "unexpected continuation byte", t.BAD_PREFIX = "bad codepoint prefix", t.OVERRUN = "string overrun", t.MISSING_CONTINUE = "missing continuation byte", t.OUT_OF_RANGE = "out of UTF-8 range", t.UTF16_SURROGATE = "UTF-16 surrogate", t.OVERLONG = "overlong representation"; -})(wx || (wx = {})); +})(bx || (bx = {})); function em(t, e = r0.current) { - e != r0.current && (LF.checkNormalize(), t = t.normalize(e)); + e != r0.current && (kF.checkNormalize(), t = t.normalize(e)); let r = []; for (let n = 0; n < t.length; n++) { const i = t.charCodeAt(n); @@ -10096,17 +10096,17 @@ function em(t, e = r0.current) { } return wn(r); } -const kF = `Ethereum Signed Message: +const $F = `Ethereum Signed Message: `; -function Y4(t) { - return typeof t == "string" && (t = em(t)), qv(IF([ - em(kF), +function V4(t) { + return typeof t == "string" && (t = em(t)), qv(CF([ + em($F), em(String(t.length)), t ])); } -const $F = "address/5.7.0", $f = new Yr($F); -function xx(t) { +const BF = "address/5.7.0", $f = new Yr(BF); +function yx(t) { zs(t, 20) || $f.throwArgumentError("invalid address", "address", t), t = t.toLowerCase(); const e = t.substring(2).split(""), r = new Uint8Array(40); for (let i = 0; i < 40; i++) @@ -10116,8 +10116,8 @@ function xx(t) { n[i >> 1] >> 4 >= 8 && (e[i] = e[i].toUpperCase()), (n[i >> 1] & 15) >= 8 && (e[i + 1] = e[i + 1].toUpperCase()); return "0x" + e.join(""); } -const BF = 9007199254740991; -function FF(t) { +const FF = 9007199254740991; +function jF(t) { return Math.log10 ? Math.log10(t) : Math.log(t) / Math.LN10; } const Wv = {}; @@ -10125,12 +10125,12 @@ for (let t = 0; t < 10; t++) Wv[String(t)] = String(t); for (let t = 0; t < 26; t++) Wv[String.fromCharCode(65 + t)] = String(10 + t); -const _x = Math.floor(FF(BF)); -function jF(t) { +const wx = Math.floor(jF(FF)); +function UF(t) { t = t.toUpperCase(), t = t.substring(4) + t.substring(0, 2) + "00"; let e = t.split("").map((n) => Wv[n]).join(""); - for (; e.length >= _x; ) { - let n = e.substring(0, _x); + for (; e.length >= wx; ) { + let n = e.substring(0, wx); e = parseInt(n, 10) % 97 + e.substring(n.length); } let r = String(98 - parseInt(e, 10) % 97); @@ -10138,14 +10138,14 @@ function jF(t) { r = "0" + r; return r; } -function UF(t) { +function qF(t) { let e = null; if (typeof t != "string" && $f.throwArgumentError("invalid address", "address", t), t.match(/^(0x)?[0-9a-fA-F]{40}$/)) - t.substring(0, 2) !== "0x" && (t = "0x" + t), e = xx(t), t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && e !== t && $f.throwArgumentError("bad address checksum", "address", t); + t.substring(0, 2) !== "0x" && (t = "0x" + t), e = yx(t), t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && e !== t && $f.throwArgumentError("bad address checksum", "address", t); else if (t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { - for (t.substring(2, 4) !== jF(t) && $f.throwArgumentError("bad icap checksum", "address", t), e = OF(t.substring(4)); e.length < 40; ) + for (t.substring(2, 4) !== UF(t) && $f.throwArgumentError("bad icap checksum", "address", t), e = NF(t.substring(4)); e.length < 40; ) e = "0" + e; - e = xx("0x" + e); + e = yx("0x" + e); } else $f.throwArgumentError("invalid address", "address", t); return e; @@ -10157,12 +10157,12 @@ function _f(t, e, r) { writable: !1 }); } -var Vl = {}, xr = {}, wc = J4; -function J4(t, e) { +var Vl = {}, xr = {}, wc = G4; +function G4(t, e) { if (!t) throw new Error(e || "Assertion failed"); } -J4.equal = function(e, r, n) { +G4.equal = function(e, r, n) { if (e != r) throw new Error(n || "Assertion failed: " + e + " != " + r); }; @@ -10184,12 +10184,12 @@ typeof Object.create == "function" ? w1.exports = function(e, r) { n.prototype = r.prototype, e.prototype = new n(), e.prototype.constructor = e; } }; -var z0 = w1.exports, qF = wc, zF = z0; -xr.inherits = zF; -function WF(t, e) { +var z0 = w1.exports, zF = wc, WF = z0; +xr.inherits = WF; +function HF(t, e) { return (t.charCodeAt(e) & 64512) !== 55296 || e < 0 || e + 1 >= t.length ? !1 : (t.charCodeAt(e + 1) & 64512) === 56320; } -function HF(t, e) { +function KF(t, e) { if (Array.isArray(t)) return t.slice(); if (!t) @@ -10202,158 +10202,158 @@ function HF(t, e) { r.push(parseInt(t[i] + t[i + 1], 16)); } else for (var n = 0, i = 0; i < t.length; i++) { var s = t.charCodeAt(i); - s < 128 ? r[n++] = s : s < 2048 ? (r[n++] = s >> 6 | 192, r[n++] = s & 63 | 128) : WF(t, i) ? (s = 65536 + ((s & 1023) << 10) + (t.charCodeAt(++i) & 1023), r[n++] = s >> 18 | 240, r[n++] = s >> 12 & 63 | 128, r[n++] = s >> 6 & 63 | 128, r[n++] = s & 63 | 128) : (r[n++] = s >> 12 | 224, r[n++] = s >> 6 & 63 | 128, r[n++] = s & 63 | 128); + s < 128 ? r[n++] = s : s < 2048 ? (r[n++] = s >> 6 | 192, r[n++] = s & 63 | 128) : HF(t, i) ? (s = 65536 + ((s & 1023) << 10) + (t.charCodeAt(++i) & 1023), r[n++] = s >> 18 | 240, r[n++] = s >> 12 & 63 | 128, r[n++] = s >> 6 & 63 | 128, r[n++] = s & 63 | 128) : (r[n++] = s >> 12 | 224, r[n++] = s >> 6 & 63 | 128, r[n++] = s & 63 | 128); } else for (i = 0; i < t.length; i++) r[i] = t[i] | 0; return r; } -xr.toArray = HF; -function KF(t) { +xr.toArray = KF; +function VF(t) { for (var e = "", r = 0; r < t.length; r++) - e += Z4(t[r].toString(16)); + e += J4(t[r].toString(16)); return e; } -xr.toHex = KF; -function X4(t) { +xr.toHex = VF; +function Y4(t) { var e = t >>> 24 | t >>> 8 & 65280 | t << 8 & 16711680 | (t & 255) << 24; return e >>> 0; } -xr.htonl = X4; -function VF(t, e) { +xr.htonl = Y4; +function GF(t, e) { for (var r = "", n = 0; n < t.length; n++) { var i = t[n]; - e === "little" && (i = X4(i)), r += Q4(i.toString(16)); + e === "little" && (i = Y4(i)), r += X4(i.toString(16)); } return r; } -xr.toHex32 = VF; -function Z4(t) { +xr.toHex32 = GF; +function J4(t) { return t.length === 1 ? "0" + t : t; } -xr.zero2 = Z4; -function Q4(t) { +xr.zero2 = J4; +function X4(t) { return t.length === 7 ? "0" + t : t.length === 6 ? "00" + t : t.length === 5 ? "000" + t : t.length === 4 ? "0000" + t : t.length === 3 ? "00000" + t : t.length === 2 ? "000000" + t : t.length === 1 ? "0000000" + t : t; } -xr.zero8 = Q4; -function GF(t, e, r, n) { +xr.zero8 = X4; +function YF(t, e, r, n) { var i = r - e; - qF(i % 4 === 0); + zF(i % 4 === 0); for (var s = new Array(i / 4), o = 0, a = e; o < s.length; o++, a += 4) { var u; n === "big" ? u = t[a] << 24 | t[a + 1] << 16 | t[a + 2] << 8 | t[a + 3] : u = t[a + 3] << 24 | t[a + 2] << 16 | t[a + 1] << 8 | t[a], s[o] = u >>> 0; } return s; } -xr.join32 = GF; -function YF(t, e) { +xr.join32 = YF; +function JF(t, e) { for (var r = new Array(t.length * 4), n = 0, i = 0; n < t.length; n++, i += 4) { var s = t[n]; e === "big" ? (r[i] = s >>> 24, r[i + 1] = s >>> 16 & 255, r[i + 2] = s >>> 8 & 255, r[i + 3] = s & 255) : (r[i + 3] = s >>> 24, r[i + 2] = s >>> 16 & 255, r[i + 1] = s >>> 8 & 255, r[i] = s & 255); } return r; } -xr.split32 = YF; -function JF(t, e) { +xr.split32 = JF; +function XF(t, e) { return t >>> e | t << 32 - e; } -xr.rotr32 = JF; -function XF(t, e) { +xr.rotr32 = XF; +function ZF(t, e) { return t << e | t >>> 32 - e; } -xr.rotl32 = XF; -function ZF(t, e) { +xr.rotl32 = ZF; +function QF(t, e) { return t + e >>> 0; } -xr.sum32 = ZF; -function QF(t, e, r) { +xr.sum32 = QF; +function ej(t, e, r) { return t + e + r >>> 0; } -xr.sum32_3 = QF; -function ej(t, e, r, n) { +xr.sum32_3 = ej; +function tj(t, e, r, n) { return t + e + r + n >>> 0; } -xr.sum32_4 = ej; -function tj(t, e, r, n, i) { +xr.sum32_4 = tj; +function rj(t, e, r, n, i) { return t + e + r + n + i >>> 0; } -xr.sum32_5 = tj; -function rj(t, e, r, n) { +xr.sum32_5 = rj; +function nj(t, e, r, n) { var i = t[e], s = t[e + 1], o = n + s >>> 0, a = (o < n ? 1 : 0) + r + i; t[e] = a >>> 0, t[e + 1] = o; } -xr.sum64 = rj; -function nj(t, e, r, n) { +xr.sum64 = nj; +function ij(t, e, r, n) { var i = e + n >>> 0, s = (i < e ? 1 : 0) + t + r; return s >>> 0; } -xr.sum64_hi = nj; -function ij(t, e, r, n) { +xr.sum64_hi = ij; +function sj(t, e, r, n) { var i = e + n; return i >>> 0; } -xr.sum64_lo = ij; -function sj(t, e, r, n, i, s, o, a) { +xr.sum64_lo = sj; +function oj(t, e, r, n, i, s, o, a) { var u = 0, l = e; l = l + n >>> 0, u += l < e ? 1 : 0, l = l + s >>> 0, u += l < s ? 1 : 0, l = l + a >>> 0, u += l < a ? 1 : 0; var d = t + r + i + o + u; return d >>> 0; } -xr.sum64_4_hi = sj; -function oj(t, e, r, n, i, s, o, a) { +xr.sum64_4_hi = oj; +function aj(t, e, r, n, i, s, o, a) { var u = e + n + s + a; return u >>> 0; } -xr.sum64_4_lo = oj; -function aj(t, e, r, n, i, s, o, a, u, l) { +xr.sum64_4_lo = aj; +function cj(t, e, r, n, i, s, o, a, u, l) { var d = 0, p = e; p = p + n >>> 0, d += p < e ? 1 : 0, p = p + s >>> 0, d += p < s ? 1 : 0, p = p + a >>> 0, d += p < a ? 1 : 0, p = p + l >>> 0, d += p < l ? 1 : 0; var w = t + r + i + o + u + d; return w >>> 0; } -xr.sum64_5_hi = aj; -function cj(t, e, r, n, i, s, o, a, u, l) { +xr.sum64_5_hi = cj; +function uj(t, e, r, n, i, s, o, a, u, l) { var d = e + n + s + a + l; return d >>> 0; } -xr.sum64_5_lo = cj; -function uj(t, e, r) { +xr.sum64_5_lo = uj; +function fj(t, e, r) { var n = e << 32 - r | t >>> r; return n >>> 0; } -xr.rotr64_hi = uj; -function fj(t, e, r) { +xr.rotr64_hi = fj; +function lj(t, e, r) { var n = t << 32 - r | e >>> r; return n >>> 0; } -xr.rotr64_lo = fj; -function lj(t, e, r) { +xr.rotr64_lo = lj; +function hj(t, e, r) { return t >>> r; } -xr.shr64_hi = lj; -function hj(t, e, r) { +xr.shr64_hi = hj; +function dj(t, e, r) { var n = t << 32 - r | e >>> r; return n >>> 0; } -xr.shr64_lo = hj; -var Lu = {}, Ex = xr, dj = wc; +xr.shr64_lo = dj; +var Lu = {}, xx = xr, pj = wc; function W0() { this.pending = null, this.pendingTotal = 0, this.blockSize = this.constructor.blockSize, this.outSize = this.constructor.outSize, this.hmacStrength = this.constructor.hmacStrength, this.padLength = this.constructor.padLength / 8, this.endian = "big", this._delta8 = this.blockSize / 8, this._delta32 = this.blockSize / 32; } Lu.BlockHash = W0; W0.prototype.update = function(e, r) { - if (e = Ex.toArray(e, r), this.pending ? this.pending = this.pending.concat(e) : this.pending = e, this.pendingTotal += e.length, this.pending.length >= this._delta8) { + if (e = xx.toArray(e, r), this.pending ? this.pending = this.pending.concat(e) : this.pending = e, this.pendingTotal += e.length, this.pending.length >= this._delta8) { e = this.pending; var n = e.length % this._delta8; - this.pending = e.slice(e.length - n, e.length), this.pending.length === 0 && (this.pending = null), e = Ex.join32(e, 0, e.length - n, this.endian); + this.pending = e.slice(e.length - n, e.length), this.pending.length === 0 && (this.pending = null), e = xx.join32(e, 0, e.length - n, this.endian); for (var i = 0; i < e.length; i += this._delta32) this._update(e, i, i + this._delta32); } return this; }; W0.prototype.digest = function(e) { - return this.update(this._pad()), dj(this.pending === null), this._digest(e); + return this.update(this._pad()), pj(this.pending === null), this._digest(e); }; W0.prototype._pad = function() { var e = this.pendingTotal, r = this._delta8, n = r - (e + this.padLength) % r, i = new Array(n + this.padLength); @@ -10369,54 +10369,54 @@ W0.prototype._pad = function() { i[s++] = 0; return i; }; -var ku = {}, no = {}, pj = xr, Ws = pj.rotr32; -function gj(t, e, r, n) { +var ku = {}, ro = {}, gj = xr, Ws = gj.rotr32; +function mj(t, e, r, n) { if (t === 0) - return e8(e, r, n); + return Z4(e, r, n); if (t === 1 || t === 3) - return r8(e, r, n); + return e8(e, r, n); if (t === 2) - return t8(e, r, n); + return Q4(e, r, n); } -no.ft_1 = gj; -function e8(t, e, r) { +ro.ft_1 = mj; +function Z4(t, e, r) { return t & e ^ ~t & r; } -no.ch32 = e8; -function t8(t, e, r) { +ro.ch32 = Z4; +function Q4(t, e, r) { return t & e ^ t & r ^ e & r; } -no.maj32 = t8; -function r8(t, e, r) { +ro.maj32 = Q4; +function e8(t, e, r) { return t ^ e ^ r; } -no.p32 = r8; -function mj(t) { +ro.p32 = e8; +function vj(t) { return Ws(t, 2) ^ Ws(t, 13) ^ Ws(t, 22); } -no.s0_256 = mj; -function vj(t) { +ro.s0_256 = vj; +function bj(t) { return Ws(t, 6) ^ Ws(t, 11) ^ Ws(t, 25); } -no.s1_256 = vj; -function bj(t) { +ro.s1_256 = bj; +function yj(t) { return Ws(t, 7) ^ Ws(t, 18) ^ t >>> 3; } -no.g0_256 = bj; -function yj(t) { +ro.g0_256 = yj; +function wj(t) { return Ws(t, 17) ^ Ws(t, 19) ^ t >>> 10; } -no.g1_256 = yj; -var _u = xr, wj = Lu, xj = no, tm = _u.rotl32, Ef = _u.sum32, _j = _u.sum32_5, Ej = xj.ft_1, n8 = wj.BlockHash, Sj = [ +ro.g1_256 = wj; +var _u = xr, xj = Lu, _j = ro, tm = _u.rotl32, Ef = _u.sum32, Ej = _u.sum32_5, Sj = _j.ft_1, t8 = xj.BlockHash, Aj = [ 1518500249, 1859775393, 2400959708, 3395469782 ]; -function Xs() { - if (!(this instanceof Xs)) - return new Xs(); - n8.call(this), this.h = [ +function Js() { + if (!(this instanceof Js)) + return new Js(); + t8.call(this), this.h = [ 1732584193, 4023233417, 2562383102, @@ -10424,28 +10424,28 @@ function Xs() { 3285377520 ], this.W = new Array(80); } -_u.inherits(Xs, n8); -var Aj = Xs; -Xs.blockSize = 512; -Xs.outSize = 160; -Xs.hmacStrength = 80; -Xs.padLength = 64; -Xs.prototype._update = function(e, r) { +_u.inherits(Js, t8); +var Pj = Js; +Js.blockSize = 512; +Js.outSize = 160; +Js.hmacStrength = 80; +Js.padLength = 64; +Js.prototype._update = function(e, r) { for (var n = this.W, i = 0; i < 16; i++) n[i] = e[r + i]; for (; i < n.length; i++) n[i] = tm(n[i - 3] ^ n[i - 8] ^ n[i - 14] ^ n[i - 16], 1); var s = this.h[0], o = this.h[1], a = this.h[2], u = this.h[3], l = this.h[4]; for (i = 0; i < n.length; i++) { - var d = ~~(i / 20), p = _j(tm(s, 5), Ej(d, o, a, u), l, n[i], Sj[d]); + var d = ~~(i / 20), p = Ej(tm(s, 5), Sj(d, o, a, u), l, n[i], Aj[d]); l = u, u = a, a = tm(o, 30), o = s, s = p; } this.h[0] = Ef(this.h[0], s), this.h[1] = Ef(this.h[1], o), this.h[2] = Ef(this.h[2], a), this.h[3] = Ef(this.h[3], u), this.h[4] = Ef(this.h[4], l); }; -Xs.prototype._digest = function(e) { +Js.prototype._digest = function(e) { return e === "hex" ? _u.toHex32(this.h, "big") : _u.split32(this.h, "big"); }; -var Eu = xr, Pj = Lu, $u = no, Mj = wc, gs = Eu.sum32, Ij = Eu.sum32_4, Cj = Eu.sum32_5, Tj = $u.ch32, Rj = $u.maj32, Dj = $u.s0_256, Oj = $u.s1_256, Nj = $u.g0_256, Lj = $u.g1_256, i8 = Pj.BlockHash, kj = [ +var Eu = xr, Mj = Lu, $u = ro, Ij = wc, gs = Eu.sum32, Cj = Eu.sum32_4, Tj = Eu.sum32_5, Rj = $u.ch32, Dj = $u.maj32, Oj = $u.s0_256, Nj = $u.s1_256, Lj = $u.g0_256, kj = $u.g1_256, r8 = Mj.BlockHash, $j = [ 1116352408, 1899447441, 3049323471, @@ -10511,10 +10511,10 @@ var Eu = xr, Pj = Lu, $u = no, Mj = wc, gs = Eu.sum32, Ij = Eu.sum32_4, Cj = Eu. 3204031479, 3329325298 ]; -function Zs() { - if (!(this instanceof Zs)) - return new Zs(); - i8.call(this), this.h = [ +function Xs() { + if (!(this instanceof Xs)) + return new Xs(); + r8.call(this), this.h = [ 1779033703, 3144134277, 1013904242, @@ -10523,34 +10523,34 @@ function Zs() { 2600822924, 528734635, 1541459225 - ], this.k = kj, this.W = new Array(64); + ], this.k = $j, this.W = new Array(64); } -Eu.inherits(Zs, i8); -var s8 = Zs; -Zs.blockSize = 512; -Zs.outSize = 256; -Zs.hmacStrength = 192; -Zs.padLength = 64; -Zs.prototype._update = function(e, r) { +Eu.inherits(Xs, r8); +var n8 = Xs; +Xs.blockSize = 512; +Xs.outSize = 256; +Xs.hmacStrength = 192; +Xs.padLength = 64; +Xs.prototype._update = function(e, r) { for (var n = this.W, i = 0; i < 16; i++) n[i] = e[r + i]; for (; i < n.length; i++) - n[i] = Ij(Lj(n[i - 2]), n[i - 7], Nj(n[i - 15]), n[i - 16]); + n[i] = Cj(kj(n[i - 2]), n[i - 7], Lj(n[i - 15]), n[i - 16]); var s = this.h[0], o = this.h[1], a = this.h[2], u = this.h[3], l = this.h[4], d = this.h[5], p = this.h[6], w = this.h[7]; - for (Mj(this.k.length === n.length), i = 0; i < n.length; i++) { - var A = Cj(w, Oj(l), Tj(l, d, p), this.k[i], n[i]), P = gs(Dj(s), Rj(s, o, a)); - w = p, p = d, d = l, l = gs(u, A), u = a, a = o, o = s, s = gs(A, P); + for (Ij(this.k.length === n.length), i = 0; i < n.length; i++) { + var A = Tj(w, Nj(l), Rj(l, d, p), this.k[i], n[i]), M = gs(Oj(s), Dj(s, o, a)); + w = p, p = d, d = l, l = gs(u, A), u = a, a = o, o = s, s = gs(A, M); } this.h[0] = gs(this.h[0], s), this.h[1] = gs(this.h[1], o), this.h[2] = gs(this.h[2], a), this.h[3] = gs(this.h[3], u), this.h[4] = gs(this.h[4], l), this.h[5] = gs(this.h[5], d), this.h[6] = gs(this.h[6], p), this.h[7] = gs(this.h[7], w); }; -Zs.prototype._digest = function(e) { +Xs.prototype._digest = function(e) { return e === "hex" ? Eu.toHex32(this.h, "big") : Eu.split32(this.h, "big"); }; -var x1 = xr, o8 = s8; -function jo() { - if (!(this instanceof jo)) - return new jo(); - o8.call(this), this.h = [ +var x1 = xr, i8 = n8; +function Fo() { + if (!(this instanceof Fo)) + return new Fo(); + i8.call(this), this.h = [ 3238371032, 914150663, 812702999, @@ -10561,16 +10561,16 @@ function jo() { 3204075428 ]; } -x1.inherits(jo, o8); -var $j = jo; -jo.blockSize = 512; -jo.outSize = 224; -jo.hmacStrength = 192; -jo.padLength = 64; -jo.prototype._digest = function(e) { +x1.inherits(Fo, i8); +var Bj = Fo; +Fo.blockSize = 512; +Fo.outSize = 224; +Fo.hmacStrength = 192; +Fo.padLength = 64; +Fo.prototype._digest = function(e) { return e === "hex" ? x1.toHex32(this.h.slice(0, 7), "big") : x1.split32(this.h.slice(0, 7), "big"); }; -var xi = xr, Bj = Lu, Fj = wc, Hs = xi.rotr64_hi, Ks = xi.rotr64_lo, a8 = xi.shr64_hi, c8 = xi.shr64_lo, na = xi.sum64, rm = xi.sum64_hi, nm = xi.sum64_lo, jj = xi.sum64_4_hi, Uj = xi.sum64_4_lo, qj = xi.sum64_5_hi, zj = xi.sum64_5_lo, u8 = Bj.BlockHash, Wj = [ +var _i = xr, Fj = Lu, jj = wc, Hs = _i.rotr64_hi, Ks = _i.rotr64_lo, s8 = _i.shr64_hi, o8 = _i.shr64_lo, ta = _i.sum64, rm = _i.sum64_hi, nm = _i.sum64_lo, Uj = _i.sum64_4_hi, qj = _i.sum64_4_lo, zj = _i.sum64_5_hi, Wj = _i.sum64_5_lo, a8 = Fj.BlockHash, Hj = [ 1116352408, 3609767458, 1899447441, @@ -10735,7 +10735,7 @@ var xi = xr, Bj = Lu, Fj = wc, Hs = xi.rotr64_hi, Ks = xi.rotr64_lo, a8 = xi.shr function Ss() { if (!(this instanceof Ss)) return new Ss(); - u8.call(this), this.h = [ + a8.call(this), this.h = [ 1779033703, 4089235720, 3144134277, @@ -10752,10 +10752,10 @@ function Ss() { 4215389547, 1541459225, 327033209 - ], this.k = Wj, this.W = new Array(160); + ], this.k = Hj, this.W = new Array(160); } -xi.inherits(Ss, u8); -var f8 = Ss; +_i.inherits(Ss, a8); +var c8 = Ss; Ss.blockSize = 1024; Ss.outSize = 512; Ss.hmacStrength = 192; @@ -10764,8 +10764,8 @@ Ss.prototype._prepareBlock = function(e, r) { for (var n = this.W, i = 0; i < 32; i++) n[i] = e[r + i]; for (; i < n.length; i += 2) { - var s = tU(n[i - 4], n[i - 3]), o = rU(n[i - 4], n[i - 3]), a = n[i - 14], u = n[i - 13], l = Qj(n[i - 30], n[i - 29]), d = eU(n[i - 30], n[i - 29]), p = n[i - 32], w = n[i - 31]; - n[i] = jj( + var s = rU(n[i - 4], n[i - 3]), o = nU(n[i - 4], n[i - 3]), a = n[i - 14], u = n[i - 13], l = eU(n[i - 30], n[i - 29]), d = tU(n[i - 30], n[i - 29]), p = n[i - 32], w = n[i - 31]; + n[i] = Uj( s, o, a, @@ -10774,7 +10774,7 @@ Ss.prototype._prepareBlock = function(e, r) { d, p, w - ), n[i + 1] = Uj( + ), n[i + 1] = qj( s, o, a, @@ -10788,10 +10788,10 @@ Ss.prototype._prepareBlock = function(e, r) { }; Ss.prototype._update = function(e, r) { this._prepareBlock(e, r); - var n = this.W, i = this.h[0], s = this.h[1], o = this.h[2], a = this.h[3], u = this.h[4], l = this.h[5], d = this.h[6], p = this.h[7], w = this.h[8], A = this.h[9], P = this.h[10], N = this.h[11], L = this.h[12], $ = this.h[13], B = this.h[14], H = this.h[15]; - Fj(this.k.length === n.length); + var n = this.W, i = this.h[0], s = this.h[1], o = this.h[2], a = this.h[3], u = this.h[4], l = this.h[5], d = this.h[6], p = this.h[7], w = this.h[8], A = this.h[9], M = this.h[10], N = this.h[11], L = this.h[12], B = this.h[13], $ = this.h[14], H = this.h[15]; + jj(this.k.length === n.length); for (var W = 0; W < n.length; W += 2) { - var V = B, te = H, R = Xj(w, A), K = Zj(w, A), ge = Hj(w, A, P, N, L), Ee = Kj(w, A, P, N, L, $), Y = this.k[W], S = this.k[W + 1], m = n[W], f = n[W + 1], g = qj( + var V = $, te = H, R = Zj(w, A), K = Qj(w, A), ge = Kj(w, A, M, N, L), Ee = Vj(w, A, M, N, L, B), Y = this.k[W], S = this.k[W + 1], m = n[W], f = n[W + 1], g = zj( V, te, R, @@ -10802,7 +10802,7 @@ Ss.prototype._update = function(e, r) { S, m, f - ), b = zj( + ), b = Wj( V, te, R, @@ -10814,68 +10814,68 @@ Ss.prototype._update = function(e, r) { m, f ); - V = Yj(i, s), te = Jj(i, s), R = Vj(i, s, o, a, u), K = Gj(i, s, o, a, u, l); + V = Jj(i, s), te = Xj(i, s), R = Gj(i, s, o, a, u), K = Yj(i, s, o, a, u, l); var x = rm(V, te, R, K), _ = nm(V, te, R, K); - B = L, H = $, L = P, $ = N, P = w, N = A, w = rm(d, p, g, b), A = nm(p, p, g, b), d = u, p = l, u = o, l = a, o = i, a = s, i = rm(g, b, x, _), s = nm(g, b, x, _); + $ = L, H = B, L = M, B = N, M = w, N = A, w = rm(d, p, g, b), A = nm(p, p, g, b), d = u, p = l, u = o, l = a, o = i, a = s, i = rm(g, b, x, _), s = nm(g, b, x, _); } - na(this.h, 0, i, s), na(this.h, 2, o, a), na(this.h, 4, u, l), na(this.h, 6, d, p), na(this.h, 8, w, A), na(this.h, 10, P, N), na(this.h, 12, L, $), na(this.h, 14, B, H); + ta(this.h, 0, i, s), ta(this.h, 2, o, a), ta(this.h, 4, u, l), ta(this.h, 6, d, p), ta(this.h, 8, w, A), ta(this.h, 10, M, N), ta(this.h, 12, L, B), ta(this.h, 14, $, H); }; Ss.prototype._digest = function(e) { - return e === "hex" ? xi.toHex32(this.h, "big") : xi.split32(this.h, "big"); + return e === "hex" ? _i.toHex32(this.h, "big") : _i.split32(this.h, "big"); }; -function Hj(t, e, r, n, i) { +function Kj(t, e, r, n, i) { var s = t & r ^ ~t & i; return s < 0 && (s += 4294967296), s; } -function Kj(t, e, r, n, i, s) { +function Vj(t, e, r, n, i, s) { var o = e & n ^ ~e & s; return o < 0 && (o += 4294967296), o; } -function Vj(t, e, r, n, i) { +function Gj(t, e, r, n, i) { var s = t & r ^ t & i ^ r & i; return s < 0 && (s += 4294967296), s; } -function Gj(t, e, r, n, i, s) { +function Yj(t, e, r, n, i, s) { var o = e & n ^ e & s ^ n & s; return o < 0 && (o += 4294967296), o; } -function Yj(t, e) { - var r = Hs(t, e, 28), n = Hs(e, t, 2), i = Hs(e, t, 7), s = r ^ n ^ i; - return s < 0 && (s += 4294967296), s; -} function Jj(t, e) { - var r = Ks(t, e, 28), n = Ks(e, t, 2), i = Ks(e, t, 7), s = r ^ n ^ i; + var r = Hs(t, e, 28), n = Hs(e, t, 2), i = Hs(e, t, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } function Xj(t, e) { - var r = Hs(t, e, 14), n = Hs(t, e, 18), i = Hs(e, t, 9), s = r ^ n ^ i; + var r = Ks(t, e, 28), n = Ks(e, t, 2), i = Ks(e, t, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } function Zj(t, e) { - var r = Ks(t, e, 14), n = Ks(t, e, 18), i = Ks(e, t, 9), s = r ^ n ^ i; + var r = Hs(t, e, 14), n = Hs(t, e, 18), i = Hs(e, t, 9), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } function Qj(t, e) { - var r = Hs(t, e, 1), n = Hs(t, e, 8), i = a8(t, e, 7), s = r ^ n ^ i; + var r = Ks(t, e, 14), n = Ks(t, e, 18), i = Ks(e, t, 9), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } function eU(t, e) { - var r = Ks(t, e, 1), n = Ks(t, e, 8), i = c8(t, e, 7), s = r ^ n ^ i; + var r = Hs(t, e, 1), n = Hs(t, e, 8), i = s8(t, e, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } function tU(t, e) { - var r = Hs(t, e, 19), n = Hs(e, t, 29), i = a8(t, e, 6), s = r ^ n ^ i; + var r = Ks(t, e, 1), n = Ks(t, e, 8), i = o8(t, e, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } function rU(t, e) { - var r = Ks(t, e, 19), n = Ks(e, t, 29), i = c8(t, e, 6), s = r ^ n ^ i; + var r = Hs(t, e, 19), n = Hs(e, t, 29), i = s8(t, e, 6), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -var _1 = xr, l8 = f8; -function Uo() { - if (!(this instanceof Uo)) - return new Uo(); - l8.call(this), this.h = [ +function nU(t, e) { + var r = Ks(t, e, 19), n = Ks(e, t, 29), i = o8(t, e, 6), s = r ^ n ^ i; + return s < 0 && (s += 4294967296), s; +} +var _1 = xr, u8 = c8; +function jo() { + if (!(this instanceof jo)) + return new jo(); + u8.call(this), this.h = [ 3418070365, 3238371032, 1654270250, @@ -10894,64 +10894,64 @@ function Uo() { 3204075428 ]; } -_1.inherits(Uo, l8); -var nU = Uo; -Uo.blockSize = 1024; -Uo.outSize = 384; -Uo.hmacStrength = 192; -Uo.padLength = 128; -Uo.prototype._digest = function(e) { +_1.inherits(jo, u8); +var iU = jo; +jo.blockSize = 1024; +jo.outSize = 384; +jo.hmacStrength = 192; +jo.padLength = 128; +jo.prototype._digest = function(e) { return e === "hex" ? _1.toHex32(this.h.slice(0, 12), "big") : _1.split32(this.h.slice(0, 12), "big"); }; -ku.sha1 = Aj; -ku.sha224 = $j; -ku.sha256 = s8; -ku.sha384 = nU; -ku.sha512 = f8; -var h8 = {}, hc = xr, iU = Lu, ud = hc.rotl32, Sx = hc.sum32, Sf = hc.sum32_3, Ax = hc.sum32_4, d8 = iU.BlockHash; -function Qs() { - if (!(this instanceof Qs)) - return new Qs(); - d8.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = "little"; -} -hc.inherits(Qs, d8); -h8.ripemd160 = Qs; -Qs.blockSize = 512; -Qs.outSize = 160; -Qs.hmacStrength = 192; -Qs.padLength = 64; -Qs.prototype._update = function(e, r) { +ku.sha1 = Pj; +ku.sha224 = Bj; +ku.sha256 = n8; +ku.sha384 = iU; +ku.sha512 = c8; +var f8 = {}, lc = xr, sU = Lu, ud = lc.rotl32, _x = lc.sum32, Sf = lc.sum32_3, Ex = lc.sum32_4, l8 = sU.BlockHash; +function Zs() { + if (!(this instanceof Zs)) + return new Zs(); + l8.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = "little"; +} +lc.inherits(Zs, l8); +f8.ripemd160 = Zs; +Zs.blockSize = 512; +Zs.outSize = 160; +Zs.hmacStrength = 192; +Zs.padLength = 64; +Zs.prototype._update = function(e, r) { for (var n = this.h[0], i = this.h[1], s = this.h[2], o = this.h[3], a = this.h[4], u = n, l = i, d = s, p = o, w = a, A = 0; A < 80; A++) { - var P = Sx( + var M = _x( ud( - Ax(n, Px(A, i, s, o), e[aU[A] + r], sU(A)), - uU[A] + Ex(n, Sx(A, i, s, o), e[cU[A] + r], oU(A)), + fU[A] ), a ); - n = a, a = o, o = ud(s, 10), s = i, i = P, P = Sx( + n = a, a = o, o = ud(s, 10), s = i, i = M, M = _x( ud( - Ax(u, Px(79 - A, l, d, p), e[cU[A] + r], oU(A)), - fU[A] + Ex(u, Sx(79 - A, l, d, p), e[uU[A] + r], aU(A)), + lU[A] ), w - ), u = w, w = p, p = ud(d, 10), d = l, l = P; + ), u = w, w = p, p = ud(d, 10), d = l, l = M; } - P = Sf(this.h[1], s, p), this.h[1] = Sf(this.h[2], o, w), this.h[2] = Sf(this.h[3], a, u), this.h[3] = Sf(this.h[4], n, l), this.h[4] = Sf(this.h[0], i, d), this.h[0] = P; + M = Sf(this.h[1], s, p), this.h[1] = Sf(this.h[2], o, w), this.h[2] = Sf(this.h[3], a, u), this.h[3] = Sf(this.h[4], n, l), this.h[4] = Sf(this.h[0], i, d), this.h[0] = M; }; -Qs.prototype._digest = function(e) { - return e === "hex" ? hc.toHex32(this.h, "little") : hc.split32(this.h, "little"); +Zs.prototype._digest = function(e) { + return e === "hex" ? lc.toHex32(this.h, "little") : lc.split32(this.h, "little"); }; -function Px(t, e, r, n) { +function Sx(t, e, r, n) { return t <= 15 ? e ^ r ^ n : t <= 31 ? e & r | ~e & n : t <= 47 ? (e | ~r) ^ n : t <= 63 ? e & n | r & ~n : e ^ (r | ~n); } -function sU(t) { +function oU(t) { return t <= 15 ? 0 : t <= 31 ? 1518500249 : t <= 47 ? 1859775393 : t <= 63 ? 2400959708 : 2840853838; } -function oU(t) { +function aU(t) { return t <= 15 ? 1352829926 : t <= 31 ? 1548603684 : t <= 47 ? 1836072691 : t <= 63 ? 2053994217 : 0; } -var aU = [ +var cU = [ 0, 1, 2, @@ -11032,7 +11032,7 @@ var aU = [ 6, 15, 13 -], cU = [ +], uU = [ 5, 14, 7, @@ -11113,7 +11113,7 @@ var aU = [ 3, 9, 11 -], uU = [ +], fU = [ 11, 14, 15, @@ -11194,7 +11194,7 @@ var aU = [ 8, 5, 6 -], fU = [ +], lU = [ 8, 9, 9, @@ -11275,15 +11275,15 @@ var aU = [ 13, 11, 11 -], lU = xr, hU = wc; +], hU = xr, dU = wc; function Su(t, e, r) { if (!(this instanceof Su)) return new Su(t, e, r); - this.Hash = t, this.blockSize = t.blockSize / 8, this.outSize = t.outSize / 8, this.inner = null, this.outer = null, this._init(lU.toArray(e, r)); + this.Hash = t, this.blockSize = t.blockSize / 8, this.outSize = t.outSize / 8, this.inner = null, this.outer = null, this._init(hU.toArray(e, r)); } -var dU = Su; +var pU = Su; Su.prototype._init = function(e) { - e.length > this.blockSize && (e = new this.Hash().update(e).digest()), hU(e.length <= this.blockSize); + e.length > this.blockSize && (e = new this.Hash().update(e).digest()), dU(e.length <= this.blockSize); for (var r = e.length; r < this.blockSize; r++) e.push(0); for (r = 0; r < e.length; r++) @@ -11300,27 +11300,27 @@ Su.prototype.digest = function(e) { }; (function(t) { var e = t; - e.utils = xr, e.common = Lu, e.sha = ku, e.ripemd = h8, e.hmac = dU, e.sha1 = e.sha.sha1, e.sha256 = e.sha.sha256, e.sha224 = e.sha.sha224, e.sha384 = e.sha.sha384, e.sha512 = e.sha.sha512, e.ripemd160 = e.ripemd.ripemd160; + e.utils = xr, e.common = Lu, e.sha = ku, e.ripemd = f8, e.hmac = pU, e.sha1 = e.sha.sha1, e.sha256 = e.sha.sha256, e.sha224 = e.sha.sha224, e.sha384 = e.sha.sha384, e.sha512 = e.sha.sha512, e.ripemd160 = e.ripemd.ripemd160; })(Vl); -const xo = /* @__PURE__ */ rs(Vl); +const yo = /* @__PURE__ */ ts(Vl); function Bu(t, e, r) { return r = { path: e, exports: {}, require: function(n, i) { - return pU(n, i ?? r.path); + return gU(n, i ?? r.path); } }, t(r, r.exports), r.exports; } -function pU() { +function gU() { throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs"); } -var Hv = p8; -function p8(t, e) { +var Hv = h8; +function h8(t, e) { if (!t) throw new Error(e || "Assertion failed"); } -p8.equal = function(e, r, n) { +h8.equal = function(e, r, n) { if (e != r) throw new Error(n || "Assertion failed: " + e + " != " + r); }; @@ -11361,15 +11361,15 @@ var xs = Bu(function(t, e) { r.toHex = s, r.encode = function(a, u) { return u === "hex" ? s(a) : a; }; -}), Bi = Bu(function(t, e) { +}), $i = Bu(function(t, e) { var r = e; r.assert = Hv, r.toArray = xs.toArray, r.zero2 = xs.zero2, r.toHex = xs.toHex, r.encode = xs.encode; function n(u, l, d) { var p = new Array(Math.max(u.bitLength(), d) + 1); p.fill(0); - for (var w = 1 << l + 1, A = u.clone(), P = 0; P < p.length; P++) { + for (var w = 1 << l + 1, A = u.clone(), M = 0; M < p.length; M++) { var N, L = A.andln(w - 1); - A.isOdd() ? (L > (w >> 1) - 1 ? N = (w >> 1) - L : N = L, A.isubn(N)) : N = 0, p[P] = N, A.iushrn(1); + A.isOdd() ? (L > (w >> 1) - 1 ? N = (w >> 1) - L : N = L, A.isubn(N)) : N = 0, p[M] = N, A.iushrn(1); } return p; } @@ -11381,12 +11381,12 @@ var xs = Bu(function(t, e) { ]; u = u.clone(), l = l.clone(); for (var p = 0, w = 0, A; u.cmpn(-p) > 0 || l.cmpn(-w) > 0; ) { - var P = u.andln(3) + p & 3, N = l.andln(3) + w & 3; - P === 3 && (P = -1), N === 3 && (N = -1); + var M = u.andln(3) + p & 3, N = l.andln(3) + w & 3; + M === 3 && (M = -1), N === 3 && (N = -1); var L; - P & 1 ? (A = u.andln(7) + p & 7, (A === 3 || A === 5) && N === 2 ? L = -P : L = P) : L = 0, d[0].push(L); - var $; - N & 1 ? (A = l.andln(7) + w & 7, (A === 3 || A === 5) && P === 2 ? $ = -N : $ = N) : $ = 0, d[1].push($), 2 * p === L + 1 && (p = 1 - p), 2 * w === $ + 1 && (w = 1 - w), u.iushrn(1), l.iushrn(1); + M & 1 ? (A = u.andln(7) + p & 7, (A === 3 || A === 5) && N === 2 ? L = -M : L = M) : L = 0, d[0].push(L); + var B; + N & 1 ? (A = l.andln(7) + w & 7, (A === 3 || A === 5) && M === 2 ? B = -N : B = N) : B = 0, d[1].push(B), 2 * p === L + 1 && (p = 1 - p), 2 * w === B + 1 && (w = 1 - w), u.iushrn(1), l.iushrn(1); } return d; } @@ -11406,20 +11406,20 @@ var xs = Bu(function(t, e) { return new sr(u, "hex", "le"); } r.intFromLE = a; -}), n0 = Bi.getNAF, gU = Bi.getJSF, i0 = Bi.assert; -function Ta(t, e) { +}), n0 = $i.getNAF, mU = $i.getJSF, i0 = $i.assert; +function Ma(t, e) { this.type = t, this.p = new sr(e.p, 16), this.red = e.prime ? sr.red(e.prime) : sr.mont(this.p), this.zero = new sr(0).toRed(this.red), this.one = new sr(1).toRed(this.red), this.two = new sr(2).toRed(this.red), this.n = e.n && new sr(e.n, 16), this.g = e.g && this.pointFromJSON(e.g, e.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; var r = this.n && this.p.div(this.n); !r || r.cmpn(100) > 0 ? this.redN = null : (this._maxwellTrick = !0, this.redN = this.n.toRed(this.red)); } -var xc = Ta; -Ta.prototype.point = function() { +var xc = Ma; +Ma.prototype.point = function() { throw new Error("Not implemented"); }; -Ta.prototype.validate = function() { +Ma.prototype.validate = function() { throw new Error("Not implemented"); }; -Ta.prototype._fixedNafMul = function(e, r) { +Ma.prototype._fixedNafMul = function(e, r) { i0(e.precomputed); var n = e._getDoubles(), i = n0(r, 1, this._bitLength), s = (1 << n.step + 1) - (n.step % 2 === 0 ? 2 : 1); s /= 3; @@ -11437,7 +11437,7 @@ Ta.prototype._fixedNafMul = function(e, r) { } return d.toP(); }; -Ta.prototype._wnafMul = function(e, r) { +Ma.prototype._wnafMul = function(e, r) { var n = 4, i = e._getNAFPoints(n); n = i.wnd; for (var s = i.points, o = n0(r, n, this._bitLength), a = this.jpoint(null, null, null), u = o.length - 1; u >= 0; u--) { @@ -11450,7 +11450,7 @@ Ta.prototype._wnafMul = function(e, r) { } return e.type === "affine" ? a.toP() : a; }; -Ta.prototype._wnafMulAdd = function(e, r, n, i, s) { +Ma.prototype._wnafMulAdd = function(e, r, n, i, s) { var o = this._wnafT1, a = this._wnafT2, u = this._wnafT3, l = 0, d, p, w; for (d = 0; d < i; d++) { w = r[d]; @@ -11458,13 +11458,13 @@ Ta.prototype._wnafMulAdd = function(e, r, n, i, s) { o[d] = A.wnd, a[d] = A.points; } for (d = i - 1; d >= 1; d -= 2) { - var P = d - 1, N = d; - if (o[P] !== 1 || o[N] !== 1) { - u[P] = n0(n[P], o[P], this._bitLength), u[N] = n0(n[N], o[N], this._bitLength), l = Math.max(u[P].length, l), l = Math.max(u[N].length, l); + var M = d - 1, N = d; + if (o[M] !== 1 || o[N] !== 1) { + u[M] = n0(n[M], o[M], this._bitLength), u[N] = n0(n[N], o[N], this._bitLength), l = Math.max(u[M].length, l), l = Math.max(u[N].length, l); continue; } var L = [ - r[P], + r[M], /* 1 */ null, /* 3 */ @@ -11473,8 +11473,8 @@ Ta.prototype._wnafMulAdd = function(e, r, n, i, s) { r[N] /* 7 */ ]; - r[P].y.cmp(r[N].y) === 0 ? (L[1] = r[P].add(r[N]), L[2] = r[P].toJ().mixedAdd(r[N].neg())) : r[P].y.cmp(r[N].y.redNeg()) === 0 ? (L[1] = r[P].toJ().mixedAdd(r[N]), L[2] = r[P].add(r[N].neg())) : (L[1] = r[P].toJ().mixedAdd(r[N]), L[2] = r[P].toJ().mixedAdd(r[N].neg())); - var $ = [ + r[M].y.cmp(r[N].y) === 0 ? (L[1] = r[M].add(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())) : r[M].y.cmp(r[N].y.redNeg()) === 0 ? (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].add(r[N].neg())) : (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())); + var B = [ -3, /* -1 -1 */ -1, @@ -11493,10 +11493,10 @@ Ta.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 1 0 */ 3 /* 1 1 */ - ], B = gU(n[P], n[N]); - for (l = Math.max(B[0].length, l), u[P] = new Array(l), u[N] = new Array(l), p = 0; p < l; p++) { - var H = B[0][p] | 0, W = B[1][p] | 0; - u[P][p] = $[(H + 1) * 3 + (W + 1)], u[N][p] = 0, a[P] = L; + ], $ = mU(n[M], n[N]); + for (l = Math.max($[0].length, l), u[M] = new Array(l), u[N] = new Array(l), p = 0; p < l; p++) { + var H = $[0][p] | 0, W = $[1][p] | 0; + u[M][p] = B[(H + 1) * 3 + (W + 1)], u[N][p] = 0, a[M] = L; } } var V = this.jpoint(null, null, null), te = this._wnafT4; @@ -11520,18 +11520,18 @@ Ta.prototype._wnafMulAdd = function(e, r, n, i, s) { a[d] = null; return s ? V : V.toP(); }; -function is(t, e) { +function ns(t, e) { this.curve = t, this.type = e, this.precomputed = null; } -Ta.BasePoint = is; -is.prototype.eq = function() { +Ma.BasePoint = ns; +ns.prototype.eq = function() { throw new Error("Not implemented"); }; -is.prototype.validate = function() { +ns.prototype.validate = function() { return this.curve.validate(this); }; -Ta.prototype.decodePoint = function(e, r) { - e = Bi.toArray(e, r); +Ma.prototype.decodePoint = function(e, r) { + e = $i.toArray(e, r); var n = this.p.byteLength(); if ((e[0] === 4 || e[0] === 6 || e[0] === 7) && e.length - 1 === 2 * n) { e[0] === 6 ? i0(e[e.length - 1] % 2 === 0) : e[0] === 7 && i0(e[e.length - 1] % 2 === 1); @@ -11544,17 +11544,17 @@ Ta.prototype.decodePoint = function(e, r) { return this.pointFromX(e.slice(1, 1 + n), e[0] === 3); throw new Error("Unknown point format"); }; -is.prototype.encodeCompressed = function(e) { +ns.prototype.encodeCompressed = function(e) { return this.encode(e, !0); }; -is.prototype._encode = function(e) { +ns.prototype._encode = function(e) { var r = this.curve.p.byteLength(), n = this.getX().toArray("be", r); return e ? [this.getY().isEven() ? 2 : 3].concat(n) : [4].concat(n, this.getY().toArray("be", r)); }; -is.prototype.encode = function(e, r) { - return Bi.encode(this._encode(r), e); +ns.prototype.encode = function(e, r) { + return $i.encode(this._encode(r), e); }; -is.prototype.precompute = function(e) { +ns.prototype.precompute = function(e) { if (this.precomputed) return this; var r = { @@ -11564,13 +11564,13 @@ is.prototype.precompute = function(e) { }; return r.naf = this._getNAFPoints(8), r.doubles = this._getDoubles(4, e), r.beta = this._getBeta(), this.precomputed = r, this; }; -is.prototype._hasDoubles = function(e) { +ns.prototype._hasDoubles = function(e) { if (!this.precomputed) return !1; var r = this.precomputed.doubles; return r ? r.points.length >= Math.ceil((e.bitLength() + 1) / r.step) : !1; }; -is.prototype._getDoubles = function(e, r) { +ns.prototype._getDoubles = function(e, r) { if (this.precomputed && this.precomputed.doubles) return this.precomputed.doubles; for (var n = [this], i = this, s = 0; s < r; s += e) { @@ -11583,7 +11583,7 @@ is.prototype._getDoubles = function(e, r) { points: n }; }; -is.prototype._getNAFPoints = function(e) { +ns.prototype._getNAFPoints = function(e) { if (this.precomputed && this.precomputed.naf) return this.precomputed.naf; for (var r = [this], n = (1 << e) - 1, i = n === 1 ? null : this.dbl(), s = 1; s < n; s++) @@ -11593,10 +11593,10 @@ is.prototype._getNAFPoints = function(e) { points: r }; }; -is.prototype._getBeta = function() { +ns.prototype._getBeta = function() { return null; }; -is.prototype.dblp = function(e) { +ns.prototype.dblp = function(e) { for (var r = this, n = 0; n < e; n++) r = r.dbl(); return r; @@ -11619,13 +11619,13 @@ var Kv = Bu(function(t) { i.prototype = n.prototype, r.prototype = new i(), r.prototype.constructor = r; } }; -}), mU = Bi.assert; -function ss(t) { +}), vU = $i.assert; +function is(t) { xc.call(this, "short", t), this.a = new sr(t.a, 16).toRed(this.red), this.b = new sr(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); } -Kv(ss, xc); -var vU = ss; -ss.prototype._getEndomorphism = function(e) { +Kv(is, xc); +var bU = is; +is.prototype._getEndomorphism = function(e) { if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { var r, n; if (e.beta) @@ -11638,7 +11638,7 @@ ss.prototype._getEndomorphism = function(e) { n = new sr(e.lambda, 16); else { var s = this._getEndoRoots(this.n); - this.g.mul(s[0]).x.cmp(this.g.x.redMul(r)) === 0 ? n = s[0] : (n = s[1], mU(this.g.mul(n).x.cmp(this.g.x.redMul(r)) === 0)); + this.g.mul(s[0]).x.cmp(this.g.x.redMul(r)) === 0 ? n = s[0] : (n = s[1], vU(this.g.mul(n).x.cmp(this.g.x.redMul(r)) === 0)); } var o; return e.basis ? o = e.basis.map(function(a) { @@ -11653,33 +11653,33 @@ ss.prototype._getEndomorphism = function(e) { }; } }; -ss.prototype._getEndoRoots = function(e) { +is.prototype._getEndoRoots = function(e) { var r = e === this.p ? this.red : sr.mont(e), n = new sr(2).toRed(r).redInvm(), i = n.redNeg(), s = new sr(3).toRed(r).redNeg().redSqrt().redMul(n), o = i.redAdd(s).fromRed(), a = i.redSub(s).fromRed(); return [o, a]; }; -ss.prototype._getEndoBasis = function(e) { - for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new sr(1), o = new sr(0), a = new sr(0), u = new sr(1), l, d, p, w, A, P, N, L = 0, $, B; n.cmpn(0) !== 0; ) { +is.prototype._getEndoBasis = function(e) { + for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new sr(1), o = new sr(0), a = new sr(0), u = new sr(1), l, d, p, w, A, M, N, L = 0, B, $; n.cmpn(0) !== 0; ) { var H = i.div(n); - $ = i.sub(H.mul(n)), B = a.sub(H.mul(s)); + B = i.sub(H.mul(n)), $ = a.sub(H.mul(s)); var W = u.sub(H.mul(o)); - if (!p && $.cmp(r) < 0) - l = N.neg(), d = s, p = $.neg(), w = B; + if (!p && B.cmp(r) < 0) + l = N.neg(), d = s, p = B.neg(), w = $; else if (p && ++L === 2) break; - N = $, i = n, n = $, a = s, s = B, u = o, o = W; + N = B, i = n, n = B, a = s, s = $, u = o, o = W; } - A = $.neg(), P = B; - var V = p.sqr().add(w.sqr()), te = A.sqr().add(P.sqr()); - return te.cmp(V) >= 0 && (A = l, P = d), p.negative && (p = p.neg(), w = w.neg()), A.negative && (A = A.neg(), P = P.neg()), [ + A = B.neg(), M = $; + var V = p.sqr().add(w.sqr()), te = A.sqr().add(M.sqr()); + return te.cmp(V) >= 0 && (A = l, M = d), p.negative && (p = p.neg(), w = w.neg()), A.negative && (A = A.neg(), M = M.neg()), [ { a: p, b: w }, - { a: A, b: P } + { a: A, b: M } ]; }; -ss.prototype._endoSplit = function(e) { +is.prototype._endoSplit = function(e) { var r = this.endo.basis, n = r[0], i = r[1], s = i.b.mul(e).divRound(this.n), o = n.b.neg().mul(e).divRound(this.n), a = s.mul(n.a), u = o.mul(i.a), l = s.mul(n.b), d = o.mul(i.b), p = e.sub(a).sub(u), w = l.add(d).neg(); return { k1: p, k2: w }; }; -ss.prototype.pointFromX = function(e, r) { +is.prototype.pointFromX = function(e, r) { e = new sr(e, 16), e.red || (e = e.toRed(this.red)); var n = e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b), i = n.redSqrt(); if (i.redSqr().redSub(n).cmp(this.zero) !== 0) @@ -11687,13 +11687,13 @@ ss.prototype.pointFromX = function(e, r) { var s = i.fromRed().isOdd(); return (r && !s || !r && s) && (i = i.redNeg()), this.point(e, i); }; -ss.prototype.validate = function(e) { +is.prototype.validate = function(e) { if (e.inf) return !0; var r = e.x, n = e.y, i = this.a.redMul(r), s = r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b); return n.redSqr().redISub(s).cmpn(0) === 0; }; -ss.prototype._endoWnafMulAdd = function(e, r, n) { +is.prototype._endoWnafMulAdd = function(e, r, n) { for (var i = this._endoWnafT1, s = this._endoWnafT2, o = 0; o < e.length; o++) { var a = this._endoSplit(r[o]), u = e[o], l = u._getBeta(); a.k1.negative && (a.k1.ineg(), u = u.neg(!0)), a.k2.negative && (a.k2.ineg(), l = l.neg(!0)), i[o * 2] = u, i[o * 2 + 1] = l, s[o * 2] = a.k1, s[o * 2 + 1] = a.k2; @@ -11706,10 +11706,10 @@ function kn(t, e, r, n) { xc.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new sr(e, 16), this.y = new sr(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); } Kv(kn, xc.BasePoint); -ss.prototype.point = function(e, r, n) { +is.prototype.point = function(e, r, n) { return new kn(this, e, r, n); }; -ss.prototype.pointFromJSON = function(e, r) { +is.prototype.pointFromJSON = function(e, r) { return kn.fromJSON(this, e, r); }; kn.prototype._getBeta = function() { @@ -11848,23 +11848,23 @@ kn.prototype.toJ = function() { var e = this.curve.jpoint(this.x, this.y, this.curve.one); return e; }; -function zn(t, e, r, n) { +function Wn(t, e, r, n) { xc.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new sr(0)) : (this.x = new sr(e, 16), this.y = new sr(r, 16), this.z = new sr(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; } -Kv(zn, xc.BasePoint); -ss.prototype.jpoint = function(e, r, n) { - return new zn(this, e, r, n); +Kv(Wn, xc.BasePoint); +is.prototype.jpoint = function(e, r, n) { + return new Wn(this, e, r, n); }; -zn.prototype.toP = function() { +Wn.prototype.toP = function() { if (this.isInfinity()) return this.curve.point(null, null); var e = this.z.redInvm(), r = e.redSqr(), n = this.x.redMul(r), i = this.y.redMul(r).redMul(e); return this.curve.point(n, i); }; -zn.prototype.neg = function() { +Wn.prototype.neg = function() { return this.curve.jpoint(this.x, this.y.redNeg(), this.z); }; -zn.prototype.add = function(e) { +Wn.prototype.add = function(e) { if (this.isInfinity()) return e; if (e.isInfinity()) @@ -11872,10 +11872,10 @@ zn.prototype.add = function(e) { var r = e.z.redSqr(), n = this.z.redSqr(), i = this.x.redMul(r), s = e.x.redMul(n), o = this.y.redMul(r.redMul(e.z)), a = e.y.redMul(n.redMul(this.z)), u = i.redSub(s), l = o.redSub(a); if (u.cmpn(0) === 0) return l.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var d = u.redSqr(), p = d.redMul(u), w = i.redMul(d), A = l.redSqr().redIAdd(p).redISub(w).redISub(w), P = l.redMul(w.redISub(A)).redISub(o.redMul(p)), N = this.z.redMul(e.z).redMul(u); - return this.curve.jpoint(A, P, N); + var d = u.redSqr(), p = d.redMul(u), w = i.redMul(d), A = l.redSqr().redIAdd(p).redISub(w).redISub(w), M = l.redMul(w.redISub(A)).redISub(o.redMul(p)), N = this.z.redMul(e.z).redMul(u); + return this.curve.jpoint(A, M, N); }; -zn.prototype.mixedAdd = function(e) { +Wn.prototype.mixedAdd = function(e) { if (this.isInfinity()) return e.toJ(); if (e.isInfinity()) @@ -11883,10 +11883,10 @@ zn.prototype.mixedAdd = function(e) { var r = this.z.redSqr(), n = this.x, i = e.x.redMul(r), s = this.y, o = e.y.redMul(r).redMul(this.z), a = n.redSub(i), u = s.redSub(o); if (a.cmpn(0) === 0) return u.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var l = a.redSqr(), d = l.redMul(a), p = n.redMul(l), w = u.redSqr().redIAdd(d).redISub(p).redISub(p), A = u.redMul(p.redISub(w)).redISub(s.redMul(d)), P = this.z.redMul(a); - return this.curve.jpoint(w, A, P); + var l = a.redSqr(), d = l.redMul(a), p = n.redMul(l), w = u.redSqr().redIAdd(d).redISub(p).redISub(p), A = u.redMul(p.redISub(w)).redISub(s.redMul(d)), M = this.z.redMul(a); + return this.curve.jpoint(w, A, M); }; -zn.prototype.dblp = function(e) { +Wn.prototype.dblp = function(e) { if (e === 0) return this; if (this.isInfinity()) @@ -11902,17 +11902,17 @@ zn.prototype.dblp = function(e) { } var i = this.curve.a, s = this.curve.tinv, o = this.x, a = this.y, u = this.z, l = u.redSqr().redSqr(), d = a.redAdd(a); for (r = 0; r < e; r++) { - var p = o.redSqr(), w = d.redSqr(), A = w.redSqr(), P = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), N = o.redMul(w), L = P.redSqr().redISub(N.redAdd(N)), $ = N.redISub(L), B = P.redMul($); - B = B.redIAdd(B).redISub(A); + var p = o.redSqr(), w = d.redSqr(), A = w.redSqr(), M = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), N = o.redMul(w), L = M.redSqr().redISub(N.redAdd(N)), B = N.redISub(L), $ = M.redMul(B); + $ = $.redIAdd($).redISub(A); var H = d.redMul(u); - r + 1 < e && (l = l.redMul(A)), o = L, u = H, d = B; + r + 1 < e && (l = l.redMul(A)), o = L, u = H, d = $; } return this.curve.jpoint(o, d.redMul(s), u); }; -zn.prototype.dbl = function() { +Wn.prototype.dbl = function() { return this.isInfinity() ? this : this.curve.zeroA ? this._zeroDbl() : this.curve.threeA ? this._threeDbl() : this._dbl(); }; -zn.prototype._zeroDbl = function() { +Wn.prototype._zeroDbl = function() { var e, r, n; if (this.zOne) { var i = this.x.redSqr(), s = this.y.redSqr(), o = s.redSqr(), a = this.x.redAdd(s).redSqr().redISub(i).redISub(o); @@ -11920,14 +11920,14 @@ zn.prototype._zeroDbl = function() { var u = i.redAdd(i).redIAdd(i), l = u.redSqr().redISub(a).redISub(a), d = o.redIAdd(o); d = d.redIAdd(d), d = d.redIAdd(d), e = l, r = u.redMul(a.redISub(l)).redISub(d), n = this.y.redAdd(this.y); } else { - var p = this.x.redSqr(), w = this.y.redSqr(), A = w.redSqr(), P = this.x.redAdd(w).redSqr().redISub(p).redISub(A); - P = P.redIAdd(P); - var N = p.redAdd(p).redIAdd(p), L = N.redSqr(), $ = A.redIAdd(A); - $ = $.redIAdd($), $ = $.redIAdd($), e = L.redISub(P).redISub(P), r = N.redMul(P.redISub(e)).redISub($), n = this.y.redMul(this.z), n = n.redIAdd(n); + var p = this.x.redSqr(), w = this.y.redSqr(), A = w.redSqr(), M = this.x.redAdd(w).redSqr().redISub(p).redISub(A); + M = M.redIAdd(M); + var N = p.redAdd(p).redIAdd(p), L = N.redSqr(), B = A.redIAdd(A); + B = B.redIAdd(B), B = B.redIAdd(B), e = L.redISub(M).redISub(M), r = N.redMul(M.redISub(e)).redISub(B), n = this.y.redMul(this.z), n = n.redIAdd(n); } return this.curve.jpoint(e, r, n); }; -zn.prototype._threeDbl = function() { +Wn.prototype._threeDbl = function() { var e, r, n; if (this.zOne) { var i = this.x.redSqr(), s = this.y.redSqr(), o = s.redSqr(), a = this.x.redAdd(s).redSqr().redISub(i).redISub(o); @@ -11937,26 +11937,26 @@ zn.prototype._threeDbl = function() { var d = o.redIAdd(o); d = d.redIAdd(d), d = d.redIAdd(d), r = u.redMul(a.redISub(l)).redISub(d), n = this.y.redAdd(this.y); } else { - var p = this.z.redSqr(), w = this.y.redSqr(), A = this.x.redMul(w), P = this.x.redSub(p).redMul(this.x.redAdd(p)); - P = P.redAdd(P).redIAdd(P); + var p = this.z.redSqr(), w = this.y.redSqr(), A = this.x.redMul(w), M = this.x.redSub(p).redMul(this.x.redAdd(p)); + M = M.redAdd(M).redIAdd(M); var N = A.redIAdd(A); N = N.redIAdd(N); var L = N.redAdd(N); - e = P.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(p); - var $ = w.redSqr(); - $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($), r = P.redMul(N.redISub(e)).redISub($); + e = M.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(p); + var B = w.redSqr(); + B = B.redIAdd(B), B = B.redIAdd(B), B = B.redIAdd(B), r = M.redMul(N.redISub(e)).redISub(B); } return this.curve.jpoint(e, r, n); }; -zn.prototype._dbl = function() { +Wn.prototype._dbl = function() { var e = this.curve.a, r = this.x, n = this.y, i = this.z, s = i.redSqr().redSqr(), o = r.redSqr(), a = n.redSqr(), u = o.redAdd(o).redIAdd(o).redIAdd(e.redMul(s)), l = r.redAdd(r); l = l.redIAdd(l); var d = l.redMul(a), p = u.redSqr().redISub(d.redAdd(d)), w = d.redISub(p), A = a.redSqr(); A = A.redIAdd(A), A = A.redIAdd(A), A = A.redIAdd(A); - var P = u.redMul(w).redISub(A), N = n.redAdd(n).redMul(i); - return this.curve.jpoint(p, P, N); + var M = u.redMul(w).redISub(A), N = n.redAdd(n).redMul(i); + return this.curve.jpoint(p, M, N); }; -zn.prototype.trpl = function() { +Wn.prototype.trpl = function() { if (!this.curve.zeroA) return this.dbl().add(this); var e = this.x.redSqr(), r = this.y.redSqr(), n = this.z.redSqr(), i = r.redSqr(), s = e.redAdd(e).redIAdd(e), o = s.redSqr(), a = this.x.redAdd(r).redSqr().redISub(e).redISub(i); @@ -11969,13 +11969,13 @@ zn.prototype.trpl = function() { w = w.redIAdd(w), w = w.redIAdd(w); var A = this.y.redMul(d.redMul(l.redISub(d)).redISub(a.redMul(u))); A = A.redIAdd(A), A = A.redIAdd(A), A = A.redIAdd(A); - var P = this.z.redAdd(a).redSqr().redISub(n).redISub(u); - return this.curve.jpoint(w, A, P); + var M = this.z.redAdd(a).redSqr().redISub(n).redISub(u); + return this.curve.jpoint(w, A, M); }; -zn.prototype.mul = function(e, r) { +Wn.prototype.mul = function(e, r) { return e = new sr(e, r), this.curve._wnafMul(this, e); }; -zn.prototype.eq = function(e) { +Wn.prototype.eq = function(e) { if (e.type === "affine") return this.eq(e.toJ()); if (this === e) @@ -11986,7 +11986,7 @@ zn.prototype.eq = function(e) { var i = r.redMul(this.z), s = n.redMul(e.z); return this.y.redMul(s).redISub(e.y.redMul(i)).cmpn(0) === 0; }; -zn.prototype.eqXToP = function(e) { +Wn.prototype.eqXToP = function(e) { var r = this.z.redSqr(), n = e.toRed(this.curve.red).redMul(r); if (this.x.cmp(n) === 0) return !0; @@ -11997,19 +11997,19 @@ zn.prototype.eqXToP = function(e) { return !0; } }; -zn.prototype.inspect = function() { +Wn.prototype.inspect = function() { return this.isInfinity() ? "" : ""; }; -zn.prototype.isInfinity = function() { +Wn.prototype.isInfinity = function() { return this.z.cmpn(0) === 0; }; var Pd = Bu(function(t, e) { var r = e; - r.base = xc, r.short = vU, r.mont = /*RicMoo:ethers:require(./mont)*/ + r.base = xc, r.short = bU, r.mont = /*RicMoo:ethers:require(./mont)*/ null, r.edwards = /*RicMoo:ethers:require(./edwards)*/ null; }), Md = Bu(function(t, e) { - var r = e, n = Bi.assert; + var r = e, n = $i.assert; function i(a) { a.type === "short" ? this.curve = new Pd.short(a) : a.type === "edwards" ? this.curve = new Pd.edwards(a) : this.curve = new Pd.mont(a), this.g = this.curve.g, this.n = this.curve.n, this.hash = a.hash, n(this.g.validate(), "Invalid curve"), n(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); } @@ -12035,7 +12035,7 @@ var Pd = Bu(function(t, e) { a: "ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc", b: "64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1", n: "ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831", - hash: xo.sha256, + hash: yo.sha256, gRed: !1, g: [ "188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012", @@ -12048,7 +12048,7 @@ var Pd = Bu(function(t, e) { a: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe", b: "b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4", n: "ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d", - hash: xo.sha256, + hash: yo.sha256, gRed: !1, g: [ "b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21", @@ -12061,7 +12061,7 @@ var Pd = Bu(function(t, e) { a: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc", b: "5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b", n: "ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551", - hash: xo.sha256, + hash: yo.sha256, gRed: !1, g: [ "6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296", @@ -12074,7 +12074,7 @@ var Pd = Bu(function(t, e) { a: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc", b: "b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef", n: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973", - hash: xo.sha384, + hash: yo.sha384, gRed: !1, g: [ "aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7", @@ -12087,7 +12087,7 @@ var Pd = Bu(function(t, e) { a: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc", b: "00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00", n: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409", - hash: xo.sha512, + hash: yo.sha512, gRed: !1, g: [ "000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66", @@ -12100,7 +12100,7 @@ var Pd = Bu(function(t, e) { a: "76d06", b: "1", n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", - hash: xo.sha256, + hash: yo.sha256, gRed: !1, g: [ "9" @@ -12114,7 +12114,7 @@ var Pd = Bu(function(t, e) { // -121665 * (121666^(-1)) (mod P) d: "52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3", n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", - hash: xo.sha256, + hash: yo.sha256, gRed: !1, g: [ "216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a", @@ -12137,7 +12137,7 @@ var Pd = Bu(function(t, e) { b: "7", n: "ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141", h: "1", - hash: xo.sha256, + hash: yo.sha256, // Precomputed endomorphism beta: "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee", lambda: "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72", @@ -12159,9 +12159,9 @@ var Pd = Bu(function(t, e) { ] }); }); -function wa(t) { - if (!(this instanceof wa)) - return new wa(t); +function ba(t) { + if (!(this instanceof ba)) + return new ba(t); this.hash = t.hash, this.predResist = !!t.predResist, this.outLen = this.hash.outSize, this.minEntropy = t.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null; var e = xs.toArray(t.entropy, t.entropyEnc || "hex"), r = xs.toArray(t.nonce, t.nonceEnc || "hex"), n = xs.toArray(t.pers, t.persEnc || "hex"); Hv( @@ -12169,28 +12169,28 @@ function wa(t) { "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._init(e, r, n); } -var g8 = wa; -wa.prototype._init = function(e, r, n) { +var d8 = ba; +ba.prototype._init = function(e, r, n) { var i = e.concat(r).concat(n); this.K = new Array(this.outLen / 8), this.V = new Array(this.outLen / 8); for (var s = 0; s < this.V.length; s++) this.K[s] = 0, this.V[s] = 1; this._update(i), this._reseed = 1, this.reseedInterval = 281474976710656; }; -wa.prototype._hmac = function() { - return new xo.hmac(this.hash, this.K); +ba.prototype._hmac = function() { + return new yo.hmac(this.hash, this.K); }; -wa.prototype._update = function(e) { +ba.prototype._update = function(e) { var r = this._hmac().update(this.V).update([0]); e && (r = r.update(e)), this.K = r.digest(), this.V = this._hmac().update(this.V).digest(), e && (this.K = this._hmac().update(this.V).update([1]).update(e).digest(), this.V = this._hmac().update(this.V).digest()); }; -wa.prototype.reseed = function(e, r, n, i) { +ba.prototype.reseed = function(e, r, n, i) { typeof r != "string" && (i = n, n = r, r = null), e = xs.toArray(e, r), n = xs.toArray(n, i), Hv( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._update(e.concat(n || [])), this._reseed = 1; }; -wa.prototype.generate = function(e, r, n, i) { +ba.prototype.generate = function(e, r, n, i) { if (this._reseed > this.reseedInterval) throw new Error("Reseed is required"); typeof r != "string" && (i = n, n = r, r = null), n && (n = xs.toArray(n, i || "hex"), this._update(n)); @@ -12199,63 +12199,63 @@ wa.prototype.generate = function(e, r, n, i) { var o = s.slice(0, e); return this._update(n), this._reseed++, xs.encode(o, r); }; -var E1 = Bi.assert; -function Zn(t, e) { +var E1 = $i.assert; +function Qn(t, e) { this.ec = t, this.priv = null, this.pub = null, e.priv && this._importPrivate(e.priv, e.privEnc), e.pub && this._importPublic(e.pub, e.pubEnc); } -var Vv = Zn; -Zn.fromPublic = function(e, r, n) { - return r instanceof Zn ? r : new Zn(e, { +var Vv = Qn; +Qn.fromPublic = function(e, r, n) { + return r instanceof Qn ? r : new Qn(e, { pub: r, pubEnc: n }); }; -Zn.fromPrivate = function(e, r, n) { - return r instanceof Zn ? r : new Zn(e, { +Qn.fromPrivate = function(e, r, n) { + return r instanceof Qn ? r : new Qn(e, { priv: r, privEnc: n }); }; -Zn.prototype.validate = function() { +Qn.prototype.validate = function() { var e = this.getPublic(); return e.isInfinity() ? { result: !1, reason: "Invalid public key" } : e.validate() ? e.mul(this.ec.curve.n).isInfinity() ? { result: !0, reason: null } : { result: !1, reason: "Public key * N != O" } : { result: !1, reason: "Public key is not a point" }; }; -Zn.prototype.getPublic = function(e, r) { +Qn.prototype.getPublic = function(e, r) { return typeof e == "string" && (r = e, e = null), this.pub || (this.pub = this.ec.g.mul(this.priv)), r ? this.pub.encode(r, e) : this.pub; }; -Zn.prototype.getPrivate = function(e) { +Qn.prototype.getPrivate = function(e) { return e === "hex" ? this.priv.toString(16, 2) : this.priv; }; -Zn.prototype._importPrivate = function(e, r) { +Qn.prototype._importPrivate = function(e, r) { this.priv = new sr(e, r || 16), this.priv = this.priv.umod(this.ec.curve.n); }; -Zn.prototype._importPublic = function(e, r) { +Qn.prototype._importPublic = function(e, r) { if (e.x || e.y) { this.ec.curve.type === "mont" ? E1(e.x, "Need x coordinate") : (this.ec.curve.type === "short" || this.ec.curve.type === "edwards") && E1(e.x && e.y, "Need both x and y coordinate"), this.pub = this.ec.curve.point(e.x, e.y); return; } this.pub = this.ec.curve.decodePoint(e, r); }; -Zn.prototype.derive = function(e) { +Qn.prototype.derive = function(e) { return e.validate() || E1(e.validate(), "public point not validated"), e.mul(this.priv).getX(); }; -Zn.prototype.sign = function(e, r, n) { +Qn.prototype.sign = function(e, r, n) { return this.ec.sign(e, this, r, n); }; -Zn.prototype.verify = function(e, r) { +Qn.prototype.verify = function(e, r) { return this.ec.verify(e, r, this); }; -Zn.prototype.inspect = function() { +Qn.prototype.inspect = function() { return ""; }; -var bU = Bi.assert; +var yU = $i.assert; function H0(t, e) { if (t instanceof H0) return t; - this._importDER(t, e) || (bU(t.r && t.s, "Signature without r or s"), this.r = new sr(t.r, 16), this.s = new sr(t.s, 16), t.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = t.recoveryParam); + this._importDER(t, e) || (yU(t.r && t.s, "Signature without r or s"), this.r = new sr(t.r, 16), this.s = new sr(t.s, 16), t.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = t.recoveryParam); } var K0 = H0; -function yU() { +function wU() { this.place = 0; } function im(t, e) { @@ -12269,14 +12269,14 @@ function im(t, e) { i <<= 8, i |= t[o], i >>>= 0; return i <= 127 ? !1 : (e.place = o, i); } -function Mx(t) { +function Ax(t) { for (var e = 0, r = t.length - 1; !t[e] && !(t[e + 1] & 128) && e < r; ) e++; return e === 0 ? t : t.slice(e); } H0.prototype._importDER = function(e, r) { - e = Bi.toArray(e, r); - var n = new yU(); + e = $i.toArray(e, r); + var n = new wU(); if (e[n.place++] !== 48) return !1; var i = im(e, n); @@ -12316,44 +12316,44 @@ function sm(t, e) { } H0.prototype.toDER = function(e) { var r = this.r.toArray(), n = this.s.toArray(); - for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Mx(r), n = Mx(n); !n[0] && !(n[1] & 128); ) + for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Ax(r), n = Ax(n); !n[0] && !(n[1] & 128); ) n = n.slice(1); var i = [2]; sm(i, r.length), i = i.concat(r), i.push(2), sm(i, n.length); var s = i.concat(n), o = [48]; - return sm(o, s.length), o = o.concat(s), Bi.encode(o, e); + return sm(o, s.length), o = o.concat(s), $i.encode(o, e); }; -var wU = ( +var xU = ( /*RicMoo:ethers:require(brorand)*/ function() { throw new Error("unsupported"); } -), m8 = Bi.assert; -function es(t) { - if (!(this instanceof es)) - return new es(t); - typeof t == "string" && (m8( +), p8 = $i.assert; +function Qi(t) { + if (!(this instanceof Qi)) + return new Qi(t); + typeof t == "string" && (p8( Object.prototype.hasOwnProperty.call(Md, t), "Unknown curve " + t ), t = Md[t]), t instanceof Md.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; } -var xU = es; -es.prototype.keyPair = function(e) { +var _U = Qi; +Qi.prototype.keyPair = function(e) { return new Vv(this, e); }; -es.prototype.keyFromPrivate = function(e, r) { +Qi.prototype.keyFromPrivate = function(e, r) { return Vv.fromPrivate(this, e, r); }; -es.prototype.keyFromPublic = function(e, r) { +Qi.prototype.keyFromPublic = function(e, r) { return Vv.fromPublic(this, e, r); }; -es.prototype.genKeyPair = function(e) { +Qi.prototype.genKeyPair = function(e) { e || (e = {}); - for (var r = new g8({ + for (var r = new d8({ hash: this.hash, pers: e.pers, persEnc: e.persEnc || "utf8", - entropy: e.entropy || wU(this.hash.hmacStrength), + entropy: e.entropy || xU(this.hash.hmacStrength), entropyEnc: e.entropy && e.entropyEnc || "utf8", nonce: this.n.toArray() }), n = this.n.byteLength(), i = this.n.sub(new sr(2)); ; ) { @@ -12362,13 +12362,13 @@ es.prototype.genKeyPair = function(e) { return s.iaddn(1), this.keyFromPrivate(s); } }; -es.prototype._truncateToN = function(e, r) { +Qi.prototype._truncateToN = function(e, r) { var n = e.byteLength() * 8 - this.n.bitLength(); return n > 0 && (e = e.ushrn(n)), !r && e.cmp(this.n) >= 0 ? e.sub(this.n) : e; }; -es.prototype.sign = function(e, r, n, i) { +Qi.prototype.sign = function(e, r, n, i) { typeof n == "object" && (i = n, n = null), i || (i = {}), r = this.keyFromPrivate(r, n), e = this._truncateToN(new sr(e, 16)); - for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new g8({ + for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new d8({ hash: this.hash, entropy: o, nonce: a, @@ -12379,19 +12379,19 @@ es.prototype.sign = function(e, r, n, i) { if (p = this._truncateToN(p, !0), !(p.cmpn(1) <= 0 || p.cmp(l) >= 0)) { var w = this.g.mul(p); if (!w.isInfinity()) { - var A = w.getX(), P = A.umod(this.n); - if (P.cmpn(0) !== 0) { - var N = p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e)); + var A = w.getX(), M = A.umod(this.n); + if (M.cmpn(0) !== 0) { + var N = p.invm(this.n).mul(M.mul(r.getPrivate()).iadd(e)); if (N = N.umod(this.n), N.cmpn(0) !== 0) { - var L = (w.getY().isOdd() ? 1 : 0) | (A.cmp(P) !== 0 ? 2 : 0); - return i.canonical && N.cmp(this.nh) > 0 && (N = this.n.sub(N), L ^= 1), new K0({ r: P, s: N, recoveryParam: L }); + var L = (w.getY().isOdd() ? 1 : 0) | (A.cmp(M) !== 0 ? 2 : 0); + return i.canonical && N.cmp(this.nh) > 0 && (N = this.n.sub(N), L ^= 1), new K0({ r: M, s: N, recoveryParam: L }); } } } } } }; -es.prototype.verify = function(e, r, n, i) { +Qi.prototype.verify = function(e, r, n, i) { e = this._truncateToN(new sr(e, 16)), n = this.keyFromPublic(n, i), r = new K0(r, "hex"); var s = r.r, o = r.s; if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0 || o.cmpn(1) < 0 || o.cmp(this.n) >= 0) @@ -12399,8 +12399,8 @@ es.prototype.verify = function(e, r, n, i) { var a = o.invm(this.n), u = a.mul(e).umod(this.n), l = a.mul(s).umod(this.n), d; return this.curve._maxwellTrick ? (d = this.g.jmulAdd(u, n.getPublic(), l), d.isInfinity() ? !1 : d.eqXToP(s)) : (d = this.g.mulAdd(u, n.getPublic(), l), d.isInfinity() ? !1 : d.getX().umod(this.n).cmp(s) === 0); }; -es.prototype.recoverPubKey = function(t, e, r, n) { - m8((3 & r) === r, "The recovery param is more than two bits"), e = new K0(e, n); +Qi.prototype.recoverPubKey = function(t, e, r, n) { + p8((3 & r) === r, "The recovery param is more than two bits"), e = new K0(e, n); var i = this.n, s = new sr(t), o = e.r, a = e.s, u = r & 1, l = r >> 1; if (o.cmp(this.curve.p.umod(this.curve.n)) >= 0 && l) throw new Error("Unable to find sencond key candinate"); @@ -12408,7 +12408,7 @@ es.prototype.recoverPubKey = function(t, e, r, n) { var d = e.r.invm(i), p = i.sub(s).mul(d).umod(i), w = a.mul(d).umod(i); return this.g.mulAdd(p, o, w); }; -es.prototype.getKeyRecoveryParam = function(t, e, r, n) { +Qi.prototype.getKeyRecoveryParam = function(t, e, r, n) { if (e = new K0(e, n), e.recoveryParam !== null) return e.recoveryParam; for (var i = 0; i < 4; i++) { @@ -12423,75 +12423,75 @@ es.prototype.getKeyRecoveryParam = function(t, e, r, n) { } throw new Error("Unable to find valid recovery factor"); }; -var _U = Bu(function(t, e) { +var EU = Bu(function(t, e) { var r = e; - r.version = "6.5.4", r.utils = Bi, r.rand = /*RicMoo:ethers:require(brorand)*/ + r.version = "6.5.4", r.utils = $i, r.rand = /*RicMoo:ethers:require(brorand)*/ function() { throw new Error("unsupported"); - }, r.curve = Pd, r.curves = Md, r.ec = xU, r.eddsa = /*RicMoo:ethers:require(./elliptic/eddsa)*/ + }, r.curve = Pd, r.curves = Md, r.ec = _U, r.eddsa = /*RicMoo:ethers:require(./elliptic/eddsa)*/ null; -}), EU = _U.ec; -const SU = "signing-key/5.7.0", S1 = new Yr(SU); +}), SU = EU.ec; +const AU = "signing-key/5.7.0", S1 = new Yr(AU); let om = null; -function ua() { - return om || (om = new EU("secp256k1")), om; +function aa() { + return om || (om = new SU("secp256k1")), om; } -class AU { +class PU { constructor(e) { - _f(this, "curve", "secp256k1"), _f(this, "privateKey", Ti(e)), TF(this.privateKey) !== 32 && S1.throwArgumentError("invalid private key", "privateKey", "[[ REDACTED ]]"); - const r = ua().keyFromPrivate(wn(this.privateKey)); + _f(this, "curve", "secp256k1"), _f(this, "privateKey", Ri(e)), RF(this.privateKey) !== 32 && S1.throwArgumentError("invalid private key", "privateKey", "[[ REDACTED ]]"); + const r = aa().keyFromPrivate(wn(this.privateKey)); _f(this, "publicKey", "0x" + r.getPublic(!1, "hex")), _f(this, "compressedPublicKey", "0x" + r.getPublic(!0, "hex")), _f(this, "_isSigningKey", !0); } _addPoint(e) { - const r = ua().keyFromPublic(wn(this.publicKey)), n = ua().keyFromPublic(wn(e)); + const r = aa().keyFromPublic(wn(this.publicKey)), n = aa().keyFromPublic(wn(e)); return "0x" + r.pub.add(n.pub).encodeCompressed("hex"); } signDigest(e) { - const r = ua().keyFromPrivate(wn(this.privateKey)), n = wn(e); + const r = aa().keyFromPrivate(wn(this.privateKey)), n = wn(e); n.length !== 32 && S1.throwArgumentError("bad digest length", "digest", e); const i = r.sign(n, { canonical: !0 }); - return G4({ + return K4({ recoveryParam: i.recoveryParam, r: lu("0x" + i.r.toString(16), 32), s: lu("0x" + i.s.toString(16), 32) }); } computeSharedSecret(e) { - const r = ua().keyFromPrivate(wn(this.privateKey)), n = ua().keyFromPublic(wn(v8(e))); + const r = aa().keyFromPrivate(wn(this.privateKey)), n = aa().keyFromPublic(wn(g8(e))); return lu("0x" + r.derive(n.getPublic()).toString(16), 32); } static isSigningKey(e) { return !!(e && e._isSigningKey); } } -function PU(t, e) { - const r = G4(e), n = { r: wn(r.r), s: wn(r.s) }; - return "0x" + ua().recoverPubKey(wn(t), n, r.recoveryParam).encode("hex", !1); +function MU(t, e) { + const r = K4(e), n = { r: wn(r.r), s: wn(r.s) }; + return "0x" + aa().recoverPubKey(wn(t), n, r.recoveryParam).encode("hex", !1); } -function v8(t, e) { +function g8(t, e) { const r = wn(t); - return r.length === 32 ? new AU(r).publicKey : r.length === 33 ? "0x" + ua().keyFromPublic(r).getPublic(!1, "hex") : r.length === 65 ? Ti(r) : S1.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); + return r.length === 32 ? new PU(r).publicKey : r.length === 33 ? "0x" + aa().keyFromPublic(r).getPublic(!1, "hex") : r.length === 65 ? Ri(r) : S1.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); } -var Ix; +var Px; (function(t) { t[t.legacy = 0] = "legacy", t[t.eip2930 = 1] = "eip2930", t[t.eip1559 = 2] = "eip1559"; -})(Ix || (Ix = {})); -function MU(t) { - const e = v8(t); - return UF(yx(qv(yx(e, 1)), 12)); +})(Px || (Px = {})); +function IU(t) { + const e = g8(t); + return qF(vx(qv(vx(e, 1)), 12)); } -function IU(t, e) { - return MU(PU(wn(t), e)); +function CU(t, e) { + return IU(MU(wn(t), e)); } var Gv = {}, V0 = {}; Object.defineProperty(V0, "__esModule", { value: !0 }); -var Gn = ar, A1 = $i, CU = 20; -function TU(t, e, r) { - for (var n = 1634760805, i = 857760878, s = 2036477234, o = 1797285236, a = r[3] << 24 | r[2] << 16 | r[1] << 8 | r[0], u = r[7] << 24 | r[6] << 16 | r[5] << 8 | r[4], l = r[11] << 24 | r[10] << 16 | r[9] << 8 | r[8], d = r[15] << 24 | r[14] << 16 | r[13] << 8 | r[12], p = r[19] << 24 | r[18] << 16 | r[17] << 8 | r[16], w = r[23] << 24 | r[22] << 16 | r[21] << 8 | r[20], A = r[27] << 24 | r[26] << 16 | r[25] << 8 | r[24], P = r[31] << 24 | r[30] << 16 | r[29] << 8 | r[28], N = e[3] << 24 | e[2] << 16 | e[1] << 8 | e[0], L = e[7] << 24 | e[6] << 16 | e[5] << 8 | e[4], $ = e[11] << 24 | e[10] << 16 | e[9] << 8 | e[8], B = e[15] << 24 | e[14] << 16 | e[13] << 8 | e[12], H = n, W = i, V = s, te = o, R = a, K = u, ge = l, Ee = d, Y = p, S = w, m = A, f = P, g = N, b = L, x = $, _ = B, E = 0; E < CU; E += 2) +var Yn = ar, A1 = ki, TU = 20; +function RU(t, e, r) { + for (var n = 1634760805, i = 857760878, s = 2036477234, o = 1797285236, a = r[3] << 24 | r[2] << 16 | r[1] << 8 | r[0], u = r[7] << 24 | r[6] << 16 | r[5] << 8 | r[4], l = r[11] << 24 | r[10] << 16 | r[9] << 8 | r[8], d = r[15] << 24 | r[14] << 16 | r[13] << 8 | r[12], p = r[19] << 24 | r[18] << 16 | r[17] << 8 | r[16], w = r[23] << 24 | r[22] << 16 | r[21] << 8 | r[20], A = r[27] << 24 | r[26] << 16 | r[25] << 8 | r[24], M = r[31] << 24 | r[30] << 16 | r[29] << 8 | r[28], N = e[3] << 24 | e[2] << 16 | e[1] << 8 | e[0], L = e[7] << 24 | e[6] << 16 | e[5] << 8 | e[4], B = e[11] << 24 | e[10] << 16 | e[9] << 8 | e[8], $ = e[15] << 24 | e[14] << 16 | e[13] << 8 | e[12], H = n, W = i, V = s, te = o, R = a, K = u, ge = l, Ee = d, Y = p, S = w, m = A, f = M, g = N, b = L, x = B, _ = $, E = 0; E < TU; E += 2) H = H + R | 0, g ^= H, g = g >>> 16 | g << 16, Y = Y + g | 0, R ^= Y, R = R >>> 20 | R << 12, W = W + K | 0, b ^= W, b = b >>> 16 | b << 16, S = S + b | 0, K ^= S, K = K >>> 20 | K << 12, V = V + ge | 0, x ^= V, x = x >>> 16 | x << 16, m = m + x | 0, ge ^= m, ge = ge >>> 20 | ge << 12, te = te + Ee | 0, _ ^= te, _ = _ >>> 16 | _ << 16, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 20 | Ee << 12, V = V + ge | 0, x ^= V, x = x >>> 24 | x << 8, m = m + x | 0, ge ^= m, ge = ge >>> 25 | ge << 7, te = te + Ee | 0, _ ^= te, _ = _ >>> 24 | _ << 8, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 25 | Ee << 7, W = W + K | 0, b ^= W, b = b >>> 24 | b << 8, S = S + b | 0, K ^= S, K = K >>> 25 | K << 7, H = H + R | 0, g ^= H, g = g >>> 24 | g << 8, Y = Y + g | 0, R ^= Y, R = R >>> 25 | R << 7, H = H + K | 0, _ ^= H, _ = _ >>> 16 | _ << 16, m = m + _ | 0, K ^= m, K = K >>> 20 | K << 12, W = W + ge | 0, g ^= W, g = g >>> 16 | g << 16, f = f + g | 0, ge ^= f, ge = ge >>> 20 | ge << 12, V = V + Ee | 0, b ^= V, b = b >>> 16 | b << 16, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 20 | Ee << 12, te = te + R | 0, x ^= te, x = x >>> 16 | x << 16, S = S + x | 0, R ^= S, R = R >>> 20 | R << 12, V = V + Ee | 0, b ^= V, b = b >>> 24 | b << 8, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 25 | Ee << 7, te = te + R | 0, x ^= te, x = x >>> 24 | x << 8, S = S + x | 0, R ^= S, R = R >>> 25 | R << 7, W = W + ge | 0, g ^= W, g = g >>> 24 | g << 8, f = f + g | 0, ge ^= f, ge = ge >>> 25 | ge << 7, H = H + K | 0, _ ^= H, _ = _ >>> 24 | _ << 8, m = m + _ | 0, K ^= m, K = K >>> 25 | K << 7; - Gn.writeUint32LE(H + n | 0, t, 0), Gn.writeUint32LE(W + i | 0, t, 4), Gn.writeUint32LE(V + s | 0, t, 8), Gn.writeUint32LE(te + o | 0, t, 12), Gn.writeUint32LE(R + a | 0, t, 16), Gn.writeUint32LE(K + u | 0, t, 20), Gn.writeUint32LE(ge + l | 0, t, 24), Gn.writeUint32LE(Ee + d | 0, t, 28), Gn.writeUint32LE(Y + p | 0, t, 32), Gn.writeUint32LE(S + w | 0, t, 36), Gn.writeUint32LE(m + A | 0, t, 40), Gn.writeUint32LE(f + P | 0, t, 44), Gn.writeUint32LE(g + N | 0, t, 48), Gn.writeUint32LE(b + L | 0, t, 52), Gn.writeUint32LE(x + $ | 0, t, 56), Gn.writeUint32LE(_ + B | 0, t, 60); + Yn.writeUint32LE(H + n | 0, t, 0), Yn.writeUint32LE(W + i | 0, t, 4), Yn.writeUint32LE(V + s | 0, t, 8), Yn.writeUint32LE(te + o | 0, t, 12), Yn.writeUint32LE(R + a | 0, t, 16), Yn.writeUint32LE(K + u | 0, t, 20), Yn.writeUint32LE(ge + l | 0, t, 24), Yn.writeUint32LE(Ee + d | 0, t, 28), Yn.writeUint32LE(Y + p | 0, t, 32), Yn.writeUint32LE(S + w | 0, t, 36), Yn.writeUint32LE(m + A | 0, t, 40), Yn.writeUint32LE(f + M | 0, t, 44), Yn.writeUint32LE(g + N | 0, t, 48), Yn.writeUint32LE(b + L | 0, t, 52), Yn.writeUint32LE(x + B | 0, t, 56), Yn.writeUint32LE(_ + $ | 0, t, 60); } -function b8(t, e, r, n, i) { +function m8(t, e, r, n, i) { if (i === void 0 && (i = 0), t.length !== 32) throw new Error("ChaCha: key size must be 32 bytes"); if (n.length < r.length) @@ -12507,49 +12507,49 @@ function b8(t, e, r, n, i) { s = e, o = i; } for (var a = new Uint8Array(64), u = 0; u < r.length; u += 64) { - TU(a, s, t); + RU(a, s, t); for (var l = u; l < u + 64 && l < r.length; l++) n[l] = r[l] ^ a[l - u]; - DU(s, 0, o); + OU(s, 0, o); } return A1.wipe(a), i === 0 && A1.wipe(s), n; } -V0.streamXOR = b8; -function RU(t, e, r, n) { - return n === void 0 && (n = 0), A1.wipe(r), b8(t, e, r, r, n); +V0.streamXOR = m8; +function DU(t, e, r, n) { + return n === void 0 && (n = 0), A1.wipe(r), m8(t, e, r, r, n); } -V0.stream = RU; -function DU(t, e, r) { +V0.stream = DU; +function OU(t, e, r) { for (var n = 1; r--; ) n = n + (t[e] & 255) | 0, t[e] = n & 255, n >>>= 8, e++; if (n > 0) throw new Error("ChaCha: counter overflow"); } -var y8 = {}, Ra = {}; -Object.defineProperty(Ra, "__esModule", { value: !0 }); -function OU(t, e, r) { +var v8 = {}, Ia = {}; +Object.defineProperty(Ia, "__esModule", { value: !0 }); +function NU(t, e, r) { return ~(t - 1) & e | t - 1 & r; } -Ra.select = OU; -function NU(t, e) { +Ia.select = NU; +function LU(t, e) { return (t | 0) - (e | 0) - 1 >>> 31 & 1; } -Ra.lessOrEqual = NU; -function w8(t, e) { +Ia.lessOrEqual = LU; +function b8(t, e) { if (t.length !== e.length) return 0; for (var r = 0, n = 0; n < t.length; n++) r |= t[n] ^ e[n]; return 1 & r - 1 >>> 8; } -Ra.compare = w8; -function LU(t, e) { - return t.length === 0 || e.length === 0 ? !1 : w8(t, e) !== 0; +Ia.compare = b8; +function kU(t, e) { + return t.length === 0 || e.length === 0 ? !1 : b8(t, e) !== 0; } -Ra.equal = LU; +Ia.equal = kU; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - var e = Ra, r = $i; + var e = Ia, r = ki; t.DIGEST_LENGTH = 16; var n = ( /** @class */ @@ -12568,13 +12568,13 @@ Ra.equal = LU; this._r[4] = (p >>> 4 | w << 12) & 255, this._r[5] = w >>> 1 & 8190; var A = a[10] | a[11] << 8; this._r[6] = (w >>> 14 | A << 2) & 8191; - var P = a[12] | a[13] << 8; - this._r[7] = (A >>> 11 | P << 5) & 8065; + var M = a[12] | a[13] << 8; + this._r[7] = (A >>> 11 | M << 5) & 8065; var N = a[14] | a[15] << 8; - this._r[8] = (P >>> 8 | N << 8) & 8191, this._r[9] = N >>> 5 & 127, this._pad[0] = a[16] | a[17] << 8, this._pad[1] = a[18] | a[19] << 8, this._pad[2] = a[20] | a[21] << 8, this._pad[3] = a[22] | a[23] << 8, this._pad[4] = a[24] | a[25] << 8, this._pad[5] = a[26] | a[27] << 8, this._pad[6] = a[28] | a[29] << 8, this._pad[7] = a[30] | a[31] << 8; + this._r[8] = (M >>> 8 | N << 8) & 8191, this._r[9] = N >>> 5 & 127, this._pad[0] = a[16] | a[17] << 8, this._pad[1] = a[18] | a[19] << 8, this._pad[2] = a[20] | a[21] << 8, this._pad[3] = a[22] | a[23] << 8, this._pad[4] = a[24] | a[25] << 8, this._pad[5] = a[26] | a[27] << 8, this._pad[6] = a[28] | a[29] << 8, this._pad[7] = a[30] | a[31] << 8; } return o.prototype._blocks = function(a, u, l) { - for (var d = this._fin ? 0 : 2048, p = this._h[0], w = this._h[1], A = this._h[2], P = this._h[3], N = this._h[4], L = this._h[5], $ = this._h[6], B = this._h[7], H = this._h[8], W = this._h[9], V = this._r[0], te = this._r[1], R = this._r[2], K = this._r[3], ge = this._r[4], Ee = this._r[5], Y = this._r[6], S = this._r[7], m = this._r[8], f = this._r[9]; l >= 16; ) { + for (var d = this._fin ? 0 : 2048, p = this._h[0], w = this._h[1], A = this._h[2], M = this._h[3], N = this._h[4], L = this._h[5], B = this._h[6], $ = this._h[7], H = this._h[8], W = this._h[9], V = this._r[0], te = this._r[1], R = this._r[2], K = this._r[3], ge = this._r[4], Ee = this._r[5], Y = this._r[6], S = this._r[7], m = this._r[8], f = this._r[9]; l >= 16; ) { var g = a[u + 0] | a[u + 1] << 8; p += g & 8191; var b = a[u + 2] | a[u + 3] << 8; @@ -12582,37 +12582,37 @@ Ra.equal = LU; var x = a[u + 4] | a[u + 5] << 8; A += (b >>> 10 | x << 6) & 8191; var _ = a[u + 6] | a[u + 7] << 8; - P += (x >>> 7 | _ << 9) & 8191; + M += (x >>> 7 | _ << 9) & 8191; var E = a[u + 8] | a[u + 9] << 8; N += (_ >>> 4 | E << 12) & 8191, L += E >>> 1 & 8191; var v = a[u + 10] | a[u + 11] << 8; - $ += (E >>> 14 | v << 2) & 8191; - var M = a[u + 12] | a[u + 13] << 8; - B += (v >>> 11 | M << 5) & 8191; + B += (E >>> 14 | v << 2) & 8191; + var P = a[u + 12] | a[u + 13] << 8; + $ += (v >>> 11 | P << 5) & 8191; var I = a[u + 14] | a[u + 15] << 8; - H += (M >>> 8 | I << 8) & 8191, W += I >>> 5 | d; + H += (P >>> 8 | I << 8) & 8191, W += I >>> 5 | d; var F = 0, ce = F; - ce += p * V, ce += w * (5 * f), ce += A * (5 * m), ce += P * (5 * S), ce += N * (5 * Y), F = ce >>> 13, ce &= 8191, ce += L * (5 * Ee), ce += $ * (5 * ge), ce += B * (5 * K), ce += H * (5 * R), ce += W * (5 * te), F += ce >>> 13, ce &= 8191; + ce += p * V, ce += w * (5 * f), ce += A * (5 * m), ce += M * (5 * S), ce += N * (5 * Y), F = ce >>> 13, ce &= 8191, ce += L * (5 * Ee), ce += B * (5 * ge), ce += $ * (5 * K), ce += H * (5 * R), ce += W * (5 * te), F += ce >>> 13, ce &= 8191; var D = F; - D += p * te, D += w * V, D += A * (5 * f), D += P * (5 * m), D += N * (5 * S), F = D >>> 13, D &= 8191, D += L * (5 * Y), D += $ * (5 * Ee), D += B * (5 * ge), D += H * (5 * K), D += W * (5 * R), F += D >>> 13, D &= 8191; + D += p * te, D += w * V, D += A * (5 * f), D += M * (5 * m), D += N * (5 * S), F = D >>> 13, D &= 8191, D += L * (5 * Y), D += B * (5 * Ee), D += $ * (5 * ge), D += H * (5 * K), D += W * (5 * R), F += D >>> 13, D &= 8191; var oe = F; - oe += p * R, oe += w * te, oe += A * V, oe += P * (5 * f), oe += N * (5 * m), F = oe >>> 13, oe &= 8191, oe += L * (5 * S), oe += $ * (5 * Y), oe += B * (5 * Ee), oe += H * (5 * ge), oe += W * (5 * K), F += oe >>> 13, oe &= 8191; + oe += p * R, oe += w * te, oe += A * V, oe += M * (5 * f), oe += N * (5 * m), F = oe >>> 13, oe &= 8191, oe += L * (5 * S), oe += B * (5 * Y), oe += $ * (5 * Ee), oe += H * (5 * ge), oe += W * (5 * K), F += oe >>> 13, oe &= 8191; var Z = F; - Z += p * K, Z += w * R, Z += A * te, Z += P * V, Z += N * (5 * f), F = Z >>> 13, Z &= 8191, Z += L * (5 * m), Z += $ * (5 * S), Z += B * (5 * Y), Z += H * (5 * Ee), Z += W * (5 * ge), F += Z >>> 13, Z &= 8191; + Z += p * K, Z += w * R, Z += A * te, Z += M * V, Z += N * (5 * f), F = Z >>> 13, Z &= 8191, Z += L * (5 * m), Z += B * (5 * S), Z += $ * (5 * Y), Z += H * (5 * Ee), Z += W * (5 * ge), F += Z >>> 13, Z &= 8191; var J = F; - J += p * ge, J += w * K, J += A * R, J += P * te, J += N * V, F = J >>> 13, J &= 8191, J += L * (5 * f), J += $ * (5 * m), J += B * (5 * S), J += H * (5 * Y), J += W * (5 * Ee), F += J >>> 13, J &= 8191; + J += p * ge, J += w * K, J += A * R, J += M * te, J += N * V, F = J >>> 13, J &= 8191, J += L * (5 * f), J += B * (5 * m), J += $ * (5 * S), J += H * (5 * Y), J += W * (5 * Ee), F += J >>> 13, J &= 8191; var Q = F; - Q += p * Ee, Q += w * ge, Q += A * K, Q += P * R, Q += N * te, F = Q >>> 13, Q &= 8191, Q += L * V, Q += $ * (5 * f), Q += B * (5 * m), Q += H * (5 * S), Q += W * (5 * Y), F += Q >>> 13, Q &= 8191; + Q += p * Ee, Q += w * ge, Q += A * K, Q += M * R, Q += N * te, F = Q >>> 13, Q &= 8191, Q += L * V, Q += B * (5 * f), Q += $ * (5 * m), Q += H * (5 * S), Q += W * (5 * Y), F += Q >>> 13, Q &= 8191; var T = F; - T += p * Y, T += w * Ee, T += A * ge, T += P * K, T += N * R, F = T >>> 13, T &= 8191, T += L * te, T += $ * V, T += B * (5 * f), T += H * (5 * m), T += W * (5 * S), F += T >>> 13, T &= 8191; + T += p * Y, T += w * Ee, T += A * ge, T += M * K, T += N * R, F = T >>> 13, T &= 8191, T += L * te, T += B * V, T += $ * (5 * f), T += H * (5 * m), T += W * (5 * S), F += T >>> 13, T &= 8191; var X = F; - X += p * S, X += w * Y, X += A * Ee, X += P * ge, X += N * K, F = X >>> 13, X &= 8191, X += L * R, X += $ * te, X += B * V, X += H * (5 * f), X += W * (5 * m), F += X >>> 13, X &= 8191; + X += p * S, X += w * Y, X += A * Ee, X += M * ge, X += N * K, F = X >>> 13, X &= 8191, X += L * R, X += B * te, X += $ * V, X += H * (5 * f), X += W * (5 * m), F += X >>> 13, X &= 8191; var re = F; - re += p * m, re += w * S, re += A * Y, re += P * Ee, re += N * ge, F = re >>> 13, re &= 8191, re += L * K, re += $ * R, re += B * te, re += H * V, re += W * (5 * f), F += re >>> 13, re &= 8191; - var pe = F; - pe += p * f, pe += w * m, pe += A * S, pe += P * Y, pe += N * Ee, F = pe >>> 13, pe &= 8191, pe += L * ge, pe += $ * K, pe += B * R, pe += H * te, pe += W * V, F += pe >>> 13, pe &= 8191, F = (F << 2) + F | 0, F = F + ce | 0, ce = F & 8191, F = F >>> 13, D += F, p = ce, w = D, A = oe, P = Z, N = J, L = Q, $ = T, B = X, H = re, W = pe, u += 16, l -= 16; + re += p * m, re += w * S, re += A * Y, re += M * Ee, re += N * ge, F = re >>> 13, re &= 8191, re += L * K, re += B * R, re += $ * te, re += H * V, re += W * (5 * f), F += re >>> 13, re &= 8191; + var de = F; + de += p * f, de += w * m, de += A * S, de += M * Y, de += N * Ee, F = de >>> 13, de &= 8191, de += L * ge, de += B * K, de += $ * R, de += H * te, de += W * V, F += de >>> 13, de &= 8191, F = (F << 2) + F | 0, F = F + ce | 0, ce = F & 8191, F = F >>> 13, D += F, p = ce, w = D, A = oe, M = Z, N = J, L = Q, B = T, $ = X, H = re, W = de, u += 16, l -= 16; } - this._h[0] = p, this._h[1] = w, this._h[2] = A, this._h[3] = P, this._h[4] = N, this._h[5] = L, this._h[6] = $, this._h[7] = B, this._h[8] = H, this._h[9] = W; + this._h[0] = p, this._h[1] = w, this._h[2] = A, this._h[3] = M, this._h[4] = N, this._h[5] = L, this._h[6] = B, this._h[7] = $, this._h[8] = H, this._h[9] = W; }, o.prototype.finish = function(a, u) { u === void 0 && (u = 0); var l = new Uint16Array(10), d, p, w, A; @@ -12670,10 +12670,10 @@ Ra.equal = LU; return o.length !== t.DIGEST_LENGTH || a.length !== t.DIGEST_LENGTH ? !1 : e.equal(o, a); } t.equal = s; -})(y8); +})(v8); (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - var e = V0, r = y8, n = $i, i = ar, s = Ra; + var e = V0, r = v8, n = ki, i = ar, s = Ia; t.KEY_LENGTH = 32, t.NONCE_LENGTH = 12, t.TAG_LENGTH = 16; var o = new Uint8Array(16), a = ( /** @class */ @@ -12688,8 +12688,8 @@ Ra.equal = LU; throw new Error("ChaCha20Poly1305: incorrect nonce length"); var A = new Uint8Array(16); A.set(l, A.length - l.length); - var P = new Uint8Array(32); - e.stream(this._key, A, P, 4); + var M = new Uint8Array(32); + e.stream(this._key, A, M, 4); var N = d.length + this.tagLength, L; if (w) { if (w.length !== N) @@ -12697,7 +12697,7 @@ Ra.equal = LU; L = w; } else L = new Uint8Array(N); - return e.streamXOR(this._key, A, d, L, 4), this._authenticate(L.subarray(L.length - this.tagLength, L.length), P, L.subarray(0, L.length - this.tagLength), p), n.wipe(A), L; + return e.streamXOR(this._key, A, d, L, 4), this._authenticate(L.subarray(L.length - this.tagLength, L.length), M, L.subarray(0, L.length - this.tagLength), p), n.wipe(A), L; }, u.prototype.open = function(l, d, p, w) { if (l.length > 16) throw new Error("ChaCha20Poly1305: incorrect nonce length"); @@ -12705,42 +12705,42 @@ Ra.equal = LU; return null; var A = new Uint8Array(16); A.set(l, A.length - l.length); - var P = new Uint8Array(32); - e.stream(this._key, A, P, 4); + var M = new Uint8Array(32); + e.stream(this._key, A, M, 4); var N = new Uint8Array(this.tagLength); - if (this._authenticate(N, P, d.subarray(0, d.length - this.tagLength), p), !s.equal(N, d.subarray(d.length - this.tagLength, d.length))) + if (this._authenticate(N, M, d.subarray(0, d.length - this.tagLength), p), !s.equal(N, d.subarray(d.length - this.tagLength, d.length))) return null; - var L = d.length - this.tagLength, $; + var L = d.length - this.tagLength, B; if (w) { if (w.length !== L) throw new Error("ChaCha20Poly1305: incorrect destination length"); - $ = w; + B = w; } else - $ = new Uint8Array(L); - return e.streamXOR(this._key, A, d.subarray(0, d.length - this.tagLength), $, 4), n.wipe(A), $; + B = new Uint8Array(L); + return e.streamXOR(this._key, A, d.subarray(0, d.length - this.tagLength), B, 4), n.wipe(A), B; }, u.prototype.clean = function() { return n.wipe(this._key), this; }, u.prototype._authenticate = function(l, d, p, w) { var A = new r.Poly1305(d); w && (A.update(w), w.length % 16 > 0 && A.update(o.subarray(w.length % 16))), A.update(p), p.length % 16 > 0 && A.update(o.subarray(p.length % 16)); - var P = new Uint8Array(8); - w && i.writeUint64LE(w.length, P), A.update(P), i.writeUint64LE(p.length, P), A.update(P); + var M = new Uint8Array(8); + w && i.writeUint64LE(w.length, M), A.update(M), i.writeUint64LE(p.length, M), A.update(M); for (var N = A.digest(), L = 0; L < N.length; L++) l[L] = N[L]; - A.clean(), n.wipe(N), n.wipe(P); + A.clean(), n.wipe(N), n.wipe(M); }, u; }() ); t.ChaCha20Poly1305 = a; })(Gv); -var x8 = {}, Gl = {}, Yv = {}; +var y8 = {}, Gl = {}, Yv = {}; Object.defineProperty(Yv, "__esModule", { value: !0 }); -function kU(t) { +function $U(t) { return typeof t.saveState < "u" && typeof t.restoreState < "u" && typeof t.cleanSavedState < "u"; } -Yv.isSerializableHash = kU; +Yv.isSerializableHash = $U; Object.defineProperty(Gl, "__esModule", { value: !0 }); -var Ls = Yv, $U = Ra, BU = $i, _8 = ( +var Ls = Yv, BU = Ia, FU = ki, w8 = ( /** @class */ function() { function t(e, r) { @@ -12752,7 +12752,7 @@ var Ls = Yv, $U = Ra, BU = $i, _8 = ( this._inner.update(n); for (var i = 0; i < n.length; i++) n[i] ^= 106; - this._outer.update(n), Ls.isSerializableHash(this._inner) && Ls.isSerializableHash(this._outer) && (this._innerKeyedState = this._inner.saveState(), this._outerKeyedState = this._outer.saveState()), BU.wipe(n); + this._outer.update(n), Ls.isSerializableHash(this._inner) && Ls.isSerializableHash(this._outer) && (this._innerKeyedState = this._inner.saveState(), this._outerKeyedState = this._outer.saveState()), FU.wipe(n); } return t.prototype.reset = function() { if (!Ls.isSerializableHash(this._inner) || !Ls.isSerializableHash(this._outer)) @@ -12782,23 +12782,23 @@ var Ls = Yv, $U = Ra, BU = $i, _8 = ( }, t; }() ); -Gl.HMAC = _8; -function FU(t, e, r) { - var n = new _8(t, e); +Gl.HMAC = w8; +function jU(t, e, r) { + var n = new w8(t, e); n.update(r); var i = n.digest(); return n.clean(), i; } -Gl.hmac = FU; -Gl.equal = $U.equal; -Object.defineProperty(x8, "__esModule", { value: !0 }); -var Cx = Gl, Tx = $i, jU = ( +Gl.hmac = jU; +Gl.equal = BU.equal; +Object.defineProperty(y8, "__esModule", { value: !0 }); +var Mx = Gl, Ix = ki, UU = ( /** @class */ function() { function t(e, r, n, i) { n === void 0 && (n = new Uint8Array(0)), this._counter = new Uint8Array(1), this._hash = e, this._info = i; - var s = Cx.hmac(this._hash, n, r); - this._hmac = new Cx.HMAC(e, s), this._buffer = new Uint8Array(this._hmac.digestLength), this._bufpos = this._buffer.length; + var s = Mx.hmac(this._hash, n, r); + this._hmac = new Mx.HMAC(e, s), this._buffer = new Uint8Array(this._hmac.digestLength), this._bufpos = this._buffer.length; } return t.prototype._fillBuffer = function() { this._counter[0]++; @@ -12811,13 +12811,13 @@ var Cx = Gl, Tx = $i, jU = ( this._bufpos === this._buffer.length && this._fillBuffer(), r[n] = this._buffer[this._bufpos++]; return r; }, t.prototype.clean = function() { - this._hmac.clean(), Tx.wipe(this._buffer), Tx.wipe(this._counter), this._bufpos = 0; + this._hmac.clean(), Ix.wipe(this._buffer), Ix.wipe(this._counter), this._bufpos = 0; }, t; }() -), UU = x8.HKDF = jU, Yl = {}; +), qU = y8.HKDF = UU, Yl = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - var e = ar, r = $i; + var e = ar, r = ki; t.DIGEST_LENGTH = 32, t.BLOCK_SIZE = 64; var n = ( /** @class */ @@ -12847,12 +12847,12 @@ var Cx = Gl, Tx = $i, jU = ( if (!this._finished) { var l = this._bytesHashed, d = this._bufferLength, p = l / 536870912 | 0, w = l << 3, A = l % 64 < 56 ? 64 : 128; this._buffer[d] = 128; - for (var P = d + 1; P < A - 8; P++) - this._buffer[P] = 0; + for (var M = d + 1; M < A - 8; M++) + this._buffer[M] = 0; e.writeUint32BE(p, this._buffer, A - 8), e.writeUint32BE(w, this._buffer, A - 4), s(this._temp, this._state, this._buffer, 0, A), this._finished = !0; } - for (var P = 0; P < this.digestLength / 4; P++) - e.writeUint32BE(this._state[P], u, P * 4); + for (var M = 0; M < this.digestLength / 4; M++) + e.writeUint32BE(this._state[M], u, M * 4); return this; }, a.prototype.digest = function() { var u = new Uint8Array(this.digestLength); @@ -12942,7 +12942,7 @@ var Cx = Gl, Tx = $i, jU = ( ]); function s(a, u, l, d, p) { for (; p >= 64; ) { - for (var w = u[0], A = u[1], P = u[2], N = u[3], L = u[4], $ = u[5], B = u[6], H = u[7], W = 0; W < 16; W++) { + for (var w = u[0], A = u[1], M = u[2], N = u[3], L = u[4], B = u[5], $ = u[6], H = u[7], W = 0; W < 16; W++) { var V = d + W * 4; a[W] = e.readUint32BE(l, V); } @@ -12953,10 +12953,10 @@ var Cx = Gl, Tx = $i, jU = ( a[W] = (R + a[W - 7] | 0) + (K + a[W - 16] | 0); } for (var W = 0; W < 64; W++) { - var R = (((L >>> 6 | L << 26) ^ (L >>> 11 | L << 21) ^ (L >>> 25 | L << 7)) + (L & $ ^ ~L & B) | 0) + (H + (i[W] + a[W] | 0) | 0) | 0, K = ((w >>> 2 | w << 30) ^ (w >>> 13 | w << 19) ^ (w >>> 22 | w << 10)) + (w & A ^ w & P ^ A & P) | 0; - H = B, B = $, $ = L, L = N + R | 0, N = P, P = A, A = w, w = R + K | 0; + var R = (((L >>> 6 | L << 26) ^ (L >>> 11 | L << 21) ^ (L >>> 25 | L << 7)) + (L & B ^ ~L & $) | 0) + (H + (i[W] + a[W] | 0) | 0) | 0, K = ((w >>> 2 | w << 30) ^ (w >>> 13 | w << 19) ^ (w >>> 22 | w << 10)) + (w & A ^ w & M ^ A & M) | 0; + H = $, $ = B, B = L, L = N + R | 0, N = M, M = A, A = w, w = R + K | 0; } - u[0] += w, u[1] += A, u[2] += P, u[3] += N, u[4] += L, u[5] += $, u[6] += B, u[7] += H, d += 64, p -= 64; + u[0] += w, u[1] += A, u[2] += M, u[3] += N, u[4] += L, u[5] += B, u[6] += $, u[7] += H, d += 64, p -= 64; } return d; } @@ -12971,7 +12971,7 @@ var Cx = Gl, Tx = $i, jU = ( var Jv = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.sharedKey = t.generateKeyPair = t.generateKeyPairFromSeed = t.scalarMultBase = t.scalarMult = t.SHARED_KEY_LENGTH = t.SECRET_KEY_LENGTH = t.PUBLIC_KEY_LENGTH = void 0; - const e = Ca, r = $i; + const e = Pa, r = ki; t.PUBLIC_KEY_LENGTH = 32, t.SECRET_KEY_LENGTH = 32, t.SHARED_KEY_LENGTH = 32; function n(W) { const V = new Float64Array(16); @@ -13028,13 +13028,13 @@ var Jv = {}; W[R] = V[R] - te[R]; } function w(W, V, te) { - let R, K, ge = 0, Ee = 0, Y = 0, S = 0, m = 0, f = 0, g = 0, b = 0, x = 0, _ = 0, E = 0, v = 0, M = 0, I = 0, F = 0, ce = 0, D = 0, oe = 0, Z = 0, J = 0, Q = 0, T = 0, X = 0, re = 0, pe = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = te[0], Me = te[1], Ne = te[2], Ke = te[3], Le = te[4], qe = te[5], ze = te[6], _e = te[7], Ze = te[8], at = te[9], ke = te[10], Qe = te[11], tt = te[12], Ye = te[13], dt = te[14], lt = te[15]; - R = V[0], ge += R * $e, Ee += R * Me, Y += R * Ne, S += R * Ke, m += R * Le, f += R * qe, g += R * ze, b += R * _e, x += R * Ze, _ += R * at, E += R * ke, v += R * Qe, M += R * tt, I += R * Ye, F += R * dt, ce += R * lt, R = V[1], Ee += R * $e, Y += R * Me, S += R * Ne, m += R * Ke, f += R * Le, g += R * qe, b += R * ze, x += R * _e, _ += R * Ze, E += R * at, v += R * ke, M += R * Qe, I += R * tt, F += R * Ye, ce += R * dt, D += R * lt, R = V[2], Y += R * $e, S += R * Me, m += R * Ne, f += R * Ke, g += R * Le, b += R * qe, x += R * ze, _ += R * _e, E += R * Ze, v += R * at, M += R * ke, I += R * Qe, F += R * tt, ce += R * Ye, D += R * dt, oe += R * lt, R = V[3], S += R * $e, m += R * Me, f += R * Ne, g += R * Ke, b += R * Le, x += R * qe, _ += R * ze, E += R * _e, v += R * Ze, M += R * at, I += R * ke, F += R * Qe, ce += R * tt, D += R * Ye, oe += R * dt, Z += R * lt, R = V[4], m += R * $e, f += R * Me, g += R * Ne, b += R * Ke, x += R * Le, _ += R * qe, E += R * ze, v += R * _e, M += R * Ze, I += R * at, F += R * ke, ce += R * Qe, D += R * tt, oe += R * Ye, Z += R * dt, J += R * lt, R = V[5], f += R * $e, g += R * Me, b += R * Ne, x += R * Ke, _ += R * Le, E += R * qe, v += R * ze, M += R * _e, I += R * Ze, F += R * at, ce += R * ke, D += R * Qe, oe += R * tt, Z += R * Ye, J += R * dt, Q += R * lt, R = V[6], g += R * $e, b += R * Me, x += R * Ne, _ += R * Ke, E += R * Le, v += R * qe, M += R * ze, I += R * _e, F += R * Ze, ce += R * at, D += R * ke, oe += R * Qe, Z += R * tt, J += R * Ye, Q += R * dt, T += R * lt, R = V[7], b += R * $e, x += R * Me, _ += R * Ne, E += R * Ke, v += R * Le, M += R * qe, I += R * ze, F += R * _e, ce += R * Ze, D += R * at, oe += R * ke, Z += R * Qe, J += R * tt, Q += R * Ye, T += R * dt, X += R * lt, R = V[8], x += R * $e, _ += R * Me, E += R * Ne, v += R * Ke, M += R * Le, I += R * qe, F += R * ze, ce += R * _e, D += R * Ze, oe += R * at, Z += R * ke, J += R * Qe, Q += R * tt, T += R * Ye, X += R * dt, re += R * lt, R = V[9], _ += R * $e, E += R * Me, v += R * Ne, M += R * Ke, I += R * Le, F += R * qe, ce += R * ze, D += R * _e, oe += R * Ze, Z += R * at, J += R * ke, Q += R * Qe, T += R * tt, X += R * Ye, re += R * dt, pe += R * lt, R = V[10], E += R * $e, v += R * Me, M += R * Ne, I += R * Ke, F += R * Le, ce += R * qe, D += R * ze, oe += R * _e, Z += R * Ze, J += R * at, Q += R * ke, T += R * Qe, X += R * tt, re += R * Ye, pe += R * dt, ie += R * lt, R = V[11], v += R * $e, M += R * Me, I += R * Ne, F += R * Ke, ce += R * Le, D += R * qe, oe += R * ze, Z += R * _e, J += R * Ze, Q += R * at, T += R * ke, X += R * Qe, re += R * tt, pe += R * Ye, ie += R * dt, ue += R * lt, R = V[12], M += R * $e, I += R * Me, F += R * Ne, ce += R * Ke, D += R * Le, oe += R * qe, Z += R * ze, J += R * _e, Q += R * Ze, T += R * at, X += R * ke, re += R * Qe, pe += R * tt, ie += R * Ye, ue += R * dt, ve += R * lt, R = V[13], I += R * $e, F += R * Me, ce += R * Ne, D += R * Ke, oe += R * Le, Z += R * qe, J += R * ze, Q += R * _e, T += R * Ze, X += R * at, re += R * ke, pe += R * Qe, ie += R * tt, ue += R * Ye, ve += R * dt, Pe += R * lt, R = V[14], F += R * $e, ce += R * Me, D += R * Ne, oe += R * Ke, Z += R * Le, J += R * qe, Q += R * ze, T += R * _e, X += R * Ze, re += R * at, pe += R * ke, ie += R * Qe, ue += R * tt, ve += R * Ye, Pe += R * dt, De += R * lt, R = V[15], ce += R * $e, D += R * Me, oe += R * Ne, Z += R * Ke, J += R * Le, Q += R * qe, T += R * ze, X += R * _e, re += R * Ze, pe += R * at, ie += R * ke, ue += R * Qe, ve += R * tt, Pe += R * Ye, De += R * dt, Ce += R * lt, ge += 38 * D, Ee += 38 * oe, Y += 38 * Z, S += 38 * J, m += 38 * Q, f += 38 * T, g += 38 * X, b += 38 * re, x += 38 * pe, _ += 38 * ie, E += 38 * ue, v += 38 * ve, M += 38 * Pe, I += 38 * De, F += 38 * Ce, K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = _ + K + 65535, K = Math.floor(R / 65536), _ = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = M + K + 65535, K = Math.floor(R / 65536), M = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = _ + K + 65535, K = Math.floor(R / 65536), _ = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = M + K + 65535, K = Math.floor(R / 65536), M = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), W[0] = ge, W[1] = Ee, W[2] = Y, W[3] = S, W[4] = m, W[5] = f, W[6] = g, W[7] = b, W[8] = x, W[9] = _, W[10] = E, W[11] = v, W[12] = M, W[13] = I, W[14] = F, W[15] = ce; + let R, K, ge = 0, Ee = 0, Y = 0, S = 0, m = 0, f = 0, g = 0, b = 0, x = 0, _ = 0, E = 0, v = 0, P = 0, I = 0, F = 0, ce = 0, D = 0, oe = 0, Z = 0, J = 0, Q = 0, T = 0, X = 0, re = 0, de = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = te[0], Me = te[1], Ne = te[2], Ke = te[3], Le = te[4], qe = te[5], ze = te[6], _e = te[7], Ze = te[8], at = te[9], ke = te[10], Qe = te[11], tt = te[12], Ye = te[13], dt = te[14], lt = te[15]; + R = V[0], ge += R * $e, Ee += R * Me, Y += R * Ne, S += R * Ke, m += R * Le, f += R * qe, g += R * ze, b += R * _e, x += R * Ze, _ += R * at, E += R * ke, v += R * Qe, P += R * tt, I += R * Ye, F += R * dt, ce += R * lt, R = V[1], Ee += R * $e, Y += R * Me, S += R * Ne, m += R * Ke, f += R * Le, g += R * qe, b += R * ze, x += R * _e, _ += R * Ze, E += R * at, v += R * ke, P += R * Qe, I += R * tt, F += R * Ye, ce += R * dt, D += R * lt, R = V[2], Y += R * $e, S += R * Me, m += R * Ne, f += R * Ke, g += R * Le, b += R * qe, x += R * ze, _ += R * _e, E += R * Ze, v += R * at, P += R * ke, I += R * Qe, F += R * tt, ce += R * Ye, D += R * dt, oe += R * lt, R = V[3], S += R * $e, m += R * Me, f += R * Ne, g += R * Ke, b += R * Le, x += R * qe, _ += R * ze, E += R * _e, v += R * Ze, P += R * at, I += R * ke, F += R * Qe, ce += R * tt, D += R * Ye, oe += R * dt, Z += R * lt, R = V[4], m += R * $e, f += R * Me, g += R * Ne, b += R * Ke, x += R * Le, _ += R * qe, E += R * ze, v += R * _e, P += R * Ze, I += R * at, F += R * ke, ce += R * Qe, D += R * tt, oe += R * Ye, Z += R * dt, J += R * lt, R = V[5], f += R * $e, g += R * Me, b += R * Ne, x += R * Ke, _ += R * Le, E += R * qe, v += R * ze, P += R * _e, I += R * Ze, F += R * at, ce += R * ke, D += R * Qe, oe += R * tt, Z += R * Ye, J += R * dt, Q += R * lt, R = V[6], g += R * $e, b += R * Me, x += R * Ne, _ += R * Ke, E += R * Le, v += R * qe, P += R * ze, I += R * _e, F += R * Ze, ce += R * at, D += R * ke, oe += R * Qe, Z += R * tt, J += R * Ye, Q += R * dt, T += R * lt, R = V[7], b += R * $e, x += R * Me, _ += R * Ne, E += R * Ke, v += R * Le, P += R * qe, I += R * ze, F += R * _e, ce += R * Ze, D += R * at, oe += R * ke, Z += R * Qe, J += R * tt, Q += R * Ye, T += R * dt, X += R * lt, R = V[8], x += R * $e, _ += R * Me, E += R * Ne, v += R * Ke, P += R * Le, I += R * qe, F += R * ze, ce += R * _e, D += R * Ze, oe += R * at, Z += R * ke, J += R * Qe, Q += R * tt, T += R * Ye, X += R * dt, re += R * lt, R = V[9], _ += R * $e, E += R * Me, v += R * Ne, P += R * Ke, I += R * Le, F += R * qe, ce += R * ze, D += R * _e, oe += R * Ze, Z += R * at, J += R * ke, Q += R * Qe, T += R * tt, X += R * Ye, re += R * dt, de += R * lt, R = V[10], E += R * $e, v += R * Me, P += R * Ne, I += R * Ke, F += R * Le, ce += R * qe, D += R * ze, oe += R * _e, Z += R * Ze, J += R * at, Q += R * ke, T += R * Qe, X += R * tt, re += R * Ye, de += R * dt, ie += R * lt, R = V[11], v += R * $e, P += R * Me, I += R * Ne, F += R * Ke, ce += R * Le, D += R * qe, oe += R * ze, Z += R * _e, J += R * Ze, Q += R * at, T += R * ke, X += R * Qe, re += R * tt, de += R * Ye, ie += R * dt, ue += R * lt, R = V[12], P += R * $e, I += R * Me, F += R * Ne, ce += R * Ke, D += R * Le, oe += R * qe, Z += R * ze, J += R * _e, Q += R * Ze, T += R * at, X += R * ke, re += R * Qe, de += R * tt, ie += R * Ye, ue += R * dt, ve += R * lt, R = V[13], I += R * $e, F += R * Me, ce += R * Ne, D += R * Ke, oe += R * Le, Z += R * qe, J += R * ze, Q += R * _e, T += R * Ze, X += R * at, re += R * ke, de += R * Qe, ie += R * tt, ue += R * Ye, ve += R * dt, Pe += R * lt, R = V[14], F += R * $e, ce += R * Me, D += R * Ne, oe += R * Ke, Z += R * Le, J += R * qe, Q += R * ze, T += R * _e, X += R * Ze, re += R * at, de += R * ke, ie += R * Qe, ue += R * tt, ve += R * Ye, Pe += R * dt, De += R * lt, R = V[15], ce += R * $e, D += R * Me, oe += R * Ne, Z += R * Ke, J += R * Le, Q += R * qe, T += R * ze, X += R * _e, re += R * Ze, de += R * at, ie += R * ke, ue += R * Qe, ve += R * tt, Pe += R * Ye, De += R * dt, Ce += R * lt, ge += 38 * D, Ee += 38 * oe, Y += 38 * Z, S += 38 * J, m += 38 * Q, f += 38 * T, g += 38 * X, b += 38 * re, x += 38 * de, _ += 38 * ie, E += 38 * ue, v += 38 * ve, P += 38 * Pe, I += 38 * De, F += 38 * Ce, K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = _ + K + 65535, K = Math.floor(R / 65536), _ = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = P + K + 65535, K = Math.floor(R / 65536), P = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = _ + K + 65535, K = Math.floor(R / 65536), _ = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = P + K + 65535, K = Math.floor(R / 65536), P = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), W[0] = ge, W[1] = Ee, W[2] = Y, W[3] = S, W[4] = m, W[5] = f, W[6] = g, W[7] = b, W[8] = x, W[9] = _, W[10] = E, W[11] = v, W[12] = P, W[13] = I, W[14] = F, W[15] = ce; } function A(W, V) { w(W, V, V); } - function P(W, V) { + function M(W, V) { const te = n(); for (let R = 0; R < 16; R++) te[R] = V[R]; @@ -13058,7 +13058,7 @@ var Jv = {}; for (let x = 0; x < 16; x++) R[x + 16] = K[x], R[x + 32] = Ee[x], R[x + 48] = ge[x], R[x + 64] = Y[x]; const f = R.subarray(32), g = R.subarray(16); - P(f, f), w(g, g, f); + M(f, f), w(g, g, f); const b = new Uint8Array(32); return u(b, g), b; } @@ -13067,7 +13067,7 @@ var Jv = {}; return N(W, i); } t.scalarMultBase = L; - function $(W) { + function B(W) { if (W.length !== t.SECRET_KEY_LENGTH) throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`); const V = new Uint8Array(W); @@ -13076,12 +13076,12 @@ var Jv = {}; secretKey: V }; } - t.generateKeyPairFromSeed = $; - function B(W) { - const V = (0, e.randomBytes)(32, W), te = $(V); + t.generateKeyPairFromSeed = B; + function $(W) { + const V = (0, e.randomBytes)(32, W), te = B(V); return (0, r.wipe)(V), te; } - t.generateKeyPair = B; + t.generateKeyPair = $; function H(W, V, te = !1) { if (W.length !== t.PUBLIC_KEY_LENGTH) throw new Error("X25519: incorrect secret key length"); @@ -13099,26 +13099,26 @@ var Jv = {}; } t.sharedKey = H; })(Jv); -var E8 = {}; -const qU = "elliptic", zU = "6.6.0", WU = "EC cryptography", HU = "lib/elliptic.js", KU = [ +var x8 = {}; +const zU = "elliptic", WU = "6.6.0", HU = "EC cryptography", KU = "lib/elliptic.js", VU = [ "lib" -], VU = { +], GU = { lint: "eslint lib test", "lint:fix": "npm run lint -- --fix", unit: "istanbul test _mocha --reporter=spec test/index.js", test: "npm run lint && npm run unit", version: "grunt dist && git add dist/" -}, GU = { +}, YU = { type: "git", url: "git@github.com:indutny/elliptic" -}, YU = [ +}, JU = [ "EC", "Elliptic", "curve", "Cryptography" -], JU = "Fedor Indutny ", XU = "MIT", ZU = { +], XU = "Fedor Indutny ", ZU = "MIT", QU = { url: "https://github.com/indutny/elliptic/issues" -}, QU = "https://github.com/indutny/elliptic", eq = { +}, eq = "https://github.com/indutny/elliptic", tq = { brfs: "^2.0.2", coveralls: "^3.1.0", eslint: "^7.6.0", @@ -13132,7 +13132,7 @@ const qU = "elliptic", zU = "6.6.0", WU = "EC cryptography", HU = "lib/elliptic. "grunt-saucelabs": "^9.0.1", istanbul: "^0.4.5", mocha: "^8.0.1" -}, tq = { +}, rq = { "bn.js": "^4.11.9", brorand: "^1.1.0", "hash.js": "^1.0.0", @@ -13140,23 +13140,23 @@ const qU = "elliptic", zU = "6.6.0", WU = "EC cryptography", HU = "lib/elliptic. inherits: "^2.0.4", "minimalistic-assert": "^1.0.1", "minimalistic-crypto-utils": "^1.0.1" -}, rq = { - name: qU, - version: zU, - description: WU, - main: HU, - files: KU, - scripts: VU, - repository: GU, - keywords: YU, - author: JU, - license: XU, - bugs: ZU, - homepage: QU, - devDependencies: eq, - dependencies: tq -}; -var Fi = {}, Xv = { exports: {} }; +}, nq = { + name: zU, + version: WU, + description: HU, + main: KU, + files: VU, + scripts: GU, + repository: YU, + keywords: JU, + author: XU, + license: ZU, + bugs: QU, + homepage: eq, + devDependencies: tq, + dependencies: rq +}; +var Bi = {}, Xv = { exports: {} }; Xv.exports; (function(t) { (function(e, r) { @@ -13253,11 +13253,11 @@ Xv.exports; for (var g = 0, b = 1; b <= 67108863; b *= m) g++; g--, b = b / m | 0; - for (var x = S.length - f, _ = x % g, E = Math.min(x, x - _) + f, v = 0, M = f; M < E; M += g) - v = l(S, M, M + g, m), this.imuln(b), this.words[0] + v < 67108864 ? this.words[0] += v : this._iaddn(v); + for (var x = S.length - f, _ = x % g, E = Math.min(x, x - _) + f, v = 0, P = f; P < E; P += g) + v = l(S, P, P + g, m), this.imuln(b), this.words[0] + v < 67108864 ? this.words[0] += v : this._iaddn(v); if (_ !== 0) { var I = 1; - for (v = l(S, M, S.length, m), M = 0; M < _; M++) + for (v = l(S, P, S.length, m), P = 0; P < _; P++) I *= m; this.imuln(I), this.words[0] + v < 67108864 ? this.words[0] += v : this._iaddn(v); } @@ -13401,12 +13401,12 @@ Xv.exports; return this.negative !== 0 && (f = "-" + f), f; } if (S === (S | 0) && S >= 2 && S <= 36) { - var v = p[S], M = w[S]; + var v = p[S], P = w[S]; f = ""; var I = this.clone(); for (I.negative = 0; !I.isZero(); ) { - var F = I.modn(M).toString(S); - I = I.idivn(M), I.isZero() ? f = F + f : f = d[v - F.length] + F + f; + var F = I.modn(P).toString(S); + I = I.idivn(P), I.isZero() ? f = F + f : f = d[v - F.length] + F + f; } for (this.isZero() && (f = "0" + f); f.length % m !== 0; ) f = "0" + f; @@ -13425,17 +13425,17 @@ Xv.exports; }, s.prototype.toArrayLike = function(S, m, f) { var g = this.byteLength(), b = f || Math.max(1, g); n(g <= b, "byte array longer than desired length"), n(b > 0, "Requested array length <= 0"), this.strip(); - var x = m === "le", _ = new S(b), E, v, M = this.clone(); + var x = m === "le", _ = new S(b), E, v, P = this.clone(); if (x) { - for (v = 0; !M.isZero(); v++) - E = M.andln(255), M.iushrn(8), _[v] = E; + for (v = 0; !P.isZero(); v++) + E = P.andln(255), P.iushrn(8), _[v] = E; for (; v < b; v++) _[v] = 0; } else { for (v = 0; v < b - g; v++) _[v] = 0; - for (v = 0; !M.isZero(); v++) - E = M.andln(255), M.iushrn(8), _[b - v - 1] = E; + for (v = 0; !P.isZero(); v++) + E = P.andln(255), P.iushrn(8), _[b - v - 1] = E; } return _; }, Math.clz32 ? s.prototype._countBits = function(S) { @@ -13573,138 +13573,138 @@ Xv.exports; }, s.prototype.sub = function(S) { return this.clone().isub(S); }; - function P(Y, S, m) { + function M(Y, S, m) { m.negative = S.negative ^ Y.negative; var f = Y.length + S.length | 0; m.length = f, f = f - 1 | 0; var g = Y.words[0] | 0, b = S.words[0] | 0, x = g * b, _ = x & 67108863, E = x / 67108864 | 0; m.words[0] = _; for (var v = 1; v < f; v++) { - for (var M = E >>> 26, I = E & 67108863, F = Math.min(v, S.length - 1), ce = Math.max(0, v - Y.length + 1); ce <= F; ce++) { + for (var P = E >>> 26, I = E & 67108863, F = Math.min(v, S.length - 1), ce = Math.max(0, v - Y.length + 1); ce <= F; ce++) { var D = v - ce | 0; - g = Y.words[D] | 0, b = S.words[ce] | 0, x = g * b + I, M += x / 67108864 | 0, I = x & 67108863; + g = Y.words[D] | 0, b = S.words[ce] | 0, x = g * b + I, P += x / 67108864 | 0, I = x & 67108863; } - m.words[v] = I | 0, E = M | 0; + m.words[v] = I | 0, E = P | 0; } return E !== 0 ? m.words[v] = E | 0 : m.length--, m.strip(); } var N = function(S, m, f) { - var g = S.words, b = m.words, x = f.words, _ = 0, E, v, M, I = g[0] | 0, F = I & 8191, ce = I >>> 13, D = g[1] | 0, oe = D & 8191, Z = D >>> 13, J = g[2] | 0, Q = J & 8191, T = J >>> 13, X = g[3] | 0, re = X & 8191, pe = X >>> 13, ie = g[4] | 0, ue = ie & 8191, ve = ie >>> 13, Pe = g[5] | 0, De = Pe & 8191, Ce = Pe >>> 13, $e = g[6] | 0, Me = $e & 8191, Ne = $e >>> 13, Ke = g[7] | 0, Le = Ke & 8191, qe = Ke >>> 13, ze = g[8] | 0, _e = ze & 8191, Ze = ze >>> 13, at = g[9] | 0, ke = at & 8191, Qe = at >>> 13, tt = b[0] | 0, Ye = tt & 8191, dt = tt >>> 13, lt = b[1] | 0, ct = lt & 8191, qt = lt >>> 13, Jt = b[2] | 0, Et = Jt & 8191, er = Jt >>> 13, Xt = b[3] | 0, Dt = Xt & 8191, kt = Xt >>> 13, Ct = b[4] | 0, gt = Ct & 8191, Rt = Ct >>> 13, Nt = b[5] | 0, vt = Nt & 8191, $t = Nt >>> 13, Ft = b[6] | 0, rt = Ft & 8191, Bt = Ft >>> 13, k = b[7] | 0, U = k & 8191, z = k >>> 13, C = b[8] | 0, G = C & 8191, j = C >>> 13, se = b[9] | 0, de = se & 8191, xe = se >>> 13; - f.negative = S.negative ^ m.negative, f.length = 19, E = Math.imul(F, Ye), v = Math.imul(F, dt), v = v + Math.imul(ce, Ye) | 0, M = Math.imul(ce, dt); + var g = S.words, b = m.words, x = f.words, _ = 0, E, v, P, I = g[0] | 0, F = I & 8191, ce = I >>> 13, D = g[1] | 0, oe = D & 8191, Z = D >>> 13, J = g[2] | 0, Q = J & 8191, T = J >>> 13, X = g[3] | 0, re = X & 8191, de = X >>> 13, ie = g[4] | 0, ue = ie & 8191, ve = ie >>> 13, Pe = g[5] | 0, De = Pe & 8191, Ce = Pe >>> 13, $e = g[6] | 0, Me = $e & 8191, Ne = $e >>> 13, Ke = g[7] | 0, Le = Ke & 8191, qe = Ke >>> 13, ze = g[8] | 0, _e = ze & 8191, Ze = ze >>> 13, at = g[9] | 0, ke = at & 8191, Qe = at >>> 13, tt = b[0] | 0, Ye = tt & 8191, dt = tt >>> 13, lt = b[1] | 0, ct = lt & 8191, qt = lt >>> 13, Yt = b[2] | 0, Et = Yt & 8191, er = Yt >>> 13, Jt = b[3] | 0, Dt = Jt & 8191, kt = Jt >>> 13, Ct = b[4] | 0, gt = Ct & 8191, Rt = Ct >>> 13, Nt = b[5] | 0, vt = Nt & 8191, $t = Nt >>> 13, Ft = b[6] | 0, rt = Ft & 8191, Bt = Ft >>> 13, k = b[7] | 0, U = k & 8191, z = k >>> 13, C = b[8] | 0, G = C & 8191, j = C >>> 13, se = b[9] | 0, he = se & 8191, xe = se >>> 13; + f.negative = S.negative ^ m.negative, f.length = 19, E = Math.imul(F, Ye), v = Math.imul(F, dt), v = v + Math.imul(ce, Ye) | 0, P = Math.imul(ce, dt); var Te = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (M + (v >>> 13) | 0) + (Te >>> 26) | 0, Te &= 67108863, E = Math.imul(oe, Ye), v = Math.imul(oe, dt), v = v + Math.imul(Z, Ye) | 0, M = Math.imul(Z, dt), E = E + Math.imul(F, ct) | 0, v = v + Math.imul(F, qt) | 0, v = v + Math.imul(ce, ct) | 0, M = M + Math.imul(ce, qt) | 0; + _ = (P + (v >>> 13) | 0) + (Te >>> 26) | 0, Te &= 67108863, E = Math.imul(oe, Ye), v = Math.imul(oe, dt), v = v + Math.imul(Z, Ye) | 0, P = Math.imul(Z, dt), E = E + Math.imul(F, ct) | 0, v = v + Math.imul(F, qt) | 0, v = v + Math.imul(ce, ct) | 0, P = P + Math.imul(ce, qt) | 0; var Re = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (M + (v >>> 13) | 0) + (Re >>> 26) | 0, Re &= 67108863, E = Math.imul(Q, Ye), v = Math.imul(Q, dt), v = v + Math.imul(T, Ye) | 0, M = Math.imul(T, dt), E = E + Math.imul(oe, ct) | 0, v = v + Math.imul(oe, qt) | 0, v = v + Math.imul(Z, ct) | 0, M = M + Math.imul(Z, qt) | 0, E = E + Math.imul(F, Et) | 0, v = v + Math.imul(F, er) | 0, v = v + Math.imul(ce, Et) | 0, M = M + Math.imul(ce, er) | 0; + _ = (P + (v >>> 13) | 0) + (Re >>> 26) | 0, Re &= 67108863, E = Math.imul(Q, Ye), v = Math.imul(Q, dt), v = v + Math.imul(T, Ye) | 0, P = Math.imul(T, dt), E = E + Math.imul(oe, ct) | 0, v = v + Math.imul(oe, qt) | 0, v = v + Math.imul(Z, ct) | 0, P = P + Math.imul(Z, qt) | 0, E = E + Math.imul(F, Et) | 0, v = v + Math.imul(F, er) | 0, v = v + Math.imul(ce, Et) | 0, P = P + Math.imul(ce, er) | 0; var nt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (M + (v >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, E = Math.imul(re, Ye), v = Math.imul(re, dt), v = v + Math.imul(pe, Ye) | 0, M = Math.imul(pe, dt), E = E + Math.imul(Q, ct) | 0, v = v + Math.imul(Q, qt) | 0, v = v + Math.imul(T, ct) | 0, M = M + Math.imul(T, qt) | 0, E = E + Math.imul(oe, Et) | 0, v = v + Math.imul(oe, er) | 0, v = v + Math.imul(Z, Et) | 0, M = M + Math.imul(Z, er) | 0, E = E + Math.imul(F, Dt) | 0, v = v + Math.imul(F, kt) | 0, v = v + Math.imul(ce, Dt) | 0, M = M + Math.imul(ce, kt) | 0; + _ = (P + (v >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, E = Math.imul(re, Ye), v = Math.imul(re, dt), v = v + Math.imul(de, Ye) | 0, P = Math.imul(de, dt), E = E + Math.imul(Q, ct) | 0, v = v + Math.imul(Q, qt) | 0, v = v + Math.imul(T, ct) | 0, P = P + Math.imul(T, qt) | 0, E = E + Math.imul(oe, Et) | 0, v = v + Math.imul(oe, er) | 0, v = v + Math.imul(Z, Et) | 0, P = P + Math.imul(Z, er) | 0, E = E + Math.imul(F, Dt) | 0, v = v + Math.imul(F, kt) | 0, v = v + Math.imul(ce, Dt) | 0, P = P + Math.imul(ce, kt) | 0; var je = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (M + (v >>> 13) | 0) + (je >>> 26) | 0, je &= 67108863, E = Math.imul(ue, Ye), v = Math.imul(ue, dt), v = v + Math.imul(ve, Ye) | 0, M = Math.imul(ve, dt), E = E + Math.imul(re, ct) | 0, v = v + Math.imul(re, qt) | 0, v = v + Math.imul(pe, ct) | 0, M = M + Math.imul(pe, qt) | 0, E = E + Math.imul(Q, Et) | 0, v = v + Math.imul(Q, er) | 0, v = v + Math.imul(T, Et) | 0, M = M + Math.imul(T, er) | 0, E = E + Math.imul(oe, Dt) | 0, v = v + Math.imul(oe, kt) | 0, v = v + Math.imul(Z, Dt) | 0, M = M + Math.imul(Z, kt) | 0, E = E + Math.imul(F, gt) | 0, v = v + Math.imul(F, Rt) | 0, v = v + Math.imul(ce, gt) | 0, M = M + Math.imul(ce, Rt) | 0; + _ = (P + (v >>> 13) | 0) + (je >>> 26) | 0, je &= 67108863, E = Math.imul(ue, Ye), v = Math.imul(ue, dt), v = v + Math.imul(ve, Ye) | 0, P = Math.imul(ve, dt), E = E + Math.imul(re, ct) | 0, v = v + Math.imul(re, qt) | 0, v = v + Math.imul(de, ct) | 0, P = P + Math.imul(de, qt) | 0, E = E + Math.imul(Q, Et) | 0, v = v + Math.imul(Q, er) | 0, v = v + Math.imul(T, Et) | 0, P = P + Math.imul(T, er) | 0, E = E + Math.imul(oe, Dt) | 0, v = v + Math.imul(oe, kt) | 0, v = v + Math.imul(Z, Dt) | 0, P = P + Math.imul(Z, kt) | 0, E = E + Math.imul(F, gt) | 0, v = v + Math.imul(F, Rt) | 0, v = v + Math.imul(ce, gt) | 0, P = P + Math.imul(ce, Rt) | 0; var pt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (M + (v >>> 13) | 0) + (pt >>> 26) | 0, pt &= 67108863, E = Math.imul(De, Ye), v = Math.imul(De, dt), v = v + Math.imul(Ce, Ye) | 0, M = Math.imul(Ce, dt), E = E + Math.imul(ue, ct) | 0, v = v + Math.imul(ue, qt) | 0, v = v + Math.imul(ve, ct) | 0, M = M + Math.imul(ve, qt) | 0, E = E + Math.imul(re, Et) | 0, v = v + Math.imul(re, er) | 0, v = v + Math.imul(pe, Et) | 0, M = M + Math.imul(pe, er) | 0, E = E + Math.imul(Q, Dt) | 0, v = v + Math.imul(Q, kt) | 0, v = v + Math.imul(T, Dt) | 0, M = M + Math.imul(T, kt) | 0, E = E + Math.imul(oe, gt) | 0, v = v + Math.imul(oe, Rt) | 0, v = v + Math.imul(Z, gt) | 0, M = M + Math.imul(Z, Rt) | 0, E = E + Math.imul(F, vt) | 0, v = v + Math.imul(F, $t) | 0, v = v + Math.imul(ce, vt) | 0, M = M + Math.imul(ce, $t) | 0; + _ = (P + (v >>> 13) | 0) + (pt >>> 26) | 0, pt &= 67108863, E = Math.imul(De, Ye), v = Math.imul(De, dt), v = v + Math.imul(Ce, Ye) | 0, P = Math.imul(Ce, dt), E = E + Math.imul(ue, ct) | 0, v = v + Math.imul(ue, qt) | 0, v = v + Math.imul(ve, ct) | 0, P = P + Math.imul(ve, qt) | 0, E = E + Math.imul(re, Et) | 0, v = v + Math.imul(re, er) | 0, v = v + Math.imul(de, Et) | 0, P = P + Math.imul(de, er) | 0, E = E + Math.imul(Q, Dt) | 0, v = v + Math.imul(Q, kt) | 0, v = v + Math.imul(T, Dt) | 0, P = P + Math.imul(T, kt) | 0, E = E + Math.imul(oe, gt) | 0, v = v + Math.imul(oe, Rt) | 0, v = v + Math.imul(Z, gt) | 0, P = P + Math.imul(Z, Rt) | 0, E = E + Math.imul(F, vt) | 0, v = v + Math.imul(F, $t) | 0, v = v + Math.imul(ce, vt) | 0, P = P + Math.imul(ce, $t) | 0; var it = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (M + (v >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, E = Math.imul(Me, Ye), v = Math.imul(Me, dt), v = v + Math.imul(Ne, Ye) | 0, M = Math.imul(Ne, dt), E = E + Math.imul(De, ct) | 0, v = v + Math.imul(De, qt) | 0, v = v + Math.imul(Ce, ct) | 0, M = M + Math.imul(Ce, qt) | 0, E = E + Math.imul(ue, Et) | 0, v = v + Math.imul(ue, er) | 0, v = v + Math.imul(ve, Et) | 0, M = M + Math.imul(ve, er) | 0, E = E + Math.imul(re, Dt) | 0, v = v + Math.imul(re, kt) | 0, v = v + Math.imul(pe, Dt) | 0, M = M + Math.imul(pe, kt) | 0, E = E + Math.imul(Q, gt) | 0, v = v + Math.imul(Q, Rt) | 0, v = v + Math.imul(T, gt) | 0, M = M + Math.imul(T, Rt) | 0, E = E + Math.imul(oe, vt) | 0, v = v + Math.imul(oe, $t) | 0, v = v + Math.imul(Z, vt) | 0, M = M + Math.imul(Z, $t) | 0, E = E + Math.imul(F, rt) | 0, v = v + Math.imul(F, Bt) | 0, v = v + Math.imul(ce, rt) | 0, M = M + Math.imul(ce, Bt) | 0; + _ = (P + (v >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, E = Math.imul(Me, Ye), v = Math.imul(Me, dt), v = v + Math.imul(Ne, Ye) | 0, P = Math.imul(Ne, dt), E = E + Math.imul(De, ct) | 0, v = v + Math.imul(De, qt) | 0, v = v + Math.imul(Ce, ct) | 0, P = P + Math.imul(Ce, qt) | 0, E = E + Math.imul(ue, Et) | 0, v = v + Math.imul(ue, er) | 0, v = v + Math.imul(ve, Et) | 0, P = P + Math.imul(ve, er) | 0, E = E + Math.imul(re, Dt) | 0, v = v + Math.imul(re, kt) | 0, v = v + Math.imul(de, Dt) | 0, P = P + Math.imul(de, kt) | 0, E = E + Math.imul(Q, gt) | 0, v = v + Math.imul(Q, Rt) | 0, v = v + Math.imul(T, gt) | 0, P = P + Math.imul(T, Rt) | 0, E = E + Math.imul(oe, vt) | 0, v = v + Math.imul(oe, $t) | 0, v = v + Math.imul(Z, vt) | 0, P = P + Math.imul(Z, $t) | 0, E = E + Math.imul(F, rt) | 0, v = v + Math.imul(F, Bt) | 0, v = v + Math.imul(ce, rt) | 0, P = P + Math.imul(ce, Bt) | 0; var et = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (M + (v >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, E = Math.imul(Le, Ye), v = Math.imul(Le, dt), v = v + Math.imul(qe, Ye) | 0, M = Math.imul(qe, dt), E = E + Math.imul(Me, ct) | 0, v = v + Math.imul(Me, qt) | 0, v = v + Math.imul(Ne, ct) | 0, M = M + Math.imul(Ne, qt) | 0, E = E + Math.imul(De, Et) | 0, v = v + Math.imul(De, er) | 0, v = v + Math.imul(Ce, Et) | 0, M = M + Math.imul(Ce, er) | 0, E = E + Math.imul(ue, Dt) | 0, v = v + Math.imul(ue, kt) | 0, v = v + Math.imul(ve, Dt) | 0, M = M + Math.imul(ve, kt) | 0, E = E + Math.imul(re, gt) | 0, v = v + Math.imul(re, Rt) | 0, v = v + Math.imul(pe, gt) | 0, M = M + Math.imul(pe, Rt) | 0, E = E + Math.imul(Q, vt) | 0, v = v + Math.imul(Q, $t) | 0, v = v + Math.imul(T, vt) | 0, M = M + Math.imul(T, $t) | 0, E = E + Math.imul(oe, rt) | 0, v = v + Math.imul(oe, Bt) | 0, v = v + Math.imul(Z, rt) | 0, M = M + Math.imul(Z, Bt) | 0, E = E + Math.imul(F, U) | 0, v = v + Math.imul(F, z) | 0, v = v + Math.imul(ce, U) | 0, M = M + Math.imul(ce, z) | 0; + _ = (P + (v >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, E = Math.imul(Le, Ye), v = Math.imul(Le, dt), v = v + Math.imul(qe, Ye) | 0, P = Math.imul(qe, dt), E = E + Math.imul(Me, ct) | 0, v = v + Math.imul(Me, qt) | 0, v = v + Math.imul(Ne, ct) | 0, P = P + Math.imul(Ne, qt) | 0, E = E + Math.imul(De, Et) | 0, v = v + Math.imul(De, er) | 0, v = v + Math.imul(Ce, Et) | 0, P = P + Math.imul(Ce, er) | 0, E = E + Math.imul(ue, Dt) | 0, v = v + Math.imul(ue, kt) | 0, v = v + Math.imul(ve, Dt) | 0, P = P + Math.imul(ve, kt) | 0, E = E + Math.imul(re, gt) | 0, v = v + Math.imul(re, Rt) | 0, v = v + Math.imul(de, gt) | 0, P = P + Math.imul(de, Rt) | 0, E = E + Math.imul(Q, vt) | 0, v = v + Math.imul(Q, $t) | 0, v = v + Math.imul(T, vt) | 0, P = P + Math.imul(T, $t) | 0, E = E + Math.imul(oe, rt) | 0, v = v + Math.imul(oe, Bt) | 0, v = v + Math.imul(Z, rt) | 0, P = P + Math.imul(Z, Bt) | 0, E = E + Math.imul(F, U) | 0, v = v + Math.imul(F, z) | 0, v = v + Math.imul(ce, U) | 0, P = P + Math.imul(ce, z) | 0; var St = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (M + (v >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, E = Math.imul(_e, Ye), v = Math.imul(_e, dt), v = v + Math.imul(Ze, Ye) | 0, M = Math.imul(Ze, dt), E = E + Math.imul(Le, ct) | 0, v = v + Math.imul(Le, qt) | 0, v = v + Math.imul(qe, ct) | 0, M = M + Math.imul(qe, qt) | 0, E = E + Math.imul(Me, Et) | 0, v = v + Math.imul(Me, er) | 0, v = v + Math.imul(Ne, Et) | 0, M = M + Math.imul(Ne, er) | 0, E = E + Math.imul(De, Dt) | 0, v = v + Math.imul(De, kt) | 0, v = v + Math.imul(Ce, Dt) | 0, M = M + Math.imul(Ce, kt) | 0, E = E + Math.imul(ue, gt) | 0, v = v + Math.imul(ue, Rt) | 0, v = v + Math.imul(ve, gt) | 0, M = M + Math.imul(ve, Rt) | 0, E = E + Math.imul(re, vt) | 0, v = v + Math.imul(re, $t) | 0, v = v + Math.imul(pe, vt) | 0, M = M + Math.imul(pe, $t) | 0, E = E + Math.imul(Q, rt) | 0, v = v + Math.imul(Q, Bt) | 0, v = v + Math.imul(T, rt) | 0, M = M + Math.imul(T, Bt) | 0, E = E + Math.imul(oe, U) | 0, v = v + Math.imul(oe, z) | 0, v = v + Math.imul(Z, U) | 0, M = M + Math.imul(Z, z) | 0, E = E + Math.imul(F, G) | 0, v = v + Math.imul(F, j) | 0, v = v + Math.imul(ce, G) | 0, M = M + Math.imul(ce, j) | 0; + _ = (P + (v >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, E = Math.imul(_e, Ye), v = Math.imul(_e, dt), v = v + Math.imul(Ze, Ye) | 0, P = Math.imul(Ze, dt), E = E + Math.imul(Le, ct) | 0, v = v + Math.imul(Le, qt) | 0, v = v + Math.imul(qe, ct) | 0, P = P + Math.imul(qe, qt) | 0, E = E + Math.imul(Me, Et) | 0, v = v + Math.imul(Me, er) | 0, v = v + Math.imul(Ne, Et) | 0, P = P + Math.imul(Ne, er) | 0, E = E + Math.imul(De, Dt) | 0, v = v + Math.imul(De, kt) | 0, v = v + Math.imul(Ce, Dt) | 0, P = P + Math.imul(Ce, kt) | 0, E = E + Math.imul(ue, gt) | 0, v = v + Math.imul(ue, Rt) | 0, v = v + Math.imul(ve, gt) | 0, P = P + Math.imul(ve, Rt) | 0, E = E + Math.imul(re, vt) | 0, v = v + Math.imul(re, $t) | 0, v = v + Math.imul(de, vt) | 0, P = P + Math.imul(de, $t) | 0, E = E + Math.imul(Q, rt) | 0, v = v + Math.imul(Q, Bt) | 0, v = v + Math.imul(T, rt) | 0, P = P + Math.imul(T, Bt) | 0, E = E + Math.imul(oe, U) | 0, v = v + Math.imul(oe, z) | 0, v = v + Math.imul(Z, U) | 0, P = P + Math.imul(Z, z) | 0, E = E + Math.imul(F, G) | 0, v = v + Math.imul(F, j) | 0, v = v + Math.imul(ce, G) | 0, P = P + Math.imul(ce, j) | 0; var Tt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (M + (v >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, E = Math.imul(ke, Ye), v = Math.imul(ke, dt), v = v + Math.imul(Qe, Ye) | 0, M = Math.imul(Qe, dt), E = E + Math.imul(_e, ct) | 0, v = v + Math.imul(_e, qt) | 0, v = v + Math.imul(Ze, ct) | 0, M = M + Math.imul(Ze, qt) | 0, E = E + Math.imul(Le, Et) | 0, v = v + Math.imul(Le, er) | 0, v = v + Math.imul(qe, Et) | 0, M = M + Math.imul(qe, er) | 0, E = E + Math.imul(Me, Dt) | 0, v = v + Math.imul(Me, kt) | 0, v = v + Math.imul(Ne, Dt) | 0, M = M + Math.imul(Ne, kt) | 0, E = E + Math.imul(De, gt) | 0, v = v + Math.imul(De, Rt) | 0, v = v + Math.imul(Ce, gt) | 0, M = M + Math.imul(Ce, Rt) | 0, E = E + Math.imul(ue, vt) | 0, v = v + Math.imul(ue, $t) | 0, v = v + Math.imul(ve, vt) | 0, M = M + Math.imul(ve, $t) | 0, E = E + Math.imul(re, rt) | 0, v = v + Math.imul(re, Bt) | 0, v = v + Math.imul(pe, rt) | 0, M = M + Math.imul(pe, Bt) | 0, E = E + Math.imul(Q, U) | 0, v = v + Math.imul(Q, z) | 0, v = v + Math.imul(T, U) | 0, M = M + Math.imul(T, z) | 0, E = E + Math.imul(oe, G) | 0, v = v + Math.imul(oe, j) | 0, v = v + Math.imul(Z, G) | 0, M = M + Math.imul(Z, j) | 0, E = E + Math.imul(F, de) | 0, v = v + Math.imul(F, xe) | 0, v = v + Math.imul(ce, de) | 0, M = M + Math.imul(ce, xe) | 0; + _ = (P + (v >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, E = Math.imul(ke, Ye), v = Math.imul(ke, dt), v = v + Math.imul(Qe, Ye) | 0, P = Math.imul(Qe, dt), E = E + Math.imul(_e, ct) | 0, v = v + Math.imul(_e, qt) | 0, v = v + Math.imul(Ze, ct) | 0, P = P + Math.imul(Ze, qt) | 0, E = E + Math.imul(Le, Et) | 0, v = v + Math.imul(Le, er) | 0, v = v + Math.imul(qe, Et) | 0, P = P + Math.imul(qe, er) | 0, E = E + Math.imul(Me, Dt) | 0, v = v + Math.imul(Me, kt) | 0, v = v + Math.imul(Ne, Dt) | 0, P = P + Math.imul(Ne, kt) | 0, E = E + Math.imul(De, gt) | 0, v = v + Math.imul(De, Rt) | 0, v = v + Math.imul(Ce, gt) | 0, P = P + Math.imul(Ce, Rt) | 0, E = E + Math.imul(ue, vt) | 0, v = v + Math.imul(ue, $t) | 0, v = v + Math.imul(ve, vt) | 0, P = P + Math.imul(ve, $t) | 0, E = E + Math.imul(re, rt) | 0, v = v + Math.imul(re, Bt) | 0, v = v + Math.imul(de, rt) | 0, P = P + Math.imul(de, Bt) | 0, E = E + Math.imul(Q, U) | 0, v = v + Math.imul(Q, z) | 0, v = v + Math.imul(T, U) | 0, P = P + Math.imul(T, z) | 0, E = E + Math.imul(oe, G) | 0, v = v + Math.imul(oe, j) | 0, v = v + Math.imul(Z, G) | 0, P = P + Math.imul(Z, j) | 0, E = E + Math.imul(F, he) | 0, v = v + Math.imul(F, xe) | 0, v = v + Math.imul(ce, he) | 0, P = P + Math.imul(ce, xe) | 0; var At = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (M + (v >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, E = Math.imul(ke, ct), v = Math.imul(ke, qt), v = v + Math.imul(Qe, ct) | 0, M = Math.imul(Qe, qt), E = E + Math.imul(_e, Et) | 0, v = v + Math.imul(_e, er) | 0, v = v + Math.imul(Ze, Et) | 0, M = M + Math.imul(Ze, er) | 0, E = E + Math.imul(Le, Dt) | 0, v = v + Math.imul(Le, kt) | 0, v = v + Math.imul(qe, Dt) | 0, M = M + Math.imul(qe, kt) | 0, E = E + Math.imul(Me, gt) | 0, v = v + Math.imul(Me, Rt) | 0, v = v + Math.imul(Ne, gt) | 0, M = M + Math.imul(Ne, Rt) | 0, E = E + Math.imul(De, vt) | 0, v = v + Math.imul(De, $t) | 0, v = v + Math.imul(Ce, vt) | 0, M = M + Math.imul(Ce, $t) | 0, E = E + Math.imul(ue, rt) | 0, v = v + Math.imul(ue, Bt) | 0, v = v + Math.imul(ve, rt) | 0, M = M + Math.imul(ve, Bt) | 0, E = E + Math.imul(re, U) | 0, v = v + Math.imul(re, z) | 0, v = v + Math.imul(pe, U) | 0, M = M + Math.imul(pe, z) | 0, E = E + Math.imul(Q, G) | 0, v = v + Math.imul(Q, j) | 0, v = v + Math.imul(T, G) | 0, M = M + Math.imul(T, j) | 0, E = E + Math.imul(oe, de) | 0, v = v + Math.imul(oe, xe) | 0, v = v + Math.imul(Z, de) | 0, M = M + Math.imul(Z, xe) | 0; + _ = (P + (v >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, E = Math.imul(ke, ct), v = Math.imul(ke, qt), v = v + Math.imul(Qe, ct) | 0, P = Math.imul(Qe, qt), E = E + Math.imul(_e, Et) | 0, v = v + Math.imul(_e, er) | 0, v = v + Math.imul(Ze, Et) | 0, P = P + Math.imul(Ze, er) | 0, E = E + Math.imul(Le, Dt) | 0, v = v + Math.imul(Le, kt) | 0, v = v + Math.imul(qe, Dt) | 0, P = P + Math.imul(qe, kt) | 0, E = E + Math.imul(Me, gt) | 0, v = v + Math.imul(Me, Rt) | 0, v = v + Math.imul(Ne, gt) | 0, P = P + Math.imul(Ne, Rt) | 0, E = E + Math.imul(De, vt) | 0, v = v + Math.imul(De, $t) | 0, v = v + Math.imul(Ce, vt) | 0, P = P + Math.imul(Ce, $t) | 0, E = E + Math.imul(ue, rt) | 0, v = v + Math.imul(ue, Bt) | 0, v = v + Math.imul(ve, rt) | 0, P = P + Math.imul(ve, Bt) | 0, E = E + Math.imul(re, U) | 0, v = v + Math.imul(re, z) | 0, v = v + Math.imul(de, U) | 0, P = P + Math.imul(de, z) | 0, E = E + Math.imul(Q, G) | 0, v = v + Math.imul(Q, j) | 0, v = v + Math.imul(T, G) | 0, P = P + Math.imul(T, j) | 0, E = E + Math.imul(oe, he) | 0, v = v + Math.imul(oe, xe) | 0, v = v + Math.imul(Z, he) | 0, P = P + Math.imul(Z, xe) | 0; var _t = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (M + (v >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, E = Math.imul(ke, Et), v = Math.imul(ke, er), v = v + Math.imul(Qe, Et) | 0, M = Math.imul(Qe, er), E = E + Math.imul(_e, Dt) | 0, v = v + Math.imul(_e, kt) | 0, v = v + Math.imul(Ze, Dt) | 0, M = M + Math.imul(Ze, kt) | 0, E = E + Math.imul(Le, gt) | 0, v = v + Math.imul(Le, Rt) | 0, v = v + Math.imul(qe, gt) | 0, M = M + Math.imul(qe, Rt) | 0, E = E + Math.imul(Me, vt) | 0, v = v + Math.imul(Me, $t) | 0, v = v + Math.imul(Ne, vt) | 0, M = M + Math.imul(Ne, $t) | 0, E = E + Math.imul(De, rt) | 0, v = v + Math.imul(De, Bt) | 0, v = v + Math.imul(Ce, rt) | 0, M = M + Math.imul(Ce, Bt) | 0, E = E + Math.imul(ue, U) | 0, v = v + Math.imul(ue, z) | 0, v = v + Math.imul(ve, U) | 0, M = M + Math.imul(ve, z) | 0, E = E + Math.imul(re, G) | 0, v = v + Math.imul(re, j) | 0, v = v + Math.imul(pe, G) | 0, M = M + Math.imul(pe, j) | 0, E = E + Math.imul(Q, de) | 0, v = v + Math.imul(Q, xe) | 0, v = v + Math.imul(T, de) | 0, M = M + Math.imul(T, xe) | 0; + _ = (P + (v >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, E = Math.imul(ke, Et), v = Math.imul(ke, er), v = v + Math.imul(Qe, Et) | 0, P = Math.imul(Qe, er), E = E + Math.imul(_e, Dt) | 0, v = v + Math.imul(_e, kt) | 0, v = v + Math.imul(Ze, Dt) | 0, P = P + Math.imul(Ze, kt) | 0, E = E + Math.imul(Le, gt) | 0, v = v + Math.imul(Le, Rt) | 0, v = v + Math.imul(qe, gt) | 0, P = P + Math.imul(qe, Rt) | 0, E = E + Math.imul(Me, vt) | 0, v = v + Math.imul(Me, $t) | 0, v = v + Math.imul(Ne, vt) | 0, P = P + Math.imul(Ne, $t) | 0, E = E + Math.imul(De, rt) | 0, v = v + Math.imul(De, Bt) | 0, v = v + Math.imul(Ce, rt) | 0, P = P + Math.imul(Ce, Bt) | 0, E = E + Math.imul(ue, U) | 0, v = v + Math.imul(ue, z) | 0, v = v + Math.imul(ve, U) | 0, P = P + Math.imul(ve, z) | 0, E = E + Math.imul(re, G) | 0, v = v + Math.imul(re, j) | 0, v = v + Math.imul(de, G) | 0, P = P + Math.imul(de, j) | 0, E = E + Math.imul(Q, he) | 0, v = v + Math.imul(Q, xe) | 0, v = v + Math.imul(T, he) | 0, P = P + Math.imul(T, xe) | 0; var ht = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (M + (v >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, E = Math.imul(ke, Dt), v = Math.imul(ke, kt), v = v + Math.imul(Qe, Dt) | 0, M = Math.imul(Qe, kt), E = E + Math.imul(_e, gt) | 0, v = v + Math.imul(_e, Rt) | 0, v = v + Math.imul(Ze, gt) | 0, M = M + Math.imul(Ze, Rt) | 0, E = E + Math.imul(Le, vt) | 0, v = v + Math.imul(Le, $t) | 0, v = v + Math.imul(qe, vt) | 0, M = M + Math.imul(qe, $t) | 0, E = E + Math.imul(Me, rt) | 0, v = v + Math.imul(Me, Bt) | 0, v = v + Math.imul(Ne, rt) | 0, M = M + Math.imul(Ne, Bt) | 0, E = E + Math.imul(De, U) | 0, v = v + Math.imul(De, z) | 0, v = v + Math.imul(Ce, U) | 0, M = M + Math.imul(Ce, z) | 0, E = E + Math.imul(ue, G) | 0, v = v + Math.imul(ue, j) | 0, v = v + Math.imul(ve, G) | 0, M = M + Math.imul(ve, j) | 0, E = E + Math.imul(re, de) | 0, v = v + Math.imul(re, xe) | 0, v = v + Math.imul(pe, de) | 0, M = M + Math.imul(pe, xe) | 0; + _ = (P + (v >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, E = Math.imul(ke, Dt), v = Math.imul(ke, kt), v = v + Math.imul(Qe, Dt) | 0, P = Math.imul(Qe, kt), E = E + Math.imul(_e, gt) | 0, v = v + Math.imul(_e, Rt) | 0, v = v + Math.imul(Ze, gt) | 0, P = P + Math.imul(Ze, Rt) | 0, E = E + Math.imul(Le, vt) | 0, v = v + Math.imul(Le, $t) | 0, v = v + Math.imul(qe, vt) | 0, P = P + Math.imul(qe, $t) | 0, E = E + Math.imul(Me, rt) | 0, v = v + Math.imul(Me, Bt) | 0, v = v + Math.imul(Ne, rt) | 0, P = P + Math.imul(Ne, Bt) | 0, E = E + Math.imul(De, U) | 0, v = v + Math.imul(De, z) | 0, v = v + Math.imul(Ce, U) | 0, P = P + Math.imul(Ce, z) | 0, E = E + Math.imul(ue, G) | 0, v = v + Math.imul(ue, j) | 0, v = v + Math.imul(ve, G) | 0, P = P + Math.imul(ve, j) | 0, E = E + Math.imul(re, he) | 0, v = v + Math.imul(re, xe) | 0, v = v + Math.imul(de, he) | 0, P = P + Math.imul(de, xe) | 0; var xt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (M + (v >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, E = Math.imul(ke, gt), v = Math.imul(ke, Rt), v = v + Math.imul(Qe, gt) | 0, M = Math.imul(Qe, Rt), E = E + Math.imul(_e, vt) | 0, v = v + Math.imul(_e, $t) | 0, v = v + Math.imul(Ze, vt) | 0, M = M + Math.imul(Ze, $t) | 0, E = E + Math.imul(Le, rt) | 0, v = v + Math.imul(Le, Bt) | 0, v = v + Math.imul(qe, rt) | 0, M = M + Math.imul(qe, Bt) | 0, E = E + Math.imul(Me, U) | 0, v = v + Math.imul(Me, z) | 0, v = v + Math.imul(Ne, U) | 0, M = M + Math.imul(Ne, z) | 0, E = E + Math.imul(De, G) | 0, v = v + Math.imul(De, j) | 0, v = v + Math.imul(Ce, G) | 0, M = M + Math.imul(Ce, j) | 0, E = E + Math.imul(ue, de) | 0, v = v + Math.imul(ue, xe) | 0, v = v + Math.imul(ve, de) | 0, M = M + Math.imul(ve, xe) | 0; + _ = (P + (v >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, E = Math.imul(ke, gt), v = Math.imul(ke, Rt), v = v + Math.imul(Qe, gt) | 0, P = Math.imul(Qe, Rt), E = E + Math.imul(_e, vt) | 0, v = v + Math.imul(_e, $t) | 0, v = v + Math.imul(Ze, vt) | 0, P = P + Math.imul(Ze, $t) | 0, E = E + Math.imul(Le, rt) | 0, v = v + Math.imul(Le, Bt) | 0, v = v + Math.imul(qe, rt) | 0, P = P + Math.imul(qe, Bt) | 0, E = E + Math.imul(Me, U) | 0, v = v + Math.imul(Me, z) | 0, v = v + Math.imul(Ne, U) | 0, P = P + Math.imul(Ne, z) | 0, E = E + Math.imul(De, G) | 0, v = v + Math.imul(De, j) | 0, v = v + Math.imul(Ce, G) | 0, P = P + Math.imul(Ce, j) | 0, E = E + Math.imul(ue, he) | 0, v = v + Math.imul(ue, xe) | 0, v = v + Math.imul(ve, he) | 0, P = P + Math.imul(ve, xe) | 0; var st = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (M + (v >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, E = Math.imul(ke, vt), v = Math.imul(ke, $t), v = v + Math.imul(Qe, vt) | 0, M = Math.imul(Qe, $t), E = E + Math.imul(_e, rt) | 0, v = v + Math.imul(_e, Bt) | 0, v = v + Math.imul(Ze, rt) | 0, M = M + Math.imul(Ze, Bt) | 0, E = E + Math.imul(Le, U) | 0, v = v + Math.imul(Le, z) | 0, v = v + Math.imul(qe, U) | 0, M = M + Math.imul(qe, z) | 0, E = E + Math.imul(Me, G) | 0, v = v + Math.imul(Me, j) | 0, v = v + Math.imul(Ne, G) | 0, M = M + Math.imul(Ne, j) | 0, E = E + Math.imul(De, de) | 0, v = v + Math.imul(De, xe) | 0, v = v + Math.imul(Ce, de) | 0, M = M + Math.imul(Ce, xe) | 0; + _ = (P + (v >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, E = Math.imul(ke, vt), v = Math.imul(ke, $t), v = v + Math.imul(Qe, vt) | 0, P = Math.imul(Qe, $t), E = E + Math.imul(_e, rt) | 0, v = v + Math.imul(_e, Bt) | 0, v = v + Math.imul(Ze, rt) | 0, P = P + Math.imul(Ze, Bt) | 0, E = E + Math.imul(Le, U) | 0, v = v + Math.imul(Le, z) | 0, v = v + Math.imul(qe, U) | 0, P = P + Math.imul(qe, z) | 0, E = E + Math.imul(Me, G) | 0, v = v + Math.imul(Me, j) | 0, v = v + Math.imul(Ne, G) | 0, P = P + Math.imul(Ne, j) | 0, E = E + Math.imul(De, he) | 0, v = v + Math.imul(De, xe) | 0, v = v + Math.imul(Ce, he) | 0, P = P + Math.imul(Ce, xe) | 0; var bt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (M + (v >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, E = Math.imul(ke, rt), v = Math.imul(ke, Bt), v = v + Math.imul(Qe, rt) | 0, M = Math.imul(Qe, Bt), E = E + Math.imul(_e, U) | 0, v = v + Math.imul(_e, z) | 0, v = v + Math.imul(Ze, U) | 0, M = M + Math.imul(Ze, z) | 0, E = E + Math.imul(Le, G) | 0, v = v + Math.imul(Le, j) | 0, v = v + Math.imul(qe, G) | 0, M = M + Math.imul(qe, j) | 0, E = E + Math.imul(Me, de) | 0, v = v + Math.imul(Me, xe) | 0, v = v + Math.imul(Ne, de) | 0, M = M + Math.imul(Ne, xe) | 0; + _ = (P + (v >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, E = Math.imul(ke, rt), v = Math.imul(ke, Bt), v = v + Math.imul(Qe, rt) | 0, P = Math.imul(Qe, Bt), E = E + Math.imul(_e, U) | 0, v = v + Math.imul(_e, z) | 0, v = v + Math.imul(Ze, U) | 0, P = P + Math.imul(Ze, z) | 0, E = E + Math.imul(Le, G) | 0, v = v + Math.imul(Le, j) | 0, v = v + Math.imul(qe, G) | 0, P = P + Math.imul(qe, j) | 0, E = E + Math.imul(Me, he) | 0, v = v + Math.imul(Me, xe) | 0, v = v + Math.imul(Ne, he) | 0, P = P + Math.imul(Ne, xe) | 0; var ut = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (M + (v >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, E = Math.imul(ke, U), v = Math.imul(ke, z), v = v + Math.imul(Qe, U) | 0, M = Math.imul(Qe, z), E = E + Math.imul(_e, G) | 0, v = v + Math.imul(_e, j) | 0, v = v + Math.imul(Ze, G) | 0, M = M + Math.imul(Ze, j) | 0, E = E + Math.imul(Le, de) | 0, v = v + Math.imul(Le, xe) | 0, v = v + Math.imul(qe, de) | 0, M = M + Math.imul(qe, xe) | 0; + _ = (P + (v >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, E = Math.imul(ke, U), v = Math.imul(ke, z), v = v + Math.imul(Qe, U) | 0, P = Math.imul(Qe, z), E = E + Math.imul(_e, G) | 0, v = v + Math.imul(_e, j) | 0, v = v + Math.imul(Ze, G) | 0, P = P + Math.imul(Ze, j) | 0, E = E + Math.imul(Le, he) | 0, v = v + Math.imul(Le, xe) | 0, v = v + Math.imul(qe, he) | 0, P = P + Math.imul(qe, xe) | 0; var ot = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (M + (v >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, E = Math.imul(ke, G), v = Math.imul(ke, j), v = v + Math.imul(Qe, G) | 0, M = Math.imul(Qe, j), E = E + Math.imul(_e, de) | 0, v = v + Math.imul(_e, xe) | 0, v = v + Math.imul(Ze, de) | 0, M = M + Math.imul(Ze, xe) | 0; + _ = (P + (v >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, E = Math.imul(ke, G), v = Math.imul(ke, j), v = v + Math.imul(Qe, G) | 0, P = Math.imul(Qe, j), E = E + Math.imul(_e, he) | 0, v = v + Math.imul(_e, xe) | 0, v = v + Math.imul(Ze, he) | 0, P = P + Math.imul(Ze, xe) | 0; var Se = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (M + (v >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, E = Math.imul(ke, de), v = Math.imul(ke, xe), v = v + Math.imul(Qe, de) | 0, M = Math.imul(Qe, xe); + _ = (P + (v >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, E = Math.imul(ke, he), v = Math.imul(ke, xe), v = v + Math.imul(Qe, he) | 0, P = Math.imul(Qe, xe); var Ae = (_ + E | 0) + ((v & 8191) << 13) | 0; - return _ = (M + (v >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, x[0] = Te, x[1] = Re, x[2] = nt, x[3] = je, x[4] = pt, x[5] = it, x[6] = et, x[7] = St, x[8] = Tt, x[9] = At, x[10] = _t, x[11] = ht, x[12] = xt, x[13] = st, x[14] = bt, x[15] = ut, x[16] = ot, x[17] = Se, x[18] = Ae, _ !== 0 && (x[19] = _, f.length++), f; + return _ = (P + (v >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, x[0] = Te, x[1] = Re, x[2] = nt, x[3] = je, x[4] = pt, x[5] = it, x[6] = et, x[7] = St, x[8] = Tt, x[9] = At, x[10] = _t, x[11] = ht, x[12] = xt, x[13] = st, x[14] = bt, x[15] = ut, x[16] = ot, x[17] = Se, x[18] = Ae, _ !== 0 && (x[19] = _, f.length++), f; }; - Math.imul || (N = P); + Math.imul || (N = M); function L(Y, S, m) { m.negative = S.negative ^ Y.negative, m.length = Y.length + S.length; for (var f = 0, g = 0, b = 0; b < m.length - 1; b++) { var x = g; g = 0; for (var _ = f & 67108863, E = Math.min(b, S.length - 1), v = Math.max(0, b - Y.length + 1); v <= E; v++) { - var M = b - v, I = Y.words[M] | 0, F = S.words[v] | 0, ce = I * F, D = ce & 67108863; + var P = b - v, I = Y.words[P] | 0, F = S.words[v] | 0, ce = I * F, D = ce & 67108863; x = x + (ce / 67108864 | 0) | 0, D = D + _ | 0, _ = D & 67108863, x = x + (D >>> 26) | 0, g += x >>> 26, x &= 67108863; } m.words[b] = _, f = x, x = g; } return f !== 0 ? m.words[b] = f : m.length--, m.strip(); } - function $(Y, S, m) { - var f = new B(); + function B(Y, S, m) { + var f = new $(); return f.mulp(Y, S, m); } s.prototype.mulTo = function(S, m) { var f, g = this.length + S.length; - return this.length === 10 && S.length === 10 ? f = N(this, S, m) : g < 63 ? f = P(this, S, m) : g < 1024 ? f = L(this, S, m) : f = $(this, S, m), f; + return this.length === 10 && S.length === 10 ? f = N(this, S, m) : g < 63 ? f = M(this, S, m) : g < 1024 ? f = L(this, S, m) : f = B(this, S, m), f; }; - function B(Y, S) { + function $(Y, S) { this.x = Y, this.y = S; } - B.prototype.makeRBT = function(S) { + $.prototype.makeRBT = function(S) { for (var m = new Array(S), f = s.prototype._countBits(S) - 1, g = 0; g < S; g++) m[g] = this.revBin(g, f, S); return m; - }, B.prototype.revBin = function(S, m, f) { + }, $.prototype.revBin = function(S, m, f) { if (S === 0 || S === f - 1) return S; for (var g = 0, b = 0; b < m; b++) g |= (S & 1) << m - b - 1, S >>= 1; return g; - }, B.prototype.permute = function(S, m, f, g, b, x) { + }, $.prototype.permute = function(S, m, f, g, b, x) { for (var _ = 0; _ < x; _++) g[_] = m[S[_]], b[_] = f[S[_]]; - }, B.prototype.transform = function(S, m, f, g, b, x) { + }, $.prototype.transform = function(S, m, f, g, b, x) { this.permute(x, S, m, f, g, b); for (var _ = 1; _ < b; _ <<= 1) - for (var E = _ << 1, v = Math.cos(2 * Math.PI / E), M = Math.sin(2 * Math.PI / E), I = 0; I < b; I += E) - for (var F = v, ce = M, D = 0; D < _; D++) { + for (var E = _ << 1, v = Math.cos(2 * Math.PI / E), P = Math.sin(2 * Math.PI / E), I = 0; I < b; I += E) + for (var F = v, ce = P, D = 0; D < _; D++) { var oe = f[I + D], Z = g[I + D], J = f[I + D + _], Q = g[I + D + _], T = F * J - ce * Q; - Q = F * Q + ce * J, J = T, f[I + D] = oe + J, g[I + D] = Z + Q, f[I + D + _] = oe - J, g[I + D + _] = Z - Q, D !== E && (T = v * F - M * ce, ce = v * ce + M * F, F = T); + Q = F * Q + ce * J, J = T, f[I + D] = oe + J, g[I + D] = Z + Q, f[I + D + _] = oe - J, g[I + D + _] = Z - Q, D !== E && (T = v * F - P * ce, ce = v * ce + P * F, F = T); } - }, B.prototype.guessLen13b = function(S, m) { + }, $.prototype.guessLen13b = function(S, m) { var f = Math.max(m, S) | 1, g = f & 1, b = 0; for (f = f / 2 | 0; f; f = f >>> 1) b++; return 1 << b + 1 + g; - }, B.prototype.conjugate = function(S, m, f) { + }, $.prototype.conjugate = function(S, m, f) { if (!(f <= 1)) for (var g = 0; g < f / 2; g++) { var b = S[g]; S[g] = S[f - g - 1], S[f - g - 1] = b, b = m[g], m[g] = -m[f - g - 1], m[f - g - 1] = -b; } - }, B.prototype.normalize13b = function(S, m) { + }, $.prototype.normalize13b = function(S, m) { for (var f = 0, g = 0; g < m / 2; g++) { var b = Math.round(S[2 * g + 1] / m) * 8192 + Math.round(S[2 * g] / m) + f; S[g] = b & 67108863, b < 67108864 ? f = 0 : f = b / 67108864 | 0; } return S; - }, B.prototype.convert13b = function(S, m, f, g) { + }, $.prototype.convert13b = function(S, m, f, g) { for (var b = 0, x = 0; x < m; x++) b = b + (S[x] | 0), f[2 * x] = b & 8191, b = b >>> 13, f[2 * x + 1] = b & 8191, b = b >>> 13; for (x = 2 * m; x < g; ++x) f[x] = 0; n(b === 0), n((b & -8192) === 0); - }, B.prototype.stub = function(S) { + }, $.prototype.stub = function(S) { for (var m = new Array(S), f = 0; f < S; f++) m[f] = 0; return m; - }, B.prototype.mulp = function(S, m, f) { - var g = 2 * this.guessLen13b(S.length, m.length), b = this.makeRBT(g), x = this.stub(g), _ = new Array(g), E = new Array(g), v = new Array(g), M = new Array(g), I = new Array(g), F = new Array(g), ce = f.words; - ce.length = g, this.convert13b(S.words, S.length, _, g), this.convert13b(m.words, m.length, M, g), this.transform(_, x, E, v, g, b), this.transform(M, x, I, F, g, b); + }, $.prototype.mulp = function(S, m, f) { + var g = 2 * this.guessLen13b(S.length, m.length), b = this.makeRBT(g), x = this.stub(g), _ = new Array(g), E = new Array(g), v = new Array(g), P = new Array(g), I = new Array(g), F = new Array(g), ce = f.words; + ce.length = g, this.convert13b(S.words, S.length, _, g), this.convert13b(m.words, m.length, P, g), this.transform(_, x, E, v, g, b), this.transform(P, x, I, F, g, b); for (var D = 0; D < g; D++) { var oe = E[D] * I[D] - v[D] * F[D]; v[D] = E[D] * F[D] + v[D] * I[D], E[D] = oe; @@ -13715,7 +13715,7 @@ Xv.exports; return m.words = new Array(this.length + S.length), this.mulTo(S, m); }, s.prototype.mulf = function(S) { var m = new s(null); - return m.words = new Array(this.length + S.length), $(this, S, m); + return m.words = new Array(this.length + S.length), B(this, S, m); }, s.prototype.imul = function(S) { return this.clone().mulTo(S, this); }, s.prototype.imuln = function(S) { @@ -13776,12 +13776,12 @@ Xv.exports; this.words[v] = this.words[v + x]; else this.words[0] = 0, this.length = 1; - var M = 0; - for (v = this.length - 1; v >= 0 && (M !== 0 || v >= g); v--) { + var P = 0; + for (v = this.length - 1; v >= 0 && (P !== 0 || v >= g); v--) { var I = this.words[v] | 0; - this.words[v] = M << 26 - b | I >>> b, M = I & _; + this.words[v] = P << 26 - b | I >>> b, P = I & _; } - return E && M !== 0 && (E.words[E.length++] = M), this.length === 0 && (this.words[0] = 0, this.length = 1), this.strip(); + return E && P !== 0 && (E.words[E.length++] = P), this.length === 0 && (this.words[0] = 0, this.length = 1), this.strip(); }, s.prototype.ishrn = function(S, m, f) { return n(this.negative === 0), this.iushrn(S, m, f); }, s.prototype.shln = function(S) { @@ -13856,8 +13856,8 @@ Xv.exports; var E = g.length - b.length, v; if (m !== "mod") { v = new s(null), v.length = E + 1, v.words = new Array(v.length); - for (var M = 0; M < v.length; M++) - v.words[M] = 0; + for (var P = 0; P < v.length; P++) + v.words[P] = 0; } var I = g.clone()._ishlnsubmul(b, 1, E); I.negative === 0 && (g = I, v && (v.words[E] = 1)); @@ -13931,15 +13931,15 @@ Xv.exports; m.negative !== 0 ? m = m.umod(S) : m = m.clone(); for (var g = new s(1), b = new s(0), x = new s(0), _ = new s(1), E = 0; m.isEven() && f.isEven(); ) m.iushrn(1), f.iushrn(1), ++E; - for (var v = f.clone(), M = m.clone(); !m.isZero(); ) { + for (var v = f.clone(), P = m.clone(); !m.isZero(); ) { for (var I = 0, F = 1; !(m.words[0] & F) && I < 26; ++I, F <<= 1) ; if (I > 0) for (m.iushrn(I); I-- > 0; ) - (g.isOdd() || b.isOdd()) && (g.iadd(v), b.isub(M)), g.iushrn(1), b.iushrn(1); + (g.isOdd() || b.isOdd()) && (g.iadd(v), b.isub(P)), g.iushrn(1), b.iushrn(1); for (var ce = 0, D = 1; !(f.words[0] & D) && ce < 26; ++ce, D <<= 1) ; if (ce > 0) for (f.iushrn(ce); ce-- > 0; ) - (x.isOdd() || _.isOdd()) && (x.iadd(v), _.isub(M)), x.iushrn(1), _.iushrn(1); + (x.isOdd() || _.isOdd()) && (x.iadd(v), _.isub(P)), x.iushrn(1), _.iushrn(1); m.cmp(f) >= 0 ? (m.isub(f), g.isub(x), b.isub(_)) : (f.isub(m), x.isub(g), _.isub(b)); } return { @@ -13956,7 +13956,7 @@ Xv.exports; if (_ > 0) for (m.iushrn(_); _-- > 0; ) g.isOdd() && g.iadd(x), g.iushrn(1); - for (var v = 0, M = 1; !(f.words[0] & M) && v < 26; ++v, M <<= 1) ; + for (var v = 0, P = 1; !(f.words[0] & P) && v < 26; ++v, P <<= 1) ; if (v > 0) for (f.iushrn(v); v-- > 0; ) b.isOdd() && b.iadd(x), b.iushrn(1); @@ -14245,12 +14245,12 @@ Xv.exports; var x = new s(1).toRed(this), _ = x.redNeg(), E = this.m.subn(1).iushrn(1), v = this.m.bitLength(); for (v = new s(2 * v * v).toRed(this); this.pow(v, E).cmp(_) !== 0; ) v.redIAdd(_); - for (var M = this.pow(v, g), I = this.pow(S, g.addn(1).iushrn(1)), F = this.pow(S, g), ce = b; F.cmp(x) !== 0; ) { + for (var P = this.pow(v, g), I = this.pow(S, g.addn(1).iushrn(1)), F = this.pow(S, g), ce = b; F.cmp(x) !== 0; ) { for (var D = F, oe = 0; D.cmp(x) !== 0; oe++) D = D.redSqr(); n(oe < ce); - var Z = this.pow(M, new s(1).iushln(ce - oe - 1)); - I = I.redMul(Z), M = Z.redSqr(), F = F.redMul(M), ce = oe; + var Z = this.pow(P, new s(1).iushln(ce - oe - 1)); + I = I.redMul(Z), P = Z.redSqr(), F = F.redMul(P), ce = oe; } return I; }, ge.prototype.invm = function(S) { @@ -14265,8 +14265,8 @@ Xv.exports; g[b] = this.mul(g[b - 1], S); var x = g[0], _ = 0, E = 0, v = m.bitLength() % 26; for (v === 0 && (v = 26), b = m.length - 1; b >= 0; b--) { - for (var M = m.words[b], I = v - 1; I >= 0; I--) { - var F = M >> I & 1; + for (var P = m.words[b], I = v - 1; I >= 0; I--) { + var F = P >> I & 1; if (x !== g[0] && (x = this.sqr(x)), F === 0 && _ === 0) { E = 0; continue; @@ -14308,7 +14308,7 @@ Xv.exports; }; })(t, gn); })(Xv); -var Ho = Xv.exports, Zv = {}; +var zo = Xv.exports, Zv = {}; (function(t) { var e = t; function r(s, o) { @@ -14348,16 +14348,16 @@ var Ho = Xv.exports, Zv = {}; }; })(Zv); (function(t) { - var e = t, r = Ho, n = wc, i = Zv; + var e = t, r = zo, n = wc, i = Zv; e.assert = n, e.toArray = i.toArray, e.zero2 = i.zero2, e.toHex = i.toHex, e.encode = i.encode; function s(d, p, w) { - var A = new Array(Math.max(d.bitLength(), w) + 1), P; - for (P = 0; P < A.length; P += 1) - A[P] = 0; + var A = new Array(Math.max(d.bitLength(), w) + 1), M; + for (M = 0; M < A.length; M += 1) + A[M] = 0; var N = 1 << p + 1, L = d.clone(); - for (P = 0; P < A.length; P++) { - var $, B = L.andln(N - 1); - L.isOdd() ? (B > (N >> 1) - 1 ? $ = (N >> 1) - B : $ = B, L.isubn($)) : $ = 0, A[P] = $, L.iushrn(1); + for (M = 0; M < A.length; M++) { + var B, $ = L.andln(N - 1); + L.isOdd() ? ($ > (N >> 1) - 1 ? B = (N >> 1) - $ : B = $, L.isubn(B)) : B = 0, A[M] = B, L.iushrn(1); } return A; } @@ -14368,13 +14368,13 @@ var Ho = Xv.exports, Zv = {}; [] ]; d = d.clone(), p = p.clone(); - for (var A = 0, P = 0, N; d.cmpn(-A) > 0 || p.cmpn(-P) > 0; ) { - var L = d.andln(3) + A & 3, $ = p.andln(3) + P & 3; - L === 3 && (L = -1), $ === 3 && ($ = -1); - var B; - L & 1 ? (N = d.andln(7) + A & 7, (N === 3 || N === 5) && $ === 2 ? B = -L : B = L) : B = 0, w[0].push(B); + for (var A = 0, M = 0, N; d.cmpn(-A) > 0 || p.cmpn(-M) > 0; ) { + var L = d.andln(3) + A & 3, B = p.andln(3) + M & 3; + L === 3 && (L = -1), B === 3 && (B = -1); + var $; + L & 1 ? (N = d.andln(7) + A & 7, (N === 3 || N === 5) && B === 2 ? $ = -L : $ = L) : $ = 0, w[0].push($); var H; - $ & 1 ? (N = p.andln(7) + P & 7, (N === 3 || N === 5) && L === 2 ? H = -$ : H = $) : H = 0, w[1].push(H), 2 * A === B + 1 && (A = 1 - A), 2 * P === H + 1 && (P = 1 - P), d.iushrn(1), p.iushrn(1); + B & 1 ? (N = p.andln(7) + M & 7, (N === 3 || N === 5) && L === 2 ? H = -B : H = B) : H = 0, w[1].push(H), 2 * A === $ + 1 && (A = 1 - A), 2 * M === H + 1 && (M = 1 - M), d.iushrn(1), p.iushrn(1); } return w; } @@ -14394,19 +14394,19 @@ var Ho = Xv.exports, Zv = {}; return new r(d, "hex", "le"); } e.intFromLE = l; -})(Fi); +})(Bi); var Qv = { exports: {} }, am; Qv.exports = function(e) { - return am || (am = new da(null)), am.generate(e); + return am || (am = new la(null)), am.generate(e); }; -function da(t) { +function la(t) { this.rand = t; } -Qv.exports.Rand = da; -da.prototype.generate = function(e) { +Qv.exports.Rand = la; +la.prototype.generate = function(e) { return this._rand(e); }; -da.prototype._rand = function(e) { +la.prototype._rand = function(e) { if (this.rand.getBytes) return this.rand.getBytes(e); for (var r = new Uint8Array(e), n = 0; n < r.length; n++) @@ -14414,39 +14414,39 @@ da.prototype._rand = function(e) { return r; }; if (typeof self == "object") - self.crypto && self.crypto.getRandomValues ? da.prototype._rand = function(e) { + self.crypto && self.crypto.getRandomValues ? la.prototype._rand = function(e) { var r = new Uint8Array(e); return self.crypto.getRandomValues(r), r; - } : self.msCrypto && self.msCrypto.getRandomValues ? da.prototype._rand = function(e) { + } : self.msCrypto && self.msCrypto.getRandomValues ? la.prototype._rand = function(e) { var r = new Uint8Array(e); return self.msCrypto.getRandomValues(r), r; - } : typeof window == "object" && (da.prototype._rand = function() { + } : typeof window == "object" && (la.prototype._rand = function() { throw new Error("Not implemented yet"); }); else try { - var Rx = Wl; - if (typeof Rx.randomBytes != "function") + var Cx = Wl; + if (typeof Cx.randomBytes != "function") throw new Error("Not supported"); - da.prototype._rand = function(e) { - return Rx.randomBytes(e); + la.prototype._rand = function(e) { + return Cx.randomBytes(e); }; } catch { } -var S8 = Qv.exports, eb = {}, Ka = Ho, Jl = Fi, s0 = Jl.getNAF, nq = Jl.getJSF, o0 = Jl.assert; -function Da(t, e) { - this.type = t, this.p = new Ka(e.p, 16), this.red = e.prime ? Ka.red(e.prime) : Ka.mont(this.p), this.zero = new Ka(0).toRed(this.red), this.one = new Ka(1).toRed(this.red), this.two = new Ka(2).toRed(this.red), this.n = e.n && new Ka(e.n, 16), this.g = e.g && this.pointFromJSON(e.g, e.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; +var _8 = Qv.exports, eb = {}, Wa = zo, Jl = Bi, s0 = Jl.getNAF, iq = Jl.getJSF, o0 = Jl.assert; +function Ca(t, e) { + this.type = t, this.p = new Wa(e.p, 16), this.red = e.prime ? Wa.red(e.prime) : Wa.mont(this.p), this.zero = new Wa(0).toRed(this.red), this.one = new Wa(1).toRed(this.red), this.two = new Wa(2).toRed(this.red), this.n = e.n && new Wa(e.n, 16), this.g = e.g && this.pointFromJSON(e.g, e.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; var r = this.n && this.p.div(this.n); !r || r.cmpn(100) > 0 ? this.redN = null : (this._maxwellTrick = !0, this.redN = this.n.toRed(this.red)); } -var G0 = Da; -Da.prototype.point = function() { +var G0 = Ca; +Ca.prototype.point = function() { throw new Error("Not implemented"); }; -Da.prototype.validate = function() { +Ca.prototype.validate = function() { throw new Error("Not implemented"); }; -Da.prototype._fixedNafMul = function(e, r) { +Ca.prototype._fixedNafMul = function(e, r) { o0(e.precomputed); var n = e._getDoubles(), i = s0(r, 1, this._bitLength), s = (1 << n.step + 1) - (n.step % 2 === 0 ? 2 : 1); s /= 3; @@ -14464,7 +14464,7 @@ Da.prototype._fixedNafMul = function(e, r) { } return d.toP(); }; -Da.prototype._wnafMul = function(e, r) { +Ca.prototype._wnafMul = function(e, r) { var n = 4, i = e._getNAFPoints(n); n = i.wnd; for (var s = i.points, o = s0(r, n, this._bitLength), a = this.jpoint(null, null, null), u = o.length - 1; u >= 0; u--) { @@ -14477,7 +14477,7 @@ Da.prototype._wnafMul = function(e, r) { } return e.type === "affine" ? a.toP() : a; }; -Da.prototype._wnafMulAdd = function(e, r, n, i, s) { +Ca.prototype._wnafMulAdd = function(e, r, n, i, s) { var o = this._wnafT1, a = this._wnafT2, u = this._wnafT3, l = 0, d, p, w; for (d = 0; d < i; d++) { w = r[d]; @@ -14485,13 +14485,13 @@ Da.prototype._wnafMulAdd = function(e, r, n, i, s) { o[d] = A.wnd, a[d] = A.points; } for (d = i - 1; d >= 1; d -= 2) { - var P = d - 1, N = d; - if (o[P] !== 1 || o[N] !== 1) { - u[P] = s0(n[P], o[P], this._bitLength), u[N] = s0(n[N], o[N], this._bitLength), l = Math.max(u[P].length, l), l = Math.max(u[N].length, l); + var M = d - 1, N = d; + if (o[M] !== 1 || o[N] !== 1) { + u[M] = s0(n[M], o[M], this._bitLength), u[N] = s0(n[N], o[N], this._bitLength), l = Math.max(u[M].length, l), l = Math.max(u[N].length, l); continue; } var L = [ - r[P], + r[M], /* 1 */ null, /* 3 */ @@ -14500,8 +14500,8 @@ Da.prototype._wnafMulAdd = function(e, r, n, i, s) { r[N] /* 7 */ ]; - r[P].y.cmp(r[N].y) === 0 ? (L[1] = r[P].add(r[N]), L[2] = r[P].toJ().mixedAdd(r[N].neg())) : r[P].y.cmp(r[N].y.redNeg()) === 0 ? (L[1] = r[P].toJ().mixedAdd(r[N]), L[2] = r[P].add(r[N].neg())) : (L[1] = r[P].toJ().mixedAdd(r[N]), L[2] = r[P].toJ().mixedAdd(r[N].neg())); - var $ = [ + r[M].y.cmp(r[N].y) === 0 ? (L[1] = r[M].add(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())) : r[M].y.cmp(r[N].y.redNeg()) === 0 ? (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].add(r[N].neg())) : (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())); + var B = [ -3, /* -1 -1 */ -1, @@ -14520,10 +14520,10 @@ Da.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 1 0 */ 3 /* 1 1 */ - ], B = nq(n[P], n[N]); - for (l = Math.max(B[0].length, l), u[P] = new Array(l), u[N] = new Array(l), p = 0; p < l; p++) { - var H = B[0][p] | 0, W = B[1][p] | 0; - u[P][p] = $[(H + 1) * 3 + (W + 1)], u[N][p] = 0, a[P] = L; + ], $ = iq(n[M], n[N]); + for (l = Math.max($[0].length, l), u[M] = new Array(l), u[N] = new Array(l), p = 0; p < l; p++) { + var H = $[0][p] | 0, W = $[1][p] | 0; + u[M][p] = B[(H + 1) * 3 + (W + 1)], u[N][p] = 0, a[M] = L; } } var V = this.jpoint(null, null, null), te = this._wnafT4; @@ -14547,17 +14547,17 @@ Da.prototype._wnafMulAdd = function(e, r, n, i, s) { a[d] = null; return s ? V : V.toP(); }; -function os(t, e) { +function ss(t, e) { this.curve = t, this.type = e, this.precomputed = null; } -Da.BasePoint = os; -os.prototype.eq = function() { +Ca.BasePoint = ss; +ss.prototype.eq = function() { throw new Error("Not implemented"); }; -os.prototype.validate = function() { +ss.prototype.validate = function() { return this.curve.validate(this); }; -Da.prototype.decodePoint = function(e, r) { +Ca.prototype.decodePoint = function(e, r) { e = Jl.toArray(e, r); var n = this.p.byteLength(); if ((e[0] === 4 || e[0] === 6 || e[0] === 7) && e.length - 1 === 2 * n) { @@ -14571,17 +14571,17 @@ Da.prototype.decodePoint = function(e, r) { return this.pointFromX(e.slice(1, 1 + n), e[0] === 3); throw new Error("Unknown point format"); }; -os.prototype.encodeCompressed = function(e) { +ss.prototype.encodeCompressed = function(e) { return this.encode(e, !0); }; -os.prototype._encode = function(e) { +ss.prototype._encode = function(e) { var r = this.curve.p.byteLength(), n = this.getX().toArray("be", r); return e ? [this.getY().isEven() ? 2 : 3].concat(n) : [4].concat(n, this.getY().toArray("be", r)); }; -os.prototype.encode = function(e, r) { +ss.prototype.encode = function(e, r) { return Jl.encode(this._encode(r), e); }; -os.prototype.precompute = function(e) { +ss.prototype.precompute = function(e) { if (this.precomputed) return this; var r = { @@ -14591,13 +14591,13 @@ os.prototype.precompute = function(e) { }; return r.naf = this._getNAFPoints(8), r.doubles = this._getDoubles(4, e), r.beta = this._getBeta(), this.precomputed = r, this; }; -os.prototype._hasDoubles = function(e) { +ss.prototype._hasDoubles = function(e) { if (!this.precomputed) return !1; var r = this.precomputed.doubles; return r ? r.points.length >= Math.ceil((e.bitLength() + 1) / r.step) : !1; }; -os.prototype._getDoubles = function(e, r) { +ss.prototype._getDoubles = function(e, r) { if (this.precomputed && this.precomputed.doubles) return this.precomputed.doubles; for (var n = [this], i = this, s = 0; s < r; s += e) { @@ -14610,7 +14610,7 @@ os.prototype._getDoubles = function(e, r) { points: n }; }; -os.prototype._getNAFPoints = function(e) { +ss.prototype._getNAFPoints = function(e) { if (this.precomputed && this.precomputed.naf) return this.precomputed.naf; for (var r = [this], n = (1 << e) - 1, i = n === 1 ? null : this.dbl(), s = 1; s < n; s++) @@ -14620,21 +14620,21 @@ os.prototype._getNAFPoints = function(e) { points: r }; }; -os.prototype._getBeta = function() { +ss.prototype._getBeta = function() { return null; }; -os.prototype.dblp = function(e) { +ss.prototype.dblp = function(e) { for (var r = this, n = 0; n < e; n++) r = r.dbl(); return r; }; -var iq = Fi, rn = Ho, tb = z0, Fu = G0, sq = iq.assert; -function as(t) { +var sq = Bi, rn = zo, tb = z0, Fu = G0, oq = sq.assert; +function os(t) { Fu.call(this, "short", t), this.a = new rn(t.a, 16).toRed(this.red), this.b = new rn(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); } -tb(as, Fu); -var oq = as; -as.prototype._getEndomorphism = function(e) { +tb(os, Fu); +var aq = os; +os.prototype._getEndomorphism = function(e) { if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { var r, n; if (e.beta) @@ -14647,7 +14647,7 @@ as.prototype._getEndomorphism = function(e) { n = new rn(e.lambda, 16); else { var s = this._getEndoRoots(this.n); - this.g.mul(s[0]).x.cmp(this.g.x.redMul(r)) === 0 ? n = s[0] : (n = s[1], sq(this.g.mul(n).x.cmp(this.g.x.redMul(r)) === 0)); + this.g.mul(s[0]).x.cmp(this.g.x.redMul(r)) === 0 ? n = s[0] : (n = s[1], oq(this.g.mul(n).x.cmp(this.g.x.redMul(r)) === 0)); } var o; return e.basis ? o = e.basis.map(function(a) { @@ -14662,33 +14662,33 @@ as.prototype._getEndomorphism = function(e) { }; } }; -as.prototype._getEndoRoots = function(e) { +os.prototype._getEndoRoots = function(e) { var r = e === this.p ? this.red : rn.mont(e), n = new rn(2).toRed(r).redInvm(), i = n.redNeg(), s = new rn(3).toRed(r).redNeg().redSqrt().redMul(n), o = i.redAdd(s).fromRed(), a = i.redSub(s).fromRed(); return [o, a]; }; -as.prototype._getEndoBasis = function(e) { - for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new rn(1), o = new rn(0), a = new rn(0), u = new rn(1), l, d, p, w, A, P, N, L = 0, $, B; n.cmpn(0) !== 0; ) { +os.prototype._getEndoBasis = function(e) { + for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new rn(1), o = new rn(0), a = new rn(0), u = new rn(1), l, d, p, w, A, M, N, L = 0, B, $; n.cmpn(0) !== 0; ) { var H = i.div(n); - $ = i.sub(H.mul(n)), B = a.sub(H.mul(s)); + B = i.sub(H.mul(n)), $ = a.sub(H.mul(s)); var W = u.sub(H.mul(o)); - if (!p && $.cmp(r) < 0) - l = N.neg(), d = s, p = $.neg(), w = B; + if (!p && B.cmp(r) < 0) + l = N.neg(), d = s, p = B.neg(), w = $; else if (p && ++L === 2) break; - N = $, i = n, n = $, a = s, s = B, u = o, o = W; + N = B, i = n, n = B, a = s, s = $, u = o, o = W; } - A = $.neg(), P = B; - var V = p.sqr().add(w.sqr()), te = A.sqr().add(P.sqr()); - return te.cmp(V) >= 0 && (A = l, P = d), p.negative && (p = p.neg(), w = w.neg()), A.negative && (A = A.neg(), P = P.neg()), [ + A = B.neg(), M = $; + var V = p.sqr().add(w.sqr()), te = A.sqr().add(M.sqr()); + return te.cmp(V) >= 0 && (A = l, M = d), p.negative && (p = p.neg(), w = w.neg()), A.negative && (A = A.neg(), M = M.neg()), [ { a: p, b: w }, - { a: A, b: P } + { a: A, b: M } ]; }; -as.prototype._endoSplit = function(e) { +os.prototype._endoSplit = function(e) { var r = this.endo.basis, n = r[0], i = r[1], s = i.b.mul(e).divRound(this.n), o = n.b.neg().mul(e).divRound(this.n), a = s.mul(n.a), u = o.mul(i.a), l = s.mul(n.b), d = o.mul(i.b), p = e.sub(a).sub(u), w = l.add(d).neg(); return { k1: p, k2: w }; }; -as.prototype.pointFromX = function(e, r) { +os.prototype.pointFromX = function(e, r) { e = new rn(e, 16), e.red || (e = e.toRed(this.red)); var n = e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b), i = n.redSqrt(); if (i.redSqr().redSub(n).cmp(this.zero) !== 0) @@ -14696,13 +14696,13 @@ as.prototype.pointFromX = function(e, r) { var s = i.fromRed().isOdd(); return (r && !s || !r && s) && (i = i.redNeg()), this.point(e, i); }; -as.prototype.validate = function(e) { +os.prototype.validate = function(e) { if (e.inf) return !0; var r = e.x, n = e.y, i = this.a.redMul(r), s = r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b); return n.redSqr().redISub(s).cmpn(0) === 0; }; -as.prototype._endoWnafMulAdd = function(e, r, n) { +os.prototype._endoWnafMulAdd = function(e, r, n) { for (var i = this._endoWnafT1, s = this._endoWnafT2, o = 0; o < e.length; o++) { var a = this._endoSplit(r[o]), u = e[o], l = u._getBeta(); a.k1.negative && (a.k1.ineg(), u = u.neg(!0)), a.k2.negative && (a.k2.ineg(), l = l.neg(!0)), i[o * 2] = u, i[o * 2 + 1] = l, s[o * 2] = a.k1, s[o * 2 + 1] = a.k2; @@ -14715,10 +14715,10 @@ function $n(t, e, r, n) { Fu.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new rn(e, 16), this.y = new rn(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); } tb($n, Fu.BasePoint); -as.prototype.point = function(e, r, n) { +os.prototype.point = function(e, r, n) { return new $n(this, e, r, n); }; -as.prototype.pointFromJSON = function(e, r) { +os.prototype.pointFromJSON = function(e, r) { return $n.fromJSON(this, e, r); }; $n.prototype._getBeta = function() { @@ -14857,23 +14857,23 @@ $n.prototype.toJ = function() { var e = this.curve.jpoint(this.x, this.y, this.curve.one); return e; }; -function Wn(t, e, r, n) { +function Hn(t, e, r, n) { Fu.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new rn(0)) : (this.x = new rn(e, 16), this.y = new rn(r, 16), this.z = new rn(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; } -tb(Wn, Fu.BasePoint); -as.prototype.jpoint = function(e, r, n) { - return new Wn(this, e, r, n); +tb(Hn, Fu.BasePoint); +os.prototype.jpoint = function(e, r, n) { + return new Hn(this, e, r, n); }; -Wn.prototype.toP = function() { +Hn.prototype.toP = function() { if (this.isInfinity()) return this.curve.point(null, null); var e = this.z.redInvm(), r = e.redSqr(), n = this.x.redMul(r), i = this.y.redMul(r).redMul(e); return this.curve.point(n, i); }; -Wn.prototype.neg = function() { +Hn.prototype.neg = function() { return this.curve.jpoint(this.x, this.y.redNeg(), this.z); }; -Wn.prototype.add = function(e) { +Hn.prototype.add = function(e) { if (this.isInfinity()) return e; if (e.isInfinity()) @@ -14881,10 +14881,10 @@ Wn.prototype.add = function(e) { var r = e.z.redSqr(), n = this.z.redSqr(), i = this.x.redMul(r), s = e.x.redMul(n), o = this.y.redMul(r.redMul(e.z)), a = e.y.redMul(n.redMul(this.z)), u = i.redSub(s), l = o.redSub(a); if (u.cmpn(0) === 0) return l.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var d = u.redSqr(), p = d.redMul(u), w = i.redMul(d), A = l.redSqr().redIAdd(p).redISub(w).redISub(w), P = l.redMul(w.redISub(A)).redISub(o.redMul(p)), N = this.z.redMul(e.z).redMul(u); - return this.curve.jpoint(A, P, N); + var d = u.redSqr(), p = d.redMul(u), w = i.redMul(d), A = l.redSqr().redIAdd(p).redISub(w).redISub(w), M = l.redMul(w.redISub(A)).redISub(o.redMul(p)), N = this.z.redMul(e.z).redMul(u); + return this.curve.jpoint(A, M, N); }; -Wn.prototype.mixedAdd = function(e) { +Hn.prototype.mixedAdd = function(e) { if (this.isInfinity()) return e.toJ(); if (e.isInfinity()) @@ -14892,10 +14892,10 @@ Wn.prototype.mixedAdd = function(e) { var r = this.z.redSqr(), n = this.x, i = e.x.redMul(r), s = this.y, o = e.y.redMul(r).redMul(this.z), a = n.redSub(i), u = s.redSub(o); if (a.cmpn(0) === 0) return u.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var l = a.redSqr(), d = l.redMul(a), p = n.redMul(l), w = u.redSqr().redIAdd(d).redISub(p).redISub(p), A = u.redMul(p.redISub(w)).redISub(s.redMul(d)), P = this.z.redMul(a); - return this.curve.jpoint(w, A, P); + var l = a.redSqr(), d = l.redMul(a), p = n.redMul(l), w = u.redSqr().redIAdd(d).redISub(p).redISub(p), A = u.redMul(p.redISub(w)).redISub(s.redMul(d)), M = this.z.redMul(a); + return this.curve.jpoint(w, A, M); }; -Wn.prototype.dblp = function(e) { +Hn.prototype.dblp = function(e) { if (e === 0) return this; if (this.isInfinity()) @@ -14911,17 +14911,17 @@ Wn.prototype.dblp = function(e) { } var i = this.curve.a, s = this.curve.tinv, o = this.x, a = this.y, u = this.z, l = u.redSqr().redSqr(), d = a.redAdd(a); for (r = 0; r < e; r++) { - var p = o.redSqr(), w = d.redSqr(), A = w.redSqr(), P = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), N = o.redMul(w), L = P.redSqr().redISub(N.redAdd(N)), $ = N.redISub(L), B = P.redMul($); - B = B.redIAdd(B).redISub(A); + var p = o.redSqr(), w = d.redSqr(), A = w.redSqr(), M = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), N = o.redMul(w), L = M.redSqr().redISub(N.redAdd(N)), B = N.redISub(L), $ = M.redMul(B); + $ = $.redIAdd($).redISub(A); var H = d.redMul(u); - r + 1 < e && (l = l.redMul(A)), o = L, u = H, d = B; + r + 1 < e && (l = l.redMul(A)), o = L, u = H, d = $; } return this.curve.jpoint(o, d.redMul(s), u); }; -Wn.prototype.dbl = function() { +Hn.prototype.dbl = function() { return this.isInfinity() ? this : this.curve.zeroA ? this._zeroDbl() : this.curve.threeA ? this._threeDbl() : this._dbl(); }; -Wn.prototype._zeroDbl = function() { +Hn.prototype._zeroDbl = function() { var e, r, n; if (this.zOne) { var i = this.x.redSqr(), s = this.y.redSqr(), o = s.redSqr(), a = this.x.redAdd(s).redSqr().redISub(i).redISub(o); @@ -14929,14 +14929,14 @@ Wn.prototype._zeroDbl = function() { var u = i.redAdd(i).redIAdd(i), l = u.redSqr().redISub(a).redISub(a), d = o.redIAdd(o); d = d.redIAdd(d), d = d.redIAdd(d), e = l, r = u.redMul(a.redISub(l)).redISub(d), n = this.y.redAdd(this.y); } else { - var p = this.x.redSqr(), w = this.y.redSqr(), A = w.redSqr(), P = this.x.redAdd(w).redSqr().redISub(p).redISub(A); - P = P.redIAdd(P); - var N = p.redAdd(p).redIAdd(p), L = N.redSqr(), $ = A.redIAdd(A); - $ = $.redIAdd($), $ = $.redIAdd($), e = L.redISub(P).redISub(P), r = N.redMul(P.redISub(e)).redISub($), n = this.y.redMul(this.z), n = n.redIAdd(n); + var p = this.x.redSqr(), w = this.y.redSqr(), A = w.redSqr(), M = this.x.redAdd(w).redSqr().redISub(p).redISub(A); + M = M.redIAdd(M); + var N = p.redAdd(p).redIAdd(p), L = N.redSqr(), B = A.redIAdd(A); + B = B.redIAdd(B), B = B.redIAdd(B), e = L.redISub(M).redISub(M), r = N.redMul(M.redISub(e)).redISub(B), n = this.y.redMul(this.z), n = n.redIAdd(n); } return this.curve.jpoint(e, r, n); }; -Wn.prototype._threeDbl = function() { +Hn.prototype._threeDbl = function() { var e, r, n; if (this.zOne) { var i = this.x.redSqr(), s = this.y.redSqr(), o = s.redSqr(), a = this.x.redAdd(s).redSqr().redISub(i).redISub(o); @@ -14946,26 +14946,26 @@ Wn.prototype._threeDbl = function() { var d = o.redIAdd(o); d = d.redIAdd(d), d = d.redIAdd(d), r = u.redMul(a.redISub(l)).redISub(d), n = this.y.redAdd(this.y); } else { - var p = this.z.redSqr(), w = this.y.redSqr(), A = this.x.redMul(w), P = this.x.redSub(p).redMul(this.x.redAdd(p)); - P = P.redAdd(P).redIAdd(P); + var p = this.z.redSqr(), w = this.y.redSqr(), A = this.x.redMul(w), M = this.x.redSub(p).redMul(this.x.redAdd(p)); + M = M.redAdd(M).redIAdd(M); var N = A.redIAdd(A); N = N.redIAdd(N); var L = N.redAdd(N); - e = P.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(p); - var $ = w.redSqr(); - $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($), r = P.redMul(N.redISub(e)).redISub($); + e = M.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(p); + var B = w.redSqr(); + B = B.redIAdd(B), B = B.redIAdd(B), B = B.redIAdd(B), r = M.redMul(N.redISub(e)).redISub(B); } return this.curve.jpoint(e, r, n); }; -Wn.prototype._dbl = function() { +Hn.prototype._dbl = function() { var e = this.curve.a, r = this.x, n = this.y, i = this.z, s = i.redSqr().redSqr(), o = r.redSqr(), a = n.redSqr(), u = o.redAdd(o).redIAdd(o).redIAdd(e.redMul(s)), l = r.redAdd(r); l = l.redIAdd(l); var d = l.redMul(a), p = u.redSqr().redISub(d.redAdd(d)), w = d.redISub(p), A = a.redSqr(); A = A.redIAdd(A), A = A.redIAdd(A), A = A.redIAdd(A); - var P = u.redMul(w).redISub(A), N = n.redAdd(n).redMul(i); - return this.curve.jpoint(p, P, N); + var M = u.redMul(w).redISub(A), N = n.redAdd(n).redMul(i); + return this.curve.jpoint(p, M, N); }; -Wn.prototype.trpl = function() { +Hn.prototype.trpl = function() { if (!this.curve.zeroA) return this.dbl().add(this); var e = this.x.redSqr(), r = this.y.redSqr(), n = this.z.redSqr(), i = r.redSqr(), s = e.redAdd(e).redIAdd(e), o = s.redSqr(), a = this.x.redAdd(r).redSqr().redISub(e).redISub(i); @@ -14978,13 +14978,13 @@ Wn.prototype.trpl = function() { w = w.redIAdd(w), w = w.redIAdd(w); var A = this.y.redMul(d.redMul(l.redISub(d)).redISub(a.redMul(u))); A = A.redIAdd(A), A = A.redIAdd(A), A = A.redIAdd(A); - var P = this.z.redAdd(a).redSqr().redISub(n).redISub(u); - return this.curve.jpoint(w, A, P); + var M = this.z.redAdd(a).redSqr().redISub(n).redISub(u); + return this.curve.jpoint(w, A, M); }; -Wn.prototype.mul = function(e, r) { +Hn.prototype.mul = function(e, r) { return e = new rn(e, r), this.curve._wnafMul(this, e); }; -Wn.prototype.eq = function(e) { +Hn.prototype.eq = function(e) { if (e.type === "affine") return this.eq(e.toJ()); if (this === e) @@ -14995,7 +14995,7 @@ Wn.prototype.eq = function(e) { var i = r.redMul(this.z), s = n.redMul(e.z); return this.y.redMul(s).redISub(e.y.redMul(i)).cmpn(0) === 0; }; -Wn.prototype.eqXToP = function(e) { +Hn.prototype.eqXToP = function(e) { var r = this.z.redSqr(), n = e.toRed(this.curve.red).redMul(r); if (this.x.cmp(n) === 0) return !0; @@ -15006,18 +15006,18 @@ Wn.prototype.eqXToP = function(e) { return !0; } }; -Wn.prototype.inspect = function() { +Hn.prototype.inspect = function() { return this.isInfinity() ? "" : ""; }; -Wn.prototype.isInfinity = function() { +Hn.prototype.isInfinity = function() { return this.z.cmpn(0) === 0; }; -var Qc = Ho, A8 = z0, Y0 = G0, aq = Fi; +var Qc = zo, E8 = z0, Y0 = G0, cq = Bi; function ju(t) { Y0.call(this, "mont", t), this.a = new Qc(t.a, 16).toRed(this.red), this.b = new Qc(t.b, 16).toRed(this.red), this.i4 = new Qc(4).toRed(this.red).redInvm(), this.two = new Qc(2).toRed(this.red), this.a24 = this.i4.redMul(this.a.redAdd(this.two)); } -A8(ju, Y0); -var cq = ju; +E8(ju, Y0); +var uq = ju; ju.prototype.validate = function(e) { var r = e.normalize().x, n = r.redSqr(), i = n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r), s = i.redSqrt(); return s.redSqr().cmp(i) === 0; @@ -15025,9 +15025,9 @@ ju.prototype.validate = function(e) { function Ln(t, e, r) { Y0.BasePoint.call(this, t, "projective"), e === null && r === null ? (this.x = this.curve.one, this.z = this.curve.zero) : (this.x = new Qc(e, 16), this.z = new Qc(r, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red))); } -A8(Ln, Y0.BasePoint); +E8(Ln, Y0.BasePoint); ju.prototype.decodePoint = function(e, r) { - return this.point(aq.toArray(e, r), 1); + return this.point(cq.toArray(e, r), 1); }; ju.prototype.point = function(e, r) { return new Ln(this, e, r); @@ -15082,31 +15082,31 @@ Ln.prototype.normalize = function() { Ln.prototype.getX = function() { return this.normalize(), this.x.fromRed(); }; -var uq = Fi, Po = Ho, P8 = z0, J0 = G0, fq = uq.assert; -function io(t) { - this.twisted = (t.a | 0) !== 1, this.mOneA = this.twisted && (t.a | 0) === -1, this.extended = this.mOneA, J0.call(this, "edwards", t), this.a = new Po(t.a, 16).umod(this.red.m), this.a = this.a.toRed(this.red), this.c = new Po(t.c, 16).toRed(this.red), this.c2 = this.c.redSqr(), this.d = new Po(t.d, 16).toRed(this.red), this.dd = this.d.redAdd(this.d), fq(!this.twisted || this.c.fromRed().cmpn(1) === 0), this.oneC = (t.c | 0) === 1; +var fq = Bi, So = zo, S8 = z0, J0 = G0, lq = fq.assert; +function no(t) { + this.twisted = (t.a | 0) !== 1, this.mOneA = this.twisted && (t.a | 0) === -1, this.extended = this.mOneA, J0.call(this, "edwards", t), this.a = new So(t.a, 16).umod(this.red.m), this.a = this.a.toRed(this.red), this.c = new So(t.c, 16).toRed(this.red), this.c2 = this.c.redSqr(), this.d = new So(t.d, 16).toRed(this.red), this.dd = this.d.redAdd(this.d), lq(!this.twisted || this.c.fromRed().cmpn(1) === 0), this.oneC = (t.c | 0) === 1; } -P8(io, J0); -var lq = io; -io.prototype._mulA = function(e) { +S8(no, J0); +var hq = no; +no.prototype._mulA = function(e) { return this.mOneA ? e.redNeg() : this.a.redMul(e); }; -io.prototype._mulC = function(e) { +no.prototype._mulC = function(e) { return this.oneC ? e : this.c.redMul(e); }; -io.prototype.jpoint = function(e, r, n, i) { +no.prototype.jpoint = function(e, r, n, i) { return this.point(e, r, n, i); }; -io.prototype.pointFromX = function(e, r) { - e = new Po(e, 16), e.red || (e = e.toRed(this.red)); +no.prototype.pointFromX = function(e, r) { + e = new So(e, 16), e.red || (e = e.toRed(this.red)); var n = e.redSqr(), i = this.c2.redSub(this.a.redMul(n)), s = this.one.redSub(this.c2.redMul(this.d).redMul(n)), o = i.redMul(s.redInvm()), a = o.redSqrt(); if (a.redSqr().redSub(o).cmp(this.zero) !== 0) throw new Error("invalid point"); var u = a.fromRed().isOdd(); return (r && !u || !r && u) && (a = a.redNeg()), this.point(e, a); }; -io.prototype.pointFromY = function(e, r) { - e = new Po(e, 16), e.red || (e = e.toRed(this.red)); +no.prototype.pointFromY = function(e, r) { + e = new So(e, 16), e.red || (e = e.toRed(this.red)); var n = e.redSqr(), i = n.redSub(this.c2), s = n.redMul(this.d).redMul(this.c2).redSub(this.a), o = i.redMul(s.redInvm()); if (o.cmp(this.zero) === 0) { if (r) @@ -15118,7 +15118,7 @@ io.prototype.pointFromY = function(e, r) { throw new Error("invalid point"); return a.fromRed().isOdd() !== r && (a = a.redNeg()), this.point(a, e); }; -io.prototype.validate = function(e) { +no.prototype.validate = function(e) { if (e.isInfinity()) return !0; e.normalize(); @@ -15126,13 +15126,13 @@ io.prototype.validate = function(e) { return i.cmp(s) === 0; }; function Hr(t, e, r, n, i) { - J0.BasePoint.call(this, t, "projective"), e === null && r === null && n === null ? (this.x = this.curve.zero, this.y = this.curve.one, this.z = this.curve.one, this.t = this.curve.zero, this.zOne = !0) : (this.x = new Po(e, 16), this.y = new Po(r, 16), this.z = n ? new Po(n, 16) : this.curve.one, this.t = i && new Po(i, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.t && !this.t.red && (this.t = this.t.toRed(this.curve.red)), this.zOne = this.z === this.curve.one, this.curve.extended && !this.t && (this.t = this.x.redMul(this.y), this.zOne || (this.t = this.t.redMul(this.z.redInvm())))); + J0.BasePoint.call(this, t, "projective"), e === null && r === null && n === null ? (this.x = this.curve.zero, this.y = this.curve.one, this.z = this.curve.one, this.t = this.curve.zero, this.zOne = !0) : (this.x = new So(e, 16), this.y = new So(r, 16), this.z = n ? new So(n, 16) : this.curve.one, this.t = i && new So(i, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.t && !this.t.red && (this.t = this.t.toRed(this.curve.red)), this.zOne = this.z === this.curve.one, this.curve.extended && !this.t && (this.t = this.x.redMul(this.y), this.zOne || (this.t = this.t.redMul(this.z.redInvm())))); } -P8(Hr, J0.BasePoint); -io.prototype.pointFromJSON = function(e) { +S8(Hr, J0.BasePoint); +no.prototype.pointFromJSON = function(e) { return Hr.fromJSON(this, e); }; -io.prototype.point = function(e, r, n, i) { +no.prototype.point = function(e, r, n, i) { return new Hr(this, e, r, n, i); }; Hr.fromJSON = function(e, r) { @@ -15221,11 +15221,11 @@ Hr.prototype.toP = Hr.prototype.normalize; Hr.prototype.mixedAdd = Hr.prototype.add; (function(t) { var e = t; - e.base = G0, e.short = oq, e.mont = cq, e.edwards = lq; + e.base = G0, e.short = aq, e.mont = uq, e.edwards = hq; })(eb); -var X0 = {}, cm, Dx; -function hq() { - return Dx || (Dx = 1, cm = { +var X0 = {}, cm, Tx; +function dq() { + return Tx || (Tx = 1, cm = { doubles: { step: 4, points: [ @@ -16007,7 +16007,7 @@ function hq() { }), cm; } (function(t) { - var e = t, r = Vl, n = eb, i = Fi, s = i.assert; + var e = t, r = Vl, n = eb, i = Bi, s = i.assert; function o(l) { l.type === "short" ? this.curve = new n.short(l) : l.type === "edwards" ? this.curve = new n.edwards(l) : this.curve = new n.mont(l), this.g = this.curve.g, this.n = this.curve.n, this.hash = l.hash, s(this.g.validate(), "Invalid curve"), s(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); } @@ -16122,7 +16122,7 @@ function hq() { }); var u; try { - u = hq(); + u = dq(); } catch { u = void 0; } @@ -16156,104 +16156,104 @@ function hq() { ] }); })(X0); -var dq = Vl, ac = Zv, M8 = wc; -function xa(t) { - if (!(this instanceof xa)) - return new xa(t); +var pq = Vl, oc = Zv, A8 = wc; +function ya(t) { + if (!(this instanceof ya)) + return new ya(t); this.hash = t.hash, this.predResist = !!t.predResist, this.outLen = this.hash.outSize, this.minEntropy = t.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null; - var e = ac.toArray(t.entropy, t.entropyEnc || "hex"), r = ac.toArray(t.nonce, t.nonceEnc || "hex"), n = ac.toArray(t.pers, t.persEnc || "hex"); - M8( + var e = oc.toArray(t.entropy, t.entropyEnc || "hex"), r = oc.toArray(t.nonce, t.nonceEnc || "hex"), n = oc.toArray(t.pers, t.persEnc || "hex"); + A8( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._init(e, r, n); } -var pq = xa; -xa.prototype._init = function(e, r, n) { +var gq = ya; +ya.prototype._init = function(e, r, n) { var i = e.concat(r).concat(n); this.K = new Array(this.outLen / 8), this.V = new Array(this.outLen / 8); for (var s = 0; s < this.V.length; s++) this.K[s] = 0, this.V[s] = 1; this._update(i), this._reseed = 1, this.reseedInterval = 281474976710656; }; -xa.prototype._hmac = function() { - return new dq.hmac(this.hash, this.K); +ya.prototype._hmac = function() { + return new pq.hmac(this.hash, this.K); }; -xa.prototype._update = function(e) { +ya.prototype._update = function(e) { var r = this._hmac().update(this.V).update([0]); e && (r = r.update(e)), this.K = r.digest(), this.V = this._hmac().update(this.V).digest(), e && (this.K = this._hmac().update(this.V).update([1]).update(e).digest(), this.V = this._hmac().update(this.V).digest()); }; -xa.prototype.reseed = function(e, r, n, i) { - typeof r != "string" && (i = n, n = r, r = null), e = ac.toArray(e, r), n = ac.toArray(n, i), M8( +ya.prototype.reseed = function(e, r, n, i) { + typeof r != "string" && (i = n, n = r, r = null), e = oc.toArray(e, r), n = oc.toArray(n, i), A8( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._update(e.concat(n || [])), this._reseed = 1; }; -xa.prototype.generate = function(e, r, n, i) { +ya.prototype.generate = function(e, r, n, i) { if (this._reseed > this.reseedInterval) throw new Error("Reseed is required"); - typeof r != "string" && (i = n, n = r, r = null), n && (n = ac.toArray(n, i || "hex"), this._update(n)); + typeof r != "string" && (i = n, n = r, r = null), n && (n = oc.toArray(n, i || "hex"), this._update(n)); for (var s = []; s.length < e; ) this.V = this._hmac().update(this.V).digest(), s = s.concat(this.V); var o = s.slice(0, e); - return this._update(n), this._reseed++, ac.encode(o, r); + return this._update(n), this._reseed++, oc.encode(o, r); }; -var gq = Ho, mq = Fi, P1 = mq.assert; -function Qn(t, e) { +var mq = zo, vq = Bi, P1 = vq.assert; +function ei(t, e) { this.ec = t, this.priv = null, this.pub = null, e.priv && this._importPrivate(e.priv, e.privEnc), e.pub && this._importPublic(e.pub, e.pubEnc); } -var vq = Qn; -Qn.fromPublic = function(e, r, n) { - return r instanceof Qn ? r : new Qn(e, { +var bq = ei; +ei.fromPublic = function(e, r, n) { + return r instanceof ei ? r : new ei(e, { pub: r, pubEnc: n }); }; -Qn.fromPrivate = function(e, r, n) { - return r instanceof Qn ? r : new Qn(e, { +ei.fromPrivate = function(e, r, n) { + return r instanceof ei ? r : new ei(e, { priv: r, privEnc: n }); }; -Qn.prototype.validate = function() { +ei.prototype.validate = function() { var e = this.getPublic(); return e.isInfinity() ? { result: !1, reason: "Invalid public key" } : e.validate() ? e.mul(this.ec.curve.n).isInfinity() ? { result: !0, reason: null } : { result: !1, reason: "Public key * N != O" } : { result: !1, reason: "Public key is not a point" }; }; -Qn.prototype.getPublic = function(e, r) { +ei.prototype.getPublic = function(e, r) { return typeof e == "string" && (r = e, e = null), this.pub || (this.pub = this.ec.g.mul(this.priv)), r ? this.pub.encode(r, e) : this.pub; }; -Qn.prototype.getPrivate = function(e) { +ei.prototype.getPrivate = function(e) { return e === "hex" ? this.priv.toString(16, 2) : this.priv; }; -Qn.prototype._importPrivate = function(e, r) { - this.priv = new gq(e, r || 16), this.priv = this.priv.umod(this.ec.curve.n); +ei.prototype._importPrivate = function(e, r) { + this.priv = new mq(e, r || 16), this.priv = this.priv.umod(this.ec.curve.n); }; -Qn.prototype._importPublic = function(e, r) { +ei.prototype._importPublic = function(e, r) { if (e.x || e.y) { this.ec.curve.type === "mont" ? P1(e.x, "Need x coordinate") : (this.ec.curve.type === "short" || this.ec.curve.type === "edwards") && P1(e.x && e.y, "Need both x and y coordinate"), this.pub = this.ec.curve.point(e.x, e.y); return; } this.pub = this.ec.curve.decodePoint(e, r); }; -Qn.prototype.derive = function(e) { +ei.prototype.derive = function(e) { return e.validate() || P1(e.validate(), "public point not validated"), e.mul(this.priv).getX(); }; -Qn.prototype.sign = function(e, r, n) { +ei.prototype.sign = function(e, r, n) { return this.ec.sign(e, this, r, n); }; -Qn.prototype.verify = function(e, r, n) { +ei.prototype.verify = function(e, r, n) { return this.ec.verify(e, r, this, void 0, n); }; -Qn.prototype.inspect = function() { +ei.prototype.inspect = function() { return ""; }; -var a0 = Ho, rb = Fi, bq = rb.assert; +var a0 = zo, rb = Bi, yq = rb.assert; function Z0(t, e) { if (t instanceof Z0) return t; - this._importDER(t, e) || (bq(t.r && t.s, "Signature without r or s"), this.r = new a0(t.r, 16), this.s = new a0(t.s, 16), t.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = t.recoveryParam); + this._importDER(t, e) || (yq(t.r && t.s, "Signature without r or s"), this.r = new a0(t.r, 16), this.s = new a0(t.s, 16), t.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = t.recoveryParam); } -var yq = Z0; -function wq() { +var wq = Z0; +function xq() { this.place = 0; } function um(t, e) { @@ -16267,14 +16267,14 @@ function um(t, e) { i <<= 8, i |= t[o], i >>>= 0; return i <= 127 ? !1 : (e.place = o, i); } -function Ox(t) { +function Rx(t) { for (var e = 0, r = t.length - 1; !t[e] && !(t[e + 1] & 128) && e < r; ) e++; return e === 0 ? t : t.slice(e); } Z0.prototype._importDER = function(e, r) { e = rb.toArray(e, r); - var n = new wq(); + var n = new xq(); if (e[n.place++] !== 48) return !1; var i = um(e, n); @@ -16314,87 +16314,87 @@ function fm(t, e) { } Z0.prototype.toDER = function(e) { var r = this.r.toArray(), n = this.s.toArray(); - for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Ox(r), n = Ox(n); !n[0] && !(n[1] & 128); ) + for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Rx(r), n = Rx(n); !n[0] && !(n[1] & 128); ) n = n.slice(1); var i = [2]; fm(i, r.length), i = i.concat(r), i.push(2), fm(i, n.length); var s = i.concat(n), o = [48]; return fm(o, s.length), o = o.concat(s), rb.encode(o, e); }; -var Mo = Ho, I8 = pq, xq = Fi, lm = X0, _q = S8, C8 = xq.assert, nb = vq, Q0 = yq; -function ts(t) { - if (!(this instanceof ts)) - return new ts(t); - typeof t == "string" && (C8( +var Ao = zo, P8 = gq, _q = Bi, lm = X0, Eq = _8, M8 = _q.assert, nb = bq, Q0 = wq; +function es(t) { + if (!(this instanceof es)) + return new es(t); + typeof t == "string" && (M8( Object.prototype.hasOwnProperty.call(lm, t), "Unknown curve " + t ), t = lm[t]), t instanceof lm.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; } -var Eq = ts; -ts.prototype.keyPair = function(e) { +var Sq = es; +es.prototype.keyPair = function(e) { return new nb(this, e); }; -ts.prototype.keyFromPrivate = function(e, r) { +es.prototype.keyFromPrivate = function(e, r) { return nb.fromPrivate(this, e, r); }; -ts.prototype.keyFromPublic = function(e, r) { +es.prototype.keyFromPublic = function(e, r) { return nb.fromPublic(this, e, r); }; -ts.prototype.genKeyPair = function(e) { +es.prototype.genKeyPair = function(e) { e || (e = {}); - for (var r = new I8({ + for (var r = new P8({ hash: this.hash, pers: e.pers, persEnc: e.persEnc || "utf8", - entropy: e.entropy || _q(this.hash.hmacStrength), + entropy: e.entropy || Eq(this.hash.hmacStrength), entropyEnc: e.entropy && e.entropyEnc || "utf8", nonce: this.n.toArray() - }), n = this.n.byteLength(), i = this.n.sub(new Mo(2)); ; ) { - var s = new Mo(r.generate(n)); + }), n = this.n.byteLength(), i = this.n.sub(new Ao(2)); ; ) { + var s = new Ao(r.generate(n)); if (!(s.cmp(i) > 0)) return s.iaddn(1), this.keyFromPrivate(s); } }; -ts.prototype._truncateToN = function(e, r, n) { +es.prototype._truncateToN = function(e, r, n) { var i; - if (Mo.isBN(e) || typeof e == "number") - e = new Mo(e, 16), i = e.byteLength(); + if (Ao.isBN(e) || typeof e == "number") + e = new Ao(e, 16), i = e.byteLength(); else if (typeof e == "object") - i = e.length, e = new Mo(e, 16); + i = e.length, e = new Ao(e, 16); else { var s = e.toString(); - i = s.length + 1 >>> 1, e = new Mo(s, 16); + i = s.length + 1 >>> 1, e = new Ao(s, 16); } typeof n != "number" && (n = i * 8); var o = n - this.n.bitLength(); return o > 0 && (e = e.ushrn(o)), !r && e.cmp(this.n) >= 0 ? e.sub(this.n) : e; }; -ts.prototype.sign = function(e, r, n, i) { +es.prototype.sign = function(e, r, n, i) { typeof n == "object" && (i = n, n = null), i || (i = {}), r = this.keyFromPrivate(r, n), e = this._truncateToN(e, !1, i.msgBitLength); - for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new I8({ + for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new P8({ hash: this.hash, entropy: o, nonce: a, pers: i.pers, persEnc: i.persEnc || "utf8" - }), l = this.n.sub(new Mo(1)), d = 0; ; d++) { - var p = i.k ? i.k(d) : new Mo(u.generate(this.n.byteLength())); + }), l = this.n.sub(new Ao(1)), d = 0; ; d++) { + var p = i.k ? i.k(d) : new Ao(u.generate(this.n.byteLength())); if (p = this._truncateToN(p, !0), !(p.cmpn(1) <= 0 || p.cmp(l) >= 0)) { var w = this.g.mul(p); if (!w.isInfinity()) { - var A = w.getX(), P = A.umod(this.n); - if (P.cmpn(0) !== 0) { - var N = p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e)); + var A = w.getX(), M = A.umod(this.n); + if (M.cmpn(0) !== 0) { + var N = p.invm(this.n).mul(M.mul(r.getPrivate()).iadd(e)); if (N = N.umod(this.n), N.cmpn(0) !== 0) { - var L = (w.getY().isOdd() ? 1 : 0) | (A.cmp(P) !== 0 ? 2 : 0); - return i.canonical && N.cmp(this.nh) > 0 && (N = this.n.sub(N), L ^= 1), new Q0({ r: P, s: N, recoveryParam: L }); + var L = (w.getY().isOdd() ? 1 : 0) | (A.cmp(M) !== 0 ? 2 : 0); + return i.canonical && N.cmp(this.nh) > 0 && (N = this.n.sub(N), L ^= 1), new Q0({ r: M, s: N, recoveryParam: L }); } } } } } }; -ts.prototype.verify = function(e, r, n, i, s) { +es.prototype.verify = function(e, r, n, i, s) { s || (s = {}), e = this._truncateToN(e, !1, s.msgBitLength), n = this.keyFromPublic(n, i), r = new Q0(r, "hex"); var o = r.r, a = r.s; if (o.cmpn(1) < 0 || o.cmp(this.n) >= 0 || a.cmpn(1) < 0 || a.cmp(this.n) >= 0) @@ -16402,16 +16402,16 @@ ts.prototype.verify = function(e, r, n, i, s) { var u = a.invm(this.n), l = u.mul(e).umod(this.n), d = u.mul(o).umod(this.n), p; return this.curve._maxwellTrick ? (p = this.g.jmulAdd(l, n.getPublic(), d), p.isInfinity() ? !1 : p.eqXToP(o)) : (p = this.g.mulAdd(l, n.getPublic(), d), p.isInfinity() ? !1 : p.getX().umod(this.n).cmp(o) === 0); }; -ts.prototype.recoverPubKey = function(t, e, r, n) { - C8((3 & r) === r, "The recovery param is more than two bits"), e = new Q0(e, n); - var i = this.n, s = new Mo(t), o = e.r, a = e.s, u = r & 1, l = r >> 1; +es.prototype.recoverPubKey = function(t, e, r, n) { + M8((3 & r) === r, "The recovery param is more than two bits"), e = new Q0(e, n); + var i = this.n, s = new Ao(t), o = e.r, a = e.s, u = r & 1, l = r >> 1; if (o.cmp(this.curve.p.umod(this.curve.n)) >= 0 && l) throw new Error("Unable to find sencond key candinate"); l ? o = this.curve.pointFromX(o.add(this.curve.n), u) : o = this.curve.pointFromX(o, u); var d = e.r.invm(i), p = i.sub(s).mul(d).umod(i), w = a.mul(d).umod(i); return this.g.mulAdd(p, o, w); }; -ts.prototype.getKeyRecoveryParam = function(t, e, r, n) { +es.prototype.getKeyRecoveryParam = function(t, e, r, n) { if (e = new Q0(e, n), e.recoveryParam !== null) return e.recoveryParam; for (var i = 0; i < 4; i++) { @@ -16426,9 +16426,9 @@ ts.prototype.getKeyRecoveryParam = function(t, e, r, n) { } throw new Error("Unable to find valid recovery factor"); }; -var Xl = Fi, T8 = Xl.assert, Nx = Xl.parseBytes, Uu = Xl.cachedProperty; +var Xl = Bi, I8 = Xl.assert, Dx = Xl.parseBytes, Uu = Xl.cachedProperty; function Nn(t, e) { - this.eddsa = t, this._secret = Nx(e.secret), t.isPoint(e.pub) ? this._pub = e.pub : this._pubBytes = Nx(e.pub); + this.eddsa = t, this._secret = Dx(e.secret), t.isPoint(e.pub) ? this._pub = e.pub : this._pubBytes = Dx(e.pub); } Nn.fromPublic = function(e, r) { return r instanceof Nn ? r : new Nn(e, { pub: r }); @@ -16459,23 +16459,23 @@ Uu(Nn, "messagePrefix", function() { return this.hash().slice(this.eddsa.encodingLength); }); Nn.prototype.sign = function(e) { - return T8(this._secret, "KeyPair can only verify"), this.eddsa.sign(e, this); + return I8(this._secret, "KeyPair can only verify"), this.eddsa.sign(e, this); }; Nn.prototype.verify = function(e, r) { return this.eddsa.verify(e, r, this); }; Nn.prototype.getSecret = function(e) { - return T8(this._secret, "KeyPair is public only"), Xl.encode(this.secret(), e); + return I8(this._secret, "KeyPair is public only"), Xl.encode(this.secret(), e); }; Nn.prototype.getPublic = function(e) { return Xl.encode(this.pubBytes(), e); }; -var Sq = Nn, Aq = Ho, ep = Fi, Lx = ep.assert, tp = ep.cachedProperty, Pq = ep.parseBytes; +var Aq = Nn, Pq = zo, ep = Bi, Ox = ep.assert, tp = ep.cachedProperty, Mq = ep.parseBytes; function _c(t, e) { - this.eddsa = t, typeof e != "object" && (e = Pq(e)), Array.isArray(e) && (Lx(e.length === t.encodingLength * 2, "Signature has invalid size"), e = { + this.eddsa = t, typeof e != "object" && (e = Mq(e)), Array.isArray(e) && (Ox(e.length === t.encodingLength * 2, "Signature has invalid size"), e = { R: e.slice(0, t.encodingLength), S: e.slice(t.encodingLength) - }), Lx(e.R && e.S, "Signature without R or S"), t.isPoint(e.R) && (this._R = e.R), e.S instanceof Aq && (this._S = e.S), this._Rencoded = Array.isArray(e.R) ? e.R : e.Rencoded, this._Sencoded = Array.isArray(e.S) ? e.S : e.Sencoded; + }), Ox(e.R && e.S, "Signature without R or S"), t.isPoint(e.R) && (this._R = e.R), e.S instanceof Pq && (this._S = e.S), this._Rencoded = Array.isArray(e.R) ? e.R : e.Rencoded, this._Sencoded = Array.isArray(e.S) ? e.S : e.Sencoded; } tp(_c, "S", function() { return this.eddsa.decodeInt(this.Sencoded()); @@ -16495,79 +16495,79 @@ _c.prototype.toBytes = function() { _c.prototype.toHex = function() { return ep.encode(this.toBytes(), "hex").toUpperCase(); }; -var Mq = _c, Iq = Vl, Cq = X0, Au = Fi, Tq = Au.assert, R8 = Au.parseBytes, D8 = Sq, kx = Mq; -function _i(t) { - if (Tq(t === "ed25519", "only tested with ed25519 so far"), !(this instanceof _i)) - return new _i(t); - t = Cq[t].curve, this.curve = t, this.g = t.g, this.g.precompute(t.n.bitLength() + 1), this.pointClass = t.point().constructor, this.encodingLength = Math.ceil(t.n.bitLength() / 8), this.hash = Iq.sha512; +var Iq = _c, Cq = Vl, Tq = X0, Au = Bi, Rq = Au.assert, C8 = Au.parseBytes, T8 = Aq, Nx = Iq; +function Ei(t) { + if (Rq(t === "ed25519", "only tested with ed25519 so far"), !(this instanceof Ei)) + return new Ei(t); + t = Tq[t].curve, this.curve = t, this.g = t.g, this.g.precompute(t.n.bitLength() + 1), this.pointClass = t.point().constructor, this.encodingLength = Math.ceil(t.n.bitLength() / 8), this.hash = Cq.sha512; } -var Rq = _i; -_i.prototype.sign = function(e, r) { - e = R8(e); +var Dq = Ei; +Ei.prototype.sign = function(e, r) { + e = C8(e); var n = this.keyFromSecret(r), i = this.hashInt(n.messagePrefix(), e), s = this.g.mul(i), o = this.encodePoint(s), a = this.hashInt(o, n.pubBytes(), e).mul(n.priv()), u = i.add(a).umod(this.curve.n); return this.makeSignature({ R: s, S: u, Rencoded: o }); }; -_i.prototype.verify = function(e, r, n) { - if (e = R8(e), r = this.makeSignature(r), r.S().gte(r.eddsa.curve.n) || r.S().isNeg()) +Ei.prototype.verify = function(e, r, n) { + if (e = C8(e), r = this.makeSignature(r), r.S().gte(r.eddsa.curve.n) || r.S().isNeg()) return !1; var i = this.keyFromPublic(n), s = this.hashInt(r.Rencoded(), i.pubBytes(), e), o = this.g.mul(r.S()), a = r.R().add(i.pub().mul(s)); return a.eq(o); }; -_i.prototype.hashInt = function() { +Ei.prototype.hashInt = function() { for (var e = this.hash(), r = 0; r < arguments.length; r++) e.update(arguments[r]); return Au.intFromLE(e.digest()).umod(this.curve.n); }; -_i.prototype.keyFromPublic = function(e) { - return D8.fromPublic(this, e); +Ei.prototype.keyFromPublic = function(e) { + return T8.fromPublic(this, e); }; -_i.prototype.keyFromSecret = function(e) { - return D8.fromSecret(this, e); +Ei.prototype.keyFromSecret = function(e) { + return T8.fromSecret(this, e); }; -_i.prototype.makeSignature = function(e) { - return e instanceof kx ? e : new kx(this, e); +Ei.prototype.makeSignature = function(e) { + return e instanceof Nx ? e : new Nx(this, e); }; -_i.prototype.encodePoint = function(e) { +Ei.prototype.encodePoint = function(e) { var r = e.getY().toArray("le", this.encodingLength); return r[this.encodingLength - 1] |= e.getX().isOdd() ? 128 : 0, r; }; -_i.prototype.decodePoint = function(e) { +Ei.prototype.decodePoint = function(e) { e = Au.parseBytes(e); var r = e.length - 1, n = e.slice(0, r).concat(e[r] & -129), i = (e[r] & 128) !== 0, s = Au.intFromLE(n); return this.curve.pointFromY(s, i); }; -_i.prototype.encodeInt = function(e) { +Ei.prototype.encodeInt = function(e) { return e.toArray("le", this.encodingLength); }; -_i.prototype.decodeInt = function(e) { +Ei.prototype.decodeInt = function(e) { return Au.intFromLE(e); }; -_i.prototype.isPoint = function(e) { +Ei.prototype.isPoint = function(e) { return e instanceof this.pointClass; }; (function(t) { var e = t; - e.version = rq.version, e.utils = Fi, e.rand = S8, e.curve = eb, e.curves = X0, e.ec = Eq, e.eddsa = Rq; -})(E8); -const Dq = { waku: { publish: "waku_publish", batchPublish: "waku_batchPublish", subscribe: "waku_subscribe", batchSubscribe: "waku_batchSubscribe", subscription: "waku_subscription", unsubscribe: "waku_unsubscribe", batchUnsubscribe: "waku_batchUnsubscribe", batchFetchMessages: "waku_batchFetchMessages" }, irn: { publish: "irn_publish", batchPublish: "irn_batchPublish", subscribe: "irn_subscribe", batchSubscribe: "irn_batchSubscribe", subscription: "irn_subscription", unsubscribe: "irn_unsubscribe", batchUnsubscribe: "irn_batchUnsubscribe", batchFetchMessages: "irn_batchFetchMessages" }, iridium: { publish: "iridium_publish", batchPublish: "iridium_batchPublish", subscribe: "iridium_subscribe", batchSubscribe: "iridium_batchSubscribe", subscription: "iridium_subscription", unsubscribe: "iridium_unsubscribe", batchUnsubscribe: "iridium_batchUnsubscribe", batchFetchMessages: "iridium_batchFetchMessages" } }, Oq = ":"; + e.version = nq.version, e.utils = Bi, e.rand = _8, e.curve = eb, e.curves = X0, e.ec = Sq, e.eddsa = Dq; +})(x8); +const Oq = { waku: { publish: "waku_publish", batchPublish: "waku_batchPublish", subscribe: "waku_subscribe", batchSubscribe: "waku_batchSubscribe", subscription: "waku_subscription", unsubscribe: "waku_unsubscribe", batchUnsubscribe: "waku_batchUnsubscribe", batchFetchMessages: "waku_batchFetchMessages" }, irn: { publish: "irn_publish", batchPublish: "irn_batchPublish", subscribe: "irn_subscribe", batchSubscribe: "irn_batchSubscribe", subscription: "irn_subscription", unsubscribe: "irn_unsubscribe", batchUnsubscribe: "irn_batchUnsubscribe", batchFetchMessages: "irn_batchFetchMessages" }, iridium: { publish: "iridium_publish", batchPublish: "iridium_batchPublish", subscribe: "iridium_subscribe", batchSubscribe: "iridium_batchSubscribe", subscription: "iridium_subscription", unsubscribe: "iridium_unsubscribe", batchUnsubscribe: "iridium_batchUnsubscribe", batchFetchMessages: "iridium_batchFetchMessages" } }, Nq = ":"; function hu(t) { - const [e, r] = t.split(Oq); + const [e, r] = t.split(Nq); return { namespace: e, reference: r }; } -function O8(t, e) { +function R8(t, e) { return t.includes(":") ? [t] : e.chains || []; } -var Nq = Object.defineProperty, $x = Object.getOwnPropertySymbols, Lq = Object.prototype.hasOwnProperty, kq = Object.prototype.propertyIsEnumerable, Bx = (t, e, r) => e in t ? Nq(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Fx = (t, e) => { - for (var r in e || (e = {})) Lq.call(e, r) && Bx(t, r, e[r]); - if ($x) for (var r of $x(e)) kq.call(e, r) && Bx(t, r, e[r]); +var Lq = Object.defineProperty, Lx = Object.getOwnPropertySymbols, kq = Object.prototype.hasOwnProperty, $q = Object.prototype.propertyIsEnumerable, kx = (t, e, r) => e in t ? Lq(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, $x = (t, e) => { + for (var r in e || (e = {})) kq.call(e, r) && kx(t, r, e[r]); + if (Lx) for (var r of Lx(e)) $q.call(e, r) && kx(t, r, e[r]); return t; }; -const $q = "ReactNative", Di = { reactNative: "react-native", node: "node", browser: "browser", unknown: "unknown" }, Bq = "js"; +const Bq = "ReactNative", Di = { reactNative: "react-native", node: "node", browser: "browser", unknown: "unknown" }, Fq = "js"; function c0() { return typeof process < "u" && typeof process.versions < "u" && typeof process.versions.node < "u"; } function qu() { - return !Kl() && !!Fv() && navigator.product === $q; + return !Kl() && !!Fv() && navigator.product === Bq; } function Zl() { return !c0() && !!Fv() && !!Kl(); @@ -16575,7 +16575,7 @@ function Zl() { function Ql() { return qu() ? Di.reactNative : c0() ? Di.node : Zl() ? Di.browser : Di.unknown; } -function Fq() { +function jq() { var t; try { return qu() && typeof global < "u" && typeof (global == null ? void 0 : global.Application) < "u" ? (t = global.Application) == null ? void 0 : t.applicationId : void 0; @@ -16583,46 +16583,46 @@ function Fq() { return; } } -function jq(t, e) { +function Uq(t, e) { let r = xl.parse(t); - return r = Fx(Fx({}, r), e), t = xl.stringify(r), t; + return r = $x($x({}, r), e), t = xl.stringify(r), t; } -function N8() { - return W4() || { name: "", description: "", url: "", icons: [""] }; +function D8() { + return q4() || { name: "", description: "", url: "", icons: [""] }; } -function Uq() { +function qq() { if (Ql() === Di.reactNative && typeof global < "u" && typeof (global == null ? void 0 : global.Platform) < "u") { const { OS: r, Version: n } = global.Platform; return [r, n].join("-"); } - const t = QB(); + const t = eF(); if (t === null) return "unknown"; const e = t.os ? t.os.replace(" ", "").toLowerCase() : "unknown"; return t.type === "browser" ? [e, t.name, t.version].join("-") : [e, t.version].join("-"); } -function qq() { +function zq() { var t; const e = Ql(); - return e === Di.browser ? [e, ((t = z4()) == null ? void 0 : t.host) || "unknown"].join(":") : e; + return e === Di.browser ? [e, ((t = U4()) == null ? void 0 : t.host) || "unknown"].join(":") : e; } -function L8(t, e, r) { - const n = Uq(), i = qq(); - return [[t, e].join("-"), [Bq, r].join("-"), n, i].join("/"); +function O8(t, e, r) { + const n = qq(), i = zq(); + return [[t, e].join("-"), [Fq, r].join("-"), n, i].join("/"); } -function zq({ protocol: t, version: e, relayUrl: r, sdkVersion: n, auth: i, projectId: s, useOnCloseEvent: o, bundleId: a }) { - const u = r.split("?"), l = L8(t, e, n), d = { auth: i, ua: l, projectId: s, useOnCloseEvent: o, origin: a || void 0 }, p = jq(u[1] || "", d); +function Wq({ protocol: t, version: e, relayUrl: r, sdkVersion: n, auth: i, projectId: s, useOnCloseEvent: o, bundleId: a }) { + const u = r.split("?"), l = O8(t, e, n), d = { auth: i, ua: l, projectId: s, useOnCloseEvent: o, origin: a || void 0 }, p = Uq(u[1] || "", d); return u[0] + "?" + p; } -function nc(t, e) { +function rc(t, e) { return t.filter((r) => e.includes(r)).length === t.length; } -function k8(t) { +function N8(t) { return Object.fromEntries(t.entries()); } -function $8(t) { +function L8(t) { return new Map(Object.entries(t)); } -function Ja(t = mt.FIVE_MINUTES, e) { +function Ga(t = mt.FIVE_MINUTES, e) { const r = mt.toMiliseconds(t || mt.FIVE_MINUTES); let n, i, s; return { resolve: (o) => { @@ -16647,7 +16647,7 @@ function du(t, e, r) { clearTimeout(s); }); } -function B8(t, e) { +function k8(t, e) { if (typeof e == "string" && e.startsWith(`${t}:`)) return e; if (t.toLowerCase() === "topic") { if (typeof e != "string") throw new Error('Value must be "string" for expirer target type: topic'); @@ -16658,13 +16658,13 @@ function B8(t, e) { } throw new Error(`Unknown expirer target type: ${t}`); } -function Wq(t) { - return B8("topic", t); -} function Hq(t) { - return B8("id", t); + return k8("topic", t); +} +function Kq(t) { + return k8("id", t); } -function F8(t) { +function $8(t) { const [e, r] = t.split(":"), n = { id: void 0, topic: void 0 }; if (e === "topic" && typeof r == "string") n.topic = r; else if (e === "id" && Number.isInteger(Number(r))) n.id = Number(r); @@ -16674,7 +16674,7 @@ function F8(t) { function En(t, e) { return mt.fromMiliseconds(Date.now() + mt.toMiliseconds(t)); } -function fa(t) { +function ca(t) { return Date.now() >= mt.toMiliseconds(t); } function br(t, e) { @@ -16683,35 +16683,35 @@ function br(t, e) { function Id(t = [], e = []) { return [.../* @__PURE__ */ new Set([...t, ...e])]; } -async function Kq({ id: t, topic: e, wcDeepLink: r }) { +async function Vq({ id: t, topic: e, wcDeepLink: r }) { var n; try { if (!r) return; const i = typeof r == "string" ? JSON.parse(r) : r, s = i == null ? void 0 : i.href; if (typeof s != "string") return; - const o = Vq(s, t, e), a = Ql(); + const o = Gq(s, t, e), a = Ql(); if (a === Di.browser) { if (!((n = Kl()) != null && n.hasFocus())) { console.warn("Document does not have focus, skipping deeplink."); return; } - o.startsWith("https://") || o.startsWith("http://") ? window.open(o, "_blank", "noreferrer noopener") : window.open(o, Yq() ? "_blank" : "_self", "noreferrer noopener"); + o.startsWith("https://") || o.startsWith("http://") ? window.open(o, "_blank", "noreferrer noopener") : window.open(o, Jq() ? "_blank" : "_self", "noreferrer noopener"); } else a === Di.reactNative && typeof (global == null ? void 0 : global.Linking) < "u" && await global.Linking.openURL(o); } catch (i) { console.error(i); } } -function Vq(t, e, r) { +function Gq(t, e, r) { const n = `requestId=${e}&sessionTopic=${r}`; t.endsWith("/") && (t = t.slice(0, -1)); let i = `${t}`; if (t.startsWith("https://t.me")) { const s = t.includes("?") ? "&startapp=" : "?startapp="; - i = `${i}${s}${Jq(n, !0)}`; + i = `${i}${s}${Xq(n, !0)}`; } else i = `${i}/wc?${n}`; return i; } -async function Gq(t, e) { +async function Yq(t, e) { let r = ""; try { if (Zl() && (r = localStorage.getItem(e), r)) return r; @@ -16721,12 +16721,12 @@ async function Gq(t, e) { } return r; } -function jx(t, e) { +function Bx(t, e) { if (!t.includes(e)) return null; const r = t.split(/([&,?,=])/), n = r.indexOf(e); return r[n + 2]; } -function Ux() { +function Fx() { return typeof crypto < "u" && crypto != null && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu, (t) => { const e = Math.random() * 16 | 0; return (t === "x" ? e : e & 3 | 8).toString(16); @@ -16735,51 +16735,51 @@ function Ux() { function ib() { return typeof process < "u" && process.env.IS_VITEST === "true"; } -function Yq() { +function Jq() { return typeof window < "u" && (!!window.TelegramWebviewProxy || !!window.Telegram || !!window.TelegramWebviewProxyProto); } -function Jq(t, e = !1) { +function Xq(t, e = !1) { const r = Buffer.from(t).toString("base64"); return e ? r.replace(/[=]/g, "") : r; } -function j8(t) { +function B8(t) { return Buffer.from(t, "base64").toString("utf-8"); } -const Xq = "https://rpc.walletconnect.org/v1"; -async function Zq(t, e, r, n, i, s) { +const Zq = "https://rpc.walletconnect.org/v1"; +async function Qq(t, e, r, n, i, s) { switch (r.t) { case "eip191": - return Qq(t, e, r.s); + return ez(t, e, r.s); case "eip1271": - return await ez(t, e, r.s, n, i, s); + return await tz(t, e, r.s, n, i, s); default: throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`); } } -function Qq(t, e, r) { - return IU(Y4(e), r).toLowerCase() === t.toLowerCase(); +function ez(t, e, r) { + return CU(V4(e), r).toLowerCase() === t.toLowerCase(); } -async function ez(t, e, r, n, i, s) { +async function tz(t, e, r, n, i, s) { const o = hu(n); if (!o.namespace || !o.reference) throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`); try { - const a = "0x1626ba7e", u = "0000000000000000000000000000000000000000000000000000000000000040", l = "0000000000000000000000000000000000000000000000000000000000000041", d = r.substring(2), p = Y4(e).substring(2), w = a + p + u + l + d, A = await fetch(`${s || Xq}/?chainId=${n}&projectId=${i}`, { method: "POST", body: JSON.stringify({ id: tz(), jsonrpc: "2.0", method: "eth_call", params: [{ to: t, data: w }, "latest"] }) }), { result: P } = await A.json(); - return P ? P.slice(0, a.length).toLowerCase() === a.toLowerCase() : !1; + const a = "0x1626ba7e", u = "0000000000000000000000000000000000000000000000000000000000000040", l = "0000000000000000000000000000000000000000000000000000000000000041", d = r.substring(2), p = V4(e).substring(2), w = a + p + u + l + d, A = await fetch(`${s || Zq}/?chainId=${n}&projectId=${i}`, { method: "POST", body: JSON.stringify({ id: rz(), jsonrpc: "2.0", method: "eth_call", params: [{ to: t, data: w }, "latest"] }) }), { result: M } = await A.json(); + return M ? M.slice(0, a.length).toLowerCase() === a.toLowerCase() : !1; } catch (a) { return console.error("isValidEip1271Signature: ", a), !1; } } -function tz() { +function rz() { return Date.now() + Math.floor(Math.random() * 1e3); } -var rz = Object.defineProperty, nz = Object.defineProperties, iz = Object.getOwnPropertyDescriptors, qx = Object.getOwnPropertySymbols, sz = Object.prototype.hasOwnProperty, oz = Object.prototype.propertyIsEnumerable, zx = (t, e, r) => e in t ? rz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, az = (t, e) => { - for (var r in e || (e = {})) sz.call(e, r) && zx(t, r, e[r]); - if (qx) for (var r of qx(e)) oz.call(e, r) && zx(t, r, e[r]); +var nz = Object.defineProperty, iz = Object.defineProperties, sz = Object.getOwnPropertyDescriptors, jx = Object.getOwnPropertySymbols, oz = Object.prototype.hasOwnProperty, az = Object.prototype.propertyIsEnumerable, Ux = (t, e, r) => e in t ? nz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, cz = (t, e) => { + for (var r in e || (e = {})) oz.call(e, r) && Ux(t, r, e[r]); + if (jx) for (var r of jx(e)) az.call(e, r) && Ux(t, r, e[r]); return t; -}, cz = (t, e) => nz(t, iz(e)); -const uz = "did:pkh:", sb = (t) => t == null ? void 0 : t.split(":"), fz = (t) => { +}, uz = (t, e) => iz(t, sz(e)); +const fz = "did:pkh:", sb = (t) => t == null ? void 0 : t.split(":"), lz = (t) => { const e = t && sb(t); - if (e) return t.includes(uz) ? e[3] : e[1]; + if (e) return t.includes(fz) ? e[3] : e[1]; }, M1 = (t) => { const e = t && sb(t); if (e) return e[2] + ":" + e[3]; @@ -16787,30 +16787,30 @@ const uz = "did:pkh:", sb = (t) => t == null ? void 0 : t.split(":"), fz = (t) = const e = t && sb(t); if (e) return e.pop(); }; -async function Wx(t) { - const { cacao: e, projectId: r } = t, { s: n, p: i } = e, s = U8(i, i.iss), o = u0(i.iss); - return await Zq(o, s, n, M1(i.iss), r); +async function qx(t) { + const { cacao: e, projectId: r } = t, { s: n, p: i } = e, s = F8(i, i.iss), o = u0(i.iss); + return await Qq(o, s, n, M1(i.iss), r); } -const U8 = (t, e) => { +const F8 = (t, e) => { const r = `${t.domain} wants you to sign in with your Ethereum account:`, n = u0(e); if (!t.aud && !t.uri) throw new Error("Either `aud` or `uri` is required to construct the message"); let i = t.statement || void 0; - const s = `URI: ${t.aud || t.uri}`, o = `Version: ${t.version}`, a = `Chain ID: ${fz(e)}`, u = `Nonce: ${t.nonce}`, l = `Issued At: ${t.iat}`, d = t.exp ? `Expiration Time: ${t.exp}` : void 0, p = t.nbf ? `Not Before: ${t.nbf}` : void 0, w = t.requestId ? `Request ID: ${t.requestId}` : void 0, A = t.resources ? `Resources:${t.resources.map((N) => ` -- ${N}`).join("")}` : void 0, P = Cd(t.resources); - if (P) { - const N = _l(P); - i = yz(i, N); + const s = `URI: ${t.aud || t.uri}`, o = `Version: ${t.version}`, a = `Chain ID: ${lz(e)}`, u = `Nonce: ${t.nonce}`, l = `Issued At: ${t.iat}`, d = t.exp ? `Expiration Time: ${t.exp}` : void 0, p = t.nbf ? `Not Before: ${t.nbf}` : void 0, w = t.requestId ? `Request ID: ${t.requestId}` : void 0, A = t.resources ? `Resources:${t.resources.map((N) => ` +- ${N}`).join("")}` : void 0, M = Cd(t.resources); + if (M) { + const N = _l(M); + i = wz(i, N); } return [r, n, "", i, "", s, o, a, u, l, d, p, w, A].filter((N) => N != null).join(` `); }; -function lz(t) { +function hz(t) { return Buffer.from(JSON.stringify(t)).toString("base64"); } -function hz(t) { +function dz(t) { return JSON.parse(Buffer.from(t, "base64").toString("utf-8")); } -function dc(t) { +function hc(t) { if (!t) throw new Error("No recap provided, value is undefined"); if (!t.att) throw new Error("No `att` property found"); const e = Object.keys(t.att); @@ -16830,45 +16830,45 @@ function dc(t) { }); }); } -function dz(t, e, r, n = {}) { - return r == null || r.sort((i, s) => i.localeCompare(s)), { att: { [t]: pz(e, r, n) } }; +function pz(t, e, r, n = {}) { + return r == null || r.sort((i, s) => i.localeCompare(s)), { att: { [t]: gz(e, r, n) } }; } -function pz(t, e, r = {}) { +function gz(t, e, r = {}) { e = e == null ? void 0 : e.sort((i, s) => i.localeCompare(s)); const n = e.map((i) => ({ [`${t}/${i}`]: [r] })); return Object.assign({}, ...n); } -function q8(t) { - return dc(t), `urn:recap:${lz(t).replace(/=/g, "")}`; +function j8(t) { + return hc(t), `urn:recap:${hz(t).replace(/=/g, "")}`; } function _l(t) { - const e = hz(t.replace("urn:recap:", "")); - return dc(e), e; + const e = dz(t.replace("urn:recap:", "")); + return hc(e), e; } -function gz(t, e, r) { - const n = dz(t, e, r); - return q8(n); +function mz(t, e, r) { + const n = pz(t, e, r); + return j8(n); } -function mz(t) { +function vz(t) { return t && t.includes("urn:recap:"); } -function vz(t, e) { - const r = _l(t), n = _l(e), i = bz(r, n); - return q8(i); -} function bz(t, e) { - dc(t), dc(e); + const r = _l(t), n = _l(e), i = yz(r, n); + return j8(i); +} +function yz(t, e) { + hc(t), hc(e); const r = Object.keys(t.att).concat(Object.keys(e.att)).sort((i, s) => i.localeCompare(s)), n = { att: {} }; return r.forEach((i) => { var s, o; Object.keys(((s = t.att) == null ? void 0 : s[i]) || {}).concat(Object.keys(((o = e.att) == null ? void 0 : o[i]) || {})).sort((a, u) => a.localeCompare(u)).forEach((a) => { var u, l; - n.att[i] = cz(az({}, n.att[i]), { [a]: ((u = t.att[i]) == null ? void 0 : u[a]) || ((l = e.att[i]) == null ? void 0 : l[a]) }); + n.att[i] = uz(cz({}, n.att[i]), { [a]: ((u = t.att[i]) == null ? void 0 : u[a]) || ((l = e.att[i]) == null ? void 0 : l[a]) }); }); }), n; } -function yz(t = "", e) { - dc(e); +function wz(t = "", e) { + hc(e); const r = "I further authorize the stated URI to perform the following actions on my behalf: "; if (t.includes(r)) return t; const n = []; @@ -16886,16 +16886,16 @@ function yz(t = "", e) { const s = n.join(" "), o = `${r}${s}`; return `${t ? t + " " : ""}${o}`; } -function Hx(t) { +function zx(t) { var e; const r = _l(t); - dc(r); + hc(r); const n = (e = r.att) == null ? void 0 : e.eip155; return n ? Object.keys(n).map((i) => i.split("/")[1]) : []; } -function Kx(t) { +function Wx(t) { const e = _l(t); - dc(e); + hc(e); const r = []; return Object.values(e.att).forEach((n) => { Object.values(n).forEach((i) => { @@ -16907,127 +16907,127 @@ function Kx(t) { function Cd(t) { if (!t) return; const e = t == null ? void 0 : t[t.length - 1]; - return mz(e) ? e : void 0; + return vz(e) ? e : void 0; } -const z8 = "base10", ai = "base16", pa = "base64pad", Af = "base64url", eh = "utf8", W8 = 0, Ro = 1, th = 2, wz = 0, Vx = 1, qf = 12, ob = 32; -function xz() { +const U8 = "base10", ai = "base16", ha = "base64pad", Af = "base64url", eh = "utf8", q8 = 0, Co = 1, th = 2, xz = 0, Hx = 1, qf = 12, ob = 32; +function _z() { const t = Jv.generateKeyPair(); return { privateKey: On(t.secretKey, ai), publicKey: On(t.publicKey, ai) }; } function I1() { - const t = Ca.randomBytes(ob); + const t = Pa.randomBytes(ob); return On(t, ai); } -function _z(t, e) { - const r = Jv.sharedKey(Rn(t, ai), Rn(e, ai), !0), n = new UU(Yl.SHA256, r).expand(ob); +function Ez(t, e) { + const r = Jv.sharedKey(Rn(t, ai), Rn(e, ai), !0), n = new qU(Yl.SHA256, r).expand(ob); return On(n, ai); } function Td(t) { const e = Yl.hash(Rn(t, ai)); return On(e, ai); } -function Eo(t) { +function xo(t) { const e = Yl.hash(Rn(t, eh)); return On(e, ai); } -function H8(t) { - return Rn(`${t}`, z8); +function z8(t) { + return Rn(`${t}`, U8); } -function pc(t) { - return Number(On(t, z8)); +function dc(t) { + return Number(On(t, U8)); } -function Ez(t) { - const e = H8(typeof t.type < "u" ? t.type : W8); - if (pc(e) === Ro && typeof t.senderPublicKey > "u") throw new Error("Missing sender public key for type 1 envelope"); - const r = typeof t.senderPublicKey < "u" ? Rn(t.senderPublicKey, ai) : void 0, n = typeof t.iv < "u" ? Rn(t.iv, ai) : Ca.randomBytes(qf), i = new Gv.ChaCha20Poly1305(Rn(t.symKey, ai)).seal(n, Rn(t.message, eh)); - return K8({ type: e, sealed: i, iv: n, senderPublicKey: r, encoding: t.encoding }); +function Sz(t) { + const e = z8(typeof t.type < "u" ? t.type : q8); + if (dc(e) === Co && typeof t.senderPublicKey > "u") throw new Error("Missing sender public key for type 1 envelope"); + const r = typeof t.senderPublicKey < "u" ? Rn(t.senderPublicKey, ai) : void 0, n = typeof t.iv < "u" ? Rn(t.iv, ai) : Pa.randomBytes(qf), i = new Gv.ChaCha20Poly1305(Rn(t.symKey, ai)).seal(n, Rn(t.message, eh)); + return W8({ type: e, sealed: i, iv: n, senderPublicKey: r, encoding: t.encoding }); } -function Sz(t, e) { - const r = H8(th), n = Ca.randomBytes(qf), i = Rn(t, eh); - return K8({ type: r, sealed: i, iv: n, encoding: e }); +function Az(t, e) { + const r = z8(th), n = Pa.randomBytes(qf), i = Rn(t, eh); + return W8({ type: r, sealed: i, iv: n, encoding: e }); } -function Az(t) { +function Pz(t) { const e = new Gv.ChaCha20Poly1305(Rn(t.symKey, ai)), { sealed: r, iv: n } = El({ encoded: t.encoded, encoding: t == null ? void 0 : t.encoding }), i = e.open(n, r); if (i === null) throw new Error("Failed to decrypt"); return On(i, eh); } -function Pz(t, e) { +function Mz(t, e) { const { sealed: r } = El({ encoded: t, encoding: e }); return On(r, eh); } -function K8(t) { - const { encoding: e = pa } = t; - if (pc(t.type) === th) return On(Sd([t.type, t.sealed]), e); - if (pc(t.type) === Ro) { +function W8(t) { + const { encoding: e = ha } = t; + if (dc(t.type) === th) return On(Sd([t.type, t.sealed]), e); + if (dc(t.type) === Co) { if (typeof t.senderPublicKey > "u") throw new Error("Missing sender public key for type 1 envelope"); return On(Sd([t.type, t.senderPublicKey, t.iv, t.sealed]), e); } return On(Sd([t.type, t.iv, t.sealed]), e); } function El(t) { - const { encoded: e, encoding: r = pa } = t, n = Rn(e, r), i = n.slice(wz, Vx), s = Vx; - if (pc(i) === Ro) { + const { encoded: e, encoding: r = ha } = t, n = Rn(e, r), i = n.slice(xz, Hx), s = Hx; + if (dc(i) === Co) { const l = s + ob, d = l + qf, p = n.slice(s, l), w = n.slice(l, d), A = n.slice(d); return { type: i, sealed: A, iv: w, senderPublicKey: p }; } - if (pc(i) === th) { - const l = n.slice(s), d = Ca.randomBytes(qf); + if (dc(i) === th) { + const l = n.slice(s), d = Pa.randomBytes(qf); return { type: i, sealed: l, iv: d }; } const o = s + qf, a = n.slice(s, o), u = n.slice(o); return { type: i, sealed: u, iv: a }; } -function Mz(t, e) { +function Iz(t, e) { const r = El({ encoded: t, encoding: e == null ? void 0 : e.encoding }); - return V8({ type: pc(r.type), senderPublicKey: typeof r.senderPublicKey < "u" ? On(r.senderPublicKey, ai) : void 0, receiverPublicKey: e == null ? void 0 : e.receiverPublicKey }); + return H8({ type: dc(r.type), senderPublicKey: typeof r.senderPublicKey < "u" ? On(r.senderPublicKey, ai) : void 0, receiverPublicKey: e == null ? void 0 : e.receiverPublicKey }); } -function V8(t) { - const e = (t == null ? void 0 : t.type) || W8; - if (e === Ro) { +function H8(t) { + const e = (t == null ? void 0 : t.type) || q8; + if (e === Co) { if (typeof (t == null ? void 0 : t.senderPublicKey) > "u") throw new Error("missing sender public key"); if (typeof (t == null ? void 0 : t.receiverPublicKey) > "u") throw new Error("missing receiver public key"); } return { type: e, senderPublicKey: t == null ? void 0 : t.senderPublicKey, receiverPublicKey: t == null ? void 0 : t.receiverPublicKey }; } -function Gx(t) { - return t.type === Ro && typeof t.senderPublicKey == "string" && typeof t.receiverPublicKey == "string"; +function Kx(t) { + return t.type === Co && typeof t.senderPublicKey == "string" && typeof t.receiverPublicKey == "string"; } -function Yx(t) { +function Vx(t) { return t.type === th; } -function Iz(t) { - return new E8.ec("p256").keyFromPublic({ x: Buffer.from(t.x, "base64").toString("hex"), y: Buffer.from(t.y, "base64").toString("hex") }, "hex"); -} function Cz(t) { + return new x8.ec("p256").keyFromPublic({ x: Buffer.from(t.x, "base64").toString("hex"), y: Buffer.from(t.y, "base64").toString("hex") }, "hex"); +} +function Tz(t) { let e = t.replace(/-/g, "+").replace(/_/g, "/"); const r = e.length % 4; return r > 0 && (e += "=".repeat(4 - r)), e; } -function Tz(t) { - return Buffer.from(Cz(t), "base64"); +function Rz(t) { + return Buffer.from(Tz(t), "base64"); } -function Rz(t, e) { - const [r, n, i] = t.split("."), s = Tz(i); +function Dz(t, e) { + const [r, n, i] = t.split("."), s = Rz(i); if (s.length !== 64) throw new Error("Invalid signature length"); - const o = s.slice(0, 32).toString("hex"), a = s.slice(32, 64).toString("hex"), u = `${r}.${n}`, l = new Yl.SHA256().update(Buffer.from(u)).digest(), d = Iz(e), p = Buffer.from(l).toString("hex"); + const o = s.slice(0, 32).toString("hex"), a = s.slice(32, 64).toString("hex"), u = `${r}.${n}`, l = new Yl.SHA256().update(Buffer.from(u)).digest(), d = Cz(e), p = Buffer.from(l).toString("hex"); if (!d.verify(p, { r: o, s: a })) throw new Error("Invalid signature"); return v1(t).payload; } -const Dz = "irn"; +const Oz = "irn"; function C1(t) { - return (t == null ? void 0 : t.relay) || { protocol: Dz }; + return (t == null ? void 0 : t.relay) || { protocol: Oz }; } function Bf(t) { - const e = Dq[t]; + const e = Oq[t]; if (typeof e > "u") throw new Error(`Relay Protocol not supported: ${t}`); return e; } -var Oz = Object.defineProperty, Nz = Object.defineProperties, Lz = Object.getOwnPropertyDescriptors, Jx = Object.getOwnPropertySymbols, kz = Object.prototype.hasOwnProperty, $z = Object.prototype.propertyIsEnumerable, Xx = (t, e, r) => e in t ? Oz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Zx = (t, e) => { - for (var r in e || (e = {})) kz.call(e, r) && Xx(t, r, e[r]); - if (Jx) for (var r of Jx(e)) $z.call(e, r) && Xx(t, r, e[r]); +var Nz = Object.defineProperty, Lz = Object.defineProperties, kz = Object.getOwnPropertyDescriptors, Gx = Object.getOwnPropertySymbols, $z = Object.prototype.hasOwnProperty, Bz = Object.prototype.propertyIsEnumerable, Yx = (t, e, r) => e in t ? Nz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Jx = (t, e) => { + for (var r in e || (e = {})) $z.call(e, r) && Yx(t, r, e[r]); + if (Gx) for (var r of Gx(e)) Bz.call(e, r) && Yx(t, r, e[r]); return t; -}, Bz = (t, e) => Nz(t, Lz(e)); -function Fz(t, e = "-") { +}, Fz = (t, e) => Lz(t, kz(e)); +function jz(t, e = "-") { const r = {}, n = "relay" + e; return Object.keys(t).forEach((i) => { if (i.startsWith(n)) { @@ -17036,27 +17036,27 @@ function Fz(t, e = "-") { } }), r; } -function Qx(t) { +function Xx(t) { if (!t.includes("wc:")) { - const u = j8(t); + const u = B8(t); u != null && u.includes("wc:") && (t = u); } t = t.includes("wc://") ? t.replace("wc://", "") : t, t = t.includes("wc:") ? t.replace("wc:", "") : t; const e = t.indexOf(":"), r = t.indexOf("?") !== -1 ? t.indexOf("?") : void 0, n = t.substring(0, e), i = t.substring(e + 1, r).split("@"), s = typeof r < "u" ? t.substring(r) : "", o = xl.parse(s), a = typeof o.methods == "string" ? o.methods.split(",") : void 0; - return { protocol: n, topic: jz(i[0]), version: parseInt(i[1], 10), symKey: o.symKey, relay: Fz(o), methods: a, expiryTimestamp: o.expiryTimestamp ? parseInt(o.expiryTimestamp, 10) : void 0 }; + return { protocol: n, topic: Uz(i[0]), version: parseInt(i[1], 10), symKey: o.symKey, relay: jz(o), methods: a, expiryTimestamp: o.expiryTimestamp ? parseInt(o.expiryTimestamp, 10) : void 0 }; } -function jz(t) { +function Uz(t) { return t.startsWith("//") ? t.substring(2) : t; } -function Uz(t, e = "-") { +function qz(t, e = "-") { const r = "relay", n = {}; return Object.keys(t).forEach((i) => { const s = r + e + i; t[i] && (n[s] = t[i]); }), n; } -function e3(t) { - return `${t.protocol}:${t.topic}@${t.version}?` + xl.stringify(Zx(Bz(Zx({ symKey: t.symKey }, Uz(t.relay)), { expiryTimestamp: t.expiryTimestamp }), t.methods ? { methods: t.methods.join(",") } : {})); +function Zx(t) { + return `${t.protocol}:${t.topic}@${t.version}?` + xl.stringify(Jx(Fz(Jx({ symKey: t.symKey }, qz(t.relay)), { expiryTimestamp: t.expiryTimestamp }), t.methods ? { methods: t.methods.join(",") } : {})); } function fd(t, e, r) { return `${t}?wc_ev=${r}&topic=${e}`; @@ -17068,19 +17068,19 @@ function zu(t) { e.push(`${n}:${i}`); }), e; } -function qz(t) { +function zz(t) { const e = []; return Object.values(t).forEach((r) => { e.push(...zu(r.accounts)); }), e; } -function zz(t, e) { +function Wz(t, e) { const r = []; return Object.values(t).forEach((n) => { zu(n.accounts).includes(e) && r.push(...n.methods); }), r; } -function Wz(t, e) { +function Hz(t, e) { const r = []; return Object.values(t).forEach((n) => { zu(n.accounts).includes(e) && r.push(...n.events); @@ -17092,29 +17092,29 @@ function ab(t) { function Ff(t) { return ab(t) ? t.split(":")[0] : t; } -function Hz(t) { +function Kz(t) { const e = {}; return t == null || t.forEach((r) => { const [n, i] = r.split(":"); e[n] || (e[n] = { accounts: [], chains: [], events: [] }), e[n].accounts.push(r), e[n].chains.push(`${n}:${i}`); }), e; } -function t3(t, e) { +function Qx(t, e) { e = e.map((n) => n.replace("did:pkh:", "")); - const r = Hz(e); + const r = Kz(e); for (const [n, i] of Object.entries(r)) i.methods ? i.methods = Id(i.methods, t) : i.methods = t, i.events = ["chainChanged", "accountsChanged"]; return r; } -const Kz = { INVALID_METHOD: { message: "Invalid method.", code: 1001 }, INVALID_EVENT: { message: "Invalid event.", code: 1002 }, INVALID_UPDATE_REQUEST: { message: "Invalid update request.", code: 1003 }, INVALID_EXTEND_REQUEST: { message: "Invalid extend request.", code: 1004 }, INVALID_SESSION_SETTLE_REQUEST: { message: "Invalid session settle request.", code: 1005 }, UNAUTHORIZED_METHOD: { message: "Unauthorized method.", code: 3001 }, UNAUTHORIZED_EVENT: { message: "Unauthorized event.", code: 3002 }, UNAUTHORIZED_UPDATE_REQUEST: { message: "Unauthorized update request.", code: 3003 }, UNAUTHORIZED_EXTEND_REQUEST: { message: "Unauthorized extend request.", code: 3004 }, USER_REJECTED: { message: "User rejected.", code: 5e3 }, USER_REJECTED_CHAINS: { message: "User rejected chains.", code: 5001 }, USER_REJECTED_METHODS: { message: "User rejected methods.", code: 5002 }, USER_REJECTED_EVENTS: { message: "User rejected events.", code: 5003 }, UNSUPPORTED_CHAINS: { message: "Unsupported chains.", code: 5100 }, UNSUPPORTED_METHODS: { message: "Unsupported methods.", code: 5101 }, UNSUPPORTED_EVENTS: { message: "Unsupported events.", code: 5102 }, UNSUPPORTED_ACCOUNTS: { message: "Unsupported accounts.", code: 5103 }, UNSUPPORTED_NAMESPACE_KEY: { message: "Unsupported namespace key.", code: 5104 }, USER_DISCONNECTED: { message: "User disconnected.", code: 6e3 }, SESSION_SETTLEMENT_FAILED: { message: "Session settlement failed.", code: 7e3 }, WC_METHOD_UNSUPPORTED: { message: "Unsupported wc_ method.", code: 10001 } }, Vz = { NOT_INITIALIZED: { message: "Not initialized.", code: 1 }, NO_MATCHING_KEY: { message: "No matching key.", code: 2 }, RESTORE_WILL_OVERRIDE: { message: "Restore will override.", code: 3 }, RESUBSCRIBED: { message: "Resubscribed.", code: 4 }, MISSING_OR_INVALID: { message: "Missing or invalid.", code: 5 }, EXPIRED: { message: "Expired.", code: 6 }, UNKNOWN_TYPE: { message: "Unknown type.", code: 7 }, MISMATCHED_TOPIC: { message: "Mismatched topic.", code: 8 }, NON_CONFORMING_NAMESPACES: { message: "Non conforming namespaces.", code: 9 } }; +const Vz = { INVALID_METHOD: { message: "Invalid method.", code: 1001 }, INVALID_EVENT: { message: "Invalid event.", code: 1002 }, INVALID_UPDATE_REQUEST: { message: "Invalid update request.", code: 1003 }, INVALID_EXTEND_REQUEST: { message: "Invalid extend request.", code: 1004 }, INVALID_SESSION_SETTLE_REQUEST: { message: "Invalid session settle request.", code: 1005 }, UNAUTHORIZED_METHOD: { message: "Unauthorized method.", code: 3001 }, UNAUTHORIZED_EVENT: { message: "Unauthorized event.", code: 3002 }, UNAUTHORIZED_UPDATE_REQUEST: { message: "Unauthorized update request.", code: 3003 }, UNAUTHORIZED_EXTEND_REQUEST: { message: "Unauthorized extend request.", code: 3004 }, USER_REJECTED: { message: "User rejected.", code: 5e3 }, USER_REJECTED_CHAINS: { message: "User rejected chains.", code: 5001 }, USER_REJECTED_METHODS: { message: "User rejected methods.", code: 5002 }, USER_REJECTED_EVENTS: { message: "User rejected events.", code: 5003 }, UNSUPPORTED_CHAINS: { message: "Unsupported chains.", code: 5100 }, UNSUPPORTED_METHODS: { message: "Unsupported methods.", code: 5101 }, UNSUPPORTED_EVENTS: { message: "Unsupported events.", code: 5102 }, UNSUPPORTED_ACCOUNTS: { message: "Unsupported accounts.", code: 5103 }, UNSUPPORTED_NAMESPACE_KEY: { message: "Unsupported namespace key.", code: 5104 }, USER_DISCONNECTED: { message: "User disconnected.", code: 6e3 }, SESSION_SETTLEMENT_FAILED: { message: "Session settlement failed.", code: 7e3 }, WC_METHOD_UNSUPPORTED: { message: "Unsupported wc_ method.", code: 10001 } }, Gz = { NOT_INITIALIZED: { message: "Not initialized.", code: 1 }, NO_MATCHING_KEY: { message: "No matching key.", code: 2 }, RESTORE_WILL_OVERRIDE: { message: "Restore will override.", code: 3 }, RESUBSCRIBED: { message: "Resubscribed.", code: 4 }, MISSING_OR_INVALID: { message: "Missing or invalid.", code: 5 }, EXPIRED: { message: "Expired.", code: 6 }, UNKNOWN_TYPE: { message: "Unknown type.", code: 7 }, MISMATCHED_TOPIC: { message: "Mismatched topic.", code: 8 }, NON_CONFORMING_NAMESPACES: { message: "Non conforming namespaces.", code: 9 } }; function ft(t, e) { - const { message: r, code: n } = Vz[t]; + const { message: r, code: n } = Gz[t]; return { message: e ? `${r} ${e}` : r, code: n }; } function Or(t, e) { - const { message: r, code: n } = Kz[t]; + const { message: r, code: n } = Vz[t]; return { message: e ? `${r} ${e}` : r, code: n }; } -function gc(t, e) { +function pc(t, e) { return !!Array.isArray(t); } function Sl(t) { @@ -17129,18 +17129,18 @@ function dn(t, e) { function cb(t, e) { return typeof t == "number" && !isNaN(t); } -function Gz(t, e) { +function Yz(t, e) { const { requiredNamespaces: r } = e, n = Object.keys(t.namespaces), i = Object.keys(r); let s = !0; - return nc(i, n) ? (n.forEach((o) => { + return rc(i, n) ? (n.forEach((o) => { const { accounts: a, methods: u, events: l } = t.namespaces[o], d = zu(a), p = r[o]; - (!nc(O8(o, p), d) || !nc(p.methods, u) || !nc(p.events, l)) && (s = !1); + (!rc(R8(o, p), d) || !rc(p.methods, u) || !rc(p.events, l)) && (s = !1); }), s) : !1; } function f0(t) { return dn(t, !1) && t.includes(":") ? t.split(":").length === 2 : !1; } -function Yz(t) { +function Jz(t) { if (dn(t, !1) && t.includes(":")) { const e = t.split(":"); if (e.length === 3) { @@ -17150,7 +17150,7 @@ function Yz(t) { } return !1; } -function Jz(t) { +function Xz(t) { function e(r) { try { return typeof new URL(r) < "u"; @@ -17161,74 +17161,74 @@ function Jz(t) { try { if (dn(t, !1)) { if (e(t)) return !0; - const r = j8(t); + const r = B8(t); return e(r); } } catch { } return !1; } -function Xz(t) { +function Zz(t) { var e; return (e = t == null ? void 0 : t.proposer) == null ? void 0 : e.publicKey; } -function Zz(t) { +function Qz(t) { return t == null ? void 0 : t.topic; } -function Qz(t, e) { +function eW(t, e) { let r = null; return dn(t == null ? void 0 : t.publicKey, !1) || (r = ft("MISSING_OR_INVALID", `${e} controller public key should be a string`)), r; } -function r3(t) { +function e3(t) { let e = !0; - return gc(t) ? t.length && (e = t.every((r) => dn(r, !1))) : e = !1, e; + return pc(t) ? t.length && (e = t.every((r) => dn(r, !1))) : e = !1, e; } -function eW(t, e, r) { +function tW(t, e, r) { let n = null; - return gc(e) && e.length ? e.forEach((i) => { + return pc(e) && e.length ? e.forEach((i) => { n || f0(i) || (n = Or("UNSUPPORTED_CHAINS", `${r}, chain ${i} should be a string and conform to "namespace:chainId" format`)); }) : f0(t) || (n = Or("UNSUPPORTED_CHAINS", `${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)), n; } -function tW(t, e, r) { +function rW(t, e, r) { let n = null; return Object.entries(t).forEach(([i, s]) => { if (n) return; - const o = eW(i, O8(i, s), `${e} ${r}`); + const o = tW(i, R8(i, s), `${e} ${r}`); o && (n = o); }), n; } -function rW(t, e) { +function nW(t, e) { let r = null; - return gc(t) ? t.forEach((n) => { - r || Yz(n) || (r = Or("UNSUPPORTED_ACCOUNTS", `${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`)); + return pc(t) ? t.forEach((n) => { + r || Jz(n) || (r = Or("UNSUPPORTED_ACCOUNTS", `${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`)); }) : r = Or("UNSUPPORTED_ACCOUNTS", `${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`), r; } -function nW(t, e) { +function iW(t, e) { let r = null; return Object.values(t).forEach((n) => { if (r) return; - const i = rW(n == null ? void 0 : n.accounts, `${e} namespace`); + const i = nW(n == null ? void 0 : n.accounts, `${e} namespace`); i && (r = i); }), r; } -function iW(t, e) { +function sW(t, e) { let r = null; - return r3(t == null ? void 0 : t.methods) ? r3(t == null ? void 0 : t.events) || (r = Or("UNSUPPORTED_EVENTS", `${e}, events should be an array of strings or empty array for no events`)) : r = Or("UNSUPPORTED_METHODS", `${e}, methods should be an array of strings or empty array for no methods`), r; + return e3(t == null ? void 0 : t.methods) ? e3(t == null ? void 0 : t.events) || (r = Or("UNSUPPORTED_EVENTS", `${e}, events should be an array of strings or empty array for no events`)) : r = Or("UNSUPPORTED_METHODS", `${e}, methods should be an array of strings or empty array for no methods`), r; } -function G8(t, e) { +function K8(t, e) { let r = null; return Object.values(t).forEach((n) => { if (r) return; - const i = iW(n, `${e}, namespace`); + const i = sW(n, `${e}, namespace`); i && (r = i); }), r; } -function sW(t, e, r) { +function oW(t, e, r) { let n = null; if (t && Sl(t)) { - const i = G8(t, e); + const i = K8(t, e); i && (n = i); - const s = tW(t, e, r); + const s = rW(t, e, r); s && (n = s); } else n = ft("MISSING_OR_INVALID", `${e}, ${r} should be an object with data`); return n; @@ -17236,55 +17236,55 @@ function sW(t, e, r) { function hm(t, e) { let r = null; if (t && Sl(t)) { - const n = G8(t, e); + const n = K8(t, e); n && (r = n); - const i = nW(t, e); + const i = iW(t, e); i && (r = i); } else r = ft("MISSING_OR_INVALID", `${e}, namespaces should be an object with data`); return r; } -function Y8(t) { +function V8(t) { return dn(t.protocol, !0); } -function oW(t, e) { +function aW(t, e) { let r = !1; - return t ? t && gc(t) && t.length && t.forEach((n) => { - r = Y8(n); + return t ? t && pc(t) && t.length && t.forEach((n) => { + r = V8(n); }) : r = !0, r; } -function aW(t) { +function cW(t) { return typeof t == "number"; } function gi(t) { return typeof t < "u" && typeof t !== null; } -function cW(t) { +function uW(t) { return !(!t || typeof t != "object" || !t.code || !cb(t.code) || !t.message || !dn(t.message, !1)); } -function uW(t) { +function fW(t) { return !(mi(t) || !dn(t.method, !1)); } -function fW(t) { +function lW(t) { return !(mi(t) || mi(t.result) && mi(t.error) || !cb(t.id) || !dn(t.jsonrpc, !1)); } -function lW(t) { +function hW(t) { return !(mi(t) || !dn(t.name, !1)); } -function n3(t, e) { - return !(!f0(e) || !qz(t).includes(e)); -} -function hW(t, e, r) { - return dn(r, !1) ? zz(t, e).includes(r) : !1; +function t3(t, e) { + return !(!f0(e) || !zz(t).includes(e)); } function dW(t, e, r) { return dn(r, !1) ? Wz(t, e).includes(r) : !1; } -function i3(t, e, r) { +function pW(t, e, r) { + return dn(r, !1) ? Hz(t, e).includes(r) : !1; +} +function r3(t, e, r) { let n = null; - const i = pW(t), s = gW(e), o = Object.keys(i), a = Object.keys(s), u = s3(Object.keys(t)), l = s3(Object.keys(e)), d = u.filter((p) => !l.includes(p)); + const i = gW(t), s = mW(e), o = Object.keys(i), a = Object.keys(s), u = n3(Object.keys(t)), l = n3(Object.keys(e)), d = u.filter((p) => !l.includes(p)); return d.length && (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces keys don't satisfy requiredNamespaces. Required: ${d.toString()} - Received: ${Object.keys(e).toString()}`)), nc(o, a) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces chains don't satisfy required namespaces. + Received: ${Object.keys(e).toString()}`)), rc(o, a) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} Approved: ${a.toString()}`)), Object.keys(e).forEach((p) => { if (!p.includes(":") || n) return; @@ -17293,10 +17293,10 @@ function i3(t, e, r) { Required: ${p} Approved: ${w.toString()}`)); }), o.forEach((p) => { - n || (nc(i[p].methods, s[p].methods) ? nc(i[p].events, s[p].events) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces events don't satisfy namespace events for ${p}`)) : n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces methods don't satisfy namespace methods for ${p}`)); + n || (rc(i[p].methods, s[p].methods) ? rc(i[p].events, s[p].events) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces events don't satisfy namespace events for ${p}`)) : n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces methods don't satisfy namespace methods for ${p}`)); }), n; } -function pW(t) { +function gW(t) { const e = {}; return Object.keys(t).forEach((r) => { var n; @@ -17305,10 +17305,10 @@ function pW(t) { }); }), e; } -function s3(t) { +function n3(t) { return [...new Set(t.map((e) => e.includes(":") ? e.split(":")[0] : e))]; } -function gW(t) { +function mW(t) { const e = {}; return Object.keys(t).forEach((r) => { if (r.includes(":")) e[r] = t[r]; @@ -17320,54 +17320,54 @@ function gW(t) { } }), e; } -function mW(t, e) { +function vW(t, e) { return cb(t) && t <= e.max && t >= e.min; } -function o3() { +function i3() { const t = Ql(); return new Promise((e) => { switch (t) { case Di.browser: - e(vW()); + e(bW()); break; case Di.reactNative: - e(bW()); + e(yW()); break; case Di.node: - e(yW()); + e(wW()); break; default: e(!0); } }); } -function vW() { +function bW() { return Zl() && (navigator == null ? void 0 : navigator.onLine); } -async function bW() { +async function yW() { if (qu() && typeof global < "u" && global != null && global.NetInfo) { const t = await (global == null ? void 0 : global.NetInfo.fetch()); return t == null ? void 0 : t.isConnected; } return !0; } -function yW() { +function wW() { return !0; } -function wW(t) { +function xW(t) { switch (Ql()) { case Di.browser: - xW(t); + _W(t); break; case Di.reactNative: - _W(t); + EW(t); break; } } -function xW(t) { +function _W(t) { !qu() && Zl() && (window.addEventListener("online", () => t(!0)), window.addEventListener("offline", () => t(!1))); } -function _W(t) { +function EW(t) { qu() && typeof global < "u" && global != null && global.NetInfo && (global == null || global.NetInfo.addEventListener((e) => t(e == null ? void 0 : e.isConnected))); } const dm = {}; @@ -17382,77 +17382,77 @@ class Pf { delete dm[e]; } } -const EW = "PARSE_ERROR", SW = "INVALID_REQUEST", AW = "METHOD_NOT_FOUND", PW = "INVALID_PARAMS", J8 = "INTERNAL_ERROR", ub = "SERVER_ERROR", MW = [-32700, -32600, -32601, -32602, -32603], zf = { - [EW]: { code: -32700, message: "Parse error" }, - [SW]: { code: -32600, message: "Invalid Request" }, - [AW]: { code: -32601, message: "Method not found" }, - [PW]: { code: -32602, message: "Invalid params" }, - [J8]: { code: -32603, message: "Internal error" }, +const SW = "PARSE_ERROR", AW = "INVALID_REQUEST", PW = "METHOD_NOT_FOUND", MW = "INVALID_PARAMS", G8 = "INTERNAL_ERROR", ub = "SERVER_ERROR", IW = [-32700, -32600, -32601, -32602, -32603], zf = { + [SW]: { code: -32700, message: "Parse error" }, + [AW]: { code: -32600, message: "Invalid Request" }, + [PW]: { code: -32601, message: "Method not found" }, + [MW]: { code: -32602, message: "Invalid params" }, + [G8]: { code: -32603, message: "Internal error" }, [ub]: { code: -32e3, message: "Server error" } -}, X8 = ub; -function IW(t) { - return MW.includes(t); +}, Y8 = ub; +function CW(t) { + return IW.includes(t); } -function a3(t) { - return Object.keys(zf).includes(t) ? zf[t] : zf[X8]; +function s3(t) { + return Object.keys(zf).includes(t) ? zf[t] : zf[Y8]; } -function CW(t) { +function TW(t) { const e = Object.values(zf).find((r) => r.code === t); - return e || zf[X8]; + return e || zf[Y8]; } -function Z8(t, e, r) { +function J8(t, e, r) { return t.message.includes("getaddrinfo ENOTFOUND") || t.message.includes("connect ECONNREFUSED") ? new Error(`Unavailable ${r} RPC url at ${e}`) : t; } -var Q8 = {}, bo = {}, c3; -function TW() { - if (c3) return bo; - c3 = 1, Object.defineProperty(bo, "__esModule", { value: !0 }), bo.isBrowserCryptoAvailable = bo.getSubtleCrypto = bo.getBrowerCrypto = void 0; +var X8 = {}, mo = {}, o3; +function RW() { + if (o3) return mo; + o3 = 1, Object.defineProperty(mo, "__esModule", { value: !0 }), mo.isBrowserCryptoAvailable = mo.getSubtleCrypto = mo.getBrowerCrypto = void 0; function t() { return (gn == null ? void 0 : gn.crypto) || (gn == null ? void 0 : gn.msCrypto) || {}; } - bo.getBrowerCrypto = t; + mo.getBrowerCrypto = t; function e() { const n = t(); return n.subtle || n.webkitSubtle; } - bo.getSubtleCrypto = e; + mo.getSubtleCrypto = e; function r() { return !!t() && !!e(); } - return bo.isBrowserCryptoAvailable = r, bo; + return mo.isBrowserCryptoAvailable = r, mo; } -var yo = {}, u3; -function RW() { - if (u3) return yo; - u3 = 1, Object.defineProperty(yo, "__esModule", { value: !0 }), yo.isBrowser = yo.isNode = yo.isReactNative = void 0; +var vo = {}, a3; +function DW() { + if (a3) return vo; + a3 = 1, Object.defineProperty(vo, "__esModule", { value: !0 }), vo.isBrowser = vo.isNode = vo.isReactNative = void 0; function t() { return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative"; } - yo.isReactNative = t; + vo.isReactNative = t; function e() { return typeof process < "u" && typeof process.versions < "u" && typeof process.versions.node < "u"; } - yo.isNode = e; + vo.isNode = e; function r() { return !t() && !e(); } - return yo.isBrowser = r, yo; + return vo.isBrowser = r, vo; } (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); const e = jl; - e.__exportStar(TW(), t), e.__exportStar(RW(), t); -})(Q8); -function la(t = 3) { + e.__exportStar(RW(), t), e.__exportStar(DW(), t); +})(X8); +function ua(t = 3) { const e = Date.now() * Math.pow(10, t), r = Math.floor(Math.random() * Math.pow(10, t)); return e + r; } -function ic(t = 6) { - return BigInt(la(t)); +function nc(t = 6) { + return BigInt(ua(t)); } -function ga(t, e, r) { +function da(t, e, r) { return { - id: r || la(), + id: r || ua(), jsonrpc: "2.0", method: t, params: e @@ -17469,59 +17469,59 @@ function np(t, e, r) { return { id: t, jsonrpc: "2.0", - error: DW(e) + error: OW(e) }; } -function DW(t, e) { - return typeof t > "u" ? a3(J8) : (typeof t == "string" && (t = Object.assign(Object.assign({}, a3(ub)), { message: t })), IW(t.code) && (t = CW(t.code)), t); +function OW(t, e) { + return typeof t > "u" ? s3(G8) : (typeof t == "string" && (t = Object.assign(Object.assign({}, s3(ub)), { message: t })), CW(t.code) && (t = TW(t.code)), t); } -let OW = class { -}, NW = class extends OW { +let NW = class { +}, LW = class extends NW { constructor() { super(); } -}, LW = class extends NW { +}, kW = class extends LW { constructor(e) { super(); } }; -const kW = "^https?:", $W = "^wss?:"; -function BW(t) { +const $W = "^https?:", BW = "^wss?:"; +function FW(t) { const e = t.match(new RegExp(/^\w+:/, "gi")); if (!(!e || !e.length)) return e[0]; } -function eE(t, e) { - const r = BW(t); +function Z8(t, e) { + const r = FW(t); return typeof r > "u" ? !1 : new RegExp(e).test(r); } -function f3(t) { - return eE(t, kW); +function c3(t) { + return Z8(t, $W); } -function l3(t) { - return eE(t, $W); +function u3(t) { + return Z8(t, BW); } -function FW(t) { +function jW(t) { return new RegExp("wss?://localhost(:d{2,5})?").test(t); } -function tE(t) { +function Q8(t) { return typeof t == "object" && "id" in t && "jsonrpc" in t && t.jsonrpc === "2.0"; } function fb(t) { - return tE(t) && "method" in t; + return Q8(t) && "method" in t; } function ip(t) { - return tE(t) && (js(t) || Qi(t)); + return Q8(t) && (js(t) || Zi(t)); } function js(t) { return "result" in t; } -function Qi(t) { +function Zi(t) { return "error" in t; } -let cs = class extends LW { +let as = class extends kW { constructor(e) { - super(e), this.events = new ns.EventEmitter(), this.hasRegisteredEventListeners = !1, this.connection = this.setConnection(e), this.connection.connected && this.registerEventListeners(); + super(e), this.events = new rs.EventEmitter(), this.hasRegisteredEventListeners = !1, this.connection = this.setConnection(e), this.connection.connected && this.registerEventListeners(); } async connect(e = this.connection) { await this.open(e); @@ -17542,7 +17542,7 @@ let cs = class extends LW { this.events.removeListener(e, r); } async request(e, r) { - return this.requestStrict(ga(e.method, e.params || [], e.id || ic().toString()), r); + return this.requestStrict(da(e.method, e.params || [], e.id || nc().toString()), r); } async requestStrict(e, r) { return new Promise(async (n, i) => { @@ -17552,7 +17552,7 @@ let cs = class extends LW { i(s); } this.events.on(`${e.id}`, (s) => { - Qi(s) ? i(s.error) : n(s.result); + Zi(s) ? i(s.error) : n(s.result); }); try { await this.connection.send(e, r); @@ -17580,10 +17580,10 @@ let cs = class extends LW { this.hasRegisteredEventListeners || (this.connection.on("payload", (e) => this.onPayload(e)), this.connection.on("close", (e) => this.onClose(e)), this.connection.on("error", (e) => this.events.emit("error", e)), this.connection.on("register_error", (e) => this.onClose()), this.hasRegisteredEventListeners = !0); } }; -const jW = () => typeof WebSocket < "u" ? WebSocket : typeof global < "u" && typeof global.WebSocket < "u" ? global.WebSocket : typeof window < "u" && typeof window.WebSocket < "u" ? window.WebSocket : typeof self < "u" && typeof self.WebSocket < "u" ? self.WebSocket : require("ws"), UW = () => typeof WebSocket < "u" || typeof global < "u" && typeof global.WebSocket < "u" || typeof window < "u" && typeof window.WebSocket < "u" || typeof self < "u" && typeof self.WebSocket < "u", h3 = (t) => t.split("?")[0], d3 = 10, qW = jW(); -let zW = class { +const UW = () => typeof WebSocket < "u" ? WebSocket : typeof global < "u" && typeof global.WebSocket < "u" ? global.WebSocket : typeof window < "u" && typeof window.WebSocket < "u" ? window.WebSocket : typeof self < "u" && typeof self.WebSocket < "u" ? self.WebSocket : require("ws"), qW = () => typeof WebSocket < "u" || typeof global < "u" && typeof global.WebSocket < "u" || typeof window < "u" && typeof window.WebSocket < "u" || typeof self < "u" && typeof self.WebSocket < "u", f3 = (t) => t.split("?")[0], l3 = 10, zW = UW(); +let WW = class { constructor(e) { - if (this.url = e, this.events = new ns.EventEmitter(), this.registering = !1, !l3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); + if (this.url = e, this.events = new rs.EventEmitter(), this.registering = !1, !u3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); this.url = e; } get connected() { @@ -17621,13 +17621,13 @@ let zW = class { async send(e) { typeof this.socket > "u" && (this.socket = await this.register()); try { - this.socket.send(Bo(e)); + this.socket.send($o(e)); } catch (r) { this.onError(e.id, r); } } register(e = this.url) { - if (!l3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); + if (!u3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); if (this.registering) { const r = this.events.getMaxListeners(); return (this.events.listenerCount("register_error") >= r || this.events.listenerCount("open") >= r) && this.events.setMaxListeners(r + 1), new Promise((n, i) => { @@ -17640,8 +17640,8 @@ let zW = class { }); } return this.url = e, this.registering = !0, new Promise((r, n) => { - const i = new URLSearchParams(e).get("origin"), s = Q8.isReactNative() ? { headers: { origin: i } } : { rejectUnauthorized: !FW(e) }, o = new qW(e, [], s); - UW() ? o.onerror = (a) => { + const i = new URLSearchParams(e).get("origin"), s = X8.isReactNative() ? { headers: { origin: i } } : { rejectUnauthorized: !jW(e) }, o = new zW(e, [], s); + qW() ? o.onerror = (a) => { const u = a; n(this.emitError(u.error)); } : o.on("error", (a) => { @@ -17659,7 +17659,7 @@ let zW = class { } onPayload(e) { if (typeof e.data > "u") return; - const r = typeof e.data == "string" ? lc(e.data) : e.data; + const r = typeof e.data == "string" ? fc(e.data) : e.data; this.events.emit("payload", r); } onError(e, r) { @@ -17667,27 +17667,27 @@ let zW = class { this.events.emit("payload", s); } parseError(e, r = this.url) { - return Z8(e, h3(r), "WS"); + return J8(e, f3(r), "WS"); } resetMaxListeners() { - this.events.getMaxListeners() > d3 && this.events.setMaxListeners(d3); + this.events.getMaxListeners() > l3 && this.events.setMaxListeners(l3); } emitError(e) { - const r = this.parseError(new Error((e == null ? void 0 : e.message) || `WebSocket connection failed for host: ${h3(this.url)}`)); + const r = this.parseError(new Error((e == null ? void 0 : e.message) || `WebSocket connection failed for host: ${f3(this.url)}`)); return this.events.emit("register_error", r), r; } }; var l0 = { exports: {} }; l0.exports; (function(t, e) { - var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", u = "[object Array]", l = "[object AsyncFunction]", d = "[object Boolean]", p = "[object Date]", w = "[object Error]", A = "[object Function]", P = "[object GeneratorFunction]", N = "[object Map]", L = "[object Number]", $ = "[object Null]", B = "[object Object]", H = "[object Promise]", W = "[object Proxy]", V = "[object RegExp]", te = "[object Set]", R = "[object String]", K = "[object Symbol]", ge = "[object Undefined]", Ee = "[object WeakMap]", Y = "[object ArrayBuffer]", S = "[object DataView]", m = "[object Float32Array]", f = "[object Float64Array]", g = "[object Int8Array]", b = "[object Int16Array]", x = "[object Int32Array]", _ = "[object Uint8Array]", E = "[object Uint8ClampedArray]", v = "[object Uint16Array]", M = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, F = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, D = {}; - D[m] = D[f] = D[g] = D[b] = D[x] = D[_] = D[E] = D[v] = D[M] = !0, D[a] = D[u] = D[Y] = D[d] = D[S] = D[p] = D[w] = D[A] = D[N] = D[L] = D[B] = D[V] = D[te] = D[R] = D[Ee] = !1; - var oe = typeof gn == "object" && gn && gn.Object === Object && gn, Z = typeof self == "object" && self && self.Object === Object && self, J = oe || Z || Function("return this")(), Q = e && !e.nodeType && e, T = Q && !0 && t && !t.nodeType && t, X = T && T.exports === Q, re = X && oe.process, pe = function() { + var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", u = "[object Array]", l = "[object AsyncFunction]", d = "[object Boolean]", p = "[object Date]", w = "[object Error]", A = "[object Function]", M = "[object GeneratorFunction]", N = "[object Map]", L = "[object Number]", B = "[object Null]", $ = "[object Object]", H = "[object Promise]", W = "[object Proxy]", V = "[object RegExp]", te = "[object Set]", R = "[object String]", K = "[object Symbol]", ge = "[object Undefined]", Ee = "[object WeakMap]", Y = "[object ArrayBuffer]", S = "[object DataView]", m = "[object Float32Array]", f = "[object Float64Array]", g = "[object Int8Array]", b = "[object Int16Array]", x = "[object Int32Array]", _ = "[object Uint8Array]", E = "[object Uint8ClampedArray]", v = "[object Uint16Array]", P = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, F = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, D = {}; + D[m] = D[f] = D[g] = D[b] = D[x] = D[_] = D[E] = D[v] = D[P] = !0, D[a] = D[u] = D[Y] = D[d] = D[S] = D[p] = D[w] = D[A] = D[N] = D[L] = D[$] = D[V] = D[te] = D[R] = D[Ee] = !1; + var oe = typeof gn == "object" && gn && gn.Object === Object && gn, Z = typeof self == "object" && self && self.Object === Object && self, J = oe || Z || Function("return this")(), Q = e && !e.nodeType && e, T = Q && !0 && t && !t.nodeType && t, X = T && T.exports === Q, re = X && oe.process, de = function() { try { return re && re.binding && re.binding("util"); } catch { } - }(), ie = pe && pe.isTypedArray; + }(), ie = de && de.isTypedArray; function ue(ae, ye) { for (var Ge = -1, Pt = ae == null ? 0 : ae.length, jr = 0, nr = []; ++Ge < Pt; ) { var Kr = ae[Ge]; @@ -17744,7 +17744,7 @@ l0.exports; return ae ? "Symbol(src)_1." + ae : ""; }(), tt = _e.toString, Ye = RegExp( "^" + at.call(ke).replace(I, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" - ), dt = X ? J.Buffer : void 0, lt = J.Symbol, ct = J.Uint8Array, qt = _e.propertyIsEnumerable, Jt = qe.splice, Et = lt ? lt.toStringTag : void 0, er = Object.getOwnPropertySymbols, Xt = dt ? dt.isBuffer : void 0, Dt = Ke(Object.keys, Object), kt = yr(J, "DataView"), Ct = yr(J, "Map"), gt = yr(J, "Promise"), Rt = yr(J, "Set"), Nt = yr(J, "WeakMap"), vt = yr(Object, "create"), $t = oo(kt), Ft = oo(Ct), rt = oo(gt), Bt = oo(Rt), k = oo(Nt), U = lt ? lt.prototype : void 0, z = U ? U.valueOf : void 0; + ), dt = X ? J.Buffer : void 0, lt = J.Symbol, ct = J.Uint8Array, qt = _e.propertyIsEnumerable, Yt = qe.splice, Et = lt ? lt.toStringTag : void 0, er = Object.getOwnPropertySymbols, Jt = dt ? dt.isBuffer : void 0, Dt = Ke(Object.keys, Object), kt = yr(J, "DataView"), Ct = yr(J, "Map"), gt = yr(J, "Promise"), Rt = yr(J, "Set"), Nt = yr(J, "WeakMap"), vt = yr(Object, "create"), $t = io(kt), Ft = io(Ct), rt = io(gt), Bt = io(Rt), k = io(Nt), U = lt ? lt.prototype : void 0, z = U ? U.valueOf : void 0; function C(ae) { var ye = -1, Ge = ae == null ? 0 : ae.length; for (this.clear(); ++ye < Ge; ) { @@ -17767,7 +17767,7 @@ l0.exports; } return ke.call(ye, ae) ? ye[ae] : void 0; } - function de(ae) { + function he(ae) { var ye = this.__data__; return vt ? ye[ae] !== void 0 : ke.call(ye, ae); } @@ -17775,7 +17775,7 @@ l0.exports; var Ge = this.__data__; return this.size += this.has(ae) ? 0 : 1, Ge[ae] = vt && ye === void 0 ? n : ye, this; } - C.prototype.clear = G, C.prototype.delete = j, C.prototype.get = se, C.prototype.has = de, C.prototype.set = xe; + C.prototype.clear = G, C.prototype.delete = j, C.prototype.get = se, C.prototype.has = he, C.prototype.set = xe; function Te(ae) { var ye = -1, Ge = ae == null ? 0 : ae.length; for (this.clear(); ++ye < Ge; ) { @@ -17791,7 +17791,7 @@ l0.exports; if (Ge < 0) return !1; var Pt = ye.length - 1; - return Ge == Pt ? ye.pop() : Jt.call(ye, Ge, 1), --this.size, !0; + return Ge == Pt ? ye.pop() : Yt.call(ye, Ge, 1), --this.size, !0; } function je(ae) { var ye = this.__data__, Ge = Je(ye, ae); @@ -17895,30 +17895,30 @@ l0.exports; return Mc(ae) ? Pt : ve(Pt, Ge(ae)); } function zt(ae) { - return ae == null ? ae === void 0 ? ge : $ : Et && Et in Object(ae) ? $r(ae) : Rp(ae); + return ae == null ? ae === void 0 ? ge : B : Et && Et in Object(ae) ? $r(ae) : Rp(ae); } - function Zt(ae) { - return Na(ae) && zt(ae) == a; + function Xt(ae) { + return Da(ae) && zt(ae) == a; } function Wt(ae, ye, Ge, Pt, jr) { - return ae === ye ? !0 : ae == null || ye == null || !Na(ae) && !Na(ye) ? ae !== ae && ye !== ye : he(ae, ye, Ge, Pt, Wt, jr); + return ae === ye ? !0 : ae == null || ye == null || !Da(ae) && !Da(ye) ? ae !== ae && ye !== ye : le(ae, ye, Ge, Pt, Wt, jr); } - function he(ae, ye, Ge, Pt, jr, nr) { + function le(ae, ye, Ge, Pt, jr, nr) { var Kr = Mc(ae), vn = Mc(ye), _r = Kr ? u : Ir(ae), Ur = vn ? u : Ir(ye); - _r = _r == a ? B : _r, Ur = Ur == a ? B : Ur; - var an = _r == B, ui = Ur == B, bn = _r == Ur; + _r = _r == a ? $ : _r, Ur = Ur == a ? $ : Ur; + var an = _r == $, ui = Ur == $, bn = _r == Ur; if (bn && Xu(ae)) { if (!Xu(ye)) return !1; Kr = !0, an = !1; } if (bn && !an) - return nr || (nr = new ut()), Kr || mh(ae) ? Qt(ae, ye, Ge, Pt, jr, nr) : gr(ae, ye, _r, Ge, Pt, jr, nr); + return nr || (nr = new ut()), Kr || mh(ae) ? Zt(ae, ye, Ge, Pt, jr, nr) : gr(ae, ye, _r, Ge, Pt, jr, nr); if (!(Ge & i)) { - var Vr = an && ke.call(ae, "__wrapped__"), ei = ui && ke.call(ye, "__wrapped__"); - if (Vr || ei) { - var fs = Vr ? ae.value() : ae, ji = ei ? ye.value() : ye; - return nr || (nr = new ut()), jr(fs, ji, Ge, Pt, nr); + var Vr = an && ke.call(ae, "__wrapped__"), ti = ui && ke.call(ye, "__wrapped__"); + if (Vr || ti) { + var fs = Vr ? ae.value() : ae, Fi = ti ? ye.value() : ye; + return nr || (nr = new ut()), jr(fs, Fi, Ge, Pt, nr); } } return bn ? (nr || (nr = new ut()), lr(ae, ye, Ge, Pt, jr, nr)) : !1; @@ -17927,10 +17927,10 @@ l0.exports; if (!gh(ae) || on(ae)) return !1; var ye = Ic(ae) ? Ye : F; - return ye.test(oo(ae)); + return ye.test(io(ae)); } function dr(ae) { - return Na(ae) && ph(ae.length) && !!D[zt(ae)]; + return Da(ae) && ph(ae.length) && !!D[zt(ae)]; } function pr(ae) { if (!lh(ae)) @@ -17940,7 +17940,7 @@ l0.exports; ke.call(ae, Ge) && Ge != "constructor" && ye.push(Ge); return ye; } - function Qt(ae, ye, Ge, Pt, jr, nr) { + function Zt(ae, ye, Ge, Pt, jr, nr) { var Kr = Ge & i, vn = ae.length, _r = ye.length; if (vn != _r && !(Kr && _r > vn)) return !1; @@ -17949,9 +17949,9 @@ l0.exports; return Ur == ye; var an = -1, ui = !0, bn = Ge & s ? new xt() : void 0; for (nr.set(ae, ye), nr.set(ye, ae); ++an < vn; ) { - var Vr = ae[an], ei = ye[an]; + var Vr = ae[an], ti = ye[an]; if (Pt) - var fs = Kr ? Pt(ei, Vr, an, ye, ae, nr) : Pt(Vr, ei, an, ae, ye, nr); + var fs = Kr ? Pt(ti, Vr, an, ye, ae, nr) : Pt(Vr, ti, an, ae, ye, nr); if (fs !== void 0) { if (fs) continue; @@ -17959,14 +17959,14 @@ l0.exports; break; } if (bn) { - if (!Pe(ye, function(ji, Is) { - if (!$e(bn, Is) && (Vr === ji || jr(Vr, ji, Ge, Pt, nr))) + if (!Pe(ye, function(Fi, Is) { + if (!$e(bn, Is) && (Vr === Fi || jr(Vr, Fi, Ge, Pt, nr))) return bn.push(Is); })) { ui = !1; break; } - } else if (!(Vr === ei || jr(Vr, ei, Ge, Pt, nr))) { + } else if (!(Vr === ti || jr(Vr, ti, Ge, Pt, nr))) { ui = !1; break; } @@ -18000,7 +18000,7 @@ l0.exports; if (Ur) return Ur == ye; Pt |= s, Kr.set(ae, ye); - var an = Qt(vn(ae), vn(ye), Pt, jr, nr, Kr); + var an = Zt(vn(ae), vn(ye), Pt, jr, nr, Kr); return Kr.delete(ae), an; case K: if (z) @@ -18020,24 +18020,24 @@ l0.exports; var Vr = nr.get(ae); if (Vr && nr.get(ye)) return Vr == ye; - var ei = !0; + var ti = !0; nr.set(ae, ye), nr.set(ye, ae); for (var fs = Kr; ++ui < _r; ) { bn = vn[ui]; - var ji = ae[bn], Is = ye[bn]; + var Fi = ae[bn], Is = ye[bn]; if (Pt) - var Zu = Kr ? Pt(Is, ji, bn, ye, ae, nr) : Pt(ji, Is, bn, ae, ye, nr); - if (!(Zu === void 0 ? ji === Is || jr(ji, Is, Ge, Pt, nr) : Zu)) { - ei = !1; + var Zu = Kr ? Pt(Is, Fi, bn, ye, ae, nr) : Pt(Fi, Is, bn, ae, ye, nr); + if (!(Zu === void 0 ? Fi === Is || jr(Fi, Is, Ge, Pt, nr) : Zu)) { + ti = !1; break; } fs || (fs = bn == "constructor"); } - if (ei && !fs) { - var La = ae.constructor, Pn = ye.constructor; - La != Pn && "constructor" in ae && "constructor" in ye && !(typeof La == "function" && La instanceof La && typeof Pn == "function" && Pn instanceof Pn) && (ei = !1); + if (ti && !fs) { + var Oa = ae.constructor, Pn = ye.constructor; + Oa != Pn && "constructor" in ae && "constructor" in ye && !(typeof Oa == "function" && Oa instanceof Oa && typeof Pn == "function" && Pn instanceof Pn) && (ti = !1); } - return nr.delete(ae), nr.delete(ye), ei; + return nr.delete(ae), nr.delete(ye), ti; } function Rr(ae) { return Lt(ae, Np, Br); @@ -18066,7 +18066,7 @@ l0.exports; })); } : Fr, Ir = zt; (kt && Ir(new kt(new ArrayBuffer(1))) != S || Ct && Ir(new Ct()) != N || gt && Ir(gt.resolve()) != H || Rt && Ir(new Rt()) != te || Nt && Ir(new Nt()) != Ee) && (Ir = function(ae) { - var ye = zt(ae), Ge = ye == B ? ae.constructor : void 0, Pt = Ge ? oo(Ge) : ""; + var ye = zt(ae), Ge = ye == $ ? ae.constructor : void 0, Pt = Ge ? io(Ge) : ""; if (Pt) switch (Pt) { case $t: @@ -18099,7 +18099,7 @@ l0.exports; function Rp(ae) { return tt.call(ae); } - function oo(ae) { + function io(ae) { if (ae != null) { try { return at.call(ae); @@ -18115,15 +18115,15 @@ l0.exports; function hh(ae, ye) { return ae === ye || ae !== ae && ye !== ye; } - var dh = Zt(/* @__PURE__ */ function() { + var dh = Xt(/* @__PURE__ */ function() { return arguments; - }()) ? Zt : function(ae) { - return Na(ae) && ke.call(ae, "callee") && !qt.call(ae, "callee"); + }()) ? Xt : function(ae) { + return Da(ae) && ke.call(ae, "callee") && !qt.call(ae, "callee"); }, Mc = Array.isArray; function Dp(ae) { return ae != null && ph(ae.length) && !Ic(ae); } - var Xu = Xt || Dr; + var Xu = Jt || Dr; function Op(ae, ye) { return Wt(ae, ye); } @@ -18131,7 +18131,7 @@ l0.exports; if (!gh(ae)) return !1; var ye = zt(ae); - return ye == A || ye == P || ye == l || ye == W; + return ye == A || ye == M || ye == l || ye == W; } function ph(ae) { return typeof ae == "number" && ae > -1 && ae % 1 == 0 && ae <= o; @@ -18140,7 +18140,7 @@ l0.exports; var ye = typeof ae; return ae != null && (ye == "object" || ye == "function"); } - function Na(ae) { + function Da(ae) { return ae != null && typeof ae == "object"; } var mh = ie ? Ce(ie) : dr; @@ -18155,9 +18155,9 @@ l0.exports; } t.exports = Op; })(l0, l0.exports); -var WW = l0.exports; -const HW = /* @__PURE__ */ rs(WW), rE = "wc", nE = 2, iE = "core", eo = `${rE}@2:${iE}:`, KW = { logger: "error" }, VW = { database: ":memory:" }, GW = "crypto", p3 = "client_ed25519_seed", YW = mt.ONE_DAY, JW = "keychain", XW = "0.3", ZW = "messages", QW = "0.3", eH = mt.SIX_HOURS, tH = "publisher", sE = "irn", rH = "error", oE = "wss://relay.walletconnect.org", nH = "relayer", si = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", publish: "relayer_publish" }, iH = "_subscription", Gi = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, sH = 0.1, T1 = "2.17.2", zr = { link_mode: "link_mode", relay: "relay" }, oH = "0.3", aH = "WALLETCONNECT_CLIENT_ID", g3 = "WALLETCONNECT_LINK_MODE_APPS", Us = { created: "subscription_created", deleted: "subscription_deleted", sync: "subscription_sync", resubscribed: "subscription_resubscribed" }, cH = "subscription", uH = "0.3", fH = mt.FIVE_SECONDS * 1e3, lH = "pairing", hH = "0.3", Mf = { wc_pairingDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1e3 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1001 } }, wc_pairingPing: { req: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1002 }, res: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1003 } }, unregistered_method: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 } } }, Qa = { create: "pairing_create", expire: "pairing_expire", delete: "pairing_delete", ping: "pairing_ping" }, ms = { created: "history_created", updated: "history_updated", deleted: "history_deleted", sync: "history_sync" }, dH = "history", pH = "0.3", gH = "expirer", Xi = { created: "expirer_created", deleted: "expirer_deleted", expired: "expirer_expired", sync: "expirer_sync" }, mH = "0.3", vH = "verify-api", bH = "https://verify.walletconnect.com", aE = "https://verify.walletconnect.org", Wf = aE, yH = `${Wf}/v3`, wH = [bH, aE], xH = "echo", _H = "https://echo.walletconnect.com", Fs = { pairing_started: "pairing_started", pairing_uri_validation_success: "pairing_uri_validation_success", pairing_uri_not_expired: "pairing_uri_not_expired", store_new_pairing: "store_new_pairing", subscribing_pairing_topic: "subscribing_pairing_topic", subscribe_pairing_topic_success: "subscribe_pairing_topic_success", existing_pairing: "existing_pairing", pairing_not_expired: "pairing_not_expired", emit_inactive_pairing: "emit_inactive_pairing", emit_session_proposal: "emit_session_proposal" }, _o = { no_internet_connection: "no_internet_connection", malformed_pairing_uri: "malformed_pairing_uri", active_pairing_already_exists: "active_pairing_already_exists", subscribe_pairing_topic_failure: "subscribe_pairing_topic_failure", pairing_expired: "pairing_expired", proposal_listener_not_found: "proposal_listener_not_found" }, vs = { session_approve_started: "session_approve_started", session_namespaces_validation_success: "session_namespaces_validation_success", subscribing_session_topic: "subscribing_session_topic", subscribe_session_topic_success: "subscribe_session_topic_success", publishing_session_approve: "publishing_session_approve", session_approve_publish_success: "session_approve_publish_success", store_session: "store_session", publishing_session_settle: "publishing_session_settle", session_settle_publish_success: "session_settle_publish_success" }, Va = { no_internet_connection: "no_internet_connection", proposal_expired: "proposal_expired", subscribe_session_topic_failure: "subscribe_session_topic_failure", session_approve_publish_failure: "session_approve_publish_failure", session_settle_publish_failure: "session_settle_publish_failure", session_approve_namespace_validation_failure: "session_approve_namespace_validation_failure", proposal_not_found: "proposal_not_found" }, Ga = { authenticated_session_approve_started: "authenticated_session_approve_started", create_authenticated_session_topic: "create_authenticated_session_topic", cacaos_verified: "cacaos_verified", store_authenticated_session: "store_authenticated_session", subscribing_authenticated_session_topic: "subscribing_authenticated_session_topic", subscribe_authenticated_session_topic_success: "subscribe_authenticated_session_topic_success", publishing_authenticated_session_approve: "publishing_authenticated_session_approve" }, If = { no_internet_connection: "no_internet_connection", invalid_cacao: "invalid_cacao", subscribe_authenticated_session_topic_failure: "subscribe_authenticated_session_topic_failure", authenticated_session_approve_publish_failure: "authenticated_session_approve_publish_failure", authenticated_session_pending_request_not_found: "authenticated_session_pending_request_not_found" }, EH = 0.1, SH = "event-client", AH = 86400, PH = "https://pulse.walletconnect.org/batch"; -function MH(t, e) { +var HW = l0.exports; +const KW = /* @__PURE__ */ ts(HW), eE = "wc", tE = 2, rE = "core", Qs = `${eE}@2:${rE}:`, VW = { logger: "error" }, GW = { database: ":memory:" }, YW = "crypto", h3 = "client_ed25519_seed", JW = mt.ONE_DAY, XW = "keychain", ZW = "0.3", QW = "messages", eH = "0.3", tH = mt.SIX_HOURS, rH = "publisher", nE = "irn", nH = "error", iE = "wss://relay.walletconnect.org", iH = "relayer", oi = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", publish: "relayer_publish" }, sH = "_subscription", Vi = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, oH = 0.1, T1 = "2.17.2", zr = { link_mode: "link_mode", relay: "relay" }, aH = "0.3", cH = "WALLETCONNECT_CLIENT_ID", d3 = "WALLETCONNECT_LINK_MODE_APPS", Us = { created: "subscription_created", deleted: "subscription_deleted", sync: "subscription_sync", resubscribed: "subscription_resubscribed" }, uH = "subscription", fH = "0.3", lH = mt.FIVE_SECONDS * 1e3, hH = "pairing", dH = "0.3", Mf = { wc_pairingDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1e3 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1001 } }, wc_pairingPing: { req: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1002 }, res: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1003 } }, unregistered_method: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 } } }, Za = { create: "pairing_create", expire: "pairing_expire", delete: "pairing_delete", ping: "pairing_ping" }, ms = { created: "history_created", updated: "history_updated", deleted: "history_deleted", sync: "history_sync" }, pH = "history", gH = "0.3", mH = "expirer", Ji = { created: "expirer_created", deleted: "expirer_deleted", expired: "expirer_expired", sync: "expirer_sync" }, vH = "0.3", bH = "verify-api", yH = "https://verify.walletconnect.com", sE = "https://verify.walletconnect.org", Wf = sE, wH = `${Wf}/v3`, xH = [yH, sE], _H = "echo", EH = "https://echo.walletconnect.com", Fs = { pairing_started: "pairing_started", pairing_uri_validation_success: "pairing_uri_validation_success", pairing_uri_not_expired: "pairing_uri_not_expired", store_new_pairing: "store_new_pairing", subscribing_pairing_topic: "subscribing_pairing_topic", subscribe_pairing_topic_success: "subscribe_pairing_topic_success", existing_pairing: "existing_pairing", pairing_not_expired: "pairing_not_expired", emit_inactive_pairing: "emit_inactive_pairing", emit_session_proposal: "emit_session_proposal" }, wo = { no_internet_connection: "no_internet_connection", malformed_pairing_uri: "malformed_pairing_uri", active_pairing_already_exists: "active_pairing_already_exists", subscribe_pairing_topic_failure: "subscribe_pairing_topic_failure", pairing_expired: "pairing_expired", proposal_listener_not_found: "proposal_listener_not_found" }, vs = { session_approve_started: "session_approve_started", session_namespaces_validation_success: "session_namespaces_validation_success", subscribing_session_topic: "subscribing_session_topic", subscribe_session_topic_success: "subscribe_session_topic_success", publishing_session_approve: "publishing_session_approve", session_approve_publish_success: "session_approve_publish_success", store_session: "store_session", publishing_session_settle: "publishing_session_settle", session_settle_publish_success: "session_settle_publish_success" }, Ha = { no_internet_connection: "no_internet_connection", proposal_expired: "proposal_expired", subscribe_session_topic_failure: "subscribe_session_topic_failure", session_approve_publish_failure: "session_approve_publish_failure", session_settle_publish_failure: "session_settle_publish_failure", session_approve_namespace_validation_failure: "session_approve_namespace_validation_failure", proposal_not_found: "proposal_not_found" }, Ka = { authenticated_session_approve_started: "authenticated_session_approve_started", create_authenticated_session_topic: "create_authenticated_session_topic", cacaos_verified: "cacaos_verified", store_authenticated_session: "store_authenticated_session", subscribing_authenticated_session_topic: "subscribing_authenticated_session_topic", subscribe_authenticated_session_topic_success: "subscribe_authenticated_session_topic_success", publishing_authenticated_session_approve: "publishing_authenticated_session_approve" }, If = { no_internet_connection: "no_internet_connection", invalid_cacao: "invalid_cacao", subscribe_authenticated_session_topic_failure: "subscribe_authenticated_session_topic_failure", authenticated_session_approve_publish_failure: "authenticated_session_approve_publish_failure", authenticated_session_pending_request_not_found: "authenticated_session_pending_request_not_found" }, SH = 0.1, AH = "event-client", PH = 86400, MH = "https://pulse.walletconnect.org/batch"; +function IH(t, e) { if (t.length >= 255) throw new TypeError("Alphabet too long"); for (var r = new Uint8Array(256), n = 0; n < r.length; n++) r[n] = 255; for (var i = 0; i < t.length; i++) { @@ -18166,54 +18166,54 @@ function MH(t, e) { r[o] = i; } var a = t.length, u = t.charAt(0), l = Math.log(a) / Math.log(256), d = Math.log(256) / Math.log(a); - function p(P) { - if (P instanceof Uint8Array || (ArrayBuffer.isView(P) ? P = new Uint8Array(P.buffer, P.byteOffset, P.byteLength) : Array.isArray(P) && (P = Uint8Array.from(P))), !(P instanceof Uint8Array)) throw new TypeError("Expected Uint8Array"); - if (P.length === 0) return ""; - for (var N = 0, L = 0, $ = 0, B = P.length; $ !== B && P[$] === 0; ) $++, N++; - for (var H = (B - $) * d + 1 >>> 0, W = new Uint8Array(H); $ !== B; ) { - for (var V = P[$], te = 0, R = H - 1; (V !== 0 || te < L) && R !== -1; R--, te++) V += 256 * W[R] >>> 0, W[R] = V % a >>> 0, V = V / a >>> 0; + function p(M) { + if (M instanceof Uint8Array || (ArrayBuffer.isView(M) ? M = new Uint8Array(M.buffer, M.byteOffset, M.byteLength) : Array.isArray(M) && (M = Uint8Array.from(M))), !(M instanceof Uint8Array)) throw new TypeError("Expected Uint8Array"); + if (M.length === 0) return ""; + for (var N = 0, L = 0, B = 0, $ = M.length; B !== $ && M[B] === 0; ) B++, N++; + for (var H = ($ - B) * d + 1 >>> 0, W = new Uint8Array(H); B !== $; ) { + for (var V = M[B], te = 0, R = H - 1; (V !== 0 || te < L) && R !== -1; R--, te++) V += 256 * W[R] >>> 0, W[R] = V % a >>> 0, V = V / a >>> 0; if (V !== 0) throw new Error("Non-zero carry"); - L = te, $++; + L = te, B++; } for (var K = H - L; K !== H && W[K] === 0; ) K++; for (var ge = u.repeat(N); K < H; ++K) ge += t.charAt(W[K]); return ge; } - function w(P) { - if (typeof P != "string") throw new TypeError("Expected String"); - if (P.length === 0) return new Uint8Array(); + function w(M) { + if (typeof M != "string") throw new TypeError("Expected String"); + if (M.length === 0) return new Uint8Array(); var N = 0; - if (P[N] !== " ") { - for (var L = 0, $ = 0; P[N] === u; ) L++, N++; - for (var B = (P.length - N) * l + 1 >>> 0, H = new Uint8Array(B); P[N]; ) { - var W = r[P.charCodeAt(N)]; + if (M[N] !== " ") { + for (var L = 0, B = 0; M[N] === u; ) L++, N++; + for (var $ = (M.length - N) * l + 1 >>> 0, H = new Uint8Array($); M[N]; ) { + var W = r[M.charCodeAt(N)]; if (W === 255) return; - for (var V = 0, te = B - 1; (W !== 0 || V < $) && te !== -1; te--, V++) W += a * H[te] >>> 0, H[te] = W % 256 >>> 0, W = W / 256 >>> 0; + for (var V = 0, te = $ - 1; (W !== 0 || V < B) && te !== -1; te--, V++) W += a * H[te] >>> 0, H[te] = W % 256 >>> 0, W = W / 256 >>> 0; if (W !== 0) throw new Error("Non-zero carry"); - $ = V, N++; + B = V, N++; } - if (P[N] !== " ") { - for (var R = B - $; R !== B && H[R] === 0; ) R++; - for (var K = new Uint8Array(L + (B - R)), ge = L; R !== B; ) K[ge++] = H[R++]; + if (M[N] !== " ") { + for (var R = $ - B; R !== $ && H[R] === 0; ) R++; + for (var K = new Uint8Array(L + ($ - R)), ge = L; R !== $; ) K[ge++] = H[R++]; return K; } } } - function A(P) { - var N = w(P); + function A(M) { + var N = w(M); if (N) return N; throw new Error(`Non-${e} character`); } return { encode: p, decodeUnsafe: w, decode: A }; } -var IH = MH, CH = IH; -const cE = (t) => { +var CH = IH, TH = CH; +const oE = (t) => { if (t instanceof Uint8Array && t.constructor.name === "Uint8Array") return t; if (t instanceof ArrayBuffer) return new Uint8Array(t); if (ArrayBuffer.isView(t)) return new Uint8Array(t.buffer, t.byteOffset, t.byteLength); throw new Error("Unknown type, must be binary type"); -}, TH = (t) => new TextEncoder().encode(t), RH = (t) => new TextDecoder().decode(t); -class DH { +}, RH = (t) => new TextEncoder().encode(t), DH = (t) => new TextDecoder().decode(t); +class OH { constructor(e, r, n) { this.name = e, this.prefix = r, this.baseEncode = n; } @@ -18222,7 +18222,7 @@ class DH { throw Error("Unknown type, must be binary type"); } } -class OH { +class NH { constructor(e, r, n) { if (this.name = e, this.prefix = r, r.codePointAt(0) === void 0) throw new Error("Invalid prefix character"); this.prefixCodePoint = r.codePointAt(0), this.baseDecode = n; @@ -18234,15 +18234,15 @@ class OH { } else throw Error("Can only multibase decode strings"); } or(e) { - return uE(this, e); + return aE(this, e); } } -class NH { +class LH { constructor(e) { this.decoders = e; } or(e) { - return uE(this, e); + return aE(this, e); } decode(e) { const r = e[0], n = this.decoders[r]; @@ -18250,10 +18250,10 @@ class NH { throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`); } } -const uE = (t, e) => new NH({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); -class LH { +const aE = (t, e) => new LH({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); +class kH { constructor(e, r, n, i) { - this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new DH(e, r, n), this.decoder = new OH(e, r, i); + this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new OH(e, r, n), this.decoder = new NH(e, r, i); } encode(e) { return this.encoder.encode(e); @@ -18262,10 +18262,10 @@ class LH { return this.decoder.decode(e); } } -const sp = ({ name: t, prefix: e, encode: r, decode: n }) => new LH(t, e, r, n), rh = ({ prefix: t, name: e, alphabet: r }) => { - const { encode: n, decode: i } = CH(r, e); - return sp({ prefix: t, name: e, encode: n, decode: (s) => cE(i(s)) }); -}, kH = (t, e, r, n) => { +const sp = ({ name: t, prefix: e, encode: r, decode: n }) => new kH(t, e, r, n), rh = ({ prefix: t, name: e, alphabet: r }) => { + const { encode: n, decode: i } = TH(r, e); + return sp({ prefix: t, name: e, encode: n, decode: (s) => oE(i(s)) }); +}, $H = (t, e, r, n) => { const i = {}; for (let d = 0; d < e.length; ++d) i[e[d]] = d; let s = t.length; @@ -18279,78 +18279,78 @@ const sp = ({ name: t, prefix: e, encode: r, decode: n }) => new LH(t, e, r, n), } if (a >= r || 255 & u << 8 - a) throw new SyntaxError("Unexpected end of data"); return o; -}, $H = (t, e, r) => { +}, BH = (t, e, r) => { const n = e[e.length - 1] === "=", i = (1 << r) - 1; let s = "", o = 0, a = 0; for (let u = 0; u < t.length; ++u) for (a = a << 8 | t[u], o += 8; o > r; ) o -= r, s += e[i & a >> o]; if (o && (s += e[i & a << r - o]), n) for (; s.length * r & 7; ) s += "="; return s; -}, Hn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => sp({ prefix: e, name: t, encode(i) { - return $H(i, n, r); +}, Kn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => sp({ prefix: e, name: t, encode(i) { + return BH(i, n, r); }, decode(i) { - return kH(i, n, r, t); -} }), BH = sp({ prefix: "\0", name: "identity", encode: (t) => RH(t), decode: (t) => TH(t) }); -var FH = Object.freeze({ __proto__: null, identity: BH }); -const jH = Hn({ prefix: "0", name: "base2", alphabet: "01", bitsPerChar: 1 }); -var UH = Object.freeze({ __proto__: null, base2: jH }); -const qH = Hn({ prefix: "7", name: "base8", alphabet: "01234567", bitsPerChar: 3 }); -var zH = Object.freeze({ __proto__: null, base8: qH }); -const WH = rh({ prefix: "9", name: "base10", alphabet: "0123456789" }); -var HH = Object.freeze({ __proto__: null, base10: WH }); -const KH = Hn({ prefix: "f", name: "base16", alphabet: "0123456789abcdef", bitsPerChar: 4 }), VH = Hn({ prefix: "F", name: "base16upper", alphabet: "0123456789ABCDEF", bitsPerChar: 4 }); -var GH = Object.freeze({ __proto__: null, base16: KH, base16upper: VH }); -const YH = Hn({ prefix: "b", name: "base32", alphabet: "abcdefghijklmnopqrstuvwxyz234567", bitsPerChar: 5 }), JH = Hn({ prefix: "B", name: "base32upper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", bitsPerChar: 5 }), XH = Hn({ prefix: "c", name: "base32pad", alphabet: "abcdefghijklmnopqrstuvwxyz234567=", bitsPerChar: 5 }), ZH = Hn({ prefix: "C", name: "base32padupper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", bitsPerChar: 5 }), QH = Hn({ prefix: "v", name: "base32hex", alphabet: "0123456789abcdefghijklmnopqrstuv", bitsPerChar: 5 }), eK = Hn({ prefix: "V", name: "base32hexupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", bitsPerChar: 5 }), tK = Hn({ prefix: "t", name: "base32hexpad", alphabet: "0123456789abcdefghijklmnopqrstuv=", bitsPerChar: 5 }), rK = Hn({ prefix: "T", name: "base32hexpadupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=", bitsPerChar: 5 }), nK = Hn({ prefix: "h", name: "base32z", alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769", bitsPerChar: 5 }); -var iK = Object.freeze({ __proto__: null, base32: YH, base32upper: JH, base32pad: XH, base32padupper: ZH, base32hex: QH, base32hexupper: eK, base32hexpad: tK, base32hexpadupper: rK, base32z: nK }); -const sK = rh({ prefix: "k", name: "base36", alphabet: "0123456789abcdefghijklmnopqrstuvwxyz" }), oK = rh({ prefix: "K", name: "base36upper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" }); -var aK = Object.freeze({ __proto__: null, base36: sK, base36upper: oK }); -const cK = rh({ name: "base58btc", prefix: "z", alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" }), uK = rh({ name: "base58flickr", prefix: "Z", alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" }); -var fK = Object.freeze({ __proto__: null, base58btc: cK, base58flickr: uK }); -const lK = Hn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 }), hK = Hn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 }), dK = Hn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 }), pK = Hn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", bitsPerChar: 6 }); -var gK = Object.freeze({ __proto__: null, base64: lK, base64pad: hK, base64url: dK, base64urlpad: pK }); -const fE = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), mK = fE.reduce((t, e, r) => (t[r] = e, t), []), vK = fE.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); -function bK(t) { - return t.reduce((e, r) => (e += mK[r], e), ""); -} + return $H(i, n, r, t); +} }), FH = sp({ prefix: "\0", name: "identity", encode: (t) => DH(t), decode: (t) => RH(t) }); +var jH = Object.freeze({ __proto__: null, identity: FH }); +const UH = Kn({ prefix: "0", name: "base2", alphabet: "01", bitsPerChar: 1 }); +var qH = Object.freeze({ __proto__: null, base2: UH }); +const zH = Kn({ prefix: "7", name: "base8", alphabet: "01234567", bitsPerChar: 3 }); +var WH = Object.freeze({ __proto__: null, base8: zH }); +const HH = rh({ prefix: "9", name: "base10", alphabet: "0123456789" }); +var KH = Object.freeze({ __proto__: null, base10: HH }); +const VH = Kn({ prefix: "f", name: "base16", alphabet: "0123456789abcdef", bitsPerChar: 4 }), GH = Kn({ prefix: "F", name: "base16upper", alphabet: "0123456789ABCDEF", bitsPerChar: 4 }); +var YH = Object.freeze({ __proto__: null, base16: VH, base16upper: GH }); +const JH = Kn({ prefix: "b", name: "base32", alphabet: "abcdefghijklmnopqrstuvwxyz234567", bitsPerChar: 5 }), XH = Kn({ prefix: "B", name: "base32upper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", bitsPerChar: 5 }), ZH = Kn({ prefix: "c", name: "base32pad", alphabet: "abcdefghijklmnopqrstuvwxyz234567=", bitsPerChar: 5 }), QH = Kn({ prefix: "C", name: "base32padupper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", bitsPerChar: 5 }), eK = Kn({ prefix: "v", name: "base32hex", alphabet: "0123456789abcdefghijklmnopqrstuv", bitsPerChar: 5 }), tK = Kn({ prefix: "V", name: "base32hexupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", bitsPerChar: 5 }), rK = Kn({ prefix: "t", name: "base32hexpad", alphabet: "0123456789abcdefghijklmnopqrstuv=", bitsPerChar: 5 }), nK = Kn({ prefix: "T", name: "base32hexpadupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=", bitsPerChar: 5 }), iK = Kn({ prefix: "h", name: "base32z", alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769", bitsPerChar: 5 }); +var sK = Object.freeze({ __proto__: null, base32: JH, base32upper: XH, base32pad: ZH, base32padupper: QH, base32hex: eK, base32hexupper: tK, base32hexpad: rK, base32hexpadupper: nK, base32z: iK }); +const oK = rh({ prefix: "k", name: "base36", alphabet: "0123456789abcdefghijklmnopqrstuvwxyz" }), aK = rh({ prefix: "K", name: "base36upper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" }); +var cK = Object.freeze({ __proto__: null, base36: oK, base36upper: aK }); +const uK = rh({ name: "base58btc", prefix: "z", alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" }), fK = rh({ name: "base58flickr", prefix: "Z", alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" }); +var lK = Object.freeze({ __proto__: null, base58btc: uK, base58flickr: fK }); +const hK = Kn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 }), dK = Kn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 }), pK = Kn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 }), gK = Kn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", bitsPerChar: 6 }); +var mK = Object.freeze({ __proto__: null, base64: hK, base64pad: dK, base64url: pK, base64urlpad: gK }); +const cE = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), vK = cE.reduce((t, e, r) => (t[r] = e, t), []), bK = cE.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); function yK(t) { + return t.reduce((e, r) => (e += vK[r], e), ""); +} +function wK(t) { const e = []; for (const r of t) { - const n = vK[r.codePointAt(0)]; + const n = bK[r.codePointAt(0)]; if (n === void 0) throw new Error(`Non-base256emoji character: ${r}`); e.push(n); } return new Uint8Array(e); } -const wK = sp({ prefix: "🚀", name: "base256emoji", encode: bK, decode: yK }); -var xK = Object.freeze({ __proto__: null, base256emoji: wK }), _K = lE, m3 = 128, EK = 127, SK = ~EK, AK = Math.pow(2, 31); -function lE(t, e, r) { +const xK = sp({ prefix: "🚀", name: "base256emoji", encode: yK, decode: wK }); +var _K = Object.freeze({ __proto__: null, base256emoji: xK }), EK = uE, p3 = 128, SK = 127, AK = ~SK, PK = Math.pow(2, 31); +function uE(t, e, r) { e = e || [], r = r || 0; - for (var n = r; t >= AK; ) e[r++] = t & 255 | m3, t /= 128; - for (; t & SK; ) e[r++] = t & 255 | m3, t >>>= 7; - return e[r] = t | 0, lE.bytes = r - n + 1, e; + for (var n = r; t >= PK; ) e[r++] = t & 255 | p3, t /= 128; + for (; t & AK; ) e[r++] = t & 255 | p3, t >>>= 7; + return e[r] = t | 0, uE.bytes = r - n + 1, e; } -var PK = R1, MK = 128, v3 = 127; +var MK = R1, IK = 128, g3 = 127; function R1(t, n) { var r = 0, n = n || 0, i = 0, s = n, o, a = t.length; do { if (s >= a) throw R1.bytes = 0, new RangeError("Could not decode varint"); - o = t[s++], r += i < 28 ? (o & v3) << i : (o & v3) * Math.pow(2, i), i += 7; - } while (o >= MK); + o = t[s++], r += i < 28 ? (o & g3) << i : (o & g3) * Math.pow(2, i), i += 7; + } while (o >= IK); return R1.bytes = s - n, r; } -var IK = Math.pow(2, 7), CK = Math.pow(2, 14), TK = Math.pow(2, 21), RK = Math.pow(2, 28), DK = Math.pow(2, 35), OK = Math.pow(2, 42), NK = Math.pow(2, 49), LK = Math.pow(2, 56), kK = Math.pow(2, 63), $K = function(t) { - return t < IK ? 1 : t < CK ? 2 : t < TK ? 3 : t < RK ? 4 : t < DK ? 5 : t < OK ? 6 : t < NK ? 7 : t < LK ? 8 : t < kK ? 9 : 10; -}, BK = { encode: _K, decode: PK, encodingLength: $K }, hE = BK; -const b3 = (t, e, r = 0) => (hE.encode(t, e, r), e), y3 = (t) => hE.encodingLength(t), D1 = (t, e) => { - const r = e.byteLength, n = y3(t), i = n + y3(r), s = new Uint8Array(i + r); - return b3(t, s, 0), b3(r, s, n), s.set(e, i), new FK(t, r, e, s); +var CK = Math.pow(2, 7), TK = Math.pow(2, 14), RK = Math.pow(2, 21), DK = Math.pow(2, 28), OK = Math.pow(2, 35), NK = Math.pow(2, 42), LK = Math.pow(2, 49), kK = Math.pow(2, 56), $K = Math.pow(2, 63), BK = function(t) { + return t < CK ? 1 : t < TK ? 2 : t < RK ? 3 : t < DK ? 4 : t < OK ? 5 : t < NK ? 6 : t < LK ? 7 : t < kK ? 8 : t < $K ? 9 : 10; +}, FK = { encode: EK, decode: MK, encodingLength: BK }, fE = FK; +const m3 = (t, e, r = 0) => (fE.encode(t, e, r), e), v3 = (t) => fE.encodingLength(t), D1 = (t, e) => { + const r = e.byteLength, n = v3(t), i = n + v3(r), s = new Uint8Array(i + r); + return m3(t, s, 0), m3(r, s, n), s.set(e, i), new jK(t, r, e, s); }; -class FK { +class jK { constructor(e, r, n, i) { this.code = e, this.size = r, this.digest = n, this.bytes = i; } } -const dE = ({ name: t, code: e, encode: r }) => new jK(t, e, r); -class jK { +const lE = ({ name: t, code: e, encode: r }) => new UK(t, e, r); +class UK { constructor(e, r, n) { this.name = e, this.code = r, this.encode = n; } @@ -18361,37 +18361,37 @@ class jK { } else throw Error("Unknown type, must be binary type"); } } -const pE = (t) => async (e) => new Uint8Array(await crypto.subtle.digest(t, e)), UK = dE({ name: "sha2-256", code: 18, encode: pE("SHA-256") }), qK = dE({ name: "sha2-512", code: 19, encode: pE("SHA-512") }); -var zK = Object.freeze({ __proto__: null, sha256: UK, sha512: qK }); -const gE = 0, WK = "identity", mE = cE, HK = (t) => D1(gE, mE(t)), KK = { code: gE, name: WK, encode: mE, digest: HK }; -var VK = Object.freeze({ __proto__: null, identity: KK }); +const hE = (t) => async (e) => new Uint8Array(await crypto.subtle.digest(t, e)), qK = lE({ name: "sha2-256", code: 18, encode: hE("SHA-256") }), zK = lE({ name: "sha2-512", code: 19, encode: hE("SHA-512") }); +var WK = Object.freeze({ __proto__: null, sha256: qK, sha512: zK }); +const dE = 0, HK = "identity", pE = oE, KK = (t) => D1(dE, pE(t)), VK = { code: dE, name: HK, encode: pE, digest: KK }; +var GK = Object.freeze({ __proto__: null, identity: VK }); new TextEncoder(), new TextDecoder(); -const w3 = { ...FH, ...UH, ...zH, ...HH, ...GH, ...iK, ...aK, ...fK, ...gK, ...xK }; -({ ...zK, ...VK }); -function GK(t = 0) { +const b3 = { ...jH, ...qH, ...WH, ...KH, ...YH, ...sK, ...cK, ...lK, ...mK, ..._K }; +({ ...WK, ...GK }); +function YK(t = 0) { return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); } -function vE(t, e, r, n) { +function gE(t, e, r, n) { return { name: t, prefix: e, encoder: { name: t, prefix: e, encode: r }, decoder: { decode: n } }; } -const x3 = vE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), pm = vE("ascii", "a", (t) => { +const y3 = gE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), pm = gE("ascii", "a", (t) => { let e = "a"; for (let r = 0; r < t.length; r++) e += String.fromCharCode(t[r]); return e; }, (t) => { t = t.substring(1); - const e = GK(t.length); + const e = YK(t.length); for (let r = 0; r < t.length; r++) e[r] = t.charCodeAt(r); return e; -}), YK = { utf8: x3, "utf-8": x3, hex: w3.base16, latin1: pm, ascii: pm, binary: pm, ...w3 }; -function JK(t, e = "utf8") { - const r = YK[e]; +}), JK = { utf8: y3, "utf-8": y3, hex: b3.base16, latin1: pm, ascii: pm, binary: pm, ...b3 }; +function XK(t, e = "utf8") { + const r = JK[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t, "utf8") : r.decoder.decode(`${r.prefix}${t}`); } -let XK = class { +let ZK = class { constructor(e, r) { - this.core = e, this.logger = r, this.keychain = /* @__PURE__ */ new Map(), this.name = JW, this.version = XW, this.initialized = !1, this.storagePrefix = eo, this.init = async () => { + this.core = e, this.logger = r, this.keychain = /* @__PURE__ */ new Map(), this.name = XW, this.version = ZW, this.initialized = !1, this.storagePrefix = Qs, this.init = async () => { if (!this.initialized) { const n = await this.getKeyChain(); typeof n < "u" && (this.keychain = n), this.initialized = !0; @@ -18411,17 +18411,17 @@ let XK = class { }, this.core = e, this.logger = ci(r, this.name); } get context() { - return Si(this.logger); + return Ai(this.logger); } get storageKey() { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; } async setKeyChain(e) { - await this.core.storage.setItem(this.storageKey, k8(e)); + await this.core.storage.setItem(this.storageKey, N8(e)); } async getKeyChain() { const e = await this.core.storage.getItem(this.storageKey); - return typeof e < "u" ? $8(e) : void 0; + return typeof e < "u" ? L8(e) : void 0; } async persist() { await this.setKeyChain(this.keychain); @@ -18432,25 +18432,25 @@ let XK = class { throw new Error(e); } } -}, ZK = class { +}, QK = class { constructor(e, r, n) { - this.core = e, this.logger = r, this.name = GW, this.randomSessionIdentifier = I1(), this.initialized = !1, this.init = async () => { + this.core = e, this.logger = r, this.name = YW, this.randomSessionIdentifier = I1(), this.initialized = !1, this.init = async () => { this.initialized || (await this.keychain.init(), this.initialized = !0); }, this.hasKeys = (i) => (this.isInitialized(), this.keychain.has(i)), this.getClientId = async () => { this.isInitialized(); - const i = await this.getClientSeed(), s = ox(i); - return q4(s.publicKey); + const i = await this.getClientSeed(), s = ix(i); + return j4(s.publicKey); }, this.generateKeyPair = () => { this.isInitialized(); - const i = xz(); + const i = _z(); return this.setPrivateKey(i.publicKey, i.privateKey); }, this.signJWT = async (i) => { this.isInitialized(); - const s = await this.getClientSeed(), o = ox(s), a = this.randomSessionIdentifier; - return await WB(a, i, YW, o); + const s = await this.getClientSeed(), o = ix(s), a = this.randomSessionIdentifier; + return await HB(a, i, JW, o); }, this.generateSharedKey = (i, s, o) => { this.isInitialized(); - const a = this.getPrivateKey(i), u = _z(a, s); + const a = this.getPrivateKey(i), u = Ez(a, s); return this.setSymKey(u, o); }, this.setSymKey = async (i, s) => { this.isInitialized(); @@ -18462,41 +18462,41 @@ let XK = class { this.isInitialized(), await this.keychain.del(i); }, this.encode = async (i, s, o) => { this.isInitialized(); - const a = V8(o), u = Bo(s); - if (Yx(a)) return Sz(u, o == null ? void 0 : o.encoding); - if (Gx(a)) { + const a = H8(o), u = $o(s); + if (Vx(a)) return Az(u, o == null ? void 0 : o.encoding); + if (Kx(a)) { const w = a.senderPublicKey, A = a.receiverPublicKey; i = await this.generateSharedKey(w, A); } const l = this.getSymKey(i), { type: d, senderPublicKey: p } = a; - return Ez({ type: d, symKey: l, message: u, senderPublicKey: p, encoding: o == null ? void 0 : o.encoding }); + return Sz({ type: d, symKey: l, message: u, senderPublicKey: p, encoding: o == null ? void 0 : o.encoding }); }, this.decode = async (i, s, o) => { this.isInitialized(); - const a = Mz(s, o); - if (Yx(a)) { - const u = Pz(s, o == null ? void 0 : o.encoding); - return lc(u); + const a = Iz(s, o); + if (Vx(a)) { + const u = Mz(s, o == null ? void 0 : o.encoding); + return fc(u); } - if (Gx(a)) { + if (Kx(a)) { const u = a.receiverPublicKey, l = a.senderPublicKey; i = await this.generateSharedKey(u, l); } try { - const u = this.getSymKey(i), l = Az({ symKey: u, encoded: s, encoding: o == null ? void 0 : o.encoding }); - return lc(l); + const u = this.getSymKey(i), l = Pz({ symKey: u, encoded: s, encoding: o == null ? void 0 : o.encoding }); + return fc(l); } catch (u) { this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`), this.logger.error(u); } - }, this.getPayloadType = (i, s = pa) => { + }, this.getPayloadType = (i, s = ha) => { const o = El({ encoded: i, encoding: s }); - return pc(o.type); - }, this.getPayloadSenderPublicKey = (i, s = pa) => { + return dc(o.type); + }, this.getPayloadSenderPublicKey = (i, s = ha) => { const o = El({ encoded: i, encoding: s }); return o.senderPublicKey ? On(o.senderPublicKey, ai) : void 0; - }, this.core = e, this.logger = ci(r, this.name), this.keychain = n || new XK(this.core, this.logger); + }, this.core = e, this.logger = ci(r, this.name), this.keychain = n || new ZK(this.core, this.logger); } get context() { - return Si(this.logger); + return Ai(this.logger); } async setPrivateKey(e, r) { return await this.keychain.set(e, r), e; @@ -18507,11 +18507,11 @@ let XK = class { async getClientSeed() { let e = ""; try { - e = this.keychain.get(p3); + e = this.keychain.get(h3); } catch { - e = I1(), await this.keychain.set(p3, e); + e = I1(), await this.keychain.set(h3, e); } - return JK(e, "base16"); + return XK(e, "base16"); } getSymKey(e) { return this.keychain.get(e); @@ -18523,9 +18523,9 @@ let XK = class { } } }; -class QK extends Jk { +class eV extends Xk { constructor(e, r) { - super(e, r), this.logger = e, this.core = r, this.messages = /* @__PURE__ */ new Map(), this.name = ZW, this.version = QW, this.initialized = !1, this.storagePrefix = eo, this.init = async () => { + super(e, r), this.logger = e, this.core = r, this.messages = /* @__PURE__ */ new Map(), this.name = QW, this.version = eH, this.initialized = !1, this.storagePrefix = Qs, this.init = async () => { if (!this.initialized) { this.logger.trace("Initialized"); try { @@ -18539,7 +18539,7 @@ class QK extends Jk { } }, this.set = async (n, i) => { this.isInitialized(); - const s = Eo(i); + const s = xo(i); let o = this.messages.get(n); return typeof o > "u" && (o = {}), typeof o[s] < "u" || (o[s] = i, this.messages.set(n, o), await this.persist()), s; }, this.get = (n) => { @@ -18548,24 +18548,24 @@ class QK extends Jk { return typeof i > "u" && (i = {}), i; }, this.has = (n, i) => { this.isInitialized(); - const s = this.get(n), o = Eo(i); + const s = this.get(n), o = xo(i); return typeof s[o] < "u"; }, this.del = async (n) => { this.isInitialized(), this.messages.delete(n), await this.persist(); }, this.logger = ci(e, this.name), this.core = r; } get context() { - return Si(this.logger); + return Ai(this.logger); } get storageKey() { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; } async setRelayerMessages(e) { - await this.core.storage.setItem(this.storageKey, k8(e)); + await this.core.storage.setItem(this.storageKey, N8(e)); } async getRelayerMessages() { const e = await this.core.storage.getItem(this.storageKey); - return typeof e < "u" ? $8(e) : void 0; + return typeof e < "u" ? L8(e) : void 0; } async persist() { await this.setRelayerMessages(this.messages); @@ -18577,21 +18577,21 @@ class QK extends Jk { } } } -class eV extends Xk { +class tV extends Zk { constructor(e, r) { - super(e, r), this.relayer = e, this.logger = r, this.events = new ns.EventEmitter(), this.name = tH, this.queue = /* @__PURE__ */ new Map(), this.publishTimeout = mt.toMiliseconds(mt.ONE_MINUTE), this.failedPublishTimeout = mt.toMiliseconds(mt.ONE_SECOND), this.needsTransportRestart = !1, this.publish = async (n, i, s) => { + super(e, r), this.relayer = e, this.logger = r, this.events = new rs.EventEmitter(), this.name = rH, this.queue = /* @__PURE__ */ new Map(), this.publishTimeout = mt.toMiliseconds(mt.ONE_MINUTE), this.failedPublishTimeout = mt.toMiliseconds(mt.ONE_SECOND), this.needsTransportRestart = !1, this.publish = async (n, i, s) => { var o; this.logger.debug("Publishing Payload"), this.logger.trace({ type: "method", method: "publish", params: { topic: n, message: i, opts: s } }); - const a = (s == null ? void 0 : s.ttl) || eH, u = C1(s), l = (s == null ? void 0 : s.prompt) || !1, d = (s == null ? void 0 : s.tag) || 0, p = (s == null ? void 0 : s.id) || ic().toString(), w = { topic: n, message: i, opts: { ttl: a, relay: u, prompt: l, tag: d, id: p, attestation: s == null ? void 0 : s.attestation } }, A = `Failed to publish payload, please try again. id:${p} tag:${d}`, P = Date.now(); + const a = (s == null ? void 0 : s.ttl) || tH, u = C1(s), l = (s == null ? void 0 : s.prompt) || !1, d = (s == null ? void 0 : s.tag) || 0, p = (s == null ? void 0 : s.id) || nc().toString(), w = { topic: n, message: i, opts: { ttl: a, relay: u, prompt: l, tag: d, id: p, attestation: s == null ? void 0 : s.attestation } }, A = `Failed to publish payload, please try again. id:${p} tag:${d}`, M = Date.now(); let N, L = 1; try { for (; N === void 0; ) { - if (Date.now() - P > this.publishTimeout) throw new Error(A); - this.logger.trace({ id: p, attempts: L }, `publisher.publish - attempt ${L}`), N = await await du(this.rpcPublish(n, i, a, u, l, d, p, s == null ? void 0 : s.attestation).catch(($) => this.logger.warn($)), this.publishTimeout, A), L++, N || await new Promise(($) => setTimeout($, this.failedPublishTimeout)); + if (Date.now() - M > this.publishTimeout) throw new Error(A); + this.logger.trace({ id: p, attempts: L }, `publisher.publish - attempt ${L}`), N = await await du(this.rpcPublish(n, i, a, u, l, d, p, s == null ? void 0 : s.attestation).catch((B) => this.logger.warn(B)), this.publishTimeout, A), L++, N || await new Promise((B) => setTimeout(B, this.failedPublishTimeout)); } - this.relayer.events.emit(si.publish, w), this.logger.debug("Successfully Published Payload"), this.logger.trace({ type: "method", method: "publish", params: { id: p, topic: n, message: i, opts: s } }); - } catch ($) { - if (this.logger.debug("Failed to Publish Payload"), this.logger.error($), (o = s == null ? void 0 : s.internal) != null && o.throwOnFailedPublish) throw $; + this.relayer.events.emit(oi.publish, w), this.logger.debug("Successfully Published Payload"), this.logger.trace({ type: "method", method: "publish", params: { id: p, topic: n, message: i, opts: s } }); + } catch (B) { + if (this.logger.debug("Failed to Publish Payload"), this.logger.error(B), (o = s == null ? void 0 : s.internal) != null && o.throwOnFailedPublish) throw B; this.queue.set(p, w); } }, this.on = (n, i) => { @@ -18605,7 +18605,7 @@ class eV extends Xk { }, this.relayer = e, this.logger = ci(r, this.name), this.registerEventListeners(); } get context() { - return Si(this.logger); + return Ai(this.logger); } rpcPublish(e, r, n, i, s, o, a, u) { var l, d, p, w; @@ -18624,16 +18624,16 @@ class eV extends Xk { registerEventListeners() { this.relayer.core.heartbeat.on(Ou.pulse, () => { if (this.needsTransportRestart) { - this.needsTransportRestart = !1, this.relayer.events.emit(si.connection_stalled); + this.needsTransportRestart = !1, this.relayer.events.emit(oi.connection_stalled); return; } this.checkQueue(); - }), this.relayer.on(si.message_ack, (e) => { + }), this.relayer.on(oi.message_ack, (e) => { this.removeRequestFromQueue(e.id.toString()); }); } } -class tV { +class rV { constructor() { this.map = /* @__PURE__ */ new Map(), this.set = (e, r) => { const n = this.get(e); @@ -18660,14 +18660,14 @@ class tV { return Array.from(this.map.keys()); } } -var rV = Object.defineProperty, nV = Object.defineProperties, iV = Object.getOwnPropertyDescriptors, _3 = Object.getOwnPropertySymbols, sV = Object.prototype.hasOwnProperty, oV = Object.prototype.propertyIsEnumerable, E3 = (t, e, r) => e in t ? rV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Cf = (t, e) => { - for (var r in e || (e = {})) sV.call(e, r) && E3(t, r, e[r]); - if (_3) for (var r of _3(e)) oV.call(e, r) && E3(t, r, e[r]); +var nV = Object.defineProperty, iV = Object.defineProperties, sV = Object.getOwnPropertyDescriptors, w3 = Object.getOwnPropertySymbols, oV = Object.prototype.hasOwnProperty, aV = Object.prototype.propertyIsEnumerable, x3 = (t, e, r) => e in t ? nV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Cf = (t, e) => { + for (var r in e || (e = {})) oV.call(e, r) && x3(t, r, e[r]); + if (w3) for (var r of w3(e)) aV.call(e, r) && x3(t, r, e[r]); return t; -}, gm = (t, e) => nV(t, iV(e)); -class aV extends e$ { +}, gm = (t, e) => iV(t, sV(e)); +class cV extends t$ { constructor(e, r) { - super(e, r), this.relayer = e, this.logger = r, this.subscriptions = /* @__PURE__ */ new Map(), this.topicMap = new tV(), this.events = new ns.EventEmitter(), this.name = cH, this.version = uH, this.pending = /* @__PURE__ */ new Map(), this.cached = [], this.initialized = !1, this.pendingSubscriptionWatchLabel = "pending_sub_watch_label", this.pollingInterval = 20, this.storagePrefix = eo, this.subscribeTimeout = mt.toMiliseconds(mt.ONE_MINUTE), this.restartInProgress = !1, this.batchSubscribeTopicsLimit = 500, this.pendingBatchMessages = [], this.init = async () => { + super(e, r), this.relayer = e, this.logger = r, this.subscriptions = /* @__PURE__ */ new Map(), this.topicMap = new rV(), this.events = new rs.EventEmitter(), this.name = uH, this.version = fH, this.pending = /* @__PURE__ */ new Map(), this.cached = [], this.initialized = !1, this.pendingSubscriptionWatchLabel = "pending_sub_watch_label", this.pollingInterval = 20, this.storagePrefix = Qs, this.subscribeTimeout = mt.toMiliseconds(mt.ONE_MINUTE), this.restartInProgress = !1, this.batchSubscribeTopicsLimit = 500, this.pendingBatchMessages = [], this.init = async () => { this.initialized || (this.logger.trace("Initialized"), this.registerEventListeners(), this.clientId = await this.relayer.core.crypto.getClientId(), await this.restore()), this.initialized = !0; }, this.subscribe = async (n, i) => { this.isInitialized(), this.logger.debug("Subscribing Topic"), this.logger.trace({ type: "method", method: "subscribe", params: { topic: n, opts: i } }); @@ -18688,7 +18688,7 @@ class aV extends e$ { const a = new mt.Watch(); a.start(i); const u = setInterval(() => { - !this.pending.has(n) && this.topics.includes(n) && (clearInterval(u), a.stop(i), s(!0)), a.elapsed(i) >= fH && (clearInterval(u), a.stop(i), o(new Error("Subscription resolution timeout"))); + !this.pending.has(n) && this.topics.includes(n) && (clearInterval(u), a.stop(i), s(!0)), a.elapsed(i) >= lH && (clearInterval(u), a.stop(i), o(new Error("Subscription resolution timeout"))); }, this.pollingInterval); }).catch(() => !1); }, this.on = (n, i) => { @@ -18708,7 +18708,7 @@ class aV extends e$ { }, this.relayer = e, this.logger = ci(r, this.name), this.clientId = ""; } get context() { - return Si(this.logger); + return Ai(this.logger); } get storageKey() { return this.storagePrefix + this.version + this.relayer.core.customStoragePrefix + "//" + this.name; @@ -18761,7 +18761,7 @@ class aV extends e$ { this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: s }); const o = (i = n == null ? void 0 : n.internal) == null ? void 0 : i.throwOnFailedPublish; try { - const a = Eo(e + this.clientId); + const a = xo(e + this.clientId); if ((n == null ? void 0 : n.transportType) === zr.link_mode) return setTimeout(() => { (this.relayer.connected || this.relayer.connecting) && this.relayer.request(s).catch((l) => this.logger.warn(l)); }, mt.toMiliseconds(mt.ONE_SECOND)), a; @@ -18769,7 +18769,7 @@ class aV extends e$ { if (!u && o) throw new Error(`Subscribing to ${e} failed, please try again`); return u ? a : null; } catch (a) { - if (this.logger.debug("Outgoing Relay Subscribe Payload stalled"), this.relayer.events.emit(si.connection_stalled), o) throw a; + if (this.logger.debug("Outgoing Relay Subscribe Payload stalled"), this.relayer.events.emit(oi.connection_stalled), o) throw a; } return null; } @@ -18780,7 +18780,7 @@ class aV extends e$ { try { return await await du(this.relayer.request(n).catch((i) => this.logger.warn(i)), this.subscribeTimeout); } catch { - this.relayer.events.emit(si.connection_stalled); + this.relayer.events.emit(oi.connection_stalled); } } async rpcBatchFetchMessages(e) { @@ -18791,7 +18791,7 @@ class aV extends e$ { try { i = await await du(this.relayer.request(n).catch((s) => this.logger.warn(s)), this.subscribeTimeout); } catch { - this.relayer.events.emit(si.connection_stalled); + this.relayer.events.emit(oi.connection_stalled); } return i; } @@ -18865,7 +18865,7 @@ class aV extends e$ { async batchSubscribe(e) { if (!e.length) return; const r = await this.rpcBatchSubscribe(e); - gc(r) && this.onBatchSubscribe(r.map((n, i) => gm(Cf({}, e[i]), { id: n }))); + pc(r) && this.onBatchSubscribe(r.map((n, i) => gm(Cf({}, e[i]), { id: n }))); } async batchFetchMessages(e) { if (!e.length) return; @@ -18911,17 +18911,17 @@ class aV extends e$ { }); } } -var cV = Object.defineProperty, S3 = Object.getOwnPropertySymbols, uV = Object.prototype.hasOwnProperty, fV = Object.prototype.propertyIsEnumerable, A3 = (t, e, r) => e in t ? cV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, P3 = (t, e) => { - for (var r in e || (e = {})) uV.call(e, r) && A3(t, r, e[r]); - if (S3) for (var r of S3(e)) fV.call(e, r) && A3(t, r, e[r]); +var uV = Object.defineProperty, _3 = Object.getOwnPropertySymbols, fV = Object.prototype.hasOwnProperty, lV = Object.prototype.propertyIsEnumerable, E3 = (t, e, r) => e in t ? uV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, S3 = (t, e) => { + for (var r in e || (e = {})) fV.call(e, r) && E3(t, r, e[r]); + if (_3) for (var r of _3(e)) lV.call(e, r) && E3(t, r, e[r]); return t; }; -class lV extends Zk { +class hV extends Qk { constructor(e) { - super(e), this.protocol = "wc", this.version = 2, this.events = new ns.EventEmitter(), this.name = nH, this.transportExplicitlyClosed = !1, this.initialized = !1, this.connectionAttemptInProgress = !1, this.connectionStatusPollingInterval = 20, this.staleConnectionErrors = ["socket hang up", "stalled", "interrupted"], this.hasExperiencedNetworkDisruption = !1, this.requestsInFlight = /* @__PURE__ */ new Map(), this.heartBeatTimeout = mt.toMiliseconds(mt.THIRTY_SECONDS + mt.ONE_SECOND), this.request = async (r) => { + super(e), this.protocol = "wc", this.version = 2, this.events = new rs.EventEmitter(), this.name = iH, this.transportExplicitlyClosed = !1, this.initialized = !1, this.connectionAttemptInProgress = !1, this.connectionStatusPollingInterval = 20, this.staleConnectionErrors = ["socket hang up", "stalled", "interrupted"], this.hasExperiencedNetworkDisruption = !1, this.requestsInFlight = /* @__PURE__ */ new Map(), this.heartBeatTimeout = mt.toMiliseconds(mt.THIRTY_SECONDS + mt.ONE_SECOND), this.request = async (r) => { var n, i; this.logger.debug("Publishing Request Payload"); - const s = r.id || ic().toString(); + const s = r.id || nc().toString(); await this.toEstablishConnection(); try { const o = this.provider.request(r); @@ -18930,9 +18930,9 @@ class lV extends Zk { const d = () => { l(new Error(`relayer.request - publish interrupted, id: ${s}`)); }; - this.provider.on(Gi.disconnect, d); + this.provider.on(Vi.disconnect, d); const p = await o; - this.provider.off(Gi.disconnect, d), u(p); + this.provider.off(Vi.disconnect, d), u(p); }); return this.logger.trace({ id: s, method: r.method, topic: (i = r.params) == null ? void 0 : i.topic }, "relayer.request - published"), a; } catch (o) { @@ -18952,14 +18952,14 @@ class lV extends Zk { }, this.onPayloadHandler = (r) => { this.onProviderPayload(r), this.resetPingTimeout(); }, this.onConnectHandler = () => { - this.logger.trace("relayer connected"), this.startPingTimeout(), this.events.emit(si.connect); + this.logger.trace("relayer connected"), this.startPingTimeout(), this.events.emit(oi.connect); }, this.onDisconnectHandler = () => { this.logger.trace("relayer disconnected"), this.onProviderDisconnect(); }, this.onProviderErrorHandler = (r) => { - this.logger.error(r), this.events.emit(si.error, r), this.logger.info("Fatal socket error received, closing transport"), this.transportClose(); + this.logger.error(r), this.events.emit(oi.error, r), this.logger.info("Fatal socket error received, closing transport"), this.transportClose(); }, this.registerProviderListeners = () => { - this.provider.on(Gi.payload, this.onPayloadHandler), this.provider.on(Gi.connect, this.onConnectHandler), this.provider.on(Gi.disconnect, this.onDisconnectHandler), this.provider.on(Gi.error, this.onProviderErrorHandler); - }, this.core = e.core, this.logger = typeof e.logger < "u" && typeof e.logger != "string" ? ci(e.logger, this.name) : ql($0({ level: e.logger || rH })), this.messages = new QK(this.logger, e.core), this.subscriber = new aV(this, this.logger), this.publisher = new eV(this, this.logger), this.relayUrl = (e == null ? void 0 : e.relayUrl) || oE, this.projectId = e.projectId, this.bundleId = Fq(), this.provider = {}; + this.provider.on(Vi.payload, this.onPayloadHandler), this.provider.on(Vi.connect, this.onConnectHandler), this.provider.on(Vi.disconnect, this.onDisconnectHandler), this.provider.on(Vi.error, this.onProviderErrorHandler); + }, this.core = e.core, this.logger = typeof e.logger < "u" && typeof e.logger != "string" ? ci(e.logger, this.name) : ql($0({ level: e.logger || nH })), this.messages = new eV(this.logger, e.core), this.subscriber = new cV(this, this.logger), this.publisher = new tV(this, this.logger), this.relayUrl = (e == null ? void 0 : e.relayUrl) || iE, this.projectId = e.projectId, this.bundleId = jq(), this.provider = {}; } async init() { if (this.logger.trace("Initialized"), this.registerEventListeners(), await Promise.all([this.messages.init(), this.subscriber.init()]), this.initialized = !0, this.subscriber.cached.length > 0) try { @@ -18969,7 +18969,7 @@ class lV extends Zk { } } get context() { - return Si(this.logger); + return Ai(this.logger); } get connected() { var e, r, n; @@ -18993,7 +18993,7 @@ class lV extends Zk { return await Promise.all([new Promise((d) => { u = d, this.subscriber.on(Us.created, l); }), new Promise(async (d, p) => { - a = await this.subscriber.subscribe(e, P3({ internal: { throwOnFailedPublish: o } }, r)).catch((w) => { + a = await this.subscriber.subscribe(e, S3({ internal: { throwOnFailedPublish: o } }, r)).catch((w) => { o && p(w); }) || a, d(); })]), a; @@ -19029,9 +19029,9 @@ class lV extends Zk { try { await new Promise(async (r, n) => { const i = () => { - this.provider.off(Gi.disconnect, i), n(new Error("Connection interrupted while trying to subscribe")); + this.provider.off(Vi.disconnect, i), n(new Error("Connection interrupted while trying to subscribe")); }; - this.provider.on(Gi.disconnect, i), await du(this.provider.connect(), mt.toMiliseconds(mt.ONE_MINUTE), `Socket stalled when trying to connect to ${this.relayUrl}`).catch((s) => { + this.provider.on(Vi.disconnect, i), await du(this.provider.connect(), mt.toMiliseconds(mt.ONE_MINUTE), `Socket stalled when trying to connect to ${this.relayUrl}`).catch((s) => { n(s); }).finally(() => { clearTimeout(this.reconnectTimeout), this.reconnectTimeout = void 0; @@ -19051,7 +19051,7 @@ class lV extends Zk { this.connectionAttemptInProgress || (this.relayUrl = e || this.relayUrl, await this.confirmOnlineStateOrThrow(), await this.transportClose(), await this.transportOpen()); } async confirmOnlineStateOrThrow() { - if (!await o3()) throw new Error("No internet connection detected. Please restart your network and try again."); + if (!await i3()) throw new Error("No internet connection detected. Please restart your network and try again."); } async handleBatchMessageEvents(e) { if ((e == null ? void 0 : e.length) === 0) { @@ -19073,7 +19073,7 @@ class lV extends Zk { const i = En(mt.FIVE_MINUTES), s = { topic: n, expiry: i, relay: { protocol: "irn" }, active: !1 }; await this.core.pairing.pairings.set(n, s); } - this.events.emit(si.message, e), await this.recordMessageEvent(e); + this.events.emit(oi.message, e), await this.recordMessageEvent(e); } startPingTimeout() { var e, r, n, i, s; @@ -19091,7 +19091,7 @@ class lV extends Zk { async createProvider() { this.provider.connection && this.unregisterProviderListeners(); const e = await this.core.crypto.signJWT(this.relayUrl); - this.provider = new cs(new zW(zq({ sdkVersion: T1, protocol: this.protocol, version: this.version, relayUrl: this.relayUrl, projectId: this.projectId, auth: e, useOnCloseEvent: !0, bundleId: this.bundleId }))), this.registerProviderListeners(); + this.provider = new as(new WW(Wq({ sdkVersion: T1, protocol: this.protocol, version: this.version, relayUrl: this.relayUrl, projectId: this.projectId, auth: e, useOnCloseEvent: !0, bundleId: this.bundleId }))), this.registerProviderListeners(); } async recordMessageEvent(e) { const { topic: r, message: n } = e; @@ -19106,31 +19106,31 @@ class lV extends Zk { } async onProviderPayload(e) { if (this.logger.debug("Incoming Relay Payload"), this.logger.trace({ type: "payload", direction: "incoming", payload: e }), fb(e)) { - if (!e.method.endsWith(iH)) return; + if (!e.method.endsWith(sH)) return; const r = e.params, { topic: n, message: i, publishedAt: s, attestation: o } = r.data, a = { topic: n, message: i, publishedAt: s, transportType: zr.relay, attestation: o }; - this.logger.debug("Emitting Relayer Payload"), this.logger.trace(P3({ type: "event", event: r.id }, a)), this.events.emit(r.id, a), await this.acknowledgePayload(e), await this.onMessageEvent(a); - } else ip(e) && this.events.emit(si.message_ack, e); + this.logger.debug("Emitting Relayer Payload"), this.logger.trace(S3({ type: "event", event: r.id }, a)), this.events.emit(r.id, a), await this.acknowledgePayload(e), await this.onMessageEvent(a); + } else ip(e) && this.events.emit(oi.message_ack, e); } async onMessageEvent(e) { - await this.shouldIgnoreMessageEvent(e) || (this.events.emit(si.message, e), await this.recordMessageEvent(e)); + await this.shouldIgnoreMessageEvent(e) || (this.events.emit(oi.message, e), await this.recordMessageEvent(e)); } async acknowledgePayload(e) { const r = rp(e.id, !0); await this.provider.connection.send(r); } unregisterProviderListeners() { - this.provider.off(Gi.payload, this.onPayloadHandler), this.provider.off(Gi.connect, this.onConnectHandler), this.provider.off(Gi.disconnect, this.onDisconnectHandler), this.provider.off(Gi.error, this.onProviderErrorHandler), clearTimeout(this.pingTimeout); + this.provider.off(Vi.payload, this.onPayloadHandler), this.provider.off(Vi.connect, this.onConnectHandler), this.provider.off(Vi.disconnect, this.onDisconnectHandler), this.provider.off(Vi.error, this.onProviderErrorHandler), clearTimeout(this.pingTimeout); } async registerEventListeners() { - let e = await o3(); - wW(async (r) => { + let e = await i3(); + xW(async (r) => { e !== r && (e = r, r ? await this.restartTransport().catch((n) => this.logger.error(n)) : (this.hasExperiencedNetworkDisruption = !0, await this.transportDisconnect(), this.transportExplicitlyClosed = !1)); }); } async onProviderDisconnect() { - await this.subscriber.stop(), this.requestsInFlight.clear(), clearTimeout(this.pingTimeout), this.events.emit(si.disconnect), this.connectionAttemptInProgress = !1, !this.transportExplicitlyClosed && (this.reconnectTimeout || (this.reconnectTimeout = setTimeout(async () => { + await this.subscriber.stop(), this.requestsInFlight.clear(), clearTimeout(this.pingTimeout), this.events.emit(oi.disconnect), this.connectionAttemptInProgress = !1, !this.transportExplicitlyClosed && (this.reconnectTimeout || (this.reconnectTimeout = setTimeout(async () => { await this.transportOpen().catch((e) => this.logger.error(e)); - }, mt.toMiliseconds(sH)))); + }, mt.toMiliseconds(oH)))); } isInitialized() { if (!this.initialized) { @@ -19146,29 +19146,29 @@ class lV extends Zk { }), await this.transportOpen()); } } -var hV = Object.defineProperty, M3 = Object.getOwnPropertySymbols, dV = Object.prototype.hasOwnProperty, pV = Object.prototype.propertyIsEnumerable, I3 = (t, e, r) => e in t ? hV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, C3 = (t, e) => { - for (var r in e || (e = {})) dV.call(e, r) && I3(t, r, e[r]); - if (M3) for (var r of M3(e)) pV.call(e, r) && I3(t, r, e[r]); +var dV = Object.defineProperty, A3 = Object.getOwnPropertySymbols, pV = Object.prototype.hasOwnProperty, gV = Object.prototype.propertyIsEnumerable, P3 = (t, e, r) => e in t ? dV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, M3 = (t, e) => { + for (var r in e || (e = {})) pV.call(e, r) && P3(t, r, e[r]); + if (A3) for (var r of A3(e)) gV.call(e, r) && P3(t, r, e[r]); return t; }; -class Ec extends Qk { - constructor(e, r, n, i = eo, s = void 0) { - super(e, r, n, i), this.core = e, this.logger = r, this.name = n, this.map = /* @__PURE__ */ new Map(), this.version = oH, this.cached = [], this.initialized = !1, this.storagePrefix = eo, this.recentlyDeleted = [], this.recentlyDeletedLimit = 200, this.init = async () => { +class Ec extends e$ { + constructor(e, r, n, i = Qs, s = void 0) { + super(e, r, n, i), this.core = e, this.logger = r, this.name = n, this.map = /* @__PURE__ */ new Map(), this.version = aH, this.cached = [], this.initialized = !1, this.storagePrefix = Qs, this.recentlyDeleted = [], this.recentlyDeletedLimit = 200, this.init = async () => { this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((o) => { - this.getKey && o !== null && !mi(o) ? this.map.set(this.getKey(o), o) : Xz(o) ? this.map.set(o.id, o) : Zz(o) && this.map.set(o.topic, o); + this.getKey && o !== null && !mi(o) ? this.map.set(this.getKey(o), o) : Zz(o) ? this.map.set(o.id, o) : Qz(o) && this.map.set(o.topic, o); }), this.cached = [], this.initialized = !0); }, this.set = async (o, a) => { this.isInitialized(), this.map.has(o) ? await this.update(o, a) : (this.logger.debug("Setting value"), this.logger.trace({ type: "method", method: "set", key: o, value: a }), this.map.set(o, a), await this.persist()); - }, this.get = (o) => (this.isInitialized(), this.logger.debug("Getting value"), this.logger.trace({ type: "method", method: "get", key: o }), this.getData(o)), this.getAll = (o) => (this.isInitialized(), o ? this.values.filter((a) => Object.keys(o).every((u) => HW(a[u], o[u]))) : this.values), this.update = async (o, a) => { + }, this.get = (o) => (this.isInitialized(), this.logger.debug("Getting value"), this.logger.trace({ type: "method", method: "get", key: o }), this.getData(o)), this.getAll = (o) => (this.isInitialized(), o ? this.values.filter((a) => Object.keys(o).every((u) => KW(a[u], o[u]))) : this.values), this.update = async (o, a) => { this.isInitialized(), this.logger.debug("Updating value"), this.logger.trace({ type: "method", method: "update", key: o, update: a }); - const u = C3(C3({}, this.getData(o)), a); + const u = M3(M3({}, this.getData(o)), a); this.map.set(o, u), await this.persist(); }, this.delete = async (o, a) => { this.isInitialized(), this.map.has(o) && (this.logger.debug("Deleting value"), this.logger.trace({ type: "method", method: "delete", key: o, reason: a }), this.map.delete(o), this.addToRecentlyDeleted(o), await this.persist()); }, this.logger = ci(r, this.name), this.storagePrefix = i, this.getKey = s; } get context() { - return Si(this.logger); + return Ai(this.logger); } get storageKey() { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; @@ -19226,38 +19226,38 @@ class Ec extends Qk { } } } -class gV { +class mV { constructor(e, r) { - this.core = e, this.logger = r, this.name = lH, this.version = hH, this.events = new kv(), this.initialized = !1, this.storagePrefix = eo, this.ignoredPayloadTypes = [Ro], this.registeredMethods = [], this.init = async () => { + this.core = e, this.logger = r, this.name = hH, this.version = dH, this.events = new kv(), this.initialized = !1, this.storagePrefix = Qs, this.ignoredPayloadTypes = [Co], this.registeredMethods = [], this.init = async () => { this.initialized || (await this.pairings.init(), await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.initialized = !0, this.logger.trace("Initialized")); }, this.register = ({ methods: n }) => { this.isInitialized(), this.registeredMethods = [.../* @__PURE__ */ new Set([...this.registeredMethods, ...n])]; }, this.create = async (n) => { this.isInitialized(); - const i = I1(), s = await this.core.crypto.setSymKey(i), o = En(mt.FIVE_MINUTES), a = { protocol: sE }, u = { topic: s, expiry: o, relay: a, active: !1, methods: n == null ? void 0 : n.methods }, l = e3({ protocol: this.core.protocol, version: this.core.version, topic: s, symKey: i, relay: a, expiryTimestamp: o, methods: n == null ? void 0 : n.methods }); - return this.events.emit(Qa.create, u), this.core.expirer.set(s, o), await this.pairings.set(s, u), await this.core.relayer.subscribe(s, { transportType: n == null ? void 0 : n.transportType }), { topic: s, uri: l }; + const i = I1(), s = await this.core.crypto.setSymKey(i), o = En(mt.FIVE_MINUTES), a = { protocol: nE }, u = { topic: s, expiry: o, relay: a, active: !1, methods: n == null ? void 0 : n.methods }, l = Zx({ protocol: this.core.protocol, version: this.core.version, topic: s, symKey: i, relay: a, expiryTimestamp: o, methods: n == null ? void 0 : n.methods }); + return this.events.emit(Za.create, u), this.core.expirer.set(s, o), await this.pairings.set(s, u), await this.core.relayer.subscribe(s, { transportType: n == null ? void 0 : n.transportType }), { topic: s, uri: l }; }, this.pair = async (n) => { this.isInitialized(); const i = this.core.eventClient.createEvent({ properties: { topic: n == null ? void 0 : n.uri, trace: [Fs.pairing_started] } }); this.isValidPair(n, i); - const { topic: s, symKey: o, relay: a, expiryTimestamp: u, methods: l } = Qx(n.uri); + const { topic: s, symKey: o, relay: a, expiryTimestamp: u, methods: l } = Xx(n.uri); i.props.properties.topic = s, i.addTrace(Fs.pairing_uri_validation_success), i.addTrace(Fs.pairing_uri_not_expired); let d; if (this.pairings.keys.includes(s)) { - if (d = this.pairings.get(s), i.addTrace(Fs.existing_pairing), d.active) throw i.setError(_o.active_pairing_already_exists), new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`); + if (d = this.pairings.get(s), i.addTrace(Fs.existing_pairing), d.active) throw i.setError(wo.active_pairing_already_exists), new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`); i.addTrace(Fs.pairing_not_expired); } const p = u || En(mt.FIVE_MINUTES), w = { topic: s, relay: a, expiry: p, active: !1, methods: l }; - this.core.expirer.set(s, p), await this.pairings.set(s, w), i.addTrace(Fs.store_new_pairing), n.activatePairing && await this.activate({ topic: s }), this.events.emit(Qa.create, w), i.addTrace(Fs.emit_inactive_pairing), this.core.crypto.keychain.has(s) || await this.core.crypto.setSymKey(o, s), i.addTrace(Fs.subscribing_pairing_topic); + this.core.expirer.set(s, p), await this.pairings.set(s, w), i.addTrace(Fs.store_new_pairing), n.activatePairing && await this.activate({ topic: s }), this.events.emit(Za.create, w), i.addTrace(Fs.emit_inactive_pairing), this.core.crypto.keychain.has(s) || await this.core.crypto.setSymKey(o, s), i.addTrace(Fs.subscribing_pairing_topic); try { await this.core.relayer.confirmOnlineStateOrThrow(); } catch { - i.setError(_o.no_internet_connection); + i.setError(wo.no_internet_connection); } try { await this.core.relayer.subscribe(s, { relay: a }); } catch (A) { - throw i.setError(_o.subscribe_pairing_topic_failure), A; + throw i.setError(wo.subscribe_pairing_topic_failure), A; } return i.addTrace(Fs.subscribe_pairing_topic_success), w; }, this.activate = async ({ topic: n }) => { @@ -19268,7 +19268,7 @@ class gV { this.isInitialized(), await this.isValidPing(n); const { topic: i } = n; if (this.pairings.keys.includes(i)) { - const s = await this.sendRequest(i, "wc_pairingPing", {}), { done: o, resolve: a, reject: u } = Ja(); + const s = await this.sendRequest(i, "wc_pairingPing", {}), { done: o, resolve: a, reject: u } = Ga(); this.events.once(br("pairing_ping", s), ({ error: l }) => { l ? u(l) : a(); }), await o(); @@ -19284,9 +19284,9 @@ class gV { }, this.formatUriFromPairing = (n) => { this.isInitialized(); const { topic: i, relay: s, expiry: o, methods: a } = n, u = this.core.crypto.keychain.get(i); - return e3({ protocol: this.core.protocol, version: this.core.version, topic: i, symKey: u, relay: s, expiryTimestamp: o, methods: a }); + return Zx({ protocol: this.core.protocol, version: this.core.version, topic: i, symKey: u, relay: s, expiryTimestamp: o, methods: a }); }, this.sendRequest = async (n, i, s) => { - const o = ga(i, s), a = await this.core.crypto.encode(n, o), u = Mf[i].req; + const o = da(i, s), a = await this.core.crypto.encode(n, o), u = Mf[i].req; return this.core.history.set(n, o), this.core.relayer.publish(n, a, u), o.id; }, this.sendResult = async (n, i, s) => { const o = rp(n, s), a = await this.core.crypto.encode(i, o), u = await this.core.history.get(i, n), l = Mf[u.request.method].res; @@ -19297,7 +19297,7 @@ class gV { }, this.deletePairing = async (n, i) => { await this.core.relayer.unsubscribe(n), await Promise.all([this.pairings.delete(n, Or("USER_DISCONNECTED")), this.core.crypto.deleteSymKey(n), i ? Promise.resolve() : this.core.expirer.del(n)]); }, this.cleanup = async () => { - const n = this.pairings.getAll().filter((i) => fa(i.expiry)); + const n = this.pairings.getAll().filter((i) => ca(i.expiry)); await Promise.all(n.map((i) => this.deletePairing(i.topic))); }, this.onRelayEventRequest = (n) => { const { topic: i, payload: s } = n; @@ -19320,19 +19320,19 @@ class gV { }, this.onPairingPingRequest = async (n, i) => { const { id: s } = i; try { - this.isValidPing({ topic: n }), await this.sendResult(s, n, !0), this.events.emit(Qa.ping, { id: s, topic: n }); + this.isValidPing({ topic: n }), await this.sendResult(s, n, !0), this.events.emit(Za.ping, { id: s, topic: n }); } catch (o) { await this.sendError(s, n, o), this.logger.error(o); } }, this.onPairingPingResponse = (n, i) => { const { id: s } = i; setTimeout(() => { - js(i) ? this.events.emit(br("pairing_ping", s), {}) : Qi(i) && this.events.emit(br("pairing_ping", s), { error: i.error }); + js(i) ? this.events.emit(br("pairing_ping", s), {}) : Zi(i) && this.events.emit(br("pairing_ping", s), { error: i.error }); }, 500); }, this.onPairingDeleteRequest = async (n, i) => { const { id: s } = i; try { - this.isValidDisconnect({ topic: n }), await this.deletePairing(n), this.events.emit(Qa.delete, { id: s, topic: n }); + this.isValidDisconnect({ topic: n }), await this.deletePairing(n), this.events.emit(Za.delete, { id: s, topic: n }); } catch (o) { await this.sendError(s, n, o), this.logger.error(o); } @@ -19351,23 +19351,23 @@ class gV { var s; if (!gi(n)) { const { message: a } = ft("MISSING_OR_INVALID", `pair() params: ${n}`); - throw i.setError(_o.malformed_pairing_uri), new Error(a); + throw i.setError(wo.malformed_pairing_uri), new Error(a); } - if (!Jz(n.uri)) { + if (!Xz(n.uri)) { const { message: a } = ft("MISSING_OR_INVALID", `pair() uri: ${n.uri}`); - throw i.setError(_o.malformed_pairing_uri), new Error(a); + throw i.setError(wo.malformed_pairing_uri), new Error(a); } - const o = Qx(n == null ? void 0 : n.uri); + const o = Xx(n == null ? void 0 : n.uri); if (!((s = o == null ? void 0 : o.relay) != null && s.protocol)) { const { message: a } = ft("MISSING_OR_INVALID", "pair() uri#relay-protocol"); - throw i.setError(_o.malformed_pairing_uri), new Error(a); + throw i.setError(wo.malformed_pairing_uri), new Error(a); } if (!(o != null && o.symKey)) { const { message: a } = ft("MISSING_OR_INVALID", "pair() uri#symKey"); - throw i.setError(_o.malformed_pairing_uri), new Error(a); + throw i.setError(wo.malformed_pairing_uri), new Error(a); } if (o != null && o.expiryTimestamp && mt.toMiliseconds(o == null ? void 0 : o.expiryTimestamp) < Date.now()) { - i.setError(_o.pairing_expired); + i.setError(wo.pairing_expired); const { message: a } = ft("EXPIRED", "pair() URI has expired. Please try again with a new connection URI."); throw new Error(a); } @@ -19394,7 +19394,7 @@ class gV { const { message: i } = ft("NO_MATCHING_KEY", `pairing topic doesn't exist: ${n}`); throw new Error(i); } - if (fa(this.pairings.get(n).expiry)) { + if (ca(this.pairings.get(n).expiry)) { await this.deletePairing(n); const { message: i } = ft("EXPIRED", `pairing topic: ${n}`); throw new Error(i); @@ -19402,7 +19402,7 @@ class gV { }, this.core = e, this.logger = ci(r, this.name), this.pairings = new Ec(this.core, this.logger, this.name, this.storagePrefix); } get context() { - return Si(this.logger); + return Ai(this.logger); } isInitialized() { if (!this.initialized) { @@ -19411,7 +19411,7 @@ class gV { } } registerRelayerEvents() { - this.core.relayer.on(si.message, async (e) => { + this.core.relayer.on(oi.message, async (e) => { const { topic: r, message: n, transportType: i } = e; if (!this.pairings.keys.includes(r) || i === zr.link_mode || this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n))) return; const s = await this.core.crypto.decode(r, n); @@ -19423,15 +19423,15 @@ class gV { }); } registerExpirerEvents() { - this.core.expirer.on(Xi.expired, async (e) => { - const { topic: r } = F8(e.target); - r && this.pairings.keys.includes(r) && (await this.deletePairing(r, !0), this.events.emit(Qa.expire, { topic: r })); + this.core.expirer.on(Ji.expired, async (e) => { + const { topic: r } = $8(e.target); + r && this.pairings.keys.includes(r) && (await this.deletePairing(r, !0), this.events.emit(Za.expire, { topic: r })); }); } } -class mV extends Yk { +class vV extends Jk { constructor(e, r) { - super(e, r), this.core = e, this.logger = r, this.records = /* @__PURE__ */ new Map(), this.events = new ns.EventEmitter(), this.name = dH, this.version = pH, this.cached = [], this.initialized = !1, this.storagePrefix = eo, this.init = async () => { + super(e, r), this.core = e, this.logger = r, this.records = /* @__PURE__ */ new Map(), this.events = new rs.EventEmitter(), this.name = pH, this.version = gH, this.cached = [], this.initialized = !1, this.storagePrefix = Qs, this.init = async () => { this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((n) => this.records.set(n.id, n)), this.cached = [], this.registerEventListeners(), this.initialized = !0); }, this.set = (n, i, s) => { if (this.isInitialized(), this.logger.debug("Setting JSON-RPC request history record"), this.logger.trace({ type: "method", method: "set", topic: n, request: i, chainId: s }), this.records.has(i.id)) return; @@ -19440,7 +19440,7 @@ class mV extends Yk { }, this.resolve = async (n) => { if (this.isInitialized(), this.logger.debug("Updating JSON-RPC response history record"), this.logger.trace({ type: "method", method: "update", response: n }), !this.records.has(n.id)) return; const i = await this.getRecord(n.id); - typeof i.response > "u" && (i.response = Qi(n) ? { error: n.error } : { result: n.result }, this.records.set(i.id, i), this.persist(), this.events.emit(ms.updated, i)); + typeof i.response > "u" && (i.response = Zi(n) ? { error: n.error } : { result: n.result }, this.records.set(i.id, i), this.persist(), this.events.emit(ms.updated, i)); }, this.get = async (n, i) => (this.isInitialized(), this.logger.debug("Getting record"), this.logger.trace({ type: "method", method: "get", topic: n, id: i }), await this.getRecord(i)), this.delete = (n, i) => { this.isInitialized(), this.logger.debug("Deleting record"), this.logger.trace({ type: "method", method: "delete", id: i }), this.values.forEach((s) => { if (s.topic === n) { @@ -19459,7 +19459,7 @@ class mV extends Yk { }, this.logger = ci(r, this.name); } get context() { - return Si(this.logger); + return Ai(this.logger); } get storageKey() { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; @@ -19477,7 +19477,7 @@ class mV extends Yk { const e = []; return this.values.forEach((r) => { if (typeof r.response < "u") return; - const n = { topic: r.topic, request: ga(r.request.method, r.request.params, r.id), chainId: r.chainId }; + const n = { topic: r.topic, request: da(r.request.method, r.request.params, r.id), chainId: r.chainId }; return e.push(n); }), e; } @@ -19544,9 +19544,9 @@ class mV extends Yk { } } } -class vV extends t$ { +class bV extends r$ { constructor(e, r) { - super(e, r), this.core = e, this.logger = r, this.expirations = /* @__PURE__ */ new Map(), this.events = new ns.EventEmitter(), this.name = gH, this.version = mH, this.cached = [], this.initialized = !1, this.storagePrefix = eo, this.init = async () => { + super(e, r), this.core = e, this.logger = r, this.expirations = /* @__PURE__ */ new Map(), this.events = new rs.EventEmitter(), this.name = mH, this.version = vH, this.cached = [], this.initialized = !1, this.storagePrefix = Qs, this.init = async () => { this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((n) => this.expirations.set(n.target, n)), this.cached = [], this.registerEventListeners(), this.initialized = !0); }, this.has = (n) => { try { @@ -19558,7 +19558,7 @@ class vV extends t$ { }, this.set = (n, i) => { this.isInitialized(); const s = this.formatTarget(n), o = { target: s, expiry: i }; - this.expirations.set(s, o), this.checkExpiry(s, o), this.events.emit(Xi.created, { target: s, expiration: o }); + this.expirations.set(s, o), this.checkExpiry(s, o), this.events.emit(Ji.created, { target: s, expiration: o }); }, this.get = (n) => { this.isInitialized(); const i = this.formatTarget(n); @@ -19566,7 +19566,7 @@ class vV extends t$ { }, this.del = (n) => { if (this.isInitialized(), this.has(n)) { const i = this.formatTarget(n), s = this.getExpiration(i); - this.expirations.delete(i), this.events.emit(Xi.deleted, { target: i, expiration: s }); + this.expirations.delete(i), this.events.emit(Ji.deleted, { target: i, expiration: s }); } }, this.on = (n, i) => { this.events.on(n, i); @@ -19579,7 +19579,7 @@ class vV extends t$ { }, this.logger = ci(r, this.name); } get context() { - return Si(this.logger); + return Ai(this.logger); } get storageKey() { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; @@ -19594,8 +19594,8 @@ class vV extends t$ { return Array.from(this.expirations.values()); } formatTarget(e) { - if (typeof e == "string") return Wq(e); - if (typeof e == "number") return Hq(e); + if (typeof e == "string") return Hq(e); + if (typeof e == "number") return Kq(e); const { message: r } = ft("UNKNOWN_TYPE", `Target type: ${typeof e}`); throw new Error(r); } @@ -19606,7 +19606,7 @@ class vV extends t$ { return await this.core.storage.getItem(this.storageKey); } async persist() { - await this.setExpirations(this.values), this.events.emit(Xi.sync); + await this.setExpirations(this.values), this.events.emit(Ji.sync); } async restore() { try { @@ -19634,20 +19634,20 @@ class vV extends t$ { mt.toMiliseconds(n) - Date.now() <= 0 && this.expire(e, r); } expire(e, r) { - this.expirations.delete(e), this.events.emit(Xi.expired, { target: e, expiration: r }); + this.expirations.delete(e), this.events.emit(Ji.expired, { target: e, expiration: r }); } checkExpirations() { this.core.relayer.connected && this.expirations.forEach((e, r) => this.checkExpiry(r, e)); } registerEventListeners() { - this.core.heartbeat.on(Ou.pulse, () => this.checkExpirations()), this.events.on(Xi.created, (e) => { - const r = Xi.created; + this.core.heartbeat.on(Ou.pulse, () => this.checkExpirations()), this.events.on(Ji.created, (e) => { + const r = Ji.created; this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), this.persist(); - }), this.events.on(Xi.expired, (e) => { - const r = Xi.expired; + }), this.events.on(Ji.expired, (e) => { + const r = Ji.expired; this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), this.persist(); - }), this.events.on(Xi.deleted, (e) => { - const r = Xi.deleted; + }), this.events.on(Ji.deleted, (e) => { + const r = Ji.deleted; this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), this.persist(); }); } @@ -19658,9 +19658,9 @@ class vV extends t$ { } } } -class bV extends r$ { +class yV extends n$ { constructor(e, r, n) { - super(e, r, n), this.core = e, this.logger = r, this.store = n, this.name = vH, this.verifyUrlV3 = yH, this.storagePrefix = eo, this.version = nE, this.init = async () => { + super(e, r, n), this.core = e, this.logger = r, this.store = n, this.name = bH, this.verifyUrlV3 = wH, this.storagePrefix = Qs, this.version = tE, this.init = async () => { var i; this.isDevEnv || (this.publicKey = await this.store.getItem(this.storeKey), this.publicKey && mt.toMiliseconds((i = this.publicKey) == null ? void 0 : i.expiresAt) < Date.now() && (this.logger.debug("verify v2 public key expired"), await this.removePublicKey())); }, this.register = async (i) => { @@ -19668,21 +19668,21 @@ class bV extends r$ { const s = window.location.origin, { id: o, decryptedId: a } = i, u = `${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`; try { const l = Kl(), d = this.startAbortTimer(mt.ONE_SECOND * 5), p = await new Promise((w, A) => { - const P = () => { + const M = () => { window.removeEventListener("message", L), l.body.removeChild(N), A("attestation aborted"); }; - this.abortController.signal.addEventListener("abort", P); + this.abortController.signal.addEventListener("abort", M); const N = l.createElement("iframe"); - N.src = u, N.style.display = "none", N.addEventListener("error", P, { signal: this.abortController.signal }); - const L = ($) => { - if ($.data && typeof $.data == "string") try { - const B = JSON.parse($.data); - if (B.type === "verify_attestation") { - if (v1(B.attestation).payload.id !== o) return; - clearInterval(d), l.body.removeChild(N), this.abortController.signal.removeEventListener("abort", P), window.removeEventListener("message", L), w(B.attestation === null ? "" : B.attestation); + N.src = u, N.style.display = "none", N.addEventListener("error", M, { signal: this.abortController.signal }); + const L = (B) => { + if (B.data && typeof B.data == "string") try { + const $ = JSON.parse(B.data); + if ($.type === "verify_attestation") { + if (v1($.attestation).payload.id !== o) return; + clearInterval(d), l.body.removeChild(N), this.abortController.signal.removeEventListener("abort", M), window.removeEventListener("message", L), w($.attestation === null ? "" : $.attestation); } - } catch (B) { - this.logger.warn(B); + } catch ($) { + this.logger.warn($); } }; l.body.appendChild(N), window.addEventListener("message", L, { signal: this.abortController.signal }); @@ -19719,7 +19719,7 @@ class bV extends r$ { return clearTimeout(o), a.status === 200 ? await a.json() : void 0; }, this.getVerifyUrl = (i) => { let s = i || Wf; - return wH.includes(s) || (this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Wf}`), s = Wf), s; + return xH.includes(s) || (this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Wf}`), s = Wf), s; }, this.fetchPublicKey = async () => { try { this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`); @@ -19754,7 +19754,7 @@ class bV extends r$ { const i = await this.fetchPromise; return this.fetchPromise = void 0, i; }, this.validateAttestation = (i, s) => { - const o = Rz(i, s.publicKey), a = { hasExpired: mt.toMiliseconds(o.exp) < Date.now(), payload: o }; + const o = Dz(i, s.publicKey), a = { hasExpired: mt.toMiliseconds(o.exp) < Date.now(), payload: o }; if (a.hasExpired) throw this.logger.warn("resolve: jwt attestation expired"), new Error("JWT attestation expired"); return { origin: a.payload.origin, isScam: a.payload.isScam, isVerified: a.payload.isVerified }; }, this.logger = ci(r, this.name), this.abortController = new AbortController(), this.isDevEnv = ib(), this.init(); @@ -19763,36 +19763,36 @@ class bV extends r$ { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//verify:public:key"; } get context() { - return Si(this.logger); + return Ai(this.logger); } startAbortTimer(e) { return this.abortController = new AbortController(), setTimeout(() => this.abortController.abort(), mt.toMiliseconds(e)); } } -class yV extends n$ { +class wV extends i$ { constructor(e, r) { - super(e, r), this.projectId = e, this.logger = r, this.context = xH, this.registerDeviceToken = async (n) => { - const { clientId: i, token: s, notificationType: o, enableEncrypted: a = !1 } = n, u = `${_H}/${this.projectId}/clients`; + super(e, r), this.projectId = e, this.logger = r, this.context = _H, this.registerDeviceToken = async (n) => { + const { clientId: i, token: s, notificationType: o, enableEncrypted: a = !1 } = n, u = `${EH}/${this.projectId}/clients`; await fetch(u, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ client_id: i, type: o, token: s, always_raw: a }) }); }, this.logger = ci(r, this.context); } } -var wV = Object.defineProperty, T3 = Object.getOwnPropertySymbols, xV = Object.prototype.hasOwnProperty, _V = Object.prototype.propertyIsEnumerable, R3 = (t, e, r) => e in t ? wV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Tf = (t, e) => { - for (var r in e || (e = {})) xV.call(e, r) && R3(t, r, e[r]); - if (T3) for (var r of T3(e)) _V.call(e, r) && R3(t, r, e[r]); +var xV = Object.defineProperty, I3 = Object.getOwnPropertySymbols, _V = Object.prototype.hasOwnProperty, EV = Object.prototype.propertyIsEnumerable, C3 = (t, e, r) => e in t ? xV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Tf = (t, e) => { + for (var r in e || (e = {})) _V.call(e, r) && C3(t, r, e[r]); + if (I3) for (var r of I3(e)) EV.call(e, r) && C3(t, r, e[r]); return t; }; -class EV extends i$ { +class SV extends s$ { constructor(e, r, n = !0) { - super(e, r, n), this.core = e, this.logger = r, this.context = SH, this.storagePrefix = eo, this.storageVersion = EH, this.events = /* @__PURE__ */ new Map(), this.shouldPersist = !1, this.init = async () => { + super(e, r, n), this.core = e, this.logger = r, this.context = AH, this.storagePrefix = Qs, this.storageVersion = SH, this.events = /* @__PURE__ */ new Map(), this.shouldPersist = !1, this.init = async () => { if (!ib()) try { - const i = { eventId: Ux(), timestamp: Date.now(), domain: this.getAppDomain(), props: { event: "INIT", type: "", properties: { client_id: await this.core.crypto.getClientId(), user_agent: L8(this.core.relayer.protocol, this.core.relayer.version, T1) } } }; + const i = { eventId: Fx(), timestamp: Date.now(), domain: this.getAppDomain(), props: { event: "INIT", type: "", properties: { client_id: await this.core.crypto.getClientId(), user_agent: O8(this.core.relayer.protocol, this.core.relayer.version, T1) } } }; await this.sendEvent([i]); } catch (i) { this.logger.warn(i); } }, this.createEvent = (i) => { - const { event: s = "ERROR", type: o = "", properties: { topic: a, trace: u } } = i, l = Ux(), d = this.core.projectId || "", p = Date.now(), w = Tf({ eventId: l, timestamp: p, props: { event: s, type: o, properties: { topic: a, trace: u } }, bundleId: d, domain: this.getAppDomain() }, this.setMethods(l)); + const { event: s = "ERROR", type: o = "", properties: { topic: a, trace: u } } = i, l = Fx(), d = this.core.projectId || "", p = Date.now(), w = Tf({ eventId: l, timestamp: p, props: { event: s, type: o, properties: { topic: a, trace: u } }, bundleId: d, domain: this.getAppDomain() }, this.setMethods(l)); return this.telemetryEnabled && (this.events.set(l, w), this.shouldPersist = !0), w; }, this.getEvent = (i) => { const { eventId: s, topic: o } = i; @@ -19805,7 +19805,7 @@ class EV extends i$ { }, this.setEventListeners = () => { this.core.heartbeat.on(Ou.pulse, async () => { this.shouldPersist && await this.persist(), this.events.forEach((i) => { - mt.fromMiliseconds(Date.now()) - mt.fromMiliseconds(i.timestamp) > AH && (this.events.delete(i.eventId), this.shouldPersist = !0); + mt.fromMiliseconds(Date.now()) - mt.fromMiliseconds(i.timestamp) > PH && (this.events.delete(i.eventId), this.shouldPersist = !0); }); }); }, this.setMethods = (i) => ({ addTrace: (s) => this.addTrace(i, s), setError: (s) => this.setError(i, s) }), this.addTrace = (i, s) => { @@ -19837,8 +19837,8 @@ class EV extends i$ { } }, this.sendEvent = async (i) => { const s = this.getAppDomain() ? "" : "&sp=desktop"; - return await fetch(`${PH}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${T1}${s}`, { method: "POST", body: JSON.stringify(i) }); - }, this.getAppDomain = () => N8().url, this.logger = ci(r, this.context), this.telemetryEnabled = n, n ? this.restore().then(async () => { + return await fetch(`${MH}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${T1}${s}`, { method: "POST", body: JSON.stringify(i) }); + }, this.getAppDomain = () => D8().url, this.logger = ci(r, this.context), this.telemetryEnabled = n, n ? this.restore().then(async () => { await this.submit(), this.setEventListeners(); }) : this.persist(); } @@ -19846,33 +19846,33 @@ class EV extends i$ { return this.storagePrefix + this.storageVersion + this.core.customStoragePrefix + "//" + this.context; } } -var SV = Object.defineProperty, D3 = Object.getOwnPropertySymbols, AV = Object.prototype.hasOwnProperty, PV = Object.prototype.propertyIsEnumerable, O3 = (t, e, r) => e in t ? SV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, N3 = (t, e) => { - for (var r in e || (e = {})) AV.call(e, r) && O3(t, r, e[r]); - if (D3) for (var r of D3(e)) PV.call(e, r) && O3(t, r, e[r]); +var AV = Object.defineProperty, T3 = Object.getOwnPropertySymbols, PV = Object.prototype.hasOwnProperty, MV = Object.prototype.propertyIsEnumerable, R3 = (t, e, r) => e in t ? AV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, D3 = (t, e) => { + for (var r in e || (e = {})) PV.call(e, r) && R3(t, r, e[r]); + if (T3) for (var r of T3(e)) MV.call(e, r) && R3(t, r, e[r]); return t; }; -class lb extends Gk { +class lb extends Yk { constructor(e) { var r; - super(e), this.protocol = rE, this.version = nE, this.name = iE, this.events = new ns.EventEmitter(), this.initialized = !1, this.on = (o, a) => this.events.on(o, a), this.once = (o, a) => this.events.once(o, a), this.off = (o, a) => this.events.off(o, a), this.removeListener = (o, a) => this.events.removeListener(o, a), this.dispatchEnvelope = ({ topic: o, message: a, sessionExists: u }) => { + super(e), this.protocol = eE, this.version = tE, this.name = rE, this.events = new rs.EventEmitter(), this.initialized = !1, this.on = (o, a) => this.events.on(o, a), this.once = (o, a) => this.events.once(o, a), this.off = (o, a) => this.events.off(o, a), this.removeListener = (o, a) => this.events.removeListener(o, a), this.dispatchEnvelope = ({ topic: o, message: a, sessionExists: u }) => { if (!o || !a) return; const l = { topic: o, message: a, publishedAt: Date.now(), transportType: zr.link_mode }; this.relayer.onLinkMessageEvent(l, { sessionExists: u }); - }, this.projectId = e == null ? void 0 : e.projectId, this.relayUrl = (e == null ? void 0 : e.relayUrl) || oE, this.customStoragePrefix = e != null && e.customStoragePrefix ? `:${e.customStoragePrefix}` : ""; - const n = $0({ level: typeof (e == null ? void 0 : e.logger) == "string" && e.logger ? e.logger : KW.logger }), { logger: i, chunkLoggerController: s } = Vk({ opts: n, maxSizeInBytes: e == null ? void 0 : e.maxLogBlobSizeInBytes, loggerOverride: e == null ? void 0 : e.logger }); + }, this.projectId = e == null ? void 0 : e.projectId, this.relayUrl = (e == null ? void 0 : e.relayUrl) || iE, this.customStoragePrefix = e != null && e.customStoragePrefix ? `:${e.customStoragePrefix}` : ""; + const n = $0({ level: typeof (e == null ? void 0 : e.logger) == "string" && e.logger ? e.logger : VW.logger }), { logger: i, chunkLoggerController: s } = Gk({ opts: n, maxSizeInBytes: e == null ? void 0 : e.maxLogBlobSizeInBytes, loggerOverride: e == null ? void 0 : e.logger }); this.logChunkController = s, (r = this.logChunkController) != null && r.downloadLogsBlobInBrowser && (window.downloadLogsBlobInBrowser = async () => { var o, a; (o = this.logChunkController) != null && o.downloadLogsBlobInBrowser && ((a = this.logChunkController) == null || a.downloadLogsBlobInBrowser({ clientId: await this.crypto.getClientId() })); - }), this.logger = ci(i, this.name), this.heartbeat = new UL(), this.crypto = new ZK(this, this.logger, e == null ? void 0 : e.keychain), this.history = new mV(this, this.logger), this.expirer = new vV(this, this.logger), this.storage = e != null && e.storage ? e.storage : new yk(N3(N3({}, VW), e == null ? void 0 : e.storageOptions)), this.relayer = new lV({ core: this, logger: this.logger, relayUrl: this.relayUrl, projectId: this.projectId }), this.pairing = new gV(this, this.logger), this.verify = new bV(this, this.logger, this.storage), this.echoClient = new yV(this.projectId || "", this.logger), this.linkModeSupportedApps = [], this.eventClient = new EV(this, this.logger, e == null ? void 0 : e.telemetryEnabled); + }), this.logger = ci(i, this.name), this.heartbeat = new qL(), this.crypto = new QK(this, this.logger, e == null ? void 0 : e.keychain), this.history = new vV(this, this.logger), this.expirer = new bV(this, this.logger), this.storage = e != null && e.storage ? e.storage : new wk(D3(D3({}, GW), e == null ? void 0 : e.storageOptions)), this.relayer = new hV({ core: this, logger: this.logger, relayUrl: this.relayUrl, projectId: this.projectId }), this.pairing = new mV(this, this.logger), this.verify = new yV(this, this.logger, this.storage), this.echoClient = new wV(this.projectId || "", this.logger), this.linkModeSupportedApps = [], this.eventClient = new SV(this, this.logger, e == null ? void 0 : e.telemetryEnabled); } static async init(e) { const r = new lb(e); await r.initialize(); const n = await r.crypto.getClientId(); - return await r.storage.setItem(aH, n), r; + return await r.storage.setItem(cH, n), r; } get context() { - return Si(this.logger); + return Ai(this.logger); } async start() { this.initialized || await this.initialize(); @@ -19882,26 +19882,26 @@ class lb extends Gk { return (e = this.logChunkController) == null ? void 0 : e.logsToBlob({ clientId: await this.crypto.getClientId() }); } async addLinkModeSupportedApp(e) { - this.linkModeSupportedApps.includes(e) || (this.linkModeSupportedApps.push(e), await this.storage.setItem(g3, this.linkModeSupportedApps)); + this.linkModeSupportedApps.includes(e) || (this.linkModeSupportedApps.push(e), await this.storage.setItem(d3, this.linkModeSupportedApps)); } async initialize() { this.logger.trace("Initialized"); try { - await this.crypto.init(), await this.history.init(), await this.expirer.init(), await this.relayer.init(), await this.heartbeat.init(), await this.pairing.init(), this.eventClient.init(), this.linkModeSupportedApps = await this.storage.getItem(g3) || [], this.initialized = !0, this.logger.info("Core Initialization Success"); + await this.crypto.init(), await this.history.init(), await this.expirer.init(), await this.relayer.init(), await this.heartbeat.init(), await this.pairing.init(), this.eventClient.init(), this.linkModeSupportedApps = await this.storage.getItem(d3) || [], this.initialized = !0, this.logger.info("Core Initialization Success"); } catch (e) { throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`, e), this.logger.error(e.message), e; } } } -const MV = lb, bE = "wc", yE = 2, wE = "client", hb = `${bE}@${yE}:${wE}:`, mm = { name: wE, logger: "error" }, L3 = "WALLETCONNECT_DEEPLINK_CHOICE", IV = "proposal", xE = "Proposal expired", CV = "session", Kc = mt.SEVEN_DAYS, TV = "engine", In = { wc_sessionPropose: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1100 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1101 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1120 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1121 } }, wc_sessionSettle: { req: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1102 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1103 } }, wc_sessionUpdate: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1104 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1105 } }, wc_sessionExtend: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1106 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1107 } }, wc_sessionRequest: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1108 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1109 } }, wc_sessionEvent: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1110 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1111 } }, wc_sessionDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1112 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1113 } }, wc_sessionPing: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1114 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1115 } }, wc_sessionAuthenticate: { req: { ttl: mt.ONE_HOUR, prompt: !0, tag: 1116 }, res: { ttl: mt.ONE_HOUR, prompt: !1, tag: 1117 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1118 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1119 } } }, vm = { min: mt.FIVE_MINUTES, max: mt.SEVEN_DAYS }, ks = { idle: "IDLE", active: "ACTIVE" }, RV = "request", DV = ["wc_sessionPropose", "wc_sessionRequest", "wc_authRequest", "wc_sessionAuthenticate"], OV = "wc", NV = "auth", LV = "authKeys", kV = "pairingTopics", $V = "requests", op = `${OV}@${1.5}:${NV}:`, Rd = `${op}:PUB_KEY`; -var BV = Object.defineProperty, FV = Object.defineProperties, jV = Object.getOwnPropertyDescriptors, k3 = Object.getOwnPropertySymbols, UV = Object.prototype.hasOwnProperty, qV = Object.prototype.propertyIsEnumerable, $3 = (t, e, r) => e in t ? BV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, tn = (t, e) => { - for (var r in e || (e = {})) UV.call(e, r) && $3(t, r, e[r]); - if (k3) for (var r of k3(e)) qV.call(e, r) && $3(t, r, e[r]); +const IV = lb, mE = "wc", vE = 2, bE = "client", hb = `${mE}@${vE}:${bE}:`, mm = { name: bE, logger: "error" }, O3 = "WALLETCONNECT_DEEPLINK_CHOICE", CV = "proposal", yE = "Proposal expired", TV = "session", Kc = mt.SEVEN_DAYS, RV = "engine", In = { wc_sessionPropose: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1100 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1101 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1120 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1121 } }, wc_sessionSettle: { req: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1102 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1103 } }, wc_sessionUpdate: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1104 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1105 } }, wc_sessionExtend: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1106 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1107 } }, wc_sessionRequest: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1108 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1109 } }, wc_sessionEvent: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1110 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1111 } }, wc_sessionDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1112 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1113 } }, wc_sessionPing: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1114 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1115 } }, wc_sessionAuthenticate: { req: { ttl: mt.ONE_HOUR, prompt: !0, tag: 1116 }, res: { ttl: mt.ONE_HOUR, prompt: !1, tag: 1117 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1118 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1119 } } }, vm = { min: mt.FIVE_MINUTES, max: mt.SEVEN_DAYS }, ks = { idle: "IDLE", active: "ACTIVE" }, DV = "request", OV = ["wc_sessionPropose", "wc_sessionRequest", "wc_authRequest", "wc_sessionAuthenticate"], NV = "wc", LV = "auth", kV = "authKeys", $V = "pairingTopics", BV = "requests", op = `${NV}@${1.5}:${LV}:`, Rd = `${op}:PUB_KEY`; +var FV = Object.defineProperty, jV = Object.defineProperties, UV = Object.getOwnPropertyDescriptors, N3 = Object.getOwnPropertySymbols, qV = Object.prototype.hasOwnProperty, zV = Object.prototype.propertyIsEnumerable, L3 = (t, e, r) => e in t ? FV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, tn = (t, e) => { + for (var r in e || (e = {})) qV.call(e, r) && L3(t, r, e[r]); + if (N3) for (var r of N3(e)) zV.call(e, r) && L3(t, r, e[r]); return t; -}, bs = (t, e) => FV(t, jV(e)); -class zV extends o$ { +}, bs = (t, e) => jV(t, UV(e)); +class WV extends a$ { constructor(e) { - super(e), this.name = TV, this.events = new kv(), this.initialized = !1, this.requestQueue = { state: ks.idle, queue: [] }, this.sessionRequestQueue = { state: ks.idle, queue: [] }, this.requestQueueDelay = mt.ONE_SECOND, this.expectedPairingMethodMap = /* @__PURE__ */ new Map(), this.recentlyDeletedMap = /* @__PURE__ */ new Map(), this.recentlyDeletedLimit = 200, this.relayMessageCache = [], this.init = async () => { + super(e), this.name = RV, this.events = new kv(), this.initialized = !1, this.requestQueue = { state: ks.idle, queue: [] }, this.sessionRequestQueue = { state: ks.idle, queue: [] }, this.requestQueueDelay = mt.ONE_SECOND, this.expectedPairingMethodMap = /* @__PURE__ */ new Map(), this.recentlyDeletedMap = /* @__PURE__ */ new Map(), this.recentlyDeletedLimit = 200, this.relayMessageCache = [], this.init = async () => { this.initialized || (await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.registerPairingEvents(), await this.registerLinkModeListeners(), this.client.core.pairing.register({ methods: Object.keys(In) }), this.initialized = !0, setTimeout(() => { this.sessionRequestQueue.queue = this.getPendingSessionRequests(), this.processSessionRequestQueue(); }, mt.toMiliseconds(this.requestQueueDelay))); @@ -19924,17 +19924,17 @@ class zV extends o$ { const { message: W } = ft("NO_MATCHING_KEY", `connect() pairing topic: ${l}`); throw new Error(W); } - const w = await this.client.core.crypto.generateKeyPair(), A = In.wc_sessionPropose.req.ttl || mt.FIVE_MINUTES, P = En(A), N = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: u ?? [{ protocol: sE }], proposer: { publicKey: w, metadata: this.client.metadata }, expiryTimestamp: P, pairingTopic: l }, a && { sessionProperties: a }), { reject: L, resolve: $, done: B } = Ja(A, xE); + const w = await this.client.core.crypto.generateKeyPair(), A = In.wc_sessionPropose.req.ttl || mt.FIVE_MINUTES, M = En(A), N = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: u ?? [{ protocol: nE }], proposer: { publicKey: w, metadata: this.client.metadata }, expiryTimestamp: M, pairingTopic: l }, a && { sessionProperties: a }), { reject: L, resolve: B, done: $ } = Ga(A, yE); this.events.once(br("session_connect"), async ({ error: W, session: V }) => { if (W) L(W); else if (V) { V.self.publicKey = w; const te = bs(tn({}, V), { pairingTopic: N.pairingTopic, requiredNamespaces: N.requiredNamespaces, optionalNamespaces: N.optionalNamespaces, transportType: zr.relay }); - await this.client.session.set(V.topic, te), await this.setExpiry(V.topic, V.expiry), l && await this.client.core.pairing.updateMetadata({ topic: l, metadata: V.peer.metadata }), this.cleanupDuplicatePairings(te), $(te); + await this.client.session.set(V.topic, te), await this.setExpiry(V.topic, V.expiry), l && await this.client.core.pairing.updateMetadata({ topic: l, metadata: V.peer.metadata }), this.cleanupDuplicatePairings(te), B(te); } }); const H = await this.sendRequest({ topic: l, method: "wc_sessionPropose", params: N, throwOnFailedPublish: !0 }); - return await this.setProposal(H, tn({ id: H }, N)), { uri: d, approval: B }; + return await this.setProposal(H, tn({ id: H }, N)), { uri: d, approval: $ }; }, this.pair = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); try { @@ -19948,43 +19948,43 @@ class zV extends o$ { try { this.isInitialized(), await this.confirmOnlineStateOrThrow(); } catch (K) { - throw o.setError(Va.no_internet_connection), K; + throw o.setError(Ha.no_internet_connection), K; } try { await this.isValidProposalId(r == null ? void 0 : r.id); } catch (K) { - throw this.client.logger.error(`approve() -> proposal.get(${r == null ? void 0 : r.id}) failed`), o.setError(Va.proposal_not_found), K; + throw this.client.logger.error(`approve() -> proposal.get(${r == null ? void 0 : r.id}) failed`), o.setError(Ha.proposal_not_found), K; } try { await this.isValidApprove(r); } catch (K) { - throw this.client.logger.error("approve() -> isValidApprove() failed"), o.setError(Va.session_approve_namespace_validation_failure), K; + throw this.client.logger.error("approve() -> isValidApprove() failed"), o.setError(Ha.session_approve_namespace_validation_failure), K; } const { id: a, relayProtocol: u, namespaces: l, sessionProperties: d, sessionConfig: p } = r, w = this.client.proposal.get(a); this.client.core.eventClient.deleteEvent({ eventId: o.eventId }); - const { pairingTopic: A, proposer: P, requiredNamespaces: N, optionalNamespaces: L } = w; - let $ = (i = this.client.core.eventClient) == null ? void 0 : i.getEvent({ topic: A }); - $ || ($ = (s = this.client.core.eventClient) == null ? void 0 : s.createEvent({ type: vs.session_approve_started, properties: { topic: A, trace: [vs.session_approve_started, vs.session_namespaces_validation_success] } })); - const B = await this.client.core.crypto.generateKeyPair(), H = P.publicKey, W = await this.client.core.crypto.generateSharedKey(B, H), V = tn(tn({ relay: { protocol: u ?? "irn" }, namespaces: l, controller: { publicKey: B, metadata: this.client.metadata }, expiry: En(Kc) }, d && { sessionProperties: d }), p && { sessionConfig: p }), te = zr.relay; - $.addTrace(vs.subscribing_session_topic); + const { pairingTopic: A, proposer: M, requiredNamespaces: N, optionalNamespaces: L } = w; + let B = (i = this.client.core.eventClient) == null ? void 0 : i.getEvent({ topic: A }); + B || (B = (s = this.client.core.eventClient) == null ? void 0 : s.createEvent({ type: vs.session_approve_started, properties: { topic: A, trace: [vs.session_approve_started, vs.session_namespaces_validation_success] } })); + const $ = await this.client.core.crypto.generateKeyPair(), H = M.publicKey, W = await this.client.core.crypto.generateSharedKey($, H), V = tn(tn({ relay: { protocol: u ?? "irn" }, namespaces: l, controller: { publicKey: $, metadata: this.client.metadata }, expiry: En(Kc) }, d && { sessionProperties: d }), p && { sessionConfig: p }), te = zr.relay; + B.addTrace(vs.subscribing_session_topic); try { await this.client.core.relayer.subscribe(W, { transportType: te }); } catch (K) { - throw $.setError(Va.subscribe_session_topic_failure), K; + throw B.setError(Ha.subscribe_session_topic_failure), K; } - $.addTrace(vs.subscribe_session_topic_success); - const R = bs(tn({}, V), { topic: W, requiredNamespaces: N, optionalNamespaces: L, pairingTopic: A, acknowledged: !1, self: V.controller, peer: { publicKey: P.publicKey, metadata: P.metadata }, controller: B, transportType: zr.relay }); - await this.client.session.set(W, R), $.addTrace(vs.store_session); + B.addTrace(vs.subscribe_session_topic_success); + const R = bs(tn({}, V), { topic: W, requiredNamespaces: N, optionalNamespaces: L, pairingTopic: A, acknowledged: !1, self: V.controller, peer: { publicKey: M.publicKey, metadata: M.metadata }, controller: $, transportType: zr.relay }); + await this.client.session.set(W, R), B.addTrace(vs.store_session); try { - $.addTrace(vs.publishing_session_settle), await this.sendRequest({ topic: W, method: "wc_sessionSettle", params: V, throwOnFailedPublish: !0 }).catch((K) => { - throw $ == null || $.setError(Va.session_settle_publish_failure), K; - }), $.addTrace(vs.session_settle_publish_success), $.addTrace(vs.publishing_session_approve), await this.sendResult({ id: a, topic: A, result: { relay: { protocol: u ?? "irn" }, responderPublicKey: B }, throwOnFailedPublish: !0 }).catch((K) => { - throw $ == null || $.setError(Va.session_approve_publish_failure), K; - }), $.addTrace(vs.session_approve_publish_success); + B.addTrace(vs.publishing_session_settle), await this.sendRequest({ topic: W, method: "wc_sessionSettle", params: V, throwOnFailedPublish: !0 }).catch((K) => { + throw B == null || B.setError(Ha.session_settle_publish_failure), K; + }), B.addTrace(vs.session_settle_publish_success), B.addTrace(vs.publishing_session_approve), await this.sendResult({ id: a, topic: A, result: { relay: { protocol: u ?? "irn" }, responderPublicKey: $ }, throwOnFailedPublish: !0 }).catch((K) => { + throw B == null || B.setError(Ha.session_approve_publish_failure), K; + }), B.addTrace(vs.session_approve_publish_success); } catch (K) { throw this.client.logger.error(K), this.client.session.delete(W, Or("USER_DISCONNECTED")), await this.client.core.relayer.unsubscribe(W), K; } - return this.client.core.eventClient.deleteEvent({ eventId: $.eventId }), await this.client.core.pairing.updateMetadata({ topic: A, metadata: P.metadata }), await this.client.proposal.delete(a, Or("USER_DISCONNECTED")), await this.client.core.pairing.activate({ topic: A }), await this.setExpiry(W, En(Kc)), { topic: W, acknowledged: () => Promise.resolve(this.client.session.get(W)) }; + return this.client.core.eventClient.deleteEvent({ eventId: B.eventId }), await this.client.core.pairing.updateMetadata({ topic: A, metadata: M.metadata }), await this.client.proposal.delete(a, Or("USER_DISCONNECTED")), await this.client.core.pairing.activate({ topic: A }), await this.setExpiry(W, En(Kc)), { topic: W, acknowledged: () => Promise.resolve(this.client.session.get(W)) }; }, this.reject = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); try { @@ -20007,7 +20007,7 @@ class zV extends o$ { } catch (p) { throw this.client.logger.error("update() -> isValidUpdate() failed"), p; } - const { topic: n, namespaces: i } = r, { done: s, resolve: o, reject: a } = Ja(), u = la(), l = ic().toString(), d = this.client.session.get(n).namespaces; + const { topic: n, namespaces: i } = r, { done: s, resolve: o, reject: a } = Ga(), u = ua(), l = nc().toString(), d = this.client.session.get(n).namespaces; return this.events.once(br("session_update", u), ({ error: p }) => { p ? a(p) : o(); }), await this.client.session.update(n, { namespaces: i }), await this.sendRequest({ topic: n, method: "wc_sessionUpdate", params: { namespaces: i }, throwOnFailedPublish: !0, clientRpcId: u, relayRpcId: l }).catch((p) => { @@ -20020,7 +20020,7 @@ class zV extends o$ { } catch (u) { throw this.client.logger.error("extend() -> isValidExtend() failed"), u; } - const { topic: n } = r, i = la(), { done: s, resolve: o, reject: a } = Ja(); + const { topic: n } = r, i = ua(), { done: s, resolve: o, reject: a } = Ga(); return this.events.once(br("session_extend", i), ({ error: u }) => { u ? a(u) : o(); }), await this.setExpiry(n, En(Kc)), this.sendRequest({ topic: n, method: "wc_sessionExtend", params: {}, clientRpcId: i, throwOnFailedPublish: !0 }).catch((u) => { @@ -20030,32 +20030,32 @@ class zV extends o$ { this.isInitialized(); try { await this.isValidRequest(r); - } catch (P) { - throw this.client.logger.error("request() -> isValidRequest() failed"), P; + } catch (M) { + throw this.client.logger.error("request() -> isValidRequest() failed"), M; } const { chainId: n, request: i, topic: s, expiry: o = In.wc_sessionRequest.req.ttl } = r, a = this.client.session.get(s); (a == null ? void 0 : a.transportType) === zr.relay && await this.confirmOnlineStateOrThrow(); - const u = la(), l = ic().toString(), { done: d, resolve: p, reject: w } = Ja(o, "Request expired. Please try again."); - this.events.once(br("session_request", u), ({ error: P, result: N }) => { - P ? w(P) : p(N); + const u = ua(), l = nc().toString(), { done: d, resolve: p, reject: w } = Ga(o, "Request expired. Please try again."); + this.events.once(br("session_request", u), ({ error: M, result: N }) => { + M ? w(M) : p(N); }); const A = this.getAppLinkIfEnabled(a.peer.metadata, a.transportType); - return A ? (await this.sendRequest({ clientRpcId: u, relayRpcId: l, topic: s, method: "wc_sessionRequest", params: { request: bs(tn({}, i), { expiryTimestamp: En(o) }), chainId: n }, expiry: o, throwOnFailedPublish: !0, appLink: A }).catch((P) => w(P)), this.client.events.emit("session_request_sent", { topic: s, request: i, chainId: n, id: u }), await d()) : await Promise.all([new Promise(async (P) => { - await this.sendRequest({ clientRpcId: u, relayRpcId: l, topic: s, method: "wc_sessionRequest", params: { request: bs(tn({}, i), { expiryTimestamp: En(o) }), chainId: n }, expiry: o, throwOnFailedPublish: !0 }).catch((N) => w(N)), this.client.events.emit("session_request_sent", { topic: s, request: i, chainId: n, id: u }), P(); - }), new Promise(async (P) => { + return A ? (await this.sendRequest({ clientRpcId: u, relayRpcId: l, topic: s, method: "wc_sessionRequest", params: { request: bs(tn({}, i), { expiryTimestamp: En(o) }), chainId: n }, expiry: o, throwOnFailedPublish: !0, appLink: A }).catch((M) => w(M)), this.client.events.emit("session_request_sent", { topic: s, request: i, chainId: n, id: u }), await d()) : await Promise.all([new Promise(async (M) => { + await this.sendRequest({ clientRpcId: u, relayRpcId: l, topic: s, method: "wc_sessionRequest", params: { request: bs(tn({}, i), { expiryTimestamp: En(o) }), chainId: n }, expiry: o, throwOnFailedPublish: !0 }).catch((N) => w(N)), this.client.events.emit("session_request_sent", { topic: s, request: i, chainId: n, id: u }), M(); + }), new Promise(async (M) => { var N; if (!((N = a.sessionConfig) != null && N.disableDeepLink)) { - const L = await Gq(this.client.core.storage, L3); - await Kq({ id: u, topic: s, wcDeepLink: L }); + const L = await Yq(this.client.core.storage, O3); + await Vq({ id: u, topic: s, wcDeepLink: L }); } - P(); - }), d()]).then((P) => P[2]); + M(); + }), d()]).then((M) => M[2]); }, this.respond = async (r) => { this.isInitialized(), await this.isValidRespond(r); const { topic: n, response: i } = r, { id: s } = i, o = this.client.session.get(n); o.transportType === zr.relay && await this.confirmOnlineStateOrThrow(); const a = this.getAppLinkIfEnabled(o.peer.metadata, o.transportType); - js(i) ? await this.sendResult({ id: s, topic: n, result: i.result, throwOnFailedPublish: !0, appLink: a }) : Qi(i) && await this.sendError({ id: s, topic: n, error: i.error, appLink: a }), this.cleanupAfterResponse(r); + js(i) ? await this.sendResult({ id: s, topic: n, result: i.result, throwOnFailedPublish: !0, appLink: a }) : Zi(i) && await this.sendError({ id: s, topic: n, error: i.error, appLink: a }), this.cleanupAfterResponse(r); }, this.ping = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); try { @@ -20065,14 +20065,14 @@ class zV extends o$ { } const { topic: n } = r; if (this.client.session.keys.includes(n)) { - const i = la(), s = ic().toString(), { done: o, resolve: a, reject: u } = Ja(); + const i = ua(), s = nc().toString(), { done: o, resolve: a, reject: u } = Ga(); this.events.once(br("session_ping", i), ({ error: l }) => { l ? u(l) : a(); }), await Promise.all([this.sendRequest({ topic: n, method: "wc_sessionPing", params: {}, throwOnFailedPublish: !0, clientRpcId: i, relayRpcId: s }), o()]); } else this.client.core.pairing.pairings.keys.includes(n) && await this.client.core.pairing.ping({ topic: n }); }, this.emit = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(), await this.isValidEmit(r); - const { topic: n, event: i, chainId: s } = r, o = ic().toString(); + const { topic: n, event: i, chainId: s } = r, o = nc().toString(); await this.sendRequest({ topic: n, method: "wc_sessionEvent", params: { event: i, chainId: s }, throwOnFailedPublish: !0, relayRpcId: o }); }, this.disconnect = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(), await this.isValidDisconnect(r); @@ -20083,28 +20083,28 @@ class zV extends o$ { const { message: i } = ft("MISMATCHED_TOPIC", `Session or pairing topic not found: ${n}`); throw new Error(i); } - }, this.find = (r) => (this.isInitialized(), this.client.session.getAll().filter((n) => Gz(n, r))), this.getPendingSessionRequests = () => this.client.pendingRequest.getAll(), this.authenticate = async (r, n) => { + }, this.find = (r) => (this.isInitialized(), this.client.session.getAll().filter((n) => Yz(n, r))), this.getPendingSessionRequests = () => this.client.pendingRequest.getAll(), this.authenticate = async (r, n) => { var i; this.isInitialized(), this.isValidAuthenticate(r); const s = n && this.client.core.linkModeSupportedApps.includes(n) && ((i = this.client.metadata.redirect) == null ? void 0 : i.linkMode), o = s ? zr.link_mode : zr.relay; o === zr.relay && await this.confirmOnlineStateOrThrow(); - const { chains: a, statement: u = "", uri: l, domain: d, nonce: p, type: w, exp: A, nbf: P, methods: N = [], expiry: L } = r, $ = [...r.resources || []], { topic: B, uri: H } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); - this.client.logger.info({ message: "Generated new pairing", pairing: { topic: B, uri: H } }); + const { chains: a, statement: u = "", uri: l, domain: d, nonce: p, type: w, exp: A, nbf: M, methods: N = [], expiry: L } = r, B = [...r.resources || []], { topic: $, uri: H } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); + this.client.logger.info({ message: "Generated new pairing", pairing: { topic: $, uri: H } }); const W = await this.client.core.crypto.generateKeyPair(), V = Td(W); - if (await Promise.all([this.client.auth.authKeys.set(Rd, { responseTopic: V, publicKey: W }), this.client.auth.pairingTopics.set(V, { topic: V, pairingTopic: B })]), await this.client.core.relayer.subscribe(V, { transportType: o }), this.client.logger.info(`sending request to new pairing topic: ${B}`), N.length > 0) { + if (await Promise.all([this.client.auth.authKeys.set(Rd, { responseTopic: V, publicKey: W }), this.client.auth.pairingTopics.set(V, { topic: V, pairingTopic: $ })]), await this.client.core.relayer.subscribe(V, { transportType: o }), this.client.logger.info(`sending request to new pairing topic: ${$}`), N.length > 0) { const { namespace: _ } = hu(a[0]); - let E = gz(_, "request", N); - Cd($) && (E = vz(E, $.pop())), $.push(E); + let E = mz(_, "request", N); + Cd(B) && (E = bz(E, B.pop())), B.push(E); } - const te = L && L > In.wc_sessionAuthenticate.req.ttl ? L : In.wc_sessionAuthenticate.req.ttl, R = { authPayload: { type: w ?? "caip122", chains: a, statement: u, aud: l, domain: d, version: "1", nonce: p, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: A, nbf: P, resources: $ }, requester: { publicKey: W, metadata: this.client.metadata }, expiryTimestamp: En(te) }, K = { eip155: { chains: a, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...N])], events: ["chainChanged", "accountsChanged"] } }, ge = { requiredNamespaces: {}, optionalNamespaces: K, relays: [{ protocol: "irn" }], pairingTopic: B, proposer: { publicKey: W, metadata: this.client.metadata }, expiryTimestamp: En(In.wc_sessionPropose.req.ttl) }, { done: Ee, resolve: Y, reject: S } = Ja(te, "Request expired"), m = async ({ error: _, session: E }) => { + const te = L && L > In.wc_sessionAuthenticate.req.ttl ? L : In.wc_sessionAuthenticate.req.ttl, R = { authPayload: { type: w ?? "caip122", chains: a, statement: u, aud: l, domain: d, version: "1", nonce: p, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: A, nbf: M, resources: B }, requester: { publicKey: W, metadata: this.client.metadata }, expiryTimestamp: En(te) }, K = { eip155: { chains: a, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...N])], events: ["chainChanged", "accountsChanged"] } }, ge = { requiredNamespaces: {}, optionalNamespaces: K, relays: [{ protocol: "irn" }], pairingTopic: $, proposer: { publicKey: W, metadata: this.client.metadata }, expiryTimestamp: En(In.wc_sessionPropose.req.ttl) }, { done: Ee, resolve: Y, reject: S } = Ga(te, "Request expired"), m = async ({ error: _, session: E }) => { if (this.events.off(br("session_request", g), f), _) S(_); else if (E) { - E.self.publicKey = W, await this.client.session.set(E.topic, E), await this.setExpiry(E.topic, E.expiry), B && await this.client.core.pairing.updateMetadata({ topic: B, metadata: E.peer.metadata }); + E.self.publicKey = W, await this.client.session.set(E.topic, E), await this.setExpiry(E.topic, E.expiry), $ && await this.client.core.pairing.updateMetadata({ topic: $, metadata: E.peer.metadata }); const v = this.client.session.get(E.topic); await this.deleteProposal(b), Y({ session: v }); } }, f = async (_) => { - var E, v, M; + var E, v, P; if (await this.deletePendingAuthRequest(g, { message: "fulfilled", code: 0 }), _.error) { const J = Or("WC_METHOD_UNSUPPORTED", "wc_sessionAuthenticate"); return _.error.code === J.code ? void 0 : (this.events.off(br("session_connect"), m), S(_.error.message)); @@ -20112,33 +20112,33 @@ class zV extends o$ { await this.deleteProposal(b), this.events.off(br("session_connect"), m); const { cacaos: I, responder: F } = _.result, ce = [], D = []; for (const J of I) { - await Wx({ cacao: J, projectId: this.client.core.projectId }) || (this.client.logger.error(J, "Signature verification failed"), S(Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"))); + await qx({ cacao: J, projectId: this.client.core.projectId }) || (this.client.logger.error(J, "Signature verification failed"), S(Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"))); const { p: Q } = J, T = Cd(Q.resources), X = [M1(Q.iss)], re = u0(Q.iss); if (T) { - const pe = Hx(T), ie = Kx(T); - ce.push(...pe), X.push(...ie); + const de = zx(T), ie = Wx(T); + ce.push(...de), X.push(...ie); } - for (const pe of X) D.push(`${pe}:${re}`); + for (const de of X) D.push(`${de}:${re}`); } const oe = await this.client.core.crypto.generateSharedKey(W, F.publicKey); let Z; - ce.length > 0 && (Z = { topic: oe, acknowledged: !0, self: { publicKey: W, metadata: this.client.metadata }, peer: F, controller: F.publicKey, expiry: En(Kc), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: B, namespaces: t3([...new Set(ce)], [...new Set(D)]), transportType: o }, await this.client.core.relayer.subscribe(oe, { transportType: o }), await this.client.session.set(oe, Z), B && await this.client.core.pairing.updateMetadata({ topic: B, metadata: F.metadata }), Z = this.client.session.get(oe)), (E = this.client.metadata.redirect) != null && E.linkMode && (v = F.metadata.redirect) != null && v.linkMode && (M = F.metadata.redirect) != null && M.universal && n && (this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal), this.client.session.update(oe, { transportType: zr.link_mode })), Y({ auths: I, session: Z }); - }, g = la(), b = la(); + ce.length > 0 && (Z = { topic: oe, acknowledged: !0, self: { publicKey: W, metadata: this.client.metadata }, peer: F, controller: F.publicKey, expiry: En(Kc), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: $, namespaces: Qx([...new Set(ce)], [...new Set(D)]), transportType: o }, await this.client.core.relayer.subscribe(oe, { transportType: o }), await this.client.session.set(oe, Z), $ && await this.client.core.pairing.updateMetadata({ topic: $, metadata: F.metadata }), Z = this.client.session.get(oe)), (E = this.client.metadata.redirect) != null && E.linkMode && (v = F.metadata.redirect) != null && v.linkMode && (P = F.metadata.redirect) != null && P.universal && n && (this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal), this.client.session.update(oe, { transportType: zr.link_mode })), Y({ auths: I, session: Z }); + }, g = ua(), b = ua(); this.events.once(br("session_connect"), m), this.events.once(br("session_request", g), f); let x; try { if (s) { - const _ = ga("wc_sessionAuthenticate", R, g); - this.client.core.history.set(B, _); + const _ = da("wc_sessionAuthenticate", R, g); + this.client.core.history.set($, _); const E = await this.client.core.crypto.encode("", _, { type: th, encoding: Af }); - x = fd(n, B, E); - } else await Promise.all([this.sendRequest({ topic: B, method: "wc_sessionAuthenticate", params: R, expiry: r.expiry, throwOnFailedPublish: !0, clientRpcId: g }), this.sendRequest({ topic: B, method: "wc_sessionPropose", params: ge, expiry: In.wc_sessionPropose.req.ttl, throwOnFailedPublish: !0, clientRpcId: b })]); + x = fd(n, $, E); + } else await Promise.all([this.sendRequest({ topic: $, method: "wc_sessionAuthenticate", params: R, expiry: r.expiry, throwOnFailedPublish: !0, clientRpcId: g }), this.sendRequest({ topic: $, method: "wc_sessionPropose", params: ge, expiry: In.wc_sessionPropose.req.ttl, throwOnFailedPublish: !0, clientRpcId: b })]); } catch (_) { throw this.events.off(br("session_connect"), m), this.events.off(br("session_request", g), f), _; } - return await this.setProposal(b, tn({ id: b }, ge)), await this.setAuthRequest(g, { request: bs(tn({}, R), { verifyContext: {} }), pairingTopic: B, transportType: o }), { uri: x ?? H, response: Ee }; + return await this.setProposal(b, tn({ id: b }, ge)), await this.setAuthRequest(g, { request: bs(tn({}, R), { verifyContext: {} }), pairingTopic: $, transportType: o }), { uri: x ?? H, response: Ee }; }, this.approveSessionAuthenticate = async (r) => { - const { id: n, auths: i } = r, s = this.client.core.eventClient.createEvent({ properties: { topic: n.toString(), trace: [Ga.authenticated_session_approve_started] } }); + const { id: n, auths: i } = r, s = this.client.core.eventClient.createEvent({ properties: { topic: n.toString(), trace: [Ka.authenticated_session_approve_started] } }); try { this.isInitialized(); } catch (L) { @@ -20148,34 +20148,34 @@ class zV extends o$ { if (!o) throw s.setError(If.authenticated_session_pending_request_not_found), new Error(`Could not find pending auth request with id ${n}`); const a = o.transportType || zr.relay; a === zr.relay && await this.confirmOnlineStateOrThrow(); - const u = o.requester.publicKey, l = await this.client.core.crypto.generateKeyPair(), d = Td(u), p = { type: Ro, receiverPublicKey: u, senderPublicKey: l }, w = [], A = []; + const u = o.requester.publicKey, l = await this.client.core.crypto.generateKeyPair(), d = Td(u), p = { type: Co, receiverPublicKey: u, senderPublicKey: l }, w = [], A = []; for (const L of i) { - if (!await Wx({ cacao: L, projectId: this.client.core.projectId })) { + if (!await qx({ cacao: L, projectId: this.client.core.projectId })) { s.setError(If.invalid_cacao); const V = Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"); throw await this.sendError({ id: n, topic: d, error: V, encodeOpts: p }), new Error(V.message); } - s.addTrace(Ga.cacaos_verified); - const { p: $ } = L, B = Cd($.resources), H = [M1($.iss)], W = u0($.iss); - if (B) { - const V = Hx(B), te = Kx(B); + s.addTrace(Ka.cacaos_verified); + const { p: B } = L, $ = Cd(B.resources), H = [M1(B.iss)], W = u0(B.iss); + if ($) { + const V = zx($), te = Wx($); w.push(...V), H.push(...te); } for (const V of H) A.push(`${V}:${W}`); } - const P = await this.client.core.crypto.generateSharedKey(l, u); - s.addTrace(Ga.create_authenticated_session_topic); + const M = await this.client.core.crypto.generateSharedKey(l, u); + s.addTrace(Ka.create_authenticated_session_topic); let N; if ((w == null ? void 0 : w.length) > 0) { - N = { topic: P, acknowledged: !0, self: { publicKey: l, metadata: this.client.metadata }, peer: { publicKey: u, metadata: o.requester.metadata }, controller: u, expiry: En(Kc), authentication: i, requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: o.pairingTopic, namespaces: t3([...new Set(w)], [...new Set(A)]), transportType: a }, s.addTrace(Ga.subscribing_authenticated_session_topic); + N = { topic: M, acknowledged: !0, self: { publicKey: l, metadata: this.client.metadata }, peer: { publicKey: u, metadata: o.requester.metadata }, controller: u, expiry: En(Kc), authentication: i, requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: o.pairingTopic, namespaces: Qx([...new Set(w)], [...new Set(A)]), transportType: a }, s.addTrace(Ka.subscribing_authenticated_session_topic); try { - await this.client.core.relayer.subscribe(P, { transportType: a }); + await this.client.core.relayer.subscribe(M, { transportType: a }); } catch (L) { throw s.setError(If.subscribe_authenticated_session_topic_failure), L; } - s.addTrace(Ga.subscribe_authenticated_session_topic_success), await this.client.session.set(P, N), s.addTrace(Ga.store_authenticated_session), await this.client.core.pairing.updateMetadata({ topic: o.pairingTopic, metadata: o.requester.metadata }); + s.addTrace(Ka.subscribe_authenticated_session_topic_success), await this.client.session.set(M, N), s.addTrace(Ka.store_authenticated_session), await this.client.core.pairing.updateMetadata({ topic: o.pairingTopic, metadata: o.requester.metadata }); } - s.addTrace(Ga.publishing_authenticated_session_approve); + s.addTrace(Ka.publishing_authenticated_session_approve); try { await this.sendResult({ topic: d, id: n, result: { cacaos: i, responder: { publicKey: l, metadata: this.client.metadata } }, encodeOpts: p, throwOnFailedPublish: !0, appLink: this.getAppLinkIfEnabled(o.requester.metadata, a) }); } catch (L) { @@ -20187,12 +20187,12 @@ class zV extends o$ { const { id: n, reason: i } = r, s = this.getPendingAuthRequest(n); if (!s) throw new Error(`Could not find pending auth request with id ${n}`); s.transportType === zr.relay && await this.confirmOnlineStateOrThrow(); - const o = s.requester.publicKey, a = await this.client.core.crypto.generateKeyPair(), u = Td(o), l = { type: Ro, receiverPublicKey: o, senderPublicKey: a }; + const o = s.requester.publicKey, a = await this.client.core.crypto.generateKeyPair(), u = Td(o), l = { type: Co, receiverPublicKey: o, senderPublicKey: a }; await this.sendError({ id: n, topic: u, error: i, encodeOpts: l, rpcOpts: In.wc_sessionAuthenticate.reject, appLink: this.getAppLinkIfEnabled(s.requester.metadata, s.transportType) }), await this.client.auth.requests.delete(n, { message: "rejected", code: 0 }), await this.client.proposal.delete(n, Or("USER_DISCONNECTED")); }, this.formatAuthMessage = (r) => { this.isInitialized(); const { request: n, iss: i } = r; - return U8(n, i); + return F8(n, i); }, this.processRelayMessageCache = () => { setTimeout(async () => { if (this.relayMessageCache.length !== 0) for (; this.relayMessageCache.length > 0; ) try { @@ -20216,13 +20216,13 @@ class zV extends o$ { }, this.deleteSession = async (r) => { var n; const { topic: i, expirerHasDeleted: s = !1, emitEvent: o = !0, id: a = 0 } = r, { self: u } = this.client.session.get(i); - await this.client.core.relayer.unsubscribe(i), await this.client.session.delete(i, Or("USER_DISCONNECTED")), this.addToRecentlyDeleted(i, "session"), this.client.core.crypto.keychain.has(u.publicKey) && await this.client.core.crypto.deleteKeyPair(u.publicKey), this.client.core.crypto.keychain.has(i) && await this.client.core.crypto.deleteSymKey(i), s || this.client.core.expirer.del(i), this.client.core.storage.removeItem(L3).catch((l) => this.client.logger.warn(l)), this.getPendingSessionRequests().forEach((l) => { + await this.client.core.relayer.unsubscribe(i), await this.client.session.delete(i, Or("USER_DISCONNECTED")), this.addToRecentlyDeleted(i, "session"), this.client.core.crypto.keychain.has(u.publicKey) && await this.client.core.crypto.deleteKeyPair(u.publicKey), this.client.core.crypto.keychain.has(i) && await this.client.core.crypto.deleteSymKey(i), s || this.client.core.expirer.del(i), this.client.core.storage.removeItem(O3).catch((l) => this.client.logger.warn(l)), this.getPendingSessionRequests().forEach((l) => { l.topic === i && this.deletePendingSessionRequest(l.id, Or("USER_DISCONNECTED")); }), i === ((n = this.sessionRequestQueue.queue[0]) == null ? void 0 : n.topic) && (this.sessionRequestQueue.state = ks.idle), o && this.client.events.emit("session_delete", { id: a, topic: i }); }, this.deleteProposal = async (r, n) => { if (n) try { const i = this.client.proposal.get(r), s = this.client.core.eventClient.getEvent({ topic: i.pairingTopic }); - s == null || s.setError(Va.proposal_expired); + s == null || s.setError(Ha.proposal_expired); } catch { } await Promise.all([this.client.proposal.delete(r, Or("USER_DISCONNECTED")), n ? Promise.resolve() : this.client.core.expirer.del(r)]), this.addToRecentlyDeleted(r, "proposal"); @@ -20241,27 +20241,27 @@ class zV extends o$ { const { id: n, topic: i, params: s, verifyContext: o } = r, a = s.request.expiryTimestamp || En(In.wc_sessionRequest.req.ttl); this.client.core.expirer.set(n, a), await this.client.pendingRequest.set(n, { id: n, topic: i, params: s, verifyContext: o }); }, this.sendRequest = async (r) => { - const { topic: n, method: i, params: s, expiry: o, relayRpcId: a, clientRpcId: u, throwOnFailedPublish: l, appLink: d } = r, p = ga(i, s, u); + const { topic: n, method: i, params: s, expiry: o, relayRpcId: a, clientRpcId: u, throwOnFailedPublish: l, appLink: d } = r, p = da(i, s, u); let w; const A = !!d; try { - const L = A ? Af : pa; + const L = A ? Af : ha; w = await this.client.core.crypto.encode(n, p, { encoding: L }); } catch (L) { throw await this.cleanup(), this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`), L; } - let P; - if (DV.includes(i)) { - const L = Eo(JSON.stringify(p)), $ = Eo(w); - P = await this.client.core.verify.register({ id: $, decryptedId: L }); + let M; + if (OV.includes(i)) { + const L = xo(JSON.stringify(p)), B = xo(w); + M = await this.client.core.verify.register({ id: B, decryptedId: L }); } const N = In[i].req; - if (N.attestation = P, o && (N.ttl = o), a && (N.id = a), this.client.core.history.set(n, p), A) { + if (N.attestation = M, o && (N.ttl = o), a && (N.id = a), this.client.core.history.set(n, p), A) { const L = fd(d, n, w); await global.Linking.openURL(L, this.client.name); } else { const L = In[i].req; - o && (L.ttl = o), a && (L.id = a), l ? (L.internal = bs(tn({}, L.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(n, w, L)) : this.client.core.relayer.publish(n, w, L).catch(($) => this.client.logger.error($)); + o && (L.ttl = o), a && (L.id = a), l ? (L.internal = bs(tn({}, L.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(n, w, L)) : this.client.core.relayer.publish(n, w, L).catch((B) => this.client.logger.error(B)); } return p.id; }, this.sendResult = async (r) => { @@ -20269,7 +20269,7 @@ class zV extends o$ { let d; const p = u && typeof (global == null ? void 0 : global.Linking) < "u"; try { - const A = p ? Af : pa; + const A = p ? Af : ha; d = await this.client.core.crypto.encode(i, l, bs(tn({}, a || {}), { encoding: A })); } catch (A) { throw await this.cleanup(), this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`), A; @@ -20285,7 +20285,7 @@ class zV extends o$ { await global.Linking.openURL(A, this.client.name); } else { const A = In[w.request.method].res; - o ? (A.internal = bs(tn({}, A.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(i, d, A)) : this.client.core.relayer.publish(i, d, A).catch((P) => this.client.logger.error(P)); + o ? (A.internal = bs(tn({}, A.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(i, d, A)) : this.client.core.relayer.publish(i, d, A).catch((M) => this.client.logger.error(M)); } await this.client.core.history.resolve(l); }, this.sendError = async (r) => { @@ -20293,7 +20293,7 @@ class zV extends o$ { let d; const p = u && typeof (global == null ? void 0 : global.Linking) < "u"; try { - const A = p ? Af : pa; + const A = p ? Af : ha; d = await this.client.core.crypto.encode(i, l, bs(tn({}, o || {}), { encoding: A })); } catch (A) { throw await this.cleanup(), this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`), A; @@ -20316,9 +20316,9 @@ class zV extends o$ { const r = [], n = []; this.client.session.getAll().forEach((i) => { let s = !1; - fa(i.expiry) && (s = !0), this.client.core.crypto.keychain.has(i.topic) || (s = !0), s && r.push(i.topic); + ca(i.expiry) && (s = !0), this.client.core.crypto.keychain.has(i.topic) || (s = !0), s && r.push(i.topic); }), this.client.proposal.getAll().forEach((i) => { - fa(i.expiryTimestamp) && n.push(i.id); + ca(i.expiryTimestamp) && n.push(i.id); }), await Promise.all([...r.map((i) => this.deleteSession({ topic: i })), ...n.map((i) => this.deleteProposal(i))]); }, this.onRelayEventRequest = async (r) => { this.requestQueue.queue.push(r), await this.processRequestsQueue(); @@ -20394,8 +20394,8 @@ class zV extends o$ { this.isValidConnect(tn({}, i.params)); const d = a.expiryTimestamp || En(In.wc_sessionPropose.req.ttl), p = tn({ id: u, pairingTopic: n, expiryTimestamp: d }, a); await this.setProposal(u, p); - const w = await this.getVerifyContext({ attestationId: s, hash: Eo(JSON.stringify(i)), encryptedId: o, metadata: p.proposer.metadata }); - this.client.events.listenerCount("session_proposal") === 0 && (console.warn("No listener for session_proposal event"), l == null || l.setError(_o.proposal_listener_not_found)), l == null || l.addTrace(Fs.emit_session_proposal), this.client.events.emit("session_proposal", { id: u, params: p, verifyContext: w }); + const w = await this.getVerifyContext({ attestationId: s, hash: xo(JSON.stringify(i)), encryptedId: o, metadata: p.proposer.metadata }); + this.client.events.listenerCount("session_proposal") === 0 && (console.warn("No listener for session_proposal event"), l == null || l.setError(wo.proposal_listener_not_found)), l == null || l.addTrace(Fs.emit_session_proposal), this.client.events.emit("session_proposal", { id: u, params: p, verifyContext: w }); } catch (l) { await this.sendError({ id: u, topic: n, error: l, rpcOpts: In.wc_sessionPropose.autoReject }), this.client.logger.error(l); } @@ -20414,7 +20414,7 @@ class zV extends o$ { this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", sessionTopic: d }); const p = await this.client.core.relayer.subscribe(d, { transportType: i }); this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", subscriptionId: p }), await this.client.core.pairing.activate({ topic: r }); - } else if (Qi(n)) { + } else if (Zi(n)) { await this.client.proposal.delete(s, Or("USER_DISCONNECTED")); const o = br("session_connect"); if (this.events.listenerCount(o) === 0) throw new Error(`emitting ${o} without any listeners, 954`); @@ -20432,7 +20432,7 @@ class zV extends o$ { } }, this.onSessionSettleResponse = async (r, n) => { const { id: i } = n; - js(n) ? (await this.client.session.update(r, { acknowledged: !0 }), this.events.emit(br("session_approve", i), {})) : Qi(n) && (await this.client.session.delete(r, Or("USER_DISCONNECTED")), this.events.emit(br("session_approve", i), { error: n.error })); + js(n) ? (await this.client.session.update(r, { acknowledged: !0 }), this.events.emit(br("session_approve", i), {})) : Zi(n) && (await this.client.session.delete(r, Or("USER_DISCONNECTED")), this.events.emit(br("session_approve", i), { error: n.error })); }, this.onSessionUpdateRequest = async (r, n) => { const { params: i, id: s } = n; try { @@ -20454,7 +20454,7 @@ class zV extends o$ { }, this.isRequestOutOfSync = (r, n) => parseInt(n.toString().slice(0, -3)) <= parseInt(r.toString().slice(0, -3)), this.onSessionUpdateResponse = (r, n) => { const { id: i } = n, s = br("session_update", i); if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); - js(n) ? this.events.emit(br("session_update", i), {}) : Qi(n) && this.events.emit(br("session_update", i), { error: n.error }); + js(n) ? this.events.emit(br("session_update", i), {}) : Zi(n) && this.events.emit(br("session_update", i), { error: n.error }); }, this.onSessionExtendRequest = async (r, n) => { const { id: i } = n; try { @@ -20465,7 +20465,7 @@ class zV extends o$ { }, this.onSessionExtendResponse = (r, n) => { const { id: i } = n, s = br("session_extend", i); if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); - js(n) ? this.events.emit(br("session_extend", i), {}) : Qi(n) && this.events.emit(br("session_extend", i), { error: n.error }); + js(n) ? this.events.emit(br("session_extend", i), {}) : Zi(n) && this.events.emit(br("session_extend", i), { error: n.error }); }, this.onSessionPingRequest = async (r, n) => { const { id: i } = n; try { @@ -20477,13 +20477,13 @@ class zV extends o$ { const { id: i } = n, s = br("session_ping", i); if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); setTimeout(() => { - js(n) ? this.events.emit(br("session_ping", i), {}) : Qi(n) && this.events.emit(br("session_ping", i), { error: n.error }); + js(n) ? this.events.emit(br("session_ping", i), {}) : Zi(n) && this.events.emit(br("session_ping", i), { error: n.error }); }, 500); }, this.onSessionDeleteRequest = async (r, n) => { const { id: i } = n; try { this.isValidDisconnect({ topic: r, reason: n.params }), Promise.all([new Promise((s) => { - this.client.core.relayer.once(si.publish, async () => { + this.client.core.relayer.once(oi.publish, async () => { s(await this.deleteSession({ topic: r, id: i })); }); }), this.sendResult({ id: i, topic: r, result: !0, throwOnFailedPublish: !0 }), this.cleanupPendingSentRequestsForTopic({ topic: r, error: Or("USER_DISCONNECTED") })]).catch((s) => this.client.logger.error(s)); @@ -20495,7 +20495,7 @@ class zV extends o$ { const { topic: o, payload: a, attestation: u, encryptedId: l, transportType: d } = r, { id: p, params: w } = a; try { await this.isValidRequest(tn({ topic: o }, w)); - const A = this.client.session.get(o), P = await this.getVerifyContext({ attestationId: u, hash: Eo(JSON.stringify(ga("wc_sessionRequest", w, p))), encryptedId: l, metadata: A.peer.metadata, transportType: d }), N = { id: p, topic: o, params: w, verifyContext: P }; + const A = this.client.session.get(o), M = await this.getVerifyContext({ attestationId: u, hash: xo(JSON.stringify(da("wc_sessionRequest", w, p))), encryptedId: l, metadata: A.peer.metadata, transportType: d }), N = { id: p, topic: o, params: w, verifyContext: M }; await this.setPendingSessionRequest(N), d === zr.link_mode && (n = A.peer.metadata.redirect) != null && n.universal && this.client.core.addLinkModeSupportedApp((i = A.peer.metadata.redirect) == null ? void 0 : i.universal), (s = this.client.signConfig) != null && s.disableRequestQueue ? this.emitSessionRequest(N) : (this.addSessionRequestToSessionRequestQueue(N), this.processSessionRequestQueue()); } catch (A) { await this.sendError({ id: p, topic: o, error: A }), this.client.logger.error(A); @@ -20503,7 +20503,7 @@ class zV extends o$ { }, this.onSessionRequestResponse = (r, n) => { const { id: i } = n, s = br("session_request", i); if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); - js(n) ? this.events.emit(br("session_request", i), { result: n.result }) : Qi(n) && this.events.emit(br("session_request", i), { error: n.error }); + js(n) ? this.events.emit(br("session_request", i), { result: n.result }) : Zi(n) && this.events.emit(br("session_request", i), { error: n.error }); }, this.onSessionEventRequest = async (r, n) => { const { id: i, params: s } = n; try { @@ -20518,16 +20518,16 @@ class zV extends o$ { } }, this.onSessionAuthenticateResponse = (r, n) => { const { id: i } = n; - this.client.logger.trace({ type: "method", method: "onSessionAuthenticateResponse", topic: r, payload: n }), js(n) ? this.events.emit(br("session_request", i), { result: n.result }) : Qi(n) && this.events.emit(br("session_request", i), { error: n.error }); + this.client.logger.trace({ type: "method", method: "onSessionAuthenticateResponse", topic: r, payload: n }), js(n) ? this.events.emit(br("session_request", i), { result: n.result }) : Zi(n) && this.events.emit(br("session_request", i), { error: n.error }); }, this.onSessionAuthenticateRequest = async (r) => { var n; const { topic: i, payload: s, attestation: o, encryptedId: a, transportType: u } = r; try { - const { requester: l, authPayload: d, expiryTimestamp: p } = s.params, w = await this.getVerifyContext({ attestationId: o, hash: Eo(JSON.stringify(s)), encryptedId: a, metadata: l.metadata, transportType: u }), A = { requester: l, pairingTopic: i, id: s.id, authPayload: d, verifyContext: w, expiryTimestamp: p }; + const { requester: l, authPayload: d, expiryTimestamp: p } = s.params, w = await this.getVerifyContext({ attestationId: o, hash: xo(JSON.stringify(s)), encryptedId: a, metadata: l.metadata, transportType: u }), A = { requester: l, pairingTopic: i, id: s.id, authPayload: d, verifyContext: w, expiryTimestamp: p }; await this.setAuthRequest(s.id, { request: A, pairingTopic: i, transportType: u }), u === zr.link_mode && (n = l.metadata.redirect) != null && n.universal && this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal), this.client.events.emit("session_authenticate", { topic: i, params: s.params, id: s.id, verifyContext: w }); } catch (l) { this.client.logger.error(l); - const d = s.params.requester.publicKey, p = await this.client.core.crypto.generateKeyPair(), w = this.getAppLinkIfEnabled(s.params.requester.metadata, u), A = { type: Ro, receiverPublicKey: d, senderPublicKey: p }; + const d = s.params.requester.publicKey, p = await this.client.core.crypto.generateKeyPair(), w = this.getAppLinkIfEnabled(s.params.requester.metadata, u), A = { type: Co, receiverPublicKey: d, senderPublicKey: p }; await this.sendError({ id: s.id, topic: i, error: l, encodeOpts: A, rpcOpts: In.wc_sessionAuthenticate.autoReject, appLink: w }); } }, this.addSessionRequestToSessionRequestQueue = (r) => { @@ -20563,20 +20563,20 @@ class zV extends o$ { }, this.onPairingCreated = (r) => { if (r.methods && this.expectedPairingMethodMap.set(r.topic, r.methods), r.active) return; const n = this.client.proposal.getAll().find((i) => i.pairingTopic === r.topic); - n && this.onSessionProposeRequest({ topic: r.topic, payload: ga("wc_sessionPropose", { requiredNamespaces: n.requiredNamespaces, optionalNamespaces: n.optionalNamespaces, relays: n.relays, proposer: n.proposer, sessionProperties: n.sessionProperties }, n.id) }); + n && this.onSessionProposeRequest({ topic: r.topic, payload: da("wc_sessionPropose", { requiredNamespaces: n.requiredNamespaces, optionalNamespaces: n.optionalNamespaces, relays: n.relays, proposer: n.proposer, sessionProperties: n.sessionProperties }, n.id) }); }, this.isValidConnect = async (r) => { if (!gi(r)) { const { message: u } = ft("MISSING_OR_INVALID", `connect() params: ${JSON.stringify(r)}`); throw new Error(u); } const { pairingTopic: n, requiredNamespaces: i, optionalNamespaces: s, sessionProperties: o, relays: a } = r; - if (mi(n) || await this.isValidPairingTopic(n), !oW(a)) { + if (mi(n) || await this.isValidPairingTopic(n), !aW(a)) { const { message: u } = ft("MISSING_OR_INVALID", `connect() relays: ${a}`); throw new Error(u); } !mi(i) && Sl(i) !== 0 && this.validateNamespaces(i, "requiredNamespaces"), !mi(s) && Sl(s) !== 0 && this.validateNamespaces(s, "optionalNamespaces"), mi(o) || this.validateSessionProps(o, "sessionProperties"); }, this.validateNamespaces = (r, n) => { - const i = sW(r, "connect()", n); + const i = oW(r, "connect()", n); if (i) throw new Error(i.message); }, this.isValidApprove = async (r) => { if (!gi(r)) throw new Error(ft("MISSING_OR_INVALID", `approve() params: ${r}`).message); @@ -20584,7 +20584,7 @@ class zV extends o$ { this.checkRecentlyDeleted(n), await this.isValidProposalId(n); const a = this.client.proposal.get(n), u = hm(i, "approve()"); if (u) throw new Error(u.message); - const l = i3(a.requiredNamespaces, i, "approve()"); + const l = r3(a.requiredNamespaces, i, "approve()"); if (l) throw new Error(l.message); if (!dn(s, !0)) { const { message: d } = ft("MISSING_OR_INVALID", `approve() relayProtocol: ${s}`); @@ -20597,7 +20597,7 @@ class zV extends o$ { throw new Error(s); } const { id: n, reason: i } = r; - if (this.checkRecentlyDeleted(n), await this.isValidProposalId(n), !cW(i)) { + if (this.checkRecentlyDeleted(n), await this.isValidProposalId(n), !uW(i)) { const { message: s } = ft("MISSING_OR_INVALID", `reject() reason: ${JSON.stringify(i)}`); throw new Error(s); } @@ -20607,15 +20607,15 @@ class zV extends o$ { throw new Error(l); } const { relay: n, controller: i, namespaces: s, expiry: o } = r; - if (!Y8(n)) { + if (!V8(n)) { const { message: l } = ft("MISSING_OR_INVALID", "onSessionSettleRequest() relay protocol should be a string"); throw new Error(l); } - const a = Qz(i, "onSessionSettleRequest()"); + const a = eW(i, "onSessionSettleRequest()"); if (a) throw new Error(a.message); const u = hm(s, "onSessionSettleRequest()"); if (u) throw new Error(u.message); - if (fa(o)) { + if (ca(o)) { const { message: l } = ft("EXPIRED", "onSessionSettleRequest()"); throw new Error(l); } @@ -20628,7 +20628,7 @@ class zV extends o$ { this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); const s = this.client.session.get(n), o = hm(i, "update()"); if (o) throw new Error(o.message); - const a = i3(s.requiredNamespaces, i, "update()"); + const a = r3(s.requiredNamespaces, i, "update()"); if (a) throw new Error(a.message); }, this.isValidExtend = async (r) => { if (!gi(r)) { @@ -20645,19 +20645,19 @@ class zV extends o$ { const { topic: n, request: i, chainId: s, expiry: o } = r; this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); const { namespaces: a } = this.client.session.get(n); - if (!n3(a, s)) { + if (!t3(a, s)) { const { message: u } = ft("MISSING_OR_INVALID", `request() chainId: ${s}`); throw new Error(u); } - if (!uW(i)) { + if (!fW(i)) { const { message: u } = ft("MISSING_OR_INVALID", `request() ${JSON.stringify(i)}`); throw new Error(u); } - if (!hW(a, s, i.method)) { + if (!dW(a, s, i.method)) { const { message: u } = ft("MISSING_OR_INVALID", `request() method: ${i.method}`); throw new Error(u); } - if (o && !mW(o, vm)) { + if (o && !vW(o, vm)) { const { message: u } = ft("MISSING_OR_INVALID", `request() expiry: ${o}. Expiry must be a number (in seconds) between ${vm.min} and ${vm.max}`); throw new Error(u); } @@ -20673,7 +20673,7 @@ class zV extends o$ { } catch (o) { throw (n = r == null ? void 0 : r.response) != null && n.id && this.cleanupAfterResponse(r), o; } - if (!fW(s)) { + if (!lW(s)) { const { message: o } = ft("MISSING_OR_INVALID", `respond() response: ${JSON.stringify(s)}`); throw new Error(o); } @@ -20692,15 +20692,15 @@ class zV extends o$ { const { topic: n, event: i, chainId: s } = r; await this.isValidSessionTopic(n); const { namespaces: o } = this.client.session.get(n); - if (!n3(o, s)) { + if (!t3(o, s)) { const { message: a } = ft("MISSING_OR_INVALID", `emit() chainId: ${s}`); throw new Error(a); } - if (!lW(i)) { + if (!hW(i)) { const { message: a } = ft("MISSING_OR_INVALID", `emit() event: ${JSON.stringify(i)}`); throw new Error(a); } - if (!dW(o, s, i.name)) { + if (!pW(o, s, i.name)) { const { message: a } = ft("MISSING_OR_INVALID", `emit() event: ${JSON.stringify(i)}`); throw new Error(a); } @@ -20766,7 +20766,7 @@ class zV extends o$ { return this.isLinkModeEnabled(r, n) ? (i = r == null ? void 0 : r.redirect) == null ? void 0 : i.universal : void 0; }, this.handleLinkModeMessage = ({ url: r }) => { if (!r || !r.includes("wc_ev") || !r.includes("topic")) return; - const n = jx(r, "topic") || "", i = decodeURIComponent(jx(r, "wc_ev") || ""), s = this.client.session.keys.includes(n); + const n = Bx(r, "topic") || "", i = decodeURIComponent(Bx(r, "wc_ev") || ""), s = this.client.session.keys.includes(n); s && this.client.session.update(n, { transportType: zr.link_mode }), this.client.core.dispatchEnvelope({ topic: n, message: i, sessionExists: s }); }, this.registerLinkModeListeners = async () => { var r; @@ -20792,28 +20792,28 @@ class zV extends o$ { await this.client.core.relayer.confirmOnlineStateOrThrow(); } registerRelayerEvents() { - this.client.core.relayer.on(si.message, (e) => { + this.client.core.relayer.on(oi.message, (e) => { !this.initialized || this.relayMessageCache.length > 0 ? this.relayMessageCache.push(e) : this.onRelayMessage(e); }); } async onRelayMessage(e) { - const { topic: r, message: n, attestation: i, transportType: s } = e, { publicKey: o } = this.client.auth.authKeys.keys.includes(Rd) ? this.client.auth.authKeys.get(Rd) : { publicKey: void 0 }, a = await this.client.core.crypto.decode(r, n, { receiverPublicKey: o, encoding: s === zr.link_mode ? Af : pa }); + const { topic: r, message: n, attestation: i, transportType: s } = e, { publicKey: o } = this.client.auth.authKeys.keys.includes(Rd) ? this.client.auth.authKeys.get(Rd) : { publicKey: void 0 }, a = await this.client.core.crypto.decode(r, n, { receiverPublicKey: o, encoding: s === zr.link_mode ? Af : ha }); try { - fb(a) ? (this.client.core.history.set(r, a), this.onRelayEventRequest({ topic: r, payload: a, attestation: i, transportType: s, encryptedId: Eo(n) })) : ip(a) ? (await this.client.core.history.resolve(a), await this.onRelayEventResponse({ topic: r, payload: a, transportType: s }), this.client.core.history.delete(r, a.id)) : this.onRelayEventUnknownPayload({ topic: r, payload: a, transportType: s }); + fb(a) ? (this.client.core.history.set(r, a), this.onRelayEventRequest({ topic: r, payload: a, attestation: i, transportType: s, encryptedId: xo(n) })) : ip(a) ? (await this.client.core.history.resolve(a), await this.onRelayEventResponse({ topic: r, payload: a, transportType: s }), this.client.core.history.delete(r, a.id)) : this.onRelayEventUnknownPayload({ topic: r, payload: a, transportType: s }); } catch (u) { this.client.logger.error(u); } } registerExpirerEvents() { - this.client.core.expirer.on(Xi.expired, async (e) => { - const { topic: r, id: n } = F8(e.target); + this.client.core.expirer.on(Ji.expired, async (e) => { + const { topic: r, id: n } = $8(e.target); if (n && this.client.pendingRequest.keys.includes(n)) return await this.deletePendingSessionRequest(n, ft("EXPIRED"), !0); if (n && this.client.auth.requests.keys.includes(n)) return await this.deletePendingAuthRequest(n, ft("EXPIRED"), !0); r ? this.client.session.keys.includes(r) && (await this.deleteSession({ topic: r, expirerHasDeleted: !0 }), this.client.events.emit("session_expire", { topic: r })) : n && (await this.deleteProposal(n, !0), this.client.events.emit("proposal_expire", { id: n })); }); } registerPairingEvents() { - this.client.core.pairing.events.on(Qa.create, (e) => this.onPairingCreated(e)), this.client.core.pairing.events.on(Qa.delete, (e) => { + this.client.core.pairing.events.on(Za.create, (e) => this.onPairingCreated(e)), this.client.core.pairing.events.on(Za.delete, (e) => { this.addToRecentlyDeleted(e.topic, "pairing"); }); } @@ -20826,7 +20826,7 @@ class zV extends o$ { const { message: r } = ft("NO_MATCHING_KEY", `pairing topic doesn't exist: ${e}`); throw new Error(r); } - if (fa(this.client.core.pairing.pairings.get(e).expiry)) { + if (ca(this.client.core.pairing.pairings.get(e).expiry)) { const { message: r } = ft("EXPIRED", `pairing topic: ${e}`); throw new Error(r); } @@ -20840,7 +20840,7 @@ class zV extends o$ { const { message: r } = ft("NO_MATCHING_KEY", `session topic doesn't exist: ${e}`); throw new Error(r); } - if (fa(this.client.session.get(e).expiry)) { + if (ca(this.client.session.get(e).expiry)) { await this.deleteSession({ topic: e }); const { message: r } = ft("EXPIRED", `session topic: ${e}`); throw new Error(r); @@ -20862,7 +20862,7 @@ class zV extends o$ { } } async isValidProposalId(e) { - if (!aW(e)) { + if (!cW(e)) { const { message: r } = ft("MISSING_OR_INVALID", `proposal id should be a number: ${e}`); throw new Error(r); } @@ -20870,54 +20870,54 @@ class zV extends o$ { const { message: r } = ft("NO_MATCHING_KEY", `proposal id doesn't exist: ${e}`); throw new Error(r); } - if (fa(this.client.proposal.get(e).expiryTimestamp)) { + if (ca(this.client.proposal.get(e).expiryTimestamp)) { await this.deleteProposal(e); const { message: r } = ft("EXPIRED", `proposal id: ${e}`); throw new Error(r); } } } -class WV extends Ec { +class HV extends Ec { constructor(e, r) { - super(e, r, IV, hb), this.core = e, this.logger = r; + super(e, r, CV, hb), this.core = e, this.logger = r; } } -let HV = class extends Ec { +let KV = class extends Ec { constructor(e, r) { - super(e, r, CV, hb), this.core = e, this.logger = r; + super(e, r, TV, hb), this.core = e, this.logger = r; } }; -class KV extends Ec { - constructor(e, r) { - super(e, r, RV, hb, (n) => n.id), this.core = e, this.logger = r; - } -} class VV extends Ec { constructor(e, r) { - super(e, r, LV, op, () => Rd), this.core = e, this.logger = r; + super(e, r, DV, hb, (n) => n.id), this.core = e, this.logger = r; } } class GV extends Ec { constructor(e, r) { - super(e, r, kV, op), this.core = e, this.logger = r; + super(e, r, kV, op, () => Rd), this.core = e, this.logger = r; } } class YV extends Ec { constructor(e, r) { - super(e, r, $V, op, (n) => n.id), this.core = e, this.logger = r; + super(e, r, $V, op), this.core = e, this.logger = r; } } -class JV { +class JV extends Ec { constructor(e, r) { - this.core = e, this.logger = r, this.authKeys = new VV(this.core, this.logger), this.pairingTopics = new GV(this.core, this.logger), this.requests = new YV(this.core, this.logger); + super(e, r, BV, op, (n) => n.id), this.core = e, this.logger = r; + } +} +class XV { + constructor(e, r) { + this.core = e, this.logger = r, this.authKeys = new GV(this.core, this.logger), this.pairingTopics = new YV(this.core, this.logger), this.requests = new JV(this.core, this.logger); } async init() { await this.authKeys.init(), await this.pairingTopics.init(), await this.requests.init(); } } -class db extends s$ { +class db extends o$ { constructor(e) { - super(e), this.protocol = bE, this.version = yE, this.name = mm.name, this.events = new ns.EventEmitter(), this.on = (n, i) => this.events.on(n, i), this.once = (n, i) => this.events.once(n, i), this.off = (n, i) => this.events.off(n, i), this.removeListener = (n, i) => this.events.removeListener(n, i), this.removeAllListeners = (n) => this.events.removeAllListeners(n), this.connect = async (n) => { + super(e), this.protocol = mE, this.version = vE, this.name = mm.name, this.events = new rs.EventEmitter(), this.on = (n, i) => this.events.on(n, i), this.once = (n, i) => this.events.once(n, i), this.off = (n, i) => this.events.off(n, i), this.removeListener = (n, i) => this.events.removeListener(n, i), this.removeAllListeners = (n) => this.events.removeAllListeners(n), this.connect = async (n) => { try { return await this.engine.connect(n); } catch (i) { @@ -21019,16 +21019,16 @@ class db extends s$ { } catch (i) { throw this.logger.error(i.message), i; } - }, this.name = (e == null ? void 0 : e.name) || mm.name, this.metadata = (e == null ? void 0 : e.metadata) || N8(), this.signConfig = e == null ? void 0 : e.signConfig; + }, this.name = (e == null ? void 0 : e.name) || mm.name, this.metadata = (e == null ? void 0 : e.metadata) || D8(), this.signConfig = e == null ? void 0 : e.signConfig; const r = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : ql($0({ level: (e == null ? void 0 : e.logger) || mm.logger })); - this.core = (e == null ? void 0 : e.core) || new MV(e), this.logger = ci(r, this.name), this.session = new HV(this.core, this.logger), this.proposal = new WV(this.core, this.logger), this.pendingRequest = new KV(this.core, this.logger), this.engine = new zV(this), this.auth = new JV(this.core, this.logger); + this.core = (e == null ? void 0 : e.core) || new IV(e), this.logger = ci(r, this.name), this.session = new KV(this.core, this.logger), this.proposal = new HV(this.core, this.logger), this.pendingRequest = new VV(this.core, this.logger), this.engine = new WV(this), this.auth = new XV(this.core, this.logger); } static async init(e) { const r = new db(e); return await r.initialize(), r; } get context() { - return Si(this.logger); + return Ai(this.logger); } get pairing() { return this.core.pairing.pairings; @@ -21054,26 +21054,26 @@ var h0 = { exports: {} }; h0.exports; (function(t, e) { (function() { - var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", u = "__lodash_hash_undefined__", l = 500, d = "__lodash_placeholder__", p = 1, w = 2, A = 4, P = 1, N = 2, L = 1, $ = 2, B = 4, H = 8, W = 16, V = 32, te = 64, R = 128, K = 256, ge = 512, Ee = 30, Y = "...", S = 800, m = 16, f = 1, g = 2, b = 3, x = 1 / 0, _ = 9007199254740991, E = 17976931348623157e292, v = NaN, M = 4294967295, I = M - 1, F = M >>> 1, ce = [ + var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", u = "__lodash_hash_undefined__", l = 500, d = "__lodash_placeholder__", p = 1, w = 2, A = 4, M = 1, N = 2, L = 1, B = 2, $ = 4, H = 8, W = 16, V = 32, te = 64, R = 128, K = 256, ge = 512, Ee = 30, Y = "...", S = 800, m = 16, f = 1, g = 2, b = 3, x = 1 / 0, _ = 9007199254740991, E = 17976931348623157e292, v = NaN, P = 4294967295, I = P - 1, F = P >>> 1, ce = [ ["ary", R], ["bind", L], - ["bindKey", $], + ["bindKey", B], ["curry", H], ["curryRight", W], ["flip", ge], ["partial", V], ["partialRight", te], ["rearg", K] - ], D = "[object Arguments]", oe = "[object Array]", Z = "[object AsyncFunction]", J = "[object Boolean]", Q = "[object Date]", T = "[object DOMException]", X = "[object Error]", re = "[object Function]", pe = "[object GeneratorFunction]", ie = "[object Map]", ue = "[object Number]", ve = "[object Null]", Pe = "[object Object]", De = "[object Promise]", Ce = "[object Proxy]", $e = "[object RegExp]", Me = "[object Set]", Ne = "[object String]", Ke = "[object Symbol]", Le = "[object Undefined]", qe = "[object WeakMap]", ze = "[object WeakSet]", _e = "[object ArrayBuffer]", Ze = "[object DataView]", at = "[object Float32Array]", ke = "[object Float64Array]", Qe = "[object Int8Array]", tt = "[object Int16Array]", Ye = "[object Int32Array]", dt = "[object Uint8Array]", lt = "[object Uint8ClampedArray]", ct = "[object Uint16Array]", qt = "[object Uint32Array]", Jt = /\b__p \+= '';/g, Et = /\b(__p \+=) '' \+/g, er = /(__e\(.*?\)|\b__t\)) \+\n'';/g, Xt = /&(?:amp|lt|gt|quot|#39);/g, Dt = /[&<>"']/g, kt = RegExp(Xt.source), Ct = RegExp(Dt.source), gt = /<%-([\s\S]+?)%>/g, Rt = /<%([\s\S]+?)%>/g, Nt = /<%=([\s\S]+?)%>/g, vt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $t = /^\w*$/, Ft = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, rt = /[\\^$.*+?()[\]{}|]/g, Bt = RegExp(rt.source), k = /^\s+/, U = /\s/, z = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, C = /\{\n\/\* \[wrapped with (.+)\] \*/, G = /,? & /, j = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, se = /[()=,{}\[\]\/\s]/, de = /\\(\\)?/g, xe = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Te = /\w*$/, Re = /^[-+]0x[0-9a-f]+$/i, nt = /^0b[01]+$/i, je = /^\[object .+?Constructor\]$/, pt = /^0o[0-7]+$/i, it = /^(?:0|[1-9]\d*)$/, et = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, St = /($^)/, Tt = /['\n\r\u2028\u2029\\]/g, At = "\\ud800-\\udfff", _t = "\\u0300-\\u036f", ht = "\\ufe20-\\ufe2f", xt = "\\u20d0-\\u20ff", st = _t + ht + xt, bt = "\\u2700-\\u27bf", ut = "a-z\\xdf-\\xf6\\xf8-\\xff", ot = "\\xac\\xb1\\xd7\\xf7", Se = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Ae = "\\u2000-\\u206f", Ve = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Fe = "A-Z\\xc0-\\xd6\\xd8-\\xde", Ue = "\\ufe0e\\ufe0f", Je = ot + Se + Ae + Ve, Lt = "['’]", zt = "[" + At + "]", Zt = "[" + Je + "]", Wt = "[" + st + "]", he = "\\d+", rr = "[" + bt + "]", dr = "[" + ut + "]", pr = "[^" + At + Je + he + bt + ut + Fe + "]", Qt = "\\ud83c[\\udffb-\\udfff]", gr = "(?:" + Wt + "|" + Qt + ")", lr = "[^" + At + "]", Rr = "(?:\\ud83c[\\udde6-\\uddff]){2}", mr = "[\\ud800-\\udbff][\\udc00-\\udfff]", yr = "[" + Fe + "]", $r = "\\u200d", Br = "(?:" + dr + "|" + pr + ")", Ir = "(?:" + yr + "|" + pr + ")", nn = "(?:" + Lt + "(?:d|ll|m|re|s|t|ve))?", sn = "(?:" + Lt + "(?:D|LL|M|RE|S|T|VE))?", on = gr + "?", lh = "[" + Ue + "]?", Rp = "(?:" + $r + "(?:" + [lr, Rr, mr].join("|") + ")" + lh + on + ")*", oo = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", hh = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", dh = lh + on + Rp, Mc = "(?:" + [rr, Rr, mr].join("|") + ")" + dh, Dp = "(?:" + [lr + Wt + "?", Wt, Rr, mr, zt].join("|") + ")", Xu = RegExp(Lt, "g"), Op = RegExp(Wt, "g"), Ic = RegExp(Qt + "(?=" + Qt + ")|" + Dp + dh, "g"), ph = RegExp([ - yr + "?" + dr + "+" + nn + "(?=" + [Zt, yr, "$"].join("|") + ")", - Ir + "+" + sn + "(?=" + [Zt, yr + Br, "$"].join("|") + ")", + ], D = "[object Arguments]", oe = "[object Array]", Z = "[object AsyncFunction]", J = "[object Boolean]", Q = "[object Date]", T = "[object DOMException]", X = "[object Error]", re = "[object Function]", de = "[object GeneratorFunction]", ie = "[object Map]", ue = "[object Number]", ve = "[object Null]", Pe = "[object Object]", De = "[object Promise]", Ce = "[object Proxy]", $e = "[object RegExp]", Me = "[object Set]", Ne = "[object String]", Ke = "[object Symbol]", Le = "[object Undefined]", qe = "[object WeakMap]", ze = "[object WeakSet]", _e = "[object ArrayBuffer]", Ze = "[object DataView]", at = "[object Float32Array]", ke = "[object Float64Array]", Qe = "[object Int8Array]", tt = "[object Int16Array]", Ye = "[object Int32Array]", dt = "[object Uint8Array]", lt = "[object Uint8ClampedArray]", ct = "[object Uint16Array]", qt = "[object Uint32Array]", Yt = /\b__p \+= '';/g, Et = /\b(__p \+=) '' \+/g, er = /(__e\(.*?\)|\b__t\)) \+\n'';/g, Jt = /&(?:amp|lt|gt|quot|#39);/g, Dt = /[&<>"']/g, kt = RegExp(Jt.source), Ct = RegExp(Dt.source), gt = /<%-([\s\S]+?)%>/g, Rt = /<%([\s\S]+?)%>/g, Nt = /<%=([\s\S]+?)%>/g, vt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $t = /^\w*$/, Ft = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, rt = /[\\^$.*+?()[\]{}|]/g, Bt = RegExp(rt.source), k = /^\s+/, U = /\s/, z = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, C = /\{\n\/\* \[wrapped with (.+)\] \*/, G = /,? & /, j = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, se = /[()=,{}\[\]\/\s]/, he = /\\(\\)?/g, xe = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Te = /\w*$/, Re = /^[-+]0x[0-9a-f]+$/i, nt = /^0b[01]+$/i, je = /^\[object .+?Constructor\]$/, pt = /^0o[0-7]+$/i, it = /^(?:0|[1-9]\d*)$/, et = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, St = /($^)/, Tt = /['\n\r\u2028\u2029\\]/g, At = "\\ud800-\\udfff", _t = "\\u0300-\\u036f", ht = "\\ufe20-\\ufe2f", xt = "\\u20d0-\\u20ff", st = _t + ht + xt, bt = "\\u2700-\\u27bf", ut = "a-z\\xdf-\\xf6\\xf8-\\xff", ot = "\\xac\\xb1\\xd7\\xf7", Se = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Ae = "\\u2000-\\u206f", Ve = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Fe = "A-Z\\xc0-\\xd6\\xd8-\\xde", Ue = "\\ufe0e\\ufe0f", Je = ot + Se + Ae + Ve, Lt = "['’]", zt = "[" + At + "]", Xt = "[" + Je + "]", Wt = "[" + st + "]", le = "\\d+", rr = "[" + bt + "]", dr = "[" + ut + "]", pr = "[^" + At + Je + le + bt + ut + Fe + "]", Zt = "\\ud83c[\\udffb-\\udfff]", gr = "(?:" + Wt + "|" + Zt + ")", lr = "[^" + At + "]", Rr = "(?:\\ud83c[\\udde6-\\uddff]){2}", mr = "[\\ud800-\\udbff][\\udc00-\\udfff]", yr = "[" + Fe + "]", $r = "\\u200d", Br = "(?:" + dr + "|" + pr + ")", Ir = "(?:" + yr + "|" + pr + ")", nn = "(?:" + Lt + "(?:d|ll|m|re|s|t|ve))?", sn = "(?:" + Lt + "(?:D|LL|M|RE|S|T|VE))?", on = gr + "?", lh = "[" + Ue + "]?", Rp = "(?:" + $r + "(?:" + [lr, Rr, mr].join("|") + ")" + lh + on + ")*", io = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", hh = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", dh = lh + on + Rp, Mc = "(?:" + [rr, Rr, mr].join("|") + ")" + dh, Dp = "(?:" + [lr + Wt + "?", Wt, Rr, mr, zt].join("|") + ")", Xu = RegExp(Lt, "g"), Op = RegExp(Wt, "g"), Ic = RegExp(Zt + "(?=" + Zt + ")|" + Dp + dh, "g"), ph = RegExp([ + yr + "?" + dr + "+" + nn + "(?=" + [Xt, yr, "$"].join("|") + ")", + Ir + "+" + sn + "(?=" + [Xt, yr + Br, "$"].join("|") + ")", yr + "?" + Br + "+" + nn, yr + "+" + sn, hh, - oo, - he, + io, + le, Mc - ].join("|"), "g"), gh = RegExp("[" + $r + At + st + Ue + "]"), Na = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, mh = [ + ].join("|"), "g"), gh = RegExp("[" + $r + At + st + Ue + "]"), Da = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, mh = [ "Array", "Buffer", "DataView", @@ -21326,7 +21326,7 @@ h0.exports; return be || bn && bn.binding && bn.binding("util"); } catch { } - }(), ei = Vr && Vr.isArrayBuffer, fs = Vr && Vr.isDate, ji = Vr && Vr.isMap, Is = Vr && Vr.isRegExp, Zu = Vr && Vr.isSet, La = Vr && Vr.isTypedArray; + }(), ti = Vr && Vr.isArrayBuffer, fs = Vr && Vr.isDate, Fi = Vr && Vr.isMap, Is = Vr && Vr.isRegExp, Zu = Vr && Vr.isSet, Oa = Vr && Vr.isTypedArray; function Pn(be, Be, Ie) { switch (Ie.length) { case 0: @@ -21340,30 +21340,30 @@ h0.exports; } return be.apply(Be, Ie); } - function rA(be, Be, Ie, It) { + function nA(be, Be, Ie, It) { for (var tr = -1, Pr = be == null ? 0 : be.length; ++tr < Pr; ) { var xn = be[tr]; Be(It, xn, Ie(xn), be); } return It; } - function Ui(be, Be) { + function ji(be, Be) { for (var Ie = -1, It = be == null ? 0 : be.length; ++Ie < It && Be(be[Ie], Ie, be) !== !1; ) ; return be; } - function nA(be, Be) { + function iA(be, Be) { for (var Ie = be == null ? 0 : be.length; Ie-- && Be(be[Ie], Ie, be) !== !1; ) ; return be; } - function my(be, Be) { + function py(be, Be) { for (var Ie = -1, It = be == null ? 0 : be.length; ++Ie < It; ) if (!Be(be[Ie], Ie, be)) return !1; return !0; } - function Ko(be, Be) { + function Wo(be, Be) { for (var Ie = -1, It = be == null ? 0 : be.length, tr = 0, Pr = []; ++Ie < It; ) { var xn = be[Ie]; Be(xn, Ie, be) && (Pr[tr++] = xn); @@ -21385,7 +21385,7 @@ h0.exports; tr[Ie] = Be(be[Ie], Ie, be); return tr; } - function Vo(be, Be) { + function Ho(be, Be) { for (var Ie = -1, It = Be.length, tr = be.length; ++Ie < It; ) be[tr + Ie] = Be[Ie]; return be; @@ -21396,7 +21396,7 @@ h0.exports; Ie = Be(Ie, be[tr], tr, be); return Ie; } - function iA(be, Be, Ie, It) { + function sA(be, Be, Ie, It) { var tr = be == null ? 0 : be.length; for (It && tr && (Ie = be[--tr]); tr--; ) Ie = Be(Ie, be[tr], tr, be); @@ -21408,14 +21408,14 @@ h0.exports; return !0; return !1; } - var sA = Bp("length"); - function oA(be) { + var oA = Bp("length"); + function aA(be) { return be.split(""); } - function aA(be) { + function cA(be) { return be.match(j) || []; } - function vy(be, Be, Ie) { + function gy(be, Be, Ie) { var It; return Ie(be, function(tr, Pr, xn) { if (Be(tr, Pr, xn)) @@ -21429,18 +21429,18 @@ h0.exports; return -1; } function Cc(be, Be, Ie) { - return Be === Be ? yA(be, Be, Ie) : bh(be, by, Ie); + return Be === Be ? wA(be, Be, Ie) : bh(be, my, Ie); } - function cA(be, Be, Ie, It) { + function uA(be, Be, Ie, It) { for (var tr = Ie - 1, Pr = be.length; ++tr < Pr; ) if (It(be[tr], Be)) return tr; return -1; } - function by(be) { + function my(be) { return be !== be; } - function yy(be, Be) { + function vy(be, Be) { var Ie = be == null ? 0 : be.length; return Ie ? jp(be, Be) / Ie : v; } @@ -21454,12 +21454,12 @@ h0.exports; return be == null ? r : be[Be]; }; } - function wy(be, Be, Ie, It, tr) { + function by(be, Be, Ie, It, tr) { return tr(be, function(Pr, xn, qr) { Ie = It ? (It = !1, Pr) : Be(Ie, Pr, xn, qr); }), Ie; } - function uA(be, Be) { + function fA(be, Be) { var Ie = be.length; for (be.sort(Be); Ie--; ) be[Ie] = be[Ie].value; @@ -21477,15 +21477,15 @@ h0.exports; It[Ie] = Be(Ie); return It; } - function fA(be, Be) { + function lA(be, Be) { return Xr(Be, function(Ie) { return [Ie, be[Ie]]; }); } - function xy(be) { - return be && be.slice(0, Ay(be) + 1).replace(k, ""); + function yy(be) { + return be && be.slice(0, Ey(be) + 1).replace(k, ""); } - function Ai(be) { + function Pi(be) { return function(Be) { return be(Be); }; @@ -21498,35 +21498,35 @@ h0.exports; function Qu(be, Be) { return be.has(Be); } - function _y(be, Be) { + function wy(be, Be) { for (var Ie = -1, It = be.length; ++Ie < It && Cc(Be, be[Ie], 0) > -1; ) ; return Ie; } - function Ey(be, Be) { + function xy(be, Be) { for (var Ie = be.length; Ie-- && Cc(Be, be[Ie], 0) > -1; ) ; return Ie; } - function lA(be, Be) { + function hA(be, Be) { for (var Ie = be.length, It = 0; Ie--; ) be[Ie] === Be && ++It; return It; } - var hA = Fp(ae), dA = Fp(ye); - function pA(be) { + var dA = Fp(ae), pA = Fp(ye); + function gA(be) { return "\\" + Pt[be]; } - function gA(be, Be) { + function mA(be, Be) { return be == null ? r : be[Be]; } function Tc(be) { return gh.test(be); } - function mA(be) { - return Na.test(be); - } function vA(be) { + return Da.test(be); + } + function bA(be) { for (var Be, Ie = []; !(Be = be.next()).done; ) Ie.push(Be.value); return Ie; @@ -21537,12 +21537,12 @@ h0.exports; Ie[++Be] = [tr, It]; }), Ie; } - function Sy(be, Be) { + function _y(be, Be) { return function(Ie) { return be(Be(Ie)); }; } - function Go(be, Be) { + function Ko(be, Be) { for (var Ie = -1, It = be.length, tr = 0, Pr = []; ++Ie < It; ) { var xn = be[Ie]; (xn === Be || xn === d) && (be[Ie] = d, Pr[tr++] = Ie); @@ -21555,69 +21555,69 @@ h0.exports; Ie[++Be] = It; }), Ie; } - function bA(be) { + function yA(be) { var Be = -1, Ie = Array(be.size); return be.forEach(function(It) { Ie[++Be] = [It, It]; }), Ie; } - function yA(be, Be, Ie) { + function wA(be, Be, Ie) { for (var It = Ie - 1, tr = be.length; ++It < tr; ) if (be[It] === Be) return It; return -1; } - function wA(be, Be, Ie) { + function xA(be, Be, Ie) { for (var It = Ie + 1; It--; ) if (be[It] === Be) return It; return It; } function Rc(be) { - return Tc(be) ? _A(be) : sA(be); + return Tc(be) ? EA(be) : oA(be); } function ls(be) { - return Tc(be) ? EA(be) : oA(be); + return Tc(be) ? SA(be) : aA(be); } - function Ay(be) { + function Ey(be) { for (var Be = be.length; Be-- && U.test(be.charAt(Be)); ) ; return Be; } - var xA = Fp(Ge); - function _A(be) { + var _A = Fp(Ge); + function EA(be) { for (var Be = Ic.lastIndex = 0; Ic.test(be); ) ++Be; return Be; } - function EA(be) { + function SA(be) { return be.match(Ic) || []; } - function SA(be) { + function AA(be) { return be.match(ph) || []; } - var AA = function be(Be) { + var PA = function be(Be) { Be = Be == null ? _r : Dc.defaults(_r.Object(), Be, Dc.pick(_r, mh)); - var Ie = Be.Array, It = Be.Date, tr = Be.Error, Pr = Be.Function, xn = Be.Math, qr = Be.Object, Wp = Be.RegExp, PA = Be.String, qi = Be.TypeError, wh = Ie.prototype, MA = Pr.prototype, Oc = qr.prototype, xh = Be["__core-js_shared__"], _h = MA.toString, Tr = Oc.hasOwnProperty, IA = 0, Py = function() { + var Ie = Be.Array, It = Be.Date, tr = Be.Error, Pr = Be.Function, xn = Be.Math, qr = Be.Object, Wp = Be.RegExp, MA = Be.String, Ui = Be.TypeError, wh = Ie.prototype, IA = Pr.prototype, Oc = qr.prototype, xh = Be["__core-js_shared__"], _h = IA.toString, Tr = Oc.hasOwnProperty, CA = 0, Sy = function() { var c = /[^.]+$/.exec(xh && xh.keys && xh.keys.IE_PROTO || ""); return c ? "Symbol(src)_1." + c : ""; - }(), Eh = Oc.toString, CA = _h.call(qr), TA = _r._, RA = Wp( + }(), Eh = Oc.toString, TA = _h.call(qr), RA = _r._, DA = Wp( "^" + _h.call(Tr).replace(rt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" - ), Sh = ui ? Be.Buffer : r, Yo = Be.Symbol, Ah = Be.Uint8Array, My = Sh ? Sh.allocUnsafe : r, Ph = Sy(qr.getPrototypeOf, qr), Iy = qr.create, Cy = Oc.propertyIsEnumerable, Mh = wh.splice, Ty = Yo ? Yo.isConcatSpreadable : r, ef = Yo ? Yo.iterator : r, ka = Yo ? Yo.toStringTag : r, Ih = function() { + ), Sh = ui ? Be.Buffer : r, Vo = Be.Symbol, Ah = Be.Uint8Array, Ay = Sh ? Sh.allocUnsafe : r, Ph = _y(qr.getPrototypeOf, qr), Py = qr.create, My = Oc.propertyIsEnumerable, Mh = wh.splice, Iy = Vo ? Vo.isConcatSpreadable : r, ef = Vo ? Vo.iterator : r, Na = Vo ? Vo.toStringTag : r, Ih = function() { try { - var c = Ua(qr, "defineProperty"); + var c = Fa(qr, "defineProperty"); return c({}, "", {}), c; } catch { } - }(), DA = Be.clearTimeout !== _r.clearTimeout && Be.clearTimeout, OA = It && It.now !== _r.Date.now && It.now, NA = Be.setTimeout !== _r.setTimeout && Be.setTimeout, Ch = xn.ceil, Th = xn.floor, Hp = qr.getOwnPropertySymbols, LA = Sh ? Sh.isBuffer : r, Ry = Be.isFinite, kA = wh.join, $A = Sy(qr.keys, qr), _n = xn.max, Kn = xn.min, BA = It.now, FA = Be.parseInt, Dy = xn.random, jA = wh.reverse, Kp = Ua(Be, "DataView"), tf = Ua(Be, "Map"), Vp = Ua(Be, "Promise"), Nc = Ua(Be, "Set"), rf = Ua(Be, "WeakMap"), nf = Ua(qr, "create"), Rh = rf && new rf(), Lc = {}, UA = qa(Kp), qA = qa(tf), zA = qa(Vp), WA = qa(Nc), HA = qa(rf), Dh = Yo ? Yo.prototype : r, sf = Dh ? Dh.valueOf : r, Oy = Dh ? Dh.toString : r; + }(), OA = Be.clearTimeout !== _r.clearTimeout && Be.clearTimeout, NA = It && It.now !== _r.Date.now && It.now, LA = Be.setTimeout !== _r.setTimeout && Be.setTimeout, Ch = xn.ceil, Th = xn.floor, Hp = qr.getOwnPropertySymbols, kA = Sh ? Sh.isBuffer : r, Cy = Be.isFinite, $A = wh.join, BA = _y(qr.keys, qr), _n = xn.max, Vn = xn.min, FA = It.now, jA = Be.parseInt, Ty = xn.random, UA = wh.reverse, Kp = Fa(Be, "DataView"), tf = Fa(Be, "Map"), Vp = Fa(Be, "Promise"), Nc = Fa(Be, "Set"), rf = Fa(Be, "WeakMap"), nf = Fa(qr, "create"), Rh = rf && new rf(), Lc = {}, qA = ja(Kp), zA = ja(tf), WA = ja(Vp), HA = ja(Nc), KA = ja(rf), Dh = Vo ? Vo.prototype : r, sf = Dh ? Dh.valueOf : r, Ry = Dh ? Dh.toString : r; function ee(c) { if (en(c) && !ir(c) && !(c instanceof wr)) { - if (c instanceof zi) + if (c instanceof qi) return c; if (Tr.call(c, "__wrapped__")) - return Nw(c); + return Dw(c); } - return new zi(c); + return new qi(c); } var kc = /* @__PURE__ */ function() { function c() { @@ -21625,8 +21625,8 @@ h0.exports; return function(h) { if (!Zr(h)) return {}; - if (Iy) - return Iy(h); + if (Py) + return Py(h); c.prototype = h; var y = new c(); return c.prototype = r, y; @@ -21634,7 +21634,7 @@ h0.exports; }(); function Oh() { } - function zi(c, h) { + function qi(c, h) { this.__wrapped__ = c, this.__actions__ = [], this.__chain__ = !!h, this.__index__ = 0, this.__values__ = r; } ee.templateSettings = { @@ -21681,15 +21681,15 @@ h0.exports; */ _: ee } - }, ee.prototype = Oh.prototype, ee.prototype.constructor = ee, zi.prototype = kc(Oh.prototype), zi.prototype.constructor = zi; + }, ee.prototype = Oh.prototype, ee.prototype.constructor = ee, qi.prototype = kc(Oh.prototype), qi.prototype.constructor = qi; function wr(c) { - this.__wrapped__ = c, this.__actions__ = [], this.__dir__ = 1, this.__filtered__ = !1, this.__iteratees__ = [], this.__takeCount__ = M, this.__views__ = []; + this.__wrapped__ = c, this.__actions__ = [], this.__dir__ = 1, this.__filtered__ = !1, this.__iteratees__ = [], this.__takeCount__ = P, this.__views__ = []; } - function KA() { + function VA() { var c = new wr(this.__wrapped__); return c.__actions__ = fi(this.__actions__), c.__dir__ = this.__dir__, c.__filtered__ = this.__filtered__, c.__iteratees__ = fi(this.__iteratees__), c.__takeCount__ = this.__takeCount__, c.__views__ = fi(this.__views__), c; } - function VA() { + function GA() { if (this.__filtered__) { var c = new wr(this); c.__dir__ = -1, c.__filtered__ = !0; @@ -21697,20 +21697,20 @@ h0.exports; c = this.clone(), c.__dir__ *= -1; return c; } - function GA() { - var c = this.__wrapped__.value(), h = this.__dir__, y = ir(c), O = h < 0, q = y ? c.length : 0, ne = oM(0, q, this.__views__), le = ne.start, me = ne.end, we = me - le, We = O ? me : le - 1, He = this.__iteratees__, Xe = He.length, wt = 0, Ot = Kn(we, this.__takeCount__); + function YA() { + var c = this.__wrapped__.value(), h = this.__dir__, y = ir(c), O = h < 0, q = y ? c.length : 0, ne = aM(0, q, this.__views__), fe = ne.start, me = ne.end, we = me - fe, We = O ? me : fe - 1, He = this.__iteratees__, Xe = He.length, wt = 0, Ot = Vn(we, this.__takeCount__); if (!y || !O && q == we && Ot == we) - return nw(c, this.__actions__); + return tw(c, this.__actions__); var Ht = []; e: for (; we-- && wt < Ot; ) { We += h; for (var fr = -1, Kt = c[We]; ++fr < Xe; ) { - var vr = He[fr], Er = vr.iteratee, Ii = vr.type, ni = Er(Kt); - if (Ii == g) - Kt = ni; - else if (!ni) { - if (Ii == f) + var vr = He[fr], Er = vr.iteratee, Ci = vr.type, ii = Er(Kt); + if (Ci == g) + Kt = ii; + else if (!ii) { + if (Ci == f) continue e; break e; } @@ -21720,21 +21720,21 @@ h0.exports; return Ht; } wr.prototype = kc(Oh.prototype), wr.prototype.constructor = wr; - function $a(c) { + function La(c) { var h = -1, y = c == null ? 0 : c.length; for (this.clear(); ++h < y; ) { var O = c[h]; this.set(O[0], O[1]); } } - function YA() { + function JA() { this.__data__ = nf ? nf(null) : {}, this.size = 0; } - function JA(c) { + function XA(c) { var h = this.has(c) && delete this.__data__[c]; return this.size -= h ? 1 : 0, h; } - function XA(c) { + function ZA(c) { var h = this.__data__; if (nf) { var y = h[c]; @@ -21742,139 +21742,139 @@ h0.exports; } return Tr.call(h, c) ? h[c] : r; } - function ZA(c) { + function QA(c) { var h = this.__data__; return nf ? h[c] !== r : Tr.call(h, c); } - function QA(c, h) { + function eP(c, h) { var y = this.__data__; return this.size += this.has(c) ? 0 : 1, y[c] = nf && h === r ? u : h, this; } - $a.prototype.clear = YA, $a.prototype.delete = JA, $a.prototype.get = XA, $a.prototype.has = ZA, $a.prototype.set = QA; - function ao(c) { + La.prototype.clear = JA, La.prototype.delete = XA, La.prototype.get = ZA, La.prototype.has = QA, La.prototype.set = eP; + function so(c) { var h = -1, y = c == null ? 0 : c.length; for (this.clear(); ++h < y; ) { var O = c[h]; this.set(O[0], O[1]); } } - function eP() { + function tP() { this.__data__ = [], this.size = 0; } - function tP(c) { + function rP(c) { var h = this.__data__, y = Nh(h, c); if (y < 0) return !1; var O = h.length - 1; return y == O ? h.pop() : Mh.call(h, y, 1), --this.size, !0; } - function rP(c) { + function nP(c) { var h = this.__data__, y = Nh(h, c); return y < 0 ? r : h[y][1]; } - function nP(c) { + function iP(c) { return Nh(this.__data__, c) > -1; } - function iP(c, h) { + function sP(c, h) { var y = this.__data__, O = Nh(y, c); return O < 0 ? (++this.size, y.push([c, h])) : y[O][1] = h, this; } - ao.prototype.clear = eP, ao.prototype.delete = tP, ao.prototype.get = rP, ao.prototype.has = nP, ao.prototype.set = iP; - function co(c) { + so.prototype.clear = tP, so.prototype.delete = rP, so.prototype.get = nP, so.prototype.has = iP, so.prototype.set = sP; + function oo(c) { var h = -1, y = c == null ? 0 : c.length; for (this.clear(); ++h < y; ) { var O = c[h]; this.set(O[0], O[1]); } } - function sP() { + function oP() { this.size = 0, this.__data__ = { - hash: new $a(), - map: new (tf || ao)(), - string: new $a() + hash: new La(), + map: new (tf || so)(), + string: new La() }; } - function oP(c) { + function aP(c) { var h = Kh(this, c).delete(c); return this.size -= h ? 1 : 0, h; } - function aP(c) { + function cP(c) { return Kh(this, c).get(c); } - function cP(c) { + function uP(c) { return Kh(this, c).has(c); } - function uP(c, h) { + function fP(c, h) { var y = Kh(this, c), O = y.size; return y.set(c, h), this.size += y.size == O ? 0 : 1, this; } - co.prototype.clear = sP, co.prototype.delete = oP, co.prototype.get = aP, co.prototype.has = cP, co.prototype.set = uP; - function Ba(c) { + oo.prototype.clear = oP, oo.prototype.delete = aP, oo.prototype.get = cP, oo.prototype.has = uP, oo.prototype.set = fP; + function ka(c) { var h = -1, y = c == null ? 0 : c.length; - for (this.__data__ = new co(); ++h < y; ) + for (this.__data__ = new oo(); ++h < y; ) this.add(c[h]); } - function fP(c) { + function lP(c) { return this.__data__.set(c, u), this; } - function lP(c) { + function hP(c) { return this.__data__.has(c); } - Ba.prototype.add = Ba.prototype.push = fP, Ba.prototype.has = lP; + ka.prototype.add = ka.prototype.push = lP, ka.prototype.has = hP; function hs(c) { - var h = this.__data__ = new ao(c); + var h = this.__data__ = new so(c); this.size = h.size; } - function hP() { - this.__data__ = new ao(), this.size = 0; + function dP() { + this.__data__ = new so(), this.size = 0; } - function dP(c) { + function pP(c) { var h = this.__data__, y = h.delete(c); return this.size = h.size, y; } - function pP(c) { + function gP(c) { return this.__data__.get(c); } - function gP(c) { + function mP(c) { return this.__data__.has(c); } - function mP(c, h) { + function vP(c, h) { var y = this.__data__; - if (y instanceof ao) { + if (y instanceof so) { var O = y.__data__; if (!tf || O.length < i - 1) return O.push([c, h]), this.size = ++y.size, this; - y = this.__data__ = new co(O); + y = this.__data__ = new oo(O); } return y.set(c, h), this.size = y.size, this; } - hs.prototype.clear = hP, hs.prototype.delete = dP, hs.prototype.get = pP, hs.prototype.has = gP, hs.prototype.set = mP; - function Ny(c, h) { - var y = ir(c), O = !y && za(c), q = !y && !O && ea(c), ne = !y && !O && !q && jc(c), le = y || O || q || ne, me = le ? Up(c.length, PA) : [], we = me.length; + hs.prototype.clear = dP, hs.prototype.delete = pP, hs.prototype.get = gP, hs.prototype.has = mP, hs.prototype.set = vP; + function Dy(c, h) { + var y = ir(c), O = !y && Ua(c), q = !y && !O && Zo(c), ne = !y && !O && !q && jc(c), fe = y || O || q || ne, me = fe ? Up(c.length, MA) : [], we = me.length; for (var We in c) - (h || Tr.call(c, We)) && !(le && // Safari 9 has enumerable `arguments.length` in strict mode. + (h || Tr.call(c, We)) && !(fe && // Safari 9 has enumerable `arguments.length` in strict mode. (We == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. q && (We == "offset" || We == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. ne && (We == "buffer" || We == "byteLength" || We == "byteOffset") || // Skip index properties. - ho(We, we))) && me.push(We); + fo(We, we))) && me.push(We); return me; } - function Ly(c) { + function Oy(c) { var h = c.length; return h ? c[ig(0, h - 1)] : r; } - function vP(c, h) { - return Vh(fi(c), Fa(h, 0, c.length)); + function bP(c, h) { + return Vh(fi(c), $a(h, 0, c.length)); } - function bP(c) { + function yP(c) { return Vh(fi(c)); } function Gp(c, h, y) { - (y !== r && !ds(c[h], y) || y === r && !(h in c)) && uo(c, h, y); + (y !== r && !ds(c[h], y) || y === r && !(h in c)) && ao(c, h, y); } function of(c, h, y) { var O = c[h]; - (!(Tr.call(c, h) && ds(O, y)) || y === r && !(h in c)) && uo(c, h, y); + (!(Tr.call(c, h) && ds(O, y)) || y === r && !(h in c)) && ao(c, h, y); } function Nh(c, h) { for (var y = c.length; y--; ) @@ -21882,18 +21882,18 @@ h0.exports; return y; return -1; } - function yP(c, h, y, O) { - return Jo(c, function(q, ne, le) { - h(O, q, y(q), le); + function wP(c, h, y, O) { + return Go(c, function(q, ne, fe) { + h(O, q, y(q), fe); }), O; } - function ky(c, h) { + function Ny(c, h) { return c && Ts(h, Mn(h), c); } - function wP(c, h) { + function xP(c, h) { return c && Ts(h, hi(h), c); } - function uo(c, h, y) { + function ao(c, h, y) { h == "__proto__" && Ih ? Ih(c, h, { configurable: !0, enumerable: !0, @@ -21906,79 +21906,79 @@ h0.exports; q[y] = ne ? r : Cg(c, h[y]); return q; } - function Fa(c, h, y) { + function $a(c, h, y) { return c === c && (y !== r && (c = c <= y ? c : y), h !== r && (c = c >= h ? c : h)), c; } - function Wi(c, h, y, O, q, ne) { - var le, me = h & p, we = h & w, We = h & A; - if (y && (le = q ? y(c, O, q, ne) : y(c)), le !== r) - return le; + function zi(c, h, y, O, q, ne) { + var fe, me = h & p, we = h & w, We = h & A; + if (y && (fe = q ? y(c, O, q, ne) : y(c)), fe !== r) + return fe; if (!Zr(c)) return c; var He = ir(c); if (He) { - if (le = cM(c), !me) - return fi(c, le); + if (fe = uM(c), !me) + return fi(c, fe); } else { - var Xe = Vn(c), wt = Xe == re || Xe == pe; - if (ea(c)) - return ow(c, me); + var Xe = Gn(c), wt = Xe == re || Xe == de; + if (Zo(c)) + return iw(c, me); if (Xe == Pe || Xe == D || wt && !q) { - if (le = we || wt ? {} : Aw(c), !me) - return we ? XP(c, wP(le, c)) : JP(c, ky(le, c)); + if (fe = we || wt ? {} : Ew(c), !me) + return we ? ZP(c, xP(fe, c)) : XP(c, Ny(fe, c)); } else { if (!Dr[Xe]) return q ? c : {}; - le = uM(c, Xe, me); + fe = fM(c, Xe, me); } } ne || (ne = new hs()); var Ot = ne.get(c); if (Ot) return Ot; - ne.set(c, le), e2(c) ? c.forEach(function(Kt) { - le.add(Wi(Kt, h, y, Kt, c, ne)); - }) : Zw(c) && c.forEach(function(Kt, vr) { - le.set(vr, Wi(Kt, h, y, vr, c, ne)); + ne.set(c, fe), Zw(c) ? c.forEach(function(Kt) { + fe.add(zi(Kt, h, y, Kt, c, ne)); + }) : Jw(c) && c.forEach(function(Kt, vr) { + fe.set(vr, zi(Kt, h, y, vr, c, ne)); }); var Ht = We ? we ? gg : pg : we ? hi : Mn, fr = He ? r : Ht(c); - return Ui(fr || c, function(Kt, vr) { - fr && (vr = Kt, Kt = c[vr]), of(le, vr, Wi(Kt, h, y, vr, c, ne)); - }), le; + return ji(fr || c, function(Kt, vr) { + fr && (vr = Kt, Kt = c[vr]), of(fe, vr, zi(Kt, h, y, vr, c, ne)); + }), fe; } - function xP(c) { + function _P(c) { var h = Mn(c); return function(y) { - return $y(y, c, h); + return Ly(y, c, h); }; } - function $y(c, h, y) { + function Ly(c, h, y) { var O = y.length; if (c == null) return !O; for (c = qr(c); O--; ) { - var q = y[O], ne = h[q], le = c[q]; - if (le === r && !(q in c) || !ne(le)) + var q = y[O], ne = h[q], fe = c[q]; + if (fe === r && !(q in c) || !ne(fe)) return !1; } return !0; } - function By(c, h, y) { + function ky(c, h, y) { if (typeof c != "function") - throw new qi(o); + throw new Ui(o); return df(function() { c.apply(r, y); }, h); } function af(c, h, y, O) { - var q = -1, ne = vh, le = !0, me = c.length, we = [], We = h.length; + var q = -1, ne = vh, fe = !0, me = c.length, we = [], We = h.length; if (!me) return we; - y && (h = Xr(h, Ai(y))), O ? (ne = Lp, le = !1) : h.length >= i && (ne = Qu, le = !1, h = new Ba(h)); + y && (h = Xr(h, Pi(y))), O ? (ne = Lp, fe = !1) : h.length >= i && (ne = Qu, fe = !1, h = new ka(h)); e: for (; ++q < me; ) { var He = c[q], Xe = y == null ? He : y(He); - if (He = O || He !== 0 ? He : 0, le && Xe === Xe) { + if (He = O || He !== 0 ? He : 0, fe && Xe === Xe) { for (var wt = We; wt--; ) if (h[wt] === Xe) continue e; @@ -21987,82 +21987,82 @@ h0.exports; } return we; } - var Jo = lw(Cs), Fy = lw(Xp, !0); - function _P(c, h) { + var Go = uw(Cs), $y = uw(Xp, !0); + function EP(c, h) { var y = !0; - return Jo(c, function(O, q, ne) { + return Go(c, function(O, q, ne) { return y = !!h(O, q, ne), y; }), y; } function Lh(c, h, y) { for (var O = -1, q = c.length; ++O < q; ) { - var ne = c[O], le = h(ne); - if (le != null && (me === r ? le === le && !Mi(le) : y(le, me))) - var me = le, we = ne; + var ne = c[O], fe = h(ne); + if (fe != null && (me === r ? fe === fe && !Ii(fe) : y(fe, me))) + var me = fe, we = ne; } return we; } - function EP(c, h, y, O) { + function SP(c, h, y, O) { var q = c.length; - for (y = cr(y), y < 0 && (y = -y > q ? 0 : q + y), O = O === r || O > q ? q : cr(O), O < 0 && (O += q), O = y > O ? 0 : r2(O); y < O; ) + for (y = cr(y), y < 0 && (y = -y > q ? 0 : q + y), O = O === r || O > q ? q : cr(O), O < 0 && (O += q), O = y > O ? 0 : e2(O); y < O; ) c[y++] = h; return c; } - function jy(c, h) { + function By(c, h) { var y = []; - return Jo(c, function(O, q, ne) { + return Go(c, function(O, q, ne) { h(O, q, ne) && y.push(O); }), y; } function Bn(c, h, y, O, q) { - var ne = -1, le = c.length; - for (y || (y = lM), q || (q = []); ++ne < le; ) { + var ne = -1, fe = c.length; + for (y || (y = hM), q || (q = []); ++ne < fe; ) { var me = c[ne]; - h > 0 && y(me) ? h > 1 ? Bn(me, h - 1, y, O, q) : Vo(q, me) : O || (q[q.length] = me); + h > 0 && y(me) ? h > 1 ? Bn(me, h - 1, y, O, q) : Ho(q, me) : O || (q[q.length] = me); } return q; } - var Jp = hw(), Uy = hw(!0); + var Jp = fw(), Fy = fw(!0); function Cs(c, h) { return c && Jp(c, h, Mn); } function Xp(c, h) { - return c && Uy(c, h, Mn); + return c && Fy(c, h, Mn); } function kh(c, h) { - return Ko(h, function(y) { - return po(c[y]); + return Wo(h, function(y) { + return lo(c[y]); }); } - function ja(c, h) { - h = Zo(h, c); + function Ba(c, h) { + h = Jo(h, c); for (var y = 0, O = h.length; c != null && y < O; ) c = c[Rs(h[y++])]; return y && y == O ? c : r; } - function qy(c, h, y) { + function jy(c, h, y) { var O = h(c); - return ir(c) ? O : Vo(O, y(c)); + return ir(c) ? O : Ho(O, y(c)); } - function ti(c) { - return c == null ? c === r ? Le : ve : ka && ka in qr(c) ? sM(c) : bM(c); + function ri(c) { + return c == null ? c === r ? Le : ve : Na && Na in qr(c) ? oM(c) : yM(c); } function Zp(c, h) { return c > h; } - function SP(c, h) { + function AP(c, h) { return c != null && Tr.call(c, h); } - function AP(c, h) { + function PP(c, h) { return c != null && h in qr(c); } - function PP(c, h, y) { - return c >= Kn(h, y) && c < _n(h, y); + function MP(c, h, y) { + return c >= Vn(h, y) && c < _n(h, y); } function Qp(c, h, y) { - for (var O = y ? Lp : vh, q = c[0].length, ne = c.length, le = ne, me = Ie(ne), we = 1 / 0, We = []; le--; ) { - var He = c[le]; - le && h && (He = Xr(He, Ai(h))), we = Kn(He.length, we), me[le] = !y && (h || q >= 120 && He.length >= 120) ? new Ba(le && He) : r; + for (var O = y ? Lp : vh, q = c[0].length, ne = c.length, fe = ne, me = Ie(ne), we = 1 / 0, We = []; fe--; ) { + var He = c[fe]; + fe && h && (He = Xr(He, Pi(h))), we = Vn(He.length, we), me[fe] = !y && (h || q >= 120 && He.length >= 120) ? new ka(fe && He) : r; } He = c[0]; var Xe = -1, wt = me[0]; @@ -22070,9 +22070,9 @@ h0.exports; for (; ++Xe < q && We.length < we; ) { var Ot = He[Xe], Ht = h ? h(Ot) : Ot; if (Ot = y || Ot !== 0 ? Ot : 0, !(wt ? Qu(wt, Ht) : O(We, Ht, y))) { - for (le = ne; --le; ) { - var fr = me[le]; - if (!(fr ? Qu(fr, Ht) : O(c[le], Ht, y))) + for (fe = ne; --fe; ) { + var fr = me[fe]; + if (!(fr ? Qu(fr, Ht) : O(c[fe], Ht, y))) continue e; } wt && wt.push(Ht), We.push(Ot); @@ -22080,105 +22080,105 @@ h0.exports; } return We; } - function MP(c, h, y, O) { - return Cs(c, function(q, ne, le) { - h(O, y(q), ne, le); + function IP(c, h, y, O) { + return Cs(c, function(q, ne, fe) { + h(O, y(q), ne, fe); }), O; } function cf(c, h, y) { - h = Zo(h, c), c = Cw(c, h); - var O = c == null ? c : c[Rs(Ki(h))]; + h = Jo(h, c), c = Mw(c, h); + var O = c == null ? c : c[Rs(Hi(h))]; return O == null ? r : Pn(O, c, y); } - function zy(c) { - return en(c) && ti(c) == D; - } - function IP(c) { - return en(c) && ti(c) == _e; + function Uy(c) { + return en(c) && ri(c) == D; } function CP(c) { - return en(c) && ti(c) == Q; + return en(c) && ri(c) == _e; + } + function TP(c) { + return en(c) && ri(c) == Q; } function uf(c, h, y, O, q) { - return c === h ? !0 : c == null || h == null || !en(c) && !en(h) ? c !== c && h !== h : TP(c, h, y, O, uf, q); + return c === h ? !0 : c == null || h == null || !en(c) && !en(h) ? c !== c && h !== h : RP(c, h, y, O, uf, q); } - function TP(c, h, y, O, q, ne) { - var le = ir(c), me = ir(h), we = le ? oe : Vn(c), We = me ? oe : Vn(h); + function RP(c, h, y, O, q, ne) { + var fe = ir(c), me = ir(h), we = fe ? oe : Gn(c), We = me ? oe : Gn(h); we = we == D ? Pe : we, We = We == D ? Pe : We; var He = we == Pe, Xe = We == Pe, wt = we == We; - if (wt && ea(c)) { - if (!ea(h)) + if (wt && Zo(c)) { + if (!Zo(h)) return !1; - le = !0, He = !1; + fe = !0, He = !1; } if (wt && !He) - return ne || (ne = new hs()), le || jc(c) ? _w(c, h, y, O, q, ne) : nM(c, h, we, y, O, q, ne); - if (!(y & P)) { + return ne || (ne = new hs()), fe || jc(c) ? ww(c, h, y, O, q, ne) : iM(c, h, we, y, O, q, ne); + if (!(y & M)) { var Ot = He && Tr.call(c, "__wrapped__"), Ht = Xe && Tr.call(h, "__wrapped__"); if (Ot || Ht) { var fr = Ot ? c.value() : c, Kt = Ht ? h.value() : h; return ne || (ne = new hs()), q(fr, Kt, y, O, ne); } } - return wt ? (ne || (ne = new hs()), iM(c, h, y, O, q, ne)) : !1; + return wt ? (ne || (ne = new hs()), sM(c, h, y, O, q, ne)) : !1; } - function RP(c) { - return en(c) && Vn(c) == ie; + function DP(c) { + return en(c) && Gn(c) == ie; } function eg(c, h, y, O) { - var q = y.length, ne = q, le = !O; + var q = y.length, ne = q, fe = !O; if (c == null) return !ne; for (c = qr(c); q--; ) { var me = y[q]; - if (le && me[2] ? me[1] !== c[me[0]] : !(me[0] in c)) + if (fe && me[2] ? me[1] !== c[me[0]] : !(me[0] in c)) return !1; } for (; ++q < ne; ) { me = y[q]; var we = me[0], We = c[we], He = me[1]; - if (le && me[2]) { + if (fe && me[2]) { if (We === r && !(we in c)) return !1; } else { var Xe = new hs(); if (O) var wt = O(We, He, we, c, h, Xe); - if (!(wt === r ? uf(He, We, P | N, O, Xe) : wt)) + if (!(wt === r ? uf(He, We, M | N, O, Xe) : wt)) return !1; } } return !0; } - function Wy(c) { - if (!Zr(c) || dM(c)) + function qy(c) { + if (!Zr(c) || pM(c)) return !1; - var h = po(c) ? RA : je; - return h.test(qa(c)); - } - function DP(c) { - return en(c) && ti(c) == $e; + var h = lo(c) ? DA : je; + return h.test(ja(c)); } function OP(c) { - return en(c) && Vn(c) == Me; + return en(c) && ri(c) == $e; } function NP(c) { - return en(c) && Qh(c.length) && !!Fr[ti(c)]; + return en(c) && Gn(c) == Me; } - function Hy(c) { - return typeof c == "function" ? c : c == null ? di : typeof c == "object" ? ir(c) ? Gy(c[0], c[1]) : Vy(c) : d2(c); + function LP(c) { + return en(c) && Qh(c.length) && !!Fr[ri(c)]; + } + function zy(c) { + return typeof c == "function" ? c : c == null ? di : typeof c == "object" ? ir(c) ? Ky(c[0], c[1]) : Hy(c) : l2(c); } function tg(c) { if (!hf(c)) - return $A(c); + return BA(c); var h = []; for (var y in qr(c)) Tr.call(c, y) && y != "constructor" && h.push(y); return h; } - function LP(c) { + function kP(c) { if (!Zr(c)) - return vM(c); + return bM(c); var h = hf(c), y = []; for (var O in c) O == "constructor" && (h || !Tr.call(c, O)) || y.push(O); @@ -22187,111 +22187,111 @@ h0.exports; function rg(c, h) { return c < h; } - function Ky(c, h) { + function Wy(c, h) { var y = -1, O = li(c) ? Ie(c.length) : []; - return Jo(c, function(q, ne, le) { - O[++y] = h(q, ne, le); + return Go(c, function(q, ne, fe) { + O[++y] = h(q, ne, fe); }), O; } - function Vy(c) { + function Hy(c) { var h = vg(c); - return h.length == 1 && h[0][2] ? Mw(h[0][0], h[0][1]) : function(y) { + return h.length == 1 && h[0][2] ? Aw(h[0][0], h[0][1]) : function(y) { return y === c || eg(y, c, h); }; } - function Gy(c, h) { - return yg(c) && Pw(h) ? Mw(Rs(c), h) : function(y) { + function Ky(c, h) { + return yg(c) && Sw(h) ? Aw(Rs(c), h) : function(y) { var O = Cg(y, c); - return O === r && O === h ? Tg(y, c) : uf(h, O, P | N); + return O === r && O === h ? Tg(y, c) : uf(h, O, M | N); }; } function $h(c, h, y, O, q) { - c !== h && Jp(h, function(ne, le) { + c !== h && Jp(h, function(ne, fe) { if (q || (q = new hs()), Zr(ne)) - kP(c, h, le, y, $h, O, q); + $P(c, h, fe, y, $h, O, q); else { - var me = O ? O(xg(c, le), ne, le + "", c, h, q) : r; - me === r && (me = ne), Gp(c, le, me); + var me = O ? O(xg(c, fe), ne, fe + "", c, h, q) : r; + me === r && (me = ne), Gp(c, fe, me); } }, hi); } - function kP(c, h, y, O, q, ne, le) { - var me = xg(c, y), we = xg(h, y), We = le.get(we); + function $P(c, h, y, O, q, ne, fe) { + var me = xg(c, y), we = xg(h, y), We = fe.get(we); if (We) { Gp(c, y, We); return; } - var He = ne ? ne(me, we, y + "", c, h, le) : r, Xe = He === r; + var He = ne ? ne(me, we, y + "", c, h, fe) : r, Xe = He === r; if (Xe) { - var wt = ir(we), Ot = !wt && ea(we), Ht = !wt && !Ot && jc(we); - He = we, wt || Ot || Ht ? ir(me) ? He = me : cn(me) ? He = fi(me) : Ot ? (Xe = !1, He = ow(we, !0)) : Ht ? (Xe = !1, He = aw(we, !0)) : He = [] : pf(we) || za(we) ? (He = me, za(me) ? He = n2(me) : (!Zr(me) || po(me)) && (He = Aw(we))) : Xe = !1; + var wt = ir(we), Ot = !wt && Zo(we), Ht = !wt && !Ot && jc(we); + He = we, wt || Ot || Ht ? ir(me) ? He = me : cn(me) ? He = fi(me) : Ot ? (Xe = !1, He = iw(we, !0)) : Ht ? (Xe = !1, He = sw(we, !0)) : He = [] : pf(we) || Ua(we) ? (He = me, Ua(me) ? He = t2(me) : (!Zr(me) || lo(me)) && (He = Ew(we))) : Xe = !1; } - Xe && (le.set(we, He), q(He, we, O, ne, le), le.delete(we)), Gp(c, y, He); + Xe && (fe.set(we, He), q(He, we, O, ne, fe), fe.delete(we)), Gp(c, y, He); } - function Yy(c, h) { + function Vy(c, h) { var y = c.length; if (y) - return h += h < 0 ? y : 0, ho(h, y) ? c[h] : r; + return h += h < 0 ? y : 0, fo(h, y) ? c[h] : r; } - function Jy(c, h, y) { + function Gy(c, h, y) { h.length ? h = Xr(h, function(ne) { - return ir(ne) ? function(le) { - return ja(le, ne.length === 1 ? ne[0] : ne); + return ir(ne) ? function(fe) { + return Ba(fe, ne.length === 1 ? ne[0] : ne); } : ne; }) : h = [di]; var O = -1; - h = Xr(h, Ai(Ut())); - var q = Ky(c, function(ne, le, me) { + h = Xr(h, Pi(Ut())); + var q = Wy(c, function(ne, fe, me) { var we = Xr(h, function(We) { return We(ne); }); return { criteria: we, index: ++O, value: ne }; }); - return uA(q, function(ne, le) { - return YP(ne, le, y); + return fA(q, function(ne, fe) { + return JP(ne, fe, y); }); } - function $P(c, h) { - return Xy(c, h, function(y, O) { + function BP(c, h) { + return Yy(c, h, function(y, O) { return Tg(c, O); }); } - function Xy(c, h, y) { + function Yy(c, h, y) { for (var O = -1, q = h.length, ne = {}; ++O < q; ) { - var le = h[O], me = ja(c, le); - y(me, le) && ff(ne, Zo(le, c), me); + var fe = h[O], me = Ba(c, fe); + y(me, fe) && ff(ne, Jo(fe, c), me); } return ne; } - function BP(c) { + function FP(c) { return function(h) { - return ja(h, c); + return Ba(h, c); }; } function ng(c, h, y, O) { - var q = O ? cA : Cc, ne = -1, le = h.length, me = c; - for (c === h && (h = fi(h)), y && (me = Xr(c, Ai(y))); ++ne < le; ) + var q = O ? uA : Cc, ne = -1, fe = h.length, me = c; + for (c === h && (h = fi(h)), y && (me = Xr(c, Pi(y))); ++ne < fe; ) for (var we = 0, We = h[ne], He = y ? y(We) : We; (we = q(me, He, we, O)) > -1; ) me !== c && Mh.call(me, we, 1), Mh.call(c, we, 1); return c; } - function Zy(c, h) { + function Jy(c, h) { for (var y = c ? h.length : 0, O = y - 1; y--; ) { var q = h[y]; if (y == O || q !== ne) { var ne = q; - ho(q) ? Mh.call(c, q, 1) : ag(c, q); + fo(q) ? Mh.call(c, q, 1) : ag(c, q); } } return c; } function ig(c, h) { - return c + Th(Dy() * (h - c + 1)); + return c + Th(Ty() * (h - c + 1)); } - function FP(c, h, y, O) { - for (var q = -1, ne = _n(Ch((h - c) / (y || 1)), 0), le = Ie(ne); ne--; ) - le[O ? ne : ++q] = c, c += y; - return le; + function jP(c, h, y, O) { + for (var q = -1, ne = _n(Ch((h - c) / (y || 1)), 0), fe = Ie(ne); ne--; ) + fe[O ? ne : ++q] = c, c += y; + return fe; } function sg(c, h) { var y = ""; @@ -22303,34 +22303,34 @@ h0.exports; return y; } function hr(c, h) { - return _g(Iw(c, h, di), c + ""); + return _g(Pw(c, h, di), c + ""); } - function jP(c) { - return Ly(Uc(c)); + function UP(c) { + return Oy(Uc(c)); } - function UP(c, h) { + function qP(c, h) { var y = Uc(c); - return Vh(y, Fa(h, 0, y.length)); + return Vh(y, $a(h, 0, y.length)); } function ff(c, h, y, O) { if (!Zr(c)) return c; - h = Zo(h, c); - for (var q = -1, ne = h.length, le = ne - 1, me = c; me != null && ++q < ne; ) { + h = Jo(h, c); + for (var q = -1, ne = h.length, fe = ne - 1, me = c; me != null && ++q < ne; ) { var we = Rs(h[q]), We = y; if (we === "__proto__" || we === "constructor" || we === "prototype") return c; - if (q != le) { + if (q != fe) { var He = me[we]; - We = O ? O(He, we, me) : r, We === r && (We = Zr(He) ? He : ho(h[q + 1]) ? [] : {}); + We = O ? O(He, we, me) : r, We === r && (We = Zr(He) ? He : fo(h[q + 1]) ? [] : {}); } of(me, we, We), me = me[we]; } return c; } - var Qy = Rh ? function(c, h) { + var Xy = Rh ? function(c, h) { return Rh.set(c, h), c; - } : di, qP = Ih ? function(c, h) { + } : di, zP = Ih ? function(c, h) { return Ih(c, "toString", { configurable: !0, enumerable: !1, @@ -22338,19 +22338,19 @@ h0.exports; writable: !0 }); } : di; - function zP(c) { + function WP(c) { return Vh(Uc(c)); } - function Hi(c, h, y) { + function Wi(c, h, y) { var O = -1, q = c.length; h < 0 && (h = -h > q ? 0 : q + h), y = y > q ? q : y, y < 0 && (y += q), q = h > y ? 0 : y - h >>> 0, h >>>= 0; for (var ne = Ie(q); ++O < q; ) ne[O] = c[O + h]; return ne; } - function WP(c, h) { + function HP(c, h) { var y; - return Jo(c, function(O, q, ne) { + return Go(c, function(O, q, ne) { return y = h(O, q, ne), !y; }), !!y; } @@ -22358,8 +22358,8 @@ h0.exports; var O = 0, q = c == null ? O : c.length; if (typeof h == "number" && h === h && q <= F) { for (; O < q; ) { - var ne = O + q >>> 1, le = c[ne]; - le !== null && !Mi(le) && (y ? le <= h : le < h) ? O = ne + 1 : q = ne; + var ne = O + q >>> 1, fe = c[ne]; + fe !== null && !Ii(fe) && (y ? fe <= h : fe < h) ? O = ne + 1 : q = ne; } return q; } @@ -22370,53 +22370,53 @@ h0.exports; if (ne === 0) return 0; h = y(h); - for (var le = h !== h, me = h === null, we = Mi(h), We = h === r; q < ne; ) { - var He = Th((q + ne) / 2), Xe = y(c[He]), wt = Xe !== r, Ot = Xe === null, Ht = Xe === Xe, fr = Mi(Xe); - if (le) + for (var fe = h !== h, me = h === null, we = Ii(h), We = h === r; q < ne; ) { + var He = Th((q + ne) / 2), Xe = y(c[He]), wt = Xe !== r, Ot = Xe === null, Ht = Xe === Xe, fr = Ii(Xe); + if (fe) var Kt = O || Ht; else We ? Kt = Ht && (O || wt) : me ? Kt = Ht && wt && (O || !Ot) : we ? Kt = Ht && wt && !Ot && (O || !fr) : Ot || fr ? Kt = !1 : Kt = O ? Xe <= h : Xe < h; Kt ? q = He + 1 : ne = He; } - return Kn(ne, I); + return Vn(ne, I); } - function ew(c, h) { + function Zy(c, h) { for (var y = -1, O = c.length, q = 0, ne = []; ++y < O; ) { - var le = c[y], me = h ? h(le) : le; + var fe = c[y], me = h ? h(fe) : fe; if (!y || !ds(me, we)) { var we = me; - ne[q++] = le === 0 ? 0 : le; + ne[q++] = fe === 0 ? 0 : fe; } } return ne; } - function tw(c) { - return typeof c == "number" ? c : Mi(c) ? v : +c; + function Qy(c) { + return typeof c == "number" ? c : Ii(c) ? v : +c; } - function Pi(c) { + function Mi(c) { if (typeof c == "string") return c; if (ir(c)) - return Xr(c, Pi) + ""; - if (Mi(c)) - return Oy ? Oy.call(c) : ""; + return Xr(c, Mi) + ""; + if (Ii(c)) + return Ry ? Ry.call(c) : ""; var h = c + ""; return h == "0" && 1 / c == -x ? "-0" : h; } - function Xo(c, h, y) { - var O = -1, q = vh, ne = c.length, le = !0, me = [], we = me; + function Yo(c, h, y) { + var O = -1, q = vh, ne = c.length, fe = !0, me = [], we = me; if (y) - le = !1, q = Lp; + fe = !1, q = Lp; else if (ne >= i) { - var We = h ? null : tM(c); + var We = h ? null : rM(c); if (We) return yh(We); - le = !1, q = Qu, we = new Ba(); + fe = !1, q = Qu, we = new ka(); } else we = h ? [] : me; e: for (; ++O < ne; ) { var He = c[O], Xe = h ? h(He) : He; - if (He = y || He !== 0 ? He : 0, le && Xe === Xe) { + if (He = y || He !== 0 ? He : 0, fe && Xe === Xe) { for (var wt = we.length; wt--; ) if (we[wt] === Xe) continue e; @@ -22426,37 +22426,37 @@ h0.exports; return me; } function ag(c, h) { - return h = Zo(h, c), c = Cw(c, h), c == null || delete c[Rs(Ki(h))]; + return h = Jo(h, c), c = Mw(c, h), c == null || delete c[Rs(Hi(h))]; } - function rw(c, h, y, O) { - return ff(c, h, y(ja(c, h)), O); + function ew(c, h, y, O) { + return ff(c, h, y(Ba(c, h)), O); } function Fh(c, h, y, O) { for (var q = c.length, ne = O ? q : -1; (O ? ne-- : ++ne < q) && h(c[ne], ne, c); ) ; - return y ? Hi(c, O ? 0 : ne, O ? ne + 1 : q) : Hi(c, O ? ne + 1 : 0, O ? q : ne); + return y ? Wi(c, O ? 0 : ne, O ? ne + 1 : q) : Wi(c, O ? ne + 1 : 0, O ? q : ne); } - function nw(c, h) { + function tw(c, h) { var y = c; return y instanceof wr && (y = y.value()), kp(h, function(O, q) { - return q.func.apply(q.thisArg, Vo([O], q.args)); + return q.func.apply(q.thisArg, Ho([O], q.args)); }, y); } function cg(c, h, y) { var O = c.length; if (O < 2) - return O ? Xo(c[0]) : []; + return O ? Yo(c[0]) : []; for (var q = -1, ne = Ie(O); ++q < O; ) - for (var le = c[q], me = -1; ++me < O; ) - me != q && (ne[q] = af(ne[q] || le, c[me], h, y)); - return Xo(Bn(ne, 1), h, y); + for (var fe = c[q], me = -1; ++me < O; ) + me != q && (ne[q] = af(ne[q] || fe, c[me], h, y)); + return Yo(Bn(ne, 1), h, y); } - function iw(c, h, y) { - for (var O = -1, q = c.length, ne = h.length, le = {}; ++O < q; ) { + function rw(c, h, y) { + for (var O = -1, q = c.length, ne = h.length, fe = {}; ++O < q; ) { var me = O < ne ? h[O] : r; - y(le, c[O], me); + y(fe, c[O], me); } - return le; + return fe; } function ug(c) { return cn(c) ? c : []; @@ -22464,55 +22464,55 @@ h0.exports; function fg(c) { return typeof c == "function" ? c : di; } - function Zo(c, h) { - return ir(c) ? c : yg(c, h) ? [c] : Ow(Cr(c)); + function Jo(c, h) { + return ir(c) ? c : yg(c, h) ? [c] : Rw(Cr(c)); } - var HP = hr; - function Qo(c, h, y) { + var KP = hr; + function Xo(c, h, y) { var O = c.length; - return y = y === r ? O : y, !h && y >= O ? c : Hi(c, h, y); + return y = y === r ? O : y, !h && y >= O ? c : Wi(c, h, y); } - var sw = DA || function(c) { + var nw = OA || function(c) { return _r.clearTimeout(c); }; - function ow(c, h) { + function iw(c, h) { if (h) return c.slice(); - var y = c.length, O = My ? My(y) : new c.constructor(y); + var y = c.length, O = Ay ? Ay(y) : new c.constructor(y); return c.copy(O), O; } function lg(c) { var h = new c.constructor(c.byteLength); return new Ah(h).set(new Ah(c)), h; } - function KP(c, h) { + function VP(c, h) { var y = h ? lg(c.buffer) : c.buffer; return new c.constructor(y, c.byteOffset, c.byteLength); } - function VP(c) { + function GP(c) { var h = new c.constructor(c.source, Te.exec(c)); return h.lastIndex = c.lastIndex, h; } - function GP(c) { + function YP(c) { return sf ? qr(sf.call(c)) : {}; } - function aw(c, h) { + function sw(c, h) { var y = h ? lg(c.buffer) : c.buffer; return new c.constructor(y, c.byteOffset, c.length); } - function cw(c, h) { + function ow(c, h) { if (c !== h) { - var y = c !== r, O = c === null, q = c === c, ne = Mi(c), le = h !== r, me = h === null, we = h === h, We = Mi(h); - if (!me && !We && !ne && c > h || ne && le && we && !me && !We || O && le && we || !y && we || !q) + var y = c !== r, O = c === null, q = c === c, ne = Ii(c), fe = h !== r, me = h === null, we = h === h, We = Ii(h); + if (!me && !We && !ne && c > h || ne && fe && we && !me && !We || O && fe && we || !y && we || !q) return 1; - if (!O && !ne && !We && c < h || We && y && q && !O && !ne || me && y && q || !le && q || !we) + if (!O && !ne && !We && c < h || We && y && q && !O && !ne || me && y && q || !fe && q || !we) return -1; } return 0; } - function YP(c, h, y) { - for (var O = -1, q = c.criteria, ne = h.criteria, le = q.length, me = y.length; ++O < le; ) { - var we = cw(q[O], ne[O]); + function JP(c, h, y) { + for (var O = -1, q = c.criteria, ne = h.criteria, fe = q.length, me = y.length; ++O < fe; ) { + var we = ow(q[O], ne[O]); if (we) { if (O >= me) return we; @@ -22522,22 +22522,22 @@ h0.exports; } return c.index - h.index; } - function uw(c, h, y, O) { - for (var q = -1, ne = c.length, le = y.length, me = -1, we = h.length, We = _n(ne - le, 0), He = Ie(we + We), Xe = !O; ++me < we; ) + function aw(c, h, y, O) { + for (var q = -1, ne = c.length, fe = y.length, me = -1, we = h.length, We = _n(ne - fe, 0), He = Ie(we + We), Xe = !O; ++me < we; ) He[me] = h[me]; - for (; ++q < le; ) + for (; ++q < fe; ) (Xe || q < ne) && (He[y[q]] = c[q]); for (; We--; ) He[me++] = c[q++]; return He; } - function fw(c, h, y, O) { - for (var q = -1, ne = c.length, le = -1, me = y.length, we = -1, We = h.length, He = _n(ne - me, 0), Xe = Ie(He + We), wt = !O; ++q < He; ) + function cw(c, h, y, O) { + for (var q = -1, ne = c.length, fe = -1, me = y.length, we = -1, We = h.length, He = _n(ne - me, 0), Xe = Ie(He + We), wt = !O; ++q < He; ) Xe[q] = c[q]; for (var Ot = q; ++we < We; ) Xe[Ot + we] = h[we]; - for (; ++le < me; ) - (wt || q < ne) && (Xe[Ot + y[le]] = c[q++]); + for (; ++fe < me; ) + (wt || q < ne) && (Xe[Ot + y[fe]] = c[q++]); return Xe; } function fi(c, h) { @@ -22549,73 +22549,73 @@ h0.exports; function Ts(c, h, y, O) { var q = !y; y || (y = {}); - for (var ne = -1, le = h.length; ++ne < le; ) { + for (var ne = -1, fe = h.length; ++ne < fe; ) { var me = h[ne], we = O ? O(y[me], c[me], me, y, c) : r; - we === r && (we = c[me]), q ? uo(y, me, we) : of(y, me, we); + we === r && (we = c[me]), q ? ao(y, me, we) : of(y, me, we); } return y; } - function JP(c, h) { + function XP(c, h) { return Ts(c, bg(c), h); } - function XP(c, h) { - return Ts(c, Ew(c), h); + function ZP(c, h) { + return Ts(c, xw(c), h); } function jh(c, h) { return function(y, O) { - var q = ir(y) ? rA : yP, ne = h ? h() : {}; + var q = ir(y) ? nA : wP, ne = h ? h() : {}; return q(y, c, Ut(O, 2), ne); }; } function $c(c) { return hr(function(h, y) { - var O = -1, q = y.length, ne = q > 1 ? y[q - 1] : r, le = q > 2 ? y[2] : r; - for (ne = c.length > 3 && typeof ne == "function" ? (q--, ne) : r, le && ri(y[0], y[1], le) && (ne = q < 3 ? r : ne, q = 1), h = qr(h); ++O < q; ) { + var O = -1, q = y.length, ne = q > 1 ? y[q - 1] : r, fe = q > 2 ? y[2] : r; + for (ne = c.length > 3 && typeof ne == "function" ? (q--, ne) : r, fe && ni(y[0], y[1], fe) && (ne = q < 3 ? r : ne, q = 1), h = qr(h); ++O < q; ) { var me = y[O]; me && c(h, me, O, ne); } return h; }); } - function lw(c, h) { + function uw(c, h) { return function(y, O) { if (y == null) return y; if (!li(y)) return c(y, O); - for (var q = y.length, ne = h ? q : -1, le = qr(y); (h ? ne-- : ++ne < q) && O(le[ne], ne, le) !== !1; ) + for (var q = y.length, ne = h ? q : -1, fe = qr(y); (h ? ne-- : ++ne < q) && O(fe[ne], ne, fe) !== !1; ) ; return y; }; } - function hw(c) { + function fw(c) { return function(h, y, O) { - for (var q = -1, ne = qr(h), le = O(h), me = le.length; me--; ) { - var we = le[c ? me : ++q]; + for (var q = -1, ne = qr(h), fe = O(h), me = fe.length; me--; ) { + var we = fe[c ? me : ++q]; if (y(ne[we], we, ne) === !1) break; } return h; }; } - function ZP(c, h, y) { + function QP(c, h, y) { var O = h & L, q = lf(c); function ne() { - var le = this && this !== _r && this instanceof ne ? q : c; - return le.apply(O ? y : this, arguments); + var fe = this && this !== _r && this instanceof ne ? q : c; + return fe.apply(O ? y : this, arguments); } return ne; } - function dw(c) { + function lw(c) { return function(h) { h = Cr(h); - var y = Tc(h) ? ls(h) : r, O = y ? y[0] : h.charAt(0), q = y ? Qo(y, 1).join("") : h.slice(1); + var y = Tc(h) ? ls(h) : r, O = y ? y[0] : h.charAt(0), q = y ? Xo(y, 1).join("") : h.slice(1); return O[c]() + q; }; } function Bc(c) { return function(h) { - return kp(l2(f2(h).replace(Xu, "")), c, ""); + return kp(u2(c2(h).replace(Xu, "")), c, ""); }; } function lf(c) { @@ -22643,31 +22643,31 @@ h0.exports; return Zr(O) ? O : y; }; } - function QP(c, h, y) { + function eM(c, h, y) { var O = lf(c); function q() { - for (var ne = arguments.length, le = Ie(ne), me = ne, we = Fc(q); me--; ) - le[me] = arguments[me]; - var We = ne < 3 && le[0] !== we && le[ne - 1] !== we ? [] : Go(le, we); + for (var ne = arguments.length, fe = Ie(ne), me = ne, we = Fc(q); me--; ) + fe[me] = arguments[me]; + var We = ne < 3 && fe[0] !== we && fe[ne - 1] !== we ? [] : Ko(fe, we); if (ne -= We.length, ne < y) - return bw( + return mw( c, h, Uh, q.placeholder, r, - le, + fe, We, r, r, y - ne ); var He = this && this !== _r && this instanceof q ? O : c; - return Pn(He, this, le); + return Pn(He, this, fe); } return q; } - function pw(c) { + function hw(c) { return function(h, y, O) { var q = qr(h); if (!li(h)) { @@ -22676,45 +22676,45 @@ h0.exports; return ne(q[me], me, q); }; } - var le = c(h, y, O); - return le > -1 ? q[ne ? h[le] : le] : r; + var fe = c(h, y, O); + return fe > -1 ? q[ne ? h[fe] : fe] : r; }; } - function gw(c) { - return lo(function(h) { - var y = h.length, O = y, q = zi.prototype.thru; + function dw(c) { + return uo(function(h) { + var y = h.length, O = y, q = qi.prototype.thru; for (c && h.reverse(); O--; ) { var ne = h[O]; if (typeof ne != "function") - throw new qi(o); - if (q && !le && Hh(ne) == "wrapper") - var le = new zi([], !0); + throw new Ui(o); + if (q && !fe && Hh(ne) == "wrapper") + var fe = new qi([], !0); } - for (O = le ? O : y; ++O < y; ) { + for (O = fe ? O : y; ++O < y; ) { ne = h[O]; var me = Hh(ne), we = me == "wrapper" ? mg(ne) : r; - we && wg(we[0]) && we[1] == (R | H | V | K) && !we[4].length && we[9] == 1 ? le = le[Hh(we[0])].apply(le, we[3]) : le = ne.length == 1 && wg(ne) ? le[me]() : le.thru(ne); + we && wg(we[0]) && we[1] == (R | H | V | K) && !we[4].length && we[9] == 1 ? fe = fe[Hh(we[0])].apply(fe, we[3]) : fe = ne.length == 1 && wg(ne) ? fe[me]() : fe.thru(ne); } return function() { var We = arguments, He = We[0]; - if (le && We.length == 1 && ir(He)) - return le.plant(He).value(); + if (fe && We.length == 1 && ir(He)) + return fe.plant(He).value(); for (var Xe = 0, wt = y ? h[Xe].apply(this, We) : He; ++Xe < y; ) wt = h[Xe].call(this, wt); return wt; }; }); } - function Uh(c, h, y, O, q, ne, le, me, we, We) { - var He = h & R, Xe = h & L, wt = h & $, Ot = h & (H | W), Ht = h & ge, fr = wt ? r : lf(c); + function Uh(c, h, y, O, q, ne, fe, me, we, We) { + var He = h & R, Xe = h & L, wt = h & B, Ot = h & (H | W), Ht = h & ge, fr = wt ? r : lf(c); function Kt() { - for (var vr = arguments.length, Er = Ie(vr), Ii = vr; Ii--; ) - Er[Ii] = arguments[Ii]; + for (var vr = arguments.length, Er = Ie(vr), Ci = vr; Ci--; ) + Er[Ci] = arguments[Ci]; if (Ot) - var ni = Fc(Kt), Ci = lA(Er, ni); - if (O && (Er = uw(Er, O, q, Ot)), ne && (Er = fw(Er, ne, le, Ot)), vr -= Ci, Ot && vr < We) { - var un = Go(Er, ni); - return bw( + var ii = Fc(Kt), Ti = hA(Er, ii); + if (O && (Er = aw(Er, O, q, Ot)), ne && (Er = cw(Er, ne, fe, Ot)), vr -= Ti, Ot && vr < We) { + var un = Ko(Er, ii); + return mw( c, h, Uh, @@ -22727,14 +22727,14 @@ h0.exports; We - vr ); } - var ps = Xe ? y : this, mo = wt ? ps[c] : c; - return vr = Er.length, me ? Er = yM(Er, me) : Ht && vr > 1 && Er.reverse(), He && we < vr && (Er.length = we), this && this !== _r && this instanceof Kt && (mo = fr || lf(mo)), mo.apply(ps, Er); + var ps = Xe ? y : this, po = wt ? ps[c] : c; + return vr = Er.length, me ? Er = wM(Er, me) : Ht && vr > 1 && Er.reverse(), He && we < vr && (Er.length = we), this && this !== _r && this instanceof Kt && (po = fr || lf(po)), po.apply(ps, Er); } return Kt; } - function mw(c, h) { + function pw(c, h) { return function(y, O) { - return MP(y, c, h(O), {}); + return IP(y, c, h(O), {}); }; } function qh(c, h) { @@ -22745,14 +22745,14 @@ h0.exports; if (y !== r && (q = y), O !== r) { if (q === r) return O; - typeof y == "string" || typeof O == "string" ? (y = Pi(y), O = Pi(O)) : (y = tw(y), O = tw(O)), q = c(y, O); + typeof y == "string" || typeof O == "string" ? (y = Mi(y), O = Mi(O)) : (y = Qy(y), O = Qy(O)), q = c(y, O); } return q; }; } function hg(c) { - return lo(function(h) { - return h = Xr(h, Ai(Ut())), hr(function(y) { + return uo(function(h) { + return h = Xr(h, Pi(Ut())), hr(function(y) { var O = this; return c(h, function(q) { return Pn(q, O, y); @@ -22761,37 +22761,37 @@ h0.exports; }); } function zh(c, h) { - h = h === r ? " " : Pi(h); + h = h === r ? " " : Mi(h); var y = h.length; if (y < 2) return y ? sg(h, c) : h; var O = sg(h, Ch(c / Rc(h))); - return Tc(h) ? Qo(ls(O), 0, c).join("") : O.slice(0, c); + return Tc(h) ? Xo(ls(O), 0, c).join("") : O.slice(0, c); } - function eM(c, h, y, O) { + function tM(c, h, y, O) { var q = h & L, ne = lf(c); - function le() { - for (var me = -1, we = arguments.length, We = -1, He = O.length, Xe = Ie(He + we), wt = this && this !== _r && this instanceof le ? ne : c; ++We < He; ) + function fe() { + for (var me = -1, we = arguments.length, We = -1, He = O.length, Xe = Ie(He + we), wt = this && this !== _r && this instanceof fe ? ne : c; ++We < He; ) Xe[We] = O[We]; for (; we--; ) Xe[We++] = arguments[++me]; return Pn(wt, q ? y : this, Xe); } - return le; + return fe; } - function vw(c) { + function gw(c) { return function(h, y, O) { - return O && typeof O != "number" && ri(h, y, O) && (y = O = r), h = go(h), y === r ? (y = h, h = 0) : y = go(y), O = O === r ? h < y ? 1 : -1 : go(O), FP(h, y, O, c); + return O && typeof O != "number" && ni(h, y, O) && (y = O = r), h = ho(h), y === r ? (y = h, h = 0) : y = ho(y), O = O === r ? h < y ? 1 : -1 : ho(O), jP(h, y, O, c); }; } function Wh(c) { return function(h, y) { - return typeof h == "string" && typeof y == "string" || (h = Vi(h), y = Vi(y)), c(h, y); + return typeof h == "string" && typeof y == "string" || (h = Ki(h), y = Ki(y)), c(h, y); }; } - function bw(c, h, y, O, q, ne, le, me, we, We) { - var He = h & H, Xe = He ? le : r, wt = He ? r : le, Ot = He ? ne : r, Ht = He ? r : ne; - h |= He ? V : te, h &= ~(He ? te : V), h & B || (h &= ~(L | $)); + function mw(c, h, y, O, q, ne, fe, me, we, We) { + var He = h & H, Xe = He ? fe : r, wt = He ? r : fe, Ot = He ? ne : r, Ht = He ? r : ne; + h |= He ? V : te, h &= ~(He ? te : V), h & $ || (h &= ~(L | B)); var fr = [ c, h, @@ -22804,33 +22804,33 @@ h0.exports; we, We ], Kt = y.apply(r, fr); - return wg(c) && Tw(Kt, fr), Kt.placeholder = O, Rw(Kt, c, h); + return wg(c) && Iw(Kt, fr), Kt.placeholder = O, Cw(Kt, c, h); } function dg(c) { var h = xn[c]; return function(y, O) { - if (y = Vi(y), O = O == null ? 0 : Kn(cr(O), 292), O && Ry(y)) { + if (y = Ki(y), O = O == null ? 0 : Vn(cr(O), 292), O && Cy(y)) { var q = (Cr(y) + "e").split("e"), ne = h(q[0] + "e" + (+q[1] + O)); return q = (Cr(ne) + "e").split("e"), +(q[0] + "e" + (+q[1] - O)); } return h(y); }; } - var tM = Nc && 1 / yh(new Nc([, -0]))[1] == x ? function(c) { + var rM = Nc && 1 / yh(new Nc([, -0]))[1] == x ? function(c) { return new Nc(c); } : Lg; - function yw(c) { + function vw(c) { return function(h) { - var y = Vn(h); - return y == ie ? zp(h) : y == Me ? bA(h) : fA(h, c(h)); + var y = Gn(h); + return y == ie ? zp(h) : y == Me ? yA(h) : lA(h, c(h)); }; } - function fo(c, h, y, O, q, ne, le, me) { - var we = h & $; + function co(c, h, y, O, q, ne, fe, me) { + var we = h & B; if (!we && typeof c != "function") - throw new qi(o); + throw new Ui(o); var We = O ? O.length : 0; - if (We || (h &= ~(V | te), O = q = r), le = le === r ? le : _n(cr(le), 0), me = me === r ? me : cr(me), We -= q ? q.length : 0, h & te) { + if (We || (h &= ~(V | te), O = q = r), fe = fe === r ? fe : _n(cr(fe), 0), me = me === r ? me : cr(me), We -= q ? q.length : 0, h & te) { var He = O, Xe = q; O = q = r; } @@ -22843,36 +22843,36 @@ h0.exports; He, Xe, ne, - le, + fe, me ]; - if (wt && mM(Ot, wt), c = Ot[0], h = Ot[1], y = Ot[2], O = Ot[3], q = Ot[4], me = Ot[9] = Ot[9] === r ? we ? 0 : c.length : _n(Ot[9] - We, 0), !me && h & (H | W) && (h &= ~(H | W)), !h || h == L) - var Ht = ZP(c, h, y); - else h == H || h == W ? Ht = QP(c, h, me) : (h == V || h == (L | V)) && !q.length ? Ht = eM(c, h, y, O) : Ht = Uh.apply(r, Ot); - var fr = wt ? Qy : Tw; - return Rw(fr(Ht, Ot), c, h); + if (wt && vM(Ot, wt), c = Ot[0], h = Ot[1], y = Ot[2], O = Ot[3], q = Ot[4], me = Ot[9] = Ot[9] === r ? we ? 0 : c.length : _n(Ot[9] - We, 0), !me && h & (H | W) && (h &= ~(H | W)), !h || h == L) + var Ht = QP(c, h, y); + else h == H || h == W ? Ht = eM(c, h, me) : (h == V || h == (L | V)) && !q.length ? Ht = tM(c, h, y, O) : Ht = Uh.apply(r, Ot); + var fr = wt ? Xy : Iw; + return Cw(fr(Ht, Ot), c, h); } - function ww(c, h, y, O) { + function bw(c, h, y, O) { return c === r || ds(c, Oc[y]) && !Tr.call(O, y) ? h : c; } - function xw(c, h, y, O, q, ne) { - return Zr(c) && Zr(h) && (ne.set(h, c), $h(c, h, r, xw, ne), ne.delete(h)), c; + function yw(c, h, y, O, q, ne) { + return Zr(c) && Zr(h) && (ne.set(h, c), $h(c, h, r, yw, ne), ne.delete(h)), c; } - function rM(c) { + function nM(c) { return pf(c) ? r : c; } - function _w(c, h, y, O, q, ne) { - var le = y & P, me = c.length, we = h.length; - if (me != we && !(le && we > me)) + function ww(c, h, y, O, q, ne) { + var fe = y & M, me = c.length, we = h.length; + if (me != we && !(fe && we > me)) return !1; var We = ne.get(c), He = ne.get(h); if (We && He) return We == h && He == c; - var Xe = -1, wt = !0, Ot = y & N ? new Ba() : r; + var Xe = -1, wt = !0, Ot = y & N ? new ka() : r; for (ne.set(c, h), ne.set(h, c); ++Xe < me; ) { var Ht = c[Xe], fr = h[Xe]; if (O) - var Kt = le ? O(fr, Ht, Xe, h, c, ne) : O(Ht, fr, Xe, c, h, ne); + var Kt = fe ? O(fr, Ht, Xe, h, c, ne) : O(Ht, fr, Xe, c, h, ne); if (Kt !== r) { if (Kt) continue; @@ -22894,7 +22894,7 @@ h0.exports; } return ne.delete(c), ne.delete(h), wt; } - function nM(c, h, y, O, q, ne, le) { + function iM(c, h, y, O, q, ne, fe) { switch (y) { case Ze: if (c.byteLength != h.byteLength || c.byteOffset != h.byteOffset) @@ -22914,28 +22914,28 @@ h0.exports; case ie: var me = zp; case Me: - var we = O & P; + var we = O & M; if (me || (me = yh), c.size != h.size && !we) return !1; - var We = le.get(c); + var We = fe.get(c); if (We) return We == h; - O |= N, le.set(c, h); - var He = _w(me(c), me(h), O, q, ne, le); - return le.delete(c), He; + O |= N, fe.set(c, h); + var He = ww(me(c), me(h), O, q, ne, fe); + return fe.delete(c), He; case Ke: if (sf) return sf.call(c) == sf.call(h); } return !1; } - function iM(c, h, y, O, q, ne) { - var le = y & P, me = pg(c), we = me.length, We = pg(h), He = We.length; - if (we != He && !le) + function sM(c, h, y, O, q, ne) { + var fe = y & M, me = pg(c), we = me.length, We = pg(h), He = We.length; + if (we != He && !fe) return !1; for (var Xe = we; Xe--; ) { var wt = me[Xe]; - if (!(le ? wt in h : Tr.call(h, wt))) + if (!(fe ? wt in h : Tr.call(h, wt))) return !1; } var Ot = ne.get(c), Ht = ne.get(h); @@ -22943,31 +22943,31 @@ h0.exports; return Ot == h && Ht == c; var fr = !0; ne.set(c, h), ne.set(h, c); - for (var Kt = le; ++Xe < we; ) { + for (var Kt = fe; ++Xe < we; ) { wt = me[Xe]; var vr = c[wt], Er = h[wt]; if (O) - var Ii = le ? O(Er, vr, wt, h, c, ne) : O(vr, Er, wt, c, h, ne); - if (!(Ii === r ? vr === Er || q(vr, Er, y, O, ne) : Ii)) { + var Ci = fe ? O(Er, vr, wt, h, c, ne) : O(vr, Er, wt, c, h, ne); + if (!(Ci === r ? vr === Er || q(vr, Er, y, O, ne) : Ci)) { fr = !1; break; } Kt || (Kt = wt == "constructor"); } if (fr && !Kt) { - var ni = c.constructor, Ci = h.constructor; - ni != Ci && "constructor" in c && "constructor" in h && !(typeof ni == "function" && ni instanceof ni && typeof Ci == "function" && Ci instanceof Ci) && (fr = !1); + var ii = c.constructor, Ti = h.constructor; + ii != Ti && "constructor" in c && "constructor" in h && !(typeof ii == "function" && ii instanceof ii && typeof Ti == "function" && Ti instanceof Ti) && (fr = !1); } return ne.delete(c), ne.delete(h), fr; } - function lo(c) { - return _g(Iw(c, r, $w), c + ""); + function uo(c) { + return _g(Pw(c, r, Lw), c + ""); } function pg(c) { - return qy(c, Mn, bg); + return jy(c, Mn, bg); } function gg(c) { - return qy(c, hi, Ew); + return jy(c, hi, xw); } var mg = Rh ? function(c) { return Rh.get(c); @@ -22986,101 +22986,101 @@ h0.exports; } function Ut() { var c = ee.iteratee || Og; - return c = c === Og ? Hy : c, arguments.length ? c(arguments[0], arguments[1]) : c; + return c = c === Og ? zy : c, arguments.length ? c(arguments[0], arguments[1]) : c; } function Kh(c, h) { var y = c.__data__; - return hM(h) ? y[typeof h == "string" ? "string" : "hash"] : y.map; + return dM(h) ? y[typeof h == "string" ? "string" : "hash"] : y.map; } function vg(c) { for (var h = Mn(c), y = h.length; y--; ) { var O = h[y], q = c[O]; - h[y] = [O, q, Pw(q)]; + h[y] = [O, q, Sw(q)]; } return h; } - function Ua(c, h) { - var y = gA(c, h); - return Wy(y) ? y : r; + function Fa(c, h) { + var y = mA(c, h); + return qy(y) ? y : r; } - function sM(c) { - var h = Tr.call(c, ka), y = c[ka]; + function oM(c) { + var h = Tr.call(c, Na), y = c[Na]; try { - c[ka] = r; + c[Na] = r; var O = !0; } catch { } var q = Eh.call(c); - return O && (h ? c[ka] = y : delete c[ka]), q; + return O && (h ? c[Na] = y : delete c[Na]), q; } var bg = Hp ? function(c) { - return c == null ? [] : (c = qr(c), Ko(Hp(c), function(h) { - return Cy.call(c, h); + return c == null ? [] : (c = qr(c), Wo(Hp(c), function(h) { + return My.call(c, h); })); - } : kg, Ew = Hp ? function(c) { + } : kg, xw = Hp ? function(c) { for (var h = []; c; ) - Vo(h, bg(c)), c = Ph(c); + Ho(h, bg(c)), c = Ph(c); return h; - } : kg, Vn = ti; - (Kp && Vn(new Kp(new ArrayBuffer(1))) != Ze || tf && Vn(new tf()) != ie || Vp && Vn(Vp.resolve()) != De || Nc && Vn(new Nc()) != Me || rf && Vn(new rf()) != qe) && (Vn = function(c) { - var h = ti(c), y = h == Pe ? c.constructor : r, O = y ? qa(y) : ""; + } : kg, Gn = ri; + (Kp && Gn(new Kp(new ArrayBuffer(1))) != Ze || tf && Gn(new tf()) != ie || Vp && Gn(Vp.resolve()) != De || Nc && Gn(new Nc()) != Me || rf && Gn(new rf()) != qe) && (Gn = function(c) { + var h = ri(c), y = h == Pe ? c.constructor : r, O = y ? ja(y) : ""; if (O) switch (O) { - case UA: - return Ze; case qA: - return ie; + return Ze; case zA: - return De; + return ie; case WA: - return Me; + return De; case HA: + return Me; + case KA: return qe; } return h; }); - function oM(c, h, y) { + function aM(c, h, y) { for (var O = -1, q = y.length; ++O < q; ) { - var ne = y[O], le = ne.size; + var ne = y[O], fe = ne.size; switch (ne.type) { case "drop": - c += le; + c += fe; break; case "dropRight": - h -= le; + h -= fe; break; case "take": - h = Kn(h, c + le); + h = Vn(h, c + fe); break; case "takeRight": - c = _n(c, h - le); + c = _n(c, h - fe); break; } } return { start: c, end: h }; } - function aM(c) { + function cM(c) { var h = c.match(C); return h ? h[1].split(G) : []; } - function Sw(c, h, y) { - h = Zo(h, c); + function _w(c, h, y) { + h = Jo(h, c); for (var O = -1, q = h.length, ne = !1; ++O < q; ) { - var le = Rs(h[O]); - if (!(ne = c != null && y(c, le))) + var fe = Rs(h[O]); + if (!(ne = c != null && y(c, fe))) break; - c = c[le]; + c = c[fe]; } - return ne || ++O != q ? ne : (q = c == null ? 0 : c.length, !!q && Qh(q) && ho(le, q) && (ir(c) || za(c))); + return ne || ++O != q ? ne : (q = c == null ? 0 : c.length, !!q && Qh(q) && fo(fe, q) && (ir(c) || Ua(c))); } - function cM(c) { + function uM(c) { var h = c.length, y = new c.constructor(h); return h && typeof c[0] == "string" && Tr.call(c, "index") && (y.index = c.index, y.input = c.input), y; } - function Aw(c) { + function Ew(c) { return typeof c.constructor == "function" && !hf(c) ? kc(Ph(c)) : {}; } - function uM(c, h, y) { + function fM(c, h, y) { var O = c.constructor; switch (h) { case _e: @@ -23089,7 +23089,7 @@ h0.exports; case Q: return new O(+c); case Ze: - return KP(c, y); + return VP(c, y); case at: case ke: case Qe: @@ -23099,21 +23099,21 @@ h0.exports; case lt: case ct: case qt: - return aw(c, y); + return sw(c, y); case ie: return new O(); case ue: case Ne: return new O(c); case $e: - return VP(c); + return GP(c); case Me: return new O(); case Ke: - return GP(c); + return YP(c); } } - function fM(c, h) { + function lM(c, h) { var y = h.length; if (!y) return c; @@ -23122,26 +23122,26 @@ h0.exports; /* [wrapped with ` + h + `] */ `); } - function lM(c) { - return ir(c) || za(c) || !!(Ty && c && c[Ty]); + function hM(c) { + return ir(c) || Ua(c) || !!(Iy && c && c[Iy]); } - function ho(c, h) { + function fo(c, h) { var y = typeof c; return h = h ?? _, !!h && (y == "number" || y != "symbol" && it.test(c)) && c > -1 && c % 1 == 0 && c < h; } - function ri(c, h, y) { + function ni(c, h, y) { if (!Zr(y)) return !1; var O = typeof h; - return (O == "number" ? li(y) && ho(h, y.length) : O == "string" && h in y) ? ds(y[h], c) : !1; + return (O == "number" ? li(y) && fo(h, y.length) : O == "string" && h in y) ? ds(y[h], c) : !1; } function yg(c, h) { if (ir(c)) return !1; var y = typeof c; - return y == "number" || y == "symbol" || y == "boolean" || c == null || Mi(c) ? !0 : $t.test(c) || !vt.test(c) || h != null && c in qr(h); + return y == "number" || y == "symbol" || y == "boolean" || c == null || Ii(c) ? !0 : $t.test(c) || !vt.test(c) || h != null && c in qr(h); } - function hM(c) { + function dM(c) { var h = typeof c; return h == "string" || h == "number" || h == "symbol" || h == "boolean" ? c !== "__proto__" : c === null; } @@ -23154,67 +23154,67 @@ h0.exports; var O = mg(y); return !!O && c === O[0]; } - function dM(c) { - return !!Py && Py in c; + function pM(c) { + return !!Sy && Sy in c; } - var pM = xh ? po : $g; + var gM = xh ? lo : $g; function hf(c) { var h = c && c.constructor, y = typeof h == "function" && h.prototype || Oc; return c === y; } - function Pw(c) { + function Sw(c) { return c === c && !Zr(c); } - function Mw(c, h) { + function Aw(c, h) { return function(y) { return y == null ? !1 : y[c] === h && (h !== r || c in qr(y)); }; } - function gM(c) { + function mM(c) { var h = Xh(c, function(O) { return y.size === l && y.clear(), O; }), y = h.cache; return h; } - function mM(c, h) { - var y = c[1], O = h[1], q = y | O, ne = q < (L | $ | R), le = O == R && y == H || O == R && y == K && c[7].length <= h[8] || O == (R | K) && h[7].length <= h[8] && y == H; - if (!(ne || le)) + function vM(c, h) { + var y = c[1], O = h[1], q = y | O, ne = q < (L | B | R), fe = O == R && y == H || O == R && y == K && c[7].length <= h[8] || O == (R | K) && h[7].length <= h[8] && y == H; + if (!(ne || fe)) return c; - O & L && (c[2] = h[2], q |= y & L ? 0 : B); + O & L && (c[2] = h[2], q |= y & L ? 0 : $); var me = h[3]; if (me) { var we = c[3]; - c[3] = we ? uw(we, me, h[4]) : me, c[4] = we ? Go(c[3], d) : h[4]; + c[3] = we ? aw(we, me, h[4]) : me, c[4] = we ? Ko(c[3], d) : h[4]; } - return me = h[5], me && (we = c[5], c[5] = we ? fw(we, me, h[6]) : me, c[6] = we ? Go(c[5], d) : h[6]), me = h[7], me && (c[7] = me), O & R && (c[8] = c[8] == null ? h[8] : Kn(c[8], h[8])), c[9] == null && (c[9] = h[9]), c[0] = h[0], c[1] = q, c; + return me = h[5], me && (we = c[5], c[5] = we ? cw(we, me, h[6]) : me, c[6] = we ? Ko(c[5], d) : h[6]), me = h[7], me && (c[7] = me), O & R && (c[8] = c[8] == null ? h[8] : Vn(c[8], h[8])), c[9] == null && (c[9] = h[9]), c[0] = h[0], c[1] = q, c; } - function vM(c) { + function bM(c) { var h = []; if (c != null) for (var y in qr(c)) h.push(y); return h; } - function bM(c) { + function yM(c) { return Eh.call(c); } - function Iw(c, h, y) { + function Pw(c, h, y) { return h = _n(h === r ? c.length - 1 : h, 0), function() { - for (var O = arguments, q = -1, ne = _n(O.length - h, 0), le = Ie(ne); ++q < ne; ) - le[q] = O[h + q]; + for (var O = arguments, q = -1, ne = _n(O.length - h, 0), fe = Ie(ne); ++q < ne; ) + fe[q] = O[h + q]; q = -1; for (var me = Ie(h + 1); ++q < h; ) me[q] = O[q]; - return me[h] = y(le), Pn(c, this, me); + return me[h] = y(fe), Pn(c, this, me); }; } - function Cw(c, h) { - return h.length < 2 ? c : ja(c, Hi(h, 0, -1)); + function Mw(c, h) { + return h.length < 2 ? c : Ba(c, Wi(h, 0, -1)); } - function yM(c, h) { - for (var y = c.length, O = Kn(h.length, y), q = fi(c); O--; ) { + function wM(c, h) { + for (var y = c.length, O = Vn(h.length, y), q = fi(c); O--; ) { var ne = h[O]; - c[O] = ho(ne, y) ? q[ne] : r; + c[O] = fo(ne, y) ? q[ne] : r; } return c; } @@ -23222,17 +23222,17 @@ h0.exports; if (!(h === "constructor" && typeof c[h] == "function") && h != "__proto__") return c[h]; } - var Tw = Dw(Qy), df = NA || function(c, h) { + var Iw = Tw(Xy), df = LA || function(c, h) { return _r.setTimeout(c, h); - }, _g = Dw(qP); - function Rw(c, h, y) { + }, _g = Tw(zP); + function Cw(c, h, y) { var O = h + ""; - return _g(c, fM(O, wM(aM(O), y))); + return _g(c, lM(O, xM(cM(O), y))); } - function Dw(c) { + function Tw(c) { var h = 0, y = 0; return function() { - var O = BA(), q = m - (O - y); + var O = FA(), q = m - (O - y); if (y = O, q > 0) { if (++h >= S) return arguments[0]; @@ -23244,24 +23244,24 @@ h0.exports; function Vh(c, h) { var y = -1, O = c.length, q = O - 1; for (h = h === r ? O : h; ++y < h; ) { - var ne = ig(y, q), le = c[ne]; - c[ne] = c[y], c[y] = le; + var ne = ig(y, q), fe = c[ne]; + c[ne] = c[y], c[y] = fe; } return c.length = h, c; } - var Ow = gM(function(c) { + var Rw = mM(function(c) { var h = []; return c.charCodeAt(0) === 46 && h.push(""), c.replace(Ft, function(y, O, q, ne) { - h.push(q ? ne.replace(de, "$1") : O || y); + h.push(q ? ne.replace(he, "$1") : O || y); }), h; }); function Rs(c) { - if (typeof c == "string" || Mi(c)) + if (typeof c == "string" || Ii(c)) return c; var h = c + ""; return h == "0" && 1 / c == -x ? "-0" : h; } - function qa(c) { + function ja(c) { if (c != null) { try { return _h.call(c); @@ -23274,184 +23274,184 @@ h0.exports; } return ""; } - function wM(c, h) { - return Ui(ce, function(y) { + function xM(c, h) { + return ji(ce, function(y) { var O = "_." + y[0]; h & y[1] && !vh(c, O) && c.push(O); }), c.sort(); } - function Nw(c) { + function Dw(c) { if (c instanceof wr) return c.clone(); - var h = new zi(c.__wrapped__, c.__chain__); + var h = new qi(c.__wrapped__, c.__chain__); return h.__actions__ = fi(c.__actions__), h.__index__ = c.__index__, h.__values__ = c.__values__, h; } - function xM(c, h, y) { - (y ? ri(c, h, y) : h === r) ? h = 1 : h = _n(cr(h), 0); + function _M(c, h, y) { + (y ? ni(c, h, y) : h === r) ? h = 1 : h = _n(cr(h), 0); var O = c == null ? 0 : c.length; if (!O || h < 1) return []; - for (var q = 0, ne = 0, le = Ie(Ch(O / h)); q < O; ) - le[ne++] = Hi(c, q, q += h); - return le; + for (var q = 0, ne = 0, fe = Ie(Ch(O / h)); q < O; ) + fe[ne++] = Wi(c, q, q += h); + return fe; } - function _M(c) { + function EM(c) { for (var h = -1, y = c == null ? 0 : c.length, O = 0, q = []; ++h < y; ) { var ne = c[h]; ne && (q[O++] = ne); } return q; } - function EM() { + function SM() { var c = arguments.length; if (!c) return []; for (var h = Ie(c - 1), y = arguments[0], O = c; O--; ) h[O - 1] = arguments[O]; - return Vo(ir(y) ? fi(y) : [y], Bn(h, 1)); + return Ho(ir(y) ? fi(y) : [y], Bn(h, 1)); } - var SM = hr(function(c, h) { + var AM = hr(function(c, h) { return cn(c) ? af(c, Bn(h, 1, cn, !0)) : []; - }), AM = hr(function(c, h) { - var y = Ki(h); - return cn(y) && (y = r), cn(c) ? af(c, Bn(h, 1, cn, !0), Ut(y, 2)) : []; }), PM = hr(function(c, h) { - var y = Ki(h); + var y = Hi(h); + return cn(y) && (y = r), cn(c) ? af(c, Bn(h, 1, cn, !0), Ut(y, 2)) : []; + }), MM = hr(function(c, h) { + var y = Hi(h); return cn(y) && (y = r), cn(c) ? af(c, Bn(h, 1, cn, !0), r, y) : []; }); - function MM(c, h, y) { + function IM(c, h, y) { var O = c == null ? 0 : c.length; - return O ? (h = y || h === r ? 1 : cr(h), Hi(c, h < 0 ? 0 : h, O)) : []; + return O ? (h = y || h === r ? 1 : cr(h), Wi(c, h < 0 ? 0 : h, O)) : []; } - function IM(c, h, y) { + function CM(c, h, y) { var O = c == null ? 0 : c.length; - return O ? (h = y || h === r ? 1 : cr(h), h = O - h, Hi(c, 0, h < 0 ? 0 : h)) : []; + return O ? (h = y || h === r ? 1 : cr(h), h = O - h, Wi(c, 0, h < 0 ? 0 : h)) : []; } - function CM(c, h) { + function TM(c, h) { return c && c.length ? Fh(c, Ut(h, 3), !0, !0) : []; } - function TM(c, h) { + function RM(c, h) { return c && c.length ? Fh(c, Ut(h, 3), !0) : []; } - function RM(c, h, y, O) { + function DM(c, h, y, O) { var q = c == null ? 0 : c.length; - return q ? (y && typeof y != "number" && ri(c, h, y) && (y = 0, O = q), EP(c, h, y, O)) : []; + return q ? (y && typeof y != "number" && ni(c, h, y) && (y = 0, O = q), SP(c, h, y, O)) : []; } - function Lw(c, h, y) { + function Ow(c, h, y) { var O = c == null ? 0 : c.length; if (!O) return -1; var q = y == null ? 0 : cr(y); return q < 0 && (q = _n(O + q, 0)), bh(c, Ut(h, 3), q); } - function kw(c, h, y) { + function Nw(c, h, y) { var O = c == null ? 0 : c.length; if (!O) return -1; var q = O - 1; - return y !== r && (q = cr(y), q = y < 0 ? _n(O + q, 0) : Kn(q, O - 1)), bh(c, Ut(h, 3), q, !0); + return y !== r && (q = cr(y), q = y < 0 ? _n(O + q, 0) : Vn(q, O - 1)), bh(c, Ut(h, 3), q, !0); } - function $w(c) { + function Lw(c) { var h = c == null ? 0 : c.length; return h ? Bn(c, 1) : []; } - function DM(c) { + function OM(c) { var h = c == null ? 0 : c.length; return h ? Bn(c, x) : []; } - function OM(c, h) { + function NM(c, h) { var y = c == null ? 0 : c.length; return y ? (h = h === r ? 1 : cr(h), Bn(c, h)) : []; } - function NM(c) { + function LM(c) { for (var h = -1, y = c == null ? 0 : c.length, O = {}; ++h < y; ) { var q = c[h]; O[q[0]] = q[1]; } return O; } - function Bw(c) { + function kw(c) { return c && c.length ? c[0] : r; } - function LM(c, h, y) { + function kM(c, h, y) { var O = c == null ? 0 : c.length; if (!O) return -1; var q = y == null ? 0 : cr(y); return q < 0 && (q = _n(O + q, 0)), Cc(c, h, q); } - function kM(c) { + function $M(c) { var h = c == null ? 0 : c.length; - return h ? Hi(c, 0, -1) : []; + return h ? Wi(c, 0, -1) : []; } - var $M = hr(function(c) { + var BM = hr(function(c) { var h = Xr(c, ug); return h.length && h[0] === c[0] ? Qp(h) : []; - }), BM = hr(function(c) { - var h = Ki(c), y = Xr(c, ug); - return h === Ki(y) ? h = r : y.pop(), y.length && y[0] === c[0] ? Qp(y, Ut(h, 2)) : []; }), FM = hr(function(c) { - var h = Ki(c), y = Xr(c, ug); + var h = Hi(c), y = Xr(c, ug); + return h === Hi(y) ? h = r : y.pop(), y.length && y[0] === c[0] ? Qp(y, Ut(h, 2)) : []; + }), jM = hr(function(c) { + var h = Hi(c), y = Xr(c, ug); return h = typeof h == "function" ? h : r, h && y.pop(), y.length && y[0] === c[0] ? Qp(y, r, h) : []; }); - function jM(c, h) { - return c == null ? "" : kA.call(c, h); + function UM(c, h) { + return c == null ? "" : $A.call(c, h); } - function Ki(c) { + function Hi(c) { var h = c == null ? 0 : c.length; return h ? c[h - 1] : r; } - function UM(c, h, y) { + function qM(c, h, y) { var O = c == null ? 0 : c.length; if (!O) return -1; var q = O; - return y !== r && (q = cr(y), q = q < 0 ? _n(O + q, 0) : Kn(q, O - 1)), h === h ? wA(c, h, q) : bh(c, by, q, !0); + return y !== r && (q = cr(y), q = q < 0 ? _n(O + q, 0) : Vn(q, O - 1)), h === h ? xA(c, h, q) : bh(c, my, q, !0); } - function qM(c, h) { - return c && c.length ? Yy(c, cr(h)) : r; + function zM(c, h) { + return c && c.length ? Vy(c, cr(h)) : r; } - var zM = hr(Fw); - function Fw(c, h) { + var WM = hr($w); + function $w(c, h) { return c && c.length && h && h.length ? ng(c, h) : c; } - function WM(c, h, y) { + function HM(c, h, y) { return c && c.length && h && h.length ? ng(c, h, Ut(y, 2)) : c; } - function HM(c, h, y) { + function KM(c, h, y) { return c && c.length && h && h.length ? ng(c, h, r, y) : c; } - var KM = lo(function(c, h) { + var VM = uo(function(c, h) { var y = c == null ? 0 : c.length, O = Yp(c, h); - return Zy(c, Xr(h, function(q) { - return ho(q, y) ? +q : q; - }).sort(cw)), O; + return Jy(c, Xr(h, function(q) { + return fo(q, y) ? +q : q; + }).sort(ow)), O; }); - function VM(c, h) { + function GM(c, h) { var y = []; if (!(c && c.length)) return y; var O = -1, q = [], ne = c.length; for (h = Ut(h, 3); ++O < ne; ) { - var le = c[O]; - h(le, O, c) && (y.push(le), q.push(O)); + var fe = c[O]; + h(fe, O, c) && (y.push(fe), q.push(O)); } - return Zy(c, q), y; + return Jy(c, q), y; } function Eg(c) { - return c == null ? c : jA.call(c); + return c == null ? c : UA.call(c); } - function GM(c, h, y) { + function YM(c, h, y) { var O = c == null ? 0 : c.length; - return O ? (y && typeof y != "number" && ri(c, h, y) ? (h = 0, y = O) : (h = h == null ? 0 : cr(h), y = y === r ? O : cr(y)), Hi(c, h, y)) : []; + return O ? (y && typeof y != "number" && ni(c, h, y) ? (h = 0, y = O) : (h = h == null ? 0 : cr(h), y = y === r ? O : cr(y)), Wi(c, h, y)) : []; } - function YM(c, h) { + function JM(c, h) { return Bh(c, h); } - function JM(c, h, y) { + function XM(c, h, y) { return og(c, h, Ut(y, 2)); } - function XM(c, h) { + function ZM(c, h) { var y = c == null ? 0 : c.length; if (y) { var O = Bh(c, h); @@ -23460,13 +23460,13 @@ h0.exports; } return -1; } - function ZM(c, h) { + function QM(c, h) { return Bh(c, h, !0); } - function QM(c, h, y) { + function eI(c, h, y) { return og(c, h, Ut(y, 2), !0); } - function eI(c, h) { + function tI(c, h) { var y = c == null ? 0 : c.length; if (y) { var O = Bh(c, h, !0) - 1; @@ -23475,59 +23475,59 @@ h0.exports; } return -1; } - function tI(c) { - return c && c.length ? ew(c) : []; + function rI(c) { + return c && c.length ? Zy(c) : []; } - function rI(c, h) { - return c && c.length ? ew(c, Ut(h, 2)) : []; + function nI(c, h) { + return c && c.length ? Zy(c, Ut(h, 2)) : []; } - function nI(c) { + function iI(c) { var h = c == null ? 0 : c.length; - return h ? Hi(c, 1, h) : []; - } - function iI(c, h, y) { - return c && c.length ? (h = y || h === r ? 1 : cr(h), Hi(c, 0, h < 0 ? 0 : h)) : []; + return h ? Wi(c, 1, h) : []; } function sI(c, h, y) { + return c && c.length ? (h = y || h === r ? 1 : cr(h), Wi(c, 0, h < 0 ? 0 : h)) : []; + } + function oI(c, h, y) { var O = c == null ? 0 : c.length; - return O ? (h = y || h === r ? 1 : cr(h), h = O - h, Hi(c, h < 0 ? 0 : h, O)) : []; + return O ? (h = y || h === r ? 1 : cr(h), h = O - h, Wi(c, h < 0 ? 0 : h, O)) : []; } - function oI(c, h) { + function aI(c, h) { return c && c.length ? Fh(c, Ut(h, 3), !1, !0) : []; } - function aI(c, h) { + function cI(c, h) { return c && c.length ? Fh(c, Ut(h, 3)) : []; } - var cI = hr(function(c) { - return Xo(Bn(c, 1, cn, !0)); - }), uI = hr(function(c) { - var h = Ki(c); - return cn(h) && (h = r), Xo(Bn(c, 1, cn, !0), Ut(h, 2)); + var uI = hr(function(c) { + return Yo(Bn(c, 1, cn, !0)); }), fI = hr(function(c) { - var h = Ki(c); - return h = typeof h == "function" ? h : r, Xo(Bn(c, 1, cn, !0), r, h); + var h = Hi(c); + return cn(h) && (h = r), Yo(Bn(c, 1, cn, !0), Ut(h, 2)); + }), lI = hr(function(c) { + var h = Hi(c); + return h = typeof h == "function" ? h : r, Yo(Bn(c, 1, cn, !0), r, h); }); - function lI(c) { - return c && c.length ? Xo(c) : []; - } - function hI(c, h) { - return c && c.length ? Xo(c, Ut(h, 2)) : []; + function hI(c) { + return c && c.length ? Yo(c) : []; } function dI(c, h) { - return h = typeof h == "function" ? h : r, c && c.length ? Xo(c, r, h) : []; + return c && c.length ? Yo(c, Ut(h, 2)) : []; + } + function pI(c, h) { + return h = typeof h == "function" ? h : r, c && c.length ? Yo(c, r, h) : []; } function Sg(c) { if (!(c && c.length)) return []; var h = 0; - return c = Ko(c, function(y) { + return c = Wo(c, function(y) { if (cn(y)) return h = _n(y.length, h), !0; }), Up(h, function(y) { return Xr(c, Bp(y)); }); } - function jw(c, h) { + function Bw(c, h) { if (!(c && c.length)) return []; var y = Sg(c); @@ -23535,73 +23535,73 @@ h0.exports; return Pn(h, r, O); }); } - var pI = hr(function(c, h) { + var gI = hr(function(c, h) { return cn(c) ? af(c, h) : []; - }), gI = hr(function(c) { - return cg(Ko(c, cn)); }), mI = hr(function(c) { - var h = Ki(c); - return cn(h) && (h = r), cg(Ko(c, cn), Ut(h, 2)); + return cg(Wo(c, cn)); }), vI = hr(function(c) { - var h = Ki(c); - return h = typeof h == "function" ? h : r, cg(Ko(c, cn), r, h); - }), bI = hr(Sg); - function yI(c, h) { - return iw(c || [], h || [], of); - } + var h = Hi(c); + return cn(h) && (h = r), cg(Wo(c, cn), Ut(h, 2)); + }), bI = hr(function(c) { + var h = Hi(c); + return h = typeof h == "function" ? h : r, cg(Wo(c, cn), r, h); + }), yI = hr(Sg); function wI(c, h) { - return iw(c || [], h || [], ff); + return rw(c || [], h || [], of); + } + function xI(c, h) { + return rw(c || [], h || [], ff); } - var xI = hr(function(c) { + var _I = hr(function(c) { var h = c.length, y = h > 1 ? c[h - 1] : r; - return y = typeof y == "function" ? (c.pop(), y) : r, jw(c, y); + return y = typeof y == "function" ? (c.pop(), y) : r, Bw(c, y); }); - function Uw(c) { + function Fw(c) { var h = ee(c); return h.__chain__ = !0, h; } - function _I(c, h) { + function EI(c, h) { return h(c), c; } function Gh(c, h) { return h(c); } - var EI = lo(function(c) { + var SI = uo(function(c) { var h = c.length, y = h ? c[0] : 0, O = this.__wrapped__, q = function(ne) { return Yp(ne, c); }; - return h > 1 || this.__actions__.length || !(O instanceof wr) || !ho(y) ? this.thru(q) : (O = O.slice(y, +y + (h ? 1 : 0)), O.__actions__.push({ + return h > 1 || this.__actions__.length || !(O instanceof wr) || !fo(y) ? this.thru(q) : (O = O.slice(y, +y + (h ? 1 : 0)), O.__actions__.push({ func: Gh, args: [q], thisArg: r - }), new zi(O, this.__chain__).thru(function(ne) { + }), new qi(O, this.__chain__).thru(function(ne) { return h && !ne.length && ne.push(r), ne; })); }); - function SI() { - return Uw(this); - } function AI() { - return new zi(this.value(), this.__chain__); + return Fw(this); } function PI() { - this.__values__ === r && (this.__values__ = t2(this.value())); + return new qi(this.value(), this.__chain__); + } + function MI() { + this.__values__ === r && (this.__values__ = Qw(this.value())); var c = this.__index__ >= this.__values__.length, h = c ? r : this.__values__[this.__index__++]; return { done: c, value: h }; } - function MI() { + function II() { return this; } - function II(c) { + function CI(c) { for (var h, y = this; y instanceof Oh; ) { - var O = Nw(y); + var O = Dw(y); O.__index__ = 0, O.__values__ = r, h ? q.__wrapped__ = O : h = O; var q = O; y = y.__wrapped__; } return q.__wrapped__ = c, h; } - function CI() { + function TI() { var c = this.__wrapped__; if (c instanceof wr) { var h = c; @@ -23609,130 +23609,130 @@ h0.exports; func: Gh, args: [Eg], thisArg: r - }), new zi(h, this.__chain__); + }), new qi(h, this.__chain__); } return this.thru(Eg); } - function TI() { - return nw(this.__wrapped__, this.__actions__); + function RI() { + return tw(this.__wrapped__, this.__actions__); } - var RI = jh(function(c, h, y) { - Tr.call(c, y) ? ++c[y] : uo(c, y, 1); + var DI = jh(function(c, h, y) { + Tr.call(c, y) ? ++c[y] : ao(c, y, 1); }); - function DI(c, h, y) { - var O = ir(c) ? my : _P; - return y && ri(c, h, y) && (h = r), O(c, Ut(h, 3)); + function OI(c, h, y) { + var O = ir(c) ? py : EP; + return y && ni(c, h, y) && (h = r), O(c, Ut(h, 3)); } - function OI(c, h) { - var y = ir(c) ? Ko : jy; + function NI(c, h) { + var y = ir(c) ? Wo : By; return y(c, Ut(h, 3)); } - var NI = pw(Lw), LI = pw(kw); - function kI(c, h) { + var LI = hw(Ow), kI = hw(Nw); + function $I(c, h) { return Bn(Yh(c, h), 1); } - function $I(c, h) { + function BI(c, h) { return Bn(Yh(c, h), x); } - function BI(c, h, y) { + function FI(c, h, y) { return y = y === r ? 1 : cr(y), Bn(Yh(c, h), y); } - function qw(c, h) { - var y = ir(c) ? Ui : Jo; + function jw(c, h) { + var y = ir(c) ? ji : Go; return y(c, Ut(h, 3)); } - function zw(c, h) { - var y = ir(c) ? nA : Fy; + function Uw(c, h) { + var y = ir(c) ? iA : $y; return y(c, Ut(h, 3)); } - var FI = jh(function(c, h, y) { - Tr.call(c, y) ? c[y].push(h) : uo(c, y, [h]); + var jI = jh(function(c, h, y) { + Tr.call(c, y) ? c[y].push(h) : ao(c, y, [h]); }); - function jI(c, h, y, O) { + function UI(c, h, y, O) { c = li(c) ? c : Uc(c), y = y && !O ? cr(y) : 0; var q = c.length; return y < 0 && (y = _n(q + y, 0)), ed(c) ? y <= q && c.indexOf(h, y) > -1 : !!q && Cc(c, h, y) > -1; } - var UI = hr(function(c, h, y) { + var qI = hr(function(c, h, y) { var O = -1, q = typeof h == "function", ne = li(c) ? Ie(c.length) : []; - return Jo(c, function(le) { - ne[++O] = q ? Pn(h, le, y) : cf(le, h, y); + return Go(c, function(fe) { + ne[++O] = q ? Pn(h, fe, y) : cf(fe, h, y); }), ne; - }), qI = jh(function(c, h, y) { - uo(c, y, h); + }), zI = jh(function(c, h, y) { + ao(c, y, h); }); function Yh(c, h) { - var y = ir(c) ? Xr : Ky; + var y = ir(c) ? Xr : Wy; return y(c, Ut(h, 3)); } - function zI(c, h, y, O) { - return c == null ? [] : (ir(h) || (h = h == null ? [] : [h]), y = O ? r : y, ir(y) || (y = y == null ? [] : [y]), Jy(c, h, y)); + function WI(c, h, y, O) { + return c == null ? [] : (ir(h) || (h = h == null ? [] : [h]), y = O ? r : y, ir(y) || (y = y == null ? [] : [y]), Gy(c, h, y)); } - var WI = jh(function(c, h, y) { + var HI = jh(function(c, h, y) { c[y ? 0 : 1].push(h); }, function() { return [[], []]; }); - function HI(c, h, y) { - var O = ir(c) ? kp : wy, q = arguments.length < 3; - return O(c, Ut(h, 4), y, q, Jo); - } function KI(c, h, y) { - var O = ir(c) ? iA : wy, q = arguments.length < 3; - return O(c, Ut(h, 4), y, q, Fy); + var O = ir(c) ? kp : by, q = arguments.length < 3; + return O(c, Ut(h, 4), y, q, Go); + } + function VI(c, h, y) { + var O = ir(c) ? sA : by, q = arguments.length < 3; + return O(c, Ut(h, 4), y, q, $y); } - function VI(c, h) { - var y = ir(c) ? Ko : jy; + function GI(c, h) { + var y = ir(c) ? Wo : By; return y(c, Zh(Ut(h, 3))); } - function GI(c) { - var h = ir(c) ? Ly : jP; + function YI(c) { + var h = ir(c) ? Oy : UP; return h(c); } - function YI(c, h, y) { - (y ? ri(c, h, y) : h === r) ? h = 1 : h = cr(h); - var O = ir(c) ? vP : UP; + function JI(c, h, y) { + (y ? ni(c, h, y) : h === r) ? h = 1 : h = cr(h); + var O = ir(c) ? bP : qP; return O(c, h); } - function JI(c) { - var h = ir(c) ? bP : zP; + function XI(c) { + var h = ir(c) ? yP : WP; return h(c); } - function XI(c) { + function ZI(c) { if (c == null) return 0; if (li(c)) return ed(c) ? Rc(c) : c.length; - var h = Vn(c); + var h = Gn(c); return h == ie || h == Me ? c.size : tg(c).length; } - function ZI(c, h, y) { - var O = ir(c) ? $p : WP; - return y && ri(c, h, y) && (h = r), O(c, Ut(h, 3)); + function QI(c, h, y) { + var O = ir(c) ? $p : HP; + return y && ni(c, h, y) && (h = r), O(c, Ut(h, 3)); } - var QI = hr(function(c, h) { + var eC = hr(function(c, h) { if (c == null) return []; var y = h.length; - return y > 1 && ri(c, h[0], h[1]) ? h = [] : y > 2 && ri(h[0], h[1], h[2]) && (h = [h[0]]), Jy(c, Bn(h, 1), []); - }), Jh = OA || function() { + return y > 1 && ni(c, h[0], h[1]) ? h = [] : y > 2 && ni(h[0], h[1], h[2]) && (h = [h[0]]), Gy(c, Bn(h, 1), []); + }), Jh = NA || function() { return _r.Date.now(); }; - function eC(c, h) { + function tC(c, h) { if (typeof h != "function") - throw new qi(o); + throw new Ui(o); return c = cr(c), function() { if (--c < 1) return h.apply(this, arguments); }; } - function Ww(c, h, y) { - return h = y ? r : h, h = c && h == null ? c.length : h, fo(c, R, r, r, r, r, h); + function qw(c, h, y) { + return h = y ? r : h, h = c && h == null ? c.length : h, co(c, R, r, r, r, r, h); } - function Hw(c, h) { + function zw(c, h) { var y; if (typeof h != "function") - throw new qi(o); + throw new Ui(o); return c = cr(c), function() { return --c > 0 && (y = h.apply(this, arguments)), c <= 1 && (h = r), y; }; @@ -23740,47 +23740,47 @@ h0.exports; var Ag = hr(function(c, h, y) { var O = L; if (y.length) { - var q = Go(y, Fc(Ag)); + var q = Ko(y, Fc(Ag)); O |= V; } - return fo(c, O, h, y, q); - }), Kw = hr(function(c, h, y) { - var O = L | $; + return co(c, O, h, y, q); + }), Ww = hr(function(c, h, y) { + var O = L | B; if (y.length) { - var q = Go(y, Fc(Kw)); + var q = Ko(y, Fc(Ww)); O |= V; } - return fo(h, O, c, y, q); + return co(h, O, c, y, q); }); - function Vw(c, h, y) { + function Hw(c, h, y) { h = y ? r : h; - var O = fo(c, H, r, r, r, r, r, h); - return O.placeholder = Vw.placeholder, O; + var O = co(c, H, r, r, r, r, r, h); + return O.placeholder = Hw.placeholder, O; } - function Gw(c, h, y) { + function Kw(c, h, y) { h = y ? r : h; - var O = fo(c, W, r, r, r, r, r, h); - return O.placeholder = Gw.placeholder, O; + var O = co(c, W, r, r, r, r, r, h); + return O.placeholder = Kw.placeholder, O; } - function Yw(c, h, y) { - var O, q, ne, le, me, we, We = 0, He = !1, Xe = !1, wt = !0; + function Vw(c, h, y) { + var O, q, ne, fe, me, we, We = 0, He = !1, Xe = !1, wt = !0; if (typeof c != "function") - throw new qi(o); - h = Vi(h) || 0, Zr(y) && (He = !!y.leading, Xe = "maxWait" in y, ne = Xe ? _n(Vi(y.maxWait) || 0, h) : ne, wt = "trailing" in y ? !!y.trailing : wt); + throw new Ui(o); + h = Ki(h) || 0, Zr(y) && (He = !!y.leading, Xe = "maxWait" in y, ne = Xe ? _n(Ki(y.maxWait) || 0, h) : ne, wt = "trailing" in y ? !!y.trailing : wt); function Ot(un) { - var ps = O, mo = q; - return O = q = r, We = un, le = c.apply(mo, ps), le; + var ps = O, po = q; + return O = q = r, We = un, fe = c.apply(po, ps), fe; } function Ht(un) { - return We = un, me = df(vr, h), He ? Ot(un) : le; + return We = un, me = df(vr, h), He ? Ot(un) : fe; } function fr(un) { - var ps = un - we, mo = un - We, p2 = h - ps; - return Xe ? Kn(p2, ne - mo) : p2; + var ps = un - we, po = un - We, h2 = h - ps; + return Xe ? Vn(h2, ne - po) : h2; } function Kt(un) { - var ps = un - we, mo = un - We; - return we === r || ps >= h || ps < 0 || Xe && mo >= ne; + var ps = un - we, po = un - We; + return we === r || ps >= h || ps < 0 || Xe && po >= ne; } function vr() { var un = Jh(); @@ -23789,50 +23789,50 @@ h0.exports; me = df(vr, fr(un)); } function Er(un) { - return me = r, wt && O ? Ot(un) : (O = q = r, le); + return me = r, wt && O ? Ot(un) : (O = q = r, fe); } - function Ii() { - me !== r && sw(me), We = 0, O = we = q = me = r; + function Ci() { + me !== r && nw(me), We = 0, O = we = q = me = r; } - function ni() { - return me === r ? le : Er(Jh()); + function ii() { + return me === r ? fe : Er(Jh()); } - function Ci() { + function Ti() { var un = Jh(), ps = Kt(un); if (O = arguments, q = this, we = un, ps) { if (me === r) return Ht(we); if (Xe) - return sw(me), me = df(vr, h), Ot(we); + return nw(me), me = df(vr, h), Ot(we); } - return me === r && (me = df(vr, h)), le; + return me === r && (me = df(vr, h)), fe; } - return Ci.cancel = Ii, Ci.flush = ni, Ci; + return Ti.cancel = Ci, Ti.flush = ii, Ti; } - var tC = hr(function(c, h) { - return By(c, 1, h); - }), rC = hr(function(c, h, y) { - return By(c, Vi(h) || 0, y); + var rC = hr(function(c, h) { + return ky(c, 1, h); + }), nC = hr(function(c, h, y) { + return ky(c, Ki(h) || 0, y); }); - function nC(c) { - return fo(c, ge); + function iC(c) { + return co(c, ge); } function Xh(c, h) { if (typeof c != "function" || h != null && typeof h != "function") - throw new qi(o); + throw new Ui(o); var y = function() { var O = arguments, q = h ? h.apply(this, O) : O[0], ne = y.cache; if (ne.has(q)) return ne.get(q); - var le = c.apply(this, O); - return y.cache = ne.set(q, le) || ne, le; + var fe = c.apply(this, O); + return y.cache = ne.set(q, fe) || ne, fe; }; - return y.cache = new (Xh.Cache || co)(), y; + return y.cache = new (Xh.Cache || oo)(), y; } - Xh.Cache = co; + Xh.Cache = oo; function Zh(c) { if (typeof c != "function") - throw new qi(o); + throw new Ui(o); return function() { var h = arguments; switch (h.length) { @@ -23848,105 +23848,105 @@ h0.exports; return !c.apply(this, h); }; } - function iC(c) { - return Hw(2, c); + function sC(c) { + return zw(2, c); } - var sC = HP(function(c, h) { - h = h.length == 1 && ir(h[0]) ? Xr(h[0], Ai(Ut())) : Xr(Bn(h, 1), Ai(Ut())); + var oC = KP(function(c, h) { + h = h.length == 1 && ir(h[0]) ? Xr(h[0], Pi(Ut())) : Xr(Bn(h, 1), Pi(Ut())); var y = h.length; return hr(function(O) { - for (var q = -1, ne = Kn(O.length, y); ++q < ne; ) + for (var q = -1, ne = Vn(O.length, y); ++q < ne; ) O[q] = h[q].call(this, O[q]); return Pn(c, this, O); }); }), Pg = hr(function(c, h) { - var y = Go(h, Fc(Pg)); - return fo(c, V, r, h, y); - }), Jw = hr(function(c, h) { - var y = Go(h, Fc(Jw)); - return fo(c, te, r, h, y); - }), oC = lo(function(c, h) { - return fo(c, K, r, r, r, h); + var y = Ko(h, Fc(Pg)); + return co(c, V, r, h, y); + }), Gw = hr(function(c, h) { + var y = Ko(h, Fc(Gw)); + return co(c, te, r, h, y); + }), aC = uo(function(c, h) { + return co(c, K, r, r, r, h); }); - function aC(c, h) { + function cC(c, h) { if (typeof c != "function") - throw new qi(o); + throw new Ui(o); return h = h === r ? h : cr(h), hr(c, h); } - function cC(c, h) { + function uC(c, h) { if (typeof c != "function") - throw new qi(o); + throw new Ui(o); return h = h == null ? 0 : _n(cr(h), 0), hr(function(y) { - var O = y[h], q = Qo(y, 0, h); - return O && Vo(q, O), Pn(c, this, q); + var O = y[h], q = Xo(y, 0, h); + return O && Ho(q, O), Pn(c, this, q); }); } - function uC(c, h, y) { + function fC(c, h, y) { var O = !0, q = !0; if (typeof c != "function") - throw new qi(o); - return Zr(y) && (O = "leading" in y ? !!y.leading : O, q = "trailing" in y ? !!y.trailing : q), Yw(c, h, { + throw new Ui(o); + return Zr(y) && (O = "leading" in y ? !!y.leading : O, q = "trailing" in y ? !!y.trailing : q), Vw(c, h, { leading: O, maxWait: h, trailing: q }); } - function fC(c) { - return Ww(c, 1); + function lC(c) { + return qw(c, 1); } - function lC(c, h) { + function hC(c, h) { return Pg(fg(h), c); } - function hC() { + function dC() { if (!arguments.length) return []; var c = arguments[0]; return ir(c) ? c : [c]; } - function dC(c) { - return Wi(c, A); - } - function pC(c, h) { - return h = typeof h == "function" ? h : r, Wi(c, A, h); + function pC(c) { + return zi(c, A); } - function gC(c) { - return Wi(c, p | A); + function gC(c, h) { + return h = typeof h == "function" ? h : r, zi(c, A, h); } - function mC(c, h) { - return h = typeof h == "function" ? h : r, Wi(c, p | A, h); + function mC(c) { + return zi(c, p | A); } function vC(c, h) { - return h == null || $y(c, h, Mn(h)); + return h = typeof h == "function" ? h : r, zi(c, p | A, h); + } + function bC(c, h) { + return h == null || Ly(c, h, Mn(h)); } function ds(c, h) { return c === h || c !== c && h !== h; } - var bC = Wh(Zp), yC = Wh(function(c, h) { + var yC = Wh(Zp), wC = Wh(function(c, h) { return c >= h; - }), za = zy(/* @__PURE__ */ function() { + }), Ua = Uy(/* @__PURE__ */ function() { return arguments; - }()) ? zy : function(c) { - return en(c) && Tr.call(c, "callee") && !Cy.call(c, "callee"); - }, ir = Ie.isArray, wC = ei ? Ai(ei) : IP; + }()) ? Uy : function(c) { + return en(c) && Tr.call(c, "callee") && !My.call(c, "callee"); + }, ir = Ie.isArray, xC = ti ? Pi(ti) : CP; function li(c) { - return c != null && Qh(c.length) && !po(c); + return c != null && Qh(c.length) && !lo(c); } function cn(c) { return en(c) && li(c); } - function xC(c) { - return c === !0 || c === !1 || en(c) && ti(c) == J; + function _C(c) { + return c === !0 || c === !1 || en(c) && ri(c) == J; } - var ea = LA || $g, _C = fs ? Ai(fs) : CP; - function EC(c) { + var Zo = kA || $g, EC = fs ? Pi(fs) : TP; + function SC(c) { return en(c) && c.nodeType === 1 && !pf(c); } - function SC(c) { + function AC(c) { if (c == null) return !0; - if (li(c) && (ir(c) || typeof c == "string" || typeof c.splice == "function" || ea(c) || jc(c) || za(c))) + if (li(c) && (ir(c) || typeof c == "string" || typeof c.splice == "function" || Zo(c) || jc(c) || Ua(c))) return !c.length; - var h = Vn(c); + var h = Gn(c); if (h == ie || h == Me) return !c.size; if (hf(c)) @@ -23956,10 +23956,10 @@ h0.exports; return !1; return !0; } - function AC(c, h) { + function PC(c, h) { return uf(c, h); } - function PC(c, h, y) { + function MC(c, h, y) { y = typeof y == "function" ? y : r; var O = y ? y(c, h) : r; return O === r ? uf(c, h, r, y) : !!O; @@ -23967,19 +23967,19 @@ h0.exports; function Mg(c) { if (!en(c)) return !1; - var h = ti(c); + var h = ri(c); return h == X || h == T || typeof c.message == "string" && typeof c.name == "string" && !pf(c); } - function MC(c) { - return typeof c == "number" && Ry(c); + function IC(c) { + return typeof c == "number" && Cy(c); } - function po(c) { + function lo(c) { if (!Zr(c)) return !1; - var h = ti(c); - return h == re || h == pe || h == Z || h == Ce; + var h = ri(c); + return h == re || h == de || h == Z || h == Ce; } - function Xw(c) { + function Yw(c) { return typeof c == "number" && c == cr(c); } function Qh(c) { @@ -23992,93 +23992,93 @@ h0.exports; function en(c) { return c != null && typeof c == "object"; } - var Zw = ji ? Ai(ji) : RP; - function IC(c, h) { + var Jw = Fi ? Pi(Fi) : DP; + function CC(c, h) { return c === h || eg(c, h, vg(h)); } - function CC(c, h, y) { + function TC(c, h, y) { return y = typeof y == "function" ? y : r, eg(c, h, vg(h), y); } - function TC(c) { - return Qw(c) && c != +c; - } function RC(c) { - if (pM(c)) - throw new tr(s); - return Wy(c); + return Xw(c) && c != +c; } function DC(c) { - return c === null; + if (gM(c)) + throw new tr(s); + return qy(c); } function OC(c) { + return c === null; + } + function NC(c) { return c == null; } - function Qw(c) { - return typeof c == "number" || en(c) && ti(c) == ue; + function Xw(c) { + return typeof c == "number" || en(c) && ri(c) == ue; } function pf(c) { - if (!en(c) || ti(c) != Pe) + if (!en(c) || ri(c) != Pe) return !1; var h = Ph(c); if (h === null) return !0; var y = Tr.call(h, "constructor") && h.constructor; - return typeof y == "function" && y instanceof y && _h.call(y) == CA; + return typeof y == "function" && y instanceof y && _h.call(y) == TA; } - var Ig = Is ? Ai(Is) : DP; - function NC(c) { - return Xw(c) && c >= -_ && c <= _; + var Ig = Is ? Pi(Is) : OP; + function LC(c) { + return Yw(c) && c >= -_ && c <= _; } - var e2 = Zu ? Ai(Zu) : OP; + var Zw = Zu ? Pi(Zu) : NP; function ed(c) { - return typeof c == "string" || !ir(c) && en(c) && ti(c) == Ne; + return typeof c == "string" || !ir(c) && en(c) && ri(c) == Ne; } - function Mi(c) { - return typeof c == "symbol" || en(c) && ti(c) == Ke; - } - var jc = La ? Ai(La) : NP; - function LC(c) { - return c === r; + function Ii(c) { + return typeof c == "symbol" || en(c) && ri(c) == Ke; } + var jc = Oa ? Pi(Oa) : LP; function kC(c) { - return en(c) && Vn(c) == qe; + return c === r; } function $C(c) { - return en(c) && ti(c) == ze; + return en(c) && Gn(c) == qe; + } + function BC(c) { + return en(c) && ri(c) == ze; } - var BC = Wh(rg), FC = Wh(function(c, h) { + var FC = Wh(rg), jC = Wh(function(c, h) { return c <= h; }); - function t2(c) { + function Qw(c) { if (!c) return []; if (li(c)) return ed(c) ? ls(c) : fi(c); if (ef && c[ef]) - return vA(c[ef]()); - var h = Vn(c), y = h == ie ? zp : h == Me ? yh : Uc; + return bA(c[ef]()); + var h = Gn(c), y = h == ie ? zp : h == Me ? yh : Uc; return y(c); } - function go(c) { + function ho(c) { if (!c) return c === 0 ? c : 0; - if (c = Vi(c), c === x || c === -x) { + if (c = Ki(c), c === x || c === -x) { var h = c < 0 ? -1 : 1; return h * E; } return c === c ? c : 0; } function cr(c) { - var h = go(c), y = h % 1; + var h = ho(c), y = h % 1; return h === h ? y ? h - y : h : 0; } - function r2(c) { - return c ? Fa(cr(c), 0, M) : 0; + function e2(c) { + return c ? $a(cr(c), 0, P) : 0; } - function Vi(c) { + function Ki(c) { if (typeof c == "number") return c; - if (Mi(c)) + if (Ii(c)) return v; if (Zr(c)) { var h = typeof c.valueOf == "function" ? c.valueOf() : c; @@ -24086,224 +24086,224 @@ h0.exports; } if (typeof c != "string") return c === 0 ? c : +c; - c = xy(c); + c = yy(c); var y = nt.test(c); return y || pt.test(c) ? nr(c.slice(2), y ? 2 : 8) : Re.test(c) ? v : +c; } - function n2(c) { + function t2(c) { return Ts(c, hi(c)); } - function jC(c) { - return c ? Fa(cr(c), -_, _) : c === 0 ? c : 0; + function UC(c) { + return c ? $a(cr(c), -_, _) : c === 0 ? c : 0; } function Cr(c) { - return c == null ? "" : Pi(c); + return c == null ? "" : Mi(c); } - var UC = $c(function(c, h) { + var qC = $c(function(c, h) { if (hf(h) || li(h)) { Ts(h, Mn(h), c); return; } for (var y in h) Tr.call(h, y) && of(c, y, h[y]); - }), i2 = $c(function(c, h) { + }), r2 = $c(function(c, h) { Ts(h, hi(h), c); }), td = $c(function(c, h, y, O) { Ts(h, hi(h), c, O); - }), qC = $c(function(c, h, y, O) { + }), zC = $c(function(c, h, y, O) { Ts(h, Mn(h), c, O); - }), zC = lo(Yp); - function WC(c, h) { + }), WC = uo(Yp); + function HC(c, h) { var y = kc(c); - return h == null ? y : ky(y, h); + return h == null ? y : Ny(y, h); } - var HC = hr(function(c, h) { + var KC = hr(function(c, h) { c = qr(c); var y = -1, O = h.length, q = O > 2 ? h[2] : r; - for (q && ri(h[0], h[1], q) && (O = 1); ++y < O; ) - for (var ne = h[y], le = hi(ne), me = -1, we = le.length; ++me < we; ) { - var We = le[me], He = c[We]; + for (q && ni(h[0], h[1], q) && (O = 1); ++y < O; ) + for (var ne = h[y], fe = hi(ne), me = -1, we = fe.length; ++me < we; ) { + var We = fe[me], He = c[We]; (He === r || ds(He, Oc[We]) && !Tr.call(c, We)) && (c[We] = ne[We]); } return c; - }), KC = hr(function(c) { - return c.push(r, xw), Pn(s2, r, c); + }), VC = hr(function(c) { + return c.push(r, yw), Pn(n2, r, c); }); - function VC(c, h) { - return vy(c, Ut(h, 3), Cs); - } function GC(c, h) { - return vy(c, Ut(h, 3), Xp); + return gy(c, Ut(h, 3), Cs); } function YC(c, h) { - return c == null ? c : Jp(c, Ut(h, 3), hi); + return gy(c, Ut(h, 3), Xp); } function JC(c, h) { - return c == null ? c : Uy(c, Ut(h, 3), hi); + return c == null ? c : Jp(c, Ut(h, 3), hi); } function XC(c, h) { - return c && Cs(c, Ut(h, 3)); + return c == null ? c : Fy(c, Ut(h, 3), hi); } function ZC(c, h) { + return c && Cs(c, Ut(h, 3)); + } + function QC(c, h) { return c && Xp(c, Ut(h, 3)); } - function QC(c) { + function eT(c) { return c == null ? [] : kh(c, Mn(c)); } - function eT(c) { + function tT(c) { return c == null ? [] : kh(c, hi(c)); } function Cg(c, h, y) { - var O = c == null ? r : ja(c, h); + var O = c == null ? r : Ba(c, h); return O === r ? y : O; } - function tT(c, h) { - return c != null && Sw(c, h, SP); + function rT(c, h) { + return c != null && _w(c, h, AP); } function Tg(c, h) { - return c != null && Sw(c, h, AP); + return c != null && _w(c, h, PP); } - var rT = mw(function(c, h, y) { + var nT = pw(function(c, h, y) { h != null && typeof h.toString != "function" && (h = Eh.call(h)), c[h] = y; - }, Dg(di)), nT = mw(function(c, h, y) { + }, Dg(di)), iT = pw(function(c, h, y) { h != null && typeof h.toString != "function" && (h = Eh.call(h)), Tr.call(c, h) ? c[h].push(y) : c[h] = [y]; - }, Ut), iT = hr(cf); + }, Ut), sT = hr(cf); function Mn(c) { - return li(c) ? Ny(c) : tg(c); + return li(c) ? Dy(c) : tg(c); } function hi(c) { - return li(c) ? Ny(c, !0) : LP(c); + return li(c) ? Dy(c, !0) : kP(c); } - function sT(c, h) { + function oT(c, h) { var y = {}; return h = Ut(h, 3), Cs(c, function(O, q, ne) { - uo(y, h(O, q, ne), O); + ao(y, h(O, q, ne), O); }), y; } - function oT(c, h) { + function aT(c, h) { var y = {}; return h = Ut(h, 3), Cs(c, function(O, q, ne) { - uo(y, q, h(O, q, ne)); + ao(y, q, h(O, q, ne)); }), y; } - var aT = $c(function(c, h, y) { + var cT = $c(function(c, h, y) { $h(c, h, y); - }), s2 = $c(function(c, h, y, O) { + }), n2 = $c(function(c, h, y, O) { $h(c, h, y, O); - }), cT = lo(function(c, h) { + }), uT = uo(function(c, h) { var y = {}; if (c == null) return y; var O = !1; h = Xr(h, function(ne) { - return ne = Zo(ne, c), O || (O = ne.length > 1), ne; - }), Ts(c, gg(c), y), O && (y = Wi(y, p | w | A, rM)); + return ne = Jo(ne, c), O || (O = ne.length > 1), ne; + }), Ts(c, gg(c), y), O && (y = zi(y, p | w | A, nM)); for (var q = h.length; q--; ) ag(y, h[q]); return y; }); - function uT(c, h) { - return o2(c, Zh(Ut(h))); + function fT(c, h) { + return i2(c, Zh(Ut(h))); } - var fT = lo(function(c, h) { - return c == null ? {} : $P(c, h); + var lT = uo(function(c, h) { + return c == null ? {} : BP(c, h); }); - function o2(c, h) { + function i2(c, h) { if (c == null) return {}; var y = Xr(gg(c), function(O) { return [O]; }); - return h = Ut(h), Xy(c, y, function(O, q) { + return h = Ut(h), Yy(c, y, function(O, q) { return h(O, q[0]); }); } - function lT(c, h, y) { - h = Zo(h, c); + function hT(c, h, y) { + h = Jo(h, c); var O = -1, q = h.length; for (q || (q = 1, c = r); ++O < q; ) { var ne = c == null ? r : c[Rs(h[O])]; - ne === r && (O = q, ne = y), c = po(ne) ? ne.call(c) : ne; + ne === r && (O = q, ne = y), c = lo(ne) ? ne.call(c) : ne; } return c; } - function hT(c, h, y) { + function dT(c, h, y) { return c == null ? c : ff(c, h, y); } - function dT(c, h, y, O) { + function pT(c, h, y, O) { return O = typeof O == "function" ? O : r, c == null ? c : ff(c, h, y, O); } - var a2 = yw(Mn), c2 = yw(hi); - function pT(c, h, y) { - var O = ir(c), q = O || ea(c) || jc(c); + var s2 = vw(Mn), o2 = vw(hi); + function gT(c, h, y) { + var O = ir(c), q = O || Zo(c) || jc(c); if (h = Ut(h, 4), y == null) { var ne = c && c.constructor; - q ? y = O ? new ne() : [] : Zr(c) ? y = po(ne) ? kc(Ph(c)) : {} : y = {}; + q ? y = O ? new ne() : [] : Zr(c) ? y = lo(ne) ? kc(Ph(c)) : {} : y = {}; } - return (q ? Ui : Cs)(c, function(le, me, we) { - return h(y, le, me, we); + return (q ? ji : Cs)(c, function(fe, me, we) { + return h(y, fe, me, we); }), y; } - function gT(c, h) { + function mT(c, h) { return c == null ? !0 : ag(c, h); } - function mT(c, h, y) { - return c == null ? c : rw(c, h, fg(y)); + function vT(c, h, y) { + return c == null ? c : ew(c, h, fg(y)); } - function vT(c, h, y, O) { - return O = typeof O == "function" ? O : r, c == null ? c : rw(c, h, fg(y), O); + function bT(c, h, y, O) { + return O = typeof O == "function" ? O : r, c == null ? c : ew(c, h, fg(y), O); } function Uc(c) { return c == null ? [] : qp(c, Mn(c)); } - function bT(c) { + function yT(c) { return c == null ? [] : qp(c, hi(c)); } - function yT(c, h, y) { - return y === r && (y = h, h = r), y !== r && (y = Vi(y), y = y === y ? y : 0), h !== r && (h = Vi(h), h = h === h ? h : 0), Fa(Vi(c), h, y); - } function wT(c, h, y) { - return h = go(h), y === r ? (y = h, h = 0) : y = go(y), c = Vi(c), PP(c, h, y); + return y === r && (y = h, h = r), y !== r && (y = Ki(y), y = y === y ? y : 0), h !== r && (h = Ki(h), h = h === h ? h : 0), $a(Ki(c), h, y); } function xT(c, h, y) { - if (y && typeof y != "boolean" && ri(c, h, y) && (h = y = r), y === r && (typeof h == "boolean" ? (y = h, h = r) : typeof c == "boolean" && (y = c, c = r)), c === r && h === r ? (c = 0, h = 1) : (c = go(c), h === r ? (h = c, c = 0) : h = go(h)), c > h) { + return h = ho(h), y === r ? (y = h, h = 0) : y = ho(y), c = Ki(c), MP(c, h, y); + } + function _T(c, h, y) { + if (y && typeof y != "boolean" && ni(c, h, y) && (h = y = r), y === r && (typeof h == "boolean" ? (y = h, h = r) : typeof c == "boolean" && (y = c, c = r)), c === r && h === r ? (c = 0, h = 1) : (c = ho(c), h === r ? (h = c, c = 0) : h = ho(h)), c > h) { var O = c; c = h, h = O; } if (y || c % 1 || h % 1) { - var q = Dy(); - return Kn(c + q * (h - c + jr("1e-" + ((q + "").length - 1))), h); + var q = Ty(); + return Vn(c + q * (h - c + jr("1e-" + ((q + "").length - 1))), h); } return ig(c, h); } - var _T = Bc(function(c, h, y) { - return h = h.toLowerCase(), c + (y ? u2(h) : h); + var ET = Bc(function(c, h, y) { + return h = h.toLowerCase(), c + (y ? a2(h) : h); }); - function u2(c) { + function a2(c) { return Rg(Cr(c).toLowerCase()); } - function f2(c) { - return c = Cr(c), c && c.replace(et, hA).replace(Op, ""); + function c2(c) { + return c = Cr(c), c && c.replace(et, dA).replace(Op, ""); } - function ET(c, h, y) { - c = Cr(c), h = Pi(h); + function ST(c, h, y) { + c = Cr(c), h = Mi(h); var O = c.length; - y = y === r ? O : Fa(cr(y), 0, O); + y = y === r ? O : $a(cr(y), 0, O); var q = y; return y -= h.length, y >= 0 && c.slice(y, q) == h; } - function ST(c) { - return c = Cr(c), c && Ct.test(c) ? c.replace(Dt, dA) : c; - } function AT(c) { + return c = Cr(c), c && Ct.test(c) ? c.replace(Dt, pA) : c; + } + function PT(c) { return c = Cr(c), c && Bt.test(c) ? c.replace(rt, "\\$&") : c; } - var PT = Bc(function(c, h, y) { + var MT = Bc(function(c, h, y) { return c + (y ? "-" : "") + h.toLowerCase(); - }), MT = Bc(function(c, h, y) { + }), IT = Bc(function(c, h, y) { return c + (y ? " " : "") + h.toLowerCase(); - }), IT = dw("toLowerCase"); - function CT(c, h, y) { + }), CT = lw("toLowerCase"); + function TT(c, h, y) { c = Cr(c), h = cr(h); var O = h ? Rc(c) : 0; if (!h || O >= h) @@ -24311,54 +24311,54 @@ h0.exports; var q = (h - O) / 2; return zh(Th(q), y) + c + zh(Ch(q), y); } - function TT(c, h, y) { + function RT(c, h, y) { c = Cr(c), h = cr(h); var O = h ? Rc(c) : 0; return h && O < h ? c + zh(h - O, y) : c; } - function RT(c, h, y) { + function DT(c, h, y) { c = Cr(c), h = cr(h); var O = h ? Rc(c) : 0; return h && O < h ? zh(h - O, y) + c : c; } - function DT(c, h, y) { - return y || h == null ? h = 0 : h && (h = +h), FA(Cr(c).replace(k, ""), h || 0); - } function OT(c, h, y) { - return (y ? ri(c, h, y) : h === r) ? h = 1 : h = cr(h), sg(Cr(c), h); + return y || h == null ? h = 0 : h && (h = +h), jA(Cr(c).replace(k, ""), h || 0); + } + function NT(c, h, y) { + return (y ? ni(c, h, y) : h === r) ? h = 1 : h = cr(h), sg(Cr(c), h); } - function NT() { + function LT() { var c = arguments, h = Cr(c[0]); return c.length < 3 ? h : h.replace(c[1], c[2]); } - var LT = Bc(function(c, h, y) { + var kT = Bc(function(c, h, y) { return c + (y ? "_" : "") + h.toLowerCase(); }); - function kT(c, h, y) { - return y && typeof y != "number" && ri(c, h, y) && (h = y = r), y = y === r ? M : y >>> 0, y ? (c = Cr(c), c && (typeof h == "string" || h != null && !Ig(h)) && (h = Pi(h), !h && Tc(c)) ? Qo(ls(c), 0, y) : c.split(h, y)) : []; + function $T(c, h, y) { + return y && typeof y != "number" && ni(c, h, y) && (h = y = r), y = y === r ? P : y >>> 0, y ? (c = Cr(c), c && (typeof h == "string" || h != null && !Ig(h)) && (h = Mi(h), !h && Tc(c)) ? Xo(ls(c), 0, y) : c.split(h, y)) : []; } - var $T = Bc(function(c, h, y) { + var BT = Bc(function(c, h, y) { return c + (y ? " " : "") + Rg(h); }); - function BT(c, h, y) { - return c = Cr(c), y = y == null ? 0 : Fa(cr(y), 0, c.length), h = Pi(h), c.slice(y, y + h.length) == h; - } function FT(c, h, y) { + return c = Cr(c), y = y == null ? 0 : $a(cr(y), 0, c.length), h = Mi(h), c.slice(y, y + h.length) == h; + } + function jT(c, h, y) { var O = ee.templateSettings; - y && ri(c, h, y) && (h = r), c = Cr(c), h = td({}, h, O, ww); - var q = td({}, h.imports, O.imports, ww), ne = Mn(q), le = qp(q, ne), me, we, We = 0, He = h.interpolate || St, Xe = "__p += '", wt = Wp( + y && ni(c, h, y) && (h = r), c = Cr(c), h = td({}, h, O, bw); + var q = td({}, h.imports, O.imports, bw), ne = Mn(q), fe = qp(q, ne), me, we, We = 0, He = h.interpolate || St, Xe = "__p += '", wt = Wp( (h.escape || St).source + "|" + He.source + "|" + (He === Nt ? xe : St).source + "|" + (h.evaluate || St).source + "|$", "g" ), Ot = "//# sourceURL=" + (Tr.call(h, "sourceURL") ? (h.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++Np + "]") + ` `; - c.replace(wt, function(Kt, vr, Er, Ii, ni, Ci) { - return Er || (Er = Ii), Xe += c.slice(We, Ci).replace(Tt, pA), vr && (me = !0, Xe += `' + + c.replace(wt, function(Kt, vr, Er, Ci, ii, Ti) { + return Er || (Er = Ci), Xe += c.slice(We, Ti).replace(Tt, gA), vr && (me = !0, Xe += `' + __e(` + vr + `) + -'`), ni && (we = !0, Xe += `'; -` + ni + `; +'`), ii && (we = !0, Xe += `'; +` + ii + `; __p += '`), Er && (Xe += `' + ((__t = (` + Er + `)) == null ? '' : __t) + -'`), We = Ci + Kt.length, Kt; +'`), We = Ti + Kt.length, Kt; }), Xe += `'; `; var Ht = Tr.call(h, "variable") && h.variable; @@ -24369,108 +24369,108 @@ __p += '`), Er && (Xe += `' + `; else if (se.test(Ht)) throw new tr(a); - Xe = (we ? Xe.replace(Jt, "") : Xe).replace(Et, "$1").replace(er, "$1;"), Xe = "function(" + (Ht || "obj") + `) { + Xe = (we ? Xe.replace(Yt, "") : Xe).replace(Et, "$1").replace(er, "$1;"), Xe = "function(" + (Ht || "obj") + `) { ` + (Ht ? "" : `obj || (obj = {}); `) + "var __t, __p = ''" + (me ? ", __e = _.escape" : "") + (we ? `, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } ` : `; `) + Xe + `return __p }`; - var fr = h2(function() { - return Pr(ne, Ot + "return " + Xe).apply(r, le); + var fr = f2(function() { + return Pr(ne, Ot + "return " + Xe).apply(r, fe); }); if (fr.source = Xe, Mg(fr)) throw fr; return fr; } - function jT(c) { + function UT(c) { return Cr(c).toLowerCase(); } - function UT(c) { + function qT(c) { return Cr(c).toUpperCase(); } - function qT(c, h, y) { + function zT(c, h, y) { if (c = Cr(c), c && (y || h === r)) - return xy(c); - if (!c || !(h = Pi(h))) + return yy(c); + if (!c || !(h = Mi(h))) return c; - var O = ls(c), q = ls(h), ne = _y(O, q), le = Ey(O, q) + 1; - return Qo(O, ne, le).join(""); + var O = ls(c), q = ls(h), ne = wy(O, q), fe = xy(O, q) + 1; + return Xo(O, ne, fe).join(""); } - function zT(c, h, y) { + function WT(c, h, y) { if (c = Cr(c), c && (y || h === r)) - return c.slice(0, Ay(c) + 1); - if (!c || !(h = Pi(h))) + return c.slice(0, Ey(c) + 1); + if (!c || !(h = Mi(h))) return c; - var O = ls(c), q = Ey(O, ls(h)) + 1; - return Qo(O, 0, q).join(""); + var O = ls(c), q = xy(O, ls(h)) + 1; + return Xo(O, 0, q).join(""); } - function WT(c, h, y) { + function HT(c, h, y) { if (c = Cr(c), c && (y || h === r)) return c.replace(k, ""); - if (!c || !(h = Pi(h))) + if (!c || !(h = Mi(h))) return c; - var O = ls(c), q = _y(O, ls(h)); - return Qo(O, q).join(""); + var O = ls(c), q = wy(O, ls(h)); + return Xo(O, q).join(""); } - function HT(c, h) { + function KT(c, h) { var y = Ee, O = Y; if (Zr(h)) { var q = "separator" in h ? h.separator : q; - y = "length" in h ? cr(h.length) : y, O = "omission" in h ? Pi(h.omission) : O; + y = "length" in h ? cr(h.length) : y, O = "omission" in h ? Mi(h.omission) : O; } c = Cr(c); var ne = c.length; if (Tc(c)) { - var le = ls(c); - ne = le.length; + var fe = ls(c); + ne = fe.length; } if (y >= ne) return c; var me = y - Rc(O); if (me < 1) return O; - var we = le ? Qo(le, 0, me).join("") : c.slice(0, me); + var we = fe ? Xo(fe, 0, me).join("") : c.slice(0, me); if (q === r) return we + O; - if (le && (me += we.length - me), Ig(q)) { + if (fe && (me += we.length - me), Ig(q)) { if (c.slice(me).search(q)) { var We, He = we; for (q.global || (q = Wp(q.source, Cr(Te.exec(q)) + "g")), q.lastIndex = 0; We = q.exec(He); ) var Xe = We.index; we = we.slice(0, Xe === r ? me : Xe); } - } else if (c.indexOf(Pi(q), me) != me) { + } else if (c.indexOf(Mi(q), me) != me) { var wt = we.lastIndexOf(q); wt > -1 && (we = we.slice(0, wt)); } return we + O; } - function KT(c) { - return c = Cr(c), c && kt.test(c) ? c.replace(Xt, xA) : c; + function VT(c) { + return c = Cr(c), c && kt.test(c) ? c.replace(Jt, _A) : c; } - var VT = Bc(function(c, h, y) { + var GT = Bc(function(c, h, y) { return c + (y ? " " : "") + h.toUpperCase(); - }), Rg = dw("toUpperCase"); - function l2(c, h, y) { - return c = Cr(c), h = y ? r : h, h === r ? mA(c) ? SA(c) : aA(c) : c.match(h) || []; + }), Rg = lw("toUpperCase"); + function u2(c, h, y) { + return c = Cr(c), h = y ? r : h, h === r ? vA(c) ? AA(c) : cA(c) : c.match(h) || []; } - var h2 = hr(function(c, h) { + var f2 = hr(function(c, h) { try { return Pn(c, r, h); } catch (y) { return Mg(y) ? y : new tr(y); } - }), GT = lo(function(c, h) { - return Ui(h, function(y) { - y = Rs(y), uo(c, y, Ag(c[y], c)); + }), YT = uo(function(c, h) { + return ji(h, function(y) { + y = Rs(y), ao(c, y, Ag(c[y], c)); }), c; }); - function YT(c) { + function JT(c) { var h = c == null ? 0 : c.length, y = Ut(); return c = h ? Xr(c, function(O) { if (typeof O[1] != "function") - throw new qi(o); + throw new Ui(o); return [y(O[0]), O[1]]; }) : [], hr(function(O) { for (var q = -1; ++q < h; ) { @@ -24480,35 +24480,35 @@ function print() { __p += __j.call(arguments, '') } } }); } - function JT(c) { - return xP(Wi(c, p)); + function XT(c) { + return _P(zi(c, p)); } function Dg(c) { return function() { return c; }; } - function XT(c, h) { + function ZT(c, h) { return c == null || c !== c ? h : c; } - var ZT = gw(), QT = gw(!0); + var QT = dw(), eR = dw(!0); function di(c) { return c; } function Og(c) { - return Hy(typeof c == "function" ? c : Wi(c, p)); + return zy(typeof c == "function" ? c : zi(c, p)); } - function eR(c) { - return Vy(Wi(c, p)); + function tR(c) { + return Hy(zi(c, p)); } - function tR(c, h) { - return Gy(c, Wi(h, p)); + function rR(c, h) { + return Ky(c, zi(h, p)); } - var rR = hr(function(c, h) { + var nR = hr(function(c, h) { return function(y) { return cf(y, c, h); }; - }), nR = hr(function(c, h) { + }), iR = hr(function(c, h) { return function(y) { return cf(c, y, h); }; @@ -24516,123 +24516,123 @@ function print() { __p += __j.call(arguments, '') } function Ng(c, h, y) { var O = Mn(h), q = kh(h, O); y == null && !(Zr(h) && (q.length || !O.length)) && (y = h, h = c, c = this, q = kh(h, Mn(h))); - var ne = !(Zr(y) && "chain" in y) || !!y.chain, le = po(c); - return Ui(q, function(me) { + var ne = !(Zr(y) && "chain" in y) || !!y.chain, fe = lo(c); + return ji(q, function(me) { var we = h[me]; - c[me] = we, le && (c.prototype[me] = function() { + c[me] = we, fe && (c.prototype[me] = function() { var We = this.__chain__; if (ne || We) { var He = c(this.__wrapped__), Xe = He.__actions__ = fi(this.__actions__); return Xe.push({ func: we, args: arguments, thisArg: c }), He.__chain__ = We, He; } - return we.apply(c, Vo([this.value()], arguments)); + return we.apply(c, Ho([this.value()], arguments)); }); }), c; } - function iR() { - return _r._ === this && (_r._ = TA), this; + function sR() { + return _r._ === this && (_r._ = RA), this; } function Lg() { } - function sR(c) { + function oR(c) { return c = cr(c), hr(function(h) { - return Yy(h, c); + return Vy(h, c); }); } - var oR = hg(Xr), aR = hg(my), cR = hg($p); - function d2(c) { - return yg(c) ? Bp(Rs(c)) : BP(c); + var aR = hg(Xr), cR = hg(py), uR = hg($p); + function l2(c) { + return yg(c) ? Bp(Rs(c)) : FP(c); } - function uR(c) { + function fR(c) { return function(h) { - return c == null ? r : ja(c, h); + return c == null ? r : Ba(c, h); }; } - var fR = vw(), lR = vw(!0); + var lR = gw(), hR = gw(!0); function kg() { return []; } function $g() { return !1; } - function hR() { + function dR() { return {}; } - function dR() { + function pR() { return ""; } - function pR() { + function gR() { return !0; } - function gR(c, h) { + function mR(c, h) { if (c = cr(c), c < 1 || c > _) return []; - var y = M, O = Kn(c, M); - h = Ut(h), c -= M; + var y = P, O = Vn(c, P); + h = Ut(h), c -= P; for (var q = Up(O, h); ++y < c; ) h(y); return q; } - function mR(c) { - return ir(c) ? Xr(c, Rs) : Mi(c) ? [c] : fi(Ow(Cr(c))); - } function vR(c) { - var h = ++IA; + return ir(c) ? Xr(c, Rs) : Ii(c) ? [c] : fi(Rw(Cr(c))); + } + function bR(c) { + var h = ++CA; return Cr(c) + h; } - var bR = qh(function(c, h) { + var yR = qh(function(c, h) { return c + h; - }, 0), yR = dg("ceil"), wR = qh(function(c, h) { + }, 0), wR = dg("ceil"), xR = qh(function(c, h) { return c / h; - }, 1), xR = dg("floor"); - function _R(c) { + }, 1), _R = dg("floor"); + function ER(c) { return c && c.length ? Lh(c, di, Zp) : r; } - function ER(c, h) { + function SR(c, h) { return c && c.length ? Lh(c, Ut(h, 2), Zp) : r; } - function SR(c) { - return yy(c, di); + function AR(c) { + return vy(c, di); } - function AR(c, h) { - return yy(c, Ut(h, 2)); + function PR(c, h) { + return vy(c, Ut(h, 2)); } - function PR(c) { + function MR(c) { return c && c.length ? Lh(c, di, rg) : r; } - function MR(c, h) { + function IR(c, h) { return c && c.length ? Lh(c, Ut(h, 2), rg) : r; } - var IR = qh(function(c, h) { + var CR = qh(function(c, h) { return c * h; - }, 1), CR = dg("round"), TR = qh(function(c, h) { + }, 1), TR = dg("round"), RR = qh(function(c, h) { return c - h; }, 0); - function RR(c) { + function DR(c) { return c && c.length ? jp(c, di) : 0; } - function DR(c, h) { + function OR(c, h) { return c && c.length ? jp(c, Ut(h, 2)) : 0; } - return ee.after = eC, ee.ary = Ww, ee.assign = UC, ee.assignIn = i2, ee.assignInWith = td, ee.assignWith = qC, ee.at = zC, ee.before = Hw, ee.bind = Ag, ee.bindAll = GT, ee.bindKey = Kw, ee.castArray = hC, ee.chain = Uw, ee.chunk = xM, ee.compact = _M, ee.concat = EM, ee.cond = YT, ee.conforms = JT, ee.constant = Dg, ee.countBy = RI, ee.create = WC, ee.curry = Vw, ee.curryRight = Gw, ee.debounce = Yw, ee.defaults = HC, ee.defaultsDeep = KC, ee.defer = tC, ee.delay = rC, ee.difference = SM, ee.differenceBy = AM, ee.differenceWith = PM, ee.drop = MM, ee.dropRight = IM, ee.dropRightWhile = CM, ee.dropWhile = TM, ee.fill = RM, ee.filter = OI, ee.flatMap = kI, ee.flatMapDeep = $I, ee.flatMapDepth = BI, ee.flatten = $w, ee.flattenDeep = DM, ee.flattenDepth = OM, ee.flip = nC, ee.flow = ZT, ee.flowRight = QT, ee.fromPairs = NM, ee.functions = QC, ee.functionsIn = eT, ee.groupBy = FI, ee.initial = kM, ee.intersection = $M, ee.intersectionBy = BM, ee.intersectionWith = FM, ee.invert = rT, ee.invertBy = nT, ee.invokeMap = UI, ee.iteratee = Og, ee.keyBy = qI, ee.keys = Mn, ee.keysIn = hi, ee.map = Yh, ee.mapKeys = sT, ee.mapValues = oT, ee.matches = eR, ee.matchesProperty = tR, ee.memoize = Xh, ee.merge = aT, ee.mergeWith = s2, ee.method = rR, ee.methodOf = nR, ee.mixin = Ng, ee.negate = Zh, ee.nthArg = sR, ee.omit = cT, ee.omitBy = uT, ee.once = iC, ee.orderBy = zI, ee.over = oR, ee.overArgs = sC, ee.overEvery = aR, ee.overSome = cR, ee.partial = Pg, ee.partialRight = Jw, ee.partition = WI, ee.pick = fT, ee.pickBy = o2, ee.property = d2, ee.propertyOf = uR, ee.pull = zM, ee.pullAll = Fw, ee.pullAllBy = WM, ee.pullAllWith = HM, ee.pullAt = KM, ee.range = fR, ee.rangeRight = lR, ee.rearg = oC, ee.reject = VI, ee.remove = VM, ee.rest = aC, ee.reverse = Eg, ee.sampleSize = YI, ee.set = hT, ee.setWith = dT, ee.shuffle = JI, ee.slice = GM, ee.sortBy = QI, ee.sortedUniq = tI, ee.sortedUniqBy = rI, ee.split = kT, ee.spread = cC, ee.tail = nI, ee.take = iI, ee.takeRight = sI, ee.takeRightWhile = oI, ee.takeWhile = aI, ee.tap = _I, ee.throttle = uC, ee.thru = Gh, ee.toArray = t2, ee.toPairs = a2, ee.toPairsIn = c2, ee.toPath = mR, ee.toPlainObject = n2, ee.transform = pT, ee.unary = fC, ee.union = cI, ee.unionBy = uI, ee.unionWith = fI, ee.uniq = lI, ee.uniqBy = hI, ee.uniqWith = dI, ee.unset = gT, ee.unzip = Sg, ee.unzipWith = jw, ee.update = mT, ee.updateWith = vT, ee.values = Uc, ee.valuesIn = bT, ee.without = pI, ee.words = l2, ee.wrap = lC, ee.xor = gI, ee.xorBy = mI, ee.xorWith = vI, ee.zip = bI, ee.zipObject = yI, ee.zipObjectDeep = wI, ee.zipWith = xI, ee.entries = a2, ee.entriesIn = c2, ee.extend = i2, ee.extendWith = td, Ng(ee, ee), ee.add = bR, ee.attempt = h2, ee.camelCase = _T, ee.capitalize = u2, ee.ceil = yR, ee.clamp = yT, ee.clone = dC, ee.cloneDeep = gC, ee.cloneDeepWith = mC, ee.cloneWith = pC, ee.conformsTo = vC, ee.deburr = f2, ee.defaultTo = XT, ee.divide = wR, ee.endsWith = ET, ee.eq = ds, ee.escape = ST, ee.escapeRegExp = AT, ee.every = DI, ee.find = NI, ee.findIndex = Lw, ee.findKey = VC, ee.findLast = LI, ee.findLastIndex = kw, ee.findLastKey = GC, ee.floor = xR, ee.forEach = qw, ee.forEachRight = zw, ee.forIn = YC, ee.forInRight = JC, ee.forOwn = XC, ee.forOwnRight = ZC, ee.get = Cg, ee.gt = bC, ee.gte = yC, ee.has = tT, ee.hasIn = Tg, ee.head = Bw, ee.identity = di, ee.includes = jI, ee.indexOf = LM, ee.inRange = wT, ee.invoke = iT, ee.isArguments = za, ee.isArray = ir, ee.isArrayBuffer = wC, ee.isArrayLike = li, ee.isArrayLikeObject = cn, ee.isBoolean = xC, ee.isBuffer = ea, ee.isDate = _C, ee.isElement = EC, ee.isEmpty = SC, ee.isEqual = AC, ee.isEqualWith = PC, ee.isError = Mg, ee.isFinite = MC, ee.isFunction = po, ee.isInteger = Xw, ee.isLength = Qh, ee.isMap = Zw, ee.isMatch = IC, ee.isMatchWith = CC, ee.isNaN = TC, ee.isNative = RC, ee.isNil = OC, ee.isNull = DC, ee.isNumber = Qw, ee.isObject = Zr, ee.isObjectLike = en, ee.isPlainObject = pf, ee.isRegExp = Ig, ee.isSafeInteger = NC, ee.isSet = e2, ee.isString = ed, ee.isSymbol = Mi, ee.isTypedArray = jc, ee.isUndefined = LC, ee.isWeakMap = kC, ee.isWeakSet = $C, ee.join = jM, ee.kebabCase = PT, ee.last = Ki, ee.lastIndexOf = UM, ee.lowerCase = MT, ee.lowerFirst = IT, ee.lt = BC, ee.lte = FC, ee.max = _R, ee.maxBy = ER, ee.mean = SR, ee.meanBy = AR, ee.min = PR, ee.minBy = MR, ee.stubArray = kg, ee.stubFalse = $g, ee.stubObject = hR, ee.stubString = dR, ee.stubTrue = pR, ee.multiply = IR, ee.nth = qM, ee.noConflict = iR, ee.noop = Lg, ee.now = Jh, ee.pad = CT, ee.padEnd = TT, ee.padStart = RT, ee.parseInt = DT, ee.random = xT, ee.reduce = HI, ee.reduceRight = KI, ee.repeat = OT, ee.replace = NT, ee.result = lT, ee.round = CR, ee.runInContext = be, ee.sample = GI, ee.size = XI, ee.snakeCase = LT, ee.some = ZI, ee.sortedIndex = YM, ee.sortedIndexBy = JM, ee.sortedIndexOf = XM, ee.sortedLastIndex = ZM, ee.sortedLastIndexBy = QM, ee.sortedLastIndexOf = eI, ee.startCase = $T, ee.startsWith = BT, ee.subtract = TR, ee.sum = RR, ee.sumBy = DR, ee.template = FT, ee.times = gR, ee.toFinite = go, ee.toInteger = cr, ee.toLength = r2, ee.toLower = jT, ee.toNumber = Vi, ee.toSafeInteger = jC, ee.toString = Cr, ee.toUpper = UT, ee.trim = qT, ee.trimEnd = zT, ee.trimStart = WT, ee.truncate = HT, ee.unescape = KT, ee.uniqueId = vR, ee.upperCase = VT, ee.upperFirst = Rg, ee.each = qw, ee.eachRight = zw, ee.first = Bw, Ng(ee, function() { + return ee.after = tC, ee.ary = qw, ee.assign = qC, ee.assignIn = r2, ee.assignInWith = td, ee.assignWith = zC, ee.at = WC, ee.before = zw, ee.bind = Ag, ee.bindAll = YT, ee.bindKey = Ww, ee.castArray = dC, ee.chain = Fw, ee.chunk = _M, ee.compact = EM, ee.concat = SM, ee.cond = JT, ee.conforms = XT, ee.constant = Dg, ee.countBy = DI, ee.create = HC, ee.curry = Hw, ee.curryRight = Kw, ee.debounce = Vw, ee.defaults = KC, ee.defaultsDeep = VC, ee.defer = rC, ee.delay = nC, ee.difference = AM, ee.differenceBy = PM, ee.differenceWith = MM, ee.drop = IM, ee.dropRight = CM, ee.dropRightWhile = TM, ee.dropWhile = RM, ee.fill = DM, ee.filter = NI, ee.flatMap = $I, ee.flatMapDeep = BI, ee.flatMapDepth = FI, ee.flatten = Lw, ee.flattenDeep = OM, ee.flattenDepth = NM, ee.flip = iC, ee.flow = QT, ee.flowRight = eR, ee.fromPairs = LM, ee.functions = eT, ee.functionsIn = tT, ee.groupBy = jI, ee.initial = $M, ee.intersection = BM, ee.intersectionBy = FM, ee.intersectionWith = jM, ee.invert = nT, ee.invertBy = iT, ee.invokeMap = qI, ee.iteratee = Og, ee.keyBy = zI, ee.keys = Mn, ee.keysIn = hi, ee.map = Yh, ee.mapKeys = oT, ee.mapValues = aT, ee.matches = tR, ee.matchesProperty = rR, ee.memoize = Xh, ee.merge = cT, ee.mergeWith = n2, ee.method = nR, ee.methodOf = iR, ee.mixin = Ng, ee.negate = Zh, ee.nthArg = oR, ee.omit = uT, ee.omitBy = fT, ee.once = sC, ee.orderBy = WI, ee.over = aR, ee.overArgs = oC, ee.overEvery = cR, ee.overSome = uR, ee.partial = Pg, ee.partialRight = Gw, ee.partition = HI, ee.pick = lT, ee.pickBy = i2, ee.property = l2, ee.propertyOf = fR, ee.pull = WM, ee.pullAll = $w, ee.pullAllBy = HM, ee.pullAllWith = KM, ee.pullAt = VM, ee.range = lR, ee.rangeRight = hR, ee.rearg = aC, ee.reject = GI, ee.remove = GM, ee.rest = cC, ee.reverse = Eg, ee.sampleSize = JI, ee.set = dT, ee.setWith = pT, ee.shuffle = XI, ee.slice = YM, ee.sortBy = eC, ee.sortedUniq = rI, ee.sortedUniqBy = nI, ee.split = $T, ee.spread = uC, ee.tail = iI, ee.take = sI, ee.takeRight = oI, ee.takeRightWhile = aI, ee.takeWhile = cI, ee.tap = EI, ee.throttle = fC, ee.thru = Gh, ee.toArray = Qw, ee.toPairs = s2, ee.toPairsIn = o2, ee.toPath = vR, ee.toPlainObject = t2, ee.transform = gT, ee.unary = lC, ee.union = uI, ee.unionBy = fI, ee.unionWith = lI, ee.uniq = hI, ee.uniqBy = dI, ee.uniqWith = pI, ee.unset = mT, ee.unzip = Sg, ee.unzipWith = Bw, ee.update = vT, ee.updateWith = bT, ee.values = Uc, ee.valuesIn = yT, ee.without = gI, ee.words = u2, ee.wrap = hC, ee.xor = mI, ee.xorBy = vI, ee.xorWith = bI, ee.zip = yI, ee.zipObject = wI, ee.zipObjectDeep = xI, ee.zipWith = _I, ee.entries = s2, ee.entriesIn = o2, ee.extend = r2, ee.extendWith = td, Ng(ee, ee), ee.add = yR, ee.attempt = f2, ee.camelCase = ET, ee.capitalize = a2, ee.ceil = wR, ee.clamp = wT, ee.clone = pC, ee.cloneDeep = mC, ee.cloneDeepWith = vC, ee.cloneWith = gC, ee.conformsTo = bC, ee.deburr = c2, ee.defaultTo = ZT, ee.divide = xR, ee.endsWith = ST, ee.eq = ds, ee.escape = AT, ee.escapeRegExp = PT, ee.every = OI, ee.find = LI, ee.findIndex = Ow, ee.findKey = GC, ee.findLast = kI, ee.findLastIndex = Nw, ee.findLastKey = YC, ee.floor = _R, ee.forEach = jw, ee.forEachRight = Uw, ee.forIn = JC, ee.forInRight = XC, ee.forOwn = ZC, ee.forOwnRight = QC, ee.get = Cg, ee.gt = yC, ee.gte = wC, ee.has = rT, ee.hasIn = Tg, ee.head = kw, ee.identity = di, ee.includes = UI, ee.indexOf = kM, ee.inRange = xT, ee.invoke = sT, ee.isArguments = Ua, ee.isArray = ir, ee.isArrayBuffer = xC, ee.isArrayLike = li, ee.isArrayLikeObject = cn, ee.isBoolean = _C, ee.isBuffer = Zo, ee.isDate = EC, ee.isElement = SC, ee.isEmpty = AC, ee.isEqual = PC, ee.isEqualWith = MC, ee.isError = Mg, ee.isFinite = IC, ee.isFunction = lo, ee.isInteger = Yw, ee.isLength = Qh, ee.isMap = Jw, ee.isMatch = CC, ee.isMatchWith = TC, ee.isNaN = RC, ee.isNative = DC, ee.isNil = NC, ee.isNull = OC, ee.isNumber = Xw, ee.isObject = Zr, ee.isObjectLike = en, ee.isPlainObject = pf, ee.isRegExp = Ig, ee.isSafeInteger = LC, ee.isSet = Zw, ee.isString = ed, ee.isSymbol = Ii, ee.isTypedArray = jc, ee.isUndefined = kC, ee.isWeakMap = $C, ee.isWeakSet = BC, ee.join = UM, ee.kebabCase = MT, ee.last = Hi, ee.lastIndexOf = qM, ee.lowerCase = IT, ee.lowerFirst = CT, ee.lt = FC, ee.lte = jC, ee.max = ER, ee.maxBy = SR, ee.mean = AR, ee.meanBy = PR, ee.min = MR, ee.minBy = IR, ee.stubArray = kg, ee.stubFalse = $g, ee.stubObject = dR, ee.stubString = pR, ee.stubTrue = gR, ee.multiply = CR, ee.nth = zM, ee.noConflict = sR, ee.noop = Lg, ee.now = Jh, ee.pad = TT, ee.padEnd = RT, ee.padStart = DT, ee.parseInt = OT, ee.random = _T, ee.reduce = KI, ee.reduceRight = VI, ee.repeat = NT, ee.replace = LT, ee.result = hT, ee.round = TR, ee.runInContext = be, ee.sample = YI, ee.size = ZI, ee.snakeCase = kT, ee.some = QI, ee.sortedIndex = JM, ee.sortedIndexBy = XM, ee.sortedIndexOf = ZM, ee.sortedLastIndex = QM, ee.sortedLastIndexBy = eI, ee.sortedLastIndexOf = tI, ee.startCase = BT, ee.startsWith = FT, ee.subtract = RR, ee.sum = DR, ee.sumBy = OR, ee.template = jT, ee.times = mR, ee.toFinite = ho, ee.toInteger = cr, ee.toLength = e2, ee.toLower = UT, ee.toNumber = Ki, ee.toSafeInteger = UC, ee.toString = Cr, ee.toUpper = qT, ee.trim = zT, ee.trimEnd = WT, ee.trimStart = HT, ee.truncate = KT, ee.unescape = VT, ee.uniqueId = bR, ee.upperCase = GT, ee.upperFirst = Rg, ee.each = jw, ee.eachRight = Uw, ee.first = kw, Ng(ee, function() { var c = {}; return Cs(ee, function(h, y) { Tr.call(ee.prototype, y) || (c[y] = h); }), c; - }(), { chain: !1 }), ee.VERSION = n, Ui(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(c) { + }(), { chain: !1 }), ee.VERSION = n, ji(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(c) { ee[c].placeholder = ee; - }), Ui(["drop", "take"], function(c, h) { + }), ji(["drop", "take"], function(c, h) { wr.prototype[c] = function(y) { y = y === r ? 1 : _n(cr(y), 0); var O = this.__filtered__ && !h ? new wr(this) : this.clone(); - return O.__filtered__ ? O.__takeCount__ = Kn(y, O.__takeCount__) : O.__views__.push({ - size: Kn(y, M), + return O.__filtered__ ? O.__takeCount__ = Vn(y, O.__takeCount__) : O.__views__.push({ + size: Vn(y, P), type: c + (O.__dir__ < 0 ? "Right" : "") }), O; }, wr.prototype[c + "Right"] = function(y) { return this.reverse()[c](y).reverse(); }; - }), Ui(["filter", "map", "takeWhile"], function(c, h) { + }), ji(["filter", "map", "takeWhile"], function(c, h) { var y = h + 1, O = y == f || y == b; wr.prototype[c] = function(q) { var ne = this.clone(); @@ -24641,12 +24641,12 @@ function print() { __p += __j.call(arguments, '') } type: y }), ne.__filtered__ = ne.__filtered__ || O, ne; }; - }), Ui(["head", "last"], function(c, h) { + }), ji(["head", "last"], function(c, h) { var y = "take" + (h ? "Right" : ""); wr.prototype[c] = function() { return this[y](1).value()[0]; }; - }), Ui(["initial", "tail"], function(c, h) { + }), ji(["initial", "tail"], function(c, h) { var y = "drop" + (h ? "" : "Right"); wr.prototype[c] = function() { return this.__filtered__ ? new wr(this) : this[y](1); @@ -24670,24 +24670,24 @@ function print() { __p += __j.call(arguments, '') } }, wr.prototype.takeRightWhile = function(c) { return this.reverse().takeWhile(c).reverse(); }, wr.prototype.toArray = function() { - return this.take(M); + return this.take(P); }, Cs(wr.prototype, function(c, h) { var y = /^(?:filter|find|map|reject)|While$/.test(h), O = /^(?:head|last)$/.test(h), q = ee[O ? "take" + (h == "last" ? "Right" : "") : h], ne = O || /^find/.test(h); q && (ee.prototype[h] = function() { - var le = this.__wrapped__, me = O ? [1] : arguments, we = le instanceof wr, We = me[0], He = we || ir(le), Xe = function(vr) { - var Er = q.apply(ee, Vo([vr], me)); + var fe = this.__wrapped__, me = O ? [1] : arguments, we = fe instanceof wr, We = me[0], He = we || ir(fe), Xe = function(vr) { + var Er = q.apply(ee, Ho([vr], me)); return O && wt ? Er[0] : Er; }; He && y && typeof We == "function" && We.length != 1 && (we = He = !1); var wt = this.__chain__, Ot = !!this.__actions__.length, Ht = ne && !wt, fr = we && !Ot; if (!ne && He) { - le = fr ? le : new wr(this); - var Kt = c.apply(le, me); - return Kt.__actions__.push({ func: Gh, args: [Xe], thisArg: r }), new zi(Kt, wt); + fe = fr ? fe : new wr(this); + var Kt = c.apply(fe, me); + return Kt.__actions__.push({ func: Gh, args: [Xe], thisArg: r }), new qi(Kt, wt); } return Ht && fr ? c.apply(this, me) : (Kt = this.thru(Xe), Ht ? O ? Kt.value()[0] : Kt.value() : Kt); }); - }), Ui(["pop", "push", "shift", "sort", "splice", "unshift"], function(c) { + }), ji(["pop", "push", "shift", "sort", "splice", "unshift"], function(c) { var h = wh[c], y = /^(?:push|sort|unshift)$/.test(c) ? "tap" : "thru", O = /^(?:pop|shift)$/.test(c); ee.prototype[c] = function() { var q = arguments; @@ -24695,8 +24695,8 @@ function print() { __p += __j.call(arguments, '') } var ne = this.value(); return h.apply(ir(ne) ? ne : [], q); } - return this[y](function(le) { - return h.apply(ir(le) ? le : [], q); + return this[y](function(fe) { + return h.apply(ir(fe) ? fe : [], q); }); }; }), Cs(wr.prototype, function(c, h) { @@ -24705,15 +24705,15 @@ function print() { __p += __j.call(arguments, '') } var O = y.name + ""; Tr.call(Lc, O) || (Lc[O] = []), Lc[O].push({ name: h, func: y }); } - }), Lc[Uh(r, $).name] = [{ + }), Lc[Uh(r, B).name] = [{ name: "wrapper", func: r - }], wr.prototype.clone = KA, wr.prototype.reverse = VA, wr.prototype.value = GA, ee.prototype.at = EI, ee.prototype.chain = SI, ee.prototype.commit = AI, ee.prototype.next = PI, ee.prototype.plant = II, ee.prototype.reverse = CI, ee.prototype.toJSON = ee.prototype.valueOf = ee.prototype.value = TI, ee.prototype.first = ee.prototype.head, ef && (ee.prototype[ef] = MI), ee; - }, Dc = AA(); + }], wr.prototype.clone = VA, wr.prototype.reverse = GA, wr.prototype.value = YA, ee.prototype.at = SI, ee.prototype.chain = AI, ee.prototype.commit = PI, ee.prototype.next = MI, ee.prototype.plant = CI, ee.prototype.reverse = TI, ee.prototype.toJSON = ee.prototype.valueOf = ee.prototype.value = RI, ee.prototype.first = ee.prototype.head, ef && (ee.prototype[ef] = II), ee; + }, Dc = PA(); an ? ((an.exports = Dc)._ = Dc, Ur._ = Dc) : _r._ = Dc; }).call(gn); })(h0, h0.exports); -var XV = h0.exports, O1 = { exports: {} }; +var ZV = h0.exports, O1 = { exports: {} }; (function(t, e) { var r = typeof self < "u" ? self : gn, n = function() { function s() { @@ -24772,8 +24772,8 @@ var XV = h0.exports, O1 = { exports: {} }; return g; }), g; } - function P(f) { - this.map = {}, f instanceof P ? f.forEach(function(g, b) { + function M(f) { + this.map = {}, f instanceof M ? f.forEach(function(g, b) { this.append(b, g); }, this) : Array.isArray(f) ? f.forEach(function(g) { this.append(g[0], g[1]); @@ -24781,37 +24781,37 @@ var XV = h0.exports, O1 = { exports: {} }; this.append(g, f[g]); }, this); } - P.prototype.append = function(f, g) { + M.prototype.append = function(f, g) { f = p(f), g = w(g); var b = this.map[f]; this.map[f] = b ? b + ", " + g : g; - }, P.prototype.delete = function(f) { + }, M.prototype.delete = function(f) { delete this.map[p(f)]; - }, P.prototype.get = function(f) { + }, M.prototype.get = function(f) { return f = p(f), this.has(f) ? this.map[f] : null; - }, P.prototype.has = function(f) { + }, M.prototype.has = function(f) { return this.map.hasOwnProperty(p(f)); - }, P.prototype.set = function(f, g) { + }, M.prototype.set = function(f, g) { this.map[p(f)] = w(g); - }, P.prototype.forEach = function(f, g) { + }, M.prototype.forEach = function(f, g) { for (var b in this.map) this.map.hasOwnProperty(b) && f.call(g, this.map[b], b, this); - }, P.prototype.keys = function() { + }, M.prototype.keys = function() { var f = []; return this.forEach(function(g, b) { f.push(b); }), A(f); - }, P.prototype.values = function() { + }, M.prototype.values = function() { var f = []; return this.forEach(function(g) { f.push(g); }), A(f); - }, P.prototype.entries = function() { + }, M.prototype.entries = function() { var f = []; return this.forEach(function(g, b) { f.push([b, g]); }), A(f); - }, a.iterable && (P.prototype[Symbol.iterator] = P.prototype.entries); + }, a.iterable && (M.prototype[Symbol.iterator] = M.prototype.entries); function N(f) { if (f.bodyUsed) return Promise.reject(new TypeError("Already read")); @@ -24826,11 +24826,11 @@ var XV = h0.exports, O1 = { exports: {} }; }; }); } - function $(f) { + function B(f) { var g = new FileReader(), b = L(g); return g.readAsArrayBuffer(f), b; } - function B(f) { + function $(f) { var g = new FileReader(), b = L(g); return g.readAsText(f), b; } @@ -24860,13 +24860,13 @@ var XV = h0.exports, O1 = { exports: {} }; throw new Error("could not read FormData body as blob"); return Promise.resolve(new Blob([this._bodyText])); }, this.arrayBuffer = function() { - return this._bodyArrayBuffer ? N(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then($); + return this._bodyArrayBuffer ? N(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(B); }), this.text = function() { var f = N(this); if (f) return f; if (this._bodyBlob) - return B(this._bodyBlob); + return $(this._bodyBlob); if (this._bodyArrayBuffer) return Promise.resolve(H(this._bodyArrayBuffer)); if (this._bodyFormData) @@ -24889,10 +24889,10 @@ var XV = h0.exports, O1 = { exports: {} }; if (f instanceof K) { if (f.bodyUsed) throw new TypeError("Already read"); - this.url = f.url, this.credentials = f.credentials, g.headers || (this.headers = new P(f.headers)), this.method = f.method, this.mode = f.mode, this.signal = f.signal, !b && f._bodyInit != null && (b = f._bodyInit, f.bodyUsed = !0); + this.url = f.url, this.credentials = f.credentials, g.headers || (this.headers = new M(f.headers)), this.method = f.method, this.mode = f.mode, this.signal = f.signal, !b && f._bodyInit != null && (b = f._bodyInit, f.bodyUsed = !0); } else this.url = String(f); - if (this.credentials = g.credentials || this.credentials || "same-origin", (g.headers || !this.headers) && (this.headers = new P(g.headers)), this.method = R(g.method || this.method || "GET"), this.mode = g.mode || this.mode || null, this.signal = g.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && b) + if (this.credentials = g.credentials || this.credentials || "same-origin", (g.headers || !this.headers) && (this.headers = new M(g.headers)), this.method = R(g.method || this.method || "GET"), this.mode = g.mode || this.mode || null, this.signal = g.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && b) throw new TypeError("Body not allowed for GET or HEAD requests"); this._initBody(b); } @@ -24909,7 +24909,7 @@ var XV = h0.exports, O1 = { exports: {} }; }), g; } function Ee(f) { - var g = new P(), b = f.replace(/\r?\n[\t ]+/g, " "); + var g = new M(), b = f.replace(/\r?\n[\t ]+/g, " "); return b.split(/\r?\n/).forEach(function(x) { var _ = x.split(":"), E = _.shift().trim(); if (E) { @@ -24920,13 +24920,13 @@ var XV = h0.exports, O1 = { exports: {} }; } V.call(K.prototype); function Y(f, g) { - g || (g = {}), this.type = "default", this.status = g.status === void 0 ? 200 : g.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in g ? g.statusText : "OK", this.headers = new P(g.headers), this.url = g.url || "", this._initBody(f); + g || (g = {}), this.type = "default", this.status = g.status === void 0 ? 200 : g.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in g ? g.statusText : "OK", this.headers = new M(g.headers), this.url = g.url || "", this._initBody(f); } V.call(Y.prototype), Y.prototype.clone = function() { return new Y(this._bodyInit, { status: this.status, statusText: this.statusText, - headers: new P(this.headers), + headers: new M(this.headers), url: this.url }); }, Y.error = function() { @@ -24958,44 +24958,44 @@ var XV = h0.exports, O1 = { exports: {} }; E.abort(); } E.onload = function() { - var M = { + var P = { status: E.status, statusText: E.statusText, headers: Ee(E.getAllResponseHeaders() || "") }; - M.url = "responseURL" in E ? E.responseURL : M.headers.get("X-Request-URL"); + P.url = "responseURL" in E ? E.responseURL : P.headers.get("X-Request-URL"); var I = "response" in E ? E.response : E.responseText; - b(new Y(I, M)); + b(new Y(I, P)); }, E.onerror = function() { x(new TypeError("Network request failed")); }, E.ontimeout = function() { x(new TypeError("Network request failed")); }, E.onabort = function() { x(new o.DOMException("Aborted", "AbortError")); - }, E.open(_.method, _.url, !0), _.credentials === "include" ? E.withCredentials = !0 : _.credentials === "omit" && (E.withCredentials = !1), "responseType" in E && a.blob && (E.responseType = "blob"), _.headers.forEach(function(M, I) { - E.setRequestHeader(I, M); + }, E.open(_.method, _.url, !0), _.credentials === "include" ? E.withCredentials = !0 : _.credentials === "omit" && (E.withCredentials = !1), "responseType" in E && a.blob && (E.responseType = "blob"), _.headers.forEach(function(P, I) { + E.setRequestHeader(I, P); }), _.signal && (_.signal.addEventListener("abort", v), E.onreadystatechange = function() { E.readyState === 4 && _.signal.removeEventListener("abort", v); }), E.send(typeof _._bodyInit > "u" ? null : _._bodyInit); }); } - return m.polyfill = !0, s.fetch || (s.fetch = m, s.Headers = P, s.Request = K, s.Response = Y), o.Headers = P, o.Request = K, o.Response = Y, o.fetch = m, Object.defineProperty(o, "__esModule", { value: !0 }), o; + return m.polyfill = !0, s.fetch || (s.fetch = m, s.Headers = M, s.Request = K, s.Response = Y), o.Headers = M, o.Request = K, o.Response = Y, o.fetch = m, Object.defineProperty(o, "__esModule", { value: !0 }), o; })({}); })(n), n.fetch.ponyfill = !0, delete n.fetch.polyfill; var i = n; e = i.fetch, e.default = i.fetch, e.fetch = i.fetch, e.Headers = i.Headers, e.Request = i.Request, e.Response = i.Response, t.exports = e; })(O1, O1.exports); -var ZV = O1.exports; -const B3 = /* @__PURE__ */ rs(ZV); -var QV = Object.defineProperty, eG = Object.defineProperties, tG = Object.getOwnPropertyDescriptors, F3 = Object.getOwnPropertySymbols, rG = Object.prototype.hasOwnProperty, nG = Object.prototype.propertyIsEnumerable, j3 = (t, e, r) => e in t ? QV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, U3 = (t, e) => { - for (var r in e || (e = {})) rG.call(e, r) && j3(t, r, e[r]); - if (F3) for (var r of F3(e)) nG.call(e, r) && j3(t, r, e[r]); +var QV = O1.exports; +const k3 = /* @__PURE__ */ ts(QV); +var eG = Object.defineProperty, tG = Object.defineProperties, rG = Object.getOwnPropertyDescriptors, $3 = Object.getOwnPropertySymbols, nG = Object.prototype.hasOwnProperty, iG = Object.prototype.propertyIsEnumerable, B3 = (t, e, r) => e in t ? eG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, F3 = (t, e) => { + for (var r in e || (e = {})) nG.call(e, r) && B3(t, r, e[r]); + if ($3) for (var r of $3(e)) iG.call(e, r) && B3(t, r, e[r]); return t; -}, q3 = (t, e) => eG(t, tG(e)); -const iG = { Accept: "application/json", "Content-Type": "application/json" }, sG = "POST", z3 = { headers: iG, method: sG }, W3 = 10; +}, j3 = (t, e) => tG(t, rG(e)); +const sG = { Accept: "application/json", "Content-Type": "application/json" }, oG = "POST", U3 = { headers: sG, method: oG }, q3 = 10; let As = class { constructor(e, r = !1) { - if (this.url = e, this.disableProviderPing = r, this.events = new ns.EventEmitter(), this.isAvailable = !1, this.registering = !1, !f3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); + if (this.url = e, this.disableProviderPing = r, this.events = new rs.EventEmitter(), this.isAvailable = !1, this.registering = !1, !c3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); this.url = e, this.disableProviderPing = r; } get connected() { @@ -25026,14 +25026,14 @@ let As = class { async send(e) { this.isAvailable || await this.register(); try { - const r = Bo(e), n = await (await B3(this.url, q3(U3({}, z3), { body: r }))).json(); + const r = $o(e), n = await (await k3(this.url, j3(F3({}, U3), { body: r }))).json(); this.onPayload({ data: n }); } catch (r) { this.onError(e.id, r); } } async register(e = this.url) { - if (!f3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); + if (!c3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); if (this.registering) { const r = this.events.getMaxListeners(); return (this.events.listenerCount("register_error") >= r || this.events.listenerCount("open") >= r) && this.events.setMaxListeners(r + 1), new Promise((n, i) => { @@ -25048,8 +25048,8 @@ let As = class { this.url = e, this.registering = !0; try { if (!this.disableProviderPing) { - const r = Bo({ id: 1, jsonrpc: "2.0", method: "test", params: [] }); - await B3(e, q3(U3({}, z3), { body: r })); + const r = $o({ id: 1, jsonrpc: "2.0", method: "test", params: [] }); + await k3(e, j3(F3({}, U3), { body: r })); } this.onOpen(); } catch (r) { @@ -25065,7 +25065,7 @@ let As = class { } onPayload(e) { if (typeof e.data > "u") return; - const r = typeof e.data == "string" ? lc(e.data) : e.data; + const r = typeof e.data == "string" ? fc(e.data) : e.data; this.events.emit("payload", r); } onError(e, r) { @@ -25073,30 +25073,30 @@ let As = class { this.events.emit("payload", s); } parseError(e, r = this.url) { - return Z8(e, r, "HTTP"); + return J8(e, r, "HTTP"); } resetMaxListeners() { - this.events.getMaxListeners() > W3 && this.events.setMaxListeners(W3); + this.events.getMaxListeners() > q3 && this.events.setMaxListeners(q3); } }; -const H3 = "error", oG = "wss://relay.walletconnect.org", aG = "wc", cG = "universal_provider", K3 = `${aG}@2:${cG}:`, _E = "https://rpc.walletconnect.org/v1/", Xc = "generic", uG = `${_E}bundler`, us = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; -var fG = Object.defineProperty, lG = Object.defineProperties, hG = Object.getOwnPropertyDescriptors, V3 = Object.getOwnPropertySymbols, dG = Object.prototype.hasOwnProperty, pG = Object.prototype.propertyIsEnumerable, G3 = (t, e, r) => e in t ? fG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ld = (t, e) => { - for (var r in e || (e = {})) dG.call(e, r) && G3(t, r, e[r]); - if (V3) for (var r of V3(e)) pG.call(e, r) && G3(t, r, e[r]); +const z3 = "error", aG = "wss://relay.walletconnect.org", cG = "wc", uG = "universal_provider", W3 = `${cG}@2:${uG}:`, wE = "https://rpc.walletconnect.org/v1/", Xc = "generic", fG = `${wE}bundler`, cs = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; +var lG = Object.defineProperty, hG = Object.defineProperties, dG = Object.getOwnPropertyDescriptors, H3 = Object.getOwnPropertySymbols, pG = Object.prototype.hasOwnProperty, gG = Object.prototype.propertyIsEnumerable, K3 = (t, e, r) => e in t ? lG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ld = (t, e) => { + for (var r in e || (e = {})) pG.call(e, r) && K3(t, r, e[r]); + if (H3) for (var r of H3(e)) gG.call(e, r) && K3(t, r, e[r]); return t; -}, gG = (t, e) => lG(t, hG(e)); -function Li(t, e, r) { +}, mG = (t, e) => hG(t, dG(e)); +function Ni(t, e, r) { var n; const i = hu(t); - return ((n = e.rpcMap) == null ? void 0 : n[i.reference]) || `${_E}?chainId=${i.namespace}:${i.reference}&projectId=${r}`; + return ((n = e.rpcMap) == null ? void 0 : n[i.reference]) || `${wE}?chainId=${i.namespace}:${i.reference}&projectId=${r}`; } function Sc(t) { return t.includes(":") ? t.split(":")[1] : t; } -function EE(t) { +function xE(t) { return t.map((e) => `${e.split(":")[0]}:${e.split(":")[1]}`); } -function mG(t, e) { +function vG(t, e) { const r = Object.keys(e.namespaces).filter((i) => i.includes(t)); if (!r.length) return []; const n = []; @@ -25106,26 +25106,26 @@ function mG(t, e) { }), n; } function bm(t = {}, e = {}) { - const r = Y3(t), n = Y3(e); - return XV.merge(r, n); + const r = V3(t), n = V3(e); + return ZV.merge(r, n); } -function Y3(t) { +function V3(t) { var e, r, n, i; const s = {}; if (!Sl(t)) return s; for (const [o, a] of Object.entries(t)) { const u = ab(o) ? [o] : a.chains, l = a.methods || [], d = a.events || [], p = a.rpcMap || {}, w = Ff(o); - s[w] = gG(ld(ld({}, s[w]), a), { chains: Id(u, (e = s[w]) == null ? void 0 : e.chains), methods: Id(l, (r = s[w]) == null ? void 0 : r.methods), events: Id(d, (n = s[w]) == null ? void 0 : n.events), rpcMap: ld(ld({}, p), (i = s[w]) == null ? void 0 : i.rpcMap) }); + s[w] = mG(ld(ld({}, s[w]), a), { chains: Id(u, (e = s[w]) == null ? void 0 : e.chains), methods: Id(l, (r = s[w]) == null ? void 0 : r.methods), events: Id(d, (n = s[w]) == null ? void 0 : n.events), rpcMap: ld(ld({}, p), (i = s[w]) == null ? void 0 : i.rpcMap) }); } return s; } -function vG(t) { +function bG(t) { return t.includes(":") ? t.split(":")[2] : t; } -function J3(t) { +function G3(t) { const e = {}; for (const [r, n] of Object.entries(t)) { - const i = n.methods || [], s = n.events || [], o = n.accounts || [], a = ab(r) ? [r] : n.chains ? n.chains : EE(n.accounts); + const i = n.methods || [], s = n.events || [], o = n.accounts || [], a = ab(r) ? [r] : n.chains ? n.chains : xE(n.accounts); e[r] = { chains: a, methods: i, events: s, accounts: o }; } return e; @@ -25133,10 +25133,10 @@ function J3(t) { function ym(t) { return typeof t == "number" ? t : t.includes("0x") ? parseInt(t, 16) : (t = t.includes(":") ? t.split(":")[1] : t, isNaN(Number(t)) ? t : Number(t)); } -const SE = {}, Ar = (t) => SE[t], wm = (t, e) => { - SE[t] = e; +const _E = {}, Ar = (t) => _E[t], wm = (t, e) => { + _E[t] = e; }; -class bG { +class yG { constructor(e) { this.name = "polkadot", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25157,7 +25157,7 @@ class bG { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); } getAccounts() { const e = this.namespace.accounts; @@ -25181,17 +25181,17 @@ class bG { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Li(e, this.namespace, this.client.core.projectId); + const n = r || Ni(e, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new cs(new As(n, Ar("disableProviderPing"))); + return new as(new As(n, Ar("disableProviderPing"))); } } -var yG = Object.defineProperty, wG = Object.defineProperties, xG = Object.getOwnPropertyDescriptors, X3 = Object.getOwnPropertySymbols, _G = Object.prototype.hasOwnProperty, EG = Object.prototype.propertyIsEnumerable, Z3 = (t, e, r) => e in t ? yG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Q3 = (t, e) => { - for (var r in e || (e = {})) _G.call(e, r) && Z3(t, r, e[r]); - if (X3) for (var r of X3(e)) EG.call(e, r) && Z3(t, r, e[r]); +var wG = Object.defineProperty, xG = Object.defineProperties, _G = Object.getOwnPropertyDescriptors, Y3 = Object.getOwnPropertySymbols, EG = Object.prototype.hasOwnProperty, SG = Object.prototype.propertyIsEnumerable, J3 = (t, e, r) => e in t ? wG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, X3 = (t, e) => { + for (var r in e || (e = {})) EG.call(e, r) && J3(t, r, e[r]); + if (Y3) for (var r of Y3(e)) SG.call(e, r) && J3(t, r, e[r]); return t; -}, e6 = (t, e) => wG(t, xG(e)); -class SG { +}, Z3 = (t, e) => xG(t, _G(e)); +class AG { constructor(e) { this.name = "eip155", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.httpProviders = this.createHttpProviders(), this.chainId = parseInt(this.getDefaultChain()); } @@ -25216,7 +25216,7 @@ class SG { this.namespace = Object.assign(this.namespace, e); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(parseInt(e), r), this.chainId = parseInt(e), this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + this.httpProviders[e] || this.setHttpProvider(parseInt(e), r), this.chainId = parseInt(e), this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); } requestAccounts() { return this.getAccounts(); @@ -25229,9 +25229,9 @@ class SG { return e.split(":")[1]; } createHttpProvider(e, r) { - const n = r || Li(`${this.name}:${e}`, this.namespace, this.client.core.projectId); + const n = r || Ni(`${this.name}:${e}`, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new cs(new As(n, Ar("disableProviderPing"))); + return new as(new As(n, Ar("disableProviderPing"))); } setHttpProvider(e, r) { const n = this.createHttpProvider(e, r); @@ -25275,7 +25275,7 @@ class SG { if (a != null && a[s]) return a == null ? void 0 : a[s]; const u = await this.client.request(e); try { - await this.client.session.update(e.topic, { sessionProperties: e6(Q3({}, o.sessionProperties || {}), { capabilities: e6(Q3({}, a || {}), { [s]: u }) }) }); + await this.client.session.update(e.topic, { sessionProperties: Z3(X3({}, o.sessionProperties || {}), { capabilities: Z3(X3({}, a || {}), { [s]: u }) }) }); } catch (l) { console.warn("Failed to update session with capabilities", l); } @@ -25303,15 +25303,15 @@ class SG { } async getUserOperationReceipt(e, r) { var n; - const i = new URL(e), s = await fetch(i, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(ga("eth_getUserOperationReceipt", [(n = r.request.params) == null ? void 0 : n[0]])) }); + const i = new URL(e), s = await fetch(i, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(da("eth_getUserOperationReceipt", [(n = r.request.params) == null ? void 0 : n[0]])) }); if (!s.ok) throw new Error(`Failed to fetch user operation receipt - ${s.status}`); return await s.json(); } getBundlerUrl(e, r) { - return `${uG}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`; + return `${fG}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`; } } -class AG { +class PG { constructor(e) { this.name = "solana", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25325,7 +25325,7 @@ class AG { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); } getDefaultChain() { if (this.chainId) return this.chainId; @@ -25356,12 +25356,12 @@ class AG { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Li(e, this.namespace, this.client.core.projectId); + const n = r || Ni(e, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new cs(new As(n, Ar("disableProviderPing"))); + return new as(new As(n, Ar("disableProviderPing"))); } } -let PG = class { +let MG = class { constructor(e) { this.name = "cosmos", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25382,7 +25382,7 @@ let PG = class { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); } getAccounts() { const e = this.namespace.accounts; @@ -25406,11 +25406,11 @@ let PG = class { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Li(e, this.namespace, this.client.core.projectId); + const n = r || Ni(e, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new cs(new As(n, Ar("disableProviderPing"))); + return new as(new As(n, Ar("disableProviderPing"))); } -}, MG = class { +}, IG = class { constructor(e) { this.name = "algorand", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25425,11 +25425,11 @@ let PG = class { } setDefaultChain(e, r) { if (!this.httpProviders[e]) { - const n = r || Li(`${this.name}:${e}`, this.namespace, this.client.core.projectId); + const n = r || Ni(`${this.name}:${e}`, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); this.setHttpProvider(e, n); } - this.chainId = e, this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); } getDefaultChain() { if (this.chainId) return this.chainId; @@ -25459,10 +25459,10 @@ let PG = class { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Li(e, this.namespace, this.client.core.projectId); - return typeof n > "u" ? void 0 : new cs(new As(n, Ar("disableProviderPing"))); + const n = r || Ni(e, this.namespace, this.client.core.projectId); + return typeof n > "u" ? void 0 : new as(new As(n, Ar("disableProviderPing"))); } -}, IG = class { +}, CG = class { constructor(e) { this.name = "cip34", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25483,7 +25483,7 @@ let PG = class { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); } getAccounts() { const e = this.namespace.accounts; @@ -25512,9 +25512,9 @@ let PG = class { createHttpProvider(e, r) { const n = r || this.getCardanoRPCUrl(e); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new cs(new As(n, Ar("disableProviderPing"))); + return new as(new As(n, Ar("disableProviderPing"))); } -}, CG = class { +}, TG = class { constructor(e) { this.name = "elrond", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25528,7 +25528,7 @@ let PG = class { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); } getDefaultChain() { if (this.chainId) return this.chainId; @@ -25559,12 +25559,12 @@ let PG = class { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Li(e, this.namespace, this.client.core.projectId); + const n = r || Ni(e, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new cs(new As(n, Ar("disableProviderPing"))); + return new as(new As(n, Ar("disableProviderPing"))); } }; -class TG { +class RG { constructor(e) { this.name = "multiversx", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25578,7 +25578,7 @@ class TG { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); } getDefaultChain() { if (this.chainId) return this.chainId; @@ -25609,12 +25609,12 @@ class TG { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Li(e, this.namespace, this.client.core.projectId); + const n = r || Ni(e, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new cs(new As(n, Ar("disableProviderPing"))); + return new as(new As(n, Ar("disableProviderPing"))); } } -let RG = class { +let DG = class { constructor(e) { this.name = "near", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25636,11 +25636,11 @@ let RG = class { } setDefaultChain(e, r) { if (this.chainId = e, !this.httpProviders[e]) { - const n = r || Li(`${this.name}:${e}`, this.namespace); + const n = r || Ni(`${this.name}:${e}`, this.namespace); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); this.setHttpProvider(e, n); } - this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); } getAccounts() { const e = this.namespace.accounts; @@ -25663,11 +25663,11 @@ let RG = class { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Li(e, this.namespace); - return typeof n > "u" ? void 0 : new cs(new As(n, Ar("disableProviderPing"))); + const n = r || Ni(e, this.namespace); + return typeof n > "u" ? void 0 : new as(new As(n, Ar("disableProviderPing"))); } }; -class DG { +class OG { constructor(e) { this.name = "tezos", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25689,11 +25689,11 @@ class DG { } setDefaultChain(e, r) { if (this.chainId = e, !this.httpProviders[e]) { - const n = r || Li(`${this.name}:${e}`, this.namespace); + const n = r || Ni(`${this.name}:${e}`, this.namespace); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); this.setHttpProvider(e, n); } - this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); } getAccounts() { const e = this.namespace.accounts; @@ -25715,11 +25715,11 @@ class DG { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Li(e, this.namespace); - return typeof n > "u" ? void 0 : new cs(new As(n)); + const n = r || Ni(e, this.namespace); + return typeof n > "u" ? void 0 : new as(new As(n)); } } -class OG { +class NG { constructor(e) { this.name = Xc, this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25733,7 +25733,7 @@ class OG { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider(e.chainId).request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(us.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); } getDefaultChain() { if (this.chainId) return this.chainId; @@ -25764,22 +25764,22 @@ class OG { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Li(e, this.namespace, this.client.core.projectId); + const n = r || Ni(e, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new cs(new As(n, Ar("disableProviderPing"))); + return new as(new As(n, Ar("disableProviderPing"))); } } -var NG = Object.defineProperty, LG = Object.defineProperties, kG = Object.getOwnPropertyDescriptors, t6 = Object.getOwnPropertySymbols, $G = Object.prototype.hasOwnProperty, BG = Object.prototype.propertyIsEnumerable, r6 = (t, e, r) => e in t ? NG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, hd = (t, e) => { - for (var r in e || (e = {})) $G.call(e, r) && r6(t, r, e[r]); - if (t6) for (var r of t6(e)) BG.call(e, r) && r6(t, r, e[r]); +var LG = Object.defineProperty, kG = Object.defineProperties, $G = Object.getOwnPropertyDescriptors, Q3 = Object.getOwnPropertySymbols, BG = Object.prototype.hasOwnProperty, FG = Object.prototype.propertyIsEnumerable, e6 = (t, e, r) => e in t ? LG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, hd = (t, e) => { + for (var r in e || (e = {})) BG.call(e, r) && e6(t, r, e[r]); + if (Q3) for (var r of Q3(e)) FG.call(e, r) && e6(t, r, e[r]); return t; -}, xm = (t, e) => LG(t, kG(e)); -let AE = class PE { +}, xm = (t, e) => kG(t, $G(e)); +let EE = class SE { constructor(e) { - this.events = new kv(), this.rpcProviders = {}, this.shouldAbortPairingAttempt = !1, this.maxPairingAttempts = 10, this.disableProviderPing = !1, this.providerOpts = e, this.logger = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : ql($0({ level: (e == null ? void 0 : e.logger) || H3 })), this.disableProviderPing = (e == null ? void 0 : e.disableProviderPing) || !1; + this.events = new kv(), this.rpcProviders = {}, this.shouldAbortPairingAttempt = !1, this.maxPairingAttempts = 10, this.disableProviderPing = !1, this.providerOpts = e, this.logger = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : ql($0({ level: (e == null ? void 0 : e.logger) || z3 })), this.disableProviderPing = (e == null ? void 0 : e.disableProviderPing) || !1; } static async init(e) { - const r = new PE(e); + const r = new SE(e); return await r.initialize(), r; } async request(e, r, n) { @@ -25811,7 +25811,7 @@ let AE = class PE { n && (this.uri = n, this.events.emit("display_uri", n)); const s = await i(); if (this.session = s.session, this.session) { - const o = J3(this.session.namespaces); + const o = G3(this.session.namespaces); this.namespaces = bm(this.namespaces, o), this.persist("namespaces", this.namespaces), this.onConnect(); } return s; @@ -25840,10 +25840,10 @@ let AE = class PE { const { uri: n, approval: i } = await this.client.connect({ pairingTopic: e, requiredNamespaces: this.namespaces, optionalNamespaces: this.optionalNamespaces, sessionProperties: this.sessionProperties }); n && (this.uri = n, this.events.emit("display_uri", n)), await i().then((s) => { this.session = s; - const o = J3(s.namespaces); + const o = G3(s.namespaces); this.namespaces = bm(this.namespaces, o), this.persist("namespaces", this.namespaces); }).catch((s) => { - if (s.message !== xE) throw s; + if (s.message !== yE) throw s; r++; }); } while (!this.session); @@ -25861,7 +25861,7 @@ let AE = class PE { async cleanupPendingPairings(e = {}) { this.logger.info("Cleaning up inactive pairings..."); const r = this.client.pairing.getAll(); - if (gc(r)) { + if (pc(r)) { for (const n of r) e.deletePairings ? this.client.core.expirer.set(n.topic, 0) : await this.client.core.relayer.subscriber.unsubscribe(n.topic); this.logger.info(`Inactive pairings cleared: ${r.length}`); } @@ -25879,7 +25879,7 @@ let AE = class PE { this.logger.trace("Initialized"), await this.createClient(), await this.checkStorage(), this.registerEventListeners(); } async createClient() { - this.client = this.providerOpts.client || await db.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || H3, relayUrl: this.providerOpts.relayUrl || oG, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); + this.client = this.providerOpts.client || await db.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || z3, relayUrl: this.providerOpts.relayUrl || aG, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); } createProviders() { if (!this.client) throw new Error("Sign Client not initialized"); @@ -25887,40 +25887,40 @@ let AE = class PE { const e = [...new Set(Object.keys(this.session.namespaces).map((r) => Ff(r)))]; wm("client", this.client), wm("events", this.events), wm("disableProviderPing", this.disableProviderPing), e.forEach((r) => { if (!this.session) return; - const n = mG(r, this.session), i = EE(n), s = bm(this.namespaces, this.optionalNamespaces), o = xm(hd({}, s[r]), { accounts: n, chains: i }); + const n = vG(r, this.session), i = xE(n), s = bm(this.namespaces, this.optionalNamespaces), o = xm(hd({}, s[r]), { accounts: n, chains: i }); switch (r) { case "eip155": - this.rpcProviders[r] = new SG({ namespace: o }); + this.rpcProviders[r] = new AG({ namespace: o }); break; case "algorand": - this.rpcProviders[r] = new MG({ namespace: o }); + this.rpcProviders[r] = new IG({ namespace: o }); break; case "solana": - this.rpcProviders[r] = new AG({ namespace: o }); + this.rpcProviders[r] = new PG({ namespace: o }); break; case "cosmos": - this.rpcProviders[r] = new PG({ namespace: o }); + this.rpcProviders[r] = new MG({ namespace: o }); break; case "polkadot": - this.rpcProviders[r] = new bG({ namespace: o }); + this.rpcProviders[r] = new yG({ namespace: o }); break; case "cip34": - this.rpcProviders[r] = new IG({ namespace: o }); + this.rpcProviders[r] = new CG({ namespace: o }); break; case "elrond": - this.rpcProviders[r] = new CG({ namespace: o }); + this.rpcProviders[r] = new TG({ namespace: o }); break; case "multiversx": - this.rpcProviders[r] = new TG({ namespace: o }); + this.rpcProviders[r] = new RG({ namespace: o }); break; case "near": - this.rpcProviders[r] = new RG({ namespace: o }); + this.rpcProviders[r] = new DG({ namespace: o }); break; case "tezos": - this.rpcProviders[r] = new DG({ namespace: o }); + this.rpcProviders[r] = new OG({ namespace: o }); break; default: - this.rpcProviders[Xc] ? this.rpcProviders[Xc].updateNamespace(o) : this.rpcProviders[Xc] = new OG({ namespace: o }); + this.rpcProviders[Xc] ? this.rpcProviders[Xc].updateNamespace(o) : this.rpcProviders[Xc] = new NG({ namespace: o }); } }); } @@ -25932,7 +25932,7 @@ let AE = class PE { const { params: r } = e, { event: n } = r; if (n.name === "accountsChanged") { const i = n.data; - i && gc(i) && this.events.emit("accountsChanged", i.map(vG)); + i && pc(i) && this.events.emit("accountsChanged", i.map(bG)); } else if (n.name === "chainChanged") { const i = r.chainId, s = r.event.data, o = Ff(i), a = ym(i) !== ym(s) ? `${o}:${ym(s)}` : i; this.onChainChanged(a); @@ -25944,7 +25944,7 @@ let AE = class PE { this.session = xm(hd({}, s), { namespaces: i }), this.onSessionUpdate(), this.events.emit("session_update", { topic: e, params: r }); }), this.client.on("session_delete", async (e) => { await this.cleanup(), this.events.emit("session_delete", e), this.events.emit("disconnect", xm(hd({}, Or("USER_DISCONNECTED")), { data: e.topic })); - }), this.on(us.DEFAULT_CHAIN_CHANGED, (e) => { + }), this.on(cs.DEFAULT_CHAIN_CHANGED, (e) => { this.onChainChanged(e, !0); }); } @@ -25985,14 +25985,14 @@ let AE = class PE { this.session = void 0, this.namespaces = void 0, this.optionalNamespaces = void 0, this.sessionProperties = void 0, this.persist("namespaces", void 0), this.persist("optionalNamespaces", void 0), this.persist("sessionProperties", void 0), await this.cleanupPendingPairings({ deletePairings: !0 }); } persist(e, r) { - this.client.core.storage.setItem(`${K3}/${e}`, r); + this.client.core.storage.setItem(`${W3}/${e}`, r); } async getFromStore(e) { - return await this.client.core.storage.getItem(`${K3}/${e}`); + return await this.client.core.storage.getItem(`${W3}/${e}`); } }; -const FG = AE; -function jG() { +const jG = EE; +function UG() { return new Promise((t) => { const e = []; let r; @@ -26002,7 +26002,7 @@ function jG() { }), r = setTimeout(() => t(e), 200), window.dispatchEvent(new Event("eip6963:requestProvider")); }); } -class to { +class eo { constructor(e, r) { this.scope = e, this.module = r; } @@ -26034,7 +26034,7 @@ class to { return `-${this.scope}${this.module ? `:${this.module}` : ""}:${e}`; } static clearAll() { - new to("CBWSDK").clear(), new to("walletlink").clear(); + new eo("CBWSDK").clear(), new eo("walletlink").clear(); } } const fn = { @@ -26128,65 +26128,65 @@ const fn = { standard: "EIP-3085", message: "Unrecognized chain ID." } -}, ME = "Unspecified error message.", UG = "Unspecified server error."; -function pb(t, e = ME) { +}, AE = "Unspecified error message.", qG = "Unspecified server error."; +function pb(t, e = AE) { if (t && Number.isInteger(t)) { const r = t.toString(); if (L1(N1, r)) return N1[r].message; - if (IE(t)) - return UG; + if (PE(t)) + return qG; } return e; } -function qG(t) { +function zG(t) { if (!Number.isInteger(t)) return !1; const e = t.toString(); - return !!(N1[e] || IE(t)); + return !!(N1[e] || PE(t)); } -function zG(t, { shouldIncludeStack: e = !1 } = {}) { +function WG(t, { shouldIncludeStack: e = !1 } = {}) { const r = {}; - if (t && typeof t == "object" && !Array.isArray(t) && L1(t, "code") && qG(t.code)) { + if (t && typeof t == "object" && !Array.isArray(t) && L1(t, "code") && zG(t.code)) { const n = t; - r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, L1(n, "data") && (r.data = n.data)) : (r.message = pb(r.code), r.data = { originalError: n6(t) }); + r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, L1(n, "data") && (r.data = n.data)) : (r.message = pb(r.code), r.data = { originalError: t6(t) }); } else - r.code = fn.rpc.internal, r.message = i6(t, "message") ? t.message : ME, r.data = { originalError: n6(t) }; - return e && (r.stack = i6(t, "stack") ? t.stack : void 0), r; + r.code = fn.rpc.internal, r.message = r6(t, "message") ? t.message : AE, r.data = { originalError: t6(t) }; + return e && (r.stack = r6(t, "stack") ? t.stack : void 0), r; } -function IE(t) { +function PE(t) { return t >= -32099 && t <= -32e3; } -function n6(t) { +function t6(t) { return t && typeof t == "object" && !Array.isArray(t) ? Object.assign({}, t) : t; } function L1(t, e) { return Object.prototype.hasOwnProperty.call(t, e); } -function i6(t, e) { +function r6(t, e) { return typeof t == "object" && t !== null && e in t && typeof t[e] == "string"; } const Sr = { rpc: { - parse: (t) => Yi(fn.rpc.parse, t), - invalidRequest: (t) => Yi(fn.rpc.invalidRequest, t), - invalidParams: (t) => Yi(fn.rpc.invalidParams, t), - methodNotFound: (t) => Yi(fn.rpc.methodNotFound, t), - internal: (t) => Yi(fn.rpc.internal, t), + parse: (t) => Gi(fn.rpc.parse, t), + invalidRequest: (t) => Gi(fn.rpc.invalidRequest, t), + invalidParams: (t) => Gi(fn.rpc.invalidParams, t), + methodNotFound: (t) => Gi(fn.rpc.methodNotFound, t), + internal: (t) => Gi(fn.rpc.internal, t), server: (t) => { if (!t || typeof t != "object" || Array.isArray(t)) throw new Error("Ethereum RPC Server errors must provide single object argument."); const { code: e } = t; if (!Number.isInteger(e) || e > -32005 || e < -32099) throw new Error('"code" must be an integer such that: -32099 <= code <= -32005'); - return Yi(e, t); + return Gi(e, t); }, - invalidInput: (t) => Yi(fn.rpc.invalidInput, t), - resourceNotFound: (t) => Yi(fn.rpc.resourceNotFound, t), - resourceUnavailable: (t) => Yi(fn.rpc.resourceUnavailable, t), - transactionRejected: (t) => Yi(fn.rpc.transactionRejected, t), - methodNotSupported: (t) => Yi(fn.rpc.methodNotSupported, t), - limitExceeded: (t) => Yi(fn.rpc.limitExceeded, t) + invalidInput: (t) => Gi(fn.rpc.invalidInput, t), + resourceNotFound: (t) => Gi(fn.rpc.resourceNotFound, t), + resourceUnavailable: (t) => Gi(fn.rpc.resourceUnavailable, t), + transactionRejected: (t) => Gi(fn.rpc.transactionRejected, t), + methodNotSupported: (t) => Gi(fn.rpc.methodNotSupported, t), + limitExceeded: (t) => Gi(fn.rpc.limitExceeded, t) }, provider: { userRejectedRequest: (t) => Vc(fn.provider.userRejectedRequest, t), @@ -26201,19 +26201,19 @@ const Sr = { const { code: e, message: r, data: n } = t; if (!r || typeof r != "string") throw new Error('"message" must be a nonempty string'); - return new RE(e, r, n); + return new CE(e, r, n); } } }; -function Yi(t, e) { - const [r, n] = CE(e); - return new TE(t, r || pb(t), n); +function Gi(t, e) { + const [r, n] = ME(e); + return new IE(t, r || pb(t), n); } function Vc(t, e) { - const [r, n] = CE(e); - return new RE(t, r || pb(t), n); + const [r, n] = ME(e); + return new CE(t, r || pb(t), n); } -function CE(t) { +function ME(t) { if (t) { if (typeof t == "string") return [t]; @@ -26226,7 +26226,7 @@ function CE(t) { } return []; } -class TE extends Error { +class IE extends Error { constructor(e, r, n) { if (!Number.isInteger(e)) throw new Error('"code" must be an integer.'); @@ -26235,29 +26235,29 @@ class TE extends Error { super(r), this.code = e, n !== void 0 && (this.data = n); } } -class RE extends TE { +class CE extends IE { /** * Create an Ethereum Provider JSON-RPC error. * `code` must be an integer in the 1000 <= 4999 range. */ constructor(e, r, n) { - if (!WG(e)) + if (!HG(e)) throw new Error('"code" must be an integer such that: 1000 <= code <= 4999'); super(e, r, n); } } -function WG(t) { +function HG(t) { return Number.isInteger(t) && t >= 1e3 && t <= 4999; } function gb() { return (t) => t; } -const Al = gb(), HG = gb(), KG = gb(); -function So(t) { +const Al = gb(), KG = gb(), VG = gb(); +function _o(t) { return Math.floor(t); } -const DE = /^[0-9]*$/, OE = /^[a-f0-9]*$/; -function ec(t) { +const TE = /^[0-9]*$/, RE = /^[a-f0-9]*$/; +function Qa(t) { return mb(crypto.getRandomValues(new Uint8Array(t))); } function mb(t) { @@ -26274,43 +26274,43 @@ function _m(t) { return Hf(k1(t), !0); } function $s(t) { - return KG(t.toString(10)); + return VG(t.toString(10)); } -function ma(t) { +function pa(t) { return Al(`0x${BigInt(t).toString(16)}`); } -function NE(t) { +function DE(t) { return t.startsWith("0x") || t.startsWith("0X"); } function vb(t) { - return NE(t) ? t.slice(2) : t; + return DE(t) ? t.slice(2) : t; } -function LE(t) { - return NE(t) ? `0x${t.slice(2)}` : `0x${t}`; +function OE(t) { + return DE(t) ? `0x${t.slice(2)}` : `0x${t}`; } function ap(t) { if (typeof t != "string") return !1; const e = vb(t).toLowerCase(); - return OE.test(e); + return RE.test(e); } -function VG(t, e = !1) { +function GG(t, e = !1) { if (typeof t == "string") { const r = vb(t).toLowerCase(); - if (OE.test(r)) + if (RE.test(r)) return Al(e ? `0x${r}` : r); } throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`); } function bb(t, e = !1) { - let r = VG(t, !1); + let r = GG(t, !1); return r.length % 2 === 1 && (r = Al(`0${r}`)), e ? Al(`0x${r}`) : r; } -function ia(t) { +function ra(t) { if (typeof t == "string") { const e = vb(t).toLowerCase(); if (ap(e) && e.length === 40) - return HG(LE(e)); + return KG(OE(e)); } throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`); } @@ -26328,48 +26328,48 @@ function k1(t) { } function Kf(t) { if (typeof t == "number" && Number.isInteger(t)) - return So(t); + return _o(t); if (typeof t == "string") { - if (DE.test(t)) - return So(Number(t)); + if (TE.test(t)) + return _o(Number(t)); if (ap(t)) - return So(Number(BigInt(bb(t, !0)))); + return _o(Number(BigInt(bb(t, !0)))); } throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`); } function Rf(t) { - if (t !== null && (typeof t == "bigint" || YG(t))) + if (t !== null && (typeof t == "bigint" || JG(t))) return BigInt(t.toString(10)); if (typeof t == "number") return BigInt(Kf(t)); if (typeof t == "string") { - if (DE.test(t)) + if (TE.test(t)) return BigInt(t); if (ap(t)) return BigInt(bb(t, !0)); } throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`); } -function GG(t) { +function YG(t) { if (typeof t == "string") return JSON.parse(t); if (typeof t == "object") return t; throw Sr.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`); } -function YG(t) { +function JG(t) { if (t == null || typeof t.constructor != "function") return !1; const { constructor: e } = t; return typeof e.config == "function" && typeof e.EUCLID == "number"; } -async function JG() { +async function XG() { return crypto.subtle.generateKey({ name: "ECDH", namedCurve: "P-256" }, !0, ["deriveKey"]); } -async function XG(t, e) { +async function ZG(t, e) { return crypto.subtle.deriveKey({ name: "ECDH", public: e @@ -26378,21 +26378,21 @@ async function XG(t, e) { length: 256 }, !1, ["encrypt", "decrypt"]); } -async function ZG(t, e) { +async function QG(t, e) { const r = crypto.getRandomValues(new Uint8Array(12)), n = await crypto.subtle.encrypt({ name: "AES-GCM", iv: r }, t, new TextEncoder().encode(e)); return { iv: r, cipherText: n }; } -async function QG(t, { iv: e, cipherText: r }) { +async function eY(t, { iv: e, cipherText: r }) { const n = await crypto.subtle.decrypt({ name: "AES-GCM", iv: e }, t, r); return new TextDecoder().decode(n); } -function kE(t) { +function NE(t) { switch (t) { case "public": return "spki"; @@ -26400,28 +26400,28 @@ function kE(t) { return "pkcs8"; } } -async function $E(t, e) { - const r = kE(t), n = await crypto.subtle.exportKey(r, e); +async function LE(t, e) { + const r = NE(t), n = await crypto.subtle.exportKey(r, e); return mb(new Uint8Array(n)); } -async function BE(t, e) { - const r = kE(t), n = Dd(e).buffer; +async function kE(t, e) { + const r = NE(t), n = Dd(e).buffer; return await crypto.subtle.importKey(r, new Uint8Array(n), { name: "ECDH", namedCurve: "P-256" }, !0, t === "private" ? ["deriveKey"] : []); } -async function eY(t, e) { +async function tY(t, e) { const r = JSON.stringify(t, (n, i) => { if (!(i instanceof Error)) return i; const s = i; return Object.assign(Object.assign({}, s.code ? { code: s.code } : {}), { message: s.message }); }); - return ZG(e, r); + return QG(e, r); } -async function tY(t, e) { - return JSON.parse(await QG(e, t)); +async function rY(t, e) { + return JSON.parse(await eY(e, t)); } const Em = { storageKey: "ownPrivateKey", @@ -26433,9 +26433,9 @@ const Em = { storageKey: "peerPublicKey", keyType: "public" }; -class rY { +class nY { constructor() { - this.storage = new to("CBWSDK", "SCWKeyManager"), this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null; + this.storage = new eo("CBWSDK", "SCWKeyManager"), this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null; } async getOwnPublicKey() { return await this.loadKeysIfNeeded(), this.ownPublicKey; @@ -26451,28 +26451,28 @@ class rY { this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null, this.storage.removeItem(Sm.storageKey), this.storage.removeItem(Em.storageKey), this.storage.removeItem(Am.storageKey); } async generateKeyPair() { - const e = await JG(); + const e = await XG(); this.ownPrivateKey = e.privateKey, this.ownPublicKey = e.publicKey, await this.storeKey(Em, e.privateKey), await this.storeKey(Sm, e.publicKey); } async loadKeysIfNeeded() { if (this.ownPrivateKey === null && (this.ownPrivateKey = await this.loadKey(Em)), this.ownPublicKey === null && (this.ownPublicKey = await this.loadKey(Sm)), (this.ownPrivateKey === null || this.ownPublicKey === null) && await this.generateKeyPair(), this.peerPublicKey === null && (this.peerPublicKey = await this.loadKey(Am)), this.sharedSecret === null) { if (this.ownPrivateKey === null || this.peerPublicKey === null) return; - this.sharedSecret = await XG(this.ownPrivateKey, this.peerPublicKey); + this.sharedSecret = await ZG(this.ownPrivateKey, this.peerPublicKey); } } // storage methods async loadKey(e) { const r = this.storage.getItem(e.storageKey); - return r ? BE(e.keyType, r) : null; + return r ? kE(e.keyType, r) : null; } async storeKey(e, r) { - const n = await $E(e.keyType, r); + const n = await LE(e.keyType, r); this.storage.setItem(e.storageKey, n); } } -const nh = "4.2.4", FE = "@coinbase/wallet-sdk"; -async function jE(t, e) { +const nh = "4.2.4", $E = "@coinbase/wallet-sdk"; +async function BE(t, e) { const r = Object.assign(Object.assign({}, t), { jsonrpc: "2.0", id: crypto.randomUUID() }), n = await window.fetch(e, { method: "POST", body: JSON.stringify(r), @@ -26480,17 +26480,17 @@ async function jE(t, e) { headers: { "Content-Type": "application/json", "X-Cbw-Sdk-Version": nh, - "X-Cbw-Sdk-Platform": FE + "X-Cbw-Sdk-Platform": $E } }), { result: i, error: s } = await n.json(); if (s) throw s; return i; } -function nY() { +function iY() { return globalThis.coinbaseWalletExtension; } -function iY() { +function sY() { var t, e; try { const r = globalThis; @@ -26499,19 +26499,19 @@ function iY() { return; } } -function sY({ metadata: t, preference: e }) { +function oY({ metadata: t, preference: e }) { var r, n; const { appName: i, appLogoUrl: s, appChainIds: o } = t; if (e.options !== "smartWalletOnly") { - const u = nY(); + const u = iY(); if (u) return (r = u.setAppInfo) === null || r === void 0 || r.call(u, i, s, o, e), u; } - const a = iY(); + const a = sY(); if (a != null && a.isCoinbaseBrowser) return (n = a.setAppInfo) === null || n === void 0 || n.call(a, i, s, o, e), a; } -function oY(t) { +function aY(t) { if (!t || typeof t != "object" || Array.isArray(t)) throw Sr.rpc.invalidParams({ message: "Expected a single, non-array, object argument.", @@ -26536,11 +26536,11 @@ function oY(t) { throw Sr.provider.unsupportedMethod(); } } -const s6 = "accounts", o6 = "activeChain", a6 = "availableChains", c6 = "walletCapabilities"; -class aY { +const n6 = "accounts", i6 = "activeChain", s6 = "availableChains", o6 = "walletCapabilities"; +class cY { constructor(e) { var r, n, i; - this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new rY(), this.storage = new to("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(s6)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(o6) || { + this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new nY(), this.storage = new eo("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(n6)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(i6) || { id: (i = (n = e.metadata.appChainIds) === null || n === void 0 ? void 0 : n[0]) !== null && i !== void 0 ? i : 1 }, this.handshake = this.handshake.bind(this), this.request = this.request.bind(this), this.createRequestMessage = this.createRequestMessage.bind(this), this.decryptResponseMessage = this.decryptResponseMessage.bind(this); } @@ -26554,13 +26554,13 @@ class aY { }), s = await this.communicator.postRequestAndWaitForResponse(i); if ("failure" in s.content) throw s.content.failure; - const o = await BE("public", s.sender); + const o = await kE("public", s.sender); await this.keyManager.setPeerPublicKey(o); const u = (await this.decryptResponseMessage(s)).result; if ("error" in u) throw u.error; const l = u.value; - this.accounts = l, this.storage.storeObject(s6, l), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", l); + this.accounts = l, this.storage.storeObject(n6, l), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", l); } async request(e) { var r; @@ -26568,7 +26568,7 @@ class aY { throw Sr.provider.unauthorized(); switch (e.method) { case "eth_requestAccounts": - return (r = this.callback) === null || r === void 0 || r.call(this, "connect", { chainId: ma(this.chain.id) }), this.accounts; + return (r = this.callback) === null || r === void 0 || r.call(this, "connect", { chainId: pa(this.chain.id) }), this.accounts; case "eth_accounts": return this.accounts; case "eth_coinbase": @@ -26576,9 +26576,9 @@ class aY { case "net_version": return this.chain.id; case "eth_chainId": - return ma(this.chain.id); + return pa(this.chain.id); case "wallet_getCapabilities": - return this.storage.loadObject(c6); + return this.storage.loadObject(o6); case "wallet_switchEthereumChain": return this.handleSwitchChainRequest(e); case "eth_ecRecover": @@ -26599,7 +26599,7 @@ class aY { default: if (!this.chain.rpcUrl) throw Sr.rpc.internal("No RPC URL set for chain"); - return jE(e, this.chain.rpcUrl); + return BE(e, this.chain.rpcUrl); } } async sendRequestToPopup(e) { @@ -26635,14 +26635,14 @@ class aY { const r = await this.keyManager.getSharedSecret(); if (!r) throw Sr.provider.unauthorized("No valid session found, try requestAccounts before other methods"); - const n = await eY({ + const n = await tY({ action: e, chainId: this.chain.id }, r), i = await this.createRequestMessage({ encrypted: n }); return this.communicator.postRequestAndWaitForResponse(i); } async createRequestMessage(e) { - const r = await $E("public", await this.keyManager.getOwnPublicKey()); + const r = await LE("public", await this.keyManager.getOwnPublicKey()); return { id: crypto.randomUUID(), sender: r, @@ -26658,31 +26658,31 @@ class aY { const s = await this.keyManager.getSharedSecret(); if (!s) throw Sr.provider.unauthorized("Invalid session"); - const o = await tY(i.encrypted, s), a = (r = o.data) === null || r === void 0 ? void 0 : r.chains; + const o = await rY(i.encrypted, s), a = (r = o.data) === null || r === void 0 ? void 0 : r.chains; if (a) { const l = Object.entries(a).map(([d, p]) => ({ id: Number(d), rpcUrl: p })); - this.storage.storeObject(a6, l), this.updateChain(this.chain.id, l); + this.storage.storeObject(s6, l), this.updateChain(this.chain.id, l); } const u = (n = o.data) === null || n === void 0 ? void 0 : n.capabilities; - return u && this.storage.storeObject(c6, u), o; + return u && this.storage.storeObject(o6, u), o; } updateChain(e, r) { var n; - const i = r ?? this.storage.loadObject(a6), s = i == null ? void 0 : i.find((o) => o.id === e); - return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(o6, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", ma(s.id))), !0) : !1; + const i = r ?? this.storage.loadObject(s6), s = i == null ? void 0 : i.find((o) => o.id === e); + return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(i6, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(s.id))), !0) : !1; } } -const cY = /* @__PURE__ */ bv(jD), { keccak_256: uY } = cY; -function UE(t) { +const uY = /* @__PURE__ */ bv(UD), { keccak_256: fY } = uY; +function FE(t) { return Buffer.allocUnsafe(t).fill(0); } -function fY(t) { +function lY(t) { return t.toString(2).length; } -function qE(t, e) { +function jE(t, e) { let r = t.toString(16); r.length % 2 !== 0 && (r = "0" + r); const n = r.match(/.{1,2}/g).map((i) => parseInt(i, 16)); @@ -26690,7 +26690,7 @@ function qE(t, e) { n.unshift(0); return Buffer.from(n); } -function lY(t, e) { +function hY(t, e) { const r = t < 0n; let n; if (r) { @@ -26700,77 +26700,77 @@ function lY(t, e) { n = t; return n &= (1n << BigInt(e)) - 1n, n; } -function zE(t, e, r) { - const n = UE(e); +function UE(t, e, r) { + const n = FE(e); return t = cp(t), r ? t.length < e ? (t.copy(n), n) : t.slice(0, e) : t.length < e ? (t.copy(n, e - t.length), n) : t.slice(-e); } -function hY(t, e) { - return zE(t, e, !0); +function dY(t, e) { + return UE(t, e, !0); } function cp(t) { if (!Buffer.isBuffer(t)) if (Array.isArray(t)) t = Buffer.from(t); else if (typeof t == "string") - WE(t) ? t = Buffer.from(gY(HE(t)), "hex") : t = Buffer.from(t); + qE(t) ? t = Buffer.from(mY(zE(t)), "hex") : t = Buffer.from(t); else if (typeof t == "number") t = intToBuffer(t); else if (t == null) t = Buffer.allocUnsafe(0); else if (typeof t == "bigint") - t = qE(t); + t = jE(t); else if (t.toArray) t = Buffer.from(t.toArray()); else throw new Error("invalid type"); return t; } -function dY(t) { +function pY(t) { return t = cp(t), "0x" + t.toString("hex"); } -function pY(t, e) { +function gY(t, e) { if (t = cp(t), e || (e = 256), e !== 256) throw new Error("unsupported"); - return Buffer.from(uY(new Uint8Array(t))); + return Buffer.from(fY(new Uint8Array(t))); } -function gY(t) { +function mY(t) { return t.length % 2 ? "0" + t : t; } -function WE(t) { +function qE(t) { return typeof t == "string" && t.match(/^0x[0-9A-Fa-f]*$/); } -function HE(t) { +function zE(t) { return typeof t == "string" && t.startsWith("0x") ? t.slice(2) : t; } -var KE = { - zeros: UE, - setLength: zE, - setLengthRight: hY, - isHexString: WE, - stripHexPrefix: HE, +var WE = { + zeros: FE, + setLength: UE, + setLengthRight: dY, + isHexString: qE, + stripHexPrefix: zE, toBuffer: cp, - bufferToHex: dY, - keccak: pY, - bitLengthFromBigInt: fY, - bufferBEFromBigInt: qE, - twosFromBigInt: lY -}; -const ii = KE; -function VE(t) { + bufferToHex: pY, + keccak: gY, + bitLengthFromBigInt: lY, + bufferBEFromBigInt: jE, + twosFromBigInt: hY +}; +const si = WE; +function HE(t) { return t.startsWith("int[") ? "int256" + t.slice(3) : t === "int" ? "int256" : t.startsWith("uint[") ? "uint256" + t.slice(4) : t === "uint" ? "uint256" : t.startsWith("fixed[") ? "fixed128x128" + t.slice(5) : t === "fixed" ? "fixed128x128" : t.startsWith("ufixed[") ? "ufixed128x128" + t.slice(6) : t === "ufixed" ? "ufixed128x128" : t; } function pu(t) { return Number.parseInt(/^\D+(\d+)$/.exec(t)[1], 10); } -function u6(t) { +function a6(t) { var e = /^\D+(\d+)x(\d+)$/.exec(t); return [Number.parseInt(e[1], 10), Number.parseInt(e[2], 10)]; } -function GE(t) { +function KE(t) { var e = t.match(/(.*)\[(.*?)\]$/); return e ? e[2] === "" ? "dynamic" : Number.parseInt(e[2], 10) : null; } -function tc(t) { +function ec(t) { var e = typeof t; if (e === "string" || e === "number") return BigInt(t); @@ -26781,15 +26781,15 @@ function tc(t) { function qs(t, e) { var r, n, i, s; if (t === "address") - return qs("uint160", tc(e)); + return qs("uint160", ec(e)); if (t === "bool") return qs("uint8", e ? 1 : 0); if (t === "string") return qs("bytes", new Buffer(e, "utf8")); - if (vY(t)) { + if (bY(t)) { if (typeof e.length > "u") throw new Error("Not an array?"); - if (r = GE(t), r !== "dynamic" && r !== 0 && e.length > r) + if (r = KE(t), r !== "dynamic" && r !== 0 && e.length > r) throw new Error("Elements exceed array size: " + r); i = [], t = t.slice(0, t.lastIndexOf("[")), typeof e == "string" && (e = JSON.parse(e)); for (s in e) @@ -26801,58 +26801,58 @@ function qs(t, e) { return Buffer.concat(i); } else { if (t === "bytes") - return e = new Buffer(e), i = Buffer.concat([qs("uint256", e.length), e]), e.length % 32 !== 0 && (i = Buffer.concat([i, ii.zeros(32 - e.length % 32)])), i; + return e = new Buffer(e), i = Buffer.concat([qs("uint256", e.length), e]), e.length % 32 !== 0 && (i = Buffer.concat([i, si.zeros(32 - e.length % 32)])), i; if (t.startsWith("bytes")) { if (r = pu(t), r < 1 || r > 32) throw new Error("Invalid bytes width: " + r); - return ii.setLengthRight(e, 32); + return si.setLengthRight(e, 32); } else if (t.startsWith("uint")) { if (r = pu(t), r % 8 || r < 8 || r > 256) throw new Error("Invalid uint width: " + r); - n = tc(e); - const a = ii.bitLengthFromBigInt(n); + n = ec(e); + const a = si.bitLengthFromBigInt(n); if (a > r) throw new Error("Supplied uint exceeds width: " + r + " vs " + a); if (n < 0) throw new Error("Supplied uint is negative"); - return ii.bufferBEFromBigInt(n, 32); + return si.bufferBEFromBigInt(n, 32); } else if (t.startsWith("int")) { if (r = pu(t), r % 8 || r < 8 || r > 256) throw new Error("Invalid int width: " + r); - n = tc(e); - const a = ii.bitLengthFromBigInt(n); + n = ec(e); + const a = si.bitLengthFromBigInt(n); if (a > r) throw new Error("Supplied int exceeds width: " + r + " vs " + a); - const u = ii.twosFromBigInt(n, 256); - return ii.bufferBEFromBigInt(u, 32); + const u = si.twosFromBigInt(n, 256); + return si.bufferBEFromBigInt(u, 32); } else if (t.startsWith("ufixed")) { - if (r = u6(t), n = tc(e), n < 0) + if (r = a6(t), n = ec(e), n < 0) throw new Error("Supplied ufixed is negative"); return qs("uint256", n * BigInt(2) ** BigInt(r[1])); } else if (t.startsWith("fixed")) - return r = u6(t), qs("int256", tc(e) * BigInt(2) ** BigInt(r[1])); + return r = a6(t), qs("int256", ec(e) * BigInt(2) ** BigInt(r[1])); } throw new Error("Unsupported or invalid type: " + t); } -function mY(t) { - return t === "string" || t === "bytes" || GE(t) === "dynamic"; -} function vY(t) { + return t === "string" || t === "bytes" || KE(t) === "dynamic"; +} +function bY(t) { return t.lastIndexOf("]") === t.length - 1; } -function bY(t, e) { +function yY(t, e) { var r = [], n = [], i = 32 * t.length; for (var s in t) { - var o = VE(t[s]), a = e[s], u = qs(o, a); - mY(o) ? (r.push(qs("uint256", i)), n.push(u), i += u.length) : r.push(u); + var o = HE(t[s]), a = e[s], u = qs(o, a); + vY(o) ? (r.push(qs("uint256", i)), n.push(u), i += u.length) : r.push(u); } return Buffer.concat(r.concat(n)); } -function YE(t, e) { +function VE(t, e) { if (t.length !== e.length) throw new Error("Number of types are not matching the values"); for (var r, n, i = [], s = 0; s < t.length; s++) { - var o = VE(t[s]), a = e[s]; + var o = HE(t[s]), a = e[s]; if (o === "bytes") i.push(a); else if (o === "string") @@ -26860,42 +26860,42 @@ function YE(t, e) { else if (o === "bool") i.push(new Buffer(a ? "01" : "00", "hex")); else if (o === "address") - i.push(ii.setLength(a, 20)); + i.push(si.setLength(a, 20)); else if (o.startsWith("bytes")) { if (r = pu(o), r < 1 || r > 32) throw new Error("Invalid bytes width: " + r); - i.push(ii.setLengthRight(a, r)); + i.push(si.setLengthRight(a, r)); } else if (o.startsWith("uint")) { if (r = pu(o), r % 8 || r < 8 || r > 256) throw new Error("Invalid uint width: " + r); - n = tc(a); - const u = ii.bitLengthFromBigInt(n); + n = ec(a); + const u = si.bitLengthFromBigInt(n); if (u > r) throw new Error("Supplied uint exceeds width: " + r + " vs " + u); - i.push(ii.bufferBEFromBigInt(n, r / 8)); + i.push(si.bufferBEFromBigInt(n, r / 8)); } else if (o.startsWith("int")) { if (r = pu(o), r % 8 || r < 8 || r > 256) throw new Error("Invalid int width: " + r); - n = tc(a); - const u = ii.bitLengthFromBigInt(n); + n = ec(a); + const u = si.bitLengthFromBigInt(n); if (u > r) throw new Error("Supplied int exceeds width: " + r + " vs " + u); - const l = ii.twosFromBigInt(n, r); - i.push(ii.bufferBEFromBigInt(l, r / 8)); + const l = si.twosFromBigInt(n, r); + i.push(si.bufferBEFromBigInt(l, r / 8)); } else throw new Error("Unsupported or invalid type: " + o); } return Buffer.concat(i); } -function yY(t, e) { - return ii.keccak(YE(t, e)); +function wY(t, e) { + return si.keccak(VE(t, e)); } -var wY = { - rawEncode: bY, - solidityPack: YE, - soliditySHA3: yY +var xY = { + rawEncode: yY, + solidityPack: VE, + soliditySHA3: wY }; -const ys = KE, Vf = wY, JE = { +const ys = WE, Vf = xY, GE = { type: "object", properties: { types: { @@ -27032,7 +27032,7 @@ const ys = KE, Vf = wY, JE = { */ sanitizeData(t) { const e = {}; - for (const r in JE.properties) + for (const r in GE.properties) t[r] && (e[r] = t[r]); return e.types && (e.types = Object.assign({ EIP712Domain: [] }, e.types)), e; }, @@ -27047,11 +27047,11 @@ const ys = KE, Vf = wY, JE = { return n.push(this.hashStruct("EIP712Domain", r.domain, r.types, e)), r.primaryType !== "EIP712Domain" && n.push(this.hashStruct(r.primaryType, r.message, r.types, e)), ys.keccak(Buffer.concat(n)); } }; -var xY = { - TYPED_MESSAGE_SCHEMA: JE, +var _Y = { + TYPED_MESSAGE_SCHEMA: GE, TypedDataUtils: Pm, hashForSignTypedDataLegacy: function(t) { - return _Y(t.data); + return EY(t.data); }, hashForSignTypedData_v3: function(t) { return Pm.hash(t.data, !1); @@ -27060,7 +27060,7 @@ var xY = { return Pm.hash(t.data); } }; -function _Y(t) { +function EY(t) { const e = new Error("Expect argument to be non-empty array"); if (typeof t != "object" || !t.length) throw e; const r = t.map(function(s) { @@ -27079,11 +27079,11 @@ function _Y(t) { ] ); } -const dd = /* @__PURE__ */ rs(xY), EY = "walletUsername", $1 = "Addresses", SY = "AppVersion"; +const dd = /* @__PURE__ */ ts(_Y), SY = "walletUsername", $1 = "Addresses", AY = "AppVersion"; function jn(t) { return t.errorMessage !== void 0; } -class AY { +class PY { // @param secret hex representation of 32-byte secret constructor(e) { this.secret = e; @@ -27130,7 +27130,7 @@ class AY { }); } } -class PY { +class MY { constructor(e, r, n) { this.linkAPIUrl = e, this.sessionId = r; const i = `${r}:${n}`; @@ -27168,11 +27168,11 @@ class PY { throw new Error(`Check unseen events failed: ${r.status}`); } } -var Io; +var Po; (function(t) { t[t.DISCONNECTED = 0] = "DISCONNECTED", t[t.CONNECTING = 1] = "CONNECTING", t[t.CONNECTED = 2] = "CONNECTED"; -})(Io || (Io = {})); -class MY { +})(Po || (Po = {})); +class IY { setConnectionStateListener(e) { this.connectionStateListener = e; } @@ -27203,12 +27203,12 @@ class MY { r(s); return; } - (n = this.connectionStateListener) === null || n === void 0 || n.call(this, Io.CONNECTING), i.onclose = (s) => { + (n = this.connectionStateListener) === null || n === void 0 || n.call(this, Po.CONNECTING), i.onclose = (s) => { var o; - this.clearWebSocket(), r(new Error(`websocket error ${s.code}: ${s.reason}`)), (o = this.connectionStateListener) === null || o === void 0 || o.call(this, Io.DISCONNECTED); + this.clearWebSocket(), r(new Error(`websocket error ${s.code}: ${s.reason}`)), (o = this.connectionStateListener) === null || o === void 0 || o.call(this, Po.DISCONNECTED); }, i.onopen = (s) => { var o; - e(), (o = this.connectionStateListener) === null || o === void 0 || o.call(this, Io.CONNECTED), this.pendingData.length > 0 && ([...this.pendingData].forEach((u) => this.sendData(u)), this.pendingData = []); + e(), (o = this.connectionStateListener) === null || o === void 0 || o.call(this, Po.CONNECTED), this.pendingData.length > 0 && ([...this.pendingData].forEach((u) => this.sendData(u)), this.pendingData = []); }, i.onmessage = (s) => { var o, a; if (s.data === "h") @@ -27231,7 +27231,7 @@ class MY { var e; const { webSocket: r } = this; if (r) { - this.clearWebSocket(), (e = this.connectionStateListener) === null || e === void 0 || e.call(this, Io.DISCONNECTED), this.connectionStateListener = void 0, this.incomingDataListener = void 0; + this.clearWebSocket(), (e = this.connectionStateListener) === null || e === void 0 || e.call(this, Po.DISCONNECTED), this.connectionStateListener = void 0, this.incomingDataListener = void 0; try { r.close(); } catch { @@ -27255,8 +27255,8 @@ class MY { e && (this.webSocket = null, e.onclose = null, e.onerror = null, e.onmessage = null, e.onopen = null); } } -const f6 = 1e4, IY = 6e4; -class CY { +const c6 = 1e4, CY = 6e4; +class TY { /** * Constructor * @param session Session @@ -27265,7 +27265,7 @@ class CY { * @param [WebSocketClass] Custom WebSocket implementation */ constructor({ session: e, linkAPIUrl: r, listener: n }) { - this.destroyed = !1, this.lastHeartbeatResponse = 0, this.nextReqId = So(1), this._connected = !1, this._linked = !1, this.shouldFetchUnseenEventsOnConnect = !1, this.requestResolutions = /* @__PURE__ */ new Map(), this.handleSessionMetadataUpdated = (s) => { + this.destroyed = !1, this.lastHeartbeatResponse = 0, this.nextReqId = _o(1), this._connected = !1, this._linked = !1, this.shouldFetchUnseenEventsOnConnect = !1, this.requestResolutions = /* @__PURE__ */ new Map(), this.handleSessionMetadataUpdated = (s) => { if (!s) return; (/* @__PURE__ */ new Map([ @@ -27294,19 +27294,19 @@ class CY { const u = await this.cipher.decrypt(o); (a = this.listener) === null || a === void 0 || a.metadataUpdated(s, u); }, this.handleWalletUsernameUpdated = async (s) => { - this.handleMetadataUpdated(EY, s); - }, this.handleAppVersionUpdated = async (s) => { this.handleMetadataUpdated(SY, s); + }, this.handleAppVersionUpdated = async (s) => { + this.handleMetadataUpdated(AY, s); }, this.handleChainUpdated = async (s, o) => { var a; const u = await this.cipher.decrypt(s), l = await this.cipher.decrypt(o); (a = this.listener) === null || a === void 0 || a.chainUpdated(u, l); - }, this.session = e, this.cipher = new AY(e.secret), this.listener = n; - const i = new MY(`${r}/rpc`, WebSocket); + }, this.session = e, this.cipher = new PY(e.secret), this.listener = n; + const i = new IY(`${r}/rpc`, WebSocket); i.setConnectionStateListener(async (s) => { let o = !1; switch (s) { - case Io.DISCONNECTED: + case Po.DISCONNECTED: if (!this.destroyed) { const a = async () => { await new Promise((u) => setTimeout(u, 5e3)), this.destroyed || i.connect().catch(() => { @@ -27316,12 +27316,12 @@ class CY { a(); } break; - case Io.CONNECTED: + case Po.CONNECTED: o = await this.handleConnected(), this.updateLastHeartbeat(), setInterval(() => { this.heartbeat(); - }, f6), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); + }, c6), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); break; - case Io.CONNECTING: + case Po.CONNECTING: break; } this.connected !== o && (this.connected = o); @@ -27348,7 +27348,7 @@ class CY { } } s.id !== void 0 && ((o = this.requestResolutions.get(s.id)) === null || o === void 0 || o(s)); - }), this.ws = i, this.http = new PY(r, e.id, e.key); + }), this.ws = i, this.http = new MY(r, e.id, e.key); } /** * Make a connection to the server @@ -27365,7 +27365,7 @@ class CY { async destroy() { this.destroyed || (await this.makeRequest({ type: "SetSessionConfig", - id: So(this.nextReqId++), + id: _o(this.nextReqId++), sessionId: this.session.id, metadata: { __destroyed: "1" } }, { timeout: 1e3 }), this.destroyed = !0, this.ws.disconnect(), this.listener = void 0); @@ -27425,7 +27425,7 @@ class CY { async publishEvent(e, r, n = !1) { const i = await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({}, r), { origin: location.origin, location: location.href, relaySource: "coinbaseWalletExtension" in window && window.coinbaseWalletExtension ? "injected_sdk" : "sdk" }))), s = { type: "PublishEvent", - id: So(this.nextReqId++), + id: _o(this.nextReqId++), sessionId: this.session.id, event: e, data: i, @@ -27445,7 +27445,7 @@ class CY { this.lastHeartbeatResponse = Date.now(); } heartbeat() { - if (Date.now() - this.lastHeartbeatResponse > f6 * 2) { + if (Date.now() - this.lastHeartbeatResponse > c6 * 2) { this.ws.disconnect(); return; } @@ -27454,7 +27454,7 @@ class CY { } catch { } } - async makeRequest(e, r = { timeout: IY }) { + async makeRequest(e, r = { timeout: CY }) { const n = e.id; this.sendData(e); let i; @@ -27474,41 +27474,41 @@ class CY { async handleConnected() { return (await this.makeRequest({ type: "HostSession", - id: So(this.nextReqId++), + id: _o(this.nextReqId++), sessionId: this.session.id, sessionKey: this.session.key })).type === "Fail" ? !1 : (this.sendData({ type: "IsLinked", - id: So(this.nextReqId++), + id: _o(this.nextReqId++), sessionId: this.session.id }), this.sendData({ type: "GetSessionConfig", - id: So(this.nextReqId++), + id: _o(this.nextReqId++), sessionId: this.session.id }), !0); } } -class TY { +class RY { constructor() { this._nextRequestId = 0, this.callbacks = /* @__PURE__ */ new Map(); } makeRequestId() { this._nextRequestId = (this._nextRequestId + 1) % 2147483647; - const e = this._nextRequestId, r = LE(e.toString(16)); + const e = this._nextRequestId, r = OE(e.toString(16)); return this.callbacks.get(r) && this.callbacks.delete(r), e; } } -const l6 = "session:id", h6 = "session:secret", d6 = "session:linked"; +const u6 = "session:id", f6 = "session:secret", l6 = "session:linked"; class gu { constructor(e, r, n, i = !1) { - this.storage = e, this.id = r, this.secret = n, this.key = xD(i4(`${r}, ${n} WalletLink`)), this._linked = !!i; + this.storage = e, this.id = r, this.secret = n, this.key = _D(r4(`${r}, ${n} WalletLink`)), this._linked = !!i; } static create(e) { - const r = ec(16), n = ec(32); + const r = Qa(16), n = Qa(32); return new gu(e, r, n).save(); } static load(e) { - const r = e.getItem(l6), n = e.getItem(d6), i = e.getItem(h6); + const r = e.getItem(u6), n = e.getItem(l6), i = e.getItem(f6); return r && i ? new gu(e, r, i, n === "1") : null; } get linked() { @@ -27518,52 +27518,52 @@ class gu { this._linked = e, this.persistLinked(); } save() { - return this.storage.setItem(l6, this.id), this.storage.setItem(h6, this.secret), this.persistLinked(), this; + return this.storage.setItem(u6, this.id), this.storage.setItem(f6, this.secret), this.persistLinked(), this; } persistLinked() { - this.storage.setItem(d6, this._linked ? "1" : "0"); + this.storage.setItem(l6, this._linked ? "1" : "0"); } } -function RY() { +function DY() { try { return window.frameElement !== null; } catch { return !1; } } -function DY() { +function OY() { try { - return RY() && window.top ? window.top.location : window.location; + return DY() && window.top ? window.top.location : window.location; } catch { return window.location; } } -function OY() { +function NY() { var t; return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t = window == null ? void 0 : window.navigator) === null || t === void 0 ? void 0 : t.userAgent); } -function XE() { +function YE() { var t, e; return (e = (t = window == null ? void 0 : window.matchMedia) === null || t === void 0 ? void 0 : t.call(window, "(prefers-color-scheme: dark)").matches) !== null && e !== void 0 ? e : !1; } -const NY = '@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}'; -function ZE() { +const LY = '@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}'; +function JE() { const t = document.createElement("style"); - t.type = "text/css", t.appendChild(document.createTextNode(NY)), document.documentElement.appendChild(t); + t.type = "text/css", t.appendChild(document.createTextNode(LY)), document.documentElement.appendChild(t); } -function QE(t) { +function XE(t) { var e, r, n = ""; if (typeof t == "string" || typeof t == "number") n += t; - else if (typeof t == "object") if (Array.isArray(t)) for (e = 0; e < t.length; e++) t[e] && (r = QE(t[e])) && (n && (n += " "), n += r); + else if (typeof t == "object") if (Array.isArray(t)) for (e = 0; e < t.length; e++) t[e] && (r = XE(t[e])) && (n && (n += " "), n += r); else for (e in t) t[e] && (n && (n += " "), n += e); return n; } function Gf() { - for (var t, e, r = 0, n = ""; r < arguments.length; ) (t = arguments[r++]) && (e = QE(t)) && (n && (n += " "), n += e); + for (var t, e, r = 0, n = ""; r < arguments.length; ) (t = arguments[r++]) && (e = XE(t)) && (n && (n += " "), n += e); return n; } -var up, Jr, eS, rc, p6, tS, B1, rS, yb, F1, j1, Pl = {}, nS = [], LY = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, wb = Array.isArray; -function va(t, e) { +var up, Jr, ZE, tc, h6, QE, B1, eS, yb, F1, j1, Pl = {}, tS = [], kY = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, wb = Array.isArray; +function ga(t, e) { for (var r in e) t[r] = e[r]; return t; } @@ -27577,7 +27577,7 @@ function Nr(t, e, r) { return Od(t, o, n, i, null); } function Od(t, e, r, n, i) { - var s = { type: t, props: e, key: r, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++eS, __i: -1, __u: 0 }; + var s = { type: t, props: e, key: r, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++ZE, __i: -1, __u: 0 }; return i == null && Jr.vnode != null && Jr.vnode(s), s; } function ih(t) { @@ -27591,39 +27591,39 @@ function Pu(t, e) { for (var r; e < t.__k.length; e++) if ((r = t.__k[e]) != null && r.__e != null) return r.__e; return typeof t.type == "function" ? Pu(t) : null; } -function iS(t) { +function rS(t) { var e, r; if ((t = t.__) != null && t.__c != null) { for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) if ((r = t.__k[e]) != null && r.__e != null) { t.__e = t.__c.base = r.__e; break; } - return iS(t); + return rS(t); } } -function g6(t) { - (!t.__d && (t.__d = !0) && rc.push(t) && !d0.__r++ || p6 !== Jr.debounceRendering) && ((p6 = Jr.debounceRendering) || tS)(d0); +function d6(t) { + (!t.__d && (t.__d = !0) && tc.push(t) && !d0.__r++ || h6 !== Jr.debounceRendering) && ((h6 = Jr.debounceRendering) || QE)(d0); } function d0() { var t, e, r, n, i, s, o, a; - for (rc.sort(B1); t = rc.shift(); ) t.__d && (e = rc.length, n = void 0, s = (i = (r = t).__v).__e, o = [], a = [], r.__P && ((n = va({}, i)).__v = i.__v + 1, Jr.vnode && Jr.vnode(n), _b(r.__P, n, i, r.__n, r.__P.namespaceURI, 32 & i.__u ? [s] : null, o, s ?? Pu(i), !!(32 & i.__u), a), n.__v = i.__v, n.__.__k[n.__i] = n, aS(o, n, a), n.__e != s && iS(n)), rc.length > e && rc.sort(B1)); + for (tc.sort(B1); t = tc.shift(); ) t.__d && (e = tc.length, n = void 0, s = (i = (r = t).__v).__e, o = [], a = [], r.__P && ((n = ga({}, i)).__v = i.__v + 1, Jr.vnode && Jr.vnode(n), _b(r.__P, n, i, r.__n, r.__P.namespaceURI, 32 & i.__u ? [s] : null, o, s ?? Pu(i), !!(32 & i.__u), a), n.__v = i.__v, n.__.__k[n.__i] = n, sS(o, n, a), n.__e != s && rS(n)), tc.length > e && tc.sort(B1)); d0.__r = 0; } -function sS(t, e, r, n, i, s, o, a, u, l, d) { - var p, w, A, P, N, L, $ = n && n.__k || nS, B = e.length; - for (u = kY(r, e, $, u), p = 0; p < B; p++) (A = r.__k[p]) != null && (w = A.__i === -1 ? Pl : $[A.__i] || Pl, A.__i = p, L = _b(t, A, w, i, s, o, a, u, l, d), P = A.__e, A.ref && w.ref != A.ref && (w.ref && Eb(w.ref, null, A), d.push(A.ref, A.__c || P, A)), N == null && P != null && (N = P), 4 & A.__u || w.__k === A.__k ? u = oS(A, u, t) : typeof A.type == "function" && L !== void 0 ? u = L : P && (u = P.nextSibling), A.__u &= -7); +function nS(t, e, r, n, i, s, o, a, u, l, d) { + var p, w, A, M, N, L, B = n && n.__k || tS, $ = e.length; + for (u = $Y(r, e, B, u), p = 0; p < $; p++) (A = r.__k[p]) != null && (w = A.__i === -1 ? Pl : B[A.__i] || Pl, A.__i = p, L = _b(t, A, w, i, s, o, a, u, l, d), M = A.__e, A.ref && w.ref != A.ref && (w.ref && Eb(w.ref, null, A), d.push(A.ref, A.__c || M, A)), N == null && M != null && (N = M), 4 & A.__u || w.__k === A.__k ? u = iS(A, u, t) : typeof A.type == "function" && L !== void 0 ? u = L : M && (u = M.nextSibling), A.__u &= -7); return r.__e = N, u; } -function kY(t, e, r, n) { +function $Y(t, e, r, n) { var i, s, o, a, u, l = e.length, d = r.length, p = d, w = 0; - for (t.__k = [], i = 0; i < l; i++) (s = e[i]) != null && typeof s != "boolean" && typeof s != "function" ? (a = i + w, (s = t.__k[i] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Od(null, s, null, null, null) : wb(s) ? Od(ih, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? Od(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, o = null, (u = s.__i = $Y(s, r, a, p)) !== -1 && (p--, (o = r[u]) && (o.__u |= 2)), o == null || o.__v === null ? (u == -1 && w--, typeof s.type != "function" && (s.__u |= 4)) : u !== a && (u == a - 1 ? w-- : u == a + 1 ? w++ : (u > a ? w-- : w++, s.__u |= 4))) : s = t.__k[i] = null; - if (p) for (i = 0; i < d; i++) (o = r[i]) != null && !(2 & o.__u) && (o.__e == n && (n = Pu(o)), cS(o, o)); + for (t.__k = [], i = 0; i < l; i++) (s = e[i]) != null && typeof s != "boolean" && typeof s != "function" ? (a = i + w, (s = t.__k[i] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Od(null, s, null, null, null) : wb(s) ? Od(ih, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? Od(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, o = null, (u = s.__i = BY(s, r, a, p)) !== -1 && (p--, (o = r[u]) && (o.__u |= 2)), o == null || o.__v === null ? (u == -1 && w--, typeof s.type != "function" && (s.__u |= 4)) : u !== a && (u == a - 1 ? w-- : u == a + 1 ? w++ : (u > a ? w-- : w++, s.__u |= 4))) : s = t.__k[i] = null; + if (p) for (i = 0; i < d; i++) (o = r[i]) != null && !(2 & o.__u) && (o.__e == n && (n = Pu(o)), oS(o, o)); return n; } -function oS(t, e, r) { +function iS(t, e, r) { var n, i; if (typeof t.type == "function") { - for (n = t.__k, i = 0; n && i < n.length; i++) n[i] && (n[i].__ = t, e = oS(n[i], e, r)); + for (n = t.__k, i = 0; n && i < n.length; i++) n[i] && (n[i].__ = t, e = iS(n[i], e, r)); return e; } t.__e != e && (e && t.type && !r.contains(e) && (e = Pu(t)), r.insertBefore(t.__e, e || null), e = t.__e); @@ -27632,7 +27632,7 @@ function oS(t, e, r) { while (e != null && e.nodeType === 8); return e; } -function $Y(t, e, r, n) { +function BY(t, e, r, n) { var i = t.key, s = t.type, o = r - 1, a = r + 1, u = e[r]; if (u === null || u && i == u.key && s === u.type && !(2 & u.__u)) return r; if ((typeof s != "function" || s === ih || i) && n > (u != null && !(2 & u.__u) ? 1 : 0)) for (; o >= 0 || a < e.length; ) { @@ -27647,17 +27647,17 @@ function $Y(t, e, r, n) { } return -1; } -function m6(t, e, r) { - e[0] === "-" ? t.setProperty(e, r ?? "") : t[e] = r == null ? "" : typeof r != "number" || LY.test(e) ? r : r + "px"; +function p6(t, e, r) { + e[0] === "-" ? t.setProperty(e, r ?? "") : t[e] = r == null ? "" : typeof r != "number" || kY.test(e) ? r : r + "px"; } function pd(t, e, r, n, i) { var s; e: if (e === "style") if (typeof r == "string") t.style.cssText = r; else { - if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || m6(t.style, e, ""); - if (r) for (e in r) n && r[e] === n[e] || m6(t.style, e, r[e]); + if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || p6(t.style, e, ""); + if (r) for (e in r) n && r[e] === n[e] || p6(t.style, e, r[e]); } - else if (e[0] === "o" && e[1] === "n") s = e !== (e = e.replace(rS, "$1")), e = e.toLowerCase() in t || e === "onFocusOut" || e === "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = yb, t.addEventListener(e, s ? j1 : F1, s)) : t.removeEventListener(e, s ? j1 : F1, s); + else if (e[0] === "o" && e[1] === "n") s = e !== (e = e.replace(eS, "$1")), e = e.toLowerCase() in t || e === "onFocusOut" || e === "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = yb, t.addEventListener(e, s ? j1 : F1, s)) : t.removeEventListener(e, s ? j1 : F1, s); else { if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try { @@ -27668,7 +27668,7 @@ function pd(t, e, r, n, i) { typeof r == "function" || (r == null || r === !1 && e[4] !== "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && r == 1 ? "" : r)); } } -function v6(t) { +function g6(t) { return function(e) { if (this.l) { var r = this.l[e.type + t]; @@ -27679,30 +27679,30 @@ function v6(t) { }; } function _b(t, e, r, n, i, s, o, a, u, l) { - var d, p, w, A, P, N, L, $, B, H, W, V, te, R, K, ge, Ee, Y = e.type; + var d, p, w, A, M, N, L, B, $, H, W, V, te, R, K, ge, Ee, Y = e.type; if (e.constructor !== void 0) return null; 128 & r.__u && (u = !!(32 & r.__u), s = [a = e.__e = r.__e]), (d = Jr.__b) && d(e); e: if (typeof Y == "function") try { - if ($ = e.props, B = "prototype" in Y && Y.prototype.render, H = (d = Y.contextType) && n[d.__c], W = d ? H ? H.props.value : d.__ : n, r.__c ? L = (p = e.__c = r.__c).__ = p.__E : (B ? e.__c = p = new Y($, W) : (e.__c = p = new Nd($, W), p.constructor = Y, p.render = FY), H && H.sub(p), p.props = $, p.state || (p.state = {}), p.context = W, p.__n = n, w = p.__d = !0, p.__h = [], p._sb = []), B && p.__s == null && (p.__s = p.state), B && Y.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = va({}, p.__s)), va(p.__s, Y.getDerivedStateFromProps($, p.__s))), A = p.props, P = p.state, p.__v = e, w) B && Y.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), B && p.componentDidMount != null && p.__h.push(p.componentDidMount); + if (B = e.props, $ = "prototype" in Y && Y.prototype.render, H = (d = Y.contextType) && n[d.__c], W = d ? H ? H.props.value : d.__ : n, r.__c ? L = (p = e.__c = r.__c).__ = p.__E : ($ ? e.__c = p = new Y(B, W) : (e.__c = p = new Nd(B, W), p.constructor = Y, p.render = jY), H && H.sub(p), p.props = B, p.state || (p.state = {}), p.context = W, p.__n = n, w = p.__d = !0, p.__h = [], p._sb = []), $ && p.__s == null && (p.__s = p.state), $ && Y.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = ga({}, p.__s)), ga(p.__s, Y.getDerivedStateFromProps(B, p.__s))), A = p.props, M = p.state, p.__v = e, w) $ && Y.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), $ && p.componentDidMount != null && p.__h.push(p.componentDidMount); else { - if (B && Y.getDerivedStateFromProps == null && $ !== A && p.componentWillReceiveProps != null && p.componentWillReceiveProps($, W), !p.__e && (p.shouldComponentUpdate != null && p.shouldComponentUpdate($, p.__s, W) === !1 || e.__v === r.__v)) { - for (e.__v !== r.__v && (p.props = $, p.state = p.__s, p.__d = !1), e.__e = r.__e, e.__k = r.__k, e.__k.some(function(S) { + if ($ && Y.getDerivedStateFromProps == null && B !== A && p.componentWillReceiveProps != null && p.componentWillReceiveProps(B, W), !p.__e && (p.shouldComponentUpdate != null && p.shouldComponentUpdate(B, p.__s, W) === !1 || e.__v === r.__v)) { + for (e.__v !== r.__v && (p.props = B, p.state = p.__s, p.__d = !1), e.__e = r.__e, e.__k = r.__k, e.__k.some(function(S) { S && (S.__ = e); }), V = 0; V < p._sb.length; V++) p.__h.push(p._sb[V]); p._sb = [], p.__h.length && o.push(p); break e; } - p.componentWillUpdate != null && p.componentWillUpdate($, p.__s, W), B && p.componentDidUpdate != null && p.__h.push(function() { - p.componentDidUpdate(A, P, N); + p.componentWillUpdate != null && p.componentWillUpdate(B, p.__s, W), $ && p.componentDidUpdate != null && p.__h.push(function() { + p.componentDidUpdate(A, M, N); }); } - if (p.context = W, p.props = $, p.__P = t, p.__e = !1, te = Jr.__r, R = 0, B) { + if (p.context = W, p.props = B, p.__P = t, p.__e = !1, te = Jr.__r, R = 0, $) { for (p.state = p.__s, p.__d = !1, te && te(e), d = p.render(p.props, p.state, p.context), K = 0; K < p._sb.length; K++) p.__h.push(p._sb[K]); p._sb = []; } else do p.__d = !1, te && te(e), d = p.render(p.props, p.state, p.context), p.state = p.__s; while (p.__d && ++R < 25); - p.state = p.__s, p.getChildContext != null && (n = va(va({}, n), p.getChildContext())), B && !w && p.getSnapshotBeforeUpdate != null && (N = p.getSnapshotBeforeUpdate(A, P)), a = sS(t, wb(ge = d != null && d.type === ih && d.key == null ? d.props.children : d) ? ge : [ge], e, r, n, i, s, o, a, u, l), p.base = e.__e, e.__u &= -161, p.__h.length && o.push(p), L && (p.__E = p.__ = null); + p.state = p.__s, p.getChildContext != null && (n = ga(ga({}, n), p.getChildContext())), $ && !w && p.getSnapshotBeforeUpdate != null && (N = p.getSnapshotBeforeUpdate(A, M)), a = nS(t, wb(ge = d != null && d.type === ih && d.key == null ? d.props.children : d) ? ge : [ge], e, r, n, i, s, o, a, u, l), p.base = e.__e, e.__u &= -161, p.__h.length && o.push(p), L && (p.__E = p.__ = null); } catch (S) { if (e.__v = null, u || s != null) if (S.then) { for (e.__u |= u ? 160 : 128; a && a.nodeType === 8 && a.nextSibling; ) a = a.nextSibling; @@ -27711,10 +27711,10 @@ function _b(t, e, r, n, i, s, o, a, u, l) { else e.__e = r.__e, e.__k = r.__k; Jr.__e(S, e, r); } - else s == null && e.__v === r.__v ? (e.__k = r.__k, e.__e = r.__e) : a = e.__e = BY(r.__e, e, r, n, i, s, o, u, l); + else s == null && e.__v === r.__v ? (e.__k = r.__k, e.__e = r.__e) : a = e.__e = FY(r.__e, e, r, n, i, s, o, u, l); return (d = Jr.diffed) && d(e), 128 & e.__u ? void 0 : a; } -function aS(t, e, r) { +function sS(t, e, r) { for (var n = 0; n < r.length; n++) Eb(r[n], r[++n], r[++n]); Jr.__c && Jr.__c(e, t), t.some(function(i) { try { @@ -27726,32 +27726,32 @@ function aS(t, e, r) { } }); } -function BY(t, e, r, n, i, s, o, a, u) { - var l, d, p, w, A, P, N, L = r.props, $ = e.props, B = e.type; - if (B === "svg" ? i = "http://www.w3.org/2000/svg" : B === "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) { - for (l = 0; l < s.length; l++) if ((A = s[l]) && "setAttribute" in A == !!B && (B ? A.localName === B : A.nodeType === 3)) { +function FY(t, e, r, n, i, s, o, a, u) { + var l, d, p, w, A, M, N, L = r.props, B = e.props, $ = e.type; + if ($ === "svg" ? i = "http://www.w3.org/2000/svg" : $ === "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) { + for (l = 0; l < s.length; l++) if ((A = s[l]) && "setAttribute" in A == !!$ && ($ ? A.localName === $ : A.nodeType === 3)) { t = A, s[l] = null; break; } } if (t == null) { - if (B === null) return document.createTextNode($); - t = document.createElementNS(i, B, $.is && $), a && (Jr.__m && Jr.__m(e, s), a = !1), s = null; + if ($ === null) return document.createTextNode(B); + t = document.createElementNS(i, $, B.is && B), a && (Jr.__m && Jr.__m(e, s), a = !1), s = null; } - if (B === null) L === $ || a && t.data === $ || (t.data = $); + if ($ === null) L === B || a && t.data === B || (t.data = B); else { if (s = s && up.call(t.childNodes), L = r.props || Pl, !a && s != null) for (L = {}, l = 0; l < t.attributes.length; l++) L[(A = t.attributes[l]).name] = A.value; for (l in L) if (A = L[l], l != "children") { if (l == "dangerouslySetInnerHTML") p = A; - else if (!(l in $)) { - if (l == "value" && "defaultValue" in $ || l == "checked" && "defaultChecked" in $) continue; + else if (!(l in B)) { + if (l == "value" && "defaultValue" in B || l == "checked" && "defaultChecked" in B) continue; pd(t, l, null, A, i); } } - for (l in $) A = $[l], l == "children" ? w = A : l == "dangerouslySetInnerHTML" ? d = A : l == "value" ? P = A : l == "checked" ? N = A : a && typeof A != "function" || L[l] === A || pd(t, l, A, L[l], i); + for (l in B) A = B[l], l == "children" ? w = A : l == "dangerouslySetInnerHTML" ? d = A : l == "value" ? M = A : l == "checked" ? N = A : a && typeof A != "function" || L[l] === A || pd(t, l, A, L[l], i); if (d) a || p && (d.__html === p.__html || d.__html === t.innerHTML) || (t.innerHTML = d.__html), e.__k = []; - else if (p && (t.innerHTML = ""), sS(t, wb(w) ? w : [w], e, r, n, B === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && Pu(r, 0), a, u), s != null) for (l = s.length; l--; ) xb(s[l]); - a || (l = "value", B === "progress" && P == null ? t.removeAttribute("value") : P !== void 0 && (P !== t[l] || B === "progress" && !P || B === "option" && P !== L[l]) && pd(t, l, P, L[l], i), l = "checked", N !== void 0 && N !== t[l] && pd(t, l, N, L[l], i)); + else if (p && (t.innerHTML = ""), nS(t, wb(w) ? w : [w], e, r, n, $ === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && Pu(r, 0), a, u), s != null) for (l = s.length; l--; ) xb(s[l]); + a || (l = "value", $ === "progress" && M == null ? t.removeAttribute("value") : M !== void 0 && (M !== t[l] || $ === "progress" && !M || $ === "option" && M !== L[l]) && pd(t, l, M, L[l], i), l = "checked", N !== void 0 && N !== t[l] && pd(t, l, N, L[l], i)); } return t; } @@ -27765,7 +27765,7 @@ function Eb(t, e, r) { Jr.__e(i, r); } } -function cS(t, e, r) { +function oS(t, e, r) { var n, i; if (Jr.unmount && Jr.unmount(t), (n = t.ref) && (n.current && n.current !== t.__e || Eb(n, null, e)), (n = t.__c) != null) { if (n.componentWillUnmount) try { @@ -27775,43 +27775,43 @@ function cS(t, e, r) { } n.base = n.__P = null; } - if (n = t.__k) for (i = 0; i < n.length; i++) n[i] && cS(n[i], e, r || typeof t.type != "function"); + if (n = t.__k) for (i = 0; i < n.length; i++) n[i] && oS(n[i], e, r || typeof t.type != "function"); r || xb(t.__e), t.__c = t.__ = t.__e = void 0; } -function FY(t, e, r) { +function jY(t, e, r) { return this.constructor(t, r); } function U1(t, e, r) { var n, i, s, o; - e === document && (e = document.documentElement), Jr.__ && Jr.__(t, e), i = (n = typeof r == "function") ? null : e.__k, s = [], o = [], _b(e, t = (!n && r || e).__k = Nr(ih, null, [t]), i || Pl, Pl, e.namespaceURI, !n && r ? [r] : i ? null : e.firstChild ? up.call(e.childNodes) : null, s, !n && r ? r : i ? i.__e : e.firstChild, n, o), aS(s, t, o); + e === document && (e = document.documentElement), Jr.__ && Jr.__(t, e), i = (n = typeof r == "function") ? null : e.__k, s = [], o = [], _b(e, t = (!n && r || e).__k = Nr(ih, null, [t]), i || Pl, Pl, e.namespaceURI, !n && r ? [r] : i ? null : e.firstChild ? up.call(e.childNodes) : null, s, !n && r ? r : i ? i.__e : e.firstChild, n, o), sS(s, t, o); } -up = nS.slice, Jr = { __e: function(t, e, r, n) { +up = tS.slice, Jr = { __e: function(t, e, r, n) { for (var i, s, o; e = e.__; ) if ((i = e.__c) && !i.__) try { if ((s = i.constructor) && s.getDerivedStateFromError != null && (i.setState(s.getDerivedStateFromError(t)), o = i.__d), i.componentDidCatch != null && (i.componentDidCatch(t, n || {}), o = i.__d), o) return i.__E = i; } catch (a) { t = a; } throw t; -} }, eS = 0, Nd.prototype.setState = function(t, e) { +} }, ZE = 0, Nd.prototype.setState = function(t, e) { var r; - r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = va({}, this.state), typeof t == "function" && (t = t(va({}, r), this.props)), t && va(r, t), t != null && this.__v && (e && this._sb.push(e), g6(this)); + r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = ga({}, this.state), typeof t == "function" && (t = t(ga({}, r), this.props)), t && ga(r, t), t != null && this.__v && (e && this._sb.push(e), d6(this)); }, Nd.prototype.forceUpdate = function(t) { - this.__v && (this.__e = !0, t && this.__h.push(t), g6(this)); -}, Nd.prototype.render = ih, rc = [], tS = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, B1 = function(t, e) { + this.__v && (this.__e = !0, t && this.__h.push(t), d6(this)); +}, Nd.prototype.render = ih, tc = [], QE = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, B1 = function(t, e) { return t.__v.__b - e.__v.__b; -}, d0.__r = 0, rS = /(PointerCapture)$|Capture$/i, yb = 0, F1 = v6(!1), j1 = v6(!0); -var p0, pn, Mm, b6, q1 = 0, uS = [], yn = Jr, y6 = yn.__b, w6 = yn.__r, x6 = yn.diffed, _6 = yn.__c, E6 = yn.unmount, S6 = yn.__; -function fS(t, e) { +}, d0.__r = 0, eS = /(PointerCapture)$|Capture$/i, yb = 0, F1 = g6(!1), j1 = g6(!0); +var p0, pn, Mm, m6, q1 = 0, aS = [], yn = Jr, v6 = yn.__b, b6 = yn.__r, y6 = yn.diffed, w6 = yn.__c, x6 = yn.unmount, _6 = yn.__; +function cS(t, e) { yn.__h && yn.__h(pn, t, q1 || e), q1 = 0; var r = pn.__H || (pn.__H = { __: [], __h: [] }); return t >= r.__.length && r.__.push({}), r.__[t]; } -function A6(t) { - return q1 = 1, jY(lS, t); +function E6(t) { + return q1 = 1, UY(uS, t); } -function jY(t, e, r) { - var n = fS(p0++, 2); - if (n.t = t, !n.__c && (n.__ = [lS(void 0, e), function(a) { +function UY(t, e, r) { + var n = cS(p0++, 2); + if (n.t = t, !n.__c && (n.__ = [uS(void 0, e), function(a) { var u = n.__N ? n.__N[0] : n.__[0], l = n.t(u, a); u !== l && (n.__N = [l, n.__[1]], n.__c.setState({})); }], n.__c = pn, !pn.u)) { @@ -27843,31 +27843,31 @@ function jY(t, e, r) { } return n.__N || n.__; } -function UY(t, e) { - var r = fS(p0++, 3); - !yn.__s && WY(r.__H, e) && (r.__ = t, r.i = e, pn.__H.__h.push(r)); +function qY(t, e) { + var r = cS(p0++, 3); + !yn.__s && HY(r.__H, e) && (r.__ = t, r.i = e, pn.__H.__h.push(r)); } -function qY() { - for (var t; t = uS.shift(); ) if (t.__P && t.__H) try { +function zY() { + for (var t; t = aS.shift(); ) if (t.__P && t.__H) try { t.__H.__h.forEach(Ld), t.__H.__h.forEach(z1), t.__H.__h = []; } catch (e) { t.__H.__h = [], yn.__e(e, t.__v); } } yn.__b = function(t) { - pn = null, y6 && y6(t); + pn = null, v6 && v6(t); }, yn.__ = function(t, e) { - t && e.__k && e.__k.__m && (t.__m = e.__k.__m), S6 && S6(t, e); + t && e.__k && e.__k.__m && (t.__m = e.__k.__m), _6 && _6(t, e); }, yn.__r = function(t) { - w6 && w6(t), p0 = 0; + b6 && b6(t), p0 = 0; var e = (pn = t.__c).__H; e && (Mm === pn ? (e.__h = [], pn.__h = [], e.__.forEach(function(r) { r.__N && (r.__ = r.__N), r.i = r.__N = void 0; })) : (e.__h.forEach(Ld), e.__h.forEach(z1), e.__h = [], p0 = 0)), Mm = pn; }, yn.diffed = function(t) { - x6 && x6(t); + y6 && y6(t); var e = t.__c; - e && e.__H && (e.__H.__h.length && (uS.push(e) !== 1 && b6 === yn.requestAnimationFrame || ((b6 = yn.requestAnimationFrame) || zY)(qY)), e.__H.__.forEach(function(r) { + e && e.__H && (e.__H.__h.length && (aS.push(e) !== 1 && m6 === yn.requestAnimationFrame || ((m6 = yn.requestAnimationFrame) || WY)(zY)), e.__H.__.forEach(function(r) { r.i && (r.__H = r.i), r.i = void 0; })), Mm = pn = null; }, yn.__c = function(t, e) { @@ -27881,9 +27881,9 @@ yn.__b = function(t) { i.__h && (i.__h = []); }), e = [], yn.__e(n, r.__v); } - }), _6 && _6(t, e); + }), w6 && w6(t, e); }, yn.unmount = function(t) { - E6 && E6(t); + x6 && x6(t); var e, r = t.__c; r && r.__H && (r.__H.__.forEach(function(n) { try { @@ -27893,12 +27893,12 @@ yn.__b = function(t) { } }), r.__H = void 0, e && yn.__e(e, r.__v)); }; -var P6 = typeof requestAnimationFrame == "function"; -function zY(t) { +var S6 = typeof requestAnimationFrame == "function"; +function WY(t) { var e, r = function() { - clearTimeout(n), P6 && cancelAnimationFrame(e), setTimeout(t); + clearTimeout(n), S6 && cancelAnimationFrame(e), setTimeout(t); }, n = setTimeout(r, 100); - P6 && (e = requestAnimationFrame(r)); + S6 && (e = requestAnimationFrame(r)); } function Ld(t) { var e = pn, r = t.__c; @@ -27908,18 +27908,18 @@ function z1(t) { var e = pn; t.__c = t.__(), pn = e; } -function WY(t, e) { +function HY(t, e) { return !t || t.length !== e.length || e.some(function(r, n) { return r !== t[n]; }); } -function lS(t, e) { +function uS(t, e) { return typeof e == "function" ? e(t) : e; } -const HY = ".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}", KY = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+", VY = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4="; -class GY { +const KY = ".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}", VY = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+", GY = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4="; +class YY { constructor() { - this.items = /* @__PURE__ */ new Map(), this.nextItemKey = 0, this.root = null, this.darkMode = XE(); + this.items = /* @__PURE__ */ new Map(), this.nextItemKey = 0, this.root = null, this.darkMode = YE(); } attach(e) { this.root = document.createElement("div"), this.root.className = "-cbwsdk-snackbar-root", e.appendChild(this.root), this.render(); @@ -27937,18 +27937,18 @@ class GY { this.root && U1(Nr( "div", null, - Nr(hS, { darkMode: this.darkMode }, Array.from(this.items.entries()).map(([e, r]) => Nr(YY, Object.assign({}, r, { key: e })))) + Nr(fS, { darkMode: this.darkMode }, Array.from(this.items.entries()).map(([e, r]) => Nr(JY, Object.assign({}, r, { key: e })))) ), this.root); } } -const hS = (t) => Nr( +const fS = (t) => Nr( "div", { class: Gf("-cbwsdk-snackbar-container") }, - Nr("style", null, HY), + Nr("style", null, KY), Nr("div", { class: "-cbwsdk-snackbar" }, t.children) -), YY = ({ autoExpand: t, message: e, menuItems: r }) => { - const [n, i] = A6(!0), [s, o] = A6(t ?? !1); - UY(() => { +), JY = ({ autoExpand: t, message: e, menuItems: r }) => { + const [n, i] = E6(!0), [s, o] = E6(t ?? !1); + qY(() => { const u = [ window.setTimeout(() => { i(!1); @@ -27970,7 +27970,7 @@ const hS = (t) => Nr( Nr( "div", { class: "-cbwsdk-snackbar-instance-header", onClick: a }, - Nr("img", { src: KY, class: "-cbwsdk-snackbar-instance-header-cblogo" }), + Nr("img", { src: VY, class: "-cbwsdk-snackbar-instance-header-cblogo" }), " ", Nr("div", { class: "-cbwsdk-snackbar-instance-header-message" }, e), Nr( @@ -27981,7 +27981,7 @@ const hS = (t) => Nr( { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, Nr("circle", { cx: "12", cy: "12", r: "12", fill: "#F5F7F8" }) ), - Nr("img", { src: VY, class: "-gear-icon", title: "Expand" }) + Nr("img", { src: GY, class: "-gear-icon", title: "Expand" }) ) ), r && r.length > 0 && Nr("div", { class: "-cbwsdk-snackbar-instance-menu" }, r.map((u, l) => Nr( @@ -27996,15 +27996,15 @@ const hS = (t) => Nr( ))) ); }; -class JY { +class XY { constructor() { - this.attached = !1, this.snackbar = new GY(); + this.attached = !1, this.snackbar = new YY(); } attach() { if (this.attached) throw new Error("Coinbase Wallet SDK UI is already attached"); const e = document.documentElement, r = document.createElement("div"); - r.className = "-cbwsdk-css-reset", e.appendChild(r), this.snackbar.attach(r), this.attached = !0, ZE(); + r.className = "-cbwsdk-css-reset", e.appendChild(r), this.snackbar.attach(r), this.attached = !0, JE(); } showConnecting(e) { let r; @@ -28050,14 +28050,14 @@ class JY { }, this.snackbar.presentItem(r); } } -const XY = ".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}"; -class ZY { +const ZY = ".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}"; +class QY { constructor() { - this.root = null, this.darkMode = XE(); + this.root = null, this.darkMode = YE(); } attach() { const e = document.documentElement; - this.root = document.createElement("div"), this.root.className = "-cbwsdk-css-reset", e.appendChild(this.root), ZE(); + this.root = document.createElement("div"), this.root.className = "-cbwsdk-css-reset", e.appendChild(this.root), JE(); } present(e) { this.render(e); @@ -28066,20 +28066,20 @@ class ZY { this.render(null); } render(e) { - this.root && (U1(null, this.root), e && U1(Nr(QY, Object.assign({}, e, { onDismiss: () => { + this.root && (U1(null, this.root), e && U1(Nr(eJ, Object.assign({}, e, { onDismiss: () => { this.clear(); }, darkMode: this.darkMode })), this.root)); } } -const QY = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: i }) => { +const eJ = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: i }) => { const s = r ? "dark" : "light"; return Nr( - hS, + fS, { darkMode: r }, Nr( "div", { class: "-cbwsdk-redirect-dialog" }, - Nr("style", null, XY), + Nr("style", null, ZY), Nr("div", { class: "-cbwsdk-redirect-dialog-backdrop", onClick: i }), Nr( "div", @@ -28089,10 +28089,10 @@ const QY = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: ) ) ); -}, eJ = "https://keys.coinbase.com/connect", M6 = "https://www.walletlink.org", tJ = "https://go.cb-w.com/walletlink"; -class I6 { +}, tJ = "https://keys.coinbase.com/connect", A6 = "https://www.walletlink.org", rJ = "https://go.cb-w.com/walletlink"; +class P6 { constructor() { - this.attached = !1, this.redirectDialog = new ZY(); + this.attached = !1, this.redirectDialog = new QY(); } attach() { if (this.attached) @@ -28100,8 +28100,8 @@ class I6 { this.redirectDialog.attach(), this.attached = !0; } redirectToCoinbaseWallet(e) { - const r = new URL(tJ); - r.searchParams.append("redirect_url", DY().href), e && r.searchParams.append("wl_url", e); + const r = new URL(rJ); + r.searchParams.append("redirect_url", OY().href), e && r.searchParams.append("wl_url", e); const n = document.createElement("a"); n.target = "cbw-opener", n.href = r.href, n.rel = "noreferrer noopener", n.click(); } @@ -28122,9 +28122,9 @@ class I6 { }; } } -class Ao { +class Eo { constructor(e) { - this.chainCallbackParams = { chainId: "", jsonRpcUrl: "" }, this.isMobileWeb = OY(), this.linkedUpdated = (s) => { + this.chainCallbackParams = { chainId: "", jsonRpcUrl: "" }, this.isMobileWeb = NY(), this.linkedUpdated = (s) => { this.isLinked = s; const o = this.storage.getItem($1); if (s && (this._session.linked = s), this.isUnlinkedErrorState = !1, o) { @@ -28139,28 +28139,28 @@ class Ao { jsonRpcUrl: o }, this.chainCallback && this.chainCallback(o, Number.parseInt(s, 10))); }, this.accountUpdated = (s) => { - this.accountsCallback && this.accountsCallback([s]), Ao.accountRequestCallbackIds.size > 0 && (Array.from(Ao.accountRequestCallbackIds.values()).forEach((o) => { + this.accountsCallback && this.accountsCallback([s]), Eo.accountRequestCallbackIds.size > 0 && (Array.from(Eo.accountRequestCallbackIds.values()).forEach((o) => { this.invokeCallback(o, { method: "requestEthereumAccounts", result: [s] }); - }), Ao.accountRequestCallbackIds.clear()); + }), Eo.accountRequestCallbackIds.clear()); }, this.resetAndReload = this.resetAndReload.bind(this), this.linkAPIUrl = e.linkAPIUrl, this.storage = e.storage, this.metadata = e.metadata, this.accountsCallback = e.accountsCallback, this.chainCallback = e.chainCallback; const { session: r, ui: n, connection: i } = this.subscribe(); - this._session = r, this.connection = i, this.relayEventManager = new TY(), this.ui = n, this.ui.attach(); + this._session = r, this.connection = i, this.relayEventManager = new RY(), this.ui = n, this.ui.attach(); } subscribe() { - const e = gu.load(this.storage) || gu.create(this.storage), { linkAPIUrl: r } = this, n = new CY({ + const e = gu.load(this.storage) || gu.create(this.storage), { linkAPIUrl: r } = this, n = new TY({ session: e, linkAPIUrl: r, listener: this - }), i = this.isMobileWeb ? new I6() : new JY(); + }), i = this.isMobileWeb ? new P6() : new XY(); return n.connect(), { session: e, ui: i, connection: n }; } resetAndReload() { this.connection.destroy().then(() => { const e = gu.load(this.storage); - (e == null ? void 0 : e.id) === this._session.id && to.clearAll(), document.location.reload(); + (e == null ? void 0 : e.id) === this._session.id && eo.clearAll(), document.location.reload(); }).catch((e) => { }); } @@ -28214,7 +28214,7 @@ class Ao { } sendRequest(e) { let r = null; - const n = ec(8), i = (s) => { + const n = Qa(8), i = (s) => { this.publishWeb3RequestCanceledEvent(n), this.handleErrorResponse(n, e.method, s), r == null || r(); }; return new Promise((s, o) => { @@ -28242,7 +28242,7 @@ class Ao { } // copied from MobileRelay openCoinbaseWalletDeeplink(e) { - if (this.ui instanceof I6) + if (this.ui instanceof P6) switch (e) { case "requestEthereumAccounts": case "switchEthereumChain": @@ -28268,7 +28268,7 @@ class Ao { } handleWeb3ResponseMessage(e, r) { if (r.method === "requestEthereumAccounts") { - Ao.accountRequestCallbackIds.forEach((n) => this.invokeCallback(n, r)), Ao.accountRequestCallbackIds.clear(); + Eo.accountRequestCallbackIds.forEach((n) => this.invokeCallback(n, r)), Eo.accountRequestCallbackIds.clear(); return; } this.invokeCallback(e, r); @@ -28292,13 +28292,13 @@ class Ao { appName: e, appLogoUrl: r } - }, i = ec(8); + }, i = Qa(8); return new Promise((s, o) => { this.relayEventManager.callbacks.set(i, (a) => { if (jn(a)) return o(new Error(a.errorMessage)); s(a); - }), Ao.accountRequestCallbackIds.add(i), this.publishWeb3RequestEvent(i, n); + }), Eo.accountRequestCallbackIds.add(i), this.publishWeb3RequestEvent(i, n); }); } watchAsset(e, r, n, i, s, o) { @@ -28316,7 +28316,7 @@ class Ao { } }; let u = null; - const l = ec(8), d = (p) => { + const l = Qa(8), d = (p) => { this.publishWeb3RequestCanceledEvent(l), this.handleErrorResponse(l, a.method, p), u == null || u(); }; return u = this.ui.showConnecting({ @@ -28345,7 +28345,7 @@ class Ao { } }; let u = null; - const l = ec(8), d = (p) => { + const l = Qa(8), d = (p) => { this.publishWeb3RequestCanceledEvent(l), this.handleErrorResponse(l, a.method, p), u == null || u(); }; return u = this.ui.showConnecting({ @@ -28367,7 +28367,7 @@ class Ao { params: Object.assign({ chainId: e }, { address: r }) }; let i = null; - const s = ec(8), o = (a) => { + const s = Qa(8), o = (a) => { this.publishWeb3RequestCanceledEvent(s), this.handleErrorResponse(s, n.method, a), i == null || i(); }; return i = this.ui.showConnecting({ @@ -28389,15 +28389,15 @@ class Ao { }); } } -Ao.accountRequestCallbackIds = /* @__PURE__ */ new Set(); -const C6 = "DefaultChainId", T6 = "DefaultJsonRpcUrl"; -class dS { +Eo.accountRequestCallbackIds = /* @__PURE__ */ new Set(); +const M6 = "DefaultChainId", I6 = "DefaultJsonRpcUrl"; +class lS { constructor(e) { - this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new to("walletlink", M6), this.callback = e.callback || null; + this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new eo("walletlink", A6), this.callback = e.callback || null; const r = this._storage.getItem($1); if (r) { const n = r.split(" "); - n[0] !== "" && (this._addresses = n.map((i) => ia(i))); + n[0] !== "" && (this._addresses = n.map((i) => ra(i))); } this.initializeRelay(); } @@ -28413,16 +28413,16 @@ class dS { } get jsonRpcUrl() { var e; - return (e = this._storage.getItem(T6)) !== null && e !== void 0 ? e : void 0; + return (e = this._storage.getItem(I6)) !== null && e !== void 0 ? e : void 0; } set jsonRpcUrl(e) { - this._storage.setItem(T6, e); + this._storage.setItem(I6, e); } updateProviderInfo(e, r) { var n; this.jsonRpcUrl = e; const i = this.getChainId(); - this._storage.setItem(C6, r.toString(10)), Kf(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", ma(r))); + this._storage.setItem(M6, r.toString(10)), Kf(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(r))); } async watchAsset(e) { const r = Array.isArray(e) ? e[0] : e; @@ -28470,7 +28470,7 @@ class dS { var n; if (!Array.isArray(e)) throw new Error("addresses is not an array"); - const i = e.map((s) => ia(s)); + const i = e.map((s) => ra(s)); JSON.stringify(i) !== JSON.stringify(this._addresses) && (this._addresses = i, (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", i), this._storage.setItem($1, i.join(" "))); } async request(e) { @@ -28483,7 +28483,7 @@ class dS { case "net_version": return this.getChainId().toString(10); case "eth_chainId": - return ma(this.getChainId()); + return pa(this.getChainId()); case "eth_requestAccounts": return this._eth_requestAccounts(); case "eth_ecRecover": @@ -28511,20 +28511,20 @@ class dS { default: if (!this.jsonRpcUrl) throw Sr.rpc.internal("No RPC URL set for chain"); - return jE(e, this.jsonRpcUrl); + return BE(e, this.jsonRpcUrl); } } _ensureKnownAddress(e) { - const r = ia(e); - if (!this._addresses.map((i) => ia(i)).includes(r)) + const r = ra(e); + if (!this._addresses.map((i) => ra(i)).includes(r)) throw new Error("Unknown Ethereum address"); } _prepareTransactionParams(e) { - const r = e.from ? ia(e.from) : this.selectedAddress; + const r = e.from ? ra(e.from) : this.selectedAddress; if (!r) throw new Error("Ethereum address is unavailable"); this._ensureKnownAddress(r); - const n = e.to ? ia(e.to) : null, i = e.value != null ? Rf(e.value) : BigInt(0), s = e.data ? k1(e.data) : Buffer.alloc(0), o = e.nonce != null ? Kf(e.nonce) : null, a = e.gasPrice != null ? Rf(e.gasPrice) : null, u = e.maxFeePerGas != null ? Rf(e.maxFeePerGas) : null, l = e.maxPriorityFeePerGas != null ? Rf(e.maxPriorityFeePerGas) : null, d = e.gas != null ? Rf(e.gas) : null, p = e.chainId ? Kf(e.chainId) : this.getChainId(); + const n = e.to ? ra(e.to) : null, i = e.value != null ? Rf(e.value) : BigInt(0), s = e.data ? k1(e.data) : Buffer.alloc(0), o = e.nonce != null ? Kf(e.nonce) : null, a = e.gasPrice != null ? Rf(e.gasPrice) : null, u = e.maxFeePerGas != null ? Rf(e.maxFeePerGas) : null, l = e.maxPriorityFeePerGas != null ? Rf(e.maxPriorityFeePerGas) : null, d = e.gas != null ? Rf(e.gas) : null, p = e.chainId ? Kf(e.chainId) : this.getChainId(); return { fromAddress: r, toAddress: n, @@ -28556,18 +28556,18 @@ class dS { } getChainId() { var e; - return Number.parseInt((e = this._storage.getItem(C6)) !== null && e !== void 0 ? e : "1", 10); + return Number.parseInt((e = this._storage.getItem(M6)) !== null && e !== void 0 ? e : "1", 10); } async _eth_requestAccounts() { var e, r; if (this._addresses.length > 0) - return (e = this.callback) === null || e === void 0 || e.call(this, "connect", { chainId: ma(this.getChainId()) }), this._addresses; + return (e = this.callback) === null || e === void 0 || e.call(this, "connect", { chainId: pa(this.getChainId()) }), this._addresses; const i = await this.initializeRelay().requestEthereumAccounts(); if (jn(i)) throw i; if (!i.result) throw new Error("accounts received is empty"); - return this._setAddresses(i.result), (r = this.callback) === null || r === void 0 || r.call(this, "connect", { chainId: ma(this.getChainId()) }), this._addresses; + return this._setAddresses(i.result), (r = this.callback) === null || r === void 0 || r.call(this, "connect", { chainId: pa(this.getChainId()) }), this._addresses; } async personalSign({ params: e }) { if (!Array.isArray(e)) @@ -28577,7 +28577,7 @@ class dS { const s = await this.initializeRelay().sendRequest({ method: "signEthereumMessage", params: { - address: ia(r), + address: ra(r), message: _m(n), addPrefix: !0, typedDataJson: null @@ -28617,14 +28617,14 @@ class dS { eth_signTypedData: dd.hashForSignTypedData_v4 }; return Hf(d[r]({ - data: GG(l) + data: YG(l) }), !0); }, s = n[r === "eth_signTypedData_v1" ? 1 : 0], o = n[r === "eth_signTypedData_v1" ? 0 : 1]; this._ensureKnownAddress(s); const u = await this.initializeRelay().sendRequest({ method: "signEthereumMessage", params: { - address: ia(s), + address: ra(s), message: i(o), typedDataJson: JSON.stringify(o, null, 2), addPrefix: !1 @@ -28635,8 +28635,8 @@ class dS { return u.result; } initializeRelay() { - return this._relay || (this._relay = new Ao({ - linkAPIUrl: M6, + return this._relay || (this._relay = new Eo({ + linkAPIUrl: A6, storage: this._storage, metadata: this.metadata, accountsCallback: this._setAddresses.bind(this), @@ -28644,16 +28644,16 @@ class dS { })), this._relay; } } -const pS = "SignerType", gS = new to("CBWSDK", "SignerConfigurator"); -function rJ() { - return gS.getItem(pS); +const hS = "SignerType", dS = new eo("CBWSDK", "SignerConfigurator"); +function nJ() { + return dS.getItem(hS); } -function nJ(t) { - gS.setItem(pS, t); +function iJ(t) { + dS.setItem(hS, t); } -async function iJ(t) { +async function sJ(t) { const { communicator: e, metadata: r, handshakeRequest: n, callback: i } = t; - oJ(e, r, i).catch(() => { + aJ(e, r, i).catch(() => { }); const s = { id: crypto.randomUUID(), @@ -28662,25 +28662,25 @@ async function iJ(t) { }, { data: o } = await e.postRequestAndWaitForResponse(s); return o; } -function sJ(t) { +function oJ(t) { const { signerType: e, metadata: r, communicator: n, callback: i } = t; switch (e) { case "scw": - return new aY({ + return new cY({ metadata: r, callback: i, communicator: n }); case "walletlink": - return new dS({ + return new lS({ metadata: r, callback: i }); } } -async function oJ(t, e, r) { +async function aJ(t, e, r) { await t.onMessage(({ event: i }) => i === "WalletLinkSessionRequest"); - const n = new dS({ + const n = new lS({ metadata: e, callback: r }); @@ -28692,9 +28692,9 @@ async function oJ(t, e, r) { data: { connected: !0 } }); } -const aJ = `Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. +const cJ = `Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. -Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`, cJ = () => { +Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`, uJ = () => { let t; return { getCrossOriginOpenerPolicy: () => t === void 0 ? "undefined" : t, @@ -28710,36 +28710,36 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene if (!r.ok) throw new Error(`HTTP error! status: ${r.status}`); const n = r.headers.get("Cross-Origin-Opener-Policy"); - t = n ?? "null", t === "same-origin" && console.error(aJ); + t = n ?? "null", t === "same-origin" && console.error(cJ); } catch (e) { console.error("Error checking Cross-Origin-Opener-Policy:", e.message), t = "error"; } } }; -}, { checkCrossOriginOpenerPolicy: uJ, getCrossOriginOpenerPolicy: fJ } = cJ(), R6 = 420, D6 = 540; -function lJ(t) { - const e = (window.innerWidth - R6) / 2 + window.screenX, r = (window.innerHeight - D6) / 2 + window.screenY; - dJ(t); - const n = window.open(t, "Smart Wallet", `width=${R6}, height=${D6}, left=${e}, top=${r}`); +}, { checkCrossOriginOpenerPolicy: fJ, getCrossOriginOpenerPolicy: lJ } = uJ(), C6 = 420, T6 = 540; +function hJ(t) { + const e = (window.innerWidth - C6) / 2 + window.screenX, r = (window.innerHeight - T6) / 2 + window.screenY; + pJ(t); + const n = window.open(t, "Smart Wallet", `width=${C6}, height=${T6}, left=${e}, top=${r}`); if (n == null || n.focus(), !n) throw Sr.rpc.internal("Pop up window failed to open"); return n; } -function hJ(t) { +function dJ(t) { t && !t.closed && t.close(); } -function dJ(t) { +function pJ(t) { const e = { - sdkName: FE, + sdkName: $E, sdkVersion: nh, origin: window.location.origin, - coop: fJ() + coop: lJ() }; for (const [r, n] of Object.entries(e)) t.searchParams.append(r, n.toString()); } -class pJ { - constructor({ url: e = eJ, metadata: r, preference: n }) { +class gJ { + constructor({ url: e = tJ, metadata: r, preference: n }) { this.popup = null, this.listeners = /* @__PURE__ */ new Map(), this.postMessage = async (i) => { (await this.waitForPopupLoaded()).postMessage(i, this.url.origin); }, this.postRequestAndWaitForResponse = async (i) => { @@ -28754,10 +28754,10 @@ class pJ { }; window.addEventListener("message", a), this.listeners.set(a, { reject: o }); }), this.disconnect = () => { - hJ(this.popup), this.popup = null, this.listeners.forEach(({ reject: i }, s) => { + dJ(this.popup), this.popup = null, this.listeners.forEach(({ reject: i }, s) => { i(Sr.provider.userRejectedRequest("Request rejected")), window.removeEventListener("message", s); }), this.listeners.clear(); - }, this.waitForPopupLoaded = async () => this.popup && !this.popup.closed ? (this.popup.focus(), this.popup) : (this.popup = lJ(this.url), this.onMessage(({ event: i }) => i === "PopupUnload").then(this.disconnect).catch(() => { + }, this.waitForPopupLoaded = async () => this.popup && !this.popup.closed ? (this.popup.focus(), this.popup) : (this.popup = hJ(this.url), this.onMessage(({ event: i }) => i === "PopupUnload").then(this.disconnect).catch(() => { }), this.onMessage(({ event: i }) => i === "PopupLoaded").then((i) => { this.postMessage({ requestId: i.id, @@ -28775,13 +28775,13 @@ class pJ { })), this.url = new URL(e), this.metadata = r, this.preference = n; } } -function gJ(t) { - const e = zG(mJ(t), { +function mJ(t) { + const e = WG(vJ(t), { shouldIncludeStack: !0 }), r = new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors"); return r.searchParams.set("version", nh), r.searchParams.set("code", e.code.toString()), r.searchParams.set("message", e.message), Object.assign(Object.assign({}, e), { docUrl: r.href }); } -function mJ(t) { +function vJ(t) { var e; if (typeof t == "string") return { @@ -28798,7 +28798,7 @@ function mJ(t) { } return t; } -var mS = { exports: {} }; +var pS = { exports: {} }; (function(t) { var e = Object.prototype.hasOwnProperty, r = "~"; function n() { @@ -28810,8 +28810,8 @@ var mS = { exports: {} }; function s(u, l, d, p, w) { if (typeof d != "function") throw new TypeError("The listener must be a function"); - var A = new i(d, p || u, w), P = r ? r + l : l; - return u._events[P] ? u._events[P].fn ? u._events[P] = [u._events[P], A] : u._events[P].push(A) : (u._events[P] = A, u._eventsCount++), u; + var A = new i(d, p || u, w), M = r ? r + l : l; + return u._events[M] ? u._events[M].fn ? u._events[M] = [u._events[M], A] : u._events[M].push(A) : (u._events[M] = A, u._eventsCount++), u; } function o(u, l) { --u._eventsCount === 0 ? u._events = new n() : delete u._events[l]; @@ -28829,18 +28829,18 @@ var mS = { exports: {} }; var d = r ? r + l : l, p = this._events[d]; if (!p) return []; if (p.fn) return [p.fn]; - for (var w = 0, A = p.length, P = new Array(A); w < A; w++) - P[w] = p[w].fn; - return P; + for (var w = 0, A = p.length, M = new Array(A); w < A; w++) + M[w] = p[w].fn; + return M; }, a.prototype.listenerCount = function(l) { var d = r ? r + l : l, p = this._events[d]; return p ? p.fn ? 1 : p.length : 0; - }, a.prototype.emit = function(l, d, p, w, A, P) { + }, a.prototype.emit = function(l, d, p, w, A, M) { var N = r ? r + l : l; if (!this._events[N]) return !1; - var L = this._events[N], $ = arguments.length, B, H; + var L = this._events[N], B = arguments.length, $, H; if (L.fn) { - switch (L.once && this.removeListener(l, L.fn, void 0, !0), $) { + switch (L.once && this.removeListener(l, L.fn, void 0, !0), B) { case 1: return L.fn.call(L.context), !0; case 2: @@ -28852,15 +28852,15 @@ var mS = { exports: {} }; case 5: return L.fn.call(L.context, d, p, w, A), !0; case 6: - return L.fn.call(L.context, d, p, w, A, P), !0; + return L.fn.call(L.context, d, p, w, A, M), !0; } - for (H = 1, B = new Array($ - 1); H < $; H++) - B[H - 1] = arguments[H]; - L.fn.apply(L.context, B); + for (H = 1, $ = new Array(B - 1); H < B; H++) + $[H - 1] = arguments[H]; + L.fn.apply(L.context, $); } else { var W = L.length, V; for (H = 0; H < W; H++) - switch (L[H].once && this.removeListener(l, L[H].fn, void 0, !0), $) { + switch (L[H].once && this.removeListener(l, L[H].fn, void 0, !0), B) { case 1: L[H].fn.call(L[H].context); break; @@ -28874,9 +28874,9 @@ var mS = { exports: {} }; L[H].fn.call(L[H].context, d, p, w); break; default: - if (!B) for (V = 1, B = new Array($ - 1); V < $; V++) - B[V - 1] = arguments[V]; - L[H].fn.apply(L[H].context, B); + if (!$) for (V = 1, $ = new Array(B - 1); V < B; V++) + $[V - 1] = arguments[V]; + L[H].fn.apply(L[H].context, $); } } return !0; @@ -28889,12 +28889,12 @@ var mS = { exports: {} }; if (!this._events[A]) return this; if (!d) return o(this, A), this; - var P = this._events[A]; - if (P.fn) - P.fn === d && (!w || P.once) && (!p || P.context === p) && o(this, A); + var M = this._events[A]; + if (M.fn) + M.fn === d && (!w || M.once) && (!p || M.context === p) && o(this, A); else { - for (var N = 0, L = [], $ = P.length; N < $; N++) - (P[N].fn !== d || w && !P[N].once || p && P[N].context !== p) && L.push(P[N]); + for (var N = 0, L = [], B = M.length; N < B; N++) + (M[N].fn !== d || w && !M[N].once || p && M[N].context !== p) && L.push(M[N]); L.length ? this._events[A] = L.length === 1 ? L[0] : L : o(this, A); } return this; @@ -28902,12 +28902,12 @@ var mS = { exports: {} }; var d; return l ? (d = r ? r + l : l, this._events[d] && o(this, d)) : (this._events = new n(), this._eventsCount = 0), this; }, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = r, a.EventEmitter = a, t.exports = a; -})(mS); -var vJ = mS.exports; -const bJ = /* @__PURE__ */ rs(vJ); -class yJ extends bJ { +})(pS); +var bJ = pS.exports; +const yJ = /* @__PURE__ */ ts(bJ); +class wJ extends yJ { } -var wJ = function(t, e) { +var xJ = function(t, e) { var r = {}; for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); if (t != null && typeof Object.getOwnPropertySymbols == "function") @@ -28915,37 +28915,37 @@ var wJ = function(t, e) { e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]); return r; }; -class xJ extends yJ { +class _J extends wJ { constructor(e) { - var { metadata: r } = e, n = e.preference, { keysUrl: i } = n, s = wJ(n, ["keysUrl"]); - super(), this.signer = null, this.isCoinbaseWallet = !0, this.metadata = r, this.preference = s, this.communicator = new pJ({ + var { metadata: r } = e, n = e.preference, { keysUrl: i } = n, s = xJ(n, ["keysUrl"]); + super(), this.signer = null, this.isCoinbaseWallet = !0, this.metadata = r, this.preference = s, this.communicator = new gJ({ url: i, metadata: r, preference: s }); - const o = rJ(); + const o = nJ(); o && (this.signer = this.initSigner(o)); } async request(e) { try { - if (oY(e), !this.signer) + if (aY(e), !this.signer) switch (e.method) { case "eth_requestAccounts": { const r = await this.requestSignerSelection(e), n = this.initSigner(r); - await n.handshake(e), this.signer = n, nJ(r); + await n.handshake(e), this.signer = n, iJ(r); break; } case "net_version": return 1; case "eth_chainId": - return ma(1); + return pa(1); default: throw Sr.provider.unauthorized("Must call 'eth_requestAccounts' before other methods"); } return this.signer.request(e); } catch (r) { const { code: n } = r; - return n === fn.provider.unauthorized && this.disconnect(), Promise.reject(gJ(r)); + return n === fn.provider.unauthorized && this.disconnect(), Promise.reject(mJ(r)); } } /** @deprecated Use `.request({ method: 'eth_requestAccounts' })` instead. */ @@ -28956,10 +28956,10 @@ class xJ extends yJ { } async disconnect() { var e; - await ((e = this.signer) === null || e === void 0 ? void 0 : e.cleanup()), this.signer = null, to.clearAll(), this.emit("disconnect", Sr.provider.disconnected("User initiated disconnection")); + await ((e = this.signer) === null || e === void 0 ? void 0 : e.cleanup()), this.signer = null, eo.clearAll(), this.emit("disconnect", Sr.provider.disconnected("User initiated disconnection")); } requestSignerSelection(e) { - return iJ({ + return sJ({ communicator: this.communicator, preference: this.preference, metadata: this.metadata, @@ -28968,7 +28968,7 @@ class xJ extends yJ { }); } initSigner(e) { - return sJ({ + return oJ({ signerType: e, metadata: this.metadata, communicator: this.communicator, @@ -28976,7 +28976,7 @@ class xJ extends yJ { }); } } -function _J(t) { +function EJ(t) { if (t) { if (!["all", "smartWalletOnly", "eoaOnly"].includes(t.options)) throw new Error(`Invalid options: ${t.options}`); @@ -28984,61 +28984,61 @@ function _J(t) { throw new Error("Attribution cannot contain both auto and dataSuffix properties"); } } -function EJ(t) { +function SJ(t) { var e; const r = { metadata: t.metadata, preference: t.preference }; - return (e = sY(r)) !== null && e !== void 0 ? e : new xJ(r); + return (e = oY(r)) !== null && e !== void 0 ? e : new _J(r); } -const SJ = { +const AJ = { options: "all" }; -function AJ(t) { +function PJ(t) { var e; - new to("CBWSDK").setItem("VERSION", nh), uJ(); + new eo("CBWSDK").setItem("VERSION", nh), fJ(); const n = { metadata: { appName: t.appName || "Dapp", appLogoUrl: t.appLogoUrl || "", appChainIds: t.appChainIds || [] }, - preference: Object.assign(SJ, (e = t.preference) !== null && e !== void 0 ? e : {}) + preference: Object.assign(AJ, (e = t.preference) !== null && e !== void 0 ? e : {}) }; - _J(n.preference); + EJ(n.preference); let i = null; return { - getProvider: () => (i || (i = EJ(n)), i) + getProvider: () => (i || (i = SJ(n)), i) }; } -function vS(t, e) { +function gS(t, e) { return function() { return t.apply(e, arguments); }; } -const { toString: PJ } = Object.prototype, { getPrototypeOf: Sb } = Object, fp = /* @__PURE__ */ ((t) => (e) => { - const r = PJ.call(e); +const { toString: MJ } = Object.prototype, { getPrototypeOf: Sb } = Object, fp = /* @__PURE__ */ ((t) => (e) => { + const r = MJ.call(e); return t[r] || (t[r] = r.slice(8, -1).toLowerCase()); })(/* @__PURE__ */ Object.create(null)), Ps = (t) => (t = t.toLowerCase(), (e) => fp(e) === t), lp = (t) => (e) => typeof e === t, { isArray: Wu } = Array, Ml = lp("undefined"); -function MJ(t) { +function IJ(t) { return t !== null && !Ml(t) && t.constructor !== null && !Ml(t.constructor) && Oi(t.constructor.isBuffer) && t.constructor.isBuffer(t); } -const bS = Ps("ArrayBuffer"); -function IJ(t) { +const mS = Ps("ArrayBuffer"); +function CJ(t) { let e; - return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && bS(t.buffer), e; + return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && mS(t.buffer), e; } -const CJ = lp("string"), Oi = lp("function"), yS = lp("number"), hp = (t) => t !== null && typeof t == "object", TJ = (t) => t === !0 || t === !1, kd = (t) => { +const TJ = lp("string"), Oi = lp("function"), vS = lp("number"), hp = (t) => t !== null && typeof t == "object", RJ = (t) => t === !0 || t === !1, kd = (t) => { if (fp(t) !== "object") return !1; const e = Sb(t); return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in t) && !(Symbol.iterator in t); -}, RJ = Ps("Date"), DJ = Ps("File"), OJ = Ps("Blob"), NJ = Ps("FileList"), LJ = (t) => hp(t) && Oi(t.pipe), kJ = (t) => { +}, DJ = Ps("Date"), OJ = Ps("File"), NJ = Ps("Blob"), LJ = Ps("FileList"), kJ = (t) => hp(t) && Oi(t.pipe), $J = (t) => { let e; return t && (typeof FormData == "function" && t instanceof FormData || Oi(t.append) && ((e = fp(t)) === "formdata" || // detect form-data instance e === "object" && Oi(t.toString) && t.toString() === "[object FormData]")); -}, $J = Ps("URLSearchParams"), [BJ, FJ, jJ, UJ] = ["ReadableStream", "Request", "Response", "Headers"].map(Ps), qJ = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); +}, BJ = Ps("URLSearchParams"), [FJ, jJ, UJ, qJ] = ["ReadableStream", "Request", "Response", "Headers"].map(Ps), zJ = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); function sh(t, e, { allOwnKeys: r = !1 } = {}) { if (t === null || typeof t > "u") return; @@ -29053,7 +29053,7 @@ function sh(t, e, { allOwnKeys: r = !1 } = {}) { a = s[n], e.call(null, t[a], a, t); } } -function wS(t, e) { +function bS(t, e) { e = e.toLowerCase(); const r = Object.keys(t); let n = r.length, i; @@ -29062,23 +29062,23 @@ function wS(t, e) { return i; return null; } -const sc = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, xS = (t) => !Ml(t) && t !== sc; +const ic = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, yS = (t) => !Ml(t) && t !== ic; function W1() { - const { caseless: t } = xS(this) && this || {}, e = {}, r = (n, i) => { - const s = t && wS(e, i) || i; + const { caseless: t } = yS(this) && this || {}, e = {}, r = (n, i) => { + const s = t && bS(e, i) || i; kd(e[s]) && kd(n) ? e[s] = W1(e[s], n) : kd(n) ? e[s] = W1({}, n) : Wu(n) ? e[s] = n.slice() : e[s] = n; }; for (let n = 0, i = arguments.length; n < i; n++) arguments[n] && sh(arguments[n], r); return e; } -const zJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { - r && Oi(i) ? t[s] = vS(i, r) : t[s] = i; -}, { allOwnKeys: n }), t), WJ = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), HJ = (t, e, r, n) => { +const WJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { + r && Oi(i) ? t[s] = gS(i, r) : t[s] = i; +}, { allOwnKeys: n }), t), HJ = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), KJ = (t, e, r, n) => { t.prototype = Object.create(e.prototype, n), t.prototype.constructor = t, Object.defineProperty(t, "super", { value: e.prototype }), r && Object.assign(t.prototype, r); -}, KJ = (t, e, r, n) => { +}, VJ = (t, e, r, n) => { let i, s, o; const a = {}; if (e = e || {}, t == null) return e; @@ -29088,45 +29088,45 @@ const zJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { t = r !== !1 && Sb(t); } while (t && (!r || r(t, e)) && t !== Object.prototype); return e; -}, VJ = (t, e, r) => { +}, GJ = (t, e, r) => { t = String(t), (r === void 0 || r > t.length) && (r = t.length), r -= e.length; const n = t.indexOf(e, r); return n !== -1 && n === r; -}, GJ = (t) => { +}, YJ = (t) => { if (!t) return null; if (Wu(t)) return t; let e = t.length; - if (!yS(e)) return null; + if (!vS(e)) return null; const r = new Array(e); for (; e-- > 0; ) r[e] = t[e]; return r; -}, YJ = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Sb(Uint8Array)), JJ = (t, e) => { +}, JJ = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Sb(Uint8Array)), XJ = (t, e) => { const n = (t && t[Symbol.iterator]).call(t); let i; for (; (i = n.next()) && !i.done; ) { const s = i.value; e.call(t, s[0], s[1]); } -}, XJ = (t, e) => { +}, ZJ = (t, e) => { let r; const n = []; for (; (r = t.exec(e)) !== null; ) n.push(r); return n; -}, ZJ = Ps("HTMLFormElement"), QJ = (t) => t.toLowerCase().replace( +}, QJ = Ps("HTMLFormElement"), eX = (t) => t.toLowerCase().replace( /[-_\s]([a-z\d])(\w*)/g, function(r, n, i) { return n.toUpperCase() + i; } -), O6 = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), eX = Ps("RegExp"), _S = (t, e) => { +), R6 = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), tX = Ps("RegExp"), wS = (t, e) => { const r = Object.getOwnPropertyDescriptors(t), n = {}; sh(r, (i, s) => { let o; (o = e(i, s, t)) !== !1 && (n[s] = o || i); }), Object.defineProperties(t, n); -}, tX = (t) => { - _S(t, (e, r) => { +}, rX = (t) => { + wS(t, (e, r) => { if (Oi(t) && ["arguments", "caller", "callee"].indexOf(r) !== -1) return !1; const n = t[r]; @@ -29140,29 +29140,29 @@ const zJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { }); } }); -}, rX = (t, e) => { +}, nX = (t, e) => { const r = {}, n = (i) => { i.forEach((s) => { r[s] = !0; }); }; return Wu(t) ? n(t) : n(String(t).split(e)), r; -}, nX = () => { -}, iX = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, Im = "abcdefghijklmnopqrstuvwxyz", N6 = "0123456789", ES = { - DIGIT: N6, +}, iX = () => { +}, sX = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, Im = "abcdefghijklmnopqrstuvwxyz", D6 = "0123456789", xS = { + DIGIT: D6, ALPHA: Im, - ALPHA_DIGIT: Im + Im.toUpperCase() + N6 -}, sX = (t = 16, e = ES.ALPHA_DIGIT) => { + ALPHA_DIGIT: Im + Im.toUpperCase() + D6 +}, oX = (t = 16, e = xS.ALPHA_DIGIT) => { let r = ""; const { length: n } = e; for (; t--; ) r += e[Math.random() * n | 0]; return r; }; -function oX(t) { +function aX(t) { return !!(t && Oi(t.append) && t[Symbol.toStringTag] === "FormData" && t[Symbol.iterator]); } -const aX = (t) => { +const cX = (t) => { const e = new Array(10), r = (n, i) => { if (hp(n)) { if (e.indexOf(n) >= 0) @@ -29179,72 +29179,72 @@ const aX = (t) => { return n; }; return r(t, 0); -}, cX = Ps("AsyncFunction"), uX = (t) => t && (hp(t) || Oi(t)) && Oi(t.then) && Oi(t.catch), SS = ((t, e) => t ? setImmediate : e ? ((r, n) => (sc.addEventListener("message", ({ source: i, data: s }) => { - i === sc && s === r && n.length && n.shift()(); +}, uX = Ps("AsyncFunction"), fX = (t) => t && (hp(t) || Oi(t)) && Oi(t.then) && Oi(t.catch), _S = ((t, e) => t ? setImmediate : e ? ((r, n) => (ic.addEventListener("message", ({ source: i, data: s }) => { + i === ic && s === r && n.length && n.shift()(); }, !1), (i) => { - n.push(i), sc.postMessage(r, "*"); + n.push(i), ic.postMessage(r, "*"); }))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))( typeof setImmediate == "function", - Oi(sc.postMessage) -), fX = typeof queueMicrotask < "u" ? queueMicrotask.bind(sc) : typeof process < "u" && process.nextTick || SS, Oe = { + Oi(ic.postMessage) +), lX = typeof queueMicrotask < "u" ? queueMicrotask.bind(ic) : typeof process < "u" && process.nextTick || _S, Oe = { isArray: Wu, - isArrayBuffer: bS, - isBuffer: MJ, - isFormData: kJ, - isArrayBufferView: IJ, - isString: CJ, - isNumber: yS, - isBoolean: TJ, + isArrayBuffer: mS, + isBuffer: IJ, + isFormData: $J, + isArrayBufferView: CJ, + isString: TJ, + isNumber: vS, + isBoolean: RJ, isObject: hp, isPlainObject: kd, - isReadableStream: BJ, - isRequest: FJ, - isResponse: jJ, - isHeaders: UJ, + isReadableStream: FJ, + isRequest: jJ, + isResponse: UJ, + isHeaders: qJ, isUndefined: Ml, - isDate: RJ, - isFile: DJ, - isBlob: OJ, - isRegExp: eX, + isDate: DJ, + isFile: OJ, + isBlob: NJ, + isRegExp: tX, isFunction: Oi, - isStream: LJ, - isURLSearchParams: $J, - isTypedArray: YJ, - isFileList: NJ, + isStream: kJ, + isURLSearchParams: BJ, + isTypedArray: JJ, + isFileList: LJ, forEach: sh, merge: W1, - extend: zJ, - trim: qJ, - stripBOM: WJ, - inherits: HJ, - toFlatObject: KJ, + extend: WJ, + trim: zJ, + stripBOM: HJ, + inherits: KJ, + toFlatObject: VJ, kindOf: fp, kindOfTest: Ps, - endsWith: VJ, - toArray: GJ, - forEachEntry: JJ, - matchAll: XJ, - isHTMLForm: ZJ, - hasOwnProperty: O6, - hasOwnProp: O6, + endsWith: GJ, + toArray: YJ, + forEachEntry: XJ, + matchAll: ZJ, + isHTMLForm: QJ, + hasOwnProperty: R6, + hasOwnProp: R6, // an alias to avoid ESLint no-prototype-builtins detection - reduceDescriptors: _S, - freezeMethods: tX, - toObjectSet: rX, - toCamelCase: QJ, - noop: nX, - toFiniteNumber: iX, - findKey: wS, - global: sc, - isContextDefined: xS, - ALPHABET: ES, - generateString: sX, - isSpecCompliantForm: oX, - toJSONObject: aX, - isAsyncFn: cX, - isThenable: uX, - setImmediate: SS, - asap: fX + reduceDescriptors: wS, + freezeMethods: rX, + toObjectSet: nX, + toCamelCase: eX, + noop: iX, + toFiniteNumber: sX, + findKey: bS, + global: ic, + isContextDefined: yS, + ALPHABET: xS, + generateString: oX, + isSpecCompliantForm: aX, + toJSONObject: cX, + isAsyncFn: uX, + isThenable: fX, + setImmediate: _S, + asap: lX }; function or(t, e, r, n, i) { Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = t, this.name = "AxiosError", e && (this.code = e), r && (this.config = r), n && (this.request = n), i && (this.response = i, this.status = i.status ? i.status : null); @@ -29270,7 +29270,7 @@ Oe.inherits(or, Error, { }; } }); -const AS = or.prototype, PS = {}; +const ES = or.prototype, SS = {}; [ "ERR_BAD_OPTION_VALUE", "ERR_BAD_OPTION", @@ -29286,32 +29286,32 @@ const AS = or.prototype, PS = {}; "ERR_INVALID_URL" // eslint-disable-next-line func-names ].forEach((t) => { - PS[t] = { value: t }; + SS[t] = { value: t }; }); -Object.defineProperties(or, PS); -Object.defineProperty(AS, "isAxiosError", { value: !0 }); +Object.defineProperties(or, SS); +Object.defineProperty(ES, "isAxiosError", { value: !0 }); or.from = (t, e, r, n, i, s) => { - const o = Object.create(AS); + const o = Object.create(ES); return Oe.toFlatObject(t, o, function(u) { return u !== Error.prototype; }, (a) => a !== "isAxiosError"), or.call(o, t.message, e, r, n, i), o.cause = t, o.name = t.name, s && Object.assign(o, s), o; }; -const lX = null; +const hX = null; function H1(t) { return Oe.isPlainObject(t) || Oe.isArray(t); } -function MS(t) { +function AS(t) { return Oe.endsWith(t, "[]") ? t.slice(0, -2) : t; } -function L6(t, e, r) { +function O6(t, e, r) { return t ? t.concat(e).map(function(i, s) { - return i = MS(i), !r && s ? "[" + i + "]" : i; + return i = AS(i), !r && s ? "[" + i + "]" : i; }).join(r ? "." : "") : e; } -function hX(t) { +function dX(t) { return Oe.isArray(t) && !t.some(H1); } -const dX = Oe.toFlatObject(Oe, {}, null, function(e) { +const pX = Oe.toFlatObject(Oe, {}, null, function(e) { return /^is[A-Z]/.test(e); }); function dp(t, e, r) { @@ -29327,47 +29327,47 @@ function dp(t, e, r) { const n = r.metaTokens, i = r.visitor || d, s = r.dots, o = r.indexes, u = (r.Blob || typeof Blob < "u" && Blob) && Oe.isSpecCompliantForm(e); if (!Oe.isFunction(i)) throw new TypeError("visitor must be a function"); - function l(P) { - if (P === null) return ""; - if (Oe.isDate(P)) - return P.toISOString(); - if (!u && Oe.isBlob(P)) + function l(M) { + if (M === null) return ""; + if (Oe.isDate(M)) + return M.toISOString(); + if (!u && Oe.isBlob(M)) throw new or("Blob is not supported. Use a Buffer instead."); - return Oe.isArrayBuffer(P) || Oe.isTypedArray(P) ? u && typeof Blob == "function" ? new Blob([P]) : Buffer.from(P) : P; + return Oe.isArrayBuffer(M) || Oe.isTypedArray(M) ? u && typeof Blob == "function" ? new Blob([M]) : Buffer.from(M) : M; } - function d(P, N, L) { - let $ = P; - if (P && !L && typeof P == "object") { + function d(M, N, L) { + let B = M; + if (M && !L && typeof M == "object") { if (Oe.endsWith(N, "{}")) - N = n ? N : N.slice(0, -2), P = JSON.stringify(P); - else if (Oe.isArray(P) && hX(P) || (Oe.isFileList(P) || Oe.endsWith(N, "[]")) && ($ = Oe.toArray(P))) - return N = MS(N), $.forEach(function(H, W) { + N = n ? N : N.slice(0, -2), M = JSON.stringify(M); + else if (Oe.isArray(M) && dX(M) || (Oe.isFileList(M) || Oe.endsWith(N, "[]")) && (B = Oe.toArray(M))) + return N = AS(N), B.forEach(function(H, W) { !(Oe.isUndefined(H) || H === null) && e.append( // eslint-disable-next-line no-nested-ternary - o === !0 ? L6([N], W, s) : o === null ? N : N + "[]", + o === !0 ? O6([N], W, s) : o === null ? N : N + "[]", l(H) ); }), !1; } - return H1(P) ? !0 : (e.append(L6(L, N, s), l(P)), !1); + return H1(M) ? !0 : (e.append(O6(L, N, s), l(M)), !1); } - const p = [], w = Object.assign(dX, { + const p = [], w = Object.assign(pX, { defaultVisitor: d, convertValue: l, isVisitable: H1 }); - function A(P, N) { - if (!Oe.isUndefined(P)) { - if (p.indexOf(P) !== -1) + function A(M, N) { + if (!Oe.isUndefined(M)) { + if (p.indexOf(M) !== -1) throw Error("Circular reference detected in " + N.join(".")); - p.push(P), Oe.forEach(P, function($, B) { - (!(Oe.isUndefined($) || $ === null) && i.call( + p.push(M), Oe.forEach(M, function(B, $) { + (!(Oe.isUndefined(B) || B === null) && i.call( e, - $, - Oe.isString(B) ? B.trim() : B, + B, + Oe.isString($) ? $.trim() : $, N, w - )) === !0 && A($, N ? N.concat(B) : [B]); + )) === !0 && A(B, N ? N.concat($) : [$]); }), p.pop(); } } @@ -29375,7 +29375,7 @@ function dp(t, e, r) { throw new TypeError("data must be an object"); return A(t), e; } -function k6(t) { +function N6(t) { const e = { "!": "%21", "'": "%27", @@ -29392,25 +29392,25 @@ function k6(t) { function Ab(t, e) { this._pairs = [], t && dp(t, this, e); } -const IS = Ab.prototype; -IS.append = function(e, r) { +const PS = Ab.prototype; +PS.append = function(e, r) { this._pairs.push([e, r]); }; -IS.toString = function(e) { +PS.toString = function(e) { const r = e ? function(n) { - return e.call(this, n, k6); - } : k6; + return e.call(this, n, N6); + } : N6; return this._pairs.map(function(i) { return r(i[0]) + "=" + r(i[1]); }, "").join("&"); }; -function pX(t) { +function gX(t) { return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]"); } -function CS(t, e, r) { +function MS(t, e, r) { if (!e) return t; - const n = r && r.encode || pX; + const n = r && r.encode || gX; Oe.isFunction(r) && (r = { serialize: r }); @@ -29422,7 +29422,7 @@ function CS(t, e, r) { } return t; } -class $6 { +class L6 { constructor() { this.handlers = []; } @@ -29476,41 +29476,41 @@ class $6 { }); } } -const TS = { +const IS = { silentJSONParsing: !0, forcedJSONParsing: !0, clarifyTimeoutError: !1 -}, gX = typeof URLSearchParams < "u" ? URLSearchParams : Ab, mX = typeof FormData < "u" ? FormData : null, vX = typeof Blob < "u" ? Blob : null, bX = { +}, mX = typeof URLSearchParams < "u" ? URLSearchParams : Ab, vX = typeof FormData < "u" ? FormData : null, bX = typeof Blob < "u" ? Blob : null, yX = { isBrowser: !0, classes: { - URLSearchParams: gX, - FormData: mX, - Blob: vX + URLSearchParams: mX, + FormData: vX, + Blob: bX }, protocols: ["http", "https", "file", "blob", "url", "data"] -}, Pb = typeof window < "u" && typeof document < "u", K1 = typeof navigator == "object" && navigator || void 0, yX = Pb && (!K1 || ["ReactNative", "NativeScript", "NS"].indexOf(K1.product) < 0), wX = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef -self instanceof WorkerGlobalScope && typeof self.importScripts == "function", xX = Pb && window.location.href || "http://localhost", _X = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}, Pb = typeof window < "u" && typeof document < "u", K1 = typeof navigator == "object" && navigator || void 0, wX = Pb && (!K1 || ["ReactNative", "NativeScript", "NS"].indexOf(K1.product) < 0), xX = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef +self instanceof WorkerGlobalScope && typeof self.importScripts == "function", _X = Pb && window.location.href || "http://localhost", EX = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, hasBrowserEnv: Pb, - hasStandardBrowserEnv: yX, - hasStandardBrowserWebWorkerEnv: wX, + hasStandardBrowserEnv: wX, + hasStandardBrowserWebWorkerEnv: xX, navigator: K1, - origin: xX -}, Symbol.toStringTag, { value: "Module" })), Jn = { - ..._X, - ...bX + origin: _X +}, Symbol.toStringTag, { value: "Module" })), Xn = { + ...EX, + ...yX }; -function EX(t, e) { - return dp(t, new Jn.classes.URLSearchParams(), Object.assign({ +function SX(t, e) { + return dp(t, new Xn.classes.URLSearchParams(), Object.assign({ visitor: function(r, n, i, s) { - return Jn.isNode && Oe.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : s.defaultVisitor.apply(this, arguments); + return Xn.isNode && Oe.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : s.defaultVisitor.apply(this, arguments); } }, e)); } -function SX(t) { +function AX(t) { return Oe.matchAll(/\w+|\[(\w*)]/g, t).map((e) => e[0] === "[]" ? "" : e[1] || e[0]); } -function AX(t) { +function PX(t) { const e = {}, r = Object.keys(t); let n; const i = r.length; @@ -29519,22 +29519,22 @@ function AX(t) { s = r[n], e[s] = t[s]; return e; } -function RS(t) { +function CS(t) { function e(r, n, i, s) { let o = r[s++]; if (o === "__proto__") return !0; const a = Number.isFinite(+o), u = s >= r.length; - return o = !o && Oe.isArray(i) ? i.length : o, u ? (Oe.hasOwnProp(i, o) ? i[o] = [i[o], n] : i[o] = n, !a) : ((!i[o] || !Oe.isObject(i[o])) && (i[o] = []), e(r, n, i[o], s) && Oe.isArray(i[o]) && (i[o] = AX(i[o])), !a); + return o = !o && Oe.isArray(i) ? i.length : o, u ? (Oe.hasOwnProp(i, o) ? i[o] = [i[o], n] : i[o] = n, !a) : ((!i[o] || !Oe.isObject(i[o])) && (i[o] = []), e(r, n, i[o], s) && Oe.isArray(i[o]) && (i[o] = PX(i[o])), !a); } if (Oe.isFormData(t) && Oe.isFunction(t.entries)) { const r = {}; return Oe.forEachEntry(t, (n, i) => { - e(SX(n), i, r, 0); + e(AX(n), i, r, 0); }), r; } return null; } -function PX(t, e, r) { +function MX(t, e, r) { if (Oe.isString(t)) try { return (e || JSON.parse)(t), Oe.trim(t); @@ -29545,12 +29545,12 @@ function PX(t, e, r) { return (r || JSON.stringify)(t); } const oh = { - transitional: TS, + transitional: IS, adapter: ["xhr", "http", "fetch"], transformRequest: [function(e, r) { const n = r.getContentType() || "", i = n.indexOf("application/json") > -1, s = Oe.isObject(e); if (s && Oe.isHTMLForm(e) && (e = new FormData(e)), Oe.isFormData(e)) - return i ? JSON.stringify(RS(e)) : e; + return i ? JSON.stringify(CS(e)) : e; if (Oe.isArrayBuffer(e) || Oe.isBuffer(e) || Oe.isStream(e) || Oe.isFile(e) || Oe.isBlob(e) || Oe.isReadableStream(e)) return e; if (Oe.isArrayBufferView(e)) @@ -29560,7 +29560,7 @@ const oh = { let a; if (s) { if (n.indexOf("application/x-www-form-urlencoded") > -1) - return EX(e, this.formSerializer).toString(); + return SX(e, this.formSerializer).toString(); if ((a = Oe.isFileList(e)) || n.indexOf("multipart/form-data") > -1) { const u = this.env && this.env.FormData; return dp( @@ -29570,7 +29570,7 @@ const oh = { ); } } - return s || i ? (r.setContentType("application/json", !1), PX(e)) : e; + return s || i ? (r.setContentType("application/json", !1), MX(e)) : e; }], transformResponse: [function(e) { const r = this.transitional || oh.transitional, n = r && r.forcedJSONParsing, i = this.responseType === "json"; @@ -29597,8 +29597,8 @@ const oh = { maxContentLength: -1, maxBodyLength: -1, env: { - FormData: Jn.classes.FormData, - Blob: Jn.classes.Blob + FormData: Xn.classes.FormData, + Blob: Xn.classes.Blob }, validateStatus: function(e) { return e >= 200 && e < 300; @@ -29613,7 +29613,7 @@ const oh = { Oe.forEach(["delete", "get", "head", "post", "put", "patch"], (t) => { oh.headers[t] = {}; }); -const MX = Oe.toObjectSet([ +const IX = Oe.toObjectSet([ "age", "authorization", "content-length", @@ -29631,28 +29631,28 @@ const MX = Oe.toObjectSet([ "referer", "retry-after", "user-agent" -]), IX = (t) => { +]), CX = (t) => { const e = {}; let r, n, i; return t && t.split(` `).forEach(function(o) { - i = o.indexOf(":"), r = o.substring(0, i).trim().toLowerCase(), n = o.substring(i + 1).trim(), !(!r || e[r] && MX[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n); + i = o.indexOf(":"), r = o.substring(0, i).trim().toLowerCase(), n = o.substring(i + 1).trim(), !(!r || e[r] && IX[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n); }), e; -}, B6 = Symbol("internals"); +}, k6 = Symbol("internals"); function Df(t) { return t && String(t).trim().toLowerCase(); } function $d(t) { return t === !1 || t == null ? t : Oe.isArray(t) ? t.map($d) : String(t); } -function CX(t) { +function TX(t) { const e = /* @__PURE__ */ Object.create(null), r = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; let n; for (; n = r.exec(t); ) e[n[1]] = n[2]; return e; } -const TX = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()); +const RX = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()); function Cm(t, e, r, n, i) { if (Oe.isFunction(n)) return n.call(this, e, r); @@ -29663,10 +29663,10 @@ function Cm(t, e, r, n, i) { return n.test(e); } } -function RX(t) { +function DX(t) { return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, r, n) => r.toUpperCase() + n); } -function DX(t, e) { +function OX(t, e) { const r = Oe.toCamelCase(" " + e); ["get", "set", "has"].forEach((n) => { Object.defineProperty(t, n + r, { @@ -29693,8 +29693,8 @@ let yi = class { const o = (a, u) => Oe.forEach(a, (l, d) => s(l, d, u)); if (Oe.isPlainObject(e) || e instanceof this.constructor) o(e, r); - else if (Oe.isString(e) && (e = e.trim()) && !TX(e)) - o(IX(e), r); + else if (Oe.isString(e) && (e = e.trim()) && !RX(e)) + o(CX(e), r); else if (Oe.isHeaders(e)) for (const [a, u] of e.entries()) s(u, a, n); @@ -29710,7 +29710,7 @@ let yi = class { if (!r) return i; if (r === !0) - return CX(i); + return TX(i); if (Oe.isFunction(r)) return r.call(this, i, n); if (Oe.isRegExp(r)) @@ -29754,7 +29754,7 @@ let yi = class { r[o] = $d(i), delete r[s]; return; } - const a = e ? RX(s) : String(s).trim(); + const a = e ? DX(s) : String(s).trim(); a !== s && delete r[s], r[a] = $d(i), n[a] = !0; }), this; } @@ -29785,12 +29785,12 @@ let yi = class { return r.forEach((i) => n.set(i)), n; } static accessor(e) { - const n = (this[B6] = this[B6] = { + const n = (this[k6] = this[k6] = { accessors: {} }).accessors, i = this.prototype; function s(o) { const a = Df(o); - n[a] || (DX(i, o), n[a] = !0); + n[a] || (OX(i, o), n[a] = !0); } return Oe.isArray(e) ? e.forEach(s) : s(e), this; } @@ -29813,7 +29813,7 @@ function Tm(t, e) { s = a.call(r, s, i.normalize(), e ? e.status : void 0); }), i.normalize(), s; } -function DS(t) { +function TS(t) { return !!(t && t.__CANCEL__); } function Hu(t, e, r) { @@ -29822,7 +29822,7 @@ function Hu(t, e, r) { Oe.inherits(Hu, or, { __CANCEL__: !0 }); -function OS(t, e, r) { +function RS(t, e, r) { const n = r.config.validateStatus; !r.status || !n || n(r.status) ? t(r) : e(new or( "Request failed with status code " + r.status, @@ -29832,11 +29832,11 @@ function OS(t, e, r) { r )); } -function OX(t) { +function NX(t) { const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(t); return e && e[1] || ""; } -function NX(t, e) { +function LX(t, e) { t = t || 10; const r = new Array(t), n = new Array(t); let i = 0, s = 0, o; @@ -29852,7 +29852,7 @@ function NX(t, e) { return A ? Math.round(w * 1e3 / A) : void 0; }; } -function LX(t, e) { +function kX(t, e) { let r = 0, n = 1e3 / e, i, s; const o = (l, d = Date.now()) => { r = d, i = null, s && (clearTimeout(s), s = null), t.apply(null, l); @@ -29866,8 +29866,8 @@ function LX(t, e) { } const g0 = (t, e, r = 3) => { let n = 0; - const i = NX(50, 250); - return LX((s) => { + const i = LX(50, 250); + return kX((s) => { const o = s.loaded, a = s.lengthComputable ? s.total : void 0, u = o - n, l = i(u), d = o <= a; n = o; const p = { @@ -29883,17 +29883,17 @@ const g0 = (t, e, r = 3) => { }; t(p); }, r); -}, F6 = (t, e) => { +}, $6 = (t, e) => { const r = t != null; return [(n) => e[0]({ lengthComputable: r, total: t, loaded: n }), e[1]]; -}, j6 = (t) => (...e) => Oe.asap(() => t(...e)), kX = Jn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Jn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( - new URL(Jn.origin), - Jn.navigator && /(msie|trident)/i.test(Jn.navigator.userAgent) -) : () => !0, $X = Jn.hasStandardBrowserEnv ? ( +}, B6 = (t) => (...e) => Oe.asap(() => t(...e)), $X = Xn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Xn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( + new URL(Xn.origin), + Xn.navigator && /(msie|trident)/i.test(Xn.navigator.userAgent) +) : () => !0, BX = Xn.hasStandardBrowserEnv ? ( // Standard browser envs support document.cookie { write(t, e, r, n, i, s) { @@ -29920,17 +29920,17 @@ const g0 = (t, e, r = 3) => { } } ); -function BX(t) { +function FX(t) { return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t); } -function FX(t, e) { +function jX(t, e) { return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t; } -function NS(t, e) { - return t && !BX(e) ? FX(t, e) : e; +function DS(t, e) { + return t && !FX(e) ? jX(t, e) : e; } -const U6 = (t) => t instanceof yi ? { ...t } : t; -function mc(t, e) { +const F6 = (t) => t instanceof yi ? { ...t } : t; +function gc(t, e) { e = e || {}; const r = {}; function n(l, d, p, w) { @@ -29987,46 +29987,46 @@ function mc(t, e) { socketPath: o, responseEncoding: o, validateStatus: a, - headers: (l, d, p) => i(U6(l), U6(d), p, !0) + headers: (l, d, p) => i(F6(l), F6(d), p, !0) }; return Oe.forEach(Object.keys(Object.assign({}, t, e)), function(d) { const p = u[d] || i, w = p(t[d], e[d], d); Oe.isUndefined(w) && p !== a || (r[d] = w); }), r; } -const LS = (t) => { - const e = mc({}, t); +const OS = (t) => { + const e = gc({}, t); let { data: r, withXSRFToken: n, xsrfHeaderName: i, xsrfCookieName: s, headers: o, auth: a } = e; - e.headers = o = yi.from(o), e.url = CS(NS(e.baseURL, e.url), t.params, t.paramsSerializer), a && o.set( + e.headers = o = yi.from(o), e.url = MS(DS(e.baseURL, e.url), t.params, t.paramsSerializer), a && o.set( "Authorization", "Basic " + btoa((a.username || "") + ":" + (a.password ? unescape(encodeURIComponent(a.password)) : "")) ); let u; if (Oe.isFormData(r)) { - if (Jn.hasStandardBrowserEnv || Jn.hasStandardBrowserWebWorkerEnv) + if (Xn.hasStandardBrowserEnv || Xn.hasStandardBrowserWebWorkerEnv) o.setContentType(void 0); else if ((u = o.getContentType()) !== !1) { const [l, ...d] = u ? u.split(";").map((p) => p.trim()).filter(Boolean) : []; o.setContentType([l || "multipart/form-data", ...d].join("; ")); } } - if (Jn.hasStandardBrowserEnv && (n && Oe.isFunction(n) && (n = n(e)), n || n !== !1 && kX(e.url))) { - const l = i && s && $X.read(s); + if (Xn.hasStandardBrowserEnv && (n && Oe.isFunction(n) && (n = n(e)), n || n !== !1 && $X(e.url))) { + const l = i && s && BX.read(s); l && o.set(i, l); } return e; -}, jX = typeof XMLHttpRequest < "u", UX = jX && function(t) { +}, UX = typeof XMLHttpRequest < "u", qX = UX && function(t) { return new Promise(function(r, n) { - const i = LS(t); + const i = OS(t); let s = i.data; const o = yi.from(i.headers).normalize(); - let { responseType: a, onUploadProgress: u, onDownloadProgress: l } = i, d, p, w, A, P; + let { responseType: a, onUploadProgress: u, onDownloadProgress: l } = i, d, p, w, A, M; function N() { - A && A(), P && P(), i.cancelToken && i.cancelToken.unsubscribe(d), i.signal && i.signal.removeEventListener("abort", d); + A && A(), M && M(), i.cancelToken && i.cancelToken.unsubscribe(d), i.signal && i.signal.removeEventListener("abort", d); } let L = new XMLHttpRequest(); L.open(i.method.toUpperCase(), i.url, !0), L.timeout = i.timeout; - function $() { + function B() { if (!L) return; const H = yi.from( @@ -30039,21 +30039,21 @@ const LS = (t) => { config: t, request: L }; - OS(function(R) { + RS(function(R) { r(R), N(); }, function(R) { n(R), N(); }, V), L = null; } - "onloadend" in L ? L.onloadend = $ : L.onreadystatechange = function() { - !L || L.readyState !== 4 || L.status === 0 && !(L.responseURL && L.responseURL.indexOf("file:") === 0) || setTimeout($); + "onloadend" in L ? L.onloadend = B : L.onreadystatechange = function() { + !L || L.readyState !== 4 || L.status === 0 && !(L.responseURL && L.responseURL.indexOf("file:") === 0) || setTimeout(B); }, L.onabort = function() { L && (n(new or("Request aborted", or.ECONNABORTED, t, L)), L = null); }, L.onerror = function() { n(new or("Network Error", or.ERR_NETWORK, t, L)), L = null; }, L.ontimeout = function() { let W = i.timeout ? "timeout of " + i.timeout + "ms exceeded" : "timeout exceeded"; - const V = i.transitional || TS; + const V = i.transitional || IS; i.timeoutErrorMessage && (W = i.timeoutErrorMessage), n(new or( W, V.clarifyTimeoutError ? or.ETIMEDOUT : or.ECONNABORTED, @@ -30062,17 +30062,17 @@ const LS = (t) => { )), L = null; }, s === void 0 && o.setContentType(null), "setRequestHeader" in L && Oe.forEach(o.toJSON(), function(W, V) { L.setRequestHeader(V, W); - }), Oe.isUndefined(i.withCredentials) || (L.withCredentials = !!i.withCredentials), a && a !== "json" && (L.responseType = i.responseType), l && ([w, P] = g0(l, !0), L.addEventListener("progress", w)), u && L.upload && ([p, A] = g0(u), L.upload.addEventListener("progress", p), L.upload.addEventListener("loadend", A)), (i.cancelToken || i.signal) && (d = (H) => { + }), Oe.isUndefined(i.withCredentials) || (L.withCredentials = !!i.withCredentials), a && a !== "json" && (L.responseType = i.responseType), l && ([w, M] = g0(l, !0), L.addEventListener("progress", w)), u && L.upload && ([p, A] = g0(u), L.upload.addEventListener("progress", p), L.upload.addEventListener("loadend", A)), (i.cancelToken || i.signal) && (d = (H) => { L && (n(!H || H.type ? new Hu(null, t, L) : H), L.abort(), L = null); }, i.cancelToken && i.cancelToken.subscribe(d), i.signal && (i.signal.aborted ? d() : i.signal.addEventListener("abort", d))); - const B = OX(i.url); - if (B && Jn.protocols.indexOf(B) === -1) { - n(new or("Unsupported protocol " + B + ":", or.ERR_BAD_REQUEST, t)); + const $ = NX(i.url); + if ($ && Xn.protocols.indexOf($) === -1) { + n(new or("Unsupported protocol " + $ + ":", or.ERR_BAD_REQUEST, t)); return; } L.send(s || null); }); -}, qX = (t, e) => { +}, zX = (t, e) => { const { length: r } = t = t ? t.filter(Boolean) : []; if (e || r) { let n = new AbortController(), i; @@ -30095,7 +30095,7 @@ const LS = (t) => { const { signal: u } = n; return u.unsubscribe = () => Oe.asap(a), u; } -}, zX = function* (t, e) { +}, WX = function* (t, e) { let r = t.byteLength; if (r < e) { yield t; @@ -30104,10 +30104,10 @@ const LS = (t) => { let n = 0, i; for (; n < r; ) i = n + e, yield t.slice(n, i), n = i; -}, WX = async function* (t, e) { - for await (const r of HX(t)) - yield* zX(r, e); -}, HX = async function* (t) { +}, HX = async function* (t, e) { + for await (const r of KX(t)) + yield* WX(r, e); +}, KX = async function* (t) { if (t[Symbol.asyncIterator]) { yield* t; return; @@ -30123,8 +30123,8 @@ const LS = (t) => { } finally { await e.cancel(); } -}, q6 = (t, e, r, n) => { - const i = WX(t, e); +}, j6 = (t, e, r, n) => { + const i = HX(t, e); let s = 0, o, a = (u) => { o || (o = !0, n && n(u)); }; @@ -30152,15 +30152,15 @@ const LS = (t) => { }, { highWaterMark: 2 }); -}, pp = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", kS = pp && typeof ReadableStream == "function", KX = pp && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), $S = (t, ...e) => { +}, pp = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", NS = pp && typeof ReadableStream == "function", VX = pp && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), LS = (t, ...e) => { try { return !!t(...e); } catch { return !1; } -}, VX = kS && $S(() => { +}, GX = NS && LS(() => { let t = !1; - const e = new Request(Jn.origin, { + const e = new Request(Xn.origin, { body: new ReadableStream(), method: "POST", get duplex() { @@ -30168,7 +30168,7 @@ const LS = (t) => { } }).headers.has("Content-Type"); return t && !e; -}), z6 = 64 * 1024, V1 = kS && $S(() => Oe.isReadableStream(new Response("").body)), m0 = { +}), U6 = 64 * 1024, V1 = NS && LS(() => Oe.isReadableStream(new Response("").body)), m0 = { stream: V1 && ((t) => t.body) }; pp && ((t) => { @@ -30178,24 +30178,24 @@ pp && ((t) => { }); }); })(new Response()); -const GX = async (t) => { +const YX = async (t) => { if (t == null) return 0; if (Oe.isBlob(t)) return t.size; if (Oe.isSpecCompliantForm(t)) - return (await new Request(Jn.origin, { + return (await new Request(Xn.origin, { method: "POST", body: t }).arrayBuffer()).byteLength; if (Oe.isArrayBufferView(t) || Oe.isArrayBuffer(t)) return t.byteLength; if (Oe.isURLSearchParams(t) && (t = t + ""), Oe.isString(t)) - return (await KX(t)).byteLength; -}, YX = async (t, e) => { + return (await VX(t)).byteLength; +}, JX = async (t, e) => { const r = Oe.toFiniteNumber(t.getContentLength()); - return r ?? GX(e); -}, JX = pp && (async (t) => { + return r ?? YX(e); +}, XX = pp && (async (t) => { let { url: e, method: r, @@ -30209,81 +30209,81 @@ const GX = async (t) => { headers: d, withCredentials: p = "same-origin", fetchOptions: w - } = LS(t); + } = OS(t); l = l ? (l + "").toLowerCase() : "text"; - let A = qX([i, s && s.toAbortSignal()], o), P; + let A = zX([i, s && s.toAbortSignal()], o), M; const N = A && A.unsubscribe && (() => { A.unsubscribe(); }); let L; try { - if (u && VX && r !== "get" && r !== "head" && (L = await YX(d, n)) !== 0) { + if (u && GX && r !== "get" && r !== "head" && (L = await JX(d, n)) !== 0) { let V = new Request(e, { method: "POST", body: n, duplex: "half" }), te; if (Oe.isFormData(n) && (te = V.headers.get("content-type")) && d.setContentType(te), V.body) { - const [R, K] = F6( + const [R, K] = $6( L, - g0(j6(u)) + g0(B6(u)) ); - n = q6(V.body, z6, R, K); + n = j6(V.body, U6, R, K); } } Oe.isString(p) || (p = p ? "include" : "omit"); - const $ = "credentials" in Request.prototype; - P = new Request(e, { + const B = "credentials" in Request.prototype; + M = new Request(e, { ...w, signal: A, method: r.toUpperCase(), headers: d.normalize().toJSON(), body: n, duplex: "half", - credentials: $ ? p : void 0 + credentials: B ? p : void 0 }); - let B = await fetch(P); + let $ = await fetch(M); const H = V1 && (l === "stream" || l === "response"); if (V1 && (a || H && N)) { const V = {}; ["status", "statusText", "headers"].forEach((ge) => { - V[ge] = B[ge]; + V[ge] = $[ge]; }); - const te = Oe.toFiniteNumber(B.headers.get("content-length")), [R, K] = a && F6( + const te = Oe.toFiniteNumber($.headers.get("content-length")), [R, K] = a && $6( te, - g0(j6(a), !0) + g0(B6(a), !0) ) || []; - B = new Response( - q6(B.body, z6, R, () => { + $ = new Response( + j6($.body, U6, R, () => { K && K(), N && N(); }), V ); } l = l || "text"; - let W = await m0[Oe.findKey(m0, l) || "text"](B, t); + let W = await m0[Oe.findKey(m0, l) || "text"]($, t); return !H && N && N(), await new Promise((V, te) => { - OS(V, te, { + RS(V, te, { data: W, - headers: yi.from(B.headers), - status: B.status, - statusText: B.statusText, + headers: yi.from($.headers), + status: $.status, + statusText: $.statusText, config: t, - request: P + request: M }); }); - } catch ($) { - throw N && N(), $ && $.name === "TypeError" && /fetch/i.test($.message) ? Object.assign( - new or("Network Error", or.ERR_NETWORK, t, P), + } catch (B) { + throw N && N(), B && B.name === "TypeError" && /fetch/i.test(B.message) ? Object.assign( + new or("Network Error", or.ERR_NETWORK, t, M), { - cause: $.cause || $ + cause: B.cause || B } - ) : or.from($, $ && $.code, t, P); + ) : or.from(B, B && B.code, t, M); } }), G1 = { - http: lX, - xhr: UX, - fetch: JX + http: hX, + xhr: qX, + fetch: XX }; Oe.forEach(G1, (t, e) => { if (t) { @@ -30294,7 +30294,7 @@ Oe.forEach(G1, (t, e) => { Object.defineProperty(t, "adapterName", { value: e }); } }); -const W6 = (t) => `- ${t}`, XX = (t) => Oe.isFunction(t) || t === null || t === !1, BS = { +const q6 = (t) => `- ${t}`, ZX = (t) => Oe.isFunction(t) || t === null || t === !1, kS = { getAdapter: (t) => { t = Oe.isArray(t) ? t : [t]; const { length: e } = t; @@ -30303,7 +30303,7 @@ const W6 = (t) => `- ${t}`, XX = (t) => Oe.isFunction(t) || t === null || t === for (let s = 0; s < e; s++) { r = t[s]; let o; - if (n = r, !XX(r) && (n = G1[(o = String(r)).toLowerCase()], n === void 0)) + if (n = r, !ZX(r) && (n = G1[(o = String(r)).toLowerCase()], n === void 0)) throw new or(`Unknown adapter '${o}'`); if (n) break; @@ -30314,8 +30314,8 @@ const W6 = (t) => `- ${t}`, XX = (t) => Oe.isFunction(t) || t === null || t === ([a, u]) => `adapter ${a} ` + (u === !1 ? "is not supported by the environment" : "is not available in the build") ); let o = e ? s.length > 1 ? `since : -` + s.map(W6).join(` -`) : " " + W6(s[0]) : "as no adapter specified"; +` + s.map(q6).join(` +`) : " " + q6(s[0]) : "as no adapter specified"; throw new or( "There is no suitable adapter to dispatch the request " + o, "ERR_NOT_SUPPORT" @@ -30329,34 +30329,34 @@ function Rm(t) { if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted) throw new Hu(null, t); } -function H6(t) { +function z6(t) { return Rm(t), t.headers = yi.from(t.headers), t.data = Tm.call( t, t.transformRequest - ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), BS.getAdapter(t.adapter || oh.adapter)(t).then(function(n) { + ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), kS.getAdapter(t.adapter || oh.adapter)(t).then(function(n) { return Rm(t), n.data = Tm.call( t, t.transformResponse, n ), n.headers = yi.from(n.headers), n; }, function(n) { - return DS(n) || (Rm(t), n && n.response && (n.response.data = Tm.call( + return TS(n) || (Rm(t), n && n.response && (n.response.data = Tm.call( t, t.transformResponse, n.response ), n.response.headers = yi.from(n.response.headers))), Promise.reject(n); }); } -const FS = "1.7.8", gp = {}; +const $S = "1.7.8", gp = {}; ["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => { gp[t] = function(n) { return typeof n === t || "a" + (e < 1 ? "n " : " ") + t; }; }); -const K6 = {}; +const W6 = {}; gp.transitional = function(e, r, n) { function i(s, o) { - return "[Axios v" + FS + "] Transitional option '" + s + "'" + o + (n ? ". " + n : ""); + return "[Axios v" + $S + "] Transitional option '" + s + "'" + o + (n ? ". " + n : ""); } return (s, o, a) => { if (e === !1) @@ -30364,7 +30364,7 @@ gp.transitional = function(e, r, n) { i(o, " has been removed" + (r ? " in " + r : "")), or.ERR_DEPRECATED ); - return r && !K6[o] && (K6[o] = !0, console.warn( + return r && !W6[o] && (W6[o] = !0, console.warn( i( o, " has been deprecated since v" + r + " and will be removed in the near future" @@ -30375,7 +30375,7 @@ gp.transitional = function(e, r, n) { gp.spelling = function(e) { return (r, n) => (console.warn(`${n} is likely a misspelling of ${e}`), !0); }; -function ZX(t, e, r) { +function QX(t, e, r) { if (typeof t != "object") throw new or("options must be an object", or.ERR_BAD_OPTION_VALUE); const n = Object.keys(t); @@ -30393,14 +30393,14 @@ function ZX(t, e, r) { } } const Bd = { - assertOptions: ZX, + assertOptions: QX, validators: gp }, Bs = Bd.validators; -let cc = class { +let ac = class { constructor(e) { this.defaults = e, this.interceptors = { - request: new $6(), - response: new $6() + request: new L6(), + response: new L6() }; } /** @@ -30429,7 +30429,7 @@ let cc = class { } } _request(e, r) { - typeof e == "string" ? (r = r || {}, r.url = e) : r = e || {}, r = mc(this.defaults, r); + typeof e == "string" ? (r = r || {}, r.url = e) : r = e || {}, r = gc(this.defaults, r); const { transitional: n, paramsSerializer: i, headers: s } = r; n !== void 0 && Bd.assertOptions(n, { silentJSONParsing: Bs.transitional(Bs.boolean), @@ -30450,8 +30450,8 @@ let cc = class { ); s && Oe.forEach( ["delete", "get", "head", "post", "put", "patch", "common"], - (P) => { - delete s[P]; + (M) => { + delete s[M]; } ), r.headers = yi.concat(o, s); const a = []; @@ -30465,40 +30465,40 @@ let cc = class { }); let d, p = 0, w; if (!u) { - const P = [H6.bind(this), void 0]; - for (P.unshift.apply(P, a), P.push.apply(P, l), w = P.length, d = Promise.resolve(r); p < w; ) - d = d.then(P[p++], P[p++]); + const M = [z6.bind(this), void 0]; + for (M.unshift.apply(M, a), M.push.apply(M, l), w = M.length, d = Promise.resolve(r); p < w; ) + d = d.then(M[p++], M[p++]); return d; } w = a.length; let A = r; for (p = 0; p < w; ) { - const P = a[p++], N = a[p++]; + const M = a[p++], N = a[p++]; try { - A = P(A); + A = M(A); } catch (L) { N.call(this, L); break; } } try { - d = H6.call(this, A); - } catch (P) { - return Promise.reject(P); + d = z6.call(this, A); + } catch (M) { + return Promise.reject(M); } for (p = 0, w = l.length; p < w; ) d = d.then(l[p++], l[p++]); return d; } getUri(e) { - e = mc(this.defaults, e); - const r = NS(e.baseURL, e.url); - return CS(r, e.params, e.paramsSerializer); + e = gc(this.defaults, e); + const r = DS(e.baseURL, e.url); + return MS(r, e.params, e.paramsSerializer); } }; Oe.forEach(["delete", "get", "head", "options"], function(e) { - cc.prototype[e] = function(r, n) { - return this.request(mc(n || {}, { + ac.prototype[e] = function(r, n) { + return this.request(gc(n || {}, { method: e, url: r, data: (n || {}).data @@ -30508,7 +30508,7 @@ Oe.forEach(["delete", "get", "head", "options"], function(e) { Oe.forEach(["post", "put", "patch"], function(e) { function r(n) { return function(s, o, a) { - return this.request(mc(a || {}, { + return this.request(gc(a || {}, { method: e, headers: n ? { "Content-Type": "multipart/form-data" @@ -30518,9 +30518,9 @@ Oe.forEach(["post", "put", "patch"], function(e) { })); }; } - cc.prototype[e] = r(), cc.prototype[e + "Form"] = r(!0); + ac.prototype[e] = r(), ac.prototype[e + "Form"] = r(!0); }); -let QX = class jS { +let eZ = class BS { constructor(e) { if (typeof e != "function") throw new TypeError("executor must be a function."); @@ -30586,19 +30586,19 @@ let QX = class jS { static source() { let e; return { - token: new jS(function(i) { + token: new BS(function(i) { e = i; }), cancel: e }; } }; -function eZ(t) { +function tZ(t) { return function(r) { return t.apply(null, r); }; } -function tZ(t) { +function rZ(t) { return Oe.isObject(t) && t.isAxiosError === !0; } const Y1 = { @@ -30669,50 +30669,50 @@ const Y1 = { Object.entries(Y1).forEach(([t, e]) => { Y1[e] = t; }); -function US(t) { - const e = new cc(t), r = vS(cc.prototype.request, e); - return Oe.extend(r, cc.prototype, e, { allOwnKeys: !0 }), Oe.extend(r, e, null, { allOwnKeys: !0 }), r.create = function(i) { - return US(mc(t, i)); +function FS(t) { + const e = new ac(t), r = gS(ac.prototype.request, e); + return Oe.extend(r, ac.prototype, e, { allOwnKeys: !0 }), Oe.extend(r, e, null, { allOwnKeys: !0 }), r.create = function(i) { + return FS(gc(t, i)); }, r; } -const mn = US(oh); -mn.Axios = cc; +const mn = FS(oh); +mn.Axios = ac; mn.CanceledError = Hu; -mn.CancelToken = QX; -mn.isCancel = DS; -mn.VERSION = FS; +mn.CancelToken = eZ; +mn.isCancel = TS; +mn.VERSION = $S; mn.toFormData = dp; mn.AxiosError = or; mn.Cancel = mn.CanceledError; mn.all = function(e) { return Promise.all(e); }; -mn.spread = eZ; -mn.isAxiosError = tZ; -mn.mergeConfig = mc; +mn.spread = tZ; +mn.isAxiosError = rZ; +mn.mergeConfig = gc; mn.AxiosHeaders = yi; -mn.formToJSON = (t) => RS(Oe.isHTMLForm(t) ? new FormData(t) : t); -mn.getAdapter = BS.getAdapter; +mn.formToJSON = (t) => CS(Oe.isHTMLForm(t) ? new FormData(t) : t); +mn.getAdapter = kS.getAdapter; mn.HttpStatusCode = Y1; mn.default = mn; const { - Axios: eoe, - AxiosError: rZ, - CanceledError: toe, - isCancel: roe, - CancelToken: noe, - VERSION: ioe, - all: soe, - Cancel: ooe, - isAxiosError: aoe, - spread: coe, - toFormData: uoe, - AxiosHeaders: foe, - HttpStatusCode: loe, - formToJSON: hoe, - getAdapter: doe, - mergeConfig: poe -} = mn, qS = mn.create({ + Axios: noe, + AxiosError: jS, + CanceledError: ioe, + isCancel: soe, + CancelToken: ooe, + VERSION: aoe, + all: coe, + Cancel: uoe, + isAxiosError: foe, + spread: loe, + toFormData: hoe, + AxiosHeaders: doe, + HttpStatusCode: poe, + formToJSON: goe, + getAdapter: moe, + mergeConfig: voe +} = mn, US = mn.create({ timeout: 6e4, headers: { "Content-Type": "application/json", @@ -30722,7 +30722,7 @@ const { function nZ(t) { var e, r, n; if (((e = t.data) == null ? void 0 : e.success) !== !0) { - const i = new rZ( + const i = new jS( (r = t.data) == null ? void 0 : r.errorMessage, (n = t.data) == null ? void 0 : n.errorCode, t.config, @@ -30733,10 +30733,28 @@ function nZ(t) { } else return t; } -qS.interceptors.response.use( - nZ +function iZ(t) { + var r; + console.log(t); + const e = (r = t.response) == null ? void 0 : r.data; + if (e) { + console.log(e, "responseData"); + const n = new jS( + e.errorMessage, + t.code, + t.config, + t.request, + t.response + ); + return Promise.reject(n); + } else + return Promise.reject(t); +} +US.interceptors.response.use( + nZ, + iZ ); -class iZ { +class sZ { constructor(e) { Ds(this, "_apiBase", ""); this.request = e; @@ -30748,9 +30766,11 @@ class iZ { const { data: r } = await this.request.post(`${this._apiBase}/api/v2/user/nonce`, e); return r.data; } - async getEmailCode(e) { - const { data: r } = await this.request.post(`${this._apiBase}/api/v2/user/get_code`, e); - return r.data; + async getEmailCode(e, r) { + const { data: n } = await this.request.post(`${this._apiBase}/api/v2/user/get_code`, e, { + headers: { "Captcha-Param": r } + }); + return n.data; } async emailLogin(e) { return (await this.request.post(`${this._apiBase}/api/v2/user/login`, e)).data; @@ -30771,7 +30791,7 @@ class iZ { return (await this.request.post("/api/v2/user/account/bind", e)).data; } } -const qo = new iZ(qS), sZ = { +const Ta = new sZ(US), oZ = { projectId: "7a4434fefbcc9af474fb5c995e47d286", metadata: { name: "codatta", @@ -30779,10 +30799,10 @@ const qo = new iZ(qS), sZ = { url: "https://codatta.io/", icons: ["https://avatars.githubusercontent.com/u/171659315"] } -}, oZ = AJ({ +}, aZ = PJ({ appName: "codatta", appLogoUrl: "https://avatars.githubusercontent.com/u/171659315" -}), zS = Ma({ +}), qS = Sa({ saveLastUsedWallet: () => { }, lastUsedWallet: null, @@ -30791,41 +30811,41 @@ const qo = new iZ(qS), sZ = { featuredWallets: [] }); function mp() { - return Tn(zS); + return Tn(qS); } -function goe(t) { - const { apiBaseUrl: e } = t, [r, n] = Gt([]), [i, s] = Gt([]), [o, a] = Gt(null), [u, l] = Gt(!1), d = (A) => { +function boe(t) { + const { apiBaseUrl: e } = t, [r, n] = Qt([]), [i, s] = Qt([]), [o, a] = Qt(null), [u, l] = Qt(!1), d = (A) => { console.log("saveLastUsedWallet", A); }; function p(A) { - const P = A.filter(($) => $.featured || $.installed), N = A.filter(($) => !$.featured && !$.installed), L = [...P, ...N]; - n(L), s(P); + const M = A.filter((B) => B.featured || B.installed), N = A.filter((B) => !B.featured && !B.installed), L = [...M, ...N]; + n(L), s(M); } async function w() { - const A = [], P = /* @__PURE__ */ new Map(); - UR.forEach((L) => { - const $ = new vl(L); - L.name === "Coinbase Wallet" && $.EIP6963Detected({ + const A = [], M = /* @__PURE__ */ new Map(); + qR.forEach((L) => { + const B = new vl(L); + L.name === "Coinbase Wallet" && B.EIP6963Detected({ info: { name: "Coinbase Wallet", uuid: "coinbase", icon: L.image, rdns: "coinbase" }, - provider: oZ.getProvider() - }), P.set($.key, $), A.push($); - }), (await jG()).forEach((L) => { - const $ = P.get(L.info.name); - if ($) - $.EIP6963Detected(L); + provider: aZ.getProvider() + }), M.set(B.key, B), A.push(B); + }), (await UG()).forEach((L) => { + const B = M.get(L.info.name); + if (B) + B.EIP6963Detected(L); else { - const B = new vl(L); - P.set(B.key, B), A.push(B); + const $ = new vl(L); + M.set($.key, $), A.push($); } }); try { - const L = JSON.parse(localStorage.getItem("xn-last-used-info") || "{}"), $ = P.get(L.key); - if ($) { - if ($.lastUsed = !0, L.provider === "UniversalProvider") { - const B = await AE.init(sZ); - B.session && $.setUniversalProvider(B); + const L = JSON.parse(localStorage.getItem("xn-last-used-info") || "{}"), B = M.get(L.key); + if (B) { + if (B.lastUsed = !0, L.provider === "UniversalProvider") { + const $ = await EE.init(oZ); + $.session && B.setUniversalProvider($); } - a($); + a(B); } } catch (L) { console.log(L); @@ -30833,9 +30853,9 @@ function goe(t) { p(A), l(!0); } return Dn(() => { - w(), qo.setApiBase(e); - }, []), /* @__PURE__ */ fe.jsx( - zS.Provider, + w(), Ta.setApiBase(e); + }, []), /* @__PURE__ */ pe.jsx( + qS.Provider, { value: { saveLastUsedWallet: d, @@ -30854,14 +30874,14 @@ function goe(t) { * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const aZ = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), WS = (...t) => t.filter((e, r, n) => !!e && e.trim() !== "" && n.indexOf(e) === r).join(" ").trim(); +const cZ = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), zS = (...t) => t.filter((e, r, n) => !!e && e.trim() !== "" && n.indexOf(e) === r).join(" ").trim(); /** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -var cZ = { +var uZ = { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, @@ -30878,7 +30898,7 @@ var cZ = { * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const uZ = gv( +const fZ = gv( ({ color: t = "currentColor", size: e = 24, @@ -30892,12 +30912,12 @@ const uZ = gv( "svg", { ref: u, - ...cZ, + ...uZ, width: e, height: e, stroke: t, strokeWidth: n ? Number(r) * 24 / Number(e) : r, - className: WS("lucide", i), + className: zS("lucide", i), ...a }, [ @@ -30912,12 +30932,12 @@ const uZ = gv( * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const Ms = (t, e) => { +const us = (t, e) => { const r = gv( - ({ className: n, ...i }, s) => qd(uZ, { + ({ className: n, ...i }, s) => qd(fZ, { ref: s, iconNode: e, - className: WS(`lucide-${aZ(t)}`, n), + className: zS(`lucide-${cZ(t)}`, n), ...i }) ); @@ -30929,7 +30949,7 @@ const Ms = (t, e) => { * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const fZ = Ms("ArrowLeft", [ +const lZ = us("ArrowLeft", [ ["path", { d: "m12 19-7-7 7-7", key: "1l729n" }], ["path", { d: "M19 12H5", key: "x3x0zl" }] ]); @@ -30939,7 +30959,7 @@ const fZ = Ms("ArrowLeft", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const HS = Ms("ArrowRight", [ +const WS = us("ArrowRight", [ ["path", { d: "M5 12h14", key: "1ays0h" }], ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }] ]); @@ -30949,7 +30969,7 @@ const HS = Ms("ArrowRight", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const lZ = Ms("ChevronRight", [ +const hZ = us("ChevronRight", [ ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }] ]); /** @@ -30958,7 +30978,7 @@ const lZ = Ms("ChevronRight", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const hZ = Ms("CircleCheckBig", [ +const dZ = us("CircleCheckBig", [ ["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }], ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }] ]); @@ -30968,7 +30988,7 @@ const hZ = Ms("CircleCheckBig", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const dZ = Ms("Download", [ +const pZ = us("Download", [ ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }], ["polyline", { points: "7 10 12 15 17 10", key: "2ggqvy" }], ["line", { x1: "12", x2: "12", y1: "15", y2: "3", key: "1vk2je" }] @@ -30979,7 +30999,7 @@ const dZ = Ms("Download", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const pZ = Ms("Globe", [ +const gZ = us("Globe", [ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }], ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }], ["path", { d: "M2 12h20", key: "9i4pu4" }] @@ -30990,7 +31010,7 @@ const pZ = Ms("Globe", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const KS = Ms("Laptop", [ +const HS = us("Laptop", [ [ "path", { @@ -31005,7 +31025,7 @@ const KS = Ms("Laptop", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const gZ = Ms("Link2", [ +const mZ = us("Link2", [ ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }], ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }], ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }] @@ -31016,7 +31036,7 @@ const gZ = Ms("Link2", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const _a = Ms("LoaderCircle", [ +const mc = us("LoaderCircle", [ ["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }] ]); /** @@ -31025,7 +31045,7 @@ const _a = Ms("LoaderCircle", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const VS = Ms("Mail", [ +const vZ = us("Mail", [ ["rect", { width: "20", height: "16", x: "2", y: "4", rx: "2", key: "18n3k1" }], ["path", { d: "m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7", key: "1ocrg3" }] ]); @@ -31035,14 +31055,25 @@ const VS = Ms("Mail", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const GS = Ms("Search", [ +const KS = us("Search", [ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }], ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }] -]), V6 = /* @__PURE__ */ new Set(); +]); +/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */ +const bZ = us("UserRoundCheck", [ + ["path", { d: "M2 21a8 8 0 0 1 13.292-6", key: "bjp14o" }], + ["circle", { cx: "10", cy: "8", r: "5", key: "o932ke" }], + ["path", { d: "m16 19 2 2 4-4", key: "1b14m6" }] +]), H6 = /* @__PURE__ */ new Set(); function vp(t, e, r) { - t || V6.has(e) || (console.warn(e), V6.add(e)); + t || H6.has(e) || (console.warn(e), H6.add(e)); } -function mZ(t) { +function yZ(t) { if (typeof Proxy > "u") return t; const e = /* @__PURE__ */ new Map(), r = (...n) => (process.env.NODE_ENV !== "production" && vp(!1, "motion() is deprecated. Use motion.create() instead."), t(...n)); @@ -31059,7 +31090,7 @@ function bp(t) { return t !== null && typeof t == "object" && typeof t.start == "function"; } const J1 = (t) => Array.isArray(t); -function YS(t, e) { +function VS(t, e) { if (!Array.isArray(e)) return !1; const r = e.length; @@ -31073,7 +31104,7 @@ function YS(t, e) { function Il(t) { return typeof t == "string" || Array.isArray(t); } -function G6(t) { +function K6(t) { const e = [{}, {}]; return t == null || t.values.forEach((r, n) => { e[0][n] = r.get(), e[1][n] = r.getVelocity(); @@ -31081,11 +31112,11 @@ function G6(t) { } function Mb(t, e, r, n) { if (typeof e == "function") { - const [i, s] = G6(n); + const [i, s] = K6(n); e = e(r !== void 0 ? r : t.custom, i, s); } if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") { - const [i, s] = G6(n); + const [i, s] = K6(n); e = e(r !== void 0 ? r : t.custom, i, s); } return e; @@ -31120,36 +31151,36 @@ const Ib = [ "skew", "skewX", "skewY" -], Ac = new Set(ah), Vs = (t) => t * 1e3, Do = (t) => t / 1e3, vZ = { +], Ac = new Set(ah), Vs = (t) => t * 1e3, To = (t) => t / 1e3, wZ = { type: "spring", stiffness: 500, damping: 25, restSpeed: 10 -}, bZ = (t) => ({ +}, xZ = (t) => ({ type: "spring", stiffness: 550, damping: t === 0 ? 2 * Math.sqrt(550) : 30, restSpeed: 10 -}), yZ = { +}), _Z = { type: "keyframes", duration: 0.8 -}, wZ = { +}, EZ = { type: "keyframes", ease: [0.25, 0.1, 0.35, 1], duration: 0.3 -}, xZ = (t, { keyframes: e }) => e.length > 2 ? yZ : Ac.has(t) ? t.startsWith("scale") ? bZ(e[1]) : vZ : wZ; +}, SZ = (t, { keyframes: e }) => e.length > 2 ? _Z : Ac.has(t) ? t.startsWith("scale") ? xZ(e[1]) : wZ : EZ; function Tb(t, e) { return t ? t[e] || t.default || t : void 0; } -const _Z = { +const AZ = { useManualTiming: !1 -}, EZ = (t) => t !== null; +}, PZ = (t) => t !== null; function wp(t, { repeat: e, repeatType: r = "loop" }, n) { - const i = t.filter(EZ), s = e && r !== "loop" && e % 2 === 1 ? 0 : i.length - 1; + const i = t.filter(PZ), s = e && r !== "loop" && e % 2 === 1 ? 0 : i.length - 1; return !s || n === void 0 ? i[s] : n; } -const Un = (t) => t; -function SZ(t) { +const qn = (t) => t; +function MZ(t) { let e = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), n = !1, i = !1; const s = /* @__PURE__ */ new WeakSet(); let o = { @@ -31200,83 +31231,83 @@ const gd = [ // Write "postRender" // Compute -], AZ = 40; -function JS(t, e) { +], IZ = 40; +function GS(t, e) { let r = !1, n = !0; const i = { delta: 0, timestamp: 0, isProcessing: !1 - }, s = () => r = !0, o = gd.reduce(($, B) => ($[B] = SZ(s), $), {}), { read: a, resolveKeyframes: u, update: l, preRender: d, render: p, postRender: w } = o, A = () => { - const $ = performance.now(); - r = !1, i.delta = n ? 1e3 / 60 : Math.max(Math.min($ - i.timestamp, AZ), 1), i.timestamp = $, i.isProcessing = !0, a.process(i), u.process(i), l.process(i), d.process(i), p.process(i), w.process(i), i.isProcessing = !1, r && e && (n = !1, t(A)); - }, P = () => { + }, s = () => r = !0, o = gd.reduce((B, $) => (B[$] = MZ(s), B), {}), { read: a, resolveKeyframes: u, update: l, preRender: d, render: p, postRender: w } = o, A = () => { + const B = performance.now(); + r = !1, i.delta = n ? 1e3 / 60 : Math.max(Math.min(B - i.timestamp, IZ), 1), i.timestamp = B, i.isProcessing = !0, a.process(i), u.process(i), l.process(i), d.process(i), p.process(i), w.process(i), i.isProcessing = !1, r && e && (n = !1, t(A)); + }, M = () => { r = !0, n = !0, i.isProcessing || t(A); }; - return { schedule: gd.reduce(($, B) => { - const H = o[B]; - return $[B] = (W, V = !1, te = !1) => (r || P(), H.schedule(W, V, te)), $; - }, {}), cancel: ($) => { - for (let B = 0; B < gd.length; B++) - o[gd[B]].cancel($); + return { schedule: gd.reduce((B, $) => { + const H = o[$]; + return B[$] = (W, V = !1, te = !1) => (r || M(), H.schedule(W, V, te)), B; + }, {}), cancel: (B) => { + for (let $ = 0; $ < gd.length; $++) + o[gd[$]].cancel(B); }, state: i, steps: o }; } -const { schedule: Lr, cancel: Ea, state: Fn, steps: Dm } = JS(typeof requestAnimationFrame < "u" ? requestAnimationFrame : Un, !0), XS = (t, e, r) => (((1 - 3 * r + 3 * e) * t + (3 * r - 6 * e)) * t + 3 * e) * t, PZ = 1e-7, MZ = 12; -function IZ(t, e, r, n, i) { +const { schedule: Lr, cancel: wa, state: Fn, steps: Dm } = GS(typeof requestAnimationFrame < "u" ? requestAnimationFrame : qn, !0), YS = (t, e, r) => (((1 - 3 * r + 3 * e) * t + (3 * r - 6 * e)) * t + 3 * e) * t, CZ = 1e-7, TZ = 12; +function RZ(t, e, r, n, i) { let s, o, a = 0; do - o = e + (r - e) / 2, s = XS(o, n, i) - t, s > 0 ? r = o : e = o; - while (Math.abs(s) > PZ && ++a < MZ); + o = e + (r - e) / 2, s = YS(o, n, i) - t, s > 0 ? r = o : e = o; + while (Math.abs(s) > CZ && ++a < TZ); return o; } function ch(t, e, r, n) { if (t === e && r === n) - return Un; - const i = (s) => IZ(s, 0, 1, t, r); - return (s) => s === 0 || s === 1 ? s : XS(i(s), e, n); + return qn; + const i = (s) => RZ(s, 0, 1, t, r); + return (s) => s === 0 || s === 1 ? s : YS(i(s), e, n); } -const ZS = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, QS = (t) => (e) => 1 - t(1 - e), e7 = /* @__PURE__ */ ch(0.33, 1.53, 0.69, 0.99), Rb = /* @__PURE__ */ QS(e7), t7 = /* @__PURE__ */ ZS(Rb), r7 = (t) => (t *= 2) < 1 ? 0.5 * Rb(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Db = (t) => 1 - Math.sin(Math.acos(t)), n7 = QS(Db), i7 = ZS(Db), s7 = (t) => /^0[^.\s]+$/u.test(t); -function CZ(t) { - return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || s7(t) : !0; +const JS = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, XS = (t) => (e) => 1 - t(1 - e), ZS = /* @__PURE__ */ ch(0.33, 1.53, 0.69, 0.99), Rb = /* @__PURE__ */ XS(ZS), QS = /* @__PURE__ */ JS(Rb), e7 = (t) => (t *= 2) < 1 ? 0.5 * Rb(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Db = (t) => 1 - Math.sin(Math.acos(t)), t7 = XS(Db), r7 = JS(Db), n7 = (t) => /^0[^.\s]+$/u.test(t); +function DZ(t) { + return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || n7(t) : !0; } -let Ku = Un, zo = Un; +let Ku = qn, Uo = qn; process.env.NODE_ENV !== "production" && (Ku = (t, e) => { !t && typeof console < "u" && console.warn(e); -}, zo = (t, e) => { +}, Uo = (t, e) => { if (!t) throw new Error(e); }); -const o7 = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), a7 = (t) => (e) => typeof e == "string" && e.startsWith(t), c7 = /* @__PURE__ */ a7("--"), TZ = /* @__PURE__ */ a7("var(--"), Ob = (t) => TZ(t) ? RZ.test(t.split("/*")[0].trim()) : !1, RZ = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, DZ = ( +const i7 = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), s7 = (t) => (e) => typeof e == "string" && e.startsWith(t), o7 = /* @__PURE__ */ s7("--"), OZ = /* @__PURE__ */ s7("var(--"), Ob = (t) => OZ(t) ? NZ.test(t.split("/*")[0].trim()) : !1, NZ = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, LZ = ( // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u ); -function OZ(t) { - const e = DZ.exec(t); +function kZ(t) { + const e = LZ.exec(t); if (!e) return [,]; const [, r, n, i] = e; return [`--${r ?? n}`, i]; } -const NZ = 4; -function u7(t, e, r = 1) { - zo(r <= NZ, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`); - const [n, i] = OZ(t); +const $Z = 4; +function a7(t, e, r = 1) { + Uo(r <= $Z, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`); + const [n, i] = kZ(t); if (!n) return; const s = window.getComputedStyle(e).getPropertyValue(n); if (s) { const o = s.trim(); - return o7(o) ? parseFloat(o) : o; + return i7(o) ? parseFloat(o) : o; } - return Ob(i) ? u7(i, e, r + 1) : i; + return Ob(i) ? a7(i, e, r + 1) : i; } -const Sa = (t, e, r) => r > e ? e : r < t ? t : r, Vu = { +const xa = (t, e, r) => r > e ? e : r < t ? t : r, Vu = { test: (t) => typeof t == "number", parse: parseFloat, transform: (t) => t }, Cl = { ...Vu, - transform: (t) => Sa(0, 1, t) + transform: (t) => xa(0, 1, t) }, md = { ...Vu, default: 1 @@ -31284,11 +31315,11 @@ const Sa = (t, e, r) => r > e ? e : r < t ? t : r, Vu = { test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1, parse: parseFloat, transform: (e) => `${e}${t}` -}), ca = /* @__PURE__ */ uh("deg"), Gs = /* @__PURE__ */ uh("%"), Vt = /* @__PURE__ */ uh("px"), LZ = /* @__PURE__ */ uh("vh"), kZ = /* @__PURE__ */ uh("vw"), Y6 = { +}), oa = /* @__PURE__ */ uh("deg"), Gs = /* @__PURE__ */ uh("%"), Vt = /* @__PURE__ */ uh("px"), BZ = /* @__PURE__ */ uh("vh"), FZ = /* @__PURE__ */ uh("vw"), V6 = { ...Gs, parse: (t) => Gs.parse(t) / 100, transform: (t) => Gs.transform(t * 100) -}, $Z = /* @__PURE__ */ new Set([ +}, jZ = /* @__PURE__ */ new Set([ "width", "height", "top", @@ -31299,20 +31330,20 @@ const Sa = (t, e, r) => r > e ? e : r < t ? t : r, Vu = { "y", "translateX", "translateY" -]), J6 = (t) => t === Vu || t === Vt, X6 = (t, e) => parseFloat(t.split(", ")[e]), Z6 = (t, e) => (r, { transform: n }) => { +]), G6 = (t) => t === Vu || t === Vt, Y6 = (t, e) => parseFloat(t.split(", ")[e]), J6 = (t, e) => (r, { transform: n }) => { if (n === "none" || !n) return 0; const i = n.match(/^matrix3d\((.+)\)$/u); if (i) - return X6(i[1], e); + return Y6(i[1], e); { const s = n.match(/^matrix\((.+)\)$/u); - return s ? X6(s[1], t) : 0; + return s ? Y6(s[1], t) : 0; } -}, BZ = /* @__PURE__ */ new Set(["x", "y", "z"]), FZ = ah.filter((t) => !BZ.has(t)); -function jZ(t) { +}, UZ = /* @__PURE__ */ new Set(["x", "y", "z"]), qZ = ah.filter((t) => !UZ.has(t)); +function zZ(t) { const e = []; - return FZ.forEach((r) => { + return qZ.forEach((r) => { const n = t.getValue(r); n !== void 0 && (e.push([r, n.get()]), n.set(r.startsWith("scale") ? 1 : 0)); }), e; @@ -31326,21 +31357,21 @@ const Mu = { bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min), right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min), // Transform - x: Z6(4, 13), - y: Z6(5, 14) + x: J6(4, 13), + y: J6(5, 14) }; Mu.translateX = Mu.x; Mu.translateY = Mu.y; -const f7 = (t) => (e) => e.test(t), UZ = { +const c7 = (t) => (e) => e.test(t), WZ = { test: (t) => t === "auto", parse: (t) => t -}, l7 = [Vu, Vt, Gs, ca, kZ, LZ, UZ], Q6 = (t) => l7.find(f7(t)), uc = /* @__PURE__ */ new Set(); +}, u7 = [Vu, Vt, Gs, oa, FZ, BZ, WZ], X6 = (t) => u7.find(c7(t)), cc = /* @__PURE__ */ new Set(); let X1 = !1, Z1 = !1; -function h7() { +function f7() { if (Z1) { - const t = Array.from(uc).filter((n) => n.needsMeasurement), e = new Set(t.map((n) => n.element)), r = /* @__PURE__ */ new Map(); + const t = Array.from(cc).filter((n) => n.needsMeasurement), e = new Set(t.map((n) => n.element)), r = /* @__PURE__ */ new Map(); e.forEach((n) => { - const i = jZ(n); + const i = zZ(n); i.length && (r.set(n, i), n.render()); }), t.forEach((n) => n.measureInitialState()), e.forEach((n) => { n.render(); @@ -31353,22 +31384,22 @@ function h7() { n.suspendedScrollY !== void 0 && window.scrollTo(0, n.suspendedScrollY); }); } - Z1 = !1, X1 = !1, uc.forEach((t) => t.complete()), uc.clear(); + Z1 = !1, X1 = !1, cc.forEach((t) => t.complete()), cc.clear(); } -function d7() { - uc.forEach((t) => { +function l7() { + cc.forEach((t) => { t.readKeyframes(), t.needsMeasurement && (Z1 = !0); }); } -function qZ() { - d7(), h7(); +function HZ() { + l7(), f7(); } class Nb { constructor(e, r, n, i, s, o = !1) { this.isComplete = !1, this.isAsync = !1, this.needsMeasurement = !1, this.isScheduled = !1, this.unresolvedKeyframes = [...e], this.onComplete = r, this.name = n, this.motionValue = i, this.element = s, this.isAsync = o; } scheduleResolve() { - this.isScheduled = !0, this.isAsync ? (uc.add(this), X1 || (X1 = !0, Lr.read(d7), Lr.resolveKeyframes(h7))) : (this.readKeyframes(), this.complete()); + this.isScheduled = !0, this.isAsync ? (cc.add(this), X1 || (X1 = !0, Lr.read(l7), Lr.resolveKeyframes(f7))) : (this.readKeyframes(), this.complete()); } readKeyframes() { const { unresolvedKeyframes: e, name: r, element: n, motionValue: i } = this; @@ -31395,20 +31426,20 @@ class Nb { measureEndState() { } complete() { - this.isComplete = !0, this.onComplete(this.unresolvedKeyframes, this.finalKeyframe), uc.delete(this); + this.isComplete = !0, this.onComplete(this.unresolvedKeyframes, this.finalKeyframe), cc.delete(this); } cancel() { - this.isComplete || (this.isScheduled = !1, uc.delete(this)); + this.isComplete || (this.isScheduled = !1, cc.delete(this)); } resume() { this.isComplete || this.scheduleResolve(); } } const Yf = (t) => Math.round(t * 1e5) / 1e5, Lb = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; -function zZ(t) { +function KZ(t) { return t == null; } -const WZ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, kb = (t, e) => (r) => !!(typeof r == "string" && WZ.test(r) && r.startsWith(t) || e && !zZ(r) && Object.prototype.hasOwnProperty.call(r, e)), p7 = (t, e, r) => (n) => { +const VZ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, kb = (t, e) => (r) => !!(typeof r == "string" && VZ.test(r) && r.startsWith(t) || e && !KZ(r) && Object.prototype.hasOwnProperty.call(r, e)), h7 = (t, e, r) => (n) => { if (typeof n != "string") return n; const [i, s, o, a] = n.match(Lb); @@ -31418,15 +31449,15 @@ const WZ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s [r]: parseFloat(o), alpha: a !== void 0 ? parseFloat(a) : 1 }; -}, HZ = (t) => Sa(0, 255, t), Om = { +}, GZ = (t) => xa(0, 255, t), Om = { ...Vu, - transform: (t) => Math.round(HZ(t)) -}, oc = { + transform: (t) => Math.round(GZ(t)) +}, sc = { test: /* @__PURE__ */ kb("rgb", "red"), - parse: /* @__PURE__ */ p7("red", "green", "blue"), + parse: /* @__PURE__ */ h7("red", "green", "blue"), transform: ({ red: t, green: e, blue: r, alpha: n = 1 }) => "rgba(" + Om.transform(t) + ", " + Om.transform(e) + ", " + Om.transform(r) + ", " + Yf(Cl.transform(n)) + ")" }; -function KZ(t) { +function YZ(t) { let e = "", r = "", n = "", i = ""; return t.length > 5 ? (e = t.substring(1, 3), r = t.substring(3, 5), n = t.substring(5, 7), i = t.substring(7, 9)) : (e = t.substring(1, 2), r = t.substring(2, 3), n = t.substring(3, 4), i = t.substring(4, 5), e += e, r += r, n += n, i += i), { red: parseInt(e, 16), @@ -31437,22 +31468,22 @@ function KZ(t) { } const Q1 = { test: /* @__PURE__ */ kb("#"), - parse: KZ, - transform: oc.transform + parse: YZ, + transform: sc.transform }, eu = { test: /* @__PURE__ */ kb("hsl", "hue"), - parse: /* @__PURE__ */ p7("hue", "saturation", "lightness"), + parse: /* @__PURE__ */ h7("hue", "saturation", "lightness"), transform: ({ hue: t, saturation: e, lightness: r, alpha: n = 1 }) => "hsla(" + Math.round(t) + ", " + Gs.transform(Yf(e)) + ", " + Gs.transform(Yf(r)) + ", " + Yf(Cl.transform(n)) + ")" -}, Yn = { - test: (t) => oc.test(t) || Q1.test(t) || eu.test(t), - parse: (t) => oc.test(t) ? oc.parse(t) : eu.test(t) ? eu.parse(t) : Q1.parse(t), - transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? oc.transform(t) : eu.transform(t) -}, VZ = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu; -function GZ(t) { +}, Jn = { + test: (t) => sc.test(t) || Q1.test(t) || eu.test(t), + parse: (t) => sc.test(t) ? sc.parse(t) : eu.test(t) ? eu.parse(t) : Q1.parse(t), + transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? sc.transform(t) : eu.transform(t) +}, JZ = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu; +function XZ(t) { var e, r; - return isNaN(t) && typeof t == "string" && (((e = t.match(Lb)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match(VZ)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; + return isNaN(t) && typeof t == "string" && (((e = t.match(Lb)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match(JZ)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; } -const g7 = "number", m7 = "color", YZ = "var", JZ = "var(", e_ = "${}", XZ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; +const d7 = "number", p7 = "color", ZZ = "var", QZ = "var(", Z6 = "${}", eQ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; function Tl(t) { const e = t.toString(), r = [], n = { color: [], @@ -31460,36 +31491,36 @@ function Tl(t) { var: [] }, i = []; let s = 0; - const a = e.replace(XZ, (u) => (Yn.test(u) ? (n.color.push(s), i.push(m7), r.push(Yn.parse(u))) : u.startsWith(JZ) ? (n.var.push(s), i.push(YZ), r.push(u)) : (n.number.push(s), i.push(g7), r.push(parseFloat(u))), ++s, e_)).split(e_); + const a = e.replace(eQ, (u) => (Jn.test(u) ? (n.color.push(s), i.push(p7), r.push(Jn.parse(u))) : u.startsWith(QZ) ? (n.var.push(s), i.push(ZZ), r.push(u)) : (n.number.push(s), i.push(d7), r.push(parseFloat(u))), ++s, Z6)).split(Z6); return { values: r, split: a, indexes: n, types: i }; } -function v7(t) { +function g7(t) { return Tl(t).values; } -function b7(t) { +function m7(t) { const { split: e, types: r } = Tl(t), n = e.length; return (i) => { let s = ""; for (let o = 0; o < n; o++) if (s += e[o], i[o] !== void 0) { const a = r[o]; - a === g7 ? s += Yf(i[o]) : a === m7 ? s += Yn.transform(i[o]) : s += i[o]; + a === d7 ? s += Yf(i[o]) : a === p7 ? s += Jn.transform(i[o]) : s += i[o]; } return s; }; } -const ZZ = (t) => typeof t == "number" ? 0 : t; -function QZ(t) { - const e = v7(t); - return b7(t)(e.map(ZZ)); -} -const Aa = { - test: GZ, - parse: v7, - createTransformer: b7, - getAnimatableNone: QZ -}, eQ = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]); -function tQ(t) { +const tQ = (t) => typeof t == "number" ? 0 : t; +function rQ(t) { + const e = g7(t); + return m7(t)(e.map(tQ)); +} +const _a = { + test: XZ, + parse: g7, + createTransformer: m7, + getAnimatableNone: rQ +}, nQ = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]); +function iQ(t) { const [e, r] = t.slice(0, -1).split("("); if (e === "drop-shadow") return t; @@ -31497,16 +31528,16 @@ function tQ(t) { if (!n) return t; const i = r.replace(n, ""); - let s = eQ.has(e) ? 1 : 0; + let s = nQ.has(e) ? 1 : 0; return n !== r && (s *= 100), e + "(" + s + i + ")"; } -const rQ = /\b([a-z-]*)\(.*?\)/gu, ev = { - ...Aa, +const sQ = /\b([a-z-]*)\(.*?\)/gu, ev = { + ..._a, getAnimatableNone: (t) => { - const e = t.match(rQ); - return e ? e.map(tQ).join(" ") : t; + const e = t.match(sQ); + return e ? e.map(iQ).join(" ") : t; } -}, nQ = { +}, oQ = { // Border props borderWidth: Vt, borderTopWidth: Vt, @@ -31542,18 +31573,18 @@ const rQ = /\b([a-z-]*)\(.*?\)/gu, ev = { // Misc backgroundPositionX: Vt, backgroundPositionY: Vt -}, iQ = { - rotate: ca, - rotateX: ca, - rotateY: ca, - rotateZ: ca, +}, aQ = { + rotate: oa, + rotateX: oa, + rotateY: oa, + rotateZ: oa, scale: md, scaleX: md, scaleY: md, scaleZ: md, - skew: ca, - skewX: ca, - skewY: ca, + skew: oa, + skewX: oa, + skewY: oa, distance: Vt, translateX: Vt, translateY: Vt, @@ -31564,54 +31595,54 @@ const rQ = /\b([a-z-]*)\(.*?\)/gu, ev = { perspective: Vt, transformPerspective: Vt, opacity: Cl, - originX: Y6, - originY: Y6, + originX: V6, + originY: V6, originZ: Vt -}, t_ = { +}, Q6 = { ...Vu, transform: Math.round }, $b = { - ...nQ, - ...iQ, - zIndex: t_, + ...oQ, + ...aQ, + zIndex: Q6, size: Vt, // SVG fillOpacity: Cl, strokeOpacity: Cl, - numOctaves: t_ -}, sQ = { + numOctaves: Q6 +}, cQ = { ...$b, // Color props - color: Yn, - backgroundColor: Yn, - outlineColor: Yn, - fill: Yn, - stroke: Yn, + color: Jn, + backgroundColor: Jn, + outlineColor: Jn, + fill: Jn, + stroke: Jn, // Border props - borderColor: Yn, - borderTopColor: Yn, - borderRightColor: Yn, - borderBottomColor: Yn, - borderLeftColor: Yn, + borderColor: Jn, + borderTopColor: Jn, + borderRightColor: Jn, + borderBottomColor: Jn, + borderLeftColor: Jn, filter: ev, WebkitFilter: ev -}, Bb = (t) => sQ[t]; -function y7(t, e) { +}, Bb = (t) => cQ[t]; +function v7(t, e) { let r = Bb(t); - return r !== ev && (r = Aa), r.getAnimatableNone ? r.getAnimatableNone(e) : void 0; + return r !== ev && (r = _a), r.getAnimatableNone ? r.getAnimatableNone(e) : void 0; } -const oQ = /* @__PURE__ */ new Set(["auto", "none", "0"]); -function aQ(t, e, r) { +const uQ = /* @__PURE__ */ new Set(["auto", "none", "0"]); +function fQ(t, e, r) { let n = 0, i; for (; n < t.length && !i; ) { const s = t[n]; - typeof s == "string" && !oQ.has(s) && Tl(s).values.length && (i = t[n]), n++; + typeof s == "string" && !uQ.has(s) && Tl(s).values.length && (i = t[n]), n++; } if (i && r) for (const s of e) - t[s] = y7(r, i); + t[s] = v7(r, i); } -class w7 extends Nb { +class b7 extends Nb { constructor(e, r, n, i, s) { super(e, r, n, i, s, !0); } @@ -31623,15 +31654,15 @@ class w7 extends Nb { for (let u = 0; u < e.length; u++) { let l = e[u]; if (typeof l == "string" && (l = l.trim(), Ob(l))) { - const d = u7(l, r.current); + const d = a7(l, r.current); d !== void 0 && (e[u] = d), u === e.length - 1 && (this.finalKeyframe = l); } } - if (this.resolveNoneKeyframes(), !$Z.has(n) || e.length !== 2) + if (this.resolveNoneKeyframes(), !jZ.has(n) || e.length !== 2) return; - const [i, s] = e, o = Q6(i), a = Q6(s); + const [i, s] = e, o = X6(i), a = X6(s); if (o !== a) - if (J6(o) && J6(a)) + if (G6(o) && G6(a)) for (let u = 0; u < e.length; u++) { const l = e[u]; typeof l == "string" && (e[u] = parseFloat(l)); @@ -31642,8 +31673,8 @@ class w7 extends Nb { resolveNoneKeyframes() { const { unresolvedKeyframes: e, name: r } = this, n = []; for (let i = 0; i < e.length; i++) - CZ(e[i]) && n.push(i); - n.length && aQ(e, n, r); + DZ(e[i]) && n.push(i); + n.length && fQ(e, n, r); } measureInitialState() { const { element: e, unresolvedKeyframes: r, name: n } = this; @@ -31670,18 +31701,18 @@ function Fb(t) { return typeof t == "function"; } let Fd; -function cQ() { +function lQ() { Fd = void 0; } const Ys = { - now: () => (Fd === void 0 && Ys.set(Fn.isProcessing || _Z.useManualTiming ? Fn.timestamp : performance.now()), Fd), + now: () => (Fd === void 0 && Ys.set(Fn.isProcessing || AZ.useManualTiming ? Fn.timestamp : performance.now()), Fd), set: (t) => { - Fd = t, queueMicrotask(cQ); + Fd = t, queueMicrotask(lQ); } -}, r_ = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string -(Aa.test(t) || t === "0") && // And it contains numbers and/or colors +}, e_ = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string +(_a.test(t) || t === "0") && // And it contains numbers and/or colors !t.startsWith("url(")); -function uQ(t) { +function hQ(t) { const e = t[0]; if (t.length === 1) return !0; @@ -31689,17 +31720,17 @@ function uQ(t) { if (t[r] !== e) return !0; } -function fQ(t, e, r, n) { +function dQ(t, e, r, n) { const i = t[0]; if (i === null) return !1; if (e === "display" || e === "visibility") return !0; - const s = t[t.length - 1], o = r_(i, e), a = r_(s, e); - return Ku(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : uQ(t) || (r === "spring" || Fb(r)) && n; + const s = t[t.length - 1], o = e_(i, e), a = e_(s, e); + return Ku(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : hQ(t) || (r === "spring" || Fb(r)) && n; } -const lQ = 40; -class x7 { +const pQ = 40; +class y7 { constructor({ autoplay: e = !0, delay: r = 0, type: n = "keyframes", repeat: i = 0, repeatDelay: s = 0, repeatType: o = "loop", ...a }) { this.isStopped = !1, this.hasAttemptedResolve = !1, this.createdAt = Ys.now(), this.options = { autoplay: e, @@ -31722,7 +31753,7 @@ class x7 { * to avoid a sudden jump into the animation. */ calcStartTime() { - return this.resolvedAt ? this.resolvedAt - this.createdAt > lQ ? this.resolvedAt : this.createdAt : this.createdAt; + return this.resolvedAt ? this.resolvedAt - this.createdAt > pQ ? this.resolvedAt : this.createdAt : this.createdAt; } /** * A getter for resolved data. If keyframes are not yet resolved, accessing @@ -31730,7 +31761,7 @@ class x7 { * This is a deoptimisation, but at its worst still batches read/writes. */ get resolved() { - return !this._resolved && !this.hasAttemptedResolve && qZ(), this._resolved; + return !this._resolved && !this.hasAttemptedResolve && HZ(), this._resolved; } /** * A method to be called when the keyframes resolver completes. This method @@ -31740,7 +31771,7 @@ class x7 { onKeyframesResolved(e, r) { this.resolvedAt = Ys.now(), this.hasAttemptedResolve = !0; const { name: n, type: i, velocity: s, delay: o, onComplete: a, onUpdate: u, isGenerator: l } = this.options; - if (!l && !fQ(e, n, i, s)) + if (!l && !dQ(e, n, i, s)) if (o) this.options.duration = 0; else { @@ -31773,25 +31804,25 @@ class x7 { }); } } -function _7(t, e) { +function w7(t, e) { return e ? t * (1e3 / e) : 0; } -const hQ = 5; -function E7(t, e, r) { - const n = Math.max(e - hQ, 0); - return _7(r - t(n), e - n); +const gQ = 5; +function x7(t, e, r) { + const n = Math.max(e - gQ, 0); + return w7(r - t(n), e - n); } -const Nm = 1e-3, dQ = 0.01, n_ = 10, pQ = 0.05, gQ = 1; -function mQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }) { +const Nm = 1e-3, mQ = 0.01, t_ = 10, vQ = 0.05, bQ = 1; +function yQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }) { let i, s; - Ku(t <= Vs(n_), "Spring duration must be 10 seconds or less"); + Ku(t <= Vs(t_), "Spring duration must be 10 seconds or less"); let o = 1 - e; - o = Sa(pQ, gQ, o), t = Sa(dQ, n_, Do(t)), o < 1 ? (i = (l) => { - const d = l * o, p = d * t, w = d - r, A = tv(l, o), P = Math.exp(-p); - return Nm - w / A * P; + o = xa(vQ, bQ, o), t = xa(mQ, t_, To(t)), o < 1 ? (i = (l) => { + const d = l * o, p = d * t, w = d - r, A = tv(l, o), M = Math.exp(-p); + return Nm - w / A * M; }, s = (l) => { - const p = l * o * t, w = p * r + r, A = Math.pow(o, 2) * Math.pow(l, 2) * t, P = Math.exp(-p), N = tv(Math.pow(l, 2), o); - return (-i(l) + Nm > 0 ? -1 : 1) * ((w - A) * P) / N; + const p = l * o * t, w = p * r + r, A = Math.pow(o, 2) * Math.pow(l, 2) * t, M = Math.exp(-p), N = tv(Math.pow(l, 2), o); + return (-i(l) + Nm > 0 ? -1 : 1) * ((w - A) * M) / N; }) : (i = (l) => { const d = Math.exp(-l * t), p = (l - r) * t + 1; return -Nm + d * p; @@ -31799,7 +31830,7 @@ function mQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 const d = Math.exp(-l * t), p = (r - l) * (t * t); return d * p; }); - const a = 5 / t, u = bQ(i, s, a); + const a = 5 / t, u = xQ(i, s, a); if (t = Vs(t), isNaN(u)) return { stiffness: 100, @@ -31815,21 +31846,21 @@ function mQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }; } } -const vQ = 12; -function bQ(t, e, r) { +const wQ = 12; +function xQ(t, e, r) { let n = r; - for (let i = 1; i < vQ; i++) + for (let i = 1; i < wQ; i++) n = n - t(n) / e(n); return n; } function tv(t, e) { return t * Math.sqrt(1 - e * e); } -const yQ = ["duration", "bounce"], wQ = ["stiffness", "damping", "mass"]; -function i_(t, e) { +const _Q = ["duration", "bounce"], EQ = ["stiffness", "damping", "mass"]; +function r_(t, e) { return e.some((r) => t[r] !== void 0); } -function xQ(t) { +function SQ(t) { let e = { velocity: 0, stiffness: 100, @@ -31838,8 +31869,8 @@ function xQ(t) { isResolvedFromDuration: !1, ...t }; - if (!i_(t, wQ) && i_(t, yQ)) { - const r = mQ(t); + if (!r_(t, EQ) && r_(t, _Q)) { + const r = yQ(t); e = { ...e, ...r, @@ -31848,37 +31879,37 @@ function xQ(t) { } return e; } -function S7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { - const i = t[0], s = t[t.length - 1], o = { done: !1, value: i }, { stiffness: a, damping: u, mass: l, duration: d, velocity: p, isResolvedFromDuration: w } = xQ({ +function _7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { + const i = t[0], s = t[t.length - 1], o = { done: !1, value: i }, { stiffness: a, damping: u, mass: l, duration: d, velocity: p, isResolvedFromDuration: w } = SQ({ ...n, - velocity: -Do(n.velocity || 0) - }), A = p || 0, P = u / (2 * Math.sqrt(a * l)), N = s - i, L = Do(Math.sqrt(a / l)), $ = Math.abs(N) < 5; - r || (r = $ ? 0.01 : 2), e || (e = $ ? 5e-3 : 0.5); - let B; - if (P < 1) { - const H = tv(L, P); - B = (W) => { - const V = Math.exp(-P * L * W); - return s - V * ((A + P * L * N) / H * Math.sin(H * W) + N * Math.cos(H * W)); + velocity: -To(n.velocity || 0) + }), A = p || 0, M = u / (2 * Math.sqrt(a * l)), N = s - i, L = To(Math.sqrt(a / l)), B = Math.abs(N) < 5; + r || (r = B ? 0.01 : 2), e || (e = B ? 5e-3 : 0.5); + let $; + if (M < 1) { + const H = tv(L, M); + $ = (W) => { + const V = Math.exp(-M * L * W); + return s - V * ((A + M * L * N) / H * Math.sin(H * W) + N * Math.cos(H * W)); }; - } else if (P === 1) - B = (H) => s - Math.exp(-L * H) * (N + (A + L * N) * H); + } else if (M === 1) + $ = (H) => s - Math.exp(-L * H) * (N + (A + L * N) * H); else { - const H = L * Math.sqrt(P * P - 1); - B = (W) => { - const V = Math.exp(-P * L * W), te = Math.min(H * W, 300); - return s - V * ((A + P * L * N) * Math.sinh(te) + H * N * Math.cosh(te)) / H; + const H = L * Math.sqrt(M * M - 1); + $ = (W) => { + const V = Math.exp(-M * L * W), te = Math.min(H * W, 300); + return s - V * ((A + M * L * N) * Math.sinh(te) + H * N * Math.cosh(te)) / H; }; } return { calculatedDuration: w && d || null, next: (H) => { - const W = B(H); + const W = $(H); if (w) o.done = H >= d; else { let V = 0; - P < 1 && (V = H === 0 ? Vs(A) : E7(B, H, W)); + M < 1 && (V = H === 0 ? Vs(A) : x7($, H, W)); const te = Math.abs(V) <= r, R = Math.abs(s - W) <= e; o.done = te && R; } @@ -31886,23 +31917,23 @@ function S7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { } }; } -function s_({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: u, restDelta: l = 0.5, restSpeed: d }) { +function n_({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: u, restDelta: l = 0.5, restSpeed: d }) { const p = t[0], w = { done: !1, value: p - }, A = (K) => a !== void 0 && K < a || u !== void 0 && K > u, P = (K) => a === void 0 ? u : u === void 0 || Math.abs(a - K) < Math.abs(u - K) ? a : u; + }, A = (K) => a !== void 0 && K < a || u !== void 0 && K > u, M = (K) => a === void 0 ? u : u === void 0 || Math.abs(a - K) < Math.abs(u - K) ? a : u; let N = r * e; - const L = p + N, $ = o === void 0 ? L : o(L); - $ !== L && (N = $ - p); - const B = (K) => -N * Math.exp(-K / n), H = (K) => $ + B(K), W = (K) => { - const ge = B(K), Ee = H(K); - w.done = Math.abs(ge) <= l, w.value = w.done ? $ : Ee; + const L = p + N, B = o === void 0 ? L : o(L); + B !== L && (N = B - p); + const $ = (K) => -N * Math.exp(-K / n), H = (K) => B + $(K), W = (K) => { + const ge = $(K), Ee = H(K); + w.done = Math.abs(ge) <= l, w.value = w.done ? B : Ee; }; let V, te; const R = (K) => { - A(w.value) && (V = K, te = S7({ - keyframes: [w.value, P(w.value)], - velocity: E7(H, K, w.value), + A(w.value) && (V = K, te = _7({ + keyframes: [w.value, M(w.value)], + velocity: x7(H, K, w.value), // TODO: This should be passing * 1000 damping: i, stiffness: s, @@ -31918,34 +31949,34 @@ function s_({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 3 } }; } -const _Q = /* @__PURE__ */ ch(0.42, 0, 1, 1), EQ = /* @__PURE__ */ ch(0, 0, 0.58, 1), A7 = /* @__PURE__ */ ch(0.42, 0, 0.58, 1), SQ = (t) => Array.isArray(t) && typeof t[0] != "number", jb = (t) => Array.isArray(t) && typeof t[0] == "number", o_ = { - linear: Un, - easeIn: _Q, - easeInOut: A7, - easeOut: EQ, +const AQ = /* @__PURE__ */ ch(0.42, 0, 1, 1), PQ = /* @__PURE__ */ ch(0, 0, 0.58, 1), E7 = /* @__PURE__ */ ch(0.42, 0, 0.58, 1), MQ = (t) => Array.isArray(t) && typeof t[0] != "number", jb = (t) => Array.isArray(t) && typeof t[0] == "number", i_ = { + linear: qn, + easeIn: AQ, + easeInOut: E7, + easeOut: PQ, circIn: Db, - circInOut: i7, - circOut: n7, + circInOut: r7, + circOut: t7, backIn: Rb, - backInOut: t7, - backOut: e7, - anticipate: r7 -}, a_ = (t) => { + backInOut: QS, + backOut: ZS, + anticipate: e7 +}, s_ = (t) => { if (jb(t)) { - zo(t.length === 4, "Cubic bezier arrays must contain four numerical values."); + Uo(t.length === 4, "Cubic bezier arrays must contain four numerical values."); const [e, r, n, i] = t; return ch(e, r, n, i); } else if (typeof t == "string") - return zo(o_[t] !== void 0, `Invalid easing type '${t}'`), o_[t]; + return Uo(i_[t] !== void 0, `Invalid easing type '${t}'`), i_[t]; return t; -}, AQ = (t, e) => (r) => e(t(r)), Oo = (...t) => t.reduce(AQ), Iu = (t, e, r) => { +}, IQ = (t, e) => (r) => e(t(r)), Ro = (...t) => t.reduce(IQ), Iu = (t, e, r) => { const n = e - t; return n === 0 ? 1 : (r - t) / n; }, Qr = (t, e, r) => t + (e - t) * r; function Lm(t, e, r) { return r < 0 && (r += 1), r > 1 && (r -= 1), r < 1 / 6 ? t + (e - t) * 6 * r : r < 1 / 2 ? e : r < 2 / 3 ? t + (e - t) * (2 / 3 - r) * 6 : t; } -function PQ({ hue: t, saturation: e, lightness: r, alpha: n }) { +function CQ({ hue: t, saturation: e, lightness: r, alpha: n }) { t /= 360, e /= 100, r /= 100; let i = 0, s = 0, o = 0; if (!e) @@ -31967,31 +31998,31 @@ function v0(t, e) { const km = (t, e, r) => { const n = t * t, i = r * (e * e - n) + n; return i < 0 ? 0 : Math.sqrt(i); -}, MQ = [Q1, oc, eu], IQ = (t) => MQ.find((e) => e.test(t)); -function c_(t) { - const e = IQ(t); +}, TQ = [Q1, sc, eu], RQ = (t) => TQ.find((e) => e.test(t)); +function o_(t) { + const e = RQ(t); if (Ku(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e) return !1; let r = e.parse(t); - return e === eu && (r = PQ(r)), r; + return e === eu && (r = CQ(r)), r; } -const u_ = (t, e) => { - const r = c_(t), n = c_(e); +const a_ = (t, e) => { + const r = o_(t), n = o_(e); if (!r || !n) return v0(t, e); const i = { ...r }; - return (s) => (i.red = km(r.red, n.red, s), i.green = km(r.green, n.green, s), i.blue = km(r.blue, n.blue, s), i.alpha = Qr(r.alpha, n.alpha, s), oc.transform(i)); + return (s) => (i.red = km(r.red, n.red, s), i.green = km(r.green, n.green, s), i.blue = km(r.blue, n.blue, s), i.alpha = Qr(r.alpha, n.alpha, s), sc.transform(i)); }, rv = /* @__PURE__ */ new Set(["none", "hidden"]); -function CQ(t, e) { +function DQ(t, e) { return rv.has(t) ? (r) => r <= 0 ? t : e : (r) => r >= 1 ? e : t; } -function TQ(t, e) { +function OQ(t, e) { return (r) => Qr(t, e, r); } function Ub(t) { - return typeof t == "number" ? TQ : typeof t == "string" ? Ob(t) ? v0 : Yn.test(t) ? u_ : OQ : Array.isArray(t) ? P7 : typeof t == "object" ? Yn.test(t) ? u_ : RQ : v0; + return typeof t == "number" ? OQ : typeof t == "string" ? Ob(t) ? v0 : Jn.test(t) ? a_ : kQ : Array.isArray(t) ? S7 : typeof t == "object" ? Jn.test(t) ? a_ : NQ : v0; } -function P7(t, e) { +function S7(t, e) { const r = [...t], n = r.length, i = t.map((s, o) => Ub(s)(s, e[o])); return (s) => { for (let o = 0; o < n; o++) @@ -31999,7 +32030,7 @@ function P7(t, e) { return r; }; } -function RQ(t, e) { +function NQ(t, e) { const r = { ...t, ...e }, n = {}; for (const i in r) t[i] !== void 0 && e[i] !== void 0 && (n[i] = Ub(t[i])(t[i], e[i])); @@ -32009,7 +32040,7 @@ function RQ(t, e) { return r; }; } -function DQ(t, e) { +function LQ(t, e) { var r; const n = [], i = { color: 0, var: 0, number: 0 }; for (let s = 0; s < e.values.length; s++) { @@ -32018,33 +32049,33 @@ function DQ(t, e) { } return n; } -const OQ = (t, e) => { - const r = Aa.createTransformer(e), n = Tl(t), i = Tl(e); - return n.indexes.var.length === i.indexes.var.length && n.indexes.color.length === i.indexes.color.length && n.indexes.number.length >= i.indexes.number.length ? rv.has(t) && !i.values.length || rv.has(e) && !n.values.length ? CQ(t, e) : Oo(P7(DQ(n, i), i.values), r) : (Ku(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), v0(t, e)); +const kQ = (t, e) => { + const r = _a.createTransformer(e), n = Tl(t), i = Tl(e); + return n.indexes.var.length === i.indexes.var.length && n.indexes.color.length === i.indexes.color.length && n.indexes.number.length >= i.indexes.number.length ? rv.has(t) && !i.values.length || rv.has(e) && !n.values.length ? DQ(t, e) : Ro(S7(LQ(n, i), i.values), r) : (Ku(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), v0(t, e)); }; -function M7(t, e, r) { +function A7(t, e, r) { return typeof t == "number" && typeof e == "number" && typeof r == "number" ? Qr(t, e, r) : Ub(t)(t, e); } -function NQ(t, e, r) { - const n = [], i = r || M7, s = t.length - 1; +function $Q(t, e, r) { + const n = [], i = r || A7, s = t.length - 1; for (let o = 0; o < s; o++) { let a = i(t[o], t[o + 1]); if (e) { - const u = Array.isArray(e) ? e[o] || Un : e; - a = Oo(u, a); + const u = Array.isArray(e) ? e[o] || qn : e; + a = Ro(u, a); } n.push(a); } return n; } -function LQ(t, e, { clamp: r = !0, ease: n, mixer: i } = {}) { +function BQ(t, e, { clamp: r = !0, ease: n, mixer: i } = {}) { const s = t.length; - if (zo(s === e.length, "Both input and output ranges must be the same length"), s === 1) + if (Uo(s === e.length, "Both input and output ranges must be the same length"), s === 1) return () => e[0]; if (s === 2 && t[0] === t[1]) return () => e[1]; t[0] > t[s - 1] && (t = [...t].reverse(), e = [...e].reverse()); - const o = NQ(e, n, i), a = o.length, u = (l) => { + const o = $Q(e, n, i), a = o.length, u = (l) => { let d = 0; if (a > 1) for (; d < t.length - 2 && !(l < t[d + 1]); d++) @@ -32052,70 +32083,70 @@ function LQ(t, e, { clamp: r = !0, ease: n, mixer: i } = {}) { const p = Iu(t[d], t[d + 1], l); return o[d](p); }; - return r ? (l) => u(Sa(t[0], t[s - 1], l)) : u; + return r ? (l) => u(xa(t[0], t[s - 1], l)) : u; } -function kQ(t, e) { +function FQ(t, e) { const r = t[t.length - 1]; for (let n = 1; n <= e; n++) { const i = Iu(0, e, n); t.push(Qr(r, 1, i)); } } -function $Q(t) { +function jQ(t) { const e = [0]; - return kQ(e, t.length - 1), e; + return FQ(e, t.length - 1), e; } -function BQ(t, e) { +function UQ(t, e) { return t.map((r) => r * e); } -function FQ(t, e) { - return t.map(() => e || A7).splice(0, t.length - 1); +function qQ(t, e) { + return t.map(() => e || E7).splice(0, t.length - 1); } function b0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" }) { - const i = SQ(n) ? n.map(a_) : a_(n), s = { + const i = MQ(n) ? n.map(s_) : s_(n), s = { done: !1, value: e[0] - }, o = BQ( + }, o = UQ( // Only use the provided offsets if they're the correct length // TODO Maybe we should warn here if there's a length mismatch - r && r.length === e.length ? r : $Q(e), + r && r.length === e.length ? r : jQ(e), t - ), a = LQ(o, e, { - ease: Array.isArray(i) ? i : FQ(e, i) + ), a = BQ(o, e, { + ease: Array.isArray(i) ? i : qQ(e, i) }); return { calculatedDuration: t, next: (u) => (s.value = a(u), s.done = u >= t, s) }; } -const f_ = 2e4; -function jQ(t) { +const c_ = 2e4; +function zQ(t) { let e = 0; const r = 50; let n = t.next(e); - for (; !n.done && e < f_; ) + for (; !n.done && e < c_; ) e += r, n = t.next(e); - return e >= f_ ? 1 / 0 : e; + return e >= c_ ? 1 / 0 : e; } -const UQ = (t) => { +const WQ = (t) => { const e = ({ timestamp: r }) => t(r); return { start: () => Lr.update(e, !0), - stop: () => Ea(e), + stop: () => wa(e), /** * If we're processing this frame we can use the * framelocked timestamp to keep things in sync. */ now: () => Fn.isProcessing ? Fn.timestamp : Ys.now() }; -}, qQ = { - decay: s_, - inertia: s_, +}, HQ = { + decay: n_, + inertia: n_, tween: b0, keyframes: b0, - spring: S7 -}, zQ = (t) => t / 100; -class qb extends x7 { + spring: _7 +}, KQ = (t) => t / 100; +class qb extends y7 { constructor(e) { super(e), this.holdTime = null, this.cancelTime = null, this.currentTime = 0, this.playbackSpeed = 1, this.pendingPlayState = "running", this.startTime = null, this.state = "idle", this.stop = () => { if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle") @@ -32131,15 +32162,15 @@ class qb extends x7 { super.flatten(), this._resolved && Object.assign(this._resolved, this.initPlayback(this._resolved.keyframes)); } initPlayback(e) { - const { type: r = "keyframes", repeat: n = 0, repeatDelay: i = 0, repeatType: s, velocity: o = 0 } = this.options, a = Fb(r) ? r : qQ[r] || b0; + const { type: r = "keyframes", repeat: n = 0, repeatDelay: i = 0, repeatType: s, velocity: o = 0 } = this.options, a = Fb(r) ? r : HQ[r] || b0; let u, l; - a !== b0 && typeof e[0] != "number" && (process.env.NODE_ENV !== "production" && zo(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), u = Oo(zQ, M7(e[0], e[1])), e = [0, 100]); + a !== b0 && typeof e[0] != "number" && (process.env.NODE_ENV !== "production" && Uo(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), u = Ro(KQ, A7(e[0], e[1])), e = [0, 100]); const d = a({ ...this.options, keyframes: e }); s === "mirror" && (l = a({ ...this.options, keyframes: [...e].reverse(), velocity: -o - })), d.calculatedDuration === null && (d.calculatedDuration = jQ(d)); + })), d.calculatedDuration === null && (d.calculatedDuration = zQ(d)); const { calculatedDuration: p } = d, w = p + i, A = w * (n + 1) - i; return { generator: d, @@ -32163,29 +32194,29 @@ class qb extends x7 { const { finalKeyframe: i, generator: s, mirroredGenerator: o, mapPercentToKeyframes: a, keyframes: u, calculatedDuration: l, totalDuration: d, resolvedDuration: p } = n; if (this.startTime === null) return s.next(0); - const { delay: w, repeat: A, repeatType: P, repeatDelay: N, onUpdate: L } = this.options; + const { delay: w, repeat: A, repeatType: M, repeatDelay: N, onUpdate: L } = this.options; this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - d / this.speed, this.startTime)), r ? this.currentTime = e : this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = Math.round(e - this.startTime) * this.speed; - const $ = this.currentTime - w * (this.speed >= 0 ? 1 : -1), B = this.speed >= 0 ? $ < 0 : $ > d; - this.currentTime = Math.max($, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = d); + const B = this.currentTime - w * (this.speed >= 0 ? 1 : -1), $ = this.speed >= 0 ? B < 0 : B > d; + this.currentTime = Math.max(B, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = d); let H = this.currentTime, W = s; if (A) { const K = Math.min(this.currentTime, d) / p; let ge = Math.floor(K), Ee = K % 1; - !Ee && K >= 1 && (Ee = 1), Ee === 1 && ge--, ge = Math.min(ge, A + 1), !!(ge % 2) && (P === "reverse" ? (Ee = 1 - Ee, N && (Ee -= N / p)) : P === "mirror" && (W = o)), H = Sa(0, 1, Ee) * p; + !Ee && K >= 1 && (Ee = 1), Ee === 1 && ge--, ge = Math.min(ge, A + 1), !!(ge % 2) && (M === "reverse" ? (Ee = 1 - Ee, N && (Ee -= N / p)) : M === "mirror" && (W = o)), H = xa(0, 1, Ee) * p; } - const V = B ? { done: !1, value: u[0] } : W.next(H); + const V = $ ? { done: !1, value: u[0] } : W.next(H); a && (V.value = a(V.value)); let { done: te } = V; - !B && l !== null && (te = this.speed >= 0 ? this.currentTime >= d : this.currentTime <= 0); + !$ && l !== null && (te = this.speed >= 0 ? this.currentTime >= d : this.currentTime <= 0); const R = this.holdTime === null && (this.state === "finished" || this.state === "running" && te); return R && i !== void 0 && (V.value = wp(u, this.options, i)), L && L(V.value), R && this.finish(), V; } get duration() { const { resolved: e } = this; - return e ? Do(e.calculatedDuration) : 0; + return e ? To(e.calculatedDuration) : 0; } get time() { - return Do(this.currentTime); + return To(this.currentTime); } set time(e) { e = Vs(e), this.currentTime = e, this.holdTime !== null || this.speed === 0 ? this.holdTime = e : this.driver && (this.startTime = this.driver.now() - e / this.speed); @@ -32195,7 +32226,7 @@ class qb extends x7 { } set speed(e) { const r = this.playbackSpeed !== e; - this.playbackSpeed = e, r && (this.time = Do(this.currentTime)); + this.playbackSpeed = e, r && (this.time = To(this.currentTime)); } play() { if (this.resolver.isScheduled || this.resolver.resume(), !this._resolved) { @@ -32204,7 +32235,7 @@ class qb extends x7 { } if (this.isStopped) return; - const { driver: e = UQ, onPlay: r, startTime: n } = this.options; + const { driver: e = WQ, onPlay: r, startTime: n } = this.options; this.driver || (this.driver = e((s) => this.tick(s))), r && r(); const i = this.driver.now(); this.holdTime !== null ? this.startTime = i - this.holdTime : this.startTime ? this.state === "finished" && (this.startTime = i) : this.startTime = n ?? this.calcStartTime(), this.state === "finished" && this.updateFinishedPromise(), this.cancelTime = this.startTime, this.holdTime = null, this.state = "running", this.driver.start(); @@ -32238,7 +32269,7 @@ class qb extends x7 { return this.startTime = 0, this.tick(e, !0); } } -const WQ = /* @__PURE__ */ new Set([ +const VQ = /* @__PURE__ */ new Set([ "opacity", "clipPath", "filter", @@ -32246,9 +32277,9 @@ const WQ = /* @__PURE__ */ new Set([ // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved // or until we implement support for linear() easing. // "background-color" -]), HQ = 10, KQ = (t, e) => { +]), GQ = 10, YQ = (t, e) => { let r = ""; - const n = Math.max(Math.round(e / HQ), 2); + const n = Math.max(Math.round(e / GQ), 2); for (let i = 0; i < n; i++) r += t(Iu(0, n - 1, i)) + ", "; return `linear(${r.substring(0, r.length - 2)})`; @@ -32257,17 +32288,17 @@ function zb(t) { let e; return () => (e === void 0 && (e = t()), e); } -const VQ = { +const JQ = { linearEasing: void 0 }; -function GQ(t, e) { +function XQ(t, e) { const r = zb(t); return () => { var n; - return (n = VQ[e]) !== null && n !== void 0 ? n : r(); + return (n = JQ[e]) !== null && n !== void 0 ? n : r(); }; } -const y0 = /* @__PURE__ */ GQ(() => { +const y0 = /* @__PURE__ */ XQ(() => { try { document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" }); } catch { @@ -32275,8 +32306,8 @@ const y0 = /* @__PURE__ */ GQ(() => { } return !0; }, "linearEasing"); -function I7(t) { - return !!(typeof t == "function" && y0() || !t || typeof t == "string" && (t in nv || y0()) || jb(t) || Array.isArray(t) && t.every(I7)); +function P7(t) { + return !!(typeof t == "function" && y0() || !t || typeof t == "string" && (t in nv || y0()) || jb(t) || Array.isArray(t) && t.every(P7)); } const jf = ([t, e, r, n]) => `cubic-bezier(${t}, ${e}, ${r}, ${n})`, nv = { linear: "linear", @@ -32289,14 +32320,14 @@ const jf = ([t, e, r, n]) => `cubic-bezier(${t}, ${e}, ${r}, ${n})`, nv = { backIn: /* @__PURE__ */ jf([0.31, 0.01, 0.66, -0.59]), backOut: /* @__PURE__ */ jf([0.33, 1.53, 0.69, 0.99]) }; -function C7(t, e) { +function M7(t, e) { if (t) - return typeof t == "function" && y0() ? KQ(t, e) : jb(t) ? jf(t) : Array.isArray(t) ? t.map((r) => C7(r, e) || nv.easeOut) : nv[t]; + return typeof t == "function" && y0() ? YQ(t, e) : jb(t) ? jf(t) : Array.isArray(t) ? t.map((r) => M7(r, e) || nv.easeOut) : nv[t]; } -function YQ(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatType: o = "loop", ease: a = "easeInOut", times: u } = {}) { +function ZQ(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatType: o = "loop", ease: a = "easeInOut", times: u } = {}) { const l = { [e]: r }; u && (l.offset = u); - const d = C7(a, i); + const d = M7(a, i); return Array.isArray(d) && (l.easing = d), t.animate(l, { delay: n, duration: i, @@ -32306,14 +32337,14 @@ function YQ(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatTyp direction: o === "reverse" ? "alternate" : "normal" }); } -function l_(t, e) { +function u_(t, e) { t.timeline = e, t.onfinish = null; } -const JQ = /* @__PURE__ */ zb(() => Object.hasOwnProperty.call(Element.prototype, "animate")), w0 = 10, XQ = 2e4; -function ZQ(t) { - return Fb(t.type) || t.type === "spring" || !I7(t.ease); +const QQ = /* @__PURE__ */ zb(() => Object.hasOwnProperty.call(Element.prototype, "animate")), w0 = 10, eee = 2e4; +function tee(t) { + return Fb(t.type) || t.type === "spring" || !P7(t.ease); } -function QQ(t, e) { +function ree(t, e) { const r = new qb({ ...e, keyframes: t, @@ -32324,7 +32355,7 @@ function QQ(t, e) { let n = { done: !1, value: t[0] }; const i = []; let s = 0; - for (; !n.done && s < XQ; ) + for (; !n.done && s < eee; ) n = r.sample(s), i.push(n.value), s += w0; return { times: void 0, @@ -32333,31 +32364,31 @@ function QQ(t, e) { ease: "linear" }; } -const T7 = { - anticipate: r7, - backInOut: t7, - circInOut: i7 +const I7 = { + anticipate: e7, + backInOut: QS, + circInOut: r7 }; -function eee(t) { - return t in T7; +function nee(t) { + return t in I7; } -class h_ extends x7 { +class f_ extends y7 { constructor(e) { super(e); const { name: r, motionValue: n, element: i, keyframes: s } = this.options; - this.resolver = new w7(s, (o, a) => this.onKeyframesResolved(o, a), r, n, i), this.resolver.scheduleResolve(); + this.resolver = new b7(s, (o, a) => this.onKeyframesResolved(o, a), r, n, i), this.resolver.scheduleResolve(); } initPlayback(e, r) { var n; let { duration: i = 300, times: s, ease: o, type: a, motionValue: u, name: l, startTime: d } = this.options; if (!(!((n = u.owner) === null || n === void 0) && n.current)) return !1; - if (typeof o == "string" && y0() && eee(o) && (o = T7[o]), ZQ(this.options)) { - const { onComplete: w, onUpdate: A, motionValue: P, element: N, ...L } = this.options, $ = QQ(e, L); - e = $.keyframes, e.length === 1 && (e[1] = e[0]), i = $.duration, s = $.times, o = $.ease, a = "keyframes"; + if (typeof o == "string" && y0() && nee(o) && (o = I7[o]), tee(this.options)) { + const { onComplete: w, onUpdate: A, motionValue: M, element: N, ...L } = this.options, B = ree(e, L); + e = B.keyframes, e.length === 1 && (e[1] = e[0]), i = B.duration, s = B.times, o = B.ease, a = "keyframes"; } - const p = YQ(u.owner.current, l, e, { ...this.options, duration: i, times: s, ease: o }); - return p.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (l_(p, this.pendingTimeline), this.pendingTimeline = void 0) : p.onfinish = () => { + const p = ZQ(u.owner.current, l, e, { ...this.options, duration: i, times: s, ease: o }); + return p.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (u_(p, this.pendingTimeline), this.pendingTimeline = void 0) : p.onfinish = () => { const { onComplete: w } = this.options; u.set(wp(e, this.options, r)), w && w(), this.cancel(), this.resolveFinishedPromise(); }, { @@ -32374,14 +32405,14 @@ class h_ extends x7 { if (!e) return 0; const { duration: r } = e; - return Do(r); + return To(r); } get time() { const { resolved: e } = this; if (!e) return 0; const { animation: r } = e; - return Do(r.currentTime || 0); + return To(r.currentTime || 0); } set time(e) { const { resolved: r } = this; @@ -32428,11 +32459,11 @@ class h_ extends x7 { else { const { resolved: r } = this; if (!r) - return Un; + return qn; const { animation: n } = r; - l_(n, e); + u_(n, e); } - return Un; + return qn; } play() { if (this.isStopped) @@ -32461,7 +32492,7 @@ class h_ extends x7 { if (r.playState === "idle" || r.playState === "finished") return; if (this.time) { - const { motionValue: l, onUpdate: d, onComplete: p, element: w, ...A } = this.options, P = new qb({ + const { motionValue: l, onUpdate: d, onComplete: p, element: w, ...A } = this.options, M = new qb({ ...A, keyframes: n, duration: i, @@ -32470,7 +32501,7 @@ class h_ extends x7 { times: a, isGenerator: !0 }), N = Vs(this.time); - l.setWithVelocity(P.sample(N - w0).value, P.sample(N).value, w0); + l.setWithVelocity(M.sample(N - w0).value, M.sample(N).value, w0); } const { onStop: u } = this.options; u && u(), this.cancel(); @@ -32485,15 +32516,15 @@ class h_ extends x7 { } static supports(e) { const { motionValue: r, name: n, repeatDelay: i, repeatType: s, damping: o, type: a } = e; - return JQ() && n && WQ.has(n) && r && r.owner && r.owner.current instanceof HTMLElement && /** + return QQ() && n && VQ.has(n) && r && r.owner && r.owner.current instanceof HTMLElement && /** * If we're outputting values to onUpdate then we can't use WAAPI as there's * no way to read the value from WAAPI every frame. */ !r.owner.getProps().onUpdate && !i && s !== "mirror" && o !== 0 && a !== "inertia"; } } -const tee = zb(() => window.ScrollTimeline !== void 0); -class ree { +const iee = zb(() => window.ScrollTimeline !== void 0); +class see { constructor(e) { this.stop = () => this.runAll("stop"), this.animations = e.filter(Boolean); } @@ -32511,7 +32542,7 @@ class ree { this.animations[n][e] = r; } attachTimeline(e, r) { - const n = this.animations.map((i) => tee() && i.attachTimeline ? i.attachTimeline(e) : r(i)); + const n = this.animations.map((i) => iee() && i.attachTimeline ? i.attachTimeline(e) : r(i)); return () => { n.forEach((i, s) => { i && i(), this.animations[s].stop(); @@ -32558,7 +32589,7 @@ class ree { this.runAll("complete"); } } -function nee({ when: t, delay: e, delayChildren: r, staggerChildren: n, staggerDirection: i, repeat: s, repeatType: o, repeatDelay: a, from: u, elapsed: l, ...d }) { +function oee({ when: t, delay: e, delayChildren: r, staggerChildren: n, staggerDirection: i, repeat: s, repeatType: o, repeatDelay: a, from: u, elapsed: l, ...d }) { return !!Object.keys(d).length; } const Wb = (t, e, r, n = {}, i, s) => (o) => { @@ -32581,9 +32612,9 @@ const Wb = (t, e, r, n = {}, i, s) => (o) => { motionValue: e, element: s ? void 0 : i }; - nee(a) || (d = { + oee(a) || (d = { ...d, - ...xZ(t, d) + ...SZ(t, d) }), d.duration && (d.duration = Vs(d.duration)), d.repeatDelay && (d.repeatDelay = Vs(d.repeatDelay)), d.from !== void 0 && (d.keyframes[0] = d.from); let p = !1; if ((d.type === !1 || d.duration === 0 && !d.repeatDelay) && (d.duration = 0, d.delay === 0 && (p = !0)), p && !s && e.get() !== void 0) { @@ -32591,10 +32622,10 @@ const Wb = (t, e, r, n = {}, i, s) => (o) => { if (w !== void 0) return Lr.update(() => { d.onUpdate(w), d.onComplete(); - }), new ree([]); + }), new see([]); } - return !s && h_.supports(d) ? new h_(d) : new qb(d); -}, iee = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), see = (t) => J1(t) ? t[t.length - 1] || 0 : t; + return !s && f_.supports(d) ? new f_(d) : new qb(d); +}, aee = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), cee = (t) => J1(t) ? t[t.length - 1] || 0 : t; function Hb(t, e) { t.indexOf(e) === -1 && t.push(e); } @@ -32627,8 +32658,8 @@ class Vb { this.subscriptions.length = 0; } } -const d_ = 30, oee = (t) => !isNaN(parseFloat(t)); -class aee { +const l_ = 30, uee = (t) => !isNaN(parseFloat(t)); +class fee { /** * @param init - The initiating value * @param config - Optional configuration options @@ -32644,7 +32675,7 @@ class aee { }, this.hasAnimated = !1, this.setCurrent(e), this.owner = r.owner; } setCurrent(e) { - this.current = e, this.updatedAt = Ys.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = oee(this.current)); + this.current = e, this.updatedAt = Ys.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = uee(this.current)); } setPrevFrameValue(e = this.current) { this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt; @@ -32766,10 +32797,10 @@ class aee { */ getVelocity() { const e = Ys.now(); - if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > d_) + if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > l_) return 0; - const r = Math.min(this.updatedAt - this.prevUpdatedAt, d_); - return _7(parseFloat(this.current) - parseFloat(this.prevFrameValue), r); + const r = Math.min(this.updatedAt - this.prevUpdatedAt, l_); + return w7(parseFloat(this.current) - parseFloat(this.prevFrameValue), r); } /** * Registers a new animation to control this `MotionValue`. Only one @@ -32823,65 +32854,65 @@ class aee { } } function Rl(t, e) { - return new aee(t, e); + return new fee(t, e); } -function cee(t, e, r) { +function lee(t, e, r) { t.hasValue(e) ? t.getValue(e).set(r) : t.addValue(e, Rl(r)); } -function uee(t, e) { +function hee(t, e) { const r = yp(t, e); let { transitionEnd: n = {}, transition: i = {}, ...s } = r || {}; s = { ...s, ...n }; for (const o in s) { - const a = see(s[o]); - cee(t, o, a); + const a = cee(s[o]); + lee(t, o, a); } } -const Gb = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), fee = "framerAppearId", R7 = "data-" + Gb(fee); -function D7(t) { - return t.props[R7]; +const Gb = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), dee = "framerAppearId", C7 = "data-" + Gb(dee); +function T7(t) { + return t.props[C7]; } -const Xn = (t) => !!(t && t.getVelocity); -function lee(t) { - return !!(Xn(t) && t.add); +const Zn = (t) => !!(t && t.getVelocity); +function pee(t) { + return !!(Zn(t) && t.add); } function iv(t, e) { const r = t.getValue("willChange"); - if (lee(r)) + if (pee(r)) return r.add(e); } -function hee({ protectedKeys: t, needsAnimating: e }, r) { +function gee({ protectedKeys: t, needsAnimating: e }, r) { const n = t.hasOwnProperty(r) && e[r] !== !0; return e[r] = !1, n; } -function O7(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { +function R7(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { var s; let { transition: o = t.getDefaultTransition(), transitionEnd: a, ...u } = e; n && (o = n); const l = [], d = i && t.animationState && t.animationState.getState()[i]; for (const p in u) { const w = t.getValue(p, (s = t.latestValues[p]) !== null && s !== void 0 ? s : null), A = u[p]; - if (A === void 0 || d && hee(d, p)) + if (A === void 0 || d && gee(d, p)) continue; - const P = { + const M = { delay: r, ...Tb(o || {}, p) }; let N = !1; if (window.MotionHandoffAnimation) { - const $ = D7(t); - if ($) { - const B = window.MotionHandoffAnimation($, p, Lr); - B !== null && (P.startTime = B, N = !0); + const B = T7(t); + if (B) { + const $ = window.MotionHandoffAnimation(B, p, Lr); + $ !== null && (M.startTime = $, N = !0); } } - iv(t, p), w.start(Wb(p, w, A, t.shouldReduceMotion && Ac.has(p) ? { type: !1 } : P, t, N)); + iv(t, p), w.start(Wb(p, w, A, t.shouldReduceMotion && Ac.has(p) ? { type: !1 } : M, t, N)); const L = w.animation; L && l.push(L); } return a && Promise.all(l).then(() => { Lr.update(() => { - a && uee(t, a); + a && hee(t, a); }); }), l; } @@ -32890,9 +32921,9 @@ function sv(t, e, r = {}) { const i = yp(t, e, r.type === "exit" ? (n = t.presenceContext) === null || n === void 0 ? void 0 : n.custom : void 0); let { transition: s = t.getDefaultTransition() || {} } = i || {}; r.transitionOverride && (s = r.transitionOverride); - const o = i ? () => Promise.all(O7(t, i, r)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (l = 0) => { + const o = i ? () => Promise.all(R7(t, i, r)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (l = 0) => { const { delayChildren: d = 0, staggerChildren: p, staggerDirection: w } = s; - return dee(t, e, d + l, p, w, r); + return mee(t, e, d + l, p, w, r); } : () => Promise.resolve(), { when: u } = s; if (u) { const [l, d] = u === "beforeChildren" ? [o, a] : [a, o]; @@ -32900,19 +32931,19 @@ function sv(t, e, r = {}) { } else return Promise.all([o(), a(r.delay)]); } -function dee(t, e, r = 0, n = 0, i = 1, s) { +function mee(t, e, r = 0, n = 0, i = 1, s) { const o = [], a = (t.variantChildren.size - 1) * n, u = i === 1 ? (l = 0) => l * n : (l = 0) => a - l * n; - return Array.from(t.variantChildren).sort(pee).forEach((l, d) => { + return Array.from(t.variantChildren).sort(vee).forEach((l, d) => { l.notify("AnimationStart", e), o.push(sv(l, e, { ...s, delay: r + u(d) }).then(() => l.notify("AnimationComplete", e))); }), Promise.all(o); } -function pee(t, e) { +function vee(t, e) { return t.sortNodePosition(e); } -function gee(t, e, r = {}) { +function bee(t, e, r = {}) { t.notify("AnimationStart", e); let n; if (Array.isArray(e)) { @@ -32922,39 +32953,39 @@ function gee(t, e, r = {}) { n = sv(t, e, r); else { const i = typeof e == "function" ? yp(t, e, r.custom) : e; - n = Promise.all(O7(t, i, r)); + n = Promise.all(R7(t, i, r)); } return n.then(() => { t.notify("AnimationComplete", e); }); } -const mee = Cb.length; -function N7(t) { +const yee = Cb.length; +function D7(t) { if (!t) return; if (!t.isControllingVariants) { - const r = t.parent ? N7(t.parent) || {} : {}; + const r = t.parent ? D7(t.parent) || {} : {}; return t.props.initial !== void 0 && (r.initial = t.props.initial), r; } const e = {}; - for (let r = 0; r < mee; r++) { + for (let r = 0; r < yee; r++) { const n = Cb[r], i = t.props[n]; (Il(i) || i === !1) && (e[n] = i); } return e; } -const vee = [...Ib].reverse(), bee = Ib.length; -function yee(t) { - return (e) => Promise.all(e.map(({ animation: r, options: n }) => gee(t, r, n))); +const wee = [...Ib].reverse(), xee = Ib.length; +function _ee(t) { + return (e) => Promise.all(e.map(({ animation: r, options: n }) => bee(t, r, n))); } -function wee(t) { - let e = yee(t), r = p_(), n = !0; +function Eee(t) { + let e = _ee(t), r = h_(), n = !0; const i = (u) => (l, d) => { var p; const w = yp(t, d, u === "exit" ? (p = t.presenceContext) === null || p === void 0 ? void 0 : p.custom : void 0); if (w) { - const { transition: A, transitionEnd: P, ...N } = w; - l = { ...l, ...N, ...P }; + const { transition: A, transitionEnd: M, ...N } = w; + l = { ...l, ...N, ...M }; } return l; }; @@ -32962,29 +32993,29 @@ function wee(t) { e = u(t); } function o(u) { - const { props: l } = t, d = N7(t.parent) || {}, p = [], w = /* @__PURE__ */ new Set(); - let A = {}, P = 1 / 0; - for (let L = 0; L < bee; L++) { - const $ = vee[L], B = r[$], H = l[$] !== void 0 ? l[$] : d[$], W = Il(H), V = $ === u ? B.isActive : null; - V === !1 && (P = L); - let te = H === d[$] && H !== l[$] && W; - if (te && n && t.manuallyAnimateOnMount && (te = !1), B.protectedKeys = { ...A }, // If it isn't active and hasn't *just* been set as inactive - !B.isActive && V === null || // If we didn't and don't have any defined prop for this animation type - !H && !B.prevProp || // Or if the prop doesn't define an animation + const { props: l } = t, d = D7(t.parent) || {}, p = [], w = /* @__PURE__ */ new Set(); + let A = {}, M = 1 / 0; + for (let L = 0; L < xee; L++) { + const B = wee[L], $ = r[B], H = l[B] !== void 0 ? l[B] : d[B], W = Il(H), V = B === u ? $.isActive : null; + V === !1 && (M = L); + let te = H === d[B] && H !== l[B] && W; + if (te && n && t.manuallyAnimateOnMount && (te = !1), $.protectedKeys = { ...A }, // If it isn't active and hasn't *just* been set as inactive + !$.isActive && V === null || // If we didn't and don't have any defined prop for this animation type + !H && !$.prevProp || // Or if the prop doesn't define an animation bp(H) || typeof H == "boolean") continue; - const R = xee(B.prevProp, H); + const R = See($.prevProp, H); let K = R || // If we're making this variant active, we want to always make it active - $ === u && B.isActive && !te && W || // If we removed a higher-priority variant (i is in reverse order) - L > P && W, ge = !1; + B === u && $.isActive && !te && W || // If we removed a higher-priority variant (i is in reverse order) + L > M && W, ge = !1; const Ee = Array.isArray(H) ? H : [H]; - let Y = Ee.reduce(i($), {}); + let Y = Ee.reduce(i(B), {}); V === !1 && (Y = {}); - const { prevResolvedValues: S = {} } = B, m = { + const { prevResolvedValues: S = {} } = $, m = { ...S, ...Y }, f = (x) => { - K = !0, w.has(x) && (ge = !0, w.delete(x)), B.needsAnimating[x] = !0; + K = !0, w.has(x) && (ge = !0, w.delete(x)), $.needsAnimating[x] = !0; const _ = t.getValue(x); _ && (_.liveStyle = !1); }; @@ -32993,18 +33024,18 @@ function wee(t) { if (A.hasOwnProperty(x)) continue; let v = !1; - J1(_) && J1(E) ? v = !YS(_, E) : v = _ !== E, v ? _ != null ? f(x) : w.add(x) : _ !== void 0 && w.has(x) ? f(x) : B.protectedKeys[x] = !0; + J1(_) && J1(E) ? v = !VS(_, E) : v = _ !== E, v ? _ != null ? f(x) : w.add(x) : _ !== void 0 && w.has(x) ? f(x) : $.protectedKeys[x] = !0; } - B.prevProp = H, B.prevResolvedValues = Y, B.isActive && (A = { ...A, ...Y }), n && t.blockInitialAnimation && (K = !1), K && (!(te && R) || ge) && p.push(...Ee.map((x) => ({ + $.prevProp = H, $.prevResolvedValues = Y, $.isActive && (A = { ...A, ...Y }), n && t.blockInitialAnimation && (K = !1), K && (!(te && R) || ge) && p.push(...Ee.map((x) => ({ animation: x, - options: { type: $ } + options: { type: B } }))); } if (w.size) { const L = {}; - w.forEach(($) => { - const B = t.getBaseTarget($), H = t.getValue($); - H && (H.liveStyle = !0), L[$] = B ?? null; + w.forEach((B) => { + const $ = t.getBaseTarget(B), H = t.getValue(B); + H && (H.liveStyle = !0), L[B] = $ ?? null; }), p.push({ animation: L }); } let N = !!p.length; @@ -33029,14 +33060,14 @@ function wee(t) { setAnimateFunction: s, getState: () => r, reset: () => { - r = p_(), n = !0; + r = h_(), n = !0; } }; } -function xee(t, e) { - return typeof e == "string" ? e !== t : Array.isArray(e) ? !YS(e, t) : !1; +function See(t, e) { + return typeof e == "string" ? e !== t : Array.isArray(e) ? !VS(e, t) : !1; } -function Ya(t = !1) { +function Va(t = !1) { return { isActive: t, protectedKeys: {}, @@ -33044,32 +33075,32 @@ function Ya(t = !1) { prevResolvedValues: {} }; } -function p_() { +function h_() { return { - animate: Ya(!0), - whileInView: Ya(), - whileHover: Ya(), - whileTap: Ya(), - whileDrag: Ya(), - whileFocus: Ya(), - exit: Ya() + animate: Va(!0), + whileInView: Va(), + whileHover: Va(), + whileTap: Va(), + whileDrag: Va(), + whileFocus: Va(), + exit: Va() }; } -class Oa { +class Ra { constructor(e) { this.isMounted = !1, this.node = e; } update() { } } -class _ee extends Oa { +class Aee extends Ra { /** * We dynamically generate the AnimationState manager as it contains a reference * to the underlying animation library. We only want to load that if we load this, * so people can optionally code split it out using the `m` component. */ constructor(e) { - super(e), e.animationState || (e.animationState = wee(e)); + super(e), e.animationState || (e.animationState = Eee(e)); } updateAnimationControlsSubscription() { const { animate: e } = this.node.getProps(); @@ -33090,10 +33121,10 @@ class _ee extends Oa { this.node.animationState.reset(), (e = this.unmountControls) === null || e === void 0 || e.call(this); } } -let Eee = 0; -class See extends Oa { +let Pee = 0; +class Mee extends Ra { constructor() { - super(...arguments), this.id = Eee++; + super(...arguments), this.id = Pee++; } update() { if (!this.node.presenceContext) @@ -33111,14 +33142,14 @@ class See extends Oa { unmount() { } } -const Aee = { +const Iee = { animation: { - Feature: _ee + Feature: Aee }, exit: { - Feature: See + Feature: Mee } -}, L7 = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1; +}, O7 = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1; function xp(t, e = "page") { return { point: { @@ -33127,84 +33158,84 @@ function xp(t, e = "page") { } }; } -const Pee = (t) => (e) => L7(e) && t(e, xp(e)); -function Co(t, e, r, n = { passive: !0 }) { +const Cee = (t) => (e) => O7(e) && t(e, xp(e)); +function Mo(t, e, r, n = { passive: !0 }) { return t.addEventListener(e, r, n), () => t.removeEventListener(e, r); } -function No(t, e, r, n) { - return Co(t, e, Pee(r), n); +function Do(t, e, r, n) { + return Mo(t, e, Cee(r), n); } -const g_ = (t, e) => Math.abs(t - e); -function Mee(t, e) { - const r = g_(t.x, e.x), n = g_(t.y, e.y); +const d_ = (t, e) => Math.abs(t - e); +function Tee(t, e) { + const r = d_(t.x, e.x), n = d_(t.y, e.y); return Math.sqrt(r ** 2 + n ** 2); } -class k7 { +class N7 { constructor(e, r, { transformPagePoint: n, contextWindow: i, dragSnapToOrigin: s = !1 } = {}) { if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.updatePoint = () => { if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return; - const p = Bm(this.lastMoveEventInfo, this.history), w = this.startEvent !== null, A = Mee(p.offset, { x: 0, y: 0 }) >= 3; + const p = Bm(this.lastMoveEventInfo, this.history), w = this.startEvent !== null, A = Tee(p.offset, { x: 0, y: 0 }) >= 3; if (!w && !A) return; - const { point: P } = p, { timestamp: N } = Fn; - this.history.push({ ...P, timestamp: N }); - const { onStart: L, onMove: $ } = this.handlers; - w || (L && L(this.lastMoveEvent, p), this.startEvent = this.lastMoveEvent), $ && $(this.lastMoveEvent, p); + const { point: M } = p, { timestamp: N } = Fn; + this.history.push({ ...M, timestamp: N }); + const { onStart: L, onMove: B } = this.handlers; + w || (L && L(this.lastMoveEvent, p), this.startEvent = this.lastMoveEvent), B && B(this.lastMoveEvent, p); }, this.handlePointerMove = (p, w) => { this.lastMoveEvent = p, this.lastMoveEventInfo = $m(w, this.transformPagePoint), Lr.update(this.updatePoint, !0); }, this.handlePointerUp = (p, w) => { this.end(); - const { onEnd: A, onSessionEnd: P, resumeAnimation: N } = this.handlers; + const { onEnd: A, onSessionEnd: M, resumeAnimation: N } = this.handlers; if (this.dragSnapToOrigin && N && N(), !(this.lastMoveEvent && this.lastMoveEventInfo)) return; const L = Bm(p.type === "pointercancel" ? this.lastMoveEventInfo : $m(w, this.transformPagePoint), this.history); - this.startEvent && A && A(p, L), P && P(p, L); - }, !L7(e)) + this.startEvent && A && A(p, L), M && M(p, L); + }, !O7(e)) return; this.dragSnapToOrigin = s, this.handlers = r, this.transformPagePoint = n, this.contextWindow = i || window; const o = xp(e), a = $m(o, this.transformPagePoint), { point: u } = a, { timestamp: l } = Fn; this.history = [{ ...u, timestamp: l }]; const { onSessionStart: d } = r; - d && d(e, Bm(a, this.history)), this.removeListeners = Oo(No(this.contextWindow, "pointermove", this.handlePointerMove), No(this.contextWindow, "pointerup", this.handlePointerUp), No(this.contextWindow, "pointercancel", this.handlePointerUp)); + d && d(e, Bm(a, this.history)), this.removeListeners = Ro(Do(this.contextWindow, "pointermove", this.handlePointerMove), Do(this.contextWindow, "pointerup", this.handlePointerUp), Do(this.contextWindow, "pointercancel", this.handlePointerUp)); } updateHandlers(e) { this.handlers = e; } end() { - this.removeListeners && this.removeListeners(), Ea(this.updatePoint); + this.removeListeners && this.removeListeners(), wa(this.updatePoint); } } function $m(t, e) { return e ? { point: e(t.point) } : t; } -function m_(t, e) { +function p_(t, e) { return { x: t.x - e.x, y: t.y - e.y }; } function Bm({ point: t }, e) { return { point: t, - delta: m_(t, $7(e)), - offset: m_(t, Iee(e)), - velocity: Cee(e, 0.1) + delta: p_(t, L7(e)), + offset: p_(t, Ree(e)), + velocity: Dee(e, 0.1) }; } -function Iee(t) { +function Ree(t) { return t[0]; } -function $7(t) { +function L7(t) { return t[t.length - 1]; } -function Cee(t, e) { +function Dee(t, e) { if (t.length < 2) return { x: 0, y: 0 }; let r = t.length - 1, n = null; - const i = $7(t); + const i = L7(t); for (; r >= 0 && (n = t[r], !(i.timestamp - n.timestamp > Vs(e))); ) r--; if (!n) return { x: 0, y: 0 }; - const s = Do(i.timestamp - n.timestamp); + const s = To(i.timestamp - n.timestamp); if (s === 0) return { x: 0, y: 0 }; const o = { @@ -33213,7 +33244,7 @@ function Cee(t, e) { }; return o.x === 1 / 0 && (o.x = 0), o.y === 1 / 0 && (o.y = 0), o; } -function B7(t) { +function k7(t) { let e = null; return () => { const r = () => { @@ -33222,128 +33253,128 @@ function B7(t) { return e === null ? (e = t, r) : !1; }; } -const v_ = B7("dragHorizontal"), b_ = B7("dragVertical"); -function F7(t) { +const g_ = k7("dragHorizontal"), m_ = k7("dragVertical"); +function $7(t) { let e = !1; if (t === "y") - e = b_(); + e = m_(); else if (t === "x") - e = v_(); + e = g_(); else { - const r = v_(), n = b_(); + const r = g_(), n = m_(); r && n ? e = () => { r(), n(); } : (r && r(), n && n()); } return e; } -function j7() { - const t = F7(!0); +function B7() { + const t = $7(!0); return t ? (t(), !1) : !0; } function tu(t) { return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current"); } -const U7 = 1e-4, Tee = 1 - U7, Ree = 1 + U7, q7 = 0.01, Dee = 0 - q7, Oee = 0 + q7; -function ki(t) { +const F7 = 1e-4, Oee = 1 - F7, Nee = 1 + F7, j7 = 0.01, Lee = 0 - j7, kee = 0 + j7; +function Li(t) { return t.max - t.min; } -function Nee(t, e, r) { +function $ee(t, e, r) { return Math.abs(t - e) <= r; } -function y_(t, e, r, n = 0.5) { - t.origin = n, t.originPoint = Qr(e.min, e.max, t.origin), t.scale = ki(r) / ki(e), t.translate = Qr(r.min, r.max, t.origin) - t.originPoint, (t.scale >= Tee && t.scale <= Ree || isNaN(t.scale)) && (t.scale = 1), (t.translate >= Dee && t.translate <= Oee || isNaN(t.translate)) && (t.translate = 0); +function v_(t, e, r, n = 0.5) { + t.origin = n, t.originPoint = Qr(e.min, e.max, t.origin), t.scale = Li(r) / Li(e), t.translate = Qr(r.min, r.max, t.origin) - t.originPoint, (t.scale >= Oee && t.scale <= Nee || isNaN(t.scale)) && (t.scale = 1), (t.translate >= Lee && t.translate <= kee || isNaN(t.translate)) && (t.translate = 0); } function Jf(t, e, r, n) { - y_(t.x, e.x, r.x, n ? n.originX : void 0), y_(t.y, e.y, r.y, n ? n.originY : void 0); + v_(t.x, e.x, r.x, n ? n.originX : void 0), v_(t.y, e.y, r.y, n ? n.originY : void 0); } -function w_(t, e, r) { - t.min = r.min + e.min, t.max = t.min + ki(e); +function b_(t, e, r) { + t.min = r.min + e.min, t.max = t.min + Li(e); } -function Lee(t, e, r) { - w_(t.x, e.x, r.x), w_(t.y, e.y, r.y); +function Bee(t, e, r) { + b_(t.x, e.x, r.x), b_(t.y, e.y, r.y); } -function x_(t, e, r) { - t.min = e.min - r.min, t.max = t.min + ki(e); +function y_(t, e, r) { + t.min = e.min - r.min, t.max = t.min + Li(e); } function Xf(t, e, r) { - x_(t.x, e.x, r.x), x_(t.y, e.y, r.y); + y_(t.x, e.x, r.x), y_(t.y, e.y, r.y); } -function kee(t, { min: e, max: r }, n) { +function Fee(t, { min: e, max: r }, n) { return e !== void 0 && t < e ? t = n ? Qr(e, t, n.min) : Math.max(t, e) : r !== void 0 && t > r && (t = n ? Qr(r, t, n.max) : Math.min(t, r)), t; } -function __(t, e, r) { +function w_(t, e, r) { return { min: e !== void 0 ? t.min + e : void 0, max: r !== void 0 ? t.max + r - (t.max - t.min) : void 0 }; } -function $ee(t, { top: e, left: r, bottom: n, right: i }) { +function jee(t, { top: e, left: r, bottom: n, right: i }) { return { - x: __(t.x, r, i), - y: __(t.y, e, n) + x: w_(t.x, r, i), + y: w_(t.y, e, n) }; } -function E_(t, e) { +function x_(t, e) { let r = e.min - t.min, n = e.max - t.max; return e.max - e.min < t.max - t.min && ([r, n] = [n, r]), { min: r, max: n }; } -function Bee(t, e) { +function Uee(t, e) { return { - x: E_(t.x, e.x), - y: E_(t.y, e.y) + x: x_(t.x, e.x), + y: x_(t.y, e.y) }; } -function Fee(t, e) { +function qee(t, e) { let r = 0.5; - const n = ki(t), i = ki(e); - return i > n ? r = Iu(e.min, e.max - n, t.min) : n > i && (r = Iu(t.min, t.max - i, e.min)), Sa(0, 1, r); + const n = Li(t), i = Li(e); + return i > n ? r = Iu(e.min, e.max - n, t.min) : n > i && (r = Iu(t.min, t.max - i, e.min)), xa(0, 1, r); } -function jee(t, e) { +function zee(t, e) { const r = {}; return e.min !== void 0 && (r.min = e.min - t.min), e.max !== void 0 && (r.max = e.max - t.min), r; } const ov = 0.35; -function Uee(t = ov) { +function Wee(t = ov) { return t === !1 ? t = 0 : t === !0 && (t = ov), { - x: S_(t, "left", "right"), - y: S_(t, "top", "bottom") + x: __(t, "left", "right"), + y: __(t, "top", "bottom") }; } -function S_(t, e, r) { +function __(t, e, r) { return { - min: A_(t, e), - max: A_(t, r) + min: E_(t, e), + max: E_(t, r) }; } -function A_(t, e) { +function E_(t, e) { return typeof t == "number" ? t : t[e] || 0; } -const P_ = () => ({ +const S_ = () => ({ translate: 0, scale: 1, origin: 0, originPoint: 0 }), ru = () => ({ - x: P_(), - y: P_() -}), M_ = () => ({ min: 0, max: 0 }), ln = () => ({ - x: M_(), - y: M_() + x: S_(), + y: S_() +}), A_ = () => ({ min: 0, max: 0 }), ln = () => ({ + x: A_(), + y: A_() }); -function Zi(t) { +function Xi(t) { return [t("x"), t("y")]; } -function z7({ top: t, left: e, right: r, bottom: n }) { +function U7({ top: t, left: e, right: r, bottom: n }) { return { x: { min: e, max: r }, y: { min: t, max: n } }; } -function qee({ x: t, y: e }) { +function Hee({ x: t, y: e }) { return { top: e.min, right: t.max, bottom: e.max, left: t.min }; } -function zee(t, e) { +function Kee(t, e) { if (!e) return t; const r = e({ x: t.left, y: t.top }), n = e({ x: t.right, y: t.bottom }); @@ -33360,30 +33391,30 @@ function Fm(t) { function av({ scale: t, scaleX: e, scaleY: r }) { return !Fm(t) || !Fm(e) || !Fm(r); } -function Xa(t) { - return av(t) || W7(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY; +function Ya(t) { + return av(t) || q7(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY; } -function W7(t) { - return I_(t.x) || I_(t.y); +function q7(t) { + return P_(t.x) || P_(t.y); } -function I_(t) { +function P_(t) { return t && t !== "0%"; } function x0(t, e, r) { const n = t - r, i = e * n; return r + i; } -function C_(t, e, r, n, i) { +function M_(t, e, r, n, i) { return i !== void 0 && (t = x0(t, i, n)), x0(t, r, n) + e; } function cv(t, e = 0, r = 1, n, i) { - t.min = C_(t.min, e, r, n, i), t.max = C_(t.max, e, r, n, i); + t.min = M_(t.min, e, r, n, i), t.max = M_(t.max, e, r, n, i); } -function H7(t, { x: e, y: r }) { +function z7(t, { x: e, y: r }) { cv(t.x, e.translate, e.scale, e.originPoint), cv(t.y, r.translate, r.scale, r.originPoint); } -const T_ = 0.999999999999, R_ = 1.0000000000001; -function Wee(t, e, r, n = !1) { +const I_ = 0.999999999999, C_ = 1.0000000000001; +function Vee(t, e, r, n = !1) { const i = r.length; if (!i) return; @@ -33395,29 +33426,29 @@ function Wee(t, e, r, n = !1) { u && u.props.style && u.props.style.display === "contents" || (n && s.options.layoutScroll && s.scroll && s !== s.root && iu(t, { x: -s.scroll.offset.x, y: -s.scroll.offset.y - }), o && (e.x *= o.x.scale, e.y *= o.y.scale, H7(t, o)), n && Xa(s.latestValues) && iu(t, s.latestValues)); + }), o && (e.x *= o.x.scale, e.y *= o.y.scale, z7(t, o)), n && Ya(s.latestValues) && iu(t, s.latestValues)); } - e.x < R_ && e.x > T_ && (e.x = 1), e.y < R_ && e.y > T_ && (e.y = 1); + e.x < C_ && e.x > I_ && (e.x = 1), e.y < C_ && e.y > I_ && (e.y = 1); } function nu(t, e) { t.min = t.min + e, t.max = t.max + e; } -function D_(t, e, r, n, i = 0.5) { +function T_(t, e, r, n, i = 0.5) { const s = Qr(t.min, t.max, i); cv(t, e, r, s, n); } function iu(t, e) { - D_(t.x, e.x, e.scaleX, e.scale, e.originX), D_(t.y, e.y, e.scaleY, e.scale, e.originY); + T_(t.x, e.x, e.scaleX, e.scale, e.originX), T_(t.y, e.y, e.scaleY, e.scale, e.originY); } -function K7(t, e) { - return z7(zee(t.getBoundingClientRect(), e)); +function W7(t, e) { + return U7(Kee(t.getBoundingClientRect(), e)); } -function Hee(t, e, r) { - const n = K7(t, r), { scroll: i } = e; +function Gee(t, e, r) { + const n = W7(t, r), { scroll: i } = e; return i && (nu(n.x, i.offset.x), nu(n.y, i.offset.y)), n; } -const V7 = ({ current: t }) => t ? t.ownerDocument.defaultView : null, Kee = /* @__PURE__ */ new WeakMap(); -class Vee { +const H7 = ({ current: t }) => t ? t.ownerDocument.defaultView : null, Yee = /* @__PURE__ */ new WeakMap(); +class Jee { constructor(e) { this.openGlobalLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = ln(), this.visualElement = e; } @@ -33429,37 +33460,37 @@ class Vee { const { dragSnapToOrigin: p } = this.getProps(); p ? this.pauseAnimation() : this.stopAnimation(), r && this.snapToCursor(xp(d, "page").point); }, s = (d, p) => { - const { drag: w, dragPropagation: A, onDragStart: P } = this.getProps(); - if (w && !A && (this.openGlobalLock && this.openGlobalLock(), this.openGlobalLock = F7(w), !this.openGlobalLock)) + const { drag: w, dragPropagation: A, onDragStart: M } = this.getProps(); + if (w && !A && (this.openGlobalLock && this.openGlobalLock(), this.openGlobalLock = $7(w), !this.openGlobalLock)) return; - this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), Zi((L) => { - let $ = this.getAxisMotionValue(L).get() || 0; - if (Gs.test($)) { - const { projection: B } = this.visualElement; - if (B && B.layout) { - const H = B.layout.layoutBox[L]; - H && ($ = ki(H) * (parseFloat($) / 100)); + this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), Xi((L) => { + let B = this.getAxisMotionValue(L).get() || 0; + if (Gs.test(B)) { + const { projection: $ } = this.visualElement; + if ($ && $.layout) { + const H = $.layout.layoutBox[L]; + H && (B = Li(H) * (parseFloat(B) / 100)); } } - this.originPoint[L] = $; - }), P && Lr.postRender(() => P(d, p)), iv(this.visualElement, "transform"); + this.originPoint[L] = B; + }), M && Lr.postRender(() => M(d, p)), iv(this.visualElement, "transform"); const { animationState: N } = this.visualElement; N && N.setActive("whileDrag", !0); }, o = (d, p) => { - const { dragPropagation: w, dragDirectionLock: A, onDirectionLock: P, onDrag: N } = this.getProps(); + const { dragPropagation: w, dragDirectionLock: A, onDirectionLock: M, onDrag: N } = this.getProps(); if (!w && !this.openGlobalLock) return; const { offset: L } = p; if (A && this.currentDirection === null) { - this.currentDirection = Gee(L), this.currentDirection !== null && P && P(this.currentDirection); + this.currentDirection = Xee(L), this.currentDirection !== null && M && M(this.currentDirection); return; } this.updateAxis("x", p.point, L), this.updateAxis("y", p.point, L), this.visualElement.render(), N && N(d, p); - }, a = (d, p) => this.stop(d, p), u = () => Zi((d) => { + }, a = (d, p) => this.stop(d, p), u = () => Xi((d) => { var p; return this.getAnimationState(d) === "paused" && ((p = this.getAxisMotionValue(d).animation) === null || p === void 0 ? void 0 : p.play()); }), { dragSnapToOrigin: l } = this.getProps(); - this.panSession = new k7(e, { + this.panSession = new N7(e, { onSessionStart: i, onStart: s, onMove: o, @@ -33468,7 +33499,7 @@ class Vee { }, { transformPagePoint: this.visualElement.getTransformPagePoint(), dragSnapToOrigin: l, - contextWindow: V7(this.visualElement) + contextWindow: H7(this.visualElement) }); } stop(e, r) { @@ -33493,13 +33524,13 @@ class Vee { return; const s = this.getAxisMotionValue(e); let o = this.originPoint[e] + n[e]; - this.constraints && this.constraints[e] && (o = kee(o, this.constraints[e], this.elastic[e])), s.set(o); + this.constraints && this.constraints[e] && (o = Fee(o, this.constraints[e], this.elastic[e])), s.set(o); } resolveConstraints() { var e; const { dragConstraints: r, dragElastic: n } = this.getProps(), i = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : (e = this.visualElement.projection) === null || e === void 0 ? void 0 : e.layout, s = this.constraints; - r && tu(r) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : r && i ? this.constraints = $ee(i.layoutBox, r) : this.constraints = !1, this.elastic = Uee(n), s !== this.constraints && i && this.constraints && !this.hasMutatedConstraints && Zi((o) => { - this.constraints !== !1 && this.getAxisMotionValue(o) && (this.constraints[o] = jee(i.layoutBox[o], this.constraints[o])); + r && tu(r) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : r && i ? this.constraints = jee(i.layoutBox, r) : this.constraints = !1, this.elastic = Wee(n), s !== this.constraints && i && this.constraints && !this.hasMutatedConstraints && Xi((o) => { + this.constraints !== !1 && this.getAxisMotionValue(o) && (this.constraints[o] = zee(i.layoutBox[o], this.constraints[o])); }); } resolveRefConstraints() { @@ -33507,25 +33538,25 @@ class Vee { if (!e || !tu(e)) return !1; const n = e.current; - zo(n !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop."); + Uo(n !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop."); const { projection: i } = this.visualElement; if (!i || !i.layout) return !1; - const s = Hee(n, i.root, this.visualElement.getTransformPagePoint()); - let o = Bee(i.layout.layoutBox, s); + const s = Gee(n, i.root, this.visualElement.getTransformPagePoint()); + let o = Uee(i.layout.layoutBox, s); if (r) { - const a = r(qee(o)); - this.hasMutatedConstraints = !!a, a && (o = z7(a)); + const a = r(Hee(o)); + this.hasMutatedConstraints = !!a, a && (o = U7(a)); } return o; } startAnimation(e) { - const { drag: r, dragMomentum: n, dragElastic: i, dragTransition: s, dragSnapToOrigin: o, onDragTransitionEnd: a } = this.getProps(), u = this.constraints || {}, l = Zi((d) => { + const { drag: r, dragMomentum: n, dragElastic: i, dragTransition: s, dragSnapToOrigin: o, onDragTransitionEnd: a } = this.getProps(), u = this.constraints || {}, l = Xi((d) => { if (!vd(d, r, this.currentDirection)) return; let p = u && u[d] || {}; o && (p = { min: 0, max: 0 }); - const w = i ? 200 : 1e6, A = i ? 40 : 1e7, P = { + const w = i ? 200 : 1e6, A = i ? 40 : 1e7, M = { type: "inertia", velocity: n ? e[d] : 0, bounceStiffness: w, @@ -33536,7 +33567,7 @@ class Vee { ...s, ...p }; - return this.startAxisValueAnimation(d, P); + return this.startAxisValueAnimation(d, M); }); return Promise.all(l).then(a); } @@ -33545,10 +33576,10 @@ class Vee { return iv(this.visualElement, e), n.start(Wb(e, n, 0, r, this.visualElement, !1)); } stopAnimation() { - Zi((e) => this.getAxisMotionValue(e).stop()); + Xi((e) => this.getAxisMotionValue(e).stop()); } pauseAnimation() { - Zi((e) => { + Xi((e) => { var r; return (r = this.getAxisMotionValue(e).animation) === null || r === void 0 ? void 0 : r.pause(); }); @@ -33568,7 +33599,7 @@ class Vee { return i || this.visualElement.getValue(e, (n.initial ? n.initial[e] : void 0) || 0); } snapToCursor(e) { - Zi((r) => { + Xi((r) => { const { drag: n } = this.getProps(); if (!vd(r, n, this.currentDirection)) return; @@ -33592,15 +33623,15 @@ class Vee { return; this.stopAnimation(); const i = { x: 0, y: 0 }; - Zi((o) => { + Xi((o) => { const a = this.getAxisMotionValue(o); if (a && this.constraints !== !1) { const u = a.get(); - i[o] = Fee({ min: u, max: u }, this.constraints[o]); + i[o] = qee({ min: u, max: u }, this.constraints[o]); } }); const { transformTemplate: s } = this.visualElement.getProps(); - this.visualElement.current.style.transform = s ? s({}, "") : "none", n.root && n.root.updateScroll(), n.updateLayout(), this.resolveConstraints(), Zi((o) => { + this.visualElement.current.style.transform = s ? s({}, "") : "none", n.root && n.root.updateScroll(), n.updateLayout(), this.resolveConstraints(), Xi((o) => { if (!vd(o, e, null)) return; const a = this.getAxisMotionValue(o), { min: u, max: l } = this.constraints[o]; @@ -33610,8 +33641,8 @@ class Vee { addListeners() { if (!this.visualElement.current) return; - Kee.set(this.visualElement, this); - const e = this.visualElement.current, r = No(e, "pointerdown", (u) => { + Yee.set(this.visualElement, this); + const e = this.visualElement.current, r = Do(e, "pointerdown", (u) => { const { drag: l, dragListener: d = !0 } = this.getProps(); l && d && this.start(u); }), n = () => { @@ -33619,8 +33650,8 @@ class Vee { tu(u) && u.current && (this.constraints = this.resolveRefConstraints()); }, { projection: i } = this.visualElement, s = i.addEventListener("measure", n); i && !i.layout && (i.root && i.root.updateScroll(), i.updateLayout()), Lr.read(n); - const o = Co(window, "resize", () => this.scalePositionWithinConstraints()), a = i.addEventListener("didUpdate", ({ delta: u, hasLayoutChanged: l }) => { - this.isDragging && l && (Zi((d) => { + const o = Mo(window, "resize", () => this.scalePositionWithinConstraints()), a = i.addEventListener("didUpdate", ({ delta: u, hasLayoutChanged: l }) => { + this.isDragging && l && (Xi((d) => { const p = this.getAxisMotionValue(d); p && (this.originPoint[d] += u[d].translate, p.set(p.get() + u[d].translate)); }), this.visualElement.render()); @@ -33645,40 +33676,40 @@ class Vee { function vd(t, e, r) { return (e === !0 || e === t) && (r === null || r === t); } -function Gee(t, e = 10) { +function Xee(t, e = 10) { let r = null; return Math.abs(t.y) > e ? r = "y" : Math.abs(t.x) > e && (r = "x"), r; } -class Yee extends Oa { +class Zee extends Ra { constructor(e) { - super(e), this.removeGroupControls = Un, this.removeListeners = Un, this.controls = new Vee(e); + super(e), this.removeGroupControls = qn, this.removeListeners = qn, this.controls = new Jee(e); } mount() { const { dragControls: e } = this.node.getProps(); - e && (this.removeGroupControls = e.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || Un; + e && (this.removeGroupControls = e.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || qn; } unmount() { this.removeGroupControls(), this.removeListeners(); } } -const O_ = (t) => (e, r) => { +const R_ = (t) => (e, r) => { t && Lr.postRender(() => t(e, r)); }; -class Jee extends Oa { +class Qee extends Ra { constructor() { - super(...arguments), this.removePointerDownListener = Un; + super(...arguments), this.removePointerDownListener = qn; } onPointerDown(e) { - this.session = new k7(e, this.createPanHandlers(), { + this.session = new N7(e, this.createPanHandlers(), { transformPagePoint: this.node.getTransformPagePoint(), - contextWindow: V7(this.node) + contextWindow: H7(this.node) }); } createPanHandlers() { const { onPanSessionStart: e, onPanStart: r, onPan: n, onPanEnd: i } = this.node.getProps(); return { - onSessionStart: O_(e), - onStart: O_(r), + onSessionStart: R_(e), + onStart: R_(r), onMove: n, onEnd: (s, o) => { delete this.session, i && Lr.postRender(() => i(s, o)); @@ -33686,7 +33717,7 @@ class Jee extends Oa { }; } mount() { - this.removePointerDownListener = No(this.node.current, "pointerdown", (e) => this.onPointerDown(e)); + this.removePointerDownListener = Do(this.node.current, "pointerdown", (e) => this.onPointerDown(e)); } update() { this.session && this.session.updateHandlers(this.createPanHandlers()); @@ -33695,8 +33726,8 @@ class Jee extends Oa { this.removePointerDownListener(), this.session && this.session.end(); } } -const _p = Ma(null); -function Xee() { +const _p = Sa(null); +function ete() { const t = Tn(_p); if (t === null) return [!0, null]; @@ -33705,7 +33736,7 @@ function Xee() { const s = vv(() => r && r(i), [i, r]); return !e && r ? [!1, s] : [!0]; } -const Yb = Ma({}), G7 = Ma({}), jd = { +const Yb = Sa({}), K7 = Sa({}), jd = { /** * Global flag as to whether the tree has animated since the last time * we resized the window @@ -33717,7 +33748,7 @@ const Yb = Ma({}), G7 = Ma({}), jd = { */ hasEverUpdated: !1 }; -function N_(t, e) { +function D_(t, e) { return e.max === e.min ? 0 : t / (e.max - e.min) * 100; } const Of = { @@ -33729,25 +33760,25 @@ const Of = { t = parseFloat(t); else return t; - const r = N_(t, e.target.x), n = N_(t, e.target.y); + const r = D_(t, e.target.x), n = D_(t, e.target.y); return `${r}% ${n}%`; } -}, Zee = { +}, tte = { correct: (t, { treeScale: e, projectionDelta: r }) => { - const n = t, i = Aa.parse(t); + const n = t, i = _a.parse(t); if (i.length > 5) return n; - const s = Aa.createTransformer(t), o = typeof i[0] != "number" ? 1 : 0, a = r.x.scale * e.x, u = r.y.scale * e.y; + const s = _a.createTransformer(t), o = typeof i[0] != "number" ? 1 : 0, a = r.x.scale * e.x, u = r.y.scale * e.y; i[0 + o] /= a, i[1 + o] /= u; const l = Qr(a, u, 0.5); return typeof i[2 + o] == "number" && (i[2 + o] /= l), typeof i[3 + o] == "number" && (i[3 + o] /= l), s(i); } }, _0 = {}; -function Qee(t) { +function rte(t) { Object.assign(_0, t); } -const { schedule: Jb } = JS(queueMicrotask, !1); -class ete extends LR { +const { schedule: Jb } = GS(queueMicrotask, !1); +class nte extends kR { /** * This only mounts projection nodes for components that * need measuring, we might want to do it for all components @@ -33755,7 +33786,7 @@ class ete extends LR { */ componentDidMount() { const { visualElement: e, layoutGroup: r, switchLayoutGroup: n, layoutId: i } = this.props, { projection: s } = e; - Qee(tte), s && (r.group && r.group.add(s), n && n.register && i && n.register(s), s.root.didUpdate(), s.addEventListener("animationComplete", () => { + rte(ite), s && (r.group && r.group.add(s), n && n.register && i && n.register(s), s.root.didUpdate(), s.addEventListener("animationComplete", () => { this.safeToRemove(); }), s.setOptions({ ...s.options, @@ -33787,11 +33818,11 @@ class ete extends LR { return null; } } -function Y7(t) { - const [e, r] = Xee(), n = Tn(Yb); - return fe.jsx(ete, { ...t, layoutGroup: n, switchLayoutGroup: Tn(G7), isPresent: e, safeToRemove: r }); +function V7(t) { + const [e, r] = ete(), n = Tn(Yb); + return pe.jsx(nte, { ...t, layoutGroup: n, switchLayoutGroup: Tn(K7), isPresent: e, safeToRemove: r }); } -const tte = { +const ite = { borderRadius: { ...Of, applyTo: [ @@ -33805,81 +33836,81 @@ const tte = { borderTopRightRadius: Of, borderBottomLeftRadius: Of, borderBottomRightRadius: Of, - boxShadow: Zee -}, J7 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], rte = J7.length, L_ = (t) => typeof t == "string" ? parseFloat(t) : t, k_ = (t) => typeof t == "number" || Vt.test(t); -function nte(t, e, r, n, i, s) { + boxShadow: tte +}, G7 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], ste = G7.length, O_ = (t) => typeof t == "string" ? parseFloat(t) : t, N_ = (t) => typeof t == "number" || Vt.test(t); +function ote(t, e, r, n, i, s) { i ? (t.opacity = Qr( 0, // TODO Reinstate this if only child r.opacity !== void 0 ? r.opacity : 1, - ite(n) - ), t.opacityExit = Qr(e.opacity !== void 0 ? e.opacity : 1, 0, ste(n))) : s && (t.opacity = Qr(e.opacity !== void 0 ? e.opacity : 1, r.opacity !== void 0 ? r.opacity : 1, n)); - for (let o = 0; o < rte; o++) { - const a = `border${J7[o]}Radius`; - let u = $_(e, a), l = $_(r, a); + ate(n) + ), t.opacityExit = Qr(e.opacity !== void 0 ? e.opacity : 1, 0, cte(n))) : s && (t.opacity = Qr(e.opacity !== void 0 ? e.opacity : 1, r.opacity !== void 0 ? r.opacity : 1, n)); + for (let o = 0; o < ste; o++) { + const a = `border${G7[o]}Radius`; + let u = L_(e, a), l = L_(r, a); if (u === void 0 && l === void 0) continue; - u || (u = 0), l || (l = 0), u === 0 || l === 0 || k_(u) === k_(l) ? (t[a] = Math.max(Qr(L_(u), L_(l), n), 0), (Gs.test(l) || Gs.test(u)) && (t[a] += "%")) : t[a] = l; + u || (u = 0), l || (l = 0), u === 0 || l === 0 || N_(u) === N_(l) ? (t[a] = Math.max(Qr(O_(u), O_(l), n), 0), (Gs.test(l) || Gs.test(u)) && (t[a] += "%")) : t[a] = l; } (e.rotate || r.rotate) && (t.rotate = Qr(e.rotate || 0, r.rotate || 0, n)); } -function $_(t, e) { +function L_(t, e) { return t[e] !== void 0 ? t[e] : t.borderRadius; } -const ite = /* @__PURE__ */ X7(0, 0.5, n7), ste = /* @__PURE__ */ X7(0.5, 0.95, Un); -function X7(t, e, r) { +const ate = /* @__PURE__ */ Y7(0, 0.5, t7), cte = /* @__PURE__ */ Y7(0.5, 0.95, qn); +function Y7(t, e, r) { return (n) => n < t ? 0 : n > e ? 1 : r(Iu(t, e, n)); } -function B_(t, e) { +function k_(t, e) { t.min = e.min, t.max = e.max; } -function Ji(t, e) { - B_(t.x, e.x), B_(t.y, e.y); +function Yi(t, e) { + k_(t.x, e.x), k_(t.y, e.y); } -function F_(t, e) { +function $_(t, e) { t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin; } -function j_(t, e, r, n, i) { +function B_(t, e, r, n, i) { return t -= e, t = x0(t, 1 / r, n), i !== void 0 && (t = x0(t, 1 / i, n)), t; } -function ote(t, e = 0, r = 1, n = 0.5, i, s = t, o = t) { +function ute(t, e = 0, r = 1, n = 0.5, i, s = t, o = t) { if (Gs.test(e) && (e = parseFloat(e), e = Qr(o.min, o.max, e / 100) - o.min), typeof e != "number") return; let a = Qr(s.min, s.max, n); - t === s && (a -= e), t.min = j_(t.min, e, r, a, i), t.max = j_(t.max, e, r, a, i); + t === s && (a -= e), t.min = B_(t.min, e, r, a, i), t.max = B_(t.max, e, r, a, i); } -function U_(t, e, [r, n, i], s, o) { - ote(t, e[r], e[n], e[i], e.scale, s, o); +function F_(t, e, [r, n, i], s, o) { + ute(t, e[r], e[n], e[i], e.scale, s, o); } -const ate = ["x", "scaleX", "originX"], cte = ["y", "scaleY", "originY"]; -function q_(t, e, r, n) { - U_(t.x, e, ate, r ? r.x : void 0, n ? n.x : void 0), U_(t.y, e, cte, r ? r.y : void 0, n ? n.y : void 0); +const fte = ["x", "scaleX", "originX"], lte = ["y", "scaleY", "originY"]; +function j_(t, e, r, n) { + F_(t.x, e, fte, r ? r.x : void 0, n ? n.x : void 0), F_(t.y, e, lte, r ? r.y : void 0, n ? n.y : void 0); } -function z_(t) { +function U_(t) { return t.translate === 0 && t.scale === 1; } -function Z7(t) { - return z_(t.x) && z_(t.y); +function J7(t) { + return U_(t.x) && U_(t.y); } -function W_(t, e) { +function q_(t, e) { return t.min === e.min && t.max === e.max; } -function ute(t, e) { - return W_(t.x, e.x) && W_(t.y, e.y); +function hte(t, e) { + return q_(t.x, e.x) && q_(t.y, e.y); } -function H_(t, e) { +function z_(t, e) { return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max); } -function Q7(t, e) { - return H_(t.x, e.x) && H_(t.y, e.y); +function X7(t, e) { + return z_(t.x, e.x) && z_(t.y, e.y); } -function K_(t) { - return ki(t.x) / ki(t.y); +function W_(t) { + return Li(t.x) / Li(t.y); } -function V_(t, e) { +function H_(t, e) { return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint; } -class fte { +class dte { constructor() { this.members = []; } @@ -33933,18 +33964,18 @@ class fte { this.lead && this.lead.snapshot && (this.lead.snapshot = void 0); } } -function lte(t, e, r) { +function pte(t, e, r) { let n = ""; const i = t.x.translate / e.x, s = t.y.translate / e.y, o = (r == null ? void 0 : r.z) || 0; if ((i || s || o) && (n = `translate3d(${i}px, ${s}px, ${o}px) `), (e.x !== 1 || e.y !== 1) && (n += `scale(${1 / e.x}, ${1 / e.y}) `), r) { - const { transformPerspective: l, rotate: d, rotateX: p, rotateY: w, skewX: A, skewY: P } = r; - l && (n = `perspective(${l}px) ${n}`), d && (n += `rotate(${d}deg) `), p && (n += `rotateX(${p}deg) `), w && (n += `rotateY(${w}deg) `), A && (n += `skewX(${A}deg) `), P && (n += `skewY(${P}deg) `); + const { transformPerspective: l, rotate: d, rotateX: p, rotateY: w, skewX: A, skewY: M } = r; + l && (n = `perspective(${l}px) ${n}`), d && (n += `rotate(${d}deg) `), p && (n += `rotateX(${p}deg) `), w && (n += `rotateY(${w}deg) `), A && (n += `skewX(${A}deg) `), M && (n += `skewY(${M}deg) `); } const a = t.x.scale * e.x, u = t.y.scale * e.y; return (a !== 1 || u !== 1) && (n += `scale(${a}, ${u})`), n || "none"; } -const hte = (t, e) => t.depth - e.depth; -class dte { +const gte = (t, e) => t.depth - e.depth; +class mte { constructor() { this.children = [], this.isDirty = !1; } @@ -33955,63 +33986,63 @@ class dte { Kb(this.children, e), this.isDirty = !0; } forEach(e) { - this.isDirty && this.children.sort(hte), this.isDirty = !1, this.children.forEach(e); + this.isDirty && this.children.sort(gte), this.isDirty = !1, this.children.forEach(e); } } function Ud(t) { - const e = Xn(t) ? t.get() : t; - return iee(e) ? e.toValue() : e; + const e = Zn(t) ? t.get() : t; + return aee(e) ? e.toValue() : e; } -function pte(t, e) { +function vte(t, e) { const r = Ys.now(), n = ({ timestamp: i }) => { const s = i - r; - s >= e && (Ea(n), t(s - e)); + s >= e && (wa(n), t(s - e)); }; - return Lr.read(n, !0), () => Ea(n); + return Lr.read(n, !0), () => wa(n); } -function gte(t) { +function bte(t) { return t instanceof SVGElement && t.tagName !== "svg"; } -function mte(t, e, r) { - const n = Xn(t) ? t : Rl(t); +function yte(t, e, r) { + const n = Zn(t) ? t : Rl(t); return n.start(Wb("", n, e, r)), n.animation; } -const Za = { +const Ja = { type: "projectionFrame", totalNodes: 0, resolvedTargetDeltas: 0, recalculatedProjection: 0 -}, Uf = typeof window < "u" && window.MotionDebug !== void 0, jm = ["", "X", "Y", "Z"], vte = { visibility: "hidden" }, G_ = 1e3; -let bte = 0; +}, Uf = typeof window < "u" && window.MotionDebug !== void 0, jm = ["", "X", "Y", "Z"], wte = { visibility: "hidden" }, K_ = 1e3; +let xte = 0; function Um(t, e, r, n) { const { latestValues: i } = e; i[t] && (r[t] = i[t], e.setStaticValue(t, 0), n && (n[t] = 0)); } -function e9(t) { +function Z7(t) { if (t.hasCheckedOptimisedAppear = !0, t.root === t) return; const { visualElement: e } = t.options; if (!e) return; - const r = D7(e); + const r = T7(e); if (window.MotionHasOptimisedAnimation(r, "transform")) { const { layout: i, layoutId: s } = t.options; window.MotionCancelOptimisedAnimation(r, "transform", Lr, !(i || s)); } const { parent: n } = t; - n && !n.hasCheckedOptimisedAppear && e9(n); + n && !n.hasCheckedOptimisedAppear && Z7(n); } -function t9({ attachResizeListener: t, defaultParent: e, measureScroll: r, checkIsScrollRoot: n, resetTransform: i }) { +function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, checkIsScrollRoot: n, resetTransform: i }) { return class { constructor(o = {}, a = e == null ? void 0 : e()) { - this.id = bte++, this.animationId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => { + this.id = xte++, this.animationId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => { this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots()); }, this.updateProjection = () => { - this.projectionUpdateScheduled = !1, Uf && (Za.totalNodes = Za.resolvedTargetDeltas = Za.recalculatedProjection = 0), this.nodes.forEach(xte), this.nodes.forEach(Pte), this.nodes.forEach(Mte), this.nodes.forEach(_te), Uf && window.MotionDebug.record(Za); + this.projectionUpdateScheduled = !1, Uf && (Ja.totalNodes = Ja.resolvedTargetDeltas = Ja.recalculatedProjection = 0), this.nodes.forEach(Ste), this.nodes.forEach(Cte), this.nodes.forEach(Tte), this.nodes.forEach(Ate), Uf && window.MotionDebug.record(Ja); }, this.resolvedRelativeTargetAt = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = o, this.root = a ? a.root || a : this, this.path = a ? [...a.path, a] : [], this.parent = a, this.depth = a ? a.depth + 1 : 0; for (let u = 0; u < this.path.length; u++) this.path[u].shouldResetTransform = !0; - this.root === this && (this.nodes = new dte()); + this.root === this && (this.nodes = new mte()); } addEventListener(o, a) { return this.eventHandlers.has(o) || this.eventHandlers.set(o, new Vb()), this.eventHandlers.get(o).add(a); @@ -34029,38 +34060,38 @@ function t9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check mount(o, a = this.root.hasTreeAnimated) { if (this.instance) return; - this.isSVG = gte(o), this.instance = o; + this.isSVG = bte(o), this.instance = o; const { layoutId: u, layout: l, visualElement: d } = this.options; if (d && !d.current && d.mount(o), this.root.nodes.add(this), this.parent && this.parent.children.add(this), a && (l || u) && (this.isLayoutDirty = !0), t) { let p; const w = () => this.root.updateBlockedByResize = !1; t(o, () => { - this.root.updateBlockedByResize = !0, p && p(), p = pte(w, 250), jd.hasAnimatedSinceResize && (jd.hasAnimatedSinceResize = !1, this.nodes.forEach(J_)); + this.root.updateBlockedByResize = !0, p && p(), p = vte(w, 250), jd.hasAnimatedSinceResize && (jd.hasAnimatedSinceResize = !1, this.nodes.forEach(G_)); }); } - u && this.root.registerSharedNode(u, this), this.options.animate !== !1 && d && (u || l) && this.addEventListener("didUpdate", ({ delta: p, hasLayoutChanged: w, hasRelativeTargetChanged: A, layout: P }) => { + u && this.root.registerSharedNode(u, this), this.options.animate !== !1 && d && (u || l) && this.addEventListener("didUpdate", ({ delta: p, hasLayoutChanged: w, hasRelativeTargetChanged: A, layout: M }) => { if (this.isTreeAnimationBlocked()) { this.target = void 0, this.relativeTarget = void 0; return; } - const N = this.options.transition || d.getDefaultTransition() || Dte, { onLayoutAnimationStart: L, onLayoutAnimationComplete: $ } = d.getProps(), B = !this.targetLayout || !Q7(this.targetLayout, P) || A, H = !w && A; - if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || H || w && (B || !this.currentAnimation)) { + const N = this.options.transition || d.getDefaultTransition() || Lte, { onLayoutAnimationStart: L, onLayoutAnimationComplete: B } = d.getProps(), $ = !this.targetLayout || !X7(this.targetLayout, M) || A, H = !w && A; + if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || H || w && ($ || !this.currentAnimation)) { this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0), this.setAnimationOrigin(p, H); const W = { ...Tb(N, "layout"), onPlay: L, - onComplete: $ + onComplete: B }; (d.shouldReduceMotion || this.options.layoutRoot) && (W.delay = 0, W.type = !1), this.startAnimation(W); } else - w || J_(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete(); - this.targetLayout = P; + w || G_(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete(); + this.targetLayout = M; }); } unmount() { this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this); const o = this.getStack(); - o && o.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, Ea(this.updateProjection); + o && o.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, wa(this.updateProjection); } // only on the root blockUpdate() { @@ -34077,7 +34108,7 @@ function t9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check } // Note: currently only running on root node startUpdate() { - this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(Ite), this.animationId++); + this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(Rte), this.animationId++); } getTransformTemplate() { const { visualElement: o } = this.options; @@ -34088,7 +34119,7 @@ function t9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.options.onExitComplete && this.options.onExitComplete(); return; } - if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && e9(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty) + if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && Z7(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty) return; this.isLayoutDirty = !0; for (let d = 0; d < this.path.length; d++) { @@ -34103,18 +34134,18 @@ function t9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check } update() { if (this.updateScheduled = !1, this.isUpdateBlocked()) { - this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(Y_); + this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(V_); return; } - this.isUpdating || this.nodes.forEach(Ste), this.isUpdating = !1, this.nodes.forEach(Ate), this.nodes.forEach(yte), this.nodes.forEach(wte), this.clearAllSnapshots(); + this.isUpdating || this.nodes.forEach(Mte), this.isUpdating = !1, this.nodes.forEach(Ite), this.nodes.forEach(_te), this.nodes.forEach(Ete), this.clearAllSnapshots(); const a = Ys.now(); - Fn.delta = Sa(0, 1e3 / 60, a - Fn.timestamp), Fn.timestamp = a, Fn.isProcessing = !0, Dm.update.process(Fn), Dm.preRender.process(Fn), Dm.render.process(Fn), Fn.isProcessing = !1; + Fn.delta = xa(0, 1e3 / 60, a - Fn.timestamp), Fn.timestamp = a, Fn.isProcessing = !0, Dm.update.process(Fn), Dm.preRender.process(Fn), Dm.render.process(Fn), Fn.isProcessing = !1; } didUpdate() { this.updateScheduled || (this.updateScheduled = !0, Jb.read(this.scheduleUpdate)); } clearAllSnapshots() { - this.nodes.forEach(Ete), this.sharedNodes.forEach(Cte); + this.nodes.forEach(Pte), this.sharedNodes.forEach(Dte); } scheduleUpdateProjection() { this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, Lr.preRender(this.updateProjection, !1, !0)); @@ -34157,13 +34188,13 @@ function t9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check resetTransform() { if (!i) return; - const o = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, a = this.projectionDelta && !Z7(this.projectionDelta), u = this.getTransformTemplate(), l = u ? u(this.latestValues, "") : void 0, d = l !== this.prevTransformTemplateValue; - o && (a || Xa(this.latestValues) || d) && (i(this.instance, l), this.shouldResetTransform = !1, this.scheduleRender()); + const o = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, a = this.projectionDelta && !J7(this.projectionDelta), u = this.getTransformTemplate(), l = u ? u(this.latestValues, "") : void 0, d = l !== this.prevTransformTemplateValue; + o && (a || Ya(this.latestValues) || d) && (i(this.instance, l), this.shouldResetTransform = !1, this.scheduleRender()); } measure(o = !0) { const a = this.measurePageBox(); let u = this.removeElementScroll(a); - return o && (u = this.removeTransform(u)), Ote(u), { + return o && (u = this.removeTransform(u)), kte(u), { animationId: this.root.animationId, measuredBox: a, layoutBox: u, @@ -34177,7 +34208,7 @@ function t9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check if (!a) return ln(); const u = a.measureViewportBox(); - if (!(((o = this.scroll) === null || o === void 0 ? void 0 : o.wasRoot) || this.path.some(Nte))) { + if (!(((o = this.scroll) === null || o === void 0 ? void 0 : o.wasRoot) || this.path.some($te))) { const { scroll: d } = this.root; d && (nu(u.x, d.offset.x), nu(u.y, d.offset.y)); } @@ -34186,38 +34217,38 @@ function t9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check removeElementScroll(o) { var a; const u = ln(); - if (Ji(u, o), !((a = this.scroll) === null || a === void 0) && a.wasRoot) + if (Yi(u, o), !((a = this.scroll) === null || a === void 0) && a.wasRoot) return u; for (let l = 0; l < this.path.length; l++) { const d = this.path[l], { scroll: p, options: w } = d; - d !== this.root && p && w.layoutScroll && (p.wasRoot && Ji(u, o), nu(u.x, p.offset.x), nu(u.y, p.offset.y)); + d !== this.root && p && w.layoutScroll && (p.wasRoot && Yi(u, o), nu(u.x, p.offset.x), nu(u.y, p.offset.y)); } return u; } applyTransform(o, a = !1) { const u = ln(); - Ji(u, o); + Yi(u, o); for (let l = 0; l < this.path.length; l++) { const d = this.path[l]; !a && d.options.layoutScroll && d.scroll && d !== d.root && iu(u, { x: -d.scroll.offset.x, y: -d.scroll.offset.y - }), Xa(d.latestValues) && iu(u, d.latestValues); + }), Ya(d.latestValues) && iu(u, d.latestValues); } - return Xa(this.latestValues) && iu(u, this.latestValues), u; + return Ya(this.latestValues) && iu(u, this.latestValues), u; } removeTransform(o) { const a = ln(); - Ji(a, o); + Yi(a, o); for (let u = 0; u < this.path.length; u++) { const l = this.path[u]; - if (!l.instance || !Xa(l.latestValues)) + if (!l.instance || !Ya(l.latestValues)) continue; av(l.latestValues) && l.updateSnapshot(); const d = ln(), p = l.measurePageBox(); - Ji(d, p), q_(a, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, d); + Yi(d, p), j_(a, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, d); } - return Xa(this.latestValues) && q_(a, this.latestValues), a; + return Ya(this.latestValues) && j_(a, this.latestValues), a; } setTargetDelta(o) { this.targetDelta = o, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0; @@ -34246,20 +34277,20 @@ function t9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check if (!(!this.layout || !(p || w))) { if (this.resolvedRelativeTargetAt = Fn.timestamp, !this.targetDelta && !this.relativeTarget) { const A = this.getClosestProjectingParent(); - A && A.layout && this.animationProgress !== 1 ? (this.relativeParent = A, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), Xf(this.relativeTargetOrigin, this.layout.layoutBox, A.layout.layoutBox), Ji(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; + A && A.layout && this.animationProgress !== 1 ? (this.relativeParent = A, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), Xf(this.relativeTargetOrigin, this.layout.layoutBox, A.layout.layoutBox), Yi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; } if (!(!this.relativeTarget && !this.targetDelta)) { - if (this.target || (this.target = ln(), this.targetWithTransforms = ln()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), Lee(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : Ji(this.target, this.layout.layoutBox), H7(this.target, this.targetDelta)) : Ji(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget) { + if (this.target || (this.target = ln(), this.targetWithTransforms = ln()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), Bee(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : Yi(this.target, this.layout.layoutBox), z7(this.target, this.targetDelta)) : Yi(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget) { this.attemptToResolveRelativeTarget = !1; const A = this.getClosestProjectingParent(); - A && !!A.resumingFrom == !!this.resumingFrom && !A.options.layoutScroll && A.target && this.animationProgress !== 1 ? (this.relativeParent = A, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), Xf(this.relativeTargetOrigin, this.target, A.target), Ji(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; + A && !!A.resumingFrom == !!this.resumingFrom && !A.options.layoutScroll && A.target && this.animationProgress !== 1 ? (this.relativeParent = A, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), Xf(this.relativeTargetOrigin, this.target, A.target), Yi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; } - Uf && Za.resolvedTargetDeltas++; + Uf && Ja.resolvedTargetDeltas++; } } } getClosestProjectingParent() { - if (!(!this.parent || av(this.parent.latestValues) || W7(this.parent.latestValues))) + if (!(!this.parent || av(this.parent.latestValues) || q7(this.parent.latestValues))) return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent(); } isProjecting() { @@ -34274,15 +34305,15 @@ function t9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check const { layout: d, layoutId: p } = this.options; if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(d || p)) return; - Ji(this.layoutCorrected, this.layout.layoutBox); + Yi(this.layoutCorrected, this.layout.layoutBox); const w = this.treeScale.x, A = this.treeScale.y; - Wee(this.layoutCorrected, this.treeScale, this.path, u), a.layout && !a.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (a.target = a.layout.layoutBox, a.targetWithTransforms = ln()); - const { target: P } = a; - if (!P) { + Vee(this.layoutCorrected, this.treeScale, this.path, u), a.layout && !a.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (a.target = a.layout.layoutBox, a.targetWithTransforms = ln()); + const { target: M } = a; + if (!M) { this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender()); return; } - !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (F_(this.prevProjectionDelta.x, this.projectionDelta.x), F_(this.prevProjectionDelta.y, this.projectionDelta.y)), Jf(this.projectionDelta, this.layoutCorrected, P, this.latestValues), (this.treeScale.x !== w || this.treeScale.y !== A || !V_(this.projectionDelta.x, this.prevProjectionDelta.x) || !V_(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", P)), Uf && Za.recalculatedProjection++; + !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : ($_(this.prevProjectionDelta.x, this.projectionDelta.x), $_(this.prevProjectionDelta.y, this.projectionDelta.y)), Jf(this.projectionDelta, this.layoutCorrected, M, this.latestValues), (this.treeScale.x !== w || this.treeScale.y !== A || !H_(this.projectionDelta.x, this.prevProjectionDelta.x) || !H_(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", M)), Uf && Ja.recalculatedProjection++; } hide() { this.isVisible = !1; @@ -34304,17 +34335,17 @@ function t9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check setAnimationOrigin(o, a = !1) { const u = this.snapshot, l = u ? u.latestValues : {}, d = { ...this.latestValues }, p = ru(); (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !a; - const w = ln(), A = u ? u.source : void 0, P = this.layout ? this.layout.source : void 0, N = A !== P, L = this.getStack(), $ = !L || L.members.length <= 1, B = !!(N && !$ && this.options.crossfade === !0 && !this.path.some(Rte)); + const w = ln(), A = u ? u.source : void 0, M = this.layout ? this.layout.source : void 0, N = A !== M, L = this.getStack(), B = !L || L.members.length <= 1, $ = !!(N && !B && this.options.crossfade === !0 && !this.path.some(Nte)); this.animationProgress = 0; let H; this.mixTargetDelta = (W) => { const V = W / 1e3; - X_(p.x, o.x, V), X_(p.y, o.y, V), this.setTargetDelta(p), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Xf(w, this.layout.layoutBox, this.relativeParent.layout.layoutBox), Tte(this.relativeTarget, this.relativeTargetOrigin, w, V), H && ute(this.relativeTarget, H) && (this.isProjectionDirty = !1), H || (H = ln()), Ji(H, this.relativeTarget)), N && (this.animationValues = d, nte(d, l, this.latestValues, V, B, $)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V; + Y_(p.x, o.x, V), Y_(p.y, o.y, V), this.setTargetDelta(p), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Xf(w, this.layout.layoutBox, this.relativeParent.layout.layoutBox), Ote(this.relativeTarget, this.relativeTargetOrigin, w, V), H && hte(this.relativeTarget, H) && (this.isProjectionDirty = !1), H || (H = ln()), Yi(H, this.relativeTarget)), N && (this.animationValues = d, ote(d, l, this.latestValues, V, $, B)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V; }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0); } startAnimation(o) { - this.notifyListeners("animationStart"), this.currentAnimation && this.currentAnimation.stop(), this.resumingFrom && this.resumingFrom.currentAnimation && this.resumingFrom.currentAnimation.stop(), this.pendingAnimation && (Ea(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = Lr.update(() => { - jd.hasAnimatedSinceResize = !0, this.currentAnimation = mte(0, G_, { + this.notifyListeners("animationStart"), this.currentAnimation && this.currentAnimation.stop(), this.resumingFrom && this.resumingFrom.currentAnimation && this.resumingFrom.currentAnimation.stop(), this.pendingAnimation && (wa(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = Lr.update(() => { + jd.hasAnimatedSinceResize = !0, this.currentAnimation = yte(0, K_, { ...o, onUpdate: (a) => { this.mixTargetDelta(a), o.onUpdate && o.onUpdate(a); @@ -34331,24 +34362,24 @@ function t9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check o && o.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete"); } finishAnimation() { - this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(G_), this.currentAnimation.stop()), this.completeAnimation(); + this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(K_), this.currentAnimation.stop()), this.completeAnimation(); } applyTransformsToTarget() { const o = this.getLead(); let { targetWithTransforms: a, target: u, layout: l, latestValues: d } = o; if (!(!a || !u || !l)) { - if (this !== o && this.layout && l && r9(this.options.animationType, this.layout.layoutBox, l.layoutBox)) { + if (this !== o && this.layout && l && e9(this.options.animationType, this.layout.layoutBox, l.layoutBox)) { u = this.target || ln(); - const p = ki(this.layout.layoutBox.x); + const p = Li(this.layout.layoutBox.x); u.x.min = o.target.x.min, u.x.max = u.x.min + p; - const w = ki(this.layout.layoutBox.y); + const w = Li(this.layout.layoutBox.y); u.y.min = o.target.y.min, u.y.max = u.y.min + w; } - Ji(a, u), iu(a, d), Jf(this.projectionDeltaWithTransform, this.layoutCorrected, a, d); + Yi(a, u), iu(a, d), Jf(this.projectionDeltaWithTransform, this.layoutCorrected, a, d); } } registerSharedNode(o, a) { - this.sharedNodes.has(o) || this.sharedNodes.set(o, new fte()), this.sharedNodes.get(o).add(a); + this.sharedNodes.has(o) || this.sharedNodes.set(o, new dte()), this.sharedNodes.get(o).add(a); const l = a.options.initialPromotionConfig; a.promote({ transition: l ? l.transition : void 0, @@ -34404,7 +34435,7 @@ function t9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check if (!this.instance || this.isSVG) return; if (!this.isVisible) - return vte; + return wte; const l = { visibility: "" }, d = this.getTransformTemplate(); @@ -34413,22 +34444,22 @@ function t9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check const p = this.getLead(); if (!this.projectionDelta || !this.layout || !p.target) { const N = {}; - return this.options.layoutId && (N.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, N.pointerEvents = Ud(o == null ? void 0 : o.pointerEvents) || ""), this.hasProjected && !Xa(this.latestValues) && (N.transform = d ? d({}, "") : "none", this.hasProjected = !1), N; + return this.options.layoutId && (N.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, N.pointerEvents = Ud(o == null ? void 0 : o.pointerEvents) || ""), this.hasProjected && !Ya(this.latestValues) && (N.transform = d ? d({}, "") : "none", this.hasProjected = !1), N; } const w = p.animationValues || p.latestValues; - this.applyTransformsToTarget(), l.transform = lte(this.projectionDeltaWithTransform, this.treeScale, w), d && (l.transform = d(w, l.transform)); - const { x: A, y: P } = this.projectionDelta; - l.transformOrigin = `${A.origin * 100}% ${P.origin * 100}% 0`, p.animationValues ? l.opacity = p === this ? (u = (a = w.opacity) !== null && a !== void 0 ? a : this.latestValues.opacity) !== null && u !== void 0 ? u : 1 : this.preserveOpacity ? this.latestValues.opacity : w.opacityExit : l.opacity = p === this ? w.opacity !== void 0 ? w.opacity : "" : w.opacityExit !== void 0 ? w.opacityExit : 0; + this.applyTransformsToTarget(), l.transform = pte(this.projectionDeltaWithTransform, this.treeScale, w), d && (l.transform = d(w, l.transform)); + const { x: A, y: M } = this.projectionDelta; + l.transformOrigin = `${A.origin * 100}% ${M.origin * 100}% 0`, p.animationValues ? l.opacity = p === this ? (u = (a = w.opacity) !== null && a !== void 0 ? a : this.latestValues.opacity) !== null && u !== void 0 ? u : 1 : this.preserveOpacity ? this.latestValues.opacity : w.opacityExit : l.opacity = p === this ? w.opacity !== void 0 ? w.opacity : "" : w.opacityExit !== void 0 ? w.opacityExit : 0; for (const N in _0) { if (w[N] === void 0) continue; - const { correct: L, applyTo: $ } = _0[N], B = l.transform === "none" ? w[N] : L(w[N], p); - if ($) { - const H = $.length; + const { correct: L, applyTo: B } = _0[N], $ = l.transform === "none" ? w[N] : L(w[N], p); + if (B) { + const H = B.length; for (let W = 0; W < H; W++) - l[$[W]] = B; + l[B[W]] = $; } else - l[N] = B; + l[N] = $; } return this.options.layoutId && (l.pointerEvents = p === this ? Ud(o == null ? void 0 : o.pointerEvents) || "" : "none"), l; } @@ -34440,40 +34471,40 @@ function t9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.root.nodes.forEach((o) => { var a; return (a = o.currentAnimation) === null || a === void 0 ? void 0 : a.stop(); - }), this.root.nodes.forEach(Y_), this.root.sharedNodes.clear(); + }), this.root.nodes.forEach(V_), this.root.sharedNodes.clear(); } }; } -function yte(t) { +function _te(t) { t.updateLayout(); } -function wte(t) { +function Ete(t) { var e; const r = ((e = t.resumeFrom) === null || e === void 0 ? void 0 : e.snapshot) || t.snapshot; if (t.isLead() && t.layout && r && t.hasListeners("didUpdate")) { const { layoutBox: n, measuredBox: i } = t.layout, { animationType: s } = t.options, o = r.source !== t.layout.source; - s === "size" ? Zi((p) => { - const w = o ? r.measuredBox[p] : r.layoutBox[p], A = ki(w); + s === "size" ? Xi((p) => { + const w = o ? r.measuredBox[p] : r.layoutBox[p], A = Li(w); w.min = n[p].min, w.max = w.min + A; - }) : r9(s, r.layoutBox, n) && Zi((p) => { - const w = o ? r.measuredBox[p] : r.layoutBox[p], A = ki(n[p]); + }) : e9(s, r.layoutBox, n) && Xi((p) => { + const w = o ? r.measuredBox[p] : r.layoutBox[p], A = Li(n[p]); w.max = w.min + A, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[p].max = t.relativeTarget[p].min + A); }); const a = ru(); Jf(a, n, r.layoutBox); const u = ru(); o ? Jf(u, t.applyTransform(i, !0), r.measuredBox) : Jf(u, n, r.layoutBox); - const l = !Z7(a); + const l = !J7(a); let d = !1; if (!t.resumeFrom) { const p = t.getClosestProjectingParent(); if (p && !p.resumeFrom) { const { snapshot: w, layout: A } = p; if (w && A) { - const P = ln(); - Xf(P, r.layoutBox, w.layoutBox); + const M = ln(); + Xf(M, r.layoutBox, w.layoutBox); const N = ln(); - Xf(N, n, A.layoutBox), Q7(P, N) || (d = !0), p.options.layoutRoot && (t.relativeTarget = N, t.relativeTargetOrigin = P, t.relativeParent = p); + Xf(N, n, A.layoutBox), X7(M, N) || (d = !0), p.options.layoutRoot && (t.relativeTarget = N, t.relativeTargetOrigin = M, t.relativeParent = p); } } } @@ -34491,71 +34522,71 @@ function wte(t) { } t.options.transition = void 0; } -function xte(t) { - Uf && Za.totalNodes++, t.parent && (t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty), t.isSharedProjectionDirty || (t.isSharedProjectionDirty = !!(t.isProjectionDirty || t.parent.isProjectionDirty || t.parent.isSharedProjectionDirty)), t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty)); +function Ste(t) { + Uf && Ja.totalNodes++, t.parent && (t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty), t.isSharedProjectionDirty || (t.isSharedProjectionDirty = !!(t.isProjectionDirty || t.parent.isProjectionDirty || t.parent.isSharedProjectionDirty)), t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty)); } -function _te(t) { +function Ate(t) { t.isProjectionDirty = t.isSharedProjectionDirty = t.isTransformDirty = !1; } -function Ete(t) { +function Pte(t) { t.clearSnapshot(); } -function Y_(t) { +function V_(t) { t.clearMeasurements(); } -function Ste(t) { +function Mte(t) { t.isLayoutDirty = !1; } -function Ate(t) { +function Ite(t) { const { visualElement: e } = t.options; e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform(); } -function J_(t) { +function G_(t) { t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0; } -function Pte(t) { +function Cte(t) { t.resolveTargetDelta(); } -function Mte(t) { +function Tte(t) { t.calcProjection(); } -function Ite(t) { +function Rte(t) { t.resetSkewAndRotation(); } -function Cte(t) { +function Dte(t) { t.removeLeadSnapshot(); } -function X_(t, e, r) { +function Y_(t, e, r) { t.translate = Qr(e.translate, 0, r), t.scale = Qr(e.scale, 1, r), t.origin = e.origin, t.originPoint = e.originPoint; } -function Z_(t, e, r, n) { +function J_(t, e, r, n) { t.min = Qr(e.min, r.min, n), t.max = Qr(e.max, r.max, n); } -function Tte(t, e, r, n) { - Z_(t.x, e.x, r.x, n), Z_(t.y, e.y, r.y, n); +function Ote(t, e, r, n) { + J_(t.x, e.x, r.x, n), J_(t.y, e.y, r.y, n); } -function Rte(t) { +function Nte(t) { return t.animationValues && t.animationValues.opacityExit !== void 0; } -const Dte = { +const Lte = { duration: 0.45, ease: [0.4, 0, 0.1, 1] -}, Q_ = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), e5 = Q_("applewebkit/") && !Q_("chrome/") ? Math.round : Un; -function t5(t) { - t.min = e5(t.min), t.max = e5(t.max); +}, X_ = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Z_ = X_("applewebkit/") && !X_("chrome/") ? Math.round : qn; +function Q_(t) { + t.min = Z_(t.min), t.max = Z_(t.max); } -function Ote(t) { - t5(t.x), t5(t.y); +function kte(t) { + Q_(t.x), Q_(t.y); } -function r9(t, e, r) { - return t === "position" || t === "preserve-aspect" && !Nee(K_(e), K_(r), 0.2); +function e9(t, e, r) { + return t === "position" || t === "preserve-aspect" && !$ee(W_(e), W_(r), 0.2); } -function Nte(t) { +function $te(t) { var e; return t !== t.root && ((e = t.scroll) === null || e === void 0 ? void 0 : e.wasRoot); } -const Lte = t9({ - attachResizeListener: (t, e) => Co(t, "resize", e), +const Bte = Q7({ + attachResizeListener: (t, e) => Mo(t, "resize", e), measureScroll: () => ({ x: document.documentElement.scrollLeft || document.body.scrollLeft, y: document.documentElement.scrollTop || document.body.scrollTop @@ -34563,14 +34594,14 @@ const Lte = t9({ checkIsScrollRoot: () => !0 }), qm = { current: void 0 -}, n9 = t9({ +}, t9 = Q7({ measureScroll: (t) => ({ x: t.scrollLeft, y: t.scrollTop }), defaultParent: () => { if (!qm.current) { - const t = new Lte({}); + const t = new Bte({}); t.mount(window), t.setOptions({ layoutScroll: !0 }), qm.current = t; } return qm.current; @@ -34579,37 +34610,37 @@ const Lte = t9({ t.style.transform = e !== void 0 ? e : "none"; }, checkIsScrollRoot: (t) => window.getComputedStyle(t).position === "fixed" -}), kte = { +}), Fte = { pan: { - Feature: Jee + Feature: Qee }, drag: { - Feature: Yee, - ProjectionNode: n9, - MeasureLayout: Y7 + Feature: Zee, + ProjectionNode: t9, + MeasureLayout: V7 } }; -function r5(t, e) { +function e5(t, e) { const r = e ? "pointerenter" : "pointerleave", n = e ? "onHoverStart" : "onHoverEnd", i = (s, o) => { - if (s.pointerType === "touch" || j7()) + if (s.pointerType === "touch" || B7()) return; const a = t.getProps(); t.animationState && a.whileHover && t.animationState.setActive("whileHover", e); const u = a[n]; u && Lr.postRender(() => u(s, o)); }; - return No(t.current, r, i, { + return Do(t.current, r, i, { passive: !t.getProps()[n] }); } -class $te extends Oa { +class jte extends Ra { mount() { - this.unmount = Oo(r5(this.node, !0), r5(this.node, !1)); + this.unmount = Ro(e5(this.node, !0), e5(this.node, !1)); } unmount() { } } -class Bte extends Oa { +class Ute extends Ra { constructor() { super(...arguments), this.isActive = !1; } @@ -34626,35 +34657,35 @@ class Bte extends Oa { !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1); } mount() { - this.unmount = Oo(Co(this.node.current, "focus", () => this.onFocus()), Co(this.node.current, "blur", () => this.onBlur())); + this.unmount = Ro(Mo(this.node.current, "focus", () => this.onFocus()), Mo(this.node.current, "blur", () => this.onBlur())); } unmount() { } } -const i9 = (t, e) => e ? t === e ? !0 : i9(t, e.parentElement) : !1; +const r9 = (t, e) => e ? t === e ? !0 : r9(t, e.parentElement) : !1; function zm(t, e) { if (!e) return; const r = new PointerEvent("pointer" + t); e(r, xp(r)); } -class Fte extends Oa { +class qte extends Ra { constructor() { - super(...arguments), this.removeStartListeners = Un, this.removeEndListeners = Un, this.removeAccessibleListeners = Un, this.startPointerPress = (e, r) => { + super(...arguments), this.removeStartListeners = qn, this.removeEndListeners = qn, this.removeAccessibleListeners = qn, this.startPointerPress = (e, r) => { if (this.isPressing) return; this.removeEndListeners(); - const n = this.node.getProps(), s = No(window, "pointerup", (a, u) => { + const n = this.node.getProps(), s = Do(window, "pointerup", (a, u) => { if (!this.checkPressEnd()) return; - const { onTap: l, onTapCancel: d, globalTapTarget: p } = this.node.getProps(), w = !p && !i9(this.node.current, a.target) ? d : l; + const { onTap: l, onTapCancel: d, globalTapTarget: p } = this.node.getProps(), w = !p && !r9(this.node.current, a.target) ? d : l; w && Lr.update(() => w(a, u)); }, { passive: !(n.onTap || n.onPointerUp) - }), o = No(window, "pointercancel", (a, u) => this.cancelPress(a, u), { + }), o = Do(window, "pointercancel", (a, u) => this.cancelPress(a, u), { passive: !(n.onTapCancel || n.onPointerCancel) }); - this.removeEndListeners = Oo(s, o), this.startPress(e, r); + this.removeEndListeners = Ro(s, o), this.startPress(e, r); }, this.startAccessiblePress = () => { const e = (s) => { if (s.key !== "Enter" || this.isPressing) @@ -34665,13 +34696,13 @@ class Fte extends Oa { d && Lr.postRender(() => d(u, l)); }); }; - this.removeEndListeners(), this.removeEndListeners = Co(this.node.current, "keyup", o), zm("down", (a, u) => { + this.removeEndListeners(), this.removeEndListeners = Mo(this.node.current, "keyup", o), zm("down", (a, u) => { this.startPress(a, u); }); - }, r = Co(this.node.current, "keydown", e), n = () => { + }, r = Mo(this.node.current, "keydown", e), n = () => { this.isPressing && zm("cancel", (s, o) => this.cancelPress(s, o)); - }, i = Co(this.node.current, "blur", n); - this.removeAccessibleListeners = Oo(r, i); + }, i = Mo(this.node.current, "blur", n); + this.removeAccessibleListeners = Ro(r, i); }; } startPress(e, r) { @@ -34680,7 +34711,7 @@ class Fte extends Oa { i && this.node.animationState && this.node.animationState.setActive("whileTap", !0), n && Lr.postRender(() => n(e, r)); } checkPressEnd() { - return this.removeEndListeners(), this.isPressing = !1, this.node.getProps().whileTap && this.node.animationState && this.node.animationState.setActive("whileTap", !1), !j7(); + return this.removeEndListeners(), this.isPressing = !1, this.node.getProps().whileTap && this.node.animationState && this.node.animationState.setActive("whileTap", !1), !B7(); } cancelPress(e, r) { if (!this.checkPressEnd()) @@ -34689,38 +34720,38 @@ class Fte extends Oa { n && Lr.postRender(() => n(e, r)); } mount() { - const e = this.node.getProps(), r = No(e.globalTapTarget ? window : this.node.current, "pointerdown", this.startPointerPress, { + const e = this.node.getProps(), r = Do(e.globalTapTarget ? window : this.node.current, "pointerdown", this.startPointerPress, { passive: !(e.onTapStart || e.onPointerStart) - }), n = Co(this.node.current, "focus", this.startAccessiblePress); - this.removeStartListeners = Oo(r, n); + }), n = Mo(this.node.current, "focus", this.startAccessiblePress); + this.removeStartListeners = Ro(r, n); } unmount() { this.removeStartListeners(), this.removeEndListeners(), this.removeAccessibleListeners(); } } -const uv = /* @__PURE__ */ new WeakMap(), Wm = /* @__PURE__ */ new WeakMap(), jte = (t) => { +const uv = /* @__PURE__ */ new WeakMap(), Wm = /* @__PURE__ */ new WeakMap(), zte = (t) => { const e = uv.get(t.target); e && e(t); -}, Ute = (t) => { - t.forEach(jte); +}, Wte = (t) => { + t.forEach(zte); }; -function qte({ root: t, ...e }) { +function Hte({ root: t, ...e }) { const r = t || document; Wm.has(r) || Wm.set(r, {}); const n = Wm.get(r), i = JSON.stringify(e); - return n[i] || (n[i] = new IntersectionObserver(Ute, { root: t, ...e })), n[i]; + return n[i] || (n[i] = new IntersectionObserver(Wte, { root: t, ...e })), n[i]; } -function zte(t, e, r) { - const n = qte(e); +function Kte(t, e, r) { + const n = Hte(e); return uv.set(t, r), n.observe(t), () => { uv.delete(t), n.unobserve(t); }; } -const Wte = { +const Vte = { some: 0, all: 1 }; -class Hte extends Oa { +class Gte extends Ra { constructor() { super(...arguments), this.hasEnteredView = !1, this.isInView = !1; } @@ -34729,7 +34760,7 @@ class Hte extends Oa { const { viewport: e = {} } = this.node.getProps(), { root: r, margin: n, amount: i = "some", once: s } = e, o = { root: r ? r.current : void 0, rootMargin: n, - threshold: typeof i == "number" ? i : Wte[i] + threshold: typeof i == "number" ? i : Vte[i] }, a = (u) => { const { isIntersecting: l } = u; if (this.isInView === l || (this.isInView = l, s && !l && this.hasEnteredView)) @@ -34738,7 +34769,7 @@ class Hte extends Oa { const { onViewportEnter: d, onViewportLeave: p } = this.node.getProps(), w = l ? d : p; w && w(u); }; - return zte(this.node.current, o, a); + return Kte(this.node.current, o, a); } mount() { this.startObserver(); @@ -34747,40 +34778,40 @@ class Hte extends Oa { if (typeof IntersectionObserver > "u") return; const { props: e, prevProps: r } = this.node; - ["amount", "margin", "root"].some(Kte(e, r)) && this.startObserver(); + ["amount", "margin", "root"].some(Yte(e, r)) && this.startObserver(); } unmount() { } } -function Kte({ viewport: t = {} }, { viewport: e = {} } = {}) { +function Yte({ viewport: t = {} }, { viewport: e = {} } = {}) { return (r) => t[r] !== e[r]; } -const Vte = { +const Jte = { inView: { - Feature: Hte + Feature: Gte }, tap: { - Feature: Fte + Feature: qte }, focus: { - Feature: Bte + Feature: Ute }, hover: { - Feature: $te + Feature: jte } -}, Gte = { +}, Xte = { layout: { - ProjectionNode: n9, - MeasureLayout: Y7 + ProjectionNode: t9, + MeasureLayout: V7 } -}, Xb = Ma({ +}, Xb = Sa({ transformPagePoint: (t) => t, isStatic: !1, reducedMotion: "never" -}), Ep = Ma({}), Zb = typeof window < "u", s9 = Zb ? kR : Dn, o9 = Ma({ strict: !1 }); -function Yte(t, e, r, n, i) { +}), Ep = Sa({}), Zb = typeof window < "u", n9 = Zb ? $R : Dn, i9 = Sa({ strict: !1 }); +function Zte(t, e, r, n, i) { var s, o; - const { visualElement: a } = Tn(Ep), u = Tn(o9), l = Tn(_p), d = Tn(Xb).reducedMotion, p = oi(); + const { visualElement: a } = Tn(Ep), u = Tn(i9), l = Tn(_p), d = Tn(Xb).reducedMotion, p = Un(); n = n || u.renderer, !p.current && n && (p.current = n(t, { visualState: e, parent: a, @@ -34789,25 +34820,25 @@ function Yte(t, e, r, n, i) { blockInitialAnimation: l ? l.initial === !1 : !1, reducedMotionConfig: d })); - const w = p.current, A = Tn(G7); - w && !w.projection && i && (w.type === "html" || w.type === "svg") && Jte(p.current, r, i, A); - const P = oi(!1); - w5(() => { - w && P.current && w.update(r, l); + const w = p.current, A = Tn(K7); + w && !w.projection && i && (w.type === "html" || w.type === "svg") && Qte(p.current, r, i, A); + const M = Un(!1); + b5(() => { + w && M.current && w.update(r, l); }); - const N = r[R7], L = oi(!!N && !(!((s = window.MotionHandoffIsComplete) === null || s === void 0) && s.call(window, N)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, N))); - return s9(() => { - w && (P.current = !0, window.MotionIsMounted = !0, w.updateFeatures(), Jb.render(w.render), L.current && w.animationState && w.animationState.animateChanges()); + const N = r[C7], L = Un(!!N && !(!((s = window.MotionHandoffIsComplete) === null || s === void 0) && s.call(window, N)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, N))); + return n9(() => { + w && (M.current = !0, window.MotionIsMounted = !0, w.updateFeatures(), Jb.render(w.render), L.current && w.animationState && w.animationState.animateChanges()); }), Dn(() => { w && (!L.current && w.animationState && w.animationState.animateChanges(), L.current && (queueMicrotask(() => { - var $; - ($ = window.MotionHandoffMarkAsComplete) === null || $ === void 0 || $.call(window, N); + var B; + (B = window.MotionHandoffMarkAsComplete) === null || B === void 0 || B.call(window, N); }), L.current = !1)); }), w; } -function Jte(t, e, r, n) { +function Qte(t, e, r, n) { const { layoutId: i, layout: s, drag: o, dragConstraints: a, layoutScroll: u, layoutRoot: l } = e; - t.projection = new r(t.latestValues, e["data-framer-portal-id"] ? void 0 : a9(t.parent)), t.projection.setOptions({ + t.projection = new r(t.latestValues, e["data-framer-portal-id"] ? void 0 : s9(t.parent)), t.projection.setOptions({ layoutId: i, layout: s, alwaysMeasureLayout: !!o || a && tu(a), @@ -34825,11 +34856,11 @@ function Jte(t, e, r, n) { layoutRoot: l }); } -function a9(t) { +function s9(t) { if (t) - return t.options.allowProjection !== !1 ? t.projection : a9(t.parent); + return t.options.allowProjection !== !1 ? t.projection : s9(t.parent); } -function Xte(t, e, r) { +function ere(t, e, r) { return vv( (n) => { n && t.mount && t.mount(n), e && (n ? e.mount(n) : e.unmount()), r && (typeof r == "function" ? r(n) : tu(r) && (r.current = n)); @@ -34845,10 +34876,10 @@ function Xte(t, e, r) { function Sp(t) { return bp(t.animate) || Cb.some((e) => Il(t[e])); } -function c9(t) { +function o9(t) { return !!(Sp(t) || t.variants); } -function Zte(t, e) { +function tre(t, e) { if (Sp(t)) { const { initial: r, animate: n } = t; return { @@ -34858,14 +34889,14 @@ function Zte(t, e) { } return t.inherit !== !1 ? e : {}; } -function Qte(t) { - const { initial: e, animate: r } = Zte(t, Tn(Ep)); - return Ni(() => ({ initial: e, animate: r }), [n5(e), n5(r)]); +function rre(t) { + const { initial: e, animate: r } = tre(t, Tn(Ep)); + return wi(() => ({ initial: e, animate: r }), [t5(e), t5(r)]); } -function n5(t) { +function t5(t) { return Array.isArray(t) ? t.join(" ") : t; } -const i5 = { +const r5 = { animation: [ "animate", "variants", @@ -34885,49 +34916,49 @@ const i5 = { inView: ["whileInView", "onViewportEnter", "onViewportLeave"], layout: ["layout", "layoutId"] }, Cu = {}; -for (const t in i5) +for (const t in r5) Cu[t] = { - isEnabled: (e) => i5[t].some((r) => !!e[r]) + isEnabled: (e) => r5[t].some((r) => !!e[r]) }; -function ere(t) { +function nre(t) { for (const e in t) Cu[e] = { ...Cu[e], ...t[e] }; } -const tre = Symbol.for("motionComponentSymbol"); -function rre({ preloadedFeatures: t, createVisualElement: e, useRender: r, useVisualState: n, Component: i }) { - t && ere(t); +const ire = Symbol.for("motionComponentSymbol"); +function sre({ preloadedFeatures: t, createVisualElement: e, useRender: r, useVisualState: n, Component: i }) { + t && nre(t); function s(a, u) { let l; const d = { ...Tn(Xb), ...a, - layoutId: nre(a) - }, { isStatic: p } = d, w = Qte(a), A = n(a, p); + layoutId: ore(a) + }, { isStatic: p } = d, w = rre(a), A = n(a, p); if (!p && Zb) { - ire(d, t); - const P = sre(d); - l = P.MeasureLayout, w.visualElement = Yte(i, A, d, e, P.ProjectionNode); + are(d, t); + const M = cre(d); + l = M.MeasureLayout, w.visualElement = Zte(i, A, d, e, M.ProjectionNode); } - return fe.jsxs(Ep.Provider, { value: w, children: [l && w.visualElement ? fe.jsx(l, { visualElement: w.visualElement, ...d }) : null, r(i, a, Xte(A, w.visualElement, u), A, p, w.visualElement)] }); + return pe.jsxs(Ep.Provider, { value: w, children: [l && w.visualElement ? pe.jsx(l, { visualElement: w.visualElement, ...d }) : null, r(i, a, ere(A, w.visualElement, u), A, p, w.visualElement)] }); } const o = gv(s); - return o[tre] = i, o; + return o[ire] = i, o; } -function nre({ layoutId: t }) { +function ore({ layoutId: t }) { const e = Tn(Yb).id; return e && t !== void 0 ? e + "-" + t : t; } -function ire(t, e) { - const r = Tn(o9).strict; +function are(t, e) { + const r = Tn(i9).strict; if (process.env.NODE_ENV !== "production" && e && r) { const n = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead."; - t.ignoreStrict ? Ku(!1, n) : zo(!1, n); + t.ignoreStrict ? Ku(!1, n) : Uo(!1, n); } } -function sre(t) { +function cre(t) { const { drag: e, layout: r } = Cu; if (!e && !r) return {}; @@ -34937,7 +34968,7 @@ function sre(t) { ProjectionNode: n.ProjectionNode }; } -const ore = [ +const ure = [ "animate", "circle", "defs", @@ -34977,19 +35008,19 @@ function Qb(t) { /** * If it's in our list of lowercase SVG tags, it's an SVG component */ - !!(ore.indexOf(t) > -1 || /** + !!(ure.indexOf(t) > -1 || /** * If it contains a capital letter, it's an SVG component */ /[A-Z]/u.test(t)) ) ); } -function u9(t, { style: e, vars: r }, n, i) { +function a9(t, { style: e, vars: r }, n, i) { Object.assign(t.style, e, i && i.getProjectionStyles(n)); for (const s in r) t.style.setProperty(s, r[s]); } -const f9 = /* @__PURE__ */ new Set([ +const c9 = /* @__PURE__ */ new Set([ "baseFrequency", "diffuseConstant", "kernelMatrix", @@ -35014,51 +35045,51 @@ const f9 = /* @__PURE__ */ new Set([ "textLength", "lengthAdjust" ]); -function l9(t, e, r, n) { - u9(t, e, void 0, n); +function u9(t, e, r, n) { + a9(t, e, void 0, n); for (const i in e.attrs) - t.setAttribute(f9.has(i) ? i : Gb(i), e.attrs[i]); + t.setAttribute(c9.has(i) ? i : Gb(i), e.attrs[i]); } -function h9(t, { layout: e, layoutId: r }) { +function f9(t, { layout: e, layoutId: r }) { return Ac.has(t) || t.startsWith("origin") || (e || r !== void 0) && (!!_0[t] || t === "opacity"); } function ey(t, e, r) { var n; const { style: i } = t, s = {}; for (const o in i) - (Xn(i[o]) || e.style && Xn(e.style[o]) || h9(o, t) || ((n = r == null ? void 0 : r.getValue(o)) === null || n === void 0 ? void 0 : n.liveStyle) !== void 0) && (s[o] = i[o]); + (Zn(i[o]) || e.style && Zn(e.style[o]) || f9(o, t) || ((n = r == null ? void 0 : r.getValue(o)) === null || n === void 0 ? void 0 : n.liveStyle) !== void 0) && (s[o] = i[o]); return s; } -function d9(t, e, r) { +function l9(t, e, r) { const n = ey(t, e, r); for (const i in t) - if (Xn(t[i]) || Xn(e[i])) { + if (Zn(t[i]) || Zn(e[i])) { const s = ah.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i; n[s] = t[i]; } return n; } function ty(t) { - const e = oi(null); + const e = Un(null); return e.current === null && (e.current = t()), e.current; } -function are({ scrapeMotionValuesFromProps: t, createRenderState: e, onMount: r }, n, i, s) { +function fre({ scrapeMotionValuesFromProps: t, createRenderState: e, onMount: r }, n, i, s) { const o = { - latestValues: cre(n, i, s, t), + latestValues: lre(n, i, s, t), renderState: e() }; return r && (o.mount = (a) => r(n, a, o)), o; } -const p9 = (t) => (e, r) => { - const n = Tn(Ep), i = Tn(_p), s = () => are(t, e, n, i); +const h9 = (t) => (e, r) => { + const n = Tn(Ep), i = Tn(_p), s = () => fre(t, e, n, i); return r ? s() : ty(s); }; -function cre(t, e, r, n) { +function lre(t, e, r, n) { const i = {}, s = n(t, {}); for (const w in s) i[w] = Ud(s[w]); let { initial: o, animate: a } = t; - const u = Sp(t), l = c9(t); + const u = Sp(t), l = o9(t); e && l && !u && t.inherit !== !1 && (o === void 0 && (o = e.initial), a === void 0 && (a = e.animate)); let d = r ? r.initial === !1 : !1; d = d || o === !1; @@ -35066,19 +35097,19 @@ function cre(t, e, r, n) { if (p && typeof p != "boolean" && !bp(p)) { const w = Array.isArray(p) ? p : [p]; for (let A = 0; A < w.length; A++) { - const P = Mb(t, w[A]); - if (P) { - const { transitionEnd: N, transition: L, ...$ } = P; - for (const B in $) { - let H = $[B]; + const M = Mb(t, w[A]); + if (M) { + const { transitionEnd: N, transition: L, ...B } = M; + for (const $ in B) { + let H = B[$]; if (Array.isArray(H)) { const W = d ? H.length - 1 : 0; H = H[W]; } - H !== null && (i[B] = H); + H !== null && (i[$] = H); } - for (const B in N) - i[B] = N[B]; + for (const $ in N) + i[$] = N[$]; } } } @@ -35089,27 +35120,27 @@ const ry = () => ({ transform: {}, transformOrigin: {}, vars: {} -}), g9 = () => ({ +}), d9 = () => ({ ...ry(), attrs: {} -}), m9 = (t, e) => e && typeof t == "number" ? e.transform(t) : t, ure = { +}), p9 = (t, e) => e && typeof t == "number" ? e.transform(t) : t, hre = { x: "translateX", y: "translateY", z: "translateZ", transformPerspective: "perspective" -}, fre = ah.length; -function lre(t, e, r) { +}, dre = ah.length; +function pre(t, e, r) { let n = "", i = !0; - for (let s = 0; s < fre; s++) { + for (let s = 0; s < dre; s++) { const o = ah[s], a = t[o]; if (a === void 0) continue; let u = !0; if (typeof a == "number" ? u = a === (o.startsWith("scale") ? 1 : 0) : u = parseFloat(a) === 0, !u || r) { - const l = m9(a, $b[o]); + const l = p9(a, $b[o]); if (!u) { i = !1; - const d = ure[o] || o; + const d = hre[o] || o; n += `${d}(${l}) `; } r && (e[o] = l); @@ -35125,36 +35156,36 @@ function ny(t, e, r) { if (Ac.has(u)) { o = !0; continue; - } else if (c7(u)) { + } else if (o7(u)) { i[u] = l; continue; } else { - const d = m9(l, $b[u]); + const d = p9(l, $b[u]); u.startsWith("origin") ? (a = !0, s[u] = d) : n[u] = d; } } - if (e.transform || (o || r ? n.transform = lre(e, t.transform, r) : n.transform && (n.transform = "none")), a) { + if (e.transform || (o || r ? n.transform = pre(e, t.transform, r) : n.transform && (n.transform = "none")), a) { const { originX: u = "50%", originY: l = "50%", originZ: d = 0 } = s; n.transformOrigin = `${u} ${l} ${d}`; } } -function s5(t, e, r) { +function n5(t, e, r) { return typeof t == "string" ? t : Vt.transform(e + r * t); } -function hre(t, e, r) { - const n = s5(e, t.x, t.width), i = s5(r, t.y, t.height); +function gre(t, e, r) { + const n = n5(e, t.x, t.width), i = n5(r, t.y, t.height); return `${n} ${i}`; } -const dre = { +const mre = { offset: "stroke-dashoffset", array: "stroke-dasharray" -}, pre = { +}, vre = { offset: "strokeDashoffset", array: "strokeDasharray" }; -function gre(t, e, r = 1, n = 0, i = !0) { +function bre(t, e, r = 1, n = 0, i = !0) { t.pathLength = 1; - const s = i ? dre : pre; + const s = i ? mre : vre; t[s.offset] = Vt.transform(-n); const o = Vt.transform(e), a = Vt.transform(r); t[s.array] = `${o} ${a}`; @@ -35176,13 +35207,13 @@ function iy(t, { return; } t.attrs = t.style, t.style = {}; - const { attrs: w, style: A, dimensions: P } = t; - w.transform && (P && (A.transform = w.transform), delete w.transform), P && (i !== void 0 || s !== void 0 || A.transform) && (A.transformOrigin = hre(P, i !== void 0 ? i : 0.5, s !== void 0 ? s : 0.5)), e !== void 0 && (w.x = e), r !== void 0 && (w.y = r), n !== void 0 && (w.scale = n), o !== void 0 && gre(w, o, a, u, !1); + const { attrs: w, style: A, dimensions: M } = t; + w.transform && (M && (A.transform = w.transform), delete w.transform), M && (i !== void 0 || s !== void 0 || A.transform) && (A.transformOrigin = gre(M, i !== void 0 ? i : 0.5, s !== void 0 ? s : 0.5)), e !== void 0 && (w.x = e), r !== void 0 && (w.y = r), n !== void 0 && (w.scale = n), o !== void 0 && bre(w, o, a, u, !1); } -const sy = (t) => typeof t == "string" && t.toLowerCase() === "svg", mre = { - useVisualState: p9({ - scrapeMotionValuesFromProps: d9, - createRenderState: g9, +const sy = (t) => typeof t == "string" && t.toLowerCase() === "svg", yre = { + useVisualState: h9({ + scrapeMotionValuesFromProps: l9, + createRenderState: d9, onMount: (t, e, { renderState: r, latestValues: n }) => { Lr.read(() => { try { @@ -35196,35 +35227,35 @@ const sy = (t) => typeof t == "string" && t.toLowerCase() === "svg", mre = { }; } }), Lr.render(() => { - iy(r, n, sy(e.tagName), t.transformTemplate), l9(e, r); + iy(r, n, sy(e.tagName), t.transformTemplate), u9(e, r); }); } }) -}, vre = { - useVisualState: p9({ +}, wre = { + useVisualState: h9({ scrapeMotionValuesFromProps: ey, createRenderState: ry }) }; -function v9(t, e, r) { +function g9(t, e, r) { for (const n in e) - !Xn(e[n]) && !h9(n, r) && (t[n] = e[n]); + !Zn(e[n]) && !f9(n, r) && (t[n] = e[n]); } -function bre({ transformTemplate: t }, e) { - return Ni(() => { +function xre({ transformTemplate: t }, e) { + return wi(() => { const r = ry(); return ny(r, e, t), Object.assign({}, r.vars, r.style); }, [e]); } -function yre(t, e) { +function _re(t, e) { const r = t.style || {}, n = {}; - return v9(n, r, t), Object.assign(n, bre(t, e)), n; + return g9(n, r, t), Object.assign(n, xre(t, e)), n; } -function wre(t, e) { - const r = {}, n = yre(t, e); +function Ere(t, e) { + const r = {}, n = _re(t, e); return t.drag && t.dragListener !== !1 && (r.draggable = !1, n.userSelect = n.WebkitUserSelect = n.WebkitTouchCallout = "none", n.touchAction = t.drag === !0 ? "none" : `pan-${t.drag === "x" ? "y" : "x"}`), t.tabIndex === void 0 && (t.onTap || t.onTapStart || t.whileTap) && (r.tabIndex = 0), r.style = n, r; } -const xre = /* @__PURE__ */ new Set([ +const Sre = /* @__PURE__ */ new Set([ "animate", "exit", "variants", @@ -35257,26 +35288,26 @@ const xre = /* @__PURE__ */ new Set([ "viewport" ]); function E0(t) { - return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || xre.has(t); + return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || Sre.has(t); } -let b9 = (t) => !E0(t); -function _re(t) { - t && (b9 = (e) => e.startsWith("on") ? !E0(e) : t(e)); +let m9 = (t) => !E0(t); +function Are(t) { + t && (m9 = (e) => e.startsWith("on") ? !E0(e) : t(e)); } try { - _re(require("@emotion/is-prop-valid").default); + Are(require("@emotion/is-prop-valid").default); } catch { } -function Ere(t, e, r) { +function Pre(t, e, r) { const n = {}; for (const i in t) - i === "values" && typeof t.values == "object" || (b9(i) || r === !0 && E0(i) || !e && !E0(i) || // If trying to use native HTML drag events, forward drag listeners + i === "values" && typeof t.values == "object" || (m9(i) || r === !0 && E0(i) || !e && !E0(i) || // If trying to use native HTML drag events, forward drag listeners t.draggable && i.startsWith("onDrag")) && (n[i] = t[i]); return n; } -function Sre(t, e, r, n) { - const i = Ni(() => { - const s = g9(); +function Mre(t, e, r, n) { + const i = wi(() => { + const s = d9(); return iy(s, e, sy(n), t.transformTemplate), { ...s.attrs, style: { ...s.style } @@ -35284,46 +35315,46 @@ function Sre(t, e, r, n) { }, [e]); if (t.style) { const s = {}; - v9(s, t.style, t), i.style = { ...s, ...i.style }; + g9(s, t.style, t), i.style = { ...s, ...i.style }; } return i; } -function Are(t = !1) { +function Ire(t = !1) { return (r, n, i, { latestValues: s }, o) => { - const u = (Qb(r) ? Sre : wre)(n, s, o, r), l = Ere(n, typeof r == "string", t), d = r !== x5 ? { ...l, ...u, ref: i } : {}, { children: p } = n, w = Ni(() => Xn(p) ? p.get() : p, [p]); + const u = (Qb(r) ? Mre : Ere)(n, s, o, r), l = Pre(n, typeof r == "string", t), d = r !== y5 ? { ...l, ...u, ref: i } : {}, { children: p } = n, w = wi(() => Zn(p) ? p.get() : p, [p]); return qd(r, { ...d, children: w }); }; } -function Pre(t, e) { +function Cre(t, e) { return function(n, { forwardMotionProps: i } = { forwardMotionProps: !1 }) { const o = { - ...Qb(n) ? mre : vre, + ...Qb(n) ? yre : wre, preloadedFeatures: t, - useRender: Are(i), + useRender: Ire(i), createVisualElement: e, Component: n }; - return rre(o); + return sre(o); }; } -const fv = { current: null }, y9 = { current: !1 }; -function Mre() { - if (y9.current = !0, !!Zb) +const fv = { current: null }, v9 = { current: !1 }; +function Tre() { + if (v9.current = !0, !!Zb) if (window.matchMedia) { const t = window.matchMedia("(prefers-reduced-motion)"), e = () => fv.current = t.matches; t.addListener(e), e(); } else fv.current = !1; } -function Ire(t, e, r) { +function Rre(t, e, r) { for (const n in e) { const i = e[n], s = r[n]; - if (Xn(i)) + if (Zn(i)) t.addValue(n, i), process.env.NODE_ENV === "development" && vp(i.version === "11.11.17", `Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`); - else if (Xn(s)) + else if (Zn(s)) t.addValue(n, Rl(i, { owner: t })); else if (s !== i) if (t.hasValue(n)) { @@ -35338,7 +35369,7 @@ function Ire(t, e, r) { e[n] === void 0 && t.removeValue(n); return e; } -const o5 = /* @__PURE__ */ new WeakMap(), Cre = [...l7, Yn, Aa], Tre = (t) => Cre.find(f7(t)), a5 = [ +const i5 = /* @__PURE__ */ new WeakMap(), Dre = [...u7, Jn, _a], Ore = (t) => Dre.find(c7(t)), s5 = [ "AnimationStart", "AnimationComplete", "Update", @@ -35347,7 +35378,7 @@ const o5 = /* @__PURE__ */ new WeakMap(), Cre = [...l7, Yn, Aa], Tre = (t) => Cr "LayoutAnimationStart", "LayoutAnimationComplete" ]; -class Rre { +class Nre { /** * This method takes React props and returns found MotionValues. For example, HTML * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays. @@ -35366,18 +35397,18 @@ class Rre { this.renderScheduledAt < w && (this.renderScheduledAt = w, Lr.render(this.render, !1, !0)); }; const { latestValues: u, renderState: l } = o; - this.latestValues = u, this.baseTarget = { ...u }, this.initialValues = r.initial ? { ...u } : {}, this.renderState = l, this.parent = e, this.props = r, this.presenceContext = n, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!s, this.isControllingVariants = Sp(r), this.isVariantNode = c9(r), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current); + this.latestValues = u, this.baseTarget = { ...u }, this.initialValues = r.initial ? { ...u } : {}, this.renderState = l, this.parent = e, this.props = r, this.presenceContext = n, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!s, this.isControllingVariants = Sp(r), this.isVariantNode = o9(r), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current); const { willChange: d, ...p } = this.scrapeMotionValuesFromProps(r, {}, this); for (const w in p) { const A = p[w]; - u[w] !== void 0 && Xn(A) && A.set(u[w], !1); + u[w] !== void 0 && Zn(A) && A.set(u[w], !1); } } mount(e) { - this.current = e, o5.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((r, n) => this.bindToMotionValue(n, r)), y9.current || Mre(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : fv.current, process.env.NODE_ENV !== "production" && vp(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext); + this.current = e, i5.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((r, n) => this.bindToMotionValue(n, r)), v9.current || Tre(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : fv.current, process.env.NODE_ENV !== "production" && vp(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext); } unmount() { - o5.delete(this.current), this.projection && this.projection.unmount(), Ea(this.notifyUpdate), Ea(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this); + i5.delete(this.current), this.projection && this.projection.unmount(), wa(this.notifyUpdate), wa(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this); for (const e in this.events) this.events[e].clear(); for (const e in this.features) { @@ -35435,13 +35466,13 @@ class Rre { */ update(e, r) { (e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = r; - for (let n = 0; n < a5.length; n++) { - const i = a5[n]; + for (let n = 0; n < s5.length; n++) { + const i = s5[n]; this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]); const s = "on" + i, o = e[s]; o && (this.propEventSubscriptions[i] = this.on(i, o)); } - this.prevMotionValues = Ire(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue(); + this.prevMotionValues = Rre(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue(); } getProps() { return this.props; @@ -35507,7 +35538,7 @@ class Rre { readValue(e, r) { var n; let i = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : (n = this.getBaseTargetFromProps(this.props, e)) !== null && n !== void 0 ? n : this.readValueFromInstance(this.current, e, this.options); - return i != null && (typeof i == "string" && (o7(i) || s7(i)) ? i = parseFloat(i) : !Tre(i) && Aa.test(r) && (i = y7(e, r)), this.setBaseTarget(e, Xn(i) ? i.get() : i)), Xn(i) ? i.get() : i; + return i != null && (typeof i == "string" && (i7(i) || n7(i)) ? i = parseFloat(i) : !Ore(i) && _a.test(r) && (i = v7(e, r)), this.setBaseTarget(e, Zn(i) ? i.get() : i)), Zn(i) ? i.get() : i; } /** * Set the base target to later animate back to. This is currently @@ -35531,7 +35562,7 @@ class Rre { if (n && i !== void 0) return i; const s = this.getBaseTargetFromProps(this.props, e); - return s !== void 0 && !Xn(s) ? s : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e]; + return s !== void 0 && !Zn(s) ? s : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e]; } on(e, r) { return this.events[e] || (this.events[e] = new Vb()), this.events[e].add(r); @@ -35540,9 +35571,9 @@ class Rre { this.events[e] && this.events[e].notify(...r); } } -class w9 extends Rre { +class b9 extends Nre { constructor() { - super(...arguments), this.KeyframeResolver = w7; + super(...arguments), this.KeyframeResolver = b7; } sortInstanceNodePosition(e, r) { return e.compareDocumentPosition(r) & 2 ? 1 : -1; @@ -35554,24 +35585,24 @@ class w9 extends Rre { delete r[e], delete n[e]; } } -function Dre(t) { +function Lre(t) { return window.getComputedStyle(t); } -class Ore extends w9 { +class kre extends b9 { constructor() { - super(...arguments), this.type = "html", this.renderInstance = u9; + super(...arguments), this.type = "html", this.renderInstance = a9; } readValueFromInstance(e, r) { if (Ac.has(r)) { const n = Bb(r); return n && n.default || 0; } else { - const n = Dre(e), i = (c7(r) ? n.getPropertyValue(r) : n[r]) || 0; + const n = Lre(e), i = (o7(r) ? n.getPropertyValue(r) : n[r]) || 0; return typeof i == "string" ? i.trim() : i; } } measureInstanceViewportBox(e, { transformPagePoint: r }) { - return K7(e, r); + return W7(e, r); } build(e, r, n) { ny(e, r, n.transformTemplate); @@ -35582,12 +35613,12 @@ class Ore extends w9 { handleChildMotionValue() { this.childSubscription && (this.childSubscription(), delete this.childSubscription); const { children: e } = this.props; - Xn(e) && (this.childSubscription = e.on("change", (r) => { + Zn(e) && (this.childSubscription = e.on("change", (r) => { this.current && (this.current.textContent = `${r}`); })); } } -class Nre extends w9 { +class $re extends b9 { constructor() { super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = ln; } @@ -35599,30 +35630,30 @@ class Nre extends w9 { const n = Bb(r); return n && n.default || 0; } - return r = f9.has(r) ? r : Gb(r), e.getAttribute(r); + return r = c9.has(r) ? r : Gb(r), e.getAttribute(r); } scrapeMotionValuesFromProps(e, r, n) { - return d9(e, r, n); + return l9(e, r, n); } build(e, r, n) { iy(e, r, this.isSVGTag, n.transformTemplate); } renderInstance(e, r, n, i) { - l9(e, r, n, i); + u9(e, r, n, i); } mount(e) { this.isSVGTag = sy(e.tagName), super.mount(e); } } -const Lre = (t, e) => Qb(t) ? new Nre(e) : new Ore(e, { - allowProjection: t !== x5 -}), kre = /* @__PURE__ */ Pre({ - ...Aee, - ...Vte, - ...kte, - ...Gte -}, Lre), $re = /* @__PURE__ */ mZ(kre); -class Bre extends Yt.Component { +const Bre = (t, e) => Qb(t) ? new $re(e) : new kre(e, { + allowProjection: t !== y5 +}), Fre = /* @__PURE__ */ Cre({ + ...Iee, + ...Jte, + ...Fte, + ...Xte +}, Bre), jre = /* @__PURE__ */ yZ(Fre); +class Ure extends Gt.Component { getSnapshotBeforeUpdate(e) { const r = this.props.childRef.current; if (r && e.isPresent && !this.props.isPresent) { @@ -35640,14 +35671,14 @@ class Bre extends Yt.Component { return this.props.children; } } -function Fre({ children: t, isPresent: e }) { - const r = mv(), n = oi(null), i = oi({ +function qre({ children: t, isPresent: e }) { + const r = mv(), n = Un(null), i = Un({ width: 0, height: 0, top: 0, left: 0 }), { nonce: s } = Tn(Xb); - return w5(() => { + return b5(() => { const { width: o, height: a, top: u, left: l } = i.current; if (e || !n.current || !o || !a) return; @@ -35664,16 +35695,16 @@ function Fre({ children: t, isPresent: e }) { `), () => { document.head.removeChild(d); }; - }, [e]), fe.jsx(Bre, { isPresent: e, childRef: n, sizeRef: i, children: Yt.cloneElement(t, { ref: n }) }); + }, [e]), pe.jsx(Ure, { isPresent: e, childRef: n, sizeRef: i, children: Gt.cloneElement(t, { ref: n }) }); } -const jre = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: i, presenceAffectsLayout: s, mode: o }) => { - const a = ty(Ure), u = mv(), l = vv((p) => { +const zre = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: i, presenceAffectsLayout: s, mode: o }) => { + const a = ty(Wre), u = mv(), l = vv((p) => { a.set(p, !0); for (const w of a.values()) if (!w) return; n && n(); - }, [a, n]), d = Ni( + }, [a, n]), d = wi( () => ({ id: u, initial: e, @@ -35689,46 +35720,46 @@ const jre = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: */ s ? [Math.random(), l] : [r, l] ); - return Ni(() => { + return wi(() => { a.forEach((p, w) => a.set(w, !1)); - }, [r]), Yt.useEffect(() => { + }, [r]), Gt.useEffect(() => { !r && !a.size && n && n(); - }, [r]), o === "popLayout" && (t = fe.jsx(Fre, { isPresent: r, children: t })), fe.jsx(_p.Provider, { value: d, children: t }); + }, [r]), o === "popLayout" && (t = pe.jsx(qre, { isPresent: r, children: t })), pe.jsx(_p.Provider, { value: d, children: t }); }; -function Ure() { +function Wre() { return /* @__PURE__ */ new Map(); } const bd = (t) => t.key || ""; -function c5(t) { +function o5(t) { const e = []; - return $R.forEach(t, (r) => { - BR(r) && e.push(r); + return BR.forEach(t, (r) => { + FR(r) && e.push(r); }), e; } -const qre = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExitComplete: i, presenceAffectsLayout: s = !0, mode: o = "sync" }) => { - zo(!e, "Replace exitBeforeEnter with mode='wait'"); - const a = Ni(() => c5(t), [t]), u = a.map(bd), l = oi(!0), d = oi(a), p = ty(() => /* @__PURE__ */ new Map()), [w, A] = Gt(a), [P, N] = Gt(a); - s9(() => { +const Hre = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExitComplete: i, presenceAffectsLayout: s = !0, mode: o = "sync" }) => { + Uo(!e, "Replace exitBeforeEnter with mode='wait'"); + const a = wi(() => o5(t), [t]), u = a.map(bd), l = Un(!0), d = Un(a), p = ty(() => /* @__PURE__ */ new Map()), [w, A] = Qt(a), [M, N] = Qt(a); + n9(() => { l.current = !1, d.current = a; - for (let B = 0; B < P.length; B++) { - const H = bd(P[B]); + for (let $ = 0; $ < M.length; $++) { + const H = bd(M[$]); u.includes(H) ? p.delete(H) : p.get(H) !== !0 && p.set(H, !1); } - }, [P, u.length, u.join("-")]); + }, [M, u.length, u.join("-")]); const L = []; if (a !== w) { - let B = [...a]; - for (let H = 0; H < P.length; H++) { - const W = P[H], V = bd(W); - u.includes(V) || (B.splice(H, 0, W), L.push(W)); + let $ = [...a]; + for (let H = 0; H < M.length; H++) { + const W = M[H], V = bd(W); + u.includes(V) || ($.splice(H, 0, W), L.push(W)); } - o === "wait" && L.length && (B = L), N(c5(B)), A(a); + o === "wait" && L.length && ($ = L), N(o5($)), A(a); return; } - process.env.NODE_ENV !== "production" && o === "wait" && P.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`); - const { forceRender: $ } = Tn(Yb); - return fe.jsx(fe.Fragment, { children: P.map((B) => { - const H = bd(B), W = a === P || u.includes(H), V = () => { + process.env.NODE_ENV !== "production" && o === "wait" && M.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`); + const { forceRender: B } = Tn(Yb); + return pe.jsx(pe.Fragment, { children: M.map(($) => { + const H = bd($), W = a === M || u.includes(H), V = () => { if (p.has(H)) p.set(H, !0); else @@ -35736,12 +35767,12 @@ const qre = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onEx let te = !0; p.forEach((R) => { R || (te = !1); - }), te && ($ == null || $(), N(d.current), i && i()); + }), te && (B == null || B(), N(d.current), i && i()); }; - return fe.jsx(jre, { isPresent: W, initial: !l.current || n ? void 0 : !1, custom: W ? void 0 : r, presenceAffectsLayout: s, mode: o, onExitComplete: W ? void 0 : V, children: B }, H); + return pe.jsx(zre, { isPresent: W, initial: !l.current || n ? void 0 : !1, custom: W ? void 0 : r, presenceAffectsLayout: s, mode: o, onExitComplete: W ? void 0 : V, children: $ }, H); }) }); -}, so = (t) => /* @__PURE__ */ fe.jsx(qre, { children: /* @__PURE__ */ fe.jsx( - $re.div, +}, Ms = (t) => /* @__PURE__ */ pe.jsx(Hre, { children: /* @__PURE__ */ pe.jsx( + jre.div, { initial: { x: 0, opacity: 0 }, animate: { x: 0, opacity: 1 }, @@ -35756,7 +35787,7 @@ function oy(t) { function s() { i && i(); } - return /* @__PURE__ */ fe.jsxs( + return /* @__PURE__ */ pe.jsxs( "div", { className: "xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg", @@ -35764,61 +35795,61 @@ function oy(t) { children: [ e, r, - /* @__PURE__ */ fe.jsxs("div", { className: "xc-relative xc-ml-auto xc-h-6", children: [ - /* @__PURE__ */ fe.jsx("div", { className: "xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0", children: n }), - /* @__PURE__ */ fe.jsx("div", { className: "xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100", children: /* @__PURE__ */ fe.jsx(lZ, {}) }) + /* @__PURE__ */ pe.jsxs("div", { className: "xc-relative xc-ml-auto xc-h-6", children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0", children: n }), + /* @__PURE__ */ pe.jsx("div", { className: "xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100", children: /* @__PURE__ */ pe.jsx(hZ, {}) }) ] }) ] } ); } -function zre(t) { - return t.lastUsed ? /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500", children: [ - /* @__PURE__ */ fe.jsx("div", { className: "xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]" }), +function Kre(t) { + return t.lastUsed ? /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500", children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]" }), "Last Used" - ] }) : t.installed ? /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500", children: [ - /* @__PURE__ */ fe.jsx("div", { className: "xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]" }), + ] }) : t.installed ? /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500", children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]" }), "Installed" ] }) : null; } -function x9(t) { +function y9(t) { var o, a; - const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ fe.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: (o = e.config) == null ? void 0 : o.image }), i = ((a = e.config) == null ? void 0 : a.name) || "", s = Ni(() => zre(e), [e]); - return /* @__PURE__ */ fe.jsx(oy, { icon: n, title: i, extra: s, onClick: () => r(e) }); + const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: (o = e.config) == null ? void 0 : o.image }), i = ((a = e.config) == null ? void 0 : a.name) || "", s = wi(() => Kre(e), [e]); + return /* @__PURE__ */ pe.jsx(oy, { icon: n, title: i, extra: s, onClick: () => r(e) }); } -function _9(t) { +function w9(t) { var e, r, n = ""; if (typeof t == "string" || typeof t == "number") n += t; else if (typeof t == "object") if (Array.isArray(t)) { var i = t.length; - for (e = 0; e < i; e++) t[e] && (r = _9(t[e])) && (n && (n += " "), n += r); + for (e = 0; e < i; e++) t[e] && (r = w9(t[e])) && (n && (n += " "), n += r); } else for (r in t) t[r] && (n && (n += " "), n += r); return n; } -function Wre() { - for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++) (t = arguments[r]) && (e = _9(t)) && (n && (n += " "), n += e); +function Vre() { + for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++) (t = arguments[r]) && (e = w9(t)) && (n && (n += " "), n += e); return n; } -const Hre = Wre, ay = "-", Kre = (t) => { - const e = Gre(t), { +const Gre = Vre, ay = "-", Yre = (t) => { + const e = Xre(t), { conflictingClassGroups: r, conflictingClassGroupModifiers: n } = t; return { getClassGroupId: (o) => { const a = o.split(ay); - return a[0] === "" && a.length !== 1 && a.shift(), E9(a, e) || Vre(o); + return a[0] === "" && a.length !== 1 && a.shift(), x9(a, e) || Jre(o); }, getConflictingClassGroupIds: (o, a) => { const u = r[o] || []; return a && n[o] ? [...u, ...n[o]] : u; } }; -}, E9 = (t, e) => { +}, x9 = (t, e) => { var o; if (t.length === 0) return e.classGroupId; - const r = t[0], n = e.nextPart.get(r), i = n ? E9(t.slice(1), n) : void 0; + const r = t[0], n = e.nextPart.get(r), i = n ? x9(t.slice(1), n) : void 0; if (i) return i; if (e.validators.length === 0) @@ -35827,13 +35858,13 @@ const Hre = Wre, ay = "-", Kre = (t) => { return (o = e.validators.find(({ validator: a }) => a(s))) == null ? void 0 : o.classGroupId; -}, u5 = /^\[(.+)\]$/, Vre = (t) => { - if (u5.test(t)) { - const e = u5.exec(t)[1], r = e == null ? void 0 : e.substring(0, e.indexOf(":")); +}, a5 = /^\[(.+)\]$/, Jre = (t) => { + if (a5.test(t)) { + const e = a5.exec(t)[1], r = e == null ? void 0 : e.substring(0, e.indexOf(":")); if (r) return "arbitrary.." + r; } -}, Gre = (t) => { +}, Xre = (t) => { const { theme: e, prefix: r @@ -35841,18 +35872,18 @@ const Hre = Wre, ay = "-", Kre = (t) => { nextPart: /* @__PURE__ */ new Map(), validators: [] }; - return Jre(Object.entries(t.classGroups), r).forEach(([s, o]) => { + return Qre(Object.entries(t.classGroups), r).forEach(([s, o]) => { lv(o, n, s, e); }), n; }, lv = (t, e, r, n) => { t.forEach((i) => { if (typeof i == "string") { - const s = i === "" ? e : f5(e, i); + const s = i === "" ? e : c5(e, i); s.classGroupId = r; return; } if (typeof i == "function") { - if (Yre(i)) { + if (Zre(i)) { lv(i(n), e, r, n); return; } @@ -35863,10 +35894,10 @@ const Hre = Wre, ay = "-", Kre = (t) => { return; } Object.entries(i).forEach(([s, o]) => { - lv(o, f5(e, s), r, n); + lv(o, c5(e, s), r, n); }); }); -}, f5 = (t, e) => { +}, c5 = (t, e) => { let r = t; return e.split(ay).forEach((n) => { r.nextPart.has(n) || r.nextPart.set(n, { @@ -35874,10 +35905,10 @@ const Hre = Wre, ay = "-", Kre = (t) => { validators: [] }), r = r.nextPart.get(n); }), r; -}, Yre = (t) => t.isThemeGetter, Jre = (t, e) => e ? t.map(([r, n]) => { +}, Zre = (t) => t.isThemeGetter, Qre = (t, e) => e ? t.map(([r, n]) => { const i = n.map((s) => typeof s == "string" ? e + s : typeof s == "object" ? Object.fromEntries(Object.entries(s).map(([o, a]) => [e + o, a])) : s); return [r, i]; -}) : t, Xre = (t) => { +}) : t, ene = (t) => { if (t < 1) return { get: () => { @@ -35901,7 +35932,7 @@ const Hre = Wre, ay = "-", Kre = (t) => { r.has(s) ? r.set(s, o) : i(s, o); } }; -}, S9 = "!", Zre = (t) => { +}, _9 = "!", tne = (t) => { const { separator: e, experimentalParseClassName: r @@ -35909,24 +35940,24 @@ const Hre = Wre, ay = "-", Kre = (t) => { const u = []; let l = 0, d = 0, p; for (let L = 0; L < a.length; L++) { - let $ = a[L]; + let B = a[L]; if (l === 0) { - if ($ === i && (n || a.slice(L, L + s) === e)) { + if (B === i && (n || a.slice(L, L + s) === e)) { u.push(a.slice(d, L)), d = L + s; continue; } - if ($ === "/") { + if (B === "/") { p = L; continue; } } - $ === "[" ? l++ : $ === "]" && l--; + B === "[" ? l++ : B === "]" && l--; } - const w = u.length === 0 ? a : a.substring(d), A = w.startsWith(S9), P = A ? w.substring(1) : w, N = p && p > d ? p - d : void 0; + const w = u.length === 0 ? a : a.substring(d), A = w.startsWith(_9), M = A ? w.substring(1) : w, N = p && p > d ? p - d : void 0; return { modifiers: u, hasImportantModifier: A, - baseClassName: P, + baseClassName: M, maybePostfixModifierPosition: N }; }; @@ -35934,7 +35965,7 @@ const Hre = Wre, ay = "-", Kre = (t) => { className: a, parseClassName: o }) : o; -}, Qre = (t) => { +}, rne = (t) => { if (t.length <= 1) return t; const e = []; @@ -35942,16 +35973,16 @@ const Hre = Wre, ay = "-", Kre = (t) => { return t.forEach((n) => { n[0] === "[" ? (e.push(...r.sort(), n), r = []) : r.push(n); }), e.push(...r.sort()), e; -}, ene = (t) => ({ - cache: Xre(t.cacheSize), - parseClassName: Zre(t), - ...Kre(t) -}), tne = /\s+/, rne = (t, e) => { +}, nne = (t) => ({ + cache: ene(t.cacheSize), + parseClassName: tne(t), + ...Yre(t) +}), ine = /\s+/, sne = (t, e) => { const { parseClassName: r, getClassGroupId: n, getConflictingClassGroupIds: i - } = e, s = [], o = t.trim().split(tne); + } = e, s = [], o = t.trim().split(ine); let a = ""; for (let u = o.length - 1; u >= 0; u -= 1) { const l = o[u], { @@ -35960,9 +35991,9 @@ const Hre = Wre, ay = "-", Kre = (t) => { baseClassName: w, maybePostfixModifierPosition: A } = r(l); - let P = !!A, N = n(P ? w.substring(0, A) : w); + let M = !!A, N = n(M ? w.substring(0, A) : w); if (!N) { - if (!P) { + if (!M) { a = l + (a.length > 0 ? " " + a : a); continue; } @@ -35970,92 +36001,92 @@ const Hre = Wre, ay = "-", Kre = (t) => { a = l + (a.length > 0 ? " " + a : a); continue; } - P = !1; + M = !1; } - const L = Qre(d).join(":"), $ = p ? L + S9 : L, B = $ + N; - if (s.includes(B)) + const L = rne(d).join(":"), B = p ? L + _9 : L, $ = B + N; + if (s.includes($)) continue; - s.push(B); - const H = i(N, P); + s.push($); + const H = i(N, M); for (let W = 0; W < H.length; ++W) { const V = H[W]; - s.push($ + V); + s.push(B + V); } a = l + (a.length > 0 ? " " + a : a); } return a; }; -function nne() { +function one() { let t = 0, e, r, n = ""; for (; t < arguments.length; ) - (e = arguments[t++]) && (r = A9(e)) && (n && (n += " "), n += r); + (e = arguments[t++]) && (r = E9(e)) && (n && (n += " "), n += r); return n; } -const A9 = (t) => { +const E9 = (t) => { if (typeof t == "string") return t; let e, r = ""; for (let n = 0; n < t.length; n++) - t[n] && (e = A9(t[n])) && (r && (r += " "), r += e); + t[n] && (e = E9(t[n])) && (r && (r += " "), r += e); return r; }; -function ine(t, ...e) { +function ane(t, ...e) { let r, n, i, s = o; function o(u) { const l = e.reduce((d, p) => p(d), t()); - return r = ene(l), n = r.cache.get, i = r.cache.set, s = a, a(u); + return r = nne(l), n = r.cache.get, i = r.cache.set, s = a, a(u); } function a(u) { const l = n(u); if (l) return l; - const d = rne(u, r); + const d = sne(u, r); return i(u, d), d; } return function() { - return s(nne.apply(null, arguments)); + return s(one.apply(null, arguments)); }; } const Gr = (t) => { const e = (r) => r[t] || []; return e.isThemeGetter = !0, e; -}, P9 = /^\[(?:([a-z-]+):)?(.+)\]$/i, sne = /^\d+\/\d+$/, one = /* @__PURE__ */ new Set(["px", "full", "screen"]), ane = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, cne = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, une = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, fne = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, lne = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, wo = (t) => mu(t) || one.has(t) || sne.test(t), sa = (t) => Gu(t, "length", yne), mu = (t) => !!t && !Number.isNaN(Number(t)), Hm = (t) => Gu(t, "number", mu), Nf = (t) => !!t && Number.isInteger(Number(t)), hne = (t) => t.endsWith("%") && mu(t.slice(0, -1)), ur = (t) => P9.test(t), oa = (t) => ane.test(t), dne = /* @__PURE__ */ new Set(["length", "size", "percentage"]), pne = (t) => Gu(t, dne, M9), gne = (t) => Gu(t, "position", M9), mne = /* @__PURE__ */ new Set(["image", "url"]), vne = (t) => Gu(t, mne, xne), bne = (t) => Gu(t, "", wne), Lf = () => !0, Gu = (t, e, r) => { - const n = P9.exec(t); +}, S9 = /^\[(?:([a-z-]+):)?(.+)\]$/i, cne = /^\d+\/\d+$/, une = /* @__PURE__ */ new Set(["px", "full", "screen"]), fne = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, lne = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, hne = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, dne = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, pne = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, bo = (t) => mu(t) || une.has(t) || cne.test(t), na = (t) => Gu(t, "length", _ne), mu = (t) => !!t && !Number.isNaN(Number(t)), Hm = (t) => Gu(t, "number", mu), Nf = (t) => !!t && Number.isInteger(Number(t)), gne = (t) => t.endsWith("%") && mu(t.slice(0, -1)), ur = (t) => S9.test(t), ia = (t) => fne.test(t), mne = /* @__PURE__ */ new Set(["length", "size", "percentage"]), vne = (t) => Gu(t, mne, A9), bne = (t) => Gu(t, "position", A9), yne = /* @__PURE__ */ new Set(["image", "url"]), wne = (t) => Gu(t, yne, Sne), xne = (t) => Gu(t, "", Ene), Lf = () => !0, Gu = (t, e, r) => { + const n = S9.exec(t); return n ? n[1] ? typeof e == "string" ? n[1] === e : e.has(n[1]) : r(n[2]) : !1; -}, yne = (t) => ( +}, _ne = (t) => ( // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths. // For example, `hsl(0 0% 0%)` would be classified as a length without this check. // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough. - cne.test(t) && !une.test(t) -), M9 = () => !1, wne = (t) => fne.test(t), xne = (t) => lne.test(t), _ne = () => { - const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), u = Gr("contrast"), l = Gr("grayscale"), d = Gr("hueRotate"), p = Gr("invert"), w = Gr("gap"), A = Gr("gradientColorStops"), P = Gr("gradientColorStopPositions"), N = Gr("inset"), L = Gr("margin"), $ = Gr("opacity"), B = Gr("padding"), H = Gr("saturate"), W = Gr("scale"), V = Gr("sepia"), te = Gr("skew"), R = Gr("space"), K = Gr("translate"), ge = () => ["auto", "contain", "none"], Ee = () => ["auto", "hidden", "clip", "visible", "scroll"], Y = () => ["auto", ur, e], S = () => [ur, e], m = () => ["", wo, sa], f = () => ["auto", mu, ur], g = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], b = () => ["solid", "dashed", "dotted", "double", "none"], x = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], _ = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], E = () => ["", "0", ur], v = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], M = () => [mu, ur]; + lne.test(t) && !hne.test(t) +), A9 = () => !1, Ene = (t) => dne.test(t), Sne = (t) => pne.test(t), Ane = () => { + const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), u = Gr("contrast"), l = Gr("grayscale"), d = Gr("hueRotate"), p = Gr("invert"), w = Gr("gap"), A = Gr("gradientColorStops"), M = Gr("gradientColorStopPositions"), N = Gr("inset"), L = Gr("margin"), B = Gr("opacity"), $ = Gr("padding"), H = Gr("saturate"), W = Gr("scale"), V = Gr("sepia"), te = Gr("skew"), R = Gr("space"), K = Gr("translate"), ge = () => ["auto", "contain", "none"], Ee = () => ["auto", "hidden", "clip", "visible", "scroll"], Y = () => ["auto", ur, e], S = () => [ur, e], m = () => ["", bo, na], f = () => ["auto", mu, ur], g = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], b = () => ["solid", "dashed", "dotted", "double", "none"], x = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], _ = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], E = () => ["", "0", ur], v = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], P = () => [mu, ur]; return { cacheSize: 500, separator: ":", theme: { colors: [Lf], - spacing: [wo, sa], - blur: ["none", "", oa, ur], - brightness: M(), + spacing: [bo, na], + blur: ["none", "", ia, ur], + brightness: P(), borderColor: [t], - borderRadius: ["none", "", "full", oa, ur], + borderRadius: ["none", "", "full", ia, ur], borderSpacing: S(), borderWidth: m(), - contrast: M(), + contrast: P(), grayscale: E(), - hueRotate: M(), + hueRotate: P(), invert: E(), gap: S(), gradientColorStops: [t], - gradientColorStopPositions: [hne, sa], + gradientColorStopPositions: [gne, na], inset: Y(), margin: Y(), - opacity: M(), + opacity: P(), padding: S(), - saturate: M(), - scale: M(), + saturate: P(), + scale: P(), sepia: E(), - skew: M(), + skew: P(), space: S(), translate: S() }, @@ -36078,7 +36109,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/columns */ columns: [{ - columns: [oa] + columns: [ia] }], /** * Break After @@ -36496,63 +36527,63 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/padding */ p: [{ - p: [B] + p: [$] }], /** * Padding X * @see https://tailwindcss.com/docs/padding */ px: [{ - px: [B] + px: [$] }], /** * Padding Y * @see https://tailwindcss.com/docs/padding */ py: [{ - py: [B] + py: [$] }], /** * Padding Start * @see https://tailwindcss.com/docs/padding */ ps: [{ - ps: [B] + ps: [$] }], /** * Padding End * @see https://tailwindcss.com/docs/padding */ pe: [{ - pe: [B] + pe: [$] }], /** * Padding Top * @see https://tailwindcss.com/docs/padding */ pt: [{ - pt: [B] + pt: [$] }], /** * Padding Right * @see https://tailwindcss.com/docs/padding */ pr: [{ - pr: [B] + pr: [$] }], /** * Padding Bottom * @see https://tailwindcss.com/docs/padding */ pb: [{ - pb: [B] + pb: [$] }], /** * Padding Left * @see https://tailwindcss.com/docs/padding */ pl: [{ - pl: [B] + pl: [$] }], /** * Margin @@ -36662,8 +36693,8 @@ const Gr = (t) => { */ "max-w": [{ "max-w": [ur, e, "none", "full", "min", "max", "fit", "prose", { - screen: [oa] - }, oa] + screen: [ia] + }, ia] }], /** * Height @@ -36699,7 +36730,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/font-size */ "font-size": [{ - text: ["base", oa, sa] + text: ["base", ia, na] }], /** * Font Smoothing @@ -36774,7 +36805,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/line-height */ leading: [{ - leading: ["none", "tight", "snug", "normal", "relaxed", "loose", wo, ur] + leading: ["none", "tight", "snug", "normal", "relaxed", "loose", bo, ur] }], /** * List Style Image @@ -36810,7 +36841,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/placeholder-opacity */ "placeholder-opacity": [{ - "placeholder-opacity": [$] + "placeholder-opacity": [B] }], /** * Text Alignment @@ -36831,7 +36862,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/text-opacity */ "text-opacity": [{ - "text-opacity": [$] + "text-opacity": [B] }], /** * Text Decoration @@ -36850,14 +36881,14 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/text-decoration-thickness */ "text-decoration-thickness": [{ - decoration: ["auto", "from-font", wo, sa] + decoration: ["auto", "from-font", bo, na] }], /** * Text Underline Offset * @see https://tailwindcss.com/docs/text-underline-offset */ "underline-offset": [{ - "underline-offset": ["auto", wo, ur] + "underline-offset": ["auto", bo, ur] }], /** * Text Decoration Color @@ -36946,7 +36977,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/background-opacity */ "bg-opacity": [{ - "bg-opacity": [$] + "bg-opacity": [B] }], /** * Background Origin @@ -36960,7 +36991,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/background-position */ "bg-position": [{ - bg: [...g(), gne] + bg: [...g(), bne] }], /** * Background Repeat @@ -36976,7 +37007,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/background-size */ "bg-size": [{ - bg: ["auto", "cover", "contain", pne] + bg: ["auto", "cover", "contain", vne] }], /** * Background Image @@ -36985,7 +37016,7 @@ const Gr = (t) => { "bg-image": [{ bg: ["none", { "gradient-to": ["t", "tr", "r", "br", "b", "bl", "l", "tl"] - }, vne] + }, wne] }], /** * Background Color @@ -36999,21 +37030,21 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/gradient-color-stops */ "gradient-from-pos": [{ - from: [P] + from: [M] }], /** * Gradient Color Stops Via Position * @see https://tailwindcss.com/docs/gradient-color-stops */ "gradient-via-pos": [{ - via: [P] + via: [M] }], /** * Gradient Color Stops To Position * @see https://tailwindcss.com/docs/gradient-color-stops */ "gradient-to-pos": [{ - to: [P] + to: [M] }], /** * Gradient Color Stops From @@ -37210,7 +37241,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/border-opacity */ "border-opacity": [{ - "border-opacity": [$] + "border-opacity": [B] }], /** * Border Style @@ -37248,7 +37279,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/divide-opacity */ "divide-opacity": [{ - "divide-opacity": [$] + "divide-opacity": [B] }], /** * Divide Style @@ -37339,14 +37370,14 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/outline-offset */ "outline-offset": [{ - "outline-offset": [wo, ur] + "outline-offset": [bo, ur] }], /** * Outline Width * @see https://tailwindcss.com/docs/outline-width */ "outline-w": [{ - outline: [wo, sa] + outline: [bo, na] }], /** * Outline Color @@ -37379,14 +37410,14 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/ring-opacity */ "ring-opacity": [{ - "ring-opacity": [$] + "ring-opacity": [B] }], /** * Ring Offset Width * @see https://tailwindcss.com/docs/ring-offset-width */ "ring-offset-w": [{ - "ring-offset": [wo, sa] + "ring-offset": [bo, na] }], /** * Ring Offset Color @@ -37401,7 +37432,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/box-shadow */ shadow: [{ - shadow: ["", "inner", "none", oa, bne] + shadow: ["", "inner", "none", ia, xne] }], /** * Box Shadow Color @@ -37415,7 +37446,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/opacity */ opacity: [{ - opacity: [$] + opacity: [B] }], /** * Mix Blend Mode @@ -37466,7 +37497,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/drop-shadow */ "drop-shadow": [{ - "drop-shadow": ["", "none", oa, ur] + "drop-shadow": ["", "none", ia, ur] }], /** * Grayscale @@ -37558,7 +37589,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/backdrop-opacity */ "backdrop-opacity": [{ - "backdrop-opacity": [$] + "backdrop-opacity": [B] }], /** * Backdrop Saturate @@ -37630,7 +37661,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/transition-duration */ duration: [{ - duration: M() + duration: P() }], /** * Transition Timing Function @@ -37644,7 +37675,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/transition-delay */ delay: [{ - delay: M() + delay: P() }], /** * Animation @@ -37981,7 +38012,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/stroke-width */ "stroke-w": [{ - stroke: [wo, sa, Hm] + stroke: [bo, na, Hm] }], /** * Stroke @@ -38056,31 +38087,31 @@ const Gr = (t) => { "font-size": ["leading"] } }; -}, Ene = /* @__PURE__ */ ine(_ne); -function Js(...t) { - return Ene(Hre(t)); +}, Pne = /* @__PURE__ */ ane(Ane); +function Oo(...t) { + return Pne(Gre(t)); } -function I9(t) { +function P9(t) { const { className: e } = t; - return /* @__PURE__ */ fe.jsxs("div", { className: Js("xc-flex xc-items-center xc-gap-2"), children: [ - /* @__PURE__ */ fe.jsx("hr", { className: Js("xc-flex-1 xc-border-gray-200", e) }), - /* @__PURE__ */ fe.jsx("div", { className: "xc-shrink-0", children: t.children }), - /* @__PURE__ */ fe.jsx("hr", { className: Js("xc-flex-1 xc-border-gray-200", e) }) + return /* @__PURE__ */ pe.jsxs("div", { className: Oo("xc-flex xc-items-center xc-gap-2"), children: [ + /* @__PURE__ */ pe.jsx("hr", { className: Oo("xc-flex-1 xc-border-gray-200", e) }), + /* @__PURE__ */ pe.jsx("div", { className: "xc-shrink-0", children: t.children }), + /* @__PURE__ */ pe.jsx("hr", { className: Oo("xc-flex-1 xc-border-gray-200", e) }) ] }); } -const Sne = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton"; -function Ane(t) { +const Mne = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton"; +function Ine(t) { const { onClick: e } = t; function r() { e && e(); } - return /* @__PURE__ */ fe.jsx(I9, { className: "xc-opacity-20", children: /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-cursor-pointer", onClick: r, children: [ - /* @__PURE__ */ fe.jsx("span", { className: "xc-text-sm", children: "View more wallets" }), - /* @__PURE__ */ fe.jsx(HS, { size: 16 }) + return /* @__PURE__ */ pe.jsx(P9, { className: "xc-opacity-20", children: /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-cursor-pointer", onClick: r, children: [ + /* @__PURE__ */ pe.jsx("span", { className: "xc-text-sm", children: "View more wallets" }), + /* @__PURE__ */ pe.jsx(WS, { size: 16 }) ] }) }); } -function C9(t) { - const [e, r] = Gt(""), { featuredWallets: n, initialized: i } = mp(), { onEmailConfirm: s, onSelectWallet: o, onSelectMoreWallets: a, onSelectTonConnect: u, config: l } = t, d = Ni(() => { +function M9(t) { + const [e, r] = Qt(""), { featuredWallets: n, initialized: i } = mp(), { onEmailConfirm: s, onSelectWallet: o, onSelectMoreWallets: a, onSelectTonConnect: u, config: l } = t, d = wi(() => { const N = /[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu, L = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; return !N.test(e) && L.test(e); }, [e]); @@ -38093,106 +38124,132 @@ function C9(t) { async function A() { s(e); } - function P(N) { + function M(N) { N.key === "Enter" && d && A(); } - return /* @__PURE__ */ fe.jsx(so, { children: i && /* @__PURE__ */ fe.jsxs(fe.Fragment, { children: [ - t.header || /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-6 xc-text-xl xc-font-bold", children: "Log in or sign up" }), - l.showEmailSignIn && /* @__PURE__ */ fe.jsxs("div", { className: "xc-mb-4", children: [ - /* @__PURE__ */ fe.jsx("input", { className: "xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3", placeholder: "Enter your email", type: "email", onChange: w, onKeyDown: P }), - /* @__PURE__ */ fe.jsx("button", { disabled: !d, className: "xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all", onClick: A, children: "Continue" }) + return /* @__PURE__ */ pe.jsx(Ms, { children: i && /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ + t.header || /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6 xc-text-xl xc-font-bold", children: "Log in or sign up" }), + l.showEmailSignIn && /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-4", children: [ + /* @__PURE__ */ pe.jsx("input", { className: "xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3", placeholder: "Enter your email", type: "email", onChange: w, onKeyDown: M }), + /* @__PURE__ */ pe.jsx("button", { disabled: !d, className: "xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all", onClick: A, children: "Continue" }) ] }), - l.showEmailSignIn && (l.showFeaturedWallets || l.showTonConnect) && /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-4", children: /* @__PURE__ */ fe.jsxs(I9, { className: "xc-opacity-20", children: [ + l.showEmailSignIn && (l.showFeaturedWallets || l.showTonConnect) && /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4", children: /* @__PURE__ */ pe.jsxs(P9, { className: "xc-opacity-20", children: [ " ", - /* @__PURE__ */ fe.jsx("span", { className: "xc-text-sm xc-opacity-20", children: "OR" }) + /* @__PURE__ */ pe.jsx("span", { className: "xc-text-sm xc-opacity-20", children: "OR" }) ] }) }), - /* @__PURE__ */ fe.jsxs("div", { children: [ - /* @__PURE__ */ fe.jsxs("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: [ - l.showFeaturedWallets && n && n.map((N) => /* @__PURE__ */ fe.jsx( - x9, + /* @__PURE__ */ pe.jsxs("div", { children: [ + /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: [ + l.showFeaturedWallets && n && n.map((N) => /* @__PURE__ */ pe.jsx( + y9, { wallet: N, onClick: p }, `feature-${N.key}` )), - l.showTonConnect && /* @__PURE__ */ fe.jsx( + l.showTonConnect && /* @__PURE__ */ pe.jsx( oy, { - icon: /* @__PURE__ */ fe.jsx("img", { className: "xc-h-5 xc-w-5", src: Sne }), + icon: /* @__PURE__ */ pe.jsx("img", { className: "xc-h-5 xc-w-5", src: Mne }), title: "TON Connect", onClick: u } ) ] }), - l.showMoreWallets && /* @__PURE__ */ fe.jsx(Ane, { onClick: a }) + l.showMoreWallets && /* @__PURE__ */ pe.jsx(Ine, { onClick: a }) ] }) ] }) }); } function Pc(t) { const { title: e } = t; - return /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2", children: [ - /* @__PURE__ */ fe.jsx(fZ, { onClick: t.onBack, size: 20, className: "xc-cursor-pointer" }), - /* @__PURE__ */ fe.jsx("span", { children: e }) + return /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2", children: [ + /* @__PURE__ */ pe.jsx(lZ, { onClick: t.onBack, size: 20, className: "xc-cursor-pointer" }), + /* @__PURE__ */ pe.jsx("span", { children: e }) ] }); } -var Pne = Object.defineProperty, Mne = Object.defineProperties, Ine = Object.getOwnPropertyDescriptors, S0 = Object.getOwnPropertySymbols, T9 = Object.prototype.hasOwnProperty, R9 = Object.prototype.propertyIsEnumerable, l5 = (t, e, r) => e in t ? Pne(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Cne = (t, e) => { - for (var r in e || (e = {})) T9.call(e, r) && l5(t, r, e[r]); - if (S0) for (var r of S0(e)) R9.call(e, r) && l5(t, r, e[r]); +const I9 = Sa({ + channel: "", + device: "WEB", + app: "", + inviterCode: "" +}); +function cy() { + return Tn(I9); +} +function Cne(t) { + const { config: e } = t, [r, n] = Qt(e.channel), [i, s] = Qt(e.device), [o, a] = Qt(e.app), [u, l] = Qt(e.inviterCode); + return Dn(() => { + n(e.channel), s(e.device), a(e.app), l(e.inviterCode); + }, [e]), /* @__PURE__ */ pe.jsx( + I9.Provider, + { + value: { + channel: r, + device: i, + app: o, + inviterCode: u + }, + children: t.children + } + ); +} +var Tne = Object.defineProperty, Rne = Object.defineProperties, Dne = Object.getOwnPropertyDescriptors, S0 = Object.getOwnPropertySymbols, C9 = Object.prototype.hasOwnProperty, T9 = Object.prototype.propertyIsEnumerable, u5 = (t, e, r) => e in t ? Tne(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, One = (t, e) => { + for (var r in e || (e = {})) C9.call(e, r) && u5(t, r, e[r]); + if (S0) for (var r of S0(e)) T9.call(e, r) && u5(t, r, e[r]); return t; -}, Tne = (t, e) => Mne(t, Ine(e)), Rne = (t, e) => { +}, Nne = (t, e) => Rne(t, Dne(e)), Lne = (t, e) => { var r = {}; - for (var n in t) T9.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); - if (t != null && S0) for (var n of S0(t)) e.indexOf(n) < 0 && R9.call(t, n) && (r[n] = t[n]); + for (var n in t) C9.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); + if (t != null && S0) for (var n of S0(t)) e.indexOf(n) < 0 && T9.call(t, n) && (r[n] = t[n]); return r; }; -function Dne(t) { +function kne(t) { let e = setTimeout(t, 0), r = setTimeout(t, 10), n = setTimeout(t, 50); return [e, r, n]; } -function One(t) { - let e = Yt.useRef(); - return Yt.useEffect(() => { +function $ne(t) { + let e = Gt.useRef(); + return Gt.useEffect(() => { e.current = t; }), e.current; } -var Nne = 18, D9 = 40, Lne = `${D9}px`, kne = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(","); -function $ne({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isFocused: n }) { - let [i, s] = Yt.useState(!1), [o, a] = Yt.useState(!1), [u, l] = Yt.useState(!1), d = Yt.useMemo(() => r === "none" ? !1 : (r === "increase-width" || r === "experimental-no-flickering") && i && o, [i, o, r]), p = Yt.useCallback(() => { +var Bne = 18, R9 = 40, Fne = `${R9}px`, jne = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(","); +function Une({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isFocused: n }) { + let [i, s] = Gt.useState(!1), [o, a] = Gt.useState(!1), [u, l] = Gt.useState(!1), d = Gt.useMemo(() => r === "none" ? !1 : (r === "increase-width" || r === "experimental-no-flickering") && i && o, [i, o, r]), p = Gt.useCallback(() => { let w = t.current, A = e.current; if (!w || !A || u || r === "none") return; - let P = w, N = P.getBoundingClientRect().left + P.offsetWidth, L = P.getBoundingClientRect().top + P.offsetHeight / 2, $ = N - Nne, B = L; - document.querySelectorAll(kne).length === 0 && document.elementFromPoint($, B) === w || (s(!0), l(!0)); + let M = w, N = M.getBoundingClientRect().left + M.offsetWidth, L = M.getBoundingClientRect().top + M.offsetHeight / 2, B = N - Bne, $ = L; + document.querySelectorAll(jne).length === 0 && document.elementFromPoint(B, $) === w || (s(!0), l(!0)); }, [t, e, u, r]); - return Yt.useEffect(() => { + return Gt.useEffect(() => { let w = t.current; if (!w || r === "none") return; function A() { let N = window.innerWidth - w.getBoundingClientRect().right; - a(N >= D9); + a(N >= R9); } A(); - let P = setInterval(A, 1e3); + let M = setInterval(A, 1e3); return () => { - clearInterval(P); + clearInterval(M); }; - }, [t, r]), Yt.useEffect(() => { + }, [t, r]), Gt.useEffect(() => { let w = n || document.activeElement === e.current; if (r === "none" || !w) return; - let A = setTimeout(p, 0), P = setTimeout(p, 2e3), N = setTimeout(p, 5e3), L = setTimeout(() => { + let A = setTimeout(p, 0), M = setTimeout(p, 2e3), N = setTimeout(p, 5e3), L = setTimeout(() => { l(!0); }, 6e3); return () => { - clearTimeout(A), clearTimeout(P), clearTimeout(N), clearTimeout(L); + clearTimeout(A), clearTimeout(M), clearTimeout(N), clearTimeout(L); }; - }, [e, n, r, p]), { hasPWMBadge: i, willPushPWMBadge: d, PWM_BADGE_SPACE_WIDTH: Lne }; + }, [e, n, r, p]), { hasPWMBadge: i, willPushPWMBadge: d, PWM_BADGE_SPACE_WIDTH: Fne }; } -var O9 = Yt.createContext({}), N9 = Yt.forwardRef((t, e) => { - var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: u, inputMode: l = "numeric", onComplete: d, pushPasswordManagerStrategy: p = "increase-width", pasteTransformer: w, containerClassName: A, noScriptCSSFallback: P = Bne, render: N, children: L } = r, $ = Rne(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), B, H, W, V, te; - let [R, K] = Yt.useState(typeof $.defaultValue == "string" ? $.defaultValue : ""), ge = n ?? R, Ee = One(ge), Y = Yt.useCallback((ie) => { +var D9 = Gt.createContext({}), O9 = Gt.forwardRef((t, e) => { + var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: u, inputMode: l = "numeric", onComplete: d, pushPasswordManagerStrategy: p = "increase-width", pasteTransformer: w, containerClassName: A, noScriptCSSFallback: M = qne, render: N, children: L } = r, B = Lne(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), $, H, W, V, te; + let [R, K] = Gt.useState(typeof B.defaultValue == "string" ? B.defaultValue : ""), ge = n ?? R, Ee = $ne(ge), Y = Gt.useCallback((ie) => { i == null || i(ie), K(ie); - }, [i]), S = Yt.useMemo(() => a ? typeof a == "string" ? new RegExp(a) : a : null, [a]), m = Yt.useRef(null), f = Yt.useRef(null), g = Yt.useRef({ value: ge, onChange: Y, isIOS: typeof window < "u" && ((H = (B = window == null ? void 0 : window.CSS) == null ? void 0 : B.supports) == null ? void 0 : H.call(B, "-webkit-touch-callout", "none")) }), b = Yt.useRef({ prev: [(W = m.current) == null ? void 0 : W.selectionStart, (V = m.current) == null ? void 0 : V.selectionEnd, (te = m.current) == null ? void 0 : te.selectionDirection] }); - Yt.useImperativeHandle(e, () => m.current, []), Yt.useEffect(() => { + }, [i]), S = Gt.useMemo(() => a ? typeof a == "string" ? new RegExp(a) : a : null, [a]), m = Gt.useRef(null), f = Gt.useRef(null), g = Gt.useRef({ value: ge, onChange: Y, isIOS: typeof window < "u" && ((H = ($ = window == null ? void 0 : window.CSS) == null ? void 0 : $.supports) == null ? void 0 : H.call($, "-webkit-touch-callout", "none")) }), b = Gt.useRef({ prev: [(W = m.current) == null ? void 0 : W.selectionStart, (V = m.current) == null ? void 0 : V.selectionEnd, (te = m.current) == null ? void 0 : te.selectionDirection] }); + Gt.useImperativeHandle(e, () => m.current, []), Gt.useEffect(() => { let ie = m.current, ue = f.current; if (!ie || !ue) return; g.current.value !== ie.value && g.current.onChange(ie.value), b.current.prev = [ie.selectionStart, ie.selectionEnd, ie.selectionDirection]; @@ -38239,32 +38296,32 @@ var O9 = Yt.createContext({}), N9 = Yt.forwardRef((t, e) => { document.removeEventListener("selectionchange", ve, { capture: !0 }), De.disconnect(); }; }, []); - let [x, _] = Yt.useState(!1), [E, v] = Yt.useState(!1), [M, I] = Yt.useState(null), [F, ce] = Yt.useState(null); - Yt.useEffect(() => { - Dne(() => { + let [x, _] = Gt.useState(!1), [E, v] = Gt.useState(!1), [P, I] = Gt.useState(null), [F, ce] = Gt.useState(null); + Gt.useEffect(() => { + kne(() => { var ie, ue, ve, Pe; (ie = m.current) == null || ie.dispatchEvent(new Event("input")); let De = (ue = m.current) == null ? void 0 : ue.selectionStart, Ce = (ve = m.current) == null ? void 0 : ve.selectionEnd, $e = (Pe = m.current) == null ? void 0 : Pe.selectionDirection; De !== null && Ce !== null && (I(De), ce(Ce), b.current.prev = [De, Ce, $e]); }); - }, [ge, E]), Yt.useEffect(() => { + }, [ge, E]), Gt.useEffect(() => { Ee !== void 0 && ge !== Ee && Ee.length < s && ge.length === s && (d == null || d(ge)); }, [s, d, Ee, ge]); - let D = $ne({ containerRef: f, inputRef: m, pushPasswordManagerStrategy: p, isFocused: E }), oe = Yt.useCallback((ie) => { + let D = Une({ containerRef: f, inputRef: m, pushPasswordManagerStrategy: p, isFocused: E }), oe = Gt.useCallback((ie) => { let ue = ie.currentTarget.value.slice(0, s); if (ue.length > 0 && S && !S.test(ue)) { ie.preventDefault(); return; } typeof Ee == "string" && ue.length < Ee.length && document.dispatchEvent(new Event("selectionchange")), Y(ue); - }, [s, Y, Ee, S]), Z = Yt.useCallback(() => { + }, [s, Y, Ee, S]), Z = Gt.useCallback(() => { var ie; if (m.current) { let ue = Math.min(m.current.value.length, s - 1), ve = m.current.value.length; (ie = m.current) == null || ie.setSelectionRange(ue, ve), I(ue), ce(ve); } v(!0); - }, [s]), J = Yt.useCallback((ie) => { + }, [s]), J = Gt.useCallback((ie) => { var ue, ve; let Pe = m.current; if (!w && (!g.current.isIOS || !ie.clipboardData || !Pe)) return; @@ -38275,29 +38332,29 @@ var O9 = Yt.createContext({}), N9 = Yt.forwardRef((t, e) => { Pe.value = Ne, Y(Ne); let Ke = Math.min(Ne.length, s - 1), Le = Ne.length; Pe.setSelectionRange(Ke, Le), I(Ke), ce(Le); - }, [s, Y, S, ge]), Q = Yt.useMemo(() => ({ position: "relative", cursor: $.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [$.disabled]), T = Yt.useMemo(() => ({ position: "absolute", inset: 0, width: D.willPushPWMBadge ? `calc(100% + ${D.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: D.willPushPWMBadge ? `inset(0 ${D.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: o, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [D.PWM_BADGE_SPACE_WIDTH, D.willPushPWMBadge, o]), X = Yt.useMemo(() => Yt.createElement("input", Tne(Cne({ autoComplete: $.autoComplete || "one-time-code" }, $), { "data-input-otp": !0, "data-input-otp-placeholder-shown": ge.length === 0 || void 0, "data-input-otp-mss": M, "data-input-otp-mse": F, inputMode: l, pattern: S == null ? void 0 : S.source, "aria-placeholder": u, style: T, maxLength: s, value: ge, ref: m, onPaste: (ie) => { + }, [s, Y, S, ge]), Q = Gt.useMemo(() => ({ position: "relative", cursor: B.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [B.disabled]), T = Gt.useMemo(() => ({ position: "absolute", inset: 0, width: D.willPushPWMBadge ? `calc(100% + ${D.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: D.willPushPWMBadge ? `inset(0 ${D.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: o, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [D.PWM_BADGE_SPACE_WIDTH, D.willPushPWMBadge, o]), X = Gt.useMemo(() => Gt.createElement("input", Nne(One({ autoComplete: B.autoComplete || "one-time-code" }, B), { "data-input-otp": !0, "data-input-otp-placeholder-shown": ge.length === 0 || void 0, "data-input-otp-mss": P, "data-input-otp-mse": F, inputMode: l, pattern: S == null ? void 0 : S.source, "aria-placeholder": u, style: T, maxLength: s, value: ge, ref: m, onPaste: (ie) => { var ue; - J(ie), (ue = $.onPaste) == null || ue.call($, ie); + J(ie), (ue = B.onPaste) == null || ue.call(B, ie); }, onChange: oe, onMouseOver: (ie) => { var ue; - _(!0), (ue = $.onMouseOver) == null || ue.call($, ie); + _(!0), (ue = B.onMouseOver) == null || ue.call(B, ie); }, onMouseLeave: (ie) => { var ue; - _(!1), (ue = $.onMouseLeave) == null || ue.call($, ie); + _(!1), (ue = B.onMouseLeave) == null || ue.call(B, ie); }, onFocus: (ie) => { var ue; - Z(), (ue = $.onFocus) == null || ue.call($, ie); + Z(), (ue = B.onFocus) == null || ue.call(B, ie); }, onBlur: (ie) => { var ue; - v(!1), (ue = $.onBlur) == null || ue.call($, ie); - } })), [oe, Z, J, l, T, s, F, M, $, S == null ? void 0 : S.source, ge]), re = Yt.useMemo(() => ({ slots: Array.from({ length: s }).map((ie, ue) => { + v(!1), (ue = B.onBlur) == null || ue.call(B, ie); + } })), [oe, Z, J, l, T, s, F, P, B, S == null ? void 0 : S.source, ge]), re = Gt.useMemo(() => ({ slots: Array.from({ length: s }).map((ie, ue) => { var ve; - let Pe = E && M !== null && F !== null && (M === F && ue === M || ue >= M && ue < F), De = ge[ue] !== void 0 ? ge[ue] : null, Ce = ge[0] !== void 0 ? null : (ve = u == null ? void 0 : u[ue]) != null ? ve : null; + let Pe = E && P !== null && F !== null && (P === F && ue === P || ue >= P && ue < F), De = ge[ue] !== void 0 ? ge[ue] : null, Ce = ge[0] !== void 0 ? null : (ve = u == null ? void 0 : u[ue]) != null ? ve : null; return { char: De, placeholderChar: Ce, isActive: Pe, hasFakeCaret: Pe && De === null }; - }), isFocused: E, isHovering: !$.disabled && x }), [E, x, s, F, M, $.disabled, ge]), pe = Yt.useMemo(() => N ? N(re) : Yt.createElement(O9.Provider, { value: re }, L), [L, re, N]); - return Yt.createElement(Yt.Fragment, null, P !== null && Yt.createElement("noscript", null, Yt.createElement("style", null, P)), Yt.createElement("div", { ref: f, "data-input-otp-container": !0, style: Q, className: A }, pe, Yt.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, X))); + }), isFocused: E, isHovering: !B.disabled && x }), [E, x, s, F, P, B.disabled, ge]), de = Gt.useMemo(() => N ? N(re) : Gt.createElement(D9.Provider, { value: re }, L), [L, re, N]); + return Gt.createElement(Gt.Fragment, null, M !== null && Gt.createElement("noscript", null, Gt.createElement("style", null, M)), Gt.createElement("div", { ref: f, "data-input-otp-container": !0, style: Q, className: A }, de, Gt.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, X))); }); -N9.displayName = "Input"; +O9.displayName = "Input"; function kf(t, e) { try { t.insertRule(e); @@ -38305,7 +38362,7 @@ function kf(t, e) { console.error("input-otp could not insert CSS rule:", e); } } -var Bne = ` +var qne = ` [data-input-otp] { --nojs-bg: white !important; --nojs-fg: black !important; @@ -38325,28 +38382,28 @@ var Bne = ` --nojs-fg: white !important; } }`; -const cy = Yt.forwardRef(({ className: t, containerClassName: e, ...r }, n) => /* @__PURE__ */ fe.jsx( - N9, +const N9 = Gt.forwardRef(({ className: t, containerClassName: e, ...r }, n) => /* @__PURE__ */ pe.jsx( + O9, { ref: n, - containerClassName: Js( + containerClassName: Oo( "xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50", e ), - className: Js("disabled:xc-cursor-not-allowed", t), + className: Oo("disabled:xc-cursor-not-allowed", t), ...r } )); -cy.displayName = "InputOTP"; -const uy = Yt.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ fe.jsx("div", { ref: r, className: Js("xc-flex xc-items-center", t), ...e })); -uy.displayName = "InputOTPGroup"; -const Ri = Yt.forwardRef(({ index: t, className: e, ...r }, n) => { - const i = Yt.useContext(O9), { char: s, hasFakeCaret: o, isActive: a } = i.slots[t]; - return /* @__PURE__ */ fe.jsxs( +N9.displayName = "InputOTP"; +const L9 = Gt.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ pe.jsx("div", { ref: r, className: Oo("xc-flex xc-items-center", t), ...e })); +L9.displayName = "InputOTPGroup"; +const Xa = Gt.forwardRef(({ index: t, className: e, ...r }, n) => { + const i = Gt.useContext(D9), { char: s, hasFakeCaret: o, isActive: a } = i.slots[t]; + return /* @__PURE__ */ pe.jsxs( "div", { ref: n, - className: Js( + className: Oo( "xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all", a && "xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background", e @@ -38354,114 +38411,143 @@ const Ri = Yt.forwardRef(({ index: t, className: e, ...r }, n) => { ...r, children: [ s, - o && /* @__PURE__ */ fe.jsx("div", { className: "xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center", children: /* @__PURE__ */ fe.jsx("div", { className: "xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000" }) }) + o && /* @__PURE__ */ pe.jsx("div", { className: "xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center", children: /* @__PURE__ */ pe.jsx("div", { className: "xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000" }) }) ] } ); }); -Ri.displayName = "InputOTPSlot"; -function L9(t) { +Xa.displayName = "InputOTPSlot"; +function zne(t) { const { spinning: e, children: r, className: n } = t; - return /* @__PURE__ */ fe.jsxs("div", { className: "xc-inline-block xc-relative", children: [ + return /* @__PURE__ */ pe.jsxs("div", { className: "xc-inline-block xc-relative", children: [ r, - e && /* @__PURE__ */ fe.jsx("div", { className: Js("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center", n), children: /* @__PURE__ */ fe.jsx(_a, { className: "xc-animate-spin" }) }) + e && /* @__PURE__ */ pe.jsx("div", { className: Oo("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center", n), children: /* @__PURE__ */ pe.jsx(mc, { className: "xc-animate-spin" }) }) ] }); } -const k9 = Ma({ - channel: "", - device: "WEB", - app: "", - inviterCode: "" -}); -function fy() { - return Tn(k9); -} -function Fne(t) { - const { config: e } = t, [r, n] = Gt(e.channel), [i, s] = Gt(e.device), [o, a] = Gt(e.app), [u, l] = Gt(e.inviterCode); - return Dn(() => { - n(e.channel), s(e.device), a(e.app), l(e.inviterCode); - }, [e]), /* @__PURE__ */ fe.jsx( - k9.Provider, - { - value: { - channel: r, - device: i, - app: o, - inviterCode: u - }, - children: t.children - } - ); -} -function jne(t) { - const { email: e } = t, [r, n] = Gt(0), [i, s] = Gt(!1), [o, a] = Gt(!1), [u, l] = Gt(""), [d, p] = Gt(""), w = fy(); - async function A() { +function k9(t) { + const { email: e } = t, [r, n] = Qt(0), [i, s] = Qt(!1), [o, a] = Qt(""), u = Un(null); + async function l() { n(60); - const L = setInterval(() => { - n(($) => $ === 0 ? (clearInterval(L), 0) : $ - 1); + const p = setInterval(() => { + n((w) => w === 0 ? (clearInterval(p), 0) : w - 1); }, 1e3); } - async function P(L) { - a(!0); - try { - l(""), await qo.getEmailCode({ account_type: "email", email: L }), A(); - } catch ($) { - l($.message); - } - a(!1); - } - Dn(() => { - e && P(e); - }, [e]); - async function N(L) { - if (p(""), !(L.length < 6)) { + async function d(p) { + if (a(""), !(p.length < 6)) { s(!0); try { - const $ = await qo.emailLogin({ - account_type: "email", - connector: "codatta_email", - account_enum: "C", - email_code: L, - email: e, - inviter_code: w.inviterCode, - source: { - device: w.device, - channel: w.channel, - app: w.app - } - }); - t.onLogin($.data); - } catch ($) { - p($.message); + await t.onInputCode(e, p); + } catch (w) { + a(w.message); } s(!1); } } - return /* @__PURE__ */ fe.jsxs(so, { children: [ - /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ fe.jsx(Pc, { title: "Sign in with email", onBack: t.onBack }) }), - /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ - /* @__PURE__ */ fe.jsx(VS, { className: "xc-mb-4", size: 60 }), - /* @__PURE__ */ fe.jsx("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16", children: u ? /* @__PURE__ */ fe.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ fe.jsx("p", { className: "xc-px-8", children: u }) }) : o ? /* @__PURE__ */ fe.jsx(_a, { className: "xc-animate-spin" }) : /* @__PURE__ */ fe.jsxs(fe.Fragment, { children: [ - /* @__PURE__ */ fe.jsx("p", { className: "xc-text-lg xc-mb-1", children: "We’ve sent a verification code to" }), - /* @__PURE__ */ fe.jsx("p", { className: "xc-font-bold xc-text-center", children: e }) - ] }) }), - /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-2 xc-h-12", children: /* @__PURE__ */ fe.jsx(L9, { spinning: i, className: "xc-rounded-xl", children: /* @__PURE__ */ fe.jsx(cy, { maxLength: 6, onChange: N, disabled: i, className: "disabled:xc-opacity-20", children: /* @__PURE__ */ fe.jsx(uy, { children: /* @__PURE__ */ fe.jsxs("div", { className: Js("xc-flex xc-gap-2", i ? "xc-opacity-20" : ""), children: [ - /* @__PURE__ */ fe.jsx(Ri, { index: 0 }), - /* @__PURE__ */ fe.jsx(Ri, { index: 1 }), - /* @__PURE__ */ fe.jsx(Ri, { index: 2 }), - /* @__PURE__ */ fe.jsx(Ri, { index: 3 }), - /* @__PURE__ */ fe.jsx(Ri, { index: 4 }), - /* @__PURE__ */ fe.jsx(Ri, { index: 5 }) + return Dn(() => { + l(); + }, []), /* @__PURE__ */ pe.jsxs(Ms, { children: [ + /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ + /* @__PURE__ */ pe.jsx(vZ, { className: "xc-mb-4", size: 60 }), + /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16", children: [ + /* @__PURE__ */ pe.jsx("p", { className: "xc-text-lg xc-mb-1", children: "We’ve sent a verification code to" }), + /* @__PURE__ */ pe.jsx("p", { className: "xc-font-bold xc-text-center", children: e }) + ] }), + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-2 xc-h-12", children: /* @__PURE__ */ pe.jsx(zne, { spinning: i, className: "xc-rounded-xl", children: /* @__PURE__ */ pe.jsx(N9, { maxLength: 6, onChange: d, disabled: i, className: "disabled:xc-opacity-20", children: /* @__PURE__ */ pe.jsx(L9, { children: /* @__PURE__ */ pe.jsxs("div", { className: Oo("xc-flex xc-gap-2", i ? "xc-opacity-20" : ""), children: [ + /* @__PURE__ */ pe.jsx(Xa, { index: 0 }), + /* @__PURE__ */ pe.jsx(Xa, { index: 1 }), + /* @__PURE__ */ pe.jsx(Xa, { index: 2 }), + /* @__PURE__ */ pe.jsx(Xa, { index: 3 }), + /* @__PURE__ */ pe.jsx(Xa, { index: 4 }), + /* @__PURE__ */ pe.jsx(Xa, { index: 5 }) ] }) }) }) }) }), - d && /* @__PURE__ */ fe.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ fe.jsx("p", { children: d }) }) + o && /* @__PURE__ */ pe.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ pe.jsx("p", { children: o }) }) ] }), - /* @__PURE__ */ fe.jsxs("div", { className: "xc-text-center xc-text-sm xc-text-gray-400", children: [ + /* @__PURE__ */ pe.jsxs("div", { className: "xc-text-center xc-text-sm xc-text-gray-400", children: [ "Not get it? ", - r ? `Recend in ${r}s` : /* @__PURE__ */ fe.jsx("button", { onClick: () => P(e), children: "Send again" }) - ] }) + r ? `Recend in ${r}s` : /* @__PURE__ */ pe.jsx("button", { id: "sendCodeButton", ref: u, children: "Send again" }) + ] }), + /* @__PURE__ */ pe.jsx("div", { id: "captcha-element" }) ] }); } -var $9 = { exports: {} }; +function $9(t) { + const { email: e } = t, [r, n] = Qt(!1), [i, s] = Qt(""), o = wi(() => `xn-btn-${(/* @__PURE__ */ new Date()).getTime()}`, [e]); + async function a(w, A) { + n(!0); + try { + s(""), await Ta.getEmailCode({ account_type: "email", email: w }, A); + } catch (M) { + s(M.message); + } + n(!1); + } + async function u(w) { + try { + return await a(e, JSON.stringify(w)), { captchaResult: !0, bizResult: !0 }; + } catch (A) { + return s(A.message), { captchaResult: !1, bizResult: !1 }; + } + } + async function l(w) { + w && t.onCodeSend(); + } + const d = Un(); + function p(w) { + d.current = w; + } + return Dn(() => { + if (e) + return window.initAliyunCaptcha({ + SceneId: "tqyu8129d", + prefix: "1mfsn5f", + mode: "popup", + element: "#captcha-element", + button: `#${o}`, + captchaVerifyCallback: u, + onBizResultCallback: l, + getInstance: p, + slideStyle: { + width: 360, + height: 40 + }, + language: "en", + region: "cn" + }), () => { + var w, A; + (w = document.getElementById("aliyunCaptcha-mask")) == null || w.remove(), (A = document.getElementById("aliyunCaptcha-window-popup")) == null || A.remove(); + }; + }, [e]), /* @__PURE__ */ pe.jsxs(Ms, { children: [ + /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ + /* @__PURE__ */ pe.jsx(bZ, { className: "xc-mb-4", size: 60 }), + /* @__PURE__ */ pe.jsx("button", { className: "xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2", id: o, children: r ? /* @__PURE__ */ pe.jsx(mc, { className: "xc-animate-spin" }) : "I'm not a robot" }) + ] }), + i && /* @__PURE__ */ pe.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ pe.jsx("p", { children: i }) }) + ] }); +} +function Wne(t) { + const { email: e } = t, r = cy(), [n, i] = Qt("captcha"); + async function s(o, a) { + const u = await Ta.emailLogin({ + account_type: "email", + connector: "codatta_email", + account_enum: "C", + email_code: a, + email: o, + inviter_code: r.inviterCode, + source: { + device: r.device, + channel: r.channel, + app: r.app + } + }); + t.onLogin(u.data); + } + return /* @__PURE__ */ pe.jsxs(Ms, { children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ pe.jsx(Pc, { title: "Sign in with email", onBack: t.onBack }) }), + n === "captcha" && /* @__PURE__ */ pe.jsx($9, { email: e, onCodeSend: () => i("verify-email") }), + n === "verify-email" && /* @__PURE__ */ pe.jsx(k9, { email: e, onInputCode: s, onResendCode: () => i("captcha") }) + ] }); +} +var B9 = { exports: {} }; (function(t, e) { (function(r, n) { t.exports = n(); @@ -38469,39 +38555,39 @@ var $9 = { exports: {} }; var r = { 873: (o, a) => { var u, l, d = function() { var p = function(f, g) { - var b = f, x = $[g], _ = null, E = 0, v = null, M = [], I = {}, F = function(re, pe) { + var b = f, x = B[g], _ = null, E = 0, v = null, P = [], I = {}, F = function(re, de) { _ = function(ie) { for (var ue = new Array(ie), ve = 0; ve < ie; ve += 1) { ue[ve] = new Array(ie); for (var Pe = 0; Pe < ie; Pe += 1) ue[ve][Pe] = null; } return ue; - }(E = 4 * b + 17), ce(0, 0), ce(E - 7, 0), ce(0, E - 7), oe(), D(), J(re, pe), b >= 7 && Z(re), v == null && (v = T(b, x, M)), Q(v, pe); - }, ce = function(re, pe) { - for (var ie = -1; ie <= 7; ie += 1) if (!(re + ie <= -1 || E <= re + ie)) for (var ue = -1; ue <= 7; ue += 1) pe + ue <= -1 || E <= pe + ue || (_[re + ie][pe + ue] = 0 <= ie && ie <= 6 && (ue == 0 || ue == 6) || 0 <= ue && ue <= 6 && (ie == 0 || ie == 6) || 2 <= ie && ie <= 4 && 2 <= ue && ue <= 4); + }(E = 4 * b + 17), ce(0, 0), ce(E - 7, 0), ce(0, E - 7), oe(), D(), J(re, de), b >= 7 && Z(re), v == null && (v = T(b, x, P)), Q(v, de); + }, ce = function(re, de) { + for (var ie = -1; ie <= 7; ie += 1) if (!(re + ie <= -1 || E <= re + ie)) for (var ue = -1; ue <= 7; ue += 1) de + ue <= -1 || E <= de + ue || (_[re + ie][de + ue] = 0 <= ie && ie <= 6 && (ue == 0 || ue == 6) || 0 <= ue && ue <= 6 && (ie == 0 || ie == 6) || 2 <= ie && ie <= 4 && 2 <= ue && ue <= 4); }, D = function() { for (var re = 8; re < E - 8; re += 1) _[re][6] == null && (_[re][6] = re % 2 == 0); - for (var pe = 8; pe < E - 8; pe += 1) _[6][pe] == null && (_[6][pe] = pe % 2 == 0); + for (var de = 8; de < E - 8; de += 1) _[6][de] == null && (_[6][de] = de % 2 == 0); }, oe = function() { - for (var re = B.getPatternPosition(b), pe = 0; pe < re.length; pe += 1) for (var ie = 0; ie < re.length; ie += 1) { - var ue = re[pe], ve = re[ie]; + for (var re = $.getPatternPosition(b), de = 0; de < re.length; de += 1) for (var ie = 0; ie < re.length; ie += 1) { + var ue = re[de], ve = re[ie]; if (_[ue][ve] == null) for (var Pe = -2; Pe <= 2; Pe += 1) for (var De = -2; De <= 2; De += 1) _[ue + Pe][ve + De] = Pe == -2 || Pe == 2 || De == -2 || De == 2 || Pe == 0 && De == 0; } }, Z = function(re) { - for (var pe = B.getBCHTypeNumber(b), ie = 0; ie < 18; ie += 1) { - var ue = !re && (pe >> ie & 1) == 1; + for (var de = $.getBCHTypeNumber(b), ie = 0; ie < 18; ie += 1) { + var ue = !re && (de >> ie & 1) == 1; _[Math.floor(ie / 3)][ie % 3 + E - 8 - 3] = ue; } - for (ie = 0; ie < 18; ie += 1) ue = !re && (pe >> ie & 1) == 1, _[ie % 3 + E - 8 - 3][Math.floor(ie / 3)] = ue; - }, J = function(re, pe) { - for (var ie = x << 3 | pe, ue = B.getBCHTypeInfo(ie), ve = 0; ve < 15; ve += 1) { + for (ie = 0; ie < 18; ie += 1) ue = !re && (de >> ie & 1) == 1, _[ie % 3 + E - 8 - 3][Math.floor(ie / 3)] = ue; + }, J = function(re, de) { + for (var ie = x << 3 | de, ue = $.getBCHTypeInfo(ie), ve = 0; ve < 15; ve += 1) { var Pe = !re && (ue >> ve & 1) == 1; ve < 6 ? _[ve][8] = Pe : ve < 8 ? _[ve + 1][8] = Pe : _[E - 15 + ve][8] = Pe; } for (ve = 0; ve < 15; ve += 1) Pe = !re && (ue >> ve & 1) == 1, ve < 8 ? _[8][E - ve - 1] = Pe : ve < 9 ? _[8][15 - ve - 1 + 1] = Pe : _[8][15 - ve - 1] = Pe; _[E - 8][8] = !re; - }, Q = function(re, pe) { - for (var ie = -1, ue = E - 1, ve = 7, Pe = 0, De = B.getMaskFunction(pe), Ce = E - 1; Ce > 0; Ce -= 2) for (Ce == 6 && (Ce -= 1); ; ) { + }, Q = function(re, de) { + for (var ie = -1, ue = E - 1, ve = 7, Pe = 0, De = $.getMaskFunction(de), Ce = E - 1; Ce > 0; Ce -= 2) for (Ce == 6 && (Ce -= 1); ; ) { for (var $e = 0; $e < 2; $e += 1) if (_[ue][Ce - $e] == null) { var Me = !1; Pe < re.length && (Me = (re[Pe] >>> ve & 1) == 1), De(ue, Ce - $e) && (Me = !Me), _[ue][Ce - $e] = Me, (ve -= 1) == -1 && (Pe += 1, ve = 7); @@ -38511,10 +38597,10 @@ var $9 = { exports: {} }; break; } } - }, T = function(re, pe, ie) { - for (var ue = V.getRSBlocks(re, pe), ve = te(), Pe = 0; Pe < ie.length; Pe += 1) { + }, T = function(re, de, ie) { + for (var ue = V.getRSBlocks(re, de), ve = te(), Pe = 0; Pe < ie.length; Pe += 1) { var De = ie[Pe]; - ve.put(De.getMode(), 4), ve.put(De.getLength(), B.getLengthInBits(De.getMode(), re)), De.write(ve); + ve.put(De.getMode(), 4), ve.put(De.getLength(), $.getLengthInBits(De.getMode(), re)), De.write(ve); } var Ce = 0; for (Pe = 0; Pe < ue.length; Pe += 1) Ce += ue[Pe].dataCount; @@ -38527,7 +38613,7 @@ var $9 = { exports: {} }; Ke = Math.max(Ke, Ze), Le = Math.max(Le, at), qe[_e] = new Array(Ze); for (var ke = 0; ke < qe[_e].length; ke += 1) qe[_e][ke] = 255 & $e.getBuffer()[ke + Ne]; Ne += Ze; - var Qe = B.getErrorCorrectPolynomial(at), tt = W(qe[_e], Qe.getLength() - 1).mod(Qe); + var Qe = $.getErrorCorrectPolynomial(at), tt = W(qe[_e], Qe.getLength() - 1).mod(Qe); for (ze[_e] = new Array(Qe.getLength() - 1), ke = 0; ke < ze[_e].length; ke += 1) { var Ye = ke + tt.getLength() - ze[_e].length; ze[_e][ke] = Ye >= 0 ? tt.getAt(Ye) : 0; @@ -38541,9 +38627,9 @@ var $9 = { exports: {} }; return lt; }(ve, ue); }; - I.addData = function(re, pe) { + I.addData = function(re, de) { var ie = null; - switch (pe = pe || "Byte") { + switch (de = de || "Byte") { case "Numeric": ie = R(re); break; @@ -38557,23 +38643,23 @@ var $9 = { exports: {} }; ie = Ee(re); break; default: - throw "mode:" + pe; + throw "mode:" + de; } - M.push(ie), v = null; - }, I.isDark = function(re, pe) { - if (re < 0 || E <= re || pe < 0 || E <= pe) throw re + "," + pe; - return _[re][pe]; + P.push(ie), v = null; + }, I.isDark = function(re, de) { + if (re < 0 || E <= re || de < 0 || E <= de) throw re + "," + de; + return _[re][de]; }, I.getModuleCount = function() { return E; }, I.make = function() { if (b < 1) { for (var re = 1; re < 40; re++) { - for (var pe = V.getRSBlocks(re, x), ie = te(), ue = 0; ue < M.length; ue++) { - var ve = M[ue]; - ie.put(ve.getMode(), 4), ie.put(ve.getLength(), B.getLengthInBits(ve.getMode(), re)), ve.write(ie); + for (var de = V.getRSBlocks(re, x), ie = te(), ue = 0; ue < P.length; ue++) { + var ve = P[ue]; + ie.put(ve.getMode(), 4), ie.put(ve.getLength(), $.getLengthInBits(ve.getMode(), re)), ve.write(ie); } var Pe = 0; - for (ue = 0; ue < pe.length; ue++) Pe += pe[ue].dataCount; + for (ue = 0; ue < de.length; ue++) Pe += de[ue].dataCount; if (ie.getLengthInBits() <= 8 * Pe) break; } b = re; @@ -38581,30 +38667,30 @@ var $9 = { exports: {} }; F(!1, function() { for (var De = 0, Ce = 0, $e = 0; $e < 8; $e += 1) { F(!0, $e); - var Me = B.getLostPoint(I); + var Me = $.getLostPoint(I); ($e == 0 || De > Me) && (De = Me, Ce = $e); } return Ce; }()); - }, I.createTableTag = function(re, pe) { + }, I.createTableTag = function(re, de) { re = re || 2; var ie = ""; - ie += '"; - }, I.createSvgTag = function(re, pe, ie, ue) { + }, I.createSvgTag = function(re, de, ie, ue) { var ve = {}; - typeof arguments[0] == "object" && (re = (ve = arguments[0]).cellSize, pe = ve.margin, ie = ve.alt, ue = ve.title), re = re || 2, pe = pe === void 0 ? 4 * re : pe, (ie = typeof ie == "string" ? { text: ie } : ie || {}).text = ie.text || null, ie.id = ie.text ? ie.id || "qrcode-description" : null, (ue = typeof ue == "string" ? { text: ue } : ue || {}).text = ue.text || null, ue.id = ue.text ? ue.id || "qrcode-title" : null; - var Pe, De, Ce, $e, Me = I.getModuleCount() * re + 2 * pe, Ne = ""; - for ($e = "l" + re + ",0 0," + re + " -" + re + ",0 0,-" + re + "z ", Ne += '' + X(ue.text) + "" : "", Ne += ie.text ? '' + X(ie.text) + "" : "", Ne += '', Ne += '' + X(ue.text) + "" : "", Ne += ie.text ? '' + X(ie.text) + "" : "", Ne += '', Ne += '"; - }, I.createDataURL = function(re, pe) { - re = re || 2, pe = pe === void 0 ? 4 * re : pe; - var ie = I.getModuleCount() * re + 2 * pe, ue = pe, ve = ie - pe; + }, I.createDataURL = function(re, de) { + re = re || 2, de = de === void 0 ? 4 * re : de; + var ie = I.getModuleCount() * re + 2 * de, ue = de, ve = ie - de; return m(ie, ie, function(Pe, De) { if (ue <= Pe && Pe < ve && ue <= De && De < ve) { var Ce = Math.floor((Pe - ue) / re), $e = Math.floor((De - ue) / re); @@ -38612,34 +38698,34 @@ var $9 = { exports: {} }; } return 1; }); - }, I.createImgTag = function(re, pe, ie) { - re = re || 2, pe = pe === void 0 ? 4 * re : pe; - var ue = I.getModuleCount() * re + 2 * pe, ve = ""; - return ve += ""; + }, I.createImgTag = function(re, de, ie) { + re = re || 2, de = de === void 0 ? 4 * re : de; + var ue = I.getModuleCount() * re + 2 * de, ve = ""; + return ve += ""; }; var X = function(re) { - for (var pe = "", ie = 0; ie < re.length; ie += 1) { + for (var de = "", ie = 0; ie < re.length; ie += 1) { var ue = re.charAt(ie); switch (ue) { case "<": - pe += "<"; + de += "<"; break; case ">": - pe += ">"; + de += ">"; break; case "&": - pe += "&"; + de += "&"; break; case '"': - pe += """; + de += """; break; default: - pe += ue; + de += ue; } } - return pe; + return de; }; - return I.createASCII = function(re, pe) { + return I.createASCII = function(re, de) { if ((re = re || 1) < 2) return function(qe) { qe = qe === void 0 ? 2 : qe; var ze, _e, Ze, at, ke, Qe = 1 * I.getModuleCount() + 2 * qe, tt = qe, Ye = Qe - qe, dt = { "██": "█", "█ ": "▀", " █": "▄", " ": " " }, lt = { "██": "▀", "█ ": "▀", " █": " ", " ": " " }, ct = ""; @@ -38649,18 +38735,18 @@ var $9 = { exports: {} }; `; } return Qe % 2 && qe > 0 ? ct.substring(0, ct.length - Qe - 1) + Array(Qe + 1).join("▀") : ct.substring(0, ct.length - 1); - }(pe); - re -= 1, pe = pe === void 0 ? 2 * re : pe; - var ie, ue, ve, Pe, De = I.getModuleCount() * re + 2 * pe, Ce = pe, $e = De - pe, Me = Array(re + 1).join("██"), Ne = Array(re + 1).join(" "), Ke = "", Le = ""; + }(de); + re -= 1, de = de === void 0 ? 2 * re : de; + var ie, ue, ve, Pe, De = I.getModuleCount() * re + 2 * de, Ce = de, $e = De - de, Me = Array(re + 1).join("██"), Ne = Array(re + 1).join(" "), Ke = "", Le = ""; for (ie = 0; ie < De; ie += 1) { for (ve = Math.floor((ie - Ce) / re), Le = "", ue = 0; ue < De; ue += 1) Pe = 1, Ce <= ue && ue < $e && Ce <= ie && ie < $e && I.isDark(ve, Math.floor((ue - Ce) / re)) && (Pe = 0), Le += Pe ? Me : Ne; for (ve = 0; ve < re; ve += 1) Ke += Le + ` `; } return Ke.substring(0, Ke.length - 1); - }, I.renderTo2dContext = function(re, pe) { - pe = pe || 2; - for (var ie = I.getModuleCount(), ue = 0; ue < ie; ue++) for (var ve = 0; ve < ie; ve++) re.fillStyle = I.isDark(ue, ve) ? "black" : "white", re.fillRect(ue * pe, ve * pe, pe, pe); + }, I.renderTo2dContext = function(re, de) { + de = de || 2; + for (var ie = I.getModuleCount(), ue = 0; ue < ie; ue++) for (var ve = 0; ve < ie; ve++) re.fillStyle = I.isDark(ue, ve) ? "black" : "white", re.fillRect(ue * de, ve * de, de, de); }, I; }; p.stringToBytes = (p.stringToBytesFuncs = { default: function(f) { @@ -38675,19 +38761,19 @@ var $9 = { exports: {} }; var D = _.read(); if (D == -1) throw "eof"; return D; - }, v = 0, M = {}; ; ) { + }, v = 0, P = {}; ; ) { var I = _.read(); if (I == -1) break; var F = E(), ce = E() << 8 | E(); - M[String.fromCharCode(I << 8 | F)] = ce, v += 1; + P[String.fromCharCode(I << 8 | F)] = ce, v += 1; } if (v != g) throw v + " != " + g; - return M; + return P; }(), x = 63; return function(_) { for (var E = [], v = 0; v < _.length; v += 1) { - var M = _.charCodeAt(v); - if (M < 128) E.push(M); + var P = _.charCodeAt(v); + if (P < 128) E.push(P); else { var I = b[_.charAt(v)]; typeof I == "number" ? (255 & I) == I ? E.push(I) : (E.push(I >>> 8), E.push(255 & I)) : E.push(x); @@ -38696,14 +38782,14 @@ var $9 = { exports: {} }; return E; }; }; - var w, A, P, N, L, $ = { L: 1, M: 0, Q: 3, H: 2 }, B = (w = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], A = 1335, P = 7973, L = function(f) { + var w, A, M, N, L, B = { L: 1, M: 0, Q: 3, H: 2 }, $ = (w = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], A = 1335, M = 7973, L = function(f) { for (var g = 0; f != 0; ) g += 1, f >>>= 1; return g; }, (N = {}).getBCHTypeInfo = function(f) { for (var g = f << 10; L(g) - L(A) >= 0; ) g ^= A << L(g) - L(A); return 21522 ^ (f << 10 | g); }, N.getBCHTypeNumber = function(f) { - for (var g = f << 12; L(g) - L(P) >= 0; ) g ^= P << L(g) - L(P); + for (var g = f << 12; L(g) - L(M) >= 0; ) g ^= M << L(g) - L(M); return f << 12 | g; }, N.getPatternPosition = function(f) { return w[f - 1]; @@ -38788,7 +38874,7 @@ var $9 = { exports: {} }; } }, N.getLostPoint = function(f) { for (var g = f.getModuleCount(), b = 0, x = 0; x < g; x += 1) for (var _ = 0; _ < g; _ += 1) { - for (var E = 0, v = f.isDark(x, _), M = -1; M <= 1; M += 1) if (!(x + M < 0 || g <= x + M)) for (var I = -1; I <= 1; I += 1) _ + I < 0 || g <= _ + I || M == 0 && I == 0 || v == f.isDark(x + M, _ + I) && (E += 1); + for (var E = 0, v = f.isDark(x, _), P = -1; P <= 1; P += 1) if (!(x + P < 0 || g <= x + P)) for (var I = -1; I <= 1; I += 1) _ + I < 0 || g <= _ + I || P == 0 && I == 0 || v == f.isDark(x + P, _ + I) && (E += 1); E > 5 && (b += 3 + E - 5); } for (x = 0; x < g - 1; x += 1) for (_ = 0; _ < g - 1; _ += 1) { @@ -38824,12 +38910,12 @@ var $9 = { exports: {} }; }, getLength: function() { return b.length; }, multiply: function(_) { - for (var E = new Array(x.getLength() + _.getLength() - 1), v = 0; v < x.getLength(); v += 1) for (var M = 0; M < _.getLength(); M += 1) E[v + M] ^= H.gexp(H.glog(x.getAt(v)) + H.glog(_.getAt(M))); + for (var E = new Array(x.getLength() + _.getLength() - 1), v = 0; v < x.getLength(); v += 1) for (var P = 0; P < _.getLength(); P += 1) E[v + P] ^= H.gexp(H.glog(x.getAt(v)) + H.glog(_.getAt(P))); return W(E, 0); }, mod: function(_) { if (x.getLength() - _.getLength() < 0) return x; - for (var E = H.glog(x.getAt(0)) - H.glog(_.getAt(0)), v = new Array(x.getLength()), M = 0; M < x.getLength(); M += 1) v[M] = x.getAt(M); - for (M = 0; M < _.getLength(); M += 1) v[M] ^= H.gexp(H.glog(_.getAt(M)) + E); + for (var E = H.glog(x.getAt(0)) - H.glog(_.getAt(0)), v = new Array(x.getLength()), P = 0; P < x.getLength(); P += 1) v[P] = x.getAt(P); + for (P = 0; P < _.getLength(); P += 1) v[P] ^= H.gexp(H.glog(_.getAt(P)) + E); return W(v, 0).mod(_); } }; return x; @@ -38841,21 +38927,21 @@ var $9 = { exports: {} }; }, b = { getRSBlocks: function(x, _) { var E = function(Z, J) { switch (J) { - case $.L: + case B.L: return f[4 * (Z - 1) + 0]; - case $.M: + case B.M: return f[4 * (Z - 1) + 1]; - case $.Q: + case B.Q: return f[4 * (Z - 1) + 2]; - case $.H: + case B.H: return f[4 * (Z - 1) + 3]; default: return; } }(x, _); if (E === void 0) throw "bad rs block @ typeNumber:" + x + "/errorCorrectionLevel:" + _; - for (var v = E.length / 3, M = [], I = 0; I < v; I += 1) for (var F = E[3 * I + 0], ce = E[3 * I + 1], D = E[3 * I + 2], oe = 0; oe < F; oe += 1) M.push(g(ce, D)); - return M; + for (var v = E.length / 3, P = [], I = 0; I < v; I += 1) for (var F = E[3 * I + 0], ce = E[3 * I + 1], D = E[3 * I + 2], oe = 0; oe < F; oe += 1) P.push(g(ce, D)); + return P; } }; return b; }(), te = function() { @@ -38879,10 +38965,10 @@ var $9 = { exports: {} }; }, getLength: function(E) { return g.length; }, write: function(E) { - for (var v = g, M = 0; M + 2 < v.length; ) E.put(x(v.substring(M, M + 3)), 10), M += 3; - M < v.length && (v.length - M == 1 ? E.put(x(v.substring(M, M + 1)), 4) : v.length - M == 2 && E.put(x(v.substring(M, M + 2)), 7)); + for (var v = g, P = 0; P + 2 < v.length; ) E.put(x(v.substring(P, P + 3)), 10), P += 3; + P < v.length && (v.length - P == 1 ? E.put(x(v.substring(P, P + 1)), 4) : v.length - P == 2 && E.put(x(v.substring(P, P + 2)), 7)); } }, x = function(E) { - for (var v = 0, M = 0; M < E.length; M += 1) v = 10 * v + _(E.charAt(M)); + for (var v = 0, P = 0; P < E.length; P += 1) v = 10 * v + _(E.charAt(P)); return v; }, _ = function(E) { if ("0" <= E && E <= "9") return E.charCodeAt(0) - 48; @@ -38946,13 +39032,13 @@ var $9 = { exports: {} }; return ~~(b.length / 2); }, write: function(_) { for (var E = b, v = 0; v + 1 < E.length; ) { - var M = (255 & E[v]) << 8 | 255 & E[v + 1]; - if (33088 <= M && M <= 40956) M -= 33088; + var P = (255 & E[v]) << 8 | 255 & E[v + 1]; + if (33088 <= P && P <= 40956) P -= 33088; else { - if (!(57408 <= M && M <= 60351)) throw "illegal char at " + (v + 1) + "/" + M; - M -= 49472; + if (!(57408 <= P && P <= 60351)) throw "illegal char at " + (v + 1) + "/" + P; + P -= 49472; } - M = 192 * (M >>> 8 & 255) + (255 & M), _.put(M, 13), v += 2; + P = 192 * (P >>> 8 & 255) + (255 & P), _.put(P, 13), v += 2; } if (v < E.length) throw "illegal char at " + (v + 1); } }; @@ -38983,34 +39069,34 @@ var $9 = { exports: {} }; if (_ == 0) return -1; throw "unexpected end of file./" + _; } - var M = g.charAt(b); - if (b += 1, M == "=") return _ = 0, -1; - M.match(/^\s$/) || (x = x << 6 | v(M.charCodeAt(0)), _ += 6); + var P = g.charAt(b); + if (b += 1, P == "=") return _ = 0, -1; + P.match(/^\s$/) || (x = x << 6 | v(P.charCodeAt(0)), _ += 6); } var I = x >>> _ - 8 & 255; return _ -= 8, I; - } }, v = function(M) { - if (65 <= M && M <= 90) return M - 65; - if (97 <= M && M <= 122) return M - 97 + 26; - if (48 <= M && M <= 57) return M - 48 + 52; - if (M == 43) return 62; - if (M == 47) return 63; - throw "c:" + M; + } }, v = function(P) { + if (65 <= P && P <= 90) return P - 65; + if (97 <= P && P <= 122) return P - 97 + 26; + if (48 <= P && P <= 57) return P - 48 + 52; + if (P == 43) return 62; + if (P == 47) return 63; + throw "c:" + P; }; return E; }, m = function(f, g, b) { for (var x = function(ce, D) { - var oe = ce, Z = D, J = new Array(ce * D), Q = { setPixel: function(re, pe, ie) { - J[pe * oe + re] = ie; + var oe = ce, Z = D, J = new Array(ce * D), Q = { setPixel: function(re, de, ie) { + J[de * oe + re] = ie; }, write: function(re) { re.writeString("GIF87a"), re.writeShort(oe), re.writeShort(Z), re.writeByte(128), re.writeByte(0), re.writeByte(0), re.writeByte(0), re.writeByte(0), re.writeByte(0), re.writeByte(255), re.writeByte(255), re.writeByte(255), re.writeString(","), re.writeShort(0), re.writeShort(0), re.writeShort(oe), re.writeShort(Z), re.writeByte(0); - var pe = T(2); + var de = T(2); re.writeByte(2); - for (var ie = 0; pe.length - ie > 255; ) re.writeByte(255), re.writeBytes(pe, ie, 255), ie += 255; - re.writeByte(pe.length - ie), re.writeBytes(pe, ie, pe.length - ie), re.writeByte(0), re.writeString(";"); + for (var ie = 0; de.length - ie > 255; ) re.writeByte(255), re.writeBytes(de, ie, 255), ie += 255; + re.writeByte(de.length - ie), re.writeBytes(de, ie, de.length - ie), re.writeByte(0), re.writeString(";"); } }, T = function(re) { - for (var pe = 1 << re, ie = 1 + (1 << re), ue = re + 1, ve = X(), Pe = 0; Pe < pe; Pe += 1) ve.add(String.fromCharCode(Pe)); - ve.add(String.fromCharCode(pe)), ve.add(String.fromCharCode(ie)); + for (var de = 1 << re, ie = 1 + (1 << re), ue = re + 1, ve = X(), Pe = 0; Pe < de; Pe += 1) ve.add(String.fromCharCode(Pe)); + ve.add(String.fromCharCode(de)), ve.add(String.fromCharCode(ie)); var De, Ce, $e, Me = Y(), Ne = (De = Me, Ce = 0, $e = 0, { write: function(ze, _e) { if (ze >>> _e) throw "length over"; for (; Ce + _e >= 8; ) De.writeByte(255 & (ze << Ce | $e)), _e -= 8 - Ce, ze >>>= 8 - Ce, $e = 0, Ce = 0; @@ -39018,7 +39104,7 @@ var $9 = { exports: {} }; }, flush: function() { Ce > 0 && De.writeByte($e); } }); - Ne.write(pe, ue); + Ne.write(de, ue); var Ke = 0, Le = String.fromCharCode(J[Ke]); for (Ke += 1; Ke < J.length; ) { var qe = String.fromCharCode(J[Ke]); @@ -39026,11 +39112,11 @@ var $9 = { exports: {} }; } return Ne.write(ve.indexOf(Le), ue), Ne.write(ie, ue), Ne.flush(), Me.toByteArray(); }, X = function() { - var re = {}, pe = 0, ie = { add: function(ue) { + var re = {}, de = 0, ie = { add: function(ue) { if (ie.contains(ue)) throw "dup key:" + ue; - re[ue] = pe, pe += 1; + re[ue] = de, de += 1; }, size: function() { - return pe; + return de; }, indexOf: function(ue) { return re[ue]; }, contains: function(ue) { @@ -39042,7 +39128,7 @@ var $9 = { exports: {} }; }(f, g), _ = 0; _ < g; _ += 1) for (var E = 0; E < f; E += 1) x.setPixel(E, _, b(E, _)); var v = Y(); x.write(v); - for (var M = function() { + for (var P = function() { var ce = 0, D = 0, oe = 0, Z = "", J = {}, Q = function(X) { Z += String.fromCharCode(T(63 & X)); }, T = function(X) { @@ -39062,16 +39148,16 @@ var $9 = { exports: {} }; }, J.toString = function() { return Z; }, J; - }(), I = v.toByteArray(), F = 0; F < I.length; F += 1) M.writeByte(I[F]); - return M.flush(), "data:image/gif;base64," + M; + }(), I = v.toByteArray(), F = 0; F < I.length; F += 1) P.writeByte(I[F]); + return P.flush(), "data:image/gif;base64," + P; }; return p; }(); d.stringToBytesFuncs["UTF-8"] = function(p) { return function(w) { - for (var A = [], P = 0; P < w.length; P++) { - var N = w.charCodeAt(P); - N < 128 ? A.push(N) : N < 2048 ? A.push(192 | N >> 6, 128 | 63 & N) : N < 55296 || N >= 57344 ? A.push(224 | N >> 12, 128 | N >> 6 & 63, 128 | 63 & N) : (P++, N = 65536 + ((1023 & N) << 10 | 1023 & w.charCodeAt(P)), A.push(240 | N >> 18, 128 | N >> 12 & 63, 128 | N >> 6 & 63, 128 | 63 & N)); + for (var A = [], M = 0; M < w.length; M++) { + var N = w.charCodeAt(M); + N < 128 ? A.push(N) : N < 2048 ? A.push(192 | N >> 6, 128 | 63 & N) : N < 55296 || N >= 57344 ? A.push(224 | N >> 12, 128 | N >> 6 & 63, 128 | 63 & N) : (M++, N = 65536 + ((1023 & N) << 10 | 1023 & w.charCodeAt(M)), A.push(240 | N >> 18, 128 | N >> 12 & 63, 128 | N >> 6 & 63, 128 | 63 & N)); } return A; }(p); @@ -39183,14 +39269,14 @@ var $9 = { exports: {} }; this._basicSquare({ x: m, y: f, size: g, rotation: 0 }); } _drawRounded({ x: m, y: f, size: g, getNeighbor: b }) { - const x = b ? +b(-1, 0) : 0, _ = b ? +b(1, 0) : 0, E = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0, M = x + _ + E + v; - if (M !== 0) if (M > 2 || x && _ || E && v) this._basicSquare({ x: m, y: f, size: g, rotation: 0 }); + const x = b ? +b(-1, 0) : 0, _ = b ? +b(1, 0) : 0, E = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0, P = x + _ + E + v; + if (P !== 0) if (P > 2 || x && _ || E && v) this._basicSquare({ x: m, y: f, size: g, rotation: 0 }); else { - if (M === 2) { + if (P === 2) { let I = 0; return x && E ? I = Math.PI / 2 : E && _ ? I = Math.PI : _ && v && (I = -Math.PI / 2), void this._basicCornerRounded({ x: m, y: f, size: g, rotation: I }); } - if (M === 1) { + if (P === 1) { let I = 0; return E ? I = Math.PI / 2 : _ ? I = Math.PI : v && (I = -Math.PI / 2), void this._basicSideRounded({ x: m, y: f, size: g, rotation: I }); } @@ -39198,14 +39284,14 @@ var $9 = { exports: {} }; else this._basicDot({ x: m, y: f, size: g, rotation: 0 }); } _drawExtraRounded({ x: m, y: f, size: g, getNeighbor: b }) { - const x = b ? +b(-1, 0) : 0, _ = b ? +b(1, 0) : 0, E = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0, M = x + _ + E + v; - if (M !== 0) if (M > 2 || x && _ || E && v) this._basicSquare({ x: m, y: f, size: g, rotation: 0 }); + const x = b ? +b(-1, 0) : 0, _ = b ? +b(1, 0) : 0, E = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0, P = x + _ + E + v; + if (P !== 0) if (P > 2 || x && _ || E && v) this._basicSquare({ x: m, y: f, size: g, rotation: 0 }); else { - if (M === 2) { + if (P === 2) { let I = 0; return x && E ? I = Math.PI / 2 : E && _ ? I = Math.PI : _ && v && (I = -Math.PI / 2), void this._basicCornerExtraRounded({ x: m, y: f, size: g, rotation: I }); } - if (M === 1) { + if (P === 1) { let I = 0; return E ? I = Math.PI / 2 : _ ? I = Math.PI : v && (I = -Math.PI / 2), void this._basicSideRounded({ x: m, y: f, size: g, rotation: I }); } @@ -39304,7 +39390,7 @@ var $9 = { exports: {} }; this._basicSquare({ x: m, y: f, size: g, rotation: b }); } } - const A = "circle", P = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]], N = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]; + const A = "circle", M = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]], N = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]; class L { constructor(m, f) { this._roundSize = (g) => this._options.dotsOptions.roundSize ? Math.floor(g) : g, this._window = f, this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._element.setAttribute("width", String(m.width)), this._element.setAttribute("height", String(m.height)), this._element.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), m.dotsOptions.roundSize || this._element.setAttribute("shape-rendering", "crispEdges"), this._element.setAttribute("viewBox", `0 0 ${m.width} ${m.height}`), this._defs = this._window.document.createElementNS("http://www.w3.org/2000/svg", "defs"), this._element.appendChild(this._defs), this._imageUri = m.image, this._instanceId = L.instanceCount++, this._options = m; @@ -39323,7 +39409,7 @@ var $9 = { exports: {} }; let _ = { hideXDots: 0, hideYDots: 0, width: 0, height: 0 }; if (this._qr = m, this._options.image) { if (await this.loadImage(), !this._image) return; - const { imageOptions: E, qrOptions: v } = this._options, M = E.imageSize * l[v.errorCorrectionLevel], I = Math.floor(M * f * f); + const { imageOptions: E, qrOptions: v } = this._options, P = E.imageSize * l[v.errorCorrectionLevel], I = Math.floor(P * f * f); _ = function({ originalHeight: F, originalWidth: ce, maxHiddenDots: D, maxHiddenAxisDots: oe, dotSize: Z }) { const J = { x: 0, y: 0 }, Q = { x: 0, y: 0 }; if (F <= 0 || ce <= 0 || D <= 0 || Z <= 0) return { height: 0, width: 0, hideYDots: 0, hideXDots: 0 }; @@ -39332,8 +39418,8 @@ var $9 = { exports: {} }; }({ originalWidth: this._image.width, originalHeight: this._image.height, maxHiddenDots: I, maxHiddenAxisDots: f - 14, dotSize: x }); } this.drawBackground(), this.drawDots((E, v) => { - var M, I, F, ce, D, oe; - return !(this._options.imageOptions.hideBackgroundDots && E >= (f - _.hideYDots) / 2 && E < (f + _.hideYDots) / 2 && v >= (f - _.hideXDots) / 2 && v < (f + _.hideXDots) / 2 || !((M = P[E]) === null || M === void 0) && M[v] || !((I = P[E - f + 7]) === null || I === void 0) && I[v] || !((F = P[E]) === null || F === void 0) && F[v - f + 7] || !((ce = N[E]) === null || ce === void 0) && ce[v] || !((D = N[E - f + 7]) === null || D === void 0) && D[v] || !((oe = N[E]) === null || oe === void 0) && oe[v - f + 7]); + var P, I, F, ce, D, oe; + return !(this._options.imageOptions.hideBackgroundDots && E >= (f - _.hideYDots) / 2 && E < (f + _.hideYDots) / 2 && v >= (f - _.hideXDots) / 2 && v < (f + _.hideXDots) / 2 || !((P = M[E]) === null || P === void 0) && P[v] || !((I = M[E - f + 7]) === null || I === void 0) && I[v] || !((F = M[E]) === null || F === void 0) && F[v - f + 7] || !((ce = N[E]) === null || ce === void 0) && ce[v] || !((D = N[E - f + 7]) === null || D === void 0) && D[v] || !((oe = N[E]) === null || oe === void 0) && oe[v - f + 7]); }), this.drawCorners(), this._options.image && await this.drawImage({ width: _.width, height: _.height, count: f, dotSize: x }); } drawBackground() { @@ -39341,10 +39427,10 @@ var $9 = { exports: {} }; const b = this._element, x = this._options; if (b) { const _ = (m = x.backgroundOptions) === null || m === void 0 ? void 0 : m.gradient, E = (f = x.backgroundOptions) === null || f === void 0 ? void 0 : f.color; - let v = x.height, M = x.width; + let v = x.height, P = x.width; if (_ || E) { const I = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"); - this._backgroundClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._backgroundClipPath.setAttribute("id", `clip-path-background-color-${this._instanceId}`), this._defs.appendChild(this._backgroundClipPath), !((g = x.backgroundOptions) === null || g === void 0) && g.round && (v = M = Math.min(x.width, x.height), I.setAttribute("rx", String(v / 2 * x.backgroundOptions.round))), I.setAttribute("x", String(this._roundSize((x.width - M) / 2))), I.setAttribute("y", String(this._roundSize((x.height - v) / 2))), I.setAttribute("width", String(M)), I.setAttribute("height", String(v)), this._backgroundClipPath.appendChild(I), this._createColor({ options: _, color: E, additionalRotation: 0, x: 0, y: 0, height: x.height, width: x.width, name: `background-color-${this._instanceId}` }); + this._backgroundClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._backgroundClipPath.setAttribute("id", `clip-path-background-color-${this._instanceId}`), this._defs.appendChild(this._backgroundClipPath), !((g = x.backgroundOptions) === null || g === void 0) && g.round && (v = P = Math.min(x.width, x.height), I.setAttribute("rx", String(v / 2 * x.backgroundOptions.round))), I.setAttribute("x", String(this._roundSize((x.width - P) / 2))), I.setAttribute("y", String(this._roundSize((x.height - v) / 2))), I.setAttribute("width", String(P)), I.setAttribute("height", String(v)), this._backgroundClipPath.appendChild(I), this._createColor({ options: _, color: E, additionalRotation: 0, x: 0, y: 0, height: x.height, width: x.width, name: `background-color-${this._instanceId}` }); } } } @@ -39353,18 +39439,18 @@ var $9 = { exports: {} }; if (!this._qr) throw "QR code is not defined"; const b = this._options, x = this._qr.getModuleCount(); if (x > b.width || x > b.height) throw "The canvas is too small."; - const _ = Math.min(b.width, b.height) - 2 * b.margin, E = b.shape === A ? _ / Math.sqrt(2) : _, v = this._roundSize(E / x), M = this._roundSize((b.width - x * v) / 2), I = this._roundSize((b.height - x * v) / 2), F = new d({ svg: this._element, type: b.dotsOptions.type, window: this._window }); + const _ = Math.min(b.width, b.height) - 2 * b.margin, E = b.shape === A ? _ / Math.sqrt(2) : _, v = this._roundSize(E / x), P = this._roundSize((b.width - x * v) / 2), I = this._roundSize((b.height - x * v) / 2), F = new d({ svg: this._element, type: b.dotsOptions.type, window: this._window }); this._dotsClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._dotsClipPath.setAttribute("id", `clip-path-dot-color-${this._instanceId}`), this._defs.appendChild(this._dotsClipPath), this._createColor({ options: (f = b.dotsOptions) === null || f === void 0 ? void 0 : f.gradient, color: b.dotsOptions.color, additionalRotation: 0, x: 0, y: 0, height: b.height, width: b.width, name: `dot-color-${this._instanceId}` }); - for (let ce = 0; ce < x; ce++) for (let D = 0; D < x; D++) m && !m(ce, D) || !((g = this._qr) === null || g === void 0) && g.isDark(ce, D) && (F.draw(M + D * v, I + ce * v, v, (oe, Z) => !(D + oe < 0 || ce + Z < 0 || D + oe >= x || ce + Z >= x) && !(m && !m(ce + Z, D + oe)) && !!this._qr && this._qr.isDark(ce + Z, D + oe)), F._element && this._dotsClipPath && this._dotsClipPath.appendChild(F._element)); + for (let ce = 0; ce < x; ce++) for (let D = 0; D < x; D++) m && !m(ce, D) || !((g = this._qr) === null || g === void 0) && g.isDark(ce, D) && (F.draw(P + D * v, I + ce * v, v, (oe, Z) => !(D + oe < 0 || ce + Z < 0 || D + oe >= x || ce + Z >= x) && !(m && !m(ce + Z, D + oe)) && !!this._qr && this._qr.isDark(ce + Z, D + oe)), F._element && this._dotsClipPath && this._dotsClipPath.appendChild(F._element)); if (b.shape === A) { - const ce = this._roundSize((_ / v - x) / 2), D = x + 2 * ce, oe = M - ce * v, Z = I - ce * v, J = [], Q = this._roundSize(D / 2); + const ce = this._roundSize((_ / v - x) / 2), D = x + 2 * ce, oe = P - ce * v, Z = I - ce * v, J = [], Q = this._roundSize(D / 2); for (let T = 0; T < D; T++) { J[T] = []; for (let X = 0; X < D; X++) T >= ce - 1 && T <= D - ce && X >= ce - 1 && X <= D - ce || Math.sqrt((T - Q) * (T - Q) + (X - Q) * (X - Q)) > Q ? J[T][X] = 0 : J[T][X] = this._qr.isDark(X - 2 * ce < 0 ? X : X >= x ? X - 2 * ce : X - ce, T - 2 * ce < 0 ? T : T >= x ? T - 2 * ce : T - ce) ? 1 : 0; } - for (let T = 0; T < D; T++) for (let X = 0; X < D; X++) J[T][X] && (F.draw(oe + X * v, Z + T * v, v, (re, pe) => { + for (let T = 0; T < D; T++) for (let X = 0; X < D; X++) J[T][X] && (F.draw(oe + X * v, Z + T * v, v, (re, de) => { var ie; - return !!(!((ie = J[T + pe]) === null || ie === void 0) && ie[X + re]); + return !!(!((ie = J[T + de]) === null || ie === void 0) && ie[X + re]); }), F._element && this._dotsClipPath && this._dotsClipPath.appendChild(F._element)); } } @@ -39372,22 +39458,22 @@ var $9 = { exports: {} }; if (!this._qr) throw "QR code is not defined"; const m = this._element, f = this._options; if (!m) throw "Element code is not defined"; - const g = this._qr.getModuleCount(), b = Math.min(f.width, f.height) - 2 * f.margin, x = f.shape === A ? b / Math.sqrt(2) : b, _ = this._roundSize(x / g), E = 7 * _, v = 3 * _, M = this._roundSize((f.width - g * _) / 2), I = this._roundSize((f.height - g * _) / 2); + const g = this._qr.getModuleCount(), b = Math.min(f.width, f.height) - 2 * f.margin, x = f.shape === A ? b / Math.sqrt(2) : b, _ = this._roundSize(x / g), E = 7 * _, v = 3 * _, P = this._roundSize((f.width - g * _) / 2), I = this._roundSize((f.height - g * _) / 2); [[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach(([F, ce, D]) => { - var oe, Z, J, Q, T, X, re, pe, ie, ue, ve, Pe; - const De = M + F * _ * (g - 7), Ce = I + ce * _ * (g - 7); + var oe, Z, J, Q, T, X, re, de, ie, ue, ve, Pe; + const De = P + F * _ * (g - 7), Ce = I + ce * _ * (g - 7); let $e = this._dotsClipPath, Me = this._dotsClipPath; if ((!((oe = f.cornersSquareOptions) === null || oe === void 0) && oe.gradient || !((Z = f.cornersSquareOptions) === null || Z === void 0) && Z.color) && ($e = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), $e.setAttribute("id", `clip-path-corners-square-color-${F}-${ce}-${this._instanceId}`), this._defs.appendChild($e), this._cornersSquareClipPath = this._cornersDotClipPath = Me = $e, this._createColor({ options: (J = f.cornersSquareOptions) === null || J === void 0 ? void 0 : J.gradient, color: (Q = f.cornersSquareOptions) === null || Q === void 0 ? void 0 : Q.color, additionalRotation: D, x: De, y: Ce, height: E, width: E, name: `corners-square-color-${F}-${ce}-${this._instanceId}` })), (T = f.cornersSquareOptions) === null || T === void 0 ? void 0 : T.type) { const Ne = new p({ svg: this._element, type: f.cornersSquareOptions.type, window: this._window }); Ne.draw(De, Ce, E, D), Ne._element && $e && $e.appendChild(Ne._element); } else { const Ne = new d({ svg: this._element, type: f.dotsOptions.type, window: this._window }); - for (let Ke = 0; Ke < P.length; Ke++) for (let Le = 0; Le < P[Ke].length; Le++) !((X = P[Ke]) === null || X === void 0) && X[Le] && (Ne.draw(De + Le * _, Ce + Ke * _, _, (qe, ze) => { + for (let Ke = 0; Ke < M.length; Ke++) for (let Le = 0; Le < M[Ke].length; Le++) !((X = M[Ke]) === null || X === void 0) && X[Le] && (Ne.draw(De + Le * _, Ce + Ke * _, _, (qe, ze) => { var _e; - return !!(!((_e = P[Ke + ze]) === null || _e === void 0) && _e[Le + qe]); + return !!(!((_e = M[Ke + ze]) === null || _e === void 0) && _e[Le + qe]); }), Ne._element && $e && $e.appendChild(Ne._element)); } - if ((!((re = f.cornersDotOptions) === null || re === void 0) && re.gradient || !((pe = f.cornersDotOptions) === null || pe === void 0) && pe.color) && (Me = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), Me.setAttribute("id", `clip-path-corners-dot-color-${F}-${ce}-${this._instanceId}`), this._defs.appendChild(Me), this._cornersDotClipPath = Me, this._createColor({ options: (ie = f.cornersDotOptions) === null || ie === void 0 ? void 0 : ie.gradient, color: (ue = f.cornersDotOptions) === null || ue === void 0 ? void 0 : ue.color, additionalRotation: D, x: De + 2 * _, y: Ce + 2 * _, height: v, width: v, name: `corners-dot-color-${F}-${ce}-${this._instanceId}` })), (ve = f.cornersDotOptions) === null || ve === void 0 ? void 0 : ve.type) { + if ((!((re = f.cornersDotOptions) === null || re === void 0) && re.gradient || !((de = f.cornersDotOptions) === null || de === void 0) && de.color) && (Me = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), Me.setAttribute("id", `clip-path-corners-dot-color-${F}-${ce}-${this._instanceId}`), this._defs.appendChild(Me), this._cornersDotClipPath = Me, this._createColor({ options: (ie = f.cornersDotOptions) === null || ie === void 0 ? void 0 : ie.gradient, color: (ue = f.cornersDotOptions) === null || ue === void 0 ? void 0 : ue.color, additionalRotation: D, x: De + 2 * _, y: Ce + 2 * _, height: v, width: v, name: `corners-dot-color-${F}-${ce}-${this._instanceId}` })), (ve = f.cornersDotOptions) === null || ve === void 0 ? void 0 : ve.type) { const Ne = new w({ svg: this._element, type: f.cornersDotOptions.type, window: this._window }); Ne.draw(De + 2 * _, Ce + 2 * _, v, D), Ne._element && Me && Me.appendChild(Ne._element); } else { @@ -39417,13 +39503,13 @@ var $9 = { exports: {} }; typeof b.imageOptions.crossOrigin == "string" && (x.crossOrigin = b.imageOptions.crossOrigin), this._image = x, x.onload = async () => { this._options.imageOptions.saveAsBlob && (this._imageUri = await async function(_, E) { return new Promise((v) => { - const M = new E.XMLHttpRequest(); - M.onload = function() { + const P = new E.XMLHttpRequest(); + P.onload = function() { const I = new E.FileReader(); I.onloadend = function() { v(I.result); - }, I.readAsDataURL(M.response); - }, M.open("GET", _), M.responseType = "blob", M.send(); + }, I.readAsDataURL(P.response); + }, P.open("GET", _), P.responseType = "blob", P.send(); }); }(b.image || "", this._window)), m(); }, x.src = b.image; @@ -39431,14 +39517,14 @@ var $9 = { exports: {} }; }); } async drawImage({ width: m, height: f, count: g, dotSize: b }) { - const x = this._options, _ = this._roundSize((x.width - g * b) / 2), E = this._roundSize((x.height - g * b) / 2), v = _ + this._roundSize(x.imageOptions.margin + (g * b - m) / 2), M = E + this._roundSize(x.imageOptions.margin + (g * b - f) / 2), I = m - 2 * x.imageOptions.margin, F = f - 2 * x.imageOptions.margin, ce = this._window.document.createElementNS("http://www.w3.org/2000/svg", "image"); - ce.setAttribute("href", this._imageUri || ""), ce.setAttribute("x", String(v)), ce.setAttribute("y", String(M)), ce.setAttribute("width", `${I}px`), ce.setAttribute("height", `${F}px`), this._element.appendChild(ce); + const x = this._options, _ = this._roundSize((x.width - g * b) / 2), E = this._roundSize((x.height - g * b) / 2), v = _ + this._roundSize(x.imageOptions.margin + (g * b - m) / 2), P = E + this._roundSize(x.imageOptions.margin + (g * b - f) / 2), I = m - 2 * x.imageOptions.margin, F = f - 2 * x.imageOptions.margin, ce = this._window.document.createElementNS("http://www.w3.org/2000/svg", "image"); + ce.setAttribute("href", this._imageUri || ""), ce.setAttribute("x", String(v)), ce.setAttribute("y", String(P)), ce.setAttribute("width", `${I}px`), ce.setAttribute("height", `${F}px`), this._element.appendChild(ce); } _createColor({ options: m, color: f, additionalRotation: g, x: b, y: x, height: _, width: E, name: v }) { - const M = E > _ ? E : _, I = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"); + const P = E > _ ? E : _, I = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"); if (I.setAttribute("x", String(b)), I.setAttribute("y", String(x)), I.setAttribute("height", String(_)), I.setAttribute("width", String(E)), I.setAttribute("clip-path", `url('#clip-path-${v}')`), m) { let F; - if (m.type === "radial") F = this._window.document.createElementNS("http://www.w3.org/2000/svg", "radialGradient"), F.setAttribute("id", v), F.setAttribute("gradientUnits", "userSpaceOnUse"), F.setAttribute("fx", String(b + E / 2)), F.setAttribute("fy", String(x + _ / 2)), F.setAttribute("cx", String(b + E / 2)), F.setAttribute("cy", String(x + _ / 2)), F.setAttribute("r", String(M / 2)); + if (m.type === "radial") F = this._window.document.createElementNS("http://www.w3.org/2000/svg", "radialGradient"), F.setAttribute("id", v), F.setAttribute("gradientUnits", "userSpaceOnUse"), F.setAttribute("fx", String(b + E / 2)), F.setAttribute("fy", String(x + _ / 2)), F.setAttribute("cx", String(b + E / 2)), F.setAttribute("cy", String(x + _ / 2)), F.setAttribute("r", String(P / 2)); else { const ce = ((m.rotation || 0) + g) % (2 * Math.PI), D = (ce + 2 * Math.PI) % (2 * Math.PI); let oe = b + E / 2, Z = x + _ / 2, J = b + E / 2, Q = x + _ / 2; @@ -39453,9 +39539,9 @@ var $9 = { exports: {} }; } } L.instanceCount = 0; - const $ = L, B = "canvas", H = {}; + const B = L, $ = "canvas", H = {}; for (let S = 0; S <= 40; S++) H[S] = S; - const W = { type: B, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: H[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: !0, hideBackgroundDots: !0, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: !0 }, backgroundOptions: { round: 0, color: "#fff" } }; + const W = { type: $, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: H[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: !0, hideBackgroundDots: !0, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: !0 }, backgroundOptions: { round: 0, color: "#fff" } }; function V(S) { const m = Object.assign({}, S); if (!m.colorStops || !m.colorStops.length) throw "Field 'colorStops' is required in gradient"; @@ -39482,7 +39568,7 @@ var $9 = { exports: {} }; } _setupSvg() { if (!this._qr) return; - const m = new $(this._options, this._window); + const m = new B(this._options, this._window); this._svg = m.getElement(), this._svgDrawingPromise = m.drawQR(this._qr).then(() => { var f; this._svg && ((f = this._extension) === null || f === void 0 || f.call(this, m.getElement(), this._options)); @@ -39495,15 +39581,15 @@ var $9 = { exports: {} }; if (!this._svg) return; const b = this._svg, x = new this._window.XMLSerializer().serializeToString(b), _ = btoa(x), E = `data:${ge("svg")};base64,${_}`; if (!((g = this._options.nodeCanvas) === null || g === void 0) && g.loadImage) return this._options.nodeCanvas.loadImage(E).then((v) => { - var M, I; - v.width = this._options.width, v.height = this._options.height, (I = (M = this._nodeCanvas) === null || M === void 0 ? void 0 : M.getContext("2d")) === null || I === void 0 || I.drawImage(v, 0, 0); + var P, I; + v.width = this._options.width, v.height = this._options.height, (I = (P = this._nodeCanvas) === null || P === void 0 ? void 0 : P.getContext("2d")) === null || I === void 0 || I.drawImage(v, 0, 0); }); { const v = new this._window.Image(); - return new Promise((M) => { + return new Promise((P) => { v.onload = () => { var I, F; - (F = (I = this._domCanvas) === null || I === void 0 ? void 0 : I.getContext("2d")) === null || F === void 0 || F.drawImage(v, 0, 0), M(); + (F = (I = this._domCanvas) === null || I === void 0 ? void 0 : I.getContext("2d")) === null || F === void 0 || F.drawImage(v, 0, 0), P(); }, v.src = E; }); } @@ -39523,12 +39609,12 @@ var $9 = { exports: {} }; default: return "Byte"; } - }(this._options.data)), this._qr.make(), this._options.type === B ? this._setupCanvas() : this._setupSvg(), this.append(this._container)); + }(this._options.data)), this._qr.make(), this._options.type === $ ? this._setupCanvas() : this._setupSvg(), this.append(this._container)); } append(m) { if (m) { if (typeof m.appendChild != "function") throw "Container should be a single DOM node"; - this._options.type === B ? this._domCanvas && m.appendChild(this._domCanvas) : this._svg && m.appendChild(this._svg), this._container = m; + this._options.type === $ ? this._domCanvas && m.appendChild(this._domCanvas) : this._svg && m.appendChild(this._svg), this._container = m; } } applyExtension(m) { @@ -39574,10 +39660,10 @@ ${new this._window.XMLSerializer().serializeToString(f)}`; const Y = Ee; })(), s.default; })()); -})($9); -var Une = $9.exports; -const B9 = /* @__PURE__ */ rs(Une); -class aa extends yt { +})(B9); +var Hne = B9.exports; +const F9 = /* @__PURE__ */ ts(Hne); +class sa extends yt { constructor(e) { const { docsPath: r, field: n, metaMessages: i } = e; super(`Invalid Sign-In with Ethereum message field "${n}".`, { @@ -39587,10 +39673,10 @@ class aa extends yt { }); } } -function h5(t) { +function f5(t) { if (/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t) || /%[^0-9a-f]/i.test(t) || /%[0-9a-f](:?[^0-9a-f]|$)/i.test(t)) return !1; - const e = qne(t), r = e[1], n = e[2], i = e[3], s = e[4], o = e[5]; + const e = Kne(t), r = e[1], n = e[2], i = e[3], s = e[4], o = e[5]; if (!(r != null && r.length && i.length >= 0)) return !1; if (n != null && n.length) { @@ -39603,14 +39689,14 @@ function h5(t) { let a = ""; return a += `${r}:`, n != null && n.length && (a += `//${n}`), a += i, s != null && s.length && (a += `?${s}`), o != null && o.length && (a += `#${o}`), a; } -function qne(t) { +function Kne(t) { return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/); } -function F9(t) { +function j9(t) { const { chainId: e, domain: r, expirationTime: n, issuedAt: i = /* @__PURE__ */ new Date(), nonce: s, notBefore: o, requestId: a, resources: u, scheme: l, uri: d, version: p } = t; { if (e !== Math.floor(e)) - throw new aa({ + throw new sa({ field: "chainId", metaMessages: [ "- Chain ID must be a EIP-155 chain ID.", @@ -39619,8 +39705,8 @@ function F9(t) { `Provided value: ${e}` ] }); - if (!(zne.test(r) || Wne.test(r) || Hne.test(r))) - throw new aa({ + if (!(Vne.test(r) || Gne.test(r) || Yne.test(r))) + throw new sa({ field: "domain", metaMessages: [ "- Domain must be an RFC 3986 authority.", @@ -39629,8 +39715,8 @@ function F9(t) { `Provided value: ${r}` ] }); - if (!Kne.test(s)) - throw new aa({ + if (!Jne.test(s)) + throw new sa({ field: "nonce", metaMessages: [ "- Nonce must be at least 8 characters.", @@ -39639,8 +39725,8 @@ function F9(t) { `Provided value: ${s}` ] }); - if (!h5(d)) - throw new aa({ + if (!f5(d)) + throw new sa({ field: "uri", metaMessages: [ "- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.", @@ -39650,7 +39736,7 @@ function F9(t) { ] }); if (p !== "1") - throw new aa({ + throw new sa({ field: "version", metaMessages: [ "- Version must be '1'.", @@ -39658,8 +39744,8 @@ function F9(t) { `Provided value: ${p}` ] }); - if (l && !Vne.test(l)) - throw new aa({ + if (l && !Xne.test(l)) + throw new sa({ field: "scheme", metaMessages: [ "- Scheme must be an RFC 3986 URI scheme.", @@ -39668,23 +39754,23 @@ function F9(t) { `Provided value: ${l}` ] }); - const $ = t.statement; - if ($ != null && $.includes(` + const B = t.statement; + if (B != null && B.includes(` `)) - throw new aa({ + throw new sa({ field: "statement", metaMessages: [ "- Statement must not include '\\n'.", "", - `Provided value: ${$}` + `Provided value: ${B}` ] }); } - const w = Ev(t.address), A = l ? `${l}://${r}` : r, P = t.statement ? `${t.statement} + const w = Ev(t.address), A = l ? `${l}://${r}` : r, M = t.statement ? `${t.statement} ` : "", N = `${A} wants you to sign in with your Ethereum account: ${w} -${P}`; +${M}`; let L = `URI: ${d} Version: ${p} Chain ID: ${e} @@ -39694,36 +39780,36 @@ Issued At: ${i.toISOString()}`; Expiration Time: ${n.toISOString()}`), o && (L += ` Not Before: ${o.toISOString()}`), a && (L += ` Request ID: ${a}`), u) { - let $ = ` + let B = ` Resources:`; - for (const B of u) { - if (!h5(B)) - throw new aa({ + for (const $ of u) { + if (!f5($)) + throw new sa({ field: "resources", metaMessages: [ "- Every resource must be a RFC 3986 URI.", "- See https://www.rfc-editor.org/rfc/rfc3986", "", - `Provided value: ${B}` + `Provided value: ${$}` ] }); - $ += ` -- ${B}`; + B += ` +- ${$}`; } - L += $; + L += B; } return `${N} ${L}`; } -const zne = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/, Wne = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/, Hne = /^localhost(:[0-9]{1,5})?$/, Kne = /^[a-zA-Z0-9]{8,}$/, Vne = /^([a-zA-Z][a-zA-Z0-9+-.]*)$/, j9 = "7a4434fefbcc9af474fb5c995e47d286", Gne = { - projectId: j9, +const Vne = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/, Gne = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/, Yne = /^localhost(:[0-9]{1,5})?$/, Jne = /^[a-zA-Z0-9]{8,}$/, Xne = /^([a-zA-Z][a-zA-Z0-9+-.]*)$/, U9 = "7a4434fefbcc9af474fb5c995e47d286", Zne = { + projectId: U9, metadata: { name: "codatta", description: "codatta", url: "https://codatta.io/", icons: ["https://avatars.githubusercontent.com/u/171659315"] } -}, Yne = { +}, Qne = { namespaces: { eip155: { methods: [ @@ -39736,15 +39822,15 @@ const zne = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0- chains: ["eip155:1"], events: ["chainChanged", "accountsChanged", "disconnect"], rpcMap: { - 1: `https://rpc.walletconnect.com?chainId=eip155:1&projectId=${j9}` + 1: `https://rpc.walletconnect.com?chainId=eip155:1&projectId=${U9}` } } }, skipPairing: !1 }; -function Jne(t, e) { +function eie(t, e) { const r = window.location.host, n = window.location.href; - return F9({ + return j9({ address: t, chainId: 1, domain: r, @@ -39753,13 +39839,13 @@ function Jne(t, e) { version: "1" }); } -function U9(t) { +function q9(t) { var ge, Ee, Y; - const e = oi(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Gt(""), [a, u] = Gt(!1), [l, d] = Gt(""), [p, w] = Gt("scan"), A = oi(), [P, N] = Gt((ge = r.config) == null ? void 0 : ge.image), [L, $] = Gt(!1), { saveLastUsedWallet: B } = mp(); + const e = Un(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Qt(""), [a, u] = Qt(!1), [l, d] = Qt(""), [p, w] = Qt("scan"), A = Un(), [M, N] = Qt((ge = r.config) == null ? void 0 : ge.image), [L, B] = Qt(!1), { saveLastUsedWallet: $ } = mp(); async function H(S) { var f, g, b, x; u(!0); - const m = await FG.init(Gne); + const m = await jG.init(Zne); m.session && await m.disconnect(); try { if (w("scan"), m.on("display_uri", (ce) => { @@ -39768,27 +39854,27 @@ function U9(t) { console.log(ce); }), m.on("session_update", (ce) => { console.log("session_update", ce); - }), !await m.connect(Yne)) throw new Error("Walletconnect init failed"); + }), !await m.connect(Qne)) throw new Error("Walletconnect init failed"); const E = new vl(m); N(((f = E.config) == null ? void 0 : f.image) || ((g = S.config) == null ? void 0 : g.image)); - const v = await E.getAddress(), M = await qo.getNonce({ account_type: "block_chain" }); - console.log("get nonce", M); - const I = Jne(v, M); + const v = await E.getAddress(), P = await Ta.getNonce({ account_type: "block_chain" }); + console.log("get nonce", P); + const I = eie(v, P); w("sign"); const F = await E.signMessage(I, v); w("waiting"), await i(E, { message: I, - nonce: M, + nonce: P, signature: F, address: v, wallet_name: ((b = E.config) == null ? void 0 : b.name) || ((x = S.config) == null ? void 0 : x.name) || "" - }), B(E); + }), $(E); } catch (_) { console.log("err", _), d(_.details || _.message); } } function W() { - A.current = new B9({ + A.current = new F9({ width: 264, height: 264, margin: 0, @@ -39823,8 +39909,8 @@ function U9(t) { d(""), V(""), H(r); } function R() { - $(!0), navigator.clipboard.writeText(s), setTimeout(() => { - $(!1); + B(!0), navigator.clipboard.writeText(s), setTimeout(() => { + B(!1); }, 2500); } function K() { @@ -39834,67 +39920,67 @@ function U9(t) { const m = `${S}?uri=${encodeURIComponent(s)}`; window.open(m, "_blank"); } - return /* @__PURE__ */ fe.jsxs("div", { children: [ - /* @__PURE__ */ fe.jsx("div", { className: "xc-text-center", children: /* @__PURE__ */ fe.jsxs("div", { className: "xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1", children: [ - /* @__PURE__ */ fe.jsx("div", { className: "xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center", ref: e }), - /* @__PURE__ */ fe.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: a ? /* @__PURE__ */ fe.jsx(_a, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ fe.jsx("img", { className: "xc-h-10 xc-w-10", src: P }) }) + return /* @__PURE__ */ pe.jsxs("div", { children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-text-center", children: /* @__PURE__ */ pe.jsxs("div", { className: "xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1", children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center", ref: e }), + /* @__PURE__ */ pe.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: a ? /* @__PURE__ */ pe.jsx(mc, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ pe.jsx("img", { className: "xc-h-10 xc-w-10", src: M }) }) ] }) }), - /* @__PURE__ */ fe.jsxs("div", { className: "xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3", children: [ - /* @__PURE__ */ fe.jsx( + /* @__PURE__ */ pe.jsxs("div", { className: "xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3", children: [ + /* @__PURE__ */ pe.jsx( "button", { disabled: !s, onClick: R, className: "xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent", - children: L ? /* @__PURE__ */ fe.jsxs(fe.Fragment, { children: [ + children: L ? /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ " ", - /* @__PURE__ */ fe.jsx(hZ, {}), + /* @__PURE__ */ pe.jsx(dZ, {}), " Copied!" - ] }) : /* @__PURE__ */ fe.jsxs(fe.Fragment, { children: [ - /* @__PURE__ */ fe.jsx(gZ, {}), + ] }) : /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ + /* @__PURE__ */ pe.jsx(mZ, {}), "Copy QR URL" ] }) } ), - ((Ee = r.config) == null ? void 0 : Ee.getWallet) && /* @__PURE__ */ fe.jsxs( + ((Ee = r.config) == null ? void 0 : Ee.getWallet) && /* @__PURE__ */ pe.jsxs( "button", { className: "xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black", onClick: n, children: [ - /* @__PURE__ */ fe.jsx(dZ, {}), + /* @__PURE__ */ pe.jsx(pZ, {}), "Get Extension" ] } ), - ((Y = r.config) == null ? void 0 : Y.desktop_link) && /* @__PURE__ */ fe.jsxs( + ((Y = r.config) == null ? void 0 : Y.desktop_link) && /* @__PURE__ */ pe.jsxs( "button", { disabled: !s, className: "xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black", onClick: K, children: [ - /* @__PURE__ */ fe.jsx(KS, {}), + /* @__PURE__ */ pe.jsx(HS, {}), "Desktop" ] } ) ] }), - /* @__PURE__ */ fe.jsx("div", { className: "xc-text-center", children: l ? /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ - /* @__PURE__ */ fe.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: l }), - /* @__PURE__ */ fe.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: te, children: "Retry" }) - ] }) : /* @__PURE__ */ fe.jsxs(fe.Fragment, { children: [ - p === "scan" && /* @__PURE__ */ fe.jsx("p", { children: "Scan this QR code from your mobile wallet or phone's camera to connect." }), - p === "connect" && /* @__PURE__ */ fe.jsx("p", { children: "Click connect in your wallet app" }), - p === "sign" && /* @__PURE__ */ fe.jsx("p", { children: "Click sign-in in your wallet to confirm you own this wallet." }), - p === "waiting" && /* @__PURE__ */ fe.jsx("div", { className: "xc-text-center", children: /* @__PURE__ */ fe.jsx(_a, { className: "xc-inline-block xc-animate-spin" }) }) + /* @__PURE__ */ pe.jsx("div", { className: "xc-text-center", children: l ? /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ + /* @__PURE__ */ pe.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: l }), + /* @__PURE__ */ pe.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: te, children: "Retry" }) + ] }) : /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ + p === "scan" && /* @__PURE__ */ pe.jsx("p", { children: "Scan this QR code from your mobile wallet or phone's camera to connect." }), + p === "connect" && /* @__PURE__ */ pe.jsx("p", { children: "Click connect in your wallet app" }), + p === "sign" && /* @__PURE__ */ pe.jsx("p", { children: "Click sign-in in your wallet to confirm you own this wallet." }), + p === "waiting" && /* @__PURE__ */ pe.jsx("div", { className: "xc-text-center", children: /* @__PURE__ */ pe.jsx(mc, { className: "xc-inline-block xc-animate-spin" }) }) ] }) }) ] }); } -const Xne = "Accept connection request in the wallet", Zne = "Accept sign-in request in your wallet"; -function Qne(t, e) { +const tie = "Accept connection request in the wallet", rie = "Accept sign-in request in your wallet"; +function nie(t, e) { const r = window.location.host, n = window.location.href; - return F9({ + return j9({ address: t, chainId: 1, domain: r, @@ -39903,30 +39989,30 @@ function Qne(t, e) { version: "1" }); } -function q9(t) { +function z9(t) { var p; - const [e, r] = Gt(), { wallet: n, onSignFinish: i } = t, s = oi(), [o, a] = Gt("connect"), { saveLastUsedWallet: u } = mp(); + const [e, r] = Qt(), { wallet: n, onSignFinish: i } = t, s = Un(), [o, a] = Qt("connect"), { saveLastUsedWallet: u } = mp(); async function l(w) { var A; try { a("connect"); - const P = await n.connect(); - if (!P || P.length === 0) + const M = await n.connect(); + if (!M || M.length === 0) throw new Error("Wallet connect error"); - const N = Ev(P[0]), L = Qne(N, w); + const N = Ev(M[0]), L = nie(N, w); a("sign"); - const $ = await n.signMessage(L, N); - if (!$ || $.length === 0) + const B = await n.signMessage(L, N); + if (!B || B.length === 0) throw new Error("user sign error"); - a("waiting"), await i(n, { address: N, signature: $, message: L, nonce: w, wallet_name: ((A = n.config) == null ? void 0 : A.name) || "" }), u(n); - } catch (P) { - console.log(P.details), r(P.details || P.message); + a("waiting"), await i(n, { address: N, signature: B, message: L, nonce: w, wallet_name: ((A = n.config) == null ? void 0 : A.name) || "" }), u(n); + } catch (M) { + console.log(M.details), r(M.details || M.message); } } async function d() { try { r(""); - const w = await qo.getNonce({ account_type: "block_chain" }); + const w = await Ta.getNonce({ account_type: "block_chain" }); s.current = w, l(s.current); } catch (w) { console.log(w.details), r(w.message); @@ -39934,37 +40020,37 @@ function q9(t) { } return Dn(() => { d(); - }, []), /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4", children: [ - /* @__PURE__ */ fe.jsx("img", { className: "xc-rounded-md xc-h-16 xc-w-16", src: (p = n.config) == null ? void 0 : p.image, alt: "" }), - e && /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ - /* @__PURE__ */ fe.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: e }), - /* @__PURE__ */ fe.jsx("div", { className: "xc-flex xc-gap-2", children: /* @__PURE__ */ fe.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: d, children: "Retry" }) }) + }, []), /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4", children: [ + /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-md xc-h-16 xc-w-16", src: (p = n.config) == null ? void 0 : p.image, alt: "" }), + e && /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ + /* @__PURE__ */ pe.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: e }), + /* @__PURE__ */ pe.jsx("div", { className: "xc-flex xc-gap-2", children: /* @__PURE__ */ pe.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: d, children: "Retry" }) }) ] }), - !e && /* @__PURE__ */ fe.jsxs(fe.Fragment, { children: [ - o === "connect" && /* @__PURE__ */ fe.jsx("span", { className: "xc-text-center", children: Xne }), - o === "sign" && /* @__PURE__ */ fe.jsx("span", { className: "xc-text-center", children: Zne }), - o === "waiting" && /* @__PURE__ */ fe.jsx("span", { className: "xc-text-center", children: /* @__PURE__ */ fe.jsx(_a, { className: "xc-animate-spin" }) }) + !e && /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ + o === "connect" && /* @__PURE__ */ pe.jsx("span", { className: "xc-text-center", children: tie }), + o === "sign" && /* @__PURE__ */ pe.jsx("span", { className: "xc-text-center", children: rie }), + o === "waiting" && /* @__PURE__ */ pe.jsx("span", { className: "xc-text-center", children: /* @__PURE__ */ pe.jsx(mc, { className: "xc-animate-spin" }) }) ] }) ] }); } -const Gc = "https://static.codatta.io/codatta-connect/wallet-icons.svg", eie = "https://itunes.apple.com/app/", tie = "https://play.google.com/store/apps/details?id=", rie = "https://chromewebstore.google.com/detail/", nie = "https://chromewebstore.google.com/detail/", iie = "https://addons.mozilla.org/en-US/firefox/addon/", sie = "https://microsoftedge.microsoft.com/addons/detail/"; +const Gc = "https://static.codatta.io/codatta-connect/wallet-icons.svg", iie = "https://itunes.apple.com/app/", sie = "https://play.google.com/store/apps/details?id=", oie = "https://chromewebstore.google.com/detail/", aie = "https://chromewebstore.google.com/detail/", cie = "https://addons.mozilla.org/en-US/firefox/addon/", uie = "https://microsoftedge.microsoft.com/addons/detail/"; function Yc(t) { const { icon: e, title: r, link: n } = t; - return /* @__PURE__ */ fe.jsxs( + return /* @__PURE__ */ pe.jsxs( "a", { href: n, target: "_blank", className: "xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5", children: [ - /* @__PURE__ */ fe.jsx("img", { className: "xc-rounded-1 xc-h-6 xc-w-6", src: e, alt: "" }), + /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-1 xc-h-6 xc-w-6", src: e, alt: "" }), r, - /* @__PURE__ */ fe.jsx(HS, { className: "xc-ml-auto xc-text-gray-400" }) + /* @__PURE__ */ pe.jsx(WS, { className: "xc-ml-auto xc-text-gray-400" }) ] } ); } -function oie(t) { +function fie(t) { const e = { appStoreLink: "", playStoreLink: "", @@ -39973,21 +40059,21 @@ function oie(t) { firefoxStoreLink: "", edgeStoreLink: "" }; - return t != null && t.app_store_id && (e.appStoreLink = `${eie}${t.app_store_id}`), t != null && t.play_store_id && (e.playStoreLink = `${tie}${t.play_store_id}`), t != null && t.chrome_store_id && (e.chromeStoreLink = `${rie}${t.chrome_store_id}`), t != null && t.brave_store_id && (e.braveStoreLink = `${nie}${t.brave_store_id}`), t != null && t.firefox_addon_id && (e.firefoxStoreLink = `${iie}${t.firefox_addon_id}`), t != null && t.edge_addon_id && (e.edgeStoreLink = `${sie}${t.edge_addon_id}`), e; + return t != null && t.app_store_id && (e.appStoreLink = `${iie}${t.app_store_id}`), t != null && t.play_store_id && (e.playStoreLink = `${sie}${t.play_store_id}`), t != null && t.chrome_store_id && (e.chromeStoreLink = `${oie}${t.chrome_store_id}`), t != null && t.brave_store_id && (e.braveStoreLink = `${aie}${t.brave_store_id}`), t != null && t.firefox_addon_id && (e.firefoxStoreLink = `${cie}${t.firefox_addon_id}`), t != null && t.edge_addon_id && (e.edgeStoreLink = `${uie}${t.edge_addon_id}`), e; } -function z9(t) { +function W9(t) { var i, s, o; - const { wallet: e } = t, r = (i = e.config) == null ? void 0 : i.getWallet, n = oie(r); - return /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ - /* @__PURE__ */ fe.jsx("img", { className: "xc-rounded-md xc-mb-2 xc-h-12 xc-w-12", src: (s = e.config) == null ? void 0 : s.image, alt: "" }), - /* @__PURE__ */ fe.jsxs("p", { className: "xc-text-lg xc-font-bold", children: [ + const { wallet: e } = t, r = (i = e.config) == null ? void 0 : i.getWallet, n = fie(r); + return /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ + /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-md xc-mb-2 xc-h-12 xc-w-12", src: (s = e.config) == null ? void 0 : s.image, alt: "" }), + /* @__PURE__ */ pe.jsxs("p", { className: "xc-text-lg xc-font-bold", children: [ "Install ", (o = e.config) == null ? void 0 : o.name, " to connect" ] }), - /* @__PURE__ */ fe.jsx("p", { className: "xc-mb-6 xc-text-sm xc-text-gray-500", children: "Select from your preferred options below:" }), - /* @__PURE__ */ fe.jsxs("div", { className: "xc-grid xc-w-full xc-grid-cols-1 xc-gap-3", children: [ - (r == null ? void 0 : r.chrome_store_id) && /* @__PURE__ */ fe.jsx( + /* @__PURE__ */ pe.jsx("p", { className: "xc-mb-6 xc-text-sm xc-text-gray-500", children: "Select from your preferred options below:" }), + /* @__PURE__ */ pe.jsxs("div", { className: "xc-grid xc-w-full xc-grid-cols-1 xc-gap-3", children: [ + (r == null ? void 0 : r.chrome_store_id) && /* @__PURE__ */ pe.jsx( Yc, { link: n.chromeStoreLink, @@ -39995,7 +40081,7 @@ function z9(t) { title: "Google Play Store" } ), - (r == null ? void 0 : r.app_store_id) && /* @__PURE__ */ fe.jsx( + (r == null ? void 0 : r.app_store_id) && /* @__PURE__ */ pe.jsx( Yc, { link: n.appStoreLink, @@ -40003,7 +40089,7 @@ function z9(t) { title: "Apple App Store" } ), - (r == null ? void 0 : r.play_store_id) && /* @__PURE__ */ fe.jsx( + (r == null ? void 0 : r.play_store_id) && /* @__PURE__ */ pe.jsx( Yc, { link: n.playStoreLink, @@ -40011,7 +40097,7 @@ function z9(t) { title: "Google Play Store" } ), - (r == null ? void 0 : r.edge_addon_id) && /* @__PURE__ */ fe.jsx( + (r == null ? void 0 : r.edge_addon_id) && /* @__PURE__ */ pe.jsx( Yc, { link: n.edgeStoreLink, @@ -40019,7 +40105,7 @@ function z9(t) { title: "Microsoft Edge" } ), - (r == null ? void 0 : r.brave_store_id) && /* @__PURE__ */ fe.jsx( + (r == null ? void 0 : r.brave_store_id) && /* @__PURE__ */ pe.jsx( Yc, { link: n.braveStoreLink, @@ -40027,7 +40113,7 @@ function z9(t) { title: "Brave extension" } ), - (r == null ? void 0 : r.firefox_addon_id) && /* @__PURE__ */ fe.jsx( + (r == null ? void 0 : r.firefox_addon_id) && /* @__PURE__ */ pe.jsx( Yc, { link: n.firefoxStoreLink, @@ -40038,11 +40124,11 @@ function z9(t) { ] }) ] }); } -function aie(t) { - const { wallet: e } = t, [r, n] = Gt(e.installed ? "connect" : "qr"), i = fy(); +function lie(t) { + const { wallet: e } = t, [r, n] = Qt(e.installed ? "connect" : "qr"), i = cy(); async function s(o, a) { var l; - const u = await qo.walletLogin({ + const u = await Ta.walletLogin({ account_type: "block_chain", account_enum: "C", connector: "codatta_wallet", @@ -40061,33 +40147,33 @@ function aie(t) { }); await t.onLogin(u.data); } - return /* @__PURE__ */ fe.jsxs(so, { children: [ - /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ fe.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), - r === "qr" && /* @__PURE__ */ fe.jsx( - U9, + return /* @__PURE__ */ pe.jsxs(Ms, { children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ pe.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), + r === "qr" && /* @__PURE__ */ pe.jsx( + q9, { wallet: e, onGetExtension: () => n("get-extension"), onSignFinish: s } ), - r === "connect" && /* @__PURE__ */ fe.jsx( - q9, + r === "connect" && /* @__PURE__ */ pe.jsx( + z9, { onShowQrCode: () => n("qr"), wallet: e, onSignFinish: s } ), - r === "get-extension" && /* @__PURE__ */ fe.jsx(z9, { wallet: e }) + r === "get-extension" && /* @__PURE__ */ pe.jsx(W9, { wallet: e }) ] }); } -function cie(t) { - const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ fe.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: e.imageUrl }), i = e.name || ""; - return /* @__PURE__ */ fe.jsx(oy, { icon: n, title: i, onClick: () => r(e) }); +function hie(t) { + const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: e.imageUrl }), i = e.name || ""; + return /* @__PURE__ */ pe.jsx(oy, { icon: n, title: i, onClick: () => r(e) }); } -function W9(t) { - const { connector: e } = t, [r, n] = Gt(), [i, s] = Gt([]), o = Ni(() => r ? i.filter((d) => d.name.toLowerCase().includes(r.toLowerCase())) : i, [r, i]); +function H9(t) { + const { connector: e } = t, [r, n] = Qt(), [i, s] = Qt([]), o = wi(() => r ? i.filter((d) => d.name.toLowerCase().includes(r.toLowerCase())) : i, [r, i]); function a(d) { n(d.target.value); } @@ -40101,16 +40187,16 @@ function W9(t) { function l(d) { t.onSelect(d); } - return /* @__PURE__ */ fe.jsxs(so, { children: [ - /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ fe.jsx(Pc, { title: "Select wallet", onBack: t.onBack }) }), - /* @__PURE__ */ fe.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ - /* @__PURE__ */ fe.jsx(GS, { className: "xc-shrink-0 xc-opacity-50" }), - /* @__PURE__ */ fe.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: a }) + return /* @__PURE__ */ pe.jsxs(Ms, { children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ pe.jsx(Pc, { title: "Select wallet", onBack: t.onBack }) }), + /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ + /* @__PURE__ */ pe.jsx(KS, { className: "xc-shrink-0 xc-opacity-50" }), + /* @__PURE__ */ pe.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: a }) ] }), - /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: o == null ? void 0 : o.map((d) => /* @__PURE__ */ fe.jsx(cie, { wallet: d, onClick: l }, d.name)) }) + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: o == null ? void 0 : o.map((d) => /* @__PURE__ */ pe.jsx(hie, { wallet: d, onClick: l }, d.name)) }) ] }); } -var H9 = { exports: {} }; +var K9 = { exports: {} }; (function(t) { (function(e, r) { t.exports ? t.exports = r() : (e.nacl || (e.nacl = {}), e.nacl.util = r()); @@ -40148,10 +40234,10 @@ var H9 = { exports: {} }; return o; }), e; }); -})(H9); -var uie = H9.exports; -const Dl = /* @__PURE__ */ rs(uie); -var K9 = { exports: {} }; +})(K9); +var die = K9.exports; +const Dl = /* @__PURE__ */ ts(die); +var V9 = { exports: {} }; (function(t) { (function(e) { var r = function(k) { @@ -40163,7 +40249,7 @@ var K9 = { exports: {} }; }, i = new Uint8Array(16), s = new Uint8Array(32); s[0] = 9; var o = r(), a = r([1]), u = r([56129, 1]), l = r([30883, 4953, 19914, 30187, 55467, 16705, 2637, 112, 59544, 30585, 16505, 36039, 65139, 11119, 27886, 20995]), d = r([61785, 9906, 39828, 60374, 45398, 33411, 5274, 224, 53552, 61171, 33010, 6542, 64743, 22239, 55772, 9222]), p = r([54554, 36645, 11616, 51542, 42930, 38181, 51040, 26924, 56412, 64982, 57905, 49316, 21502, 52590, 14035, 8553]), w = r([26200, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214]), A = r([41136, 18958, 6951, 50414, 58488, 44335, 6150, 12099, 55207, 15867, 153, 11085, 57099, 20417, 9344, 11139]); - function P(k, U, z, C) { + function M(k, U, z, C) { k[U] = z >> 24 & 255, k[U + 1] = z >> 16 & 255, k[U + 2] = z >> 8 & 255, k[U + 3] = z & 255, k[U + 4] = C >> 24 & 255, k[U + 5] = C >> 16 & 255, k[U + 6] = C >> 8 & 255, k[U + 7] = C & 255; } function N(k, U, z, C, G) { @@ -40174,48 +40260,48 @@ var K9 = { exports: {} }; function L(k, U, z, C) { return N(k, U, z, C, 16); } - function $(k, U, z, C) { + function B(k, U, z, C) { return N(k, U, z, C, 32); } - function B(k, U, z, C) { - for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = z[0] & 255 | (z[1] & 255) << 8 | (z[2] & 255) << 16 | (z[3] & 255) << 24, se = z[4] & 255 | (z[5] & 255) << 8 | (z[6] & 255) << 16 | (z[7] & 255) << 24, de = z[8] & 255 | (z[9] & 255) << 8 | (z[10] & 255) << 16 | (z[11] & 255) << 24, xe = z[12] & 255 | (z[13] & 255) << 8 | (z[14] & 255) << 16 | (z[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = U[0] & 255 | (U[1] & 255) << 8 | (U[2] & 255) << 16 | (U[3] & 255) << 24, nt = U[4] & 255 | (U[5] & 255) << 8 | (U[6] & 255) << 16 | (U[7] & 255) << 24, je = U[8] & 255 | (U[9] & 255) << 8 | (U[10] & 255) << 16 | (U[11] & 255) << 24, pt = U[12] & 255 | (U[13] & 255) << 8 | (U[14] & 255) << 16 | (U[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = z[16] & 255 | (z[17] & 255) << 8 | (z[18] & 255) << 16 | (z[19] & 255) << 24, St = z[20] & 255 | (z[21] & 255) << 8 | (z[22] & 255) << 16 | (z[23] & 255) << 24, Tt = z[24] & 255 | (z[25] & 255) << 8 | (z[26] & 255) << 16 | (z[27] & 255) << 24, At = z[28] & 255 | (z[29] & 255) << 8 | (z[30] & 255) << 16 | (z[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = de, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, he, rr = 0; rr < 20; rr += 2) - he = ht + Lt | 0, ut ^= he << 7 | he >>> 25, he = ut + ht | 0, Ve ^= he << 9 | he >>> 23, he = Ve + ut | 0, Lt ^= he << 13 | he >>> 19, he = Lt + Ve | 0, ht ^= he << 18 | he >>> 14, he = ot + xt | 0, Fe ^= he << 7 | he >>> 25, he = Fe + ot | 0, zt ^= he << 9 | he >>> 23, he = zt + Fe | 0, xt ^= he << 13 | he >>> 19, he = xt + zt | 0, ot ^= he << 18 | he >>> 14, he = Ue + Se | 0, Zt ^= he << 7 | he >>> 25, he = Zt + Ue | 0, st ^= he << 9 | he >>> 23, he = st + Zt | 0, Se ^= he << 13 | he >>> 19, he = Se + st | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Je | 0, bt ^= he << 7 | he >>> 25, he = bt + Wt | 0, Ae ^= he << 9 | he >>> 23, he = Ae + bt | 0, Je ^= he << 13 | he >>> 19, he = Je + Ae | 0, Wt ^= he << 18 | he >>> 14, he = ht + bt | 0, xt ^= he << 7 | he >>> 25, he = xt + ht | 0, st ^= he << 9 | he >>> 23, he = st + xt | 0, bt ^= he << 13 | he >>> 19, he = bt + st | 0, ht ^= he << 18 | he >>> 14, he = ot + ut | 0, Se ^= he << 7 | he >>> 25, he = Se + ot | 0, Ae ^= he << 9 | he >>> 23, he = Ae + Se | 0, ut ^= he << 13 | he >>> 19, he = ut + Ae | 0, ot ^= he << 18 | he >>> 14, he = Ue + Fe | 0, Je ^= he << 7 | he >>> 25, he = Je + Ue | 0, Ve ^= he << 9 | he >>> 23, he = Ve + Je | 0, Fe ^= he << 13 | he >>> 19, he = Fe + Ve | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Zt | 0, Lt ^= he << 7 | he >>> 25, he = Lt + Wt | 0, zt ^= he << 9 | he >>> 23, he = zt + Lt | 0, Zt ^= he << 13 | he >>> 19, he = Zt + zt | 0, Wt ^= he << 18 | he >>> 14; - ht = ht + G | 0, xt = xt + j | 0, st = st + se | 0, bt = bt + de | 0, ut = ut + xe | 0, ot = ot + Te | 0, Se = Se + Re | 0, Ae = Ae + nt | 0, Ve = Ve + je | 0, Fe = Fe + pt | 0, Ue = Ue + it | 0, Je = Je + et | 0, Lt = Lt + St | 0, zt = zt + Tt | 0, Zt = Zt + At | 0, Wt = Wt + _t | 0, k[0] = ht >>> 0 & 255, k[1] = ht >>> 8 & 255, k[2] = ht >>> 16 & 255, k[3] = ht >>> 24 & 255, k[4] = xt >>> 0 & 255, k[5] = xt >>> 8 & 255, k[6] = xt >>> 16 & 255, k[7] = xt >>> 24 & 255, k[8] = st >>> 0 & 255, k[9] = st >>> 8 & 255, k[10] = st >>> 16 & 255, k[11] = st >>> 24 & 255, k[12] = bt >>> 0 & 255, k[13] = bt >>> 8 & 255, k[14] = bt >>> 16 & 255, k[15] = bt >>> 24 & 255, k[16] = ut >>> 0 & 255, k[17] = ut >>> 8 & 255, k[18] = ut >>> 16 & 255, k[19] = ut >>> 24 & 255, k[20] = ot >>> 0 & 255, k[21] = ot >>> 8 & 255, k[22] = ot >>> 16 & 255, k[23] = ot >>> 24 & 255, k[24] = Se >>> 0 & 255, k[25] = Se >>> 8 & 255, k[26] = Se >>> 16 & 255, k[27] = Se >>> 24 & 255, k[28] = Ae >>> 0 & 255, k[29] = Ae >>> 8 & 255, k[30] = Ae >>> 16 & 255, k[31] = Ae >>> 24 & 255, k[32] = Ve >>> 0 & 255, k[33] = Ve >>> 8 & 255, k[34] = Ve >>> 16 & 255, k[35] = Ve >>> 24 & 255, k[36] = Fe >>> 0 & 255, k[37] = Fe >>> 8 & 255, k[38] = Fe >>> 16 & 255, k[39] = Fe >>> 24 & 255, k[40] = Ue >>> 0 & 255, k[41] = Ue >>> 8 & 255, k[42] = Ue >>> 16 & 255, k[43] = Ue >>> 24 & 255, k[44] = Je >>> 0 & 255, k[45] = Je >>> 8 & 255, k[46] = Je >>> 16 & 255, k[47] = Je >>> 24 & 255, k[48] = Lt >>> 0 & 255, k[49] = Lt >>> 8 & 255, k[50] = Lt >>> 16 & 255, k[51] = Lt >>> 24 & 255, k[52] = zt >>> 0 & 255, k[53] = zt >>> 8 & 255, k[54] = zt >>> 16 & 255, k[55] = zt >>> 24 & 255, k[56] = Zt >>> 0 & 255, k[57] = Zt >>> 8 & 255, k[58] = Zt >>> 16 & 255, k[59] = Zt >>> 24 & 255, k[60] = Wt >>> 0 & 255, k[61] = Wt >>> 8 & 255, k[62] = Wt >>> 16 & 255, k[63] = Wt >>> 24 & 255; + function $(k, U, z, C) { + for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = z[0] & 255 | (z[1] & 255) << 8 | (z[2] & 255) << 16 | (z[3] & 255) << 24, se = z[4] & 255 | (z[5] & 255) << 8 | (z[6] & 255) << 16 | (z[7] & 255) << 24, he = z[8] & 255 | (z[9] & 255) << 8 | (z[10] & 255) << 16 | (z[11] & 255) << 24, xe = z[12] & 255 | (z[13] & 255) << 8 | (z[14] & 255) << 16 | (z[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = U[0] & 255 | (U[1] & 255) << 8 | (U[2] & 255) << 16 | (U[3] & 255) << 24, nt = U[4] & 255 | (U[5] & 255) << 8 | (U[6] & 255) << 16 | (U[7] & 255) << 24, je = U[8] & 255 | (U[9] & 255) << 8 | (U[10] & 255) << 16 | (U[11] & 255) << 24, pt = U[12] & 255 | (U[13] & 255) << 8 | (U[14] & 255) << 16 | (U[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = z[16] & 255 | (z[17] & 255) << 8 | (z[18] & 255) << 16 | (z[19] & 255) << 24, St = z[20] & 255 | (z[21] & 255) << 8 | (z[22] & 255) << 16 | (z[23] & 255) << 24, Tt = z[24] & 255 | (z[25] & 255) << 8 | (z[26] & 255) << 16 | (z[27] & 255) << 24, At = z[28] & 255 | (z[29] & 255) << 8 | (z[30] & 255) << 16 | (z[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = he, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Xt = At, Wt = _t, le, rr = 0; rr < 20; rr += 2) + le = ht + Lt | 0, ut ^= le << 7 | le >>> 25, le = ut + ht | 0, Ve ^= le << 9 | le >>> 23, le = Ve + ut | 0, Lt ^= le << 13 | le >>> 19, le = Lt + Ve | 0, ht ^= le << 18 | le >>> 14, le = ot + xt | 0, Fe ^= le << 7 | le >>> 25, le = Fe + ot | 0, zt ^= le << 9 | le >>> 23, le = zt + Fe | 0, xt ^= le << 13 | le >>> 19, le = xt + zt | 0, ot ^= le << 18 | le >>> 14, le = Ue + Se | 0, Xt ^= le << 7 | le >>> 25, le = Xt + Ue | 0, st ^= le << 9 | le >>> 23, le = st + Xt | 0, Se ^= le << 13 | le >>> 19, le = Se + st | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Je | 0, bt ^= le << 7 | le >>> 25, le = bt + Wt | 0, Ae ^= le << 9 | le >>> 23, le = Ae + bt | 0, Je ^= le << 13 | le >>> 19, le = Je + Ae | 0, Wt ^= le << 18 | le >>> 14, le = ht + bt | 0, xt ^= le << 7 | le >>> 25, le = xt + ht | 0, st ^= le << 9 | le >>> 23, le = st + xt | 0, bt ^= le << 13 | le >>> 19, le = bt + st | 0, ht ^= le << 18 | le >>> 14, le = ot + ut | 0, Se ^= le << 7 | le >>> 25, le = Se + ot | 0, Ae ^= le << 9 | le >>> 23, le = Ae + Se | 0, ut ^= le << 13 | le >>> 19, le = ut + Ae | 0, ot ^= le << 18 | le >>> 14, le = Ue + Fe | 0, Je ^= le << 7 | le >>> 25, le = Je + Ue | 0, Ve ^= le << 9 | le >>> 23, le = Ve + Je | 0, Fe ^= le << 13 | le >>> 19, le = Fe + Ve | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Xt | 0, Lt ^= le << 7 | le >>> 25, le = Lt + Wt | 0, zt ^= le << 9 | le >>> 23, le = zt + Lt | 0, Xt ^= le << 13 | le >>> 19, le = Xt + zt | 0, Wt ^= le << 18 | le >>> 14; + ht = ht + G | 0, xt = xt + j | 0, st = st + se | 0, bt = bt + he | 0, ut = ut + xe | 0, ot = ot + Te | 0, Se = Se + Re | 0, Ae = Ae + nt | 0, Ve = Ve + je | 0, Fe = Fe + pt | 0, Ue = Ue + it | 0, Je = Je + et | 0, Lt = Lt + St | 0, zt = zt + Tt | 0, Xt = Xt + At | 0, Wt = Wt + _t | 0, k[0] = ht >>> 0 & 255, k[1] = ht >>> 8 & 255, k[2] = ht >>> 16 & 255, k[3] = ht >>> 24 & 255, k[4] = xt >>> 0 & 255, k[5] = xt >>> 8 & 255, k[6] = xt >>> 16 & 255, k[7] = xt >>> 24 & 255, k[8] = st >>> 0 & 255, k[9] = st >>> 8 & 255, k[10] = st >>> 16 & 255, k[11] = st >>> 24 & 255, k[12] = bt >>> 0 & 255, k[13] = bt >>> 8 & 255, k[14] = bt >>> 16 & 255, k[15] = bt >>> 24 & 255, k[16] = ut >>> 0 & 255, k[17] = ut >>> 8 & 255, k[18] = ut >>> 16 & 255, k[19] = ut >>> 24 & 255, k[20] = ot >>> 0 & 255, k[21] = ot >>> 8 & 255, k[22] = ot >>> 16 & 255, k[23] = ot >>> 24 & 255, k[24] = Se >>> 0 & 255, k[25] = Se >>> 8 & 255, k[26] = Se >>> 16 & 255, k[27] = Se >>> 24 & 255, k[28] = Ae >>> 0 & 255, k[29] = Ae >>> 8 & 255, k[30] = Ae >>> 16 & 255, k[31] = Ae >>> 24 & 255, k[32] = Ve >>> 0 & 255, k[33] = Ve >>> 8 & 255, k[34] = Ve >>> 16 & 255, k[35] = Ve >>> 24 & 255, k[36] = Fe >>> 0 & 255, k[37] = Fe >>> 8 & 255, k[38] = Fe >>> 16 & 255, k[39] = Fe >>> 24 & 255, k[40] = Ue >>> 0 & 255, k[41] = Ue >>> 8 & 255, k[42] = Ue >>> 16 & 255, k[43] = Ue >>> 24 & 255, k[44] = Je >>> 0 & 255, k[45] = Je >>> 8 & 255, k[46] = Je >>> 16 & 255, k[47] = Je >>> 24 & 255, k[48] = Lt >>> 0 & 255, k[49] = Lt >>> 8 & 255, k[50] = Lt >>> 16 & 255, k[51] = Lt >>> 24 & 255, k[52] = zt >>> 0 & 255, k[53] = zt >>> 8 & 255, k[54] = zt >>> 16 & 255, k[55] = zt >>> 24 & 255, k[56] = Xt >>> 0 & 255, k[57] = Xt >>> 8 & 255, k[58] = Xt >>> 16 & 255, k[59] = Xt >>> 24 & 255, k[60] = Wt >>> 0 & 255, k[61] = Wt >>> 8 & 255, k[62] = Wt >>> 16 & 255, k[63] = Wt >>> 24 & 255; } function H(k, U, z, C) { - for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = z[0] & 255 | (z[1] & 255) << 8 | (z[2] & 255) << 16 | (z[3] & 255) << 24, se = z[4] & 255 | (z[5] & 255) << 8 | (z[6] & 255) << 16 | (z[7] & 255) << 24, de = z[8] & 255 | (z[9] & 255) << 8 | (z[10] & 255) << 16 | (z[11] & 255) << 24, xe = z[12] & 255 | (z[13] & 255) << 8 | (z[14] & 255) << 16 | (z[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = U[0] & 255 | (U[1] & 255) << 8 | (U[2] & 255) << 16 | (U[3] & 255) << 24, nt = U[4] & 255 | (U[5] & 255) << 8 | (U[6] & 255) << 16 | (U[7] & 255) << 24, je = U[8] & 255 | (U[9] & 255) << 8 | (U[10] & 255) << 16 | (U[11] & 255) << 24, pt = U[12] & 255 | (U[13] & 255) << 8 | (U[14] & 255) << 16 | (U[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = z[16] & 255 | (z[17] & 255) << 8 | (z[18] & 255) << 16 | (z[19] & 255) << 24, St = z[20] & 255 | (z[21] & 255) << 8 | (z[22] & 255) << 16 | (z[23] & 255) << 24, Tt = z[24] & 255 | (z[25] & 255) << 8 | (z[26] & 255) << 16 | (z[27] & 255) << 24, At = z[28] & 255 | (z[29] & 255) << 8 | (z[30] & 255) << 16 | (z[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = de, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, he, rr = 0; rr < 20; rr += 2) - he = ht + Lt | 0, ut ^= he << 7 | he >>> 25, he = ut + ht | 0, Ve ^= he << 9 | he >>> 23, he = Ve + ut | 0, Lt ^= he << 13 | he >>> 19, he = Lt + Ve | 0, ht ^= he << 18 | he >>> 14, he = ot + xt | 0, Fe ^= he << 7 | he >>> 25, he = Fe + ot | 0, zt ^= he << 9 | he >>> 23, he = zt + Fe | 0, xt ^= he << 13 | he >>> 19, he = xt + zt | 0, ot ^= he << 18 | he >>> 14, he = Ue + Se | 0, Zt ^= he << 7 | he >>> 25, he = Zt + Ue | 0, st ^= he << 9 | he >>> 23, he = st + Zt | 0, Se ^= he << 13 | he >>> 19, he = Se + st | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Je | 0, bt ^= he << 7 | he >>> 25, he = bt + Wt | 0, Ae ^= he << 9 | he >>> 23, he = Ae + bt | 0, Je ^= he << 13 | he >>> 19, he = Je + Ae | 0, Wt ^= he << 18 | he >>> 14, he = ht + bt | 0, xt ^= he << 7 | he >>> 25, he = xt + ht | 0, st ^= he << 9 | he >>> 23, he = st + xt | 0, bt ^= he << 13 | he >>> 19, he = bt + st | 0, ht ^= he << 18 | he >>> 14, he = ot + ut | 0, Se ^= he << 7 | he >>> 25, he = Se + ot | 0, Ae ^= he << 9 | he >>> 23, he = Ae + Se | 0, ut ^= he << 13 | he >>> 19, he = ut + Ae | 0, ot ^= he << 18 | he >>> 14, he = Ue + Fe | 0, Je ^= he << 7 | he >>> 25, he = Je + Ue | 0, Ve ^= he << 9 | he >>> 23, he = Ve + Je | 0, Fe ^= he << 13 | he >>> 19, he = Fe + Ve | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Zt | 0, Lt ^= he << 7 | he >>> 25, he = Lt + Wt | 0, zt ^= he << 9 | he >>> 23, he = zt + Lt | 0, Zt ^= he << 13 | he >>> 19, he = Zt + zt | 0, Wt ^= he << 18 | he >>> 14; + for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = z[0] & 255 | (z[1] & 255) << 8 | (z[2] & 255) << 16 | (z[3] & 255) << 24, se = z[4] & 255 | (z[5] & 255) << 8 | (z[6] & 255) << 16 | (z[7] & 255) << 24, he = z[8] & 255 | (z[9] & 255) << 8 | (z[10] & 255) << 16 | (z[11] & 255) << 24, xe = z[12] & 255 | (z[13] & 255) << 8 | (z[14] & 255) << 16 | (z[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = U[0] & 255 | (U[1] & 255) << 8 | (U[2] & 255) << 16 | (U[3] & 255) << 24, nt = U[4] & 255 | (U[5] & 255) << 8 | (U[6] & 255) << 16 | (U[7] & 255) << 24, je = U[8] & 255 | (U[9] & 255) << 8 | (U[10] & 255) << 16 | (U[11] & 255) << 24, pt = U[12] & 255 | (U[13] & 255) << 8 | (U[14] & 255) << 16 | (U[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = z[16] & 255 | (z[17] & 255) << 8 | (z[18] & 255) << 16 | (z[19] & 255) << 24, St = z[20] & 255 | (z[21] & 255) << 8 | (z[22] & 255) << 16 | (z[23] & 255) << 24, Tt = z[24] & 255 | (z[25] & 255) << 8 | (z[26] & 255) << 16 | (z[27] & 255) << 24, At = z[28] & 255 | (z[29] & 255) << 8 | (z[30] & 255) << 16 | (z[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = he, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Xt = At, Wt = _t, le, rr = 0; rr < 20; rr += 2) + le = ht + Lt | 0, ut ^= le << 7 | le >>> 25, le = ut + ht | 0, Ve ^= le << 9 | le >>> 23, le = Ve + ut | 0, Lt ^= le << 13 | le >>> 19, le = Lt + Ve | 0, ht ^= le << 18 | le >>> 14, le = ot + xt | 0, Fe ^= le << 7 | le >>> 25, le = Fe + ot | 0, zt ^= le << 9 | le >>> 23, le = zt + Fe | 0, xt ^= le << 13 | le >>> 19, le = xt + zt | 0, ot ^= le << 18 | le >>> 14, le = Ue + Se | 0, Xt ^= le << 7 | le >>> 25, le = Xt + Ue | 0, st ^= le << 9 | le >>> 23, le = st + Xt | 0, Se ^= le << 13 | le >>> 19, le = Se + st | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Je | 0, bt ^= le << 7 | le >>> 25, le = bt + Wt | 0, Ae ^= le << 9 | le >>> 23, le = Ae + bt | 0, Je ^= le << 13 | le >>> 19, le = Je + Ae | 0, Wt ^= le << 18 | le >>> 14, le = ht + bt | 0, xt ^= le << 7 | le >>> 25, le = xt + ht | 0, st ^= le << 9 | le >>> 23, le = st + xt | 0, bt ^= le << 13 | le >>> 19, le = bt + st | 0, ht ^= le << 18 | le >>> 14, le = ot + ut | 0, Se ^= le << 7 | le >>> 25, le = Se + ot | 0, Ae ^= le << 9 | le >>> 23, le = Ae + Se | 0, ut ^= le << 13 | le >>> 19, le = ut + Ae | 0, ot ^= le << 18 | le >>> 14, le = Ue + Fe | 0, Je ^= le << 7 | le >>> 25, le = Je + Ue | 0, Ve ^= le << 9 | le >>> 23, le = Ve + Je | 0, Fe ^= le << 13 | le >>> 19, le = Fe + Ve | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Xt | 0, Lt ^= le << 7 | le >>> 25, le = Lt + Wt | 0, zt ^= le << 9 | le >>> 23, le = zt + Lt | 0, Xt ^= le << 13 | le >>> 19, le = Xt + zt | 0, Wt ^= le << 18 | le >>> 14; k[0] = ht >>> 0 & 255, k[1] = ht >>> 8 & 255, k[2] = ht >>> 16 & 255, k[3] = ht >>> 24 & 255, k[4] = ot >>> 0 & 255, k[5] = ot >>> 8 & 255, k[6] = ot >>> 16 & 255, k[7] = ot >>> 24 & 255, k[8] = Ue >>> 0 & 255, k[9] = Ue >>> 8 & 255, k[10] = Ue >>> 16 & 255, k[11] = Ue >>> 24 & 255, k[12] = Wt >>> 0 & 255, k[13] = Wt >>> 8 & 255, k[14] = Wt >>> 16 & 255, k[15] = Wt >>> 24 & 255, k[16] = Se >>> 0 & 255, k[17] = Se >>> 8 & 255, k[18] = Se >>> 16 & 255, k[19] = Se >>> 24 & 255, k[20] = Ae >>> 0 & 255, k[21] = Ae >>> 8 & 255, k[22] = Ae >>> 16 & 255, k[23] = Ae >>> 24 & 255, k[24] = Ve >>> 0 & 255, k[25] = Ve >>> 8 & 255, k[26] = Ve >>> 16 & 255, k[27] = Ve >>> 24 & 255, k[28] = Fe >>> 0 & 255, k[29] = Fe >>> 8 & 255, k[30] = Fe >>> 16 & 255, k[31] = Fe >>> 24 & 255; } function W(k, U, z, C) { - B(k, U, z, C); + $(k, U, z, C); } function V(k, U, z, C) { H(k, U, z, C); } var te = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); function R(k, U, z, C, G, j, se) { - var de = new Uint8Array(16), xe = new Uint8Array(64), Te, Re; - for (Re = 0; Re < 16; Re++) de[Re] = 0; - for (Re = 0; Re < 8; Re++) de[Re] = j[Re]; + var he = new Uint8Array(16), xe = new Uint8Array(64), Te, Re; + for (Re = 0; Re < 16; Re++) he[Re] = 0; + for (Re = 0; Re < 8; Re++) he[Re] = j[Re]; for (; G >= 64; ) { - for (W(xe, de, se, te), Re = 0; Re < 64; Re++) k[U + Re] = z[C + Re] ^ xe[Re]; + for (W(xe, he, se, te), Re = 0; Re < 64; Re++) k[U + Re] = z[C + Re] ^ xe[Re]; for (Te = 1, Re = 8; Re < 16; Re++) - Te = Te + (de[Re] & 255) | 0, de[Re] = Te & 255, Te >>>= 8; + Te = Te + (he[Re] & 255) | 0, he[Re] = Te & 255, Te >>>= 8; G -= 64, U += 64, C += 64; } if (G > 0) - for (W(xe, de, se, te), Re = 0; Re < G; Re++) k[U + Re] = z[C + Re] ^ xe[Re]; + for (W(xe, he, se, te), Re = 0; Re < G; Re++) k[U + Re] = z[C + Re] ^ xe[Re]; return 0; } function K(k, U, z, C, G) { - var j = new Uint8Array(16), se = new Uint8Array(64), de, xe; + var j = new Uint8Array(16), se = new Uint8Array(64), he, xe; for (xe = 0; xe < 16; xe++) j[xe] = 0; for (xe = 0; xe < 8; xe++) j[xe] = C[xe]; for (; z >= 64; ) { for (W(se, j, G, te), xe = 0; xe < 64; xe++) k[U + xe] = se[xe]; - for (de = 1, xe = 8; xe < 16; xe++) - de = de + (j[xe] & 255) | 0, j[xe] = de & 255, de >>>= 8; + for (he = 1, xe = 8; xe < 16; xe++) + he = he + (j[xe] & 255) | 0, j[xe] = he & 255, he >>>= 8; z -= 64, U += 64; } if (z > 0) @@ -40225,23 +40311,23 @@ var K9 = { exports: {} }; function ge(k, U, z, C, G) { var j = new Uint8Array(32); V(j, C, G, te); - for (var se = new Uint8Array(8), de = 0; de < 8; de++) se[de] = C[de + 16]; + for (var se = new Uint8Array(8), he = 0; he < 8; he++) se[he] = C[he + 16]; return K(k, U, z, se, j); } function Ee(k, U, z, C, G, j, se) { - var de = new Uint8Array(32); - V(de, j, se, te); + var he = new Uint8Array(32); + V(he, j, se, te); for (var xe = new Uint8Array(8), Te = 0; Te < 8; Te++) xe[Te] = j[Te + 16]; - return R(k, U, z, C, G, xe, de); + return R(k, U, z, C, G, xe, he); } var Y = function(k) { this.buffer = new Uint8Array(16), this.r = new Uint16Array(10), this.h = new Uint16Array(10), this.pad = new Uint16Array(8), this.leftover = 0, this.fin = 0; - var U, z, C, G, j, se, de, xe; - U = k[0] & 255 | (k[1] & 255) << 8, this.r[0] = U & 8191, z = k[2] & 255 | (k[3] & 255) << 8, this.r[1] = (U >>> 13 | z << 3) & 8191, C = k[4] & 255 | (k[5] & 255) << 8, this.r[2] = (z >>> 10 | C << 6) & 7939, G = k[6] & 255 | (k[7] & 255) << 8, this.r[3] = (C >>> 7 | G << 9) & 8191, j = k[8] & 255 | (k[9] & 255) << 8, this.r[4] = (G >>> 4 | j << 12) & 255, this.r[5] = j >>> 1 & 8190, se = k[10] & 255 | (k[11] & 255) << 8, this.r[6] = (j >>> 14 | se << 2) & 8191, de = k[12] & 255 | (k[13] & 255) << 8, this.r[7] = (se >>> 11 | de << 5) & 8065, xe = k[14] & 255 | (k[15] & 255) << 8, this.r[8] = (de >>> 8 | xe << 8) & 8191, this.r[9] = xe >>> 5 & 127, this.pad[0] = k[16] & 255 | (k[17] & 255) << 8, this.pad[1] = k[18] & 255 | (k[19] & 255) << 8, this.pad[2] = k[20] & 255 | (k[21] & 255) << 8, this.pad[3] = k[22] & 255 | (k[23] & 255) << 8, this.pad[4] = k[24] & 255 | (k[25] & 255) << 8, this.pad[5] = k[26] & 255 | (k[27] & 255) << 8, this.pad[6] = k[28] & 255 | (k[29] & 255) << 8, this.pad[7] = k[30] & 255 | (k[31] & 255) << 8; + var U, z, C, G, j, se, he, xe; + U = k[0] & 255 | (k[1] & 255) << 8, this.r[0] = U & 8191, z = k[2] & 255 | (k[3] & 255) << 8, this.r[1] = (U >>> 13 | z << 3) & 8191, C = k[4] & 255 | (k[5] & 255) << 8, this.r[2] = (z >>> 10 | C << 6) & 7939, G = k[6] & 255 | (k[7] & 255) << 8, this.r[3] = (C >>> 7 | G << 9) & 8191, j = k[8] & 255 | (k[9] & 255) << 8, this.r[4] = (G >>> 4 | j << 12) & 255, this.r[5] = j >>> 1 & 8190, se = k[10] & 255 | (k[11] & 255) << 8, this.r[6] = (j >>> 14 | se << 2) & 8191, he = k[12] & 255 | (k[13] & 255) << 8, this.r[7] = (se >>> 11 | he << 5) & 8065, xe = k[14] & 255 | (k[15] & 255) << 8, this.r[8] = (he >>> 8 | xe << 8) & 8191, this.r[9] = xe >>> 5 & 127, this.pad[0] = k[16] & 255 | (k[17] & 255) << 8, this.pad[1] = k[18] & 255 | (k[19] & 255) << 8, this.pad[2] = k[20] & 255 | (k[21] & 255) << 8, this.pad[3] = k[22] & 255 | (k[23] & 255) << 8, this.pad[4] = k[24] & 255 | (k[25] & 255) << 8, this.pad[5] = k[26] & 255 | (k[27] & 255) << 8, this.pad[6] = k[28] & 255 | (k[29] & 255) << 8, this.pad[7] = k[30] & 255 | (k[31] & 255) << 8; }; Y.prototype.blocks = function(k, U, z) { - for (var C = this.fin ? 0 : 2048, G, j, se, de, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt = this.h[0], ut = this.h[1], ot = this.h[2], Se = this.h[3], Ae = this.h[4], Ve = this.h[5], Fe = this.h[6], Ue = this.h[7], Je = this.h[8], Lt = this.h[9], zt = this.r[0], Zt = this.r[1], Wt = this.r[2], he = this.r[3], rr = this.r[4], dr = this.r[5], pr = this.r[6], Qt = this.r[7], gr = this.r[8], lr = this.r[9]; z >= 16; ) - G = k[U + 0] & 255 | (k[U + 1] & 255) << 8, bt += G & 8191, j = k[U + 2] & 255 | (k[U + 3] & 255) << 8, ut += (G >>> 13 | j << 3) & 8191, se = k[U + 4] & 255 | (k[U + 5] & 255) << 8, ot += (j >>> 10 | se << 6) & 8191, de = k[U + 6] & 255 | (k[U + 7] & 255) << 8, Se += (se >>> 7 | de << 9) & 8191, xe = k[U + 8] & 255 | (k[U + 9] & 255) << 8, Ae += (de >>> 4 | xe << 12) & 8191, Ve += xe >>> 1 & 8191, Te = k[U + 10] & 255 | (k[U + 11] & 255) << 8, Fe += (xe >>> 14 | Te << 2) & 8191, Re = k[U + 12] & 255 | (k[U + 13] & 255) << 8, Ue += (Te >>> 11 | Re << 5) & 8191, nt = k[U + 14] & 255 | (k[U + 15] & 255) << 8, Je += (Re >>> 8 | nt << 8) & 8191, Lt += nt >>> 5 | C, je = 0, pt = je, pt += bt * zt, pt += ut * (5 * lr), pt += ot * (5 * gr), pt += Se * (5 * Qt), pt += Ae * (5 * pr), je = pt >>> 13, pt &= 8191, pt += Ve * (5 * dr), pt += Fe * (5 * rr), pt += Ue * (5 * he), pt += Je * (5 * Wt), pt += Lt * (5 * Zt), je += pt >>> 13, pt &= 8191, it = je, it += bt * Zt, it += ut * zt, it += ot * (5 * lr), it += Se * (5 * gr), it += Ae * (5 * Qt), je = it >>> 13, it &= 8191, it += Ve * (5 * pr), it += Fe * (5 * dr), it += Ue * (5 * rr), it += Je * (5 * he), it += Lt * (5 * Wt), je += it >>> 13, it &= 8191, et = je, et += bt * Wt, et += ut * Zt, et += ot * zt, et += Se * (5 * lr), et += Ae * (5 * gr), je = et >>> 13, et &= 8191, et += Ve * (5 * Qt), et += Fe * (5 * pr), et += Ue * (5 * dr), et += Je * (5 * rr), et += Lt * (5 * he), je += et >>> 13, et &= 8191, St = je, St += bt * he, St += ut * Wt, St += ot * Zt, St += Se * zt, St += Ae * (5 * lr), je = St >>> 13, St &= 8191, St += Ve * (5 * gr), St += Fe * (5 * Qt), St += Ue * (5 * pr), St += Je * (5 * dr), St += Lt * (5 * rr), je += St >>> 13, St &= 8191, Tt = je, Tt += bt * rr, Tt += ut * he, Tt += ot * Wt, Tt += Se * Zt, Tt += Ae * zt, je = Tt >>> 13, Tt &= 8191, Tt += Ve * (5 * lr), Tt += Fe * (5 * gr), Tt += Ue * (5 * Qt), Tt += Je * (5 * pr), Tt += Lt * (5 * dr), je += Tt >>> 13, Tt &= 8191, At = je, At += bt * dr, At += ut * rr, At += ot * he, At += Se * Wt, At += Ae * Zt, je = At >>> 13, At &= 8191, At += Ve * zt, At += Fe * (5 * lr), At += Ue * (5 * gr), At += Je * (5 * Qt), At += Lt * (5 * pr), je += At >>> 13, At &= 8191, _t = je, _t += bt * pr, _t += ut * dr, _t += ot * rr, _t += Se * he, _t += Ae * Wt, je = _t >>> 13, _t &= 8191, _t += Ve * Zt, _t += Fe * zt, _t += Ue * (5 * lr), _t += Je * (5 * gr), _t += Lt * (5 * Qt), je += _t >>> 13, _t &= 8191, ht = je, ht += bt * Qt, ht += ut * pr, ht += ot * dr, ht += Se * rr, ht += Ae * he, je = ht >>> 13, ht &= 8191, ht += Ve * Wt, ht += Fe * Zt, ht += Ue * zt, ht += Je * (5 * lr), ht += Lt * (5 * gr), je += ht >>> 13, ht &= 8191, xt = je, xt += bt * gr, xt += ut * Qt, xt += ot * pr, xt += Se * dr, xt += Ae * rr, je = xt >>> 13, xt &= 8191, xt += Ve * he, xt += Fe * Wt, xt += Ue * Zt, xt += Je * zt, xt += Lt * (5 * lr), je += xt >>> 13, xt &= 8191, st = je, st += bt * lr, st += ut * gr, st += ot * Qt, st += Se * pr, st += Ae * dr, je = st >>> 13, st &= 8191, st += Ve * rr, st += Fe * he, st += Ue * Wt, st += Je * Zt, st += Lt * zt, je += st >>> 13, st &= 8191, je = (je << 2) + je | 0, je = je + pt | 0, pt = je & 8191, je = je >>> 13, it += je, bt = pt, ut = it, ot = et, Se = St, Ae = Tt, Ve = At, Fe = _t, Ue = ht, Je = xt, Lt = st, U += 16, z -= 16; + for (var C = this.fin ? 0 : 2048, G, j, se, he, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt = this.h[0], ut = this.h[1], ot = this.h[2], Se = this.h[3], Ae = this.h[4], Ve = this.h[5], Fe = this.h[6], Ue = this.h[7], Je = this.h[8], Lt = this.h[9], zt = this.r[0], Xt = this.r[1], Wt = this.r[2], le = this.r[3], rr = this.r[4], dr = this.r[5], pr = this.r[6], Zt = this.r[7], gr = this.r[8], lr = this.r[9]; z >= 16; ) + G = k[U + 0] & 255 | (k[U + 1] & 255) << 8, bt += G & 8191, j = k[U + 2] & 255 | (k[U + 3] & 255) << 8, ut += (G >>> 13 | j << 3) & 8191, se = k[U + 4] & 255 | (k[U + 5] & 255) << 8, ot += (j >>> 10 | se << 6) & 8191, he = k[U + 6] & 255 | (k[U + 7] & 255) << 8, Se += (se >>> 7 | he << 9) & 8191, xe = k[U + 8] & 255 | (k[U + 9] & 255) << 8, Ae += (he >>> 4 | xe << 12) & 8191, Ve += xe >>> 1 & 8191, Te = k[U + 10] & 255 | (k[U + 11] & 255) << 8, Fe += (xe >>> 14 | Te << 2) & 8191, Re = k[U + 12] & 255 | (k[U + 13] & 255) << 8, Ue += (Te >>> 11 | Re << 5) & 8191, nt = k[U + 14] & 255 | (k[U + 15] & 255) << 8, Je += (Re >>> 8 | nt << 8) & 8191, Lt += nt >>> 5 | C, je = 0, pt = je, pt += bt * zt, pt += ut * (5 * lr), pt += ot * (5 * gr), pt += Se * (5 * Zt), pt += Ae * (5 * pr), je = pt >>> 13, pt &= 8191, pt += Ve * (5 * dr), pt += Fe * (5 * rr), pt += Ue * (5 * le), pt += Je * (5 * Wt), pt += Lt * (5 * Xt), je += pt >>> 13, pt &= 8191, it = je, it += bt * Xt, it += ut * zt, it += ot * (5 * lr), it += Se * (5 * gr), it += Ae * (5 * Zt), je = it >>> 13, it &= 8191, it += Ve * (5 * pr), it += Fe * (5 * dr), it += Ue * (5 * rr), it += Je * (5 * le), it += Lt * (5 * Wt), je += it >>> 13, it &= 8191, et = je, et += bt * Wt, et += ut * Xt, et += ot * zt, et += Se * (5 * lr), et += Ae * (5 * gr), je = et >>> 13, et &= 8191, et += Ve * (5 * Zt), et += Fe * (5 * pr), et += Ue * (5 * dr), et += Je * (5 * rr), et += Lt * (5 * le), je += et >>> 13, et &= 8191, St = je, St += bt * le, St += ut * Wt, St += ot * Xt, St += Se * zt, St += Ae * (5 * lr), je = St >>> 13, St &= 8191, St += Ve * (5 * gr), St += Fe * (5 * Zt), St += Ue * (5 * pr), St += Je * (5 * dr), St += Lt * (5 * rr), je += St >>> 13, St &= 8191, Tt = je, Tt += bt * rr, Tt += ut * le, Tt += ot * Wt, Tt += Se * Xt, Tt += Ae * zt, je = Tt >>> 13, Tt &= 8191, Tt += Ve * (5 * lr), Tt += Fe * (5 * gr), Tt += Ue * (5 * Zt), Tt += Je * (5 * pr), Tt += Lt * (5 * dr), je += Tt >>> 13, Tt &= 8191, At = je, At += bt * dr, At += ut * rr, At += ot * le, At += Se * Wt, At += Ae * Xt, je = At >>> 13, At &= 8191, At += Ve * zt, At += Fe * (5 * lr), At += Ue * (5 * gr), At += Je * (5 * Zt), At += Lt * (5 * pr), je += At >>> 13, At &= 8191, _t = je, _t += bt * pr, _t += ut * dr, _t += ot * rr, _t += Se * le, _t += Ae * Wt, je = _t >>> 13, _t &= 8191, _t += Ve * Xt, _t += Fe * zt, _t += Ue * (5 * lr), _t += Je * (5 * gr), _t += Lt * (5 * Zt), je += _t >>> 13, _t &= 8191, ht = je, ht += bt * Zt, ht += ut * pr, ht += ot * dr, ht += Se * rr, ht += Ae * le, je = ht >>> 13, ht &= 8191, ht += Ve * Wt, ht += Fe * Xt, ht += Ue * zt, ht += Je * (5 * lr), ht += Lt * (5 * gr), je += ht >>> 13, ht &= 8191, xt = je, xt += bt * gr, xt += ut * Zt, xt += ot * pr, xt += Se * dr, xt += Ae * rr, je = xt >>> 13, xt &= 8191, xt += Ve * le, xt += Fe * Wt, xt += Ue * Xt, xt += Je * zt, xt += Lt * (5 * lr), je += xt >>> 13, xt &= 8191, st = je, st += bt * lr, st += ut * gr, st += ot * Zt, st += Se * pr, st += Ae * dr, je = st >>> 13, st &= 8191, st += Ve * rr, st += Fe * le, st += Ue * Wt, st += Je * Xt, st += Lt * zt, je += st >>> 13, st &= 8191, je = (je << 2) + je | 0, je = je + pt | 0, pt = je & 8191, je = je >>> 13, it += je, bt = pt, ut = it, ot = et, Se = St, Ae = Tt, Ve = At, Fe = _t, Ue = ht, Je = xt, Lt = st, U += 16, z -= 16; this.h[0] = bt, this.h[1] = ut, this.h[2] = ot, this.h[3] = Se, this.h[4] = Ae, this.h[5] = Ve, this.h[6] = Fe, this.h[7] = Ue, this.h[8] = Je, this.h[9] = Lt; }, Y.prototype.finish = function(k, U) { var z = new Uint16Array(10), C, G, j, se; @@ -40320,9 +40406,9 @@ var K9 = { exports: {} }; } function v(k, U) { var z = new Uint8Array(32), C = new Uint8Array(32); - return E(z, k), E(C, U), $(z, 0, C, 0); + return E(z, k), E(C, U), B(z, 0, C, 0); } - function M(k) { + function P(k) { var U = new Uint8Array(32); return E(U, k), U[0] & 1; } @@ -40338,8 +40424,8 @@ var K9 = { exports: {} }; for (var C = 0; C < 16; C++) k[C] = U[C] - z[C]; } function D(k, U, z) { - var C, G, j = 0, se = 0, de = 0, xe = 0, Te = 0, Re = 0, nt = 0, je = 0, pt = 0, it = 0, et = 0, St = 0, Tt = 0, At = 0, _t = 0, ht = 0, xt = 0, st = 0, bt = 0, ut = 0, ot = 0, Se = 0, Ae = 0, Ve = 0, Fe = 0, Ue = 0, Je = 0, Lt = 0, zt = 0, Zt = 0, Wt = 0, he = z[0], rr = z[1], dr = z[2], pr = z[3], Qt = z[4], gr = z[5], lr = z[6], Rr = z[7], mr = z[8], yr = z[9], $r = z[10], Br = z[11], Ir = z[12], nn = z[13], sn = z[14], on = z[15]; - C = U[0], j += C * he, se += C * rr, de += C * dr, xe += C * pr, Te += C * Qt, Re += C * gr, nt += C * lr, je += C * Rr, pt += C * mr, it += C * yr, et += C * $r, St += C * Br, Tt += C * Ir, At += C * nn, _t += C * sn, ht += C * on, C = U[1], se += C * he, de += C * rr, xe += C * dr, Te += C * pr, Re += C * Qt, nt += C * gr, je += C * lr, pt += C * Rr, it += C * mr, et += C * yr, St += C * $r, Tt += C * Br, At += C * Ir, _t += C * nn, ht += C * sn, xt += C * on, C = U[2], de += C * he, xe += C * rr, Te += C * dr, Re += C * pr, nt += C * Qt, je += C * gr, pt += C * lr, it += C * Rr, et += C * mr, St += C * yr, Tt += C * $r, At += C * Br, _t += C * Ir, ht += C * nn, xt += C * sn, st += C * on, C = U[3], xe += C * he, Te += C * rr, Re += C * dr, nt += C * pr, je += C * Qt, pt += C * gr, it += C * lr, et += C * Rr, St += C * mr, Tt += C * yr, At += C * $r, _t += C * Br, ht += C * Ir, xt += C * nn, st += C * sn, bt += C * on, C = U[4], Te += C * he, Re += C * rr, nt += C * dr, je += C * pr, pt += C * Qt, it += C * gr, et += C * lr, St += C * Rr, Tt += C * mr, At += C * yr, _t += C * $r, ht += C * Br, xt += C * Ir, st += C * nn, bt += C * sn, ut += C * on, C = U[5], Re += C * he, nt += C * rr, je += C * dr, pt += C * pr, it += C * Qt, et += C * gr, St += C * lr, Tt += C * Rr, At += C * mr, _t += C * yr, ht += C * $r, xt += C * Br, st += C * Ir, bt += C * nn, ut += C * sn, ot += C * on, C = U[6], nt += C * he, je += C * rr, pt += C * dr, it += C * pr, et += C * Qt, St += C * gr, Tt += C * lr, At += C * Rr, _t += C * mr, ht += C * yr, xt += C * $r, st += C * Br, bt += C * Ir, ut += C * nn, ot += C * sn, Se += C * on, C = U[7], je += C * he, pt += C * rr, it += C * dr, et += C * pr, St += C * Qt, Tt += C * gr, At += C * lr, _t += C * Rr, ht += C * mr, xt += C * yr, st += C * $r, bt += C * Br, ut += C * Ir, ot += C * nn, Se += C * sn, Ae += C * on, C = U[8], pt += C * he, it += C * rr, et += C * dr, St += C * pr, Tt += C * Qt, At += C * gr, _t += C * lr, ht += C * Rr, xt += C * mr, st += C * yr, bt += C * $r, ut += C * Br, ot += C * Ir, Se += C * nn, Ae += C * sn, Ve += C * on, C = U[9], it += C * he, et += C * rr, St += C * dr, Tt += C * pr, At += C * Qt, _t += C * gr, ht += C * lr, xt += C * Rr, st += C * mr, bt += C * yr, ut += C * $r, ot += C * Br, Se += C * Ir, Ae += C * nn, Ve += C * sn, Fe += C * on, C = U[10], et += C * he, St += C * rr, Tt += C * dr, At += C * pr, _t += C * Qt, ht += C * gr, xt += C * lr, st += C * Rr, bt += C * mr, ut += C * yr, ot += C * $r, Se += C * Br, Ae += C * Ir, Ve += C * nn, Fe += C * sn, Ue += C * on, C = U[11], St += C * he, Tt += C * rr, At += C * dr, _t += C * pr, ht += C * Qt, xt += C * gr, st += C * lr, bt += C * Rr, ut += C * mr, ot += C * yr, Se += C * $r, Ae += C * Br, Ve += C * Ir, Fe += C * nn, Ue += C * sn, Je += C * on, C = U[12], Tt += C * he, At += C * rr, _t += C * dr, ht += C * pr, xt += C * Qt, st += C * gr, bt += C * lr, ut += C * Rr, ot += C * mr, Se += C * yr, Ae += C * $r, Ve += C * Br, Fe += C * Ir, Ue += C * nn, Je += C * sn, Lt += C * on, C = U[13], At += C * he, _t += C * rr, ht += C * dr, xt += C * pr, st += C * Qt, bt += C * gr, ut += C * lr, ot += C * Rr, Se += C * mr, Ae += C * yr, Ve += C * $r, Fe += C * Br, Ue += C * Ir, Je += C * nn, Lt += C * sn, zt += C * on, C = U[14], _t += C * he, ht += C * rr, xt += C * dr, st += C * pr, bt += C * Qt, ut += C * gr, ot += C * lr, Se += C * Rr, Ae += C * mr, Ve += C * yr, Fe += C * $r, Ue += C * Br, Je += C * Ir, Lt += C * nn, zt += C * sn, Zt += C * on, C = U[15], ht += C * he, xt += C * rr, st += C * dr, bt += C * pr, ut += C * Qt, ot += C * gr, Se += C * lr, Ae += C * Rr, Ve += C * mr, Fe += C * yr, Ue += C * $r, Je += C * Br, Lt += C * Ir, zt += C * nn, Zt += C * sn, Wt += C * on, j += 38 * xt, se += 38 * st, de += 38 * bt, xe += 38 * ut, Te += 38 * ot, Re += 38 * Se, nt += 38 * Ae, je += 38 * Ve, pt += 38 * Fe, it += 38 * Ue, et += 38 * Je, St += 38 * Lt, Tt += 38 * zt, At += 38 * Zt, _t += 38 * Wt, G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = de + G + 65535, G = Math.floor(C / 65536), de = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = de + G + 65535, G = Math.floor(C / 65536), de = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), k[0] = j, k[1] = se, k[2] = de, k[3] = xe, k[4] = Te, k[5] = Re, k[6] = nt, k[7] = je, k[8] = pt, k[9] = it, k[10] = et, k[11] = St, k[12] = Tt, k[13] = At, k[14] = _t, k[15] = ht; + var C, G, j = 0, se = 0, he = 0, xe = 0, Te = 0, Re = 0, nt = 0, je = 0, pt = 0, it = 0, et = 0, St = 0, Tt = 0, At = 0, _t = 0, ht = 0, xt = 0, st = 0, bt = 0, ut = 0, ot = 0, Se = 0, Ae = 0, Ve = 0, Fe = 0, Ue = 0, Je = 0, Lt = 0, zt = 0, Xt = 0, Wt = 0, le = z[0], rr = z[1], dr = z[2], pr = z[3], Zt = z[4], gr = z[5], lr = z[6], Rr = z[7], mr = z[8], yr = z[9], $r = z[10], Br = z[11], Ir = z[12], nn = z[13], sn = z[14], on = z[15]; + C = U[0], j += C * le, se += C * rr, he += C * dr, xe += C * pr, Te += C * Zt, Re += C * gr, nt += C * lr, je += C * Rr, pt += C * mr, it += C * yr, et += C * $r, St += C * Br, Tt += C * Ir, At += C * nn, _t += C * sn, ht += C * on, C = U[1], se += C * le, he += C * rr, xe += C * dr, Te += C * pr, Re += C * Zt, nt += C * gr, je += C * lr, pt += C * Rr, it += C * mr, et += C * yr, St += C * $r, Tt += C * Br, At += C * Ir, _t += C * nn, ht += C * sn, xt += C * on, C = U[2], he += C * le, xe += C * rr, Te += C * dr, Re += C * pr, nt += C * Zt, je += C * gr, pt += C * lr, it += C * Rr, et += C * mr, St += C * yr, Tt += C * $r, At += C * Br, _t += C * Ir, ht += C * nn, xt += C * sn, st += C * on, C = U[3], xe += C * le, Te += C * rr, Re += C * dr, nt += C * pr, je += C * Zt, pt += C * gr, it += C * lr, et += C * Rr, St += C * mr, Tt += C * yr, At += C * $r, _t += C * Br, ht += C * Ir, xt += C * nn, st += C * sn, bt += C * on, C = U[4], Te += C * le, Re += C * rr, nt += C * dr, je += C * pr, pt += C * Zt, it += C * gr, et += C * lr, St += C * Rr, Tt += C * mr, At += C * yr, _t += C * $r, ht += C * Br, xt += C * Ir, st += C * nn, bt += C * sn, ut += C * on, C = U[5], Re += C * le, nt += C * rr, je += C * dr, pt += C * pr, it += C * Zt, et += C * gr, St += C * lr, Tt += C * Rr, At += C * mr, _t += C * yr, ht += C * $r, xt += C * Br, st += C * Ir, bt += C * nn, ut += C * sn, ot += C * on, C = U[6], nt += C * le, je += C * rr, pt += C * dr, it += C * pr, et += C * Zt, St += C * gr, Tt += C * lr, At += C * Rr, _t += C * mr, ht += C * yr, xt += C * $r, st += C * Br, bt += C * Ir, ut += C * nn, ot += C * sn, Se += C * on, C = U[7], je += C * le, pt += C * rr, it += C * dr, et += C * pr, St += C * Zt, Tt += C * gr, At += C * lr, _t += C * Rr, ht += C * mr, xt += C * yr, st += C * $r, bt += C * Br, ut += C * Ir, ot += C * nn, Se += C * sn, Ae += C * on, C = U[8], pt += C * le, it += C * rr, et += C * dr, St += C * pr, Tt += C * Zt, At += C * gr, _t += C * lr, ht += C * Rr, xt += C * mr, st += C * yr, bt += C * $r, ut += C * Br, ot += C * Ir, Se += C * nn, Ae += C * sn, Ve += C * on, C = U[9], it += C * le, et += C * rr, St += C * dr, Tt += C * pr, At += C * Zt, _t += C * gr, ht += C * lr, xt += C * Rr, st += C * mr, bt += C * yr, ut += C * $r, ot += C * Br, Se += C * Ir, Ae += C * nn, Ve += C * sn, Fe += C * on, C = U[10], et += C * le, St += C * rr, Tt += C * dr, At += C * pr, _t += C * Zt, ht += C * gr, xt += C * lr, st += C * Rr, bt += C * mr, ut += C * yr, ot += C * $r, Se += C * Br, Ae += C * Ir, Ve += C * nn, Fe += C * sn, Ue += C * on, C = U[11], St += C * le, Tt += C * rr, At += C * dr, _t += C * pr, ht += C * Zt, xt += C * gr, st += C * lr, bt += C * Rr, ut += C * mr, ot += C * yr, Se += C * $r, Ae += C * Br, Ve += C * Ir, Fe += C * nn, Ue += C * sn, Je += C * on, C = U[12], Tt += C * le, At += C * rr, _t += C * dr, ht += C * pr, xt += C * Zt, st += C * gr, bt += C * lr, ut += C * Rr, ot += C * mr, Se += C * yr, Ae += C * $r, Ve += C * Br, Fe += C * Ir, Ue += C * nn, Je += C * sn, Lt += C * on, C = U[13], At += C * le, _t += C * rr, ht += C * dr, xt += C * pr, st += C * Zt, bt += C * gr, ut += C * lr, ot += C * Rr, Se += C * mr, Ae += C * yr, Ve += C * $r, Fe += C * Br, Ue += C * Ir, Je += C * nn, Lt += C * sn, zt += C * on, C = U[14], _t += C * le, ht += C * rr, xt += C * dr, st += C * pr, bt += C * Zt, ut += C * gr, ot += C * lr, Se += C * Rr, Ae += C * mr, Ve += C * yr, Fe += C * $r, Ue += C * Br, Je += C * Ir, Lt += C * nn, zt += C * sn, Xt += C * on, C = U[15], ht += C * le, xt += C * rr, st += C * dr, bt += C * pr, ut += C * Zt, ot += C * gr, Se += C * lr, Ae += C * Rr, Ve += C * mr, Fe += C * yr, Ue += C * $r, Je += C * Br, Lt += C * Ir, zt += C * nn, Xt += C * sn, Wt += C * on, j += 38 * xt, se += 38 * st, he += 38 * bt, xe += 38 * ut, Te += 38 * ot, Re += 38 * Se, nt += 38 * Ae, je += 38 * Ve, pt += 38 * Fe, it += 38 * Ue, et += 38 * Je, St += 38 * Lt, Tt += 38 * zt, At += 38 * Xt, _t += 38 * Wt, G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = he + G + 65535, G = Math.floor(C / 65536), he = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = he + G + 65535, G = Math.floor(C / 65536), he = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), k[0] = j, k[1] = se, k[2] = he, k[3] = xe, k[4] = Te, k[5] = Re, k[6] = nt, k[7] = je, k[8] = pt, k[9] = it, k[10] = et, k[11] = St, k[12] = Tt, k[13] = At, k[14] = _t, k[15] = ht; } function oe(k, U) { D(k, U, U); @@ -40359,14 +40445,14 @@ var K9 = { exports: {} }; for (C = 0; C < 16; C++) k[C] = z[C]; } function Q(k, U, z) { - var C = new Uint8Array(32), G = new Float64Array(80), j, se, de = r(), xe = r(), Te = r(), Re = r(), nt = r(), je = r(); + var C = new Uint8Array(32), G = new Float64Array(80), j, se, he = r(), xe = r(), Te = r(), Re = r(), nt = r(), je = r(); for (se = 0; se < 31; se++) C[se] = U[se]; for (C[31] = U[31] & 127 | 64, C[0] &= 248, I(G, z), se = 0; se < 16; se++) - xe[se] = G[se], Re[se] = de[se] = Te[se] = 0; - for (de[0] = Re[0] = 1, se = 254; se >= 0; --se) - j = C[se >>> 3] >>> (se & 7) & 1, _(de, xe, j), _(Te, Re, j), F(nt, de, Te), ce(de, de, Te), F(Te, xe, Re), ce(xe, xe, Re), oe(Re, nt), oe(je, de), D(de, Te, de), D(Te, xe, nt), F(nt, de, Te), ce(de, de, Te), oe(xe, de), ce(Te, Re, je), D(de, Te, u), F(de, de, Re), D(Te, Te, de), D(de, Re, je), D(Re, xe, G), oe(xe, nt), _(de, xe, j), _(Te, Re, j); + xe[se] = G[se], Re[se] = he[se] = Te[se] = 0; + for (he[0] = Re[0] = 1, se = 254; se >= 0; --se) + j = C[se >>> 3] >>> (se & 7) & 1, _(he, xe, j), _(Te, Re, j), F(nt, he, Te), ce(he, he, Te), F(Te, xe, Re), ce(xe, xe, Re), oe(Re, nt), oe(je, he), D(he, Te, he), D(Te, xe, nt), F(nt, he, Te), ce(he, he, Te), oe(xe, he), ce(Te, Re, je), D(he, Te, u), F(he, he, Re), D(Te, Te, he), D(he, Re, je), D(Re, xe, G), oe(xe, nt), _(he, xe, j), _(Te, Re, j); for (se = 0; se < 16; se++) - G[se + 16] = de[se], G[se + 32] = Te[se], G[se + 48] = xe[se], G[se + 64] = Re[se]; + G[se + 16] = he[se], G[se + 32] = Te[se], G[se + 48] = xe[se], G[se + 64] = Re[se]; var pt = G.subarray(32), it = G.subarray(16); return Z(pt, pt), D(it, it, pt), E(k, it), 0; } @@ -40380,10 +40466,10 @@ var K9 = { exports: {} }; var C = new Uint8Array(32); return Q(C, z, U), V(k, i, C, te); } - var pe = f, ie = g; + var de = f, ie = g; function ue(k, U, z, C, G, j) { var se = new Uint8Array(32); - return re(se, G, j), pe(k, U, z, C, se); + return re(se, G, j), de(k, U, z, C, se); } function ve(k, U, z, C, G, j) { var se = new Uint8Array(32); @@ -40552,26 +40638,26 @@ var K9 = { exports: {} }; 1246189591 ]; function De(k, U, z, C) { - for (var G = new Int32Array(16), j = new Int32Array(16), se, de, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt, ut, ot, Se, Ae, Ve, Fe, Ue, Je, Lt = k[0], zt = k[1], Zt = k[2], Wt = k[3], he = k[4], rr = k[5], dr = k[6], pr = k[7], Qt = U[0], gr = U[1], lr = U[2], Rr = U[3], mr = U[4], yr = U[5], $r = U[6], Br = U[7], Ir = 0; C >= 128; ) { + for (var G = new Int32Array(16), j = new Int32Array(16), se, he, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt, ut, ot, Se, Ae, Ve, Fe, Ue, Je, Lt = k[0], zt = k[1], Xt = k[2], Wt = k[3], le = k[4], rr = k[5], dr = k[6], pr = k[7], Zt = U[0], gr = U[1], lr = U[2], Rr = U[3], mr = U[4], yr = U[5], $r = U[6], Br = U[7], Ir = 0; C >= 128; ) { for (ut = 0; ut < 16; ut++) ot = 8 * ut + Ir, G[ut] = z[ot + 0] << 24 | z[ot + 1] << 16 | z[ot + 2] << 8 | z[ot + 3], j[ut] = z[ot + 4] << 24 | z[ot + 5] << 16 | z[ot + 6] << 8 | z[ot + 7]; for (ut = 0; ut < 80; ut++) - if (se = Lt, de = zt, xe = Zt, Te = Wt, Re = he, nt = rr, je = dr, pt = pr, it = Qt, et = gr, St = lr, Tt = Rr, At = mr, _t = yr, ht = $r, xt = Br, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (he >>> 14 | mr << 18) ^ (he >>> 18 | mr << 14) ^ (mr >>> 9 | he << 23), Ae = (mr >>> 14 | he << 18) ^ (mr >>> 18 | he << 14) ^ (he >>> 9 | mr << 23), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = he & rr ^ ~he & dr, Ae = mr & yr ^ ~mr & $r, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Pe[ut * 2], Ae = Pe[ut * 2 + 1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = G[ut % 16], Ae = j[ut % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, st = Ue & 65535 | Je << 16, bt = Ve & 65535 | Fe << 16, Se = st, Ae = bt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (Lt >>> 28 | Qt << 4) ^ (Qt >>> 2 | Lt << 30) ^ (Qt >>> 7 | Lt << 25), Ae = (Qt >>> 28 | Lt << 4) ^ (Lt >>> 2 | Qt << 30) ^ (Lt >>> 7 | Qt << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Lt & zt ^ Lt & Zt ^ zt & Zt, Ae = Qt & gr ^ Qt & lr ^ gr & lr, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, pt = Ue & 65535 | Je << 16, xt = Ve & 65535 | Fe << 16, Se = Te, Ae = Tt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = st, Ae = bt, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, Te = Ue & 65535 | Je << 16, Tt = Ve & 65535 | Fe << 16, zt = se, Zt = de, Wt = xe, he = Te, rr = Re, dr = nt, pr = je, Lt = pt, gr = it, lr = et, Rr = St, mr = Tt, yr = At, $r = _t, Br = ht, Qt = xt, ut % 16 === 15) + if (se = Lt, he = zt, xe = Xt, Te = Wt, Re = le, nt = rr, je = dr, pt = pr, it = Zt, et = gr, St = lr, Tt = Rr, At = mr, _t = yr, ht = $r, xt = Br, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (le >>> 14 | mr << 18) ^ (le >>> 18 | mr << 14) ^ (mr >>> 9 | le << 23), Ae = (mr >>> 14 | le << 18) ^ (mr >>> 18 | le << 14) ^ (le >>> 9 | mr << 23), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = le & rr ^ ~le & dr, Ae = mr & yr ^ ~mr & $r, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Pe[ut * 2], Ae = Pe[ut * 2 + 1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = G[ut % 16], Ae = j[ut % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, st = Ue & 65535 | Je << 16, bt = Ve & 65535 | Fe << 16, Se = st, Ae = bt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (Lt >>> 28 | Zt << 4) ^ (Zt >>> 2 | Lt << 30) ^ (Zt >>> 7 | Lt << 25), Ae = (Zt >>> 28 | Lt << 4) ^ (Lt >>> 2 | Zt << 30) ^ (Lt >>> 7 | Zt << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Lt & zt ^ Lt & Xt ^ zt & Xt, Ae = Zt & gr ^ Zt & lr ^ gr & lr, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, pt = Ue & 65535 | Je << 16, xt = Ve & 65535 | Fe << 16, Se = Te, Ae = Tt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = st, Ae = bt, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, Te = Ue & 65535 | Je << 16, Tt = Ve & 65535 | Fe << 16, zt = se, Xt = he, Wt = xe, le = Te, rr = Re, dr = nt, pr = je, Lt = pt, gr = it, lr = et, Rr = St, mr = Tt, yr = At, $r = _t, Br = ht, Zt = xt, ut % 16 === 15) for (ot = 0; ot < 16; ot++) Se = G[ot], Ae = j[ot], Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = G[(ot + 9) % 16], Ae = j[(ot + 9) % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, st = G[(ot + 1) % 16], bt = j[(ot + 1) % 16], Se = (st >>> 1 | bt << 31) ^ (st >>> 8 | bt << 24) ^ st >>> 7, Ae = (bt >>> 1 | st << 31) ^ (bt >>> 8 | st << 24) ^ (bt >>> 7 | st << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, st = G[(ot + 14) % 16], bt = j[(ot + 14) % 16], Se = (st >>> 19 | bt << 13) ^ (bt >>> 29 | st << 3) ^ st >>> 6, Ae = (bt >>> 19 | st << 13) ^ (st >>> 29 | bt << 3) ^ (bt >>> 6 | st << 26), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, G[ot] = Ue & 65535 | Je << 16, j[ot] = Ve & 65535 | Fe << 16; - Se = Lt, Ae = Qt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[0], Ae = U[0], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[0] = Lt = Ue & 65535 | Je << 16, U[0] = Qt = Ve & 65535 | Fe << 16, Se = zt, Ae = gr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[1], Ae = U[1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[1] = zt = Ue & 65535 | Je << 16, U[1] = gr = Ve & 65535 | Fe << 16, Se = Zt, Ae = lr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[2], Ae = U[2], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[2] = Zt = Ue & 65535 | Je << 16, U[2] = lr = Ve & 65535 | Fe << 16, Se = Wt, Ae = Rr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[3], Ae = U[3], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[3] = Wt = Ue & 65535 | Je << 16, U[3] = Rr = Ve & 65535 | Fe << 16, Se = he, Ae = mr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[4], Ae = U[4], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[4] = he = Ue & 65535 | Je << 16, U[4] = mr = Ve & 65535 | Fe << 16, Se = rr, Ae = yr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[5], Ae = U[5], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[5] = rr = Ue & 65535 | Je << 16, U[5] = yr = Ve & 65535 | Fe << 16, Se = dr, Ae = $r, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[6], Ae = U[6], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[6] = dr = Ue & 65535 | Je << 16, U[6] = $r = Ve & 65535 | Fe << 16, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[7], Ae = U[7], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[7] = pr = Ue & 65535 | Je << 16, U[7] = Br = Ve & 65535 | Fe << 16, Ir += 128, C -= 128; + Se = Lt, Ae = Zt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[0], Ae = U[0], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[0] = Lt = Ue & 65535 | Je << 16, U[0] = Zt = Ve & 65535 | Fe << 16, Se = zt, Ae = gr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[1], Ae = U[1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[1] = zt = Ue & 65535 | Je << 16, U[1] = gr = Ve & 65535 | Fe << 16, Se = Xt, Ae = lr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[2], Ae = U[2], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[2] = Xt = Ue & 65535 | Je << 16, U[2] = lr = Ve & 65535 | Fe << 16, Se = Wt, Ae = Rr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[3], Ae = U[3], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[3] = Wt = Ue & 65535 | Je << 16, U[3] = Rr = Ve & 65535 | Fe << 16, Se = le, Ae = mr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[4], Ae = U[4], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[4] = le = Ue & 65535 | Je << 16, U[4] = mr = Ve & 65535 | Fe << 16, Se = rr, Ae = yr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[5], Ae = U[5], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[5] = rr = Ue & 65535 | Je << 16, U[5] = yr = Ve & 65535 | Fe << 16, Se = dr, Ae = $r, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[6], Ae = U[6], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[6] = dr = Ue & 65535 | Je << 16, U[6] = $r = Ve & 65535 | Fe << 16, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[7], Ae = U[7], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[7] = pr = Ue & 65535 | Je << 16, U[7] = Br = Ve & 65535 | Fe << 16, Ir += 128, C -= 128; } return C; } function Ce(k, U, z) { - var C = new Int32Array(8), G = new Int32Array(8), j = new Uint8Array(256), se, de = z; - for (C[0] = 1779033703, C[1] = 3144134277, C[2] = 1013904242, C[3] = 2773480762, C[4] = 1359893119, C[5] = 2600822924, C[6] = 528734635, C[7] = 1541459225, G[0] = 4089235720, G[1] = 2227873595, G[2] = 4271175723, G[3] = 1595750129, G[4] = 2917565137, G[5] = 725511199, G[6] = 4215389547, G[7] = 327033209, De(C, G, U, z), z %= 128, se = 0; se < z; se++) j[se] = U[de - z + se]; - for (j[z] = 128, z = 256 - 128 * (z < 112 ? 1 : 0), j[z - 9] = 0, P(j, z - 8, de / 536870912 | 0, de << 3), De(C, G, j, z), se = 0; se < 8; se++) P(k, 8 * se, C[se], G[se]); + var C = new Int32Array(8), G = new Int32Array(8), j = new Uint8Array(256), se, he = z; + for (C[0] = 1779033703, C[1] = 3144134277, C[2] = 1013904242, C[3] = 2773480762, C[4] = 1359893119, C[5] = 2600822924, C[6] = 528734635, C[7] = 1541459225, G[0] = 4089235720, G[1] = 2227873595, G[2] = 4271175723, G[3] = 1595750129, G[4] = 2917565137, G[5] = 725511199, G[6] = 4215389547, G[7] = 327033209, De(C, G, U, z), z %= 128, se = 0; se < z; se++) j[se] = U[he - z + se]; + for (j[z] = 128, z = 256 - 128 * (z < 112 ? 1 : 0), j[z - 9] = 0, M(j, z - 8, he / 536870912 | 0, he << 3), De(C, G, j, z), se = 0; se < 8; se++) M(k, 8 * se, C[se], G[se]); return 0; } function $e(k, U) { - var z = r(), C = r(), G = r(), j = r(), se = r(), de = r(), xe = r(), Te = r(), Re = r(); - ce(z, k[1], k[0]), ce(Re, U[1], U[0]), D(z, z, Re), F(C, k[0], k[1]), F(Re, U[0], U[1]), D(C, C, Re), D(G, k[3], U[3]), D(G, G, d), D(j, k[2], U[2]), F(j, j, j), ce(se, C, z), ce(de, j, G), F(xe, j, G), F(Te, C, z), D(k[0], se, de), D(k[1], Te, xe), D(k[2], xe, de), D(k[3], se, Te); + var z = r(), C = r(), G = r(), j = r(), se = r(), he = r(), xe = r(), Te = r(), Re = r(); + ce(z, k[1], k[0]), ce(Re, U[1], U[0]), D(z, z, Re), F(C, k[0], k[1]), F(Re, U[0], U[1]), D(C, C, Re), D(G, k[3], U[3]), D(G, G, d), D(j, k[2], U[2]), F(j, j, j), ce(se, C, z), ce(he, j, G), F(xe, j, G), F(Te, C, z), D(k[0], se, he), D(k[1], Te, xe), D(k[2], xe, he), D(k[3], se, Te); } function Me(k, U, z) { var C; @@ -40580,7 +40666,7 @@ var K9 = { exports: {} }; } function Ne(k, U) { var z = r(), C = r(), G = r(); - Z(G, U[2]), D(z, U[0], G), D(C, U[1], G), E(k, C), k[31] ^= M(z) << 7; + Z(G, U[2]), D(z, U[0], G), D(C, U[1], G), E(k, C), k[31] ^= P(z) << 7; } function Ke(k, U, z) { var C, G; @@ -40617,36 +40703,36 @@ var K9 = { exports: {} }; _e(k, U); } function at(k, U, z, C) { - var G = new Uint8Array(64), j = new Uint8Array(64), se = new Uint8Array(64), de, xe, Te = new Float64Array(64), Re = [r(), r(), r(), r()]; + var G = new Uint8Array(64), j = new Uint8Array(64), se = new Uint8Array(64), he, xe, Te = new Float64Array(64), Re = [r(), r(), r(), r()]; Ce(G, C, 32), G[0] &= 248, G[31] &= 127, G[31] |= 64; var nt = z + 64; - for (de = 0; de < z; de++) k[64 + de] = U[de]; - for (de = 0; de < 32; de++) k[32 + de] = G[32 + de]; - for (Ce(se, k.subarray(32), z + 32), Ze(se), Le(Re, se), Ne(k, Re), de = 32; de < 64; de++) k[de] = C[de]; - for (Ce(j, k, z + 64), Ze(j), de = 0; de < 64; de++) Te[de] = 0; - for (de = 0; de < 32; de++) Te[de] = se[de]; - for (de = 0; de < 32; de++) + for (he = 0; he < z; he++) k[64 + he] = U[he]; + for (he = 0; he < 32; he++) k[32 + he] = G[32 + he]; + for (Ce(se, k.subarray(32), z + 32), Ze(se), Le(Re, se), Ne(k, Re), he = 32; he < 64; he++) k[he] = C[he]; + for (Ce(j, k, z + 64), Ze(j), he = 0; he < 64; he++) Te[he] = 0; + for (he = 0; he < 32; he++) Te[he] = se[he]; + for (he = 0; he < 32; he++) for (xe = 0; xe < 32; xe++) - Te[de + xe] += j[de] * G[xe]; + Te[he + xe] += j[he] * G[xe]; return _e(k.subarray(32), Te), nt; } function ke(k, U) { - var z = r(), C = r(), G = r(), j = r(), se = r(), de = r(), xe = r(); - return b(k[2], a), I(k[1], U), oe(G, k[1]), D(j, G, l), ce(G, G, k[2]), F(j, k[2], j), oe(se, j), oe(de, se), D(xe, de, se), D(z, xe, G), D(z, z, j), J(z, z), D(z, z, G), D(z, z, j), D(z, z, j), D(k[0], z, j), oe(C, k[0]), D(C, C, j), v(C, G) && D(k[0], k[0], A), oe(C, k[0]), D(C, C, j), v(C, G) ? -1 : (M(k[0]) === U[31] >> 7 && ce(k[0], o, k[0]), D(k[3], k[0], k[1]), 0); + var z = r(), C = r(), G = r(), j = r(), se = r(), he = r(), xe = r(); + return b(k[2], a), I(k[1], U), oe(G, k[1]), D(j, G, l), ce(G, G, k[2]), F(j, k[2], j), oe(se, j), oe(he, se), D(xe, he, se), D(z, xe, G), D(z, z, j), J(z, z), D(z, z, G), D(z, z, j), D(z, z, j), D(k[0], z, j), oe(C, k[0]), D(C, C, j), v(C, G) && D(k[0], k[0], A), oe(C, k[0]), D(C, C, j), v(C, G) ? -1 : (P(k[0]) === U[31] >> 7 && ce(k[0], o, k[0]), D(k[3], k[0], k[1]), 0); } function Qe(k, U, z, C) { - var G, j = new Uint8Array(32), se = new Uint8Array(64), de = [r(), r(), r(), r()], xe = [r(), r(), r(), r()]; + var G, j = new Uint8Array(32), se = new Uint8Array(64), he = [r(), r(), r(), r()], xe = [r(), r(), r(), r()]; if (z < 64 || ke(xe, C)) return -1; for (G = 0; G < z; G++) k[G] = U[G]; for (G = 0; G < 32; G++) k[G + 32] = C[G]; - if (Ce(se, k, z), Ze(se), Ke(de, xe, se), Le(xe, U.subarray(32)), $e(de, xe), Ne(j, de), z -= 64, $(U, 0, j, 0)) { + if (Ce(se, k, z), Ze(se), Ke(he, xe, se), Le(xe, U.subarray(32)), $e(he, xe), Ne(j, he), z -= 64, B(U, 0, j, 0)) { for (G = 0; G < z; G++) k[G] = 0; return -1; } for (G = 0; G < z; G++) k[G] = U[G + 64]; return z; } - var tt = 32, Ye = 24, dt = 32, lt = 16, ct = 32, qt = 32, Jt = 32, Et = 32, er = 32, Xt = Ye, Dt = dt, kt = lt, Ct = 64, gt = 32, Rt = 64, Nt = 32, vt = 64; + var tt = 32, Ye = 24, dt = 32, lt = 16, ct = 32, qt = 32, Yt = 32, Et = 32, er = 32, Jt = Ye, Dt = dt, kt = lt, Ct = 64, gt = 32, Rt = 64, Nt = 32, vt = 64; e.lowlevel = { crypto_core_hsalsa20: V, crypto_stream_xor: Ee, @@ -40656,13 +40742,13 @@ var K9 = { exports: {} }; crypto_onetimeauth: S, crypto_onetimeauth_verify: m, crypto_verify_16: L, - crypto_verify_32: $, + crypto_verify_32: B, crypto_secretbox: f, crypto_secretbox_open: g, crypto_scalarmult: Q, crypto_scalarmult_base: T, crypto_box_beforenm: re, - crypto_box_afternm: pe, + crypto_box_afternm: de, crypto_box: ue, crypto_box_open: ve, crypto_box_keypair: X, @@ -40676,10 +40762,10 @@ var K9 = { exports: {} }; crypto_secretbox_BOXZEROBYTES: lt, crypto_scalarmult_BYTES: ct, crypto_scalarmult_SCALARBYTES: qt, - crypto_box_PUBLICKEYBYTES: Jt, + crypto_box_PUBLICKEYBYTES: Yt, crypto_box_SECRETKEYBYTES: Et, crypto_box_BEFORENMBYTES: er, - crypto_box_NONCEBYTES: Xt, + crypto_box_NONCEBYTES: Jt, crypto_box_ZEROBYTES: Dt, crypto_box_BOXZEROBYTES: kt, crypto_sign_BYTES: Ct, @@ -40708,7 +40794,7 @@ var K9 = { exports: {} }; if (U.length !== Ye) throw new Error("bad nonce size"); } function Ft(k, U) { - if (k.length !== Jt) throw new Error("bad public key size"); + if (k.length !== Yt) throw new Error("bad public key size"); if (U.length !== Et) throw new Error("bad secret key size"); } function rt() { @@ -40750,14 +40836,14 @@ var K9 = { exports: {} }; var G = e.box.before(z, C); return e.secretbox.open(k, U, G); }, e.box.open.after = e.secretbox.open, e.box.keyPair = function() { - var k = new Uint8Array(Jt), U = new Uint8Array(Et); + var k = new Uint8Array(Yt), U = new Uint8Array(Et); return X(k, U), { publicKey: k, secretKey: U }; }, e.box.keyPair.fromSecretKey = function(k) { if (rt(k), k.length !== Et) throw new Error("bad secret key size"); - var U = new Uint8Array(Jt); + var U = new Uint8Array(Yt); return T(U, k), { publicKey: U, secretKey: new Uint8Array(k) }; - }, e.box.publicKeyLength = Jt, e.box.secretKeyLength = Et, e.box.sharedKeyLength = er, e.box.nonceLength = Xt, e.box.overheadLength = e.secretbox.overheadLength, e.sign = function(k, U) { + }, e.box.publicKeyLength = Yt, e.box.secretKeyLength = Et, e.box.sharedKeyLength = er, e.box.nonceLength = Jt, e.box.overheadLength = e.secretbox.overheadLength, e.sign = function(k, U) { if (rt(k, U), U.length !== Rt) throw new Error("bad secret key size"); var z = new Uint8Array(Ct + k.length); @@ -40813,53 +40899,53 @@ var K9 = { exports: {} }; for (G = 0; G < C; G++) z[G] = j[G]; Bt(j); }); - } else typeof M4 < "u" && (k = Wl, k && k.randomBytes && e.setPRNG(function(z, C) { + } else typeof A4 < "u" && (k = Wl, k && k.randomBytes && e.setPRNG(function(z, C) { var G, j = k.randomBytes(C); for (G = 0; G < C; G++) z[G] = j[G]; Bt(j); })); }(); })(t.exports ? t.exports : self.nacl = self.nacl || {}); -})(K9); -var fie = K9.exports; -const yd = /* @__PURE__ */ rs(fie); -var ha; +})(V9); +var pie = V9.exports; +const yd = /* @__PURE__ */ ts(pie); +var fa; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.MANIFEST_NOT_FOUND_ERROR = 2] = "MANIFEST_NOT_FOUND_ERROR", t[t.MANIFEST_CONTENT_ERROR = 3] = "MANIFEST_CONTENT_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(ha || (ha = {})); -var d5; +})(fa || (fa = {})); +var l5; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(d5 || (d5 = {})); +})(l5 || (l5 = {})); var su; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; })(su || (su = {})); -var p5; +var h5; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(p5 || (p5 = {})); -var g5; +})(h5 || (h5 = {})); +var d5; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(g5 || (g5 = {})); -var m5; +})(d5 || (d5 = {})); +var p5; (function(t) { t.MAINNET = "-239", t.TESTNET = "-3"; -})(m5 || (m5 = {})); -function lie(t, e) { +})(p5 || (p5 = {})); +function gie(t, e) { const r = Dl.encodeBase64(t); return e ? encodeURIComponent(r) : r; } -function hie(t, e) { +function mie(t, e) { return e && (t = decodeURIComponent(t)), Dl.decodeBase64(t); } -function die(t, e = !1) { +function vie(t, e = !1) { let r; - return t instanceof Uint8Array ? r = t : (typeof t != "string" && (t = JSON.stringify(t)), r = Dl.decodeUTF8(t)), lie(r, e); + return t instanceof Uint8Array ? r = t : (typeof t != "string" && (t = JSON.stringify(t)), r = Dl.decodeUTF8(t)), gie(r, e); } -function pie(t, e = !1) { - const r = hie(t, e); +function bie(t, e = !1) { + const r = mie(t, e); return { toString() { return Dl.encodeUTF8(r); @@ -40876,15 +40962,15 @@ function pie(t, e = !1) { } }; } -const V9 = { - encode: die, - decode: pie +const G9 = { + encode: vie, + decode: bie }; -function gie(t, e) { +function yie(t, e) { const r = new Uint8Array(t.length + e.length); return r.set(t), r.set(e, t.length), r; } -function mie(t, e) { +function wie(t, e) { if (e >= t.length) throw new Error("Index is out of buffer"); const r = t.slice(0, e), n = t.slice(e); @@ -40922,10 +41008,10 @@ class hv { } encrypt(e, r) { const n = new TextEncoder().encode(e), i = this.createNonce(), s = yd.box(n, i, r, this.keyPair.secretKey); - return gie(i, s); + return yie(i, s); } decrypt(e, r) { - const [n, i] = mie(e, this.nonceLength), s = yd.box.open(i, n, r, this.keyPair.secretKey); + const [n, i] = wie(e, this.nonceLength), s = yd.box.open(i, n, r, this.keyPair.secretKey); if (!s) throw new Error(`Decryption error: message: ${e.toString()} @@ -40955,7 +41041,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ -function vie(t, e) { +function xie(t, e) { var r = {}; for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); if (t != null && typeof Object.getOwnPropertySymbols == "function") @@ -41000,12 +41086,12 @@ class jt extends Error { } } jt.prefix = "[TON_CONNECT_SDK_ERROR]"; -class ly extends jt { +class uy extends jt { get info() { return "Passed DappMetadata is in incorrect format."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, ly.prototype); + super(...e), Object.setPrototypeOf(this, uy.prototype); } } class Ap extends jt { @@ -41024,12 +41110,12 @@ class Pp extends jt { super(...e), Object.setPrototypeOf(this, Pp.prototype); } } -class hy extends jt { +class fy extends jt { get info() { return "Wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, hy.prototype); + super(...e), Object.setPrototypeOf(this, fy.prototype); } } class P0 extends jt { @@ -41040,7 +41126,7 @@ class P0 extends jt { super(...e), Object.setPrototypeOf(this, P0.prototype); } } -function bie(t) { +function _ie(t) { return "jsBridgeKey" in t; } class Mp extends jt { @@ -41067,54 +41153,54 @@ class Cp extends jt { super(...e), Object.setPrototypeOf(this, Cp.prototype); } } -class dy extends jt { +class ly extends jt { get info() { return "There is an attempt to connect to the injected wallet while it is not exists in the webpage."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, dy.prototype); + super(...e), Object.setPrototypeOf(this, ly.prototype); } } -class py extends jt { +class hy extends jt { get info() { return "An error occurred while fetching the wallets list."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, py.prototype); + super(...e), Object.setPrototypeOf(this, hy.prototype); } } -class Pa extends jt { +class Ea extends jt { constructor(...e) { - super(...e), Object.setPrototypeOf(this, Pa.prototype); + super(...e), Object.setPrototypeOf(this, Ea.prototype); } } -const v5 = { - [ha.UNKNOWN_ERROR]: Pa, - [ha.USER_REJECTS_ERROR]: Mp, - [ha.BAD_REQUEST_ERROR]: Ip, - [ha.UNKNOWN_APP_ERROR]: Cp, - [ha.MANIFEST_NOT_FOUND_ERROR]: Pp, - [ha.MANIFEST_CONTENT_ERROR]: Ap +const g5 = { + [fa.UNKNOWN_ERROR]: Ea, + [fa.USER_REJECTS_ERROR]: Mp, + [fa.BAD_REQUEST_ERROR]: Ip, + [fa.UNKNOWN_APP_ERROR]: Cp, + [fa.MANIFEST_NOT_FOUND_ERROR]: Pp, + [fa.MANIFEST_CONTENT_ERROR]: Ap }; -class yie { +class Eie { parseError(e) { - let r = Pa; - return e.code in v5 && (r = v5[e.code] || Pa), new r(e.message); + let r = Ea; + return e.code in g5 && (r = g5[e.code] || Ea), new r(e.message); } } -const wie = new yie(); -class xie { +const Sie = new Eie(); +class Aie { isError(e) { return "error" in e; } } -const b5 = { - [su.UNKNOWN_ERROR]: Pa, +const m5 = { + [su.UNKNOWN_ERROR]: Ea, [su.USER_REJECTS_ERROR]: Mp, [su.BAD_REQUEST_ERROR]: Ip, [su.UNKNOWN_APP_ERROR]: Cp }; -class _ie extends xie { +class Pie extends Aie { convertToRpcRequest(e) { return { method: "sendTransaction", @@ -41122,8 +41208,8 @@ class _ie extends xie { }; } parseAndThrowError(e) { - let r = Pa; - throw e.error.code in b5 && (r = b5[e.error.code] || Pa), new r(e.error.message); + let r = Ea; + throw e.error.code in m5 && (r = m5[e.error.code] || Ea), new r(e.error.message); } convertFromRpcResponse(e) { return { @@ -41131,8 +41217,8 @@ class _ie extends xie { }; } } -const wd = new _ie(); -class Eie { +const wd = new Pie(); +class Mie { constructor(e, r) { this.storage = e, this.storeKey = "ton-connect-storage_http-bridge-gateway::" + r; } @@ -41153,22 +41239,22 @@ class Eie { }); } } -function Sie(t) { +function Iie(t) { return t.slice(-1) === "/" ? t.slice(0, -1) : t; } -function G9(t, e) { - return Sie(t) + "/" + e; +function Y9(t, e) { + return Iie(t) + "/" + e; } -function Aie(t) { +function Cie(t) { if (!t) return !1; const e = new URL(t); return e.protocol === "tg:" || e.hostname === "t.me"; } -function Pie(t) { +function Tie(t) { return t.replaceAll(".", "%2E").replaceAll("-", "%2D").replaceAll("_", "%5F").replaceAll("&", "-").replaceAll("=", "__").replaceAll("%", "--"); } -function Y9(t, e) { +function J9(t, e) { return Mt(this, void 0, void 0, function* () { return new Promise((r, n) => { var i, s; @@ -41200,7 +41286,7 @@ function Zf(t, e) { try { return yield t({ signal: o.signal }); } catch (l) { - u = l, a++, a < i && (yield Y9(s)); + u = l, a++, a < i && (yield J9(s)); } } throw u; @@ -41212,19 +41298,19 @@ function Sn(...t) { } catch { } } -function Lo(...t) { +function No(...t) { try { console.error("[TON_CONNECT_SDK]", ...t); } catch { } } -function Mie(...t) { +function Rie(...t) { try { console.warn("[TON_CONNECT_SDK]", ...t); } catch { } } -function Iie(t, e) { +function Die(t, e) { let r = null, n = null, i = null, s = null, o = null; const a = (p, ...w) => Mt(this, void 0, void 0, function* () { if (s = p ?? null, o == null || o.abort(), o = _s(p), o.signal.aborted) @@ -41232,10 +41318,10 @@ function Iie(t, e) { n = w ?? null; const A = t(o.signal, ...w); i = A; - const P = yield A; - if (i !== A && P !== r) - throw yield e(P), new jt("Resource creation was aborted by a new resource creation"); - return r = P, r; + const M = yield A; + if (i !== A && M !== r) + throw yield e(M), new jt("Resource creation was aborted by a new resource creation"); + return r = M, r; }); return { create: a, @@ -41258,14 +41344,14 @@ function Iie(t, e) { } }), recreate: (p) => Mt(this, void 0, void 0, function* () { - const w = r, A = i, P = n, N = s; - if (yield Y9(p), w === r && A === i && P === n && N === s) - return yield a(s, ...P ?? []); + const w = r, A = i, M = n, N = s; + if (yield J9(p), w === r && A === i && M === n && N === s) + return yield a(s, ...M ?? []); throw new jt("Resource recreation was aborted by a new resource creation"); }) }; } -function Cie(t, e) { +function Oie(t, e) { const r = e == null ? void 0 : e.timeout, n = e == null ? void 0 : e.signal, i = _s(n); return new Promise((s, o) => Mt(this, void 0, void 0, function* () { if (i.signal.aborted) { @@ -41288,7 +41374,7 @@ function Cie(t, e) { } class Vm { constructor(e, r, n, i, s) { - this.bridgeUrl = r, this.sessionId = n, this.listener = i, this.errorsListener = s, this.ssePath = "events", this.postPath = "message", this.heartbeatMessage = "heartbeat", this.defaultTtl = 300, this.defaultReconnectDelay = 2e3, this.defaultResendDelay = 5e3, this.eventSource = Iie((o, a) => Mt(this, void 0, void 0, function* () { + this.bridgeUrl = r, this.sessionId = n, this.listener = i, this.errorsListener = s, this.ssePath = "events", this.postPath = "message", this.heartbeatMessage = "heartbeat", this.defaultTtl = 300, this.defaultReconnectDelay = 2e3, this.defaultResendDelay = 5e3, this.eventSource = Die((o, a) => Mt(this, void 0, void 0, function* () { const u = { bridgeUrl: this.bridgeUrl, ssePath: this.ssePath, @@ -41299,10 +41385,10 @@ class Vm { signal: o, openingDeadlineMS: a }; - return yield Tie(u); + return yield Nie(u); }), (o) => Mt(this, void 0, void 0, function* () { o.close(); - })), this.bridgeGatewayStorage = new Eie(e, r); + })), this.bridgeGatewayStorage = new Mie(e, r); } get isReady() { const e = this.eventSource.current(); @@ -41326,9 +41412,9 @@ class Vm { return Mt(this, void 0, void 0, function* () { const o = {}; typeof i == "number" ? o.ttl = i : (o.ttl = i == null ? void 0 : i.ttl, o.signal = i == null ? void 0 : i.signal, o.attempts = i == null ? void 0 : i.attempts); - const a = new URL(G9(this.bridgeUrl, this.postPath)); + const a = new URL(Y9(this.bridgeUrl, this.postPath)); a.searchParams.append("client_id", this.sessionId), a.searchParams.append("to", r), a.searchParams.append("ttl", ((o == null ? void 0 : o.ttl) || this.defaultTtl).toString()), a.searchParams.append("topic", n); - const u = V9.encode(e); + const u = G9.encode(e); yield Zf((l) => Mt(this, void 0, void 0, function* () { const d = yield this.post(a, u, l.signal); if (!d.ok) @@ -41341,7 +41427,7 @@ class Vm { }); } pause() { - this.eventSource.dispose().catch((e) => Lo(`Bridge pause failed, ${e}`)); + this.eventSource.dispose().catch((e) => No(`Bridge pause failed, ${e}`)); } unPause() { return Mt(this, void 0, void 0, function* () { @@ -41350,7 +41436,7 @@ class Vm { } close() { return Mt(this, void 0, void 0, function* () { - yield this.eventSource.dispose().catch((e) => Lo(`Bridge close failed, ${e}`)); + yield this.eventSource.dispose().catch((e) => No(`Bridge close failed, ${e}`)); }); } setListener(e) { @@ -41401,16 +41487,16 @@ class Vm { }); } } -function Tie(t) { +function Nie(t) { return Mt(this, void 0, void 0, function* () { - return yield Cie((e, r, n) => Mt(this, void 0, void 0, function* () { + return yield Oie((e, r, n) => Mt(this, void 0, void 0, function* () { var i; const o = _s(n.signal).signal; if (o.aborted) { r(new jt("Bridge connection aborted")); return; } - const a = new URL(G9(t.bridgeUrl, t.ssePath)); + const a = new URL(Y9(t.bridgeUrl, t.ssePath)); a.searchParams.append("client_id", t.sessionId); const u = yield t.bridgeGatewayStorage.getLastEventId(); if (u && a.searchParams.append("last_event_id", u), o.aborted) { @@ -41582,7 +41668,7 @@ class Ol { }); } } -const J9 = 2; +const X9 = 2; class Nl { constructor(e, r) { this.storage = e, this.walletConnectionSource = r, this.type = "http", this.standardUniversalLink = "tc://", this.pendingRequests = /* @__PURE__ */ new Map(), this.session = null, this.gateway = null, this.pendingGateways = [], this.listeners = [], this.defaultOpeningDeadlineMS = 12e3, this.defaultRetryTimeoutMS = 2e3, this.connectionStorage = new Ol(e); @@ -41728,7 +41814,7 @@ class Nl { } gatewayListener(e) { return Mt(this, void 0, void 0, function* () { - const r = JSON.parse(this.session.sessionCrypto.decrypt(V9.decode(e.message).toUint8Array(), A0(e.from))); + const r = JSON.parse(this.session.sessionCrypto.decrypt(G9.decode(e.message).toUint8Array(), A0(e.from))); if (Sn("Wallet message received:", r), !("event" in r)) { const i = r.id.toString(), s = this.pendingRequests.get(i); if (!s) { @@ -41741,7 +41827,7 @@ class Nl { if (r.id !== void 0) { const i = yield this.connectionStorage.getLastWalletEventId(); if (i !== void 0 && r.id <= i) { - Lo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `); + No(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `); return; } r.event !== "connect" && (yield this.connectionStorage.storeLastWalletEventId(r.id)); @@ -41774,14 +41860,14 @@ class Nl { }); } generateUniversalLink(e, r) { - return Aie(e) ? this.generateTGUniversalLink(e, r) : this.generateRegularUniversalLink(e, r); + return Cie(e) ? this.generateTGUniversalLink(e, r) : this.generateRegularUniversalLink(e, r); } generateRegularUniversalLink(e, r) { const n = new URL(e); - return n.searchParams.append("v", J9.toString()), n.searchParams.append("id", this.session.sessionCrypto.sessionId), n.searchParams.append("r", JSON.stringify(r)), n.toString(); + return n.searchParams.append("v", X9.toString()), n.searchParams.append("id", this.session.sessionCrypto.sessionId), n.searchParams.append("r", JSON.stringify(r)), n.toString(); } generateTGUniversalLink(e, r) { - const i = this.generateRegularUniversalLink("about:blank", r).split("?")[1], s = "tonconnect-" + Pie(i), o = this.convertToDirectLink(e), a = new URL(o); + const i = this.generateRegularUniversalLink("about:blank", r).split("?")[1], s = "tonconnect-" + Tie(i), o = this.convertToDirectLink(e), a = new URL(o); return a.searchParams.append("startapp", s), a.toString(); } // TODO: Remove this method after all dApps and the wallets-list.json have been updated @@ -41821,15 +41907,15 @@ class Nl { (r = this.gateway) === null || r === void 0 || r.close(), this.pendingGateways.filter((n) => n !== (e == null ? void 0 : e.except)).forEach((n) => n.close()), this.pendingGateways = []; } } -function y5(t, e) { - return X9(t, [e]); +function v5(t, e) { + return Z9(t, [e]); } -function X9(t, e) { +function Z9(t, e) { return !t || typeof t != "object" ? !1 : e.every((r) => r in t); } -function Rie(t) { +function Lie(t) { try { - return !y5(t, "tonconnect") || !y5(t.tonconnect, "walletInfo") ? !1 : X9(t.tonconnect.walletInfo, [ + return !v5(t, "tonconnect") || !v5(t.tonconnect, "walletInfo") ? !1 : Z9(t.tonconnect.walletInfo, [ "name", "app_name", "image", @@ -41873,7 +41959,7 @@ function Tp() { if (!(typeof window > "u")) return window; } -function Die() { +function kie() { const t = Tp(); if (!t) return []; @@ -41883,30 +41969,30 @@ function Die() { return []; } } -function Oie() { +function $ie() { if (!(typeof document > "u")) return document; } -function Nie() { +function Bie() { var t; const e = (t = Tp()) === null || t === void 0 ? void 0 : t.location.origin; return e ? e + "/tonconnect-manifest.json" : ""; } -function Lie() { - if (kie()) +function Fie() { + if (jie()) return localStorage; - if ($ie()) + if (Uie()) throw new jt("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector"); return ou.getInstance(); } -function kie() { +function jie() { try { return typeof localStorage < "u"; } catch { return !1; } } -function $ie() { +function Uie() { return typeof process < "u" && process.versions != null && process.versions.node != null; } class vi { @@ -41914,7 +42000,7 @@ class vi { this.injectedWalletKey = r, this.type = "injected", this.unsubscribeCallback = null, this.listenSubscriptions = !1, this.listeners = []; const n = vi.window; if (!vi.isWindowContainsWallet(n, r)) - throw new dy(); + throw new ly(); this.connectionStorage = new Ol(e), this.injectedWallet = n[r].tonconnect; } static fromStorage(e) { @@ -41930,7 +42016,7 @@ class vi { return vi.isWindowContainsWallet(this.window, e) ? this.window[e].tonconnect.isWalletBrowser : !1; } static getCurrentlyInjectedWallets() { - return this.window ? Die().filter(([n, i]) => Rie(i)).map(([n, i]) => ({ + return this.window ? kie().filter(([n, i]) => Lie(i)).map(([n, i]) => ({ name: i.tonconnect.walletInfo.name, appName: i.tonconnect.walletInfo.app_name, aboutUrl: i.tonconnect.walletInfo.about_url, @@ -41946,7 +42032,7 @@ class vi { return !!e && r in e && typeof e[r] == "object" && "tonconnect" in e[r]; } connect(e) { - this._connect(J9, e); + this._connect(X9, e); } restoreConnection() { return Mt(this, void 0, void 0, function* () { @@ -42030,9 +42116,9 @@ class vi { } } vi.window = Tp(); -class Bie { +class qie { constructor() { - this.localStorage = Lie(); + this.localStorage = Fie(); } getItem(e) { return Mt(this, void 0, void 0, function* () { @@ -42050,16 +42136,16 @@ class Bie { }); } } -function Z9(t) { - return jie(t) && t.injected; +function Q9(t) { + return Wie(t) && t.injected; } -function Fie(t) { - return Z9(t) && t.embedded; +function zie(t) { + return Q9(t) && t.embedded; } -function jie(t) { +function Wie(t) { return "jsBridgeKey" in t; } -const Uie = [ +const Hie = [ { app_name: "telegram-wallet", name: "Wallet", @@ -42274,7 +42360,7 @@ class dv { } getEmbeddedWallet() { return Mt(this, void 0, void 0, function* () { - const r = (yield this.getWallets()).filter(Fie); + const r = (yield this.getWallets()).filter(zie); return r.length !== 1 ? null : r[0]; }); } @@ -42283,17 +42369,17 @@ class dv { let e = []; try { if (e = yield (yield fetch(this.walletsListSource)).json(), !Array.isArray(e)) - throw new py("Wrong wallets list format, wallets list must be an array."); + throw new hy("Wrong wallets list format, wallets list must be an array."); const i = e.filter((s) => !this.isCorrectWalletConfigDTO(s)); - i.length && (Lo(`Wallet(s) ${i.map((s) => s.name).join(", ")} config format is wrong. They were removed from the wallets list.`), e = e.filter((s) => this.isCorrectWalletConfigDTO(s))); + i.length && (No(`Wallet(s) ${i.map((s) => s.name).join(", ")} config format is wrong. They were removed from the wallets list.`), e = e.filter((s) => this.isCorrectWalletConfigDTO(s))); } catch (n) { - Lo(n), e = Uie; + No(n), e = Hie; } let r = []; try { r = vi.getCurrentlyInjectedWallets(); } catch (n) { - Lo(n); + No(n); } return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e), r); }); @@ -42347,7 +42433,7 @@ class M0 extends jt { super(...e), Object.setPrototypeOf(this, M0.prototype); } } -function qie(t, e) { +function Kie(t, e) { const r = t.includes("SendTransaction"), n = t.find((i) => i && typeof i == "object" && i.name === "SendTransaction"); if (!r && !n) throw new M0("Wallet doesn't support SendTransaction feature."); @@ -42356,14 +42442,14 @@ function qie(t, e) { throw new M0(`Wallet is not able to handle such SendTransaction request. Max support messages number is ${n.maxMessages}, but ${e.requiredMessagesNumber} is required.`); return; } - Mie("Connected wallet didn't provide information about max allowed messages in the SendTransaction request. Request may be rejected by the wallet."); + Rie("Connected wallet didn't provide information about max allowed messages in the SendTransaction request. Request may be rejected by the wallet."); } -function zie() { +function Vie() { return { type: "request-version" }; } -function Wie(t) { +function Gie(t) { return { type: "response-version", version: t @@ -42386,16 +42472,16 @@ function Ju(t, e) { custom_data: Object.assign({ chain_id: (u = (a = e == null ? void 0 : e.account) === null || a === void 0 ? void 0 : a.chain) !== null && u !== void 0 ? u : null, provider: (l = e == null ? void 0 : e.provider) !== null && l !== void 0 ? l : null }, Yu(t)) }; } -function Hie(t) { +function Yie(t) { return { type: "connection-started", custom_data: Yu(t) }; } -function Kie(t, e) { +function Jie(t, e) { return Object.assign({ type: "connection-completed", is_success: !0 }, Ju(t, e)); } -function Vie(t, e, r) { +function Xie(t, e, r) { return { type: "connection-error", is_success: !1, @@ -42404,16 +42490,16 @@ function Vie(t, e, r) { custom_data: Yu(t) }; } -function Gie(t) { +function Zie(t) { return { type: "connection-restoring-started", custom_data: Yu(t) }; } -function Yie(t, e) { +function Qie(t, e) { return Object.assign({ type: "connection-restoring-completed", is_success: !0 }, Ju(t, e)); } -function Jie(t, e) { +function ese(t, e) { return { type: "connection-restoring-error", is_success: !1, @@ -42421,7 +42507,7 @@ function Jie(t, e) { custom_data: Yu(t) }; } -function gy(t, e) { +function dy(t, e) { var r, n, i, s; return { valid_until: (r = String(e.validUntil)) !== null && r !== void 0 ? r : null, @@ -42435,19 +42521,19 @@ function gy(t, e) { }) }; } -function Xie(t, e, r) { - return Object.assign(Object.assign({ type: "transaction-sent-for-signature" }, Ju(t, e)), gy(e, r)); +function tse(t, e, r) { + return Object.assign(Object.assign({ type: "transaction-sent-for-signature" }, Ju(t, e)), dy(e, r)); } -function Zie(t, e, r, n) { - return Object.assign(Object.assign({ type: "transaction-signed", is_success: !0, signed_transaction: n.boc }, Ju(t, e)), gy(e, r)); +function rse(t, e, r, n) { + return Object.assign(Object.assign({ type: "transaction-signed", is_success: !0, signed_transaction: n.boc }, Ju(t, e)), dy(e, r)); } -function Qie(t, e, r, n, i) { - return Object.assign(Object.assign({ type: "transaction-signing-failed", is_success: !1, error_message: n, error_code: i ?? null }, Ju(t, e)), gy(e, r)); +function nse(t, e, r, n, i) { + return Object.assign(Object.assign({ type: "transaction-signing-failed", is_success: !1, error_message: n, error_code: i ?? null }, Ju(t, e)), dy(e, r)); } -function ese(t, e, r) { +function ise(t, e, r) { return Object.assign({ type: "disconnection", scope: r }, Ju(t, e)); } -class tse { +class sse { constructor() { this.window = Tp(); } @@ -42481,10 +42567,10 @@ class tse { }); } } -class rse { +class ose { constructor(e) { var r; - this.eventPrefix = "ton-connect-", this.tonConnectUiVersion = null, this.eventDispatcher = (r = e == null ? void 0 : e.eventDispatcher) !== null && r !== void 0 ? r : new tse(), this.tonConnectSdkVersion = e.tonConnectSdkVersion, this.init().catch(); + this.eventPrefix = "ton-connect-", this.tonConnectUiVersion = null, this.eventDispatcher = (r = e == null ? void 0 : e.eventDispatcher) !== null && r !== void 0 ? r : new sse(), this.tonConnectSdkVersion = e.tonConnectSdkVersion, this.init().catch(); } /** * Version of the library. @@ -42513,7 +42599,7 @@ class rse { setRequestVersionHandler() { return Mt(this, void 0, void 0, function* () { yield this.eventDispatcher.addEventListener("ton-connect-request-version", () => Mt(this, void 0, void 0, function* () { - yield this.eventDispatcher.dispatchEvent("ton-connect-response-version", Wie(this.tonConnectSdkVersion)); + yield this.eventDispatcher.dispatchEvent("ton-connect-response-version", Gie(this.tonConnectSdkVersion)); })); }); } @@ -42527,7 +42613,7 @@ class rse { try { yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version", (n) => { e(n.detail.version); - }, { once: !0 }), yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version", zie()); + }, { once: !0 }), yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version", Vie()); } catch (n) { r(n); } @@ -42551,7 +42637,7 @@ class rse { */ trackConnectionStarted(...e) { try { - const r = Hie(this.version, ...e); + const r = Yie(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42562,7 +42648,7 @@ class rse { */ trackConnectionCompleted(...e) { try { - const r = Kie(this.version, ...e); + const r = Jie(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42573,7 +42659,7 @@ class rse { */ trackConnectionError(...e) { try { - const r = Vie(this.version, ...e); + const r = Xie(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42584,7 +42670,7 @@ class rse { */ trackConnectionRestoringStarted(...e) { try { - const r = Gie(this.version, ...e); + const r = Zie(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42595,7 +42681,7 @@ class rse { */ trackConnectionRestoringCompleted(...e) { try { - const r = Yie(this.version, ...e); + const r = Qie(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42606,7 +42692,7 @@ class rse { */ trackConnectionRestoringError(...e) { try { - const r = Jie(this.version, ...e); + const r = ese(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42617,7 +42703,7 @@ class rse { */ trackDisconnection(...e) { try { - const r = ese(this.version, ...e); + const r = ise(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42628,7 +42714,7 @@ class rse { */ trackTransactionSentForSignature(...e) { try { - const r = Xie(this.version, ...e); + const r = tse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42639,7 +42725,7 @@ class rse { */ trackTransactionSigned(...e) { try { - const r = Zie(this.version, ...e); + const r = rse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42650,26 +42736,26 @@ class rse { */ trackTransactionSigningFailed(...e) { try { - const r = Qie(this.version, ...e); + const r = nse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } } } -const nse = "3.0.5"; +const ase = "3.0.5"; class fh { constructor(e) { if (this.walletsList = new dv(), this._wallet = null, this.provider = null, this.statusChangeSubscriptions = [], this.statusChangeErrorSubscriptions = [], this.dappSettings = { - manifestUrl: (e == null ? void 0 : e.manifestUrl) || Nie(), - storage: (e == null ? void 0 : e.storage) || new Bie() + manifestUrl: (e == null ? void 0 : e.manifestUrl) || Bie(), + storage: (e == null ? void 0 : e.storage) || new qie() }, this.walletsList = new dv({ walletsListSource: e == null ? void 0 : e.walletsListSource, cacheTTLMs: e == null ? void 0 : e.walletsListCacheTTLMs - }), this.tracker = new rse({ + }), this.tracker = new ose({ eventDispatcher: e == null ? void 0 : e.eventDispatcher, - tonConnectSdkVersion: nse + tonConnectSdkVersion: ase }), !this.dappSettings.manifestUrl) - throw new ly("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"); + throw new uy("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"); this.bridgeConnectionStorage = new Ol(this.dappSettings.storage), e != null && e.disableAutoPauseConnection || this.addWindowFocusAndBlurSubscriptions(); } /** @@ -42721,7 +42807,7 @@ class fh { var n, i; const s = {}; if (typeof r == "object" && "tonProof" in r && (s.request = r), typeof r == "object" && ("openingDeadlineMS" in r || "signal" in r || "request" in r) && (s.request = r == null ? void 0 : r.request, s.openingDeadlineMS = r == null ? void 0 : r.openingDeadlineMS, s.signal = r == null ? void 0 : r.signal), this.connected) - throw new hy(); + throw new fy(); const o = _s(s == null ? void 0 : s.signal); if ((n = this.abortController) === null || n === void 0 || n.abort(), this.abortController = o, o.signal.aborted) throw new jt("Connection was aborted"); @@ -42777,7 +42863,7 @@ class fh { return; } if (!a) { - Lo("Provider is not restored"), this.tracker.trackConnectionRestoringError("Provider is not restored"); + No("Provider is not restored"), this.tracker.trackConnectionRestoringError("Provider is not restored"); return; } (n = this.provider) === null || n === void 0 || n.closeConnection(), this.provider = a, a.listen(this.walletEventsListener.bind(this)); @@ -42808,10 +42894,10 @@ class fh { const i = _s(n == null ? void 0 : n.signal); if (i.signal.aborted) throw new jt("Transaction sending was aborted"); - this.checkConnection(), qie(this.wallet.device.features, { + this.checkConnection(), Kie(this.wallet.device.features, { requiredMessagesNumber: e.messages.length }), this.tracker.trackTransactionSentForSignature(this.wallet, e); - const { validUntil: s } = e, o = vie(e, ["validUntil"]), a = e.from || this.account.address, u = e.network || this.account.chain, l = yield this.provider.sendRequest(wd.convertToRpcRequest(Object.assign(Object.assign({}, o), { + const { validUntil: s } = e, o = xie(e, ["validUntil"]), a = e.from || this.account.address, u = e.network || this.account.chain, l = yield this.provider.sendRequest(wd.convertToRpcRequest(Object.assign(Object.assign({}, o), { valid_until: s, from: a, network: u @@ -42854,19 +42940,19 @@ class fh { return ((e = this.provider) === null || e === void 0 ? void 0 : e.type) !== "http" ? Promise.resolve() : this.provider.unPause(); } addWindowFocusAndBlurSubscriptions() { - const e = Oie(); + const e = $ie(); if (e) try { e.addEventListener("visibilitychange", () => { e.hidden ? this.pauseConnection() : this.unPauseConnection().catch(); }); } catch (r) { - Lo("Cannot subscribe to the document.visibilitychange: ", r); + No("Cannot subscribe to the document.visibilitychange: ", r); } } createProvider(e) { let r; - return !Array.isArray(e) && bie(e) ? r = new vi(this.dappSettings.storage, e.jsBridgeKey) : r = new Nl(this.dappSettings.storage, e), r.listen(this.walletEventsListener.bind(this)), r; + return !Array.isArray(e) && _ie(e) ? r = new vi(this.dappSettings.storage, e.jsBridgeKey) : r = new Nl(this.dappSettings.storage, e), r.listen(this.walletEventsListener.bind(this)), r; } walletEventsListener(e) { switch (e.event) { @@ -42899,9 +42985,9 @@ class fh { }), this.wallet = i, this.tracker.trackConnectionCompleted(i); } onWalletConnectError(e) { - const r = wie.parseError(e); + const r = Sie.parseError(e); if (this.statusChangeErrorSubscriptions.forEach((n) => n(r)), Sn(r), this.tracker.trackConnectionError(e.message, e.code), r instanceof Pp || r instanceof Ap) - throw Lo(r), r; + throw No(r), r; } onWalletDisconnected(e) { this.tracker.trackDisconnection(this.wallet, e), this.wallet = null; @@ -42934,21 +43020,21 @@ for (let t = 0; t <= 255; t++) { } function Gm(t) { const { children: e, onClick: r } = t; - return /* @__PURE__ */ fe.jsx("button", { onClick: r, className: "xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center", children: e }); + return /* @__PURE__ */ pe.jsx("button", { onClick: r, className: "xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center", children: e }); } -function Q9(t) { - const { wallet: e, connector: r, loading: n } = t, i = oi(null), s = oi(), [o, a] = Gt(), [u, l] = Gt(), [d, p] = Gt("connect"), [w, A] = Gt(!1), [P, N] = Gt(); +function eA(t) { + const { wallet: e, connector: r, loading: n } = t, i = Un(null), s = Un(), [o, a] = Qt(), [u, l] = Qt(), [d, p] = Qt("connect"), [w, A] = Qt(!1), [M, N] = Qt(); function L(K) { var ge; (ge = s.current) == null || ge.update({ data: K }); } - async function $() { + async function B() { A(!0); try { a(""); - const K = await qo.getNonce({ account_type: "block_chain" }); + const K = await Ta.getNonce({ account_type: "block_chain" }); if ("universalLink" in e && e.universalLink) { const ge = r.connect({ universalLink: e.universalLink, @@ -42964,8 +43050,8 @@ function Q9(t) { } A(!1); } - function B() { - s.current = new B9({ + function $() { + s.current = new F9({ width: 264, height: 264, margin: 0, @@ -42989,49 +43075,49 @@ function Q9(t) { } function W() { if ("deepLink" in e) { - if (!e.deepLink || !P) return; - const K = new URL(P), ge = `${e.deepLink}${K.search}`; + if (!e.deepLink || !M) return; + const K = new URL(M), ge = `${e.deepLink}${K.search}`; window.open(ge); } } function V() { - "universalLink" in e && e.universalLink && /t.me/.test(e.universalLink) && window.open(P); + "universalLink" in e && e.universalLink && /t.me/.test(e.universalLink) && window.open(M); } - const te = Ni(() => !!("deepLink" in e && e.deepLink), [e]), R = Ni(() => !!("universalLink" in e && e.universalLink && /t.me/.test(e.universalLink)), [e]); + const te = wi(() => !!("deepLink" in e && e.deepLink), [e]), R = wi(() => !!("universalLink" in e && e.universalLink && /t.me/.test(e.universalLink)), [e]); return Dn(() => { - B(), $(); - }, []), /* @__PURE__ */ fe.jsxs(so, { children: [ - /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ fe.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), - /* @__PURE__ */ fe.jsxs("div", { className: "xc-text-center xc-mb-6", children: [ - /* @__PURE__ */ fe.jsxs("div", { className: "xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1", children: [ - /* @__PURE__ */ fe.jsx("div", { className: "xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center", ref: i }), - /* @__PURE__ */ fe.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: w ? /* @__PURE__ */ fe.jsx(_a, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ fe.jsx("img", { className: "xc-h-10 xc-w-10 xc-rounded-md", src: e.imageUrl }) }) + $(), B(); + }, []), /* @__PURE__ */ pe.jsxs(Ms, { children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ pe.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), + /* @__PURE__ */ pe.jsxs("div", { className: "xc-text-center xc-mb-6", children: [ + /* @__PURE__ */ pe.jsxs("div", { className: "xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1", children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center", ref: i }), + /* @__PURE__ */ pe.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: w ? /* @__PURE__ */ pe.jsx(mc, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ pe.jsx("img", { className: "xc-h-10 xc-w-10 xc-rounded-md", src: e.imageUrl }) }) ] }), - /* @__PURE__ */ fe.jsx("p", { className: "xc-text-center", children: "Scan the QR code below with your phone's camera. " }) + /* @__PURE__ */ pe.jsx("p", { className: "xc-text-center", children: "Scan the QR code below with your phone's camera. " }) ] }), - /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-justify-center xc-gap-2", children: [ - n && /* @__PURE__ */ fe.jsx(_a, { className: "xc-animate-spin" }), - !w && !n && /* @__PURE__ */ fe.jsxs(fe.Fragment, { children: [ - Z9(e) && /* @__PURE__ */ fe.jsxs(Gm, { onClick: H, children: [ - /* @__PURE__ */ fe.jsx(pZ, { className: "xc-opacity-80" }), + /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-justify-center xc-gap-2", children: [ + n && /* @__PURE__ */ pe.jsx(mc, { className: "xc-animate-spin" }), + !w && !n && /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ + Q9(e) && /* @__PURE__ */ pe.jsxs(Gm, { onClick: H, children: [ + /* @__PURE__ */ pe.jsx(gZ, { className: "xc-opacity-80" }), "Extension" ] }), - te && /* @__PURE__ */ fe.jsxs(Gm, { onClick: W, children: [ - /* @__PURE__ */ fe.jsx(KS, { className: "xc-opacity-80" }), + te && /* @__PURE__ */ pe.jsxs(Gm, { onClick: W, children: [ + /* @__PURE__ */ pe.jsx(HS, { className: "xc-opacity-80" }), "Desktop" ] }), - R && /* @__PURE__ */ fe.jsx(Gm, { onClick: V, children: "Telegram Mini App" }) + R && /* @__PURE__ */ pe.jsx(Gm, { onClick: V, children: "Telegram Mini App" }) ] }) ] }) ] }); } -function ise(t) { - const [e, r] = Gt(""), [n, i] = Gt(), [s, o] = Gt(), a = fy(), [u, l] = Gt(!1); +function cse(t) { + const [e, r] = Qt(""), [n, i] = Qt(), [s, o] = Qt(), a = cy(), [u, l] = Qt(!1); async function d(w) { - var P, N; - if (!w || !((P = w.connectItems) != null && P.tonProof)) return; + var M, N; + if (!w || !((M = w.connectItems) != null && M.tonProof)) return; l(!0); - const A = await qo.tonLogin({ + const A = await Ta.tonLogin({ account_type: "block_chain", connector: "codatta_ton", account_enum: "C", @@ -43060,17 +43146,17 @@ function ise(t) { function p(w) { r("connect"), i(w); } - return /* @__PURE__ */ fe.jsxs(so, { children: [ - e === "select" && /* @__PURE__ */ fe.jsx( - W9, + return /* @__PURE__ */ pe.jsxs(Ms, { children: [ + e === "select" && /* @__PURE__ */ pe.jsx( + H9, { connector: s, onSelect: p, onBack: t.onBack } ), - e === "connect" && /* @__PURE__ */ fe.jsx( - Q9, + e === "connect" && /* @__PURE__ */ pe.jsx( + eA, { connector: s, wallet: n, @@ -43080,8 +43166,8 @@ function ise(t) { ) ] }); } -function eA(t) { - const { children: e, className: r } = t, n = oi(null), [i, s] = pv.useState(0); +function tA(t) { + const { children: e, className: r } = t, n = Un(null), [i, s] = pv.useState(0); function o() { var a; try { @@ -43099,7 +43185,7 @@ function eA(t) { return a.observe(n.current, { childList: !0, subtree: !0 }), () => a.disconnect(); }, []), Dn(() => { console.log("maxHeight", i); - }, [i]), /* @__PURE__ */ fe.jsx( + }, [i]), /* @__PURE__ */ pe.jsx( "div", { ref: n, @@ -43113,78 +43199,78 @@ function eA(t) { } ); } -function sse() { - return /* @__PURE__ */ fe.jsxs("svg", { width: "121", height: "120", viewBox: "0 0 121 120", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [ - /* @__PURE__ */ fe.jsx("rect", { x: "0.5", width: "120", height: "120", rx: "60", fill: "#404049" }), - /* @__PURE__ */ fe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z", fill: "#252532" }), - /* @__PURE__ */ fe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z", fill: "#252532" }), - /* @__PURE__ */ fe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z", fill: "#404049" }), - /* @__PURE__ */ fe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z", stroke: "#77777D", "stroke-width": "2" }), - /* @__PURE__ */ fe.jsx("path", { d: "M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829", stroke: "#77777D", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) +function use() { + return /* @__PURE__ */ pe.jsxs("svg", { width: "121", height: "120", viewBox: "0 0 121 120", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [ + /* @__PURE__ */ pe.jsx("rect", { x: "0.5", width: "120", height: "120", rx: "60", fill: "#404049" }), + /* @__PURE__ */ pe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z", fill: "#252532" }), + /* @__PURE__ */ pe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z", fill: "#252532" }), + /* @__PURE__ */ pe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z", fill: "#404049" }), + /* @__PURE__ */ pe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z", stroke: "#77777D", "stroke-width": "2" }), + /* @__PURE__ */ pe.jsx("path", { d: "M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829", stroke: "#77777D", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) ] }); } -function tA(t) { - const { wallets: e } = mp(), [r, n] = Gt(), i = Ni(() => r ? e.filter((a) => a.key.toLowerCase().includes(r.toLowerCase())) : e, [r]); +function rA(t) { + const { wallets: e } = mp(), [r, n] = Qt(), i = wi(() => r ? e.filter((a) => a.key.toLowerCase().includes(r.toLowerCase())) : e, [r]); function s(a) { t.onSelectWallet(a); } function o(a) { n(a.target.value); } - return /* @__PURE__ */ fe.jsxs(so, { children: [ - /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ fe.jsx(Pc, { title: "Select wallet", onBack: t.onBack }) }), - /* @__PURE__ */ fe.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ - /* @__PURE__ */ fe.jsx(GS, { className: "xc-shrink-0 xc-opacity-50" }), - /* @__PURE__ */ fe.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: o }) + return /* @__PURE__ */ pe.jsxs(Ms, { children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ pe.jsx(Pc, { title: "Select wallet", onBack: t.onBack }) }), + /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ + /* @__PURE__ */ pe.jsx(KS, { className: "xc-shrink-0 xc-opacity-50" }), + /* @__PURE__ */ pe.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: o }) ] }), - /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: i.length ? i.map((a) => /* @__PURE__ */ fe.jsx( - x9, + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: i.length ? i.map((a) => /* @__PURE__ */ pe.jsx( + y9, { wallet: a, onClick: s }, `feature-${a.key}` - )) : /* @__PURE__ */ fe.jsx(sse, {}) }) + )) : /* @__PURE__ */ pe.jsx(use, {}) }) ] }); } -function voe(t) { - const { onLogin: e, header: r, showEmailSignIn: n = !0, showMoreWallets: i = !0, showTonConnect: s = !0, showFeaturedWallets: o = !0 } = t, [a, u] = Gt(""), [l, d] = Gt(null), [p, w] = Gt(""); - function A($) { - d($), u("evm-wallet"); +function woe(t) { + const { onLogin: e, header: r, showEmailSignIn: n = !0, showMoreWallets: i = !0, showTonConnect: s = !0, showFeaturedWallets: o = !0 } = t, [a, u] = Qt(""), [l, d] = Qt(null), [p, w] = Qt(""); + function A(B) { + d(B), u("evm-wallet"); } - function P($) { - u("email"), w($); + function M(B) { + u("email"), w(B); } - async function N($) { - await e($); + async function N(B) { + await e(B); } function L() { u("ton-wallet"); } return Dn(() => { u("index"); - }, []), /* @__PURE__ */ fe.jsx(Fne, { config: t.config, children: /* @__PURE__ */ fe.jsxs(eA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ - a === "evm-wallet" && /* @__PURE__ */ fe.jsx( - aie, + }, []), /* @__PURE__ */ pe.jsx(Cne, { config: t.config, children: /* @__PURE__ */ pe.jsxs(tA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ + a === "evm-wallet" && /* @__PURE__ */ pe.jsx( + lie, { onBack: () => u("index"), onLogin: N, wallet: l } ), - a === "ton-wallet" && /* @__PURE__ */ fe.jsx( - ise, + a === "ton-wallet" && /* @__PURE__ */ pe.jsx( + cse, { onBack: () => u("index"), onLogin: N } ), - a === "email" && /* @__PURE__ */ fe.jsx(jne, { email: p, onBack: () => u("index"), onLogin: N }), - a === "index" && /* @__PURE__ */ fe.jsx( - C9, + a === "email" && /* @__PURE__ */ pe.jsx(Wne, { email: p, onBack: () => u("index"), onLogin: N }), + a === "index" && /* @__PURE__ */ pe.jsx( + M9, { header: r, - onEmailConfirm: P, + onEmailConfirm: M, onSelectWallet: A, onSelectMoreWallets: () => { u("all-wallet"); @@ -43198,8 +43284,8 @@ function voe(t) { } } ), - a === "all-wallet" && /* @__PURE__ */ fe.jsx( - tA, + a === "all-wallet" && /* @__PURE__ */ pe.jsx( + rA, { onBack: () => u("index"), onSelectWallet: A @@ -43207,101 +43293,48 @@ function voe(t) { ) ] }) }); } -function ose(t) { - const { wallet: e, onConnect: r } = t, [n, i] = Gt(e.installed ? "connect" : "qr"); +function fse(t) { + const { wallet: e, onConnect: r } = t, [n, i] = Qt(e.installed ? "connect" : "qr"); async function s(o, a) { await r(o, a); } - return /* @__PURE__ */ fe.jsxs(so, { children: [ - /* @__PURE__ */ fe.jsx("div", { className: "mb-6", children: /* @__PURE__ */ fe.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), - n === "qr" && /* @__PURE__ */ fe.jsx( - U9, + return /* @__PURE__ */ pe.jsxs(Ms, { children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ pe.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), + n === "qr" && /* @__PURE__ */ pe.jsx( + q9, { wallet: e, onGetExtension: () => i("get-extension"), onSignFinish: s } ), - n === "connect" && /* @__PURE__ */ fe.jsx( - q9, + n === "connect" && /* @__PURE__ */ pe.jsx( + z9, { onShowQrCode: () => i("qr"), wallet: e, onSignFinish: s } ), - n === "get-extension" && /* @__PURE__ */ fe.jsx(z9, { wallet: e }) - ] }); -} -function ase(t) { - const { email: e } = t, [r, n] = Gt(0), [i, s] = Gt(!1), [o, a] = Gt(!1), [u, l] = Gt(""), [d, p] = Gt(""); - async function w() { - n(60); - const N = setInterval(() => { - n((L) => L === 0 ? (clearInterval(N), 0) : L - 1); - }, 1e3); - } - async function A(N) { - a(!0); - try { - l(""), await qo.getEmailCode({ account_type: "email", email: N }), w(); - } catch (L) { - l(L.message); - } - a(!1); - } - Dn(() => { - e && A(e); - }, [e]); - async function P(N) { - if (p(""), !(N.length < 6)) { - s(!0); - try { - await t.onInputCode(e, N); - } catch (L) { - p(L.message); - } - s(!1); - } - } - return /* @__PURE__ */ fe.jsxs(so, { children: [ - /* @__PURE__ */ fe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ - /* @__PURE__ */ fe.jsx(VS, { className: "xc-mb-4", size: 60 }), - /* @__PURE__ */ fe.jsx("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16", children: u ? /* @__PURE__ */ fe.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ fe.jsx("p", { className: "xc-px-8", children: u }) }) : o ? /* @__PURE__ */ fe.jsx(_a, { className: "xc-animate-spin" }) : /* @__PURE__ */ fe.jsxs(fe.Fragment, { children: [ - /* @__PURE__ */ fe.jsx("p", { className: "xc-text-lg xc-mb-1", children: "We’ve sent a verification code to" }), - /* @__PURE__ */ fe.jsx("p", { className: "xc-font-bold xc-text-center", children: e }) - ] }) }), - /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-2 xc-h-12", children: /* @__PURE__ */ fe.jsx(L9, { spinning: i, className: "xc-rounded-xl", children: /* @__PURE__ */ fe.jsx(cy, { maxLength: 6, onChange: P, disabled: i, className: "disabled:xc-opacity-20", children: /* @__PURE__ */ fe.jsx(uy, { children: /* @__PURE__ */ fe.jsxs("div", { className: Js("xc-flex xc-gap-2", i ? "xc-opacity-20" : ""), children: [ - /* @__PURE__ */ fe.jsx(Ri, { index: 0 }), - /* @__PURE__ */ fe.jsx(Ri, { index: 1 }), - /* @__PURE__ */ fe.jsx(Ri, { index: 2 }), - /* @__PURE__ */ fe.jsx(Ri, { index: 3 }), - /* @__PURE__ */ fe.jsx(Ri, { index: 4 }), - /* @__PURE__ */ fe.jsx(Ri, { index: 5 }) - ] }) }) }) }) }), - d && /* @__PURE__ */ fe.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ fe.jsx("p", { children: d }) }) - ] }), - /* @__PURE__ */ fe.jsxs("div", { className: "xc-text-center xc-text-sm xc-text-gray-400", children: [ - "Not get it? ", - r ? `Recend in ${r}s` : /* @__PURE__ */ fe.jsx("button", { onClick: () => A(e), children: "Send again" }) - ] }) + n === "get-extension" && /* @__PURE__ */ pe.jsx(W9, { wallet: e }) ] }); } -function cse(t) { - const { email: e } = t; - return /* @__PURE__ */ fe.jsxs(so, { children: [ - /* @__PURE__ */ fe.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ fe.jsx(Pc, { title: "Sign in with email", onBack: t.onBack }) }), - /* @__PURE__ */ fe.jsx(ase, { email: e, onInputCode: t.onInputCode }) +function lse(t) { + const { email: e } = t, [r, n] = Qt("captcha"); + return /* @__PURE__ */ pe.jsxs(Ms, { children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ pe.jsx(Pc, { title: "Sign in with email", onBack: t.onBack }) }), + r === "captcha" && /* @__PURE__ */ pe.jsx($9, { email: e, onCodeSend: () => n("verify-email") }), + r === "verify-email" && /* @__PURE__ */ pe.jsx(k9, { email: e, onInputCode: t.onInputCode, onResendCode: () => n("captcha") }) ] }); } -function boe(t) { +function xoe(t) { const { onEvmWalletConnect: e, onTonWalletConnect: r, onEmailConnect: n, config: i = { showEmailSignIn: !1, showFeaturedWallets: !0, showMoreWallets: !0, showTonConnect: !0 - } } = t, [s, o] = Gt(""), [a, u] = Gt(), [l, d] = Gt(), p = oi(), [w, A] = Gt(""); - function P(H) { + } } = t, [s, o] = Qt(""), [a, u] = Qt(), [l, d] = Qt(), p = Un(), [w, A] = Qt(""); + function M(H) { u(H), o("evm-wallet-connect"); } function N(H) { @@ -43314,10 +43347,10 @@ function boe(t) { connect_info: W }), o("index"); } - function $(H) { + function B(H) { d(H), o("ton-wallet-connect"); } - async function B(H) { + async function $(H) { H && await r({ chain_type: "ton", client: p.current, @@ -43328,46 +43361,46 @@ function boe(t) { p.current = new fh({ manifestUrl: "https://static.codatta.io/static/tonconnect-manifest.json?v=2" }); - const H = p.current.onStatusChange(B); + const H = p.current.onStatusChange($); return o("index"), H; - }, []), /* @__PURE__ */ fe.jsxs(eA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ - s === "evm-wallet-select" && /* @__PURE__ */ fe.jsx( - tA, + }, []), /* @__PURE__ */ pe.jsxs(tA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ + s === "evm-wallet-select" && /* @__PURE__ */ pe.jsx( + rA, { onBack: () => o("index"), - onSelectWallet: P + onSelectWallet: M } ), - s === "evm-wallet-connect" && /* @__PURE__ */ fe.jsx( - ose, + s === "evm-wallet-connect" && /* @__PURE__ */ pe.jsx( + fse, { onBack: () => o("index"), onConnect: L, wallet: a } ), - s === "ton-wallet-select" && /* @__PURE__ */ fe.jsx( - W9, + s === "ton-wallet-select" && /* @__PURE__ */ pe.jsx( + H9, { connector: p.current, - onSelect: $, + onSelect: B, onBack: () => o("index") } ), - s === "ton-wallet-connect" && /* @__PURE__ */ fe.jsx( - Q9, + s === "ton-wallet-connect" && /* @__PURE__ */ pe.jsx( + eA, { connector: p.current, wallet: l, onBack: () => o("index") } ), - s === "email-connect" && /* @__PURE__ */ fe.jsx(cse, { email: w, onBack: () => o("index"), onInputCode: n }), - s === "index" && /* @__PURE__ */ fe.jsx( - C9, + s === "email-connect" && /* @__PURE__ */ pe.jsx(lse, { email: w, onBack: () => o("index"), onInputCode: n }), + s === "index" && /* @__PURE__ */ pe.jsx( + M9, { onEmailConfirm: N, - onSelectWallet: P, + onSelectWallet: M, onSelectMoreWallets: () => o("evm-wallet-select"), onSelectTonConnect: () => o("ton-wallet-select"), config: i @@ -43376,17 +43409,17 @@ function boe(t) { ] }); } export { - goe as C, - T5 as H, - oZ as a, + boe as C, + I5 as H, + aZ as a, Ll as b, - dse as c, - voe as d, + mse as c, + woe as d, Hd as e, - boe as f, - hse as h, - pse as r, - i4 as s, + xoe as f, + gse as h, + vse as r, + r4 as s, C0 as t, mp as u }; diff --git a/dist/secp256k1-DxcrBxlU.js b/dist/secp256k1-ChY4PDp8.js similarity index 99% rename from dist/secp256k1-DxcrBxlU.js rename to dist/secp256k1-ChY4PDp8.js index fdaaab4..5c51d0f 100644 --- a/dist/secp256k1-DxcrBxlU.js +++ b/dist/secp256k1-ChY4PDp8.js @@ -1,4 +1,4 @@ -import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-DYrF27mZ.js"; +import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-CpxLUVHd.js"; class Kt extends ee { constructor(n, t) { super(), this.finished = !1, this.destroyed = !1, ne(n); diff --git a/lib/api/account.api.ts b/lib/api/account.api.ts index 0c52357..360d192 100644 --- a/lib/api/account.api.ts +++ b/lib/api/account.api.ts @@ -104,8 +104,10 @@ class AccountApi { return data.data } - public async getEmailCode(props: { account_type: TAccountType , email: string}) { - const { data } = await this.request.post<{ data: string }>(`${this._apiBase}/api/v2/user/get_code`, props) + public async getEmailCode(props: { account_type: TAccountType , email: string}, captcha:string) { + const { data } = await this.request.post<{ data: string }>(`${this._apiBase}/api/v2/user/get_code`, props, { + headers: {'Captcha-Param': captcha} + }) return data.data } diff --git a/lib/api/request.ts b/lib/api/request.ts index 7f35196..ff95236 100644 --- a/lib/api/request.ts +++ b/lib/api/request.ts @@ -23,8 +23,27 @@ function responseBaseInterceptor(res: AxiosResponse) { } } +function responseErrorInterceptor(error: AxiosError<{errorMessage:string, errorCode:string | number}>) { + console.log(error) + const responseData = error.response?.data + if (responseData) { + console.log(responseData, 'responseData') + const err = new AxiosError( + responseData.errorMessage, + error.code, + error.config, + error.request, + error.response + ) + return Promise.reject(err) + } else { + return Promise.reject(error) + } +} + request.interceptors.response.use( responseBaseInterceptor, + responseErrorInterceptor ) export default request diff --git a/lib/codatta-connect-context-provider.tsx b/lib/codatta-connect-context-provider.tsx index d9aba6b..ec02c11 100644 --- a/lib/codatta-connect-context-provider.tsx +++ b/lib/codatta-connect-context-provider.tsx @@ -112,7 +112,7 @@ export function CodattaConnectContextProvider(props: CodattaConnectContextProvid if (lastUsedInfo.provider === 'UniversalProvider') { const provider = await UniversalProvider.init(walletConnectConfig) if (provider.session) lastUsedWallet.setUniversalProvider(provider) - } + } setLastUsedWallet(lastUsedWallet) } } catch (err) { diff --git a/lib/codatta-signin.tsx b/lib/codatta-signin.tsx index 67d22af..165714e 100644 --- a/lib/codatta-signin.tsx +++ b/lib/codatta-signin.tsx @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react' import SigninIndex from './components/signin-index' -import EmailLoginWidget from './components/email-login' +import EmailLoginWidget from './components/email-login-widget' import EvmWalletLoginWidget from './components/evm-wallet-login-widget' import TonWalletLoginWidget from './components/ton-wallet-login-widget' import AnimateContainer from './components/animate-container' diff --git a/lib/components/email-captcha.tsx b/lib/components/email-captcha.tsx new file mode 100644 index 0000000..4f82602 --- /dev/null +++ b/lib/components/email-captcha.tsx @@ -0,0 +1,78 @@ +import { useEffect, useMemo, useRef, useState } from "react" +import TransitionEffect from "./transition-effect" +import accountApi from "@/api/account.api" +import { Loader2, UserCheck2Icon } from 'lucide-react' + +export default function EmailCaptcha(props: { email: string, onCodeSend: () => void }) { + const { email } = props + const [sendingCode, setSendingCode] = useState(false) + const [getCodeError, setGetCodeError] = useState('') + + const buttonId = useMemo(() => { + return `xn-btn-${new Date().getTime()}` + }, [email]) + + async function sendEmailCode(email: string, captcha: string) { + setSendingCode(true) + try { + setGetCodeError('') + await accountApi.getEmailCode({ account_type: 'email', email }, captcha) + } catch (err: any) { + setGetCodeError(err.message) + } + setSendingCode(false) + } + + async function captchaVerifyCallback(captchaVerifyParam: object) { + try { + await sendEmailCode(email, JSON.stringify(captchaVerifyParam)) + return { captchaResult: true, bizResult: true } + } catch (err: any) { + setGetCodeError(err.message) + return { captchaResult: false, bizResult: false } + } + } + + async function onBizResultCallback(result: boolean) { + if (result) { props.onCodeSend() } + } + + const captcha = useRef() + function getInstance(instance: unknown) { + captcha.current = instance; + } + + useEffect(() => { + if (!email) return + window.initAliyunCaptcha({ + SceneId: 'tqyu8129d', + prefix: '1mfsn5f', + mode: 'popup', + element: '#captcha-element', + button: `#${buttonId}`, + captchaVerifyCallback: captchaVerifyCallback, + onBizResultCallback: onBizResultCallback, + getInstance: getInstance, + slideStyle: { + width: 360, + height: 40, + }, + language: 'en', + region: 'cn' + }) + + return () => { + document.getElementById('aliyunCaptcha-mask')?.remove(); + document.getElementById('aliyunCaptcha-window-popup')?.remove(); + } + }, [email]) + + return +
+ + +
+ {getCodeError &&

{getCodeError}

} + + +} \ No newline at end of file diff --git a/lib/components/email-connect-widget.tsx b/lib/components/email-connect-widget.tsx index b15ceac..51debcb 100644 --- a/lib/components/email-connect-widget.tsx +++ b/lib/components/email-connect-widget.tsx @@ -2,6 +2,8 @@ import TransitionEffect from './transition-effect' import ControlHead from './control-head' import EmailConnect from './email-connect' +import { useState } from 'react' +import EmailCaptcha from './email-captcha' export default function EmailConnectWidget(props: { email: string @@ -9,13 +11,16 @@ export default function EmailConnectWidget(props: { onBack: () => void }) { const { email } = props + const [step, setStep] = useState<'captcha' | 'verify-email'>('captcha') + return (
- + {step === 'captcha' && setStep('verify-email')} />} + {step === 'verify-email' && setStep('captcha')}>}
) } diff --git a/lib/components/email-connect.tsx b/lib/components/email-connect.tsx index e0040b4..315e619 100644 --- a/lib/components/email-connect.tsx +++ b/lib/components/email-connect.tsx @@ -1,22 +1,22 @@ import TransitionEffect from './transition-effect' -import { useEffect, useState } from 'react' +import { useEffect, useRef, useState } from 'react' import { InputOTP, InputOTPGroup, InputOTPSlot } from './ui/input-otp' -import accountApi from '@/api/account.api' -import { Loader2, Mail } from 'lucide-react' +import { Mail } from 'lucide-react' import Spin from './ui/spin' import { cn } from '@udecode/cn' +import 'https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js' export default function EmailConnect(props: { email: string - onInputCode: (email:string, code:string) => Promise + onInputCode: (email: string, code: string) => Promise + onResendCode: () => void }) { const { email } = props const [count, setCount] = useState(0) const [loading, setLoading] = useState(false) - const [sendingCode, setSendingCode] = useState(false) - const [getCodeError, setGetCodeError] = useState('') const [connectError, setConnectError] = useState('') + const sendCodeButton = useRef(null) async function startCountDown() { setCount(60) @@ -31,23 +31,6 @@ export default function EmailConnect(props: { }, 1000) } - async function sendEmailCode(email: string) { - setSendingCode(true) - try { - setGetCodeError('') - await accountApi.getEmailCode({ account_type: 'email', email }) - startCountDown() - } catch (err: any) { - setGetCodeError(err.message) - } - setSendingCode(false) - } - - useEffect(() => { - if (!email) return - sendEmailCode(email) - }, [email]) - async function handleOTPChange(value: string) { setConnectError('') if (value.length < 6) return @@ -60,17 +43,17 @@ export default function EmailConnect(props: { setLoading(false) } + useEffect(() => { + startCountDown() + }, []) + return (
- {getCodeError ?

{getCodeError}

: - sendingCode ? : <> -

We’ve sent a verification code to

-

{email}

- - } +

We’ve sent a verification code to

+

{email}

@@ -93,9 +76,9 @@ export default function EmailConnect(props: {
- Not get it? {count ? `Recend in ${count}s` : } + Not get it? {count ? `Recend in ${count}s` : }
- +
) } diff --git a/lib/components/email-login-widget.tsx b/lib/components/email-login-widget.tsx index 5745746..50651e4 100644 --- a/lib/components/email-login-widget.tsx +++ b/lib/components/email-login-widget.tsx @@ -3,6 +3,8 @@ import TransitionEffect from './transition-effect' import accountApi, { ILoginResponse } from '@/api/account.api' import { useCodattaSigninContext } from '@/providers/codatta-signin-context-provider' import EmailConnect from './email-connect' +import EmailCaptcha from './email-captcha' +import { useState } from 'react' export default function EmailLoginWidget(props: { email: string @@ -11,6 +13,7 @@ export default function EmailLoginWidget(props: { }) { const { email } = props const config = useCodattaSigninContext() + const [step, setStep] = useState<'captcha' | 'verify-email'>('captcha') async function handleOTPChange(email: string, value: string) { const res = await accountApi.emailLogin({ @@ -34,7 +37,8 @@ export default function EmailLoginWidget(props: {
- + {step === 'captcha' && setStep('verify-email')} />} + {step === 'verify-email' && setStep('captcha')}>} ) } diff --git a/lib/components/signin-index.tsx b/lib/components/signin-index.tsx index 8100e5b..acddce7 100644 --- a/lib/components/signin-index.tsx +++ b/lib/components/signin-index.tsx @@ -71,40 +71,40 @@ export default function SingInIndex(props: { {initialized && <> - {props.header ||
Log in or sign up
} + {props.header ||
Log in or sign up
} - {config.showEmailSignIn && ( -
- - -
- )} + {config.showEmailSignIn && ( +
+ + +
+ )} - {config.showEmailSignIn && (config.showFeaturedWallets || config.showTonConnect) &&
- OR -
- } + {config.showEmailSignIn && (config.showFeaturedWallets || config.showTonConnect) &&
+ OR +
+ } -
-
- {config.showFeaturedWallets && featuredWallets && - featuredWallets.map((wallet) => ( - - ))} - {config.showTonConnect && ( - } - title="TON Connect" - onClick={onSelectTonConnect} - > - )} +
+
+ {config.showFeaturedWallets && featuredWallets && + featuredWallets.map((wallet) => ( + + ))} + {config.showTonConnect && ( + } + title="TON Connect" + onClick={onSelectTonConnect} + > + )} +
+ {config.showMoreWallets && }
- {config.showMoreWallets && } -
} ) diff --git a/lib/components/wallet-connect-widget.tsx b/lib/components/wallet-connect-widget.tsx index 892b00d..621ff4e 100644 --- a/lib/components/wallet-connect-widget.tsx +++ b/lib/components/wallet-connect-widget.tsx @@ -20,7 +20,7 @@ export default function WalletConnectWidget(props: { return ( -
+
{step === 'qr' && ( diff --git a/lib/components/wallet-connect.tsx b/lib/components/wallet-connect.tsx index 3427e50..9ea906c 100644 --- a/lib/components/wallet-connect.tsx +++ b/lib/components/wallet-connect.tsx @@ -33,7 +33,7 @@ function getSiweMessage(address: `0x${string}`, nonce: string) { export default function WalletConnect(props: { wallet: WalletItem - onSignFinish: (wallet:WalletItem , params: WalletSignInfo) => Promise + onSignFinish: (wallet: WalletItem, params: WalletSignInfo) => Promise onShowQrCode: () => void }) { const [error, setError] = useState() @@ -73,7 +73,7 @@ export default function WalletConnect(props: { async function initWalletConnect() { try { setError('') - const res = await accountApi.getNonce({account_type: 'block_chain'}) + const res = await accountApi.getNonce({ account_type: 'block_chain' }) nonce.current = res walletSignin(nonce.current) } catch (err: any) { diff --git a/lib/vite-env.d.ts b/lib/vite-env.d.ts new file mode 100644 index 0000000..d676aa0 --- /dev/null +++ b/lib/vite-env.d.ts @@ -0,0 +1,5 @@ +/// + +interface Window { + initAliyunCaptcha: any +} \ No newline at end of file diff --git a/package.json b/package.json index 939ab70..f5e7581 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codatta-connect", - "version": "2.2.0", + "version": "2.3.0", "type": "module", "main": "./dist/index.umd.js", "module": "./dist/index.es.js", diff --git a/src/views/login-view.tsx b/src/views/login-view.tsx index fe632b9..2fb2f35 100644 --- a/src/views/login-view.tsx +++ b/src/views/login-view.tsx @@ -1,6 +1,6 @@ import accountApi, { ILoginResponse } from '../../lib/api/account.api' -import CodattaConnect, { EmvWalletConnectInfo, TonWalletConnectInfo } from '../../lib/codatta-connect' -import { CodattaSignin } from '../../lib/main' +import { EmvWalletConnectInfo, TonWalletConnectInfo } from '../../lib/codatta-connect' +import { CodattaSignin, CodattaConnect } from '../../lib/main' import React from 'react' export default function LoginView() { @@ -38,7 +38,6 @@ export default function LoginView() { connectItems.tonProof ], }) - } async function handleEvmWalletConnect(info: EmvWalletConnectInfo) { @@ -66,15 +65,16 @@ export default function LoginView() { config={{ showEmailSignIn: true, showFeaturedWallets: true, - showTonConnect: true + showTonConnect: true, + showMoreWallets: true }} > - + }}> */} ) } \ No newline at end of file From 76636825d4afd4074f6ab73a9e6b6d8304df7f7a Mon Sep 17 00:00:00 2001 From: markof Date: Tue, 24 Dec 2024 20:05:53 +0800 Subject: [PATCH 06/25] feat: fix resend button --- lib/components/email-connect.tsx | 5 ++--- package.json | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/components/email-connect.tsx b/lib/components/email-connect.tsx index 315e619..51299ea 100644 --- a/lib/components/email-connect.tsx +++ b/lib/components/email-connect.tsx @@ -1,6 +1,6 @@ import TransitionEffect from './transition-effect' -import { useEffect, useRef, useState } from 'react' +import { useEffect, useState } from 'react' import { InputOTP, InputOTPGroup, InputOTPSlot } from './ui/input-otp' import { Mail } from 'lucide-react' import Spin from './ui/spin' @@ -16,7 +16,6 @@ export default function EmailConnect(props: { const [count, setCount] = useState(0) const [loading, setLoading] = useState(false) const [connectError, setConnectError] = useState('') - const sendCodeButton = useRef(null) async function startCountDown() { setCount(60) @@ -76,7 +75,7 @@ export default function EmailConnect(props: {
- Not get it? {count ? `Recend in ${count}s` : } + Not get it? {count ? `Recend in ${count}s` : }
diff --git a/package.json b/package.json index f5e7581..28ad65a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codatta-connect", - "version": "2.3.0", + "version": "2.3.1", "type": "module", "main": "./dist/index.umd.js", "module": "./dist/index.es.js", From bbfe99d069581fdc7e0aef1e1ac468a0f7c01d00 Mon Sep 17 00:00:00 2001 From: markof Date: Wed, 25 Dec 2024 11:06:47 +0800 Subject: [PATCH 07/25] feat: fix captcha error action --- dist/index.es.js | 2 +- dist/index.umd.js | 2 +- dist/{main-CpxLUVHd.js => main-D0QbPgKD.js} | 354 +++++++++--------- ...56k1-ChY4PDp8.js => secp256k1-CFcsUqQG.js} | 2 +- lib/components/email-captcha.tsx | 8 +- package.json | 2 +- 6 files changed, 180 insertions(+), 190 deletions(-) rename dist/{main-CpxLUVHd.js => main-D0QbPgKD.js} (99%) rename dist/{secp256k1-ChY4PDp8.js => secp256k1-CFcsUqQG.js} (99%) diff --git a/dist/index.es.js b/dist/index.es.js index d8c11b4..c15cbe0 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -1,4 +1,4 @@ -import { f as o, C as n, d as e, a as C, u as s } from "./main-CpxLUVHd.js"; +import { f as o, C as n, d as e, a as C, u as s } from "./main-D0QbPgKD.js"; export { o as CodattaConnect, n as CodattaConnectContextProvider, diff --git a/dist/index.umd.js b/dist/index.umd.js index e0fb1bc..501cf96 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -218,7 +218,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene --nojs-bg: black !important; --nojs-fg: white !important; } -}`;const b7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>ge.jsx(v7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));b7.displayName="InputOTP";const y7=Yt.forwardRef(({className:t,...e},r)=>ge.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));y7.displayName="InputOTPGroup";const Ac=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(m7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return ge.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&ge.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:ge.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Ac.displayName="InputOTPSlot";function cZ(t){const{spinning:e,children:r,className:n}=t;return ge.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&ge.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:ge.jsx(vc,{className:"xc-animate-spin"})})]})}function w7(t){const{email:e}=t,[r,n]=Se.useState(0),[i,s]=Se.useState(!1),[o,a]=Se.useState(""),u=Se.useRef(null);async function l(){n(60);const g=setInterval(()=>{n(y=>y===0?(clearInterval(g),0):y-1)},1e3)}async function d(g){if(a(""),!(g.length<6)){s(!0);try{await t.onInputCode(e,g)}catch(y){a(y.message)}s(!1)}}return Se.useEffect(()=>{l()},[]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(FK,{className:"xc-mb-4",size:60}),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:[ge.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),ge.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]}),ge.jsx("div",{className:"xc-mb-2 xc-h-12",children:ge.jsx(cZ,{spinning:i,className:"xc-rounded-xl",children:ge.jsx(b7,{maxLength:6,onChange:d,disabled:i,className:"disabled:xc-opacity-20",children:ge.jsx(y7,{children:ge.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[ge.jsx(Ac,{index:0}),ge.jsx(Ac,{index:1}),ge.jsx(Ac,{index:2}),ge.jsx(Ac,{index:3}),ge.jsx(Ac,{index:4}),ge.jsx(Ac,{index:5})]})})})})}),o&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:o})})]}),ge.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Recend in ${r}s`:ge.jsx("button",{id:"sendCodeButton",ref:u,children:"Send again"})]}),ge.jsx("div",{id:"captcha-element"})]})}function x7(t){const{email:e}=t,[r,n]=Se.useState(!1),[i,s]=Se.useState(""),o=Se.useMemo(()=>`xn-btn-${new Date().getTime()}`,[e]);async function a(y,A){n(!0);try{s(""),await va.getEmailCode({account_type:"email",email:y},A)}catch(P){s(P.message)}n(!1)}async function u(y){try{return await a(e,JSON.stringify(y)),{captchaResult:!0,bizResult:!0}}catch(A){return s(A.message),{captchaResult:!1,bizResult:!1}}}async function l(y){y&&t.onCodeSend()}const d=Se.useRef();function g(y){d.current=y}return Se.useEffect(()=>{if(e)return window.initAliyunCaptcha({SceneId:"tqyu8129d",prefix:"1mfsn5f",mode:"popup",element:"#captcha-element",button:`#${o}`,captchaVerifyCallback:u,onBizResultCallback:l,getInstance:g,slideStyle:{width:360,height:40},language:"en",region:"cn"}),()=>{var y,A;(y=document.getElementById("aliyunCaptcha-mask"))==null||y.remove(),(A=document.getElementById("aliyunCaptcha-window-popup"))==null||A.remove()}},[e]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(jK,{className:"xc-mb-4",size:60}),ge.jsx("button",{className:"xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2",id:o,children:r?ge.jsx(vc,{className:"xc-animate-spin"}):"I'm not a robot"})]}),i&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:i})})]})}function uZ(t){const{email:e}=t,r=Mb(),[n,i]=Se.useState("captcha");async function s(o,a){const u=await va.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:a,email:o,inviter_code:r.inviterCode,source:{device:r.device,channel:r.channel,app:r.app}});t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),n==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>i("verify-email")}),n==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:s,onResendCode:()=>i("captcha")})]})}var _7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var g=function(f,p){var v=f,x=k[p],_=null,S=0,b=null,M=[],I={},F=function(te,le){_=function(ie){for(var fe=new Array(ie),ve=0;ve=7&&ee(te),b==null&&(b=R(v,x,M)),Q(b,le)},ae=function(te,le){for(var ie=-1;ie<=7;ie+=1)if(!(te+ie<=-1||S<=te+ie))for(var fe=-1;fe<=7;fe+=1)le+fe<=-1||S<=le+fe||(_[te+ie][le+fe]=0<=ie&&ie<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(ie==0||ie==6)||2<=ie&&ie<=4&&2<=fe&&fe<=4)},O=function(){for(var te=8;te>ie&1)==1;_[Math.floor(ie/3)][ie%3+S-8-3]=fe}for(ie=0;ie<18;ie+=1)fe=!te&&(le>>ie&1)==1,_[ie%3+S-8-3][Math.floor(ie/3)]=fe},X=function(te,le){for(var ie=x<<3|le,fe=B.getBCHTypeInfo(ie),ve=0;ve<15;ve+=1){var Me=!te&&(fe>>ve&1)==1;ve<6?_[ve][8]=Me:ve<8?_[ve+1][8]=Me:_[S-15+ve][8]=Me}for(ve=0;ve<15;ve+=1)Me=!te&&(fe>>ve&1)==1,ve<8?_[8][S-ve-1]=Me:ve<9?_[8][15-ve-1+1]=Me:_[8][15-ve-1]=Me;_[S-8][8]=!te},Q=function(te,le){for(var ie=-1,fe=S-1,ve=7,Me=0,Ne=B.getMaskFunction(le),Te=S-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var $e=0;$e<2;$e+=1)if(_[fe][Te-$e]==null){var Ie=!1;Me>>ve&1)==1),Ne(fe,Te-$e)&&(Ie=!Ie),_[fe][Te-$e]=Ie,(ve-=1)==-1&&(Me+=1,ve=7)}if((fe+=ie)<0||S<=fe){fe-=ie,ie=-ie;break}}},R=function(te,le,ie){for(var fe=K.getRSBlocks(te,le),ve=J(),Me=0;Me8*Te)throw"code length overflow. ("+ve.getLengthInBits()+">"+8*Te+")";for(ve.getLengthInBits()+4<=8*Te&&ve.put(0,4);ve.getLengthInBits()%8!=0;)ve.putBit(!1);for(;!(ve.getLengthInBits()>=8*Te||(ve.put(236,8),ve.getLengthInBits()>=8*Te));)ve.put(17,8);return function($e,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Ee=0;Ee=0?rt.getAt(Je):0}}var pt=0;for(Be=0;BeIe)&&(Ne=Ie,Te=$e)}return Te}())},I.createTableTag=function(te,le){te=te||2;var ie="";ie+='
";for(var ve=0;ve';ie+=""}return(ie+="")+"
"},I.createSvgTag=function(te,le,ie,fe){var ve={};typeof arguments[0]=="object"&&(te=(ve=arguments[0]).cellSize,le=ve.margin,ie=ve.alt,fe=ve.title),te=te||2,le=le===void 0?4*te:le,(ie=typeof ie=="string"?{text:ie}:ie||{}).text=ie.text||null,ie.id=ie.text?ie.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*te+2*le,Le="";for($e="l"+te+",0 0,"+te+" -"+te+",0 0,-"+te+"z ",Le+=''+Z(fe.text)+"":"",Le+=ie.text?''+Z(ie.text)+"":"",Le+='',Le+='"},I.createDataURL=function(te,le){te=te||2,le=le===void 0?4*te:le;var ie=I.getModuleCount()*te+2*le,fe=le,ve=ie-le;return m(ie,ie,function(Me,Ne){if(fe<=Me&&Me"};var Z=function(te){for(var le="",ie=0;ie":le+=">";break;case"&":le+="&";break;case'"':le+=""";break;default:le+=fe}}return le};return I.createASCII=function(te,le){if((te=te||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Ee,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:pt[Be];ft+=` +}`;const b7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>ge.jsx(v7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));b7.displayName="InputOTP";const y7=Yt.forwardRef(({className:t,...e},r)=>ge.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));y7.displayName="InputOTPGroup";const Ac=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(m7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return ge.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&ge.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:ge.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Ac.displayName="InputOTPSlot";function cZ(t){const{spinning:e,children:r,className:n}=t;return ge.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&ge.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:ge.jsx(vc,{className:"xc-animate-spin"})})]})}function w7(t){const{email:e}=t,[r,n]=Se.useState(0),[i,s]=Se.useState(!1),[o,a]=Se.useState("");async function u(){n(60);const d=setInterval(()=>{n(g=>g===0?(clearInterval(d),0):g-1)},1e3)}async function l(d){if(a(""),!(d.length<6)){s(!0);try{await t.onInputCode(e,d)}catch(g){a(g.message)}s(!1)}}return Se.useEffect(()=>{u()},[]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(FK,{className:"xc-mb-4",size:60}),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:[ge.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),ge.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]}),ge.jsx("div",{className:"xc-mb-2 xc-h-12",children:ge.jsx(cZ,{spinning:i,className:"xc-rounded-xl",children:ge.jsx(b7,{maxLength:6,onChange:l,disabled:i,className:"disabled:xc-opacity-20",children:ge.jsx(y7,{children:ge.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[ge.jsx(Ac,{index:0}),ge.jsx(Ac,{index:1}),ge.jsx(Ac,{index:2}),ge.jsx(Ac,{index:3}),ge.jsx(Ac,{index:4}),ge.jsx(Ac,{index:5})]})})})})}),o&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:o})})]}),ge.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Recend in ${r}s`:ge.jsx("button",{id:"sendCodeButton",onClick:t.onResendCode,children:"Send again"})]}),ge.jsx("div",{id:"captcha-element"})]})}function x7(t){const{email:e}=t,[r,n]=Se.useState(!1),[i,s]=Se.useState(""),o=Se.useMemo(()=>`xn-btn-${new Date().getTime()}`,[e]);async function a(y,A){n(!0),s(""),await va.getEmailCode({account_type:"email",email:y},A),n(!1)}async function u(y){try{return await a(e,JSON.stringify(y)),{captchaResult:!0,bizResult:!0}}catch(A){return s(A.message),{captchaResult:!1,bizResult:!1}}}async function l(y){y&&t.onCodeSend()}const d=Se.useRef();function g(y){d.current=y}return Se.useEffect(()=>{if(e)return window.initAliyunCaptcha({SceneId:"tqyu8129d",prefix:"1mfsn5f",mode:"popup",element:"#captcha-element",button:`#${o}`,captchaVerifyCallback:u,onBizResultCallback:l,getInstance:g,slideStyle:{width:360,height:40},language:"en",region:"cn"}),()=>{var y,A;(y=document.getElementById("aliyunCaptcha-mask"))==null||y.remove(),(A=document.getElementById("aliyunCaptcha-window-popup"))==null||A.remove()}},[e]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(jK,{className:"xc-mb-4",size:60}),ge.jsx("button",{className:"xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2",id:o,children:r?ge.jsx(vc,{className:"xc-animate-spin"}):"I'm not a robot"})]}),i&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:i})})]})}function uZ(t){const{email:e}=t,r=Mb(),[n,i]=Se.useState("captcha");async function s(o,a){const u=await va.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:a,email:o,inviter_code:r.inviterCode,source:{device:r.device,channel:r.channel,app:r.app}});t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),n==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>i("verify-email")}),n==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:s,onResendCode:()=>i("captcha")})]})}var _7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var g=function(f,p){var v=f,x=k[p],_=null,S=0,b=null,M=[],I={},F=function(te,le){_=function(ie){for(var fe=new Array(ie),ve=0;ve=7&&ee(te),b==null&&(b=R(v,x,M)),Q(b,le)},ae=function(te,le){for(var ie=-1;ie<=7;ie+=1)if(!(te+ie<=-1||S<=te+ie))for(var fe=-1;fe<=7;fe+=1)le+fe<=-1||S<=le+fe||(_[te+ie][le+fe]=0<=ie&&ie<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(ie==0||ie==6)||2<=ie&&ie<=4&&2<=fe&&fe<=4)},O=function(){for(var te=8;te>ie&1)==1;_[Math.floor(ie/3)][ie%3+S-8-3]=fe}for(ie=0;ie<18;ie+=1)fe=!te&&(le>>ie&1)==1,_[ie%3+S-8-3][Math.floor(ie/3)]=fe},X=function(te,le){for(var ie=x<<3|le,fe=B.getBCHTypeInfo(ie),ve=0;ve<15;ve+=1){var Me=!te&&(fe>>ve&1)==1;ve<6?_[ve][8]=Me:ve<8?_[ve+1][8]=Me:_[S-15+ve][8]=Me}for(ve=0;ve<15;ve+=1)Me=!te&&(fe>>ve&1)==1,ve<8?_[8][S-ve-1]=Me:ve<9?_[8][15-ve-1+1]=Me:_[8][15-ve-1]=Me;_[S-8][8]=!te},Q=function(te,le){for(var ie=-1,fe=S-1,ve=7,Me=0,Ne=B.getMaskFunction(le),Te=S-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var $e=0;$e<2;$e+=1)if(_[fe][Te-$e]==null){var Ie=!1;Me>>ve&1)==1),Ne(fe,Te-$e)&&(Ie=!Ie),_[fe][Te-$e]=Ie,(ve-=1)==-1&&(Me+=1,ve=7)}if((fe+=ie)<0||S<=fe){fe-=ie,ie=-ie;break}}},R=function(te,le,ie){for(var fe=K.getRSBlocks(te,le),ve=J(),Me=0;Me8*Te)throw"code length overflow. ("+ve.getLengthInBits()+">"+8*Te+")";for(ve.getLengthInBits()+4<=8*Te&&ve.put(0,4);ve.getLengthInBits()%8!=0;)ve.putBit(!1);for(;!(ve.getLengthInBits()>=8*Te||(ve.put(236,8),ve.getLengthInBits()>=8*Te));)ve.put(17,8);return function($e,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Ee=0;Ee=0?rt.getAt(Je):0}}var pt=0;for(Be=0;BeIe)&&(Ne=Ie,Te=$e)}return Te}())},I.createTableTag=function(te,le){te=te||2;var ie="";ie+='";for(var ve=0;ve';ie+=""}return(ie+="")+"
"},I.createSvgTag=function(te,le,ie,fe){var ve={};typeof arguments[0]=="object"&&(te=(ve=arguments[0]).cellSize,le=ve.margin,ie=ve.alt,fe=ve.title),te=te||2,le=le===void 0?4*te:le,(ie=typeof ie=="string"?{text:ie}:ie||{}).text=ie.text||null,ie.id=ie.text?ie.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*te+2*le,Le="";for($e="l"+te+",0 0,"+te+" -"+te+",0 0,-"+te+"z ",Le+=''+Z(fe.text)+"":"",Le+=ie.text?''+Z(ie.text)+"":"",Le+='',Le+='"},I.createDataURL=function(te,le){te=te||2,le=le===void 0?4*te:le;var ie=I.getModuleCount()*te+2*le,fe=le,ve=ie-le;return m(ie,ie,function(Me,Ne){if(fe<=Me&&Me"};var Z=function(te){for(var le="",ie=0;ie":le+=">";break;case"&":le+="&";break;case'"':le+=""";break;default:le+=fe}}return le};return I.createASCII=function(te,le){if((te=te||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Ee,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:pt[Be];ft+=` `}return et%2&&ze>0?ft.substring(0,ft.length-et-1)+Array(et+1).join("▀"):ft.substring(0,ft.length-1)}(le);te-=1,le=le===void 0?2*te:le;var ie,fe,ve,Me,Ne=I.getModuleCount()*te+2*le,Te=le,$e=Ne-le,Ie=Array(te+1).join("██"),Le=Array(te+1).join(" "),Ve="",ke="";for(ie=0;ie>>8),S.push(255&I)):S.push(x)}}return S}};var y,A,P,N,D,k={L:1,M:0,Q:3,H:2},B=(y=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],A=1335,P=7973,D=function(f){for(var p=0;f!=0;)p+=1,f>>>=1;return p},(N={}).getBCHTypeInfo=function(f){for(var p=f<<10;D(p)-D(A)>=0;)p^=A<=0;)p^=P<5&&(v+=3+S-5)}for(x=0;x=256;)x-=255;return f[x]}}}();function U(f,p){if(f.length===void 0)throw f.length+"/"+p;var v=function(){for(var _=0;_>>7-x%8&1)==1},put:function(x,_){for(var S=0;S<_;S+=1)v.putBit((x>>>_-S-1&1)==1)},getLengthInBits:function(){return p},putBit:function(x){var _=Math.floor(p/8);f.length<=_&&f.push(0),x&&(f[_]|=128>>>p%8),p+=1}};return v},T=function(f){var p=f,v={getMode:function(){return 1},getLength:function(S){return p.length},write:function(S){for(var b=p,M=0;M+2>>8&255)+(255&M),_.put(M,13),b+=2}if(b>>8)},writeBytes:function(v,x,_){x=x||0,_=_||v.length;for(var S=0;S<_;S+=1)p.writeByte(v[S+x])},writeString:function(v){for(var x=0;x0&&(v+=","),v+=f[x];return v+"]"}};return p},E=function(f){var p=f,v=0,x=0,_=0,S={read:function(){for(;_<8;){if(v>=p.length){if(_==0)return-1;throw"unexpected end of file./"+_}var M=p.charAt(v);if(v+=1,M=="=")return _=0,-1;M.match(/^\s$/)||(x=x<<6|b(M.charCodeAt(0)),_+=6)}var I=x>>>_-8&255;return _-=8,I}},b=function(M){if(65<=M&&M<=90)return M-65;if(97<=M&&M<=122)return M-97+26;if(48<=M&&M<=57)return M-48+52;if(M==43)return 62;if(M==47)return 63;throw"c:"+M};return S},m=function(f,p,v){for(var x=function(ae,O){var se=ae,ee=O,X=new Array(ae*O),Q={setPixel:function(te,le,ie){X[le*se+te]=ie},write:function(te){te.writeString("GIF87a"),te.writeShort(se),te.writeShort(ee),te.writeByte(128),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(255),te.writeByte(255),te.writeByte(255),te.writeString(","),te.writeShort(0),te.writeShort(0),te.writeShort(se),te.writeShort(ee),te.writeByte(0);var le=R(2);te.writeByte(2);for(var ie=0;le.length-ie>255;)te.writeByte(255),te.writeBytes(le,ie,255),ie+=255;te.writeByte(le.length-ie),te.writeBytes(le,ie,le.length-ie),te.writeByte(0),te.writeString(";")}},R=function(te){for(var le=1<>>Ee)throw"length over";for(;Te+Ee>=8;)Ne.writeByte(255&(He<>>=8-Te,$e=0,Te=0;$e|=He<0&&Ne.writeByte($e)}});Le.write(le,fe);var Ve=0,ke=String.fromCharCode(X[Ve]);for(Ve+=1;Ve=6;)Q(ae>>>O-6),O-=6},X.flush=function(){if(O>0&&(Q(ae<<6-O),ae=0,O=0),se%3!=0)for(var Z=3-se%3,te=0;te>6,128|63&N):N<55296||N>=57344?A.push(224|N>>12,128|N>>6&63,128|63&N):(P++,N=65536+((1023&N)<<10|1023&y.charCodeAt(P)),A.push(240|N>>18,128|N>>12&63,128|N>>6&63,128|63&N))}return A}(g)},(l=typeof(u=function(){return d})=="function"?u.apply(a,[]):u)===void 0||(o.exports=l)}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var u=n[o]={exports:{}};return r[o](u,u.exports,i),u.exports}i.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return i.d(a,{a}),a},i.d=(o,a)=>{for(var u in a)i.o(a,u)&&!i.o(o,u)&&Object.defineProperty(o,u,{enumerable:!0,get:a[u]})},i.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a);var s={};return(()=>{i.d(s,{default:()=>G});const o=E=>!!E&&typeof E=="object"&&!Array.isArray(E);function a(E,...m){if(!m.length)return E;const f=m.shift();return f!==void 0&&o(E)&&o(f)?(E=Object.assign({},E),Object.keys(f).forEach(p=>{const v=E[p],x=f[p];Array.isArray(v)&&Array.isArray(x)?E[p]=x:o(v)&&o(x)?E[p]=a(Object.assign({},v),x):E[p]=x}),a(E,...m)):E}function u(E,m){const f=document.createElement("a");f.download=m,f.href=E,document.body.appendChild(f),f.click(),document.body.removeChild(f)}const l={L:.07,M:.15,Q:.25,H:.3};class d{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;switch(this._type){case"dots":x=this._drawDot;break;case"classy":x=this._drawClassy;break;case"classy-rounded":x=this._drawClassyRounded;break;case"rounded":x=this._drawRounded;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawSquare}x.call(this,{x:m,y:f,size:p,getNeighbor:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(p+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(p)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_basicSideRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, 0 ${-f}`)}}))}_basicCornerRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}v `+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_basicCornerExtraRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`)}}))}_basicCornersRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${f/2} ${f/2}h `+f/2+"v "+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_drawDot({x:m,y:f,size:p}){this._basicDot({x:m,y:f,size:p,rotation:0})}_drawSquare({x:m,y:f,size:p}){this._basicSquare({x:m,y:f,size:p,rotation:0})}_drawRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:p,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerRounded({x:m,y:f,size:p,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:p,rotation:I})}}else this._basicDot({x:m,y:f,size:p,rotation:0})}_drawExtraRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:p,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:p,rotation:I})}}else this._basicDot({x:m,y:f,size:p,rotation:0})}_drawClassy({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:p,rotation:0}):this._basicCornerRounded({x:m,y:f,size:p,rotation:Math.PI/2}):this._basicCornerRounded({x:m,y:f,size:p,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:p,rotation:Math.PI/2})}_drawClassyRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:p,rotation:0}):this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:p,rotation:Math.PI/2})}}class g{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;switch(this._type){case"square":x=this._drawSquare;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawDot}x.call(this,{x:m,y:f,size:p,rotation:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p+f/2} ${v}a ${f/2} ${f/2} 0 1 0 0.1 0zm 0 ${x}a ${f/2-x} ${f/2-x} 0 1 1 -0.1 0Z`)}}))}_basicSquare(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}v `+-f+`zM ${p+x} ${v+x}h `+(f-2*x)+"v "+(f-2*x)+"h "+(2*x-f)+"z")}}))}_basicExtraRounded(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p} ${v+2.5*x}v `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*x}h `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*-x}v `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*-x}h `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*x}M ${p+2.5*x} ${v+x}h `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*x}v `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*x}h `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*-x}v `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*-x}`)}}))}_drawDot({x:m,y:f,size:p,rotation:v}){this._basicDot({x:m,y:f,size:p,rotation:v})}_drawSquare({x:m,y:f,size:p,rotation:v}){this._basicSquare({x:m,y:f,size:p,rotation:v})}_drawExtraRounded({x:m,y:f,size:p,rotation:v}){this._basicExtraRounded({x:m,y:f,size:p,rotation:v})}}class y{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;x=this._type==="square"?this._drawSquare:this._drawDot,x.call(this,{x:m,y:f,size:p,rotation:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(p+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(p)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_drawDot({x:m,y:f,size:p,rotation:v}){this._basicDot({x:m,y:f,size:p,rotation:v})}_drawSquare({x:m,y:f,size:p,rotation:v}){this._basicSquare({x:m,y:f,size:p,rotation:v})}}const A="circle",P=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],N=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class D{constructor(m,f){this._roundSize=p=>this._options.dotsOptions.roundSize?Math.floor(p):p,this._window=f,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(m.width)),this._element.setAttribute("height",String(m.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),m.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=m.image,this._instanceId=D.instanceCount++,this._options=m}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(m){const f=m.getModuleCount(),p=Math.min(this._options.width,this._options.height)-2*this._options.margin,v=this._options.shape===A?p/Math.sqrt(2):p,x=this._roundSize(v/f);let _={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=m,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:S,qrOptions:b}=this._options,M=S.imageSize*l[b.errorCorrectionLevel],I=Math.floor(M*f*f);_=function({originalHeight:F,originalWidth:ae,maxHiddenDots:O,maxHiddenAxisDots:se,dotSize:ee}){const X={x:0,y:0},Q={x:0,y:0};if(F<=0||ae<=0||O<=0||ee<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const R=F/ae;return X.x=Math.floor(Math.sqrt(O/R)),X.x<=0&&(X.x=1),se&&seO||se&&se{var M,I,F,ae,O,se;return!(this._options.imageOptions.hideBackgroundDots&&S>=(f-_.hideYDots)/2&&S<(f+_.hideYDots)/2&&b>=(f-_.hideXDots)/2&&b<(f+_.hideXDots)/2||!((M=P[S])===null||M===void 0)&&M[b]||!((I=P[S-f+7])===null||I===void 0)&&I[b]||!((F=P[S])===null||F===void 0)&&F[b-f+7]||!((ae=N[S])===null||ae===void 0)&&ae[b]||!((O=N[S-f+7])===null||O===void 0)&&O[b]||!((se=N[S])===null||se===void 0)&&se[b-f+7])}),this.drawCorners(),this._options.image&&await this.drawImage({width:_.width,height:_.height,count:f,dotSize:x})}drawBackground(){var m,f,p;const v=this._element,x=this._options;if(v){const _=(m=x.backgroundOptions)===null||m===void 0?void 0:m.gradient,S=(f=x.backgroundOptions)===null||f===void 0?void 0:f.color;let b=x.height,M=x.width;if(_||S){const I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((p=x.backgroundOptions)===null||p===void 0)&&p.round&&(b=M=Math.min(x.width,x.height),I.setAttribute("rx",String(b/2*x.backgroundOptions.round))),I.setAttribute("x",String(this._roundSize((x.width-M)/2))),I.setAttribute("y",String(this._roundSize((x.height-b)/2))),I.setAttribute("width",String(M)),I.setAttribute("height",String(b)),this._backgroundClipPath.appendChild(I),this._createColor({options:_,color:S,additionalRotation:0,x:0,y:0,height:x.height,width:x.width,name:`background-color-${this._instanceId}`})}}}drawDots(m){var f,p;if(!this._qr)throw"QR code is not defined";const v=this._options,x=this._qr.getModuleCount();if(x>v.width||x>v.height)throw"The canvas is too small.";const _=Math.min(v.width,v.height)-2*v.margin,S=v.shape===A?_/Math.sqrt(2):_,b=this._roundSize(S/x),M=this._roundSize((v.width-x*b)/2),I=this._roundSize((v.height-x*b)/2),F=new d({svg:this._element,type:v.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(f=v.dotsOptions)===null||f===void 0?void 0:f.gradient,color:v.dotsOptions.color,additionalRotation:0,x:0,y:0,height:v.height,width:v.width,name:`dot-color-${this._instanceId}`});for(let ae=0;ae!(O+se<0||ae+ee<0||O+se>=x||ae+ee>=x)&&!(m&&!m(ae+ee,O+se))&&!!this._qr&&this._qr.isDark(ae+ee,O+se)),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element));if(v.shape===A){const ae=this._roundSize((_/b-x)/2),O=x+2*ae,se=M-ae*b,ee=I-ae*b,X=[],Q=this._roundSize(O/2);for(let R=0;R=ae-1&&R<=O-ae&&Z>=ae-1&&Z<=O-ae||Math.sqrt((R-Q)*(R-Q)+(Z-Q)*(Z-Q))>Q?X[R][Z]=0:X[R][Z]=this._qr.isDark(Z-2*ae<0?Z:Z>=x?Z-2*ae:Z-ae,R-2*ae<0?R:R>=x?R-2*ae:R-ae)?1:0}for(let R=0;R{var ie;return!!(!((ie=X[R+le])===null||ie===void 0)&&ie[Z+te])}),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const m=this._element,f=this._options;if(!m)throw"Element code is not defined";const p=this._qr.getModuleCount(),v=Math.min(f.width,f.height)-2*f.margin,x=f.shape===A?v/Math.sqrt(2):v,_=this._roundSize(x/p),S=7*_,b=3*_,M=this._roundSize((f.width-p*_)/2),I=this._roundSize((f.height-p*_)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([F,ae,O])=>{var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me;const Ne=M+F*_*(p-7),Te=I+ae*_*(p-7);let $e=this._dotsClipPath,Ie=this._dotsClipPath;if((!((se=f.cornersSquareOptions)===null||se===void 0)&&se.gradient||!((ee=f.cornersSquareOptions)===null||ee===void 0)&&ee.color)&&($e=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),$e.setAttribute("id",`clip-path-corners-square-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild($e),this._cornersSquareClipPath=this._cornersDotClipPath=Ie=$e,this._createColor({options:(X=f.cornersSquareOptions)===null||X===void 0?void 0:X.gradient,color:(Q=f.cornersSquareOptions)===null||Q===void 0?void 0:Q.color,additionalRotation:O,x:Ne,y:Te,height:S,width:S,name:`corners-square-color-${F}-${ae}-${this._instanceId}`})),(R=f.cornersSquareOptions)===null||R===void 0?void 0:R.type){const Le=new g({svg:this._element,type:f.cornersSquareOptions.type,window:this._window});Le.draw(Ne,Te,S,O),Le._element&&$e&&$e.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=P[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&$e&&$e.appendChild(Le._element))}if((!((te=f.cornersDotOptions)===null||te===void 0)&&te.gradient||!((le=f.cornersDotOptions)===null||le===void 0)&&le.color)&&(Ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Ie.setAttribute("id",`clip-path-corners-dot-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild(Ie),this._cornersDotClipPath=Ie,this._createColor({options:(ie=f.cornersDotOptions)===null||ie===void 0?void 0:ie.gradient,color:(fe=f.cornersDotOptions)===null||fe===void 0?void 0:fe.color,additionalRotation:O,x:Ne+2*_,y:Te+2*_,height:b,width:b,name:`corners-dot-color-${F}-${ae}-${this._instanceId}`})),(ve=f.cornersDotOptions)===null||ve===void 0?void 0:ve.type){const Le=new y({svg:this._element,type:f.cornersDotOptions.type,window:this._window});Le.draw(Ne+2*_,Te+2*_,b,O),Le._element&&Ie&&Ie.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=N[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&Ie&&Ie.appendChild(Le._element))}})}loadImage(){return new Promise((m,f)=>{var p;const v=this._options;if(!v.image)return f("Image is not defined");if(!((p=v.nodeCanvas)===null||p===void 0)&&p.loadImage)v.nodeCanvas.loadImage(v.image).then(x=>{var _,S;if(this._image=x,this._options.imageOptions.saveAsBlob){const b=(_=v.nodeCanvas)===null||_===void 0?void 0:_.createCanvas(this._image.width,this._image.height);(S=b==null?void 0:b.getContext("2d"))===null||S===void 0||S.drawImage(x,0,0),this._imageUri=b==null?void 0:b.toDataURL()}m()}).catch(f);else{const x=new this._window.Image;typeof v.imageOptions.crossOrigin=="string"&&(x.crossOrigin=v.imageOptions.crossOrigin),this._image=x,x.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await async function(_,S){return new Promise(b=>{const M=new S.XMLHttpRequest;M.onload=function(){const I=new S.FileReader;I.onloadend=function(){b(I.result)},I.readAsDataURL(M.response)},M.open("GET",_),M.responseType="blob",M.send()})}(v.image||"",this._window)),m()},x.src=v.image}})}async drawImage({width:m,height:f,count:p,dotSize:v}){const x=this._options,_=this._roundSize((x.width-p*v)/2),S=this._roundSize((x.height-p*v)/2),b=_+this._roundSize(x.imageOptions.margin+(p*v-m)/2),M=S+this._roundSize(x.imageOptions.margin+(p*v-f)/2),I=m-2*x.imageOptions.margin,F=f-2*x.imageOptions.margin,ae=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");ae.setAttribute("href",this._imageUri||""),ae.setAttribute("x",String(b)),ae.setAttribute("y",String(M)),ae.setAttribute("width",`${I}px`),ae.setAttribute("height",`${F}px`),this._element.appendChild(ae)}_createColor({options:m,color:f,additionalRotation:p,x:v,y:x,height:_,width:S,name:b}){const M=S>_?S:_,I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(I.setAttribute("x",String(v)),I.setAttribute("y",String(x)),I.setAttribute("height",String(_)),I.setAttribute("width",String(S)),I.setAttribute("clip-path",`url('#clip-path-${b}')`),m){let F;if(m.type==="radial")F=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("fx",String(v+S/2)),F.setAttribute("fy",String(x+_/2)),F.setAttribute("cx",String(v+S/2)),F.setAttribute("cy",String(x+_/2)),F.setAttribute("r",String(M/2));else{const ae=((m.rotation||0)+p)%(2*Math.PI),O=(ae+2*Math.PI)%(2*Math.PI);let se=v+S/2,ee=x+_/2,X=v+S/2,Q=x+_/2;O>=0&&O<=.25*Math.PI||O>1.75*Math.PI&&O<=2*Math.PI?(se-=S/2,ee-=_/2*Math.tan(ae),X+=S/2,Q+=_/2*Math.tan(ae)):O>.25*Math.PI&&O<=.75*Math.PI?(ee-=_/2,se-=S/2/Math.tan(ae),Q+=_/2,X+=S/2/Math.tan(ae)):O>.75*Math.PI&&O<=1.25*Math.PI?(se+=S/2,ee+=_/2*Math.tan(ae),X-=S/2,Q-=_/2*Math.tan(ae)):O>1.25*Math.PI&&O<=1.75*Math.PI&&(ee+=_/2,se+=S/2/Math.tan(ae),Q-=_/2,X-=S/2/Math.tan(ae)),F=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("x1",String(Math.round(se))),F.setAttribute("y1",String(Math.round(ee))),F.setAttribute("x2",String(Math.round(X))),F.setAttribute("y2",String(Math.round(Q)))}m.colorStops.forEach(({offset:ae,color:O})=>{const se=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");se.setAttribute("offset",100*ae+"%"),se.setAttribute("stop-color",O),F.appendChild(se)}),I.setAttribute("fill",`url('#${b}')`),this._defs.appendChild(F)}else f&&I.setAttribute("fill",f);this._element.appendChild(I)}}D.instanceCount=0;const k=D,B="canvas",j={};for(let E=0;E<=40;E++)j[E]=E;const U={type:B,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:j[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function K(E){const m=Object.assign({},E);if(!m.colorStops||!m.colorStops.length)throw"Field 'colorStops' is required in gradient";return m.rotation?m.rotation=Number(m.rotation):m.rotation=0,m.colorStops=m.colorStops.map(f=>Object.assign(Object.assign({},f),{offset:Number(f.offset)})),m}function J(E){const m=Object.assign({},E);return m.width=Number(m.width),m.height=Number(m.height),m.margin=Number(m.margin),m.imageOptions=Object.assign(Object.assign({},m.imageOptions),{hideBackgroundDots:!!m.imageOptions.hideBackgroundDots,imageSize:Number(m.imageOptions.imageSize),margin:Number(m.imageOptions.margin)}),m.margin>Math.min(m.width,m.height)&&(m.margin=Math.min(m.width,m.height)),m.dotsOptions=Object.assign({},m.dotsOptions),m.dotsOptions.gradient&&(m.dotsOptions.gradient=K(m.dotsOptions.gradient)),m.cornersSquareOptions&&(m.cornersSquareOptions=Object.assign({},m.cornersSquareOptions),m.cornersSquareOptions.gradient&&(m.cornersSquareOptions.gradient=K(m.cornersSquareOptions.gradient))),m.cornersDotOptions&&(m.cornersDotOptions=Object.assign({},m.cornersDotOptions),m.cornersDotOptions.gradient&&(m.cornersDotOptions.gradient=K(m.cornersDotOptions.gradient))),m.backgroundOptions&&(m.backgroundOptions=Object.assign({},m.backgroundOptions),m.backgroundOptions.gradient&&(m.backgroundOptions.gradient=K(m.backgroundOptions.gradient))),m}var T=i(873),z=i.n(T);function ue(E){if(!E)throw new Error("Extension must be defined");E[0]==="."&&(E=E.substring(1));const m={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[E.toLowerCase()];if(!m)throw new Error(`Extension "${E}" is not supported`);return m}class _e{constructor(m){m!=null&&m.jsdom?this._window=new m.jsdom("",{resources:"usable"}).window:this._window=window,this._options=m?J(a(U,m)):U,this.update()}static _clearContainer(m){m&&(m.innerHTML="")}_setupSvg(){if(!this._qr)return;const m=new k(this._options,this._window);this._svg=m.getElement(),this._svgDrawingPromise=m.drawQR(this._qr).then(()=>{var f;this._svg&&((f=this._extension)===null||f===void 0||f.call(this,m.getElement(),this._options))})}_setupCanvas(){var m,f;this._qr&&(!((m=this._options.nodeCanvas)===null||m===void 0)&&m.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(f=this._svgDrawingPromise)===null||f===void 0?void 0:f.then(()=>{var p;if(!this._svg)return;const v=this._svg,x=new this._window.XMLSerializer().serializeToString(v),_=btoa(x),S=`data:${ue("svg")};base64,${_}`;if(!((p=this._options.nodeCanvas)===null||p===void 0)&&p.loadImage)return this._options.nodeCanvas.loadImage(S).then(b=>{var M,I;b.width=this._options.width,b.height=this._options.height,(I=(M=this._nodeCanvas)===null||M===void 0?void 0:M.getContext("2d"))===null||I===void 0||I.drawImage(b,0,0)});{const b=new this._window.Image;return new Promise(M=>{b.onload=()=>{var I,F;(F=(I=this._domCanvas)===null||I===void 0?void 0:I.getContext("2d"))===null||F===void 0||F.drawImage(b,0,0),M()},b.src=S})}}))}async _getElement(m="png"){if(!this._qr)throw"QR code is empty";return m.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(m){_e._clearContainer(this._container),this._options=m?J(a(this._options,m)):this._options,this._options.data&&(this._qr=z()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(f){switch(!0){case/^[0-9]*$/.test(f):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(f):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===B?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(m){if(m){if(typeof m.appendChild!="function")throw"Container should be a single DOM node";this._options.type===B?this._domCanvas&&m.appendChild(this._domCanvas):this._svg&&m.appendChild(this._svg),this._container=m}}applyExtension(m){if(!m)throw"Extension function should be defined.";this._extension=m,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(m="png"){if(!this._qr)throw"QR code is empty";const f=await this._getElement(m),p=ue(m);if(!f)return null;if(m.toLowerCase()==="svg"){const v=`\r ${new this._window.XMLSerializer().serializeToString(f)}`;return typeof Blob>"u"||this._options.jsdom?Buffer.from(v):new Blob([v],{type:p})}return new Promise(v=>{const x=f;if("toBuffer"in x)if(p==="image/png")v(x.toBuffer(p));else if(p==="image/jpeg")v(x.toBuffer(p));else{if(p!=="application/pdf")throw Error("Unsupported extension");v(x.toBuffer(p))}else"toBlob"in x&&x.toBlob(v,p,1)})}async download(m){if(!this._qr)throw"QR code is empty";if(typeof Blob>"u")throw"Cannot download in Node.js, call getRawData instead.";let f="png",p="qr";typeof m=="string"?(f=m,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):typeof m=="object"&&m!==null&&(m.name&&(p=m.name),m.extension&&(f=m.extension));const v=await this._getElement(f);if(v)if(f.toLowerCase()==="svg"){let x=new XMLSerializer().serializeToString(v);x=`\r diff --git a/dist/main-CpxLUVHd.js b/dist/main-D0QbPgKD.js similarity index 99% rename from dist/main-CpxLUVHd.js rename to dist/main-D0QbPgKD.js index eb565da..5214a02 100644 --- a/dist/main-CpxLUVHd.js +++ b/dist/main-D0QbPgKD.js @@ -2,7 +2,7 @@ var NR = Object.defineProperty; var LR = (t, e, r) => e in t ? NR(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; var Ds = (t, e, r) => LR(t, typeof e != "symbol" ? e + "" : e, r); import * as Gt from "react"; -import pv, { createContext as Sa, useContext as Tn, useState as Qt, useEffect as Dn, forwardRef as gv, createElement as qd, useId as mv, useCallback as vv, Component as kR, useLayoutEffect as $R, useRef as Un, useInsertionEffect as b5, useMemo as wi, Fragment as y5, Children as BR, isValidElement as FR } from "react"; +import pv, { createContext as Sa, useContext as Tn, useState as Qt, useEffect as Dn, forwardRef as gv, createElement as qd, useId as mv, useCallback as vv, Component as kR, useLayoutEffect as $R, useRef as Zn, useInsertionEffect as b5, useMemo as wi, Fragment as y5, Children as BR, isValidElement as FR } from "react"; import "https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"; var gn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function ts(t) { @@ -2850,7 +2850,7 @@ function UO(t) { return Bl(`0x${e}`); } async function qO({ hash: t, signature: e }) { - const r = va(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-ChY4PDp8.js"); + const r = va(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-CFcsUqQG.js"); return `0x${(() => { if (typeof e == "object" && "r" in e && "s" in e) { const { r: l, s: d, v: p, yParity: w } = e, A = Number(w ?? p), M = I2(A); @@ -7512,7 +7512,7 @@ const q0 = ({ name: t, prefix: e, encode: r, decode: n }) => new eB(t, e, r, n), for (; s.length * r & 7; ) s += "="; return s; -}, zn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => q0({ +}, qn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => q0({ prefix: e, name: t, encode(i) { @@ -7529,7 +7529,7 @@ const q0 = ({ name: t, prefix: e, encode: r, decode: n }) => new eB(t, e, r, n), }), iB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, identity: nB -}, Symbol.toStringTag, { value: "Module" })), sB = zn({ +}, Symbol.toStringTag, { value: "Module" })), sB = qn({ prefix: "0", name: "base2", alphabet: "01", @@ -7537,7 +7537,7 @@ const q0 = ({ name: t, prefix: e, encode: r, decode: n }) => new eB(t, e, r, n), }), oB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, base2: sB -}, Symbol.toStringTag, { value: "Module" })), aB = zn({ +}, Symbol.toStringTag, { value: "Module" })), aB = qn({ prefix: "7", name: "base8", alphabet: "01234567", @@ -7552,12 +7552,12 @@ const q0 = ({ name: t, prefix: e, encode: r, decode: n }) => new eB(t, e, r, n), }), fB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, base10: uB -}, Symbol.toStringTag, { value: "Module" })), lB = zn({ +}, Symbol.toStringTag, { value: "Module" })), lB = qn({ prefix: "f", name: "base16", alphabet: "0123456789abcdef", bitsPerChar: 4 -}), hB = zn({ +}), hB = qn({ prefix: "F", name: "base16upper", alphabet: "0123456789ABCDEF", @@ -7566,47 +7566,47 @@ const q0 = ({ name: t, prefix: e, encode: r, decode: n }) => new eB(t, e, r, n), __proto__: null, base16: lB, base16upper: hB -}, Symbol.toStringTag, { value: "Module" })), pB = zn({ +}, Symbol.toStringTag, { value: "Module" })), pB = qn({ prefix: "b", name: "base32", alphabet: "abcdefghijklmnopqrstuvwxyz234567", bitsPerChar: 5 -}), gB = zn({ +}), gB = qn({ prefix: "B", name: "base32upper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", bitsPerChar: 5 -}), mB = zn({ +}), mB = qn({ prefix: "c", name: "base32pad", alphabet: "abcdefghijklmnopqrstuvwxyz234567=", bitsPerChar: 5 -}), vB = zn({ +}), vB = qn({ prefix: "C", name: "base32padupper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", bitsPerChar: 5 -}), bB = zn({ +}), bB = qn({ prefix: "v", name: "base32hex", alphabet: "0123456789abcdefghijklmnopqrstuv", bitsPerChar: 5 -}), yB = zn({ +}), yB = qn({ prefix: "V", name: "base32hexupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", bitsPerChar: 5 -}), wB = zn({ +}), wB = qn({ prefix: "t", name: "base32hexpad", alphabet: "0123456789abcdefghijklmnopqrstuv=", bitsPerChar: 5 -}), xB = zn({ +}), xB = qn({ prefix: "T", name: "base32hexpadupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=", bitsPerChar: 5 -}), _B = zn({ +}), _B = qn({ prefix: "h", name: "base32z", alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769", @@ -7646,22 +7646,22 @@ const q0 = ({ name: t, prefix: e, encode: r, decode: n }) => new eB(t, e, r, n), __proto__: null, base58btc: MB, base58flickr: IB -}, Symbol.toStringTag, { value: "Module" })), TB = zn({ +}, Symbol.toStringTag, { value: "Module" })), TB = qn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 -}), RB = zn({ +}), RB = qn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 -}), DB = zn({ +}), DB = qn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 -}), OB = zn({ +}), OB = qn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", @@ -11848,23 +11848,23 @@ kn.prototype.toJ = function() { var e = this.curve.jpoint(this.x, this.y, this.curve.one); return e; }; -function Wn(t, e, r, n) { +function zn(t, e, r, n) { xc.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new sr(0)) : (this.x = new sr(e, 16), this.y = new sr(r, 16), this.z = new sr(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; } -Kv(Wn, xc.BasePoint); +Kv(zn, xc.BasePoint); is.prototype.jpoint = function(e, r, n) { - return new Wn(this, e, r, n); + return new zn(this, e, r, n); }; -Wn.prototype.toP = function() { +zn.prototype.toP = function() { if (this.isInfinity()) return this.curve.point(null, null); var e = this.z.redInvm(), r = e.redSqr(), n = this.x.redMul(r), i = this.y.redMul(r).redMul(e); return this.curve.point(n, i); }; -Wn.prototype.neg = function() { +zn.prototype.neg = function() { return this.curve.jpoint(this.x, this.y.redNeg(), this.z); }; -Wn.prototype.add = function(e) { +zn.prototype.add = function(e) { if (this.isInfinity()) return e; if (e.isInfinity()) @@ -11875,7 +11875,7 @@ Wn.prototype.add = function(e) { var d = u.redSqr(), p = d.redMul(u), w = i.redMul(d), A = l.redSqr().redIAdd(p).redISub(w).redISub(w), M = l.redMul(w.redISub(A)).redISub(o.redMul(p)), N = this.z.redMul(e.z).redMul(u); return this.curve.jpoint(A, M, N); }; -Wn.prototype.mixedAdd = function(e) { +zn.prototype.mixedAdd = function(e) { if (this.isInfinity()) return e.toJ(); if (e.isInfinity()) @@ -11886,7 +11886,7 @@ Wn.prototype.mixedAdd = function(e) { var l = a.redSqr(), d = l.redMul(a), p = n.redMul(l), w = u.redSqr().redIAdd(d).redISub(p).redISub(p), A = u.redMul(p.redISub(w)).redISub(s.redMul(d)), M = this.z.redMul(a); return this.curve.jpoint(w, A, M); }; -Wn.prototype.dblp = function(e) { +zn.prototype.dblp = function(e) { if (e === 0) return this; if (this.isInfinity()) @@ -11909,10 +11909,10 @@ Wn.prototype.dblp = function(e) { } return this.curve.jpoint(o, d.redMul(s), u); }; -Wn.prototype.dbl = function() { +zn.prototype.dbl = function() { return this.isInfinity() ? this : this.curve.zeroA ? this._zeroDbl() : this.curve.threeA ? this._threeDbl() : this._dbl(); }; -Wn.prototype._zeroDbl = function() { +zn.prototype._zeroDbl = function() { var e, r, n; if (this.zOne) { var i = this.x.redSqr(), s = this.y.redSqr(), o = s.redSqr(), a = this.x.redAdd(s).redSqr().redISub(i).redISub(o); @@ -11927,7 +11927,7 @@ Wn.prototype._zeroDbl = function() { } return this.curve.jpoint(e, r, n); }; -Wn.prototype._threeDbl = function() { +zn.prototype._threeDbl = function() { var e, r, n; if (this.zOne) { var i = this.x.redSqr(), s = this.y.redSqr(), o = s.redSqr(), a = this.x.redAdd(s).redSqr().redISub(i).redISub(o); @@ -11948,7 +11948,7 @@ Wn.prototype._threeDbl = function() { } return this.curve.jpoint(e, r, n); }; -Wn.prototype._dbl = function() { +zn.prototype._dbl = function() { var e = this.curve.a, r = this.x, n = this.y, i = this.z, s = i.redSqr().redSqr(), o = r.redSqr(), a = n.redSqr(), u = o.redAdd(o).redIAdd(o).redIAdd(e.redMul(s)), l = r.redAdd(r); l = l.redIAdd(l); var d = l.redMul(a), p = u.redSqr().redISub(d.redAdd(d)), w = d.redISub(p), A = a.redSqr(); @@ -11956,7 +11956,7 @@ Wn.prototype._dbl = function() { var M = u.redMul(w).redISub(A), N = n.redAdd(n).redMul(i); return this.curve.jpoint(p, M, N); }; -Wn.prototype.trpl = function() { +zn.prototype.trpl = function() { if (!this.curve.zeroA) return this.dbl().add(this); var e = this.x.redSqr(), r = this.y.redSqr(), n = this.z.redSqr(), i = r.redSqr(), s = e.redAdd(e).redIAdd(e), o = s.redSqr(), a = this.x.redAdd(r).redSqr().redISub(e).redISub(i); @@ -11972,10 +11972,10 @@ Wn.prototype.trpl = function() { var M = this.z.redAdd(a).redSqr().redISub(n).redISub(u); return this.curve.jpoint(w, A, M); }; -Wn.prototype.mul = function(e, r) { +zn.prototype.mul = function(e, r) { return e = new sr(e, r), this.curve._wnafMul(this, e); }; -Wn.prototype.eq = function(e) { +zn.prototype.eq = function(e) { if (e.type === "affine") return this.eq(e.toJ()); if (this === e) @@ -11986,7 +11986,7 @@ Wn.prototype.eq = function(e) { var i = r.redMul(this.z), s = n.redMul(e.z); return this.y.redMul(s).redISub(e.y.redMul(i)).cmpn(0) === 0; }; -Wn.prototype.eqXToP = function(e) { +zn.prototype.eqXToP = function(e) { var r = this.z.redSqr(), n = e.toRed(this.curve.red).redMul(r); if (this.x.cmp(n) === 0) return !0; @@ -11997,10 +11997,10 @@ Wn.prototype.eqXToP = function(e) { return !0; } }; -Wn.prototype.inspect = function() { +zn.prototype.inspect = function() { return this.isInfinity() ? "" : ""; }; -Wn.prototype.isInfinity = function() { +zn.prototype.isInfinity = function() { return this.z.cmpn(0) === 0; }; var Pd = Bu(function(t, e) { @@ -12485,11 +12485,11 @@ function CU(t, e) { } var Gv = {}, V0 = {}; Object.defineProperty(V0, "__esModule", { value: !0 }); -var Yn = ar, A1 = ki, TU = 20; +var Gn = ar, A1 = ki, TU = 20; function RU(t, e, r) { for (var n = 1634760805, i = 857760878, s = 2036477234, o = 1797285236, a = r[3] << 24 | r[2] << 16 | r[1] << 8 | r[0], u = r[7] << 24 | r[6] << 16 | r[5] << 8 | r[4], l = r[11] << 24 | r[10] << 16 | r[9] << 8 | r[8], d = r[15] << 24 | r[14] << 16 | r[13] << 8 | r[12], p = r[19] << 24 | r[18] << 16 | r[17] << 8 | r[16], w = r[23] << 24 | r[22] << 16 | r[21] << 8 | r[20], A = r[27] << 24 | r[26] << 16 | r[25] << 8 | r[24], M = r[31] << 24 | r[30] << 16 | r[29] << 8 | r[28], N = e[3] << 24 | e[2] << 16 | e[1] << 8 | e[0], L = e[7] << 24 | e[6] << 16 | e[5] << 8 | e[4], B = e[11] << 24 | e[10] << 16 | e[9] << 8 | e[8], $ = e[15] << 24 | e[14] << 16 | e[13] << 8 | e[12], H = n, W = i, V = s, te = o, R = a, K = u, ge = l, Ee = d, Y = p, S = w, m = A, f = M, g = N, b = L, x = B, _ = $, E = 0; E < TU; E += 2) H = H + R | 0, g ^= H, g = g >>> 16 | g << 16, Y = Y + g | 0, R ^= Y, R = R >>> 20 | R << 12, W = W + K | 0, b ^= W, b = b >>> 16 | b << 16, S = S + b | 0, K ^= S, K = K >>> 20 | K << 12, V = V + ge | 0, x ^= V, x = x >>> 16 | x << 16, m = m + x | 0, ge ^= m, ge = ge >>> 20 | ge << 12, te = te + Ee | 0, _ ^= te, _ = _ >>> 16 | _ << 16, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 20 | Ee << 12, V = V + ge | 0, x ^= V, x = x >>> 24 | x << 8, m = m + x | 0, ge ^= m, ge = ge >>> 25 | ge << 7, te = te + Ee | 0, _ ^= te, _ = _ >>> 24 | _ << 8, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 25 | Ee << 7, W = W + K | 0, b ^= W, b = b >>> 24 | b << 8, S = S + b | 0, K ^= S, K = K >>> 25 | K << 7, H = H + R | 0, g ^= H, g = g >>> 24 | g << 8, Y = Y + g | 0, R ^= Y, R = R >>> 25 | R << 7, H = H + K | 0, _ ^= H, _ = _ >>> 16 | _ << 16, m = m + _ | 0, K ^= m, K = K >>> 20 | K << 12, W = W + ge | 0, g ^= W, g = g >>> 16 | g << 16, f = f + g | 0, ge ^= f, ge = ge >>> 20 | ge << 12, V = V + Ee | 0, b ^= V, b = b >>> 16 | b << 16, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 20 | Ee << 12, te = te + R | 0, x ^= te, x = x >>> 16 | x << 16, S = S + x | 0, R ^= S, R = R >>> 20 | R << 12, V = V + Ee | 0, b ^= V, b = b >>> 24 | b << 8, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 25 | Ee << 7, te = te + R | 0, x ^= te, x = x >>> 24 | x << 8, S = S + x | 0, R ^= S, R = R >>> 25 | R << 7, W = W + ge | 0, g ^= W, g = g >>> 24 | g << 8, f = f + g | 0, ge ^= f, ge = ge >>> 25 | ge << 7, H = H + K | 0, _ ^= H, _ = _ >>> 24 | _ << 8, m = m + _ | 0, K ^= m, K = K >>> 25 | K << 7; - Yn.writeUint32LE(H + n | 0, t, 0), Yn.writeUint32LE(W + i | 0, t, 4), Yn.writeUint32LE(V + s | 0, t, 8), Yn.writeUint32LE(te + o | 0, t, 12), Yn.writeUint32LE(R + a | 0, t, 16), Yn.writeUint32LE(K + u | 0, t, 20), Yn.writeUint32LE(ge + l | 0, t, 24), Yn.writeUint32LE(Ee + d | 0, t, 28), Yn.writeUint32LE(Y + p | 0, t, 32), Yn.writeUint32LE(S + w | 0, t, 36), Yn.writeUint32LE(m + A | 0, t, 40), Yn.writeUint32LE(f + M | 0, t, 44), Yn.writeUint32LE(g + N | 0, t, 48), Yn.writeUint32LE(b + L | 0, t, 52), Yn.writeUint32LE(x + B | 0, t, 56), Yn.writeUint32LE(_ + $ | 0, t, 60); + Gn.writeUint32LE(H + n | 0, t, 0), Gn.writeUint32LE(W + i | 0, t, 4), Gn.writeUint32LE(V + s | 0, t, 8), Gn.writeUint32LE(te + o | 0, t, 12), Gn.writeUint32LE(R + a | 0, t, 16), Gn.writeUint32LE(K + u | 0, t, 20), Gn.writeUint32LE(ge + l | 0, t, 24), Gn.writeUint32LE(Ee + d | 0, t, 28), Gn.writeUint32LE(Y + p | 0, t, 32), Gn.writeUint32LE(S + w | 0, t, 36), Gn.writeUint32LE(m + A | 0, t, 40), Gn.writeUint32LE(f + M | 0, t, 44), Gn.writeUint32LE(g + N | 0, t, 48), Gn.writeUint32LE(b + L | 0, t, 52), Gn.writeUint32LE(x + B | 0, t, 56), Gn.writeUint32LE(_ + $ | 0, t, 60); } function m8(t, e, r, n, i) { if (i === void 0 && (i = 0), t.length !== 32) @@ -14857,23 +14857,23 @@ $n.prototype.toJ = function() { var e = this.curve.jpoint(this.x, this.y, this.curve.one); return e; }; -function Hn(t, e, r, n) { +function Wn(t, e, r, n) { Fu.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new rn(0)) : (this.x = new rn(e, 16), this.y = new rn(r, 16), this.z = new rn(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; } -tb(Hn, Fu.BasePoint); +tb(Wn, Fu.BasePoint); os.prototype.jpoint = function(e, r, n) { - return new Hn(this, e, r, n); + return new Wn(this, e, r, n); }; -Hn.prototype.toP = function() { +Wn.prototype.toP = function() { if (this.isInfinity()) return this.curve.point(null, null); var e = this.z.redInvm(), r = e.redSqr(), n = this.x.redMul(r), i = this.y.redMul(r).redMul(e); return this.curve.point(n, i); }; -Hn.prototype.neg = function() { +Wn.prototype.neg = function() { return this.curve.jpoint(this.x, this.y.redNeg(), this.z); }; -Hn.prototype.add = function(e) { +Wn.prototype.add = function(e) { if (this.isInfinity()) return e; if (e.isInfinity()) @@ -14884,7 +14884,7 @@ Hn.prototype.add = function(e) { var d = u.redSqr(), p = d.redMul(u), w = i.redMul(d), A = l.redSqr().redIAdd(p).redISub(w).redISub(w), M = l.redMul(w.redISub(A)).redISub(o.redMul(p)), N = this.z.redMul(e.z).redMul(u); return this.curve.jpoint(A, M, N); }; -Hn.prototype.mixedAdd = function(e) { +Wn.prototype.mixedAdd = function(e) { if (this.isInfinity()) return e.toJ(); if (e.isInfinity()) @@ -14895,7 +14895,7 @@ Hn.prototype.mixedAdd = function(e) { var l = a.redSqr(), d = l.redMul(a), p = n.redMul(l), w = u.redSqr().redIAdd(d).redISub(p).redISub(p), A = u.redMul(p.redISub(w)).redISub(s.redMul(d)), M = this.z.redMul(a); return this.curve.jpoint(w, A, M); }; -Hn.prototype.dblp = function(e) { +Wn.prototype.dblp = function(e) { if (e === 0) return this; if (this.isInfinity()) @@ -14918,10 +14918,10 @@ Hn.prototype.dblp = function(e) { } return this.curve.jpoint(o, d.redMul(s), u); }; -Hn.prototype.dbl = function() { +Wn.prototype.dbl = function() { return this.isInfinity() ? this : this.curve.zeroA ? this._zeroDbl() : this.curve.threeA ? this._threeDbl() : this._dbl(); }; -Hn.prototype._zeroDbl = function() { +Wn.prototype._zeroDbl = function() { var e, r, n; if (this.zOne) { var i = this.x.redSqr(), s = this.y.redSqr(), o = s.redSqr(), a = this.x.redAdd(s).redSqr().redISub(i).redISub(o); @@ -14936,7 +14936,7 @@ Hn.prototype._zeroDbl = function() { } return this.curve.jpoint(e, r, n); }; -Hn.prototype._threeDbl = function() { +Wn.prototype._threeDbl = function() { var e, r, n; if (this.zOne) { var i = this.x.redSqr(), s = this.y.redSqr(), o = s.redSqr(), a = this.x.redAdd(s).redSqr().redISub(i).redISub(o); @@ -14957,7 +14957,7 @@ Hn.prototype._threeDbl = function() { } return this.curve.jpoint(e, r, n); }; -Hn.prototype._dbl = function() { +Wn.prototype._dbl = function() { var e = this.curve.a, r = this.x, n = this.y, i = this.z, s = i.redSqr().redSqr(), o = r.redSqr(), a = n.redSqr(), u = o.redAdd(o).redIAdd(o).redIAdd(e.redMul(s)), l = r.redAdd(r); l = l.redIAdd(l); var d = l.redMul(a), p = u.redSqr().redISub(d.redAdd(d)), w = d.redISub(p), A = a.redSqr(); @@ -14965,7 +14965,7 @@ Hn.prototype._dbl = function() { var M = u.redMul(w).redISub(A), N = n.redAdd(n).redMul(i); return this.curve.jpoint(p, M, N); }; -Hn.prototype.trpl = function() { +Wn.prototype.trpl = function() { if (!this.curve.zeroA) return this.dbl().add(this); var e = this.x.redSqr(), r = this.y.redSqr(), n = this.z.redSqr(), i = r.redSqr(), s = e.redAdd(e).redIAdd(e), o = s.redSqr(), a = this.x.redAdd(r).redSqr().redISub(e).redISub(i); @@ -14981,10 +14981,10 @@ Hn.prototype.trpl = function() { var M = this.z.redAdd(a).redSqr().redISub(n).redISub(u); return this.curve.jpoint(w, A, M); }; -Hn.prototype.mul = function(e, r) { +Wn.prototype.mul = function(e, r) { return e = new rn(e, r), this.curve._wnafMul(this, e); }; -Hn.prototype.eq = function(e) { +Wn.prototype.eq = function(e) { if (e.type === "affine") return this.eq(e.toJ()); if (this === e) @@ -14995,7 +14995,7 @@ Hn.prototype.eq = function(e) { var i = r.redMul(this.z), s = n.redMul(e.z); return this.y.redMul(s).redISub(e.y.redMul(i)).cmpn(0) === 0; }; -Hn.prototype.eqXToP = function(e) { +Wn.prototype.eqXToP = function(e) { var r = this.z.redSqr(), n = e.toRed(this.curve.red).redMul(r); if (this.x.cmp(n) === 0) return !0; @@ -15006,10 +15006,10 @@ Hn.prototype.eqXToP = function(e) { return !0; } }; -Hn.prototype.inspect = function() { +Wn.prototype.inspect = function() { return this.isInfinity() ? "" : ""; }; -Hn.prototype.isInfinity = function() { +Wn.prototype.isInfinity = function() { return this.z.cmpn(0) === 0; }; var Qc = zo, E8 = z0, Y0 = G0, cq = Bi; @@ -18285,27 +18285,27 @@ const sp = ({ name: t, prefix: e, encode: r, decode: n }) => new kH(t, e, r, n), for (let u = 0; u < t.length; ++u) for (a = a << 8 | t[u], o += 8; o > r; ) o -= r, s += e[i & a >> o]; if (o && (s += e[i & a << r - o]), n) for (; s.length * r & 7; ) s += "="; return s; -}, Kn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => sp({ prefix: e, name: t, encode(i) { +}, Hn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => sp({ prefix: e, name: t, encode(i) { return BH(i, n, r); }, decode(i) { return $H(i, n, r, t); } }), FH = sp({ prefix: "\0", name: "identity", encode: (t) => DH(t), decode: (t) => RH(t) }); var jH = Object.freeze({ __proto__: null, identity: FH }); -const UH = Kn({ prefix: "0", name: "base2", alphabet: "01", bitsPerChar: 1 }); +const UH = Hn({ prefix: "0", name: "base2", alphabet: "01", bitsPerChar: 1 }); var qH = Object.freeze({ __proto__: null, base2: UH }); -const zH = Kn({ prefix: "7", name: "base8", alphabet: "01234567", bitsPerChar: 3 }); +const zH = Hn({ prefix: "7", name: "base8", alphabet: "01234567", bitsPerChar: 3 }); var WH = Object.freeze({ __proto__: null, base8: zH }); const HH = rh({ prefix: "9", name: "base10", alphabet: "0123456789" }); var KH = Object.freeze({ __proto__: null, base10: HH }); -const VH = Kn({ prefix: "f", name: "base16", alphabet: "0123456789abcdef", bitsPerChar: 4 }), GH = Kn({ prefix: "F", name: "base16upper", alphabet: "0123456789ABCDEF", bitsPerChar: 4 }); +const VH = Hn({ prefix: "f", name: "base16", alphabet: "0123456789abcdef", bitsPerChar: 4 }), GH = Hn({ prefix: "F", name: "base16upper", alphabet: "0123456789ABCDEF", bitsPerChar: 4 }); var YH = Object.freeze({ __proto__: null, base16: VH, base16upper: GH }); -const JH = Kn({ prefix: "b", name: "base32", alphabet: "abcdefghijklmnopqrstuvwxyz234567", bitsPerChar: 5 }), XH = Kn({ prefix: "B", name: "base32upper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", bitsPerChar: 5 }), ZH = Kn({ prefix: "c", name: "base32pad", alphabet: "abcdefghijklmnopqrstuvwxyz234567=", bitsPerChar: 5 }), QH = Kn({ prefix: "C", name: "base32padupper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", bitsPerChar: 5 }), eK = Kn({ prefix: "v", name: "base32hex", alphabet: "0123456789abcdefghijklmnopqrstuv", bitsPerChar: 5 }), tK = Kn({ prefix: "V", name: "base32hexupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", bitsPerChar: 5 }), rK = Kn({ prefix: "t", name: "base32hexpad", alphabet: "0123456789abcdefghijklmnopqrstuv=", bitsPerChar: 5 }), nK = Kn({ prefix: "T", name: "base32hexpadupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=", bitsPerChar: 5 }), iK = Kn({ prefix: "h", name: "base32z", alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769", bitsPerChar: 5 }); +const JH = Hn({ prefix: "b", name: "base32", alphabet: "abcdefghijklmnopqrstuvwxyz234567", bitsPerChar: 5 }), XH = Hn({ prefix: "B", name: "base32upper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", bitsPerChar: 5 }), ZH = Hn({ prefix: "c", name: "base32pad", alphabet: "abcdefghijklmnopqrstuvwxyz234567=", bitsPerChar: 5 }), QH = Hn({ prefix: "C", name: "base32padupper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", bitsPerChar: 5 }), eK = Hn({ prefix: "v", name: "base32hex", alphabet: "0123456789abcdefghijklmnopqrstuv", bitsPerChar: 5 }), tK = Hn({ prefix: "V", name: "base32hexupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", bitsPerChar: 5 }), rK = Hn({ prefix: "t", name: "base32hexpad", alphabet: "0123456789abcdefghijklmnopqrstuv=", bitsPerChar: 5 }), nK = Hn({ prefix: "T", name: "base32hexpadupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=", bitsPerChar: 5 }), iK = Hn({ prefix: "h", name: "base32z", alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769", bitsPerChar: 5 }); var sK = Object.freeze({ __proto__: null, base32: JH, base32upper: XH, base32pad: ZH, base32padupper: QH, base32hex: eK, base32hexupper: tK, base32hexpad: rK, base32hexpadupper: nK, base32z: iK }); const oK = rh({ prefix: "k", name: "base36", alphabet: "0123456789abcdefghijklmnopqrstuvwxyz" }), aK = rh({ prefix: "K", name: "base36upper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" }); var cK = Object.freeze({ __proto__: null, base36: oK, base36upper: aK }); const uK = rh({ name: "base58btc", prefix: "z", alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" }), fK = rh({ name: "base58flickr", prefix: "Z", alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" }); var lK = Object.freeze({ __proto__: null, base58btc: uK, base58flickr: fK }); -const hK = Kn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 }), dK = Kn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 }), pK = Kn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 }), gK = Kn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", bitsPerChar: 6 }); +const hK = Hn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 }), dK = Hn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 }), pK = Hn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 }), gK = Hn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", bitsPerChar: 6 }); var mK = Object.freeze({ __proto__: null, base64: hK, base64pad: dK, base64url: pK, base64urlpad: gK }); const cE = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), vK = cE.reduce((t, e, r) => (t[r] = e, t), []), bK = cE.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); function yK(t) { @@ -21609,7 +21609,7 @@ h0.exports; return c({}, "", {}), c; } catch { } - }(), OA = Be.clearTimeout !== _r.clearTimeout && Be.clearTimeout, NA = It && It.now !== _r.Date.now && It.now, LA = Be.setTimeout !== _r.setTimeout && Be.setTimeout, Ch = xn.ceil, Th = xn.floor, Hp = qr.getOwnPropertySymbols, kA = Sh ? Sh.isBuffer : r, Cy = Be.isFinite, $A = wh.join, BA = _y(qr.keys, qr), _n = xn.max, Vn = xn.min, FA = It.now, jA = Be.parseInt, Ty = xn.random, UA = wh.reverse, Kp = Fa(Be, "DataView"), tf = Fa(Be, "Map"), Vp = Fa(Be, "Promise"), Nc = Fa(Be, "Set"), rf = Fa(Be, "WeakMap"), nf = Fa(qr, "create"), Rh = rf && new rf(), Lc = {}, qA = ja(Kp), zA = ja(tf), WA = ja(Vp), HA = ja(Nc), KA = ja(rf), Dh = Vo ? Vo.prototype : r, sf = Dh ? Dh.valueOf : r, Ry = Dh ? Dh.toString : r; + }(), OA = Be.clearTimeout !== _r.clearTimeout && Be.clearTimeout, NA = It && It.now !== _r.Date.now && It.now, LA = Be.setTimeout !== _r.setTimeout && Be.setTimeout, Ch = xn.ceil, Th = xn.floor, Hp = qr.getOwnPropertySymbols, kA = Sh ? Sh.isBuffer : r, Cy = Be.isFinite, $A = wh.join, BA = _y(qr.keys, qr), _n = xn.max, Kn = xn.min, FA = It.now, jA = Be.parseInt, Ty = xn.random, UA = wh.reverse, Kp = Fa(Be, "DataView"), tf = Fa(Be, "Map"), Vp = Fa(Be, "Promise"), Nc = Fa(Be, "Set"), rf = Fa(Be, "WeakMap"), nf = Fa(qr, "create"), Rh = rf && new rf(), Lc = {}, qA = ja(Kp), zA = ja(tf), WA = ja(Vp), HA = ja(Nc), KA = ja(rf), Dh = Vo ? Vo.prototype : r, sf = Dh ? Dh.valueOf : r, Ry = Dh ? Dh.toString : r; function ee(c) { if (en(c) && !ir(c) && !(c instanceof wr)) { if (c instanceof qi) @@ -21698,7 +21698,7 @@ h0.exports; return c; } function YA() { - var c = this.__wrapped__.value(), h = this.__dir__, y = ir(c), O = h < 0, q = y ? c.length : 0, ne = aM(0, q, this.__views__), fe = ne.start, me = ne.end, we = me - fe, We = O ? me : fe - 1, He = this.__iteratees__, Xe = He.length, wt = 0, Ot = Vn(we, this.__takeCount__); + var c = this.__wrapped__.value(), h = this.__dir__, y = ir(c), O = h < 0, q = y ? c.length : 0, ne = aM(0, q, this.__views__), fe = ne.start, me = ne.end, we = me - fe, We = O ? me : fe - 1, He = this.__iteratees__, Xe = He.length, wt = 0, Ot = Kn(we, this.__takeCount__); if (!y || !O && q == we && Ot == we) return tw(c, this.__actions__); var Ht = []; @@ -21920,7 +21920,7 @@ h0.exports; if (fe = uM(c), !me) return fi(c, fe); } else { - var Xe = Gn(c), wt = Xe == re || Xe == de; + var Xe = Vn(c), wt = Xe == re || Xe == de; if (Zo(c)) return iw(c, me); if (Xe == Pe || Xe == D || wt && !q) { @@ -22057,12 +22057,12 @@ h0.exports; return c != null && h in qr(c); } function MP(c, h, y) { - return c >= Vn(h, y) && c < _n(h, y); + return c >= Kn(h, y) && c < _n(h, y); } function Qp(c, h, y) { for (var O = y ? Lp : vh, q = c[0].length, ne = c.length, fe = ne, me = Ie(ne), we = 1 / 0, We = []; fe--; ) { var He = c[fe]; - fe && h && (He = Xr(He, Pi(h))), we = Vn(He.length, we), me[fe] = !y && (h || q >= 120 && He.length >= 120) ? new ka(fe && He) : r; + fe && h && (He = Xr(He, Pi(h))), we = Kn(He.length, we), me[fe] = !y && (h || q >= 120 && He.length >= 120) ? new ka(fe && He) : r; } He = c[0]; var Xe = -1, wt = me[0]; @@ -22103,7 +22103,7 @@ h0.exports; return c === h ? !0 : c == null || h == null || !en(c) && !en(h) ? c !== c && h !== h : RP(c, h, y, O, uf, q); } function RP(c, h, y, O, q, ne) { - var fe = ir(c), me = ir(h), we = fe ? oe : Gn(c), We = me ? oe : Gn(h); + var fe = ir(c), me = ir(h), we = fe ? oe : Vn(c), We = me ? oe : Vn(h); we = we == D ? Pe : we, We = We == D ? Pe : We; var He = we == Pe, Xe = We == Pe, wt = we == We; if (wt && Zo(c)) { @@ -22123,7 +22123,7 @@ h0.exports; return wt ? (ne || (ne = new hs()), sM(c, h, y, O, q, ne)) : !1; } function DP(c) { - return en(c) && Gn(c) == ie; + return en(c) && Vn(c) == ie; } function eg(c, h, y, O) { var q = y.length, ne = q, fe = !O; @@ -22160,7 +22160,7 @@ h0.exports; return en(c) && ri(c) == $e; } function NP(c) { - return en(c) && Gn(c) == Me; + return en(c) && Vn(c) == Me; } function LP(c) { return en(c) && Qh(c.length) && !!Fr[ri(c)]; @@ -22377,7 +22377,7 @@ h0.exports; else We ? Kt = Ht && (O || wt) : me ? Kt = Ht && wt && (O || !Ot) : we ? Kt = Ht && wt && !Ot && (O || !fr) : Ot || fr ? Kt = !1 : Kt = O ? Xe <= h : Xe < h; Kt ? q = He + 1 : ne = He; } - return Vn(ne, I); + return Kn(ne, I); } function Zy(c, h) { for (var y = -1, O = c.length, q = 0, ne = []; ++y < O; ) { @@ -22809,7 +22809,7 @@ h0.exports; function dg(c) { var h = xn[c]; return function(y, O) { - if (y = Ki(y), O = O == null ? 0 : Vn(cr(O), 292), O && Cy(y)) { + if (y = Ki(y), O = O == null ? 0 : Kn(cr(O), 292), O && Cy(y)) { var q = (Cr(y) + "e").split("e"), ne = h(q[0] + "e" + (+q[1] + O)); return q = (Cr(ne) + "e").split("e"), +(q[0] + "e" + (+q[1] - O)); } @@ -22821,7 +22821,7 @@ h0.exports; } : Lg; function vw(c) { return function(h) { - var y = Gn(h); + var y = Vn(h); return y == ie ? zp(h) : y == Me ? yA(h) : lA(h, c(h)); }; } @@ -23021,8 +23021,8 @@ h0.exports; for (var h = []; c; ) Ho(h, bg(c)), c = Ph(c); return h; - } : kg, Gn = ri; - (Kp && Gn(new Kp(new ArrayBuffer(1))) != Ze || tf && Gn(new tf()) != ie || Vp && Gn(Vp.resolve()) != De || Nc && Gn(new Nc()) != Me || rf && Gn(new rf()) != qe) && (Gn = function(c) { + } : kg, Vn = ri; + (Kp && Vn(new Kp(new ArrayBuffer(1))) != Ze || tf && Vn(new tf()) != ie || Vp && Vn(Vp.resolve()) != De || Nc && Vn(new Nc()) != Me || rf && Vn(new rf()) != qe) && (Vn = function(c) { var h = ri(c), y = h == Pe ? c.constructor : r, O = y ? ja(y) : ""; if (O) switch (O) { @@ -23050,7 +23050,7 @@ h0.exports; h -= fe; break; case "take": - h = Vn(h, c + fe); + h = Kn(h, c + fe); break; case "takeRight": c = _n(c, h - fe); @@ -23186,7 +23186,7 @@ h0.exports; var we = c[3]; c[3] = we ? aw(we, me, h[4]) : me, c[4] = we ? Ko(c[3], d) : h[4]; } - return me = h[5], me && (we = c[5], c[5] = we ? cw(we, me, h[6]) : me, c[6] = we ? Ko(c[5], d) : h[6]), me = h[7], me && (c[7] = me), O & R && (c[8] = c[8] == null ? h[8] : Vn(c[8], h[8])), c[9] == null && (c[9] = h[9]), c[0] = h[0], c[1] = q, c; + return me = h[5], me && (we = c[5], c[5] = we ? cw(we, me, h[6]) : me, c[6] = we ? Ko(c[5], d) : h[6]), me = h[7], me && (c[7] = me), O & R && (c[8] = c[8] == null ? h[8] : Kn(c[8], h[8])), c[9] == null && (c[9] = h[9]), c[0] = h[0], c[1] = q, c; } function bM(c) { var h = []; @@ -23212,7 +23212,7 @@ h0.exports; return h.length < 2 ? c : Ba(c, Wi(h, 0, -1)); } function wM(c, h) { - for (var y = c.length, O = Vn(h.length, y), q = fi(c); O--; ) { + for (var y = c.length, O = Kn(h.length, y), q = fi(c); O--; ) { var ne = h[O]; c[O] = fo(ne, y) ? q[ne] : r; } @@ -23349,7 +23349,7 @@ h0.exports; if (!O) return -1; var q = O - 1; - return y !== r && (q = cr(y), q = y < 0 ? _n(O + q, 0) : Vn(q, O - 1)), bh(c, Ut(h, 3), q, !0); + return y !== r && (q = cr(y), q = y < 0 ? _n(O + q, 0) : Kn(q, O - 1)), bh(c, Ut(h, 3), q, !0); } function Lw(c) { var h = c == null ? 0 : c.length; @@ -23406,7 +23406,7 @@ h0.exports; if (!O) return -1; var q = O; - return y !== r && (q = cr(y), q = q < 0 ? _n(O + q, 0) : Vn(q, O - 1)), h === h ? xA(c, h, q) : bh(c, my, q, !0); + return y !== r && (q = cr(y), q = q < 0 ? _n(O + q, 0) : Kn(q, O - 1)), h === h ? xA(c, h, q) : bh(c, my, q, !0); } function zM(c, h) { return c && c.length ? Vy(c, cr(h)) : r; @@ -23703,7 +23703,7 @@ h0.exports; return 0; if (li(c)) return ed(c) ? Rc(c) : c.length; - var h = Gn(c); + var h = Vn(c); return h == ie || h == Me ? c.size : tg(c).length; } function QI(c, h, y) { @@ -23776,7 +23776,7 @@ h0.exports; } function fr(un) { var ps = un - we, po = un - We, h2 = h - ps; - return Xe ? Vn(h2, ne - po) : h2; + return Xe ? Kn(h2, ne - po) : h2; } function Kt(un) { var ps = un - we, po = un - We; @@ -23855,7 +23855,7 @@ h0.exports; h = h.length == 1 && ir(h[0]) ? Xr(h[0], Pi(Ut())) : Xr(Bn(h, 1), Pi(Ut())); var y = h.length; return hr(function(O) { - for (var q = -1, ne = Vn(O.length, y); ++q < ne; ) + for (var q = -1, ne = Kn(O.length, y); ++q < ne; ) O[q] = h[q].call(this, O[q]); return Pn(c, this, O); }); @@ -23946,7 +23946,7 @@ h0.exports; return !0; if (li(c) && (ir(c) || typeof c == "string" || typeof c.splice == "function" || Zo(c) || jc(c) || Ua(c))) return !c.length; - var h = Gn(c); + var h = Vn(c); if (h == ie || h == Me) return !c.size; if (hf(c)) @@ -24041,7 +24041,7 @@ h0.exports; return c === r; } function $C(c) { - return en(c) && Gn(c) == qe; + return en(c) && Vn(c) == qe; } function BC(c) { return en(c) && ri(c) == ze; @@ -24056,7 +24056,7 @@ h0.exports; return ed(c) ? ls(c) : fi(c); if (ef && c[ef]) return bA(c[ef]()); - var h = Gn(c), y = h == ie ? zp : h == Me ? yh : Uc; + var h = Vn(c), y = h == ie ? zp : h == Me ? yh : Uc; return y(c); } function ho(c) { @@ -24272,7 +24272,7 @@ h0.exports; } if (y || c % 1 || h % 1) { var q = Ty(); - return Vn(c + q * (h - c + jr("1e-" + ((q + "").length - 1))), h); + return Kn(c + q * (h - c + jr("1e-" + ((q + "").length - 1))), h); } return ig(c, h); } @@ -24567,7 +24567,7 @@ function print() { __p += __j.call(arguments, '') } function mR(c, h) { if (c = cr(c), c < 1 || c > _) return []; - var y = P, O = Vn(c, P); + var y = P, O = Kn(c, P); h = Ut(h), c -= P; for (var q = Up(O, h); ++y < c; ) h(y); @@ -24625,8 +24625,8 @@ function print() { __p += __j.call(arguments, '') } wr.prototype[c] = function(y) { y = y === r ? 1 : _n(cr(y), 0); var O = this.__filtered__ && !h ? new wr(this) : this.clone(); - return O.__filtered__ ? O.__takeCount__ = Vn(y, O.__takeCount__) : O.__views__.push({ - size: Vn(y, P), + return O.__filtered__ ? O.__takeCount__ = Kn(y, O.__takeCount__) : O.__views__.push({ + size: Kn(y, P), type: c + (O.__dir__ < 0 ? "Right" : "") }), O; }, wr.prototype[c + "Right"] = function(y) { @@ -29496,14 +29496,14 @@ self instanceof WorkerGlobalScope && typeof self.importScripts == "function", _X hasStandardBrowserWebWorkerEnv: xX, navigator: K1, origin: _X -}, Symbol.toStringTag, { value: "Module" })), Xn = { +}, Symbol.toStringTag, { value: "Module" })), Jn = { ...EX, ...yX }; function SX(t, e) { - return dp(t, new Xn.classes.URLSearchParams(), Object.assign({ + return dp(t, new Jn.classes.URLSearchParams(), Object.assign({ visitor: function(r, n, i, s) { - return Xn.isNode && Oe.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : s.defaultVisitor.apply(this, arguments); + return Jn.isNode && Oe.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : s.defaultVisitor.apply(this, arguments); } }, e)); } @@ -29597,8 +29597,8 @@ const oh = { maxContentLength: -1, maxBodyLength: -1, env: { - FormData: Xn.classes.FormData, - Blob: Xn.classes.Blob + FormData: Jn.classes.FormData, + Blob: Jn.classes.Blob }, validateStatus: function(e) { return e >= 200 && e < 300; @@ -29890,10 +29890,10 @@ const g0 = (t, e, r = 3) => { total: t, loaded: n }), e[1]]; -}, B6 = (t) => (...e) => Oe.asap(() => t(...e)), $X = Xn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Xn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( - new URL(Xn.origin), - Xn.navigator && /(msie|trident)/i.test(Xn.navigator.userAgent) -) : () => !0, BX = Xn.hasStandardBrowserEnv ? ( +}, B6 = (t) => (...e) => Oe.asap(() => t(...e)), $X = Jn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Jn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( + new URL(Jn.origin), + Jn.navigator && /(msie|trident)/i.test(Jn.navigator.userAgent) +) : () => !0, BX = Jn.hasStandardBrowserEnv ? ( // Standard browser envs support document.cookie { write(t, e, r, n, i, s) { @@ -30003,14 +30003,14 @@ const OS = (t) => { ); let u; if (Oe.isFormData(r)) { - if (Xn.hasStandardBrowserEnv || Xn.hasStandardBrowserWebWorkerEnv) + if (Jn.hasStandardBrowserEnv || Jn.hasStandardBrowserWebWorkerEnv) o.setContentType(void 0); else if ((u = o.getContentType()) !== !1) { const [l, ...d] = u ? u.split(";").map((p) => p.trim()).filter(Boolean) : []; o.setContentType([l || "multipart/form-data", ...d].join("; ")); } } - if (Xn.hasStandardBrowserEnv && (n && Oe.isFunction(n) && (n = n(e)), n || n !== !1 && $X(e.url))) { + if (Jn.hasStandardBrowserEnv && (n && Oe.isFunction(n) && (n = n(e)), n || n !== !1 && $X(e.url))) { const l = i && s && BX.read(s); l && o.set(i, l); } @@ -30066,7 +30066,7 @@ const OS = (t) => { L && (n(!H || H.type ? new Hu(null, t, L) : H), L.abort(), L = null); }, i.cancelToken && i.cancelToken.subscribe(d), i.signal && (i.signal.aborted ? d() : i.signal.addEventListener("abort", d))); const $ = NX(i.url); - if ($ && Xn.protocols.indexOf($) === -1) { + if ($ && Jn.protocols.indexOf($) === -1) { n(new or("Unsupported protocol " + $ + ":", or.ERR_BAD_REQUEST, t)); return; } @@ -30160,7 +30160,7 @@ const OS = (t) => { } }, GX = NS && LS(() => { let t = !1; - const e = new Request(Xn.origin, { + const e = new Request(Jn.origin, { body: new ReadableStream(), method: "POST", get duplex() { @@ -30184,7 +30184,7 @@ const YX = async (t) => { if (Oe.isBlob(t)) return t.size; if (Oe.isSpecCompliantForm(t)) - return (await new Request(Xn.origin, { + return (await new Request(Jn.origin, { method: "POST", body: t }).arrayBuffer()).byteLength; @@ -31179,7 +31179,7 @@ function wp(t, { repeat: e, repeatType: r = "loop" }, n) { const i = t.filter(PZ), s = e && r !== "loop" && e % 2 === 1 ? 0 : i.length - 1; return !s || n === void 0 ? i[s] : n; } -const qn = (t) => t; +const Un = (t) => t; function MZ(t) { let e = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), n = !1, i = !1; const s = /* @__PURE__ */ new WeakSet(); @@ -31252,7 +31252,7 @@ function GS(t, e) { o[gd[$]].cancel(B); }, state: i, steps: o }; } -const { schedule: Lr, cancel: wa, state: Fn, steps: Dm } = GS(typeof requestAnimationFrame < "u" ? requestAnimationFrame : qn, !0), YS = (t, e, r) => (((1 - 3 * r + 3 * e) * t + (3 * r - 6 * e)) * t + 3 * e) * t, CZ = 1e-7, TZ = 12; +const { schedule: Lr, cancel: wa, state: Fn, steps: Dm } = GS(typeof requestAnimationFrame < "u" ? requestAnimationFrame : Un, !0), YS = (t, e, r) => (((1 - 3 * r + 3 * e) * t + (3 * r - 6 * e)) * t + 3 * e) * t, CZ = 1e-7, TZ = 12; function RZ(t, e, r, n, i) { let s, o, a = 0; do @@ -31262,7 +31262,7 @@ function RZ(t, e, r, n, i) { } function ch(t, e, r, n) { if (t === e && r === n) - return qn; + return Un; const i = (s) => RZ(s, 0, 1, t, r); return (s) => s === 0 || s === 1 ? s : YS(i(s), e, n); } @@ -31270,7 +31270,7 @@ const JS = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, XS function DZ(t) { return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || n7(t) : !0; } -let Ku = qn, Uo = qn; +let Ku = Un, Uo = Un; process.env.NODE_ENV !== "production" && (Ku = (t, e) => { !t && typeof console < "u" && console.warn(e); }, Uo = (t, e) => { @@ -31474,7 +31474,7 @@ const Q1 = { test: /* @__PURE__ */ kb("hsl", "hue"), parse: /* @__PURE__ */ h7("hue", "saturation", "lightness"), transform: ({ hue: t, saturation: e, lightness: r, alpha: n = 1 }) => "hsla(" + Math.round(t) + ", " + Gs.transform(Yf(e)) + ", " + Gs.transform(Yf(r)) + ", " + Yf(Cl.transform(n)) + ")" -}, Jn = { +}, Yn = { test: (t) => sc.test(t) || Q1.test(t) || eu.test(t), parse: (t) => sc.test(t) ? sc.parse(t) : eu.test(t) ? eu.parse(t) : Q1.parse(t), transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? sc.transform(t) : eu.transform(t) @@ -31491,7 +31491,7 @@ function Tl(t) { var: [] }, i = []; let s = 0; - const a = e.replace(eQ, (u) => (Jn.test(u) ? (n.color.push(s), i.push(p7), r.push(Jn.parse(u))) : u.startsWith(QZ) ? (n.var.push(s), i.push(ZZ), r.push(u)) : (n.number.push(s), i.push(d7), r.push(parseFloat(u))), ++s, Z6)).split(Z6); + const a = e.replace(eQ, (u) => (Yn.test(u) ? (n.color.push(s), i.push(p7), r.push(Yn.parse(u))) : u.startsWith(QZ) ? (n.var.push(s), i.push(ZZ), r.push(u)) : (n.number.push(s), i.push(d7), r.push(parseFloat(u))), ++s, Z6)).split(Z6); return { values: r, split: a, indexes: n, types: i }; } function g7(t) { @@ -31504,7 +31504,7 @@ function m7(t) { for (let o = 0; o < n; o++) if (s += e[o], i[o] !== void 0) { const a = r[o]; - a === d7 ? s += Yf(i[o]) : a === p7 ? s += Jn.transform(i[o]) : s += i[o]; + a === d7 ? s += Yf(i[o]) : a === p7 ? s += Yn.transform(i[o]) : s += i[o]; } return s; }; @@ -31613,17 +31613,17 @@ const sQ = /\b([a-z-]*)\(.*?\)/gu, ev = { }, cQ = { ...$b, // Color props - color: Jn, - backgroundColor: Jn, - outlineColor: Jn, - fill: Jn, - stroke: Jn, + color: Yn, + backgroundColor: Yn, + outlineColor: Yn, + fill: Yn, + stroke: Yn, // Border props - borderColor: Jn, - borderTopColor: Jn, - borderRightColor: Jn, - borderBottomColor: Jn, - borderLeftColor: Jn, + borderColor: Yn, + borderTopColor: Yn, + borderRightColor: Yn, + borderBottomColor: Yn, + borderLeftColor: Yn, filter: ev, WebkitFilter: ev }, Bb = (t) => cQ[t]; @@ -31950,7 +31950,7 @@ function n_({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 3 }; } const AQ = /* @__PURE__ */ ch(0.42, 0, 1, 1), PQ = /* @__PURE__ */ ch(0, 0, 0.58, 1), E7 = /* @__PURE__ */ ch(0.42, 0, 0.58, 1), MQ = (t) => Array.isArray(t) && typeof t[0] != "number", jb = (t) => Array.isArray(t) && typeof t[0] == "number", i_ = { - linear: qn, + linear: Un, easeIn: AQ, easeInOut: E7, easeOut: PQ, @@ -32020,7 +32020,7 @@ function OQ(t, e) { return (r) => Qr(t, e, r); } function Ub(t) { - return typeof t == "number" ? OQ : typeof t == "string" ? Ob(t) ? v0 : Jn.test(t) ? a_ : kQ : Array.isArray(t) ? S7 : typeof t == "object" ? Jn.test(t) ? a_ : NQ : v0; + return typeof t == "number" ? OQ : typeof t == "string" ? Ob(t) ? v0 : Yn.test(t) ? a_ : kQ : Array.isArray(t) ? S7 : typeof t == "object" ? Yn.test(t) ? a_ : NQ : v0; } function S7(t, e) { const r = [...t], n = r.length, i = t.map((s, o) => Ub(s)(s, e[o])); @@ -32061,7 +32061,7 @@ function $Q(t, e, r) { for (let o = 0; o < s; o++) { let a = i(t[o], t[o + 1]); if (e) { - const u = Array.isArray(e) ? e[o] || qn : e; + const u = Array.isArray(e) ? e[o] || Un : e; a = Ro(u, a); } n.push(a); @@ -32459,11 +32459,11 @@ class f_ extends y7 { else { const { resolved: r } = this; if (!r) - return qn; + return Un; const { animation: n } = r; u_(n, e); } - return qn; + return Un; } play() { if (this.isStopped) @@ -32872,9 +32872,9 @@ const Gb = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), dee = "f function T7(t) { return t.props[C7]; } -const Zn = (t) => !!(t && t.getVelocity); +const Xn = (t) => !!(t && t.getVelocity); function pee(t) { - return !!(Zn(t) && t.add); + return !!(Xn(t) && t.add); } function iv(t, e) { const r = t.getValue("willChange"); @@ -33682,11 +33682,11 @@ function Xee(t, e = 10) { } class Zee extends Ra { constructor(e) { - super(e), this.removeGroupControls = qn, this.removeListeners = qn, this.controls = new Jee(e); + super(e), this.removeGroupControls = Un, this.removeListeners = Un, this.controls = new Jee(e); } mount() { const { dragControls: e } = this.node.getProps(); - e && (this.removeGroupControls = e.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || qn; + e && (this.removeGroupControls = e.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || Un; } unmount() { this.removeGroupControls(), this.removeListeners(); @@ -33697,7 +33697,7 @@ const R_ = (t) => (e, r) => { }; class Qee extends Ra { constructor() { - super(...arguments), this.removePointerDownListener = qn; + super(...arguments), this.removePointerDownListener = Un; } onPointerDown(e) { this.session = new N7(e, this.createPanHandlers(), { @@ -33857,7 +33857,7 @@ function ote(t, e, r, n, i, s) { function L_(t, e) { return t[e] !== void 0 ? t[e] : t.borderRadius; } -const ate = /* @__PURE__ */ Y7(0, 0.5, t7), cte = /* @__PURE__ */ Y7(0.5, 0.95, qn); +const ate = /* @__PURE__ */ Y7(0, 0.5, t7), cte = /* @__PURE__ */ Y7(0.5, 0.95, Un); function Y7(t, e, r) { return (n) => n < t ? 0 : n > e ? 1 : r(Iu(t, e, n)); } @@ -33990,7 +33990,7 @@ class mte { } } function Ud(t) { - const e = Zn(t) ? t.get() : t; + const e = Xn(t) ? t.get() : t; return aee(e) ? e.toValue() : e; } function vte(t, e) { @@ -34004,7 +34004,7 @@ function bte(t) { return t instanceof SVGElement && t.tagName !== "svg"; } function yte(t, e, r) { - const n = Zn(t) ? t : Rl(t); + const n = Xn(t) ? t : Rl(t); return n.start(Wb("", n, e, r)), n.animation; } const Ja = { @@ -34571,7 +34571,7 @@ function Nte(t) { const Lte = { duration: 0.45, ease: [0.4, 0, 0.1, 1] -}, X_ = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Z_ = X_("applewebkit/") && !X_("chrome/") ? Math.round : qn; +}, X_ = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Z_ = X_("applewebkit/") && !X_("chrome/") ? Math.round : Un; function Q_(t) { t.min = Z_(t.min), t.max = Z_(t.max); } @@ -34671,7 +34671,7 @@ function zm(t, e) { } class qte extends Ra { constructor() { - super(...arguments), this.removeStartListeners = qn, this.removeEndListeners = qn, this.removeAccessibleListeners = qn, this.startPointerPress = (e, r) => { + super(...arguments), this.removeStartListeners = Un, this.removeEndListeners = Un, this.removeAccessibleListeners = Un, this.startPointerPress = (e, r) => { if (this.isPressing) return; this.removeEndListeners(); @@ -34811,7 +34811,7 @@ const Jte = { }), Ep = Sa({}), Zb = typeof window < "u", n9 = Zb ? $R : Dn, i9 = Sa({ strict: !1 }); function Zte(t, e, r, n, i) { var s, o; - const { visualElement: a } = Tn(Ep), u = Tn(i9), l = Tn(_p), d = Tn(Xb).reducedMotion, p = Un(); + const { visualElement: a } = Tn(Ep), u = Tn(i9), l = Tn(_p), d = Tn(Xb).reducedMotion, p = Zn(); n = n || u.renderer, !p.current && n && (p.current = n(t, { visualState: e, parent: a, @@ -34822,11 +34822,11 @@ function Zte(t, e, r, n, i) { })); const w = p.current, A = Tn(K7); w && !w.projection && i && (w.type === "html" || w.type === "svg") && Qte(p.current, r, i, A); - const M = Un(!1); + const M = Zn(!1); b5(() => { w && M.current && w.update(r, l); }); - const N = r[C7], L = Un(!!N && !(!((s = window.MotionHandoffIsComplete) === null || s === void 0) && s.call(window, N)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, N))); + const N = r[C7], L = Zn(!!N && !(!((s = window.MotionHandoffIsComplete) === null || s === void 0) && s.call(window, N)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, N))); return n9(() => { w && (M.current = !0, window.MotionIsMounted = !0, w.updateFeatures(), Jb.render(w.render), L.current && w.animationState && w.animationState.animateChanges()); }), Dn(() => { @@ -35057,20 +35057,20 @@ function ey(t, e, r) { var n; const { style: i } = t, s = {}; for (const o in i) - (Zn(i[o]) || e.style && Zn(e.style[o]) || f9(o, t) || ((n = r == null ? void 0 : r.getValue(o)) === null || n === void 0 ? void 0 : n.liveStyle) !== void 0) && (s[o] = i[o]); + (Xn(i[o]) || e.style && Xn(e.style[o]) || f9(o, t) || ((n = r == null ? void 0 : r.getValue(o)) === null || n === void 0 ? void 0 : n.liveStyle) !== void 0) && (s[o] = i[o]); return s; } function l9(t, e, r) { const n = ey(t, e, r); for (const i in t) - if (Zn(t[i]) || Zn(e[i])) { + if (Xn(t[i]) || Xn(e[i])) { const s = ah.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i; n[s] = t[i]; } return n; } function ty(t) { - const e = Un(null); + const e = Zn(null); return e.current === null && (e.current = t()), e.current; } function fre({ scrapeMotionValuesFromProps: t, createRenderState: e, onMount: r }, n, i, s) { @@ -35239,7 +35239,7 @@ const sy = (t) => typeof t == "string" && t.toLowerCase() === "svg", yre = { }; function g9(t, e, r) { for (const n in e) - !Zn(e[n]) && !f9(n, r) && (t[n] = e[n]); + !Xn(e[n]) && !f9(n, r) && (t[n] = e[n]); } function xre({ transformTemplate: t }, e) { return wi(() => { @@ -35321,7 +35321,7 @@ function Mre(t, e, r, n) { } function Ire(t = !1) { return (r, n, i, { latestValues: s }, o) => { - const u = (Qb(r) ? Mre : Ere)(n, s, o, r), l = Pre(n, typeof r == "string", t), d = r !== y5 ? { ...l, ...u, ref: i } : {}, { children: p } = n, w = wi(() => Zn(p) ? p.get() : p, [p]); + const u = (Qb(r) ? Mre : Ere)(n, s, o, r), l = Pre(n, typeof r == "string", t), d = r !== y5 ? { ...l, ...u, ref: i } : {}, { children: p } = n, w = wi(() => Xn(p) ? p.get() : p, [p]); return qd(r, { ...d, children: w @@ -35352,9 +35352,9 @@ function Tre() { function Rre(t, e, r) { for (const n in e) { const i = e[n], s = r[n]; - if (Zn(i)) + if (Xn(i)) t.addValue(n, i), process.env.NODE_ENV === "development" && vp(i.version === "11.11.17", `Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`); - else if (Zn(s)) + else if (Xn(s)) t.addValue(n, Rl(i, { owner: t })); else if (s !== i) if (t.hasValue(n)) { @@ -35369,7 +35369,7 @@ function Rre(t, e, r) { e[n] === void 0 && t.removeValue(n); return e; } -const i5 = /* @__PURE__ */ new WeakMap(), Dre = [...u7, Jn, _a], Ore = (t) => Dre.find(c7(t)), s5 = [ +const i5 = /* @__PURE__ */ new WeakMap(), Dre = [...u7, Yn, _a], Ore = (t) => Dre.find(c7(t)), s5 = [ "AnimationStart", "AnimationComplete", "Update", @@ -35401,7 +35401,7 @@ class Nre { const { willChange: d, ...p } = this.scrapeMotionValuesFromProps(r, {}, this); for (const w in p) { const A = p[w]; - u[w] !== void 0 && Zn(A) && A.set(u[w], !1); + u[w] !== void 0 && Xn(A) && A.set(u[w], !1); } } mount(e) { @@ -35538,7 +35538,7 @@ class Nre { readValue(e, r) { var n; let i = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : (n = this.getBaseTargetFromProps(this.props, e)) !== null && n !== void 0 ? n : this.readValueFromInstance(this.current, e, this.options); - return i != null && (typeof i == "string" && (i7(i) || n7(i)) ? i = parseFloat(i) : !Ore(i) && _a.test(r) && (i = v7(e, r)), this.setBaseTarget(e, Zn(i) ? i.get() : i)), Zn(i) ? i.get() : i; + return i != null && (typeof i == "string" && (i7(i) || n7(i)) ? i = parseFloat(i) : !Ore(i) && _a.test(r) && (i = v7(e, r)), this.setBaseTarget(e, Xn(i) ? i.get() : i)), Xn(i) ? i.get() : i; } /** * Set the base target to later animate back to. This is currently @@ -35562,7 +35562,7 @@ class Nre { if (n && i !== void 0) return i; const s = this.getBaseTargetFromProps(this.props, e); - return s !== void 0 && !Zn(s) ? s : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e]; + return s !== void 0 && !Xn(s) ? s : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e]; } on(e, r) { return this.events[e] || (this.events[e] = new Vb()), this.events[e].add(r); @@ -35613,7 +35613,7 @@ class kre extends b9 { handleChildMotionValue() { this.childSubscription && (this.childSubscription(), delete this.childSubscription); const { children: e } = this.props; - Zn(e) && (this.childSubscription = e.on("change", (r) => { + Xn(e) && (this.childSubscription = e.on("change", (r) => { this.current && (this.current.textContent = `${r}`); })); } @@ -35672,7 +35672,7 @@ class Ure extends Gt.Component { } } function qre({ children: t, isPresent: e }) { - const r = mv(), n = Un(null), i = Un({ + const r = mv(), n = Zn(null), i = Zn({ width: 0, height: 0, top: 0, @@ -35738,7 +35738,7 @@ function o5(t) { } const Hre = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExitComplete: i, presenceAffectsLayout: s = !0, mode: o = "sync" }) => { Uo(!e, "Replace exitBeforeEnter with mode='wait'"); - const a = wi(() => o5(t), [t]), u = a.map(bd), l = Un(!0), d = Un(a), p = ty(() => /* @__PURE__ */ new Map()), [w, A] = Qt(a), [M, N] = Qt(a); + const a = wi(() => o5(t), [t]), u = a.map(bd), l = Zn(!0), d = Zn(a), p = ty(() => /* @__PURE__ */ new Map()), [w, A] = Qt(a), [M, N] = Qt(a); n9(() => { l.current = !1, d.current = a; for (let $ = 0; $ < M.length; $++) { @@ -38425,26 +38425,26 @@ function zne(t) { ] }); } function k9(t) { - const { email: e } = t, [r, n] = Qt(0), [i, s] = Qt(!1), [o, a] = Qt(""), u = Un(null); - async function l() { + const { email: e } = t, [r, n] = Qt(0), [i, s] = Qt(!1), [o, a] = Qt(""); + async function u() { n(60); - const p = setInterval(() => { - n((w) => w === 0 ? (clearInterval(p), 0) : w - 1); + const d = setInterval(() => { + n((p) => p === 0 ? (clearInterval(d), 0) : p - 1); }, 1e3); } - async function d(p) { - if (a(""), !(p.length < 6)) { + async function l(d) { + if (a(""), !(d.length < 6)) { s(!0); try { - await t.onInputCode(e, p); - } catch (w) { - a(w.message); + await t.onInputCode(e, d); + } catch (p) { + a(p.message); } s(!1); } } return Dn(() => { - l(); + u(); }, []), /* @__PURE__ */ pe.jsxs(Ms, { children: [ /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ /* @__PURE__ */ pe.jsx(vZ, { className: "xc-mb-4", size: 60 }), @@ -38452,7 +38452,7 @@ function k9(t) { /* @__PURE__ */ pe.jsx("p", { className: "xc-text-lg xc-mb-1", children: "We’ve sent a verification code to" }), /* @__PURE__ */ pe.jsx("p", { className: "xc-font-bold xc-text-center", children: e }) ] }), - /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-2 xc-h-12", children: /* @__PURE__ */ pe.jsx(zne, { spinning: i, className: "xc-rounded-xl", children: /* @__PURE__ */ pe.jsx(N9, { maxLength: 6, onChange: d, disabled: i, className: "disabled:xc-opacity-20", children: /* @__PURE__ */ pe.jsx(L9, { children: /* @__PURE__ */ pe.jsxs("div", { className: Oo("xc-flex xc-gap-2", i ? "xc-opacity-20" : ""), children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-2 xc-h-12", children: /* @__PURE__ */ pe.jsx(zne, { spinning: i, className: "xc-rounded-xl", children: /* @__PURE__ */ pe.jsx(N9, { maxLength: 6, onChange: l, disabled: i, className: "disabled:xc-opacity-20", children: /* @__PURE__ */ pe.jsx(L9, { children: /* @__PURE__ */ pe.jsxs("div", { className: Oo("xc-flex xc-gap-2", i ? "xc-opacity-20" : ""), children: [ /* @__PURE__ */ pe.jsx(Xa, { index: 0 }), /* @__PURE__ */ pe.jsx(Xa, { index: 1 }), /* @__PURE__ */ pe.jsx(Xa, { index: 2 }), @@ -38464,7 +38464,7 @@ function k9(t) { ] }), /* @__PURE__ */ pe.jsxs("div", { className: "xc-text-center xc-text-sm xc-text-gray-400", children: [ "Not get it? ", - r ? `Recend in ${r}s` : /* @__PURE__ */ pe.jsx("button", { id: "sendCodeButton", ref: u, children: "Send again" }) + r ? `Recend in ${r}s` : /* @__PURE__ */ pe.jsx("button", { id: "sendCodeButton", onClick: t.onResendCode, children: "Send again" }) ] }), /* @__PURE__ */ pe.jsx("div", { id: "captcha-element" }) ] }); @@ -38472,13 +38472,7 @@ function k9(t) { function $9(t) { const { email: e } = t, [r, n] = Qt(!1), [i, s] = Qt(""), o = wi(() => `xn-btn-${(/* @__PURE__ */ new Date()).getTime()}`, [e]); async function a(w, A) { - n(!0); - try { - s(""), await Ta.getEmailCode({ account_type: "email", email: w }, A); - } catch (M) { - s(M.message); - } - n(!1); + n(!0), s(""), await Ta.getEmailCode({ account_type: "email", email: w }, A), n(!1); } async function u(w) { try { @@ -38490,7 +38484,7 @@ function $9(t) { async function l(w) { w && t.onCodeSend(); } - const d = Un(); + const d = Zn(); function p(w) { d.current = w; } @@ -39841,7 +39835,7 @@ function eie(t, e) { } function q9(t) { var ge, Ee, Y; - const e = Un(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Qt(""), [a, u] = Qt(!1), [l, d] = Qt(""), [p, w] = Qt("scan"), A = Un(), [M, N] = Qt((ge = r.config) == null ? void 0 : ge.image), [L, B] = Qt(!1), { saveLastUsedWallet: $ } = mp(); + const e = Zn(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Qt(""), [a, u] = Qt(!1), [l, d] = Qt(""), [p, w] = Qt("scan"), A = Zn(), [M, N] = Qt((ge = r.config) == null ? void 0 : ge.image), [L, B] = Qt(!1), { saveLastUsedWallet: $ } = mp(); async function H(S) { var f, g, b, x; u(!0); @@ -39991,7 +39985,7 @@ function nie(t, e) { } function z9(t) { var p; - const [e, r] = Qt(), { wallet: n, onSignFinish: i } = t, s = Un(), [o, a] = Qt("connect"), { saveLastUsedWallet: u } = mp(); + const [e, r] = Qt(), { wallet: n, onSignFinish: i } = t, s = Zn(), [o, a] = Qt("connect"), { saveLastUsedWallet: u } = mp(); async function l(w) { var A; try { @@ -43023,7 +43017,7 @@ function Gm(t) { return /* @__PURE__ */ pe.jsx("button", { onClick: r, className: "xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center", children: e }); } function eA(t) { - const { wallet: e, connector: r, loading: n } = t, i = Un(null), s = Un(), [o, a] = Qt(), [u, l] = Qt(), [d, p] = Qt("connect"), [w, A] = Qt(!1), [M, N] = Qt(); + const { wallet: e, connector: r, loading: n } = t, i = Zn(null), s = Zn(), [o, a] = Qt(), [u, l] = Qt(), [d, p] = Qt("connect"), [w, A] = Qt(!1), [M, N] = Qt(); function L(K) { var ge; (ge = s.current) == null || ge.update({ @@ -43167,7 +43161,7 @@ function cse(t) { ] }); } function tA(t) { - const { children: e, className: r } = t, n = Un(null), [i, s] = pv.useState(0); + const { children: e, className: r } = t, n = Zn(null), [i, s] = pv.useState(0); function o() { var a; try { @@ -43333,7 +43327,7 @@ function xoe(t) { showFeaturedWallets: !0, showMoreWallets: !0, showTonConnect: !0 - } } = t, [s, o] = Qt(""), [a, u] = Qt(), [l, d] = Qt(), p = Un(), [w, A] = Qt(""); + } } = t, [s, o] = Qt(""), [a, u] = Qt(), [l, d] = Qt(), p = Zn(), [w, A] = Qt(""); function M(H) { u(H), o("evm-wallet-connect"); } diff --git a/dist/secp256k1-ChY4PDp8.js b/dist/secp256k1-CFcsUqQG.js similarity index 99% rename from dist/secp256k1-ChY4PDp8.js rename to dist/secp256k1-CFcsUqQG.js index 5c51d0f..3c9333e 100644 --- a/dist/secp256k1-ChY4PDp8.js +++ b/dist/secp256k1-CFcsUqQG.js @@ -1,4 +1,4 @@ -import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-CpxLUVHd.js"; +import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-D0QbPgKD.js"; class Kt extends ee { constructor(n, t) { super(), this.finished = !1, this.destroyed = !1, ne(n); diff --git a/lib/components/email-captcha.tsx b/lib/components/email-captcha.tsx index 4f82602..a1175a8 100644 --- a/lib/components/email-captcha.tsx +++ b/lib/components/email-captcha.tsx @@ -14,12 +14,8 @@ export default function EmailCaptcha(props: { email: string, onCodeSend: () => v async function sendEmailCode(email: string, captcha: string) { setSendingCode(true) - try { - setGetCodeError('') - await accountApi.getEmailCode({ account_type: 'email', email }, captcha) - } catch (err: any) { - setGetCodeError(err.message) - } + setGetCodeError('') + await accountApi.getEmailCode({ account_type: 'email', email }, captcha) setSendingCode(false) } diff --git a/package.json b/package.json index 28ad65a..b0bbea0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codatta-connect", - "version": "2.3.1", + "version": "2.3.2", "type": "module", "main": "./dist/index.umd.js", "module": "./dist/index.es.js", From 5375b6cbe82c98e17e69c80dc3358a22a53c52a9 Mon Sep 17 00:00:00 2001 From: Meow Lord Date: Wed, 8 Jan 2025 15:43:22 +0800 Subject: [PATCH 08/25] feat: special version --- dist/index.es.js | 2 +- dist/index.umd.js | 2 +- dist/{main-D0QbPgKD.js => main-BTMJGjm9.js} | 18 +-- ...56k1-CFcsUqQG.js => secp256k1-Vxeo4UZR.js} | 2 +- dist/style.css | 2 +- lib/components/email-login.tsx | 121 ------------------ lib/components/signin-index.tsx | 24 ++-- package.json | 2 +- src/views/login-view.tsx | 8 +- vite.config.dev.ts | 2 +- 10 files changed, 31 insertions(+), 152 deletions(-) rename dist/{main-D0QbPgKD.js => main-BTMJGjm9.js} (99%) rename dist/{secp256k1-CFcsUqQG.js => secp256k1-Vxeo4UZR.js} (99%) delete mode 100644 lib/components/email-login.tsx diff --git a/dist/index.es.js b/dist/index.es.js index c15cbe0..f3d96c7 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -1,4 +1,4 @@ -import { f as o, C as n, d as e, a as C, u as s } from "./main-D0QbPgKD.js"; +import { f as o, C as n, d as e, a as C, u as s } from "./main-BTMJGjm9.js"; export { o as CodattaConnect, n as CodattaConnectContextProvider, diff --git a/dist/index.umd.js b/dist/index.umd.js index 501cf96..664d748 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -199,7 +199,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene top: ${u}px !important; left: ${l}px !important; } - `),()=>{document.head.removeChild(d)}},[e]),ge.jsx(aX,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const uX=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=vb(fX),u=Se.useId(),l=Se.useCallback(g=>{a.set(g,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Se.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:g=>(a.set(g,!1),()=>a.delete(g))}),s?[Math.random(),l]:[r,l]);return Se.useMemo(()=>{a.forEach((g,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=ge.jsx(cX,{isPresent:r,children:t})),ge.jsx(F0.Provider,{value:d,children:t})};function fX(){return new Map}const K0=t=>t.key||"";function QS(t){const e=[];return Se.Children.forEach(t,r=>{Se.isValidElement(r)&&e.push(r)}),e}const lX=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Oo(!e,"Replace exitBeforeEnter with mode='wait'");const a=Se.useMemo(()=>QS(t),[t]),u=a.map(K0),l=Se.useRef(!0),d=Se.useRef(a),g=vb(()=>new Map),[y,A]=Se.useState(a),[P,N]=Se.useState(a);DS(()=>{l.current=!1,d.current=a;for(let B=0;B1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=Se.useContext(sb);return ge.jsx(ge.Fragment,{children:P.map(B=>{const j=K0(B),U=a===P||u.includes(j),K=()=>{if(g.has(j))g.set(j,!0);else return;let J=!0;g.forEach(T=>{T||(J=!1)}),J&&(k==null||k(),N(d.current),i&&i())};return ge.jsx(uX,{isPresent:U,initial:!l.current||n?void 0:!1,custom:U?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:U?void 0:K,children:B},j)})})},Ss=t=>ge.jsx(lX,{children:ge.jsx(oX.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Eb(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return ge.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,ge.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[ge.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),ge.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:ge.jsx(NK,{})})]})]})}function hX(t){return t.lastUsed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function e7(t){var o,a;const{wallet:e,onClick:r}=t,n=ge.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Se.useMemo(()=>hX(e),[e]);return ge.jsx(Eb,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function t7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=vX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Sb);return a[0]===""&&a.length!==1&&a.shift(),r7(a,e)||mX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},r7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?r7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Sb);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},n7=/^\[(.+)\]$/,mX=t=>{if(n7.test(t)){const e=n7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},vX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return yX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Ab(o,n,s,e)}),n},Ab=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:i7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(bX(i)){Ab(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Ab(o,i7(e,s),r,n)})})},i7=(t,e)=>{let r=t;return e.split(Sb).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},bX=t=>t.isThemeGetter,yX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,wX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},s7="!",xX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,g;for(let D=0;Dd?g-d:void 0;return{modifiers:u,hasImportantModifier:A,baseClassName:P,maybePostfixModifierPosition:N}};return r?a=>r({className:a,parseClassName:o}):o},_X=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},EX=t=>({cache:wX(t.cacheSize),parseClassName:xX(t),...gX(t)}),SX=/\s+/,AX=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(SX);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:A}=r(l);let P=!!A,N=n(P?y.substring(0,A):y);if(!N){if(!P){a=l+(a.length>0?" "+a:a);continue}if(N=n(y),!N){a=l+(a.length>0?" "+a:a);continue}P=!1}const D=_X(d).join(":"),k=g?D+s7:D,B=k+N;if(s.includes(B))continue;s.push(B);const j=i(N,P);for(let U=0;U0?" "+a:a)}return a};function PX(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;ng(d),t());return r=EX(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=AX(u,r);return i(u,d),d}return function(){return s(PX.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},a7=/^\[(?:([a-z-]+):)?(.+)\]$/i,IX=/^\d+\/\d+$/,CX=new Set(["px","full","screen"]),TX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RX=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,DX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,OX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bo=t=>Wu(t)||CX.has(t)||IX.test(t),Ea=t=>Ku(t,"length",qX),Wu=t=>!!t&&!Number.isNaN(Number(t)),Pb=t=>Ku(t,"number",Wu),oh=t=>!!t&&Number.isInteger(Number(t)),LX=t=>t.endsWith("%")&&Wu(t.slice(0,-1)),cr=t=>a7.test(t),Sa=t=>TX.test(t),kX=new Set(["length","size","percentage"]),BX=t=>Ku(t,kX,c7),$X=t=>Ku(t,"position",c7),FX=new Set(["image","url"]),jX=t=>Ku(t,FX,HX),UX=t=>Ku(t,"",zX),ah=()=>!0,Ku=(t,e,r)=>{const n=a7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},qX=t=>RX.test(t)&&!DX.test(t),c7=()=>!1,zX=t=>OX.test(t),HX=t=>NX.test(t),WX=MX(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),g=Gr("invert"),y=Gr("gap"),A=Gr("gradientColorStops"),P=Gr("gradientColorStopPositions"),N=Gr("inset"),D=Gr("margin"),k=Gr("opacity"),B=Gr("padding"),j=Gr("saturate"),U=Gr("scale"),K=Gr("sepia"),J=Gr("skew"),T=Gr("space"),z=Gr("translate"),ue=()=>["auto","contain","none"],_e=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",Bo,Ea],f=()=>["auto",Wu,cr],p=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],S=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Wu,cr];return{cacheSize:500,separator:":",theme:{colors:[ah],spacing:[Bo,Ea],blur:["none","",Sa,cr],brightness:M(),borderColor:[t],borderRadius:["none","","full",Sa,cr],borderSpacing:E(),borderWidth:m(),contrast:M(),grayscale:S(),hueRotate:M(),invert:S(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[LX,Ea],inset:G(),margin:G(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:S(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Sa]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...p(),cr]}],overflow:[{overflow:_e()}],"overflow-x":[{"overflow-x":_e()}],"overflow-y":[{"overflow-y":_e()}],overscroll:[{overscroll:ue()}],"overscroll-x":[{"overscroll-x":ue()}],"overscroll-y":[{"overscroll-y":ue()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",oh,cr]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",oh,cr]}],"grid-cols":[{"grid-cols":[ah]}],"col-start-end":[{col:["auto",{span:["full",oh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[ah]}],"row-start-end":[{row:["auto",{span:[oh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[B]}],px:[{px:[B]}],py:[{py:[B]}],ps:[{ps:[B]}],pe:[{pe:[B]}],pt:[{pt:[B]}],pr:[{pr:[B]}],pb:[{pb:[B]}],pl:[{pl:[B]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Sa]},Sa]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Sa,Ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Pb]}],"font-family":[{font:[ah]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Wu,Pb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Bo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Bo,Ea]}],"underline-offset":[{"underline-offset":["auto",Bo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...p(),$X]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",BX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},jX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[A]}],"gradient-via":[{via:[A]}],"gradient-to":[{to:[A]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[Bo,cr]}],"outline-w":[{outline:[Bo,Ea]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Bo,Ea]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Sa,UX]}],"shadow-color":[{shadow:[ah]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Sa,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[g]}],saturate:[{saturate:[j]}],sepia:[{sepia:[K]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[j]}],"backdrop-sepia":[{"backdrop-sepia":[K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[U]}],"scale-x":[{"scale-x":[U]}],"scale-y":[{"scale-y":[U]}],rotate:[{rotate:[oh,cr]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[J]}],"skew-y":[{"skew-y":[J]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Bo,Ea,Pb]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function $o(...t){return WX(pX(t))}function u7(t){const{className:e}=t;return ge.jsxs("div",{className:$o("xc-flex xc-items-center xc-gap-2"),children:[ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)}),ge.jsx("div",{className:"xc-shrink-0",children:t.children}),ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)})]})}const KX="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function VX(t){const{onClick:e}=t;function r(){e&&e()}return ge.jsx(u7,{className:"xc-opacity-20",children:ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[ge.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),ge.jsx(u8,{size:16})]})})}function f7(t){const[e,r]=Se.useState(""),{featuredWallets:n,initialized:i}=Kl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Se.useMemo(()=>{const N=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!N.test(e)&&D.test(e)},[e]);function g(N){o(N)}function y(N){r(N.target.value)}async function A(){s(e)}function P(N){N.key==="Enter"&&d&&A()}return ge.jsx(Ss,{children:i&&ge.jsxs(ge.Fragment,{children:[t.header||ge.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),l.showEmailSignIn&&ge.jsxs("div",{className:"xc-mb-4",children:[ge.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:y,onKeyDown:P}),ge.jsx("button",{disabled:!d,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:A,children:"Continue"})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&ge.jsx("div",{className:"xc-mb-4",children:ge.jsxs(u7,{className:"xc-opacity-20",children:[" ",ge.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),ge.jsxs("div",{children:[ge.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(N=>ge.jsx(e7,{wallet:N,onClick:g},`feature-${N.key}`)),l.showTonConnect&&ge.jsx(Eb,{icon:ge.jsx("img",{className:"xc-h-5 xc-w-5",src:KX}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&ge.jsx(VX,{onClick:a})]})]})})}function Sc(t){const{title:e}=t;return ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[ge.jsx(OK,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),ge.jsx("span",{children:e})]})}const l7=Se.createContext({channel:"",device:"WEB",app:"",inviterCode:""});function Mb(){return Se.useContext(l7)}function GX(t){const{config:e}=t,[r,n]=Se.useState(e.channel),[i,s]=Se.useState(e.device),[o,a]=Se.useState(e.app),[u,l]=Se.useState(e.inviterCode);return Se.useEffect(()=>{n(e.channel),s(e.device),a(e.app),l(e.inviterCode)},[e]),ge.jsx(l7.Provider,{value:{channel:r,device:i,app:o,inviterCode:u},children:t.children})}var YX=Object.defineProperty,JX=Object.defineProperties,XX=Object.getOwnPropertyDescriptors,V0=Object.getOwnPropertySymbols,h7=Object.prototype.hasOwnProperty,d7=Object.prototype.propertyIsEnumerable,p7=(t,e,r)=>e in t?YX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ZX=(t,e)=>{for(var r in e||(e={}))h7.call(e,r)&&p7(t,r,e[r]);if(V0)for(var r of V0(e))d7.call(e,r)&&p7(t,r,e[r]);return t},QX=(t,e)=>JX(t,XX(e)),eZ=(t,e)=>{var r={};for(var n in t)h7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&V0)for(var n of V0(t))e.indexOf(n)<0&&d7.call(t,n)&&(r[n]=t[n]);return r};function tZ(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function rZ(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var nZ=18,g7=40,iZ=`${g7}px`,sZ=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function oZ({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),g=Yt.useCallback(()=>{let y=t.current,A=e.current;if(!y||!A||u||r==="none")return;let P=y,N=P.getBoundingClientRect().left+P.offsetWidth,D=P.getBoundingClientRect().top+P.offsetHeight/2,k=N-nZ,B=D;document.querySelectorAll(sZ).length===0&&document.elementFromPoint(k,B)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function A(){let N=window.innerWidth-y.getBoundingClientRect().right;a(N>=g7)}A();let P=setInterval(A,1e3);return()=>{clearInterval(P)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let A=setTimeout(g,0),P=setTimeout(g,2e3),N=setTimeout(g,5e3),D=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(A),clearTimeout(P),clearTimeout(N),clearTimeout(D)}},[e,n,r,g]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:iZ}}var m7=Yt.createContext({}),v7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:g="increase-width",pasteTransformer:y,containerClassName:A,noScriptCSSFallback:P=aZ,render:N,children:D}=r,k=eZ(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),B,j,U,K,J;let[T,z]=Yt.useState(typeof k.defaultValue=="string"?k.defaultValue:""),ue=n??T,_e=rZ(ue),G=Yt.useCallback(ie=>{i==null||i(ie),z(ie)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),p=Yt.useRef({value:ue,onChange:G,isIOS:typeof window<"u"&&((j=(B=window==null?void 0:window.CSS)==null?void 0:B.supports)==null?void 0:j.call(B,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(U=m.current)==null?void 0:U.selectionStart,(K=m.current)==null?void 0:K.selectionEnd,(J=m.current)==null?void 0:J.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let ie=m.current,fe=f.current;if(!ie||!fe)return;p.current.value!==ie.value&&p.current.onChange(ie.value),v.current.prev=[ie.selectionStart,ie.selectionEnd,ie.selectionDirection];function ve(){if(document.activeElement!==ie){I(null),ae(null);return}let Te=ie.selectionStart,$e=ie.selectionEnd,Ie=ie.selectionDirection,Le=ie.maxLength,Ve=ie.value,ke=v.current.prev,ze=-1,He=-1,Ee;if(Ve.length!==0&&Te!==null&&$e!==null){let et=Te===$e,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let pt=0;if(ke[0]!==null&&ke[1]!==null){Ee=Je{fe&&fe.style.setProperty("--root-height",`${ie.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(ie),()=>{document.removeEventListener("selectionchange",ve,{capture:!0}),Ne.disconnect()}},[]);let[x,_]=Yt.useState(!1),[S,b]=Yt.useState(!1),[M,I]=Yt.useState(null),[F,ae]=Yt.useState(null);Yt.useEffect(()=>{tZ(()=>{var ie,fe,ve,Me;(ie=m.current)==null||ie.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(ve=m.current)==null?void 0:ve.selectionEnd,$e=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ae(Te),v.current.prev=[Ne,Te,$e])})},[ue,S]),Yt.useEffect(()=>{_e!==void 0&&ue!==_e&&_e.length{let fe=ie.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){ie.preventDefault();return}typeof _e=="string"&&fe.length<_e.length&&document.dispatchEvent(new Event("selectionchange")),G(fe)},[s,G,_e,E]),ee=Yt.useCallback(()=>{var ie;if(m.current){let fe=Math.min(m.current.value.length,s-1),ve=m.current.value.length;(ie=m.current)==null||ie.setSelectionRange(fe,ve),I(fe),ae(ve)}b(!0)},[s]),X=Yt.useCallback(ie=>{var fe,ve;let Me=m.current;if(!y&&(!p.current.isIOS||!ie.clipboardData||!Me))return;let Ne=ie.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),ie.preventDefault();let $e=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(ve=m.current)==null?void 0:ve.selectionEnd,Le=($e!==Ie?ue.slice(0,$e)+Te+ue.slice(Ie):ue.slice(0,$e)+Te+ue.slice($e)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,G(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ae(ke)},[s,G,E,ue]),Q=Yt.useMemo(()=>({position:"relative",cursor:k.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[k.disabled]),R=Yt.useMemo(()=>({position:"absolute",inset:0,width:O.willPushPWMBadge?`calc(100% + ${O.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:O.willPushPWMBadge?`inset(0 ${O.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[O.PWM_BADGE_SPACE_WIDTH,O.willPushPWMBadge,o]),Z=Yt.useMemo(()=>Yt.createElement("input",QX(ZX({autoComplete:k.autoComplete||"one-time-code"},k),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ue.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:R,maxLength:s,value:ue,ref:m,onPaste:ie=>{var fe;X(ie),(fe=k.onPaste)==null||fe.call(k,ie)},onChange:se,onMouseOver:ie=>{var fe;_(!0),(fe=k.onMouseOver)==null||fe.call(k,ie)},onMouseLeave:ie=>{var fe;_(!1),(fe=k.onMouseLeave)==null||fe.call(k,ie)},onFocus:ie=>{var fe;ee(),(fe=k.onFocus)==null||fe.call(k,ie)},onBlur:ie=>{var fe;b(!1),(fe=k.onBlur)==null||fe.call(k,ie)}})),[se,ee,X,l,R,s,F,M,k,E==null?void 0:E.source,ue]),te=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ie,fe)=>{var ve;let Me=S&&M!==null&&F!==null&&(M===F&&fe===M||fe>=M&&feN?N(te):Yt.createElement(m7.Provider,{value:te},D),[D,te,N]);return Yt.createElement(Yt.Fragment,null,P!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,P)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:A},le,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Z)))});v7.displayName="Input";function ch(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var aZ=` + `),()=>{document.head.removeChild(d)}},[e]),ge.jsx(aX,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const uX=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=vb(fX),u=Se.useId(),l=Se.useCallback(g=>{a.set(g,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Se.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:g=>(a.set(g,!1),()=>a.delete(g))}),s?[Math.random(),l]:[r,l]);return Se.useMemo(()=>{a.forEach((g,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=ge.jsx(cX,{isPresent:r,children:t})),ge.jsx(F0.Provider,{value:d,children:t})};function fX(){return new Map}const K0=t=>t.key||"";function QS(t){const e=[];return Se.Children.forEach(t,r=>{Se.isValidElement(r)&&e.push(r)}),e}const lX=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Oo(!e,"Replace exitBeforeEnter with mode='wait'");const a=Se.useMemo(()=>QS(t),[t]),u=a.map(K0),l=Se.useRef(!0),d=Se.useRef(a),g=vb(()=>new Map),[y,A]=Se.useState(a),[P,N]=Se.useState(a);DS(()=>{l.current=!1,d.current=a;for(let B=0;B1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=Se.useContext(sb);return ge.jsx(ge.Fragment,{children:P.map(B=>{const j=K0(B),U=a===P||u.includes(j),K=()=>{if(g.has(j))g.set(j,!0);else return;let J=!0;g.forEach(T=>{T||(J=!1)}),J&&(k==null||k(),N(d.current),i&&i())};return ge.jsx(uX,{isPresent:U,initial:!l.current||n?void 0:!1,custom:U?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:U?void 0:K,children:B},j)})})},Ss=t=>ge.jsx(lX,{children:ge.jsx(oX.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Eb(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return ge.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,ge.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[ge.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),ge.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:ge.jsx(NK,{})})]})]})}function hX(t){return t.lastUsed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function e7(t){var o,a;const{wallet:e,onClick:r}=t,n=ge.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Se.useMemo(()=>hX(e),[e]);return ge.jsx(Eb,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function t7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=vX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Sb);return a[0]===""&&a.length!==1&&a.shift(),r7(a,e)||mX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},r7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?r7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Sb);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},n7=/^\[(.+)\]$/,mX=t=>{if(n7.test(t)){const e=n7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},vX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return yX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Ab(o,n,s,e)}),n},Ab=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:i7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(bX(i)){Ab(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Ab(o,i7(e,s),r,n)})})},i7=(t,e)=>{let r=t;return e.split(Sb).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},bX=t=>t.isThemeGetter,yX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,wX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},s7="!",xX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,g;for(let D=0;Dd?g-d:void 0;return{modifiers:u,hasImportantModifier:A,baseClassName:P,maybePostfixModifierPosition:N}};return r?a=>r({className:a,parseClassName:o}):o},_X=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},EX=t=>({cache:wX(t.cacheSize),parseClassName:xX(t),...gX(t)}),SX=/\s+/,AX=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(SX);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:A}=r(l);let P=!!A,N=n(P?y.substring(0,A):y);if(!N){if(!P){a=l+(a.length>0?" "+a:a);continue}if(N=n(y),!N){a=l+(a.length>0?" "+a:a);continue}P=!1}const D=_X(d).join(":"),k=g?D+s7:D,B=k+N;if(s.includes(B))continue;s.push(B);const j=i(N,P);for(let U=0;U0?" "+a:a)}return a};function PX(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;ng(d),t());return r=EX(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=AX(u,r);return i(u,d),d}return function(){return s(PX.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},a7=/^\[(?:([a-z-]+):)?(.+)\]$/i,IX=/^\d+\/\d+$/,CX=new Set(["px","full","screen"]),TX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RX=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,DX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,OX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bo=t=>Wu(t)||CX.has(t)||IX.test(t),Ea=t=>Ku(t,"length",qX),Wu=t=>!!t&&!Number.isNaN(Number(t)),Pb=t=>Ku(t,"number",Wu),oh=t=>!!t&&Number.isInteger(Number(t)),LX=t=>t.endsWith("%")&&Wu(t.slice(0,-1)),cr=t=>a7.test(t),Sa=t=>TX.test(t),kX=new Set(["length","size","percentage"]),BX=t=>Ku(t,kX,c7),$X=t=>Ku(t,"position",c7),FX=new Set(["image","url"]),jX=t=>Ku(t,FX,HX),UX=t=>Ku(t,"",zX),ah=()=>!0,Ku=(t,e,r)=>{const n=a7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},qX=t=>RX.test(t)&&!DX.test(t),c7=()=>!1,zX=t=>OX.test(t),HX=t=>NX.test(t),WX=MX(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),g=Gr("invert"),y=Gr("gap"),A=Gr("gradientColorStops"),P=Gr("gradientColorStopPositions"),N=Gr("inset"),D=Gr("margin"),k=Gr("opacity"),B=Gr("padding"),j=Gr("saturate"),U=Gr("scale"),K=Gr("sepia"),J=Gr("skew"),T=Gr("space"),z=Gr("translate"),ue=()=>["auto","contain","none"],_e=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",Bo,Ea],f=()=>["auto",Wu,cr],p=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],S=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Wu,cr];return{cacheSize:500,separator:":",theme:{colors:[ah],spacing:[Bo,Ea],blur:["none","",Sa,cr],brightness:M(),borderColor:[t],borderRadius:["none","","full",Sa,cr],borderSpacing:E(),borderWidth:m(),contrast:M(),grayscale:S(),hueRotate:M(),invert:S(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[LX,Ea],inset:G(),margin:G(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:S(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Sa]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...p(),cr]}],overflow:[{overflow:_e()}],"overflow-x":[{"overflow-x":_e()}],"overflow-y":[{"overflow-y":_e()}],overscroll:[{overscroll:ue()}],"overscroll-x":[{"overscroll-x":ue()}],"overscroll-y":[{"overscroll-y":ue()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",oh,cr]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",oh,cr]}],"grid-cols":[{"grid-cols":[ah]}],"col-start-end":[{col:["auto",{span:["full",oh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[ah]}],"row-start-end":[{row:["auto",{span:[oh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[B]}],px:[{px:[B]}],py:[{py:[B]}],ps:[{ps:[B]}],pe:[{pe:[B]}],pt:[{pt:[B]}],pr:[{pr:[B]}],pb:[{pb:[B]}],pl:[{pl:[B]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Sa]},Sa]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Sa,Ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Pb]}],"font-family":[{font:[ah]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Wu,Pb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Bo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Bo,Ea]}],"underline-offset":[{"underline-offset":["auto",Bo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...p(),$X]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",BX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},jX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[A]}],"gradient-via":[{via:[A]}],"gradient-to":[{to:[A]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[Bo,cr]}],"outline-w":[{outline:[Bo,Ea]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Bo,Ea]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Sa,UX]}],"shadow-color":[{shadow:[ah]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Sa,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[g]}],saturate:[{saturate:[j]}],sepia:[{sepia:[K]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[j]}],"backdrop-sepia":[{"backdrop-sepia":[K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[U]}],"scale-x":[{"scale-x":[U]}],"scale-y":[{"scale-y":[U]}],rotate:[{rotate:[oh,cr]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[J]}],"skew-y":[{"skew-y":[J]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Bo,Ea,Pb]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function $o(...t){return WX(pX(t))}function u7(t){const{className:e}=t;return ge.jsxs("div",{className:$o("xc-flex xc-items-center xc-gap-2"),children:[ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)}),ge.jsx("div",{className:"xc-shrink-0",children:t.children}),ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)})]})}const KX="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function VX(t){const{onClick:e}=t;function r(){e&&e()}return ge.jsx(u7,{className:"xc-opacity-20",children:ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[ge.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),ge.jsx(u8,{size:16})]})})}function f7(t){const[e,r]=Se.useState(""),{featuredWallets:n,initialized:i}=Kl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Se.useMemo(()=>{const N=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!N.test(e)&&D.test(e)},[e]);function g(N){o(N)}function y(N){r(N.target.value)}async function A(){s(e)}function P(N){N.key==="Enter"&&d&&A()}return ge.jsx(Ss,{children:i&&ge.jsxs(ge.Fragment,{children:[t.header||ge.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),ge.jsxs("div",{children:[ge.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(N=>ge.jsx(e7,{wallet:N,onClick:g},`feature-${N.key}`)),l.showTonConnect&&ge.jsx(Eb,{icon:ge.jsx("img",{className:"xc-h-5 xc-w-5",src:KX}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&ge.jsx(VX,{onClick:a})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&ge.jsx("div",{className:"xc-mb-4 xc-mt-4",children:ge.jsxs(u7,{className:"xc-opacity-20",children:[" ",ge.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),l.showEmailSignIn&&ge.jsxs("div",{className:"xc-mb-4",children:[ge.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:y,onKeyDown:P}),ge.jsx("button",{disabled:!d,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:A,children:"Continue"})]})]})})}function Sc(t){const{title:e}=t;return ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[ge.jsx(OK,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),ge.jsx("span",{children:e})]})}const l7=Se.createContext({channel:"",device:"WEB",app:"",inviterCode:""});function Mb(){return Se.useContext(l7)}function GX(t){const{config:e}=t,[r,n]=Se.useState(e.channel),[i,s]=Se.useState(e.device),[o,a]=Se.useState(e.app),[u,l]=Se.useState(e.inviterCode);return Se.useEffect(()=>{n(e.channel),s(e.device),a(e.app),l(e.inviterCode)},[e]),ge.jsx(l7.Provider,{value:{channel:r,device:i,app:o,inviterCode:u},children:t.children})}var YX=Object.defineProperty,JX=Object.defineProperties,XX=Object.getOwnPropertyDescriptors,V0=Object.getOwnPropertySymbols,h7=Object.prototype.hasOwnProperty,d7=Object.prototype.propertyIsEnumerable,p7=(t,e,r)=>e in t?YX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ZX=(t,e)=>{for(var r in e||(e={}))h7.call(e,r)&&p7(t,r,e[r]);if(V0)for(var r of V0(e))d7.call(e,r)&&p7(t,r,e[r]);return t},QX=(t,e)=>JX(t,XX(e)),eZ=(t,e)=>{var r={};for(var n in t)h7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&V0)for(var n of V0(t))e.indexOf(n)<0&&d7.call(t,n)&&(r[n]=t[n]);return r};function tZ(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function rZ(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var nZ=18,g7=40,iZ=`${g7}px`,sZ=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function oZ({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),g=Yt.useCallback(()=>{let y=t.current,A=e.current;if(!y||!A||u||r==="none")return;let P=y,N=P.getBoundingClientRect().left+P.offsetWidth,D=P.getBoundingClientRect().top+P.offsetHeight/2,k=N-nZ,B=D;document.querySelectorAll(sZ).length===0&&document.elementFromPoint(k,B)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function A(){let N=window.innerWidth-y.getBoundingClientRect().right;a(N>=g7)}A();let P=setInterval(A,1e3);return()=>{clearInterval(P)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let A=setTimeout(g,0),P=setTimeout(g,2e3),N=setTimeout(g,5e3),D=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(A),clearTimeout(P),clearTimeout(N),clearTimeout(D)}},[e,n,r,g]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:iZ}}var m7=Yt.createContext({}),v7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:g="increase-width",pasteTransformer:y,containerClassName:A,noScriptCSSFallback:P=aZ,render:N,children:D}=r,k=eZ(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),B,j,U,K,J;let[T,z]=Yt.useState(typeof k.defaultValue=="string"?k.defaultValue:""),ue=n??T,_e=rZ(ue),G=Yt.useCallback(ie=>{i==null||i(ie),z(ie)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),p=Yt.useRef({value:ue,onChange:G,isIOS:typeof window<"u"&&((j=(B=window==null?void 0:window.CSS)==null?void 0:B.supports)==null?void 0:j.call(B,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(U=m.current)==null?void 0:U.selectionStart,(K=m.current)==null?void 0:K.selectionEnd,(J=m.current)==null?void 0:J.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let ie=m.current,fe=f.current;if(!ie||!fe)return;p.current.value!==ie.value&&p.current.onChange(ie.value),v.current.prev=[ie.selectionStart,ie.selectionEnd,ie.selectionDirection];function ve(){if(document.activeElement!==ie){I(null),ae(null);return}let Te=ie.selectionStart,$e=ie.selectionEnd,Ie=ie.selectionDirection,Le=ie.maxLength,Ve=ie.value,ke=v.current.prev,ze=-1,He=-1,Ee;if(Ve.length!==0&&Te!==null&&$e!==null){let et=Te===$e,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let pt=0;if(ke[0]!==null&&ke[1]!==null){Ee=Je{fe&&fe.style.setProperty("--root-height",`${ie.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(ie),()=>{document.removeEventListener("selectionchange",ve,{capture:!0}),Ne.disconnect()}},[]);let[x,_]=Yt.useState(!1),[S,b]=Yt.useState(!1),[M,I]=Yt.useState(null),[F,ae]=Yt.useState(null);Yt.useEffect(()=>{tZ(()=>{var ie,fe,ve,Me;(ie=m.current)==null||ie.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(ve=m.current)==null?void 0:ve.selectionEnd,$e=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ae(Te),v.current.prev=[Ne,Te,$e])})},[ue,S]),Yt.useEffect(()=>{_e!==void 0&&ue!==_e&&_e.length{let fe=ie.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){ie.preventDefault();return}typeof _e=="string"&&fe.length<_e.length&&document.dispatchEvent(new Event("selectionchange")),G(fe)},[s,G,_e,E]),ee=Yt.useCallback(()=>{var ie;if(m.current){let fe=Math.min(m.current.value.length,s-1),ve=m.current.value.length;(ie=m.current)==null||ie.setSelectionRange(fe,ve),I(fe),ae(ve)}b(!0)},[s]),X=Yt.useCallback(ie=>{var fe,ve;let Me=m.current;if(!y&&(!p.current.isIOS||!ie.clipboardData||!Me))return;let Ne=ie.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),ie.preventDefault();let $e=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(ve=m.current)==null?void 0:ve.selectionEnd,Le=($e!==Ie?ue.slice(0,$e)+Te+ue.slice(Ie):ue.slice(0,$e)+Te+ue.slice($e)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,G(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ae(ke)},[s,G,E,ue]),Q=Yt.useMemo(()=>({position:"relative",cursor:k.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[k.disabled]),R=Yt.useMemo(()=>({position:"absolute",inset:0,width:O.willPushPWMBadge?`calc(100% + ${O.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:O.willPushPWMBadge?`inset(0 ${O.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[O.PWM_BADGE_SPACE_WIDTH,O.willPushPWMBadge,o]),Z=Yt.useMemo(()=>Yt.createElement("input",QX(ZX({autoComplete:k.autoComplete||"one-time-code"},k),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ue.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:R,maxLength:s,value:ue,ref:m,onPaste:ie=>{var fe;X(ie),(fe=k.onPaste)==null||fe.call(k,ie)},onChange:se,onMouseOver:ie=>{var fe;_(!0),(fe=k.onMouseOver)==null||fe.call(k,ie)},onMouseLeave:ie=>{var fe;_(!1),(fe=k.onMouseLeave)==null||fe.call(k,ie)},onFocus:ie=>{var fe;ee(),(fe=k.onFocus)==null||fe.call(k,ie)},onBlur:ie=>{var fe;b(!1),(fe=k.onBlur)==null||fe.call(k,ie)}})),[se,ee,X,l,R,s,F,M,k,E==null?void 0:E.source,ue]),te=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ie,fe)=>{var ve;let Me=S&&M!==null&&F!==null&&(M===F&&fe===M||fe>=M&&feN?N(te):Yt.createElement(m7.Provider,{value:te},D),[D,te,N]);return Yt.createElement(Yt.Fragment,null,P!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,P)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:A},le,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Z)))});v7.displayName="Input";function ch(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var aZ=` [data-input-otp] { --nojs-bg: white !important; --nojs-fg: black !important; diff --git a/dist/main-D0QbPgKD.js b/dist/main-BTMJGjm9.js similarity index 99% rename from dist/main-D0QbPgKD.js rename to dist/main-BTMJGjm9.js index 5214a02..6b66db7 100644 --- a/dist/main-D0QbPgKD.js +++ b/dist/main-BTMJGjm9.js @@ -2850,7 +2850,7 @@ function UO(t) { return Bl(`0x${e}`); } async function qO({ hash: t, signature: e }) { - const r = va(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-CFcsUqQG.js"); + const r = va(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-Vxeo4UZR.js"); return `0x${(() => { if (typeof e == "object" && "r" in e && "s" in e) { const { r: l, s: d, v: p, yParity: w } = e, A = Number(w ?? p), M = I2(A); @@ -38129,14 +38129,6 @@ function M9(t) { } return /* @__PURE__ */ pe.jsx(Ms, { children: i && /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ t.header || /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6 xc-text-xl xc-font-bold", children: "Log in or sign up" }), - l.showEmailSignIn && /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-4", children: [ - /* @__PURE__ */ pe.jsx("input", { className: "xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3", placeholder: "Enter your email", type: "email", onChange: w, onKeyDown: M }), - /* @__PURE__ */ pe.jsx("button", { disabled: !d, className: "xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all", onClick: A, children: "Continue" }) - ] }), - l.showEmailSignIn && (l.showFeaturedWallets || l.showTonConnect) && /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4", children: /* @__PURE__ */ pe.jsxs(P9, { className: "xc-opacity-20", children: [ - " ", - /* @__PURE__ */ pe.jsx("span", { className: "xc-text-sm xc-opacity-20", children: "OR" }) - ] }) }), /* @__PURE__ */ pe.jsxs("div", { children: [ /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: [ l.showFeaturedWallets && n && n.map((N) => /* @__PURE__ */ pe.jsx( @@ -38157,6 +38149,14 @@ function M9(t) { ) ] }), l.showMoreWallets && /* @__PURE__ */ pe.jsx(Ine, { onClick: a }) + ] }), + l.showEmailSignIn && (l.showFeaturedWallets || l.showTonConnect) && /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4 xc-mt-4", children: /* @__PURE__ */ pe.jsxs(P9, { className: "xc-opacity-20", children: [ + " ", + /* @__PURE__ */ pe.jsx("span", { className: "xc-text-sm xc-opacity-20", children: "OR" }) + ] }) }), + l.showEmailSignIn && /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-4", children: [ + /* @__PURE__ */ pe.jsx("input", { className: "xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3", placeholder: "Enter your email", type: "email", onChange: w, onKeyDown: M }), + /* @__PURE__ */ pe.jsx("button", { disabled: !d, className: "xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all", onClick: A, children: "Continue" }) ] }) ] }) }); } diff --git a/dist/secp256k1-CFcsUqQG.js b/dist/secp256k1-Vxeo4UZR.js similarity index 99% rename from dist/secp256k1-CFcsUqQG.js rename to dist/secp256k1-Vxeo4UZR.js index 3c9333e..fd84375 100644 --- a/dist/secp256k1-CFcsUqQG.js +++ b/dist/secp256k1-Vxeo4UZR.js @@ -1,4 +1,4 @@ -import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-D0QbPgKD.js"; +import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-BTMJGjm9.js"; class Kt extends ee { constructor(n, t) { super(), this.finished = !1, this.destroyed = !1, ne(n); diff --git a/dist/style.css b/dist/style.css index 569940c..1c4b1ca 100644 --- a/dist/style.css +++ b/dist/style.css @@ -1 +1 @@ -*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.xc-pointer-events-none{pointer-events:none}.xc-absolute{position:absolute}.xc-relative{position:relative}.xc-inset-0{top:0;right:0;bottom:0;left:0}.xc-left-0{left:0}.xc-right-2{right:.5rem}.xc-top-0{top:0}.xc-z-10{z-index:10}.xc-m-auto{margin:auto}.xc-mx-auto{margin-left:auto;margin-right:auto}.xc-mb-1{margin-bottom:.25rem}.xc-mb-12{margin-bottom:3rem}.xc-mb-2{margin-bottom:.5rem}.xc-mb-3{margin-bottom:.75rem}.xc-mb-4{margin-bottom:1rem}.xc-mb-6{margin-bottom:1.5rem}.xc-mb-8{margin-bottom:2rem}.xc-ml-auto{margin-left:auto}.xc-box-content{box-sizing:content-box}.xc-block{display:block}.xc-inline-block{display:inline-block}.xc-flex{display:flex}.xc-grid{display:grid}.xc-aspect-\[1\/1\]{aspect-ratio:1/1}.xc-h-1{height:.25rem}.xc-h-10{height:2.5rem}.xc-h-12{height:3rem}.xc-h-16{height:4rem}.xc-h-4{height:1rem}.xc-h-5{height:1.25rem}.xc-h-6{height:1.5rem}.xc-h-\[309px\]{height:309px}.xc-h-full{height:100%}.xc-h-screen{height:100vh}.xc-max-h-\[272px\]{max-height:272px}.xc-max-h-\[309px\]{max-height:309px}.xc-w-1{width:.25rem}.xc-w-10{width:2.5rem}.xc-w-12{width:3rem}.xc-w-16{width:4rem}.xc-w-5{width:1.25rem}.xc-w-6{width:1.5rem}.xc-w-full{width:100%}.xc-w-px{width:1px}.xc-min-w-\[160px\]{min-width:160px}.xc-min-w-\[277px\]{min-width:277px}.xc-max-w-\[272px\]{max-width:272px}.xc-max-w-\[400px\]{max-width:400px}.xc-max-w-\[420px\]{max-width:420px}.xc-flex-1{flex:1 1 0%}.xc-shrink-0{flex-shrink:0}@keyframes xc-caret-blink{0%,70%,to{opacity:1}20%,50%{opacity:0}}.xc-animate-caret-blink{animation:xc-caret-blink 1.25s ease-out infinite}@keyframes xc-spin{to{transform:rotate(360deg)}}.xc-animate-spin{animation:xc-spin 1s linear infinite}.xc-cursor-pointer{cursor:pointer}.xc-appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.xc-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.xc-flex-col{flex-direction:column}.xc-flex-wrap{flex-wrap:wrap}.xc-items-center{align-items:center}.xc-justify-center{justify-content:center}.xc-justify-between{justify-content:space-between}.xc-gap-2{gap:.5rem}.xc-gap-3{gap:.75rem}.xc-gap-4{gap:1rem}.xc-overflow-hidden{overflow:hidden}.xc-overflow-scroll{overflow:scroll}.xc-rounded-2xl{border-radius:1rem}.xc-rounded-full{border-radius:9999px}.xc-rounded-lg{border-radius:.5rem}.xc-rounded-md{border-radius:.375rem}.xc-rounded-xl{border-radius:.75rem}.xc-border{border-width:1px}.xc-border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.xc-border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.xc-border-opacity-15{--tw-border-opacity: .15}.xc-border-opacity-20{--tw-border-opacity: .2}.xc-bg-\[\#009E8C\]{--tw-bg-opacity: 1;background-color:rgb(0 158 140 / var(--tw-bg-opacity, 1))}.xc-bg-\[\#2596FF\]{--tw-bg-opacity: 1;background-color:rgb(37 150 255 / var(--tw-bg-opacity, 1))}.xc-bg-\[rgb\(135\,93\,255\)\]{--tw-bg-opacity: 1;background-color:rgb(135 93 255 / var(--tw-bg-opacity, 1))}.xc-bg-\[rgb\(28\,28\,38\)\]{--tw-bg-opacity: 1;background-color:rgb(28 28 38 / var(--tw-bg-opacity, 1))}.xc-bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.xc-bg-transparent{background-color:transparent}.xc-bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.xc-bg-opacity-10{--tw-bg-opacity: .1}.xc-p-1{padding:.25rem}.xc-p-6{padding:1.5rem}.xc-px-3{padding-left:.75rem;padding-right:.75rem}.xc-px-4{padding-left:1rem;padding-right:1rem}.xc-px-6{padding-left:1.5rem;padding-right:1.5rem}.xc-px-8{padding-left:2rem;padding-right:2rem}.xc-py-1{padding-top:.25rem;padding-bottom:.25rem}.xc-py-2{padding-top:.5rem;padding-bottom:.5rem}.xc-py-3{padding-top:.75rem;padding-bottom:.75rem}.xc-text-center{text-align:center}.xc-text-2xl{font-size:1.5rem;line-height:2rem}.xc-text-lg{font-size:1.125rem;line-height:1.75rem}.xc-text-sm{font-size:.875rem;line-height:1.25rem}.xc-text-xl{font-size:1.25rem;line-height:1.75rem}.xc-text-xs{font-size:.75rem;line-height:1rem}.xc-font-bold{font-weight:700}.xc-text-\[\#ff0000\]{--tw-text-opacity: 1;color:rgb(255 0 0 / var(--tw-text-opacity, 1))}.xc-text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.xc-text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.xc-text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.xc-text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.xc-opacity-0{opacity:0}.xc-opacity-100{opacity:1}.xc-opacity-20{opacity:.2}.xc-opacity-50{opacity:.5}.xc-opacity-80{opacity:.8}.xc-outline-none{outline:2px solid transparent;outline-offset:2px}.xc-ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.xc-ring-\[rgb\(135\,93\,255\)\]{--tw-ring-opacity: 1;--tw-ring-color: rgb(135 93 255 / var(--tw-ring-opacity, 1))}.xc-transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.xc-duration-1000{transition-duration:1s}.no-scrollbar::-webkit-scrollbar{display:none}.\[key\:string\]{key:string}.focus-within\:xc-border-opacity-40:focus-within{--tw-border-opacity: .4}.hover\:xc-shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.disabled\:xc-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:xc-bg-white:disabled{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.disabled\:xc-bg-opacity-10:disabled{--tw-bg-opacity: .1}.disabled\:xc-text-opacity-50:disabled{--tw-text-opacity: .5}.disabled\:xc-opacity-20:disabled{opacity:.2}.xc-group:hover .group-hover\:xc-left-2{left:.5rem}.xc-group:hover .group-hover\:xc-right-0{right:0}.xc-group:hover .group-hover\:xc-opacity-0{opacity:0}.xc-group:hover .group-hover\:xc-opacity-100{opacity:1} +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.xc-pointer-events-none{pointer-events:none}.xc-absolute{position:absolute}.xc-relative{position:relative}.xc-inset-0{top:0;right:0;bottom:0;left:0}.xc-left-0{left:0}.xc-right-2{right:.5rem}.xc-top-0{top:0}.xc-z-10{z-index:10}.xc-m-auto{margin:auto}.xc-mx-auto{margin-left:auto;margin-right:auto}.xc-mb-1{margin-bottom:.25rem}.xc-mb-12{margin-bottom:3rem}.xc-mb-2{margin-bottom:.5rem}.xc-mb-3{margin-bottom:.75rem}.xc-mb-4{margin-bottom:1rem}.xc-mb-6{margin-bottom:1.5rem}.xc-mb-8{margin-bottom:2rem}.xc-ml-auto{margin-left:auto}.xc-mt-4{margin-top:1rem}.xc-box-content{box-sizing:content-box}.xc-block{display:block}.xc-inline-block{display:inline-block}.xc-flex{display:flex}.xc-grid{display:grid}.xc-aspect-\[1\/1\]{aspect-ratio:1/1}.xc-h-1{height:.25rem}.xc-h-10{height:2.5rem}.xc-h-12{height:3rem}.xc-h-16{height:4rem}.xc-h-4{height:1rem}.xc-h-5{height:1.25rem}.xc-h-6{height:1.5rem}.xc-h-\[309px\]{height:309px}.xc-h-full{height:100%}.xc-h-screen{height:100vh}.xc-max-h-\[272px\]{max-height:272px}.xc-max-h-\[309px\]{max-height:309px}.xc-w-1{width:.25rem}.xc-w-10{width:2.5rem}.xc-w-12{width:3rem}.xc-w-16{width:4rem}.xc-w-5{width:1.25rem}.xc-w-6{width:1.5rem}.xc-w-full{width:100%}.xc-w-px{width:1px}.xc-min-w-\[160px\]{min-width:160px}.xc-min-w-\[277px\]{min-width:277px}.xc-max-w-\[272px\]{max-width:272px}.xc-max-w-\[400px\]{max-width:400px}.xc-max-w-\[420px\]{max-width:420px}.xc-flex-1{flex:1 1 0%}.xc-shrink-0{flex-shrink:0}@keyframes xc-caret-blink{0%,70%,to{opacity:1}20%,50%{opacity:0}}.xc-animate-caret-blink{animation:xc-caret-blink 1.25s ease-out infinite}@keyframes xc-spin{to{transform:rotate(360deg)}}.xc-animate-spin{animation:xc-spin 1s linear infinite}.xc-cursor-pointer{cursor:pointer}.xc-appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.xc-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.xc-flex-col{flex-direction:column}.xc-flex-wrap{flex-wrap:wrap}.xc-items-center{align-items:center}.xc-justify-center{justify-content:center}.xc-justify-between{justify-content:space-between}.xc-gap-2{gap:.5rem}.xc-gap-3{gap:.75rem}.xc-gap-4{gap:1rem}.xc-overflow-hidden{overflow:hidden}.xc-overflow-scroll{overflow:scroll}.xc-rounded-2xl{border-radius:1rem}.xc-rounded-full{border-radius:9999px}.xc-rounded-lg{border-radius:.5rem}.xc-rounded-md{border-radius:.375rem}.xc-rounded-xl{border-radius:.75rem}.xc-border{border-width:1px}.xc-border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.xc-border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.xc-border-opacity-15{--tw-border-opacity: .15}.xc-border-opacity-20{--tw-border-opacity: .2}.xc-bg-\[\#009E8C\]{--tw-bg-opacity: 1;background-color:rgb(0 158 140 / var(--tw-bg-opacity, 1))}.xc-bg-\[\#2596FF\]{--tw-bg-opacity: 1;background-color:rgb(37 150 255 / var(--tw-bg-opacity, 1))}.xc-bg-\[rgb\(135\,93\,255\)\]{--tw-bg-opacity: 1;background-color:rgb(135 93 255 / var(--tw-bg-opacity, 1))}.xc-bg-\[rgb\(28\,28\,38\)\]{--tw-bg-opacity: 1;background-color:rgb(28 28 38 / var(--tw-bg-opacity, 1))}.xc-bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.xc-bg-transparent{background-color:transparent}.xc-bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.xc-bg-opacity-10{--tw-bg-opacity: .1}.xc-p-1{padding:.25rem}.xc-p-6{padding:1.5rem}.xc-px-3{padding-left:.75rem;padding-right:.75rem}.xc-px-4{padding-left:1rem;padding-right:1rem}.xc-px-6{padding-left:1.5rem;padding-right:1.5rem}.xc-px-8{padding-left:2rem;padding-right:2rem}.xc-py-1{padding-top:.25rem;padding-bottom:.25rem}.xc-py-2{padding-top:.5rem;padding-bottom:.5rem}.xc-py-3{padding-top:.75rem;padding-bottom:.75rem}.xc-text-center{text-align:center}.xc-text-2xl{font-size:1.5rem;line-height:2rem}.xc-text-lg{font-size:1.125rem;line-height:1.75rem}.xc-text-sm{font-size:.875rem;line-height:1.25rem}.xc-text-xl{font-size:1.25rem;line-height:1.75rem}.xc-text-xs{font-size:.75rem;line-height:1rem}.xc-font-bold{font-weight:700}.xc-text-\[\#ff0000\]{--tw-text-opacity: 1;color:rgb(255 0 0 / var(--tw-text-opacity, 1))}.xc-text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.xc-text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.xc-text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.xc-text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.xc-opacity-0{opacity:0}.xc-opacity-100{opacity:1}.xc-opacity-20{opacity:.2}.xc-opacity-50{opacity:.5}.xc-opacity-80{opacity:.8}.xc-outline-none{outline:2px solid transparent;outline-offset:2px}.xc-ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.xc-ring-\[rgb\(135\,93\,255\)\]{--tw-ring-opacity: 1;--tw-ring-color: rgb(135 93 255 / var(--tw-ring-opacity, 1))}.xc-transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.xc-duration-1000{transition-duration:1s}.no-scrollbar::-webkit-scrollbar{display:none}.\[key\:string\]{key:string}.focus-within\:xc-border-opacity-40:focus-within{--tw-border-opacity: .4}.hover\:xc-shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.disabled\:xc-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:xc-bg-white:disabled{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.disabled\:xc-bg-opacity-10:disabled{--tw-bg-opacity: .1}.disabled\:xc-text-opacity-50:disabled{--tw-text-opacity: .5}.disabled\:xc-opacity-20:disabled{opacity:.2}.xc-group:hover .group-hover\:xc-left-2{left:.5rem}.xc-group:hover .group-hover\:xc-right-0{right:0}.xc-group:hover .group-hover\:xc-opacity-0{opacity:0}.xc-group:hover .group-hover\:xc-opacity-100{opacity:1} diff --git a/lib/components/email-login.tsx b/lib/components/email-login.tsx deleted file mode 100644 index e29ca86..0000000 --- a/lib/components/email-login.tsx +++ /dev/null @@ -1,121 +0,0 @@ -import ControlHead from './control-head' -import TransitionEffect from './transition-effect' -import { useEffect, useState } from 'react' -import { InputOTP, InputOTPGroup, InputOTPSlot } from './ui/input-otp' -import accountApi, { ILoginResponse } from '@/api/account.api' -import { Loader2, Mail } from 'lucide-react' -import Spin from './ui/spin' -import { cn } from '@udecode/cn' -import { useCodattaSigninContext } from '@/providers/codatta-signin-context-provider' - -export default function EmailLoginWidget(props: { - email: string - onLogin: (res: ILoginResponse) => void - onBack: () => void -}) { - const { email } = props - const [count, setCount] = useState(0) - const [loading, setLoading] = useState(false) - const [sendingCode, setSendingCode] = useState(false) - const [getCodeError, setGetCodeError] = useState('') - const [signInError, setSignInError] = useState('') - const config = useCodattaSigninContext() - - async function startCountDown() { - setCount(60) - const timer = setInterval(() => { - setCount((prev) => { - if (prev === 0) { - clearInterval(timer) - return 0 - } - return prev - 1 - }) - }, 1000) - } - - async function sendEmailCode(email: string) { - setSendingCode(true) - try { - setGetCodeError('') - await accountApi.getEmailCode({ account_type: 'email', email }) - startCountDown() - } catch (err: any) { - setGetCodeError(err.message) - } - setSendingCode(false) - } - - useEffect(() => { - if (!email) return - sendEmailCode(email) - }, [email]) - - async function handleOTPChange(value: string) { - setSignInError('') - if (value.length < 6) return - setLoading(true) - try { - const res = await accountApi.emailLogin({ - account_type: 'email', - connector: 'codatta_email', - account_enum: 'C', - email_code: value, - email: email, - inviter_code: config.inviterCode, - source: { - device: config.device, - channel: config.channel, - app: config.app - } - }) - props.onLogin(res.data) - } catch (err: any) { - setSignInError(err.message) - } - setLoading(false) - } - - return ( - -
- -
- -
- -
- {getCodeError ?

{getCodeError}

: - sendingCode ? : <> -

We’ve sent a verification code to

-

{email}

- - } -
- -
- - - -
- - - - - - -
-
-
-
-
- {signInError &&

{signInError}

} -
- -
- Not get it? {count ? `Resend in ${count}s` : } -
- - - ) -} diff --git a/lib/components/signin-index.tsx b/lib/components/signin-index.tsx index acddce7..12bb312 100644 --- a/lib/components/signin-index.tsx +++ b/lib/components/signin-index.tsx @@ -73,18 +73,6 @@ export default function SingInIndex(props: { {props.header ||
Log in or sign up
} - {config.showEmailSignIn && ( -
- - -
- )} - - {config.showEmailSignIn && (config.showFeaturedWallets || config.showTonConnect) &&
- OR -
- } -
{config.showFeaturedWallets && featuredWallets && @@ -105,6 +93,18 @@ export default function SingInIndex(props: {
{config.showMoreWallets && }
+ + {config.showEmailSignIn && (config.showFeaturedWallets || config.showTonConnect) &&
+ OR +
+ } + + {config.showEmailSignIn && ( +
+ + +
+ )} } ) diff --git a/package.json b/package.json index b0bbea0..9a7922c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codatta-connect", - "version": "2.3.2", + "version": "2.3.2-SPC002", "type": "module", "main": "./dist/index.umd.js", "module": "./dist/index.es.js", diff --git a/src/views/login-view.tsx b/src/views/login-view.tsx index 2fb2f35..f55e147 100644 --- a/src/views/login-view.tsx +++ b/src/views/login-view.tsx @@ -58,7 +58,7 @@ export default function LoginView() { return (<> - - {/* */} + */} + }}> ) } \ No newline at end of file diff --git a/vite.config.dev.ts b/vite.config.dev.ts index e5bb5f2..7c9a929 100644 --- a/vite.config.dev.ts +++ b/vite.config.dev.ts @@ -39,7 +39,7 @@ export default defineConfig({ server: { proxy: { '/api': { - target: 'https://app-test.b18a.io', + target: 'https://app.codatta.io', changeOrigin: true, configure: proxyDebug, }, From 5faff66666e286442b0e7d21152c7114136f77a8 Mon Sep 17 00:00:00 2001 From: Meow Lord Date: Thu, 9 Jan 2025 10:36:49 +0800 Subject: [PATCH 09/25] fix: fix spell --- dist/index.es.js | 2 +- dist/index.umd.js | 2 +- dist/{main-BTMJGjm9.js => main-BPYw2mdm.js} | 4 ++-- dist/{secp256k1-Vxeo4UZR.js => secp256k1-zOw5-Bh-.js} | 2 +- lib/components/email-connect.tsx | 2 +- package.json | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) rename dist/{main-BTMJGjm9.js => main-BPYw2mdm.js} (99%) rename dist/{secp256k1-Vxeo4UZR.js => secp256k1-zOw5-Bh-.js} (99%) diff --git a/dist/index.es.js b/dist/index.es.js index f3d96c7..d2fee2e 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -1,4 +1,4 @@ -import { f as o, C as n, d as e, a as C, u as s } from "./main-BTMJGjm9.js"; +import { f as o, C as n, d as e, a as C, u as s } from "./main-BPYw2mdm.js"; export { o as CodattaConnect, n as CodattaConnectContextProvider, diff --git a/dist/index.umd.js b/dist/index.umd.js index 664d748..5daf3bb 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -218,7 +218,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene --nojs-bg: black !important; --nojs-fg: white !important; } -}`;const b7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>ge.jsx(v7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));b7.displayName="InputOTP";const y7=Yt.forwardRef(({className:t,...e},r)=>ge.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));y7.displayName="InputOTPGroup";const Ac=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(m7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return ge.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&ge.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:ge.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Ac.displayName="InputOTPSlot";function cZ(t){const{spinning:e,children:r,className:n}=t;return ge.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&ge.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:ge.jsx(vc,{className:"xc-animate-spin"})})]})}function w7(t){const{email:e}=t,[r,n]=Se.useState(0),[i,s]=Se.useState(!1),[o,a]=Se.useState("");async function u(){n(60);const d=setInterval(()=>{n(g=>g===0?(clearInterval(d),0):g-1)},1e3)}async function l(d){if(a(""),!(d.length<6)){s(!0);try{await t.onInputCode(e,d)}catch(g){a(g.message)}s(!1)}}return Se.useEffect(()=>{u()},[]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(FK,{className:"xc-mb-4",size:60}),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:[ge.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),ge.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]}),ge.jsx("div",{className:"xc-mb-2 xc-h-12",children:ge.jsx(cZ,{spinning:i,className:"xc-rounded-xl",children:ge.jsx(b7,{maxLength:6,onChange:l,disabled:i,className:"disabled:xc-opacity-20",children:ge.jsx(y7,{children:ge.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[ge.jsx(Ac,{index:0}),ge.jsx(Ac,{index:1}),ge.jsx(Ac,{index:2}),ge.jsx(Ac,{index:3}),ge.jsx(Ac,{index:4}),ge.jsx(Ac,{index:5})]})})})})}),o&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:o})})]}),ge.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Recend in ${r}s`:ge.jsx("button",{id:"sendCodeButton",onClick:t.onResendCode,children:"Send again"})]}),ge.jsx("div",{id:"captcha-element"})]})}function x7(t){const{email:e}=t,[r,n]=Se.useState(!1),[i,s]=Se.useState(""),o=Se.useMemo(()=>`xn-btn-${new Date().getTime()}`,[e]);async function a(y,A){n(!0),s(""),await va.getEmailCode({account_type:"email",email:y},A),n(!1)}async function u(y){try{return await a(e,JSON.stringify(y)),{captchaResult:!0,bizResult:!0}}catch(A){return s(A.message),{captchaResult:!1,bizResult:!1}}}async function l(y){y&&t.onCodeSend()}const d=Se.useRef();function g(y){d.current=y}return Se.useEffect(()=>{if(e)return window.initAliyunCaptcha({SceneId:"tqyu8129d",prefix:"1mfsn5f",mode:"popup",element:"#captcha-element",button:`#${o}`,captchaVerifyCallback:u,onBizResultCallback:l,getInstance:g,slideStyle:{width:360,height:40},language:"en",region:"cn"}),()=>{var y,A;(y=document.getElementById("aliyunCaptcha-mask"))==null||y.remove(),(A=document.getElementById("aliyunCaptcha-window-popup"))==null||A.remove()}},[e]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(jK,{className:"xc-mb-4",size:60}),ge.jsx("button",{className:"xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2",id:o,children:r?ge.jsx(vc,{className:"xc-animate-spin"}):"I'm not a robot"})]}),i&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:i})})]})}function uZ(t){const{email:e}=t,r=Mb(),[n,i]=Se.useState("captcha");async function s(o,a){const u=await va.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:a,email:o,inviter_code:r.inviterCode,source:{device:r.device,channel:r.channel,app:r.app}});t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),n==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>i("verify-email")}),n==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:s,onResendCode:()=>i("captcha")})]})}var _7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var g=function(f,p){var v=f,x=k[p],_=null,S=0,b=null,M=[],I={},F=function(te,le){_=function(ie){for(var fe=new Array(ie),ve=0;ve=7&&ee(te),b==null&&(b=R(v,x,M)),Q(b,le)},ae=function(te,le){for(var ie=-1;ie<=7;ie+=1)if(!(te+ie<=-1||S<=te+ie))for(var fe=-1;fe<=7;fe+=1)le+fe<=-1||S<=le+fe||(_[te+ie][le+fe]=0<=ie&&ie<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(ie==0||ie==6)||2<=ie&&ie<=4&&2<=fe&&fe<=4)},O=function(){for(var te=8;te>ie&1)==1;_[Math.floor(ie/3)][ie%3+S-8-3]=fe}for(ie=0;ie<18;ie+=1)fe=!te&&(le>>ie&1)==1,_[ie%3+S-8-3][Math.floor(ie/3)]=fe},X=function(te,le){for(var ie=x<<3|le,fe=B.getBCHTypeInfo(ie),ve=0;ve<15;ve+=1){var Me=!te&&(fe>>ve&1)==1;ve<6?_[ve][8]=Me:ve<8?_[ve+1][8]=Me:_[S-15+ve][8]=Me}for(ve=0;ve<15;ve+=1)Me=!te&&(fe>>ve&1)==1,ve<8?_[8][S-ve-1]=Me:ve<9?_[8][15-ve-1+1]=Me:_[8][15-ve-1]=Me;_[S-8][8]=!te},Q=function(te,le){for(var ie=-1,fe=S-1,ve=7,Me=0,Ne=B.getMaskFunction(le),Te=S-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var $e=0;$e<2;$e+=1)if(_[fe][Te-$e]==null){var Ie=!1;Me>>ve&1)==1),Ne(fe,Te-$e)&&(Ie=!Ie),_[fe][Te-$e]=Ie,(ve-=1)==-1&&(Me+=1,ve=7)}if((fe+=ie)<0||S<=fe){fe-=ie,ie=-ie;break}}},R=function(te,le,ie){for(var fe=K.getRSBlocks(te,le),ve=J(),Me=0;Me8*Te)throw"code length overflow. ("+ve.getLengthInBits()+">"+8*Te+")";for(ve.getLengthInBits()+4<=8*Te&&ve.put(0,4);ve.getLengthInBits()%8!=0;)ve.putBit(!1);for(;!(ve.getLengthInBits()>=8*Te||(ve.put(236,8),ve.getLengthInBits()>=8*Te));)ve.put(17,8);return function($e,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Ee=0;Ee=0?rt.getAt(Je):0}}var pt=0;for(Be=0;BeIe)&&(Ne=Ie,Te=$e)}return Te}())},I.createTableTag=function(te,le){te=te||2;var ie="";ie+='";for(var ve=0;ve';ie+=""}return(ie+="")+"
"},I.createSvgTag=function(te,le,ie,fe){var ve={};typeof arguments[0]=="object"&&(te=(ve=arguments[0]).cellSize,le=ve.margin,ie=ve.alt,fe=ve.title),te=te||2,le=le===void 0?4*te:le,(ie=typeof ie=="string"?{text:ie}:ie||{}).text=ie.text||null,ie.id=ie.text?ie.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*te+2*le,Le="";for($e="l"+te+",0 0,"+te+" -"+te+",0 0,-"+te+"z ",Le+=''+Z(fe.text)+"":"",Le+=ie.text?''+Z(ie.text)+"":"",Le+='',Le+='"},I.createDataURL=function(te,le){te=te||2,le=le===void 0?4*te:le;var ie=I.getModuleCount()*te+2*le,fe=le,ve=ie-le;return m(ie,ie,function(Me,Ne){if(fe<=Me&&Me"};var Z=function(te){for(var le="",ie=0;ie":le+=">";break;case"&":le+="&";break;case'"':le+=""";break;default:le+=fe}}return le};return I.createASCII=function(te,le){if((te=te||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Ee,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:pt[Be];ft+=` +}`;const b7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>ge.jsx(v7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));b7.displayName="InputOTP";const y7=Yt.forwardRef(({className:t,...e},r)=>ge.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));y7.displayName="InputOTPGroup";const Ac=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(m7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return ge.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&ge.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:ge.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Ac.displayName="InputOTPSlot";function cZ(t){const{spinning:e,children:r,className:n}=t;return ge.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&ge.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:ge.jsx(vc,{className:"xc-animate-spin"})})]})}function w7(t){const{email:e}=t,[r,n]=Se.useState(0),[i,s]=Se.useState(!1),[o,a]=Se.useState("");async function u(){n(60);const d=setInterval(()=>{n(g=>g===0?(clearInterval(d),0):g-1)},1e3)}async function l(d){if(a(""),!(d.length<6)){s(!0);try{await t.onInputCode(e,d)}catch(g){a(g.message)}s(!1)}}return Se.useEffect(()=>{u()},[]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(FK,{className:"xc-mb-4",size:60}),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:[ge.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),ge.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]}),ge.jsx("div",{className:"xc-mb-2 xc-h-12",children:ge.jsx(cZ,{spinning:i,className:"xc-rounded-xl",children:ge.jsx(b7,{maxLength:6,onChange:l,disabled:i,className:"disabled:xc-opacity-20",children:ge.jsx(y7,{children:ge.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[ge.jsx(Ac,{index:0}),ge.jsx(Ac,{index:1}),ge.jsx(Ac,{index:2}),ge.jsx(Ac,{index:3}),ge.jsx(Ac,{index:4}),ge.jsx(Ac,{index:5})]})})})})}),o&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:o})})]}),ge.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Resend in ${r}s`:ge.jsx("button",{id:"sendCodeButton",onClick:t.onResendCode,children:"Send again"})]}),ge.jsx("div",{id:"captcha-element"})]})}function x7(t){const{email:e}=t,[r,n]=Se.useState(!1),[i,s]=Se.useState(""),o=Se.useMemo(()=>`xn-btn-${new Date().getTime()}`,[e]);async function a(y,A){n(!0),s(""),await va.getEmailCode({account_type:"email",email:y},A),n(!1)}async function u(y){try{return await a(e,JSON.stringify(y)),{captchaResult:!0,bizResult:!0}}catch(A){return s(A.message),{captchaResult:!1,bizResult:!1}}}async function l(y){y&&t.onCodeSend()}const d=Se.useRef();function g(y){d.current=y}return Se.useEffect(()=>{if(e)return window.initAliyunCaptcha({SceneId:"tqyu8129d",prefix:"1mfsn5f",mode:"popup",element:"#captcha-element",button:`#${o}`,captchaVerifyCallback:u,onBizResultCallback:l,getInstance:g,slideStyle:{width:360,height:40},language:"en",region:"cn"}),()=>{var y,A;(y=document.getElementById("aliyunCaptcha-mask"))==null||y.remove(),(A=document.getElementById("aliyunCaptcha-window-popup"))==null||A.remove()}},[e]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(jK,{className:"xc-mb-4",size:60}),ge.jsx("button",{className:"xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2",id:o,children:r?ge.jsx(vc,{className:"xc-animate-spin"}):"I'm not a robot"})]}),i&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:i})})]})}function uZ(t){const{email:e}=t,r=Mb(),[n,i]=Se.useState("captcha");async function s(o,a){const u=await va.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:a,email:o,inviter_code:r.inviterCode,source:{device:r.device,channel:r.channel,app:r.app}});t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),n==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>i("verify-email")}),n==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:s,onResendCode:()=>i("captcha")})]})}var _7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var g=function(f,p){var v=f,x=k[p],_=null,S=0,b=null,M=[],I={},F=function(te,le){_=function(ie){for(var fe=new Array(ie),ve=0;ve=7&&ee(te),b==null&&(b=R(v,x,M)),Q(b,le)},ae=function(te,le){for(var ie=-1;ie<=7;ie+=1)if(!(te+ie<=-1||S<=te+ie))for(var fe=-1;fe<=7;fe+=1)le+fe<=-1||S<=le+fe||(_[te+ie][le+fe]=0<=ie&&ie<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(ie==0||ie==6)||2<=ie&&ie<=4&&2<=fe&&fe<=4)},O=function(){for(var te=8;te>ie&1)==1;_[Math.floor(ie/3)][ie%3+S-8-3]=fe}for(ie=0;ie<18;ie+=1)fe=!te&&(le>>ie&1)==1,_[ie%3+S-8-3][Math.floor(ie/3)]=fe},X=function(te,le){for(var ie=x<<3|le,fe=B.getBCHTypeInfo(ie),ve=0;ve<15;ve+=1){var Me=!te&&(fe>>ve&1)==1;ve<6?_[ve][8]=Me:ve<8?_[ve+1][8]=Me:_[S-15+ve][8]=Me}for(ve=0;ve<15;ve+=1)Me=!te&&(fe>>ve&1)==1,ve<8?_[8][S-ve-1]=Me:ve<9?_[8][15-ve-1+1]=Me:_[8][15-ve-1]=Me;_[S-8][8]=!te},Q=function(te,le){for(var ie=-1,fe=S-1,ve=7,Me=0,Ne=B.getMaskFunction(le),Te=S-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var $e=0;$e<2;$e+=1)if(_[fe][Te-$e]==null){var Ie=!1;Me>>ve&1)==1),Ne(fe,Te-$e)&&(Ie=!Ie),_[fe][Te-$e]=Ie,(ve-=1)==-1&&(Me+=1,ve=7)}if((fe+=ie)<0||S<=fe){fe-=ie,ie=-ie;break}}},R=function(te,le,ie){for(var fe=K.getRSBlocks(te,le),ve=J(),Me=0;Me8*Te)throw"code length overflow. ("+ve.getLengthInBits()+">"+8*Te+")";for(ve.getLengthInBits()+4<=8*Te&&ve.put(0,4);ve.getLengthInBits()%8!=0;)ve.putBit(!1);for(;!(ve.getLengthInBits()>=8*Te||(ve.put(236,8),ve.getLengthInBits()>=8*Te));)ve.put(17,8);return function($e,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Ee=0;Ee=0?rt.getAt(Je):0}}var pt=0;for(Be=0;BeIe)&&(Ne=Ie,Te=$e)}return Te}())},I.createTableTag=function(te,le){te=te||2;var ie="";ie+='";for(var ve=0;ve';ie+=""}return(ie+="")+"
"},I.createSvgTag=function(te,le,ie,fe){var ve={};typeof arguments[0]=="object"&&(te=(ve=arguments[0]).cellSize,le=ve.margin,ie=ve.alt,fe=ve.title),te=te||2,le=le===void 0?4*te:le,(ie=typeof ie=="string"?{text:ie}:ie||{}).text=ie.text||null,ie.id=ie.text?ie.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*te+2*le,Le="";for($e="l"+te+",0 0,"+te+" -"+te+",0 0,-"+te+"z ",Le+=''+Z(fe.text)+"":"",Le+=ie.text?''+Z(ie.text)+"":"",Le+='',Le+='"},I.createDataURL=function(te,le){te=te||2,le=le===void 0?4*te:le;var ie=I.getModuleCount()*te+2*le,fe=le,ve=ie-le;return m(ie,ie,function(Me,Ne){if(fe<=Me&&Me"};var Z=function(te){for(var le="",ie=0;ie":le+=">";break;case"&":le+="&";break;case'"':le+=""";break;default:le+=fe}}return le};return I.createASCII=function(te,le){if((te=te||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Ee,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:pt[Be];ft+=` `}return et%2&&ze>0?ft.substring(0,ft.length-et-1)+Array(et+1).join("▀"):ft.substring(0,ft.length-1)}(le);te-=1,le=le===void 0?2*te:le;var ie,fe,ve,Me,Ne=I.getModuleCount()*te+2*le,Te=le,$e=Ne-le,Ie=Array(te+1).join("██"),Le=Array(te+1).join(" "),Ve="",ke="";for(ie=0;ie>>8),S.push(255&I)):S.push(x)}}return S}};var y,A,P,N,D,k={L:1,M:0,Q:3,H:2},B=(y=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],A=1335,P=7973,D=function(f){for(var p=0;f!=0;)p+=1,f>>>=1;return p},(N={}).getBCHTypeInfo=function(f){for(var p=f<<10;D(p)-D(A)>=0;)p^=A<=0;)p^=P<5&&(v+=3+S-5)}for(x=0;x=256;)x-=255;return f[x]}}}();function U(f,p){if(f.length===void 0)throw f.length+"/"+p;var v=function(){for(var _=0;_>>7-x%8&1)==1},put:function(x,_){for(var S=0;S<_;S+=1)v.putBit((x>>>_-S-1&1)==1)},getLengthInBits:function(){return p},putBit:function(x){var _=Math.floor(p/8);f.length<=_&&f.push(0),x&&(f[_]|=128>>>p%8),p+=1}};return v},T=function(f){var p=f,v={getMode:function(){return 1},getLength:function(S){return p.length},write:function(S){for(var b=p,M=0;M+2>>8&255)+(255&M),_.put(M,13),b+=2}if(b>>8)},writeBytes:function(v,x,_){x=x||0,_=_||v.length;for(var S=0;S<_;S+=1)p.writeByte(v[S+x])},writeString:function(v){for(var x=0;x0&&(v+=","),v+=f[x];return v+"]"}};return p},E=function(f){var p=f,v=0,x=0,_=0,S={read:function(){for(;_<8;){if(v>=p.length){if(_==0)return-1;throw"unexpected end of file./"+_}var M=p.charAt(v);if(v+=1,M=="=")return _=0,-1;M.match(/^\s$/)||(x=x<<6|b(M.charCodeAt(0)),_+=6)}var I=x>>>_-8&255;return _-=8,I}},b=function(M){if(65<=M&&M<=90)return M-65;if(97<=M&&M<=122)return M-97+26;if(48<=M&&M<=57)return M-48+52;if(M==43)return 62;if(M==47)return 63;throw"c:"+M};return S},m=function(f,p,v){for(var x=function(ae,O){var se=ae,ee=O,X=new Array(ae*O),Q={setPixel:function(te,le,ie){X[le*se+te]=ie},write:function(te){te.writeString("GIF87a"),te.writeShort(se),te.writeShort(ee),te.writeByte(128),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(255),te.writeByte(255),te.writeByte(255),te.writeString(","),te.writeShort(0),te.writeShort(0),te.writeShort(se),te.writeShort(ee),te.writeByte(0);var le=R(2);te.writeByte(2);for(var ie=0;le.length-ie>255;)te.writeByte(255),te.writeBytes(le,ie,255),ie+=255;te.writeByte(le.length-ie),te.writeBytes(le,ie,le.length-ie),te.writeByte(0),te.writeString(";")}},R=function(te){for(var le=1<>>Ee)throw"length over";for(;Te+Ee>=8;)Ne.writeByte(255&(He<>>=8-Te,$e=0,Te=0;$e|=He<0&&Ne.writeByte($e)}});Le.write(le,fe);var Ve=0,ke=String.fromCharCode(X[Ve]);for(Ve+=1;Ve=6;)Q(ae>>>O-6),O-=6},X.flush=function(){if(O>0&&(Q(ae<<6-O),ae=0,O=0),se%3!=0)for(var Z=3-se%3,te=0;te>6,128|63&N):N<55296||N>=57344?A.push(224|N>>12,128|N>>6&63,128|63&N):(P++,N=65536+((1023&N)<<10|1023&y.charCodeAt(P)),A.push(240|N>>18,128|N>>12&63,128|N>>6&63,128|63&N))}return A}(g)},(l=typeof(u=function(){return d})=="function"?u.apply(a,[]):u)===void 0||(o.exports=l)}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var u=n[o]={exports:{}};return r[o](u,u.exports,i),u.exports}i.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return i.d(a,{a}),a},i.d=(o,a)=>{for(var u in a)i.o(a,u)&&!i.o(o,u)&&Object.defineProperty(o,u,{enumerable:!0,get:a[u]})},i.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a);var s={};return(()=>{i.d(s,{default:()=>G});const o=E=>!!E&&typeof E=="object"&&!Array.isArray(E);function a(E,...m){if(!m.length)return E;const f=m.shift();return f!==void 0&&o(E)&&o(f)?(E=Object.assign({},E),Object.keys(f).forEach(p=>{const v=E[p],x=f[p];Array.isArray(v)&&Array.isArray(x)?E[p]=x:o(v)&&o(x)?E[p]=a(Object.assign({},v),x):E[p]=x}),a(E,...m)):E}function u(E,m){const f=document.createElement("a");f.download=m,f.href=E,document.body.appendChild(f),f.click(),document.body.removeChild(f)}const l={L:.07,M:.15,Q:.25,H:.3};class d{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;switch(this._type){case"dots":x=this._drawDot;break;case"classy":x=this._drawClassy;break;case"classy-rounded":x=this._drawClassyRounded;break;case"rounded":x=this._drawRounded;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawSquare}x.call(this,{x:m,y:f,size:p,getNeighbor:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(p+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(p)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_basicSideRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, 0 ${-f}`)}}))}_basicCornerRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}v `+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_basicCornerExtraRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`)}}))}_basicCornersRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${f/2} ${f/2}h `+f/2+"v "+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_drawDot({x:m,y:f,size:p}){this._basicDot({x:m,y:f,size:p,rotation:0})}_drawSquare({x:m,y:f,size:p}){this._basicSquare({x:m,y:f,size:p,rotation:0})}_drawRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:p,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerRounded({x:m,y:f,size:p,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:p,rotation:I})}}else this._basicDot({x:m,y:f,size:p,rotation:0})}_drawExtraRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:p,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:p,rotation:I})}}else this._basicDot({x:m,y:f,size:p,rotation:0})}_drawClassy({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:p,rotation:0}):this._basicCornerRounded({x:m,y:f,size:p,rotation:Math.PI/2}):this._basicCornerRounded({x:m,y:f,size:p,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:p,rotation:Math.PI/2})}_drawClassyRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:p,rotation:0}):this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:p,rotation:Math.PI/2})}}class g{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;switch(this._type){case"square":x=this._drawSquare;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawDot}x.call(this,{x:m,y:f,size:p,rotation:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p+f/2} ${v}a ${f/2} ${f/2} 0 1 0 0.1 0zm 0 ${x}a ${f/2-x} ${f/2-x} 0 1 1 -0.1 0Z`)}}))}_basicSquare(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}v `+-f+`zM ${p+x} ${v+x}h `+(f-2*x)+"v "+(f-2*x)+"h "+(2*x-f)+"z")}}))}_basicExtraRounded(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p} ${v+2.5*x}v `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*x}h `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*-x}v `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*-x}h `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*x}M ${p+2.5*x} ${v+x}h `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*x}v `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*x}h `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*-x}v `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*-x}`)}}))}_drawDot({x:m,y:f,size:p,rotation:v}){this._basicDot({x:m,y:f,size:p,rotation:v})}_drawSquare({x:m,y:f,size:p,rotation:v}){this._basicSquare({x:m,y:f,size:p,rotation:v})}_drawExtraRounded({x:m,y:f,size:p,rotation:v}){this._basicExtraRounded({x:m,y:f,size:p,rotation:v})}}class y{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;x=this._type==="square"?this._drawSquare:this._drawDot,x.call(this,{x:m,y:f,size:p,rotation:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(p+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(p)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_drawDot({x:m,y:f,size:p,rotation:v}){this._basicDot({x:m,y:f,size:p,rotation:v})}_drawSquare({x:m,y:f,size:p,rotation:v}){this._basicSquare({x:m,y:f,size:p,rotation:v})}}const A="circle",P=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],N=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class D{constructor(m,f){this._roundSize=p=>this._options.dotsOptions.roundSize?Math.floor(p):p,this._window=f,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(m.width)),this._element.setAttribute("height",String(m.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),m.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=m.image,this._instanceId=D.instanceCount++,this._options=m}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(m){const f=m.getModuleCount(),p=Math.min(this._options.width,this._options.height)-2*this._options.margin,v=this._options.shape===A?p/Math.sqrt(2):p,x=this._roundSize(v/f);let _={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=m,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:S,qrOptions:b}=this._options,M=S.imageSize*l[b.errorCorrectionLevel],I=Math.floor(M*f*f);_=function({originalHeight:F,originalWidth:ae,maxHiddenDots:O,maxHiddenAxisDots:se,dotSize:ee}){const X={x:0,y:0},Q={x:0,y:0};if(F<=0||ae<=0||O<=0||ee<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const R=F/ae;return X.x=Math.floor(Math.sqrt(O/R)),X.x<=0&&(X.x=1),se&&seO||se&&se{var M,I,F,ae,O,se;return!(this._options.imageOptions.hideBackgroundDots&&S>=(f-_.hideYDots)/2&&S<(f+_.hideYDots)/2&&b>=(f-_.hideXDots)/2&&b<(f+_.hideXDots)/2||!((M=P[S])===null||M===void 0)&&M[b]||!((I=P[S-f+7])===null||I===void 0)&&I[b]||!((F=P[S])===null||F===void 0)&&F[b-f+7]||!((ae=N[S])===null||ae===void 0)&&ae[b]||!((O=N[S-f+7])===null||O===void 0)&&O[b]||!((se=N[S])===null||se===void 0)&&se[b-f+7])}),this.drawCorners(),this._options.image&&await this.drawImage({width:_.width,height:_.height,count:f,dotSize:x})}drawBackground(){var m,f,p;const v=this._element,x=this._options;if(v){const _=(m=x.backgroundOptions)===null||m===void 0?void 0:m.gradient,S=(f=x.backgroundOptions)===null||f===void 0?void 0:f.color;let b=x.height,M=x.width;if(_||S){const I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((p=x.backgroundOptions)===null||p===void 0)&&p.round&&(b=M=Math.min(x.width,x.height),I.setAttribute("rx",String(b/2*x.backgroundOptions.round))),I.setAttribute("x",String(this._roundSize((x.width-M)/2))),I.setAttribute("y",String(this._roundSize((x.height-b)/2))),I.setAttribute("width",String(M)),I.setAttribute("height",String(b)),this._backgroundClipPath.appendChild(I),this._createColor({options:_,color:S,additionalRotation:0,x:0,y:0,height:x.height,width:x.width,name:`background-color-${this._instanceId}`})}}}drawDots(m){var f,p;if(!this._qr)throw"QR code is not defined";const v=this._options,x=this._qr.getModuleCount();if(x>v.width||x>v.height)throw"The canvas is too small.";const _=Math.min(v.width,v.height)-2*v.margin,S=v.shape===A?_/Math.sqrt(2):_,b=this._roundSize(S/x),M=this._roundSize((v.width-x*b)/2),I=this._roundSize((v.height-x*b)/2),F=new d({svg:this._element,type:v.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(f=v.dotsOptions)===null||f===void 0?void 0:f.gradient,color:v.dotsOptions.color,additionalRotation:0,x:0,y:0,height:v.height,width:v.width,name:`dot-color-${this._instanceId}`});for(let ae=0;ae!(O+se<0||ae+ee<0||O+se>=x||ae+ee>=x)&&!(m&&!m(ae+ee,O+se))&&!!this._qr&&this._qr.isDark(ae+ee,O+se)),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element));if(v.shape===A){const ae=this._roundSize((_/b-x)/2),O=x+2*ae,se=M-ae*b,ee=I-ae*b,X=[],Q=this._roundSize(O/2);for(let R=0;R=ae-1&&R<=O-ae&&Z>=ae-1&&Z<=O-ae||Math.sqrt((R-Q)*(R-Q)+(Z-Q)*(Z-Q))>Q?X[R][Z]=0:X[R][Z]=this._qr.isDark(Z-2*ae<0?Z:Z>=x?Z-2*ae:Z-ae,R-2*ae<0?R:R>=x?R-2*ae:R-ae)?1:0}for(let R=0;R{var ie;return!!(!((ie=X[R+le])===null||ie===void 0)&&ie[Z+te])}),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const m=this._element,f=this._options;if(!m)throw"Element code is not defined";const p=this._qr.getModuleCount(),v=Math.min(f.width,f.height)-2*f.margin,x=f.shape===A?v/Math.sqrt(2):v,_=this._roundSize(x/p),S=7*_,b=3*_,M=this._roundSize((f.width-p*_)/2),I=this._roundSize((f.height-p*_)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([F,ae,O])=>{var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me;const Ne=M+F*_*(p-7),Te=I+ae*_*(p-7);let $e=this._dotsClipPath,Ie=this._dotsClipPath;if((!((se=f.cornersSquareOptions)===null||se===void 0)&&se.gradient||!((ee=f.cornersSquareOptions)===null||ee===void 0)&&ee.color)&&($e=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),$e.setAttribute("id",`clip-path-corners-square-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild($e),this._cornersSquareClipPath=this._cornersDotClipPath=Ie=$e,this._createColor({options:(X=f.cornersSquareOptions)===null||X===void 0?void 0:X.gradient,color:(Q=f.cornersSquareOptions)===null||Q===void 0?void 0:Q.color,additionalRotation:O,x:Ne,y:Te,height:S,width:S,name:`corners-square-color-${F}-${ae}-${this._instanceId}`})),(R=f.cornersSquareOptions)===null||R===void 0?void 0:R.type){const Le=new g({svg:this._element,type:f.cornersSquareOptions.type,window:this._window});Le.draw(Ne,Te,S,O),Le._element&&$e&&$e.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=P[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&$e&&$e.appendChild(Le._element))}if((!((te=f.cornersDotOptions)===null||te===void 0)&&te.gradient||!((le=f.cornersDotOptions)===null||le===void 0)&&le.color)&&(Ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Ie.setAttribute("id",`clip-path-corners-dot-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild(Ie),this._cornersDotClipPath=Ie,this._createColor({options:(ie=f.cornersDotOptions)===null||ie===void 0?void 0:ie.gradient,color:(fe=f.cornersDotOptions)===null||fe===void 0?void 0:fe.color,additionalRotation:O,x:Ne+2*_,y:Te+2*_,height:b,width:b,name:`corners-dot-color-${F}-${ae}-${this._instanceId}`})),(ve=f.cornersDotOptions)===null||ve===void 0?void 0:ve.type){const Le=new y({svg:this._element,type:f.cornersDotOptions.type,window:this._window});Le.draw(Ne+2*_,Te+2*_,b,O),Le._element&&Ie&&Ie.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=N[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&Ie&&Ie.appendChild(Le._element))}})}loadImage(){return new Promise((m,f)=>{var p;const v=this._options;if(!v.image)return f("Image is not defined");if(!((p=v.nodeCanvas)===null||p===void 0)&&p.loadImage)v.nodeCanvas.loadImage(v.image).then(x=>{var _,S;if(this._image=x,this._options.imageOptions.saveAsBlob){const b=(_=v.nodeCanvas)===null||_===void 0?void 0:_.createCanvas(this._image.width,this._image.height);(S=b==null?void 0:b.getContext("2d"))===null||S===void 0||S.drawImage(x,0,0),this._imageUri=b==null?void 0:b.toDataURL()}m()}).catch(f);else{const x=new this._window.Image;typeof v.imageOptions.crossOrigin=="string"&&(x.crossOrigin=v.imageOptions.crossOrigin),this._image=x,x.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await async function(_,S){return new Promise(b=>{const M=new S.XMLHttpRequest;M.onload=function(){const I=new S.FileReader;I.onloadend=function(){b(I.result)},I.readAsDataURL(M.response)},M.open("GET",_),M.responseType="blob",M.send()})}(v.image||"",this._window)),m()},x.src=v.image}})}async drawImage({width:m,height:f,count:p,dotSize:v}){const x=this._options,_=this._roundSize((x.width-p*v)/2),S=this._roundSize((x.height-p*v)/2),b=_+this._roundSize(x.imageOptions.margin+(p*v-m)/2),M=S+this._roundSize(x.imageOptions.margin+(p*v-f)/2),I=m-2*x.imageOptions.margin,F=f-2*x.imageOptions.margin,ae=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");ae.setAttribute("href",this._imageUri||""),ae.setAttribute("x",String(b)),ae.setAttribute("y",String(M)),ae.setAttribute("width",`${I}px`),ae.setAttribute("height",`${F}px`),this._element.appendChild(ae)}_createColor({options:m,color:f,additionalRotation:p,x:v,y:x,height:_,width:S,name:b}){const M=S>_?S:_,I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(I.setAttribute("x",String(v)),I.setAttribute("y",String(x)),I.setAttribute("height",String(_)),I.setAttribute("width",String(S)),I.setAttribute("clip-path",`url('#clip-path-${b}')`),m){let F;if(m.type==="radial")F=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("fx",String(v+S/2)),F.setAttribute("fy",String(x+_/2)),F.setAttribute("cx",String(v+S/2)),F.setAttribute("cy",String(x+_/2)),F.setAttribute("r",String(M/2));else{const ae=((m.rotation||0)+p)%(2*Math.PI),O=(ae+2*Math.PI)%(2*Math.PI);let se=v+S/2,ee=x+_/2,X=v+S/2,Q=x+_/2;O>=0&&O<=.25*Math.PI||O>1.75*Math.PI&&O<=2*Math.PI?(se-=S/2,ee-=_/2*Math.tan(ae),X+=S/2,Q+=_/2*Math.tan(ae)):O>.25*Math.PI&&O<=.75*Math.PI?(ee-=_/2,se-=S/2/Math.tan(ae),Q+=_/2,X+=S/2/Math.tan(ae)):O>.75*Math.PI&&O<=1.25*Math.PI?(se+=S/2,ee+=_/2*Math.tan(ae),X-=S/2,Q-=_/2*Math.tan(ae)):O>1.25*Math.PI&&O<=1.75*Math.PI&&(ee+=_/2,se+=S/2/Math.tan(ae),Q-=_/2,X-=S/2/Math.tan(ae)),F=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("x1",String(Math.round(se))),F.setAttribute("y1",String(Math.round(ee))),F.setAttribute("x2",String(Math.round(X))),F.setAttribute("y2",String(Math.round(Q)))}m.colorStops.forEach(({offset:ae,color:O})=>{const se=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");se.setAttribute("offset",100*ae+"%"),se.setAttribute("stop-color",O),F.appendChild(se)}),I.setAttribute("fill",`url('#${b}')`),this._defs.appendChild(F)}else f&&I.setAttribute("fill",f);this._element.appendChild(I)}}D.instanceCount=0;const k=D,B="canvas",j={};for(let E=0;E<=40;E++)j[E]=E;const U={type:B,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:j[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function K(E){const m=Object.assign({},E);if(!m.colorStops||!m.colorStops.length)throw"Field 'colorStops' is required in gradient";return m.rotation?m.rotation=Number(m.rotation):m.rotation=0,m.colorStops=m.colorStops.map(f=>Object.assign(Object.assign({},f),{offset:Number(f.offset)})),m}function J(E){const m=Object.assign({},E);return m.width=Number(m.width),m.height=Number(m.height),m.margin=Number(m.margin),m.imageOptions=Object.assign(Object.assign({},m.imageOptions),{hideBackgroundDots:!!m.imageOptions.hideBackgroundDots,imageSize:Number(m.imageOptions.imageSize),margin:Number(m.imageOptions.margin)}),m.margin>Math.min(m.width,m.height)&&(m.margin=Math.min(m.width,m.height)),m.dotsOptions=Object.assign({},m.dotsOptions),m.dotsOptions.gradient&&(m.dotsOptions.gradient=K(m.dotsOptions.gradient)),m.cornersSquareOptions&&(m.cornersSquareOptions=Object.assign({},m.cornersSquareOptions),m.cornersSquareOptions.gradient&&(m.cornersSquareOptions.gradient=K(m.cornersSquareOptions.gradient))),m.cornersDotOptions&&(m.cornersDotOptions=Object.assign({},m.cornersDotOptions),m.cornersDotOptions.gradient&&(m.cornersDotOptions.gradient=K(m.cornersDotOptions.gradient))),m.backgroundOptions&&(m.backgroundOptions=Object.assign({},m.backgroundOptions),m.backgroundOptions.gradient&&(m.backgroundOptions.gradient=K(m.backgroundOptions.gradient))),m}var T=i(873),z=i.n(T);function ue(E){if(!E)throw new Error("Extension must be defined");E[0]==="."&&(E=E.substring(1));const m={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[E.toLowerCase()];if(!m)throw new Error(`Extension "${E}" is not supported`);return m}class _e{constructor(m){m!=null&&m.jsdom?this._window=new m.jsdom("",{resources:"usable"}).window:this._window=window,this._options=m?J(a(U,m)):U,this.update()}static _clearContainer(m){m&&(m.innerHTML="")}_setupSvg(){if(!this._qr)return;const m=new k(this._options,this._window);this._svg=m.getElement(),this._svgDrawingPromise=m.drawQR(this._qr).then(()=>{var f;this._svg&&((f=this._extension)===null||f===void 0||f.call(this,m.getElement(),this._options))})}_setupCanvas(){var m,f;this._qr&&(!((m=this._options.nodeCanvas)===null||m===void 0)&&m.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(f=this._svgDrawingPromise)===null||f===void 0?void 0:f.then(()=>{var p;if(!this._svg)return;const v=this._svg,x=new this._window.XMLSerializer().serializeToString(v),_=btoa(x),S=`data:${ue("svg")};base64,${_}`;if(!((p=this._options.nodeCanvas)===null||p===void 0)&&p.loadImage)return this._options.nodeCanvas.loadImage(S).then(b=>{var M,I;b.width=this._options.width,b.height=this._options.height,(I=(M=this._nodeCanvas)===null||M===void 0?void 0:M.getContext("2d"))===null||I===void 0||I.drawImage(b,0,0)});{const b=new this._window.Image;return new Promise(M=>{b.onload=()=>{var I,F;(F=(I=this._domCanvas)===null||I===void 0?void 0:I.getContext("2d"))===null||F===void 0||F.drawImage(b,0,0),M()},b.src=S})}}))}async _getElement(m="png"){if(!this._qr)throw"QR code is empty";return m.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(m){_e._clearContainer(this._container),this._options=m?J(a(this._options,m)):this._options,this._options.data&&(this._qr=z()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(f){switch(!0){case/^[0-9]*$/.test(f):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(f):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===B?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(m){if(m){if(typeof m.appendChild!="function")throw"Container should be a single DOM node";this._options.type===B?this._domCanvas&&m.appendChild(this._domCanvas):this._svg&&m.appendChild(this._svg),this._container=m}}applyExtension(m){if(!m)throw"Extension function should be defined.";this._extension=m,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(m="png"){if(!this._qr)throw"QR code is empty";const f=await this._getElement(m),p=ue(m);if(!f)return null;if(m.toLowerCase()==="svg"){const v=`\r ${new this._window.XMLSerializer().serializeToString(f)}`;return typeof Blob>"u"||this._options.jsdom?Buffer.from(v):new Blob([v],{type:p})}return new Promise(v=>{const x=f;if("toBuffer"in x)if(p==="image/png")v(x.toBuffer(p));else if(p==="image/jpeg")v(x.toBuffer(p));else{if(p!=="application/pdf")throw Error("Unsupported extension");v(x.toBuffer(p))}else"toBlob"in x&&x.toBlob(v,p,1)})}async download(m){if(!this._qr)throw"QR code is empty";if(typeof Blob>"u")throw"Cannot download in Node.js, call getRawData instead.";let f="png",p="qr";typeof m=="string"?(f=m,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):typeof m=="object"&&m!==null&&(m.name&&(p=m.name),m.extension&&(f=m.extension));const v=await this._getElement(f);if(v)if(f.toLowerCase()==="svg"){let x=new XMLSerializer().serializeToString(v);x=`\r diff --git a/dist/main-BTMJGjm9.js b/dist/main-BPYw2mdm.js similarity index 99% rename from dist/main-BTMJGjm9.js rename to dist/main-BPYw2mdm.js index 6b66db7..d95cdc4 100644 --- a/dist/main-BTMJGjm9.js +++ b/dist/main-BPYw2mdm.js @@ -2850,7 +2850,7 @@ function UO(t) { return Bl(`0x${e}`); } async function qO({ hash: t, signature: e }) { - const r = va(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-Vxeo4UZR.js"); + const r = va(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-zOw5-Bh-.js"); return `0x${(() => { if (typeof e == "object" && "r" in e && "s" in e) { const { r: l, s: d, v: p, yParity: w } = e, A = Number(w ?? p), M = I2(A); @@ -38464,7 +38464,7 @@ function k9(t) { ] }), /* @__PURE__ */ pe.jsxs("div", { className: "xc-text-center xc-text-sm xc-text-gray-400", children: [ "Not get it? ", - r ? `Recend in ${r}s` : /* @__PURE__ */ pe.jsx("button", { id: "sendCodeButton", onClick: t.onResendCode, children: "Send again" }) + r ? `Resend in ${r}s` : /* @__PURE__ */ pe.jsx("button", { id: "sendCodeButton", onClick: t.onResendCode, children: "Send again" }) ] }), /* @__PURE__ */ pe.jsx("div", { id: "captcha-element" }) ] }); diff --git a/dist/secp256k1-Vxeo4UZR.js b/dist/secp256k1-zOw5-Bh-.js similarity index 99% rename from dist/secp256k1-Vxeo4UZR.js rename to dist/secp256k1-zOw5-Bh-.js index fd84375..a52d062 100644 --- a/dist/secp256k1-Vxeo4UZR.js +++ b/dist/secp256k1-zOw5-Bh-.js @@ -1,4 +1,4 @@ -import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-BTMJGjm9.js"; +import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-BPYw2mdm.js"; class Kt extends ee { constructor(n, t) { super(), this.finished = !1, this.destroyed = !1, ne(n); diff --git a/lib/components/email-connect.tsx b/lib/components/email-connect.tsx index 51299ea..0571084 100644 --- a/lib/components/email-connect.tsx +++ b/lib/components/email-connect.tsx @@ -75,7 +75,7 @@ export default function EmailConnect(props: {
- Not get it? {count ? `Recend in ${count}s` : } + Not get it? {count ? `Resend in ${count}s` : }
diff --git a/package.json b/package.json index 9a7922c..a3620cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codatta-connect", - "version": "2.3.2-SPC002", + "version": "2.3.2-SPC003", "type": "module", "main": "./dist/index.umd.js", "module": "./dist/index.es.js", From e484cd7cfc6c9a67bd7cceb0e314efab2d0c1208 Mon Sep 17 00:00:00 2001 From: Meow Lord Date: Sat, 8 Feb 2025 15:00:42 +0800 Subject: [PATCH 10/25] feat: support biz login --- lib/api/account.api.ts | 11 ++++++++--- lib/components/evm-wallet-login-widget.tsx | 2 +- lib/providers/codatta-signin-context-provider.tsx | 7 ++++++- src/views/login-view.tsx | 2 +- vite.config.dev.ts | 2 +- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/lib/api/account.api.ts b/lib/api/account.api.ts index 360d192..376a1c3 100644 --- a/lib/api/account.api.ts +++ b/lib/api/account.api.ts @@ -8,7 +8,7 @@ export type TDeviceType = 'WEB' | 'TG' | 'PLUG' export interface ILoginResponse { token: string - old_token: string + old_token?: string user_id: string, new_user: boolean } @@ -117,8 +117,13 @@ class AccountApi { } public async walletLogin(props: IWalletLoginParams) { - const res = await this.request.post<{ data: ILoginResponse }>(`${this._apiBase}/api/v2/user/login`, props) - return res.data + if (props.account_enum === 'C') { + const res = await this.request.post<{ data: ILoginResponse }>(`${this._apiBase}/api/v2/user/login`, props) + return res.data + } else { + const res = await this.request.post<{ data: ILoginResponse }>(`${this._apiBase}/api/v2/business/login`, props) + return res.data + } } public async tonLogin(props: ITonLoginParams) { diff --git a/lib/components/evm-wallet-login-widget.tsx b/lib/components/evm-wallet-login-widget.tsx index a851dd8..4dc15d8 100644 --- a/lib/components/evm-wallet-login-widget.tsx +++ b/lib/components/evm-wallet-login-widget.tsx @@ -26,7 +26,7 @@ export default function WalletLogin(props: { }) { const res = await accountApi.walletLogin({ account_type: 'block_chain', - account_enum: 'C', + account_enum: config.role, connector: 'codatta_wallet', inviter_code: config.inviterCode, wallet_name: wallet.config?.name || wallet.key, diff --git a/lib/providers/codatta-signin-context-provider.tsx b/lib/providers/codatta-signin-context-provider.tsx index ed235bc..1f8801c 100644 --- a/lib/providers/codatta-signin-context-provider.tsx +++ b/lib/providers/codatta-signin-context-provider.tsx @@ -7,13 +7,15 @@ export interface CodattaSigninConfig { device: TDeviceType app: string, inviterCode: string, + role?: "B" | "C" } -const CodattaSigninContext = createContext({ +const CodattaSigninContext = createContext({ channel: '', device: 'WEB', app: '', inviterCode: '', + role: 'C' }) export function useCodattaSigninContext() { @@ -30,6 +32,7 @@ export function CodattaSinginContextProvider(props: CodattaConnectContextProvide const [channel, setChannel] = useState(config.channel) const [device, setDevice] = useState(config.device) const [app, setApp] = useState(config.app) + const [role, setRole] = useState<("B" | "C")>(config.role || 'C') const [inviterCode, setInviderCode] = useState(config.inviterCode) useEffect(() => { @@ -37,6 +40,7 @@ export function CodattaSinginContextProvider(props: CodattaConnectContextProvide setDevice(config.device) setApp(config.app) setInviderCode(config.inviterCode) + setRole(config.role || 'C') }, [config]) return ( @@ -46,6 +50,7 @@ export function CodattaSinginContextProvider(props: CodattaConnectContextProvide device, app, inviterCode, + role }} > {props.children} diff --git a/src/views/login-view.tsx b/src/views/login-view.tsx index f55e147..c37c1a2 100644 --- a/src/views/login-view.tsx +++ b/src/views/login-view.tsx @@ -73,7 +73,7 @@ export default function LoginView() { channel:'test', device:'WEB', app:'test', - inviterCode:'' + inviterCode:'', }}> ) diff --git a/vite.config.dev.ts b/vite.config.dev.ts index 7c9a929..e5bb5f2 100644 --- a/vite.config.dev.ts +++ b/vite.config.dev.ts @@ -39,7 +39,7 @@ export default defineConfig({ server: { proxy: { '/api': { - target: 'https://app.codatta.io', + target: 'https://app-test.b18a.io', changeOrigin: true, configure: proxyDebug, }, From b99abdcdc44f52b36f33b640a9d0928a275755e4 Mon Sep 17 00:00:00 2001 From: Meow Lord Date: Sat, 8 Feb 2025 17:18:32 +0800 Subject: [PATCH 11/25] feat: release 2.4.2 --- dist/api/account.api.d.ts | 2 +- dist/index.es.js | 2 +- dist/index.umd.js | 68 +- dist/{main-BPYw2mdm.js => main-ChUtI_2i.js} | 644 +++++++++--------- .../codatta-signin-context-provider.d.ts | 5 +- ...56k1-zOw5-Bh-.js => secp256k1-C2LQAh0i.js} | 2 +- package.json | 2 +- src/views/login-view.tsx | 1 + 8 files changed, 366 insertions(+), 360 deletions(-) rename dist/{main-BPYw2mdm.js => main-ChUtI_2i.js} (98%) rename dist/{secp256k1-zOw5-Bh-.js => secp256k1-C2LQAh0i.js} (99%) diff --git a/dist/api/account.api.d.ts b/dist/api/account.api.d.ts index 2f011fa..3a673e5 100644 --- a/dist/api/account.api.d.ts +++ b/dist/api/account.api.d.ts @@ -5,7 +5,7 @@ export type TAccountRole = 'B' | 'C'; export type TDeviceType = 'WEB' | 'TG' | 'PLUG'; export interface ILoginResponse { token: string; - old_token: string; + old_token?: string; user_id: string; new_user: boolean; } diff --git a/dist/index.es.js b/dist/index.es.js index d2fee2e..117ce64 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -1,4 +1,4 @@ -import { f as o, C as n, d as e, a as C, u as s } from "./main-BPYw2mdm.js"; +import { f as o, C as n, d as e, a as C, u as s } from "./main-ChUtI_2i.js"; export { o as CodattaConnect, n as CodattaConnectContextProvider, diff --git a/dist/index.umd.js b/dist/index.umd.js index 5daf3bb..3e709a1 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Wy;function XA(){if(Wy)return gf;Wy=1;var t=Se,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,u,l){var d,g={},y=null,A=null;l!==void 0&&(y=""+l),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(A=u.ref);for(d in u)n.call(u,d)&&!s.hasOwnProperty(d)&&(g[d]=u[d]);if(a&&a.defaultProps)for(d in u=a.defaultProps,u)g[d]===void 0&&(g[d]=u[d]);return{$$typeof:e,type:a,key:y,ref:A,props:g,_owner:i.current}}return gf.Fragment=r,gf.jsx=o,gf.jsxs=o,gf}var mf={};/** + */var Wy;function XA(){if(Wy)return gf;Wy=1;var t=Se,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,u,l){var d,p={},y=null,A=null;l!==void 0&&(y=""+l),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(A=u.ref);for(d in u)n.call(u,d)&&!s.hasOwnProperty(d)&&(p[d]=u[d]);if(a&&a.defaultProps)for(d in u=a.defaultProps,u)p[d]===void 0&&(p[d]=u[d]);return{$$typeof:e,type:a,key:y,ref:A,props:p,_owner:i.current}}return gf.Fragment=r,gf.jsx=o,gf.jsxs=o,gf}var mf={};/** * @license React * react-jsx-runtime.development.js * @@ -14,15 +14,15 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ky;function ZA(){return Ky||(Ky=1,process.env.NODE_ENV!=="production"&&function(){var t=Se,e=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),A=Symbol.for("react.offscreen"),P=Symbol.iterator,N="@@iterator";function D(q){if(q===null||typeof q!="object")return null;var oe=P&&q[P]||q[N];return typeof oe=="function"?oe:null}var k=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function B(q){{for(var oe=arguments.length,pe=new Array(oe>1?oe-1:0),xe=1;xe1?oe-1:0),xe=1;xe=1&&tt>=0&&Ue[st]!==gt[tt];)tt--;for(;st>=1&&tt>=0;st--,tt--)if(Ue[st]!==gt[tt]){if(st!==1||tt!==1)do if(st--,tt--,tt<0||Ue[st]!==gt[tt]){var At=` -`+Ue[st].replace(" at new "," at ");return q.displayName&&At.includes("")&&(At=At.replace("",q.displayName)),typeof q=="function"&&R.set(q,At),At}while(st>=1&&tt>=0);break}}}finally{Q=!1,se.current=De,O(),Error.prepareStackTrace=Re}var Rt=q?q.displayName||q.name:"",Mt=Rt?X(Rt):"";return typeof q=="function"&&R.set(q,Mt),Mt}function le(q,oe,pe){return te(q,!1)}function ie(q){var oe=q.prototype;return!!(oe&&oe.isReactComponent)}function fe(q,oe,pe){if(q==null)return"";if(typeof q=="function")return te(q,ie(q));if(typeof q=="string")return X(q);switch(q){case l:return X("Suspense");case d:return X("SuspenseList")}if(typeof q=="object")switch(q.$$typeof){case u:return le(q.render);case g:return fe(q.type,oe,pe);case y:{var xe=q,Re=xe._payload,De=xe._init;try{return fe(De(Re),oe,pe)}catch{}}}return""}var ve=Object.prototype.hasOwnProperty,Me={},Ne=k.ReactDebugCurrentFrame;function Te(q){if(q){var oe=q._owner,pe=fe(q.type,q._source,oe?oe.type:null);Ne.setExtraStackFrame(pe)}else Ne.setExtraStackFrame(null)}function $e(q,oe,pe,xe,Re){{var De=Function.call.bind(ve);for(var it in q)if(De(q,it)){var Ue=void 0;try{if(typeof q[it]!="function"){var gt=Error((xe||"React class")+": "+pe+" type `"+it+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof q[it]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw gt.name="Invariant Violation",gt}Ue=q[it](oe,it,xe,pe,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(st){Ue=st}Ue&&!(Ue instanceof Error)&&(Te(Re),B("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",xe||"React class",pe,it,typeof Ue),Te(null)),Ue instanceof Error&&!(Ue.message in Me)&&(Me[Ue.message]=!0,Te(Re),B("Failed %s type: %s",pe,Ue.message),Te(null))}}}var Ie=Array.isArray;function Le(q){return Ie(q)}function Ve(q){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,pe=oe&&q[Symbol.toStringTag]||q.constructor.name||"Object";return pe}}function ke(q){try{return ze(q),!1}catch{return!0}}function ze(q){return""+q}function He(q){if(ke(q))return B("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ve(q)),ze(q)}var Ee=k.ReactCurrentOwner,Qe={key:!0,ref:!0,__self:!0,__source:!0},ct,Be,et;et={};function rt(q){if(ve.call(q,"ref")){var oe=Object.getOwnPropertyDescriptor(q,"ref").get;if(oe&&oe.isReactWarning)return!1}return q.ref!==void 0}function Je(q){if(ve.call(q,"key")){var oe=Object.getOwnPropertyDescriptor(q,"key").get;if(oe&&oe.isReactWarning)return!1}return q.key!==void 0}function pt(q,oe){if(typeof q.ref=="string"&&Ee.current&&oe&&Ee.current.stateNode!==oe){var pe=m(Ee.current.type);et[pe]||(B('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',m(Ee.current.type),q.ref),et[pe]=!0)}}function ht(q,oe){{var pe=function(){ct||(ct=!0,B("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};pe.isReactWarning=!0,Object.defineProperty(q,"key",{get:pe,configurable:!0})}}function ft(q,oe){{var pe=function(){Be||(Be=!0,B("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};pe.isReactWarning=!0,Object.defineProperty(q,"ref",{get:pe,configurable:!0})}}var Ht=function(q,oe,pe,xe,Re,De,it){var Ue={$$typeof:e,type:q,key:oe,ref:pe,props:it,_owner:De};return Ue._store={},Object.defineProperty(Ue._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ue,"_self",{configurable:!1,enumerable:!1,writable:!1,value:xe}),Object.defineProperty(Ue,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Re}),Object.freeze&&(Object.freeze(Ue.props),Object.freeze(Ue)),Ue};function Jt(q,oe,pe,xe,Re){{var De,it={},Ue=null,gt=null;pe!==void 0&&(He(pe),Ue=""+pe),Je(oe)&&(He(oe.key),Ue=""+oe.key),rt(oe)&&(gt=oe.ref,pt(oe,Re));for(De in oe)ve.call(oe,De)&&!Qe.hasOwnProperty(De)&&(it[De]=oe[De]);if(q&&q.defaultProps){var st=q.defaultProps;for(De in st)it[De]===void 0&&(it[De]=st[De])}if(Ue||gt){var tt=typeof q=="function"?q.displayName||q.name||"Unknown":q;Ue&&ht(it,tt),gt&&ft(it,tt)}return Ht(q,Ue,gt,Re,xe,Ee.current,it)}}var St=k.ReactCurrentOwner,er=k.ReactDebugCurrentFrame;function Xt(q){if(q){var oe=q._owner,pe=fe(q.type,q._source,oe?oe.type:null);er.setExtraStackFrame(pe)}else er.setExtraStackFrame(null)}var Ot;Ot=!1;function Bt(q){return typeof q=="object"&&q!==null&&q.$$typeof===e}function Tt(){{if(St.current){var q=m(St.current.type);if(q)return` +`+Ue[st].replace(" at new "," at ");return q.displayName&&At.includes("")&&(At=At.replace("",q.displayName)),typeof q=="function"&&R.set(q,At),At}while(st>=1&&tt>=0);break}}}finally{Q=!1,se.current=De,O(),Error.prepareStackTrace=Re}var Rt=q?q.displayName||q.name:"",Mt=Rt?X(Rt):"";return typeof q=="function"&&R.set(q,Mt),Mt}function le(q,oe,pe){return te(q,!1)}function ie(q){var oe=q.prototype;return!!(oe&&oe.isReactComponent)}function fe(q,oe,pe){if(q==null)return"";if(typeof q=="function")return te(q,ie(q));if(typeof q=="string")return X(q);switch(q){case l:return X("Suspense");case d:return X("SuspenseList")}if(typeof q=="object")switch(q.$$typeof){case u:return le(q.render);case p:return fe(q.type,oe,pe);case y:{var xe=q,Re=xe._payload,De=xe._init;try{return fe(De(Re),oe,pe)}catch{}}}return""}var ve=Object.prototype.hasOwnProperty,Me={},Ne=k.ReactDebugCurrentFrame;function Te(q){if(q){var oe=q._owner,pe=fe(q.type,q._source,oe?oe.type:null);Ne.setExtraStackFrame(pe)}else Ne.setExtraStackFrame(null)}function $e(q,oe,pe,xe,Re){{var De=Function.call.bind(ve);for(var it in q)if(De(q,it)){var Ue=void 0;try{if(typeof q[it]!="function"){var gt=Error((xe||"React class")+": "+pe+" type `"+it+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof q[it]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw gt.name="Invariant Violation",gt}Ue=q[it](oe,it,xe,pe,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(st){Ue=st}Ue&&!(Ue instanceof Error)&&(Te(Re),B("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",xe||"React class",pe,it,typeof Ue),Te(null)),Ue instanceof Error&&!(Ue.message in Me)&&(Me[Ue.message]=!0,Te(Re),B("Failed %s type: %s",pe,Ue.message),Te(null))}}}var Ie=Array.isArray;function Le(q){return Ie(q)}function Ve(q){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,pe=oe&&q[Symbol.toStringTag]||q.constructor.name||"Object";return pe}}function ke(q){try{return ze(q),!1}catch{return!0}}function ze(q){return""+q}function He(q){if(ke(q))return B("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ve(q)),ze(q)}var Ee=k.ReactCurrentOwner,Qe={key:!0,ref:!0,__self:!0,__source:!0},ct,Be,et;et={};function rt(q){if(ve.call(q,"ref")){var oe=Object.getOwnPropertyDescriptor(q,"ref").get;if(oe&&oe.isReactWarning)return!1}return q.ref!==void 0}function Je(q){if(ve.call(q,"key")){var oe=Object.getOwnPropertyDescriptor(q,"key").get;if(oe&&oe.isReactWarning)return!1}return q.key!==void 0}function pt(q,oe){if(typeof q.ref=="string"&&Ee.current&&oe&&Ee.current.stateNode!==oe){var pe=m(Ee.current.type);et[pe]||(B('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',m(Ee.current.type),q.ref),et[pe]=!0)}}function ht(q,oe){{var pe=function(){ct||(ct=!0,B("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};pe.isReactWarning=!0,Object.defineProperty(q,"key",{get:pe,configurable:!0})}}function ft(q,oe){{var pe=function(){Be||(Be=!0,B("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};pe.isReactWarning=!0,Object.defineProperty(q,"ref",{get:pe,configurable:!0})}}var Ht=function(q,oe,pe,xe,Re,De,it){var Ue={$$typeof:e,type:q,key:oe,ref:pe,props:it,_owner:De};return Ue._store={},Object.defineProperty(Ue._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ue,"_self",{configurable:!1,enumerable:!1,writable:!1,value:xe}),Object.defineProperty(Ue,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Re}),Object.freeze&&(Object.freeze(Ue.props),Object.freeze(Ue)),Ue};function Jt(q,oe,pe,xe,Re){{var De,it={},Ue=null,gt=null;pe!==void 0&&(He(pe),Ue=""+pe),Je(oe)&&(He(oe.key),Ue=""+oe.key),rt(oe)&&(gt=oe.ref,pt(oe,Re));for(De in oe)ve.call(oe,De)&&!Qe.hasOwnProperty(De)&&(it[De]=oe[De]);if(q&&q.defaultProps){var st=q.defaultProps;for(De in st)it[De]===void 0&&(it[De]=st[De])}if(Ue||gt){var tt=typeof q=="function"?q.displayName||q.name||"Unknown":q;Ue&&ht(it,tt),gt&&ft(it,tt)}return Ht(q,Ue,gt,Re,xe,Ee.current,it)}}var St=k.ReactCurrentOwner,er=k.ReactDebugCurrentFrame;function Xt(q){if(q){var oe=q._owner,pe=fe(q.type,q._source,oe?oe.type:null);er.setExtraStackFrame(pe)}else er.setExtraStackFrame(null)}var Ot;Ot=!1;function Bt(q){return typeof q=="object"&&q!==null&&q.$$typeof===e}function Tt(){{if(St.current){var q=m(St.current.type);if(q)return` Check the render method of \``+q+"`."}return""}}function vt(q){return""}var Dt={};function Lt(q){{var oe=Tt();if(!oe){var pe=typeof q=="string"?q:q.displayName||q.name;pe&&(oe=` -Check the top-level render call using <`+pe+">.")}return oe}}function bt(q,oe){{if(!q._store||q._store.validated||q.key!=null)return;q._store.validated=!0;var pe=Lt(oe);if(Dt[pe])return;Dt[pe]=!0;var xe="";q&&q._owner&&q._owner!==St.current&&(xe=" It was passed a child from "+m(q._owner.type)+"."),Xt(q),B('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',pe,xe),Xt(null)}}function $t(q,oe){{if(typeof q!="object")return;if(Le(q))for(var pe=0;pe",Ue=" Did you accidentally export a JSX literal instead of a component?"):st=typeof q,B("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",st,Ue)}var tt=Jt(q,oe,pe,Re,De);if(tt==null)return tt;if(it){var At=oe.children;if(At!==void 0)if(xe)if(Le(At)){for(var Rt=0;Rt0?"{key: someKey, "+Et.join(": ..., ")+": ...}":"{key: someKey}";if(!Ft[Mt+dt]){var _t=Et.length>0?"{"+Et.join(": ..., ")+": ...}":"{}";B(`A props object containing a "key" prop is being spread into JSX: +Check the top-level render call using <`+pe+">.")}return oe}}function bt(q,oe){{if(!q._store||q._store.validated||q.key!=null)return;q._store.validated=!0;var pe=Lt(oe);if(Dt[pe])return;Dt[pe]=!0;var xe="";q&&q._owner&&q._owner!==St.current&&(xe=" It was passed a child from "+m(q._owner.type)+"."),Xt(q),B('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',pe,xe),Xt(null)}}function $t(q,oe){{if(typeof q!="object")return;if(Le(q))for(var pe=0;pe",Ue=" Did you accidentally export a JSX literal instead of a component?"):st=typeof q,B("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",st,Ue)}var tt=Jt(q,oe,pe,Re,De);if(tt==null)return tt;if(it){var At=oe.children;if(At!==void 0)if(xe)if(Le(At)){for(var Rt=0;Rt0?"{key: someKey, "+Et.join(": ..., ")+": ...}":"{key: someKey}";if(!Ft[Mt+dt]){var _t=Et.length>0?"{"+Et.join(": ..., ")+": ...}":"{}";B(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: @@ -39,17 +39,17 @@ React keys must be passed directly to JSX without using spread: `),{docsPath:r,name:"InvalidAbiEncodingType"})}}class lP extends yt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` `),{docsPath:r,name:"InvalidAbiDecodingType"})}}class hP extends yt{constructor(e){super([`Value "${e}" is not a valid array.`].join(` `),{name:"InvalidArrayError"})}}class dP extends yt{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` -`),{name:"InvalidDefinitionTypeError"})}}class Qy extends yt{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}class ew extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}class tw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function $c(t,{dir:e,size:r=32}={}){return typeof t=="string"?Xo(t,{dir:e,size:r}):pP(t,{dir:e,size:r})}function Xo(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new ew({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function pP(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new ew({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie)throw new vP({givenSize:_n(t),maxSize:e})}function yf(t,e={}){const{signed:r}=e;e.size&&Ds(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<e.toString(16).padStart(2,"0"));function Dh(t,e={}){return typeof t=="number"||typeof t=="bigint"?Pr(t,e):typeof t=="string"?Oh(t,e):typeof t=="boolean"?rw(t,e):li(t,e)}function rw(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(Ds(r,{size:e.size}),$c(r,{size:e.size})):r}function li(t,e={}){let r="";for(let i=0;is||i=ao.zero&&t<=ao.nine)return t-ao.zero;if(t>=ao.A&&t<=ao.F)return t-(ao.A-10);if(t>=ao.a&&t<=ao.f)return t-(ao.a-10)}function co(t,e={}){let r=t;e.size&&(Ds(r,{size:e.size}),r=$c(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function SP(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Nh(t.outputLen),Nh(t.blockLen)}function Uc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function sw(t,e){jc(t);const r=e.outputLen;if(t.length>ow&Lh)}:{h:Number(t>>ow&Lh)|0,l:Number(t&Lh)|0}}function PP(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;it<>>32-r,IP=(t,e,r)=>e<>>32-r,CP=(t,e,r)=>e<>>64-r,TP=(t,e,r)=>t<>>64-r,qc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const RP=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),ng=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Os=(t,e)=>t<<32-e|t>>>e,aw=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,DP=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function cw(t){for(let e=0;ee.toString(16).padStart(2,"0"));function NP(t){jc(t);let e="";for(let r=0;rt().update(wf(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function BP(t){const e=(n,i)=>t(i).update(wf(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function $P(t=32){if(qc&&typeof qc.getRandomValues=="function")return qc.getRandomValues(new Uint8Array(t));if(qc&&typeof qc.randomBytes=="function")return qc.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const fw=[],lw=[],hw=[],FP=BigInt(0),xf=BigInt(1),jP=BigInt(2),UP=BigInt(7),qP=BigInt(256),zP=BigInt(113);for(let t=0,e=xf,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],fw.push(2*(5*n+r)),lw.push((t+1)*(t+2)/2%64);let i=FP;for(let s=0;s<7;s++)e=(e<>UP)*zP)%qP,e&jP&&(i^=xf<<(xf<r>32?CP(t,e,r):MP(t,e,r),pw=(t,e,r)=>r>32?TP(t,e,r):IP(t,e,r);function gw(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,u=(o+2)%10,l=r[u],d=r[u+1],g=dw(l,d,1)^r[a],y=pw(l,d,1)^r[a+1];for(let A=0;A<50;A+=10)t[o+A]^=g,t[o+A+1]^=y}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=lw[o],u=dw(i,s,a),l=pw(i,s,a),d=fw[o];i=t[d],s=t[d+1],t[d]=u,t[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=HP[n],t[1]^=WP[n]}r.fill(0)}class _f extends ig{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Nh(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=RP(this.state)}keccak(){aw||cw(this.state32),gw(this.state32,this.rounds),aw||cw(this.state32),this.posOut=0,this.pos=0}update(e){Uc(this);const{blockLen:r,state:n}=this;e=wf(e);const i=e.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Nh(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(sw(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new _f(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Zo=(t,e,r)=>uw(()=>new _f(e,t,r)),KP=Zo(6,144,224/8),VP=Zo(6,136,256/8),GP=Zo(6,104,384/8),YP=Zo(6,72,512/8),JP=Zo(1,144,224/8),mw=Zo(1,136,256/8),XP=Zo(1,104,384/8),ZP=Zo(1,72,512/8),vw=(t,e,r)=>BP((n={})=>new _f(e,t,n.dkLen===void 0?r:n.dkLen,!0)),QP=vw(31,168,128/8),eM=vw(31,136,256/8),tM=Object.freeze(Object.defineProperty({__proto__:null,Keccak:_f,keccakP:gw,keccak_224:JP,keccak_256:mw,keccak_384:XP,keccak_512:ZP,sha3_224:KP,sha3_256:VP,sha3_384:GP,sha3_512:YP,shake128:QP,shake256:eM},Symbol.toStringTag,{value:"Module"}));function Ef(t,e){const r=e||"hex",n=mw(Jo(t,{strict:!1})?rg(t):t);return r==="bytes"?n:Dh(n)}const rM=t=>Ef(rg(t));function nM(t){return rM(t)}function iM(t){let e=!0,r="",n=0,i="",s=!1;for(let o=0;o{const e=typeof t=="string"?t:tP(t);return iM(e)};function bw(t){return nM(sM(t))}const oM=bw;class zc extends yt{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class kh extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const sg=new kh(8192);function Sf(t,e){if(sg.has(`${t}.${e}`))return sg.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=Ef(iw(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return sg.set(`${t}.${e}`,s),s}function og(t,e){if(!uo(t,{strict:!1}))throw new zc({address:t});return Sf(t,e)}const aM=/^0x[a-fA-F0-9]{40}$/,ag=new kh(8192);function uo(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(ag.has(n))return ag.get(n);const i=aM.test(t)?t.toLowerCase()===t?!0:r?Sf(t)===t:!0:!1;return ag.set(n,i),i}function Hc(t){return typeof t[0]=="string"?Bh(t):cM(t)}function cM(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function Bh(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}function $h(t,e,r,{strict:n}={}){return Jo(t,{strict:!1})?uM(t,e,r,{strict:n}):xw(t,e,r,{strict:n})}function yw(t,e){if(typeof e=="number"&&e>0&&e>_n(t)-1)throw new Qy({offset:e,position:"start",size:_n(t)})}function ww(t,e,r){if(typeof e=="number"&&typeof r=="number"&&_n(t)!==r-e)throw new Qy({offset:r,position:"end",size:_n(t)})}function xw(t,e,r,{strict:n}={}){yw(t,e);const i=t.slice(e,r);return n&&ww(i,e,r),i}function uM(t,e,r,{strict:n}={}){yw(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&ww(i,e,r),i}function _w(t,e){if(t.length!==e.length)throw new aP({expectedLength:t.length,givenLength:e.length});const r=fM({params:t,values:e}),n=ug(r);return n.length===0?"0x":n}function fM({params:t,values:e}){const r=[];for(let n=0;n0?Hc([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:Hc(s.map(({encoded:o})=>o))}}function dM(t,{param:e}){const[,r]=e.type.split("bytes"),n=_n(t);if(!r){let i=t;return n%32!==0&&(i=Xo(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:Hc([Xo(Pr(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new oP({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:Xo(t,{dir:"right"})}}function pM(t){if(typeof t!="boolean")throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Xo(rw(t))}}function gM(t,{signed:e}){return{dynamic:!1,encoded:Pr(t,{size:32,signed:e})}}function mM(t){const e=Oh(t),r=Math.ceil(_n(e)/32),n=[];for(let i=0;ii))}}function fg(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const lg=t=>$h(bw(t),0,4);function Ew(t){const{abi:e,args:r=[],name:n}=t,i=Jo(n,{strict:!1}),s=e.filter(a=>i?a.type==="function"?lg(a)===n:a.type==="event"?oM(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((l,d)=>{const g="inputs"in a&&a.inputs[d];return g?hg(l,g):!1})){if(o&&"inputs"in o&&o.inputs){const l=Sw(a.inputs,o.inputs,r);if(l)throw new cP({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||s[0]}function hg(t,e){const r=typeof t,n=e.type;switch(n){case"address":return uo(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>hg(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>hg(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Sw(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return Sw(i.components,s.components,r[n]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?uo(r[n],{strict:!1}):o.includes("address")&&o.includes("bytes")?uo(r[n],{strict:!1}):!1)return o}}function fo(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const Aw="/docs/contract/encodeFunctionData";function bM(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=Ew({abi:e,args:r,name:n});if(!s)throw new Zy(n,{docsPath:Aw});i=s}if(i.type!=="function")throw new Zy(void 0,{docsPath:Aw});return{abi:[i],functionName:lg(Bc(i))}}function yM(t){const{args:e}=t,{abi:r,functionName:n}=(()=>{var a;return t.abi.length===1&&((a=t.functionName)!=null&&a.startsWith("0x"))?t:bM(t)})(),i=r[0],s=n,o="inputs"in i&&i.inputs?_w(i.inputs,e??[]):void 0;return Bh([s,o??"0x"])}const wM={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},xM={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},_M={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Pw extends yt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class EM extends yt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class SM extends yt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const AM={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new SM({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new EM({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Pw({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Pw({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function dg(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(AM);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function PM(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return yf(r,e)}function MM(t,e={}){let r=t;if(typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r)),r.length>1||r[0]>1)throw new mP(r);return!!r[0]}function lo(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return Fc(r,e)}function IM(t,e={}){let r=t;return typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r,{dir:"right"})),new TextDecoder().decode(r)}function CM(t,e){const r=typeof e=="string"?co(e):e,n=dg(r);if(_n(r)===0&&t.length>0)throw new eg;if(_n(e)&&_n(e)<32)throw new iP({data:typeof e=="string"?e:li(e),params:t,size:_n(e)});let i=0;const s=[];for(let o=0;o48?PM(i,{signed:r}):lo(i,{signed:r}),32]}function LM(t,e,{staticPosition:r}){const n=e.components.length===0||e.components.some(({name:o})=>!o),i=n?[]:{};let s=0;if(Af(e)){const o=lo(t.readBytes(pg)),a=r+o;for(let u=0;uo.type==="error"&&n===lg(Bc(o)));if(!s)throw new Xy(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?CM(s.inputs,$h(r,4)):void 0,errorName:s.name}}const Kc=(t,e,r)=>JSON.stringify(t,(n,i)=>typeof i=="bigint"?i.toString():i,r);function Iw({abiItem:t,args:e,includeFunctionName:r=!0,includeName:n=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${r?t.name:""}(${t.inputs.map((i,s)=>`${n&&i.name?`${i.name}: `:""}${typeof e[s]=="object"?Kc(e[s]):e[s]}`).join(", ")})`}const $M={gwei:9,wei:18},FM={ether:-9,wei:9};function Cw(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}function Tw(t,e="wei"){return Cw(t,$M[e])}function hs(t,e="wei"){return Cw(t,FM[e])}class jM extends yt{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class UM extends yt{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Fh(t){const e=Object.entries(t).map(([n,i])=>i===void 0||i===!1?null:[n,i]).filter(Boolean),r=e.reduce((n,[i])=>Math.max(n,i.length),0);return e.map(([n,i])=>` ${`${n}:`.padEnd(r+1)} ${i}`).join(` +`),{name:"InvalidDefinitionTypeError"})}}class Qy extends yt{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}class ew extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}class tw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function $c(t,{dir:e,size:r=32}={}){return typeof t=="string"?Xo(t,{dir:e,size:r}):pP(t,{dir:e,size:r})}function Xo(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new ew({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function pP(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new ew({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie)throw new vP({givenSize:_n(t),maxSize:e})}function yf(t,e={}){const{signed:r}=e;e.size&&Ds(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<e.toString(16).padStart(2,"0"));function Dh(t,e={}){return typeof t=="number"||typeof t=="bigint"?Pr(t,e):typeof t=="string"?Oh(t,e):typeof t=="boolean"?rw(t,e):li(t,e)}function rw(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(Ds(r,{size:e.size}),$c(r,{size:e.size})):r}function li(t,e={}){let r="";for(let i=0;is||i=ao.zero&&t<=ao.nine)return t-ao.zero;if(t>=ao.A&&t<=ao.F)return t-(ao.A-10);if(t>=ao.a&&t<=ao.f)return t-(ao.a-10)}function co(t,e={}){let r=t;e.size&&(Ds(r,{size:e.size}),r=$c(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function SP(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Nh(t.outputLen),Nh(t.blockLen)}function Uc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function sw(t,e){jc(t);const r=e.outputLen;if(t.length>ow&Lh)}:{h:Number(t>>ow&Lh)|0,l:Number(t&Lh)|0}}function PP(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;it<>>32-r,IP=(t,e,r)=>e<>>32-r,CP=(t,e,r)=>e<>>64-r,TP=(t,e,r)=>t<>>64-r,qc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const RP=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),ng=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Os=(t,e)=>t<<32-e|t>>>e,aw=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,DP=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function cw(t){for(let e=0;ee.toString(16).padStart(2,"0"));function NP(t){jc(t);let e="";for(let r=0;rt().update(wf(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function BP(t){const e=(n,i)=>t(i).update(wf(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function $P(t=32){if(qc&&typeof qc.getRandomValues=="function")return qc.getRandomValues(new Uint8Array(t));if(qc&&typeof qc.randomBytes=="function")return qc.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const fw=[],lw=[],hw=[],FP=BigInt(0),xf=BigInt(1),jP=BigInt(2),UP=BigInt(7),qP=BigInt(256),zP=BigInt(113);for(let t=0,e=xf,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],fw.push(2*(5*n+r)),lw.push((t+1)*(t+2)/2%64);let i=FP;for(let s=0;s<7;s++)e=(e<>UP)*zP)%qP,e&jP&&(i^=xf<<(xf<r>32?CP(t,e,r):MP(t,e,r),pw=(t,e,r)=>r>32?TP(t,e,r):IP(t,e,r);function gw(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,u=(o+2)%10,l=r[u],d=r[u+1],p=dw(l,d,1)^r[a],y=pw(l,d,1)^r[a+1];for(let A=0;A<50;A+=10)t[o+A]^=p,t[o+A+1]^=y}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=lw[o],u=dw(i,s,a),l=pw(i,s,a),d=fw[o];i=t[d],s=t[d+1],t[d]=u,t[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=HP[n],t[1]^=WP[n]}r.fill(0)}class _f extends ig{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Nh(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=RP(this.state)}keccak(){aw||cw(this.state32),gw(this.state32,this.rounds),aw||cw(this.state32),this.posOut=0,this.pos=0}update(e){Uc(this);const{blockLen:r,state:n}=this;e=wf(e);const i=e.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Nh(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(sw(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new _f(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Zo=(t,e,r)=>uw(()=>new _f(e,t,r)),KP=Zo(6,144,224/8),VP=Zo(6,136,256/8),GP=Zo(6,104,384/8),YP=Zo(6,72,512/8),JP=Zo(1,144,224/8),mw=Zo(1,136,256/8),XP=Zo(1,104,384/8),ZP=Zo(1,72,512/8),vw=(t,e,r)=>BP((n={})=>new _f(e,t,n.dkLen===void 0?r:n.dkLen,!0)),QP=vw(31,168,128/8),eM=vw(31,136,256/8),tM=Object.freeze(Object.defineProperty({__proto__:null,Keccak:_f,keccakP:gw,keccak_224:JP,keccak_256:mw,keccak_384:XP,keccak_512:ZP,sha3_224:KP,sha3_256:VP,sha3_384:GP,sha3_512:YP,shake128:QP,shake256:eM},Symbol.toStringTag,{value:"Module"}));function Ef(t,e){const r=e||"hex",n=mw(Jo(t,{strict:!1})?rg(t):t);return r==="bytes"?n:Dh(n)}const rM=t=>Ef(rg(t));function nM(t){return rM(t)}function iM(t){let e=!0,r="",n=0,i="",s=!1;for(let o=0;o{const e=typeof t=="string"?t:tP(t);return iM(e)};function bw(t){return nM(sM(t))}const oM=bw;class zc extends yt{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class kh extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const sg=new kh(8192);function Sf(t,e){if(sg.has(`${t}.${e}`))return sg.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=Ef(iw(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return sg.set(`${t}.${e}`,s),s}function og(t,e){if(!uo(t,{strict:!1}))throw new zc({address:t});return Sf(t,e)}const aM=/^0x[a-fA-F0-9]{40}$/,ag=new kh(8192);function uo(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(ag.has(n))return ag.get(n);const i=aM.test(t)?t.toLowerCase()===t?!0:r?Sf(t)===t:!0:!1;return ag.set(n,i),i}function Hc(t){return typeof t[0]=="string"?Bh(t):cM(t)}function cM(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function Bh(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}function $h(t,e,r,{strict:n}={}){return Jo(t,{strict:!1})?uM(t,e,r,{strict:n}):xw(t,e,r,{strict:n})}function yw(t,e){if(typeof e=="number"&&e>0&&e>_n(t)-1)throw new Qy({offset:e,position:"start",size:_n(t)})}function ww(t,e,r){if(typeof e=="number"&&typeof r=="number"&&_n(t)!==r-e)throw new Qy({offset:r,position:"end",size:_n(t)})}function xw(t,e,r,{strict:n}={}){yw(t,e);const i=t.slice(e,r);return n&&ww(i,e,r),i}function uM(t,e,r,{strict:n}={}){yw(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&ww(i,e,r),i}function _w(t,e){if(t.length!==e.length)throw new aP({expectedLength:t.length,givenLength:e.length});const r=fM({params:t,values:e}),n=ug(r);return n.length===0?"0x":n}function fM({params:t,values:e}){const r=[];for(let n=0;n0?Hc([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:Hc(s.map(({encoded:o})=>o))}}function dM(t,{param:e}){const[,r]=e.type.split("bytes"),n=_n(t);if(!r){let i=t;return n%32!==0&&(i=Xo(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:Hc([Xo(Pr(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new oP({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:Xo(t,{dir:"right"})}}function pM(t){if(typeof t!="boolean")throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Xo(rw(t))}}function gM(t,{signed:e}){return{dynamic:!1,encoded:Pr(t,{size:32,signed:e})}}function mM(t){const e=Oh(t),r=Math.ceil(_n(e)/32),n=[];for(let i=0;ii))}}function fg(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const lg=t=>$h(bw(t),0,4);function Ew(t){const{abi:e,args:r=[],name:n}=t,i=Jo(n,{strict:!1}),s=e.filter(a=>i?a.type==="function"?lg(a)===n:a.type==="event"?oM(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((l,d)=>{const p="inputs"in a&&a.inputs[d];return p?hg(l,p):!1})){if(o&&"inputs"in o&&o.inputs){const l=Sw(a.inputs,o.inputs,r);if(l)throw new cP({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||s[0]}function hg(t,e){const r=typeof t,n=e.type;switch(n){case"address":return uo(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>hg(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>hg(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Sw(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return Sw(i.components,s.components,r[n]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?uo(r[n],{strict:!1}):o.includes("address")&&o.includes("bytes")?uo(r[n],{strict:!1}):!1)return o}}function fo(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const Aw="/docs/contract/encodeFunctionData";function bM(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=Ew({abi:e,args:r,name:n});if(!s)throw new Zy(n,{docsPath:Aw});i=s}if(i.type!=="function")throw new Zy(void 0,{docsPath:Aw});return{abi:[i],functionName:lg(Bc(i))}}function yM(t){const{args:e}=t,{abi:r,functionName:n}=(()=>{var a;return t.abi.length===1&&((a=t.functionName)!=null&&a.startsWith("0x"))?t:bM(t)})(),i=r[0],s=n,o="inputs"in i&&i.inputs?_w(i.inputs,e??[]):void 0;return Bh([s,o??"0x"])}const wM={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},xM={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},_M={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Pw extends yt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class EM extends yt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class SM extends yt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const AM={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new SM({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new EM({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Pw({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Pw({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function dg(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(AM);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function PM(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return yf(r,e)}function MM(t,e={}){let r=t;if(typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r)),r.length>1||r[0]>1)throw new mP(r);return!!r[0]}function lo(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return Fc(r,e)}function IM(t,e={}){let r=t;return typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r,{dir:"right"})),new TextDecoder().decode(r)}function CM(t,e){const r=typeof e=="string"?co(e):e,n=dg(r);if(_n(r)===0&&t.length>0)throw new eg;if(_n(e)&&_n(e)<32)throw new iP({data:typeof e=="string"?e:li(e),params:t,size:_n(e)});let i=0;const s=[];for(let o=0;o48?PM(i,{signed:r}):lo(i,{signed:r}),32]}function LM(t,e,{staticPosition:r}){const n=e.components.length===0||e.components.some(({name:o})=>!o),i=n?[]:{};let s=0;if(Af(e)){const o=lo(t.readBytes(pg)),a=r+o;for(let u=0;uo.type==="error"&&n===lg(Bc(o)));if(!s)throw new Xy(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?CM(s.inputs,$h(r,4)):void 0,errorName:s.name}}const Kc=(t,e,r)=>JSON.stringify(t,(n,i)=>typeof i=="bigint"?i.toString():i,r);function Iw({abiItem:t,args:e,includeFunctionName:r=!0,includeName:n=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${r?t.name:""}(${t.inputs.map((i,s)=>`${n&&i.name?`${i.name}: `:""}${typeof e[s]=="object"?Kc(e[s]):e[s]}`).join(", ")})`}const $M={gwei:9,wei:18},FM={ether:-9,wei:9};function Cw(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}function Tw(t,e="wei"){return Cw(t,$M[e])}function hs(t,e="wei"){return Cw(t,FM[e])}class jM extends yt{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class UM extends yt{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Fh(t){const e=Object.entries(t).map(([n,i])=>i===void 0||i===!1?null:[n,i]).filter(Boolean),r=e.reduce((n,[i])=>Math.max(n,i.length),0);return e.map(([n,i])=>` ${`${n}:`.padEnd(r+1)} ${i}`).join(` `)}class qM extends yt{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(` -`),{name:"FeeConflictError"})}}class zM extends yt{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Fh(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class HM extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:g,value:y}){var P;const A=Fh({chain:i&&`${i==null?void 0:i.name} (id: ${i==null?void 0:i.id})`,from:r==null?void 0:r.address,to:g,value:typeof y<"u"&&`${Tw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",A].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const WM=t=>t,Rw=t=>t;class KM extends yt{constructor(e,{abi:r,args:n,contractAddress:i,docsPath:s,functionName:o,sender:a}){const u=Ew({abi:r,args:n,name:o}),l=u?Iw({abiItem:u,args:n,includeFunctionName:!1,includeName:!1}):void 0,d=u?Bc(u,{includeName:!0}):void 0,g=Fh({address:i&&WM(i),function:d,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:s,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],g&&"Contract Call:",g].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=e,this.contractAddress=i,this.functionName=o,this.sender=a}}class VM extends yt{constructor({abi:e,data:r,functionName:n,message:i}){let s,o,a,u;if(r&&r!=="0x")try{o=BM({abi:e,data:r});const{abiItem:d,errorName:g,args:y}=o;if(g==="Error")u=y[0];else if(g==="Panic"){const[A]=y;u=wM[A]}else{const A=d?Bc(d,{includeName:!0}):void 0,P=d&&y?Iw({abiItem:d,args:y,includeFunctionName:!1,includeName:!1}):void 0;a=[A?`Error: ${A}`:"",P&&P!=="()"?` ${[...Array((g==null?void 0:g.length)??0).keys()].map(()=>" ").join("")}${P}`:""]}}catch(d){s=d}else i&&(u=i);let l;s instanceof Xy&&(l=s.signature,a=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(u&&u!=="execution reverted"||l?[`The contract function "${n}" reverted with the following ${l?"signature":"reason"}:`,u||l].join(` +`),{name:"FeeConflictError"})}}class zM extends yt{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Fh(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class HM extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var P;const A=Fh({chain:i&&`${i==null?void 0:i.name} (id: ${i==null?void 0:i.id})`,from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Tw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",A].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const WM=t=>t,Rw=t=>t;class KM extends yt{constructor(e,{abi:r,args:n,contractAddress:i,docsPath:s,functionName:o,sender:a}){const u=Ew({abi:r,args:n,name:o}),l=u?Iw({abiItem:u,args:n,includeFunctionName:!1,includeName:!1}):void 0,d=u?Bc(u,{includeName:!0}):void 0,p=Fh({address:i&&WM(i),function:d,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:s,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],p&&"Contract Call:",p].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=e,this.contractAddress=i,this.functionName=o,this.sender=a}}class VM extends yt{constructor({abi:e,data:r,functionName:n,message:i}){let s,o,a,u;if(r&&r!=="0x")try{o=BM({abi:e,data:r});const{abiItem:d,errorName:p,args:y}=o;if(p==="Error")u=y[0];else if(p==="Panic"){const[A]=y;u=wM[A]}else{const A=d?Bc(d,{includeName:!0}):void 0,P=d&&y?Iw({abiItem:d,args:y,includeFunctionName:!1,includeName:!1}):void 0;a=[A?`Error: ${A}`:"",P&&P!=="()"?` ${[...Array((p==null?void 0:p.length)??0).keys()].map(()=>" ").join("")}${P}`:""]}}catch(d){s=d}else i&&(u=i);let l;s instanceof Xy&&(l=s.signature,a=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(u&&u!=="execution reverted"||l?[`The contract function "${n}" reverted with the following ${l?"signature":"reason"}:`,u||l].join(` `):`The contract function "${n}" reverted.`,{cause:s,metaMessages:a,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.reason=u,this.signature=l}}class GM extends yt{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class YM extends yt{constructor({data:e,message:r}){super(r||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}class Dw extends yt{constructor({body:e,cause:r,details:n,headers:i,status:s,url:o}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${Rw(o)}`,e&&`Request body: ${Kc(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=i,this.status=s,this.url=o}}class JM extends yt{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${Rw(n)}`,`Request body: ${Kc(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code}}const XM=-1;class hi extends yt{constructor(e,{code:r,docsPath:n,metaMessages:i,name:s,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:i||(e==null?void 0:e.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||e.name,this.code=e instanceof JM?e.code:r??XM}}class Vc extends hi{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class Pf extends hi{constructor(e){super(e,{code:Pf.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Pf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Mf extends hi{constructor(e){super(e,{code:Mf.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Mf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class If extends hi{constructor(e,{method:r}={}){super(e,{code:If.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(If,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Cf extends hi{constructor(e){super(e,{code:Cf.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` `)})}}Object.defineProperty(Cf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Ba extends hi{constructor(e){super(e,{code:Ba.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Ba,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Tf extends hi{constructor(e){super(e,{code:Tf.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` -`)})}}Object.defineProperty(Tf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Rf extends hi{constructor(e){super(e,{code:Rf.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Rf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Df extends hi{constructor(e){super(e,{code:Df.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Df,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Of extends hi{constructor(e){super(e,{code:Of.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Of,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Nf extends hi{constructor(e,{method:r}={}){super(e,{code:Nf.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not implemented.`})}}Object.defineProperty(Nf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Gc extends hi{constructor(e){super(e,{code:Gc.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Gc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Lf extends hi{constructor(e){super(e,{code:Lf.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Lf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Yc extends Vc{constructor(e){super(e,{code:Yc.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Yc,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class kf extends Vc{constructor(e){super(e,{code:kf.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(kf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Bf extends Vc{constructor(e,{method:r}={}){super(e,{code:Bf.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(Bf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class $f extends Vc{constructor(e){super(e,{code:$f.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty($f,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Ff extends Vc{constructor(e){super(e,{code:Ff.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Ff,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class jf extends Vc{constructor(e){super(e,{code:jf.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(jf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ZM extends hi{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const QM=3;function eI(t,{abi:e,address:r,args:n,docsPath:i,functionName:s,sender:o}){const{code:a,data:u,message:l,shortMessage:d}=t instanceof YM?t:t instanceof yt?t.walk(y=>"data"in y)||t.walk():{},g=t instanceof eg?new GM({functionName:s}):[QM,Ba.code].includes(a)&&(u||l||d)?new VM({abi:e,data:typeof u=="object"?u.data:u,functionName:s,message:d??l}):t;return new KM(g,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:o})}function tI(t){const e=Ef(`0x${t.substring(4)}`).substring(26);return Sf(`0x${e}`)}async function rI({hash:t,signature:e}){const r=Jo(t)?t:Dh(t),{secp256k1:n}=await Promise.resolve().then(()=>UC);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:d,v:g,yParity:y}=e,A=Number(y??g),P=Ow(A);return new n.Signature(yf(l),yf(d)).addRecoveryBit(P)}const o=Jo(e)?e:Dh(e),a=Fc(`0x${o.slice(130)}`),u=Ow(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Ow(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function nI({hash:t,signature:e}){return tI(await rI({hash:t,signature:e}))}function iI(t,e="hex"){const r=Nw(t),n=dg(new Uint8Array(r.length));return r.encode(n),e==="hex"?li(n.bytes):n.bytes}function Nw(t){return Array.isArray(t)?sI(t.map(e=>Nw(e))):oI(t)}function sI(t){const e=t.reduce((i,s)=>i+s.length,0),r=Lw(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function oI(t){const e=typeof t=="string"?co(t):t,r=Lw(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function Lw(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new yt("Length is too large.")}function aI(t){const{chainId:e,contractAddress:r,nonce:n,to:i}=t,s=Ef(Bh(["0x05",iI([e?Pr(e):"0x",r,n?Pr(n):"0x"])]));return i==="bytes"?co(s):s}async function kw(t){const{authorization:e,signature:r}=t;return nI({hash:aI(e),signature:r??e})}class cI extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:g,value:y}){var P;const A=Fh({from:r==null?void 0:r.address,to:g,value:typeof y<"u"&&`${Tw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",A].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class Jc extends yt{constructor({cause:e,message:r}={}){var i;const n=(i=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(Jc,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Jc,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class jh extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(jh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class gg extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(gg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class mg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(mg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class vg extends yt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` +`)})}}Object.defineProperty(Tf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Rf extends hi{constructor(e){super(e,{code:Rf.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Rf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Df extends hi{constructor(e){super(e,{code:Df.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Df,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Of extends hi{constructor(e){super(e,{code:Of.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Of,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Nf extends hi{constructor(e,{method:r}={}){super(e,{code:Nf.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not implemented.`})}}Object.defineProperty(Nf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Gc extends hi{constructor(e){super(e,{code:Gc.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Gc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Lf extends hi{constructor(e){super(e,{code:Lf.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Lf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Yc extends Vc{constructor(e){super(e,{code:Yc.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Yc,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class kf extends Vc{constructor(e){super(e,{code:kf.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(kf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Bf extends Vc{constructor(e,{method:r}={}){super(e,{code:Bf.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(Bf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class $f extends Vc{constructor(e){super(e,{code:$f.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty($f,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Ff extends Vc{constructor(e){super(e,{code:Ff.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Ff,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class jf extends Vc{constructor(e){super(e,{code:jf.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(jf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ZM extends hi{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const QM=3;function eI(t,{abi:e,address:r,args:n,docsPath:i,functionName:s,sender:o}){const{code:a,data:u,message:l,shortMessage:d}=t instanceof YM?t:t instanceof yt?t.walk(y=>"data"in y)||t.walk():{},p=t instanceof eg?new GM({functionName:s}):[QM,Ba.code].includes(a)&&(u||l||d)?new VM({abi:e,data:typeof u=="object"?u.data:u,functionName:s,message:d??l}):t;return new KM(p,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:o})}function tI(t){const e=Ef(`0x${t.substring(4)}`).substring(26);return Sf(`0x${e}`)}async function rI({hash:t,signature:e}){const r=Jo(t)?t:Dh(t),{secp256k1:n}=await Promise.resolve().then(()=>UC);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:d,v:p,yParity:y}=e,A=Number(y??p),P=Ow(A);return new n.Signature(yf(l),yf(d)).addRecoveryBit(P)}const o=Jo(e)?e:Dh(e),a=Fc(`0x${o.slice(130)}`),u=Ow(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Ow(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function nI({hash:t,signature:e}){return tI(await rI({hash:t,signature:e}))}function iI(t,e="hex"){const r=Nw(t),n=dg(new Uint8Array(r.length));return r.encode(n),e==="hex"?li(n.bytes):n.bytes}function Nw(t){return Array.isArray(t)?sI(t.map(e=>Nw(e))):oI(t)}function sI(t){const e=t.reduce((i,s)=>i+s.length,0),r=Lw(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function oI(t){const e=typeof t=="string"?co(t):t,r=Lw(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function Lw(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new yt("Length is too large.")}function aI(t){const{chainId:e,contractAddress:r,nonce:n,to:i}=t,s=Ef(Bh(["0x05",iI([e?Pr(e):"0x",r,n?Pr(n):"0x"])]));return i==="bytes"?co(s):s}async function kw(t){const{authorization:e,signature:r}=t;return nI({hash:aI(e),signature:r??e})}class cI extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var P;const A=Fh({from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Tw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",A].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class Jc extends yt{constructor({cause:e,message:r}={}){var i;const n=(i=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(Jc,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Jc,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class jh extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(jh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class gg extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(gg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class mg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(mg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class vg extends yt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` `),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(vg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class bg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(bg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class yg extends yt{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` `),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(yg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class wg extends yt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(wg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class xg extends yt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(xg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class _g extends yt{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(_g,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Uh extends yt{constructor({cause:e,maxPriorityFeePerGas:r,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${r?` = ${hs(r)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${hs(n)} gwei`:""}).`].join(` -`),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(Uh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Eg extends yt{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function Bw(t,e){const r=(t.details||"").toLowerCase(),n=t instanceof yt?t.walk(i=>(i==null?void 0:i.code)===Jc.code):t;return n instanceof yt?new Jc({cause:t,message:n.details}):Jc.nodeMessage.test(r)?new Jc({cause:t,message:t.details}):jh.nodeMessage.test(r)?new jh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):gg.nodeMessage.test(r)?new gg({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):mg.nodeMessage.test(r)?new mg({cause:t,nonce:e==null?void 0:e.nonce}):vg.nodeMessage.test(r)?new vg({cause:t,nonce:e==null?void 0:e.nonce}):bg.nodeMessage.test(r)?new bg({cause:t,nonce:e==null?void 0:e.nonce}):yg.nodeMessage.test(r)?new yg({cause:t}):wg.nodeMessage.test(r)?new wg({cause:t,gas:e==null?void 0:e.gas}):xg.nodeMessage.test(r)?new xg({cause:t,gas:e==null?void 0:e.gas}):_g.nodeMessage.test(r)?new _g({cause:t}):Uh.nodeMessage.test(r)?new Uh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new Eg({cause:t})}function uI(t,{docsPath:e,...r}){const n=(()=>{const i=Bw(t,r);return i instanceof Eg?t:i})();return new cI(n,{docsPath:e,...r})}function $w(t,{format:e}){if(!e)return{};const r={};function n(s){const o=Object.keys(s);for(const a of o)a in t&&(r[a]=t[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}const i=e(t||{});return n(i),r}const fI={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Sg(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=lI(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(r=>li(r)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=Pr(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=Pr(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=Pr(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=Pr(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=Pr(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=Pr(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=fI[t.type]),typeof t.value<"u"&&(e.value=Pr(t.value)),e}function lI(t){return t.map(e=>({address:e.contractAddress,r:e.r,s:e.s,chainId:Pr(e.chainId),nonce:Pr(e.nonce),...typeof e.yParity<"u"?{yParity:Pr(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:Pr(e.v)}:{}}))}function Fw(t){if(!(!t||t.length===0))return t.reduce((e,{slot:r,value:n})=>{if(r.length!==66)throw new tw({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new tw({size:n.length,targetSize:66,type:"hex"});return e[r]=n,e},{})}function hI(t){const{balance:e,nonce:r,state:n,stateDiff:i,code:s}=t,o={};if(s!==void 0&&(o.code=s),e!==void 0&&(o.balance=Pr(e)),r!==void 0&&(o.nonce=Pr(r)),n!==void 0&&(o.state=Fw(n)),i!==void 0){if(o.state)throw new UM;o.stateDiff=Fw(i)}return o}function dI(t){if(!t)return;const e={};for(const{address:r,...n}of t){if(!uo(r,{strict:!1}))throw new zc({address:r});if(e[r])throw new jM({address:r});e[r]=hI(n)}return e}const pI=2n**256n-1n;function qh(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?fo(e):void 0;if(o&&!uo(o.address))throw new zc({address:o.address});if(s&&!uo(s))throw new zc({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new qM;if(n&&n>pI)throw new jh({maxFeePerGas:n});if(i&&n&&i>n)throw new Uh({maxFeePerGas:n,maxPriorityFeePerGas:i})}class gI extends yt{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Ag extends yt{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class mI extends yt{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${hs(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class vI extends yt{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}const bI={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function yI(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?Fc(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?Fc(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?bI[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=wI(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function wI(t){return t.map(e=>({contractAddress:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function xI(t){const e=(t.transactions??[]).map(r=>typeof r=="string"?r:yI(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function zh(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){var d,g,y;const s=n??"latest",o=i??!1,a=r!==void 0?Pr(r):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,o]},{dedupe:!0}):u=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]},{dedupe:!!a}),!u)throw new vI({blockHash:e,blockNumber:r});return(((y=(g=(d=t.chain)==null?void 0:d.formatters)==null?void 0:g.block)==null?void 0:y.format)||xI)(u)}async function jw(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function _I(t,e){var s,o;const{block:r,chain:n=t.chain,request:i}=e||{};try{const a=((s=n==null?void 0:n.fees)==null?void 0:s.maxPriorityFeePerGas)??((o=n==null?void 0:n.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=r||await fi(t,zh,"getBlock")({}),d=await a({block:l,client:t,request:i});if(d===null)throw new Error;return d}if(typeof a<"u")return a;const u=await t.request({method:"eth_maxPriorityFeePerGas"});return yf(u)}catch{const[a,u]=await Promise.all([r?Promise.resolve(r):fi(t,zh,"getBlock")({}),fi(t,jw,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new Ag;const l=u-a.baseFeePerGas;return l<0n?0n:l}}async function Uw(t,e){var y,A;const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>{var P,N;return typeof((P=n==null?void 0:n.fees)==null?void 0:P.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):((N=n==null?void 0:n.fees)==null?void 0:N.baseFeeMultiplier)??1.2})();if(o<1)throw new gI;const u=10**(((y=o.toString().split(".")[1])==null?void 0:y.length)??0),l=P=>P*BigInt(Math.ceil(o*u))/BigInt(u),d=r||await fi(t,zh,"getBlock")({});if(typeof((A=n==null?void 0:n.fees)==null?void 0:A.estimateFeesPerGas)=="function"){const P=await n.fees.estimateFeesPerGas({block:r,client:t,multiply:l,request:i,type:s});if(P!==null)return P}if(s==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new Ag;const P=typeof(i==null?void 0:i.maxPriorityFeePerGas)=="bigint"?i.maxPriorityFeePerGas:await _I(t,{block:d,chain:n,request:i}),N=l(d.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??N+P,maxPriorityFeePerGas:P}}return{gasPrice:(i==null?void 0:i.gasPrice)??l(await fi(t,jw,"getGasPrice")({}))}}async function EI(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,n?Pr(n):r]},{dedupe:!!n});return Fc(i)}function qw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(s=>co(s)):t.blobs,i=[];for(const s of n)i.push(Uint8Array.from(e.blobToKzgCommitment(s)));return r==="bytes"?i:i.map(s=>li(s))}function zw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>co(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>co(o)):t.commitments,s=[];for(let o=0;oli(o))}function SI(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),u=n?4:0,l=n?0:4;t.setUint32(e+u,o,n),t.setUint32(e+l,a,n)}const AI=(t,e,r)=>t&e^~t&r,PI=(t,e,r)=>t&e^t&r^e&r;class MI extends ig{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ng(this.buffer)}update(e){Uc(this);const{view:r,buffer:n,blockLen:i}=this;e=wf(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let g=o;gd.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g>>3,N=Os(A,17)^Os(A,19)^A>>>10;ea[g]=N+ea[g-7]+P+ea[g-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:u,G:l,H:d}=this;for(let g=0;g<64;g++){const y=Os(a,6)^Os(a,11)^Os(a,25),A=d+y+AI(a,u,l)+II[g]+ea[g]|0,N=(Os(n,2)^Os(n,13)^Os(n,22))+PI(n,i,s)|0;d=l,l=u,u=a,a=o+A|0,o=s,s=i,i=n,n=A+N|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(n,i,s,o,a,u,l,d)}roundClean(){ea.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Pg=uw(()=>new CI);function TI(t,e){return Pg(Jo(t,{strict:!1})?rg(t):t)}function RI(t){const{commitment:e,version:r=1}=t,n=t.to??(typeof e=="string"?"hex":"bytes"),i=TI(e);return i.set([r],0),n==="bytes"?i:li(i)}function DI(t){const{commitments:e,version:r}=t,n=t.to??(typeof e[0]=="string"?"hex":"bytes"),i=[];for(const s of e)i.push(RI({commitment:s,to:n,version:r}));return i}const Hw=6,Ww=32,Mg=4096,Kw=Ww*Mg,Vw=Kw*Hw-1-1*Mg*Hw;class OI extends yt{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class NI extends yt{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function LI(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),r=typeof t.data=="string"?co(t.data):t.data,n=_n(r);if(!n)throw new NI;if(n>Vw)throw new OI({maxSize:Vw,size:n});const i=[];let s=!0,o=0;for(;s;){const a=dg(new Uint8Array(Kw));let u=0;for(;ua.bytes):i.map(a=>li(a.bytes))}function kI(t){const{data:e,kzg:r,to:n}=t,i=t.blobs??LI({data:e,to:n}),s=t.commitments??qw({blobs:i,kzg:r,to:n}),o=t.proofs??zw({blobs:i,commitments:s,kzg:r,to:n}),a=[];for(let u=0;u"u"&&g)if(u){const k=await D();y.nonce=await u.consume({address:g.address,chainId:k,client:t})}else y.nonce=await fi(t,EI,"getTransactionCount")({address:g.address,blockTag:"pending"});if((l.includes("fees")||l.includes("type"))&&typeof d>"u")try{y.type=BI(y)}catch{const k=await P();y.type=typeof(k==null?void 0:k.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(l.includes("fees"))if(y.type!=="legacy"&&y.type!=="eip2930"){if(typeof y.maxFeePerGas>"u"||typeof y.maxPriorityFeePerGas>"u"){const k=await P(),{maxFeePerGas:B,maxPriorityFeePerGas:j}=await Uw(t,{block:k,chain:i,request:y});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(y.gas=await fi(t,FI,"estimateGas")({...y,account:g&&{address:g.address,type:"json-rpc"}})),qh(y),delete y.parameters,y}async function $I(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=r?Pr(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function FI(t,e){var i,s,o;const{account:r=t.account}=e,n=r?fo(r):void 0;try{let f=function(v){const{block:x,request:_,rpcStateOverride:S}=v;return t.request({method:"eth_estimateGas",params:S?[_,x??"latest",S]:x?[_,x]:[_]})};const{accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,blockNumber:g,blockTag:y,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:j,value:U,stateOverride:K,...J}=await Ig(t,{...e,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),z=(g?Pr(g):void 0)||y,ue=dI(K),_e=await(async()=>{if(J.to)return J.to;if(u&&u.length>0)return await kw({authorization:u[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`")})})();qh(e);const G=(o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:o.format,m=(G||Sg)({...$w(J,{format:G}),from:n==null?void 0:n.address,accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:j,to:_e,value:U});let p=BigInt(await f({block:z,request:m,rpcStateOverride:ue}));if(u){const v=await $I(t,{address:m.from}),x=await Promise.all(u.map(async _=>{const{contractAddress:S}=_,b=await f({block:z,request:{authorizationList:void 0,data:A,from:n==null?void 0:n.address,to:S,value:Pr(v)},rpcStateOverride:ue}).catch(()=>100000n);return 2n*BigInt(b)}));p+=x.reduce((_,S)=>_+S,0n)}return p}catch(a){throw uI(a,{...e,account:n,chain:t.chain})}}class jI extends yt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class UI extends yt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` +`),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(Uh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Eg extends yt{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function Bw(t,e){const r=(t.details||"").toLowerCase(),n=t instanceof yt?t.walk(i=>(i==null?void 0:i.code)===Jc.code):t;return n instanceof yt?new Jc({cause:t,message:n.details}):Jc.nodeMessage.test(r)?new Jc({cause:t,message:t.details}):jh.nodeMessage.test(r)?new jh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):gg.nodeMessage.test(r)?new gg({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):mg.nodeMessage.test(r)?new mg({cause:t,nonce:e==null?void 0:e.nonce}):vg.nodeMessage.test(r)?new vg({cause:t,nonce:e==null?void 0:e.nonce}):bg.nodeMessage.test(r)?new bg({cause:t,nonce:e==null?void 0:e.nonce}):yg.nodeMessage.test(r)?new yg({cause:t}):wg.nodeMessage.test(r)?new wg({cause:t,gas:e==null?void 0:e.gas}):xg.nodeMessage.test(r)?new xg({cause:t,gas:e==null?void 0:e.gas}):_g.nodeMessage.test(r)?new _g({cause:t}):Uh.nodeMessage.test(r)?new Uh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new Eg({cause:t})}function uI(t,{docsPath:e,...r}){const n=(()=>{const i=Bw(t,r);return i instanceof Eg?t:i})();return new cI(n,{docsPath:e,...r})}function $w(t,{format:e}){if(!e)return{};const r={};function n(s){const o=Object.keys(s);for(const a of o)a in t&&(r[a]=t[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}const i=e(t||{});return n(i),r}const fI={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Sg(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=lI(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(r=>li(r)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=Pr(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=Pr(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=Pr(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=Pr(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=Pr(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=Pr(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=fI[t.type]),typeof t.value<"u"&&(e.value=Pr(t.value)),e}function lI(t){return t.map(e=>({address:e.contractAddress,r:e.r,s:e.s,chainId:Pr(e.chainId),nonce:Pr(e.nonce),...typeof e.yParity<"u"?{yParity:Pr(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:Pr(e.v)}:{}}))}function Fw(t){if(!(!t||t.length===0))return t.reduce((e,{slot:r,value:n})=>{if(r.length!==66)throw new tw({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new tw({size:n.length,targetSize:66,type:"hex"});return e[r]=n,e},{})}function hI(t){const{balance:e,nonce:r,state:n,stateDiff:i,code:s}=t,o={};if(s!==void 0&&(o.code=s),e!==void 0&&(o.balance=Pr(e)),r!==void 0&&(o.nonce=Pr(r)),n!==void 0&&(o.state=Fw(n)),i!==void 0){if(o.state)throw new UM;o.stateDiff=Fw(i)}return o}function dI(t){if(!t)return;const e={};for(const{address:r,...n}of t){if(!uo(r,{strict:!1}))throw new zc({address:r});if(e[r])throw new jM({address:r});e[r]=hI(n)}return e}const pI=2n**256n-1n;function qh(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?fo(e):void 0;if(o&&!uo(o.address))throw new zc({address:o.address});if(s&&!uo(s))throw new zc({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new qM;if(n&&n>pI)throw new jh({maxFeePerGas:n});if(i&&n&&i>n)throw new Uh({maxFeePerGas:n,maxPriorityFeePerGas:i})}class gI extends yt{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Ag extends yt{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class mI extends yt{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${hs(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class vI extends yt{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}const bI={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function yI(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?Fc(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?Fc(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?bI[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=wI(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function wI(t){return t.map(e=>({contractAddress:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function xI(t){const e=(t.transactions??[]).map(r=>typeof r=="string"?r:yI(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function zh(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){var d,p,y;const s=n??"latest",o=i??!1,a=r!==void 0?Pr(r):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,o]},{dedupe:!0}):u=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]},{dedupe:!!a}),!u)throw new vI({blockHash:e,blockNumber:r});return(((y=(p=(d=t.chain)==null?void 0:d.formatters)==null?void 0:p.block)==null?void 0:y.format)||xI)(u)}async function jw(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function _I(t,e){var s,o;const{block:r,chain:n=t.chain,request:i}=e||{};try{const a=((s=n==null?void 0:n.fees)==null?void 0:s.maxPriorityFeePerGas)??((o=n==null?void 0:n.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=r||await fi(t,zh,"getBlock")({}),d=await a({block:l,client:t,request:i});if(d===null)throw new Error;return d}if(typeof a<"u")return a;const u=await t.request({method:"eth_maxPriorityFeePerGas"});return yf(u)}catch{const[a,u]=await Promise.all([r?Promise.resolve(r):fi(t,zh,"getBlock")({}),fi(t,jw,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new Ag;const l=u-a.baseFeePerGas;return l<0n?0n:l}}async function Uw(t,e){var y,A;const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>{var P,N;return typeof((P=n==null?void 0:n.fees)==null?void 0:P.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):((N=n==null?void 0:n.fees)==null?void 0:N.baseFeeMultiplier)??1.2})();if(o<1)throw new gI;const u=10**(((y=o.toString().split(".")[1])==null?void 0:y.length)??0),l=P=>P*BigInt(Math.ceil(o*u))/BigInt(u),d=r||await fi(t,zh,"getBlock")({});if(typeof((A=n==null?void 0:n.fees)==null?void 0:A.estimateFeesPerGas)=="function"){const P=await n.fees.estimateFeesPerGas({block:r,client:t,multiply:l,request:i,type:s});if(P!==null)return P}if(s==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new Ag;const P=typeof(i==null?void 0:i.maxPriorityFeePerGas)=="bigint"?i.maxPriorityFeePerGas:await _I(t,{block:d,chain:n,request:i}),N=l(d.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??N+P,maxPriorityFeePerGas:P}}return{gasPrice:(i==null?void 0:i.gasPrice)??l(await fi(t,jw,"getGasPrice")({}))}}async function EI(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,n?Pr(n):r]},{dedupe:!!n});return Fc(i)}function qw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(s=>co(s)):t.blobs,i=[];for(const s of n)i.push(Uint8Array.from(e.blobToKzgCommitment(s)));return r==="bytes"?i:i.map(s=>li(s))}function zw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>co(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>co(o)):t.commitments,s=[];for(let o=0;oli(o))}function SI(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),u=n?4:0,l=n?0:4;t.setUint32(e+u,o,n),t.setUint32(e+l,a,n)}const AI=(t,e,r)=>t&e^~t&r,PI=(t,e,r)=>t&e^t&r^e&r;class MI extends ig{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ng(this.buffer)}update(e){Uc(this);const{view:r,buffer:n,blockLen:i}=this;e=wf(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let p=o;pd.length)throw new Error("_sha2: outputLen bigger than state");for(let p=0;p>>3,N=Os(A,17)^Os(A,19)^A>>>10;ea[p]=N+ea[p-7]+P+ea[p-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:u,G:l,H:d}=this;for(let p=0;p<64;p++){const y=Os(a,6)^Os(a,11)^Os(a,25),A=d+y+AI(a,u,l)+II[p]+ea[p]|0,N=(Os(n,2)^Os(n,13)^Os(n,22))+PI(n,i,s)|0;d=l,l=u,u=a,a=o+A|0,o=s,s=i,i=n,n=A+N|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(n,i,s,o,a,u,l,d)}roundClean(){ea.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Pg=uw(()=>new CI);function TI(t,e){return Pg(Jo(t,{strict:!1})?rg(t):t)}function RI(t){const{commitment:e,version:r=1}=t,n=t.to??(typeof e=="string"?"hex":"bytes"),i=TI(e);return i.set([r],0),n==="bytes"?i:li(i)}function DI(t){const{commitments:e,version:r}=t,n=t.to??(typeof e[0]=="string"?"hex":"bytes"),i=[];for(const s of e)i.push(RI({commitment:s,to:n,version:r}));return i}const Hw=6,Ww=32,Mg=4096,Kw=Ww*Mg,Vw=Kw*Hw-1-1*Mg*Hw;class OI extends yt{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class NI extends yt{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function LI(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),r=typeof t.data=="string"?co(t.data):t.data,n=_n(r);if(!n)throw new NI;if(n>Vw)throw new OI({maxSize:Vw,size:n});const i=[];let s=!0,o=0;for(;s;){const a=dg(new Uint8Array(Kw));let u=0;for(;ua.bytes):i.map(a=>li(a.bytes))}function kI(t){const{data:e,kzg:r,to:n}=t,i=t.blobs??LI({data:e,to:n}),s=t.commitments??qw({blobs:i,kzg:r,to:n}),o=t.proofs??zw({blobs:i,commitments:s,kzg:r,to:n}),a=[];for(let u=0;u"u"&&p)if(u){const k=await D();y.nonce=await u.consume({address:p.address,chainId:k,client:t})}else y.nonce=await fi(t,EI,"getTransactionCount")({address:p.address,blockTag:"pending"});if((l.includes("fees")||l.includes("type"))&&typeof d>"u")try{y.type=BI(y)}catch{const k=await P();y.type=typeof(k==null?void 0:k.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(l.includes("fees"))if(y.type!=="legacy"&&y.type!=="eip2930"){if(typeof y.maxFeePerGas>"u"||typeof y.maxPriorityFeePerGas>"u"){const k=await P(),{maxFeePerGas:B,maxPriorityFeePerGas:j}=await Uw(t,{block:k,chain:i,request:y});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(y.gas=await fi(t,FI,"estimateGas")({...y,account:p&&{address:p.address,type:"json-rpc"}})),qh(y),delete y.parameters,y}async function $I(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=r?Pr(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function FI(t,e){var i,s,o;const{account:r=t.account}=e,n=r?fo(r):void 0;try{let f=function(v){const{block:x,request:_,rpcStateOverride:S}=v;return t.request({method:"eth_estimateGas",params:S?[_,x??"latest",S]:x?[_,x]:[_]})};const{accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,blockNumber:p,blockTag:y,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:j,value:U,stateOverride:K,...J}=await Ig(t,{...e,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),z=(p?Pr(p):void 0)||y,ue=dI(K),_e=await(async()=>{if(J.to)return J.to;if(u&&u.length>0)return await kw({authorization:u[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`")})})();qh(e);const G=(o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:o.format,m=(G||Sg)({...$w(J,{format:G}),from:n==null?void 0:n.address,accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:j,to:_e,value:U});let g=BigInt(await f({block:z,request:m,rpcStateOverride:ue}));if(u){const v=await $I(t,{address:m.from}),x=await Promise.all(u.map(async _=>{const{contractAddress:S}=_,b=await f({block:z,request:{authorizationList:void 0,data:A,from:n==null?void 0:n.address,to:S,value:Pr(v)},rpcStateOverride:ue}).catch(()=>100000n);return 2n*BigInt(b)}));g+=x.reduce((_,S)=>_+S,0n)}return g}catch(a){throw uI(a,{...e,account:n,chain:t.chain})}}class jI extends yt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class UI extends yt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` `),{name:"ChainNotFoundError"})}}const Cg="/docs/contract/encodeDeployData";function qI(t){const{abi:e,args:r,bytecode:n}=t;if(!r||r.length===0)return n;const i=e.find(o=>"type"in o&&o.type==="constructor");if(!i)throw new nP({docsPath:Cg});if(!("inputs"in i))throw new Jy({docsPath:Cg});if(!i.inputs||i.inputs.length===0)throw new Jy({docsPath:Cg});const s=_w(i.inputs,r);return Bh([n,s])}async function zI(t){return new Promise(e=>setTimeout(e,t))}class Uf extends yt{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` -`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class Tg extends yt{constructor({docsPath:e,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:e,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function Yw({chain:t,currentChainId:e}){if(!t)throw new UI;if(e!==t.id)throw new jI({chain:t,currentChainId:e})}function HI(t,{docsPath:e,...r}){const n=(()=>{const i=Bw(t,r);return i instanceof Eg?t:i})();return new HM(n,{docsPath:e,...r})}async function Jw(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const Rg=new kh(128);async function Dg(t,e){var k,B,j,U;const{account:r=t.account,chain:n=t.chain,accessList:i,authorizationList:s,blobs:o,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,value:P,...N}=e;if(typeof r>"u")throw new Uf({docsPath:"/docs/actions/wallet/sendTransaction"});const D=r?fo(r):null;try{qh(e);const K=await(async()=>{if(e.to)return e.to;if(s&&s.length>0)return await kw({authorization:s[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`.")})})();if((D==null?void 0:D.type)==="json-rpc"||D===null){let J;n!==null&&(J=await fi(t,Hh,"getChainId")({}),Yw({currentChainId:J,chain:n}));const T=(j=(B=(k=t.chain)==null?void 0:k.formatters)==null?void 0:B.transactionRequest)==null?void 0:j.format,ue=(T||Sg)({...$w(N,{format:T}),accessList:i,authorizationList:s,blobs:o,chainId:J,data:a,from:D==null?void 0:D.address,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,to:K,value:P}),_e=Rg.get(t.uid),G=_e?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:G,params:[ue]},{retryCount:0})}catch(E){if(_e===!1)throw E;const m=E;if(m.name==="InvalidInputRpcError"||m.name==="InvalidParamsRpcError"||m.name==="MethodNotFoundRpcError"||m.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[ue]},{retryCount:0}).then(f=>(Rg.set(t.uid,!0),f)).catch(f=>{const p=f;throw p.name==="MethodNotFoundRpcError"||p.name==="MethodNotSupportedRpcError"?(Rg.set(t.uid,!1),m):p});throw m}}if((D==null?void 0:D.type)==="local"){const J=await fi(t,Ig,"prepareTransactionRequest")({account:D,accessList:i,authorizationList:s,blobs:o,chain:n,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:g,maxPriorityFeePerGas:y,nonce:A,nonceManager:D.nonceManager,parameters:[...Gw,"sidecars"],value:P,...N,to:K}),T=(U=n==null?void 0:n.serializers)==null?void 0:U.transaction,z=await D.signTransaction(J,{serializer:T});return await fi(t,Jw,"sendRawTransaction")({serializedTransaction:z})}throw(D==null?void 0:D.type)==="smart"?new Tg({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Tg({docsPath:"/docs/actions/wallet/sendTransaction",type:D==null?void 0:D.type})}catch(K){throw K instanceof Tg?K:HI(K,{...e,account:D,chain:e.chain||void 0})}}async function WI(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:o,functionName:a,...u}=e;if(typeof n>"u")throw new Uf({docsPath:"/docs/contract/writeContract"});const l=n?fo(n):null,d=yM({abi:r,args:s,functionName:a});try{return await fi(t,Dg,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:i,account:l,...u})}catch(g){throw eI(g,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:a,sender:l==null?void 0:l.address})}}async function KI(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:Pr(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}const Og=256;let Wh=Og,Kh;function Xw(t=11){if(!Kh||Wh+t>Og*2){Kh="",Wh=0;for(let e=0;e{const B=k(D);for(const U in P)delete B[U];const j={...D,...B};return Object.assign(j,{extend:N(j)})}}return Object.assign(P,{extend:N(P)})}const Vh=new kh(8192);function GI(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(Vh.get(r))return Vh.get(r);const n=t().finally(()=>Vh.delete(r));return Vh.set(r,n),n}function YI(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const u=async({error:l})=>{const d=typeof e=="function"?e({count:a,error:l}):e;d&&await zI(d),o({count:a+1})};try{const l=await t();i(l)}catch(l){if(a{const{dedupe:i=!1,retryDelay:s=150,retryCount:o=3,uid:a}={...e,...n},u=i?Ef(Oh(`${a}.${Kc(r)}`)):void 0;return GI(()=>YI(async()=>{try{return await t(r)}catch(l){const d=l;switch(d.code){case Pf.code:throw new Pf(d);case Mf.code:throw new Mf(d);case If.code:throw new If(d,{method:r.method});case Cf.code:throw new Cf(d);case Ba.code:throw new Ba(d);case Tf.code:throw new Tf(d);case Rf.code:throw new Rf(d);case Df.code:throw new Df(d);case Of.code:throw new Of(d);case Nf.code:throw new Nf(d,{method:r.method});case Gc.code:throw new Gc(d);case Lf.code:throw new Lf(d);case Yc.code:throw new Yc(d);case kf.code:throw new kf(d);case Bf.code:throw new Bf(d);case $f.code:throw new $f(d);case Ff.code:throw new Ff(d);case jf.code:throw new jf(d);case 5e3:throw new Yc(d);default:throw l instanceof yt?l:new ZM(d)}}},{delay:({count:l,error:d})=>{var g;if(d&&d instanceof Dw){const y=(g=d==null?void 0:d.headers)==null?void 0:g.get("Retry-After");if(y!=null&&y.match(/\d/))return Number.parseInt(y)*1e3}return~~(1<XI(l)}),{enabled:i,id:u})}}function XI(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Gc.code||t.code===Ba.code:t instanceof Dw&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function ZI({key:t,name:e,request:r,retryCount:n=3,retryDelay:i=150,timeout:s,type:o},a){const u=Xw();return{config:{key:t,name:e,request:r,retryCount:n,retryDelay:i,timeout:s,type:o},request:JI(r,{retryCount:n,retryDelay:i,uid:u}),value:a}}function QI(t,e={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=e;return({retryCount:s})=>ZI({key:r,name:n,request:t.request.bind(t),retryCount:e.retryCount??s,retryDelay:i,type:"custom"})}const eC=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,tC=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;class rC extends yt{constructor({domain:e}){super(`Invalid domain "${Kc(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class nC extends yt{constructor({primaryType:e,types:r}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class iC extends yt{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function sC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(u,l)=>{const d={...l};for(const g of u){const{name:y,type:A}=g;A==="address"&&(d[y]=d[y].toLowerCase())}return d},o=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return Kc({domain:o,message:a,primaryType:n,types:i})}function oC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(o,a)=>{for(const u of o){const{name:l,type:d}=u,g=a[l],y=d.match(tC);if(y&&(typeof g=="number"||typeof g=="bigint")){const[N,D,k]=y;Pr(g,{signed:D==="int",size:Number.parseInt(k)/8})}if(d==="address"&&typeof g=="string"&&!uo(g))throw new zc({address:g});const A=d.match(eC);if(A){const[N,D]=A;if(D&&_n(g)!==Number.parseInt(D))throw new uP({expectedSize:Number.parseInt(D),givenSize:_n(g)})}const P=i[d];P&&(cC(d),s(P,g))}};if(i.EIP712Domain&&e){if(typeof e!="object")throw new rC({domain:e});s(i.EIP712Domain,e)}if(n!=="EIP712Domain")if(i[n])s(i[n],r);else throw new nC({primaryType:n,types:i})}function aC({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},typeof(t==null?void 0:t.chainId)=="number"&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function cC(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new iC({type:t})}let Zw=class extends ig{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,SP(e);const n=wf(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew Zw(t,e).update(r).digest();Qw.create=(t,e)=>new Zw(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ng=BigInt(0),Gh=BigInt(1),uC=BigInt(2);function $a(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function qf(t){if(!$a(t))throw new Error("Uint8Array expected")}function Xc(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)}const fC=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Zc(t){qf(t);let e="";for(let r=0;r=ho._0&&t<=ho._9)return t-ho._0;if(t>=ho._A&&t<=ho._F)return t-(ho._A-10);if(t>=ho._a&&t<=ho._f)return t-(ho._a-10)}function eu(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;itypeof t=="bigint"&&Ng<=t;function Yh(t,e,r){return $g(t)&&$g(e)&&$g(r)&&e<=t&&tNg;t>>=Gh,e+=1);return e}function pC(t,e){return t>>BigInt(e)&Gh}function gC(t,e,r){return t|(r?Gh:Ng)<(uC<new Uint8Array(t),r2=t=>Uint8Array.from(t);function n2(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=jg(t),i=jg(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...g)=>r(i,n,...g),u=(g=jg())=>{i=a(r2([0]),g),n=a(),g.length!==0&&(i=a(r2([1]),g),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let g=0;const y=[];for(;g{o(),u(g);let A;for(;!(A=y(l()));)u();return o(),A}}const mC={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||$a(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Hf(t,e,r={}){const n=(i,s,o)=>{const a=mC[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const u=t[i];if(!(o&&u===void 0)&&!a(u,t))throw new Error(`Invalid param ${String(i)}=${u} (${typeof u}), expected ${s}`)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const vC=()=>{throw new Error("not implemented")};function Ug(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}const bC=Object.freeze(Object.defineProperty({__proto__:null,aInRange:ja,abool:Xc,abytes:qf,bitGet:pC,bitLen:t2,bitMask:Fg,bitSet:gC,bytesToHex:Zc,bytesToNumberBE:Fa,bytesToNumberLE:kg,concatBytes:zf,createHmacDrbg:n2,ensureBytes:ds,equalBytes:hC,hexToBytes:eu,hexToNumber:Lg,inRange:Yh,isBytes:$a,memoized:Ug,notImplemented:vC,numberToBytesBE:tu,numberToBytesLE:Bg,numberToHexUnpadded:Qc,numberToVarBytesBE:lC,utf8ToBytes:dC,validateObject:Hf},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mn=BigInt(0),sn=BigInt(1),Ua=BigInt(2),yC=BigInt(3),qg=BigInt(4),i2=BigInt(5),s2=BigInt(8);BigInt(9),BigInt(16);function di(t,e){const r=t%e;return r>=Mn?r:e+r}function wC(t,e,r){if(r<=Mn||e 0");if(r===sn)return Mn;let n=sn;for(;e>Mn;)e&sn&&(n=n*t%r),t=t*t%r,e>>=sn;return n}function Ui(t,e,r){let n=t;for(;e-- >Mn;)n*=n,n%=r;return n}function zg(t,e){if(t===Mn||e<=Mn)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=di(t,e),n=e,i=Mn,s=sn;for(;r!==Mn;){const a=n/r,u=n%r,l=i-s*a;n=r,r=u,i=s,s=l}if(n!==sn)throw new Error("invert: does not exist");return di(i,e)}function xC(t){const e=(t-sn)/Ua;let r,n,i;for(r=t-sn,n=0;r%Ua===Mn;r/=Ua,n++);for(i=Ua;i(n[i]="function",n),e);return Hf(t,r)}function AC(t,e,r){if(r 0");if(r===Mn)return t.ONE;if(r===sn)return e;let n=t.ONE,i=e;for(;r>Mn;)r&sn&&(n=t.mul(n,i)),i=t.sqr(i),r>>=sn;return n}function PC(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function o2(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function a2(t,e,r=!1,n={}){if(t<=Mn)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=o2(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=_C(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:Fg(i),ZERO:Mn,ONE:sn,create:u=>di(u,t),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return Mn<=u&&uu===Mn,isOdd:u=>(u&sn)===sn,neg:u=>di(-u,t),eql:(u,l)=>u===l,sqr:u=>di(u*u,t),add:(u,l)=>di(u+l,t),sub:(u,l)=>di(u-l,t),mul:(u,l)=>di(u*l,t),pow:(u,l)=>AC(a,u,l),div:(u,l)=>di(u*zg(l,t),t),sqrN:u=>u*u,addN:(u,l)=>u+l,subN:(u,l)=>u-l,mulN:(u,l)=>u*l,inv:u=>zg(u,t),sqrt:n.sqrt||(u=>o(a,u)),invertBatch:u=>PC(a,u),cmov:(u,l,d)=>d?l:u,toBytes:u=>r?Bg(u,s):tu(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return r?kg(u):Fa(u)}});return Object.freeze(a)}function c2(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function u2(t){const e=c2(t);return e+Math.ceil(e/2)}function MC(t,e,r=!1){const n=t.length,i=c2(e),s=u2(e);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?Fa(t):kg(t),a=di(o,e-sn)+sn;return r?Bg(a,i):tu(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const IC=BigInt(0),Hg=BigInt(1),Wg=new WeakMap,f2=new WeakMap;function CC(t,e){const r=(s,o)=>{const a=o.negate();return s?a:o},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>e)throw new Error(`Wrong window size=${s}, should be [1..${e}]`)},i=s=>{n(s);const o=Math.ceil(e/s)+1,a=2**(s-1);return{windows:o,windowSize:a}};return{constTimeNegate:r,unsafeLadder(s,o){let a=t.ZERO,u=s;for(;o>IC;)o&Hg&&(a=a.add(u)),u=u.double(),o>>=Hg;return a},precomputeWindow(s,o){const{windows:a,windowSize:u}=i(o),l=[];let d=s,g=d;for(let y=0;y>=P,k>l&&(k-=A,a+=Hg);const B=D,j=D+Math.abs(k)-1,U=N%2!==0,K=k<0;k===0?g=g.add(r(U,o[B])):d=d.add(r(K,o[j]))}return{p:d,f:g}},wNAFCached(s,o,a){const u=f2.get(s)||1;let l=Wg.get(s);return l||(l=this.precomputeWindow(s,u),u!==1&&Wg.set(s,a(l))),this.wNAF(u,l,o)},setWindowSize(s,o){n(o),f2.set(s,o),Wg.delete(s)}}}function TC(t,e,r,n){if(!Array.isArray(r)||!Array.isArray(n)||n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((d,g)=>{if(!e.isValid(d))throw new Error(`wrong scalar at index ${g}`)}),r.forEach((d,g)=>{if(!(d instanceof t))throw new Error(`wrong point at index ${g}`)});const i=t2(BigInt(r.length)),s=i>12?i-3:i>4?i-2:i?2:1,o=(1<=0;d-=s){a.fill(t.ZERO);for(let y=0;y>BigInt(d)&BigInt(o));a[P]=a[P].add(r[y])}let g=t.ZERO;for(let y=a.length-1,A=t.ZERO;y>0;y--)A=A.add(a[y]),g=g.add(A);if(l=l.add(g),d!==0)for(let y=0;y{const{Err:r}=po;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=Qc(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?Qc(i.length/2|128):"";return`${Qc(t)}${s}${i}${e}`},decode(t,e){const{Err:r}=po;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");const l=e.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const d of l)o=o<<8|d;if(n+=u,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=po;if(t{const B=D.toAffine();return zf(Uint8Array.from([4]),r.toBytes(B.x),r.toBytes(B.y))}),s=e.fromBytes||(N=>{const D=N.subarray(1),k=r.fromBytes(D.subarray(0,r.BYTES)),B=r.fromBytes(D.subarray(r.BYTES,2*r.BYTES));return{x:k,y:B}});function o(N){const{a:D,b:k}=e,B=r.sqr(N),j=r.mul(B,N);return r.add(r.add(j,r.mul(N,D)),k)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(N){return Yh(N,In,e.n)}function u(N){const{allowedPrivateKeyLengths:D,nByteLength:k,wrapPrivateKey:B,n:j}=e;if(D&&typeof N!="bigint"){if($a(N)&&(N=Zc(N)),typeof N!="string"||!D.includes(N.length))throw new Error("Invalid key");N=N.padStart(k*2,"0")}let U;try{U=typeof N=="bigint"?N:Fa(ds("private key",N,k))}catch{throw new Error(`private key must be ${k} bytes, hex or bigint, not ${typeof N}`)}return B&&(U=di(U,j)),ja("private key",U,In,j),U}function l(N){if(!(N instanceof y))throw new Error("ProjectivePoint expected")}const d=Ug((N,D)=>{const{px:k,py:B,pz:j}=N;if(r.eql(j,r.ONE))return{x:k,y:B};const U=N.is0();D==null&&(D=U?r.ONE:r.inv(j));const K=r.mul(k,D),J=r.mul(B,D),T=r.mul(j,D);if(U)return{x:r.ZERO,y:r.ZERO};if(!r.eql(T,r.ONE))throw new Error("invZ was invalid");return{x:K,y:J}}),g=Ug(N=>{if(N.is0()){if(e.allowInfinityPoint&&!r.is0(N.py))return;throw new Error("bad point: ZERO")}const{x:D,y:k}=N.toAffine();if(!r.isValid(D)||!r.isValid(k))throw new Error("bad point: x or y not FE");const B=r.sqr(k),j=o(D);if(!r.eql(B,j))throw new Error("bad point: equation left != right");if(!N.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(D,k,B){if(this.px=D,this.py=k,this.pz=B,D==null||!r.isValid(D))throw new Error("x required");if(k==null||!r.isValid(k))throw new Error("y required");if(B==null||!r.isValid(B))throw new Error("z required");Object.freeze(this)}static fromAffine(D){const{x:k,y:B}=D||{};if(!D||!r.isValid(k)||!r.isValid(B))throw new Error("invalid affine point");if(D instanceof y)throw new Error("projective point not allowed");const j=U=>r.eql(U,r.ZERO);return j(k)&&j(B)?y.ZERO:new y(k,B,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(D){const k=r.invertBatch(D.map(B=>B.pz));return D.map((B,j)=>B.toAffine(k[j])).map(y.fromAffine)}static fromHex(D){const k=y.fromAffine(s(ds("pointHex",D)));return k.assertValidity(),k}static fromPrivateKey(D){return y.BASE.multiply(u(D))}static msm(D,k){return TC(y,n,D,k)}_setWindowSize(D){P.setWindowSize(this,D)}assertValidity(){g(this)}hasEvenY(){const{y:D}=this.toAffine();if(r.isOdd)return!r.isOdd(D);throw new Error("Field doesn't support isOdd")}equals(D){l(D);const{px:k,py:B,pz:j}=this,{px:U,py:K,pz:J}=D,T=r.eql(r.mul(k,J),r.mul(U,j)),z=r.eql(r.mul(B,J),r.mul(K,j));return T&&z}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){const{a:D,b:k}=e,B=r.mul(k,d2),{px:j,py:U,pz:K}=this;let J=r.ZERO,T=r.ZERO,z=r.ZERO,ue=r.mul(j,j),_e=r.mul(U,U),G=r.mul(K,K),E=r.mul(j,U);return E=r.add(E,E),z=r.mul(j,K),z=r.add(z,z),J=r.mul(D,z),T=r.mul(B,G),T=r.add(J,T),J=r.sub(_e,T),T=r.add(_e,T),T=r.mul(J,T),J=r.mul(E,J),z=r.mul(B,z),G=r.mul(D,G),E=r.sub(ue,G),E=r.mul(D,E),E=r.add(E,z),z=r.add(ue,ue),ue=r.add(z,ue),ue=r.add(ue,G),ue=r.mul(ue,E),T=r.add(T,ue),G=r.mul(U,K),G=r.add(G,G),ue=r.mul(G,E),J=r.sub(J,ue),z=r.mul(G,_e),z=r.add(z,z),z=r.add(z,z),new y(J,T,z)}add(D){l(D);const{px:k,py:B,pz:j}=this,{px:U,py:K,pz:J}=D;let T=r.ZERO,z=r.ZERO,ue=r.ZERO;const _e=e.a,G=r.mul(e.b,d2);let E=r.mul(k,U),m=r.mul(B,K),f=r.mul(j,J),p=r.add(k,B),v=r.add(U,K);p=r.mul(p,v),v=r.add(E,m),p=r.sub(p,v),v=r.add(k,j);let x=r.add(U,J);return v=r.mul(v,x),x=r.add(E,f),v=r.sub(v,x),x=r.add(B,j),T=r.add(K,J),x=r.mul(x,T),T=r.add(m,f),x=r.sub(x,T),ue=r.mul(_e,v),T=r.mul(G,f),ue=r.add(T,ue),T=r.sub(m,ue),ue=r.add(m,ue),z=r.mul(T,ue),m=r.add(E,E),m=r.add(m,E),f=r.mul(_e,f),v=r.mul(G,v),m=r.add(m,f),f=r.sub(E,f),f=r.mul(_e,f),v=r.add(v,f),E=r.mul(m,v),z=r.add(z,E),E=r.mul(x,v),T=r.mul(p,T),T=r.sub(T,E),E=r.mul(p,m),ue=r.mul(x,ue),ue=r.add(ue,E),new y(T,z,ue)}subtract(D){return this.add(D.negate())}is0(){return this.equals(y.ZERO)}wNAF(D){return P.wNAFCached(this,D,y.normalizeZ)}multiplyUnsafe(D){ja("scalar",D,go,e.n);const k=y.ZERO;if(D===go)return k;if(D===In)return this;const{endo:B}=e;if(!B)return P.unsafeLadder(this,D);let{k1neg:j,k1:U,k2neg:K,k2:J}=B.splitScalar(D),T=k,z=k,ue=this;for(;U>go||J>go;)U&In&&(T=T.add(ue)),J&In&&(z=z.add(ue)),ue=ue.double(),U>>=In,J>>=In;return j&&(T=T.negate()),K&&(z=z.negate()),z=new y(r.mul(z.px,B.beta),z.py,z.pz),T.add(z)}multiply(D){const{endo:k,n:B}=e;ja("scalar",D,In,B);let j,U;if(k){const{k1neg:K,k1:J,k2neg:T,k2:z}=k.splitScalar(D);let{p:ue,f:_e}=this.wNAF(J),{p:G,f:E}=this.wNAF(z);ue=P.constTimeNegate(K,ue),G=P.constTimeNegate(T,G),G=new y(r.mul(G.px,k.beta),G.py,G.pz),j=ue.add(G),U=_e.add(E)}else{const{p:K,f:J}=this.wNAF(D);j=K,U=J}return y.normalizeZ([j,U])[0]}multiplyAndAddUnsafe(D,k,B){const j=y.BASE,U=(J,T)=>T===go||T===In||!J.equals(j)?J.multiplyUnsafe(T):J.multiply(T),K=U(this,k).add(U(D,B));return K.is0()?void 0:K}toAffine(D){return d(this,D)}isTorsionFree(){const{h:D,isTorsionFree:k}=e;if(D===In)return!0;if(k)return k(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:D,clearCofactor:k}=e;return D===In?this:k?k(y,this):this.multiplyUnsafe(e.h)}toRawBytes(D=!0){return Xc("isCompressed",D),this.assertValidity(),i(y,this,D)}toHex(D=!0){return Xc("isCompressed",D),Zc(this.toRawBytes(D))}}y.BASE=new y(e.Gx,e.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);const A=e.nBitLength,P=CC(y,e.endo?Math.ceil(A/2):A);return{CURVE:e,ProjectivePoint:y,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:a}}function LC(t){const e=l2(t);return Hf(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function kC(t){const e=LC(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(f){return di(f,n)}function a(f){return zg(f,n)}const{ProjectivePoint:u,normPrivateKeyToScalar:l,weierstrassEquation:d,isWithinCurveOrder:g}=NC({...e,toBytes(f,p,v){const x=p.toAffine(),_=r.toBytes(x.x),S=zf;return Xc("isCompressed",v),v?S(Uint8Array.from([p.hasEvenY()?2:3]),_):S(Uint8Array.from([4]),_,r.toBytes(x.y))},fromBytes(f){const p=f.length,v=f[0],x=f.subarray(1);if(p===i&&(v===2||v===3)){const _=Fa(x);if(!Yh(_,In,r.ORDER))throw new Error("Point is not on curve");const S=d(_);let b;try{b=r.sqrt(S)}catch(F){const ae=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+ae)}const M=(b&In)===In;return(v&1)===1!==M&&(b=r.neg(b)),{x:_,y:b}}else if(p===s&&v===4){const _=r.fromBytes(x.subarray(0,r.BYTES)),S=r.fromBytes(x.subarray(r.BYTES,2*r.BYTES));return{x:_,y:S}}else throw new Error(`Point of length ${p} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`)}}),y=f=>Zc(tu(f,e.nByteLength));function A(f){const p=n>>In;return f>p}function P(f){return A(f)?o(-f):f}const N=(f,p,v)=>Fa(f.slice(p,v));class D{constructor(p,v,x){this.r=p,this.s=v,this.recovery=x,this.assertValidity()}static fromCompact(p){const v=e.nByteLength;return p=ds("compactSignature",p,v*2),new D(N(p,0,v),N(p,v,2*v))}static fromDER(p){const{r:v,s:x}=po.toSig(ds("DER",p));return new D(v,x)}assertValidity(){ja("r",this.r,In,n),ja("s",this.s,In,n)}addRecoveryBit(p){return new D(this.r,this.s,p)}recoverPublicKey(p){const{r:v,s:x,recovery:_}=this,S=J(ds("msgHash",p));if(_==null||![0,1,2,3].includes(_))throw new Error("recovery id invalid");const b=_===2||_===3?v+e.n:v;if(b>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const M=_&1?"03":"02",I=u.fromHex(M+y(b)),F=a(b),ae=o(-S*F),O=o(x*F),se=u.BASE.multiplyAndAddUnsafe(I,ae,O);if(!se)throw new Error("point at infinify");return se.assertValidity(),se}hasHighS(){return A(this.s)}normalizeS(){return this.hasHighS()?new D(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return eu(this.toDERHex())}toDERHex(){return po.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return eu(this.toCompactHex())}toCompactHex(){return y(this.r)+y(this.s)}}const k={isValidPrivateKey(f){try{return l(f),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const f=u2(e.n);return MC(e.randomBytes(f),e.n)},precompute(f=8,p=u.BASE){return p._setWindowSize(f),p.multiply(BigInt(3)),p}};function B(f,p=!0){return u.fromPrivateKey(f).toRawBytes(p)}function j(f){const p=$a(f),v=typeof f=="string",x=(p||v)&&f.length;return p?x===i||x===s:v?x===2*i||x===2*s:f instanceof u}function U(f,p,v=!0){if(j(f))throw new Error("first arg must be private key");if(!j(p))throw new Error("second arg must be public key");return u.fromHex(p).multiply(l(f)).toRawBytes(v)}const K=e.bits2int||function(f){const p=Fa(f),v=f.length*8-e.nBitLength;return v>0?p>>BigInt(v):p},J=e.bits2int_modN||function(f){return o(K(f))},T=Fg(e.nBitLength);function z(f){return ja(`num < 2^${e.nBitLength}`,f,go,T),tu(f,e.nByteLength)}function ue(f,p,v=_e){if(["recovered","canonical"].some(X=>X in v))throw new Error("sign() legacy options not supported");const{hash:x,randomBytes:_}=e;let{lowS:S,prehash:b,extraEntropy:M}=v;S==null&&(S=!0),f=ds("msgHash",f),h2(v),b&&(f=ds("prehashed msgHash",x(f)));const I=J(f),F=l(p),ae=[z(F),z(I)];if(M!=null&&M!==!1){const X=M===!0?_(r.BYTES):M;ae.push(ds("extraEntropy",X))}const O=zf(...ae),se=I;function ee(X){const Q=K(X);if(!g(Q))return;const R=a(Q),Z=u.BASE.multiply(Q).toAffine(),te=o(Z.x);if(te===go)return;const le=o(R*o(se+te*F));if(le===go)return;let ie=(Z.x===te?0:2)|Number(Z.y&In),fe=le;return S&&A(le)&&(fe=P(le),ie^=1),new D(te,fe,ie)}return{seed:O,k2sig:ee}}const _e={lowS:e.lowS,prehash:!1},G={lowS:e.lowS,prehash:!1};function E(f,p,v=_e){const{seed:x,k2sig:_}=ue(f,p,v),S=e;return n2(S.hash.outputLen,S.nByteLength,S.hmac)(x,_)}u.BASE._setWindowSize(8);function m(f,p,v,x=G){var Z;const _=f;if(p=ds("msgHash",p),v=ds("publicKey",v),"strict"in x)throw new Error("options.strict was renamed to lowS");h2(x);const{lowS:S,prehash:b}=x;let M,I;try{if(typeof _=="string"||$a(_))try{M=D.fromDER(_)}catch(te){if(!(te instanceof po.Err))throw te;M=D.fromCompact(_)}else if(typeof _=="object"&&typeof _.r=="bigint"&&typeof _.s=="bigint"){const{r:te,s:le}=_;M=new D(te,le)}else throw new Error("PARSE");I=u.fromHex(v)}catch(te){if(te.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(S&&M.hasHighS())return!1;b&&(p=e.hash(p));const{r:F,s:ae}=M,O=J(p),se=a(ae),ee=o(O*se),X=o(F*se),Q=(Z=u.BASE.multiplyAndAddUnsafe(I,ee,X))==null?void 0:Z.toAffine();return Q?o(Q.x)===F:!1}return{CURVE:e,getPublicKey:B,getSharedSecret:U,sign:E,verify:m,ProjectivePoint:u,Signature:D,utils:k}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function BC(t){return{hash:t,hmac:(e,...r)=>Qw(t,e,kP(...r)),randomBytes:$P}}function $C(t,e){const r=n=>kC({...t,...BC(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const p2=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),g2=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),FC=BigInt(1),Kg=BigInt(2),m2=(t,e)=>(t+e/Kg)/e;function jC(t){const e=p2,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),u=BigInt(88),l=t*t*t%e,d=l*l*t%e,g=Ui(d,r,e)*d%e,y=Ui(g,r,e)*d%e,A=Ui(y,Kg,e)*l%e,P=Ui(A,i,e)*A%e,N=Ui(P,s,e)*P%e,D=Ui(N,a,e)*N%e,k=Ui(D,u,e)*D%e,B=Ui(k,a,e)*N%e,j=Ui(B,r,e)*d%e,U=Ui(j,o,e)*P%e,K=Ui(U,n,e)*l%e,J=Ui(K,Kg,e);if(!Vg.eql(Vg.sqr(J),t))throw new Error("Cannot find square root");return J}const Vg=a2(p2,void 0,void 0,{sqrt:jC}),v2=$C({a:BigInt(0),b:BigInt(7),Fp:Vg,n:g2,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=g2,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-FC*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=m2(s*t,e),u=m2(-n*t,e);let l=di(t-a*r-u*i,e),d=di(-a*n-u*s,e);const g=l>o,y=d>o;if(g&&(l=e-l),y&&(d=e-d),l>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:g,k1:l,k2neg:y,k2:d}}}},Pg);BigInt(0),v2.ProjectivePoint;const UC=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:v2},Symbol.toStringTag,{value:"Module"}));function qC(t,e){const{abi:r,args:n,bytecode:i,...s}=e,o=qI({abi:r,args:n,bytecode:i});return Dg(t,{...s,data:o})}async function zC(t){var r;return((r=t.account)==null?void 0:r.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(n=>Sf(n))}async function HC(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}async function WC(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>og(r))}async function KC(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function VC(t,{account:e=t.account,message:r}){if(!e)throw new Uf({docsPath:"/docs/actions/wallet/signMessage"});const n=fo(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Oh(r):r.raw instanceof Uint8Array?Dh(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function GC(t,e){var l,d,g,y;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTransaction"});const s=fo(r);qh({account:s,...e});const o=await fi(t,Hh,"getChainId")({});n!==null&&Yw({currentChainId:o,chain:n});const a=(n==null?void 0:n.formatters)||((l=t.chain)==null?void 0:l.formatters),u=((d=a==null?void 0:a.transactionRequest)==null?void 0:d.format)||Sg;return s.signTransaction?s.signTransaction({...i,chainId:o},{serializer:(y=(g=t.chain)==null?void 0:g.serializers)==null?void 0:y.transaction}):await t.request({method:"eth_signTransaction",params:[{...u(i),chainId:Pr(o),from:s.address}]},{retryCount:0})}async function YC(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTypedData"});const o=fo(r),a={EIP712Domain:aC({domain:n}),...e.types};if(oC({domain:n,message:i,primaryType:s,types:a}),o.signTypedData)return o.signTypedData({domain:n,message:i,primaryType:s,types:a});const u=sC({domain:n,message:i,primaryType:s,types:a});return t.request({method:"eth_signTypedData_v4",params:[o.address,u]},{retryCount:0})}async function JC(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:Pr(e)}]},{retryCount:0})}async function XC(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}function ZC(t){return{addChain:e=>KI(t,e),deployContract:e=>qC(t,e),getAddresses:()=>zC(t),getChainId:()=>Hh(t),getPermissions:()=>HC(t),prepareTransactionRequest:e=>Ig(t,e),requestAddresses:()=>WC(t),requestPermissions:e=>KC(t,e),sendRawTransaction:e=>Jw(t,e),sendTransaction:e=>Dg(t,e),signMessage:e=>VC(t,e),signTransaction:e=>GC(t,e),signTypedData:e=>YC(t,e),switchChain:e=>JC(t,e),watchAsset:e=>XC(t,e),writeContract:e=>WI(t,e)}}function QC(t){const{key:e="wallet",name:r="Wallet Client",transport:n}=t;return VI({...t,key:e,name:r,transport:n,type:"walletClient"}).extend(ZC)}class Wf{constructor(e){oo(this,"_key");oo(this,"_config",null);oo(this,"_provider",null);oo(this,"_connected",!1);oo(this,"_address",null);oo(this,"_fatured",!1);oo(this,"_installed",!1);oo(this,"lastUsed",!1);var r;if("name"in e&&"image"in e)this._key=e.name,this._config=e,this._fatured=e.featured;else if("session"in e){if(!e.session)throw new Error("session is null");this._key=(r=e.session)==null?void 0:r.peer.metadata.name,this._provider=e,this._config={name:e.session.peer.metadata.name,image:e.session.peer.metadata.icons[0],featured:!1}}else if("info"in e)console.log(e.info,"installed"),this._key=e.info.name,this._provider=e.provider,this._installed=!0,this._config={name:e.info.name,image:e.info.icon,featured:!1},this.testConnect();else throw new Error("unknown params")}get address(){return this._address}get connected(){return this._connected}get featured(){return this._fatured}get key(){return this._key}get installed(){return this._installed}get client(){return this._provider?QC({transport:QI(this._provider)}):null}get config(){return this._config}static fromWalletConfig(e){return new Wf(e)}EIP6963Detected(e){this._provider=e.provider,this._installed=!0,this._provider.on("disconnect",this.disconnect),this._provider.on("accountsChanged",r=>{this._address=r[0],this._connected=!0}),this.testConnect()}setUniversalProvider(e){this._provider=e,this.testConnect()}async testConnect(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());e&&e.length>0?(this._address=e[0],this._connected=!0):(this._address=null,this._connected=!1)}async connect(){var r;const e=await((r=this.client)==null?void 0:r.request({method:"eth_requestAccounts",params:void 0}));if(!e)throw new Error("connect failed");return e}async getAddress(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());if(!e)throw new Error("get address failed");return e[0]}async getChain(){var r;const e=await((r=this.client)==null?void 0:r.getChainId());if(!e)throw new Error("get chain failed");return e}async signMessage(e,r){var i;return await((i=this.client)==null?void 0:i.signMessage({message:e,account:r}))}async disconnect(){this._provider&&"session"in this._provider&&await this._provider.disconnect(),this._connected=!1,this._address=null}}var Gg={exports:{}},ru=typeof Reflect=="object"?Reflect:null,b2=ru&&typeof ru.apply=="function"?ru.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Jh;ru&&typeof ru.ownKeys=="function"?Jh=ru.ownKeys:Object.getOwnPropertySymbols?Jh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Jh=function(e){return Object.getOwnPropertyNames(e)};function eT(t){console&&console.warn&&console.warn(t)}var y2=Number.isNaN||function(e){return e!==e};function Rr(){Rr.init.call(this)}Gg.exports=Rr,Gg.exports.once=iT,Rr.EventEmitter=Rr,Rr.prototype._events=void 0,Rr.prototype._eventsCount=0,Rr.prototype._maxListeners=void 0;var w2=10;function Xh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Rr,"defaultMaxListeners",{enumerable:!0,get:function(){return w2},set:function(t){if(typeof t!="number"||t<0||y2(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");w2=t}}),Rr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Rr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||y2(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function x2(t){return t._maxListeners===void 0?Rr.defaultMaxListeners:t._maxListeners}Rr.prototype.getMaxListeners=function(){return x2(this)},Rr.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")b2(u,this,r);else for(var l=u.length,d=P2(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,eT(a)}return t}Rr.prototype.addListener=function(e,r){return _2(this,e,r,!1)},Rr.prototype.on=Rr.prototype.addListener,Rr.prototype.prependListener=function(e,r){return _2(this,e,r,!0)};function tT(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function E2(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=tT.bind(n);return i.listener=r,n.wrapFn=i,i}Rr.prototype.once=function(e,r){return Xh(r),this.on(e,E2(this,e,r)),this},Rr.prototype.prependOnceListener=function(e,r){return Xh(r),this.prependListener(e,E2(this,e,r)),this},Rr.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Xh(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():rT(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Rr.prototype.off=Rr.prototype.removeListener,Rr.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function S2(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?nT(i):P2(i,i.length)}Rr.prototype.listeners=function(e){return S2(this,e,!0)},Rr.prototype.rawListeners=function(e){return S2(this,e,!1)},Rr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):A2.call(t,e)},Rr.prototype.listenerCount=A2;function A2(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Rr.prototype.eventNames=function(){return this._eventsCount>0?Jh(this._events):[]};function P2(t,e){for(var r=new Array(e),n=0;n{const i=Bw(t,r);return i instanceof Eg?t:i})();return new HM(n,{docsPath:e,...r})}async function Jw(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const Rg=new kh(128);async function Dg(t,e){var k,B,j,U;const{account:r=t.account,chain:n=t.chain,accessList:i,authorizationList:s,blobs:o,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,value:P,...N}=e;if(typeof r>"u")throw new Uf({docsPath:"/docs/actions/wallet/sendTransaction"});const D=r?fo(r):null;try{qh(e);const K=await(async()=>{if(e.to)return e.to;if(s&&s.length>0)return await kw({authorization:s[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`.")})})();if((D==null?void 0:D.type)==="json-rpc"||D===null){let J;n!==null&&(J=await fi(t,Hh,"getChainId")({}),Yw({currentChainId:J,chain:n}));const T=(j=(B=(k=t.chain)==null?void 0:k.formatters)==null?void 0:B.transactionRequest)==null?void 0:j.format,ue=(T||Sg)({...$w(N,{format:T}),accessList:i,authorizationList:s,blobs:o,chainId:J,data:a,from:D==null?void 0:D.address,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,to:K,value:P}),_e=Rg.get(t.uid),G=_e?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:G,params:[ue]},{retryCount:0})}catch(E){if(_e===!1)throw E;const m=E;if(m.name==="InvalidInputRpcError"||m.name==="InvalidParamsRpcError"||m.name==="MethodNotFoundRpcError"||m.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[ue]},{retryCount:0}).then(f=>(Rg.set(t.uid,!0),f)).catch(f=>{const g=f;throw g.name==="MethodNotFoundRpcError"||g.name==="MethodNotSupportedRpcError"?(Rg.set(t.uid,!1),m):g});throw m}}if((D==null?void 0:D.type)==="local"){const J=await fi(t,Ig,"prepareTransactionRequest")({account:D,accessList:i,authorizationList:s,blobs:o,chain:n,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,nonceManager:D.nonceManager,parameters:[...Gw,"sidecars"],value:P,...N,to:K}),T=(U=n==null?void 0:n.serializers)==null?void 0:U.transaction,z=await D.signTransaction(J,{serializer:T});return await fi(t,Jw,"sendRawTransaction")({serializedTransaction:z})}throw(D==null?void 0:D.type)==="smart"?new Tg({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Tg({docsPath:"/docs/actions/wallet/sendTransaction",type:D==null?void 0:D.type})}catch(K){throw K instanceof Tg?K:HI(K,{...e,account:D,chain:e.chain||void 0})}}async function WI(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:o,functionName:a,...u}=e;if(typeof n>"u")throw new Uf({docsPath:"/docs/contract/writeContract"});const l=n?fo(n):null,d=yM({abi:r,args:s,functionName:a});try{return await fi(t,Dg,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:i,account:l,...u})}catch(p){throw eI(p,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:a,sender:l==null?void 0:l.address})}}async function KI(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:Pr(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}const Og=256;let Wh=Og,Kh;function Xw(t=11){if(!Kh||Wh+t>Og*2){Kh="",Wh=0;for(let e=0;e{const B=k(D);for(const U in P)delete B[U];const j={...D,...B};return Object.assign(j,{extend:N(j)})}}return Object.assign(P,{extend:N(P)})}const Vh=new kh(8192);function GI(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(Vh.get(r))return Vh.get(r);const n=t().finally(()=>Vh.delete(r));return Vh.set(r,n),n}function YI(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const u=async({error:l})=>{const d=typeof e=="function"?e({count:a,error:l}):e;d&&await zI(d),o({count:a+1})};try{const l=await t();i(l)}catch(l){if(a{const{dedupe:i=!1,retryDelay:s=150,retryCount:o=3,uid:a}={...e,...n},u=i?Ef(Oh(`${a}.${Kc(r)}`)):void 0;return GI(()=>YI(async()=>{try{return await t(r)}catch(l){const d=l;switch(d.code){case Pf.code:throw new Pf(d);case Mf.code:throw new Mf(d);case If.code:throw new If(d,{method:r.method});case Cf.code:throw new Cf(d);case Ba.code:throw new Ba(d);case Tf.code:throw new Tf(d);case Rf.code:throw new Rf(d);case Df.code:throw new Df(d);case Of.code:throw new Of(d);case Nf.code:throw new Nf(d,{method:r.method});case Gc.code:throw new Gc(d);case Lf.code:throw new Lf(d);case Yc.code:throw new Yc(d);case kf.code:throw new kf(d);case Bf.code:throw new Bf(d);case $f.code:throw new $f(d);case Ff.code:throw new Ff(d);case jf.code:throw new jf(d);case 5e3:throw new Yc(d);default:throw l instanceof yt?l:new ZM(d)}}},{delay:({count:l,error:d})=>{var p;if(d&&d instanceof Dw){const y=(p=d==null?void 0:d.headers)==null?void 0:p.get("Retry-After");if(y!=null&&y.match(/\d/))return Number.parseInt(y)*1e3}return~~(1<XI(l)}),{enabled:i,id:u})}}function XI(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Gc.code||t.code===Ba.code:t instanceof Dw&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function ZI({key:t,name:e,request:r,retryCount:n=3,retryDelay:i=150,timeout:s,type:o},a){const u=Xw();return{config:{key:t,name:e,request:r,retryCount:n,retryDelay:i,timeout:s,type:o},request:JI(r,{retryCount:n,retryDelay:i,uid:u}),value:a}}function QI(t,e={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=e;return({retryCount:s})=>ZI({key:r,name:n,request:t.request.bind(t),retryCount:e.retryCount??s,retryDelay:i,type:"custom"})}const eC=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,tC=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;class rC extends yt{constructor({domain:e}){super(`Invalid domain "${Kc(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class nC extends yt{constructor({primaryType:e,types:r}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class iC extends yt{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function sC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(u,l)=>{const d={...l};for(const p of u){const{name:y,type:A}=p;A==="address"&&(d[y]=d[y].toLowerCase())}return d},o=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return Kc({domain:o,message:a,primaryType:n,types:i})}function oC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(o,a)=>{for(const u of o){const{name:l,type:d}=u,p=a[l],y=d.match(tC);if(y&&(typeof p=="number"||typeof p=="bigint")){const[N,D,k]=y;Pr(p,{signed:D==="int",size:Number.parseInt(k)/8})}if(d==="address"&&typeof p=="string"&&!uo(p))throw new zc({address:p});const A=d.match(eC);if(A){const[N,D]=A;if(D&&_n(p)!==Number.parseInt(D))throw new uP({expectedSize:Number.parseInt(D),givenSize:_n(p)})}const P=i[d];P&&(cC(d),s(P,p))}};if(i.EIP712Domain&&e){if(typeof e!="object")throw new rC({domain:e});s(i.EIP712Domain,e)}if(n!=="EIP712Domain")if(i[n])s(i[n],r);else throw new nC({primaryType:n,types:i})}function aC({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},typeof(t==null?void 0:t.chainId)=="number"&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function cC(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new iC({type:t})}let Zw=class extends ig{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,SP(e);const n=wf(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew Zw(t,e).update(r).digest();Qw.create=(t,e)=>new Zw(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ng=BigInt(0),Gh=BigInt(1),uC=BigInt(2);function $a(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function qf(t){if(!$a(t))throw new Error("Uint8Array expected")}function Xc(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)}const fC=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Zc(t){qf(t);let e="";for(let r=0;r=ho._0&&t<=ho._9)return t-ho._0;if(t>=ho._A&&t<=ho._F)return t-(ho._A-10);if(t>=ho._a&&t<=ho._f)return t-(ho._a-10)}function eu(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;itypeof t=="bigint"&&Ng<=t;function Yh(t,e,r){return $g(t)&&$g(e)&&$g(r)&&e<=t&&tNg;t>>=Gh,e+=1);return e}function pC(t,e){return t>>BigInt(e)&Gh}function gC(t,e,r){return t|(r?Gh:Ng)<(uC<new Uint8Array(t),r2=t=>Uint8Array.from(t);function n2(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=jg(t),i=jg(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...p)=>r(i,n,...p),u=(p=jg())=>{i=a(r2([0]),p),n=a(),p.length!==0&&(i=a(r2([1]),p),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let p=0;const y=[];for(;p{o(),u(p);let A;for(;!(A=y(l()));)u();return o(),A}}const mC={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||$a(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Hf(t,e,r={}){const n=(i,s,o)=>{const a=mC[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const u=t[i];if(!(o&&u===void 0)&&!a(u,t))throw new Error(`Invalid param ${String(i)}=${u} (${typeof u}), expected ${s}`)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const vC=()=>{throw new Error("not implemented")};function Ug(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}const bC=Object.freeze(Object.defineProperty({__proto__:null,aInRange:ja,abool:Xc,abytes:qf,bitGet:pC,bitLen:t2,bitMask:Fg,bitSet:gC,bytesToHex:Zc,bytesToNumberBE:Fa,bytesToNumberLE:kg,concatBytes:zf,createHmacDrbg:n2,ensureBytes:ds,equalBytes:hC,hexToBytes:eu,hexToNumber:Lg,inRange:Yh,isBytes:$a,memoized:Ug,notImplemented:vC,numberToBytesBE:tu,numberToBytesLE:Bg,numberToHexUnpadded:Qc,numberToVarBytesBE:lC,utf8ToBytes:dC,validateObject:Hf},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mn=BigInt(0),sn=BigInt(1),Ua=BigInt(2),yC=BigInt(3),qg=BigInt(4),i2=BigInt(5),s2=BigInt(8);BigInt(9),BigInt(16);function di(t,e){const r=t%e;return r>=Mn?r:e+r}function wC(t,e,r){if(r<=Mn||e 0");if(r===sn)return Mn;let n=sn;for(;e>Mn;)e&sn&&(n=n*t%r),t=t*t%r,e>>=sn;return n}function Ui(t,e,r){let n=t;for(;e-- >Mn;)n*=n,n%=r;return n}function zg(t,e){if(t===Mn||e<=Mn)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=di(t,e),n=e,i=Mn,s=sn;for(;r!==Mn;){const a=n/r,u=n%r,l=i-s*a;n=r,r=u,i=s,s=l}if(n!==sn)throw new Error("invert: does not exist");return di(i,e)}function xC(t){const e=(t-sn)/Ua;let r,n,i;for(r=t-sn,n=0;r%Ua===Mn;r/=Ua,n++);for(i=Ua;i(n[i]="function",n),e);return Hf(t,r)}function AC(t,e,r){if(r 0");if(r===Mn)return t.ONE;if(r===sn)return e;let n=t.ONE,i=e;for(;r>Mn;)r&sn&&(n=t.mul(n,i)),i=t.sqr(i),r>>=sn;return n}function PC(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function o2(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function a2(t,e,r=!1,n={}){if(t<=Mn)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=o2(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=_C(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:Fg(i),ZERO:Mn,ONE:sn,create:u=>di(u,t),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return Mn<=u&&uu===Mn,isOdd:u=>(u&sn)===sn,neg:u=>di(-u,t),eql:(u,l)=>u===l,sqr:u=>di(u*u,t),add:(u,l)=>di(u+l,t),sub:(u,l)=>di(u-l,t),mul:(u,l)=>di(u*l,t),pow:(u,l)=>AC(a,u,l),div:(u,l)=>di(u*zg(l,t),t),sqrN:u=>u*u,addN:(u,l)=>u+l,subN:(u,l)=>u-l,mulN:(u,l)=>u*l,inv:u=>zg(u,t),sqrt:n.sqrt||(u=>o(a,u)),invertBatch:u=>PC(a,u),cmov:(u,l,d)=>d?l:u,toBytes:u=>r?Bg(u,s):tu(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return r?kg(u):Fa(u)}});return Object.freeze(a)}function c2(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function u2(t){const e=c2(t);return e+Math.ceil(e/2)}function MC(t,e,r=!1){const n=t.length,i=c2(e),s=u2(e);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?Fa(t):kg(t),a=di(o,e-sn)+sn;return r?Bg(a,i):tu(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const IC=BigInt(0),Hg=BigInt(1),Wg=new WeakMap,f2=new WeakMap;function CC(t,e){const r=(s,o)=>{const a=o.negate();return s?a:o},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>e)throw new Error(`Wrong window size=${s}, should be [1..${e}]`)},i=s=>{n(s);const o=Math.ceil(e/s)+1,a=2**(s-1);return{windows:o,windowSize:a}};return{constTimeNegate:r,unsafeLadder(s,o){let a=t.ZERO,u=s;for(;o>IC;)o&Hg&&(a=a.add(u)),u=u.double(),o>>=Hg;return a},precomputeWindow(s,o){const{windows:a,windowSize:u}=i(o),l=[];let d=s,p=d;for(let y=0;y>=P,k>l&&(k-=A,a+=Hg);const B=D,j=D+Math.abs(k)-1,U=N%2!==0,K=k<0;k===0?p=p.add(r(U,o[B])):d=d.add(r(K,o[j]))}return{p:d,f:p}},wNAFCached(s,o,a){const u=f2.get(s)||1;let l=Wg.get(s);return l||(l=this.precomputeWindow(s,u),u!==1&&Wg.set(s,a(l))),this.wNAF(u,l,o)},setWindowSize(s,o){n(o),f2.set(s,o),Wg.delete(s)}}}function TC(t,e,r,n){if(!Array.isArray(r)||!Array.isArray(n)||n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((d,p)=>{if(!e.isValid(d))throw new Error(`wrong scalar at index ${p}`)}),r.forEach((d,p)=>{if(!(d instanceof t))throw new Error(`wrong point at index ${p}`)});const i=t2(BigInt(r.length)),s=i>12?i-3:i>4?i-2:i?2:1,o=(1<=0;d-=s){a.fill(t.ZERO);for(let y=0;y>BigInt(d)&BigInt(o));a[P]=a[P].add(r[y])}let p=t.ZERO;for(let y=a.length-1,A=t.ZERO;y>0;y--)A=A.add(a[y]),p=p.add(A);if(l=l.add(p),d!==0)for(let y=0;y{const{Err:r}=po;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=Qc(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?Qc(i.length/2|128):"";return`${Qc(t)}${s}${i}${e}`},decode(t,e){const{Err:r}=po;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");const l=e.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const d of l)o=o<<8|d;if(n+=u,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=po;if(t{const B=D.toAffine();return zf(Uint8Array.from([4]),r.toBytes(B.x),r.toBytes(B.y))}),s=e.fromBytes||(N=>{const D=N.subarray(1),k=r.fromBytes(D.subarray(0,r.BYTES)),B=r.fromBytes(D.subarray(r.BYTES,2*r.BYTES));return{x:k,y:B}});function o(N){const{a:D,b:k}=e,B=r.sqr(N),j=r.mul(B,N);return r.add(r.add(j,r.mul(N,D)),k)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(N){return Yh(N,In,e.n)}function u(N){const{allowedPrivateKeyLengths:D,nByteLength:k,wrapPrivateKey:B,n:j}=e;if(D&&typeof N!="bigint"){if($a(N)&&(N=Zc(N)),typeof N!="string"||!D.includes(N.length))throw new Error("Invalid key");N=N.padStart(k*2,"0")}let U;try{U=typeof N=="bigint"?N:Fa(ds("private key",N,k))}catch{throw new Error(`private key must be ${k} bytes, hex or bigint, not ${typeof N}`)}return B&&(U=di(U,j)),ja("private key",U,In,j),U}function l(N){if(!(N instanceof y))throw new Error("ProjectivePoint expected")}const d=Ug((N,D)=>{const{px:k,py:B,pz:j}=N;if(r.eql(j,r.ONE))return{x:k,y:B};const U=N.is0();D==null&&(D=U?r.ONE:r.inv(j));const K=r.mul(k,D),J=r.mul(B,D),T=r.mul(j,D);if(U)return{x:r.ZERO,y:r.ZERO};if(!r.eql(T,r.ONE))throw new Error("invZ was invalid");return{x:K,y:J}}),p=Ug(N=>{if(N.is0()){if(e.allowInfinityPoint&&!r.is0(N.py))return;throw new Error("bad point: ZERO")}const{x:D,y:k}=N.toAffine();if(!r.isValid(D)||!r.isValid(k))throw new Error("bad point: x or y not FE");const B=r.sqr(k),j=o(D);if(!r.eql(B,j))throw new Error("bad point: equation left != right");if(!N.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(D,k,B){if(this.px=D,this.py=k,this.pz=B,D==null||!r.isValid(D))throw new Error("x required");if(k==null||!r.isValid(k))throw new Error("y required");if(B==null||!r.isValid(B))throw new Error("z required");Object.freeze(this)}static fromAffine(D){const{x:k,y:B}=D||{};if(!D||!r.isValid(k)||!r.isValid(B))throw new Error("invalid affine point");if(D instanceof y)throw new Error("projective point not allowed");const j=U=>r.eql(U,r.ZERO);return j(k)&&j(B)?y.ZERO:new y(k,B,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(D){const k=r.invertBatch(D.map(B=>B.pz));return D.map((B,j)=>B.toAffine(k[j])).map(y.fromAffine)}static fromHex(D){const k=y.fromAffine(s(ds("pointHex",D)));return k.assertValidity(),k}static fromPrivateKey(D){return y.BASE.multiply(u(D))}static msm(D,k){return TC(y,n,D,k)}_setWindowSize(D){P.setWindowSize(this,D)}assertValidity(){p(this)}hasEvenY(){const{y:D}=this.toAffine();if(r.isOdd)return!r.isOdd(D);throw new Error("Field doesn't support isOdd")}equals(D){l(D);const{px:k,py:B,pz:j}=this,{px:U,py:K,pz:J}=D,T=r.eql(r.mul(k,J),r.mul(U,j)),z=r.eql(r.mul(B,J),r.mul(K,j));return T&&z}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){const{a:D,b:k}=e,B=r.mul(k,d2),{px:j,py:U,pz:K}=this;let J=r.ZERO,T=r.ZERO,z=r.ZERO,ue=r.mul(j,j),_e=r.mul(U,U),G=r.mul(K,K),E=r.mul(j,U);return E=r.add(E,E),z=r.mul(j,K),z=r.add(z,z),J=r.mul(D,z),T=r.mul(B,G),T=r.add(J,T),J=r.sub(_e,T),T=r.add(_e,T),T=r.mul(J,T),J=r.mul(E,J),z=r.mul(B,z),G=r.mul(D,G),E=r.sub(ue,G),E=r.mul(D,E),E=r.add(E,z),z=r.add(ue,ue),ue=r.add(z,ue),ue=r.add(ue,G),ue=r.mul(ue,E),T=r.add(T,ue),G=r.mul(U,K),G=r.add(G,G),ue=r.mul(G,E),J=r.sub(J,ue),z=r.mul(G,_e),z=r.add(z,z),z=r.add(z,z),new y(J,T,z)}add(D){l(D);const{px:k,py:B,pz:j}=this,{px:U,py:K,pz:J}=D;let T=r.ZERO,z=r.ZERO,ue=r.ZERO;const _e=e.a,G=r.mul(e.b,d2);let E=r.mul(k,U),m=r.mul(B,K),f=r.mul(j,J),g=r.add(k,B),v=r.add(U,K);g=r.mul(g,v),v=r.add(E,m),g=r.sub(g,v),v=r.add(k,j);let x=r.add(U,J);return v=r.mul(v,x),x=r.add(E,f),v=r.sub(v,x),x=r.add(B,j),T=r.add(K,J),x=r.mul(x,T),T=r.add(m,f),x=r.sub(x,T),ue=r.mul(_e,v),T=r.mul(G,f),ue=r.add(T,ue),T=r.sub(m,ue),ue=r.add(m,ue),z=r.mul(T,ue),m=r.add(E,E),m=r.add(m,E),f=r.mul(_e,f),v=r.mul(G,v),m=r.add(m,f),f=r.sub(E,f),f=r.mul(_e,f),v=r.add(v,f),E=r.mul(m,v),z=r.add(z,E),E=r.mul(x,v),T=r.mul(g,T),T=r.sub(T,E),E=r.mul(g,m),ue=r.mul(x,ue),ue=r.add(ue,E),new y(T,z,ue)}subtract(D){return this.add(D.negate())}is0(){return this.equals(y.ZERO)}wNAF(D){return P.wNAFCached(this,D,y.normalizeZ)}multiplyUnsafe(D){ja("scalar",D,go,e.n);const k=y.ZERO;if(D===go)return k;if(D===In)return this;const{endo:B}=e;if(!B)return P.unsafeLadder(this,D);let{k1neg:j,k1:U,k2neg:K,k2:J}=B.splitScalar(D),T=k,z=k,ue=this;for(;U>go||J>go;)U&In&&(T=T.add(ue)),J&In&&(z=z.add(ue)),ue=ue.double(),U>>=In,J>>=In;return j&&(T=T.negate()),K&&(z=z.negate()),z=new y(r.mul(z.px,B.beta),z.py,z.pz),T.add(z)}multiply(D){const{endo:k,n:B}=e;ja("scalar",D,In,B);let j,U;if(k){const{k1neg:K,k1:J,k2neg:T,k2:z}=k.splitScalar(D);let{p:ue,f:_e}=this.wNAF(J),{p:G,f:E}=this.wNAF(z);ue=P.constTimeNegate(K,ue),G=P.constTimeNegate(T,G),G=new y(r.mul(G.px,k.beta),G.py,G.pz),j=ue.add(G),U=_e.add(E)}else{const{p:K,f:J}=this.wNAF(D);j=K,U=J}return y.normalizeZ([j,U])[0]}multiplyAndAddUnsafe(D,k,B){const j=y.BASE,U=(J,T)=>T===go||T===In||!J.equals(j)?J.multiplyUnsafe(T):J.multiply(T),K=U(this,k).add(U(D,B));return K.is0()?void 0:K}toAffine(D){return d(this,D)}isTorsionFree(){const{h:D,isTorsionFree:k}=e;if(D===In)return!0;if(k)return k(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:D,clearCofactor:k}=e;return D===In?this:k?k(y,this):this.multiplyUnsafe(e.h)}toRawBytes(D=!0){return Xc("isCompressed",D),this.assertValidity(),i(y,this,D)}toHex(D=!0){return Xc("isCompressed",D),Zc(this.toRawBytes(D))}}y.BASE=new y(e.Gx,e.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);const A=e.nBitLength,P=CC(y,e.endo?Math.ceil(A/2):A);return{CURVE:e,ProjectivePoint:y,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:a}}function LC(t){const e=l2(t);return Hf(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function kC(t){const e=LC(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(f){return di(f,n)}function a(f){return zg(f,n)}const{ProjectivePoint:u,normPrivateKeyToScalar:l,weierstrassEquation:d,isWithinCurveOrder:p}=NC({...e,toBytes(f,g,v){const x=g.toAffine(),_=r.toBytes(x.x),S=zf;return Xc("isCompressed",v),v?S(Uint8Array.from([g.hasEvenY()?2:3]),_):S(Uint8Array.from([4]),_,r.toBytes(x.y))},fromBytes(f){const g=f.length,v=f[0],x=f.subarray(1);if(g===i&&(v===2||v===3)){const _=Fa(x);if(!Yh(_,In,r.ORDER))throw new Error("Point is not on curve");const S=d(_);let b;try{b=r.sqrt(S)}catch(F){const ae=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+ae)}const M=(b&In)===In;return(v&1)===1!==M&&(b=r.neg(b)),{x:_,y:b}}else if(g===s&&v===4){const _=r.fromBytes(x.subarray(0,r.BYTES)),S=r.fromBytes(x.subarray(r.BYTES,2*r.BYTES));return{x:_,y:S}}else throw new Error(`Point of length ${g} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`)}}),y=f=>Zc(tu(f,e.nByteLength));function A(f){const g=n>>In;return f>g}function P(f){return A(f)?o(-f):f}const N=(f,g,v)=>Fa(f.slice(g,v));class D{constructor(g,v,x){this.r=g,this.s=v,this.recovery=x,this.assertValidity()}static fromCompact(g){const v=e.nByteLength;return g=ds("compactSignature",g,v*2),new D(N(g,0,v),N(g,v,2*v))}static fromDER(g){const{r:v,s:x}=po.toSig(ds("DER",g));return new D(v,x)}assertValidity(){ja("r",this.r,In,n),ja("s",this.s,In,n)}addRecoveryBit(g){return new D(this.r,this.s,g)}recoverPublicKey(g){const{r:v,s:x,recovery:_}=this,S=J(ds("msgHash",g));if(_==null||![0,1,2,3].includes(_))throw new Error("recovery id invalid");const b=_===2||_===3?v+e.n:v;if(b>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const M=_&1?"03":"02",I=u.fromHex(M+y(b)),F=a(b),ae=o(-S*F),O=o(x*F),se=u.BASE.multiplyAndAddUnsafe(I,ae,O);if(!se)throw new Error("point at infinify");return se.assertValidity(),se}hasHighS(){return A(this.s)}normalizeS(){return this.hasHighS()?new D(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return eu(this.toDERHex())}toDERHex(){return po.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return eu(this.toCompactHex())}toCompactHex(){return y(this.r)+y(this.s)}}const k={isValidPrivateKey(f){try{return l(f),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const f=u2(e.n);return MC(e.randomBytes(f),e.n)},precompute(f=8,g=u.BASE){return g._setWindowSize(f),g.multiply(BigInt(3)),g}};function B(f,g=!0){return u.fromPrivateKey(f).toRawBytes(g)}function j(f){const g=$a(f),v=typeof f=="string",x=(g||v)&&f.length;return g?x===i||x===s:v?x===2*i||x===2*s:f instanceof u}function U(f,g,v=!0){if(j(f))throw new Error("first arg must be private key");if(!j(g))throw new Error("second arg must be public key");return u.fromHex(g).multiply(l(f)).toRawBytes(v)}const K=e.bits2int||function(f){const g=Fa(f),v=f.length*8-e.nBitLength;return v>0?g>>BigInt(v):g},J=e.bits2int_modN||function(f){return o(K(f))},T=Fg(e.nBitLength);function z(f){return ja(`num < 2^${e.nBitLength}`,f,go,T),tu(f,e.nByteLength)}function ue(f,g,v=_e){if(["recovered","canonical"].some(X=>X in v))throw new Error("sign() legacy options not supported");const{hash:x,randomBytes:_}=e;let{lowS:S,prehash:b,extraEntropy:M}=v;S==null&&(S=!0),f=ds("msgHash",f),h2(v),b&&(f=ds("prehashed msgHash",x(f)));const I=J(f),F=l(g),ae=[z(F),z(I)];if(M!=null&&M!==!1){const X=M===!0?_(r.BYTES):M;ae.push(ds("extraEntropy",X))}const O=zf(...ae),se=I;function ee(X){const Q=K(X);if(!p(Q))return;const R=a(Q),Z=u.BASE.multiply(Q).toAffine(),te=o(Z.x);if(te===go)return;const le=o(R*o(se+te*F));if(le===go)return;let ie=(Z.x===te?0:2)|Number(Z.y&In),fe=le;return S&&A(le)&&(fe=P(le),ie^=1),new D(te,fe,ie)}return{seed:O,k2sig:ee}}const _e={lowS:e.lowS,prehash:!1},G={lowS:e.lowS,prehash:!1};function E(f,g,v=_e){const{seed:x,k2sig:_}=ue(f,g,v),S=e;return n2(S.hash.outputLen,S.nByteLength,S.hmac)(x,_)}u.BASE._setWindowSize(8);function m(f,g,v,x=G){var Z;const _=f;if(g=ds("msgHash",g),v=ds("publicKey",v),"strict"in x)throw new Error("options.strict was renamed to lowS");h2(x);const{lowS:S,prehash:b}=x;let M,I;try{if(typeof _=="string"||$a(_))try{M=D.fromDER(_)}catch(te){if(!(te instanceof po.Err))throw te;M=D.fromCompact(_)}else if(typeof _=="object"&&typeof _.r=="bigint"&&typeof _.s=="bigint"){const{r:te,s:le}=_;M=new D(te,le)}else throw new Error("PARSE");I=u.fromHex(v)}catch(te){if(te.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(S&&M.hasHighS())return!1;b&&(g=e.hash(g));const{r:F,s:ae}=M,O=J(g),se=a(ae),ee=o(O*se),X=o(F*se),Q=(Z=u.BASE.multiplyAndAddUnsafe(I,ee,X))==null?void 0:Z.toAffine();return Q?o(Q.x)===F:!1}return{CURVE:e,getPublicKey:B,getSharedSecret:U,sign:E,verify:m,ProjectivePoint:u,Signature:D,utils:k}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function BC(t){return{hash:t,hmac:(e,...r)=>Qw(t,e,kP(...r)),randomBytes:$P}}function $C(t,e){const r=n=>kC({...t,...BC(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const p2=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),g2=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),FC=BigInt(1),Kg=BigInt(2),m2=(t,e)=>(t+e/Kg)/e;function jC(t){const e=p2,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),u=BigInt(88),l=t*t*t%e,d=l*l*t%e,p=Ui(d,r,e)*d%e,y=Ui(p,r,e)*d%e,A=Ui(y,Kg,e)*l%e,P=Ui(A,i,e)*A%e,N=Ui(P,s,e)*P%e,D=Ui(N,a,e)*N%e,k=Ui(D,u,e)*D%e,B=Ui(k,a,e)*N%e,j=Ui(B,r,e)*d%e,U=Ui(j,o,e)*P%e,K=Ui(U,n,e)*l%e,J=Ui(K,Kg,e);if(!Vg.eql(Vg.sqr(J),t))throw new Error("Cannot find square root");return J}const Vg=a2(p2,void 0,void 0,{sqrt:jC}),v2=$C({a:BigInt(0),b:BigInt(7),Fp:Vg,n:g2,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=g2,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-FC*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=m2(s*t,e),u=m2(-n*t,e);let l=di(t-a*r-u*i,e),d=di(-a*n-u*s,e);const p=l>o,y=d>o;if(p&&(l=e-l),y&&(d=e-d),l>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:p,k1:l,k2neg:y,k2:d}}}},Pg);BigInt(0),v2.ProjectivePoint;const UC=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:v2},Symbol.toStringTag,{value:"Module"}));function qC(t,e){const{abi:r,args:n,bytecode:i,...s}=e,o=qI({abi:r,args:n,bytecode:i});return Dg(t,{...s,data:o})}async function zC(t){var r;return((r=t.account)==null?void 0:r.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(n=>Sf(n))}async function HC(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}async function WC(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>og(r))}async function KC(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function VC(t,{account:e=t.account,message:r}){if(!e)throw new Uf({docsPath:"/docs/actions/wallet/signMessage"});const n=fo(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Oh(r):r.raw instanceof Uint8Array?Dh(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function GC(t,e){var l,d,p,y;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTransaction"});const s=fo(r);qh({account:s,...e});const o=await fi(t,Hh,"getChainId")({});n!==null&&Yw({currentChainId:o,chain:n});const a=(n==null?void 0:n.formatters)||((l=t.chain)==null?void 0:l.formatters),u=((d=a==null?void 0:a.transactionRequest)==null?void 0:d.format)||Sg;return s.signTransaction?s.signTransaction({...i,chainId:o},{serializer:(y=(p=t.chain)==null?void 0:p.serializers)==null?void 0:y.transaction}):await t.request({method:"eth_signTransaction",params:[{...u(i),chainId:Pr(o),from:s.address}]},{retryCount:0})}async function YC(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTypedData"});const o=fo(r),a={EIP712Domain:aC({domain:n}),...e.types};if(oC({domain:n,message:i,primaryType:s,types:a}),o.signTypedData)return o.signTypedData({domain:n,message:i,primaryType:s,types:a});const u=sC({domain:n,message:i,primaryType:s,types:a});return t.request({method:"eth_signTypedData_v4",params:[o.address,u]},{retryCount:0})}async function JC(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:Pr(e)}]},{retryCount:0})}async function XC(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}function ZC(t){return{addChain:e=>KI(t,e),deployContract:e=>qC(t,e),getAddresses:()=>zC(t),getChainId:()=>Hh(t),getPermissions:()=>HC(t),prepareTransactionRequest:e=>Ig(t,e),requestAddresses:()=>WC(t),requestPermissions:e=>KC(t,e),sendRawTransaction:e=>Jw(t,e),sendTransaction:e=>Dg(t,e),signMessage:e=>VC(t,e),signTransaction:e=>GC(t,e),signTypedData:e=>YC(t,e),switchChain:e=>JC(t,e),watchAsset:e=>XC(t,e),writeContract:e=>WI(t,e)}}function QC(t){const{key:e="wallet",name:r="Wallet Client",transport:n}=t;return VI({...t,key:e,name:r,transport:n,type:"walletClient"}).extend(ZC)}class Wf{constructor(e){oo(this,"_key");oo(this,"_config",null);oo(this,"_provider",null);oo(this,"_connected",!1);oo(this,"_address",null);oo(this,"_fatured",!1);oo(this,"_installed",!1);oo(this,"lastUsed",!1);var r;if("name"in e&&"image"in e)this._key=e.name,this._config=e,this._fatured=e.featured;else if("session"in e){if(!e.session)throw new Error("session is null");this._key=(r=e.session)==null?void 0:r.peer.metadata.name,this._provider=e,this._config={name:e.session.peer.metadata.name,image:e.session.peer.metadata.icons[0],featured:!1}}else if("info"in e)console.log(e.info,"installed"),this._key=e.info.name,this._provider=e.provider,this._installed=!0,this._config={name:e.info.name,image:e.info.icon,featured:!1},this.testConnect();else throw new Error("unknown params")}get address(){return this._address}get connected(){return this._connected}get featured(){return this._fatured}get key(){return this._key}get installed(){return this._installed}get client(){return this._provider?QC({transport:QI(this._provider)}):null}get config(){return this._config}static fromWalletConfig(e){return new Wf(e)}EIP6963Detected(e){this._provider=e.provider,this._installed=!0,this._provider.on("disconnect",this.disconnect),this._provider.on("accountsChanged",r=>{this._address=r[0],this._connected=!0}),this.testConnect()}setUniversalProvider(e){this._provider=e,this.testConnect()}async testConnect(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());e&&e.length>0?(this._address=e[0],this._connected=!0):(this._address=null,this._connected=!1)}async connect(){var r;const e=await((r=this.client)==null?void 0:r.request({method:"eth_requestAccounts",params:void 0}));if(!e)throw new Error("connect failed");return e}async getAddress(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());if(!e)throw new Error("get address failed");return e[0]}async getChain(){var r;const e=await((r=this.client)==null?void 0:r.getChainId());if(!e)throw new Error("get chain failed");return e}async signMessage(e,r){var i;return await((i=this.client)==null?void 0:i.signMessage({message:e,account:r}))}async disconnect(){this._provider&&"session"in this._provider&&await this._provider.disconnect(),this._connected=!1,this._address=null}}var Gg={exports:{}},ru=typeof Reflect=="object"?Reflect:null,b2=ru&&typeof ru.apply=="function"?ru.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Jh;ru&&typeof ru.ownKeys=="function"?Jh=ru.ownKeys:Object.getOwnPropertySymbols?Jh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Jh=function(e){return Object.getOwnPropertyNames(e)};function eT(t){console&&console.warn&&console.warn(t)}var y2=Number.isNaN||function(e){return e!==e};function Rr(){Rr.init.call(this)}Gg.exports=Rr,Gg.exports.once=iT,Rr.EventEmitter=Rr,Rr.prototype._events=void 0,Rr.prototype._eventsCount=0,Rr.prototype._maxListeners=void 0;var w2=10;function Xh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Rr,"defaultMaxListeners",{enumerable:!0,get:function(){return w2},set:function(t){if(typeof t!="number"||t<0||y2(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");w2=t}}),Rr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Rr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||y2(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function x2(t){return t._maxListeners===void 0?Rr.defaultMaxListeners:t._maxListeners}Rr.prototype.getMaxListeners=function(){return x2(this)},Rr.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")b2(u,this,r);else for(var l=u.length,d=P2(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,eT(a)}return t}Rr.prototype.addListener=function(e,r){return _2(this,e,r,!1)},Rr.prototype.on=Rr.prototype.addListener,Rr.prototype.prependListener=function(e,r){return _2(this,e,r,!0)};function tT(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function E2(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=tT.bind(n);return i.listener=r,n.wrapFn=i,i}Rr.prototype.once=function(e,r){return Xh(r),this.on(e,E2(this,e,r)),this},Rr.prototype.prependOnceListener=function(e,r){return Xh(r),this.prependListener(e,E2(this,e,r)),this},Rr.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Xh(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():rT(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Rr.prototype.off=Rr.prototype.removeListener,Rr.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function S2(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?nT(i):P2(i,i.length)}Rr.prototype.listeners=function(e){return S2(this,e,!0)},Rr.prototype.rawListeners=function(e){return S2(this,e,!1)},Rr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):A2.call(t,e)},Rr.prototype.listenerCount=A2;function A2(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Rr.prototype.eventNames=function(){return this._eventsCount>0?Jh(this._events):[]};function P2(t,e){for(var r=new Array(e),n=0;n=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function uT(t,e){return function(r,n){e(r,n,t)}}function fT(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function lT(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(d){try{l(n.next(d))}catch(g){o(g)}}function u(d){try{l(n.throw(d))}catch(g){o(g)}}function l(d){d.done?s(d.value):i(d.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function hT(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return u([l,d])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function I2(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function gT(){for(var t=[],e=0;e1||a(y,A)})})}function a(y,A){try{u(n[y](A))}catch(P){g(s[0][3],P)}}function u(y){y.value instanceof Kf?Promise.resolve(y.value.v).then(l,d):g(s[0][2],y)}function l(y){a("next",y)}function d(y){a("throw",y)}function g(y,A){y(A),s.shift(),s.length&&a(s[0][0],s[0][1])}}function bT(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Kf(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function yT(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Zg=="function"?Zg(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function wT(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function xT(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function _T(t){return t&&t.__esModule?t:{default:t}}function ET(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function ST(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const Vf=Jp(Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Xg},__asyncDelegator:bT,__asyncGenerator:vT,__asyncValues:yT,__await:Kf,__awaiter:lT,__classPrivateFieldGet:ET,__classPrivateFieldSet:ST,__createBinding:dT,__decorate:cT,__exportStar:pT,__extends:oT,__generator:hT,__importDefault:_T,__importStar:xT,__makeTemplateObject:wT,__metadata:fT,__param:uT,__read:I2,__rest:aT,__spread:gT,__spreadArrays:mT,__values:Zg},Symbol.toStringTag,{value:"Module"})));var Qg={},Gf={},C2;function AT(){if(C2)return Gf;C2=1,Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Gf.delay=t,Gf}var qa={},em={},za={},T2;function PT(){return T2||(T2=1,Object.defineProperty(za,"__esModule",{value:!0}),za.ONE_THOUSAND=za.ONE_HUNDRED=void 0,za.ONE_HUNDRED=100,za.ONE_THOUSAND=1e3),za}var tm={},R2;function MT(){return R2||(R2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(tm)),tm}var D2;function O2(){return D2||(D2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(PT(),t),e.__exportStar(MT(),t)}(em)),em}var N2;function IT(){if(N2)return qa;N2=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.fromMiliseconds=qa.toMiliseconds=void 0;const t=O2();function e(n){return n*t.ONE_THOUSAND}qa.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return qa.fromMiliseconds=r,qa}var L2;function CT(){return L2||(L2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(AT(),t),e.__exportStar(IT(),t)}(Qg)),Qg}var nu={},k2;function TT(){if(k2)return nu;k2=1,Object.defineProperty(nu,"__esModule",{value:!0}),nu.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return nu.Watch=t,nu.default=t,nu}var rm={},Yf={},B2;function RT(){if(B2)return Yf;B2=1,Object.defineProperty(Yf,"__esModule",{value:!0}),Yf.IWatch=void 0;class t{}return Yf.IWatch=t,Yf}var $2;function DT(){return $2||($2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Vf.__exportStar(RT(),t)}(rm)),rm}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(CT(),t),e.__exportStar(TT(),t),e.__exportStar(DT(),t),e.__exportStar(O2(),t)})(mt);class Ha{}let OT=class extends Ha{constructor(e){super()}};const F2=mt.FIVE_SECONDS,iu={pulse:"heartbeat_pulse"};let NT=class GA extends OT{constructor(e){super(e),this.events=new qi.EventEmitter,this.interval=F2,this.interval=(e==null?void 0:e.interval)||F2}static async init(e){const r=new GA(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),mt.toMiliseconds(this.interval))}pulse(){this.events.emit(iu.pulse)}};const LT=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,kT=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,BT=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function $T(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){FT(t);return}return e}function FT(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Zh(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!BT.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(LT.test(t)||kT.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,$T)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function jT(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Cn(t,...e){try{return jT(t(...e))}catch(r){return Promise.reject(r)}}function UT(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function qT(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Qh(t){if(UT(t))return String(t);if(qT(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Qh(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function j2(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const nm="base64:";function zT(t){if(typeof t=="string")return t;j2();const e=Buffer.from(t).toString("base64");return nm+e}function HT(t){return typeof t!="string"||!t.startsWith(nm)?t:(j2(),Buffer.from(t.slice(nm.length),"base64"))}function pi(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function WT(...t){return pi(t.join(":"))}function ed(t){return t=pi(t),t?t+":":""}function doe(t){return t}const KT="memory",VT=()=>{const t=new Map;return{name:KT,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function GT(t={}){const e={mounts:{"":t.driver||VT()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const d of e.mountpoints)if(l.startsWith(d))return{base:d,relativeKey:l.slice(d.length),driver:e.mounts[d]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,d)=>e.mountpoints.filter(g=>g.startsWith(l)||d&&l.startsWith(g)).map(g=>({relativeBase:l.length>g.length?l.slice(g.length):void 0,mountpoint:g,driver:e.mounts[g]})),i=(l,d)=>{if(e.watching){d=pi(d);for(const g of e.watchListeners)g(l,d)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await U2(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,d,g)=>{const y=new Map,A=P=>{let N=y.get(P.base);return N||(N={driver:P.driver,base:P.base,items:[]},y.set(P.base,N)),N};for(const P of l){const N=typeof P=="string",D=pi(N?P:P.key),k=N?void 0:P.value,B=N||!P.options?d:{...d,...P.options},j=r(D);A(j).items.push({key:D,value:k,relativeKey:j.relativeKey,options:B})}return Promise.all([...y.values()].map(P=>g(P))).then(P=>P.flat())},u={hasItem(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return Cn(y.hasItem,g,d)},getItem(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return Cn(y.getItem,g,d).then(A=>Zh(A))},getItems(l,d){return a(l,d,g=>g.driver.getItems?Cn(g.driver.getItems,g.items.map(y=>({key:y.relativeKey,options:y.options})),d).then(y=>y.map(A=>({key:WT(g.base,A.key),value:Zh(A.value)}))):Promise.all(g.items.map(y=>Cn(g.driver.getItem,y.relativeKey,y.options).then(A=>({key:y.key,value:Zh(A)})))))},getItemRaw(l,d={}){l=pi(l);const{relativeKey:g,driver:y}=r(l);return y.getItemRaw?Cn(y.getItemRaw,g,d):Cn(y.getItem,g,d).then(A=>HT(A))},async setItem(l,d,g={}){if(d===void 0)return u.removeItem(l);l=pi(l);const{relativeKey:y,driver:A}=r(l);A.setItem&&(await Cn(A.setItem,y,Qh(d),g),A.watch||i("update",l))},async setItems(l,d){await a(l,d,async g=>{if(g.driver.setItems)return Cn(g.driver.setItems,g.items.map(y=>({key:y.relativeKey,value:Qh(y.value),options:y.options})),d);g.driver.setItem&&await Promise.all(g.items.map(y=>Cn(g.driver.setItem,y.relativeKey,Qh(y.value),y.options)))})},async setItemRaw(l,d,g={}){if(d===void 0)return u.removeItem(l,g);l=pi(l);const{relativeKey:y,driver:A}=r(l);if(A.setItemRaw)await Cn(A.setItemRaw,y,d,g);else if(A.setItem)await Cn(A.setItem,y,zT(d),g);else return;A.watch||i("update",l)},async removeItem(l,d={}){typeof d=="boolean"&&(d={removeMeta:d}),l=pi(l);const{relativeKey:g,driver:y}=r(l);y.removeItem&&(await Cn(y.removeItem,g,d),(d.removeMeta||d.removeMata)&&await Cn(y.removeItem,g+"$",d),y.watch||i("remove",l))},async getMeta(l,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),l=pi(l);const{relativeKey:g,driver:y}=r(l),A=Object.create(null);if(y.getMeta&&Object.assign(A,await Cn(y.getMeta,g,d)),!d.nativeOnly){const P=await Cn(y.getItem,g+"$",d).then(N=>Zh(N));P&&typeof P=="object"&&(typeof P.atime=="string"&&(P.atime=new Date(P.atime)),typeof P.mtime=="string"&&(P.mtime=new Date(P.mtime)),Object.assign(A,P))}return A},setMeta(l,d,g={}){return this.setItem(l+"$",d,g)},removeMeta(l,d={}){return this.removeItem(l+"$",d)},async getKeys(l,d={}){l=ed(l);const g=n(l,!0);let y=[];const A=[];for(const P of g){const N=await Cn(P.driver.getKeys,P.relativeBase,d);for(const D of N){const k=P.mountpoint+pi(D);y.some(B=>k.startsWith(B))||A.push(k)}y=[P.mountpoint,...y.filter(D=>!D.startsWith(P.mountpoint))]}return l?A.filter(P=>P.startsWith(l)&&P[P.length-1]!=="$"):A.filter(P=>P[P.length-1]!=="$")},async clear(l,d={}){l=ed(l),await Promise.all(n(l,!1).map(async g=>{if(g.driver.clear)return Cn(g.driver.clear,g.relativeBase,d);if(g.driver.removeItem){const y=await g.driver.getKeys(g.relativeBase||"",d);return Promise.all(y.map(A=>g.driver.removeItem(A,d)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>q2(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(d=>d!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,d){if(l=ed(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((g,y)=>y.length-g.length)),e.mounts[l]=d,e.watching&&Promise.resolve(U2(d,i,l)).then(g=>{e.unwatch[l]=g}).catch(console.error),u},async unmount(l,d=!0){l=ed(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),d&&await q2(e.mounts[l]),e.mountpoints=e.mountpoints.filter(g=>g!==l),delete e.mounts[l])},getMount(l=""){l=pi(l)+":";const d=r(l);return{driver:d.driver,base:d.base}},getMounts(l="",d={}){return l=pi(l),n(l,d.parents).map(y=>({driver:y.driver,base:y.mountpoint}))},keys:(l,d={})=>u.getKeys(l,d),get:(l,d={})=>u.getItem(l,d),set:(l,d,g={})=>u.setItem(l,d,g),has:(l,d={})=>u.hasItem(l,d),del:(l,d={})=>u.removeItem(l,d),remove:(l,d={})=>u.removeItem(l,d)};return u}function U2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function q2(t){typeof t.dispose=="function"&&await Cn(t.dispose)}function Wa(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function z2(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Wa(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let im;function Jf(){return im||(im=z2("keyval-store","keyval")),im}function H2(t,e=Jf()){return e("readonly",r=>Wa(r.get(t)))}function YT(t,e,r=Jf()){return r("readwrite",n=>(n.put(e,t),Wa(n.transaction)))}function JT(t,e=Jf()){return e("readwrite",r=>(r.delete(t),Wa(r.transaction)))}function XT(t=Jf()){return t("readwrite",e=>(e.clear(),Wa(e.transaction)))}function ZT(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Wa(t.transaction)}function QT(t=Jf()){return t("readonly",e=>{if(e.getAllKeys)return Wa(e.getAllKeys());const r=[];return ZT(e,n=>r.push(n.key)).then(()=>r)})}const eR=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),tR=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Ka(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return tR(t)}catch{return t}}function mo(t){return typeof t=="string"?t:eR(t)||""}const rR="idb-keyval";var nR=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=z2(t.dbName,t.storeName)),{name:rR,options:t,async hasItem(i){return!(typeof await H2(r(i),n)>"u")},async getItem(i){return await H2(r(i),n)??null},setItem(i,s){return YT(r(i),s,n)},removeItem(i){return JT(r(i),n)},getKeys(){return QT(n)},clear(){return XT(n)}}};const iR="WALLET_CONNECT_V2_INDEXED_DB",sR="keyvaluestorage";let oR=class{constructor(){this.indexedDb=GT({driver:nR({dbName:iR,storeName:sR})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,mo(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var sm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},td={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof sm<"u"&&sm.localStorage?td.exports=sm.localStorage:typeof window<"u"&&window.localStorage?td.exports=window.localStorage:td.exports=new e})();function aR(t){var e;return[t[0],Ka((e=t[1])!=null?e:"")]}let cR=class{constructor(){this.localStorage=td.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(aR)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Ka(r)}async setItem(e,r){this.localStorage.setItem(e,mo(r))}async removeItem(e){this.localStorage.removeItem(e)}};const uR="wc_storage_version",W2=1,fR=async(t,e,r)=>{const n=uR,i=await e.getItem(n);if(i&&i>=W2){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,W2),r(e),lR(t,o)},lR=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let hR=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new cR;this.storage=e;try{const r=new oR;fR(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function dR(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var pR=gR;function gR(t,e,r){var n=r&&r.stringify||dR,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?g:0,t.charCodeAt(A+1)){case 100:case 102:if(d>=u||e[d]==null)break;g=u||e[d]==null)break;g=u||e[d]===void 0)break;g",g=A+2,A++;break}l+=n(e[d]),g=A+2,A++;break;case 115:if(d>=u)break;g-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",u=Object.create(r);u.log||(u.log=Zf),Object.defineProperty(u,"levelVal",{get:d}),Object.defineProperty(u,"level",{get:g,set:y});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:_R(t)};u.levels=vo.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Zf,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=A,e&&(u._logEvent=om());function d(){return this.level==="silent"?1/0:this.levels.values[this.level]}function g(){return this._level}function y(P){if(P!=="silent"&&!this.levels.values[P])throw Error("unknown level "+P);this._level=P,ou(l,u,"error","log"),ou(l,u,"fatal","error"),ou(l,u,"warn","error"),ou(l,u,"info","log"),ou(l,u,"debug","log"),ou(l,u,"trace","log")}function A(P,N){if(!P)throw new Error("missing bindings for child Pino");N=N||{},i&&P.serializers&&(N.serializers=P.serializers);const D=N.serializers;if(i&&D){var k=Object.assign({},n,D),B=t.browser.serialize===!0?Object.keys(k):i;delete P.serializers,rd([P],B,k,this._stdErrSerialize)}function j(U){this._childLevel=(U._childLevel|0)+1,this.error=au(U,P,"error"),this.fatal=au(U,P,"fatal"),this.warn=au(U,P,"warn"),this.info=au(U,P,"info"),this.debug=au(U,P,"debug"),this.trace=au(U,P,"trace"),k&&(this.serializers=k,this._serialize=B),e&&(this._logEvent=om([].concat(U._logEvent.bindings,P)))}return j.prototype=this,new j(this)}return u}vo.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},vo.stdSerializers=mR,vo.stdTimeFunctions=Object.assign({},{nullTime:V2,epochTime:G2,unixTime:ER,isoTime:SR});function ou(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Zf:i[r]?i[r]:Xf[r]||Xf[n]||Zf,bR(t,e,r)}function bR(t,e,r){!t.transmit&&e[r]===Zf||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Xf?Xf:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function au(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},J2=class{constructor(e,r=cm){this.level=e??"error",this.levelValue=su.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Y2(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===su.levels.values.error?console.error(e):r===su.levels.values.warn?console.warn(e):r===su.levels.values.debug?console.debug(e):r===su.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(mo({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new Y2(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(mo({extraMetadata:e})),new Blob(r,{type:"application/json"})}},IR=class{constructor(e,r=cm){this.baseChunkLogger=new J2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},CR=class{constructor(e,r=cm){this.baseChunkLogger=new J2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var TR=Object.defineProperty,RR=Object.defineProperties,DR=Object.getOwnPropertyDescriptors,X2=Object.getOwnPropertySymbols,OR=Object.prototype.hasOwnProperty,NR=Object.prototype.propertyIsEnumerable,Z2=(t,e,r)=>e in t?TR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,id=(t,e)=>{for(var r in e||(e={}))OR.call(e,r)&&Z2(t,r,e[r]);if(X2)for(var r of X2(e))NR.call(e,r)&&Z2(t,r,e[r]);return t},sd=(t,e)=>RR(t,DR(e));function od(t){return sd(id({},t),{level:(t==null?void 0:t.level)||PR.level})}function LR(t,e=el){return t[e]||""}function kR(t,e,r=el){return t[r]=e,t}function gi(t,e=el){let r="";return typeof t.bindings>"u"?r=LR(t,e):r=t.bindings().context||"",r}function BR(t,e,r=el){const n=gi(t,r);return n.trim()?`${n}/${e}`:e}function ri(t,e,r=el){const n=BR(t,e,r),i=t.child({context:n});return kR(i,n,r)}function $R(t){var e,r;const n=new IR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace",browser:sd(id({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function FR(t){var e;const r=new CR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function jR(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?$R(t):FR(t)}let UR=class extends Ha{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},qR=class extends Ha{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},zR=class{constructor(e,r){this.logger=e,this.core=r}},HR=class extends Ha{constructor(e,r){super(),this.relayer=e,this.logger=r}},WR=class extends Ha{constructor(e){super()}},KR=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},VR=class extends Ha{constructor(e,r){super(),this.relayer=e,this.logger=r}},GR=class extends Ha{constructor(e,r){super(),this.core=e,this.logger=r}},YR=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},JR=class{constructor(e,r){this.projectId=e,this.logger=r}},XR=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},ZR=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},QR=class{constructor(e){this.client=e}};var um={},ta={},ad={},cd={};Object.defineProperty(cd,"__esModule",{value:!0}),cd.BrowserRandomSource=void 0;const Q2=65536;class eD{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let n=0;n>>16&65535,d=a&65535,g=u>>>16&65535,y=u&65535;return d*y+(l*y+d*g<<16>>>0)|0}t.mul=Math.imul||e;function r(a,u){return a+u|0}t.add=r;function n(a,u){return a-u|0}t.sub=n;function i(a,u){return a<>>32-u}t.rotl=i;function s(a,u){return a<<32-u|a>>>u}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(tx),Object.defineProperty(or,"__esModule",{value:!0});var rx=tx;function aD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}or.readInt16BE=aD;function cD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}or.readUint16BE=cD;function uD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}or.readInt16LE=uD;function fD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}or.readUint16LE=fD;function nx(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}or.writeUint16BE=nx,or.writeInt16BE=nx;function ix(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}or.writeUint16LE=ix,or.writeInt16LE=ix;function fm(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}or.readInt32BE=fm;function lm(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}or.readUint32BE=lm;function hm(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}or.readInt32LE=hm;function dm(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}or.readUint32LE=dm;function fd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}or.writeUint32BE=fd,or.writeInt32BE=fd;function ld(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}or.writeUint32LE=ld,or.writeInt32LE=ld;function lD(t,e){e===void 0&&(e=0);var r=fm(t,e),n=fm(t,e+4);return r*4294967296+n-(n>>31)*4294967296}or.readInt64BE=lD;function hD(t,e){e===void 0&&(e=0);var r=lm(t,e),n=lm(t,e+4);return r*4294967296+n}or.readUint64BE=hD;function dD(t,e){e===void 0&&(e=0);var r=hm(t,e),n=hm(t,e+4);return n*4294967296+r-(r>>31)*4294967296}or.readInt64LE=dD;function pD(t,e){e===void 0&&(e=0);var r=dm(t,e),n=dm(t,e+4);return n*4294967296+r}or.readUint64LE=pD;function sx(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fd(t/4294967296>>>0,e,r),fd(t>>>0,e,r+4),e}or.writeUint64BE=sx,or.writeInt64BE=sx;function ox(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ld(t>>>0,e,r),ld(t/4294967296>>>0,e,r+4),e}or.writeUint64LE=ox,or.writeInt64LE=ox;function gD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}or.readUintBE=gD;function mD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}or.writeUintBE=vD;function bD(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!rx.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s256)throw new Error("randomString charset is too long");let y="";const A=d.length,P=256-256%A;for(;l>0;){const N=i(Math.ceil(l*256/P),g);for(let D=0;D0;D++){const k=N[D];k0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,g=l/536870912|0,y=l<<3,A=l%128<112?128:256;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._stateHi.set(u.stateHi),this._stateLo.set(u.stateLo),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.stateHi),r.wipe(u.stateLo),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,u,l,d,g,y,A){for(var P=l[0],N=l[1],D=l[2],k=l[3],B=l[4],j=l[5],U=l[6],K=l[7],J=d[0],T=d[1],z=d[2],ue=d[3],_e=d[4],G=d[5],E=d[6],m=d[7],f,p,v,x,_,S,b,M;A>=128;){for(var I=0;I<16;I++){var F=8*I+y;a[I]=e.readUint32BE(g,F),u[I]=e.readUint32BE(g,F+4)}for(var I=0;I<80;I++){var ae=P,O=N,se=D,ee=k,X=B,Q=j,R=U,Z=K,te=J,le=T,ie=z,fe=ue,ve=_e,Me=G,Ne=E,Te=m;if(f=K,p=m,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=(B>>>14|_e<<18)^(B>>>18|_e<<14)^(_e>>>9|B<<23),p=(_e>>>14|B<<18)^(_e>>>18|B<<14)^(B>>>9|_e<<23),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=B&j^~B&U,p=_e&G^~_e&E,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=i[I*2],p=i[I*2+1],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=a[I%16],p=u[I%16],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,v=b&65535|M<<16,x=_&65535|S<<16,f=v,p=x,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=(P>>>28|J<<4)^(J>>>2|P<<30)^(J>>>7|P<<25),p=(J>>>28|P<<4)^(P>>>2|J<<30)^(P>>>7|J<<25),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,f=P&N^P&D^N&D,p=J&T^J&z^T&z,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,Z=b&65535|M<<16,Te=_&65535|S<<16,f=ee,p=fe,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=v,p=x,_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,ee=b&65535|M<<16,fe=_&65535|S<<16,N=ae,D=O,k=se,B=ee,j=X,U=Q,K=R,P=Z,T=te,z=le,ue=ie,_e=fe,G=ve,E=Me,m=Ne,J=Te,I%16===15)for(var F=0;F<16;F++)f=a[F],p=u[F],_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=a[(F+9)%16],p=u[(F+9)%16],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,v=a[(F+1)%16],x=u[(F+1)%16],f=(v>>>1|x<<31)^(v>>>8|x<<24)^v>>>7,p=(x>>>1|v<<31)^(x>>>8|v<<24)^(x>>>7|v<<25),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,v=a[(F+14)%16],x=u[(F+14)%16],f=(v>>>19|x<<13)^(x>>>29|v<<3)^v>>>6,p=(x>>>19|v<<13)^(v>>>29|x<<3)^(x>>>6|v<<26),_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,a[F]=b&65535|M<<16,u[F]=_&65535|S<<16}f=P,p=J,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[0],p=d[0],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[0]=P=b&65535|M<<16,d[0]=J=_&65535|S<<16,f=N,p=T,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[1],p=d[1],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[1]=N=b&65535|M<<16,d[1]=T=_&65535|S<<16,f=D,p=z,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[2],p=d[2],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[2]=D=b&65535|M<<16,d[2]=z=_&65535|S<<16,f=k,p=ue,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[3],p=d[3],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[3]=k=b&65535|M<<16,d[3]=ue=_&65535|S<<16,f=B,p=_e,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[4],p=d[4],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[4]=B=b&65535|M<<16,d[4]=_e=_&65535|S<<16,f=j,p=G,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[5],p=d[5],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[5]=j=b&65535|M<<16,d[5]=G=_&65535|S<<16,f=U,p=E,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[6],p=d[6],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[6]=U=b&65535|M<<16,d[6]=E=_&65535|S<<16,f=K,p=m,_=p&65535,S=p>>>16,b=f&65535,M=f>>>16,f=l[7],p=d[7],_+=p&65535,S+=p>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[7]=K=b&65535|M<<16,d[7]=m=_&65535|S<<16,y+=128,A-=128}return y}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ax),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=ta,r=ax,n=Mi;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(ee){const X=new Float64Array(16);if(ee)for(let Q=0;Q>16&1),Q[le-1]&=65535;Q[15]=R[15]-32767-(Q[14]>>16&1);const te=Q[15]>>16&1;Q[14]&=65535,N(R,Q,1-te)}for(let Z=0;Z<16;Z++)ee[2*Z]=R[Z]&255,ee[2*Z+1]=R[Z]>>8}function k(ee,X){let Q=0;for(let R=0;R<32;R++)Q|=ee[R]^X[R];return(1&Q-1>>>8)-1}function B(ee,X){const Q=new Uint8Array(32),R=new Uint8Array(32);return D(Q,ee),D(R,X),k(Q,R)}function j(ee){const X=new Uint8Array(32);return D(X,ee),X[0]&1}function U(ee,X){for(let Q=0;Q<16;Q++)ee[Q]=X[2*Q]+(X[2*Q+1]<<8);ee[15]&=32767}function K(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]+Q[R]}function J(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]-Q[R]}function T(ee,X,Q){let R,Z,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=0,Ie=0,Le=0,Ve=0,ke=0,ze=0,He=0,Ee=0,Qe=0,ct=0,Be=0,et=0,rt=0,Je=0,pt=0,ht=0,ft=0,Ht=0,Jt=0,St=0,er=0,Xt=0,Ot=0,Bt=Q[0],Tt=Q[1],vt=Q[2],Dt=Q[3],Lt=Q[4],bt=Q[5],$t=Q[6],jt=Q[7],nt=Q[8],Ft=Q[9],$=Q[10],H=Q[11],V=Q[12],C=Q[13],Y=Q[14],q=Q[15];R=X[0],te+=R*Bt,le+=R*Tt,ie+=R*vt,fe+=R*Dt,ve+=R*Lt,Me+=R*bt,Ne+=R*$t,Te+=R*jt,$e+=R*nt,Ie+=R*Ft,Le+=R*$,Ve+=R*H,ke+=R*V,ze+=R*C,He+=R*Y,Ee+=R*q,R=X[1],le+=R*Bt,ie+=R*Tt,fe+=R*vt,ve+=R*Dt,Me+=R*Lt,Ne+=R*bt,Te+=R*$t,$e+=R*jt,Ie+=R*nt,Le+=R*Ft,Ve+=R*$,ke+=R*H,ze+=R*V,He+=R*C,Ee+=R*Y,Qe+=R*q,R=X[2],ie+=R*Bt,fe+=R*Tt,ve+=R*vt,Me+=R*Dt,Ne+=R*Lt,Te+=R*bt,$e+=R*$t,Ie+=R*jt,Le+=R*nt,Ve+=R*Ft,ke+=R*$,ze+=R*H,He+=R*V,Ee+=R*C,Qe+=R*Y,ct+=R*q,R=X[3],fe+=R*Bt,ve+=R*Tt,Me+=R*vt,Ne+=R*Dt,Te+=R*Lt,$e+=R*bt,Ie+=R*$t,Le+=R*jt,Ve+=R*nt,ke+=R*Ft,ze+=R*$,He+=R*H,Ee+=R*V,Qe+=R*C,ct+=R*Y,Be+=R*q,R=X[4],ve+=R*Bt,Me+=R*Tt,Ne+=R*vt,Te+=R*Dt,$e+=R*Lt,Ie+=R*bt,Le+=R*$t,Ve+=R*jt,ke+=R*nt,ze+=R*Ft,He+=R*$,Ee+=R*H,Qe+=R*V,ct+=R*C,Be+=R*Y,et+=R*q,R=X[5],Me+=R*Bt,Ne+=R*Tt,Te+=R*vt,$e+=R*Dt,Ie+=R*Lt,Le+=R*bt,Ve+=R*$t,ke+=R*jt,ze+=R*nt,He+=R*Ft,Ee+=R*$,Qe+=R*H,ct+=R*V,Be+=R*C,et+=R*Y,rt+=R*q,R=X[6],Ne+=R*Bt,Te+=R*Tt,$e+=R*vt,Ie+=R*Dt,Le+=R*Lt,Ve+=R*bt,ke+=R*$t,ze+=R*jt,He+=R*nt,Ee+=R*Ft,Qe+=R*$,ct+=R*H,Be+=R*V,et+=R*C,rt+=R*Y,Je+=R*q,R=X[7],Te+=R*Bt,$e+=R*Tt,Ie+=R*vt,Le+=R*Dt,Ve+=R*Lt,ke+=R*bt,ze+=R*$t,He+=R*jt,Ee+=R*nt,Qe+=R*Ft,ct+=R*$,Be+=R*H,et+=R*V,rt+=R*C,Je+=R*Y,pt+=R*q,R=X[8],$e+=R*Bt,Ie+=R*Tt,Le+=R*vt,Ve+=R*Dt,ke+=R*Lt,ze+=R*bt,He+=R*$t,Ee+=R*jt,Qe+=R*nt,ct+=R*Ft,Be+=R*$,et+=R*H,rt+=R*V,Je+=R*C,pt+=R*Y,ht+=R*q,R=X[9],Ie+=R*Bt,Le+=R*Tt,Ve+=R*vt,ke+=R*Dt,ze+=R*Lt,He+=R*bt,Ee+=R*$t,Qe+=R*jt,ct+=R*nt,Be+=R*Ft,et+=R*$,rt+=R*H,Je+=R*V,pt+=R*C,ht+=R*Y,ft+=R*q,R=X[10],Le+=R*Bt,Ve+=R*Tt,ke+=R*vt,ze+=R*Dt,He+=R*Lt,Ee+=R*bt,Qe+=R*$t,ct+=R*jt,Be+=R*nt,et+=R*Ft,rt+=R*$,Je+=R*H,pt+=R*V,ht+=R*C,ft+=R*Y,Ht+=R*q,R=X[11],Ve+=R*Bt,ke+=R*Tt,ze+=R*vt,He+=R*Dt,Ee+=R*Lt,Qe+=R*bt,ct+=R*$t,Be+=R*jt,et+=R*nt,rt+=R*Ft,Je+=R*$,pt+=R*H,ht+=R*V,ft+=R*C,Ht+=R*Y,Jt+=R*q,R=X[12],ke+=R*Bt,ze+=R*Tt,He+=R*vt,Ee+=R*Dt,Qe+=R*Lt,ct+=R*bt,Be+=R*$t,et+=R*jt,rt+=R*nt,Je+=R*Ft,pt+=R*$,ht+=R*H,ft+=R*V,Ht+=R*C,Jt+=R*Y,St+=R*q,R=X[13],ze+=R*Bt,He+=R*Tt,Ee+=R*vt,Qe+=R*Dt,ct+=R*Lt,Be+=R*bt,et+=R*$t,rt+=R*jt,Je+=R*nt,pt+=R*Ft,ht+=R*$,ft+=R*H,Ht+=R*V,Jt+=R*C,St+=R*Y,er+=R*q,R=X[14],He+=R*Bt,Ee+=R*Tt,Qe+=R*vt,ct+=R*Dt,Be+=R*Lt,et+=R*bt,rt+=R*$t,Je+=R*jt,pt+=R*nt,ht+=R*Ft,ft+=R*$,Ht+=R*H,Jt+=R*V,St+=R*C,er+=R*Y,Xt+=R*q,R=X[15],Ee+=R*Bt,Qe+=R*Tt,ct+=R*vt,Be+=R*Dt,et+=R*Lt,rt+=R*bt,Je+=R*$t,pt+=R*jt,ht+=R*nt,ft+=R*Ft,Ht+=R*$,Jt+=R*H,St+=R*V,er+=R*C,Xt+=R*Y,Ot+=R*q,te+=38*Qe,le+=38*ct,ie+=38*Be,fe+=38*et,ve+=38*rt,Me+=38*Je,Ne+=38*pt,Te+=38*ht,$e+=38*ft,Ie+=38*Ht,Le+=38*Jt,Ve+=38*St,ke+=38*er,ze+=38*Xt,He+=38*Ot,Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),ee[0]=te,ee[1]=le,ee[2]=ie,ee[3]=fe,ee[4]=ve,ee[5]=Me,ee[6]=Ne,ee[7]=Te,ee[8]=$e,ee[9]=Ie,ee[10]=Le,ee[11]=Ve,ee[12]=ke,ee[13]=ze,ee[14]=He,ee[15]=Ee}function z(ee,X){T(ee,X,X)}function ue(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=253;R>=0;R--)z(Q,Q),R!==2&&R!==4&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function _e(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=250;R>=0;R--)z(Q,Q),R!==1&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function G(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i(),ve=i(),Me=i();J(Q,ee[1],ee[0]),J(Me,X[1],X[0]),T(Q,Q,Me),K(R,ee[0],ee[1]),K(Me,X[0],X[1]),T(R,R,Me),T(Z,ee[3],X[3]),T(Z,Z,l),T(te,ee[2],X[2]),K(te,te,te),J(le,R,Q),J(ie,te,Z),K(fe,te,Z),K(ve,R,Q),T(ee[0],le,ie),T(ee[1],ve,fe),T(ee[2],fe,ie),T(ee[3],le,ve)}function E(ee,X,Q){for(let R=0;R<4;R++)N(ee[R],X[R],Q)}function m(ee,X){const Q=i(),R=i(),Z=i();ue(Z,X[2]),T(Q,X[0],Z),T(R,X[1],Z),D(ee,R),ee[31]^=j(Q)<<7}function f(ee,X,Q){A(ee[0],o),A(ee[1],a),A(ee[2],a),A(ee[3],o);for(let R=255;R>=0;--R){const Z=Q[R/8|0]>>(R&7)&1;E(ee,X,Z),G(X,ee),G(ee,ee),E(ee,X,Z)}}function p(ee,X){const Q=[i(),i(),i(),i()];A(Q[0],d),A(Q[1],g),A(Q[2],a),T(Q[3],d,g),f(ee,Q,X)}function v(ee){if(ee.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const X=(0,r.hash)(ee);X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(32),R=[i(),i(),i(),i()];p(R,X),m(Q,R);const Z=new Uint8Array(64);return Z.set(ee),Z.set(Q,32),{publicKey:Q,secretKey:Z}}t.generateKeyPairFromSeed=v;function x(ee){const X=(0,e.randomBytes)(32,ee),Q=v(X);return(0,n.wipe)(X),Q}t.generateKeyPair=x;function _(ee){if(ee.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(ee.subarray(32))}t.extractPublicKeyFromSecretKey=_;const S=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function b(ee,X){let Q,R,Z,te;for(R=63;R>=32;--R){for(Q=0,Z=R-32,te=R-12;Z>4)*S[Z],Q=X[Z]>>8,X[Z]&=255;for(Z=0;Z<32;Z++)X[Z]-=Q*S[Z];for(R=0;R<32;R++)X[R+1]+=X[R]>>8,ee[R]=X[R]&255}function M(ee){const X=new Float64Array(64);for(let Q=0;Q<64;Q++)X[Q]=ee[Q];for(let Q=0;Q<64;Q++)ee[Q]=0;b(ee,X)}function I(ee,X){const Q=new Float64Array(64),R=[i(),i(),i(),i()],Z=(0,r.hash)(ee.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(64);te.set(Z.subarray(32),32);const le=new r.SHA512;le.update(te.subarray(32)),le.update(X);const ie=le.digest();le.clean(),M(ie),p(R,ie),m(te,R),le.reset(),le.update(te.subarray(0,32)),le.update(ee.subarray(32)),le.update(X);const fe=le.digest();M(fe);for(let ve=0;ve<32;ve++)Q[ve]=ie[ve];for(let ve=0;ve<32;ve++)for(let Me=0;Me<32;Me++)Q[ve+Me]+=fe[ve]*Z[Me];return b(te.subarray(32),Q),te}t.sign=I;function F(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i();return A(ee[2],a),U(ee[1],X),z(Z,ee[1]),T(te,Z,u),J(Z,Z,ee[2]),K(te,ee[2],te),z(le,te),z(ie,le),T(fe,ie,le),T(Q,fe,Z),T(Q,Q,te),_e(Q,Q),T(Q,Q,Z),T(Q,Q,te),T(Q,Q,te),T(ee[0],Q,te),z(R,ee[0]),T(R,R,te),B(R,Z)&&T(ee[0],ee[0],y),z(R,ee[0]),T(R,R,te),B(R,Z)?-1:(j(ee[0])===X[31]>>7&&J(ee[0],o,ee[0]),T(ee[3],ee[0],ee[1]),0)}function ae(ee,X,Q){const R=new Uint8Array(32),Z=[i(),i(),i(),i()],te=[i(),i(),i(),i()];if(Q.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(F(te,ee))return!1;const le=new r.SHA512;le.update(Q.subarray(0,32)),le.update(ee),le.update(X);const ie=le.digest();return M(ie),f(Z,te,ie),p(te,Q.subarray(32)),G(Z,te),m(R,Z),!k(Q,R)}t.verify=ae;function O(ee){let X=[i(),i(),i(),i()];if(F(X,ee))throw new Error("Ed25519: invalid public key");let Q=i(),R=i(),Z=X[1];K(Q,a,Z),J(R,a,Z),ue(R,R),T(Q,Q,R);let te=new Uint8Array(32);return D(te,Q),te}t.convertPublicKeyToX25519=O;function se(ee){const X=(0,r.hash)(ee.subarray(0,32));X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(X.subarray(0,32));return(0,n.wipe)(X),Q}t.convertSecretKeyToX25519=se}(um);const MD="EdDSA",ID="JWT",hd=".",dd="base64url",cx="utf8",ux="utf8",CD=":",TD="did",RD="key",fx="base58btc",DD="z",OD="K36",ND=32;function lx(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function pd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=lx(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function LD(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(j);k!==B;){for(var K=P[k],J=0,T=j-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=j-D;z!==j&&U[z]===0;)z++;for(var ue=u.repeat(N);z>>0,j=new Uint8Array(B);P[N];){var U=r[P.charCodeAt(N)];if(U===255)return;for(var K=0,J=B-1;(U!==0||K>>0,j[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,N++}if(P[N]!==" "){for(var T=B-k;T!==B&&j[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=j[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:g,decodeUnsafe:y,decode:A}}var kD=LD,BD=kD;const $D=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},FD=t=>new TextEncoder().encode(t),jD=t=>new TextDecoder().decode(t);class UD{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class qD{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return hx(this,e)}}class zD{constructor(e){this.decoders=e}or(e){return hx(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const hx=(t,e)=>new zD({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class HD{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new UD(e,r,n),this.decoder=new qD(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const gd=({name:t,prefix:e,encode:r,decode:n})=>new HD(t,e,r,n),rl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=BD(r,e);return gd({prefix:t,name:e,encode:n,decode:s=>$D(i(s))})},WD=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},KD=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<gd({prefix:e,name:t,encode(i){return KD(i,n,r)},decode(i){return WD(i,n,r,t)}}),VD=gd({prefix:"\0",name:"identity",encode:t=>jD(t),decode:t=>FD(t)}),GD=Object.freeze(Object.defineProperty({__proto__:null,identity:VD},Symbol.toStringTag,{value:"Module"})),YD=jn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),JD=Object.freeze(Object.defineProperty({__proto__:null,base2:YD},Symbol.toStringTag,{value:"Module"})),XD=jn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),ZD=Object.freeze(Object.defineProperty({__proto__:null,base8:XD},Symbol.toStringTag,{value:"Module"})),QD=rl({prefix:"9",name:"base10",alphabet:"0123456789"}),eO=Object.freeze(Object.defineProperty({__proto__:null,base10:QD},Symbol.toStringTag,{value:"Module"})),tO=jn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),rO=jn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),nO=Object.freeze(Object.defineProperty({__proto__:null,base16:tO,base16upper:rO},Symbol.toStringTag,{value:"Module"})),iO=jn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),sO=jn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),oO=jn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),aO=jn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),cO=jn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),uO=jn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),fO=jn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),lO=jn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),hO=jn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),dO=Object.freeze(Object.defineProperty({__proto__:null,base32:iO,base32hex:cO,base32hexpad:fO,base32hexpadupper:lO,base32hexupper:uO,base32pad:oO,base32padupper:aO,base32upper:sO,base32z:hO},Symbol.toStringTag,{value:"Module"})),pO=rl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),gO=rl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),mO=Object.freeze(Object.defineProperty({__proto__:null,base36:pO,base36upper:gO},Symbol.toStringTag,{value:"Module"})),vO=rl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),bO=rl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),yO=Object.freeze(Object.defineProperty({__proto__:null,base58btc:vO,base58flickr:bO},Symbol.toStringTag,{value:"Module"})),wO=jn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),xO=jn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),_O=jn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),EO=jn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),SO=Object.freeze(Object.defineProperty({__proto__:null,base64:wO,base64pad:xO,base64url:_O,base64urlpad:EO},Symbol.toStringTag,{value:"Module"})),dx=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),AO=dx.reduce((t,e,r)=>(t[r]=e,t),[]),PO=dx.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function MO(t){return t.reduce((e,r)=>(e+=AO[r],e),"")}function IO(t){const e=[];for(const r of t){const n=PO[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const CO=gd({prefix:"🚀",name:"base256emoji",encode:MO,decode:IO}),TO=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:CO},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const px={...GD,...JD,...ZD,...eO,...nO,...dO,...mO,...yO,...SO,...TO};function gx(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const mx=gx("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),pm=gx("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=lx(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new jO:typeof navigator<"u"?KO(navigator.userAgent):GO()}function WO(t){return t!==""&&zO.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function KO(t){var e=WO(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new FO;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<_x&&(i=xx(xx([],i,!0),YO(_x-i.length),!0)):i=[];var s=i.join("."),o=VO(t),a=qO.exec(t);return a&&a[1]?new $O(r,s,o,a[1]):new kO(r,s,o)}function VO(t){for(var e=0,r=Ex.length;e-1){const D=P.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let k=e.protocol+"//"+e.host;if(D.indexOf("/")===0)k+=D;else{const B=e.pathname.split("/");B.pop();const j=B.join("/");k+=j+"/"+D}y.push(k)}else if(D.indexOf("//")===0){const k=e.protocol+D;y.push(k)}else y.push(D)}}return y}function n(...g){const y=t.getElementsByTagName("meta");for(let A=0;AP.getAttribute(D)).filter(D=>D?g.includes(D):!1);if(N.length&&N){const D=P.getAttribute("content");if(D)return D}}return""}function i(){let g=n("name","og:site_name","og:title","twitter:title");return g||(g=t.title),g}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}Ax=vm.getWindowMetadata=oN;var il={},aN=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Mx="%[a-f0-9]{2}",Ix=new RegExp("("+Mx+")|([^%]+?)","gi"),Cx=new RegExp("("+Mx+")+","gi");function bm(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],bm(r),bm(n))}function cN(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(Ix)||[],r=1;r{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},hN=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;sB==null,o=Symbol("encodeFragmentIdentifier");function a(B){switch(B.arrayFormat){case"index":return j=>(U,K)=>{const J=U.length;return K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),"[",J,"]"].join("")]:[...U,[d(j,B),"[",d(J,B),"]=",d(K,B)].join("")]};case"bracket":return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),"[]"].join("")]:[...U,[d(j,B),"[]=",d(K,B)].join("")];case"colon-list-separator":return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),":list="].join("")]:[...U,[d(j,B),":list=",d(K,B)].join("")];case"comma":case"separator":case"bracket-separator":{const j=B.arrayFormat==="bracket-separator"?"[]=":"=";return U=>(K,J)=>J===void 0||B.skipNull&&J===null||B.skipEmptyString&&J===""?K:(J=J===null?"":J,K.length===0?[[d(U,B),j,d(J,B)].join("")]:[[K,d(J,B)].join(B.arrayFormatSeparator)])}default:return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,d(j,B)]:[...U,[d(j,B),"=",d(K,B)].join("")]}}function u(B){let j;switch(B.arrayFormat){case"index":return(U,K,J)=>{if(j=/\[(\d*)\]$/.exec(U),U=U.replace(/\[\d*\]$/,""),!j){J[U]=K;return}J[U]===void 0&&(J[U]={}),J[U][j[1]]=K};case"bracket":return(U,K,J)=>{if(j=/(\[\])$/.exec(U),U=U.replace(/\[\]$/,""),!j){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"colon-list-separator":return(U,K,J)=>{if(j=/(:list)$/.exec(U),U=U.replace(/:list$/,""),!j){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"comma":case"separator":return(U,K,J)=>{const T=typeof K=="string"&&K.includes(B.arrayFormatSeparator),z=typeof K=="string"&&!T&&g(K,B).includes(B.arrayFormatSeparator);K=z?g(K,B):K;const ue=T||z?K.split(B.arrayFormatSeparator).map(_e=>g(_e,B)):K===null?K:g(K,B);J[U]=ue};case"bracket-separator":return(U,K,J)=>{const T=/(\[\])$/.test(U);if(U=U.replace(/\[\]$/,""),!T){J[U]=K&&g(K,B);return}const z=K===null?[]:K.split(B.arrayFormatSeparator).map(ue=>g(ue,B));if(J[U]===void 0){J[U]=z;return}J[U]=[].concat(J[U],z)};default:return(U,K,J)=>{if(J[U]===void 0){J[U]=K;return}J[U]=[].concat(J[U],K)}}}function l(B){if(typeof B!="string"||B.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function d(B,j){return j.encode?j.strict?e(B):encodeURIComponent(B):B}function g(B,j){return j.decode?r(B):B}function y(B){return Array.isArray(B)?B.sort():typeof B=="object"?y(Object.keys(B)).sort((j,U)=>Number(j)-Number(U)).map(j=>B[j]):B}function A(B){const j=B.indexOf("#");return j!==-1&&(B=B.slice(0,j)),B}function P(B){let j="";const U=B.indexOf("#");return U!==-1&&(j=B.slice(U)),j}function N(B){B=A(B);const j=B.indexOf("?");return j===-1?"":B.slice(j+1)}function D(B,j){return j.parseNumbers&&!Number.isNaN(Number(B))&&typeof B=="string"&&B.trim()!==""?B=Number(B):j.parseBooleans&&B!==null&&(B.toLowerCase()==="true"||B.toLowerCase()==="false")&&(B=B.toLowerCase()==="true"),B}function k(B,j){j=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},j),l(j.arrayFormatSeparator);const U=u(j),K=Object.create(null);if(typeof B!="string"||(B=B.trim().replace(/^[?#&]/,""),!B))return K;for(const J of B.split("&")){if(J==="")continue;let[T,z]=n(j.decode?J.replace(/\+/g," "):J,"=");z=z===void 0?null:["comma","separator","bracket-separator"].includes(j.arrayFormat)?z:g(z,j),U(g(T,j),z,K)}for(const J of Object.keys(K)){const T=K[J];if(typeof T=="object"&&T!==null)for(const z of Object.keys(T))T[z]=D(T[z],j);else K[J]=D(T,j)}return j.sort===!1?K:(j.sort===!0?Object.keys(K).sort():Object.keys(K).sort(j.sort)).reduce((J,T)=>{const z=K[T];return z&&typeof z=="object"&&!Array.isArray(z)?J[T]=y(z):J[T]=z,J},Object.create(null))}t.extract=N,t.parse=k,t.stringify=(B,j)=>{if(!B)return"";j=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},j),l(j.arrayFormatSeparator);const U=z=>j.skipNull&&s(B[z])||j.skipEmptyString&&B[z]==="",K=a(j),J={};for(const z of Object.keys(B))U(z)||(J[z]=B[z]);const T=Object.keys(J);return j.sort!==!1&&T.sort(j.sort),T.map(z=>{const ue=B[z];return ue===void 0?"":ue===null?d(z,j):Array.isArray(ue)?ue.length===0&&j.arrayFormat==="bracket-separator"?d(z,j)+"[]":ue.reduce(K(z),[]).join("&"):d(z,j)+"="+d(ue,j)}).filter(z=>z.length>0).join("&")},t.parseUrl=(B,j)=>{j=Object.assign({decode:!0},j);const[U,K]=n(B,"#");return Object.assign({url:U.split("?")[0]||"",query:k(N(B),j)},j&&j.parseFragmentIdentifier&&K?{fragmentIdentifier:g(K,j)}:{})},t.stringifyUrl=(B,j)=>{j=Object.assign({encode:!0,strict:!0,[o]:!0},j);const U=A(B.url).split("?")[0]||"",K=t.extract(B.url),J=t.parse(K,{sort:!1}),T=Object.assign(J,B.query);let z=t.stringify(T,j);z&&(z=`?${z}`);let ue=P(B.url);return B.fragmentIdentifier&&(ue=`#${j[o]?d(B.fragmentIdentifier,j):B.fragmentIdentifier}`),`${U}${z}${ue}`},t.pick=(B,j,U)=>{U=Object.assign({parseFragmentIdentifier:!0,[o]:!1},U);const{url:K,query:J,fragmentIdentifier:T}=t.parseUrl(B,U);return t.stringifyUrl({url:K,query:i(J,j),fragmentIdentifier:T},U)},t.exclude=(B,j,U)=>{const K=Array.isArray(j)?J=>!j.includes(J):(J,T)=>!j(J,T);return t.pick(B,K,U)}})(il);var Tx={exports:{}};/** + ***************************************************************************** */var Jg=function(t,e){return Jg=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Jg(t,e)};function oT(t,e){Jg(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Xg=function(){return Xg=Object.assign||function(e){for(var r,n=1,i=arguments.length;n=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function uT(t,e){return function(r,n){e(r,n,t)}}function fT(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function lT(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(d){try{l(n.next(d))}catch(p){o(p)}}function u(d){try{l(n.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):i(d.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function hT(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return u([l,d])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function I2(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function gT(){for(var t=[],e=0;e1||a(y,A)})})}function a(y,A){try{u(n[y](A))}catch(P){p(s[0][3],P)}}function u(y){y.value instanceof Kf?Promise.resolve(y.value.v).then(l,d):p(s[0][2],y)}function l(y){a("next",y)}function d(y){a("throw",y)}function p(y,A){y(A),s.shift(),s.length&&a(s[0][0],s[0][1])}}function bT(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Kf(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function yT(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Zg=="function"?Zg(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function wT(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function xT(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function _T(t){return t&&t.__esModule?t:{default:t}}function ET(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function ST(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const Vf=Jp(Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Xg},__asyncDelegator:bT,__asyncGenerator:vT,__asyncValues:yT,__await:Kf,__awaiter:lT,__classPrivateFieldGet:ET,__classPrivateFieldSet:ST,__createBinding:dT,__decorate:cT,__exportStar:pT,__extends:oT,__generator:hT,__importDefault:_T,__importStar:xT,__makeTemplateObject:wT,__metadata:fT,__param:uT,__read:I2,__rest:aT,__spread:gT,__spreadArrays:mT,__values:Zg},Symbol.toStringTag,{value:"Module"})));var Qg={},Gf={},C2;function AT(){if(C2)return Gf;C2=1,Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Gf.delay=t,Gf}var qa={},em={},za={},T2;function PT(){return T2||(T2=1,Object.defineProperty(za,"__esModule",{value:!0}),za.ONE_THOUSAND=za.ONE_HUNDRED=void 0,za.ONE_HUNDRED=100,za.ONE_THOUSAND=1e3),za}var tm={},R2;function MT(){return R2||(R2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(tm)),tm}var D2;function O2(){return D2||(D2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(PT(),t),e.__exportStar(MT(),t)}(em)),em}var N2;function IT(){if(N2)return qa;N2=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.fromMiliseconds=qa.toMiliseconds=void 0;const t=O2();function e(n){return n*t.ONE_THOUSAND}qa.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return qa.fromMiliseconds=r,qa}var L2;function CT(){return L2||(L2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(AT(),t),e.__exportStar(IT(),t)}(Qg)),Qg}var nu={},k2;function TT(){if(k2)return nu;k2=1,Object.defineProperty(nu,"__esModule",{value:!0}),nu.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return nu.Watch=t,nu.default=t,nu}var rm={},Yf={},B2;function RT(){if(B2)return Yf;B2=1,Object.defineProperty(Yf,"__esModule",{value:!0}),Yf.IWatch=void 0;class t{}return Yf.IWatch=t,Yf}var $2;function DT(){return $2||($2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Vf.__exportStar(RT(),t)}(rm)),rm}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(CT(),t),e.__exportStar(TT(),t),e.__exportStar(DT(),t),e.__exportStar(O2(),t)})(mt);class Ha{}let OT=class extends Ha{constructor(e){super()}};const F2=mt.FIVE_SECONDS,iu={pulse:"heartbeat_pulse"};let NT=class GA extends OT{constructor(e){super(e),this.events=new qi.EventEmitter,this.interval=F2,this.interval=(e==null?void 0:e.interval)||F2}static async init(e){const r=new GA(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),mt.toMiliseconds(this.interval))}pulse(){this.events.emit(iu.pulse)}};const LT=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,kT=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,BT=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function $T(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){FT(t);return}return e}function FT(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Zh(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!BT.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(LT.test(t)||kT.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,$T)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function jT(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Cn(t,...e){try{return jT(t(...e))}catch(r){return Promise.reject(r)}}function UT(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function qT(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Qh(t){if(UT(t))return String(t);if(qT(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Qh(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function j2(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const nm="base64:";function zT(t){if(typeof t=="string")return t;j2();const e=Buffer.from(t).toString("base64");return nm+e}function HT(t){return typeof t!="string"||!t.startsWith(nm)?t:(j2(),Buffer.from(t.slice(nm.length),"base64"))}function pi(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function WT(...t){return pi(t.join(":"))}function ed(t){return t=pi(t),t?t+":":""}function doe(t){return t}const KT="memory",VT=()=>{const t=new Map;return{name:KT,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function GT(t={}){const e={mounts:{"":t.driver||VT()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const d of e.mountpoints)if(l.startsWith(d))return{base:d,relativeKey:l.slice(d.length),driver:e.mounts[d]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,d)=>e.mountpoints.filter(p=>p.startsWith(l)||d&&l.startsWith(p)).map(p=>({relativeBase:l.length>p.length?l.slice(p.length):void 0,mountpoint:p,driver:e.mounts[p]})),i=(l,d)=>{if(e.watching){d=pi(d);for(const p of e.watchListeners)p(l,d)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await U2(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,d,p)=>{const y=new Map,A=P=>{let N=y.get(P.base);return N||(N={driver:P.driver,base:P.base,items:[]},y.set(P.base,N)),N};for(const P of l){const N=typeof P=="string",D=pi(N?P:P.key),k=N?void 0:P.value,B=N||!P.options?d:{...d,...P.options},j=r(D);A(j).items.push({key:D,value:k,relativeKey:j.relativeKey,options:B})}return Promise.all([...y.values()].map(P=>p(P))).then(P=>P.flat())},u={hasItem(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return Cn(y.hasItem,p,d)},getItem(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return Cn(y.getItem,p,d).then(A=>Zh(A))},getItems(l,d){return a(l,d,p=>p.driver.getItems?Cn(p.driver.getItems,p.items.map(y=>({key:y.relativeKey,options:y.options})),d).then(y=>y.map(A=>({key:WT(p.base,A.key),value:Zh(A.value)}))):Promise.all(p.items.map(y=>Cn(p.driver.getItem,y.relativeKey,y.options).then(A=>({key:y.key,value:Zh(A)})))))},getItemRaw(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return y.getItemRaw?Cn(y.getItemRaw,p,d):Cn(y.getItem,p,d).then(A=>HT(A))},async setItem(l,d,p={}){if(d===void 0)return u.removeItem(l);l=pi(l);const{relativeKey:y,driver:A}=r(l);A.setItem&&(await Cn(A.setItem,y,Qh(d),p),A.watch||i("update",l))},async setItems(l,d){await a(l,d,async p=>{if(p.driver.setItems)return Cn(p.driver.setItems,p.items.map(y=>({key:y.relativeKey,value:Qh(y.value),options:y.options})),d);p.driver.setItem&&await Promise.all(p.items.map(y=>Cn(p.driver.setItem,y.relativeKey,Qh(y.value),y.options)))})},async setItemRaw(l,d,p={}){if(d===void 0)return u.removeItem(l,p);l=pi(l);const{relativeKey:y,driver:A}=r(l);if(A.setItemRaw)await Cn(A.setItemRaw,y,d,p);else if(A.setItem)await Cn(A.setItem,y,zT(d),p);else return;A.watch||i("update",l)},async removeItem(l,d={}){typeof d=="boolean"&&(d={removeMeta:d}),l=pi(l);const{relativeKey:p,driver:y}=r(l);y.removeItem&&(await Cn(y.removeItem,p,d),(d.removeMeta||d.removeMata)&&await Cn(y.removeItem,p+"$",d),y.watch||i("remove",l))},async getMeta(l,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),l=pi(l);const{relativeKey:p,driver:y}=r(l),A=Object.create(null);if(y.getMeta&&Object.assign(A,await Cn(y.getMeta,p,d)),!d.nativeOnly){const P=await Cn(y.getItem,p+"$",d).then(N=>Zh(N));P&&typeof P=="object"&&(typeof P.atime=="string"&&(P.atime=new Date(P.atime)),typeof P.mtime=="string"&&(P.mtime=new Date(P.mtime)),Object.assign(A,P))}return A},setMeta(l,d,p={}){return this.setItem(l+"$",d,p)},removeMeta(l,d={}){return this.removeItem(l+"$",d)},async getKeys(l,d={}){l=ed(l);const p=n(l,!0);let y=[];const A=[];for(const P of p){const N=await Cn(P.driver.getKeys,P.relativeBase,d);for(const D of N){const k=P.mountpoint+pi(D);y.some(B=>k.startsWith(B))||A.push(k)}y=[P.mountpoint,...y.filter(D=>!D.startsWith(P.mountpoint))]}return l?A.filter(P=>P.startsWith(l)&&P[P.length-1]!=="$"):A.filter(P=>P[P.length-1]!=="$")},async clear(l,d={}){l=ed(l),await Promise.all(n(l,!1).map(async p=>{if(p.driver.clear)return Cn(p.driver.clear,p.relativeBase,d);if(p.driver.removeItem){const y=await p.driver.getKeys(p.relativeBase||"",d);return Promise.all(y.map(A=>p.driver.removeItem(A,d)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>q2(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(d=>d!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,d){if(l=ed(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((p,y)=>y.length-p.length)),e.mounts[l]=d,e.watching&&Promise.resolve(U2(d,i,l)).then(p=>{e.unwatch[l]=p}).catch(console.error),u},async unmount(l,d=!0){l=ed(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),d&&await q2(e.mounts[l]),e.mountpoints=e.mountpoints.filter(p=>p!==l),delete e.mounts[l])},getMount(l=""){l=pi(l)+":";const d=r(l);return{driver:d.driver,base:d.base}},getMounts(l="",d={}){return l=pi(l),n(l,d.parents).map(y=>({driver:y.driver,base:y.mountpoint}))},keys:(l,d={})=>u.getKeys(l,d),get:(l,d={})=>u.getItem(l,d),set:(l,d,p={})=>u.setItem(l,d,p),has:(l,d={})=>u.hasItem(l,d),del:(l,d={})=>u.removeItem(l,d),remove:(l,d={})=>u.removeItem(l,d)};return u}function U2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function q2(t){typeof t.dispose=="function"&&await Cn(t.dispose)}function Wa(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function z2(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Wa(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let im;function Jf(){return im||(im=z2("keyval-store","keyval")),im}function H2(t,e=Jf()){return e("readonly",r=>Wa(r.get(t)))}function YT(t,e,r=Jf()){return r("readwrite",n=>(n.put(e,t),Wa(n.transaction)))}function JT(t,e=Jf()){return e("readwrite",r=>(r.delete(t),Wa(r.transaction)))}function XT(t=Jf()){return t("readwrite",e=>(e.clear(),Wa(e.transaction)))}function ZT(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Wa(t.transaction)}function QT(t=Jf()){return t("readonly",e=>{if(e.getAllKeys)return Wa(e.getAllKeys());const r=[];return ZT(e,n=>r.push(n.key)).then(()=>r)})}const eR=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),tR=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Ka(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return tR(t)}catch{return t}}function mo(t){return typeof t=="string"?t:eR(t)||""}const rR="idb-keyval";var nR=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=z2(t.dbName,t.storeName)),{name:rR,options:t,async hasItem(i){return!(typeof await H2(r(i),n)>"u")},async getItem(i){return await H2(r(i),n)??null},setItem(i,s){return YT(r(i),s,n)},removeItem(i){return JT(r(i),n)},getKeys(){return QT(n)},clear(){return XT(n)}}};const iR="WALLET_CONNECT_V2_INDEXED_DB",sR="keyvaluestorage";let oR=class{constructor(){this.indexedDb=GT({driver:nR({dbName:iR,storeName:sR})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,mo(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var sm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},td={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof sm<"u"&&sm.localStorage?td.exports=sm.localStorage:typeof window<"u"&&window.localStorage?td.exports=window.localStorage:td.exports=new e})();function aR(t){var e;return[t[0],Ka((e=t[1])!=null?e:"")]}let cR=class{constructor(){this.localStorage=td.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(aR)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Ka(r)}async setItem(e,r){this.localStorage.setItem(e,mo(r))}async removeItem(e){this.localStorage.removeItem(e)}};const uR="wc_storage_version",W2=1,fR=async(t,e,r)=>{const n=uR,i=await e.getItem(n);if(i&&i>=W2){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,W2),r(e),lR(t,o)},lR=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let hR=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new cR;this.storage=e;try{const r=new oR;fR(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function dR(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var pR=gR;function gR(t,e,r){var n=r&&r.stringify||dR,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?p:0,t.charCodeAt(A+1)){case 100:case 102:if(d>=u||e[d]==null)break;p=u||e[d]==null)break;p=u||e[d]===void 0)break;p",p=A+2,A++;break}l+=n(e[d]),p=A+2,A++;break;case 115:if(d>=u)break;p-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",u=Object.create(r);u.log||(u.log=Zf),Object.defineProperty(u,"levelVal",{get:d}),Object.defineProperty(u,"level",{get:p,set:y});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:_R(t)};u.levels=vo.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Zf,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=A,e&&(u._logEvent=om());function d(){return this.level==="silent"?1/0:this.levels.values[this.level]}function p(){return this._level}function y(P){if(P!=="silent"&&!this.levels.values[P])throw Error("unknown level "+P);this._level=P,ou(l,u,"error","log"),ou(l,u,"fatal","error"),ou(l,u,"warn","error"),ou(l,u,"info","log"),ou(l,u,"debug","log"),ou(l,u,"trace","log")}function A(P,N){if(!P)throw new Error("missing bindings for child Pino");N=N||{},i&&P.serializers&&(N.serializers=P.serializers);const D=N.serializers;if(i&&D){var k=Object.assign({},n,D),B=t.browser.serialize===!0?Object.keys(k):i;delete P.serializers,rd([P],B,k,this._stdErrSerialize)}function j(U){this._childLevel=(U._childLevel|0)+1,this.error=au(U,P,"error"),this.fatal=au(U,P,"fatal"),this.warn=au(U,P,"warn"),this.info=au(U,P,"info"),this.debug=au(U,P,"debug"),this.trace=au(U,P,"trace"),k&&(this.serializers=k,this._serialize=B),e&&(this._logEvent=om([].concat(U._logEvent.bindings,P)))}return j.prototype=this,new j(this)}return u}vo.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},vo.stdSerializers=mR,vo.stdTimeFunctions=Object.assign({},{nullTime:V2,epochTime:G2,unixTime:ER,isoTime:SR});function ou(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Zf:i[r]?i[r]:Xf[r]||Xf[n]||Zf,bR(t,e,r)}function bR(t,e,r){!t.transmit&&e[r]===Zf||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Xf?Xf:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function au(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},J2=class{constructor(e,r=cm){this.level=e??"error",this.levelValue=su.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Y2(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===su.levels.values.error?console.error(e):r===su.levels.values.warn?console.warn(e):r===su.levels.values.debug?console.debug(e):r===su.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(mo({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new Y2(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(mo({extraMetadata:e})),new Blob(r,{type:"application/json"})}},IR=class{constructor(e,r=cm){this.baseChunkLogger=new J2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},CR=class{constructor(e,r=cm){this.baseChunkLogger=new J2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var TR=Object.defineProperty,RR=Object.defineProperties,DR=Object.getOwnPropertyDescriptors,X2=Object.getOwnPropertySymbols,OR=Object.prototype.hasOwnProperty,NR=Object.prototype.propertyIsEnumerable,Z2=(t,e,r)=>e in t?TR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,id=(t,e)=>{for(var r in e||(e={}))OR.call(e,r)&&Z2(t,r,e[r]);if(X2)for(var r of X2(e))NR.call(e,r)&&Z2(t,r,e[r]);return t},sd=(t,e)=>RR(t,DR(e));function od(t){return sd(id({},t),{level:(t==null?void 0:t.level)||PR.level})}function LR(t,e=el){return t[e]||""}function kR(t,e,r=el){return t[r]=e,t}function gi(t,e=el){let r="";return typeof t.bindings>"u"?r=LR(t,e):r=t.bindings().context||"",r}function BR(t,e,r=el){const n=gi(t,r);return n.trim()?`${n}/${e}`:e}function ri(t,e,r=el){const n=BR(t,e,r),i=t.child({context:n});return kR(i,n,r)}function $R(t){var e,r;const n=new IR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace",browser:sd(id({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function FR(t){var e;const r=new CR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function jR(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?$R(t):FR(t)}let UR=class extends Ha{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},qR=class extends Ha{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},zR=class{constructor(e,r){this.logger=e,this.core=r}},HR=class extends Ha{constructor(e,r){super(),this.relayer=e,this.logger=r}},WR=class extends Ha{constructor(e){super()}},KR=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},VR=class extends Ha{constructor(e,r){super(),this.relayer=e,this.logger=r}},GR=class extends Ha{constructor(e,r){super(),this.core=e,this.logger=r}},YR=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},JR=class{constructor(e,r){this.projectId=e,this.logger=r}},XR=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},ZR=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},QR=class{constructor(e){this.client=e}};var um={},ta={},ad={},cd={};Object.defineProperty(cd,"__esModule",{value:!0}),cd.BrowserRandomSource=void 0;const Q2=65536;class eD{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let n=0;n>>16&65535,d=a&65535,p=u>>>16&65535,y=u&65535;return d*y+(l*y+d*p<<16>>>0)|0}t.mul=Math.imul||e;function r(a,u){return a+u|0}t.add=r;function n(a,u){return a-u|0}t.sub=n;function i(a,u){return a<>>32-u}t.rotl=i;function s(a,u){return a<<32-u|a>>>u}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(tx),Object.defineProperty(or,"__esModule",{value:!0});var rx=tx;function aD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}or.readInt16BE=aD;function cD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}or.readUint16BE=cD;function uD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}or.readInt16LE=uD;function fD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}or.readUint16LE=fD;function nx(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}or.writeUint16BE=nx,or.writeInt16BE=nx;function ix(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}or.writeUint16LE=ix,or.writeInt16LE=ix;function fm(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}or.readInt32BE=fm;function lm(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}or.readUint32BE=lm;function hm(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}or.readInt32LE=hm;function dm(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}or.readUint32LE=dm;function fd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}or.writeUint32BE=fd,or.writeInt32BE=fd;function ld(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}or.writeUint32LE=ld,or.writeInt32LE=ld;function lD(t,e){e===void 0&&(e=0);var r=fm(t,e),n=fm(t,e+4);return r*4294967296+n-(n>>31)*4294967296}or.readInt64BE=lD;function hD(t,e){e===void 0&&(e=0);var r=lm(t,e),n=lm(t,e+4);return r*4294967296+n}or.readUint64BE=hD;function dD(t,e){e===void 0&&(e=0);var r=hm(t,e),n=hm(t,e+4);return n*4294967296+r-(r>>31)*4294967296}or.readInt64LE=dD;function pD(t,e){e===void 0&&(e=0);var r=dm(t,e),n=dm(t,e+4);return n*4294967296+r}or.readUint64LE=pD;function sx(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fd(t/4294967296>>>0,e,r),fd(t>>>0,e,r+4),e}or.writeUint64BE=sx,or.writeInt64BE=sx;function ox(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ld(t>>>0,e,r),ld(t/4294967296>>>0,e,r+4),e}or.writeUint64LE=ox,or.writeInt64LE=ox;function gD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}or.readUintBE=gD;function mD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}or.writeUintBE=vD;function bD(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!rx.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s256)throw new Error("randomString charset is too long");let y="";const A=d.length,P=256-256%A;for(;l>0;){const N=i(Math.ceil(l*256/P),p);for(let D=0;D0;D++){const k=N[D];k0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,A=l%128<112?128:256;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._stateHi.set(u.stateHi),this._stateLo.set(u.stateLo),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.stateHi),r.wipe(u.stateLo),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,u,l,d,p,y,A){for(var P=l[0],N=l[1],D=l[2],k=l[3],B=l[4],j=l[5],U=l[6],K=l[7],J=d[0],T=d[1],z=d[2],ue=d[3],_e=d[4],G=d[5],E=d[6],m=d[7],f,g,v,x,_,S,b,M;A>=128;){for(var I=0;I<16;I++){var F=8*I+y;a[I]=e.readUint32BE(p,F),u[I]=e.readUint32BE(p,F+4)}for(var I=0;I<80;I++){var ae=P,O=N,se=D,ee=k,X=B,Q=j,R=U,Z=K,te=J,le=T,ie=z,fe=ue,ve=_e,Me=G,Ne=E,Te=m;if(f=K,g=m,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=(B>>>14|_e<<18)^(B>>>18|_e<<14)^(_e>>>9|B<<23),g=(_e>>>14|B<<18)^(_e>>>18|B<<14)^(B>>>9|_e<<23),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=B&j^~B&U,g=_e&G^~_e&E,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=i[I*2],g=i[I*2+1],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=a[I%16],g=u[I%16],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,v=b&65535|M<<16,x=_&65535|S<<16,f=v,g=x,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=(P>>>28|J<<4)^(J>>>2|P<<30)^(J>>>7|P<<25),g=(J>>>28|P<<4)^(P>>>2|J<<30)^(P>>>7|J<<25),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=P&N^P&D^N&D,g=J&T^J&z^T&z,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,Z=b&65535|M<<16,Te=_&65535|S<<16,f=ee,g=fe,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=v,g=x,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,ee=b&65535|M<<16,fe=_&65535|S<<16,N=ae,D=O,k=se,B=ee,j=X,U=Q,K=R,P=Z,T=te,z=le,ue=ie,_e=fe,G=ve,E=Me,m=Ne,J=Te,I%16===15)for(var F=0;F<16;F++)f=a[F],g=u[F],_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=a[(F+9)%16],g=u[(F+9)%16],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,v=a[(F+1)%16],x=u[(F+1)%16],f=(v>>>1|x<<31)^(v>>>8|x<<24)^v>>>7,g=(x>>>1|v<<31)^(x>>>8|v<<24)^(x>>>7|v<<25),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,v=a[(F+14)%16],x=u[(F+14)%16],f=(v>>>19|x<<13)^(x>>>29|v<<3)^v>>>6,g=(x>>>19|v<<13)^(v>>>29|x<<3)^(x>>>6|v<<26),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,a[F]=b&65535|M<<16,u[F]=_&65535|S<<16}f=P,g=J,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[0],g=d[0],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[0]=P=b&65535|M<<16,d[0]=J=_&65535|S<<16,f=N,g=T,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[1],g=d[1],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[1]=N=b&65535|M<<16,d[1]=T=_&65535|S<<16,f=D,g=z,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[2],g=d[2],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[2]=D=b&65535|M<<16,d[2]=z=_&65535|S<<16,f=k,g=ue,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[3],g=d[3],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[3]=k=b&65535|M<<16,d[3]=ue=_&65535|S<<16,f=B,g=_e,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[4],g=d[4],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[4]=B=b&65535|M<<16,d[4]=_e=_&65535|S<<16,f=j,g=G,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[5],g=d[5],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[5]=j=b&65535|M<<16,d[5]=G=_&65535|S<<16,f=U,g=E,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[6],g=d[6],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[6]=U=b&65535|M<<16,d[6]=E=_&65535|S<<16,f=K,g=m,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[7],g=d[7],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[7]=K=b&65535|M<<16,d[7]=m=_&65535|S<<16,y+=128,A-=128}return y}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ax),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=ta,r=ax,n=Mi;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(ee){const X=new Float64Array(16);if(ee)for(let Q=0;Q>16&1),Q[le-1]&=65535;Q[15]=R[15]-32767-(Q[14]>>16&1);const te=Q[15]>>16&1;Q[14]&=65535,N(R,Q,1-te)}for(let Z=0;Z<16;Z++)ee[2*Z]=R[Z]&255,ee[2*Z+1]=R[Z]>>8}function k(ee,X){let Q=0;for(let R=0;R<32;R++)Q|=ee[R]^X[R];return(1&Q-1>>>8)-1}function B(ee,X){const Q=new Uint8Array(32),R=new Uint8Array(32);return D(Q,ee),D(R,X),k(Q,R)}function j(ee){const X=new Uint8Array(32);return D(X,ee),X[0]&1}function U(ee,X){for(let Q=0;Q<16;Q++)ee[Q]=X[2*Q]+(X[2*Q+1]<<8);ee[15]&=32767}function K(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]+Q[R]}function J(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]-Q[R]}function T(ee,X,Q){let R,Z,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=0,Ie=0,Le=0,Ve=0,ke=0,ze=0,He=0,Ee=0,Qe=0,ct=0,Be=0,et=0,rt=0,Je=0,pt=0,ht=0,ft=0,Ht=0,Jt=0,St=0,er=0,Xt=0,Ot=0,Bt=Q[0],Tt=Q[1],vt=Q[2],Dt=Q[3],Lt=Q[4],bt=Q[5],$t=Q[6],jt=Q[7],nt=Q[8],Ft=Q[9],$=Q[10],H=Q[11],V=Q[12],C=Q[13],Y=Q[14],q=Q[15];R=X[0],te+=R*Bt,le+=R*Tt,ie+=R*vt,fe+=R*Dt,ve+=R*Lt,Me+=R*bt,Ne+=R*$t,Te+=R*jt,$e+=R*nt,Ie+=R*Ft,Le+=R*$,Ve+=R*H,ke+=R*V,ze+=R*C,He+=R*Y,Ee+=R*q,R=X[1],le+=R*Bt,ie+=R*Tt,fe+=R*vt,ve+=R*Dt,Me+=R*Lt,Ne+=R*bt,Te+=R*$t,$e+=R*jt,Ie+=R*nt,Le+=R*Ft,Ve+=R*$,ke+=R*H,ze+=R*V,He+=R*C,Ee+=R*Y,Qe+=R*q,R=X[2],ie+=R*Bt,fe+=R*Tt,ve+=R*vt,Me+=R*Dt,Ne+=R*Lt,Te+=R*bt,$e+=R*$t,Ie+=R*jt,Le+=R*nt,Ve+=R*Ft,ke+=R*$,ze+=R*H,He+=R*V,Ee+=R*C,Qe+=R*Y,ct+=R*q,R=X[3],fe+=R*Bt,ve+=R*Tt,Me+=R*vt,Ne+=R*Dt,Te+=R*Lt,$e+=R*bt,Ie+=R*$t,Le+=R*jt,Ve+=R*nt,ke+=R*Ft,ze+=R*$,He+=R*H,Ee+=R*V,Qe+=R*C,ct+=R*Y,Be+=R*q,R=X[4],ve+=R*Bt,Me+=R*Tt,Ne+=R*vt,Te+=R*Dt,$e+=R*Lt,Ie+=R*bt,Le+=R*$t,Ve+=R*jt,ke+=R*nt,ze+=R*Ft,He+=R*$,Ee+=R*H,Qe+=R*V,ct+=R*C,Be+=R*Y,et+=R*q,R=X[5],Me+=R*Bt,Ne+=R*Tt,Te+=R*vt,$e+=R*Dt,Ie+=R*Lt,Le+=R*bt,Ve+=R*$t,ke+=R*jt,ze+=R*nt,He+=R*Ft,Ee+=R*$,Qe+=R*H,ct+=R*V,Be+=R*C,et+=R*Y,rt+=R*q,R=X[6],Ne+=R*Bt,Te+=R*Tt,$e+=R*vt,Ie+=R*Dt,Le+=R*Lt,Ve+=R*bt,ke+=R*$t,ze+=R*jt,He+=R*nt,Ee+=R*Ft,Qe+=R*$,ct+=R*H,Be+=R*V,et+=R*C,rt+=R*Y,Je+=R*q,R=X[7],Te+=R*Bt,$e+=R*Tt,Ie+=R*vt,Le+=R*Dt,Ve+=R*Lt,ke+=R*bt,ze+=R*$t,He+=R*jt,Ee+=R*nt,Qe+=R*Ft,ct+=R*$,Be+=R*H,et+=R*V,rt+=R*C,Je+=R*Y,pt+=R*q,R=X[8],$e+=R*Bt,Ie+=R*Tt,Le+=R*vt,Ve+=R*Dt,ke+=R*Lt,ze+=R*bt,He+=R*$t,Ee+=R*jt,Qe+=R*nt,ct+=R*Ft,Be+=R*$,et+=R*H,rt+=R*V,Je+=R*C,pt+=R*Y,ht+=R*q,R=X[9],Ie+=R*Bt,Le+=R*Tt,Ve+=R*vt,ke+=R*Dt,ze+=R*Lt,He+=R*bt,Ee+=R*$t,Qe+=R*jt,ct+=R*nt,Be+=R*Ft,et+=R*$,rt+=R*H,Je+=R*V,pt+=R*C,ht+=R*Y,ft+=R*q,R=X[10],Le+=R*Bt,Ve+=R*Tt,ke+=R*vt,ze+=R*Dt,He+=R*Lt,Ee+=R*bt,Qe+=R*$t,ct+=R*jt,Be+=R*nt,et+=R*Ft,rt+=R*$,Je+=R*H,pt+=R*V,ht+=R*C,ft+=R*Y,Ht+=R*q,R=X[11],Ve+=R*Bt,ke+=R*Tt,ze+=R*vt,He+=R*Dt,Ee+=R*Lt,Qe+=R*bt,ct+=R*$t,Be+=R*jt,et+=R*nt,rt+=R*Ft,Je+=R*$,pt+=R*H,ht+=R*V,ft+=R*C,Ht+=R*Y,Jt+=R*q,R=X[12],ke+=R*Bt,ze+=R*Tt,He+=R*vt,Ee+=R*Dt,Qe+=R*Lt,ct+=R*bt,Be+=R*$t,et+=R*jt,rt+=R*nt,Je+=R*Ft,pt+=R*$,ht+=R*H,ft+=R*V,Ht+=R*C,Jt+=R*Y,St+=R*q,R=X[13],ze+=R*Bt,He+=R*Tt,Ee+=R*vt,Qe+=R*Dt,ct+=R*Lt,Be+=R*bt,et+=R*$t,rt+=R*jt,Je+=R*nt,pt+=R*Ft,ht+=R*$,ft+=R*H,Ht+=R*V,Jt+=R*C,St+=R*Y,er+=R*q,R=X[14],He+=R*Bt,Ee+=R*Tt,Qe+=R*vt,ct+=R*Dt,Be+=R*Lt,et+=R*bt,rt+=R*$t,Je+=R*jt,pt+=R*nt,ht+=R*Ft,ft+=R*$,Ht+=R*H,Jt+=R*V,St+=R*C,er+=R*Y,Xt+=R*q,R=X[15],Ee+=R*Bt,Qe+=R*Tt,ct+=R*vt,Be+=R*Dt,et+=R*Lt,rt+=R*bt,Je+=R*$t,pt+=R*jt,ht+=R*nt,ft+=R*Ft,Ht+=R*$,Jt+=R*H,St+=R*V,er+=R*C,Xt+=R*Y,Ot+=R*q,te+=38*Qe,le+=38*ct,ie+=38*Be,fe+=38*et,ve+=38*rt,Me+=38*Je,Ne+=38*pt,Te+=38*ht,$e+=38*ft,Ie+=38*Ht,Le+=38*Jt,Ve+=38*St,ke+=38*er,ze+=38*Xt,He+=38*Ot,Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),ee[0]=te,ee[1]=le,ee[2]=ie,ee[3]=fe,ee[4]=ve,ee[5]=Me,ee[6]=Ne,ee[7]=Te,ee[8]=$e,ee[9]=Ie,ee[10]=Le,ee[11]=Ve,ee[12]=ke,ee[13]=ze,ee[14]=He,ee[15]=Ee}function z(ee,X){T(ee,X,X)}function ue(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=253;R>=0;R--)z(Q,Q),R!==2&&R!==4&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function _e(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=250;R>=0;R--)z(Q,Q),R!==1&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function G(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i(),ve=i(),Me=i();J(Q,ee[1],ee[0]),J(Me,X[1],X[0]),T(Q,Q,Me),K(R,ee[0],ee[1]),K(Me,X[0],X[1]),T(R,R,Me),T(Z,ee[3],X[3]),T(Z,Z,l),T(te,ee[2],X[2]),K(te,te,te),J(le,R,Q),J(ie,te,Z),K(fe,te,Z),K(ve,R,Q),T(ee[0],le,ie),T(ee[1],ve,fe),T(ee[2],fe,ie),T(ee[3],le,ve)}function E(ee,X,Q){for(let R=0;R<4;R++)N(ee[R],X[R],Q)}function m(ee,X){const Q=i(),R=i(),Z=i();ue(Z,X[2]),T(Q,X[0],Z),T(R,X[1],Z),D(ee,R),ee[31]^=j(Q)<<7}function f(ee,X,Q){A(ee[0],o),A(ee[1],a),A(ee[2],a),A(ee[3],o);for(let R=255;R>=0;--R){const Z=Q[R/8|0]>>(R&7)&1;E(ee,X,Z),G(X,ee),G(ee,ee),E(ee,X,Z)}}function g(ee,X){const Q=[i(),i(),i(),i()];A(Q[0],d),A(Q[1],p),A(Q[2],a),T(Q[3],d,p),f(ee,Q,X)}function v(ee){if(ee.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const X=(0,r.hash)(ee);X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(32),R=[i(),i(),i(),i()];g(R,X),m(Q,R);const Z=new Uint8Array(64);return Z.set(ee),Z.set(Q,32),{publicKey:Q,secretKey:Z}}t.generateKeyPairFromSeed=v;function x(ee){const X=(0,e.randomBytes)(32,ee),Q=v(X);return(0,n.wipe)(X),Q}t.generateKeyPair=x;function _(ee){if(ee.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(ee.subarray(32))}t.extractPublicKeyFromSecretKey=_;const S=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function b(ee,X){let Q,R,Z,te;for(R=63;R>=32;--R){for(Q=0,Z=R-32,te=R-12;Z>4)*S[Z],Q=X[Z]>>8,X[Z]&=255;for(Z=0;Z<32;Z++)X[Z]-=Q*S[Z];for(R=0;R<32;R++)X[R+1]+=X[R]>>8,ee[R]=X[R]&255}function M(ee){const X=new Float64Array(64);for(let Q=0;Q<64;Q++)X[Q]=ee[Q];for(let Q=0;Q<64;Q++)ee[Q]=0;b(ee,X)}function I(ee,X){const Q=new Float64Array(64),R=[i(),i(),i(),i()],Z=(0,r.hash)(ee.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(64);te.set(Z.subarray(32),32);const le=new r.SHA512;le.update(te.subarray(32)),le.update(X);const ie=le.digest();le.clean(),M(ie),g(R,ie),m(te,R),le.reset(),le.update(te.subarray(0,32)),le.update(ee.subarray(32)),le.update(X);const fe=le.digest();M(fe);for(let ve=0;ve<32;ve++)Q[ve]=ie[ve];for(let ve=0;ve<32;ve++)for(let Me=0;Me<32;Me++)Q[ve+Me]+=fe[ve]*Z[Me];return b(te.subarray(32),Q),te}t.sign=I;function F(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i();return A(ee[2],a),U(ee[1],X),z(Z,ee[1]),T(te,Z,u),J(Z,Z,ee[2]),K(te,ee[2],te),z(le,te),z(ie,le),T(fe,ie,le),T(Q,fe,Z),T(Q,Q,te),_e(Q,Q),T(Q,Q,Z),T(Q,Q,te),T(Q,Q,te),T(ee[0],Q,te),z(R,ee[0]),T(R,R,te),B(R,Z)&&T(ee[0],ee[0],y),z(R,ee[0]),T(R,R,te),B(R,Z)?-1:(j(ee[0])===X[31]>>7&&J(ee[0],o,ee[0]),T(ee[3],ee[0],ee[1]),0)}function ae(ee,X,Q){const R=new Uint8Array(32),Z=[i(),i(),i(),i()],te=[i(),i(),i(),i()];if(Q.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(F(te,ee))return!1;const le=new r.SHA512;le.update(Q.subarray(0,32)),le.update(ee),le.update(X);const ie=le.digest();return M(ie),f(Z,te,ie),g(te,Q.subarray(32)),G(Z,te),m(R,Z),!k(Q,R)}t.verify=ae;function O(ee){let X=[i(),i(),i(),i()];if(F(X,ee))throw new Error("Ed25519: invalid public key");let Q=i(),R=i(),Z=X[1];K(Q,a,Z),J(R,a,Z),ue(R,R),T(Q,Q,R);let te=new Uint8Array(32);return D(te,Q),te}t.convertPublicKeyToX25519=O;function se(ee){const X=(0,r.hash)(ee.subarray(0,32));X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(X.subarray(0,32));return(0,n.wipe)(X),Q}t.convertSecretKeyToX25519=se}(um);const MD="EdDSA",ID="JWT",hd=".",dd="base64url",cx="utf8",ux="utf8",CD=":",TD="did",RD="key",fx="base58btc",DD="z",OD="K36",ND=32;function lx(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function pd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=lx(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function LD(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(j);k!==B;){for(var K=P[k],J=0,T=j-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=j-D;z!==j&&U[z]===0;)z++;for(var ue=u.repeat(N);z>>0,j=new Uint8Array(B);P[N];){var U=r[P.charCodeAt(N)];if(U===255)return;for(var K=0,J=B-1;(U!==0||K>>0,j[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,N++}if(P[N]!==" "){for(var T=B-k;T!==B&&j[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=j[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:A}}var kD=LD,BD=kD;const $D=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},FD=t=>new TextEncoder().encode(t),jD=t=>new TextDecoder().decode(t);class UD{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class qD{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return hx(this,e)}}class zD{constructor(e){this.decoders=e}or(e){return hx(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const hx=(t,e)=>new zD({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class HD{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new UD(e,r,n),this.decoder=new qD(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const gd=({name:t,prefix:e,encode:r,decode:n})=>new HD(t,e,r,n),rl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=BD(r,e);return gd({prefix:t,name:e,encode:n,decode:s=>$D(i(s))})},WD=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},KD=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<gd({prefix:e,name:t,encode(i){return KD(i,n,r)},decode(i){return WD(i,n,r,t)}}),VD=gd({prefix:"\0",name:"identity",encode:t=>jD(t),decode:t=>FD(t)}),GD=Object.freeze(Object.defineProperty({__proto__:null,identity:VD},Symbol.toStringTag,{value:"Module"})),YD=jn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),JD=Object.freeze(Object.defineProperty({__proto__:null,base2:YD},Symbol.toStringTag,{value:"Module"})),XD=jn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),ZD=Object.freeze(Object.defineProperty({__proto__:null,base8:XD},Symbol.toStringTag,{value:"Module"})),QD=rl({prefix:"9",name:"base10",alphabet:"0123456789"}),eO=Object.freeze(Object.defineProperty({__proto__:null,base10:QD},Symbol.toStringTag,{value:"Module"})),tO=jn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),rO=jn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),nO=Object.freeze(Object.defineProperty({__proto__:null,base16:tO,base16upper:rO},Symbol.toStringTag,{value:"Module"})),iO=jn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),sO=jn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),oO=jn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),aO=jn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),cO=jn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),uO=jn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),fO=jn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),lO=jn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),hO=jn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),dO=Object.freeze(Object.defineProperty({__proto__:null,base32:iO,base32hex:cO,base32hexpad:fO,base32hexpadupper:lO,base32hexupper:uO,base32pad:oO,base32padupper:aO,base32upper:sO,base32z:hO},Symbol.toStringTag,{value:"Module"})),pO=rl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),gO=rl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),mO=Object.freeze(Object.defineProperty({__proto__:null,base36:pO,base36upper:gO},Symbol.toStringTag,{value:"Module"})),vO=rl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),bO=rl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),yO=Object.freeze(Object.defineProperty({__proto__:null,base58btc:vO,base58flickr:bO},Symbol.toStringTag,{value:"Module"})),wO=jn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),xO=jn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),_O=jn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),EO=jn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),SO=Object.freeze(Object.defineProperty({__proto__:null,base64:wO,base64pad:xO,base64url:_O,base64urlpad:EO},Symbol.toStringTag,{value:"Module"})),dx=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),AO=dx.reduce((t,e,r)=>(t[r]=e,t),[]),PO=dx.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function MO(t){return t.reduce((e,r)=>(e+=AO[r],e),"")}function IO(t){const e=[];for(const r of t){const n=PO[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const CO=gd({prefix:"🚀",name:"base256emoji",encode:MO,decode:IO}),TO=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:CO},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const px={...GD,...JD,...ZD,...eO,...nO,...dO,...mO,...yO,...SO,...TO};function gx(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const mx=gx("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),pm=gx("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=lx(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new jO:typeof navigator<"u"?KO(navigator.userAgent):GO()}function WO(t){return t!==""&&zO.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function KO(t){var e=WO(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new FO;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<_x&&(i=xx(xx([],i,!0),YO(_x-i.length),!0)):i=[];var s=i.join("."),o=VO(t),a=qO.exec(t);return a&&a[1]?new $O(r,s,o,a[1]):new kO(r,s,o)}function VO(t){for(var e=0,r=Ex.length;e-1){const D=P.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let k=e.protocol+"//"+e.host;if(D.indexOf("/")===0)k+=D;else{const B=e.pathname.split("/");B.pop();const j=B.join("/");k+=j+"/"+D}y.push(k)}else if(D.indexOf("//")===0){const k=e.protocol+D;y.push(k)}else y.push(D)}}return y}function n(...p){const y=t.getElementsByTagName("meta");for(let A=0;AP.getAttribute(D)).filter(D=>D?p.includes(D):!1);if(N.length&&N){const D=P.getAttribute("content");if(D)return D}}return""}function i(){let p=n("name","og:site_name","og:title","twitter:title");return p||(p=t.title),p}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}Ax=vm.getWindowMetadata=oN;var il={},aN=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Mx="%[a-f0-9]{2}",Ix=new RegExp("("+Mx+")|([^%]+?)","gi"),Cx=new RegExp("("+Mx+")+","gi");function bm(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],bm(r),bm(n))}function cN(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(Ix)||[],r=1;r{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},hN=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;sB==null,o=Symbol("encodeFragmentIdentifier");function a(B){switch(B.arrayFormat){case"index":return j=>(U,K)=>{const J=U.length;return K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),"[",J,"]"].join("")]:[...U,[d(j,B),"[",d(J,B),"]=",d(K,B)].join("")]};case"bracket":return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),"[]"].join("")]:[...U,[d(j,B),"[]=",d(K,B)].join("")];case"colon-list-separator":return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),":list="].join("")]:[...U,[d(j,B),":list=",d(K,B)].join("")];case"comma":case"separator":case"bracket-separator":{const j=B.arrayFormat==="bracket-separator"?"[]=":"=";return U=>(K,J)=>J===void 0||B.skipNull&&J===null||B.skipEmptyString&&J===""?K:(J=J===null?"":J,K.length===0?[[d(U,B),j,d(J,B)].join("")]:[[K,d(J,B)].join(B.arrayFormatSeparator)])}default:return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,d(j,B)]:[...U,[d(j,B),"=",d(K,B)].join("")]}}function u(B){let j;switch(B.arrayFormat){case"index":return(U,K,J)=>{if(j=/\[(\d*)\]$/.exec(U),U=U.replace(/\[\d*\]$/,""),!j){J[U]=K;return}J[U]===void 0&&(J[U]={}),J[U][j[1]]=K};case"bracket":return(U,K,J)=>{if(j=/(\[\])$/.exec(U),U=U.replace(/\[\]$/,""),!j){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"colon-list-separator":return(U,K,J)=>{if(j=/(:list)$/.exec(U),U=U.replace(/:list$/,""),!j){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"comma":case"separator":return(U,K,J)=>{const T=typeof K=="string"&&K.includes(B.arrayFormatSeparator),z=typeof K=="string"&&!T&&p(K,B).includes(B.arrayFormatSeparator);K=z?p(K,B):K;const ue=T||z?K.split(B.arrayFormatSeparator).map(_e=>p(_e,B)):K===null?K:p(K,B);J[U]=ue};case"bracket-separator":return(U,K,J)=>{const T=/(\[\])$/.test(U);if(U=U.replace(/\[\]$/,""),!T){J[U]=K&&p(K,B);return}const z=K===null?[]:K.split(B.arrayFormatSeparator).map(ue=>p(ue,B));if(J[U]===void 0){J[U]=z;return}J[U]=[].concat(J[U],z)};default:return(U,K,J)=>{if(J[U]===void 0){J[U]=K;return}J[U]=[].concat(J[U],K)}}}function l(B){if(typeof B!="string"||B.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function d(B,j){return j.encode?j.strict?e(B):encodeURIComponent(B):B}function p(B,j){return j.decode?r(B):B}function y(B){return Array.isArray(B)?B.sort():typeof B=="object"?y(Object.keys(B)).sort((j,U)=>Number(j)-Number(U)).map(j=>B[j]):B}function A(B){const j=B.indexOf("#");return j!==-1&&(B=B.slice(0,j)),B}function P(B){let j="";const U=B.indexOf("#");return U!==-1&&(j=B.slice(U)),j}function N(B){B=A(B);const j=B.indexOf("?");return j===-1?"":B.slice(j+1)}function D(B,j){return j.parseNumbers&&!Number.isNaN(Number(B))&&typeof B=="string"&&B.trim()!==""?B=Number(B):j.parseBooleans&&B!==null&&(B.toLowerCase()==="true"||B.toLowerCase()==="false")&&(B=B.toLowerCase()==="true"),B}function k(B,j){j=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},j),l(j.arrayFormatSeparator);const U=u(j),K=Object.create(null);if(typeof B!="string"||(B=B.trim().replace(/^[?#&]/,""),!B))return K;for(const J of B.split("&")){if(J==="")continue;let[T,z]=n(j.decode?J.replace(/\+/g," "):J,"=");z=z===void 0?null:["comma","separator","bracket-separator"].includes(j.arrayFormat)?z:p(z,j),U(p(T,j),z,K)}for(const J of Object.keys(K)){const T=K[J];if(typeof T=="object"&&T!==null)for(const z of Object.keys(T))T[z]=D(T[z],j);else K[J]=D(T,j)}return j.sort===!1?K:(j.sort===!0?Object.keys(K).sort():Object.keys(K).sort(j.sort)).reduce((J,T)=>{const z=K[T];return z&&typeof z=="object"&&!Array.isArray(z)?J[T]=y(z):J[T]=z,J},Object.create(null))}t.extract=N,t.parse=k,t.stringify=(B,j)=>{if(!B)return"";j=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},j),l(j.arrayFormatSeparator);const U=z=>j.skipNull&&s(B[z])||j.skipEmptyString&&B[z]==="",K=a(j),J={};for(const z of Object.keys(B))U(z)||(J[z]=B[z]);const T=Object.keys(J);return j.sort!==!1&&T.sort(j.sort),T.map(z=>{const ue=B[z];return ue===void 0?"":ue===null?d(z,j):Array.isArray(ue)?ue.length===0&&j.arrayFormat==="bracket-separator"?d(z,j)+"[]":ue.reduce(K(z),[]).join("&"):d(z,j)+"="+d(ue,j)}).filter(z=>z.length>0).join("&")},t.parseUrl=(B,j)=>{j=Object.assign({decode:!0},j);const[U,K]=n(B,"#");return Object.assign({url:U.split("?")[0]||"",query:k(N(B),j)},j&&j.parseFragmentIdentifier&&K?{fragmentIdentifier:p(K,j)}:{})},t.stringifyUrl=(B,j)=>{j=Object.assign({encode:!0,strict:!0,[o]:!0},j);const U=A(B.url).split("?")[0]||"",K=t.extract(B.url),J=t.parse(K,{sort:!1}),T=Object.assign(J,B.query);let z=t.stringify(T,j);z&&(z=`?${z}`);let ue=P(B.url);return B.fragmentIdentifier&&(ue=`#${j[o]?d(B.fragmentIdentifier,j):B.fragmentIdentifier}`),`${U}${z}${ue}`},t.pick=(B,j,U)=>{U=Object.assign({parseFragmentIdentifier:!0,[o]:!1},U);const{url:K,query:J,fragmentIdentifier:T}=t.parseUrl(B,U);return t.stringifyUrl({url:K,query:i(J,j),fragmentIdentifier:T},U)},t.exclude=(B,j,U)=>{const K=Array.isArray(j)?J=>!j.includes(J):(J,T)=>!j(J,T);return t.pick(B,K,U)}})(il);var Tx={exports:{}};/** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.8.0 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT - */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=nn:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],g=[4,1024,262144,67108864],y=[1,256,65536,16777216],A=[6,1536,393216,100663296],P=[0,8,16,24],N=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],D=[224,256,384,512],k=[128,256],B=["hex","buffer","arrayBuffer","array","digest"],j={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(O){return Object.prototype.toString.call(O)==="[object Array]"}),u&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(O){return typeof O=="object"&&O.buffer&&O.buffer.constructor===ArrayBuffer});for(var U=function(O,se,ee){return function(X){return new I(O,se,O).update(X)[ee]()}},K=function(O,se,ee){return function(X,Q){return new I(O,se,Q).update(X)[ee]()}},J=function(O,se,ee){return function(X,Q,R,Z){return f["cshake"+O].update(X,Q,R,Z)[ee]()}},T=function(O,se,ee){return function(X,Q,R,Z){return f["kmac"+O].update(X,Q,R,Z)[ee]()}},z=function(O,se,ee,X){for(var Q=0;Q>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ee>>5,this.extraBytes=(ee&31)>>3;for(var X=0;X<50;++X)this.s[X]=0}I.prototype.update=function(O){if(this.finalized)throw new Error(r);var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}for(var X=this.blocks,Q=this.byteCount,R=O.length,Z=this.blockCount,te=0,le=this.s,ie,fe;te>2]|=O[te]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(X[ie>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=Q){for(this.start=ie-Q,this.block=X[Z],ie=0;ie>8,ee=O&255;ee>0;)Q.unshift(ee),O=O>>8,ee=O&255,++X;return se?Q.push(X):Q.unshift(X),this.update(Q),Q.length},I.prototype.encodeString=function(O){var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}var X=0,Q=O.length;if(se)X=Q;else for(var R=0;R=57344?X+=3:(Z=65536+((Z&1023)<<10|O.charCodeAt(++R)&1023),X+=4)}return X+=this.encode(X*8),this.update(O),X},I.prototype.bytepad=function(O,se){for(var ee=this.encode(se),X=0;X>2]|=this.padding[se&3],this.lastByteIndex===this.byteCount)for(O[0]=O[ee],se=1;se>4&15]+l[te&15]+l[te>>12&15]+l[te>>8&15]+l[te>>20&15]+l[te>>16&15]+l[te>>28&15]+l[te>>24&15];R%O===0&&(ae(se),Q=0)}return X&&(te=se[Q],Z+=l[te>>4&15]+l[te&15],X>1&&(Z+=l[te>>12&15]+l[te>>8&15]),X>2&&(Z+=l[te>>20&15]+l[te>>16&15])),Z},I.prototype.arrayBuffer=function(){this.finalize();var O=this.blockCount,se=this.s,ee=this.outputBlocks,X=this.extraBytes,Q=0,R=0,Z=this.outputBits>>3,te;X?te=new ArrayBuffer(ee+1<<2):te=new ArrayBuffer(Z);for(var le=new Uint32Array(te);R>8&255,Z[te+2]=le>>16&255,Z[te+3]=le>>24&255;R%O===0&&ae(se)}return X&&(te=R<<2,le=se[Q],Z[te]=le&255,X>1&&(Z[te+1]=le>>8&255),X>2&&(Z[te+2]=le>>16&255)),Z};function F(O,se,ee){I.call(this,O,se,ee)}F.prototype=new I,F.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var ae=function(O){var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me,Ne,Te,$e,Ie,Le,Ve,ke,ze,He,Ee,Qe,ct,Be,et,rt,Je,pt,ht,ft,Ht,Jt,St,er,Xt,Ot,Bt,Tt,vt,Dt,Lt,bt,$t,jt,nt,Ft,$,H,V,C,Y,q,oe,pe,xe,Re,De,it,Ue,gt,st,tt;for(X=0;X<48;X+=2)Q=O[0]^O[10]^O[20]^O[30]^O[40],R=O[1]^O[11]^O[21]^O[31]^O[41],Z=O[2]^O[12]^O[22]^O[32]^O[42],te=O[3]^O[13]^O[23]^O[33]^O[43],le=O[4]^O[14]^O[24]^O[34]^O[44],ie=O[5]^O[15]^O[25]^O[35]^O[45],fe=O[6]^O[16]^O[26]^O[36]^O[46],ve=O[7]^O[17]^O[27]^O[37]^O[47],Me=O[8]^O[18]^O[28]^O[38]^O[48],Ne=O[9]^O[19]^O[29]^O[39]^O[49],se=Me^(Z<<1|te>>>31),ee=Ne^(te<<1|Z>>>31),O[0]^=se,O[1]^=ee,O[10]^=se,O[11]^=ee,O[20]^=se,O[21]^=ee,O[30]^=se,O[31]^=ee,O[40]^=se,O[41]^=ee,se=Q^(le<<1|ie>>>31),ee=R^(ie<<1|le>>>31),O[2]^=se,O[3]^=ee,O[12]^=se,O[13]^=ee,O[22]^=se,O[23]^=ee,O[32]^=se,O[33]^=ee,O[42]^=se,O[43]^=ee,se=Z^(fe<<1|ve>>>31),ee=te^(ve<<1|fe>>>31),O[4]^=se,O[5]^=ee,O[14]^=se,O[15]^=ee,O[24]^=se,O[25]^=ee,O[34]^=se,O[35]^=ee,O[44]^=se,O[45]^=ee,se=le^(Me<<1|Ne>>>31),ee=ie^(Ne<<1|Me>>>31),O[6]^=se,O[7]^=ee,O[16]^=se,O[17]^=ee,O[26]^=se,O[27]^=ee,O[36]^=se,O[37]^=ee,O[46]^=se,O[47]^=ee,se=fe^(Q<<1|R>>>31),ee=ve^(R<<1|Q>>>31),O[8]^=se,O[9]^=ee,O[18]^=se,O[19]^=ee,O[28]^=se,O[29]^=ee,O[38]^=se,O[39]^=ee,O[48]^=se,O[49]^=ee,Te=O[0],$e=O[1],nt=O[11]<<4|O[10]>>>28,Ft=O[10]<<4|O[11]>>>28,Je=O[20]<<3|O[21]>>>29,pt=O[21]<<3|O[20]>>>29,Ue=O[31]<<9|O[30]>>>23,gt=O[30]<<9|O[31]>>>23,Lt=O[40]<<18|O[41]>>>14,bt=O[41]<<18|O[40]>>>14,St=O[2]<<1|O[3]>>>31,er=O[3]<<1|O[2]>>>31,Ie=O[13]<<12|O[12]>>>20,Le=O[12]<<12|O[13]>>>20,$=O[22]<<10|O[23]>>>22,H=O[23]<<10|O[22]>>>22,ht=O[33]<<13|O[32]>>>19,ft=O[32]<<13|O[33]>>>19,st=O[42]<<2|O[43]>>>30,tt=O[43]<<2|O[42]>>>30,oe=O[5]<<30|O[4]>>>2,pe=O[4]<<30|O[5]>>>2,Xt=O[14]<<6|O[15]>>>26,Ot=O[15]<<6|O[14]>>>26,Ve=O[25]<<11|O[24]>>>21,ke=O[24]<<11|O[25]>>>21,V=O[34]<<15|O[35]>>>17,C=O[35]<<15|O[34]>>>17,Ht=O[45]<<29|O[44]>>>3,Jt=O[44]<<29|O[45]>>>3,ct=O[6]<<28|O[7]>>>4,Be=O[7]<<28|O[6]>>>4,xe=O[17]<<23|O[16]>>>9,Re=O[16]<<23|O[17]>>>9,Bt=O[26]<<25|O[27]>>>7,Tt=O[27]<<25|O[26]>>>7,ze=O[36]<<21|O[37]>>>11,He=O[37]<<21|O[36]>>>11,Y=O[47]<<24|O[46]>>>8,q=O[46]<<24|O[47]>>>8,$t=O[8]<<27|O[9]>>>5,jt=O[9]<<27|O[8]>>>5,et=O[18]<<20|O[19]>>>12,rt=O[19]<<20|O[18]>>>12,De=O[29]<<7|O[28]>>>25,it=O[28]<<7|O[29]>>>25,vt=O[38]<<8|O[39]>>>24,Dt=O[39]<<8|O[38]>>>24,Ee=O[48]<<14|O[49]>>>18,Qe=O[49]<<14|O[48]>>>18,O[0]=Te^~Ie&Ve,O[1]=$e^~Le&ke,O[10]=ct^~et&Je,O[11]=Be^~rt&pt,O[20]=St^~Xt&Bt,O[21]=er^~Ot&Tt,O[30]=$t^~nt&$,O[31]=jt^~Ft&H,O[40]=oe^~xe&De,O[41]=pe^~Re&it,O[2]=Ie^~Ve&ze,O[3]=Le^~ke&He,O[12]=et^~Je&ht,O[13]=rt^~pt&ft,O[22]=Xt^~Bt&vt,O[23]=Ot^~Tt&Dt,O[32]=nt^~$&V,O[33]=Ft^~H&C,O[42]=xe^~De&Ue,O[43]=Re^~it>,O[4]=Ve^~ze&Ee,O[5]=ke^~He&Qe,O[14]=Je^~ht&Ht,O[15]=pt^~ft&Jt,O[24]=Bt^~vt&Lt,O[25]=Tt^~Dt&bt,O[34]=$^~V&Y,O[35]=H^~C&q,O[44]=De^~Ue&st,O[45]=it^~gt&tt,O[6]=ze^~Ee&Te,O[7]=He^~Qe&$e,O[16]=ht^~Ht&ct,O[17]=ft^~Jt&Be,O[26]=vt^~Lt&St,O[27]=Dt^~bt&er,O[36]=V^~Y&$t,O[37]=C^~q&jt,O[46]=Ue^~st&oe,O[47]=gt^~tt&pe,O[8]=Ee^~Te&Ie,O[9]=Qe^~$e&Le,O[18]=Ht^~ct&et,O[19]=Jt^~Be&rt,O[28]=Lt^~St&Xt,O[29]=bt^~er&Ot,O[38]=Y^~$t&nt,O[39]=q^~jt&Ft,O[48]=st^~oe&xe,O[49]=tt^~pe&Re,O[0]^=N[X],O[1]^=N[X+1]};if(a)t.exports=f;else for(v=0;v{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const Nx=mN();var wm;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(wm||(wm={}));var ps;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(ps||(ps={}));const Lx="0123456789abcdef";class Kr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();vd[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Ox>vd[n])&&console.log.apply(console,r)}debug(...e){this._log(Kr.levels.DEBUG,e)}info(...e){this._log(Kr.levels.INFO,e)}warn(...e){this._log(Kr.levels.WARNING,e)}makeError(e,r,n){if(Dx)return this.makeError("censored error",r,{});r||(r=Kr.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(u=>{const l=n[u];try{if(l instanceof Uint8Array){let d="";for(let g=0;g>4],d+=Lx[l[g]&15];i.push(u+"=Uint8Array(0x"+d+")")}else i.push(u+"="+JSON.stringify(l))}catch{i.push(u+"="+JSON.stringify(n[u].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case ps.NUMERIC_FAULT:{o="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case ps.CALL_EXCEPTION:case ps.INSUFFICIENT_FUNDS:case ps.MISSING_NEW:case ps.NONCE_EXPIRED:case ps.REPLACEMENT_UNDERPRICED:case ps.TRANSACTION_REPLACED:case ps.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(u){a[u]=n[u]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Kr.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){Nx&&this.throwError("platform missing String.prototype.normalize",Kr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Nx})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Kr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Kr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return ym||(ym=new Kr(gN)),ym}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Rx){if(!e)return;this.globalLogger().throwError("error censorship permanent",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Dx=!!e,Rx=!!r}static setLogLevel(e){const r=vd[e.toLowerCase()];if(r==null){Kr.globalLogger().warn("invalid log level - "+e);return}Ox=r}static from(e){return new Kr(e)}}Kr.errors=ps,Kr.levels=wm;const vN="bytes/5.7.0",on=new Kr(vN);function kx(t){return!!t.toHexString}function uu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return uu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function bN(t){return Ns(t)&&!(t.length%2)||xm(t)}function Bx(t){return typeof t=="number"&&t==t&&t%1===0}function xm(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!Bx(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function bn(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),uu(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t)&&(t=t.toHexString()),Ns(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":on.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ibn(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),uu(n)}function wN(t,e){t=bn(t),t.length>e&&on.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),uu(r)}function Ns(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const _m="0123456789abcdef";function Ii(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=_m[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t))return t.toHexString();if(Ns(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":on.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(xm(t)){let r="0x";for(let n=0;n>4]+_m[i&15]}return r}return on.throwArgumentError("invalid hexlify value","value",t)}function xN(t){if(typeof t!="string")t=Ii(t);else if(!Ns(t)||t.length%2)return null;return(t.length-2)/2}function $x(t,e,r){return typeof t!="string"?t=Ii(t):(!Ns(t)||t.length%2)&&on.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function fu(t,e){for(typeof t!="string"?t=Ii(t):Ns(t)||on.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&on.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Fx(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(bN(t)){let r=bn(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64))):r.length===65?(e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64)),e.v=r[64]):on.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:on.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Ii(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=wN(bn(e._vs),32);e._vs=Ii(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&on.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=Ii(i);e.s==null?e.s=o:e.s!==o&&on.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?on.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&on.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Ns(e.r)?on.throwArgumentError("signature missing or invalid r","signature",t):e.r=fu(e.r,32),e.s==null||!Ns(e.s)?on.throwArgumentError("signature missing or invalid s","signature",t):e.s=fu(e.s,32);const r=bn(e.s);r[0]>=128&&on.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=Ii(r);e._vs&&(Ns(e._vs)||on.throwArgumentError("signature invalid _vs","signature",t),e._vs=fu(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&on.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Em(t){return"0x"+pN.keccak_256(bn(t))}var Sm={exports:{}};Sm.exports,function(t){(function(e,r){function n(m,f){if(!m)throw new Error(f||"Assertion failed")}function i(m,f){m.super_=f;var p=function(){};p.prototype=f.prototype,m.prototype=new p,m.prototype.constructor=m}function s(m,f,p){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((f==="le"||f==="be")&&(p=f,f=10),this._init(m||0,f||10,p||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,p){return f.cmp(p)>0?f:p},s.min=function(f,p){return f.cmp(p)<0?f:p},s.prototype._init=function(f,p,v){if(typeof f=="number")return this._initNumber(f,p,v);if(typeof f=="object")return this._initArray(f,p,v);p==="hex"&&(p=16),n(p===(p|0)&&p>=2&&p<=36),f=f.toString().replace(/\s+/g,"");var x=0;f[0]==="-"&&(x++,this.negative=1),x=0;x-=3)S=f[x]|f[x-1]<<8|f[x-2]<<16,this.words[_]|=S<>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);else if(v==="le")for(x=0,_=0;x>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);return this._strip()};function a(m,f){var p=m.charCodeAt(f);if(p>=48&&p<=57)return p-48;if(p>=65&&p<=70)return p-55;if(p>=97&&p<=102)return p-87;n(!1,"Invalid character in "+m)}function u(m,f,p){var v=a(m,p);return p-1>=f&&(v|=a(m,p-1)<<4),v}s.prototype._parseHex=function(f,p,v){this.length=Math.ceil((f.length-p)/6),this.words=new Array(this.length);for(var x=0;x=p;x-=2)b=u(f,p,x)<<_,this.words[S]|=b&67108863,_>=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8;else{var M=f.length-p;for(x=M%2===0?p+1:p;x=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8}this._strip()};function l(m,f,p,v){for(var x=0,_=0,S=Math.min(m.length,p),b=f;b=49?_=M-49+10:M>=17?_=M-17+10:_=M,n(M>=0&&_1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=g}catch{s.prototype.inspect=g}else s.prototype.inspect=g;function g(){return(this.red?""}var y=["","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"],A=[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,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(f,p){f=f||10,p=p|0||1;var v;if(f===16||f==="hex"){v="";for(var x=0,_=0,S=0;S>>24-x&16777215,x+=2,x>=26&&(x-=26,S--),_!==0||S!==this.length-1?v=y[6-M.length]+M+v:v=M+v}for(_!==0&&(v=_.toString(16)+v);v.length%p!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(f===(f|0)&&f>=2&&f<=36){var I=A[f],F=P[f];v="";var ae=this.clone();for(ae.negative=0;!ae.isZero();){var O=ae.modrn(F).toString(f);ae=ae.idivn(F),ae.isZero()?v=O+v:v=y[I-O.length]+O+v}for(this.isZero()&&(v="0"+v);v.length%p!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,p){return this.toArrayLike(o,f,p)}),s.prototype.toArray=function(f,p){return this.toArrayLike(Array,f,p)};var N=function(f,p){return f.allocUnsafe?f.allocUnsafe(p):new f(p)};s.prototype.toArrayLike=function(f,p,v){this._strip();var x=this.byteLength(),_=v||Math.max(1,x);n(x<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var S=N(f,_),b=p==="le"?"LE":"BE";return this["_toArrayLike"+b](S,x),S},s.prototype._toArrayLikeLE=function(f,p){for(var v=0,x=0,_=0,S=0;_>8&255),v>16&255),S===6?(v>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v=0&&(f[v--]=b>>8&255),v>=0&&(f[v--]=b>>16&255),S===6?(v>=0&&(f[v--]=b>>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v>=0)for(f[v--]=x;v>=0;)f[v--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var p=f,v=0;return p>=4096&&(v+=13,p>>>=13),p>=64&&(v+=7,p>>>=7),p>=8&&(v+=4,p>>>=4),p>=2&&(v+=2,p>>>=2),v+p},s.prototype._zeroBits=function(f){if(f===0)return 26;var p=f,v=0;return p&8191||(v+=13,p>>>=13),p&127||(v+=7,p>>>=7),p&15||(v+=4,p>>>=4),p&3||(v+=2,p>>>=2),p&1||v++,v},s.prototype.bitLength=function(){var f=this.words[this.length-1],p=this._countBits(f);return(this.length-1)*26+p};function D(m){for(var f=new Array(m.bitLength()),p=0;p>>x&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,p=0;pf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var p;this.length>f.length?p=f:p=this;for(var v=0;vf.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var p,v;this.length>f.length?(p=this,v=f):(p=f,v=this);for(var x=0;xf.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var p=Math.ceil(f/26)|0,v=f%26;this._expand(p),v>0&&p--;for(var x=0;x0&&(this.words[x]=~this.words[x]&67108863>>26-v),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,p){n(typeof f=="number"&&f>=0);var v=f/26|0,x=f%26;return this._expand(v+1),p?this.words[v]=this.words[v]|1<f.length?(v=this,x=f):(v=f,x=this);for(var _=0,S=0;S>>26;for(;_!==0&&S>>26;if(this.length=v.length,_!==0)this.words[this.length]=_,this.length++;else if(v!==this)for(;Sf.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var p=this.iadd(f);return f.negative=1,p._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var v=this.cmp(f);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,_;v>0?(x=this,_=f):(x=f,_=this);for(var S=0,b=0;b<_.length;b++)p=(x.words[b]|0)-(_.words[b]|0)+S,S=p>>26,this.words[b]=p&67108863;for(;S!==0&&b>26,this.words[b]=p&67108863;if(S===0&&b>>26,ae=M&67108863,O=Math.min(I,f.length-1),se=Math.max(0,I-m.length+1);se<=O;se++){var ee=I-se|0;x=m.words[ee]|0,_=f.words[se]|0,S=x*_+ae,F+=S/67108864|0,ae=S&67108863}p.words[I]=ae|0,M=F|0}return M!==0?p.words[I]=M|0:p.length--,p._strip()}var B=function(f,p,v){var x=f.words,_=p.words,S=v.words,b=0,M,I,F,ae=x[0]|0,O=ae&8191,se=ae>>>13,ee=x[1]|0,X=ee&8191,Q=ee>>>13,R=x[2]|0,Z=R&8191,te=R>>>13,le=x[3]|0,ie=le&8191,fe=le>>>13,ve=x[4]|0,Me=ve&8191,Ne=ve>>>13,Te=x[5]|0,$e=Te&8191,Ie=Te>>>13,Le=x[6]|0,Ve=Le&8191,ke=Le>>>13,ze=x[7]|0,He=ze&8191,Ee=ze>>>13,Qe=x[8]|0,ct=Qe&8191,Be=Qe>>>13,et=x[9]|0,rt=et&8191,Je=et>>>13,pt=_[0]|0,ht=pt&8191,ft=pt>>>13,Ht=_[1]|0,Jt=Ht&8191,St=Ht>>>13,er=_[2]|0,Xt=er&8191,Ot=er>>>13,Bt=_[3]|0,Tt=Bt&8191,vt=Bt>>>13,Dt=_[4]|0,Lt=Dt&8191,bt=Dt>>>13,$t=_[5]|0,jt=$t&8191,nt=$t>>>13,Ft=_[6]|0,$=Ft&8191,H=Ft>>>13,V=_[7]|0,C=V&8191,Y=V>>>13,q=_[8]|0,oe=q&8191,pe=q>>>13,xe=_[9]|0,Re=xe&8191,De=xe>>>13;v.negative=f.negative^p.negative,v.length=19,M=Math.imul(O,ht),I=Math.imul(O,ft),I=I+Math.imul(se,ht)|0,F=Math.imul(se,ft);var it=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(it>>>26)|0,it&=67108863,M=Math.imul(X,ht),I=Math.imul(X,ft),I=I+Math.imul(Q,ht)|0,F=Math.imul(Q,ft),M=M+Math.imul(O,Jt)|0,I=I+Math.imul(O,St)|0,I=I+Math.imul(se,Jt)|0,F=F+Math.imul(se,St)|0;var Ue=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,M=Math.imul(Z,ht),I=Math.imul(Z,ft),I=I+Math.imul(te,ht)|0,F=Math.imul(te,ft),M=M+Math.imul(X,Jt)|0,I=I+Math.imul(X,St)|0,I=I+Math.imul(Q,Jt)|0,F=F+Math.imul(Q,St)|0,M=M+Math.imul(O,Xt)|0,I=I+Math.imul(O,Ot)|0,I=I+Math.imul(se,Xt)|0,F=F+Math.imul(se,Ot)|0;var gt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(gt>>>26)|0,gt&=67108863,M=Math.imul(ie,ht),I=Math.imul(ie,ft),I=I+Math.imul(fe,ht)|0,F=Math.imul(fe,ft),M=M+Math.imul(Z,Jt)|0,I=I+Math.imul(Z,St)|0,I=I+Math.imul(te,Jt)|0,F=F+Math.imul(te,St)|0,M=M+Math.imul(X,Xt)|0,I=I+Math.imul(X,Ot)|0,I=I+Math.imul(Q,Xt)|0,F=F+Math.imul(Q,Ot)|0,M=M+Math.imul(O,Tt)|0,I=I+Math.imul(O,vt)|0,I=I+Math.imul(se,Tt)|0,F=F+Math.imul(se,vt)|0;var st=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(st>>>26)|0,st&=67108863,M=Math.imul(Me,ht),I=Math.imul(Me,ft),I=I+Math.imul(Ne,ht)|0,F=Math.imul(Ne,ft),M=M+Math.imul(ie,Jt)|0,I=I+Math.imul(ie,St)|0,I=I+Math.imul(fe,Jt)|0,F=F+Math.imul(fe,St)|0,M=M+Math.imul(Z,Xt)|0,I=I+Math.imul(Z,Ot)|0,I=I+Math.imul(te,Xt)|0,F=F+Math.imul(te,Ot)|0,M=M+Math.imul(X,Tt)|0,I=I+Math.imul(X,vt)|0,I=I+Math.imul(Q,Tt)|0,F=F+Math.imul(Q,vt)|0,M=M+Math.imul(O,Lt)|0,I=I+Math.imul(O,bt)|0,I=I+Math.imul(se,Lt)|0,F=F+Math.imul(se,bt)|0;var tt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(tt>>>26)|0,tt&=67108863,M=Math.imul($e,ht),I=Math.imul($e,ft),I=I+Math.imul(Ie,ht)|0,F=Math.imul(Ie,ft),M=M+Math.imul(Me,Jt)|0,I=I+Math.imul(Me,St)|0,I=I+Math.imul(Ne,Jt)|0,F=F+Math.imul(Ne,St)|0,M=M+Math.imul(ie,Xt)|0,I=I+Math.imul(ie,Ot)|0,I=I+Math.imul(fe,Xt)|0,F=F+Math.imul(fe,Ot)|0,M=M+Math.imul(Z,Tt)|0,I=I+Math.imul(Z,vt)|0,I=I+Math.imul(te,Tt)|0,F=F+Math.imul(te,vt)|0,M=M+Math.imul(X,Lt)|0,I=I+Math.imul(X,bt)|0,I=I+Math.imul(Q,Lt)|0,F=F+Math.imul(Q,bt)|0,M=M+Math.imul(O,jt)|0,I=I+Math.imul(O,nt)|0,I=I+Math.imul(se,jt)|0,F=F+Math.imul(se,nt)|0;var At=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(At>>>26)|0,At&=67108863,M=Math.imul(Ve,ht),I=Math.imul(Ve,ft),I=I+Math.imul(ke,ht)|0,F=Math.imul(ke,ft),M=M+Math.imul($e,Jt)|0,I=I+Math.imul($e,St)|0,I=I+Math.imul(Ie,Jt)|0,F=F+Math.imul(Ie,St)|0,M=M+Math.imul(Me,Xt)|0,I=I+Math.imul(Me,Ot)|0,I=I+Math.imul(Ne,Xt)|0,F=F+Math.imul(Ne,Ot)|0,M=M+Math.imul(ie,Tt)|0,I=I+Math.imul(ie,vt)|0,I=I+Math.imul(fe,Tt)|0,F=F+Math.imul(fe,vt)|0,M=M+Math.imul(Z,Lt)|0,I=I+Math.imul(Z,bt)|0,I=I+Math.imul(te,Lt)|0,F=F+Math.imul(te,bt)|0,M=M+Math.imul(X,jt)|0,I=I+Math.imul(X,nt)|0,I=I+Math.imul(Q,jt)|0,F=F+Math.imul(Q,nt)|0,M=M+Math.imul(O,$)|0,I=I+Math.imul(O,H)|0,I=I+Math.imul(se,$)|0,F=F+Math.imul(se,H)|0;var Rt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,M=Math.imul(He,ht),I=Math.imul(He,ft),I=I+Math.imul(Ee,ht)|0,F=Math.imul(Ee,ft),M=M+Math.imul(Ve,Jt)|0,I=I+Math.imul(Ve,St)|0,I=I+Math.imul(ke,Jt)|0,F=F+Math.imul(ke,St)|0,M=M+Math.imul($e,Xt)|0,I=I+Math.imul($e,Ot)|0,I=I+Math.imul(Ie,Xt)|0,F=F+Math.imul(Ie,Ot)|0,M=M+Math.imul(Me,Tt)|0,I=I+Math.imul(Me,vt)|0,I=I+Math.imul(Ne,Tt)|0,F=F+Math.imul(Ne,vt)|0,M=M+Math.imul(ie,Lt)|0,I=I+Math.imul(ie,bt)|0,I=I+Math.imul(fe,Lt)|0,F=F+Math.imul(fe,bt)|0,M=M+Math.imul(Z,jt)|0,I=I+Math.imul(Z,nt)|0,I=I+Math.imul(te,jt)|0,F=F+Math.imul(te,nt)|0,M=M+Math.imul(X,$)|0,I=I+Math.imul(X,H)|0,I=I+Math.imul(Q,$)|0,F=F+Math.imul(Q,H)|0,M=M+Math.imul(O,C)|0,I=I+Math.imul(O,Y)|0,I=I+Math.imul(se,C)|0,F=F+Math.imul(se,Y)|0;var Mt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,M=Math.imul(ct,ht),I=Math.imul(ct,ft),I=I+Math.imul(Be,ht)|0,F=Math.imul(Be,ft),M=M+Math.imul(He,Jt)|0,I=I+Math.imul(He,St)|0,I=I+Math.imul(Ee,Jt)|0,F=F+Math.imul(Ee,St)|0,M=M+Math.imul(Ve,Xt)|0,I=I+Math.imul(Ve,Ot)|0,I=I+Math.imul(ke,Xt)|0,F=F+Math.imul(ke,Ot)|0,M=M+Math.imul($e,Tt)|0,I=I+Math.imul($e,vt)|0,I=I+Math.imul(Ie,Tt)|0,F=F+Math.imul(Ie,vt)|0,M=M+Math.imul(Me,Lt)|0,I=I+Math.imul(Me,bt)|0,I=I+Math.imul(Ne,Lt)|0,F=F+Math.imul(Ne,bt)|0,M=M+Math.imul(ie,jt)|0,I=I+Math.imul(ie,nt)|0,I=I+Math.imul(fe,jt)|0,F=F+Math.imul(fe,nt)|0,M=M+Math.imul(Z,$)|0,I=I+Math.imul(Z,H)|0,I=I+Math.imul(te,$)|0,F=F+Math.imul(te,H)|0,M=M+Math.imul(X,C)|0,I=I+Math.imul(X,Y)|0,I=I+Math.imul(Q,C)|0,F=F+Math.imul(Q,Y)|0,M=M+Math.imul(O,oe)|0,I=I+Math.imul(O,pe)|0,I=I+Math.imul(se,oe)|0,F=F+Math.imul(se,pe)|0;var Et=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Et>>>26)|0,Et&=67108863,M=Math.imul(rt,ht),I=Math.imul(rt,ft),I=I+Math.imul(Je,ht)|0,F=Math.imul(Je,ft),M=M+Math.imul(ct,Jt)|0,I=I+Math.imul(ct,St)|0,I=I+Math.imul(Be,Jt)|0,F=F+Math.imul(Be,St)|0,M=M+Math.imul(He,Xt)|0,I=I+Math.imul(He,Ot)|0,I=I+Math.imul(Ee,Xt)|0,F=F+Math.imul(Ee,Ot)|0,M=M+Math.imul(Ve,Tt)|0,I=I+Math.imul(Ve,vt)|0,I=I+Math.imul(ke,Tt)|0,F=F+Math.imul(ke,vt)|0,M=M+Math.imul($e,Lt)|0,I=I+Math.imul($e,bt)|0,I=I+Math.imul(Ie,Lt)|0,F=F+Math.imul(Ie,bt)|0,M=M+Math.imul(Me,jt)|0,I=I+Math.imul(Me,nt)|0,I=I+Math.imul(Ne,jt)|0,F=F+Math.imul(Ne,nt)|0,M=M+Math.imul(ie,$)|0,I=I+Math.imul(ie,H)|0,I=I+Math.imul(fe,$)|0,F=F+Math.imul(fe,H)|0,M=M+Math.imul(Z,C)|0,I=I+Math.imul(Z,Y)|0,I=I+Math.imul(te,C)|0,F=F+Math.imul(te,Y)|0,M=M+Math.imul(X,oe)|0,I=I+Math.imul(X,pe)|0,I=I+Math.imul(Q,oe)|0,F=F+Math.imul(Q,pe)|0,M=M+Math.imul(O,Re)|0,I=I+Math.imul(O,De)|0,I=I+Math.imul(se,Re)|0,F=F+Math.imul(se,De)|0;var dt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(dt>>>26)|0,dt&=67108863,M=Math.imul(rt,Jt),I=Math.imul(rt,St),I=I+Math.imul(Je,Jt)|0,F=Math.imul(Je,St),M=M+Math.imul(ct,Xt)|0,I=I+Math.imul(ct,Ot)|0,I=I+Math.imul(Be,Xt)|0,F=F+Math.imul(Be,Ot)|0,M=M+Math.imul(He,Tt)|0,I=I+Math.imul(He,vt)|0,I=I+Math.imul(Ee,Tt)|0,F=F+Math.imul(Ee,vt)|0,M=M+Math.imul(Ve,Lt)|0,I=I+Math.imul(Ve,bt)|0,I=I+Math.imul(ke,Lt)|0,F=F+Math.imul(ke,bt)|0,M=M+Math.imul($e,jt)|0,I=I+Math.imul($e,nt)|0,I=I+Math.imul(Ie,jt)|0,F=F+Math.imul(Ie,nt)|0,M=M+Math.imul(Me,$)|0,I=I+Math.imul(Me,H)|0,I=I+Math.imul(Ne,$)|0,F=F+Math.imul(Ne,H)|0,M=M+Math.imul(ie,C)|0,I=I+Math.imul(ie,Y)|0,I=I+Math.imul(fe,C)|0,F=F+Math.imul(fe,Y)|0,M=M+Math.imul(Z,oe)|0,I=I+Math.imul(Z,pe)|0,I=I+Math.imul(te,oe)|0,F=F+Math.imul(te,pe)|0,M=M+Math.imul(X,Re)|0,I=I+Math.imul(X,De)|0,I=I+Math.imul(Q,Re)|0,F=F+Math.imul(Q,De)|0;var _t=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(_t>>>26)|0,_t&=67108863,M=Math.imul(rt,Xt),I=Math.imul(rt,Ot),I=I+Math.imul(Je,Xt)|0,F=Math.imul(Je,Ot),M=M+Math.imul(ct,Tt)|0,I=I+Math.imul(ct,vt)|0,I=I+Math.imul(Be,Tt)|0,F=F+Math.imul(Be,vt)|0,M=M+Math.imul(He,Lt)|0,I=I+Math.imul(He,bt)|0,I=I+Math.imul(Ee,Lt)|0,F=F+Math.imul(Ee,bt)|0,M=M+Math.imul(Ve,jt)|0,I=I+Math.imul(Ve,nt)|0,I=I+Math.imul(ke,jt)|0,F=F+Math.imul(ke,nt)|0,M=M+Math.imul($e,$)|0,I=I+Math.imul($e,H)|0,I=I+Math.imul(Ie,$)|0,F=F+Math.imul(Ie,H)|0,M=M+Math.imul(Me,C)|0,I=I+Math.imul(Me,Y)|0,I=I+Math.imul(Ne,C)|0,F=F+Math.imul(Ne,Y)|0,M=M+Math.imul(ie,oe)|0,I=I+Math.imul(ie,pe)|0,I=I+Math.imul(fe,oe)|0,F=F+Math.imul(fe,pe)|0,M=M+Math.imul(Z,Re)|0,I=I+Math.imul(Z,De)|0,I=I+Math.imul(te,Re)|0,F=F+Math.imul(te,De)|0;var ot=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(ot>>>26)|0,ot&=67108863,M=Math.imul(rt,Tt),I=Math.imul(rt,vt),I=I+Math.imul(Je,Tt)|0,F=Math.imul(Je,vt),M=M+Math.imul(ct,Lt)|0,I=I+Math.imul(ct,bt)|0,I=I+Math.imul(Be,Lt)|0,F=F+Math.imul(Be,bt)|0,M=M+Math.imul(He,jt)|0,I=I+Math.imul(He,nt)|0,I=I+Math.imul(Ee,jt)|0,F=F+Math.imul(Ee,nt)|0,M=M+Math.imul(Ve,$)|0,I=I+Math.imul(Ve,H)|0,I=I+Math.imul(ke,$)|0,F=F+Math.imul(ke,H)|0,M=M+Math.imul($e,C)|0,I=I+Math.imul($e,Y)|0,I=I+Math.imul(Ie,C)|0,F=F+Math.imul(Ie,Y)|0,M=M+Math.imul(Me,oe)|0,I=I+Math.imul(Me,pe)|0,I=I+Math.imul(Ne,oe)|0,F=F+Math.imul(Ne,pe)|0,M=M+Math.imul(ie,Re)|0,I=I+Math.imul(ie,De)|0,I=I+Math.imul(fe,Re)|0,F=F+Math.imul(fe,De)|0;var wt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(wt>>>26)|0,wt&=67108863,M=Math.imul(rt,Lt),I=Math.imul(rt,bt),I=I+Math.imul(Je,Lt)|0,F=Math.imul(Je,bt),M=M+Math.imul(ct,jt)|0,I=I+Math.imul(ct,nt)|0,I=I+Math.imul(Be,jt)|0,F=F+Math.imul(Be,nt)|0,M=M+Math.imul(He,$)|0,I=I+Math.imul(He,H)|0,I=I+Math.imul(Ee,$)|0,F=F+Math.imul(Ee,H)|0,M=M+Math.imul(Ve,C)|0,I=I+Math.imul(Ve,Y)|0,I=I+Math.imul(ke,C)|0,F=F+Math.imul(ke,Y)|0,M=M+Math.imul($e,oe)|0,I=I+Math.imul($e,pe)|0,I=I+Math.imul(Ie,oe)|0,F=F+Math.imul(Ie,pe)|0,M=M+Math.imul(Me,Re)|0,I=I+Math.imul(Me,De)|0,I=I+Math.imul(Ne,Re)|0,F=F+Math.imul(Ne,De)|0;var lt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(lt>>>26)|0,lt&=67108863,M=Math.imul(rt,jt),I=Math.imul(rt,nt),I=I+Math.imul(Je,jt)|0,F=Math.imul(Je,nt),M=M+Math.imul(ct,$)|0,I=I+Math.imul(ct,H)|0,I=I+Math.imul(Be,$)|0,F=F+Math.imul(Be,H)|0,M=M+Math.imul(He,C)|0,I=I+Math.imul(He,Y)|0,I=I+Math.imul(Ee,C)|0,F=F+Math.imul(Ee,Y)|0,M=M+Math.imul(Ve,oe)|0,I=I+Math.imul(Ve,pe)|0,I=I+Math.imul(ke,oe)|0,F=F+Math.imul(ke,pe)|0,M=M+Math.imul($e,Re)|0,I=I+Math.imul($e,De)|0,I=I+Math.imul(Ie,Re)|0,F=F+Math.imul(Ie,De)|0;var at=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(at>>>26)|0,at&=67108863,M=Math.imul(rt,$),I=Math.imul(rt,H),I=I+Math.imul(Je,$)|0,F=Math.imul(Je,H),M=M+Math.imul(ct,C)|0,I=I+Math.imul(ct,Y)|0,I=I+Math.imul(Be,C)|0,F=F+Math.imul(Be,Y)|0,M=M+Math.imul(He,oe)|0,I=I+Math.imul(He,pe)|0,I=I+Math.imul(Ee,oe)|0,F=F+Math.imul(Ee,pe)|0,M=M+Math.imul(Ve,Re)|0,I=I+Math.imul(Ve,De)|0,I=I+Math.imul(ke,Re)|0,F=F+Math.imul(ke,De)|0;var Ae=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,M=Math.imul(rt,C),I=Math.imul(rt,Y),I=I+Math.imul(Je,C)|0,F=Math.imul(Je,Y),M=M+Math.imul(ct,oe)|0,I=I+Math.imul(ct,pe)|0,I=I+Math.imul(Be,oe)|0,F=F+Math.imul(Be,pe)|0,M=M+Math.imul(He,Re)|0,I=I+Math.imul(He,De)|0,I=I+Math.imul(Ee,Re)|0,F=F+Math.imul(Ee,De)|0;var Pe=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,M=Math.imul(rt,oe),I=Math.imul(rt,pe),I=I+Math.imul(Je,oe)|0,F=Math.imul(Je,pe),M=M+Math.imul(ct,Re)|0,I=I+Math.imul(ct,De)|0,I=I+Math.imul(Be,Re)|0,F=F+Math.imul(Be,De)|0;var Ge=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,M=Math.imul(rt,Re),I=Math.imul(rt,De),I=I+Math.imul(Je,Re)|0,F=Math.imul(Je,De);var je=(b+M|0)+((I&8191)<<13)|0;return b=(F+(I>>>13)|0)+(je>>>26)|0,je&=67108863,S[0]=it,S[1]=Ue,S[2]=gt,S[3]=st,S[4]=tt,S[5]=At,S[6]=Rt,S[7]=Mt,S[8]=Et,S[9]=dt,S[10]=_t,S[11]=ot,S[12]=wt,S[13]=lt,S[14]=at,S[15]=Ae,S[16]=Pe,S[17]=Ge,S[18]=je,b!==0&&(S[19]=b,v.length++),v};Math.imul||(B=k);function j(m,f,p){p.negative=f.negative^m.negative,p.length=m.length+f.length;for(var v=0,x=0,_=0;_>>26)|0,x+=S>>>26,S&=67108863}p.words[_]=b,v=S,S=x}return v!==0?p.words[_]=v:p.length--,p._strip()}function U(m,f,p){return j(m,f,p)}s.prototype.mulTo=function(f,p){var v,x=this.length+f.length;return this.length===10&&f.length===10?v=B(this,f,p):x<63?v=k(this,f,p):x<1024?v=j(this,f,p):v=U(this,f,p),v},s.prototype.mul=function(f){var p=new s(null);return p.words=new Array(this.length+f.length),this.mulTo(f,p)},s.prototype.mulf=function(f){var p=new s(null);return p.words=new Array(this.length+f.length),U(this,f,p)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var p=f<0;p&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var v=0,x=0;x>=26,v+=_/67108864|0,v+=S>>>26,this.words[x]=S&67108863}return v!==0&&(this.words[x]=v,this.length++),p?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var p=D(f);if(p.length===0)return new s(1);for(var v=this,x=0;x=0);var p=f%26,v=(f-p)/26,x=67108863>>>26-p<<26-p,_;if(p!==0){var S=0;for(_=0;_>>26-p}S&&(this.words[_]=S,this.length++)}if(v!==0){for(_=this.length-1;_>=0;_--)this.words[_+v]=this.words[_];for(_=0;_=0);var x;p?x=(p-p%26)/26:x=0;var _=f%26,S=Math.min((f-_)/26,this.length),b=67108863^67108863>>>_<<_,M=v;if(x-=S,x=Math.max(0,x),M){for(var I=0;IS)for(this.length-=S,I=0;I=0&&(F!==0||I>=x);I--){var ae=this.words[I]|0;this.words[I]=F<<26-_|ae>>>_,F=ae&b}return M&&F!==0&&(M.words[M.length++]=F),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,p,v){return n(this.negative===0),this.iushrn(f,p,v)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var p=f%26,v=(f-p)/26,x=1<=0);var p=f%26,v=(f-p)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(p!==0&&v++,this.length=Math.min(v,this.length),p!==0){var x=67108863^67108863>>>p<=67108864;p++)this.words[p]-=67108864,p===this.length-1?this.words[p+1]=1:this.words[p+1]++;return this.length=Math.max(this.length,p+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var p=0;p>26)-(M/67108864|0),this.words[_+v]=S&67108863}for(;_>26,this.words[_+v]=S&67108863;if(b===0)return this._strip();for(n(b===-1),b=0,_=0;_>26,this.words[_]=S&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,p){var v=this.length-f.length,x=this.clone(),_=f,S=_.words[_.length-1]|0,b=this._countBits(S);v=26-b,v!==0&&(_=_.ushln(v),x.iushln(v),S=_.words[_.length-1]|0);var M=x.length-_.length,I;if(p!=="mod"){I=new s(null),I.length=M+1,I.words=new Array(I.length);for(var F=0;F=0;O--){var se=(x.words[_.length+O]|0)*67108864+(x.words[_.length+O-1]|0);for(se=Math.min(se/S|0,67108863),x._ishlnsubmul(_,se,O);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(_,1,O),x.isZero()||(x.negative^=1);I&&(I.words[O]=se)}return I&&I._strip(),x._strip(),p!=="div"&&v!==0&&x.iushrn(v),{div:I||null,mod:x}},s.prototype.divmod=function(f,p,v){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,_,S;return this.negative!==0&&f.negative===0?(S=this.neg().divmod(f,p),p!=="mod"&&(x=S.div.neg()),p!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.iadd(f)),{div:x,mod:_}):this.negative===0&&f.negative!==0?(S=this.divmod(f.neg(),p),p!=="mod"&&(x=S.div.neg()),{div:x,mod:S.mod}):this.negative&f.negative?(S=this.neg().divmod(f.neg(),p),p!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.isub(f)),{div:S.div,mod:_}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?p==="div"?{div:this.divn(f.words[0]),mod:null}:p==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,p)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var p=this.divmod(f);if(p.mod.isZero())return p.div;var v=p.div.negative!==0?p.mod.isub(f):p.mod,x=f.ushrn(1),_=f.andln(1),S=v.cmp(x);return S<0||_===1&&S===0?p.div:p.div.negative!==0?p.div.isubn(1):p.div.iaddn(1)},s.prototype.modrn=function(f){var p=f<0;p&&(f=-f),n(f<=67108863);for(var v=(1<<26)%f,x=0,_=this.length-1;_>=0;_--)x=(v*x+(this.words[_]|0))%f;return p?-x:x},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var p=f<0;p&&(f=-f),n(f<=67108863);for(var v=0,x=this.length-1;x>=0;x--){var _=(this.words[x]|0)+v*67108864;this.words[x]=_/f|0,v=_%f}return this._strip(),p?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var p=this,v=f.clone();p.negative!==0?p=p.umod(f):p=p.clone();for(var x=new s(1),_=new s(0),S=new s(0),b=new s(1),M=0;p.isEven()&&v.isEven();)p.iushrn(1),v.iushrn(1),++M;for(var I=v.clone(),F=p.clone();!p.isZero();){for(var ae=0,O=1;!(p.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(p.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(I),_.isub(F)),x.iushrn(1),_.iushrn(1);for(var se=0,ee=1;!(v.words[0]&ee)&&se<26;++se,ee<<=1);if(se>0)for(v.iushrn(se);se-- >0;)(S.isOdd()||b.isOdd())&&(S.iadd(I),b.isub(F)),S.iushrn(1),b.iushrn(1);p.cmp(v)>=0?(p.isub(v),x.isub(S),_.isub(b)):(v.isub(p),S.isub(x),b.isub(_))}return{a:S,b,gcd:v.iushln(M)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var p=this,v=f.clone();p.negative!==0?p=p.umod(f):p=p.clone();for(var x=new s(1),_=new s(0),S=v.clone();p.cmpn(1)>0&&v.cmpn(1)>0;){for(var b=0,M=1;!(p.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(p.iushrn(b);b-- >0;)x.isOdd()&&x.iadd(S),x.iushrn(1);for(var I=0,F=1;!(v.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(v.iushrn(I);I-- >0;)_.isOdd()&&_.iadd(S),_.iushrn(1);p.cmp(v)>=0?(p.isub(v),x.isub(_)):(v.isub(p),_.isub(x))}var ae;return p.cmpn(1)===0?ae=x:ae=_,ae.cmpn(0)<0&&ae.iadd(f),ae},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var p=this.clone(),v=f.clone();p.negative=0,v.negative=0;for(var x=0;p.isEven()&&v.isEven();x++)p.iushrn(1),v.iushrn(1);do{for(;p.isEven();)p.iushrn(1);for(;v.isEven();)v.iushrn(1);var _=p.cmp(v);if(_<0){var S=p;p=v,v=S}else if(_===0||v.cmpn(1)===0)break;p.isub(v)}while(!0);return v.iushln(x)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var p=f%26,v=(f-p)/26,x=1<>>26,b&=67108863,this.words[S]=b}return _!==0&&(this.words[S]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var p=f<0;if(this.negative!==0&&!p)return-1;if(this.negative===0&&p)return 1;this._strip();var v;if(this.length>1)v=1;else{p&&(f=-f),n(f<=67108863,"Number is too big");var x=this.words[0]|0;v=x===f?0:xf.length)return 1;if(this.length=0;v--){var x=this.words[v]|0,_=f.words[v]|0;if(x!==_){x<_?p=-1:x>_&&(p=1);break}}return p},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new G(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var K={k256:null,p224:null,p192:null,p25519:null};function J(m,f){this.name=m,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}J.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},J.prototype.ireduce=function(f){var p=f,v;do this.split(p,this.tmp),p=this.imulK(p),p=p.iadd(this.tmp),v=p.bitLength();while(v>this.n);var x=v0?p.isub(this.p):p.strip!==void 0?p.strip():p._strip(),p},J.prototype.split=function(f,p){f.iushrn(this.n,0,p)},J.prototype.imulK=function(f){return f.imul(this.k)};function T(){J.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(T,J),T.prototype.split=function(f,p){for(var v=4194303,x=Math.min(f.length,9),_=0;_>>22,S=b}S>>>=22,f.words[_-10]=S,S===0&&f.length>10?f.length-=10:f.length-=9},T.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var p=0,v=0;v>>=26,f.words[v]=_,p=x}return p!==0&&(f.words[f.length++]=p),f},s._prime=function(f){if(K[f])return K[f];var p;if(f==="k256")p=new T;else if(f==="p224")p=new z;else if(f==="p192")p=new ue;else if(f==="p25519")p=new _e;else throw new Error("Unknown prime "+f);return K[f]=p,p};function G(m){if(typeof m=="string"){var f=s._prime(m);this.m=f.p,this.prime=f}else n(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}G.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},G.prototype._verify2=function(f,p){n((f.negative|p.negative)===0,"red works only with positives"),n(f.red&&f.red===p.red,"red works only with red numbers")},G.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(d(f,f.umod(this.m)._forceRed(this)),f)},G.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},G.prototype.add=function(f,p){this._verify2(f,p);var v=f.add(p);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},G.prototype.iadd=function(f,p){this._verify2(f,p);var v=f.iadd(p);return v.cmp(this.m)>=0&&v.isub(this.m),v},G.prototype.sub=function(f,p){this._verify2(f,p);var v=f.sub(p);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},G.prototype.isub=function(f,p){this._verify2(f,p);var v=f.isub(p);return v.cmpn(0)<0&&v.iadd(this.m),v},G.prototype.shl=function(f,p){return this._verify1(f),this.imod(f.ushln(p))},G.prototype.imul=function(f,p){return this._verify2(f,p),this.imod(f.imul(p))},G.prototype.mul=function(f,p){return this._verify2(f,p),this.imod(f.mul(p))},G.prototype.isqr=function(f){return this.imul(f,f.clone())},G.prototype.sqr=function(f){return this.mul(f,f)},G.prototype.sqrt=function(f){if(f.isZero())return f.clone();var p=this.m.andln(3);if(n(p%2===1),p===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(f,v)}for(var x=this.m.subn(1),_=0;!x.isZero()&&x.andln(1)===0;)_++,x.iushrn(1);n(!x.isZero());var S=new s(1).toRed(this),b=S.redNeg(),M=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,M).cmp(b)!==0;)I.redIAdd(b);for(var F=this.pow(I,x),ae=this.pow(f,x.addn(1).iushrn(1)),O=this.pow(f,x),se=_;O.cmp(S)!==0;){for(var ee=O,X=0;ee.cmp(S)!==0;X++)ee=ee.redSqr();n(X=0;_--){for(var F=p.words[_],ae=I-1;ae>=0;ae--){var O=F>>ae&1;if(S!==x[0]&&(S=this.sqr(S)),O===0&&b===0){M=0;continue}b<<=1,b|=O,M++,!(M!==v&&(_!==0||ae!==0))&&(S=this.mul(S,x[b]),M=0,b=0)}I=26}return S},G.prototype.convertTo=function(f){var p=f.umod(this.m);return p===f?p.clone():p},G.prototype.convertFrom=function(f){var p=f.clone();return p.red=null,p},s.mont=function(f){return new E(f)};function E(m){G.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(E,G),E.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},E.prototype.convertFrom=function(f){var p=this.imod(f.mul(this.rinv));return p.red=null,p},E.prototype.imul=function(f,p){if(f.isZero()||p.isZero())return f.words[0]=0,f.length=1,f;var v=f.imul(p),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.mul=function(f,p){if(f.isZero()||p.isZero())return new s(0)._forceRed(this);var v=f.mul(p),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.invm=function(f){var p=this.imod(f._invmp(this.m).mul(this.r2));return p._forceRed(this)}})(t,nn)}(Sm);var _N=Sm.exports;const rr=ji(_N);var EN=rr.BN;function SN(t){return new EN(t,36).toString(16)}const AN="strings/5.7.0",PN=new Kr(AN);var bd;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(bd||(bd={}));var jx;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(jx||(jx={}));function Am(t,e=bd.current){e!=bd.current&&(PN.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return bn(r)}const MN=`Ethereum Signed Message: -`;function Ux(t){return typeof t=="string"&&(t=Am(t)),Em(yN([Am(MN),Am(String(t.length)),t]))}const IN="address/5.7.0",sl=new Kr(IN);function qx(t){Ns(t,20)||sl.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=bn(Em(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const CN=9007199254740991;function TN(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const Pm={};for(let t=0;t<10;t++)Pm[String(t)]=String(t);for(let t=0;t<26;t++)Pm[String.fromCharCode(65+t)]=String(10+t);const zx=Math.floor(TN(CN));function RN(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Pm[n]).join("");for(;e.length>=zx;){let n=e.substring(0,zx);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function DN(t){let e=null;if(typeof t!="string"&&sl.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=qx(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&sl.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==RN(t)&&sl.throwArgumentError("bad icap checksum","address",t),e=SN(t.substring(4));e.length<40;)e="0"+e;e=qx("0x"+e)}else sl.throwArgumentError("invalid address","address",t);return e}function ol(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var al={},yr={},Ga=Hx;function Hx(t,e){if(!t)throw new Error(e||"Assertion failed")}Hx.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var Mm={exports:{}};typeof Object.create=="function"?Mm.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Mm.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var yd=Mm.exports,ON=Ga,NN=yd;yr.inherits=NN;function LN(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function kN(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):LN(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}yr.htonl=Wx;function $N(t,e){for(var r="",n=0;n>>0}return s}yr.join32=FN;function jN(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}yr.split32=jN;function UN(t,e){return t>>>e|t<<32-e}yr.rotr32=UN;function qN(t,e){return t<>>32-e}yr.rotl32=qN;function zN(t,e){return t+e>>>0}yr.sum32=zN;function HN(t,e,r){return t+e+r>>>0}yr.sum32_3=HN;function WN(t,e,r,n){return t+e+r+n>>>0}yr.sum32_4=WN;function KN(t,e,r,n,i){return t+e+r+n+i>>>0}yr.sum32_5=KN;function VN(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}yr.sum64=VN;function GN(t,e,r,n){var i=e+n>>>0,s=(i>>0}yr.sum64_hi=GN;function YN(t,e,r,n){var i=e+n;return i>>>0}yr.sum64_lo=YN;function JN(t,e,r,n,i,s,o,a){var u=0,l=e;l=l+n>>>0,u+=l>>0,u+=l>>0,u+=l>>0}yr.sum64_4_hi=JN;function XN(t,e,r,n,i,s,o,a){var u=e+n+s+a;return u>>>0}yr.sum64_4_lo=XN;function ZN(t,e,r,n,i,s,o,a,u,l){var d=0,g=e;g=g+n>>>0,d+=g>>0,d+=g>>0,d+=g>>0,d+=g>>0}yr.sum64_5_hi=ZN;function QN(t,e,r,n,i,s,o,a,u,l){var d=e+n+s+a+l;return d>>>0}yr.sum64_5_lo=QN;function eL(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}yr.rotr64_hi=eL;function tL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.rotr64_lo=tL;function rL(t,e,r){return t>>>r}yr.shr64_hi=rL;function nL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.shr64_lo=nL;var lu={},Gx=yr,iL=Ga;function wd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}lu.BlockHash=wd,wd.prototype.update=function(e,r){if(e=Gx.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Gx.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}Ls.g0_256=uL;function fL(t){return ks(t,17)^ks(t,19)^t>>>10}Ls.g1_256=fL;var du=yr,lL=lu,hL=Ls,Im=du.rotl32,cl=du.sum32,dL=du.sum32_5,pL=hL.ft_1,Zx=lL.BlockHash,gL=[1518500249,1859775393,2400959708,3395469782];function Bs(){if(!(this instanceof Bs))return new Bs;Zx.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}du.inherits(Bs,Zx);var mL=Bs;Bs.blockSize=512,Bs.outSize=160,Bs.hmacStrength=80,Bs.padLength=64,Bs.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),nk(e.length<=this.blockSize);for(var r=e.length;r>8,y=d&255;g?u.push(g,y):u.push(y)}return u}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",u=0;u(y>>1)-1?N=(y>>1)-D:N=D,A.isubn(N)):N=0,g[P]=N,A.iushrn(1)}return g}r.getNAF=n;function i(u,l){var d=[[],[]];u=u.clone(),l=l.clone();for(var g=0,y=0,A;u.cmpn(-g)>0||l.cmpn(-y)>0;){var P=u.andln(3)+g&3,N=l.andln(3)+y&3;P===3&&(P=-1),N===3&&(N=-1);var D;P&1?(A=u.andln(7)+g&7,(A===3||A===5)&&N===2?D=-P:D=P):D=0,d[0].push(D);var k;N&1?(A=l.andln(7)+y&7,(A===3||A===5)&&P===2?k=-N:k=N):k=0,d[1].push(k),2*g===D+1&&(g=1-g),2*y===k+1&&(y=1-y),u.iushrn(1),l.iushrn(1)}return d}r.getJSF=i;function s(u,l,d){var g="_"+l;u.prototype[l]=function(){return this[g]!==void 0?this[g]:this[g]=d.call(this)}}r.cachedProperty=s;function o(u){return typeof u=="string"?r.toArray(u,"hex"):u}r.parseBytes=o;function a(u){return new rr(u,"hex","le")}r.intFromLE=a}),_d=Ci.getNAF,ok=Ci.getJSF,Ed=Ci.assert;function na(t,e){this.type=t,this.p=new rr(e.p,16),this.red=e.prime?rr.red(e.prime):rr.mont(this.p),this.zero=new rr(0).toRed(this.red),this.one=new rr(1).toRed(this.red),this.two=new rr(2).toRed(this.red),this.n=e.n&&new rr(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ja=na;na.prototype.point=function(){throw new Error("Not implemented")},na.prototype.validate=function(){throw new Error("Not implemented")},na.prototype._fixedNafMul=function(e,r){Ed(e.precomputed);var n=e._getDoubles(),i=_d(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),g=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Ed(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},na.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,g,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=_d(n[P],o[P],this._bitLength),u[N]=_d(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=ok(n[P],n[N]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[N]=new Array(l),g=0;g=0;d--){for(var T=0;d>=0;){var z=!0;for(g=0;g=0&&T++,K=K.dblp(T),d<0)break;for(g=0;g0?y=a[g][ue-1>>1]:ue<0&&(y=a[g][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},zi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),g.negative&&(g=g.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:g,b:y},{a:A,b:P}]},Hi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),g=e.sub(a).sub(u),y=l.add(d).neg();return{k1:g,k2:y}},Hi.prototype.pointFromX=function(e,r){e=new rr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Hi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Hi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Dn.prototype.isInfinity=function(){return this.inf},Dn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Dn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Dn.prototype.getX=function(){return this.x.fromRed()},Dn.prototype.getY=function(){return this.y.fromRed()},Dn.prototype.mul=function(e){return e=new rr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Dn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Dn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Dn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Dn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Dn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Un(t,e,r,n){Ja.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new rr(0)):(this.x=new rr(e,16),this.y=new rr(r,16),this.z=new rr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Nm(Un,Ja.BasePoint),Hi.prototype.jpoint=function(e,r,n){return new Un(this,e,r,n)},Un.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},Un.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Un.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),g=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(g).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(g)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},Un.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),g=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(g).redISub(g),A=u.redMul(g.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},Un.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},Un.prototype.inspect=function(){return this.isInfinity()?"":""},Un.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Sd=vu(function(t,e){var r=e;r.base=Ja,r.short=ck,r.mont=null,r.edwards=null}),Ad=vu(function(t,e){var r=e,n=Ci.assert;function i(a){a.type==="short"?this.curve=new Sd.short(a):a.type==="edwards"?this.curve=new Sd.edwards(a):this.curve=new Sd.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,u){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(u);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:wo.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:wo.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:wo.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:wo.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:wo.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:wo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function ia(t){if(!(this instanceof ia))return new ia(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=vs.toArray(t.entropy,t.entropyEnc||"hex"),r=vs.toArray(t.nonce,t.nonceEnc||"hex"),n=vs.toArray(t.pers,t.persEnc||"hex");Om(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var d3=ia;ia.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ia.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=vs.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var uk=Ci.assert;function Pd(t,e){if(t instanceof Pd)return t;this._importDER(t,e)||(uk(t.r&&t.s,"Signature without r or s"),this.r=new rr(t.r,16),this.s=new rr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Md=Pd;function fk(){this.place=0}function Bm(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function p3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Pd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=p3(r),n=p3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];$m(i,r.length),i=i.concat(r),i.push(2),$m(i,n.length);var s=i.concat(n),o=[48];return $m(o,s.length),o=o.concat(s),Ci.encode(o,e)};var lk=function(){throw new Error("unsupported")},g3=Ci.assert;function Wi(t){if(!(this instanceof Wi))return new Wi(t);typeof t=="string"&&(g3(Object.prototype.hasOwnProperty.call(Ad,t),"Unknown curve "+t),t=Ad[t]),t instanceof Ad.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var hk=Wi;Wi.prototype.keyPair=function(e){return new km(this,e)},Wi.prototype.keyFromPrivate=function(e,r){return km.fromPrivate(this,e,r)},Wi.prototype.keyFromPublic=function(e,r){return km.fromPublic(this,e,r)},Wi.prototype.genKeyPair=function(e){e||(e={});for(var r=new d3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||lk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new rr(2));;){var s=new rr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Wi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Wi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new rr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new d3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new rr(1)),d=0;;d++){var g=i.k?i.k(d):new rr(u.generate(this.n.byteLength()));if(g=this._truncateToN(g,!0),!(g.cmpn(1)<=0||g.cmp(l)>=0)){var y=this.g.mul(g);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=g.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new Md({r:P,s:N,recoveryParam:D})}}}}}},Wi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new rr(e,16)),n=this.keyFromPublic(n,i),r=new Md(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),u=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.eqXToP(s)):(d=this.g.mulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.getX().umod(this.n).cmp(s)===0)},Wi.prototype.recoverPubKey=function(t,e,r,n){g3((3&r)===r,"The recovery param is more than two bits"),e=new Md(e,n);var i=this.n,s=new rr(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),g=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(g,o,y)},Wi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Md(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dk=vu(function(t,e){var r=e;r.version="6.5.4",r.utils=Ci,r.rand=function(){throw new Error("unsupported")},r.curve=Sd,r.curves=Ad,r.ec=hk,r.eddsa=null}),pk=dk.ec;const gk="signing-key/5.7.0",Fm=new Kr(gk);let jm=null;function sa(){return jm||(jm=new pk("secp256k1")),jm}class mk{constructor(e){ol(this,"curve","secp256k1"),ol(this,"privateKey",Ii(e)),xN(this.privateKey)!==32&&Fm.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=sa().keyFromPrivate(bn(this.privateKey));ol(this,"publicKey","0x"+r.getPublic(!1,"hex")),ol(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ol(this,"_isSigningKey",!0)}_addPoint(e){const r=sa().keyFromPublic(bn(this.publicKey)),n=sa().keyFromPublic(bn(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=sa().keyFromPrivate(bn(this.privateKey)),n=bn(e);n.length!==32&&Fm.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Fx({recoveryParam:i.recoveryParam,r:fu("0x"+i.r.toString(16),32),s:fu("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=sa().keyFromPrivate(bn(this.privateKey)),n=sa().keyFromPublic(bn(m3(e)));return fu("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function vk(t,e){const r=Fx(e),n={r:bn(r.r),s:bn(r.s)};return"0x"+sa().recoverPubKey(bn(t),n,r.recoveryParam).encode("hex",!1)}function m3(t,e){const r=bn(t);return r.length===32?new mk(r).publicKey:r.length===33?"0x"+sa().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?Ii(r):Fm.throwArgumentError("invalid public or private key","key","[REDACTED]")}var v3;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(v3||(v3={}));function bk(t){const e=m3(t);return DN($x(Em($x(e,1)),12))}function yk(t,e){return bk(vk(bn(t),e))}var Um={},Id={};Object.defineProperty(Id,"__esModule",{value:!0});var Yn=or,qm=Mi,wk=20;function xk(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],g=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],P=r[31]<<24|r[30]<<16|r[29]<<8|r[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],k=e[11]<<24|e[10]<<16|e[9]<<8|e[8],B=e[15]<<24|e[14]<<16|e[13]<<8|e[12],j=n,U=i,K=s,J=o,T=a,z=u,ue=l,_e=d,G=g,E=y,m=A,f=P,p=N,v=D,x=k,_=B,S=0;S>>16|p<<16,G=G+p|0,T^=G,T=T>>>20|T<<12,U=U+z|0,v^=U,v=v>>>16|v<<16,E=E+v|0,z^=E,z=z>>>20|z<<12,K=K+ue|0,x^=K,x=x>>>16|x<<16,m=m+x|0,ue^=m,ue=ue>>>20|ue<<12,J=J+_e|0,_^=J,_=_>>>16|_<<16,f=f+_|0,_e^=f,_e=_e>>>20|_e<<12,K=K+ue|0,x^=K,x=x>>>24|x<<8,m=m+x|0,ue^=m,ue=ue>>>25|ue<<7,J=J+_e|0,_^=J,_=_>>>24|_<<8,f=f+_|0,_e^=f,_e=_e>>>25|_e<<7,U=U+z|0,v^=U,v=v>>>24|v<<8,E=E+v|0,z^=E,z=z>>>25|z<<7,j=j+T|0,p^=j,p=p>>>24|p<<8,G=G+p|0,T^=G,T=T>>>25|T<<7,j=j+z|0,_^=j,_=_>>>16|_<<16,m=m+_|0,z^=m,z=z>>>20|z<<12,U=U+ue|0,p^=U,p=p>>>16|p<<16,f=f+p|0,ue^=f,ue=ue>>>20|ue<<12,K=K+_e|0,v^=K,v=v>>>16|v<<16,G=G+v|0,_e^=G,_e=_e>>>20|_e<<12,J=J+T|0,x^=J,x=x>>>16|x<<16,E=E+x|0,T^=E,T=T>>>20|T<<12,K=K+_e|0,v^=K,v=v>>>24|v<<8,G=G+v|0,_e^=G,_e=_e>>>25|_e<<7,J=J+T|0,x^=J,x=x>>>24|x<<8,E=E+x|0,T^=E,T=T>>>25|T<<7,U=U+ue|0,p^=U,p=p>>>24|p<<8,f=f+p|0,ue^=f,ue=ue>>>25|ue<<7,j=j+z|0,_^=j,_=_>>>24|_<<8,m=m+_|0,z^=m,z=z>>>25|z<<7;Yn.writeUint32LE(j+n|0,t,0),Yn.writeUint32LE(U+i|0,t,4),Yn.writeUint32LE(K+s|0,t,8),Yn.writeUint32LE(J+o|0,t,12),Yn.writeUint32LE(T+a|0,t,16),Yn.writeUint32LE(z+u|0,t,20),Yn.writeUint32LE(ue+l|0,t,24),Yn.writeUint32LE(_e+d|0,t,28),Yn.writeUint32LE(G+g|0,t,32),Yn.writeUint32LE(E+y|0,t,36),Yn.writeUint32LE(m+A|0,t,40),Yn.writeUint32LE(f+P|0,t,44),Yn.writeUint32LE(p+N|0,t,48),Yn.writeUint32LE(v+D|0,t,52),Yn.writeUint32LE(x+k|0,t,56),Yn.writeUint32LE(_+B|0,t,60)}function b3(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var y3={},oa={};Object.defineProperty(oa,"__esModule",{value:!0});function Sk(t,e,r){return~(t-1)&e|t-1&r}oa.select=Sk;function Ak(t,e){return(t|0)-(e|0)-1>>>31&1}oa.lessOrEqual=Ak;function w3(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}oa.compare=w3;function Pk(t,e){return t.length===0||e.length===0?!1:w3(t,e)!==0}oa.equal=Pk,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=oa,r=Mi;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var u=a[0]|a[1]<<8;this._r[0]=u&8191;var l=a[2]|a[3]<<8;this._r[1]=(u>>>13|l<<3)&8191;var d=a[4]|a[5]<<8;this._r[2]=(l>>>10|d<<6)&7939;var g=a[6]|a[7]<<8;this._r[3]=(d>>>7|g<<9)&8191;var y=a[8]|a[9]<<8;this._r[4]=(g>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var A=a[10]|a[11]<<8;this._r[6]=(y>>>14|A<<2)&8191;var P=a[12]|a[13]<<8;this._r[7]=(A>>>11|P<<5)&8065;var N=a[14]|a[15]<<8;this._r[8]=(P>>>8|N<<8)&8191,this._r[9]=N>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,u,l){for(var d=this._fin?0:2048,g=this._h[0],y=this._h[1],A=this._h[2],P=this._h[3],N=this._h[4],D=this._h[5],k=this._h[6],B=this._h[7],j=this._h[8],U=this._h[9],K=this._r[0],J=this._r[1],T=this._r[2],z=this._r[3],ue=this._r[4],_e=this._r[5],G=this._r[6],E=this._r[7],m=this._r[8],f=this._r[9];l>=16;){var p=a[u+0]|a[u+1]<<8;g+=p&8191;var v=a[u+2]|a[u+3]<<8;y+=(p>>>13|v<<3)&8191;var x=a[u+4]|a[u+5]<<8;A+=(v>>>10|x<<6)&8191;var _=a[u+6]|a[u+7]<<8;P+=(x>>>7|_<<9)&8191;var S=a[u+8]|a[u+9]<<8;N+=(_>>>4|S<<12)&8191,D+=S>>>1&8191;var b=a[u+10]|a[u+11]<<8;k+=(S>>>14|b<<2)&8191;var M=a[u+12]|a[u+13]<<8;B+=(b>>>11|M<<5)&8191;var I=a[u+14]|a[u+15]<<8;j+=(M>>>8|I<<8)&8191,U+=I>>>5|d;var F=0,ae=F;ae+=g*K,ae+=y*(5*f),ae+=A*(5*m),ae+=P*(5*E),ae+=N*(5*G),F=ae>>>13,ae&=8191,ae+=D*(5*_e),ae+=k*(5*ue),ae+=B*(5*z),ae+=j*(5*T),ae+=U*(5*J),F+=ae>>>13,ae&=8191;var O=F;O+=g*J,O+=y*K,O+=A*(5*f),O+=P*(5*m),O+=N*(5*E),F=O>>>13,O&=8191,O+=D*(5*G),O+=k*(5*_e),O+=B*(5*ue),O+=j*(5*z),O+=U*(5*T),F+=O>>>13,O&=8191;var se=F;se+=g*T,se+=y*J,se+=A*K,se+=P*(5*f),se+=N*(5*m),F=se>>>13,se&=8191,se+=D*(5*E),se+=k*(5*G),se+=B*(5*_e),se+=j*(5*ue),se+=U*(5*z),F+=se>>>13,se&=8191;var ee=F;ee+=g*z,ee+=y*T,ee+=A*J,ee+=P*K,ee+=N*(5*f),F=ee>>>13,ee&=8191,ee+=D*(5*m),ee+=k*(5*E),ee+=B*(5*G),ee+=j*(5*_e),ee+=U*(5*ue),F+=ee>>>13,ee&=8191;var X=F;X+=g*ue,X+=y*z,X+=A*T,X+=P*J,X+=N*K,F=X>>>13,X&=8191,X+=D*(5*f),X+=k*(5*m),X+=B*(5*E),X+=j*(5*G),X+=U*(5*_e),F+=X>>>13,X&=8191;var Q=F;Q+=g*_e,Q+=y*ue,Q+=A*z,Q+=P*T,Q+=N*J,F=Q>>>13,Q&=8191,Q+=D*K,Q+=k*(5*f),Q+=B*(5*m),Q+=j*(5*E),Q+=U*(5*G),F+=Q>>>13,Q&=8191;var R=F;R+=g*G,R+=y*_e,R+=A*ue,R+=P*z,R+=N*T,F=R>>>13,R&=8191,R+=D*J,R+=k*K,R+=B*(5*f),R+=j*(5*m),R+=U*(5*E),F+=R>>>13,R&=8191;var Z=F;Z+=g*E,Z+=y*G,Z+=A*_e,Z+=P*ue,Z+=N*z,F=Z>>>13,Z&=8191,Z+=D*T,Z+=k*J,Z+=B*K,Z+=j*(5*f),Z+=U*(5*m),F+=Z>>>13,Z&=8191;var te=F;te+=g*m,te+=y*E,te+=A*G,te+=P*_e,te+=N*ue,F=te>>>13,te&=8191,te+=D*z,te+=k*T,te+=B*J,te+=j*K,te+=U*(5*f),F+=te>>>13,te&=8191;var le=F;le+=g*f,le+=y*m,le+=A*E,le+=P*G,le+=N*_e,F=le>>>13,le&=8191,le+=D*ue,le+=k*z,le+=B*T,le+=j*J,le+=U*K,F+=le>>>13,le&=8191,F=(F<<2)+F|0,F=F+ae|0,ae=F&8191,F=F>>>13,O+=F,g=ae,y=O,A=se,P=ee,N=X,D=Q,k=R,B=Z,j=te,U=le,u+=16,l-=16}this._h[0]=g,this._h[1]=y,this._h[2]=A,this._h[3]=P,this._h[4]=N,this._h[5]=D,this._h[6]=k,this._h[7]=B,this._h[8]=j,this._h[9]=U},o.prototype.finish=function(a,u){u===void 0&&(u=0);var l=new Uint16Array(10),d,g,y,A;if(this._leftover){for(A=this._leftover,this._buffer[A++]=1;A<16;A++)this._buffer[A]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(d=this._h[1]>>>13,this._h[1]&=8191,A=2;A<10;A++)this._h[A]+=d,d=this._h[A]>>>13,this._h[A]&=8191;for(this._h[0]+=d*5,d=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=d,d=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=d,l[0]=this._h[0]+5,d=l[0]>>>13,l[0]&=8191,A=1;A<10;A++)l[A]=this._h[A]+d,d=l[A]>>>13,l[A]&=8191;for(l[9]-=8192,g=(d^1)-1,A=0;A<10;A++)l[A]&=g;for(g=~g,A=0;A<10;A++)this._h[A]=this._h[A]&g|l[A];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,y=this._h[0]+this._pad[0],this._h[0]=y&65535,A=1;A<8;A++)y=(this._h[A]+this._pad[A]|0)+(y>>>16)|0,this._h[A]=y&65535;return a[u+0]=this._h[0]>>>0,a[u+1]=this._h[0]>>>8,a[u+2]=this._h[1]>>>0,a[u+3]=this._h[1]>>>8,a[u+4]=this._h[2]>>>0,a[u+5]=this._h[2]>>>8,a[u+6]=this._h[3]>>>0,a[u+7]=this._h[3]>>>8,a[u+8]=this._h[4]>>>0,a[u+9]=this._h[4]>>>8,a[u+10]=this._h[5]>>>0,a[u+11]=this._h[5]>>>8,a[u+12]=this._h[6]>>>0,a[u+13]=this._h[6]>>>8,a[u+14]=this._h[7]>>>0,a[u+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var u=0,l=a.length,d;if(this._leftover){d=16-this._leftover,d>l&&(d=l);for(var g=0;g=16&&(d=l-l%16,this._blocks(a,u,d),u+=d,l-=d),l){for(var g=0;g16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var A=new Uint8Array(16);A.set(l,A.length-l.length);var P=new Uint8Array(32);e.stream(this._key,A,P,4);var N=d.length+this.tagLength,D;if(y){if(y.length!==N)throw new Error("ChaCha20Poly1305: incorrect destination length");D=y}else D=new Uint8Array(N);return e.streamXOR(this._key,A,d,D,4),this._authenticate(D.subarray(D.length-this.tagLength,D.length),P,D.subarray(0,D.length-this.tagLength),g),n.wipe(A),D},u.prototype.open=function(l,d,g,y){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(d.length0&&A.update(o.subarray(y.length%16))),A.update(g),g.length%16>0&&A.update(o.subarray(g.length%16));var P=new Uint8Array(8);y&&i.writeUint64LE(y.length,P),A.update(P),i.writeUint64LE(g.length,P),A.update(P);for(var N=A.digest(),D=0;Dthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._temp,this._state,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,g=l/536870912|0,y=l<<3,A=l%64<56?64:128;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._state.set(u.state),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.state),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,u,l,d,g){for(;g>=64;){for(var y=u[0],A=u[1],P=u[2],N=u[3],D=u[4],k=u[5],B=u[6],j=u[7],U=0;U<16;U++){var K=d+U*4;a[U]=e.readUint32BE(l,K)}for(var U=16;U<64;U++){var J=a[U-2],T=(J>>>17|J<<15)^(J>>>19|J<<13)^J>>>10;J=a[U-15];var z=(J>>>7|J<<25)^(J>>>18|J<<14)^J>>>3;a[U]=(T+a[U-7]|0)+(z+a[U-16]|0)}for(var U=0;U<64;U++){var T=(((D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7))+(D&k^~D&B)|0)+(j+(i[U]+a[U]|0)|0)|0,z=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&A^y&P^A&P)|0;j=B,B=k,k=D,D=N+T|0,N=P,P=A,A=y,y=T+z|0}u[0]+=y,u[1]+=A,u[2]+=P,u[3]+=N,u[4]+=D,u[5]+=k,u[6]+=B,u[7]+=j,d+=64,g-=64}return d}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ll);var Hm={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=ta,r=Mi;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(U){const K=new Float64Array(16);if(U)for(let J=0;J>16&1),J[_e-1]&=65535;J[15]=T[15]-32767-(J[14]>>16&1);const ue=J[15]>>16&1;J[14]&=65535,a(T,J,1-ue)}for(let z=0;z<16;z++)U[2*z]=T[z]&255,U[2*z+1]=T[z]>>8}function l(U,K){for(let J=0;J<16;J++)U[J]=K[2*J]+(K[2*J+1]<<8);U[15]&=32767}function d(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]+J[T]}function g(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]-J[T]}function y(U,K,J){let T,z,ue=0,_e=0,G=0,E=0,m=0,f=0,p=0,v=0,x=0,_=0,S=0,b=0,M=0,I=0,F=0,ae=0,O=0,se=0,ee=0,X=0,Q=0,R=0,Z=0,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=J[0],Ie=J[1],Le=J[2],Ve=J[3],ke=J[4],ze=J[5],He=J[6],Ee=J[7],Qe=J[8],ct=J[9],Be=J[10],et=J[11],rt=J[12],Je=J[13],pt=J[14],ht=J[15];T=K[0],ue+=T*$e,_e+=T*Ie,G+=T*Le,E+=T*Ve,m+=T*ke,f+=T*ze,p+=T*He,v+=T*Ee,x+=T*Qe,_+=T*ct,S+=T*Be,b+=T*et,M+=T*rt,I+=T*Je,F+=T*pt,ae+=T*ht,T=K[1],_e+=T*$e,G+=T*Ie,E+=T*Le,m+=T*Ve,f+=T*ke,p+=T*ze,v+=T*He,x+=T*Ee,_+=T*Qe,S+=T*ct,b+=T*Be,M+=T*et,I+=T*rt,F+=T*Je,ae+=T*pt,O+=T*ht,T=K[2],G+=T*$e,E+=T*Ie,m+=T*Le,f+=T*Ve,p+=T*ke,v+=T*ze,x+=T*He,_+=T*Ee,S+=T*Qe,b+=T*ct,M+=T*Be,I+=T*et,F+=T*rt,ae+=T*Je,O+=T*pt,se+=T*ht,T=K[3],E+=T*$e,m+=T*Ie,f+=T*Le,p+=T*Ve,v+=T*ke,x+=T*ze,_+=T*He,S+=T*Ee,b+=T*Qe,M+=T*ct,I+=T*Be,F+=T*et,ae+=T*rt,O+=T*Je,se+=T*pt,ee+=T*ht,T=K[4],m+=T*$e,f+=T*Ie,p+=T*Le,v+=T*Ve,x+=T*ke,_+=T*ze,S+=T*He,b+=T*Ee,M+=T*Qe,I+=T*ct,F+=T*Be,ae+=T*et,O+=T*rt,se+=T*Je,ee+=T*pt,X+=T*ht,T=K[5],f+=T*$e,p+=T*Ie,v+=T*Le,x+=T*Ve,_+=T*ke,S+=T*ze,b+=T*He,M+=T*Ee,I+=T*Qe,F+=T*ct,ae+=T*Be,O+=T*et,se+=T*rt,ee+=T*Je,X+=T*pt,Q+=T*ht,T=K[6],p+=T*$e,v+=T*Ie,x+=T*Le,_+=T*Ve,S+=T*ke,b+=T*ze,M+=T*He,I+=T*Ee,F+=T*Qe,ae+=T*ct,O+=T*Be,se+=T*et,ee+=T*rt,X+=T*Je,Q+=T*pt,R+=T*ht,T=K[7],v+=T*$e,x+=T*Ie,_+=T*Le,S+=T*Ve,b+=T*ke,M+=T*ze,I+=T*He,F+=T*Ee,ae+=T*Qe,O+=T*ct,se+=T*Be,ee+=T*et,X+=T*rt,Q+=T*Je,R+=T*pt,Z+=T*ht,T=K[8],x+=T*$e,_+=T*Ie,S+=T*Le,b+=T*Ve,M+=T*ke,I+=T*ze,F+=T*He,ae+=T*Ee,O+=T*Qe,se+=T*ct,ee+=T*Be,X+=T*et,Q+=T*rt,R+=T*Je,Z+=T*pt,te+=T*ht,T=K[9],_+=T*$e,S+=T*Ie,b+=T*Le,M+=T*Ve,I+=T*ke,F+=T*ze,ae+=T*He,O+=T*Ee,se+=T*Qe,ee+=T*ct,X+=T*Be,Q+=T*et,R+=T*rt,Z+=T*Je,te+=T*pt,le+=T*ht,T=K[10],S+=T*$e,b+=T*Ie,M+=T*Le,I+=T*Ve,F+=T*ke,ae+=T*ze,O+=T*He,se+=T*Ee,ee+=T*Qe,X+=T*ct,Q+=T*Be,R+=T*et,Z+=T*rt,te+=T*Je,le+=T*pt,ie+=T*ht,T=K[11],b+=T*$e,M+=T*Ie,I+=T*Le,F+=T*Ve,ae+=T*ke,O+=T*ze,se+=T*He,ee+=T*Ee,X+=T*Qe,Q+=T*ct,R+=T*Be,Z+=T*et,te+=T*rt,le+=T*Je,ie+=T*pt,fe+=T*ht,T=K[12],M+=T*$e,I+=T*Ie,F+=T*Le,ae+=T*Ve,O+=T*ke,se+=T*ze,ee+=T*He,X+=T*Ee,Q+=T*Qe,R+=T*ct,Z+=T*Be,te+=T*et,le+=T*rt,ie+=T*Je,fe+=T*pt,ve+=T*ht,T=K[13],I+=T*$e,F+=T*Ie,ae+=T*Le,O+=T*Ve,se+=T*ke,ee+=T*ze,X+=T*He,Q+=T*Ee,R+=T*Qe,Z+=T*ct,te+=T*Be,le+=T*et,ie+=T*rt,fe+=T*Je,ve+=T*pt,Me+=T*ht,T=K[14],F+=T*$e,ae+=T*Ie,O+=T*Le,se+=T*Ve,ee+=T*ke,X+=T*ze,Q+=T*He,R+=T*Ee,Z+=T*Qe,te+=T*ct,le+=T*Be,ie+=T*et,fe+=T*rt,ve+=T*Je,Me+=T*pt,Ne+=T*ht,T=K[15],ae+=T*$e,O+=T*Ie,se+=T*Le,ee+=T*Ve,X+=T*ke,Q+=T*ze,R+=T*He,Z+=T*Ee,te+=T*Qe,le+=T*ct,ie+=T*Be,fe+=T*et,ve+=T*rt,Me+=T*Je,Ne+=T*pt,Te+=T*ht,ue+=38*O,_e+=38*se,G+=38*ee,E+=38*X,m+=38*Q,f+=38*R,p+=38*Z,v+=38*te,x+=38*le,_+=38*ie,S+=38*fe,b+=38*ve,M+=38*Me,I+=38*Ne,F+=38*Te,z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=p+z+65535,z=Math.floor(T/65536),p=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=p+z+65535,z=Math.floor(T/65536),p=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),U[0]=ue,U[1]=_e,U[2]=G,U[3]=E,U[4]=m,U[5]=f,U[6]=p,U[7]=v,U[8]=x,U[9]=_,U[10]=S,U[11]=b,U[12]=M,U[13]=I,U[14]=F,U[15]=ae}function A(U,K){y(U,K,K)}function P(U,K){const J=n();for(let T=0;T<16;T++)J[T]=K[T];for(let T=253;T>=0;T--)A(J,J),T!==2&&T!==4&&y(J,J,K);for(let T=0;T<16;T++)U[T]=J[T]}function N(U,K){const J=new Uint8Array(32),T=new Float64Array(80),z=n(),ue=n(),_e=n(),G=n(),E=n(),m=n();for(let x=0;x<31;x++)J[x]=U[x];J[31]=U[31]&127|64,J[0]&=248,l(T,K);for(let x=0;x<16;x++)ue[x]=T[x];z[0]=G[0]=1;for(let x=254;x>=0;--x){const _=J[x>>>3]>>>(x&7)&1;a(z,ue,_),a(_e,G,_),d(E,z,_e),g(z,z,_e),d(_e,ue,G),g(ue,ue,G),A(G,E),A(m,z),y(z,_e,z),y(_e,ue,E),d(E,z,_e),g(z,z,_e),A(ue,z),g(_e,G,m),y(z,_e,s),d(z,z,G),y(_e,_e,z),y(z,G,m),y(G,ue,T),A(ue,E),a(z,ue,_),a(_e,G,_)}for(let x=0;x<16;x++)T[x+16]=z[x],T[x+32]=_e[x],T[x+48]=ue[x],T[x+64]=G[x];const f=T.subarray(32),p=T.subarray(16);P(f,f),y(p,p,f);const v=new Uint8Array(32);return u(v,p),v}t.scalarMult=N;function D(U){return N(U,i)}t.scalarMultBase=D;function k(U){if(U.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const K=new Uint8Array(U);return{publicKey:D(K),secretKey:K}}t.generateKeyPairFromSeed=k;function B(U){const K=(0,e.randomBytes)(32,U),J=k(K);return(0,r.wipe)(K),J}t.generateKeyPair=B;function j(U,K,J=!1){if(U.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(K.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const T=N(U,K);if(J){let z=0;for(let ue=0;ue",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}};var Ti={},Wm={exports:{}};Wm.exports,function(t){(function(e,r){function n(G,E){if(!G)throw new Error(E||"Assertion failed")}function i(G,E){G.super_=E;var m=function(){};m.prototype=E.prototype,G.prototype=new m,G.prototype.constructor=G}function s(G,E,m){if(s.isBN(G))return G;this.negative=0,this.words=null,this.length=0,this.red=null,G!==null&&((E==="le"||E==="be")&&(m=E,E=10),this._init(G||0,E||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(E){return E instanceof s?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===s.wordSize&&Array.isArray(E.words)},s.max=function(E,m){return E.cmp(m)>0?E:m},s.min=function(E,m){return E.cmp(m)<0?E:m},s.prototype._init=function(E,m,f){if(typeof E=="number")return this._initNumber(E,m,f);if(typeof E=="object")return this._initArray(E,m,f);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),E=E.toString().replace(/\s+/g,"");var p=0;E[0]==="-"&&(p++,this.negative=1),p=0;p-=3)x=E[p]|E[p-1]<<8|E[p-2]<<16,this.words[v]|=x<<_&67108863,this.words[v+1]=x>>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);else if(f==="le")for(p=0,v=0;p>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);return this.strip()};function a(G,E){var m=G.charCodeAt(E);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function u(G,E,m){var f=a(G,m);return m-1>=E&&(f|=a(G,m-1)<<4),f}s.prototype._parseHex=function(E,m,f){this.length=Math.ceil((E.length-m)/6),this.words=new Array(this.length);for(var p=0;p=m;p-=2)_=u(E,m,p)<=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8;else{var S=E.length-m;for(p=S%2===0?m+1:m;p=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8}this.strip()};function l(G,E,m,f){for(var p=0,v=Math.min(G.length,m),x=E;x=49?p+=_-49+10:_>=17?p+=_-17+10:p+=_}return p}s.prototype._parseBase=function(E,m,f){this.words=[0],this.length=1;for(var p=0,v=1;v<=67108863;v*=m)p++;p--,v=v/m|0;for(var x=E.length-f,_=x%p,S=Math.min(x,x-_)+f,b=0,M=f;M1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var d=["","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"],g=[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],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(E,m){E=E||10,m=m|0||1;var f;if(E===16||E==="hex"){f="";for(var p=0,v=0,x=0;x>>24-p&16777215,p+=2,p>=26&&(p-=26,x--),v!==0||x!==this.length-1?f=d[6-S.length]+S+f:f=S+f}for(v!==0&&(f=v.toString(16)+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(E===(E|0)&&E>=2&&E<=36){var b=g[E],M=y[E];f="";var I=this.clone();for(I.negative=0;!I.isZero();){var F=I.modn(M).toString(E);I=I.idivn(M),I.isZero()?f=F+f:f=d[b-F.length]+F+f}for(this.isZero()&&(f="0"+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(E,m){return n(typeof o<"u"),this.toArrayLike(o,E,m)},s.prototype.toArray=function(E,m){return this.toArrayLike(Array,E,m)},s.prototype.toArrayLike=function(E,m,f){var p=this.byteLength(),v=f||Math.max(1,p);n(p<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var x=m==="le",_=new E(v),S,b,M=this.clone();if(x){for(b=0;!M.isZero();b++)S=M.andln(255),M.iushrn(8),_[b]=S;for(;b=4096&&(f+=13,m>>>=13),m>=64&&(f+=7,m>>>=7),m>=8&&(f+=4,m>>>=4),m>=2&&(f+=2,m>>>=2),f+m},s.prototype._zeroBits=function(E){if(E===0)return 26;var m=E,f=0;return m&8191||(f+=13,m>>>=13),m&127||(f+=7,m>>>=7),m&15||(f+=4,m>>>=4),m&3||(f+=2,m>>>=2),m&1||f++,f},s.prototype.bitLength=function(){var E=this.words[this.length-1],m=this._countBits(E);return(this.length-1)*26+m};function A(G){for(var E=new Array(G.bitLength()),m=0;m>>p}return E}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,m=0;mE.length?this.clone().ior(E):E.clone().ior(this)},s.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},s.prototype.iuand=function(E){var m;this.length>E.length?m=E:m=this;for(var f=0;fE.length?this.clone().iand(E):E.clone().iand(this)},s.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},s.prototype.iuxor=function(E){var m,f;this.length>E.length?(m=this,f=E):(m=E,f=this);for(var p=0;pE.length?this.clone().ixor(E):E.clone().ixor(this)},s.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},s.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var m=Math.ceil(E/26)|0,f=E%26;this._expand(m),f>0&&m--;for(var p=0;p0&&(this.words[p]=~this.words[p]&67108863>>26-f),this.strip()},s.prototype.notn=function(E){return this.clone().inotn(E)},s.prototype.setn=function(E,m){n(typeof E=="number"&&E>=0);var f=E/26|0,p=E%26;return this._expand(f+1),m?this.words[f]=this.words[f]|1<E.length?(f=this,p=E):(f=E,p=this);for(var v=0,x=0;x>>26;for(;v!==0&&x>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;xE.length?this.clone().iadd(E):E.clone().iadd(this)},s.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var m=this.iadd(E);return E.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var f=this.cmp(E);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,v;f>0?(p=this,v=E):(p=E,v=this);for(var x=0,_=0;_>26,this.words[_]=m&67108863;for(;x!==0&&_>26,this.words[_]=m&67108863;if(x===0&&_>>26,I=S&67108863,F=Math.min(b,E.length-1),ae=Math.max(0,b-G.length+1);ae<=F;ae++){var O=b-ae|0;p=G.words[O]|0,v=E.words[ae]|0,x=p*v+I,M+=x/67108864|0,I=x&67108863}m.words[b]=I|0,S=M|0}return S!==0?m.words[b]=S|0:m.length--,m.strip()}var N=function(E,m,f){var p=E.words,v=m.words,x=f.words,_=0,S,b,M,I=p[0]|0,F=I&8191,ae=I>>>13,O=p[1]|0,se=O&8191,ee=O>>>13,X=p[2]|0,Q=X&8191,R=X>>>13,Z=p[3]|0,te=Z&8191,le=Z>>>13,ie=p[4]|0,fe=ie&8191,ve=ie>>>13,Me=p[5]|0,Ne=Me&8191,Te=Me>>>13,$e=p[6]|0,Ie=$e&8191,Le=$e>>>13,Ve=p[7]|0,ke=Ve&8191,ze=Ve>>>13,He=p[8]|0,Ee=He&8191,Qe=He>>>13,ct=p[9]|0,Be=ct&8191,et=ct>>>13,rt=v[0]|0,Je=rt&8191,pt=rt>>>13,ht=v[1]|0,ft=ht&8191,Ht=ht>>>13,Jt=v[2]|0,St=Jt&8191,er=Jt>>>13,Xt=v[3]|0,Ot=Xt&8191,Bt=Xt>>>13,Tt=v[4]|0,vt=Tt&8191,Dt=Tt>>>13,Lt=v[5]|0,bt=Lt&8191,$t=Lt>>>13,jt=v[6]|0,nt=jt&8191,Ft=jt>>>13,$=v[7]|0,H=$&8191,V=$>>>13,C=v[8]|0,Y=C&8191,q=C>>>13,oe=v[9]|0,pe=oe&8191,xe=oe>>>13;f.negative=E.negative^m.negative,f.length=19,S=Math.imul(F,Je),b=Math.imul(F,pt),b=b+Math.imul(ae,Je)|0,M=Math.imul(ae,pt);var Re=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Re>>>26)|0,Re&=67108863,S=Math.imul(se,Je),b=Math.imul(se,pt),b=b+Math.imul(ee,Je)|0,M=Math.imul(ee,pt),S=S+Math.imul(F,ft)|0,b=b+Math.imul(F,Ht)|0,b=b+Math.imul(ae,ft)|0,M=M+Math.imul(ae,Ht)|0;var De=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(De>>>26)|0,De&=67108863,S=Math.imul(Q,Je),b=Math.imul(Q,pt),b=b+Math.imul(R,Je)|0,M=Math.imul(R,pt),S=S+Math.imul(se,ft)|0,b=b+Math.imul(se,Ht)|0,b=b+Math.imul(ee,ft)|0,M=M+Math.imul(ee,Ht)|0,S=S+Math.imul(F,St)|0,b=b+Math.imul(F,er)|0,b=b+Math.imul(ae,St)|0,M=M+Math.imul(ae,er)|0;var it=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(it>>>26)|0,it&=67108863,S=Math.imul(te,Je),b=Math.imul(te,pt),b=b+Math.imul(le,Je)|0,M=Math.imul(le,pt),S=S+Math.imul(Q,ft)|0,b=b+Math.imul(Q,Ht)|0,b=b+Math.imul(R,ft)|0,M=M+Math.imul(R,Ht)|0,S=S+Math.imul(se,St)|0,b=b+Math.imul(se,er)|0,b=b+Math.imul(ee,St)|0,M=M+Math.imul(ee,er)|0,S=S+Math.imul(F,Ot)|0,b=b+Math.imul(F,Bt)|0,b=b+Math.imul(ae,Ot)|0,M=M+Math.imul(ae,Bt)|0;var Ue=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,S=Math.imul(fe,Je),b=Math.imul(fe,pt),b=b+Math.imul(ve,Je)|0,M=Math.imul(ve,pt),S=S+Math.imul(te,ft)|0,b=b+Math.imul(te,Ht)|0,b=b+Math.imul(le,ft)|0,M=M+Math.imul(le,Ht)|0,S=S+Math.imul(Q,St)|0,b=b+Math.imul(Q,er)|0,b=b+Math.imul(R,St)|0,M=M+Math.imul(R,er)|0,S=S+Math.imul(se,Ot)|0,b=b+Math.imul(se,Bt)|0,b=b+Math.imul(ee,Ot)|0,M=M+Math.imul(ee,Bt)|0,S=S+Math.imul(F,vt)|0,b=b+Math.imul(F,Dt)|0,b=b+Math.imul(ae,vt)|0,M=M+Math.imul(ae,Dt)|0;var gt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(gt>>>26)|0,gt&=67108863,S=Math.imul(Ne,Je),b=Math.imul(Ne,pt),b=b+Math.imul(Te,Je)|0,M=Math.imul(Te,pt),S=S+Math.imul(fe,ft)|0,b=b+Math.imul(fe,Ht)|0,b=b+Math.imul(ve,ft)|0,M=M+Math.imul(ve,Ht)|0,S=S+Math.imul(te,St)|0,b=b+Math.imul(te,er)|0,b=b+Math.imul(le,St)|0,M=M+Math.imul(le,er)|0,S=S+Math.imul(Q,Ot)|0,b=b+Math.imul(Q,Bt)|0,b=b+Math.imul(R,Ot)|0,M=M+Math.imul(R,Bt)|0,S=S+Math.imul(se,vt)|0,b=b+Math.imul(se,Dt)|0,b=b+Math.imul(ee,vt)|0,M=M+Math.imul(ee,Dt)|0,S=S+Math.imul(F,bt)|0,b=b+Math.imul(F,$t)|0,b=b+Math.imul(ae,bt)|0,M=M+Math.imul(ae,$t)|0;var st=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(st>>>26)|0,st&=67108863,S=Math.imul(Ie,Je),b=Math.imul(Ie,pt),b=b+Math.imul(Le,Je)|0,M=Math.imul(Le,pt),S=S+Math.imul(Ne,ft)|0,b=b+Math.imul(Ne,Ht)|0,b=b+Math.imul(Te,ft)|0,M=M+Math.imul(Te,Ht)|0,S=S+Math.imul(fe,St)|0,b=b+Math.imul(fe,er)|0,b=b+Math.imul(ve,St)|0,M=M+Math.imul(ve,er)|0,S=S+Math.imul(te,Ot)|0,b=b+Math.imul(te,Bt)|0,b=b+Math.imul(le,Ot)|0,M=M+Math.imul(le,Bt)|0,S=S+Math.imul(Q,vt)|0,b=b+Math.imul(Q,Dt)|0,b=b+Math.imul(R,vt)|0,M=M+Math.imul(R,Dt)|0,S=S+Math.imul(se,bt)|0,b=b+Math.imul(se,$t)|0,b=b+Math.imul(ee,bt)|0,M=M+Math.imul(ee,$t)|0,S=S+Math.imul(F,nt)|0,b=b+Math.imul(F,Ft)|0,b=b+Math.imul(ae,nt)|0,M=M+Math.imul(ae,Ft)|0;var tt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(tt>>>26)|0,tt&=67108863,S=Math.imul(ke,Je),b=Math.imul(ke,pt),b=b+Math.imul(ze,Je)|0,M=Math.imul(ze,pt),S=S+Math.imul(Ie,ft)|0,b=b+Math.imul(Ie,Ht)|0,b=b+Math.imul(Le,ft)|0,M=M+Math.imul(Le,Ht)|0,S=S+Math.imul(Ne,St)|0,b=b+Math.imul(Ne,er)|0,b=b+Math.imul(Te,St)|0,M=M+Math.imul(Te,er)|0,S=S+Math.imul(fe,Ot)|0,b=b+Math.imul(fe,Bt)|0,b=b+Math.imul(ve,Ot)|0,M=M+Math.imul(ve,Bt)|0,S=S+Math.imul(te,vt)|0,b=b+Math.imul(te,Dt)|0,b=b+Math.imul(le,vt)|0,M=M+Math.imul(le,Dt)|0,S=S+Math.imul(Q,bt)|0,b=b+Math.imul(Q,$t)|0,b=b+Math.imul(R,bt)|0,M=M+Math.imul(R,$t)|0,S=S+Math.imul(se,nt)|0,b=b+Math.imul(se,Ft)|0,b=b+Math.imul(ee,nt)|0,M=M+Math.imul(ee,Ft)|0,S=S+Math.imul(F,H)|0,b=b+Math.imul(F,V)|0,b=b+Math.imul(ae,H)|0,M=M+Math.imul(ae,V)|0;var At=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(At>>>26)|0,At&=67108863,S=Math.imul(Ee,Je),b=Math.imul(Ee,pt),b=b+Math.imul(Qe,Je)|0,M=Math.imul(Qe,pt),S=S+Math.imul(ke,ft)|0,b=b+Math.imul(ke,Ht)|0,b=b+Math.imul(ze,ft)|0,M=M+Math.imul(ze,Ht)|0,S=S+Math.imul(Ie,St)|0,b=b+Math.imul(Ie,er)|0,b=b+Math.imul(Le,St)|0,M=M+Math.imul(Le,er)|0,S=S+Math.imul(Ne,Ot)|0,b=b+Math.imul(Ne,Bt)|0,b=b+Math.imul(Te,Ot)|0,M=M+Math.imul(Te,Bt)|0,S=S+Math.imul(fe,vt)|0,b=b+Math.imul(fe,Dt)|0,b=b+Math.imul(ve,vt)|0,M=M+Math.imul(ve,Dt)|0,S=S+Math.imul(te,bt)|0,b=b+Math.imul(te,$t)|0,b=b+Math.imul(le,bt)|0,M=M+Math.imul(le,$t)|0,S=S+Math.imul(Q,nt)|0,b=b+Math.imul(Q,Ft)|0,b=b+Math.imul(R,nt)|0,M=M+Math.imul(R,Ft)|0,S=S+Math.imul(se,H)|0,b=b+Math.imul(se,V)|0,b=b+Math.imul(ee,H)|0,M=M+Math.imul(ee,V)|0,S=S+Math.imul(F,Y)|0,b=b+Math.imul(F,q)|0,b=b+Math.imul(ae,Y)|0,M=M+Math.imul(ae,q)|0;var Rt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,S=Math.imul(Be,Je),b=Math.imul(Be,pt),b=b+Math.imul(et,Je)|0,M=Math.imul(et,pt),S=S+Math.imul(Ee,ft)|0,b=b+Math.imul(Ee,Ht)|0,b=b+Math.imul(Qe,ft)|0,M=M+Math.imul(Qe,Ht)|0,S=S+Math.imul(ke,St)|0,b=b+Math.imul(ke,er)|0,b=b+Math.imul(ze,St)|0,M=M+Math.imul(ze,er)|0,S=S+Math.imul(Ie,Ot)|0,b=b+Math.imul(Ie,Bt)|0,b=b+Math.imul(Le,Ot)|0,M=M+Math.imul(Le,Bt)|0,S=S+Math.imul(Ne,vt)|0,b=b+Math.imul(Ne,Dt)|0,b=b+Math.imul(Te,vt)|0,M=M+Math.imul(Te,Dt)|0,S=S+Math.imul(fe,bt)|0,b=b+Math.imul(fe,$t)|0,b=b+Math.imul(ve,bt)|0,M=M+Math.imul(ve,$t)|0,S=S+Math.imul(te,nt)|0,b=b+Math.imul(te,Ft)|0,b=b+Math.imul(le,nt)|0,M=M+Math.imul(le,Ft)|0,S=S+Math.imul(Q,H)|0,b=b+Math.imul(Q,V)|0,b=b+Math.imul(R,H)|0,M=M+Math.imul(R,V)|0,S=S+Math.imul(se,Y)|0,b=b+Math.imul(se,q)|0,b=b+Math.imul(ee,Y)|0,M=M+Math.imul(ee,q)|0,S=S+Math.imul(F,pe)|0,b=b+Math.imul(F,xe)|0,b=b+Math.imul(ae,pe)|0,M=M+Math.imul(ae,xe)|0;var Mt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,S=Math.imul(Be,ft),b=Math.imul(Be,Ht),b=b+Math.imul(et,ft)|0,M=Math.imul(et,Ht),S=S+Math.imul(Ee,St)|0,b=b+Math.imul(Ee,er)|0,b=b+Math.imul(Qe,St)|0,M=M+Math.imul(Qe,er)|0,S=S+Math.imul(ke,Ot)|0,b=b+Math.imul(ke,Bt)|0,b=b+Math.imul(ze,Ot)|0,M=M+Math.imul(ze,Bt)|0,S=S+Math.imul(Ie,vt)|0,b=b+Math.imul(Ie,Dt)|0,b=b+Math.imul(Le,vt)|0,M=M+Math.imul(Le,Dt)|0,S=S+Math.imul(Ne,bt)|0,b=b+Math.imul(Ne,$t)|0,b=b+Math.imul(Te,bt)|0,M=M+Math.imul(Te,$t)|0,S=S+Math.imul(fe,nt)|0,b=b+Math.imul(fe,Ft)|0,b=b+Math.imul(ve,nt)|0,M=M+Math.imul(ve,Ft)|0,S=S+Math.imul(te,H)|0,b=b+Math.imul(te,V)|0,b=b+Math.imul(le,H)|0,M=M+Math.imul(le,V)|0,S=S+Math.imul(Q,Y)|0,b=b+Math.imul(Q,q)|0,b=b+Math.imul(R,Y)|0,M=M+Math.imul(R,q)|0,S=S+Math.imul(se,pe)|0,b=b+Math.imul(se,xe)|0,b=b+Math.imul(ee,pe)|0,M=M+Math.imul(ee,xe)|0;var Et=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Et>>>26)|0,Et&=67108863,S=Math.imul(Be,St),b=Math.imul(Be,er),b=b+Math.imul(et,St)|0,M=Math.imul(et,er),S=S+Math.imul(Ee,Ot)|0,b=b+Math.imul(Ee,Bt)|0,b=b+Math.imul(Qe,Ot)|0,M=M+Math.imul(Qe,Bt)|0,S=S+Math.imul(ke,vt)|0,b=b+Math.imul(ke,Dt)|0,b=b+Math.imul(ze,vt)|0,M=M+Math.imul(ze,Dt)|0,S=S+Math.imul(Ie,bt)|0,b=b+Math.imul(Ie,$t)|0,b=b+Math.imul(Le,bt)|0,M=M+Math.imul(Le,$t)|0,S=S+Math.imul(Ne,nt)|0,b=b+Math.imul(Ne,Ft)|0,b=b+Math.imul(Te,nt)|0,M=M+Math.imul(Te,Ft)|0,S=S+Math.imul(fe,H)|0,b=b+Math.imul(fe,V)|0,b=b+Math.imul(ve,H)|0,M=M+Math.imul(ve,V)|0,S=S+Math.imul(te,Y)|0,b=b+Math.imul(te,q)|0,b=b+Math.imul(le,Y)|0,M=M+Math.imul(le,q)|0,S=S+Math.imul(Q,pe)|0,b=b+Math.imul(Q,xe)|0,b=b+Math.imul(R,pe)|0,M=M+Math.imul(R,xe)|0;var dt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(dt>>>26)|0,dt&=67108863,S=Math.imul(Be,Ot),b=Math.imul(Be,Bt),b=b+Math.imul(et,Ot)|0,M=Math.imul(et,Bt),S=S+Math.imul(Ee,vt)|0,b=b+Math.imul(Ee,Dt)|0,b=b+Math.imul(Qe,vt)|0,M=M+Math.imul(Qe,Dt)|0,S=S+Math.imul(ke,bt)|0,b=b+Math.imul(ke,$t)|0,b=b+Math.imul(ze,bt)|0,M=M+Math.imul(ze,$t)|0,S=S+Math.imul(Ie,nt)|0,b=b+Math.imul(Ie,Ft)|0,b=b+Math.imul(Le,nt)|0,M=M+Math.imul(Le,Ft)|0,S=S+Math.imul(Ne,H)|0,b=b+Math.imul(Ne,V)|0,b=b+Math.imul(Te,H)|0,M=M+Math.imul(Te,V)|0,S=S+Math.imul(fe,Y)|0,b=b+Math.imul(fe,q)|0,b=b+Math.imul(ve,Y)|0,M=M+Math.imul(ve,q)|0,S=S+Math.imul(te,pe)|0,b=b+Math.imul(te,xe)|0,b=b+Math.imul(le,pe)|0,M=M+Math.imul(le,xe)|0;var _t=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(_t>>>26)|0,_t&=67108863,S=Math.imul(Be,vt),b=Math.imul(Be,Dt),b=b+Math.imul(et,vt)|0,M=Math.imul(et,Dt),S=S+Math.imul(Ee,bt)|0,b=b+Math.imul(Ee,$t)|0,b=b+Math.imul(Qe,bt)|0,M=M+Math.imul(Qe,$t)|0,S=S+Math.imul(ke,nt)|0,b=b+Math.imul(ke,Ft)|0,b=b+Math.imul(ze,nt)|0,M=M+Math.imul(ze,Ft)|0,S=S+Math.imul(Ie,H)|0,b=b+Math.imul(Ie,V)|0,b=b+Math.imul(Le,H)|0,M=M+Math.imul(Le,V)|0,S=S+Math.imul(Ne,Y)|0,b=b+Math.imul(Ne,q)|0,b=b+Math.imul(Te,Y)|0,M=M+Math.imul(Te,q)|0,S=S+Math.imul(fe,pe)|0,b=b+Math.imul(fe,xe)|0,b=b+Math.imul(ve,pe)|0,M=M+Math.imul(ve,xe)|0;var ot=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(ot>>>26)|0,ot&=67108863,S=Math.imul(Be,bt),b=Math.imul(Be,$t),b=b+Math.imul(et,bt)|0,M=Math.imul(et,$t),S=S+Math.imul(Ee,nt)|0,b=b+Math.imul(Ee,Ft)|0,b=b+Math.imul(Qe,nt)|0,M=M+Math.imul(Qe,Ft)|0,S=S+Math.imul(ke,H)|0,b=b+Math.imul(ke,V)|0,b=b+Math.imul(ze,H)|0,M=M+Math.imul(ze,V)|0,S=S+Math.imul(Ie,Y)|0,b=b+Math.imul(Ie,q)|0,b=b+Math.imul(Le,Y)|0,M=M+Math.imul(Le,q)|0,S=S+Math.imul(Ne,pe)|0,b=b+Math.imul(Ne,xe)|0,b=b+Math.imul(Te,pe)|0,M=M+Math.imul(Te,xe)|0;var wt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(wt>>>26)|0,wt&=67108863,S=Math.imul(Be,nt),b=Math.imul(Be,Ft),b=b+Math.imul(et,nt)|0,M=Math.imul(et,Ft),S=S+Math.imul(Ee,H)|0,b=b+Math.imul(Ee,V)|0,b=b+Math.imul(Qe,H)|0,M=M+Math.imul(Qe,V)|0,S=S+Math.imul(ke,Y)|0,b=b+Math.imul(ke,q)|0,b=b+Math.imul(ze,Y)|0,M=M+Math.imul(ze,q)|0,S=S+Math.imul(Ie,pe)|0,b=b+Math.imul(Ie,xe)|0,b=b+Math.imul(Le,pe)|0,M=M+Math.imul(Le,xe)|0;var lt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul(Be,H),b=Math.imul(Be,V),b=b+Math.imul(et,H)|0,M=Math.imul(et,V),S=S+Math.imul(Ee,Y)|0,b=b+Math.imul(Ee,q)|0,b=b+Math.imul(Qe,Y)|0,M=M+Math.imul(Qe,q)|0,S=S+Math.imul(ke,pe)|0,b=b+Math.imul(ke,xe)|0,b=b+Math.imul(ze,pe)|0,M=M+Math.imul(ze,xe)|0;var at=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(at>>>26)|0,at&=67108863,S=Math.imul(Be,Y),b=Math.imul(Be,q),b=b+Math.imul(et,Y)|0,M=Math.imul(et,q),S=S+Math.imul(Ee,pe)|0,b=b+Math.imul(Ee,xe)|0,b=b+Math.imul(Qe,pe)|0,M=M+Math.imul(Qe,xe)|0;var Ae=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,S=Math.imul(Be,pe),b=Math.imul(Be,xe),b=b+Math.imul(et,pe)|0,M=Math.imul(et,xe);var Pe=(_+S|0)+((b&8191)<<13)|0;return _=(M+(b>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,x[0]=Re,x[1]=De,x[2]=it,x[3]=Ue,x[4]=gt,x[5]=st,x[6]=tt,x[7]=At,x[8]=Rt,x[9]=Mt,x[10]=Et,x[11]=dt,x[12]=_t,x[13]=ot,x[14]=wt,x[15]=lt,x[16]=at,x[17]=Ae,x[18]=Pe,_!==0&&(x[19]=_,f.length++),f};Math.imul||(N=P);function D(G,E,m){m.negative=E.negative^G.negative,m.length=G.length+E.length;for(var f=0,p=0,v=0;v>>26)|0,p+=x>>>26,x&=67108863}m.words[v]=_,f=x,x=p}return f!==0?m.words[v]=f:m.length--,m.strip()}function k(G,E,m){var f=new B;return f.mulp(G,E,m)}s.prototype.mulTo=function(E,m){var f,p=this.length+E.length;return this.length===10&&E.length===10?f=N(this,E,m):p<63?f=P(this,E,m):p<1024?f=D(this,E,m):f=k(this,E,m),f};function B(G,E){this.x=G,this.y=E}B.prototype.makeRBT=function(E){for(var m=new Array(E),f=s.prototype._countBits(E)-1,p=0;p>=1;return p},B.prototype.permute=function(E,m,f,p,v,x){for(var _=0;_>>1)v++;return 1<>>13,f[2*x+1]=v&8191,v=v>>>13;for(x=2*m;x>=26,m+=p/67108864|0,m+=v>>>26,this.words[f]=v&67108863}return m!==0&&(this.words[f]=m,this.length++),this},s.prototype.muln=function(E){return this.clone().imuln(E)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(E){var m=A(E);if(m.length===0)return new s(1);for(var f=this,p=0;p=0);var m=E%26,f=(E-m)/26,p=67108863>>>26-m<<26-m,v;if(m!==0){var x=0;for(v=0;v>>26-m}x&&(this.words[v]=x,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var p;m?p=(m-m%26)/26:p=0;var v=E%26,x=Math.min((E-v)/26,this.length),_=67108863^67108863>>>v<x)for(this.length-=x,b=0;b=0&&(M!==0||b>=p);b--){var I=this.words[b]|0;this.words[b]=M<<26-v|I>>>v,M=I&_}return S&&M!==0&&(S.words[S.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(E,m,f){return n(this.negative===0),this.iushrn(E,m,f)},s.prototype.shln=function(E){return this.clone().ishln(E)},s.prototype.ushln=function(E){return this.clone().iushln(E)},s.prototype.shrn=function(E){return this.clone().ishrn(E)},s.prototype.ushrn=function(E){return this.clone().iushrn(E)},s.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var m=E%26,f=(E-m)/26,p=1<=0);var m=E%26,f=(E-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(m!==0&&f++,this.length=Math.min(f,this.length),m!==0){var p=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(S/67108864|0),this.words[v+f]=x&67108863}for(;v>26,this.words[v+f]=x&67108863;if(_===0)return this.strip();for(n(_===-1),_=0,v=0;v>26,this.words[v]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(E,m){var f=this.length-E.length,p=this.clone(),v=E,x=v.words[v.length-1]|0,_=this._countBits(x);f=26-_,f!==0&&(v=v.ushln(f),p.iushln(f),x=v.words[v.length-1]|0);var S=p.length-v.length,b;if(m!=="mod"){b=new s(null),b.length=S+1,b.words=new Array(b.length);for(var M=0;M=0;F--){var ae=(p.words[v.length+F]|0)*67108864+(p.words[v.length+F-1]|0);for(ae=Math.min(ae/x|0,67108863),p._ishlnsubmul(v,ae,F);p.negative!==0;)ae--,p.negative=0,p._ishlnsubmul(v,1,F),p.isZero()||(p.negative^=1);b&&(b.words[F]=ae)}return b&&b.strip(),p.strip(),m!=="div"&&f!==0&&p.iushrn(f),{div:b||null,mod:p}},s.prototype.divmod=function(E,m,f){if(n(!E.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var p,v,x;return this.negative!==0&&E.negative===0?(x=this.neg().divmod(E,m),m!=="mod"&&(p=x.div.neg()),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.iadd(E)),{div:p,mod:v}):this.negative===0&&E.negative!==0?(x=this.divmod(E.neg(),m),m!=="mod"&&(p=x.div.neg()),{div:p,mod:x.mod}):this.negative&E.negative?(x=this.neg().divmod(E.neg(),m),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.isub(E)),{div:x.div,mod:v}):E.length>this.length||this.cmp(E)<0?{div:new s(0),mod:this}:E.length===1?m==="div"?{div:this.divn(E.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new s(this.modn(E.words[0]))}:this._wordDiv(E,m)},s.prototype.div=function(E){return this.divmod(E,"div",!1).div},s.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},s.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},s.prototype.divRound=function(E){var m=this.divmod(E);if(m.mod.isZero())return m.div;var f=m.div.negative!==0?m.mod.isub(E):m.mod,p=E.ushrn(1),v=E.andln(1),x=f.cmp(p);return x<0||v===1&&x===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(E){n(E<=67108863);for(var m=(1<<26)%E,f=0,p=this.length-1;p>=0;p--)f=(m*f+(this.words[p]|0))%E;return f},s.prototype.idivn=function(E){n(E<=67108863);for(var m=0,f=this.length-1;f>=0;f--){var p=(this.words[f]|0)+m*67108864;this.words[f]=p/E|0,m=p%E}return this.strip()},s.prototype.divn=function(E){return this.clone().idivn(E)},s.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var p=new s(1),v=new s(0),x=new s(0),_=new s(1),S=0;m.isEven()&&f.isEven();)m.iushrn(1),f.iushrn(1),++S;for(var b=f.clone(),M=m.clone();!m.isZero();){for(var I=0,F=1;!(m.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(m.iushrn(I);I-- >0;)(p.isOdd()||v.isOdd())&&(p.iadd(b),v.isub(M)),p.iushrn(1),v.iushrn(1);for(var ae=0,O=1;!(f.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(f.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(b),_.isub(M)),x.iushrn(1),_.iushrn(1);m.cmp(f)>=0?(m.isub(f),p.isub(x),v.isub(_)):(f.isub(m),x.isub(p),_.isub(v))}return{a:x,b:_,gcd:f.iushln(S)}},s.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var p=new s(1),v=new s(0),x=f.clone();m.cmpn(1)>0&&f.cmpn(1)>0;){for(var _=0,S=1;!(m.words[0]&S)&&_<26;++_,S<<=1);if(_>0)for(m.iushrn(_);_-- >0;)p.isOdd()&&p.iadd(x),p.iushrn(1);for(var b=0,M=1;!(f.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(f.iushrn(b);b-- >0;)v.isOdd()&&v.iadd(x),v.iushrn(1);m.cmp(f)>=0?(m.isub(f),p.isub(v)):(f.isub(m),v.isub(p))}var I;return m.cmpn(1)===0?I=p:I=v,I.cmpn(0)<0&&I.iadd(E),I},s.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var m=this.clone(),f=E.clone();m.negative=0,f.negative=0;for(var p=0;m.isEven()&&f.isEven();p++)m.iushrn(1),f.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=m.cmp(f);if(v<0){var x=m;m=f,f=x}else if(v===0||f.cmpn(1)===0)break;m.isub(f)}while(!0);return f.iushln(p)},s.prototype.invm=function(E){return this.egcd(E).a.umod(E)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(E){return this.words[0]&E},s.prototype.bincn=function(E){n(typeof E=="number");var m=E%26,f=(E-m)/26,p=1<>>26,_&=67108863,this.words[x]=_}return v!==0&&(this.words[x]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(E){var m=E<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var f;if(this.length>1)f=1;else{m&&(E=-E),n(E<=67108863,"Number is too big");var p=this.words[0]|0;f=p===E?0:pE.length)return 1;if(this.length=0;f--){var p=this.words[f]|0,v=E.words[f]|0;if(p!==v){pv&&(m=1);break}}return m},s.prototype.gtn=function(E){return this.cmpn(E)===1},s.prototype.gt=function(E){return this.cmp(E)===1},s.prototype.gten=function(E){return this.cmpn(E)>=0},s.prototype.gte=function(E){return this.cmp(E)>=0},s.prototype.ltn=function(E){return this.cmpn(E)===-1},s.prototype.lt=function(E){return this.cmp(E)===-1},s.prototype.lten=function(E){return this.cmpn(E)<=0},s.prototype.lte=function(E){return this.cmp(E)<=0},s.prototype.eqn=function(E){return this.cmpn(E)===0},s.prototype.eq=function(E){return this.cmp(E)===0},s.red=function(E){return new ue(E)},s.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(E){return this.red=E,this},s.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},s.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},s.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},s.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},s.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},s.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},s.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},s.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var j={k256:null,p224:null,p192:null,p25519:null};function U(G,E){this.name=G,this.p=new s(E,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var E=new s(null);return E.words=new Array(Math.ceil(this.n/13)),E},U.prototype.ireduce=function(E){var m=E,f;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),f=m.bitLength();while(f>this.n);var p=f0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},U.prototype.split=function(E,m){E.iushrn(this.n,0,m)},U.prototype.imulK=function(E){return E.imul(this.k)};function K(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(K,U),K.prototype.split=function(E,m){for(var f=4194303,p=Math.min(E.length,9),v=0;v>>22,x=_}x>>>=22,E.words[v-10]=x,x===0&&E.length>10?E.length-=10:E.length-=9},K.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var m=0,f=0;f>>=26,E.words[f]=v,m=p}return m!==0&&(E.words[E.length++]=m),E},s._prime=function(E){if(j[E])return j[E];var m;if(E==="k256")m=new K;else if(E==="p224")m=new J;else if(E==="p192")m=new T;else if(E==="p25519")m=new z;else throw new Error("Unknown prime "+E);return j[E]=m,m};function ue(G){if(typeof G=="string"){var E=s._prime(G);this.m=E.p,this.prime=E}else n(G.gtn(1),"modulus must be greater than 1"),this.m=G,this.prime=null}ue.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},ue.prototype._verify2=function(E,m){n((E.negative|m.negative)===0,"red works only with positives"),n(E.red&&E.red===m.red,"red works only with red numbers")},ue.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},ue.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},ue.prototype.add=function(E,m){this._verify2(E,m);var f=E.add(m);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},ue.prototype.iadd=function(E,m){this._verify2(E,m);var f=E.iadd(m);return f.cmp(this.m)>=0&&f.isub(this.m),f},ue.prototype.sub=function(E,m){this._verify2(E,m);var f=E.sub(m);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},ue.prototype.isub=function(E,m){this._verify2(E,m);var f=E.isub(m);return f.cmpn(0)<0&&f.iadd(this.m),f},ue.prototype.shl=function(E,m){return this._verify1(E),this.imod(E.ushln(m))},ue.prototype.imul=function(E,m){return this._verify2(E,m),this.imod(E.imul(m))},ue.prototype.mul=function(E,m){return this._verify2(E,m),this.imod(E.mul(m))},ue.prototype.isqr=function(E){return this.imul(E,E.clone())},ue.prototype.sqr=function(E){return this.mul(E,E)},ue.prototype.sqrt=function(E){if(E.isZero())return E.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(E,f)}for(var p=this.m.subn(1),v=0;!p.isZero()&&p.andln(1)===0;)v++,p.iushrn(1);n(!p.isZero());var x=new s(1).toRed(this),_=x.redNeg(),S=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new s(2*b*b).toRed(this);this.pow(b,S).cmp(_)!==0;)b.redIAdd(_);for(var M=this.pow(b,p),I=this.pow(E,p.addn(1).iushrn(1)),F=this.pow(E,p),ae=v;F.cmp(x)!==0;){for(var O=F,se=0;O.cmp(x)!==0;se++)O=O.redSqr();n(se=0;v--){for(var M=m.words[v],I=b-1;I>=0;I--){var F=M>>I&1;if(x!==p[0]&&(x=this.sqr(x)),F===0&&_===0){S=0;continue}_<<=1,_|=F,S++,!(S!==f&&(v!==0||I!==0))&&(x=this.mul(x,p[_]),S=0,_=0)}b=26}return x},ue.prototype.convertTo=function(E){var m=E.umod(this.m);return m===E?m.clone():m},ue.prototype.convertFrom=function(E){var m=E.clone();return m.red=null,m},s.mont=function(E){return new _e(E)};function _e(G){ue.call(this,G),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(_e,ue),_e.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},_e.prototype.convertFrom=function(E){var m=this.imod(E.mul(this.rinv));return m.red=null,m},_e.prototype.imul=function(E,m){if(E.isZero()||m.isZero())return E.words[0]=0,E.length=1,E;var f=E.imul(m),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.mul=function(E,m){if(E.isZero()||m.isZero())return new s(0)._forceRed(this);var f=E.mul(m),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.invm=function(E){var m=this.imod(E._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,nn)}(Wm);var xo=Wm.exports,Km={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var u=0;u>8,g=l&255;d?a.push(d,g):a.push(g)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(N>>1)-1?k=(N>>1)-B:k=B,D.isubn(k)):k=0,A[P]=k,D.iushrn(1)}return A}e.getNAF=s;function o(d,g){var y=[[],[]];d=d.clone(),g=g.clone();for(var A=0,P=0,N;d.cmpn(-A)>0||g.cmpn(-P)>0;){var D=d.andln(3)+A&3,k=g.andln(3)+P&3;D===3&&(D=-1),k===3&&(k=-1);var B;D&1?(N=d.andln(7)+A&7,(N===3||N===5)&&k===2?B=-D:B=D):B=0,y[0].push(B);var j;k&1?(N=g.andln(7)+P&7,(N===3||N===5)&&D===2?j=-k:j=k):j=0,y[1].push(j),2*A===B+1&&(A=1-A),2*P===j+1&&(P=1-P),d.iushrn(1),g.iushrn(1)}return y}e.getJSF=o;function a(d,g,y){var A="_"+g;d.prototype[g]=function(){return this[A]!==void 0?this[A]:this[A]=y.call(this)}}e.cachedProperty=a;function u(d){return typeof d=="string"?e.toArray(d,"hex"):d}e.parseBytes=u;function l(d){return new r(d,"hex","le")}e.intFromLE=l}(Ti);var Vm={exports:{}},Gm;Vm.exports=function(e){return Gm||(Gm=new aa(null)),Gm.generate(e)};function aa(t){this.rand=t}if(Vm.exports.Rand=aa,aa.prototype.generate=function(e){return this._rand(e)},aa.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Rd=ca;ca.prototype.point=function(){throw new Error("Not implemented")},ca.prototype.validate=function(){throw new Error("Not implemented")},ca.prototype._fixedNafMul=function(e,r){Td(e.precomputed);var n=e._getDoubles(),i=Cd(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),g=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Td(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},ca.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,g,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=Cd(n[P],o[P],this._bitLength),u[N]=Cd(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=Nk(n[P],n[N]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[N]=new Array(l),g=0;g=0;d--){for(var T=0;d>=0;){var z=!0;for(g=0;g=0&&T++,K=K.dblp(T),d<0)break;for(g=0;g0?y=a[g][ue-1>>1]:ue<0&&(y=a[g][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Ki.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),g.negative&&(g=g.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:g,b:y},{a:A,b:P}]},Vi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),g=e.sub(a).sub(u),y=l.add(d).neg();return{k1:g,k2:y}},Vi.prototype.pointFromX=function(e,r){e=new en(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Vi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Vi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},On.prototype.isInfinity=function(){return this.inf},On.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},On.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},On.prototype.getX=function(){return this.x.fromRed()},On.prototype.getY=function(){return this.y.fromRed()},On.prototype.mul=function(e){return e=new en(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},On.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},On.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},On.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},On.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},On.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function qn(t,e,r,n){bu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new en(0)):(this.x=new en(e,16),this.y=new en(r,16),this.z=new en(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Jm(qn,bu.BasePoint),Vi.prototype.jpoint=function(e,r,n){return new qn(this,e,r,n)},qn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},qn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},qn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),g=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(g).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(g)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},qn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),g=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(g).redISub(g),A=u.redMul(g.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},qn.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},qn.prototype.inspect=function(){return this.isInfinity()?"":""},qn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var yu=xo,I3=yd,Dd=Rd,$k=Ti;function wu(t){Dd.call(this,"mont",t),this.a=new yu(t.a,16).toRed(this.red),this.b=new yu(t.b,16).toRed(this.red),this.i4=new yu(4).toRed(this.red).redInvm(),this.two=new yu(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}I3(wu,Dd);var Fk=wu;wu.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function Nn(t,e,r){Dd.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new yu(e,16),this.z=new yu(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}I3(Nn,Dd.BasePoint),wu.prototype.decodePoint=function(e,r){return this.point($k.toArray(e,r),1)},wu.prototype.point=function(e,r){return new Nn(this,e,r)},wu.prototype.pointFromJSON=function(e){return Nn.fromJSON(this,e)},Nn.prototype.precompute=function(){},Nn.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Nn.fromJSON=function(e,r){return new Nn(e,r[0],r[1]||e.one)},Nn.prototype.inspect=function(){return this.isInfinity()?"":""},Nn.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Nn.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)},Nn.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),u=s.redMul(i),l=r.z.redMul(a.redAdd(u).redSqr()),d=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(l,d)},Nn.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i},Nn.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Nn.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Nn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var jk=Ti,_o=xo,C3=yd,Od=Rd,Uk=jk.assert;function zs(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Od.call(this,"edwards",t),this.a=new _o(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new _o(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new _o(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Uk(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}C3(zs,Od);var qk=zs;zs.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},zs.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},zs.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)},zs.prototype.pointFromX=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var u=a.fromRed().isOdd();return(r&&!u||!r&&u)&&(a=a.redNeg()),this.point(e,a)},zs.prototype.pointFromY=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)},zs.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function Hr(t,e,r,n,i){Od.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new _o(e,16),this.y=new _o(r,16),this.z=n?new _o(n,16):this.curve.one,this.t=i&&new _o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}C3(Hr,Od.BasePoint),zs.prototype.pointFromJSON=function(e){return Hr.fromJSON(this,e)},zs.prototype.point=function(e,r,n,i){return new Hr(this,e,r,n,i)},Hr.fromJSON=function(e,r){return new Hr(e,r[0],r[1],r[2])},Hr.prototype.inspect=function(){return this.isInfinity()?"":""},Hr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Hr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),u=i.redSub(r),l=s.redMul(a),d=o.redMul(u),g=s.redMul(u),y=a.redMul(o);return this.curve.point(l,d,y,g)},Hr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,u,l;if(this.curve.twisted){a=this.curve._mulA(r);var d=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(d.redSub(this.curve.two)),s=d.redMul(a.redSub(n)),o=d.redSqr().redSub(d).redSub(d)):(u=this.z.redSqr(),l=d.redSub(u).redISub(u),i=e.redSub(r).redISub(n).redMul(l),s=d.redMul(a.redSub(n)),o=d.redMul(l))}else a=r.redAdd(n),u=this.curve._mulC(this.z).redSqr(),l=a.redSub(u).redSub(u),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)},Hr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Hr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),u=s.redAdd(i),l=n.redAdd(r),d=o.redMul(a),g=u.redMul(l),y=o.redMul(l),A=a.redMul(u);return this.curve.point(d,g,A,y)},Hr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),u=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),d=r.redMul(a).redMul(l),g,y;return this.curve.twisted?(g=r.redMul(u).redMul(s.redSub(this.curve._mulA(i))),y=a.redMul(u)):(g=r.redMul(u).redMul(s.redSub(i)),y=this.curve._mulC(a).redMul(u)),this.curve.point(d,g,y)},Hr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Hr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Hr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)},Hr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)},Hr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Hr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Hr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Hr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Hr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Hr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Hr.prototype.toP=Hr.prototype.normalize,Hr.prototype.mixedAdd=Hr.prototype.add,function(t){var e=t;e.base=Rd,e.short=Bk,e.mont=Fk,e.edwards=qk}(Ym);var Nd={},Xm,T3;function zk(){return T3||(T3=1,Xm={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Xm}(function(t){var e=t,r=al,n=Ym,i=Ti,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,d){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var g=new o(d);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:g}),g}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=zk()}catch{u=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})})(Nd);var Hk=al,Za=Km,R3=Ga;function ua(t){if(!(this instanceof ua))return new ua(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Za.toArray(t.entropy,t.entropyEnc||"hex"),r=Za.toArray(t.nonce,t.nonceEnc||"hex"),n=Za.toArray(t.pers,t.persEnc||"hex");R3(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Wk=ua;ua.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ua.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Za.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var Ld=xo,Qm=Ti,Yk=Qm.assert;function kd(t,e){if(t instanceof kd)return t;this._importDER(t,e)||(Yk(t.r&&t.s,"Signature without r or s"),this.r=new Ld(t.r,16),this.s=new Ld(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Jk=kd;function Xk(){this.place=0}function e1(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function D3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}kd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=D3(r),n=D3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];t1(i,r.length),i=i.concat(r),i.push(2),t1(i,n.length);var s=i.concat(n),o=[48];return t1(o,s.length),o=o.concat(s),Qm.encode(o,e)};var Eo=xo,O3=Wk,Zk=Ti,r1=Nd,Qk=M3,N3=Zk.assert,n1=Gk,Bd=Jk;function Gi(t){if(!(this instanceof Gi))return new Gi(t);typeof t=="string"&&(N3(Object.prototype.hasOwnProperty.call(r1,t),"Unknown curve "+t),t=r1[t]),t instanceof r1.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var eB=Gi;Gi.prototype.keyPair=function(e){return new n1(this,e)},Gi.prototype.keyFromPrivate=function(e,r){return n1.fromPrivate(this,e,r)},Gi.prototype.keyFromPublic=function(e,r){return n1.fromPublic(this,e,r)},Gi.prototype.genKeyPair=function(e){e||(e={});for(var r=new O3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Qk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new Eo(2));;){var s=new Eo(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Gi.prototype._truncateToN=function(e,r,n){var i;if(Eo.isBN(e)||typeof e=="number")e=new Eo(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new Eo(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new Eo(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Gi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new O3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new Eo(1)),d=0;;d++){var g=i.k?i.k(d):new Eo(u.generate(this.n.byteLength()));if(g=this._truncateToN(g,!0),!(g.cmpn(1)<=0||g.cmp(l)>=0)){var y=this.g.mul(g);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=g.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new Bd({r:P,s:N,recoveryParam:D})}}}}}},Gi.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new Bd(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),l=u.mul(e).umod(this.n),d=u.mul(o).umod(this.n),g;return this.curve._maxwellTrick?(g=this.g.jmulAdd(l,n.getPublic(),d),g.isInfinity()?!1:g.eqXToP(o)):(g=this.g.mulAdd(l,n.getPublic(),d),g.isInfinity()?!1:g.getX().umod(this.n).cmp(o)===0)},Gi.prototype.recoverPubKey=function(t,e,r,n){N3((3&r)===r,"The recovery param is more than two bits"),e=new Bd(e,n);var i=this.n,s=new Eo(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),g=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(g,o,y)},Gi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Bd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dl=Ti,L3=dl.assert,k3=dl.parseBytes,xu=dl.cachedProperty;function Ln(t,e){this.eddsa=t,this._secret=k3(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=k3(e.pub)}Ln.fromPublic=function(e,r){return r instanceof Ln?r:new Ln(e,{pub:r})},Ln.fromSecret=function(e,r){return r instanceof Ln?r:new Ln(e,{secret:r})},Ln.prototype.secret=function(){return this._secret},xu(Ln,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),xu(Ln,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),xu(Ln,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i}),xu(Ln,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),xu(Ln,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),xu(Ln,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Ln.prototype.sign=function(e){return L3(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Ln.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},Ln.prototype.getSecret=function(e){return L3(this._secret,"KeyPair is public only"),dl.encode(this.secret(),e)},Ln.prototype.getPublic=function(e){return dl.encode(this.pubBytes(),e)};var tB=Ln,rB=xo,$d=Ti,B3=$d.assert,Fd=$d.cachedProperty,nB=$d.parseBytes;function Qa(t,e){this.eddsa=t,typeof e!="object"&&(e=nB(e)),Array.isArray(e)&&(B3(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),B3(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof rB&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Fd(Qa,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Fd(Qa,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Fd(Qa,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Fd(Qa,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Qa.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Qa.prototype.toHex=function(){return $d.encode(this.toBytes(),"hex").toUpperCase()};var iB=Qa,sB=al,oB=Nd,_u=Ti,aB=_u.assert,$3=_u.parseBytes,F3=tB,j3=iB;function vi(t){if(aB(t==="ed25519","only tested with ed25519 so far"),!(this instanceof vi))return new vi(t);t=oB[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=sB.sha512}var cB=vi;vi.prototype.sign=function(e,r){e=$3(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),u=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:u,Rencoded:o})},vi.prototype.verify=function(e,r,n){if(e=$3(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)},vi.prototype.hashInt=function(){for(var e=this.hash(),r=0;re in t?lB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,H3=(t,e)=>{for(var r in e||(e={}))hB.call(e,r)&&z3(t,r,e[r]);if(q3)for(var r of q3(e))dB.call(e,r)&&z3(t,r,e[r]);return t};const pB="ReactNative",Ri={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},gB="js";function jd(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Su(){return!nl()&&!!mm()&&navigator.product===pB}function pl(){return!jd()&&!!mm()&&!!nl()}function gl(){return Su()?Ri.reactNative:jd()?Ri.node:pl()?Ri.browser:Ri.unknown}function mB(){var t;try{return Su()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function vB(t,e){let r=il.parse(t);return r=H3(H3({},r),e),t=il.stringify(r),t}function W3(){return Ax()||{name:"",description:"",url:"",icons:[""]}}function bB(){if(gl()===Ri.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=HO();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function yB(){var t;const e=gl();return e===Ri.browser?[e,((t=Sx())==null?void 0:t.host)||"unknown"].join(":"):e}function K3(t,e,r){const n=bB(),i=yB();return[[t,e].join("-"),[gB,r].join("-"),n,i].join("/")}function wB({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const u=r.split("?"),l=K3(t,e,n),d={auth:i,ua:l,projectId:s,useOnCloseEvent:o,origin:a||void 0},g=vB(u[1]||"",d);return u[0]+"?"+g}function ec(t,e){return t.filter(r=>e.includes(r)).length===t.length}function V3(t){return Object.fromEntries(t.entries())}function G3(t){return new Map(Object.entries(t))}function tc(t=mt.FIVE_MINUTES,e){const r=mt.toMiliseconds(t||mt.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Au(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function Y3(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function xB(t){return Y3("topic",t)}function _B(t){return Y3("id",t)}function J3(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function En(t,e){return mt.fromMiliseconds(Date.now()+mt.toMiliseconds(t))}function fa(t){return Date.now()>=mt.toMiliseconds(t)}function vr(t,e){return`${t}${e?`:${e}`:""}`}function Ud(t=[],e=[]){return[...new Set([...t,...e])]}async function EB({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=SB(s,t,e),a=gl();if(a===Ri.browser){if(!((n=nl())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,PB()?"_blank":"_self","noreferrer noopener")}else a===Ri.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function SB(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${MB(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function AB(t,e){let r="";try{if(pl()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function X3(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function Z3(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function i1(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function PB(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function MB(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function Q3(t){return Buffer.from(t,"base64").toString("utf-8")}const IB="https://rpc.walletconnect.org/v1";async function CB(t,e,r,n,i,s){switch(r.t){case"eip191":return TB(t,e,r.s);case"eip1271":return await RB(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function TB(t,e,r){return yk(Ux(e),r).toLowerCase()===t.toLowerCase()}async function RB(t,e,r,n,i,s){const o=Eu(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",d=r.substring(2),g=Ux(e).substring(2),y=a+g+u+l+d,A=await fetch(`${s||IB}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:DB(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:y},"latest"]})}),{result:P}=await A.json();return P?P.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function DB(){return Date.now()+Math.floor(Math.random()*1e3)}var OB=Object.defineProperty,NB=Object.defineProperties,LB=Object.getOwnPropertyDescriptors,e_=Object.getOwnPropertySymbols,kB=Object.prototype.hasOwnProperty,BB=Object.prototype.propertyIsEnumerable,t_=(t,e,r)=>e in t?OB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$B=(t,e)=>{for(var r in e||(e={}))kB.call(e,r)&&t_(t,r,e[r]);if(e_)for(var r of e_(e))BB.call(e,r)&&t_(t,r,e[r]);return t},FB=(t,e)=>NB(t,LB(e));const jB="did:pkh:",s1=t=>t==null?void 0:t.split(":"),UB=t=>{const e=t&&s1(t);if(e)return t.includes(jB)?e[3]:e[1]},o1=t=>{const e=t&&s1(t);if(e)return e[2]+":"+e[3]},qd=t=>{const e=t&&s1(t);if(e)return e.pop()};async function r_(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=n_(i,i.iss),o=qd(i.iss);return await CB(o,s,n,o1(i.iss),r)}const n_=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=qd(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${UB(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,d=t.exp?`Expiration Time: ${t.exp}`:void 0,g=t.nbf?`Not Before: ${t.nbf}`:void 0,y=t.requestId?`Request ID: ${t.requestId}`:void 0,A=t.resources?`Resources:${t.resources.map(N=>` -- ${N}`).join("")}`:void 0,P=zd(t.resources);if(P){const N=ml(P);i=JB(i,N)}return[r,n,"",i,"",s,o,a,u,l,d,g,y,A].filter(N=>N!=null).join(` -`)};function qB(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function zB(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function rc(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function HB(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:WB(e,r,n)}}}function WB(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function i_(t){return rc(t),`urn:recap:${qB(t).replace(/=/g,"")}`}function ml(t){const e=zB(t.replace("urn:recap:",""));return rc(e),e}function KB(t,e,r){const n=HB(t,e,r);return i_(n)}function VB(t){return t&&t.includes("urn:recap:")}function GB(t,e){const r=ml(t),n=ml(e),i=YB(r,n);return i_(i)}function YB(t,e){rc(t),rc(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,u)=>a.localeCompare(u)).forEach(a=>{var u,l;n.att[i]=FB($B({},n.att[i]),{[a]:((u=t.att[i])==null?void 0:u[a])||((l=e.att[i])==null?void 0:l[a])})})}),n}function JB(t="",e){rc(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const u=Object.keys(e.att[a]).map(g=>({ability:g.split("/")[0],action:g.split("/")[1]}));u.sort((g,y)=>g.action.localeCompare(y.action));const l={};u.forEach(g=>{l[g.ability]||(l[g.ability]=[]),l[g.ability].push(g.action)});const d=Object.keys(l).map(g=>(i++,`(${i}) '${g}': '${l[g].join("', '")}' for '${a}'.`));n.push(d.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function s_(t){var e;const r=ml(t);rc(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function o_(t){const e=ml(t);rc(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function zd(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return VB(e)?e:void 0}const a_="base10",ni="base16",la="base64pad",vl="base64url",bl="utf8",c_=0,So=1,yl=2,XB=0,u_=1,wl=12,a1=32;function ZB(){const t=Hm.generateKeyPair();return{privateKey:Tn(t.secretKey,ni),publicKey:Tn(t.publicKey,ni)}}function c1(){const t=ta.randomBytes(a1);return Tn(t,ni)}function QB(t,e){const r=Hm.sharedKey(Rn(t,ni),Rn(e,ni),!0),n=new Dk(ll.SHA256,r).expand(a1);return Tn(n,ni)}function Hd(t){const e=ll.hash(Rn(t,ni));return Tn(e,ni)}function Ao(t){const e=ll.hash(Rn(t,bl));return Tn(e,ni)}function f_(t){return Rn(`${t}`,a_)}function nc(t){return Number(Tn(t,a_))}function e$(t){const e=f_(typeof t.type<"u"?t.type:c_);if(nc(e)===So&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Rn(t.senderPublicKey,ni):void 0,n=typeof t.iv<"u"?Rn(t.iv,ni):ta.randomBytes(wl),i=new Um.ChaCha20Poly1305(Rn(t.symKey,ni)).seal(n,Rn(t.message,bl));return l_({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function t$(t,e){const r=f_(yl),n=ta.randomBytes(wl),i=Rn(t,bl);return l_({type:r,sealed:i,iv:n,encoding:e})}function r$(t){const e=new Um.ChaCha20Poly1305(Rn(t.symKey,ni)),{sealed:r,iv:n}=xl({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Tn(i,bl)}function n$(t,e){const{sealed:r}=xl({encoded:t,encoding:e});return Tn(r,bl)}function l_(t){const{encoding:e=la}=t;if(nc(t.type)===yl)return Tn(pd([t.type,t.sealed]),e);if(nc(t.type)===So){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Tn(pd([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return Tn(pd([t.type,t.iv,t.sealed]),e)}function xl(t){const{encoded:e,encoding:r=la}=t,n=Rn(e,r),i=n.slice(XB,u_),s=u_;if(nc(i)===So){const l=s+a1,d=l+wl,g=n.slice(s,l),y=n.slice(l,d),A=n.slice(d);return{type:i,sealed:A,iv:y,senderPublicKey:g}}if(nc(i)===yl){const l=n.slice(s),d=ta.randomBytes(wl);return{type:i,sealed:l,iv:d}}const o=s+wl,a=n.slice(s,o),u=n.slice(o);return{type:i,sealed:u,iv:a}}function i$(t,e){const r=xl({encoded:t,encoding:e==null?void 0:e.encoding});return h_({type:nc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Tn(r.senderPublicKey,ni):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function h_(t){const e=(t==null?void 0:t.type)||c_;if(e===So){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function d_(t){return t.type===So&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function p_(t){return t.type===yl}function s$(t){return new A3.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function o$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function a$(t){return Buffer.from(o$(t),"base64")}function c$(t,e){const[r,n,i]=t.split("."),s=a$(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),u=`${r}.${n}`,l=new ll.SHA256().update(Buffer.from(u)).digest(),d=s$(e),g=Buffer.from(l).toString("hex");if(!d.verify(g,{r:o,s:a}))throw new Error("Invalid signature");return gm(t).payload}const u$="irn";function u1(t){return(t==null?void 0:t.relay)||{protocol:u$}}function _l(t){const e=uB[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var f$=Object.defineProperty,l$=Object.defineProperties,h$=Object.getOwnPropertyDescriptors,g_=Object.getOwnPropertySymbols,d$=Object.prototype.hasOwnProperty,p$=Object.prototype.propertyIsEnumerable,m_=(t,e,r)=>e in t?f$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v_=(t,e)=>{for(var r in e||(e={}))d$.call(e,r)&&m_(t,r,e[r]);if(g_)for(var r of g_(e))p$.call(e,r)&&m_(t,r,e[r]);return t},g$=(t,e)=>l$(t,h$(e));function m$(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function b_(t){if(!t.includes("wc:")){const u=Q3(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=il.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:v$(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:m$(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function v$(t){return t.startsWith("//")?t.substring(2):t}function b$(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function y_(t){return`${t.protocol}:${t.topic}@${t.version}?`+il.stringify(v_(g$(v_({symKey:t.symKey},b$(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Wd(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Pu(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function y$(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Pu(r.accounts))}),e}function w$(t,e){const r=[];return Object.values(t).forEach(n=>{Pu(n.accounts).includes(e)&&r.push(...n.methods)}),r}function x$(t,e){const r=[];return Object.values(t).forEach(n=>{Pu(n.accounts).includes(e)&&r.push(...n.events)}),r}function f1(t){return t.includes(":")}function El(t){return f1(t)?t.split(":")[0]:t}function _$(t){const e={};return t==null||t.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function w_(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=_$(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=Ud(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const E$={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},S$={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ut(t,e){const{message:r,code:n}=S$[t];return{message:e?`${r} ${e}`:r,code:n}}function Dr(t,e){const{message:r,code:n}=E$[t];return{message:e?`${r} ${e}`:r,code:n}}function ic(t,e){return!!Array.isArray(t)}function Sl(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function bi(t){return typeof t>"u"}function an(t,e){return e&&bi(t)?!0:typeof t=="string"&&!!t.trim().length}function l1(t,e){return typeof t=="number"&&!isNaN(t)}function A$(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return ec(i,n)?(n.forEach(o=>{const{accounts:a,methods:u,events:l}=t.namespaces[o],d=Pu(a),g=r[o];(!ec(U3(o,g),d)||!ec(g.methods,u)||!ec(g.events,l))&&(s=!1)}),s):!1}function Kd(t){return an(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function P$(t){if(an(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Kd(r)}}return!1}function M$(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(an(t,!1)){if(e(t))return!0;const r=Q3(t);return e(r)}}catch{}return!1}function I$(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function C$(t){return t==null?void 0:t.topic}function T$(t,e){let r=null;return an(t==null?void 0:t.publicKey,!1)||(r=ut("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function x_(t){let e=!0;return ic(t)?t.length&&(e=t.every(r=>an(r,!1))):e=!1,e}function R$(t,e,r){let n=null;return ic(e)&&e.length?e.forEach(i=>{n||Kd(i)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Kd(t)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function D$(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=R$(i,U3(i,s),`${e} ${r}`);o&&(n=o)}),n}function O$(t,e){let r=null;return ic(t)?t.forEach(n=>{r||P$(n)||(r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function N$(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=O$(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function L$(t,e){let r=null;return x_(t==null?void 0:t.methods)?x_(t==null?void 0:t.events)||(r=Dr("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Dr("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function __(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=L$(n,`${e}, namespace`);i&&(r=i)}),r}function k$(t,e,r){let n=null;if(t&&Sl(t)){const i=__(t,e);i&&(n=i);const s=D$(t,e,r);s&&(n=s)}else n=ut("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function h1(t,e){let r=null;if(t&&Sl(t)){const n=__(t,e);n&&(r=n);const i=N$(t,e);i&&(r=i)}else r=ut("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function E_(t){return an(t.protocol,!0)}function B$(t,e){let r=!1;return t?t&&ic(t)&&t.length&&t.forEach(n=>{r=E_(n)}):r=!0,r}function $$(t){return typeof t=="number"}function yi(t){return typeof t<"u"&&typeof t!==null}function F$(t){return!(!t||typeof t!="object"||!t.code||!l1(t.code)||!t.message||!an(t.message,!1))}function j$(t){return!(bi(t)||!an(t.method,!1))}function U$(t){return!(bi(t)||bi(t.result)&&bi(t.error)||!l1(t.id)||!an(t.jsonrpc,!1))}function q$(t){return!(bi(t)||!an(t.name,!1))}function S_(t,e){return!(!Kd(e)||!y$(t).includes(e))}function z$(t,e,r){return an(r,!1)?w$(t,e).includes(r):!1}function H$(t,e,r){return an(r,!1)?x$(t,e).includes(r):!1}function A_(t,e,r){let n=null;const i=W$(t),s=K$(e),o=Object.keys(i),a=Object.keys(s),u=P_(Object.keys(t)),l=P_(Object.keys(e)),d=u.filter(g=>!l.includes(g));return d.length&&(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. + */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=nn:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],p=[4,1024,262144,67108864],y=[1,256,65536,16777216],A=[6,1536,393216,100663296],P=[0,8,16,24],N=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],D=[224,256,384,512],k=[128,256],B=["hex","buffer","arrayBuffer","array","digest"],j={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(O){return Object.prototype.toString.call(O)==="[object Array]"}),u&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(O){return typeof O=="object"&&O.buffer&&O.buffer.constructor===ArrayBuffer});for(var U=function(O,se,ee){return function(X){return new I(O,se,O).update(X)[ee]()}},K=function(O,se,ee){return function(X,Q){return new I(O,se,Q).update(X)[ee]()}},J=function(O,se,ee){return function(X,Q,R,Z){return f["cshake"+O].update(X,Q,R,Z)[ee]()}},T=function(O,se,ee){return function(X,Q,R,Z){return f["kmac"+O].update(X,Q,R,Z)[ee]()}},z=function(O,se,ee,X){for(var Q=0;Q>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ee>>5,this.extraBytes=(ee&31)>>3;for(var X=0;X<50;++X)this.s[X]=0}I.prototype.update=function(O){if(this.finalized)throw new Error(r);var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}for(var X=this.blocks,Q=this.byteCount,R=O.length,Z=this.blockCount,te=0,le=this.s,ie,fe;te>2]|=O[te]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(X[ie>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=Q){for(this.start=ie-Q,this.block=X[Z],ie=0;ie>8,ee=O&255;ee>0;)Q.unshift(ee),O=O>>8,ee=O&255,++X;return se?Q.push(X):Q.unshift(X),this.update(Q),Q.length},I.prototype.encodeString=function(O){var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}var X=0,Q=O.length;if(se)X=Q;else for(var R=0;R=57344?X+=3:(Z=65536+((Z&1023)<<10|O.charCodeAt(++R)&1023),X+=4)}return X+=this.encode(X*8),this.update(O),X},I.prototype.bytepad=function(O,se){for(var ee=this.encode(se),X=0;X>2]|=this.padding[se&3],this.lastByteIndex===this.byteCount)for(O[0]=O[ee],se=1;se>4&15]+l[te&15]+l[te>>12&15]+l[te>>8&15]+l[te>>20&15]+l[te>>16&15]+l[te>>28&15]+l[te>>24&15];R%O===0&&(ae(se),Q=0)}return X&&(te=se[Q],Z+=l[te>>4&15]+l[te&15],X>1&&(Z+=l[te>>12&15]+l[te>>8&15]),X>2&&(Z+=l[te>>20&15]+l[te>>16&15])),Z},I.prototype.arrayBuffer=function(){this.finalize();var O=this.blockCount,se=this.s,ee=this.outputBlocks,X=this.extraBytes,Q=0,R=0,Z=this.outputBits>>3,te;X?te=new ArrayBuffer(ee+1<<2):te=new ArrayBuffer(Z);for(var le=new Uint32Array(te);R>8&255,Z[te+2]=le>>16&255,Z[te+3]=le>>24&255;R%O===0&&ae(se)}return X&&(te=R<<2,le=se[Q],Z[te]=le&255,X>1&&(Z[te+1]=le>>8&255),X>2&&(Z[te+2]=le>>16&255)),Z};function F(O,se,ee){I.call(this,O,se,ee)}F.prototype=new I,F.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var ae=function(O){var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me,Ne,Te,$e,Ie,Le,Ve,ke,ze,He,Ee,Qe,ct,Be,et,rt,Je,pt,ht,ft,Ht,Jt,St,er,Xt,Ot,Bt,Tt,vt,Dt,Lt,bt,$t,jt,nt,Ft,$,H,V,C,Y,q,oe,pe,xe,Re,De,it,Ue,gt,st,tt;for(X=0;X<48;X+=2)Q=O[0]^O[10]^O[20]^O[30]^O[40],R=O[1]^O[11]^O[21]^O[31]^O[41],Z=O[2]^O[12]^O[22]^O[32]^O[42],te=O[3]^O[13]^O[23]^O[33]^O[43],le=O[4]^O[14]^O[24]^O[34]^O[44],ie=O[5]^O[15]^O[25]^O[35]^O[45],fe=O[6]^O[16]^O[26]^O[36]^O[46],ve=O[7]^O[17]^O[27]^O[37]^O[47],Me=O[8]^O[18]^O[28]^O[38]^O[48],Ne=O[9]^O[19]^O[29]^O[39]^O[49],se=Me^(Z<<1|te>>>31),ee=Ne^(te<<1|Z>>>31),O[0]^=se,O[1]^=ee,O[10]^=se,O[11]^=ee,O[20]^=se,O[21]^=ee,O[30]^=se,O[31]^=ee,O[40]^=se,O[41]^=ee,se=Q^(le<<1|ie>>>31),ee=R^(ie<<1|le>>>31),O[2]^=se,O[3]^=ee,O[12]^=se,O[13]^=ee,O[22]^=se,O[23]^=ee,O[32]^=se,O[33]^=ee,O[42]^=se,O[43]^=ee,se=Z^(fe<<1|ve>>>31),ee=te^(ve<<1|fe>>>31),O[4]^=se,O[5]^=ee,O[14]^=se,O[15]^=ee,O[24]^=se,O[25]^=ee,O[34]^=se,O[35]^=ee,O[44]^=se,O[45]^=ee,se=le^(Me<<1|Ne>>>31),ee=ie^(Ne<<1|Me>>>31),O[6]^=se,O[7]^=ee,O[16]^=se,O[17]^=ee,O[26]^=se,O[27]^=ee,O[36]^=se,O[37]^=ee,O[46]^=se,O[47]^=ee,se=fe^(Q<<1|R>>>31),ee=ve^(R<<1|Q>>>31),O[8]^=se,O[9]^=ee,O[18]^=se,O[19]^=ee,O[28]^=se,O[29]^=ee,O[38]^=se,O[39]^=ee,O[48]^=se,O[49]^=ee,Te=O[0],$e=O[1],nt=O[11]<<4|O[10]>>>28,Ft=O[10]<<4|O[11]>>>28,Je=O[20]<<3|O[21]>>>29,pt=O[21]<<3|O[20]>>>29,Ue=O[31]<<9|O[30]>>>23,gt=O[30]<<9|O[31]>>>23,Lt=O[40]<<18|O[41]>>>14,bt=O[41]<<18|O[40]>>>14,St=O[2]<<1|O[3]>>>31,er=O[3]<<1|O[2]>>>31,Ie=O[13]<<12|O[12]>>>20,Le=O[12]<<12|O[13]>>>20,$=O[22]<<10|O[23]>>>22,H=O[23]<<10|O[22]>>>22,ht=O[33]<<13|O[32]>>>19,ft=O[32]<<13|O[33]>>>19,st=O[42]<<2|O[43]>>>30,tt=O[43]<<2|O[42]>>>30,oe=O[5]<<30|O[4]>>>2,pe=O[4]<<30|O[5]>>>2,Xt=O[14]<<6|O[15]>>>26,Ot=O[15]<<6|O[14]>>>26,Ve=O[25]<<11|O[24]>>>21,ke=O[24]<<11|O[25]>>>21,V=O[34]<<15|O[35]>>>17,C=O[35]<<15|O[34]>>>17,Ht=O[45]<<29|O[44]>>>3,Jt=O[44]<<29|O[45]>>>3,ct=O[6]<<28|O[7]>>>4,Be=O[7]<<28|O[6]>>>4,xe=O[17]<<23|O[16]>>>9,Re=O[16]<<23|O[17]>>>9,Bt=O[26]<<25|O[27]>>>7,Tt=O[27]<<25|O[26]>>>7,ze=O[36]<<21|O[37]>>>11,He=O[37]<<21|O[36]>>>11,Y=O[47]<<24|O[46]>>>8,q=O[46]<<24|O[47]>>>8,$t=O[8]<<27|O[9]>>>5,jt=O[9]<<27|O[8]>>>5,et=O[18]<<20|O[19]>>>12,rt=O[19]<<20|O[18]>>>12,De=O[29]<<7|O[28]>>>25,it=O[28]<<7|O[29]>>>25,vt=O[38]<<8|O[39]>>>24,Dt=O[39]<<8|O[38]>>>24,Ee=O[48]<<14|O[49]>>>18,Qe=O[49]<<14|O[48]>>>18,O[0]=Te^~Ie&Ve,O[1]=$e^~Le&ke,O[10]=ct^~et&Je,O[11]=Be^~rt&pt,O[20]=St^~Xt&Bt,O[21]=er^~Ot&Tt,O[30]=$t^~nt&$,O[31]=jt^~Ft&H,O[40]=oe^~xe&De,O[41]=pe^~Re&it,O[2]=Ie^~Ve&ze,O[3]=Le^~ke&He,O[12]=et^~Je&ht,O[13]=rt^~pt&ft,O[22]=Xt^~Bt&vt,O[23]=Ot^~Tt&Dt,O[32]=nt^~$&V,O[33]=Ft^~H&C,O[42]=xe^~De&Ue,O[43]=Re^~it>,O[4]=Ve^~ze&Ee,O[5]=ke^~He&Qe,O[14]=Je^~ht&Ht,O[15]=pt^~ft&Jt,O[24]=Bt^~vt&Lt,O[25]=Tt^~Dt&bt,O[34]=$^~V&Y,O[35]=H^~C&q,O[44]=De^~Ue&st,O[45]=it^~gt&tt,O[6]=ze^~Ee&Te,O[7]=He^~Qe&$e,O[16]=ht^~Ht&ct,O[17]=ft^~Jt&Be,O[26]=vt^~Lt&St,O[27]=Dt^~bt&er,O[36]=V^~Y&$t,O[37]=C^~q&jt,O[46]=Ue^~st&oe,O[47]=gt^~tt&pe,O[8]=Ee^~Te&Ie,O[9]=Qe^~$e&Le,O[18]=Ht^~ct&et,O[19]=Jt^~Be&rt,O[28]=Lt^~St&Xt,O[29]=bt^~er&Ot,O[38]=Y^~$t&nt,O[39]=q^~jt&Ft,O[48]=st^~oe&xe,O[49]=tt^~pe&Re,O[0]^=N[X],O[1]^=N[X+1]};if(a)t.exports=f;else for(v=0;v{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const Nx=mN();var wm;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(wm||(wm={}));var ps;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(ps||(ps={}));const Lx="0123456789abcdef";class Kr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();vd[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Ox>vd[n])&&console.log.apply(console,r)}debug(...e){this._log(Kr.levels.DEBUG,e)}info(...e){this._log(Kr.levels.INFO,e)}warn(...e){this._log(Kr.levels.WARNING,e)}makeError(e,r,n){if(Dx)return this.makeError("censored error",r,{});r||(r=Kr.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(u=>{const l=n[u];try{if(l instanceof Uint8Array){let d="";for(let p=0;p>4],d+=Lx[l[p]&15];i.push(u+"=Uint8Array(0x"+d+")")}else i.push(u+"="+JSON.stringify(l))}catch{i.push(u+"="+JSON.stringify(n[u].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case ps.NUMERIC_FAULT:{o="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case ps.CALL_EXCEPTION:case ps.INSUFFICIENT_FUNDS:case ps.MISSING_NEW:case ps.NONCE_EXPIRED:case ps.REPLACEMENT_UNDERPRICED:case ps.TRANSACTION_REPLACED:case ps.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(u){a[u]=n[u]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Kr.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){Nx&&this.throwError("platform missing String.prototype.normalize",Kr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Nx})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Kr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Kr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return ym||(ym=new Kr(gN)),ym}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Rx){if(!e)return;this.globalLogger().throwError("error censorship permanent",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Dx=!!e,Rx=!!r}static setLogLevel(e){const r=vd[e.toLowerCase()];if(r==null){Kr.globalLogger().warn("invalid log level - "+e);return}Ox=r}static from(e){return new Kr(e)}}Kr.errors=ps,Kr.levels=wm;const vN="bytes/5.7.0",on=new Kr(vN);function kx(t){return!!t.toHexString}function uu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return uu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function bN(t){return Ns(t)&&!(t.length%2)||xm(t)}function Bx(t){return typeof t=="number"&&t==t&&t%1===0}function xm(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!Bx(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function bn(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),uu(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t)&&(t=t.toHexString()),Ns(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":on.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ibn(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),uu(n)}function wN(t,e){t=bn(t),t.length>e&&on.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),uu(r)}function Ns(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const _m="0123456789abcdef";function Ii(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=_m[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t))return t.toHexString();if(Ns(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":on.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(xm(t)){let r="0x";for(let n=0;n>4]+_m[i&15]}return r}return on.throwArgumentError("invalid hexlify value","value",t)}function xN(t){if(typeof t!="string")t=Ii(t);else if(!Ns(t)||t.length%2)return null;return(t.length-2)/2}function $x(t,e,r){return typeof t!="string"?t=Ii(t):(!Ns(t)||t.length%2)&&on.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function fu(t,e){for(typeof t!="string"?t=Ii(t):Ns(t)||on.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&on.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Fx(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(bN(t)){let r=bn(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64))):r.length===65?(e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64)),e.v=r[64]):on.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:on.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Ii(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=wN(bn(e._vs),32);e._vs=Ii(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&on.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=Ii(i);e.s==null?e.s=o:e.s!==o&&on.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?on.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&on.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Ns(e.r)?on.throwArgumentError("signature missing or invalid r","signature",t):e.r=fu(e.r,32),e.s==null||!Ns(e.s)?on.throwArgumentError("signature missing or invalid s","signature",t):e.s=fu(e.s,32);const r=bn(e.s);r[0]>=128&&on.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=Ii(r);e._vs&&(Ns(e._vs)||on.throwArgumentError("signature invalid _vs","signature",t),e._vs=fu(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&on.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Em(t){return"0x"+pN.keccak_256(bn(t))}var Sm={exports:{}};Sm.exports,function(t){(function(e,r){function n(m,f){if(!m)throw new Error(f||"Assertion failed")}function i(m,f){m.super_=f;var g=function(){};g.prototype=f.prototype,m.prototype=new g,m.prototype.constructor=m}function s(m,f,g){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((f==="le"||f==="be")&&(g=f,f=10),this._init(m||0,f||10,g||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,g){return f.cmp(g)>0?f:g},s.min=function(f,g){return f.cmp(g)<0?f:g},s.prototype._init=function(f,g,v){if(typeof f=="number")return this._initNumber(f,g,v);if(typeof f=="object")return this._initArray(f,g,v);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),f=f.toString().replace(/\s+/g,"");var x=0;f[0]==="-"&&(x++,this.negative=1),x=0;x-=3)S=f[x]|f[x-1]<<8|f[x-2]<<16,this.words[_]|=S<>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);else if(v==="le")for(x=0,_=0;x>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);return this._strip()};function a(m,f){var g=m.charCodeAt(f);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+m)}function u(m,f,g){var v=a(m,g);return g-1>=f&&(v|=a(m,g-1)<<4),v}s.prototype._parseHex=function(f,g,v){this.length=Math.ceil((f.length-g)/6),this.words=new Array(this.length);for(var x=0;x=g;x-=2)b=u(f,g,x)<<_,this.words[S]|=b&67108863,_>=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8;else{var M=f.length-g;for(x=M%2===0?g+1:g;x=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8}this._strip()};function l(m,f,g,v){for(var x=0,_=0,S=Math.min(m.length,g),b=f;b=49?_=M-49+10:M>=17?_=M-17+10:_=M,n(M>=0&&_1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{s.prototype.inspect=p}else s.prototype.inspect=p;function p(){return(this.red?""}var y=["","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"],A=[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,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(f,g){f=f||10,g=g|0||1;var v;if(f===16||f==="hex"){v="";for(var x=0,_=0,S=0;S>>24-x&16777215,x+=2,x>=26&&(x-=26,S--),_!==0||S!==this.length-1?v=y[6-M.length]+M+v:v=M+v}for(_!==0&&(v=_.toString(16)+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(f===(f|0)&&f>=2&&f<=36){var I=A[f],F=P[f];v="";var ae=this.clone();for(ae.negative=0;!ae.isZero();){var O=ae.modrn(F).toString(f);ae=ae.idivn(F),ae.isZero()?v=O+v:v=y[I-O.length]+O+v}for(this.isZero()&&(v="0"+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,g){return this.toArrayLike(o,f,g)}),s.prototype.toArray=function(f,g){return this.toArrayLike(Array,f,g)};var N=function(f,g){return f.allocUnsafe?f.allocUnsafe(g):new f(g)};s.prototype.toArrayLike=function(f,g,v){this._strip();var x=this.byteLength(),_=v||Math.max(1,x);n(x<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var S=N(f,_),b=g==="le"?"LE":"BE";return this["_toArrayLike"+b](S,x),S},s.prototype._toArrayLikeLE=function(f,g){for(var v=0,x=0,_=0,S=0;_>8&255),v>16&255),S===6?(v>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v=0&&(f[v--]=b>>8&255),v>=0&&(f[v--]=b>>16&255),S===6?(v>=0&&(f[v--]=b>>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v>=0)for(f[v--]=x;v>=0;)f[v--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var g=f,v=0;return g>=4096&&(v+=13,g>>>=13),g>=64&&(v+=7,g>>>=7),g>=8&&(v+=4,g>>>=4),g>=2&&(v+=2,g>>>=2),v+g},s.prototype._zeroBits=function(f){if(f===0)return 26;var g=f,v=0;return g&8191||(v+=13,g>>>=13),g&127||(v+=7,g>>>=7),g&15||(v+=4,g>>>=4),g&3||(v+=2,g>>>=2),g&1||v++,v},s.prototype.bitLength=function(){var f=this.words[this.length-1],g=this._countBits(f);return(this.length-1)*26+g};function D(m){for(var f=new Array(m.bitLength()),g=0;g>>x&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,g=0;gf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var g;this.length>f.length?g=f:g=this;for(var v=0;vf.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var g,v;this.length>f.length?(g=this,v=f):(g=f,v=this);for(var x=0;xf.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var g=Math.ceil(f/26)|0,v=f%26;this._expand(g),v>0&&g--;for(var x=0;x0&&(this.words[x]=~this.words[x]&67108863>>26-v),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,g){n(typeof f=="number"&&f>=0);var v=f/26|0,x=f%26;return this._expand(v+1),g?this.words[v]=this.words[v]|1<f.length?(v=this,x=f):(v=f,x=this);for(var _=0,S=0;S>>26;for(;_!==0&&S>>26;if(this.length=v.length,_!==0)this.words[this.length]=_,this.length++;else if(v!==this)for(;Sf.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var g=this.iadd(f);return f.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var v=this.cmp(f);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,_;v>0?(x=this,_=f):(x=f,_=this);for(var S=0,b=0;b<_.length;b++)g=(x.words[b]|0)-(_.words[b]|0)+S,S=g>>26,this.words[b]=g&67108863;for(;S!==0&&b>26,this.words[b]=g&67108863;if(S===0&&b>>26,ae=M&67108863,O=Math.min(I,f.length-1),se=Math.max(0,I-m.length+1);se<=O;se++){var ee=I-se|0;x=m.words[ee]|0,_=f.words[se]|0,S=x*_+ae,F+=S/67108864|0,ae=S&67108863}g.words[I]=ae|0,M=F|0}return M!==0?g.words[I]=M|0:g.length--,g._strip()}var B=function(f,g,v){var x=f.words,_=g.words,S=v.words,b=0,M,I,F,ae=x[0]|0,O=ae&8191,se=ae>>>13,ee=x[1]|0,X=ee&8191,Q=ee>>>13,R=x[2]|0,Z=R&8191,te=R>>>13,le=x[3]|0,ie=le&8191,fe=le>>>13,ve=x[4]|0,Me=ve&8191,Ne=ve>>>13,Te=x[5]|0,$e=Te&8191,Ie=Te>>>13,Le=x[6]|0,Ve=Le&8191,ke=Le>>>13,ze=x[7]|0,He=ze&8191,Ee=ze>>>13,Qe=x[8]|0,ct=Qe&8191,Be=Qe>>>13,et=x[9]|0,rt=et&8191,Je=et>>>13,pt=_[0]|0,ht=pt&8191,ft=pt>>>13,Ht=_[1]|0,Jt=Ht&8191,St=Ht>>>13,er=_[2]|0,Xt=er&8191,Ot=er>>>13,Bt=_[3]|0,Tt=Bt&8191,vt=Bt>>>13,Dt=_[4]|0,Lt=Dt&8191,bt=Dt>>>13,$t=_[5]|0,jt=$t&8191,nt=$t>>>13,Ft=_[6]|0,$=Ft&8191,H=Ft>>>13,V=_[7]|0,C=V&8191,Y=V>>>13,q=_[8]|0,oe=q&8191,pe=q>>>13,xe=_[9]|0,Re=xe&8191,De=xe>>>13;v.negative=f.negative^g.negative,v.length=19,M=Math.imul(O,ht),I=Math.imul(O,ft),I=I+Math.imul(se,ht)|0,F=Math.imul(se,ft);var it=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(it>>>26)|0,it&=67108863,M=Math.imul(X,ht),I=Math.imul(X,ft),I=I+Math.imul(Q,ht)|0,F=Math.imul(Q,ft),M=M+Math.imul(O,Jt)|0,I=I+Math.imul(O,St)|0,I=I+Math.imul(se,Jt)|0,F=F+Math.imul(se,St)|0;var Ue=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,M=Math.imul(Z,ht),I=Math.imul(Z,ft),I=I+Math.imul(te,ht)|0,F=Math.imul(te,ft),M=M+Math.imul(X,Jt)|0,I=I+Math.imul(X,St)|0,I=I+Math.imul(Q,Jt)|0,F=F+Math.imul(Q,St)|0,M=M+Math.imul(O,Xt)|0,I=I+Math.imul(O,Ot)|0,I=I+Math.imul(se,Xt)|0,F=F+Math.imul(se,Ot)|0;var gt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(gt>>>26)|0,gt&=67108863,M=Math.imul(ie,ht),I=Math.imul(ie,ft),I=I+Math.imul(fe,ht)|0,F=Math.imul(fe,ft),M=M+Math.imul(Z,Jt)|0,I=I+Math.imul(Z,St)|0,I=I+Math.imul(te,Jt)|0,F=F+Math.imul(te,St)|0,M=M+Math.imul(X,Xt)|0,I=I+Math.imul(X,Ot)|0,I=I+Math.imul(Q,Xt)|0,F=F+Math.imul(Q,Ot)|0,M=M+Math.imul(O,Tt)|0,I=I+Math.imul(O,vt)|0,I=I+Math.imul(se,Tt)|0,F=F+Math.imul(se,vt)|0;var st=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(st>>>26)|0,st&=67108863,M=Math.imul(Me,ht),I=Math.imul(Me,ft),I=I+Math.imul(Ne,ht)|0,F=Math.imul(Ne,ft),M=M+Math.imul(ie,Jt)|0,I=I+Math.imul(ie,St)|0,I=I+Math.imul(fe,Jt)|0,F=F+Math.imul(fe,St)|0,M=M+Math.imul(Z,Xt)|0,I=I+Math.imul(Z,Ot)|0,I=I+Math.imul(te,Xt)|0,F=F+Math.imul(te,Ot)|0,M=M+Math.imul(X,Tt)|0,I=I+Math.imul(X,vt)|0,I=I+Math.imul(Q,Tt)|0,F=F+Math.imul(Q,vt)|0,M=M+Math.imul(O,Lt)|0,I=I+Math.imul(O,bt)|0,I=I+Math.imul(se,Lt)|0,F=F+Math.imul(se,bt)|0;var tt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(tt>>>26)|0,tt&=67108863,M=Math.imul($e,ht),I=Math.imul($e,ft),I=I+Math.imul(Ie,ht)|0,F=Math.imul(Ie,ft),M=M+Math.imul(Me,Jt)|0,I=I+Math.imul(Me,St)|0,I=I+Math.imul(Ne,Jt)|0,F=F+Math.imul(Ne,St)|0,M=M+Math.imul(ie,Xt)|0,I=I+Math.imul(ie,Ot)|0,I=I+Math.imul(fe,Xt)|0,F=F+Math.imul(fe,Ot)|0,M=M+Math.imul(Z,Tt)|0,I=I+Math.imul(Z,vt)|0,I=I+Math.imul(te,Tt)|0,F=F+Math.imul(te,vt)|0,M=M+Math.imul(X,Lt)|0,I=I+Math.imul(X,bt)|0,I=I+Math.imul(Q,Lt)|0,F=F+Math.imul(Q,bt)|0,M=M+Math.imul(O,jt)|0,I=I+Math.imul(O,nt)|0,I=I+Math.imul(se,jt)|0,F=F+Math.imul(se,nt)|0;var At=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(At>>>26)|0,At&=67108863,M=Math.imul(Ve,ht),I=Math.imul(Ve,ft),I=I+Math.imul(ke,ht)|0,F=Math.imul(ke,ft),M=M+Math.imul($e,Jt)|0,I=I+Math.imul($e,St)|0,I=I+Math.imul(Ie,Jt)|0,F=F+Math.imul(Ie,St)|0,M=M+Math.imul(Me,Xt)|0,I=I+Math.imul(Me,Ot)|0,I=I+Math.imul(Ne,Xt)|0,F=F+Math.imul(Ne,Ot)|0,M=M+Math.imul(ie,Tt)|0,I=I+Math.imul(ie,vt)|0,I=I+Math.imul(fe,Tt)|0,F=F+Math.imul(fe,vt)|0,M=M+Math.imul(Z,Lt)|0,I=I+Math.imul(Z,bt)|0,I=I+Math.imul(te,Lt)|0,F=F+Math.imul(te,bt)|0,M=M+Math.imul(X,jt)|0,I=I+Math.imul(X,nt)|0,I=I+Math.imul(Q,jt)|0,F=F+Math.imul(Q,nt)|0,M=M+Math.imul(O,$)|0,I=I+Math.imul(O,H)|0,I=I+Math.imul(se,$)|0,F=F+Math.imul(se,H)|0;var Rt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,M=Math.imul(He,ht),I=Math.imul(He,ft),I=I+Math.imul(Ee,ht)|0,F=Math.imul(Ee,ft),M=M+Math.imul(Ve,Jt)|0,I=I+Math.imul(Ve,St)|0,I=I+Math.imul(ke,Jt)|0,F=F+Math.imul(ke,St)|0,M=M+Math.imul($e,Xt)|0,I=I+Math.imul($e,Ot)|0,I=I+Math.imul(Ie,Xt)|0,F=F+Math.imul(Ie,Ot)|0,M=M+Math.imul(Me,Tt)|0,I=I+Math.imul(Me,vt)|0,I=I+Math.imul(Ne,Tt)|0,F=F+Math.imul(Ne,vt)|0,M=M+Math.imul(ie,Lt)|0,I=I+Math.imul(ie,bt)|0,I=I+Math.imul(fe,Lt)|0,F=F+Math.imul(fe,bt)|0,M=M+Math.imul(Z,jt)|0,I=I+Math.imul(Z,nt)|0,I=I+Math.imul(te,jt)|0,F=F+Math.imul(te,nt)|0,M=M+Math.imul(X,$)|0,I=I+Math.imul(X,H)|0,I=I+Math.imul(Q,$)|0,F=F+Math.imul(Q,H)|0,M=M+Math.imul(O,C)|0,I=I+Math.imul(O,Y)|0,I=I+Math.imul(se,C)|0,F=F+Math.imul(se,Y)|0;var Mt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,M=Math.imul(ct,ht),I=Math.imul(ct,ft),I=I+Math.imul(Be,ht)|0,F=Math.imul(Be,ft),M=M+Math.imul(He,Jt)|0,I=I+Math.imul(He,St)|0,I=I+Math.imul(Ee,Jt)|0,F=F+Math.imul(Ee,St)|0,M=M+Math.imul(Ve,Xt)|0,I=I+Math.imul(Ve,Ot)|0,I=I+Math.imul(ke,Xt)|0,F=F+Math.imul(ke,Ot)|0,M=M+Math.imul($e,Tt)|0,I=I+Math.imul($e,vt)|0,I=I+Math.imul(Ie,Tt)|0,F=F+Math.imul(Ie,vt)|0,M=M+Math.imul(Me,Lt)|0,I=I+Math.imul(Me,bt)|0,I=I+Math.imul(Ne,Lt)|0,F=F+Math.imul(Ne,bt)|0,M=M+Math.imul(ie,jt)|0,I=I+Math.imul(ie,nt)|0,I=I+Math.imul(fe,jt)|0,F=F+Math.imul(fe,nt)|0,M=M+Math.imul(Z,$)|0,I=I+Math.imul(Z,H)|0,I=I+Math.imul(te,$)|0,F=F+Math.imul(te,H)|0,M=M+Math.imul(X,C)|0,I=I+Math.imul(X,Y)|0,I=I+Math.imul(Q,C)|0,F=F+Math.imul(Q,Y)|0,M=M+Math.imul(O,oe)|0,I=I+Math.imul(O,pe)|0,I=I+Math.imul(se,oe)|0,F=F+Math.imul(se,pe)|0;var Et=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Et>>>26)|0,Et&=67108863,M=Math.imul(rt,ht),I=Math.imul(rt,ft),I=I+Math.imul(Je,ht)|0,F=Math.imul(Je,ft),M=M+Math.imul(ct,Jt)|0,I=I+Math.imul(ct,St)|0,I=I+Math.imul(Be,Jt)|0,F=F+Math.imul(Be,St)|0,M=M+Math.imul(He,Xt)|0,I=I+Math.imul(He,Ot)|0,I=I+Math.imul(Ee,Xt)|0,F=F+Math.imul(Ee,Ot)|0,M=M+Math.imul(Ve,Tt)|0,I=I+Math.imul(Ve,vt)|0,I=I+Math.imul(ke,Tt)|0,F=F+Math.imul(ke,vt)|0,M=M+Math.imul($e,Lt)|0,I=I+Math.imul($e,bt)|0,I=I+Math.imul(Ie,Lt)|0,F=F+Math.imul(Ie,bt)|0,M=M+Math.imul(Me,jt)|0,I=I+Math.imul(Me,nt)|0,I=I+Math.imul(Ne,jt)|0,F=F+Math.imul(Ne,nt)|0,M=M+Math.imul(ie,$)|0,I=I+Math.imul(ie,H)|0,I=I+Math.imul(fe,$)|0,F=F+Math.imul(fe,H)|0,M=M+Math.imul(Z,C)|0,I=I+Math.imul(Z,Y)|0,I=I+Math.imul(te,C)|0,F=F+Math.imul(te,Y)|0,M=M+Math.imul(X,oe)|0,I=I+Math.imul(X,pe)|0,I=I+Math.imul(Q,oe)|0,F=F+Math.imul(Q,pe)|0,M=M+Math.imul(O,Re)|0,I=I+Math.imul(O,De)|0,I=I+Math.imul(se,Re)|0,F=F+Math.imul(se,De)|0;var dt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(dt>>>26)|0,dt&=67108863,M=Math.imul(rt,Jt),I=Math.imul(rt,St),I=I+Math.imul(Je,Jt)|0,F=Math.imul(Je,St),M=M+Math.imul(ct,Xt)|0,I=I+Math.imul(ct,Ot)|0,I=I+Math.imul(Be,Xt)|0,F=F+Math.imul(Be,Ot)|0,M=M+Math.imul(He,Tt)|0,I=I+Math.imul(He,vt)|0,I=I+Math.imul(Ee,Tt)|0,F=F+Math.imul(Ee,vt)|0,M=M+Math.imul(Ve,Lt)|0,I=I+Math.imul(Ve,bt)|0,I=I+Math.imul(ke,Lt)|0,F=F+Math.imul(ke,bt)|0,M=M+Math.imul($e,jt)|0,I=I+Math.imul($e,nt)|0,I=I+Math.imul(Ie,jt)|0,F=F+Math.imul(Ie,nt)|0,M=M+Math.imul(Me,$)|0,I=I+Math.imul(Me,H)|0,I=I+Math.imul(Ne,$)|0,F=F+Math.imul(Ne,H)|0,M=M+Math.imul(ie,C)|0,I=I+Math.imul(ie,Y)|0,I=I+Math.imul(fe,C)|0,F=F+Math.imul(fe,Y)|0,M=M+Math.imul(Z,oe)|0,I=I+Math.imul(Z,pe)|0,I=I+Math.imul(te,oe)|0,F=F+Math.imul(te,pe)|0,M=M+Math.imul(X,Re)|0,I=I+Math.imul(X,De)|0,I=I+Math.imul(Q,Re)|0,F=F+Math.imul(Q,De)|0;var _t=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(_t>>>26)|0,_t&=67108863,M=Math.imul(rt,Xt),I=Math.imul(rt,Ot),I=I+Math.imul(Je,Xt)|0,F=Math.imul(Je,Ot),M=M+Math.imul(ct,Tt)|0,I=I+Math.imul(ct,vt)|0,I=I+Math.imul(Be,Tt)|0,F=F+Math.imul(Be,vt)|0,M=M+Math.imul(He,Lt)|0,I=I+Math.imul(He,bt)|0,I=I+Math.imul(Ee,Lt)|0,F=F+Math.imul(Ee,bt)|0,M=M+Math.imul(Ve,jt)|0,I=I+Math.imul(Ve,nt)|0,I=I+Math.imul(ke,jt)|0,F=F+Math.imul(ke,nt)|0,M=M+Math.imul($e,$)|0,I=I+Math.imul($e,H)|0,I=I+Math.imul(Ie,$)|0,F=F+Math.imul(Ie,H)|0,M=M+Math.imul(Me,C)|0,I=I+Math.imul(Me,Y)|0,I=I+Math.imul(Ne,C)|0,F=F+Math.imul(Ne,Y)|0,M=M+Math.imul(ie,oe)|0,I=I+Math.imul(ie,pe)|0,I=I+Math.imul(fe,oe)|0,F=F+Math.imul(fe,pe)|0,M=M+Math.imul(Z,Re)|0,I=I+Math.imul(Z,De)|0,I=I+Math.imul(te,Re)|0,F=F+Math.imul(te,De)|0;var ot=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(ot>>>26)|0,ot&=67108863,M=Math.imul(rt,Tt),I=Math.imul(rt,vt),I=I+Math.imul(Je,Tt)|0,F=Math.imul(Je,vt),M=M+Math.imul(ct,Lt)|0,I=I+Math.imul(ct,bt)|0,I=I+Math.imul(Be,Lt)|0,F=F+Math.imul(Be,bt)|0,M=M+Math.imul(He,jt)|0,I=I+Math.imul(He,nt)|0,I=I+Math.imul(Ee,jt)|0,F=F+Math.imul(Ee,nt)|0,M=M+Math.imul(Ve,$)|0,I=I+Math.imul(Ve,H)|0,I=I+Math.imul(ke,$)|0,F=F+Math.imul(ke,H)|0,M=M+Math.imul($e,C)|0,I=I+Math.imul($e,Y)|0,I=I+Math.imul(Ie,C)|0,F=F+Math.imul(Ie,Y)|0,M=M+Math.imul(Me,oe)|0,I=I+Math.imul(Me,pe)|0,I=I+Math.imul(Ne,oe)|0,F=F+Math.imul(Ne,pe)|0,M=M+Math.imul(ie,Re)|0,I=I+Math.imul(ie,De)|0,I=I+Math.imul(fe,Re)|0,F=F+Math.imul(fe,De)|0;var wt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(wt>>>26)|0,wt&=67108863,M=Math.imul(rt,Lt),I=Math.imul(rt,bt),I=I+Math.imul(Je,Lt)|0,F=Math.imul(Je,bt),M=M+Math.imul(ct,jt)|0,I=I+Math.imul(ct,nt)|0,I=I+Math.imul(Be,jt)|0,F=F+Math.imul(Be,nt)|0,M=M+Math.imul(He,$)|0,I=I+Math.imul(He,H)|0,I=I+Math.imul(Ee,$)|0,F=F+Math.imul(Ee,H)|0,M=M+Math.imul(Ve,C)|0,I=I+Math.imul(Ve,Y)|0,I=I+Math.imul(ke,C)|0,F=F+Math.imul(ke,Y)|0,M=M+Math.imul($e,oe)|0,I=I+Math.imul($e,pe)|0,I=I+Math.imul(Ie,oe)|0,F=F+Math.imul(Ie,pe)|0,M=M+Math.imul(Me,Re)|0,I=I+Math.imul(Me,De)|0,I=I+Math.imul(Ne,Re)|0,F=F+Math.imul(Ne,De)|0;var lt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(lt>>>26)|0,lt&=67108863,M=Math.imul(rt,jt),I=Math.imul(rt,nt),I=I+Math.imul(Je,jt)|0,F=Math.imul(Je,nt),M=M+Math.imul(ct,$)|0,I=I+Math.imul(ct,H)|0,I=I+Math.imul(Be,$)|0,F=F+Math.imul(Be,H)|0,M=M+Math.imul(He,C)|0,I=I+Math.imul(He,Y)|0,I=I+Math.imul(Ee,C)|0,F=F+Math.imul(Ee,Y)|0,M=M+Math.imul(Ve,oe)|0,I=I+Math.imul(Ve,pe)|0,I=I+Math.imul(ke,oe)|0,F=F+Math.imul(ke,pe)|0,M=M+Math.imul($e,Re)|0,I=I+Math.imul($e,De)|0,I=I+Math.imul(Ie,Re)|0,F=F+Math.imul(Ie,De)|0;var at=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(at>>>26)|0,at&=67108863,M=Math.imul(rt,$),I=Math.imul(rt,H),I=I+Math.imul(Je,$)|0,F=Math.imul(Je,H),M=M+Math.imul(ct,C)|0,I=I+Math.imul(ct,Y)|0,I=I+Math.imul(Be,C)|0,F=F+Math.imul(Be,Y)|0,M=M+Math.imul(He,oe)|0,I=I+Math.imul(He,pe)|0,I=I+Math.imul(Ee,oe)|0,F=F+Math.imul(Ee,pe)|0,M=M+Math.imul(Ve,Re)|0,I=I+Math.imul(Ve,De)|0,I=I+Math.imul(ke,Re)|0,F=F+Math.imul(ke,De)|0;var Ae=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,M=Math.imul(rt,C),I=Math.imul(rt,Y),I=I+Math.imul(Je,C)|0,F=Math.imul(Je,Y),M=M+Math.imul(ct,oe)|0,I=I+Math.imul(ct,pe)|0,I=I+Math.imul(Be,oe)|0,F=F+Math.imul(Be,pe)|0,M=M+Math.imul(He,Re)|0,I=I+Math.imul(He,De)|0,I=I+Math.imul(Ee,Re)|0,F=F+Math.imul(Ee,De)|0;var Pe=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,M=Math.imul(rt,oe),I=Math.imul(rt,pe),I=I+Math.imul(Je,oe)|0,F=Math.imul(Je,pe),M=M+Math.imul(ct,Re)|0,I=I+Math.imul(ct,De)|0,I=I+Math.imul(Be,Re)|0,F=F+Math.imul(Be,De)|0;var Ge=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,M=Math.imul(rt,Re),I=Math.imul(rt,De),I=I+Math.imul(Je,Re)|0,F=Math.imul(Je,De);var je=(b+M|0)+((I&8191)<<13)|0;return b=(F+(I>>>13)|0)+(je>>>26)|0,je&=67108863,S[0]=it,S[1]=Ue,S[2]=gt,S[3]=st,S[4]=tt,S[5]=At,S[6]=Rt,S[7]=Mt,S[8]=Et,S[9]=dt,S[10]=_t,S[11]=ot,S[12]=wt,S[13]=lt,S[14]=at,S[15]=Ae,S[16]=Pe,S[17]=Ge,S[18]=je,b!==0&&(S[19]=b,v.length++),v};Math.imul||(B=k);function j(m,f,g){g.negative=f.negative^m.negative,g.length=m.length+f.length;for(var v=0,x=0,_=0;_>>26)|0,x+=S>>>26,S&=67108863}g.words[_]=b,v=S,S=x}return v!==0?g.words[_]=v:g.length--,g._strip()}function U(m,f,g){return j(m,f,g)}s.prototype.mulTo=function(f,g){var v,x=this.length+f.length;return this.length===10&&f.length===10?v=B(this,f,g):x<63?v=k(this,f,g):x<1024?v=j(this,f,g):v=U(this,f,g),v},s.prototype.mul=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),this.mulTo(f,g)},s.prototype.mulf=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),U(this,f,g)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var g=f<0;g&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var v=0,x=0;x>=26,v+=_/67108864|0,v+=S>>>26,this.words[x]=S&67108863}return v!==0&&(this.words[x]=v,this.length++),g?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var g=D(f);if(g.length===0)return new s(1);for(var v=this,x=0;x=0);var g=f%26,v=(f-g)/26,x=67108863>>>26-g<<26-g,_;if(g!==0){var S=0;for(_=0;_>>26-g}S&&(this.words[_]=S,this.length++)}if(v!==0){for(_=this.length-1;_>=0;_--)this.words[_+v]=this.words[_];for(_=0;_=0);var x;g?x=(g-g%26)/26:x=0;var _=f%26,S=Math.min((f-_)/26,this.length),b=67108863^67108863>>>_<<_,M=v;if(x-=S,x=Math.max(0,x),M){for(var I=0;IS)for(this.length-=S,I=0;I=0&&(F!==0||I>=x);I--){var ae=this.words[I]|0;this.words[I]=F<<26-_|ae>>>_,F=ae&b}return M&&F!==0&&(M.words[M.length++]=F),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,g,v){return n(this.negative===0),this.iushrn(f,g,v)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var g=f%26,v=(f-g)/26,x=1<=0);var g=f%26,v=(f-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(g!==0&&v++,this.length=Math.min(v,this.length),g!==0){var x=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(M/67108864|0),this.words[_+v]=S&67108863}for(;_>26,this.words[_+v]=S&67108863;if(b===0)return this._strip();for(n(b===-1),b=0,_=0;_>26,this.words[_]=S&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,g){var v=this.length-f.length,x=this.clone(),_=f,S=_.words[_.length-1]|0,b=this._countBits(S);v=26-b,v!==0&&(_=_.ushln(v),x.iushln(v),S=_.words[_.length-1]|0);var M=x.length-_.length,I;if(g!=="mod"){I=new s(null),I.length=M+1,I.words=new Array(I.length);for(var F=0;F=0;O--){var se=(x.words[_.length+O]|0)*67108864+(x.words[_.length+O-1]|0);for(se=Math.min(se/S|0,67108863),x._ishlnsubmul(_,se,O);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(_,1,O),x.isZero()||(x.negative^=1);I&&(I.words[O]=se)}return I&&I._strip(),x._strip(),g!=="div"&&v!==0&&x.iushrn(v),{div:I||null,mod:x}},s.prototype.divmod=function(f,g,v){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,_,S;return this.negative!==0&&f.negative===0?(S=this.neg().divmod(f,g),g!=="mod"&&(x=S.div.neg()),g!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.iadd(f)),{div:x,mod:_}):this.negative===0&&f.negative!==0?(S=this.divmod(f.neg(),g),g!=="mod"&&(x=S.div.neg()),{div:x,mod:S.mod}):this.negative&f.negative?(S=this.neg().divmod(f.neg(),g),g!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.isub(f)),{div:S.div,mod:_}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?g==="div"?{div:this.divn(f.words[0]),mod:null}:g==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,g)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var g=this.divmod(f);if(g.mod.isZero())return g.div;var v=g.div.negative!==0?g.mod.isub(f):g.mod,x=f.ushrn(1),_=f.andln(1),S=v.cmp(x);return S<0||_===1&&S===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},s.prototype.modrn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=(1<<26)%f,x=0,_=this.length-1;_>=0;_--)x=(v*x+(this.words[_]|0))%f;return g?-x:x},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=0,x=this.length-1;x>=0;x--){var _=(this.words[x]|0)+v*67108864;this.words[x]=_/f|0,v=_%f}return this._strip(),g?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),_=new s(0),S=new s(0),b=new s(1),M=0;g.isEven()&&v.isEven();)g.iushrn(1),v.iushrn(1),++M;for(var I=v.clone(),F=g.clone();!g.isZero();){for(var ae=0,O=1;!(g.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(g.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(I),_.isub(F)),x.iushrn(1),_.iushrn(1);for(var se=0,ee=1;!(v.words[0]&ee)&&se<26;++se,ee<<=1);if(se>0)for(v.iushrn(se);se-- >0;)(S.isOdd()||b.isOdd())&&(S.iadd(I),b.isub(F)),S.iushrn(1),b.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(S),_.isub(b)):(v.isub(g),S.isub(x),b.isub(_))}return{a:S,b,gcd:v.iushln(M)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),_=new s(0),S=v.clone();g.cmpn(1)>0&&v.cmpn(1)>0;){for(var b=0,M=1;!(g.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(g.iushrn(b);b-- >0;)x.isOdd()&&x.iadd(S),x.iushrn(1);for(var I=0,F=1;!(v.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(v.iushrn(I);I-- >0;)_.isOdd()&&_.iadd(S),_.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(_)):(v.isub(g),_.isub(x))}var ae;return g.cmpn(1)===0?ae=x:ae=_,ae.cmpn(0)<0&&ae.iadd(f),ae},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var g=this.clone(),v=f.clone();g.negative=0,v.negative=0;for(var x=0;g.isEven()&&v.isEven();x++)g.iushrn(1),v.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;v.isEven();)v.iushrn(1);var _=g.cmp(v);if(_<0){var S=g;g=v,v=S}else if(_===0||v.cmpn(1)===0)break;g.isub(v)}while(!0);return v.iushln(x)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var g=f%26,v=(f-g)/26,x=1<>>26,b&=67108863,this.words[S]=b}return _!==0&&(this.words[S]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var g=f<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var v;if(this.length>1)v=1;else{g&&(f=-f),n(f<=67108863,"Number is too big");var x=this.words[0]|0;v=x===f?0:xf.length)return 1;if(this.length=0;v--){var x=this.words[v]|0,_=f.words[v]|0;if(x!==_){x<_?g=-1:x>_&&(g=1);break}}return g},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new G(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var K={k256:null,p224:null,p192:null,p25519:null};function J(m,f){this.name=m,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}J.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},J.prototype.ireduce=function(f){var g=f,v;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),v=g.bitLength();while(v>this.n);var x=v0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},J.prototype.split=function(f,g){f.iushrn(this.n,0,g)},J.prototype.imulK=function(f){return f.imul(this.k)};function T(){J.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(T,J),T.prototype.split=function(f,g){for(var v=4194303,x=Math.min(f.length,9),_=0;_>>22,S=b}S>>>=22,f.words[_-10]=S,S===0&&f.length>10?f.length-=10:f.length-=9},T.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var g=0,v=0;v>>=26,f.words[v]=_,g=x}return g!==0&&(f.words[f.length++]=g),f},s._prime=function(f){if(K[f])return K[f];var g;if(f==="k256")g=new T;else if(f==="p224")g=new z;else if(f==="p192")g=new ue;else if(f==="p25519")g=new _e;else throw new Error("Unknown prime "+f);return K[f]=g,g};function G(m){if(typeof m=="string"){var f=s._prime(m);this.m=f.p,this.prime=f}else n(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}G.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},G.prototype._verify2=function(f,g){n((f.negative|g.negative)===0,"red works only with positives"),n(f.red&&f.red===g.red,"red works only with red numbers")},G.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(d(f,f.umod(this.m)._forceRed(this)),f)},G.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},G.prototype.add=function(f,g){this._verify2(f,g);var v=f.add(g);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},G.prototype.iadd=function(f,g){this._verify2(f,g);var v=f.iadd(g);return v.cmp(this.m)>=0&&v.isub(this.m),v},G.prototype.sub=function(f,g){this._verify2(f,g);var v=f.sub(g);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},G.prototype.isub=function(f,g){this._verify2(f,g);var v=f.isub(g);return v.cmpn(0)<0&&v.iadd(this.m),v},G.prototype.shl=function(f,g){return this._verify1(f),this.imod(f.ushln(g))},G.prototype.imul=function(f,g){return this._verify2(f,g),this.imod(f.imul(g))},G.prototype.mul=function(f,g){return this._verify2(f,g),this.imod(f.mul(g))},G.prototype.isqr=function(f){return this.imul(f,f.clone())},G.prototype.sqr=function(f){return this.mul(f,f)},G.prototype.sqrt=function(f){if(f.isZero())return f.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(f,v)}for(var x=this.m.subn(1),_=0;!x.isZero()&&x.andln(1)===0;)_++,x.iushrn(1);n(!x.isZero());var S=new s(1).toRed(this),b=S.redNeg(),M=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,M).cmp(b)!==0;)I.redIAdd(b);for(var F=this.pow(I,x),ae=this.pow(f,x.addn(1).iushrn(1)),O=this.pow(f,x),se=_;O.cmp(S)!==0;){for(var ee=O,X=0;ee.cmp(S)!==0;X++)ee=ee.redSqr();n(X=0;_--){for(var F=g.words[_],ae=I-1;ae>=0;ae--){var O=F>>ae&1;if(S!==x[0]&&(S=this.sqr(S)),O===0&&b===0){M=0;continue}b<<=1,b|=O,M++,!(M!==v&&(_!==0||ae!==0))&&(S=this.mul(S,x[b]),M=0,b=0)}I=26}return S},G.prototype.convertTo=function(f){var g=f.umod(this.m);return g===f?g.clone():g},G.prototype.convertFrom=function(f){var g=f.clone();return g.red=null,g},s.mont=function(f){return new E(f)};function E(m){G.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(E,G),E.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},E.prototype.convertFrom=function(f){var g=this.imod(f.mul(this.rinv));return g.red=null,g},E.prototype.imul=function(f,g){if(f.isZero()||g.isZero())return f.words[0]=0,f.length=1,f;var v=f.imul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.mul=function(f,g){if(f.isZero()||g.isZero())return new s(0)._forceRed(this);var v=f.mul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.invm=function(f){var g=this.imod(f._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,nn)}(Sm);var _N=Sm.exports;const rr=ji(_N);var EN=rr.BN;function SN(t){return new EN(t,36).toString(16)}const AN="strings/5.7.0",PN=new Kr(AN);var bd;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(bd||(bd={}));var jx;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(jx||(jx={}));function Am(t,e=bd.current){e!=bd.current&&(PN.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return bn(r)}const MN=`Ethereum Signed Message: +`;function Ux(t){return typeof t=="string"&&(t=Am(t)),Em(yN([Am(MN),Am(String(t.length)),t]))}const IN="address/5.7.0",sl=new Kr(IN);function qx(t){Ns(t,20)||sl.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=bn(Em(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const CN=9007199254740991;function TN(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const Pm={};for(let t=0;t<10;t++)Pm[String(t)]=String(t);for(let t=0;t<26;t++)Pm[String.fromCharCode(65+t)]=String(10+t);const zx=Math.floor(TN(CN));function RN(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Pm[n]).join("");for(;e.length>=zx;){let n=e.substring(0,zx);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function DN(t){let e=null;if(typeof t!="string"&&sl.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=qx(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&sl.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==RN(t)&&sl.throwArgumentError("bad icap checksum","address",t),e=SN(t.substring(4));e.length<40;)e="0"+e;e=qx("0x"+e)}else sl.throwArgumentError("invalid address","address",t);return e}function ol(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var al={},yr={},Ga=Hx;function Hx(t,e){if(!t)throw new Error(e||"Assertion failed")}Hx.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var Mm={exports:{}};typeof Object.create=="function"?Mm.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Mm.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var yd=Mm.exports,ON=Ga,NN=yd;yr.inherits=NN;function LN(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function kN(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):LN(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}yr.htonl=Wx;function $N(t,e){for(var r="",n=0;n>>0}return s}yr.join32=FN;function jN(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}yr.split32=jN;function UN(t,e){return t>>>e|t<<32-e}yr.rotr32=UN;function qN(t,e){return t<>>32-e}yr.rotl32=qN;function zN(t,e){return t+e>>>0}yr.sum32=zN;function HN(t,e,r){return t+e+r>>>0}yr.sum32_3=HN;function WN(t,e,r,n){return t+e+r+n>>>0}yr.sum32_4=WN;function KN(t,e,r,n,i){return t+e+r+n+i>>>0}yr.sum32_5=KN;function VN(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}yr.sum64=VN;function GN(t,e,r,n){var i=e+n>>>0,s=(i>>0}yr.sum64_hi=GN;function YN(t,e,r,n){var i=e+n;return i>>>0}yr.sum64_lo=YN;function JN(t,e,r,n,i,s,o,a){var u=0,l=e;l=l+n>>>0,u+=l>>0,u+=l>>0,u+=l>>0}yr.sum64_4_hi=JN;function XN(t,e,r,n,i,s,o,a){var u=e+n+s+a;return u>>>0}yr.sum64_4_lo=XN;function ZN(t,e,r,n,i,s,o,a,u,l){var d=0,p=e;p=p+n>>>0,d+=p>>0,d+=p>>0,d+=p>>0,d+=p>>0}yr.sum64_5_hi=ZN;function QN(t,e,r,n,i,s,o,a,u,l){var d=e+n+s+a+l;return d>>>0}yr.sum64_5_lo=QN;function eL(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}yr.rotr64_hi=eL;function tL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.rotr64_lo=tL;function rL(t,e,r){return t>>>r}yr.shr64_hi=rL;function nL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.shr64_lo=nL;var lu={},Gx=yr,iL=Ga;function wd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}lu.BlockHash=wd,wd.prototype.update=function(e,r){if(e=Gx.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Gx.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}Ls.g0_256=uL;function fL(t){return ks(t,17)^ks(t,19)^t>>>10}Ls.g1_256=fL;var du=yr,lL=lu,hL=Ls,Im=du.rotl32,cl=du.sum32,dL=du.sum32_5,pL=hL.ft_1,Zx=lL.BlockHash,gL=[1518500249,1859775393,2400959708,3395469782];function Bs(){if(!(this instanceof Bs))return new Bs;Zx.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}du.inherits(Bs,Zx);var mL=Bs;Bs.blockSize=512,Bs.outSize=160,Bs.hmacStrength=80,Bs.padLength=64,Bs.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),nk(e.length<=this.blockSize);for(var r=e.length;r>8,y=d&255;p?u.push(p,y):u.push(y)}return u}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",u=0;u(y>>1)-1?N=(y>>1)-D:N=D,A.isubn(N)):N=0,p[P]=N,A.iushrn(1)}return p}r.getNAF=n;function i(u,l){var d=[[],[]];u=u.clone(),l=l.clone();for(var p=0,y=0,A;u.cmpn(-p)>0||l.cmpn(-y)>0;){var P=u.andln(3)+p&3,N=l.andln(3)+y&3;P===3&&(P=-1),N===3&&(N=-1);var D;P&1?(A=u.andln(7)+p&7,(A===3||A===5)&&N===2?D=-P:D=P):D=0,d[0].push(D);var k;N&1?(A=l.andln(7)+y&7,(A===3||A===5)&&P===2?k=-N:k=N):k=0,d[1].push(k),2*p===D+1&&(p=1-p),2*y===k+1&&(y=1-y),u.iushrn(1),l.iushrn(1)}return d}r.getJSF=i;function s(u,l,d){var p="_"+l;u.prototype[l]=function(){return this[p]!==void 0?this[p]:this[p]=d.call(this)}}r.cachedProperty=s;function o(u){return typeof u=="string"?r.toArray(u,"hex"):u}r.parseBytes=o;function a(u){return new rr(u,"hex","le")}r.intFromLE=a}),_d=Ci.getNAF,ok=Ci.getJSF,Ed=Ci.assert;function na(t,e){this.type=t,this.p=new rr(e.p,16),this.red=e.prime?rr.red(e.prime):rr.mont(this.p),this.zero=new rr(0).toRed(this.red),this.one=new rr(1).toRed(this.red),this.two=new rr(2).toRed(this.red),this.n=e.n&&new rr(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ja=na;na.prototype.point=function(){throw new Error("Not implemented")},na.prototype.validate=function(){throw new Error("Not implemented")},na.prototype._fixedNafMul=function(e,r){Ed(e.precomputed);var n=e._getDoubles(),i=_d(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Ed(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},na.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=_d(n[P],o[P],this._bitLength),u[N]=_d(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=ok(n[P],n[N]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[N]=new Array(l),p=0;p=0;d--){for(var T=0;d>=0;){var z=!0;for(p=0;p=0&&T++,K=K.dblp(T),d<0)break;for(p=0;p0?y=a[p][ue-1>>1]:ue<0&&(y=a[p][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},zi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),p.negative&&(p=p.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:p,b:y},{a:A,b:P}]},Hi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Hi.prototype.pointFromX=function(e,r){e=new rr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Hi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Hi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Dn.prototype.isInfinity=function(){return this.inf},Dn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Dn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Dn.prototype.getX=function(){return this.x.fromRed()},Dn.prototype.getY=function(){return this.y.fromRed()},Dn.prototype.mul=function(e){return e=new rr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Dn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Dn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Dn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Dn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Dn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Un(t,e,r,n){Ja.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new rr(0)):(this.x=new rr(e,16),this.y=new rr(r,16),this.z=new rr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Nm(Un,Ja.BasePoint),Hi.prototype.jpoint=function(e,r,n){return new Un(this,e,r,n)},Un.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},Un.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Un.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(p).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(p)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},Un.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),A=u.redMul(p.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},Un.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},Un.prototype.inspect=function(){return this.isInfinity()?"":""},Un.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Sd=vu(function(t,e){var r=e;r.base=Ja,r.short=ck,r.mont=null,r.edwards=null}),Ad=vu(function(t,e){var r=e,n=Ci.assert;function i(a){a.type==="short"?this.curve=new Sd.short(a):a.type==="edwards"?this.curve=new Sd.edwards(a):this.curve=new Sd.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,u){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(u);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:wo.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:wo.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:wo.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:wo.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:wo.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:wo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function ia(t){if(!(this instanceof ia))return new ia(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=vs.toArray(t.entropy,t.entropyEnc||"hex"),r=vs.toArray(t.nonce,t.nonceEnc||"hex"),n=vs.toArray(t.pers,t.persEnc||"hex");Om(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var d3=ia;ia.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ia.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=vs.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var uk=Ci.assert;function Pd(t,e){if(t instanceof Pd)return t;this._importDER(t,e)||(uk(t.r&&t.s,"Signature without r or s"),this.r=new rr(t.r,16),this.s=new rr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Md=Pd;function fk(){this.place=0}function Bm(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function p3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Pd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=p3(r),n=p3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];$m(i,r.length),i=i.concat(r),i.push(2),$m(i,n.length);var s=i.concat(n),o=[48];return $m(o,s.length),o=o.concat(s),Ci.encode(o,e)};var lk=function(){throw new Error("unsupported")},g3=Ci.assert;function Wi(t){if(!(this instanceof Wi))return new Wi(t);typeof t=="string"&&(g3(Object.prototype.hasOwnProperty.call(Ad,t),"Unknown curve "+t),t=Ad[t]),t instanceof Ad.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var hk=Wi;Wi.prototype.keyPair=function(e){return new km(this,e)},Wi.prototype.keyFromPrivate=function(e,r){return km.fromPrivate(this,e,r)},Wi.prototype.keyFromPublic=function(e,r){return km.fromPublic(this,e,r)},Wi.prototype.genKeyPair=function(e){e||(e={});for(var r=new d3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||lk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new rr(2));;){var s=new rr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Wi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Wi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new rr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new d3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new rr(1)),d=0;;d++){var p=i.k?i.k(d):new rr(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new Md({r:P,s:N,recoveryParam:D})}}}}}},Wi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new rr(e,16)),n=this.keyFromPublic(n,i),r=new Md(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),u=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.eqXToP(s)):(d=this.g.mulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.getX().umod(this.n).cmp(s)===0)},Wi.prototype.recoverPubKey=function(t,e,r,n){g3((3&r)===r,"The recovery param is more than two bits"),e=new Md(e,n);var i=this.n,s=new rr(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Wi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Md(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dk=vu(function(t,e){var r=e;r.version="6.5.4",r.utils=Ci,r.rand=function(){throw new Error("unsupported")},r.curve=Sd,r.curves=Ad,r.ec=hk,r.eddsa=null}),pk=dk.ec;const gk="signing-key/5.7.0",Fm=new Kr(gk);let jm=null;function sa(){return jm||(jm=new pk("secp256k1")),jm}class mk{constructor(e){ol(this,"curve","secp256k1"),ol(this,"privateKey",Ii(e)),xN(this.privateKey)!==32&&Fm.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=sa().keyFromPrivate(bn(this.privateKey));ol(this,"publicKey","0x"+r.getPublic(!1,"hex")),ol(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ol(this,"_isSigningKey",!0)}_addPoint(e){const r=sa().keyFromPublic(bn(this.publicKey)),n=sa().keyFromPublic(bn(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=sa().keyFromPrivate(bn(this.privateKey)),n=bn(e);n.length!==32&&Fm.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Fx({recoveryParam:i.recoveryParam,r:fu("0x"+i.r.toString(16),32),s:fu("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=sa().keyFromPrivate(bn(this.privateKey)),n=sa().keyFromPublic(bn(m3(e)));return fu("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function vk(t,e){const r=Fx(e),n={r:bn(r.r),s:bn(r.s)};return"0x"+sa().recoverPubKey(bn(t),n,r.recoveryParam).encode("hex",!1)}function m3(t,e){const r=bn(t);return r.length===32?new mk(r).publicKey:r.length===33?"0x"+sa().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?Ii(r):Fm.throwArgumentError("invalid public or private key","key","[REDACTED]")}var v3;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(v3||(v3={}));function bk(t){const e=m3(t);return DN($x(Em($x(e,1)),12))}function yk(t,e){return bk(vk(bn(t),e))}var Um={},Id={};Object.defineProperty(Id,"__esModule",{value:!0});var Yn=or,qm=Mi,wk=20;function xk(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],p=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],P=r[31]<<24|r[30]<<16|r[29]<<8|r[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],k=e[11]<<24|e[10]<<16|e[9]<<8|e[8],B=e[15]<<24|e[14]<<16|e[13]<<8|e[12],j=n,U=i,K=s,J=o,T=a,z=u,ue=l,_e=d,G=p,E=y,m=A,f=P,g=N,v=D,x=k,_=B,S=0;S>>16|g<<16,G=G+g|0,T^=G,T=T>>>20|T<<12,U=U+z|0,v^=U,v=v>>>16|v<<16,E=E+v|0,z^=E,z=z>>>20|z<<12,K=K+ue|0,x^=K,x=x>>>16|x<<16,m=m+x|0,ue^=m,ue=ue>>>20|ue<<12,J=J+_e|0,_^=J,_=_>>>16|_<<16,f=f+_|0,_e^=f,_e=_e>>>20|_e<<12,K=K+ue|0,x^=K,x=x>>>24|x<<8,m=m+x|0,ue^=m,ue=ue>>>25|ue<<7,J=J+_e|0,_^=J,_=_>>>24|_<<8,f=f+_|0,_e^=f,_e=_e>>>25|_e<<7,U=U+z|0,v^=U,v=v>>>24|v<<8,E=E+v|0,z^=E,z=z>>>25|z<<7,j=j+T|0,g^=j,g=g>>>24|g<<8,G=G+g|0,T^=G,T=T>>>25|T<<7,j=j+z|0,_^=j,_=_>>>16|_<<16,m=m+_|0,z^=m,z=z>>>20|z<<12,U=U+ue|0,g^=U,g=g>>>16|g<<16,f=f+g|0,ue^=f,ue=ue>>>20|ue<<12,K=K+_e|0,v^=K,v=v>>>16|v<<16,G=G+v|0,_e^=G,_e=_e>>>20|_e<<12,J=J+T|0,x^=J,x=x>>>16|x<<16,E=E+x|0,T^=E,T=T>>>20|T<<12,K=K+_e|0,v^=K,v=v>>>24|v<<8,G=G+v|0,_e^=G,_e=_e>>>25|_e<<7,J=J+T|0,x^=J,x=x>>>24|x<<8,E=E+x|0,T^=E,T=T>>>25|T<<7,U=U+ue|0,g^=U,g=g>>>24|g<<8,f=f+g|0,ue^=f,ue=ue>>>25|ue<<7,j=j+z|0,_^=j,_=_>>>24|_<<8,m=m+_|0,z^=m,z=z>>>25|z<<7;Yn.writeUint32LE(j+n|0,t,0),Yn.writeUint32LE(U+i|0,t,4),Yn.writeUint32LE(K+s|0,t,8),Yn.writeUint32LE(J+o|0,t,12),Yn.writeUint32LE(T+a|0,t,16),Yn.writeUint32LE(z+u|0,t,20),Yn.writeUint32LE(ue+l|0,t,24),Yn.writeUint32LE(_e+d|0,t,28),Yn.writeUint32LE(G+p|0,t,32),Yn.writeUint32LE(E+y|0,t,36),Yn.writeUint32LE(m+A|0,t,40),Yn.writeUint32LE(f+P|0,t,44),Yn.writeUint32LE(g+N|0,t,48),Yn.writeUint32LE(v+D|0,t,52),Yn.writeUint32LE(x+k|0,t,56),Yn.writeUint32LE(_+B|0,t,60)}function b3(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var y3={},oa={};Object.defineProperty(oa,"__esModule",{value:!0});function Sk(t,e,r){return~(t-1)&e|t-1&r}oa.select=Sk;function Ak(t,e){return(t|0)-(e|0)-1>>>31&1}oa.lessOrEqual=Ak;function w3(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}oa.compare=w3;function Pk(t,e){return t.length===0||e.length===0?!1:w3(t,e)!==0}oa.equal=Pk,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=oa,r=Mi;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var u=a[0]|a[1]<<8;this._r[0]=u&8191;var l=a[2]|a[3]<<8;this._r[1]=(u>>>13|l<<3)&8191;var d=a[4]|a[5]<<8;this._r[2]=(l>>>10|d<<6)&7939;var p=a[6]|a[7]<<8;this._r[3]=(d>>>7|p<<9)&8191;var y=a[8]|a[9]<<8;this._r[4]=(p>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var A=a[10]|a[11]<<8;this._r[6]=(y>>>14|A<<2)&8191;var P=a[12]|a[13]<<8;this._r[7]=(A>>>11|P<<5)&8065;var N=a[14]|a[15]<<8;this._r[8]=(P>>>8|N<<8)&8191,this._r[9]=N>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,u,l){for(var d=this._fin?0:2048,p=this._h[0],y=this._h[1],A=this._h[2],P=this._h[3],N=this._h[4],D=this._h[5],k=this._h[6],B=this._h[7],j=this._h[8],U=this._h[9],K=this._r[0],J=this._r[1],T=this._r[2],z=this._r[3],ue=this._r[4],_e=this._r[5],G=this._r[6],E=this._r[7],m=this._r[8],f=this._r[9];l>=16;){var g=a[u+0]|a[u+1]<<8;p+=g&8191;var v=a[u+2]|a[u+3]<<8;y+=(g>>>13|v<<3)&8191;var x=a[u+4]|a[u+5]<<8;A+=(v>>>10|x<<6)&8191;var _=a[u+6]|a[u+7]<<8;P+=(x>>>7|_<<9)&8191;var S=a[u+8]|a[u+9]<<8;N+=(_>>>4|S<<12)&8191,D+=S>>>1&8191;var b=a[u+10]|a[u+11]<<8;k+=(S>>>14|b<<2)&8191;var M=a[u+12]|a[u+13]<<8;B+=(b>>>11|M<<5)&8191;var I=a[u+14]|a[u+15]<<8;j+=(M>>>8|I<<8)&8191,U+=I>>>5|d;var F=0,ae=F;ae+=p*K,ae+=y*(5*f),ae+=A*(5*m),ae+=P*(5*E),ae+=N*(5*G),F=ae>>>13,ae&=8191,ae+=D*(5*_e),ae+=k*(5*ue),ae+=B*(5*z),ae+=j*(5*T),ae+=U*(5*J),F+=ae>>>13,ae&=8191;var O=F;O+=p*J,O+=y*K,O+=A*(5*f),O+=P*(5*m),O+=N*(5*E),F=O>>>13,O&=8191,O+=D*(5*G),O+=k*(5*_e),O+=B*(5*ue),O+=j*(5*z),O+=U*(5*T),F+=O>>>13,O&=8191;var se=F;se+=p*T,se+=y*J,se+=A*K,se+=P*(5*f),se+=N*(5*m),F=se>>>13,se&=8191,se+=D*(5*E),se+=k*(5*G),se+=B*(5*_e),se+=j*(5*ue),se+=U*(5*z),F+=se>>>13,se&=8191;var ee=F;ee+=p*z,ee+=y*T,ee+=A*J,ee+=P*K,ee+=N*(5*f),F=ee>>>13,ee&=8191,ee+=D*(5*m),ee+=k*(5*E),ee+=B*(5*G),ee+=j*(5*_e),ee+=U*(5*ue),F+=ee>>>13,ee&=8191;var X=F;X+=p*ue,X+=y*z,X+=A*T,X+=P*J,X+=N*K,F=X>>>13,X&=8191,X+=D*(5*f),X+=k*(5*m),X+=B*(5*E),X+=j*(5*G),X+=U*(5*_e),F+=X>>>13,X&=8191;var Q=F;Q+=p*_e,Q+=y*ue,Q+=A*z,Q+=P*T,Q+=N*J,F=Q>>>13,Q&=8191,Q+=D*K,Q+=k*(5*f),Q+=B*(5*m),Q+=j*(5*E),Q+=U*(5*G),F+=Q>>>13,Q&=8191;var R=F;R+=p*G,R+=y*_e,R+=A*ue,R+=P*z,R+=N*T,F=R>>>13,R&=8191,R+=D*J,R+=k*K,R+=B*(5*f),R+=j*(5*m),R+=U*(5*E),F+=R>>>13,R&=8191;var Z=F;Z+=p*E,Z+=y*G,Z+=A*_e,Z+=P*ue,Z+=N*z,F=Z>>>13,Z&=8191,Z+=D*T,Z+=k*J,Z+=B*K,Z+=j*(5*f),Z+=U*(5*m),F+=Z>>>13,Z&=8191;var te=F;te+=p*m,te+=y*E,te+=A*G,te+=P*_e,te+=N*ue,F=te>>>13,te&=8191,te+=D*z,te+=k*T,te+=B*J,te+=j*K,te+=U*(5*f),F+=te>>>13,te&=8191;var le=F;le+=p*f,le+=y*m,le+=A*E,le+=P*G,le+=N*_e,F=le>>>13,le&=8191,le+=D*ue,le+=k*z,le+=B*T,le+=j*J,le+=U*K,F+=le>>>13,le&=8191,F=(F<<2)+F|0,F=F+ae|0,ae=F&8191,F=F>>>13,O+=F,p=ae,y=O,A=se,P=ee,N=X,D=Q,k=R,B=Z,j=te,U=le,u+=16,l-=16}this._h[0]=p,this._h[1]=y,this._h[2]=A,this._h[3]=P,this._h[4]=N,this._h[5]=D,this._h[6]=k,this._h[7]=B,this._h[8]=j,this._h[9]=U},o.prototype.finish=function(a,u){u===void 0&&(u=0);var l=new Uint16Array(10),d,p,y,A;if(this._leftover){for(A=this._leftover,this._buffer[A++]=1;A<16;A++)this._buffer[A]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(d=this._h[1]>>>13,this._h[1]&=8191,A=2;A<10;A++)this._h[A]+=d,d=this._h[A]>>>13,this._h[A]&=8191;for(this._h[0]+=d*5,d=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=d,d=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=d,l[0]=this._h[0]+5,d=l[0]>>>13,l[0]&=8191,A=1;A<10;A++)l[A]=this._h[A]+d,d=l[A]>>>13,l[A]&=8191;for(l[9]-=8192,p=(d^1)-1,A=0;A<10;A++)l[A]&=p;for(p=~p,A=0;A<10;A++)this._h[A]=this._h[A]&p|l[A];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,y=this._h[0]+this._pad[0],this._h[0]=y&65535,A=1;A<8;A++)y=(this._h[A]+this._pad[A]|0)+(y>>>16)|0,this._h[A]=y&65535;return a[u+0]=this._h[0]>>>0,a[u+1]=this._h[0]>>>8,a[u+2]=this._h[1]>>>0,a[u+3]=this._h[1]>>>8,a[u+4]=this._h[2]>>>0,a[u+5]=this._h[2]>>>8,a[u+6]=this._h[3]>>>0,a[u+7]=this._h[3]>>>8,a[u+8]=this._h[4]>>>0,a[u+9]=this._h[4]>>>8,a[u+10]=this._h[5]>>>0,a[u+11]=this._h[5]>>>8,a[u+12]=this._h[6]>>>0,a[u+13]=this._h[6]>>>8,a[u+14]=this._h[7]>>>0,a[u+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var u=0,l=a.length,d;if(this._leftover){d=16-this._leftover,d>l&&(d=l);for(var p=0;p=16&&(d=l-l%16,this._blocks(a,u,d),u+=d,l-=d),l){for(var p=0;p16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var A=new Uint8Array(16);A.set(l,A.length-l.length);var P=new Uint8Array(32);e.stream(this._key,A,P,4);var N=d.length+this.tagLength,D;if(y){if(y.length!==N)throw new Error("ChaCha20Poly1305: incorrect destination length");D=y}else D=new Uint8Array(N);return e.streamXOR(this._key,A,d,D,4),this._authenticate(D.subarray(D.length-this.tagLength,D.length),P,D.subarray(0,D.length-this.tagLength),p),n.wipe(A),D},u.prototype.open=function(l,d,p,y){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(d.length0&&A.update(o.subarray(y.length%16))),A.update(p),p.length%16>0&&A.update(o.subarray(p.length%16));var P=new Uint8Array(8);y&&i.writeUint64LE(y.length,P),A.update(P),i.writeUint64LE(p.length,P),A.update(P);for(var N=A.digest(),D=0;Dthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._temp,this._state,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,A=l%64<56?64:128;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._state.set(u.state),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.state),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,u,l,d,p){for(;p>=64;){for(var y=u[0],A=u[1],P=u[2],N=u[3],D=u[4],k=u[5],B=u[6],j=u[7],U=0;U<16;U++){var K=d+U*4;a[U]=e.readUint32BE(l,K)}for(var U=16;U<64;U++){var J=a[U-2],T=(J>>>17|J<<15)^(J>>>19|J<<13)^J>>>10;J=a[U-15];var z=(J>>>7|J<<25)^(J>>>18|J<<14)^J>>>3;a[U]=(T+a[U-7]|0)+(z+a[U-16]|0)}for(var U=0;U<64;U++){var T=(((D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7))+(D&k^~D&B)|0)+(j+(i[U]+a[U]|0)|0)|0,z=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&A^y&P^A&P)|0;j=B,B=k,k=D,D=N+T|0,N=P,P=A,A=y,y=T+z|0}u[0]+=y,u[1]+=A,u[2]+=P,u[3]+=N,u[4]+=D,u[5]+=k,u[6]+=B,u[7]+=j,d+=64,p-=64}return d}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ll);var Hm={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=ta,r=Mi;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(U){const K=new Float64Array(16);if(U)for(let J=0;J>16&1),J[_e-1]&=65535;J[15]=T[15]-32767-(J[14]>>16&1);const ue=J[15]>>16&1;J[14]&=65535,a(T,J,1-ue)}for(let z=0;z<16;z++)U[2*z]=T[z]&255,U[2*z+1]=T[z]>>8}function l(U,K){for(let J=0;J<16;J++)U[J]=K[2*J]+(K[2*J+1]<<8);U[15]&=32767}function d(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]+J[T]}function p(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]-J[T]}function y(U,K,J){let T,z,ue=0,_e=0,G=0,E=0,m=0,f=0,g=0,v=0,x=0,_=0,S=0,b=0,M=0,I=0,F=0,ae=0,O=0,se=0,ee=0,X=0,Q=0,R=0,Z=0,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=J[0],Ie=J[1],Le=J[2],Ve=J[3],ke=J[4],ze=J[5],He=J[6],Ee=J[7],Qe=J[8],ct=J[9],Be=J[10],et=J[11],rt=J[12],Je=J[13],pt=J[14],ht=J[15];T=K[0],ue+=T*$e,_e+=T*Ie,G+=T*Le,E+=T*Ve,m+=T*ke,f+=T*ze,g+=T*He,v+=T*Ee,x+=T*Qe,_+=T*ct,S+=T*Be,b+=T*et,M+=T*rt,I+=T*Je,F+=T*pt,ae+=T*ht,T=K[1],_e+=T*$e,G+=T*Ie,E+=T*Le,m+=T*Ve,f+=T*ke,g+=T*ze,v+=T*He,x+=T*Ee,_+=T*Qe,S+=T*ct,b+=T*Be,M+=T*et,I+=T*rt,F+=T*Je,ae+=T*pt,O+=T*ht,T=K[2],G+=T*$e,E+=T*Ie,m+=T*Le,f+=T*Ve,g+=T*ke,v+=T*ze,x+=T*He,_+=T*Ee,S+=T*Qe,b+=T*ct,M+=T*Be,I+=T*et,F+=T*rt,ae+=T*Je,O+=T*pt,se+=T*ht,T=K[3],E+=T*$e,m+=T*Ie,f+=T*Le,g+=T*Ve,v+=T*ke,x+=T*ze,_+=T*He,S+=T*Ee,b+=T*Qe,M+=T*ct,I+=T*Be,F+=T*et,ae+=T*rt,O+=T*Je,se+=T*pt,ee+=T*ht,T=K[4],m+=T*$e,f+=T*Ie,g+=T*Le,v+=T*Ve,x+=T*ke,_+=T*ze,S+=T*He,b+=T*Ee,M+=T*Qe,I+=T*ct,F+=T*Be,ae+=T*et,O+=T*rt,se+=T*Je,ee+=T*pt,X+=T*ht,T=K[5],f+=T*$e,g+=T*Ie,v+=T*Le,x+=T*Ve,_+=T*ke,S+=T*ze,b+=T*He,M+=T*Ee,I+=T*Qe,F+=T*ct,ae+=T*Be,O+=T*et,se+=T*rt,ee+=T*Je,X+=T*pt,Q+=T*ht,T=K[6],g+=T*$e,v+=T*Ie,x+=T*Le,_+=T*Ve,S+=T*ke,b+=T*ze,M+=T*He,I+=T*Ee,F+=T*Qe,ae+=T*ct,O+=T*Be,se+=T*et,ee+=T*rt,X+=T*Je,Q+=T*pt,R+=T*ht,T=K[7],v+=T*$e,x+=T*Ie,_+=T*Le,S+=T*Ve,b+=T*ke,M+=T*ze,I+=T*He,F+=T*Ee,ae+=T*Qe,O+=T*ct,se+=T*Be,ee+=T*et,X+=T*rt,Q+=T*Je,R+=T*pt,Z+=T*ht,T=K[8],x+=T*$e,_+=T*Ie,S+=T*Le,b+=T*Ve,M+=T*ke,I+=T*ze,F+=T*He,ae+=T*Ee,O+=T*Qe,se+=T*ct,ee+=T*Be,X+=T*et,Q+=T*rt,R+=T*Je,Z+=T*pt,te+=T*ht,T=K[9],_+=T*$e,S+=T*Ie,b+=T*Le,M+=T*Ve,I+=T*ke,F+=T*ze,ae+=T*He,O+=T*Ee,se+=T*Qe,ee+=T*ct,X+=T*Be,Q+=T*et,R+=T*rt,Z+=T*Je,te+=T*pt,le+=T*ht,T=K[10],S+=T*$e,b+=T*Ie,M+=T*Le,I+=T*Ve,F+=T*ke,ae+=T*ze,O+=T*He,se+=T*Ee,ee+=T*Qe,X+=T*ct,Q+=T*Be,R+=T*et,Z+=T*rt,te+=T*Je,le+=T*pt,ie+=T*ht,T=K[11],b+=T*$e,M+=T*Ie,I+=T*Le,F+=T*Ve,ae+=T*ke,O+=T*ze,se+=T*He,ee+=T*Ee,X+=T*Qe,Q+=T*ct,R+=T*Be,Z+=T*et,te+=T*rt,le+=T*Je,ie+=T*pt,fe+=T*ht,T=K[12],M+=T*$e,I+=T*Ie,F+=T*Le,ae+=T*Ve,O+=T*ke,se+=T*ze,ee+=T*He,X+=T*Ee,Q+=T*Qe,R+=T*ct,Z+=T*Be,te+=T*et,le+=T*rt,ie+=T*Je,fe+=T*pt,ve+=T*ht,T=K[13],I+=T*$e,F+=T*Ie,ae+=T*Le,O+=T*Ve,se+=T*ke,ee+=T*ze,X+=T*He,Q+=T*Ee,R+=T*Qe,Z+=T*ct,te+=T*Be,le+=T*et,ie+=T*rt,fe+=T*Je,ve+=T*pt,Me+=T*ht,T=K[14],F+=T*$e,ae+=T*Ie,O+=T*Le,se+=T*Ve,ee+=T*ke,X+=T*ze,Q+=T*He,R+=T*Ee,Z+=T*Qe,te+=T*ct,le+=T*Be,ie+=T*et,fe+=T*rt,ve+=T*Je,Me+=T*pt,Ne+=T*ht,T=K[15],ae+=T*$e,O+=T*Ie,se+=T*Le,ee+=T*Ve,X+=T*ke,Q+=T*ze,R+=T*He,Z+=T*Ee,te+=T*Qe,le+=T*ct,ie+=T*Be,fe+=T*et,ve+=T*rt,Me+=T*Je,Ne+=T*pt,Te+=T*ht,ue+=38*O,_e+=38*se,G+=38*ee,E+=38*X,m+=38*Q,f+=38*R,g+=38*Z,v+=38*te,x+=38*le,_+=38*ie,S+=38*fe,b+=38*ve,M+=38*Me,I+=38*Ne,F+=38*Te,z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=g+z+65535,z=Math.floor(T/65536),g=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=g+z+65535,z=Math.floor(T/65536),g=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),U[0]=ue,U[1]=_e,U[2]=G,U[3]=E,U[4]=m,U[5]=f,U[6]=g,U[7]=v,U[8]=x,U[9]=_,U[10]=S,U[11]=b,U[12]=M,U[13]=I,U[14]=F,U[15]=ae}function A(U,K){y(U,K,K)}function P(U,K){const J=n();for(let T=0;T<16;T++)J[T]=K[T];for(let T=253;T>=0;T--)A(J,J),T!==2&&T!==4&&y(J,J,K);for(let T=0;T<16;T++)U[T]=J[T]}function N(U,K){const J=new Uint8Array(32),T=new Float64Array(80),z=n(),ue=n(),_e=n(),G=n(),E=n(),m=n();for(let x=0;x<31;x++)J[x]=U[x];J[31]=U[31]&127|64,J[0]&=248,l(T,K);for(let x=0;x<16;x++)ue[x]=T[x];z[0]=G[0]=1;for(let x=254;x>=0;--x){const _=J[x>>>3]>>>(x&7)&1;a(z,ue,_),a(_e,G,_),d(E,z,_e),p(z,z,_e),d(_e,ue,G),p(ue,ue,G),A(G,E),A(m,z),y(z,_e,z),y(_e,ue,E),d(E,z,_e),p(z,z,_e),A(ue,z),p(_e,G,m),y(z,_e,s),d(z,z,G),y(_e,_e,z),y(z,G,m),y(G,ue,T),A(ue,E),a(z,ue,_),a(_e,G,_)}for(let x=0;x<16;x++)T[x+16]=z[x],T[x+32]=_e[x],T[x+48]=ue[x],T[x+64]=G[x];const f=T.subarray(32),g=T.subarray(16);P(f,f),y(g,g,f);const v=new Uint8Array(32);return u(v,g),v}t.scalarMult=N;function D(U){return N(U,i)}t.scalarMultBase=D;function k(U){if(U.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const K=new Uint8Array(U);return{publicKey:D(K),secretKey:K}}t.generateKeyPairFromSeed=k;function B(U){const K=(0,e.randomBytes)(32,U),J=k(K);return(0,r.wipe)(K),J}t.generateKeyPair=B;function j(U,K,J=!1){if(U.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(K.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const T=N(U,K);if(J){let z=0;for(let ue=0;ue",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}};var Ti={},Wm={exports:{}};Wm.exports,function(t){(function(e,r){function n(G,E){if(!G)throw new Error(E||"Assertion failed")}function i(G,E){G.super_=E;var m=function(){};m.prototype=E.prototype,G.prototype=new m,G.prototype.constructor=G}function s(G,E,m){if(s.isBN(G))return G;this.negative=0,this.words=null,this.length=0,this.red=null,G!==null&&((E==="le"||E==="be")&&(m=E,E=10),this._init(G||0,E||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(E){return E instanceof s?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===s.wordSize&&Array.isArray(E.words)},s.max=function(E,m){return E.cmp(m)>0?E:m},s.min=function(E,m){return E.cmp(m)<0?E:m},s.prototype._init=function(E,m,f){if(typeof E=="number")return this._initNumber(E,m,f);if(typeof E=="object")return this._initArray(E,m,f);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),E=E.toString().replace(/\s+/g,"");var g=0;E[0]==="-"&&(g++,this.negative=1),g=0;g-=3)x=E[g]|E[g-1]<<8|E[g-2]<<16,this.words[v]|=x<<_&67108863,this.words[v+1]=x>>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);else if(f==="le")for(g=0,v=0;g>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);return this.strip()};function a(G,E){var m=G.charCodeAt(E);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function u(G,E,m){var f=a(G,m);return m-1>=E&&(f|=a(G,m-1)<<4),f}s.prototype._parseHex=function(E,m,f){this.length=Math.ceil((E.length-m)/6),this.words=new Array(this.length);for(var g=0;g=m;g-=2)_=u(E,m,g)<=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8;else{var S=E.length-m;for(g=S%2===0?m+1:m;g=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8}this.strip()};function l(G,E,m,f){for(var g=0,v=Math.min(G.length,m),x=E;x=49?g+=_-49+10:_>=17?g+=_-17+10:g+=_}return g}s.prototype._parseBase=function(E,m,f){this.words=[0],this.length=1;for(var g=0,v=1;v<=67108863;v*=m)g++;g--,v=v/m|0;for(var x=E.length-f,_=x%g,S=Math.min(x,x-_)+f,b=0,M=f;M1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var d=["","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"],p=[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],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(E,m){E=E||10,m=m|0||1;var f;if(E===16||E==="hex"){f="";for(var g=0,v=0,x=0;x>>24-g&16777215,g+=2,g>=26&&(g-=26,x--),v!==0||x!==this.length-1?f=d[6-S.length]+S+f:f=S+f}for(v!==0&&(f=v.toString(16)+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(E===(E|0)&&E>=2&&E<=36){var b=p[E],M=y[E];f="";var I=this.clone();for(I.negative=0;!I.isZero();){var F=I.modn(M).toString(E);I=I.idivn(M),I.isZero()?f=F+f:f=d[b-F.length]+F+f}for(this.isZero()&&(f="0"+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(E,m){return n(typeof o<"u"),this.toArrayLike(o,E,m)},s.prototype.toArray=function(E,m){return this.toArrayLike(Array,E,m)},s.prototype.toArrayLike=function(E,m,f){var g=this.byteLength(),v=f||Math.max(1,g);n(g<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var x=m==="le",_=new E(v),S,b,M=this.clone();if(x){for(b=0;!M.isZero();b++)S=M.andln(255),M.iushrn(8),_[b]=S;for(;b=4096&&(f+=13,m>>>=13),m>=64&&(f+=7,m>>>=7),m>=8&&(f+=4,m>>>=4),m>=2&&(f+=2,m>>>=2),f+m},s.prototype._zeroBits=function(E){if(E===0)return 26;var m=E,f=0;return m&8191||(f+=13,m>>>=13),m&127||(f+=7,m>>>=7),m&15||(f+=4,m>>>=4),m&3||(f+=2,m>>>=2),m&1||f++,f},s.prototype.bitLength=function(){var E=this.words[this.length-1],m=this._countBits(E);return(this.length-1)*26+m};function A(G){for(var E=new Array(G.bitLength()),m=0;m>>g}return E}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,m=0;mE.length?this.clone().ior(E):E.clone().ior(this)},s.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},s.prototype.iuand=function(E){var m;this.length>E.length?m=E:m=this;for(var f=0;fE.length?this.clone().iand(E):E.clone().iand(this)},s.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},s.prototype.iuxor=function(E){var m,f;this.length>E.length?(m=this,f=E):(m=E,f=this);for(var g=0;gE.length?this.clone().ixor(E):E.clone().ixor(this)},s.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},s.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var m=Math.ceil(E/26)|0,f=E%26;this._expand(m),f>0&&m--;for(var g=0;g0&&(this.words[g]=~this.words[g]&67108863>>26-f),this.strip()},s.prototype.notn=function(E){return this.clone().inotn(E)},s.prototype.setn=function(E,m){n(typeof E=="number"&&E>=0);var f=E/26|0,g=E%26;return this._expand(f+1),m?this.words[f]=this.words[f]|1<E.length?(f=this,g=E):(f=E,g=this);for(var v=0,x=0;x>>26;for(;v!==0&&x>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;xE.length?this.clone().iadd(E):E.clone().iadd(this)},s.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var m=this.iadd(E);return E.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var f=this.cmp(E);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var g,v;f>0?(g=this,v=E):(g=E,v=this);for(var x=0,_=0;_>26,this.words[_]=m&67108863;for(;x!==0&&_>26,this.words[_]=m&67108863;if(x===0&&_>>26,I=S&67108863,F=Math.min(b,E.length-1),ae=Math.max(0,b-G.length+1);ae<=F;ae++){var O=b-ae|0;g=G.words[O]|0,v=E.words[ae]|0,x=g*v+I,M+=x/67108864|0,I=x&67108863}m.words[b]=I|0,S=M|0}return S!==0?m.words[b]=S|0:m.length--,m.strip()}var N=function(E,m,f){var g=E.words,v=m.words,x=f.words,_=0,S,b,M,I=g[0]|0,F=I&8191,ae=I>>>13,O=g[1]|0,se=O&8191,ee=O>>>13,X=g[2]|0,Q=X&8191,R=X>>>13,Z=g[3]|0,te=Z&8191,le=Z>>>13,ie=g[4]|0,fe=ie&8191,ve=ie>>>13,Me=g[5]|0,Ne=Me&8191,Te=Me>>>13,$e=g[6]|0,Ie=$e&8191,Le=$e>>>13,Ve=g[7]|0,ke=Ve&8191,ze=Ve>>>13,He=g[8]|0,Ee=He&8191,Qe=He>>>13,ct=g[9]|0,Be=ct&8191,et=ct>>>13,rt=v[0]|0,Je=rt&8191,pt=rt>>>13,ht=v[1]|0,ft=ht&8191,Ht=ht>>>13,Jt=v[2]|0,St=Jt&8191,er=Jt>>>13,Xt=v[3]|0,Ot=Xt&8191,Bt=Xt>>>13,Tt=v[4]|0,vt=Tt&8191,Dt=Tt>>>13,Lt=v[5]|0,bt=Lt&8191,$t=Lt>>>13,jt=v[6]|0,nt=jt&8191,Ft=jt>>>13,$=v[7]|0,H=$&8191,V=$>>>13,C=v[8]|0,Y=C&8191,q=C>>>13,oe=v[9]|0,pe=oe&8191,xe=oe>>>13;f.negative=E.negative^m.negative,f.length=19,S=Math.imul(F,Je),b=Math.imul(F,pt),b=b+Math.imul(ae,Je)|0,M=Math.imul(ae,pt);var Re=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Re>>>26)|0,Re&=67108863,S=Math.imul(se,Je),b=Math.imul(se,pt),b=b+Math.imul(ee,Je)|0,M=Math.imul(ee,pt),S=S+Math.imul(F,ft)|0,b=b+Math.imul(F,Ht)|0,b=b+Math.imul(ae,ft)|0,M=M+Math.imul(ae,Ht)|0;var De=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(De>>>26)|0,De&=67108863,S=Math.imul(Q,Je),b=Math.imul(Q,pt),b=b+Math.imul(R,Je)|0,M=Math.imul(R,pt),S=S+Math.imul(se,ft)|0,b=b+Math.imul(se,Ht)|0,b=b+Math.imul(ee,ft)|0,M=M+Math.imul(ee,Ht)|0,S=S+Math.imul(F,St)|0,b=b+Math.imul(F,er)|0,b=b+Math.imul(ae,St)|0,M=M+Math.imul(ae,er)|0;var it=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(it>>>26)|0,it&=67108863,S=Math.imul(te,Je),b=Math.imul(te,pt),b=b+Math.imul(le,Je)|0,M=Math.imul(le,pt),S=S+Math.imul(Q,ft)|0,b=b+Math.imul(Q,Ht)|0,b=b+Math.imul(R,ft)|0,M=M+Math.imul(R,Ht)|0,S=S+Math.imul(se,St)|0,b=b+Math.imul(se,er)|0,b=b+Math.imul(ee,St)|0,M=M+Math.imul(ee,er)|0,S=S+Math.imul(F,Ot)|0,b=b+Math.imul(F,Bt)|0,b=b+Math.imul(ae,Ot)|0,M=M+Math.imul(ae,Bt)|0;var Ue=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,S=Math.imul(fe,Je),b=Math.imul(fe,pt),b=b+Math.imul(ve,Je)|0,M=Math.imul(ve,pt),S=S+Math.imul(te,ft)|0,b=b+Math.imul(te,Ht)|0,b=b+Math.imul(le,ft)|0,M=M+Math.imul(le,Ht)|0,S=S+Math.imul(Q,St)|0,b=b+Math.imul(Q,er)|0,b=b+Math.imul(R,St)|0,M=M+Math.imul(R,er)|0,S=S+Math.imul(se,Ot)|0,b=b+Math.imul(se,Bt)|0,b=b+Math.imul(ee,Ot)|0,M=M+Math.imul(ee,Bt)|0,S=S+Math.imul(F,vt)|0,b=b+Math.imul(F,Dt)|0,b=b+Math.imul(ae,vt)|0,M=M+Math.imul(ae,Dt)|0;var gt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(gt>>>26)|0,gt&=67108863,S=Math.imul(Ne,Je),b=Math.imul(Ne,pt),b=b+Math.imul(Te,Je)|0,M=Math.imul(Te,pt),S=S+Math.imul(fe,ft)|0,b=b+Math.imul(fe,Ht)|0,b=b+Math.imul(ve,ft)|0,M=M+Math.imul(ve,Ht)|0,S=S+Math.imul(te,St)|0,b=b+Math.imul(te,er)|0,b=b+Math.imul(le,St)|0,M=M+Math.imul(le,er)|0,S=S+Math.imul(Q,Ot)|0,b=b+Math.imul(Q,Bt)|0,b=b+Math.imul(R,Ot)|0,M=M+Math.imul(R,Bt)|0,S=S+Math.imul(se,vt)|0,b=b+Math.imul(se,Dt)|0,b=b+Math.imul(ee,vt)|0,M=M+Math.imul(ee,Dt)|0,S=S+Math.imul(F,bt)|0,b=b+Math.imul(F,$t)|0,b=b+Math.imul(ae,bt)|0,M=M+Math.imul(ae,$t)|0;var st=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(st>>>26)|0,st&=67108863,S=Math.imul(Ie,Je),b=Math.imul(Ie,pt),b=b+Math.imul(Le,Je)|0,M=Math.imul(Le,pt),S=S+Math.imul(Ne,ft)|0,b=b+Math.imul(Ne,Ht)|0,b=b+Math.imul(Te,ft)|0,M=M+Math.imul(Te,Ht)|0,S=S+Math.imul(fe,St)|0,b=b+Math.imul(fe,er)|0,b=b+Math.imul(ve,St)|0,M=M+Math.imul(ve,er)|0,S=S+Math.imul(te,Ot)|0,b=b+Math.imul(te,Bt)|0,b=b+Math.imul(le,Ot)|0,M=M+Math.imul(le,Bt)|0,S=S+Math.imul(Q,vt)|0,b=b+Math.imul(Q,Dt)|0,b=b+Math.imul(R,vt)|0,M=M+Math.imul(R,Dt)|0,S=S+Math.imul(se,bt)|0,b=b+Math.imul(se,$t)|0,b=b+Math.imul(ee,bt)|0,M=M+Math.imul(ee,$t)|0,S=S+Math.imul(F,nt)|0,b=b+Math.imul(F,Ft)|0,b=b+Math.imul(ae,nt)|0,M=M+Math.imul(ae,Ft)|0;var tt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(tt>>>26)|0,tt&=67108863,S=Math.imul(ke,Je),b=Math.imul(ke,pt),b=b+Math.imul(ze,Je)|0,M=Math.imul(ze,pt),S=S+Math.imul(Ie,ft)|0,b=b+Math.imul(Ie,Ht)|0,b=b+Math.imul(Le,ft)|0,M=M+Math.imul(Le,Ht)|0,S=S+Math.imul(Ne,St)|0,b=b+Math.imul(Ne,er)|0,b=b+Math.imul(Te,St)|0,M=M+Math.imul(Te,er)|0,S=S+Math.imul(fe,Ot)|0,b=b+Math.imul(fe,Bt)|0,b=b+Math.imul(ve,Ot)|0,M=M+Math.imul(ve,Bt)|0,S=S+Math.imul(te,vt)|0,b=b+Math.imul(te,Dt)|0,b=b+Math.imul(le,vt)|0,M=M+Math.imul(le,Dt)|0,S=S+Math.imul(Q,bt)|0,b=b+Math.imul(Q,$t)|0,b=b+Math.imul(R,bt)|0,M=M+Math.imul(R,$t)|0,S=S+Math.imul(se,nt)|0,b=b+Math.imul(se,Ft)|0,b=b+Math.imul(ee,nt)|0,M=M+Math.imul(ee,Ft)|0,S=S+Math.imul(F,H)|0,b=b+Math.imul(F,V)|0,b=b+Math.imul(ae,H)|0,M=M+Math.imul(ae,V)|0;var At=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(At>>>26)|0,At&=67108863,S=Math.imul(Ee,Je),b=Math.imul(Ee,pt),b=b+Math.imul(Qe,Je)|0,M=Math.imul(Qe,pt),S=S+Math.imul(ke,ft)|0,b=b+Math.imul(ke,Ht)|0,b=b+Math.imul(ze,ft)|0,M=M+Math.imul(ze,Ht)|0,S=S+Math.imul(Ie,St)|0,b=b+Math.imul(Ie,er)|0,b=b+Math.imul(Le,St)|0,M=M+Math.imul(Le,er)|0,S=S+Math.imul(Ne,Ot)|0,b=b+Math.imul(Ne,Bt)|0,b=b+Math.imul(Te,Ot)|0,M=M+Math.imul(Te,Bt)|0,S=S+Math.imul(fe,vt)|0,b=b+Math.imul(fe,Dt)|0,b=b+Math.imul(ve,vt)|0,M=M+Math.imul(ve,Dt)|0,S=S+Math.imul(te,bt)|0,b=b+Math.imul(te,$t)|0,b=b+Math.imul(le,bt)|0,M=M+Math.imul(le,$t)|0,S=S+Math.imul(Q,nt)|0,b=b+Math.imul(Q,Ft)|0,b=b+Math.imul(R,nt)|0,M=M+Math.imul(R,Ft)|0,S=S+Math.imul(se,H)|0,b=b+Math.imul(se,V)|0,b=b+Math.imul(ee,H)|0,M=M+Math.imul(ee,V)|0,S=S+Math.imul(F,Y)|0,b=b+Math.imul(F,q)|0,b=b+Math.imul(ae,Y)|0,M=M+Math.imul(ae,q)|0;var Rt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,S=Math.imul(Be,Je),b=Math.imul(Be,pt),b=b+Math.imul(et,Je)|0,M=Math.imul(et,pt),S=S+Math.imul(Ee,ft)|0,b=b+Math.imul(Ee,Ht)|0,b=b+Math.imul(Qe,ft)|0,M=M+Math.imul(Qe,Ht)|0,S=S+Math.imul(ke,St)|0,b=b+Math.imul(ke,er)|0,b=b+Math.imul(ze,St)|0,M=M+Math.imul(ze,er)|0,S=S+Math.imul(Ie,Ot)|0,b=b+Math.imul(Ie,Bt)|0,b=b+Math.imul(Le,Ot)|0,M=M+Math.imul(Le,Bt)|0,S=S+Math.imul(Ne,vt)|0,b=b+Math.imul(Ne,Dt)|0,b=b+Math.imul(Te,vt)|0,M=M+Math.imul(Te,Dt)|0,S=S+Math.imul(fe,bt)|0,b=b+Math.imul(fe,$t)|0,b=b+Math.imul(ve,bt)|0,M=M+Math.imul(ve,$t)|0,S=S+Math.imul(te,nt)|0,b=b+Math.imul(te,Ft)|0,b=b+Math.imul(le,nt)|0,M=M+Math.imul(le,Ft)|0,S=S+Math.imul(Q,H)|0,b=b+Math.imul(Q,V)|0,b=b+Math.imul(R,H)|0,M=M+Math.imul(R,V)|0,S=S+Math.imul(se,Y)|0,b=b+Math.imul(se,q)|0,b=b+Math.imul(ee,Y)|0,M=M+Math.imul(ee,q)|0,S=S+Math.imul(F,pe)|0,b=b+Math.imul(F,xe)|0,b=b+Math.imul(ae,pe)|0,M=M+Math.imul(ae,xe)|0;var Mt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,S=Math.imul(Be,ft),b=Math.imul(Be,Ht),b=b+Math.imul(et,ft)|0,M=Math.imul(et,Ht),S=S+Math.imul(Ee,St)|0,b=b+Math.imul(Ee,er)|0,b=b+Math.imul(Qe,St)|0,M=M+Math.imul(Qe,er)|0,S=S+Math.imul(ke,Ot)|0,b=b+Math.imul(ke,Bt)|0,b=b+Math.imul(ze,Ot)|0,M=M+Math.imul(ze,Bt)|0,S=S+Math.imul(Ie,vt)|0,b=b+Math.imul(Ie,Dt)|0,b=b+Math.imul(Le,vt)|0,M=M+Math.imul(Le,Dt)|0,S=S+Math.imul(Ne,bt)|0,b=b+Math.imul(Ne,$t)|0,b=b+Math.imul(Te,bt)|0,M=M+Math.imul(Te,$t)|0,S=S+Math.imul(fe,nt)|0,b=b+Math.imul(fe,Ft)|0,b=b+Math.imul(ve,nt)|0,M=M+Math.imul(ve,Ft)|0,S=S+Math.imul(te,H)|0,b=b+Math.imul(te,V)|0,b=b+Math.imul(le,H)|0,M=M+Math.imul(le,V)|0,S=S+Math.imul(Q,Y)|0,b=b+Math.imul(Q,q)|0,b=b+Math.imul(R,Y)|0,M=M+Math.imul(R,q)|0,S=S+Math.imul(se,pe)|0,b=b+Math.imul(se,xe)|0,b=b+Math.imul(ee,pe)|0,M=M+Math.imul(ee,xe)|0;var Et=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Et>>>26)|0,Et&=67108863,S=Math.imul(Be,St),b=Math.imul(Be,er),b=b+Math.imul(et,St)|0,M=Math.imul(et,er),S=S+Math.imul(Ee,Ot)|0,b=b+Math.imul(Ee,Bt)|0,b=b+Math.imul(Qe,Ot)|0,M=M+Math.imul(Qe,Bt)|0,S=S+Math.imul(ke,vt)|0,b=b+Math.imul(ke,Dt)|0,b=b+Math.imul(ze,vt)|0,M=M+Math.imul(ze,Dt)|0,S=S+Math.imul(Ie,bt)|0,b=b+Math.imul(Ie,$t)|0,b=b+Math.imul(Le,bt)|0,M=M+Math.imul(Le,$t)|0,S=S+Math.imul(Ne,nt)|0,b=b+Math.imul(Ne,Ft)|0,b=b+Math.imul(Te,nt)|0,M=M+Math.imul(Te,Ft)|0,S=S+Math.imul(fe,H)|0,b=b+Math.imul(fe,V)|0,b=b+Math.imul(ve,H)|0,M=M+Math.imul(ve,V)|0,S=S+Math.imul(te,Y)|0,b=b+Math.imul(te,q)|0,b=b+Math.imul(le,Y)|0,M=M+Math.imul(le,q)|0,S=S+Math.imul(Q,pe)|0,b=b+Math.imul(Q,xe)|0,b=b+Math.imul(R,pe)|0,M=M+Math.imul(R,xe)|0;var dt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(dt>>>26)|0,dt&=67108863,S=Math.imul(Be,Ot),b=Math.imul(Be,Bt),b=b+Math.imul(et,Ot)|0,M=Math.imul(et,Bt),S=S+Math.imul(Ee,vt)|0,b=b+Math.imul(Ee,Dt)|0,b=b+Math.imul(Qe,vt)|0,M=M+Math.imul(Qe,Dt)|0,S=S+Math.imul(ke,bt)|0,b=b+Math.imul(ke,$t)|0,b=b+Math.imul(ze,bt)|0,M=M+Math.imul(ze,$t)|0,S=S+Math.imul(Ie,nt)|0,b=b+Math.imul(Ie,Ft)|0,b=b+Math.imul(Le,nt)|0,M=M+Math.imul(Le,Ft)|0,S=S+Math.imul(Ne,H)|0,b=b+Math.imul(Ne,V)|0,b=b+Math.imul(Te,H)|0,M=M+Math.imul(Te,V)|0,S=S+Math.imul(fe,Y)|0,b=b+Math.imul(fe,q)|0,b=b+Math.imul(ve,Y)|0,M=M+Math.imul(ve,q)|0,S=S+Math.imul(te,pe)|0,b=b+Math.imul(te,xe)|0,b=b+Math.imul(le,pe)|0,M=M+Math.imul(le,xe)|0;var _t=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(_t>>>26)|0,_t&=67108863,S=Math.imul(Be,vt),b=Math.imul(Be,Dt),b=b+Math.imul(et,vt)|0,M=Math.imul(et,Dt),S=S+Math.imul(Ee,bt)|0,b=b+Math.imul(Ee,$t)|0,b=b+Math.imul(Qe,bt)|0,M=M+Math.imul(Qe,$t)|0,S=S+Math.imul(ke,nt)|0,b=b+Math.imul(ke,Ft)|0,b=b+Math.imul(ze,nt)|0,M=M+Math.imul(ze,Ft)|0,S=S+Math.imul(Ie,H)|0,b=b+Math.imul(Ie,V)|0,b=b+Math.imul(Le,H)|0,M=M+Math.imul(Le,V)|0,S=S+Math.imul(Ne,Y)|0,b=b+Math.imul(Ne,q)|0,b=b+Math.imul(Te,Y)|0,M=M+Math.imul(Te,q)|0,S=S+Math.imul(fe,pe)|0,b=b+Math.imul(fe,xe)|0,b=b+Math.imul(ve,pe)|0,M=M+Math.imul(ve,xe)|0;var ot=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(ot>>>26)|0,ot&=67108863,S=Math.imul(Be,bt),b=Math.imul(Be,$t),b=b+Math.imul(et,bt)|0,M=Math.imul(et,$t),S=S+Math.imul(Ee,nt)|0,b=b+Math.imul(Ee,Ft)|0,b=b+Math.imul(Qe,nt)|0,M=M+Math.imul(Qe,Ft)|0,S=S+Math.imul(ke,H)|0,b=b+Math.imul(ke,V)|0,b=b+Math.imul(ze,H)|0,M=M+Math.imul(ze,V)|0,S=S+Math.imul(Ie,Y)|0,b=b+Math.imul(Ie,q)|0,b=b+Math.imul(Le,Y)|0,M=M+Math.imul(Le,q)|0,S=S+Math.imul(Ne,pe)|0,b=b+Math.imul(Ne,xe)|0,b=b+Math.imul(Te,pe)|0,M=M+Math.imul(Te,xe)|0;var wt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(wt>>>26)|0,wt&=67108863,S=Math.imul(Be,nt),b=Math.imul(Be,Ft),b=b+Math.imul(et,nt)|0,M=Math.imul(et,Ft),S=S+Math.imul(Ee,H)|0,b=b+Math.imul(Ee,V)|0,b=b+Math.imul(Qe,H)|0,M=M+Math.imul(Qe,V)|0,S=S+Math.imul(ke,Y)|0,b=b+Math.imul(ke,q)|0,b=b+Math.imul(ze,Y)|0,M=M+Math.imul(ze,q)|0,S=S+Math.imul(Ie,pe)|0,b=b+Math.imul(Ie,xe)|0,b=b+Math.imul(Le,pe)|0,M=M+Math.imul(Le,xe)|0;var lt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul(Be,H),b=Math.imul(Be,V),b=b+Math.imul(et,H)|0,M=Math.imul(et,V),S=S+Math.imul(Ee,Y)|0,b=b+Math.imul(Ee,q)|0,b=b+Math.imul(Qe,Y)|0,M=M+Math.imul(Qe,q)|0,S=S+Math.imul(ke,pe)|0,b=b+Math.imul(ke,xe)|0,b=b+Math.imul(ze,pe)|0,M=M+Math.imul(ze,xe)|0;var at=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(at>>>26)|0,at&=67108863,S=Math.imul(Be,Y),b=Math.imul(Be,q),b=b+Math.imul(et,Y)|0,M=Math.imul(et,q),S=S+Math.imul(Ee,pe)|0,b=b+Math.imul(Ee,xe)|0,b=b+Math.imul(Qe,pe)|0,M=M+Math.imul(Qe,xe)|0;var Ae=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,S=Math.imul(Be,pe),b=Math.imul(Be,xe),b=b+Math.imul(et,pe)|0,M=Math.imul(et,xe);var Pe=(_+S|0)+((b&8191)<<13)|0;return _=(M+(b>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,x[0]=Re,x[1]=De,x[2]=it,x[3]=Ue,x[4]=gt,x[5]=st,x[6]=tt,x[7]=At,x[8]=Rt,x[9]=Mt,x[10]=Et,x[11]=dt,x[12]=_t,x[13]=ot,x[14]=wt,x[15]=lt,x[16]=at,x[17]=Ae,x[18]=Pe,_!==0&&(x[19]=_,f.length++),f};Math.imul||(N=P);function D(G,E,m){m.negative=E.negative^G.negative,m.length=G.length+E.length;for(var f=0,g=0,v=0;v>>26)|0,g+=x>>>26,x&=67108863}m.words[v]=_,f=x,x=g}return f!==0?m.words[v]=f:m.length--,m.strip()}function k(G,E,m){var f=new B;return f.mulp(G,E,m)}s.prototype.mulTo=function(E,m){var f,g=this.length+E.length;return this.length===10&&E.length===10?f=N(this,E,m):g<63?f=P(this,E,m):g<1024?f=D(this,E,m):f=k(this,E,m),f};function B(G,E){this.x=G,this.y=E}B.prototype.makeRBT=function(E){for(var m=new Array(E),f=s.prototype._countBits(E)-1,g=0;g>=1;return g},B.prototype.permute=function(E,m,f,g,v,x){for(var _=0;_>>1)v++;return 1<>>13,f[2*x+1]=v&8191,v=v>>>13;for(x=2*m;x>=26,m+=g/67108864|0,m+=v>>>26,this.words[f]=v&67108863}return m!==0&&(this.words[f]=m,this.length++),this},s.prototype.muln=function(E){return this.clone().imuln(E)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(E){var m=A(E);if(m.length===0)return new s(1);for(var f=this,g=0;g=0);var m=E%26,f=(E-m)/26,g=67108863>>>26-m<<26-m,v;if(m!==0){var x=0;for(v=0;v>>26-m}x&&(this.words[v]=x,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var g;m?g=(m-m%26)/26:g=0;var v=E%26,x=Math.min((E-v)/26,this.length),_=67108863^67108863>>>v<x)for(this.length-=x,b=0;b=0&&(M!==0||b>=g);b--){var I=this.words[b]|0;this.words[b]=M<<26-v|I>>>v,M=I&_}return S&&M!==0&&(S.words[S.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(E,m,f){return n(this.negative===0),this.iushrn(E,m,f)},s.prototype.shln=function(E){return this.clone().ishln(E)},s.prototype.ushln=function(E){return this.clone().iushln(E)},s.prototype.shrn=function(E){return this.clone().ishrn(E)},s.prototype.ushrn=function(E){return this.clone().iushrn(E)},s.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var m=E%26,f=(E-m)/26,g=1<=0);var m=E%26,f=(E-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(m!==0&&f++,this.length=Math.min(f,this.length),m!==0){var g=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(S/67108864|0),this.words[v+f]=x&67108863}for(;v>26,this.words[v+f]=x&67108863;if(_===0)return this.strip();for(n(_===-1),_=0,v=0;v>26,this.words[v]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(E,m){var f=this.length-E.length,g=this.clone(),v=E,x=v.words[v.length-1]|0,_=this._countBits(x);f=26-_,f!==0&&(v=v.ushln(f),g.iushln(f),x=v.words[v.length-1]|0);var S=g.length-v.length,b;if(m!=="mod"){b=new s(null),b.length=S+1,b.words=new Array(b.length);for(var M=0;M=0;F--){var ae=(g.words[v.length+F]|0)*67108864+(g.words[v.length+F-1]|0);for(ae=Math.min(ae/x|0,67108863),g._ishlnsubmul(v,ae,F);g.negative!==0;)ae--,g.negative=0,g._ishlnsubmul(v,1,F),g.isZero()||(g.negative^=1);b&&(b.words[F]=ae)}return b&&b.strip(),g.strip(),m!=="div"&&f!==0&&g.iushrn(f),{div:b||null,mod:g}},s.prototype.divmod=function(E,m,f){if(n(!E.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var g,v,x;return this.negative!==0&&E.negative===0?(x=this.neg().divmod(E,m),m!=="mod"&&(g=x.div.neg()),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.iadd(E)),{div:g,mod:v}):this.negative===0&&E.negative!==0?(x=this.divmod(E.neg(),m),m!=="mod"&&(g=x.div.neg()),{div:g,mod:x.mod}):this.negative&E.negative?(x=this.neg().divmod(E.neg(),m),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.isub(E)),{div:x.div,mod:v}):E.length>this.length||this.cmp(E)<0?{div:new s(0),mod:this}:E.length===1?m==="div"?{div:this.divn(E.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new s(this.modn(E.words[0]))}:this._wordDiv(E,m)},s.prototype.div=function(E){return this.divmod(E,"div",!1).div},s.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},s.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},s.prototype.divRound=function(E){var m=this.divmod(E);if(m.mod.isZero())return m.div;var f=m.div.negative!==0?m.mod.isub(E):m.mod,g=E.ushrn(1),v=E.andln(1),x=f.cmp(g);return x<0||v===1&&x===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(E){n(E<=67108863);for(var m=(1<<26)%E,f=0,g=this.length-1;g>=0;g--)f=(m*f+(this.words[g]|0))%E;return f},s.prototype.idivn=function(E){n(E<=67108863);for(var m=0,f=this.length-1;f>=0;f--){var g=(this.words[f]|0)+m*67108864;this.words[f]=g/E|0,m=g%E}return this.strip()},s.prototype.divn=function(E){return this.clone().idivn(E)},s.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=new s(0),_=new s(1),S=0;m.isEven()&&f.isEven();)m.iushrn(1),f.iushrn(1),++S;for(var b=f.clone(),M=m.clone();!m.isZero();){for(var I=0,F=1;!(m.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(m.iushrn(I);I-- >0;)(g.isOdd()||v.isOdd())&&(g.iadd(b),v.isub(M)),g.iushrn(1),v.iushrn(1);for(var ae=0,O=1;!(f.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(f.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(b),_.isub(M)),x.iushrn(1),_.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(x),v.isub(_)):(f.isub(m),x.isub(g),_.isub(v))}return{a:x,b:_,gcd:f.iushln(S)}},s.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=f.clone();m.cmpn(1)>0&&f.cmpn(1)>0;){for(var _=0,S=1;!(m.words[0]&S)&&_<26;++_,S<<=1);if(_>0)for(m.iushrn(_);_-- >0;)g.isOdd()&&g.iadd(x),g.iushrn(1);for(var b=0,M=1;!(f.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(f.iushrn(b);b-- >0;)v.isOdd()&&v.iadd(x),v.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(v)):(f.isub(m),v.isub(g))}var I;return m.cmpn(1)===0?I=g:I=v,I.cmpn(0)<0&&I.iadd(E),I},s.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var m=this.clone(),f=E.clone();m.negative=0,f.negative=0;for(var g=0;m.isEven()&&f.isEven();g++)m.iushrn(1),f.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=m.cmp(f);if(v<0){var x=m;m=f,f=x}else if(v===0||f.cmpn(1)===0)break;m.isub(f)}while(!0);return f.iushln(g)},s.prototype.invm=function(E){return this.egcd(E).a.umod(E)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(E){return this.words[0]&E},s.prototype.bincn=function(E){n(typeof E=="number");var m=E%26,f=(E-m)/26,g=1<>>26,_&=67108863,this.words[x]=_}return v!==0&&(this.words[x]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(E){var m=E<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var f;if(this.length>1)f=1;else{m&&(E=-E),n(E<=67108863,"Number is too big");var g=this.words[0]|0;f=g===E?0:gE.length)return 1;if(this.length=0;f--){var g=this.words[f]|0,v=E.words[f]|0;if(g!==v){gv&&(m=1);break}}return m},s.prototype.gtn=function(E){return this.cmpn(E)===1},s.prototype.gt=function(E){return this.cmp(E)===1},s.prototype.gten=function(E){return this.cmpn(E)>=0},s.prototype.gte=function(E){return this.cmp(E)>=0},s.prototype.ltn=function(E){return this.cmpn(E)===-1},s.prototype.lt=function(E){return this.cmp(E)===-1},s.prototype.lten=function(E){return this.cmpn(E)<=0},s.prototype.lte=function(E){return this.cmp(E)<=0},s.prototype.eqn=function(E){return this.cmpn(E)===0},s.prototype.eq=function(E){return this.cmp(E)===0},s.red=function(E){return new ue(E)},s.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(E){return this.red=E,this},s.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},s.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},s.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},s.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},s.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},s.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},s.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},s.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var j={k256:null,p224:null,p192:null,p25519:null};function U(G,E){this.name=G,this.p=new s(E,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var E=new s(null);return E.words=new Array(Math.ceil(this.n/13)),E},U.prototype.ireduce=function(E){var m=E,f;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),f=m.bitLength();while(f>this.n);var g=f0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},U.prototype.split=function(E,m){E.iushrn(this.n,0,m)},U.prototype.imulK=function(E){return E.imul(this.k)};function K(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(K,U),K.prototype.split=function(E,m){for(var f=4194303,g=Math.min(E.length,9),v=0;v>>22,x=_}x>>>=22,E.words[v-10]=x,x===0&&E.length>10?E.length-=10:E.length-=9},K.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var m=0,f=0;f>>=26,E.words[f]=v,m=g}return m!==0&&(E.words[E.length++]=m),E},s._prime=function(E){if(j[E])return j[E];var m;if(E==="k256")m=new K;else if(E==="p224")m=new J;else if(E==="p192")m=new T;else if(E==="p25519")m=new z;else throw new Error("Unknown prime "+E);return j[E]=m,m};function ue(G){if(typeof G=="string"){var E=s._prime(G);this.m=E.p,this.prime=E}else n(G.gtn(1),"modulus must be greater than 1"),this.m=G,this.prime=null}ue.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},ue.prototype._verify2=function(E,m){n((E.negative|m.negative)===0,"red works only with positives"),n(E.red&&E.red===m.red,"red works only with red numbers")},ue.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},ue.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},ue.prototype.add=function(E,m){this._verify2(E,m);var f=E.add(m);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},ue.prototype.iadd=function(E,m){this._verify2(E,m);var f=E.iadd(m);return f.cmp(this.m)>=0&&f.isub(this.m),f},ue.prototype.sub=function(E,m){this._verify2(E,m);var f=E.sub(m);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},ue.prototype.isub=function(E,m){this._verify2(E,m);var f=E.isub(m);return f.cmpn(0)<0&&f.iadd(this.m),f},ue.prototype.shl=function(E,m){return this._verify1(E),this.imod(E.ushln(m))},ue.prototype.imul=function(E,m){return this._verify2(E,m),this.imod(E.imul(m))},ue.prototype.mul=function(E,m){return this._verify2(E,m),this.imod(E.mul(m))},ue.prototype.isqr=function(E){return this.imul(E,E.clone())},ue.prototype.sqr=function(E){return this.mul(E,E)},ue.prototype.sqrt=function(E){if(E.isZero())return E.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(E,f)}for(var g=this.m.subn(1),v=0;!g.isZero()&&g.andln(1)===0;)v++,g.iushrn(1);n(!g.isZero());var x=new s(1).toRed(this),_=x.redNeg(),S=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new s(2*b*b).toRed(this);this.pow(b,S).cmp(_)!==0;)b.redIAdd(_);for(var M=this.pow(b,g),I=this.pow(E,g.addn(1).iushrn(1)),F=this.pow(E,g),ae=v;F.cmp(x)!==0;){for(var O=F,se=0;O.cmp(x)!==0;se++)O=O.redSqr();n(se=0;v--){for(var M=m.words[v],I=b-1;I>=0;I--){var F=M>>I&1;if(x!==g[0]&&(x=this.sqr(x)),F===0&&_===0){S=0;continue}_<<=1,_|=F,S++,!(S!==f&&(v!==0||I!==0))&&(x=this.mul(x,g[_]),S=0,_=0)}b=26}return x},ue.prototype.convertTo=function(E){var m=E.umod(this.m);return m===E?m.clone():m},ue.prototype.convertFrom=function(E){var m=E.clone();return m.red=null,m},s.mont=function(E){return new _e(E)};function _e(G){ue.call(this,G),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(_e,ue),_e.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},_e.prototype.convertFrom=function(E){var m=this.imod(E.mul(this.rinv));return m.red=null,m},_e.prototype.imul=function(E,m){if(E.isZero()||m.isZero())return E.words[0]=0,E.length=1,E;var f=E.imul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.mul=function(E,m){if(E.isZero()||m.isZero())return new s(0)._forceRed(this);var f=E.mul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.invm=function(E){var m=this.imod(E._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,nn)}(Wm);var xo=Wm.exports,Km={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var u=0;u>8,p=l&255;d?a.push(d,p):a.push(p)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(N>>1)-1?k=(N>>1)-B:k=B,D.isubn(k)):k=0,A[P]=k,D.iushrn(1)}return A}e.getNAF=s;function o(d,p){var y=[[],[]];d=d.clone(),p=p.clone();for(var A=0,P=0,N;d.cmpn(-A)>0||p.cmpn(-P)>0;){var D=d.andln(3)+A&3,k=p.andln(3)+P&3;D===3&&(D=-1),k===3&&(k=-1);var B;D&1?(N=d.andln(7)+A&7,(N===3||N===5)&&k===2?B=-D:B=D):B=0,y[0].push(B);var j;k&1?(N=p.andln(7)+P&7,(N===3||N===5)&&D===2?j=-k:j=k):j=0,y[1].push(j),2*A===B+1&&(A=1-A),2*P===j+1&&(P=1-P),d.iushrn(1),p.iushrn(1)}return y}e.getJSF=o;function a(d,p,y){var A="_"+p;d.prototype[p]=function(){return this[A]!==void 0?this[A]:this[A]=y.call(this)}}e.cachedProperty=a;function u(d){return typeof d=="string"?e.toArray(d,"hex"):d}e.parseBytes=u;function l(d){return new r(d,"hex","le")}e.intFromLE=l}(Ti);var Vm={exports:{}},Gm;Vm.exports=function(e){return Gm||(Gm=new aa(null)),Gm.generate(e)};function aa(t){this.rand=t}if(Vm.exports.Rand=aa,aa.prototype.generate=function(e){return this._rand(e)},aa.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Rd=ca;ca.prototype.point=function(){throw new Error("Not implemented")},ca.prototype.validate=function(){throw new Error("Not implemented")},ca.prototype._fixedNafMul=function(e,r){Td(e.precomputed);var n=e._getDoubles(),i=Cd(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Td(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},ca.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=Cd(n[P],o[P],this._bitLength),u[N]=Cd(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=Nk(n[P],n[N]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[N]=new Array(l),p=0;p=0;d--){for(var T=0;d>=0;){var z=!0;for(p=0;p=0&&T++,K=K.dblp(T),d<0)break;for(p=0;p0?y=a[p][ue-1>>1]:ue<0&&(y=a[p][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Ki.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),p.negative&&(p=p.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:p,b:y},{a:A,b:P}]},Vi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Vi.prototype.pointFromX=function(e,r){e=new en(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Vi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Vi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},On.prototype.isInfinity=function(){return this.inf},On.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},On.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},On.prototype.getX=function(){return this.x.fromRed()},On.prototype.getY=function(){return this.y.fromRed()},On.prototype.mul=function(e){return e=new en(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},On.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},On.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},On.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},On.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},On.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function qn(t,e,r,n){bu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new en(0)):(this.x=new en(e,16),this.y=new en(r,16),this.z=new en(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Jm(qn,bu.BasePoint),Vi.prototype.jpoint=function(e,r,n){return new qn(this,e,r,n)},qn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},qn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},qn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(p).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(p)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},qn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),A=u.redMul(p.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},qn.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},qn.prototype.inspect=function(){return this.isInfinity()?"":""},qn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var yu=xo,I3=yd,Dd=Rd,$k=Ti;function wu(t){Dd.call(this,"mont",t),this.a=new yu(t.a,16).toRed(this.red),this.b=new yu(t.b,16).toRed(this.red),this.i4=new yu(4).toRed(this.red).redInvm(),this.two=new yu(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}I3(wu,Dd);var Fk=wu;wu.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function Nn(t,e,r){Dd.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new yu(e,16),this.z=new yu(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}I3(Nn,Dd.BasePoint),wu.prototype.decodePoint=function(e,r){return this.point($k.toArray(e,r),1)},wu.prototype.point=function(e,r){return new Nn(this,e,r)},wu.prototype.pointFromJSON=function(e){return Nn.fromJSON(this,e)},Nn.prototype.precompute=function(){},Nn.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Nn.fromJSON=function(e,r){return new Nn(e,r[0],r[1]||e.one)},Nn.prototype.inspect=function(){return this.isInfinity()?"":""},Nn.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Nn.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)},Nn.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),u=s.redMul(i),l=r.z.redMul(a.redAdd(u).redSqr()),d=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(l,d)},Nn.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i},Nn.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Nn.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Nn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var jk=Ti,_o=xo,C3=yd,Od=Rd,Uk=jk.assert;function zs(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Od.call(this,"edwards",t),this.a=new _o(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new _o(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new _o(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Uk(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}C3(zs,Od);var qk=zs;zs.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},zs.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},zs.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)},zs.prototype.pointFromX=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var u=a.fromRed().isOdd();return(r&&!u||!r&&u)&&(a=a.redNeg()),this.point(e,a)},zs.prototype.pointFromY=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)},zs.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function Hr(t,e,r,n,i){Od.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new _o(e,16),this.y=new _o(r,16),this.z=n?new _o(n,16):this.curve.one,this.t=i&&new _o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}C3(Hr,Od.BasePoint),zs.prototype.pointFromJSON=function(e){return Hr.fromJSON(this,e)},zs.prototype.point=function(e,r,n,i){return new Hr(this,e,r,n,i)},Hr.fromJSON=function(e,r){return new Hr(e,r[0],r[1],r[2])},Hr.prototype.inspect=function(){return this.isInfinity()?"":""},Hr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Hr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),u=i.redSub(r),l=s.redMul(a),d=o.redMul(u),p=s.redMul(u),y=a.redMul(o);return this.curve.point(l,d,y,p)},Hr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,u,l;if(this.curve.twisted){a=this.curve._mulA(r);var d=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(d.redSub(this.curve.two)),s=d.redMul(a.redSub(n)),o=d.redSqr().redSub(d).redSub(d)):(u=this.z.redSqr(),l=d.redSub(u).redISub(u),i=e.redSub(r).redISub(n).redMul(l),s=d.redMul(a.redSub(n)),o=d.redMul(l))}else a=r.redAdd(n),u=this.curve._mulC(this.z).redSqr(),l=a.redSub(u).redSub(u),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)},Hr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Hr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),u=s.redAdd(i),l=n.redAdd(r),d=o.redMul(a),p=u.redMul(l),y=o.redMul(l),A=a.redMul(u);return this.curve.point(d,p,A,y)},Hr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),u=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),d=r.redMul(a).redMul(l),p,y;return this.curve.twisted?(p=r.redMul(u).redMul(s.redSub(this.curve._mulA(i))),y=a.redMul(u)):(p=r.redMul(u).redMul(s.redSub(i)),y=this.curve._mulC(a).redMul(u)),this.curve.point(d,p,y)},Hr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Hr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Hr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)},Hr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)},Hr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Hr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Hr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Hr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Hr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Hr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Hr.prototype.toP=Hr.prototype.normalize,Hr.prototype.mixedAdd=Hr.prototype.add,function(t){var e=t;e.base=Rd,e.short=Bk,e.mont=Fk,e.edwards=qk}(Ym);var Nd={},Xm,T3;function zk(){return T3||(T3=1,Xm={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Xm}(function(t){var e=t,r=al,n=Ym,i=Ti,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,d){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var p=new o(d);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:p}),p}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=zk()}catch{u=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})})(Nd);var Hk=al,Za=Km,R3=Ga;function ua(t){if(!(this instanceof ua))return new ua(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Za.toArray(t.entropy,t.entropyEnc||"hex"),r=Za.toArray(t.nonce,t.nonceEnc||"hex"),n=Za.toArray(t.pers,t.persEnc||"hex");R3(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Wk=ua;ua.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ua.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Za.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var Ld=xo,Qm=Ti,Yk=Qm.assert;function kd(t,e){if(t instanceof kd)return t;this._importDER(t,e)||(Yk(t.r&&t.s,"Signature without r or s"),this.r=new Ld(t.r,16),this.s=new Ld(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Jk=kd;function Xk(){this.place=0}function e1(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function D3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}kd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=D3(r),n=D3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];t1(i,r.length),i=i.concat(r),i.push(2),t1(i,n.length);var s=i.concat(n),o=[48];return t1(o,s.length),o=o.concat(s),Qm.encode(o,e)};var Eo=xo,O3=Wk,Zk=Ti,r1=Nd,Qk=M3,N3=Zk.assert,n1=Gk,Bd=Jk;function Gi(t){if(!(this instanceof Gi))return new Gi(t);typeof t=="string"&&(N3(Object.prototype.hasOwnProperty.call(r1,t),"Unknown curve "+t),t=r1[t]),t instanceof r1.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var eB=Gi;Gi.prototype.keyPair=function(e){return new n1(this,e)},Gi.prototype.keyFromPrivate=function(e,r){return n1.fromPrivate(this,e,r)},Gi.prototype.keyFromPublic=function(e,r){return n1.fromPublic(this,e,r)},Gi.prototype.genKeyPair=function(e){e||(e={});for(var r=new O3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Qk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new Eo(2));;){var s=new Eo(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Gi.prototype._truncateToN=function(e,r,n){var i;if(Eo.isBN(e)||typeof e=="number")e=new Eo(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new Eo(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new Eo(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Gi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new O3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new Eo(1)),d=0;;d++){var p=i.k?i.k(d):new Eo(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new Bd({r:P,s:N,recoveryParam:D})}}}}}},Gi.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new Bd(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),l=u.mul(e).umod(this.n),d=u.mul(o).umod(this.n),p;return this.curve._maxwellTrick?(p=this.g.jmulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.eqXToP(o)):(p=this.g.mulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.getX().umod(this.n).cmp(o)===0)},Gi.prototype.recoverPubKey=function(t,e,r,n){N3((3&r)===r,"The recovery param is more than two bits"),e=new Bd(e,n);var i=this.n,s=new Eo(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Gi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Bd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dl=Ti,L3=dl.assert,k3=dl.parseBytes,xu=dl.cachedProperty;function Ln(t,e){this.eddsa=t,this._secret=k3(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=k3(e.pub)}Ln.fromPublic=function(e,r){return r instanceof Ln?r:new Ln(e,{pub:r})},Ln.fromSecret=function(e,r){return r instanceof Ln?r:new Ln(e,{secret:r})},Ln.prototype.secret=function(){return this._secret},xu(Ln,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),xu(Ln,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),xu(Ln,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i}),xu(Ln,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),xu(Ln,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),xu(Ln,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Ln.prototype.sign=function(e){return L3(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Ln.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},Ln.prototype.getSecret=function(e){return L3(this._secret,"KeyPair is public only"),dl.encode(this.secret(),e)},Ln.prototype.getPublic=function(e){return dl.encode(this.pubBytes(),e)};var tB=Ln,rB=xo,$d=Ti,B3=$d.assert,Fd=$d.cachedProperty,nB=$d.parseBytes;function Qa(t,e){this.eddsa=t,typeof e!="object"&&(e=nB(e)),Array.isArray(e)&&(B3(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),B3(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof rB&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Fd(Qa,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Fd(Qa,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Fd(Qa,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Fd(Qa,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Qa.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Qa.prototype.toHex=function(){return $d.encode(this.toBytes(),"hex").toUpperCase()};var iB=Qa,sB=al,oB=Nd,_u=Ti,aB=_u.assert,$3=_u.parseBytes,F3=tB,j3=iB;function vi(t){if(aB(t==="ed25519","only tested with ed25519 so far"),!(this instanceof vi))return new vi(t);t=oB[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=sB.sha512}var cB=vi;vi.prototype.sign=function(e,r){e=$3(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),u=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:u,Rencoded:o})},vi.prototype.verify=function(e,r,n){if(e=$3(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)},vi.prototype.hashInt=function(){for(var e=this.hash(),r=0;re in t?lB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,H3=(t,e)=>{for(var r in e||(e={}))hB.call(e,r)&&z3(t,r,e[r]);if(q3)for(var r of q3(e))dB.call(e,r)&&z3(t,r,e[r]);return t};const pB="ReactNative",Ri={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},gB="js";function jd(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Su(){return!nl()&&!!mm()&&navigator.product===pB}function pl(){return!jd()&&!!mm()&&!!nl()}function gl(){return Su()?Ri.reactNative:jd()?Ri.node:pl()?Ri.browser:Ri.unknown}function mB(){var t;try{return Su()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function vB(t,e){let r=il.parse(t);return r=H3(H3({},r),e),t=il.stringify(r),t}function W3(){return Ax()||{name:"",description:"",url:"",icons:[""]}}function bB(){if(gl()===Ri.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=HO();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function yB(){var t;const e=gl();return e===Ri.browser?[e,((t=Sx())==null?void 0:t.host)||"unknown"].join(":"):e}function K3(t,e,r){const n=bB(),i=yB();return[[t,e].join("-"),[gB,r].join("-"),n,i].join("/")}function wB({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const u=r.split("?"),l=K3(t,e,n),d={auth:i,ua:l,projectId:s,useOnCloseEvent:o,origin:a||void 0},p=vB(u[1]||"",d);return u[0]+"?"+p}function ec(t,e){return t.filter(r=>e.includes(r)).length===t.length}function V3(t){return Object.fromEntries(t.entries())}function G3(t){return new Map(Object.entries(t))}function tc(t=mt.FIVE_MINUTES,e){const r=mt.toMiliseconds(t||mt.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Au(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function Y3(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function xB(t){return Y3("topic",t)}function _B(t){return Y3("id",t)}function J3(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function En(t,e){return mt.fromMiliseconds(Date.now()+mt.toMiliseconds(t))}function fa(t){return Date.now()>=mt.toMiliseconds(t)}function vr(t,e){return`${t}${e?`:${e}`:""}`}function Ud(t=[],e=[]){return[...new Set([...t,...e])]}async function EB({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=SB(s,t,e),a=gl();if(a===Ri.browser){if(!((n=nl())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,PB()?"_blank":"_self","noreferrer noopener")}else a===Ri.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function SB(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${MB(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function AB(t,e){let r="";try{if(pl()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function X3(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function Z3(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function i1(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function PB(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function MB(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function Q3(t){return Buffer.from(t,"base64").toString("utf-8")}const IB="https://rpc.walletconnect.org/v1";async function CB(t,e,r,n,i,s){switch(r.t){case"eip191":return TB(t,e,r.s);case"eip1271":return await RB(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function TB(t,e,r){return yk(Ux(e),r).toLowerCase()===t.toLowerCase()}async function RB(t,e,r,n,i,s){const o=Eu(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",d=r.substring(2),p=Ux(e).substring(2),y=a+p+u+l+d,A=await fetch(`${s||IB}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:DB(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:y},"latest"]})}),{result:P}=await A.json();return P?P.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function DB(){return Date.now()+Math.floor(Math.random()*1e3)}var OB=Object.defineProperty,NB=Object.defineProperties,LB=Object.getOwnPropertyDescriptors,e_=Object.getOwnPropertySymbols,kB=Object.prototype.hasOwnProperty,BB=Object.prototype.propertyIsEnumerable,t_=(t,e,r)=>e in t?OB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$B=(t,e)=>{for(var r in e||(e={}))kB.call(e,r)&&t_(t,r,e[r]);if(e_)for(var r of e_(e))BB.call(e,r)&&t_(t,r,e[r]);return t},FB=(t,e)=>NB(t,LB(e));const jB="did:pkh:",s1=t=>t==null?void 0:t.split(":"),UB=t=>{const e=t&&s1(t);if(e)return t.includes(jB)?e[3]:e[1]},o1=t=>{const e=t&&s1(t);if(e)return e[2]+":"+e[3]},qd=t=>{const e=t&&s1(t);if(e)return e.pop()};async function r_(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=n_(i,i.iss),o=qd(i.iss);return await CB(o,s,n,o1(i.iss),r)}const n_=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=qd(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${UB(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,d=t.exp?`Expiration Time: ${t.exp}`:void 0,p=t.nbf?`Not Before: ${t.nbf}`:void 0,y=t.requestId?`Request ID: ${t.requestId}`:void 0,A=t.resources?`Resources:${t.resources.map(N=>` +- ${N}`).join("")}`:void 0,P=zd(t.resources);if(P){const N=ml(P);i=JB(i,N)}return[r,n,"",i,"",s,o,a,u,l,d,p,y,A].filter(N=>N!=null).join(` +`)};function qB(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function zB(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function rc(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function HB(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:WB(e,r,n)}}}function WB(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function i_(t){return rc(t),`urn:recap:${qB(t).replace(/=/g,"")}`}function ml(t){const e=zB(t.replace("urn:recap:",""));return rc(e),e}function KB(t,e,r){const n=HB(t,e,r);return i_(n)}function VB(t){return t&&t.includes("urn:recap:")}function GB(t,e){const r=ml(t),n=ml(e),i=YB(r,n);return i_(i)}function YB(t,e){rc(t),rc(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,u)=>a.localeCompare(u)).forEach(a=>{var u,l;n.att[i]=FB($B({},n.att[i]),{[a]:((u=t.att[i])==null?void 0:u[a])||((l=e.att[i])==null?void 0:l[a])})})}),n}function JB(t="",e){rc(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const u=Object.keys(e.att[a]).map(p=>({ability:p.split("/")[0],action:p.split("/")[1]}));u.sort((p,y)=>p.action.localeCompare(y.action));const l={};u.forEach(p=>{l[p.ability]||(l[p.ability]=[]),l[p.ability].push(p.action)});const d=Object.keys(l).map(p=>(i++,`(${i}) '${p}': '${l[p].join("', '")}' for '${a}'.`));n.push(d.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function s_(t){var e;const r=ml(t);rc(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function o_(t){const e=ml(t);rc(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function zd(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return VB(e)?e:void 0}const a_="base10",ni="base16",la="base64pad",vl="base64url",bl="utf8",c_=0,So=1,yl=2,XB=0,u_=1,wl=12,a1=32;function ZB(){const t=Hm.generateKeyPair();return{privateKey:Tn(t.secretKey,ni),publicKey:Tn(t.publicKey,ni)}}function c1(){const t=ta.randomBytes(a1);return Tn(t,ni)}function QB(t,e){const r=Hm.sharedKey(Rn(t,ni),Rn(e,ni),!0),n=new Dk(ll.SHA256,r).expand(a1);return Tn(n,ni)}function Hd(t){const e=ll.hash(Rn(t,ni));return Tn(e,ni)}function Ao(t){const e=ll.hash(Rn(t,bl));return Tn(e,ni)}function f_(t){return Rn(`${t}`,a_)}function nc(t){return Number(Tn(t,a_))}function e$(t){const e=f_(typeof t.type<"u"?t.type:c_);if(nc(e)===So&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Rn(t.senderPublicKey,ni):void 0,n=typeof t.iv<"u"?Rn(t.iv,ni):ta.randomBytes(wl),i=new Um.ChaCha20Poly1305(Rn(t.symKey,ni)).seal(n,Rn(t.message,bl));return l_({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function t$(t,e){const r=f_(yl),n=ta.randomBytes(wl),i=Rn(t,bl);return l_({type:r,sealed:i,iv:n,encoding:e})}function r$(t){const e=new Um.ChaCha20Poly1305(Rn(t.symKey,ni)),{sealed:r,iv:n}=xl({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Tn(i,bl)}function n$(t,e){const{sealed:r}=xl({encoded:t,encoding:e});return Tn(r,bl)}function l_(t){const{encoding:e=la}=t;if(nc(t.type)===yl)return Tn(pd([t.type,t.sealed]),e);if(nc(t.type)===So){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Tn(pd([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return Tn(pd([t.type,t.iv,t.sealed]),e)}function xl(t){const{encoded:e,encoding:r=la}=t,n=Rn(e,r),i=n.slice(XB,u_),s=u_;if(nc(i)===So){const l=s+a1,d=l+wl,p=n.slice(s,l),y=n.slice(l,d),A=n.slice(d);return{type:i,sealed:A,iv:y,senderPublicKey:p}}if(nc(i)===yl){const l=n.slice(s),d=ta.randomBytes(wl);return{type:i,sealed:l,iv:d}}const o=s+wl,a=n.slice(s,o),u=n.slice(o);return{type:i,sealed:u,iv:a}}function i$(t,e){const r=xl({encoded:t,encoding:e==null?void 0:e.encoding});return h_({type:nc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Tn(r.senderPublicKey,ni):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function h_(t){const e=(t==null?void 0:t.type)||c_;if(e===So){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function d_(t){return t.type===So&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function p_(t){return t.type===yl}function s$(t){return new A3.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function o$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function a$(t){return Buffer.from(o$(t),"base64")}function c$(t,e){const[r,n,i]=t.split("."),s=a$(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),u=`${r}.${n}`,l=new ll.SHA256().update(Buffer.from(u)).digest(),d=s$(e),p=Buffer.from(l).toString("hex");if(!d.verify(p,{r:o,s:a}))throw new Error("Invalid signature");return gm(t).payload}const u$="irn";function u1(t){return(t==null?void 0:t.relay)||{protocol:u$}}function _l(t){const e=uB[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var f$=Object.defineProperty,l$=Object.defineProperties,h$=Object.getOwnPropertyDescriptors,g_=Object.getOwnPropertySymbols,d$=Object.prototype.hasOwnProperty,p$=Object.prototype.propertyIsEnumerable,m_=(t,e,r)=>e in t?f$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v_=(t,e)=>{for(var r in e||(e={}))d$.call(e,r)&&m_(t,r,e[r]);if(g_)for(var r of g_(e))p$.call(e,r)&&m_(t,r,e[r]);return t},g$=(t,e)=>l$(t,h$(e));function m$(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function b_(t){if(!t.includes("wc:")){const u=Q3(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=il.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:v$(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:m$(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function v$(t){return t.startsWith("//")?t.substring(2):t}function b$(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function y_(t){return`${t.protocol}:${t.topic}@${t.version}?`+il.stringify(v_(g$(v_({symKey:t.symKey},b$(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Wd(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Pu(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function y$(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Pu(r.accounts))}),e}function w$(t,e){const r=[];return Object.values(t).forEach(n=>{Pu(n.accounts).includes(e)&&r.push(...n.methods)}),r}function x$(t,e){const r=[];return Object.values(t).forEach(n=>{Pu(n.accounts).includes(e)&&r.push(...n.events)}),r}function f1(t){return t.includes(":")}function El(t){return f1(t)?t.split(":")[0]:t}function _$(t){const e={};return t==null||t.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function w_(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=_$(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=Ud(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const E$={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},S$={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ut(t,e){const{message:r,code:n}=S$[t];return{message:e?`${r} ${e}`:r,code:n}}function Dr(t,e){const{message:r,code:n}=E$[t];return{message:e?`${r} ${e}`:r,code:n}}function ic(t,e){return!!Array.isArray(t)}function Sl(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function bi(t){return typeof t>"u"}function an(t,e){return e&&bi(t)?!0:typeof t=="string"&&!!t.trim().length}function l1(t,e){return typeof t=="number"&&!isNaN(t)}function A$(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return ec(i,n)?(n.forEach(o=>{const{accounts:a,methods:u,events:l}=t.namespaces[o],d=Pu(a),p=r[o];(!ec(U3(o,p),d)||!ec(p.methods,u)||!ec(p.events,l))&&(s=!1)}),s):!1}function Kd(t){return an(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function P$(t){if(an(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Kd(r)}}return!1}function M$(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(an(t,!1)){if(e(t))return!0;const r=Q3(t);return e(r)}}catch{}return!1}function I$(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function C$(t){return t==null?void 0:t.topic}function T$(t,e){let r=null;return an(t==null?void 0:t.publicKey,!1)||(r=ut("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function x_(t){let e=!0;return ic(t)?t.length&&(e=t.every(r=>an(r,!1))):e=!1,e}function R$(t,e,r){let n=null;return ic(e)&&e.length?e.forEach(i=>{n||Kd(i)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Kd(t)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function D$(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=R$(i,U3(i,s),`${e} ${r}`);o&&(n=o)}),n}function O$(t,e){let r=null;return ic(t)?t.forEach(n=>{r||P$(n)||(r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function N$(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=O$(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function L$(t,e){let r=null;return x_(t==null?void 0:t.methods)?x_(t==null?void 0:t.events)||(r=Dr("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Dr("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function __(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=L$(n,`${e}, namespace`);i&&(r=i)}),r}function k$(t,e,r){let n=null;if(t&&Sl(t)){const i=__(t,e);i&&(n=i);const s=D$(t,e,r);s&&(n=s)}else n=ut("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function h1(t,e){let r=null;if(t&&Sl(t)){const n=__(t,e);n&&(r=n);const i=N$(t,e);i&&(r=i)}else r=ut("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function E_(t){return an(t.protocol,!0)}function B$(t,e){let r=!1;return t?t&&ic(t)&&t.length&&t.forEach(n=>{r=E_(n)}):r=!0,r}function $$(t){return typeof t=="number"}function yi(t){return typeof t<"u"&&typeof t!==null}function F$(t){return!(!t||typeof t!="object"||!t.code||!l1(t.code)||!t.message||!an(t.message,!1))}function j$(t){return!(bi(t)||!an(t.method,!1))}function U$(t){return!(bi(t)||bi(t.result)&&bi(t.error)||!l1(t.id)||!an(t.jsonrpc,!1))}function q$(t){return!(bi(t)||!an(t.name,!1))}function S_(t,e){return!(!Kd(e)||!y$(t).includes(e))}function z$(t,e,r){return an(r,!1)?w$(t,e).includes(r):!1}function H$(t,e,r){return an(r,!1)?x$(t,e).includes(r):!1}function A_(t,e,r){let n=null;const i=W$(t),s=K$(e),o=Object.keys(i),a=Object.keys(s),u=P_(Object.keys(t)),l=P_(Object.keys(e)),d=u.filter(p=>!l.includes(p));return d.length&&(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${d.toString()} Received: ${Object.keys(e).toString()}`)),ec(o,a)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} - Approved: ${a.toString()}`)),Object.keys(e).forEach(g=>{if(!g.includes(":")||n)return;const y=Pu(e[g].accounts);y.includes(g)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${g} - Required: ${g} - Approved: ${y.toString()}`))}),o.forEach(g=>{n||(ec(i[g].methods,s[g].methods)?ec(i[g].events,s[g].events)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${g}`)):n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${g}`))}),n}function W$(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function P_(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function K$(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Pu(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function V$(t,e){return l1(t)&&t<=e.max&&t>=e.min}function M_(){const t=gl();return new Promise(e=>{switch(t){case Ri.browser:e(G$());break;case Ri.reactNative:e(Y$());break;case Ri.node:e(J$());break;default:e(!0)}})}function G$(){return pl()&&(navigator==null?void 0:navigator.onLine)}async function Y$(){if(Su()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function J$(){return!0}function X$(t){switch(gl()){case Ri.browser:Z$(t);break;case Ri.reactNative:Q$(t);break}}function Z$(t){!Su()&&pl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function Q$(t){Su()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const d1={};class Al{static get(e){return d1[e]}static set(e,r){d1[e]=r}static delete(e){delete d1[e]}}const eF="PARSE_ERROR",tF="INVALID_REQUEST",rF="METHOD_NOT_FOUND",nF="INVALID_PARAMS",I_="INTERNAL_ERROR",p1="SERVER_ERROR",iF=[-32700,-32600,-32601,-32602,-32603],Pl={[eF]:{code:-32700,message:"Parse error"},[tF]:{code:-32600,message:"Invalid Request"},[rF]:{code:-32601,message:"Method not found"},[nF]:{code:-32602,message:"Invalid params"},[I_]:{code:-32603,message:"Internal error"},[p1]:{code:-32e3,message:"Server error"}},C_=p1;function sF(t){return iF.includes(t)}function T_(t){return Object.keys(Pl).includes(t)?Pl[t]:Pl[C_]}function oF(t){const e=Object.values(Pl).find(r=>r.code===t);return e||Pl[C_]}function R_(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var D_={},Po={},O_;function aF(){if(O_)return Po;O_=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.isBrowserCryptoAvailable=Po.getSubtleCrypto=Po.getBrowerCrypto=void 0;function t(){return(nn==null?void 0:nn.crypto)||(nn==null?void 0:nn.msCrypto)||{}}Po.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Po.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Po.isBrowserCryptoAvailable=r,Po}var Mo={},N_;function cF(){if(N_)return Mo;N_=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.isBrowser=Mo.isNode=Mo.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Mo.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Mo.isNode=e;function r(){return!t()&&!e()}return Mo.isBrowser=r,Mo}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(aF(),t),e.__exportStar(cF(),t)})(D_);function ha(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function sc(t=6){return BigInt(ha(t))}function da(t,e,r){return{id:r||ha(),jsonrpc:"2.0",method:t,params:e}}function Vd(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Gd(t,e,r){return{id:t,jsonrpc:"2.0",error:uF(e)}}function uF(t,e){return typeof t>"u"?T_(I_):(typeof t=="string"&&(t=Object.assign(Object.assign({},T_(p1)),{message:t})),sF(t.code)&&(t=oF(t.code)),t)}let fF=class{},lF=class extends fF{constructor(){super()}},hF=class extends lF{constructor(e){super()}};const dF="^https?:",pF="^wss?:";function gF(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function L_(t,e){const r=gF(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function k_(t){return L_(t,dF)}function B_(t){return L_(t,pF)}function mF(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function $_(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function g1(t){return $_(t)&&"method"in t}function Yd(t){return $_(t)&&(Hs(t)||Yi(t))}function Hs(t){return"result"in t}function Yi(t){return"error"in t}let Ji=class extends hF{constructor(e){super(e),this.events=new qi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(da(e.method,e.params||[],e.id||sc().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Yi(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Yd(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const vF=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),bF=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",F_=t=>t.split("?")[0],j_=10,yF=vF();let wF=class{constructor(e){if(this.url=e,this.events=new qi.EventEmitter,this.registering=!1,!B_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(mo(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!B_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=D_.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!mF(e)},o=new yF(e,[],s);bF()?o.onerror=a=>{const u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ka(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return R_(e,F_(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>j_&&this.events.setMaxListeners(j_)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${F_(this.url)}`));return this.events.emit("register_error",r),r}};var Jd={exports:{}};Jd.exports,function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",u="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",g="[object Date]",y="[object Error]",A="[object Function]",P="[object GeneratorFunction]",N="[object Map]",D="[object Number]",k="[object Null]",B="[object Object]",j="[object Promise]",U="[object Proxy]",K="[object RegExp]",J="[object Set]",T="[object String]",z="[object Symbol]",ue="[object Undefined]",_e="[object WeakMap]",G="[object ArrayBuffer]",E="[object DataView]",m="[object Float32Array]",f="[object Float64Array]",p="[object Int8Array]",v="[object Int16Array]",x="[object Int32Array]",_="[object Uint8Array]",S="[object Uint8ClampedArray]",b="[object Uint16Array]",M="[object Uint32Array]",I=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,O={};O[m]=O[f]=O[p]=O[v]=O[x]=O[_]=O[S]=O[b]=O[M]=!0,O[a]=O[u]=O[G]=O[d]=O[E]=O[g]=O[y]=O[A]=O[N]=O[D]=O[B]=O[K]=O[J]=O[T]=O[_e]=!1;var se=typeof nn=="object"&&nn&&nn.Object===Object&&nn,ee=typeof self=="object"&&self&&self.Object===Object&&self,X=se||ee||Function("return this")(),Q=e&&!e.nodeType&&e,R=Q&&!0&&t&&!t.nodeType&&t,Z=R&&R.exports===Q,te=Z&&se.process,le=function(){try{return te&&te.binding&&te.binding("util")}catch{}}(),ie=le&&le.isTypedArray;function fe(ce,ye){for(var Ye=-1,It=ce==null?0:ce.length,jr=0,ir=[];++Ye-1}function st(ce,ye){var Ye=this.__data__,It=Xe(Ye,ce);return It<0?(++this.size,Ye.push([ce,ye])):Ye[It][1]=ye,this}Re.prototype.clear=De,Re.prototype.delete=it,Re.prototype.get=Ue,Re.prototype.has=gt,Re.prototype.set=st;function tt(ce){var ye=-1,Ye=ce==null?0:ce.length;for(this.clear();++yewn))return!1;var Ur=ir.get(ce);if(Ur&&ir.get(ye))return Ur==ye;var gn=-1,_i=!0,xn=Ye&s?new _t:void 0;for(ir.set(ce,ye),ir.set(ye,ce);++gn-1&&ce%1==0&&ce-1&&ce%1==0&&ce<=o}function up(ce){var ye=typeof ce;return ce!=null&&(ye=="object"||ye=="function")}function Pc(ce){return ce!=null&&typeof ce=="object"}var fp=ie?Te(ie):dr;function Ub(ce){return Fb(ce)?qe(ce):pr(ce)}function Fr(){return[]}function kr(){return!1}t.exports=jb}(Jd,Jd.exports);var xF=Jd.exports;const _F=ji(xF),U_="wc",q_=2,z_="core",Ws=`${U_}@2:${z_}:`,EF={logger:"error"},SF={database:":memory:"},AF="crypto",H_="client_ed25519_seed",PF=mt.ONE_DAY,MF="keychain",IF="0.3",CF="messages",TF="0.3",RF=mt.SIX_HOURS,DF="publisher",W_="irn",OF="error",K_="wss://relay.walletconnect.org",NF="relayer",ii={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},LF="_subscription",Xi={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},kF=.1,m1="2.17.2",Wr={link_mode:"link_mode",relay:"relay"},BF="0.3",$F="WALLETCONNECT_CLIENT_ID",V_="WALLETCONNECT_LINK_MODE_APPS",Ks={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},FF="subscription",jF="0.3",UF=mt.FIVE_SECONDS*1e3,qF="pairing",zF="0.3",Ml={wc_pairingDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:0},res:{ttl:mt.ONE_DAY,prompt:!1,tag:0}}},oc={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},bs={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},HF="history",WF="0.3",KF="expirer",Zi={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},VF="0.3",GF="verify-api",YF="https://verify.walletconnect.com",G_="https://verify.walletconnect.org",Il=G_,JF=`${Il}/v3`,XF=[YF,G_],ZF="echo",QF="https://echo.walletconnect.com",Vs={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},Io={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},ys={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},ac={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},cc={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Cl={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},ej=.1,tj="event-client",rj=86400,nj="https://pulse.walletconnect.org/batch";function ij(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(j);k!==B;){for(var K=P[k],J=0,T=j-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=j-D;z!==j&&U[z]===0;)z++;for(var ue=u.repeat(N);z>>0,j=new Uint8Array(B);P[N];){var U=r[P.charCodeAt(N)];if(U===255)return;for(var K=0,J=B-1;(U!==0||K>>0,j[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,N++}if(P[N]!==" "){for(var T=B-k;T!==B&&j[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=j[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:g,decodeUnsafe:y,decode:A}}var sj=ij,oj=sj;const Y_=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},aj=t=>new TextEncoder().encode(t),cj=t=>new TextDecoder().decode(t);class uj{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class fj{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return J_(this,e)}}class lj{constructor(e){this.decoders=e}or(e){return J_(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const J_=(t,e)=>new lj({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class hj{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new uj(e,r,n),this.decoder=new fj(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Xd=({name:t,prefix:e,encode:r,decode:n})=>new hj(t,e,r,n),Tl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=oj(r,e);return Xd({prefix:t,name:e,encode:n,decode:s=>Y_(i(s))})},dj=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},pj=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Xd({prefix:e,name:t,encode(i){return pj(i,n,r)},decode(i){return dj(i,n,r,t)}}),gj=Xd({prefix:"\0",name:"identity",encode:t=>cj(t),decode:t=>aj(t)});var mj=Object.freeze({__proto__:null,identity:gj});const vj=zn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var bj=Object.freeze({__proto__:null,base2:vj});const yj=zn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var wj=Object.freeze({__proto__:null,base8:yj});const xj=Tl({prefix:"9",name:"base10",alphabet:"0123456789"});var _j=Object.freeze({__proto__:null,base10:xj});const Ej=zn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Sj=zn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Aj=Object.freeze({__proto__:null,base16:Ej,base16upper:Sj});const Pj=zn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Mj=zn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ij=zn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Cj=zn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Tj=zn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Rj=zn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Dj=zn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Oj=zn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Nj=zn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Lj=Object.freeze({__proto__:null,base32:Pj,base32upper:Mj,base32pad:Ij,base32padupper:Cj,base32hex:Tj,base32hexupper:Rj,base32hexpad:Dj,base32hexpadupper:Oj,base32z:Nj});const kj=Tl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Bj=Tl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var $j=Object.freeze({__proto__:null,base36:kj,base36upper:Bj});const Fj=Tl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),jj=Tl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Uj=Object.freeze({__proto__:null,base58btc:Fj,base58flickr:jj});const qj=zn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zj=zn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Hj=zn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Wj=zn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Kj=Object.freeze({__proto__:null,base64:qj,base64pad:zj,base64url:Hj,base64urlpad:Wj});const X_=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Vj=X_.reduce((t,e,r)=>(t[r]=e,t),[]),Gj=X_.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Yj(t){return t.reduce((e,r)=>(e+=Vj[r],e),"")}function Jj(t){const e=[];for(const r of t){const n=Gj[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const Xj=Xd({prefix:"🚀",name:"base256emoji",encode:Yj,decode:Jj});var Zj=Object.freeze({__proto__:null,base256emoji:Xj}),Qj=Q_,Z_=128,eU=127,tU=~eU,rU=Math.pow(2,31);function Q_(t,e,r){e=e||[],r=r||0;for(var n=r;t>=rU;)e[r++]=t&255|Z_,t/=128;for(;t&tU;)e[r++]=t&255|Z_,t>>>=7;return e[r]=t|0,Q_.bytes=r-n+1,e}var nU=v1,iU=128,e6=127;function v1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw v1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&e6)<=iU);return v1.bytes=s-n,r}var sU=Math.pow(2,7),oU=Math.pow(2,14),aU=Math.pow(2,21),cU=Math.pow(2,28),uU=Math.pow(2,35),fU=Math.pow(2,42),lU=Math.pow(2,49),hU=Math.pow(2,56),dU=Math.pow(2,63),pU=function(t){return t(t6.encode(t,e,r),e),n6=t=>t6.encodingLength(t),b1=(t,e)=>{const r=e.byteLength,n=n6(t),i=n+n6(r),s=new Uint8Array(i+r);return r6(t,s,0),r6(r,s,n),s.set(e,i),new mU(t,r,e,s)};class mU{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const i6=({name:t,code:e,encode:r})=>new vU(t,e,r);class vU{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?b1(this.code,r):r.then(n=>b1(this.code,n))}else throw Error("Unknown type, must be binary type")}}const s6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),bU=i6({name:"sha2-256",code:18,encode:s6("SHA-256")}),yU=i6({name:"sha2-512",code:19,encode:s6("SHA-512")});var wU=Object.freeze({__proto__:null,sha256:bU,sha512:yU});const o6=0,xU="identity",a6=Y_;var _U=Object.freeze({__proto__:null,identity:{code:o6,name:xU,encode:a6,digest:t=>b1(o6,a6(t))}});new TextEncoder,new TextDecoder;const c6={...mj,...bj,...wj,..._j,...Aj,...Lj,...$j,...Uj,...Kj,...Zj};({...wU,..._U});function EU(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function u6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const f6=u6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),y1=u6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=EU(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=ut("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,V3(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?G3(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}},MU=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=AF,this.randomSessionIdentifier=c1(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=wx(i);return yx(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=ZB();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=wx(s),a=this.randomSessionIdentifier;return await LO(a,i,PF,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),u=QB(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||Hd(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=h_(o),u=mo(s);if(p_(a))return t$(u,o==null?void 0:o.encoding);if(d_(a)){const y=a.senderPublicKey,A=a.receiverPublicKey;i=await this.generateSharedKey(y,A)}const l=this.getSymKey(i),{type:d,senderPublicKey:g}=a;return e$({type:d,symKey:l,message:u,senderPublicKey:g,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=i$(s,o);if(p_(a)){const u=n$(s,o==null?void 0:o.encoding);return Ka(u)}if(d_(a)){const u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{const u=this.getSymKey(i),l=r$({symKey:u,encoded:s,encoding:o==null?void 0:o.encoding});return Ka(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=(i,s=la)=>{const o=xl({encoded:i,encoding:s});return nc(o.type)},this.getPayloadSenderPublicKey=(i,s=la)=>{const o=xl({encoded:i,encoding:s});return o.senderPublicKey?Tn(o.senderPublicKey,ni):void 0},this.core=e,this.logger=ri(r,this.name),this.keychain=n||new PU(this.core,this.logger)}get context(){return gi(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(H_)}catch{e=c1(),await this.keychain.set(H_,e)}return AU(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}};class IU extends zR{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=CF,this.version=TF,this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Ao(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Ao(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=ri(e,this.name),this.core=r}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,V3(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?G3(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class CU extends HR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new qi.EventEmitter,this.name=DF,this.queue=new Map,this.publishTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.failedPublishTimeout=mt.toMiliseconds(mt.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||RF,u=u1(s),l=(s==null?void 0:s.prompt)||!1,d=(s==null?void 0:s.tag)||0,g=(s==null?void 0:s.id)||sc().toString(),y={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:d,id:g,attestation:s==null?void 0:s.attestation}},A=`Failed to publish payload, please try again. id:${g} tag:${d}`,P=Date.now();let N,D=1;try{for(;N===void 0;){if(Date.now()-P>this.publishTimeout)throw new Error(A);this.logger.trace({id:g,attempts:D},`publisher.publish - attempt ${D}`),N=await await Au(this.rpcPublish(n,i,a,u,l,d,g,s==null?void 0:s.attestation).catch(k=>this.logger.warn(k)),this.publishTimeout,A),D++,N||await new Promise(k=>setTimeout(k,this.failedPublishTimeout))}this.relayer.events.emit(ii.publish,y),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:g,topic:n,message:i,opts:s}})}catch(k){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(k),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw k;this.queue.set(g,y)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=ri(r,this.name),this.registerEventListeners()}get context(){return gi(this.logger)}rpcPublish(e,r,n,i,s,o,a,u){var l,d,g,y;const A={method:_l(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:u},id:a};return bi((l=A.params)==null?void 0:l.prompt)&&((d=A.params)==null||delete d.prompt),bi((g=A.params)==null?void 0:g.tag)&&((y=A.params)==null||delete y.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:A}),this.relayer.request(A)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(iu.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ii.connection_stalled);return}this.checkQueue()}),this.relayer.on(ii.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class TU{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var RU=Object.defineProperty,DU=Object.defineProperties,OU=Object.getOwnPropertyDescriptors,l6=Object.getOwnPropertySymbols,NU=Object.prototype.hasOwnProperty,LU=Object.prototype.propertyIsEnumerable,h6=(t,e,r)=>e in t?RU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rl=(t,e)=>{for(var r in e||(e={}))NU.call(e,r)&&h6(t,r,e[r]);if(l6)for(var r of l6(e))LU.call(e,r)&&h6(t,r,e[r]);return t},w1=(t,e)=>DU(t,OU(e));class kU extends VR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new TU,this.events=new qi.EventEmitter,this.name=FF,this.version=jF,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Ws,this.subscribeTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=u1(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new mt.Watch;a.start(i);const u=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(u),a.stop(i),s(!0)),a.elapsed(i)>=UF&&(clearInterval(u),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ri(r,this.name),this.clientId=""}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=u1(n);await this.rpcUnsubscribe(e,r,i);const s=Dr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===Wr.relay&&await this.restartToComplete();const s={method:_l(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=Ao(e+this.clientId);if((n==null?void 0:n.transportType)===Wr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},mt.toMiliseconds(mt.ONE_SECOND)),a;const u=await Au(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return u?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ii.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Au(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Au(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:_l(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,w1(Rl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Rl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Rl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Ks.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Ks.deleted,w1(Rl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Ks.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);ic(r)&&this.onBatchSubscribe(r.map((n,i)=>w1(Rl({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(iu.pulse,async()=>{await this.checkPending()}),this.events.on(Ks.created,async e=>{const r=Ks.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Ks.deleted,async e=>{const r=Ks.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var BU=Object.defineProperty,d6=Object.getOwnPropertySymbols,$U=Object.prototype.hasOwnProperty,FU=Object.prototype.propertyIsEnumerable,p6=(t,e,r)=>e in t?BU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,g6=(t,e)=>{for(var r in e||(e={}))$U.call(e,r)&&p6(t,r,e[r]);if(d6)for(var r of d6(e))FU.call(e,r)&&p6(t,r,e[r]);return t};class jU extends WR{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new qi.EventEmitter,this.name=NF,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=mt.toMiliseconds(mt.THIRTY_SECONDS+mt.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||sc().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(u,l)=>{const d=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Xi.disconnect,d);const g=await o;this.provider.off(Xi.disconnect,d),u(g)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(jd())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(ii.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ii.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Xi.payload,this.onPayloadHandler),this.provider.on(Xi.connect,this.onConnectHandler),this.provider.on(Xi.disconnect,this.onDisconnectHandler),this.provider.on(Xi.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ri(e.logger,this.name):Qf(od({level:e.logger||OF})),this.messages=new IU(this.logger,e.core),this.subscriber=new kU(this,this.logger),this.publisher=new CU(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||K_,this.projectId=e.projectId,this.bundleId=mB(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return gi(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Wr.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",u;const l=d=>{d.topic===e&&(this.subscriber.off(Ks.created,l),u())};return await Promise.all([new Promise(d=>{u=d,this.subscriber.on(Ks.created,l)}),new Promise(async(d,g)=>{a=await this.subscriber.subscribe(e,g6({internal:{throwOnFailedPublish:o}},r)).catch(y=>{o&&g(y)})||a,d()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Au(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Xi.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Xi.disconnect,i),await Au(this.provider.connect(),mt.toMiliseconds(mt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await M_())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=En(mt.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(ii.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(jd())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Ji(new wF(wB({sdkVersion:m1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),g1(e)){if(!e.method.endsWith(LF))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:Wr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(g6({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else Yd(e)&&this.events.emit(ii.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ii.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Vd(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Xi.payload,this.onPayloadHandler),this.provider.off(Xi.connect,this.onConnectHandler),this.provider.off(Xi.disconnect,this.onDisconnectHandler),this.provider.off(Xi.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await M_();X$(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(ii.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},mt.toMiliseconds(kF))))}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var UU=Object.defineProperty,m6=Object.getOwnPropertySymbols,qU=Object.prototype.hasOwnProperty,zU=Object.prototype.propertyIsEnumerable,v6=(t,e,r)=>e in t?UU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b6=(t,e)=>{for(var r in e||(e={}))qU.call(e,r)&&v6(t,r,e[r]);if(m6)for(var r of m6(e))zU.call(e,r)&&v6(t,r,e[r]);return t};class uc extends KR{constructor(e,r,n,i=Ws,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=BF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!bi(o)?this.map.set(this.getKey(o),o):I$(o)?this.map.set(o.id,o):C$(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>_F(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const u=b6(b6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=ri(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class HU{constructor(e,r){this.core=e,this.logger=r,this.name=qF,this.version=zF,this.events=new Yg,this.initialized=!1,this.storagePrefix=Ws,this.ignoredPayloadTypes=[So],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=c1(),s=await this.core.crypto.setSymKey(i),o=En(mt.FIVE_MINUTES),a={protocol:W_},u={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=y_({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(oc.create,u),this.core.expirer.set(s,o),await this.pairings.set(s,u),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Vs.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:u,methods:l}=b_(n.uri);i.props.properties.topic=s,i.addTrace(Vs.pairing_uri_validation_success),i.addTrace(Vs.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(Vs.existing_pairing),d.active)throw i.setError(Io.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Vs.pairing_not_expired)}const g=u||En(mt.FIVE_MINUTES),y={topic:s,relay:a,expiry:g,active:!1,methods:l};this.core.expirer.set(s,g),await this.pairings.set(s,y),i.addTrace(Vs.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(oc.create,y),i.addTrace(Vs.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Vs.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Io.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(A){throw i.setError(Io.subscribe_pairing_topic_failure),A}return i.addTrace(Vs.subscribe_pairing_topic_success),y},this.activate=async({topic:n})=>{this.isInitialized();const i=En(mt.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=tc();this.events.once(vr("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Dr("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,u=this.core.crypto.keychain.get(i);return y_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:u,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=da(i,s),a=await this.core.crypto.encode(n,o),u=Ml[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{const o=Vd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=Gd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method]?Ml[u.request.method].res:Ml.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Dr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>fa(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(oc.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{Hs(i)?this.events.emit(vr("pairing_ping",s),{}):Yi(i)&&this.events.emit(vr("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(oc.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Dr("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Dr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!yi(n)){const{message:a}=ut("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!M$(n.uri)){const{message:a}=ut("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}const o=b_(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&mt.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!an(n,!1)){const{message:i}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(fa(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ut("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=ri(r,this.name),this.pairings=new uc(this.core,this.logger,this.name,this.storagePrefix)}get context(){return gi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ii.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===Wr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{g1(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):Yd(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Zi.expired,async e=>{const{topic:r}=J3(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(oc.expire,{topic:r}))})}}class WU extends qR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new qi.EventEmitter,this.name=HF,this.version=WF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:En(mt.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(bs.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Yi(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(bs.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(bs.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:da(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(bs.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(bs.created,e=>{const r=bs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.updated,e=>{const r=bs.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.deleted,e=>{const r=bs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(iu.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{mt.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(bs.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class KU extends GR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new qi.EventEmitter,this.name=KF,this.version=VF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Zi.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Zi.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return xB(e);if(typeof e=="number")return _B(e);const{message:r}=ut("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Zi.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;mt.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Zi.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(iu.pulse,()=>this.checkExpirations()),this.events.on(Zi.created,e=>{const r=Zi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.expired,e=>{const r=Zi.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.deleted,e=>{const r=Zi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class VU extends YR{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=GF,this.verifyUrlV3=JF,this.storagePrefix=Ws,this.version=q_,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&mt.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!pl()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,u=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=nl(),d=this.startAbortTimer(mt.ONE_SECOND*5),g=await new Promise((y,A)=>{const P=()=>{window.removeEventListener("message",D),l.body.removeChild(N),A("attestation aborted")};this.abortController.signal.addEventListener("abort",P);const N=l.createElement("iframe");N.src=u,N.style.display="none",N.addEventListener("error",P,{signal:this.abortController.signal});const D=k=>{if(k.data&&typeof k.data=="string")try{const B=JSON.parse(k.data);if(B.type==="verify_attestation"){if(gm(B.attestation).payload.id!==o)return;clearInterval(d),l.body.removeChild(N),this.abortController.signal.removeEventListener("abort",P),window.removeEventListener("message",D),y(B.attestation===null?"":B.attestation)}}catch(B){this.logger.warn(B)}};l.body.appendChild(N),window.addEventListener("message",D,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",g),g}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(gm(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const u=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,u)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(mt.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Il;return XF.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Il}`),s=Il),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(mt.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=c$(i,s.publicKey),a={hasExpired:mt.toMiliseconds(o.exp)this.abortController.abort(),mt.toMiliseconds(e))}}class GU extends JR{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=ZF,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${QF}/${this.projectId}/clients`;await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=ri(r,this.context)}}var YU=Object.defineProperty,y6=Object.getOwnPropertySymbols,JU=Object.prototype.hasOwnProperty,XU=Object.prototype.propertyIsEnumerable,w6=(t,e,r)=>e in t?YU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dl=(t,e)=>{for(var r in e||(e={}))JU.call(e,r)&&w6(t,r,e[r]);if(y6)for(var r of y6(e))XU.call(e,r)&&w6(t,r,e[r]);return t};class ZU extends XR{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=tj,this.storagePrefix=Ws,this.storageVersion=ej,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!i1())try{const i={eventId:Z3(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:K3(this.core.relayer.protocol,this.core.relayer.version,m1)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:u}}=i,l=Z3(),d=this.core.projectId||"",g=Date.now(),y=Dl({eventId:l,timestamp:g,props:{event:s,type:o,properties:{topic:a,trace:u}},bundleId:d,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,y),this.shouldPersist=!0),y},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(u=>u.props.properties.topic===o);if(a)return Dl(Dl({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(iu.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{mt.fromMiliseconds(Date.now())-mt.fromMiliseconds(i.timestamp)>rj&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Dl(Dl({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${nj}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${m1}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>W3().url,this.logger=ri(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var QU=Object.defineProperty,x6=Object.getOwnPropertySymbols,eq=Object.prototype.hasOwnProperty,tq=Object.prototype.propertyIsEnumerable,_6=(t,e,r)=>e in t?QU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,E6=(t,e)=>{for(var r in e||(e={}))eq.call(e,r)&&_6(t,r,e[r]);if(x6)for(var r of x6(e))tq.call(e,r)&&_6(t,r,e[r]);return t};class x1 extends UR{constructor(e){var r;super(e),this.protocol=U_,this.version=q_,this.name=z_,this.events=new qi.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:u})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:Wr.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||K_,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=od({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:EF.logger}),{logger:i,chunkLoggerController:s}=jR({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ri(i,this.name),this.heartbeat=new NT,this.crypto=new MU(this,this.logger,e==null?void 0:e.keychain),this.history=new WU(this,this.logger),this.expirer=new KU(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new hR(E6(E6({},SF),e==null?void 0:e.storageOptions)),this.relayer=new jU({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new HU(this,this.logger),this.verify=new VU(this,this.logger,this.storage),this.echoClient=new GU(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new ZU(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new x1(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem($F,n),r}get context(){return gi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(V_,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(V_)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const rq=x1,S6="wc",A6=2,P6="client",_1=`${S6}@${A6}:${P6}:`,E1={name:P6,logger:"error"},M6="WALLETCONNECT_DEEPLINK_CHOICE",nq="proposal",I6="Proposal expired",iq="session",Mu=mt.SEVEN_DAYS,sq="engine",kn={wc_sessionPropose:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:mt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:mt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1119}}},S1={min:mt.FIVE_MINUTES,max:mt.SEVEN_DAYS},Gs={idle:"IDLE",active:"ACTIVE"},oq="request",aq=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],cq="wc",uq="auth",fq="authKeys",lq="pairingTopics",hq="requests",Zd=`${cq}@${1.5}:${uq}:`,Qd=`${Zd}:PUB_KEY`;var dq=Object.defineProperty,pq=Object.defineProperties,gq=Object.getOwnPropertyDescriptors,C6=Object.getOwnPropertySymbols,mq=Object.prototype.hasOwnProperty,vq=Object.prototype.propertyIsEnumerable,T6=(t,e,r)=>e in t?dq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))mq.call(e,r)&&T6(t,r,e[r]);if(C6)for(var r of C6(e))vq.call(e,r)&&T6(t,r,e[r]);return t},ws=(t,e)=>pq(t,gq(e));class bq extends QR{constructor(e){super(e),this.name=sq,this.events=new Yg,this.initialized=!1,this.requestQueue={state:Gs.idle,queue:[]},this.sessionRequestQueue={state:Gs.idle,queue:[]},this.requestQueueDelay=mt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(kn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=ws(tn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n;let l=i,d,g=!1;try{l&&(g=this.client.core.pairing.pairings.get(l).active)}catch(U){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),U}if(!l||!g){const{topic:U,uri:K}=await this.client.core.pairing.create();l=U,d=K}if(!l){const{message:U}=ut("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(U)}const y=await this.client.core.crypto.generateKeyPair(),A=kn.wc_sessionPropose.req.ttl||mt.FIVE_MINUTES,P=En(A),N=tn({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:W_}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:P,pairingTopic:l},a&&{sessionProperties:a}),{reject:D,resolve:k,done:B}=tc(A,I6);this.events.once(vr("session_connect"),async({error:U,session:K})=>{if(U)D(U);else if(K){K.self.publicKey=y;const J=ws(tn({},K),{pairingTopic:N.pairingTopic,requiredNamespaces:N.requiredNamespaces,optionalNamespaces:N.optionalNamespaces,transportType:Wr.relay});await this.client.session.set(K.topic,J),await this.setExpiry(K.topic,K.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:K.peer.metadata}),this.cleanupDuplicatePairings(J),k(J)}});const j=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:N,throwOnFailedPublish:!0});return await this.setProposal(j,tn({id:j},N)),{uri:d,approval:B}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[ys.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(z){throw o.setError(ac.no_internet_connection),z}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(z){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(ac.proposal_not_found),z}try{await this.isValidApprove(r)}catch(z){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(ac.session_approve_namespace_validation_failure),z}const{id:a,relayProtocol:u,namespaces:l,sessionProperties:d,sessionConfig:g}=r,y=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:A,proposer:P,requiredNamespaces:N,optionalNamespaces:D}=y;let k=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:A});k||(k=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:ys.session_approve_started,properties:{topic:A,trace:[ys.session_approve_started,ys.session_namespaces_validation_success]}}));const B=await this.client.core.crypto.generateKeyPair(),j=P.publicKey,U=await this.client.core.crypto.generateSharedKey(B,j),K=tn(tn({relay:{protocol:u??"irn"},namespaces:l,controller:{publicKey:B,metadata:this.client.metadata},expiry:En(Mu)},d&&{sessionProperties:d}),g&&{sessionConfig:g}),J=Wr.relay;k.addTrace(ys.subscribing_session_topic);try{await this.client.core.relayer.subscribe(U,{transportType:J})}catch(z){throw k.setError(ac.subscribe_session_topic_failure),z}k.addTrace(ys.subscribe_session_topic_success);const T=ws(tn({},K),{topic:U,requiredNamespaces:N,optionalNamespaces:D,pairingTopic:A,acknowledged:!1,self:K.controller,peer:{publicKey:P.publicKey,metadata:P.metadata},controller:B,transportType:Wr.relay});await this.client.session.set(U,T),k.addTrace(ys.store_session);try{k.addTrace(ys.publishing_session_settle),await this.sendRequest({topic:U,method:"wc_sessionSettle",params:K,throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(ac.session_settle_publish_failure),z}),k.addTrace(ys.session_settle_publish_success),k.addTrace(ys.publishing_session_approve),await this.sendResult({id:a,topic:A,result:{relay:{protocol:u??"irn"},responderPublicKey:B},throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(ac.session_approve_publish_failure),z}),k.addTrace(ys.session_approve_publish_success)}catch(z){throw this.client.logger.error(z),this.client.session.delete(U,Dr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(U),z}return this.client.core.eventClient.deleteEvent({eventId:k.eventId}),await this.client.core.pairing.updateMetadata({topic:A,metadata:P.metadata}),await this.client.proposal.delete(a,Dr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:A}),await this.setExpiry(U,En(Mu)),{topic:U,acknowledged:()=>Promise.resolve(this.client.session.get(U))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:kn.wc_sessionPropose.reject}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(g){throw this.client.logger.error("update() -> isValidUpdate() failed"),g}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=tc(),u=ha(),l=sc().toString(),d=this.client.session.get(n).namespaces;return this.events.once(vr("session_update",u),({error:g})=>{g?a(g):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:u,relayRpcId:l}).catch(g=>{this.client.logger.error(g),this.client.session.update(n,{namespaces:d}),a(g)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(u){throw this.client.logger.error("extend() -> isValidExtend() failed"),u}const{topic:n}=r,i=ha(),{done:s,resolve:o,reject:a}=tc();return this.events.once(vr("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,En(Mu)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(u=>{a(u)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(P){throw this.client.logger.error("request() -> isValidRequest() failed"),P}const{chainId:n,request:i,topic:s,expiry:o=kn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=ha(),l=sc().toString(),{done:d,resolve:g,reject:y}=tc(o,"Request expired. Please try again.");this.events.once(vr("session_request",u),({error:P,result:N})=>{P?y(P):g(N)});const A=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return A?(await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:A}).catch(P=>y(P)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),await d()):await Promise.all([new Promise(async P=>{await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(N=>y(N)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),P()}),new Promise(async P=>{var N;if(!((N=a.sessionConfig)!=null&&N.disableDeepLink)){const D=await AB(this.client.core.storage,M6);await EB({id:u,topic:s,wcDeepLink:D})}P()}),d()]).then(P=>P[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);Hs(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Yi(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=ha(),s=sc().toString(),{done:o,resolve:a,reject:u}=tc();this.events.once(vr("session_ping",i),({error:l})=>{l?u(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=sc().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Dr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ut("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>A$(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?Wr.link_mode:Wr.relay;o===Wr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:u="",uri:l,domain:d,nonce:g,type:y,exp:A,nbf:P,methods:N=[],expiry:D}=r,k=[...r.resources||[]],{topic:B,uri:j}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:B,uri:j}});const U=await this.client.core.crypto.generateKeyPair(),K=Hd(U);if(await Promise.all([this.client.auth.authKeys.set(Qd,{responseTopic:K,publicKey:U}),this.client.auth.pairingTopics.set(K,{topic:K,pairingTopic:B})]),await this.client.core.relayer.subscribe(K,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${B}`),N.length>0){const{namespace:_}=Eu(a[0]);let S=KB(_,"request",N);zd(k)&&(S=GB(S,k.pop())),k.push(S)}const J=D&&D>kn.wc_sessionAuthenticate.req.ttl?D:kn.wc_sessionAuthenticate.req.ttl,T={authPayload:{type:y??"caip122",chains:a,statement:u,aud:l,domain:d,version:"1",nonce:g,iat:new Date().toISOString(),exp:A,nbf:P,resources:k},requester:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(J)},z={eip155:{chains:a,methods:[...new Set(["personal_sign",...N])],events:["chainChanged","accountsChanged"]}},ue={requiredNamespaces:{},optionalNamespaces:z,relays:[{protocol:"irn"}],pairingTopic:B,proposer:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(kn.wc_sessionPropose.req.ttl)},{done:_e,resolve:G,reject:E}=tc(J,"Request expired"),m=async({error:_,session:S})=>{if(this.events.off(vr("session_request",p),f),_)E(_);else if(S){S.self.publicKey=U,await this.client.session.set(S.topic,S),await this.setExpiry(S.topic,S.expiry),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:S.peer.metadata});const b=this.client.session.get(S.topic);await this.deleteProposal(v),G({session:b})}},f=async _=>{var S,b,M;if(await this.deletePendingAuthRequest(p,{message:"fulfilled",code:0}),_.error){const X=Dr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return _.error.code===X.code?void 0:(this.events.off(vr("session_connect"),m),E(_.error.message))}await this.deleteProposal(v),this.events.off(vr("session_connect"),m);const{cacaos:I,responder:F}=_.result,ae=[],O=[];for(const X of I){await r_({cacao:X,projectId:this.client.core.projectId})||(this.client.logger.error(X,"Signature verification failed"),E(Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Q}=X,R=zd(Q.resources),Z=[o1(Q.iss)],te=qd(Q.iss);if(R){const le=s_(R),ie=o_(R);ae.push(...le),Z.push(...ie)}for(const le of Z)O.push(`${le}:${te}`)}const se=await this.client.core.crypto.generateSharedKey(U,F.publicKey);let ee;ae.length>0&&(ee={topic:se,acknowledged:!0,self:{publicKey:U,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:En(Mu),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:B,namespaces:w_([...new Set(ae)],[...new Set(O)]),transportType:o},await this.client.core.relayer.subscribe(se,{transportType:o}),await this.client.session.set(se,ee),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:F.metadata}),ee=this.client.session.get(se)),(S=this.client.metadata.redirect)!=null&&S.linkMode&&(b=F.metadata.redirect)!=null&&b.linkMode&&(M=F.metadata.redirect)!=null&&M.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(se,{transportType:Wr.link_mode})),G({auths:I,session:ee})},p=ha(),v=ha();this.events.once(vr("session_connect"),m),this.events.once(vr("session_request",p),f);let x;try{if(s){const _=da("wc_sessionAuthenticate",T,p);this.client.core.history.set(B,_);const S=await this.client.core.crypto.encode("",_,{type:yl,encoding:vl});x=Wd(n,B,S)}else await Promise.all([this.sendRequest({topic:B,method:"wc_sessionAuthenticate",params:T,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:p}),this.sendRequest({topic:B,method:"wc_sessionPropose",params:ue,expiry:kn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:v})])}catch(_){throw this.events.off(vr("session_connect"),m),this.events.off(vr("session_request",p),f),_}return await this.setProposal(v,tn({id:v},ue)),await this.setAuthRequest(p,{request:ws(tn({},T),{verifyContext:{}}),pairingTopic:B,transportType:o}),{uri:x??j,response:_e}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[cc.authenticated_session_approve_started]}});try{this.isInitialized()}catch(D){throw s.setError(Cl.no_internet_connection),D}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Cl.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||Wr.relay;a===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=Hd(u),g={type:So,receiverPublicKey:u,senderPublicKey:l},y=[],A=[];for(const D of i){if(!await r_({cacao:D,projectId:this.client.core.projectId})){s.setError(Cl.invalid_cacao);const K=Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:K,encodeOpts:g}),new Error(K.message)}s.addTrace(cc.cacaos_verified);const{p:k}=D,B=zd(k.resources),j=[o1(k.iss)],U=qd(k.iss);if(B){const K=s_(B),J=o_(B);y.push(...K),j.push(...J)}for(const K of j)A.push(`${K}:${U}`)}const P=await this.client.core.crypto.generateSharedKey(l,u);s.addTrace(cc.create_authenticated_session_topic);let N;if((y==null?void 0:y.length)>0){N={topic:P,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:u,metadata:o.requester.metadata},controller:u,expiry:En(Mu),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:w_([...new Set(y)],[...new Set(A)]),transportType:a},s.addTrace(cc.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(P,{transportType:a})}catch(D){throw s.setError(Cl.subscribe_authenticated_session_topic_failure),D}s.addTrace(cc.subscribe_authenticated_session_topic_success),await this.client.session.set(P,N),s.addTrace(cc.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(cc.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:g,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(D){throw s.setError(Cl.authenticated_session_approve_publish_failure),D}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:N}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),u=Hd(o),l={type:So,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:u,error:i,encodeOpts:l,rpcOpts:kn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return n_(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:u}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Dr("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(M6).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,Dr("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Gs.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(ac.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Dr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Gs.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,En(kn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=Wr.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||En(kn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l,appLink:d}=r,g=da(i,s,u);let y;const A=!!d;try{const D=A?vl:la;y=await this.client.core.crypto.encode(n,g,{encoding:D})}catch(D){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),D}let P;if(aq.includes(i)){const D=Ao(JSON.stringify(g)),k=Ao(y);P=await this.client.core.verify.register({id:k,decryptedId:D})}const N=kn[i].req;if(N.attestation=P,o&&(N.ttl=o),a&&(N.id=a),this.client.core.history.set(n,g),A){const D=Wd(d,n,y);await global.Linking.openURL(D,this.client.name)}else{const D=kn[i].req;o&&(D.ttl=o),a&&(D.id=a),l?(D.internal=ws(tn({},D.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,y,D)):this.client.core.relayer.publish(n,y,D).catch(k=>this.client.logger.error(k))}return g.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:u}=r,l=Vd(n,s);let d;const g=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=g?vl:la;d=await this.client.core.crypto.encode(i,l,ws(tn({},a||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),A}if(g){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=kn[y.request.method].res;o?(A.internal=ws(tn({},A.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,A)):this.client.core.relayer.publish(i,d,A).catch(P=>this.client.logger.error(P))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:u}=r,l=Gd(n,s);let d;const g=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=g?vl:la;d=await this.client.core.crypto.encode(i,l,ws(tn({},o||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),A}if(g){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=a||kn[y.request.method].res;this.client.core.relayer.publish(i,d,A)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;fa(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{fa(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Gs.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Gs.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Gs.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,u=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:u}))switch(u){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=ut("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:u}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(tn({},i.params));const d=a.expiryTimestamp||En(kn.wc_sessionPropose.req.ttl),g=tn({id:u,pairingTopic:n,expiryTimestamp:d},a);await this.setProposal(u,g);const y=await this.getVerifyContext({attestationId:s,hash:Ao(JSON.stringify(i)),encryptedId:o,metadata:g.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(Io.proposal_listener_not_found)),l==null||l.addTrace(Vs.emit_session_proposal),this.client.events.emit("session_proposal",{id:u,params:g,verifyContext:y})}catch(l){await this.sendError({id:u,topic:n,error:l,rpcOpts:kn.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(Hs(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const u=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const d=await this.client.core.crypto.generateSharedKey(u,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:d});const g=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:g}),await this.client.core.pairing.activate({topic:r})}else if(Yi(n)){await this.client.proposal.delete(s,Dr("USER_DISCONNECTED"));const o=vr("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(vr("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:u,namespaces:l,sessionProperties:d,sessionConfig:g}=n.params,y=ws(tn(tn({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},d&&{sessionProperties:d}),g&&{sessionConfig:g}),{transportType:Wr.relay}),A=vr("session_connect");if(this.events.listenerCount(A)===0)throw new Error(`emitting ${A} without any listeners 997`);this.events.emit(vr("session_connect"),{session:y}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;Hs(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(vr("session_approve",i),{})):Yi(n)&&(await this.client.session.delete(r,Dr("USER_DISCONNECTED")),this.events.emit(vr("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Dr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(tn({topic:r},i));try{Al.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(u){throw Al.delete(o),u}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=vr("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_update",i),{}):Yi(n)&&this.events.emit(vr("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,En(Mu)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=vr("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_extend",i),{}):Yi(n)&&this.events.emit(vr("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=vr("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{Hs(n)?this.events.emit(vr("session_ping",i),{}):Yi(n)&&this.events.emit(vr("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(ii.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Dr("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:u,encryptedId:l,transportType:d}=r,{id:g,params:y}=a;try{await this.isValidRequest(tn({topic:o},y));const A=this.client.session.get(o),P=await this.getVerifyContext({attestationId:u,hash:Ao(JSON.stringify(da("wc_sessionRequest",y,g))),encryptedId:l,metadata:A.peer.metadata,transportType:d}),N={id:g,topic:o,params:y,verifyContext:P};await this.setPendingSessionRequest(N),d===Wr.link_mode&&(n=A.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=A.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(N):(this.addSessionRequestToSessionRequestQueue(N),this.processSessionRequestQueue())}catch(A){await this.sendError({id:g,topic:o,error:A}),this.client.logger.error(A)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=vr("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(tn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Al.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:u}=r;try{const{requester:l,authPayload:d,expiryTimestamp:g}=s.params,y=await this.getVerifyContext({attestationId:o,hash:Ao(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:u}),A={requester:l,pairingTopic:i,id:s.id,authPayload:d,verifyContext:y,expiryTimestamp:g};await this.setAuthRequest(s.id,{request:A,pairingTopic:i,transportType:u}),u===Wr.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:y})}catch(l){this.client.logger.error(l);const d=s.params.requester.publicKey,g=await this.client.core.crypto.generateKeyPair(),y=this.getAppLinkIfEnabled(s.params.requester.metadata,u),A={type:So,receiverPublicKey:d,senderPublicKey:g};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:A,rpcOpts:kn.wc_sessionAuthenticate.autoReject,appLink:y})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Gs.idle,this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=vr("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(vr("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Gs.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Gs.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:da("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(bi(n)||await this.isValidPairingTopic(n),!B$(a)){const{message:u}=ut("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!bi(i)&&Sl(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!bi(s)&&Sl(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),bi(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=k$(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!yi(r))throw new Error(ut("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),u=h1(i,"approve()");if(u)throw new Error(u.message);const l=A_(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!an(s,!0)){const{message:d}=ut("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}bi(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!yi(r)){const{message:s}=ut("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!F$(i)){const{message:s}=ut("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!yi(r)){const{message:l}=ut("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!E_(n)){const{message:l}=ut("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=T$(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const u=h1(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(fa(o)){const{message:l}=ut("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=h1(i,"update()");if(o)throw new Error(o.message);const a=A_(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!S_(a,s)){const{message:u}=ut("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!j$(i)){const{message:u}=ut("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!z$(a,s,i.method)){const{message:u}=ut("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!V$(o,S1)){const{message:u}=ut("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${S1.min} and ${S1.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!yi(r)){const{message:o}=ut("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!U$(s)){const{message:o}=ut("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!yi(r)){const{message:a}=ut("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!S_(o,s)){const{message:a}=ut("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!q$(i)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!H$(o,s,i.name)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!an(i,!1))throw new Error("uri is required parameter");if(!an(s,!1))throw new Error("domain is required parameter");if(!an(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(u=>Eu(u).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Eu(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,u={verified:{verifyUrl:o.verifyUrl||Il,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Wr.link_mode){const d=this.getAppLinkIfEnabled(o,a);return u.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",u}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(u.verified.origin=l.origin,u.verified.isScam=l.isScam,u.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(u)}`),u},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!an(i,!1)){const{message:s}=ut("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,u,l,d,g,y;return!r||n!==Wr.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(u=this.client.metadata)==null?void 0:u.redirect)==null?void 0:l.universal)!==""&&((d=r==null?void 0:r.redirect)==null?void 0:d.universal)!==void 0&&((g=r==null?void 0:r.redirect)==null?void 0:g.universal)!==""&&((y=r==null?void 0:r.redirect)==null?void 0:y.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=X3(r,"topic")||"",i=decodeURIComponent(X3(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:Wr.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(i1()||Su()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ii.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(Qd)?this.client.auth.authKeys.get(Qd):{publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===Wr.link_mode?vl:la});try{g1(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:Ao(n)})):Yd(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(u){this.client.logger.error(u)}}registerExpirerEvents(){this.client.core.expirer.on(Zi.expired,async e=>{const{topic:r,id:n}=J3(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ut("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,ut("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(oc.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(oc.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=ut("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=ut("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=ut("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(an(e,!1)){const{message:r}=ut("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=ut("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!$$(e)){const{message:r}=ut("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=ut("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class yq extends uc{constructor(e,r){super(e,r,nq,_1),this.core=e,this.logger=r}}let wq=class extends uc{constructor(e,r){super(e,r,iq,_1),this.core=e,this.logger=r}};class xq extends uc{constructor(e,r){super(e,r,oq,_1,n=>n.id),this.core=e,this.logger=r}}class _q extends uc{constructor(e,r){super(e,r,fq,Zd,()=>Qd),this.core=e,this.logger=r}}class Eq extends uc{constructor(e,r){super(e,r,lq,Zd),this.core=e,this.logger=r}}class Sq extends uc{constructor(e,r){super(e,r,hq,Zd,n=>n.id),this.core=e,this.logger=r}}class Aq{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new _q(this.core,this.logger),this.pairingTopics=new Eq(this.core,this.logger),this.requests=new Sq(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class A1 extends ZR{constructor(e){super(e),this.protocol=S6,this.version=A6,this.name=E1.name,this.events=new qi.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||E1.name,this.metadata=(e==null?void 0:e.metadata)||W3(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||E1.logger}));this.core=(e==null?void 0:e.core)||new rq(e),this.logger=ri(r,this.name),this.session=new wq(this.core,this.logger),this.proposal=new yq(this.core,this.logger),this.pendingRequest=new xq(this.core,this.logger),this.engine=new bq(this),this.auth=new Aq(this.core,this.logger)}static async init(e){const r=new A1(e);return await r.initialize(),r}get context(){return gi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var e0={exports:{}};/** + Approved: ${a.toString()}`)),Object.keys(e).forEach(p=>{if(!p.includes(":")||n)return;const y=Pu(e[p].accounts);y.includes(p)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${p} + Required: ${p} + Approved: ${y.toString()}`))}),o.forEach(p=>{n||(ec(i[p].methods,s[p].methods)?ec(i[p].events,s[p].events)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${p}`)):n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${p}`))}),n}function W$(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function P_(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function K$(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Pu(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function V$(t,e){return l1(t)&&t<=e.max&&t>=e.min}function M_(){const t=gl();return new Promise(e=>{switch(t){case Ri.browser:e(G$());break;case Ri.reactNative:e(Y$());break;case Ri.node:e(J$());break;default:e(!0)}})}function G$(){return pl()&&(navigator==null?void 0:navigator.onLine)}async function Y$(){if(Su()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function J$(){return!0}function X$(t){switch(gl()){case Ri.browser:Z$(t);break;case Ri.reactNative:Q$(t);break}}function Z$(t){!Su()&&pl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function Q$(t){Su()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const d1={};class Al{static get(e){return d1[e]}static set(e,r){d1[e]=r}static delete(e){delete d1[e]}}const eF="PARSE_ERROR",tF="INVALID_REQUEST",rF="METHOD_NOT_FOUND",nF="INVALID_PARAMS",I_="INTERNAL_ERROR",p1="SERVER_ERROR",iF=[-32700,-32600,-32601,-32602,-32603],Pl={[eF]:{code:-32700,message:"Parse error"},[tF]:{code:-32600,message:"Invalid Request"},[rF]:{code:-32601,message:"Method not found"},[nF]:{code:-32602,message:"Invalid params"},[I_]:{code:-32603,message:"Internal error"},[p1]:{code:-32e3,message:"Server error"}},C_=p1;function sF(t){return iF.includes(t)}function T_(t){return Object.keys(Pl).includes(t)?Pl[t]:Pl[C_]}function oF(t){const e=Object.values(Pl).find(r=>r.code===t);return e||Pl[C_]}function R_(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var D_={},Po={},O_;function aF(){if(O_)return Po;O_=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.isBrowserCryptoAvailable=Po.getSubtleCrypto=Po.getBrowerCrypto=void 0;function t(){return(nn==null?void 0:nn.crypto)||(nn==null?void 0:nn.msCrypto)||{}}Po.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Po.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Po.isBrowserCryptoAvailable=r,Po}var Mo={},N_;function cF(){if(N_)return Mo;N_=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.isBrowser=Mo.isNode=Mo.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Mo.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Mo.isNode=e;function r(){return!t()&&!e()}return Mo.isBrowser=r,Mo}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(aF(),t),e.__exportStar(cF(),t)})(D_);function ha(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function sc(t=6){return BigInt(ha(t))}function da(t,e,r){return{id:r||ha(),jsonrpc:"2.0",method:t,params:e}}function Vd(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Gd(t,e,r){return{id:t,jsonrpc:"2.0",error:uF(e)}}function uF(t,e){return typeof t>"u"?T_(I_):(typeof t=="string"&&(t=Object.assign(Object.assign({},T_(p1)),{message:t})),sF(t.code)&&(t=oF(t.code)),t)}let fF=class{},lF=class extends fF{constructor(){super()}},hF=class extends lF{constructor(e){super()}};const dF="^https?:",pF="^wss?:";function gF(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function L_(t,e){const r=gF(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function k_(t){return L_(t,dF)}function B_(t){return L_(t,pF)}function mF(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function $_(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function g1(t){return $_(t)&&"method"in t}function Yd(t){return $_(t)&&(Hs(t)||Yi(t))}function Hs(t){return"result"in t}function Yi(t){return"error"in t}let Ji=class extends hF{constructor(e){super(e),this.events=new qi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(da(e.method,e.params||[],e.id||sc().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Yi(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Yd(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const vF=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),bF=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",F_=t=>t.split("?")[0],j_=10,yF=vF();let wF=class{constructor(e){if(this.url=e,this.events=new qi.EventEmitter,this.registering=!1,!B_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(mo(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!B_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=D_.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!mF(e)},o=new yF(e,[],s);bF()?o.onerror=a=>{const u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ka(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return R_(e,F_(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>j_&&this.events.setMaxListeners(j_)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${F_(this.url)}`));return this.events.emit("register_error",r),r}};var Jd={exports:{}};Jd.exports,function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",u="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",p="[object Date]",y="[object Error]",A="[object Function]",P="[object GeneratorFunction]",N="[object Map]",D="[object Number]",k="[object Null]",B="[object Object]",j="[object Promise]",U="[object Proxy]",K="[object RegExp]",J="[object Set]",T="[object String]",z="[object Symbol]",ue="[object Undefined]",_e="[object WeakMap]",G="[object ArrayBuffer]",E="[object DataView]",m="[object Float32Array]",f="[object Float64Array]",g="[object Int8Array]",v="[object Int16Array]",x="[object Int32Array]",_="[object Uint8Array]",S="[object Uint8ClampedArray]",b="[object Uint16Array]",M="[object Uint32Array]",I=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,O={};O[m]=O[f]=O[g]=O[v]=O[x]=O[_]=O[S]=O[b]=O[M]=!0,O[a]=O[u]=O[G]=O[d]=O[E]=O[p]=O[y]=O[A]=O[N]=O[D]=O[B]=O[K]=O[J]=O[T]=O[_e]=!1;var se=typeof nn=="object"&&nn&&nn.Object===Object&&nn,ee=typeof self=="object"&&self&&self.Object===Object&&self,X=se||ee||Function("return this")(),Q=e&&!e.nodeType&&e,R=Q&&!0&&t&&!t.nodeType&&t,Z=R&&R.exports===Q,te=Z&&se.process,le=function(){try{return te&&te.binding&&te.binding("util")}catch{}}(),ie=le&&le.isTypedArray;function fe(ce,ye){for(var Ye=-1,It=ce==null?0:ce.length,jr=0,ir=[];++Ye-1}function st(ce,ye){var Ye=this.__data__,It=Xe(Ye,ce);return It<0?(++this.size,Ye.push([ce,ye])):Ye[It][1]=ye,this}Re.prototype.clear=De,Re.prototype.delete=it,Re.prototype.get=Ue,Re.prototype.has=gt,Re.prototype.set=st;function tt(ce){var ye=-1,Ye=ce==null?0:ce.length;for(this.clear();++yewn))return!1;var Ur=ir.get(ce);if(Ur&&ir.get(ye))return Ur==ye;var gn=-1,_i=!0,xn=Ye&s?new _t:void 0;for(ir.set(ce,ye),ir.set(ye,ce);++gn-1&&ce%1==0&&ce-1&&ce%1==0&&ce<=o}function up(ce){var ye=typeof ce;return ce!=null&&(ye=="object"||ye=="function")}function Pc(ce){return ce!=null&&typeof ce=="object"}var fp=ie?Te(ie):dr;function Ub(ce){return Fb(ce)?qe(ce):pr(ce)}function Fr(){return[]}function kr(){return!1}t.exports=jb}(Jd,Jd.exports);var xF=Jd.exports;const _F=ji(xF),U_="wc",q_=2,z_="core",Ws=`${U_}@2:${z_}:`,EF={logger:"error"},SF={database:":memory:"},AF="crypto",H_="client_ed25519_seed",PF=mt.ONE_DAY,MF="keychain",IF="0.3",CF="messages",TF="0.3",RF=mt.SIX_HOURS,DF="publisher",W_="irn",OF="error",K_="wss://relay.walletconnect.org",NF="relayer",ii={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},LF="_subscription",Xi={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},kF=.1,m1="2.17.2",Wr={link_mode:"link_mode",relay:"relay"},BF="0.3",$F="WALLETCONNECT_CLIENT_ID",V_="WALLETCONNECT_LINK_MODE_APPS",Ks={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},FF="subscription",jF="0.3",UF=mt.FIVE_SECONDS*1e3,qF="pairing",zF="0.3",Ml={wc_pairingDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:0},res:{ttl:mt.ONE_DAY,prompt:!1,tag:0}}},oc={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},bs={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},HF="history",WF="0.3",KF="expirer",Zi={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},VF="0.3",GF="verify-api",YF="https://verify.walletconnect.com",G_="https://verify.walletconnect.org",Il=G_,JF=`${Il}/v3`,XF=[YF,G_],ZF="echo",QF="https://echo.walletconnect.com",Vs={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},Io={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},ys={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},ac={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},cc={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Cl={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},ej=.1,tj="event-client",rj=86400,nj="https://pulse.walletconnect.org/batch";function ij(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(j);k!==B;){for(var K=P[k],J=0,T=j-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=j-D;z!==j&&U[z]===0;)z++;for(var ue=u.repeat(N);z>>0,j=new Uint8Array(B);P[N];){var U=r[P.charCodeAt(N)];if(U===255)return;for(var K=0,J=B-1;(U!==0||K>>0,j[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,N++}if(P[N]!==" "){for(var T=B-k;T!==B&&j[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=j[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:A}}var sj=ij,oj=sj;const Y_=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},aj=t=>new TextEncoder().encode(t),cj=t=>new TextDecoder().decode(t);class uj{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class fj{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return J_(this,e)}}class lj{constructor(e){this.decoders=e}or(e){return J_(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const J_=(t,e)=>new lj({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class hj{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new uj(e,r,n),this.decoder=new fj(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Xd=({name:t,prefix:e,encode:r,decode:n})=>new hj(t,e,r,n),Tl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=oj(r,e);return Xd({prefix:t,name:e,encode:n,decode:s=>Y_(i(s))})},dj=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},pj=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Xd({prefix:e,name:t,encode(i){return pj(i,n,r)},decode(i){return dj(i,n,r,t)}}),gj=Xd({prefix:"\0",name:"identity",encode:t=>cj(t),decode:t=>aj(t)});var mj=Object.freeze({__proto__:null,identity:gj});const vj=zn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var bj=Object.freeze({__proto__:null,base2:vj});const yj=zn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var wj=Object.freeze({__proto__:null,base8:yj});const xj=Tl({prefix:"9",name:"base10",alphabet:"0123456789"});var _j=Object.freeze({__proto__:null,base10:xj});const Ej=zn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Sj=zn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Aj=Object.freeze({__proto__:null,base16:Ej,base16upper:Sj});const Pj=zn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Mj=zn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ij=zn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Cj=zn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Tj=zn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Rj=zn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Dj=zn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Oj=zn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Nj=zn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Lj=Object.freeze({__proto__:null,base32:Pj,base32upper:Mj,base32pad:Ij,base32padupper:Cj,base32hex:Tj,base32hexupper:Rj,base32hexpad:Dj,base32hexpadupper:Oj,base32z:Nj});const kj=Tl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Bj=Tl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var $j=Object.freeze({__proto__:null,base36:kj,base36upper:Bj});const Fj=Tl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),jj=Tl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Uj=Object.freeze({__proto__:null,base58btc:Fj,base58flickr:jj});const qj=zn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zj=zn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Hj=zn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Wj=zn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Kj=Object.freeze({__proto__:null,base64:qj,base64pad:zj,base64url:Hj,base64urlpad:Wj});const X_=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Vj=X_.reduce((t,e,r)=>(t[r]=e,t),[]),Gj=X_.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Yj(t){return t.reduce((e,r)=>(e+=Vj[r],e),"")}function Jj(t){const e=[];for(const r of t){const n=Gj[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const Xj=Xd({prefix:"🚀",name:"base256emoji",encode:Yj,decode:Jj});var Zj=Object.freeze({__proto__:null,base256emoji:Xj}),Qj=Q_,Z_=128,eU=127,tU=~eU,rU=Math.pow(2,31);function Q_(t,e,r){e=e||[],r=r||0;for(var n=r;t>=rU;)e[r++]=t&255|Z_,t/=128;for(;t&tU;)e[r++]=t&255|Z_,t>>>=7;return e[r]=t|0,Q_.bytes=r-n+1,e}var nU=v1,iU=128,e6=127;function v1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw v1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&e6)<=iU);return v1.bytes=s-n,r}var sU=Math.pow(2,7),oU=Math.pow(2,14),aU=Math.pow(2,21),cU=Math.pow(2,28),uU=Math.pow(2,35),fU=Math.pow(2,42),lU=Math.pow(2,49),hU=Math.pow(2,56),dU=Math.pow(2,63),pU=function(t){return t(t6.encode(t,e,r),e),n6=t=>t6.encodingLength(t),b1=(t,e)=>{const r=e.byteLength,n=n6(t),i=n+n6(r),s=new Uint8Array(i+r);return r6(t,s,0),r6(r,s,n),s.set(e,i),new mU(t,r,e,s)};class mU{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const i6=({name:t,code:e,encode:r})=>new vU(t,e,r);class vU{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?b1(this.code,r):r.then(n=>b1(this.code,n))}else throw Error("Unknown type, must be binary type")}}const s6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),bU=i6({name:"sha2-256",code:18,encode:s6("SHA-256")}),yU=i6({name:"sha2-512",code:19,encode:s6("SHA-512")});var wU=Object.freeze({__proto__:null,sha256:bU,sha512:yU});const o6=0,xU="identity",a6=Y_;var _U=Object.freeze({__proto__:null,identity:{code:o6,name:xU,encode:a6,digest:t=>b1(o6,a6(t))}});new TextEncoder,new TextDecoder;const c6={...mj,...bj,...wj,..._j,...Aj,...Lj,...$j,...Uj,...Kj,...Zj};({...wU,..._U});function EU(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function u6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const f6=u6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),y1=u6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=EU(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=ut("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,V3(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?G3(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}},MU=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=AF,this.randomSessionIdentifier=c1(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=wx(i);return yx(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=ZB();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=wx(s),a=this.randomSessionIdentifier;return await LO(a,i,PF,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),u=QB(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||Hd(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=h_(o),u=mo(s);if(p_(a))return t$(u,o==null?void 0:o.encoding);if(d_(a)){const y=a.senderPublicKey,A=a.receiverPublicKey;i=await this.generateSharedKey(y,A)}const l=this.getSymKey(i),{type:d,senderPublicKey:p}=a;return e$({type:d,symKey:l,message:u,senderPublicKey:p,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=i$(s,o);if(p_(a)){const u=n$(s,o==null?void 0:o.encoding);return Ka(u)}if(d_(a)){const u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{const u=this.getSymKey(i),l=r$({symKey:u,encoded:s,encoding:o==null?void 0:o.encoding});return Ka(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=(i,s=la)=>{const o=xl({encoded:i,encoding:s});return nc(o.type)},this.getPayloadSenderPublicKey=(i,s=la)=>{const o=xl({encoded:i,encoding:s});return o.senderPublicKey?Tn(o.senderPublicKey,ni):void 0},this.core=e,this.logger=ri(r,this.name),this.keychain=n||new PU(this.core,this.logger)}get context(){return gi(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(H_)}catch{e=c1(),await this.keychain.set(H_,e)}return AU(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}};class IU extends zR{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=CF,this.version=TF,this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Ao(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Ao(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=ri(e,this.name),this.core=r}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,V3(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?G3(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class CU extends HR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new qi.EventEmitter,this.name=DF,this.queue=new Map,this.publishTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.failedPublishTimeout=mt.toMiliseconds(mt.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||RF,u=u1(s),l=(s==null?void 0:s.prompt)||!1,d=(s==null?void 0:s.tag)||0,p=(s==null?void 0:s.id)||sc().toString(),y={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:d,id:p,attestation:s==null?void 0:s.attestation}},A=`Failed to publish payload, please try again. id:${p} tag:${d}`,P=Date.now();let N,D=1;try{for(;N===void 0;){if(Date.now()-P>this.publishTimeout)throw new Error(A);this.logger.trace({id:p,attempts:D},`publisher.publish - attempt ${D}`),N=await await Au(this.rpcPublish(n,i,a,u,l,d,p,s==null?void 0:s.attestation).catch(k=>this.logger.warn(k)),this.publishTimeout,A),D++,N||await new Promise(k=>setTimeout(k,this.failedPublishTimeout))}this.relayer.events.emit(ii.publish,y),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:p,topic:n,message:i,opts:s}})}catch(k){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(k),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw k;this.queue.set(p,y)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=ri(r,this.name),this.registerEventListeners()}get context(){return gi(this.logger)}rpcPublish(e,r,n,i,s,o,a,u){var l,d,p,y;const A={method:_l(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:u},id:a};return bi((l=A.params)==null?void 0:l.prompt)&&((d=A.params)==null||delete d.prompt),bi((p=A.params)==null?void 0:p.tag)&&((y=A.params)==null||delete y.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:A}),this.relayer.request(A)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(iu.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ii.connection_stalled);return}this.checkQueue()}),this.relayer.on(ii.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class TU{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var RU=Object.defineProperty,DU=Object.defineProperties,OU=Object.getOwnPropertyDescriptors,l6=Object.getOwnPropertySymbols,NU=Object.prototype.hasOwnProperty,LU=Object.prototype.propertyIsEnumerable,h6=(t,e,r)=>e in t?RU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rl=(t,e)=>{for(var r in e||(e={}))NU.call(e,r)&&h6(t,r,e[r]);if(l6)for(var r of l6(e))LU.call(e,r)&&h6(t,r,e[r]);return t},w1=(t,e)=>DU(t,OU(e));class kU extends VR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new TU,this.events=new qi.EventEmitter,this.name=FF,this.version=jF,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Ws,this.subscribeTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=u1(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new mt.Watch;a.start(i);const u=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(u),a.stop(i),s(!0)),a.elapsed(i)>=UF&&(clearInterval(u),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ri(r,this.name),this.clientId=""}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=u1(n);await this.rpcUnsubscribe(e,r,i);const s=Dr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===Wr.relay&&await this.restartToComplete();const s={method:_l(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=Ao(e+this.clientId);if((n==null?void 0:n.transportType)===Wr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},mt.toMiliseconds(mt.ONE_SECOND)),a;const u=await Au(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return u?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ii.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Au(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Au(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:_l(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,w1(Rl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Rl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Rl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Ks.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Ks.deleted,w1(Rl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Ks.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);ic(r)&&this.onBatchSubscribe(r.map((n,i)=>w1(Rl({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(iu.pulse,async()=>{await this.checkPending()}),this.events.on(Ks.created,async e=>{const r=Ks.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Ks.deleted,async e=>{const r=Ks.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var BU=Object.defineProperty,d6=Object.getOwnPropertySymbols,$U=Object.prototype.hasOwnProperty,FU=Object.prototype.propertyIsEnumerable,p6=(t,e,r)=>e in t?BU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,g6=(t,e)=>{for(var r in e||(e={}))$U.call(e,r)&&p6(t,r,e[r]);if(d6)for(var r of d6(e))FU.call(e,r)&&p6(t,r,e[r]);return t};class jU extends WR{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new qi.EventEmitter,this.name=NF,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=mt.toMiliseconds(mt.THIRTY_SECONDS+mt.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||sc().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(u,l)=>{const d=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Xi.disconnect,d);const p=await o;this.provider.off(Xi.disconnect,d),u(p)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(jd())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(ii.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ii.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Xi.payload,this.onPayloadHandler),this.provider.on(Xi.connect,this.onConnectHandler),this.provider.on(Xi.disconnect,this.onDisconnectHandler),this.provider.on(Xi.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ri(e.logger,this.name):Qf(od({level:e.logger||OF})),this.messages=new IU(this.logger,e.core),this.subscriber=new kU(this,this.logger),this.publisher=new CU(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||K_,this.projectId=e.projectId,this.bundleId=mB(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return gi(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Wr.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",u;const l=d=>{d.topic===e&&(this.subscriber.off(Ks.created,l),u())};return await Promise.all([new Promise(d=>{u=d,this.subscriber.on(Ks.created,l)}),new Promise(async(d,p)=>{a=await this.subscriber.subscribe(e,g6({internal:{throwOnFailedPublish:o}},r)).catch(y=>{o&&p(y)})||a,d()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Au(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Xi.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Xi.disconnect,i),await Au(this.provider.connect(),mt.toMiliseconds(mt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await M_())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=En(mt.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(ii.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(jd())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Ji(new wF(wB({sdkVersion:m1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),g1(e)){if(!e.method.endsWith(LF))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:Wr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(g6({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else Yd(e)&&this.events.emit(ii.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ii.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Vd(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Xi.payload,this.onPayloadHandler),this.provider.off(Xi.connect,this.onConnectHandler),this.provider.off(Xi.disconnect,this.onDisconnectHandler),this.provider.off(Xi.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await M_();X$(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(ii.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},mt.toMiliseconds(kF))))}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var UU=Object.defineProperty,m6=Object.getOwnPropertySymbols,qU=Object.prototype.hasOwnProperty,zU=Object.prototype.propertyIsEnumerable,v6=(t,e,r)=>e in t?UU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b6=(t,e)=>{for(var r in e||(e={}))qU.call(e,r)&&v6(t,r,e[r]);if(m6)for(var r of m6(e))zU.call(e,r)&&v6(t,r,e[r]);return t};class uc extends KR{constructor(e,r,n,i=Ws,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=BF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!bi(o)?this.map.set(this.getKey(o),o):I$(o)?this.map.set(o.id,o):C$(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>_F(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const u=b6(b6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=ri(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class HU{constructor(e,r){this.core=e,this.logger=r,this.name=qF,this.version=zF,this.events=new Yg,this.initialized=!1,this.storagePrefix=Ws,this.ignoredPayloadTypes=[So],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=c1(),s=await this.core.crypto.setSymKey(i),o=En(mt.FIVE_MINUTES),a={protocol:W_},u={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=y_({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(oc.create,u),this.core.expirer.set(s,o),await this.pairings.set(s,u),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Vs.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:u,methods:l}=b_(n.uri);i.props.properties.topic=s,i.addTrace(Vs.pairing_uri_validation_success),i.addTrace(Vs.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(Vs.existing_pairing),d.active)throw i.setError(Io.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Vs.pairing_not_expired)}const p=u||En(mt.FIVE_MINUTES),y={topic:s,relay:a,expiry:p,active:!1,methods:l};this.core.expirer.set(s,p),await this.pairings.set(s,y),i.addTrace(Vs.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(oc.create,y),i.addTrace(Vs.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Vs.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Io.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(A){throw i.setError(Io.subscribe_pairing_topic_failure),A}return i.addTrace(Vs.subscribe_pairing_topic_success),y},this.activate=async({topic:n})=>{this.isInitialized();const i=En(mt.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=tc();this.events.once(vr("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Dr("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,u=this.core.crypto.keychain.get(i);return y_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:u,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=da(i,s),a=await this.core.crypto.encode(n,o),u=Ml[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{const o=Vd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=Gd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method]?Ml[u.request.method].res:Ml.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Dr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>fa(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(oc.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{Hs(i)?this.events.emit(vr("pairing_ping",s),{}):Yi(i)&&this.events.emit(vr("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(oc.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Dr("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Dr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!yi(n)){const{message:a}=ut("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!M$(n.uri)){const{message:a}=ut("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}const o=b_(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&mt.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!an(n,!1)){const{message:i}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(fa(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ut("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=ri(r,this.name),this.pairings=new uc(this.core,this.logger,this.name,this.storagePrefix)}get context(){return gi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ii.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===Wr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{g1(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):Yd(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Zi.expired,async e=>{const{topic:r}=J3(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(oc.expire,{topic:r}))})}}class WU extends qR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new qi.EventEmitter,this.name=HF,this.version=WF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:En(mt.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(bs.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Yi(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(bs.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(bs.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:da(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(bs.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(bs.created,e=>{const r=bs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.updated,e=>{const r=bs.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.deleted,e=>{const r=bs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(iu.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{mt.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(bs.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class KU extends GR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new qi.EventEmitter,this.name=KF,this.version=VF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Zi.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Zi.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return xB(e);if(typeof e=="number")return _B(e);const{message:r}=ut("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Zi.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;mt.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Zi.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(iu.pulse,()=>this.checkExpirations()),this.events.on(Zi.created,e=>{const r=Zi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.expired,e=>{const r=Zi.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.deleted,e=>{const r=Zi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class VU extends YR{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=GF,this.verifyUrlV3=JF,this.storagePrefix=Ws,this.version=q_,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&mt.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!pl()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,u=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=nl(),d=this.startAbortTimer(mt.ONE_SECOND*5),p=await new Promise((y,A)=>{const P=()=>{window.removeEventListener("message",D),l.body.removeChild(N),A("attestation aborted")};this.abortController.signal.addEventListener("abort",P);const N=l.createElement("iframe");N.src=u,N.style.display="none",N.addEventListener("error",P,{signal:this.abortController.signal});const D=k=>{if(k.data&&typeof k.data=="string")try{const B=JSON.parse(k.data);if(B.type==="verify_attestation"){if(gm(B.attestation).payload.id!==o)return;clearInterval(d),l.body.removeChild(N),this.abortController.signal.removeEventListener("abort",P),window.removeEventListener("message",D),y(B.attestation===null?"":B.attestation)}}catch(B){this.logger.warn(B)}};l.body.appendChild(N),window.addEventListener("message",D,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",p),p}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(gm(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const u=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,u)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(mt.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Il;return XF.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Il}`),s=Il),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(mt.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=c$(i,s.publicKey),a={hasExpired:mt.toMiliseconds(o.exp)this.abortController.abort(),mt.toMiliseconds(e))}}class GU extends JR{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=ZF,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${QF}/${this.projectId}/clients`;await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=ri(r,this.context)}}var YU=Object.defineProperty,y6=Object.getOwnPropertySymbols,JU=Object.prototype.hasOwnProperty,XU=Object.prototype.propertyIsEnumerable,w6=(t,e,r)=>e in t?YU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dl=(t,e)=>{for(var r in e||(e={}))JU.call(e,r)&&w6(t,r,e[r]);if(y6)for(var r of y6(e))XU.call(e,r)&&w6(t,r,e[r]);return t};class ZU extends XR{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=tj,this.storagePrefix=Ws,this.storageVersion=ej,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!i1())try{const i={eventId:Z3(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:K3(this.core.relayer.protocol,this.core.relayer.version,m1)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:u}}=i,l=Z3(),d=this.core.projectId||"",p=Date.now(),y=Dl({eventId:l,timestamp:p,props:{event:s,type:o,properties:{topic:a,trace:u}},bundleId:d,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,y),this.shouldPersist=!0),y},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(u=>u.props.properties.topic===o);if(a)return Dl(Dl({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(iu.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{mt.fromMiliseconds(Date.now())-mt.fromMiliseconds(i.timestamp)>rj&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Dl(Dl({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${nj}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${m1}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>W3().url,this.logger=ri(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var QU=Object.defineProperty,x6=Object.getOwnPropertySymbols,eq=Object.prototype.hasOwnProperty,tq=Object.prototype.propertyIsEnumerable,_6=(t,e,r)=>e in t?QU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,E6=(t,e)=>{for(var r in e||(e={}))eq.call(e,r)&&_6(t,r,e[r]);if(x6)for(var r of x6(e))tq.call(e,r)&&_6(t,r,e[r]);return t};class x1 extends UR{constructor(e){var r;super(e),this.protocol=U_,this.version=q_,this.name=z_,this.events=new qi.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:u})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:Wr.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||K_,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=od({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:EF.logger}),{logger:i,chunkLoggerController:s}=jR({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ri(i,this.name),this.heartbeat=new NT,this.crypto=new MU(this,this.logger,e==null?void 0:e.keychain),this.history=new WU(this,this.logger),this.expirer=new KU(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new hR(E6(E6({},SF),e==null?void 0:e.storageOptions)),this.relayer=new jU({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new HU(this,this.logger),this.verify=new VU(this,this.logger,this.storage),this.echoClient=new GU(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new ZU(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new x1(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem($F,n),r}get context(){return gi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(V_,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(V_)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const rq=x1,S6="wc",A6=2,P6="client",_1=`${S6}@${A6}:${P6}:`,E1={name:P6,logger:"error"},M6="WALLETCONNECT_DEEPLINK_CHOICE",nq="proposal",I6="Proposal expired",iq="session",Mu=mt.SEVEN_DAYS,sq="engine",kn={wc_sessionPropose:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:mt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:mt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1119}}},S1={min:mt.FIVE_MINUTES,max:mt.SEVEN_DAYS},Gs={idle:"IDLE",active:"ACTIVE"},oq="request",aq=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],cq="wc",uq="auth",fq="authKeys",lq="pairingTopics",hq="requests",Zd=`${cq}@${1.5}:${uq}:`,Qd=`${Zd}:PUB_KEY`;var dq=Object.defineProperty,pq=Object.defineProperties,gq=Object.getOwnPropertyDescriptors,C6=Object.getOwnPropertySymbols,mq=Object.prototype.hasOwnProperty,vq=Object.prototype.propertyIsEnumerable,T6=(t,e,r)=>e in t?dq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))mq.call(e,r)&&T6(t,r,e[r]);if(C6)for(var r of C6(e))vq.call(e,r)&&T6(t,r,e[r]);return t},ws=(t,e)=>pq(t,gq(e));class bq extends QR{constructor(e){super(e),this.name=sq,this.events=new Yg,this.initialized=!1,this.requestQueue={state:Gs.idle,queue:[]},this.sessionRequestQueue={state:Gs.idle,queue:[]},this.requestQueueDelay=mt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(kn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=ws(tn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n;let l=i,d,p=!1;try{l&&(p=this.client.core.pairing.pairings.get(l).active)}catch(U){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),U}if(!l||!p){const{topic:U,uri:K}=await this.client.core.pairing.create();l=U,d=K}if(!l){const{message:U}=ut("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(U)}const y=await this.client.core.crypto.generateKeyPair(),A=kn.wc_sessionPropose.req.ttl||mt.FIVE_MINUTES,P=En(A),N=tn({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:W_}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:P,pairingTopic:l},a&&{sessionProperties:a}),{reject:D,resolve:k,done:B}=tc(A,I6);this.events.once(vr("session_connect"),async({error:U,session:K})=>{if(U)D(U);else if(K){K.self.publicKey=y;const J=ws(tn({},K),{pairingTopic:N.pairingTopic,requiredNamespaces:N.requiredNamespaces,optionalNamespaces:N.optionalNamespaces,transportType:Wr.relay});await this.client.session.set(K.topic,J),await this.setExpiry(K.topic,K.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:K.peer.metadata}),this.cleanupDuplicatePairings(J),k(J)}});const j=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:N,throwOnFailedPublish:!0});return await this.setProposal(j,tn({id:j},N)),{uri:d,approval:B}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[ys.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(z){throw o.setError(ac.no_internet_connection),z}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(z){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(ac.proposal_not_found),z}try{await this.isValidApprove(r)}catch(z){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(ac.session_approve_namespace_validation_failure),z}const{id:a,relayProtocol:u,namespaces:l,sessionProperties:d,sessionConfig:p}=r,y=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:A,proposer:P,requiredNamespaces:N,optionalNamespaces:D}=y;let k=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:A});k||(k=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:ys.session_approve_started,properties:{topic:A,trace:[ys.session_approve_started,ys.session_namespaces_validation_success]}}));const B=await this.client.core.crypto.generateKeyPair(),j=P.publicKey,U=await this.client.core.crypto.generateSharedKey(B,j),K=tn(tn({relay:{protocol:u??"irn"},namespaces:l,controller:{publicKey:B,metadata:this.client.metadata},expiry:En(Mu)},d&&{sessionProperties:d}),p&&{sessionConfig:p}),J=Wr.relay;k.addTrace(ys.subscribing_session_topic);try{await this.client.core.relayer.subscribe(U,{transportType:J})}catch(z){throw k.setError(ac.subscribe_session_topic_failure),z}k.addTrace(ys.subscribe_session_topic_success);const T=ws(tn({},K),{topic:U,requiredNamespaces:N,optionalNamespaces:D,pairingTopic:A,acknowledged:!1,self:K.controller,peer:{publicKey:P.publicKey,metadata:P.metadata},controller:B,transportType:Wr.relay});await this.client.session.set(U,T),k.addTrace(ys.store_session);try{k.addTrace(ys.publishing_session_settle),await this.sendRequest({topic:U,method:"wc_sessionSettle",params:K,throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(ac.session_settle_publish_failure),z}),k.addTrace(ys.session_settle_publish_success),k.addTrace(ys.publishing_session_approve),await this.sendResult({id:a,topic:A,result:{relay:{protocol:u??"irn"},responderPublicKey:B},throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(ac.session_approve_publish_failure),z}),k.addTrace(ys.session_approve_publish_success)}catch(z){throw this.client.logger.error(z),this.client.session.delete(U,Dr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(U),z}return this.client.core.eventClient.deleteEvent({eventId:k.eventId}),await this.client.core.pairing.updateMetadata({topic:A,metadata:P.metadata}),await this.client.proposal.delete(a,Dr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:A}),await this.setExpiry(U,En(Mu)),{topic:U,acknowledged:()=>Promise.resolve(this.client.session.get(U))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:kn.wc_sessionPropose.reject}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(p){throw this.client.logger.error("update() -> isValidUpdate() failed"),p}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=tc(),u=ha(),l=sc().toString(),d=this.client.session.get(n).namespaces;return this.events.once(vr("session_update",u),({error:p})=>{p?a(p):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:u,relayRpcId:l}).catch(p=>{this.client.logger.error(p),this.client.session.update(n,{namespaces:d}),a(p)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(u){throw this.client.logger.error("extend() -> isValidExtend() failed"),u}const{topic:n}=r,i=ha(),{done:s,resolve:o,reject:a}=tc();return this.events.once(vr("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,En(Mu)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(u=>{a(u)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(P){throw this.client.logger.error("request() -> isValidRequest() failed"),P}const{chainId:n,request:i,topic:s,expiry:o=kn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=ha(),l=sc().toString(),{done:d,resolve:p,reject:y}=tc(o,"Request expired. Please try again.");this.events.once(vr("session_request",u),({error:P,result:N})=>{P?y(P):p(N)});const A=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return A?(await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:A}).catch(P=>y(P)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),await d()):await Promise.all([new Promise(async P=>{await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(N=>y(N)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),P()}),new Promise(async P=>{var N;if(!((N=a.sessionConfig)!=null&&N.disableDeepLink)){const D=await AB(this.client.core.storage,M6);await EB({id:u,topic:s,wcDeepLink:D})}P()}),d()]).then(P=>P[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);Hs(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Yi(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=ha(),s=sc().toString(),{done:o,resolve:a,reject:u}=tc();this.events.once(vr("session_ping",i),({error:l})=>{l?u(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=sc().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Dr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ut("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>A$(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?Wr.link_mode:Wr.relay;o===Wr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:u="",uri:l,domain:d,nonce:p,type:y,exp:A,nbf:P,methods:N=[],expiry:D}=r,k=[...r.resources||[]],{topic:B,uri:j}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:B,uri:j}});const U=await this.client.core.crypto.generateKeyPair(),K=Hd(U);if(await Promise.all([this.client.auth.authKeys.set(Qd,{responseTopic:K,publicKey:U}),this.client.auth.pairingTopics.set(K,{topic:K,pairingTopic:B})]),await this.client.core.relayer.subscribe(K,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${B}`),N.length>0){const{namespace:_}=Eu(a[0]);let S=KB(_,"request",N);zd(k)&&(S=GB(S,k.pop())),k.push(S)}const J=D&&D>kn.wc_sessionAuthenticate.req.ttl?D:kn.wc_sessionAuthenticate.req.ttl,T={authPayload:{type:y??"caip122",chains:a,statement:u,aud:l,domain:d,version:"1",nonce:p,iat:new Date().toISOString(),exp:A,nbf:P,resources:k},requester:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(J)},z={eip155:{chains:a,methods:[...new Set(["personal_sign",...N])],events:["chainChanged","accountsChanged"]}},ue={requiredNamespaces:{},optionalNamespaces:z,relays:[{protocol:"irn"}],pairingTopic:B,proposer:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(kn.wc_sessionPropose.req.ttl)},{done:_e,resolve:G,reject:E}=tc(J,"Request expired"),m=async({error:_,session:S})=>{if(this.events.off(vr("session_request",g),f),_)E(_);else if(S){S.self.publicKey=U,await this.client.session.set(S.topic,S),await this.setExpiry(S.topic,S.expiry),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:S.peer.metadata});const b=this.client.session.get(S.topic);await this.deleteProposal(v),G({session:b})}},f=async _=>{var S,b,M;if(await this.deletePendingAuthRequest(g,{message:"fulfilled",code:0}),_.error){const X=Dr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return _.error.code===X.code?void 0:(this.events.off(vr("session_connect"),m),E(_.error.message))}await this.deleteProposal(v),this.events.off(vr("session_connect"),m);const{cacaos:I,responder:F}=_.result,ae=[],O=[];for(const X of I){await r_({cacao:X,projectId:this.client.core.projectId})||(this.client.logger.error(X,"Signature verification failed"),E(Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Q}=X,R=zd(Q.resources),Z=[o1(Q.iss)],te=qd(Q.iss);if(R){const le=s_(R),ie=o_(R);ae.push(...le),Z.push(...ie)}for(const le of Z)O.push(`${le}:${te}`)}const se=await this.client.core.crypto.generateSharedKey(U,F.publicKey);let ee;ae.length>0&&(ee={topic:se,acknowledged:!0,self:{publicKey:U,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:En(Mu),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:B,namespaces:w_([...new Set(ae)],[...new Set(O)]),transportType:o},await this.client.core.relayer.subscribe(se,{transportType:o}),await this.client.session.set(se,ee),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:F.metadata}),ee=this.client.session.get(se)),(S=this.client.metadata.redirect)!=null&&S.linkMode&&(b=F.metadata.redirect)!=null&&b.linkMode&&(M=F.metadata.redirect)!=null&&M.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(se,{transportType:Wr.link_mode})),G({auths:I,session:ee})},g=ha(),v=ha();this.events.once(vr("session_connect"),m),this.events.once(vr("session_request",g),f);let x;try{if(s){const _=da("wc_sessionAuthenticate",T,g);this.client.core.history.set(B,_);const S=await this.client.core.crypto.encode("",_,{type:yl,encoding:vl});x=Wd(n,B,S)}else await Promise.all([this.sendRequest({topic:B,method:"wc_sessionAuthenticate",params:T,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:g}),this.sendRequest({topic:B,method:"wc_sessionPropose",params:ue,expiry:kn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:v})])}catch(_){throw this.events.off(vr("session_connect"),m),this.events.off(vr("session_request",g),f),_}return await this.setProposal(v,tn({id:v},ue)),await this.setAuthRequest(g,{request:ws(tn({},T),{verifyContext:{}}),pairingTopic:B,transportType:o}),{uri:x??j,response:_e}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[cc.authenticated_session_approve_started]}});try{this.isInitialized()}catch(D){throw s.setError(Cl.no_internet_connection),D}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Cl.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||Wr.relay;a===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=Hd(u),p={type:So,receiverPublicKey:u,senderPublicKey:l},y=[],A=[];for(const D of i){if(!await r_({cacao:D,projectId:this.client.core.projectId})){s.setError(Cl.invalid_cacao);const K=Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:K,encodeOpts:p}),new Error(K.message)}s.addTrace(cc.cacaos_verified);const{p:k}=D,B=zd(k.resources),j=[o1(k.iss)],U=qd(k.iss);if(B){const K=s_(B),J=o_(B);y.push(...K),j.push(...J)}for(const K of j)A.push(`${K}:${U}`)}const P=await this.client.core.crypto.generateSharedKey(l,u);s.addTrace(cc.create_authenticated_session_topic);let N;if((y==null?void 0:y.length)>0){N={topic:P,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:u,metadata:o.requester.metadata},controller:u,expiry:En(Mu),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:w_([...new Set(y)],[...new Set(A)]),transportType:a},s.addTrace(cc.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(P,{transportType:a})}catch(D){throw s.setError(Cl.subscribe_authenticated_session_topic_failure),D}s.addTrace(cc.subscribe_authenticated_session_topic_success),await this.client.session.set(P,N),s.addTrace(cc.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(cc.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:p,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(D){throw s.setError(Cl.authenticated_session_approve_publish_failure),D}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:N}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),u=Hd(o),l={type:So,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:u,error:i,encodeOpts:l,rpcOpts:kn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return n_(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:u}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Dr("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(M6).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,Dr("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Gs.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(ac.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Dr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Gs.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,En(kn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=Wr.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||En(kn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l,appLink:d}=r,p=da(i,s,u);let y;const A=!!d;try{const D=A?vl:la;y=await this.client.core.crypto.encode(n,p,{encoding:D})}catch(D){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),D}let P;if(aq.includes(i)){const D=Ao(JSON.stringify(p)),k=Ao(y);P=await this.client.core.verify.register({id:k,decryptedId:D})}const N=kn[i].req;if(N.attestation=P,o&&(N.ttl=o),a&&(N.id=a),this.client.core.history.set(n,p),A){const D=Wd(d,n,y);await global.Linking.openURL(D,this.client.name)}else{const D=kn[i].req;o&&(D.ttl=o),a&&(D.id=a),l?(D.internal=ws(tn({},D.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,y,D)):this.client.core.relayer.publish(n,y,D).catch(k=>this.client.logger.error(k))}return p.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:u}=r,l=Vd(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=p?vl:la;d=await this.client.core.crypto.encode(i,l,ws(tn({},a||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),A}if(p){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=kn[y.request.method].res;o?(A.internal=ws(tn({},A.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,A)):this.client.core.relayer.publish(i,d,A).catch(P=>this.client.logger.error(P))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:u}=r,l=Gd(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=p?vl:la;d=await this.client.core.crypto.encode(i,l,ws(tn({},o||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),A}if(p){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=a||kn[y.request.method].res;this.client.core.relayer.publish(i,d,A)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;fa(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{fa(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Gs.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Gs.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Gs.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,u=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:u}))switch(u){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=ut("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:u}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(tn({},i.params));const d=a.expiryTimestamp||En(kn.wc_sessionPropose.req.ttl),p=tn({id:u,pairingTopic:n,expiryTimestamp:d},a);await this.setProposal(u,p);const y=await this.getVerifyContext({attestationId:s,hash:Ao(JSON.stringify(i)),encryptedId:o,metadata:p.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(Io.proposal_listener_not_found)),l==null||l.addTrace(Vs.emit_session_proposal),this.client.events.emit("session_proposal",{id:u,params:p,verifyContext:y})}catch(l){await this.sendError({id:u,topic:n,error:l,rpcOpts:kn.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(Hs(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const u=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const d=await this.client.core.crypto.generateSharedKey(u,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:d});const p=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:p}),await this.client.core.pairing.activate({topic:r})}else if(Yi(n)){await this.client.proposal.delete(s,Dr("USER_DISCONNECTED"));const o=vr("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(vr("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:u,namespaces:l,sessionProperties:d,sessionConfig:p}=n.params,y=ws(tn(tn({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},d&&{sessionProperties:d}),p&&{sessionConfig:p}),{transportType:Wr.relay}),A=vr("session_connect");if(this.events.listenerCount(A)===0)throw new Error(`emitting ${A} without any listeners 997`);this.events.emit(vr("session_connect"),{session:y}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;Hs(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(vr("session_approve",i),{})):Yi(n)&&(await this.client.session.delete(r,Dr("USER_DISCONNECTED")),this.events.emit(vr("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Dr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(tn({topic:r},i));try{Al.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(u){throw Al.delete(o),u}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=vr("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_update",i),{}):Yi(n)&&this.events.emit(vr("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,En(Mu)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=vr("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_extend",i),{}):Yi(n)&&this.events.emit(vr("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=vr("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{Hs(n)?this.events.emit(vr("session_ping",i),{}):Yi(n)&&this.events.emit(vr("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(ii.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Dr("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:u,encryptedId:l,transportType:d}=r,{id:p,params:y}=a;try{await this.isValidRequest(tn({topic:o},y));const A=this.client.session.get(o),P=await this.getVerifyContext({attestationId:u,hash:Ao(JSON.stringify(da("wc_sessionRequest",y,p))),encryptedId:l,metadata:A.peer.metadata,transportType:d}),N={id:p,topic:o,params:y,verifyContext:P};await this.setPendingSessionRequest(N),d===Wr.link_mode&&(n=A.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=A.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(N):(this.addSessionRequestToSessionRequestQueue(N),this.processSessionRequestQueue())}catch(A){await this.sendError({id:p,topic:o,error:A}),this.client.logger.error(A)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=vr("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(tn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Al.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:u}=r;try{const{requester:l,authPayload:d,expiryTimestamp:p}=s.params,y=await this.getVerifyContext({attestationId:o,hash:Ao(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:u}),A={requester:l,pairingTopic:i,id:s.id,authPayload:d,verifyContext:y,expiryTimestamp:p};await this.setAuthRequest(s.id,{request:A,pairingTopic:i,transportType:u}),u===Wr.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:y})}catch(l){this.client.logger.error(l);const d=s.params.requester.publicKey,p=await this.client.core.crypto.generateKeyPair(),y=this.getAppLinkIfEnabled(s.params.requester.metadata,u),A={type:So,receiverPublicKey:d,senderPublicKey:p};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:A,rpcOpts:kn.wc_sessionAuthenticate.autoReject,appLink:y})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Gs.idle,this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=vr("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(vr("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Gs.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Gs.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:da("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(bi(n)||await this.isValidPairingTopic(n),!B$(a)){const{message:u}=ut("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!bi(i)&&Sl(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!bi(s)&&Sl(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),bi(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=k$(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!yi(r))throw new Error(ut("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),u=h1(i,"approve()");if(u)throw new Error(u.message);const l=A_(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!an(s,!0)){const{message:d}=ut("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}bi(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!yi(r)){const{message:s}=ut("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!F$(i)){const{message:s}=ut("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!yi(r)){const{message:l}=ut("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!E_(n)){const{message:l}=ut("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=T$(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const u=h1(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(fa(o)){const{message:l}=ut("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=h1(i,"update()");if(o)throw new Error(o.message);const a=A_(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!S_(a,s)){const{message:u}=ut("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!j$(i)){const{message:u}=ut("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!z$(a,s,i.method)){const{message:u}=ut("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!V$(o,S1)){const{message:u}=ut("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${S1.min} and ${S1.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!yi(r)){const{message:o}=ut("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!U$(s)){const{message:o}=ut("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!yi(r)){const{message:a}=ut("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!S_(o,s)){const{message:a}=ut("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!q$(i)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!H$(o,s,i.name)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!an(i,!1))throw new Error("uri is required parameter");if(!an(s,!1))throw new Error("domain is required parameter");if(!an(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(u=>Eu(u).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Eu(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,u={verified:{verifyUrl:o.verifyUrl||Il,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Wr.link_mode){const d=this.getAppLinkIfEnabled(o,a);return u.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",u}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(u.verified.origin=l.origin,u.verified.isScam=l.isScam,u.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(u)}`),u},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!an(i,!1)){const{message:s}=ut("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,u,l,d,p,y;return!r||n!==Wr.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(u=this.client.metadata)==null?void 0:u.redirect)==null?void 0:l.universal)!==""&&((d=r==null?void 0:r.redirect)==null?void 0:d.universal)!==void 0&&((p=r==null?void 0:r.redirect)==null?void 0:p.universal)!==""&&((y=r==null?void 0:r.redirect)==null?void 0:y.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=X3(r,"topic")||"",i=decodeURIComponent(X3(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:Wr.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(i1()||Su()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ii.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(Qd)?this.client.auth.authKeys.get(Qd):{publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===Wr.link_mode?vl:la});try{g1(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:Ao(n)})):Yd(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(u){this.client.logger.error(u)}}registerExpirerEvents(){this.client.core.expirer.on(Zi.expired,async e=>{const{topic:r,id:n}=J3(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ut("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,ut("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(oc.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(oc.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=ut("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=ut("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=ut("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(an(e,!1)){const{message:r}=ut("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=ut("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!$$(e)){const{message:r}=ut("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=ut("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class yq extends uc{constructor(e,r){super(e,r,nq,_1),this.core=e,this.logger=r}}let wq=class extends uc{constructor(e,r){super(e,r,iq,_1),this.core=e,this.logger=r}};class xq extends uc{constructor(e,r){super(e,r,oq,_1,n=>n.id),this.core=e,this.logger=r}}class _q extends uc{constructor(e,r){super(e,r,fq,Zd,()=>Qd),this.core=e,this.logger=r}}class Eq extends uc{constructor(e,r){super(e,r,lq,Zd),this.core=e,this.logger=r}}class Sq extends uc{constructor(e,r){super(e,r,hq,Zd,n=>n.id),this.core=e,this.logger=r}}class Aq{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new _q(this.core,this.logger),this.pairingTopics=new Eq(this.core,this.logger),this.requests=new Sq(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class A1 extends ZR{constructor(e){super(e),this.protocol=S6,this.version=A6,this.name=E1.name,this.events=new qi.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||E1.name,this.metadata=(e==null?void 0:e.metadata)||W3(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||E1.logger}));this.core=(e==null?void 0:e.core)||new rq(e),this.logger=ri(r,this.name),this.session=new wq(this.core,this.logger),this.proposal=new yq(this.core,this.logger),this.pendingRequest=new xq(this.core,this.logger),this.engine=new bq(this),this.auth=new Aq(this.core,this.logger)}static async init(e){const r=new A1(e);return await r.initialize(),r}get context(){return gi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var e0={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */e0.exports,function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",l=500,d="__lodash_placeholder__",g=1,y=2,A=4,P=1,N=2,D=1,k=2,B=4,j=8,U=16,K=32,J=64,T=128,z=256,ue=512,_e=30,G="...",E=800,m=16,f=1,p=2,v=3,x=1/0,_=9007199254740991,S=17976931348623157e292,b=NaN,M=4294967295,I=M-1,F=M>>>1,ae=[["ary",T],["bind",D],["bindKey",k],["curry",j],["curryRight",U],["flip",ue],["partial",K],["partialRight",J],["rearg",z]],O="[object Arguments]",se="[object Array]",ee="[object AsyncFunction]",X="[object Boolean]",Q="[object Date]",R="[object DOMException]",Z="[object Error]",te="[object Function]",le="[object GeneratorFunction]",ie="[object Map]",fe="[object Number]",ve="[object Null]",Me="[object Object]",Ne="[object Promise]",Te="[object Proxy]",$e="[object RegExp]",Ie="[object Set]",Le="[object String]",Ve="[object Symbol]",ke="[object Undefined]",ze="[object WeakMap]",He="[object WeakSet]",Ee="[object ArrayBuffer]",Qe="[object DataView]",ct="[object Float32Array]",Be="[object Float64Array]",et="[object Int8Array]",rt="[object Int16Array]",Je="[object Int32Array]",pt="[object Uint8Array]",ht="[object Uint8ClampedArray]",ft="[object Uint16Array]",Ht="[object Uint32Array]",Jt=/\b__p \+= '';/g,St=/\b(__p \+=) '' \+/g,er=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Xt=/&(?:amp|lt|gt|quot|#39);/g,Ot=/[&<>"']/g,Bt=RegExp(Xt.source),Tt=RegExp(Ot.source),vt=/<%-([\s\S]+?)%>/g,Dt=/<%([\s\S]+?)%>/g,Lt=/<%=([\s\S]+?)%>/g,bt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$t=/^\w*$/,jt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(nt.source),$=/^\s+/,H=/\s/,V=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C=/\{\n\/\* \[wrapped with (.+)\] \*/,Y=/,? & /,q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,oe=/[()=,{}\[\]\/\s]/,pe=/\\(\\)?/g,xe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Re=/\w*$/,De=/^[-+]0x[0-9a-f]+$/i,it=/^0b[01]+$/i,Ue=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,st=/^(?:0|[1-9]\d*)$/,tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,Rt=/['\n\r\u2028\u2029\\]/g,Mt="\\ud800-\\udfff",Et="\\u0300-\\u036f",dt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",ot=Et+dt+_t,wt="\\u2700-\\u27bf",lt="a-z\\xdf-\\xf6\\xf8-\\xff",at="\\xac\\xb1\\xd7\\xf7",Ae="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Pe="\\u2000-\\u206f",Ge=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="A-Z\\xc0-\\xd6\\xd8-\\xde",qe="\\ufe0e\\ufe0f",Xe=at+Ae+Pe+Ge,kt="['’]",Wt="["+Mt+"]",Zt="["+Xe+"]",Kt="["+ot+"]",de="\\d+",nr="["+wt+"]",dr="["+lt+"]",pr="[^"+Mt+Xe+de+wt+lt+je+"]",Qt="\\ud83c[\\udffb-\\udfff]",gr="(?:"+Kt+"|"+Qt+")",lr="[^"+Mt+"]",Lr="(?:\\ud83c[\\udde6-\\uddff]){2}",mr="[\\ud800-\\udbff][\\udc00-\\udfff]",wr="["+je+"]",Br="\\u200d",$r="(?:"+dr+"|"+pr+")",Ir="(?:"+wr+"|"+pr+")",hn="(?:"+kt+"(?:d|ll|m|re|s|t|ve))?",dn="(?:"+kt+"(?:D|LL|M|RE|S|T|VE))?",pn=gr+"?",sp="["+qe+"]?",$b="(?:"+Br+"(?:"+[lr,Lr,mr].join("|")+")"+sp+pn+")*",jo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",op="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ap=sp+pn+$b,Qu="(?:"+[nr,Lr,mr].join("|")+")"+ap,Fb="(?:"+[lr+Kt+"?",Kt,Lr,mr,Wt].join("|")+")",gh=RegExp(kt,"g"),jb=RegExp(Kt,"g"),ef=RegExp(Qt+"(?="+Qt+")|"+Fb+ap,"g"),cp=RegExp([wr+"?"+dr+"+"+hn+"(?="+[Zt,wr,"$"].join("|")+")",Ir+"+"+dn+"(?="+[Zt,wr+$r,"$"].join("|")+")",wr+"?"+$r+"+"+hn,wr+"+"+dn,op,jo,de,Qu].join("|"),"g"),up=RegExp("["+Br+Mt+ot+qe+"]"),Pc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ub=-1,Fr={};Fr[ct]=Fr[Be]=Fr[et]=Fr[rt]=Fr[Je]=Fr[pt]=Fr[ht]=Fr[ft]=Fr[Ht]=!0,Fr[O]=Fr[se]=Fr[Ee]=Fr[X]=Fr[Qe]=Fr[Q]=Fr[Z]=Fr[te]=Fr[ie]=Fr[fe]=Fr[Me]=Fr[$e]=Fr[Ie]=Fr[Le]=Fr[ze]=!1;var kr={};kr[O]=kr[se]=kr[Ee]=kr[Qe]=kr[X]=kr[Q]=kr[ct]=kr[Be]=kr[et]=kr[rt]=kr[Je]=kr[ie]=kr[fe]=kr[Me]=kr[$e]=kr[Ie]=kr[Le]=kr[Ve]=kr[pt]=kr[ht]=kr[ft]=kr[Ht]=!0,kr[Z]=kr[te]=kr[ze]=!1;var ce={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ye={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye={"&":"&","<":"<",">":">",""":'"',"'":"'"},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},jr=parseFloat,ir=parseInt,Yr=typeof nn=="object"&&nn&&nn.Object===Object&&nn,wn=typeof self=="object"&&self&&self.Object===Object&&self,_r=Yr||wn||Function("return this")(),Ur=e&&!e.nodeType&&e,gn=Ur&&!0&&t&&!t.nodeType&&t,_i=gn&&gn.exports===Ur,xn=_i&&Yr.process,Jr=function(){try{var be=gn&&gn.require&&gn.require("util").types;return be||xn&&xn.binding&&xn.binding("util")}catch{}}(),oi=Jr&&Jr.isArrayBuffer,Ps=Jr&&Jr.isDate,is=Jr&&Jr.isMap,ro=Jr&&Jr.isRegExp,mh=Jr&&Jr.isSet,Mc=Jr&&Jr.isTypedArray;function Bn(be,Fe,Ce){switch(Ce.length){case 0:return be.call(Fe);case 1:return be.call(Fe,Ce[0]);case 2:return be.call(Fe,Ce[0],Ce[1]);case 3:return be.call(Fe,Ce[0],Ce[1],Ce[2])}return be.apply(Fe,Ce)}function OQ(be,Fe,Ce,Ct){for(var tr=-1,Mr=be==null?0:be.length;++tr-1}function qb(be,Fe,Ce){for(var Ct=-1,tr=be==null?0:be.length;++Ct-1;);return Ce}function r9(be,Fe){for(var Ce=be.length;Ce--&&tf(Fe,be[Ce],0)>-1;);return Ce}function qQ(be,Fe){for(var Ce=be.length,Ct=0;Ce--;)be[Ce]===Fe&&++Ct;return Ct}var zQ=Kb(ce),HQ=Kb(ye);function WQ(be){return"\\"+It[be]}function KQ(be,Fe){return be==null?r:be[Fe]}function rf(be){return up.test(be)}function VQ(be){return Pc.test(be)}function GQ(be){for(var Fe,Ce=[];!(Fe=be.next()).done;)Ce.push(Fe.value);return Ce}function Jb(be){var Fe=-1,Ce=Array(be.size);return be.forEach(function(Ct,tr){Ce[++Fe]=[tr,Ct]}),Ce}function n9(be,Fe){return function(Ce){return be(Fe(Ce))}}function Ta(be,Fe){for(var Ce=-1,Ct=be.length,tr=0,Mr=[];++Ce-1}function Lee(c,h){var w=this.__data__,L=Ip(w,c);return L<0?(++this.size,w.push([c,h])):w[L][1]=h,this}Uo.prototype.clear=Ree,Uo.prototype.delete=Dee,Uo.prototype.get=Oee,Uo.prototype.has=Nee,Uo.prototype.set=Lee;function qo(c){var h=-1,w=c==null?0:c.length;for(this.clear();++h=h?c:h)),c}function cs(c,h,w,L,W,ne){var he,me=h&g,we=h&y,We=h&A;if(w&&(he=W?w(c,L,W,ne):w(c)),he!==r)return he;if(!Qr(c))return c;var Ke=sr(c);if(Ke){if(he=Fte(c),!me)return Ei(c,he)}else{var Ze=ti(c),xt=Ze==te||Ze==le;if(ka(c))return F9(c,me);if(Ze==Me||Ze==O||xt&&!W){if(he=we||xt?{}:iA(c),!me)return we?Ite(c,Xee(he,c)):Mte(c,g9(he,c))}else{if(!kr[Ze])return W?c:{};he=jte(c,Ze,me)}}ne||(ne=new Is);var Nt=ne.get(c);if(Nt)return Nt;ne.set(c,he),OA(c)?c.forEach(function(Gt){he.add(cs(Gt,h,w,Gt,c,ne))}):RA(c)&&c.forEach(function(Gt,br){he.set(br,cs(Gt,h,w,br,c,ne))});var Vt=We?we?_y:xy:we?Ai:$n,fr=Ke?r:Vt(c);return ss(fr||c,function(Gt,br){fr&&(br=Gt,Gt=c[br]),Eh(he,br,cs(Gt,h,w,br,c,ne))}),he}function Zee(c){var h=$n(c);return function(w){return m9(w,c,h)}}function m9(c,h,w){var L=w.length;if(c==null)return!L;for(c=qr(c);L--;){var W=w[L],ne=h[W],he=c[W];if(he===r&&!(W in c)||!ne(he))return!1}return!0}function v9(c,h,w){if(typeof c!="function")throw new os(o);return Th(function(){c.apply(r,w)},h)}function Sh(c,h,w,L){var W=-1,ne=lp,he=!0,me=c.length,we=[],We=h.length;if(!me)return we;w&&(h=Xr(h,Li(w))),L?(ne=qb,he=!1):h.length>=i&&(ne=vh,he=!1,h=new Tc(h));e:for(;++WW?0:W+w),L=L===r||L>W?W:ur(L),L<0&&(L+=W),L=w>L?0:LA(L);w0&&w(me)?h>1?Vn(me,h-1,w,L,W):Ca(W,me):L||(W[W.length]=me)}return W}var ny=W9(),w9=W9(!0);function no(c,h){return c&&ny(c,h,$n)}function iy(c,h){return c&&w9(c,h,$n)}function Tp(c,h){return Ia(h,function(w){return Vo(c[w])})}function Dc(c,h){h=Na(h,c);for(var w=0,L=h.length;c!=null&&wh}function tte(c,h){return c!=null&&Tr.call(c,h)}function rte(c,h){return c!=null&&h in qr(c)}function nte(c,h,w){return c>=ei(h,w)&&c=120&&Ke.length>=120)?new Tc(he&&Ke):r}Ke=c[0];var Ze=-1,xt=me[0];e:for(;++Ze-1;)me!==c&&xp.call(me,we,1),xp.call(c,we,1);return c}function R9(c,h){for(var w=c?h.length:0,L=w-1;w--;){var W=h[w];if(w==L||W!==ne){var ne=W;Ko(W)?xp.call(c,W,1):py(c,W)}}return c}function ly(c,h){return c+Sp(l9()*(h-c+1))}function mte(c,h,w,L){for(var W=-1,ne=Pn(Ep((h-c)/(w||1)),0),he=Ce(ne);ne--;)he[L?ne:++W]=c,c+=w;return he}function hy(c,h){var w="";if(!c||h<1||h>_)return w;do h%2&&(w+=c),h=Sp(h/2),h&&(c+=c);while(h);return w}function hr(c,h){return Cy(aA(c,h,Pi),c+"")}function vte(c){return p9(pf(c))}function bte(c,h){var w=pf(c);return Up(w,Rc(h,0,w.length))}function Mh(c,h,w,L){if(!Qr(c))return c;h=Na(h,c);for(var W=-1,ne=h.length,he=ne-1,me=c;me!=null&&++WW?0:W+h),w=w>W?W:w,w<0&&(w+=W),W=h>w?0:w-h>>>0,h>>>=0;for(var ne=Ce(W);++L>>1,he=c[ne];he!==null&&!Bi(he)&&(w?he<=h:he=i){var We=h?null:Dte(c);if(We)return dp(We);he=!1,W=vh,we=new Tc}else we=h?[]:me;e:for(;++L=L?c:us(c,h,w)}var $9=uee||function(c){return _r.clearTimeout(c)};function F9(c,h){if(h)return c.slice();var w=c.length,L=o9?o9(w):new c.constructor(w);return c.copy(L),L}function by(c){var h=new c.constructor(c.byteLength);return new yp(h).set(new yp(c)),h}function Ete(c,h){var w=h?by(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.byteLength)}function Ste(c){var h=new c.constructor(c.source,Re.exec(c));return h.lastIndex=c.lastIndex,h}function Ate(c){return _h?qr(_h.call(c)):{}}function j9(c,h){var w=h?by(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.length)}function U9(c,h){if(c!==h){var w=c!==r,L=c===null,W=c===c,ne=Bi(c),he=h!==r,me=h===null,we=h===h,We=Bi(h);if(!me&&!We&&!ne&&c>h||ne&&he&&we&&!me&&!We||L&&he&&we||!w&&we||!W)return 1;if(!L&&!ne&&!We&&c=me)return we;var We=w[L];return we*(We=="desc"?-1:1)}}return c.index-h.index}function q9(c,h,w,L){for(var W=-1,ne=c.length,he=w.length,me=-1,we=h.length,We=Pn(ne-he,0),Ke=Ce(we+We),Ze=!L;++me1?w[W-1]:r,he=W>2?w[2]:r;for(ne=c.length>3&&typeof ne=="function"?(W--,ne):r,he&&ci(w[0],w[1],he)&&(ne=W<3?r:ne,W=1),h=qr(h);++L-1?W[ne?h[he]:he]:r}}function G9(c){return Wo(function(h){var w=h.length,L=w,W=as.prototype.thru;for(c&&h.reverse();L--;){var ne=h[L];if(typeof ne!="function")throw new os(o);if(W&&!he&&Fp(ne)=="wrapper")var he=new as([],!0)}for(L=he?L:w;++L1&&Er.reverse(),Ke&&weme))return!1;var We=ne.get(c),Ke=ne.get(h);if(We&&Ke)return We==h&&Ke==c;var Ze=-1,xt=!0,Nt=w&N?new Tc:r;for(ne.set(c,h),ne.set(h,c);++Ze1?"& ":"")+h[L],h=h.join(w>2?", ":" "),c.replace(V,`{ + */e0.exports,function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",l=500,d="__lodash_placeholder__",p=1,y=2,A=4,P=1,N=2,D=1,k=2,B=4,j=8,U=16,K=32,J=64,T=128,z=256,ue=512,_e=30,G="...",E=800,m=16,f=1,g=2,v=3,x=1/0,_=9007199254740991,S=17976931348623157e292,b=NaN,M=4294967295,I=M-1,F=M>>>1,ae=[["ary",T],["bind",D],["bindKey",k],["curry",j],["curryRight",U],["flip",ue],["partial",K],["partialRight",J],["rearg",z]],O="[object Arguments]",se="[object Array]",ee="[object AsyncFunction]",X="[object Boolean]",Q="[object Date]",R="[object DOMException]",Z="[object Error]",te="[object Function]",le="[object GeneratorFunction]",ie="[object Map]",fe="[object Number]",ve="[object Null]",Me="[object Object]",Ne="[object Promise]",Te="[object Proxy]",$e="[object RegExp]",Ie="[object Set]",Le="[object String]",Ve="[object Symbol]",ke="[object Undefined]",ze="[object WeakMap]",He="[object WeakSet]",Ee="[object ArrayBuffer]",Qe="[object DataView]",ct="[object Float32Array]",Be="[object Float64Array]",et="[object Int8Array]",rt="[object Int16Array]",Je="[object Int32Array]",pt="[object Uint8Array]",ht="[object Uint8ClampedArray]",ft="[object Uint16Array]",Ht="[object Uint32Array]",Jt=/\b__p \+= '';/g,St=/\b(__p \+=) '' \+/g,er=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Xt=/&(?:amp|lt|gt|quot|#39);/g,Ot=/[&<>"']/g,Bt=RegExp(Xt.source),Tt=RegExp(Ot.source),vt=/<%-([\s\S]+?)%>/g,Dt=/<%([\s\S]+?)%>/g,Lt=/<%=([\s\S]+?)%>/g,bt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$t=/^\w*$/,jt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(nt.source),$=/^\s+/,H=/\s/,V=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C=/\{\n\/\* \[wrapped with (.+)\] \*/,Y=/,? & /,q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,oe=/[()=,{}\[\]\/\s]/,pe=/\\(\\)?/g,xe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Re=/\w*$/,De=/^[-+]0x[0-9a-f]+$/i,it=/^0b[01]+$/i,Ue=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,st=/^(?:0|[1-9]\d*)$/,tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,Rt=/['\n\r\u2028\u2029\\]/g,Mt="\\ud800-\\udfff",Et="\\u0300-\\u036f",dt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",ot=Et+dt+_t,wt="\\u2700-\\u27bf",lt="a-z\\xdf-\\xf6\\xf8-\\xff",at="\\xac\\xb1\\xd7\\xf7",Ae="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Pe="\\u2000-\\u206f",Ge=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="A-Z\\xc0-\\xd6\\xd8-\\xde",qe="\\ufe0e\\ufe0f",Xe=at+Ae+Pe+Ge,kt="['’]",Wt="["+Mt+"]",Zt="["+Xe+"]",Kt="["+ot+"]",de="\\d+",nr="["+wt+"]",dr="["+lt+"]",pr="[^"+Mt+Xe+de+wt+lt+je+"]",Qt="\\ud83c[\\udffb-\\udfff]",gr="(?:"+Kt+"|"+Qt+")",lr="[^"+Mt+"]",Lr="(?:\\ud83c[\\udde6-\\uddff]){2}",mr="[\\ud800-\\udbff][\\udc00-\\udfff]",wr="["+je+"]",Br="\\u200d",$r="(?:"+dr+"|"+pr+")",Ir="(?:"+wr+"|"+pr+")",hn="(?:"+kt+"(?:d|ll|m|re|s|t|ve))?",dn="(?:"+kt+"(?:D|LL|M|RE|S|T|VE))?",pn=gr+"?",sp="["+qe+"]?",$b="(?:"+Br+"(?:"+[lr,Lr,mr].join("|")+")"+sp+pn+")*",jo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",op="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ap=sp+pn+$b,Qu="(?:"+[nr,Lr,mr].join("|")+")"+ap,Fb="(?:"+[lr+Kt+"?",Kt,Lr,mr,Wt].join("|")+")",gh=RegExp(kt,"g"),jb=RegExp(Kt,"g"),ef=RegExp(Qt+"(?="+Qt+")|"+Fb+ap,"g"),cp=RegExp([wr+"?"+dr+"+"+hn+"(?="+[Zt,wr,"$"].join("|")+")",Ir+"+"+dn+"(?="+[Zt,wr+$r,"$"].join("|")+")",wr+"?"+$r+"+"+hn,wr+"+"+dn,op,jo,de,Qu].join("|"),"g"),up=RegExp("["+Br+Mt+ot+qe+"]"),Pc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ub=-1,Fr={};Fr[ct]=Fr[Be]=Fr[et]=Fr[rt]=Fr[Je]=Fr[pt]=Fr[ht]=Fr[ft]=Fr[Ht]=!0,Fr[O]=Fr[se]=Fr[Ee]=Fr[X]=Fr[Qe]=Fr[Q]=Fr[Z]=Fr[te]=Fr[ie]=Fr[fe]=Fr[Me]=Fr[$e]=Fr[Ie]=Fr[Le]=Fr[ze]=!1;var kr={};kr[O]=kr[se]=kr[Ee]=kr[Qe]=kr[X]=kr[Q]=kr[ct]=kr[Be]=kr[et]=kr[rt]=kr[Je]=kr[ie]=kr[fe]=kr[Me]=kr[$e]=kr[Ie]=kr[Le]=kr[Ve]=kr[pt]=kr[ht]=kr[ft]=kr[Ht]=!0,kr[Z]=kr[te]=kr[ze]=!1;var ce={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ye={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye={"&":"&","<":"<",">":">",""":'"',"'":"'"},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},jr=parseFloat,ir=parseInt,Yr=typeof nn=="object"&&nn&&nn.Object===Object&&nn,wn=typeof self=="object"&&self&&self.Object===Object&&self,_r=Yr||wn||Function("return this")(),Ur=e&&!e.nodeType&&e,gn=Ur&&!0&&t&&!t.nodeType&&t,_i=gn&&gn.exports===Ur,xn=_i&&Yr.process,Jr=function(){try{var be=gn&&gn.require&&gn.require("util").types;return be||xn&&xn.binding&&xn.binding("util")}catch{}}(),oi=Jr&&Jr.isArrayBuffer,Ps=Jr&&Jr.isDate,is=Jr&&Jr.isMap,ro=Jr&&Jr.isRegExp,mh=Jr&&Jr.isSet,Mc=Jr&&Jr.isTypedArray;function Bn(be,Fe,Ce){switch(Ce.length){case 0:return be.call(Fe);case 1:return be.call(Fe,Ce[0]);case 2:return be.call(Fe,Ce[0],Ce[1]);case 3:return be.call(Fe,Ce[0],Ce[1],Ce[2])}return be.apply(Fe,Ce)}function OQ(be,Fe,Ce,Ct){for(var tr=-1,Mr=be==null?0:be.length;++tr-1}function qb(be,Fe,Ce){for(var Ct=-1,tr=be==null?0:be.length;++Ct-1;);return Ce}function r9(be,Fe){for(var Ce=be.length;Ce--&&tf(Fe,be[Ce],0)>-1;);return Ce}function qQ(be,Fe){for(var Ce=be.length,Ct=0;Ce--;)be[Ce]===Fe&&++Ct;return Ct}var zQ=Kb(ce),HQ=Kb(ye);function WQ(be){return"\\"+It[be]}function KQ(be,Fe){return be==null?r:be[Fe]}function rf(be){return up.test(be)}function VQ(be){return Pc.test(be)}function GQ(be){for(var Fe,Ce=[];!(Fe=be.next()).done;)Ce.push(Fe.value);return Ce}function Jb(be){var Fe=-1,Ce=Array(be.size);return be.forEach(function(Ct,tr){Ce[++Fe]=[tr,Ct]}),Ce}function n9(be,Fe){return function(Ce){return be(Fe(Ce))}}function Ta(be,Fe){for(var Ce=-1,Ct=be.length,tr=0,Mr=[];++Ce-1}function Lee(c,h){var w=this.__data__,L=Ip(w,c);return L<0?(++this.size,w.push([c,h])):w[L][1]=h,this}Uo.prototype.clear=Ree,Uo.prototype.delete=Dee,Uo.prototype.get=Oee,Uo.prototype.has=Nee,Uo.prototype.set=Lee;function qo(c){var h=-1,w=c==null?0:c.length;for(this.clear();++h=h?c:h)),c}function cs(c,h,w,L,W,ne){var he,me=h&p,we=h&y,We=h&A;if(w&&(he=W?w(c,L,W,ne):w(c)),he!==r)return he;if(!Qr(c))return c;var Ke=sr(c);if(Ke){if(he=Fte(c),!me)return Ei(c,he)}else{var Ze=ti(c),xt=Ze==te||Ze==le;if(ka(c))return F9(c,me);if(Ze==Me||Ze==O||xt&&!W){if(he=we||xt?{}:iA(c),!me)return we?Ite(c,Xee(he,c)):Mte(c,g9(he,c))}else{if(!kr[Ze])return W?c:{};he=jte(c,Ze,me)}}ne||(ne=new Is);var Nt=ne.get(c);if(Nt)return Nt;ne.set(c,he),OA(c)?c.forEach(function(Gt){he.add(cs(Gt,h,w,Gt,c,ne))}):RA(c)&&c.forEach(function(Gt,br){he.set(br,cs(Gt,h,w,br,c,ne))});var Vt=We?we?_y:xy:we?Ai:$n,fr=Ke?r:Vt(c);return ss(fr||c,function(Gt,br){fr&&(br=Gt,Gt=c[br]),Eh(he,br,cs(Gt,h,w,br,c,ne))}),he}function Zee(c){var h=$n(c);return function(w){return m9(w,c,h)}}function m9(c,h,w){var L=w.length;if(c==null)return!L;for(c=qr(c);L--;){var W=w[L],ne=h[W],he=c[W];if(he===r&&!(W in c)||!ne(he))return!1}return!0}function v9(c,h,w){if(typeof c!="function")throw new os(o);return Th(function(){c.apply(r,w)},h)}function Sh(c,h,w,L){var W=-1,ne=lp,he=!0,me=c.length,we=[],We=h.length;if(!me)return we;w&&(h=Xr(h,Li(w))),L?(ne=qb,he=!1):h.length>=i&&(ne=vh,he=!1,h=new Tc(h));e:for(;++WW?0:W+w),L=L===r||L>W?W:ur(L),L<0&&(L+=W),L=w>L?0:LA(L);w0&&w(me)?h>1?Vn(me,h-1,w,L,W):Ca(W,me):L||(W[W.length]=me)}return W}var ny=W9(),w9=W9(!0);function no(c,h){return c&&ny(c,h,$n)}function iy(c,h){return c&&w9(c,h,$n)}function Tp(c,h){return Ia(h,function(w){return Vo(c[w])})}function Dc(c,h){h=Na(h,c);for(var w=0,L=h.length;c!=null&&wh}function tte(c,h){return c!=null&&Tr.call(c,h)}function rte(c,h){return c!=null&&h in qr(c)}function nte(c,h,w){return c>=ei(h,w)&&c=120&&Ke.length>=120)?new Tc(he&&Ke):r}Ke=c[0];var Ze=-1,xt=me[0];e:for(;++Ze-1;)me!==c&&xp.call(me,we,1),xp.call(c,we,1);return c}function R9(c,h){for(var w=c?h.length:0,L=w-1;w--;){var W=h[w];if(w==L||W!==ne){var ne=W;Ko(W)?xp.call(c,W,1):py(c,W)}}return c}function ly(c,h){return c+Sp(l9()*(h-c+1))}function mte(c,h,w,L){for(var W=-1,ne=Pn(Ep((h-c)/(w||1)),0),he=Ce(ne);ne--;)he[L?ne:++W]=c,c+=w;return he}function hy(c,h){var w="";if(!c||h<1||h>_)return w;do h%2&&(w+=c),h=Sp(h/2),h&&(c+=c);while(h);return w}function hr(c,h){return Cy(aA(c,h,Pi),c+"")}function vte(c){return p9(pf(c))}function bte(c,h){var w=pf(c);return Up(w,Rc(h,0,w.length))}function Mh(c,h,w,L){if(!Qr(c))return c;h=Na(h,c);for(var W=-1,ne=h.length,he=ne-1,me=c;me!=null&&++WW?0:W+h),w=w>W?W:w,w<0&&(w+=W),W=h>w?0:w-h>>>0,h>>>=0;for(var ne=Ce(W);++L>>1,he=c[ne];he!==null&&!Bi(he)&&(w?he<=h:he=i){var We=h?null:Dte(c);if(We)return dp(We);he=!1,W=vh,we=new Tc}else we=h?[]:me;e:for(;++L=L?c:us(c,h,w)}var $9=uee||function(c){return _r.clearTimeout(c)};function F9(c,h){if(h)return c.slice();var w=c.length,L=o9?o9(w):new c.constructor(w);return c.copy(L),L}function by(c){var h=new c.constructor(c.byteLength);return new yp(h).set(new yp(c)),h}function Ete(c,h){var w=h?by(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.byteLength)}function Ste(c){var h=new c.constructor(c.source,Re.exec(c));return h.lastIndex=c.lastIndex,h}function Ate(c){return _h?qr(_h.call(c)):{}}function j9(c,h){var w=h?by(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.length)}function U9(c,h){if(c!==h){var w=c!==r,L=c===null,W=c===c,ne=Bi(c),he=h!==r,me=h===null,we=h===h,We=Bi(h);if(!me&&!We&&!ne&&c>h||ne&&he&&we&&!me&&!We||L&&he&&we||!w&&we||!W)return 1;if(!L&&!ne&&!We&&c=me)return we;var We=w[L];return we*(We=="desc"?-1:1)}}return c.index-h.index}function q9(c,h,w,L){for(var W=-1,ne=c.length,he=w.length,me=-1,we=h.length,We=Pn(ne-he,0),Ke=Ce(we+We),Ze=!L;++me1?w[W-1]:r,he=W>2?w[2]:r;for(ne=c.length>3&&typeof ne=="function"?(W--,ne):r,he&&ci(w[0],w[1],he)&&(ne=W<3?r:ne,W=1),h=qr(h);++L-1?W[ne?h[he]:he]:r}}function G9(c){return Wo(function(h){var w=h.length,L=w,W=as.prototype.thru;for(c&&h.reverse();L--;){var ne=h[L];if(typeof ne!="function")throw new os(o);if(W&&!he&&Fp(ne)=="wrapper")var he=new as([],!0)}for(L=he?L:w;++L1&&Er.reverse(),Ke&&weme))return!1;var We=ne.get(c),Ke=ne.get(h);if(We&&Ke)return We==h&&Ke==c;var Ze=-1,xt=!0,Nt=w&N?new Tc:r;for(ne.set(c,h),ne.set(h,c);++Ze1?"& ":"")+h[L],h=h.join(w>2?", ":" "),c.replace(V,`{ /* [wrapped with `+h+`] */ -`)}function qte(c){return sr(c)||Lc(c)||!!(u9&&c&&c[u9])}function Ko(c,h){var w=typeof c;return h=h??_,!!h&&(w=="number"||w!="symbol"&&st.test(c))&&c>-1&&c%1==0&&c0){if(++h>=E)return arguments[0]}else h=0;return c.apply(r,arguments)}}function Up(c,h){var w=-1,L=c.length,W=L-1;for(h=h===r?L:h;++w1?c[h-1]:r;return w=typeof w=="function"?(c.pop(),w):r,yA(c,w)});function wA(c){var h=re(c);return h.__chain__=!0,h}function Qre(c,h){return h(c),c}function qp(c,h){return h(c)}var ene=Wo(function(c){var h=c.length,w=h?c[0]:0,L=this.__wrapped__,W=function(ne){return ry(ne,c)};return h>1||this.__actions__.length||!(L instanceof xr)||!Ko(w)?this.thru(W):(L=L.slice(w,+w+(h?1:0)),L.__actions__.push({func:qp,args:[W],thisArg:r}),new as(L,this.__chain__).thru(function(ne){return h&&!ne.length&&ne.push(r),ne}))});function tne(){return wA(this)}function rne(){return new as(this.value(),this.__chain__)}function nne(){this.__values__===r&&(this.__values__=NA(this.value()));var c=this.__index__>=this.__values__.length,h=c?r:this.__values__[this.__index__++];return{done:c,value:h}}function ine(){return this}function sne(c){for(var h,w=this;w instanceof Mp;){var L=dA(w);L.__index__=0,L.__values__=r,h?W.__wrapped__=L:h=L;var W=L;w=w.__wrapped__}return W.__wrapped__=c,h}function one(){var c=this.__wrapped__;if(c instanceof xr){var h=c;return this.__actions__.length&&(h=new xr(this)),h=h.reverse(),h.__actions__.push({func:qp,args:[Ty],thisArg:r}),new as(h,this.__chain__)}return this.thru(Ty)}function ane(){return k9(this.__wrapped__,this.__actions__)}var cne=Np(function(c,h,w){Tr.call(c,w)?++c[w]:zo(c,w,1)});function une(c,h,w){var L=sr(c)?Y7:Qee;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}function fne(c,h){var w=sr(c)?Ia:y9;return w(c,qt(h,3))}var lne=V9(pA),hne=V9(gA);function dne(c,h){return Vn(zp(c,h),1)}function pne(c,h){return Vn(zp(c,h),x)}function gne(c,h,w){return w=w===r?1:ur(w),Vn(zp(c,h),w)}function xA(c,h){var w=sr(c)?ss:Da;return w(c,qt(h,3))}function _A(c,h){var w=sr(c)?NQ:b9;return w(c,qt(h,3))}var mne=Np(function(c,h,w){Tr.call(c,w)?c[w].push(h):zo(c,w,[h])});function vne(c,h,w,L){c=Si(c)?c:pf(c),w=w&&!L?ur(w):0;var W=c.length;return w<0&&(w=Pn(W+w,0)),Gp(c)?w<=W&&c.indexOf(h,w)>-1:!!W&&tf(c,h,w)>-1}var bne=hr(function(c,h,w){var L=-1,W=typeof h=="function",ne=Si(c)?Ce(c.length):[];return Da(c,function(he){ne[++L]=W?Bn(h,he,w):Ah(he,h,w)}),ne}),yne=Np(function(c,h,w){zo(c,w,h)});function zp(c,h){var w=sr(c)?Xr:A9;return w(c,qt(h,3))}function wne(c,h,w,L){return c==null?[]:(sr(h)||(h=h==null?[]:[h]),w=L?r:w,sr(w)||(w=w==null?[]:[w]),C9(c,h,w))}var xne=Np(function(c,h,w){c[w?0:1].push(h)},function(){return[[],[]]});function _ne(c,h,w){var L=sr(c)?zb:Q7,W=arguments.length<3;return L(c,qt(h,4),w,W,Da)}function Ene(c,h,w){var L=sr(c)?LQ:Q7,W=arguments.length<3;return L(c,qt(h,4),w,W,b9)}function Sne(c,h){var w=sr(c)?Ia:y9;return w(c,Kp(qt(h,3)))}function Ane(c){var h=sr(c)?p9:vte;return h(c)}function Pne(c,h,w){(w?ci(c,h,w):h===r)?h=1:h=ur(h);var L=sr(c)?Gee:bte;return L(c,h)}function Mne(c){var h=sr(c)?Yee:wte;return h(c)}function Ine(c){if(c==null)return 0;if(Si(c))return Gp(c)?nf(c):c.length;var h=ti(c);return h==ie||h==Ie?c.size:cy(c).length}function Cne(c,h,w){var L=sr(c)?Hb:xte;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}var Tne=hr(function(c,h){if(c==null)return[];var w=h.length;return w>1&&ci(c,h[0],h[1])?h=[]:w>2&&ci(h[0],h[1],h[2])&&(h=[h[0]]),C9(c,Vn(h,1),[])}),Hp=fee||function(){return _r.Date.now()};function Rne(c,h){if(typeof h!="function")throw new os(o);return c=ur(c),function(){if(--c<1)return h.apply(this,arguments)}}function EA(c,h,w){return h=w?r:h,h=c&&h==null?c.length:h,Ho(c,T,r,r,r,r,h)}function SA(c,h){var w;if(typeof h!="function")throw new os(o);return c=ur(c),function(){return--c>0&&(w=h.apply(this,arguments)),c<=1&&(h=r),w}}var Dy=hr(function(c,h,w){var L=D;if(w.length){var W=Ta(w,hf(Dy));L|=K}return Ho(c,L,h,w,W)}),AA=hr(function(c,h,w){var L=D|k;if(w.length){var W=Ta(w,hf(AA));L|=K}return Ho(h,L,c,w,W)});function PA(c,h,w){h=w?r:h;var L=Ho(c,j,r,r,r,r,r,h);return L.placeholder=PA.placeholder,L}function MA(c,h,w){h=w?r:h;var L=Ho(c,U,r,r,r,r,r,h);return L.placeholder=MA.placeholder,L}function IA(c,h,w){var L,W,ne,he,me,we,We=0,Ke=!1,Ze=!1,xt=!0;if(typeof c!="function")throw new os(o);h=ls(h)||0,Qr(w)&&(Ke=!!w.leading,Ze="maxWait"in w,ne=Ze?Pn(ls(w.maxWait)||0,h):ne,xt="trailing"in w?!!w.trailing:xt);function Nt(vn){var Ts=L,Yo=W;return L=W=r,We=vn,he=c.apply(Yo,Ts),he}function Vt(vn){return We=vn,me=Th(br,h),Ke?Nt(vn):he}function fr(vn){var Ts=vn-we,Yo=vn-We,VA=h-Ts;return Ze?ei(VA,ne-Yo):VA}function Gt(vn){var Ts=vn-we,Yo=vn-We;return we===r||Ts>=h||Ts<0||Ze&&Yo>=ne}function br(){var vn=Hp();if(Gt(vn))return Er(vn);me=Th(br,fr(vn))}function Er(vn){return me=r,xt&&L?Nt(vn):(L=W=r,he)}function $i(){me!==r&&$9(me),We=0,L=we=W=me=r}function ui(){return me===r?he:Er(Hp())}function Fi(){var vn=Hp(),Ts=Gt(vn);if(L=arguments,W=this,we=vn,Ts){if(me===r)return Vt(we);if(Ze)return $9(me),me=Th(br,h),Nt(we)}return me===r&&(me=Th(br,h)),he}return Fi.cancel=$i,Fi.flush=ui,Fi}var Dne=hr(function(c,h){return v9(c,1,h)}),One=hr(function(c,h,w){return v9(c,ls(h)||0,w)});function Nne(c){return Ho(c,ue)}function Wp(c,h){if(typeof c!="function"||h!=null&&typeof h!="function")throw new os(o);var w=function(){var L=arguments,W=h?h.apply(this,L):L[0],ne=w.cache;if(ne.has(W))return ne.get(W);var he=c.apply(this,L);return w.cache=ne.set(W,he)||ne,he};return w.cache=new(Wp.Cache||qo),w}Wp.Cache=qo;function Kp(c){if(typeof c!="function")throw new os(o);return function(){var h=arguments;switch(h.length){case 0:return!c.call(this);case 1:return!c.call(this,h[0]);case 2:return!c.call(this,h[0],h[1]);case 3:return!c.call(this,h[0],h[1],h[2])}return!c.apply(this,h)}}function Lne(c){return SA(2,c)}var kne=_te(function(c,h){h=h.length==1&&sr(h[0])?Xr(h[0],Li(qt())):Xr(Vn(h,1),Li(qt()));var w=h.length;return hr(function(L){for(var W=-1,ne=ei(L.length,w);++W=h}),Lc=_9(function(){return arguments}())?_9:function(c){return rn(c)&&Tr.call(c,"callee")&&!c9.call(c,"callee")},sr=Ce.isArray,Xne=oi?Li(oi):ste;function Si(c){return c!=null&&Vp(c.length)&&!Vo(c)}function mn(c){return rn(c)&&Si(c)}function Zne(c){return c===!0||c===!1||rn(c)&&ai(c)==X}var ka=hee||Hy,Qne=Ps?Li(Ps):ote;function eie(c){return rn(c)&&c.nodeType===1&&!Rh(c)}function tie(c){if(c==null)return!0;if(Si(c)&&(sr(c)||typeof c=="string"||typeof c.splice=="function"||ka(c)||df(c)||Lc(c)))return!c.length;var h=ti(c);if(h==ie||h==Ie)return!c.size;if(Ch(c))return!cy(c).length;for(var w in c)if(Tr.call(c,w))return!1;return!0}function rie(c,h){return Ph(c,h)}function nie(c,h,w){w=typeof w=="function"?w:r;var L=w?w(c,h):r;return L===r?Ph(c,h,r,w):!!L}function Ny(c){if(!rn(c))return!1;var h=ai(c);return h==Z||h==R||typeof c.message=="string"&&typeof c.name=="string"&&!Rh(c)}function iie(c){return typeof c=="number"&&f9(c)}function Vo(c){if(!Qr(c))return!1;var h=ai(c);return h==te||h==le||h==ee||h==Te}function TA(c){return typeof c=="number"&&c==ur(c)}function Vp(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=_}function Qr(c){var h=typeof c;return c!=null&&(h=="object"||h=="function")}function rn(c){return c!=null&&typeof c=="object"}var RA=is?Li(is):cte;function sie(c,h){return c===h||ay(c,h,Sy(h))}function oie(c,h,w){return w=typeof w=="function"?w:r,ay(c,h,Sy(h),w)}function aie(c){return DA(c)&&c!=+c}function cie(c){if(Wte(c))throw new tr(s);return E9(c)}function uie(c){return c===null}function fie(c){return c==null}function DA(c){return typeof c=="number"||rn(c)&&ai(c)==fe}function Rh(c){if(!rn(c)||ai(c)!=Me)return!1;var h=wp(c);if(h===null)return!0;var w=Tr.call(h,"constructor")&&h.constructor;return typeof w=="function"&&w instanceof w&&mp.call(w)==oee}var Ly=ro?Li(ro):ute;function lie(c){return TA(c)&&c>=-_&&c<=_}var OA=mh?Li(mh):fte;function Gp(c){return typeof c=="string"||!sr(c)&&rn(c)&&ai(c)==Le}function Bi(c){return typeof c=="symbol"||rn(c)&&ai(c)==Ve}var df=Mc?Li(Mc):lte;function hie(c){return c===r}function die(c){return rn(c)&&ti(c)==ze}function pie(c){return rn(c)&&ai(c)==He}var gie=$p(uy),mie=$p(function(c,h){return c<=h});function NA(c){if(!c)return[];if(Si(c))return Gp(c)?Ms(c):Ei(c);if(bh&&c[bh])return GQ(c[bh]());var h=ti(c),w=h==ie?Jb:h==Ie?dp:pf;return w(c)}function Go(c){if(!c)return c===0?c:0;if(c=ls(c),c===x||c===-x){var h=c<0?-1:1;return h*S}return c===c?c:0}function ur(c){var h=Go(c),w=h%1;return h===h?w?h-w:h:0}function LA(c){return c?Rc(ur(c),0,M):0}function ls(c){if(typeof c=="number")return c;if(Bi(c))return b;if(Qr(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=Qr(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=e9(c);var w=it.test(c);return w||gt.test(c)?ir(c.slice(2),w?2:8):De.test(c)?b:+c}function kA(c){return io(c,Ai(c))}function vie(c){return c?Rc(ur(c),-_,_):c===0?c:0}function Cr(c){return c==null?"":ki(c)}var bie=ff(function(c,h){if(Ch(h)||Si(h)){io(h,$n(h),c);return}for(var w in h)Tr.call(h,w)&&Eh(c,w,h[w])}),BA=ff(function(c,h){io(h,Ai(h),c)}),Yp=ff(function(c,h,w,L){io(h,Ai(h),c,L)}),yie=ff(function(c,h,w,L){io(h,$n(h),c,L)}),wie=Wo(ry);function xie(c,h){var w=uf(c);return h==null?w:g9(w,h)}var _ie=hr(function(c,h){c=qr(c);var w=-1,L=h.length,W=L>2?h[2]:r;for(W&&ci(h[0],h[1],W)&&(L=1);++w1),ne}),io(c,_y(c),w),L&&(w=cs(w,g|y|A,Ote));for(var W=h.length;W--;)py(w,h[W]);return w});function jie(c,h){return FA(c,Kp(qt(h)))}var Uie=Wo(function(c,h){return c==null?{}:pte(c,h)});function FA(c,h){if(c==null)return{};var w=Xr(_y(c),function(L){return[L]});return h=qt(h),T9(c,w,function(L,W){return h(L,W[0])})}function qie(c,h,w){h=Na(h,c);var L=-1,W=h.length;for(W||(W=1,c=r);++Lh){var L=c;c=h,h=L}if(w||c%1||h%1){var W=l9();return ei(c+W*(h-c+jr("1e-"+((W+"").length-1))),h)}return ly(c,h)}var Qie=lf(function(c,h,w){return h=h.toLowerCase(),c+(w?qA(h):h)});function qA(c){return $y(Cr(c).toLowerCase())}function zA(c){return c=Cr(c),c&&c.replace(tt,zQ).replace(jb,"")}function ese(c,h,w){c=Cr(c),h=ki(h);var L=c.length;w=w===r?L:Rc(ur(w),0,L);var W=w;return w-=h.length,w>=0&&c.slice(w,W)==h}function tse(c){return c=Cr(c),c&&Tt.test(c)?c.replace(Ot,HQ):c}function rse(c){return c=Cr(c),c&&Ft.test(c)?c.replace(nt,"\\$&"):c}var nse=lf(function(c,h,w){return c+(w?"-":"")+h.toLowerCase()}),ise=lf(function(c,h,w){return c+(w?" ":"")+h.toLowerCase()}),sse=K9("toLowerCase");function ose(c,h,w){c=Cr(c),h=ur(h);var L=h?nf(c):0;if(!h||L>=h)return c;var W=(h-L)/2;return Bp(Sp(W),w)+c+Bp(Ep(W),w)}function ase(c,h,w){c=Cr(c),h=ur(h);var L=h?nf(c):0;return h&&L>>0,w?(c=Cr(c),c&&(typeof h=="string"||h!=null&&!Ly(h))&&(h=ki(h),!h&&rf(c))?La(Ms(c),0,w):c.split(h,w)):[]}var pse=lf(function(c,h,w){return c+(w?" ":"")+$y(h)});function gse(c,h,w){return c=Cr(c),w=w==null?0:Rc(ur(w),0,c.length),h=ki(h),c.slice(w,w+h.length)==h}function mse(c,h,w){var L=re.templateSettings;w&&ci(c,h,w)&&(h=r),c=Cr(c),h=Yp({},h,L,Q9);var W=Yp({},h.imports,L.imports,Q9),ne=$n(W),he=Yb(W,ne),me,we,We=0,Ke=h.interpolate||At,Ze="__p += '",xt=Xb((h.escape||At).source+"|"+Ke.source+"|"+(Ke===Lt?xe:At).source+"|"+(h.evaluate||At).source+"|$","g"),Nt="//# sourceURL="+(Tr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ub+"]")+` +`)}function qte(c){return sr(c)||Lc(c)||!!(u9&&c&&c[u9])}function Ko(c,h){var w=typeof c;return h=h??_,!!h&&(w=="number"||w!="symbol"&&st.test(c))&&c>-1&&c%1==0&&c0){if(++h>=E)return arguments[0]}else h=0;return c.apply(r,arguments)}}function Up(c,h){var w=-1,L=c.length,W=L-1;for(h=h===r?L:h;++w1?c[h-1]:r;return w=typeof w=="function"?(c.pop(),w):r,yA(c,w)});function wA(c){var h=re(c);return h.__chain__=!0,h}function Qre(c,h){return h(c),c}function qp(c,h){return h(c)}var ene=Wo(function(c){var h=c.length,w=h?c[0]:0,L=this.__wrapped__,W=function(ne){return ry(ne,c)};return h>1||this.__actions__.length||!(L instanceof xr)||!Ko(w)?this.thru(W):(L=L.slice(w,+w+(h?1:0)),L.__actions__.push({func:qp,args:[W],thisArg:r}),new as(L,this.__chain__).thru(function(ne){return h&&!ne.length&&ne.push(r),ne}))});function tne(){return wA(this)}function rne(){return new as(this.value(),this.__chain__)}function nne(){this.__values__===r&&(this.__values__=NA(this.value()));var c=this.__index__>=this.__values__.length,h=c?r:this.__values__[this.__index__++];return{done:c,value:h}}function ine(){return this}function sne(c){for(var h,w=this;w instanceof Mp;){var L=dA(w);L.__index__=0,L.__values__=r,h?W.__wrapped__=L:h=L;var W=L;w=w.__wrapped__}return W.__wrapped__=c,h}function one(){var c=this.__wrapped__;if(c instanceof xr){var h=c;return this.__actions__.length&&(h=new xr(this)),h=h.reverse(),h.__actions__.push({func:qp,args:[Ty],thisArg:r}),new as(h,this.__chain__)}return this.thru(Ty)}function ane(){return k9(this.__wrapped__,this.__actions__)}var cne=Np(function(c,h,w){Tr.call(c,w)?++c[w]:zo(c,w,1)});function une(c,h,w){var L=sr(c)?Y7:Qee;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}function fne(c,h){var w=sr(c)?Ia:y9;return w(c,qt(h,3))}var lne=V9(pA),hne=V9(gA);function dne(c,h){return Vn(zp(c,h),1)}function pne(c,h){return Vn(zp(c,h),x)}function gne(c,h,w){return w=w===r?1:ur(w),Vn(zp(c,h),w)}function xA(c,h){var w=sr(c)?ss:Da;return w(c,qt(h,3))}function _A(c,h){var w=sr(c)?NQ:b9;return w(c,qt(h,3))}var mne=Np(function(c,h,w){Tr.call(c,w)?c[w].push(h):zo(c,w,[h])});function vne(c,h,w,L){c=Si(c)?c:pf(c),w=w&&!L?ur(w):0;var W=c.length;return w<0&&(w=Pn(W+w,0)),Gp(c)?w<=W&&c.indexOf(h,w)>-1:!!W&&tf(c,h,w)>-1}var bne=hr(function(c,h,w){var L=-1,W=typeof h=="function",ne=Si(c)?Ce(c.length):[];return Da(c,function(he){ne[++L]=W?Bn(h,he,w):Ah(he,h,w)}),ne}),yne=Np(function(c,h,w){zo(c,w,h)});function zp(c,h){var w=sr(c)?Xr:A9;return w(c,qt(h,3))}function wne(c,h,w,L){return c==null?[]:(sr(h)||(h=h==null?[]:[h]),w=L?r:w,sr(w)||(w=w==null?[]:[w]),C9(c,h,w))}var xne=Np(function(c,h,w){c[w?0:1].push(h)},function(){return[[],[]]});function _ne(c,h,w){var L=sr(c)?zb:Q7,W=arguments.length<3;return L(c,qt(h,4),w,W,Da)}function Ene(c,h,w){var L=sr(c)?LQ:Q7,W=arguments.length<3;return L(c,qt(h,4),w,W,b9)}function Sne(c,h){var w=sr(c)?Ia:y9;return w(c,Kp(qt(h,3)))}function Ane(c){var h=sr(c)?p9:vte;return h(c)}function Pne(c,h,w){(w?ci(c,h,w):h===r)?h=1:h=ur(h);var L=sr(c)?Gee:bte;return L(c,h)}function Mne(c){var h=sr(c)?Yee:wte;return h(c)}function Ine(c){if(c==null)return 0;if(Si(c))return Gp(c)?nf(c):c.length;var h=ti(c);return h==ie||h==Ie?c.size:cy(c).length}function Cne(c,h,w){var L=sr(c)?Hb:xte;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}var Tne=hr(function(c,h){if(c==null)return[];var w=h.length;return w>1&&ci(c,h[0],h[1])?h=[]:w>2&&ci(h[0],h[1],h[2])&&(h=[h[0]]),C9(c,Vn(h,1),[])}),Hp=fee||function(){return _r.Date.now()};function Rne(c,h){if(typeof h!="function")throw new os(o);return c=ur(c),function(){if(--c<1)return h.apply(this,arguments)}}function EA(c,h,w){return h=w?r:h,h=c&&h==null?c.length:h,Ho(c,T,r,r,r,r,h)}function SA(c,h){var w;if(typeof h!="function")throw new os(o);return c=ur(c),function(){return--c>0&&(w=h.apply(this,arguments)),c<=1&&(h=r),w}}var Dy=hr(function(c,h,w){var L=D;if(w.length){var W=Ta(w,hf(Dy));L|=K}return Ho(c,L,h,w,W)}),AA=hr(function(c,h,w){var L=D|k;if(w.length){var W=Ta(w,hf(AA));L|=K}return Ho(h,L,c,w,W)});function PA(c,h,w){h=w?r:h;var L=Ho(c,j,r,r,r,r,r,h);return L.placeholder=PA.placeholder,L}function MA(c,h,w){h=w?r:h;var L=Ho(c,U,r,r,r,r,r,h);return L.placeholder=MA.placeholder,L}function IA(c,h,w){var L,W,ne,he,me,we,We=0,Ke=!1,Ze=!1,xt=!0;if(typeof c!="function")throw new os(o);h=ls(h)||0,Qr(w)&&(Ke=!!w.leading,Ze="maxWait"in w,ne=Ze?Pn(ls(w.maxWait)||0,h):ne,xt="trailing"in w?!!w.trailing:xt);function Nt(vn){var Ts=L,Yo=W;return L=W=r,We=vn,he=c.apply(Yo,Ts),he}function Vt(vn){return We=vn,me=Th(br,h),Ke?Nt(vn):he}function fr(vn){var Ts=vn-we,Yo=vn-We,VA=h-Ts;return Ze?ei(VA,ne-Yo):VA}function Gt(vn){var Ts=vn-we,Yo=vn-We;return we===r||Ts>=h||Ts<0||Ze&&Yo>=ne}function br(){var vn=Hp();if(Gt(vn))return Er(vn);me=Th(br,fr(vn))}function Er(vn){return me=r,xt&&L?Nt(vn):(L=W=r,he)}function $i(){me!==r&&$9(me),We=0,L=we=W=me=r}function ui(){return me===r?he:Er(Hp())}function Fi(){var vn=Hp(),Ts=Gt(vn);if(L=arguments,W=this,we=vn,Ts){if(me===r)return Vt(we);if(Ze)return $9(me),me=Th(br,h),Nt(we)}return me===r&&(me=Th(br,h)),he}return Fi.cancel=$i,Fi.flush=ui,Fi}var Dne=hr(function(c,h){return v9(c,1,h)}),One=hr(function(c,h,w){return v9(c,ls(h)||0,w)});function Nne(c){return Ho(c,ue)}function Wp(c,h){if(typeof c!="function"||h!=null&&typeof h!="function")throw new os(o);var w=function(){var L=arguments,W=h?h.apply(this,L):L[0],ne=w.cache;if(ne.has(W))return ne.get(W);var he=c.apply(this,L);return w.cache=ne.set(W,he)||ne,he};return w.cache=new(Wp.Cache||qo),w}Wp.Cache=qo;function Kp(c){if(typeof c!="function")throw new os(o);return function(){var h=arguments;switch(h.length){case 0:return!c.call(this);case 1:return!c.call(this,h[0]);case 2:return!c.call(this,h[0],h[1]);case 3:return!c.call(this,h[0],h[1],h[2])}return!c.apply(this,h)}}function Lne(c){return SA(2,c)}var kne=_te(function(c,h){h=h.length==1&&sr(h[0])?Xr(h[0],Li(qt())):Xr(Vn(h,1),Li(qt()));var w=h.length;return hr(function(L){for(var W=-1,ne=ei(L.length,w);++W=h}),Lc=_9(function(){return arguments}())?_9:function(c){return rn(c)&&Tr.call(c,"callee")&&!c9.call(c,"callee")},sr=Ce.isArray,Xne=oi?Li(oi):ste;function Si(c){return c!=null&&Vp(c.length)&&!Vo(c)}function mn(c){return rn(c)&&Si(c)}function Zne(c){return c===!0||c===!1||rn(c)&&ai(c)==X}var ka=hee||Hy,Qne=Ps?Li(Ps):ote;function eie(c){return rn(c)&&c.nodeType===1&&!Rh(c)}function tie(c){if(c==null)return!0;if(Si(c)&&(sr(c)||typeof c=="string"||typeof c.splice=="function"||ka(c)||df(c)||Lc(c)))return!c.length;var h=ti(c);if(h==ie||h==Ie)return!c.size;if(Ch(c))return!cy(c).length;for(var w in c)if(Tr.call(c,w))return!1;return!0}function rie(c,h){return Ph(c,h)}function nie(c,h,w){w=typeof w=="function"?w:r;var L=w?w(c,h):r;return L===r?Ph(c,h,r,w):!!L}function Ny(c){if(!rn(c))return!1;var h=ai(c);return h==Z||h==R||typeof c.message=="string"&&typeof c.name=="string"&&!Rh(c)}function iie(c){return typeof c=="number"&&f9(c)}function Vo(c){if(!Qr(c))return!1;var h=ai(c);return h==te||h==le||h==ee||h==Te}function TA(c){return typeof c=="number"&&c==ur(c)}function Vp(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=_}function Qr(c){var h=typeof c;return c!=null&&(h=="object"||h=="function")}function rn(c){return c!=null&&typeof c=="object"}var RA=is?Li(is):cte;function sie(c,h){return c===h||ay(c,h,Sy(h))}function oie(c,h,w){return w=typeof w=="function"?w:r,ay(c,h,Sy(h),w)}function aie(c){return DA(c)&&c!=+c}function cie(c){if(Wte(c))throw new tr(s);return E9(c)}function uie(c){return c===null}function fie(c){return c==null}function DA(c){return typeof c=="number"||rn(c)&&ai(c)==fe}function Rh(c){if(!rn(c)||ai(c)!=Me)return!1;var h=wp(c);if(h===null)return!0;var w=Tr.call(h,"constructor")&&h.constructor;return typeof w=="function"&&w instanceof w&&mp.call(w)==oee}var Ly=ro?Li(ro):ute;function lie(c){return TA(c)&&c>=-_&&c<=_}var OA=mh?Li(mh):fte;function Gp(c){return typeof c=="string"||!sr(c)&&rn(c)&&ai(c)==Le}function Bi(c){return typeof c=="symbol"||rn(c)&&ai(c)==Ve}var df=Mc?Li(Mc):lte;function hie(c){return c===r}function die(c){return rn(c)&&ti(c)==ze}function pie(c){return rn(c)&&ai(c)==He}var gie=$p(uy),mie=$p(function(c,h){return c<=h});function NA(c){if(!c)return[];if(Si(c))return Gp(c)?Ms(c):Ei(c);if(bh&&c[bh])return GQ(c[bh]());var h=ti(c),w=h==ie?Jb:h==Ie?dp:pf;return w(c)}function Go(c){if(!c)return c===0?c:0;if(c=ls(c),c===x||c===-x){var h=c<0?-1:1;return h*S}return c===c?c:0}function ur(c){var h=Go(c),w=h%1;return h===h?w?h-w:h:0}function LA(c){return c?Rc(ur(c),0,M):0}function ls(c){if(typeof c=="number")return c;if(Bi(c))return b;if(Qr(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=Qr(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=e9(c);var w=it.test(c);return w||gt.test(c)?ir(c.slice(2),w?2:8):De.test(c)?b:+c}function kA(c){return io(c,Ai(c))}function vie(c){return c?Rc(ur(c),-_,_):c===0?c:0}function Cr(c){return c==null?"":ki(c)}var bie=ff(function(c,h){if(Ch(h)||Si(h)){io(h,$n(h),c);return}for(var w in h)Tr.call(h,w)&&Eh(c,w,h[w])}),BA=ff(function(c,h){io(h,Ai(h),c)}),Yp=ff(function(c,h,w,L){io(h,Ai(h),c,L)}),yie=ff(function(c,h,w,L){io(h,$n(h),c,L)}),wie=Wo(ry);function xie(c,h){var w=uf(c);return h==null?w:g9(w,h)}var _ie=hr(function(c,h){c=qr(c);var w=-1,L=h.length,W=L>2?h[2]:r;for(W&&ci(h[0],h[1],W)&&(L=1);++w1),ne}),io(c,_y(c),w),L&&(w=cs(w,p|y|A,Ote));for(var W=h.length;W--;)py(w,h[W]);return w});function jie(c,h){return FA(c,Kp(qt(h)))}var Uie=Wo(function(c,h){return c==null?{}:pte(c,h)});function FA(c,h){if(c==null)return{};var w=Xr(_y(c),function(L){return[L]});return h=qt(h),T9(c,w,function(L,W){return h(L,W[0])})}function qie(c,h,w){h=Na(h,c);var L=-1,W=h.length;for(W||(W=1,c=r);++Lh){var L=c;c=h,h=L}if(w||c%1||h%1){var W=l9();return ei(c+W*(h-c+jr("1e-"+((W+"").length-1))),h)}return ly(c,h)}var Qie=lf(function(c,h,w){return h=h.toLowerCase(),c+(w?qA(h):h)});function qA(c){return $y(Cr(c).toLowerCase())}function zA(c){return c=Cr(c),c&&c.replace(tt,zQ).replace(jb,"")}function ese(c,h,w){c=Cr(c),h=ki(h);var L=c.length;w=w===r?L:Rc(ur(w),0,L);var W=w;return w-=h.length,w>=0&&c.slice(w,W)==h}function tse(c){return c=Cr(c),c&&Tt.test(c)?c.replace(Ot,HQ):c}function rse(c){return c=Cr(c),c&&Ft.test(c)?c.replace(nt,"\\$&"):c}var nse=lf(function(c,h,w){return c+(w?"-":"")+h.toLowerCase()}),ise=lf(function(c,h,w){return c+(w?" ":"")+h.toLowerCase()}),sse=K9("toLowerCase");function ose(c,h,w){c=Cr(c),h=ur(h);var L=h?nf(c):0;if(!h||L>=h)return c;var W=(h-L)/2;return Bp(Sp(W),w)+c+Bp(Ep(W),w)}function ase(c,h,w){c=Cr(c),h=ur(h);var L=h?nf(c):0;return h&&L>>0,w?(c=Cr(c),c&&(typeof h=="string"||h!=null&&!Ly(h))&&(h=ki(h),!h&&rf(c))?La(Ms(c),0,w):c.split(h,w)):[]}var pse=lf(function(c,h,w){return c+(w?" ":"")+$y(h)});function gse(c,h,w){return c=Cr(c),w=w==null?0:Rc(ur(w),0,c.length),h=ki(h),c.slice(w,w+h.length)==h}function mse(c,h,w){var L=re.templateSettings;w&&ci(c,h,w)&&(h=r),c=Cr(c),h=Yp({},h,L,Q9);var W=Yp({},h.imports,L.imports,Q9),ne=$n(W),he=Yb(W,ne),me,we,We=0,Ke=h.interpolate||At,Ze="__p += '",xt=Xb((h.escape||At).source+"|"+Ke.source+"|"+(Ke===Lt?xe:At).source+"|"+(h.evaluate||At).source+"|$","g"),Nt="//# sourceURL="+(Tr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ub+"]")+` `;c.replace(xt,function(Gt,br,Er,$i,ui,Fi){return Er||(Er=$i),Ze+=c.slice(We,Fi).replace(Rt,WQ),br&&(me=!0,Ze+=`' + __e(`+br+`) + '`),ui&&(we=!0,Ze+=`'; @@ -104,14 +104,14 @@ __p += '`),Er&&(Ze+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+Ze+`return __p -}`;var fr=WA(function(){return Mr(ne,Nt+"return "+Ze).apply(r,he)});if(fr.source=Ze,Ny(fr))throw fr;return fr}function vse(c){return Cr(c).toLowerCase()}function bse(c){return Cr(c).toUpperCase()}function yse(c,h,w){if(c=Cr(c),c&&(w||h===r))return e9(c);if(!c||!(h=ki(h)))return c;var L=Ms(c),W=Ms(h),ne=t9(L,W),he=r9(L,W)+1;return La(L,ne,he).join("")}function wse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.slice(0,i9(c)+1);if(!c||!(h=ki(h)))return c;var L=Ms(c),W=r9(L,Ms(h))+1;return La(L,0,W).join("")}function xse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.replace($,"");if(!c||!(h=ki(h)))return c;var L=Ms(c),W=t9(L,Ms(h));return La(L,W).join("")}function _se(c,h){var w=_e,L=G;if(Qr(h)){var W="separator"in h?h.separator:W;w="length"in h?ur(h.length):w,L="omission"in h?ki(h.omission):L}c=Cr(c);var ne=c.length;if(rf(c)){var he=Ms(c);ne=he.length}if(w>=ne)return c;var me=w-nf(L);if(me<1)return L;var we=he?La(he,0,me).join(""):c.slice(0,me);if(W===r)return we+L;if(he&&(me+=we.length-me),Ly(W)){if(c.slice(me).search(W)){var We,Ke=we;for(W.global||(W=Xb(W.source,Cr(Re.exec(W))+"g")),W.lastIndex=0;We=W.exec(Ke);)var Ze=We.index;we=we.slice(0,Ze===r?me:Ze)}}else if(c.indexOf(ki(W),me)!=me){var xt=we.lastIndexOf(W);xt>-1&&(we=we.slice(0,xt))}return we+L}function Ese(c){return c=Cr(c),c&&Bt.test(c)?c.replace(Xt,ZQ):c}var Sse=lf(function(c,h,w){return c+(w?" ":"")+h.toUpperCase()}),$y=K9("toUpperCase");function HA(c,h,w){return c=Cr(c),h=w?r:h,h===r?VQ(c)?tee(c):$Q(c):c.match(h)||[]}var WA=hr(function(c,h){try{return Bn(c,r,h)}catch(w){return Ny(w)?w:new tr(w)}}),Ase=Wo(function(c,h){return ss(h,function(w){w=so(w),zo(c,w,Dy(c[w],c))}),c});function Pse(c){var h=c==null?0:c.length,w=qt();return c=h?Xr(c,function(L){if(typeof L[1]!="function")throw new os(o);return[w(L[0]),L[1]]}):[],hr(function(L){for(var W=-1;++W_)return[];var w=M,L=ei(c,M);h=qt(h),c-=M;for(var W=Gb(L,h);++w0||h<0)?new xr(w):(c<0?w=w.takeRight(-c):c&&(w=w.drop(c)),h!==r&&(h=ur(h),w=h<0?w.dropRight(-h):w.take(h-c)),w)},xr.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},xr.prototype.toArray=function(){return this.take(M)},no(xr.prototype,function(c,h){var w=/^(?:filter|find|map|reject)|While$/.test(h),L=/^(?:head|last)$/.test(h),W=re[L?"take"+(h=="last"?"Right":""):h],ne=L||/^find/.test(h);W&&(re.prototype[h]=function(){var he=this.__wrapped__,me=L?[1]:arguments,we=he instanceof xr,We=me[0],Ke=we||sr(he),Ze=function(br){var Er=W.apply(re,Ca([br],me));return L&&xt?Er[0]:Er};Ke&&w&&typeof We=="function"&&We.length!=1&&(we=Ke=!1);var xt=this.__chain__,Nt=!!this.__actions__.length,Vt=ne&&!xt,fr=we&&!Nt;if(!ne&&Ke){he=fr?he:new xr(this);var Gt=c.apply(he,me);return Gt.__actions__.push({func:qp,args:[Ze],thisArg:r}),new as(Gt,xt)}return Vt&&fr?c.apply(this,me):(Gt=this.thru(Ze),Vt?L?Gt.value()[0]:Gt.value():Gt)})}),ss(["pop","push","shift","sort","splice","unshift"],function(c){var h=pp[c],w=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",L=/^(?:pop|shift)$/.test(c);re.prototype[c]=function(){var W=arguments;if(L&&!this.__chain__){var ne=this.value();return h.apply(sr(ne)?ne:[],W)}return this[w](function(he){return h.apply(sr(he)?he:[],W)})}}),no(xr.prototype,function(c,h){var w=re[h];if(w){var L=w.name+"";Tr.call(cf,L)||(cf[L]=[]),cf[L].push({name:h,func:w})}}),cf[Lp(r,k).name]=[{name:"wrapper",func:r}],xr.prototype.clone=Eee,xr.prototype.reverse=See,xr.prototype.value=Aee,re.prototype.at=ene,re.prototype.chain=tne,re.prototype.commit=rne,re.prototype.next=nne,re.prototype.plant=sne,re.prototype.reverse=one,re.prototype.toJSON=re.prototype.valueOf=re.prototype.value=ane,re.prototype.first=re.prototype.head,bh&&(re.prototype[bh]=ine),re},sf=ree();gn?((gn.exports=sf)._=sf,Ur._=sf):_r._=sf}).call(nn)}(e0,e0.exports);var Pq=e0.exports,P1={exports:{}};(function(t,e){var r=typeof self<"u"?self:nn,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function u(f){return f&&DataView.prototype.isPrototypeOf(f)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(f){return f&&l.indexOf(Object.prototype.toString.call(f))>-1};function g(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function y(f){return typeof f!="string"&&(f=String(f)),f}function A(f){var p={next:function(){var v=f.shift();return{done:v===void 0,value:v}}};return a.iterable&&(p[Symbol.iterator]=function(){return p}),p}function P(f){this.map={},f instanceof P?f.forEach(function(p,v){this.append(v,p)},this):Array.isArray(f)?f.forEach(function(p){this.append(p[0],p[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(p){this.append(p,f[p])},this)}P.prototype.append=function(f,p){f=g(f),p=y(p);var v=this.map[f];this.map[f]=v?v+", "+p:p},P.prototype.delete=function(f){delete this.map[g(f)]},P.prototype.get=function(f){return f=g(f),this.has(f)?this.map[f]:null},P.prototype.has=function(f){return this.map.hasOwnProperty(g(f))},P.prototype.set=function(f,p){this.map[g(f)]=y(p)},P.prototype.forEach=function(f,p){for(var v in this.map)this.map.hasOwnProperty(v)&&f.call(p,this.map[v],v,this)},P.prototype.keys=function(){var f=[];return this.forEach(function(p,v){f.push(v)}),A(f)},P.prototype.values=function(){var f=[];return this.forEach(function(p){f.push(p)}),A(f)},P.prototype.entries=function(){var f=[];return this.forEach(function(p,v){f.push([v,p])}),A(f)},a.iterable&&(P.prototype[Symbol.iterator]=P.prototype.entries);function N(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function D(f){return new Promise(function(p,v){f.onload=function(){p(f.result)},f.onerror=function(){v(f.error)}})}function k(f){var p=new FileReader,v=D(p);return p.readAsArrayBuffer(f),v}function B(f){var p=new FileReader,v=D(p);return p.readAsText(f),v}function j(f){for(var p=new Uint8Array(f),v=new Array(p.length),x=0;x-1?p:f}function z(f,p){p=p||{};var v=p.body;if(f instanceof z){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,p.headers||(this.headers=new P(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!v&&f._bodyInit!=null&&(v=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=p.credentials||this.credentials||"same-origin",(p.headers||!this.headers)&&(this.headers=new P(p.headers)),this.method=T(p.method||this.method||"GET"),this.mode=p.mode||this.mode||null,this.signal=p.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(v)}z.prototype.clone=function(){return new z(this,{body:this._bodyInit})};function ue(f){var p=new FormData;return f.trim().split("&").forEach(function(v){if(v){var x=v.split("="),_=x.shift().replace(/\+/g," "),S=x.join("=").replace(/\+/g," ");p.append(decodeURIComponent(_),decodeURIComponent(S))}}),p}function _e(f){var p=new P,v=f.replace(/\r?\n[\t ]+/g," ");return v.split(/\r?\n/).forEach(function(x){var _=x.split(":"),S=_.shift().trim();if(S){var b=_.join(":").trim();p.append(S,b)}}),p}K.call(z.prototype);function G(f,p){p||(p={}),this.type="default",this.status=p.status===void 0?200:p.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in p?p.statusText:"OK",this.headers=new P(p.headers),this.url=p.url||"",this._initBody(f)}K.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new P(this.headers),url:this.url})},G.error=function(){var f=new G(null,{status:0,statusText:""});return f.type="error",f};var E=[301,302,303,307,308];G.redirect=function(f,p){if(E.indexOf(p)===-1)throw new RangeError("Invalid status code");return new G(null,{status:p,headers:{location:f}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(p,v){this.message=p,this.name=v;var x=Error(p);this.stack=x.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function m(f,p){return new Promise(function(v,x){var _=new z(f,p);if(_.signal&&_.signal.aborted)return x(new o.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function b(){S.abort()}S.onload=function(){var M={status:S.status,statusText:S.statusText,headers:_e(S.getAllResponseHeaders()||"")};M.url="responseURL"in S?S.responseURL:M.headers.get("X-Request-URL");var I="response"in S?S.response:S.responseText;v(new G(I,M))},S.onerror=function(){x(new TypeError("Network request failed"))},S.ontimeout=function(){x(new TypeError("Network request failed"))},S.onabort=function(){x(new o.DOMException("Aborted","AbortError"))},S.open(_.method,_.url,!0),_.credentials==="include"?S.withCredentials=!0:_.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&a.blob&&(S.responseType="blob"),_.headers.forEach(function(M,I){S.setRequestHeader(I,M)}),_.signal&&(_.signal.addEventListener("abort",b),S.onreadystatechange=function(){S.readyState===4&&_.signal.removeEventListener("abort",b)}),S.send(typeof _._bodyInit>"u"?null:_._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=P,s.Request=z,s.Response=G),o.Headers=P,o.Request=z,o.Response=G,o.fetch=m,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(P1,P1.exports);var Mq=P1.exports;const R6=ji(Mq);var Iq=Object.defineProperty,Cq=Object.defineProperties,Tq=Object.getOwnPropertyDescriptors,D6=Object.getOwnPropertySymbols,Rq=Object.prototype.hasOwnProperty,Dq=Object.prototype.propertyIsEnumerable,O6=(t,e,r)=>e in t?Iq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,N6=(t,e)=>{for(var r in e||(e={}))Rq.call(e,r)&&O6(t,r,e[r]);if(D6)for(var r of D6(e))Dq.call(e,r)&&O6(t,r,e[r]);return t},L6=(t,e)=>Cq(t,Tq(e));const Oq={Accept:"application/json","Content-Type":"application/json"},Nq="POST",k6={headers:Oq,method:Nq},B6=10;let xs=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new qi.EventEmitter,this.isAvailable=!1,this.registering=!1,!k_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=mo(e),n=await(await R6(this.url,L6(N6({},k6),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!k_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=mo({id:1,jsonrpc:"2.0",method:"test",params:[]});await R6(e,L6(N6({},k6),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ka(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return R_(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>B6&&this.events.setMaxListeners(B6)}};const $6="error",Lq="wss://relay.walletconnect.org",kq="wc",Bq="universal_provider",F6=`${kq}@2:${Bq}:`,j6="https://rpc.walletconnect.org/v1/",Iu="generic",$q=`${j6}bundler`,Qi={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Fq=Object.defineProperty,jq=Object.defineProperties,Uq=Object.getOwnPropertyDescriptors,U6=Object.getOwnPropertySymbols,qq=Object.prototype.hasOwnProperty,zq=Object.prototype.propertyIsEnumerable,q6=(t,e,r)=>e in t?Fq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,t0=(t,e)=>{for(var r in e||(e={}))qq.call(e,r)&&q6(t,r,e[r]);if(U6)for(var r of U6(e))zq.call(e,r)&&q6(t,r,e[r]);return t},Hq=(t,e)=>jq(t,Uq(e));function Di(t,e,r){var n;const i=Eu(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${j6}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function fc(t){return t.includes(":")?t.split(":")[1]:t}function z6(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Wq(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function M1(t={},e={}){const r=H6(t),n=H6(e);return Pq.merge(r,n)}function H6(t){var e,r,n,i;const s={};if(!Sl(t))return s;for(const[o,a]of Object.entries(t)){const u=f1(o)?[o]:a.chains,l=a.methods||[],d=a.events||[],g=a.rpcMap||{},y=El(o);s[y]=Hq(t0(t0({},s[y]),a),{chains:Ud(u,(e=s[y])==null?void 0:e.chains),methods:Ud(l,(r=s[y])==null?void 0:r.methods),events:Ud(d,(n=s[y])==null?void 0:n.events),rpcMap:t0(t0({},g),(i=s[y])==null?void 0:i.rpcMap)})}return s}function Kq(t){return t.includes(":")?t.split(":")[2]:t}function W6(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=f1(r)?[r]:n.chains?n.chains:z6(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function I1(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const K6={},Ar=t=>K6[t],C1=(t,e)=>{K6[t]=e};class Vq{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}var Gq=Object.defineProperty,Yq=Object.defineProperties,Jq=Object.getOwnPropertyDescriptors,V6=Object.getOwnPropertySymbols,Xq=Object.prototype.hasOwnProperty,Zq=Object.prototype.propertyIsEnumerable,G6=(t,e,r)=>e in t?Gq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Y6=(t,e)=>{for(var r in e||(e={}))Xq.call(e,r)&&G6(t,r,e[r]);if(V6)for(var r of V6(e))Zq.call(e,r)&&G6(t,r,e[r]);return t},J6=(t,e)=>Yq(t,Jq(e));class Qq{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(fc(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const u=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:J6(Y6({},o.sessionProperties||{}),{capabilities:J6(Y6({},a||{}),{[s]:u})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return u}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(da("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${$q}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class ez{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}let tz=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}},rz=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ji(new xs(n,Ar("disableProviderPing")))}},nz=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=fc(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}},iz=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}};class sz{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}let oz=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new xs(n,Ar("disableProviderPing")))}};class az{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new xs(n))}}class cz{constructor(e){this.name=Iu,this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=Eu(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}var uz=Object.defineProperty,fz=Object.defineProperties,lz=Object.getOwnPropertyDescriptors,X6=Object.getOwnPropertySymbols,hz=Object.prototype.hasOwnProperty,dz=Object.prototype.propertyIsEnumerable,Z6=(t,e,r)=>e in t?uz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,r0=(t,e)=>{for(var r in e||(e={}))hz.call(e,r)&&Z6(t,r,e[r]);if(X6)for(var r of X6(e))dz.call(e,r)&&Z6(t,r,e[r]);return t},T1=(t,e)=>fz(t,lz(e));let Q6=class YA{constructor(e){this.events=new Yg,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||$6})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new YA(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:r0({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,Vd(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Dr("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=W6(this.session.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=W6(s.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==I6)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Iu?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(ic(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await A1.init({core:this.providerOpts.core,logger:this.providerOpts.logger||$6,relayUrl:this.providerOpts.relayUrl||Lq,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>El(r)))];C1("client",this.client),C1("events",this.events),C1("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Wq(r,this.session),i=z6(n),s=M1(this.namespaces,this.optionalNamespaces),o=T1(r0({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new Qq({namespace:o});break;case"algorand":this.rpcProviders[r]=new rz({namespace:o});break;case"solana":this.rpcProviders[r]=new ez({namespace:o});break;case"cosmos":this.rpcProviders[r]=new tz({namespace:o});break;case"polkadot":this.rpcProviders[r]=new Vq({namespace:o});break;case"cip34":this.rpcProviders[r]=new nz({namespace:o});break;case"elrond":this.rpcProviders[r]=new iz({namespace:o});break;case"multiversx":this.rpcProviders[r]=new sz({namespace:o});break;case"near":this.rpcProviders[r]=new oz({namespace:o});break;case"tezos":this.rpcProviders[r]=new az({namespace:o});break;default:this.rpcProviders[Iu]?this.rpcProviders[Iu].updateNamespace(o):this.rpcProviders[Iu]=new cz({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&ic(i)&&this.events.emit("accountsChanged",i.map(Kq))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=El(i),a=I1(i)!==I1(s)?`${o}:${I1(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=T1(r0({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",T1(r0({},Dr("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Qi.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Iu]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>El(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=El(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${F6}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${F6}/${e}`)}};const pz=Q6;function gz(){return new Promise(t=>{const e=[];let r;window.addEventListener("eip6963:announceProvider",n=>{const{detail:i}=n;r&&clearTimeout(r),e.push(i),r=setTimeout(()=>t(e),200)}),r=setTimeout(()=>t(e),200),window.dispatchEvent(new Event("eip6963:requestProvider"))})}class Ys{constructor(e,r){this.scope=e,this.module=r}storeObject(e,r){this.setItem(e,JSON.stringify(r))}loadObject(e){const r=this.getItem(e);return r?JSON.parse(r):void 0}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new Ys("CBWSDK").clear(),new Ys("walletlink").clear()}}const cn={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},R1={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},e5="Unspecified error message.",mz="Unspecified server error.";function D1(t,e=e5){if(t&&Number.isInteger(t)){const r=t.toString();if(O1(R1,r))return R1[r].message;if(t5(t))return mz}return e}function vz(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(R1[e]||t5(t))}function bz(t,{shouldIncludeStack:e=!1}={}){const r={};if(t&&typeof t=="object"&&!Array.isArray(t)&&O1(t,"code")&&vz(t.code)){const n=t;r.code=n.code,n.message&&typeof n.message=="string"?(r.message=n.message,O1(n,"data")&&(r.data=n.data)):(r.message=D1(r.code),r.data={originalError:r5(t)})}else r.code=cn.rpc.internal,r.message=n5(t,"message")?t.message:e5,r.data={originalError:r5(t)};return e&&(r.stack=n5(t,"stack")?t.stack:void 0),r}function t5(t){return t>=-32099&&t<=-32e3}function r5(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function O1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function n5(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const Sr={rpc:{parse:t=>es(cn.rpc.parse,t),invalidRequest:t=>es(cn.rpc.invalidRequest,t),invalidParams:t=>es(cn.rpc.invalidParams,t),methodNotFound:t=>es(cn.rpc.methodNotFound,t),internal:t=>es(cn.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return es(e,t)},invalidInput:t=>es(cn.rpc.invalidInput,t),resourceNotFound:t=>es(cn.rpc.resourceNotFound,t),resourceUnavailable:t=>es(cn.rpc.resourceUnavailable,t),transactionRejected:t=>es(cn.rpc.transactionRejected,t),methodNotSupported:t=>es(cn.rpc.methodNotSupported,t),limitExceeded:t=>es(cn.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Cu(cn.provider.userRejectedRequest,t),unauthorized:t=>Cu(cn.provider.unauthorized,t),unsupportedMethod:t=>Cu(cn.provider.unsupportedMethod,t),disconnected:t=>Cu(cn.provider.disconnected,t),chainDisconnected:t=>Cu(cn.provider.chainDisconnected,t),unsupportedChain:t=>Cu(cn.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new o5(e,r,n)}}};function es(t,e){const[r,n]=i5(e);return new s5(t,r||D1(t),n)}function Cu(t,e){const[r,n]=i5(e);return new o5(t,r||D1(t),n)}function i5(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}class s5 extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}}class o5 extends s5{constructor(e,r,n){if(!yz(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}function yz(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function N1(){return t=>t}const Ol=N1(),wz=N1(),xz=N1();function Co(t){return Math.floor(t)}const a5=/^[0-9]*$/,c5=/^[a-f0-9]*$/;function lc(t){return L1(crypto.getRandomValues(new Uint8Array(t)))}function L1(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function n0(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function Nl(t,e=!1){const r=t.toString("hex");return Ol(e?`0x${r}`:r)}function k1(t){return Nl(F1(t),!0)}function Js(t){return xz(t.toString(10))}function pa(t){return Ol(`0x${BigInt(t).toString(16)}`)}function u5(t){return t.startsWith("0x")||t.startsWith("0X")}function B1(t){return u5(t)?t.slice(2):t}function f5(t){return u5(t)?`0x${t.slice(2)}`:`0x${t}`}function i0(t){if(typeof t!="string")return!1;const e=B1(t).toLowerCase();return c5.test(e)}function _z(t,e=!1){if(typeof t=="string"){const r=B1(t).toLowerCase();if(c5.test(r))return Ol(e?`0x${r}`:r)}throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function $1(t,e=!1){let r=_z(t,!1);return r.length%2===1&&(r=Ol(`0${r}`)),e?Ol(`0x${r}`):r}function ga(t){if(typeof t=="string"){const e=B1(t).toLowerCase();if(i0(e)&&e.length===40)return wz(f5(e))}throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function F1(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(i0(t)){const e=$1(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Sr.rpc.invalidParams(`Not binary data: ${String(t)}`)}function Ll(t){if(typeof t=="number"&&Number.isInteger(t))return Co(t);if(typeof t=="string"){if(a5.test(t))return Co(Number(t));if(i0(t))return Co(Number(BigInt($1(t,!0))))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function kl(t){if(t!==null&&(typeof t=="bigint"||Sz(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(Ll(t));if(typeof t=="string"){if(a5.test(t))return BigInt(t);if(i0(t))return BigInt($1(t,!0))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function Ez(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Sr.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function Sz(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function Az(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function Pz(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Mz(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,new TextEncoder().encode(e));return{iv:r,cipherText:n}}async function Iz(t,{iv:e,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return new TextDecoder().decode(n)}function l5(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function h5(t,e){const r=l5(t),n=await crypto.subtle.exportKey(r,e);return L1(new Uint8Array(n))}async function d5(t,e){const r=l5(t),n=n0(e).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function Cz(t,e){const r=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return Mz(e,r)}async function Tz(t,e){return JSON.parse(await Iz(e,t))}const j1={storageKey:"ownPrivateKey",keyType:"private"},U1={storageKey:"ownPublicKey",keyType:"public"},q1={storageKey:"peerPublicKey",keyType:"public"};class Rz{constructor(){this.storage=new Ys("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(q1,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(U1.storageKey),this.storage.removeItem(j1.storageKey),this.storage.removeItem(q1.storageKey)}async generateKeyPair(){const e=await Az();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(j1,e.privateKey),await this.storeKey(U1,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(j1)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(U1)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(q1)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await Pz(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const r=this.storage.getItem(e.storageKey);return r?d5(e.keyType,r):null}async storeKey(e,r){const n=await h5(e.keyType,r);this.storage.setItem(e.storageKey,n)}}const Bl="4.2.4",p5="@coinbase/wallet-sdk";async function g5(t,e){const r=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":Bl,"X-Cbw-Sdk-Platform":p5}}),{result:i,error:s}=await n.json();if(s)throw s;return i}function Dz(){return globalThis.coinbaseWalletExtension}function Oz(){var t,e;try{const r=globalThis;return(t=r.ethereum)!==null&&t!==void 0?t:(e=r.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Nz({metadata:t,preference:e}){var r,n;const{appName:i,appLogoUrl:s,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const u=Dz();if(u)return(r=u.setAppInfo)===null||r===void 0||r.call(u,i,s,o,e),u}const a=Oz();if(a!=null&&a.isCoinbaseBrowser)return(n=a.setAppInfo)===null||n===void 0||n.call(a,i,s,o,e),a}function Lz(t){if(!t||typeof t!="object"||Array.isArray(t))throw Sr.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:r}=t;if(typeof e!="string"||e.length===0)throw Sr.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Sr.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw Sr.provider.unsupportedMethod()}}const m5="accounts",v5="activeChain",b5="availableChains",y5="walletCapabilities";class kz{constructor(e){var r,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new Rz,this.storage=new Ys("CBWSDK","SCWStateManager"),this.accounts=(r=this.storage.loadObject(m5))!==null&&r!==void 0?r:[],this.chain=this.storage.loadObject(v5)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var r,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(r=e.params)!==null&&r!==void 0?r:{})}}),s=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in s.content)throw s.content.failure;const o=await d5("public",s.sender);await this.keyManager.setPeerPublicKey(o);const u=(await this.decryptResponseMessage(s)).result;if("error"in u)throw u.error;const l=u.value;this.accounts=l,this.storage.storeObject(m5,l),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",l)}async request(e){var r;if(this.accounts.length===0)throw Sr.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:pa(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return pa(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(y5);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var r,n;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const i=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(i)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,r;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(r=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&r!==void 0?r:1}}async handleSwitchChainRequest(e){var r;const n=e.params;if(!n||!(!((r=n[0])===null||r===void 0)&&r.chainId))throw Sr.rpc.invalidParams();const i=Ll(n[0].chainId);if(this.updateChain(i))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(i),o}async sendEncryptedRequest(e){const r=await this.keyManager.getSharedSecret();if(!r)throw Sr.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await Cz({action:e,chainId:this.chain.id},r),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const r=await h5("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:r,content:e,timestamp:new Date}}async decryptResponseMessage(e){var r,n;const i=e.content;if("failure"in i)throw i.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw Sr.provider.unauthorized("Invalid session");const o=await Tz(i.encrypted,s),a=(r=o.data)===null||r===void 0?void 0:r.chains;if(a){const l=Object.entries(a).map(([d,g])=>({id:Number(d),rpcUrl:g}));this.storage.storeObject(b5,l),this.updateChain(this.chain.id,l)}const u=(n=o.data)===null||n===void 0?void 0:n.capabilities;return u&&this.storage.storeObject(y5,u),o}updateChain(e,r){var n;const i=r??this.storage.loadObject(b5),s=i==null?void 0:i.find(o=>o.id===e);return s?(s!==this.chain&&(this.chain=s,this.storage.storeObject(v5,s),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",pa(s.id))),!0):!1}}const Bz=Jp(tM),{keccak_256:$z}=Bz;function w5(t){return Buffer.allocUnsafe(t).fill(0)}function Fz(t){return t.toString(2).length}function x5(t,e){let r=t.toString(16);r.length%2!==0&&(r="0"+r);const n=r.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(r=I5(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(Xs(t,e[s]));if(r==="dynamic"){var o=Xs("uint256",e.length);i.unshift(o)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([Xs("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,si.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Tu(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return si.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Tu(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=hc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+a);if(n<0)throw new Error("Supplied uint is negative");return si.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(r=Tu(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=hc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied int exceeds width: "+r+" vs "+a);const u=si.twosFromBigInt(n,256);return si.bufferBEFromBigInt(u,32)}else if(t.startsWith("ufixed")){if(r=M5(t),n=hc(e),n<0)throw new Error("Supplied ufixed is negative");return Xs("uint256",n*BigInt(2)**BigInt(r[1]))}else if(t.startsWith("fixed"))return r=M5(t),Xs("int256",hc(e)*BigInt(2)**BigInt(r[1]))}throw new Error("Unsupported or invalid type: "+t)}function Wz(t){return t==="string"||t==="bytes"||I5(t)==="dynamic"}function Kz(t){return t.lastIndexOf("]")===t.length-1}function Vz(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var o=P5(t[s]),a=e[s],u=Xs(o,a);Wz(o)?(r.push(Xs("uint256",i)),n.push(u),i+=u.length):r.push(u)}return Buffer.concat(r.concat(n))}function C5(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(si.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=Tu(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=hc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+u);i.push(si.bufferBEFromBigInt(n,r/8))}else if(o.startsWith("int")){if(r=Tu(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=hc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied int exceeds width: "+r+" vs "+u);const l=si.twosFromBigInt(n,r);i.push(si.bufferBEFromBigInt(l,r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function Gz(t,e){return si.keccak(C5(t,e))}var Yz={rawEncode:Vz,solidityPack:C5,soliditySHA3:Gz};const _s=A5,$l=Yz,T5={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},z1={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const o=(a,u,l)=>{if(r[u]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":_s.keccak(this.encodeData(u,l,r,n))];if(l===void 0)throw new Error(`missing value for field ${a} of type ${u}`);if(u==="bytes")return["bytes32",_s.keccak(l)];if(u==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",_s.keccak(l)];if(u.lastIndexOf("]")===u.length-1){const d=u.slice(0,u.lastIndexOf("[")),g=l.map(y=>o(a,d,y));return["bytes32",_s.keccak($l.rawEncode(g.map(([y])=>y),g.map(([,y])=>y)))]}return[u,l]};for(const a of r[t]){const[u,l]=o(a.name,a.type,e[a.name]);i.push(u),s.push(l)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=_s.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=_s.keccak(a),s.push(a);else if(r[o.type]!==void 0)i.push("bytes32"),a=_s.keccak(this.encodeData(o.type,a,r,n)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return $l.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return _s.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return _s.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in T5.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),_s.keccak(Buffer.concat(n))}};var Jz={TYPED_MESSAGE_SCHEMA:T5,TypedDataUtils:z1,hashForSignTypedDataLegacy:function(t){return Xz(t.data)},hashForSignTypedData_v3:function(t){return z1.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return z1.hash(t.data)}};function Xz(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?_s.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return $l.soliditySHA3(["bytes32","bytes32"],[$l.soliditySHA3(new Array(t.length).fill("string"),i),$l.soliditySHA3(n,r)])}const o0=ji(Jz),Zz="walletUsername",H1="Addresses",Qz="AppVersion";function Hn(t){return t.errorMessage!==void 0}class eH{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),a=16,u=o.slice(o.byteLength-a),l=o.slice(0,o.byteLength-a),d=new Uint8Array(u),g=new Uint8Array(l),y=new Uint8Array([...n,...d,...g]);return L1(y)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=n0(e),a=o.slice(0,12),u=o.slice(12,28),l=o.slice(28),d=new Uint8Array([...l,...u]),g={name:"AES-GCM",iv:new Uint8Array(a)};try{const y=await window.crypto.subtle.decrypt(g,s,d),A=new TextDecoder;n(A.decode(y))}catch(y){i(y)}})()})}}class tH{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}var To;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(To||(To={}));class rH{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,To.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.DISCONNECTED)},i.onopen=s=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(u=>this.sendData(u)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const u=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,u)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,To.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const R5=1e4,nH=6e4;class iH{constructor({session:e,linkAPIUrl:r,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Co(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,u)=>{const l=s[u];l!==void 0&&a(l)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,u)},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(Zz,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(Qz,s)},this.handleChainUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(s),l=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(u,l)},this.session=e,this.cipher=new eH(e.secret),this.listener=n;const i=new rH(`${r}/rpc`,WebSocket);i.setConnectionStateListener(async s=>{let o=!1;switch(s){case To.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(u=>setTimeout(u,5e3)),this.destroyed||i.connect().catch(()=>{a()})};a()}break;case To.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},R5),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case To.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(s=>{var o;switch(s.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=s.type==="IsLinkedOK"?s.linked:void 0;this.linked=a||s.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(s.metadata);break}case"Event":{this.handleIncomingEvent(s);break}}s.id!==void 0&&((o=this.requestResolutions.get(s.id))===null||o===void 0||o(s))}),this.ws=i,this.http=new tH(r,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:s,response:o}=i;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s,o)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Co(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>R5*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r={timeout:nH}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r.timeout)}),new Promise(s=>{this.requestResolutions.set(n,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Co(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Co(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id}),!0)}}class sH{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=f5(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}const D5="session:id",O5="session:secret",N5="session:linked";class Ru{constructor(e,r,n,i=!1){this.storage=e,this.id=r,this.secret=n,this.key=NP(Pg(`${r}, ${n} WalletLink`)),this._linked=!!i}static create(e){const r=lc(16),n=lc(32);return new Ru(e,r,n).save()}static load(e){const r=e.getItem(D5),n=e.getItem(N5),i=e.getItem(O5);return r&&i?new Ru(e,r,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(D5,this.id),this.storage.setItem(O5,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(N5,this._linked?"1":"0")}}function oH(){try{return window.frameElement!==null}catch{return!1}}function aH(){try{return oH()&&window.top?window.top.location:window.location}catch{return window.location}}function cH(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function L5(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const uH='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function k5(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(uH)),document.documentElement.appendChild(t)}function B5(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e2&&(o.children=arguments.length>3?a0.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return c0(t,o,n,i,null)}function c0(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++$5,__i:-1,__u:0};return i==null&&Vr.vnode!=null&&Vr.vnode(s),s}function Ul(t){return t.children}function u0(t,e){this.props=t,this.context=e}function Du(t,e){if(e==null)return t.__?Du(t.__,t.__i+1):null;for(var r;ee&&dc.sort(W1));f0.__r=0}function W5(t,e,r,n,i,s,o,a,u,l,d){var g,y,A,P,N,D,k=n&&n.__k||q5,B=e.length;for(u=lH(r,e,k,u),g=0;g0?c0(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,(u=s.__i=hH(s,r,a,g))!==-1&&(g--,(o=r[u])&&(o.__u|=2)),o==null||o.__v===null?(u==-1&&y--,typeof s.type!="function"&&(s.__u|=4)):u!==a&&(u==a-1?y--:u==a+1?y++:(u>a?y--:y++,s.__u|=4))):s=t.__k[i]=null;if(g)for(i=0;i(u!=null&&!(2&u.__u)?1:0))for(;o>=0||a=0){if((u=e[o])&&!(2&u.__u)&&i==u.key&&s===u.type)return o;o--}if(a=r.__.length&&r.__.push({}),r.__[t]}function o4(t){return tv=1,gH(c4,t)}function gH(t,e,r){var n=s4(h0++,2);if(n.t=t,!n.__c&&(n.__=[c4(void 0,e),function(a){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,a);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=un,!un.u)){var i=function(a,u,l){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(y){return!!y.__c});if(d.every(function(y){return!y.__N}))return!s||s.call(this,a,u,l);var g=n.__c.props!==a;return d.forEach(function(y){if(y.__N){var A=y.__[0];y.__=y.__N,y.__N=void 0,A!==y.__[0]&&(g=!0)}}),s&&s.call(this,a,u,l)||g};un.u=!0;var s=un.shouldComponentUpdate,o=un.componentWillUpdate;un.componentWillUpdate=function(a,u,l){if(this.__e){var d=s;s=void 0,i(a,u,l),s=d}o&&o.call(this,a,u,l)},un.shouldComponentUpdate=i}return n.__N||n.__}function mH(t,e){var r=s4(h0++,3);!yn.__s&&yH(r.__H,e)&&(r.__=t,r.i=e,un.__H.__h.push(r))}function vH(){for(var t;t=Z5.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(d0),t.__H.__h.forEach(rv),t.__H.__h=[]}catch(e){t.__H.__h=[],yn.__e(e,t.__v)}}yn.__b=function(t){un=null,Q5&&Q5(t)},yn.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),i4&&i4(t,e)},yn.__r=function(t){e4&&e4(t),h0=0;var e=(un=t.__c).__H;e&&(ev===un?(e.__h=[],un.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(d0),e.__h.forEach(rv),e.__h=[],h0=0)),ev=un},yn.diffed=function(t){t4&&t4(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Z5.push(e)!==1&&X5===yn.requestAnimationFrame||((X5=yn.requestAnimationFrame)||bH)(vH)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),ev=un=null},yn.__c=function(t,e){e.some(function(r){try{r.__h.forEach(d0),r.__h=r.__h.filter(function(n){return!n.__||rv(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],yn.__e(n,r.__v)}}),r4&&r4(t,e)},yn.unmount=function(t){n4&&n4(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{d0(n)}catch(i){e=i}}),r.__H=void 0,e&&yn.__e(e,r.__v))};var a4=typeof requestAnimationFrame=="function";function bH(t){var e,r=function(){clearTimeout(n),a4&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);a4&&(e=requestAnimationFrame(r))}function d0(t){var e=un,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),un=e}function rv(t){var e=un;t.__c=t.__(),un=e}function yH(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function c4(t,e){return typeof e=="function"?e(t):e}const wH=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",xH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",_H="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class EH{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=L5()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const r=this.nextItemKey++;return this.items.set(r,e),this.render(),()=>{this.items.delete(r),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&Q1(Or("div",null,Or(u4,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,r])=>Or(SH,Object.assign({},r,{key:e}))))),this.root)}}const u4=t=>Or("div",{class:Fl("-cbwsdk-snackbar-container")},Or("style",null,wH),Or("div",{class:"-cbwsdk-snackbar"},t.children)),SH=({autoExpand:t,message:e,menuItems:r})=>{const[n,i]=o4(!0),[s,o]=o4(t??!1);mH(()=>{const u=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{u.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return Or("div",{class:Fl("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},Or("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},Or("img",{src:xH,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",Or("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),Or("div",{class:"-gear-container"},!s&&Or("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),Or("img",{src:_H,class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&Or("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((u,l)=>Or("div",{class:Fl("-cbwsdk-snackbar-instance-menu-item",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:u.onClick,key:l},Or("svg",{width:u.svgWidth,height:u.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("path",{"fill-rule":u.defaultFillRule,"clip-rule":u.defaultClipRule,d:u.path,fill:"#AAAAAA"})),Or("span",{class:Fl("-cbwsdk-snackbar-instance-menu-item-info",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},u.info)))))};class AH{constructor(){this.attached=!1,this.snackbar=new EH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.snackbar.attach(r),this.attached=!0,k5()}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}}const PH=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class MH{constructor(){this.root=null,this.darkMode=L5()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),k5()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(Q1(null,this.root),e&&Q1(Or(IH,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const IH=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return Or(u4,{darkMode:r},Or("div",{class:"-cbwsdk-redirect-dialog"},Or("style",null,PH),Or("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),Or("div",{class:Fl("-cbwsdk-redirect-dialog-box",s)},Or("p",null,t),Or("button",{onClick:n},e))))},CH="https://keys.coinbase.com/connect",f4="https://www.walletlink.org",TH="https://go.cb-w.com/walletlink";class l4{constructor(){this.attached=!1,this.redirectDialog=new MH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const r=new URL(TH);r.searchParams.append("redirect_url",aH().href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class Ro{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=cH(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(H1);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!u&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),Ro.accountRequestCallbackIds.size>0&&(Array.from(Ro.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),Ro.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new sH,this.ui=n,this.ui.attach()}subscribe(){const e=Ru.load(this.storage)||Ru.create(this.storage),{linkAPIUrl:r}=this,n=new iH({session:e,linkAPIUrl:r,listener:this}),i=this.isMobileWeb?new l4:new AH;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=Ru.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Ys.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?Js(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?Js(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Nl(e,!0),chainId:r}})}getWalletLinkSession(){return this._session}sendRequest(e){let r=null;const n=lc(8),i=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,s),r==null||r()};return new Promise((s,o)=>{r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,a=>{if(r==null||r(),Hn(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,r){const n={type:"WEB3_REQUEST",id:e,request:r};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:r.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(r.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof l4)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e,r){if(r.method==="requestEthereumAccounts"){Ro.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,r)),Ro.accountRequestCallbackIds.clear();return}this.invokeCallback(e,r)}handleErrorResponse(e,r,n){var i;const s=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:r,errorMessage:s})}invokeCallback(e,r){const n=this.relayEventManager.callbacks.get(e);n&&(n(r),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:r}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:r}},i=lc(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(Hn(a))return o(new Error(a.errorMessage));s(a)}),Ro.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,r,n,i,s,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:o}};let u=null;const l=lc(8),d=g=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,g),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((g,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));g(A)}),this.publishWeb3RequestEvent(l,a)})}addEthereumChain(e,r,n,i,s,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:o}};let u=null;const l=lc(8),d=g=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,g),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((g,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));g(A)}),this.publishWeb3RequestEvent(l,a)})}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})};let i=null;const s=lc(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,u)=>{this.relayEventManager.callbacks.set(s,l=>{if(i==null||i(),Hn(l)&&l.errorCode)return u(Sr.provider.custom({code:l.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(Hn(l))return u(new Error(l.errorMessage));a(l)}),this.publishWeb3RequestEvent(s,n)})}}Ro.accountRequestCallbackIds=new Set;const h4="DefaultChainId",d4="DefaultJsonRpcUrl";class p4{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new Ys("walletlink",f4),this.callback=e.callback||null;const r=this._storage.getItem(H1);if(r){const n=r.split(" ");n[0]!==""&&(this._addresses=n.map(i=>ga(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:r,secret:n}=e.getWalletLinkSession();return{id:r,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(d4))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(d4,e)}updateProviderInfo(e,r){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(h4,r.toString(10)),Ll(r)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",pa(r)))}async watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw Sr.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw Sr.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw Sr.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw Sr.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=r.options,l=await this.initializeRelay().watchAsset(r.type,i,s,a,o,n==null?void 0:n.toString());return Hn(l)?!1:!!l.result}async addEthereumChain(e){var r,n;const i=e[0];if(((r=i.rpcUrls)===null||r===void 0?void 0:r.length)===0)throw Sr.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw Sr.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw Sr.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:u=[],chainName:l,iconUrls:d=[],nativeCurrency:g}=i,y=await o.addEthereumChain(s.toString(),a,d,u,l,g);if(Hn(y))return!1;if(((n=y.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw Sr.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const r=e[0],n=Number.parseInt(r.chainId,16),s=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(Hn(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,r){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(s=>ga(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(H1,i.join(" ")))}async request(e){const r=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return pa(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(r);case"wallet_switchEthereumChain":return this.switchEthereumChain(r);case"wallet_watchAsset":return this.watchAsset(r);default:if(!this.jsonRpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const r=ga(e);if(!this._addresses.map(i=>ga(i)).includes(r))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?ga(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?ga(e.to):null,i=e.value!=null?kl(e.value):BigInt(0),s=e.data?F1(e.data):Buffer.alloc(0),o=e.nonce!=null?Ll(e.nonce):null,a=e.gasPrice!=null?kl(e.gasPrice):null,u=e.maxFeePerGas!=null?kl(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?kl(e.maxPriorityFeePerGas):null,d=e.gas!=null?kl(e.gas):null,g=e.chainId?Ll(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:u,maxPriorityFeePerGas:l,gasLimit:d,chainId:g}}async ecRecover(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:k1(n[0]),signature:k1(n[1]),addPrefix:r==="personal_ecRecover"}});if(Hn(s))throw s;return s.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(h4))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,r;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:pa(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(Hn(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:pa(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw Sr.rpc.invalidParams();const r=e[1],n=e[0];this._ensureKnownAddress(r);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ga(r),message:k1(n),addPrefix:!0,typedDataJson:null}});if(Hn(s))throw s;return s.result}async _eth_signTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(r);if(Hn(i))throw i;return i.result}async _eth_sendRawTransaction(e){const r=F1(e[0]),i=await this.initializeRelay().submitEthereumTransaction(r,this.getChainId());if(Hn(i))throw i;return i.result}async _eth_sendTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(r);if(Hn(i))throw i;return i.result}async signTypedData(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const i=l=>{const d={eth_signTypedData_v1:o0.hashForSignTypedDataLegacy,eth_signTypedData_v3:o0.hashForSignTypedData_v3,eth_signTypedData_v4:o0.hashForSignTypedData_v4,eth_signTypedData:o0.hashForSignTypedData_v4};return Nl(d[r]({data:Ez(l)}),!0)},s=n[r==="eth_signTypedData_v1"?1:0],o=n[r==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const u=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ga(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(Hn(u))throw u;return u.result}initializeRelay(){return this._relay||(this._relay=new Ro({linkAPIUrl:f4,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const g4="SignerType",m4=new Ys("CBWSDK","SignerConfigurator");function RH(){return m4.getItem(g4)}function DH(t){m4.setItem(g4,t)}async function OH(t){const{communicator:e,metadata:r,handshakeRequest:n,callback:i}=t;LH(e,r,i).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:o}=await e.postRequestAndWaitForResponse(s);return o}function NH(t){const{signerType:e,metadata:r,communicator:n,callback:i}=t;switch(e){case"scw":return new kz({metadata:r,callback:i,communicator:n});case"walletlink":return new p4({metadata:r,callback:i})}}async function LH(t,e,r){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new p4({metadata:e,callback:r});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const kH=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. +}`;var fr=WA(function(){return Mr(ne,Nt+"return "+Ze).apply(r,he)});if(fr.source=Ze,Ny(fr))throw fr;return fr}function vse(c){return Cr(c).toLowerCase()}function bse(c){return Cr(c).toUpperCase()}function yse(c,h,w){if(c=Cr(c),c&&(w||h===r))return e9(c);if(!c||!(h=ki(h)))return c;var L=Ms(c),W=Ms(h),ne=t9(L,W),he=r9(L,W)+1;return La(L,ne,he).join("")}function wse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.slice(0,i9(c)+1);if(!c||!(h=ki(h)))return c;var L=Ms(c),W=r9(L,Ms(h))+1;return La(L,0,W).join("")}function xse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.replace($,"");if(!c||!(h=ki(h)))return c;var L=Ms(c),W=t9(L,Ms(h));return La(L,W).join("")}function _se(c,h){var w=_e,L=G;if(Qr(h)){var W="separator"in h?h.separator:W;w="length"in h?ur(h.length):w,L="omission"in h?ki(h.omission):L}c=Cr(c);var ne=c.length;if(rf(c)){var he=Ms(c);ne=he.length}if(w>=ne)return c;var me=w-nf(L);if(me<1)return L;var we=he?La(he,0,me).join(""):c.slice(0,me);if(W===r)return we+L;if(he&&(me+=we.length-me),Ly(W)){if(c.slice(me).search(W)){var We,Ke=we;for(W.global||(W=Xb(W.source,Cr(Re.exec(W))+"g")),W.lastIndex=0;We=W.exec(Ke);)var Ze=We.index;we=we.slice(0,Ze===r?me:Ze)}}else if(c.indexOf(ki(W),me)!=me){var xt=we.lastIndexOf(W);xt>-1&&(we=we.slice(0,xt))}return we+L}function Ese(c){return c=Cr(c),c&&Bt.test(c)?c.replace(Xt,ZQ):c}var Sse=lf(function(c,h,w){return c+(w?" ":"")+h.toUpperCase()}),$y=K9("toUpperCase");function HA(c,h,w){return c=Cr(c),h=w?r:h,h===r?VQ(c)?tee(c):$Q(c):c.match(h)||[]}var WA=hr(function(c,h){try{return Bn(c,r,h)}catch(w){return Ny(w)?w:new tr(w)}}),Ase=Wo(function(c,h){return ss(h,function(w){w=so(w),zo(c,w,Dy(c[w],c))}),c});function Pse(c){var h=c==null?0:c.length,w=qt();return c=h?Xr(c,function(L){if(typeof L[1]!="function")throw new os(o);return[w(L[0]),L[1]]}):[],hr(function(L){for(var W=-1;++W_)return[];var w=M,L=ei(c,M);h=qt(h),c-=M;for(var W=Gb(L,h);++w0||h<0)?new xr(w):(c<0?w=w.takeRight(-c):c&&(w=w.drop(c)),h!==r&&(h=ur(h),w=h<0?w.dropRight(-h):w.take(h-c)),w)},xr.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},xr.prototype.toArray=function(){return this.take(M)},no(xr.prototype,function(c,h){var w=/^(?:filter|find|map|reject)|While$/.test(h),L=/^(?:head|last)$/.test(h),W=re[L?"take"+(h=="last"?"Right":""):h],ne=L||/^find/.test(h);W&&(re.prototype[h]=function(){var he=this.__wrapped__,me=L?[1]:arguments,we=he instanceof xr,We=me[0],Ke=we||sr(he),Ze=function(br){var Er=W.apply(re,Ca([br],me));return L&&xt?Er[0]:Er};Ke&&w&&typeof We=="function"&&We.length!=1&&(we=Ke=!1);var xt=this.__chain__,Nt=!!this.__actions__.length,Vt=ne&&!xt,fr=we&&!Nt;if(!ne&&Ke){he=fr?he:new xr(this);var Gt=c.apply(he,me);return Gt.__actions__.push({func:qp,args:[Ze],thisArg:r}),new as(Gt,xt)}return Vt&&fr?c.apply(this,me):(Gt=this.thru(Ze),Vt?L?Gt.value()[0]:Gt.value():Gt)})}),ss(["pop","push","shift","sort","splice","unshift"],function(c){var h=pp[c],w=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",L=/^(?:pop|shift)$/.test(c);re.prototype[c]=function(){var W=arguments;if(L&&!this.__chain__){var ne=this.value();return h.apply(sr(ne)?ne:[],W)}return this[w](function(he){return h.apply(sr(he)?he:[],W)})}}),no(xr.prototype,function(c,h){var w=re[h];if(w){var L=w.name+"";Tr.call(cf,L)||(cf[L]=[]),cf[L].push({name:h,func:w})}}),cf[Lp(r,k).name]=[{name:"wrapper",func:r}],xr.prototype.clone=Eee,xr.prototype.reverse=See,xr.prototype.value=Aee,re.prototype.at=ene,re.prototype.chain=tne,re.prototype.commit=rne,re.prototype.next=nne,re.prototype.plant=sne,re.prototype.reverse=one,re.prototype.toJSON=re.prototype.valueOf=re.prototype.value=ane,re.prototype.first=re.prototype.head,bh&&(re.prototype[bh]=ine),re},sf=ree();gn?((gn.exports=sf)._=sf,Ur._=sf):_r._=sf}).call(nn)}(e0,e0.exports);var Pq=e0.exports,P1={exports:{}};(function(t,e){var r=typeof self<"u"?self:nn,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function u(f){return f&&DataView.prototype.isPrototypeOf(f)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(f){return f&&l.indexOf(Object.prototype.toString.call(f))>-1};function p(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function y(f){return typeof f!="string"&&(f=String(f)),f}function A(f){var g={next:function(){var v=f.shift();return{done:v===void 0,value:v}}};return a.iterable&&(g[Symbol.iterator]=function(){return g}),g}function P(f){this.map={},f instanceof P?f.forEach(function(g,v){this.append(v,g)},this):Array.isArray(f)?f.forEach(function(g){this.append(g[0],g[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(g){this.append(g,f[g])},this)}P.prototype.append=function(f,g){f=p(f),g=y(g);var v=this.map[f];this.map[f]=v?v+", "+g:g},P.prototype.delete=function(f){delete this.map[p(f)]},P.prototype.get=function(f){return f=p(f),this.has(f)?this.map[f]:null},P.prototype.has=function(f){return this.map.hasOwnProperty(p(f))},P.prototype.set=function(f,g){this.map[p(f)]=y(g)},P.prototype.forEach=function(f,g){for(var v in this.map)this.map.hasOwnProperty(v)&&f.call(g,this.map[v],v,this)},P.prototype.keys=function(){var f=[];return this.forEach(function(g,v){f.push(v)}),A(f)},P.prototype.values=function(){var f=[];return this.forEach(function(g){f.push(g)}),A(f)},P.prototype.entries=function(){var f=[];return this.forEach(function(g,v){f.push([v,g])}),A(f)},a.iterable&&(P.prototype[Symbol.iterator]=P.prototype.entries);function N(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function D(f){return new Promise(function(g,v){f.onload=function(){g(f.result)},f.onerror=function(){v(f.error)}})}function k(f){var g=new FileReader,v=D(g);return g.readAsArrayBuffer(f),v}function B(f){var g=new FileReader,v=D(g);return g.readAsText(f),v}function j(f){for(var g=new Uint8Array(f),v=new Array(g.length),x=0;x-1?g:f}function z(f,g){g=g||{};var v=g.body;if(f instanceof z){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,g.headers||(this.headers=new P(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!v&&f._bodyInit!=null&&(v=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=g.credentials||this.credentials||"same-origin",(g.headers||!this.headers)&&(this.headers=new P(g.headers)),this.method=T(g.method||this.method||"GET"),this.mode=g.mode||this.mode||null,this.signal=g.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(v)}z.prototype.clone=function(){return new z(this,{body:this._bodyInit})};function ue(f){var g=new FormData;return f.trim().split("&").forEach(function(v){if(v){var x=v.split("="),_=x.shift().replace(/\+/g," "),S=x.join("=").replace(/\+/g," ");g.append(decodeURIComponent(_),decodeURIComponent(S))}}),g}function _e(f){var g=new P,v=f.replace(/\r?\n[\t ]+/g," ");return v.split(/\r?\n/).forEach(function(x){var _=x.split(":"),S=_.shift().trim();if(S){var b=_.join(":").trim();g.append(S,b)}}),g}K.call(z.prototype);function G(f,g){g||(g={}),this.type="default",this.status=g.status===void 0?200:g.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in g?g.statusText:"OK",this.headers=new P(g.headers),this.url=g.url||"",this._initBody(f)}K.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new P(this.headers),url:this.url})},G.error=function(){var f=new G(null,{status:0,statusText:""});return f.type="error",f};var E=[301,302,303,307,308];G.redirect=function(f,g){if(E.indexOf(g)===-1)throw new RangeError("Invalid status code");return new G(null,{status:g,headers:{location:f}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(g,v){this.message=g,this.name=v;var x=Error(g);this.stack=x.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function m(f,g){return new Promise(function(v,x){var _=new z(f,g);if(_.signal&&_.signal.aborted)return x(new o.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function b(){S.abort()}S.onload=function(){var M={status:S.status,statusText:S.statusText,headers:_e(S.getAllResponseHeaders()||"")};M.url="responseURL"in S?S.responseURL:M.headers.get("X-Request-URL");var I="response"in S?S.response:S.responseText;v(new G(I,M))},S.onerror=function(){x(new TypeError("Network request failed"))},S.ontimeout=function(){x(new TypeError("Network request failed"))},S.onabort=function(){x(new o.DOMException("Aborted","AbortError"))},S.open(_.method,_.url,!0),_.credentials==="include"?S.withCredentials=!0:_.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&a.blob&&(S.responseType="blob"),_.headers.forEach(function(M,I){S.setRequestHeader(I,M)}),_.signal&&(_.signal.addEventListener("abort",b),S.onreadystatechange=function(){S.readyState===4&&_.signal.removeEventListener("abort",b)}),S.send(typeof _._bodyInit>"u"?null:_._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=P,s.Request=z,s.Response=G),o.Headers=P,o.Request=z,o.Response=G,o.fetch=m,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(P1,P1.exports);var Mq=P1.exports;const R6=ji(Mq);var Iq=Object.defineProperty,Cq=Object.defineProperties,Tq=Object.getOwnPropertyDescriptors,D6=Object.getOwnPropertySymbols,Rq=Object.prototype.hasOwnProperty,Dq=Object.prototype.propertyIsEnumerable,O6=(t,e,r)=>e in t?Iq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,N6=(t,e)=>{for(var r in e||(e={}))Rq.call(e,r)&&O6(t,r,e[r]);if(D6)for(var r of D6(e))Dq.call(e,r)&&O6(t,r,e[r]);return t},L6=(t,e)=>Cq(t,Tq(e));const Oq={Accept:"application/json","Content-Type":"application/json"},Nq="POST",k6={headers:Oq,method:Nq},B6=10;let xs=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new qi.EventEmitter,this.isAvailable=!1,this.registering=!1,!k_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=mo(e),n=await(await R6(this.url,L6(N6({},k6),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!k_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=mo({id:1,jsonrpc:"2.0",method:"test",params:[]});await R6(e,L6(N6({},k6),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ka(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return R_(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>B6&&this.events.setMaxListeners(B6)}};const $6="error",Lq="wss://relay.walletconnect.org",kq="wc",Bq="universal_provider",F6=`${kq}@2:${Bq}:`,j6="https://rpc.walletconnect.org/v1/",Iu="generic",$q=`${j6}bundler`,Qi={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Fq=Object.defineProperty,jq=Object.defineProperties,Uq=Object.getOwnPropertyDescriptors,U6=Object.getOwnPropertySymbols,qq=Object.prototype.hasOwnProperty,zq=Object.prototype.propertyIsEnumerable,q6=(t,e,r)=>e in t?Fq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,t0=(t,e)=>{for(var r in e||(e={}))qq.call(e,r)&&q6(t,r,e[r]);if(U6)for(var r of U6(e))zq.call(e,r)&&q6(t,r,e[r]);return t},Hq=(t,e)=>jq(t,Uq(e));function Di(t,e,r){var n;const i=Eu(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${j6}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function fc(t){return t.includes(":")?t.split(":")[1]:t}function z6(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Wq(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function M1(t={},e={}){const r=H6(t),n=H6(e);return Pq.merge(r,n)}function H6(t){var e,r,n,i;const s={};if(!Sl(t))return s;for(const[o,a]of Object.entries(t)){const u=f1(o)?[o]:a.chains,l=a.methods||[],d=a.events||[],p=a.rpcMap||{},y=El(o);s[y]=Hq(t0(t0({},s[y]),a),{chains:Ud(u,(e=s[y])==null?void 0:e.chains),methods:Ud(l,(r=s[y])==null?void 0:r.methods),events:Ud(d,(n=s[y])==null?void 0:n.events),rpcMap:t0(t0({},p),(i=s[y])==null?void 0:i.rpcMap)})}return s}function Kq(t){return t.includes(":")?t.split(":")[2]:t}function W6(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=f1(r)?[r]:n.chains?n.chains:z6(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function I1(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const K6={},Ar=t=>K6[t],C1=(t,e)=>{K6[t]=e};class Vq{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}var Gq=Object.defineProperty,Yq=Object.defineProperties,Jq=Object.getOwnPropertyDescriptors,V6=Object.getOwnPropertySymbols,Xq=Object.prototype.hasOwnProperty,Zq=Object.prototype.propertyIsEnumerable,G6=(t,e,r)=>e in t?Gq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Y6=(t,e)=>{for(var r in e||(e={}))Xq.call(e,r)&&G6(t,r,e[r]);if(V6)for(var r of V6(e))Zq.call(e,r)&&G6(t,r,e[r]);return t},J6=(t,e)=>Yq(t,Jq(e));class Qq{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(fc(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const u=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:J6(Y6({},o.sessionProperties||{}),{capabilities:J6(Y6({},a||{}),{[s]:u})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return u}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(da("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${$q}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class ez{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}let tz=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}},rz=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ji(new xs(n,Ar("disableProviderPing")))}},nz=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=fc(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}},iz=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}};class sz{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}let oz=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new xs(n,Ar("disableProviderPing")))}};class az{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new xs(n))}}class cz{constructor(e){this.name=Iu,this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=Eu(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}var uz=Object.defineProperty,fz=Object.defineProperties,lz=Object.getOwnPropertyDescriptors,X6=Object.getOwnPropertySymbols,hz=Object.prototype.hasOwnProperty,dz=Object.prototype.propertyIsEnumerable,Z6=(t,e,r)=>e in t?uz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,r0=(t,e)=>{for(var r in e||(e={}))hz.call(e,r)&&Z6(t,r,e[r]);if(X6)for(var r of X6(e))dz.call(e,r)&&Z6(t,r,e[r]);return t},T1=(t,e)=>fz(t,lz(e));let Q6=class YA{constructor(e){this.events=new Yg,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||$6})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new YA(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:r0({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,Vd(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Dr("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=W6(this.session.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=W6(s.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==I6)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Iu?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(ic(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await A1.init({core:this.providerOpts.core,logger:this.providerOpts.logger||$6,relayUrl:this.providerOpts.relayUrl||Lq,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>El(r)))];C1("client",this.client),C1("events",this.events),C1("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Wq(r,this.session),i=z6(n),s=M1(this.namespaces,this.optionalNamespaces),o=T1(r0({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new Qq({namespace:o});break;case"algorand":this.rpcProviders[r]=new rz({namespace:o});break;case"solana":this.rpcProviders[r]=new ez({namespace:o});break;case"cosmos":this.rpcProviders[r]=new tz({namespace:o});break;case"polkadot":this.rpcProviders[r]=new Vq({namespace:o});break;case"cip34":this.rpcProviders[r]=new nz({namespace:o});break;case"elrond":this.rpcProviders[r]=new iz({namespace:o});break;case"multiversx":this.rpcProviders[r]=new sz({namespace:o});break;case"near":this.rpcProviders[r]=new oz({namespace:o});break;case"tezos":this.rpcProviders[r]=new az({namespace:o});break;default:this.rpcProviders[Iu]?this.rpcProviders[Iu].updateNamespace(o):this.rpcProviders[Iu]=new cz({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&ic(i)&&this.events.emit("accountsChanged",i.map(Kq))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=El(i),a=I1(i)!==I1(s)?`${o}:${I1(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=T1(r0({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",T1(r0({},Dr("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Qi.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Iu]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>El(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=El(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${F6}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${F6}/${e}`)}};const pz=Q6;function gz(){return new Promise(t=>{const e=[];let r;window.addEventListener("eip6963:announceProvider",n=>{const{detail:i}=n;r&&clearTimeout(r),e.push(i),r=setTimeout(()=>t(e),200)}),r=setTimeout(()=>t(e),200),window.dispatchEvent(new Event("eip6963:requestProvider"))})}class Ys{constructor(e,r){this.scope=e,this.module=r}storeObject(e,r){this.setItem(e,JSON.stringify(r))}loadObject(e){const r=this.getItem(e);return r?JSON.parse(r):void 0}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new Ys("CBWSDK").clear(),new Ys("walletlink").clear()}}const cn={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},R1={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},e5="Unspecified error message.",mz="Unspecified server error.";function D1(t,e=e5){if(t&&Number.isInteger(t)){const r=t.toString();if(O1(R1,r))return R1[r].message;if(t5(t))return mz}return e}function vz(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(R1[e]||t5(t))}function bz(t,{shouldIncludeStack:e=!1}={}){const r={};if(t&&typeof t=="object"&&!Array.isArray(t)&&O1(t,"code")&&vz(t.code)){const n=t;r.code=n.code,n.message&&typeof n.message=="string"?(r.message=n.message,O1(n,"data")&&(r.data=n.data)):(r.message=D1(r.code),r.data={originalError:r5(t)})}else r.code=cn.rpc.internal,r.message=n5(t,"message")?t.message:e5,r.data={originalError:r5(t)};return e&&(r.stack=n5(t,"stack")?t.stack:void 0),r}function t5(t){return t>=-32099&&t<=-32e3}function r5(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function O1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function n5(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const Sr={rpc:{parse:t=>es(cn.rpc.parse,t),invalidRequest:t=>es(cn.rpc.invalidRequest,t),invalidParams:t=>es(cn.rpc.invalidParams,t),methodNotFound:t=>es(cn.rpc.methodNotFound,t),internal:t=>es(cn.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return es(e,t)},invalidInput:t=>es(cn.rpc.invalidInput,t),resourceNotFound:t=>es(cn.rpc.resourceNotFound,t),resourceUnavailable:t=>es(cn.rpc.resourceUnavailable,t),transactionRejected:t=>es(cn.rpc.transactionRejected,t),methodNotSupported:t=>es(cn.rpc.methodNotSupported,t),limitExceeded:t=>es(cn.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Cu(cn.provider.userRejectedRequest,t),unauthorized:t=>Cu(cn.provider.unauthorized,t),unsupportedMethod:t=>Cu(cn.provider.unsupportedMethod,t),disconnected:t=>Cu(cn.provider.disconnected,t),chainDisconnected:t=>Cu(cn.provider.chainDisconnected,t),unsupportedChain:t=>Cu(cn.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new o5(e,r,n)}}};function es(t,e){const[r,n]=i5(e);return new s5(t,r||D1(t),n)}function Cu(t,e){const[r,n]=i5(e);return new o5(t,r||D1(t),n)}function i5(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}class s5 extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}}class o5 extends s5{constructor(e,r,n){if(!yz(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}function yz(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function N1(){return t=>t}const Ol=N1(),wz=N1(),xz=N1();function Co(t){return Math.floor(t)}const a5=/^[0-9]*$/,c5=/^[a-f0-9]*$/;function lc(t){return L1(crypto.getRandomValues(new Uint8Array(t)))}function L1(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function n0(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function Nl(t,e=!1){const r=t.toString("hex");return Ol(e?`0x${r}`:r)}function k1(t){return Nl(F1(t),!0)}function Js(t){return xz(t.toString(10))}function pa(t){return Ol(`0x${BigInt(t).toString(16)}`)}function u5(t){return t.startsWith("0x")||t.startsWith("0X")}function B1(t){return u5(t)?t.slice(2):t}function f5(t){return u5(t)?`0x${t.slice(2)}`:`0x${t}`}function i0(t){if(typeof t!="string")return!1;const e=B1(t).toLowerCase();return c5.test(e)}function _z(t,e=!1){if(typeof t=="string"){const r=B1(t).toLowerCase();if(c5.test(r))return Ol(e?`0x${r}`:r)}throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function $1(t,e=!1){let r=_z(t,!1);return r.length%2===1&&(r=Ol(`0${r}`)),e?Ol(`0x${r}`):r}function ga(t){if(typeof t=="string"){const e=B1(t).toLowerCase();if(i0(e)&&e.length===40)return wz(f5(e))}throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function F1(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(i0(t)){const e=$1(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Sr.rpc.invalidParams(`Not binary data: ${String(t)}`)}function Ll(t){if(typeof t=="number"&&Number.isInteger(t))return Co(t);if(typeof t=="string"){if(a5.test(t))return Co(Number(t));if(i0(t))return Co(Number(BigInt($1(t,!0))))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function kl(t){if(t!==null&&(typeof t=="bigint"||Sz(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(Ll(t));if(typeof t=="string"){if(a5.test(t))return BigInt(t);if(i0(t))return BigInt($1(t,!0))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function Ez(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Sr.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function Sz(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function Az(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function Pz(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Mz(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,new TextEncoder().encode(e));return{iv:r,cipherText:n}}async function Iz(t,{iv:e,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return new TextDecoder().decode(n)}function l5(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function h5(t,e){const r=l5(t),n=await crypto.subtle.exportKey(r,e);return L1(new Uint8Array(n))}async function d5(t,e){const r=l5(t),n=n0(e).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function Cz(t,e){const r=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return Mz(e,r)}async function Tz(t,e){return JSON.parse(await Iz(e,t))}const j1={storageKey:"ownPrivateKey",keyType:"private"},U1={storageKey:"ownPublicKey",keyType:"public"},q1={storageKey:"peerPublicKey",keyType:"public"};class Rz{constructor(){this.storage=new Ys("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(q1,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(U1.storageKey),this.storage.removeItem(j1.storageKey),this.storage.removeItem(q1.storageKey)}async generateKeyPair(){const e=await Az();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(j1,e.privateKey),await this.storeKey(U1,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(j1)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(U1)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(q1)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await Pz(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const r=this.storage.getItem(e.storageKey);return r?d5(e.keyType,r):null}async storeKey(e,r){const n=await h5(e.keyType,r);this.storage.setItem(e.storageKey,n)}}const Bl="4.2.4",p5="@coinbase/wallet-sdk";async function g5(t,e){const r=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":Bl,"X-Cbw-Sdk-Platform":p5}}),{result:i,error:s}=await n.json();if(s)throw s;return i}function Dz(){return globalThis.coinbaseWalletExtension}function Oz(){var t,e;try{const r=globalThis;return(t=r.ethereum)!==null&&t!==void 0?t:(e=r.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Nz({metadata:t,preference:e}){var r,n;const{appName:i,appLogoUrl:s,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const u=Dz();if(u)return(r=u.setAppInfo)===null||r===void 0||r.call(u,i,s,o,e),u}const a=Oz();if(a!=null&&a.isCoinbaseBrowser)return(n=a.setAppInfo)===null||n===void 0||n.call(a,i,s,o,e),a}function Lz(t){if(!t||typeof t!="object"||Array.isArray(t))throw Sr.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:r}=t;if(typeof e!="string"||e.length===0)throw Sr.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Sr.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw Sr.provider.unsupportedMethod()}}const m5="accounts",v5="activeChain",b5="availableChains",y5="walletCapabilities";class kz{constructor(e){var r,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new Rz,this.storage=new Ys("CBWSDK","SCWStateManager"),this.accounts=(r=this.storage.loadObject(m5))!==null&&r!==void 0?r:[],this.chain=this.storage.loadObject(v5)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var r,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(r=e.params)!==null&&r!==void 0?r:{})}}),s=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in s.content)throw s.content.failure;const o=await d5("public",s.sender);await this.keyManager.setPeerPublicKey(o);const u=(await this.decryptResponseMessage(s)).result;if("error"in u)throw u.error;const l=u.value;this.accounts=l,this.storage.storeObject(m5,l),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",l)}async request(e){var r;if(this.accounts.length===0)throw Sr.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:pa(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return pa(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(y5);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var r,n;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const i=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(i)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,r;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(r=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&r!==void 0?r:1}}async handleSwitchChainRequest(e){var r;const n=e.params;if(!n||!(!((r=n[0])===null||r===void 0)&&r.chainId))throw Sr.rpc.invalidParams();const i=Ll(n[0].chainId);if(this.updateChain(i))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(i),o}async sendEncryptedRequest(e){const r=await this.keyManager.getSharedSecret();if(!r)throw Sr.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await Cz({action:e,chainId:this.chain.id},r),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const r=await h5("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:r,content:e,timestamp:new Date}}async decryptResponseMessage(e){var r,n;const i=e.content;if("failure"in i)throw i.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw Sr.provider.unauthorized("Invalid session");const o=await Tz(i.encrypted,s),a=(r=o.data)===null||r===void 0?void 0:r.chains;if(a){const l=Object.entries(a).map(([d,p])=>({id:Number(d),rpcUrl:p}));this.storage.storeObject(b5,l),this.updateChain(this.chain.id,l)}const u=(n=o.data)===null||n===void 0?void 0:n.capabilities;return u&&this.storage.storeObject(y5,u),o}updateChain(e,r){var n;const i=r??this.storage.loadObject(b5),s=i==null?void 0:i.find(o=>o.id===e);return s?(s!==this.chain&&(this.chain=s,this.storage.storeObject(v5,s),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",pa(s.id))),!0):!1}}const Bz=Jp(tM),{keccak_256:$z}=Bz;function w5(t){return Buffer.allocUnsafe(t).fill(0)}function Fz(t){return t.toString(2).length}function x5(t,e){let r=t.toString(16);r.length%2!==0&&(r="0"+r);const n=r.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(r=I5(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(Xs(t,e[s]));if(r==="dynamic"){var o=Xs("uint256",e.length);i.unshift(o)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([Xs("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,si.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Tu(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return si.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Tu(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=hc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+a);if(n<0)throw new Error("Supplied uint is negative");return si.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(r=Tu(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=hc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied int exceeds width: "+r+" vs "+a);const u=si.twosFromBigInt(n,256);return si.bufferBEFromBigInt(u,32)}else if(t.startsWith("ufixed")){if(r=M5(t),n=hc(e),n<0)throw new Error("Supplied ufixed is negative");return Xs("uint256",n*BigInt(2)**BigInt(r[1]))}else if(t.startsWith("fixed"))return r=M5(t),Xs("int256",hc(e)*BigInt(2)**BigInt(r[1]))}throw new Error("Unsupported or invalid type: "+t)}function Wz(t){return t==="string"||t==="bytes"||I5(t)==="dynamic"}function Kz(t){return t.lastIndexOf("]")===t.length-1}function Vz(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var o=P5(t[s]),a=e[s],u=Xs(o,a);Wz(o)?(r.push(Xs("uint256",i)),n.push(u),i+=u.length):r.push(u)}return Buffer.concat(r.concat(n))}function C5(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(si.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=Tu(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=hc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+u);i.push(si.bufferBEFromBigInt(n,r/8))}else if(o.startsWith("int")){if(r=Tu(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=hc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied int exceeds width: "+r+" vs "+u);const l=si.twosFromBigInt(n,r);i.push(si.bufferBEFromBigInt(l,r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function Gz(t,e){return si.keccak(C5(t,e))}var Yz={rawEncode:Vz,solidityPack:C5,soliditySHA3:Gz};const _s=A5,$l=Yz,T5={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},z1={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const o=(a,u,l)=>{if(r[u]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":_s.keccak(this.encodeData(u,l,r,n))];if(l===void 0)throw new Error(`missing value for field ${a} of type ${u}`);if(u==="bytes")return["bytes32",_s.keccak(l)];if(u==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",_s.keccak(l)];if(u.lastIndexOf("]")===u.length-1){const d=u.slice(0,u.lastIndexOf("[")),p=l.map(y=>o(a,d,y));return["bytes32",_s.keccak($l.rawEncode(p.map(([y])=>y),p.map(([,y])=>y)))]}return[u,l]};for(const a of r[t]){const[u,l]=o(a.name,a.type,e[a.name]);i.push(u),s.push(l)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=_s.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=_s.keccak(a),s.push(a);else if(r[o.type]!==void 0)i.push("bytes32"),a=_s.keccak(this.encodeData(o.type,a,r,n)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return $l.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return _s.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return _s.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in T5.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),_s.keccak(Buffer.concat(n))}};var Jz={TYPED_MESSAGE_SCHEMA:T5,TypedDataUtils:z1,hashForSignTypedDataLegacy:function(t){return Xz(t.data)},hashForSignTypedData_v3:function(t){return z1.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return z1.hash(t.data)}};function Xz(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?_s.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return $l.soliditySHA3(["bytes32","bytes32"],[$l.soliditySHA3(new Array(t.length).fill("string"),i),$l.soliditySHA3(n,r)])}const o0=ji(Jz),Zz="walletUsername",H1="Addresses",Qz="AppVersion";function Hn(t){return t.errorMessage!==void 0}class eH{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),a=16,u=o.slice(o.byteLength-a),l=o.slice(0,o.byteLength-a),d=new Uint8Array(u),p=new Uint8Array(l),y=new Uint8Array([...n,...d,...p]);return L1(y)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=n0(e),a=o.slice(0,12),u=o.slice(12,28),l=o.slice(28),d=new Uint8Array([...l,...u]),p={name:"AES-GCM",iv:new Uint8Array(a)};try{const y=await window.crypto.subtle.decrypt(p,s,d),A=new TextDecoder;n(A.decode(y))}catch(y){i(y)}})()})}}class tH{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}var To;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(To||(To={}));class rH{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,To.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.DISCONNECTED)},i.onopen=s=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(u=>this.sendData(u)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const u=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,u)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,To.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const R5=1e4,nH=6e4;class iH{constructor({session:e,linkAPIUrl:r,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Co(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,u)=>{const l=s[u];l!==void 0&&a(l)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,u)},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(Zz,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(Qz,s)},this.handleChainUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(s),l=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(u,l)},this.session=e,this.cipher=new eH(e.secret),this.listener=n;const i=new rH(`${r}/rpc`,WebSocket);i.setConnectionStateListener(async s=>{let o=!1;switch(s){case To.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(u=>setTimeout(u,5e3)),this.destroyed||i.connect().catch(()=>{a()})};a()}break;case To.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},R5),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case To.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(s=>{var o;switch(s.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=s.type==="IsLinkedOK"?s.linked:void 0;this.linked=a||s.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(s.metadata);break}case"Event":{this.handleIncomingEvent(s);break}}s.id!==void 0&&((o=this.requestResolutions.get(s.id))===null||o===void 0||o(s))}),this.ws=i,this.http=new tH(r,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:s,response:o}=i;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s,o)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Co(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>R5*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r={timeout:nH}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r.timeout)}),new Promise(s=>{this.requestResolutions.set(n,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Co(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Co(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id}),!0)}}class sH{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=f5(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}const D5="session:id",O5="session:secret",N5="session:linked";class Ru{constructor(e,r,n,i=!1){this.storage=e,this.id=r,this.secret=n,this.key=NP(Pg(`${r}, ${n} WalletLink`)),this._linked=!!i}static create(e){const r=lc(16),n=lc(32);return new Ru(e,r,n).save()}static load(e){const r=e.getItem(D5),n=e.getItem(N5),i=e.getItem(O5);return r&&i?new Ru(e,r,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(D5,this.id),this.storage.setItem(O5,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(N5,this._linked?"1":"0")}}function oH(){try{return window.frameElement!==null}catch{return!1}}function aH(){try{return oH()&&window.top?window.top.location:window.location}catch{return window.location}}function cH(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function L5(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const uH='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function k5(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(uH)),document.documentElement.appendChild(t)}function B5(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e2&&(o.children=arguments.length>3?a0.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return c0(t,o,n,i,null)}function c0(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++$5,__i:-1,__u:0};return i==null&&Vr.vnode!=null&&Vr.vnode(s),s}function Ul(t){return t.children}function u0(t,e){this.props=t,this.context=e}function Du(t,e){if(e==null)return t.__?Du(t.__,t.__i+1):null;for(var r;ee&&dc.sort(W1));f0.__r=0}function W5(t,e,r,n,i,s,o,a,u,l,d){var p,y,A,P,N,D,k=n&&n.__k||q5,B=e.length;for(u=lH(r,e,k,u),p=0;p0?c0(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,(u=s.__i=hH(s,r,a,p))!==-1&&(p--,(o=r[u])&&(o.__u|=2)),o==null||o.__v===null?(u==-1&&y--,typeof s.type!="function"&&(s.__u|=4)):u!==a&&(u==a-1?y--:u==a+1?y++:(u>a?y--:y++,s.__u|=4))):s=t.__k[i]=null;if(p)for(i=0;i(u!=null&&!(2&u.__u)?1:0))for(;o>=0||a=0){if((u=e[o])&&!(2&u.__u)&&i==u.key&&s===u.type)return o;o--}if(a=r.__.length&&r.__.push({}),r.__[t]}function o4(t){return tv=1,gH(c4,t)}function gH(t,e,r){var n=s4(h0++,2);if(n.t=t,!n.__c&&(n.__=[c4(void 0,e),function(a){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,a);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=un,!un.u)){var i=function(a,u,l){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(y){return!!y.__c});if(d.every(function(y){return!y.__N}))return!s||s.call(this,a,u,l);var p=n.__c.props!==a;return d.forEach(function(y){if(y.__N){var A=y.__[0];y.__=y.__N,y.__N=void 0,A!==y.__[0]&&(p=!0)}}),s&&s.call(this,a,u,l)||p};un.u=!0;var s=un.shouldComponentUpdate,o=un.componentWillUpdate;un.componentWillUpdate=function(a,u,l){if(this.__e){var d=s;s=void 0,i(a,u,l),s=d}o&&o.call(this,a,u,l)},un.shouldComponentUpdate=i}return n.__N||n.__}function mH(t,e){var r=s4(h0++,3);!yn.__s&&yH(r.__H,e)&&(r.__=t,r.i=e,un.__H.__h.push(r))}function vH(){for(var t;t=Z5.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(d0),t.__H.__h.forEach(rv),t.__H.__h=[]}catch(e){t.__H.__h=[],yn.__e(e,t.__v)}}yn.__b=function(t){un=null,Q5&&Q5(t)},yn.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),i4&&i4(t,e)},yn.__r=function(t){e4&&e4(t),h0=0;var e=(un=t.__c).__H;e&&(ev===un?(e.__h=[],un.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(d0),e.__h.forEach(rv),e.__h=[],h0=0)),ev=un},yn.diffed=function(t){t4&&t4(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Z5.push(e)!==1&&X5===yn.requestAnimationFrame||((X5=yn.requestAnimationFrame)||bH)(vH)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),ev=un=null},yn.__c=function(t,e){e.some(function(r){try{r.__h.forEach(d0),r.__h=r.__h.filter(function(n){return!n.__||rv(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],yn.__e(n,r.__v)}}),r4&&r4(t,e)},yn.unmount=function(t){n4&&n4(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{d0(n)}catch(i){e=i}}),r.__H=void 0,e&&yn.__e(e,r.__v))};var a4=typeof requestAnimationFrame=="function";function bH(t){var e,r=function(){clearTimeout(n),a4&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);a4&&(e=requestAnimationFrame(r))}function d0(t){var e=un,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),un=e}function rv(t){var e=un;t.__c=t.__(),un=e}function yH(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function c4(t,e){return typeof e=="function"?e(t):e}const wH=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",xH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",_H="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class EH{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=L5()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const r=this.nextItemKey++;return this.items.set(r,e),this.render(),()=>{this.items.delete(r),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&Q1(Or("div",null,Or(u4,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,r])=>Or(SH,Object.assign({},r,{key:e}))))),this.root)}}const u4=t=>Or("div",{class:Fl("-cbwsdk-snackbar-container")},Or("style",null,wH),Or("div",{class:"-cbwsdk-snackbar"},t.children)),SH=({autoExpand:t,message:e,menuItems:r})=>{const[n,i]=o4(!0),[s,o]=o4(t??!1);mH(()=>{const u=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{u.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return Or("div",{class:Fl("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},Or("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},Or("img",{src:xH,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",Or("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),Or("div",{class:"-gear-container"},!s&&Or("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),Or("img",{src:_H,class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&Or("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((u,l)=>Or("div",{class:Fl("-cbwsdk-snackbar-instance-menu-item",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:u.onClick,key:l},Or("svg",{width:u.svgWidth,height:u.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("path",{"fill-rule":u.defaultFillRule,"clip-rule":u.defaultClipRule,d:u.path,fill:"#AAAAAA"})),Or("span",{class:Fl("-cbwsdk-snackbar-instance-menu-item-info",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},u.info)))))};class AH{constructor(){this.attached=!1,this.snackbar=new EH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.snackbar.attach(r),this.attached=!0,k5()}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}}const PH=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class MH{constructor(){this.root=null,this.darkMode=L5()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),k5()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(Q1(null,this.root),e&&Q1(Or(IH,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const IH=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return Or(u4,{darkMode:r},Or("div",{class:"-cbwsdk-redirect-dialog"},Or("style",null,PH),Or("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),Or("div",{class:Fl("-cbwsdk-redirect-dialog-box",s)},Or("p",null,t),Or("button",{onClick:n},e))))},CH="https://keys.coinbase.com/connect",f4="https://www.walletlink.org",TH="https://go.cb-w.com/walletlink";class l4{constructor(){this.attached=!1,this.redirectDialog=new MH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const r=new URL(TH);r.searchParams.append("redirect_url",aH().href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class Ro{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=cH(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(H1);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!u&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),Ro.accountRequestCallbackIds.size>0&&(Array.from(Ro.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),Ro.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new sH,this.ui=n,this.ui.attach()}subscribe(){const e=Ru.load(this.storage)||Ru.create(this.storage),{linkAPIUrl:r}=this,n=new iH({session:e,linkAPIUrl:r,listener:this}),i=this.isMobileWeb?new l4:new AH;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=Ru.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Ys.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?Js(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?Js(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Nl(e,!0),chainId:r}})}getWalletLinkSession(){return this._session}sendRequest(e){let r=null;const n=lc(8),i=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,s),r==null||r()};return new Promise((s,o)=>{r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,a=>{if(r==null||r(),Hn(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,r){const n={type:"WEB3_REQUEST",id:e,request:r};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:r.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(r.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof l4)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e,r){if(r.method==="requestEthereumAccounts"){Ro.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,r)),Ro.accountRequestCallbackIds.clear();return}this.invokeCallback(e,r)}handleErrorResponse(e,r,n){var i;const s=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:r,errorMessage:s})}invokeCallback(e,r){const n=this.relayEventManager.callbacks.get(e);n&&(n(r),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:r}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:r}},i=lc(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(Hn(a))return o(new Error(a.errorMessage));s(a)}),Ro.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,r,n,i,s,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:o}};let u=null;const l=lc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));p(A)}),this.publishWeb3RequestEvent(l,a)})}addEthereumChain(e,r,n,i,s,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:o}};let u=null;const l=lc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));p(A)}),this.publishWeb3RequestEvent(l,a)})}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})};let i=null;const s=lc(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,u)=>{this.relayEventManager.callbacks.set(s,l=>{if(i==null||i(),Hn(l)&&l.errorCode)return u(Sr.provider.custom({code:l.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(Hn(l))return u(new Error(l.errorMessage));a(l)}),this.publishWeb3RequestEvent(s,n)})}}Ro.accountRequestCallbackIds=new Set;const h4="DefaultChainId",d4="DefaultJsonRpcUrl";class p4{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new Ys("walletlink",f4),this.callback=e.callback||null;const r=this._storage.getItem(H1);if(r){const n=r.split(" ");n[0]!==""&&(this._addresses=n.map(i=>ga(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:r,secret:n}=e.getWalletLinkSession();return{id:r,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(d4))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(d4,e)}updateProviderInfo(e,r){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(h4,r.toString(10)),Ll(r)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",pa(r)))}async watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw Sr.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw Sr.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw Sr.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw Sr.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=r.options,l=await this.initializeRelay().watchAsset(r.type,i,s,a,o,n==null?void 0:n.toString());return Hn(l)?!1:!!l.result}async addEthereumChain(e){var r,n;const i=e[0];if(((r=i.rpcUrls)===null||r===void 0?void 0:r.length)===0)throw Sr.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw Sr.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw Sr.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:u=[],chainName:l,iconUrls:d=[],nativeCurrency:p}=i,y=await o.addEthereumChain(s.toString(),a,d,u,l,p);if(Hn(y))return!1;if(((n=y.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw Sr.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const r=e[0],n=Number.parseInt(r.chainId,16),s=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(Hn(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,r){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(s=>ga(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(H1,i.join(" ")))}async request(e){const r=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return pa(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(r);case"wallet_switchEthereumChain":return this.switchEthereumChain(r);case"wallet_watchAsset":return this.watchAsset(r);default:if(!this.jsonRpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const r=ga(e);if(!this._addresses.map(i=>ga(i)).includes(r))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?ga(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?ga(e.to):null,i=e.value!=null?kl(e.value):BigInt(0),s=e.data?F1(e.data):Buffer.alloc(0),o=e.nonce!=null?Ll(e.nonce):null,a=e.gasPrice!=null?kl(e.gasPrice):null,u=e.maxFeePerGas!=null?kl(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?kl(e.maxPriorityFeePerGas):null,d=e.gas!=null?kl(e.gas):null,p=e.chainId?Ll(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:u,maxPriorityFeePerGas:l,gasLimit:d,chainId:p}}async ecRecover(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:k1(n[0]),signature:k1(n[1]),addPrefix:r==="personal_ecRecover"}});if(Hn(s))throw s;return s.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(h4))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,r;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:pa(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(Hn(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:pa(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw Sr.rpc.invalidParams();const r=e[1],n=e[0];this._ensureKnownAddress(r);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ga(r),message:k1(n),addPrefix:!0,typedDataJson:null}});if(Hn(s))throw s;return s.result}async _eth_signTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(r);if(Hn(i))throw i;return i.result}async _eth_sendRawTransaction(e){const r=F1(e[0]),i=await this.initializeRelay().submitEthereumTransaction(r,this.getChainId());if(Hn(i))throw i;return i.result}async _eth_sendTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(r);if(Hn(i))throw i;return i.result}async signTypedData(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const i=l=>{const d={eth_signTypedData_v1:o0.hashForSignTypedDataLegacy,eth_signTypedData_v3:o0.hashForSignTypedData_v3,eth_signTypedData_v4:o0.hashForSignTypedData_v4,eth_signTypedData:o0.hashForSignTypedData_v4};return Nl(d[r]({data:Ez(l)}),!0)},s=n[r==="eth_signTypedData_v1"?1:0],o=n[r==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const u=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ga(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(Hn(u))throw u;return u.result}initializeRelay(){return this._relay||(this._relay=new Ro({linkAPIUrl:f4,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const g4="SignerType",m4=new Ys("CBWSDK","SignerConfigurator");function RH(){return m4.getItem(g4)}function DH(t){m4.setItem(g4,t)}async function OH(t){const{communicator:e,metadata:r,handshakeRequest:n,callback:i}=t;LH(e,r,i).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:o}=await e.postRequestAndWaitForResponse(s);return o}function NH(t){const{signerType:e,metadata:r,communicator:n,callback:i}=t;switch(e){case"scw":return new kz({metadata:r,callback:i,communicator:n});case"walletlink":return new p4({metadata:r,callback:i})}}async function LH(t,e,r){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new p4({metadata:e,callback:r});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const kH=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. -Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,BH=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,r=await fetch(e,{method:"HEAD"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const n=r.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(kH)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:$H,getCrossOriginOpenerPolicy:FH}=BH(),v4=420,b4=540;function jH(t){const e=(window.innerWidth-v4)/2+window.screenX,r=(window.innerHeight-b4)/2+window.screenY;qH(t);const n=window.open(t,"Smart Wallet",`width=${v4}, height=${b4}, left=${e}, top=${r}`);if(n==null||n.focus(),!n)throw Sr.rpc.internal("Pop up window failed to open");return n}function UH(t){t&&!t.closed&&t.close()}function qH(t){const e={sdkName:p5,sdkVersion:Bl,origin:window.location.origin,coop:FH()};for(const[r,n]of Object.entries(e))t.searchParams.append(r,n.toString())}class zH{constructor({url:e=CH,metadata:r,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=u=>{if(u.origin!==this.url.origin)return;const l=u.data;i(l)&&(s(l),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{UH(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(Sr.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=jH(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:Bl,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw Sr.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=r,this.preference=n}}function HH(t){const e=bz(WH(t),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",Bl),r.searchParams.set("code",e.code.toString()),r.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:r.href})}function WH(t){var e;if(typeof t=="string")return{message:t,code:cn.rpc.internal};if(Hn(t)){const r=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:r.match(/(denied|rejected)/i)?cn.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:r,code:n,data:{method:t.method}})}return t}var y4={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,l,d){this.fn=u,this.context=l,this.once=d||!1}function s(u,l,d,g,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var A=new i(d,g||u,y),P=r?r+l:l;return u._events[P]?u._events[P].fn?u._events[P]=[u._events[P],A]:u._events[P].push(A):(u._events[P]=A,u._eventsCount++),u}function o(u,l){--u._eventsCount===0?u._events=new n:delete u._events[l]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,g;if(this._eventsCount===0)return l;for(g in d=this._events)e.call(d,g)&&l.push(r?g.slice(1):g);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=r?r+l:l,g=this._events[d];if(!g)return[];if(g.fn)return[g.fn];for(var y=0,A=g.length,P=new Array(A);y(i||(i=ZH(n)),i)}}function w4(t,e){return function(){return t.apply(e,arguments)}}const{toString:tW}=Object.prototype,{getPrototypeOf:nv}=Object,p0=(t=>e=>{const r=tW.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Es=t=>(t=t.toLowerCase(),e=>p0(e)===t),g0=t=>e=>typeof e===t,{isArray:Ou}=Array,ql=g0("undefined");function rW(t){return t!==null&&!ql(t)&&t.constructor!==null&&!ql(t.constructor)&&Oi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const x4=Es("ArrayBuffer");function nW(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&x4(t.buffer),e}const iW=g0("string"),Oi=g0("function"),_4=g0("number"),m0=t=>t!==null&&typeof t=="object",sW=t=>t===!0||t===!1,v0=t=>{if(p0(t)!=="object")return!1;const e=nv(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},oW=Es("Date"),aW=Es("File"),cW=Es("Blob"),uW=Es("FileList"),fW=t=>m0(t)&&Oi(t.pipe),lW=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Oi(t.append)&&((e=p0(t))==="formdata"||e==="object"&&Oi(t.toString)&&t.toString()==="[object FormData]"))},hW=Es("URLSearchParams"),[dW,pW,gW,mW]=["ReadableStream","Request","Response","Headers"].map(Es),vW=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function zl(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Ou(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const pc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,S4=t=>!ql(t)&&t!==pc;function iv(){const{caseless:t}=S4(this)&&this||{},e={},r=(n,i)=>{const s=t&&E4(e,i)||i;v0(e[s])&&v0(n)?e[s]=iv(e[s],n):v0(n)?e[s]=iv({},n):Ou(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(zl(e,(i,s)=>{r&&Oi(i)?t[s]=w4(i,r):t[s]=i},{allOwnKeys:n}),t),yW=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),wW=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},xW=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&nv(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},_W=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},EW=t=>{if(!t)return null;if(Ou(t))return t;let e=t.length;if(!_4(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},SW=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&nv(Uint8Array)),AW=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},PW=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},MW=Es("HTMLFormElement"),IW=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),A4=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),CW=Es("RegExp"),P4=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};zl(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},TW=t=>{P4(t,(e,r)=>{if(Oi(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Oi(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},RW=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Ou(t)?n(t):n(String(t).split(e)),r},DW=()=>{},OW=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,sv="abcdefghijklmnopqrstuvwxyz",M4="0123456789",I4={DIGIT:M4,ALPHA:sv,ALPHA_DIGIT:sv+sv.toUpperCase()+M4},NW=(t=16,e=I4.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function LW(t){return!!(t&&Oi(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const kW=t=>{const e=new Array(10),r=(n,i)=>{if(m0(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Ou(n)?[]:{};return zl(n,(o,a)=>{const u=r(o,i+1);!ql(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},BW=Es("AsyncFunction"),$W=t=>t&&(m0(t)||Oi(t))&&Oi(t.then)&&Oi(t.catch),C4=((t,e)=>t?setImmediate:e?((r,n)=>(pc.addEventListener("message",({source:i,data:s})=>{i===pc&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),pc.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Oi(pc.postMessage)),FW=typeof queueMicrotask<"u"?queueMicrotask.bind(pc):typeof process<"u"&&process.nextTick||C4,Oe={isArray:Ou,isArrayBuffer:x4,isBuffer:rW,isFormData:lW,isArrayBufferView:nW,isString:iW,isNumber:_4,isBoolean:sW,isObject:m0,isPlainObject:v0,isReadableStream:dW,isRequest:pW,isResponse:gW,isHeaders:mW,isUndefined:ql,isDate:oW,isFile:aW,isBlob:cW,isRegExp:CW,isFunction:Oi,isStream:fW,isURLSearchParams:hW,isTypedArray:SW,isFileList:uW,forEach:zl,merge:iv,extend:bW,trim:vW,stripBOM:yW,inherits:wW,toFlatObject:xW,kindOf:p0,kindOfTest:Es,endsWith:_W,toArray:EW,forEachEntry:AW,matchAll:PW,isHTMLForm:MW,hasOwnProperty:A4,hasOwnProp:A4,reduceDescriptors:P4,freezeMethods:TW,toObjectSet:RW,toCamelCase:IW,noop:DW,toFiniteNumber:OW,findKey:E4,global:pc,isContextDefined:S4,ALPHABET:I4,generateString:NW,isSpecCompliantForm:LW,toJSONObject:kW,isAsyncFn:BW,isThenable:$W,setImmediate:C4,asap:FW};function ar(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Oe.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const T4=ar.prototype,R4={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{R4[t]={value:t}}),Object.defineProperties(ar,R4),Object.defineProperty(T4,"isAxiosError",{value:!0}),ar.from=(t,e,r,n,i,s)=>{const o=Object.create(T4);return Oe.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),ar.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const jW=null;function ov(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function D4(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function O4(t,e,r){return t?t.concat(e).map(function(i,s){return i=D4(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function UW(t){return Oe.isArray(t)&&!t.some(ov)}const qW=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function b0(t,e,r){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Oe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(N,D){return!Oe.isUndefined(D[N])});const n=r.metaTokens,i=r.visitor||d,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(i))throw new TypeError("visitor must be a function");function l(P){if(P===null)return"";if(Oe.isDate(P))return P.toISOString();if(!u&&Oe.isBlob(P))throw new ar("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(P)||Oe.isTypedArray(P)?u&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function d(P,N,D){let k=P;if(P&&!D&&typeof P=="object"){if(Oe.endsWith(N,"{}"))N=n?N:N.slice(0,-2),P=JSON.stringify(P);else if(Oe.isArray(P)&&UW(P)||(Oe.isFileList(P)||Oe.endsWith(N,"[]"))&&(k=Oe.toArray(P)))return N=D4(N),k.forEach(function(j,U){!(Oe.isUndefined(j)||j===null)&&e.append(o===!0?O4([N],U,s):o===null?N:N+"[]",l(j))}),!1}return ov(P)?!0:(e.append(O4(D,N,s),l(P)),!1)}const g=[],y=Object.assign(qW,{defaultVisitor:d,convertValue:l,isVisitable:ov});function A(P,N){if(!Oe.isUndefined(P)){if(g.indexOf(P)!==-1)throw Error("Circular reference detected in "+N.join("."));g.push(P),Oe.forEach(P,function(k,B){(!(Oe.isUndefined(k)||k===null)&&i.call(e,k,Oe.isString(B)?B.trim():B,N,y))===!0&&A(k,N?N.concat(B):[B])}),g.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return A(t),e}function N4(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function av(t,e){this._pairs=[],t&&b0(t,this,e)}const L4=av.prototype;L4.append=function(e,r){this._pairs.push([e,r])},L4.toString=function(e){const r=e?function(n){return e.call(this,n,N4)}:N4;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function zW(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function k4(t,e,r){if(!e)return t;const n=r&&r.encode||zW;Oe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(e,r):s=Oe.isURLSearchParams(e)?e.toString():new av(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class B4{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(n){n!==null&&e(n)})}}const $4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},HW={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:av,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},cv=typeof window<"u"&&typeof document<"u",uv=typeof navigator=="object"&&navigator||void 0,WW=cv&&(!uv||["ReactNative","NativeScript","NS"].indexOf(uv.product)<0),KW=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",VW=cv&&window.location.href||"http://localhost",Xn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:cv,hasStandardBrowserEnv:WW,hasStandardBrowserWebWorkerEnv:KW,navigator:uv,origin:VW},Symbol.toStringTag,{value:"Module"})),...HW};function GW(t,e){return b0(t,new Xn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Xn.isNode&&Oe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function YW(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function JW(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&Oe.isArray(i)?i.length:o,u?(Oe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Oe.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Oe.isArray(i[o])&&(i[o]=JW(i[o])),!a)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const r={};return Oe.forEachEntry(t,(n,i)=>{e(YW(n),i,r,0)}),r}return null}function XW(t,e,r){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const Hl={transitional:$4,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Oe.isObject(e);if(s&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return i?JSON.stringify(F4(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return GW(e,this.formSerializer).toString();if((a=Oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return b0(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),XW(e)):e}],transformResponse:[function(e){const r=this.transitional||Hl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ar.from(a,ar.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xn.classes.FormData,Blob:Xn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{Hl.headers[t]={}});const ZW=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),QW=t=>{const e={};let r,n,i;return t&&t.split(` -`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&ZW[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},j4=Symbol("internals");function Wl(t){return t&&String(t).trim().toLowerCase()}function y0(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(y0):String(t)}function eK(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const tK=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function fv(t,e,r,n,i){if(Oe.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Oe.isString(e)){if(Oe.isString(n))return e.indexOf(n)!==-1;if(Oe.isRegExp(n))return n.test(e)}}function rK(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function nK(t,e){const r=Oe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}let wi=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,u,l){const d=Wl(u);if(!d)throw new Error("header name must be a non-empty string");const g=Oe.findKey(i,d);(!g||i[g]===void 0||l===!0||l===void 0&&i[g]!==!1)&&(i[g||u]=y0(a))}const o=(a,u)=>Oe.forEach(a,(l,d)=>s(l,d,u));if(Oe.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(Oe.isString(e)&&(e=e.trim())&&!tK(e))o(QW(e),r);else if(Oe.isHeaders(e))for(const[a,u]of e.entries())s(u,a,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return eK(i);if(Oe.isFunction(r))return r.call(this,i,n);if(Oe.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||fv(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=Wl(o),o){const a=Oe.findKey(n,o);a&&(!r||fv(n,n[a],a,r))&&(delete n[a],i=!0)}}return Oe.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||fv(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Oe.forEach(this,(i,s)=>{const o=Oe.findKey(n,s);if(o){r[o]=y0(i),delete r[s];return}const a=e?rK(s):String(s).trim();a!==s&&delete r[s],r[a]=y0(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Oe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Oe.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[j4]=this[j4]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Wl(o);n[a]||(nK(i,o),n[a]=!0)}return Oe.isArray(e)?e.forEach(s):s(e),this}};wi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Oe.reduceDescriptors(wi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),Oe.freezeMethods(wi);function lv(t,e){const r=this||Hl,n=e||r,i=wi.from(n.headers);let s=n.data;return Oe.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function U4(t){return!!(t&&t.__CANCEL__)}function Nu(t,e,r){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,r),this.name="CanceledError"}Oe.inherits(Nu,ar,{__CANCEL__:!0});function q4(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new ar("Request failed with status code "+r.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function iK(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function sK(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),d=n[s];o||(o=l),r[i]=u,n[i]=l;let g=s,y=0;for(;g!==i;)y+=r[g++],g=g%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),l-o{r=d,i=null,s&&(clearTimeout(s),s=null),t.apply(null,l)};return[(...l)=>{const d=Date.now(),g=d-r;g>=n?o(l,d):(i=l,s||(s=setTimeout(()=>{s=null,o(i)},n-g)))},()=>i&&o(i)]}const w0=(t,e,r=3)=>{let n=0;const i=sK(50,250);return oK(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,u=o-n,l=i(u),d=o<=a;n=o;const g={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:l||void 0,estimated:l&&a&&d?(a-o)/l:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(g)},r)},z4=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},H4=t=>(...e)=>Oe.asap(()=>t(...e)),aK=Xn.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Xn.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Xn.origin),Xn.navigator&&/(msie|trident)/i.test(Xn.navigator.userAgent)):()=>!0,cK=Xn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];Oe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Oe.isString(n)&&o.push("path="+n),Oe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function uK(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function fK(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function W4(t,e){return t&&!uK(e)?fK(t,e):e}const K4=t=>t instanceof wi?{...t}:t;function gc(t,e){e=e||{};const r={};function n(l,d,g,y){return Oe.isPlainObject(l)&&Oe.isPlainObject(d)?Oe.merge.call({caseless:y},l,d):Oe.isPlainObject(d)?Oe.merge({},d):Oe.isArray(d)?d.slice():d}function i(l,d,g,y){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l,g,y)}else return n(l,d,g,y)}function s(l,d){if(!Oe.isUndefined(d))return n(void 0,d)}function o(l,d){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l)}else return n(void 0,d)}function a(l,d,g){if(g in e)return n(l,d);if(g in t)return n(void 0,l)}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,d,g)=>i(K4(l),K4(d),g,!0)};return Oe.forEach(Object.keys(Object.assign({},t,e)),function(d){const g=u[d]||i,y=g(t[d],e[d],d);Oe.isUndefined(y)&&g!==a||(r[d]=y)}),r}const V4=t=>{const e=gc({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=wi.from(o),e.url=k4(W4(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(Oe.isFormData(r)){if(Xn.hasStandardBrowserEnv||Xn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[l,...d]=u?u.split(";").map(g=>g.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...d].join("; "))}}if(Xn.hasStandardBrowserEnv&&(n&&Oe.isFunction(n)&&(n=n(e)),n||n!==!1&&aK(e.url))){const l=i&&s&&cK.read(s);l&&o.set(i,l)}return e},lK=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=V4(t);let s=i.data;const o=wi.from(i.headers).normalize();let{responseType:a,onUploadProgress:u,onDownloadProgress:l}=i,d,g,y,A,P;function N(){A&&A(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let D=new XMLHttpRequest;D.open(i.method.toUpperCase(),i.url,!0),D.timeout=i.timeout;function k(){if(!D)return;const j=wi.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),K={data:!a||a==="text"||a==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:j,config:t,request:D};q4(function(T){r(T),N()},function(T){n(T),N()},K),D=null}"onloadend"in D?D.onloadend=k:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(k)},D.onabort=function(){D&&(n(new ar("Request aborted",ar.ECONNABORTED,t,D)),D=null)},D.onerror=function(){n(new ar("Network Error",ar.ERR_NETWORK,t,D)),D=null},D.ontimeout=function(){let U=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const K=i.transitional||$4;i.timeoutErrorMessage&&(U=i.timeoutErrorMessage),n(new ar(U,K.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,D)),D=null},s===void 0&&o.setContentType(null),"setRequestHeader"in D&&Oe.forEach(o.toJSON(),function(U,K){D.setRequestHeader(K,U)}),Oe.isUndefined(i.withCredentials)||(D.withCredentials=!!i.withCredentials),a&&a!=="json"&&(D.responseType=i.responseType),l&&([y,P]=w0(l,!0),D.addEventListener("progress",y)),u&&D.upload&&([g,A]=w0(u),D.upload.addEventListener("progress",g),D.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(d=j=>{D&&(n(!j||j.type?new Nu(null,t,D):j),D.abort(),D=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const B=iK(i.url);if(B&&Xn.protocols.indexOf(B)===-1){n(new ar("Unsupported protocol "+B+":",ar.ERR_BAD_REQUEST,t));return}D.send(s||null)})},hK=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i;const s=function(l){if(!i){i=!0,a();const d=l instanceof Error?l:this.reason;n.abort(d instanceof ar?d:new Nu(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,s(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),t=null)};t.forEach(l=>l.addEventListener("abort",s));const{signal:u}=n;return u.unsubscribe=()=>Oe.asap(a),u}},dK=function*(t,e){let r=t.byteLength;if(r{const i=pK(t,e);let s=0,o,a=u=>{o||(o=!0,n&&n(u))};return new ReadableStream({async pull(u){try{const{done:l,value:d}=await i.next();if(l){a(),u.close();return}let g=d.byteLength;if(r){let y=s+=g;r(y)}u.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(u){return a(u),i.return()}},{highWaterMark:2})},x0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Y4=x0&&typeof ReadableStream=="function",mK=x0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),J4=(t,...e)=>{try{return!!t(...e)}catch{return!1}},vK=Y4&&J4(()=>{let t=!1;const e=new Request(Xn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),X4=64*1024,hv=Y4&&J4(()=>Oe.isReadableStream(new Response("").body)),_0={stream:hv&&(t=>t.body)};x0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!_0[e]&&(_0[e]=Oe.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,n)})})})(new Response);const bK=async t=>{if(t==null)return 0;if(Oe.isBlob(t))return t.size;if(Oe.isSpecCompliantForm(t))return(await new Request(Xn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(t)||Oe.isArrayBuffer(t))return t.byteLength;if(Oe.isURLSearchParams(t)&&(t=t+""),Oe.isString(t))return(await mK(t)).byteLength},yK=async(t,e)=>{const r=Oe.toFiniteNumber(t.getContentLength());return r??bK(e)},dv={http:jW,xhr:lK,fetch:x0&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:l,headers:d,withCredentials:g="same-origin",fetchOptions:y}=V4(t);l=l?(l+"").toLowerCase():"text";let A=hK([i,s&&s.toAbortSignal()],o),P;const N=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let D;try{if(u&&vK&&r!=="get"&&r!=="head"&&(D=await yK(d,n))!==0){let K=new Request(e,{method:"POST",body:n,duplex:"half"}),J;if(Oe.isFormData(n)&&(J=K.headers.get("content-type"))&&d.setContentType(J),K.body){const[T,z]=z4(D,w0(H4(u)));n=G4(K.body,X4,T,z)}}Oe.isString(g)||(g=g?"include":"omit");const k="credentials"in Request.prototype;P=new Request(e,{...y,signal:A,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:k?g:void 0});let B=await fetch(P);const j=hv&&(l==="stream"||l==="response");if(hv&&(a||j&&N)){const K={};["status","statusText","headers"].forEach(ue=>{K[ue]=B[ue]});const J=Oe.toFiniteNumber(B.headers.get("content-length")),[T,z]=a&&z4(J,w0(H4(a),!0))||[];B=new Response(G4(B.body,X4,T,()=>{z&&z(),N&&N()}),K)}l=l||"text";let U=await _0[Oe.findKey(_0,l)||"text"](B,t);return!j&&N&&N(),await new Promise((K,J)=>{q4(K,J,{data:U,headers:wi.from(B.headers),status:B.status,statusText:B.statusText,config:t,request:P})})}catch(k){throw N&&N(),k&&k.name==="TypeError"&&/fetch/i.test(k.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,P),{cause:k.cause||k}):ar.from(k,k&&k.code,t,P)}})};Oe.forEach(dv,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Z4=t=>`- ${t}`,wK=t=>Oe.isFunction(t)||t===null||t===!1,Q4={getAdapter:t=>{t=Oe.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : +Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,BH=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,r=await fetch(e,{method:"HEAD"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const n=r.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(kH)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:$H,getCrossOriginOpenerPolicy:FH}=BH(),v4=420,b4=540;function jH(t){const e=(window.innerWidth-v4)/2+window.screenX,r=(window.innerHeight-b4)/2+window.screenY;qH(t);const n=window.open(t,"Smart Wallet",`width=${v4}, height=${b4}, left=${e}, top=${r}`);if(n==null||n.focus(),!n)throw Sr.rpc.internal("Pop up window failed to open");return n}function UH(t){t&&!t.closed&&t.close()}function qH(t){const e={sdkName:p5,sdkVersion:Bl,origin:window.location.origin,coop:FH()};for(const[r,n]of Object.entries(e))t.searchParams.append(r,n.toString())}class zH{constructor({url:e=CH,metadata:r,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=u=>{if(u.origin!==this.url.origin)return;const l=u.data;i(l)&&(s(l),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{UH(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(Sr.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=jH(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:Bl,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw Sr.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=r,this.preference=n}}function HH(t){const e=bz(WH(t),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",Bl),r.searchParams.set("code",e.code.toString()),r.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:r.href})}function WH(t){var e;if(typeof t=="string")return{message:t,code:cn.rpc.internal};if(Hn(t)){const r=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:r.match(/(denied|rejected)/i)?cn.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:r,code:n,data:{method:t.method}})}return t}var y4={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,l,d){this.fn=u,this.context=l,this.once=d||!1}function s(u,l,d,p,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var A=new i(d,p||u,y),P=r?r+l:l;return u._events[P]?u._events[P].fn?u._events[P]=[u._events[P],A]:u._events[P].push(A):(u._events[P]=A,u._eventsCount++),u}function o(u,l){--u._eventsCount===0?u._events=new n:delete u._events[l]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,p;if(this._eventsCount===0)return l;for(p in d=this._events)e.call(d,p)&&l.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=r?r+l:l,p=this._events[d];if(!p)return[];if(p.fn)return[p.fn];for(var y=0,A=p.length,P=new Array(A);y(i||(i=ZH(n)),i)}}function w4(t,e){return function(){return t.apply(e,arguments)}}const{toString:tW}=Object.prototype,{getPrototypeOf:nv}=Object,p0=(t=>e=>{const r=tW.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Es=t=>(t=t.toLowerCase(),e=>p0(e)===t),g0=t=>e=>typeof e===t,{isArray:Ou}=Array,ql=g0("undefined");function rW(t){return t!==null&&!ql(t)&&t.constructor!==null&&!ql(t.constructor)&&Oi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const x4=Es("ArrayBuffer");function nW(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&x4(t.buffer),e}const iW=g0("string"),Oi=g0("function"),_4=g0("number"),m0=t=>t!==null&&typeof t=="object",sW=t=>t===!0||t===!1,v0=t=>{if(p0(t)!=="object")return!1;const e=nv(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},oW=Es("Date"),aW=Es("File"),cW=Es("Blob"),uW=Es("FileList"),fW=t=>m0(t)&&Oi(t.pipe),lW=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Oi(t.append)&&((e=p0(t))==="formdata"||e==="object"&&Oi(t.toString)&&t.toString()==="[object FormData]"))},hW=Es("URLSearchParams"),[dW,pW,gW,mW]=["ReadableStream","Request","Response","Headers"].map(Es),vW=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function zl(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Ou(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const pc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,S4=t=>!ql(t)&&t!==pc;function iv(){const{caseless:t}=S4(this)&&this||{},e={},r=(n,i)=>{const s=t&&E4(e,i)||i;v0(e[s])&&v0(n)?e[s]=iv(e[s],n):v0(n)?e[s]=iv({},n):Ou(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(zl(e,(i,s)=>{r&&Oi(i)?t[s]=w4(i,r):t[s]=i},{allOwnKeys:n}),t),yW=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),wW=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},xW=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&nv(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},_W=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},EW=t=>{if(!t)return null;if(Ou(t))return t;let e=t.length;if(!_4(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},SW=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&nv(Uint8Array)),AW=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},PW=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},MW=Es("HTMLFormElement"),IW=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),A4=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),CW=Es("RegExp"),P4=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};zl(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},TW=t=>{P4(t,(e,r)=>{if(Oi(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Oi(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},RW=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Ou(t)?n(t):n(String(t).split(e)),r},DW=()=>{},OW=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,sv="abcdefghijklmnopqrstuvwxyz",M4="0123456789",I4={DIGIT:M4,ALPHA:sv,ALPHA_DIGIT:sv+sv.toUpperCase()+M4},NW=(t=16,e=I4.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function LW(t){return!!(t&&Oi(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const kW=t=>{const e=new Array(10),r=(n,i)=>{if(m0(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Ou(n)?[]:{};return zl(n,(o,a)=>{const u=r(o,i+1);!ql(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},BW=Es("AsyncFunction"),$W=t=>t&&(m0(t)||Oi(t))&&Oi(t.then)&&Oi(t.catch),C4=((t,e)=>t?setImmediate:e?((r,n)=>(pc.addEventListener("message",({source:i,data:s})=>{i===pc&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),pc.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Oi(pc.postMessage)),FW=typeof queueMicrotask<"u"?queueMicrotask.bind(pc):typeof process<"u"&&process.nextTick||C4,Oe={isArray:Ou,isArrayBuffer:x4,isBuffer:rW,isFormData:lW,isArrayBufferView:nW,isString:iW,isNumber:_4,isBoolean:sW,isObject:m0,isPlainObject:v0,isReadableStream:dW,isRequest:pW,isResponse:gW,isHeaders:mW,isUndefined:ql,isDate:oW,isFile:aW,isBlob:cW,isRegExp:CW,isFunction:Oi,isStream:fW,isURLSearchParams:hW,isTypedArray:SW,isFileList:uW,forEach:zl,merge:iv,extend:bW,trim:vW,stripBOM:yW,inherits:wW,toFlatObject:xW,kindOf:p0,kindOfTest:Es,endsWith:_W,toArray:EW,forEachEntry:AW,matchAll:PW,isHTMLForm:MW,hasOwnProperty:A4,hasOwnProp:A4,reduceDescriptors:P4,freezeMethods:TW,toObjectSet:RW,toCamelCase:IW,noop:DW,toFiniteNumber:OW,findKey:E4,global:pc,isContextDefined:S4,ALPHABET:I4,generateString:NW,isSpecCompliantForm:LW,toJSONObject:kW,isAsyncFn:BW,isThenable:$W,setImmediate:C4,asap:FW};function ar(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Oe.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const T4=ar.prototype,R4={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{R4[t]={value:t}}),Object.defineProperties(ar,R4),Object.defineProperty(T4,"isAxiosError",{value:!0}),ar.from=(t,e,r,n,i,s)=>{const o=Object.create(T4);return Oe.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),ar.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const jW=null;function ov(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function D4(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function O4(t,e,r){return t?t.concat(e).map(function(i,s){return i=D4(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function UW(t){return Oe.isArray(t)&&!t.some(ov)}const qW=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function b0(t,e,r){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Oe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(N,D){return!Oe.isUndefined(D[N])});const n=r.metaTokens,i=r.visitor||d,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(i))throw new TypeError("visitor must be a function");function l(P){if(P===null)return"";if(Oe.isDate(P))return P.toISOString();if(!u&&Oe.isBlob(P))throw new ar("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(P)||Oe.isTypedArray(P)?u&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function d(P,N,D){let k=P;if(P&&!D&&typeof P=="object"){if(Oe.endsWith(N,"{}"))N=n?N:N.slice(0,-2),P=JSON.stringify(P);else if(Oe.isArray(P)&&UW(P)||(Oe.isFileList(P)||Oe.endsWith(N,"[]"))&&(k=Oe.toArray(P)))return N=D4(N),k.forEach(function(j,U){!(Oe.isUndefined(j)||j===null)&&e.append(o===!0?O4([N],U,s):o===null?N:N+"[]",l(j))}),!1}return ov(P)?!0:(e.append(O4(D,N,s),l(P)),!1)}const p=[],y=Object.assign(qW,{defaultVisitor:d,convertValue:l,isVisitable:ov});function A(P,N){if(!Oe.isUndefined(P)){if(p.indexOf(P)!==-1)throw Error("Circular reference detected in "+N.join("."));p.push(P),Oe.forEach(P,function(k,B){(!(Oe.isUndefined(k)||k===null)&&i.call(e,k,Oe.isString(B)?B.trim():B,N,y))===!0&&A(k,N?N.concat(B):[B])}),p.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return A(t),e}function N4(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function av(t,e){this._pairs=[],t&&b0(t,this,e)}const L4=av.prototype;L4.append=function(e,r){this._pairs.push([e,r])},L4.toString=function(e){const r=e?function(n){return e.call(this,n,N4)}:N4;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function zW(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function k4(t,e,r){if(!e)return t;const n=r&&r.encode||zW;Oe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(e,r):s=Oe.isURLSearchParams(e)?e.toString():new av(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class B4{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(n){n!==null&&e(n)})}}const $4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},HW={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:av,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},cv=typeof window<"u"&&typeof document<"u",uv=typeof navigator=="object"&&navigator||void 0,WW=cv&&(!uv||["ReactNative","NativeScript","NS"].indexOf(uv.product)<0),KW=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",VW=cv&&window.location.href||"http://localhost",Xn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:cv,hasStandardBrowserEnv:WW,hasStandardBrowserWebWorkerEnv:KW,navigator:uv,origin:VW},Symbol.toStringTag,{value:"Module"})),...HW};function GW(t,e){return b0(t,new Xn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Xn.isNode&&Oe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function YW(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function JW(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&Oe.isArray(i)?i.length:o,u?(Oe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Oe.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Oe.isArray(i[o])&&(i[o]=JW(i[o])),!a)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const r={};return Oe.forEachEntry(t,(n,i)=>{e(YW(n),i,r,0)}),r}return null}function XW(t,e,r){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const Hl={transitional:$4,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Oe.isObject(e);if(s&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return i?JSON.stringify(F4(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return GW(e,this.formSerializer).toString();if((a=Oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return b0(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),XW(e)):e}],transformResponse:[function(e){const r=this.transitional||Hl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ar.from(a,ar.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xn.classes.FormData,Blob:Xn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{Hl.headers[t]={}});const ZW=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),QW=t=>{const e={};let r,n,i;return t&&t.split(` +`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&ZW[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},j4=Symbol("internals");function Wl(t){return t&&String(t).trim().toLowerCase()}function y0(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(y0):String(t)}function eK(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const tK=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function fv(t,e,r,n,i){if(Oe.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Oe.isString(e)){if(Oe.isString(n))return e.indexOf(n)!==-1;if(Oe.isRegExp(n))return n.test(e)}}function rK(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function nK(t,e){const r=Oe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}let wi=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,u,l){const d=Wl(u);if(!d)throw new Error("header name must be a non-empty string");const p=Oe.findKey(i,d);(!p||i[p]===void 0||l===!0||l===void 0&&i[p]!==!1)&&(i[p||u]=y0(a))}const o=(a,u)=>Oe.forEach(a,(l,d)=>s(l,d,u));if(Oe.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(Oe.isString(e)&&(e=e.trim())&&!tK(e))o(QW(e),r);else if(Oe.isHeaders(e))for(const[a,u]of e.entries())s(u,a,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return eK(i);if(Oe.isFunction(r))return r.call(this,i,n);if(Oe.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||fv(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=Wl(o),o){const a=Oe.findKey(n,o);a&&(!r||fv(n,n[a],a,r))&&(delete n[a],i=!0)}}return Oe.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||fv(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Oe.forEach(this,(i,s)=>{const o=Oe.findKey(n,s);if(o){r[o]=y0(i),delete r[s];return}const a=e?rK(s):String(s).trim();a!==s&&delete r[s],r[a]=y0(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Oe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Oe.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[j4]=this[j4]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Wl(o);n[a]||(nK(i,o),n[a]=!0)}return Oe.isArray(e)?e.forEach(s):s(e),this}};wi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Oe.reduceDescriptors(wi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),Oe.freezeMethods(wi);function lv(t,e){const r=this||Hl,n=e||r,i=wi.from(n.headers);let s=n.data;return Oe.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function U4(t){return!!(t&&t.__CANCEL__)}function Nu(t,e,r){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,r),this.name="CanceledError"}Oe.inherits(Nu,ar,{__CANCEL__:!0});function q4(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new ar("Request failed with status code "+r.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function iK(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function sK(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),d=n[s];o||(o=l),r[i]=u,n[i]=l;let p=s,y=0;for(;p!==i;)y+=r[p++],p=p%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),l-o{r=d,i=null,s&&(clearTimeout(s),s=null),t.apply(null,l)};return[(...l)=>{const d=Date.now(),p=d-r;p>=n?o(l,d):(i=l,s||(s=setTimeout(()=>{s=null,o(i)},n-p)))},()=>i&&o(i)]}const w0=(t,e,r=3)=>{let n=0;const i=sK(50,250);return oK(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,u=o-n,l=i(u),d=o<=a;n=o;const p={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:l||void 0,estimated:l&&a&&d?(a-o)/l:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(p)},r)},z4=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},H4=t=>(...e)=>Oe.asap(()=>t(...e)),aK=Xn.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Xn.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Xn.origin),Xn.navigator&&/(msie|trident)/i.test(Xn.navigator.userAgent)):()=>!0,cK=Xn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];Oe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Oe.isString(n)&&o.push("path="+n),Oe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function uK(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function fK(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function W4(t,e){return t&&!uK(e)?fK(t,e):e}const K4=t=>t instanceof wi?{...t}:t;function gc(t,e){e=e||{};const r={};function n(l,d,p,y){return Oe.isPlainObject(l)&&Oe.isPlainObject(d)?Oe.merge.call({caseless:y},l,d):Oe.isPlainObject(d)?Oe.merge({},d):Oe.isArray(d)?d.slice():d}function i(l,d,p,y){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l,p,y)}else return n(l,d,p,y)}function s(l,d){if(!Oe.isUndefined(d))return n(void 0,d)}function o(l,d){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l)}else return n(void 0,d)}function a(l,d,p){if(p in e)return n(l,d);if(p in t)return n(void 0,l)}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,d,p)=>i(K4(l),K4(d),p,!0)};return Oe.forEach(Object.keys(Object.assign({},t,e)),function(d){const p=u[d]||i,y=p(t[d],e[d],d);Oe.isUndefined(y)&&p!==a||(r[d]=y)}),r}const V4=t=>{const e=gc({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=wi.from(o),e.url=k4(W4(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(Oe.isFormData(r)){if(Xn.hasStandardBrowserEnv||Xn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[l,...d]=u?u.split(";").map(p=>p.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...d].join("; "))}}if(Xn.hasStandardBrowserEnv&&(n&&Oe.isFunction(n)&&(n=n(e)),n||n!==!1&&aK(e.url))){const l=i&&s&&cK.read(s);l&&o.set(i,l)}return e},lK=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=V4(t);let s=i.data;const o=wi.from(i.headers).normalize();let{responseType:a,onUploadProgress:u,onDownloadProgress:l}=i,d,p,y,A,P;function N(){A&&A(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let D=new XMLHttpRequest;D.open(i.method.toUpperCase(),i.url,!0),D.timeout=i.timeout;function k(){if(!D)return;const j=wi.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),K={data:!a||a==="text"||a==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:j,config:t,request:D};q4(function(T){r(T),N()},function(T){n(T),N()},K),D=null}"onloadend"in D?D.onloadend=k:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(k)},D.onabort=function(){D&&(n(new ar("Request aborted",ar.ECONNABORTED,t,D)),D=null)},D.onerror=function(){n(new ar("Network Error",ar.ERR_NETWORK,t,D)),D=null},D.ontimeout=function(){let U=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const K=i.transitional||$4;i.timeoutErrorMessage&&(U=i.timeoutErrorMessage),n(new ar(U,K.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,D)),D=null},s===void 0&&o.setContentType(null),"setRequestHeader"in D&&Oe.forEach(o.toJSON(),function(U,K){D.setRequestHeader(K,U)}),Oe.isUndefined(i.withCredentials)||(D.withCredentials=!!i.withCredentials),a&&a!=="json"&&(D.responseType=i.responseType),l&&([y,P]=w0(l,!0),D.addEventListener("progress",y)),u&&D.upload&&([p,A]=w0(u),D.upload.addEventListener("progress",p),D.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(d=j=>{D&&(n(!j||j.type?new Nu(null,t,D):j),D.abort(),D=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const B=iK(i.url);if(B&&Xn.protocols.indexOf(B)===-1){n(new ar("Unsupported protocol "+B+":",ar.ERR_BAD_REQUEST,t));return}D.send(s||null)})},hK=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i;const s=function(l){if(!i){i=!0,a();const d=l instanceof Error?l:this.reason;n.abort(d instanceof ar?d:new Nu(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,s(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),t=null)};t.forEach(l=>l.addEventListener("abort",s));const{signal:u}=n;return u.unsubscribe=()=>Oe.asap(a),u}},dK=function*(t,e){let r=t.byteLength;if(r{const i=pK(t,e);let s=0,o,a=u=>{o||(o=!0,n&&n(u))};return new ReadableStream({async pull(u){try{const{done:l,value:d}=await i.next();if(l){a(),u.close();return}let p=d.byteLength;if(r){let y=s+=p;r(y)}u.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(u){return a(u),i.return()}},{highWaterMark:2})},x0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Y4=x0&&typeof ReadableStream=="function",mK=x0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),J4=(t,...e)=>{try{return!!t(...e)}catch{return!1}},vK=Y4&&J4(()=>{let t=!1;const e=new Request(Xn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),X4=64*1024,hv=Y4&&J4(()=>Oe.isReadableStream(new Response("").body)),_0={stream:hv&&(t=>t.body)};x0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!_0[e]&&(_0[e]=Oe.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,n)})})})(new Response);const bK=async t=>{if(t==null)return 0;if(Oe.isBlob(t))return t.size;if(Oe.isSpecCompliantForm(t))return(await new Request(Xn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(t)||Oe.isArrayBuffer(t))return t.byteLength;if(Oe.isURLSearchParams(t)&&(t=t+""),Oe.isString(t))return(await mK(t)).byteLength},yK=async(t,e)=>{const r=Oe.toFiniteNumber(t.getContentLength());return r??bK(e)},dv={http:jW,xhr:lK,fetch:x0&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:l,headers:d,withCredentials:p="same-origin",fetchOptions:y}=V4(t);l=l?(l+"").toLowerCase():"text";let A=hK([i,s&&s.toAbortSignal()],o),P;const N=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let D;try{if(u&&vK&&r!=="get"&&r!=="head"&&(D=await yK(d,n))!==0){let K=new Request(e,{method:"POST",body:n,duplex:"half"}),J;if(Oe.isFormData(n)&&(J=K.headers.get("content-type"))&&d.setContentType(J),K.body){const[T,z]=z4(D,w0(H4(u)));n=G4(K.body,X4,T,z)}}Oe.isString(p)||(p=p?"include":"omit");const k="credentials"in Request.prototype;P=new Request(e,{...y,signal:A,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:k?p:void 0});let B=await fetch(P);const j=hv&&(l==="stream"||l==="response");if(hv&&(a||j&&N)){const K={};["status","statusText","headers"].forEach(ue=>{K[ue]=B[ue]});const J=Oe.toFiniteNumber(B.headers.get("content-length")),[T,z]=a&&z4(J,w0(H4(a),!0))||[];B=new Response(G4(B.body,X4,T,()=>{z&&z(),N&&N()}),K)}l=l||"text";let U=await _0[Oe.findKey(_0,l)||"text"](B,t);return!j&&N&&N(),await new Promise((K,J)=>{q4(K,J,{data:U,headers:wi.from(B.headers),status:B.status,statusText:B.statusText,config:t,request:P})})}catch(k){throw N&&N(),k&&k.name==="TypeError"&&/fetch/i.test(k.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,P),{cause:k.cause||k}):ar.from(k,k&&k.code,t,P)}})};Oe.forEach(dv,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Z4=t=>`- ${t}`,wK=t=>Oe.isFunction(t)||t===null||t===!1,Q4={getAdapter:t=>{t=Oe.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : `+s.map(Z4).join(` `):" "+Z4(s[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:dv};function pv(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Nu(null,t)}function e8(t){return pv(t),t.headers=wi.from(t.headers),t.data=lv.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Q4.getAdapter(t.adapter||Hl.adapter)(t).then(function(n){return pv(t),n.data=lv.call(t,t.transformResponse,n),n.headers=wi.from(n.headers),n},function(n){return U4(n)||(pv(t),n&&n.response&&(n.response.data=lv.call(t,t.transformResponse,n.response),n.response.headers=wi.from(n.response.headers))),Promise.reject(n)})}const t8="1.7.8",E0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{E0[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const r8={};E0.transitional=function(e,r,n){function i(s,o){return"[Axios v"+t8+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new ar(i(o," has been removed"+(r?" in "+r:"")),ar.ERR_DEPRECATED);return r&&!r8[o]&&(r8[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}},E0.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function xK(t,e,r){if(typeof t!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new ar("option "+s+" must be "+u,ar.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ar("Unknown option "+s,ar.ERR_BAD_OPTION)}}const S0={assertOptions:xK,validators:E0},Zs=S0.validators;let mc=class{constructor(e){this.defaults=e,this.interceptors={request:new B4,response:new B4}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` -`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=gc(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&S0.assertOptions(n,{silentJSONParsing:Zs.transitional(Zs.boolean),forcedJSONParsing:Zs.transitional(Zs.boolean),clarifyTimeoutError:Zs.transitional(Zs.boolean)},!1),i!=null&&(Oe.isFunction(i)?r.paramsSerializer={serialize:i}:S0.assertOptions(i,{encode:Zs.function,serialize:Zs.function},!0)),S0.assertOptions(r,{baseUrl:Zs.spelling("baseURL"),withXsrfToken:Zs.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Oe.merge(s.common,s[r.method]);s&&Oe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete s[P]}),r.headers=wi.concat(o,s);const a=[];let u=!0;this.interceptors.request.forEach(function(N){typeof N.runWhen=="function"&&N.runWhen(r)===!1||(u=u&&N.synchronous,a.unshift(N.fulfilled,N.rejected))});const l=[];this.interceptors.response.forEach(function(N){l.push(N.fulfilled,N.rejected)});let d,g=0,y;if(!u){const P=[e8.bind(this),void 0];for(P.unshift.apply(P,a),P.push.apply(P,l),y=P.length,d=Promise.resolve(r);g{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new Nu(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new JA(function(i){e=i}),cancel:e}}};function EK(t){return function(r){return t.apply(null,r)}}function SK(t){return Oe.isObject(t)&&t.isAxiosError===!0}const gv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(gv).forEach(([t,e])=>{gv[e]=t});function n8(t){const e=new mc(t),r=w4(mc.prototype.request,e);return Oe.extend(r,mc.prototype,e,{allOwnKeys:!0}),Oe.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return n8(gc(t,i))},r}const fn=n8(Hl);fn.Axios=mc,fn.CanceledError=Nu,fn.CancelToken=_K,fn.isCancel=U4,fn.VERSION=t8,fn.toFormData=b0,fn.AxiosError=ar,fn.Cancel=fn.CanceledError,fn.all=function(e){return Promise.all(e)},fn.spread=EK,fn.isAxiosError=SK,fn.mergeConfig=gc,fn.AxiosHeaders=wi,fn.formToJSON=t=>F4(Oe.isHTMLForm(t)?new FormData(t):t),fn.getAdapter=Q4.getAdapter,fn.HttpStatusCode=gv,fn.default=fn;const{Axios:$oe,AxiosError:i8,CanceledError:Foe,isCancel:joe,CancelToken:Uoe,VERSION:qoe,all:zoe,Cancel:Hoe,isAxiosError:Woe,spread:Koe,toFormData:Voe,AxiosHeaders:Goe,HttpStatusCode:Yoe,formToJSON:Joe,getAdapter:Xoe,mergeConfig:Zoe}=fn,s8=fn.create({timeout:6e4,headers:{"Content-Type":"application/json",token:localStorage.getItem("auth")}});function AK(t){var e,r,n;if(((e=t.data)==null?void 0:e.success)!==!0){const i=new i8((r=t.data)==null?void 0:r.errorMessage,(n=t.data)==null?void 0:n.errorCode,t.config,t.request,t);return Promise.reject(i)}else return t}function PK(t){var r;console.log(t);const e=(r=t.response)==null?void 0:r.data;if(e){console.log(e,"responseData");const n=new i8(e.errorMessage,t.code,t.config,t.request,t.response);return Promise.reject(n)}else return Promise.reject(t)}s8.interceptors.response.use(AK,PK);class MK{constructor(e){oo(this,"_apiBase","");this.request=e}setApiBase(e){this._apiBase=e||""}async getNonce(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/nonce`,e);return r.data}async getEmailCode(e,r){const{data:n}=await this.request.post(`${this._apiBase}/api/v2/user/get_code`,e,{headers:{"Captcha-Param":r}});return n.data}async emailLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async walletLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async tonLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async bindEmail(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindTonWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindEvmWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}}const va=new MK(s8),IK={projectId:"7a4434fefbcc9af474fb5c995e47d286",metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},o8=eW({appName:"codatta",appLogoUrl:"https://avatars.githubusercontent.com/u/171659315"}),a8=Se.createContext({saveLastUsedWallet:()=>{},lastUsedWallet:null,wallets:[],initialized:!1,featuredWallets:[]});function Kl(){return Se.useContext(a8)}function CK(t){const{apiBaseUrl:e}=t,[r,n]=Se.useState([]),[i,s]=Se.useState([]),[o,a]=Se.useState(null),[u,l]=Se.useState(!1),d=A=>{console.log("saveLastUsedWallet",A)};function g(A){const P=A.filter(k=>k.featured||k.installed),N=A.filter(k=>!k.featured&&!k.installed),D=[...P,...N];n(D),s(P)}async function y(){const A=[],P=new Map;QA.forEach(D=>{const k=new Wf(D);D.name==="Coinbase Wallet"&&k.EIP6963Detected({info:{name:"Coinbase Wallet",uuid:"coinbase",icon:D.image,rdns:"coinbase"},provider:o8.getProvider()}),P.set(k.key,k),A.push(k)}),(await gz()).forEach(D=>{const k=P.get(D.info.name);if(k)k.EIP6963Detected(D);else{const B=new Wf(D);P.set(B.key,B),A.push(B)}});try{const D=JSON.parse(localStorage.getItem("xn-last-used-info")||"{}"),k=P.get(D.key);if(k){if(k.lastUsed=!0,D.provider==="UniversalProvider"){const B=await Q6.init(IK);B.session&&k.setUniversalProvider(B)}a(k)}}catch(D){console.log(D)}g(A),l(!0)}return Se.useEffect(()=>{y(),va.setApiBase(e)},[]),ge.jsx(a8.Provider,{value:{saveLastUsedWallet:d,wallets:r,initialized:u,lastUsedWallet:o,featuredWallets:i},children:t.children})}/** +`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=gc(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&S0.assertOptions(n,{silentJSONParsing:Zs.transitional(Zs.boolean),forcedJSONParsing:Zs.transitional(Zs.boolean),clarifyTimeoutError:Zs.transitional(Zs.boolean)},!1),i!=null&&(Oe.isFunction(i)?r.paramsSerializer={serialize:i}:S0.assertOptions(i,{encode:Zs.function,serialize:Zs.function},!0)),S0.assertOptions(r,{baseUrl:Zs.spelling("baseURL"),withXsrfToken:Zs.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Oe.merge(s.common,s[r.method]);s&&Oe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete s[P]}),r.headers=wi.concat(o,s);const a=[];let u=!0;this.interceptors.request.forEach(function(N){typeof N.runWhen=="function"&&N.runWhen(r)===!1||(u=u&&N.synchronous,a.unshift(N.fulfilled,N.rejected))});const l=[];this.interceptors.response.forEach(function(N){l.push(N.fulfilled,N.rejected)});let d,p=0,y;if(!u){const P=[e8.bind(this),void 0];for(P.unshift.apply(P,a),P.push.apply(P,l),y=P.length,d=Promise.resolve(r);p{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new Nu(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new JA(function(i){e=i}),cancel:e}}};function EK(t){return function(r){return t.apply(null,r)}}function SK(t){return Oe.isObject(t)&&t.isAxiosError===!0}const gv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(gv).forEach(([t,e])=>{gv[e]=t});function n8(t){const e=new mc(t),r=w4(mc.prototype.request,e);return Oe.extend(r,mc.prototype,e,{allOwnKeys:!0}),Oe.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return n8(gc(t,i))},r}const fn=n8(Hl);fn.Axios=mc,fn.CanceledError=Nu,fn.CancelToken=_K,fn.isCancel=U4,fn.VERSION=t8,fn.toFormData=b0,fn.AxiosError=ar,fn.Cancel=fn.CanceledError,fn.all=function(e){return Promise.all(e)},fn.spread=EK,fn.isAxiosError=SK,fn.mergeConfig=gc,fn.AxiosHeaders=wi,fn.formToJSON=t=>F4(Oe.isHTMLForm(t)?new FormData(t):t),fn.getAdapter=Q4.getAdapter,fn.HttpStatusCode=gv,fn.default=fn;const{Axios:$oe,AxiosError:i8,CanceledError:Foe,isCancel:joe,CancelToken:Uoe,VERSION:qoe,all:zoe,Cancel:Hoe,isAxiosError:Woe,spread:Koe,toFormData:Voe,AxiosHeaders:Goe,HttpStatusCode:Yoe,formToJSON:Joe,getAdapter:Xoe,mergeConfig:Zoe}=fn,s8=fn.create({timeout:6e4,headers:{"Content-Type":"application/json",token:localStorage.getItem("auth")}});function AK(t){var e,r,n;if(((e=t.data)==null?void 0:e.success)!==!0){const i=new i8((r=t.data)==null?void 0:r.errorMessage,(n=t.data)==null?void 0:n.errorCode,t.config,t.request,t);return Promise.reject(i)}else return t}function PK(t){var r;console.log(t);const e=(r=t.response)==null?void 0:r.data;if(e){console.log(e,"responseData");const n=new i8(e.errorMessage,t.code,t.config,t.request,t.response);return Promise.reject(n)}else return Promise.reject(t)}s8.interceptors.response.use(AK,PK);class MK{constructor(e){oo(this,"_apiBase","");this.request=e}setApiBase(e){this._apiBase=e||""}async getNonce(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/nonce`,e);return r.data}async getEmailCode(e,r){const{data:n}=await this.request.post(`${this._apiBase}/api/v2/user/get_code`,e,{headers:{"Captcha-Param":r}});return n.data}async emailLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async walletLogin(e){return e.account_enum==="C"?(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data:(await this.request.post(`${this._apiBase}/api/v2/business/login`,e)).data}async tonLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async bindEmail(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindTonWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindEvmWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}}const va=new MK(s8),IK={projectId:"7a4434fefbcc9af474fb5c995e47d286",metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},o8=eW({appName:"codatta",appLogoUrl:"https://avatars.githubusercontent.com/u/171659315"}),a8=Se.createContext({saveLastUsedWallet:()=>{},lastUsedWallet:null,wallets:[],initialized:!1,featuredWallets:[]});function Kl(){return Se.useContext(a8)}function CK(t){const{apiBaseUrl:e}=t,[r,n]=Se.useState([]),[i,s]=Se.useState([]),[o,a]=Se.useState(null),[u,l]=Se.useState(!1),d=A=>{console.log("saveLastUsedWallet",A)};function p(A){const P=A.filter(k=>k.featured||k.installed),N=A.filter(k=>!k.featured&&!k.installed),D=[...P,...N];n(D),s(P)}async function y(){const A=[],P=new Map;QA.forEach(D=>{const k=new Wf(D);D.name==="Coinbase Wallet"&&k.EIP6963Detected({info:{name:"Coinbase Wallet",uuid:"coinbase",icon:D.image,rdns:"coinbase"},provider:o8.getProvider()}),P.set(k.key,k),A.push(k)}),(await gz()).forEach(D=>{const k=P.get(D.info.name);if(k)k.EIP6963Detected(D);else{const B=new Wf(D);P.set(B.key,B),A.push(B)}});try{const D=JSON.parse(localStorage.getItem("xn-last-used-info")||"{}"),k=P.get(D.key);if(k){if(k.lastUsed=!0,D.provider==="UniversalProvider"){const B=await Q6.init(IK);B.session&&k.setUniversalProvider(B)}a(k)}}catch(D){console.log(D)}p(A),l(!0)}return Se.useEffect(()=>{y(),va.setApiBase(e)},[]),ge.jsx(a8.Provider,{value:{saveLastUsedWallet:d,wallets:r,initialized:u,lastUsedWallet:o,featuredWallets:i},children:t.children})}/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -191,7 +191,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jK=ts("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]),h8=new Set;function A0(t,e,r){t||h8.has(e)||(console.warn(e),h8.add(e))}function UK(t){if(typeof Proxy>"u")return t;const e=new Map,r=(...n)=>(process.env.NODE_ENV!=="production"&&A0(!1,"motion() is deprecated. Use motion.create() instead."),t(...n));return new Proxy(r,{get:(n,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}function P0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const mv=t=>Array.isArray(t);function d8(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function vv(t,e,r,n){if(typeof e=="function"){const[i,s]=p8(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=p8(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function M0(t,e,r){const n=t.getProps();return vv(n,e,r!==void 0?r:n.custom,t)}const bv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],yv=["initial",...bv],Gl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],bc=new Set(Gl),Qs=t=>t*1e3,Do=t=>t/1e3,qK={type:"spring",stiffness:500,damping:25,restSpeed:10},zK=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),HK={type:"keyframes",duration:.8},WK={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},KK=(t,{keyframes:e})=>e.length>2?HK:bc.has(t)?t.startsWith("scale")?zK(e[1]):qK:WK;function wv(t,e){return t?t[e]||t.default||t:void 0}const VK={useManualTiming:!1},GK=t=>t!==null;function I0(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(GK),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const Wn=t=>t;function YK(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){s.has(l)&&(u.schedule(l),t()),l(o)}const u={schedule:(l,d=!1,g=!1)=>{const A=g&&n?e:r;return d&&s.add(l),A.has(l)||A.add(l),l},cancel:l=>{r.delete(l),s.delete(l)},process:l=>{if(o=l,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,u.process(l))}};return u}const C0=["read","resolveKeyframes","update","preRender","render","postRender"],JK=40;function g8(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=C0.reduce((k,B)=>(k[B]=YK(s),k),{}),{read:a,resolveKeyframes:u,update:l,preRender:d,render:g,postRender:y}=o,A=()=>{const k=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(k-i.timestamp,JK),1),i.timestamp=k,i.isProcessing=!0,a.process(i),u.process(i),l.process(i),d.process(i),g.process(i),y.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(A))},P=()=>{r=!0,n=!0,i.isProcessing||t(A)};return{schedule:C0.reduce((k,B)=>{const j=o[B];return k[B]=(U,K=!1,J=!1)=>(r||P(),j.schedule(U,K,J)),k},{}),cancel:k=>{for(let B=0;B(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,XK=1e-7,ZK=12;function QK(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=m8(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>XK&&++aQK(s,0,1,t,r);return s=>s===0||s===1?s:m8(i(s),e,n)}const v8=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,b8=t=>e=>1-t(1-e),y8=Yl(.33,1.53,.69,.99),_v=b8(y8),w8=v8(_v),x8=t=>(t*=2)<1?.5*_v(t):.5*(2-Math.pow(2,-10*(t-1))),Ev=t=>1-Math.sin(Math.acos(t)),_8=b8(Ev),E8=v8(Ev),S8=t=>/^0[^.\s]+$/u.test(t);function eV(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||S8(t):!0}let Lu=Wn,Oo=Wn;process.env.NODE_ENV!=="production"&&(Lu=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},Oo=(t,e)=>{if(!t)throw new Error(e)});const A8=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),P8=t=>e=>typeof e=="string"&&e.startsWith(t),M8=P8("--"),tV=P8("var(--"),Sv=t=>tV(t)?rV.test(t.split("/*")[0].trim()):!1,rV=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,nV=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function iV(t){const e=nV.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}const sV=4;function I8(t,e,r=1){Oo(r<=sV,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[n,i]=iV(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return A8(o)?parseFloat(o):o}return Sv(i)?I8(i,e,r+1):i}const ya=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},Jl={...ku,transform:t=>ya(0,1,t)},T0={...ku,default:1},Xl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),wa=Xl("deg"),eo=Xl("%"),zt=Xl("px"),oV=Xl("vh"),aV=Xl("vw"),C8={...eo,parse:t=>eo.parse(t)/100,transform:t=>eo.transform(t*100)},cV=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),T8=t=>t===ku||t===zt,R8=(t,e)=>parseFloat(t.split(", ")[e]),D8=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return R8(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?R8(s[1],t):0}},uV=new Set(["x","y","z"]),fV=Gl.filter(t=>!uV.has(t));function lV(t){const e=[];return fV.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const Bu={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:D8(4,13),y:D8(5,14)};Bu.translateX=Bu.x,Bu.translateY=Bu.y;const O8=t=>e=>e.test(t),N8=[ku,zt,eo,wa,aV,oV,{test:t=>t==="auto",parse:t=>t}],L8=t=>N8.find(O8(t)),yc=new Set;let Av=!1,Pv=!1;function k8(){if(Pv){const t=Array.from(yc).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=lV(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}Pv=!1,Av=!1,yc.forEach(t=>t.complete()),yc.clear()}function B8(){yc.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Pv=!0)})}function hV(){B8(),k8()}class Mv{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(yc.add(this),Av||(Av=!0,Nr.read(B8),Nr.resolveKeyframes(k8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sMath.round(t*1e5)/1e5,Iv=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function dV(t){return t==null}const pV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Cv=(t,e)=>r=>!!(typeof r=="string"&&pV.test(r)&&r.startsWith(t)||e&&!dV(r)&&Object.prototype.hasOwnProperty.call(r,e)),$8=(t,e,r)=>n=>{if(typeof n!="string")return n;const[i,s,o,a]=n.match(Iv);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},gV=t=>ya(0,255,t),Tv={...ku,transform:t=>Math.round(gV(t))},wc={test:Cv("rgb","red"),parse:$8("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+Tv.transform(t)+", "+Tv.transform(e)+", "+Tv.transform(r)+", "+Zl(Jl.transform(n))+")"};function mV(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const Rv={test:Cv("#"),parse:mV,transform:wc.transform},$u={test:Cv("hsl","hue"),parse:$8("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+eo.transform(Zl(e))+", "+eo.transform(Zl(r))+", "+Zl(Jl.transform(n))+")"},Zn={test:t=>wc.test(t)||Rv.test(t)||$u.test(t),parse:t=>wc.test(t)?wc.parse(t):$u.test(t)?$u.parse(t):Rv.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?wc.transform(t):$u.transform(t)},vV=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function bV(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Iv))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(vV))===null||r===void 0?void 0:r.length)||0)>0}const F8="number",j8="color",yV="var",wV="var(",U8="${}",xV=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ql(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(xV,u=>(Zn.test(u)?(n.color.push(s),i.push(j8),r.push(Zn.parse(u))):u.startsWith(wV)?(n.var.push(s),i.push(yV),r.push(u)):(n.number.push(s),i.push(F8),r.push(parseFloat(u))),++s,U8)).split(U8);return{values:r,split:a,indexes:n,types:i}}function q8(t){return Ql(t).values}function z8(t){const{split:e,types:r}=Ql(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function EV(t){const e=q8(t);return z8(t)(e.map(_V))}const xa={test:bV,parse:q8,createTransformer:z8,getAnimatableNone:EV},SV=new Set(["brightness","contrast","saturate","opacity"]);function AV(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(Iv)||[];if(!n)return t;const i=r.replace(n,"");let s=SV.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const PV=/\b([a-z-]*)\(.*?\)/gu,Dv={...xa,getAnimatableNone:t=>{const e=t.match(PV);return e?e.map(AV).join(" "):t}},MV={borderWidth:zt,borderTopWidth:zt,borderRightWidth:zt,borderBottomWidth:zt,borderLeftWidth:zt,borderRadius:zt,radius:zt,borderTopLeftRadius:zt,borderTopRightRadius:zt,borderBottomRightRadius:zt,borderBottomLeftRadius:zt,width:zt,maxWidth:zt,height:zt,maxHeight:zt,top:zt,right:zt,bottom:zt,left:zt,padding:zt,paddingTop:zt,paddingRight:zt,paddingBottom:zt,paddingLeft:zt,margin:zt,marginTop:zt,marginRight:zt,marginBottom:zt,marginLeft:zt,backgroundPositionX:zt,backgroundPositionY:zt},IV={rotate:wa,rotateX:wa,rotateY:wa,rotateZ:wa,scale:T0,scaleX:T0,scaleY:T0,scaleZ:T0,skew:wa,skewX:wa,skewY:wa,distance:zt,translateX:zt,translateY:zt,translateZ:zt,x:zt,y:zt,z:zt,perspective:zt,transformPerspective:zt,opacity:Jl,originX:C8,originY:C8,originZ:zt},H8={...ku,transform:Math.round},Ov={...MV,...IV,zIndex:H8,size:zt,fillOpacity:Jl,strokeOpacity:Jl,numOctaves:H8},CV={...Ov,color:Zn,backgroundColor:Zn,outlineColor:Zn,fill:Zn,stroke:Zn,borderColor:Zn,borderTopColor:Zn,borderRightColor:Zn,borderBottomColor:Zn,borderLeftColor:Zn,filter:Dv,WebkitFilter:Dv},Nv=t=>CV[t];function W8(t,e){let r=Nv(t);return r!==Dv&&(r=xa),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const TV=new Set(["auto","none","0"]);function RV(t,e,r){let n=0,i;for(;n{r.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function Lv(t){return typeof t=="function"}let R0;function DV(){R0=void 0}const to={now:()=>(R0===void 0&&to.set(Kn.isProcessing||VK.useManualTiming?Kn.timestamp:performance.now()),R0),set:t=>{R0=t,queueMicrotask(DV)}},V8=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(xa.test(t)||t==="0")&&!t.startsWith("url("));function OV(t){const e=t[0];if(t.length===1)return!0;for(let r=0;rLV?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&hV(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=to.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:u,isGenerator:l}=this.options;if(!l&&!NV(e,n,i,s))if(o)this.options.duration=0;else{u==null||u(I0(e,this.options,r)),a==null||a(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,r);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...d},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function Y8(t,e){return e?t*(1e3/e):0}const kV=5;function J8(t,e,r){const n=Math.max(e-kV,0);return Y8(r-t(n),e-n)}const kv=.001,BV=.01,X8=10,$V=.05,FV=1;function jV({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;Lu(t<=Qs(X8),"Spring duration must be 10 seconds or less");let o=1-e;o=ya($V,FV,o),t=ya(BV,X8,Do(t)),o<1?(i=l=>{const d=l*o,g=d*t,y=d-r,A=Bv(l,o),P=Math.exp(-g);return kv-y/A*P},s=l=>{const g=l*o*t,y=g*r+r,A=Math.pow(o,2)*Math.pow(l,2)*t,P=Math.exp(-g),N=Bv(Math.pow(l,2),o);return(-i(l)+kv>0?-1:1)*((y-A)*P)/N}):(i=l=>{const d=Math.exp(-l*t),g=(l-r)*t+1;return-kv+d*g},s=l=>{const d=Math.exp(-l*t),g=(r-l)*(t*t);return d*g});const a=5/t,u=qV(i,s,a);if(t=Qs(t),isNaN(u))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(u,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:t}}}const UV=12;function qV(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function WV(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!Z8(t,HV)&&Z8(t,zV)){const r=jV(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function Q8({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:u,mass:l,duration:d,velocity:g,isResolvedFromDuration:y}=WV({...n,velocity:-Do(n.velocity||0)}),A=g||0,P=u/(2*Math.sqrt(a*l)),N=s-i,D=Do(Math.sqrt(a/l)),k=Math.abs(N)<5;r||(r=k?.01:2),e||(e=k?.005:.5);let B;if(P<1){const j=Bv(D,P);B=U=>{const K=Math.exp(-P*D*U);return s-K*((A+P*D*N)/j*Math.sin(j*U)+N*Math.cos(j*U))}}else if(P===1)B=j=>s-Math.exp(-D*j)*(N+(A+D*N)*j);else{const j=D*Math.sqrt(P*P-1);B=U=>{const K=Math.exp(-P*D*U),J=Math.min(j*U,300);return s-K*((A+P*D*N)*Math.sinh(J)+j*N*Math.cosh(J))/j}}return{calculatedDuration:y&&d||null,next:j=>{const U=B(j);if(y)o.done=j>=d;else{let K=0;P<1&&(K=j===0?Qs(A):J8(B,j,U));const J=Math.abs(K)<=r,T=Math.abs(s-U)<=e;o.done=J&&T}return o.value=o.done?s:U,o}}}function eE({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:d}){const g=t[0],y={done:!1,value:g},A=z=>a!==void 0&&zu,P=z=>a===void 0?u:u===void 0||Math.abs(a-z)-N*Math.exp(-z/n),j=z=>k+B(z),U=z=>{const ue=B(z),_e=j(z);y.done=Math.abs(ue)<=l,y.value=y.done?k:_e};let K,J;const T=z=>{A(y.value)&&(K=z,J=Q8({keyframes:[y.value,P(y.value)],velocity:J8(j,z,y.value),damping:i,stiffness:s,restDelta:l,restSpeed:d}))};return T(0),{calculatedDuration:null,next:z=>{let ue=!1;return!J&&K===void 0&&(ue=!0,U(z),T(z)),K!==void 0&&z>=K?J.next(z-K):(!ue&&U(z),y)}}}const KV=Yl(.42,0,1,1),VV=Yl(0,0,.58,1),tE=Yl(.42,0,.58,1),GV=t=>Array.isArray(t)&&typeof t[0]!="number",$v=t=>Array.isArray(t)&&typeof t[0]=="number",rE={linear:Wn,easeIn:KV,easeInOut:tE,easeOut:VV,circIn:Ev,circInOut:E8,circOut:_8,backIn:_v,backInOut:w8,backOut:y8,anticipate:x8},nE=t=>{if($v(t)){Oo(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,r,n,i]=t;return Yl(e,r,n,i)}else if(typeof t=="string")return Oo(rE[t]!==void 0,`Invalid easing type '${t}'`),rE[t];return t},YV=(t,e)=>r=>e(t(r)),No=(...t)=>t.reduce(YV),Fu=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},Zr=(t,e,r)=>t+(e-t)*r;function Fv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function JV({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,u=2*r-a;i=Fv(u,a,t+1/3),s=Fv(u,a,t),o=Fv(u,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function D0(t,e){return r=>r>0?e:t}const jv=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},XV=[Rv,wc,$u],ZV=t=>XV.find(e=>e.test(t));function iE(t){const e=ZV(t);if(Lu(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let r=e.parse(t);return e===$u&&(r=JV(r)),r}const sE=(t,e)=>{const r=iE(t),n=iE(e);if(!r||!n)return D0(t,e);const i={...r};return s=>(i.red=jv(r.red,n.red,s),i.green=jv(r.green,n.green,s),i.blue=jv(r.blue,n.blue,s),i.alpha=Zr(r.alpha,n.alpha,s),wc.transform(i))},Uv=new Set(["none","hidden"]);function QV(t,e){return Uv.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function eG(t,e){return r=>Zr(t,e,r)}function qv(t){return typeof t=="number"?eG:typeof t=="string"?Sv(t)?D0:Zn.test(t)?sE:nG:Array.isArray(t)?oE:typeof t=="object"?Zn.test(t)?sE:tG:D0}function oE(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>qv(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function rG(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=xa.createTransformer(e),n=Ql(t),i=Ql(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?Uv.has(t)&&!i.values.length||Uv.has(e)&&!n.values.length?QV(t,e):No(oE(rG(n,i),i.values),r):(Lu(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),D0(t,e))};function aE(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Zr(t,e,r):qv(t)(t,e)}function iG(t,e,r){const n=[],i=r||aE,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=iG(e,n,i),a=o.length,u=l=>{let d=0;if(a>1)for(;du(ya(t[0],t[s-1],l)):u}function oG(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=Fu(0,e,n);t.push(Zr(r,1,i))}}function aG(t){const e=[0];return oG(e,t.length-1),e}function cG(t,e){return t.map(r=>r*e)}function uG(t,e){return t.map(()=>e||tE).splice(0,t.length-1)}function O0({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=GV(n)?n.map(nE):nE(n),s={done:!1,value:e[0]},o=cG(r&&r.length===e.length?r:aG(e),t),a=sG(o,e,{ease:Array.isArray(i)?i:uG(e,i)});return{calculatedDuration:t,next:u=>(s.value=a(u),s.done=u>=t,s)}}const cE=2e4;function fG(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=cE?1/0:e}const lG=t=>{const e=({timestamp:r})=>t(r);return{start:()=>Nr.update(e,!0),stop:()=>ba(e),now:()=>Kn.isProcessing?Kn.timestamp:to.now()}},hG={decay:eE,inertia:eE,tween:O0,keyframes:O0,spring:Q8},dG=t=>t/100;class zv extends G8{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:u}=this.options;u&&u()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Mv,a=(u,l)=>this.onKeyframesResolved(u,l);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=Lv(r)?r:hG[r]||O0;let u,l;a!==O0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&Oo(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),u=No(dG,aE(e[0],e[1])),e=[0,100]);const d=a({...this.options,keyframes:e});s==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=fG(d));const{calculatedDuration:g}=d,y=g+i,A=y*(n+1)-i;return{generator:d,mirroredGenerator:l,mapPercentToKeyframes:u,calculatedDuration:g,resolvedDuration:y,totalDuration:A}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:z}=this.options;return{done:!0,value:z[z.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:u,calculatedDuration:l,totalDuration:d,resolvedDuration:g}=n;if(this.startTime===null)return s.next(0);const{delay:y,repeat:A,repeatType:P,repeatDelay:N,onUpdate:D}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const k=this.currentTime-y*(this.speed>=0?1:-1),B=this.speed>=0?k<0:k>d;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let j=this.currentTime,U=s;if(A){const z=Math.min(this.currentTime,d)/g;let ue=Math.floor(z),_e=z%1;!_e&&z>=1&&(_e=1),_e===1&&ue--,ue=Math.min(ue,A+1),!!(ue%2)&&(P==="reverse"?(_e=1-_e,N&&(_e-=N/g)):P==="mirror"&&(U=o)),j=ya(0,1,_e)*g}const K=B?{done:!1,value:u[0]}:U.next(j);a&&(K.value=a(K.value));let{done:J}=K;!B&&l!==null&&(J=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&J);return T&&i!==void 0&&(K.value=I0(u,this.options,i)),D&&D(K.value),T&&this.finish(),K}get duration(){const{resolved:e}=this;return e?Do(e.calculatedDuration):0}get time(){return Do(this.currentTime)}set time(e){e=Qs(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=Do(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=lG,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const pG=new Set(["opacity","clipPath","filter","transform"]),gG=10,mG=(t,e)=>{let r="";const n=Math.max(Math.round(e/gG),2);for(let i=0;i(e===void 0&&(e=t()),e)}const vG={linearEasing:void 0};function bG(t,e){const r=Hv(t);return()=>{var n;return(n=vG[e])!==null&&n!==void 0?n:r()}}const N0=bG(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function uE(t){return!!(typeof t=="function"&&N0()||!t||typeof t=="string"&&(t in Wv||N0())||$v(t)||Array.isArray(t)&&t.every(uE))}const eh=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,Wv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:eh([0,.65,.55,1]),circOut:eh([.55,0,1,.45]),backIn:eh([.31,.01,.66,-.59]),backOut:eh([.33,1.53,.69,.99])};function fE(t,e){if(t)return typeof t=="function"&&N0()?mG(t,e):$v(t)?eh(t):Array.isArray(t)?t.map(r=>fE(r,e)||Wv.easeOut):Wv[t]}function yG(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:u}={}){const l={[e]:r};u&&(l.offset=u);const d=fE(a,i);return Array.isArray(d)&&(l.easing=d),t.animate(l,{delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function lE(t,e){t.timeline=e,t.onfinish=null}const wG=Hv(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),L0=10,xG=2e4;function _G(t){return Lv(t.type)||t.type==="spring"||!uE(t.ease)}function EG(t,e){const r=new zv({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&sthis.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:u,name:l,startTime:d}=this.options;if(!(!((n=u.owner)===null||n===void 0)&&n.current))return!1;if(typeof o=="string"&&N0()&&SG(o)&&(o=hE[o]),_G(this.options)){const{onComplete:y,onUpdate:A,motionValue:P,element:N,...D}=this.options,k=EG(e,D);e=k.keyframes,e.length===1&&(e[1]=e[0]),i=k.duration,s=k.times,o=k.ease,a="keyframes"}const g=yG(u.owner.current,l,e,{...this.options,duration:i,times:s,ease:o});return g.startTime=d??this.calcStartTime(),this.pendingTimeline?(lE(g,this.pendingTimeline),this.pendingTimeline=void 0):g.onfinish=()=>{const{onComplete:y}=this.options;u.set(I0(e,this.options,r)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:g,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return Do(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return Do(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=Qs(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return Wn;const{animation:n}=r;lE(n,e)}return Wn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:d,onComplete:g,element:y,...A}=this.options,P=new zv({...A,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),N=Qs(this.time);l.setWithVelocity(P.sample(N-L0).value,P.sample(N).value,L0)}const{onStop:u}=this.options;u&&u(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return wG()&&n&&pG.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}const AG=Hv(()=>window.ScrollTimeline!==void 0);class PG{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;nAG()&&i.attachTimeline?i.attachTimeline(e):r(i));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function MG({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:u,elapsed:l,...d}){return!!Object.keys(d).length}const Kv=(t,e,r,n={},i,s)=>o=>{const a=wv(n,t)||{},u=a.delay||n.delay||0;let{elapsed:l=0}=n;l=l-Qs(u);let d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:y=>{e.set(y),a.onUpdate&&a.onUpdate(y)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:i};MG(a)||(d={...d,...KK(t,d)}),d.duration&&(d.duration=Qs(d.duration)),d.repeatDelay&&(d.repeatDelay=Qs(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let g=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(g=!0)),g&&!s&&e.get()!==void 0){const y=I0(d.keyframes,a);if(y!==void 0)return Nr.update(()=>{d.onUpdate(y),d.onComplete()}),new PG([])}return!s&&dE.supports(d)?new dE(d):new zv(d)},IG=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),CG=t=>mv(t)?t[t.length-1]||0:t;function Vv(t,e){t.indexOf(e)===-1&&t.push(e)}function Gv(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class Yv{constructor(){this.subscriptions=[]}add(e){return Vv(this.subscriptions,e),()=>Gv(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class RG{constructor(e,r={}){this.version="11.11.17",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=to.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=to.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=TG(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&A0(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new Yv);const n=this.events[e].add(r);return e==="change"?()=>{n(),Nr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=to.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>pE)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,pE);return Y8(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function th(t,e){return new RG(t,e)}function DG(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,th(r))}function OG(t,e){const r=M0(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=CG(s[o]);DG(t,o,a)}}const Jv=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),gE="data-"+Jv("framerAppearId");function mE(t){return t.props[gE]}const Qn=t=>!!(t&&t.getVelocity);function NG(t){return!!(Qn(t)&&t.add)}function Xv(t,e){const r=t.getValue("willChange");if(NG(r))return r.add(e)}function LG({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function vE(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...u}=e;n&&(o=n);const l=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const g in u){const y=t.getValue(g,(s=t.latestValues[g])!==null&&s!==void 0?s:null),A=u[g];if(A===void 0||d&&LG(d,g))continue;const P={delay:r,...wv(o||{},g)};let N=!1;if(window.MotionHandoffAnimation){const k=mE(t);if(k){const B=window.MotionHandoffAnimation(k,g,Nr);B!==null&&(P.startTime=B,N=!0)}}Xv(t,g),y.start(Kv(g,y,A,t.shouldReduceMotion&&bc.has(g)?{type:!1}:P,t,N));const D=y.animation;D&&l.push(D)}return a&&Promise.all(l).then(()=>{Nr.update(()=>{a&&OG(t,a)})}),l}function Zv(t,e,r={}){var n;const i=M0(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(vE(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:g,staggerDirection:y}=s;return kG(t,e,d+l,g,y,r)}:()=>Promise.resolve(),{when:u}=s;if(u){const[l,d]=u==="beforeChildren"?[o,a]:[a,o];return l().then(()=>d())}else return Promise.all([o(),a(r.delay)])}function kG(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,u=i===1?(l=0)=>l*n:(l=0)=>a-l*n;return Array.from(t.variantChildren).sort(BG).forEach((l,d)=>{l.notify("AnimationStart",e),o.push(Zv(l,e,{...s,delay:r+u(d)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function BG(t,e){return t.sortNodePosition(e)}function $G(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>Zv(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=Zv(t,e,r);else{const i=typeof e=="function"?M0(t,e,r.custom):e;n=Promise.all(vE(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const FG=yv.length;function bE(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?bE(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;rPromise.all(e.map(({animation:r,options:n})=>$G(t,r,n)))}function zG(t){let e=qG(t),r=yE(),n=!0;const i=u=>(l,d)=>{var g;const y=M0(t,d,u==="exit"?(g=t.presenceContext)===null||g===void 0?void 0:g.custom:void 0);if(y){const{transition:A,transitionEnd:P,...N}=y;l={...l,...N,...P}}return l};function s(u){e=u(t)}function o(u){const{props:l}=t,d=bE(t.parent)||{},g=[],y=new Set;let A={},P=1/0;for(let D=0;DP&&U,ue=!1;const _e=Array.isArray(j)?j:[j];let G=_e.reduce(i(k),{});K===!1&&(G={});const{prevResolvedValues:E={}}=B,m={...E,...G},f=x=>{z=!0,y.has(x)&&(ue=!0,y.delete(x)),B.needsAnimating[x]=!0;const _=t.getValue(x);_&&(_.liveStyle=!1)};for(const x in m){const _=G[x],S=E[x];if(A.hasOwnProperty(x))continue;let b=!1;mv(_)&&mv(S)?b=!d8(_,S):b=_!==S,b?_!=null?f(x):y.add(x):_!==void 0&&y.has(x)?f(x):B.protectedKeys[x]=!0}B.prevProp=j,B.prevResolvedValues=G,B.isActive&&(A={...A,...G}),n&&t.blockInitialAnimation&&(z=!1),z&&(!(J&&T)||ue)&&g.push(..._e.map(x=>({animation:x,options:{type:k}})))}if(y.size){const D={};y.forEach(k=>{const B=t.getBaseTarget(k),j=t.getValue(k);j&&(j.liveStyle=!0),D[k]=B??null}),g.push({animation:D})}let N=!!g.length;return n&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(N=!1),n=!1,N?e(g):Promise.resolve()}function a(u,l){var d;if(r[u].isActive===l)return Promise.resolve();(d=t.variantChildren)===null||d===void 0||d.forEach(y=>{var A;return(A=y.animationState)===null||A===void 0?void 0:A.setActive(u,l)}),r[u].isActive=l;const g=o(u);for(const y in r)r[y].protectedKeys={};return g}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=yE(),n=!0}}}function HG(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!d8(e,t):!1}function xc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function yE(){return{animate:xc(!0),whileInView:xc(),whileHover:xc(),whileTap:xc(),whileDrag:xc(),whileFocus:xc(),exit:xc()}}class _a{constructor(e){this.isMounted=!1,this.node=e}update(){}}class WG extends _a{constructor(e){super(e),e.animationState||(e.animationState=zG(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();P0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let KG=0;class VG extends _a{constructor(){super(...arguments),this.id=KG++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const GG={animation:{Feature:WG},exit:{Feature:VG}},wE=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function k0(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const YG=t=>e=>wE(e)&&t(e,k0(e));function Lo(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function ko(t,e,r,n){return Lo(t,e,YG(r),n)}const xE=(t,e)=>Math.abs(t-e);function JG(t,e){const r=xE(t.x,e.x),n=xE(t.y,e.y);return Math.sqrt(r**2+n**2)}class _E{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=eb(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,A=JG(g.offset,{x:0,y:0})>=3;if(!y&&!A)return;const{point:P}=g,{timestamp:N}=Kn;this.history.push({...P,timestamp:N});const{onStart:D,onMove:k}=this.handlers;y||(D&&D(this.lastMoveEvent,g),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,g)},this.handlePointerMove=(g,y)=>{this.lastMoveEvent=g,this.lastMoveEventInfo=Qv(y,this.transformPagePoint),Nr.update(this.updatePoint,!0)},this.handlePointerUp=(g,y)=>{this.end();const{onEnd:A,onSessionEnd:P,resumeAnimation:N}=this.handlers;if(this.dragSnapToOrigin&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=eb(g.type==="pointercancel"?this.lastMoveEventInfo:Qv(y,this.transformPagePoint),this.history);this.startEvent&&A&&A(g,D),P&&P(g,D)},!wE(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=k0(e),a=Qv(o,this.transformPagePoint),{point:u}=a,{timestamp:l}=Kn;this.history=[{...u,timestamp:l}];const{onSessionStart:d}=r;d&&d(e,eb(a,this.history)),this.removeListeners=No(ko(this.contextWindow,"pointermove",this.handlePointerMove),ko(this.contextWindow,"pointerup",this.handlePointerUp),ko(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),ba(this.updatePoint)}}function Qv(t,e){return e?{point:e(t.point)}:t}function EE(t,e){return{x:t.x-e.x,y:t.y-e.y}}function eb({point:t},e){return{point:t,delta:EE(t,SE(e)),offset:EE(t,XG(e)),velocity:ZG(e,.1)}}function XG(t){return t[0]}function SE(t){return t[t.length-1]}function ZG(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=SE(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>Qs(e)));)r--;if(!n)return{x:0,y:0};const s=Do(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function AE(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const PE=AE("dragHorizontal"),ME=AE("dragVertical");function IE(t){let e=!1;if(t==="y")e=ME();else if(t==="x")e=PE();else{const r=PE(),n=ME();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function CE(){const t=IE(!0);return t?(t(),!1):!0}function ju(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const TE=1e-4,QG=1-TE,eY=1+TE,RE=.01,tY=0-RE,rY=0+RE;function Ni(t){return t.max-t.min}function nY(t,e,r){return Math.abs(t-e)<=r}function DE(t,e,r,n=.5){t.origin=n,t.originPoint=Zr(e.min,e.max,t.origin),t.scale=Ni(r)/Ni(e),t.translate=Zr(r.min,r.max,t.origin)-t.originPoint,(t.scale>=QG&&t.scale<=eY||isNaN(t.scale))&&(t.scale=1),(t.translate>=tY&&t.translate<=rY||isNaN(t.translate))&&(t.translate=0)}function rh(t,e,r,n){DE(t.x,e.x,r.x,n?n.originX:void 0),DE(t.y,e.y,r.y,n?n.originY:void 0)}function OE(t,e,r){t.min=r.min+e.min,t.max=t.min+Ni(e)}function iY(t,e,r){OE(t.x,e.x,r.x),OE(t.y,e.y,r.y)}function NE(t,e,r){t.min=e.min-r.min,t.max=t.min+Ni(e)}function nh(t,e,r){NE(t.x,e.x,r.x),NE(t.y,e.y,r.y)}function sY(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?Zr(r,t,n.max):Math.min(t,r)),t}function LE(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function oY(t,{top:e,left:r,bottom:n,right:i}){return{x:LE(t.x,r,i),y:LE(t.y,e,n)}}function kE(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=Fu(e.min,e.max-n,t.min):n>i&&(r=Fu(t.min,t.max-i,e.min)),ya(0,1,r)}function uY(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const tb=.35;function fY(t=tb){return t===!1?t=0:t===!0&&(t=tb),{x:BE(t,"left","right"),y:BE(t,"top","bottom")}}function BE(t,e,r){return{min:$E(t,e),max:$E(t,r)}}function $E(t,e){return typeof t=="number"?t:t[e]||0}const FE=()=>({translate:0,scale:1,origin:0,originPoint:0}),Uu=()=>({x:FE(),y:FE()}),jE=()=>({min:0,max:0}),ln=()=>({x:jE(),y:jE()});function rs(t){return[t("x"),t("y")]}function UE({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function lY({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function hY(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function rb(t){return t===void 0||t===1}function nb({scale:t,scaleX:e,scaleY:r}){return!rb(t)||!rb(e)||!rb(r)}function _c(t){return nb(t)||qE(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function qE(t){return zE(t.x)||zE(t.y)}function zE(t){return t&&t!=="0%"}function B0(t,e,r){const n=t-r,i=e*n;return r+i}function HE(t,e,r,n,i){return i!==void 0&&(t=B0(t,i,n)),B0(t,r,n)+e}function ib(t,e=0,r=1,n,i){t.min=HE(t.min,e,r,n,i),t.max=HE(t.max,e,r,n,i)}function WE(t,{x:e,y:r}){ib(t.x,e.translate,e.scale,e.originPoint),ib(t.y,r.translate,r.scale,r.originPoint)}const KE=.999999999999,VE=1.0000000000001;function dY(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;aKE&&(e.x=1),e.yKE&&(e.y=1)}function qu(t,e){t.min=t.min+e,t.max=t.max+e}function GE(t,e,r,n,i=.5){const s=Zr(t.min,t.max,i);ib(t,e,r,s,n)}function zu(t,e){GE(t.x,e.x,e.scaleX,e.scale,e.originX),GE(t.y,e.y,e.scaleY,e.scale,e.originY)}function YE(t,e){return UE(hY(t.getBoundingClientRect(),e))}function pY(t,e,r){const n=YE(t,r),{scroll:i}=e;return i&&(qu(n.x,i.offset.x),qu(n.y,i.offset.y)),n}const JE=({current:t})=>t?t.ownerDocument.defaultView:null,gY=new WeakMap;class mY{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ln(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:g}=this.getProps();g?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(k0(d,"page").point)},s=(d,g)=>{const{drag:y,dragPropagation:A,onDragStart:P}=this.getProps();if(y&&!A&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=IE(y),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),rs(D=>{let k=this.getAxisMotionValue(D).get()||0;if(eo.test(k)){const{projection:B}=this.visualElement;if(B&&B.layout){const j=B.layout.layoutBox[D];j&&(k=Ni(j)*(parseFloat(k)/100))}}this.originPoint[D]=k}),P&&Nr.postRender(()=>P(d,g)),Xv(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},o=(d,g)=>{const{dragPropagation:y,dragDirectionLock:A,onDirectionLock:P,onDrag:N}=this.getProps();if(!y&&!this.openGlobalLock)return;const{offset:D}=g;if(A&&this.currentDirection===null){this.currentDirection=vY(D),this.currentDirection!==null&&P&&P(this.currentDirection);return}this.updateAxis("x",g.point,D),this.updateAxis("y",g.point,D),this.visualElement.render(),N&&N(d,g)},a=(d,g)=>this.stop(d,g),u=()=>rs(d=>{var g;return this.getAnimationState(d)==="paused"&&((g=this.getAxisMotionValue(d).animation)===null||g===void 0?void 0:g.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new _E(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:JE(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Nr.postRender(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!$0(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=sY(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&ju(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=oY(i.layoutBox,r):this.constraints=!1,this.elastic=fY(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&rs(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=uY(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!ju(e))return!1;const n=e.current;Oo(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=pY(n,i.root,this.visualElement.getTransformPagePoint());let o=aY(i.layout.layoutBox,s);if(r){const a=r(lY(o));this.hasMutatedConstraints=!!a,a&&(o=UE(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),u=this.constraints||{},l=rs(d=>{if(!$0(d,r,this.currentDirection))return;let g=u&&u[d]||{};o&&(g={min:0,max:0});const y=i?200:1e6,A=i?40:1e7,P={type:"inertia",velocity:n?e[d]:0,bounceStiffness:y,bounceDamping:A,timeConstant:750,restDelta:1,restSpeed:10,...s,...g};return this.startAxisValueAnimation(d,P)});return Promise.all(l).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return Xv(this.visualElement,e),n.start(Kv(e,n,0,r,this.visualElement,!1))}stopAnimation(){rs(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){rs(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){rs(r=>{const{drag:n}=this.getProps();if(!$0(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-Zr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!ju(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};rs(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const u=a.get();i[o]=cY({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),rs(o=>{if(!$0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:u,max:l}=this.constraints[o];a.set(Zr(u,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;gY.set(this.visualElement,this);const e=this.visualElement.current,r=ko(e,"pointerdown",u=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();ju(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Nr.read(n);const o=Lo(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(rs(d=>{const g=this.getAxisMotionValue(d);g&&(this.originPoint[d]+=u[d].translate,g.set(g.get()+u[d].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=tb,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function $0(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function vY(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class bY extends _a{constructor(e){super(e),this.removeGroupControls=Wn,this.removeListeners=Wn,this.controls=new mY(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Wn}unmount(){this.removeGroupControls(),this.removeListeners()}}const XE=t=>(e,r)=>{t&&Nr.postRender(()=>t(e,r))};class yY extends _a{constructor(){super(...arguments),this.removePointerDownListener=Wn}onPointerDown(e){this.session=new _E(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:JE(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:XE(e),onStart:XE(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&Nr.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=ko(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const F0=Se.createContext(null);function wY(){const t=Se.useContext(F0);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=Se.useId();Se.useEffect(()=>n(i),[]);const s=Se.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const sb=Se.createContext({}),ZE=Se.createContext({}),j0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function QE(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ih={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(zt.test(t))t=parseFloat(t);else return t;const r=QE(t,e.target.x),n=QE(t,e.target.y);return`${r}% ${n}%`}},xY={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=xa.parse(t);if(i.length>5)return n;const s=xa.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,u=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=u;const l=Zr(a,u,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),s(i)}},U0={};function _Y(t){Object.assign(U0,t)}const{schedule:ob}=g8(queueMicrotask,!1);class EY extends Se.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;_Y(SY),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),j0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Nr.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ob.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function eS(t){const[e,r]=wY(),n=Se.useContext(sb);return ge.jsx(EY,{...t,layoutGroup:n,switchLayoutGroup:Se.useContext(ZE),isPresent:e,safeToRemove:r})}const SY={borderRadius:{...ih,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ih,borderTopRightRadius:ih,borderBottomLeftRadius:ih,borderBottomRightRadius:ih,boxShadow:xY},tS=["TopLeft","TopRight","BottomLeft","BottomRight"],AY=tS.length,rS=t=>typeof t=="string"?parseFloat(t):t,nS=t=>typeof t=="number"||zt.test(t);function PY(t,e,r,n,i,s){i?(t.opacity=Zr(0,r.opacity!==void 0?r.opacity:1,MY(n)),t.opacityExit=Zr(e.opacity!==void 0?e.opacity:1,0,IY(n))):s&&(t.opacity=Zr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(Fu(t,e,n))}function oS(t,e){t.min=e.min,t.max=e.max}function ns(t,e){oS(t.x,e.x),oS(t.y,e.y)}function aS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function cS(t,e,r,n,i){return t-=e,t=B0(t,1/r,n),i!==void 0&&(t=B0(t,1/i,n)),t}function CY(t,e=0,r=1,n=.5,i,s=t,o=t){if(eo.test(e)&&(e=parseFloat(e),e=Zr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Zr(s.min,s.max,n);t===s&&(a-=e),t.min=cS(t.min,e,r,a,i),t.max=cS(t.max,e,r,a,i)}function uS(t,e,[r,n,i],s,o){CY(t,e[r],e[n],e[i],e.scale,s,o)}const TY=["x","scaleX","originX"],RY=["y","scaleY","originY"];function fS(t,e,r,n){uS(t.x,e,TY,r?r.x:void 0,n?n.x:void 0),uS(t.y,e,RY,r?r.y:void 0,n?n.y:void 0)}function lS(t){return t.translate===0&&t.scale===1}function hS(t){return lS(t.x)&&lS(t.y)}function dS(t,e){return t.min===e.min&&t.max===e.max}function DY(t,e){return dS(t.x,e.x)&&dS(t.y,e.y)}function pS(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function gS(t,e){return pS(t.x,e.x)&&pS(t.y,e.y)}function mS(t){return Ni(t.x)/Ni(t.y)}function vS(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class OY{constructor(){this.members=[]}add(e){Vv(this.members,e),e.scheduleRender()}remove(e){if(Gv(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function NY(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:l,rotate:d,rotateX:g,rotateY:y,skewX:A,skewY:P}=r;l&&(n=`perspective(${l}px) ${n}`),d&&(n+=`rotate(${d}deg) `),g&&(n+=`rotateX(${g}deg) `),y&&(n+=`rotateY(${y}deg) `),A&&(n+=`skewX(${A}deg) `),P&&(n+=`skewY(${P}deg) `)}const a=t.x.scale*e.x,u=t.y.scale*e.y;return(a!==1||u!==1)&&(n+=`scale(${a}, ${u})`),n||"none"}const LY=(t,e)=>t.depth-e.depth;class kY{constructor(){this.children=[],this.isDirty=!1}add(e){Vv(this.children,e),this.isDirty=!0}remove(e){Gv(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(LY),this.isDirty=!1,this.children.forEach(e)}}function q0(t){const e=Qn(t)?t.get():t;return IG(e)?e.toValue():e}function BY(t,e){const r=to.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(ba(n),t(s-e))};return Nr.read(n,!0),()=>ba(n)}function $Y(t){return t instanceof SVGElement&&t.tagName!=="svg"}function FY(t,e,r){const n=Qn(t)?t:th(t);return n.start(Kv("",n,e,r)),n.animation}const Ec={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},sh=typeof window<"u"&&window.MotionDebug!==void 0,ab=["","X","Y","Z"],jY={visibility:"hidden"},bS=1e3;let UY=0;function cb(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function yS(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=mE(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Nr,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&yS(n)}function wS({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=UY++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,sh&&(Ec.totalNodes=Ec.resolvedTargetDeltas=Ec.recalculatedProjection=0),this.nodes.forEach(HY),this.nodes.forEach(YY),this.nodes.forEach(JY),this.nodes.forEach(WY),sh&&window.MotionDebug.record(Ec)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let u=0;uthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,g&&g(),g=BY(y,250),j0.hasAnimatedSinceResize&&(j0.hasAnimatedSinceResize=!1,this.nodes.forEach(_S))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&d&&(u||l)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:y,hasRelativeTargetChanged:A,layout:P})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const N=this.options.transition||d.getDefaultTransition()||tJ,{onLayoutAnimationStart:D,onLayoutAnimationComplete:k}=d.getProps(),B=!this.targetLayout||!gS(this.targetLayout,P)||A,j=!y&&A;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||j||y&&(B||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(g,j);const U={...wv(N,"layout"),onPlay:D,onComplete:k};(d.shouldReduceMotion||this.options.layoutRoot)&&(U.delay=0,U.type=!1),this.startAnimation(U)}else y||_S(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=P})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,ba(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(XY),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&yS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u{const K=U/1e3;ES(g.x,o.x,K),ES(g.y,o.y,K),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(nh(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),QY(this.relativeTarget,this.relativeTargetOrigin,y,K),j&&DY(this.relativeTarget,j)&&(this.isProjectionDirty=!1),j||(j=ln()),ns(j,this.relativeTarget)),N&&(this.animationValues=d,PY(d,l,this.latestValues,K,B,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=K},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(ba(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nr.update(()=>{j0.hasAnimatedSinceResize=!0,this.currentAnimation=FY(0,bS,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(bS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:u,layout:l,latestValues:d}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&IS(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||ln();const g=Ni(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+g;const y=Ni(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+y}ns(a,u),zu(a,d),rh(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new OY),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(a=!0),!a)return;const l={};u.z&&cb("z",o,l,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(xS),this.root.sharedNodes.clear()}}}function qY(t){t.updateLayout()}function zY(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?rs(g=>{const y=o?r.measuredBox[g]:r.layoutBox[g],A=Ni(y);y.min=n[g].min,y.max=y.min+A}):IS(s,r.layoutBox,n)&&rs(g=>{const y=o?r.measuredBox[g]:r.layoutBox[g],A=Ni(n[g]);y.max=y.min+A,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[g].max=t.relativeTarget[g].min+A)});const a=Uu();rh(a,n,r.layoutBox);const u=Uu();o?rh(u,t.applyTransform(i,!0),r.measuredBox):rh(u,n,r.layoutBox);const l=!hS(a);let d=!1;if(!t.resumeFrom){const g=t.getClosestProjectingParent();if(g&&!g.resumeFrom){const{snapshot:y,layout:A}=g;if(y&&A){const P=ln();nh(P,r.layoutBox,y.layoutBox);const N=ln();nh(N,n,A.layoutBox),gS(P,N)||(d=!0),g.options.layoutRoot&&(t.relativeTarget=N,t.relativeTargetOrigin=P,t.relativeParent=g)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:u,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function HY(t){sh&&Ec.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function WY(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function KY(t){t.clearSnapshot()}function xS(t){t.clearMeasurements()}function VY(t){t.isLayoutDirty=!1}function GY(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function _S(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function YY(t){t.resolveTargetDelta()}function JY(t){t.calcProjection()}function XY(t){t.resetSkewAndRotation()}function ZY(t){t.removeLeadSnapshot()}function ES(t,e,r){t.translate=Zr(e.translate,0,r),t.scale=Zr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function SS(t,e,r,n){t.min=Zr(e.min,r.min,n),t.max=Zr(e.max,r.max,n)}function QY(t,e,r,n){SS(t.x,e.x,r.x,n),SS(t.y,e.y,r.y,n)}function eJ(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const tJ={duration:.45,ease:[.4,0,.1,1]},AS=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),PS=AS("applewebkit/")&&!AS("chrome/")?Math.round:Wn;function MS(t){t.min=PS(t.min),t.max=PS(t.max)}function rJ(t){MS(t.x),MS(t.y)}function IS(t,e,r){return t==="position"||t==="preserve-aspect"&&!nY(mS(e),mS(r),.2)}function nJ(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const iJ=wS({attachResizeListener:(t,e)=>Lo(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ub={current:void 0},CS=wS({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!ub.current){const t=new iJ({});t.mount(window),t.setOptions({layoutScroll:!0}),ub.current=t}return ub.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),sJ={pan:{Feature:yY},drag:{Feature:bY,ProjectionNode:CS,MeasureLayout:eS}};function TS(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||CE())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const u=a[n];u&&Nr.postRender(()=>u(s,o))};return ko(t.current,r,i,{passive:!t.getProps()[n]})}class oJ extends _a{mount(){this.unmount=No(TS(this.node,!0),TS(this.node,!1))}unmount(){}}class aJ extends _a{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=No(Lo(this.node.current,"focus",()=>this.onFocus()),Lo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const RS=(t,e)=>e?t===e?!0:RS(t,e.parentElement):!1;function fb(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,k0(r))}class cJ extends _a{constructor(){super(...arguments),this.removeStartListeners=Wn,this.removeEndListeners=Wn,this.removeAccessibleListeners=Wn,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=ko(window,"pointerup",(a,u)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:d,globalTapTarget:g}=this.node.getProps(),y=!g&&!RS(this.node.current,a.target)?d:l;y&&Nr.update(()=>y(a,u))},{passive:!(n.onTap||n.onPointerUp)}),o=ko(window,"pointercancel",(a,u)=>this.cancelPress(a,u),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=No(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||fb("up",(u,l)=>{const{onTap:d}=this.node.getProps();d&&Nr.postRender(()=>d(u,l))})};this.removeEndListeners(),this.removeEndListeners=Lo(this.node.current,"keyup",o),fb("down",(a,u)=>{this.startPress(a,u)})},r=Lo(this.node.current,"keydown",e),n=()=>{this.isPressing&&fb("cancel",(s,o)=>this.cancelPress(s,o))},i=Lo(this.node.current,"blur",n);this.removeAccessibleListeners=No(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Nr.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!CE()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Nr.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=ko(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=Lo(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=No(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const lb=new WeakMap,hb=new WeakMap,uJ=t=>{const e=lb.get(t.target);e&&e(t)},fJ=t=>{t.forEach(uJ)};function lJ({root:t,...e}){const r=t||document;hb.has(r)||hb.set(r,{});const n=hb.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(fJ,{root:t,...e})),n[i]}function hJ(t,e,r){const n=lJ(e);return lb.set(t,r),n.observe(t),()=>{lb.delete(t),n.unobserve(t)}}const dJ={some:0,all:1};class pJ extends _a{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:dJ[i]},a=u=>{const{isIntersecting:l}=u;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:g}=this.node.getProps(),y=l?d:g;y&&y(u)};return hJ(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(gJ(e,r))&&this.startObserver()}unmount(){}}function gJ({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const mJ={inView:{Feature:pJ},tap:{Feature:cJ},focus:{Feature:aJ},hover:{Feature:oJ}},vJ={layout:{ProjectionNode:CS,MeasureLayout:eS}},db=Se.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),z0=Se.createContext({}),pb=typeof window<"u",DS=pb?Se.useLayoutEffect:Se.useEffect,OS=Se.createContext({strict:!1});function bJ(t,e,r,n,i){var s,o;const{visualElement:a}=Se.useContext(z0),u=Se.useContext(OS),l=Se.useContext(F0),d=Se.useContext(db).reducedMotion,g=Se.useRef();n=n||u.renderer,!g.current&&n&&(g.current=n(t,{visualState:e,parent:a,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d}));const y=g.current,A=Se.useContext(ZE);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&yJ(g.current,r,i,A);const P=Se.useRef(!1);Se.useInsertionEffect(()=>{y&&P.current&&y.update(r,l)});const N=r[gE],D=Se.useRef(!!N&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,N))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,N)));return DS(()=>{y&&(P.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),ob.render(y.render),D.current&&y.animationState&&y.animationState.animateChanges())}),Se.useEffect(()=>{y&&(!D.current&&y.animationState&&y.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{var k;(k=window.MotionHandoffMarkAsComplete)===null||k===void 0||k.call(window,N)}),D.current=!1))}),y}function yJ(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:u,layoutRoot:l}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:NS(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&ju(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:u,layoutRoot:l})}function NS(t){if(t)return t.options.allowProjection!==!1?t.projection:NS(t.parent)}function wJ(t,e,r){return Se.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):ju(r)&&(r.current=n))},[e])}function H0(t){return P0(t.animate)||yv.some(e=>Vl(t[e]))}function LS(t){return!!(H0(t)||t.variants)}function xJ(t,e){if(H0(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Vl(r)?r:void 0,animate:Vl(n)?n:void 0}}return t.inherit!==!1?e:{}}function _J(t){const{initial:e,animate:r}=xJ(t,Se.useContext(z0));return Se.useMemo(()=>({initial:e,animate:r}),[kS(e),kS(r)])}function kS(t){return Array.isArray(t)?t.join(" "):t}const BS={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Hu={};for(const t in BS)Hu[t]={isEnabled:e=>BS[t].some(r=>!!e[r])};function EJ(t){for(const e in t)Hu[e]={...Hu[e],...t[e]}}const SJ=Symbol.for("motionComponentSymbol");function AJ({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&EJ(t);function s(a,u){let l;const d={...Se.useContext(db),...a,layoutId:PJ(a)},{isStatic:g}=d,y=_J(a),A=n(a,g);if(!g&&pb){MJ(d,t);const P=IJ(d);l=P.MeasureLayout,y.visualElement=bJ(i,A,d,e,P.ProjectionNode)}return ge.jsxs(z0.Provider,{value:y,children:[l&&y.visualElement?ge.jsx(l,{visualElement:y.visualElement,...d}):null,r(i,a,wJ(A,y.visualElement,u),A,g,y.visualElement)]})}const o=Se.forwardRef(s);return o[SJ]=i,o}function PJ({layoutId:t}){const e=Se.useContext(sb).id;return e&&t!==void 0?e+"-"+t:t}function MJ(t,e){const r=Se.useContext(OS).strict;if(process.env.NODE_ENV!=="production"&&e&&r){const n="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?Lu(!1,n):Oo(!1,n)}}function IJ(t){const{drag:e,layout:r}=Hu;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const CJ=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function gb(t){return typeof t!="string"||t.includes("-")?!1:!!(CJ.indexOf(t)>-1||/[A-Z]/u.test(t))}function $S(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const FS=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function jS(t,e,r,n){$S(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(FS.has(i)?i:Jv(i),e.attrs[i])}function US(t,{layout:e,layoutId:r}){return bc.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!U0[t]||t==="opacity")}function mb(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(Qn(i[o])||e.style&&Qn(e.style[o])||US(o,t)||((n=r==null?void 0:r.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function qS(t,e,r){const n=mb(t,e,r);for(const i in t)if(Qn(t[i])||Qn(e[i])){const s=Gl.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function vb(t){const e=Se.useRef(null);return e.current===null&&(e.current=t()),e.current}function TJ({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:RJ(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const zS=t=>(e,r)=>{const n=Se.useContext(z0),i=Se.useContext(F0),s=()=>TJ(t,e,n,i);return r?s():vb(s)};function RJ(t,e,r,n){const i={},s=n(t,{});for(const y in s)i[y]=q0(s[y]);let{initial:o,animate:a}=t;const u=H0(t),l=LS(t);e&&l&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const g=d?a:o;if(g&&typeof g!="boolean"&&!P0(g)){const y=Array.isArray(g)?g:[g];for(let A=0;A({style:{},transform:{},transformOrigin:{},vars:{}}),HS=()=>({...bb(),attrs:{}}),WS=(t,e)=>e&&typeof t=="number"?e.transform(t):t,DJ={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},OJ=Gl.length;function NJ(t,e,r){let n="",i=!0;for(let s=0;stypeof t=="string"&&t.toLowerCase()==="svg",FJ={useVisualState:zS({scrapeMotionValuesFromProps:qS,createRenderState:HS,onMount:(t,e,{renderState:r,latestValues:n})=>{Nr.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),Nr.render(()=>{wb(r,n,xb(e.tagName),t.transformTemplate),jS(e,r)})}})},jJ={useVisualState:zS({scrapeMotionValuesFromProps:mb,createRenderState:bb})};function VS(t,e,r){for(const n in e)!Qn(e[n])&&!US(n,r)&&(t[n]=e[n])}function UJ({transformTemplate:t},e){return Se.useMemo(()=>{const r=bb();return yb(r,e,t),Object.assign({},r.vars,r.style)},[e])}function qJ(t,e){const r=t.style||{},n={};return VS(n,r,t),Object.assign(n,UJ(t,e)),n}function zJ(t,e){const r={},n=qJ(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const HJ=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function W0(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||HJ.has(t)}let GS=t=>!W0(t);function WJ(t){t&&(GS=e=>e.startsWith("on")?!W0(e):t(e))}try{WJ(require("@emotion/is-prop-valid").default)}catch{}function KJ(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(GS(i)||r===!0&&W0(i)||!e&&!W0(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function VJ(t,e,r,n){const i=Se.useMemo(()=>{const s=HS();return wb(s,e,xb(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};VS(s,t.style,t),i.style={...s,...i.style}}return i}function GJ(t=!1){return(r,n,i,{latestValues:s},o)=>{const u=(gb(r)?VJ:zJ)(n,s,o,r),l=KJ(n,typeof r=="string",t),d=r!==Se.Fragment?{...l,...u,ref:i}:{},{children:g}=n,y=Se.useMemo(()=>Qn(g)?g.get():g,[g]);return Se.createElement(r,{...d,children:y})}}function YJ(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...gb(n)?FJ:jJ,preloadedFeatures:t,useRender:GJ(i),createVisualElement:e,Component:n};return AJ(o)}}const _b={current:null},YS={current:!1};function JJ(){if(YS.current=!0,!!pb)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>_b.current=t.matches;t.addListener(e),e()}else _b.current=!1}function XJ(t,e,r){for(const n in e){const i=e[n],s=r[n];if(Qn(i))t.addValue(n,i),process.env.NODE_ENV==="development"&&A0(i.version==="11.11.17",`Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`);else if(Qn(s))t.addValue(n,th(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,th(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const JS=new WeakMap,ZJ=[...N8,Zn,xa],QJ=t=>ZJ.find(O8(t)),XS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class eX{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Mv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=to.now();this.renderScheduledAtthis.bindToMotionValue(n,r)),YS.current||JJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:_b.current,process.env.NODE_ENV!=="production"&&A0(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){JS.delete(this.current),this.projection&&this.projection.unmount(),ba(this.notifyUpdate),ba(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=bc.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Nr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Hu){const r=Hu[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ln()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=th(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(A8(i)||S8(i))?i=parseFloat(i):!QJ(i)&&xa.test(r)&&(i=W8(e,r)),this.setBaseTarget(e,Qn(i)?i.get():i)),Qn(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=vv(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Qn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new Yv),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class ZS extends eX{constructor(){super(...arguments),this.KeyframeResolver=K8}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function tX(t){return window.getComputedStyle(t)}class rX extends ZS{constructor(){super(...arguments),this.type="html",this.renderInstance=$S}readValueFromInstance(e,r){if(bc.has(r)){const n=Nv(r);return n&&n.default||0}else{const n=tX(e),i=(M8(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return YE(e,r)}build(e,r,n){yb(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return mb(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Qn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class nX extends ZS{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ln}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(bc.has(r)){const n=Nv(r);return n&&n.default||0}return r=FS.has(r)?r:Jv(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return qS(e,r,n)}build(e,r,n){wb(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){jS(e,r,n,i)}mount(e){this.isSVGTag=xb(e.tagName),super.mount(e)}}const iX=(t,e)=>gb(t)?new nX(e):new rX(e,{allowProjection:t!==Se.Fragment}),sX=YJ({...GG,...mJ,...sJ,...vJ},iX),oX=UK(sX);class aX extends Yt.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function cX({children:t,isPresent:e}){const r=Se.useId(),n=Se.useRef(null),i=Se.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=Se.useContext(db);return Se.useInsertionEffect(()=>{const{width:o,height:a,top:u,left:l}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` + */const jK=ts("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]),h8=new Set;function A0(t,e,r){t||h8.has(e)||(console.warn(e),h8.add(e))}function UK(t){if(typeof Proxy>"u")return t;const e=new Map,r=(...n)=>(process.env.NODE_ENV!=="production"&&A0(!1,"motion() is deprecated. Use motion.create() instead."),t(...n));return new Proxy(r,{get:(n,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}function P0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const mv=t=>Array.isArray(t);function d8(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function vv(t,e,r,n){if(typeof e=="function"){const[i,s]=p8(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=p8(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function M0(t,e,r){const n=t.getProps();return vv(n,e,r!==void 0?r:n.custom,t)}const bv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],yv=["initial",...bv],Gl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],bc=new Set(Gl),Qs=t=>t*1e3,Do=t=>t/1e3,qK={type:"spring",stiffness:500,damping:25,restSpeed:10},zK=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),HK={type:"keyframes",duration:.8},WK={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},KK=(t,{keyframes:e})=>e.length>2?HK:bc.has(t)?t.startsWith("scale")?zK(e[1]):qK:WK;function wv(t,e){return t?t[e]||t.default||t:void 0}const VK={useManualTiming:!1},GK=t=>t!==null;function I0(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(GK),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const Wn=t=>t;function YK(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){s.has(l)&&(u.schedule(l),t()),l(o)}const u={schedule:(l,d=!1,p=!1)=>{const A=p&&n?e:r;return d&&s.add(l),A.has(l)||A.add(l),l},cancel:l=>{r.delete(l),s.delete(l)},process:l=>{if(o=l,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,u.process(l))}};return u}const C0=["read","resolveKeyframes","update","preRender","render","postRender"],JK=40;function g8(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=C0.reduce((k,B)=>(k[B]=YK(s),k),{}),{read:a,resolveKeyframes:u,update:l,preRender:d,render:p,postRender:y}=o,A=()=>{const k=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(k-i.timestamp,JK),1),i.timestamp=k,i.isProcessing=!0,a.process(i),u.process(i),l.process(i),d.process(i),p.process(i),y.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(A))},P=()=>{r=!0,n=!0,i.isProcessing||t(A)};return{schedule:C0.reduce((k,B)=>{const j=o[B];return k[B]=(U,K=!1,J=!1)=>(r||P(),j.schedule(U,K,J)),k},{}),cancel:k=>{for(let B=0;B(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,XK=1e-7,ZK=12;function QK(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=m8(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>XK&&++aQK(s,0,1,t,r);return s=>s===0||s===1?s:m8(i(s),e,n)}const v8=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,b8=t=>e=>1-t(1-e),y8=Yl(.33,1.53,.69,.99),_v=b8(y8),w8=v8(_v),x8=t=>(t*=2)<1?.5*_v(t):.5*(2-Math.pow(2,-10*(t-1))),Ev=t=>1-Math.sin(Math.acos(t)),_8=b8(Ev),E8=v8(Ev),S8=t=>/^0[^.\s]+$/u.test(t);function eV(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||S8(t):!0}let Lu=Wn,Oo=Wn;process.env.NODE_ENV!=="production"&&(Lu=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},Oo=(t,e)=>{if(!t)throw new Error(e)});const A8=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),P8=t=>e=>typeof e=="string"&&e.startsWith(t),M8=P8("--"),tV=P8("var(--"),Sv=t=>tV(t)?rV.test(t.split("/*")[0].trim()):!1,rV=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,nV=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function iV(t){const e=nV.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}const sV=4;function I8(t,e,r=1){Oo(r<=sV,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[n,i]=iV(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return A8(o)?parseFloat(o):o}return Sv(i)?I8(i,e,r+1):i}const ya=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},Jl={...ku,transform:t=>ya(0,1,t)},T0={...ku,default:1},Xl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),wa=Xl("deg"),eo=Xl("%"),zt=Xl("px"),oV=Xl("vh"),aV=Xl("vw"),C8={...eo,parse:t=>eo.parse(t)/100,transform:t=>eo.transform(t*100)},cV=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),T8=t=>t===ku||t===zt,R8=(t,e)=>parseFloat(t.split(", ")[e]),D8=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return R8(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?R8(s[1],t):0}},uV=new Set(["x","y","z"]),fV=Gl.filter(t=>!uV.has(t));function lV(t){const e=[];return fV.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const Bu={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:D8(4,13),y:D8(5,14)};Bu.translateX=Bu.x,Bu.translateY=Bu.y;const O8=t=>e=>e.test(t),N8=[ku,zt,eo,wa,aV,oV,{test:t=>t==="auto",parse:t=>t}],L8=t=>N8.find(O8(t)),yc=new Set;let Av=!1,Pv=!1;function k8(){if(Pv){const t=Array.from(yc).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=lV(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}Pv=!1,Av=!1,yc.forEach(t=>t.complete()),yc.clear()}function B8(){yc.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Pv=!0)})}function hV(){B8(),k8()}class Mv{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(yc.add(this),Av||(Av=!0,Nr.read(B8),Nr.resolveKeyframes(k8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sMath.round(t*1e5)/1e5,Iv=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function dV(t){return t==null}const pV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Cv=(t,e)=>r=>!!(typeof r=="string"&&pV.test(r)&&r.startsWith(t)||e&&!dV(r)&&Object.prototype.hasOwnProperty.call(r,e)),$8=(t,e,r)=>n=>{if(typeof n!="string")return n;const[i,s,o,a]=n.match(Iv);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},gV=t=>ya(0,255,t),Tv={...ku,transform:t=>Math.round(gV(t))},wc={test:Cv("rgb","red"),parse:$8("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+Tv.transform(t)+", "+Tv.transform(e)+", "+Tv.transform(r)+", "+Zl(Jl.transform(n))+")"};function mV(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const Rv={test:Cv("#"),parse:mV,transform:wc.transform},$u={test:Cv("hsl","hue"),parse:$8("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+eo.transform(Zl(e))+", "+eo.transform(Zl(r))+", "+Zl(Jl.transform(n))+")"},Zn={test:t=>wc.test(t)||Rv.test(t)||$u.test(t),parse:t=>wc.test(t)?wc.parse(t):$u.test(t)?$u.parse(t):Rv.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?wc.transform(t):$u.transform(t)},vV=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function bV(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Iv))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(vV))===null||r===void 0?void 0:r.length)||0)>0}const F8="number",j8="color",yV="var",wV="var(",U8="${}",xV=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ql(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(xV,u=>(Zn.test(u)?(n.color.push(s),i.push(j8),r.push(Zn.parse(u))):u.startsWith(wV)?(n.var.push(s),i.push(yV),r.push(u)):(n.number.push(s),i.push(F8),r.push(parseFloat(u))),++s,U8)).split(U8);return{values:r,split:a,indexes:n,types:i}}function q8(t){return Ql(t).values}function z8(t){const{split:e,types:r}=Ql(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function EV(t){const e=q8(t);return z8(t)(e.map(_V))}const xa={test:bV,parse:q8,createTransformer:z8,getAnimatableNone:EV},SV=new Set(["brightness","contrast","saturate","opacity"]);function AV(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(Iv)||[];if(!n)return t;const i=r.replace(n,"");let s=SV.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const PV=/\b([a-z-]*)\(.*?\)/gu,Dv={...xa,getAnimatableNone:t=>{const e=t.match(PV);return e?e.map(AV).join(" "):t}},MV={borderWidth:zt,borderTopWidth:zt,borderRightWidth:zt,borderBottomWidth:zt,borderLeftWidth:zt,borderRadius:zt,radius:zt,borderTopLeftRadius:zt,borderTopRightRadius:zt,borderBottomRightRadius:zt,borderBottomLeftRadius:zt,width:zt,maxWidth:zt,height:zt,maxHeight:zt,top:zt,right:zt,bottom:zt,left:zt,padding:zt,paddingTop:zt,paddingRight:zt,paddingBottom:zt,paddingLeft:zt,margin:zt,marginTop:zt,marginRight:zt,marginBottom:zt,marginLeft:zt,backgroundPositionX:zt,backgroundPositionY:zt},IV={rotate:wa,rotateX:wa,rotateY:wa,rotateZ:wa,scale:T0,scaleX:T0,scaleY:T0,scaleZ:T0,skew:wa,skewX:wa,skewY:wa,distance:zt,translateX:zt,translateY:zt,translateZ:zt,x:zt,y:zt,z:zt,perspective:zt,transformPerspective:zt,opacity:Jl,originX:C8,originY:C8,originZ:zt},H8={...ku,transform:Math.round},Ov={...MV,...IV,zIndex:H8,size:zt,fillOpacity:Jl,strokeOpacity:Jl,numOctaves:H8},CV={...Ov,color:Zn,backgroundColor:Zn,outlineColor:Zn,fill:Zn,stroke:Zn,borderColor:Zn,borderTopColor:Zn,borderRightColor:Zn,borderBottomColor:Zn,borderLeftColor:Zn,filter:Dv,WebkitFilter:Dv},Nv=t=>CV[t];function W8(t,e){let r=Nv(t);return r!==Dv&&(r=xa),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const TV=new Set(["auto","none","0"]);function RV(t,e,r){let n=0,i;for(;n{r.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function Lv(t){return typeof t=="function"}let R0;function DV(){R0=void 0}const to={now:()=>(R0===void 0&&to.set(Kn.isProcessing||VK.useManualTiming?Kn.timestamp:performance.now()),R0),set:t=>{R0=t,queueMicrotask(DV)}},V8=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(xa.test(t)||t==="0")&&!t.startsWith("url("));function OV(t){const e=t[0];if(t.length===1)return!0;for(let r=0;rLV?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&hV(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=to.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:u,isGenerator:l}=this.options;if(!l&&!NV(e,n,i,s))if(o)this.options.duration=0;else{u==null||u(I0(e,this.options,r)),a==null||a(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,r);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...d},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function Y8(t,e){return e?t*(1e3/e):0}const kV=5;function J8(t,e,r){const n=Math.max(e-kV,0);return Y8(r-t(n),e-n)}const kv=.001,BV=.01,X8=10,$V=.05,FV=1;function jV({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;Lu(t<=Qs(X8),"Spring duration must be 10 seconds or less");let o=1-e;o=ya($V,FV,o),t=ya(BV,X8,Do(t)),o<1?(i=l=>{const d=l*o,p=d*t,y=d-r,A=Bv(l,o),P=Math.exp(-p);return kv-y/A*P},s=l=>{const p=l*o*t,y=p*r+r,A=Math.pow(o,2)*Math.pow(l,2)*t,P=Math.exp(-p),N=Bv(Math.pow(l,2),o);return(-i(l)+kv>0?-1:1)*((y-A)*P)/N}):(i=l=>{const d=Math.exp(-l*t),p=(l-r)*t+1;return-kv+d*p},s=l=>{const d=Math.exp(-l*t),p=(r-l)*(t*t);return d*p});const a=5/t,u=qV(i,s,a);if(t=Qs(t),isNaN(u))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(u,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:t}}}const UV=12;function qV(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function WV(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!Z8(t,HV)&&Z8(t,zV)){const r=jV(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function Q8({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:u,mass:l,duration:d,velocity:p,isResolvedFromDuration:y}=WV({...n,velocity:-Do(n.velocity||0)}),A=p||0,P=u/(2*Math.sqrt(a*l)),N=s-i,D=Do(Math.sqrt(a/l)),k=Math.abs(N)<5;r||(r=k?.01:2),e||(e=k?.005:.5);let B;if(P<1){const j=Bv(D,P);B=U=>{const K=Math.exp(-P*D*U);return s-K*((A+P*D*N)/j*Math.sin(j*U)+N*Math.cos(j*U))}}else if(P===1)B=j=>s-Math.exp(-D*j)*(N+(A+D*N)*j);else{const j=D*Math.sqrt(P*P-1);B=U=>{const K=Math.exp(-P*D*U),J=Math.min(j*U,300);return s-K*((A+P*D*N)*Math.sinh(J)+j*N*Math.cosh(J))/j}}return{calculatedDuration:y&&d||null,next:j=>{const U=B(j);if(y)o.done=j>=d;else{let K=0;P<1&&(K=j===0?Qs(A):J8(B,j,U));const J=Math.abs(K)<=r,T=Math.abs(s-U)<=e;o.done=J&&T}return o.value=o.done?s:U,o}}}function eE({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:d}){const p=t[0],y={done:!1,value:p},A=z=>a!==void 0&&zu,P=z=>a===void 0?u:u===void 0||Math.abs(a-z)-N*Math.exp(-z/n),j=z=>k+B(z),U=z=>{const ue=B(z),_e=j(z);y.done=Math.abs(ue)<=l,y.value=y.done?k:_e};let K,J;const T=z=>{A(y.value)&&(K=z,J=Q8({keyframes:[y.value,P(y.value)],velocity:J8(j,z,y.value),damping:i,stiffness:s,restDelta:l,restSpeed:d}))};return T(0),{calculatedDuration:null,next:z=>{let ue=!1;return!J&&K===void 0&&(ue=!0,U(z),T(z)),K!==void 0&&z>=K?J.next(z-K):(!ue&&U(z),y)}}}const KV=Yl(.42,0,1,1),VV=Yl(0,0,.58,1),tE=Yl(.42,0,.58,1),GV=t=>Array.isArray(t)&&typeof t[0]!="number",$v=t=>Array.isArray(t)&&typeof t[0]=="number",rE={linear:Wn,easeIn:KV,easeInOut:tE,easeOut:VV,circIn:Ev,circInOut:E8,circOut:_8,backIn:_v,backInOut:w8,backOut:y8,anticipate:x8},nE=t=>{if($v(t)){Oo(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,r,n,i]=t;return Yl(e,r,n,i)}else if(typeof t=="string")return Oo(rE[t]!==void 0,`Invalid easing type '${t}'`),rE[t];return t},YV=(t,e)=>r=>e(t(r)),No=(...t)=>t.reduce(YV),Fu=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},Zr=(t,e,r)=>t+(e-t)*r;function Fv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function JV({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,u=2*r-a;i=Fv(u,a,t+1/3),s=Fv(u,a,t),o=Fv(u,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function D0(t,e){return r=>r>0?e:t}const jv=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},XV=[Rv,wc,$u],ZV=t=>XV.find(e=>e.test(t));function iE(t){const e=ZV(t);if(Lu(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let r=e.parse(t);return e===$u&&(r=JV(r)),r}const sE=(t,e)=>{const r=iE(t),n=iE(e);if(!r||!n)return D0(t,e);const i={...r};return s=>(i.red=jv(r.red,n.red,s),i.green=jv(r.green,n.green,s),i.blue=jv(r.blue,n.blue,s),i.alpha=Zr(r.alpha,n.alpha,s),wc.transform(i))},Uv=new Set(["none","hidden"]);function QV(t,e){return Uv.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function eG(t,e){return r=>Zr(t,e,r)}function qv(t){return typeof t=="number"?eG:typeof t=="string"?Sv(t)?D0:Zn.test(t)?sE:nG:Array.isArray(t)?oE:typeof t=="object"?Zn.test(t)?sE:tG:D0}function oE(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>qv(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function rG(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=xa.createTransformer(e),n=Ql(t),i=Ql(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?Uv.has(t)&&!i.values.length||Uv.has(e)&&!n.values.length?QV(t,e):No(oE(rG(n,i),i.values),r):(Lu(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),D0(t,e))};function aE(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Zr(t,e,r):qv(t)(t,e)}function iG(t,e,r){const n=[],i=r||aE,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=iG(e,n,i),a=o.length,u=l=>{let d=0;if(a>1)for(;du(ya(t[0],t[s-1],l)):u}function oG(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=Fu(0,e,n);t.push(Zr(r,1,i))}}function aG(t){const e=[0];return oG(e,t.length-1),e}function cG(t,e){return t.map(r=>r*e)}function uG(t,e){return t.map(()=>e||tE).splice(0,t.length-1)}function O0({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=GV(n)?n.map(nE):nE(n),s={done:!1,value:e[0]},o=cG(r&&r.length===e.length?r:aG(e),t),a=sG(o,e,{ease:Array.isArray(i)?i:uG(e,i)});return{calculatedDuration:t,next:u=>(s.value=a(u),s.done=u>=t,s)}}const cE=2e4;function fG(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=cE?1/0:e}const lG=t=>{const e=({timestamp:r})=>t(r);return{start:()=>Nr.update(e,!0),stop:()=>ba(e),now:()=>Kn.isProcessing?Kn.timestamp:to.now()}},hG={decay:eE,inertia:eE,tween:O0,keyframes:O0,spring:Q8},dG=t=>t/100;class zv extends G8{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:u}=this.options;u&&u()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Mv,a=(u,l)=>this.onKeyframesResolved(u,l);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=Lv(r)?r:hG[r]||O0;let u,l;a!==O0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&Oo(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),u=No(dG,aE(e[0],e[1])),e=[0,100]);const d=a({...this.options,keyframes:e});s==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=fG(d));const{calculatedDuration:p}=d,y=p+i,A=y*(n+1)-i;return{generator:d,mirroredGenerator:l,mapPercentToKeyframes:u,calculatedDuration:p,resolvedDuration:y,totalDuration:A}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:z}=this.options;return{done:!0,value:z[z.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:u,calculatedDuration:l,totalDuration:d,resolvedDuration:p}=n;if(this.startTime===null)return s.next(0);const{delay:y,repeat:A,repeatType:P,repeatDelay:N,onUpdate:D}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const k=this.currentTime-y*(this.speed>=0?1:-1),B=this.speed>=0?k<0:k>d;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let j=this.currentTime,U=s;if(A){const z=Math.min(this.currentTime,d)/p;let ue=Math.floor(z),_e=z%1;!_e&&z>=1&&(_e=1),_e===1&&ue--,ue=Math.min(ue,A+1),!!(ue%2)&&(P==="reverse"?(_e=1-_e,N&&(_e-=N/p)):P==="mirror"&&(U=o)),j=ya(0,1,_e)*p}const K=B?{done:!1,value:u[0]}:U.next(j);a&&(K.value=a(K.value));let{done:J}=K;!B&&l!==null&&(J=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&J);return T&&i!==void 0&&(K.value=I0(u,this.options,i)),D&&D(K.value),T&&this.finish(),K}get duration(){const{resolved:e}=this;return e?Do(e.calculatedDuration):0}get time(){return Do(this.currentTime)}set time(e){e=Qs(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=Do(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=lG,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const pG=new Set(["opacity","clipPath","filter","transform"]),gG=10,mG=(t,e)=>{let r="";const n=Math.max(Math.round(e/gG),2);for(let i=0;i(e===void 0&&(e=t()),e)}const vG={linearEasing:void 0};function bG(t,e){const r=Hv(t);return()=>{var n;return(n=vG[e])!==null&&n!==void 0?n:r()}}const N0=bG(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function uE(t){return!!(typeof t=="function"&&N0()||!t||typeof t=="string"&&(t in Wv||N0())||$v(t)||Array.isArray(t)&&t.every(uE))}const eh=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,Wv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:eh([0,.65,.55,1]),circOut:eh([.55,0,1,.45]),backIn:eh([.31,.01,.66,-.59]),backOut:eh([.33,1.53,.69,.99])};function fE(t,e){if(t)return typeof t=="function"&&N0()?mG(t,e):$v(t)?eh(t):Array.isArray(t)?t.map(r=>fE(r,e)||Wv.easeOut):Wv[t]}function yG(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:u}={}){const l={[e]:r};u&&(l.offset=u);const d=fE(a,i);return Array.isArray(d)&&(l.easing=d),t.animate(l,{delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function lE(t,e){t.timeline=e,t.onfinish=null}const wG=Hv(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),L0=10,xG=2e4;function _G(t){return Lv(t.type)||t.type==="spring"||!uE(t.ease)}function EG(t,e){const r=new zv({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&sthis.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:u,name:l,startTime:d}=this.options;if(!(!((n=u.owner)===null||n===void 0)&&n.current))return!1;if(typeof o=="string"&&N0()&&SG(o)&&(o=hE[o]),_G(this.options)){const{onComplete:y,onUpdate:A,motionValue:P,element:N,...D}=this.options,k=EG(e,D);e=k.keyframes,e.length===1&&(e[1]=e[0]),i=k.duration,s=k.times,o=k.ease,a="keyframes"}const p=yG(u.owner.current,l,e,{...this.options,duration:i,times:s,ease:o});return p.startTime=d??this.calcStartTime(),this.pendingTimeline?(lE(p,this.pendingTimeline),this.pendingTimeline=void 0):p.onfinish=()=>{const{onComplete:y}=this.options;u.set(I0(e,this.options,r)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:p,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return Do(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return Do(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=Qs(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return Wn;const{animation:n}=r;lE(n,e)}return Wn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:d,onComplete:p,element:y,...A}=this.options,P=new zv({...A,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),N=Qs(this.time);l.setWithVelocity(P.sample(N-L0).value,P.sample(N).value,L0)}const{onStop:u}=this.options;u&&u(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return wG()&&n&&pG.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}const AG=Hv(()=>window.ScrollTimeline!==void 0);class PG{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;nAG()&&i.attachTimeline?i.attachTimeline(e):r(i));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function MG({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:u,elapsed:l,...d}){return!!Object.keys(d).length}const Kv=(t,e,r,n={},i,s)=>o=>{const a=wv(n,t)||{},u=a.delay||n.delay||0;let{elapsed:l=0}=n;l=l-Qs(u);let d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:y=>{e.set(y),a.onUpdate&&a.onUpdate(y)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:i};MG(a)||(d={...d,...KK(t,d)}),d.duration&&(d.duration=Qs(d.duration)),d.repeatDelay&&(d.repeatDelay=Qs(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let p=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(p=!0)),p&&!s&&e.get()!==void 0){const y=I0(d.keyframes,a);if(y!==void 0)return Nr.update(()=>{d.onUpdate(y),d.onComplete()}),new PG([])}return!s&&dE.supports(d)?new dE(d):new zv(d)},IG=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),CG=t=>mv(t)?t[t.length-1]||0:t;function Vv(t,e){t.indexOf(e)===-1&&t.push(e)}function Gv(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class Yv{constructor(){this.subscriptions=[]}add(e){return Vv(this.subscriptions,e),()=>Gv(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class RG{constructor(e,r={}){this.version="11.11.17",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=to.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=to.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=TG(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&A0(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new Yv);const n=this.events[e].add(r);return e==="change"?()=>{n(),Nr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=to.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>pE)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,pE);return Y8(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function th(t,e){return new RG(t,e)}function DG(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,th(r))}function OG(t,e){const r=M0(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=CG(s[o]);DG(t,o,a)}}const Jv=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),gE="data-"+Jv("framerAppearId");function mE(t){return t.props[gE]}const Qn=t=>!!(t&&t.getVelocity);function NG(t){return!!(Qn(t)&&t.add)}function Xv(t,e){const r=t.getValue("willChange");if(NG(r))return r.add(e)}function LG({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function vE(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...u}=e;n&&(o=n);const l=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const p in u){const y=t.getValue(p,(s=t.latestValues[p])!==null&&s!==void 0?s:null),A=u[p];if(A===void 0||d&&LG(d,p))continue;const P={delay:r,...wv(o||{},p)};let N=!1;if(window.MotionHandoffAnimation){const k=mE(t);if(k){const B=window.MotionHandoffAnimation(k,p,Nr);B!==null&&(P.startTime=B,N=!0)}}Xv(t,p),y.start(Kv(p,y,A,t.shouldReduceMotion&&bc.has(p)?{type:!1}:P,t,N));const D=y.animation;D&&l.push(D)}return a&&Promise.all(l).then(()=>{Nr.update(()=>{a&&OG(t,a)})}),l}function Zv(t,e,r={}){var n;const i=M0(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(vE(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:y}=s;return kG(t,e,d+l,p,y,r)}:()=>Promise.resolve(),{when:u}=s;if(u){const[l,d]=u==="beforeChildren"?[o,a]:[a,o];return l().then(()=>d())}else return Promise.all([o(),a(r.delay)])}function kG(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,u=i===1?(l=0)=>l*n:(l=0)=>a-l*n;return Array.from(t.variantChildren).sort(BG).forEach((l,d)=>{l.notify("AnimationStart",e),o.push(Zv(l,e,{...s,delay:r+u(d)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function BG(t,e){return t.sortNodePosition(e)}function $G(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>Zv(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=Zv(t,e,r);else{const i=typeof e=="function"?M0(t,e,r.custom):e;n=Promise.all(vE(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const FG=yv.length;function bE(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?bE(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;rPromise.all(e.map(({animation:r,options:n})=>$G(t,r,n)))}function zG(t){let e=qG(t),r=yE(),n=!0;const i=u=>(l,d)=>{var p;const y=M0(t,d,u==="exit"?(p=t.presenceContext)===null||p===void 0?void 0:p.custom:void 0);if(y){const{transition:A,transitionEnd:P,...N}=y;l={...l,...N,...P}}return l};function s(u){e=u(t)}function o(u){const{props:l}=t,d=bE(t.parent)||{},p=[],y=new Set;let A={},P=1/0;for(let D=0;DP&&U,ue=!1;const _e=Array.isArray(j)?j:[j];let G=_e.reduce(i(k),{});K===!1&&(G={});const{prevResolvedValues:E={}}=B,m={...E,...G},f=x=>{z=!0,y.has(x)&&(ue=!0,y.delete(x)),B.needsAnimating[x]=!0;const _=t.getValue(x);_&&(_.liveStyle=!1)};for(const x in m){const _=G[x],S=E[x];if(A.hasOwnProperty(x))continue;let b=!1;mv(_)&&mv(S)?b=!d8(_,S):b=_!==S,b?_!=null?f(x):y.add(x):_!==void 0&&y.has(x)?f(x):B.protectedKeys[x]=!0}B.prevProp=j,B.prevResolvedValues=G,B.isActive&&(A={...A,...G}),n&&t.blockInitialAnimation&&(z=!1),z&&(!(J&&T)||ue)&&p.push(..._e.map(x=>({animation:x,options:{type:k}})))}if(y.size){const D={};y.forEach(k=>{const B=t.getBaseTarget(k),j=t.getValue(k);j&&(j.liveStyle=!0),D[k]=B??null}),p.push({animation:D})}let N=!!p.length;return n&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(N=!1),n=!1,N?e(p):Promise.resolve()}function a(u,l){var d;if(r[u].isActive===l)return Promise.resolve();(d=t.variantChildren)===null||d===void 0||d.forEach(y=>{var A;return(A=y.animationState)===null||A===void 0?void 0:A.setActive(u,l)}),r[u].isActive=l;const p=o(u);for(const y in r)r[y].protectedKeys={};return p}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=yE(),n=!0}}}function HG(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!d8(e,t):!1}function xc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function yE(){return{animate:xc(!0),whileInView:xc(),whileHover:xc(),whileTap:xc(),whileDrag:xc(),whileFocus:xc(),exit:xc()}}class _a{constructor(e){this.isMounted=!1,this.node=e}update(){}}class WG extends _a{constructor(e){super(e),e.animationState||(e.animationState=zG(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();P0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let KG=0;class VG extends _a{constructor(){super(...arguments),this.id=KG++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const GG={animation:{Feature:WG},exit:{Feature:VG}},wE=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function k0(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const YG=t=>e=>wE(e)&&t(e,k0(e));function Lo(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function ko(t,e,r,n){return Lo(t,e,YG(r),n)}const xE=(t,e)=>Math.abs(t-e);function JG(t,e){const r=xE(t.x,e.x),n=xE(t.y,e.y);return Math.sqrt(r**2+n**2)}class _E{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=eb(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,A=JG(p.offset,{x:0,y:0})>=3;if(!y&&!A)return;const{point:P}=p,{timestamp:N}=Kn;this.history.push({...P,timestamp:N});const{onStart:D,onMove:k}=this.handlers;y||(D&&D(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,p)},this.handlePointerMove=(p,y)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=Qv(y,this.transformPagePoint),Nr.update(this.updatePoint,!0)},this.handlePointerUp=(p,y)=>{this.end();const{onEnd:A,onSessionEnd:P,resumeAnimation:N}=this.handlers;if(this.dragSnapToOrigin&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=eb(p.type==="pointercancel"?this.lastMoveEventInfo:Qv(y,this.transformPagePoint),this.history);this.startEvent&&A&&A(p,D),P&&P(p,D)},!wE(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=k0(e),a=Qv(o,this.transformPagePoint),{point:u}=a,{timestamp:l}=Kn;this.history=[{...u,timestamp:l}];const{onSessionStart:d}=r;d&&d(e,eb(a,this.history)),this.removeListeners=No(ko(this.contextWindow,"pointermove",this.handlePointerMove),ko(this.contextWindow,"pointerup",this.handlePointerUp),ko(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),ba(this.updatePoint)}}function Qv(t,e){return e?{point:e(t.point)}:t}function EE(t,e){return{x:t.x-e.x,y:t.y-e.y}}function eb({point:t},e){return{point:t,delta:EE(t,SE(e)),offset:EE(t,XG(e)),velocity:ZG(e,.1)}}function XG(t){return t[0]}function SE(t){return t[t.length-1]}function ZG(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=SE(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>Qs(e)));)r--;if(!n)return{x:0,y:0};const s=Do(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function AE(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const PE=AE("dragHorizontal"),ME=AE("dragVertical");function IE(t){let e=!1;if(t==="y")e=ME();else if(t==="x")e=PE();else{const r=PE(),n=ME();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function CE(){const t=IE(!0);return t?(t(),!1):!0}function ju(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const TE=1e-4,QG=1-TE,eY=1+TE,RE=.01,tY=0-RE,rY=0+RE;function Ni(t){return t.max-t.min}function nY(t,e,r){return Math.abs(t-e)<=r}function DE(t,e,r,n=.5){t.origin=n,t.originPoint=Zr(e.min,e.max,t.origin),t.scale=Ni(r)/Ni(e),t.translate=Zr(r.min,r.max,t.origin)-t.originPoint,(t.scale>=QG&&t.scale<=eY||isNaN(t.scale))&&(t.scale=1),(t.translate>=tY&&t.translate<=rY||isNaN(t.translate))&&(t.translate=0)}function rh(t,e,r,n){DE(t.x,e.x,r.x,n?n.originX:void 0),DE(t.y,e.y,r.y,n?n.originY:void 0)}function OE(t,e,r){t.min=r.min+e.min,t.max=t.min+Ni(e)}function iY(t,e,r){OE(t.x,e.x,r.x),OE(t.y,e.y,r.y)}function NE(t,e,r){t.min=e.min-r.min,t.max=t.min+Ni(e)}function nh(t,e,r){NE(t.x,e.x,r.x),NE(t.y,e.y,r.y)}function sY(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?Zr(r,t,n.max):Math.min(t,r)),t}function LE(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function oY(t,{top:e,left:r,bottom:n,right:i}){return{x:LE(t.x,r,i),y:LE(t.y,e,n)}}function kE(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=Fu(e.min,e.max-n,t.min):n>i&&(r=Fu(t.min,t.max-i,e.min)),ya(0,1,r)}function uY(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const tb=.35;function fY(t=tb){return t===!1?t=0:t===!0&&(t=tb),{x:BE(t,"left","right"),y:BE(t,"top","bottom")}}function BE(t,e,r){return{min:$E(t,e),max:$E(t,r)}}function $E(t,e){return typeof t=="number"?t:t[e]||0}const FE=()=>({translate:0,scale:1,origin:0,originPoint:0}),Uu=()=>({x:FE(),y:FE()}),jE=()=>({min:0,max:0}),ln=()=>({x:jE(),y:jE()});function rs(t){return[t("x"),t("y")]}function UE({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function lY({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function hY(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function rb(t){return t===void 0||t===1}function nb({scale:t,scaleX:e,scaleY:r}){return!rb(t)||!rb(e)||!rb(r)}function _c(t){return nb(t)||qE(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function qE(t){return zE(t.x)||zE(t.y)}function zE(t){return t&&t!=="0%"}function B0(t,e,r){const n=t-r,i=e*n;return r+i}function HE(t,e,r,n,i){return i!==void 0&&(t=B0(t,i,n)),B0(t,r,n)+e}function ib(t,e=0,r=1,n,i){t.min=HE(t.min,e,r,n,i),t.max=HE(t.max,e,r,n,i)}function WE(t,{x:e,y:r}){ib(t.x,e.translate,e.scale,e.originPoint),ib(t.y,r.translate,r.scale,r.originPoint)}const KE=.999999999999,VE=1.0000000000001;function dY(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;aKE&&(e.x=1),e.yKE&&(e.y=1)}function qu(t,e){t.min=t.min+e,t.max=t.max+e}function GE(t,e,r,n,i=.5){const s=Zr(t.min,t.max,i);ib(t,e,r,s,n)}function zu(t,e){GE(t.x,e.x,e.scaleX,e.scale,e.originX),GE(t.y,e.y,e.scaleY,e.scale,e.originY)}function YE(t,e){return UE(hY(t.getBoundingClientRect(),e))}function pY(t,e,r){const n=YE(t,r),{scroll:i}=e;return i&&(qu(n.x,i.offset.x),qu(n.y,i.offset.y)),n}const JE=({current:t})=>t?t.ownerDocument.defaultView:null,gY=new WeakMap;class mY{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ln(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:p}=this.getProps();p?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(k0(d,"page").point)},s=(d,p)=>{const{drag:y,dragPropagation:A,onDragStart:P}=this.getProps();if(y&&!A&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=IE(y),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),rs(D=>{let k=this.getAxisMotionValue(D).get()||0;if(eo.test(k)){const{projection:B}=this.visualElement;if(B&&B.layout){const j=B.layout.layoutBox[D];j&&(k=Ni(j)*(parseFloat(k)/100))}}this.originPoint[D]=k}),P&&Nr.postRender(()=>P(d,p)),Xv(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},o=(d,p)=>{const{dragPropagation:y,dragDirectionLock:A,onDirectionLock:P,onDrag:N}=this.getProps();if(!y&&!this.openGlobalLock)return;const{offset:D}=p;if(A&&this.currentDirection===null){this.currentDirection=vY(D),this.currentDirection!==null&&P&&P(this.currentDirection);return}this.updateAxis("x",p.point,D),this.updateAxis("y",p.point,D),this.visualElement.render(),N&&N(d,p)},a=(d,p)=>this.stop(d,p),u=()=>rs(d=>{var p;return this.getAnimationState(d)==="paused"&&((p=this.getAxisMotionValue(d).animation)===null||p===void 0?void 0:p.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new _E(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:JE(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Nr.postRender(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!$0(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=sY(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&ju(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=oY(i.layoutBox,r):this.constraints=!1,this.elastic=fY(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&rs(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=uY(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!ju(e))return!1;const n=e.current;Oo(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=pY(n,i.root,this.visualElement.getTransformPagePoint());let o=aY(i.layout.layoutBox,s);if(r){const a=r(lY(o));this.hasMutatedConstraints=!!a,a&&(o=UE(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),u=this.constraints||{},l=rs(d=>{if(!$0(d,r,this.currentDirection))return;let p=u&&u[d]||{};o&&(p={min:0,max:0});const y=i?200:1e6,A=i?40:1e7,P={type:"inertia",velocity:n?e[d]:0,bounceStiffness:y,bounceDamping:A,timeConstant:750,restDelta:1,restSpeed:10,...s,...p};return this.startAxisValueAnimation(d,P)});return Promise.all(l).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return Xv(this.visualElement,e),n.start(Kv(e,n,0,r,this.visualElement,!1))}stopAnimation(){rs(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){rs(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){rs(r=>{const{drag:n}=this.getProps();if(!$0(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-Zr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!ju(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};rs(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const u=a.get();i[o]=cY({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),rs(o=>{if(!$0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:u,max:l}=this.constraints[o];a.set(Zr(u,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;gY.set(this.visualElement,this);const e=this.visualElement.current,r=ko(e,"pointerdown",u=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();ju(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Nr.read(n);const o=Lo(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(rs(d=>{const p=this.getAxisMotionValue(d);p&&(this.originPoint[d]+=u[d].translate,p.set(p.get()+u[d].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=tb,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function $0(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function vY(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class bY extends _a{constructor(e){super(e),this.removeGroupControls=Wn,this.removeListeners=Wn,this.controls=new mY(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Wn}unmount(){this.removeGroupControls(),this.removeListeners()}}const XE=t=>(e,r)=>{t&&Nr.postRender(()=>t(e,r))};class yY extends _a{constructor(){super(...arguments),this.removePointerDownListener=Wn}onPointerDown(e){this.session=new _E(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:JE(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:XE(e),onStart:XE(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&Nr.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=ko(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const F0=Se.createContext(null);function wY(){const t=Se.useContext(F0);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=Se.useId();Se.useEffect(()=>n(i),[]);const s=Se.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const sb=Se.createContext({}),ZE=Se.createContext({}),j0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function QE(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ih={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(zt.test(t))t=parseFloat(t);else return t;const r=QE(t,e.target.x),n=QE(t,e.target.y);return`${r}% ${n}%`}},xY={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=xa.parse(t);if(i.length>5)return n;const s=xa.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,u=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=u;const l=Zr(a,u,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),s(i)}},U0={};function _Y(t){Object.assign(U0,t)}const{schedule:ob}=g8(queueMicrotask,!1);class EY extends Se.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;_Y(SY),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),j0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Nr.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ob.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function eS(t){const[e,r]=wY(),n=Se.useContext(sb);return ge.jsx(EY,{...t,layoutGroup:n,switchLayoutGroup:Se.useContext(ZE),isPresent:e,safeToRemove:r})}const SY={borderRadius:{...ih,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ih,borderTopRightRadius:ih,borderBottomLeftRadius:ih,borderBottomRightRadius:ih,boxShadow:xY},tS=["TopLeft","TopRight","BottomLeft","BottomRight"],AY=tS.length,rS=t=>typeof t=="string"?parseFloat(t):t,nS=t=>typeof t=="number"||zt.test(t);function PY(t,e,r,n,i,s){i?(t.opacity=Zr(0,r.opacity!==void 0?r.opacity:1,MY(n)),t.opacityExit=Zr(e.opacity!==void 0?e.opacity:1,0,IY(n))):s&&(t.opacity=Zr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(Fu(t,e,n))}function oS(t,e){t.min=e.min,t.max=e.max}function ns(t,e){oS(t.x,e.x),oS(t.y,e.y)}function aS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function cS(t,e,r,n,i){return t-=e,t=B0(t,1/r,n),i!==void 0&&(t=B0(t,1/i,n)),t}function CY(t,e=0,r=1,n=.5,i,s=t,o=t){if(eo.test(e)&&(e=parseFloat(e),e=Zr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Zr(s.min,s.max,n);t===s&&(a-=e),t.min=cS(t.min,e,r,a,i),t.max=cS(t.max,e,r,a,i)}function uS(t,e,[r,n,i],s,o){CY(t,e[r],e[n],e[i],e.scale,s,o)}const TY=["x","scaleX","originX"],RY=["y","scaleY","originY"];function fS(t,e,r,n){uS(t.x,e,TY,r?r.x:void 0,n?n.x:void 0),uS(t.y,e,RY,r?r.y:void 0,n?n.y:void 0)}function lS(t){return t.translate===0&&t.scale===1}function hS(t){return lS(t.x)&&lS(t.y)}function dS(t,e){return t.min===e.min&&t.max===e.max}function DY(t,e){return dS(t.x,e.x)&&dS(t.y,e.y)}function pS(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function gS(t,e){return pS(t.x,e.x)&&pS(t.y,e.y)}function mS(t){return Ni(t.x)/Ni(t.y)}function vS(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class OY{constructor(){this.members=[]}add(e){Vv(this.members,e),e.scheduleRender()}remove(e){if(Gv(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function NY(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:l,rotate:d,rotateX:p,rotateY:y,skewX:A,skewY:P}=r;l&&(n=`perspective(${l}px) ${n}`),d&&(n+=`rotate(${d}deg) `),p&&(n+=`rotateX(${p}deg) `),y&&(n+=`rotateY(${y}deg) `),A&&(n+=`skewX(${A}deg) `),P&&(n+=`skewY(${P}deg) `)}const a=t.x.scale*e.x,u=t.y.scale*e.y;return(a!==1||u!==1)&&(n+=`scale(${a}, ${u})`),n||"none"}const LY=(t,e)=>t.depth-e.depth;class kY{constructor(){this.children=[],this.isDirty=!1}add(e){Vv(this.children,e),this.isDirty=!0}remove(e){Gv(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(LY),this.isDirty=!1,this.children.forEach(e)}}function q0(t){const e=Qn(t)?t.get():t;return IG(e)?e.toValue():e}function BY(t,e){const r=to.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(ba(n),t(s-e))};return Nr.read(n,!0),()=>ba(n)}function $Y(t){return t instanceof SVGElement&&t.tagName!=="svg"}function FY(t,e,r){const n=Qn(t)?t:th(t);return n.start(Kv("",n,e,r)),n.animation}const Ec={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},sh=typeof window<"u"&&window.MotionDebug!==void 0,ab=["","X","Y","Z"],jY={visibility:"hidden"},bS=1e3;let UY=0;function cb(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function yS(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=mE(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Nr,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&yS(n)}function wS({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=UY++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,sh&&(Ec.totalNodes=Ec.resolvedTargetDeltas=Ec.recalculatedProjection=0),this.nodes.forEach(HY),this.nodes.forEach(YY),this.nodes.forEach(JY),this.nodes.forEach(WY),sh&&window.MotionDebug.record(Ec)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let u=0;uthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,p&&p(),p=BY(y,250),j0.hasAnimatedSinceResize&&(j0.hasAnimatedSinceResize=!1,this.nodes.forEach(_S))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&d&&(u||l)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:y,hasRelativeTargetChanged:A,layout:P})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const N=this.options.transition||d.getDefaultTransition()||tJ,{onLayoutAnimationStart:D,onLayoutAnimationComplete:k}=d.getProps(),B=!this.targetLayout||!gS(this.targetLayout,P)||A,j=!y&&A;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||j||y&&(B||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(p,j);const U={...wv(N,"layout"),onPlay:D,onComplete:k};(d.shouldReduceMotion||this.options.layoutRoot)&&(U.delay=0,U.type=!1),this.startAnimation(U)}else y||_S(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=P})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,ba(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(XY),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&yS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u{const K=U/1e3;ES(p.x,o.x,K),ES(p.y,o.y,K),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(nh(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),QY(this.relativeTarget,this.relativeTargetOrigin,y,K),j&&DY(this.relativeTarget,j)&&(this.isProjectionDirty=!1),j||(j=ln()),ns(j,this.relativeTarget)),N&&(this.animationValues=d,PY(d,l,this.latestValues,K,B,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=K},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(ba(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nr.update(()=>{j0.hasAnimatedSinceResize=!0,this.currentAnimation=FY(0,bS,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(bS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:u,layout:l,latestValues:d}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&IS(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||ln();const p=Ni(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+p;const y=Ni(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+y}ns(a,u),zu(a,d),rh(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new OY),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(a=!0),!a)return;const l={};u.z&&cb("z",o,l,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(xS),this.root.sharedNodes.clear()}}}function qY(t){t.updateLayout()}function zY(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?rs(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],A=Ni(y);y.min=n[p].min,y.max=y.min+A}):IS(s,r.layoutBox,n)&&rs(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],A=Ni(n[p]);y.max=y.min+A,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[p].max=t.relativeTarget[p].min+A)});const a=Uu();rh(a,n,r.layoutBox);const u=Uu();o?rh(u,t.applyTransform(i,!0),r.measuredBox):rh(u,n,r.layoutBox);const l=!hS(a);let d=!1;if(!t.resumeFrom){const p=t.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:y,layout:A}=p;if(y&&A){const P=ln();nh(P,r.layoutBox,y.layoutBox);const N=ln();nh(N,n,A.layoutBox),gS(P,N)||(d=!0),p.options.layoutRoot&&(t.relativeTarget=N,t.relativeTargetOrigin=P,t.relativeParent=p)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:u,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function HY(t){sh&&Ec.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function WY(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function KY(t){t.clearSnapshot()}function xS(t){t.clearMeasurements()}function VY(t){t.isLayoutDirty=!1}function GY(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function _S(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function YY(t){t.resolveTargetDelta()}function JY(t){t.calcProjection()}function XY(t){t.resetSkewAndRotation()}function ZY(t){t.removeLeadSnapshot()}function ES(t,e,r){t.translate=Zr(e.translate,0,r),t.scale=Zr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function SS(t,e,r,n){t.min=Zr(e.min,r.min,n),t.max=Zr(e.max,r.max,n)}function QY(t,e,r,n){SS(t.x,e.x,r.x,n),SS(t.y,e.y,r.y,n)}function eJ(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const tJ={duration:.45,ease:[.4,0,.1,1]},AS=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),PS=AS("applewebkit/")&&!AS("chrome/")?Math.round:Wn;function MS(t){t.min=PS(t.min),t.max=PS(t.max)}function rJ(t){MS(t.x),MS(t.y)}function IS(t,e,r){return t==="position"||t==="preserve-aspect"&&!nY(mS(e),mS(r),.2)}function nJ(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const iJ=wS({attachResizeListener:(t,e)=>Lo(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ub={current:void 0},CS=wS({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!ub.current){const t=new iJ({});t.mount(window),t.setOptions({layoutScroll:!0}),ub.current=t}return ub.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),sJ={pan:{Feature:yY},drag:{Feature:bY,ProjectionNode:CS,MeasureLayout:eS}};function TS(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||CE())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const u=a[n];u&&Nr.postRender(()=>u(s,o))};return ko(t.current,r,i,{passive:!t.getProps()[n]})}class oJ extends _a{mount(){this.unmount=No(TS(this.node,!0),TS(this.node,!1))}unmount(){}}class aJ extends _a{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=No(Lo(this.node.current,"focus",()=>this.onFocus()),Lo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const RS=(t,e)=>e?t===e?!0:RS(t,e.parentElement):!1;function fb(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,k0(r))}class cJ extends _a{constructor(){super(...arguments),this.removeStartListeners=Wn,this.removeEndListeners=Wn,this.removeAccessibleListeners=Wn,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=ko(window,"pointerup",(a,u)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:d,globalTapTarget:p}=this.node.getProps(),y=!p&&!RS(this.node.current,a.target)?d:l;y&&Nr.update(()=>y(a,u))},{passive:!(n.onTap||n.onPointerUp)}),o=ko(window,"pointercancel",(a,u)=>this.cancelPress(a,u),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=No(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||fb("up",(u,l)=>{const{onTap:d}=this.node.getProps();d&&Nr.postRender(()=>d(u,l))})};this.removeEndListeners(),this.removeEndListeners=Lo(this.node.current,"keyup",o),fb("down",(a,u)=>{this.startPress(a,u)})},r=Lo(this.node.current,"keydown",e),n=()=>{this.isPressing&&fb("cancel",(s,o)=>this.cancelPress(s,o))},i=Lo(this.node.current,"blur",n);this.removeAccessibleListeners=No(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Nr.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!CE()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Nr.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=ko(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=Lo(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=No(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const lb=new WeakMap,hb=new WeakMap,uJ=t=>{const e=lb.get(t.target);e&&e(t)},fJ=t=>{t.forEach(uJ)};function lJ({root:t,...e}){const r=t||document;hb.has(r)||hb.set(r,{});const n=hb.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(fJ,{root:t,...e})),n[i]}function hJ(t,e,r){const n=lJ(e);return lb.set(t,r),n.observe(t),()=>{lb.delete(t),n.unobserve(t)}}const dJ={some:0,all:1};class pJ extends _a{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:dJ[i]},a=u=>{const{isIntersecting:l}=u;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:p}=this.node.getProps(),y=l?d:p;y&&y(u)};return hJ(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(gJ(e,r))&&this.startObserver()}unmount(){}}function gJ({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const mJ={inView:{Feature:pJ},tap:{Feature:cJ},focus:{Feature:aJ},hover:{Feature:oJ}},vJ={layout:{ProjectionNode:CS,MeasureLayout:eS}},db=Se.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),z0=Se.createContext({}),pb=typeof window<"u",DS=pb?Se.useLayoutEffect:Se.useEffect,OS=Se.createContext({strict:!1});function bJ(t,e,r,n,i){var s,o;const{visualElement:a}=Se.useContext(z0),u=Se.useContext(OS),l=Se.useContext(F0),d=Se.useContext(db).reducedMotion,p=Se.useRef();n=n||u.renderer,!p.current&&n&&(p.current=n(t,{visualState:e,parent:a,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d}));const y=p.current,A=Se.useContext(ZE);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&yJ(p.current,r,i,A);const P=Se.useRef(!1);Se.useInsertionEffect(()=>{y&&P.current&&y.update(r,l)});const N=r[gE],D=Se.useRef(!!N&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,N))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,N)));return DS(()=>{y&&(P.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),ob.render(y.render),D.current&&y.animationState&&y.animationState.animateChanges())}),Se.useEffect(()=>{y&&(!D.current&&y.animationState&&y.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{var k;(k=window.MotionHandoffMarkAsComplete)===null||k===void 0||k.call(window,N)}),D.current=!1))}),y}function yJ(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:u,layoutRoot:l}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:NS(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&ju(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:u,layoutRoot:l})}function NS(t){if(t)return t.options.allowProjection!==!1?t.projection:NS(t.parent)}function wJ(t,e,r){return Se.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):ju(r)&&(r.current=n))},[e])}function H0(t){return P0(t.animate)||yv.some(e=>Vl(t[e]))}function LS(t){return!!(H0(t)||t.variants)}function xJ(t,e){if(H0(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Vl(r)?r:void 0,animate:Vl(n)?n:void 0}}return t.inherit!==!1?e:{}}function _J(t){const{initial:e,animate:r}=xJ(t,Se.useContext(z0));return Se.useMemo(()=>({initial:e,animate:r}),[kS(e),kS(r)])}function kS(t){return Array.isArray(t)?t.join(" "):t}const BS={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Hu={};for(const t in BS)Hu[t]={isEnabled:e=>BS[t].some(r=>!!e[r])};function EJ(t){for(const e in t)Hu[e]={...Hu[e],...t[e]}}const SJ=Symbol.for("motionComponentSymbol");function AJ({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&EJ(t);function s(a,u){let l;const d={...Se.useContext(db),...a,layoutId:PJ(a)},{isStatic:p}=d,y=_J(a),A=n(a,p);if(!p&&pb){MJ(d,t);const P=IJ(d);l=P.MeasureLayout,y.visualElement=bJ(i,A,d,e,P.ProjectionNode)}return ge.jsxs(z0.Provider,{value:y,children:[l&&y.visualElement?ge.jsx(l,{visualElement:y.visualElement,...d}):null,r(i,a,wJ(A,y.visualElement,u),A,p,y.visualElement)]})}const o=Se.forwardRef(s);return o[SJ]=i,o}function PJ({layoutId:t}){const e=Se.useContext(sb).id;return e&&t!==void 0?e+"-"+t:t}function MJ(t,e){const r=Se.useContext(OS).strict;if(process.env.NODE_ENV!=="production"&&e&&r){const n="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?Lu(!1,n):Oo(!1,n)}}function IJ(t){const{drag:e,layout:r}=Hu;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const CJ=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function gb(t){return typeof t!="string"||t.includes("-")?!1:!!(CJ.indexOf(t)>-1||/[A-Z]/u.test(t))}function $S(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const FS=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function jS(t,e,r,n){$S(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(FS.has(i)?i:Jv(i),e.attrs[i])}function US(t,{layout:e,layoutId:r}){return bc.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!U0[t]||t==="opacity")}function mb(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(Qn(i[o])||e.style&&Qn(e.style[o])||US(o,t)||((n=r==null?void 0:r.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function qS(t,e,r){const n=mb(t,e,r);for(const i in t)if(Qn(t[i])||Qn(e[i])){const s=Gl.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function vb(t){const e=Se.useRef(null);return e.current===null&&(e.current=t()),e.current}function TJ({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:RJ(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const zS=t=>(e,r)=>{const n=Se.useContext(z0),i=Se.useContext(F0),s=()=>TJ(t,e,n,i);return r?s():vb(s)};function RJ(t,e,r,n){const i={},s=n(t,{});for(const y in s)i[y]=q0(s[y]);let{initial:o,animate:a}=t;const u=H0(t),l=LS(t);e&&l&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const p=d?a:o;if(p&&typeof p!="boolean"&&!P0(p)){const y=Array.isArray(p)?p:[p];for(let A=0;A({style:{},transform:{},transformOrigin:{},vars:{}}),HS=()=>({...bb(),attrs:{}}),WS=(t,e)=>e&&typeof t=="number"?e.transform(t):t,DJ={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},OJ=Gl.length;function NJ(t,e,r){let n="",i=!0;for(let s=0;stypeof t=="string"&&t.toLowerCase()==="svg",FJ={useVisualState:zS({scrapeMotionValuesFromProps:qS,createRenderState:HS,onMount:(t,e,{renderState:r,latestValues:n})=>{Nr.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),Nr.render(()=>{wb(r,n,xb(e.tagName),t.transformTemplate),jS(e,r)})}})},jJ={useVisualState:zS({scrapeMotionValuesFromProps:mb,createRenderState:bb})};function VS(t,e,r){for(const n in e)!Qn(e[n])&&!US(n,r)&&(t[n]=e[n])}function UJ({transformTemplate:t},e){return Se.useMemo(()=>{const r=bb();return yb(r,e,t),Object.assign({},r.vars,r.style)},[e])}function qJ(t,e){const r=t.style||{},n={};return VS(n,r,t),Object.assign(n,UJ(t,e)),n}function zJ(t,e){const r={},n=qJ(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const HJ=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function W0(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||HJ.has(t)}let GS=t=>!W0(t);function WJ(t){t&&(GS=e=>e.startsWith("on")?!W0(e):t(e))}try{WJ(require("@emotion/is-prop-valid").default)}catch{}function KJ(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(GS(i)||r===!0&&W0(i)||!e&&!W0(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function VJ(t,e,r,n){const i=Se.useMemo(()=>{const s=HS();return wb(s,e,xb(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};VS(s,t.style,t),i.style={...s,...i.style}}return i}function GJ(t=!1){return(r,n,i,{latestValues:s},o)=>{const u=(gb(r)?VJ:zJ)(n,s,o,r),l=KJ(n,typeof r=="string",t),d=r!==Se.Fragment?{...l,...u,ref:i}:{},{children:p}=n,y=Se.useMemo(()=>Qn(p)?p.get():p,[p]);return Se.createElement(r,{...d,children:y})}}function YJ(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...gb(n)?FJ:jJ,preloadedFeatures:t,useRender:GJ(i),createVisualElement:e,Component:n};return AJ(o)}}const _b={current:null},YS={current:!1};function JJ(){if(YS.current=!0,!!pb)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>_b.current=t.matches;t.addListener(e),e()}else _b.current=!1}function XJ(t,e,r){for(const n in e){const i=e[n],s=r[n];if(Qn(i))t.addValue(n,i),process.env.NODE_ENV==="development"&&A0(i.version==="11.11.17",`Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`);else if(Qn(s))t.addValue(n,th(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,th(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const JS=new WeakMap,ZJ=[...N8,Zn,xa],QJ=t=>ZJ.find(O8(t)),XS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class eX{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Mv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=to.now();this.renderScheduledAtthis.bindToMotionValue(n,r)),YS.current||JJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:_b.current,process.env.NODE_ENV!=="production"&&A0(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){JS.delete(this.current),this.projection&&this.projection.unmount(),ba(this.notifyUpdate),ba(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=bc.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Nr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Hu){const r=Hu[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ln()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=th(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(A8(i)||S8(i))?i=parseFloat(i):!QJ(i)&&xa.test(r)&&(i=W8(e,r)),this.setBaseTarget(e,Qn(i)?i.get():i)),Qn(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=vv(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Qn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new Yv),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class ZS extends eX{constructor(){super(...arguments),this.KeyframeResolver=K8}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function tX(t){return window.getComputedStyle(t)}class rX extends ZS{constructor(){super(...arguments),this.type="html",this.renderInstance=$S}readValueFromInstance(e,r){if(bc.has(r)){const n=Nv(r);return n&&n.default||0}else{const n=tX(e),i=(M8(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return YE(e,r)}build(e,r,n){yb(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return mb(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Qn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class nX extends ZS{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ln}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(bc.has(r)){const n=Nv(r);return n&&n.default||0}return r=FS.has(r)?r:Jv(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return qS(e,r,n)}build(e,r,n){wb(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){jS(e,r,n,i)}mount(e){this.isSVGTag=xb(e.tagName),super.mount(e)}}const iX=(t,e)=>gb(t)?new nX(e):new rX(e,{allowProjection:t!==Se.Fragment}),sX=YJ({...GG,...mJ,...sJ,...vJ},iX),oX=UK(sX);class aX extends Yt.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function cX({children:t,isPresent:e}){const r=Se.useId(),n=Se.useRef(null),i=Se.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=Se.useContext(db);return Se.useInsertionEffect(()=>{const{width:o,height:a,top:u,left:l}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` [data-motion-pop-id="${r}"] { position: absolute !important; width: ${o}px !important; @@ -199,7 +199,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene top: ${u}px !important; left: ${l}px !important; } - `),()=>{document.head.removeChild(d)}},[e]),ge.jsx(aX,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const uX=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=vb(fX),u=Se.useId(),l=Se.useCallback(g=>{a.set(g,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Se.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:g=>(a.set(g,!1),()=>a.delete(g))}),s?[Math.random(),l]:[r,l]);return Se.useMemo(()=>{a.forEach((g,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=ge.jsx(cX,{isPresent:r,children:t})),ge.jsx(F0.Provider,{value:d,children:t})};function fX(){return new Map}const K0=t=>t.key||"";function QS(t){const e=[];return Se.Children.forEach(t,r=>{Se.isValidElement(r)&&e.push(r)}),e}const lX=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Oo(!e,"Replace exitBeforeEnter with mode='wait'");const a=Se.useMemo(()=>QS(t),[t]),u=a.map(K0),l=Se.useRef(!0),d=Se.useRef(a),g=vb(()=>new Map),[y,A]=Se.useState(a),[P,N]=Se.useState(a);DS(()=>{l.current=!1,d.current=a;for(let B=0;B1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=Se.useContext(sb);return ge.jsx(ge.Fragment,{children:P.map(B=>{const j=K0(B),U=a===P||u.includes(j),K=()=>{if(g.has(j))g.set(j,!0);else return;let J=!0;g.forEach(T=>{T||(J=!1)}),J&&(k==null||k(),N(d.current),i&&i())};return ge.jsx(uX,{isPresent:U,initial:!l.current||n?void 0:!1,custom:U?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:U?void 0:K,children:B},j)})})},Ss=t=>ge.jsx(lX,{children:ge.jsx(oX.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Eb(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return ge.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,ge.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[ge.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),ge.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:ge.jsx(NK,{})})]})]})}function hX(t){return t.lastUsed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function e7(t){var o,a;const{wallet:e,onClick:r}=t,n=ge.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Se.useMemo(()=>hX(e),[e]);return ge.jsx(Eb,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function t7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=vX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Sb);return a[0]===""&&a.length!==1&&a.shift(),r7(a,e)||mX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},r7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?r7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Sb);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},n7=/^\[(.+)\]$/,mX=t=>{if(n7.test(t)){const e=n7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},vX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return yX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Ab(o,n,s,e)}),n},Ab=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:i7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(bX(i)){Ab(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Ab(o,i7(e,s),r,n)})})},i7=(t,e)=>{let r=t;return e.split(Sb).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},bX=t=>t.isThemeGetter,yX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,wX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},s7="!",xX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,g;for(let D=0;Dd?g-d:void 0;return{modifiers:u,hasImportantModifier:A,baseClassName:P,maybePostfixModifierPosition:N}};return r?a=>r({className:a,parseClassName:o}):o},_X=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},EX=t=>({cache:wX(t.cacheSize),parseClassName:xX(t),...gX(t)}),SX=/\s+/,AX=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(SX);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:A}=r(l);let P=!!A,N=n(P?y.substring(0,A):y);if(!N){if(!P){a=l+(a.length>0?" "+a:a);continue}if(N=n(y),!N){a=l+(a.length>0?" "+a:a);continue}P=!1}const D=_X(d).join(":"),k=g?D+s7:D,B=k+N;if(s.includes(B))continue;s.push(B);const j=i(N,P);for(let U=0;U0?" "+a:a)}return a};function PX(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;ng(d),t());return r=EX(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=AX(u,r);return i(u,d),d}return function(){return s(PX.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},a7=/^\[(?:([a-z-]+):)?(.+)\]$/i,IX=/^\d+\/\d+$/,CX=new Set(["px","full","screen"]),TX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RX=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,DX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,OX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bo=t=>Wu(t)||CX.has(t)||IX.test(t),Ea=t=>Ku(t,"length",qX),Wu=t=>!!t&&!Number.isNaN(Number(t)),Pb=t=>Ku(t,"number",Wu),oh=t=>!!t&&Number.isInteger(Number(t)),LX=t=>t.endsWith("%")&&Wu(t.slice(0,-1)),cr=t=>a7.test(t),Sa=t=>TX.test(t),kX=new Set(["length","size","percentage"]),BX=t=>Ku(t,kX,c7),$X=t=>Ku(t,"position",c7),FX=new Set(["image","url"]),jX=t=>Ku(t,FX,HX),UX=t=>Ku(t,"",zX),ah=()=>!0,Ku=(t,e,r)=>{const n=a7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},qX=t=>RX.test(t)&&!DX.test(t),c7=()=>!1,zX=t=>OX.test(t),HX=t=>NX.test(t),WX=MX(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),g=Gr("invert"),y=Gr("gap"),A=Gr("gradientColorStops"),P=Gr("gradientColorStopPositions"),N=Gr("inset"),D=Gr("margin"),k=Gr("opacity"),B=Gr("padding"),j=Gr("saturate"),U=Gr("scale"),K=Gr("sepia"),J=Gr("skew"),T=Gr("space"),z=Gr("translate"),ue=()=>["auto","contain","none"],_e=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",Bo,Ea],f=()=>["auto",Wu,cr],p=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],S=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Wu,cr];return{cacheSize:500,separator:":",theme:{colors:[ah],spacing:[Bo,Ea],blur:["none","",Sa,cr],brightness:M(),borderColor:[t],borderRadius:["none","","full",Sa,cr],borderSpacing:E(),borderWidth:m(),contrast:M(),grayscale:S(),hueRotate:M(),invert:S(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[LX,Ea],inset:G(),margin:G(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:S(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Sa]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...p(),cr]}],overflow:[{overflow:_e()}],"overflow-x":[{"overflow-x":_e()}],"overflow-y":[{"overflow-y":_e()}],overscroll:[{overscroll:ue()}],"overscroll-x":[{"overscroll-x":ue()}],"overscroll-y":[{"overscroll-y":ue()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",oh,cr]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",oh,cr]}],"grid-cols":[{"grid-cols":[ah]}],"col-start-end":[{col:["auto",{span:["full",oh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[ah]}],"row-start-end":[{row:["auto",{span:[oh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[B]}],px:[{px:[B]}],py:[{py:[B]}],ps:[{ps:[B]}],pe:[{pe:[B]}],pt:[{pt:[B]}],pr:[{pr:[B]}],pb:[{pb:[B]}],pl:[{pl:[B]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Sa]},Sa]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Sa,Ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Pb]}],"font-family":[{font:[ah]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Wu,Pb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Bo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Bo,Ea]}],"underline-offset":[{"underline-offset":["auto",Bo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...p(),$X]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",BX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},jX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[A]}],"gradient-via":[{via:[A]}],"gradient-to":[{to:[A]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[Bo,cr]}],"outline-w":[{outline:[Bo,Ea]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Bo,Ea]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Sa,UX]}],"shadow-color":[{shadow:[ah]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Sa,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[g]}],saturate:[{saturate:[j]}],sepia:[{sepia:[K]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[j]}],"backdrop-sepia":[{"backdrop-sepia":[K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[U]}],"scale-x":[{"scale-x":[U]}],"scale-y":[{"scale-y":[U]}],rotate:[{rotate:[oh,cr]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[J]}],"skew-y":[{"skew-y":[J]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Bo,Ea,Pb]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function $o(...t){return WX(pX(t))}function u7(t){const{className:e}=t;return ge.jsxs("div",{className:$o("xc-flex xc-items-center xc-gap-2"),children:[ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)}),ge.jsx("div",{className:"xc-shrink-0",children:t.children}),ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)})]})}const KX="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function VX(t){const{onClick:e}=t;function r(){e&&e()}return ge.jsx(u7,{className:"xc-opacity-20",children:ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[ge.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),ge.jsx(u8,{size:16})]})})}function f7(t){const[e,r]=Se.useState(""),{featuredWallets:n,initialized:i}=Kl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Se.useMemo(()=>{const N=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!N.test(e)&&D.test(e)},[e]);function g(N){o(N)}function y(N){r(N.target.value)}async function A(){s(e)}function P(N){N.key==="Enter"&&d&&A()}return ge.jsx(Ss,{children:i&&ge.jsxs(ge.Fragment,{children:[t.header||ge.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),ge.jsxs("div",{children:[ge.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(N=>ge.jsx(e7,{wallet:N,onClick:g},`feature-${N.key}`)),l.showTonConnect&&ge.jsx(Eb,{icon:ge.jsx("img",{className:"xc-h-5 xc-w-5",src:KX}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&ge.jsx(VX,{onClick:a})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&ge.jsx("div",{className:"xc-mb-4 xc-mt-4",children:ge.jsxs(u7,{className:"xc-opacity-20",children:[" ",ge.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),l.showEmailSignIn&&ge.jsxs("div",{className:"xc-mb-4",children:[ge.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:y,onKeyDown:P}),ge.jsx("button",{disabled:!d,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:A,children:"Continue"})]})]})})}function Sc(t){const{title:e}=t;return ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[ge.jsx(OK,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),ge.jsx("span",{children:e})]})}const l7=Se.createContext({channel:"",device:"WEB",app:"",inviterCode:""});function Mb(){return Se.useContext(l7)}function GX(t){const{config:e}=t,[r,n]=Se.useState(e.channel),[i,s]=Se.useState(e.device),[o,a]=Se.useState(e.app),[u,l]=Se.useState(e.inviterCode);return Se.useEffect(()=>{n(e.channel),s(e.device),a(e.app),l(e.inviterCode)},[e]),ge.jsx(l7.Provider,{value:{channel:r,device:i,app:o,inviterCode:u},children:t.children})}var YX=Object.defineProperty,JX=Object.defineProperties,XX=Object.getOwnPropertyDescriptors,V0=Object.getOwnPropertySymbols,h7=Object.prototype.hasOwnProperty,d7=Object.prototype.propertyIsEnumerable,p7=(t,e,r)=>e in t?YX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ZX=(t,e)=>{for(var r in e||(e={}))h7.call(e,r)&&p7(t,r,e[r]);if(V0)for(var r of V0(e))d7.call(e,r)&&p7(t,r,e[r]);return t},QX=(t,e)=>JX(t,XX(e)),eZ=(t,e)=>{var r={};for(var n in t)h7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&V0)for(var n of V0(t))e.indexOf(n)<0&&d7.call(t,n)&&(r[n]=t[n]);return r};function tZ(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function rZ(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var nZ=18,g7=40,iZ=`${g7}px`,sZ=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function oZ({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),g=Yt.useCallback(()=>{let y=t.current,A=e.current;if(!y||!A||u||r==="none")return;let P=y,N=P.getBoundingClientRect().left+P.offsetWidth,D=P.getBoundingClientRect().top+P.offsetHeight/2,k=N-nZ,B=D;document.querySelectorAll(sZ).length===0&&document.elementFromPoint(k,B)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function A(){let N=window.innerWidth-y.getBoundingClientRect().right;a(N>=g7)}A();let P=setInterval(A,1e3);return()=>{clearInterval(P)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let A=setTimeout(g,0),P=setTimeout(g,2e3),N=setTimeout(g,5e3),D=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(A),clearTimeout(P),clearTimeout(N),clearTimeout(D)}},[e,n,r,g]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:iZ}}var m7=Yt.createContext({}),v7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:g="increase-width",pasteTransformer:y,containerClassName:A,noScriptCSSFallback:P=aZ,render:N,children:D}=r,k=eZ(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),B,j,U,K,J;let[T,z]=Yt.useState(typeof k.defaultValue=="string"?k.defaultValue:""),ue=n??T,_e=rZ(ue),G=Yt.useCallback(ie=>{i==null||i(ie),z(ie)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),p=Yt.useRef({value:ue,onChange:G,isIOS:typeof window<"u"&&((j=(B=window==null?void 0:window.CSS)==null?void 0:B.supports)==null?void 0:j.call(B,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(U=m.current)==null?void 0:U.selectionStart,(K=m.current)==null?void 0:K.selectionEnd,(J=m.current)==null?void 0:J.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let ie=m.current,fe=f.current;if(!ie||!fe)return;p.current.value!==ie.value&&p.current.onChange(ie.value),v.current.prev=[ie.selectionStart,ie.selectionEnd,ie.selectionDirection];function ve(){if(document.activeElement!==ie){I(null),ae(null);return}let Te=ie.selectionStart,$e=ie.selectionEnd,Ie=ie.selectionDirection,Le=ie.maxLength,Ve=ie.value,ke=v.current.prev,ze=-1,He=-1,Ee;if(Ve.length!==0&&Te!==null&&$e!==null){let et=Te===$e,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let pt=0;if(ke[0]!==null&&ke[1]!==null){Ee=Je{fe&&fe.style.setProperty("--root-height",`${ie.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(ie),()=>{document.removeEventListener("selectionchange",ve,{capture:!0}),Ne.disconnect()}},[]);let[x,_]=Yt.useState(!1),[S,b]=Yt.useState(!1),[M,I]=Yt.useState(null),[F,ae]=Yt.useState(null);Yt.useEffect(()=>{tZ(()=>{var ie,fe,ve,Me;(ie=m.current)==null||ie.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(ve=m.current)==null?void 0:ve.selectionEnd,$e=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ae(Te),v.current.prev=[Ne,Te,$e])})},[ue,S]),Yt.useEffect(()=>{_e!==void 0&&ue!==_e&&_e.length{let fe=ie.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){ie.preventDefault();return}typeof _e=="string"&&fe.length<_e.length&&document.dispatchEvent(new Event("selectionchange")),G(fe)},[s,G,_e,E]),ee=Yt.useCallback(()=>{var ie;if(m.current){let fe=Math.min(m.current.value.length,s-1),ve=m.current.value.length;(ie=m.current)==null||ie.setSelectionRange(fe,ve),I(fe),ae(ve)}b(!0)},[s]),X=Yt.useCallback(ie=>{var fe,ve;let Me=m.current;if(!y&&(!p.current.isIOS||!ie.clipboardData||!Me))return;let Ne=ie.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),ie.preventDefault();let $e=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(ve=m.current)==null?void 0:ve.selectionEnd,Le=($e!==Ie?ue.slice(0,$e)+Te+ue.slice(Ie):ue.slice(0,$e)+Te+ue.slice($e)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,G(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ae(ke)},[s,G,E,ue]),Q=Yt.useMemo(()=>({position:"relative",cursor:k.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[k.disabled]),R=Yt.useMemo(()=>({position:"absolute",inset:0,width:O.willPushPWMBadge?`calc(100% + ${O.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:O.willPushPWMBadge?`inset(0 ${O.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[O.PWM_BADGE_SPACE_WIDTH,O.willPushPWMBadge,o]),Z=Yt.useMemo(()=>Yt.createElement("input",QX(ZX({autoComplete:k.autoComplete||"one-time-code"},k),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ue.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:R,maxLength:s,value:ue,ref:m,onPaste:ie=>{var fe;X(ie),(fe=k.onPaste)==null||fe.call(k,ie)},onChange:se,onMouseOver:ie=>{var fe;_(!0),(fe=k.onMouseOver)==null||fe.call(k,ie)},onMouseLeave:ie=>{var fe;_(!1),(fe=k.onMouseLeave)==null||fe.call(k,ie)},onFocus:ie=>{var fe;ee(),(fe=k.onFocus)==null||fe.call(k,ie)},onBlur:ie=>{var fe;b(!1),(fe=k.onBlur)==null||fe.call(k,ie)}})),[se,ee,X,l,R,s,F,M,k,E==null?void 0:E.source,ue]),te=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ie,fe)=>{var ve;let Me=S&&M!==null&&F!==null&&(M===F&&fe===M||fe>=M&&feN?N(te):Yt.createElement(m7.Provider,{value:te},D),[D,te,N]);return Yt.createElement(Yt.Fragment,null,P!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,P)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:A},le,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Z)))});v7.displayName="Input";function ch(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var aZ=` + `),()=>{document.head.removeChild(d)}},[e]),ge.jsx(aX,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const uX=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=vb(fX),u=Se.useId(),l=Se.useCallback(p=>{a.set(p,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Se.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:p=>(a.set(p,!1),()=>a.delete(p))}),s?[Math.random(),l]:[r,l]);return Se.useMemo(()=>{a.forEach((p,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=ge.jsx(cX,{isPresent:r,children:t})),ge.jsx(F0.Provider,{value:d,children:t})};function fX(){return new Map}const K0=t=>t.key||"";function QS(t){const e=[];return Se.Children.forEach(t,r=>{Se.isValidElement(r)&&e.push(r)}),e}const lX=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Oo(!e,"Replace exitBeforeEnter with mode='wait'");const a=Se.useMemo(()=>QS(t),[t]),u=a.map(K0),l=Se.useRef(!0),d=Se.useRef(a),p=vb(()=>new Map),[y,A]=Se.useState(a),[P,N]=Se.useState(a);DS(()=>{l.current=!1,d.current=a;for(let B=0;B1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=Se.useContext(sb);return ge.jsx(ge.Fragment,{children:P.map(B=>{const j=K0(B),U=a===P||u.includes(j),K=()=>{if(p.has(j))p.set(j,!0);else return;let J=!0;p.forEach(T=>{T||(J=!1)}),J&&(k==null||k(),N(d.current),i&&i())};return ge.jsx(uX,{isPresent:U,initial:!l.current||n?void 0:!1,custom:U?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:U?void 0:K,children:B},j)})})},Ss=t=>ge.jsx(lX,{children:ge.jsx(oX.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Eb(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return ge.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,ge.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[ge.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),ge.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:ge.jsx(NK,{})})]})]})}function hX(t){return t.lastUsed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function e7(t){var o,a;const{wallet:e,onClick:r}=t,n=ge.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Se.useMemo(()=>hX(e),[e]);return ge.jsx(Eb,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function t7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=vX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Sb);return a[0]===""&&a.length!==1&&a.shift(),r7(a,e)||mX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},r7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?r7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Sb);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},n7=/^\[(.+)\]$/,mX=t=>{if(n7.test(t)){const e=n7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},vX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return yX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Ab(o,n,s,e)}),n},Ab=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:i7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(bX(i)){Ab(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Ab(o,i7(e,s),r,n)})})},i7=(t,e)=>{let r=t;return e.split(Sb).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},bX=t=>t.isThemeGetter,yX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,wX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},s7="!",xX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,p;for(let D=0;Dd?p-d:void 0;return{modifiers:u,hasImportantModifier:A,baseClassName:P,maybePostfixModifierPosition:N}};return r?a=>r({className:a,parseClassName:o}):o},_X=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},EX=t=>({cache:wX(t.cacheSize),parseClassName:xX(t),...gX(t)}),SX=/\s+/,AX=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(SX);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:A}=r(l);let P=!!A,N=n(P?y.substring(0,A):y);if(!N){if(!P){a=l+(a.length>0?" "+a:a);continue}if(N=n(y),!N){a=l+(a.length>0?" "+a:a);continue}P=!1}const D=_X(d).join(":"),k=p?D+s7:D,B=k+N;if(s.includes(B))continue;s.push(B);const j=i(N,P);for(let U=0;U0?" "+a:a)}return a};function PX(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;np(d),t());return r=EX(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=AX(u,r);return i(u,d),d}return function(){return s(PX.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},a7=/^\[(?:([a-z-]+):)?(.+)\]$/i,IX=/^\d+\/\d+$/,CX=new Set(["px","full","screen"]),TX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RX=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,DX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,OX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bo=t=>Wu(t)||CX.has(t)||IX.test(t),Ea=t=>Ku(t,"length",qX),Wu=t=>!!t&&!Number.isNaN(Number(t)),Pb=t=>Ku(t,"number",Wu),oh=t=>!!t&&Number.isInteger(Number(t)),LX=t=>t.endsWith("%")&&Wu(t.slice(0,-1)),cr=t=>a7.test(t),Sa=t=>TX.test(t),kX=new Set(["length","size","percentage"]),BX=t=>Ku(t,kX,c7),$X=t=>Ku(t,"position",c7),FX=new Set(["image","url"]),jX=t=>Ku(t,FX,HX),UX=t=>Ku(t,"",zX),ah=()=>!0,Ku=(t,e,r)=>{const n=a7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},qX=t=>RX.test(t)&&!DX.test(t),c7=()=>!1,zX=t=>OX.test(t),HX=t=>NX.test(t),WX=MX(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),p=Gr("invert"),y=Gr("gap"),A=Gr("gradientColorStops"),P=Gr("gradientColorStopPositions"),N=Gr("inset"),D=Gr("margin"),k=Gr("opacity"),B=Gr("padding"),j=Gr("saturate"),U=Gr("scale"),K=Gr("sepia"),J=Gr("skew"),T=Gr("space"),z=Gr("translate"),ue=()=>["auto","contain","none"],_e=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",Bo,Ea],f=()=>["auto",Wu,cr],g=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],S=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Wu,cr];return{cacheSize:500,separator:":",theme:{colors:[ah],spacing:[Bo,Ea],blur:["none","",Sa,cr],brightness:M(),borderColor:[t],borderRadius:["none","","full",Sa,cr],borderSpacing:E(),borderWidth:m(),contrast:M(),grayscale:S(),hueRotate:M(),invert:S(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[LX,Ea],inset:G(),margin:G(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:S(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Sa]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...g(),cr]}],overflow:[{overflow:_e()}],"overflow-x":[{"overflow-x":_e()}],"overflow-y":[{"overflow-y":_e()}],overscroll:[{overscroll:ue()}],"overscroll-x":[{"overscroll-x":ue()}],"overscroll-y":[{"overscroll-y":ue()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",oh,cr]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",oh,cr]}],"grid-cols":[{"grid-cols":[ah]}],"col-start-end":[{col:["auto",{span:["full",oh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[ah]}],"row-start-end":[{row:["auto",{span:[oh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[B]}],px:[{px:[B]}],py:[{py:[B]}],ps:[{ps:[B]}],pe:[{pe:[B]}],pt:[{pt:[B]}],pr:[{pr:[B]}],pb:[{pb:[B]}],pl:[{pl:[B]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Sa]},Sa]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Sa,Ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Pb]}],"font-family":[{font:[ah]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Wu,Pb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Bo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Bo,Ea]}],"underline-offset":[{"underline-offset":["auto",Bo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...g(),$X]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",BX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},jX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[A]}],"gradient-via":[{via:[A]}],"gradient-to":[{to:[A]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[Bo,cr]}],"outline-w":[{outline:[Bo,Ea]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Bo,Ea]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Sa,UX]}],"shadow-color":[{shadow:[ah]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Sa,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[p]}],saturate:[{saturate:[j]}],sepia:[{sepia:[K]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[j]}],"backdrop-sepia":[{"backdrop-sepia":[K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[U]}],"scale-x":[{"scale-x":[U]}],"scale-y":[{"scale-y":[U]}],rotate:[{rotate:[oh,cr]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[J]}],"skew-y":[{"skew-y":[J]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Bo,Ea,Pb]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function $o(...t){return WX(pX(t))}function u7(t){const{className:e}=t;return ge.jsxs("div",{className:$o("xc-flex xc-items-center xc-gap-2"),children:[ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)}),ge.jsx("div",{className:"xc-shrink-0",children:t.children}),ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)})]})}const KX="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function VX(t){const{onClick:e}=t;function r(){e&&e()}return ge.jsx(u7,{className:"xc-opacity-20",children:ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[ge.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),ge.jsx(u8,{size:16})]})})}function f7(t){const[e,r]=Se.useState(""),{featuredWallets:n,initialized:i}=Kl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Se.useMemo(()=>{const N=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!N.test(e)&&D.test(e)},[e]);function p(N){o(N)}function y(N){r(N.target.value)}async function A(){s(e)}function P(N){N.key==="Enter"&&d&&A()}return ge.jsx(Ss,{children:i&&ge.jsxs(ge.Fragment,{children:[t.header||ge.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),ge.jsxs("div",{children:[ge.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(N=>ge.jsx(e7,{wallet:N,onClick:p},`feature-${N.key}`)),l.showTonConnect&&ge.jsx(Eb,{icon:ge.jsx("img",{className:"xc-h-5 xc-w-5",src:KX}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&ge.jsx(VX,{onClick:a})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&ge.jsx("div",{className:"xc-mb-4 xc-mt-4",children:ge.jsxs(u7,{className:"xc-opacity-20",children:[" ",ge.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),l.showEmailSignIn&&ge.jsxs("div",{className:"xc-mb-4",children:[ge.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:y,onKeyDown:P}),ge.jsx("button",{disabled:!d,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:A,children:"Continue"})]})]})})}function Sc(t){const{title:e}=t;return ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[ge.jsx(OK,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),ge.jsx("span",{children:e})]})}const l7=Se.createContext({channel:"",device:"WEB",app:"",inviterCode:"",role:"C"});function Mb(){return Se.useContext(l7)}function GX(t){const{config:e}=t,[r,n]=Se.useState(e.channel),[i,s]=Se.useState(e.device),[o,a]=Se.useState(e.app),[u,l]=Se.useState(e.role||"C"),[d,p]=Se.useState(e.inviterCode);return Se.useEffect(()=>{n(e.channel),s(e.device),a(e.app),p(e.inviterCode),l(e.role||"C")},[e]),ge.jsx(l7.Provider,{value:{channel:r,device:i,app:o,inviterCode:d,role:u},children:t.children})}var YX=Object.defineProperty,JX=Object.defineProperties,XX=Object.getOwnPropertyDescriptors,V0=Object.getOwnPropertySymbols,h7=Object.prototype.hasOwnProperty,d7=Object.prototype.propertyIsEnumerable,p7=(t,e,r)=>e in t?YX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ZX=(t,e)=>{for(var r in e||(e={}))h7.call(e,r)&&p7(t,r,e[r]);if(V0)for(var r of V0(e))d7.call(e,r)&&p7(t,r,e[r]);return t},QX=(t,e)=>JX(t,XX(e)),eZ=(t,e)=>{var r={};for(var n in t)h7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&V0)for(var n of V0(t))e.indexOf(n)<0&&d7.call(t,n)&&(r[n]=t[n]);return r};function tZ(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function rZ(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var nZ=18,g7=40,iZ=`${g7}px`,sZ=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function oZ({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),p=Yt.useCallback(()=>{let y=t.current,A=e.current;if(!y||!A||u||r==="none")return;let P=y,N=P.getBoundingClientRect().left+P.offsetWidth,D=P.getBoundingClientRect().top+P.offsetHeight/2,k=N-nZ,B=D;document.querySelectorAll(sZ).length===0&&document.elementFromPoint(k,B)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function A(){let N=window.innerWidth-y.getBoundingClientRect().right;a(N>=g7)}A();let P=setInterval(A,1e3);return()=>{clearInterval(P)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let A=setTimeout(p,0),P=setTimeout(p,2e3),N=setTimeout(p,5e3),D=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(A),clearTimeout(P),clearTimeout(N),clearTimeout(D)}},[e,n,r,p]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:iZ}}var m7=Yt.createContext({}),v7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:p="increase-width",pasteTransformer:y,containerClassName:A,noScriptCSSFallback:P=aZ,render:N,children:D}=r,k=eZ(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),B,j,U,K,J;let[T,z]=Yt.useState(typeof k.defaultValue=="string"?k.defaultValue:""),ue=n??T,_e=rZ(ue),G=Yt.useCallback(ie=>{i==null||i(ie),z(ie)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),g=Yt.useRef({value:ue,onChange:G,isIOS:typeof window<"u"&&((j=(B=window==null?void 0:window.CSS)==null?void 0:B.supports)==null?void 0:j.call(B,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(U=m.current)==null?void 0:U.selectionStart,(K=m.current)==null?void 0:K.selectionEnd,(J=m.current)==null?void 0:J.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let ie=m.current,fe=f.current;if(!ie||!fe)return;g.current.value!==ie.value&&g.current.onChange(ie.value),v.current.prev=[ie.selectionStart,ie.selectionEnd,ie.selectionDirection];function ve(){if(document.activeElement!==ie){I(null),ae(null);return}let Te=ie.selectionStart,$e=ie.selectionEnd,Ie=ie.selectionDirection,Le=ie.maxLength,Ve=ie.value,ke=v.current.prev,ze=-1,He=-1,Ee;if(Ve.length!==0&&Te!==null&&$e!==null){let et=Te===$e,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let pt=0;if(ke[0]!==null&&ke[1]!==null){Ee=Je{fe&&fe.style.setProperty("--root-height",`${ie.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(ie),()=>{document.removeEventListener("selectionchange",ve,{capture:!0}),Ne.disconnect()}},[]);let[x,_]=Yt.useState(!1),[S,b]=Yt.useState(!1),[M,I]=Yt.useState(null),[F,ae]=Yt.useState(null);Yt.useEffect(()=>{tZ(()=>{var ie,fe,ve,Me;(ie=m.current)==null||ie.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(ve=m.current)==null?void 0:ve.selectionEnd,$e=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ae(Te),v.current.prev=[Ne,Te,$e])})},[ue,S]),Yt.useEffect(()=>{_e!==void 0&&ue!==_e&&_e.length{let fe=ie.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){ie.preventDefault();return}typeof _e=="string"&&fe.length<_e.length&&document.dispatchEvent(new Event("selectionchange")),G(fe)},[s,G,_e,E]),ee=Yt.useCallback(()=>{var ie;if(m.current){let fe=Math.min(m.current.value.length,s-1),ve=m.current.value.length;(ie=m.current)==null||ie.setSelectionRange(fe,ve),I(fe),ae(ve)}b(!0)},[s]),X=Yt.useCallback(ie=>{var fe,ve;let Me=m.current;if(!y&&(!g.current.isIOS||!ie.clipboardData||!Me))return;let Ne=ie.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),ie.preventDefault();let $e=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(ve=m.current)==null?void 0:ve.selectionEnd,Le=($e!==Ie?ue.slice(0,$e)+Te+ue.slice(Ie):ue.slice(0,$e)+Te+ue.slice($e)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,G(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ae(ke)},[s,G,E,ue]),Q=Yt.useMemo(()=>({position:"relative",cursor:k.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[k.disabled]),R=Yt.useMemo(()=>({position:"absolute",inset:0,width:O.willPushPWMBadge?`calc(100% + ${O.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:O.willPushPWMBadge?`inset(0 ${O.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[O.PWM_BADGE_SPACE_WIDTH,O.willPushPWMBadge,o]),Z=Yt.useMemo(()=>Yt.createElement("input",QX(ZX({autoComplete:k.autoComplete||"one-time-code"},k),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ue.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:R,maxLength:s,value:ue,ref:m,onPaste:ie=>{var fe;X(ie),(fe=k.onPaste)==null||fe.call(k,ie)},onChange:se,onMouseOver:ie=>{var fe;_(!0),(fe=k.onMouseOver)==null||fe.call(k,ie)},onMouseLeave:ie=>{var fe;_(!1),(fe=k.onMouseLeave)==null||fe.call(k,ie)},onFocus:ie=>{var fe;ee(),(fe=k.onFocus)==null||fe.call(k,ie)},onBlur:ie=>{var fe;b(!1),(fe=k.onBlur)==null||fe.call(k,ie)}})),[se,ee,X,l,R,s,F,M,k,E==null?void 0:E.source,ue]),te=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ie,fe)=>{var ve;let Me=S&&M!==null&&F!==null&&(M===F&&fe===M||fe>=M&&feN?N(te):Yt.createElement(m7.Provider,{value:te},D),[D,te,N]);return Yt.createElement(Yt.Fragment,null,P!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,P)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:A},le,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Z)))});v7.displayName="Input";function ch(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var aZ=` [data-input-otp] { --nojs-bg: white !important; --nojs-fg: black !important; @@ -218,17 +218,17 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene --nojs-bg: black !important; --nojs-fg: white !important; } -}`;const b7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>ge.jsx(v7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));b7.displayName="InputOTP";const y7=Yt.forwardRef(({className:t,...e},r)=>ge.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));y7.displayName="InputOTPGroup";const Ac=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(m7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return ge.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&ge.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:ge.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Ac.displayName="InputOTPSlot";function cZ(t){const{spinning:e,children:r,className:n}=t;return ge.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&ge.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:ge.jsx(vc,{className:"xc-animate-spin"})})]})}function w7(t){const{email:e}=t,[r,n]=Se.useState(0),[i,s]=Se.useState(!1),[o,a]=Se.useState("");async function u(){n(60);const d=setInterval(()=>{n(g=>g===0?(clearInterval(d),0):g-1)},1e3)}async function l(d){if(a(""),!(d.length<6)){s(!0);try{await t.onInputCode(e,d)}catch(g){a(g.message)}s(!1)}}return Se.useEffect(()=>{u()},[]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(FK,{className:"xc-mb-4",size:60}),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:[ge.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),ge.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]}),ge.jsx("div",{className:"xc-mb-2 xc-h-12",children:ge.jsx(cZ,{spinning:i,className:"xc-rounded-xl",children:ge.jsx(b7,{maxLength:6,onChange:l,disabled:i,className:"disabled:xc-opacity-20",children:ge.jsx(y7,{children:ge.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[ge.jsx(Ac,{index:0}),ge.jsx(Ac,{index:1}),ge.jsx(Ac,{index:2}),ge.jsx(Ac,{index:3}),ge.jsx(Ac,{index:4}),ge.jsx(Ac,{index:5})]})})})})}),o&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:o})})]}),ge.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Resend in ${r}s`:ge.jsx("button",{id:"sendCodeButton",onClick:t.onResendCode,children:"Send again"})]}),ge.jsx("div",{id:"captcha-element"})]})}function x7(t){const{email:e}=t,[r,n]=Se.useState(!1),[i,s]=Se.useState(""),o=Se.useMemo(()=>`xn-btn-${new Date().getTime()}`,[e]);async function a(y,A){n(!0),s(""),await va.getEmailCode({account_type:"email",email:y},A),n(!1)}async function u(y){try{return await a(e,JSON.stringify(y)),{captchaResult:!0,bizResult:!0}}catch(A){return s(A.message),{captchaResult:!1,bizResult:!1}}}async function l(y){y&&t.onCodeSend()}const d=Se.useRef();function g(y){d.current=y}return Se.useEffect(()=>{if(e)return window.initAliyunCaptcha({SceneId:"tqyu8129d",prefix:"1mfsn5f",mode:"popup",element:"#captcha-element",button:`#${o}`,captchaVerifyCallback:u,onBizResultCallback:l,getInstance:g,slideStyle:{width:360,height:40},language:"en",region:"cn"}),()=>{var y,A;(y=document.getElementById("aliyunCaptcha-mask"))==null||y.remove(),(A=document.getElementById("aliyunCaptcha-window-popup"))==null||A.remove()}},[e]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(jK,{className:"xc-mb-4",size:60}),ge.jsx("button",{className:"xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2",id:o,children:r?ge.jsx(vc,{className:"xc-animate-spin"}):"I'm not a robot"})]}),i&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:i})})]})}function uZ(t){const{email:e}=t,r=Mb(),[n,i]=Se.useState("captcha");async function s(o,a){const u=await va.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:a,email:o,inviter_code:r.inviterCode,source:{device:r.device,channel:r.channel,app:r.app}});t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),n==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>i("verify-email")}),n==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:s,onResendCode:()=>i("captcha")})]})}var _7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var g=function(f,p){var v=f,x=k[p],_=null,S=0,b=null,M=[],I={},F=function(te,le){_=function(ie){for(var fe=new Array(ie),ve=0;ve=7&&ee(te),b==null&&(b=R(v,x,M)),Q(b,le)},ae=function(te,le){for(var ie=-1;ie<=7;ie+=1)if(!(te+ie<=-1||S<=te+ie))for(var fe=-1;fe<=7;fe+=1)le+fe<=-1||S<=le+fe||(_[te+ie][le+fe]=0<=ie&&ie<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(ie==0||ie==6)||2<=ie&&ie<=4&&2<=fe&&fe<=4)},O=function(){for(var te=8;te>ie&1)==1;_[Math.floor(ie/3)][ie%3+S-8-3]=fe}for(ie=0;ie<18;ie+=1)fe=!te&&(le>>ie&1)==1,_[ie%3+S-8-3][Math.floor(ie/3)]=fe},X=function(te,le){for(var ie=x<<3|le,fe=B.getBCHTypeInfo(ie),ve=0;ve<15;ve+=1){var Me=!te&&(fe>>ve&1)==1;ve<6?_[ve][8]=Me:ve<8?_[ve+1][8]=Me:_[S-15+ve][8]=Me}for(ve=0;ve<15;ve+=1)Me=!te&&(fe>>ve&1)==1,ve<8?_[8][S-ve-1]=Me:ve<9?_[8][15-ve-1+1]=Me:_[8][15-ve-1]=Me;_[S-8][8]=!te},Q=function(te,le){for(var ie=-1,fe=S-1,ve=7,Me=0,Ne=B.getMaskFunction(le),Te=S-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var $e=0;$e<2;$e+=1)if(_[fe][Te-$e]==null){var Ie=!1;Me>>ve&1)==1),Ne(fe,Te-$e)&&(Ie=!Ie),_[fe][Te-$e]=Ie,(ve-=1)==-1&&(Me+=1,ve=7)}if((fe+=ie)<0||S<=fe){fe-=ie,ie=-ie;break}}},R=function(te,le,ie){for(var fe=K.getRSBlocks(te,le),ve=J(),Me=0;Me8*Te)throw"code length overflow. ("+ve.getLengthInBits()+">"+8*Te+")";for(ve.getLengthInBits()+4<=8*Te&&ve.put(0,4);ve.getLengthInBits()%8!=0;)ve.putBit(!1);for(;!(ve.getLengthInBits()>=8*Te||(ve.put(236,8),ve.getLengthInBits()>=8*Te));)ve.put(17,8);return function($e,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Ee=0;Ee=0?rt.getAt(Je):0}}var pt=0;for(Be=0;BeIe)&&(Ne=Ie,Te=$e)}return Te}())},I.createTableTag=function(te,le){te=te||2;var ie="";ie+='";for(var ve=0;ve';ie+=""}return(ie+="")+"
"},I.createSvgTag=function(te,le,ie,fe){var ve={};typeof arguments[0]=="object"&&(te=(ve=arguments[0]).cellSize,le=ve.margin,ie=ve.alt,fe=ve.title),te=te||2,le=le===void 0?4*te:le,(ie=typeof ie=="string"?{text:ie}:ie||{}).text=ie.text||null,ie.id=ie.text?ie.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*te+2*le,Le="";for($e="l"+te+",0 0,"+te+" -"+te+",0 0,-"+te+"z ",Le+=''+Z(fe.text)+"":"",Le+=ie.text?''+Z(ie.text)+"":"",Le+='',Le+='"},I.createDataURL=function(te,le){te=te||2,le=le===void 0?4*te:le;var ie=I.getModuleCount()*te+2*le,fe=le,ve=ie-le;return m(ie,ie,function(Me,Ne){if(fe<=Me&&Me"};var Z=function(te){for(var le="",ie=0;ie":le+=">";break;case"&":le+="&";break;case'"':le+=""";break;default:le+=fe}}return le};return I.createASCII=function(te,le){if((te=te||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Ee,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:pt[Be];ft+=` +}`;const b7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>ge.jsx(v7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));b7.displayName="InputOTP";const y7=Yt.forwardRef(({className:t,...e},r)=>ge.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));y7.displayName="InputOTPGroup";const Ac=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(m7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return ge.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&ge.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:ge.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Ac.displayName="InputOTPSlot";function cZ(t){const{spinning:e,children:r,className:n}=t;return ge.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&ge.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:ge.jsx(vc,{className:"xc-animate-spin"})})]})}function w7(t){const{email:e}=t,[r,n]=Se.useState(0),[i,s]=Se.useState(!1),[o,a]=Se.useState("");async function u(){n(60);const d=setInterval(()=>{n(p=>p===0?(clearInterval(d),0):p-1)},1e3)}async function l(d){if(a(""),!(d.length<6)){s(!0);try{await t.onInputCode(e,d)}catch(p){a(p.message)}s(!1)}}return Se.useEffect(()=>{u()},[]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(FK,{className:"xc-mb-4",size:60}),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:[ge.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),ge.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]}),ge.jsx("div",{className:"xc-mb-2 xc-h-12",children:ge.jsx(cZ,{spinning:i,className:"xc-rounded-xl",children:ge.jsx(b7,{maxLength:6,onChange:l,disabled:i,className:"disabled:xc-opacity-20",children:ge.jsx(y7,{children:ge.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[ge.jsx(Ac,{index:0}),ge.jsx(Ac,{index:1}),ge.jsx(Ac,{index:2}),ge.jsx(Ac,{index:3}),ge.jsx(Ac,{index:4}),ge.jsx(Ac,{index:5})]})})})})}),o&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:o})})]}),ge.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Resend in ${r}s`:ge.jsx("button",{id:"sendCodeButton",onClick:t.onResendCode,children:"Send again"})]}),ge.jsx("div",{id:"captcha-element"})]})}function x7(t){const{email:e}=t,[r,n]=Se.useState(!1),[i,s]=Se.useState(""),o=Se.useMemo(()=>`xn-btn-${new Date().getTime()}`,[e]);async function a(y,A){n(!0),s(""),await va.getEmailCode({account_type:"email",email:y},A),n(!1)}async function u(y){try{return await a(e,JSON.stringify(y)),{captchaResult:!0,bizResult:!0}}catch(A){return s(A.message),{captchaResult:!1,bizResult:!1}}}async function l(y){y&&t.onCodeSend()}const d=Se.useRef();function p(y){d.current=y}return Se.useEffect(()=>{if(e)return window.initAliyunCaptcha({SceneId:"tqyu8129d",prefix:"1mfsn5f",mode:"popup",element:"#captcha-element",button:`#${o}`,captchaVerifyCallback:u,onBizResultCallback:l,getInstance:p,slideStyle:{width:360,height:40},language:"en",region:"cn"}),()=>{var y,A;(y=document.getElementById("aliyunCaptcha-mask"))==null||y.remove(),(A=document.getElementById("aliyunCaptcha-window-popup"))==null||A.remove()}},[e]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(jK,{className:"xc-mb-4",size:60}),ge.jsx("button",{className:"xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2",id:o,children:r?ge.jsx(vc,{className:"xc-animate-spin"}):"I'm not a robot"})]}),i&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:i})})]})}function uZ(t){const{email:e}=t,r=Mb(),[n,i]=Se.useState("captcha");async function s(o,a){const u=await va.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:a,email:o,inviter_code:r.inviterCode,source:{device:r.device,channel:r.channel,app:r.app}});t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),n==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>i("verify-email")}),n==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:s,onResendCode:()=>i("captcha")})]})}var _7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var p=function(f,g){var v=f,x=k[g],_=null,S=0,b=null,M=[],I={},F=function(te,le){_=function(ie){for(var fe=new Array(ie),ve=0;ve=7&&ee(te),b==null&&(b=R(v,x,M)),Q(b,le)},ae=function(te,le){for(var ie=-1;ie<=7;ie+=1)if(!(te+ie<=-1||S<=te+ie))for(var fe=-1;fe<=7;fe+=1)le+fe<=-1||S<=le+fe||(_[te+ie][le+fe]=0<=ie&&ie<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(ie==0||ie==6)||2<=ie&&ie<=4&&2<=fe&&fe<=4)},O=function(){for(var te=8;te>ie&1)==1;_[Math.floor(ie/3)][ie%3+S-8-3]=fe}for(ie=0;ie<18;ie+=1)fe=!te&&(le>>ie&1)==1,_[ie%3+S-8-3][Math.floor(ie/3)]=fe},X=function(te,le){for(var ie=x<<3|le,fe=B.getBCHTypeInfo(ie),ve=0;ve<15;ve+=1){var Me=!te&&(fe>>ve&1)==1;ve<6?_[ve][8]=Me:ve<8?_[ve+1][8]=Me:_[S-15+ve][8]=Me}for(ve=0;ve<15;ve+=1)Me=!te&&(fe>>ve&1)==1,ve<8?_[8][S-ve-1]=Me:ve<9?_[8][15-ve-1+1]=Me:_[8][15-ve-1]=Me;_[S-8][8]=!te},Q=function(te,le){for(var ie=-1,fe=S-1,ve=7,Me=0,Ne=B.getMaskFunction(le),Te=S-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var $e=0;$e<2;$e+=1)if(_[fe][Te-$e]==null){var Ie=!1;Me>>ve&1)==1),Ne(fe,Te-$e)&&(Ie=!Ie),_[fe][Te-$e]=Ie,(ve-=1)==-1&&(Me+=1,ve=7)}if((fe+=ie)<0||S<=fe){fe-=ie,ie=-ie;break}}},R=function(te,le,ie){for(var fe=K.getRSBlocks(te,le),ve=J(),Me=0;Me8*Te)throw"code length overflow. ("+ve.getLengthInBits()+">"+8*Te+")";for(ve.getLengthInBits()+4<=8*Te&&ve.put(0,4);ve.getLengthInBits()%8!=0;)ve.putBit(!1);for(;!(ve.getLengthInBits()>=8*Te||(ve.put(236,8),ve.getLengthInBits()>=8*Te));)ve.put(17,8);return function($e,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Ee=0;Ee=0?rt.getAt(Je):0}}var pt=0;for(Be=0;BeIe)&&(Ne=Ie,Te=$e)}return Te}())},I.createTableTag=function(te,le){te=te||2;var ie="";ie+='";for(var ve=0;ve';ie+=""}return(ie+="")+"
"},I.createSvgTag=function(te,le,ie,fe){var ve={};typeof arguments[0]=="object"&&(te=(ve=arguments[0]).cellSize,le=ve.margin,ie=ve.alt,fe=ve.title),te=te||2,le=le===void 0?4*te:le,(ie=typeof ie=="string"?{text:ie}:ie||{}).text=ie.text||null,ie.id=ie.text?ie.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*te+2*le,Le="";for($e="l"+te+",0 0,"+te+" -"+te+",0 0,-"+te+"z ",Le+=''+Z(fe.text)+"":"",Le+=ie.text?''+Z(ie.text)+"":"",Le+='',Le+='"},I.createDataURL=function(te,le){te=te||2,le=le===void 0?4*te:le;var ie=I.getModuleCount()*te+2*le,fe=le,ve=ie-le;return m(ie,ie,function(Me,Ne){if(fe<=Me&&Me"};var Z=function(te){for(var le="",ie=0;ie":le+=">";break;case"&":le+="&";break;case'"':le+=""";break;default:le+=fe}}return le};return I.createASCII=function(te,le){if((te=te||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Ee,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:pt[Be];ft+=` `}return et%2&&ze>0?ft.substring(0,ft.length-et-1)+Array(et+1).join("▀"):ft.substring(0,ft.length-1)}(le);te-=1,le=le===void 0?2*te:le;var ie,fe,ve,Me,Ne=I.getModuleCount()*te+2*le,Te=le,$e=Ne-le,Ie=Array(te+1).join("██"),Le=Array(te+1).join(" "),Ve="",ke="";for(ie=0;ie>>8),S.push(255&I)):S.push(x)}}return S}};var y,A,P,N,D,k={L:1,M:0,Q:3,H:2},B=(y=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],A=1335,P=7973,D=function(f){for(var p=0;f!=0;)p+=1,f>>>=1;return p},(N={}).getBCHTypeInfo=function(f){for(var p=f<<10;D(p)-D(A)>=0;)p^=A<=0;)p^=P<5&&(v+=3+S-5)}for(x=0;x=256;)x-=255;return f[x]}}}();function U(f,p){if(f.length===void 0)throw f.length+"/"+p;var v=function(){for(var _=0;_>>7-x%8&1)==1},put:function(x,_){for(var S=0;S<_;S+=1)v.putBit((x>>>_-S-1&1)==1)},getLengthInBits:function(){return p},putBit:function(x){var _=Math.floor(p/8);f.length<=_&&f.push(0),x&&(f[_]|=128>>>p%8),p+=1}};return v},T=function(f){var p=f,v={getMode:function(){return 1},getLength:function(S){return p.length},write:function(S){for(var b=p,M=0;M+2>>8&255)+(255&M),_.put(M,13),b+=2}if(b>>8)},writeBytes:function(v,x,_){x=x||0,_=_||v.length;for(var S=0;S<_;S+=1)p.writeByte(v[S+x])},writeString:function(v){for(var x=0;x0&&(v+=","),v+=f[x];return v+"]"}};return p},E=function(f){var p=f,v=0,x=0,_=0,S={read:function(){for(;_<8;){if(v>=p.length){if(_==0)return-1;throw"unexpected end of file./"+_}var M=p.charAt(v);if(v+=1,M=="=")return _=0,-1;M.match(/^\s$/)||(x=x<<6|b(M.charCodeAt(0)),_+=6)}var I=x>>>_-8&255;return _-=8,I}},b=function(M){if(65<=M&&M<=90)return M-65;if(97<=M&&M<=122)return M-97+26;if(48<=M&&M<=57)return M-48+52;if(M==43)return 62;if(M==47)return 63;throw"c:"+M};return S},m=function(f,p,v){for(var x=function(ae,O){var se=ae,ee=O,X=new Array(ae*O),Q={setPixel:function(te,le,ie){X[le*se+te]=ie},write:function(te){te.writeString("GIF87a"),te.writeShort(se),te.writeShort(ee),te.writeByte(128),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(255),te.writeByte(255),te.writeByte(255),te.writeString(","),te.writeShort(0),te.writeShort(0),te.writeShort(se),te.writeShort(ee),te.writeByte(0);var le=R(2);te.writeByte(2);for(var ie=0;le.length-ie>255;)te.writeByte(255),te.writeBytes(le,ie,255),ie+=255;te.writeByte(le.length-ie),te.writeBytes(le,ie,le.length-ie),te.writeByte(0),te.writeString(";")}},R=function(te){for(var le=1<>>Ee)throw"length over";for(;Te+Ee>=8;)Ne.writeByte(255&(He<>>=8-Te,$e=0,Te=0;$e|=He<0&&Ne.writeByte($e)}});Le.write(le,fe);var Ve=0,ke=String.fromCharCode(X[Ve]);for(Ve+=1;Ve=6;)Q(ae>>>O-6),O-=6},X.flush=function(){if(O>0&&(Q(ae<<6-O),ae=0,O=0),se%3!=0)for(var Z=3-se%3,te=0;te>6,128|63&N):N<55296||N>=57344?A.push(224|N>>12,128|N>>6&63,128|63&N):(P++,N=65536+((1023&N)<<10|1023&y.charCodeAt(P)),A.push(240|N>>18,128|N>>12&63,128|N>>6&63,128|63&N))}return A}(g)},(l=typeof(u=function(){return d})=="function"?u.apply(a,[]):u)===void 0||(o.exports=l)}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var u=n[o]={exports:{}};return r[o](u,u.exports,i),u.exports}i.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return i.d(a,{a}),a},i.d=(o,a)=>{for(var u in a)i.o(a,u)&&!i.o(o,u)&&Object.defineProperty(o,u,{enumerable:!0,get:a[u]})},i.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a);var s={};return(()=>{i.d(s,{default:()=>G});const o=E=>!!E&&typeof E=="object"&&!Array.isArray(E);function a(E,...m){if(!m.length)return E;const f=m.shift();return f!==void 0&&o(E)&&o(f)?(E=Object.assign({},E),Object.keys(f).forEach(p=>{const v=E[p],x=f[p];Array.isArray(v)&&Array.isArray(x)?E[p]=x:o(v)&&o(x)?E[p]=a(Object.assign({},v),x):E[p]=x}),a(E,...m)):E}function u(E,m){const f=document.createElement("a");f.download=m,f.href=E,document.body.appendChild(f),f.click(),document.body.removeChild(f)}const l={L:.07,M:.15,Q:.25,H:.3};class d{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;switch(this._type){case"dots":x=this._drawDot;break;case"classy":x=this._drawClassy;break;case"classy-rounded":x=this._drawClassyRounded;break;case"rounded":x=this._drawRounded;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawSquare}x.call(this,{x:m,y:f,size:p,getNeighbor:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(p+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(p)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_basicSideRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, 0 ${-f}`)}}))}_basicCornerRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}v `+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_basicCornerExtraRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`)}}))}_basicCornersRounded(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${v}v `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${f/2} ${f/2}h `+f/2+"v "+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_drawDot({x:m,y:f,size:p}){this._basicDot({x:m,y:f,size:p,rotation:0})}_drawSquare({x:m,y:f,size:p}){this._basicSquare({x:m,y:f,size:p,rotation:0})}_drawRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:p,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerRounded({x:m,y:f,size:p,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:p,rotation:I})}}else this._basicDot({x:m,y:f,size:p,rotation:0})}_drawExtraRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:p,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:p,rotation:I})}}else this._basicDot({x:m,y:f,size:p,rotation:0})}_drawClassy({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:p,rotation:0}):this._basicCornerRounded({x:m,y:f,size:p,rotation:Math.PI/2}):this._basicCornerRounded({x:m,y:f,size:p,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:p,rotation:Math.PI/2})}_drawClassyRounded({x:m,y:f,size:p,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:p,rotation:0}):this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:m,y:f,size:p,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:p,rotation:Math.PI/2})}}class g{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;switch(this._type){case"square":x=this._drawSquare;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawDot}x.call(this,{x:m,y:f,size:p,rotation:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p+f/2} ${v}a ${f/2} ${f/2} 0 1 0 0.1 0zm 0 ${x}a ${f/2-x} ${f/2-x} 0 1 1 -0.1 0Z`)}}))}_basicSquare(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p} ${v}v ${f}h ${f}v `+-f+`zM ${p+x} ${v+x}h `+(f-2*x)+"v "+(f-2*x)+"h "+(2*x-f)+"z")}}))}_basicExtraRounded(m){const{size:f,x:p,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p} ${v+2.5*x}v `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*x}h `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*-x}v `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*-x}h `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*x}M ${p+2.5*x} ${v+x}h `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*x}v `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*x}h `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*-x}v `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*-x}`)}}))}_drawDot({x:m,y:f,size:p,rotation:v}){this._basicDot({x:m,y:f,size:p,rotation:v})}_drawSquare({x:m,y:f,size:p,rotation:v}){this._basicSquare({x:m,y:f,size:p,rotation:v})}_drawExtraRounded({x:m,y:f,size:p,rotation:v}){this._basicExtraRounded({x:m,y:f,size:p,rotation:v})}}class y{constructor({svg:m,type:f,window:p}){this._svg=m,this._type=f,this._window=p}draw(m,f,p,v){let x;x=this._type==="square"?this._drawSquare:this._drawDot,x.call(this,{x:m,y:f,size:p,rotation:v})}_rotateFigure({x:m,y:f,size:p,rotation:v=0,draw:x}){var _;const S=m+p/2,b=f+p/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(p+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:p,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(p)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_drawDot({x:m,y:f,size:p,rotation:v}){this._basicDot({x:m,y:f,size:p,rotation:v})}_drawSquare({x:m,y:f,size:p,rotation:v}){this._basicSquare({x:m,y:f,size:p,rotation:v})}}const A="circle",P=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],N=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class D{constructor(m,f){this._roundSize=p=>this._options.dotsOptions.roundSize?Math.floor(p):p,this._window=f,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(m.width)),this._element.setAttribute("height",String(m.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),m.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=m.image,this._instanceId=D.instanceCount++,this._options=m}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(m){const f=m.getModuleCount(),p=Math.min(this._options.width,this._options.height)-2*this._options.margin,v=this._options.shape===A?p/Math.sqrt(2):p,x=this._roundSize(v/f);let _={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=m,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:S,qrOptions:b}=this._options,M=S.imageSize*l[b.errorCorrectionLevel],I=Math.floor(M*f*f);_=function({originalHeight:F,originalWidth:ae,maxHiddenDots:O,maxHiddenAxisDots:se,dotSize:ee}){const X={x:0,y:0},Q={x:0,y:0};if(F<=0||ae<=0||O<=0||ee<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const R=F/ae;return X.x=Math.floor(Math.sqrt(O/R)),X.x<=0&&(X.x=1),se&&seO||se&&se{var M,I,F,ae,O,se;return!(this._options.imageOptions.hideBackgroundDots&&S>=(f-_.hideYDots)/2&&S<(f+_.hideYDots)/2&&b>=(f-_.hideXDots)/2&&b<(f+_.hideXDots)/2||!((M=P[S])===null||M===void 0)&&M[b]||!((I=P[S-f+7])===null||I===void 0)&&I[b]||!((F=P[S])===null||F===void 0)&&F[b-f+7]||!((ae=N[S])===null||ae===void 0)&&ae[b]||!((O=N[S-f+7])===null||O===void 0)&&O[b]||!((se=N[S])===null||se===void 0)&&se[b-f+7])}),this.drawCorners(),this._options.image&&await this.drawImage({width:_.width,height:_.height,count:f,dotSize:x})}drawBackground(){var m,f,p;const v=this._element,x=this._options;if(v){const _=(m=x.backgroundOptions)===null||m===void 0?void 0:m.gradient,S=(f=x.backgroundOptions)===null||f===void 0?void 0:f.color;let b=x.height,M=x.width;if(_||S){const I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((p=x.backgroundOptions)===null||p===void 0)&&p.round&&(b=M=Math.min(x.width,x.height),I.setAttribute("rx",String(b/2*x.backgroundOptions.round))),I.setAttribute("x",String(this._roundSize((x.width-M)/2))),I.setAttribute("y",String(this._roundSize((x.height-b)/2))),I.setAttribute("width",String(M)),I.setAttribute("height",String(b)),this._backgroundClipPath.appendChild(I),this._createColor({options:_,color:S,additionalRotation:0,x:0,y:0,height:x.height,width:x.width,name:`background-color-${this._instanceId}`})}}}drawDots(m){var f,p;if(!this._qr)throw"QR code is not defined";const v=this._options,x=this._qr.getModuleCount();if(x>v.width||x>v.height)throw"The canvas is too small.";const _=Math.min(v.width,v.height)-2*v.margin,S=v.shape===A?_/Math.sqrt(2):_,b=this._roundSize(S/x),M=this._roundSize((v.width-x*b)/2),I=this._roundSize((v.height-x*b)/2),F=new d({svg:this._element,type:v.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(f=v.dotsOptions)===null||f===void 0?void 0:f.gradient,color:v.dotsOptions.color,additionalRotation:0,x:0,y:0,height:v.height,width:v.width,name:`dot-color-${this._instanceId}`});for(let ae=0;ae!(O+se<0||ae+ee<0||O+se>=x||ae+ee>=x)&&!(m&&!m(ae+ee,O+se))&&!!this._qr&&this._qr.isDark(ae+ee,O+se)),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element));if(v.shape===A){const ae=this._roundSize((_/b-x)/2),O=x+2*ae,se=M-ae*b,ee=I-ae*b,X=[],Q=this._roundSize(O/2);for(let R=0;R=ae-1&&R<=O-ae&&Z>=ae-1&&Z<=O-ae||Math.sqrt((R-Q)*(R-Q)+(Z-Q)*(Z-Q))>Q?X[R][Z]=0:X[R][Z]=this._qr.isDark(Z-2*ae<0?Z:Z>=x?Z-2*ae:Z-ae,R-2*ae<0?R:R>=x?R-2*ae:R-ae)?1:0}for(let R=0;R{var ie;return!!(!((ie=X[R+le])===null||ie===void 0)&&ie[Z+te])}),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const m=this._element,f=this._options;if(!m)throw"Element code is not defined";const p=this._qr.getModuleCount(),v=Math.min(f.width,f.height)-2*f.margin,x=f.shape===A?v/Math.sqrt(2):v,_=this._roundSize(x/p),S=7*_,b=3*_,M=this._roundSize((f.width-p*_)/2),I=this._roundSize((f.height-p*_)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([F,ae,O])=>{var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me;const Ne=M+F*_*(p-7),Te=I+ae*_*(p-7);let $e=this._dotsClipPath,Ie=this._dotsClipPath;if((!((se=f.cornersSquareOptions)===null||se===void 0)&&se.gradient||!((ee=f.cornersSquareOptions)===null||ee===void 0)&&ee.color)&&($e=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),$e.setAttribute("id",`clip-path-corners-square-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild($e),this._cornersSquareClipPath=this._cornersDotClipPath=Ie=$e,this._createColor({options:(X=f.cornersSquareOptions)===null||X===void 0?void 0:X.gradient,color:(Q=f.cornersSquareOptions)===null||Q===void 0?void 0:Q.color,additionalRotation:O,x:Ne,y:Te,height:S,width:S,name:`corners-square-color-${F}-${ae}-${this._instanceId}`})),(R=f.cornersSquareOptions)===null||R===void 0?void 0:R.type){const Le=new g({svg:this._element,type:f.cornersSquareOptions.type,window:this._window});Le.draw(Ne,Te,S,O),Le._element&&$e&&$e.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=P[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&$e&&$e.appendChild(Le._element))}if((!((te=f.cornersDotOptions)===null||te===void 0)&&te.gradient||!((le=f.cornersDotOptions)===null||le===void 0)&&le.color)&&(Ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Ie.setAttribute("id",`clip-path-corners-dot-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild(Ie),this._cornersDotClipPath=Ie,this._createColor({options:(ie=f.cornersDotOptions)===null||ie===void 0?void 0:ie.gradient,color:(fe=f.cornersDotOptions)===null||fe===void 0?void 0:fe.color,additionalRotation:O,x:Ne+2*_,y:Te+2*_,height:b,width:b,name:`corners-dot-color-${F}-${ae}-${this._instanceId}`})),(ve=f.cornersDotOptions)===null||ve===void 0?void 0:ve.type){const Le=new y({svg:this._element,type:f.cornersDotOptions.type,window:this._window});Le.draw(Ne+2*_,Te+2*_,b,O),Le._element&&Ie&&Ie.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=N[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&Ie&&Ie.appendChild(Le._element))}})}loadImage(){return new Promise((m,f)=>{var p;const v=this._options;if(!v.image)return f("Image is not defined");if(!((p=v.nodeCanvas)===null||p===void 0)&&p.loadImage)v.nodeCanvas.loadImage(v.image).then(x=>{var _,S;if(this._image=x,this._options.imageOptions.saveAsBlob){const b=(_=v.nodeCanvas)===null||_===void 0?void 0:_.createCanvas(this._image.width,this._image.height);(S=b==null?void 0:b.getContext("2d"))===null||S===void 0||S.drawImage(x,0,0),this._imageUri=b==null?void 0:b.toDataURL()}m()}).catch(f);else{const x=new this._window.Image;typeof v.imageOptions.crossOrigin=="string"&&(x.crossOrigin=v.imageOptions.crossOrigin),this._image=x,x.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await async function(_,S){return new Promise(b=>{const M=new S.XMLHttpRequest;M.onload=function(){const I=new S.FileReader;I.onloadend=function(){b(I.result)},I.readAsDataURL(M.response)},M.open("GET",_),M.responseType="blob",M.send()})}(v.image||"",this._window)),m()},x.src=v.image}})}async drawImage({width:m,height:f,count:p,dotSize:v}){const x=this._options,_=this._roundSize((x.width-p*v)/2),S=this._roundSize((x.height-p*v)/2),b=_+this._roundSize(x.imageOptions.margin+(p*v-m)/2),M=S+this._roundSize(x.imageOptions.margin+(p*v-f)/2),I=m-2*x.imageOptions.margin,F=f-2*x.imageOptions.margin,ae=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");ae.setAttribute("href",this._imageUri||""),ae.setAttribute("x",String(b)),ae.setAttribute("y",String(M)),ae.setAttribute("width",`${I}px`),ae.setAttribute("height",`${F}px`),this._element.appendChild(ae)}_createColor({options:m,color:f,additionalRotation:p,x:v,y:x,height:_,width:S,name:b}){const M=S>_?S:_,I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(I.setAttribute("x",String(v)),I.setAttribute("y",String(x)),I.setAttribute("height",String(_)),I.setAttribute("width",String(S)),I.setAttribute("clip-path",`url('#clip-path-${b}')`),m){let F;if(m.type==="radial")F=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("fx",String(v+S/2)),F.setAttribute("fy",String(x+_/2)),F.setAttribute("cx",String(v+S/2)),F.setAttribute("cy",String(x+_/2)),F.setAttribute("r",String(M/2));else{const ae=((m.rotation||0)+p)%(2*Math.PI),O=(ae+2*Math.PI)%(2*Math.PI);let se=v+S/2,ee=x+_/2,X=v+S/2,Q=x+_/2;O>=0&&O<=.25*Math.PI||O>1.75*Math.PI&&O<=2*Math.PI?(se-=S/2,ee-=_/2*Math.tan(ae),X+=S/2,Q+=_/2*Math.tan(ae)):O>.25*Math.PI&&O<=.75*Math.PI?(ee-=_/2,se-=S/2/Math.tan(ae),Q+=_/2,X+=S/2/Math.tan(ae)):O>.75*Math.PI&&O<=1.25*Math.PI?(se+=S/2,ee+=_/2*Math.tan(ae),X-=S/2,Q-=_/2*Math.tan(ae)):O>1.25*Math.PI&&O<=1.75*Math.PI&&(ee+=_/2,se+=S/2/Math.tan(ae),Q-=_/2,X-=S/2/Math.tan(ae)),F=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("x1",String(Math.round(se))),F.setAttribute("y1",String(Math.round(ee))),F.setAttribute("x2",String(Math.round(X))),F.setAttribute("y2",String(Math.round(Q)))}m.colorStops.forEach(({offset:ae,color:O})=>{const se=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");se.setAttribute("offset",100*ae+"%"),se.setAttribute("stop-color",O),F.appendChild(se)}),I.setAttribute("fill",`url('#${b}')`),this._defs.appendChild(F)}else f&&I.setAttribute("fill",f);this._element.appendChild(I)}}D.instanceCount=0;const k=D,B="canvas",j={};for(let E=0;E<=40;E++)j[E]=E;const U={type:B,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:j[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function K(E){const m=Object.assign({},E);if(!m.colorStops||!m.colorStops.length)throw"Field 'colorStops' is required in gradient";return m.rotation?m.rotation=Number(m.rotation):m.rotation=0,m.colorStops=m.colorStops.map(f=>Object.assign(Object.assign({},f),{offset:Number(f.offset)})),m}function J(E){const m=Object.assign({},E);return m.width=Number(m.width),m.height=Number(m.height),m.margin=Number(m.margin),m.imageOptions=Object.assign(Object.assign({},m.imageOptions),{hideBackgroundDots:!!m.imageOptions.hideBackgroundDots,imageSize:Number(m.imageOptions.imageSize),margin:Number(m.imageOptions.margin)}),m.margin>Math.min(m.width,m.height)&&(m.margin=Math.min(m.width,m.height)),m.dotsOptions=Object.assign({},m.dotsOptions),m.dotsOptions.gradient&&(m.dotsOptions.gradient=K(m.dotsOptions.gradient)),m.cornersSquareOptions&&(m.cornersSquareOptions=Object.assign({},m.cornersSquareOptions),m.cornersSquareOptions.gradient&&(m.cornersSquareOptions.gradient=K(m.cornersSquareOptions.gradient))),m.cornersDotOptions&&(m.cornersDotOptions=Object.assign({},m.cornersDotOptions),m.cornersDotOptions.gradient&&(m.cornersDotOptions.gradient=K(m.cornersDotOptions.gradient))),m.backgroundOptions&&(m.backgroundOptions=Object.assign({},m.backgroundOptions),m.backgroundOptions.gradient&&(m.backgroundOptions.gradient=K(m.backgroundOptions.gradient))),m}var T=i(873),z=i.n(T);function ue(E){if(!E)throw new Error("Extension must be defined");E[0]==="."&&(E=E.substring(1));const m={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[E.toLowerCase()];if(!m)throw new Error(`Extension "${E}" is not supported`);return m}class _e{constructor(m){m!=null&&m.jsdom?this._window=new m.jsdom("",{resources:"usable"}).window:this._window=window,this._options=m?J(a(U,m)):U,this.update()}static _clearContainer(m){m&&(m.innerHTML="")}_setupSvg(){if(!this._qr)return;const m=new k(this._options,this._window);this._svg=m.getElement(),this._svgDrawingPromise=m.drawQR(this._qr).then(()=>{var f;this._svg&&((f=this._extension)===null||f===void 0||f.call(this,m.getElement(),this._options))})}_setupCanvas(){var m,f;this._qr&&(!((m=this._options.nodeCanvas)===null||m===void 0)&&m.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(f=this._svgDrawingPromise)===null||f===void 0?void 0:f.then(()=>{var p;if(!this._svg)return;const v=this._svg,x=new this._window.XMLSerializer().serializeToString(v),_=btoa(x),S=`data:${ue("svg")};base64,${_}`;if(!((p=this._options.nodeCanvas)===null||p===void 0)&&p.loadImage)return this._options.nodeCanvas.loadImage(S).then(b=>{var M,I;b.width=this._options.width,b.height=this._options.height,(I=(M=this._nodeCanvas)===null||M===void 0?void 0:M.getContext("2d"))===null||I===void 0||I.drawImage(b,0,0)});{const b=new this._window.Image;return new Promise(M=>{b.onload=()=>{var I,F;(F=(I=this._domCanvas)===null||I===void 0?void 0:I.getContext("2d"))===null||F===void 0||F.drawImage(b,0,0),M()},b.src=S})}}))}async _getElement(m="png"){if(!this._qr)throw"QR code is empty";return m.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(m){_e._clearContainer(this._container),this._options=m?J(a(this._options,m)):this._options,this._options.data&&(this._qr=z()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(f){switch(!0){case/^[0-9]*$/.test(f):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(f):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===B?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(m){if(m){if(typeof m.appendChild!="function")throw"Container should be a single DOM node";this._options.type===B?this._domCanvas&&m.appendChild(this._domCanvas):this._svg&&m.appendChild(this._svg),this._container=m}}applyExtension(m){if(!m)throw"Extension function should be defined.";this._extension=m,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(m="png"){if(!this._qr)throw"QR code is empty";const f=await this._getElement(m),p=ue(m);if(!f)return null;if(m.toLowerCase()==="svg"){const v=`\r -${new this._window.XMLSerializer().serializeToString(f)}`;return typeof Blob>"u"||this._options.jsdom?Buffer.from(v):new Blob([v],{type:p})}return new Promise(v=>{const x=f;if("toBuffer"in x)if(p==="image/png")v(x.toBuffer(p));else if(p==="image/jpeg")v(x.toBuffer(p));else{if(p!=="application/pdf")throw Error("Unsupported extension");v(x.toBuffer(p))}else"toBlob"in x&&x.toBlob(v,p,1)})}async download(m){if(!this._qr)throw"QR code is empty";if(typeof Blob>"u")throw"Cannot download in Node.js, call getRawData instead.";let f="png",p="qr";typeof m=="string"?(f=m,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):typeof m=="object"&&m!==null&&(m.name&&(p=m.name),m.extension&&(f=m.extension));const v=await this._getElement(f);if(v)if(f.toLowerCase()==="svg"){let x=new XMLSerializer().serializeToString(v);x=`\r -`+x,u(`data:${ue(f)};charset=utf-8,${encodeURIComponent(x)}`,`${p}.svg`)}else u(v.toDataURL(ue(f)),`${p}.${f}`)}}const G=_e})(),s.default})())})(_7);var fZ=_7.exports;const E7=ji(fZ);class Aa extends yt{constructor(e){const{docsPath:r,field:n,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${n}".`,{docsPath:r,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}function S7(t){if(/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t)||/%[^0-9a-f]/i.test(t)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(t))return!1;const e=lZ(t),r=e[1],n=e[2],i=e[3],s=e[4],o=e[5];if(!(r!=null&&r.length&&i.length>=0))return!1;if(n!=null&&n.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9\+\-\.]*$/.test(r.toLowerCase()))return!1;let a="";return a+=`${r}:`,n!=null&&n.length&&(a+=`//${n}`),a+=i,s!=null&&s.length&&(a+=`?${s}`),o!=null&&o.length&&(a+=`#${o}`),a}function lZ(t){return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}function A7(t){const{chainId:e,domain:r,expirationTime:n,issuedAt:i=new Date,nonce:s,notBefore:o,requestId:a,resources:u,scheme:l,uri:d,version:g}=t;{if(e!==Math.floor(e))throw new Aa({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${e}`]});if(!(hZ.test(r)||dZ.test(r)||pZ.test(r)))throw new Aa({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${r}`]});if(!gZ.test(s))throw new Aa({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${s}`]});if(!S7(d))throw new Aa({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${d}`]});if(g!=="1")throw new Aa({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${g}`]});if(l&&!mZ.test(l))throw new Aa({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${l}`]});const k=t.statement;if(k!=null&&k.includes(` +`}return Ve.substring(0,Ve.length-1)},I.renderTo2dContext=function(te,le){le=le||2;for(var ie=I.getModuleCount(),fe=0;fe>>8),S.push(255&I)):S.push(x)}}return S}};var y,A,P,N,D,k={L:1,M:0,Q:3,H:2},B=(y=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],A=1335,P=7973,D=function(f){for(var g=0;f!=0;)g+=1,f>>>=1;return g},(N={}).getBCHTypeInfo=function(f){for(var g=f<<10;D(g)-D(A)>=0;)g^=A<=0;)g^=P<5&&(v+=3+S-5)}for(x=0;x=256;)x-=255;return f[x]}}}();function U(f,g){if(f.length===void 0)throw f.length+"/"+g;var v=function(){for(var _=0;_>>7-x%8&1)==1},put:function(x,_){for(var S=0;S<_;S+=1)v.putBit((x>>>_-S-1&1)==1)},getLengthInBits:function(){return g},putBit:function(x){var _=Math.floor(g/8);f.length<=_&&f.push(0),x&&(f[_]|=128>>>g%8),g+=1}};return v},T=function(f){var g=f,v={getMode:function(){return 1},getLength:function(S){return g.length},write:function(S){for(var b=g,M=0;M+2>>8&255)+(255&M),_.put(M,13),b+=2}if(b>>8)},writeBytes:function(v,x,_){x=x||0,_=_||v.length;for(var S=0;S<_;S+=1)g.writeByte(v[S+x])},writeString:function(v){for(var x=0;x0&&(v+=","),v+=f[x];return v+"]"}};return g},E=function(f){var g=f,v=0,x=0,_=0,S={read:function(){for(;_<8;){if(v>=g.length){if(_==0)return-1;throw"unexpected end of file./"+_}var M=g.charAt(v);if(v+=1,M=="=")return _=0,-1;M.match(/^\s$/)||(x=x<<6|b(M.charCodeAt(0)),_+=6)}var I=x>>>_-8&255;return _-=8,I}},b=function(M){if(65<=M&&M<=90)return M-65;if(97<=M&&M<=122)return M-97+26;if(48<=M&&M<=57)return M-48+52;if(M==43)return 62;if(M==47)return 63;throw"c:"+M};return S},m=function(f,g,v){for(var x=function(ae,O){var se=ae,ee=O,X=new Array(ae*O),Q={setPixel:function(te,le,ie){X[le*se+te]=ie},write:function(te){te.writeString("GIF87a"),te.writeShort(se),te.writeShort(ee),te.writeByte(128),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(255),te.writeByte(255),te.writeByte(255),te.writeString(","),te.writeShort(0),te.writeShort(0),te.writeShort(se),te.writeShort(ee),te.writeByte(0);var le=R(2);te.writeByte(2);for(var ie=0;le.length-ie>255;)te.writeByte(255),te.writeBytes(le,ie,255),ie+=255;te.writeByte(le.length-ie),te.writeBytes(le,ie,le.length-ie),te.writeByte(0),te.writeString(";")}},R=function(te){for(var le=1<>>Ee)throw"length over";for(;Te+Ee>=8;)Ne.writeByte(255&(He<>>=8-Te,$e=0,Te=0;$e|=He<0&&Ne.writeByte($e)}});Le.write(le,fe);var Ve=0,ke=String.fromCharCode(X[Ve]);for(Ve+=1;Ve=6;)Q(ae>>>O-6),O-=6},X.flush=function(){if(O>0&&(Q(ae<<6-O),ae=0,O=0),se%3!=0)for(var Z=3-se%3,te=0;te>6,128|63&N):N<55296||N>=57344?A.push(224|N>>12,128|N>>6&63,128|63&N):(P++,N=65536+((1023&N)<<10|1023&y.charCodeAt(P)),A.push(240|N>>18,128|N>>12&63,128|N>>6&63,128|63&N))}return A}(p)},(l=typeof(u=function(){return d})=="function"?u.apply(a,[]):u)===void 0||(o.exports=l)}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var u=n[o]={exports:{}};return r[o](u,u.exports,i),u.exports}i.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return i.d(a,{a}),a},i.d=(o,a)=>{for(var u in a)i.o(a,u)&&!i.o(o,u)&&Object.defineProperty(o,u,{enumerable:!0,get:a[u]})},i.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a);var s={};return(()=>{i.d(s,{default:()=>G});const o=E=>!!E&&typeof E=="object"&&!Array.isArray(E);function a(E,...m){if(!m.length)return E;const f=m.shift();return f!==void 0&&o(E)&&o(f)?(E=Object.assign({},E),Object.keys(f).forEach(g=>{const v=E[g],x=f[g];Array.isArray(v)&&Array.isArray(x)?E[g]=x:o(v)&&o(x)?E[g]=a(Object.assign({},v),x):E[g]=x}),a(E,...m)):E}function u(E,m){const f=document.createElement("a");f.download=m,f.href=E,document.body.appendChild(f),f.click(),document.body.removeChild(f)}const l={L:.07,M:.15,Q:.25,H:.3};class d{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"dots":x=this._drawDot;break;case"classy":x=this._drawClassy;break;case"classy-rounded":x=this._drawClassyRounded;break;case"rounded":x=this._drawRounded;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawSquare}x.call(this,{x:m,y:f,size:g,getNeighbor:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_basicSideRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, 0 ${-f}`)}}))}_basicCornerRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_basicCornerExtraRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`)}}))}_basicCornersRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${f/2} ${f/2}h `+f/2+"v "+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_drawDot({x:m,y:f,size:g}){this._basicDot({x:m,y:f,size:g,rotation:0})}_drawSquare({x:m,y:f,size:g}){this._basicSquare({x:m,y:f,size:g,rotation:0})}_drawRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerRounded({x:m,y:f,size:g,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawExtraRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawClassy({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}_drawClassyRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}}class p{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"square":x=this._drawSquare;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawDot}x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g+f/2} ${v}a ${f/2} ${f/2} 0 1 0 0.1 0zm 0 ${x}a ${f/2-x} ${f/2-x} 0 1 1 -0.1 0Z`)}}))}_basicSquare(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f+`zM ${g+x} ${v+x}h `+(f-2*x)+"v "+(f-2*x)+"h "+(2*x-f)+"z")}}))}_basicExtraRounded(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v+2.5*x}v `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*x}h `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*-x}v `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*-x}h `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*x}M ${g+2.5*x} ${v+x}h `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*x}v `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*x}h `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*-x}v `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*-x}`)}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}_drawExtraRounded({x:m,y:f,size:g,rotation:v}){this._basicExtraRounded({x:m,y:f,size:g,rotation:v})}}class y{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;x=this._type==="square"?this._drawSquare:this._drawDot,x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}}const A="circle",P=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],N=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class D{constructor(m,f){this._roundSize=g=>this._options.dotsOptions.roundSize?Math.floor(g):g,this._window=f,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(m.width)),this._element.setAttribute("height",String(m.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),m.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=m.image,this._instanceId=D.instanceCount++,this._options=m}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(m){const f=m.getModuleCount(),g=Math.min(this._options.width,this._options.height)-2*this._options.margin,v=this._options.shape===A?g/Math.sqrt(2):g,x=this._roundSize(v/f);let _={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=m,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:S,qrOptions:b}=this._options,M=S.imageSize*l[b.errorCorrectionLevel],I=Math.floor(M*f*f);_=function({originalHeight:F,originalWidth:ae,maxHiddenDots:O,maxHiddenAxisDots:se,dotSize:ee}){const X={x:0,y:0},Q={x:0,y:0};if(F<=0||ae<=0||O<=0||ee<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const R=F/ae;return X.x=Math.floor(Math.sqrt(O/R)),X.x<=0&&(X.x=1),se&&seO||se&&se{var M,I,F,ae,O,se;return!(this._options.imageOptions.hideBackgroundDots&&S>=(f-_.hideYDots)/2&&S<(f+_.hideYDots)/2&&b>=(f-_.hideXDots)/2&&b<(f+_.hideXDots)/2||!((M=P[S])===null||M===void 0)&&M[b]||!((I=P[S-f+7])===null||I===void 0)&&I[b]||!((F=P[S])===null||F===void 0)&&F[b-f+7]||!((ae=N[S])===null||ae===void 0)&&ae[b]||!((O=N[S-f+7])===null||O===void 0)&&O[b]||!((se=N[S])===null||se===void 0)&&se[b-f+7])}),this.drawCorners(),this._options.image&&await this.drawImage({width:_.width,height:_.height,count:f,dotSize:x})}drawBackground(){var m,f,g;const v=this._element,x=this._options;if(v){const _=(m=x.backgroundOptions)===null||m===void 0?void 0:m.gradient,S=(f=x.backgroundOptions)===null||f===void 0?void 0:f.color;let b=x.height,M=x.width;if(_||S){const I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((g=x.backgroundOptions)===null||g===void 0)&&g.round&&(b=M=Math.min(x.width,x.height),I.setAttribute("rx",String(b/2*x.backgroundOptions.round))),I.setAttribute("x",String(this._roundSize((x.width-M)/2))),I.setAttribute("y",String(this._roundSize((x.height-b)/2))),I.setAttribute("width",String(M)),I.setAttribute("height",String(b)),this._backgroundClipPath.appendChild(I),this._createColor({options:_,color:S,additionalRotation:0,x:0,y:0,height:x.height,width:x.width,name:`background-color-${this._instanceId}`})}}}drawDots(m){var f,g;if(!this._qr)throw"QR code is not defined";const v=this._options,x=this._qr.getModuleCount();if(x>v.width||x>v.height)throw"The canvas is too small.";const _=Math.min(v.width,v.height)-2*v.margin,S=v.shape===A?_/Math.sqrt(2):_,b=this._roundSize(S/x),M=this._roundSize((v.width-x*b)/2),I=this._roundSize((v.height-x*b)/2),F=new d({svg:this._element,type:v.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(f=v.dotsOptions)===null||f===void 0?void 0:f.gradient,color:v.dotsOptions.color,additionalRotation:0,x:0,y:0,height:v.height,width:v.width,name:`dot-color-${this._instanceId}`});for(let ae=0;ae!(O+se<0||ae+ee<0||O+se>=x||ae+ee>=x)&&!(m&&!m(ae+ee,O+se))&&!!this._qr&&this._qr.isDark(ae+ee,O+se)),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element));if(v.shape===A){const ae=this._roundSize((_/b-x)/2),O=x+2*ae,se=M-ae*b,ee=I-ae*b,X=[],Q=this._roundSize(O/2);for(let R=0;R=ae-1&&R<=O-ae&&Z>=ae-1&&Z<=O-ae||Math.sqrt((R-Q)*(R-Q)+(Z-Q)*(Z-Q))>Q?X[R][Z]=0:X[R][Z]=this._qr.isDark(Z-2*ae<0?Z:Z>=x?Z-2*ae:Z-ae,R-2*ae<0?R:R>=x?R-2*ae:R-ae)?1:0}for(let R=0;R{var ie;return!!(!((ie=X[R+le])===null||ie===void 0)&&ie[Z+te])}),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const m=this._element,f=this._options;if(!m)throw"Element code is not defined";const g=this._qr.getModuleCount(),v=Math.min(f.width,f.height)-2*f.margin,x=f.shape===A?v/Math.sqrt(2):v,_=this._roundSize(x/g),S=7*_,b=3*_,M=this._roundSize((f.width-g*_)/2),I=this._roundSize((f.height-g*_)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([F,ae,O])=>{var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me;const Ne=M+F*_*(g-7),Te=I+ae*_*(g-7);let $e=this._dotsClipPath,Ie=this._dotsClipPath;if((!((se=f.cornersSquareOptions)===null||se===void 0)&&se.gradient||!((ee=f.cornersSquareOptions)===null||ee===void 0)&&ee.color)&&($e=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),$e.setAttribute("id",`clip-path-corners-square-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild($e),this._cornersSquareClipPath=this._cornersDotClipPath=Ie=$e,this._createColor({options:(X=f.cornersSquareOptions)===null||X===void 0?void 0:X.gradient,color:(Q=f.cornersSquareOptions)===null||Q===void 0?void 0:Q.color,additionalRotation:O,x:Ne,y:Te,height:S,width:S,name:`corners-square-color-${F}-${ae}-${this._instanceId}`})),(R=f.cornersSquareOptions)===null||R===void 0?void 0:R.type){const Le=new p({svg:this._element,type:f.cornersSquareOptions.type,window:this._window});Le.draw(Ne,Te,S,O),Le._element&&$e&&$e.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=P[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&$e&&$e.appendChild(Le._element))}if((!((te=f.cornersDotOptions)===null||te===void 0)&&te.gradient||!((le=f.cornersDotOptions)===null||le===void 0)&&le.color)&&(Ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Ie.setAttribute("id",`clip-path-corners-dot-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild(Ie),this._cornersDotClipPath=Ie,this._createColor({options:(ie=f.cornersDotOptions)===null||ie===void 0?void 0:ie.gradient,color:(fe=f.cornersDotOptions)===null||fe===void 0?void 0:fe.color,additionalRotation:O,x:Ne+2*_,y:Te+2*_,height:b,width:b,name:`corners-dot-color-${F}-${ae}-${this._instanceId}`})),(ve=f.cornersDotOptions)===null||ve===void 0?void 0:ve.type){const Le=new y({svg:this._element,type:f.cornersDotOptions.type,window:this._window});Le.draw(Ne+2*_,Te+2*_,b,O),Le._element&&Ie&&Ie.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=N[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&Ie&&Ie.appendChild(Le._element))}})}loadImage(){return new Promise((m,f)=>{var g;const v=this._options;if(!v.image)return f("Image is not defined");if(!((g=v.nodeCanvas)===null||g===void 0)&&g.loadImage)v.nodeCanvas.loadImage(v.image).then(x=>{var _,S;if(this._image=x,this._options.imageOptions.saveAsBlob){const b=(_=v.nodeCanvas)===null||_===void 0?void 0:_.createCanvas(this._image.width,this._image.height);(S=b==null?void 0:b.getContext("2d"))===null||S===void 0||S.drawImage(x,0,0),this._imageUri=b==null?void 0:b.toDataURL()}m()}).catch(f);else{const x=new this._window.Image;typeof v.imageOptions.crossOrigin=="string"&&(x.crossOrigin=v.imageOptions.crossOrigin),this._image=x,x.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await async function(_,S){return new Promise(b=>{const M=new S.XMLHttpRequest;M.onload=function(){const I=new S.FileReader;I.onloadend=function(){b(I.result)},I.readAsDataURL(M.response)},M.open("GET",_),M.responseType="blob",M.send()})}(v.image||"",this._window)),m()},x.src=v.image}})}async drawImage({width:m,height:f,count:g,dotSize:v}){const x=this._options,_=this._roundSize((x.width-g*v)/2),S=this._roundSize((x.height-g*v)/2),b=_+this._roundSize(x.imageOptions.margin+(g*v-m)/2),M=S+this._roundSize(x.imageOptions.margin+(g*v-f)/2),I=m-2*x.imageOptions.margin,F=f-2*x.imageOptions.margin,ae=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");ae.setAttribute("href",this._imageUri||""),ae.setAttribute("x",String(b)),ae.setAttribute("y",String(M)),ae.setAttribute("width",`${I}px`),ae.setAttribute("height",`${F}px`),this._element.appendChild(ae)}_createColor({options:m,color:f,additionalRotation:g,x:v,y:x,height:_,width:S,name:b}){const M=S>_?S:_,I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(I.setAttribute("x",String(v)),I.setAttribute("y",String(x)),I.setAttribute("height",String(_)),I.setAttribute("width",String(S)),I.setAttribute("clip-path",`url('#clip-path-${b}')`),m){let F;if(m.type==="radial")F=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("fx",String(v+S/2)),F.setAttribute("fy",String(x+_/2)),F.setAttribute("cx",String(v+S/2)),F.setAttribute("cy",String(x+_/2)),F.setAttribute("r",String(M/2));else{const ae=((m.rotation||0)+g)%(2*Math.PI),O=(ae+2*Math.PI)%(2*Math.PI);let se=v+S/2,ee=x+_/2,X=v+S/2,Q=x+_/2;O>=0&&O<=.25*Math.PI||O>1.75*Math.PI&&O<=2*Math.PI?(se-=S/2,ee-=_/2*Math.tan(ae),X+=S/2,Q+=_/2*Math.tan(ae)):O>.25*Math.PI&&O<=.75*Math.PI?(ee-=_/2,se-=S/2/Math.tan(ae),Q+=_/2,X+=S/2/Math.tan(ae)):O>.75*Math.PI&&O<=1.25*Math.PI?(se+=S/2,ee+=_/2*Math.tan(ae),X-=S/2,Q-=_/2*Math.tan(ae)):O>1.25*Math.PI&&O<=1.75*Math.PI&&(ee+=_/2,se+=S/2/Math.tan(ae),Q-=_/2,X-=S/2/Math.tan(ae)),F=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("x1",String(Math.round(se))),F.setAttribute("y1",String(Math.round(ee))),F.setAttribute("x2",String(Math.round(X))),F.setAttribute("y2",String(Math.round(Q)))}m.colorStops.forEach(({offset:ae,color:O})=>{const se=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");se.setAttribute("offset",100*ae+"%"),se.setAttribute("stop-color",O),F.appendChild(se)}),I.setAttribute("fill",`url('#${b}')`),this._defs.appendChild(F)}else f&&I.setAttribute("fill",f);this._element.appendChild(I)}}D.instanceCount=0;const k=D,B="canvas",j={};for(let E=0;E<=40;E++)j[E]=E;const U={type:B,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:j[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function K(E){const m=Object.assign({},E);if(!m.colorStops||!m.colorStops.length)throw"Field 'colorStops' is required in gradient";return m.rotation?m.rotation=Number(m.rotation):m.rotation=0,m.colorStops=m.colorStops.map(f=>Object.assign(Object.assign({},f),{offset:Number(f.offset)})),m}function J(E){const m=Object.assign({},E);return m.width=Number(m.width),m.height=Number(m.height),m.margin=Number(m.margin),m.imageOptions=Object.assign(Object.assign({},m.imageOptions),{hideBackgroundDots:!!m.imageOptions.hideBackgroundDots,imageSize:Number(m.imageOptions.imageSize),margin:Number(m.imageOptions.margin)}),m.margin>Math.min(m.width,m.height)&&(m.margin=Math.min(m.width,m.height)),m.dotsOptions=Object.assign({},m.dotsOptions),m.dotsOptions.gradient&&(m.dotsOptions.gradient=K(m.dotsOptions.gradient)),m.cornersSquareOptions&&(m.cornersSquareOptions=Object.assign({},m.cornersSquareOptions),m.cornersSquareOptions.gradient&&(m.cornersSquareOptions.gradient=K(m.cornersSquareOptions.gradient))),m.cornersDotOptions&&(m.cornersDotOptions=Object.assign({},m.cornersDotOptions),m.cornersDotOptions.gradient&&(m.cornersDotOptions.gradient=K(m.cornersDotOptions.gradient))),m.backgroundOptions&&(m.backgroundOptions=Object.assign({},m.backgroundOptions),m.backgroundOptions.gradient&&(m.backgroundOptions.gradient=K(m.backgroundOptions.gradient))),m}var T=i(873),z=i.n(T);function ue(E){if(!E)throw new Error("Extension must be defined");E[0]==="."&&(E=E.substring(1));const m={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[E.toLowerCase()];if(!m)throw new Error(`Extension "${E}" is not supported`);return m}class _e{constructor(m){m!=null&&m.jsdom?this._window=new m.jsdom("",{resources:"usable"}).window:this._window=window,this._options=m?J(a(U,m)):U,this.update()}static _clearContainer(m){m&&(m.innerHTML="")}_setupSvg(){if(!this._qr)return;const m=new k(this._options,this._window);this._svg=m.getElement(),this._svgDrawingPromise=m.drawQR(this._qr).then(()=>{var f;this._svg&&((f=this._extension)===null||f===void 0||f.call(this,m.getElement(),this._options))})}_setupCanvas(){var m,f;this._qr&&(!((m=this._options.nodeCanvas)===null||m===void 0)&&m.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(f=this._svgDrawingPromise)===null||f===void 0?void 0:f.then(()=>{var g;if(!this._svg)return;const v=this._svg,x=new this._window.XMLSerializer().serializeToString(v),_=btoa(x),S=`data:${ue("svg")};base64,${_}`;if(!((g=this._options.nodeCanvas)===null||g===void 0)&&g.loadImage)return this._options.nodeCanvas.loadImage(S).then(b=>{var M,I;b.width=this._options.width,b.height=this._options.height,(I=(M=this._nodeCanvas)===null||M===void 0?void 0:M.getContext("2d"))===null||I===void 0||I.drawImage(b,0,0)});{const b=new this._window.Image;return new Promise(M=>{b.onload=()=>{var I,F;(F=(I=this._domCanvas)===null||I===void 0?void 0:I.getContext("2d"))===null||F===void 0||F.drawImage(b,0,0),M()},b.src=S})}}))}async _getElement(m="png"){if(!this._qr)throw"QR code is empty";return m.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(m){_e._clearContainer(this._container),this._options=m?J(a(this._options,m)):this._options,this._options.data&&(this._qr=z()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(f){switch(!0){case/^[0-9]*$/.test(f):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(f):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===B?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(m){if(m){if(typeof m.appendChild!="function")throw"Container should be a single DOM node";this._options.type===B?this._domCanvas&&m.appendChild(this._domCanvas):this._svg&&m.appendChild(this._svg),this._container=m}}applyExtension(m){if(!m)throw"Extension function should be defined.";this._extension=m,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(m="png"){if(!this._qr)throw"QR code is empty";const f=await this._getElement(m),g=ue(m);if(!f)return null;if(m.toLowerCase()==="svg"){const v=`\r +${new this._window.XMLSerializer().serializeToString(f)}`;return typeof Blob>"u"||this._options.jsdom?Buffer.from(v):new Blob([v],{type:g})}return new Promise(v=>{const x=f;if("toBuffer"in x)if(g==="image/png")v(x.toBuffer(g));else if(g==="image/jpeg")v(x.toBuffer(g));else{if(g!=="application/pdf")throw Error("Unsupported extension");v(x.toBuffer(g))}else"toBlob"in x&&x.toBlob(v,g,1)})}async download(m){if(!this._qr)throw"QR code is empty";if(typeof Blob>"u")throw"Cannot download in Node.js, call getRawData instead.";let f="png",g="qr";typeof m=="string"?(f=m,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):typeof m=="object"&&m!==null&&(m.name&&(g=m.name),m.extension&&(f=m.extension));const v=await this._getElement(f);if(v)if(f.toLowerCase()==="svg"){let x=new XMLSerializer().serializeToString(v);x=`\r +`+x,u(`data:${ue(f)};charset=utf-8,${encodeURIComponent(x)}`,`${g}.svg`)}else u(v.toDataURL(ue(f)),`${g}.${f}`)}}const G=_e})(),s.default})())})(_7);var fZ=_7.exports;const E7=ji(fZ);class Aa extends yt{constructor(e){const{docsPath:r,field:n,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${n}".`,{docsPath:r,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}function S7(t){if(/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t)||/%[^0-9a-f]/i.test(t)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(t))return!1;const e=lZ(t),r=e[1],n=e[2],i=e[3],s=e[4],o=e[5];if(!(r!=null&&r.length&&i.length>=0))return!1;if(n!=null&&n.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9\+\-\.]*$/.test(r.toLowerCase()))return!1;let a="";return a+=`${r}:`,n!=null&&n.length&&(a+=`//${n}`),a+=i,s!=null&&s.length&&(a+=`?${s}`),o!=null&&o.length&&(a+=`#${o}`),a}function lZ(t){return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}function A7(t){const{chainId:e,domain:r,expirationTime:n,issuedAt:i=new Date,nonce:s,notBefore:o,requestId:a,resources:u,scheme:l,uri:d,version:p}=t;{if(e!==Math.floor(e))throw new Aa({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${e}`]});if(!(hZ.test(r)||dZ.test(r)||pZ.test(r)))throw new Aa({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${r}`]});if(!gZ.test(s))throw new Aa({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${s}`]});if(!S7(d))throw new Aa({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${d}`]});if(p!=="1")throw new Aa({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${p}`]});if(l&&!mZ.test(l))throw new Aa({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${l}`]});const k=t.statement;if(k!=null&&k.includes(` `))throw new Aa({field:"statement",metaMessages:["- Statement must not include '\\n'.","",`Provided value: ${k}`]})}const y=og(t.address),A=l?`${l}://${r}`:r,P=t.statement?`${t.statement} `:"",N=`${A} wants you to sign in with your Ethereum account: ${y} ${P}`;let D=`URI: ${d} -Version: ${g} +Version: ${p} Chain ID: ${e} Nonce: ${s} Issued At: ${i.toISOString()}`;if(n&&(D+=` @@ -237,7 +237,7 @@ Not Before: ${o.toISOString()}`),a&&(D+=` Request ID: ${a}`),u){let k=` Resources:`;for(const B of u){if(!S7(B))throw new Aa({field:"resources",metaMessages:["- Every resource must be a RFC 3986 URI.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${B}`]});k+=` - ${B}`}D+=k}return`${N} -${D}`}const hZ=/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/,dZ=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/,pZ=/^localhost(:[0-9]{1,5})?$/,gZ=/^[a-zA-Z0-9]{8,}$/,mZ=/^([a-zA-Z][a-zA-Z0-9+-.]*)$/,P7="7a4434fefbcc9af474fb5c995e47d286",vZ={projectId:P7,metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},bZ={namespaces:{eip155:{methods:["eth_sendTransaction","eth_signTransaction","eth_sign","personal_sign","eth_signTypedData"],chains:["eip155:1"],events:["chainChanged","accountsChanged","disconnect"],rpcMap:{1:`https://rpc.walletconnect.com?chainId=eip155:1&projectId=${P7}`}}},skipPairing:!1};function yZ(t,e){const r=window.location.host,n=window.location.href;return A7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function M7(t){var ue,_e,G;const e=Se.useRef(null),{wallet:r,onGetExtension:n,onSignFinish:i}=t,[s,o]=Se.useState(""),[a,u]=Se.useState(!1),[l,d]=Se.useState(""),[g,y]=Se.useState("scan"),A=Se.useRef(),[P,N]=Se.useState((ue=r.config)==null?void 0:ue.image),[D,k]=Se.useState(!1),{saveLastUsedWallet:B}=Kl();async function j(E){var f,p,v,x;u(!0);const m=await pz.init(vZ);m.session&&await m.disconnect();try{if(y("scan"),m.on("display_uri",ae=>{console.log("display_uri",ae),o(ae),u(!1),y("scan")}),m.on("error",ae=>{console.log(ae)}),m.on("session_update",ae=>{console.log("session_update",ae)}),!await m.connect(bZ))throw new Error("Walletconnect init failed");const S=new Wf(m);N(((f=S.config)==null?void 0:f.image)||((p=E.config)==null?void 0:p.image));const b=await S.getAddress(),M=await va.getNonce({account_type:"block_chain"});console.log("get nonce",M);const I=yZ(b,M);y("sign");const F=await S.signMessage(I,b);y("waiting"),await i(S,{message:I,nonce:M,signature:F,address:b,wallet_name:((v=S.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),B(S)}catch(_){console.log("err",_),d(_.details||_.message)}}function U(){A.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),A.current.append(e.current)}function K(E){var m;console.log(A.current),(m=A.current)==null||m.update({data:E})}Se.useEffect(()=>{s&&K(s)},[s]),Se.useEffect(()=>{j(r)},[r]),Se.useEffect(()=>{U()},[]);function J(){d(""),K(""),j(r)}function T(){k(!0),navigator.clipboard.writeText(s),setTimeout(()=>{k(!1)},2500)}function z(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return ge.jsxs("div",{children:[ge.jsx("div",{className:"xc-text-center",children:ge.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[ge.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),ge.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?ge.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):ge.jsx("img",{className:"xc-h-10 xc-w-10",src:P})})]})}),ge.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[ge.jsx("button",{disabled:!s,onClick:T,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:D?ge.jsxs(ge.Fragment,{children:[" ",ge.jsx(LK,{})," Copied!"]}):ge.jsxs(ge.Fragment,{children:[ge.jsx($K,{}),"Copy QR URL"]})}),((_e=r.config)==null?void 0:_e.getWallet)&&ge.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[ge.jsx(kK,{}),"Get Extension"]}),((G=r.config)==null?void 0:G.desktop_link)&&ge.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:z,children:[ge.jsx(f8,{}),"Desktop"]})]}),ge.jsx("div",{className:"xc-text-center",children:l?ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),ge.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:J,children:"Retry"})]}):ge.jsxs(ge.Fragment,{children:[g==="scan"&&ge.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),g==="connect"&&ge.jsx("p",{children:"Click connect in your wallet app"}),g==="sign"&&ge.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),g==="waiting"&&ge.jsx("div",{className:"xc-text-center",children:ge.jsx(vc,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const wZ="Accept connection request in the wallet",xZ="Accept sign-in request in your wallet";function _Z(t,e){const r=window.location.host,n=window.location.href;return A7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function I7(t){var g;const[e,r]=Se.useState(),{wallet:n,onSignFinish:i}=t,s=Se.useRef(),[o,a]=Se.useState("connect"),{saveLastUsedWallet:u}=Kl();async function l(y){var A;try{a("connect");const P=await n.connect();if(!P||P.length===0)throw new Error("Wallet connect error");const N=og(P[0]),D=_Z(N,y);a("sign");const k=await n.signMessage(D,N);if(!k||k.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:N,signature:k,message:D,nonce:y,wallet_name:((A=n.config)==null?void 0:A.name)||""}),u(n)}catch(P){console.log(P.details),r(P.details||P.message)}}async function d(){try{r("");const y=await va.getNonce({account_type:"block_chain"});s.current=y,l(s.current)}catch(y){console.log(y.details),r(y.message)}}return Se.useEffect(()=>{d()},[]),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[ge.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(g=n.config)==null?void 0:g.image,alt:""}),e&&ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),ge.jsx("div",{className:"xc-flex xc-gap-2",children:ge.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:d,children:"Retry"})})]}),!e&&ge.jsxs(ge.Fragment,{children:[o==="connect"&&ge.jsx("span",{className:"xc-text-center",children:wZ}),o==="sign"&&ge.jsx("span",{className:"xc-text-center",children:xZ}),o==="waiting"&&ge.jsx("span",{className:"xc-text-center",children:ge.jsx(vc,{className:"xc-animate-spin"})})]})]})}const Vu="https://static.codatta.io/codatta-connect/wallet-icons.svg",EZ="https://itunes.apple.com/app/",SZ="https://play.google.com/store/apps/details?id=",AZ="https://chromewebstore.google.com/detail/",PZ="https://chromewebstore.google.com/detail/",MZ="https://addons.mozilla.org/en-US/firefox/addon/",IZ="https://microsoftedge.microsoft.com/addons/detail/";function Gu(t){const{icon:e,title:r,link:n}=t;return ge.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[ge.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,ge.jsx(u8,{className:"xc-ml-auto xc-text-gray-400"})]})}function CZ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${EZ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${SZ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${AZ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${PZ}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${MZ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${IZ}${t.edge_addon_id}`),e}function C7(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=CZ(r);return ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),ge.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),ge.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),ge.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&ge.jsx(Gu,{link:n.chromeStoreLink,icon:`${Vu}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&ge.jsx(Gu,{link:n.appStoreLink,icon:`${Vu}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&ge.jsx(Gu,{link:n.playStoreLink,icon:`${Vu}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&ge.jsx(Gu,{link:n.edgeStoreLink,icon:`${Vu}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&ge.jsx(Gu,{link:n.braveStoreLink,icon:`${Vu}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&ge.jsx(Gu,{link:n.firefoxStoreLink,icon:`${Vu}#firefox`,title:"Mozilla Firefox"})]})]})}function TZ(t){const{wallet:e}=t,[r,n]=Se.useState(e.installed?"connect":"qr"),i=Mb();async function s(o,a){var l;const u=await va.walletLogin({account_type:"block_chain",account_enum:"C",connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&ge.jsx(M7,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&ge.jsx(I7,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&ge.jsx(C7,{wallet:e})]})}function RZ(t){const{wallet:e,onClick:r}=t,n=ge.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return ge.jsx(Eb,{icon:n,title:i,onClick:()=>r(e)})}function T7(t){const{connector:e}=t,[r,n]=Se.useState(),[i,s]=Se.useState([]),o=Se.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d),console.log(d)}Se.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[ge.jsx(l8,{className:"xc-shrink-0 xc-opacity-50"}),ge.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),ge.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>ge.jsx(RZ,{wallet:d,onClick:l},d.name))})]})}var R7={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,$[H+1]=V>>16&255,$[H+2]=V>>8&255,$[H+3]=V&255,$[H+4]=C>>24&255,$[H+5]=C>>16&255,$[H+6]=C>>8&255,$[H+7]=C&255}function N($,H,V,C,Y){var q,oe=0;for(q=0;q>>8)-1}function D($,H,V,C){return N($,H,V,C,16)}function k($,H,V,C){return N($,H,V,C,32)}function B($,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,Ue=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=oe,wt=pe,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;dt=dt+Y|0,_t=_t+q|0,ot=ot+oe|0,wt=wt+pe|0,lt=lt+xe|0,at=at+Re|0,Ae=Ae+De|0,Pe=Pe+it|0,Ge=Ge+Ue|0,je=je+gt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=_t>>>0&255,$[5]=_t>>>8&255,$[6]=_t>>>16&255,$[7]=_t>>>24&255,$[8]=ot>>>0&255,$[9]=ot>>>8&255,$[10]=ot>>>16&255,$[11]=ot>>>24&255,$[12]=wt>>>0&255,$[13]=wt>>>8&255,$[14]=wt>>>16&255,$[15]=wt>>>24&255,$[16]=lt>>>0&255,$[17]=lt>>>8&255,$[18]=lt>>>16&255,$[19]=lt>>>24&255,$[20]=at>>>0&255,$[21]=at>>>8&255,$[22]=at>>>16&255,$[23]=at>>>24&255,$[24]=Ae>>>0&255,$[25]=Ae>>>8&255,$[26]=Ae>>>16&255,$[27]=Ae>>>24&255,$[28]=Pe>>>0&255,$[29]=Pe>>>8&255,$[30]=Pe>>>16&255,$[31]=Pe>>>24&255,$[32]=Ge>>>0&255,$[33]=Ge>>>8&255,$[34]=Ge>>>16&255,$[35]=Ge>>>24&255,$[36]=je>>>0&255,$[37]=je>>>8&255,$[38]=je>>>16&255,$[39]=je>>>24&255,$[40]=qe>>>0&255,$[41]=qe>>>8&255,$[42]=qe>>>16&255,$[43]=qe>>>24&255,$[44]=Xe>>>0&255,$[45]=Xe>>>8&255,$[46]=Xe>>>16&255,$[47]=Xe>>>24&255,$[48]=kt>>>0&255,$[49]=kt>>>8&255,$[50]=kt>>>16&255,$[51]=kt>>>24&255,$[52]=Wt>>>0&255,$[53]=Wt>>>8&255,$[54]=Wt>>>16&255,$[55]=Wt>>>24&255,$[56]=Zt>>>0&255,$[57]=Zt>>>8&255,$[58]=Zt>>>16&255,$[59]=Zt>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255}function j($,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,Ue=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=oe,wt=pe,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=at>>>0&255,$[5]=at>>>8&255,$[6]=at>>>16&255,$[7]=at>>>24&255,$[8]=qe>>>0&255,$[9]=qe>>>8&255,$[10]=qe>>>16&255,$[11]=qe>>>24&255,$[12]=Kt>>>0&255,$[13]=Kt>>>8&255,$[14]=Kt>>>16&255,$[15]=Kt>>>24&255,$[16]=Ae>>>0&255,$[17]=Ae>>>8&255,$[18]=Ae>>>16&255,$[19]=Ae>>>24&255,$[20]=Pe>>>0&255,$[21]=Pe>>>8&255,$[22]=Pe>>>16&255,$[23]=Pe>>>24&255,$[24]=Ge>>>0&255,$[25]=Ge>>>8&255,$[26]=Ge>>>16&255,$[27]=Ge>>>24&255,$[28]=je>>>0&255,$[29]=je>>>8&255,$[30]=je>>>16&255,$[31]=je>>>24&255}function U($,H,V,C){B($,H,V,C)}function K($,H,V,C){j($,H,V,C)}var J=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T($,H,V,C,Y,q,oe){var pe=new Uint8Array(16),xe=new Uint8Array(64),Re,De;for(De=0;De<16;De++)pe[De]=0;for(De=0;De<8;De++)pe[De]=q[De];for(;Y>=64;){for(U(xe,pe,oe,J),De=0;De<64;De++)$[H+De]=V[C+De]^xe[De];for(Re=1,De=8;De<16;De++)Re=Re+(pe[De]&255)|0,pe[De]=Re&255,Re>>>=8;Y-=64,H+=64,C+=64}if(Y>0)for(U(xe,pe,oe,J),De=0;De=64;){for(U(oe,q,Y,J),xe=0;xe<64;xe++)$[H+xe]=oe[xe];for(pe=1,xe=8;xe<16;xe++)pe=pe+(q[xe]&255)|0,q[xe]=pe&255,pe>>>=8;V-=64,H+=64}if(V>0)for(U(oe,q,Y,J),xe=0;xe>>13|V<<3)&8191,C=$[4]&255|($[5]&255)<<8,this.r[2]=(V>>>10|C<<6)&7939,Y=$[6]&255|($[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,q=$[8]&255|($[9]&255)<<8,this.r[4]=(Y>>>4|q<<12)&255,this.r[5]=q>>>1&8190,oe=$[10]&255|($[11]&255)<<8,this.r[6]=(q>>>14|oe<<2)&8191,pe=$[12]&255|($[13]&255)<<8,this.r[7]=(oe>>>11|pe<<5)&8065,xe=$[14]&255|($[15]&255)<<8,this.r[8]=(pe>>>8|xe<<8)&8191,this.r[9]=xe>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};G.prototype.blocks=function($,H,V){for(var C=this.fin?0:2048,Y,q,oe,pe,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Ae=this.h[3],Pe=this.h[4],Ge=this.h[5],je=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],de=this.r[3],nr=this.r[4],dr=this.r[5],pr=this.r[6],Qt=this.r[7],gr=this.r[8],lr=this.r[9];V>=16;)Y=$[H+0]&255|($[H+1]&255)<<8,wt+=Y&8191,q=$[H+2]&255|($[H+3]&255)<<8,lt+=(Y>>>13|q<<3)&8191,oe=$[H+4]&255|($[H+5]&255)<<8,at+=(q>>>10|oe<<6)&8191,pe=$[H+6]&255|($[H+7]&255)<<8,Ae+=(oe>>>7|pe<<9)&8191,xe=$[H+8]&255|($[H+9]&255)<<8,Pe+=(pe>>>4|xe<<12)&8191,Ge+=xe>>>1&8191,Re=$[H+10]&255|($[H+11]&255)<<8,je+=(xe>>>14|Re<<2)&8191,De=$[H+12]&255|($[H+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=$[H+14]&255|($[H+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,Ue=0,gt=Ue,gt+=wt*Wt,gt+=lt*(5*lr),gt+=at*(5*gr),gt+=Ae*(5*Qt),gt+=Pe*(5*pr),Ue=gt>>>13,gt&=8191,gt+=Ge*(5*dr),gt+=je*(5*nr),gt+=qe*(5*de),gt+=Xe*(5*Kt),gt+=kt*(5*Zt),Ue+=gt>>>13,gt&=8191,st=Ue,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Ae*(5*gr),st+=Pe*(5*Qt),Ue=st>>>13,st&=8191,st+=Ge*(5*pr),st+=je*(5*dr),st+=qe*(5*nr),st+=Xe*(5*de),st+=kt*(5*Kt),Ue+=st>>>13,st&=8191,tt=Ue,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Ae*(5*lr),tt+=Pe*(5*gr),Ue=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=je*(5*pr),tt+=qe*(5*dr),tt+=Xe*(5*nr),tt+=kt*(5*de),Ue+=tt>>>13,tt&=8191,At=Ue,At+=wt*de,At+=lt*Kt,At+=at*Zt,At+=Ae*Wt,At+=Pe*(5*lr),Ue=At>>>13,At&=8191,At+=Ge*(5*gr),At+=je*(5*Qt),At+=qe*(5*pr),At+=Xe*(5*dr),At+=kt*(5*nr),Ue+=At>>>13,At&=8191,Rt=Ue,Rt+=wt*nr,Rt+=lt*de,Rt+=at*Kt,Rt+=Ae*Zt,Rt+=Pe*Wt,Ue=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=je*(5*gr),Rt+=qe*(5*Qt),Rt+=Xe*(5*pr),Rt+=kt*(5*dr),Ue+=Rt>>>13,Rt&=8191,Mt=Ue,Mt+=wt*dr,Mt+=lt*nr,Mt+=at*de,Mt+=Ae*Kt,Mt+=Pe*Zt,Ue=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=je*(5*lr),Mt+=qe*(5*gr),Mt+=Xe*(5*Qt),Mt+=kt*(5*pr),Ue+=Mt>>>13,Mt&=8191,Et=Ue,Et+=wt*pr,Et+=lt*dr,Et+=at*nr,Et+=Ae*de,Et+=Pe*Kt,Ue=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=je*Wt,Et+=qe*(5*lr),Et+=Xe*(5*gr),Et+=kt*(5*Qt),Ue+=Et>>>13,Et&=8191,dt=Ue,dt+=wt*Qt,dt+=lt*pr,dt+=at*dr,dt+=Ae*nr,dt+=Pe*de,Ue=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=je*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*gr),Ue+=dt>>>13,dt&=8191,_t=Ue,_t+=wt*gr,_t+=lt*Qt,_t+=at*pr,_t+=Ae*dr,_t+=Pe*nr,Ue=_t>>>13,_t&=8191,_t+=Ge*de,_t+=je*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),Ue+=_t>>>13,_t&=8191,ot=Ue,ot+=wt*lr,ot+=lt*gr,ot+=at*Qt,ot+=Ae*pr,ot+=Pe*dr,Ue=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=je*de,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,Ue+=ot>>>13,ot&=8191,Ue=(Ue<<2)+Ue|0,Ue=Ue+gt|0,gt=Ue&8191,Ue=Ue>>>13,st+=Ue,wt=gt,lt=st,at=tt,Ae=At,Pe=Rt,Ge=Mt,je=Et,qe=dt,Xe=_t,kt=ot,H+=16,V-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Ae,this.h[4]=Pe,this.h[5]=Ge,this.h[6]=je,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},G.prototype.finish=function($,H){var V=new Uint16Array(10),C,Y,q,oe;if(this.leftover){for(oe=this.leftover,this.buffer[oe++]=1;oe<16;oe++)this.buffer[oe]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,oe=2;oe<10;oe++)this.h[oe]+=C,C=this.h[oe]>>>13,this.h[oe]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,V[0]=this.h[0]+5,C=V[0]>>>13,V[0]&=8191,oe=1;oe<10;oe++)V[oe]=this.h[oe]+C,C=V[oe]>>>13,V[oe]&=8191;for(V[9]-=8192,Y=(C^1)-1,oe=0;oe<10;oe++)V[oe]&=Y;for(Y=~Y,oe=0;oe<10;oe++)this.h[oe]=this.h[oe]&Y|V[oe];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,q=this.h[0]+this.pad[0],this.h[0]=q&65535,oe=1;oe<8;oe++)q=(this.h[oe]+this.pad[oe]|0)+(q>>>16)|0,this.h[oe]=q&65535;$[H+0]=this.h[0]>>>0&255,$[H+1]=this.h[0]>>>8&255,$[H+2]=this.h[1]>>>0&255,$[H+3]=this.h[1]>>>8&255,$[H+4]=this.h[2]>>>0&255,$[H+5]=this.h[2]>>>8&255,$[H+6]=this.h[3]>>>0&255,$[H+7]=this.h[3]>>>8&255,$[H+8]=this.h[4]>>>0&255,$[H+9]=this.h[4]>>>8&255,$[H+10]=this.h[5]>>>0&255,$[H+11]=this.h[5]>>>8&255,$[H+12]=this.h[6]>>>0&255,$[H+13]=this.h[6]>>>8&255,$[H+14]=this.h[7]>>>0&255,$[H+15]=this.h[7]>>>8&255},G.prototype.update=function($,H,V){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>V&&(Y=V),C=0;C=16&&(Y=V-V%16,this.blocks($,H,Y),H+=Y,V-=Y),V){for(C=0;C>16&1),q[V-1]&=65535;q[15]=oe[15]-32767-(q[14]>>16&1),Y=q[15]>>16&1,q[14]&=65535,_(oe,q,1-Y)}for(V=0;V<16;V++)$[2*V]=oe[V]&255,$[2*V+1]=oe[V]>>8}function b($,H){var V=new Uint8Array(32),C=new Uint8Array(32);return S(V,$),S(C,H),k(V,0,C,0)}function M($){var H=new Uint8Array(32);return S(H,$),H[0]&1}function I($,H){var V;for(V=0;V<16;V++)$[V]=H[2*V]+(H[2*V+1]<<8);$[15]&=32767}function F($,H,V){for(var C=0;C<16;C++)$[C]=H[C]+V[C]}function ae($,H,V){for(var C=0;C<16;C++)$[C]=H[C]-V[C]}function O($,H,V){var C,Y,q=0,oe=0,pe=0,xe=0,Re=0,De=0,it=0,Ue=0,gt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Ae=0,Pe=0,Ge=0,je=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,de=V[0],nr=V[1],dr=V[2],pr=V[3],Qt=V[4],gr=V[5],lr=V[6],Lr=V[7],mr=V[8],wr=V[9],Br=V[10],$r=V[11],Ir=V[12],hn=V[13],dn=V[14],pn=V[15];C=H[0],q+=C*de,oe+=C*nr,pe+=C*dr,xe+=C*pr,Re+=C*Qt,De+=C*gr,it+=C*lr,Ue+=C*Lr,gt+=C*mr,st+=C*wr,tt+=C*Br,At+=C*$r,Rt+=C*Ir,Mt+=C*hn,Et+=C*dn,dt+=C*pn,C=H[1],oe+=C*de,pe+=C*nr,xe+=C*dr,Re+=C*pr,De+=C*Qt,it+=C*gr,Ue+=C*lr,gt+=C*Lr,st+=C*mr,tt+=C*wr,At+=C*Br,Rt+=C*$r,Mt+=C*Ir,Et+=C*hn,dt+=C*dn,_t+=C*pn,C=H[2],pe+=C*de,xe+=C*nr,Re+=C*dr,De+=C*pr,it+=C*Qt,Ue+=C*gr,gt+=C*lr,st+=C*Lr,tt+=C*mr,At+=C*wr,Rt+=C*Br,Mt+=C*$r,Et+=C*Ir,dt+=C*hn,_t+=C*dn,ot+=C*pn,C=H[3],xe+=C*de,Re+=C*nr,De+=C*dr,it+=C*pr,Ue+=C*Qt,gt+=C*gr,st+=C*lr,tt+=C*Lr,At+=C*mr,Rt+=C*wr,Mt+=C*Br,Et+=C*$r,dt+=C*Ir,_t+=C*hn,ot+=C*dn,wt+=C*pn,C=H[4],Re+=C*de,De+=C*nr,it+=C*dr,Ue+=C*pr,gt+=C*Qt,st+=C*gr,tt+=C*lr,At+=C*Lr,Rt+=C*mr,Mt+=C*wr,Et+=C*Br,dt+=C*$r,_t+=C*Ir,ot+=C*hn,wt+=C*dn,lt+=C*pn,C=H[5],De+=C*de,it+=C*nr,Ue+=C*dr,gt+=C*pr,st+=C*Qt,tt+=C*gr,At+=C*lr,Rt+=C*Lr,Mt+=C*mr,Et+=C*wr,dt+=C*Br,_t+=C*$r,ot+=C*Ir,wt+=C*hn,lt+=C*dn,at+=C*pn,C=H[6],it+=C*de,Ue+=C*nr,gt+=C*dr,st+=C*pr,tt+=C*Qt,At+=C*gr,Rt+=C*lr,Mt+=C*Lr,Et+=C*mr,dt+=C*wr,_t+=C*Br,ot+=C*$r,wt+=C*Ir,lt+=C*hn,at+=C*dn,Ae+=C*pn,C=H[7],Ue+=C*de,gt+=C*nr,st+=C*dr,tt+=C*pr,At+=C*Qt,Rt+=C*gr,Mt+=C*lr,Et+=C*Lr,dt+=C*mr,_t+=C*wr,ot+=C*Br,wt+=C*$r,lt+=C*Ir,at+=C*hn,Ae+=C*dn,Pe+=C*pn,C=H[8],gt+=C*de,st+=C*nr,tt+=C*dr,At+=C*pr,Rt+=C*Qt,Mt+=C*gr,Et+=C*lr,dt+=C*Lr,_t+=C*mr,ot+=C*wr,wt+=C*Br,lt+=C*$r,at+=C*Ir,Ae+=C*hn,Pe+=C*dn,Ge+=C*pn,C=H[9],st+=C*de,tt+=C*nr,At+=C*dr,Rt+=C*pr,Mt+=C*Qt,Et+=C*gr,dt+=C*lr,_t+=C*Lr,ot+=C*mr,wt+=C*wr,lt+=C*Br,at+=C*$r,Ae+=C*Ir,Pe+=C*hn,Ge+=C*dn,je+=C*pn,C=H[10],tt+=C*de,At+=C*nr,Rt+=C*dr,Mt+=C*pr,Et+=C*Qt,dt+=C*gr,_t+=C*lr,ot+=C*Lr,wt+=C*mr,lt+=C*wr,at+=C*Br,Ae+=C*$r,Pe+=C*Ir,Ge+=C*hn,je+=C*dn,qe+=C*pn,C=H[11],At+=C*de,Rt+=C*nr,Mt+=C*dr,Et+=C*pr,dt+=C*Qt,_t+=C*gr,ot+=C*lr,wt+=C*Lr,lt+=C*mr,at+=C*wr,Ae+=C*Br,Pe+=C*$r,Ge+=C*Ir,je+=C*hn,qe+=C*dn,Xe+=C*pn,C=H[12],Rt+=C*de,Mt+=C*nr,Et+=C*dr,dt+=C*pr,_t+=C*Qt,ot+=C*gr,wt+=C*lr,lt+=C*Lr,at+=C*mr,Ae+=C*wr,Pe+=C*Br,Ge+=C*$r,je+=C*Ir,qe+=C*hn,Xe+=C*dn,kt+=C*pn,C=H[13],Mt+=C*de,Et+=C*nr,dt+=C*dr,_t+=C*pr,ot+=C*Qt,wt+=C*gr,lt+=C*lr,at+=C*Lr,Ae+=C*mr,Pe+=C*wr,Ge+=C*Br,je+=C*$r,qe+=C*Ir,Xe+=C*hn,kt+=C*dn,Wt+=C*pn,C=H[14],Et+=C*de,dt+=C*nr,_t+=C*dr,ot+=C*pr,wt+=C*Qt,lt+=C*gr,at+=C*lr,Ae+=C*Lr,Pe+=C*mr,Ge+=C*wr,je+=C*Br,qe+=C*$r,Xe+=C*Ir,kt+=C*hn,Wt+=C*dn,Zt+=C*pn,C=H[15],dt+=C*de,_t+=C*nr,ot+=C*dr,wt+=C*pr,lt+=C*Qt,at+=C*gr,Ae+=C*lr,Pe+=C*Lr,Ge+=C*mr,je+=C*wr,qe+=C*Br,Xe+=C*$r,kt+=C*Ir,Wt+=C*hn,Zt+=C*dn,Kt+=C*pn,q+=38*_t,oe+=38*ot,pe+=38*wt,xe+=38*lt,Re+=38*at,De+=38*Ae,it+=38*Pe,Ue+=38*Ge,gt+=38*je,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),$[0]=q,$[1]=oe,$[2]=pe,$[3]=xe,$[4]=Re,$[5]=De,$[6]=it,$[7]=Ue,$[8]=gt,$[9]=st,$[10]=tt,$[11]=At,$[12]=Rt,$[13]=Mt,$[14]=Et,$[15]=dt}function se($,H){O($,H,H)}function ee($,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=253;C>=0;C--)se(V,V),C!==2&&C!==4&&O(V,V,H);for(C=0;C<16;C++)$[C]=V[C]}function X($,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=250;C>=0;C--)se(V,V),C!==1&&O(V,V,H);for(C=0;C<16;C++)$[C]=V[C]}function Q($,H,V){var C=new Uint8Array(32),Y=new Float64Array(80),q,oe,pe=r(),xe=r(),Re=r(),De=r(),it=r(),Ue=r();for(oe=0;oe<31;oe++)C[oe]=H[oe];for(C[31]=H[31]&127|64,C[0]&=248,I(Y,V),oe=0;oe<16;oe++)xe[oe]=Y[oe],De[oe]=pe[oe]=Re[oe]=0;for(pe[0]=De[0]=1,oe=254;oe>=0;--oe)q=C[oe>>>3]>>>(oe&7)&1,_(pe,xe,q),_(Re,De,q),F(it,pe,Re),ae(pe,pe,Re),F(Re,xe,De),ae(xe,xe,De),se(De,it),se(Ue,pe),O(pe,Re,pe),O(Re,xe,it),F(it,pe,Re),ae(pe,pe,Re),se(xe,pe),ae(Re,De,Ue),O(pe,Re,u),F(pe,pe,De),O(Re,Re,pe),O(pe,De,Ue),O(De,xe,Y),se(xe,it),_(pe,xe,q),_(Re,De,q);for(oe=0;oe<16;oe++)Y[oe+16]=pe[oe],Y[oe+32]=Re[oe],Y[oe+48]=xe[oe],Y[oe+64]=De[oe];var gt=Y.subarray(32),st=Y.subarray(16);return ee(gt,gt),O(st,st,gt),S($,st),0}function R($,H){return Q($,H,s)}function Z($,H){return n(H,32),R($,H)}function te($,H,V){var C=new Uint8Array(32);return Q(C,V,H),K($,i,C,J)}var le=f,ie=p;function fe($,H,V,C,Y,q){var oe=new Uint8Array(32);return te(oe,Y,q),le($,H,V,C,oe)}function ve($,H,V,C,Y,q){var oe=new Uint8Array(32);return te(oe,Y,q),ie($,H,V,C,oe)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne($,H,V,C){for(var Y=new Int32Array(16),q=new Int32Array(16),oe,pe,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Ae,Pe,Ge,je,qe,Xe,kt=$[0],Wt=$[1],Zt=$[2],Kt=$[3],de=$[4],nr=$[5],dr=$[6],pr=$[7],Qt=H[0],gr=H[1],lr=H[2],Lr=H[3],mr=H[4],wr=H[5],Br=H[6],$r=H[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=V[at+0]<<24|V[at+1]<<16|V[at+2]<<8|V[at+3],q[lt]=V[at+4]<<24|V[at+5]<<16|V[at+6]<<8|V[at+7];for(lt=0;lt<80;lt++)if(oe=kt,pe=Wt,xe=Zt,Re=Kt,De=de,it=nr,Ue=dr,gt=pr,st=Qt,tt=gr,At=lr,Rt=Lr,Mt=mr,Et=wr,dt=Br,_t=$r,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(de>>>14|mr<<18)^(de>>>18|mr<<14)^(mr>>>9|de<<23),Pe=(mr>>>14|de<<18)^(mr>>>18|de<<14)^(de>>>9|mr<<23),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=de&nr^~de&dr,Pe=mr&wr^~mr&Br,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Me[lt*2],Pe=Me[lt*2+1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Y[lt%16],Pe=q[lt%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|je<<16,Ae=ot,Pe=wt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Pe=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=kt&Wt^kt&Zt^Wt&Zt,Pe=Qt&gr^Qt&lr^gr&lr,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,gt=qe&65535|Xe<<16,_t=Ge&65535|je<<16,Ae=Re,Pe=Rt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=ot,Pe=wt,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|je<<16,Wt=oe,Zt=pe,Kt=xe,de=Re,nr=De,dr=it,pr=Ue,kt=gt,gr=st,lr=tt,Lr=At,mr=Rt,wr=Mt,Br=Et,$r=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Ae=Y[at],Pe=q[at],Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=Y[(at+9)%16],Pe=q[(at+9)%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+1)%16],wt=q[(at+1)%16],Ae=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Pe=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+14)%16],wt=q[(at+14)%16],Ae=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Pe=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,q[at]=Ge&65535|je<<16;Ae=kt,Pe=Qt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[0],Pe=H[0],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[0]=kt=qe&65535|Xe<<16,H[0]=Qt=Ge&65535|je<<16,Ae=Wt,Pe=gr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[1],Pe=H[1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[1]=Wt=qe&65535|Xe<<16,H[1]=gr=Ge&65535|je<<16,Ae=Zt,Pe=lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[2],Pe=H[2],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[2]=Zt=qe&65535|Xe<<16,H[2]=lr=Ge&65535|je<<16,Ae=Kt,Pe=Lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[3],Pe=H[3],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[3]=Kt=qe&65535|Xe<<16,H[3]=Lr=Ge&65535|je<<16,Ae=de,Pe=mr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[4],Pe=H[4],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[4]=de=qe&65535|Xe<<16,H[4]=mr=Ge&65535|je<<16,Ae=nr,Pe=wr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[5],Pe=H[5],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[5]=nr=qe&65535|Xe<<16,H[5]=wr=Ge&65535|je<<16,Ae=dr,Pe=Br,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[6],Pe=H[6],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[6]=dr=qe&65535|Xe<<16,H[6]=Br=Ge&65535|je<<16,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[7],Pe=H[7],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[7]=pr=qe&65535|Xe<<16,H[7]=$r=Ge&65535|je<<16,Ir+=128,C-=128}return C}function Te($,H,V){var C=new Int32Array(8),Y=new Int32Array(8),q=new Uint8Array(256),oe,pe=V;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,H,V),V%=128,oe=0;oe=0;--Y)C=V[Y/8|0]>>(Y&7)&1,Ie($,H,C),$e(H,$),$e($,$),Ie($,H,C)}function ke($,H){var V=[r(),r(),r(),r()];v(V[0],g),v(V[1],y),v(V[2],a),O(V[3],g,y),Ve($,V,H)}function ze($,H,V){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],q;for(V||n(H,32),Te(C,H,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le($,Y),q=0;q<32;q++)H[q+32]=$[q];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Ee($,H){var V,C,Y,q;for(C=63;C>=32;--C){for(V=0,Y=C-32,q=C-12;Y>4)*He[Y],V=H[Y]>>8,H[Y]&=255;for(Y=0;Y<32;Y++)H[Y]-=V*He[Y];for(C=0;C<32;C++)H[C+1]+=H[C]>>8,$[C]=H[C]&255}function Qe($){var H=new Float64Array(64),V;for(V=0;V<64;V++)H[V]=$[V];for(V=0;V<64;V++)$[V]=0;Ee($,H)}function ct($,H,V,C){var Y=new Uint8Array(64),q=new Uint8Array(64),oe=new Uint8Array(64),pe,xe,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=V+64;for(pe=0;pe>7&&ae($[0],o,$[0]),O($[3],$[0],$[1]),0)}function et($,H,V,C){var Y,q=new Uint8Array(32),oe=new Uint8Array(64),pe=[r(),r(),r(),r()],xe=[r(),r(),r(),r()];if(V<64||Be(xe,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var $=new Uint8Array(vt),H=new Uint8Array(Dt);return ze($,H),{publicKey:$,secretKey:H}},e.sign.keyPair.fromSecretKey=function($){if(nt($),$.length!==Dt)throw new Error("bad secret key size");for(var H=new Uint8Array(vt),V=0;V=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function Ib(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function Y0(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{console.log("display_uri",ae),o(ae),u(!1),y("scan")}),m.on("error",ae=>{console.log(ae)}),m.on("session_update",ae=>{console.log("session_update",ae)}),!await m.connect(bZ))throw new Error("Walletconnect init failed");const S=new Wf(m);N(((f=S.config)==null?void 0:f.image)||((g=E.config)==null?void 0:g.image));const b=await S.getAddress(),M=await va.getNonce({account_type:"block_chain"});console.log("get nonce",M);const I=yZ(b,M);y("sign");const F=await S.signMessage(I,b);y("waiting"),await i(S,{message:I,nonce:M,signature:F,address:b,wallet_name:((v=S.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),B(S)}catch(_){console.log("err",_),d(_.details||_.message)}}function U(){A.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),A.current.append(e.current)}function K(E){var m;console.log(A.current),(m=A.current)==null||m.update({data:E})}Se.useEffect(()=>{s&&K(s)},[s]),Se.useEffect(()=>{j(r)},[r]),Se.useEffect(()=>{U()},[]);function J(){d(""),K(""),j(r)}function T(){k(!0),navigator.clipboard.writeText(s),setTimeout(()=>{k(!1)},2500)}function z(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return ge.jsxs("div",{children:[ge.jsx("div",{className:"xc-text-center",children:ge.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[ge.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),ge.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?ge.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):ge.jsx("img",{className:"xc-h-10 xc-w-10",src:P})})]})}),ge.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[ge.jsx("button",{disabled:!s,onClick:T,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:D?ge.jsxs(ge.Fragment,{children:[" ",ge.jsx(LK,{})," Copied!"]}):ge.jsxs(ge.Fragment,{children:[ge.jsx($K,{}),"Copy QR URL"]})}),((_e=r.config)==null?void 0:_e.getWallet)&&ge.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[ge.jsx(kK,{}),"Get Extension"]}),((G=r.config)==null?void 0:G.desktop_link)&&ge.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:z,children:[ge.jsx(f8,{}),"Desktop"]})]}),ge.jsx("div",{className:"xc-text-center",children:l?ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),ge.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:J,children:"Retry"})]}):ge.jsxs(ge.Fragment,{children:[p==="scan"&&ge.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),p==="connect"&&ge.jsx("p",{children:"Click connect in your wallet app"}),p==="sign"&&ge.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),p==="waiting"&&ge.jsx("div",{className:"xc-text-center",children:ge.jsx(vc,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const wZ="Accept connection request in the wallet",xZ="Accept sign-in request in your wallet";function _Z(t,e){const r=window.location.host,n=window.location.href;return A7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function I7(t){var p;const[e,r]=Se.useState(),{wallet:n,onSignFinish:i}=t,s=Se.useRef(),[o,a]=Se.useState("connect"),{saveLastUsedWallet:u}=Kl();async function l(y){var A;try{a("connect");const P=await n.connect();if(!P||P.length===0)throw new Error("Wallet connect error");const N=og(P[0]),D=_Z(N,y);a("sign");const k=await n.signMessage(D,N);if(!k||k.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:N,signature:k,message:D,nonce:y,wallet_name:((A=n.config)==null?void 0:A.name)||""}),u(n)}catch(P){console.log(P.details),r(P.details||P.message)}}async function d(){try{r("");const y=await va.getNonce({account_type:"block_chain"});s.current=y,l(s.current)}catch(y){console.log(y.details),r(y.message)}}return Se.useEffect(()=>{d()},[]),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[ge.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(p=n.config)==null?void 0:p.image,alt:""}),e&&ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),ge.jsx("div",{className:"xc-flex xc-gap-2",children:ge.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:d,children:"Retry"})})]}),!e&&ge.jsxs(ge.Fragment,{children:[o==="connect"&&ge.jsx("span",{className:"xc-text-center",children:wZ}),o==="sign"&&ge.jsx("span",{className:"xc-text-center",children:xZ}),o==="waiting"&&ge.jsx("span",{className:"xc-text-center",children:ge.jsx(vc,{className:"xc-animate-spin"})})]})]})}const Vu="https://static.codatta.io/codatta-connect/wallet-icons.svg",EZ="https://itunes.apple.com/app/",SZ="https://play.google.com/store/apps/details?id=",AZ="https://chromewebstore.google.com/detail/",PZ="https://chromewebstore.google.com/detail/",MZ="https://addons.mozilla.org/en-US/firefox/addon/",IZ="https://microsoftedge.microsoft.com/addons/detail/";function Gu(t){const{icon:e,title:r,link:n}=t;return ge.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[ge.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,ge.jsx(u8,{className:"xc-ml-auto xc-text-gray-400"})]})}function CZ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${EZ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${SZ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${AZ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${PZ}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${MZ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${IZ}${t.edge_addon_id}`),e}function C7(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=CZ(r);return ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),ge.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),ge.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),ge.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&ge.jsx(Gu,{link:n.chromeStoreLink,icon:`${Vu}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&ge.jsx(Gu,{link:n.appStoreLink,icon:`${Vu}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&ge.jsx(Gu,{link:n.playStoreLink,icon:`${Vu}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&ge.jsx(Gu,{link:n.edgeStoreLink,icon:`${Vu}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&ge.jsx(Gu,{link:n.braveStoreLink,icon:`${Vu}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&ge.jsx(Gu,{link:n.firefoxStoreLink,icon:`${Vu}#firefox`,title:"Mozilla Firefox"})]})]})}function TZ(t){const{wallet:e}=t,[r,n]=Se.useState(e.installed?"connect":"qr"),i=Mb();async function s(o,a){var l;const u=await va.walletLogin({account_type:"block_chain",account_enum:i.role,connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&ge.jsx(M7,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&ge.jsx(I7,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&ge.jsx(C7,{wallet:e})]})}function RZ(t){const{wallet:e,onClick:r}=t,n=ge.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return ge.jsx(Eb,{icon:n,title:i,onClick:()=>r(e)})}function T7(t){const{connector:e}=t,[r,n]=Se.useState(),[i,s]=Se.useState([]),o=Se.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d),console.log(d)}Se.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[ge.jsx(l8,{className:"xc-shrink-0 xc-opacity-50"}),ge.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),ge.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>ge.jsx(RZ,{wallet:d,onClick:l},d.name))})]})}var R7={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,$[H+1]=V>>16&255,$[H+2]=V>>8&255,$[H+3]=V&255,$[H+4]=C>>24&255,$[H+5]=C>>16&255,$[H+6]=C>>8&255,$[H+7]=C&255}function N($,H,V,C,Y){var q,oe=0;for(q=0;q>>8)-1}function D($,H,V,C){return N($,H,V,C,16)}function k($,H,V,C){return N($,H,V,C,32)}function B($,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,Ue=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=oe,wt=pe,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;dt=dt+Y|0,_t=_t+q|0,ot=ot+oe|0,wt=wt+pe|0,lt=lt+xe|0,at=at+Re|0,Ae=Ae+De|0,Pe=Pe+it|0,Ge=Ge+Ue|0,je=je+gt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=_t>>>0&255,$[5]=_t>>>8&255,$[6]=_t>>>16&255,$[7]=_t>>>24&255,$[8]=ot>>>0&255,$[9]=ot>>>8&255,$[10]=ot>>>16&255,$[11]=ot>>>24&255,$[12]=wt>>>0&255,$[13]=wt>>>8&255,$[14]=wt>>>16&255,$[15]=wt>>>24&255,$[16]=lt>>>0&255,$[17]=lt>>>8&255,$[18]=lt>>>16&255,$[19]=lt>>>24&255,$[20]=at>>>0&255,$[21]=at>>>8&255,$[22]=at>>>16&255,$[23]=at>>>24&255,$[24]=Ae>>>0&255,$[25]=Ae>>>8&255,$[26]=Ae>>>16&255,$[27]=Ae>>>24&255,$[28]=Pe>>>0&255,$[29]=Pe>>>8&255,$[30]=Pe>>>16&255,$[31]=Pe>>>24&255,$[32]=Ge>>>0&255,$[33]=Ge>>>8&255,$[34]=Ge>>>16&255,$[35]=Ge>>>24&255,$[36]=je>>>0&255,$[37]=je>>>8&255,$[38]=je>>>16&255,$[39]=je>>>24&255,$[40]=qe>>>0&255,$[41]=qe>>>8&255,$[42]=qe>>>16&255,$[43]=qe>>>24&255,$[44]=Xe>>>0&255,$[45]=Xe>>>8&255,$[46]=Xe>>>16&255,$[47]=Xe>>>24&255,$[48]=kt>>>0&255,$[49]=kt>>>8&255,$[50]=kt>>>16&255,$[51]=kt>>>24&255,$[52]=Wt>>>0&255,$[53]=Wt>>>8&255,$[54]=Wt>>>16&255,$[55]=Wt>>>24&255,$[56]=Zt>>>0&255,$[57]=Zt>>>8&255,$[58]=Zt>>>16&255,$[59]=Zt>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255}function j($,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,Ue=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=oe,wt=pe,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=at>>>0&255,$[5]=at>>>8&255,$[6]=at>>>16&255,$[7]=at>>>24&255,$[8]=qe>>>0&255,$[9]=qe>>>8&255,$[10]=qe>>>16&255,$[11]=qe>>>24&255,$[12]=Kt>>>0&255,$[13]=Kt>>>8&255,$[14]=Kt>>>16&255,$[15]=Kt>>>24&255,$[16]=Ae>>>0&255,$[17]=Ae>>>8&255,$[18]=Ae>>>16&255,$[19]=Ae>>>24&255,$[20]=Pe>>>0&255,$[21]=Pe>>>8&255,$[22]=Pe>>>16&255,$[23]=Pe>>>24&255,$[24]=Ge>>>0&255,$[25]=Ge>>>8&255,$[26]=Ge>>>16&255,$[27]=Ge>>>24&255,$[28]=je>>>0&255,$[29]=je>>>8&255,$[30]=je>>>16&255,$[31]=je>>>24&255}function U($,H,V,C){B($,H,V,C)}function K($,H,V,C){j($,H,V,C)}var J=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T($,H,V,C,Y,q,oe){var pe=new Uint8Array(16),xe=new Uint8Array(64),Re,De;for(De=0;De<16;De++)pe[De]=0;for(De=0;De<8;De++)pe[De]=q[De];for(;Y>=64;){for(U(xe,pe,oe,J),De=0;De<64;De++)$[H+De]=V[C+De]^xe[De];for(Re=1,De=8;De<16;De++)Re=Re+(pe[De]&255)|0,pe[De]=Re&255,Re>>>=8;Y-=64,H+=64,C+=64}if(Y>0)for(U(xe,pe,oe,J),De=0;De=64;){for(U(oe,q,Y,J),xe=0;xe<64;xe++)$[H+xe]=oe[xe];for(pe=1,xe=8;xe<16;xe++)pe=pe+(q[xe]&255)|0,q[xe]=pe&255,pe>>>=8;V-=64,H+=64}if(V>0)for(U(oe,q,Y,J),xe=0;xe>>13|V<<3)&8191,C=$[4]&255|($[5]&255)<<8,this.r[2]=(V>>>10|C<<6)&7939,Y=$[6]&255|($[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,q=$[8]&255|($[9]&255)<<8,this.r[4]=(Y>>>4|q<<12)&255,this.r[5]=q>>>1&8190,oe=$[10]&255|($[11]&255)<<8,this.r[6]=(q>>>14|oe<<2)&8191,pe=$[12]&255|($[13]&255)<<8,this.r[7]=(oe>>>11|pe<<5)&8065,xe=$[14]&255|($[15]&255)<<8,this.r[8]=(pe>>>8|xe<<8)&8191,this.r[9]=xe>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};G.prototype.blocks=function($,H,V){for(var C=this.fin?0:2048,Y,q,oe,pe,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Ae=this.h[3],Pe=this.h[4],Ge=this.h[5],je=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],de=this.r[3],nr=this.r[4],dr=this.r[5],pr=this.r[6],Qt=this.r[7],gr=this.r[8],lr=this.r[9];V>=16;)Y=$[H+0]&255|($[H+1]&255)<<8,wt+=Y&8191,q=$[H+2]&255|($[H+3]&255)<<8,lt+=(Y>>>13|q<<3)&8191,oe=$[H+4]&255|($[H+5]&255)<<8,at+=(q>>>10|oe<<6)&8191,pe=$[H+6]&255|($[H+7]&255)<<8,Ae+=(oe>>>7|pe<<9)&8191,xe=$[H+8]&255|($[H+9]&255)<<8,Pe+=(pe>>>4|xe<<12)&8191,Ge+=xe>>>1&8191,Re=$[H+10]&255|($[H+11]&255)<<8,je+=(xe>>>14|Re<<2)&8191,De=$[H+12]&255|($[H+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=$[H+14]&255|($[H+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,Ue=0,gt=Ue,gt+=wt*Wt,gt+=lt*(5*lr),gt+=at*(5*gr),gt+=Ae*(5*Qt),gt+=Pe*(5*pr),Ue=gt>>>13,gt&=8191,gt+=Ge*(5*dr),gt+=je*(5*nr),gt+=qe*(5*de),gt+=Xe*(5*Kt),gt+=kt*(5*Zt),Ue+=gt>>>13,gt&=8191,st=Ue,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Ae*(5*gr),st+=Pe*(5*Qt),Ue=st>>>13,st&=8191,st+=Ge*(5*pr),st+=je*(5*dr),st+=qe*(5*nr),st+=Xe*(5*de),st+=kt*(5*Kt),Ue+=st>>>13,st&=8191,tt=Ue,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Ae*(5*lr),tt+=Pe*(5*gr),Ue=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=je*(5*pr),tt+=qe*(5*dr),tt+=Xe*(5*nr),tt+=kt*(5*de),Ue+=tt>>>13,tt&=8191,At=Ue,At+=wt*de,At+=lt*Kt,At+=at*Zt,At+=Ae*Wt,At+=Pe*(5*lr),Ue=At>>>13,At&=8191,At+=Ge*(5*gr),At+=je*(5*Qt),At+=qe*(5*pr),At+=Xe*(5*dr),At+=kt*(5*nr),Ue+=At>>>13,At&=8191,Rt=Ue,Rt+=wt*nr,Rt+=lt*de,Rt+=at*Kt,Rt+=Ae*Zt,Rt+=Pe*Wt,Ue=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=je*(5*gr),Rt+=qe*(5*Qt),Rt+=Xe*(5*pr),Rt+=kt*(5*dr),Ue+=Rt>>>13,Rt&=8191,Mt=Ue,Mt+=wt*dr,Mt+=lt*nr,Mt+=at*de,Mt+=Ae*Kt,Mt+=Pe*Zt,Ue=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=je*(5*lr),Mt+=qe*(5*gr),Mt+=Xe*(5*Qt),Mt+=kt*(5*pr),Ue+=Mt>>>13,Mt&=8191,Et=Ue,Et+=wt*pr,Et+=lt*dr,Et+=at*nr,Et+=Ae*de,Et+=Pe*Kt,Ue=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=je*Wt,Et+=qe*(5*lr),Et+=Xe*(5*gr),Et+=kt*(5*Qt),Ue+=Et>>>13,Et&=8191,dt=Ue,dt+=wt*Qt,dt+=lt*pr,dt+=at*dr,dt+=Ae*nr,dt+=Pe*de,Ue=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=je*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*gr),Ue+=dt>>>13,dt&=8191,_t=Ue,_t+=wt*gr,_t+=lt*Qt,_t+=at*pr,_t+=Ae*dr,_t+=Pe*nr,Ue=_t>>>13,_t&=8191,_t+=Ge*de,_t+=je*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),Ue+=_t>>>13,_t&=8191,ot=Ue,ot+=wt*lr,ot+=lt*gr,ot+=at*Qt,ot+=Ae*pr,ot+=Pe*dr,Ue=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=je*de,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,Ue+=ot>>>13,ot&=8191,Ue=(Ue<<2)+Ue|0,Ue=Ue+gt|0,gt=Ue&8191,Ue=Ue>>>13,st+=Ue,wt=gt,lt=st,at=tt,Ae=At,Pe=Rt,Ge=Mt,je=Et,qe=dt,Xe=_t,kt=ot,H+=16,V-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Ae,this.h[4]=Pe,this.h[5]=Ge,this.h[6]=je,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},G.prototype.finish=function($,H){var V=new Uint16Array(10),C,Y,q,oe;if(this.leftover){for(oe=this.leftover,this.buffer[oe++]=1;oe<16;oe++)this.buffer[oe]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,oe=2;oe<10;oe++)this.h[oe]+=C,C=this.h[oe]>>>13,this.h[oe]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,V[0]=this.h[0]+5,C=V[0]>>>13,V[0]&=8191,oe=1;oe<10;oe++)V[oe]=this.h[oe]+C,C=V[oe]>>>13,V[oe]&=8191;for(V[9]-=8192,Y=(C^1)-1,oe=0;oe<10;oe++)V[oe]&=Y;for(Y=~Y,oe=0;oe<10;oe++)this.h[oe]=this.h[oe]&Y|V[oe];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,q=this.h[0]+this.pad[0],this.h[0]=q&65535,oe=1;oe<8;oe++)q=(this.h[oe]+this.pad[oe]|0)+(q>>>16)|0,this.h[oe]=q&65535;$[H+0]=this.h[0]>>>0&255,$[H+1]=this.h[0]>>>8&255,$[H+2]=this.h[1]>>>0&255,$[H+3]=this.h[1]>>>8&255,$[H+4]=this.h[2]>>>0&255,$[H+5]=this.h[2]>>>8&255,$[H+6]=this.h[3]>>>0&255,$[H+7]=this.h[3]>>>8&255,$[H+8]=this.h[4]>>>0&255,$[H+9]=this.h[4]>>>8&255,$[H+10]=this.h[5]>>>0&255,$[H+11]=this.h[5]>>>8&255,$[H+12]=this.h[6]>>>0&255,$[H+13]=this.h[6]>>>8&255,$[H+14]=this.h[7]>>>0&255,$[H+15]=this.h[7]>>>8&255},G.prototype.update=function($,H,V){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>V&&(Y=V),C=0;C=16&&(Y=V-V%16,this.blocks($,H,Y),H+=Y,V-=Y),V){for(C=0;C>16&1),q[V-1]&=65535;q[15]=oe[15]-32767-(q[14]>>16&1),Y=q[15]>>16&1,q[14]&=65535,_(oe,q,1-Y)}for(V=0;V<16;V++)$[2*V]=oe[V]&255,$[2*V+1]=oe[V]>>8}function b($,H){var V=new Uint8Array(32),C=new Uint8Array(32);return S(V,$),S(C,H),k(V,0,C,0)}function M($){var H=new Uint8Array(32);return S(H,$),H[0]&1}function I($,H){var V;for(V=0;V<16;V++)$[V]=H[2*V]+(H[2*V+1]<<8);$[15]&=32767}function F($,H,V){for(var C=0;C<16;C++)$[C]=H[C]+V[C]}function ae($,H,V){for(var C=0;C<16;C++)$[C]=H[C]-V[C]}function O($,H,V){var C,Y,q=0,oe=0,pe=0,xe=0,Re=0,De=0,it=0,Ue=0,gt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Ae=0,Pe=0,Ge=0,je=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,de=V[0],nr=V[1],dr=V[2],pr=V[3],Qt=V[4],gr=V[5],lr=V[6],Lr=V[7],mr=V[8],wr=V[9],Br=V[10],$r=V[11],Ir=V[12],hn=V[13],dn=V[14],pn=V[15];C=H[0],q+=C*de,oe+=C*nr,pe+=C*dr,xe+=C*pr,Re+=C*Qt,De+=C*gr,it+=C*lr,Ue+=C*Lr,gt+=C*mr,st+=C*wr,tt+=C*Br,At+=C*$r,Rt+=C*Ir,Mt+=C*hn,Et+=C*dn,dt+=C*pn,C=H[1],oe+=C*de,pe+=C*nr,xe+=C*dr,Re+=C*pr,De+=C*Qt,it+=C*gr,Ue+=C*lr,gt+=C*Lr,st+=C*mr,tt+=C*wr,At+=C*Br,Rt+=C*$r,Mt+=C*Ir,Et+=C*hn,dt+=C*dn,_t+=C*pn,C=H[2],pe+=C*de,xe+=C*nr,Re+=C*dr,De+=C*pr,it+=C*Qt,Ue+=C*gr,gt+=C*lr,st+=C*Lr,tt+=C*mr,At+=C*wr,Rt+=C*Br,Mt+=C*$r,Et+=C*Ir,dt+=C*hn,_t+=C*dn,ot+=C*pn,C=H[3],xe+=C*de,Re+=C*nr,De+=C*dr,it+=C*pr,Ue+=C*Qt,gt+=C*gr,st+=C*lr,tt+=C*Lr,At+=C*mr,Rt+=C*wr,Mt+=C*Br,Et+=C*$r,dt+=C*Ir,_t+=C*hn,ot+=C*dn,wt+=C*pn,C=H[4],Re+=C*de,De+=C*nr,it+=C*dr,Ue+=C*pr,gt+=C*Qt,st+=C*gr,tt+=C*lr,At+=C*Lr,Rt+=C*mr,Mt+=C*wr,Et+=C*Br,dt+=C*$r,_t+=C*Ir,ot+=C*hn,wt+=C*dn,lt+=C*pn,C=H[5],De+=C*de,it+=C*nr,Ue+=C*dr,gt+=C*pr,st+=C*Qt,tt+=C*gr,At+=C*lr,Rt+=C*Lr,Mt+=C*mr,Et+=C*wr,dt+=C*Br,_t+=C*$r,ot+=C*Ir,wt+=C*hn,lt+=C*dn,at+=C*pn,C=H[6],it+=C*de,Ue+=C*nr,gt+=C*dr,st+=C*pr,tt+=C*Qt,At+=C*gr,Rt+=C*lr,Mt+=C*Lr,Et+=C*mr,dt+=C*wr,_t+=C*Br,ot+=C*$r,wt+=C*Ir,lt+=C*hn,at+=C*dn,Ae+=C*pn,C=H[7],Ue+=C*de,gt+=C*nr,st+=C*dr,tt+=C*pr,At+=C*Qt,Rt+=C*gr,Mt+=C*lr,Et+=C*Lr,dt+=C*mr,_t+=C*wr,ot+=C*Br,wt+=C*$r,lt+=C*Ir,at+=C*hn,Ae+=C*dn,Pe+=C*pn,C=H[8],gt+=C*de,st+=C*nr,tt+=C*dr,At+=C*pr,Rt+=C*Qt,Mt+=C*gr,Et+=C*lr,dt+=C*Lr,_t+=C*mr,ot+=C*wr,wt+=C*Br,lt+=C*$r,at+=C*Ir,Ae+=C*hn,Pe+=C*dn,Ge+=C*pn,C=H[9],st+=C*de,tt+=C*nr,At+=C*dr,Rt+=C*pr,Mt+=C*Qt,Et+=C*gr,dt+=C*lr,_t+=C*Lr,ot+=C*mr,wt+=C*wr,lt+=C*Br,at+=C*$r,Ae+=C*Ir,Pe+=C*hn,Ge+=C*dn,je+=C*pn,C=H[10],tt+=C*de,At+=C*nr,Rt+=C*dr,Mt+=C*pr,Et+=C*Qt,dt+=C*gr,_t+=C*lr,ot+=C*Lr,wt+=C*mr,lt+=C*wr,at+=C*Br,Ae+=C*$r,Pe+=C*Ir,Ge+=C*hn,je+=C*dn,qe+=C*pn,C=H[11],At+=C*de,Rt+=C*nr,Mt+=C*dr,Et+=C*pr,dt+=C*Qt,_t+=C*gr,ot+=C*lr,wt+=C*Lr,lt+=C*mr,at+=C*wr,Ae+=C*Br,Pe+=C*$r,Ge+=C*Ir,je+=C*hn,qe+=C*dn,Xe+=C*pn,C=H[12],Rt+=C*de,Mt+=C*nr,Et+=C*dr,dt+=C*pr,_t+=C*Qt,ot+=C*gr,wt+=C*lr,lt+=C*Lr,at+=C*mr,Ae+=C*wr,Pe+=C*Br,Ge+=C*$r,je+=C*Ir,qe+=C*hn,Xe+=C*dn,kt+=C*pn,C=H[13],Mt+=C*de,Et+=C*nr,dt+=C*dr,_t+=C*pr,ot+=C*Qt,wt+=C*gr,lt+=C*lr,at+=C*Lr,Ae+=C*mr,Pe+=C*wr,Ge+=C*Br,je+=C*$r,qe+=C*Ir,Xe+=C*hn,kt+=C*dn,Wt+=C*pn,C=H[14],Et+=C*de,dt+=C*nr,_t+=C*dr,ot+=C*pr,wt+=C*Qt,lt+=C*gr,at+=C*lr,Ae+=C*Lr,Pe+=C*mr,Ge+=C*wr,je+=C*Br,qe+=C*$r,Xe+=C*Ir,kt+=C*hn,Wt+=C*dn,Zt+=C*pn,C=H[15],dt+=C*de,_t+=C*nr,ot+=C*dr,wt+=C*pr,lt+=C*Qt,at+=C*gr,Ae+=C*lr,Pe+=C*Lr,Ge+=C*mr,je+=C*wr,qe+=C*Br,Xe+=C*$r,kt+=C*Ir,Wt+=C*hn,Zt+=C*dn,Kt+=C*pn,q+=38*_t,oe+=38*ot,pe+=38*wt,xe+=38*lt,Re+=38*at,De+=38*Ae,it+=38*Pe,Ue+=38*Ge,gt+=38*je,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),$[0]=q,$[1]=oe,$[2]=pe,$[3]=xe,$[4]=Re,$[5]=De,$[6]=it,$[7]=Ue,$[8]=gt,$[9]=st,$[10]=tt,$[11]=At,$[12]=Rt,$[13]=Mt,$[14]=Et,$[15]=dt}function se($,H){O($,H,H)}function ee($,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=253;C>=0;C--)se(V,V),C!==2&&C!==4&&O(V,V,H);for(C=0;C<16;C++)$[C]=V[C]}function X($,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=250;C>=0;C--)se(V,V),C!==1&&O(V,V,H);for(C=0;C<16;C++)$[C]=V[C]}function Q($,H,V){var C=new Uint8Array(32),Y=new Float64Array(80),q,oe,pe=r(),xe=r(),Re=r(),De=r(),it=r(),Ue=r();for(oe=0;oe<31;oe++)C[oe]=H[oe];for(C[31]=H[31]&127|64,C[0]&=248,I(Y,V),oe=0;oe<16;oe++)xe[oe]=Y[oe],De[oe]=pe[oe]=Re[oe]=0;for(pe[0]=De[0]=1,oe=254;oe>=0;--oe)q=C[oe>>>3]>>>(oe&7)&1,_(pe,xe,q),_(Re,De,q),F(it,pe,Re),ae(pe,pe,Re),F(Re,xe,De),ae(xe,xe,De),se(De,it),se(Ue,pe),O(pe,Re,pe),O(Re,xe,it),F(it,pe,Re),ae(pe,pe,Re),se(xe,pe),ae(Re,De,Ue),O(pe,Re,u),F(pe,pe,De),O(Re,Re,pe),O(pe,De,Ue),O(De,xe,Y),se(xe,it),_(pe,xe,q),_(Re,De,q);for(oe=0;oe<16;oe++)Y[oe+16]=pe[oe],Y[oe+32]=Re[oe],Y[oe+48]=xe[oe],Y[oe+64]=De[oe];var gt=Y.subarray(32),st=Y.subarray(16);return ee(gt,gt),O(st,st,gt),S($,st),0}function R($,H){return Q($,H,s)}function Z($,H){return n(H,32),R($,H)}function te($,H,V){var C=new Uint8Array(32);return Q(C,V,H),K($,i,C,J)}var le=f,ie=g;function fe($,H,V,C,Y,q){var oe=new Uint8Array(32);return te(oe,Y,q),le($,H,V,C,oe)}function ve($,H,V,C,Y,q){var oe=new Uint8Array(32);return te(oe,Y,q),ie($,H,V,C,oe)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne($,H,V,C){for(var Y=new Int32Array(16),q=new Int32Array(16),oe,pe,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Ae,Pe,Ge,je,qe,Xe,kt=$[0],Wt=$[1],Zt=$[2],Kt=$[3],de=$[4],nr=$[5],dr=$[6],pr=$[7],Qt=H[0],gr=H[1],lr=H[2],Lr=H[3],mr=H[4],wr=H[5],Br=H[6],$r=H[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=V[at+0]<<24|V[at+1]<<16|V[at+2]<<8|V[at+3],q[lt]=V[at+4]<<24|V[at+5]<<16|V[at+6]<<8|V[at+7];for(lt=0;lt<80;lt++)if(oe=kt,pe=Wt,xe=Zt,Re=Kt,De=de,it=nr,Ue=dr,gt=pr,st=Qt,tt=gr,At=lr,Rt=Lr,Mt=mr,Et=wr,dt=Br,_t=$r,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(de>>>14|mr<<18)^(de>>>18|mr<<14)^(mr>>>9|de<<23),Pe=(mr>>>14|de<<18)^(mr>>>18|de<<14)^(de>>>9|mr<<23),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=de&nr^~de&dr,Pe=mr&wr^~mr&Br,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Me[lt*2],Pe=Me[lt*2+1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Y[lt%16],Pe=q[lt%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|je<<16,Ae=ot,Pe=wt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Pe=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=kt&Wt^kt&Zt^Wt&Zt,Pe=Qt&gr^Qt&lr^gr&lr,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,gt=qe&65535|Xe<<16,_t=Ge&65535|je<<16,Ae=Re,Pe=Rt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=ot,Pe=wt,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|je<<16,Wt=oe,Zt=pe,Kt=xe,de=Re,nr=De,dr=it,pr=Ue,kt=gt,gr=st,lr=tt,Lr=At,mr=Rt,wr=Mt,Br=Et,$r=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Ae=Y[at],Pe=q[at],Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=Y[(at+9)%16],Pe=q[(at+9)%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+1)%16],wt=q[(at+1)%16],Ae=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Pe=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+14)%16],wt=q[(at+14)%16],Ae=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Pe=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,q[at]=Ge&65535|je<<16;Ae=kt,Pe=Qt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[0],Pe=H[0],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[0]=kt=qe&65535|Xe<<16,H[0]=Qt=Ge&65535|je<<16,Ae=Wt,Pe=gr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[1],Pe=H[1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[1]=Wt=qe&65535|Xe<<16,H[1]=gr=Ge&65535|je<<16,Ae=Zt,Pe=lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[2],Pe=H[2],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[2]=Zt=qe&65535|Xe<<16,H[2]=lr=Ge&65535|je<<16,Ae=Kt,Pe=Lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[3],Pe=H[3],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[3]=Kt=qe&65535|Xe<<16,H[3]=Lr=Ge&65535|je<<16,Ae=de,Pe=mr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[4],Pe=H[4],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[4]=de=qe&65535|Xe<<16,H[4]=mr=Ge&65535|je<<16,Ae=nr,Pe=wr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[5],Pe=H[5],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[5]=nr=qe&65535|Xe<<16,H[5]=wr=Ge&65535|je<<16,Ae=dr,Pe=Br,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[6],Pe=H[6],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[6]=dr=qe&65535|Xe<<16,H[6]=Br=Ge&65535|je<<16,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[7],Pe=H[7],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[7]=pr=qe&65535|Xe<<16,H[7]=$r=Ge&65535|je<<16,Ir+=128,C-=128}return C}function Te($,H,V){var C=new Int32Array(8),Y=new Int32Array(8),q=new Uint8Array(256),oe,pe=V;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,H,V),V%=128,oe=0;oe=0;--Y)C=V[Y/8|0]>>(Y&7)&1,Ie($,H,C),$e(H,$),$e($,$),Ie($,H,C)}function ke($,H){var V=[r(),r(),r(),r()];v(V[0],p),v(V[1],y),v(V[2],a),O(V[3],p,y),Ve($,V,H)}function ze($,H,V){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],q;for(V||n(H,32),Te(C,H,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le($,Y),q=0;q<32;q++)H[q+32]=$[q];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Ee($,H){var V,C,Y,q;for(C=63;C>=32;--C){for(V=0,Y=C-32,q=C-12;Y>4)*He[Y],V=H[Y]>>8,H[Y]&=255;for(Y=0;Y<32;Y++)H[Y]-=V*He[Y];for(C=0;C<32;C++)H[C+1]+=H[C]>>8,$[C]=H[C]&255}function Qe($){var H=new Float64Array(64),V;for(V=0;V<64;V++)H[V]=$[V];for(V=0;V<64;V++)$[V]=0;Ee($,H)}function ct($,H,V,C){var Y=new Uint8Array(64),q=new Uint8Array(64),oe=new Uint8Array(64),pe,xe,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=V+64;for(pe=0;pe>7&&ae($[0],o,$[0]),O($[3],$[0],$[1]),0)}function et($,H,V,C){var Y,q=new Uint8Array(32),oe=new Uint8Array(64),pe=[r(),r(),r(),r()],xe=[r(),r(),r(),r()];if(V<64||Be(xe,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var $=new Uint8Array(vt),H=new Uint8Array(Dt);return ze($,H),{publicKey:$,secretKey:H}},e.sign.keyPair.fromSecretKey=function($){if(nt($),$.length!==Dt)throw new Error("bad secret key size");for(var H=new Uint8Array(vt),V=0;V=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function Ib(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function Y0(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new Ut("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new Ut("Delay aborted"))})})})}function As(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function fh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=As(e==null?void 0:e.signal);if(typeof t!="function")throw new Ut(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=g??null,o==null||o.abort(),o=As(g),o.signal.aborted)throw new Ut("Resource creation was aborted");n=y??null;const A=t(o.signal,...y);i=A;const P=yield A;if(i!==A&&P!==r)throw yield e(P),new Ut("Resource creation was aborted by a new resource creation");return r=P,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const g=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([g?e(g):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:g=>Pt(this,void 0,void 0,function*(){const y=r,A=i,P=n,N=s;if(yield U7(g),y===r&&A===i&&P===n&&N===s)return yield a(s,...P??[]);throw new Ut("Resource recreation was aborted by a new resource creation")})}}function ZZ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=As(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new Ut("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new Ut(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new Ut("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class Nb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=XZ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield QZ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new KZ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(j7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=B7.encode(e);yield fh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new Ut(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Fo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Fo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new Ut(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new Ut("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),Sn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Ut("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new Ut(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function QZ(t){return Pt(this,void 0,void 0,function*(){return yield ZZ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=As(n.signal).signal;if(o.aborted){r(new Ut("Bridge connection aborted"));return}const a=new URL(j7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new Ut("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}try{const g=yield t.errorHandler(l,d);g!==l&&l.close(),g&&g!==l&&e(g)}catch(g){l.close(),r(g)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new Ut("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function lh(t){return!("connectEvent"in t)}class hh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!lh(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Cb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Cb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");if(!lh(e))throw new Ut("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new Ut("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!lh(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const q7=2;class dh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new hh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getHttpConnection();return lh(n)?new dh(e,n.connectionSource):new dh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=As(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Cb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield fh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(lh(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new Ut("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Nb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield fh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Ut("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),Y0(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=As(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){Sn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(B7.decode(e.message).toUint8Array(),Y0(e.from)));if(Sn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){Sn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Fo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(Sn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new Ut(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return GZ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",q7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+YZ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new Nb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>fh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Nb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function z7(t,e){return H7(t,[e])}function H7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function eQ(t){try{return!z7(t,"tonconnect")||!z7(t.tonconnect,"walletInfo")?!1:H7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Ju{constructor(){this.storage={}}static getInstance(){return Ju.instance||(Ju.instance=new Ju),Ju.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function np(){if(!(typeof window>"u"))return window}function tQ(){const t=np();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function rQ(){if(!(typeof document>"u"))return document}function nQ(){var t;const e=(t=np())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function iQ(){if(sQ())return localStorage;if(oQ())throw new Ut("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Ju.getInstance()}function sQ(){try{return typeof localStorage<"u"}catch{return!1}}function oQ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class xi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=xi.window;if(!xi.isWindowContainsWallet(n,r))throw new Db;this.connectionStorage=new hh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getInjectedConnection();return new xi(e,n.jsBridgeKey)})}static isWalletInjected(e){return xi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return xi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?tQ().filter(([n,i])=>eQ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(q7,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{Sn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();Sn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){Sn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>Sn("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{Sn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);Sn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){Sn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{Sn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}xi.window=np();class aQ{constructor(){this.localStorage=iQ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function W7(t){return uQ(t)&&t.injected}function cQ(t){return W7(t)&&t.embedded}function uQ(t){return"jsBridgeKey"in t}const fQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class Lb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(cQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new Ob("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Fo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Fo(n),e=fQ}let r=[];try{r=xi.getCurrentlyInjectedWallets()}catch(n){Fo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=xi.isWalletInjected(o),i.embedded=xi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class ip extends Ut{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,ip.prototype)}}function lQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new ip("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function wQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Zu(t,e)),kb(e,r))}function xQ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Zu(t,e)),kb(e,r))}function _Q(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Zu(t,e)),kb(e,r))}function EQ(t,e,r){return Object.assign({type:"disconnection",scope:r},Zu(t,e))}class SQ{constructor(){this.window=np()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class AQ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new SQ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Xu({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",dQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",hQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=pQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=gQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=mQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=vQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=bQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=yQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=EQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=wQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=xQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=_Q(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const PQ="3.0.5";class ph{constructor(e){if(this.walletsList=new Lb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||nQ(),storage:(e==null?void 0:e.storage)||new aQ},this.walletsList=new Lb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new AQ({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:PQ}),!this.dappSettings.manifestUrl)throw new Tb("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new hh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Rb;const o=As(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new Ut("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield dh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield xi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Fo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=fh(g=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:g.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(g=>setTimeout(()=>g(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=As(n==null?void 0:n.signal);if(i.signal.aborted)throw new Ut("Transaction sending was aborted");this.checkConnection(),lQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=jZ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(rp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(rp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),rp.parseAndThrowError(l);const d=rp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new Z0;const n=As(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Ut("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=rQ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Fo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&UZ(e)?r=new xi(this.dappSettings.storage,e.jsBridgeKey):r=new dh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new Ut("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=zZ.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),Sn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof X0||r instanceof J0)throw Fo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new Z0}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}ph.walletsList=new Lb,ph.isWalletInjected=t=>xi.isWalletInjected(t),ph.isInsideWalletBrowser=t=>xi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function Bb(t){const{children:e,onClick:r}=t;return ge.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function K7(t){const{wallet:e,connector:r,loading:n}=t,i=Se.useRef(null),s=Se.useRef(),[o,a]=Se.useState(),[u,l]=Se.useState(),[d,g]=Se.useState("connect"),[y,A]=Se.useState(!1),[P,N]=Se.useState();function D(z){var ue;(ue=s.current)==null||ue.update({data:z})}async function k(){A(!0);try{a("");const z=await va.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ue=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:z}});if(!ue)return;N(ue),D(ue),l(z)}}catch(z){a(z.message)}A(!1)}function B(){s.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function j(){r.connect(e,{request:{tonProof:u}})}function U(){if("deepLink"in e){if(!e.deepLink||!P)return;const z=new URL(P),ue=`${e.deepLink}${z.search}`;window.open(ue)}}function K(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(P)}const J=Se.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),T=Se.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Se.useEffect(()=>{B(),k()},[]),ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-text-center xc-mb-6",children:[ge.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[ge.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),ge.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?ge.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):ge.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),ge.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),ge.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&ge.jsx(vc,{className:"xc-animate-spin"}),!y&&!n&&ge.jsxs(ge.Fragment,{children:[W7(e)&&ge.jsxs(Bb,{onClick:j,children:[ge.jsx(BK,{className:"xc-opacity-80"}),"Extension"]}),J&&ge.jsxs(Bb,{onClick:U,children:[ge.jsx(f8,{className:"xc-opacity-80"}),"Desktop"]}),T&&ge.jsx(Bb,{onClick:K,children:"Telegram Mini App"})]})]})]})}function MQ(t){const[e,r]=Se.useState(""),[n,i]=Se.useState(),[s,o]=Se.useState(),a=Mb(),[u,l]=Se.useState(!1);async function d(y){var P,N;if(!y||!((P=y.connectItems)!=null&&P.tonProof))return;l(!0);const A=await va.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(N=y.connectItems)==null?void 0:N.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(A.data),l(!1)}Se.useEffect(()=>{const y=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),A=y.onStatusChange(d);return o(y),r("select"),A},[]);function g(y){r("connect"),i(y)}return ge.jsxs(Ss,{children:[e==="select"&&ge.jsx(T7,{connector:s,onSelect:g,onBack:t.onBack}),e==="connect"&&ge.jsx(K7,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function V7(t){const{children:e,className:r}=t,n=Se.useRef(null),[i,s]=Se.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Se.useEffect(()=>{console.log("maxHeight",i)},[i]),ge.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function IQ(){return ge.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ge.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),ge.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function G7(t){const{wallets:e}=Kl(),[r,n]=Se.useState(),i=Se.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[ge.jsx(l8,{className:"xc-shrink-0 xc-opacity-50"}),ge.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),ge.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>ge.jsx(e7,{wallet:a,onClick:s},`feature-${a.key}`)):ge.jsx(IQ,{})})]})}function CQ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Se.useState(""),[l,d]=Se.useState(null),[g,y]=Se.useState("");function A(k){d(k),u("evm-wallet")}function P(k){u("email"),y(k)}async function N(k){await e(k)}function D(){u("ton-wallet")}return Se.useEffect(()=>{u("index")},[]),ge.jsx(GX,{config:t.config,children:ge.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&ge.jsx(TZ,{onBack:()=>u("index"),onLogin:N,wallet:l}),a==="ton-wallet"&&ge.jsx(MQ,{onBack:()=>u("index"),onLogin:N}),a==="email"&&ge.jsx(uZ,{email:g,onBack:()=>u("index"),onLogin:N}),a==="index"&&ge.jsx(f7,{header:r,onEmailConfirm:P,onSelectWallet:A,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&ge.jsx(G7,{onBack:()=>u("index"),onSelectWallet:A})]})})}function TQ(t){const{wallet:e,onConnect:r}=t,[n,i]=Se.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&ge.jsx(M7,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&ge.jsx(I7,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&ge.jsx(C7,{wallet:e})]})}function RQ(t){const{email:e}=t,[r,n]=Se.useState("captcha");return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),r==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>n("verify-email")}),r==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:t.onInputCode,onResendCode:()=>n("captcha")})]})}function DQ(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Se.useState(""),[a,u]=Se.useState(),[l,d]=Se.useState(),g=Se.useRef(),[y,A]=Se.useState("");function P(j){u(j),o("evm-wallet-connect")}function N(j){A(j),o("email-connect")}async function D(j,U){await e({chain_type:"eip155",client:j.client,connect_info:U}),o("index")}function k(j){d(j),o("ton-wallet-connect")}async function B(j){j&&await r({chain_type:"ton",client:g.current,connect_info:j})}return Se.useEffect(()=>{g.current=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const j=g.current.onStatusChange(B);return o("index"),j},[]),ge.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&ge.jsx(G7,{onBack:()=>o("index"),onSelectWallet:P}),s==="evm-wallet-connect"&&ge.jsx(TQ,{onBack:()=>o("index"),onConnect:D,wallet:a}),s==="ton-wallet-select"&&ge.jsx(T7,{connector:g.current,onSelect:k,onBack:()=>o("index")}),s==="ton-wallet-connect"&&ge.jsx(K7,{connector:g.current,wallet:l,onBack:()=>o("index")}),s==="email-connect"&&ge.jsx(RQ,{email:y,onBack:()=>o("index"),onInputCode:n}),s==="index"&&ge.jsx(f7,{onEmailConfirm:N,onSelectWallet:P,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Fn.CodattaConnect=DQ,Fn.CodattaConnectContextProvider=CK,Fn.CodattaSignin=CQ,Fn.coinbaseWallet=o8,Fn.useCodattaConnectContext=Kl,Object.defineProperty(Fn,Symbol.toStringTag,{value:"Module"})}); + ***************************************************************************** */function jZ(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new Ut("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new Ut("Delay aborted"))})})})}function As(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function fh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=As(e==null?void 0:e.signal);if(typeof t!="function")throw new Ut(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=p??null,o==null||o.abort(),o=As(p),o.signal.aborted)throw new Ut("Resource creation was aborted");n=y??null;const A=t(o.signal,...y);i=A;const P=yield A;if(i!==A&&P!==r)throw yield e(P),new Ut("Resource creation was aborted by a new resource creation");return r=P,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const p=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([p?e(p):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:p=>Pt(this,void 0,void 0,function*(){const y=r,A=i,P=n,N=s;if(yield U7(p),y===r&&A===i&&P===n&&N===s)return yield a(s,...P??[]);throw new Ut("Resource recreation was aborted by a new resource creation")})}}function ZZ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=As(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new Ut("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new Ut(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new Ut("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class Nb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=XZ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield QZ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new KZ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(j7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=B7.encode(e);yield fh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new Ut(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Fo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Fo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new Ut(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new Ut("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),Sn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Ut("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new Ut(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function QZ(t){return Pt(this,void 0,void 0,function*(){return yield ZZ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=As(n.signal).signal;if(o.aborted){r(new Ut("Bridge connection aborted"));return}const a=new URL(j7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new Ut("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}try{const p=yield t.errorHandler(l,d);p!==l&&l.close(),p&&p!==l&&e(p)}catch(p){l.close(),r(p)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new Ut("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function lh(t){return!("connectEvent"in t)}class hh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!lh(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Cb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Cb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");if(!lh(e))throw new Ut("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new Ut("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!lh(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const q7=2;class dh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new hh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getHttpConnection();return lh(n)?new dh(e,n.connectionSource):new dh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=As(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Cb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield fh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(lh(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new Ut("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Nb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield fh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Ut("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),Y0(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=As(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){Sn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(B7.decode(e.message).toUint8Array(),Y0(e.from)));if(Sn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){Sn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Fo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(Sn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new Ut(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return GZ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",q7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+YZ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new Nb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>fh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Nb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function z7(t,e){return H7(t,[e])}function H7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function eQ(t){try{return!z7(t,"tonconnect")||!z7(t.tonconnect,"walletInfo")?!1:H7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Ju{constructor(){this.storage={}}static getInstance(){return Ju.instance||(Ju.instance=new Ju),Ju.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function np(){if(!(typeof window>"u"))return window}function tQ(){const t=np();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function rQ(){if(!(typeof document>"u"))return document}function nQ(){var t;const e=(t=np())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function iQ(){if(sQ())return localStorage;if(oQ())throw new Ut("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Ju.getInstance()}function sQ(){try{return typeof localStorage<"u"}catch{return!1}}function oQ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class xi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=xi.window;if(!xi.isWindowContainsWallet(n,r))throw new Db;this.connectionStorage=new hh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getInjectedConnection();return new xi(e,n.jsBridgeKey)})}static isWalletInjected(e){return xi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return xi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?tQ().filter(([n,i])=>eQ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(q7,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{Sn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();Sn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){Sn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>Sn("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{Sn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);Sn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){Sn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{Sn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}xi.window=np();class aQ{constructor(){this.localStorage=iQ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function W7(t){return uQ(t)&&t.injected}function cQ(t){return W7(t)&&t.embedded}function uQ(t){return"jsBridgeKey"in t}const fQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class Lb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(cQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new Ob("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Fo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Fo(n),e=fQ}let r=[];try{r=xi.getCurrentlyInjectedWallets()}catch(n){Fo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=xi.isWalletInjected(o),i.embedded=xi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class ip extends Ut{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,ip.prototype)}}function lQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new ip("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function wQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Zu(t,e)),kb(e,r))}function xQ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Zu(t,e)),kb(e,r))}function _Q(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Zu(t,e)),kb(e,r))}function EQ(t,e,r){return Object.assign({type:"disconnection",scope:r},Zu(t,e))}class SQ{constructor(){this.window=np()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class AQ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new SQ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Xu({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",dQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",hQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=pQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=gQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=mQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=vQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=bQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=yQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=EQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=wQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=xQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=_Q(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const PQ="3.0.5";class ph{constructor(e){if(this.walletsList=new Lb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||nQ(),storage:(e==null?void 0:e.storage)||new aQ},this.walletsList=new Lb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new AQ({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:PQ}),!this.dappSettings.manifestUrl)throw new Tb("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new hh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Rb;const o=As(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new Ut("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield dh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield xi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Fo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=fh(p=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:p.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(p=>setTimeout(()=>p(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=As(n==null?void 0:n.signal);if(i.signal.aborted)throw new Ut("Transaction sending was aborted");this.checkConnection(),lQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=jZ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(rp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(rp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),rp.parseAndThrowError(l);const d=rp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new Z0;const n=As(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Ut("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=rQ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Fo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&UZ(e)?r=new xi(this.dappSettings.storage,e.jsBridgeKey):r=new dh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new Ut("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=zZ.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),Sn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof X0||r instanceof J0)throw Fo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new Z0}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}ph.walletsList=new Lb,ph.isWalletInjected=t=>xi.isWalletInjected(t),ph.isInsideWalletBrowser=t=>xi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function Bb(t){const{children:e,onClick:r}=t;return ge.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function K7(t){const{wallet:e,connector:r,loading:n}=t,i=Se.useRef(null),s=Se.useRef(),[o,a]=Se.useState(),[u,l]=Se.useState(),[d,p]=Se.useState("connect"),[y,A]=Se.useState(!1),[P,N]=Se.useState();function D(z){var ue;(ue=s.current)==null||ue.update({data:z})}async function k(){A(!0);try{a("");const z=await va.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ue=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:z}});if(!ue)return;N(ue),D(ue),l(z)}}catch(z){a(z.message)}A(!1)}function B(){s.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function j(){r.connect(e,{request:{tonProof:u}})}function U(){if("deepLink"in e){if(!e.deepLink||!P)return;const z=new URL(P),ue=`${e.deepLink}${z.search}`;window.open(ue)}}function K(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(P)}const J=Se.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),T=Se.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Se.useEffect(()=>{B(),k()},[]),ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-text-center xc-mb-6",children:[ge.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[ge.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),ge.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?ge.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):ge.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),ge.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),ge.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&ge.jsx(vc,{className:"xc-animate-spin"}),!y&&!n&&ge.jsxs(ge.Fragment,{children:[W7(e)&&ge.jsxs(Bb,{onClick:j,children:[ge.jsx(BK,{className:"xc-opacity-80"}),"Extension"]}),J&&ge.jsxs(Bb,{onClick:U,children:[ge.jsx(f8,{className:"xc-opacity-80"}),"Desktop"]}),T&&ge.jsx(Bb,{onClick:K,children:"Telegram Mini App"})]})]})]})}function MQ(t){const[e,r]=Se.useState(""),[n,i]=Se.useState(),[s,o]=Se.useState(),a=Mb(),[u,l]=Se.useState(!1);async function d(y){var P,N;if(!y||!((P=y.connectItems)!=null&&P.tonProof))return;l(!0);const A=await va.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(N=y.connectItems)==null?void 0:N.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(A.data),l(!1)}Se.useEffect(()=>{const y=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),A=y.onStatusChange(d);return o(y),r("select"),A},[]);function p(y){r("connect"),i(y)}return ge.jsxs(Ss,{children:[e==="select"&&ge.jsx(T7,{connector:s,onSelect:p,onBack:t.onBack}),e==="connect"&&ge.jsx(K7,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function V7(t){const{children:e,className:r}=t,n=Se.useRef(null),[i,s]=Se.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Se.useEffect(()=>{console.log("maxHeight",i)},[i]),ge.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function IQ(){return ge.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ge.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),ge.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function G7(t){const{wallets:e}=Kl(),[r,n]=Se.useState(),i=Se.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[ge.jsx(l8,{className:"xc-shrink-0 xc-opacity-50"}),ge.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),ge.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>ge.jsx(e7,{wallet:a,onClick:s},`feature-${a.key}`)):ge.jsx(IQ,{})})]})}function CQ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Se.useState(""),[l,d]=Se.useState(null),[p,y]=Se.useState("");function A(k){d(k),u("evm-wallet")}function P(k){u("email"),y(k)}async function N(k){await e(k)}function D(){u("ton-wallet")}return Se.useEffect(()=>{u("index")},[]),ge.jsx(GX,{config:t.config,children:ge.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&ge.jsx(TZ,{onBack:()=>u("index"),onLogin:N,wallet:l}),a==="ton-wallet"&&ge.jsx(MQ,{onBack:()=>u("index"),onLogin:N}),a==="email"&&ge.jsx(uZ,{email:p,onBack:()=>u("index"),onLogin:N}),a==="index"&&ge.jsx(f7,{header:r,onEmailConfirm:P,onSelectWallet:A,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&ge.jsx(G7,{onBack:()=>u("index"),onSelectWallet:A})]})})}function TQ(t){const{wallet:e,onConnect:r}=t,[n,i]=Se.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&ge.jsx(M7,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&ge.jsx(I7,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&ge.jsx(C7,{wallet:e})]})}function RQ(t){const{email:e}=t,[r,n]=Se.useState("captcha");return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),r==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>n("verify-email")}),r==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:t.onInputCode,onResendCode:()=>n("captcha")})]})}function DQ(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Se.useState(""),[a,u]=Se.useState(),[l,d]=Se.useState(),p=Se.useRef(),[y,A]=Se.useState("");function P(j){u(j),o("evm-wallet-connect")}function N(j){A(j),o("email-connect")}async function D(j,U){await e({chain_type:"eip155",client:j.client,connect_info:U}),o("index")}function k(j){d(j),o("ton-wallet-connect")}async function B(j){j&&await r({chain_type:"ton",client:p.current,connect_info:j})}return Se.useEffect(()=>{p.current=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const j=p.current.onStatusChange(B);return o("index"),j},[]),ge.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&ge.jsx(G7,{onBack:()=>o("index"),onSelectWallet:P}),s==="evm-wallet-connect"&&ge.jsx(TQ,{onBack:()=>o("index"),onConnect:D,wallet:a}),s==="ton-wallet-select"&&ge.jsx(T7,{connector:p.current,onSelect:k,onBack:()=>o("index")}),s==="ton-wallet-connect"&&ge.jsx(K7,{connector:p.current,wallet:l,onBack:()=>o("index")}),s==="email-connect"&&ge.jsx(RQ,{email:y,onBack:()=>o("index"),onInputCode:n}),s==="index"&&ge.jsx(f7,{onEmailConfirm:N,onSelectWallet:P,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Fn.CodattaConnect=DQ,Fn.CodattaConnectContextProvider=CK,Fn.CodattaSignin=CQ,Fn.coinbaseWallet=o8,Fn.useCodattaConnectContext=Kl,Object.defineProperty(Fn,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/main-BPYw2mdm.js b/dist/main-ChUtI_2i.js similarity index 98% rename from dist/main-BPYw2mdm.js rename to dist/main-ChUtI_2i.js index d95cdc4..be01045 100644 --- a/dist/main-BPYw2mdm.js +++ b/dist/main-ChUtI_2i.js @@ -2,7 +2,7 @@ var NR = Object.defineProperty; var LR = (t, e, r) => e in t ? NR(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; var Ds = (t, e, r) => LR(t, typeof e != "symbol" ? e + "" : e, r); import * as Gt from "react"; -import pv, { createContext as Sa, useContext as Tn, useState as Qt, useEffect as Dn, forwardRef as gv, createElement as qd, useId as mv, useCallback as vv, Component as kR, useLayoutEffect as $R, useRef as Zn, useInsertionEffect as b5, useMemo as wi, Fragment as y5, Children as BR, isValidElement as FR } from "react"; +import pv, { createContext as Sa, useContext as Tn, useState as Yt, useEffect as Dn, forwardRef as gv, createElement as qd, useId as mv, useCallback as vv, Component as kR, useLayoutEffect as $R, useRef as Zn, useInsertionEffect as b5, useMemo as wi, Fragment as y5, Children as BR, isValidElement as FR } from "react"; import "https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"; var gn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function ts(t) { @@ -472,7 +472,7 @@ function UR() { value: Te }), Object.freeze && (Object.freeze(je.props), Object.freeze(je)), je; }; - function Yt(j, se, he, xe, Te) { + function Jt(j, se, he, xe, Te) { { var Re, nt = {}, je = null, pt = null; he !== void 0 && (ze(he), je = "" + he), Ye(se) && (ze(se.key), je = "" + se.key), tt(se) && (pt = se.ref, dt(se, Te)); @@ -491,7 +491,7 @@ function UR() { } } var Et = B.ReactCurrentOwner, er = B.ReactDebugCurrentFrame; - function Jt(j) { + function Xt(j) { if (j) { var se = j._owner, he = ue(j.type, j._source, se ? se.type : null); er.setExtraStackFrame(he); @@ -541,7 +541,7 @@ Check the top-level render call using <` + he + ">."); return; Rt[he] = !0; var xe = ""; - j && j._owner && j._owner !== Et.current && (xe = " It was passed a child from " + m(j._owner.type) + "."), Jt(j), $('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', he, xe), Jt(null); + j && j._owner && j._owner !== Et.current && (xe = " It was passed a child from " + m(j._owner.type) + "."), Xt(j), $('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', he, xe), Xt(null); } } function $t(j, se) { @@ -593,11 +593,11 @@ Check the top-level render call using <` + he + ">."); for (var se = Object.keys(j.props), he = 0; he < se.length; he++) { var xe = se[he]; if (xe !== "children" && xe !== "key") { - Jt(j), $("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", xe), Jt(null); + Xt(j), $("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", xe), Xt(null); break; } } - j.ref !== null && (Jt(j), $("Invalid attribute `ref` supplied to `React.Fragment`."), Jt(null)); + j.ref !== null && (Xt(j), $("Invalid attribute `ref` supplied to `React.Fragment`."), Xt(null)); } } var Bt = {}; @@ -612,7 +612,7 @@ Check the top-level render call using <` + he + ">."); var it; j === null ? it = "null" : Ne(j) ? it = "array" : j !== void 0 && j.$$typeof === e ? (it = "<" + (m(j.type) || "Unknown") + " />", je = " Did you accidentally export a JSX literal instead of a component?") : it = typeof j, $("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", it, je); } - var et = Yt(j, se, he, Te, Re); + var et = Jt(j, se, he, Te, Re); if (et == null) return et; if (nt) { @@ -2850,7 +2850,7 @@ function UO(t) { return Bl(`0x${e}`); } async function qO({ hash: t, signature: e }) { - const r = va(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-zOw5-Bh-.js"); + const r = va(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-C2LQAh0i.js"); return `0x${(() => { if (typeof e == "object" && "r" in e && "s" in e) { const { r: l, s: d, v: p, yParity: w } = e, A = Number(w ?? p), M = I2(A); @@ -7142,8 +7142,8 @@ var D4 = {}; Z[T] = J[T] - Q[T]; } function R(Z, J, Q) { - let T, X, re = 0, de = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = 0, Me = 0, Ne = 0, Ke = 0, Le = 0, qe = 0, ze = 0, _e = 0, Ze = 0, at = 0, ke = 0, Qe = 0, tt = 0, Ye = 0, dt = 0, lt = 0, ct = 0, qt = 0, Yt = 0, Et = 0, er = 0, Jt = 0, Dt = 0, kt = Q[0], Ct = Q[1], gt = Q[2], Rt = Q[3], Nt = Q[4], vt = Q[5], $t = Q[6], Ft = Q[7], rt = Q[8], Bt = Q[9], k = Q[10], U = Q[11], z = Q[12], C = Q[13], G = Q[14], j = Q[15]; - T = J[0], re += T * kt, de += T * Ct, ie += T * gt, ue += T * Rt, ve += T * Nt, Pe += T * vt, De += T * $t, Ce += T * Ft, $e += T * rt, Me += T * Bt, Ne += T * k, Ke += T * U, Le += T * z, qe += T * C, ze += T * G, _e += T * j, T = J[1], de += T * kt, ie += T * Ct, ue += T * gt, ve += T * Rt, Pe += T * Nt, De += T * vt, Ce += T * $t, $e += T * Ft, Me += T * rt, Ne += T * Bt, Ke += T * k, Le += T * U, qe += T * z, ze += T * C, _e += T * G, Ze += T * j, T = J[2], ie += T * kt, ue += T * Ct, ve += T * gt, Pe += T * Rt, De += T * Nt, Ce += T * vt, $e += T * $t, Me += T * Ft, Ne += T * rt, Ke += T * Bt, Le += T * k, qe += T * U, ze += T * z, _e += T * C, Ze += T * G, at += T * j, T = J[3], ue += T * kt, ve += T * Ct, Pe += T * gt, De += T * Rt, Ce += T * Nt, $e += T * vt, Me += T * $t, Ne += T * Ft, Ke += T * rt, Le += T * Bt, qe += T * k, ze += T * U, _e += T * z, Ze += T * C, at += T * G, ke += T * j, T = J[4], ve += T * kt, Pe += T * Ct, De += T * gt, Ce += T * Rt, $e += T * Nt, Me += T * vt, Ne += T * $t, Ke += T * Ft, Le += T * rt, qe += T * Bt, ze += T * k, _e += T * U, Ze += T * z, at += T * C, ke += T * G, Qe += T * j, T = J[5], Pe += T * kt, De += T * Ct, Ce += T * gt, $e += T * Rt, Me += T * Nt, Ne += T * vt, Ke += T * $t, Le += T * Ft, qe += T * rt, ze += T * Bt, _e += T * k, Ze += T * U, at += T * z, ke += T * C, Qe += T * G, tt += T * j, T = J[6], De += T * kt, Ce += T * Ct, $e += T * gt, Me += T * Rt, Ne += T * Nt, Ke += T * vt, Le += T * $t, qe += T * Ft, ze += T * rt, _e += T * Bt, Ze += T * k, at += T * U, ke += T * z, Qe += T * C, tt += T * G, Ye += T * j, T = J[7], Ce += T * kt, $e += T * Ct, Me += T * gt, Ne += T * Rt, Ke += T * Nt, Le += T * vt, qe += T * $t, ze += T * Ft, _e += T * rt, Ze += T * Bt, at += T * k, ke += T * U, Qe += T * z, tt += T * C, Ye += T * G, dt += T * j, T = J[8], $e += T * kt, Me += T * Ct, Ne += T * gt, Ke += T * Rt, Le += T * Nt, qe += T * vt, ze += T * $t, _e += T * Ft, Ze += T * rt, at += T * Bt, ke += T * k, Qe += T * U, tt += T * z, Ye += T * C, dt += T * G, lt += T * j, T = J[9], Me += T * kt, Ne += T * Ct, Ke += T * gt, Le += T * Rt, qe += T * Nt, ze += T * vt, _e += T * $t, Ze += T * Ft, at += T * rt, ke += T * Bt, Qe += T * k, tt += T * U, Ye += T * z, dt += T * C, lt += T * G, ct += T * j, T = J[10], Ne += T * kt, Ke += T * Ct, Le += T * gt, qe += T * Rt, ze += T * Nt, _e += T * vt, Ze += T * $t, at += T * Ft, ke += T * rt, Qe += T * Bt, tt += T * k, Ye += T * U, dt += T * z, lt += T * C, ct += T * G, qt += T * j, T = J[11], Ke += T * kt, Le += T * Ct, qe += T * gt, ze += T * Rt, _e += T * Nt, Ze += T * vt, at += T * $t, ke += T * Ft, Qe += T * rt, tt += T * Bt, Ye += T * k, dt += T * U, lt += T * z, ct += T * C, qt += T * G, Yt += T * j, T = J[12], Le += T * kt, qe += T * Ct, ze += T * gt, _e += T * Rt, Ze += T * Nt, at += T * vt, ke += T * $t, Qe += T * Ft, tt += T * rt, Ye += T * Bt, dt += T * k, lt += T * U, ct += T * z, qt += T * C, Yt += T * G, Et += T * j, T = J[13], qe += T * kt, ze += T * Ct, _e += T * gt, Ze += T * Rt, at += T * Nt, ke += T * vt, Qe += T * $t, tt += T * Ft, Ye += T * rt, dt += T * Bt, lt += T * k, ct += T * U, qt += T * z, Yt += T * C, Et += T * G, er += T * j, T = J[14], ze += T * kt, _e += T * Ct, Ze += T * gt, at += T * Rt, ke += T * Nt, Qe += T * vt, tt += T * $t, Ye += T * Ft, dt += T * rt, lt += T * Bt, ct += T * k, qt += T * U, Yt += T * z, Et += T * C, er += T * G, Jt += T * j, T = J[15], _e += T * kt, Ze += T * Ct, at += T * gt, ke += T * Rt, Qe += T * Nt, tt += T * vt, Ye += T * $t, dt += T * Ft, lt += T * rt, ct += T * Bt, qt += T * k, Yt += T * U, Et += T * z, er += T * C, Jt += T * G, Dt += T * j, re += 38 * Ze, de += 38 * at, ie += 38 * ke, ue += 38 * Qe, ve += 38 * tt, Pe += 38 * Ye, De += 38 * dt, Ce += 38 * lt, $e += 38 * ct, Me += 38 * qt, Ne += 38 * Yt, Ke += 38 * Et, Le += 38 * er, qe += 38 * Jt, ze += 38 * Dt, X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = de + X + 65535, X = Math.floor(T / 65536), de = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = de + X + 65535, X = Math.floor(T / 65536), de = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), Z[0] = re, Z[1] = de, Z[2] = ie, Z[3] = ue, Z[4] = ve, Z[5] = Pe, Z[6] = De, Z[7] = Ce, Z[8] = $e, Z[9] = Me, Z[10] = Ne, Z[11] = Ke, Z[12] = Le, Z[13] = qe, Z[14] = ze, Z[15] = _e; + let T, X, re = 0, de = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = 0, Me = 0, Ne = 0, Ke = 0, Le = 0, qe = 0, ze = 0, _e = 0, Ze = 0, at = 0, ke = 0, Qe = 0, tt = 0, Ye = 0, dt = 0, lt = 0, ct = 0, qt = 0, Jt = 0, Et = 0, er = 0, Xt = 0, Dt = 0, kt = Q[0], Ct = Q[1], gt = Q[2], Rt = Q[3], Nt = Q[4], vt = Q[5], $t = Q[6], Ft = Q[7], rt = Q[8], Bt = Q[9], k = Q[10], U = Q[11], z = Q[12], C = Q[13], G = Q[14], j = Q[15]; + T = J[0], re += T * kt, de += T * Ct, ie += T * gt, ue += T * Rt, ve += T * Nt, Pe += T * vt, De += T * $t, Ce += T * Ft, $e += T * rt, Me += T * Bt, Ne += T * k, Ke += T * U, Le += T * z, qe += T * C, ze += T * G, _e += T * j, T = J[1], de += T * kt, ie += T * Ct, ue += T * gt, ve += T * Rt, Pe += T * Nt, De += T * vt, Ce += T * $t, $e += T * Ft, Me += T * rt, Ne += T * Bt, Ke += T * k, Le += T * U, qe += T * z, ze += T * C, _e += T * G, Ze += T * j, T = J[2], ie += T * kt, ue += T * Ct, ve += T * gt, Pe += T * Rt, De += T * Nt, Ce += T * vt, $e += T * $t, Me += T * Ft, Ne += T * rt, Ke += T * Bt, Le += T * k, qe += T * U, ze += T * z, _e += T * C, Ze += T * G, at += T * j, T = J[3], ue += T * kt, ve += T * Ct, Pe += T * gt, De += T * Rt, Ce += T * Nt, $e += T * vt, Me += T * $t, Ne += T * Ft, Ke += T * rt, Le += T * Bt, qe += T * k, ze += T * U, _e += T * z, Ze += T * C, at += T * G, ke += T * j, T = J[4], ve += T * kt, Pe += T * Ct, De += T * gt, Ce += T * Rt, $e += T * Nt, Me += T * vt, Ne += T * $t, Ke += T * Ft, Le += T * rt, qe += T * Bt, ze += T * k, _e += T * U, Ze += T * z, at += T * C, ke += T * G, Qe += T * j, T = J[5], Pe += T * kt, De += T * Ct, Ce += T * gt, $e += T * Rt, Me += T * Nt, Ne += T * vt, Ke += T * $t, Le += T * Ft, qe += T * rt, ze += T * Bt, _e += T * k, Ze += T * U, at += T * z, ke += T * C, Qe += T * G, tt += T * j, T = J[6], De += T * kt, Ce += T * Ct, $e += T * gt, Me += T * Rt, Ne += T * Nt, Ke += T * vt, Le += T * $t, qe += T * Ft, ze += T * rt, _e += T * Bt, Ze += T * k, at += T * U, ke += T * z, Qe += T * C, tt += T * G, Ye += T * j, T = J[7], Ce += T * kt, $e += T * Ct, Me += T * gt, Ne += T * Rt, Ke += T * Nt, Le += T * vt, qe += T * $t, ze += T * Ft, _e += T * rt, Ze += T * Bt, at += T * k, ke += T * U, Qe += T * z, tt += T * C, Ye += T * G, dt += T * j, T = J[8], $e += T * kt, Me += T * Ct, Ne += T * gt, Ke += T * Rt, Le += T * Nt, qe += T * vt, ze += T * $t, _e += T * Ft, Ze += T * rt, at += T * Bt, ke += T * k, Qe += T * U, tt += T * z, Ye += T * C, dt += T * G, lt += T * j, T = J[9], Me += T * kt, Ne += T * Ct, Ke += T * gt, Le += T * Rt, qe += T * Nt, ze += T * vt, _e += T * $t, Ze += T * Ft, at += T * rt, ke += T * Bt, Qe += T * k, tt += T * U, Ye += T * z, dt += T * C, lt += T * G, ct += T * j, T = J[10], Ne += T * kt, Ke += T * Ct, Le += T * gt, qe += T * Rt, ze += T * Nt, _e += T * vt, Ze += T * $t, at += T * Ft, ke += T * rt, Qe += T * Bt, tt += T * k, Ye += T * U, dt += T * z, lt += T * C, ct += T * G, qt += T * j, T = J[11], Ke += T * kt, Le += T * Ct, qe += T * gt, ze += T * Rt, _e += T * Nt, Ze += T * vt, at += T * $t, ke += T * Ft, Qe += T * rt, tt += T * Bt, Ye += T * k, dt += T * U, lt += T * z, ct += T * C, qt += T * G, Jt += T * j, T = J[12], Le += T * kt, qe += T * Ct, ze += T * gt, _e += T * Rt, Ze += T * Nt, at += T * vt, ke += T * $t, Qe += T * Ft, tt += T * rt, Ye += T * Bt, dt += T * k, lt += T * U, ct += T * z, qt += T * C, Jt += T * G, Et += T * j, T = J[13], qe += T * kt, ze += T * Ct, _e += T * gt, Ze += T * Rt, at += T * Nt, ke += T * vt, Qe += T * $t, tt += T * Ft, Ye += T * rt, dt += T * Bt, lt += T * k, ct += T * U, qt += T * z, Jt += T * C, Et += T * G, er += T * j, T = J[14], ze += T * kt, _e += T * Ct, Ze += T * gt, at += T * Rt, ke += T * Nt, Qe += T * vt, tt += T * $t, Ye += T * Ft, dt += T * rt, lt += T * Bt, ct += T * k, qt += T * U, Jt += T * z, Et += T * C, er += T * G, Xt += T * j, T = J[15], _e += T * kt, Ze += T * Ct, at += T * gt, ke += T * Rt, Qe += T * Nt, tt += T * vt, Ye += T * $t, dt += T * Ft, lt += T * rt, ct += T * Bt, qt += T * k, Jt += T * U, Et += T * z, er += T * C, Xt += T * G, Dt += T * j, re += 38 * Ze, de += 38 * at, ie += 38 * ke, ue += 38 * Qe, ve += 38 * tt, Pe += 38 * Ye, De += 38 * dt, Ce += 38 * lt, $e += 38 * ct, Me += 38 * qt, Ne += 38 * Jt, Ke += 38 * Et, Le += 38 * er, qe += 38 * Xt, ze += 38 * Dt, X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = de + X + 65535, X = Math.floor(T / 65536), de = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = de + X + 65535, X = Math.floor(T / 65536), de = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), Z[0] = re, Z[1] = de, Z[2] = ie, Z[3] = ue, Z[4] = ve, Z[5] = Pe, Z[6] = De, Z[7] = Ce, Z[8] = $e, Z[9] = Me, Z[10] = Ne, Z[11] = Ke, Z[12] = Le, Z[13] = qe, Z[14] = ze, Z[15] = _e; } function K(Z, J) { R(Z, J, J); @@ -8593,9 +8593,9 @@ var W4 = { exports: {} }; return this.encode(this.outputBits, !0), I.prototype.finalize.call(this); }; var ce = function(D) { - var oe, Z, J, Q, T, X, re, de, ie, ue, ve, Pe, De, Ce, $e, Me, Ne, Ke, Le, qe, ze, _e, Ze, at, ke, Qe, tt, Ye, dt, lt, ct, qt, Yt, Et, er, Jt, Dt, kt, Ct, gt, Rt, Nt, vt, $t, Ft, rt, Bt, k, U, z, C, G, j, se, he, xe, Te, Re, nt, je, pt, it, et; + var oe, Z, J, Q, T, X, re, de, ie, ue, ve, Pe, De, Ce, $e, Me, Ne, Ke, Le, qe, ze, _e, Ze, at, ke, Qe, tt, Ye, dt, lt, ct, qt, Jt, Et, er, Xt, Dt, kt, Ct, gt, Rt, Nt, vt, $t, Ft, rt, Bt, k, U, z, C, G, j, se, he, xe, Te, Re, nt, je, pt, it, et; for (J = 0; J < 48; J += 2) - Q = D[0] ^ D[10] ^ D[20] ^ D[30] ^ D[40], T = D[1] ^ D[11] ^ D[21] ^ D[31] ^ D[41], X = D[2] ^ D[12] ^ D[22] ^ D[32] ^ D[42], re = D[3] ^ D[13] ^ D[23] ^ D[33] ^ D[43], de = D[4] ^ D[14] ^ D[24] ^ D[34] ^ D[44], ie = D[5] ^ D[15] ^ D[25] ^ D[35] ^ D[45], ue = D[6] ^ D[16] ^ D[26] ^ D[36] ^ D[46], ve = D[7] ^ D[17] ^ D[27] ^ D[37] ^ D[47], Pe = D[8] ^ D[18] ^ D[28] ^ D[38] ^ D[48], De = D[9] ^ D[19] ^ D[29] ^ D[39] ^ D[49], oe = Pe ^ (X << 1 | re >>> 31), Z = De ^ (re << 1 | X >>> 31), D[0] ^= oe, D[1] ^= Z, D[10] ^= oe, D[11] ^= Z, D[20] ^= oe, D[21] ^= Z, D[30] ^= oe, D[31] ^= Z, D[40] ^= oe, D[41] ^= Z, oe = Q ^ (de << 1 | ie >>> 31), Z = T ^ (ie << 1 | de >>> 31), D[2] ^= oe, D[3] ^= Z, D[12] ^= oe, D[13] ^= Z, D[22] ^= oe, D[23] ^= Z, D[32] ^= oe, D[33] ^= Z, D[42] ^= oe, D[43] ^= Z, oe = X ^ (ue << 1 | ve >>> 31), Z = re ^ (ve << 1 | ue >>> 31), D[4] ^= oe, D[5] ^= Z, D[14] ^= oe, D[15] ^= Z, D[24] ^= oe, D[25] ^= Z, D[34] ^= oe, D[35] ^= Z, D[44] ^= oe, D[45] ^= Z, oe = de ^ (Pe << 1 | De >>> 31), Z = ie ^ (De << 1 | Pe >>> 31), D[6] ^= oe, D[7] ^= Z, D[16] ^= oe, D[17] ^= Z, D[26] ^= oe, D[27] ^= Z, D[36] ^= oe, D[37] ^= Z, D[46] ^= oe, D[47] ^= Z, oe = ue ^ (Q << 1 | T >>> 31), Z = ve ^ (T << 1 | Q >>> 31), D[8] ^= oe, D[9] ^= Z, D[18] ^= oe, D[19] ^= Z, D[28] ^= oe, D[29] ^= Z, D[38] ^= oe, D[39] ^= Z, D[48] ^= oe, D[49] ^= Z, Ce = D[0], $e = D[1], rt = D[11] << 4 | D[10] >>> 28, Bt = D[10] << 4 | D[11] >>> 28, Ye = D[20] << 3 | D[21] >>> 29, dt = D[21] << 3 | D[20] >>> 29, je = D[31] << 9 | D[30] >>> 23, pt = D[30] << 9 | D[31] >>> 23, Nt = D[40] << 18 | D[41] >>> 14, vt = D[41] << 18 | D[40] >>> 14, Et = D[2] << 1 | D[3] >>> 31, er = D[3] << 1 | D[2] >>> 31, Me = D[13] << 12 | D[12] >>> 20, Ne = D[12] << 12 | D[13] >>> 20, k = D[22] << 10 | D[23] >>> 22, U = D[23] << 10 | D[22] >>> 22, lt = D[33] << 13 | D[32] >>> 19, ct = D[32] << 13 | D[33] >>> 19, it = D[42] << 2 | D[43] >>> 30, et = D[43] << 2 | D[42] >>> 30, se = D[5] << 30 | D[4] >>> 2, he = D[4] << 30 | D[5] >>> 2, Jt = D[14] << 6 | D[15] >>> 26, Dt = D[15] << 6 | D[14] >>> 26, Ke = D[25] << 11 | D[24] >>> 21, Le = D[24] << 11 | D[25] >>> 21, z = D[34] << 15 | D[35] >>> 17, C = D[35] << 15 | D[34] >>> 17, qt = D[45] << 29 | D[44] >>> 3, Yt = D[44] << 29 | D[45] >>> 3, at = D[6] << 28 | D[7] >>> 4, ke = D[7] << 28 | D[6] >>> 4, xe = D[17] << 23 | D[16] >>> 9, Te = D[16] << 23 | D[17] >>> 9, kt = D[26] << 25 | D[27] >>> 7, Ct = D[27] << 25 | D[26] >>> 7, qe = D[36] << 21 | D[37] >>> 11, ze = D[37] << 21 | D[36] >>> 11, G = D[47] << 24 | D[46] >>> 8, j = D[46] << 24 | D[47] >>> 8, $t = D[8] << 27 | D[9] >>> 5, Ft = D[9] << 27 | D[8] >>> 5, Qe = D[18] << 20 | D[19] >>> 12, tt = D[19] << 20 | D[18] >>> 12, Re = D[29] << 7 | D[28] >>> 25, nt = D[28] << 7 | D[29] >>> 25, gt = D[38] << 8 | D[39] >>> 24, Rt = D[39] << 8 | D[38] >>> 24, _e = D[48] << 14 | D[49] >>> 18, Ze = D[49] << 14 | D[48] >>> 18, D[0] = Ce ^ ~Me & Ke, D[1] = $e ^ ~Ne & Le, D[10] = at ^ ~Qe & Ye, D[11] = ke ^ ~tt & dt, D[20] = Et ^ ~Jt & kt, D[21] = er ^ ~Dt & Ct, D[30] = $t ^ ~rt & k, D[31] = Ft ^ ~Bt & U, D[40] = se ^ ~xe & Re, D[41] = he ^ ~Te & nt, D[2] = Me ^ ~Ke & qe, D[3] = Ne ^ ~Le & ze, D[12] = Qe ^ ~Ye & lt, D[13] = tt ^ ~dt & ct, D[22] = Jt ^ ~kt & gt, D[23] = Dt ^ ~Ct & Rt, D[32] = rt ^ ~k & z, D[33] = Bt ^ ~U & C, D[42] = xe ^ ~Re & je, D[43] = Te ^ ~nt & pt, D[4] = Ke ^ ~qe & _e, D[5] = Le ^ ~ze & Ze, D[14] = Ye ^ ~lt & qt, D[15] = dt ^ ~ct & Yt, D[24] = kt ^ ~gt & Nt, D[25] = Ct ^ ~Rt & vt, D[34] = k ^ ~z & G, D[35] = U ^ ~C & j, D[44] = Re ^ ~je & it, D[45] = nt ^ ~pt & et, D[6] = qe ^ ~_e & Ce, D[7] = ze ^ ~Ze & $e, D[16] = lt ^ ~qt & at, D[17] = ct ^ ~Yt & ke, D[26] = gt ^ ~Nt & Et, D[27] = Rt ^ ~vt & er, D[36] = z ^ ~G & $t, D[37] = C ^ ~j & Ft, D[46] = je ^ ~it & se, D[47] = pt ^ ~et & he, D[8] = _e ^ ~Ce & Me, D[9] = Ze ^ ~$e & Ne, D[18] = qt ^ ~at & Qe, D[19] = Yt ^ ~ke & tt, D[28] = Nt ^ ~Et & Jt, D[29] = vt ^ ~er & Dt, D[38] = G ^ ~$t & rt, D[39] = j ^ ~Ft & Bt, D[48] = it ^ ~se & xe, D[49] = et ^ ~he & Te, D[0] ^= N[J], D[1] ^= N[J + 1]; + Q = D[0] ^ D[10] ^ D[20] ^ D[30] ^ D[40], T = D[1] ^ D[11] ^ D[21] ^ D[31] ^ D[41], X = D[2] ^ D[12] ^ D[22] ^ D[32] ^ D[42], re = D[3] ^ D[13] ^ D[23] ^ D[33] ^ D[43], de = D[4] ^ D[14] ^ D[24] ^ D[34] ^ D[44], ie = D[5] ^ D[15] ^ D[25] ^ D[35] ^ D[45], ue = D[6] ^ D[16] ^ D[26] ^ D[36] ^ D[46], ve = D[7] ^ D[17] ^ D[27] ^ D[37] ^ D[47], Pe = D[8] ^ D[18] ^ D[28] ^ D[38] ^ D[48], De = D[9] ^ D[19] ^ D[29] ^ D[39] ^ D[49], oe = Pe ^ (X << 1 | re >>> 31), Z = De ^ (re << 1 | X >>> 31), D[0] ^= oe, D[1] ^= Z, D[10] ^= oe, D[11] ^= Z, D[20] ^= oe, D[21] ^= Z, D[30] ^= oe, D[31] ^= Z, D[40] ^= oe, D[41] ^= Z, oe = Q ^ (de << 1 | ie >>> 31), Z = T ^ (ie << 1 | de >>> 31), D[2] ^= oe, D[3] ^= Z, D[12] ^= oe, D[13] ^= Z, D[22] ^= oe, D[23] ^= Z, D[32] ^= oe, D[33] ^= Z, D[42] ^= oe, D[43] ^= Z, oe = X ^ (ue << 1 | ve >>> 31), Z = re ^ (ve << 1 | ue >>> 31), D[4] ^= oe, D[5] ^= Z, D[14] ^= oe, D[15] ^= Z, D[24] ^= oe, D[25] ^= Z, D[34] ^= oe, D[35] ^= Z, D[44] ^= oe, D[45] ^= Z, oe = de ^ (Pe << 1 | De >>> 31), Z = ie ^ (De << 1 | Pe >>> 31), D[6] ^= oe, D[7] ^= Z, D[16] ^= oe, D[17] ^= Z, D[26] ^= oe, D[27] ^= Z, D[36] ^= oe, D[37] ^= Z, D[46] ^= oe, D[47] ^= Z, oe = ue ^ (Q << 1 | T >>> 31), Z = ve ^ (T << 1 | Q >>> 31), D[8] ^= oe, D[9] ^= Z, D[18] ^= oe, D[19] ^= Z, D[28] ^= oe, D[29] ^= Z, D[38] ^= oe, D[39] ^= Z, D[48] ^= oe, D[49] ^= Z, Ce = D[0], $e = D[1], rt = D[11] << 4 | D[10] >>> 28, Bt = D[10] << 4 | D[11] >>> 28, Ye = D[20] << 3 | D[21] >>> 29, dt = D[21] << 3 | D[20] >>> 29, je = D[31] << 9 | D[30] >>> 23, pt = D[30] << 9 | D[31] >>> 23, Nt = D[40] << 18 | D[41] >>> 14, vt = D[41] << 18 | D[40] >>> 14, Et = D[2] << 1 | D[3] >>> 31, er = D[3] << 1 | D[2] >>> 31, Me = D[13] << 12 | D[12] >>> 20, Ne = D[12] << 12 | D[13] >>> 20, k = D[22] << 10 | D[23] >>> 22, U = D[23] << 10 | D[22] >>> 22, lt = D[33] << 13 | D[32] >>> 19, ct = D[32] << 13 | D[33] >>> 19, it = D[42] << 2 | D[43] >>> 30, et = D[43] << 2 | D[42] >>> 30, se = D[5] << 30 | D[4] >>> 2, he = D[4] << 30 | D[5] >>> 2, Xt = D[14] << 6 | D[15] >>> 26, Dt = D[15] << 6 | D[14] >>> 26, Ke = D[25] << 11 | D[24] >>> 21, Le = D[24] << 11 | D[25] >>> 21, z = D[34] << 15 | D[35] >>> 17, C = D[35] << 15 | D[34] >>> 17, qt = D[45] << 29 | D[44] >>> 3, Jt = D[44] << 29 | D[45] >>> 3, at = D[6] << 28 | D[7] >>> 4, ke = D[7] << 28 | D[6] >>> 4, xe = D[17] << 23 | D[16] >>> 9, Te = D[16] << 23 | D[17] >>> 9, kt = D[26] << 25 | D[27] >>> 7, Ct = D[27] << 25 | D[26] >>> 7, qe = D[36] << 21 | D[37] >>> 11, ze = D[37] << 21 | D[36] >>> 11, G = D[47] << 24 | D[46] >>> 8, j = D[46] << 24 | D[47] >>> 8, $t = D[8] << 27 | D[9] >>> 5, Ft = D[9] << 27 | D[8] >>> 5, Qe = D[18] << 20 | D[19] >>> 12, tt = D[19] << 20 | D[18] >>> 12, Re = D[29] << 7 | D[28] >>> 25, nt = D[28] << 7 | D[29] >>> 25, gt = D[38] << 8 | D[39] >>> 24, Rt = D[39] << 8 | D[38] >>> 24, _e = D[48] << 14 | D[49] >>> 18, Ze = D[49] << 14 | D[48] >>> 18, D[0] = Ce ^ ~Me & Ke, D[1] = $e ^ ~Ne & Le, D[10] = at ^ ~Qe & Ye, D[11] = ke ^ ~tt & dt, D[20] = Et ^ ~Xt & kt, D[21] = er ^ ~Dt & Ct, D[30] = $t ^ ~rt & k, D[31] = Ft ^ ~Bt & U, D[40] = se ^ ~xe & Re, D[41] = he ^ ~Te & nt, D[2] = Me ^ ~Ke & qe, D[3] = Ne ^ ~Le & ze, D[12] = Qe ^ ~Ye & lt, D[13] = tt ^ ~dt & ct, D[22] = Xt ^ ~kt & gt, D[23] = Dt ^ ~Ct & Rt, D[32] = rt ^ ~k & z, D[33] = Bt ^ ~U & C, D[42] = xe ^ ~Re & je, D[43] = Te ^ ~nt & pt, D[4] = Ke ^ ~qe & _e, D[5] = Le ^ ~ze & Ze, D[14] = Ye ^ ~lt & qt, D[15] = dt ^ ~ct & Jt, D[24] = kt ^ ~gt & Nt, D[25] = Ct ^ ~Rt & vt, D[34] = k ^ ~z & G, D[35] = U ^ ~C & j, D[44] = Re ^ ~je & it, D[45] = nt ^ ~pt & et, D[6] = qe ^ ~_e & Ce, D[7] = ze ^ ~Ze & $e, D[16] = lt ^ ~qt & at, D[17] = ct ^ ~Jt & ke, D[26] = gt ^ ~Nt & Et, D[27] = Rt ^ ~vt & er, D[36] = z ^ ~G & $t, D[37] = C ^ ~j & Ft, D[46] = je ^ ~it & se, D[47] = pt ^ ~et & he, D[8] = _e ^ ~Ce & Me, D[9] = Ze ^ ~$e & Ne, D[18] = qt ^ ~at & Qe, D[19] = Jt ^ ~ke & tt, D[28] = Nt ^ ~Et & Xt, D[29] = vt ^ ~er & Dt, D[38] = G ^ ~$t & rt, D[39] = j ^ ~Ft & Bt, D[48] = it ^ ~se & xe, D[49] = et ^ ~he & Te, D[0] ^= N[J], D[1] ^= N[J + 1]; }; if (a) t.exports = f; @@ -9396,30 +9396,30 @@ zv.exports; return P !== 0 ? g.words[I] = P | 0 : g.length--, g._strip(); } var $ = function(f, g, b) { - var x = f.words, _ = g.words, E = b.words, v = 0, P, I, F, ce = x[0] | 0, D = ce & 8191, oe = ce >>> 13, Z = x[1] | 0, J = Z & 8191, Q = Z >>> 13, T = x[2] | 0, X = T & 8191, re = T >>> 13, de = x[3] | 0, ie = de & 8191, ue = de >>> 13, ve = x[4] | 0, Pe = ve & 8191, De = ve >>> 13, Ce = x[5] | 0, $e = Ce & 8191, Me = Ce >>> 13, Ne = x[6] | 0, Ke = Ne & 8191, Le = Ne >>> 13, qe = x[7] | 0, ze = qe & 8191, _e = qe >>> 13, Ze = x[8] | 0, at = Ze & 8191, ke = Ze >>> 13, Qe = x[9] | 0, tt = Qe & 8191, Ye = Qe >>> 13, dt = _[0] | 0, lt = dt & 8191, ct = dt >>> 13, qt = _[1] | 0, Yt = qt & 8191, Et = qt >>> 13, er = _[2] | 0, Jt = er & 8191, Dt = er >>> 13, kt = _[3] | 0, Ct = kt & 8191, gt = kt >>> 13, Rt = _[4] | 0, Nt = Rt & 8191, vt = Rt >>> 13, $t = _[5] | 0, Ft = $t & 8191, rt = $t >>> 13, Bt = _[6] | 0, k = Bt & 8191, U = Bt >>> 13, z = _[7] | 0, C = z & 8191, G = z >>> 13, j = _[8] | 0, se = j & 8191, he = j >>> 13, xe = _[9] | 0, Te = xe & 8191, Re = xe >>> 13; + var x = f.words, _ = g.words, E = b.words, v = 0, P, I, F, ce = x[0] | 0, D = ce & 8191, oe = ce >>> 13, Z = x[1] | 0, J = Z & 8191, Q = Z >>> 13, T = x[2] | 0, X = T & 8191, re = T >>> 13, de = x[3] | 0, ie = de & 8191, ue = de >>> 13, ve = x[4] | 0, Pe = ve & 8191, De = ve >>> 13, Ce = x[5] | 0, $e = Ce & 8191, Me = Ce >>> 13, Ne = x[6] | 0, Ke = Ne & 8191, Le = Ne >>> 13, qe = x[7] | 0, ze = qe & 8191, _e = qe >>> 13, Ze = x[8] | 0, at = Ze & 8191, ke = Ze >>> 13, Qe = x[9] | 0, tt = Qe & 8191, Ye = Qe >>> 13, dt = _[0] | 0, lt = dt & 8191, ct = dt >>> 13, qt = _[1] | 0, Jt = qt & 8191, Et = qt >>> 13, er = _[2] | 0, Xt = er & 8191, Dt = er >>> 13, kt = _[3] | 0, Ct = kt & 8191, gt = kt >>> 13, Rt = _[4] | 0, Nt = Rt & 8191, vt = Rt >>> 13, $t = _[5] | 0, Ft = $t & 8191, rt = $t >>> 13, Bt = _[6] | 0, k = Bt & 8191, U = Bt >>> 13, z = _[7] | 0, C = z & 8191, G = z >>> 13, j = _[8] | 0, se = j & 8191, he = j >>> 13, xe = _[9] | 0, Te = xe & 8191, Re = xe >>> 13; b.negative = f.negative ^ g.negative, b.length = 19, P = Math.imul(D, lt), I = Math.imul(D, ct), I = I + Math.imul(oe, lt) | 0, F = Math.imul(oe, ct); var nt = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, P = Math.imul(J, lt), I = Math.imul(J, ct), I = I + Math.imul(Q, lt) | 0, F = Math.imul(Q, ct), P = P + Math.imul(D, Yt) | 0, I = I + Math.imul(D, Et) | 0, I = I + Math.imul(oe, Yt) | 0, F = F + Math.imul(oe, Et) | 0; + v = (F + (I >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, P = Math.imul(J, lt), I = Math.imul(J, ct), I = I + Math.imul(Q, lt) | 0, F = Math.imul(Q, ct), P = P + Math.imul(D, Jt) | 0, I = I + Math.imul(D, Et) | 0, I = I + Math.imul(oe, Jt) | 0, F = F + Math.imul(oe, Et) | 0; var je = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (je >>> 26) | 0, je &= 67108863, P = Math.imul(X, lt), I = Math.imul(X, ct), I = I + Math.imul(re, lt) | 0, F = Math.imul(re, ct), P = P + Math.imul(J, Yt) | 0, I = I + Math.imul(J, Et) | 0, I = I + Math.imul(Q, Yt) | 0, F = F + Math.imul(Q, Et) | 0, P = P + Math.imul(D, Jt) | 0, I = I + Math.imul(D, Dt) | 0, I = I + Math.imul(oe, Jt) | 0, F = F + Math.imul(oe, Dt) | 0; + v = (F + (I >>> 13) | 0) + (je >>> 26) | 0, je &= 67108863, P = Math.imul(X, lt), I = Math.imul(X, ct), I = I + Math.imul(re, lt) | 0, F = Math.imul(re, ct), P = P + Math.imul(J, Jt) | 0, I = I + Math.imul(J, Et) | 0, I = I + Math.imul(Q, Jt) | 0, F = F + Math.imul(Q, Et) | 0, P = P + Math.imul(D, Xt) | 0, I = I + Math.imul(D, Dt) | 0, I = I + Math.imul(oe, Xt) | 0, F = F + Math.imul(oe, Dt) | 0; var pt = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (pt >>> 26) | 0, pt &= 67108863, P = Math.imul(ie, lt), I = Math.imul(ie, ct), I = I + Math.imul(ue, lt) | 0, F = Math.imul(ue, ct), P = P + Math.imul(X, Yt) | 0, I = I + Math.imul(X, Et) | 0, I = I + Math.imul(re, Yt) | 0, F = F + Math.imul(re, Et) | 0, P = P + Math.imul(J, Jt) | 0, I = I + Math.imul(J, Dt) | 0, I = I + Math.imul(Q, Jt) | 0, F = F + Math.imul(Q, Dt) | 0, P = P + Math.imul(D, Ct) | 0, I = I + Math.imul(D, gt) | 0, I = I + Math.imul(oe, Ct) | 0, F = F + Math.imul(oe, gt) | 0; + v = (F + (I >>> 13) | 0) + (pt >>> 26) | 0, pt &= 67108863, P = Math.imul(ie, lt), I = Math.imul(ie, ct), I = I + Math.imul(ue, lt) | 0, F = Math.imul(ue, ct), P = P + Math.imul(X, Jt) | 0, I = I + Math.imul(X, Et) | 0, I = I + Math.imul(re, Jt) | 0, F = F + Math.imul(re, Et) | 0, P = P + Math.imul(J, Xt) | 0, I = I + Math.imul(J, Dt) | 0, I = I + Math.imul(Q, Xt) | 0, F = F + Math.imul(Q, Dt) | 0, P = P + Math.imul(D, Ct) | 0, I = I + Math.imul(D, gt) | 0, I = I + Math.imul(oe, Ct) | 0, F = F + Math.imul(oe, gt) | 0; var it = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, P = Math.imul(Pe, lt), I = Math.imul(Pe, ct), I = I + Math.imul(De, lt) | 0, F = Math.imul(De, ct), P = P + Math.imul(ie, Yt) | 0, I = I + Math.imul(ie, Et) | 0, I = I + Math.imul(ue, Yt) | 0, F = F + Math.imul(ue, Et) | 0, P = P + Math.imul(X, Jt) | 0, I = I + Math.imul(X, Dt) | 0, I = I + Math.imul(re, Jt) | 0, F = F + Math.imul(re, Dt) | 0, P = P + Math.imul(J, Ct) | 0, I = I + Math.imul(J, gt) | 0, I = I + Math.imul(Q, Ct) | 0, F = F + Math.imul(Q, gt) | 0, P = P + Math.imul(D, Nt) | 0, I = I + Math.imul(D, vt) | 0, I = I + Math.imul(oe, Nt) | 0, F = F + Math.imul(oe, vt) | 0; + v = (F + (I >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, P = Math.imul(Pe, lt), I = Math.imul(Pe, ct), I = I + Math.imul(De, lt) | 0, F = Math.imul(De, ct), P = P + Math.imul(ie, Jt) | 0, I = I + Math.imul(ie, Et) | 0, I = I + Math.imul(ue, Jt) | 0, F = F + Math.imul(ue, Et) | 0, P = P + Math.imul(X, Xt) | 0, I = I + Math.imul(X, Dt) | 0, I = I + Math.imul(re, Xt) | 0, F = F + Math.imul(re, Dt) | 0, P = P + Math.imul(J, Ct) | 0, I = I + Math.imul(J, gt) | 0, I = I + Math.imul(Q, Ct) | 0, F = F + Math.imul(Q, gt) | 0, P = P + Math.imul(D, Nt) | 0, I = I + Math.imul(D, vt) | 0, I = I + Math.imul(oe, Nt) | 0, F = F + Math.imul(oe, vt) | 0; var et = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, P = Math.imul($e, lt), I = Math.imul($e, ct), I = I + Math.imul(Me, lt) | 0, F = Math.imul(Me, ct), P = P + Math.imul(Pe, Yt) | 0, I = I + Math.imul(Pe, Et) | 0, I = I + Math.imul(De, Yt) | 0, F = F + Math.imul(De, Et) | 0, P = P + Math.imul(ie, Jt) | 0, I = I + Math.imul(ie, Dt) | 0, I = I + Math.imul(ue, Jt) | 0, F = F + Math.imul(ue, Dt) | 0, P = P + Math.imul(X, Ct) | 0, I = I + Math.imul(X, gt) | 0, I = I + Math.imul(re, Ct) | 0, F = F + Math.imul(re, gt) | 0, P = P + Math.imul(J, Nt) | 0, I = I + Math.imul(J, vt) | 0, I = I + Math.imul(Q, Nt) | 0, F = F + Math.imul(Q, vt) | 0, P = P + Math.imul(D, Ft) | 0, I = I + Math.imul(D, rt) | 0, I = I + Math.imul(oe, Ft) | 0, F = F + Math.imul(oe, rt) | 0; + v = (F + (I >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, P = Math.imul($e, lt), I = Math.imul($e, ct), I = I + Math.imul(Me, lt) | 0, F = Math.imul(Me, ct), P = P + Math.imul(Pe, Jt) | 0, I = I + Math.imul(Pe, Et) | 0, I = I + Math.imul(De, Jt) | 0, F = F + Math.imul(De, Et) | 0, P = P + Math.imul(ie, Xt) | 0, I = I + Math.imul(ie, Dt) | 0, I = I + Math.imul(ue, Xt) | 0, F = F + Math.imul(ue, Dt) | 0, P = P + Math.imul(X, Ct) | 0, I = I + Math.imul(X, gt) | 0, I = I + Math.imul(re, Ct) | 0, F = F + Math.imul(re, gt) | 0, P = P + Math.imul(J, Nt) | 0, I = I + Math.imul(J, vt) | 0, I = I + Math.imul(Q, Nt) | 0, F = F + Math.imul(Q, vt) | 0, P = P + Math.imul(D, Ft) | 0, I = I + Math.imul(D, rt) | 0, I = I + Math.imul(oe, Ft) | 0, F = F + Math.imul(oe, rt) | 0; var St = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, P = Math.imul(Ke, lt), I = Math.imul(Ke, ct), I = I + Math.imul(Le, lt) | 0, F = Math.imul(Le, ct), P = P + Math.imul($e, Yt) | 0, I = I + Math.imul($e, Et) | 0, I = I + Math.imul(Me, Yt) | 0, F = F + Math.imul(Me, Et) | 0, P = P + Math.imul(Pe, Jt) | 0, I = I + Math.imul(Pe, Dt) | 0, I = I + Math.imul(De, Jt) | 0, F = F + Math.imul(De, Dt) | 0, P = P + Math.imul(ie, Ct) | 0, I = I + Math.imul(ie, gt) | 0, I = I + Math.imul(ue, Ct) | 0, F = F + Math.imul(ue, gt) | 0, P = P + Math.imul(X, Nt) | 0, I = I + Math.imul(X, vt) | 0, I = I + Math.imul(re, Nt) | 0, F = F + Math.imul(re, vt) | 0, P = P + Math.imul(J, Ft) | 0, I = I + Math.imul(J, rt) | 0, I = I + Math.imul(Q, Ft) | 0, F = F + Math.imul(Q, rt) | 0, P = P + Math.imul(D, k) | 0, I = I + Math.imul(D, U) | 0, I = I + Math.imul(oe, k) | 0, F = F + Math.imul(oe, U) | 0; + v = (F + (I >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, P = Math.imul(Ke, lt), I = Math.imul(Ke, ct), I = I + Math.imul(Le, lt) | 0, F = Math.imul(Le, ct), P = P + Math.imul($e, Jt) | 0, I = I + Math.imul($e, Et) | 0, I = I + Math.imul(Me, Jt) | 0, F = F + Math.imul(Me, Et) | 0, P = P + Math.imul(Pe, Xt) | 0, I = I + Math.imul(Pe, Dt) | 0, I = I + Math.imul(De, Xt) | 0, F = F + Math.imul(De, Dt) | 0, P = P + Math.imul(ie, Ct) | 0, I = I + Math.imul(ie, gt) | 0, I = I + Math.imul(ue, Ct) | 0, F = F + Math.imul(ue, gt) | 0, P = P + Math.imul(X, Nt) | 0, I = I + Math.imul(X, vt) | 0, I = I + Math.imul(re, Nt) | 0, F = F + Math.imul(re, vt) | 0, P = P + Math.imul(J, Ft) | 0, I = I + Math.imul(J, rt) | 0, I = I + Math.imul(Q, Ft) | 0, F = F + Math.imul(Q, rt) | 0, P = P + Math.imul(D, k) | 0, I = I + Math.imul(D, U) | 0, I = I + Math.imul(oe, k) | 0, F = F + Math.imul(oe, U) | 0; var Tt = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, P = Math.imul(ze, lt), I = Math.imul(ze, ct), I = I + Math.imul(_e, lt) | 0, F = Math.imul(_e, ct), P = P + Math.imul(Ke, Yt) | 0, I = I + Math.imul(Ke, Et) | 0, I = I + Math.imul(Le, Yt) | 0, F = F + Math.imul(Le, Et) | 0, P = P + Math.imul($e, Jt) | 0, I = I + Math.imul($e, Dt) | 0, I = I + Math.imul(Me, Jt) | 0, F = F + Math.imul(Me, Dt) | 0, P = P + Math.imul(Pe, Ct) | 0, I = I + Math.imul(Pe, gt) | 0, I = I + Math.imul(De, Ct) | 0, F = F + Math.imul(De, gt) | 0, P = P + Math.imul(ie, Nt) | 0, I = I + Math.imul(ie, vt) | 0, I = I + Math.imul(ue, Nt) | 0, F = F + Math.imul(ue, vt) | 0, P = P + Math.imul(X, Ft) | 0, I = I + Math.imul(X, rt) | 0, I = I + Math.imul(re, Ft) | 0, F = F + Math.imul(re, rt) | 0, P = P + Math.imul(J, k) | 0, I = I + Math.imul(J, U) | 0, I = I + Math.imul(Q, k) | 0, F = F + Math.imul(Q, U) | 0, P = P + Math.imul(D, C) | 0, I = I + Math.imul(D, G) | 0, I = I + Math.imul(oe, C) | 0, F = F + Math.imul(oe, G) | 0; + v = (F + (I >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, P = Math.imul(ze, lt), I = Math.imul(ze, ct), I = I + Math.imul(_e, lt) | 0, F = Math.imul(_e, ct), P = P + Math.imul(Ke, Jt) | 0, I = I + Math.imul(Ke, Et) | 0, I = I + Math.imul(Le, Jt) | 0, F = F + Math.imul(Le, Et) | 0, P = P + Math.imul($e, Xt) | 0, I = I + Math.imul($e, Dt) | 0, I = I + Math.imul(Me, Xt) | 0, F = F + Math.imul(Me, Dt) | 0, P = P + Math.imul(Pe, Ct) | 0, I = I + Math.imul(Pe, gt) | 0, I = I + Math.imul(De, Ct) | 0, F = F + Math.imul(De, gt) | 0, P = P + Math.imul(ie, Nt) | 0, I = I + Math.imul(ie, vt) | 0, I = I + Math.imul(ue, Nt) | 0, F = F + Math.imul(ue, vt) | 0, P = P + Math.imul(X, Ft) | 0, I = I + Math.imul(X, rt) | 0, I = I + Math.imul(re, Ft) | 0, F = F + Math.imul(re, rt) | 0, P = P + Math.imul(J, k) | 0, I = I + Math.imul(J, U) | 0, I = I + Math.imul(Q, k) | 0, F = F + Math.imul(Q, U) | 0, P = P + Math.imul(D, C) | 0, I = I + Math.imul(D, G) | 0, I = I + Math.imul(oe, C) | 0, F = F + Math.imul(oe, G) | 0; var At = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, P = Math.imul(at, lt), I = Math.imul(at, ct), I = I + Math.imul(ke, lt) | 0, F = Math.imul(ke, ct), P = P + Math.imul(ze, Yt) | 0, I = I + Math.imul(ze, Et) | 0, I = I + Math.imul(_e, Yt) | 0, F = F + Math.imul(_e, Et) | 0, P = P + Math.imul(Ke, Jt) | 0, I = I + Math.imul(Ke, Dt) | 0, I = I + Math.imul(Le, Jt) | 0, F = F + Math.imul(Le, Dt) | 0, P = P + Math.imul($e, Ct) | 0, I = I + Math.imul($e, gt) | 0, I = I + Math.imul(Me, Ct) | 0, F = F + Math.imul(Me, gt) | 0, P = P + Math.imul(Pe, Nt) | 0, I = I + Math.imul(Pe, vt) | 0, I = I + Math.imul(De, Nt) | 0, F = F + Math.imul(De, vt) | 0, P = P + Math.imul(ie, Ft) | 0, I = I + Math.imul(ie, rt) | 0, I = I + Math.imul(ue, Ft) | 0, F = F + Math.imul(ue, rt) | 0, P = P + Math.imul(X, k) | 0, I = I + Math.imul(X, U) | 0, I = I + Math.imul(re, k) | 0, F = F + Math.imul(re, U) | 0, P = P + Math.imul(J, C) | 0, I = I + Math.imul(J, G) | 0, I = I + Math.imul(Q, C) | 0, F = F + Math.imul(Q, G) | 0, P = P + Math.imul(D, se) | 0, I = I + Math.imul(D, he) | 0, I = I + Math.imul(oe, se) | 0, F = F + Math.imul(oe, he) | 0; + v = (F + (I >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, P = Math.imul(at, lt), I = Math.imul(at, ct), I = I + Math.imul(ke, lt) | 0, F = Math.imul(ke, ct), P = P + Math.imul(ze, Jt) | 0, I = I + Math.imul(ze, Et) | 0, I = I + Math.imul(_e, Jt) | 0, F = F + Math.imul(_e, Et) | 0, P = P + Math.imul(Ke, Xt) | 0, I = I + Math.imul(Ke, Dt) | 0, I = I + Math.imul(Le, Xt) | 0, F = F + Math.imul(Le, Dt) | 0, P = P + Math.imul($e, Ct) | 0, I = I + Math.imul($e, gt) | 0, I = I + Math.imul(Me, Ct) | 0, F = F + Math.imul(Me, gt) | 0, P = P + Math.imul(Pe, Nt) | 0, I = I + Math.imul(Pe, vt) | 0, I = I + Math.imul(De, Nt) | 0, F = F + Math.imul(De, vt) | 0, P = P + Math.imul(ie, Ft) | 0, I = I + Math.imul(ie, rt) | 0, I = I + Math.imul(ue, Ft) | 0, F = F + Math.imul(ue, rt) | 0, P = P + Math.imul(X, k) | 0, I = I + Math.imul(X, U) | 0, I = I + Math.imul(re, k) | 0, F = F + Math.imul(re, U) | 0, P = P + Math.imul(J, C) | 0, I = I + Math.imul(J, G) | 0, I = I + Math.imul(Q, C) | 0, F = F + Math.imul(Q, G) | 0, P = P + Math.imul(D, se) | 0, I = I + Math.imul(D, he) | 0, I = I + Math.imul(oe, se) | 0, F = F + Math.imul(oe, he) | 0; var _t = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, P = Math.imul(tt, lt), I = Math.imul(tt, ct), I = I + Math.imul(Ye, lt) | 0, F = Math.imul(Ye, ct), P = P + Math.imul(at, Yt) | 0, I = I + Math.imul(at, Et) | 0, I = I + Math.imul(ke, Yt) | 0, F = F + Math.imul(ke, Et) | 0, P = P + Math.imul(ze, Jt) | 0, I = I + Math.imul(ze, Dt) | 0, I = I + Math.imul(_e, Jt) | 0, F = F + Math.imul(_e, Dt) | 0, P = P + Math.imul(Ke, Ct) | 0, I = I + Math.imul(Ke, gt) | 0, I = I + Math.imul(Le, Ct) | 0, F = F + Math.imul(Le, gt) | 0, P = P + Math.imul($e, Nt) | 0, I = I + Math.imul($e, vt) | 0, I = I + Math.imul(Me, Nt) | 0, F = F + Math.imul(Me, vt) | 0, P = P + Math.imul(Pe, Ft) | 0, I = I + Math.imul(Pe, rt) | 0, I = I + Math.imul(De, Ft) | 0, F = F + Math.imul(De, rt) | 0, P = P + Math.imul(ie, k) | 0, I = I + Math.imul(ie, U) | 0, I = I + Math.imul(ue, k) | 0, F = F + Math.imul(ue, U) | 0, P = P + Math.imul(X, C) | 0, I = I + Math.imul(X, G) | 0, I = I + Math.imul(re, C) | 0, F = F + Math.imul(re, G) | 0, P = P + Math.imul(J, se) | 0, I = I + Math.imul(J, he) | 0, I = I + Math.imul(Q, se) | 0, F = F + Math.imul(Q, he) | 0, P = P + Math.imul(D, Te) | 0, I = I + Math.imul(D, Re) | 0, I = I + Math.imul(oe, Te) | 0, F = F + Math.imul(oe, Re) | 0; + v = (F + (I >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, P = Math.imul(tt, lt), I = Math.imul(tt, ct), I = I + Math.imul(Ye, lt) | 0, F = Math.imul(Ye, ct), P = P + Math.imul(at, Jt) | 0, I = I + Math.imul(at, Et) | 0, I = I + Math.imul(ke, Jt) | 0, F = F + Math.imul(ke, Et) | 0, P = P + Math.imul(ze, Xt) | 0, I = I + Math.imul(ze, Dt) | 0, I = I + Math.imul(_e, Xt) | 0, F = F + Math.imul(_e, Dt) | 0, P = P + Math.imul(Ke, Ct) | 0, I = I + Math.imul(Ke, gt) | 0, I = I + Math.imul(Le, Ct) | 0, F = F + Math.imul(Le, gt) | 0, P = P + Math.imul($e, Nt) | 0, I = I + Math.imul($e, vt) | 0, I = I + Math.imul(Me, Nt) | 0, F = F + Math.imul(Me, vt) | 0, P = P + Math.imul(Pe, Ft) | 0, I = I + Math.imul(Pe, rt) | 0, I = I + Math.imul(De, Ft) | 0, F = F + Math.imul(De, rt) | 0, P = P + Math.imul(ie, k) | 0, I = I + Math.imul(ie, U) | 0, I = I + Math.imul(ue, k) | 0, F = F + Math.imul(ue, U) | 0, P = P + Math.imul(X, C) | 0, I = I + Math.imul(X, G) | 0, I = I + Math.imul(re, C) | 0, F = F + Math.imul(re, G) | 0, P = P + Math.imul(J, se) | 0, I = I + Math.imul(J, he) | 0, I = I + Math.imul(Q, se) | 0, F = F + Math.imul(Q, he) | 0, P = P + Math.imul(D, Te) | 0, I = I + Math.imul(D, Re) | 0, I = I + Math.imul(oe, Te) | 0, F = F + Math.imul(oe, Re) | 0; var ht = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, P = Math.imul(tt, Yt), I = Math.imul(tt, Et), I = I + Math.imul(Ye, Yt) | 0, F = Math.imul(Ye, Et), P = P + Math.imul(at, Jt) | 0, I = I + Math.imul(at, Dt) | 0, I = I + Math.imul(ke, Jt) | 0, F = F + Math.imul(ke, Dt) | 0, P = P + Math.imul(ze, Ct) | 0, I = I + Math.imul(ze, gt) | 0, I = I + Math.imul(_e, Ct) | 0, F = F + Math.imul(_e, gt) | 0, P = P + Math.imul(Ke, Nt) | 0, I = I + Math.imul(Ke, vt) | 0, I = I + Math.imul(Le, Nt) | 0, F = F + Math.imul(Le, vt) | 0, P = P + Math.imul($e, Ft) | 0, I = I + Math.imul($e, rt) | 0, I = I + Math.imul(Me, Ft) | 0, F = F + Math.imul(Me, rt) | 0, P = P + Math.imul(Pe, k) | 0, I = I + Math.imul(Pe, U) | 0, I = I + Math.imul(De, k) | 0, F = F + Math.imul(De, U) | 0, P = P + Math.imul(ie, C) | 0, I = I + Math.imul(ie, G) | 0, I = I + Math.imul(ue, C) | 0, F = F + Math.imul(ue, G) | 0, P = P + Math.imul(X, se) | 0, I = I + Math.imul(X, he) | 0, I = I + Math.imul(re, se) | 0, F = F + Math.imul(re, he) | 0, P = P + Math.imul(J, Te) | 0, I = I + Math.imul(J, Re) | 0, I = I + Math.imul(Q, Te) | 0, F = F + Math.imul(Q, Re) | 0; + v = (F + (I >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, P = Math.imul(tt, Jt), I = Math.imul(tt, Et), I = I + Math.imul(Ye, Jt) | 0, F = Math.imul(Ye, Et), P = P + Math.imul(at, Xt) | 0, I = I + Math.imul(at, Dt) | 0, I = I + Math.imul(ke, Xt) | 0, F = F + Math.imul(ke, Dt) | 0, P = P + Math.imul(ze, Ct) | 0, I = I + Math.imul(ze, gt) | 0, I = I + Math.imul(_e, Ct) | 0, F = F + Math.imul(_e, gt) | 0, P = P + Math.imul(Ke, Nt) | 0, I = I + Math.imul(Ke, vt) | 0, I = I + Math.imul(Le, Nt) | 0, F = F + Math.imul(Le, vt) | 0, P = P + Math.imul($e, Ft) | 0, I = I + Math.imul($e, rt) | 0, I = I + Math.imul(Me, Ft) | 0, F = F + Math.imul(Me, rt) | 0, P = P + Math.imul(Pe, k) | 0, I = I + Math.imul(Pe, U) | 0, I = I + Math.imul(De, k) | 0, F = F + Math.imul(De, U) | 0, P = P + Math.imul(ie, C) | 0, I = I + Math.imul(ie, G) | 0, I = I + Math.imul(ue, C) | 0, F = F + Math.imul(ue, G) | 0, P = P + Math.imul(X, se) | 0, I = I + Math.imul(X, he) | 0, I = I + Math.imul(re, se) | 0, F = F + Math.imul(re, he) | 0, P = P + Math.imul(J, Te) | 0, I = I + Math.imul(J, Re) | 0, I = I + Math.imul(Q, Te) | 0, F = F + Math.imul(Q, Re) | 0; var xt = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, P = Math.imul(tt, Jt), I = Math.imul(tt, Dt), I = I + Math.imul(Ye, Jt) | 0, F = Math.imul(Ye, Dt), P = P + Math.imul(at, Ct) | 0, I = I + Math.imul(at, gt) | 0, I = I + Math.imul(ke, Ct) | 0, F = F + Math.imul(ke, gt) | 0, P = P + Math.imul(ze, Nt) | 0, I = I + Math.imul(ze, vt) | 0, I = I + Math.imul(_e, Nt) | 0, F = F + Math.imul(_e, vt) | 0, P = P + Math.imul(Ke, Ft) | 0, I = I + Math.imul(Ke, rt) | 0, I = I + Math.imul(Le, Ft) | 0, F = F + Math.imul(Le, rt) | 0, P = P + Math.imul($e, k) | 0, I = I + Math.imul($e, U) | 0, I = I + Math.imul(Me, k) | 0, F = F + Math.imul(Me, U) | 0, P = P + Math.imul(Pe, C) | 0, I = I + Math.imul(Pe, G) | 0, I = I + Math.imul(De, C) | 0, F = F + Math.imul(De, G) | 0, P = P + Math.imul(ie, se) | 0, I = I + Math.imul(ie, he) | 0, I = I + Math.imul(ue, se) | 0, F = F + Math.imul(ue, he) | 0, P = P + Math.imul(X, Te) | 0, I = I + Math.imul(X, Re) | 0, I = I + Math.imul(re, Te) | 0, F = F + Math.imul(re, Re) | 0; + v = (F + (I >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, P = Math.imul(tt, Xt), I = Math.imul(tt, Dt), I = I + Math.imul(Ye, Xt) | 0, F = Math.imul(Ye, Dt), P = P + Math.imul(at, Ct) | 0, I = I + Math.imul(at, gt) | 0, I = I + Math.imul(ke, Ct) | 0, F = F + Math.imul(ke, gt) | 0, P = P + Math.imul(ze, Nt) | 0, I = I + Math.imul(ze, vt) | 0, I = I + Math.imul(_e, Nt) | 0, F = F + Math.imul(_e, vt) | 0, P = P + Math.imul(Ke, Ft) | 0, I = I + Math.imul(Ke, rt) | 0, I = I + Math.imul(Le, Ft) | 0, F = F + Math.imul(Le, rt) | 0, P = P + Math.imul($e, k) | 0, I = I + Math.imul($e, U) | 0, I = I + Math.imul(Me, k) | 0, F = F + Math.imul(Me, U) | 0, P = P + Math.imul(Pe, C) | 0, I = I + Math.imul(Pe, G) | 0, I = I + Math.imul(De, C) | 0, F = F + Math.imul(De, G) | 0, P = P + Math.imul(ie, se) | 0, I = I + Math.imul(ie, he) | 0, I = I + Math.imul(ue, se) | 0, F = F + Math.imul(ue, he) | 0, P = P + Math.imul(X, Te) | 0, I = I + Math.imul(X, Re) | 0, I = I + Math.imul(re, Te) | 0, F = F + Math.imul(re, Re) | 0; var st = (v + P | 0) + ((I & 8191) << 13) | 0; v = (F + (I >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, P = Math.imul(tt, Ct), I = Math.imul(tt, gt), I = I + Math.imul(Ye, Ct) | 0, F = Math.imul(Ye, gt), P = P + Math.imul(at, Nt) | 0, I = I + Math.imul(at, vt) | 0, I = I + Math.imul(ke, Nt) | 0, F = F + Math.imul(ke, vt) | 0, P = P + Math.imul(ze, Ft) | 0, I = I + Math.imul(ze, rt) | 0, I = I + Math.imul(_e, Ft) | 0, F = F + Math.imul(_e, rt) | 0, P = P + Math.imul(Ke, k) | 0, I = I + Math.imul(Ke, U) | 0, I = I + Math.imul(Le, k) | 0, F = F + Math.imul(Le, U) | 0, P = P + Math.imul($e, C) | 0, I = I + Math.imul($e, G) | 0, I = I + Math.imul(Me, C) | 0, F = F + Math.imul(Me, G) | 0, P = P + Math.imul(Pe, se) | 0, I = I + Math.imul(Pe, he) | 0, I = I + Math.imul(De, se) | 0, F = F + Math.imul(De, he) | 0, P = P + Math.imul(ie, Te) | 0, I = I + Math.imul(ie, Re) | 0, I = I + Math.imul(ue, Te) | 0, F = F + Math.imul(ue, Re) | 0; var bt = (v + P | 0) + ((I & 8191) << 13) | 0; @@ -13589,7 +13589,7 @@ Xv.exports; return E !== 0 ? m.words[v] = E | 0 : m.length--, m.strip(); } var N = function(S, m, f) { - var g = S.words, b = m.words, x = f.words, _ = 0, E, v, P, I = g[0] | 0, F = I & 8191, ce = I >>> 13, D = g[1] | 0, oe = D & 8191, Z = D >>> 13, J = g[2] | 0, Q = J & 8191, T = J >>> 13, X = g[3] | 0, re = X & 8191, de = X >>> 13, ie = g[4] | 0, ue = ie & 8191, ve = ie >>> 13, Pe = g[5] | 0, De = Pe & 8191, Ce = Pe >>> 13, $e = g[6] | 0, Me = $e & 8191, Ne = $e >>> 13, Ke = g[7] | 0, Le = Ke & 8191, qe = Ke >>> 13, ze = g[8] | 0, _e = ze & 8191, Ze = ze >>> 13, at = g[9] | 0, ke = at & 8191, Qe = at >>> 13, tt = b[0] | 0, Ye = tt & 8191, dt = tt >>> 13, lt = b[1] | 0, ct = lt & 8191, qt = lt >>> 13, Yt = b[2] | 0, Et = Yt & 8191, er = Yt >>> 13, Jt = b[3] | 0, Dt = Jt & 8191, kt = Jt >>> 13, Ct = b[4] | 0, gt = Ct & 8191, Rt = Ct >>> 13, Nt = b[5] | 0, vt = Nt & 8191, $t = Nt >>> 13, Ft = b[6] | 0, rt = Ft & 8191, Bt = Ft >>> 13, k = b[7] | 0, U = k & 8191, z = k >>> 13, C = b[8] | 0, G = C & 8191, j = C >>> 13, se = b[9] | 0, he = se & 8191, xe = se >>> 13; + var g = S.words, b = m.words, x = f.words, _ = 0, E, v, P, I = g[0] | 0, F = I & 8191, ce = I >>> 13, D = g[1] | 0, oe = D & 8191, Z = D >>> 13, J = g[2] | 0, Q = J & 8191, T = J >>> 13, X = g[3] | 0, re = X & 8191, de = X >>> 13, ie = g[4] | 0, ue = ie & 8191, ve = ie >>> 13, Pe = g[5] | 0, De = Pe & 8191, Ce = Pe >>> 13, $e = g[6] | 0, Me = $e & 8191, Ne = $e >>> 13, Ke = g[7] | 0, Le = Ke & 8191, qe = Ke >>> 13, ze = g[8] | 0, _e = ze & 8191, Ze = ze >>> 13, at = g[9] | 0, ke = at & 8191, Qe = at >>> 13, tt = b[0] | 0, Ye = tt & 8191, dt = tt >>> 13, lt = b[1] | 0, ct = lt & 8191, qt = lt >>> 13, Jt = b[2] | 0, Et = Jt & 8191, er = Jt >>> 13, Xt = b[3] | 0, Dt = Xt & 8191, kt = Xt >>> 13, Ct = b[4] | 0, gt = Ct & 8191, Rt = Ct >>> 13, Nt = b[5] | 0, vt = Nt & 8191, $t = Nt >>> 13, Ft = b[6] | 0, rt = Ft & 8191, Bt = Ft >>> 13, k = b[7] | 0, U = k & 8191, z = k >>> 13, C = b[8] | 0, G = C & 8191, j = C >>> 13, se = b[9] | 0, he = se & 8191, xe = se >>> 13; f.negative = S.negative ^ m.negative, f.length = 19, E = Math.imul(F, Ye), v = Math.imul(F, dt), v = v + Math.imul(ce, Ye) | 0, P = Math.imul(ce, dt); var Te = (_ + E | 0) + ((v & 8191) << 13) | 0; _ = (P + (v >>> 13) | 0) + (Te >>> 26) | 0, Te &= 67108863, E = Math.imul(oe, Ye), v = Math.imul(oe, dt), v = v + Math.imul(Z, Ye) | 0, P = Math.imul(Z, dt), E = E + Math.imul(F, ct) | 0, v = v + Math.imul(F, qt) | 0, v = v + Math.imul(ce, ct) | 0, P = P + Math.imul(ce, qt) | 0; @@ -17744,7 +17744,7 @@ l0.exports; return ae ? "Symbol(src)_1." + ae : ""; }(), tt = _e.toString, Ye = RegExp( "^" + at.call(ke).replace(I, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" - ), dt = X ? J.Buffer : void 0, lt = J.Symbol, ct = J.Uint8Array, qt = _e.propertyIsEnumerable, Yt = qe.splice, Et = lt ? lt.toStringTag : void 0, er = Object.getOwnPropertySymbols, Jt = dt ? dt.isBuffer : void 0, Dt = Ke(Object.keys, Object), kt = yr(J, "DataView"), Ct = yr(J, "Map"), gt = yr(J, "Promise"), Rt = yr(J, "Set"), Nt = yr(J, "WeakMap"), vt = yr(Object, "create"), $t = io(kt), Ft = io(Ct), rt = io(gt), Bt = io(Rt), k = io(Nt), U = lt ? lt.prototype : void 0, z = U ? U.valueOf : void 0; + ), dt = X ? J.Buffer : void 0, lt = J.Symbol, ct = J.Uint8Array, qt = _e.propertyIsEnumerable, Jt = qe.splice, Et = lt ? lt.toStringTag : void 0, er = Object.getOwnPropertySymbols, Xt = dt ? dt.isBuffer : void 0, Dt = Ke(Object.keys, Object), kt = yr(J, "DataView"), Ct = yr(J, "Map"), gt = yr(J, "Promise"), Rt = yr(J, "Set"), Nt = yr(J, "WeakMap"), vt = yr(Object, "create"), $t = io(kt), Ft = io(Ct), rt = io(gt), Bt = io(Rt), k = io(Nt), U = lt ? lt.prototype : void 0, z = U ? U.valueOf : void 0; function C(ae) { var ye = -1, Ge = ae == null ? 0 : ae.length; for (this.clear(); ++ye < Ge; ) { @@ -17791,7 +17791,7 @@ l0.exports; if (Ge < 0) return !1; var Pt = ye.length - 1; - return Ge == Pt ? ye.pop() : Yt.call(ye, Ge, 1), --this.size, !0; + return Ge == Pt ? ye.pop() : Jt.call(ye, Ge, 1), --this.size, !0; } function je(ae) { var ye = this.__data__, Ge = Je(ye, ae); @@ -17897,7 +17897,7 @@ l0.exports; function zt(ae) { return ae == null ? ae === void 0 ? ge : B : Et && Et in Object(ae) ? $r(ae) : Rp(ae); } - function Xt(ae) { + function Zt(ae) { return Da(ae) && zt(ae) == a; } function Wt(ae, ye, Ge, Pt, jr) { @@ -17913,7 +17913,7 @@ l0.exports; Kr = !0, an = !1; } if (bn && !an) - return nr || (nr = new ut()), Kr || mh(ae) ? Zt(ae, ye, Ge, Pt, jr, nr) : gr(ae, ye, _r, Ge, Pt, jr, nr); + return nr || (nr = new ut()), Kr || mh(ae) ? Qt(ae, ye, Ge, Pt, jr, nr) : gr(ae, ye, _r, Ge, Pt, jr, nr); if (!(Ge & i)) { var Vr = an && ke.call(ae, "__wrapped__"), ti = ui && ke.call(ye, "__wrapped__"); if (Vr || ti) { @@ -17940,7 +17940,7 @@ l0.exports; ke.call(ae, Ge) && Ge != "constructor" && ye.push(Ge); return ye; } - function Zt(ae, ye, Ge, Pt, jr, nr) { + function Qt(ae, ye, Ge, Pt, jr, nr) { var Kr = Ge & i, vn = ae.length, _r = ye.length; if (vn != _r && !(Kr && _r > vn)) return !1; @@ -18000,7 +18000,7 @@ l0.exports; if (Ur) return Ur == ye; Pt |= s, Kr.set(ae, ye); - var an = Zt(vn(ae), vn(ye), Pt, jr, nr, Kr); + var an = Qt(vn(ae), vn(ye), Pt, jr, nr, Kr); return Kr.delete(ae), an; case K: if (z) @@ -18115,15 +18115,15 @@ l0.exports; function hh(ae, ye) { return ae === ye || ae !== ae && ye !== ye; } - var dh = Xt(/* @__PURE__ */ function() { + var dh = Zt(/* @__PURE__ */ function() { return arguments; - }()) ? Xt : function(ae) { + }()) ? Zt : function(ae) { return Da(ae) && ke.call(ae, "callee") && !qt.call(ae, "callee"); }, Mc = Array.isArray; function Dp(ae) { return ae != null && ph(ae.length) && !Ic(ae); } - var Xu = Jt || Dr; + var Xu = Xt || Dr; function Op(ae, ye) { return Wt(ae, ye); } @@ -21064,9 +21064,9 @@ h0.exports; ["partial", V], ["partialRight", te], ["rearg", K] - ], D = "[object Arguments]", oe = "[object Array]", Z = "[object AsyncFunction]", J = "[object Boolean]", Q = "[object Date]", T = "[object DOMException]", X = "[object Error]", re = "[object Function]", de = "[object GeneratorFunction]", ie = "[object Map]", ue = "[object Number]", ve = "[object Null]", Pe = "[object Object]", De = "[object Promise]", Ce = "[object Proxy]", $e = "[object RegExp]", Me = "[object Set]", Ne = "[object String]", Ke = "[object Symbol]", Le = "[object Undefined]", qe = "[object WeakMap]", ze = "[object WeakSet]", _e = "[object ArrayBuffer]", Ze = "[object DataView]", at = "[object Float32Array]", ke = "[object Float64Array]", Qe = "[object Int8Array]", tt = "[object Int16Array]", Ye = "[object Int32Array]", dt = "[object Uint8Array]", lt = "[object Uint8ClampedArray]", ct = "[object Uint16Array]", qt = "[object Uint32Array]", Yt = /\b__p \+= '';/g, Et = /\b(__p \+=) '' \+/g, er = /(__e\(.*?\)|\b__t\)) \+\n'';/g, Jt = /&(?:amp|lt|gt|quot|#39);/g, Dt = /[&<>"']/g, kt = RegExp(Jt.source), Ct = RegExp(Dt.source), gt = /<%-([\s\S]+?)%>/g, Rt = /<%([\s\S]+?)%>/g, Nt = /<%=([\s\S]+?)%>/g, vt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $t = /^\w*$/, Ft = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, rt = /[\\^$.*+?()[\]{}|]/g, Bt = RegExp(rt.source), k = /^\s+/, U = /\s/, z = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, C = /\{\n\/\* \[wrapped with (.+)\] \*/, G = /,? & /, j = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, se = /[()=,{}\[\]\/\s]/, he = /\\(\\)?/g, xe = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Te = /\w*$/, Re = /^[-+]0x[0-9a-f]+$/i, nt = /^0b[01]+$/i, je = /^\[object .+?Constructor\]$/, pt = /^0o[0-7]+$/i, it = /^(?:0|[1-9]\d*)$/, et = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, St = /($^)/, Tt = /['\n\r\u2028\u2029\\]/g, At = "\\ud800-\\udfff", _t = "\\u0300-\\u036f", ht = "\\ufe20-\\ufe2f", xt = "\\u20d0-\\u20ff", st = _t + ht + xt, bt = "\\u2700-\\u27bf", ut = "a-z\\xdf-\\xf6\\xf8-\\xff", ot = "\\xac\\xb1\\xd7\\xf7", Se = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Ae = "\\u2000-\\u206f", Ve = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Fe = "A-Z\\xc0-\\xd6\\xd8-\\xde", Ue = "\\ufe0e\\ufe0f", Je = ot + Se + Ae + Ve, Lt = "['’]", zt = "[" + At + "]", Xt = "[" + Je + "]", Wt = "[" + st + "]", le = "\\d+", rr = "[" + bt + "]", dr = "[" + ut + "]", pr = "[^" + At + Je + le + bt + ut + Fe + "]", Zt = "\\ud83c[\\udffb-\\udfff]", gr = "(?:" + Wt + "|" + Zt + ")", lr = "[^" + At + "]", Rr = "(?:\\ud83c[\\udde6-\\uddff]){2}", mr = "[\\ud800-\\udbff][\\udc00-\\udfff]", yr = "[" + Fe + "]", $r = "\\u200d", Br = "(?:" + dr + "|" + pr + ")", Ir = "(?:" + yr + "|" + pr + ")", nn = "(?:" + Lt + "(?:d|ll|m|re|s|t|ve))?", sn = "(?:" + Lt + "(?:D|LL|M|RE|S|T|VE))?", on = gr + "?", lh = "[" + Ue + "]?", Rp = "(?:" + $r + "(?:" + [lr, Rr, mr].join("|") + ")" + lh + on + ")*", io = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", hh = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", dh = lh + on + Rp, Mc = "(?:" + [rr, Rr, mr].join("|") + ")" + dh, Dp = "(?:" + [lr + Wt + "?", Wt, Rr, mr, zt].join("|") + ")", Xu = RegExp(Lt, "g"), Op = RegExp(Wt, "g"), Ic = RegExp(Zt + "(?=" + Zt + ")|" + Dp + dh, "g"), ph = RegExp([ - yr + "?" + dr + "+" + nn + "(?=" + [Xt, yr, "$"].join("|") + ")", - Ir + "+" + sn + "(?=" + [Xt, yr + Br, "$"].join("|") + ")", + ], D = "[object Arguments]", oe = "[object Array]", Z = "[object AsyncFunction]", J = "[object Boolean]", Q = "[object Date]", T = "[object DOMException]", X = "[object Error]", re = "[object Function]", de = "[object GeneratorFunction]", ie = "[object Map]", ue = "[object Number]", ve = "[object Null]", Pe = "[object Object]", De = "[object Promise]", Ce = "[object Proxy]", $e = "[object RegExp]", Me = "[object Set]", Ne = "[object String]", Ke = "[object Symbol]", Le = "[object Undefined]", qe = "[object WeakMap]", ze = "[object WeakSet]", _e = "[object ArrayBuffer]", Ze = "[object DataView]", at = "[object Float32Array]", ke = "[object Float64Array]", Qe = "[object Int8Array]", tt = "[object Int16Array]", Ye = "[object Int32Array]", dt = "[object Uint8Array]", lt = "[object Uint8ClampedArray]", ct = "[object Uint16Array]", qt = "[object Uint32Array]", Jt = /\b__p \+= '';/g, Et = /\b(__p \+=) '' \+/g, er = /(__e\(.*?\)|\b__t\)) \+\n'';/g, Xt = /&(?:amp|lt|gt|quot|#39);/g, Dt = /[&<>"']/g, kt = RegExp(Xt.source), Ct = RegExp(Dt.source), gt = /<%-([\s\S]+?)%>/g, Rt = /<%([\s\S]+?)%>/g, Nt = /<%=([\s\S]+?)%>/g, vt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $t = /^\w*$/, Ft = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, rt = /[\\^$.*+?()[\]{}|]/g, Bt = RegExp(rt.source), k = /^\s+/, U = /\s/, z = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, C = /\{\n\/\* \[wrapped with (.+)\] \*/, G = /,? & /, j = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, se = /[()=,{}\[\]\/\s]/, he = /\\(\\)?/g, xe = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Te = /\w*$/, Re = /^[-+]0x[0-9a-f]+$/i, nt = /^0b[01]+$/i, je = /^\[object .+?Constructor\]$/, pt = /^0o[0-7]+$/i, it = /^(?:0|[1-9]\d*)$/, et = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, St = /($^)/, Tt = /['\n\r\u2028\u2029\\]/g, At = "\\ud800-\\udfff", _t = "\\u0300-\\u036f", ht = "\\ufe20-\\ufe2f", xt = "\\u20d0-\\u20ff", st = _t + ht + xt, bt = "\\u2700-\\u27bf", ut = "a-z\\xdf-\\xf6\\xf8-\\xff", ot = "\\xac\\xb1\\xd7\\xf7", Se = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Ae = "\\u2000-\\u206f", Ve = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Fe = "A-Z\\xc0-\\xd6\\xd8-\\xde", Ue = "\\ufe0e\\ufe0f", Je = ot + Se + Ae + Ve, Lt = "['’]", zt = "[" + At + "]", Zt = "[" + Je + "]", Wt = "[" + st + "]", le = "\\d+", rr = "[" + bt + "]", dr = "[" + ut + "]", pr = "[^" + At + Je + le + bt + ut + Fe + "]", Qt = "\\ud83c[\\udffb-\\udfff]", gr = "(?:" + Wt + "|" + Qt + ")", lr = "[^" + At + "]", Rr = "(?:\\ud83c[\\udde6-\\uddff]){2}", mr = "[\\ud800-\\udbff][\\udc00-\\udfff]", yr = "[" + Fe + "]", $r = "\\u200d", Br = "(?:" + dr + "|" + pr + ")", Ir = "(?:" + yr + "|" + pr + ")", nn = "(?:" + Lt + "(?:d|ll|m|re|s|t|ve))?", sn = "(?:" + Lt + "(?:D|LL|M|RE|S|T|VE))?", on = gr + "?", lh = "[" + Ue + "]?", Rp = "(?:" + $r + "(?:" + [lr, Rr, mr].join("|") + ")" + lh + on + ")*", io = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", hh = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", dh = lh + on + Rp, Mc = "(?:" + [rr, Rr, mr].join("|") + ")" + dh, Dp = "(?:" + [lr + Wt + "?", Wt, Rr, mr, zt].join("|") + ")", Xu = RegExp(Lt, "g"), Op = RegExp(Wt, "g"), Ic = RegExp(Qt + "(?=" + Qt + ")|" + Dp + dh, "g"), ph = RegExp([ + yr + "?" + dr + "+" + nn + "(?=" + [Zt, yr, "$"].join("|") + ")", + Ir + "+" + sn + "(?=" + [Zt, yr + Br, "$"].join("|") + ")", yr + "?" + Br + "+" + nn, yr + "+" + sn, hh, @@ -24369,7 +24369,7 @@ __p += '`), Er && (Xe += `' + `; else if (se.test(Ht)) throw new tr(a); - Xe = (we ? Xe.replace(Yt, "") : Xe).replace(Et, "$1").replace(er, "$1;"), Xe = "function(" + (Ht || "obj") + `) { + Xe = (we ? Xe.replace(Jt, "") : Xe).replace(Et, "$1").replace(er, "$1;"), Xe = "function(" + (Ht || "obj") + `) { ` + (Ht ? "" : `obj || (obj = {}); `) + "var __t, __p = ''" + (me ? ", __e = _.escape" : "") + (we ? `, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } @@ -24447,7 +24447,7 @@ function print() { __p += __j.call(arguments, '') } return we + O; } function VT(c) { - return c = Cr(c), c && kt.test(c) ? c.replace(Jt, _A) : c; + return c = Cr(c), c && kt.test(c) ? c.replace(Xt, _A) : c; } var GT = Bc(function(c, h, y) { return c + (y ? " " : "") + h.toUpperCase(); @@ -25769,9 +25769,9 @@ class NG { return new as(new As(n, Ar("disableProviderPing"))); } } -var LG = Object.defineProperty, kG = Object.defineProperties, $G = Object.getOwnPropertyDescriptors, Q3 = Object.getOwnPropertySymbols, BG = Object.prototype.hasOwnProperty, FG = Object.prototype.propertyIsEnumerable, e6 = (t, e, r) => e in t ? LG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, hd = (t, e) => { - for (var r in e || (e = {})) BG.call(e, r) && e6(t, r, e[r]); - if (Q3) for (var r of Q3(e)) FG.call(e, r) && e6(t, r, e[r]); +var LG = Object.defineProperty, kG = Object.defineProperties, $G = Object.getOwnPropertyDescriptors, Q3 = Object.getOwnPropertySymbols, BG = Object.prototype.hasOwnProperty, FG = Object.prototype.propertyIsEnumerable, e_ = (t, e, r) => e in t ? LG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, hd = (t, e) => { + for (var r in e || (e = {})) BG.call(e, r) && e_(t, r, e[r]); + if (Q3) for (var r of Q3(e)) FG.call(e, r) && e_(t, r, e[r]); return t; }, xm = (t, e) => kG(t, $G(e)); let EE = class SE { @@ -26149,21 +26149,21 @@ function WG(t, { shouldIncludeStack: e = !1 } = {}) { const r = {}; if (t && typeof t == "object" && !Array.isArray(t) && L1(t, "code") && zG(t.code)) { const n = t; - r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, L1(n, "data") && (r.data = n.data)) : (r.message = pb(r.code), r.data = { originalError: t6(t) }); + r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, L1(n, "data") && (r.data = n.data)) : (r.message = pb(r.code), r.data = { originalError: t_(t) }); } else - r.code = fn.rpc.internal, r.message = r6(t, "message") ? t.message : AE, r.data = { originalError: t6(t) }; - return e && (r.stack = r6(t, "stack") ? t.stack : void 0), r; + r.code = fn.rpc.internal, r.message = r_(t, "message") ? t.message : AE, r.data = { originalError: t_(t) }; + return e && (r.stack = r_(t, "stack") ? t.stack : void 0), r; } function PE(t) { return t >= -32099 && t <= -32e3; } -function t6(t) { +function t_(t) { return t && typeof t == "object" && !Array.isArray(t) ? Object.assign({}, t) : t; } function L1(t, e) { return Object.prototype.hasOwnProperty.call(t, e); } -function r6(t, e) { +function r_(t, e) { return typeof t == "object" && t !== null && e in t && typeof t[e] == "string"; } const Sr = { @@ -26536,11 +26536,11 @@ function aY(t) { throw Sr.provider.unsupportedMethod(); } } -const n6 = "accounts", i6 = "activeChain", s6 = "availableChains", o6 = "walletCapabilities"; +const n_ = "accounts", i_ = "activeChain", s_ = "availableChains", o_ = "walletCapabilities"; class cY { constructor(e) { var r, n, i; - this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new nY(), this.storage = new eo("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(n6)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(i6) || { + this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new nY(), this.storage = new eo("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(n_)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(i_) || { id: (i = (n = e.metadata.appChainIds) === null || n === void 0 ? void 0 : n[0]) !== null && i !== void 0 ? i : 1 }, this.handshake = this.handshake.bind(this), this.request = this.request.bind(this), this.createRequestMessage = this.createRequestMessage.bind(this), this.decryptResponseMessage = this.decryptResponseMessage.bind(this); } @@ -26560,7 +26560,7 @@ class cY { if ("error" in u) throw u.error; const l = u.value; - this.accounts = l, this.storage.storeObject(n6, l), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", l); + this.accounts = l, this.storage.storeObject(n_, l), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", l); } async request(e) { var r; @@ -26578,7 +26578,7 @@ class cY { case "eth_chainId": return pa(this.chain.id); case "wallet_getCapabilities": - return this.storage.loadObject(o6); + return this.storage.loadObject(o_); case "wallet_switchEthereumChain": return this.handleSwitchChainRequest(e); case "eth_ecRecover": @@ -26664,15 +26664,15 @@ class cY { id: Number(d), rpcUrl: p })); - this.storage.storeObject(s6, l), this.updateChain(this.chain.id, l); + this.storage.storeObject(s_, l), this.updateChain(this.chain.id, l); } const u = (n = o.data) === null || n === void 0 ? void 0 : n.capabilities; - return u && this.storage.storeObject(o6, u), o; + return u && this.storage.storeObject(o_, u), o; } updateChain(e, r) { var n; - const i = r ?? this.storage.loadObject(s6), s = i == null ? void 0 : i.find((o) => o.id === e); - return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(i6, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(s.id))), !0) : !1; + const i = r ?? this.storage.loadObject(s_), s = i == null ? void 0 : i.find((o) => o.id === e); + return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(i_, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(s.id))), !0) : !1; } } const uY = /* @__PURE__ */ bv(UD), { keccak_256: fY } = uY; @@ -26762,7 +26762,7 @@ function HE(t) { function pu(t) { return Number.parseInt(/^\D+(\d+)$/.exec(t)[1], 10); } -function a6(t) { +function a_(t) { var e = /^\D+(\d+)x(\d+)$/.exec(t); return [Number.parseInt(e[1], 10), Number.parseInt(e[2], 10)]; } @@ -26826,11 +26826,11 @@ function qs(t, e) { const u = si.twosFromBigInt(n, 256); return si.bufferBEFromBigInt(u, 32); } else if (t.startsWith("ufixed")) { - if (r = a6(t), n = ec(e), n < 0) + if (r = a_(t), n = ec(e), n < 0) throw new Error("Supplied ufixed is negative"); return qs("uint256", n * BigInt(2) ** BigInt(r[1])); } else if (t.startsWith("fixed")) - return r = a6(t), qs("int256", ec(e) * BigInt(2) ** BigInt(r[1])); + return r = a_(t), qs("int256", ec(e) * BigInt(2) ** BigInt(r[1])); } throw new Error("Unsupported or invalid type: " + t); } @@ -27255,7 +27255,7 @@ class IY { e && (this.webSocket = null, e.onclose = null, e.onerror = null, e.onmessage = null, e.onopen = null); } } -const c6 = 1e4, CY = 6e4; +const c_ = 1e4, CY = 6e4; class TY { /** * Constructor @@ -27319,7 +27319,7 @@ class TY { case Po.CONNECTED: o = await this.handleConnected(), this.updateLastHeartbeat(), setInterval(() => { this.heartbeat(); - }, c6), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); + }, c_), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); break; case Po.CONNECTING: break; @@ -27445,7 +27445,7 @@ class TY { this.lastHeartbeatResponse = Date.now(); } heartbeat() { - if (Date.now() - this.lastHeartbeatResponse > c6 * 2) { + if (Date.now() - this.lastHeartbeatResponse > c_ * 2) { this.ws.disconnect(); return; } @@ -27498,7 +27498,7 @@ class RY { return this.callbacks.get(r) && this.callbacks.delete(r), e; } } -const u6 = "session:id", f6 = "session:secret", l6 = "session:linked"; +const u_ = "session:id", f_ = "session:secret", l_ = "session:linked"; class gu { constructor(e, r, n, i = !1) { this.storage = e, this.id = r, this.secret = n, this.key = _D(r4(`${r}, ${n} WalletLink`)), this._linked = !!i; @@ -27508,7 +27508,7 @@ class gu { return new gu(e, r, n).save(); } static load(e) { - const r = e.getItem(u6), n = e.getItem(l6), i = e.getItem(f6); + const r = e.getItem(u_), n = e.getItem(l_), i = e.getItem(f_); return r && i ? new gu(e, r, i, n === "1") : null; } get linked() { @@ -27518,10 +27518,10 @@ class gu { this._linked = e, this.persistLinked(); } save() { - return this.storage.setItem(u6, this.id), this.storage.setItem(f6, this.secret), this.persistLinked(), this; + return this.storage.setItem(u_, this.id), this.storage.setItem(f_, this.secret), this.persistLinked(), this; } persistLinked() { - this.storage.setItem(l6, this._linked ? "1" : "0"); + this.storage.setItem(l_, this._linked ? "1" : "0"); } } function DY() { @@ -27562,7 +27562,7 @@ function Gf() { for (var t, e, r = 0, n = ""; r < arguments.length; ) (t = arguments[r++]) && (e = XE(t)) && (n && (n += " "), n += e); return n; } -var up, Jr, ZE, tc, h6, QE, B1, eS, yb, F1, j1, Pl = {}, tS = [], kY = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, wb = Array.isArray; +var up, Jr, ZE, tc, h_, QE, B1, eS, yb, F1, j1, Pl = {}, tS = [], kY = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, wb = Array.isArray; function ga(t, e) { for (var r in e) t[r] = e[r]; return t; @@ -27601,8 +27601,8 @@ function rS(t) { return rS(t); } } -function d6(t) { - (!t.__d && (t.__d = !0) && tc.push(t) && !d0.__r++ || h6 !== Jr.debounceRendering) && ((h6 = Jr.debounceRendering) || QE)(d0); +function d_(t) { + (!t.__d && (t.__d = !0) && tc.push(t) && !d0.__r++ || h_ !== Jr.debounceRendering) && ((h_ = Jr.debounceRendering) || QE)(d0); } function d0() { var t, e, r, n, i, s, o, a; @@ -27647,15 +27647,15 @@ function BY(t, e, r, n) { } return -1; } -function p6(t, e, r) { +function p_(t, e, r) { e[0] === "-" ? t.setProperty(e, r ?? "") : t[e] = r == null ? "" : typeof r != "number" || kY.test(e) ? r : r + "px"; } function pd(t, e, r, n, i) { var s; e: if (e === "style") if (typeof r == "string") t.style.cssText = r; else { - if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || p6(t.style, e, ""); - if (r) for (e in r) n && r[e] === n[e] || p6(t.style, e, r[e]); + if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || p_(t.style, e, ""); + if (r) for (e in r) n && r[e] === n[e] || p_(t.style, e, r[e]); } else if (e[0] === "o" && e[1] === "n") s = e !== (e = e.replace(eS, "$1")), e = e.toLowerCase() in t || e === "onFocusOut" || e === "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = yb, t.addEventListener(e, s ? j1 : F1, s)) : t.removeEventListener(e, s ? j1 : F1, s); else { @@ -27668,7 +27668,7 @@ function pd(t, e, r, n, i) { typeof r == "function" || (r == null || r === !1 && e[4] !== "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && r == 1 ? "" : r)); } } -function g6(t) { +function g_(t) { return function(e) { if (this.l) { var r = this.l[e.type + t]; @@ -27794,19 +27794,19 @@ up = tS.slice, Jr = { __e: function(t, e, r, n) { throw t; } }, ZE = 0, Nd.prototype.setState = function(t, e) { var r; - r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = ga({}, this.state), typeof t == "function" && (t = t(ga({}, r), this.props)), t && ga(r, t), t != null && this.__v && (e && this._sb.push(e), d6(this)); + r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = ga({}, this.state), typeof t == "function" && (t = t(ga({}, r), this.props)), t && ga(r, t), t != null && this.__v && (e && this._sb.push(e), d_(this)); }, Nd.prototype.forceUpdate = function(t) { - this.__v && (this.__e = !0, t && this.__h.push(t), d6(this)); + this.__v && (this.__e = !0, t && this.__h.push(t), d_(this)); }, Nd.prototype.render = ih, tc = [], QE = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, B1 = function(t, e) { return t.__v.__b - e.__v.__b; -}, d0.__r = 0, eS = /(PointerCapture)$|Capture$/i, yb = 0, F1 = g6(!1), j1 = g6(!0); -var p0, pn, Mm, m6, q1 = 0, aS = [], yn = Jr, v6 = yn.__b, b6 = yn.__r, y6 = yn.diffed, w6 = yn.__c, x6 = yn.unmount, _6 = yn.__; +}, d0.__r = 0, eS = /(PointerCapture)$|Capture$/i, yb = 0, F1 = g_(!1), j1 = g_(!0); +var p0, pn, Mm, m_, q1 = 0, aS = [], yn = Jr, v_ = yn.__b, b_ = yn.__r, y_ = yn.diffed, w_ = yn.__c, x_ = yn.unmount, __ = yn.__; function cS(t, e) { yn.__h && yn.__h(pn, t, q1 || e), q1 = 0; var r = pn.__H || (pn.__H = { __: [], __h: [] }); return t >= r.__.length && r.__.push({}), r.__[t]; } -function E6(t) { +function E_(t) { return q1 = 1, UY(uS, t); } function UY(t, e, r) { @@ -27855,19 +27855,19 @@ function zY() { } } yn.__b = function(t) { - pn = null, v6 && v6(t); + pn = null, v_ && v_(t); }, yn.__ = function(t, e) { - t && e.__k && e.__k.__m && (t.__m = e.__k.__m), _6 && _6(t, e); + t && e.__k && e.__k.__m && (t.__m = e.__k.__m), __ && __(t, e); }, yn.__r = function(t) { - b6 && b6(t), p0 = 0; + b_ && b_(t), p0 = 0; var e = (pn = t.__c).__H; e && (Mm === pn ? (e.__h = [], pn.__h = [], e.__.forEach(function(r) { r.__N && (r.__ = r.__N), r.i = r.__N = void 0; })) : (e.__h.forEach(Ld), e.__h.forEach(z1), e.__h = [], p0 = 0)), Mm = pn; }, yn.diffed = function(t) { - y6 && y6(t); + y_ && y_(t); var e = t.__c; - e && e.__H && (e.__H.__h.length && (aS.push(e) !== 1 && m6 === yn.requestAnimationFrame || ((m6 = yn.requestAnimationFrame) || WY)(zY)), e.__H.__.forEach(function(r) { + e && e.__H && (e.__H.__h.length && (aS.push(e) !== 1 && m_ === yn.requestAnimationFrame || ((m_ = yn.requestAnimationFrame) || WY)(zY)), e.__H.__.forEach(function(r) { r.i && (r.__H = r.i), r.i = void 0; })), Mm = pn = null; }, yn.__c = function(t, e) { @@ -27881,9 +27881,9 @@ yn.__b = function(t) { i.__h && (i.__h = []); }), e = [], yn.__e(n, r.__v); } - }), w6 && w6(t, e); + }), w_ && w_(t, e); }, yn.unmount = function(t) { - x6 && x6(t); + x_ && x_(t); var e, r = t.__c; r && r.__H && (r.__H.__.forEach(function(n) { try { @@ -27893,12 +27893,12 @@ yn.__b = function(t) { } }), r.__H = void 0, e && yn.__e(e, r.__v)); }; -var S6 = typeof requestAnimationFrame == "function"; +var S_ = typeof requestAnimationFrame == "function"; function WY(t) { var e, r = function() { - clearTimeout(n), S6 && cancelAnimationFrame(e), setTimeout(t); + clearTimeout(n), S_ && cancelAnimationFrame(e), setTimeout(t); }, n = setTimeout(r, 100); - S6 && (e = requestAnimationFrame(r)); + S_ && (e = requestAnimationFrame(r)); } function Ld(t) { var e = pn, r = t.__c; @@ -27947,7 +27947,7 @@ const fS = (t) => Nr( Nr("style", null, KY), Nr("div", { class: "-cbwsdk-snackbar" }, t.children) ), JY = ({ autoExpand: t, message: e, menuItems: r }) => { - const [n, i] = E6(!0), [s, o] = E6(t ?? !1); + const [n, i] = E_(!0), [s, o] = E_(t ?? !1); qY(() => { const u = [ window.setTimeout(() => { @@ -28089,8 +28089,8 @@ const eJ = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: ) ) ); -}, tJ = "https://keys.coinbase.com/connect", A6 = "https://www.walletlink.org", rJ = "https://go.cb-w.com/walletlink"; -class P6 { +}, tJ = "https://keys.coinbase.com/connect", A_ = "https://www.walletlink.org", rJ = "https://go.cb-w.com/walletlink"; +class P_ { constructor() { this.attached = !1, this.redirectDialog = new QY(); } @@ -28154,7 +28154,7 @@ class Eo { session: e, linkAPIUrl: r, listener: this - }), i = this.isMobileWeb ? new P6() : new XY(); + }), i = this.isMobileWeb ? new P_() : new XY(); return n.connect(), { session: e, ui: i, connection: n }; } resetAndReload() { @@ -28242,7 +28242,7 @@ class Eo { } // copied from MobileRelay openCoinbaseWalletDeeplink(e) { - if (this.ui instanceof P6) + if (this.ui instanceof P_) switch (e) { case "requestEthereumAccounts": case "switchEthereumChain": @@ -28390,10 +28390,10 @@ class Eo { } } Eo.accountRequestCallbackIds = /* @__PURE__ */ new Set(); -const M6 = "DefaultChainId", I6 = "DefaultJsonRpcUrl"; +const M_ = "DefaultChainId", I_ = "DefaultJsonRpcUrl"; class lS { constructor(e) { - this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new eo("walletlink", A6), this.callback = e.callback || null; + this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new eo("walletlink", A_), this.callback = e.callback || null; const r = this._storage.getItem($1); if (r) { const n = r.split(" "); @@ -28413,16 +28413,16 @@ class lS { } get jsonRpcUrl() { var e; - return (e = this._storage.getItem(I6)) !== null && e !== void 0 ? e : void 0; + return (e = this._storage.getItem(I_)) !== null && e !== void 0 ? e : void 0; } set jsonRpcUrl(e) { - this._storage.setItem(I6, e); + this._storage.setItem(I_, e); } updateProviderInfo(e, r) { var n; this.jsonRpcUrl = e; const i = this.getChainId(); - this._storage.setItem(M6, r.toString(10)), Kf(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(r))); + this._storage.setItem(M_, r.toString(10)), Kf(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(r))); } async watchAsset(e) { const r = Array.isArray(e) ? e[0] : e; @@ -28556,7 +28556,7 @@ class lS { } getChainId() { var e; - return Number.parseInt((e = this._storage.getItem(M6)) !== null && e !== void 0 ? e : "1", 10); + return Number.parseInt((e = this._storage.getItem(M_)) !== null && e !== void 0 ? e : "1", 10); } async _eth_requestAccounts() { var e, r; @@ -28636,7 +28636,7 @@ class lS { } initializeRelay() { return this._relay || (this._relay = new Eo({ - linkAPIUrl: A6, + linkAPIUrl: A_, storage: this._storage, metadata: this.metadata, accountsCallback: this._setAddresses.bind(this), @@ -28716,11 +28716,11 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene } } }; -}, { checkCrossOriginOpenerPolicy: fJ, getCrossOriginOpenerPolicy: lJ } = uJ(), C6 = 420, T6 = 540; +}, { checkCrossOriginOpenerPolicy: fJ, getCrossOriginOpenerPolicy: lJ } = uJ(), C_ = 420, T_ = 540; function hJ(t) { - const e = (window.innerWidth - C6) / 2 + window.screenX, r = (window.innerHeight - T6) / 2 + window.screenY; + const e = (window.innerWidth - C_) / 2 + window.screenX, r = (window.innerHeight - T_) / 2 + window.screenY; pJ(t); - const n = window.open(t, "Smart Wallet", `width=${C6}, height=${T6}, left=${e}, top=${r}`); + const n = window.open(t, "Smart Wallet", `width=${C_}, height=${T_}, left=${e}, top=${r}`); if (n == null || n.focus(), !n) throw Sr.rpc.internal("Pop up window failed to open"); return n; @@ -29119,7 +29119,7 @@ const WJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { function(r, n, i) { return n.toUpperCase() + i; } -), R6 = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), tX = Ps("RegExp"), wS = (t, e) => { +), R_ = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), tX = Ps("RegExp"), wS = (t, e) => { const r = Object.getOwnPropertyDescriptors(t), n = {}; sh(r, (i, s) => { let o; @@ -29148,10 +29148,10 @@ const WJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { }; return Wu(t) ? n(t) : n(String(t).split(e)), r; }, iX = () => { -}, sX = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, Im = "abcdefghijklmnopqrstuvwxyz", D6 = "0123456789", xS = { - DIGIT: D6, +}, sX = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, Im = "abcdefghijklmnopqrstuvwxyz", D_ = "0123456789", xS = { + DIGIT: D_, ALPHA: Im, - ALPHA_DIGIT: Im + Im.toUpperCase() + D6 + ALPHA_DIGIT: Im + Im.toUpperCase() + D_ }, oX = (t = 16, e = xS.ALPHA_DIGIT) => { let r = ""; const { length: n } = e; @@ -29225,8 +29225,8 @@ const cX = (t) => { forEachEntry: XJ, matchAll: ZJ, isHTMLForm: QJ, - hasOwnProperty: R6, - hasOwnProp: R6, + hasOwnProperty: R_, + hasOwnProp: R_, // an alias to avoid ESLint no-prototype-builtins detection reduceDescriptors: wS, freezeMethods: rX, @@ -29303,7 +29303,7 @@ function H1(t) { function AS(t) { return Oe.endsWith(t, "[]") ? t.slice(0, -2) : t; } -function O6(t, e, r) { +function O_(t, e, r) { return t ? t.concat(e).map(function(i, s) { return i = AS(i), !r && s ? "[" + i + "]" : i; }).join(r ? "." : "") : e; @@ -29344,12 +29344,12 @@ function dp(t, e, r) { return N = AS(N), B.forEach(function(H, W) { !(Oe.isUndefined(H) || H === null) && e.append( // eslint-disable-next-line no-nested-ternary - o === !0 ? O6([N], W, s) : o === null ? N : N + "[]", + o === !0 ? O_([N], W, s) : o === null ? N : N + "[]", l(H) ); }), !1; } - return H1(M) ? !0 : (e.append(O6(L, N, s), l(M)), !1); + return H1(M) ? !0 : (e.append(O_(L, N, s), l(M)), !1); } const p = [], w = Object.assign(pX, { defaultVisitor: d, @@ -29375,7 +29375,7 @@ function dp(t, e, r) { throw new TypeError("data must be an object"); return A(t), e; } -function N6(t) { +function N_(t) { const e = { "!": "%21", "'": "%27", @@ -29398,8 +29398,8 @@ PS.append = function(e, r) { }; PS.toString = function(e) { const r = e ? function(n) { - return e.call(this, n, N6); - } : N6; + return e.call(this, n, N_); + } : N_; return this._pairs.map(function(i) { return r(i[0]) + "=" + r(i[1]); }, "").join("&"); @@ -29422,7 +29422,7 @@ function MS(t, e, r) { } return t; } -class L6 { +class L_ { constructor() { this.handlers = []; } @@ -29638,7 +29638,7 @@ const IX = Oe.toObjectSet([ `).forEach(function(o) { i = o.indexOf(":"), r = o.substring(0, i).trim().toLowerCase(), n = o.substring(i + 1).trim(), !(!r || e[r] && IX[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n); }), e; -}, k6 = Symbol("internals"); +}, k_ = Symbol("internals"); function Df(t) { return t && String(t).trim().toLowerCase(); } @@ -29785,7 +29785,7 @@ let yi = class { return r.forEach((i) => n.set(i)), n; } static accessor(e) { - const n = (this[k6] = this[k6] = { + const n = (this[k_] = this[k_] = { accessors: {} }).accessors, i = this.prototype; function s(o) { @@ -29883,14 +29883,14 @@ const g0 = (t, e, r = 3) => { }; t(p); }, r); -}, $6 = (t, e) => { +}, $_ = (t, e) => { const r = t != null; return [(n) => e[0]({ lengthComputable: r, total: t, loaded: n }), e[1]]; -}, B6 = (t) => (...e) => Oe.asap(() => t(...e)), $X = Jn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Jn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( +}, B_ = (t) => (...e) => Oe.asap(() => t(...e)), $X = Jn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Jn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( new URL(Jn.origin), Jn.navigator && /(msie|trident)/i.test(Jn.navigator.userAgent) ) : () => !0, BX = Jn.hasStandardBrowserEnv ? ( @@ -29929,7 +29929,7 @@ function jX(t, e) { function DS(t, e) { return t && !FX(e) ? jX(t, e) : e; } -const F6 = (t) => t instanceof yi ? { ...t } : t; +const F_ = (t) => t instanceof yi ? { ...t } : t; function gc(t, e) { e = e || {}; const r = {}; @@ -29987,7 +29987,7 @@ function gc(t, e) { socketPath: o, responseEncoding: o, validateStatus: a, - headers: (l, d, p) => i(F6(l), F6(d), p, !0) + headers: (l, d, p) => i(F_(l), F_(d), p, !0) }; return Oe.forEach(Object.keys(Object.assign({}, t, e)), function(d) { const p = u[d] || i, w = p(t[d], e[d], d); @@ -30123,7 +30123,7 @@ const OS = (t) => { } finally { await e.cancel(); } -}, j6 = (t, e, r, n) => { +}, j_ = (t, e, r, n) => { const i = HX(t, e); let s = 0, o, a = (u) => { o || (o = !0, n && n(u)); @@ -30168,7 +30168,7 @@ const OS = (t) => { } }).headers.has("Content-Type"); return t && !e; -}), U6 = 64 * 1024, V1 = NS && LS(() => Oe.isReadableStream(new Response("").body)), m0 = { +}), U_ = 64 * 1024, V1 = NS && LS(() => Oe.isReadableStream(new Response("").body)), m0 = { stream: V1 && ((t) => t.body) }; pp && ((t) => { @@ -30224,11 +30224,11 @@ const YX = async (t) => { duplex: "half" }), te; if (Oe.isFormData(n) && (te = V.headers.get("content-type")) && d.setContentType(te), V.body) { - const [R, K] = $6( + const [R, K] = $_( L, - g0(B6(u)) + g0(B_(u)) ); - n = j6(V.body, U6, R, K); + n = j_(V.body, U_, R, K); } } Oe.isString(p) || (p = p ? "include" : "omit"); @@ -30249,12 +30249,12 @@ const YX = async (t) => { ["status", "statusText", "headers"].forEach((ge) => { V[ge] = $[ge]; }); - const te = Oe.toFiniteNumber($.headers.get("content-length")), [R, K] = a && $6( + const te = Oe.toFiniteNumber($.headers.get("content-length")), [R, K] = a && $_( te, - g0(B6(a), !0) + g0(B_(a), !0) ) || []; $ = new Response( - j6($.body, U6, R, () => { + j_($.body, U_, R, () => { K && K(), N && N(); }), V @@ -30294,7 +30294,7 @@ Oe.forEach(G1, (t, e) => { Object.defineProperty(t, "adapterName", { value: e }); } }); -const q6 = (t) => `- ${t}`, ZX = (t) => Oe.isFunction(t) || t === null || t === !1, kS = { +const q_ = (t) => `- ${t}`, ZX = (t) => Oe.isFunction(t) || t === null || t === !1, kS = { getAdapter: (t) => { t = Oe.isArray(t) ? t : [t]; const { length: e } = t; @@ -30314,8 +30314,8 @@ const q6 = (t) => `- ${t}`, ZX = (t) => Oe.isFunction(t) || t === null || t === ([a, u]) => `adapter ${a} ` + (u === !1 ? "is not supported by the environment" : "is not available in the build") ); let o = e ? s.length > 1 ? `since : -` + s.map(q6).join(` -`) : " " + q6(s[0]) : "as no adapter specified"; +` + s.map(q_).join(` +`) : " " + q_(s[0]) : "as no adapter specified"; throw new or( "There is no suitable adapter to dispatch the request " + o, "ERR_NOT_SUPPORT" @@ -30329,7 +30329,7 @@ function Rm(t) { if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted) throw new Hu(null, t); } -function z6(t) { +function z_(t) { return Rm(t), t.headers = yi.from(t.headers), t.data = Tm.call( t, t.transformRequest @@ -30353,7 +30353,7 @@ const $S = "1.7.8", gp = {}; return typeof n === t || "a" + (e < 1 ? "n " : " ") + t; }; }); -const W6 = {}; +const W_ = {}; gp.transitional = function(e, r, n) { function i(s, o) { return "[Axios v" + $S + "] Transitional option '" + s + "'" + o + (n ? ". " + n : ""); @@ -30364,7 +30364,7 @@ gp.transitional = function(e, r, n) { i(o, " has been removed" + (r ? " in " + r : "")), or.ERR_DEPRECATED ); - return r && !W6[o] && (W6[o] = !0, console.warn( + return r && !W_[o] && (W_[o] = !0, console.warn( i( o, " has been deprecated since v" + r + " and will be removed in the near future" @@ -30399,8 +30399,8 @@ const Bd = { let ac = class { constructor(e) { this.defaults = e, this.interceptors = { - request: new L6(), - response: new L6() + request: new L_(), + response: new L_() }; } /** @@ -30465,7 +30465,7 @@ let ac = class { }); let d, p = 0, w; if (!u) { - const M = [z6.bind(this), void 0]; + const M = [z_.bind(this), void 0]; for (M.unshift.apply(M, a), M.push.apply(M, l), w = M.length, d = Promise.resolve(r); p < w; ) d = d.then(M[p++], M[p++]); return d; @@ -30482,7 +30482,7 @@ let ac = class { } } try { - d = z6.call(this, A); + d = z_.call(this, A); } catch (M) { return Promise.reject(M); } @@ -30776,7 +30776,7 @@ class sZ { return (await this.request.post(`${this._apiBase}/api/v2/user/login`, e)).data; } async walletLogin(e) { - return (await this.request.post(`${this._apiBase}/api/v2/user/login`, e)).data; + return e.account_enum === "C" ? (await this.request.post(`${this._apiBase}/api/v2/user/login`, e)).data : (await this.request.post(`${this._apiBase}/api/v2/business/login`, e)).data; } async tonLogin(e) { return (await this.request.post(`${this._apiBase}/api/v2/user/login`, e)).data; @@ -30814,7 +30814,7 @@ function mp() { return Tn(qS); } function boe(t) { - const { apiBaseUrl: e } = t, [r, n] = Qt([]), [i, s] = Qt([]), [o, a] = Qt(null), [u, l] = Qt(!1), d = (A) => { + const { apiBaseUrl: e } = t, [r, n] = Yt([]), [i, s] = Yt([]), [o, a] = Yt(null), [u, l] = Yt(!1), d = (A) => { console.log("saveLastUsedWallet", A); }; function p(A) { @@ -31069,9 +31069,9 @@ const bZ = us("UserRoundCheck", [ ["path", { d: "M2 21a8 8 0 0 1 13.292-6", key: "bjp14o" }], ["circle", { cx: "10", cy: "8", r: "5", key: "o932ke" }], ["path", { d: "m16 19 2 2 4-4", key: "1b14m6" }] -]), H6 = /* @__PURE__ */ new Set(); +]), H_ = /* @__PURE__ */ new Set(); function vp(t, e, r) { - t || H6.has(e) || (console.warn(e), H6.add(e)); + t || H_.has(e) || (console.warn(e), H_.add(e)); } function yZ(t) { if (typeof Proxy > "u") @@ -31104,7 +31104,7 @@ function VS(t, e) { function Il(t) { return typeof t == "string" || Array.isArray(t); } -function K6(t) { +function K_(t) { const e = [{}, {}]; return t == null || t.values.forEach((r, n) => { e[0][n] = r.get(), e[1][n] = r.getVelocity(); @@ -31112,11 +31112,11 @@ function K6(t) { } function Mb(t, e, r, n) { if (typeof e == "function") { - const [i, s] = K6(n); + const [i, s] = K_(n); e = e(r !== void 0 ? r : t.custom, i, s); } if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") { - const [i, s] = K6(n); + const [i, s] = K_(n); e = e(r !== void 0 ? r : t.custom, i, s); } return e; @@ -31315,7 +31315,7 @@ const xa = (t, e, r) => r > e ? e : r < t ? t : r, Vu = { test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1, parse: parseFloat, transform: (e) => `${e}${t}` -}), oa = /* @__PURE__ */ uh("deg"), Gs = /* @__PURE__ */ uh("%"), Vt = /* @__PURE__ */ uh("px"), BZ = /* @__PURE__ */ uh("vh"), FZ = /* @__PURE__ */ uh("vw"), V6 = { +}), oa = /* @__PURE__ */ uh("deg"), Gs = /* @__PURE__ */ uh("%"), Vt = /* @__PURE__ */ uh("px"), BZ = /* @__PURE__ */ uh("vh"), FZ = /* @__PURE__ */ uh("vw"), V_ = { ...Gs, parse: (t) => Gs.parse(t) / 100, transform: (t) => Gs.transform(t * 100) @@ -31330,15 +31330,15 @@ const xa = (t, e, r) => r > e ? e : r < t ? t : r, Vu = { "y", "translateX", "translateY" -]), G6 = (t) => t === Vu || t === Vt, Y6 = (t, e) => parseFloat(t.split(", ")[e]), J6 = (t, e) => (r, { transform: n }) => { +]), G_ = (t) => t === Vu || t === Vt, Y_ = (t, e) => parseFloat(t.split(", ")[e]), J_ = (t, e) => (r, { transform: n }) => { if (n === "none" || !n) return 0; const i = n.match(/^matrix3d\((.+)\)$/u); if (i) - return Y6(i[1], e); + return Y_(i[1], e); { const s = n.match(/^matrix\((.+)\)$/u); - return s ? Y6(s[1], t) : 0; + return s ? Y_(s[1], t) : 0; } }, UZ = /* @__PURE__ */ new Set(["x", "y", "z"]), qZ = ah.filter((t) => !UZ.has(t)); function zZ(t) { @@ -31357,15 +31357,15 @@ const Mu = { bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min), right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min), // Transform - x: J6(4, 13), - y: J6(5, 14) + x: J_(4, 13), + y: J_(5, 14) }; Mu.translateX = Mu.x; Mu.translateY = Mu.y; const c7 = (t) => (e) => e.test(t), WZ = { test: (t) => t === "auto", parse: (t) => t -}, u7 = [Vu, Vt, Gs, oa, FZ, BZ, WZ], X6 = (t) => u7.find(c7(t)), cc = /* @__PURE__ */ new Set(); +}, u7 = [Vu, Vt, Gs, oa, FZ, BZ, WZ], X_ = (t) => u7.find(c7(t)), cc = /* @__PURE__ */ new Set(); let X1 = !1, Z1 = !1; function f7() { if (Z1) { @@ -31483,7 +31483,7 @@ function XZ(t) { var e, r; return isNaN(t) && typeof t == "string" && (((e = t.match(Lb)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match(JZ)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; } -const d7 = "number", p7 = "color", ZZ = "var", QZ = "var(", Z6 = "${}", eQ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; +const d7 = "number", p7 = "color", ZZ = "var", QZ = "var(", Z_ = "${}", eQ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; function Tl(t) { const e = t.toString(), r = [], n = { color: [], @@ -31491,7 +31491,7 @@ function Tl(t) { var: [] }, i = []; let s = 0; - const a = e.replace(eQ, (u) => (Yn.test(u) ? (n.color.push(s), i.push(p7), r.push(Yn.parse(u))) : u.startsWith(QZ) ? (n.var.push(s), i.push(ZZ), r.push(u)) : (n.number.push(s), i.push(d7), r.push(parseFloat(u))), ++s, Z6)).split(Z6); + const a = e.replace(eQ, (u) => (Yn.test(u) ? (n.color.push(s), i.push(p7), r.push(Yn.parse(u))) : u.startsWith(QZ) ? (n.var.push(s), i.push(ZZ), r.push(u)) : (n.number.push(s), i.push(d7), r.push(parseFloat(u))), ++s, Z_)).split(Z_); return { values: r, split: a, indexes: n, types: i }; } function g7(t) { @@ -31595,21 +31595,21 @@ const sQ = /\b([a-z-]*)\(.*?\)/gu, ev = { perspective: Vt, transformPerspective: Vt, opacity: Cl, - originX: V6, - originY: V6, + originX: V_, + originY: V_, originZ: Vt -}, Q6 = { +}, Q_ = { ...Vu, transform: Math.round }, $b = { ...oQ, ...aQ, - zIndex: Q6, + zIndex: Q_, size: Vt, // SVG fillOpacity: Cl, strokeOpacity: Cl, - numOctaves: Q6 + numOctaves: Q_ }, cQ = { ...$b, // Color props @@ -31660,9 +31660,9 @@ class b7 extends Nb { } if (this.resolveNoneKeyframes(), !jZ.has(n) || e.length !== 2) return; - const [i, s] = e, o = X6(i), a = X6(s); + const [i, s] = e, o = X_(i), a = X_(s); if (o !== a) - if (G6(o) && G6(a)) + if (G_(o) && G_(a)) for (let u = 0; u < e.length; u++) { const l = e[u]; typeof l == "string" && (e[u] = parseFloat(l)); @@ -31709,7 +31709,7 @@ const Ys = { set: (t) => { Fd = t, queueMicrotask(lQ); } -}, e_ = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string +}, e6 = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string (_a.test(t) || t === "0") && // And it contains numbers and/or colors !t.startsWith("url(")); function hQ(t) { @@ -31726,7 +31726,7 @@ function dQ(t, e, r, n) { return !1; if (e === "display" || e === "visibility") return !0; - const s = t[t.length - 1], o = e_(i, e), a = e_(s, e); + const s = t[t.length - 1], o = e6(i, e), a = e6(s, e); return Ku(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : hQ(t) || (r === "spring" || Fb(r)) && n; } const pQ = 40; @@ -31812,12 +31812,12 @@ function x7(t, e, r) { const n = Math.max(e - gQ, 0); return w7(r - t(n), e - n); } -const Nm = 1e-3, mQ = 0.01, t_ = 10, vQ = 0.05, bQ = 1; +const Nm = 1e-3, mQ = 0.01, t6 = 10, vQ = 0.05, bQ = 1; function yQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }) { let i, s; - Ku(t <= Vs(t_), "Spring duration must be 10 seconds or less"); + Ku(t <= Vs(t6), "Spring duration must be 10 seconds or less"); let o = 1 - e; - o = xa(vQ, bQ, o), t = xa(mQ, t_, To(t)), o < 1 ? (i = (l) => { + o = xa(vQ, bQ, o), t = xa(mQ, t6, To(t)), o < 1 ? (i = (l) => { const d = l * o, p = d * t, w = d - r, A = tv(l, o), M = Math.exp(-p); return Nm - w / A * M; }, s = (l) => { @@ -31857,7 +31857,7 @@ function tv(t, e) { return t * Math.sqrt(1 - e * e); } const _Q = ["duration", "bounce"], EQ = ["stiffness", "damping", "mass"]; -function r_(t, e) { +function r6(t, e) { return e.some((r) => t[r] !== void 0); } function SQ(t) { @@ -31869,7 +31869,7 @@ function SQ(t) { isResolvedFromDuration: !1, ...t }; - if (!r_(t, EQ) && r_(t, _Q)) { + if (!r6(t, EQ) && r6(t, _Q)) { const r = yQ(t); e = { ...e, @@ -31917,7 +31917,7 @@ function _7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { } }; } -function n_({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: u, restDelta: l = 0.5, restSpeed: d }) { +function n6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: u, restDelta: l = 0.5, restSpeed: d }) { const p = t[0], w = { done: !1, value: p @@ -31949,7 +31949,7 @@ function n_({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 3 } }; } -const AQ = /* @__PURE__ */ ch(0.42, 0, 1, 1), PQ = /* @__PURE__ */ ch(0, 0, 0.58, 1), E7 = /* @__PURE__ */ ch(0.42, 0, 0.58, 1), MQ = (t) => Array.isArray(t) && typeof t[0] != "number", jb = (t) => Array.isArray(t) && typeof t[0] == "number", i_ = { +const AQ = /* @__PURE__ */ ch(0.42, 0, 1, 1), PQ = /* @__PURE__ */ ch(0, 0, 0.58, 1), E7 = /* @__PURE__ */ ch(0.42, 0, 0.58, 1), MQ = (t) => Array.isArray(t) && typeof t[0] != "number", jb = (t) => Array.isArray(t) && typeof t[0] == "number", i6 = { linear: Un, easeIn: AQ, easeInOut: E7, @@ -31961,13 +31961,13 @@ const AQ = /* @__PURE__ */ ch(0.42, 0, 1, 1), PQ = /* @__PURE__ */ ch(0, 0, 0.58 backInOut: QS, backOut: ZS, anticipate: e7 -}, s_ = (t) => { +}, s6 = (t) => { if (jb(t)) { Uo(t.length === 4, "Cubic bezier arrays must contain four numerical values."); const [e, r, n, i] = t; return ch(e, r, n, i); } else if (typeof t == "string") - return Uo(i_[t] !== void 0, `Invalid easing type '${t}'`), i_[t]; + return Uo(i6[t] !== void 0, `Invalid easing type '${t}'`), i6[t]; return t; }, IQ = (t, e) => (r) => e(t(r)), Ro = (...t) => t.reduce(IQ), Iu = (t, e, r) => { const n = e - t; @@ -31999,15 +31999,15 @@ const km = (t, e, r) => { const n = t * t, i = r * (e * e - n) + n; return i < 0 ? 0 : Math.sqrt(i); }, TQ = [Q1, sc, eu], RQ = (t) => TQ.find((e) => e.test(t)); -function o_(t) { +function o6(t) { const e = RQ(t); if (Ku(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e) return !1; let r = e.parse(t); return e === eu && (r = CQ(r)), r; } -const a_ = (t, e) => { - const r = o_(t), n = o_(e); +const a6 = (t, e) => { + const r = o6(t), n = o6(e); if (!r || !n) return v0(t, e); const i = { ...r }; @@ -32020,7 +32020,7 @@ function OQ(t, e) { return (r) => Qr(t, e, r); } function Ub(t) { - return typeof t == "number" ? OQ : typeof t == "string" ? Ob(t) ? v0 : Yn.test(t) ? a_ : kQ : Array.isArray(t) ? S7 : typeof t == "object" ? Yn.test(t) ? a_ : NQ : v0; + return typeof t == "number" ? OQ : typeof t == "string" ? Ob(t) ? v0 : Yn.test(t) ? a6 : kQ : Array.isArray(t) ? S7 : typeof t == "object" ? Yn.test(t) ? a6 : NQ : v0; } function S7(t, e) { const r = [...t], n = r.length, i = t.map((s, o) => Ub(s)(s, e[o])); @@ -32103,7 +32103,7 @@ function qQ(t, e) { return t.map(() => e || E7).splice(0, t.length - 1); } function b0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" }) { - const i = MQ(n) ? n.map(s_) : s_(n), s = { + const i = MQ(n) ? n.map(s6) : s6(n), s = { done: !1, value: e[0] }, o = UQ( @@ -32119,14 +32119,14 @@ function b0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" } next: (u) => (s.value = a(u), s.done = u >= t, s) }; } -const c_ = 2e4; +const c6 = 2e4; function zQ(t) { let e = 0; const r = 50; let n = t.next(e); - for (; !n.done && e < c_; ) + for (; !n.done && e < c6; ) e += r, n = t.next(e); - return e >= c_ ? 1 / 0 : e; + return e >= c6 ? 1 / 0 : e; } const WQ = (t) => { const e = ({ timestamp: r }) => t(r); @@ -32140,8 +32140,8 @@ const WQ = (t) => { now: () => Fn.isProcessing ? Fn.timestamp : Ys.now() }; }, HQ = { - decay: n_, - inertia: n_, + decay: n6, + inertia: n6, tween: b0, keyframes: b0, spring: _7 @@ -32337,7 +32337,7 @@ function ZQ(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatTyp direction: o === "reverse" ? "alternate" : "normal" }); } -function u_(t, e) { +function u6(t, e) { t.timeline = e, t.onfinish = null; } const QQ = /* @__PURE__ */ zb(() => Object.hasOwnProperty.call(Element.prototype, "animate")), w0 = 10, eee = 2e4; @@ -32372,7 +32372,7 @@ const I7 = { function nee(t) { return t in I7; } -class f_ extends y7 { +class f6 extends y7 { constructor(e) { super(e); const { name: r, motionValue: n, element: i, keyframes: s } = this.options; @@ -32388,7 +32388,7 @@ class f_ extends y7 { e = B.keyframes, e.length === 1 && (e[1] = e[0]), i = B.duration, s = B.times, o = B.ease, a = "keyframes"; } const p = ZQ(u.owner.current, l, e, { ...this.options, duration: i, times: s, ease: o }); - return p.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (u_(p, this.pendingTimeline), this.pendingTimeline = void 0) : p.onfinish = () => { + return p.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (u6(p, this.pendingTimeline), this.pendingTimeline = void 0) : p.onfinish = () => { const { onComplete: w } = this.options; u.set(wp(e, this.options, r)), w && w(), this.cancel(), this.resolveFinishedPromise(); }, { @@ -32461,7 +32461,7 @@ class f_ extends y7 { if (!r) return Un; const { animation: n } = r; - u_(n, e); + u6(n, e); } return Un; } @@ -32624,7 +32624,7 @@ const Wb = (t, e, r, n = {}, i, s) => (o) => { d.onUpdate(w), d.onComplete(); }), new see([]); } - return !s && f_.supports(d) ? new f_(d) : new qb(d); + return !s && f6.supports(d) ? new f6(d) : new qb(d); }, aee = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), cee = (t) => J1(t) ? t[t.length - 1] || 0 : t; function Hb(t, e) { t.indexOf(e) === -1 && t.push(e); @@ -32658,7 +32658,7 @@ class Vb { this.subscriptions.length = 0; } } -const l_ = 30, uee = (t) => !isNaN(parseFloat(t)); +const l6 = 30, uee = (t) => !isNaN(parseFloat(t)); class fee { /** * @param init - The initiating value @@ -32797,9 +32797,9 @@ class fee { */ getVelocity() { const e = Ys.now(); - if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > l_) + if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > l6) return 0; - const r = Math.min(this.updatedAt - this.prevUpdatedAt, l_); + const r = Math.min(this.updatedAt - this.prevUpdatedAt, l6); return w7(parseFloat(this.current) - parseFloat(this.prevFrameValue), r); } /** @@ -32979,7 +32979,7 @@ function _ee(t) { return (e) => Promise.all(e.map(({ animation: r, options: n }) => bee(t, r, n))); } function Eee(t) { - let e = _ee(t), r = h_(), n = !0; + let e = _ee(t), r = h6(), n = !0; const i = (u) => (l, d) => { var p; const w = yp(t, d, u === "exit" ? (p = t.presenceContext) === null || p === void 0 ? void 0 : p.custom : void 0); @@ -33060,7 +33060,7 @@ function Eee(t) { setAnimateFunction: s, getState: () => r, reset: () => { - r = h_(), n = !0; + r = h6(), n = !0; } }; } @@ -33075,7 +33075,7 @@ function Va(t = !1) { prevResolvedValues: {} }; } -function h_() { +function h6() { return { animate: Va(!0), whileInView: Va(), @@ -33165,9 +33165,9 @@ function Mo(t, e, r, n = { passive: !0 }) { function Do(t, e, r, n) { return Mo(t, e, Cee(r), n); } -const d_ = (t, e) => Math.abs(t - e); +const d6 = (t, e) => Math.abs(t - e); function Tee(t, e) { - const r = d_(t.x, e.x), n = d_(t.y, e.y); + const r = d6(t.x, e.x), n = d6(t.y, e.y); return Math.sqrt(r ** 2 + n ** 2); } class N7 { @@ -33209,14 +33209,14 @@ class N7 { function $m(t, e) { return e ? { point: e(t.point) } : t; } -function p_(t, e) { +function p6(t, e) { return { x: t.x - e.x, y: t.y - e.y }; } function Bm({ point: t }, e) { return { point: t, - delta: p_(t, L7(e)), - offset: p_(t, Ree(e)), + delta: p6(t, L7(e)), + offset: p6(t, Ree(e)), velocity: Dee(e, 0.1) }; } @@ -33253,15 +33253,15 @@ function k7(t) { return e === null ? (e = t, r) : !1; }; } -const g_ = k7("dragHorizontal"), m_ = k7("dragVertical"); +const g6 = k7("dragHorizontal"), m6 = k7("dragVertical"); function $7(t) { let e = !1; if (t === "y") - e = m_(); + e = m6(); else if (t === "x") - e = g_(); + e = g6(); else { - const r = g_(), n = m_(); + const r = g6(), n = m6(); r && n ? e = () => { r(), n(); } : (r && r(), n && n()); @@ -33282,28 +33282,28 @@ function Li(t) { function $ee(t, e, r) { return Math.abs(t - e) <= r; } -function v_(t, e, r, n = 0.5) { +function v6(t, e, r, n = 0.5) { t.origin = n, t.originPoint = Qr(e.min, e.max, t.origin), t.scale = Li(r) / Li(e), t.translate = Qr(r.min, r.max, t.origin) - t.originPoint, (t.scale >= Oee && t.scale <= Nee || isNaN(t.scale)) && (t.scale = 1), (t.translate >= Lee && t.translate <= kee || isNaN(t.translate)) && (t.translate = 0); } function Jf(t, e, r, n) { - v_(t.x, e.x, r.x, n ? n.originX : void 0), v_(t.y, e.y, r.y, n ? n.originY : void 0); + v6(t.x, e.x, r.x, n ? n.originX : void 0), v6(t.y, e.y, r.y, n ? n.originY : void 0); } -function b_(t, e, r) { +function b6(t, e, r) { t.min = r.min + e.min, t.max = t.min + Li(e); } function Bee(t, e, r) { - b_(t.x, e.x, r.x), b_(t.y, e.y, r.y); + b6(t.x, e.x, r.x), b6(t.y, e.y, r.y); } -function y_(t, e, r) { +function y6(t, e, r) { t.min = e.min - r.min, t.max = t.min + Li(e); } function Xf(t, e, r) { - y_(t.x, e.x, r.x), y_(t.y, e.y, r.y); + y6(t.x, e.x, r.x), y6(t.y, e.y, r.y); } function Fee(t, { min: e, max: r }, n) { return e !== void 0 && t < e ? t = n ? Qr(e, t, n.min) : Math.max(t, e) : r !== void 0 && t > r && (t = n ? Qr(r, t, n.max) : Math.min(t, r)), t; } -function w_(t, e, r) { +function w6(t, e, r) { return { min: e !== void 0 ? t.min + e : void 0, max: r !== void 0 ? t.max + r - (t.max - t.min) : void 0 @@ -33311,18 +33311,18 @@ function w_(t, e, r) { } function jee(t, { top: e, left: r, bottom: n, right: i }) { return { - x: w_(t.x, r, i), - y: w_(t.y, e, n) + x: w6(t.x, r, i), + y: w6(t.y, e, n) }; } -function x_(t, e) { +function x6(t, e) { let r = e.min - t.min, n = e.max - t.max; return e.max - e.min < t.max - t.min && ([r, n] = [n, r]), { min: r, max: n }; } function Uee(t, e) { return { - x: x_(t.x, e.x), - y: x_(t.y, e.y) + x: x6(t.x, e.x), + y: x6(t.y, e.y) }; } function qee(t, e) { @@ -33337,30 +33337,30 @@ function zee(t, e) { const ov = 0.35; function Wee(t = ov) { return t === !1 ? t = 0 : t === !0 && (t = ov), { - x: __(t, "left", "right"), - y: __(t, "top", "bottom") + x: _6(t, "left", "right"), + y: _6(t, "top", "bottom") }; } -function __(t, e, r) { +function _6(t, e, r) { return { - min: E_(t, e), - max: E_(t, r) + min: E6(t, e), + max: E6(t, r) }; } -function E_(t, e) { +function E6(t, e) { return typeof t == "number" ? t : t[e] || 0; } -const S_ = () => ({ +const S6 = () => ({ translate: 0, scale: 1, origin: 0, originPoint: 0 }), ru = () => ({ - x: S_(), - y: S_() -}), A_ = () => ({ min: 0, max: 0 }), ln = () => ({ - x: A_(), - y: A_() + x: S6(), + y: S6() +}), A6 = () => ({ min: 0, max: 0 }), ln = () => ({ + x: A6(), + y: A6() }); function Xi(t) { return [t("x"), t("y")]; @@ -33395,25 +33395,25 @@ function Ya(t) { return av(t) || q7(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY; } function q7(t) { - return P_(t.x) || P_(t.y); + return P6(t.x) || P6(t.y); } -function P_(t) { +function P6(t) { return t && t !== "0%"; } function x0(t, e, r) { const n = t - r, i = e * n; return r + i; } -function M_(t, e, r, n, i) { +function M6(t, e, r, n, i) { return i !== void 0 && (t = x0(t, i, n)), x0(t, r, n) + e; } function cv(t, e = 0, r = 1, n, i) { - t.min = M_(t.min, e, r, n, i), t.max = M_(t.max, e, r, n, i); + t.min = M6(t.min, e, r, n, i), t.max = M6(t.max, e, r, n, i); } function z7(t, { x: e, y: r }) { cv(t.x, e.translate, e.scale, e.originPoint), cv(t.y, r.translate, r.scale, r.originPoint); } -const I_ = 0.999999999999, C_ = 1.0000000000001; +const I6 = 0.999999999999, C6 = 1.0000000000001; function Vee(t, e, r, n = !1) { const i = r.length; if (!i) @@ -33428,17 +33428,17 @@ function Vee(t, e, r, n = !1) { y: -s.scroll.offset.y }), o && (e.x *= o.x.scale, e.y *= o.y.scale, z7(t, o)), n && Ya(s.latestValues) && iu(t, s.latestValues)); } - e.x < C_ && e.x > I_ && (e.x = 1), e.y < C_ && e.y > I_ && (e.y = 1); + e.x < C6 && e.x > I6 && (e.x = 1), e.y < C6 && e.y > I6 && (e.y = 1); } function nu(t, e) { t.min = t.min + e, t.max = t.max + e; } -function T_(t, e, r, n, i = 0.5) { +function T6(t, e, r, n, i = 0.5) { const s = Qr(t.min, t.max, i); cv(t, e, r, s, n); } function iu(t, e) { - T_(t.x, e.x, e.scaleX, e.scale, e.originX), T_(t.y, e.y, e.scaleY, e.scale, e.originY); + T6(t.x, e.x, e.scaleX, e.scale, e.originX), T6(t.y, e.y, e.scaleY, e.scale, e.originY); } function W7(t, e) { return U7(Kee(t.getBoundingClientRect(), e)); @@ -33692,7 +33692,7 @@ class Zee extends Ra { this.removeGroupControls(), this.removeListeners(); } } -const R_ = (t) => (e, r) => { +const R6 = (t) => (e, r) => { t && Lr.postRender(() => t(e, r)); }; class Qee extends Ra { @@ -33708,8 +33708,8 @@ class Qee extends Ra { createPanHandlers() { const { onPanSessionStart: e, onPanStart: r, onPan: n, onPanEnd: i } = this.node.getProps(); return { - onSessionStart: R_(e), - onStart: R_(r), + onSessionStart: R6(e), + onStart: R6(r), onMove: n, onEnd: (s, o) => { delete this.session, i && Lr.postRender(() => i(s, o)); @@ -33748,7 +33748,7 @@ const Yb = Sa({}), K7 = Sa({}), jd = { */ hasEverUpdated: !1 }; -function D_(t, e) { +function D6(t, e) { return e.max === e.min ? 0 : t / (e.max - e.min) * 100; } const Of = { @@ -33760,7 +33760,7 @@ const Of = { t = parseFloat(t); else return t; - const r = D_(t, e.target.x), n = D_(t, e.target.y); + const r = D6(t, e.target.x), n = D6(t, e.target.y); return `${r}% ${n}%`; } }, tte = { @@ -33837,7 +33837,7 @@ const ite = { borderBottomLeftRadius: Of, borderBottomRightRadius: Of, boxShadow: tte -}, G7 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], ste = G7.length, O_ = (t) => typeof t == "string" ? parseFloat(t) : t, N_ = (t) => typeof t == "number" || Vt.test(t); +}, G7 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], ste = G7.length, O6 = (t) => typeof t == "string" ? parseFloat(t) : t, N6 = (t) => typeof t == "number" || Vt.test(t); function ote(t, e, r, n, i, s) { i ? (t.opacity = Qr( 0, @@ -33847,67 +33847,67 @@ function ote(t, e, r, n, i, s) { ), t.opacityExit = Qr(e.opacity !== void 0 ? e.opacity : 1, 0, cte(n))) : s && (t.opacity = Qr(e.opacity !== void 0 ? e.opacity : 1, r.opacity !== void 0 ? r.opacity : 1, n)); for (let o = 0; o < ste; o++) { const a = `border${G7[o]}Radius`; - let u = L_(e, a), l = L_(r, a); + let u = L6(e, a), l = L6(r, a); if (u === void 0 && l === void 0) continue; - u || (u = 0), l || (l = 0), u === 0 || l === 0 || N_(u) === N_(l) ? (t[a] = Math.max(Qr(O_(u), O_(l), n), 0), (Gs.test(l) || Gs.test(u)) && (t[a] += "%")) : t[a] = l; + u || (u = 0), l || (l = 0), u === 0 || l === 0 || N6(u) === N6(l) ? (t[a] = Math.max(Qr(O6(u), O6(l), n), 0), (Gs.test(l) || Gs.test(u)) && (t[a] += "%")) : t[a] = l; } (e.rotate || r.rotate) && (t.rotate = Qr(e.rotate || 0, r.rotate || 0, n)); } -function L_(t, e) { +function L6(t, e) { return t[e] !== void 0 ? t[e] : t.borderRadius; } const ate = /* @__PURE__ */ Y7(0, 0.5, t7), cte = /* @__PURE__ */ Y7(0.5, 0.95, Un); function Y7(t, e, r) { return (n) => n < t ? 0 : n > e ? 1 : r(Iu(t, e, n)); } -function k_(t, e) { +function k6(t, e) { t.min = e.min, t.max = e.max; } function Yi(t, e) { - k_(t.x, e.x), k_(t.y, e.y); + k6(t.x, e.x), k6(t.y, e.y); } -function $_(t, e) { +function $6(t, e) { t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin; } -function B_(t, e, r, n, i) { +function B6(t, e, r, n, i) { return t -= e, t = x0(t, 1 / r, n), i !== void 0 && (t = x0(t, 1 / i, n)), t; } function ute(t, e = 0, r = 1, n = 0.5, i, s = t, o = t) { if (Gs.test(e) && (e = parseFloat(e), e = Qr(o.min, o.max, e / 100) - o.min), typeof e != "number") return; let a = Qr(s.min, s.max, n); - t === s && (a -= e), t.min = B_(t.min, e, r, a, i), t.max = B_(t.max, e, r, a, i); + t === s && (a -= e), t.min = B6(t.min, e, r, a, i), t.max = B6(t.max, e, r, a, i); } -function F_(t, e, [r, n, i], s, o) { +function F6(t, e, [r, n, i], s, o) { ute(t, e[r], e[n], e[i], e.scale, s, o); } const fte = ["x", "scaleX", "originX"], lte = ["y", "scaleY", "originY"]; -function j_(t, e, r, n) { - F_(t.x, e, fte, r ? r.x : void 0, n ? n.x : void 0), F_(t.y, e, lte, r ? r.y : void 0, n ? n.y : void 0); +function j6(t, e, r, n) { + F6(t.x, e, fte, r ? r.x : void 0, n ? n.x : void 0), F6(t.y, e, lte, r ? r.y : void 0, n ? n.y : void 0); } -function U_(t) { +function U6(t) { return t.translate === 0 && t.scale === 1; } function J7(t) { - return U_(t.x) && U_(t.y); + return U6(t.x) && U6(t.y); } -function q_(t, e) { +function q6(t, e) { return t.min === e.min && t.max === e.max; } function hte(t, e) { - return q_(t.x, e.x) && q_(t.y, e.y); + return q6(t.x, e.x) && q6(t.y, e.y); } -function z_(t, e) { +function z6(t, e) { return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max); } function X7(t, e) { - return z_(t.x, e.x) && z_(t.y, e.y); + return z6(t.x, e.x) && z6(t.y, e.y); } -function W_(t) { +function W6(t) { return Li(t.x) / Li(t.y); } -function H_(t, e) { +function H6(t, e) { return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint; } class dte { @@ -34012,7 +34012,7 @@ const Ja = { totalNodes: 0, resolvedTargetDeltas: 0, recalculatedProjection: 0 -}, Uf = typeof window < "u" && window.MotionDebug !== void 0, jm = ["", "X", "Y", "Z"], wte = { visibility: "hidden" }, K_ = 1e3; +}, Uf = typeof window < "u" && window.MotionDebug !== void 0, jm = ["", "X", "Y", "Z"], wte = { visibility: "hidden" }, K6 = 1e3; let xte = 0; function Um(t, e, r, n) { const { latestValues: i } = e; @@ -34066,7 +34066,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check let p; const w = () => this.root.updateBlockedByResize = !1; t(o, () => { - this.root.updateBlockedByResize = !0, p && p(), p = vte(w, 250), jd.hasAnimatedSinceResize && (jd.hasAnimatedSinceResize = !1, this.nodes.forEach(G_)); + this.root.updateBlockedByResize = !0, p && p(), p = vte(w, 250), jd.hasAnimatedSinceResize && (jd.hasAnimatedSinceResize = !1, this.nodes.forEach(G6)); }); } u && this.root.registerSharedNode(u, this), this.options.animate !== !1 && d && (u || l) && this.addEventListener("didUpdate", ({ delta: p, hasLayoutChanged: w, hasRelativeTargetChanged: A, layout: M }) => { @@ -34084,7 +34084,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check }; (d.shouldReduceMotion || this.options.layoutRoot) && (W.delay = 0, W.type = !1), this.startAnimation(W); } else - w || G_(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete(); + w || G6(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete(); this.targetLayout = M; }); } @@ -34134,7 +34134,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check } update() { if (this.updateScheduled = !1, this.isUpdateBlocked()) { - this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(V_); + this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(V6); return; } this.isUpdating || this.nodes.forEach(Mte), this.isUpdating = !1, this.nodes.forEach(Ite), this.nodes.forEach(_te), this.nodes.forEach(Ete), this.clearAllSnapshots(); @@ -34246,9 +34246,9 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check continue; av(l.latestValues) && l.updateSnapshot(); const d = ln(), p = l.measurePageBox(); - Yi(d, p), j_(a, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, d); + Yi(d, p), j6(a, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, d); } - return Ya(this.latestValues) && j_(a, this.latestValues), a; + return Ya(this.latestValues) && j6(a, this.latestValues), a; } setTargetDelta(o) { this.targetDelta = o, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0; @@ -34313,7 +34313,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender()); return; } - !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : ($_(this.prevProjectionDelta.x, this.projectionDelta.x), $_(this.prevProjectionDelta.y, this.projectionDelta.y)), Jf(this.projectionDelta, this.layoutCorrected, M, this.latestValues), (this.treeScale.x !== w || this.treeScale.y !== A || !H_(this.projectionDelta.x, this.prevProjectionDelta.x) || !H_(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", M)), Uf && Ja.recalculatedProjection++; + !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : ($6(this.prevProjectionDelta.x, this.projectionDelta.x), $6(this.prevProjectionDelta.y, this.projectionDelta.y)), Jf(this.projectionDelta, this.layoutCorrected, M, this.latestValues), (this.treeScale.x !== w || this.treeScale.y !== A || !H6(this.projectionDelta.x, this.prevProjectionDelta.x) || !H6(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", M)), Uf && Ja.recalculatedProjection++; } hide() { this.isVisible = !1; @@ -34340,12 +34340,12 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check let H; this.mixTargetDelta = (W) => { const V = W / 1e3; - Y_(p.x, o.x, V), Y_(p.y, o.y, V), this.setTargetDelta(p), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Xf(w, this.layout.layoutBox, this.relativeParent.layout.layoutBox), Ote(this.relativeTarget, this.relativeTargetOrigin, w, V), H && hte(this.relativeTarget, H) && (this.isProjectionDirty = !1), H || (H = ln()), Yi(H, this.relativeTarget)), N && (this.animationValues = d, ote(d, l, this.latestValues, V, $, B)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V; + Y6(p.x, o.x, V), Y6(p.y, o.y, V), this.setTargetDelta(p), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Xf(w, this.layout.layoutBox, this.relativeParent.layout.layoutBox), Ote(this.relativeTarget, this.relativeTargetOrigin, w, V), H && hte(this.relativeTarget, H) && (this.isProjectionDirty = !1), H || (H = ln()), Yi(H, this.relativeTarget)), N && (this.animationValues = d, ote(d, l, this.latestValues, V, $, B)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V; }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0); } startAnimation(o) { this.notifyListeners("animationStart"), this.currentAnimation && this.currentAnimation.stop(), this.resumingFrom && this.resumingFrom.currentAnimation && this.resumingFrom.currentAnimation.stop(), this.pendingAnimation && (wa(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = Lr.update(() => { - jd.hasAnimatedSinceResize = !0, this.currentAnimation = yte(0, K_, { + jd.hasAnimatedSinceResize = !0, this.currentAnimation = yte(0, K6, { ...o, onUpdate: (a) => { this.mixTargetDelta(a), o.onUpdate && o.onUpdate(a); @@ -34362,7 +34362,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check o && o.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete"); } finishAnimation() { - this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(K_), this.currentAnimation.stop()), this.completeAnimation(); + this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(K6), this.currentAnimation.stop()), this.completeAnimation(); } applyTransformsToTarget() { const o = this.getLead(); @@ -34471,7 +34471,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.root.nodes.forEach((o) => { var a; return (a = o.currentAnimation) === null || a === void 0 ? void 0 : a.stop(); - }), this.root.nodes.forEach(V_), this.root.sharedNodes.clear(); + }), this.root.nodes.forEach(V6), this.root.sharedNodes.clear(); } }; } @@ -34531,7 +34531,7 @@ function Ate(t) { function Pte(t) { t.clearSnapshot(); } -function V_(t) { +function V6(t) { t.clearMeasurements(); } function Mte(t) { @@ -34541,7 +34541,7 @@ function Ite(t) { const { visualElement: e } = t.options; e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform(); } -function G_(t) { +function G6(t) { t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0; } function Cte(t) { @@ -34556,14 +34556,14 @@ function Rte(t) { function Dte(t) { t.removeLeadSnapshot(); } -function Y_(t, e, r) { +function Y6(t, e, r) { t.translate = Qr(e.translate, 0, r), t.scale = Qr(e.scale, 1, r), t.origin = e.origin, t.originPoint = e.originPoint; } -function J_(t, e, r, n) { +function J6(t, e, r, n) { t.min = Qr(e.min, r.min, n), t.max = Qr(e.max, r.max, n); } function Ote(t, e, r, n) { - J_(t.x, e.x, r.x, n), J_(t.y, e.y, r.y, n); + J6(t.x, e.x, r.x, n), J6(t.y, e.y, r.y, n); } function Nte(t) { return t.animationValues && t.animationValues.opacityExit !== void 0; @@ -34571,15 +34571,15 @@ function Nte(t) { const Lte = { duration: 0.45, ease: [0.4, 0, 0.1, 1] -}, X_ = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Z_ = X_("applewebkit/") && !X_("chrome/") ? Math.round : Un; -function Q_(t) { - t.min = Z_(t.min), t.max = Z_(t.max); +}, X6 = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Z6 = X6("applewebkit/") && !X6("chrome/") ? Math.round : Un; +function Q6(t) { + t.min = Z6(t.min), t.max = Z6(t.max); } function kte(t) { - Q_(t.x), Q_(t.y); + Q6(t.x), Q6(t.y); } function e9(t, e, r) { - return t === "position" || t === "preserve-aspect" && !$ee(W_(e), W_(r), 0.2); + return t === "position" || t === "preserve-aspect" && !$ee(W6(e), W6(r), 0.2); } function $te(t) { var e; @@ -35738,7 +35738,7 @@ function o5(t) { } const Hre = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExitComplete: i, presenceAffectsLayout: s = !0, mode: o = "sync" }) => { Uo(!e, "Replace exitBeforeEnter with mode='wait'"); - const a = wi(() => o5(t), [t]), u = a.map(bd), l = Zn(!0), d = Zn(a), p = ty(() => /* @__PURE__ */ new Map()), [w, A] = Qt(a), [M, N] = Qt(a); + const a = wi(() => o5(t), [t]), u = a.map(bd), l = Zn(!0), d = Zn(a), p = ty(() => /* @__PURE__ */ new Map()), [w, A] = Yt(a), [M, N] = Yt(a); n9(() => { l.current = !1, d.current = a; for (let $ = 0; $ < M.length; $++) { @@ -38111,7 +38111,7 @@ function Ine(t) { ] }) }); } function M9(t) { - const [e, r] = Qt(""), { featuredWallets: n, initialized: i } = mp(), { onEmailConfirm: s, onSelectWallet: o, onSelectMoreWallets: a, onSelectTonConnect: u, config: l } = t, d = wi(() => { + const [e, r] = Yt(""), { featuredWallets: n, initialized: i } = mp(), { onEmailConfirm: s, onSelectWallet: o, onSelectMoreWallets: a, onSelectTonConnect: u, config: l } = t, d = wi(() => { const N = /[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu, L = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; return !N.test(e) && L.test(e); }, [e]); @@ -38171,15 +38171,16 @@ const I9 = Sa({ channel: "", device: "WEB", app: "", - inviterCode: "" + inviterCode: "", + role: "C" }); function cy() { return Tn(I9); } function Cne(t) { - const { config: e } = t, [r, n] = Qt(e.channel), [i, s] = Qt(e.device), [o, a] = Qt(e.app), [u, l] = Qt(e.inviterCode); + const { config: e } = t, [r, n] = Yt(e.channel), [i, s] = Yt(e.device), [o, a] = Yt(e.app), [u, l] = Yt(e.role || "C"), [d, p] = Yt(e.inviterCode); return Dn(() => { - n(e.channel), s(e.device), a(e.app), l(e.inviterCode); + n(e.channel), s(e.device), a(e.app), p(e.inviterCode), l(e.role || "C"); }, [e]), /* @__PURE__ */ pe.jsx( I9.Provider, { @@ -38187,7 +38188,8 @@ function Cne(t) { channel: r, device: i, app: o, - inviterCode: u + inviterCode: d, + role: u }, children: t.children } @@ -38425,7 +38427,7 @@ function zne(t) { ] }); } function k9(t) { - const { email: e } = t, [r, n] = Qt(0), [i, s] = Qt(!1), [o, a] = Qt(""); + const { email: e } = t, [r, n] = Yt(0), [i, s] = Yt(!1), [o, a] = Yt(""); async function u() { n(60); const d = setInterval(() => { @@ -38470,7 +38472,7 @@ function k9(t) { ] }); } function $9(t) { - const { email: e } = t, [r, n] = Qt(!1), [i, s] = Qt(""), o = wi(() => `xn-btn-${(/* @__PURE__ */ new Date()).getTime()}`, [e]); + const { email: e } = t, [r, n] = Yt(!1), [i, s] = Yt(""), o = wi(() => `xn-btn-${(/* @__PURE__ */ new Date()).getTime()}`, [e]); async function a(w, A) { n(!0), s(""), await Ta.getEmailCode({ account_type: "email", email: w }, A), n(!1); } @@ -38518,7 +38520,7 @@ function $9(t) { ] }); } function Wne(t) { - const { email: e } = t, r = cy(), [n, i] = Qt("captcha"); + const { email: e } = t, r = cy(), [n, i] = Yt("captcha"); async function s(o, a) { const u = await Ta.emailLogin({ account_type: "email", @@ -39835,7 +39837,7 @@ function eie(t, e) { } function q9(t) { var ge, Ee, Y; - const e = Zn(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Qt(""), [a, u] = Qt(!1), [l, d] = Qt(""), [p, w] = Qt("scan"), A = Zn(), [M, N] = Qt((ge = r.config) == null ? void 0 : ge.image), [L, B] = Qt(!1), { saveLastUsedWallet: $ } = mp(); + const e = Zn(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Yt(""), [a, u] = Yt(!1), [l, d] = Yt(""), [p, w] = Yt("scan"), A = Zn(), [M, N] = Yt((ge = r.config) == null ? void 0 : ge.image), [L, B] = Yt(!1), { saveLastUsedWallet: $ } = mp(); async function H(S) { var f, g, b, x; u(!0); @@ -39985,7 +39987,7 @@ function nie(t, e) { } function z9(t) { var p; - const [e, r] = Qt(), { wallet: n, onSignFinish: i } = t, s = Zn(), [o, a] = Qt("connect"), { saveLastUsedWallet: u } = mp(); + const [e, r] = Yt(), { wallet: n, onSignFinish: i } = t, s = Zn(), [o, a] = Yt("connect"), { saveLastUsedWallet: u } = mp(); async function l(w) { var A; try { @@ -40119,12 +40121,12 @@ function W9(t) { ] }); } function lie(t) { - const { wallet: e } = t, [r, n] = Qt(e.installed ? "connect" : "qr"), i = cy(); + const { wallet: e } = t, [r, n] = Yt(e.installed ? "connect" : "qr"), i = cy(); async function s(o, a) { var l; const u = await Ta.walletLogin({ account_type: "block_chain", - account_enum: "C", + account_enum: i.role, connector: "codatta_wallet", inviter_code: i.inviterCode, wallet_name: ((l = o.config) == null ? void 0 : l.name) || o.key, @@ -40167,7 +40169,7 @@ function hie(t) { return /* @__PURE__ */ pe.jsx(oy, { icon: n, title: i, onClick: () => r(e) }); } function H9(t) { - const { connector: e } = t, [r, n] = Qt(), [i, s] = Qt([]), o = wi(() => r ? i.filter((d) => d.name.toLowerCase().includes(r.toLowerCase())) : i, [r, i]); + const { connector: e } = t, [r, n] = Yt(), [i, s] = Yt([]), o = wi(() => r ? i.filter((d) => d.name.toLowerCase().includes(r.toLowerCase())) : i, [r, i]); function a(d) { n(d.target.value); } @@ -40258,13 +40260,13 @@ var V9 = { exports: {} }; return N(k, U, z, C, 32); } function $(k, U, z, C) { - for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = z[0] & 255 | (z[1] & 255) << 8 | (z[2] & 255) << 16 | (z[3] & 255) << 24, se = z[4] & 255 | (z[5] & 255) << 8 | (z[6] & 255) << 16 | (z[7] & 255) << 24, he = z[8] & 255 | (z[9] & 255) << 8 | (z[10] & 255) << 16 | (z[11] & 255) << 24, xe = z[12] & 255 | (z[13] & 255) << 8 | (z[14] & 255) << 16 | (z[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = U[0] & 255 | (U[1] & 255) << 8 | (U[2] & 255) << 16 | (U[3] & 255) << 24, nt = U[4] & 255 | (U[5] & 255) << 8 | (U[6] & 255) << 16 | (U[7] & 255) << 24, je = U[8] & 255 | (U[9] & 255) << 8 | (U[10] & 255) << 16 | (U[11] & 255) << 24, pt = U[12] & 255 | (U[13] & 255) << 8 | (U[14] & 255) << 16 | (U[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = z[16] & 255 | (z[17] & 255) << 8 | (z[18] & 255) << 16 | (z[19] & 255) << 24, St = z[20] & 255 | (z[21] & 255) << 8 | (z[22] & 255) << 16 | (z[23] & 255) << 24, Tt = z[24] & 255 | (z[25] & 255) << 8 | (z[26] & 255) << 16 | (z[27] & 255) << 24, At = z[28] & 255 | (z[29] & 255) << 8 | (z[30] & 255) << 16 | (z[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = he, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Xt = At, Wt = _t, le, rr = 0; rr < 20; rr += 2) - le = ht + Lt | 0, ut ^= le << 7 | le >>> 25, le = ut + ht | 0, Ve ^= le << 9 | le >>> 23, le = Ve + ut | 0, Lt ^= le << 13 | le >>> 19, le = Lt + Ve | 0, ht ^= le << 18 | le >>> 14, le = ot + xt | 0, Fe ^= le << 7 | le >>> 25, le = Fe + ot | 0, zt ^= le << 9 | le >>> 23, le = zt + Fe | 0, xt ^= le << 13 | le >>> 19, le = xt + zt | 0, ot ^= le << 18 | le >>> 14, le = Ue + Se | 0, Xt ^= le << 7 | le >>> 25, le = Xt + Ue | 0, st ^= le << 9 | le >>> 23, le = st + Xt | 0, Se ^= le << 13 | le >>> 19, le = Se + st | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Je | 0, bt ^= le << 7 | le >>> 25, le = bt + Wt | 0, Ae ^= le << 9 | le >>> 23, le = Ae + bt | 0, Je ^= le << 13 | le >>> 19, le = Je + Ae | 0, Wt ^= le << 18 | le >>> 14, le = ht + bt | 0, xt ^= le << 7 | le >>> 25, le = xt + ht | 0, st ^= le << 9 | le >>> 23, le = st + xt | 0, bt ^= le << 13 | le >>> 19, le = bt + st | 0, ht ^= le << 18 | le >>> 14, le = ot + ut | 0, Se ^= le << 7 | le >>> 25, le = Se + ot | 0, Ae ^= le << 9 | le >>> 23, le = Ae + Se | 0, ut ^= le << 13 | le >>> 19, le = ut + Ae | 0, ot ^= le << 18 | le >>> 14, le = Ue + Fe | 0, Je ^= le << 7 | le >>> 25, le = Je + Ue | 0, Ve ^= le << 9 | le >>> 23, le = Ve + Je | 0, Fe ^= le << 13 | le >>> 19, le = Fe + Ve | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Xt | 0, Lt ^= le << 7 | le >>> 25, le = Lt + Wt | 0, zt ^= le << 9 | le >>> 23, le = zt + Lt | 0, Xt ^= le << 13 | le >>> 19, le = Xt + zt | 0, Wt ^= le << 18 | le >>> 14; - ht = ht + G | 0, xt = xt + j | 0, st = st + se | 0, bt = bt + he | 0, ut = ut + xe | 0, ot = ot + Te | 0, Se = Se + Re | 0, Ae = Ae + nt | 0, Ve = Ve + je | 0, Fe = Fe + pt | 0, Ue = Ue + it | 0, Je = Je + et | 0, Lt = Lt + St | 0, zt = zt + Tt | 0, Xt = Xt + At | 0, Wt = Wt + _t | 0, k[0] = ht >>> 0 & 255, k[1] = ht >>> 8 & 255, k[2] = ht >>> 16 & 255, k[3] = ht >>> 24 & 255, k[4] = xt >>> 0 & 255, k[5] = xt >>> 8 & 255, k[6] = xt >>> 16 & 255, k[7] = xt >>> 24 & 255, k[8] = st >>> 0 & 255, k[9] = st >>> 8 & 255, k[10] = st >>> 16 & 255, k[11] = st >>> 24 & 255, k[12] = bt >>> 0 & 255, k[13] = bt >>> 8 & 255, k[14] = bt >>> 16 & 255, k[15] = bt >>> 24 & 255, k[16] = ut >>> 0 & 255, k[17] = ut >>> 8 & 255, k[18] = ut >>> 16 & 255, k[19] = ut >>> 24 & 255, k[20] = ot >>> 0 & 255, k[21] = ot >>> 8 & 255, k[22] = ot >>> 16 & 255, k[23] = ot >>> 24 & 255, k[24] = Se >>> 0 & 255, k[25] = Se >>> 8 & 255, k[26] = Se >>> 16 & 255, k[27] = Se >>> 24 & 255, k[28] = Ae >>> 0 & 255, k[29] = Ae >>> 8 & 255, k[30] = Ae >>> 16 & 255, k[31] = Ae >>> 24 & 255, k[32] = Ve >>> 0 & 255, k[33] = Ve >>> 8 & 255, k[34] = Ve >>> 16 & 255, k[35] = Ve >>> 24 & 255, k[36] = Fe >>> 0 & 255, k[37] = Fe >>> 8 & 255, k[38] = Fe >>> 16 & 255, k[39] = Fe >>> 24 & 255, k[40] = Ue >>> 0 & 255, k[41] = Ue >>> 8 & 255, k[42] = Ue >>> 16 & 255, k[43] = Ue >>> 24 & 255, k[44] = Je >>> 0 & 255, k[45] = Je >>> 8 & 255, k[46] = Je >>> 16 & 255, k[47] = Je >>> 24 & 255, k[48] = Lt >>> 0 & 255, k[49] = Lt >>> 8 & 255, k[50] = Lt >>> 16 & 255, k[51] = Lt >>> 24 & 255, k[52] = zt >>> 0 & 255, k[53] = zt >>> 8 & 255, k[54] = zt >>> 16 & 255, k[55] = zt >>> 24 & 255, k[56] = Xt >>> 0 & 255, k[57] = Xt >>> 8 & 255, k[58] = Xt >>> 16 & 255, k[59] = Xt >>> 24 & 255, k[60] = Wt >>> 0 & 255, k[61] = Wt >>> 8 & 255, k[62] = Wt >>> 16 & 255, k[63] = Wt >>> 24 & 255; + for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = z[0] & 255 | (z[1] & 255) << 8 | (z[2] & 255) << 16 | (z[3] & 255) << 24, se = z[4] & 255 | (z[5] & 255) << 8 | (z[6] & 255) << 16 | (z[7] & 255) << 24, he = z[8] & 255 | (z[9] & 255) << 8 | (z[10] & 255) << 16 | (z[11] & 255) << 24, xe = z[12] & 255 | (z[13] & 255) << 8 | (z[14] & 255) << 16 | (z[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = U[0] & 255 | (U[1] & 255) << 8 | (U[2] & 255) << 16 | (U[3] & 255) << 24, nt = U[4] & 255 | (U[5] & 255) << 8 | (U[6] & 255) << 16 | (U[7] & 255) << 24, je = U[8] & 255 | (U[9] & 255) << 8 | (U[10] & 255) << 16 | (U[11] & 255) << 24, pt = U[12] & 255 | (U[13] & 255) << 8 | (U[14] & 255) << 16 | (U[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = z[16] & 255 | (z[17] & 255) << 8 | (z[18] & 255) << 16 | (z[19] & 255) << 24, St = z[20] & 255 | (z[21] & 255) << 8 | (z[22] & 255) << 16 | (z[23] & 255) << 24, Tt = z[24] & 255 | (z[25] & 255) << 8 | (z[26] & 255) << 16 | (z[27] & 255) << 24, At = z[28] & 255 | (z[29] & 255) << 8 | (z[30] & 255) << 16 | (z[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = he, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, le, rr = 0; rr < 20; rr += 2) + le = ht + Lt | 0, ut ^= le << 7 | le >>> 25, le = ut + ht | 0, Ve ^= le << 9 | le >>> 23, le = Ve + ut | 0, Lt ^= le << 13 | le >>> 19, le = Lt + Ve | 0, ht ^= le << 18 | le >>> 14, le = ot + xt | 0, Fe ^= le << 7 | le >>> 25, le = Fe + ot | 0, zt ^= le << 9 | le >>> 23, le = zt + Fe | 0, xt ^= le << 13 | le >>> 19, le = xt + zt | 0, ot ^= le << 18 | le >>> 14, le = Ue + Se | 0, Zt ^= le << 7 | le >>> 25, le = Zt + Ue | 0, st ^= le << 9 | le >>> 23, le = st + Zt | 0, Se ^= le << 13 | le >>> 19, le = Se + st | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Je | 0, bt ^= le << 7 | le >>> 25, le = bt + Wt | 0, Ae ^= le << 9 | le >>> 23, le = Ae + bt | 0, Je ^= le << 13 | le >>> 19, le = Je + Ae | 0, Wt ^= le << 18 | le >>> 14, le = ht + bt | 0, xt ^= le << 7 | le >>> 25, le = xt + ht | 0, st ^= le << 9 | le >>> 23, le = st + xt | 0, bt ^= le << 13 | le >>> 19, le = bt + st | 0, ht ^= le << 18 | le >>> 14, le = ot + ut | 0, Se ^= le << 7 | le >>> 25, le = Se + ot | 0, Ae ^= le << 9 | le >>> 23, le = Ae + Se | 0, ut ^= le << 13 | le >>> 19, le = ut + Ae | 0, ot ^= le << 18 | le >>> 14, le = Ue + Fe | 0, Je ^= le << 7 | le >>> 25, le = Je + Ue | 0, Ve ^= le << 9 | le >>> 23, le = Ve + Je | 0, Fe ^= le << 13 | le >>> 19, le = Fe + Ve | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Zt | 0, Lt ^= le << 7 | le >>> 25, le = Lt + Wt | 0, zt ^= le << 9 | le >>> 23, le = zt + Lt | 0, Zt ^= le << 13 | le >>> 19, le = Zt + zt | 0, Wt ^= le << 18 | le >>> 14; + ht = ht + G | 0, xt = xt + j | 0, st = st + se | 0, bt = bt + he | 0, ut = ut + xe | 0, ot = ot + Te | 0, Se = Se + Re | 0, Ae = Ae + nt | 0, Ve = Ve + je | 0, Fe = Fe + pt | 0, Ue = Ue + it | 0, Je = Je + et | 0, Lt = Lt + St | 0, zt = zt + Tt | 0, Zt = Zt + At | 0, Wt = Wt + _t | 0, k[0] = ht >>> 0 & 255, k[1] = ht >>> 8 & 255, k[2] = ht >>> 16 & 255, k[3] = ht >>> 24 & 255, k[4] = xt >>> 0 & 255, k[5] = xt >>> 8 & 255, k[6] = xt >>> 16 & 255, k[7] = xt >>> 24 & 255, k[8] = st >>> 0 & 255, k[9] = st >>> 8 & 255, k[10] = st >>> 16 & 255, k[11] = st >>> 24 & 255, k[12] = bt >>> 0 & 255, k[13] = bt >>> 8 & 255, k[14] = bt >>> 16 & 255, k[15] = bt >>> 24 & 255, k[16] = ut >>> 0 & 255, k[17] = ut >>> 8 & 255, k[18] = ut >>> 16 & 255, k[19] = ut >>> 24 & 255, k[20] = ot >>> 0 & 255, k[21] = ot >>> 8 & 255, k[22] = ot >>> 16 & 255, k[23] = ot >>> 24 & 255, k[24] = Se >>> 0 & 255, k[25] = Se >>> 8 & 255, k[26] = Se >>> 16 & 255, k[27] = Se >>> 24 & 255, k[28] = Ae >>> 0 & 255, k[29] = Ae >>> 8 & 255, k[30] = Ae >>> 16 & 255, k[31] = Ae >>> 24 & 255, k[32] = Ve >>> 0 & 255, k[33] = Ve >>> 8 & 255, k[34] = Ve >>> 16 & 255, k[35] = Ve >>> 24 & 255, k[36] = Fe >>> 0 & 255, k[37] = Fe >>> 8 & 255, k[38] = Fe >>> 16 & 255, k[39] = Fe >>> 24 & 255, k[40] = Ue >>> 0 & 255, k[41] = Ue >>> 8 & 255, k[42] = Ue >>> 16 & 255, k[43] = Ue >>> 24 & 255, k[44] = Je >>> 0 & 255, k[45] = Je >>> 8 & 255, k[46] = Je >>> 16 & 255, k[47] = Je >>> 24 & 255, k[48] = Lt >>> 0 & 255, k[49] = Lt >>> 8 & 255, k[50] = Lt >>> 16 & 255, k[51] = Lt >>> 24 & 255, k[52] = zt >>> 0 & 255, k[53] = zt >>> 8 & 255, k[54] = zt >>> 16 & 255, k[55] = zt >>> 24 & 255, k[56] = Zt >>> 0 & 255, k[57] = Zt >>> 8 & 255, k[58] = Zt >>> 16 & 255, k[59] = Zt >>> 24 & 255, k[60] = Wt >>> 0 & 255, k[61] = Wt >>> 8 & 255, k[62] = Wt >>> 16 & 255, k[63] = Wt >>> 24 & 255; } function H(k, U, z, C) { - for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = z[0] & 255 | (z[1] & 255) << 8 | (z[2] & 255) << 16 | (z[3] & 255) << 24, se = z[4] & 255 | (z[5] & 255) << 8 | (z[6] & 255) << 16 | (z[7] & 255) << 24, he = z[8] & 255 | (z[9] & 255) << 8 | (z[10] & 255) << 16 | (z[11] & 255) << 24, xe = z[12] & 255 | (z[13] & 255) << 8 | (z[14] & 255) << 16 | (z[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = U[0] & 255 | (U[1] & 255) << 8 | (U[2] & 255) << 16 | (U[3] & 255) << 24, nt = U[4] & 255 | (U[5] & 255) << 8 | (U[6] & 255) << 16 | (U[7] & 255) << 24, je = U[8] & 255 | (U[9] & 255) << 8 | (U[10] & 255) << 16 | (U[11] & 255) << 24, pt = U[12] & 255 | (U[13] & 255) << 8 | (U[14] & 255) << 16 | (U[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = z[16] & 255 | (z[17] & 255) << 8 | (z[18] & 255) << 16 | (z[19] & 255) << 24, St = z[20] & 255 | (z[21] & 255) << 8 | (z[22] & 255) << 16 | (z[23] & 255) << 24, Tt = z[24] & 255 | (z[25] & 255) << 8 | (z[26] & 255) << 16 | (z[27] & 255) << 24, At = z[28] & 255 | (z[29] & 255) << 8 | (z[30] & 255) << 16 | (z[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = he, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Xt = At, Wt = _t, le, rr = 0; rr < 20; rr += 2) - le = ht + Lt | 0, ut ^= le << 7 | le >>> 25, le = ut + ht | 0, Ve ^= le << 9 | le >>> 23, le = Ve + ut | 0, Lt ^= le << 13 | le >>> 19, le = Lt + Ve | 0, ht ^= le << 18 | le >>> 14, le = ot + xt | 0, Fe ^= le << 7 | le >>> 25, le = Fe + ot | 0, zt ^= le << 9 | le >>> 23, le = zt + Fe | 0, xt ^= le << 13 | le >>> 19, le = xt + zt | 0, ot ^= le << 18 | le >>> 14, le = Ue + Se | 0, Xt ^= le << 7 | le >>> 25, le = Xt + Ue | 0, st ^= le << 9 | le >>> 23, le = st + Xt | 0, Se ^= le << 13 | le >>> 19, le = Se + st | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Je | 0, bt ^= le << 7 | le >>> 25, le = bt + Wt | 0, Ae ^= le << 9 | le >>> 23, le = Ae + bt | 0, Je ^= le << 13 | le >>> 19, le = Je + Ae | 0, Wt ^= le << 18 | le >>> 14, le = ht + bt | 0, xt ^= le << 7 | le >>> 25, le = xt + ht | 0, st ^= le << 9 | le >>> 23, le = st + xt | 0, bt ^= le << 13 | le >>> 19, le = bt + st | 0, ht ^= le << 18 | le >>> 14, le = ot + ut | 0, Se ^= le << 7 | le >>> 25, le = Se + ot | 0, Ae ^= le << 9 | le >>> 23, le = Ae + Se | 0, ut ^= le << 13 | le >>> 19, le = ut + Ae | 0, ot ^= le << 18 | le >>> 14, le = Ue + Fe | 0, Je ^= le << 7 | le >>> 25, le = Je + Ue | 0, Ve ^= le << 9 | le >>> 23, le = Ve + Je | 0, Fe ^= le << 13 | le >>> 19, le = Fe + Ve | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Xt | 0, Lt ^= le << 7 | le >>> 25, le = Lt + Wt | 0, zt ^= le << 9 | le >>> 23, le = zt + Lt | 0, Xt ^= le << 13 | le >>> 19, le = Xt + zt | 0, Wt ^= le << 18 | le >>> 14; + for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = z[0] & 255 | (z[1] & 255) << 8 | (z[2] & 255) << 16 | (z[3] & 255) << 24, se = z[4] & 255 | (z[5] & 255) << 8 | (z[6] & 255) << 16 | (z[7] & 255) << 24, he = z[8] & 255 | (z[9] & 255) << 8 | (z[10] & 255) << 16 | (z[11] & 255) << 24, xe = z[12] & 255 | (z[13] & 255) << 8 | (z[14] & 255) << 16 | (z[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = U[0] & 255 | (U[1] & 255) << 8 | (U[2] & 255) << 16 | (U[3] & 255) << 24, nt = U[4] & 255 | (U[5] & 255) << 8 | (U[6] & 255) << 16 | (U[7] & 255) << 24, je = U[8] & 255 | (U[9] & 255) << 8 | (U[10] & 255) << 16 | (U[11] & 255) << 24, pt = U[12] & 255 | (U[13] & 255) << 8 | (U[14] & 255) << 16 | (U[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = z[16] & 255 | (z[17] & 255) << 8 | (z[18] & 255) << 16 | (z[19] & 255) << 24, St = z[20] & 255 | (z[21] & 255) << 8 | (z[22] & 255) << 16 | (z[23] & 255) << 24, Tt = z[24] & 255 | (z[25] & 255) << 8 | (z[26] & 255) << 16 | (z[27] & 255) << 24, At = z[28] & 255 | (z[29] & 255) << 8 | (z[30] & 255) << 16 | (z[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = he, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, le, rr = 0; rr < 20; rr += 2) + le = ht + Lt | 0, ut ^= le << 7 | le >>> 25, le = ut + ht | 0, Ve ^= le << 9 | le >>> 23, le = Ve + ut | 0, Lt ^= le << 13 | le >>> 19, le = Lt + Ve | 0, ht ^= le << 18 | le >>> 14, le = ot + xt | 0, Fe ^= le << 7 | le >>> 25, le = Fe + ot | 0, zt ^= le << 9 | le >>> 23, le = zt + Fe | 0, xt ^= le << 13 | le >>> 19, le = xt + zt | 0, ot ^= le << 18 | le >>> 14, le = Ue + Se | 0, Zt ^= le << 7 | le >>> 25, le = Zt + Ue | 0, st ^= le << 9 | le >>> 23, le = st + Zt | 0, Se ^= le << 13 | le >>> 19, le = Se + st | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Je | 0, bt ^= le << 7 | le >>> 25, le = bt + Wt | 0, Ae ^= le << 9 | le >>> 23, le = Ae + bt | 0, Je ^= le << 13 | le >>> 19, le = Je + Ae | 0, Wt ^= le << 18 | le >>> 14, le = ht + bt | 0, xt ^= le << 7 | le >>> 25, le = xt + ht | 0, st ^= le << 9 | le >>> 23, le = st + xt | 0, bt ^= le << 13 | le >>> 19, le = bt + st | 0, ht ^= le << 18 | le >>> 14, le = ot + ut | 0, Se ^= le << 7 | le >>> 25, le = Se + ot | 0, Ae ^= le << 9 | le >>> 23, le = Ae + Se | 0, ut ^= le << 13 | le >>> 19, le = ut + Ae | 0, ot ^= le << 18 | le >>> 14, le = Ue + Fe | 0, Je ^= le << 7 | le >>> 25, le = Je + Ue | 0, Ve ^= le << 9 | le >>> 23, le = Ve + Je | 0, Fe ^= le << 13 | le >>> 19, le = Fe + Ve | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Zt | 0, Lt ^= le << 7 | le >>> 25, le = Lt + Wt | 0, zt ^= le << 9 | le >>> 23, le = zt + Lt | 0, Zt ^= le << 13 | le >>> 19, le = Zt + zt | 0, Wt ^= le << 18 | le >>> 14; k[0] = ht >>> 0 & 255, k[1] = ht >>> 8 & 255, k[2] = ht >>> 16 & 255, k[3] = ht >>> 24 & 255, k[4] = ot >>> 0 & 255, k[5] = ot >>> 8 & 255, k[6] = ot >>> 16 & 255, k[7] = ot >>> 24 & 255, k[8] = Ue >>> 0 & 255, k[9] = Ue >>> 8 & 255, k[10] = Ue >>> 16 & 255, k[11] = Ue >>> 24 & 255, k[12] = Wt >>> 0 & 255, k[13] = Wt >>> 8 & 255, k[14] = Wt >>> 16 & 255, k[15] = Wt >>> 24 & 255, k[16] = Se >>> 0 & 255, k[17] = Se >>> 8 & 255, k[18] = Se >>> 16 & 255, k[19] = Se >>> 24 & 255, k[20] = Ae >>> 0 & 255, k[21] = Ae >>> 8 & 255, k[22] = Ae >>> 16 & 255, k[23] = Ae >>> 24 & 255, k[24] = Ve >>> 0 & 255, k[25] = Ve >>> 8 & 255, k[26] = Ve >>> 16 & 255, k[27] = Ve >>> 24 & 255, k[28] = Fe >>> 0 & 255, k[29] = Fe >>> 8 & 255, k[30] = Fe >>> 16 & 255, k[31] = Fe >>> 24 & 255; } function W(k, U, z, C) { @@ -40320,8 +40322,8 @@ var V9 = { exports: {} }; U = k[0] & 255 | (k[1] & 255) << 8, this.r[0] = U & 8191, z = k[2] & 255 | (k[3] & 255) << 8, this.r[1] = (U >>> 13 | z << 3) & 8191, C = k[4] & 255 | (k[5] & 255) << 8, this.r[2] = (z >>> 10 | C << 6) & 7939, G = k[6] & 255 | (k[7] & 255) << 8, this.r[3] = (C >>> 7 | G << 9) & 8191, j = k[8] & 255 | (k[9] & 255) << 8, this.r[4] = (G >>> 4 | j << 12) & 255, this.r[5] = j >>> 1 & 8190, se = k[10] & 255 | (k[11] & 255) << 8, this.r[6] = (j >>> 14 | se << 2) & 8191, he = k[12] & 255 | (k[13] & 255) << 8, this.r[7] = (se >>> 11 | he << 5) & 8065, xe = k[14] & 255 | (k[15] & 255) << 8, this.r[8] = (he >>> 8 | xe << 8) & 8191, this.r[9] = xe >>> 5 & 127, this.pad[0] = k[16] & 255 | (k[17] & 255) << 8, this.pad[1] = k[18] & 255 | (k[19] & 255) << 8, this.pad[2] = k[20] & 255 | (k[21] & 255) << 8, this.pad[3] = k[22] & 255 | (k[23] & 255) << 8, this.pad[4] = k[24] & 255 | (k[25] & 255) << 8, this.pad[5] = k[26] & 255 | (k[27] & 255) << 8, this.pad[6] = k[28] & 255 | (k[29] & 255) << 8, this.pad[7] = k[30] & 255 | (k[31] & 255) << 8; }; Y.prototype.blocks = function(k, U, z) { - for (var C = this.fin ? 0 : 2048, G, j, se, he, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt = this.h[0], ut = this.h[1], ot = this.h[2], Se = this.h[3], Ae = this.h[4], Ve = this.h[5], Fe = this.h[6], Ue = this.h[7], Je = this.h[8], Lt = this.h[9], zt = this.r[0], Xt = this.r[1], Wt = this.r[2], le = this.r[3], rr = this.r[4], dr = this.r[5], pr = this.r[6], Zt = this.r[7], gr = this.r[8], lr = this.r[9]; z >= 16; ) - G = k[U + 0] & 255 | (k[U + 1] & 255) << 8, bt += G & 8191, j = k[U + 2] & 255 | (k[U + 3] & 255) << 8, ut += (G >>> 13 | j << 3) & 8191, se = k[U + 4] & 255 | (k[U + 5] & 255) << 8, ot += (j >>> 10 | se << 6) & 8191, he = k[U + 6] & 255 | (k[U + 7] & 255) << 8, Se += (se >>> 7 | he << 9) & 8191, xe = k[U + 8] & 255 | (k[U + 9] & 255) << 8, Ae += (he >>> 4 | xe << 12) & 8191, Ve += xe >>> 1 & 8191, Te = k[U + 10] & 255 | (k[U + 11] & 255) << 8, Fe += (xe >>> 14 | Te << 2) & 8191, Re = k[U + 12] & 255 | (k[U + 13] & 255) << 8, Ue += (Te >>> 11 | Re << 5) & 8191, nt = k[U + 14] & 255 | (k[U + 15] & 255) << 8, Je += (Re >>> 8 | nt << 8) & 8191, Lt += nt >>> 5 | C, je = 0, pt = je, pt += bt * zt, pt += ut * (5 * lr), pt += ot * (5 * gr), pt += Se * (5 * Zt), pt += Ae * (5 * pr), je = pt >>> 13, pt &= 8191, pt += Ve * (5 * dr), pt += Fe * (5 * rr), pt += Ue * (5 * le), pt += Je * (5 * Wt), pt += Lt * (5 * Xt), je += pt >>> 13, pt &= 8191, it = je, it += bt * Xt, it += ut * zt, it += ot * (5 * lr), it += Se * (5 * gr), it += Ae * (5 * Zt), je = it >>> 13, it &= 8191, it += Ve * (5 * pr), it += Fe * (5 * dr), it += Ue * (5 * rr), it += Je * (5 * le), it += Lt * (5 * Wt), je += it >>> 13, it &= 8191, et = je, et += bt * Wt, et += ut * Xt, et += ot * zt, et += Se * (5 * lr), et += Ae * (5 * gr), je = et >>> 13, et &= 8191, et += Ve * (5 * Zt), et += Fe * (5 * pr), et += Ue * (5 * dr), et += Je * (5 * rr), et += Lt * (5 * le), je += et >>> 13, et &= 8191, St = je, St += bt * le, St += ut * Wt, St += ot * Xt, St += Se * zt, St += Ae * (5 * lr), je = St >>> 13, St &= 8191, St += Ve * (5 * gr), St += Fe * (5 * Zt), St += Ue * (5 * pr), St += Je * (5 * dr), St += Lt * (5 * rr), je += St >>> 13, St &= 8191, Tt = je, Tt += bt * rr, Tt += ut * le, Tt += ot * Wt, Tt += Se * Xt, Tt += Ae * zt, je = Tt >>> 13, Tt &= 8191, Tt += Ve * (5 * lr), Tt += Fe * (5 * gr), Tt += Ue * (5 * Zt), Tt += Je * (5 * pr), Tt += Lt * (5 * dr), je += Tt >>> 13, Tt &= 8191, At = je, At += bt * dr, At += ut * rr, At += ot * le, At += Se * Wt, At += Ae * Xt, je = At >>> 13, At &= 8191, At += Ve * zt, At += Fe * (5 * lr), At += Ue * (5 * gr), At += Je * (5 * Zt), At += Lt * (5 * pr), je += At >>> 13, At &= 8191, _t = je, _t += bt * pr, _t += ut * dr, _t += ot * rr, _t += Se * le, _t += Ae * Wt, je = _t >>> 13, _t &= 8191, _t += Ve * Xt, _t += Fe * zt, _t += Ue * (5 * lr), _t += Je * (5 * gr), _t += Lt * (5 * Zt), je += _t >>> 13, _t &= 8191, ht = je, ht += bt * Zt, ht += ut * pr, ht += ot * dr, ht += Se * rr, ht += Ae * le, je = ht >>> 13, ht &= 8191, ht += Ve * Wt, ht += Fe * Xt, ht += Ue * zt, ht += Je * (5 * lr), ht += Lt * (5 * gr), je += ht >>> 13, ht &= 8191, xt = je, xt += bt * gr, xt += ut * Zt, xt += ot * pr, xt += Se * dr, xt += Ae * rr, je = xt >>> 13, xt &= 8191, xt += Ve * le, xt += Fe * Wt, xt += Ue * Xt, xt += Je * zt, xt += Lt * (5 * lr), je += xt >>> 13, xt &= 8191, st = je, st += bt * lr, st += ut * gr, st += ot * Zt, st += Se * pr, st += Ae * dr, je = st >>> 13, st &= 8191, st += Ve * rr, st += Fe * le, st += Ue * Wt, st += Je * Xt, st += Lt * zt, je += st >>> 13, st &= 8191, je = (je << 2) + je | 0, je = je + pt | 0, pt = je & 8191, je = je >>> 13, it += je, bt = pt, ut = it, ot = et, Se = St, Ae = Tt, Ve = At, Fe = _t, Ue = ht, Je = xt, Lt = st, U += 16, z -= 16; + for (var C = this.fin ? 0 : 2048, G, j, se, he, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt = this.h[0], ut = this.h[1], ot = this.h[2], Se = this.h[3], Ae = this.h[4], Ve = this.h[5], Fe = this.h[6], Ue = this.h[7], Je = this.h[8], Lt = this.h[9], zt = this.r[0], Zt = this.r[1], Wt = this.r[2], le = this.r[3], rr = this.r[4], dr = this.r[5], pr = this.r[6], Qt = this.r[7], gr = this.r[8], lr = this.r[9]; z >= 16; ) + G = k[U + 0] & 255 | (k[U + 1] & 255) << 8, bt += G & 8191, j = k[U + 2] & 255 | (k[U + 3] & 255) << 8, ut += (G >>> 13 | j << 3) & 8191, se = k[U + 4] & 255 | (k[U + 5] & 255) << 8, ot += (j >>> 10 | se << 6) & 8191, he = k[U + 6] & 255 | (k[U + 7] & 255) << 8, Se += (se >>> 7 | he << 9) & 8191, xe = k[U + 8] & 255 | (k[U + 9] & 255) << 8, Ae += (he >>> 4 | xe << 12) & 8191, Ve += xe >>> 1 & 8191, Te = k[U + 10] & 255 | (k[U + 11] & 255) << 8, Fe += (xe >>> 14 | Te << 2) & 8191, Re = k[U + 12] & 255 | (k[U + 13] & 255) << 8, Ue += (Te >>> 11 | Re << 5) & 8191, nt = k[U + 14] & 255 | (k[U + 15] & 255) << 8, Je += (Re >>> 8 | nt << 8) & 8191, Lt += nt >>> 5 | C, je = 0, pt = je, pt += bt * zt, pt += ut * (5 * lr), pt += ot * (5 * gr), pt += Se * (5 * Qt), pt += Ae * (5 * pr), je = pt >>> 13, pt &= 8191, pt += Ve * (5 * dr), pt += Fe * (5 * rr), pt += Ue * (5 * le), pt += Je * (5 * Wt), pt += Lt * (5 * Zt), je += pt >>> 13, pt &= 8191, it = je, it += bt * Zt, it += ut * zt, it += ot * (5 * lr), it += Se * (5 * gr), it += Ae * (5 * Qt), je = it >>> 13, it &= 8191, it += Ve * (5 * pr), it += Fe * (5 * dr), it += Ue * (5 * rr), it += Je * (5 * le), it += Lt * (5 * Wt), je += it >>> 13, it &= 8191, et = je, et += bt * Wt, et += ut * Zt, et += ot * zt, et += Se * (5 * lr), et += Ae * (5 * gr), je = et >>> 13, et &= 8191, et += Ve * (5 * Qt), et += Fe * (5 * pr), et += Ue * (5 * dr), et += Je * (5 * rr), et += Lt * (5 * le), je += et >>> 13, et &= 8191, St = je, St += bt * le, St += ut * Wt, St += ot * Zt, St += Se * zt, St += Ae * (5 * lr), je = St >>> 13, St &= 8191, St += Ve * (5 * gr), St += Fe * (5 * Qt), St += Ue * (5 * pr), St += Je * (5 * dr), St += Lt * (5 * rr), je += St >>> 13, St &= 8191, Tt = je, Tt += bt * rr, Tt += ut * le, Tt += ot * Wt, Tt += Se * Zt, Tt += Ae * zt, je = Tt >>> 13, Tt &= 8191, Tt += Ve * (5 * lr), Tt += Fe * (5 * gr), Tt += Ue * (5 * Qt), Tt += Je * (5 * pr), Tt += Lt * (5 * dr), je += Tt >>> 13, Tt &= 8191, At = je, At += bt * dr, At += ut * rr, At += ot * le, At += Se * Wt, At += Ae * Zt, je = At >>> 13, At &= 8191, At += Ve * zt, At += Fe * (5 * lr), At += Ue * (5 * gr), At += Je * (5 * Qt), At += Lt * (5 * pr), je += At >>> 13, At &= 8191, _t = je, _t += bt * pr, _t += ut * dr, _t += ot * rr, _t += Se * le, _t += Ae * Wt, je = _t >>> 13, _t &= 8191, _t += Ve * Zt, _t += Fe * zt, _t += Ue * (5 * lr), _t += Je * (5 * gr), _t += Lt * (5 * Qt), je += _t >>> 13, _t &= 8191, ht = je, ht += bt * Qt, ht += ut * pr, ht += ot * dr, ht += Se * rr, ht += Ae * le, je = ht >>> 13, ht &= 8191, ht += Ve * Wt, ht += Fe * Zt, ht += Ue * zt, ht += Je * (5 * lr), ht += Lt * (5 * gr), je += ht >>> 13, ht &= 8191, xt = je, xt += bt * gr, xt += ut * Qt, xt += ot * pr, xt += Se * dr, xt += Ae * rr, je = xt >>> 13, xt &= 8191, xt += Ve * le, xt += Fe * Wt, xt += Ue * Zt, xt += Je * zt, xt += Lt * (5 * lr), je += xt >>> 13, xt &= 8191, st = je, st += bt * lr, st += ut * gr, st += ot * Qt, st += Se * pr, st += Ae * dr, je = st >>> 13, st &= 8191, st += Ve * rr, st += Fe * le, st += Ue * Wt, st += Je * Zt, st += Lt * zt, je += st >>> 13, st &= 8191, je = (je << 2) + je | 0, je = je + pt | 0, pt = je & 8191, je = je >>> 13, it += je, bt = pt, ut = it, ot = et, Se = St, Ae = Tt, Ve = At, Fe = _t, Ue = ht, Je = xt, Lt = st, U += 16, z -= 16; this.h[0] = bt, this.h[1] = ut, this.h[2] = ot, this.h[3] = Se, this.h[4] = Ae, this.h[5] = Ve, this.h[6] = Fe, this.h[7] = Ue, this.h[8] = Je, this.h[9] = Lt; }, Y.prototype.finish = function(k, U) { var z = new Uint16Array(10), C, G, j, se; @@ -40418,8 +40420,8 @@ var V9 = { exports: {} }; for (var C = 0; C < 16; C++) k[C] = U[C] - z[C]; } function D(k, U, z) { - var C, G, j = 0, se = 0, he = 0, xe = 0, Te = 0, Re = 0, nt = 0, je = 0, pt = 0, it = 0, et = 0, St = 0, Tt = 0, At = 0, _t = 0, ht = 0, xt = 0, st = 0, bt = 0, ut = 0, ot = 0, Se = 0, Ae = 0, Ve = 0, Fe = 0, Ue = 0, Je = 0, Lt = 0, zt = 0, Xt = 0, Wt = 0, le = z[0], rr = z[1], dr = z[2], pr = z[3], Zt = z[4], gr = z[5], lr = z[6], Rr = z[7], mr = z[8], yr = z[9], $r = z[10], Br = z[11], Ir = z[12], nn = z[13], sn = z[14], on = z[15]; - C = U[0], j += C * le, se += C * rr, he += C * dr, xe += C * pr, Te += C * Zt, Re += C * gr, nt += C * lr, je += C * Rr, pt += C * mr, it += C * yr, et += C * $r, St += C * Br, Tt += C * Ir, At += C * nn, _t += C * sn, ht += C * on, C = U[1], se += C * le, he += C * rr, xe += C * dr, Te += C * pr, Re += C * Zt, nt += C * gr, je += C * lr, pt += C * Rr, it += C * mr, et += C * yr, St += C * $r, Tt += C * Br, At += C * Ir, _t += C * nn, ht += C * sn, xt += C * on, C = U[2], he += C * le, xe += C * rr, Te += C * dr, Re += C * pr, nt += C * Zt, je += C * gr, pt += C * lr, it += C * Rr, et += C * mr, St += C * yr, Tt += C * $r, At += C * Br, _t += C * Ir, ht += C * nn, xt += C * sn, st += C * on, C = U[3], xe += C * le, Te += C * rr, Re += C * dr, nt += C * pr, je += C * Zt, pt += C * gr, it += C * lr, et += C * Rr, St += C * mr, Tt += C * yr, At += C * $r, _t += C * Br, ht += C * Ir, xt += C * nn, st += C * sn, bt += C * on, C = U[4], Te += C * le, Re += C * rr, nt += C * dr, je += C * pr, pt += C * Zt, it += C * gr, et += C * lr, St += C * Rr, Tt += C * mr, At += C * yr, _t += C * $r, ht += C * Br, xt += C * Ir, st += C * nn, bt += C * sn, ut += C * on, C = U[5], Re += C * le, nt += C * rr, je += C * dr, pt += C * pr, it += C * Zt, et += C * gr, St += C * lr, Tt += C * Rr, At += C * mr, _t += C * yr, ht += C * $r, xt += C * Br, st += C * Ir, bt += C * nn, ut += C * sn, ot += C * on, C = U[6], nt += C * le, je += C * rr, pt += C * dr, it += C * pr, et += C * Zt, St += C * gr, Tt += C * lr, At += C * Rr, _t += C * mr, ht += C * yr, xt += C * $r, st += C * Br, bt += C * Ir, ut += C * nn, ot += C * sn, Se += C * on, C = U[7], je += C * le, pt += C * rr, it += C * dr, et += C * pr, St += C * Zt, Tt += C * gr, At += C * lr, _t += C * Rr, ht += C * mr, xt += C * yr, st += C * $r, bt += C * Br, ut += C * Ir, ot += C * nn, Se += C * sn, Ae += C * on, C = U[8], pt += C * le, it += C * rr, et += C * dr, St += C * pr, Tt += C * Zt, At += C * gr, _t += C * lr, ht += C * Rr, xt += C * mr, st += C * yr, bt += C * $r, ut += C * Br, ot += C * Ir, Se += C * nn, Ae += C * sn, Ve += C * on, C = U[9], it += C * le, et += C * rr, St += C * dr, Tt += C * pr, At += C * Zt, _t += C * gr, ht += C * lr, xt += C * Rr, st += C * mr, bt += C * yr, ut += C * $r, ot += C * Br, Se += C * Ir, Ae += C * nn, Ve += C * sn, Fe += C * on, C = U[10], et += C * le, St += C * rr, Tt += C * dr, At += C * pr, _t += C * Zt, ht += C * gr, xt += C * lr, st += C * Rr, bt += C * mr, ut += C * yr, ot += C * $r, Se += C * Br, Ae += C * Ir, Ve += C * nn, Fe += C * sn, Ue += C * on, C = U[11], St += C * le, Tt += C * rr, At += C * dr, _t += C * pr, ht += C * Zt, xt += C * gr, st += C * lr, bt += C * Rr, ut += C * mr, ot += C * yr, Se += C * $r, Ae += C * Br, Ve += C * Ir, Fe += C * nn, Ue += C * sn, Je += C * on, C = U[12], Tt += C * le, At += C * rr, _t += C * dr, ht += C * pr, xt += C * Zt, st += C * gr, bt += C * lr, ut += C * Rr, ot += C * mr, Se += C * yr, Ae += C * $r, Ve += C * Br, Fe += C * Ir, Ue += C * nn, Je += C * sn, Lt += C * on, C = U[13], At += C * le, _t += C * rr, ht += C * dr, xt += C * pr, st += C * Zt, bt += C * gr, ut += C * lr, ot += C * Rr, Se += C * mr, Ae += C * yr, Ve += C * $r, Fe += C * Br, Ue += C * Ir, Je += C * nn, Lt += C * sn, zt += C * on, C = U[14], _t += C * le, ht += C * rr, xt += C * dr, st += C * pr, bt += C * Zt, ut += C * gr, ot += C * lr, Se += C * Rr, Ae += C * mr, Ve += C * yr, Fe += C * $r, Ue += C * Br, Je += C * Ir, Lt += C * nn, zt += C * sn, Xt += C * on, C = U[15], ht += C * le, xt += C * rr, st += C * dr, bt += C * pr, ut += C * Zt, ot += C * gr, Se += C * lr, Ae += C * Rr, Ve += C * mr, Fe += C * yr, Ue += C * $r, Je += C * Br, Lt += C * Ir, zt += C * nn, Xt += C * sn, Wt += C * on, j += 38 * xt, se += 38 * st, he += 38 * bt, xe += 38 * ut, Te += 38 * ot, Re += 38 * Se, nt += 38 * Ae, je += 38 * Ve, pt += 38 * Fe, it += 38 * Ue, et += 38 * Je, St += 38 * Lt, Tt += 38 * zt, At += 38 * Xt, _t += 38 * Wt, G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = he + G + 65535, G = Math.floor(C / 65536), he = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = he + G + 65535, G = Math.floor(C / 65536), he = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), k[0] = j, k[1] = se, k[2] = he, k[3] = xe, k[4] = Te, k[5] = Re, k[6] = nt, k[7] = je, k[8] = pt, k[9] = it, k[10] = et, k[11] = St, k[12] = Tt, k[13] = At, k[14] = _t, k[15] = ht; + var C, G, j = 0, se = 0, he = 0, xe = 0, Te = 0, Re = 0, nt = 0, je = 0, pt = 0, it = 0, et = 0, St = 0, Tt = 0, At = 0, _t = 0, ht = 0, xt = 0, st = 0, bt = 0, ut = 0, ot = 0, Se = 0, Ae = 0, Ve = 0, Fe = 0, Ue = 0, Je = 0, Lt = 0, zt = 0, Zt = 0, Wt = 0, le = z[0], rr = z[1], dr = z[2], pr = z[3], Qt = z[4], gr = z[5], lr = z[6], Rr = z[7], mr = z[8], yr = z[9], $r = z[10], Br = z[11], Ir = z[12], nn = z[13], sn = z[14], on = z[15]; + C = U[0], j += C * le, se += C * rr, he += C * dr, xe += C * pr, Te += C * Qt, Re += C * gr, nt += C * lr, je += C * Rr, pt += C * mr, it += C * yr, et += C * $r, St += C * Br, Tt += C * Ir, At += C * nn, _t += C * sn, ht += C * on, C = U[1], se += C * le, he += C * rr, xe += C * dr, Te += C * pr, Re += C * Qt, nt += C * gr, je += C * lr, pt += C * Rr, it += C * mr, et += C * yr, St += C * $r, Tt += C * Br, At += C * Ir, _t += C * nn, ht += C * sn, xt += C * on, C = U[2], he += C * le, xe += C * rr, Te += C * dr, Re += C * pr, nt += C * Qt, je += C * gr, pt += C * lr, it += C * Rr, et += C * mr, St += C * yr, Tt += C * $r, At += C * Br, _t += C * Ir, ht += C * nn, xt += C * sn, st += C * on, C = U[3], xe += C * le, Te += C * rr, Re += C * dr, nt += C * pr, je += C * Qt, pt += C * gr, it += C * lr, et += C * Rr, St += C * mr, Tt += C * yr, At += C * $r, _t += C * Br, ht += C * Ir, xt += C * nn, st += C * sn, bt += C * on, C = U[4], Te += C * le, Re += C * rr, nt += C * dr, je += C * pr, pt += C * Qt, it += C * gr, et += C * lr, St += C * Rr, Tt += C * mr, At += C * yr, _t += C * $r, ht += C * Br, xt += C * Ir, st += C * nn, bt += C * sn, ut += C * on, C = U[5], Re += C * le, nt += C * rr, je += C * dr, pt += C * pr, it += C * Qt, et += C * gr, St += C * lr, Tt += C * Rr, At += C * mr, _t += C * yr, ht += C * $r, xt += C * Br, st += C * Ir, bt += C * nn, ut += C * sn, ot += C * on, C = U[6], nt += C * le, je += C * rr, pt += C * dr, it += C * pr, et += C * Qt, St += C * gr, Tt += C * lr, At += C * Rr, _t += C * mr, ht += C * yr, xt += C * $r, st += C * Br, bt += C * Ir, ut += C * nn, ot += C * sn, Se += C * on, C = U[7], je += C * le, pt += C * rr, it += C * dr, et += C * pr, St += C * Qt, Tt += C * gr, At += C * lr, _t += C * Rr, ht += C * mr, xt += C * yr, st += C * $r, bt += C * Br, ut += C * Ir, ot += C * nn, Se += C * sn, Ae += C * on, C = U[8], pt += C * le, it += C * rr, et += C * dr, St += C * pr, Tt += C * Qt, At += C * gr, _t += C * lr, ht += C * Rr, xt += C * mr, st += C * yr, bt += C * $r, ut += C * Br, ot += C * Ir, Se += C * nn, Ae += C * sn, Ve += C * on, C = U[9], it += C * le, et += C * rr, St += C * dr, Tt += C * pr, At += C * Qt, _t += C * gr, ht += C * lr, xt += C * Rr, st += C * mr, bt += C * yr, ut += C * $r, ot += C * Br, Se += C * Ir, Ae += C * nn, Ve += C * sn, Fe += C * on, C = U[10], et += C * le, St += C * rr, Tt += C * dr, At += C * pr, _t += C * Qt, ht += C * gr, xt += C * lr, st += C * Rr, bt += C * mr, ut += C * yr, ot += C * $r, Se += C * Br, Ae += C * Ir, Ve += C * nn, Fe += C * sn, Ue += C * on, C = U[11], St += C * le, Tt += C * rr, At += C * dr, _t += C * pr, ht += C * Qt, xt += C * gr, st += C * lr, bt += C * Rr, ut += C * mr, ot += C * yr, Se += C * $r, Ae += C * Br, Ve += C * Ir, Fe += C * nn, Ue += C * sn, Je += C * on, C = U[12], Tt += C * le, At += C * rr, _t += C * dr, ht += C * pr, xt += C * Qt, st += C * gr, bt += C * lr, ut += C * Rr, ot += C * mr, Se += C * yr, Ae += C * $r, Ve += C * Br, Fe += C * Ir, Ue += C * nn, Je += C * sn, Lt += C * on, C = U[13], At += C * le, _t += C * rr, ht += C * dr, xt += C * pr, st += C * Qt, bt += C * gr, ut += C * lr, ot += C * Rr, Se += C * mr, Ae += C * yr, Ve += C * $r, Fe += C * Br, Ue += C * Ir, Je += C * nn, Lt += C * sn, zt += C * on, C = U[14], _t += C * le, ht += C * rr, xt += C * dr, st += C * pr, bt += C * Qt, ut += C * gr, ot += C * lr, Se += C * Rr, Ae += C * mr, Ve += C * yr, Fe += C * $r, Ue += C * Br, Je += C * Ir, Lt += C * nn, zt += C * sn, Zt += C * on, C = U[15], ht += C * le, xt += C * rr, st += C * dr, bt += C * pr, ut += C * Qt, ot += C * gr, Se += C * lr, Ae += C * Rr, Ve += C * mr, Fe += C * yr, Ue += C * $r, Je += C * Br, Lt += C * Ir, zt += C * nn, Zt += C * sn, Wt += C * on, j += 38 * xt, se += 38 * st, he += 38 * bt, xe += 38 * ut, Te += 38 * ot, Re += 38 * Se, nt += 38 * Ae, je += 38 * Ve, pt += 38 * Fe, it += 38 * Ue, et += 38 * Je, St += 38 * Lt, Tt += 38 * zt, At += 38 * Zt, _t += 38 * Wt, G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = he + G + 65535, G = Math.floor(C / 65536), he = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = he + G + 65535, G = Math.floor(C / 65536), he = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), k[0] = j, k[1] = se, k[2] = he, k[3] = xe, k[4] = Te, k[5] = Re, k[6] = nt, k[7] = je, k[8] = pt, k[9] = it, k[10] = et, k[11] = St, k[12] = Tt, k[13] = At, k[14] = _t, k[15] = ht; } function oe(k, U) { D(k, U, U); @@ -40632,14 +40634,14 @@ var V9 = { exports: {} }; 1246189591 ]; function De(k, U, z, C) { - for (var G = new Int32Array(16), j = new Int32Array(16), se, he, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt, ut, ot, Se, Ae, Ve, Fe, Ue, Je, Lt = k[0], zt = k[1], Xt = k[2], Wt = k[3], le = k[4], rr = k[5], dr = k[6], pr = k[7], Zt = U[0], gr = U[1], lr = U[2], Rr = U[3], mr = U[4], yr = U[5], $r = U[6], Br = U[7], Ir = 0; C >= 128; ) { + for (var G = new Int32Array(16), j = new Int32Array(16), se, he, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt, ut, ot, Se, Ae, Ve, Fe, Ue, Je, Lt = k[0], zt = k[1], Zt = k[2], Wt = k[3], le = k[4], rr = k[5], dr = k[6], pr = k[7], Qt = U[0], gr = U[1], lr = U[2], Rr = U[3], mr = U[4], yr = U[5], $r = U[6], Br = U[7], Ir = 0; C >= 128; ) { for (ut = 0; ut < 16; ut++) ot = 8 * ut + Ir, G[ut] = z[ot + 0] << 24 | z[ot + 1] << 16 | z[ot + 2] << 8 | z[ot + 3], j[ut] = z[ot + 4] << 24 | z[ot + 5] << 16 | z[ot + 6] << 8 | z[ot + 7]; for (ut = 0; ut < 80; ut++) - if (se = Lt, he = zt, xe = Xt, Te = Wt, Re = le, nt = rr, je = dr, pt = pr, it = Zt, et = gr, St = lr, Tt = Rr, At = mr, _t = yr, ht = $r, xt = Br, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (le >>> 14 | mr << 18) ^ (le >>> 18 | mr << 14) ^ (mr >>> 9 | le << 23), Ae = (mr >>> 14 | le << 18) ^ (mr >>> 18 | le << 14) ^ (le >>> 9 | mr << 23), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = le & rr ^ ~le & dr, Ae = mr & yr ^ ~mr & $r, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Pe[ut * 2], Ae = Pe[ut * 2 + 1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = G[ut % 16], Ae = j[ut % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, st = Ue & 65535 | Je << 16, bt = Ve & 65535 | Fe << 16, Se = st, Ae = bt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (Lt >>> 28 | Zt << 4) ^ (Zt >>> 2 | Lt << 30) ^ (Zt >>> 7 | Lt << 25), Ae = (Zt >>> 28 | Lt << 4) ^ (Lt >>> 2 | Zt << 30) ^ (Lt >>> 7 | Zt << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Lt & zt ^ Lt & Xt ^ zt & Xt, Ae = Zt & gr ^ Zt & lr ^ gr & lr, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, pt = Ue & 65535 | Je << 16, xt = Ve & 65535 | Fe << 16, Se = Te, Ae = Tt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = st, Ae = bt, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, Te = Ue & 65535 | Je << 16, Tt = Ve & 65535 | Fe << 16, zt = se, Xt = he, Wt = xe, le = Te, rr = Re, dr = nt, pr = je, Lt = pt, gr = it, lr = et, Rr = St, mr = Tt, yr = At, $r = _t, Br = ht, Zt = xt, ut % 16 === 15) + if (se = Lt, he = zt, xe = Zt, Te = Wt, Re = le, nt = rr, je = dr, pt = pr, it = Qt, et = gr, St = lr, Tt = Rr, At = mr, _t = yr, ht = $r, xt = Br, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (le >>> 14 | mr << 18) ^ (le >>> 18 | mr << 14) ^ (mr >>> 9 | le << 23), Ae = (mr >>> 14 | le << 18) ^ (mr >>> 18 | le << 14) ^ (le >>> 9 | mr << 23), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = le & rr ^ ~le & dr, Ae = mr & yr ^ ~mr & $r, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Pe[ut * 2], Ae = Pe[ut * 2 + 1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = G[ut % 16], Ae = j[ut % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, st = Ue & 65535 | Je << 16, bt = Ve & 65535 | Fe << 16, Se = st, Ae = bt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (Lt >>> 28 | Qt << 4) ^ (Qt >>> 2 | Lt << 30) ^ (Qt >>> 7 | Lt << 25), Ae = (Qt >>> 28 | Lt << 4) ^ (Lt >>> 2 | Qt << 30) ^ (Lt >>> 7 | Qt << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Lt & zt ^ Lt & Zt ^ zt & Zt, Ae = Qt & gr ^ Qt & lr ^ gr & lr, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, pt = Ue & 65535 | Je << 16, xt = Ve & 65535 | Fe << 16, Se = Te, Ae = Tt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = st, Ae = bt, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, Te = Ue & 65535 | Je << 16, Tt = Ve & 65535 | Fe << 16, zt = se, Zt = he, Wt = xe, le = Te, rr = Re, dr = nt, pr = je, Lt = pt, gr = it, lr = et, Rr = St, mr = Tt, yr = At, $r = _t, Br = ht, Qt = xt, ut % 16 === 15) for (ot = 0; ot < 16; ot++) Se = G[ot], Ae = j[ot], Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = G[(ot + 9) % 16], Ae = j[(ot + 9) % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, st = G[(ot + 1) % 16], bt = j[(ot + 1) % 16], Se = (st >>> 1 | bt << 31) ^ (st >>> 8 | bt << 24) ^ st >>> 7, Ae = (bt >>> 1 | st << 31) ^ (bt >>> 8 | st << 24) ^ (bt >>> 7 | st << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, st = G[(ot + 14) % 16], bt = j[(ot + 14) % 16], Se = (st >>> 19 | bt << 13) ^ (bt >>> 29 | st << 3) ^ st >>> 6, Ae = (bt >>> 19 | st << 13) ^ (st >>> 29 | bt << 3) ^ (bt >>> 6 | st << 26), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, G[ot] = Ue & 65535 | Je << 16, j[ot] = Ve & 65535 | Fe << 16; - Se = Lt, Ae = Zt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[0], Ae = U[0], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[0] = Lt = Ue & 65535 | Je << 16, U[0] = Zt = Ve & 65535 | Fe << 16, Se = zt, Ae = gr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[1], Ae = U[1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[1] = zt = Ue & 65535 | Je << 16, U[1] = gr = Ve & 65535 | Fe << 16, Se = Xt, Ae = lr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[2], Ae = U[2], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[2] = Xt = Ue & 65535 | Je << 16, U[2] = lr = Ve & 65535 | Fe << 16, Se = Wt, Ae = Rr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[3], Ae = U[3], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[3] = Wt = Ue & 65535 | Je << 16, U[3] = Rr = Ve & 65535 | Fe << 16, Se = le, Ae = mr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[4], Ae = U[4], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[4] = le = Ue & 65535 | Je << 16, U[4] = mr = Ve & 65535 | Fe << 16, Se = rr, Ae = yr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[5], Ae = U[5], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[5] = rr = Ue & 65535 | Je << 16, U[5] = yr = Ve & 65535 | Fe << 16, Se = dr, Ae = $r, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[6], Ae = U[6], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[6] = dr = Ue & 65535 | Je << 16, U[6] = $r = Ve & 65535 | Fe << 16, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[7], Ae = U[7], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[7] = pr = Ue & 65535 | Je << 16, U[7] = Br = Ve & 65535 | Fe << 16, Ir += 128, C -= 128; + Se = Lt, Ae = Qt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[0], Ae = U[0], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[0] = Lt = Ue & 65535 | Je << 16, U[0] = Qt = Ve & 65535 | Fe << 16, Se = zt, Ae = gr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[1], Ae = U[1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[1] = zt = Ue & 65535 | Je << 16, U[1] = gr = Ve & 65535 | Fe << 16, Se = Zt, Ae = lr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[2], Ae = U[2], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[2] = Zt = Ue & 65535 | Je << 16, U[2] = lr = Ve & 65535 | Fe << 16, Se = Wt, Ae = Rr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[3], Ae = U[3], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[3] = Wt = Ue & 65535 | Je << 16, U[3] = Rr = Ve & 65535 | Fe << 16, Se = le, Ae = mr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[4], Ae = U[4], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[4] = le = Ue & 65535 | Je << 16, U[4] = mr = Ve & 65535 | Fe << 16, Se = rr, Ae = yr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[5], Ae = U[5], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[5] = rr = Ue & 65535 | Je << 16, U[5] = yr = Ve & 65535 | Fe << 16, Se = dr, Ae = $r, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[6], Ae = U[6], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[6] = dr = Ue & 65535 | Je << 16, U[6] = $r = Ve & 65535 | Fe << 16, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[7], Ae = U[7], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[7] = pr = Ue & 65535 | Je << 16, U[7] = Br = Ve & 65535 | Fe << 16, Ir += 128, C -= 128; } return C; } @@ -40726,7 +40728,7 @@ var V9 = { exports: {} }; for (G = 0; G < z; G++) k[G] = U[G + 64]; return z; } - var tt = 32, Ye = 24, dt = 32, lt = 16, ct = 32, qt = 32, Yt = 32, Et = 32, er = 32, Jt = Ye, Dt = dt, kt = lt, Ct = 64, gt = 32, Rt = 64, Nt = 32, vt = 64; + var tt = 32, Ye = 24, dt = 32, lt = 16, ct = 32, qt = 32, Jt = 32, Et = 32, er = 32, Xt = Ye, Dt = dt, kt = lt, Ct = 64, gt = 32, Rt = 64, Nt = 32, vt = 64; e.lowlevel = { crypto_core_hsalsa20: V, crypto_stream_xor: Ee, @@ -40756,10 +40758,10 @@ var V9 = { exports: {} }; crypto_secretbox_BOXZEROBYTES: lt, crypto_scalarmult_BYTES: ct, crypto_scalarmult_SCALARBYTES: qt, - crypto_box_PUBLICKEYBYTES: Yt, + crypto_box_PUBLICKEYBYTES: Jt, crypto_box_SECRETKEYBYTES: Et, crypto_box_BEFORENMBYTES: er, - crypto_box_NONCEBYTES: Jt, + crypto_box_NONCEBYTES: Xt, crypto_box_ZEROBYTES: Dt, crypto_box_BOXZEROBYTES: kt, crypto_sign_BYTES: Ct, @@ -40788,7 +40790,7 @@ var V9 = { exports: {} }; if (U.length !== Ye) throw new Error("bad nonce size"); } function Ft(k, U) { - if (k.length !== Yt) throw new Error("bad public key size"); + if (k.length !== Jt) throw new Error("bad public key size"); if (U.length !== Et) throw new Error("bad secret key size"); } function rt() { @@ -40830,14 +40832,14 @@ var V9 = { exports: {} }; var G = e.box.before(z, C); return e.secretbox.open(k, U, G); }, e.box.open.after = e.secretbox.open, e.box.keyPair = function() { - var k = new Uint8Array(Yt), U = new Uint8Array(Et); + var k = new Uint8Array(Jt), U = new Uint8Array(Et); return X(k, U), { publicKey: k, secretKey: U }; }, e.box.keyPair.fromSecretKey = function(k) { if (rt(k), k.length !== Et) throw new Error("bad secret key size"); - var U = new Uint8Array(Yt); + var U = new Uint8Array(Jt); return T(U, k), { publicKey: U, secretKey: new Uint8Array(k) }; - }, e.box.publicKeyLength = Yt, e.box.secretKeyLength = Et, e.box.sharedKeyLength = er, e.box.nonceLength = Jt, e.box.overheadLength = e.secretbox.overheadLength, e.sign = function(k, U) { + }, e.box.publicKeyLength = Jt, e.box.secretKeyLength = Et, e.box.sharedKeyLength = er, e.box.nonceLength = Xt, e.box.overheadLength = e.secretbox.overheadLength, e.sign = function(k, U) { if (rt(k, U), U.length !== Rt) throw new Error("bad secret key size"); var z = new Uint8Array(Ct + k.length); @@ -43017,7 +43019,7 @@ function Gm(t) { return /* @__PURE__ */ pe.jsx("button", { onClick: r, className: "xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center", children: e }); } function eA(t) { - const { wallet: e, connector: r, loading: n } = t, i = Zn(null), s = Zn(), [o, a] = Qt(), [u, l] = Qt(), [d, p] = Qt("connect"), [w, A] = Qt(!1), [M, N] = Qt(); + const { wallet: e, connector: r, loading: n } = t, i = Zn(null), s = Zn(), [o, a] = Yt(), [u, l] = Yt(), [d, p] = Yt("connect"), [w, A] = Yt(!1), [M, N] = Yt(); function L(K) { var ge; (ge = s.current) == null || ge.update({ @@ -43106,7 +43108,7 @@ function eA(t) { ] }); } function cse(t) { - const [e, r] = Qt(""), [n, i] = Qt(), [s, o] = Qt(), a = cy(), [u, l] = Qt(!1); + const [e, r] = Yt(""), [n, i] = Yt(), [s, o] = Yt(), a = cy(), [u, l] = Yt(!1); async function d(w) { var M, N; if (!w || !((M = w.connectItems) != null && M.tonProof)) return; @@ -43204,7 +43206,7 @@ function use() { ] }); } function rA(t) { - const { wallets: e } = mp(), [r, n] = Qt(), i = wi(() => r ? e.filter((a) => a.key.toLowerCase().includes(r.toLowerCase())) : e, [r]); + const { wallets: e } = mp(), [r, n] = Yt(), i = wi(() => r ? e.filter((a) => a.key.toLowerCase().includes(r.toLowerCase())) : e, [r]); function s(a) { t.onSelectWallet(a); } @@ -43228,7 +43230,7 @@ function rA(t) { ] }); } function woe(t) { - const { onLogin: e, header: r, showEmailSignIn: n = !0, showMoreWallets: i = !0, showTonConnect: s = !0, showFeaturedWallets: o = !0 } = t, [a, u] = Qt(""), [l, d] = Qt(null), [p, w] = Qt(""); + const { onLogin: e, header: r, showEmailSignIn: n = !0, showMoreWallets: i = !0, showTonConnect: s = !0, showFeaturedWallets: o = !0 } = t, [a, u] = Yt(""), [l, d] = Yt(null), [p, w] = Yt(""); function A(B) { d(B), u("evm-wallet"); } @@ -43288,7 +43290,7 @@ function woe(t) { ] }) }); } function fse(t) { - const { wallet: e, onConnect: r } = t, [n, i] = Qt(e.installed ? "connect" : "qr"); + const { wallet: e, onConnect: r } = t, [n, i] = Yt(e.installed ? "connect" : "qr"); async function s(o, a) { await r(o, a); } @@ -43314,7 +43316,7 @@ function fse(t) { ] }); } function lse(t) { - const { email: e } = t, [r, n] = Qt("captcha"); + const { email: e } = t, [r, n] = Yt("captcha"); return /* @__PURE__ */ pe.jsxs(Ms, { children: [ /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ pe.jsx(Pc, { title: "Sign in with email", onBack: t.onBack }) }), r === "captcha" && /* @__PURE__ */ pe.jsx($9, { email: e, onCodeSend: () => n("verify-email") }), @@ -43327,7 +43329,7 @@ function xoe(t) { showFeaturedWallets: !0, showMoreWallets: !0, showTonConnect: !0 - } } = t, [s, o] = Qt(""), [a, u] = Qt(), [l, d] = Qt(), p = Zn(), [w, A] = Qt(""); + } } = t, [s, o] = Yt(""), [a, u] = Yt(), [l, d] = Yt(), p = Zn(), [w, A] = Yt(""); function M(H) { u(H), o("evm-wallet-connect"); } diff --git a/dist/providers/codatta-signin-context-provider.d.ts b/dist/providers/codatta-signin-context-provider.d.ts index 306a0cd..5a6133f 100644 --- a/dist/providers/codatta-signin-context-provider.d.ts +++ b/dist/providers/codatta-signin-context-provider.d.ts @@ -4,8 +4,11 @@ export interface CodattaSigninConfig { device: TDeviceType; app: string; inviterCode: string; + role?: "B" | "C"; } -export declare function useCodattaSigninContext(): CodattaSigninConfig; +export declare function useCodattaSigninContext(): CodattaSigninConfig & { + role: "B" | "C"; +}; interface CodattaConnectContextProviderProps { children: React.ReactNode; config: CodattaSigninConfig; diff --git a/dist/secp256k1-zOw5-Bh-.js b/dist/secp256k1-C2LQAh0i.js similarity index 99% rename from dist/secp256k1-zOw5-Bh-.js rename to dist/secp256k1-C2LQAh0i.js index a52d062..b338a6a 100644 --- a/dist/secp256k1-zOw5-Bh-.js +++ b/dist/secp256k1-C2LQAh0i.js @@ -1,4 +1,4 @@ -import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-BPYw2mdm.js"; +import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-ChUtI_2i.js"; class Kt extends ee { constructor(n, t) { super(), this.finished = !1, this.destroyed = !1, ne(n); diff --git a/package.json b/package.json index a3620cf..b9d6775 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codatta-connect", - "version": "2.3.2-SPC003", + "version": "2.4.2", "type": "module", "main": "./dist/index.umd.js", "module": "./dist/index.es.js", diff --git a/src/views/login-view.tsx b/src/views/login-view.tsx index c37c1a2..0533918 100644 --- a/src/views/login-view.tsx +++ b/src/views/login-view.tsx @@ -74,6 +74,7 @@ export default function LoginView() { device:'WEB', app:'test', inviterCode:'', + role: 'B' }}> ) From 364a85dcac969503f43082695db8af21f46f3837 Mon Sep 17 00:00:00 2001 From: Meow Lord Date: Wed, 4 Jun 2025 10:25:35 +0800 Subject: [PATCH 12/25] feat: fix lastusedwallet, and release 2.4.3 --- lib/codatta-connect-context-provider.tsx | 31 ++++++++- lib/types/wallet-item.class.ts | 4 ++ src/views/login-view.tsx | 88 +++++++++++++----------- 3 files changed, 79 insertions(+), 44 deletions(-) diff --git a/lib/codatta-connect-context-provider.tsx b/lib/codatta-connect-context-provider.tsx index ec02c11..38914f9 100644 --- a/lib/codatta-connect-context-provider.tsx +++ b/lib/codatta-connect-context-provider.tsx @@ -55,6 +55,13 @@ interface CodattaConnectContextProviderProps { apiBaseUrl?: string } + +interface LastUsedWalletInfo { + provider: 'UniversalProvider' | 'EIP1193Provider', + key: string, + timestamp: number +} + export function CodattaConnectContextProvider(props: CodattaConnectContextProviderProps) { const { apiBaseUrl } = props const [wallets, setWallets] = useState([]) @@ -63,7 +70,15 @@ export function CodattaConnectContextProvider(props: CodattaConnectContextProvid const [initialized, setInitialized] = useState(false) const saveLastUsedWallet = (wallet: WalletItem) => { - console.log('saveLastUsedWallet', wallet) + setLastUsedWallet(wallet) + + const providerType = wallet.provider instanceof UniversalProvider ? 'UniversalProvider' : 'EIP1193Provider' + const lastUsedInfo: LastUsedWalletInfo = { + provider: providerType, + key: wallet.key, + timestamp: Date.now() + } + localStorage.setItem('xn-last-used-info', JSON.stringify(lastUsedInfo)) } function sortWallet(wallets: WalletItem[]) { @@ -105,14 +120,24 @@ export function CodattaConnectContextProvider(props: CodattaConnectContextProvid // handle last used wallet info and restore walletconnect UniveralProvider try { - const lastUsedInfo = JSON.parse(localStorage.getItem('xn-last-used-info') || '{}') + const lastUsedInfo = JSON.parse(localStorage.getItem('xn-last-used-info') || '{}') as LastUsedWalletInfo const lastUsedWallet = walletMap.get(lastUsedInfo.key) if (lastUsedWallet) { lastUsedWallet.lastUsed = true + + // Restore provider based on the saved provider type if (lastUsedInfo.provider === 'UniversalProvider') { const provider = await UniversalProvider.init(walletConnectConfig) - if (provider.session) lastUsedWallet.setUniversalProvider(provider) + if (provider.session) { + lastUsedWallet.setUniversalProvider(provider) + console.log('Restored UniversalProvider for wallet:', lastUsedWallet.key) + } + } else if (lastUsedInfo.provider === 'EIP1193Provider' && lastUsedWallet.installed) { + // For EIP1193 providers, if the wallet is installed, it should already have the provider + // from the EIP6963 detection process above + console.log('Using detected EIP1193Provider for wallet:', lastUsedWallet.key) } + setLastUsedWallet(lastUsedWallet) } } catch (err) { diff --git a/lib/types/wallet-item.class.ts b/lib/types/wallet-item.class.ts index a52c1d1..b9f209e 100644 --- a/lib/types/wallet-item.class.ts +++ b/lib/types/wallet-item.class.ts @@ -34,6 +34,10 @@ export class WalletItem { return this._installed } + public get provider() { + return this._provider + } + public get client(): WalletClient | null { if (!this._provider) return null diff --git a/src/views/login-view.tsx b/src/views/login-view.tsx index 0533918..d23faad 100644 --- a/src/views/login-view.tsx +++ b/src/views/login-view.tsx @@ -1,75 +1,81 @@ -import accountApi, { ILoginResponse } from '../../lib/api/account.api' -import { EmvWalletConnectInfo, TonWalletConnectInfo } from '../../lib/codatta-connect' -import { CodattaSignin, CodattaConnect } from '../../lib/main' -import React from 'react' +import accountApi, { ILoginResponse } from "../../lib/api/account.api"; +import { + EmvWalletConnectInfo, + TonWalletConnectInfo, +} from "../../lib/codatta-connect"; +import { CodattaSignin, CodattaConnect, useCodattaConnectContext } from "../../lib/main"; +import React, { useEffect } from "react"; export default function LoginView() { + const { lastUsedWallet } = useCodattaConnectContext(); + + useEffect(() => { + console.log(lastUsedWallet, 'lastUsedWallet change') + }, [lastUsedWallet]) async function handleLogin(res: ILoginResponse) { - localStorage.setItem('auth', res.token) + localStorage.setItem("auth", res.token); } async function handleEmailConnect(email: string, code: string) { const data = await accountApi.bindEmail({ - account_type: 'email', - connector: 'codatta_email', - account_enum: 'C', + account_type: "email", + connector: "codatta_email", + account_enum: "C", email_code: code, email: email, - }) + }); } async function handleTonWalletConnect(info: TonWalletConnectInfo) { + const account = info.connect_info.account; + const connectItems = info.connect_info.connectItems; - const account = info.connect_info.account - const connectItems = info.connect_info.connectItems - - if (!connectItems?.tonProof) return + if (!connectItems?.tonProof) return; const data = await accountApi.bindTonWallet({ - account_type: 'block_chain', - connector: 'codatta_ton', - account_enum: 'C', + account_type: "block_chain", + connector: "codatta_ton", + account_enum: "C", chain: info.connect_info.account.chain, wallet_name: info.connect_info.device.appName, address: info.connect_info.account.address, connect_info: [ - { name: 'ton_addr', network: account.chain, ...account }, - connectItems.tonProof + { name: "ton_addr", network: account.chain, ...account }, + connectItems.tonProof, ], - }) + }); } async function handleEvmWalletConnect(info: EmvWalletConnectInfo) { const data = await accountApi.bindEvmWallet({ - account_type: 'block_chain', - connector: 'codatta_wallet', - account_enum: 'C', + account_type: "block_chain", + connector: "codatta_wallet", + account_enum: "C", chain: (await info.client.getChainId()).toString(), address: (await info.client.getAddresses())[0], signature: info.connect_info.signature, nonce: info.connect_info.nonce, wallet_name: info.connect_info.wallet_name, message: info.connect_info.message, - }) - console.log(data) + }); + console.log(data); } - - return (<> - - {/* */} - + {/* */} + - ) -} \ No newline at end of file + ); +} From 5edec0bf0de7792a00722967cdae0d9b5f672e3c Mon Sep 17 00:00:00 2001 From: Meow Lord Date: Wed, 4 Jun 2025 10:27:17 +0800 Subject: [PATCH 13/25] release 2.4.3 --- dist/index.es.js | 2 +- dist/index.umd.js | 66 +- dist/{main-ChUtI_2i.js => main-C4Op-TDI.js} | 3451 +++++++++-------- ...56k1-C2LQAh0i.js => secp256k1-CNxaHocU.js} | 2 +- dist/types/wallet-item.class.d.ts | 5 + package.json | 2 +- 6 files changed, 1771 insertions(+), 1757 deletions(-) rename dist/{main-ChUtI_2i.js => main-C4Op-TDI.js} (95%) rename dist/{secp256k1-C2LQAh0i.js => secp256k1-CNxaHocU.js} (99%) diff --git a/dist/index.es.js b/dist/index.es.js index 117ce64..f205774 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -1,4 +1,4 @@ -import { f as o, C as n, d as e, a as C, u as s } from "./main-ChUtI_2i.js"; +import { f as o, C as n, d as e, a as C, u as s } from "./main-C4Op-TDI.js"; export { o as CodattaConnect, n as CodattaConnectContextProvider, diff --git a/dist/index.umd.js b/dist/index.umd.js index 3e709a1..69bcff0 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Wy;function XA(){if(Wy)return gf;Wy=1;var t=Se,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,u,l){var d,p={},y=null,A=null;l!==void 0&&(y=""+l),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(A=u.ref);for(d in u)n.call(u,d)&&!s.hasOwnProperty(d)&&(p[d]=u[d]);if(a&&a.defaultProps)for(d in u=a.defaultProps,u)p[d]===void 0&&(p[d]=u[d]);return{$$typeof:e,type:a,key:y,ref:A,props:p,_owner:i.current}}return gf.Fragment=r,gf.jsx=o,gf.jsxs=o,gf}var mf={};/** + */var Ky;function XA(){if(Ky)return gf;Ky=1;var t=Se,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,u,l){var d,p={},y=null,A=null;l!==void 0&&(y=""+l),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(A=u.ref);for(d in u)n.call(u,d)&&!s.hasOwnProperty(d)&&(p[d]=u[d]);if(a&&a.defaultProps)for(d in u=a.defaultProps,u)p[d]===void 0&&(p[d]=u[d]);return{$$typeof:e,type:a,key:y,ref:A,props:p,_owner:i.current}}return gf.Fragment=r,gf.jsx=o,gf.jsxs=o,gf}var mf={};/** * @license React * react-jsx-runtime.development.js * @@ -14,7 +14,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ky;function ZA(){return Ky||(Ky=1,process.env.NODE_ENV!=="production"&&function(){var t=Se,e=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),A=Symbol.for("react.offscreen"),P=Symbol.iterator,N="@@iterator";function D(q){if(q===null||typeof q!="object")return null;var oe=P&&q[P]||q[N];return typeof oe=="function"?oe:null}var k=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function B(q){{for(var oe=arguments.length,pe=new Array(oe>1?oe-1:0),xe=1;xe1?oe-1:0),xe=1;xe=1&&tt>=0&&Ue[st]!==gt[tt];)tt--;for(;st>=1&&tt>=0;st--,tt--)if(Ue[st]!==gt[tt]){if(st!==1||tt!==1)do if(st--,tt--,tt<0||Ue[st]!==gt[tt]){var At=` @@ -27,29 +27,29 @@ Check the top-level render call using <`+pe+">.")}return oe}}function bt(q,oe){{ <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; - <%s key={someKey} {...props} />`,dt,Mt,_t,Mt),Ft[Mt+dt]=!0}}return q===n?nt(tt):jt(tt),tt}}function H(q,oe,pe){return $(q,oe,pe,!0)}function V(q,oe,pe){return $(q,oe,pe,!1)}var C=V,Y=H;mf.Fragment=n,mf.jsx=C,mf.jsxs=Y}()),mf}process.env.NODE_ENV==="production"?Xp.exports=XA():Xp.exports=ZA();var ge=Xp.exports;const Rs="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2",QA=[{featured:!0,name:"MetaMask",rdns:"io.metamask",image:`${Rs}#metamask`,getWallet:{chrome_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",brave_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",edge_addon_id:"ejbalbakoplchlghecdalmeeeajnimhm",firefox_addon_id:"ether-metamask",play_store_id:"io.metamask",app_store_id:"id1438144202"},deep_link:"metamask://wc",universal_link:"https://metamask.app.link/wc"},{featured:!0,name:"OKX Wallet",rdns:"com.okex.wallet",image:`${Rs}#okx`,getWallet:{chrome_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",brave_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",edge_addon_id:"pbpjkcldjiffchgbbndmhojiacbgflha",play_store_id:"com.okinc.okex.gp",app_store_id:"id1327268470"},deep_link:"okex://main/wc",universal_link:"okex://main/wc"},{featured:!0,name:"WalletConnect",image:`${Rs}#walletconnect`},{featured:!1,name:"Coinbase Wallet",image:`${Rs}#coinbase`},{featured:!1,name:"GateWallet",rdns:"io.gate.wallet",image:`${Rs}#6e528abf-7a7d-47bd-d84d-481f169b1200`,getWallet:{chrome_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",brave_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",play_store_id:"com.gateio.gateio",app_store_id:"id1294998195",mac_app_store_id:"id1609559473"},deep_link:"https://www.gate.io/mobileapp",universal_link:"https://www.gate.io/mobileapp"},{featured:!1,name:"Onekey",rdns:"so.onekey.app.wallet",image:`${Rs}#onekey`,getWallet:{chrome_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",brave_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",play_store_id:"so.onekey.app.wallet",app_store_id:"id1609559473"},deep_link:"onekey-wallet://",universal_link:"onekey://wc"},{featured:!1,name:"Infinity Wallet",image:`${Rs}#9f259366-0bcd-4817-0af9-f78773e41900`,desktop_link:"infinity://wc"},{name:"Rabby Wallet",rdns:"io.rabby",featured:!1,image:`${Rs}#rabby`,getWallet:{chrome_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",brave_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",play_store_id:"com.debank.rabbymobile",app_store_id:"id6474381673"}},{name:"Binance Web3 Wallet",featured:!1,image:`${Rs}#ebac7b39-688c-41e3-7912-a4fefba74600`,getWallet:{play_store_id:"com.binance.dev",app_store_id:"id1436799971"}},{name:"Rainbow Wallet",rdns:"me.rainbow",featured:!1,image:`${Rs}#rainbow`,getWallet:{chrome_store_id:"opfgelmcmbiajamepnmloijbpoleiama",edge_addon_id:"cpojfbodiccabbabgimdeohkkpjfpbnf",firefox_addon_id:"rainbow-extension",app_store_id:"id1457119021",play_store_id:"me.rainbow"}}];function eP(t,e){const r=t.exec(e);return r==null?void 0:r.groups}const Vy=/^tuple(?(\[(\d*)\])*)$/;function Zp(t){let e=t.type;if(Vy.test(t.type)&&"components"in t){e="(";const r=t.components.length;for(let i=0;ie(t,s)}function Bc(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new dP(t.type);return`${t.name}(${Qp(t.inputs,{includeName:e})})`}function Qp(t,{includeName:e=!1}={}){return t?t.map(r=>rP(r,{includeName:e})).join(e?", ":","):""}function rP(t,{includeName:e}){return t.type.startsWith("tuple")?`(${Qp(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}function Jo(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function _n(t){return Jo(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const Gy="2.21.45";let bf={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${Gy}`};class yt extends Error{constructor(e,r={}){var a;const n=(()=>{var u;return r.cause instanceof yt?r.cause.details:(u=r.cause)!=null&&u.message?r.cause.message:r.details})(),i=r.cause instanceof yt&&r.cause.docsPath||r.docsPath,s=(a=bf.getDocsUrl)==null?void 0:a.call(bf,{...r,docsPath:i}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...bf.version?[`Version: ${bf.version}`]:[]].join(` -`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=Gy}walk(e){return Yy(this,e)}}function Yy(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?Yy(t.cause,e):e?null:t}class nP extends yt{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` -`),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class Jy extends yt{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` + <%s key={someKey} {...props} />`,dt,Mt,_t,Mt),Ft[Mt+dt]=!0}}return q===n?nt(tt):jt(tt),tt}}function H(q,oe,pe){return $(q,oe,pe,!0)}function V(q,oe,pe){return $(q,oe,pe,!1)}var C=V,Y=H;mf.Fragment=n,mf.jsx=C,mf.jsxs=Y}()),mf}process.env.NODE_ENV==="production"?Xp.exports=XA():Xp.exports=ZA();var ge=Xp.exports;const Rs="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2",QA=[{featured:!0,name:"MetaMask",rdns:"io.metamask",image:`${Rs}#metamask`,getWallet:{chrome_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",brave_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",edge_addon_id:"ejbalbakoplchlghecdalmeeeajnimhm",firefox_addon_id:"ether-metamask",play_store_id:"io.metamask",app_store_id:"id1438144202"},deep_link:"metamask://wc",universal_link:"https://metamask.app.link/wc"},{featured:!0,name:"OKX Wallet",rdns:"com.okex.wallet",image:`${Rs}#okx`,getWallet:{chrome_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",brave_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",edge_addon_id:"pbpjkcldjiffchgbbndmhojiacbgflha",play_store_id:"com.okinc.okex.gp",app_store_id:"id1327268470"},deep_link:"okex://main/wc",universal_link:"okex://main/wc"},{featured:!0,name:"WalletConnect",image:`${Rs}#walletconnect`},{featured:!1,name:"Coinbase Wallet",image:`${Rs}#coinbase`},{featured:!1,name:"GateWallet",rdns:"io.gate.wallet",image:`${Rs}#6e528abf-7a7d-47bd-d84d-481f169b1200`,getWallet:{chrome_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",brave_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",play_store_id:"com.gateio.gateio",app_store_id:"id1294998195",mac_app_store_id:"id1609559473"},deep_link:"https://www.gate.io/mobileapp",universal_link:"https://www.gate.io/mobileapp"},{featured:!1,name:"Onekey",rdns:"so.onekey.app.wallet",image:`${Rs}#onekey`,getWallet:{chrome_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",brave_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",play_store_id:"so.onekey.app.wallet",app_store_id:"id1609559473"},deep_link:"onekey-wallet://",universal_link:"onekey://wc"},{featured:!1,name:"Infinity Wallet",image:`${Rs}#9f259366-0bcd-4817-0af9-f78773e41900`,desktop_link:"infinity://wc"},{name:"Rabby Wallet",rdns:"io.rabby",featured:!1,image:`${Rs}#rabby`,getWallet:{chrome_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",brave_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",play_store_id:"com.debank.rabbymobile",app_store_id:"id6474381673"}},{name:"Binance Web3 Wallet",featured:!1,image:`${Rs}#ebac7b39-688c-41e3-7912-a4fefba74600`,getWallet:{play_store_id:"com.binance.dev",app_store_id:"id1436799971"}},{name:"Rainbow Wallet",rdns:"me.rainbow",featured:!1,image:`${Rs}#rainbow`,getWallet:{chrome_store_id:"opfgelmcmbiajamepnmloijbpoleiama",edge_addon_id:"cpojfbodiccabbabgimdeohkkpjfpbnf",firefox_addon_id:"rainbow-extension",app_store_id:"id1457119021",play_store_id:"me.rainbow"}}];function eP(t,e){const r=t.exec(e);return r==null?void 0:r.groups}const Gy=/^tuple(?(\[(\d*)\])*)$/;function Zp(t){let e=t.type;if(Gy.test(t.type)&&"components"in t){e="(";const r=t.components.length;for(let i=0;ie(t,s)}function Bc(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new dP(t.type);return`${t.name}(${Qp(t.inputs,{includeName:e})})`}function Qp(t,{includeName:e=!1}={}){return t?t.map(r=>rP(r,{includeName:e})).join(e?", ":","):""}function rP(t,{includeName:e}){return t.type.startsWith("tuple")?`(${Qp(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}function Jo(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function _n(t){return Jo(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const Yy="2.21.45";let bf={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${Yy}`};class yt extends Error{constructor(e,r={}){var a;const n=(()=>{var u;return r.cause instanceof yt?r.cause.details:(u=r.cause)!=null&&u.message?r.cause.message:r.details})(),i=r.cause instanceof yt&&r.cause.docsPath||r.docsPath,s=(a=bf.getDocsUrl)==null?void 0:a.call(bf,{...r,docsPath:i}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...bf.version?[`Version: ${bf.version}`]:[]].join(` +`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=Yy}walk(e){return Jy(this,e)}}function Jy(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?Jy(t.cause,e):e?null:t}class nP extends yt{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` +`),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class Xy extends yt{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` `),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class iP extends yt{constructor({data:e,params:r,size:n}){super([`Data size of ${n} bytes is too small for given parameters.`].join(` `),{metaMessages:[`Params: (${Qp(r,{includeName:!0})})`,`Data: ${e} (${n} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=r,this.size=n}}class eg extends yt{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class sP extends yt{constructor({expectedLength:e,givenLength:r,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${e}`,`Given length: ${r}`].join(` `),{name:"AbiEncodingArrayLengthMismatchError"})}}class oP extends yt{constructor({expectedSize:e,value:r}){super(`Size of bytes "${r}" (bytes${_n(r)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class aP extends yt{constructor({expectedLength:e,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${r}`].join(` -`),{name:"AbiEncodingLengthMismatchError"})}}class Xy extends yt{constructor(e,{docsPath:r}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(` -`),{docsPath:r,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class Zy extends yt{constructor(e,{docsPath:r}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` +`),{name:"AbiEncodingLengthMismatchError"})}}class Zy extends yt{constructor(e,{docsPath:r}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(` +`),{docsPath:r,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class Qy extends yt{constructor(e,{docsPath:r}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` `),{docsPath:r,name:"AbiFunctionNotFoundError"})}}class cP extends yt{constructor(e,r){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${Bc(e.abiItem)}\`, and`,`\`${r.type}\` in \`${Bc(r.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class uP extends yt{constructor({expectedSize:e,givenSize:r}){super(`Expected bytes${e}, got bytes${r}.`,{name:"BytesSizeMismatchError"})}}class fP extends yt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(` `),{docsPath:r,name:"InvalidAbiEncodingType"})}}class lP extends yt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` `),{docsPath:r,name:"InvalidAbiDecodingType"})}}class hP extends yt{constructor(e){super([`Value "${e}" is not a valid array.`].join(` `),{name:"InvalidArrayError"})}}class dP extends yt{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` -`),{name:"InvalidDefinitionTypeError"})}}class Qy extends yt{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}class ew extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}class tw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function $c(t,{dir:e,size:r=32}={}){return typeof t=="string"?Xo(t,{dir:e,size:r}):pP(t,{dir:e,size:r})}function Xo(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new ew({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function pP(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new ew({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie)throw new vP({givenSize:_n(t),maxSize:e})}function yf(t,e={}){const{signed:r}=e;e.size&&Ds(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<e.toString(16).padStart(2,"0"));function Dh(t,e={}){return typeof t=="number"||typeof t=="bigint"?Pr(t,e):typeof t=="string"?Oh(t,e):typeof t=="boolean"?rw(t,e):li(t,e)}function rw(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(Ds(r,{size:e.size}),$c(r,{size:e.size})):r}function li(t,e={}){let r="";for(let i=0;is||i=ao.zero&&t<=ao.nine)return t-ao.zero;if(t>=ao.A&&t<=ao.F)return t-(ao.A-10);if(t>=ao.a&&t<=ao.f)return t-(ao.a-10)}function co(t,e={}){let r=t;e.size&&(Ds(r,{size:e.size}),r=$c(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function SP(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Nh(t.outputLen),Nh(t.blockLen)}function Uc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function sw(t,e){jc(t);const r=e.outputLen;if(t.length>ow&Lh)}:{h:Number(t>>ow&Lh)|0,l:Number(t&Lh)|0}}function PP(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;it<>>32-r,IP=(t,e,r)=>e<>>32-r,CP=(t,e,r)=>e<>>64-r,TP=(t,e,r)=>t<>>64-r,qc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const RP=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),ng=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Os=(t,e)=>t<<32-e|t>>>e,aw=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,DP=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function cw(t){for(let e=0;ee.toString(16).padStart(2,"0"));function NP(t){jc(t);let e="";for(let r=0;rt().update(wf(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function BP(t){const e=(n,i)=>t(i).update(wf(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function $P(t=32){if(qc&&typeof qc.getRandomValues=="function")return qc.getRandomValues(new Uint8Array(t));if(qc&&typeof qc.randomBytes=="function")return qc.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const fw=[],lw=[],hw=[],FP=BigInt(0),xf=BigInt(1),jP=BigInt(2),UP=BigInt(7),qP=BigInt(256),zP=BigInt(113);for(let t=0,e=xf,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],fw.push(2*(5*n+r)),lw.push((t+1)*(t+2)/2%64);let i=FP;for(let s=0;s<7;s++)e=(e<>UP)*zP)%qP,e&jP&&(i^=xf<<(xf<r>32?CP(t,e,r):MP(t,e,r),pw=(t,e,r)=>r>32?TP(t,e,r):IP(t,e,r);function gw(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,u=(o+2)%10,l=r[u],d=r[u+1],p=dw(l,d,1)^r[a],y=pw(l,d,1)^r[a+1];for(let A=0;A<50;A+=10)t[o+A]^=p,t[o+A+1]^=y}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=lw[o],u=dw(i,s,a),l=pw(i,s,a),d=fw[o];i=t[d],s=t[d+1],t[d]=u,t[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=HP[n],t[1]^=WP[n]}r.fill(0)}class _f extends ig{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Nh(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=RP(this.state)}keccak(){aw||cw(this.state32),gw(this.state32,this.rounds),aw||cw(this.state32),this.posOut=0,this.pos=0}update(e){Uc(this);const{blockLen:r,state:n}=this;e=wf(e);const i=e.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Nh(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(sw(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new _f(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Zo=(t,e,r)=>uw(()=>new _f(e,t,r)),KP=Zo(6,144,224/8),VP=Zo(6,136,256/8),GP=Zo(6,104,384/8),YP=Zo(6,72,512/8),JP=Zo(1,144,224/8),mw=Zo(1,136,256/8),XP=Zo(1,104,384/8),ZP=Zo(1,72,512/8),vw=(t,e,r)=>BP((n={})=>new _f(e,t,n.dkLen===void 0?r:n.dkLen,!0)),QP=vw(31,168,128/8),eM=vw(31,136,256/8),tM=Object.freeze(Object.defineProperty({__proto__:null,Keccak:_f,keccakP:gw,keccak_224:JP,keccak_256:mw,keccak_384:XP,keccak_512:ZP,sha3_224:KP,sha3_256:VP,sha3_384:GP,sha3_512:YP,shake128:QP,shake256:eM},Symbol.toStringTag,{value:"Module"}));function Ef(t,e){const r=e||"hex",n=mw(Jo(t,{strict:!1})?rg(t):t);return r==="bytes"?n:Dh(n)}const rM=t=>Ef(rg(t));function nM(t){return rM(t)}function iM(t){let e=!0,r="",n=0,i="",s=!1;for(let o=0;o{const e=typeof t=="string"?t:tP(t);return iM(e)};function bw(t){return nM(sM(t))}const oM=bw;class zc extends yt{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class kh extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const sg=new kh(8192);function Sf(t,e){if(sg.has(`${t}.${e}`))return sg.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=Ef(iw(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return sg.set(`${t}.${e}`,s),s}function og(t,e){if(!uo(t,{strict:!1}))throw new zc({address:t});return Sf(t,e)}const aM=/^0x[a-fA-F0-9]{40}$/,ag=new kh(8192);function uo(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(ag.has(n))return ag.get(n);const i=aM.test(t)?t.toLowerCase()===t?!0:r?Sf(t)===t:!0:!1;return ag.set(n,i),i}function Hc(t){return typeof t[0]=="string"?Bh(t):cM(t)}function cM(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function Bh(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}function $h(t,e,r,{strict:n}={}){return Jo(t,{strict:!1})?uM(t,e,r,{strict:n}):xw(t,e,r,{strict:n})}function yw(t,e){if(typeof e=="number"&&e>0&&e>_n(t)-1)throw new Qy({offset:e,position:"start",size:_n(t)})}function ww(t,e,r){if(typeof e=="number"&&typeof r=="number"&&_n(t)!==r-e)throw new Qy({offset:r,position:"end",size:_n(t)})}function xw(t,e,r,{strict:n}={}){yw(t,e);const i=t.slice(e,r);return n&&ww(i,e,r),i}function uM(t,e,r,{strict:n}={}){yw(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&ww(i,e,r),i}function _w(t,e){if(t.length!==e.length)throw new aP({expectedLength:t.length,givenLength:e.length});const r=fM({params:t,values:e}),n=ug(r);return n.length===0?"0x":n}function fM({params:t,values:e}){const r=[];for(let n=0;n0?Hc([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:Hc(s.map(({encoded:o})=>o))}}function dM(t,{param:e}){const[,r]=e.type.split("bytes"),n=_n(t);if(!r){let i=t;return n%32!==0&&(i=Xo(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:Hc([Xo(Pr(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new oP({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:Xo(t,{dir:"right"})}}function pM(t){if(typeof t!="boolean")throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Xo(rw(t))}}function gM(t,{signed:e}){return{dynamic:!1,encoded:Pr(t,{size:32,signed:e})}}function mM(t){const e=Oh(t),r=Math.ceil(_n(e)/32),n=[];for(let i=0;ii))}}function fg(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const lg=t=>$h(bw(t),0,4);function Ew(t){const{abi:e,args:r=[],name:n}=t,i=Jo(n,{strict:!1}),s=e.filter(a=>i?a.type==="function"?lg(a)===n:a.type==="event"?oM(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((l,d)=>{const p="inputs"in a&&a.inputs[d];return p?hg(l,p):!1})){if(o&&"inputs"in o&&o.inputs){const l=Sw(a.inputs,o.inputs,r);if(l)throw new cP({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||s[0]}function hg(t,e){const r=typeof t,n=e.type;switch(n){case"address":return uo(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>hg(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>hg(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Sw(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return Sw(i.components,s.components,r[n]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?uo(r[n],{strict:!1}):o.includes("address")&&o.includes("bytes")?uo(r[n],{strict:!1}):!1)return o}}function fo(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const Aw="/docs/contract/encodeFunctionData";function bM(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=Ew({abi:e,args:r,name:n});if(!s)throw new Zy(n,{docsPath:Aw});i=s}if(i.type!=="function")throw new Zy(void 0,{docsPath:Aw});return{abi:[i],functionName:lg(Bc(i))}}function yM(t){const{args:e}=t,{abi:r,functionName:n}=(()=>{var a;return t.abi.length===1&&((a=t.functionName)!=null&&a.startsWith("0x"))?t:bM(t)})(),i=r[0],s=n,o="inputs"in i&&i.inputs?_w(i.inputs,e??[]):void 0;return Bh([s,o??"0x"])}const wM={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},xM={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},_M={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Pw extends yt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class EM extends yt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class SM extends yt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const AM={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new SM({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new EM({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Pw({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Pw({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function dg(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(AM);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function PM(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return yf(r,e)}function MM(t,e={}){let r=t;if(typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r)),r.length>1||r[0]>1)throw new mP(r);return!!r[0]}function lo(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return Fc(r,e)}function IM(t,e={}){let r=t;return typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r,{dir:"right"})),new TextDecoder().decode(r)}function CM(t,e){const r=typeof e=="string"?co(e):e,n=dg(r);if(_n(r)===0&&t.length>0)throw new eg;if(_n(e)&&_n(e)<32)throw new iP({data:typeof e=="string"?e:li(e),params:t,size:_n(e)});let i=0;const s=[];for(let o=0;o48?PM(i,{signed:r}):lo(i,{signed:r}),32]}function LM(t,e,{staticPosition:r}){const n=e.components.length===0||e.components.some(({name:o})=>!o),i=n?[]:{};let s=0;if(Af(e)){const o=lo(t.readBytes(pg)),a=r+o;for(let u=0;uo.type==="error"&&n===lg(Bc(o)));if(!s)throw new Xy(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?CM(s.inputs,$h(r,4)):void 0,errorName:s.name}}const Kc=(t,e,r)=>JSON.stringify(t,(n,i)=>typeof i=="bigint"?i.toString():i,r);function Iw({abiItem:t,args:e,includeFunctionName:r=!0,includeName:n=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${r?t.name:""}(${t.inputs.map((i,s)=>`${n&&i.name?`${i.name}: `:""}${typeof e[s]=="object"?Kc(e[s]):e[s]}`).join(", ")})`}const $M={gwei:9,wei:18},FM={ether:-9,wei:9};function Cw(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}function Tw(t,e="wei"){return Cw(t,$M[e])}function hs(t,e="wei"){return Cw(t,FM[e])}class jM extends yt{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class UM extends yt{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Fh(t){const e=Object.entries(t).map(([n,i])=>i===void 0||i===!1?null:[n,i]).filter(Boolean),r=e.reduce((n,[i])=>Math.max(n,i.length),0);return e.map(([n,i])=>` ${`${n}:`.padEnd(r+1)} ${i}`).join(` +`),{name:"InvalidDefinitionTypeError"})}}class ew extends yt{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}class tw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}class rw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function $c(t,{dir:e,size:r=32}={}){return typeof t=="string"?Xo(t,{dir:e,size:r}):pP(t,{dir:e,size:r})}function Xo(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new tw({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function pP(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new tw({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie)throw new vP({givenSize:_n(t),maxSize:e})}function yf(t,e={}){const{signed:r}=e;e.size&&Ds(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<e.toString(16).padStart(2,"0"));function Dh(t,e={}){return typeof t=="number"||typeof t=="bigint"?Pr(t,e):typeof t=="string"?Oh(t,e):typeof t=="boolean"?nw(t,e):li(t,e)}function nw(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(Ds(r,{size:e.size}),$c(r,{size:e.size})):r}function li(t,e={}){let r="";for(let i=0;is||i=ao.zero&&t<=ao.nine)return t-ao.zero;if(t>=ao.A&&t<=ao.F)return t-(ao.A-10);if(t>=ao.a&&t<=ao.f)return t-(ao.a-10)}function co(t,e={}){let r=t;e.size&&(Ds(r,{size:e.size}),r=$c(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function SP(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Nh(t.outputLen),Nh(t.blockLen)}function Uc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function ow(t,e){jc(t);const r=e.outputLen;if(t.length>aw&Lh)}:{h:Number(t>>aw&Lh)|0,l:Number(t&Lh)|0}}function PP(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;it<>>32-r,IP=(t,e,r)=>e<>>32-r,CP=(t,e,r)=>e<>>64-r,TP=(t,e,r)=>t<>>64-r,qc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const RP=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),ng=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Os=(t,e)=>t<<32-e|t>>>e,cw=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,DP=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function uw(t){for(let e=0;ee.toString(16).padStart(2,"0"));function NP(t){jc(t);let e="";for(let r=0;rt().update(wf(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function BP(t){const e=(n,i)=>t(i).update(wf(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function $P(t=32){if(qc&&typeof qc.getRandomValues=="function")return qc.getRandomValues(new Uint8Array(t));if(qc&&typeof qc.randomBytes=="function")return qc.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const lw=[],hw=[],dw=[],FP=BigInt(0),xf=BigInt(1),jP=BigInt(2),UP=BigInt(7),qP=BigInt(256),zP=BigInt(113);for(let t=0,e=xf,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],lw.push(2*(5*n+r)),hw.push((t+1)*(t+2)/2%64);let i=FP;for(let s=0;s<7;s++)e=(e<>UP)*zP)%qP,e&jP&&(i^=xf<<(xf<r>32?CP(t,e,r):MP(t,e,r),gw=(t,e,r)=>r>32?TP(t,e,r):IP(t,e,r);function mw(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,u=(o+2)%10,l=r[u],d=r[u+1],p=pw(l,d,1)^r[a],y=gw(l,d,1)^r[a+1];for(let A=0;A<50;A+=10)t[o+A]^=p,t[o+A+1]^=y}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=hw[o],u=pw(i,s,a),l=gw(i,s,a),d=lw[o];i=t[d],s=t[d+1],t[d]=u,t[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=HP[n],t[1]^=WP[n]}r.fill(0)}class _f extends ig{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Nh(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=RP(this.state)}keccak(){cw||uw(this.state32),mw(this.state32,this.rounds),cw||uw(this.state32),this.posOut=0,this.pos=0}update(e){Uc(this);const{blockLen:r,state:n}=this;e=wf(e);const i=e.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Nh(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(ow(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new _f(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Zo=(t,e,r)=>fw(()=>new _f(e,t,r)),KP=Zo(6,144,224/8),VP=Zo(6,136,256/8),GP=Zo(6,104,384/8),YP=Zo(6,72,512/8),JP=Zo(1,144,224/8),vw=Zo(1,136,256/8),XP=Zo(1,104,384/8),ZP=Zo(1,72,512/8),bw=(t,e,r)=>BP((n={})=>new _f(e,t,n.dkLen===void 0?r:n.dkLen,!0)),QP=bw(31,168,128/8),eM=bw(31,136,256/8),tM=Object.freeze(Object.defineProperty({__proto__:null,Keccak:_f,keccakP:mw,keccak_224:JP,keccak_256:vw,keccak_384:XP,keccak_512:ZP,sha3_224:KP,sha3_256:VP,sha3_384:GP,sha3_512:YP,shake128:QP,shake256:eM},Symbol.toStringTag,{value:"Module"}));function Ef(t,e){const r=e||"hex",n=vw(Jo(t,{strict:!1})?rg(t):t);return r==="bytes"?n:Dh(n)}const rM=t=>Ef(rg(t));function nM(t){return rM(t)}function iM(t){let e=!0,r="",n=0,i="",s=!1;for(let o=0;o{const e=typeof t=="string"?t:tP(t);return iM(e)};function yw(t){return nM(sM(t))}const oM=yw;class zc extends yt{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class kh extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const sg=new kh(8192);function Sf(t,e){if(sg.has(`${t}.${e}`))return sg.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=Ef(sw(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return sg.set(`${t}.${e}`,s),s}function og(t,e){if(!uo(t,{strict:!1}))throw new zc({address:t});return Sf(t,e)}const aM=/^0x[a-fA-F0-9]{40}$/,ag=new kh(8192);function uo(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(ag.has(n))return ag.get(n);const i=aM.test(t)?t.toLowerCase()===t?!0:r?Sf(t)===t:!0:!1;return ag.set(n,i),i}function Hc(t){return typeof t[0]=="string"?Bh(t):cM(t)}function cM(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function Bh(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}function $h(t,e,r,{strict:n}={}){return Jo(t,{strict:!1})?uM(t,e,r,{strict:n}):_w(t,e,r,{strict:n})}function ww(t,e){if(typeof e=="number"&&e>0&&e>_n(t)-1)throw new ew({offset:e,position:"start",size:_n(t)})}function xw(t,e,r){if(typeof e=="number"&&typeof r=="number"&&_n(t)!==r-e)throw new ew({offset:r,position:"end",size:_n(t)})}function _w(t,e,r,{strict:n}={}){ww(t,e);const i=t.slice(e,r);return n&&xw(i,e,r),i}function uM(t,e,r,{strict:n}={}){ww(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&xw(i,e,r),i}function Ew(t,e){if(t.length!==e.length)throw new aP({expectedLength:t.length,givenLength:e.length});const r=fM({params:t,values:e}),n=ug(r);return n.length===0?"0x":n}function fM({params:t,values:e}){const r=[];for(let n=0;n0?Hc([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:Hc(s.map(({encoded:o})=>o))}}function dM(t,{param:e}){const[,r]=e.type.split("bytes"),n=_n(t);if(!r){let i=t;return n%32!==0&&(i=Xo(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:Hc([Xo(Pr(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new oP({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:Xo(t,{dir:"right"})}}function pM(t){if(typeof t!="boolean")throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Xo(nw(t))}}function gM(t,{signed:e}){return{dynamic:!1,encoded:Pr(t,{size:32,signed:e})}}function mM(t){const e=Oh(t),r=Math.ceil(_n(e)/32),n=[];for(let i=0;ii))}}function fg(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const lg=t=>$h(yw(t),0,4);function Sw(t){const{abi:e,args:r=[],name:n}=t,i=Jo(n,{strict:!1}),s=e.filter(a=>i?a.type==="function"?lg(a)===n:a.type==="event"?oM(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((l,d)=>{const p="inputs"in a&&a.inputs[d];return p?hg(l,p):!1})){if(o&&"inputs"in o&&o.inputs){const l=Aw(a.inputs,o.inputs,r);if(l)throw new cP({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||s[0]}function hg(t,e){const r=typeof t,n=e.type;switch(n){case"address":return uo(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>hg(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>hg(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Aw(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return Aw(i.components,s.components,r[n]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?uo(r[n],{strict:!1}):o.includes("address")&&o.includes("bytes")?uo(r[n],{strict:!1}):!1)return o}}function fo(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const Pw="/docs/contract/encodeFunctionData";function bM(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=Sw({abi:e,args:r,name:n});if(!s)throw new Qy(n,{docsPath:Pw});i=s}if(i.type!=="function")throw new Qy(void 0,{docsPath:Pw});return{abi:[i],functionName:lg(Bc(i))}}function yM(t){const{args:e}=t,{abi:r,functionName:n}=(()=>{var a;return t.abi.length===1&&((a=t.functionName)!=null&&a.startsWith("0x"))?t:bM(t)})(),i=r[0],s=n,o="inputs"in i&&i.inputs?Ew(i.inputs,e??[]):void 0;return Bh([s,o??"0x"])}const wM={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},xM={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},_M={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Mw extends yt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class EM extends yt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class SM extends yt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const AM={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new SM({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new EM({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Mw({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Mw({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function dg(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(AM);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function PM(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return yf(r,e)}function MM(t,e={}){let r=t;if(typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r)),r.length>1||r[0]>1)throw new mP(r);return!!r[0]}function lo(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return Fc(r,e)}function IM(t,e={}){let r=t;return typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r,{dir:"right"})),new TextDecoder().decode(r)}function CM(t,e){const r=typeof e=="string"?co(e):e,n=dg(r);if(_n(r)===0&&t.length>0)throw new eg;if(_n(e)&&_n(e)<32)throw new iP({data:typeof e=="string"?e:li(e),params:t,size:_n(e)});let i=0;const s=[];for(let o=0;o48?PM(i,{signed:r}):lo(i,{signed:r}),32]}function LM(t,e,{staticPosition:r}){const n=e.components.length===0||e.components.some(({name:o})=>!o),i=n?[]:{};let s=0;if(Af(e)){const o=lo(t.readBytes(pg)),a=r+o;for(let u=0;uo.type==="error"&&n===lg(Bc(o)));if(!s)throw new Zy(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?CM(s.inputs,$h(r,4)):void 0,errorName:s.name}}const Kc=(t,e,r)=>JSON.stringify(t,(n,i)=>typeof i=="bigint"?i.toString():i,r);function Cw({abiItem:t,args:e,includeFunctionName:r=!0,includeName:n=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${r?t.name:""}(${t.inputs.map((i,s)=>`${n&&i.name?`${i.name}: `:""}${typeof e[s]=="object"?Kc(e[s]):e[s]}`).join(", ")})`}const $M={gwei:9,wei:18},FM={ether:-9,wei:9};function Tw(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}function Rw(t,e="wei"){return Tw(t,$M[e])}function hs(t,e="wei"){return Tw(t,FM[e])}class jM extends yt{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class UM extends yt{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Fh(t){const e=Object.entries(t).map(([n,i])=>i===void 0||i===!1?null:[n,i]).filter(Boolean),r=e.reduce((n,[i])=>Math.max(n,i.length),0);return e.map(([n,i])=>` ${`${n}:`.padEnd(r+1)} ${i}`).join(` `)}class qM extends yt{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(` -`),{name:"FeeConflictError"})}}class zM extends yt{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Fh(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class HM extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var P;const A=Fh({chain:i&&`${i==null?void 0:i.name} (id: ${i==null?void 0:i.id})`,from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Tw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",A].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const WM=t=>t,Rw=t=>t;class KM extends yt{constructor(e,{abi:r,args:n,contractAddress:i,docsPath:s,functionName:o,sender:a}){const u=Ew({abi:r,args:n,name:o}),l=u?Iw({abiItem:u,args:n,includeFunctionName:!1,includeName:!1}):void 0,d=u?Bc(u,{includeName:!0}):void 0,p=Fh({address:i&&WM(i),function:d,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:s,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],p&&"Contract Call:",p].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=e,this.contractAddress=i,this.functionName=o,this.sender=a}}class VM extends yt{constructor({abi:e,data:r,functionName:n,message:i}){let s,o,a,u;if(r&&r!=="0x")try{o=BM({abi:e,data:r});const{abiItem:d,errorName:p,args:y}=o;if(p==="Error")u=y[0];else if(p==="Panic"){const[A]=y;u=wM[A]}else{const A=d?Bc(d,{includeName:!0}):void 0,P=d&&y?Iw({abiItem:d,args:y,includeFunctionName:!1,includeName:!1}):void 0;a=[A?`Error: ${A}`:"",P&&P!=="()"?` ${[...Array((p==null?void 0:p.length)??0).keys()].map(()=>" ").join("")}${P}`:""]}}catch(d){s=d}else i&&(u=i);let l;s instanceof Xy&&(l=s.signature,a=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(u&&u!=="execution reverted"||l?[`The contract function "${n}" reverted with the following ${l?"signature":"reason"}:`,u||l].join(` -`):`The contract function "${n}" reverted.`,{cause:s,metaMessages:a,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.reason=u,this.signature=l}}class GM extends yt{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class YM extends yt{constructor({data:e,message:r}){super(r||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}class Dw extends yt{constructor({body:e,cause:r,details:n,headers:i,status:s,url:o}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${Rw(o)}`,e&&`Request body: ${Kc(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=i,this.status=s,this.url=o}}class JM extends yt{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${Rw(n)}`,`Request body: ${Kc(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code}}const XM=-1;class hi extends yt{constructor(e,{code:r,docsPath:n,metaMessages:i,name:s,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:i||(e==null?void 0:e.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||e.name,this.code=e instanceof JM?e.code:r??XM}}class Vc extends hi{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class Pf extends hi{constructor(e){super(e,{code:Pf.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Pf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Mf extends hi{constructor(e){super(e,{code:Mf.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Mf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class If extends hi{constructor(e,{method:r}={}){super(e,{code:If.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(If,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Cf extends hi{constructor(e){super(e,{code:Cf.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` +`),{name:"FeeConflictError"})}}class zM extends yt{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Fh(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class HM extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var P;const A=Fh({chain:i&&`${i==null?void 0:i.name} (id: ${i==null?void 0:i.id})`,from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Rw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",A].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const WM=t=>t,Dw=t=>t;class KM extends yt{constructor(e,{abi:r,args:n,contractAddress:i,docsPath:s,functionName:o,sender:a}){const u=Sw({abi:r,args:n,name:o}),l=u?Cw({abiItem:u,args:n,includeFunctionName:!1,includeName:!1}):void 0,d=u?Bc(u,{includeName:!0}):void 0,p=Fh({address:i&&WM(i),function:d,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:s,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],p&&"Contract Call:",p].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=e,this.contractAddress=i,this.functionName=o,this.sender=a}}class VM extends yt{constructor({abi:e,data:r,functionName:n,message:i}){let s,o,a,u;if(r&&r!=="0x")try{o=BM({abi:e,data:r});const{abiItem:d,errorName:p,args:y}=o;if(p==="Error")u=y[0];else if(p==="Panic"){const[A]=y;u=wM[A]}else{const A=d?Bc(d,{includeName:!0}):void 0,P=d&&y?Cw({abiItem:d,args:y,includeFunctionName:!1,includeName:!1}):void 0;a=[A?`Error: ${A}`:"",P&&P!=="()"?` ${[...Array((p==null?void 0:p.length)??0).keys()].map(()=>" ").join("")}${P}`:""]}}catch(d){s=d}else i&&(u=i);let l;s instanceof Zy&&(l=s.signature,a=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(u&&u!=="execution reverted"||l?[`The contract function "${n}" reverted with the following ${l?"signature":"reason"}:`,u||l].join(` +`):`The contract function "${n}" reverted.`,{cause:s,metaMessages:a,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.reason=u,this.signature=l}}class GM extends yt{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class YM extends yt{constructor({data:e,message:r}){super(r||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}class Ow extends yt{constructor({body:e,cause:r,details:n,headers:i,status:s,url:o}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${Dw(o)}`,e&&`Request body: ${Kc(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=i,this.status=s,this.url=o}}class JM extends yt{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${Dw(n)}`,`Request body: ${Kc(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code}}const XM=-1;class hi extends yt{constructor(e,{code:r,docsPath:n,metaMessages:i,name:s,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:i||(e==null?void 0:e.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||e.name,this.code=e instanceof JM?e.code:r??XM}}class Vc extends hi{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class Pf extends hi{constructor(e){super(e,{code:Pf.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Pf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Mf extends hi{constructor(e){super(e,{code:Mf.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Mf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class If extends hi{constructor(e,{method:r}={}){super(e,{code:If.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(If,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Cf extends hi{constructor(e){super(e,{code:Cf.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` `)})}}Object.defineProperty(Cf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Ba extends hi{constructor(e){super(e,{code:Ba.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Ba,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Tf extends hi{constructor(e){super(e,{code:Tf.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` -`)})}}Object.defineProperty(Tf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Rf extends hi{constructor(e){super(e,{code:Rf.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Rf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Df extends hi{constructor(e){super(e,{code:Df.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Df,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Of extends hi{constructor(e){super(e,{code:Of.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Of,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Nf extends hi{constructor(e,{method:r}={}){super(e,{code:Nf.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not implemented.`})}}Object.defineProperty(Nf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Gc extends hi{constructor(e){super(e,{code:Gc.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Gc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Lf extends hi{constructor(e){super(e,{code:Lf.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Lf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Yc extends Vc{constructor(e){super(e,{code:Yc.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Yc,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class kf extends Vc{constructor(e){super(e,{code:kf.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(kf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Bf extends Vc{constructor(e,{method:r}={}){super(e,{code:Bf.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(Bf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class $f extends Vc{constructor(e){super(e,{code:$f.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty($f,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Ff extends Vc{constructor(e){super(e,{code:Ff.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Ff,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class jf extends Vc{constructor(e){super(e,{code:jf.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(jf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ZM extends hi{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const QM=3;function eI(t,{abi:e,address:r,args:n,docsPath:i,functionName:s,sender:o}){const{code:a,data:u,message:l,shortMessage:d}=t instanceof YM?t:t instanceof yt?t.walk(y=>"data"in y)||t.walk():{},p=t instanceof eg?new GM({functionName:s}):[QM,Ba.code].includes(a)&&(u||l||d)?new VM({abi:e,data:typeof u=="object"?u.data:u,functionName:s,message:d??l}):t;return new KM(p,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:o})}function tI(t){const e=Ef(`0x${t.substring(4)}`).substring(26);return Sf(`0x${e}`)}async function rI({hash:t,signature:e}){const r=Jo(t)?t:Dh(t),{secp256k1:n}=await Promise.resolve().then(()=>UC);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:d,v:p,yParity:y}=e,A=Number(y??p),P=Ow(A);return new n.Signature(yf(l),yf(d)).addRecoveryBit(P)}const o=Jo(e)?e:Dh(e),a=Fc(`0x${o.slice(130)}`),u=Ow(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Ow(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function nI({hash:t,signature:e}){return tI(await rI({hash:t,signature:e}))}function iI(t,e="hex"){const r=Nw(t),n=dg(new Uint8Array(r.length));return r.encode(n),e==="hex"?li(n.bytes):n.bytes}function Nw(t){return Array.isArray(t)?sI(t.map(e=>Nw(e))):oI(t)}function sI(t){const e=t.reduce((i,s)=>i+s.length,0),r=Lw(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function oI(t){const e=typeof t=="string"?co(t):t,r=Lw(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function Lw(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new yt("Length is too large.")}function aI(t){const{chainId:e,contractAddress:r,nonce:n,to:i}=t,s=Ef(Bh(["0x05",iI([e?Pr(e):"0x",r,n?Pr(n):"0x"])]));return i==="bytes"?co(s):s}async function kw(t){const{authorization:e,signature:r}=t;return nI({hash:aI(e),signature:r??e})}class cI extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var P;const A=Fh({from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Tw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",A].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class Jc extends yt{constructor({cause:e,message:r}={}){var i;const n=(i=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(Jc,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Jc,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class jh extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(jh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class gg extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(gg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class mg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(mg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class vg extends yt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` +`)})}}Object.defineProperty(Tf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Rf extends hi{constructor(e){super(e,{code:Rf.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Rf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Df extends hi{constructor(e){super(e,{code:Df.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Df,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Of extends hi{constructor(e){super(e,{code:Of.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Of,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Nf extends hi{constructor(e,{method:r}={}){super(e,{code:Nf.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not implemented.`})}}Object.defineProperty(Nf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Gc extends hi{constructor(e){super(e,{code:Gc.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Gc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Lf extends hi{constructor(e){super(e,{code:Lf.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Lf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Yc extends Vc{constructor(e){super(e,{code:Yc.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Yc,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class kf extends Vc{constructor(e){super(e,{code:kf.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(kf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Bf extends Vc{constructor(e,{method:r}={}){super(e,{code:Bf.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(Bf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class $f extends Vc{constructor(e){super(e,{code:$f.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty($f,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Ff extends Vc{constructor(e){super(e,{code:Ff.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Ff,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class jf extends Vc{constructor(e){super(e,{code:jf.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(jf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ZM extends hi{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const QM=3;function eI(t,{abi:e,address:r,args:n,docsPath:i,functionName:s,sender:o}){const{code:a,data:u,message:l,shortMessage:d}=t instanceof YM?t:t instanceof yt?t.walk(y=>"data"in y)||t.walk():{},p=t instanceof eg?new GM({functionName:s}):[QM,Ba.code].includes(a)&&(u||l||d)?new VM({abi:e,data:typeof u=="object"?u.data:u,functionName:s,message:d??l}):t;return new KM(p,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:o})}function tI(t){const e=Ef(`0x${t.substring(4)}`).substring(26);return Sf(`0x${e}`)}async function rI({hash:t,signature:e}){const r=Jo(t)?t:Dh(t),{secp256k1:n}=await Promise.resolve().then(()=>UC);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:d,v:p,yParity:y}=e,A=Number(y??p),P=Nw(A);return new n.Signature(yf(l),yf(d)).addRecoveryBit(P)}const o=Jo(e)?e:Dh(e),a=Fc(`0x${o.slice(130)}`),u=Nw(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Nw(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function nI({hash:t,signature:e}){return tI(await rI({hash:t,signature:e}))}function iI(t,e="hex"){const r=Lw(t),n=dg(new Uint8Array(r.length));return r.encode(n),e==="hex"?li(n.bytes):n.bytes}function Lw(t){return Array.isArray(t)?sI(t.map(e=>Lw(e))):oI(t)}function sI(t){const e=t.reduce((i,s)=>i+s.length,0),r=kw(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function oI(t){const e=typeof t=="string"?co(t):t,r=kw(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function kw(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new yt("Length is too large.")}function aI(t){const{chainId:e,contractAddress:r,nonce:n,to:i}=t,s=Ef(Bh(["0x05",iI([e?Pr(e):"0x",r,n?Pr(n):"0x"])]));return i==="bytes"?co(s):s}async function Bw(t){const{authorization:e,signature:r}=t;return nI({hash:aI(e),signature:r??e})}class cI extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var P;const A=Fh({from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Rw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",A].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class Jc extends yt{constructor({cause:e,message:r}={}){var i;const n=(i=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(Jc,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Jc,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class jh extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(jh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class gg extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(gg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class mg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(mg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class vg extends yt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` `),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(vg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class bg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(bg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class yg extends yt{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` `),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(yg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class wg extends yt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(wg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class xg extends yt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(xg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class _g extends yt{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(_g,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Uh extends yt{constructor({cause:e,maxPriorityFeePerGas:r,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${r?` = ${hs(r)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${hs(n)} gwei`:""}).`].join(` -`),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(Uh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Eg extends yt{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function Bw(t,e){const r=(t.details||"").toLowerCase(),n=t instanceof yt?t.walk(i=>(i==null?void 0:i.code)===Jc.code):t;return n instanceof yt?new Jc({cause:t,message:n.details}):Jc.nodeMessage.test(r)?new Jc({cause:t,message:t.details}):jh.nodeMessage.test(r)?new jh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):gg.nodeMessage.test(r)?new gg({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):mg.nodeMessage.test(r)?new mg({cause:t,nonce:e==null?void 0:e.nonce}):vg.nodeMessage.test(r)?new vg({cause:t,nonce:e==null?void 0:e.nonce}):bg.nodeMessage.test(r)?new bg({cause:t,nonce:e==null?void 0:e.nonce}):yg.nodeMessage.test(r)?new yg({cause:t}):wg.nodeMessage.test(r)?new wg({cause:t,gas:e==null?void 0:e.gas}):xg.nodeMessage.test(r)?new xg({cause:t,gas:e==null?void 0:e.gas}):_g.nodeMessage.test(r)?new _g({cause:t}):Uh.nodeMessage.test(r)?new Uh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new Eg({cause:t})}function uI(t,{docsPath:e,...r}){const n=(()=>{const i=Bw(t,r);return i instanceof Eg?t:i})();return new cI(n,{docsPath:e,...r})}function $w(t,{format:e}){if(!e)return{};const r={};function n(s){const o=Object.keys(s);for(const a of o)a in t&&(r[a]=t[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}const i=e(t||{});return n(i),r}const fI={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Sg(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=lI(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(r=>li(r)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=Pr(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=Pr(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=Pr(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=Pr(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=Pr(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=Pr(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=fI[t.type]),typeof t.value<"u"&&(e.value=Pr(t.value)),e}function lI(t){return t.map(e=>({address:e.contractAddress,r:e.r,s:e.s,chainId:Pr(e.chainId),nonce:Pr(e.nonce),...typeof e.yParity<"u"?{yParity:Pr(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:Pr(e.v)}:{}}))}function Fw(t){if(!(!t||t.length===0))return t.reduce((e,{slot:r,value:n})=>{if(r.length!==66)throw new tw({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new tw({size:n.length,targetSize:66,type:"hex"});return e[r]=n,e},{})}function hI(t){const{balance:e,nonce:r,state:n,stateDiff:i,code:s}=t,o={};if(s!==void 0&&(o.code=s),e!==void 0&&(o.balance=Pr(e)),r!==void 0&&(o.nonce=Pr(r)),n!==void 0&&(o.state=Fw(n)),i!==void 0){if(o.state)throw new UM;o.stateDiff=Fw(i)}return o}function dI(t){if(!t)return;const e={};for(const{address:r,...n}of t){if(!uo(r,{strict:!1}))throw new zc({address:r});if(e[r])throw new jM({address:r});e[r]=hI(n)}return e}const pI=2n**256n-1n;function qh(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?fo(e):void 0;if(o&&!uo(o.address))throw new zc({address:o.address});if(s&&!uo(s))throw new zc({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new qM;if(n&&n>pI)throw new jh({maxFeePerGas:n});if(i&&n&&i>n)throw new Uh({maxFeePerGas:n,maxPriorityFeePerGas:i})}class gI extends yt{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Ag extends yt{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class mI extends yt{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${hs(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class vI extends yt{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}const bI={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function yI(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?Fc(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?Fc(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?bI[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=wI(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function wI(t){return t.map(e=>({contractAddress:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function xI(t){const e=(t.transactions??[]).map(r=>typeof r=="string"?r:yI(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function zh(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){var d,p,y;const s=n??"latest",o=i??!1,a=r!==void 0?Pr(r):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,o]},{dedupe:!0}):u=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]},{dedupe:!!a}),!u)throw new vI({blockHash:e,blockNumber:r});return(((y=(p=(d=t.chain)==null?void 0:d.formatters)==null?void 0:p.block)==null?void 0:y.format)||xI)(u)}async function jw(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function _I(t,e){var s,o;const{block:r,chain:n=t.chain,request:i}=e||{};try{const a=((s=n==null?void 0:n.fees)==null?void 0:s.maxPriorityFeePerGas)??((o=n==null?void 0:n.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=r||await fi(t,zh,"getBlock")({}),d=await a({block:l,client:t,request:i});if(d===null)throw new Error;return d}if(typeof a<"u")return a;const u=await t.request({method:"eth_maxPriorityFeePerGas"});return yf(u)}catch{const[a,u]=await Promise.all([r?Promise.resolve(r):fi(t,zh,"getBlock")({}),fi(t,jw,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new Ag;const l=u-a.baseFeePerGas;return l<0n?0n:l}}async function Uw(t,e){var y,A;const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>{var P,N;return typeof((P=n==null?void 0:n.fees)==null?void 0:P.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):((N=n==null?void 0:n.fees)==null?void 0:N.baseFeeMultiplier)??1.2})();if(o<1)throw new gI;const u=10**(((y=o.toString().split(".")[1])==null?void 0:y.length)??0),l=P=>P*BigInt(Math.ceil(o*u))/BigInt(u),d=r||await fi(t,zh,"getBlock")({});if(typeof((A=n==null?void 0:n.fees)==null?void 0:A.estimateFeesPerGas)=="function"){const P=await n.fees.estimateFeesPerGas({block:r,client:t,multiply:l,request:i,type:s});if(P!==null)return P}if(s==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new Ag;const P=typeof(i==null?void 0:i.maxPriorityFeePerGas)=="bigint"?i.maxPriorityFeePerGas:await _I(t,{block:d,chain:n,request:i}),N=l(d.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??N+P,maxPriorityFeePerGas:P}}return{gasPrice:(i==null?void 0:i.gasPrice)??l(await fi(t,jw,"getGasPrice")({}))}}async function EI(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,n?Pr(n):r]},{dedupe:!!n});return Fc(i)}function qw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(s=>co(s)):t.blobs,i=[];for(const s of n)i.push(Uint8Array.from(e.blobToKzgCommitment(s)));return r==="bytes"?i:i.map(s=>li(s))}function zw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>co(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>co(o)):t.commitments,s=[];for(let o=0;oli(o))}function SI(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),u=n?4:0,l=n?0:4;t.setUint32(e+u,o,n),t.setUint32(e+l,a,n)}const AI=(t,e,r)=>t&e^~t&r,PI=(t,e,r)=>t&e^t&r^e&r;class MI extends ig{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ng(this.buffer)}update(e){Uc(this);const{view:r,buffer:n,blockLen:i}=this;e=wf(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let p=o;pd.length)throw new Error("_sha2: outputLen bigger than state");for(let p=0;p>>3,N=Os(A,17)^Os(A,19)^A>>>10;ea[p]=N+ea[p-7]+P+ea[p-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:u,G:l,H:d}=this;for(let p=0;p<64;p++){const y=Os(a,6)^Os(a,11)^Os(a,25),A=d+y+AI(a,u,l)+II[p]+ea[p]|0,N=(Os(n,2)^Os(n,13)^Os(n,22))+PI(n,i,s)|0;d=l,l=u,u=a,a=o+A|0,o=s,s=i,i=n,n=A+N|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(n,i,s,o,a,u,l,d)}roundClean(){ea.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Pg=uw(()=>new CI);function TI(t,e){return Pg(Jo(t,{strict:!1})?rg(t):t)}function RI(t){const{commitment:e,version:r=1}=t,n=t.to??(typeof e=="string"?"hex":"bytes"),i=TI(e);return i.set([r],0),n==="bytes"?i:li(i)}function DI(t){const{commitments:e,version:r}=t,n=t.to??(typeof e[0]=="string"?"hex":"bytes"),i=[];for(const s of e)i.push(RI({commitment:s,to:n,version:r}));return i}const Hw=6,Ww=32,Mg=4096,Kw=Ww*Mg,Vw=Kw*Hw-1-1*Mg*Hw;class OI extends yt{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class NI extends yt{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function LI(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),r=typeof t.data=="string"?co(t.data):t.data,n=_n(r);if(!n)throw new NI;if(n>Vw)throw new OI({maxSize:Vw,size:n});const i=[];let s=!0,o=0;for(;s;){const a=dg(new Uint8Array(Kw));let u=0;for(;ua.bytes):i.map(a=>li(a.bytes))}function kI(t){const{data:e,kzg:r,to:n}=t,i=t.blobs??LI({data:e,to:n}),s=t.commitments??qw({blobs:i,kzg:r,to:n}),o=t.proofs??zw({blobs:i,commitments:s,kzg:r,to:n}),a=[];for(let u=0;u"u"&&p)if(u){const k=await D();y.nonce=await u.consume({address:p.address,chainId:k,client:t})}else y.nonce=await fi(t,EI,"getTransactionCount")({address:p.address,blockTag:"pending"});if((l.includes("fees")||l.includes("type"))&&typeof d>"u")try{y.type=BI(y)}catch{const k=await P();y.type=typeof(k==null?void 0:k.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(l.includes("fees"))if(y.type!=="legacy"&&y.type!=="eip2930"){if(typeof y.maxFeePerGas>"u"||typeof y.maxPriorityFeePerGas>"u"){const k=await P(),{maxFeePerGas:B,maxPriorityFeePerGas:j}=await Uw(t,{block:k,chain:i,request:y});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(y.gas=await fi(t,FI,"estimateGas")({...y,account:p&&{address:p.address,type:"json-rpc"}})),qh(y),delete y.parameters,y}async function $I(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=r?Pr(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function FI(t,e){var i,s,o;const{account:r=t.account}=e,n=r?fo(r):void 0;try{let f=function(v){const{block:x,request:_,rpcStateOverride:S}=v;return t.request({method:"eth_estimateGas",params:S?[_,x??"latest",S]:x?[_,x]:[_]})};const{accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,blockNumber:p,blockTag:y,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:j,value:U,stateOverride:K,...J}=await Ig(t,{...e,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),z=(p?Pr(p):void 0)||y,ue=dI(K),_e=await(async()=>{if(J.to)return J.to;if(u&&u.length>0)return await kw({authorization:u[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`")})})();qh(e);const G=(o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:o.format,m=(G||Sg)({...$w(J,{format:G}),from:n==null?void 0:n.address,accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:j,to:_e,value:U});let g=BigInt(await f({block:z,request:m,rpcStateOverride:ue}));if(u){const v=await $I(t,{address:m.from}),x=await Promise.all(u.map(async _=>{const{contractAddress:S}=_,b=await f({block:z,request:{authorizationList:void 0,data:A,from:n==null?void 0:n.address,to:S,value:Pr(v)},rpcStateOverride:ue}).catch(()=>100000n);return 2n*BigInt(b)}));g+=x.reduce((_,S)=>_+S,0n)}return g}catch(a){throw uI(a,{...e,account:n,chain:t.chain})}}class jI extends yt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class UI extends yt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` -`),{name:"ChainNotFoundError"})}}const Cg="/docs/contract/encodeDeployData";function qI(t){const{abi:e,args:r,bytecode:n}=t;if(!r||r.length===0)return n;const i=e.find(o=>"type"in o&&o.type==="constructor");if(!i)throw new nP({docsPath:Cg});if(!("inputs"in i))throw new Jy({docsPath:Cg});if(!i.inputs||i.inputs.length===0)throw new Jy({docsPath:Cg});const s=_w(i.inputs,r);return Bh([n,s])}async function zI(t){return new Promise(e=>setTimeout(e,t))}class Uf extends yt{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` -`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class Tg extends yt{constructor({docsPath:e,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:e,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function Yw({chain:t,currentChainId:e}){if(!t)throw new UI;if(e!==t.id)throw new jI({chain:t,currentChainId:e})}function HI(t,{docsPath:e,...r}){const n=(()=>{const i=Bw(t,r);return i instanceof Eg?t:i})();return new HM(n,{docsPath:e,...r})}async function Jw(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const Rg=new kh(128);async function Dg(t,e){var k,B,j,U;const{account:r=t.account,chain:n=t.chain,accessList:i,authorizationList:s,blobs:o,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,value:P,...N}=e;if(typeof r>"u")throw new Uf({docsPath:"/docs/actions/wallet/sendTransaction"});const D=r?fo(r):null;try{qh(e);const K=await(async()=>{if(e.to)return e.to;if(s&&s.length>0)return await kw({authorization:s[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`.")})})();if((D==null?void 0:D.type)==="json-rpc"||D===null){let J;n!==null&&(J=await fi(t,Hh,"getChainId")({}),Yw({currentChainId:J,chain:n}));const T=(j=(B=(k=t.chain)==null?void 0:k.formatters)==null?void 0:B.transactionRequest)==null?void 0:j.format,ue=(T||Sg)({...$w(N,{format:T}),accessList:i,authorizationList:s,blobs:o,chainId:J,data:a,from:D==null?void 0:D.address,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,to:K,value:P}),_e=Rg.get(t.uid),G=_e?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:G,params:[ue]},{retryCount:0})}catch(E){if(_e===!1)throw E;const m=E;if(m.name==="InvalidInputRpcError"||m.name==="InvalidParamsRpcError"||m.name==="MethodNotFoundRpcError"||m.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[ue]},{retryCount:0}).then(f=>(Rg.set(t.uid,!0),f)).catch(f=>{const g=f;throw g.name==="MethodNotFoundRpcError"||g.name==="MethodNotSupportedRpcError"?(Rg.set(t.uid,!1),m):g});throw m}}if((D==null?void 0:D.type)==="local"){const J=await fi(t,Ig,"prepareTransactionRequest")({account:D,accessList:i,authorizationList:s,blobs:o,chain:n,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,nonceManager:D.nonceManager,parameters:[...Gw,"sidecars"],value:P,...N,to:K}),T=(U=n==null?void 0:n.serializers)==null?void 0:U.transaction,z=await D.signTransaction(J,{serializer:T});return await fi(t,Jw,"sendRawTransaction")({serializedTransaction:z})}throw(D==null?void 0:D.type)==="smart"?new Tg({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Tg({docsPath:"/docs/actions/wallet/sendTransaction",type:D==null?void 0:D.type})}catch(K){throw K instanceof Tg?K:HI(K,{...e,account:D,chain:e.chain||void 0})}}async function WI(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:o,functionName:a,...u}=e;if(typeof n>"u")throw new Uf({docsPath:"/docs/contract/writeContract"});const l=n?fo(n):null,d=yM({abi:r,args:s,functionName:a});try{return await fi(t,Dg,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:i,account:l,...u})}catch(p){throw eI(p,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:a,sender:l==null?void 0:l.address})}}async function KI(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:Pr(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}const Og=256;let Wh=Og,Kh;function Xw(t=11){if(!Kh||Wh+t>Og*2){Kh="",Wh=0;for(let e=0;e{const B=k(D);for(const U in P)delete B[U];const j={...D,...B};return Object.assign(j,{extend:N(j)})}}return Object.assign(P,{extend:N(P)})}const Vh=new kh(8192);function GI(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(Vh.get(r))return Vh.get(r);const n=t().finally(()=>Vh.delete(r));return Vh.set(r,n),n}function YI(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const u=async({error:l})=>{const d=typeof e=="function"?e({count:a,error:l}):e;d&&await zI(d),o({count:a+1})};try{const l=await t();i(l)}catch(l){if(a{const{dedupe:i=!1,retryDelay:s=150,retryCount:o=3,uid:a}={...e,...n},u=i?Ef(Oh(`${a}.${Kc(r)}`)):void 0;return GI(()=>YI(async()=>{try{return await t(r)}catch(l){const d=l;switch(d.code){case Pf.code:throw new Pf(d);case Mf.code:throw new Mf(d);case If.code:throw new If(d,{method:r.method});case Cf.code:throw new Cf(d);case Ba.code:throw new Ba(d);case Tf.code:throw new Tf(d);case Rf.code:throw new Rf(d);case Df.code:throw new Df(d);case Of.code:throw new Of(d);case Nf.code:throw new Nf(d,{method:r.method});case Gc.code:throw new Gc(d);case Lf.code:throw new Lf(d);case Yc.code:throw new Yc(d);case kf.code:throw new kf(d);case Bf.code:throw new Bf(d);case $f.code:throw new $f(d);case Ff.code:throw new Ff(d);case jf.code:throw new jf(d);case 5e3:throw new Yc(d);default:throw l instanceof yt?l:new ZM(d)}}},{delay:({count:l,error:d})=>{var p;if(d&&d instanceof Dw){const y=(p=d==null?void 0:d.headers)==null?void 0:p.get("Retry-After");if(y!=null&&y.match(/\d/))return Number.parseInt(y)*1e3}return~~(1<XI(l)}),{enabled:i,id:u})}}function XI(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Gc.code||t.code===Ba.code:t instanceof Dw&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function ZI({key:t,name:e,request:r,retryCount:n=3,retryDelay:i=150,timeout:s,type:o},a){const u=Xw();return{config:{key:t,name:e,request:r,retryCount:n,retryDelay:i,timeout:s,type:o},request:JI(r,{retryCount:n,retryDelay:i,uid:u}),value:a}}function QI(t,e={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=e;return({retryCount:s})=>ZI({key:r,name:n,request:t.request.bind(t),retryCount:e.retryCount??s,retryDelay:i,type:"custom"})}const eC=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,tC=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;class rC extends yt{constructor({domain:e}){super(`Invalid domain "${Kc(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class nC extends yt{constructor({primaryType:e,types:r}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class iC extends yt{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function sC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(u,l)=>{const d={...l};for(const p of u){const{name:y,type:A}=p;A==="address"&&(d[y]=d[y].toLowerCase())}return d},o=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return Kc({domain:o,message:a,primaryType:n,types:i})}function oC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(o,a)=>{for(const u of o){const{name:l,type:d}=u,p=a[l],y=d.match(tC);if(y&&(typeof p=="number"||typeof p=="bigint")){const[N,D,k]=y;Pr(p,{signed:D==="int",size:Number.parseInt(k)/8})}if(d==="address"&&typeof p=="string"&&!uo(p))throw new zc({address:p});const A=d.match(eC);if(A){const[N,D]=A;if(D&&_n(p)!==Number.parseInt(D))throw new uP({expectedSize:Number.parseInt(D),givenSize:_n(p)})}const P=i[d];P&&(cC(d),s(P,p))}};if(i.EIP712Domain&&e){if(typeof e!="object")throw new rC({domain:e});s(i.EIP712Domain,e)}if(n!=="EIP712Domain")if(i[n])s(i[n],r);else throw new nC({primaryType:n,types:i})}function aC({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},typeof(t==null?void 0:t.chainId)=="number"&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function cC(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new iC({type:t})}let Zw=class extends ig{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,SP(e);const n=wf(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew Zw(t,e).update(r).digest();Qw.create=(t,e)=>new Zw(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ng=BigInt(0),Gh=BigInt(1),uC=BigInt(2);function $a(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function qf(t){if(!$a(t))throw new Error("Uint8Array expected")}function Xc(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)}const fC=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Zc(t){qf(t);let e="";for(let r=0;r=ho._0&&t<=ho._9)return t-ho._0;if(t>=ho._A&&t<=ho._F)return t-(ho._A-10);if(t>=ho._a&&t<=ho._f)return t-(ho._a-10)}function eu(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;itypeof t=="bigint"&&Ng<=t;function Yh(t,e,r){return $g(t)&&$g(e)&&$g(r)&&e<=t&&tNg;t>>=Gh,e+=1);return e}function pC(t,e){return t>>BigInt(e)&Gh}function gC(t,e,r){return t|(r?Gh:Ng)<(uC<new Uint8Array(t),r2=t=>Uint8Array.from(t);function n2(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=jg(t),i=jg(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...p)=>r(i,n,...p),u=(p=jg())=>{i=a(r2([0]),p),n=a(),p.length!==0&&(i=a(r2([1]),p),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let p=0;const y=[];for(;p{o(),u(p);let A;for(;!(A=y(l()));)u();return o(),A}}const mC={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||$a(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Hf(t,e,r={}){const n=(i,s,o)=>{const a=mC[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const u=t[i];if(!(o&&u===void 0)&&!a(u,t))throw new Error(`Invalid param ${String(i)}=${u} (${typeof u}), expected ${s}`)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const vC=()=>{throw new Error("not implemented")};function Ug(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}const bC=Object.freeze(Object.defineProperty({__proto__:null,aInRange:ja,abool:Xc,abytes:qf,bitGet:pC,bitLen:t2,bitMask:Fg,bitSet:gC,bytesToHex:Zc,bytesToNumberBE:Fa,bytesToNumberLE:kg,concatBytes:zf,createHmacDrbg:n2,ensureBytes:ds,equalBytes:hC,hexToBytes:eu,hexToNumber:Lg,inRange:Yh,isBytes:$a,memoized:Ug,notImplemented:vC,numberToBytesBE:tu,numberToBytesLE:Bg,numberToHexUnpadded:Qc,numberToVarBytesBE:lC,utf8ToBytes:dC,validateObject:Hf},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mn=BigInt(0),sn=BigInt(1),Ua=BigInt(2),yC=BigInt(3),qg=BigInt(4),i2=BigInt(5),s2=BigInt(8);BigInt(9),BigInt(16);function di(t,e){const r=t%e;return r>=Mn?r:e+r}function wC(t,e,r){if(r<=Mn||e 0");if(r===sn)return Mn;let n=sn;for(;e>Mn;)e&sn&&(n=n*t%r),t=t*t%r,e>>=sn;return n}function Ui(t,e,r){let n=t;for(;e-- >Mn;)n*=n,n%=r;return n}function zg(t,e){if(t===Mn||e<=Mn)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=di(t,e),n=e,i=Mn,s=sn;for(;r!==Mn;){const a=n/r,u=n%r,l=i-s*a;n=r,r=u,i=s,s=l}if(n!==sn)throw new Error("invert: does not exist");return di(i,e)}function xC(t){const e=(t-sn)/Ua;let r,n,i;for(r=t-sn,n=0;r%Ua===Mn;r/=Ua,n++);for(i=Ua;i(n[i]="function",n),e);return Hf(t,r)}function AC(t,e,r){if(r 0");if(r===Mn)return t.ONE;if(r===sn)return e;let n=t.ONE,i=e;for(;r>Mn;)r&sn&&(n=t.mul(n,i)),i=t.sqr(i),r>>=sn;return n}function PC(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function o2(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function a2(t,e,r=!1,n={}){if(t<=Mn)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=o2(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=_C(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:Fg(i),ZERO:Mn,ONE:sn,create:u=>di(u,t),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return Mn<=u&&uu===Mn,isOdd:u=>(u&sn)===sn,neg:u=>di(-u,t),eql:(u,l)=>u===l,sqr:u=>di(u*u,t),add:(u,l)=>di(u+l,t),sub:(u,l)=>di(u-l,t),mul:(u,l)=>di(u*l,t),pow:(u,l)=>AC(a,u,l),div:(u,l)=>di(u*zg(l,t),t),sqrN:u=>u*u,addN:(u,l)=>u+l,subN:(u,l)=>u-l,mulN:(u,l)=>u*l,inv:u=>zg(u,t),sqrt:n.sqrt||(u=>o(a,u)),invertBatch:u=>PC(a,u),cmov:(u,l,d)=>d?l:u,toBytes:u=>r?Bg(u,s):tu(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return r?kg(u):Fa(u)}});return Object.freeze(a)}function c2(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function u2(t){const e=c2(t);return e+Math.ceil(e/2)}function MC(t,e,r=!1){const n=t.length,i=c2(e),s=u2(e);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?Fa(t):kg(t),a=di(o,e-sn)+sn;return r?Bg(a,i):tu(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const IC=BigInt(0),Hg=BigInt(1),Wg=new WeakMap,f2=new WeakMap;function CC(t,e){const r=(s,o)=>{const a=o.negate();return s?a:o},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>e)throw new Error(`Wrong window size=${s}, should be [1..${e}]`)},i=s=>{n(s);const o=Math.ceil(e/s)+1,a=2**(s-1);return{windows:o,windowSize:a}};return{constTimeNegate:r,unsafeLadder(s,o){let a=t.ZERO,u=s;for(;o>IC;)o&Hg&&(a=a.add(u)),u=u.double(),o>>=Hg;return a},precomputeWindow(s,o){const{windows:a,windowSize:u}=i(o),l=[];let d=s,p=d;for(let y=0;y>=P,k>l&&(k-=A,a+=Hg);const B=D,j=D+Math.abs(k)-1,U=N%2!==0,K=k<0;k===0?p=p.add(r(U,o[B])):d=d.add(r(K,o[j]))}return{p:d,f:p}},wNAFCached(s,o,a){const u=f2.get(s)||1;let l=Wg.get(s);return l||(l=this.precomputeWindow(s,u),u!==1&&Wg.set(s,a(l))),this.wNAF(u,l,o)},setWindowSize(s,o){n(o),f2.set(s,o),Wg.delete(s)}}}function TC(t,e,r,n){if(!Array.isArray(r)||!Array.isArray(n)||n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((d,p)=>{if(!e.isValid(d))throw new Error(`wrong scalar at index ${p}`)}),r.forEach((d,p)=>{if(!(d instanceof t))throw new Error(`wrong point at index ${p}`)});const i=t2(BigInt(r.length)),s=i>12?i-3:i>4?i-2:i?2:1,o=(1<=0;d-=s){a.fill(t.ZERO);for(let y=0;y>BigInt(d)&BigInt(o));a[P]=a[P].add(r[y])}let p=t.ZERO;for(let y=a.length-1,A=t.ZERO;y>0;y--)A=A.add(a[y]),p=p.add(A);if(l=l.add(p),d!==0)for(let y=0;y{const{Err:r}=po;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=Qc(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?Qc(i.length/2|128):"";return`${Qc(t)}${s}${i}${e}`},decode(t,e){const{Err:r}=po;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");const l=e.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const d of l)o=o<<8|d;if(n+=u,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=po;if(t{const B=D.toAffine();return zf(Uint8Array.from([4]),r.toBytes(B.x),r.toBytes(B.y))}),s=e.fromBytes||(N=>{const D=N.subarray(1),k=r.fromBytes(D.subarray(0,r.BYTES)),B=r.fromBytes(D.subarray(r.BYTES,2*r.BYTES));return{x:k,y:B}});function o(N){const{a:D,b:k}=e,B=r.sqr(N),j=r.mul(B,N);return r.add(r.add(j,r.mul(N,D)),k)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(N){return Yh(N,In,e.n)}function u(N){const{allowedPrivateKeyLengths:D,nByteLength:k,wrapPrivateKey:B,n:j}=e;if(D&&typeof N!="bigint"){if($a(N)&&(N=Zc(N)),typeof N!="string"||!D.includes(N.length))throw new Error("Invalid key");N=N.padStart(k*2,"0")}let U;try{U=typeof N=="bigint"?N:Fa(ds("private key",N,k))}catch{throw new Error(`private key must be ${k} bytes, hex or bigint, not ${typeof N}`)}return B&&(U=di(U,j)),ja("private key",U,In,j),U}function l(N){if(!(N instanceof y))throw new Error("ProjectivePoint expected")}const d=Ug((N,D)=>{const{px:k,py:B,pz:j}=N;if(r.eql(j,r.ONE))return{x:k,y:B};const U=N.is0();D==null&&(D=U?r.ONE:r.inv(j));const K=r.mul(k,D),J=r.mul(B,D),T=r.mul(j,D);if(U)return{x:r.ZERO,y:r.ZERO};if(!r.eql(T,r.ONE))throw new Error("invZ was invalid");return{x:K,y:J}}),p=Ug(N=>{if(N.is0()){if(e.allowInfinityPoint&&!r.is0(N.py))return;throw new Error("bad point: ZERO")}const{x:D,y:k}=N.toAffine();if(!r.isValid(D)||!r.isValid(k))throw new Error("bad point: x or y not FE");const B=r.sqr(k),j=o(D);if(!r.eql(B,j))throw new Error("bad point: equation left != right");if(!N.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(D,k,B){if(this.px=D,this.py=k,this.pz=B,D==null||!r.isValid(D))throw new Error("x required");if(k==null||!r.isValid(k))throw new Error("y required");if(B==null||!r.isValid(B))throw new Error("z required");Object.freeze(this)}static fromAffine(D){const{x:k,y:B}=D||{};if(!D||!r.isValid(k)||!r.isValid(B))throw new Error("invalid affine point");if(D instanceof y)throw new Error("projective point not allowed");const j=U=>r.eql(U,r.ZERO);return j(k)&&j(B)?y.ZERO:new y(k,B,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(D){const k=r.invertBatch(D.map(B=>B.pz));return D.map((B,j)=>B.toAffine(k[j])).map(y.fromAffine)}static fromHex(D){const k=y.fromAffine(s(ds("pointHex",D)));return k.assertValidity(),k}static fromPrivateKey(D){return y.BASE.multiply(u(D))}static msm(D,k){return TC(y,n,D,k)}_setWindowSize(D){P.setWindowSize(this,D)}assertValidity(){p(this)}hasEvenY(){const{y:D}=this.toAffine();if(r.isOdd)return!r.isOdd(D);throw new Error("Field doesn't support isOdd")}equals(D){l(D);const{px:k,py:B,pz:j}=this,{px:U,py:K,pz:J}=D,T=r.eql(r.mul(k,J),r.mul(U,j)),z=r.eql(r.mul(B,J),r.mul(K,j));return T&&z}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){const{a:D,b:k}=e,B=r.mul(k,d2),{px:j,py:U,pz:K}=this;let J=r.ZERO,T=r.ZERO,z=r.ZERO,ue=r.mul(j,j),_e=r.mul(U,U),G=r.mul(K,K),E=r.mul(j,U);return E=r.add(E,E),z=r.mul(j,K),z=r.add(z,z),J=r.mul(D,z),T=r.mul(B,G),T=r.add(J,T),J=r.sub(_e,T),T=r.add(_e,T),T=r.mul(J,T),J=r.mul(E,J),z=r.mul(B,z),G=r.mul(D,G),E=r.sub(ue,G),E=r.mul(D,E),E=r.add(E,z),z=r.add(ue,ue),ue=r.add(z,ue),ue=r.add(ue,G),ue=r.mul(ue,E),T=r.add(T,ue),G=r.mul(U,K),G=r.add(G,G),ue=r.mul(G,E),J=r.sub(J,ue),z=r.mul(G,_e),z=r.add(z,z),z=r.add(z,z),new y(J,T,z)}add(D){l(D);const{px:k,py:B,pz:j}=this,{px:U,py:K,pz:J}=D;let T=r.ZERO,z=r.ZERO,ue=r.ZERO;const _e=e.a,G=r.mul(e.b,d2);let E=r.mul(k,U),m=r.mul(B,K),f=r.mul(j,J),g=r.add(k,B),v=r.add(U,K);g=r.mul(g,v),v=r.add(E,m),g=r.sub(g,v),v=r.add(k,j);let x=r.add(U,J);return v=r.mul(v,x),x=r.add(E,f),v=r.sub(v,x),x=r.add(B,j),T=r.add(K,J),x=r.mul(x,T),T=r.add(m,f),x=r.sub(x,T),ue=r.mul(_e,v),T=r.mul(G,f),ue=r.add(T,ue),T=r.sub(m,ue),ue=r.add(m,ue),z=r.mul(T,ue),m=r.add(E,E),m=r.add(m,E),f=r.mul(_e,f),v=r.mul(G,v),m=r.add(m,f),f=r.sub(E,f),f=r.mul(_e,f),v=r.add(v,f),E=r.mul(m,v),z=r.add(z,E),E=r.mul(x,v),T=r.mul(g,T),T=r.sub(T,E),E=r.mul(g,m),ue=r.mul(x,ue),ue=r.add(ue,E),new y(T,z,ue)}subtract(D){return this.add(D.negate())}is0(){return this.equals(y.ZERO)}wNAF(D){return P.wNAFCached(this,D,y.normalizeZ)}multiplyUnsafe(D){ja("scalar",D,go,e.n);const k=y.ZERO;if(D===go)return k;if(D===In)return this;const{endo:B}=e;if(!B)return P.unsafeLadder(this,D);let{k1neg:j,k1:U,k2neg:K,k2:J}=B.splitScalar(D),T=k,z=k,ue=this;for(;U>go||J>go;)U&In&&(T=T.add(ue)),J&In&&(z=z.add(ue)),ue=ue.double(),U>>=In,J>>=In;return j&&(T=T.negate()),K&&(z=z.negate()),z=new y(r.mul(z.px,B.beta),z.py,z.pz),T.add(z)}multiply(D){const{endo:k,n:B}=e;ja("scalar",D,In,B);let j,U;if(k){const{k1neg:K,k1:J,k2neg:T,k2:z}=k.splitScalar(D);let{p:ue,f:_e}=this.wNAF(J),{p:G,f:E}=this.wNAF(z);ue=P.constTimeNegate(K,ue),G=P.constTimeNegate(T,G),G=new y(r.mul(G.px,k.beta),G.py,G.pz),j=ue.add(G),U=_e.add(E)}else{const{p:K,f:J}=this.wNAF(D);j=K,U=J}return y.normalizeZ([j,U])[0]}multiplyAndAddUnsafe(D,k,B){const j=y.BASE,U=(J,T)=>T===go||T===In||!J.equals(j)?J.multiplyUnsafe(T):J.multiply(T),K=U(this,k).add(U(D,B));return K.is0()?void 0:K}toAffine(D){return d(this,D)}isTorsionFree(){const{h:D,isTorsionFree:k}=e;if(D===In)return!0;if(k)return k(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:D,clearCofactor:k}=e;return D===In?this:k?k(y,this):this.multiplyUnsafe(e.h)}toRawBytes(D=!0){return Xc("isCompressed",D),this.assertValidity(),i(y,this,D)}toHex(D=!0){return Xc("isCompressed",D),Zc(this.toRawBytes(D))}}y.BASE=new y(e.Gx,e.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);const A=e.nBitLength,P=CC(y,e.endo?Math.ceil(A/2):A);return{CURVE:e,ProjectivePoint:y,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:a}}function LC(t){const e=l2(t);return Hf(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function kC(t){const e=LC(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(f){return di(f,n)}function a(f){return zg(f,n)}const{ProjectivePoint:u,normPrivateKeyToScalar:l,weierstrassEquation:d,isWithinCurveOrder:p}=NC({...e,toBytes(f,g,v){const x=g.toAffine(),_=r.toBytes(x.x),S=zf;return Xc("isCompressed",v),v?S(Uint8Array.from([g.hasEvenY()?2:3]),_):S(Uint8Array.from([4]),_,r.toBytes(x.y))},fromBytes(f){const g=f.length,v=f[0],x=f.subarray(1);if(g===i&&(v===2||v===3)){const _=Fa(x);if(!Yh(_,In,r.ORDER))throw new Error("Point is not on curve");const S=d(_);let b;try{b=r.sqrt(S)}catch(F){const ae=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+ae)}const M=(b&In)===In;return(v&1)===1!==M&&(b=r.neg(b)),{x:_,y:b}}else if(g===s&&v===4){const _=r.fromBytes(x.subarray(0,r.BYTES)),S=r.fromBytes(x.subarray(r.BYTES,2*r.BYTES));return{x:_,y:S}}else throw new Error(`Point of length ${g} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`)}}),y=f=>Zc(tu(f,e.nByteLength));function A(f){const g=n>>In;return f>g}function P(f){return A(f)?o(-f):f}const N=(f,g,v)=>Fa(f.slice(g,v));class D{constructor(g,v,x){this.r=g,this.s=v,this.recovery=x,this.assertValidity()}static fromCompact(g){const v=e.nByteLength;return g=ds("compactSignature",g,v*2),new D(N(g,0,v),N(g,v,2*v))}static fromDER(g){const{r:v,s:x}=po.toSig(ds("DER",g));return new D(v,x)}assertValidity(){ja("r",this.r,In,n),ja("s",this.s,In,n)}addRecoveryBit(g){return new D(this.r,this.s,g)}recoverPublicKey(g){const{r:v,s:x,recovery:_}=this,S=J(ds("msgHash",g));if(_==null||![0,1,2,3].includes(_))throw new Error("recovery id invalid");const b=_===2||_===3?v+e.n:v;if(b>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const M=_&1?"03":"02",I=u.fromHex(M+y(b)),F=a(b),ae=o(-S*F),O=o(x*F),se=u.BASE.multiplyAndAddUnsafe(I,ae,O);if(!se)throw new Error("point at infinify");return se.assertValidity(),se}hasHighS(){return A(this.s)}normalizeS(){return this.hasHighS()?new D(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return eu(this.toDERHex())}toDERHex(){return po.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return eu(this.toCompactHex())}toCompactHex(){return y(this.r)+y(this.s)}}const k={isValidPrivateKey(f){try{return l(f),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const f=u2(e.n);return MC(e.randomBytes(f),e.n)},precompute(f=8,g=u.BASE){return g._setWindowSize(f),g.multiply(BigInt(3)),g}};function B(f,g=!0){return u.fromPrivateKey(f).toRawBytes(g)}function j(f){const g=$a(f),v=typeof f=="string",x=(g||v)&&f.length;return g?x===i||x===s:v?x===2*i||x===2*s:f instanceof u}function U(f,g,v=!0){if(j(f))throw new Error("first arg must be private key");if(!j(g))throw new Error("second arg must be public key");return u.fromHex(g).multiply(l(f)).toRawBytes(v)}const K=e.bits2int||function(f){const g=Fa(f),v=f.length*8-e.nBitLength;return v>0?g>>BigInt(v):g},J=e.bits2int_modN||function(f){return o(K(f))},T=Fg(e.nBitLength);function z(f){return ja(`num < 2^${e.nBitLength}`,f,go,T),tu(f,e.nByteLength)}function ue(f,g,v=_e){if(["recovered","canonical"].some(X=>X in v))throw new Error("sign() legacy options not supported");const{hash:x,randomBytes:_}=e;let{lowS:S,prehash:b,extraEntropy:M}=v;S==null&&(S=!0),f=ds("msgHash",f),h2(v),b&&(f=ds("prehashed msgHash",x(f)));const I=J(f),F=l(g),ae=[z(F),z(I)];if(M!=null&&M!==!1){const X=M===!0?_(r.BYTES):M;ae.push(ds("extraEntropy",X))}const O=zf(...ae),se=I;function ee(X){const Q=K(X);if(!p(Q))return;const R=a(Q),Z=u.BASE.multiply(Q).toAffine(),te=o(Z.x);if(te===go)return;const le=o(R*o(se+te*F));if(le===go)return;let ie=(Z.x===te?0:2)|Number(Z.y&In),fe=le;return S&&A(le)&&(fe=P(le),ie^=1),new D(te,fe,ie)}return{seed:O,k2sig:ee}}const _e={lowS:e.lowS,prehash:!1},G={lowS:e.lowS,prehash:!1};function E(f,g,v=_e){const{seed:x,k2sig:_}=ue(f,g,v),S=e;return n2(S.hash.outputLen,S.nByteLength,S.hmac)(x,_)}u.BASE._setWindowSize(8);function m(f,g,v,x=G){var Z;const _=f;if(g=ds("msgHash",g),v=ds("publicKey",v),"strict"in x)throw new Error("options.strict was renamed to lowS");h2(x);const{lowS:S,prehash:b}=x;let M,I;try{if(typeof _=="string"||$a(_))try{M=D.fromDER(_)}catch(te){if(!(te instanceof po.Err))throw te;M=D.fromCompact(_)}else if(typeof _=="object"&&typeof _.r=="bigint"&&typeof _.s=="bigint"){const{r:te,s:le}=_;M=new D(te,le)}else throw new Error("PARSE");I=u.fromHex(v)}catch(te){if(te.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(S&&M.hasHighS())return!1;b&&(g=e.hash(g));const{r:F,s:ae}=M,O=J(g),se=a(ae),ee=o(O*se),X=o(F*se),Q=(Z=u.BASE.multiplyAndAddUnsafe(I,ee,X))==null?void 0:Z.toAffine();return Q?o(Q.x)===F:!1}return{CURVE:e,getPublicKey:B,getSharedSecret:U,sign:E,verify:m,ProjectivePoint:u,Signature:D,utils:k}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function BC(t){return{hash:t,hmac:(e,...r)=>Qw(t,e,kP(...r)),randomBytes:$P}}function $C(t,e){const r=n=>kC({...t,...BC(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const p2=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),g2=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),FC=BigInt(1),Kg=BigInt(2),m2=(t,e)=>(t+e/Kg)/e;function jC(t){const e=p2,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),u=BigInt(88),l=t*t*t%e,d=l*l*t%e,p=Ui(d,r,e)*d%e,y=Ui(p,r,e)*d%e,A=Ui(y,Kg,e)*l%e,P=Ui(A,i,e)*A%e,N=Ui(P,s,e)*P%e,D=Ui(N,a,e)*N%e,k=Ui(D,u,e)*D%e,B=Ui(k,a,e)*N%e,j=Ui(B,r,e)*d%e,U=Ui(j,o,e)*P%e,K=Ui(U,n,e)*l%e,J=Ui(K,Kg,e);if(!Vg.eql(Vg.sqr(J),t))throw new Error("Cannot find square root");return J}const Vg=a2(p2,void 0,void 0,{sqrt:jC}),v2=$C({a:BigInt(0),b:BigInt(7),Fp:Vg,n:g2,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=g2,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-FC*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=m2(s*t,e),u=m2(-n*t,e);let l=di(t-a*r-u*i,e),d=di(-a*n-u*s,e);const p=l>o,y=d>o;if(p&&(l=e-l),y&&(d=e-d),l>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:p,k1:l,k2neg:y,k2:d}}}},Pg);BigInt(0),v2.ProjectivePoint;const UC=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:v2},Symbol.toStringTag,{value:"Module"}));function qC(t,e){const{abi:r,args:n,bytecode:i,...s}=e,o=qI({abi:r,args:n,bytecode:i});return Dg(t,{...s,data:o})}async function zC(t){var r;return((r=t.account)==null?void 0:r.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(n=>Sf(n))}async function HC(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}async function WC(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>og(r))}async function KC(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function VC(t,{account:e=t.account,message:r}){if(!e)throw new Uf({docsPath:"/docs/actions/wallet/signMessage"});const n=fo(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Oh(r):r.raw instanceof Uint8Array?Dh(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function GC(t,e){var l,d,p,y;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTransaction"});const s=fo(r);qh({account:s,...e});const o=await fi(t,Hh,"getChainId")({});n!==null&&Yw({currentChainId:o,chain:n});const a=(n==null?void 0:n.formatters)||((l=t.chain)==null?void 0:l.formatters),u=((d=a==null?void 0:a.transactionRequest)==null?void 0:d.format)||Sg;return s.signTransaction?s.signTransaction({...i,chainId:o},{serializer:(y=(p=t.chain)==null?void 0:p.serializers)==null?void 0:y.transaction}):await t.request({method:"eth_signTransaction",params:[{...u(i),chainId:Pr(o),from:s.address}]},{retryCount:0})}async function YC(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTypedData"});const o=fo(r),a={EIP712Domain:aC({domain:n}),...e.types};if(oC({domain:n,message:i,primaryType:s,types:a}),o.signTypedData)return o.signTypedData({domain:n,message:i,primaryType:s,types:a});const u=sC({domain:n,message:i,primaryType:s,types:a});return t.request({method:"eth_signTypedData_v4",params:[o.address,u]},{retryCount:0})}async function JC(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:Pr(e)}]},{retryCount:0})}async function XC(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}function ZC(t){return{addChain:e=>KI(t,e),deployContract:e=>qC(t,e),getAddresses:()=>zC(t),getChainId:()=>Hh(t),getPermissions:()=>HC(t),prepareTransactionRequest:e=>Ig(t,e),requestAddresses:()=>WC(t),requestPermissions:e=>KC(t,e),sendRawTransaction:e=>Jw(t,e),sendTransaction:e=>Dg(t,e),signMessage:e=>VC(t,e),signTransaction:e=>GC(t,e),signTypedData:e=>YC(t,e),switchChain:e=>JC(t,e),watchAsset:e=>XC(t,e),writeContract:e=>WI(t,e)}}function QC(t){const{key:e="wallet",name:r="Wallet Client",transport:n}=t;return VI({...t,key:e,name:r,transport:n,type:"walletClient"}).extend(ZC)}class Wf{constructor(e){oo(this,"_key");oo(this,"_config",null);oo(this,"_provider",null);oo(this,"_connected",!1);oo(this,"_address",null);oo(this,"_fatured",!1);oo(this,"_installed",!1);oo(this,"lastUsed",!1);var r;if("name"in e&&"image"in e)this._key=e.name,this._config=e,this._fatured=e.featured;else if("session"in e){if(!e.session)throw new Error("session is null");this._key=(r=e.session)==null?void 0:r.peer.metadata.name,this._provider=e,this._config={name:e.session.peer.metadata.name,image:e.session.peer.metadata.icons[0],featured:!1}}else if("info"in e)console.log(e.info,"installed"),this._key=e.info.name,this._provider=e.provider,this._installed=!0,this._config={name:e.info.name,image:e.info.icon,featured:!1},this.testConnect();else throw new Error("unknown params")}get address(){return this._address}get connected(){return this._connected}get featured(){return this._fatured}get key(){return this._key}get installed(){return this._installed}get client(){return this._provider?QC({transport:QI(this._provider)}):null}get config(){return this._config}static fromWalletConfig(e){return new Wf(e)}EIP6963Detected(e){this._provider=e.provider,this._installed=!0,this._provider.on("disconnect",this.disconnect),this._provider.on("accountsChanged",r=>{this._address=r[0],this._connected=!0}),this.testConnect()}setUniversalProvider(e){this._provider=e,this.testConnect()}async testConnect(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());e&&e.length>0?(this._address=e[0],this._connected=!0):(this._address=null,this._connected=!1)}async connect(){var r;const e=await((r=this.client)==null?void 0:r.request({method:"eth_requestAccounts",params:void 0}));if(!e)throw new Error("connect failed");return e}async getAddress(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());if(!e)throw new Error("get address failed");return e[0]}async getChain(){var r;const e=await((r=this.client)==null?void 0:r.getChainId());if(!e)throw new Error("get chain failed");return e}async signMessage(e,r){var i;return await((i=this.client)==null?void 0:i.signMessage({message:e,account:r}))}async disconnect(){this._provider&&"session"in this._provider&&await this._provider.disconnect(),this._connected=!1,this._address=null}}var Gg={exports:{}},ru=typeof Reflect=="object"?Reflect:null,b2=ru&&typeof ru.apply=="function"?ru.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Jh;ru&&typeof ru.ownKeys=="function"?Jh=ru.ownKeys:Object.getOwnPropertySymbols?Jh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Jh=function(e){return Object.getOwnPropertyNames(e)};function eT(t){console&&console.warn&&console.warn(t)}var y2=Number.isNaN||function(e){return e!==e};function Rr(){Rr.init.call(this)}Gg.exports=Rr,Gg.exports.once=iT,Rr.EventEmitter=Rr,Rr.prototype._events=void 0,Rr.prototype._eventsCount=0,Rr.prototype._maxListeners=void 0;var w2=10;function Xh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Rr,"defaultMaxListeners",{enumerable:!0,get:function(){return w2},set:function(t){if(typeof t!="number"||t<0||y2(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");w2=t}}),Rr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Rr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||y2(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function x2(t){return t._maxListeners===void 0?Rr.defaultMaxListeners:t._maxListeners}Rr.prototype.getMaxListeners=function(){return x2(this)},Rr.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")b2(u,this,r);else for(var l=u.length,d=P2(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,eT(a)}return t}Rr.prototype.addListener=function(e,r){return _2(this,e,r,!1)},Rr.prototype.on=Rr.prototype.addListener,Rr.prototype.prependListener=function(e,r){return _2(this,e,r,!0)};function tT(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function E2(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=tT.bind(n);return i.listener=r,n.wrapFn=i,i}Rr.prototype.once=function(e,r){return Xh(r),this.on(e,E2(this,e,r)),this},Rr.prototype.prependOnceListener=function(e,r){return Xh(r),this.prependListener(e,E2(this,e,r)),this},Rr.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Xh(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():rT(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Rr.prototype.off=Rr.prototype.removeListener,Rr.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function S2(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?nT(i):P2(i,i.length)}Rr.prototype.listeners=function(e){return S2(this,e,!0)},Rr.prototype.rawListeners=function(e){return S2(this,e,!1)},Rr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):A2.call(t,e)},Rr.prototype.listenerCount=A2;function A2(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Rr.prototype.eventNames=function(){return this._eventsCount>0?Jh(this._events):[]};function P2(t,e){for(var r=new Array(e),n=0;n(i==null?void 0:i.code)===Jc.code):t;return n instanceof yt?new Jc({cause:t,message:n.details}):Jc.nodeMessage.test(r)?new Jc({cause:t,message:t.details}):jh.nodeMessage.test(r)?new jh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):gg.nodeMessage.test(r)?new gg({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):mg.nodeMessage.test(r)?new mg({cause:t,nonce:e==null?void 0:e.nonce}):vg.nodeMessage.test(r)?new vg({cause:t,nonce:e==null?void 0:e.nonce}):bg.nodeMessage.test(r)?new bg({cause:t,nonce:e==null?void 0:e.nonce}):yg.nodeMessage.test(r)?new yg({cause:t}):wg.nodeMessage.test(r)?new wg({cause:t,gas:e==null?void 0:e.gas}):xg.nodeMessage.test(r)?new xg({cause:t,gas:e==null?void 0:e.gas}):_g.nodeMessage.test(r)?new _g({cause:t}):Uh.nodeMessage.test(r)?new Uh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new Eg({cause:t})}function uI(t,{docsPath:e,...r}){const n=(()=>{const i=$w(t,r);return i instanceof Eg?t:i})();return new cI(n,{docsPath:e,...r})}function Fw(t,{format:e}){if(!e)return{};const r={};function n(s){const o=Object.keys(s);for(const a of o)a in t&&(r[a]=t[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}const i=e(t||{});return n(i),r}const fI={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Sg(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=lI(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(r=>li(r)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=Pr(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=Pr(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=Pr(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=Pr(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=Pr(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=Pr(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=fI[t.type]),typeof t.value<"u"&&(e.value=Pr(t.value)),e}function lI(t){return t.map(e=>({address:e.contractAddress,r:e.r,s:e.s,chainId:Pr(e.chainId),nonce:Pr(e.nonce),...typeof e.yParity<"u"?{yParity:Pr(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:Pr(e.v)}:{}}))}function jw(t){if(!(!t||t.length===0))return t.reduce((e,{slot:r,value:n})=>{if(r.length!==66)throw new rw({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new rw({size:n.length,targetSize:66,type:"hex"});return e[r]=n,e},{})}function hI(t){const{balance:e,nonce:r,state:n,stateDiff:i,code:s}=t,o={};if(s!==void 0&&(o.code=s),e!==void 0&&(o.balance=Pr(e)),r!==void 0&&(o.nonce=Pr(r)),n!==void 0&&(o.state=jw(n)),i!==void 0){if(o.state)throw new UM;o.stateDiff=jw(i)}return o}function dI(t){if(!t)return;const e={};for(const{address:r,...n}of t){if(!uo(r,{strict:!1}))throw new zc({address:r});if(e[r])throw new jM({address:r});e[r]=hI(n)}return e}const pI=2n**256n-1n;function qh(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?fo(e):void 0;if(o&&!uo(o.address))throw new zc({address:o.address});if(s&&!uo(s))throw new zc({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new qM;if(n&&n>pI)throw new jh({maxFeePerGas:n});if(i&&n&&i>n)throw new Uh({maxFeePerGas:n,maxPriorityFeePerGas:i})}class gI extends yt{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Ag extends yt{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class mI extends yt{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${hs(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class vI extends yt{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}const bI={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function yI(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?Fc(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?Fc(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?bI[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=wI(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function wI(t){return t.map(e=>({contractAddress:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function xI(t){const e=(t.transactions??[]).map(r=>typeof r=="string"?r:yI(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function zh(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){var d,p,y;const s=n??"latest",o=i??!1,a=r!==void 0?Pr(r):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,o]},{dedupe:!0}):u=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]},{dedupe:!!a}),!u)throw new vI({blockHash:e,blockNumber:r});return(((y=(p=(d=t.chain)==null?void 0:d.formatters)==null?void 0:p.block)==null?void 0:y.format)||xI)(u)}async function Uw(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function _I(t,e){var s,o;const{block:r,chain:n=t.chain,request:i}=e||{};try{const a=((s=n==null?void 0:n.fees)==null?void 0:s.maxPriorityFeePerGas)??((o=n==null?void 0:n.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=r||await fi(t,zh,"getBlock")({}),d=await a({block:l,client:t,request:i});if(d===null)throw new Error;return d}if(typeof a<"u")return a;const u=await t.request({method:"eth_maxPriorityFeePerGas"});return yf(u)}catch{const[a,u]=await Promise.all([r?Promise.resolve(r):fi(t,zh,"getBlock")({}),fi(t,Uw,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new Ag;const l=u-a.baseFeePerGas;return l<0n?0n:l}}async function qw(t,e){var y,A;const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>{var P,N;return typeof((P=n==null?void 0:n.fees)==null?void 0:P.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):((N=n==null?void 0:n.fees)==null?void 0:N.baseFeeMultiplier)??1.2})();if(o<1)throw new gI;const u=10**(((y=o.toString().split(".")[1])==null?void 0:y.length)??0),l=P=>P*BigInt(Math.ceil(o*u))/BigInt(u),d=r||await fi(t,zh,"getBlock")({});if(typeof((A=n==null?void 0:n.fees)==null?void 0:A.estimateFeesPerGas)=="function"){const P=await n.fees.estimateFeesPerGas({block:r,client:t,multiply:l,request:i,type:s});if(P!==null)return P}if(s==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new Ag;const P=typeof(i==null?void 0:i.maxPriorityFeePerGas)=="bigint"?i.maxPriorityFeePerGas:await _I(t,{block:d,chain:n,request:i}),N=l(d.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??N+P,maxPriorityFeePerGas:P}}return{gasPrice:(i==null?void 0:i.gasPrice)??l(await fi(t,Uw,"getGasPrice")({}))}}async function EI(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,n?Pr(n):r]},{dedupe:!!n});return Fc(i)}function zw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(s=>co(s)):t.blobs,i=[];for(const s of n)i.push(Uint8Array.from(e.blobToKzgCommitment(s)));return r==="bytes"?i:i.map(s=>li(s))}function Hw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>co(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>co(o)):t.commitments,s=[];for(let o=0;oli(o))}function SI(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),u=n?4:0,l=n?0:4;t.setUint32(e+u,o,n),t.setUint32(e+l,a,n)}const AI=(t,e,r)=>t&e^~t&r,PI=(t,e,r)=>t&e^t&r^e&r;class MI extends ig{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ng(this.buffer)}update(e){Uc(this);const{view:r,buffer:n,blockLen:i}=this;e=wf(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let p=o;pd.length)throw new Error("_sha2: outputLen bigger than state");for(let p=0;p>>3,N=Os(A,17)^Os(A,19)^A>>>10;ea[p]=N+ea[p-7]+P+ea[p-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:u,G:l,H:d}=this;for(let p=0;p<64;p++){const y=Os(a,6)^Os(a,11)^Os(a,25),A=d+y+AI(a,u,l)+II[p]+ea[p]|0,N=(Os(n,2)^Os(n,13)^Os(n,22))+PI(n,i,s)|0;d=l,l=u,u=a,a=o+A|0,o=s,s=i,i=n,n=A+N|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(n,i,s,o,a,u,l,d)}roundClean(){ea.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Pg=fw(()=>new CI);function TI(t,e){return Pg(Jo(t,{strict:!1})?rg(t):t)}function RI(t){const{commitment:e,version:r=1}=t,n=t.to??(typeof e=="string"?"hex":"bytes"),i=TI(e);return i.set([r],0),n==="bytes"?i:li(i)}function DI(t){const{commitments:e,version:r}=t,n=t.to??(typeof e[0]=="string"?"hex":"bytes"),i=[];for(const s of e)i.push(RI({commitment:s,to:n,version:r}));return i}const Ww=6,Kw=32,Mg=4096,Vw=Kw*Mg,Gw=Vw*Ww-1-1*Mg*Ww;class OI extends yt{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class NI extends yt{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function LI(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),r=typeof t.data=="string"?co(t.data):t.data,n=_n(r);if(!n)throw new NI;if(n>Gw)throw new OI({maxSize:Gw,size:n});const i=[];let s=!0,o=0;for(;s;){const a=dg(new Uint8Array(Vw));let u=0;for(;ua.bytes):i.map(a=>li(a.bytes))}function kI(t){const{data:e,kzg:r,to:n}=t,i=t.blobs??LI({data:e,to:n}),s=t.commitments??zw({blobs:i,kzg:r,to:n}),o=t.proofs??Hw({blobs:i,commitments:s,kzg:r,to:n}),a=[];for(let u=0;u"u"&&p)if(u){const k=await D();y.nonce=await u.consume({address:p.address,chainId:k,client:t})}else y.nonce=await fi(t,EI,"getTransactionCount")({address:p.address,blockTag:"pending"});if((l.includes("fees")||l.includes("type"))&&typeof d>"u")try{y.type=BI(y)}catch{const k=await P();y.type=typeof(k==null?void 0:k.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(l.includes("fees"))if(y.type!=="legacy"&&y.type!=="eip2930"){if(typeof y.maxFeePerGas>"u"||typeof y.maxPriorityFeePerGas>"u"){const k=await P(),{maxFeePerGas:B,maxPriorityFeePerGas:j}=await qw(t,{block:k,chain:i,request:y});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(y.gas=await fi(t,FI,"estimateGas")({...y,account:p&&{address:p.address,type:"json-rpc"}})),qh(y),delete y.parameters,y}async function $I(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=r?Pr(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function FI(t,e){var i,s,o;const{account:r=t.account}=e,n=r?fo(r):void 0;try{let f=function(v){const{block:x,request:_,rpcStateOverride:S}=v;return t.request({method:"eth_estimateGas",params:S?[_,x??"latest",S]:x?[_,x]:[_]})};const{accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,blockNumber:p,blockTag:y,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:j,value:U,stateOverride:K,...J}=await Ig(t,{...e,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),z=(p?Pr(p):void 0)||y,ue=dI(K),_e=await(async()=>{if(J.to)return J.to;if(u&&u.length>0)return await Bw({authorization:u[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`")})})();qh(e);const G=(o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:o.format,m=(G||Sg)({...Fw(J,{format:G}),from:n==null?void 0:n.address,accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:j,to:_e,value:U});let g=BigInt(await f({block:z,request:m,rpcStateOverride:ue}));if(u){const v=await $I(t,{address:m.from}),x=await Promise.all(u.map(async _=>{const{contractAddress:S}=_,b=await f({block:z,request:{authorizationList:void 0,data:A,from:n==null?void 0:n.address,to:S,value:Pr(v)},rpcStateOverride:ue}).catch(()=>100000n);return 2n*BigInt(b)}));g+=x.reduce((_,S)=>_+S,0n)}return g}catch(a){throw uI(a,{...e,account:n,chain:t.chain})}}class jI extends yt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class UI extends yt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` +`),{name:"ChainNotFoundError"})}}const Cg="/docs/contract/encodeDeployData";function qI(t){const{abi:e,args:r,bytecode:n}=t;if(!r||r.length===0)return n;const i=e.find(o=>"type"in o&&o.type==="constructor");if(!i)throw new nP({docsPath:Cg});if(!("inputs"in i))throw new Xy({docsPath:Cg});if(!i.inputs||i.inputs.length===0)throw new Xy({docsPath:Cg});const s=Ew(i.inputs,r);return Bh([n,s])}async function zI(t){return new Promise(e=>setTimeout(e,t))}class Uf extends yt{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` +`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class Tg extends yt{constructor({docsPath:e,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:e,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function Jw({chain:t,currentChainId:e}){if(!t)throw new UI;if(e!==t.id)throw new jI({chain:t,currentChainId:e})}function HI(t,{docsPath:e,...r}){const n=(()=>{const i=$w(t,r);return i instanceof Eg?t:i})();return new HM(n,{docsPath:e,...r})}async function Xw(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const Rg=new kh(128);async function Dg(t,e){var k,B,j,U;const{account:r=t.account,chain:n=t.chain,accessList:i,authorizationList:s,blobs:o,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,value:P,...N}=e;if(typeof r>"u")throw new Uf({docsPath:"/docs/actions/wallet/sendTransaction"});const D=r?fo(r):null;try{qh(e);const K=await(async()=>{if(e.to)return e.to;if(s&&s.length>0)return await Bw({authorization:s[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`.")})})();if((D==null?void 0:D.type)==="json-rpc"||D===null){let J;n!==null&&(J=await fi(t,Hh,"getChainId")({}),Jw({currentChainId:J,chain:n}));const T=(j=(B=(k=t.chain)==null?void 0:k.formatters)==null?void 0:B.transactionRequest)==null?void 0:j.format,ue=(T||Sg)({...Fw(N,{format:T}),accessList:i,authorizationList:s,blobs:o,chainId:J,data:a,from:D==null?void 0:D.address,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,to:K,value:P}),_e=Rg.get(t.uid),G=_e?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:G,params:[ue]},{retryCount:0})}catch(E){if(_e===!1)throw E;const m=E;if(m.name==="InvalidInputRpcError"||m.name==="InvalidParamsRpcError"||m.name==="MethodNotFoundRpcError"||m.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[ue]},{retryCount:0}).then(f=>(Rg.set(t.uid,!0),f)).catch(f=>{const g=f;throw g.name==="MethodNotFoundRpcError"||g.name==="MethodNotSupportedRpcError"?(Rg.set(t.uid,!1),m):g});throw m}}if((D==null?void 0:D.type)==="local"){const J=await fi(t,Ig,"prepareTransactionRequest")({account:D,accessList:i,authorizationList:s,blobs:o,chain:n,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,nonceManager:D.nonceManager,parameters:[...Yw,"sidecars"],value:P,...N,to:K}),T=(U=n==null?void 0:n.serializers)==null?void 0:U.transaction,z=await D.signTransaction(J,{serializer:T});return await fi(t,Xw,"sendRawTransaction")({serializedTransaction:z})}throw(D==null?void 0:D.type)==="smart"?new Tg({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Tg({docsPath:"/docs/actions/wallet/sendTransaction",type:D==null?void 0:D.type})}catch(K){throw K instanceof Tg?K:HI(K,{...e,account:D,chain:e.chain||void 0})}}async function WI(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:o,functionName:a,...u}=e;if(typeof n>"u")throw new Uf({docsPath:"/docs/contract/writeContract"});const l=n?fo(n):null,d=yM({abi:r,args:s,functionName:a});try{return await fi(t,Dg,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:i,account:l,...u})}catch(p){throw eI(p,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:a,sender:l==null?void 0:l.address})}}async function KI(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:Pr(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}const Og=256;let Wh=Og,Kh;function Zw(t=11){if(!Kh||Wh+t>Og*2){Kh="",Wh=0;for(let e=0;e{const B=k(D);for(const U in P)delete B[U];const j={...D,...B};return Object.assign(j,{extend:N(j)})}}return Object.assign(P,{extend:N(P)})}const Vh=new kh(8192);function GI(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(Vh.get(r))return Vh.get(r);const n=t().finally(()=>Vh.delete(r));return Vh.set(r,n),n}function YI(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const u=async({error:l})=>{const d=typeof e=="function"?e({count:a,error:l}):e;d&&await zI(d),o({count:a+1})};try{const l=await t();i(l)}catch(l){if(a{const{dedupe:i=!1,retryDelay:s=150,retryCount:o=3,uid:a}={...e,...n},u=i?Ef(Oh(`${a}.${Kc(r)}`)):void 0;return GI(()=>YI(async()=>{try{return await t(r)}catch(l){const d=l;switch(d.code){case Pf.code:throw new Pf(d);case Mf.code:throw new Mf(d);case If.code:throw new If(d,{method:r.method});case Cf.code:throw new Cf(d);case Ba.code:throw new Ba(d);case Tf.code:throw new Tf(d);case Rf.code:throw new Rf(d);case Df.code:throw new Df(d);case Of.code:throw new Of(d);case Nf.code:throw new Nf(d,{method:r.method});case Gc.code:throw new Gc(d);case Lf.code:throw new Lf(d);case Yc.code:throw new Yc(d);case kf.code:throw new kf(d);case Bf.code:throw new Bf(d);case $f.code:throw new $f(d);case Ff.code:throw new Ff(d);case jf.code:throw new jf(d);case 5e3:throw new Yc(d);default:throw l instanceof yt?l:new ZM(d)}}},{delay:({count:l,error:d})=>{var p;if(d&&d instanceof Ow){const y=(p=d==null?void 0:d.headers)==null?void 0:p.get("Retry-After");if(y!=null&&y.match(/\d/))return Number.parseInt(y)*1e3}return~~(1<XI(l)}),{enabled:i,id:u})}}function XI(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Gc.code||t.code===Ba.code:t instanceof Ow&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function ZI({key:t,name:e,request:r,retryCount:n=3,retryDelay:i=150,timeout:s,type:o},a){const u=Zw();return{config:{key:t,name:e,request:r,retryCount:n,retryDelay:i,timeout:s,type:o},request:JI(r,{retryCount:n,retryDelay:i,uid:u}),value:a}}function QI(t,e={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=e;return({retryCount:s})=>ZI({key:r,name:n,request:t.request.bind(t),retryCount:e.retryCount??s,retryDelay:i,type:"custom"})}const eC=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,tC=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;class rC extends yt{constructor({domain:e}){super(`Invalid domain "${Kc(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class nC extends yt{constructor({primaryType:e,types:r}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class iC extends yt{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function sC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(u,l)=>{const d={...l};for(const p of u){const{name:y,type:A}=p;A==="address"&&(d[y]=d[y].toLowerCase())}return d},o=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return Kc({domain:o,message:a,primaryType:n,types:i})}function oC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(o,a)=>{for(const u of o){const{name:l,type:d}=u,p=a[l],y=d.match(tC);if(y&&(typeof p=="number"||typeof p=="bigint")){const[N,D,k]=y;Pr(p,{signed:D==="int",size:Number.parseInt(k)/8})}if(d==="address"&&typeof p=="string"&&!uo(p))throw new zc({address:p});const A=d.match(eC);if(A){const[N,D]=A;if(D&&_n(p)!==Number.parseInt(D))throw new uP({expectedSize:Number.parseInt(D),givenSize:_n(p)})}const P=i[d];P&&(cC(d),s(P,p))}};if(i.EIP712Domain&&e){if(typeof e!="object")throw new rC({domain:e});s(i.EIP712Domain,e)}if(n!=="EIP712Domain")if(i[n])s(i[n],r);else throw new nC({primaryType:n,types:i})}function aC({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},typeof(t==null?void 0:t.chainId)=="number"&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function cC(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new iC({type:t})}let Qw=class extends ig{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,SP(e);const n=wf(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew Qw(t,e).update(r).digest();e2.create=(t,e)=>new Qw(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ng=BigInt(0),Gh=BigInt(1),uC=BigInt(2);function $a(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function qf(t){if(!$a(t))throw new Error("Uint8Array expected")}function Xc(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)}const fC=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Zc(t){qf(t);let e="";for(let r=0;r=ho._0&&t<=ho._9)return t-ho._0;if(t>=ho._A&&t<=ho._F)return t-(ho._A-10);if(t>=ho._a&&t<=ho._f)return t-(ho._a-10)}function eu(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;itypeof t=="bigint"&&Ng<=t;function Yh(t,e,r){return $g(t)&&$g(e)&&$g(r)&&e<=t&&tNg;t>>=Gh,e+=1);return e}function pC(t,e){return t>>BigInt(e)&Gh}function gC(t,e,r){return t|(r?Gh:Ng)<(uC<new Uint8Array(t),n2=t=>Uint8Array.from(t);function i2(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=jg(t),i=jg(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...p)=>r(i,n,...p),u=(p=jg())=>{i=a(n2([0]),p),n=a(),p.length!==0&&(i=a(n2([1]),p),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let p=0;const y=[];for(;p{o(),u(p);let A;for(;!(A=y(l()));)u();return o(),A}}const mC={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||$a(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Hf(t,e,r={}){const n=(i,s,o)=>{const a=mC[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const u=t[i];if(!(o&&u===void 0)&&!a(u,t))throw new Error(`Invalid param ${String(i)}=${u} (${typeof u}), expected ${s}`)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const vC=()=>{throw new Error("not implemented")};function Ug(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}const bC=Object.freeze(Object.defineProperty({__proto__:null,aInRange:ja,abool:Xc,abytes:qf,bitGet:pC,bitLen:r2,bitMask:Fg,bitSet:gC,bytesToHex:Zc,bytesToNumberBE:Fa,bytesToNumberLE:kg,concatBytes:zf,createHmacDrbg:i2,ensureBytes:ds,equalBytes:hC,hexToBytes:eu,hexToNumber:Lg,inRange:Yh,isBytes:$a,memoized:Ug,notImplemented:vC,numberToBytesBE:tu,numberToBytesLE:Bg,numberToHexUnpadded:Qc,numberToVarBytesBE:lC,utf8ToBytes:dC,validateObject:Hf},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mn=BigInt(0),sn=BigInt(1),Ua=BigInt(2),yC=BigInt(3),qg=BigInt(4),s2=BigInt(5),o2=BigInt(8);BigInt(9),BigInt(16);function di(t,e){const r=t%e;return r>=Mn?r:e+r}function wC(t,e,r){if(r<=Mn||e 0");if(r===sn)return Mn;let n=sn;for(;e>Mn;)e&sn&&(n=n*t%r),t=t*t%r,e>>=sn;return n}function Ui(t,e,r){let n=t;for(;e-- >Mn;)n*=n,n%=r;return n}function zg(t,e){if(t===Mn||e<=Mn)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=di(t,e),n=e,i=Mn,s=sn;for(;r!==Mn;){const a=n/r,u=n%r,l=i-s*a;n=r,r=u,i=s,s=l}if(n!==sn)throw new Error("invert: does not exist");return di(i,e)}function xC(t){const e=(t-sn)/Ua;let r,n,i;for(r=t-sn,n=0;r%Ua===Mn;r/=Ua,n++);for(i=Ua;i(n[i]="function",n),e);return Hf(t,r)}function AC(t,e,r){if(r 0");if(r===Mn)return t.ONE;if(r===sn)return e;let n=t.ONE,i=e;for(;r>Mn;)r&sn&&(n=t.mul(n,i)),i=t.sqr(i),r>>=sn;return n}function PC(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function a2(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function c2(t,e,r=!1,n={}){if(t<=Mn)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=a2(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=_C(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:Fg(i),ZERO:Mn,ONE:sn,create:u=>di(u,t),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return Mn<=u&&uu===Mn,isOdd:u=>(u&sn)===sn,neg:u=>di(-u,t),eql:(u,l)=>u===l,sqr:u=>di(u*u,t),add:(u,l)=>di(u+l,t),sub:(u,l)=>di(u-l,t),mul:(u,l)=>di(u*l,t),pow:(u,l)=>AC(a,u,l),div:(u,l)=>di(u*zg(l,t),t),sqrN:u=>u*u,addN:(u,l)=>u+l,subN:(u,l)=>u-l,mulN:(u,l)=>u*l,inv:u=>zg(u,t),sqrt:n.sqrt||(u=>o(a,u)),invertBatch:u=>PC(a,u),cmov:(u,l,d)=>d?l:u,toBytes:u=>r?Bg(u,s):tu(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return r?kg(u):Fa(u)}});return Object.freeze(a)}function u2(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function f2(t){const e=u2(t);return e+Math.ceil(e/2)}function MC(t,e,r=!1){const n=t.length,i=u2(e),s=f2(e);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?Fa(t):kg(t),a=di(o,e-sn)+sn;return r?Bg(a,i):tu(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const IC=BigInt(0),Hg=BigInt(1),Wg=new WeakMap,l2=new WeakMap;function CC(t,e){const r=(s,o)=>{const a=o.negate();return s?a:o},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>e)throw new Error(`Wrong window size=${s}, should be [1..${e}]`)},i=s=>{n(s);const o=Math.ceil(e/s)+1,a=2**(s-1);return{windows:o,windowSize:a}};return{constTimeNegate:r,unsafeLadder(s,o){let a=t.ZERO,u=s;for(;o>IC;)o&Hg&&(a=a.add(u)),u=u.double(),o>>=Hg;return a},precomputeWindow(s,o){const{windows:a,windowSize:u}=i(o),l=[];let d=s,p=d;for(let y=0;y>=P,k>l&&(k-=A,a+=Hg);const B=D,j=D+Math.abs(k)-1,U=N%2!==0,K=k<0;k===0?p=p.add(r(U,o[B])):d=d.add(r(K,o[j]))}return{p:d,f:p}},wNAFCached(s,o,a){const u=l2.get(s)||1;let l=Wg.get(s);return l||(l=this.precomputeWindow(s,u),u!==1&&Wg.set(s,a(l))),this.wNAF(u,l,o)},setWindowSize(s,o){n(o),l2.set(s,o),Wg.delete(s)}}}function TC(t,e,r,n){if(!Array.isArray(r)||!Array.isArray(n)||n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((d,p)=>{if(!e.isValid(d))throw new Error(`wrong scalar at index ${p}`)}),r.forEach((d,p)=>{if(!(d instanceof t))throw new Error(`wrong point at index ${p}`)});const i=r2(BigInt(r.length)),s=i>12?i-3:i>4?i-2:i?2:1,o=(1<=0;d-=s){a.fill(t.ZERO);for(let y=0;y>BigInt(d)&BigInt(o));a[P]=a[P].add(r[y])}let p=t.ZERO;for(let y=a.length-1,A=t.ZERO;y>0;y--)A=A.add(a[y]),p=p.add(A);if(l=l.add(p),d!==0)for(let y=0;y{const{Err:r}=po;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=Qc(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?Qc(i.length/2|128):"";return`${Qc(t)}${s}${i}${e}`},decode(t,e){const{Err:r}=po;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");const l=e.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const d of l)o=o<<8|d;if(n+=u,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=po;if(t{const B=D.toAffine();return zf(Uint8Array.from([4]),r.toBytes(B.x),r.toBytes(B.y))}),s=e.fromBytes||(N=>{const D=N.subarray(1),k=r.fromBytes(D.subarray(0,r.BYTES)),B=r.fromBytes(D.subarray(r.BYTES,2*r.BYTES));return{x:k,y:B}});function o(N){const{a:D,b:k}=e,B=r.sqr(N),j=r.mul(B,N);return r.add(r.add(j,r.mul(N,D)),k)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(N){return Yh(N,In,e.n)}function u(N){const{allowedPrivateKeyLengths:D,nByteLength:k,wrapPrivateKey:B,n:j}=e;if(D&&typeof N!="bigint"){if($a(N)&&(N=Zc(N)),typeof N!="string"||!D.includes(N.length))throw new Error("Invalid key");N=N.padStart(k*2,"0")}let U;try{U=typeof N=="bigint"?N:Fa(ds("private key",N,k))}catch{throw new Error(`private key must be ${k} bytes, hex or bigint, not ${typeof N}`)}return B&&(U=di(U,j)),ja("private key",U,In,j),U}function l(N){if(!(N instanceof y))throw new Error("ProjectivePoint expected")}const d=Ug((N,D)=>{const{px:k,py:B,pz:j}=N;if(r.eql(j,r.ONE))return{x:k,y:B};const U=N.is0();D==null&&(D=U?r.ONE:r.inv(j));const K=r.mul(k,D),J=r.mul(B,D),T=r.mul(j,D);if(U)return{x:r.ZERO,y:r.ZERO};if(!r.eql(T,r.ONE))throw new Error("invZ was invalid");return{x:K,y:J}}),p=Ug(N=>{if(N.is0()){if(e.allowInfinityPoint&&!r.is0(N.py))return;throw new Error("bad point: ZERO")}const{x:D,y:k}=N.toAffine();if(!r.isValid(D)||!r.isValid(k))throw new Error("bad point: x or y not FE");const B=r.sqr(k),j=o(D);if(!r.eql(B,j))throw new Error("bad point: equation left != right");if(!N.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(D,k,B){if(this.px=D,this.py=k,this.pz=B,D==null||!r.isValid(D))throw new Error("x required");if(k==null||!r.isValid(k))throw new Error("y required");if(B==null||!r.isValid(B))throw new Error("z required");Object.freeze(this)}static fromAffine(D){const{x:k,y:B}=D||{};if(!D||!r.isValid(k)||!r.isValid(B))throw new Error("invalid affine point");if(D instanceof y)throw new Error("projective point not allowed");const j=U=>r.eql(U,r.ZERO);return j(k)&&j(B)?y.ZERO:new y(k,B,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(D){const k=r.invertBatch(D.map(B=>B.pz));return D.map((B,j)=>B.toAffine(k[j])).map(y.fromAffine)}static fromHex(D){const k=y.fromAffine(s(ds("pointHex",D)));return k.assertValidity(),k}static fromPrivateKey(D){return y.BASE.multiply(u(D))}static msm(D,k){return TC(y,n,D,k)}_setWindowSize(D){P.setWindowSize(this,D)}assertValidity(){p(this)}hasEvenY(){const{y:D}=this.toAffine();if(r.isOdd)return!r.isOdd(D);throw new Error("Field doesn't support isOdd")}equals(D){l(D);const{px:k,py:B,pz:j}=this,{px:U,py:K,pz:J}=D,T=r.eql(r.mul(k,J),r.mul(U,j)),z=r.eql(r.mul(B,J),r.mul(K,j));return T&&z}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){const{a:D,b:k}=e,B=r.mul(k,p2),{px:j,py:U,pz:K}=this;let J=r.ZERO,T=r.ZERO,z=r.ZERO,ue=r.mul(j,j),_e=r.mul(U,U),G=r.mul(K,K),E=r.mul(j,U);return E=r.add(E,E),z=r.mul(j,K),z=r.add(z,z),J=r.mul(D,z),T=r.mul(B,G),T=r.add(J,T),J=r.sub(_e,T),T=r.add(_e,T),T=r.mul(J,T),J=r.mul(E,J),z=r.mul(B,z),G=r.mul(D,G),E=r.sub(ue,G),E=r.mul(D,E),E=r.add(E,z),z=r.add(ue,ue),ue=r.add(z,ue),ue=r.add(ue,G),ue=r.mul(ue,E),T=r.add(T,ue),G=r.mul(U,K),G=r.add(G,G),ue=r.mul(G,E),J=r.sub(J,ue),z=r.mul(G,_e),z=r.add(z,z),z=r.add(z,z),new y(J,T,z)}add(D){l(D);const{px:k,py:B,pz:j}=this,{px:U,py:K,pz:J}=D;let T=r.ZERO,z=r.ZERO,ue=r.ZERO;const _e=e.a,G=r.mul(e.b,p2);let E=r.mul(k,U),m=r.mul(B,K),f=r.mul(j,J),g=r.add(k,B),v=r.add(U,K);g=r.mul(g,v),v=r.add(E,m),g=r.sub(g,v),v=r.add(k,j);let x=r.add(U,J);return v=r.mul(v,x),x=r.add(E,f),v=r.sub(v,x),x=r.add(B,j),T=r.add(K,J),x=r.mul(x,T),T=r.add(m,f),x=r.sub(x,T),ue=r.mul(_e,v),T=r.mul(G,f),ue=r.add(T,ue),T=r.sub(m,ue),ue=r.add(m,ue),z=r.mul(T,ue),m=r.add(E,E),m=r.add(m,E),f=r.mul(_e,f),v=r.mul(G,v),m=r.add(m,f),f=r.sub(E,f),f=r.mul(_e,f),v=r.add(v,f),E=r.mul(m,v),z=r.add(z,E),E=r.mul(x,v),T=r.mul(g,T),T=r.sub(T,E),E=r.mul(g,m),ue=r.mul(x,ue),ue=r.add(ue,E),new y(T,z,ue)}subtract(D){return this.add(D.negate())}is0(){return this.equals(y.ZERO)}wNAF(D){return P.wNAFCached(this,D,y.normalizeZ)}multiplyUnsafe(D){ja("scalar",D,go,e.n);const k=y.ZERO;if(D===go)return k;if(D===In)return this;const{endo:B}=e;if(!B)return P.unsafeLadder(this,D);let{k1neg:j,k1:U,k2neg:K,k2:J}=B.splitScalar(D),T=k,z=k,ue=this;for(;U>go||J>go;)U&In&&(T=T.add(ue)),J&In&&(z=z.add(ue)),ue=ue.double(),U>>=In,J>>=In;return j&&(T=T.negate()),K&&(z=z.negate()),z=new y(r.mul(z.px,B.beta),z.py,z.pz),T.add(z)}multiply(D){const{endo:k,n:B}=e;ja("scalar",D,In,B);let j,U;if(k){const{k1neg:K,k1:J,k2neg:T,k2:z}=k.splitScalar(D);let{p:ue,f:_e}=this.wNAF(J),{p:G,f:E}=this.wNAF(z);ue=P.constTimeNegate(K,ue),G=P.constTimeNegate(T,G),G=new y(r.mul(G.px,k.beta),G.py,G.pz),j=ue.add(G),U=_e.add(E)}else{const{p:K,f:J}=this.wNAF(D);j=K,U=J}return y.normalizeZ([j,U])[0]}multiplyAndAddUnsafe(D,k,B){const j=y.BASE,U=(J,T)=>T===go||T===In||!J.equals(j)?J.multiplyUnsafe(T):J.multiply(T),K=U(this,k).add(U(D,B));return K.is0()?void 0:K}toAffine(D){return d(this,D)}isTorsionFree(){const{h:D,isTorsionFree:k}=e;if(D===In)return!0;if(k)return k(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:D,clearCofactor:k}=e;return D===In?this:k?k(y,this):this.multiplyUnsafe(e.h)}toRawBytes(D=!0){return Xc("isCompressed",D),this.assertValidity(),i(y,this,D)}toHex(D=!0){return Xc("isCompressed",D),Zc(this.toRawBytes(D))}}y.BASE=new y(e.Gx,e.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);const A=e.nBitLength,P=CC(y,e.endo?Math.ceil(A/2):A);return{CURVE:e,ProjectivePoint:y,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:a}}function LC(t){const e=h2(t);return Hf(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function kC(t){const e=LC(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(f){return di(f,n)}function a(f){return zg(f,n)}const{ProjectivePoint:u,normPrivateKeyToScalar:l,weierstrassEquation:d,isWithinCurveOrder:p}=NC({...e,toBytes(f,g,v){const x=g.toAffine(),_=r.toBytes(x.x),S=zf;return Xc("isCompressed",v),v?S(Uint8Array.from([g.hasEvenY()?2:3]),_):S(Uint8Array.from([4]),_,r.toBytes(x.y))},fromBytes(f){const g=f.length,v=f[0],x=f.subarray(1);if(g===i&&(v===2||v===3)){const _=Fa(x);if(!Yh(_,In,r.ORDER))throw new Error("Point is not on curve");const S=d(_);let b;try{b=r.sqrt(S)}catch(F){const ae=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+ae)}const M=(b&In)===In;return(v&1)===1!==M&&(b=r.neg(b)),{x:_,y:b}}else if(g===s&&v===4){const _=r.fromBytes(x.subarray(0,r.BYTES)),S=r.fromBytes(x.subarray(r.BYTES,2*r.BYTES));return{x:_,y:S}}else throw new Error(`Point of length ${g} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`)}}),y=f=>Zc(tu(f,e.nByteLength));function A(f){const g=n>>In;return f>g}function P(f){return A(f)?o(-f):f}const N=(f,g,v)=>Fa(f.slice(g,v));class D{constructor(g,v,x){this.r=g,this.s=v,this.recovery=x,this.assertValidity()}static fromCompact(g){const v=e.nByteLength;return g=ds("compactSignature",g,v*2),new D(N(g,0,v),N(g,v,2*v))}static fromDER(g){const{r:v,s:x}=po.toSig(ds("DER",g));return new D(v,x)}assertValidity(){ja("r",this.r,In,n),ja("s",this.s,In,n)}addRecoveryBit(g){return new D(this.r,this.s,g)}recoverPublicKey(g){const{r:v,s:x,recovery:_}=this,S=J(ds("msgHash",g));if(_==null||![0,1,2,3].includes(_))throw new Error("recovery id invalid");const b=_===2||_===3?v+e.n:v;if(b>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const M=_&1?"03":"02",I=u.fromHex(M+y(b)),F=a(b),ae=o(-S*F),O=o(x*F),se=u.BASE.multiplyAndAddUnsafe(I,ae,O);if(!se)throw new Error("point at infinify");return se.assertValidity(),se}hasHighS(){return A(this.s)}normalizeS(){return this.hasHighS()?new D(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return eu(this.toDERHex())}toDERHex(){return po.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return eu(this.toCompactHex())}toCompactHex(){return y(this.r)+y(this.s)}}const k={isValidPrivateKey(f){try{return l(f),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const f=f2(e.n);return MC(e.randomBytes(f),e.n)},precompute(f=8,g=u.BASE){return g._setWindowSize(f),g.multiply(BigInt(3)),g}};function B(f,g=!0){return u.fromPrivateKey(f).toRawBytes(g)}function j(f){const g=$a(f),v=typeof f=="string",x=(g||v)&&f.length;return g?x===i||x===s:v?x===2*i||x===2*s:f instanceof u}function U(f,g,v=!0){if(j(f))throw new Error("first arg must be private key");if(!j(g))throw new Error("second arg must be public key");return u.fromHex(g).multiply(l(f)).toRawBytes(v)}const K=e.bits2int||function(f){const g=Fa(f),v=f.length*8-e.nBitLength;return v>0?g>>BigInt(v):g},J=e.bits2int_modN||function(f){return o(K(f))},T=Fg(e.nBitLength);function z(f){return ja(`num < 2^${e.nBitLength}`,f,go,T),tu(f,e.nByteLength)}function ue(f,g,v=_e){if(["recovered","canonical"].some(X=>X in v))throw new Error("sign() legacy options not supported");const{hash:x,randomBytes:_}=e;let{lowS:S,prehash:b,extraEntropy:M}=v;S==null&&(S=!0),f=ds("msgHash",f),d2(v),b&&(f=ds("prehashed msgHash",x(f)));const I=J(f),F=l(g),ae=[z(F),z(I)];if(M!=null&&M!==!1){const X=M===!0?_(r.BYTES):M;ae.push(ds("extraEntropy",X))}const O=zf(...ae),se=I;function ee(X){const Q=K(X);if(!p(Q))return;const R=a(Q),Z=u.BASE.multiply(Q).toAffine(),te=o(Z.x);if(te===go)return;const le=o(R*o(se+te*F));if(le===go)return;let ie=(Z.x===te?0:2)|Number(Z.y&In),fe=le;return S&&A(le)&&(fe=P(le),ie^=1),new D(te,fe,ie)}return{seed:O,k2sig:ee}}const _e={lowS:e.lowS,prehash:!1},G={lowS:e.lowS,prehash:!1};function E(f,g,v=_e){const{seed:x,k2sig:_}=ue(f,g,v),S=e;return i2(S.hash.outputLen,S.nByteLength,S.hmac)(x,_)}u.BASE._setWindowSize(8);function m(f,g,v,x=G){var Z;const _=f;if(g=ds("msgHash",g),v=ds("publicKey",v),"strict"in x)throw new Error("options.strict was renamed to lowS");d2(x);const{lowS:S,prehash:b}=x;let M,I;try{if(typeof _=="string"||$a(_))try{M=D.fromDER(_)}catch(te){if(!(te instanceof po.Err))throw te;M=D.fromCompact(_)}else if(typeof _=="object"&&typeof _.r=="bigint"&&typeof _.s=="bigint"){const{r:te,s:le}=_;M=new D(te,le)}else throw new Error("PARSE");I=u.fromHex(v)}catch(te){if(te.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(S&&M.hasHighS())return!1;b&&(g=e.hash(g));const{r:F,s:ae}=M,O=J(g),se=a(ae),ee=o(O*se),X=o(F*se),Q=(Z=u.BASE.multiplyAndAddUnsafe(I,ee,X))==null?void 0:Z.toAffine();return Q?o(Q.x)===F:!1}return{CURVE:e,getPublicKey:B,getSharedSecret:U,sign:E,verify:m,ProjectivePoint:u,Signature:D,utils:k}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function BC(t){return{hash:t,hmac:(e,...r)=>e2(t,e,kP(...r)),randomBytes:$P}}function $C(t,e){const r=n=>kC({...t,...BC(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const g2=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),m2=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),FC=BigInt(1),Kg=BigInt(2),v2=(t,e)=>(t+e/Kg)/e;function jC(t){const e=g2,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),u=BigInt(88),l=t*t*t%e,d=l*l*t%e,p=Ui(d,r,e)*d%e,y=Ui(p,r,e)*d%e,A=Ui(y,Kg,e)*l%e,P=Ui(A,i,e)*A%e,N=Ui(P,s,e)*P%e,D=Ui(N,a,e)*N%e,k=Ui(D,u,e)*D%e,B=Ui(k,a,e)*N%e,j=Ui(B,r,e)*d%e,U=Ui(j,o,e)*P%e,K=Ui(U,n,e)*l%e,J=Ui(K,Kg,e);if(!Vg.eql(Vg.sqr(J),t))throw new Error("Cannot find square root");return J}const Vg=c2(g2,void 0,void 0,{sqrt:jC}),b2=$C({a:BigInt(0),b:BigInt(7),Fp:Vg,n:m2,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=m2,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-FC*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=v2(s*t,e),u=v2(-n*t,e);let l=di(t-a*r-u*i,e),d=di(-a*n-u*s,e);const p=l>o,y=d>o;if(p&&(l=e-l),y&&(d=e-d),l>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:p,k1:l,k2neg:y,k2:d}}}},Pg);BigInt(0),b2.ProjectivePoint;const UC=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:b2},Symbol.toStringTag,{value:"Module"}));function qC(t,e){const{abi:r,args:n,bytecode:i,...s}=e,o=qI({abi:r,args:n,bytecode:i});return Dg(t,{...s,data:o})}async function zC(t){var r;return((r=t.account)==null?void 0:r.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(n=>Sf(n))}async function HC(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}async function WC(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>og(r))}async function KC(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function VC(t,{account:e=t.account,message:r}){if(!e)throw new Uf({docsPath:"/docs/actions/wallet/signMessage"});const n=fo(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Oh(r):r.raw instanceof Uint8Array?Dh(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function GC(t,e){var l,d,p,y;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTransaction"});const s=fo(r);qh({account:s,...e});const o=await fi(t,Hh,"getChainId")({});n!==null&&Jw({currentChainId:o,chain:n});const a=(n==null?void 0:n.formatters)||((l=t.chain)==null?void 0:l.formatters),u=((d=a==null?void 0:a.transactionRequest)==null?void 0:d.format)||Sg;return s.signTransaction?s.signTransaction({...i,chainId:o},{serializer:(y=(p=t.chain)==null?void 0:p.serializers)==null?void 0:y.transaction}):await t.request({method:"eth_signTransaction",params:[{...u(i),chainId:Pr(o),from:s.address}]},{retryCount:0})}async function YC(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTypedData"});const o=fo(r),a={EIP712Domain:aC({domain:n}),...e.types};if(oC({domain:n,message:i,primaryType:s,types:a}),o.signTypedData)return o.signTypedData({domain:n,message:i,primaryType:s,types:a});const u=sC({domain:n,message:i,primaryType:s,types:a});return t.request({method:"eth_signTypedData_v4",params:[o.address,u]},{retryCount:0})}async function JC(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:Pr(e)}]},{retryCount:0})}async function XC(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}function ZC(t){return{addChain:e=>KI(t,e),deployContract:e=>qC(t,e),getAddresses:()=>zC(t),getChainId:()=>Hh(t),getPermissions:()=>HC(t),prepareTransactionRequest:e=>Ig(t,e),requestAddresses:()=>WC(t),requestPermissions:e=>KC(t,e),sendRawTransaction:e=>Xw(t,e),sendTransaction:e=>Dg(t,e),signMessage:e=>VC(t,e),signTransaction:e=>GC(t,e),signTypedData:e=>YC(t,e),switchChain:e=>JC(t,e),watchAsset:e=>XC(t,e),writeContract:e=>WI(t,e)}}function QC(t){const{key:e="wallet",name:r="Wallet Client",transport:n}=t;return VI({...t,key:e,name:r,transport:n,type:"walletClient"}).extend(ZC)}class Wf{constructor(e){oo(this,"_key");oo(this,"_config",null);oo(this,"_provider",null);oo(this,"_connected",!1);oo(this,"_address",null);oo(this,"_fatured",!1);oo(this,"_installed",!1);oo(this,"lastUsed",!1);var r;if("name"in e&&"image"in e)this._key=e.name,this._config=e,this._fatured=e.featured;else if("session"in e){if(!e.session)throw new Error("session is null");this._key=(r=e.session)==null?void 0:r.peer.metadata.name,this._provider=e,this._config={name:e.session.peer.metadata.name,image:e.session.peer.metadata.icons[0],featured:!1}}else if("info"in e)console.log(e.info,"installed"),this._key=e.info.name,this._provider=e.provider,this._installed=!0,this._config={name:e.info.name,image:e.info.icon,featured:!1},this.testConnect();else throw new Error("unknown params")}get address(){return this._address}get connected(){return this._connected}get featured(){return this._fatured}get key(){return this._key}get installed(){return this._installed}get provider(){return this._provider}get client(){return this._provider?QC({transport:QI(this._provider)}):null}get config(){return this._config}static fromWalletConfig(e){return new Wf(e)}EIP6963Detected(e){this._provider=e.provider,this._installed=!0,this._provider.on("disconnect",this.disconnect),this._provider.on("accountsChanged",r=>{this._address=r[0],this._connected=!0}),this.testConnect()}setUniversalProvider(e){this._provider=e,this.testConnect()}async testConnect(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());e&&e.length>0?(this._address=e[0],this._connected=!0):(this._address=null,this._connected=!1)}async connect(){var r;const e=await((r=this.client)==null?void 0:r.request({method:"eth_requestAccounts",params:void 0}));if(!e)throw new Error("connect failed");return e}async getAddress(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());if(!e)throw new Error("get address failed");return e[0]}async getChain(){var r;const e=await((r=this.client)==null?void 0:r.getChainId());if(!e)throw new Error("get chain failed");return e}async signMessage(e,r){var i;return await((i=this.client)==null?void 0:i.signMessage({message:e,account:r}))}async disconnect(){this._provider&&"session"in this._provider&&await this._provider.disconnect(),this._connected=!1,this._address=null}}var Gg={exports:{}},ru=typeof Reflect=="object"?Reflect:null,y2=ru&&typeof ru.apply=="function"?ru.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Jh;ru&&typeof ru.ownKeys=="function"?Jh=ru.ownKeys:Object.getOwnPropertySymbols?Jh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Jh=function(e){return Object.getOwnPropertyNames(e)};function eT(t){console&&console.warn&&console.warn(t)}var w2=Number.isNaN||function(e){return e!==e};function Rr(){Rr.init.call(this)}Gg.exports=Rr,Gg.exports.once=iT,Rr.EventEmitter=Rr,Rr.prototype._events=void 0,Rr.prototype._eventsCount=0,Rr.prototype._maxListeners=void 0;var x2=10;function Xh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Rr,"defaultMaxListeners",{enumerable:!0,get:function(){return x2},set:function(t){if(typeof t!="number"||t<0||w2(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");x2=t}}),Rr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Rr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||w2(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function _2(t){return t._maxListeners===void 0?Rr.defaultMaxListeners:t._maxListeners}Rr.prototype.getMaxListeners=function(){return _2(this)},Rr.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")y2(u,this,r);else for(var l=u.length,d=M2(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,eT(a)}return t}Rr.prototype.addListener=function(e,r){return E2(this,e,r,!1)},Rr.prototype.on=Rr.prototype.addListener,Rr.prototype.prependListener=function(e,r){return E2(this,e,r,!0)};function tT(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function S2(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=tT.bind(n);return i.listener=r,n.wrapFn=i,i}Rr.prototype.once=function(e,r){return Xh(r),this.on(e,S2(this,e,r)),this},Rr.prototype.prependOnceListener=function(e,r){return Xh(r),this.prependListener(e,S2(this,e,r)),this},Rr.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Xh(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():rT(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Rr.prototype.off=Rr.prototype.removeListener,Rr.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function A2(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?nT(i):M2(i,i.length)}Rr.prototype.listeners=function(e){return A2(this,e,!0)},Rr.prototype.rawListeners=function(e){return A2(this,e,!1)},Rr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):P2.call(t,e)},Rr.prototype.listenerCount=P2;function P2(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Rr.prototype.eventNames=function(){return this._eventsCount>0?Jh(this._events):[]};function M2(t,e){for(var r=new Array(e),n=0;n=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function uT(t,e){return function(r,n){e(r,n,t)}}function fT(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function lT(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(d){try{l(n.next(d))}catch(p){o(p)}}function u(d){try{l(n.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):i(d.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function hT(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return u([l,d])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function I2(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function gT(){for(var t=[],e=0;e1||a(y,A)})})}function a(y,A){try{u(n[y](A))}catch(P){p(s[0][3],P)}}function u(y){y.value instanceof Kf?Promise.resolve(y.value.v).then(l,d):p(s[0][2],y)}function l(y){a("next",y)}function d(y){a("throw",y)}function p(y,A){y(A),s.shift(),s.length&&a(s[0][0],s[0][1])}}function bT(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Kf(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function yT(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Zg=="function"?Zg(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function wT(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function xT(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function _T(t){return t&&t.__esModule?t:{default:t}}function ET(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function ST(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const Vf=Jp(Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Xg},__asyncDelegator:bT,__asyncGenerator:vT,__asyncValues:yT,__await:Kf,__awaiter:lT,__classPrivateFieldGet:ET,__classPrivateFieldSet:ST,__createBinding:dT,__decorate:cT,__exportStar:pT,__extends:oT,__generator:hT,__importDefault:_T,__importStar:xT,__makeTemplateObject:wT,__metadata:fT,__param:uT,__read:I2,__rest:aT,__spread:gT,__spreadArrays:mT,__values:Zg},Symbol.toStringTag,{value:"Module"})));var Qg={},Gf={},C2;function AT(){if(C2)return Gf;C2=1,Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Gf.delay=t,Gf}var qa={},em={},za={},T2;function PT(){return T2||(T2=1,Object.defineProperty(za,"__esModule",{value:!0}),za.ONE_THOUSAND=za.ONE_HUNDRED=void 0,za.ONE_HUNDRED=100,za.ONE_THOUSAND=1e3),za}var tm={},R2;function MT(){return R2||(R2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(tm)),tm}var D2;function O2(){return D2||(D2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(PT(),t),e.__exportStar(MT(),t)}(em)),em}var N2;function IT(){if(N2)return qa;N2=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.fromMiliseconds=qa.toMiliseconds=void 0;const t=O2();function e(n){return n*t.ONE_THOUSAND}qa.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return qa.fromMiliseconds=r,qa}var L2;function CT(){return L2||(L2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(AT(),t),e.__exportStar(IT(),t)}(Qg)),Qg}var nu={},k2;function TT(){if(k2)return nu;k2=1,Object.defineProperty(nu,"__esModule",{value:!0}),nu.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return nu.Watch=t,nu.default=t,nu}var rm={},Yf={},B2;function RT(){if(B2)return Yf;B2=1,Object.defineProperty(Yf,"__esModule",{value:!0}),Yf.IWatch=void 0;class t{}return Yf.IWatch=t,Yf}var $2;function DT(){return $2||($2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Vf.__exportStar(RT(),t)}(rm)),rm}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(CT(),t),e.__exportStar(TT(),t),e.__exportStar(DT(),t),e.__exportStar(O2(),t)})(mt);class Ha{}let OT=class extends Ha{constructor(e){super()}};const F2=mt.FIVE_SECONDS,iu={pulse:"heartbeat_pulse"};let NT=class GA extends OT{constructor(e){super(e),this.events=new qi.EventEmitter,this.interval=F2,this.interval=(e==null?void 0:e.interval)||F2}static async init(e){const r=new GA(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),mt.toMiliseconds(this.interval))}pulse(){this.events.emit(iu.pulse)}};const LT=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,kT=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,BT=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function $T(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){FT(t);return}return e}function FT(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Zh(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!BT.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(LT.test(t)||kT.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,$T)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function jT(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Cn(t,...e){try{return jT(t(...e))}catch(r){return Promise.reject(r)}}function UT(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function qT(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Qh(t){if(UT(t))return String(t);if(qT(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Qh(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function j2(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const nm="base64:";function zT(t){if(typeof t=="string")return t;j2();const e=Buffer.from(t).toString("base64");return nm+e}function HT(t){return typeof t!="string"||!t.startsWith(nm)?t:(j2(),Buffer.from(t.slice(nm.length),"base64"))}function pi(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function WT(...t){return pi(t.join(":"))}function ed(t){return t=pi(t),t?t+":":""}function doe(t){return t}const KT="memory",VT=()=>{const t=new Map;return{name:KT,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function GT(t={}){const e={mounts:{"":t.driver||VT()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const d of e.mountpoints)if(l.startsWith(d))return{base:d,relativeKey:l.slice(d.length),driver:e.mounts[d]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,d)=>e.mountpoints.filter(p=>p.startsWith(l)||d&&l.startsWith(p)).map(p=>({relativeBase:l.length>p.length?l.slice(p.length):void 0,mountpoint:p,driver:e.mounts[p]})),i=(l,d)=>{if(e.watching){d=pi(d);for(const p of e.watchListeners)p(l,d)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await U2(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,d,p)=>{const y=new Map,A=P=>{let N=y.get(P.base);return N||(N={driver:P.driver,base:P.base,items:[]},y.set(P.base,N)),N};for(const P of l){const N=typeof P=="string",D=pi(N?P:P.key),k=N?void 0:P.value,B=N||!P.options?d:{...d,...P.options},j=r(D);A(j).items.push({key:D,value:k,relativeKey:j.relativeKey,options:B})}return Promise.all([...y.values()].map(P=>p(P))).then(P=>P.flat())},u={hasItem(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return Cn(y.hasItem,p,d)},getItem(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return Cn(y.getItem,p,d).then(A=>Zh(A))},getItems(l,d){return a(l,d,p=>p.driver.getItems?Cn(p.driver.getItems,p.items.map(y=>({key:y.relativeKey,options:y.options})),d).then(y=>y.map(A=>({key:WT(p.base,A.key),value:Zh(A.value)}))):Promise.all(p.items.map(y=>Cn(p.driver.getItem,y.relativeKey,y.options).then(A=>({key:y.key,value:Zh(A)})))))},getItemRaw(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return y.getItemRaw?Cn(y.getItemRaw,p,d):Cn(y.getItem,p,d).then(A=>HT(A))},async setItem(l,d,p={}){if(d===void 0)return u.removeItem(l);l=pi(l);const{relativeKey:y,driver:A}=r(l);A.setItem&&(await Cn(A.setItem,y,Qh(d),p),A.watch||i("update",l))},async setItems(l,d){await a(l,d,async p=>{if(p.driver.setItems)return Cn(p.driver.setItems,p.items.map(y=>({key:y.relativeKey,value:Qh(y.value),options:y.options})),d);p.driver.setItem&&await Promise.all(p.items.map(y=>Cn(p.driver.setItem,y.relativeKey,Qh(y.value),y.options)))})},async setItemRaw(l,d,p={}){if(d===void 0)return u.removeItem(l,p);l=pi(l);const{relativeKey:y,driver:A}=r(l);if(A.setItemRaw)await Cn(A.setItemRaw,y,d,p);else if(A.setItem)await Cn(A.setItem,y,zT(d),p);else return;A.watch||i("update",l)},async removeItem(l,d={}){typeof d=="boolean"&&(d={removeMeta:d}),l=pi(l);const{relativeKey:p,driver:y}=r(l);y.removeItem&&(await Cn(y.removeItem,p,d),(d.removeMeta||d.removeMata)&&await Cn(y.removeItem,p+"$",d),y.watch||i("remove",l))},async getMeta(l,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),l=pi(l);const{relativeKey:p,driver:y}=r(l),A=Object.create(null);if(y.getMeta&&Object.assign(A,await Cn(y.getMeta,p,d)),!d.nativeOnly){const P=await Cn(y.getItem,p+"$",d).then(N=>Zh(N));P&&typeof P=="object"&&(typeof P.atime=="string"&&(P.atime=new Date(P.atime)),typeof P.mtime=="string"&&(P.mtime=new Date(P.mtime)),Object.assign(A,P))}return A},setMeta(l,d,p={}){return this.setItem(l+"$",d,p)},removeMeta(l,d={}){return this.removeItem(l+"$",d)},async getKeys(l,d={}){l=ed(l);const p=n(l,!0);let y=[];const A=[];for(const P of p){const N=await Cn(P.driver.getKeys,P.relativeBase,d);for(const D of N){const k=P.mountpoint+pi(D);y.some(B=>k.startsWith(B))||A.push(k)}y=[P.mountpoint,...y.filter(D=>!D.startsWith(P.mountpoint))]}return l?A.filter(P=>P.startsWith(l)&&P[P.length-1]!=="$"):A.filter(P=>P[P.length-1]!=="$")},async clear(l,d={}){l=ed(l),await Promise.all(n(l,!1).map(async p=>{if(p.driver.clear)return Cn(p.driver.clear,p.relativeBase,d);if(p.driver.removeItem){const y=await p.driver.getKeys(p.relativeBase||"",d);return Promise.all(y.map(A=>p.driver.removeItem(A,d)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>q2(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(d=>d!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,d){if(l=ed(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((p,y)=>y.length-p.length)),e.mounts[l]=d,e.watching&&Promise.resolve(U2(d,i,l)).then(p=>{e.unwatch[l]=p}).catch(console.error),u},async unmount(l,d=!0){l=ed(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),d&&await q2(e.mounts[l]),e.mountpoints=e.mountpoints.filter(p=>p!==l),delete e.mounts[l])},getMount(l=""){l=pi(l)+":";const d=r(l);return{driver:d.driver,base:d.base}},getMounts(l="",d={}){return l=pi(l),n(l,d.parents).map(y=>({driver:y.driver,base:y.mountpoint}))},keys:(l,d={})=>u.getKeys(l,d),get:(l,d={})=>u.getItem(l,d),set:(l,d,p={})=>u.setItem(l,d,p),has:(l,d={})=>u.hasItem(l,d),del:(l,d={})=>u.removeItem(l,d),remove:(l,d={})=>u.removeItem(l,d)};return u}function U2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function q2(t){typeof t.dispose=="function"&&await Cn(t.dispose)}function Wa(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function z2(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Wa(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let im;function Jf(){return im||(im=z2("keyval-store","keyval")),im}function H2(t,e=Jf()){return e("readonly",r=>Wa(r.get(t)))}function YT(t,e,r=Jf()){return r("readwrite",n=>(n.put(e,t),Wa(n.transaction)))}function JT(t,e=Jf()){return e("readwrite",r=>(r.delete(t),Wa(r.transaction)))}function XT(t=Jf()){return t("readwrite",e=>(e.clear(),Wa(e.transaction)))}function ZT(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Wa(t.transaction)}function QT(t=Jf()){return t("readonly",e=>{if(e.getAllKeys)return Wa(e.getAllKeys());const r=[];return ZT(e,n=>r.push(n.key)).then(()=>r)})}const eR=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),tR=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Ka(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return tR(t)}catch{return t}}function mo(t){return typeof t=="string"?t:eR(t)||""}const rR="idb-keyval";var nR=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=z2(t.dbName,t.storeName)),{name:rR,options:t,async hasItem(i){return!(typeof await H2(r(i),n)>"u")},async getItem(i){return await H2(r(i),n)??null},setItem(i,s){return YT(r(i),s,n)},removeItem(i){return JT(r(i),n)},getKeys(){return QT(n)},clear(){return XT(n)}}};const iR="WALLET_CONNECT_V2_INDEXED_DB",sR="keyvaluestorage";let oR=class{constructor(){this.indexedDb=GT({driver:nR({dbName:iR,storeName:sR})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,mo(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var sm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},td={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof sm<"u"&&sm.localStorage?td.exports=sm.localStorage:typeof window<"u"&&window.localStorage?td.exports=window.localStorage:td.exports=new e})();function aR(t){var e;return[t[0],Ka((e=t[1])!=null?e:"")]}let cR=class{constructor(){this.localStorage=td.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(aR)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Ka(r)}async setItem(e,r){this.localStorage.setItem(e,mo(r))}async removeItem(e){this.localStorage.removeItem(e)}};const uR="wc_storage_version",W2=1,fR=async(t,e,r)=>{const n=uR,i=await e.getItem(n);if(i&&i>=W2){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,W2),r(e),lR(t,o)},lR=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let hR=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new cR;this.storage=e;try{const r=new oR;fR(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function dR(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var pR=gR;function gR(t,e,r){var n=r&&r.stringify||dR,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?p:0,t.charCodeAt(A+1)){case 100:case 102:if(d>=u||e[d]==null)break;p=u||e[d]==null)break;p=u||e[d]===void 0)break;p",p=A+2,A++;break}l+=n(e[d]),p=A+2,A++;break;case 115:if(d>=u)break;p-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",u=Object.create(r);u.log||(u.log=Zf),Object.defineProperty(u,"levelVal",{get:d}),Object.defineProperty(u,"level",{get:p,set:y});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:_R(t)};u.levels=vo.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Zf,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=A,e&&(u._logEvent=om());function d(){return this.level==="silent"?1/0:this.levels.values[this.level]}function p(){return this._level}function y(P){if(P!=="silent"&&!this.levels.values[P])throw Error("unknown level "+P);this._level=P,ou(l,u,"error","log"),ou(l,u,"fatal","error"),ou(l,u,"warn","error"),ou(l,u,"info","log"),ou(l,u,"debug","log"),ou(l,u,"trace","log")}function A(P,N){if(!P)throw new Error("missing bindings for child Pino");N=N||{},i&&P.serializers&&(N.serializers=P.serializers);const D=N.serializers;if(i&&D){var k=Object.assign({},n,D),B=t.browser.serialize===!0?Object.keys(k):i;delete P.serializers,rd([P],B,k,this._stdErrSerialize)}function j(U){this._childLevel=(U._childLevel|0)+1,this.error=au(U,P,"error"),this.fatal=au(U,P,"fatal"),this.warn=au(U,P,"warn"),this.info=au(U,P,"info"),this.debug=au(U,P,"debug"),this.trace=au(U,P,"trace"),k&&(this.serializers=k,this._serialize=B),e&&(this._logEvent=om([].concat(U._logEvent.bindings,P)))}return j.prototype=this,new j(this)}return u}vo.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},vo.stdSerializers=mR,vo.stdTimeFunctions=Object.assign({},{nullTime:V2,epochTime:G2,unixTime:ER,isoTime:SR});function ou(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Zf:i[r]?i[r]:Xf[r]||Xf[n]||Zf,bR(t,e,r)}function bR(t,e,r){!t.transmit&&e[r]===Zf||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Xf?Xf:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function au(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},J2=class{constructor(e,r=cm){this.level=e??"error",this.levelValue=su.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Y2(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===su.levels.values.error?console.error(e):r===su.levels.values.warn?console.warn(e):r===su.levels.values.debug?console.debug(e):r===su.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(mo({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new Y2(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(mo({extraMetadata:e})),new Blob(r,{type:"application/json"})}},IR=class{constructor(e,r=cm){this.baseChunkLogger=new J2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},CR=class{constructor(e,r=cm){this.baseChunkLogger=new J2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var TR=Object.defineProperty,RR=Object.defineProperties,DR=Object.getOwnPropertyDescriptors,X2=Object.getOwnPropertySymbols,OR=Object.prototype.hasOwnProperty,NR=Object.prototype.propertyIsEnumerable,Z2=(t,e,r)=>e in t?TR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,id=(t,e)=>{for(var r in e||(e={}))OR.call(e,r)&&Z2(t,r,e[r]);if(X2)for(var r of X2(e))NR.call(e,r)&&Z2(t,r,e[r]);return t},sd=(t,e)=>RR(t,DR(e));function od(t){return sd(id({},t),{level:(t==null?void 0:t.level)||PR.level})}function LR(t,e=el){return t[e]||""}function kR(t,e,r=el){return t[r]=e,t}function gi(t,e=el){let r="";return typeof t.bindings>"u"?r=LR(t,e):r=t.bindings().context||"",r}function BR(t,e,r=el){const n=gi(t,r);return n.trim()?`${n}/${e}`:e}function ri(t,e,r=el){const n=BR(t,e,r),i=t.child({context:n});return kR(i,n,r)}function $R(t){var e,r;const n=new IR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace",browser:sd(id({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function FR(t){var e;const r=new CR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function jR(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?$R(t):FR(t)}let UR=class extends Ha{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},qR=class extends Ha{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},zR=class{constructor(e,r){this.logger=e,this.core=r}},HR=class extends Ha{constructor(e,r){super(),this.relayer=e,this.logger=r}},WR=class extends Ha{constructor(e){super()}},KR=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},VR=class extends Ha{constructor(e,r){super(),this.relayer=e,this.logger=r}},GR=class extends Ha{constructor(e,r){super(),this.core=e,this.logger=r}},YR=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},JR=class{constructor(e,r){this.projectId=e,this.logger=r}},XR=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},ZR=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},QR=class{constructor(e){this.client=e}};var um={},ta={},ad={},cd={};Object.defineProperty(cd,"__esModule",{value:!0}),cd.BrowserRandomSource=void 0;const Q2=65536;class eD{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let n=0;n>>16&65535,d=a&65535,p=u>>>16&65535,y=u&65535;return d*y+(l*y+d*p<<16>>>0)|0}t.mul=Math.imul||e;function r(a,u){return a+u|0}t.add=r;function n(a,u){return a-u|0}t.sub=n;function i(a,u){return a<>>32-u}t.rotl=i;function s(a,u){return a<<32-u|a>>>u}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(tx),Object.defineProperty(or,"__esModule",{value:!0});var rx=tx;function aD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}or.readInt16BE=aD;function cD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}or.readUint16BE=cD;function uD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}or.readInt16LE=uD;function fD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}or.readUint16LE=fD;function nx(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}or.writeUint16BE=nx,or.writeInt16BE=nx;function ix(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}or.writeUint16LE=ix,or.writeInt16LE=ix;function fm(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}or.readInt32BE=fm;function lm(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}or.readUint32BE=lm;function hm(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}or.readInt32LE=hm;function dm(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}or.readUint32LE=dm;function fd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}or.writeUint32BE=fd,or.writeInt32BE=fd;function ld(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}or.writeUint32LE=ld,or.writeInt32LE=ld;function lD(t,e){e===void 0&&(e=0);var r=fm(t,e),n=fm(t,e+4);return r*4294967296+n-(n>>31)*4294967296}or.readInt64BE=lD;function hD(t,e){e===void 0&&(e=0);var r=lm(t,e),n=lm(t,e+4);return r*4294967296+n}or.readUint64BE=hD;function dD(t,e){e===void 0&&(e=0);var r=hm(t,e),n=hm(t,e+4);return n*4294967296+r-(r>>31)*4294967296}or.readInt64LE=dD;function pD(t,e){e===void 0&&(e=0);var r=dm(t,e),n=dm(t,e+4);return n*4294967296+r}or.readUint64LE=pD;function sx(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fd(t/4294967296>>>0,e,r),fd(t>>>0,e,r+4),e}or.writeUint64BE=sx,or.writeInt64BE=sx;function ox(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ld(t>>>0,e,r),ld(t/4294967296>>>0,e,r+4),e}or.writeUint64LE=ox,or.writeInt64LE=ox;function gD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}or.readUintBE=gD;function mD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}or.writeUintBE=vD;function bD(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!rx.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s256)throw new Error("randomString charset is too long");let y="";const A=d.length,P=256-256%A;for(;l>0;){const N=i(Math.ceil(l*256/P),p);for(let D=0;D0;D++){const k=N[D];k0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,A=l%128<112?128:256;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._stateHi.set(u.stateHi),this._stateLo.set(u.stateLo),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.stateHi),r.wipe(u.stateLo),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,u,l,d,p,y,A){for(var P=l[0],N=l[1],D=l[2],k=l[3],B=l[4],j=l[5],U=l[6],K=l[7],J=d[0],T=d[1],z=d[2],ue=d[3],_e=d[4],G=d[5],E=d[6],m=d[7],f,g,v,x,_,S,b,M;A>=128;){for(var I=0;I<16;I++){var F=8*I+y;a[I]=e.readUint32BE(p,F),u[I]=e.readUint32BE(p,F+4)}for(var I=0;I<80;I++){var ae=P,O=N,se=D,ee=k,X=B,Q=j,R=U,Z=K,te=J,le=T,ie=z,fe=ue,ve=_e,Me=G,Ne=E,Te=m;if(f=K,g=m,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=(B>>>14|_e<<18)^(B>>>18|_e<<14)^(_e>>>9|B<<23),g=(_e>>>14|B<<18)^(_e>>>18|B<<14)^(B>>>9|_e<<23),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=B&j^~B&U,g=_e&G^~_e&E,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=i[I*2],g=i[I*2+1],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=a[I%16],g=u[I%16],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,v=b&65535|M<<16,x=_&65535|S<<16,f=v,g=x,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=(P>>>28|J<<4)^(J>>>2|P<<30)^(J>>>7|P<<25),g=(J>>>28|P<<4)^(P>>>2|J<<30)^(P>>>7|J<<25),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=P&N^P&D^N&D,g=J&T^J&z^T&z,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,Z=b&65535|M<<16,Te=_&65535|S<<16,f=ee,g=fe,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=v,g=x,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,ee=b&65535|M<<16,fe=_&65535|S<<16,N=ae,D=O,k=se,B=ee,j=X,U=Q,K=R,P=Z,T=te,z=le,ue=ie,_e=fe,G=ve,E=Me,m=Ne,J=Te,I%16===15)for(var F=0;F<16;F++)f=a[F],g=u[F],_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=a[(F+9)%16],g=u[(F+9)%16],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,v=a[(F+1)%16],x=u[(F+1)%16],f=(v>>>1|x<<31)^(v>>>8|x<<24)^v>>>7,g=(x>>>1|v<<31)^(x>>>8|v<<24)^(x>>>7|v<<25),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,v=a[(F+14)%16],x=u[(F+14)%16],f=(v>>>19|x<<13)^(x>>>29|v<<3)^v>>>6,g=(x>>>19|v<<13)^(v>>>29|x<<3)^(x>>>6|v<<26),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,a[F]=b&65535|M<<16,u[F]=_&65535|S<<16}f=P,g=J,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[0],g=d[0],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[0]=P=b&65535|M<<16,d[0]=J=_&65535|S<<16,f=N,g=T,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[1],g=d[1],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[1]=N=b&65535|M<<16,d[1]=T=_&65535|S<<16,f=D,g=z,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[2],g=d[2],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[2]=D=b&65535|M<<16,d[2]=z=_&65535|S<<16,f=k,g=ue,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[3],g=d[3],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[3]=k=b&65535|M<<16,d[3]=ue=_&65535|S<<16,f=B,g=_e,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[4],g=d[4],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[4]=B=b&65535|M<<16,d[4]=_e=_&65535|S<<16,f=j,g=G,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[5],g=d[5],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[5]=j=b&65535|M<<16,d[5]=G=_&65535|S<<16,f=U,g=E,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[6],g=d[6],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[6]=U=b&65535|M<<16,d[6]=E=_&65535|S<<16,f=K,g=m,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[7],g=d[7],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[7]=K=b&65535|M<<16,d[7]=m=_&65535|S<<16,y+=128,A-=128}return y}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ax),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=ta,r=ax,n=Mi;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(ee){const X=new Float64Array(16);if(ee)for(let Q=0;Q>16&1),Q[le-1]&=65535;Q[15]=R[15]-32767-(Q[14]>>16&1);const te=Q[15]>>16&1;Q[14]&=65535,N(R,Q,1-te)}for(let Z=0;Z<16;Z++)ee[2*Z]=R[Z]&255,ee[2*Z+1]=R[Z]>>8}function k(ee,X){let Q=0;for(let R=0;R<32;R++)Q|=ee[R]^X[R];return(1&Q-1>>>8)-1}function B(ee,X){const Q=new Uint8Array(32),R=new Uint8Array(32);return D(Q,ee),D(R,X),k(Q,R)}function j(ee){const X=new Uint8Array(32);return D(X,ee),X[0]&1}function U(ee,X){for(let Q=0;Q<16;Q++)ee[Q]=X[2*Q]+(X[2*Q+1]<<8);ee[15]&=32767}function K(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]+Q[R]}function J(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]-Q[R]}function T(ee,X,Q){let R,Z,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=0,Ie=0,Le=0,Ve=0,ke=0,ze=0,He=0,Ee=0,Qe=0,ct=0,Be=0,et=0,rt=0,Je=0,pt=0,ht=0,ft=0,Ht=0,Jt=0,St=0,er=0,Xt=0,Ot=0,Bt=Q[0],Tt=Q[1],vt=Q[2],Dt=Q[3],Lt=Q[4],bt=Q[5],$t=Q[6],jt=Q[7],nt=Q[8],Ft=Q[9],$=Q[10],H=Q[11],V=Q[12],C=Q[13],Y=Q[14],q=Q[15];R=X[0],te+=R*Bt,le+=R*Tt,ie+=R*vt,fe+=R*Dt,ve+=R*Lt,Me+=R*bt,Ne+=R*$t,Te+=R*jt,$e+=R*nt,Ie+=R*Ft,Le+=R*$,Ve+=R*H,ke+=R*V,ze+=R*C,He+=R*Y,Ee+=R*q,R=X[1],le+=R*Bt,ie+=R*Tt,fe+=R*vt,ve+=R*Dt,Me+=R*Lt,Ne+=R*bt,Te+=R*$t,$e+=R*jt,Ie+=R*nt,Le+=R*Ft,Ve+=R*$,ke+=R*H,ze+=R*V,He+=R*C,Ee+=R*Y,Qe+=R*q,R=X[2],ie+=R*Bt,fe+=R*Tt,ve+=R*vt,Me+=R*Dt,Ne+=R*Lt,Te+=R*bt,$e+=R*$t,Ie+=R*jt,Le+=R*nt,Ve+=R*Ft,ke+=R*$,ze+=R*H,He+=R*V,Ee+=R*C,Qe+=R*Y,ct+=R*q,R=X[3],fe+=R*Bt,ve+=R*Tt,Me+=R*vt,Ne+=R*Dt,Te+=R*Lt,$e+=R*bt,Ie+=R*$t,Le+=R*jt,Ve+=R*nt,ke+=R*Ft,ze+=R*$,He+=R*H,Ee+=R*V,Qe+=R*C,ct+=R*Y,Be+=R*q,R=X[4],ve+=R*Bt,Me+=R*Tt,Ne+=R*vt,Te+=R*Dt,$e+=R*Lt,Ie+=R*bt,Le+=R*$t,Ve+=R*jt,ke+=R*nt,ze+=R*Ft,He+=R*$,Ee+=R*H,Qe+=R*V,ct+=R*C,Be+=R*Y,et+=R*q,R=X[5],Me+=R*Bt,Ne+=R*Tt,Te+=R*vt,$e+=R*Dt,Ie+=R*Lt,Le+=R*bt,Ve+=R*$t,ke+=R*jt,ze+=R*nt,He+=R*Ft,Ee+=R*$,Qe+=R*H,ct+=R*V,Be+=R*C,et+=R*Y,rt+=R*q,R=X[6],Ne+=R*Bt,Te+=R*Tt,$e+=R*vt,Ie+=R*Dt,Le+=R*Lt,Ve+=R*bt,ke+=R*$t,ze+=R*jt,He+=R*nt,Ee+=R*Ft,Qe+=R*$,ct+=R*H,Be+=R*V,et+=R*C,rt+=R*Y,Je+=R*q,R=X[7],Te+=R*Bt,$e+=R*Tt,Ie+=R*vt,Le+=R*Dt,Ve+=R*Lt,ke+=R*bt,ze+=R*$t,He+=R*jt,Ee+=R*nt,Qe+=R*Ft,ct+=R*$,Be+=R*H,et+=R*V,rt+=R*C,Je+=R*Y,pt+=R*q,R=X[8],$e+=R*Bt,Ie+=R*Tt,Le+=R*vt,Ve+=R*Dt,ke+=R*Lt,ze+=R*bt,He+=R*$t,Ee+=R*jt,Qe+=R*nt,ct+=R*Ft,Be+=R*$,et+=R*H,rt+=R*V,Je+=R*C,pt+=R*Y,ht+=R*q,R=X[9],Ie+=R*Bt,Le+=R*Tt,Ve+=R*vt,ke+=R*Dt,ze+=R*Lt,He+=R*bt,Ee+=R*$t,Qe+=R*jt,ct+=R*nt,Be+=R*Ft,et+=R*$,rt+=R*H,Je+=R*V,pt+=R*C,ht+=R*Y,ft+=R*q,R=X[10],Le+=R*Bt,Ve+=R*Tt,ke+=R*vt,ze+=R*Dt,He+=R*Lt,Ee+=R*bt,Qe+=R*$t,ct+=R*jt,Be+=R*nt,et+=R*Ft,rt+=R*$,Je+=R*H,pt+=R*V,ht+=R*C,ft+=R*Y,Ht+=R*q,R=X[11],Ve+=R*Bt,ke+=R*Tt,ze+=R*vt,He+=R*Dt,Ee+=R*Lt,Qe+=R*bt,ct+=R*$t,Be+=R*jt,et+=R*nt,rt+=R*Ft,Je+=R*$,pt+=R*H,ht+=R*V,ft+=R*C,Ht+=R*Y,Jt+=R*q,R=X[12],ke+=R*Bt,ze+=R*Tt,He+=R*vt,Ee+=R*Dt,Qe+=R*Lt,ct+=R*bt,Be+=R*$t,et+=R*jt,rt+=R*nt,Je+=R*Ft,pt+=R*$,ht+=R*H,ft+=R*V,Ht+=R*C,Jt+=R*Y,St+=R*q,R=X[13],ze+=R*Bt,He+=R*Tt,Ee+=R*vt,Qe+=R*Dt,ct+=R*Lt,Be+=R*bt,et+=R*$t,rt+=R*jt,Je+=R*nt,pt+=R*Ft,ht+=R*$,ft+=R*H,Ht+=R*V,Jt+=R*C,St+=R*Y,er+=R*q,R=X[14],He+=R*Bt,Ee+=R*Tt,Qe+=R*vt,ct+=R*Dt,Be+=R*Lt,et+=R*bt,rt+=R*$t,Je+=R*jt,pt+=R*nt,ht+=R*Ft,ft+=R*$,Ht+=R*H,Jt+=R*V,St+=R*C,er+=R*Y,Xt+=R*q,R=X[15],Ee+=R*Bt,Qe+=R*Tt,ct+=R*vt,Be+=R*Dt,et+=R*Lt,rt+=R*bt,Je+=R*$t,pt+=R*jt,ht+=R*nt,ft+=R*Ft,Ht+=R*$,Jt+=R*H,St+=R*V,er+=R*C,Xt+=R*Y,Ot+=R*q,te+=38*Qe,le+=38*ct,ie+=38*Be,fe+=38*et,ve+=38*rt,Me+=38*Je,Ne+=38*pt,Te+=38*ht,$e+=38*ft,Ie+=38*Ht,Le+=38*Jt,Ve+=38*St,ke+=38*er,ze+=38*Xt,He+=38*Ot,Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),ee[0]=te,ee[1]=le,ee[2]=ie,ee[3]=fe,ee[4]=ve,ee[5]=Me,ee[6]=Ne,ee[7]=Te,ee[8]=$e,ee[9]=Ie,ee[10]=Le,ee[11]=Ve,ee[12]=ke,ee[13]=ze,ee[14]=He,ee[15]=Ee}function z(ee,X){T(ee,X,X)}function ue(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=253;R>=0;R--)z(Q,Q),R!==2&&R!==4&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function _e(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=250;R>=0;R--)z(Q,Q),R!==1&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function G(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i(),ve=i(),Me=i();J(Q,ee[1],ee[0]),J(Me,X[1],X[0]),T(Q,Q,Me),K(R,ee[0],ee[1]),K(Me,X[0],X[1]),T(R,R,Me),T(Z,ee[3],X[3]),T(Z,Z,l),T(te,ee[2],X[2]),K(te,te,te),J(le,R,Q),J(ie,te,Z),K(fe,te,Z),K(ve,R,Q),T(ee[0],le,ie),T(ee[1],ve,fe),T(ee[2],fe,ie),T(ee[3],le,ve)}function E(ee,X,Q){for(let R=0;R<4;R++)N(ee[R],X[R],Q)}function m(ee,X){const Q=i(),R=i(),Z=i();ue(Z,X[2]),T(Q,X[0],Z),T(R,X[1],Z),D(ee,R),ee[31]^=j(Q)<<7}function f(ee,X,Q){A(ee[0],o),A(ee[1],a),A(ee[2],a),A(ee[3],o);for(let R=255;R>=0;--R){const Z=Q[R/8|0]>>(R&7)&1;E(ee,X,Z),G(X,ee),G(ee,ee),E(ee,X,Z)}}function g(ee,X){const Q=[i(),i(),i(),i()];A(Q[0],d),A(Q[1],p),A(Q[2],a),T(Q[3],d,p),f(ee,Q,X)}function v(ee){if(ee.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const X=(0,r.hash)(ee);X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(32),R=[i(),i(),i(),i()];g(R,X),m(Q,R);const Z=new Uint8Array(64);return Z.set(ee),Z.set(Q,32),{publicKey:Q,secretKey:Z}}t.generateKeyPairFromSeed=v;function x(ee){const X=(0,e.randomBytes)(32,ee),Q=v(X);return(0,n.wipe)(X),Q}t.generateKeyPair=x;function _(ee){if(ee.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(ee.subarray(32))}t.extractPublicKeyFromSecretKey=_;const S=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function b(ee,X){let Q,R,Z,te;for(R=63;R>=32;--R){for(Q=0,Z=R-32,te=R-12;Z>4)*S[Z],Q=X[Z]>>8,X[Z]&=255;for(Z=0;Z<32;Z++)X[Z]-=Q*S[Z];for(R=0;R<32;R++)X[R+1]+=X[R]>>8,ee[R]=X[R]&255}function M(ee){const X=new Float64Array(64);for(let Q=0;Q<64;Q++)X[Q]=ee[Q];for(let Q=0;Q<64;Q++)ee[Q]=0;b(ee,X)}function I(ee,X){const Q=new Float64Array(64),R=[i(),i(),i(),i()],Z=(0,r.hash)(ee.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(64);te.set(Z.subarray(32),32);const le=new r.SHA512;le.update(te.subarray(32)),le.update(X);const ie=le.digest();le.clean(),M(ie),g(R,ie),m(te,R),le.reset(),le.update(te.subarray(0,32)),le.update(ee.subarray(32)),le.update(X);const fe=le.digest();M(fe);for(let ve=0;ve<32;ve++)Q[ve]=ie[ve];for(let ve=0;ve<32;ve++)for(let Me=0;Me<32;Me++)Q[ve+Me]+=fe[ve]*Z[Me];return b(te.subarray(32),Q),te}t.sign=I;function F(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i();return A(ee[2],a),U(ee[1],X),z(Z,ee[1]),T(te,Z,u),J(Z,Z,ee[2]),K(te,ee[2],te),z(le,te),z(ie,le),T(fe,ie,le),T(Q,fe,Z),T(Q,Q,te),_e(Q,Q),T(Q,Q,Z),T(Q,Q,te),T(Q,Q,te),T(ee[0],Q,te),z(R,ee[0]),T(R,R,te),B(R,Z)&&T(ee[0],ee[0],y),z(R,ee[0]),T(R,R,te),B(R,Z)?-1:(j(ee[0])===X[31]>>7&&J(ee[0],o,ee[0]),T(ee[3],ee[0],ee[1]),0)}function ae(ee,X,Q){const R=new Uint8Array(32),Z=[i(),i(),i(),i()],te=[i(),i(),i(),i()];if(Q.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(F(te,ee))return!1;const le=new r.SHA512;le.update(Q.subarray(0,32)),le.update(ee),le.update(X);const ie=le.digest();return M(ie),f(Z,te,ie),g(te,Q.subarray(32)),G(Z,te),m(R,Z),!k(Q,R)}t.verify=ae;function O(ee){let X=[i(),i(),i(),i()];if(F(X,ee))throw new Error("Ed25519: invalid public key");let Q=i(),R=i(),Z=X[1];K(Q,a,Z),J(R,a,Z),ue(R,R),T(Q,Q,R);let te=new Uint8Array(32);return D(te,Q),te}t.convertPublicKeyToX25519=O;function se(ee){const X=(0,r.hash)(ee.subarray(0,32));X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(X.subarray(0,32));return(0,n.wipe)(X),Q}t.convertSecretKeyToX25519=se}(um);const MD="EdDSA",ID="JWT",hd=".",dd="base64url",cx="utf8",ux="utf8",CD=":",TD="did",RD="key",fx="base58btc",DD="z",OD="K36",ND=32;function lx(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function pd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=lx(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function LD(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(j);k!==B;){for(var K=P[k],J=0,T=j-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=j-D;z!==j&&U[z]===0;)z++;for(var ue=u.repeat(N);z>>0,j=new Uint8Array(B);P[N];){var U=r[P.charCodeAt(N)];if(U===255)return;for(var K=0,J=B-1;(U!==0||K>>0,j[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,N++}if(P[N]!==" "){for(var T=B-k;T!==B&&j[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=j[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:A}}var kD=LD,BD=kD;const $D=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},FD=t=>new TextEncoder().encode(t),jD=t=>new TextDecoder().decode(t);class UD{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class qD{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return hx(this,e)}}class zD{constructor(e){this.decoders=e}or(e){return hx(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const hx=(t,e)=>new zD({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class HD{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new UD(e,r,n),this.decoder=new qD(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const gd=({name:t,prefix:e,encode:r,decode:n})=>new HD(t,e,r,n),rl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=BD(r,e);return gd({prefix:t,name:e,encode:n,decode:s=>$D(i(s))})},WD=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},KD=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<gd({prefix:e,name:t,encode(i){return KD(i,n,r)},decode(i){return WD(i,n,r,t)}}),VD=gd({prefix:"\0",name:"identity",encode:t=>jD(t),decode:t=>FD(t)}),GD=Object.freeze(Object.defineProperty({__proto__:null,identity:VD},Symbol.toStringTag,{value:"Module"})),YD=jn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),JD=Object.freeze(Object.defineProperty({__proto__:null,base2:YD},Symbol.toStringTag,{value:"Module"})),XD=jn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),ZD=Object.freeze(Object.defineProperty({__proto__:null,base8:XD},Symbol.toStringTag,{value:"Module"})),QD=rl({prefix:"9",name:"base10",alphabet:"0123456789"}),eO=Object.freeze(Object.defineProperty({__proto__:null,base10:QD},Symbol.toStringTag,{value:"Module"})),tO=jn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),rO=jn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),nO=Object.freeze(Object.defineProperty({__proto__:null,base16:tO,base16upper:rO},Symbol.toStringTag,{value:"Module"})),iO=jn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),sO=jn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),oO=jn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),aO=jn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),cO=jn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),uO=jn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),fO=jn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),lO=jn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),hO=jn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),dO=Object.freeze(Object.defineProperty({__proto__:null,base32:iO,base32hex:cO,base32hexpad:fO,base32hexpadupper:lO,base32hexupper:uO,base32pad:oO,base32padupper:aO,base32upper:sO,base32z:hO},Symbol.toStringTag,{value:"Module"})),pO=rl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),gO=rl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),mO=Object.freeze(Object.defineProperty({__proto__:null,base36:pO,base36upper:gO},Symbol.toStringTag,{value:"Module"})),vO=rl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),bO=rl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),yO=Object.freeze(Object.defineProperty({__proto__:null,base58btc:vO,base58flickr:bO},Symbol.toStringTag,{value:"Module"})),wO=jn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),xO=jn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),_O=jn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),EO=jn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),SO=Object.freeze(Object.defineProperty({__proto__:null,base64:wO,base64pad:xO,base64url:_O,base64urlpad:EO},Symbol.toStringTag,{value:"Module"})),dx=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),AO=dx.reduce((t,e,r)=>(t[r]=e,t),[]),PO=dx.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function MO(t){return t.reduce((e,r)=>(e+=AO[r],e),"")}function IO(t){const e=[];for(const r of t){const n=PO[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const CO=gd({prefix:"🚀",name:"base256emoji",encode:MO,decode:IO}),TO=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:CO},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const px={...GD,...JD,...ZD,...eO,...nO,...dO,...mO,...yO,...SO,...TO};function gx(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const mx=gx("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),pm=gx("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=lx(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new jO:typeof navigator<"u"?KO(navigator.userAgent):GO()}function WO(t){return t!==""&&zO.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function KO(t){var e=WO(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new FO;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<_x&&(i=xx(xx([],i,!0),YO(_x-i.length),!0)):i=[];var s=i.join("."),o=VO(t),a=qO.exec(t);return a&&a[1]?new $O(r,s,o,a[1]):new kO(r,s,o)}function VO(t){for(var e=0,r=Ex.length;e-1){const D=P.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let k=e.protocol+"//"+e.host;if(D.indexOf("/")===0)k+=D;else{const B=e.pathname.split("/");B.pop();const j=B.join("/");k+=j+"/"+D}y.push(k)}else if(D.indexOf("//")===0){const k=e.protocol+D;y.push(k)}else y.push(D)}}return y}function n(...p){const y=t.getElementsByTagName("meta");for(let A=0;AP.getAttribute(D)).filter(D=>D?p.includes(D):!1);if(N.length&&N){const D=P.getAttribute("content");if(D)return D}}return""}function i(){let p=n("name","og:site_name","og:title","twitter:title");return p||(p=t.title),p}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}Ax=vm.getWindowMetadata=oN;var il={},aN=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Mx="%[a-f0-9]{2}",Ix=new RegExp("("+Mx+")|([^%]+?)","gi"),Cx=new RegExp("("+Mx+")+","gi");function bm(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],bm(r),bm(n))}function cN(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(Ix)||[],r=1;r{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},hN=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;sB==null,o=Symbol("encodeFragmentIdentifier");function a(B){switch(B.arrayFormat){case"index":return j=>(U,K)=>{const J=U.length;return K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),"[",J,"]"].join("")]:[...U,[d(j,B),"[",d(J,B),"]=",d(K,B)].join("")]};case"bracket":return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),"[]"].join("")]:[...U,[d(j,B),"[]=",d(K,B)].join("")];case"colon-list-separator":return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),":list="].join("")]:[...U,[d(j,B),":list=",d(K,B)].join("")];case"comma":case"separator":case"bracket-separator":{const j=B.arrayFormat==="bracket-separator"?"[]=":"=";return U=>(K,J)=>J===void 0||B.skipNull&&J===null||B.skipEmptyString&&J===""?K:(J=J===null?"":J,K.length===0?[[d(U,B),j,d(J,B)].join("")]:[[K,d(J,B)].join(B.arrayFormatSeparator)])}default:return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,d(j,B)]:[...U,[d(j,B),"=",d(K,B)].join("")]}}function u(B){let j;switch(B.arrayFormat){case"index":return(U,K,J)=>{if(j=/\[(\d*)\]$/.exec(U),U=U.replace(/\[\d*\]$/,""),!j){J[U]=K;return}J[U]===void 0&&(J[U]={}),J[U][j[1]]=K};case"bracket":return(U,K,J)=>{if(j=/(\[\])$/.exec(U),U=U.replace(/\[\]$/,""),!j){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"colon-list-separator":return(U,K,J)=>{if(j=/(:list)$/.exec(U),U=U.replace(/:list$/,""),!j){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"comma":case"separator":return(U,K,J)=>{const T=typeof K=="string"&&K.includes(B.arrayFormatSeparator),z=typeof K=="string"&&!T&&p(K,B).includes(B.arrayFormatSeparator);K=z?p(K,B):K;const ue=T||z?K.split(B.arrayFormatSeparator).map(_e=>p(_e,B)):K===null?K:p(K,B);J[U]=ue};case"bracket-separator":return(U,K,J)=>{const T=/(\[\])$/.test(U);if(U=U.replace(/\[\]$/,""),!T){J[U]=K&&p(K,B);return}const z=K===null?[]:K.split(B.arrayFormatSeparator).map(ue=>p(ue,B));if(J[U]===void 0){J[U]=z;return}J[U]=[].concat(J[U],z)};default:return(U,K,J)=>{if(J[U]===void 0){J[U]=K;return}J[U]=[].concat(J[U],K)}}}function l(B){if(typeof B!="string"||B.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function d(B,j){return j.encode?j.strict?e(B):encodeURIComponent(B):B}function p(B,j){return j.decode?r(B):B}function y(B){return Array.isArray(B)?B.sort():typeof B=="object"?y(Object.keys(B)).sort((j,U)=>Number(j)-Number(U)).map(j=>B[j]):B}function A(B){const j=B.indexOf("#");return j!==-1&&(B=B.slice(0,j)),B}function P(B){let j="";const U=B.indexOf("#");return U!==-1&&(j=B.slice(U)),j}function N(B){B=A(B);const j=B.indexOf("?");return j===-1?"":B.slice(j+1)}function D(B,j){return j.parseNumbers&&!Number.isNaN(Number(B))&&typeof B=="string"&&B.trim()!==""?B=Number(B):j.parseBooleans&&B!==null&&(B.toLowerCase()==="true"||B.toLowerCase()==="false")&&(B=B.toLowerCase()==="true"),B}function k(B,j){j=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},j),l(j.arrayFormatSeparator);const U=u(j),K=Object.create(null);if(typeof B!="string"||(B=B.trim().replace(/^[?#&]/,""),!B))return K;for(const J of B.split("&")){if(J==="")continue;let[T,z]=n(j.decode?J.replace(/\+/g," "):J,"=");z=z===void 0?null:["comma","separator","bracket-separator"].includes(j.arrayFormat)?z:p(z,j),U(p(T,j),z,K)}for(const J of Object.keys(K)){const T=K[J];if(typeof T=="object"&&T!==null)for(const z of Object.keys(T))T[z]=D(T[z],j);else K[J]=D(T,j)}return j.sort===!1?K:(j.sort===!0?Object.keys(K).sort():Object.keys(K).sort(j.sort)).reduce((J,T)=>{const z=K[T];return z&&typeof z=="object"&&!Array.isArray(z)?J[T]=y(z):J[T]=z,J},Object.create(null))}t.extract=N,t.parse=k,t.stringify=(B,j)=>{if(!B)return"";j=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},j),l(j.arrayFormatSeparator);const U=z=>j.skipNull&&s(B[z])||j.skipEmptyString&&B[z]==="",K=a(j),J={};for(const z of Object.keys(B))U(z)||(J[z]=B[z]);const T=Object.keys(J);return j.sort!==!1&&T.sort(j.sort),T.map(z=>{const ue=B[z];return ue===void 0?"":ue===null?d(z,j):Array.isArray(ue)?ue.length===0&&j.arrayFormat==="bracket-separator"?d(z,j)+"[]":ue.reduce(K(z),[]).join("&"):d(z,j)+"="+d(ue,j)}).filter(z=>z.length>0).join("&")},t.parseUrl=(B,j)=>{j=Object.assign({decode:!0},j);const[U,K]=n(B,"#");return Object.assign({url:U.split("?")[0]||"",query:k(N(B),j)},j&&j.parseFragmentIdentifier&&K?{fragmentIdentifier:p(K,j)}:{})},t.stringifyUrl=(B,j)=>{j=Object.assign({encode:!0,strict:!0,[o]:!0},j);const U=A(B.url).split("?")[0]||"",K=t.extract(B.url),J=t.parse(K,{sort:!1}),T=Object.assign(J,B.query);let z=t.stringify(T,j);z&&(z=`?${z}`);let ue=P(B.url);return B.fragmentIdentifier&&(ue=`#${j[o]?d(B.fragmentIdentifier,j):B.fragmentIdentifier}`),`${U}${z}${ue}`},t.pick=(B,j,U)=>{U=Object.assign({parseFragmentIdentifier:!0,[o]:!1},U);const{url:K,query:J,fragmentIdentifier:T}=t.parseUrl(B,U);return t.stringifyUrl({url:K,query:i(J,j),fragmentIdentifier:T},U)},t.exclude=(B,j,U)=>{const K=Array.isArray(j)?J=>!j.includes(J):(J,T)=>!j(J,T);return t.pick(B,K,U)}})(il);var Tx={exports:{}};/** + ***************************************************************************** */var Jg=function(t,e){return Jg=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Jg(t,e)};function oT(t,e){Jg(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Xg=function(){return Xg=Object.assign||function(e){for(var r,n=1,i=arguments.length;n=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function uT(t,e){return function(r,n){e(r,n,t)}}function fT(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function lT(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(d){try{l(n.next(d))}catch(p){o(p)}}function u(d){try{l(n.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):i(d.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function hT(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return u([l,d])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function C2(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function gT(){for(var t=[],e=0;e1||a(y,A)})})}function a(y,A){try{u(n[y](A))}catch(P){p(s[0][3],P)}}function u(y){y.value instanceof Kf?Promise.resolve(y.value.v).then(l,d):p(s[0][2],y)}function l(y){a("next",y)}function d(y){a("throw",y)}function p(y,A){y(A),s.shift(),s.length&&a(s[0][0],s[0][1])}}function bT(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Kf(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function yT(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Zg=="function"?Zg(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function wT(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function xT(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function _T(t){return t&&t.__esModule?t:{default:t}}function ET(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function ST(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const Vf=Jp(Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Xg},__asyncDelegator:bT,__asyncGenerator:vT,__asyncValues:yT,__await:Kf,__awaiter:lT,__classPrivateFieldGet:ET,__classPrivateFieldSet:ST,__createBinding:dT,__decorate:cT,__exportStar:pT,__extends:oT,__generator:hT,__importDefault:_T,__importStar:xT,__makeTemplateObject:wT,__metadata:fT,__param:uT,__read:C2,__rest:aT,__spread:gT,__spreadArrays:mT,__values:Zg},Symbol.toStringTag,{value:"Module"})));var Qg={},Gf={},T2;function AT(){if(T2)return Gf;T2=1,Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Gf.delay=t,Gf}var qa={},em={},za={},R2;function PT(){return R2||(R2=1,Object.defineProperty(za,"__esModule",{value:!0}),za.ONE_THOUSAND=za.ONE_HUNDRED=void 0,za.ONE_HUNDRED=100,za.ONE_THOUSAND=1e3),za}var tm={},D2;function MT(){return D2||(D2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(tm)),tm}var O2;function N2(){return O2||(O2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(PT(),t),e.__exportStar(MT(),t)}(em)),em}var L2;function IT(){if(L2)return qa;L2=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.fromMiliseconds=qa.toMiliseconds=void 0;const t=N2();function e(n){return n*t.ONE_THOUSAND}qa.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return qa.fromMiliseconds=r,qa}var k2;function CT(){return k2||(k2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(AT(),t),e.__exportStar(IT(),t)}(Qg)),Qg}var nu={},B2;function TT(){if(B2)return nu;B2=1,Object.defineProperty(nu,"__esModule",{value:!0}),nu.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return nu.Watch=t,nu.default=t,nu}var rm={},Yf={},$2;function RT(){if($2)return Yf;$2=1,Object.defineProperty(Yf,"__esModule",{value:!0}),Yf.IWatch=void 0;class t{}return Yf.IWatch=t,Yf}var F2;function DT(){return F2||(F2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Vf.__exportStar(RT(),t)}(rm)),rm}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(CT(),t),e.__exportStar(TT(),t),e.__exportStar(DT(),t),e.__exportStar(N2(),t)})(mt);class Ha{}let OT=class extends Ha{constructor(e){super()}};const j2=mt.FIVE_SECONDS,iu={pulse:"heartbeat_pulse"};let NT=class GA extends OT{constructor(e){super(e),this.events=new qi.EventEmitter,this.interval=j2,this.interval=(e==null?void 0:e.interval)||j2}static async init(e){const r=new GA(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),mt.toMiliseconds(this.interval))}pulse(){this.events.emit(iu.pulse)}};const LT=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,kT=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,BT=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function $T(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){FT(t);return}return e}function FT(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Zh(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!BT.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(LT.test(t)||kT.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,$T)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function jT(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Cn(t,...e){try{return jT(t(...e))}catch(r){return Promise.reject(r)}}function UT(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function qT(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Qh(t){if(UT(t))return String(t);if(qT(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Qh(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function U2(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const nm="base64:";function zT(t){if(typeof t=="string")return t;U2();const e=Buffer.from(t).toString("base64");return nm+e}function HT(t){return typeof t!="string"||!t.startsWith(nm)?t:(U2(),Buffer.from(t.slice(nm.length),"base64"))}function pi(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function WT(...t){return pi(t.join(":"))}function ed(t){return t=pi(t),t?t+":":""}function doe(t){return t}const KT="memory",VT=()=>{const t=new Map;return{name:KT,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function GT(t={}){const e={mounts:{"":t.driver||VT()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const d of e.mountpoints)if(l.startsWith(d))return{base:d,relativeKey:l.slice(d.length),driver:e.mounts[d]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,d)=>e.mountpoints.filter(p=>p.startsWith(l)||d&&l.startsWith(p)).map(p=>({relativeBase:l.length>p.length?l.slice(p.length):void 0,mountpoint:p,driver:e.mounts[p]})),i=(l,d)=>{if(e.watching){d=pi(d);for(const p of e.watchListeners)p(l,d)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await q2(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,d,p)=>{const y=new Map,A=P=>{let N=y.get(P.base);return N||(N={driver:P.driver,base:P.base,items:[]},y.set(P.base,N)),N};for(const P of l){const N=typeof P=="string",D=pi(N?P:P.key),k=N?void 0:P.value,B=N||!P.options?d:{...d,...P.options},j=r(D);A(j).items.push({key:D,value:k,relativeKey:j.relativeKey,options:B})}return Promise.all([...y.values()].map(P=>p(P))).then(P=>P.flat())},u={hasItem(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return Cn(y.hasItem,p,d)},getItem(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return Cn(y.getItem,p,d).then(A=>Zh(A))},getItems(l,d){return a(l,d,p=>p.driver.getItems?Cn(p.driver.getItems,p.items.map(y=>({key:y.relativeKey,options:y.options})),d).then(y=>y.map(A=>({key:WT(p.base,A.key),value:Zh(A.value)}))):Promise.all(p.items.map(y=>Cn(p.driver.getItem,y.relativeKey,y.options).then(A=>({key:y.key,value:Zh(A)})))))},getItemRaw(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return y.getItemRaw?Cn(y.getItemRaw,p,d):Cn(y.getItem,p,d).then(A=>HT(A))},async setItem(l,d,p={}){if(d===void 0)return u.removeItem(l);l=pi(l);const{relativeKey:y,driver:A}=r(l);A.setItem&&(await Cn(A.setItem,y,Qh(d),p),A.watch||i("update",l))},async setItems(l,d){await a(l,d,async p=>{if(p.driver.setItems)return Cn(p.driver.setItems,p.items.map(y=>({key:y.relativeKey,value:Qh(y.value),options:y.options})),d);p.driver.setItem&&await Promise.all(p.items.map(y=>Cn(p.driver.setItem,y.relativeKey,Qh(y.value),y.options)))})},async setItemRaw(l,d,p={}){if(d===void 0)return u.removeItem(l,p);l=pi(l);const{relativeKey:y,driver:A}=r(l);if(A.setItemRaw)await Cn(A.setItemRaw,y,d,p);else if(A.setItem)await Cn(A.setItem,y,zT(d),p);else return;A.watch||i("update",l)},async removeItem(l,d={}){typeof d=="boolean"&&(d={removeMeta:d}),l=pi(l);const{relativeKey:p,driver:y}=r(l);y.removeItem&&(await Cn(y.removeItem,p,d),(d.removeMeta||d.removeMata)&&await Cn(y.removeItem,p+"$",d),y.watch||i("remove",l))},async getMeta(l,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),l=pi(l);const{relativeKey:p,driver:y}=r(l),A=Object.create(null);if(y.getMeta&&Object.assign(A,await Cn(y.getMeta,p,d)),!d.nativeOnly){const P=await Cn(y.getItem,p+"$",d).then(N=>Zh(N));P&&typeof P=="object"&&(typeof P.atime=="string"&&(P.atime=new Date(P.atime)),typeof P.mtime=="string"&&(P.mtime=new Date(P.mtime)),Object.assign(A,P))}return A},setMeta(l,d,p={}){return this.setItem(l+"$",d,p)},removeMeta(l,d={}){return this.removeItem(l+"$",d)},async getKeys(l,d={}){l=ed(l);const p=n(l,!0);let y=[];const A=[];for(const P of p){const N=await Cn(P.driver.getKeys,P.relativeBase,d);for(const D of N){const k=P.mountpoint+pi(D);y.some(B=>k.startsWith(B))||A.push(k)}y=[P.mountpoint,...y.filter(D=>!D.startsWith(P.mountpoint))]}return l?A.filter(P=>P.startsWith(l)&&P[P.length-1]!=="$"):A.filter(P=>P[P.length-1]!=="$")},async clear(l,d={}){l=ed(l),await Promise.all(n(l,!1).map(async p=>{if(p.driver.clear)return Cn(p.driver.clear,p.relativeBase,d);if(p.driver.removeItem){const y=await p.driver.getKeys(p.relativeBase||"",d);return Promise.all(y.map(A=>p.driver.removeItem(A,d)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>z2(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(d=>d!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,d){if(l=ed(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((p,y)=>y.length-p.length)),e.mounts[l]=d,e.watching&&Promise.resolve(q2(d,i,l)).then(p=>{e.unwatch[l]=p}).catch(console.error),u},async unmount(l,d=!0){l=ed(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),d&&await z2(e.mounts[l]),e.mountpoints=e.mountpoints.filter(p=>p!==l),delete e.mounts[l])},getMount(l=""){l=pi(l)+":";const d=r(l);return{driver:d.driver,base:d.base}},getMounts(l="",d={}){return l=pi(l),n(l,d.parents).map(y=>({driver:y.driver,base:y.mountpoint}))},keys:(l,d={})=>u.getKeys(l,d),get:(l,d={})=>u.getItem(l,d),set:(l,d,p={})=>u.setItem(l,d,p),has:(l,d={})=>u.hasItem(l,d),del:(l,d={})=>u.removeItem(l,d),remove:(l,d={})=>u.removeItem(l,d)};return u}function q2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function z2(t){typeof t.dispose=="function"&&await Cn(t.dispose)}function Wa(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function H2(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Wa(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let im;function Jf(){return im||(im=H2("keyval-store","keyval")),im}function W2(t,e=Jf()){return e("readonly",r=>Wa(r.get(t)))}function YT(t,e,r=Jf()){return r("readwrite",n=>(n.put(e,t),Wa(n.transaction)))}function JT(t,e=Jf()){return e("readwrite",r=>(r.delete(t),Wa(r.transaction)))}function XT(t=Jf()){return t("readwrite",e=>(e.clear(),Wa(e.transaction)))}function ZT(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Wa(t.transaction)}function QT(t=Jf()){return t("readonly",e=>{if(e.getAllKeys)return Wa(e.getAllKeys());const r=[];return ZT(e,n=>r.push(n.key)).then(()=>r)})}const eR=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),tR=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Ka(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return tR(t)}catch{return t}}function mo(t){return typeof t=="string"?t:eR(t)||""}const rR="idb-keyval";var nR=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=H2(t.dbName,t.storeName)),{name:rR,options:t,async hasItem(i){return!(typeof await W2(r(i),n)>"u")},async getItem(i){return await W2(r(i),n)??null},setItem(i,s){return YT(r(i),s,n)},removeItem(i){return JT(r(i),n)},getKeys(){return QT(n)},clear(){return XT(n)}}};const iR="WALLET_CONNECT_V2_INDEXED_DB",sR="keyvaluestorage";let oR=class{constructor(){this.indexedDb=GT({driver:nR({dbName:iR,storeName:sR})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,mo(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var sm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},td={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof sm<"u"&&sm.localStorage?td.exports=sm.localStorage:typeof window<"u"&&window.localStorage?td.exports=window.localStorage:td.exports=new e})();function aR(t){var e;return[t[0],Ka((e=t[1])!=null?e:"")]}let cR=class{constructor(){this.localStorage=td.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(aR)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Ka(r)}async setItem(e,r){this.localStorage.setItem(e,mo(r))}async removeItem(e){this.localStorage.removeItem(e)}};const uR="wc_storage_version",K2=1,fR=async(t,e,r)=>{const n=uR,i=await e.getItem(n);if(i&&i>=K2){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,K2),r(e),lR(t,o)},lR=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let hR=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new cR;this.storage=e;try{const r=new oR;fR(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function dR(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var pR=gR;function gR(t,e,r){var n=r&&r.stringify||dR,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?p:0,t.charCodeAt(A+1)){case 100:case 102:if(d>=u||e[d]==null)break;p=u||e[d]==null)break;p=u||e[d]===void 0)break;p",p=A+2,A++;break}l+=n(e[d]),p=A+2,A++;break;case 115:if(d>=u)break;p-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",u=Object.create(r);u.log||(u.log=Zf),Object.defineProperty(u,"levelVal",{get:d}),Object.defineProperty(u,"level",{get:p,set:y});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:_R(t)};u.levels=vo.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Zf,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=A,e&&(u._logEvent=om());function d(){return this.level==="silent"?1/0:this.levels.values[this.level]}function p(){return this._level}function y(P){if(P!=="silent"&&!this.levels.values[P])throw Error("unknown level "+P);this._level=P,ou(l,u,"error","log"),ou(l,u,"fatal","error"),ou(l,u,"warn","error"),ou(l,u,"info","log"),ou(l,u,"debug","log"),ou(l,u,"trace","log")}function A(P,N){if(!P)throw new Error("missing bindings for child Pino");N=N||{},i&&P.serializers&&(N.serializers=P.serializers);const D=N.serializers;if(i&&D){var k=Object.assign({},n,D),B=t.browser.serialize===!0?Object.keys(k):i;delete P.serializers,rd([P],B,k,this._stdErrSerialize)}function j(U){this._childLevel=(U._childLevel|0)+1,this.error=au(U,P,"error"),this.fatal=au(U,P,"fatal"),this.warn=au(U,P,"warn"),this.info=au(U,P,"info"),this.debug=au(U,P,"debug"),this.trace=au(U,P,"trace"),k&&(this.serializers=k,this._serialize=B),e&&(this._logEvent=om([].concat(U._logEvent.bindings,P)))}return j.prototype=this,new j(this)}return u}vo.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},vo.stdSerializers=mR,vo.stdTimeFunctions=Object.assign({},{nullTime:G2,epochTime:Y2,unixTime:ER,isoTime:SR});function ou(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Zf:i[r]?i[r]:Xf[r]||Xf[n]||Zf,bR(t,e,r)}function bR(t,e,r){!t.transmit&&e[r]===Zf||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Xf?Xf:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function au(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},X2=class{constructor(e,r=cm){this.level=e??"error",this.levelValue=su.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new J2(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===su.levels.values.error?console.error(e):r===su.levels.values.warn?console.warn(e):r===su.levels.values.debug?console.debug(e):r===su.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(mo({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new J2(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(mo({extraMetadata:e})),new Blob(r,{type:"application/json"})}},IR=class{constructor(e,r=cm){this.baseChunkLogger=new X2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},CR=class{constructor(e,r=cm){this.baseChunkLogger=new X2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var TR=Object.defineProperty,RR=Object.defineProperties,DR=Object.getOwnPropertyDescriptors,Z2=Object.getOwnPropertySymbols,OR=Object.prototype.hasOwnProperty,NR=Object.prototype.propertyIsEnumerable,Q2=(t,e,r)=>e in t?TR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,id=(t,e)=>{for(var r in e||(e={}))OR.call(e,r)&&Q2(t,r,e[r]);if(Z2)for(var r of Z2(e))NR.call(e,r)&&Q2(t,r,e[r]);return t},sd=(t,e)=>RR(t,DR(e));function od(t){return sd(id({},t),{level:(t==null?void 0:t.level)||PR.level})}function LR(t,e=el){return t[e]||""}function kR(t,e,r=el){return t[r]=e,t}function gi(t,e=el){let r="";return typeof t.bindings>"u"?r=LR(t,e):r=t.bindings().context||"",r}function BR(t,e,r=el){const n=gi(t,r);return n.trim()?`${n}/${e}`:e}function ri(t,e,r=el){const n=BR(t,e,r),i=t.child({context:n});return kR(i,n,r)}function $R(t){var e,r;const n=new IR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace",browser:sd(id({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function FR(t){var e;const r=new CR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function jR(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?$R(t):FR(t)}let UR=class extends Ha{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},qR=class extends Ha{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},zR=class{constructor(e,r){this.logger=e,this.core=r}},HR=class extends Ha{constructor(e,r){super(),this.relayer=e,this.logger=r}},WR=class extends Ha{constructor(e){super()}},KR=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},VR=class extends Ha{constructor(e,r){super(),this.relayer=e,this.logger=r}},GR=class extends Ha{constructor(e,r){super(),this.core=e,this.logger=r}},YR=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},JR=class{constructor(e,r){this.projectId=e,this.logger=r}},XR=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},ZR=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},QR=class{constructor(e){this.client=e}};var um={},ta={},ad={},cd={};Object.defineProperty(cd,"__esModule",{value:!0}),cd.BrowserRandomSource=void 0;const ex=65536;class eD{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let n=0;n>>16&65535,d=a&65535,p=u>>>16&65535,y=u&65535;return d*y+(l*y+d*p<<16>>>0)|0}t.mul=Math.imul||e;function r(a,u){return a+u|0}t.add=r;function n(a,u){return a-u|0}t.sub=n;function i(a,u){return a<>>32-u}t.rotl=i;function s(a,u){return a<<32-u|a>>>u}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(rx),Object.defineProperty(or,"__esModule",{value:!0});var nx=rx;function aD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}or.readInt16BE=aD;function cD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}or.readUint16BE=cD;function uD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}or.readInt16LE=uD;function fD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}or.readUint16LE=fD;function ix(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}or.writeUint16BE=ix,or.writeInt16BE=ix;function sx(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}or.writeUint16LE=sx,or.writeInt16LE=sx;function fm(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}or.readInt32BE=fm;function lm(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}or.readUint32BE=lm;function hm(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}or.readInt32LE=hm;function dm(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}or.readUint32LE=dm;function fd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}or.writeUint32BE=fd,or.writeInt32BE=fd;function ld(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}or.writeUint32LE=ld,or.writeInt32LE=ld;function lD(t,e){e===void 0&&(e=0);var r=fm(t,e),n=fm(t,e+4);return r*4294967296+n-(n>>31)*4294967296}or.readInt64BE=lD;function hD(t,e){e===void 0&&(e=0);var r=lm(t,e),n=lm(t,e+4);return r*4294967296+n}or.readUint64BE=hD;function dD(t,e){e===void 0&&(e=0);var r=hm(t,e),n=hm(t,e+4);return n*4294967296+r-(r>>31)*4294967296}or.readInt64LE=dD;function pD(t,e){e===void 0&&(e=0);var r=dm(t,e),n=dm(t,e+4);return n*4294967296+r}or.readUint64LE=pD;function ox(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fd(t/4294967296>>>0,e,r),fd(t>>>0,e,r+4),e}or.writeUint64BE=ox,or.writeInt64BE=ox;function ax(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ld(t>>>0,e,r),ld(t/4294967296>>>0,e,r+4),e}or.writeUint64LE=ax,or.writeInt64LE=ax;function gD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}or.readUintBE=gD;function mD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}or.writeUintBE=vD;function bD(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!nx.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s256)throw new Error("randomString charset is too long");let y="";const A=d.length,P=256-256%A;for(;l>0;){const N=i(Math.ceil(l*256/P),p);for(let D=0;D0;D++){const k=N[D];k0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,A=l%128<112?128:256;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._stateHi.set(u.stateHi),this._stateLo.set(u.stateLo),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.stateHi),r.wipe(u.stateLo),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,u,l,d,p,y,A){for(var P=l[0],N=l[1],D=l[2],k=l[3],B=l[4],j=l[5],U=l[6],K=l[7],J=d[0],T=d[1],z=d[2],ue=d[3],_e=d[4],G=d[5],E=d[6],m=d[7],f,g,v,x,_,S,b,M;A>=128;){for(var I=0;I<16;I++){var F=8*I+y;a[I]=e.readUint32BE(p,F),u[I]=e.readUint32BE(p,F+4)}for(var I=0;I<80;I++){var ae=P,O=N,se=D,ee=k,X=B,Q=j,R=U,Z=K,te=J,le=T,ie=z,fe=ue,ve=_e,Me=G,Ne=E,Te=m;if(f=K,g=m,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=(B>>>14|_e<<18)^(B>>>18|_e<<14)^(_e>>>9|B<<23),g=(_e>>>14|B<<18)^(_e>>>18|B<<14)^(B>>>9|_e<<23),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=B&j^~B&U,g=_e&G^~_e&E,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=i[I*2],g=i[I*2+1],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=a[I%16],g=u[I%16],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,v=b&65535|M<<16,x=_&65535|S<<16,f=v,g=x,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=(P>>>28|J<<4)^(J>>>2|P<<30)^(J>>>7|P<<25),g=(J>>>28|P<<4)^(P>>>2|J<<30)^(P>>>7|J<<25),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=P&N^P&D^N&D,g=J&T^J&z^T&z,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,Z=b&65535|M<<16,Te=_&65535|S<<16,f=ee,g=fe,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=v,g=x,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,ee=b&65535|M<<16,fe=_&65535|S<<16,N=ae,D=O,k=se,B=ee,j=X,U=Q,K=R,P=Z,T=te,z=le,ue=ie,_e=fe,G=ve,E=Me,m=Ne,J=Te,I%16===15)for(var F=0;F<16;F++)f=a[F],g=u[F],_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=a[(F+9)%16],g=u[(F+9)%16],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,v=a[(F+1)%16],x=u[(F+1)%16],f=(v>>>1|x<<31)^(v>>>8|x<<24)^v>>>7,g=(x>>>1|v<<31)^(x>>>8|v<<24)^(x>>>7|v<<25),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,v=a[(F+14)%16],x=u[(F+14)%16],f=(v>>>19|x<<13)^(x>>>29|v<<3)^v>>>6,g=(x>>>19|v<<13)^(v>>>29|x<<3)^(x>>>6|v<<26),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,a[F]=b&65535|M<<16,u[F]=_&65535|S<<16}f=P,g=J,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[0],g=d[0],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[0]=P=b&65535|M<<16,d[0]=J=_&65535|S<<16,f=N,g=T,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[1],g=d[1],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[1]=N=b&65535|M<<16,d[1]=T=_&65535|S<<16,f=D,g=z,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[2],g=d[2],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[2]=D=b&65535|M<<16,d[2]=z=_&65535|S<<16,f=k,g=ue,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[3],g=d[3],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[3]=k=b&65535|M<<16,d[3]=ue=_&65535|S<<16,f=B,g=_e,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[4],g=d[4],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[4]=B=b&65535|M<<16,d[4]=_e=_&65535|S<<16,f=j,g=G,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[5],g=d[5],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[5]=j=b&65535|M<<16,d[5]=G=_&65535|S<<16,f=U,g=E,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[6],g=d[6],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[6]=U=b&65535|M<<16,d[6]=E=_&65535|S<<16,f=K,g=m,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[7],g=d[7],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[7]=K=b&65535|M<<16,d[7]=m=_&65535|S<<16,y+=128,A-=128}return y}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(cx),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=ta,r=cx,n=Mi;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(ee){const X=new Float64Array(16);if(ee)for(let Q=0;Q>16&1),Q[le-1]&=65535;Q[15]=R[15]-32767-(Q[14]>>16&1);const te=Q[15]>>16&1;Q[14]&=65535,N(R,Q,1-te)}for(let Z=0;Z<16;Z++)ee[2*Z]=R[Z]&255,ee[2*Z+1]=R[Z]>>8}function k(ee,X){let Q=0;for(let R=0;R<32;R++)Q|=ee[R]^X[R];return(1&Q-1>>>8)-1}function B(ee,X){const Q=new Uint8Array(32),R=new Uint8Array(32);return D(Q,ee),D(R,X),k(Q,R)}function j(ee){const X=new Uint8Array(32);return D(X,ee),X[0]&1}function U(ee,X){for(let Q=0;Q<16;Q++)ee[Q]=X[2*Q]+(X[2*Q+1]<<8);ee[15]&=32767}function K(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]+Q[R]}function J(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]-Q[R]}function T(ee,X,Q){let R,Z,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=0,Ie=0,Le=0,Ve=0,ke=0,ze=0,He=0,Ee=0,Qe=0,ct=0,Be=0,et=0,rt=0,Je=0,pt=0,ht=0,ft=0,Ht=0,Jt=0,St=0,er=0,Xt=0,Ot=0,Bt=Q[0],Tt=Q[1],vt=Q[2],Dt=Q[3],Lt=Q[4],bt=Q[5],$t=Q[6],jt=Q[7],nt=Q[8],Ft=Q[9],$=Q[10],H=Q[11],V=Q[12],C=Q[13],Y=Q[14],q=Q[15];R=X[0],te+=R*Bt,le+=R*Tt,ie+=R*vt,fe+=R*Dt,ve+=R*Lt,Me+=R*bt,Ne+=R*$t,Te+=R*jt,$e+=R*nt,Ie+=R*Ft,Le+=R*$,Ve+=R*H,ke+=R*V,ze+=R*C,He+=R*Y,Ee+=R*q,R=X[1],le+=R*Bt,ie+=R*Tt,fe+=R*vt,ve+=R*Dt,Me+=R*Lt,Ne+=R*bt,Te+=R*$t,$e+=R*jt,Ie+=R*nt,Le+=R*Ft,Ve+=R*$,ke+=R*H,ze+=R*V,He+=R*C,Ee+=R*Y,Qe+=R*q,R=X[2],ie+=R*Bt,fe+=R*Tt,ve+=R*vt,Me+=R*Dt,Ne+=R*Lt,Te+=R*bt,$e+=R*$t,Ie+=R*jt,Le+=R*nt,Ve+=R*Ft,ke+=R*$,ze+=R*H,He+=R*V,Ee+=R*C,Qe+=R*Y,ct+=R*q,R=X[3],fe+=R*Bt,ve+=R*Tt,Me+=R*vt,Ne+=R*Dt,Te+=R*Lt,$e+=R*bt,Ie+=R*$t,Le+=R*jt,Ve+=R*nt,ke+=R*Ft,ze+=R*$,He+=R*H,Ee+=R*V,Qe+=R*C,ct+=R*Y,Be+=R*q,R=X[4],ve+=R*Bt,Me+=R*Tt,Ne+=R*vt,Te+=R*Dt,$e+=R*Lt,Ie+=R*bt,Le+=R*$t,Ve+=R*jt,ke+=R*nt,ze+=R*Ft,He+=R*$,Ee+=R*H,Qe+=R*V,ct+=R*C,Be+=R*Y,et+=R*q,R=X[5],Me+=R*Bt,Ne+=R*Tt,Te+=R*vt,$e+=R*Dt,Ie+=R*Lt,Le+=R*bt,Ve+=R*$t,ke+=R*jt,ze+=R*nt,He+=R*Ft,Ee+=R*$,Qe+=R*H,ct+=R*V,Be+=R*C,et+=R*Y,rt+=R*q,R=X[6],Ne+=R*Bt,Te+=R*Tt,$e+=R*vt,Ie+=R*Dt,Le+=R*Lt,Ve+=R*bt,ke+=R*$t,ze+=R*jt,He+=R*nt,Ee+=R*Ft,Qe+=R*$,ct+=R*H,Be+=R*V,et+=R*C,rt+=R*Y,Je+=R*q,R=X[7],Te+=R*Bt,$e+=R*Tt,Ie+=R*vt,Le+=R*Dt,Ve+=R*Lt,ke+=R*bt,ze+=R*$t,He+=R*jt,Ee+=R*nt,Qe+=R*Ft,ct+=R*$,Be+=R*H,et+=R*V,rt+=R*C,Je+=R*Y,pt+=R*q,R=X[8],$e+=R*Bt,Ie+=R*Tt,Le+=R*vt,Ve+=R*Dt,ke+=R*Lt,ze+=R*bt,He+=R*$t,Ee+=R*jt,Qe+=R*nt,ct+=R*Ft,Be+=R*$,et+=R*H,rt+=R*V,Je+=R*C,pt+=R*Y,ht+=R*q,R=X[9],Ie+=R*Bt,Le+=R*Tt,Ve+=R*vt,ke+=R*Dt,ze+=R*Lt,He+=R*bt,Ee+=R*$t,Qe+=R*jt,ct+=R*nt,Be+=R*Ft,et+=R*$,rt+=R*H,Je+=R*V,pt+=R*C,ht+=R*Y,ft+=R*q,R=X[10],Le+=R*Bt,Ve+=R*Tt,ke+=R*vt,ze+=R*Dt,He+=R*Lt,Ee+=R*bt,Qe+=R*$t,ct+=R*jt,Be+=R*nt,et+=R*Ft,rt+=R*$,Je+=R*H,pt+=R*V,ht+=R*C,ft+=R*Y,Ht+=R*q,R=X[11],Ve+=R*Bt,ke+=R*Tt,ze+=R*vt,He+=R*Dt,Ee+=R*Lt,Qe+=R*bt,ct+=R*$t,Be+=R*jt,et+=R*nt,rt+=R*Ft,Je+=R*$,pt+=R*H,ht+=R*V,ft+=R*C,Ht+=R*Y,Jt+=R*q,R=X[12],ke+=R*Bt,ze+=R*Tt,He+=R*vt,Ee+=R*Dt,Qe+=R*Lt,ct+=R*bt,Be+=R*$t,et+=R*jt,rt+=R*nt,Je+=R*Ft,pt+=R*$,ht+=R*H,ft+=R*V,Ht+=R*C,Jt+=R*Y,St+=R*q,R=X[13],ze+=R*Bt,He+=R*Tt,Ee+=R*vt,Qe+=R*Dt,ct+=R*Lt,Be+=R*bt,et+=R*$t,rt+=R*jt,Je+=R*nt,pt+=R*Ft,ht+=R*$,ft+=R*H,Ht+=R*V,Jt+=R*C,St+=R*Y,er+=R*q,R=X[14],He+=R*Bt,Ee+=R*Tt,Qe+=R*vt,ct+=R*Dt,Be+=R*Lt,et+=R*bt,rt+=R*$t,Je+=R*jt,pt+=R*nt,ht+=R*Ft,ft+=R*$,Ht+=R*H,Jt+=R*V,St+=R*C,er+=R*Y,Xt+=R*q,R=X[15],Ee+=R*Bt,Qe+=R*Tt,ct+=R*vt,Be+=R*Dt,et+=R*Lt,rt+=R*bt,Je+=R*$t,pt+=R*jt,ht+=R*nt,ft+=R*Ft,Ht+=R*$,Jt+=R*H,St+=R*V,er+=R*C,Xt+=R*Y,Ot+=R*q,te+=38*Qe,le+=38*ct,ie+=38*Be,fe+=38*et,ve+=38*rt,Me+=38*Je,Ne+=38*pt,Te+=38*ht,$e+=38*ft,Ie+=38*Ht,Le+=38*Jt,Ve+=38*St,ke+=38*er,ze+=38*Xt,He+=38*Ot,Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),ee[0]=te,ee[1]=le,ee[2]=ie,ee[3]=fe,ee[4]=ve,ee[5]=Me,ee[6]=Ne,ee[7]=Te,ee[8]=$e,ee[9]=Ie,ee[10]=Le,ee[11]=Ve,ee[12]=ke,ee[13]=ze,ee[14]=He,ee[15]=Ee}function z(ee,X){T(ee,X,X)}function ue(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=253;R>=0;R--)z(Q,Q),R!==2&&R!==4&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function _e(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=250;R>=0;R--)z(Q,Q),R!==1&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function G(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i(),ve=i(),Me=i();J(Q,ee[1],ee[0]),J(Me,X[1],X[0]),T(Q,Q,Me),K(R,ee[0],ee[1]),K(Me,X[0],X[1]),T(R,R,Me),T(Z,ee[3],X[3]),T(Z,Z,l),T(te,ee[2],X[2]),K(te,te,te),J(le,R,Q),J(ie,te,Z),K(fe,te,Z),K(ve,R,Q),T(ee[0],le,ie),T(ee[1],ve,fe),T(ee[2],fe,ie),T(ee[3],le,ve)}function E(ee,X,Q){for(let R=0;R<4;R++)N(ee[R],X[R],Q)}function m(ee,X){const Q=i(),R=i(),Z=i();ue(Z,X[2]),T(Q,X[0],Z),T(R,X[1],Z),D(ee,R),ee[31]^=j(Q)<<7}function f(ee,X,Q){A(ee[0],o),A(ee[1],a),A(ee[2],a),A(ee[3],o);for(let R=255;R>=0;--R){const Z=Q[R/8|0]>>(R&7)&1;E(ee,X,Z),G(X,ee),G(ee,ee),E(ee,X,Z)}}function g(ee,X){const Q=[i(),i(),i(),i()];A(Q[0],d),A(Q[1],p),A(Q[2],a),T(Q[3],d,p),f(ee,Q,X)}function v(ee){if(ee.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const X=(0,r.hash)(ee);X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(32),R=[i(),i(),i(),i()];g(R,X),m(Q,R);const Z=new Uint8Array(64);return Z.set(ee),Z.set(Q,32),{publicKey:Q,secretKey:Z}}t.generateKeyPairFromSeed=v;function x(ee){const X=(0,e.randomBytes)(32,ee),Q=v(X);return(0,n.wipe)(X),Q}t.generateKeyPair=x;function _(ee){if(ee.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(ee.subarray(32))}t.extractPublicKeyFromSecretKey=_;const S=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function b(ee,X){let Q,R,Z,te;for(R=63;R>=32;--R){for(Q=0,Z=R-32,te=R-12;Z>4)*S[Z],Q=X[Z]>>8,X[Z]&=255;for(Z=0;Z<32;Z++)X[Z]-=Q*S[Z];for(R=0;R<32;R++)X[R+1]+=X[R]>>8,ee[R]=X[R]&255}function M(ee){const X=new Float64Array(64);for(let Q=0;Q<64;Q++)X[Q]=ee[Q];for(let Q=0;Q<64;Q++)ee[Q]=0;b(ee,X)}function I(ee,X){const Q=new Float64Array(64),R=[i(),i(),i(),i()],Z=(0,r.hash)(ee.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(64);te.set(Z.subarray(32),32);const le=new r.SHA512;le.update(te.subarray(32)),le.update(X);const ie=le.digest();le.clean(),M(ie),g(R,ie),m(te,R),le.reset(),le.update(te.subarray(0,32)),le.update(ee.subarray(32)),le.update(X);const fe=le.digest();M(fe);for(let ve=0;ve<32;ve++)Q[ve]=ie[ve];for(let ve=0;ve<32;ve++)for(let Me=0;Me<32;Me++)Q[ve+Me]+=fe[ve]*Z[Me];return b(te.subarray(32),Q),te}t.sign=I;function F(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i();return A(ee[2],a),U(ee[1],X),z(Z,ee[1]),T(te,Z,u),J(Z,Z,ee[2]),K(te,ee[2],te),z(le,te),z(ie,le),T(fe,ie,le),T(Q,fe,Z),T(Q,Q,te),_e(Q,Q),T(Q,Q,Z),T(Q,Q,te),T(Q,Q,te),T(ee[0],Q,te),z(R,ee[0]),T(R,R,te),B(R,Z)&&T(ee[0],ee[0],y),z(R,ee[0]),T(R,R,te),B(R,Z)?-1:(j(ee[0])===X[31]>>7&&J(ee[0],o,ee[0]),T(ee[3],ee[0],ee[1]),0)}function ae(ee,X,Q){const R=new Uint8Array(32),Z=[i(),i(),i(),i()],te=[i(),i(),i(),i()];if(Q.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(F(te,ee))return!1;const le=new r.SHA512;le.update(Q.subarray(0,32)),le.update(ee),le.update(X);const ie=le.digest();return M(ie),f(Z,te,ie),g(te,Q.subarray(32)),G(Z,te),m(R,Z),!k(Q,R)}t.verify=ae;function O(ee){let X=[i(),i(),i(),i()];if(F(X,ee))throw new Error("Ed25519: invalid public key");let Q=i(),R=i(),Z=X[1];K(Q,a,Z),J(R,a,Z),ue(R,R),T(Q,Q,R);let te=new Uint8Array(32);return D(te,Q),te}t.convertPublicKeyToX25519=O;function se(ee){const X=(0,r.hash)(ee.subarray(0,32));X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(X.subarray(0,32));return(0,n.wipe)(X),Q}t.convertSecretKeyToX25519=se}(um);const MD="EdDSA",ID="JWT",hd=".",dd="base64url",ux="utf8",fx="utf8",CD=":",TD="did",RD="key",lx="base58btc",DD="z",OD="K36",ND=32;function hx(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function pd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=hx(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function LD(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(j);k!==B;){for(var K=P[k],J=0,T=j-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=j-D;z!==j&&U[z]===0;)z++;for(var ue=u.repeat(N);z>>0,j=new Uint8Array(B);P[N];){var U=r[P.charCodeAt(N)];if(U===255)return;for(var K=0,J=B-1;(U!==0||K>>0,j[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,N++}if(P[N]!==" "){for(var T=B-k;T!==B&&j[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=j[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:A}}var kD=LD,BD=kD;const $D=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},FD=t=>new TextEncoder().encode(t),jD=t=>new TextDecoder().decode(t);class UD{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class qD{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return dx(this,e)}}class zD{constructor(e){this.decoders=e}or(e){return dx(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const dx=(t,e)=>new zD({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class HD{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new UD(e,r,n),this.decoder=new qD(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const gd=({name:t,prefix:e,encode:r,decode:n})=>new HD(t,e,r,n),rl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=BD(r,e);return gd({prefix:t,name:e,encode:n,decode:s=>$D(i(s))})},WD=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},KD=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<gd({prefix:e,name:t,encode(i){return KD(i,n,r)},decode(i){return WD(i,n,r,t)}}),VD=gd({prefix:"\0",name:"identity",encode:t=>jD(t),decode:t=>FD(t)}),GD=Object.freeze(Object.defineProperty({__proto__:null,identity:VD},Symbol.toStringTag,{value:"Module"})),YD=jn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),JD=Object.freeze(Object.defineProperty({__proto__:null,base2:YD},Symbol.toStringTag,{value:"Module"})),XD=jn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),ZD=Object.freeze(Object.defineProperty({__proto__:null,base8:XD},Symbol.toStringTag,{value:"Module"})),QD=rl({prefix:"9",name:"base10",alphabet:"0123456789"}),eO=Object.freeze(Object.defineProperty({__proto__:null,base10:QD},Symbol.toStringTag,{value:"Module"})),tO=jn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),rO=jn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),nO=Object.freeze(Object.defineProperty({__proto__:null,base16:tO,base16upper:rO},Symbol.toStringTag,{value:"Module"})),iO=jn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),sO=jn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),oO=jn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),aO=jn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),cO=jn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),uO=jn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),fO=jn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),lO=jn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),hO=jn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),dO=Object.freeze(Object.defineProperty({__proto__:null,base32:iO,base32hex:cO,base32hexpad:fO,base32hexpadupper:lO,base32hexupper:uO,base32pad:oO,base32padupper:aO,base32upper:sO,base32z:hO},Symbol.toStringTag,{value:"Module"})),pO=rl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),gO=rl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),mO=Object.freeze(Object.defineProperty({__proto__:null,base36:pO,base36upper:gO},Symbol.toStringTag,{value:"Module"})),vO=rl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),bO=rl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),yO=Object.freeze(Object.defineProperty({__proto__:null,base58btc:vO,base58flickr:bO},Symbol.toStringTag,{value:"Module"})),wO=jn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),xO=jn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),_O=jn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),EO=jn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),SO=Object.freeze(Object.defineProperty({__proto__:null,base64:wO,base64pad:xO,base64url:_O,base64urlpad:EO},Symbol.toStringTag,{value:"Module"})),px=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),AO=px.reduce((t,e,r)=>(t[r]=e,t),[]),PO=px.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function MO(t){return t.reduce((e,r)=>(e+=AO[r],e),"")}function IO(t){const e=[];for(const r of t){const n=PO[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const CO=gd({prefix:"🚀",name:"base256emoji",encode:MO,decode:IO}),TO=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:CO},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const gx={...GD,...JD,...ZD,...eO,...nO,...dO,...mO,...yO,...SO,...TO};function mx(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const vx=mx("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),pm=mx("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=hx(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new jO:typeof navigator<"u"?KO(navigator.userAgent):GO()}function WO(t){return t!==""&&zO.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function KO(t){var e=WO(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new FO;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length-1){const D=P.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let k=e.protocol+"//"+e.host;if(D.indexOf("/")===0)k+=D;else{const B=e.pathname.split("/");B.pop();const j=B.join("/");k+=j+"/"+D}y.push(k)}else if(D.indexOf("//")===0){const k=e.protocol+D;y.push(k)}else y.push(D)}}return y}function n(...p){const y=t.getElementsByTagName("meta");for(let A=0;AP.getAttribute(D)).filter(D=>D?p.includes(D):!1);if(N.length&&N){const D=P.getAttribute("content");if(D)return D}}return""}function i(){let p=n("name","og:site_name","og:title","twitter:title");return p||(p=t.title),p}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}Px=vm.getWindowMetadata=oN;var il={},aN=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Ix="%[a-f0-9]{2}",Cx=new RegExp("("+Ix+")|([^%]+?)","gi"),Tx=new RegExp("("+Ix+")+","gi");function bm(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],bm(r),bm(n))}function cN(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(Cx)||[],r=1;r{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},hN=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;sB==null,o=Symbol("encodeFragmentIdentifier");function a(B){switch(B.arrayFormat){case"index":return j=>(U,K)=>{const J=U.length;return K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),"[",J,"]"].join("")]:[...U,[d(j,B),"[",d(J,B),"]=",d(K,B)].join("")]};case"bracket":return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),"[]"].join("")]:[...U,[d(j,B),"[]=",d(K,B)].join("")];case"colon-list-separator":return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),":list="].join("")]:[...U,[d(j,B),":list=",d(K,B)].join("")];case"comma":case"separator":case"bracket-separator":{const j=B.arrayFormat==="bracket-separator"?"[]=":"=";return U=>(K,J)=>J===void 0||B.skipNull&&J===null||B.skipEmptyString&&J===""?K:(J=J===null?"":J,K.length===0?[[d(U,B),j,d(J,B)].join("")]:[[K,d(J,B)].join(B.arrayFormatSeparator)])}default:return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,d(j,B)]:[...U,[d(j,B),"=",d(K,B)].join("")]}}function u(B){let j;switch(B.arrayFormat){case"index":return(U,K,J)=>{if(j=/\[(\d*)\]$/.exec(U),U=U.replace(/\[\d*\]$/,""),!j){J[U]=K;return}J[U]===void 0&&(J[U]={}),J[U][j[1]]=K};case"bracket":return(U,K,J)=>{if(j=/(\[\])$/.exec(U),U=U.replace(/\[\]$/,""),!j){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"colon-list-separator":return(U,K,J)=>{if(j=/(:list)$/.exec(U),U=U.replace(/:list$/,""),!j){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"comma":case"separator":return(U,K,J)=>{const T=typeof K=="string"&&K.includes(B.arrayFormatSeparator),z=typeof K=="string"&&!T&&p(K,B).includes(B.arrayFormatSeparator);K=z?p(K,B):K;const ue=T||z?K.split(B.arrayFormatSeparator).map(_e=>p(_e,B)):K===null?K:p(K,B);J[U]=ue};case"bracket-separator":return(U,K,J)=>{const T=/(\[\])$/.test(U);if(U=U.replace(/\[\]$/,""),!T){J[U]=K&&p(K,B);return}const z=K===null?[]:K.split(B.arrayFormatSeparator).map(ue=>p(ue,B));if(J[U]===void 0){J[U]=z;return}J[U]=[].concat(J[U],z)};default:return(U,K,J)=>{if(J[U]===void 0){J[U]=K;return}J[U]=[].concat(J[U],K)}}}function l(B){if(typeof B!="string"||B.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function d(B,j){return j.encode?j.strict?e(B):encodeURIComponent(B):B}function p(B,j){return j.decode?r(B):B}function y(B){return Array.isArray(B)?B.sort():typeof B=="object"?y(Object.keys(B)).sort((j,U)=>Number(j)-Number(U)).map(j=>B[j]):B}function A(B){const j=B.indexOf("#");return j!==-1&&(B=B.slice(0,j)),B}function P(B){let j="";const U=B.indexOf("#");return U!==-1&&(j=B.slice(U)),j}function N(B){B=A(B);const j=B.indexOf("?");return j===-1?"":B.slice(j+1)}function D(B,j){return j.parseNumbers&&!Number.isNaN(Number(B))&&typeof B=="string"&&B.trim()!==""?B=Number(B):j.parseBooleans&&B!==null&&(B.toLowerCase()==="true"||B.toLowerCase()==="false")&&(B=B.toLowerCase()==="true"),B}function k(B,j){j=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},j),l(j.arrayFormatSeparator);const U=u(j),K=Object.create(null);if(typeof B!="string"||(B=B.trim().replace(/^[?#&]/,""),!B))return K;for(const J of B.split("&")){if(J==="")continue;let[T,z]=n(j.decode?J.replace(/\+/g," "):J,"=");z=z===void 0?null:["comma","separator","bracket-separator"].includes(j.arrayFormat)?z:p(z,j),U(p(T,j),z,K)}for(const J of Object.keys(K)){const T=K[J];if(typeof T=="object"&&T!==null)for(const z of Object.keys(T))T[z]=D(T[z],j);else K[J]=D(T,j)}return j.sort===!1?K:(j.sort===!0?Object.keys(K).sort():Object.keys(K).sort(j.sort)).reduce((J,T)=>{const z=K[T];return z&&typeof z=="object"&&!Array.isArray(z)?J[T]=y(z):J[T]=z,J},Object.create(null))}t.extract=N,t.parse=k,t.stringify=(B,j)=>{if(!B)return"";j=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},j),l(j.arrayFormatSeparator);const U=z=>j.skipNull&&s(B[z])||j.skipEmptyString&&B[z]==="",K=a(j),J={};for(const z of Object.keys(B))U(z)||(J[z]=B[z]);const T=Object.keys(J);return j.sort!==!1&&T.sort(j.sort),T.map(z=>{const ue=B[z];return ue===void 0?"":ue===null?d(z,j):Array.isArray(ue)?ue.length===0&&j.arrayFormat==="bracket-separator"?d(z,j)+"[]":ue.reduce(K(z),[]).join("&"):d(z,j)+"="+d(ue,j)}).filter(z=>z.length>0).join("&")},t.parseUrl=(B,j)=>{j=Object.assign({decode:!0},j);const[U,K]=n(B,"#");return Object.assign({url:U.split("?")[0]||"",query:k(N(B),j)},j&&j.parseFragmentIdentifier&&K?{fragmentIdentifier:p(K,j)}:{})},t.stringifyUrl=(B,j)=>{j=Object.assign({encode:!0,strict:!0,[o]:!0},j);const U=A(B.url).split("?")[0]||"",K=t.extract(B.url),J=t.parse(K,{sort:!1}),T=Object.assign(J,B.query);let z=t.stringify(T,j);z&&(z=`?${z}`);let ue=P(B.url);return B.fragmentIdentifier&&(ue=`#${j[o]?d(B.fragmentIdentifier,j):B.fragmentIdentifier}`),`${U}${z}${ue}`},t.pick=(B,j,U)=>{U=Object.assign({parseFragmentIdentifier:!0,[o]:!1},U);const{url:K,query:J,fragmentIdentifier:T}=t.parseUrl(B,U);return t.stringifyUrl({url:K,query:i(J,j),fragmentIdentifier:T},U)},t.exclude=(B,j,U)=>{const K=Array.isArray(j)?J=>!j.includes(J):(J,T)=>!j(J,T);return t.pick(B,K,U)}})(il);var Rx={exports:{}};/** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.8.0 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT - */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=nn:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],p=[4,1024,262144,67108864],y=[1,256,65536,16777216],A=[6,1536,393216,100663296],P=[0,8,16,24],N=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],D=[224,256,384,512],k=[128,256],B=["hex","buffer","arrayBuffer","array","digest"],j={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(O){return Object.prototype.toString.call(O)==="[object Array]"}),u&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(O){return typeof O=="object"&&O.buffer&&O.buffer.constructor===ArrayBuffer});for(var U=function(O,se,ee){return function(X){return new I(O,se,O).update(X)[ee]()}},K=function(O,se,ee){return function(X,Q){return new I(O,se,Q).update(X)[ee]()}},J=function(O,se,ee){return function(X,Q,R,Z){return f["cshake"+O].update(X,Q,R,Z)[ee]()}},T=function(O,se,ee){return function(X,Q,R,Z){return f["kmac"+O].update(X,Q,R,Z)[ee]()}},z=function(O,se,ee,X){for(var Q=0;Q>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ee>>5,this.extraBytes=(ee&31)>>3;for(var X=0;X<50;++X)this.s[X]=0}I.prototype.update=function(O){if(this.finalized)throw new Error(r);var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}for(var X=this.blocks,Q=this.byteCount,R=O.length,Z=this.blockCount,te=0,le=this.s,ie,fe;te>2]|=O[te]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(X[ie>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=Q){for(this.start=ie-Q,this.block=X[Z],ie=0;ie>8,ee=O&255;ee>0;)Q.unshift(ee),O=O>>8,ee=O&255,++X;return se?Q.push(X):Q.unshift(X),this.update(Q),Q.length},I.prototype.encodeString=function(O){var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}var X=0,Q=O.length;if(se)X=Q;else for(var R=0;R=57344?X+=3:(Z=65536+((Z&1023)<<10|O.charCodeAt(++R)&1023),X+=4)}return X+=this.encode(X*8),this.update(O),X},I.prototype.bytepad=function(O,se){for(var ee=this.encode(se),X=0;X>2]|=this.padding[se&3],this.lastByteIndex===this.byteCount)for(O[0]=O[ee],se=1;se>4&15]+l[te&15]+l[te>>12&15]+l[te>>8&15]+l[te>>20&15]+l[te>>16&15]+l[te>>28&15]+l[te>>24&15];R%O===0&&(ae(se),Q=0)}return X&&(te=se[Q],Z+=l[te>>4&15]+l[te&15],X>1&&(Z+=l[te>>12&15]+l[te>>8&15]),X>2&&(Z+=l[te>>20&15]+l[te>>16&15])),Z},I.prototype.arrayBuffer=function(){this.finalize();var O=this.blockCount,se=this.s,ee=this.outputBlocks,X=this.extraBytes,Q=0,R=0,Z=this.outputBits>>3,te;X?te=new ArrayBuffer(ee+1<<2):te=new ArrayBuffer(Z);for(var le=new Uint32Array(te);R>8&255,Z[te+2]=le>>16&255,Z[te+3]=le>>24&255;R%O===0&&ae(se)}return X&&(te=R<<2,le=se[Q],Z[te]=le&255,X>1&&(Z[te+1]=le>>8&255),X>2&&(Z[te+2]=le>>16&255)),Z};function F(O,se,ee){I.call(this,O,se,ee)}F.prototype=new I,F.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var ae=function(O){var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me,Ne,Te,$e,Ie,Le,Ve,ke,ze,He,Ee,Qe,ct,Be,et,rt,Je,pt,ht,ft,Ht,Jt,St,er,Xt,Ot,Bt,Tt,vt,Dt,Lt,bt,$t,jt,nt,Ft,$,H,V,C,Y,q,oe,pe,xe,Re,De,it,Ue,gt,st,tt;for(X=0;X<48;X+=2)Q=O[0]^O[10]^O[20]^O[30]^O[40],R=O[1]^O[11]^O[21]^O[31]^O[41],Z=O[2]^O[12]^O[22]^O[32]^O[42],te=O[3]^O[13]^O[23]^O[33]^O[43],le=O[4]^O[14]^O[24]^O[34]^O[44],ie=O[5]^O[15]^O[25]^O[35]^O[45],fe=O[6]^O[16]^O[26]^O[36]^O[46],ve=O[7]^O[17]^O[27]^O[37]^O[47],Me=O[8]^O[18]^O[28]^O[38]^O[48],Ne=O[9]^O[19]^O[29]^O[39]^O[49],se=Me^(Z<<1|te>>>31),ee=Ne^(te<<1|Z>>>31),O[0]^=se,O[1]^=ee,O[10]^=se,O[11]^=ee,O[20]^=se,O[21]^=ee,O[30]^=se,O[31]^=ee,O[40]^=se,O[41]^=ee,se=Q^(le<<1|ie>>>31),ee=R^(ie<<1|le>>>31),O[2]^=se,O[3]^=ee,O[12]^=se,O[13]^=ee,O[22]^=se,O[23]^=ee,O[32]^=se,O[33]^=ee,O[42]^=se,O[43]^=ee,se=Z^(fe<<1|ve>>>31),ee=te^(ve<<1|fe>>>31),O[4]^=se,O[5]^=ee,O[14]^=se,O[15]^=ee,O[24]^=se,O[25]^=ee,O[34]^=se,O[35]^=ee,O[44]^=se,O[45]^=ee,se=le^(Me<<1|Ne>>>31),ee=ie^(Ne<<1|Me>>>31),O[6]^=se,O[7]^=ee,O[16]^=se,O[17]^=ee,O[26]^=se,O[27]^=ee,O[36]^=se,O[37]^=ee,O[46]^=se,O[47]^=ee,se=fe^(Q<<1|R>>>31),ee=ve^(R<<1|Q>>>31),O[8]^=se,O[9]^=ee,O[18]^=se,O[19]^=ee,O[28]^=se,O[29]^=ee,O[38]^=se,O[39]^=ee,O[48]^=se,O[49]^=ee,Te=O[0],$e=O[1],nt=O[11]<<4|O[10]>>>28,Ft=O[10]<<4|O[11]>>>28,Je=O[20]<<3|O[21]>>>29,pt=O[21]<<3|O[20]>>>29,Ue=O[31]<<9|O[30]>>>23,gt=O[30]<<9|O[31]>>>23,Lt=O[40]<<18|O[41]>>>14,bt=O[41]<<18|O[40]>>>14,St=O[2]<<1|O[3]>>>31,er=O[3]<<1|O[2]>>>31,Ie=O[13]<<12|O[12]>>>20,Le=O[12]<<12|O[13]>>>20,$=O[22]<<10|O[23]>>>22,H=O[23]<<10|O[22]>>>22,ht=O[33]<<13|O[32]>>>19,ft=O[32]<<13|O[33]>>>19,st=O[42]<<2|O[43]>>>30,tt=O[43]<<2|O[42]>>>30,oe=O[5]<<30|O[4]>>>2,pe=O[4]<<30|O[5]>>>2,Xt=O[14]<<6|O[15]>>>26,Ot=O[15]<<6|O[14]>>>26,Ve=O[25]<<11|O[24]>>>21,ke=O[24]<<11|O[25]>>>21,V=O[34]<<15|O[35]>>>17,C=O[35]<<15|O[34]>>>17,Ht=O[45]<<29|O[44]>>>3,Jt=O[44]<<29|O[45]>>>3,ct=O[6]<<28|O[7]>>>4,Be=O[7]<<28|O[6]>>>4,xe=O[17]<<23|O[16]>>>9,Re=O[16]<<23|O[17]>>>9,Bt=O[26]<<25|O[27]>>>7,Tt=O[27]<<25|O[26]>>>7,ze=O[36]<<21|O[37]>>>11,He=O[37]<<21|O[36]>>>11,Y=O[47]<<24|O[46]>>>8,q=O[46]<<24|O[47]>>>8,$t=O[8]<<27|O[9]>>>5,jt=O[9]<<27|O[8]>>>5,et=O[18]<<20|O[19]>>>12,rt=O[19]<<20|O[18]>>>12,De=O[29]<<7|O[28]>>>25,it=O[28]<<7|O[29]>>>25,vt=O[38]<<8|O[39]>>>24,Dt=O[39]<<8|O[38]>>>24,Ee=O[48]<<14|O[49]>>>18,Qe=O[49]<<14|O[48]>>>18,O[0]=Te^~Ie&Ve,O[1]=$e^~Le&ke,O[10]=ct^~et&Je,O[11]=Be^~rt&pt,O[20]=St^~Xt&Bt,O[21]=er^~Ot&Tt,O[30]=$t^~nt&$,O[31]=jt^~Ft&H,O[40]=oe^~xe&De,O[41]=pe^~Re&it,O[2]=Ie^~Ve&ze,O[3]=Le^~ke&He,O[12]=et^~Je&ht,O[13]=rt^~pt&ft,O[22]=Xt^~Bt&vt,O[23]=Ot^~Tt&Dt,O[32]=nt^~$&V,O[33]=Ft^~H&C,O[42]=xe^~De&Ue,O[43]=Re^~it>,O[4]=Ve^~ze&Ee,O[5]=ke^~He&Qe,O[14]=Je^~ht&Ht,O[15]=pt^~ft&Jt,O[24]=Bt^~vt&Lt,O[25]=Tt^~Dt&bt,O[34]=$^~V&Y,O[35]=H^~C&q,O[44]=De^~Ue&st,O[45]=it^~gt&tt,O[6]=ze^~Ee&Te,O[7]=He^~Qe&$e,O[16]=ht^~Ht&ct,O[17]=ft^~Jt&Be,O[26]=vt^~Lt&St,O[27]=Dt^~bt&er,O[36]=V^~Y&$t,O[37]=C^~q&jt,O[46]=Ue^~st&oe,O[47]=gt^~tt&pe,O[8]=Ee^~Te&Ie,O[9]=Qe^~$e&Le,O[18]=Ht^~ct&et,O[19]=Jt^~Be&rt,O[28]=Lt^~St&Xt,O[29]=bt^~er&Ot,O[38]=Y^~$t&nt,O[39]=q^~jt&Ft,O[48]=st^~oe&xe,O[49]=tt^~pe&Re,O[0]^=N[X],O[1]^=N[X+1]};if(a)t.exports=f;else for(v=0;v{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const Nx=mN();var wm;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(wm||(wm={}));var ps;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(ps||(ps={}));const Lx="0123456789abcdef";class Kr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();vd[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Ox>vd[n])&&console.log.apply(console,r)}debug(...e){this._log(Kr.levels.DEBUG,e)}info(...e){this._log(Kr.levels.INFO,e)}warn(...e){this._log(Kr.levels.WARNING,e)}makeError(e,r,n){if(Dx)return this.makeError("censored error",r,{});r||(r=Kr.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(u=>{const l=n[u];try{if(l instanceof Uint8Array){let d="";for(let p=0;p>4],d+=Lx[l[p]&15];i.push(u+"=Uint8Array(0x"+d+")")}else i.push(u+"="+JSON.stringify(l))}catch{i.push(u+"="+JSON.stringify(n[u].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case ps.NUMERIC_FAULT:{o="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case ps.CALL_EXCEPTION:case ps.INSUFFICIENT_FUNDS:case ps.MISSING_NEW:case ps.NONCE_EXPIRED:case ps.REPLACEMENT_UNDERPRICED:case ps.TRANSACTION_REPLACED:case ps.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(u){a[u]=n[u]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Kr.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){Nx&&this.throwError("platform missing String.prototype.normalize",Kr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Nx})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Kr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Kr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return ym||(ym=new Kr(gN)),ym}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Rx){if(!e)return;this.globalLogger().throwError("error censorship permanent",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Dx=!!e,Rx=!!r}static setLogLevel(e){const r=vd[e.toLowerCase()];if(r==null){Kr.globalLogger().warn("invalid log level - "+e);return}Ox=r}static from(e){return new Kr(e)}}Kr.errors=ps,Kr.levels=wm;const vN="bytes/5.7.0",on=new Kr(vN);function kx(t){return!!t.toHexString}function uu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return uu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function bN(t){return Ns(t)&&!(t.length%2)||xm(t)}function Bx(t){return typeof t=="number"&&t==t&&t%1===0}function xm(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!Bx(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function bn(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),uu(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t)&&(t=t.toHexString()),Ns(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":on.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ibn(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),uu(n)}function wN(t,e){t=bn(t),t.length>e&&on.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),uu(r)}function Ns(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const _m="0123456789abcdef";function Ii(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=_m[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t))return t.toHexString();if(Ns(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":on.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(xm(t)){let r="0x";for(let n=0;n>4]+_m[i&15]}return r}return on.throwArgumentError("invalid hexlify value","value",t)}function xN(t){if(typeof t!="string")t=Ii(t);else if(!Ns(t)||t.length%2)return null;return(t.length-2)/2}function $x(t,e,r){return typeof t!="string"?t=Ii(t):(!Ns(t)||t.length%2)&&on.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function fu(t,e){for(typeof t!="string"?t=Ii(t):Ns(t)||on.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&on.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Fx(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(bN(t)){let r=bn(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64))):r.length===65?(e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64)),e.v=r[64]):on.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:on.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Ii(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=wN(bn(e._vs),32);e._vs=Ii(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&on.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=Ii(i);e.s==null?e.s=o:e.s!==o&&on.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?on.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&on.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Ns(e.r)?on.throwArgumentError("signature missing or invalid r","signature",t):e.r=fu(e.r,32),e.s==null||!Ns(e.s)?on.throwArgumentError("signature missing or invalid s","signature",t):e.s=fu(e.s,32);const r=bn(e.s);r[0]>=128&&on.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=Ii(r);e._vs&&(Ns(e._vs)||on.throwArgumentError("signature invalid _vs","signature",t),e._vs=fu(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&on.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Em(t){return"0x"+pN.keccak_256(bn(t))}var Sm={exports:{}};Sm.exports,function(t){(function(e,r){function n(m,f){if(!m)throw new Error(f||"Assertion failed")}function i(m,f){m.super_=f;var g=function(){};g.prototype=f.prototype,m.prototype=new g,m.prototype.constructor=m}function s(m,f,g){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((f==="le"||f==="be")&&(g=f,f=10),this._init(m||0,f||10,g||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,g){return f.cmp(g)>0?f:g},s.min=function(f,g){return f.cmp(g)<0?f:g},s.prototype._init=function(f,g,v){if(typeof f=="number")return this._initNumber(f,g,v);if(typeof f=="object")return this._initArray(f,g,v);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),f=f.toString().replace(/\s+/g,"");var x=0;f[0]==="-"&&(x++,this.negative=1),x=0;x-=3)S=f[x]|f[x-1]<<8|f[x-2]<<16,this.words[_]|=S<>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);else if(v==="le")for(x=0,_=0;x>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);return this._strip()};function a(m,f){var g=m.charCodeAt(f);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+m)}function u(m,f,g){var v=a(m,g);return g-1>=f&&(v|=a(m,g-1)<<4),v}s.prototype._parseHex=function(f,g,v){this.length=Math.ceil((f.length-g)/6),this.words=new Array(this.length);for(var x=0;x=g;x-=2)b=u(f,g,x)<<_,this.words[S]|=b&67108863,_>=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8;else{var M=f.length-g;for(x=M%2===0?g+1:g;x=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8}this._strip()};function l(m,f,g,v){for(var x=0,_=0,S=Math.min(m.length,g),b=f;b=49?_=M-49+10:M>=17?_=M-17+10:_=M,n(M>=0&&_1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{s.prototype.inspect=p}else s.prototype.inspect=p;function p(){return(this.red?""}var y=["","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"],A=[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,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(f,g){f=f||10,g=g|0||1;var v;if(f===16||f==="hex"){v="";for(var x=0,_=0,S=0;S>>24-x&16777215,x+=2,x>=26&&(x-=26,S--),_!==0||S!==this.length-1?v=y[6-M.length]+M+v:v=M+v}for(_!==0&&(v=_.toString(16)+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(f===(f|0)&&f>=2&&f<=36){var I=A[f],F=P[f];v="";var ae=this.clone();for(ae.negative=0;!ae.isZero();){var O=ae.modrn(F).toString(f);ae=ae.idivn(F),ae.isZero()?v=O+v:v=y[I-O.length]+O+v}for(this.isZero()&&(v="0"+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,g){return this.toArrayLike(o,f,g)}),s.prototype.toArray=function(f,g){return this.toArrayLike(Array,f,g)};var N=function(f,g){return f.allocUnsafe?f.allocUnsafe(g):new f(g)};s.prototype.toArrayLike=function(f,g,v){this._strip();var x=this.byteLength(),_=v||Math.max(1,x);n(x<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var S=N(f,_),b=g==="le"?"LE":"BE";return this["_toArrayLike"+b](S,x),S},s.prototype._toArrayLikeLE=function(f,g){for(var v=0,x=0,_=0,S=0;_>8&255),v>16&255),S===6?(v>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v=0&&(f[v--]=b>>8&255),v>=0&&(f[v--]=b>>16&255),S===6?(v>=0&&(f[v--]=b>>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v>=0)for(f[v--]=x;v>=0;)f[v--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var g=f,v=0;return g>=4096&&(v+=13,g>>>=13),g>=64&&(v+=7,g>>>=7),g>=8&&(v+=4,g>>>=4),g>=2&&(v+=2,g>>>=2),v+g},s.prototype._zeroBits=function(f){if(f===0)return 26;var g=f,v=0;return g&8191||(v+=13,g>>>=13),g&127||(v+=7,g>>>=7),g&15||(v+=4,g>>>=4),g&3||(v+=2,g>>>=2),g&1||v++,v},s.prototype.bitLength=function(){var f=this.words[this.length-1],g=this._countBits(f);return(this.length-1)*26+g};function D(m){for(var f=new Array(m.bitLength()),g=0;g>>x&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,g=0;gf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var g;this.length>f.length?g=f:g=this;for(var v=0;vf.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var g,v;this.length>f.length?(g=this,v=f):(g=f,v=this);for(var x=0;xf.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var g=Math.ceil(f/26)|0,v=f%26;this._expand(g),v>0&&g--;for(var x=0;x0&&(this.words[x]=~this.words[x]&67108863>>26-v),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,g){n(typeof f=="number"&&f>=0);var v=f/26|0,x=f%26;return this._expand(v+1),g?this.words[v]=this.words[v]|1<f.length?(v=this,x=f):(v=f,x=this);for(var _=0,S=0;S>>26;for(;_!==0&&S>>26;if(this.length=v.length,_!==0)this.words[this.length]=_,this.length++;else if(v!==this)for(;Sf.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var g=this.iadd(f);return f.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var v=this.cmp(f);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,_;v>0?(x=this,_=f):(x=f,_=this);for(var S=0,b=0;b<_.length;b++)g=(x.words[b]|0)-(_.words[b]|0)+S,S=g>>26,this.words[b]=g&67108863;for(;S!==0&&b>26,this.words[b]=g&67108863;if(S===0&&b>>26,ae=M&67108863,O=Math.min(I,f.length-1),se=Math.max(0,I-m.length+1);se<=O;se++){var ee=I-se|0;x=m.words[ee]|0,_=f.words[se]|0,S=x*_+ae,F+=S/67108864|0,ae=S&67108863}g.words[I]=ae|0,M=F|0}return M!==0?g.words[I]=M|0:g.length--,g._strip()}var B=function(f,g,v){var x=f.words,_=g.words,S=v.words,b=0,M,I,F,ae=x[0]|0,O=ae&8191,se=ae>>>13,ee=x[1]|0,X=ee&8191,Q=ee>>>13,R=x[2]|0,Z=R&8191,te=R>>>13,le=x[3]|0,ie=le&8191,fe=le>>>13,ve=x[4]|0,Me=ve&8191,Ne=ve>>>13,Te=x[5]|0,$e=Te&8191,Ie=Te>>>13,Le=x[6]|0,Ve=Le&8191,ke=Le>>>13,ze=x[7]|0,He=ze&8191,Ee=ze>>>13,Qe=x[8]|0,ct=Qe&8191,Be=Qe>>>13,et=x[9]|0,rt=et&8191,Je=et>>>13,pt=_[0]|0,ht=pt&8191,ft=pt>>>13,Ht=_[1]|0,Jt=Ht&8191,St=Ht>>>13,er=_[2]|0,Xt=er&8191,Ot=er>>>13,Bt=_[3]|0,Tt=Bt&8191,vt=Bt>>>13,Dt=_[4]|0,Lt=Dt&8191,bt=Dt>>>13,$t=_[5]|0,jt=$t&8191,nt=$t>>>13,Ft=_[6]|0,$=Ft&8191,H=Ft>>>13,V=_[7]|0,C=V&8191,Y=V>>>13,q=_[8]|0,oe=q&8191,pe=q>>>13,xe=_[9]|0,Re=xe&8191,De=xe>>>13;v.negative=f.negative^g.negative,v.length=19,M=Math.imul(O,ht),I=Math.imul(O,ft),I=I+Math.imul(se,ht)|0,F=Math.imul(se,ft);var it=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(it>>>26)|0,it&=67108863,M=Math.imul(X,ht),I=Math.imul(X,ft),I=I+Math.imul(Q,ht)|0,F=Math.imul(Q,ft),M=M+Math.imul(O,Jt)|0,I=I+Math.imul(O,St)|0,I=I+Math.imul(se,Jt)|0,F=F+Math.imul(se,St)|0;var Ue=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,M=Math.imul(Z,ht),I=Math.imul(Z,ft),I=I+Math.imul(te,ht)|0,F=Math.imul(te,ft),M=M+Math.imul(X,Jt)|0,I=I+Math.imul(X,St)|0,I=I+Math.imul(Q,Jt)|0,F=F+Math.imul(Q,St)|0,M=M+Math.imul(O,Xt)|0,I=I+Math.imul(O,Ot)|0,I=I+Math.imul(se,Xt)|0,F=F+Math.imul(se,Ot)|0;var gt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(gt>>>26)|0,gt&=67108863,M=Math.imul(ie,ht),I=Math.imul(ie,ft),I=I+Math.imul(fe,ht)|0,F=Math.imul(fe,ft),M=M+Math.imul(Z,Jt)|0,I=I+Math.imul(Z,St)|0,I=I+Math.imul(te,Jt)|0,F=F+Math.imul(te,St)|0,M=M+Math.imul(X,Xt)|0,I=I+Math.imul(X,Ot)|0,I=I+Math.imul(Q,Xt)|0,F=F+Math.imul(Q,Ot)|0,M=M+Math.imul(O,Tt)|0,I=I+Math.imul(O,vt)|0,I=I+Math.imul(se,Tt)|0,F=F+Math.imul(se,vt)|0;var st=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(st>>>26)|0,st&=67108863,M=Math.imul(Me,ht),I=Math.imul(Me,ft),I=I+Math.imul(Ne,ht)|0,F=Math.imul(Ne,ft),M=M+Math.imul(ie,Jt)|0,I=I+Math.imul(ie,St)|0,I=I+Math.imul(fe,Jt)|0,F=F+Math.imul(fe,St)|0,M=M+Math.imul(Z,Xt)|0,I=I+Math.imul(Z,Ot)|0,I=I+Math.imul(te,Xt)|0,F=F+Math.imul(te,Ot)|0,M=M+Math.imul(X,Tt)|0,I=I+Math.imul(X,vt)|0,I=I+Math.imul(Q,Tt)|0,F=F+Math.imul(Q,vt)|0,M=M+Math.imul(O,Lt)|0,I=I+Math.imul(O,bt)|0,I=I+Math.imul(se,Lt)|0,F=F+Math.imul(se,bt)|0;var tt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(tt>>>26)|0,tt&=67108863,M=Math.imul($e,ht),I=Math.imul($e,ft),I=I+Math.imul(Ie,ht)|0,F=Math.imul(Ie,ft),M=M+Math.imul(Me,Jt)|0,I=I+Math.imul(Me,St)|0,I=I+Math.imul(Ne,Jt)|0,F=F+Math.imul(Ne,St)|0,M=M+Math.imul(ie,Xt)|0,I=I+Math.imul(ie,Ot)|0,I=I+Math.imul(fe,Xt)|0,F=F+Math.imul(fe,Ot)|0,M=M+Math.imul(Z,Tt)|0,I=I+Math.imul(Z,vt)|0,I=I+Math.imul(te,Tt)|0,F=F+Math.imul(te,vt)|0,M=M+Math.imul(X,Lt)|0,I=I+Math.imul(X,bt)|0,I=I+Math.imul(Q,Lt)|0,F=F+Math.imul(Q,bt)|0,M=M+Math.imul(O,jt)|0,I=I+Math.imul(O,nt)|0,I=I+Math.imul(se,jt)|0,F=F+Math.imul(se,nt)|0;var At=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(At>>>26)|0,At&=67108863,M=Math.imul(Ve,ht),I=Math.imul(Ve,ft),I=I+Math.imul(ke,ht)|0,F=Math.imul(ke,ft),M=M+Math.imul($e,Jt)|0,I=I+Math.imul($e,St)|0,I=I+Math.imul(Ie,Jt)|0,F=F+Math.imul(Ie,St)|0,M=M+Math.imul(Me,Xt)|0,I=I+Math.imul(Me,Ot)|0,I=I+Math.imul(Ne,Xt)|0,F=F+Math.imul(Ne,Ot)|0,M=M+Math.imul(ie,Tt)|0,I=I+Math.imul(ie,vt)|0,I=I+Math.imul(fe,Tt)|0,F=F+Math.imul(fe,vt)|0,M=M+Math.imul(Z,Lt)|0,I=I+Math.imul(Z,bt)|0,I=I+Math.imul(te,Lt)|0,F=F+Math.imul(te,bt)|0,M=M+Math.imul(X,jt)|0,I=I+Math.imul(X,nt)|0,I=I+Math.imul(Q,jt)|0,F=F+Math.imul(Q,nt)|0,M=M+Math.imul(O,$)|0,I=I+Math.imul(O,H)|0,I=I+Math.imul(se,$)|0,F=F+Math.imul(se,H)|0;var Rt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,M=Math.imul(He,ht),I=Math.imul(He,ft),I=I+Math.imul(Ee,ht)|0,F=Math.imul(Ee,ft),M=M+Math.imul(Ve,Jt)|0,I=I+Math.imul(Ve,St)|0,I=I+Math.imul(ke,Jt)|0,F=F+Math.imul(ke,St)|0,M=M+Math.imul($e,Xt)|0,I=I+Math.imul($e,Ot)|0,I=I+Math.imul(Ie,Xt)|0,F=F+Math.imul(Ie,Ot)|0,M=M+Math.imul(Me,Tt)|0,I=I+Math.imul(Me,vt)|0,I=I+Math.imul(Ne,Tt)|0,F=F+Math.imul(Ne,vt)|0,M=M+Math.imul(ie,Lt)|0,I=I+Math.imul(ie,bt)|0,I=I+Math.imul(fe,Lt)|0,F=F+Math.imul(fe,bt)|0,M=M+Math.imul(Z,jt)|0,I=I+Math.imul(Z,nt)|0,I=I+Math.imul(te,jt)|0,F=F+Math.imul(te,nt)|0,M=M+Math.imul(X,$)|0,I=I+Math.imul(X,H)|0,I=I+Math.imul(Q,$)|0,F=F+Math.imul(Q,H)|0,M=M+Math.imul(O,C)|0,I=I+Math.imul(O,Y)|0,I=I+Math.imul(se,C)|0,F=F+Math.imul(se,Y)|0;var Mt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,M=Math.imul(ct,ht),I=Math.imul(ct,ft),I=I+Math.imul(Be,ht)|0,F=Math.imul(Be,ft),M=M+Math.imul(He,Jt)|0,I=I+Math.imul(He,St)|0,I=I+Math.imul(Ee,Jt)|0,F=F+Math.imul(Ee,St)|0,M=M+Math.imul(Ve,Xt)|0,I=I+Math.imul(Ve,Ot)|0,I=I+Math.imul(ke,Xt)|0,F=F+Math.imul(ke,Ot)|0,M=M+Math.imul($e,Tt)|0,I=I+Math.imul($e,vt)|0,I=I+Math.imul(Ie,Tt)|0,F=F+Math.imul(Ie,vt)|0,M=M+Math.imul(Me,Lt)|0,I=I+Math.imul(Me,bt)|0,I=I+Math.imul(Ne,Lt)|0,F=F+Math.imul(Ne,bt)|0,M=M+Math.imul(ie,jt)|0,I=I+Math.imul(ie,nt)|0,I=I+Math.imul(fe,jt)|0,F=F+Math.imul(fe,nt)|0,M=M+Math.imul(Z,$)|0,I=I+Math.imul(Z,H)|0,I=I+Math.imul(te,$)|0,F=F+Math.imul(te,H)|0,M=M+Math.imul(X,C)|0,I=I+Math.imul(X,Y)|0,I=I+Math.imul(Q,C)|0,F=F+Math.imul(Q,Y)|0,M=M+Math.imul(O,oe)|0,I=I+Math.imul(O,pe)|0,I=I+Math.imul(se,oe)|0,F=F+Math.imul(se,pe)|0;var Et=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Et>>>26)|0,Et&=67108863,M=Math.imul(rt,ht),I=Math.imul(rt,ft),I=I+Math.imul(Je,ht)|0,F=Math.imul(Je,ft),M=M+Math.imul(ct,Jt)|0,I=I+Math.imul(ct,St)|0,I=I+Math.imul(Be,Jt)|0,F=F+Math.imul(Be,St)|0,M=M+Math.imul(He,Xt)|0,I=I+Math.imul(He,Ot)|0,I=I+Math.imul(Ee,Xt)|0,F=F+Math.imul(Ee,Ot)|0,M=M+Math.imul(Ve,Tt)|0,I=I+Math.imul(Ve,vt)|0,I=I+Math.imul(ke,Tt)|0,F=F+Math.imul(ke,vt)|0,M=M+Math.imul($e,Lt)|0,I=I+Math.imul($e,bt)|0,I=I+Math.imul(Ie,Lt)|0,F=F+Math.imul(Ie,bt)|0,M=M+Math.imul(Me,jt)|0,I=I+Math.imul(Me,nt)|0,I=I+Math.imul(Ne,jt)|0,F=F+Math.imul(Ne,nt)|0,M=M+Math.imul(ie,$)|0,I=I+Math.imul(ie,H)|0,I=I+Math.imul(fe,$)|0,F=F+Math.imul(fe,H)|0,M=M+Math.imul(Z,C)|0,I=I+Math.imul(Z,Y)|0,I=I+Math.imul(te,C)|0,F=F+Math.imul(te,Y)|0,M=M+Math.imul(X,oe)|0,I=I+Math.imul(X,pe)|0,I=I+Math.imul(Q,oe)|0,F=F+Math.imul(Q,pe)|0,M=M+Math.imul(O,Re)|0,I=I+Math.imul(O,De)|0,I=I+Math.imul(se,Re)|0,F=F+Math.imul(se,De)|0;var dt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(dt>>>26)|0,dt&=67108863,M=Math.imul(rt,Jt),I=Math.imul(rt,St),I=I+Math.imul(Je,Jt)|0,F=Math.imul(Je,St),M=M+Math.imul(ct,Xt)|0,I=I+Math.imul(ct,Ot)|0,I=I+Math.imul(Be,Xt)|0,F=F+Math.imul(Be,Ot)|0,M=M+Math.imul(He,Tt)|0,I=I+Math.imul(He,vt)|0,I=I+Math.imul(Ee,Tt)|0,F=F+Math.imul(Ee,vt)|0,M=M+Math.imul(Ve,Lt)|0,I=I+Math.imul(Ve,bt)|0,I=I+Math.imul(ke,Lt)|0,F=F+Math.imul(ke,bt)|0,M=M+Math.imul($e,jt)|0,I=I+Math.imul($e,nt)|0,I=I+Math.imul(Ie,jt)|0,F=F+Math.imul(Ie,nt)|0,M=M+Math.imul(Me,$)|0,I=I+Math.imul(Me,H)|0,I=I+Math.imul(Ne,$)|0,F=F+Math.imul(Ne,H)|0,M=M+Math.imul(ie,C)|0,I=I+Math.imul(ie,Y)|0,I=I+Math.imul(fe,C)|0,F=F+Math.imul(fe,Y)|0,M=M+Math.imul(Z,oe)|0,I=I+Math.imul(Z,pe)|0,I=I+Math.imul(te,oe)|0,F=F+Math.imul(te,pe)|0,M=M+Math.imul(X,Re)|0,I=I+Math.imul(X,De)|0,I=I+Math.imul(Q,Re)|0,F=F+Math.imul(Q,De)|0;var _t=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(_t>>>26)|0,_t&=67108863,M=Math.imul(rt,Xt),I=Math.imul(rt,Ot),I=I+Math.imul(Je,Xt)|0,F=Math.imul(Je,Ot),M=M+Math.imul(ct,Tt)|0,I=I+Math.imul(ct,vt)|0,I=I+Math.imul(Be,Tt)|0,F=F+Math.imul(Be,vt)|0,M=M+Math.imul(He,Lt)|0,I=I+Math.imul(He,bt)|0,I=I+Math.imul(Ee,Lt)|0,F=F+Math.imul(Ee,bt)|0,M=M+Math.imul(Ve,jt)|0,I=I+Math.imul(Ve,nt)|0,I=I+Math.imul(ke,jt)|0,F=F+Math.imul(ke,nt)|0,M=M+Math.imul($e,$)|0,I=I+Math.imul($e,H)|0,I=I+Math.imul(Ie,$)|0,F=F+Math.imul(Ie,H)|0,M=M+Math.imul(Me,C)|0,I=I+Math.imul(Me,Y)|0,I=I+Math.imul(Ne,C)|0,F=F+Math.imul(Ne,Y)|0,M=M+Math.imul(ie,oe)|0,I=I+Math.imul(ie,pe)|0,I=I+Math.imul(fe,oe)|0,F=F+Math.imul(fe,pe)|0,M=M+Math.imul(Z,Re)|0,I=I+Math.imul(Z,De)|0,I=I+Math.imul(te,Re)|0,F=F+Math.imul(te,De)|0;var ot=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(ot>>>26)|0,ot&=67108863,M=Math.imul(rt,Tt),I=Math.imul(rt,vt),I=I+Math.imul(Je,Tt)|0,F=Math.imul(Je,vt),M=M+Math.imul(ct,Lt)|0,I=I+Math.imul(ct,bt)|0,I=I+Math.imul(Be,Lt)|0,F=F+Math.imul(Be,bt)|0,M=M+Math.imul(He,jt)|0,I=I+Math.imul(He,nt)|0,I=I+Math.imul(Ee,jt)|0,F=F+Math.imul(Ee,nt)|0,M=M+Math.imul(Ve,$)|0,I=I+Math.imul(Ve,H)|0,I=I+Math.imul(ke,$)|0,F=F+Math.imul(ke,H)|0,M=M+Math.imul($e,C)|0,I=I+Math.imul($e,Y)|0,I=I+Math.imul(Ie,C)|0,F=F+Math.imul(Ie,Y)|0,M=M+Math.imul(Me,oe)|0,I=I+Math.imul(Me,pe)|0,I=I+Math.imul(Ne,oe)|0,F=F+Math.imul(Ne,pe)|0,M=M+Math.imul(ie,Re)|0,I=I+Math.imul(ie,De)|0,I=I+Math.imul(fe,Re)|0,F=F+Math.imul(fe,De)|0;var wt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(wt>>>26)|0,wt&=67108863,M=Math.imul(rt,Lt),I=Math.imul(rt,bt),I=I+Math.imul(Je,Lt)|0,F=Math.imul(Je,bt),M=M+Math.imul(ct,jt)|0,I=I+Math.imul(ct,nt)|0,I=I+Math.imul(Be,jt)|0,F=F+Math.imul(Be,nt)|0,M=M+Math.imul(He,$)|0,I=I+Math.imul(He,H)|0,I=I+Math.imul(Ee,$)|0,F=F+Math.imul(Ee,H)|0,M=M+Math.imul(Ve,C)|0,I=I+Math.imul(Ve,Y)|0,I=I+Math.imul(ke,C)|0,F=F+Math.imul(ke,Y)|0,M=M+Math.imul($e,oe)|0,I=I+Math.imul($e,pe)|0,I=I+Math.imul(Ie,oe)|0,F=F+Math.imul(Ie,pe)|0,M=M+Math.imul(Me,Re)|0,I=I+Math.imul(Me,De)|0,I=I+Math.imul(Ne,Re)|0,F=F+Math.imul(Ne,De)|0;var lt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(lt>>>26)|0,lt&=67108863,M=Math.imul(rt,jt),I=Math.imul(rt,nt),I=I+Math.imul(Je,jt)|0,F=Math.imul(Je,nt),M=M+Math.imul(ct,$)|0,I=I+Math.imul(ct,H)|0,I=I+Math.imul(Be,$)|0,F=F+Math.imul(Be,H)|0,M=M+Math.imul(He,C)|0,I=I+Math.imul(He,Y)|0,I=I+Math.imul(Ee,C)|0,F=F+Math.imul(Ee,Y)|0,M=M+Math.imul(Ve,oe)|0,I=I+Math.imul(Ve,pe)|0,I=I+Math.imul(ke,oe)|0,F=F+Math.imul(ke,pe)|0,M=M+Math.imul($e,Re)|0,I=I+Math.imul($e,De)|0,I=I+Math.imul(Ie,Re)|0,F=F+Math.imul(Ie,De)|0;var at=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(at>>>26)|0,at&=67108863,M=Math.imul(rt,$),I=Math.imul(rt,H),I=I+Math.imul(Je,$)|0,F=Math.imul(Je,H),M=M+Math.imul(ct,C)|0,I=I+Math.imul(ct,Y)|0,I=I+Math.imul(Be,C)|0,F=F+Math.imul(Be,Y)|0,M=M+Math.imul(He,oe)|0,I=I+Math.imul(He,pe)|0,I=I+Math.imul(Ee,oe)|0,F=F+Math.imul(Ee,pe)|0,M=M+Math.imul(Ve,Re)|0,I=I+Math.imul(Ve,De)|0,I=I+Math.imul(ke,Re)|0,F=F+Math.imul(ke,De)|0;var Ae=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,M=Math.imul(rt,C),I=Math.imul(rt,Y),I=I+Math.imul(Je,C)|0,F=Math.imul(Je,Y),M=M+Math.imul(ct,oe)|0,I=I+Math.imul(ct,pe)|0,I=I+Math.imul(Be,oe)|0,F=F+Math.imul(Be,pe)|0,M=M+Math.imul(He,Re)|0,I=I+Math.imul(He,De)|0,I=I+Math.imul(Ee,Re)|0,F=F+Math.imul(Ee,De)|0;var Pe=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,M=Math.imul(rt,oe),I=Math.imul(rt,pe),I=I+Math.imul(Je,oe)|0,F=Math.imul(Je,pe),M=M+Math.imul(ct,Re)|0,I=I+Math.imul(ct,De)|0,I=I+Math.imul(Be,Re)|0,F=F+Math.imul(Be,De)|0;var Ge=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,M=Math.imul(rt,Re),I=Math.imul(rt,De),I=I+Math.imul(Je,Re)|0,F=Math.imul(Je,De);var je=(b+M|0)+((I&8191)<<13)|0;return b=(F+(I>>>13)|0)+(je>>>26)|0,je&=67108863,S[0]=it,S[1]=Ue,S[2]=gt,S[3]=st,S[4]=tt,S[5]=At,S[6]=Rt,S[7]=Mt,S[8]=Et,S[9]=dt,S[10]=_t,S[11]=ot,S[12]=wt,S[13]=lt,S[14]=at,S[15]=Ae,S[16]=Pe,S[17]=Ge,S[18]=je,b!==0&&(S[19]=b,v.length++),v};Math.imul||(B=k);function j(m,f,g){g.negative=f.negative^m.negative,g.length=m.length+f.length;for(var v=0,x=0,_=0;_>>26)|0,x+=S>>>26,S&=67108863}g.words[_]=b,v=S,S=x}return v!==0?g.words[_]=v:g.length--,g._strip()}function U(m,f,g){return j(m,f,g)}s.prototype.mulTo=function(f,g){var v,x=this.length+f.length;return this.length===10&&f.length===10?v=B(this,f,g):x<63?v=k(this,f,g):x<1024?v=j(this,f,g):v=U(this,f,g),v},s.prototype.mul=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),this.mulTo(f,g)},s.prototype.mulf=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),U(this,f,g)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var g=f<0;g&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var v=0,x=0;x>=26,v+=_/67108864|0,v+=S>>>26,this.words[x]=S&67108863}return v!==0&&(this.words[x]=v,this.length++),g?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var g=D(f);if(g.length===0)return new s(1);for(var v=this,x=0;x=0);var g=f%26,v=(f-g)/26,x=67108863>>>26-g<<26-g,_;if(g!==0){var S=0;for(_=0;_>>26-g}S&&(this.words[_]=S,this.length++)}if(v!==0){for(_=this.length-1;_>=0;_--)this.words[_+v]=this.words[_];for(_=0;_=0);var x;g?x=(g-g%26)/26:x=0;var _=f%26,S=Math.min((f-_)/26,this.length),b=67108863^67108863>>>_<<_,M=v;if(x-=S,x=Math.max(0,x),M){for(var I=0;IS)for(this.length-=S,I=0;I=0&&(F!==0||I>=x);I--){var ae=this.words[I]|0;this.words[I]=F<<26-_|ae>>>_,F=ae&b}return M&&F!==0&&(M.words[M.length++]=F),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,g,v){return n(this.negative===0),this.iushrn(f,g,v)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var g=f%26,v=(f-g)/26,x=1<=0);var g=f%26,v=(f-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(g!==0&&v++,this.length=Math.min(v,this.length),g!==0){var x=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(M/67108864|0),this.words[_+v]=S&67108863}for(;_>26,this.words[_+v]=S&67108863;if(b===0)return this._strip();for(n(b===-1),b=0,_=0;_>26,this.words[_]=S&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,g){var v=this.length-f.length,x=this.clone(),_=f,S=_.words[_.length-1]|0,b=this._countBits(S);v=26-b,v!==0&&(_=_.ushln(v),x.iushln(v),S=_.words[_.length-1]|0);var M=x.length-_.length,I;if(g!=="mod"){I=new s(null),I.length=M+1,I.words=new Array(I.length);for(var F=0;F=0;O--){var se=(x.words[_.length+O]|0)*67108864+(x.words[_.length+O-1]|0);for(se=Math.min(se/S|0,67108863),x._ishlnsubmul(_,se,O);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(_,1,O),x.isZero()||(x.negative^=1);I&&(I.words[O]=se)}return I&&I._strip(),x._strip(),g!=="div"&&v!==0&&x.iushrn(v),{div:I||null,mod:x}},s.prototype.divmod=function(f,g,v){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,_,S;return this.negative!==0&&f.negative===0?(S=this.neg().divmod(f,g),g!=="mod"&&(x=S.div.neg()),g!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.iadd(f)),{div:x,mod:_}):this.negative===0&&f.negative!==0?(S=this.divmod(f.neg(),g),g!=="mod"&&(x=S.div.neg()),{div:x,mod:S.mod}):this.negative&f.negative?(S=this.neg().divmod(f.neg(),g),g!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.isub(f)),{div:S.div,mod:_}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?g==="div"?{div:this.divn(f.words[0]),mod:null}:g==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,g)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var g=this.divmod(f);if(g.mod.isZero())return g.div;var v=g.div.negative!==0?g.mod.isub(f):g.mod,x=f.ushrn(1),_=f.andln(1),S=v.cmp(x);return S<0||_===1&&S===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},s.prototype.modrn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=(1<<26)%f,x=0,_=this.length-1;_>=0;_--)x=(v*x+(this.words[_]|0))%f;return g?-x:x},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=0,x=this.length-1;x>=0;x--){var _=(this.words[x]|0)+v*67108864;this.words[x]=_/f|0,v=_%f}return this._strip(),g?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),_=new s(0),S=new s(0),b=new s(1),M=0;g.isEven()&&v.isEven();)g.iushrn(1),v.iushrn(1),++M;for(var I=v.clone(),F=g.clone();!g.isZero();){for(var ae=0,O=1;!(g.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(g.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(I),_.isub(F)),x.iushrn(1),_.iushrn(1);for(var se=0,ee=1;!(v.words[0]&ee)&&se<26;++se,ee<<=1);if(se>0)for(v.iushrn(se);se-- >0;)(S.isOdd()||b.isOdd())&&(S.iadd(I),b.isub(F)),S.iushrn(1),b.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(S),_.isub(b)):(v.isub(g),S.isub(x),b.isub(_))}return{a:S,b,gcd:v.iushln(M)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),_=new s(0),S=v.clone();g.cmpn(1)>0&&v.cmpn(1)>0;){for(var b=0,M=1;!(g.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(g.iushrn(b);b-- >0;)x.isOdd()&&x.iadd(S),x.iushrn(1);for(var I=0,F=1;!(v.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(v.iushrn(I);I-- >0;)_.isOdd()&&_.iadd(S),_.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(_)):(v.isub(g),_.isub(x))}var ae;return g.cmpn(1)===0?ae=x:ae=_,ae.cmpn(0)<0&&ae.iadd(f),ae},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var g=this.clone(),v=f.clone();g.negative=0,v.negative=0;for(var x=0;g.isEven()&&v.isEven();x++)g.iushrn(1),v.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;v.isEven();)v.iushrn(1);var _=g.cmp(v);if(_<0){var S=g;g=v,v=S}else if(_===0||v.cmpn(1)===0)break;g.isub(v)}while(!0);return v.iushln(x)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var g=f%26,v=(f-g)/26,x=1<>>26,b&=67108863,this.words[S]=b}return _!==0&&(this.words[S]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var g=f<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var v;if(this.length>1)v=1;else{g&&(f=-f),n(f<=67108863,"Number is too big");var x=this.words[0]|0;v=x===f?0:xf.length)return 1;if(this.length=0;v--){var x=this.words[v]|0,_=f.words[v]|0;if(x!==_){x<_?g=-1:x>_&&(g=1);break}}return g},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new G(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var K={k256:null,p224:null,p192:null,p25519:null};function J(m,f){this.name=m,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}J.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},J.prototype.ireduce=function(f){var g=f,v;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),v=g.bitLength();while(v>this.n);var x=v0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},J.prototype.split=function(f,g){f.iushrn(this.n,0,g)},J.prototype.imulK=function(f){return f.imul(this.k)};function T(){J.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(T,J),T.prototype.split=function(f,g){for(var v=4194303,x=Math.min(f.length,9),_=0;_>>22,S=b}S>>>=22,f.words[_-10]=S,S===0&&f.length>10?f.length-=10:f.length-=9},T.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var g=0,v=0;v>>=26,f.words[v]=_,g=x}return g!==0&&(f.words[f.length++]=g),f},s._prime=function(f){if(K[f])return K[f];var g;if(f==="k256")g=new T;else if(f==="p224")g=new z;else if(f==="p192")g=new ue;else if(f==="p25519")g=new _e;else throw new Error("Unknown prime "+f);return K[f]=g,g};function G(m){if(typeof m=="string"){var f=s._prime(m);this.m=f.p,this.prime=f}else n(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}G.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},G.prototype._verify2=function(f,g){n((f.negative|g.negative)===0,"red works only with positives"),n(f.red&&f.red===g.red,"red works only with red numbers")},G.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(d(f,f.umod(this.m)._forceRed(this)),f)},G.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},G.prototype.add=function(f,g){this._verify2(f,g);var v=f.add(g);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},G.prototype.iadd=function(f,g){this._verify2(f,g);var v=f.iadd(g);return v.cmp(this.m)>=0&&v.isub(this.m),v},G.prototype.sub=function(f,g){this._verify2(f,g);var v=f.sub(g);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},G.prototype.isub=function(f,g){this._verify2(f,g);var v=f.isub(g);return v.cmpn(0)<0&&v.iadd(this.m),v},G.prototype.shl=function(f,g){return this._verify1(f),this.imod(f.ushln(g))},G.prototype.imul=function(f,g){return this._verify2(f,g),this.imod(f.imul(g))},G.prototype.mul=function(f,g){return this._verify2(f,g),this.imod(f.mul(g))},G.prototype.isqr=function(f){return this.imul(f,f.clone())},G.prototype.sqr=function(f){return this.mul(f,f)},G.prototype.sqrt=function(f){if(f.isZero())return f.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(f,v)}for(var x=this.m.subn(1),_=0;!x.isZero()&&x.andln(1)===0;)_++,x.iushrn(1);n(!x.isZero());var S=new s(1).toRed(this),b=S.redNeg(),M=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,M).cmp(b)!==0;)I.redIAdd(b);for(var F=this.pow(I,x),ae=this.pow(f,x.addn(1).iushrn(1)),O=this.pow(f,x),se=_;O.cmp(S)!==0;){for(var ee=O,X=0;ee.cmp(S)!==0;X++)ee=ee.redSqr();n(X=0;_--){for(var F=g.words[_],ae=I-1;ae>=0;ae--){var O=F>>ae&1;if(S!==x[0]&&(S=this.sqr(S)),O===0&&b===0){M=0;continue}b<<=1,b|=O,M++,!(M!==v&&(_!==0||ae!==0))&&(S=this.mul(S,x[b]),M=0,b=0)}I=26}return S},G.prototype.convertTo=function(f){var g=f.umod(this.m);return g===f?g.clone():g},G.prototype.convertFrom=function(f){var g=f.clone();return g.red=null,g},s.mont=function(f){return new E(f)};function E(m){G.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(E,G),E.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},E.prototype.convertFrom=function(f){var g=this.imod(f.mul(this.rinv));return g.red=null,g},E.prototype.imul=function(f,g){if(f.isZero()||g.isZero())return f.words[0]=0,f.length=1,f;var v=f.imul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.mul=function(f,g){if(f.isZero()||g.isZero())return new s(0)._forceRed(this);var v=f.mul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.invm=function(f){var g=this.imod(f._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,nn)}(Sm);var _N=Sm.exports;const rr=ji(_N);var EN=rr.BN;function SN(t){return new EN(t,36).toString(16)}const AN="strings/5.7.0",PN=new Kr(AN);var bd;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(bd||(bd={}));var jx;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(jx||(jx={}));function Am(t,e=bd.current){e!=bd.current&&(PN.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return bn(r)}const MN=`Ethereum Signed Message: -`;function Ux(t){return typeof t=="string"&&(t=Am(t)),Em(yN([Am(MN),Am(String(t.length)),t]))}const IN="address/5.7.0",sl=new Kr(IN);function qx(t){Ns(t,20)||sl.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=bn(Em(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const CN=9007199254740991;function TN(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const Pm={};for(let t=0;t<10;t++)Pm[String(t)]=String(t);for(let t=0;t<26;t++)Pm[String.fromCharCode(65+t)]=String(10+t);const zx=Math.floor(TN(CN));function RN(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Pm[n]).join("");for(;e.length>=zx;){let n=e.substring(0,zx);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function DN(t){let e=null;if(typeof t!="string"&&sl.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=qx(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&sl.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==RN(t)&&sl.throwArgumentError("bad icap checksum","address",t),e=SN(t.substring(4));e.length<40;)e="0"+e;e=qx("0x"+e)}else sl.throwArgumentError("invalid address","address",t);return e}function ol(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var al={},yr={},Ga=Hx;function Hx(t,e){if(!t)throw new Error(e||"Assertion failed")}Hx.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var Mm={exports:{}};typeof Object.create=="function"?Mm.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Mm.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var yd=Mm.exports,ON=Ga,NN=yd;yr.inherits=NN;function LN(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function kN(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):LN(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}yr.htonl=Wx;function $N(t,e){for(var r="",n=0;n>>0}return s}yr.join32=FN;function jN(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}yr.split32=jN;function UN(t,e){return t>>>e|t<<32-e}yr.rotr32=UN;function qN(t,e){return t<>>32-e}yr.rotl32=qN;function zN(t,e){return t+e>>>0}yr.sum32=zN;function HN(t,e,r){return t+e+r>>>0}yr.sum32_3=HN;function WN(t,e,r,n){return t+e+r+n>>>0}yr.sum32_4=WN;function KN(t,e,r,n,i){return t+e+r+n+i>>>0}yr.sum32_5=KN;function VN(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}yr.sum64=VN;function GN(t,e,r,n){var i=e+n>>>0,s=(i>>0}yr.sum64_hi=GN;function YN(t,e,r,n){var i=e+n;return i>>>0}yr.sum64_lo=YN;function JN(t,e,r,n,i,s,o,a){var u=0,l=e;l=l+n>>>0,u+=l>>0,u+=l>>0,u+=l>>0}yr.sum64_4_hi=JN;function XN(t,e,r,n,i,s,o,a){var u=e+n+s+a;return u>>>0}yr.sum64_4_lo=XN;function ZN(t,e,r,n,i,s,o,a,u,l){var d=0,p=e;p=p+n>>>0,d+=p>>0,d+=p>>0,d+=p>>0,d+=p>>0}yr.sum64_5_hi=ZN;function QN(t,e,r,n,i,s,o,a,u,l){var d=e+n+s+a+l;return d>>>0}yr.sum64_5_lo=QN;function eL(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}yr.rotr64_hi=eL;function tL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.rotr64_lo=tL;function rL(t,e,r){return t>>>r}yr.shr64_hi=rL;function nL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.shr64_lo=nL;var lu={},Gx=yr,iL=Ga;function wd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}lu.BlockHash=wd,wd.prototype.update=function(e,r){if(e=Gx.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Gx.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}Ls.g0_256=uL;function fL(t){return ks(t,17)^ks(t,19)^t>>>10}Ls.g1_256=fL;var du=yr,lL=lu,hL=Ls,Im=du.rotl32,cl=du.sum32,dL=du.sum32_5,pL=hL.ft_1,Zx=lL.BlockHash,gL=[1518500249,1859775393,2400959708,3395469782];function Bs(){if(!(this instanceof Bs))return new Bs;Zx.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}du.inherits(Bs,Zx);var mL=Bs;Bs.blockSize=512,Bs.outSize=160,Bs.hmacStrength=80,Bs.padLength=64,Bs.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),nk(e.length<=this.blockSize);for(var r=e.length;r>8,y=d&255;p?u.push(p,y):u.push(y)}return u}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",u=0;u(y>>1)-1?N=(y>>1)-D:N=D,A.isubn(N)):N=0,p[P]=N,A.iushrn(1)}return p}r.getNAF=n;function i(u,l){var d=[[],[]];u=u.clone(),l=l.clone();for(var p=0,y=0,A;u.cmpn(-p)>0||l.cmpn(-y)>0;){var P=u.andln(3)+p&3,N=l.andln(3)+y&3;P===3&&(P=-1),N===3&&(N=-1);var D;P&1?(A=u.andln(7)+p&7,(A===3||A===5)&&N===2?D=-P:D=P):D=0,d[0].push(D);var k;N&1?(A=l.andln(7)+y&7,(A===3||A===5)&&P===2?k=-N:k=N):k=0,d[1].push(k),2*p===D+1&&(p=1-p),2*y===k+1&&(y=1-y),u.iushrn(1),l.iushrn(1)}return d}r.getJSF=i;function s(u,l,d){var p="_"+l;u.prototype[l]=function(){return this[p]!==void 0?this[p]:this[p]=d.call(this)}}r.cachedProperty=s;function o(u){return typeof u=="string"?r.toArray(u,"hex"):u}r.parseBytes=o;function a(u){return new rr(u,"hex","le")}r.intFromLE=a}),_d=Ci.getNAF,ok=Ci.getJSF,Ed=Ci.assert;function na(t,e){this.type=t,this.p=new rr(e.p,16),this.red=e.prime?rr.red(e.prime):rr.mont(this.p),this.zero=new rr(0).toRed(this.red),this.one=new rr(1).toRed(this.red),this.two=new rr(2).toRed(this.red),this.n=e.n&&new rr(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ja=na;na.prototype.point=function(){throw new Error("Not implemented")},na.prototype.validate=function(){throw new Error("Not implemented")},na.prototype._fixedNafMul=function(e,r){Ed(e.precomputed);var n=e._getDoubles(),i=_d(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Ed(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},na.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=_d(n[P],o[P],this._bitLength),u[N]=_d(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=ok(n[P],n[N]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[N]=new Array(l),p=0;p=0;d--){for(var T=0;d>=0;){var z=!0;for(p=0;p=0&&T++,K=K.dblp(T),d<0)break;for(p=0;p0?y=a[p][ue-1>>1]:ue<0&&(y=a[p][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},zi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),p.negative&&(p=p.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:p,b:y},{a:A,b:P}]},Hi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Hi.prototype.pointFromX=function(e,r){e=new rr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Hi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Hi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Dn.prototype.isInfinity=function(){return this.inf},Dn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Dn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Dn.prototype.getX=function(){return this.x.fromRed()},Dn.prototype.getY=function(){return this.y.fromRed()},Dn.prototype.mul=function(e){return e=new rr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Dn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Dn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Dn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Dn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Dn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Un(t,e,r,n){Ja.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new rr(0)):(this.x=new rr(e,16),this.y=new rr(r,16),this.z=new rr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Nm(Un,Ja.BasePoint),Hi.prototype.jpoint=function(e,r,n){return new Un(this,e,r,n)},Un.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},Un.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Un.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(p).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(p)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},Un.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),A=u.redMul(p.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},Un.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},Un.prototype.inspect=function(){return this.isInfinity()?"":""},Un.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Sd=vu(function(t,e){var r=e;r.base=Ja,r.short=ck,r.mont=null,r.edwards=null}),Ad=vu(function(t,e){var r=e,n=Ci.assert;function i(a){a.type==="short"?this.curve=new Sd.short(a):a.type==="edwards"?this.curve=new Sd.edwards(a):this.curve=new Sd.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,u){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(u);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:wo.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:wo.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:wo.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:wo.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:wo.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:wo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function ia(t){if(!(this instanceof ia))return new ia(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=vs.toArray(t.entropy,t.entropyEnc||"hex"),r=vs.toArray(t.nonce,t.nonceEnc||"hex"),n=vs.toArray(t.pers,t.persEnc||"hex");Om(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var d3=ia;ia.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ia.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=vs.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var uk=Ci.assert;function Pd(t,e){if(t instanceof Pd)return t;this._importDER(t,e)||(uk(t.r&&t.s,"Signature without r or s"),this.r=new rr(t.r,16),this.s=new rr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Md=Pd;function fk(){this.place=0}function Bm(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function p3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Pd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=p3(r),n=p3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];$m(i,r.length),i=i.concat(r),i.push(2),$m(i,n.length);var s=i.concat(n),o=[48];return $m(o,s.length),o=o.concat(s),Ci.encode(o,e)};var lk=function(){throw new Error("unsupported")},g3=Ci.assert;function Wi(t){if(!(this instanceof Wi))return new Wi(t);typeof t=="string"&&(g3(Object.prototype.hasOwnProperty.call(Ad,t),"Unknown curve "+t),t=Ad[t]),t instanceof Ad.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var hk=Wi;Wi.prototype.keyPair=function(e){return new km(this,e)},Wi.prototype.keyFromPrivate=function(e,r){return km.fromPrivate(this,e,r)},Wi.prototype.keyFromPublic=function(e,r){return km.fromPublic(this,e,r)},Wi.prototype.genKeyPair=function(e){e||(e={});for(var r=new d3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||lk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new rr(2));;){var s=new rr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Wi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Wi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new rr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new d3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new rr(1)),d=0;;d++){var p=i.k?i.k(d):new rr(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new Md({r:P,s:N,recoveryParam:D})}}}}}},Wi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new rr(e,16)),n=this.keyFromPublic(n,i),r=new Md(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),u=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.eqXToP(s)):(d=this.g.mulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.getX().umod(this.n).cmp(s)===0)},Wi.prototype.recoverPubKey=function(t,e,r,n){g3((3&r)===r,"The recovery param is more than two bits"),e=new Md(e,n);var i=this.n,s=new rr(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Wi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Md(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dk=vu(function(t,e){var r=e;r.version="6.5.4",r.utils=Ci,r.rand=function(){throw new Error("unsupported")},r.curve=Sd,r.curves=Ad,r.ec=hk,r.eddsa=null}),pk=dk.ec;const gk="signing-key/5.7.0",Fm=new Kr(gk);let jm=null;function sa(){return jm||(jm=new pk("secp256k1")),jm}class mk{constructor(e){ol(this,"curve","secp256k1"),ol(this,"privateKey",Ii(e)),xN(this.privateKey)!==32&&Fm.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=sa().keyFromPrivate(bn(this.privateKey));ol(this,"publicKey","0x"+r.getPublic(!1,"hex")),ol(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ol(this,"_isSigningKey",!0)}_addPoint(e){const r=sa().keyFromPublic(bn(this.publicKey)),n=sa().keyFromPublic(bn(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=sa().keyFromPrivate(bn(this.privateKey)),n=bn(e);n.length!==32&&Fm.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Fx({recoveryParam:i.recoveryParam,r:fu("0x"+i.r.toString(16),32),s:fu("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=sa().keyFromPrivate(bn(this.privateKey)),n=sa().keyFromPublic(bn(m3(e)));return fu("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function vk(t,e){const r=Fx(e),n={r:bn(r.r),s:bn(r.s)};return"0x"+sa().recoverPubKey(bn(t),n,r.recoveryParam).encode("hex",!1)}function m3(t,e){const r=bn(t);return r.length===32?new mk(r).publicKey:r.length===33?"0x"+sa().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?Ii(r):Fm.throwArgumentError("invalid public or private key","key","[REDACTED]")}var v3;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(v3||(v3={}));function bk(t){const e=m3(t);return DN($x(Em($x(e,1)),12))}function yk(t,e){return bk(vk(bn(t),e))}var Um={},Id={};Object.defineProperty(Id,"__esModule",{value:!0});var Yn=or,qm=Mi,wk=20;function xk(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],p=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],P=r[31]<<24|r[30]<<16|r[29]<<8|r[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],k=e[11]<<24|e[10]<<16|e[9]<<8|e[8],B=e[15]<<24|e[14]<<16|e[13]<<8|e[12],j=n,U=i,K=s,J=o,T=a,z=u,ue=l,_e=d,G=p,E=y,m=A,f=P,g=N,v=D,x=k,_=B,S=0;S>>16|g<<16,G=G+g|0,T^=G,T=T>>>20|T<<12,U=U+z|0,v^=U,v=v>>>16|v<<16,E=E+v|0,z^=E,z=z>>>20|z<<12,K=K+ue|0,x^=K,x=x>>>16|x<<16,m=m+x|0,ue^=m,ue=ue>>>20|ue<<12,J=J+_e|0,_^=J,_=_>>>16|_<<16,f=f+_|0,_e^=f,_e=_e>>>20|_e<<12,K=K+ue|0,x^=K,x=x>>>24|x<<8,m=m+x|0,ue^=m,ue=ue>>>25|ue<<7,J=J+_e|0,_^=J,_=_>>>24|_<<8,f=f+_|0,_e^=f,_e=_e>>>25|_e<<7,U=U+z|0,v^=U,v=v>>>24|v<<8,E=E+v|0,z^=E,z=z>>>25|z<<7,j=j+T|0,g^=j,g=g>>>24|g<<8,G=G+g|0,T^=G,T=T>>>25|T<<7,j=j+z|0,_^=j,_=_>>>16|_<<16,m=m+_|0,z^=m,z=z>>>20|z<<12,U=U+ue|0,g^=U,g=g>>>16|g<<16,f=f+g|0,ue^=f,ue=ue>>>20|ue<<12,K=K+_e|0,v^=K,v=v>>>16|v<<16,G=G+v|0,_e^=G,_e=_e>>>20|_e<<12,J=J+T|0,x^=J,x=x>>>16|x<<16,E=E+x|0,T^=E,T=T>>>20|T<<12,K=K+_e|0,v^=K,v=v>>>24|v<<8,G=G+v|0,_e^=G,_e=_e>>>25|_e<<7,J=J+T|0,x^=J,x=x>>>24|x<<8,E=E+x|0,T^=E,T=T>>>25|T<<7,U=U+ue|0,g^=U,g=g>>>24|g<<8,f=f+g|0,ue^=f,ue=ue>>>25|ue<<7,j=j+z|0,_^=j,_=_>>>24|_<<8,m=m+_|0,z^=m,z=z>>>25|z<<7;Yn.writeUint32LE(j+n|0,t,0),Yn.writeUint32LE(U+i|0,t,4),Yn.writeUint32LE(K+s|0,t,8),Yn.writeUint32LE(J+o|0,t,12),Yn.writeUint32LE(T+a|0,t,16),Yn.writeUint32LE(z+u|0,t,20),Yn.writeUint32LE(ue+l|0,t,24),Yn.writeUint32LE(_e+d|0,t,28),Yn.writeUint32LE(G+p|0,t,32),Yn.writeUint32LE(E+y|0,t,36),Yn.writeUint32LE(m+A|0,t,40),Yn.writeUint32LE(f+P|0,t,44),Yn.writeUint32LE(g+N|0,t,48),Yn.writeUint32LE(v+D|0,t,52),Yn.writeUint32LE(x+k|0,t,56),Yn.writeUint32LE(_+B|0,t,60)}function b3(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var y3={},oa={};Object.defineProperty(oa,"__esModule",{value:!0});function Sk(t,e,r){return~(t-1)&e|t-1&r}oa.select=Sk;function Ak(t,e){return(t|0)-(e|0)-1>>>31&1}oa.lessOrEqual=Ak;function w3(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}oa.compare=w3;function Pk(t,e){return t.length===0||e.length===0?!1:w3(t,e)!==0}oa.equal=Pk,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=oa,r=Mi;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var u=a[0]|a[1]<<8;this._r[0]=u&8191;var l=a[2]|a[3]<<8;this._r[1]=(u>>>13|l<<3)&8191;var d=a[4]|a[5]<<8;this._r[2]=(l>>>10|d<<6)&7939;var p=a[6]|a[7]<<8;this._r[3]=(d>>>7|p<<9)&8191;var y=a[8]|a[9]<<8;this._r[4]=(p>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var A=a[10]|a[11]<<8;this._r[6]=(y>>>14|A<<2)&8191;var P=a[12]|a[13]<<8;this._r[7]=(A>>>11|P<<5)&8065;var N=a[14]|a[15]<<8;this._r[8]=(P>>>8|N<<8)&8191,this._r[9]=N>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,u,l){for(var d=this._fin?0:2048,p=this._h[0],y=this._h[1],A=this._h[2],P=this._h[3],N=this._h[4],D=this._h[5],k=this._h[6],B=this._h[7],j=this._h[8],U=this._h[9],K=this._r[0],J=this._r[1],T=this._r[2],z=this._r[3],ue=this._r[4],_e=this._r[5],G=this._r[6],E=this._r[7],m=this._r[8],f=this._r[9];l>=16;){var g=a[u+0]|a[u+1]<<8;p+=g&8191;var v=a[u+2]|a[u+3]<<8;y+=(g>>>13|v<<3)&8191;var x=a[u+4]|a[u+5]<<8;A+=(v>>>10|x<<6)&8191;var _=a[u+6]|a[u+7]<<8;P+=(x>>>7|_<<9)&8191;var S=a[u+8]|a[u+9]<<8;N+=(_>>>4|S<<12)&8191,D+=S>>>1&8191;var b=a[u+10]|a[u+11]<<8;k+=(S>>>14|b<<2)&8191;var M=a[u+12]|a[u+13]<<8;B+=(b>>>11|M<<5)&8191;var I=a[u+14]|a[u+15]<<8;j+=(M>>>8|I<<8)&8191,U+=I>>>5|d;var F=0,ae=F;ae+=p*K,ae+=y*(5*f),ae+=A*(5*m),ae+=P*(5*E),ae+=N*(5*G),F=ae>>>13,ae&=8191,ae+=D*(5*_e),ae+=k*(5*ue),ae+=B*(5*z),ae+=j*(5*T),ae+=U*(5*J),F+=ae>>>13,ae&=8191;var O=F;O+=p*J,O+=y*K,O+=A*(5*f),O+=P*(5*m),O+=N*(5*E),F=O>>>13,O&=8191,O+=D*(5*G),O+=k*(5*_e),O+=B*(5*ue),O+=j*(5*z),O+=U*(5*T),F+=O>>>13,O&=8191;var se=F;se+=p*T,se+=y*J,se+=A*K,se+=P*(5*f),se+=N*(5*m),F=se>>>13,se&=8191,se+=D*(5*E),se+=k*(5*G),se+=B*(5*_e),se+=j*(5*ue),se+=U*(5*z),F+=se>>>13,se&=8191;var ee=F;ee+=p*z,ee+=y*T,ee+=A*J,ee+=P*K,ee+=N*(5*f),F=ee>>>13,ee&=8191,ee+=D*(5*m),ee+=k*(5*E),ee+=B*(5*G),ee+=j*(5*_e),ee+=U*(5*ue),F+=ee>>>13,ee&=8191;var X=F;X+=p*ue,X+=y*z,X+=A*T,X+=P*J,X+=N*K,F=X>>>13,X&=8191,X+=D*(5*f),X+=k*(5*m),X+=B*(5*E),X+=j*(5*G),X+=U*(5*_e),F+=X>>>13,X&=8191;var Q=F;Q+=p*_e,Q+=y*ue,Q+=A*z,Q+=P*T,Q+=N*J,F=Q>>>13,Q&=8191,Q+=D*K,Q+=k*(5*f),Q+=B*(5*m),Q+=j*(5*E),Q+=U*(5*G),F+=Q>>>13,Q&=8191;var R=F;R+=p*G,R+=y*_e,R+=A*ue,R+=P*z,R+=N*T,F=R>>>13,R&=8191,R+=D*J,R+=k*K,R+=B*(5*f),R+=j*(5*m),R+=U*(5*E),F+=R>>>13,R&=8191;var Z=F;Z+=p*E,Z+=y*G,Z+=A*_e,Z+=P*ue,Z+=N*z,F=Z>>>13,Z&=8191,Z+=D*T,Z+=k*J,Z+=B*K,Z+=j*(5*f),Z+=U*(5*m),F+=Z>>>13,Z&=8191;var te=F;te+=p*m,te+=y*E,te+=A*G,te+=P*_e,te+=N*ue,F=te>>>13,te&=8191,te+=D*z,te+=k*T,te+=B*J,te+=j*K,te+=U*(5*f),F+=te>>>13,te&=8191;var le=F;le+=p*f,le+=y*m,le+=A*E,le+=P*G,le+=N*_e,F=le>>>13,le&=8191,le+=D*ue,le+=k*z,le+=B*T,le+=j*J,le+=U*K,F+=le>>>13,le&=8191,F=(F<<2)+F|0,F=F+ae|0,ae=F&8191,F=F>>>13,O+=F,p=ae,y=O,A=se,P=ee,N=X,D=Q,k=R,B=Z,j=te,U=le,u+=16,l-=16}this._h[0]=p,this._h[1]=y,this._h[2]=A,this._h[3]=P,this._h[4]=N,this._h[5]=D,this._h[6]=k,this._h[7]=B,this._h[8]=j,this._h[9]=U},o.prototype.finish=function(a,u){u===void 0&&(u=0);var l=new Uint16Array(10),d,p,y,A;if(this._leftover){for(A=this._leftover,this._buffer[A++]=1;A<16;A++)this._buffer[A]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(d=this._h[1]>>>13,this._h[1]&=8191,A=2;A<10;A++)this._h[A]+=d,d=this._h[A]>>>13,this._h[A]&=8191;for(this._h[0]+=d*5,d=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=d,d=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=d,l[0]=this._h[0]+5,d=l[0]>>>13,l[0]&=8191,A=1;A<10;A++)l[A]=this._h[A]+d,d=l[A]>>>13,l[A]&=8191;for(l[9]-=8192,p=(d^1)-1,A=0;A<10;A++)l[A]&=p;for(p=~p,A=0;A<10;A++)this._h[A]=this._h[A]&p|l[A];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,y=this._h[0]+this._pad[0],this._h[0]=y&65535,A=1;A<8;A++)y=(this._h[A]+this._pad[A]|0)+(y>>>16)|0,this._h[A]=y&65535;return a[u+0]=this._h[0]>>>0,a[u+1]=this._h[0]>>>8,a[u+2]=this._h[1]>>>0,a[u+3]=this._h[1]>>>8,a[u+4]=this._h[2]>>>0,a[u+5]=this._h[2]>>>8,a[u+6]=this._h[3]>>>0,a[u+7]=this._h[3]>>>8,a[u+8]=this._h[4]>>>0,a[u+9]=this._h[4]>>>8,a[u+10]=this._h[5]>>>0,a[u+11]=this._h[5]>>>8,a[u+12]=this._h[6]>>>0,a[u+13]=this._h[6]>>>8,a[u+14]=this._h[7]>>>0,a[u+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var u=0,l=a.length,d;if(this._leftover){d=16-this._leftover,d>l&&(d=l);for(var p=0;p=16&&(d=l-l%16,this._blocks(a,u,d),u+=d,l-=d),l){for(var p=0;p16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var A=new Uint8Array(16);A.set(l,A.length-l.length);var P=new Uint8Array(32);e.stream(this._key,A,P,4);var N=d.length+this.tagLength,D;if(y){if(y.length!==N)throw new Error("ChaCha20Poly1305: incorrect destination length");D=y}else D=new Uint8Array(N);return e.streamXOR(this._key,A,d,D,4),this._authenticate(D.subarray(D.length-this.tagLength,D.length),P,D.subarray(0,D.length-this.tagLength),p),n.wipe(A),D},u.prototype.open=function(l,d,p,y){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(d.length0&&A.update(o.subarray(y.length%16))),A.update(p),p.length%16>0&&A.update(o.subarray(p.length%16));var P=new Uint8Array(8);y&&i.writeUint64LE(y.length,P),A.update(P),i.writeUint64LE(p.length,P),A.update(P);for(var N=A.digest(),D=0;Dthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._temp,this._state,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,A=l%64<56?64:128;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._state.set(u.state),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.state),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,u,l,d,p){for(;p>=64;){for(var y=u[0],A=u[1],P=u[2],N=u[3],D=u[4],k=u[5],B=u[6],j=u[7],U=0;U<16;U++){var K=d+U*4;a[U]=e.readUint32BE(l,K)}for(var U=16;U<64;U++){var J=a[U-2],T=(J>>>17|J<<15)^(J>>>19|J<<13)^J>>>10;J=a[U-15];var z=(J>>>7|J<<25)^(J>>>18|J<<14)^J>>>3;a[U]=(T+a[U-7]|0)+(z+a[U-16]|0)}for(var U=0;U<64;U++){var T=(((D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7))+(D&k^~D&B)|0)+(j+(i[U]+a[U]|0)|0)|0,z=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&A^y&P^A&P)|0;j=B,B=k,k=D,D=N+T|0,N=P,P=A,A=y,y=T+z|0}u[0]+=y,u[1]+=A,u[2]+=P,u[3]+=N,u[4]+=D,u[5]+=k,u[6]+=B,u[7]+=j,d+=64,p-=64}return d}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ll);var Hm={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=ta,r=Mi;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(U){const K=new Float64Array(16);if(U)for(let J=0;J>16&1),J[_e-1]&=65535;J[15]=T[15]-32767-(J[14]>>16&1);const ue=J[15]>>16&1;J[14]&=65535,a(T,J,1-ue)}for(let z=0;z<16;z++)U[2*z]=T[z]&255,U[2*z+1]=T[z]>>8}function l(U,K){for(let J=0;J<16;J++)U[J]=K[2*J]+(K[2*J+1]<<8);U[15]&=32767}function d(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]+J[T]}function p(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]-J[T]}function y(U,K,J){let T,z,ue=0,_e=0,G=0,E=0,m=0,f=0,g=0,v=0,x=0,_=0,S=0,b=0,M=0,I=0,F=0,ae=0,O=0,se=0,ee=0,X=0,Q=0,R=0,Z=0,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=J[0],Ie=J[1],Le=J[2],Ve=J[3],ke=J[4],ze=J[5],He=J[6],Ee=J[7],Qe=J[8],ct=J[9],Be=J[10],et=J[11],rt=J[12],Je=J[13],pt=J[14],ht=J[15];T=K[0],ue+=T*$e,_e+=T*Ie,G+=T*Le,E+=T*Ve,m+=T*ke,f+=T*ze,g+=T*He,v+=T*Ee,x+=T*Qe,_+=T*ct,S+=T*Be,b+=T*et,M+=T*rt,I+=T*Je,F+=T*pt,ae+=T*ht,T=K[1],_e+=T*$e,G+=T*Ie,E+=T*Le,m+=T*Ve,f+=T*ke,g+=T*ze,v+=T*He,x+=T*Ee,_+=T*Qe,S+=T*ct,b+=T*Be,M+=T*et,I+=T*rt,F+=T*Je,ae+=T*pt,O+=T*ht,T=K[2],G+=T*$e,E+=T*Ie,m+=T*Le,f+=T*Ve,g+=T*ke,v+=T*ze,x+=T*He,_+=T*Ee,S+=T*Qe,b+=T*ct,M+=T*Be,I+=T*et,F+=T*rt,ae+=T*Je,O+=T*pt,se+=T*ht,T=K[3],E+=T*$e,m+=T*Ie,f+=T*Le,g+=T*Ve,v+=T*ke,x+=T*ze,_+=T*He,S+=T*Ee,b+=T*Qe,M+=T*ct,I+=T*Be,F+=T*et,ae+=T*rt,O+=T*Je,se+=T*pt,ee+=T*ht,T=K[4],m+=T*$e,f+=T*Ie,g+=T*Le,v+=T*Ve,x+=T*ke,_+=T*ze,S+=T*He,b+=T*Ee,M+=T*Qe,I+=T*ct,F+=T*Be,ae+=T*et,O+=T*rt,se+=T*Je,ee+=T*pt,X+=T*ht,T=K[5],f+=T*$e,g+=T*Ie,v+=T*Le,x+=T*Ve,_+=T*ke,S+=T*ze,b+=T*He,M+=T*Ee,I+=T*Qe,F+=T*ct,ae+=T*Be,O+=T*et,se+=T*rt,ee+=T*Je,X+=T*pt,Q+=T*ht,T=K[6],g+=T*$e,v+=T*Ie,x+=T*Le,_+=T*Ve,S+=T*ke,b+=T*ze,M+=T*He,I+=T*Ee,F+=T*Qe,ae+=T*ct,O+=T*Be,se+=T*et,ee+=T*rt,X+=T*Je,Q+=T*pt,R+=T*ht,T=K[7],v+=T*$e,x+=T*Ie,_+=T*Le,S+=T*Ve,b+=T*ke,M+=T*ze,I+=T*He,F+=T*Ee,ae+=T*Qe,O+=T*ct,se+=T*Be,ee+=T*et,X+=T*rt,Q+=T*Je,R+=T*pt,Z+=T*ht,T=K[8],x+=T*$e,_+=T*Ie,S+=T*Le,b+=T*Ve,M+=T*ke,I+=T*ze,F+=T*He,ae+=T*Ee,O+=T*Qe,se+=T*ct,ee+=T*Be,X+=T*et,Q+=T*rt,R+=T*Je,Z+=T*pt,te+=T*ht,T=K[9],_+=T*$e,S+=T*Ie,b+=T*Le,M+=T*Ve,I+=T*ke,F+=T*ze,ae+=T*He,O+=T*Ee,se+=T*Qe,ee+=T*ct,X+=T*Be,Q+=T*et,R+=T*rt,Z+=T*Je,te+=T*pt,le+=T*ht,T=K[10],S+=T*$e,b+=T*Ie,M+=T*Le,I+=T*Ve,F+=T*ke,ae+=T*ze,O+=T*He,se+=T*Ee,ee+=T*Qe,X+=T*ct,Q+=T*Be,R+=T*et,Z+=T*rt,te+=T*Je,le+=T*pt,ie+=T*ht,T=K[11],b+=T*$e,M+=T*Ie,I+=T*Le,F+=T*Ve,ae+=T*ke,O+=T*ze,se+=T*He,ee+=T*Ee,X+=T*Qe,Q+=T*ct,R+=T*Be,Z+=T*et,te+=T*rt,le+=T*Je,ie+=T*pt,fe+=T*ht,T=K[12],M+=T*$e,I+=T*Ie,F+=T*Le,ae+=T*Ve,O+=T*ke,se+=T*ze,ee+=T*He,X+=T*Ee,Q+=T*Qe,R+=T*ct,Z+=T*Be,te+=T*et,le+=T*rt,ie+=T*Je,fe+=T*pt,ve+=T*ht,T=K[13],I+=T*$e,F+=T*Ie,ae+=T*Le,O+=T*Ve,se+=T*ke,ee+=T*ze,X+=T*He,Q+=T*Ee,R+=T*Qe,Z+=T*ct,te+=T*Be,le+=T*et,ie+=T*rt,fe+=T*Je,ve+=T*pt,Me+=T*ht,T=K[14],F+=T*$e,ae+=T*Ie,O+=T*Le,se+=T*Ve,ee+=T*ke,X+=T*ze,Q+=T*He,R+=T*Ee,Z+=T*Qe,te+=T*ct,le+=T*Be,ie+=T*et,fe+=T*rt,ve+=T*Je,Me+=T*pt,Ne+=T*ht,T=K[15],ae+=T*$e,O+=T*Ie,se+=T*Le,ee+=T*Ve,X+=T*ke,Q+=T*ze,R+=T*He,Z+=T*Ee,te+=T*Qe,le+=T*ct,ie+=T*Be,fe+=T*et,ve+=T*rt,Me+=T*Je,Ne+=T*pt,Te+=T*ht,ue+=38*O,_e+=38*se,G+=38*ee,E+=38*X,m+=38*Q,f+=38*R,g+=38*Z,v+=38*te,x+=38*le,_+=38*ie,S+=38*fe,b+=38*ve,M+=38*Me,I+=38*Ne,F+=38*Te,z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=g+z+65535,z=Math.floor(T/65536),g=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=g+z+65535,z=Math.floor(T/65536),g=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),U[0]=ue,U[1]=_e,U[2]=G,U[3]=E,U[4]=m,U[5]=f,U[6]=g,U[7]=v,U[8]=x,U[9]=_,U[10]=S,U[11]=b,U[12]=M,U[13]=I,U[14]=F,U[15]=ae}function A(U,K){y(U,K,K)}function P(U,K){const J=n();for(let T=0;T<16;T++)J[T]=K[T];for(let T=253;T>=0;T--)A(J,J),T!==2&&T!==4&&y(J,J,K);for(let T=0;T<16;T++)U[T]=J[T]}function N(U,K){const J=new Uint8Array(32),T=new Float64Array(80),z=n(),ue=n(),_e=n(),G=n(),E=n(),m=n();for(let x=0;x<31;x++)J[x]=U[x];J[31]=U[31]&127|64,J[0]&=248,l(T,K);for(let x=0;x<16;x++)ue[x]=T[x];z[0]=G[0]=1;for(let x=254;x>=0;--x){const _=J[x>>>3]>>>(x&7)&1;a(z,ue,_),a(_e,G,_),d(E,z,_e),p(z,z,_e),d(_e,ue,G),p(ue,ue,G),A(G,E),A(m,z),y(z,_e,z),y(_e,ue,E),d(E,z,_e),p(z,z,_e),A(ue,z),p(_e,G,m),y(z,_e,s),d(z,z,G),y(_e,_e,z),y(z,G,m),y(G,ue,T),A(ue,E),a(z,ue,_),a(_e,G,_)}for(let x=0;x<16;x++)T[x+16]=z[x],T[x+32]=_e[x],T[x+48]=ue[x],T[x+64]=G[x];const f=T.subarray(32),g=T.subarray(16);P(f,f),y(g,g,f);const v=new Uint8Array(32);return u(v,g),v}t.scalarMult=N;function D(U){return N(U,i)}t.scalarMultBase=D;function k(U){if(U.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const K=new Uint8Array(U);return{publicKey:D(K),secretKey:K}}t.generateKeyPairFromSeed=k;function B(U){const K=(0,e.randomBytes)(32,U),J=k(K);return(0,r.wipe)(K),J}t.generateKeyPair=B;function j(U,K,J=!1){if(U.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(K.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const T=N(U,K);if(J){let z=0;for(let ue=0;ue",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}};var Ti={},Wm={exports:{}};Wm.exports,function(t){(function(e,r){function n(G,E){if(!G)throw new Error(E||"Assertion failed")}function i(G,E){G.super_=E;var m=function(){};m.prototype=E.prototype,G.prototype=new m,G.prototype.constructor=G}function s(G,E,m){if(s.isBN(G))return G;this.negative=0,this.words=null,this.length=0,this.red=null,G!==null&&((E==="le"||E==="be")&&(m=E,E=10),this._init(G||0,E||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(E){return E instanceof s?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===s.wordSize&&Array.isArray(E.words)},s.max=function(E,m){return E.cmp(m)>0?E:m},s.min=function(E,m){return E.cmp(m)<0?E:m},s.prototype._init=function(E,m,f){if(typeof E=="number")return this._initNumber(E,m,f);if(typeof E=="object")return this._initArray(E,m,f);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),E=E.toString().replace(/\s+/g,"");var g=0;E[0]==="-"&&(g++,this.negative=1),g=0;g-=3)x=E[g]|E[g-1]<<8|E[g-2]<<16,this.words[v]|=x<<_&67108863,this.words[v+1]=x>>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);else if(f==="le")for(g=0,v=0;g>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);return this.strip()};function a(G,E){var m=G.charCodeAt(E);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function u(G,E,m){var f=a(G,m);return m-1>=E&&(f|=a(G,m-1)<<4),f}s.prototype._parseHex=function(E,m,f){this.length=Math.ceil((E.length-m)/6),this.words=new Array(this.length);for(var g=0;g=m;g-=2)_=u(E,m,g)<=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8;else{var S=E.length-m;for(g=S%2===0?m+1:m;g=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8}this.strip()};function l(G,E,m,f){for(var g=0,v=Math.min(G.length,m),x=E;x=49?g+=_-49+10:_>=17?g+=_-17+10:g+=_}return g}s.prototype._parseBase=function(E,m,f){this.words=[0],this.length=1;for(var g=0,v=1;v<=67108863;v*=m)g++;g--,v=v/m|0;for(var x=E.length-f,_=x%g,S=Math.min(x,x-_)+f,b=0,M=f;M1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var d=["","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"],p=[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],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(E,m){E=E||10,m=m|0||1;var f;if(E===16||E==="hex"){f="";for(var g=0,v=0,x=0;x>>24-g&16777215,g+=2,g>=26&&(g-=26,x--),v!==0||x!==this.length-1?f=d[6-S.length]+S+f:f=S+f}for(v!==0&&(f=v.toString(16)+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(E===(E|0)&&E>=2&&E<=36){var b=p[E],M=y[E];f="";var I=this.clone();for(I.negative=0;!I.isZero();){var F=I.modn(M).toString(E);I=I.idivn(M),I.isZero()?f=F+f:f=d[b-F.length]+F+f}for(this.isZero()&&(f="0"+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(E,m){return n(typeof o<"u"),this.toArrayLike(o,E,m)},s.prototype.toArray=function(E,m){return this.toArrayLike(Array,E,m)},s.prototype.toArrayLike=function(E,m,f){var g=this.byteLength(),v=f||Math.max(1,g);n(g<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var x=m==="le",_=new E(v),S,b,M=this.clone();if(x){for(b=0;!M.isZero();b++)S=M.andln(255),M.iushrn(8),_[b]=S;for(;b=4096&&(f+=13,m>>>=13),m>=64&&(f+=7,m>>>=7),m>=8&&(f+=4,m>>>=4),m>=2&&(f+=2,m>>>=2),f+m},s.prototype._zeroBits=function(E){if(E===0)return 26;var m=E,f=0;return m&8191||(f+=13,m>>>=13),m&127||(f+=7,m>>>=7),m&15||(f+=4,m>>>=4),m&3||(f+=2,m>>>=2),m&1||f++,f},s.prototype.bitLength=function(){var E=this.words[this.length-1],m=this._countBits(E);return(this.length-1)*26+m};function A(G){for(var E=new Array(G.bitLength()),m=0;m>>g}return E}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,m=0;mE.length?this.clone().ior(E):E.clone().ior(this)},s.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},s.prototype.iuand=function(E){var m;this.length>E.length?m=E:m=this;for(var f=0;fE.length?this.clone().iand(E):E.clone().iand(this)},s.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},s.prototype.iuxor=function(E){var m,f;this.length>E.length?(m=this,f=E):(m=E,f=this);for(var g=0;gE.length?this.clone().ixor(E):E.clone().ixor(this)},s.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},s.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var m=Math.ceil(E/26)|0,f=E%26;this._expand(m),f>0&&m--;for(var g=0;g0&&(this.words[g]=~this.words[g]&67108863>>26-f),this.strip()},s.prototype.notn=function(E){return this.clone().inotn(E)},s.prototype.setn=function(E,m){n(typeof E=="number"&&E>=0);var f=E/26|0,g=E%26;return this._expand(f+1),m?this.words[f]=this.words[f]|1<E.length?(f=this,g=E):(f=E,g=this);for(var v=0,x=0;x>>26;for(;v!==0&&x>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;xE.length?this.clone().iadd(E):E.clone().iadd(this)},s.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var m=this.iadd(E);return E.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var f=this.cmp(E);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var g,v;f>0?(g=this,v=E):(g=E,v=this);for(var x=0,_=0;_>26,this.words[_]=m&67108863;for(;x!==0&&_>26,this.words[_]=m&67108863;if(x===0&&_>>26,I=S&67108863,F=Math.min(b,E.length-1),ae=Math.max(0,b-G.length+1);ae<=F;ae++){var O=b-ae|0;g=G.words[O]|0,v=E.words[ae]|0,x=g*v+I,M+=x/67108864|0,I=x&67108863}m.words[b]=I|0,S=M|0}return S!==0?m.words[b]=S|0:m.length--,m.strip()}var N=function(E,m,f){var g=E.words,v=m.words,x=f.words,_=0,S,b,M,I=g[0]|0,F=I&8191,ae=I>>>13,O=g[1]|0,se=O&8191,ee=O>>>13,X=g[2]|0,Q=X&8191,R=X>>>13,Z=g[3]|0,te=Z&8191,le=Z>>>13,ie=g[4]|0,fe=ie&8191,ve=ie>>>13,Me=g[5]|0,Ne=Me&8191,Te=Me>>>13,$e=g[6]|0,Ie=$e&8191,Le=$e>>>13,Ve=g[7]|0,ke=Ve&8191,ze=Ve>>>13,He=g[8]|0,Ee=He&8191,Qe=He>>>13,ct=g[9]|0,Be=ct&8191,et=ct>>>13,rt=v[0]|0,Je=rt&8191,pt=rt>>>13,ht=v[1]|0,ft=ht&8191,Ht=ht>>>13,Jt=v[2]|0,St=Jt&8191,er=Jt>>>13,Xt=v[3]|0,Ot=Xt&8191,Bt=Xt>>>13,Tt=v[4]|0,vt=Tt&8191,Dt=Tt>>>13,Lt=v[5]|0,bt=Lt&8191,$t=Lt>>>13,jt=v[6]|0,nt=jt&8191,Ft=jt>>>13,$=v[7]|0,H=$&8191,V=$>>>13,C=v[8]|0,Y=C&8191,q=C>>>13,oe=v[9]|0,pe=oe&8191,xe=oe>>>13;f.negative=E.negative^m.negative,f.length=19,S=Math.imul(F,Je),b=Math.imul(F,pt),b=b+Math.imul(ae,Je)|0,M=Math.imul(ae,pt);var Re=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Re>>>26)|0,Re&=67108863,S=Math.imul(se,Je),b=Math.imul(se,pt),b=b+Math.imul(ee,Je)|0,M=Math.imul(ee,pt),S=S+Math.imul(F,ft)|0,b=b+Math.imul(F,Ht)|0,b=b+Math.imul(ae,ft)|0,M=M+Math.imul(ae,Ht)|0;var De=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(De>>>26)|0,De&=67108863,S=Math.imul(Q,Je),b=Math.imul(Q,pt),b=b+Math.imul(R,Je)|0,M=Math.imul(R,pt),S=S+Math.imul(se,ft)|0,b=b+Math.imul(se,Ht)|0,b=b+Math.imul(ee,ft)|0,M=M+Math.imul(ee,Ht)|0,S=S+Math.imul(F,St)|0,b=b+Math.imul(F,er)|0,b=b+Math.imul(ae,St)|0,M=M+Math.imul(ae,er)|0;var it=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(it>>>26)|0,it&=67108863,S=Math.imul(te,Je),b=Math.imul(te,pt),b=b+Math.imul(le,Je)|0,M=Math.imul(le,pt),S=S+Math.imul(Q,ft)|0,b=b+Math.imul(Q,Ht)|0,b=b+Math.imul(R,ft)|0,M=M+Math.imul(R,Ht)|0,S=S+Math.imul(se,St)|0,b=b+Math.imul(se,er)|0,b=b+Math.imul(ee,St)|0,M=M+Math.imul(ee,er)|0,S=S+Math.imul(F,Ot)|0,b=b+Math.imul(F,Bt)|0,b=b+Math.imul(ae,Ot)|0,M=M+Math.imul(ae,Bt)|0;var Ue=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,S=Math.imul(fe,Je),b=Math.imul(fe,pt),b=b+Math.imul(ve,Je)|0,M=Math.imul(ve,pt),S=S+Math.imul(te,ft)|0,b=b+Math.imul(te,Ht)|0,b=b+Math.imul(le,ft)|0,M=M+Math.imul(le,Ht)|0,S=S+Math.imul(Q,St)|0,b=b+Math.imul(Q,er)|0,b=b+Math.imul(R,St)|0,M=M+Math.imul(R,er)|0,S=S+Math.imul(se,Ot)|0,b=b+Math.imul(se,Bt)|0,b=b+Math.imul(ee,Ot)|0,M=M+Math.imul(ee,Bt)|0,S=S+Math.imul(F,vt)|0,b=b+Math.imul(F,Dt)|0,b=b+Math.imul(ae,vt)|0,M=M+Math.imul(ae,Dt)|0;var gt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(gt>>>26)|0,gt&=67108863,S=Math.imul(Ne,Je),b=Math.imul(Ne,pt),b=b+Math.imul(Te,Je)|0,M=Math.imul(Te,pt),S=S+Math.imul(fe,ft)|0,b=b+Math.imul(fe,Ht)|0,b=b+Math.imul(ve,ft)|0,M=M+Math.imul(ve,Ht)|0,S=S+Math.imul(te,St)|0,b=b+Math.imul(te,er)|0,b=b+Math.imul(le,St)|0,M=M+Math.imul(le,er)|0,S=S+Math.imul(Q,Ot)|0,b=b+Math.imul(Q,Bt)|0,b=b+Math.imul(R,Ot)|0,M=M+Math.imul(R,Bt)|0,S=S+Math.imul(se,vt)|0,b=b+Math.imul(se,Dt)|0,b=b+Math.imul(ee,vt)|0,M=M+Math.imul(ee,Dt)|0,S=S+Math.imul(F,bt)|0,b=b+Math.imul(F,$t)|0,b=b+Math.imul(ae,bt)|0,M=M+Math.imul(ae,$t)|0;var st=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(st>>>26)|0,st&=67108863,S=Math.imul(Ie,Je),b=Math.imul(Ie,pt),b=b+Math.imul(Le,Je)|0,M=Math.imul(Le,pt),S=S+Math.imul(Ne,ft)|0,b=b+Math.imul(Ne,Ht)|0,b=b+Math.imul(Te,ft)|0,M=M+Math.imul(Te,Ht)|0,S=S+Math.imul(fe,St)|0,b=b+Math.imul(fe,er)|0,b=b+Math.imul(ve,St)|0,M=M+Math.imul(ve,er)|0,S=S+Math.imul(te,Ot)|0,b=b+Math.imul(te,Bt)|0,b=b+Math.imul(le,Ot)|0,M=M+Math.imul(le,Bt)|0,S=S+Math.imul(Q,vt)|0,b=b+Math.imul(Q,Dt)|0,b=b+Math.imul(R,vt)|0,M=M+Math.imul(R,Dt)|0,S=S+Math.imul(se,bt)|0,b=b+Math.imul(se,$t)|0,b=b+Math.imul(ee,bt)|0,M=M+Math.imul(ee,$t)|0,S=S+Math.imul(F,nt)|0,b=b+Math.imul(F,Ft)|0,b=b+Math.imul(ae,nt)|0,M=M+Math.imul(ae,Ft)|0;var tt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(tt>>>26)|0,tt&=67108863,S=Math.imul(ke,Je),b=Math.imul(ke,pt),b=b+Math.imul(ze,Je)|0,M=Math.imul(ze,pt),S=S+Math.imul(Ie,ft)|0,b=b+Math.imul(Ie,Ht)|0,b=b+Math.imul(Le,ft)|0,M=M+Math.imul(Le,Ht)|0,S=S+Math.imul(Ne,St)|0,b=b+Math.imul(Ne,er)|0,b=b+Math.imul(Te,St)|0,M=M+Math.imul(Te,er)|0,S=S+Math.imul(fe,Ot)|0,b=b+Math.imul(fe,Bt)|0,b=b+Math.imul(ve,Ot)|0,M=M+Math.imul(ve,Bt)|0,S=S+Math.imul(te,vt)|0,b=b+Math.imul(te,Dt)|0,b=b+Math.imul(le,vt)|0,M=M+Math.imul(le,Dt)|0,S=S+Math.imul(Q,bt)|0,b=b+Math.imul(Q,$t)|0,b=b+Math.imul(R,bt)|0,M=M+Math.imul(R,$t)|0,S=S+Math.imul(se,nt)|0,b=b+Math.imul(se,Ft)|0,b=b+Math.imul(ee,nt)|0,M=M+Math.imul(ee,Ft)|0,S=S+Math.imul(F,H)|0,b=b+Math.imul(F,V)|0,b=b+Math.imul(ae,H)|0,M=M+Math.imul(ae,V)|0;var At=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(At>>>26)|0,At&=67108863,S=Math.imul(Ee,Je),b=Math.imul(Ee,pt),b=b+Math.imul(Qe,Je)|0,M=Math.imul(Qe,pt),S=S+Math.imul(ke,ft)|0,b=b+Math.imul(ke,Ht)|0,b=b+Math.imul(ze,ft)|0,M=M+Math.imul(ze,Ht)|0,S=S+Math.imul(Ie,St)|0,b=b+Math.imul(Ie,er)|0,b=b+Math.imul(Le,St)|0,M=M+Math.imul(Le,er)|0,S=S+Math.imul(Ne,Ot)|0,b=b+Math.imul(Ne,Bt)|0,b=b+Math.imul(Te,Ot)|0,M=M+Math.imul(Te,Bt)|0,S=S+Math.imul(fe,vt)|0,b=b+Math.imul(fe,Dt)|0,b=b+Math.imul(ve,vt)|0,M=M+Math.imul(ve,Dt)|0,S=S+Math.imul(te,bt)|0,b=b+Math.imul(te,$t)|0,b=b+Math.imul(le,bt)|0,M=M+Math.imul(le,$t)|0,S=S+Math.imul(Q,nt)|0,b=b+Math.imul(Q,Ft)|0,b=b+Math.imul(R,nt)|0,M=M+Math.imul(R,Ft)|0,S=S+Math.imul(se,H)|0,b=b+Math.imul(se,V)|0,b=b+Math.imul(ee,H)|0,M=M+Math.imul(ee,V)|0,S=S+Math.imul(F,Y)|0,b=b+Math.imul(F,q)|0,b=b+Math.imul(ae,Y)|0,M=M+Math.imul(ae,q)|0;var Rt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,S=Math.imul(Be,Je),b=Math.imul(Be,pt),b=b+Math.imul(et,Je)|0,M=Math.imul(et,pt),S=S+Math.imul(Ee,ft)|0,b=b+Math.imul(Ee,Ht)|0,b=b+Math.imul(Qe,ft)|0,M=M+Math.imul(Qe,Ht)|0,S=S+Math.imul(ke,St)|0,b=b+Math.imul(ke,er)|0,b=b+Math.imul(ze,St)|0,M=M+Math.imul(ze,er)|0,S=S+Math.imul(Ie,Ot)|0,b=b+Math.imul(Ie,Bt)|0,b=b+Math.imul(Le,Ot)|0,M=M+Math.imul(Le,Bt)|0,S=S+Math.imul(Ne,vt)|0,b=b+Math.imul(Ne,Dt)|0,b=b+Math.imul(Te,vt)|0,M=M+Math.imul(Te,Dt)|0,S=S+Math.imul(fe,bt)|0,b=b+Math.imul(fe,$t)|0,b=b+Math.imul(ve,bt)|0,M=M+Math.imul(ve,$t)|0,S=S+Math.imul(te,nt)|0,b=b+Math.imul(te,Ft)|0,b=b+Math.imul(le,nt)|0,M=M+Math.imul(le,Ft)|0,S=S+Math.imul(Q,H)|0,b=b+Math.imul(Q,V)|0,b=b+Math.imul(R,H)|0,M=M+Math.imul(R,V)|0,S=S+Math.imul(se,Y)|0,b=b+Math.imul(se,q)|0,b=b+Math.imul(ee,Y)|0,M=M+Math.imul(ee,q)|0,S=S+Math.imul(F,pe)|0,b=b+Math.imul(F,xe)|0,b=b+Math.imul(ae,pe)|0,M=M+Math.imul(ae,xe)|0;var Mt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,S=Math.imul(Be,ft),b=Math.imul(Be,Ht),b=b+Math.imul(et,ft)|0,M=Math.imul(et,Ht),S=S+Math.imul(Ee,St)|0,b=b+Math.imul(Ee,er)|0,b=b+Math.imul(Qe,St)|0,M=M+Math.imul(Qe,er)|0,S=S+Math.imul(ke,Ot)|0,b=b+Math.imul(ke,Bt)|0,b=b+Math.imul(ze,Ot)|0,M=M+Math.imul(ze,Bt)|0,S=S+Math.imul(Ie,vt)|0,b=b+Math.imul(Ie,Dt)|0,b=b+Math.imul(Le,vt)|0,M=M+Math.imul(Le,Dt)|0,S=S+Math.imul(Ne,bt)|0,b=b+Math.imul(Ne,$t)|0,b=b+Math.imul(Te,bt)|0,M=M+Math.imul(Te,$t)|0,S=S+Math.imul(fe,nt)|0,b=b+Math.imul(fe,Ft)|0,b=b+Math.imul(ve,nt)|0,M=M+Math.imul(ve,Ft)|0,S=S+Math.imul(te,H)|0,b=b+Math.imul(te,V)|0,b=b+Math.imul(le,H)|0,M=M+Math.imul(le,V)|0,S=S+Math.imul(Q,Y)|0,b=b+Math.imul(Q,q)|0,b=b+Math.imul(R,Y)|0,M=M+Math.imul(R,q)|0,S=S+Math.imul(se,pe)|0,b=b+Math.imul(se,xe)|0,b=b+Math.imul(ee,pe)|0,M=M+Math.imul(ee,xe)|0;var Et=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Et>>>26)|0,Et&=67108863,S=Math.imul(Be,St),b=Math.imul(Be,er),b=b+Math.imul(et,St)|0,M=Math.imul(et,er),S=S+Math.imul(Ee,Ot)|0,b=b+Math.imul(Ee,Bt)|0,b=b+Math.imul(Qe,Ot)|0,M=M+Math.imul(Qe,Bt)|0,S=S+Math.imul(ke,vt)|0,b=b+Math.imul(ke,Dt)|0,b=b+Math.imul(ze,vt)|0,M=M+Math.imul(ze,Dt)|0,S=S+Math.imul(Ie,bt)|0,b=b+Math.imul(Ie,$t)|0,b=b+Math.imul(Le,bt)|0,M=M+Math.imul(Le,$t)|0,S=S+Math.imul(Ne,nt)|0,b=b+Math.imul(Ne,Ft)|0,b=b+Math.imul(Te,nt)|0,M=M+Math.imul(Te,Ft)|0,S=S+Math.imul(fe,H)|0,b=b+Math.imul(fe,V)|0,b=b+Math.imul(ve,H)|0,M=M+Math.imul(ve,V)|0,S=S+Math.imul(te,Y)|0,b=b+Math.imul(te,q)|0,b=b+Math.imul(le,Y)|0,M=M+Math.imul(le,q)|0,S=S+Math.imul(Q,pe)|0,b=b+Math.imul(Q,xe)|0,b=b+Math.imul(R,pe)|0,M=M+Math.imul(R,xe)|0;var dt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(dt>>>26)|0,dt&=67108863,S=Math.imul(Be,Ot),b=Math.imul(Be,Bt),b=b+Math.imul(et,Ot)|0,M=Math.imul(et,Bt),S=S+Math.imul(Ee,vt)|0,b=b+Math.imul(Ee,Dt)|0,b=b+Math.imul(Qe,vt)|0,M=M+Math.imul(Qe,Dt)|0,S=S+Math.imul(ke,bt)|0,b=b+Math.imul(ke,$t)|0,b=b+Math.imul(ze,bt)|0,M=M+Math.imul(ze,$t)|0,S=S+Math.imul(Ie,nt)|0,b=b+Math.imul(Ie,Ft)|0,b=b+Math.imul(Le,nt)|0,M=M+Math.imul(Le,Ft)|0,S=S+Math.imul(Ne,H)|0,b=b+Math.imul(Ne,V)|0,b=b+Math.imul(Te,H)|0,M=M+Math.imul(Te,V)|0,S=S+Math.imul(fe,Y)|0,b=b+Math.imul(fe,q)|0,b=b+Math.imul(ve,Y)|0,M=M+Math.imul(ve,q)|0,S=S+Math.imul(te,pe)|0,b=b+Math.imul(te,xe)|0,b=b+Math.imul(le,pe)|0,M=M+Math.imul(le,xe)|0;var _t=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(_t>>>26)|0,_t&=67108863,S=Math.imul(Be,vt),b=Math.imul(Be,Dt),b=b+Math.imul(et,vt)|0,M=Math.imul(et,Dt),S=S+Math.imul(Ee,bt)|0,b=b+Math.imul(Ee,$t)|0,b=b+Math.imul(Qe,bt)|0,M=M+Math.imul(Qe,$t)|0,S=S+Math.imul(ke,nt)|0,b=b+Math.imul(ke,Ft)|0,b=b+Math.imul(ze,nt)|0,M=M+Math.imul(ze,Ft)|0,S=S+Math.imul(Ie,H)|0,b=b+Math.imul(Ie,V)|0,b=b+Math.imul(Le,H)|0,M=M+Math.imul(Le,V)|0,S=S+Math.imul(Ne,Y)|0,b=b+Math.imul(Ne,q)|0,b=b+Math.imul(Te,Y)|0,M=M+Math.imul(Te,q)|0,S=S+Math.imul(fe,pe)|0,b=b+Math.imul(fe,xe)|0,b=b+Math.imul(ve,pe)|0,M=M+Math.imul(ve,xe)|0;var ot=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(ot>>>26)|0,ot&=67108863,S=Math.imul(Be,bt),b=Math.imul(Be,$t),b=b+Math.imul(et,bt)|0,M=Math.imul(et,$t),S=S+Math.imul(Ee,nt)|0,b=b+Math.imul(Ee,Ft)|0,b=b+Math.imul(Qe,nt)|0,M=M+Math.imul(Qe,Ft)|0,S=S+Math.imul(ke,H)|0,b=b+Math.imul(ke,V)|0,b=b+Math.imul(ze,H)|0,M=M+Math.imul(ze,V)|0,S=S+Math.imul(Ie,Y)|0,b=b+Math.imul(Ie,q)|0,b=b+Math.imul(Le,Y)|0,M=M+Math.imul(Le,q)|0,S=S+Math.imul(Ne,pe)|0,b=b+Math.imul(Ne,xe)|0,b=b+Math.imul(Te,pe)|0,M=M+Math.imul(Te,xe)|0;var wt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(wt>>>26)|0,wt&=67108863,S=Math.imul(Be,nt),b=Math.imul(Be,Ft),b=b+Math.imul(et,nt)|0,M=Math.imul(et,Ft),S=S+Math.imul(Ee,H)|0,b=b+Math.imul(Ee,V)|0,b=b+Math.imul(Qe,H)|0,M=M+Math.imul(Qe,V)|0,S=S+Math.imul(ke,Y)|0,b=b+Math.imul(ke,q)|0,b=b+Math.imul(ze,Y)|0,M=M+Math.imul(ze,q)|0,S=S+Math.imul(Ie,pe)|0,b=b+Math.imul(Ie,xe)|0,b=b+Math.imul(Le,pe)|0,M=M+Math.imul(Le,xe)|0;var lt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul(Be,H),b=Math.imul(Be,V),b=b+Math.imul(et,H)|0,M=Math.imul(et,V),S=S+Math.imul(Ee,Y)|0,b=b+Math.imul(Ee,q)|0,b=b+Math.imul(Qe,Y)|0,M=M+Math.imul(Qe,q)|0,S=S+Math.imul(ke,pe)|0,b=b+Math.imul(ke,xe)|0,b=b+Math.imul(ze,pe)|0,M=M+Math.imul(ze,xe)|0;var at=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(at>>>26)|0,at&=67108863,S=Math.imul(Be,Y),b=Math.imul(Be,q),b=b+Math.imul(et,Y)|0,M=Math.imul(et,q),S=S+Math.imul(Ee,pe)|0,b=b+Math.imul(Ee,xe)|0,b=b+Math.imul(Qe,pe)|0,M=M+Math.imul(Qe,xe)|0;var Ae=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,S=Math.imul(Be,pe),b=Math.imul(Be,xe),b=b+Math.imul(et,pe)|0,M=Math.imul(et,xe);var Pe=(_+S|0)+((b&8191)<<13)|0;return _=(M+(b>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,x[0]=Re,x[1]=De,x[2]=it,x[3]=Ue,x[4]=gt,x[5]=st,x[6]=tt,x[7]=At,x[8]=Rt,x[9]=Mt,x[10]=Et,x[11]=dt,x[12]=_t,x[13]=ot,x[14]=wt,x[15]=lt,x[16]=at,x[17]=Ae,x[18]=Pe,_!==0&&(x[19]=_,f.length++),f};Math.imul||(N=P);function D(G,E,m){m.negative=E.negative^G.negative,m.length=G.length+E.length;for(var f=0,g=0,v=0;v>>26)|0,g+=x>>>26,x&=67108863}m.words[v]=_,f=x,x=g}return f!==0?m.words[v]=f:m.length--,m.strip()}function k(G,E,m){var f=new B;return f.mulp(G,E,m)}s.prototype.mulTo=function(E,m){var f,g=this.length+E.length;return this.length===10&&E.length===10?f=N(this,E,m):g<63?f=P(this,E,m):g<1024?f=D(this,E,m):f=k(this,E,m),f};function B(G,E){this.x=G,this.y=E}B.prototype.makeRBT=function(E){for(var m=new Array(E),f=s.prototype._countBits(E)-1,g=0;g>=1;return g},B.prototype.permute=function(E,m,f,g,v,x){for(var _=0;_>>1)v++;return 1<>>13,f[2*x+1]=v&8191,v=v>>>13;for(x=2*m;x>=26,m+=g/67108864|0,m+=v>>>26,this.words[f]=v&67108863}return m!==0&&(this.words[f]=m,this.length++),this},s.prototype.muln=function(E){return this.clone().imuln(E)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(E){var m=A(E);if(m.length===0)return new s(1);for(var f=this,g=0;g=0);var m=E%26,f=(E-m)/26,g=67108863>>>26-m<<26-m,v;if(m!==0){var x=0;for(v=0;v>>26-m}x&&(this.words[v]=x,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var g;m?g=(m-m%26)/26:g=0;var v=E%26,x=Math.min((E-v)/26,this.length),_=67108863^67108863>>>v<x)for(this.length-=x,b=0;b=0&&(M!==0||b>=g);b--){var I=this.words[b]|0;this.words[b]=M<<26-v|I>>>v,M=I&_}return S&&M!==0&&(S.words[S.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(E,m,f){return n(this.negative===0),this.iushrn(E,m,f)},s.prototype.shln=function(E){return this.clone().ishln(E)},s.prototype.ushln=function(E){return this.clone().iushln(E)},s.prototype.shrn=function(E){return this.clone().ishrn(E)},s.prototype.ushrn=function(E){return this.clone().iushrn(E)},s.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var m=E%26,f=(E-m)/26,g=1<=0);var m=E%26,f=(E-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(m!==0&&f++,this.length=Math.min(f,this.length),m!==0){var g=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(S/67108864|0),this.words[v+f]=x&67108863}for(;v>26,this.words[v+f]=x&67108863;if(_===0)return this.strip();for(n(_===-1),_=0,v=0;v>26,this.words[v]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(E,m){var f=this.length-E.length,g=this.clone(),v=E,x=v.words[v.length-1]|0,_=this._countBits(x);f=26-_,f!==0&&(v=v.ushln(f),g.iushln(f),x=v.words[v.length-1]|0);var S=g.length-v.length,b;if(m!=="mod"){b=new s(null),b.length=S+1,b.words=new Array(b.length);for(var M=0;M=0;F--){var ae=(g.words[v.length+F]|0)*67108864+(g.words[v.length+F-1]|0);for(ae=Math.min(ae/x|0,67108863),g._ishlnsubmul(v,ae,F);g.negative!==0;)ae--,g.negative=0,g._ishlnsubmul(v,1,F),g.isZero()||(g.negative^=1);b&&(b.words[F]=ae)}return b&&b.strip(),g.strip(),m!=="div"&&f!==0&&g.iushrn(f),{div:b||null,mod:g}},s.prototype.divmod=function(E,m,f){if(n(!E.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var g,v,x;return this.negative!==0&&E.negative===0?(x=this.neg().divmod(E,m),m!=="mod"&&(g=x.div.neg()),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.iadd(E)),{div:g,mod:v}):this.negative===0&&E.negative!==0?(x=this.divmod(E.neg(),m),m!=="mod"&&(g=x.div.neg()),{div:g,mod:x.mod}):this.negative&E.negative?(x=this.neg().divmod(E.neg(),m),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.isub(E)),{div:x.div,mod:v}):E.length>this.length||this.cmp(E)<0?{div:new s(0),mod:this}:E.length===1?m==="div"?{div:this.divn(E.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new s(this.modn(E.words[0]))}:this._wordDiv(E,m)},s.prototype.div=function(E){return this.divmod(E,"div",!1).div},s.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},s.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},s.prototype.divRound=function(E){var m=this.divmod(E);if(m.mod.isZero())return m.div;var f=m.div.negative!==0?m.mod.isub(E):m.mod,g=E.ushrn(1),v=E.andln(1),x=f.cmp(g);return x<0||v===1&&x===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(E){n(E<=67108863);for(var m=(1<<26)%E,f=0,g=this.length-1;g>=0;g--)f=(m*f+(this.words[g]|0))%E;return f},s.prototype.idivn=function(E){n(E<=67108863);for(var m=0,f=this.length-1;f>=0;f--){var g=(this.words[f]|0)+m*67108864;this.words[f]=g/E|0,m=g%E}return this.strip()},s.prototype.divn=function(E){return this.clone().idivn(E)},s.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=new s(0),_=new s(1),S=0;m.isEven()&&f.isEven();)m.iushrn(1),f.iushrn(1),++S;for(var b=f.clone(),M=m.clone();!m.isZero();){for(var I=0,F=1;!(m.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(m.iushrn(I);I-- >0;)(g.isOdd()||v.isOdd())&&(g.iadd(b),v.isub(M)),g.iushrn(1),v.iushrn(1);for(var ae=0,O=1;!(f.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(f.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(b),_.isub(M)),x.iushrn(1),_.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(x),v.isub(_)):(f.isub(m),x.isub(g),_.isub(v))}return{a:x,b:_,gcd:f.iushln(S)}},s.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=f.clone();m.cmpn(1)>0&&f.cmpn(1)>0;){for(var _=0,S=1;!(m.words[0]&S)&&_<26;++_,S<<=1);if(_>0)for(m.iushrn(_);_-- >0;)g.isOdd()&&g.iadd(x),g.iushrn(1);for(var b=0,M=1;!(f.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(f.iushrn(b);b-- >0;)v.isOdd()&&v.iadd(x),v.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(v)):(f.isub(m),v.isub(g))}var I;return m.cmpn(1)===0?I=g:I=v,I.cmpn(0)<0&&I.iadd(E),I},s.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var m=this.clone(),f=E.clone();m.negative=0,f.negative=0;for(var g=0;m.isEven()&&f.isEven();g++)m.iushrn(1),f.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=m.cmp(f);if(v<0){var x=m;m=f,f=x}else if(v===0||f.cmpn(1)===0)break;m.isub(f)}while(!0);return f.iushln(g)},s.prototype.invm=function(E){return this.egcd(E).a.umod(E)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(E){return this.words[0]&E},s.prototype.bincn=function(E){n(typeof E=="number");var m=E%26,f=(E-m)/26,g=1<>>26,_&=67108863,this.words[x]=_}return v!==0&&(this.words[x]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(E){var m=E<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var f;if(this.length>1)f=1;else{m&&(E=-E),n(E<=67108863,"Number is too big");var g=this.words[0]|0;f=g===E?0:gE.length)return 1;if(this.length=0;f--){var g=this.words[f]|0,v=E.words[f]|0;if(g!==v){gv&&(m=1);break}}return m},s.prototype.gtn=function(E){return this.cmpn(E)===1},s.prototype.gt=function(E){return this.cmp(E)===1},s.prototype.gten=function(E){return this.cmpn(E)>=0},s.prototype.gte=function(E){return this.cmp(E)>=0},s.prototype.ltn=function(E){return this.cmpn(E)===-1},s.prototype.lt=function(E){return this.cmp(E)===-1},s.prototype.lten=function(E){return this.cmpn(E)<=0},s.prototype.lte=function(E){return this.cmp(E)<=0},s.prototype.eqn=function(E){return this.cmpn(E)===0},s.prototype.eq=function(E){return this.cmp(E)===0},s.red=function(E){return new ue(E)},s.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(E){return this.red=E,this},s.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},s.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},s.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},s.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},s.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},s.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},s.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},s.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var j={k256:null,p224:null,p192:null,p25519:null};function U(G,E){this.name=G,this.p=new s(E,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var E=new s(null);return E.words=new Array(Math.ceil(this.n/13)),E},U.prototype.ireduce=function(E){var m=E,f;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),f=m.bitLength();while(f>this.n);var g=f0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},U.prototype.split=function(E,m){E.iushrn(this.n,0,m)},U.prototype.imulK=function(E){return E.imul(this.k)};function K(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(K,U),K.prototype.split=function(E,m){for(var f=4194303,g=Math.min(E.length,9),v=0;v>>22,x=_}x>>>=22,E.words[v-10]=x,x===0&&E.length>10?E.length-=10:E.length-=9},K.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var m=0,f=0;f>>=26,E.words[f]=v,m=g}return m!==0&&(E.words[E.length++]=m),E},s._prime=function(E){if(j[E])return j[E];var m;if(E==="k256")m=new K;else if(E==="p224")m=new J;else if(E==="p192")m=new T;else if(E==="p25519")m=new z;else throw new Error("Unknown prime "+E);return j[E]=m,m};function ue(G){if(typeof G=="string"){var E=s._prime(G);this.m=E.p,this.prime=E}else n(G.gtn(1),"modulus must be greater than 1"),this.m=G,this.prime=null}ue.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},ue.prototype._verify2=function(E,m){n((E.negative|m.negative)===0,"red works only with positives"),n(E.red&&E.red===m.red,"red works only with red numbers")},ue.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},ue.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},ue.prototype.add=function(E,m){this._verify2(E,m);var f=E.add(m);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},ue.prototype.iadd=function(E,m){this._verify2(E,m);var f=E.iadd(m);return f.cmp(this.m)>=0&&f.isub(this.m),f},ue.prototype.sub=function(E,m){this._verify2(E,m);var f=E.sub(m);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},ue.prototype.isub=function(E,m){this._verify2(E,m);var f=E.isub(m);return f.cmpn(0)<0&&f.iadd(this.m),f},ue.prototype.shl=function(E,m){return this._verify1(E),this.imod(E.ushln(m))},ue.prototype.imul=function(E,m){return this._verify2(E,m),this.imod(E.imul(m))},ue.prototype.mul=function(E,m){return this._verify2(E,m),this.imod(E.mul(m))},ue.prototype.isqr=function(E){return this.imul(E,E.clone())},ue.prototype.sqr=function(E){return this.mul(E,E)},ue.prototype.sqrt=function(E){if(E.isZero())return E.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(E,f)}for(var g=this.m.subn(1),v=0;!g.isZero()&&g.andln(1)===0;)v++,g.iushrn(1);n(!g.isZero());var x=new s(1).toRed(this),_=x.redNeg(),S=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new s(2*b*b).toRed(this);this.pow(b,S).cmp(_)!==0;)b.redIAdd(_);for(var M=this.pow(b,g),I=this.pow(E,g.addn(1).iushrn(1)),F=this.pow(E,g),ae=v;F.cmp(x)!==0;){for(var O=F,se=0;O.cmp(x)!==0;se++)O=O.redSqr();n(se=0;v--){for(var M=m.words[v],I=b-1;I>=0;I--){var F=M>>I&1;if(x!==g[0]&&(x=this.sqr(x)),F===0&&_===0){S=0;continue}_<<=1,_|=F,S++,!(S!==f&&(v!==0||I!==0))&&(x=this.mul(x,g[_]),S=0,_=0)}b=26}return x},ue.prototype.convertTo=function(E){var m=E.umod(this.m);return m===E?m.clone():m},ue.prototype.convertFrom=function(E){var m=E.clone();return m.red=null,m},s.mont=function(E){return new _e(E)};function _e(G){ue.call(this,G),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(_e,ue),_e.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},_e.prototype.convertFrom=function(E){var m=this.imod(E.mul(this.rinv));return m.red=null,m},_e.prototype.imul=function(E,m){if(E.isZero()||m.isZero())return E.words[0]=0,E.length=1,E;var f=E.imul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.mul=function(E,m){if(E.isZero()||m.isZero())return new s(0)._forceRed(this);var f=E.mul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.invm=function(E){var m=this.imod(E._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,nn)}(Wm);var xo=Wm.exports,Km={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var u=0;u>8,p=l&255;d?a.push(d,p):a.push(p)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(N>>1)-1?k=(N>>1)-B:k=B,D.isubn(k)):k=0,A[P]=k,D.iushrn(1)}return A}e.getNAF=s;function o(d,p){var y=[[],[]];d=d.clone(),p=p.clone();for(var A=0,P=0,N;d.cmpn(-A)>0||p.cmpn(-P)>0;){var D=d.andln(3)+A&3,k=p.andln(3)+P&3;D===3&&(D=-1),k===3&&(k=-1);var B;D&1?(N=d.andln(7)+A&7,(N===3||N===5)&&k===2?B=-D:B=D):B=0,y[0].push(B);var j;k&1?(N=p.andln(7)+P&7,(N===3||N===5)&&D===2?j=-k:j=k):j=0,y[1].push(j),2*A===B+1&&(A=1-A),2*P===j+1&&(P=1-P),d.iushrn(1),p.iushrn(1)}return y}e.getJSF=o;function a(d,p,y){var A="_"+p;d.prototype[p]=function(){return this[A]!==void 0?this[A]:this[A]=y.call(this)}}e.cachedProperty=a;function u(d){return typeof d=="string"?e.toArray(d,"hex"):d}e.parseBytes=u;function l(d){return new r(d,"hex","le")}e.intFromLE=l}(Ti);var Vm={exports:{}},Gm;Vm.exports=function(e){return Gm||(Gm=new aa(null)),Gm.generate(e)};function aa(t){this.rand=t}if(Vm.exports.Rand=aa,aa.prototype.generate=function(e){return this._rand(e)},aa.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Rd=ca;ca.prototype.point=function(){throw new Error("Not implemented")},ca.prototype.validate=function(){throw new Error("Not implemented")},ca.prototype._fixedNafMul=function(e,r){Td(e.precomputed);var n=e._getDoubles(),i=Cd(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Td(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},ca.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=Cd(n[P],o[P],this._bitLength),u[N]=Cd(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=Nk(n[P],n[N]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[N]=new Array(l),p=0;p=0;d--){for(var T=0;d>=0;){var z=!0;for(p=0;p=0&&T++,K=K.dblp(T),d<0)break;for(p=0;p0?y=a[p][ue-1>>1]:ue<0&&(y=a[p][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Ki.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),p.negative&&(p=p.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:p,b:y},{a:A,b:P}]},Vi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Vi.prototype.pointFromX=function(e,r){e=new en(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Vi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Vi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},On.prototype.isInfinity=function(){return this.inf},On.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},On.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},On.prototype.getX=function(){return this.x.fromRed()},On.prototype.getY=function(){return this.y.fromRed()},On.prototype.mul=function(e){return e=new en(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},On.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},On.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},On.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},On.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},On.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function qn(t,e,r,n){bu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new en(0)):(this.x=new en(e,16),this.y=new en(r,16),this.z=new en(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Jm(qn,bu.BasePoint),Vi.prototype.jpoint=function(e,r,n){return new qn(this,e,r,n)},qn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},qn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},qn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(p).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(p)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},qn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),A=u.redMul(p.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},qn.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},qn.prototype.inspect=function(){return this.isInfinity()?"":""},qn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var yu=xo,I3=yd,Dd=Rd,$k=Ti;function wu(t){Dd.call(this,"mont",t),this.a=new yu(t.a,16).toRed(this.red),this.b=new yu(t.b,16).toRed(this.red),this.i4=new yu(4).toRed(this.red).redInvm(),this.two=new yu(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}I3(wu,Dd);var Fk=wu;wu.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function Nn(t,e,r){Dd.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new yu(e,16),this.z=new yu(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}I3(Nn,Dd.BasePoint),wu.prototype.decodePoint=function(e,r){return this.point($k.toArray(e,r),1)},wu.prototype.point=function(e,r){return new Nn(this,e,r)},wu.prototype.pointFromJSON=function(e){return Nn.fromJSON(this,e)},Nn.prototype.precompute=function(){},Nn.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Nn.fromJSON=function(e,r){return new Nn(e,r[0],r[1]||e.one)},Nn.prototype.inspect=function(){return this.isInfinity()?"":""},Nn.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Nn.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)},Nn.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),u=s.redMul(i),l=r.z.redMul(a.redAdd(u).redSqr()),d=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(l,d)},Nn.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i},Nn.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Nn.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Nn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var jk=Ti,_o=xo,C3=yd,Od=Rd,Uk=jk.assert;function zs(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Od.call(this,"edwards",t),this.a=new _o(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new _o(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new _o(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Uk(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}C3(zs,Od);var qk=zs;zs.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},zs.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},zs.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)},zs.prototype.pointFromX=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var u=a.fromRed().isOdd();return(r&&!u||!r&&u)&&(a=a.redNeg()),this.point(e,a)},zs.prototype.pointFromY=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)},zs.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function Hr(t,e,r,n,i){Od.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new _o(e,16),this.y=new _o(r,16),this.z=n?new _o(n,16):this.curve.one,this.t=i&&new _o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}C3(Hr,Od.BasePoint),zs.prototype.pointFromJSON=function(e){return Hr.fromJSON(this,e)},zs.prototype.point=function(e,r,n,i){return new Hr(this,e,r,n,i)},Hr.fromJSON=function(e,r){return new Hr(e,r[0],r[1],r[2])},Hr.prototype.inspect=function(){return this.isInfinity()?"":""},Hr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Hr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),u=i.redSub(r),l=s.redMul(a),d=o.redMul(u),p=s.redMul(u),y=a.redMul(o);return this.curve.point(l,d,y,p)},Hr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,u,l;if(this.curve.twisted){a=this.curve._mulA(r);var d=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(d.redSub(this.curve.two)),s=d.redMul(a.redSub(n)),o=d.redSqr().redSub(d).redSub(d)):(u=this.z.redSqr(),l=d.redSub(u).redISub(u),i=e.redSub(r).redISub(n).redMul(l),s=d.redMul(a.redSub(n)),o=d.redMul(l))}else a=r.redAdd(n),u=this.curve._mulC(this.z).redSqr(),l=a.redSub(u).redSub(u),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)},Hr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Hr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),u=s.redAdd(i),l=n.redAdd(r),d=o.redMul(a),p=u.redMul(l),y=o.redMul(l),A=a.redMul(u);return this.curve.point(d,p,A,y)},Hr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),u=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),d=r.redMul(a).redMul(l),p,y;return this.curve.twisted?(p=r.redMul(u).redMul(s.redSub(this.curve._mulA(i))),y=a.redMul(u)):(p=r.redMul(u).redMul(s.redSub(i)),y=this.curve._mulC(a).redMul(u)),this.curve.point(d,p,y)},Hr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Hr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Hr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)},Hr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)},Hr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Hr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Hr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Hr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Hr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Hr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Hr.prototype.toP=Hr.prototype.normalize,Hr.prototype.mixedAdd=Hr.prototype.add,function(t){var e=t;e.base=Rd,e.short=Bk,e.mont=Fk,e.edwards=qk}(Ym);var Nd={},Xm,T3;function zk(){return T3||(T3=1,Xm={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Xm}(function(t){var e=t,r=al,n=Ym,i=Ti,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,d){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var p=new o(d);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:p}),p}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=zk()}catch{u=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})})(Nd);var Hk=al,Za=Km,R3=Ga;function ua(t){if(!(this instanceof ua))return new ua(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Za.toArray(t.entropy,t.entropyEnc||"hex"),r=Za.toArray(t.nonce,t.nonceEnc||"hex"),n=Za.toArray(t.pers,t.persEnc||"hex");R3(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Wk=ua;ua.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ua.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Za.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var Ld=xo,Qm=Ti,Yk=Qm.assert;function kd(t,e){if(t instanceof kd)return t;this._importDER(t,e)||(Yk(t.r&&t.s,"Signature without r or s"),this.r=new Ld(t.r,16),this.s=new Ld(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Jk=kd;function Xk(){this.place=0}function e1(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function D3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}kd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=D3(r),n=D3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];t1(i,r.length),i=i.concat(r),i.push(2),t1(i,n.length);var s=i.concat(n),o=[48];return t1(o,s.length),o=o.concat(s),Qm.encode(o,e)};var Eo=xo,O3=Wk,Zk=Ti,r1=Nd,Qk=M3,N3=Zk.assert,n1=Gk,Bd=Jk;function Gi(t){if(!(this instanceof Gi))return new Gi(t);typeof t=="string"&&(N3(Object.prototype.hasOwnProperty.call(r1,t),"Unknown curve "+t),t=r1[t]),t instanceof r1.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var eB=Gi;Gi.prototype.keyPair=function(e){return new n1(this,e)},Gi.prototype.keyFromPrivate=function(e,r){return n1.fromPrivate(this,e,r)},Gi.prototype.keyFromPublic=function(e,r){return n1.fromPublic(this,e,r)},Gi.prototype.genKeyPair=function(e){e||(e={});for(var r=new O3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Qk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new Eo(2));;){var s=new Eo(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Gi.prototype._truncateToN=function(e,r,n){var i;if(Eo.isBN(e)||typeof e=="number")e=new Eo(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new Eo(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new Eo(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Gi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new O3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new Eo(1)),d=0;;d++){var p=i.k?i.k(d):new Eo(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new Bd({r:P,s:N,recoveryParam:D})}}}}}},Gi.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new Bd(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),l=u.mul(e).umod(this.n),d=u.mul(o).umod(this.n),p;return this.curve._maxwellTrick?(p=this.g.jmulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.eqXToP(o)):(p=this.g.mulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.getX().umod(this.n).cmp(o)===0)},Gi.prototype.recoverPubKey=function(t,e,r,n){N3((3&r)===r,"The recovery param is more than two bits"),e=new Bd(e,n);var i=this.n,s=new Eo(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Gi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Bd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dl=Ti,L3=dl.assert,k3=dl.parseBytes,xu=dl.cachedProperty;function Ln(t,e){this.eddsa=t,this._secret=k3(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=k3(e.pub)}Ln.fromPublic=function(e,r){return r instanceof Ln?r:new Ln(e,{pub:r})},Ln.fromSecret=function(e,r){return r instanceof Ln?r:new Ln(e,{secret:r})},Ln.prototype.secret=function(){return this._secret},xu(Ln,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),xu(Ln,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),xu(Ln,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i}),xu(Ln,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),xu(Ln,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),xu(Ln,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Ln.prototype.sign=function(e){return L3(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Ln.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},Ln.prototype.getSecret=function(e){return L3(this._secret,"KeyPair is public only"),dl.encode(this.secret(),e)},Ln.prototype.getPublic=function(e){return dl.encode(this.pubBytes(),e)};var tB=Ln,rB=xo,$d=Ti,B3=$d.assert,Fd=$d.cachedProperty,nB=$d.parseBytes;function Qa(t,e){this.eddsa=t,typeof e!="object"&&(e=nB(e)),Array.isArray(e)&&(B3(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),B3(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof rB&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Fd(Qa,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Fd(Qa,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Fd(Qa,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Fd(Qa,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Qa.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Qa.prototype.toHex=function(){return $d.encode(this.toBytes(),"hex").toUpperCase()};var iB=Qa,sB=al,oB=Nd,_u=Ti,aB=_u.assert,$3=_u.parseBytes,F3=tB,j3=iB;function vi(t){if(aB(t==="ed25519","only tested with ed25519 so far"),!(this instanceof vi))return new vi(t);t=oB[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=sB.sha512}var cB=vi;vi.prototype.sign=function(e,r){e=$3(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),u=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:u,Rencoded:o})},vi.prototype.verify=function(e,r,n){if(e=$3(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)},vi.prototype.hashInt=function(){for(var e=this.hash(),r=0;re in t?lB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,H3=(t,e)=>{for(var r in e||(e={}))hB.call(e,r)&&z3(t,r,e[r]);if(q3)for(var r of q3(e))dB.call(e,r)&&z3(t,r,e[r]);return t};const pB="ReactNative",Ri={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},gB="js";function jd(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Su(){return!nl()&&!!mm()&&navigator.product===pB}function pl(){return!jd()&&!!mm()&&!!nl()}function gl(){return Su()?Ri.reactNative:jd()?Ri.node:pl()?Ri.browser:Ri.unknown}function mB(){var t;try{return Su()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function vB(t,e){let r=il.parse(t);return r=H3(H3({},r),e),t=il.stringify(r),t}function W3(){return Ax()||{name:"",description:"",url:"",icons:[""]}}function bB(){if(gl()===Ri.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=HO();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function yB(){var t;const e=gl();return e===Ri.browser?[e,((t=Sx())==null?void 0:t.host)||"unknown"].join(":"):e}function K3(t,e,r){const n=bB(),i=yB();return[[t,e].join("-"),[gB,r].join("-"),n,i].join("/")}function wB({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const u=r.split("?"),l=K3(t,e,n),d={auth:i,ua:l,projectId:s,useOnCloseEvent:o,origin:a||void 0},p=vB(u[1]||"",d);return u[0]+"?"+p}function ec(t,e){return t.filter(r=>e.includes(r)).length===t.length}function V3(t){return Object.fromEntries(t.entries())}function G3(t){return new Map(Object.entries(t))}function tc(t=mt.FIVE_MINUTES,e){const r=mt.toMiliseconds(t||mt.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Au(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function Y3(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function xB(t){return Y3("topic",t)}function _B(t){return Y3("id",t)}function J3(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function En(t,e){return mt.fromMiliseconds(Date.now()+mt.toMiliseconds(t))}function fa(t){return Date.now()>=mt.toMiliseconds(t)}function vr(t,e){return`${t}${e?`:${e}`:""}`}function Ud(t=[],e=[]){return[...new Set([...t,...e])]}async function EB({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=SB(s,t,e),a=gl();if(a===Ri.browser){if(!((n=nl())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,PB()?"_blank":"_self","noreferrer noopener")}else a===Ri.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function SB(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${MB(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function AB(t,e){let r="";try{if(pl()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function X3(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function Z3(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function i1(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function PB(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function MB(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function Q3(t){return Buffer.from(t,"base64").toString("utf-8")}const IB="https://rpc.walletconnect.org/v1";async function CB(t,e,r,n,i,s){switch(r.t){case"eip191":return TB(t,e,r.s);case"eip1271":return await RB(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function TB(t,e,r){return yk(Ux(e),r).toLowerCase()===t.toLowerCase()}async function RB(t,e,r,n,i,s){const o=Eu(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",d=r.substring(2),p=Ux(e).substring(2),y=a+p+u+l+d,A=await fetch(`${s||IB}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:DB(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:y},"latest"]})}),{result:P}=await A.json();return P?P.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function DB(){return Date.now()+Math.floor(Math.random()*1e3)}var OB=Object.defineProperty,NB=Object.defineProperties,LB=Object.getOwnPropertyDescriptors,e_=Object.getOwnPropertySymbols,kB=Object.prototype.hasOwnProperty,BB=Object.prototype.propertyIsEnumerable,t_=(t,e,r)=>e in t?OB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$B=(t,e)=>{for(var r in e||(e={}))kB.call(e,r)&&t_(t,r,e[r]);if(e_)for(var r of e_(e))BB.call(e,r)&&t_(t,r,e[r]);return t},FB=(t,e)=>NB(t,LB(e));const jB="did:pkh:",s1=t=>t==null?void 0:t.split(":"),UB=t=>{const e=t&&s1(t);if(e)return t.includes(jB)?e[3]:e[1]},o1=t=>{const e=t&&s1(t);if(e)return e[2]+":"+e[3]},qd=t=>{const e=t&&s1(t);if(e)return e.pop()};async function r_(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=n_(i,i.iss),o=qd(i.iss);return await CB(o,s,n,o1(i.iss),r)}const n_=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=qd(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${UB(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,d=t.exp?`Expiration Time: ${t.exp}`:void 0,p=t.nbf?`Not Before: ${t.nbf}`:void 0,y=t.requestId?`Request ID: ${t.requestId}`:void 0,A=t.resources?`Resources:${t.resources.map(N=>` + */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=nn:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],p=[4,1024,262144,67108864],y=[1,256,65536,16777216],A=[6,1536,393216,100663296],P=[0,8,16,24],N=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],D=[224,256,384,512],k=[128,256],B=["hex","buffer","arrayBuffer","array","digest"],j={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(O){return Object.prototype.toString.call(O)==="[object Array]"}),u&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(O){return typeof O=="object"&&O.buffer&&O.buffer.constructor===ArrayBuffer});for(var U=function(O,se,ee){return function(X){return new I(O,se,O).update(X)[ee]()}},K=function(O,se,ee){return function(X,Q){return new I(O,se,Q).update(X)[ee]()}},J=function(O,se,ee){return function(X,Q,R,Z){return f["cshake"+O].update(X,Q,R,Z)[ee]()}},T=function(O,se,ee){return function(X,Q,R,Z){return f["kmac"+O].update(X,Q,R,Z)[ee]()}},z=function(O,se,ee,X){for(var Q=0;Q>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ee>>5,this.extraBytes=(ee&31)>>3;for(var X=0;X<50;++X)this.s[X]=0}I.prototype.update=function(O){if(this.finalized)throw new Error(r);var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}for(var X=this.blocks,Q=this.byteCount,R=O.length,Z=this.blockCount,te=0,le=this.s,ie,fe;te>2]|=O[te]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(X[ie>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=Q){for(this.start=ie-Q,this.block=X[Z],ie=0;ie>8,ee=O&255;ee>0;)Q.unshift(ee),O=O>>8,ee=O&255,++X;return se?Q.push(X):Q.unshift(X),this.update(Q),Q.length},I.prototype.encodeString=function(O){var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}var X=0,Q=O.length;if(se)X=Q;else for(var R=0;R=57344?X+=3:(Z=65536+((Z&1023)<<10|O.charCodeAt(++R)&1023),X+=4)}return X+=this.encode(X*8),this.update(O),X},I.prototype.bytepad=function(O,se){for(var ee=this.encode(se),X=0;X>2]|=this.padding[se&3],this.lastByteIndex===this.byteCount)for(O[0]=O[ee],se=1;se>4&15]+l[te&15]+l[te>>12&15]+l[te>>8&15]+l[te>>20&15]+l[te>>16&15]+l[te>>28&15]+l[te>>24&15];R%O===0&&(ae(se),Q=0)}return X&&(te=se[Q],Z+=l[te>>4&15]+l[te&15],X>1&&(Z+=l[te>>12&15]+l[te>>8&15]),X>2&&(Z+=l[te>>20&15]+l[te>>16&15])),Z},I.prototype.arrayBuffer=function(){this.finalize();var O=this.blockCount,se=this.s,ee=this.outputBlocks,X=this.extraBytes,Q=0,R=0,Z=this.outputBits>>3,te;X?te=new ArrayBuffer(ee+1<<2):te=new ArrayBuffer(Z);for(var le=new Uint32Array(te);R>8&255,Z[te+2]=le>>16&255,Z[te+3]=le>>24&255;R%O===0&&ae(se)}return X&&(te=R<<2,le=se[Q],Z[te]=le&255,X>1&&(Z[te+1]=le>>8&255),X>2&&(Z[te+2]=le>>16&255)),Z};function F(O,se,ee){I.call(this,O,se,ee)}F.prototype=new I,F.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var ae=function(O){var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me,Ne,Te,$e,Ie,Le,Ve,ke,ze,He,Ee,Qe,ct,Be,et,rt,Je,pt,ht,ft,Ht,Jt,St,er,Xt,Ot,Bt,Tt,vt,Dt,Lt,bt,$t,jt,nt,Ft,$,H,V,C,Y,q,oe,pe,xe,Re,De,it,Ue,gt,st,tt;for(X=0;X<48;X+=2)Q=O[0]^O[10]^O[20]^O[30]^O[40],R=O[1]^O[11]^O[21]^O[31]^O[41],Z=O[2]^O[12]^O[22]^O[32]^O[42],te=O[3]^O[13]^O[23]^O[33]^O[43],le=O[4]^O[14]^O[24]^O[34]^O[44],ie=O[5]^O[15]^O[25]^O[35]^O[45],fe=O[6]^O[16]^O[26]^O[36]^O[46],ve=O[7]^O[17]^O[27]^O[37]^O[47],Me=O[8]^O[18]^O[28]^O[38]^O[48],Ne=O[9]^O[19]^O[29]^O[39]^O[49],se=Me^(Z<<1|te>>>31),ee=Ne^(te<<1|Z>>>31),O[0]^=se,O[1]^=ee,O[10]^=se,O[11]^=ee,O[20]^=se,O[21]^=ee,O[30]^=se,O[31]^=ee,O[40]^=se,O[41]^=ee,se=Q^(le<<1|ie>>>31),ee=R^(ie<<1|le>>>31),O[2]^=se,O[3]^=ee,O[12]^=se,O[13]^=ee,O[22]^=se,O[23]^=ee,O[32]^=se,O[33]^=ee,O[42]^=se,O[43]^=ee,se=Z^(fe<<1|ve>>>31),ee=te^(ve<<1|fe>>>31),O[4]^=se,O[5]^=ee,O[14]^=se,O[15]^=ee,O[24]^=se,O[25]^=ee,O[34]^=se,O[35]^=ee,O[44]^=se,O[45]^=ee,se=le^(Me<<1|Ne>>>31),ee=ie^(Ne<<1|Me>>>31),O[6]^=se,O[7]^=ee,O[16]^=se,O[17]^=ee,O[26]^=se,O[27]^=ee,O[36]^=se,O[37]^=ee,O[46]^=se,O[47]^=ee,se=fe^(Q<<1|R>>>31),ee=ve^(R<<1|Q>>>31),O[8]^=se,O[9]^=ee,O[18]^=se,O[19]^=ee,O[28]^=se,O[29]^=ee,O[38]^=se,O[39]^=ee,O[48]^=se,O[49]^=ee,Te=O[0],$e=O[1],nt=O[11]<<4|O[10]>>>28,Ft=O[10]<<4|O[11]>>>28,Je=O[20]<<3|O[21]>>>29,pt=O[21]<<3|O[20]>>>29,Ue=O[31]<<9|O[30]>>>23,gt=O[30]<<9|O[31]>>>23,Lt=O[40]<<18|O[41]>>>14,bt=O[41]<<18|O[40]>>>14,St=O[2]<<1|O[3]>>>31,er=O[3]<<1|O[2]>>>31,Ie=O[13]<<12|O[12]>>>20,Le=O[12]<<12|O[13]>>>20,$=O[22]<<10|O[23]>>>22,H=O[23]<<10|O[22]>>>22,ht=O[33]<<13|O[32]>>>19,ft=O[32]<<13|O[33]>>>19,st=O[42]<<2|O[43]>>>30,tt=O[43]<<2|O[42]>>>30,oe=O[5]<<30|O[4]>>>2,pe=O[4]<<30|O[5]>>>2,Xt=O[14]<<6|O[15]>>>26,Ot=O[15]<<6|O[14]>>>26,Ve=O[25]<<11|O[24]>>>21,ke=O[24]<<11|O[25]>>>21,V=O[34]<<15|O[35]>>>17,C=O[35]<<15|O[34]>>>17,Ht=O[45]<<29|O[44]>>>3,Jt=O[44]<<29|O[45]>>>3,ct=O[6]<<28|O[7]>>>4,Be=O[7]<<28|O[6]>>>4,xe=O[17]<<23|O[16]>>>9,Re=O[16]<<23|O[17]>>>9,Bt=O[26]<<25|O[27]>>>7,Tt=O[27]<<25|O[26]>>>7,ze=O[36]<<21|O[37]>>>11,He=O[37]<<21|O[36]>>>11,Y=O[47]<<24|O[46]>>>8,q=O[46]<<24|O[47]>>>8,$t=O[8]<<27|O[9]>>>5,jt=O[9]<<27|O[8]>>>5,et=O[18]<<20|O[19]>>>12,rt=O[19]<<20|O[18]>>>12,De=O[29]<<7|O[28]>>>25,it=O[28]<<7|O[29]>>>25,vt=O[38]<<8|O[39]>>>24,Dt=O[39]<<8|O[38]>>>24,Ee=O[48]<<14|O[49]>>>18,Qe=O[49]<<14|O[48]>>>18,O[0]=Te^~Ie&Ve,O[1]=$e^~Le&ke,O[10]=ct^~et&Je,O[11]=Be^~rt&pt,O[20]=St^~Xt&Bt,O[21]=er^~Ot&Tt,O[30]=$t^~nt&$,O[31]=jt^~Ft&H,O[40]=oe^~xe&De,O[41]=pe^~Re&it,O[2]=Ie^~Ve&ze,O[3]=Le^~ke&He,O[12]=et^~Je&ht,O[13]=rt^~pt&ft,O[22]=Xt^~Bt&vt,O[23]=Ot^~Tt&Dt,O[32]=nt^~$&V,O[33]=Ft^~H&C,O[42]=xe^~De&Ue,O[43]=Re^~it>,O[4]=Ve^~ze&Ee,O[5]=ke^~He&Qe,O[14]=Je^~ht&Ht,O[15]=pt^~ft&Jt,O[24]=Bt^~vt&Lt,O[25]=Tt^~Dt&bt,O[34]=$^~V&Y,O[35]=H^~C&q,O[44]=De^~Ue&st,O[45]=it^~gt&tt,O[6]=ze^~Ee&Te,O[7]=He^~Qe&$e,O[16]=ht^~Ht&ct,O[17]=ft^~Jt&Be,O[26]=vt^~Lt&St,O[27]=Dt^~bt&er,O[36]=V^~Y&$t,O[37]=C^~q&jt,O[46]=Ue^~st&oe,O[47]=gt^~tt&pe,O[8]=Ee^~Te&Ie,O[9]=Qe^~$e&Le,O[18]=Ht^~ct&et,O[19]=Jt^~Be&rt,O[28]=Lt^~St&Xt,O[29]=bt^~er&Ot,O[38]=Y^~$t&nt,O[39]=q^~jt&Ft,O[48]=st^~oe&xe,O[49]=tt^~pe&Re,O[0]^=N[X],O[1]^=N[X+1]};if(a)t.exports=f;else for(v=0;v{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const Lx=mN();var wm;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(wm||(wm={}));var ps;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(ps||(ps={}));const kx="0123456789abcdef";class Kr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();vd[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Nx>vd[n])&&console.log.apply(console,r)}debug(...e){this._log(Kr.levels.DEBUG,e)}info(...e){this._log(Kr.levels.INFO,e)}warn(...e){this._log(Kr.levels.WARNING,e)}makeError(e,r,n){if(Ox)return this.makeError("censored error",r,{});r||(r=Kr.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(u=>{const l=n[u];try{if(l instanceof Uint8Array){let d="";for(let p=0;p>4],d+=kx[l[p]&15];i.push(u+"=Uint8Array(0x"+d+")")}else i.push(u+"="+JSON.stringify(l))}catch{i.push(u+"="+JSON.stringify(n[u].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case ps.NUMERIC_FAULT:{o="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case ps.CALL_EXCEPTION:case ps.INSUFFICIENT_FUNDS:case ps.MISSING_NEW:case ps.NONCE_EXPIRED:case ps.REPLACEMENT_UNDERPRICED:case ps.TRANSACTION_REPLACED:case ps.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(u){a[u]=n[u]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Kr.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){Lx&&this.throwError("platform missing String.prototype.normalize",Kr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Lx})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Kr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Kr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return ym||(ym=new Kr(gN)),ym}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Dx){if(!e)return;this.globalLogger().throwError("error censorship permanent",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Ox=!!e,Dx=!!r}static setLogLevel(e){const r=vd[e.toLowerCase()];if(r==null){Kr.globalLogger().warn("invalid log level - "+e);return}Nx=r}static from(e){return new Kr(e)}}Kr.errors=ps,Kr.levels=wm;const vN="bytes/5.7.0",on=new Kr(vN);function Bx(t){return!!t.toHexString}function uu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return uu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function bN(t){return Ns(t)&&!(t.length%2)||xm(t)}function $x(t){return typeof t=="number"&&t==t&&t%1===0}function xm(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!$x(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function bn(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),uu(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),Bx(t)&&(t=t.toHexString()),Ns(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":on.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ibn(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),uu(n)}function wN(t,e){t=bn(t),t.length>e&&on.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),uu(r)}function Ns(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const _m="0123456789abcdef";function Ii(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=_m[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),Bx(t))return t.toHexString();if(Ns(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":on.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(xm(t)){let r="0x";for(let n=0;n>4]+_m[i&15]}return r}return on.throwArgumentError("invalid hexlify value","value",t)}function xN(t){if(typeof t!="string")t=Ii(t);else if(!Ns(t)||t.length%2)return null;return(t.length-2)/2}function Fx(t,e,r){return typeof t!="string"?t=Ii(t):(!Ns(t)||t.length%2)&&on.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function fu(t,e){for(typeof t!="string"?t=Ii(t):Ns(t)||on.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&on.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function jx(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(bN(t)){let r=bn(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64))):r.length===65?(e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64)),e.v=r[64]):on.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:on.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Ii(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=wN(bn(e._vs),32);e._vs=Ii(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&on.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=Ii(i);e.s==null?e.s=o:e.s!==o&&on.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?on.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&on.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Ns(e.r)?on.throwArgumentError("signature missing or invalid r","signature",t):e.r=fu(e.r,32),e.s==null||!Ns(e.s)?on.throwArgumentError("signature missing or invalid s","signature",t):e.s=fu(e.s,32);const r=bn(e.s);r[0]>=128&&on.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=Ii(r);e._vs&&(Ns(e._vs)||on.throwArgumentError("signature invalid _vs","signature",t),e._vs=fu(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&on.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Em(t){return"0x"+pN.keccak_256(bn(t))}var Sm={exports:{}};Sm.exports,function(t){(function(e,r){function n(m,f){if(!m)throw new Error(f||"Assertion failed")}function i(m,f){m.super_=f;var g=function(){};g.prototype=f.prototype,m.prototype=new g,m.prototype.constructor=m}function s(m,f,g){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((f==="le"||f==="be")&&(g=f,f=10),this._init(m||0,f||10,g||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,g){return f.cmp(g)>0?f:g},s.min=function(f,g){return f.cmp(g)<0?f:g},s.prototype._init=function(f,g,v){if(typeof f=="number")return this._initNumber(f,g,v);if(typeof f=="object")return this._initArray(f,g,v);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),f=f.toString().replace(/\s+/g,"");var x=0;f[0]==="-"&&(x++,this.negative=1),x=0;x-=3)S=f[x]|f[x-1]<<8|f[x-2]<<16,this.words[_]|=S<>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);else if(v==="le")for(x=0,_=0;x>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);return this._strip()};function a(m,f){var g=m.charCodeAt(f);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+m)}function u(m,f,g){var v=a(m,g);return g-1>=f&&(v|=a(m,g-1)<<4),v}s.prototype._parseHex=function(f,g,v){this.length=Math.ceil((f.length-g)/6),this.words=new Array(this.length);for(var x=0;x=g;x-=2)b=u(f,g,x)<<_,this.words[S]|=b&67108863,_>=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8;else{var M=f.length-g;for(x=M%2===0?g+1:g;x=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8}this._strip()};function l(m,f,g,v){for(var x=0,_=0,S=Math.min(m.length,g),b=f;b=49?_=M-49+10:M>=17?_=M-17+10:_=M,n(M>=0&&_1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{s.prototype.inspect=p}else s.prototype.inspect=p;function p(){return(this.red?""}var y=["","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"],A=[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,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(f,g){f=f||10,g=g|0||1;var v;if(f===16||f==="hex"){v="";for(var x=0,_=0,S=0;S>>24-x&16777215,x+=2,x>=26&&(x-=26,S--),_!==0||S!==this.length-1?v=y[6-M.length]+M+v:v=M+v}for(_!==0&&(v=_.toString(16)+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(f===(f|0)&&f>=2&&f<=36){var I=A[f],F=P[f];v="";var ae=this.clone();for(ae.negative=0;!ae.isZero();){var O=ae.modrn(F).toString(f);ae=ae.idivn(F),ae.isZero()?v=O+v:v=y[I-O.length]+O+v}for(this.isZero()&&(v="0"+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,g){return this.toArrayLike(o,f,g)}),s.prototype.toArray=function(f,g){return this.toArrayLike(Array,f,g)};var N=function(f,g){return f.allocUnsafe?f.allocUnsafe(g):new f(g)};s.prototype.toArrayLike=function(f,g,v){this._strip();var x=this.byteLength(),_=v||Math.max(1,x);n(x<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var S=N(f,_),b=g==="le"?"LE":"BE";return this["_toArrayLike"+b](S,x),S},s.prototype._toArrayLikeLE=function(f,g){for(var v=0,x=0,_=0,S=0;_>8&255),v>16&255),S===6?(v>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v=0&&(f[v--]=b>>8&255),v>=0&&(f[v--]=b>>16&255),S===6?(v>=0&&(f[v--]=b>>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v>=0)for(f[v--]=x;v>=0;)f[v--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var g=f,v=0;return g>=4096&&(v+=13,g>>>=13),g>=64&&(v+=7,g>>>=7),g>=8&&(v+=4,g>>>=4),g>=2&&(v+=2,g>>>=2),v+g},s.prototype._zeroBits=function(f){if(f===0)return 26;var g=f,v=0;return g&8191||(v+=13,g>>>=13),g&127||(v+=7,g>>>=7),g&15||(v+=4,g>>>=4),g&3||(v+=2,g>>>=2),g&1||v++,v},s.prototype.bitLength=function(){var f=this.words[this.length-1],g=this._countBits(f);return(this.length-1)*26+g};function D(m){for(var f=new Array(m.bitLength()),g=0;g>>x&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,g=0;gf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var g;this.length>f.length?g=f:g=this;for(var v=0;vf.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var g,v;this.length>f.length?(g=this,v=f):(g=f,v=this);for(var x=0;xf.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var g=Math.ceil(f/26)|0,v=f%26;this._expand(g),v>0&&g--;for(var x=0;x0&&(this.words[x]=~this.words[x]&67108863>>26-v),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,g){n(typeof f=="number"&&f>=0);var v=f/26|0,x=f%26;return this._expand(v+1),g?this.words[v]=this.words[v]|1<f.length?(v=this,x=f):(v=f,x=this);for(var _=0,S=0;S>>26;for(;_!==0&&S>>26;if(this.length=v.length,_!==0)this.words[this.length]=_,this.length++;else if(v!==this)for(;Sf.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var g=this.iadd(f);return f.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var v=this.cmp(f);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,_;v>0?(x=this,_=f):(x=f,_=this);for(var S=0,b=0;b<_.length;b++)g=(x.words[b]|0)-(_.words[b]|0)+S,S=g>>26,this.words[b]=g&67108863;for(;S!==0&&b>26,this.words[b]=g&67108863;if(S===0&&b>>26,ae=M&67108863,O=Math.min(I,f.length-1),se=Math.max(0,I-m.length+1);se<=O;se++){var ee=I-se|0;x=m.words[ee]|0,_=f.words[se]|0,S=x*_+ae,F+=S/67108864|0,ae=S&67108863}g.words[I]=ae|0,M=F|0}return M!==0?g.words[I]=M|0:g.length--,g._strip()}var B=function(f,g,v){var x=f.words,_=g.words,S=v.words,b=0,M,I,F,ae=x[0]|0,O=ae&8191,se=ae>>>13,ee=x[1]|0,X=ee&8191,Q=ee>>>13,R=x[2]|0,Z=R&8191,te=R>>>13,le=x[3]|0,ie=le&8191,fe=le>>>13,ve=x[4]|0,Me=ve&8191,Ne=ve>>>13,Te=x[5]|0,$e=Te&8191,Ie=Te>>>13,Le=x[6]|0,Ve=Le&8191,ke=Le>>>13,ze=x[7]|0,He=ze&8191,Ee=ze>>>13,Qe=x[8]|0,ct=Qe&8191,Be=Qe>>>13,et=x[9]|0,rt=et&8191,Je=et>>>13,pt=_[0]|0,ht=pt&8191,ft=pt>>>13,Ht=_[1]|0,Jt=Ht&8191,St=Ht>>>13,er=_[2]|0,Xt=er&8191,Ot=er>>>13,Bt=_[3]|0,Tt=Bt&8191,vt=Bt>>>13,Dt=_[4]|0,Lt=Dt&8191,bt=Dt>>>13,$t=_[5]|0,jt=$t&8191,nt=$t>>>13,Ft=_[6]|0,$=Ft&8191,H=Ft>>>13,V=_[7]|0,C=V&8191,Y=V>>>13,q=_[8]|0,oe=q&8191,pe=q>>>13,xe=_[9]|0,Re=xe&8191,De=xe>>>13;v.negative=f.negative^g.negative,v.length=19,M=Math.imul(O,ht),I=Math.imul(O,ft),I=I+Math.imul(se,ht)|0,F=Math.imul(se,ft);var it=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(it>>>26)|0,it&=67108863,M=Math.imul(X,ht),I=Math.imul(X,ft),I=I+Math.imul(Q,ht)|0,F=Math.imul(Q,ft),M=M+Math.imul(O,Jt)|0,I=I+Math.imul(O,St)|0,I=I+Math.imul(se,Jt)|0,F=F+Math.imul(se,St)|0;var Ue=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,M=Math.imul(Z,ht),I=Math.imul(Z,ft),I=I+Math.imul(te,ht)|0,F=Math.imul(te,ft),M=M+Math.imul(X,Jt)|0,I=I+Math.imul(X,St)|0,I=I+Math.imul(Q,Jt)|0,F=F+Math.imul(Q,St)|0,M=M+Math.imul(O,Xt)|0,I=I+Math.imul(O,Ot)|0,I=I+Math.imul(se,Xt)|0,F=F+Math.imul(se,Ot)|0;var gt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(gt>>>26)|0,gt&=67108863,M=Math.imul(ie,ht),I=Math.imul(ie,ft),I=I+Math.imul(fe,ht)|0,F=Math.imul(fe,ft),M=M+Math.imul(Z,Jt)|0,I=I+Math.imul(Z,St)|0,I=I+Math.imul(te,Jt)|0,F=F+Math.imul(te,St)|0,M=M+Math.imul(X,Xt)|0,I=I+Math.imul(X,Ot)|0,I=I+Math.imul(Q,Xt)|0,F=F+Math.imul(Q,Ot)|0,M=M+Math.imul(O,Tt)|0,I=I+Math.imul(O,vt)|0,I=I+Math.imul(se,Tt)|0,F=F+Math.imul(se,vt)|0;var st=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(st>>>26)|0,st&=67108863,M=Math.imul(Me,ht),I=Math.imul(Me,ft),I=I+Math.imul(Ne,ht)|0,F=Math.imul(Ne,ft),M=M+Math.imul(ie,Jt)|0,I=I+Math.imul(ie,St)|0,I=I+Math.imul(fe,Jt)|0,F=F+Math.imul(fe,St)|0,M=M+Math.imul(Z,Xt)|0,I=I+Math.imul(Z,Ot)|0,I=I+Math.imul(te,Xt)|0,F=F+Math.imul(te,Ot)|0,M=M+Math.imul(X,Tt)|0,I=I+Math.imul(X,vt)|0,I=I+Math.imul(Q,Tt)|0,F=F+Math.imul(Q,vt)|0,M=M+Math.imul(O,Lt)|0,I=I+Math.imul(O,bt)|0,I=I+Math.imul(se,Lt)|0,F=F+Math.imul(se,bt)|0;var tt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(tt>>>26)|0,tt&=67108863,M=Math.imul($e,ht),I=Math.imul($e,ft),I=I+Math.imul(Ie,ht)|0,F=Math.imul(Ie,ft),M=M+Math.imul(Me,Jt)|0,I=I+Math.imul(Me,St)|0,I=I+Math.imul(Ne,Jt)|0,F=F+Math.imul(Ne,St)|0,M=M+Math.imul(ie,Xt)|0,I=I+Math.imul(ie,Ot)|0,I=I+Math.imul(fe,Xt)|0,F=F+Math.imul(fe,Ot)|0,M=M+Math.imul(Z,Tt)|0,I=I+Math.imul(Z,vt)|0,I=I+Math.imul(te,Tt)|0,F=F+Math.imul(te,vt)|0,M=M+Math.imul(X,Lt)|0,I=I+Math.imul(X,bt)|0,I=I+Math.imul(Q,Lt)|0,F=F+Math.imul(Q,bt)|0,M=M+Math.imul(O,jt)|0,I=I+Math.imul(O,nt)|0,I=I+Math.imul(se,jt)|0,F=F+Math.imul(se,nt)|0;var At=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(At>>>26)|0,At&=67108863,M=Math.imul(Ve,ht),I=Math.imul(Ve,ft),I=I+Math.imul(ke,ht)|0,F=Math.imul(ke,ft),M=M+Math.imul($e,Jt)|0,I=I+Math.imul($e,St)|0,I=I+Math.imul(Ie,Jt)|0,F=F+Math.imul(Ie,St)|0,M=M+Math.imul(Me,Xt)|0,I=I+Math.imul(Me,Ot)|0,I=I+Math.imul(Ne,Xt)|0,F=F+Math.imul(Ne,Ot)|0,M=M+Math.imul(ie,Tt)|0,I=I+Math.imul(ie,vt)|0,I=I+Math.imul(fe,Tt)|0,F=F+Math.imul(fe,vt)|0,M=M+Math.imul(Z,Lt)|0,I=I+Math.imul(Z,bt)|0,I=I+Math.imul(te,Lt)|0,F=F+Math.imul(te,bt)|0,M=M+Math.imul(X,jt)|0,I=I+Math.imul(X,nt)|0,I=I+Math.imul(Q,jt)|0,F=F+Math.imul(Q,nt)|0,M=M+Math.imul(O,$)|0,I=I+Math.imul(O,H)|0,I=I+Math.imul(se,$)|0,F=F+Math.imul(se,H)|0;var Rt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,M=Math.imul(He,ht),I=Math.imul(He,ft),I=I+Math.imul(Ee,ht)|0,F=Math.imul(Ee,ft),M=M+Math.imul(Ve,Jt)|0,I=I+Math.imul(Ve,St)|0,I=I+Math.imul(ke,Jt)|0,F=F+Math.imul(ke,St)|0,M=M+Math.imul($e,Xt)|0,I=I+Math.imul($e,Ot)|0,I=I+Math.imul(Ie,Xt)|0,F=F+Math.imul(Ie,Ot)|0,M=M+Math.imul(Me,Tt)|0,I=I+Math.imul(Me,vt)|0,I=I+Math.imul(Ne,Tt)|0,F=F+Math.imul(Ne,vt)|0,M=M+Math.imul(ie,Lt)|0,I=I+Math.imul(ie,bt)|0,I=I+Math.imul(fe,Lt)|0,F=F+Math.imul(fe,bt)|0,M=M+Math.imul(Z,jt)|0,I=I+Math.imul(Z,nt)|0,I=I+Math.imul(te,jt)|0,F=F+Math.imul(te,nt)|0,M=M+Math.imul(X,$)|0,I=I+Math.imul(X,H)|0,I=I+Math.imul(Q,$)|0,F=F+Math.imul(Q,H)|0,M=M+Math.imul(O,C)|0,I=I+Math.imul(O,Y)|0,I=I+Math.imul(se,C)|0,F=F+Math.imul(se,Y)|0;var Mt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,M=Math.imul(ct,ht),I=Math.imul(ct,ft),I=I+Math.imul(Be,ht)|0,F=Math.imul(Be,ft),M=M+Math.imul(He,Jt)|0,I=I+Math.imul(He,St)|0,I=I+Math.imul(Ee,Jt)|0,F=F+Math.imul(Ee,St)|0,M=M+Math.imul(Ve,Xt)|0,I=I+Math.imul(Ve,Ot)|0,I=I+Math.imul(ke,Xt)|0,F=F+Math.imul(ke,Ot)|0,M=M+Math.imul($e,Tt)|0,I=I+Math.imul($e,vt)|0,I=I+Math.imul(Ie,Tt)|0,F=F+Math.imul(Ie,vt)|0,M=M+Math.imul(Me,Lt)|0,I=I+Math.imul(Me,bt)|0,I=I+Math.imul(Ne,Lt)|0,F=F+Math.imul(Ne,bt)|0,M=M+Math.imul(ie,jt)|0,I=I+Math.imul(ie,nt)|0,I=I+Math.imul(fe,jt)|0,F=F+Math.imul(fe,nt)|0,M=M+Math.imul(Z,$)|0,I=I+Math.imul(Z,H)|0,I=I+Math.imul(te,$)|0,F=F+Math.imul(te,H)|0,M=M+Math.imul(X,C)|0,I=I+Math.imul(X,Y)|0,I=I+Math.imul(Q,C)|0,F=F+Math.imul(Q,Y)|0,M=M+Math.imul(O,oe)|0,I=I+Math.imul(O,pe)|0,I=I+Math.imul(se,oe)|0,F=F+Math.imul(se,pe)|0;var Et=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Et>>>26)|0,Et&=67108863,M=Math.imul(rt,ht),I=Math.imul(rt,ft),I=I+Math.imul(Je,ht)|0,F=Math.imul(Je,ft),M=M+Math.imul(ct,Jt)|0,I=I+Math.imul(ct,St)|0,I=I+Math.imul(Be,Jt)|0,F=F+Math.imul(Be,St)|0,M=M+Math.imul(He,Xt)|0,I=I+Math.imul(He,Ot)|0,I=I+Math.imul(Ee,Xt)|0,F=F+Math.imul(Ee,Ot)|0,M=M+Math.imul(Ve,Tt)|0,I=I+Math.imul(Ve,vt)|0,I=I+Math.imul(ke,Tt)|0,F=F+Math.imul(ke,vt)|0,M=M+Math.imul($e,Lt)|0,I=I+Math.imul($e,bt)|0,I=I+Math.imul(Ie,Lt)|0,F=F+Math.imul(Ie,bt)|0,M=M+Math.imul(Me,jt)|0,I=I+Math.imul(Me,nt)|0,I=I+Math.imul(Ne,jt)|0,F=F+Math.imul(Ne,nt)|0,M=M+Math.imul(ie,$)|0,I=I+Math.imul(ie,H)|0,I=I+Math.imul(fe,$)|0,F=F+Math.imul(fe,H)|0,M=M+Math.imul(Z,C)|0,I=I+Math.imul(Z,Y)|0,I=I+Math.imul(te,C)|0,F=F+Math.imul(te,Y)|0,M=M+Math.imul(X,oe)|0,I=I+Math.imul(X,pe)|0,I=I+Math.imul(Q,oe)|0,F=F+Math.imul(Q,pe)|0,M=M+Math.imul(O,Re)|0,I=I+Math.imul(O,De)|0,I=I+Math.imul(se,Re)|0,F=F+Math.imul(se,De)|0;var dt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(dt>>>26)|0,dt&=67108863,M=Math.imul(rt,Jt),I=Math.imul(rt,St),I=I+Math.imul(Je,Jt)|0,F=Math.imul(Je,St),M=M+Math.imul(ct,Xt)|0,I=I+Math.imul(ct,Ot)|0,I=I+Math.imul(Be,Xt)|0,F=F+Math.imul(Be,Ot)|0,M=M+Math.imul(He,Tt)|0,I=I+Math.imul(He,vt)|0,I=I+Math.imul(Ee,Tt)|0,F=F+Math.imul(Ee,vt)|0,M=M+Math.imul(Ve,Lt)|0,I=I+Math.imul(Ve,bt)|0,I=I+Math.imul(ke,Lt)|0,F=F+Math.imul(ke,bt)|0,M=M+Math.imul($e,jt)|0,I=I+Math.imul($e,nt)|0,I=I+Math.imul(Ie,jt)|0,F=F+Math.imul(Ie,nt)|0,M=M+Math.imul(Me,$)|0,I=I+Math.imul(Me,H)|0,I=I+Math.imul(Ne,$)|0,F=F+Math.imul(Ne,H)|0,M=M+Math.imul(ie,C)|0,I=I+Math.imul(ie,Y)|0,I=I+Math.imul(fe,C)|0,F=F+Math.imul(fe,Y)|0,M=M+Math.imul(Z,oe)|0,I=I+Math.imul(Z,pe)|0,I=I+Math.imul(te,oe)|0,F=F+Math.imul(te,pe)|0,M=M+Math.imul(X,Re)|0,I=I+Math.imul(X,De)|0,I=I+Math.imul(Q,Re)|0,F=F+Math.imul(Q,De)|0;var _t=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(_t>>>26)|0,_t&=67108863,M=Math.imul(rt,Xt),I=Math.imul(rt,Ot),I=I+Math.imul(Je,Xt)|0,F=Math.imul(Je,Ot),M=M+Math.imul(ct,Tt)|0,I=I+Math.imul(ct,vt)|0,I=I+Math.imul(Be,Tt)|0,F=F+Math.imul(Be,vt)|0,M=M+Math.imul(He,Lt)|0,I=I+Math.imul(He,bt)|0,I=I+Math.imul(Ee,Lt)|0,F=F+Math.imul(Ee,bt)|0,M=M+Math.imul(Ve,jt)|0,I=I+Math.imul(Ve,nt)|0,I=I+Math.imul(ke,jt)|0,F=F+Math.imul(ke,nt)|0,M=M+Math.imul($e,$)|0,I=I+Math.imul($e,H)|0,I=I+Math.imul(Ie,$)|0,F=F+Math.imul(Ie,H)|0,M=M+Math.imul(Me,C)|0,I=I+Math.imul(Me,Y)|0,I=I+Math.imul(Ne,C)|0,F=F+Math.imul(Ne,Y)|0,M=M+Math.imul(ie,oe)|0,I=I+Math.imul(ie,pe)|0,I=I+Math.imul(fe,oe)|0,F=F+Math.imul(fe,pe)|0,M=M+Math.imul(Z,Re)|0,I=I+Math.imul(Z,De)|0,I=I+Math.imul(te,Re)|0,F=F+Math.imul(te,De)|0;var ot=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(ot>>>26)|0,ot&=67108863,M=Math.imul(rt,Tt),I=Math.imul(rt,vt),I=I+Math.imul(Je,Tt)|0,F=Math.imul(Je,vt),M=M+Math.imul(ct,Lt)|0,I=I+Math.imul(ct,bt)|0,I=I+Math.imul(Be,Lt)|0,F=F+Math.imul(Be,bt)|0,M=M+Math.imul(He,jt)|0,I=I+Math.imul(He,nt)|0,I=I+Math.imul(Ee,jt)|0,F=F+Math.imul(Ee,nt)|0,M=M+Math.imul(Ve,$)|0,I=I+Math.imul(Ve,H)|0,I=I+Math.imul(ke,$)|0,F=F+Math.imul(ke,H)|0,M=M+Math.imul($e,C)|0,I=I+Math.imul($e,Y)|0,I=I+Math.imul(Ie,C)|0,F=F+Math.imul(Ie,Y)|0,M=M+Math.imul(Me,oe)|0,I=I+Math.imul(Me,pe)|0,I=I+Math.imul(Ne,oe)|0,F=F+Math.imul(Ne,pe)|0,M=M+Math.imul(ie,Re)|0,I=I+Math.imul(ie,De)|0,I=I+Math.imul(fe,Re)|0,F=F+Math.imul(fe,De)|0;var wt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(wt>>>26)|0,wt&=67108863,M=Math.imul(rt,Lt),I=Math.imul(rt,bt),I=I+Math.imul(Je,Lt)|0,F=Math.imul(Je,bt),M=M+Math.imul(ct,jt)|0,I=I+Math.imul(ct,nt)|0,I=I+Math.imul(Be,jt)|0,F=F+Math.imul(Be,nt)|0,M=M+Math.imul(He,$)|0,I=I+Math.imul(He,H)|0,I=I+Math.imul(Ee,$)|0,F=F+Math.imul(Ee,H)|0,M=M+Math.imul(Ve,C)|0,I=I+Math.imul(Ve,Y)|0,I=I+Math.imul(ke,C)|0,F=F+Math.imul(ke,Y)|0,M=M+Math.imul($e,oe)|0,I=I+Math.imul($e,pe)|0,I=I+Math.imul(Ie,oe)|0,F=F+Math.imul(Ie,pe)|0,M=M+Math.imul(Me,Re)|0,I=I+Math.imul(Me,De)|0,I=I+Math.imul(Ne,Re)|0,F=F+Math.imul(Ne,De)|0;var lt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(lt>>>26)|0,lt&=67108863,M=Math.imul(rt,jt),I=Math.imul(rt,nt),I=I+Math.imul(Je,jt)|0,F=Math.imul(Je,nt),M=M+Math.imul(ct,$)|0,I=I+Math.imul(ct,H)|0,I=I+Math.imul(Be,$)|0,F=F+Math.imul(Be,H)|0,M=M+Math.imul(He,C)|0,I=I+Math.imul(He,Y)|0,I=I+Math.imul(Ee,C)|0,F=F+Math.imul(Ee,Y)|0,M=M+Math.imul(Ve,oe)|0,I=I+Math.imul(Ve,pe)|0,I=I+Math.imul(ke,oe)|0,F=F+Math.imul(ke,pe)|0,M=M+Math.imul($e,Re)|0,I=I+Math.imul($e,De)|0,I=I+Math.imul(Ie,Re)|0,F=F+Math.imul(Ie,De)|0;var at=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(at>>>26)|0,at&=67108863,M=Math.imul(rt,$),I=Math.imul(rt,H),I=I+Math.imul(Je,$)|0,F=Math.imul(Je,H),M=M+Math.imul(ct,C)|0,I=I+Math.imul(ct,Y)|0,I=I+Math.imul(Be,C)|0,F=F+Math.imul(Be,Y)|0,M=M+Math.imul(He,oe)|0,I=I+Math.imul(He,pe)|0,I=I+Math.imul(Ee,oe)|0,F=F+Math.imul(Ee,pe)|0,M=M+Math.imul(Ve,Re)|0,I=I+Math.imul(Ve,De)|0,I=I+Math.imul(ke,Re)|0,F=F+Math.imul(ke,De)|0;var Ae=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,M=Math.imul(rt,C),I=Math.imul(rt,Y),I=I+Math.imul(Je,C)|0,F=Math.imul(Je,Y),M=M+Math.imul(ct,oe)|0,I=I+Math.imul(ct,pe)|0,I=I+Math.imul(Be,oe)|0,F=F+Math.imul(Be,pe)|0,M=M+Math.imul(He,Re)|0,I=I+Math.imul(He,De)|0,I=I+Math.imul(Ee,Re)|0,F=F+Math.imul(Ee,De)|0;var Pe=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,M=Math.imul(rt,oe),I=Math.imul(rt,pe),I=I+Math.imul(Je,oe)|0,F=Math.imul(Je,pe),M=M+Math.imul(ct,Re)|0,I=I+Math.imul(ct,De)|0,I=I+Math.imul(Be,Re)|0,F=F+Math.imul(Be,De)|0;var Ge=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,M=Math.imul(rt,Re),I=Math.imul(rt,De),I=I+Math.imul(Je,Re)|0,F=Math.imul(Je,De);var je=(b+M|0)+((I&8191)<<13)|0;return b=(F+(I>>>13)|0)+(je>>>26)|0,je&=67108863,S[0]=it,S[1]=Ue,S[2]=gt,S[3]=st,S[4]=tt,S[5]=At,S[6]=Rt,S[7]=Mt,S[8]=Et,S[9]=dt,S[10]=_t,S[11]=ot,S[12]=wt,S[13]=lt,S[14]=at,S[15]=Ae,S[16]=Pe,S[17]=Ge,S[18]=je,b!==0&&(S[19]=b,v.length++),v};Math.imul||(B=k);function j(m,f,g){g.negative=f.negative^m.negative,g.length=m.length+f.length;for(var v=0,x=0,_=0;_>>26)|0,x+=S>>>26,S&=67108863}g.words[_]=b,v=S,S=x}return v!==0?g.words[_]=v:g.length--,g._strip()}function U(m,f,g){return j(m,f,g)}s.prototype.mulTo=function(f,g){var v,x=this.length+f.length;return this.length===10&&f.length===10?v=B(this,f,g):x<63?v=k(this,f,g):x<1024?v=j(this,f,g):v=U(this,f,g),v},s.prototype.mul=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),this.mulTo(f,g)},s.prototype.mulf=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),U(this,f,g)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var g=f<0;g&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var v=0,x=0;x>=26,v+=_/67108864|0,v+=S>>>26,this.words[x]=S&67108863}return v!==0&&(this.words[x]=v,this.length++),g?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var g=D(f);if(g.length===0)return new s(1);for(var v=this,x=0;x=0);var g=f%26,v=(f-g)/26,x=67108863>>>26-g<<26-g,_;if(g!==0){var S=0;for(_=0;_>>26-g}S&&(this.words[_]=S,this.length++)}if(v!==0){for(_=this.length-1;_>=0;_--)this.words[_+v]=this.words[_];for(_=0;_=0);var x;g?x=(g-g%26)/26:x=0;var _=f%26,S=Math.min((f-_)/26,this.length),b=67108863^67108863>>>_<<_,M=v;if(x-=S,x=Math.max(0,x),M){for(var I=0;IS)for(this.length-=S,I=0;I=0&&(F!==0||I>=x);I--){var ae=this.words[I]|0;this.words[I]=F<<26-_|ae>>>_,F=ae&b}return M&&F!==0&&(M.words[M.length++]=F),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,g,v){return n(this.negative===0),this.iushrn(f,g,v)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var g=f%26,v=(f-g)/26,x=1<=0);var g=f%26,v=(f-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(g!==0&&v++,this.length=Math.min(v,this.length),g!==0){var x=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(M/67108864|0),this.words[_+v]=S&67108863}for(;_>26,this.words[_+v]=S&67108863;if(b===0)return this._strip();for(n(b===-1),b=0,_=0;_>26,this.words[_]=S&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,g){var v=this.length-f.length,x=this.clone(),_=f,S=_.words[_.length-1]|0,b=this._countBits(S);v=26-b,v!==0&&(_=_.ushln(v),x.iushln(v),S=_.words[_.length-1]|0);var M=x.length-_.length,I;if(g!=="mod"){I=new s(null),I.length=M+1,I.words=new Array(I.length);for(var F=0;F=0;O--){var se=(x.words[_.length+O]|0)*67108864+(x.words[_.length+O-1]|0);for(se=Math.min(se/S|0,67108863),x._ishlnsubmul(_,se,O);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(_,1,O),x.isZero()||(x.negative^=1);I&&(I.words[O]=se)}return I&&I._strip(),x._strip(),g!=="div"&&v!==0&&x.iushrn(v),{div:I||null,mod:x}},s.prototype.divmod=function(f,g,v){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,_,S;return this.negative!==0&&f.negative===0?(S=this.neg().divmod(f,g),g!=="mod"&&(x=S.div.neg()),g!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.iadd(f)),{div:x,mod:_}):this.negative===0&&f.negative!==0?(S=this.divmod(f.neg(),g),g!=="mod"&&(x=S.div.neg()),{div:x,mod:S.mod}):this.negative&f.negative?(S=this.neg().divmod(f.neg(),g),g!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.isub(f)),{div:S.div,mod:_}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?g==="div"?{div:this.divn(f.words[0]),mod:null}:g==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,g)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var g=this.divmod(f);if(g.mod.isZero())return g.div;var v=g.div.negative!==0?g.mod.isub(f):g.mod,x=f.ushrn(1),_=f.andln(1),S=v.cmp(x);return S<0||_===1&&S===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},s.prototype.modrn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=(1<<26)%f,x=0,_=this.length-1;_>=0;_--)x=(v*x+(this.words[_]|0))%f;return g?-x:x},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=0,x=this.length-1;x>=0;x--){var _=(this.words[x]|0)+v*67108864;this.words[x]=_/f|0,v=_%f}return this._strip(),g?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),_=new s(0),S=new s(0),b=new s(1),M=0;g.isEven()&&v.isEven();)g.iushrn(1),v.iushrn(1),++M;for(var I=v.clone(),F=g.clone();!g.isZero();){for(var ae=0,O=1;!(g.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(g.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(I),_.isub(F)),x.iushrn(1),_.iushrn(1);for(var se=0,ee=1;!(v.words[0]&ee)&&se<26;++se,ee<<=1);if(se>0)for(v.iushrn(se);se-- >0;)(S.isOdd()||b.isOdd())&&(S.iadd(I),b.isub(F)),S.iushrn(1),b.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(S),_.isub(b)):(v.isub(g),S.isub(x),b.isub(_))}return{a:S,b,gcd:v.iushln(M)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),_=new s(0),S=v.clone();g.cmpn(1)>0&&v.cmpn(1)>0;){for(var b=0,M=1;!(g.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(g.iushrn(b);b-- >0;)x.isOdd()&&x.iadd(S),x.iushrn(1);for(var I=0,F=1;!(v.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(v.iushrn(I);I-- >0;)_.isOdd()&&_.iadd(S),_.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(_)):(v.isub(g),_.isub(x))}var ae;return g.cmpn(1)===0?ae=x:ae=_,ae.cmpn(0)<0&&ae.iadd(f),ae},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var g=this.clone(),v=f.clone();g.negative=0,v.negative=0;for(var x=0;g.isEven()&&v.isEven();x++)g.iushrn(1),v.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;v.isEven();)v.iushrn(1);var _=g.cmp(v);if(_<0){var S=g;g=v,v=S}else if(_===0||v.cmpn(1)===0)break;g.isub(v)}while(!0);return v.iushln(x)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var g=f%26,v=(f-g)/26,x=1<>>26,b&=67108863,this.words[S]=b}return _!==0&&(this.words[S]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var g=f<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var v;if(this.length>1)v=1;else{g&&(f=-f),n(f<=67108863,"Number is too big");var x=this.words[0]|0;v=x===f?0:xf.length)return 1;if(this.length=0;v--){var x=this.words[v]|0,_=f.words[v]|0;if(x!==_){x<_?g=-1:x>_&&(g=1);break}}return g},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new G(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var K={k256:null,p224:null,p192:null,p25519:null};function J(m,f){this.name=m,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}J.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},J.prototype.ireduce=function(f){var g=f,v;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),v=g.bitLength();while(v>this.n);var x=v0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},J.prototype.split=function(f,g){f.iushrn(this.n,0,g)},J.prototype.imulK=function(f){return f.imul(this.k)};function T(){J.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(T,J),T.prototype.split=function(f,g){for(var v=4194303,x=Math.min(f.length,9),_=0;_>>22,S=b}S>>>=22,f.words[_-10]=S,S===0&&f.length>10?f.length-=10:f.length-=9},T.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var g=0,v=0;v>>=26,f.words[v]=_,g=x}return g!==0&&(f.words[f.length++]=g),f},s._prime=function(f){if(K[f])return K[f];var g;if(f==="k256")g=new T;else if(f==="p224")g=new z;else if(f==="p192")g=new ue;else if(f==="p25519")g=new _e;else throw new Error("Unknown prime "+f);return K[f]=g,g};function G(m){if(typeof m=="string"){var f=s._prime(m);this.m=f.p,this.prime=f}else n(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}G.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},G.prototype._verify2=function(f,g){n((f.negative|g.negative)===0,"red works only with positives"),n(f.red&&f.red===g.red,"red works only with red numbers")},G.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(d(f,f.umod(this.m)._forceRed(this)),f)},G.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},G.prototype.add=function(f,g){this._verify2(f,g);var v=f.add(g);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},G.prototype.iadd=function(f,g){this._verify2(f,g);var v=f.iadd(g);return v.cmp(this.m)>=0&&v.isub(this.m),v},G.prototype.sub=function(f,g){this._verify2(f,g);var v=f.sub(g);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},G.prototype.isub=function(f,g){this._verify2(f,g);var v=f.isub(g);return v.cmpn(0)<0&&v.iadd(this.m),v},G.prototype.shl=function(f,g){return this._verify1(f),this.imod(f.ushln(g))},G.prototype.imul=function(f,g){return this._verify2(f,g),this.imod(f.imul(g))},G.prototype.mul=function(f,g){return this._verify2(f,g),this.imod(f.mul(g))},G.prototype.isqr=function(f){return this.imul(f,f.clone())},G.prototype.sqr=function(f){return this.mul(f,f)},G.prototype.sqrt=function(f){if(f.isZero())return f.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(f,v)}for(var x=this.m.subn(1),_=0;!x.isZero()&&x.andln(1)===0;)_++,x.iushrn(1);n(!x.isZero());var S=new s(1).toRed(this),b=S.redNeg(),M=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,M).cmp(b)!==0;)I.redIAdd(b);for(var F=this.pow(I,x),ae=this.pow(f,x.addn(1).iushrn(1)),O=this.pow(f,x),se=_;O.cmp(S)!==0;){for(var ee=O,X=0;ee.cmp(S)!==0;X++)ee=ee.redSqr();n(X=0;_--){for(var F=g.words[_],ae=I-1;ae>=0;ae--){var O=F>>ae&1;if(S!==x[0]&&(S=this.sqr(S)),O===0&&b===0){M=0;continue}b<<=1,b|=O,M++,!(M!==v&&(_!==0||ae!==0))&&(S=this.mul(S,x[b]),M=0,b=0)}I=26}return S},G.prototype.convertTo=function(f){var g=f.umod(this.m);return g===f?g.clone():g},G.prototype.convertFrom=function(f){var g=f.clone();return g.red=null,g},s.mont=function(f){return new E(f)};function E(m){G.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(E,G),E.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},E.prototype.convertFrom=function(f){var g=this.imod(f.mul(this.rinv));return g.red=null,g},E.prototype.imul=function(f,g){if(f.isZero()||g.isZero())return f.words[0]=0,f.length=1,f;var v=f.imul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.mul=function(f,g){if(f.isZero()||g.isZero())return new s(0)._forceRed(this);var v=f.mul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.invm=function(f){var g=this.imod(f._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,nn)}(Sm);var _N=Sm.exports;const rr=ji(_N);var EN=rr.BN;function SN(t){return new EN(t,36).toString(16)}const AN="strings/5.7.0",PN=new Kr(AN);var bd;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(bd||(bd={}));var Ux;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(Ux||(Ux={}));function Am(t,e=bd.current){e!=bd.current&&(PN.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return bn(r)}const MN=`Ethereum Signed Message: +`;function qx(t){return typeof t=="string"&&(t=Am(t)),Em(yN([Am(MN),Am(String(t.length)),t]))}const IN="address/5.7.0",sl=new Kr(IN);function zx(t){Ns(t,20)||sl.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=bn(Em(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const CN=9007199254740991;function TN(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const Pm={};for(let t=0;t<10;t++)Pm[String(t)]=String(t);for(let t=0;t<26;t++)Pm[String.fromCharCode(65+t)]=String(10+t);const Hx=Math.floor(TN(CN));function RN(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Pm[n]).join("");for(;e.length>=Hx;){let n=e.substring(0,Hx);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function DN(t){let e=null;if(typeof t!="string"&&sl.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=zx(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&sl.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==RN(t)&&sl.throwArgumentError("bad icap checksum","address",t),e=SN(t.substring(4));e.length<40;)e="0"+e;e=zx("0x"+e)}else sl.throwArgumentError("invalid address","address",t);return e}function ol(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var al={},yr={},Ga=Wx;function Wx(t,e){if(!t)throw new Error(e||"Assertion failed")}Wx.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var Mm={exports:{}};typeof Object.create=="function"?Mm.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Mm.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var yd=Mm.exports,ON=Ga,NN=yd;yr.inherits=NN;function LN(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function kN(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):LN(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}yr.htonl=Kx;function $N(t,e){for(var r="",n=0;n>>0}return s}yr.join32=FN;function jN(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}yr.split32=jN;function UN(t,e){return t>>>e|t<<32-e}yr.rotr32=UN;function qN(t,e){return t<>>32-e}yr.rotl32=qN;function zN(t,e){return t+e>>>0}yr.sum32=zN;function HN(t,e,r){return t+e+r>>>0}yr.sum32_3=HN;function WN(t,e,r,n){return t+e+r+n>>>0}yr.sum32_4=WN;function KN(t,e,r,n,i){return t+e+r+n+i>>>0}yr.sum32_5=KN;function VN(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}yr.sum64=VN;function GN(t,e,r,n){var i=e+n>>>0,s=(i>>0}yr.sum64_hi=GN;function YN(t,e,r,n){var i=e+n;return i>>>0}yr.sum64_lo=YN;function JN(t,e,r,n,i,s,o,a){var u=0,l=e;l=l+n>>>0,u+=l>>0,u+=l>>0,u+=l>>0}yr.sum64_4_hi=JN;function XN(t,e,r,n,i,s,o,a){var u=e+n+s+a;return u>>>0}yr.sum64_4_lo=XN;function ZN(t,e,r,n,i,s,o,a,u,l){var d=0,p=e;p=p+n>>>0,d+=p>>0,d+=p>>0,d+=p>>0,d+=p>>0}yr.sum64_5_hi=ZN;function QN(t,e,r,n,i,s,o,a,u,l){var d=e+n+s+a+l;return d>>>0}yr.sum64_5_lo=QN;function eL(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}yr.rotr64_hi=eL;function tL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.rotr64_lo=tL;function rL(t,e,r){return t>>>r}yr.shr64_hi=rL;function nL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.shr64_lo=nL;var lu={},Yx=yr,iL=Ga;function wd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}lu.BlockHash=wd,wd.prototype.update=function(e,r){if(e=Yx.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Yx.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}Ls.g0_256=uL;function fL(t){return ks(t,17)^ks(t,19)^t>>>10}Ls.g1_256=fL;var du=yr,lL=lu,hL=Ls,Im=du.rotl32,cl=du.sum32,dL=du.sum32_5,pL=hL.ft_1,Qx=lL.BlockHash,gL=[1518500249,1859775393,2400959708,3395469782];function Bs(){if(!(this instanceof Bs))return new Bs;Qx.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}du.inherits(Bs,Qx);var mL=Bs;Bs.blockSize=512,Bs.outSize=160,Bs.hmacStrength=80,Bs.padLength=64,Bs.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),nk(e.length<=this.blockSize);for(var r=e.length;r>8,y=d&255;p?u.push(p,y):u.push(y)}return u}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",u=0;u(y>>1)-1?N=(y>>1)-D:N=D,A.isubn(N)):N=0,p[P]=N,A.iushrn(1)}return p}r.getNAF=n;function i(u,l){var d=[[],[]];u=u.clone(),l=l.clone();for(var p=0,y=0,A;u.cmpn(-p)>0||l.cmpn(-y)>0;){var P=u.andln(3)+p&3,N=l.andln(3)+y&3;P===3&&(P=-1),N===3&&(N=-1);var D;P&1?(A=u.andln(7)+p&7,(A===3||A===5)&&N===2?D=-P:D=P):D=0,d[0].push(D);var k;N&1?(A=l.andln(7)+y&7,(A===3||A===5)&&P===2?k=-N:k=N):k=0,d[1].push(k),2*p===D+1&&(p=1-p),2*y===k+1&&(y=1-y),u.iushrn(1),l.iushrn(1)}return d}r.getJSF=i;function s(u,l,d){var p="_"+l;u.prototype[l]=function(){return this[p]!==void 0?this[p]:this[p]=d.call(this)}}r.cachedProperty=s;function o(u){return typeof u=="string"?r.toArray(u,"hex"):u}r.parseBytes=o;function a(u){return new rr(u,"hex","le")}r.intFromLE=a}),_d=Ci.getNAF,ok=Ci.getJSF,Ed=Ci.assert;function na(t,e){this.type=t,this.p=new rr(e.p,16),this.red=e.prime?rr.red(e.prime):rr.mont(this.p),this.zero=new rr(0).toRed(this.red),this.one=new rr(1).toRed(this.red),this.two=new rr(2).toRed(this.red),this.n=e.n&&new rr(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ja=na;na.prototype.point=function(){throw new Error("Not implemented")},na.prototype.validate=function(){throw new Error("Not implemented")},na.prototype._fixedNafMul=function(e,r){Ed(e.precomputed);var n=e._getDoubles(),i=_d(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Ed(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},na.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=_d(n[P],o[P],this._bitLength),u[N]=_d(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=ok(n[P],n[N]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[N]=new Array(l),p=0;p=0;d--){for(var T=0;d>=0;){var z=!0;for(p=0;p=0&&T++,K=K.dblp(T),d<0)break;for(p=0;p0?y=a[p][ue-1>>1]:ue<0&&(y=a[p][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},zi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),p.negative&&(p=p.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:p,b:y},{a:A,b:P}]},Hi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Hi.prototype.pointFromX=function(e,r){e=new rr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Hi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Hi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Dn.prototype.isInfinity=function(){return this.inf},Dn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Dn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Dn.prototype.getX=function(){return this.x.fromRed()},Dn.prototype.getY=function(){return this.y.fromRed()},Dn.prototype.mul=function(e){return e=new rr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Dn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Dn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Dn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Dn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Dn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Un(t,e,r,n){Ja.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new rr(0)):(this.x=new rr(e,16),this.y=new rr(r,16),this.z=new rr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Nm(Un,Ja.BasePoint),Hi.prototype.jpoint=function(e,r,n){return new Un(this,e,r,n)},Un.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},Un.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Un.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(p).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(p)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},Un.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),A=u.redMul(p.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},Un.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},Un.prototype.inspect=function(){return this.isInfinity()?"":""},Un.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Sd=vu(function(t,e){var r=e;r.base=Ja,r.short=ck,r.mont=null,r.edwards=null}),Ad=vu(function(t,e){var r=e,n=Ci.assert;function i(a){a.type==="short"?this.curve=new Sd.short(a):a.type==="edwards"?this.curve=new Sd.edwards(a):this.curve=new Sd.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,u){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(u);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:wo.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:wo.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:wo.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:wo.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:wo.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:wo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function ia(t){if(!(this instanceof ia))return new ia(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=vs.toArray(t.entropy,t.entropyEnc||"hex"),r=vs.toArray(t.nonce,t.nonceEnc||"hex"),n=vs.toArray(t.pers,t.persEnc||"hex");Om(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var p3=ia;ia.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ia.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=vs.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var uk=Ci.assert;function Pd(t,e){if(t instanceof Pd)return t;this._importDER(t,e)||(uk(t.r&&t.s,"Signature without r or s"),this.r=new rr(t.r,16),this.s=new rr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Md=Pd;function fk(){this.place=0}function Bm(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function g3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Pd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=g3(r),n=g3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];$m(i,r.length),i=i.concat(r),i.push(2),$m(i,n.length);var s=i.concat(n),o=[48];return $m(o,s.length),o=o.concat(s),Ci.encode(o,e)};var lk=function(){throw new Error("unsupported")},m3=Ci.assert;function Wi(t){if(!(this instanceof Wi))return new Wi(t);typeof t=="string"&&(m3(Object.prototype.hasOwnProperty.call(Ad,t),"Unknown curve "+t),t=Ad[t]),t instanceof Ad.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var hk=Wi;Wi.prototype.keyPair=function(e){return new km(this,e)},Wi.prototype.keyFromPrivate=function(e,r){return km.fromPrivate(this,e,r)},Wi.prototype.keyFromPublic=function(e,r){return km.fromPublic(this,e,r)},Wi.prototype.genKeyPair=function(e){e||(e={});for(var r=new p3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||lk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new rr(2));;){var s=new rr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Wi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Wi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new rr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new p3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new rr(1)),d=0;;d++){var p=i.k?i.k(d):new rr(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new Md({r:P,s:N,recoveryParam:D})}}}}}},Wi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new rr(e,16)),n=this.keyFromPublic(n,i),r=new Md(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),u=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.eqXToP(s)):(d=this.g.mulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.getX().umod(this.n).cmp(s)===0)},Wi.prototype.recoverPubKey=function(t,e,r,n){m3((3&r)===r,"The recovery param is more than two bits"),e=new Md(e,n);var i=this.n,s=new rr(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Wi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Md(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dk=vu(function(t,e){var r=e;r.version="6.5.4",r.utils=Ci,r.rand=function(){throw new Error("unsupported")},r.curve=Sd,r.curves=Ad,r.ec=hk,r.eddsa=null}),pk=dk.ec;const gk="signing-key/5.7.0",Fm=new Kr(gk);let jm=null;function sa(){return jm||(jm=new pk("secp256k1")),jm}class mk{constructor(e){ol(this,"curve","secp256k1"),ol(this,"privateKey",Ii(e)),xN(this.privateKey)!==32&&Fm.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=sa().keyFromPrivate(bn(this.privateKey));ol(this,"publicKey","0x"+r.getPublic(!1,"hex")),ol(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ol(this,"_isSigningKey",!0)}_addPoint(e){const r=sa().keyFromPublic(bn(this.publicKey)),n=sa().keyFromPublic(bn(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=sa().keyFromPrivate(bn(this.privateKey)),n=bn(e);n.length!==32&&Fm.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return jx({recoveryParam:i.recoveryParam,r:fu("0x"+i.r.toString(16),32),s:fu("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=sa().keyFromPrivate(bn(this.privateKey)),n=sa().keyFromPublic(bn(v3(e)));return fu("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function vk(t,e){const r=jx(e),n={r:bn(r.r),s:bn(r.s)};return"0x"+sa().recoverPubKey(bn(t),n,r.recoveryParam).encode("hex",!1)}function v3(t,e){const r=bn(t);return r.length===32?new mk(r).publicKey:r.length===33?"0x"+sa().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?Ii(r):Fm.throwArgumentError("invalid public or private key","key","[REDACTED]")}var b3;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(b3||(b3={}));function bk(t){const e=v3(t);return DN(Fx(Em(Fx(e,1)),12))}function yk(t,e){return bk(vk(bn(t),e))}var Um={},Id={};Object.defineProperty(Id,"__esModule",{value:!0});var Yn=or,qm=Mi,wk=20;function xk(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],p=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],P=r[31]<<24|r[30]<<16|r[29]<<8|r[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],k=e[11]<<24|e[10]<<16|e[9]<<8|e[8],B=e[15]<<24|e[14]<<16|e[13]<<8|e[12],j=n,U=i,K=s,J=o,T=a,z=u,ue=l,_e=d,G=p,E=y,m=A,f=P,g=N,v=D,x=k,_=B,S=0;S>>16|g<<16,G=G+g|0,T^=G,T=T>>>20|T<<12,U=U+z|0,v^=U,v=v>>>16|v<<16,E=E+v|0,z^=E,z=z>>>20|z<<12,K=K+ue|0,x^=K,x=x>>>16|x<<16,m=m+x|0,ue^=m,ue=ue>>>20|ue<<12,J=J+_e|0,_^=J,_=_>>>16|_<<16,f=f+_|0,_e^=f,_e=_e>>>20|_e<<12,K=K+ue|0,x^=K,x=x>>>24|x<<8,m=m+x|0,ue^=m,ue=ue>>>25|ue<<7,J=J+_e|0,_^=J,_=_>>>24|_<<8,f=f+_|0,_e^=f,_e=_e>>>25|_e<<7,U=U+z|0,v^=U,v=v>>>24|v<<8,E=E+v|0,z^=E,z=z>>>25|z<<7,j=j+T|0,g^=j,g=g>>>24|g<<8,G=G+g|0,T^=G,T=T>>>25|T<<7,j=j+z|0,_^=j,_=_>>>16|_<<16,m=m+_|0,z^=m,z=z>>>20|z<<12,U=U+ue|0,g^=U,g=g>>>16|g<<16,f=f+g|0,ue^=f,ue=ue>>>20|ue<<12,K=K+_e|0,v^=K,v=v>>>16|v<<16,G=G+v|0,_e^=G,_e=_e>>>20|_e<<12,J=J+T|0,x^=J,x=x>>>16|x<<16,E=E+x|0,T^=E,T=T>>>20|T<<12,K=K+_e|0,v^=K,v=v>>>24|v<<8,G=G+v|0,_e^=G,_e=_e>>>25|_e<<7,J=J+T|0,x^=J,x=x>>>24|x<<8,E=E+x|0,T^=E,T=T>>>25|T<<7,U=U+ue|0,g^=U,g=g>>>24|g<<8,f=f+g|0,ue^=f,ue=ue>>>25|ue<<7,j=j+z|0,_^=j,_=_>>>24|_<<8,m=m+_|0,z^=m,z=z>>>25|z<<7;Yn.writeUint32LE(j+n|0,t,0),Yn.writeUint32LE(U+i|0,t,4),Yn.writeUint32LE(K+s|0,t,8),Yn.writeUint32LE(J+o|0,t,12),Yn.writeUint32LE(T+a|0,t,16),Yn.writeUint32LE(z+u|0,t,20),Yn.writeUint32LE(ue+l|0,t,24),Yn.writeUint32LE(_e+d|0,t,28),Yn.writeUint32LE(G+p|0,t,32),Yn.writeUint32LE(E+y|0,t,36),Yn.writeUint32LE(m+A|0,t,40),Yn.writeUint32LE(f+P|0,t,44),Yn.writeUint32LE(g+N|0,t,48),Yn.writeUint32LE(v+D|0,t,52),Yn.writeUint32LE(x+k|0,t,56),Yn.writeUint32LE(_+B|0,t,60)}function y3(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var w3={},oa={};Object.defineProperty(oa,"__esModule",{value:!0});function Sk(t,e,r){return~(t-1)&e|t-1&r}oa.select=Sk;function Ak(t,e){return(t|0)-(e|0)-1>>>31&1}oa.lessOrEqual=Ak;function x3(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}oa.compare=x3;function Pk(t,e){return t.length===0||e.length===0?!1:x3(t,e)!==0}oa.equal=Pk,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=oa,r=Mi;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var u=a[0]|a[1]<<8;this._r[0]=u&8191;var l=a[2]|a[3]<<8;this._r[1]=(u>>>13|l<<3)&8191;var d=a[4]|a[5]<<8;this._r[2]=(l>>>10|d<<6)&7939;var p=a[6]|a[7]<<8;this._r[3]=(d>>>7|p<<9)&8191;var y=a[8]|a[9]<<8;this._r[4]=(p>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var A=a[10]|a[11]<<8;this._r[6]=(y>>>14|A<<2)&8191;var P=a[12]|a[13]<<8;this._r[7]=(A>>>11|P<<5)&8065;var N=a[14]|a[15]<<8;this._r[8]=(P>>>8|N<<8)&8191,this._r[9]=N>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,u,l){for(var d=this._fin?0:2048,p=this._h[0],y=this._h[1],A=this._h[2],P=this._h[3],N=this._h[4],D=this._h[5],k=this._h[6],B=this._h[7],j=this._h[8],U=this._h[9],K=this._r[0],J=this._r[1],T=this._r[2],z=this._r[3],ue=this._r[4],_e=this._r[5],G=this._r[6],E=this._r[7],m=this._r[8],f=this._r[9];l>=16;){var g=a[u+0]|a[u+1]<<8;p+=g&8191;var v=a[u+2]|a[u+3]<<8;y+=(g>>>13|v<<3)&8191;var x=a[u+4]|a[u+5]<<8;A+=(v>>>10|x<<6)&8191;var _=a[u+6]|a[u+7]<<8;P+=(x>>>7|_<<9)&8191;var S=a[u+8]|a[u+9]<<8;N+=(_>>>4|S<<12)&8191,D+=S>>>1&8191;var b=a[u+10]|a[u+11]<<8;k+=(S>>>14|b<<2)&8191;var M=a[u+12]|a[u+13]<<8;B+=(b>>>11|M<<5)&8191;var I=a[u+14]|a[u+15]<<8;j+=(M>>>8|I<<8)&8191,U+=I>>>5|d;var F=0,ae=F;ae+=p*K,ae+=y*(5*f),ae+=A*(5*m),ae+=P*(5*E),ae+=N*(5*G),F=ae>>>13,ae&=8191,ae+=D*(5*_e),ae+=k*(5*ue),ae+=B*(5*z),ae+=j*(5*T),ae+=U*(5*J),F+=ae>>>13,ae&=8191;var O=F;O+=p*J,O+=y*K,O+=A*(5*f),O+=P*(5*m),O+=N*(5*E),F=O>>>13,O&=8191,O+=D*(5*G),O+=k*(5*_e),O+=B*(5*ue),O+=j*(5*z),O+=U*(5*T),F+=O>>>13,O&=8191;var se=F;se+=p*T,se+=y*J,se+=A*K,se+=P*(5*f),se+=N*(5*m),F=se>>>13,se&=8191,se+=D*(5*E),se+=k*(5*G),se+=B*(5*_e),se+=j*(5*ue),se+=U*(5*z),F+=se>>>13,se&=8191;var ee=F;ee+=p*z,ee+=y*T,ee+=A*J,ee+=P*K,ee+=N*(5*f),F=ee>>>13,ee&=8191,ee+=D*(5*m),ee+=k*(5*E),ee+=B*(5*G),ee+=j*(5*_e),ee+=U*(5*ue),F+=ee>>>13,ee&=8191;var X=F;X+=p*ue,X+=y*z,X+=A*T,X+=P*J,X+=N*K,F=X>>>13,X&=8191,X+=D*(5*f),X+=k*(5*m),X+=B*(5*E),X+=j*(5*G),X+=U*(5*_e),F+=X>>>13,X&=8191;var Q=F;Q+=p*_e,Q+=y*ue,Q+=A*z,Q+=P*T,Q+=N*J,F=Q>>>13,Q&=8191,Q+=D*K,Q+=k*(5*f),Q+=B*(5*m),Q+=j*(5*E),Q+=U*(5*G),F+=Q>>>13,Q&=8191;var R=F;R+=p*G,R+=y*_e,R+=A*ue,R+=P*z,R+=N*T,F=R>>>13,R&=8191,R+=D*J,R+=k*K,R+=B*(5*f),R+=j*(5*m),R+=U*(5*E),F+=R>>>13,R&=8191;var Z=F;Z+=p*E,Z+=y*G,Z+=A*_e,Z+=P*ue,Z+=N*z,F=Z>>>13,Z&=8191,Z+=D*T,Z+=k*J,Z+=B*K,Z+=j*(5*f),Z+=U*(5*m),F+=Z>>>13,Z&=8191;var te=F;te+=p*m,te+=y*E,te+=A*G,te+=P*_e,te+=N*ue,F=te>>>13,te&=8191,te+=D*z,te+=k*T,te+=B*J,te+=j*K,te+=U*(5*f),F+=te>>>13,te&=8191;var le=F;le+=p*f,le+=y*m,le+=A*E,le+=P*G,le+=N*_e,F=le>>>13,le&=8191,le+=D*ue,le+=k*z,le+=B*T,le+=j*J,le+=U*K,F+=le>>>13,le&=8191,F=(F<<2)+F|0,F=F+ae|0,ae=F&8191,F=F>>>13,O+=F,p=ae,y=O,A=se,P=ee,N=X,D=Q,k=R,B=Z,j=te,U=le,u+=16,l-=16}this._h[0]=p,this._h[1]=y,this._h[2]=A,this._h[3]=P,this._h[4]=N,this._h[5]=D,this._h[6]=k,this._h[7]=B,this._h[8]=j,this._h[9]=U},o.prototype.finish=function(a,u){u===void 0&&(u=0);var l=new Uint16Array(10),d,p,y,A;if(this._leftover){for(A=this._leftover,this._buffer[A++]=1;A<16;A++)this._buffer[A]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(d=this._h[1]>>>13,this._h[1]&=8191,A=2;A<10;A++)this._h[A]+=d,d=this._h[A]>>>13,this._h[A]&=8191;for(this._h[0]+=d*5,d=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=d,d=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=d,l[0]=this._h[0]+5,d=l[0]>>>13,l[0]&=8191,A=1;A<10;A++)l[A]=this._h[A]+d,d=l[A]>>>13,l[A]&=8191;for(l[9]-=8192,p=(d^1)-1,A=0;A<10;A++)l[A]&=p;for(p=~p,A=0;A<10;A++)this._h[A]=this._h[A]&p|l[A];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,y=this._h[0]+this._pad[0],this._h[0]=y&65535,A=1;A<8;A++)y=(this._h[A]+this._pad[A]|0)+(y>>>16)|0,this._h[A]=y&65535;return a[u+0]=this._h[0]>>>0,a[u+1]=this._h[0]>>>8,a[u+2]=this._h[1]>>>0,a[u+3]=this._h[1]>>>8,a[u+4]=this._h[2]>>>0,a[u+5]=this._h[2]>>>8,a[u+6]=this._h[3]>>>0,a[u+7]=this._h[3]>>>8,a[u+8]=this._h[4]>>>0,a[u+9]=this._h[4]>>>8,a[u+10]=this._h[5]>>>0,a[u+11]=this._h[5]>>>8,a[u+12]=this._h[6]>>>0,a[u+13]=this._h[6]>>>8,a[u+14]=this._h[7]>>>0,a[u+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var u=0,l=a.length,d;if(this._leftover){d=16-this._leftover,d>l&&(d=l);for(var p=0;p=16&&(d=l-l%16,this._blocks(a,u,d),u+=d,l-=d),l){for(var p=0;p16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var A=new Uint8Array(16);A.set(l,A.length-l.length);var P=new Uint8Array(32);e.stream(this._key,A,P,4);var N=d.length+this.tagLength,D;if(y){if(y.length!==N)throw new Error("ChaCha20Poly1305: incorrect destination length");D=y}else D=new Uint8Array(N);return e.streamXOR(this._key,A,d,D,4),this._authenticate(D.subarray(D.length-this.tagLength,D.length),P,D.subarray(0,D.length-this.tagLength),p),n.wipe(A),D},u.prototype.open=function(l,d,p,y){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(d.length0&&A.update(o.subarray(y.length%16))),A.update(p),p.length%16>0&&A.update(o.subarray(p.length%16));var P=new Uint8Array(8);y&&i.writeUint64LE(y.length,P),A.update(P),i.writeUint64LE(p.length,P),A.update(P);for(var N=A.digest(),D=0;Dthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._temp,this._state,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,A=l%64<56?64:128;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._state.set(u.state),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.state),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,u,l,d,p){for(;p>=64;){for(var y=u[0],A=u[1],P=u[2],N=u[3],D=u[4],k=u[5],B=u[6],j=u[7],U=0;U<16;U++){var K=d+U*4;a[U]=e.readUint32BE(l,K)}for(var U=16;U<64;U++){var J=a[U-2],T=(J>>>17|J<<15)^(J>>>19|J<<13)^J>>>10;J=a[U-15];var z=(J>>>7|J<<25)^(J>>>18|J<<14)^J>>>3;a[U]=(T+a[U-7]|0)+(z+a[U-16]|0)}for(var U=0;U<64;U++){var T=(((D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7))+(D&k^~D&B)|0)+(j+(i[U]+a[U]|0)|0)|0,z=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&A^y&P^A&P)|0;j=B,B=k,k=D,D=N+T|0,N=P,P=A,A=y,y=T+z|0}u[0]+=y,u[1]+=A,u[2]+=P,u[3]+=N,u[4]+=D,u[5]+=k,u[6]+=B,u[7]+=j,d+=64,p-=64}return d}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ll);var Hm={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=ta,r=Mi;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(U){const K=new Float64Array(16);if(U)for(let J=0;J>16&1),J[_e-1]&=65535;J[15]=T[15]-32767-(J[14]>>16&1);const ue=J[15]>>16&1;J[14]&=65535,a(T,J,1-ue)}for(let z=0;z<16;z++)U[2*z]=T[z]&255,U[2*z+1]=T[z]>>8}function l(U,K){for(let J=0;J<16;J++)U[J]=K[2*J]+(K[2*J+1]<<8);U[15]&=32767}function d(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]+J[T]}function p(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]-J[T]}function y(U,K,J){let T,z,ue=0,_e=0,G=0,E=0,m=0,f=0,g=0,v=0,x=0,_=0,S=0,b=0,M=0,I=0,F=0,ae=0,O=0,se=0,ee=0,X=0,Q=0,R=0,Z=0,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=J[0],Ie=J[1],Le=J[2],Ve=J[3],ke=J[4],ze=J[5],He=J[6],Ee=J[7],Qe=J[8],ct=J[9],Be=J[10],et=J[11],rt=J[12],Je=J[13],pt=J[14],ht=J[15];T=K[0],ue+=T*$e,_e+=T*Ie,G+=T*Le,E+=T*Ve,m+=T*ke,f+=T*ze,g+=T*He,v+=T*Ee,x+=T*Qe,_+=T*ct,S+=T*Be,b+=T*et,M+=T*rt,I+=T*Je,F+=T*pt,ae+=T*ht,T=K[1],_e+=T*$e,G+=T*Ie,E+=T*Le,m+=T*Ve,f+=T*ke,g+=T*ze,v+=T*He,x+=T*Ee,_+=T*Qe,S+=T*ct,b+=T*Be,M+=T*et,I+=T*rt,F+=T*Je,ae+=T*pt,O+=T*ht,T=K[2],G+=T*$e,E+=T*Ie,m+=T*Le,f+=T*Ve,g+=T*ke,v+=T*ze,x+=T*He,_+=T*Ee,S+=T*Qe,b+=T*ct,M+=T*Be,I+=T*et,F+=T*rt,ae+=T*Je,O+=T*pt,se+=T*ht,T=K[3],E+=T*$e,m+=T*Ie,f+=T*Le,g+=T*Ve,v+=T*ke,x+=T*ze,_+=T*He,S+=T*Ee,b+=T*Qe,M+=T*ct,I+=T*Be,F+=T*et,ae+=T*rt,O+=T*Je,se+=T*pt,ee+=T*ht,T=K[4],m+=T*$e,f+=T*Ie,g+=T*Le,v+=T*Ve,x+=T*ke,_+=T*ze,S+=T*He,b+=T*Ee,M+=T*Qe,I+=T*ct,F+=T*Be,ae+=T*et,O+=T*rt,se+=T*Je,ee+=T*pt,X+=T*ht,T=K[5],f+=T*$e,g+=T*Ie,v+=T*Le,x+=T*Ve,_+=T*ke,S+=T*ze,b+=T*He,M+=T*Ee,I+=T*Qe,F+=T*ct,ae+=T*Be,O+=T*et,se+=T*rt,ee+=T*Je,X+=T*pt,Q+=T*ht,T=K[6],g+=T*$e,v+=T*Ie,x+=T*Le,_+=T*Ve,S+=T*ke,b+=T*ze,M+=T*He,I+=T*Ee,F+=T*Qe,ae+=T*ct,O+=T*Be,se+=T*et,ee+=T*rt,X+=T*Je,Q+=T*pt,R+=T*ht,T=K[7],v+=T*$e,x+=T*Ie,_+=T*Le,S+=T*Ve,b+=T*ke,M+=T*ze,I+=T*He,F+=T*Ee,ae+=T*Qe,O+=T*ct,se+=T*Be,ee+=T*et,X+=T*rt,Q+=T*Je,R+=T*pt,Z+=T*ht,T=K[8],x+=T*$e,_+=T*Ie,S+=T*Le,b+=T*Ve,M+=T*ke,I+=T*ze,F+=T*He,ae+=T*Ee,O+=T*Qe,se+=T*ct,ee+=T*Be,X+=T*et,Q+=T*rt,R+=T*Je,Z+=T*pt,te+=T*ht,T=K[9],_+=T*$e,S+=T*Ie,b+=T*Le,M+=T*Ve,I+=T*ke,F+=T*ze,ae+=T*He,O+=T*Ee,se+=T*Qe,ee+=T*ct,X+=T*Be,Q+=T*et,R+=T*rt,Z+=T*Je,te+=T*pt,le+=T*ht,T=K[10],S+=T*$e,b+=T*Ie,M+=T*Le,I+=T*Ve,F+=T*ke,ae+=T*ze,O+=T*He,se+=T*Ee,ee+=T*Qe,X+=T*ct,Q+=T*Be,R+=T*et,Z+=T*rt,te+=T*Je,le+=T*pt,ie+=T*ht,T=K[11],b+=T*$e,M+=T*Ie,I+=T*Le,F+=T*Ve,ae+=T*ke,O+=T*ze,se+=T*He,ee+=T*Ee,X+=T*Qe,Q+=T*ct,R+=T*Be,Z+=T*et,te+=T*rt,le+=T*Je,ie+=T*pt,fe+=T*ht,T=K[12],M+=T*$e,I+=T*Ie,F+=T*Le,ae+=T*Ve,O+=T*ke,se+=T*ze,ee+=T*He,X+=T*Ee,Q+=T*Qe,R+=T*ct,Z+=T*Be,te+=T*et,le+=T*rt,ie+=T*Je,fe+=T*pt,ve+=T*ht,T=K[13],I+=T*$e,F+=T*Ie,ae+=T*Le,O+=T*Ve,se+=T*ke,ee+=T*ze,X+=T*He,Q+=T*Ee,R+=T*Qe,Z+=T*ct,te+=T*Be,le+=T*et,ie+=T*rt,fe+=T*Je,ve+=T*pt,Me+=T*ht,T=K[14],F+=T*$e,ae+=T*Ie,O+=T*Le,se+=T*Ve,ee+=T*ke,X+=T*ze,Q+=T*He,R+=T*Ee,Z+=T*Qe,te+=T*ct,le+=T*Be,ie+=T*et,fe+=T*rt,ve+=T*Je,Me+=T*pt,Ne+=T*ht,T=K[15],ae+=T*$e,O+=T*Ie,se+=T*Le,ee+=T*Ve,X+=T*ke,Q+=T*ze,R+=T*He,Z+=T*Ee,te+=T*Qe,le+=T*ct,ie+=T*Be,fe+=T*et,ve+=T*rt,Me+=T*Je,Ne+=T*pt,Te+=T*ht,ue+=38*O,_e+=38*se,G+=38*ee,E+=38*X,m+=38*Q,f+=38*R,g+=38*Z,v+=38*te,x+=38*le,_+=38*ie,S+=38*fe,b+=38*ve,M+=38*Me,I+=38*Ne,F+=38*Te,z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=g+z+65535,z=Math.floor(T/65536),g=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=g+z+65535,z=Math.floor(T/65536),g=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),U[0]=ue,U[1]=_e,U[2]=G,U[3]=E,U[4]=m,U[5]=f,U[6]=g,U[7]=v,U[8]=x,U[9]=_,U[10]=S,U[11]=b,U[12]=M,U[13]=I,U[14]=F,U[15]=ae}function A(U,K){y(U,K,K)}function P(U,K){const J=n();for(let T=0;T<16;T++)J[T]=K[T];for(let T=253;T>=0;T--)A(J,J),T!==2&&T!==4&&y(J,J,K);for(let T=0;T<16;T++)U[T]=J[T]}function N(U,K){const J=new Uint8Array(32),T=new Float64Array(80),z=n(),ue=n(),_e=n(),G=n(),E=n(),m=n();for(let x=0;x<31;x++)J[x]=U[x];J[31]=U[31]&127|64,J[0]&=248,l(T,K);for(let x=0;x<16;x++)ue[x]=T[x];z[0]=G[0]=1;for(let x=254;x>=0;--x){const _=J[x>>>3]>>>(x&7)&1;a(z,ue,_),a(_e,G,_),d(E,z,_e),p(z,z,_e),d(_e,ue,G),p(ue,ue,G),A(G,E),A(m,z),y(z,_e,z),y(_e,ue,E),d(E,z,_e),p(z,z,_e),A(ue,z),p(_e,G,m),y(z,_e,s),d(z,z,G),y(_e,_e,z),y(z,G,m),y(G,ue,T),A(ue,E),a(z,ue,_),a(_e,G,_)}for(let x=0;x<16;x++)T[x+16]=z[x],T[x+32]=_e[x],T[x+48]=ue[x],T[x+64]=G[x];const f=T.subarray(32),g=T.subarray(16);P(f,f),y(g,g,f);const v=new Uint8Array(32);return u(v,g),v}t.scalarMult=N;function D(U){return N(U,i)}t.scalarMultBase=D;function k(U){if(U.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const K=new Uint8Array(U);return{publicKey:D(K),secretKey:K}}t.generateKeyPairFromSeed=k;function B(U){const K=(0,e.randomBytes)(32,U),J=k(K);return(0,r.wipe)(K),J}t.generateKeyPair=B;function j(U,K,J=!1){if(U.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(K.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const T=N(U,K);if(J){let z=0;for(let ue=0;ue",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}};var Ti={},Wm={exports:{}};Wm.exports,function(t){(function(e,r){function n(G,E){if(!G)throw new Error(E||"Assertion failed")}function i(G,E){G.super_=E;var m=function(){};m.prototype=E.prototype,G.prototype=new m,G.prototype.constructor=G}function s(G,E,m){if(s.isBN(G))return G;this.negative=0,this.words=null,this.length=0,this.red=null,G!==null&&((E==="le"||E==="be")&&(m=E,E=10),this._init(G||0,E||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(E){return E instanceof s?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===s.wordSize&&Array.isArray(E.words)},s.max=function(E,m){return E.cmp(m)>0?E:m},s.min=function(E,m){return E.cmp(m)<0?E:m},s.prototype._init=function(E,m,f){if(typeof E=="number")return this._initNumber(E,m,f);if(typeof E=="object")return this._initArray(E,m,f);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),E=E.toString().replace(/\s+/g,"");var g=0;E[0]==="-"&&(g++,this.negative=1),g=0;g-=3)x=E[g]|E[g-1]<<8|E[g-2]<<16,this.words[v]|=x<<_&67108863,this.words[v+1]=x>>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);else if(f==="le")for(g=0,v=0;g>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);return this.strip()};function a(G,E){var m=G.charCodeAt(E);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function u(G,E,m){var f=a(G,m);return m-1>=E&&(f|=a(G,m-1)<<4),f}s.prototype._parseHex=function(E,m,f){this.length=Math.ceil((E.length-m)/6),this.words=new Array(this.length);for(var g=0;g=m;g-=2)_=u(E,m,g)<=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8;else{var S=E.length-m;for(g=S%2===0?m+1:m;g=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8}this.strip()};function l(G,E,m,f){for(var g=0,v=Math.min(G.length,m),x=E;x=49?g+=_-49+10:_>=17?g+=_-17+10:g+=_}return g}s.prototype._parseBase=function(E,m,f){this.words=[0],this.length=1;for(var g=0,v=1;v<=67108863;v*=m)g++;g--,v=v/m|0;for(var x=E.length-f,_=x%g,S=Math.min(x,x-_)+f,b=0,M=f;M1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var d=["","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"],p=[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],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(E,m){E=E||10,m=m|0||1;var f;if(E===16||E==="hex"){f="";for(var g=0,v=0,x=0;x>>24-g&16777215,g+=2,g>=26&&(g-=26,x--),v!==0||x!==this.length-1?f=d[6-S.length]+S+f:f=S+f}for(v!==0&&(f=v.toString(16)+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(E===(E|0)&&E>=2&&E<=36){var b=p[E],M=y[E];f="";var I=this.clone();for(I.negative=0;!I.isZero();){var F=I.modn(M).toString(E);I=I.idivn(M),I.isZero()?f=F+f:f=d[b-F.length]+F+f}for(this.isZero()&&(f="0"+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(E,m){return n(typeof o<"u"),this.toArrayLike(o,E,m)},s.prototype.toArray=function(E,m){return this.toArrayLike(Array,E,m)},s.prototype.toArrayLike=function(E,m,f){var g=this.byteLength(),v=f||Math.max(1,g);n(g<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var x=m==="le",_=new E(v),S,b,M=this.clone();if(x){for(b=0;!M.isZero();b++)S=M.andln(255),M.iushrn(8),_[b]=S;for(;b=4096&&(f+=13,m>>>=13),m>=64&&(f+=7,m>>>=7),m>=8&&(f+=4,m>>>=4),m>=2&&(f+=2,m>>>=2),f+m},s.prototype._zeroBits=function(E){if(E===0)return 26;var m=E,f=0;return m&8191||(f+=13,m>>>=13),m&127||(f+=7,m>>>=7),m&15||(f+=4,m>>>=4),m&3||(f+=2,m>>>=2),m&1||f++,f},s.prototype.bitLength=function(){var E=this.words[this.length-1],m=this._countBits(E);return(this.length-1)*26+m};function A(G){for(var E=new Array(G.bitLength()),m=0;m>>g}return E}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,m=0;mE.length?this.clone().ior(E):E.clone().ior(this)},s.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},s.prototype.iuand=function(E){var m;this.length>E.length?m=E:m=this;for(var f=0;fE.length?this.clone().iand(E):E.clone().iand(this)},s.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},s.prototype.iuxor=function(E){var m,f;this.length>E.length?(m=this,f=E):(m=E,f=this);for(var g=0;gE.length?this.clone().ixor(E):E.clone().ixor(this)},s.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},s.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var m=Math.ceil(E/26)|0,f=E%26;this._expand(m),f>0&&m--;for(var g=0;g0&&(this.words[g]=~this.words[g]&67108863>>26-f),this.strip()},s.prototype.notn=function(E){return this.clone().inotn(E)},s.prototype.setn=function(E,m){n(typeof E=="number"&&E>=0);var f=E/26|0,g=E%26;return this._expand(f+1),m?this.words[f]=this.words[f]|1<E.length?(f=this,g=E):(f=E,g=this);for(var v=0,x=0;x>>26;for(;v!==0&&x>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;xE.length?this.clone().iadd(E):E.clone().iadd(this)},s.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var m=this.iadd(E);return E.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var f=this.cmp(E);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var g,v;f>0?(g=this,v=E):(g=E,v=this);for(var x=0,_=0;_>26,this.words[_]=m&67108863;for(;x!==0&&_>26,this.words[_]=m&67108863;if(x===0&&_>>26,I=S&67108863,F=Math.min(b,E.length-1),ae=Math.max(0,b-G.length+1);ae<=F;ae++){var O=b-ae|0;g=G.words[O]|0,v=E.words[ae]|0,x=g*v+I,M+=x/67108864|0,I=x&67108863}m.words[b]=I|0,S=M|0}return S!==0?m.words[b]=S|0:m.length--,m.strip()}var N=function(E,m,f){var g=E.words,v=m.words,x=f.words,_=0,S,b,M,I=g[0]|0,F=I&8191,ae=I>>>13,O=g[1]|0,se=O&8191,ee=O>>>13,X=g[2]|0,Q=X&8191,R=X>>>13,Z=g[3]|0,te=Z&8191,le=Z>>>13,ie=g[4]|0,fe=ie&8191,ve=ie>>>13,Me=g[5]|0,Ne=Me&8191,Te=Me>>>13,$e=g[6]|0,Ie=$e&8191,Le=$e>>>13,Ve=g[7]|0,ke=Ve&8191,ze=Ve>>>13,He=g[8]|0,Ee=He&8191,Qe=He>>>13,ct=g[9]|0,Be=ct&8191,et=ct>>>13,rt=v[0]|0,Je=rt&8191,pt=rt>>>13,ht=v[1]|0,ft=ht&8191,Ht=ht>>>13,Jt=v[2]|0,St=Jt&8191,er=Jt>>>13,Xt=v[3]|0,Ot=Xt&8191,Bt=Xt>>>13,Tt=v[4]|0,vt=Tt&8191,Dt=Tt>>>13,Lt=v[5]|0,bt=Lt&8191,$t=Lt>>>13,jt=v[6]|0,nt=jt&8191,Ft=jt>>>13,$=v[7]|0,H=$&8191,V=$>>>13,C=v[8]|0,Y=C&8191,q=C>>>13,oe=v[9]|0,pe=oe&8191,xe=oe>>>13;f.negative=E.negative^m.negative,f.length=19,S=Math.imul(F,Je),b=Math.imul(F,pt),b=b+Math.imul(ae,Je)|0,M=Math.imul(ae,pt);var Re=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Re>>>26)|0,Re&=67108863,S=Math.imul(se,Je),b=Math.imul(se,pt),b=b+Math.imul(ee,Je)|0,M=Math.imul(ee,pt),S=S+Math.imul(F,ft)|0,b=b+Math.imul(F,Ht)|0,b=b+Math.imul(ae,ft)|0,M=M+Math.imul(ae,Ht)|0;var De=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(De>>>26)|0,De&=67108863,S=Math.imul(Q,Je),b=Math.imul(Q,pt),b=b+Math.imul(R,Je)|0,M=Math.imul(R,pt),S=S+Math.imul(se,ft)|0,b=b+Math.imul(se,Ht)|0,b=b+Math.imul(ee,ft)|0,M=M+Math.imul(ee,Ht)|0,S=S+Math.imul(F,St)|0,b=b+Math.imul(F,er)|0,b=b+Math.imul(ae,St)|0,M=M+Math.imul(ae,er)|0;var it=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(it>>>26)|0,it&=67108863,S=Math.imul(te,Je),b=Math.imul(te,pt),b=b+Math.imul(le,Je)|0,M=Math.imul(le,pt),S=S+Math.imul(Q,ft)|0,b=b+Math.imul(Q,Ht)|0,b=b+Math.imul(R,ft)|0,M=M+Math.imul(R,Ht)|0,S=S+Math.imul(se,St)|0,b=b+Math.imul(se,er)|0,b=b+Math.imul(ee,St)|0,M=M+Math.imul(ee,er)|0,S=S+Math.imul(F,Ot)|0,b=b+Math.imul(F,Bt)|0,b=b+Math.imul(ae,Ot)|0,M=M+Math.imul(ae,Bt)|0;var Ue=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,S=Math.imul(fe,Je),b=Math.imul(fe,pt),b=b+Math.imul(ve,Je)|0,M=Math.imul(ve,pt),S=S+Math.imul(te,ft)|0,b=b+Math.imul(te,Ht)|0,b=b+Math.imul(le,ft)|0,M=M+Math.imul(le,Ht)|0,S=S+Math.imul(Q,St)|0,b=b+Math.imul(Q,er)|0,b=b+Math.imul(R,St)|0,M=M+Math.imul(R,er)|0,S=S+Math.imul(se,Ot)|0,b=b+Math.imul(se,Bt)|0,b=b+Math.imul(ee,Ot)|0,M=M+Math.imul(ee,Bt)|0,S=S+Math.imul(F,vt)|0,b=b+Math.imul(F,Dt)|0,b=b+Math.imul(ae,vt)|0,M=M+Math.imul(ae,Dt)|0;var gt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(gt>>>26)|0,gt&=67108863,S=Math.imul(Ne,Je),b=Math.imul(Ne,pt),b=b+Math.imul(Te,Je)|0,M=Math.imul(Te,pt),S=S+Math.imul(fe,ft)|0,b=b+Math.imul(fe,Ht)|0,b=b+Math.imul(ve,ft)|0,M=M+Math.imul(ve,Ht)|0,S=S+Math.imul(te,St)|0,b=b+Math.imul(te,er)|0,b=b+Math.imul(le,St)|0,M=M+Math.imul(le,er)|0,S=S+Math.imul(Q,Ot)|0,b=b+Math.imul(Q,Bt)|0,b=b+Math.imul(R,Ot)|0,M=M+Math.imul(R,Bt)|0,S=S+Math.imul(se,vt)|0,b=b+Math.imul(se,Dt)|0,b=b+Math.imul(ee,vt)|0,M=M+Math.imul(ee,Dt)|0,S=S+Math.imul(F,bt)|0,b=b+Math.imul(F,$t)|0,b=b+Math.imul(ae,bt)|0,M=M+Math.imul(ae,$t)|0;var st=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(st>>>26)|0,st&=67108863,S=Math.imul(Ie,Je),b=Math.imul(Ie,pt),b=b+Math.imul(Le,Je)|0,M=Math.imul(Le,pt),S=S+Math.imul(Ne,ft)|0,b=b+Math.imul(Ne,Ht)|0,b=b+Math.imul(Te,ft)|0,M=M+Math.imul(Te,Ht)|0,S=S+Math.imul(fe,St)|0,b=b+Math.imul(fe,er)|0,b=b+Math.imul(ve,St)|0,M=M+Math.imul(ve,er)|0,S=S+Math.imul(te,Ot)|0,b=b+Math.imul(te,Bt)|0,b=b+Math.imul(le,Ot)|0,M=M+Math.imul(le,Bt)|0,S=S+Math.imul(Q,vt)|0,b=b+Math.imul(Q,Dt)|0,b=b+Math.imul(R,vt)|0,M=M+Math.imul(R,Dt)|0,S=S+Math.imul(se,bt)|0,b=b+Math.imul(se,$t)|0,b=b+Math.imul(ee,bt)|0,M=M+Math.imul(ee,$t)|0,S=S+Math.imul(F,nt)|0,b=b+Math.imul(F,Ft)|0,b=b+Math.imul(ae,nt)|0,M=M+Math.imul(ae,Ft)|0;var tt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(tt>>>26)|0,tt&=67108863,S=Math.imul(ke,Je),b=Math.imul(ke,pt),b=b+Math.imul(ze,Je)|0,M=Math.imul(ze,pt),S=S+Math.imul(Ie,ft)|0,b=b+Math.imul(Ie,Ht)|0,b=b+Math.imul(Le,ft)|0,M=M+Math.imul(Le,Ht)|0,S=S+Math.imul(Ne,St)|0,b=b+Math.imul(Ne,er)|0,b=b+Math.imul(Te,St)|0,M=M+Math.imul(Te,er)|0,S=S+Math.imul(fe,Ot)|0,b=b+Math.imul(fe,Bt)|0,b=b+Math.imul(ve,Ot)|0,M=M+Math.imul(ve,Bt)|0,S=S+Math.imul(te,vt)|0,b=b+Math.imul(te,Dt)|0,b=b+Math.imul(le,vt)|0,M=M+Math.imul(le,Dt)|0,S=S+Math.imul(Q,bt)|0,b=b+Math.imul(Q,$t)|0,b=b+Math.imul(R,bt)|0,M=M+Math.imul(R,$t)|0,S=S+Math.imul(se,nt)|0,b=b+Math.imul(se,Ft)|0,b=b+Math.imul(ee,nt)|0,M=M+Math.imul(ee,Ft)|0,S=S+Math.imul(F,H)|0,b=b+Math.imul(F,V)|0,b=b+Math.imul(ae,H)|0,M=M+Math.imul(ae,V)|0;var At=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(At>>>26)|0,At&=67108863,S=Math.imul(Ee,Je),b=Math.imul(Ee,pt),b=b+Math.imul(Qe,Je)|0,M=Math.imul(Qe,pt),S=S+Math.imul(ke,ft)|0,b=b+Math.imul(ke,Ht)|0,b=b+Math.imul(ze,ft)|0,M=M+Math.imul(ze,Ht)|0,S=S+Math.imul(Ie,St)|0,b=b+Math.imul(Ie,er)|0,b=b+Math.imul(Le,St)|0,M=M+Math.imul(Le,er)|0,S=S+Math.imul(Ne,Ot)|0,b=b+Math.imul(Ne,Bt)|0,b=b+Math.imul(Te,Ot)|0,M=M+Math.imul(Te,Bt)|0,S=S+Math.imul(fe,vt)|0,b=b+Math.imul(fe,Dt)|0,b=b+Math.imul(ve,vt)|0,M=M+Math.imul(ve,Dt)|0,S=S+Math.imul(te,bt)|0,b=b+Math.imul(te,$t)|0,b=b+Math.imul(le,bt)|0,M=M+Math.imul(le,$t)|0,S=S+Math.imul(Q,nt)|0,b=b+Math.imul(Q,Ft)|0,b=b+Math.imul(R,nt)|0,M=M+Math.imul(R,Ft)|0,S=S+Math.imul(se,H)|0,b=b+Math.imul(se,V)|0,b=b+Math.imul(ee,H)|0,M=M+Math.imul(ee,V)|0,S=S+Math.imul(F,Y)|0,b=b+Math.imul(F,q)|0,b=b+Math.imul(ae,Y)|0,M=M+Math.imul(ae,q)|0;var Rt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,S=Math.imul(Be,Je),b=Math.imul(Be,pt),b=b+Math.imul(et,Je)|0,M=Math.imul(et,pt),S=S+Math.imul(Ee,ft)|0,b=b+Math.imul(Ee,Ht)|0,b=b+Math.imul(Qe,ft)|0,M=M+Math.imul(Qe,Ht)|0,S=S+Math.imul(ke,St)|0,b=b+Math.imul(ke,er)|0,b=b+Math.imul(ze,St)|0,M=M+Math.imul(ze,er)|0,S=S+Math.imul(Ie,Ot)|0,b=b+Math.imul(Ie,Bt)|0,b=b+Math.imul(Le,Ot)|0,M=M+Math.imul(Le,Bt)|0,S=S+Math.imul(Ne,vt)|0,b=b+Math.imul(Ne,Dt)|0,b=b+Math.imul(Te,vt)|0,M=M+Math.imul(Te,Dt)|0,S=S+Math.imul(fe,bt)|0,b=b+Math.imul(fe,$t)|0,b=b+Math.imul(ve,bt)|0,M=M+Math.imul(ve,$t)|0,S=S+Math.imul(te,nt)|0,b=b+Math.imul(te,Ft)|0,b=b+Math.imul(le,nt)|0,M=M+Math.imul(le,Ft)|0,S=S+Math.imul(Q,H)|0,b=b+Math.imul(Q,V)|0,b=b+Math.imul(R,H)|0,M=M+Math.imul(R,V)|0,S=S+Math.imul(se,Y)|0,b=b+Math.imul(se,q)|0,b=b+Math.imul(ee,Y)|0,M=M+Math.imul(ee,q)|0,S=S+Math.imul(F,pe)|0,b=b+Math.imul(F,xe)|0,b=b+Math.imul(ae,pe)|0,M=M+Math.imul(ae,xe)|0;var Mt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,S=Math.imul(Be,ft),b=Math.imul(Be,Ht),b=b+Math.imul(et,ft)|0,M=Math.imul(et,Ht),S=S+Math.imul(Ee,St)|0,b=b+Math.imul(Ee,er)|0,b=b+Math.imul(Qe,St)|0,M=M+Math.imul(Qe,er)|0,S=S+Math.imul(ke,Ot)|0,b=b+Math.imul(ke,Bt)|0,b=b+Math.imul(ze,Ot)|0,M=M+Math.imul(ze,Bt)|0,S=S+Math.imul(Ie,vt)|0,b=b+Math.imul(Ie,Dt)|0,b=b+Math.imul(Le,vt)|0,M=M+Math.imul(Le,Dt)|0,S=S+Math.imul(Ne,bt)|0,b=b+Math.imul(Ne,$t)|0,b=b+Math.imul(Te,bt)|0,M=M+Math.imul(Te,$t)|0,S=S+Math.imul(fe,nt)|0,b=b+Math.imul(fe,Ft)|0,b=b+Math.imul(ve,nt)|0,M=M+Math.imul(ve,Ft)|0,S=S+Math.imul(te,H)|0,b=b+Math.imul(te,V)|0,b=b+Math.imul(le,H)|0,M=M+Math.imul(le,V)|0,S=S+Math.imul(Q,Y)|0,b=b+Math.imul(Q,q)|0,b=b+Math.imul(R,Y)|0,M=M+Math.imul(R,q)|0,S=S+Math.imul(se,pe)|0,b=b+Math.imul(se,xe)|0,b=b+Math.imul(ee,pe)|0,M=M+Math.imul(ee,xe)|0;var Et=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Et>>>26)|0,Et&=67108863,S=Math.imul(Be,St),b=Math.imul(Be,er),b=b+Math.imul(et,St)|0,M=Math.imul(et,er),S=S+Math.imul(Ee,Ot)|0,b=b+Math.imul(Ee,Bt)|0,b=b+Math.imul(Qe,Ot)|0,M=M+Math.imul(Qe,Bt)|0,S=S+Math.imul(ke,vt)|0,b=b+Math.imul(ke,Dt)|0,b=b+Math.imul(ze,vt)|0,M=M+Math.imul(ze,Dt)|0,S=S+Math.imul(Ie,bt)|0,b=b+Math.imul(Ie,$t)|0,b=b+Math.imul(Le,bt)|0,M=M+Math.imul(Le,$t)|0,S=S+Math.imul(Ne,nt)|0,b=b+Math.imul(Ne,Ft)|0,b=b+Math.imul(Te,nt)|0,M=M+Math.imul(Te,Ft)|0,S=S+Math.imul(fe,H)|0,b=b+Math.imul(fe,V)|0,b=b+Math.imul(ve,H)|0,M=M+Math.imul(ve,V)|0,S=S+Math.imul(te,Y)|0,b=b+Math.imul(te,q)|0,b=b+Math.imul(le,Y)|0,M=M+Math.imul(le,q)|0,S=S+Math.imul(Q,pe)|0,b=b+Math.imul(Q,xe)|0,b=b+Math.imul(R,pe)|0,M=M+Math.imul(R,xe)|0;var dt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(dt>>>26)|0,dt&=67108863,S=Math.imul(Be,Ot),b=Math.imul(Be,Bt),b=b+Math.imul(et,Ot)|0,M=Math.imul(et,Bt),S=S+Math.imul(Ee,vt)|0,b=b+Math.imul(Ee,Dt)|0,b=b+Math.imul(Qe,vt)|0,M=M+Math.imul(Qe,Dt)|0,S=S+Math.imul(ke,bt)|0,b=b+Math.imul(ke,$t)|0,b=b+Math.imul(ze,bt)|0,M=M+Math.imul(ze,$t)|0,S=S+Math.imul(Ie,nt)|0,b=b+Math.imul(Ie,Ft)|0,b=b+Math.imul(Le,nt)|0,M=M+Math.imul(Le,Ft)|0,S=S+Math.imul(Ne,H)|0,b=b+Math.imul(Ne,V)|0,b=b+Math.imul(Te,H)|0,M=M+Math.imul(Te,V)|0,S=S+Math.imul(fe,Y)|0,b=b+Math.imul(fe,q)|0,b=b+Math.imul(ve,Y)|0,M=M+Math.imul(ve,q)|0,S=S+Math.imul(te,pe)|0,b=b+Math.imul(te,xe)|0,b=b+Math.imul(le,pe)|0,M=M+Math.imul(le,xe)|0;var _t=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(_t>>>26)|0,_t&=67108863,S=Math.imul(Be,vt),b=Math.imul(Be,Dt),b=b+Math.imul(et,vt)|0,M=Math.imul(et,Dt),S=S+Math.imul(Ee,bt)|0,b=b+Math.imul(Ee,$t)|0,b=b+Math.imul(Qe,bt)|0,M=M+Math.imul(Qe,$t)|0,S=S+Math.imul(ke,nt)|0,b=b+Math.imul(ke,Ft)|0,b=b+Math.imul(ze,nt)|0,M=M+Math.imul(ze,Ft)|0,S=S+Math.imul(Ie,H)|0,b=b+Math.imul(Ie,V)|0,b=b+Math.imul(Le,H)|0,M=M+Math.imul(Le,V)|0,S=S+Math.imul(Ne,Y)|0,b=b+Math.imul(Ne,q)|0,b=b+Math.imul(Te,Y)|0,M=M+Math.imul(Te,q)|0,S=S+Math.imul(fe,pe)|0,b=b+Math.imul(fe,xe)|0,b=b+Math.imul(ve,pe)|0,M=M+Math.imul(ve,xe)|0;var ot=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(ot>>>26)|0,ot&=67108863,S=Math.imul(Be,bt),b=Math.imul(Be,$t),b=b+Math.imul(et,bt)|0,M=Math.imul(et,$t),S=S+Math.imul(Ee,nt)|0,b=b+Math.imul(Ee,Ft)|0,b=b+Math.imul(Qe,nt)|0,M=M+Math.imul(Qe,Ft)|0,S=S+Math.imul(ke,H)|0,b=b+Math.imul(ke,V)|0,b=b+Math.imul(ze,H)|0,M=M+Math.imul(ze,V)|0,S=S+Math.imul(Ie,Y)|0,b=b+Math.imul(Ie,q)|0,b=b+Math.imul(Le,Y)|0,M=M+Math.imul(Le,q)|0,S=S+Math.imul(Ne,pe)|0,b=b+Math.imul(Ne,xe)|0,b=b+Math.imul(Te,pe)|0,M=M+Math.imul(Te,xe)|0;var wt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(wt>>>26)|0,wt&=67108863,S=Math.imul(Be,nt),b=Math.imul(Be,Ft),b=b+Math.imul(et,nt)|0,M=Math.imul(et,Ft),S=S+Math.imul(Ee,H)|0,b=b+Math.imul(Ee,V)|0,b=b+Math.imul(Qe,H)|0,M=M+Math.imul(Qe,V)|0,S=S+Math.imul(ke,Y)|0,b=b+Math.imul(ke,q)|0,b=b+Math.imul(ze,Y)|0,M=M+Math.imul(ze,q)|0,S=S+Math.imul(Ie,pe)|0,b=b+Math.imul(Ie,xe)|0,b=b+Math.imul(Le,pe)|0,M=M+Math.imul(Le,xe)|0;var lt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul(Be,H),b=Math.imul(Be,V),b=b+Math.imul(et,H)|0,M=Math.imul(et,V),S=S+Math.imul(Ee,Y)|0,b=b+Math.imul(Ee,q)|0,b=b+Math.imul(Qe,Y)|0,M=M+Math.imul(Qe,q)|0,S=S+Math.imul(ke,pe)|0,b=b+Math.imul(ke,xe)|0,b=b+Math.imul(ze,pe)|0,M=M+Math.imul(ze,xe)|0;var at=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(at>>>26)|0,at&=67108863,S=Math.imul(Be,Y),b=Math.imul(Be,q),b=b+Math.imul(et,Y)|0,M=Math.imul(et,q),S=S+Math.imul(Ee,pe)|0,b=b+Math.imul(Ee,xe)|0,b=b+Math.imul(Qe,pe)|0,M=M+Math.imul(Qe,xe)|0;var Ae=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,S=Math.imul(Be,pe),b=Math.imul(Be,xe),b=b+Math.imul(et,pe)|0,M=Math.imul(et,xe);var Pe=(_+S|0)+((b&8191)<<13)|0;return _=(M+(b>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,x[0]=Re,x[1]=De,x[2]=it,x[3]=Ue,x[4]=gt,x[5]=st,x[6]=tt,x[7]=At,x[8]=Rt,x[9]=Mt,x[10]=Et,x[11]=dt,x[12]=_t,x[13]=ot,x[14]=wt,x[15]=lt,x[16]=at,x[17]=Ae,x[18]=Pe,_!==0&&(x[19]=_,f.length++),f};Math.imul||(N=P);function D(G,E,m){m.negative=E.negative^G.negative,m.length=G.length+E.length;for(var f=0,g=0,v=0;v>>26)|0,g+=x>>>26,x&=67108863}m.words[v]=_,f=x,x=g}return f!==0?m.words[v]=f:m.length--,m.strip()}function k(G,E,m){var f=new B;return f.mulp(G,E,m)}s.prototype.mulTo=function(E,m){var f,g=this.length+E.length;return this.length===10&&E.length===10?f=N(this,E,m):g<63?f=P(this,E,m):g<1024?f=D(this,E,m):f=k(this,E,m),f};function B(G,E){this.x=G,this.y=E}B.prototype.makeRBT=function(E){for(var m=new Array(E),f=s.prototype._countBits(E)-1,g=0;g>=1;return g},B.prototype.permute=function(E,m,f,g,v,x){for(var _=0;_>>1)v++;return 1<>>13,f[2*x+1]=v&8191,v=v>>>13;for(x=2*m;x>=26,m+=g/67108864|0,m+=v>>>26,this.words[f]=v&67108863}return m!==0&&(this.words[f]=m,this.length++),this},s.prototype.muln=function(E){return this.clone().imuln(E)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(E){var m=A(E);if(m.length===0)return new s(1);for(var f=this,g=0;g=0);var m=E%26,f=(E-m)/26,g=67108863>>>26-m<<26-m,v;if(m!==0){var x=0;for(v=0;v>>26-m}x&&(this.words[v]=x,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var g;m?g=(m-m%26)/26:g=0;var v=E%26,x=Math.min((E-v)/26,this.length),_=67108863^67108863>>>v<x)for(this.length-=x,b=0;b=0&&(M!==0||b>=g);b--){var I=this.words[b]|0;this.words[b]=M<<26-v|I>>>v,M=I&_}return S&&M!==0&&(S.words[S.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(E,m,f){return n(this.negative===0),this.iushrn(E,m,f)},s.prototype.shln=function(E){return this.clone().ishln(E)},s.prototype.ushln=function(E){return this.clone().iushln(E)},s.prototype.shrn=function(E){return this.clone().ishrn(E)},s.prototype.ushrn=function(E){return this.clone().iushrn(E)},s.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var m=E%26,f=(E-m)/26,g=1<=0);var m=E%26,f=(E-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(m!==0&&f++,this.length=Math.min(f,this.length),m!==0){var g=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(S/67108864|0),this.words[v+f]=x&67108863}for(;v>26,this.words[v+f]=x&67108863;if(_===0)return this.strip();for(n(_===-1),_=0,v=0;v>26,this.words[v]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(E,m){var f=this.length-E.length,g=this.clone(),v=E,x=v.words[v.length-1]|0,_=this._countBits(x);f=26-_,f!==0&&(v=v.ushln(f),g.iushln(f),x=v.words[v.length-1]|0);var S=g.length-v.length,b;if(m!=="mod"){b=new s(null),b.length=S+1,b.words=new Array(b.length);for(var M=0;M=0;F--){var ae=(g.words[v.length+F]|0)*67108864+(g.words[v.length+F-1]|0);for(ae=Math.min(ae/x|0,67108863),g._ishlnsubmul(v,ae,F);g.negative!==0;)ae--,g.negative=0,g._ishlnsubmul(v,1,F),g.isZero()||(g.negative^=1);b&&(b.words[F]=ae)}return b&&b.strip(),g.strip(),m!=="div"&&f!==0&&g.iushrn(f),{div:b||null,mod:g}},s.prototype.divmod=function(E,m,f){if(n(!E.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var g,v,x;return this.negative!==0&&E.negative===0?(x=this.neg().divmod(E,m),m!=="mod"&&(g=x.div.neg()),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.iadd(E)),{div:g,mod:v}):this.negative===0&&E.negative!==0?(x=this.divmod(E.neg(),m),m!=="mod"&&(g=x.div.neg()),{div:g,mod:x.mod}):this.negative&E.negative?(x=this.neg().divmod(E.neg(),m),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.isub(E)),{div:x.div,mod:v}):E.length>this.length||this.cmp(E)<0?{div:new s(0),mod:this}:E.length===1?m==="div"?{div:this.divn(E.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new s(this.modn(E.words[0]))}:this._wordDiv(E,m)},s.prototype.div=function(E){return this.divmod(E,"div",!1).div},s.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},s.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},s.prototype.divRound=function(E){var m=this.divmod(E);if(m.mod.isZero())return m.div;var f=m.div.negative!==0?m.mod.isub(E):m.mod,g=E.ushrn(1),v=E.andln(1),x=f.cmp(g);return x<0||v===1&&x===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(E){n(E<=67108863);for(var m=(1<<26)%E,f=0,g=this.length-1;g>=0;g--)f=(m*f+(this.words[g]|0))%E;return f},s.prototype.idivn=function(E){n(E<=67108863);for(var m=0,f=this.length-1;f>=0;f--){var g=(this.words[f]|0)+m*67108864;this.words[f]=g/E|0,m=g%E}return this.strip()},s.prototype.divn=function(E){return this.clone().idivn(E)},s.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=new s(0),_=new s(1),S=0;m.isEven()&&f.isEven();)m.iushrn(1),f.iushrn(1),++S;for(var b=f.clone(),M=m.clone();!m.isZero();){for(var I=0,F=1;!(m.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(m.iushrn(I);I-- >0;)(g.isOdd()||v.isOdd())&&(g.iadd(b),v.isub(M)),g.iushrn(1),v.iushrn(1);for(var ae=0,O=1;!(f.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(f.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(b),_.isub(M)),x.iushrn(1),_.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(x),v.isub(_)):(f.isub(m),x.isub(g),_.isub(v))}return{a:x,b:_,gcd:f.iushln(S)}},s.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=f.clone();m.cmpn(1)>0&&f.cmpn(1)>0;){for(var _=0,S=1;!(m.words[0]&S)&&_<26;++_,S<<=1);if(_>0)for(m.iushrn(_);_-- >0;)g.isOdd()&&g.iadd(x),g.iushrn(1);for(var b=0,M=1;!(f.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(f.iushrn(b);b-- >0;)v.isOdd()&&v.iadd(x),v.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(v)):(f.isub(m),v.isub(g))}var I;return m.cmpn(1)===0?I=g:I=v,I.cmpn(0)<0&&I.iadd(E),I},s.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var m=this.clone(),f=E.clone();m.negative=0,f.negative=0;for(var g=0;m.isEven()&&f.isEven();g++)m.iushrn(1),f.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=m.cmp(f);if(v<0){var x=m;m=f,f=x}else if(v===0||f.cmpn(1)===0)break;m.isub(f)}while(!0);return f.iushln(g)},s.prototype.invm=function(E){return this.egcd(E).a.umod(E)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(E){return this.words[0]&E},s.prototype.bincn=function(E){n(typeof E=="number");var m=E%26,f=(E-m)/26,g=1<>>26,_&=67108863,this.words[x]=_}return v!==0&&(this.words[x]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(E){var m=E<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var f;if(this.length>1)f=1;else{m&&(E=-E),n(E<=67108863,"Number is too big");var g=this.words[0]|0;f=g===E?0:gE.length)return 1;if(this.length=0;f--){var g=this.words[f]|0,v=E.words[f]|0;if(g!==v){gv&&(m=1);break}}return m},s.prototype.gtn=function(E){return this.cmpn(E)===1},s.prototype.gt=function(E){return this.cmp(E)===1},s.prototype.gten=function(E){return this.cmpn(E)>=0},s.prototype.gte=function(E){return this.cmp(E)>=0},s.prototype.ltn=function(E){return this.cmpn(E)===-1},s.prototype.lt=function(E){return this.cmp(E)===-1},s.prototype.lten=function(E){return this.cmpn(E)<=0},s.prototype.lte=function(E){return this.cmp(E)<=0},s.prototype.eqn=function(E){return this.cmpn(E)===0},s.prototype.eq=function(E){return this.cmp(E)===0},s.red=function(E){return new ue(E)},s.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(E){return this.red=E,this},s.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},s.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},s.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},s.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},s.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},s.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},s.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},s.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var j={k256:null,p224:null,p192:null,p25519:null};function U(G,E){this.name=G,this.p=new s(E,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var E=new s(null);return E.words=new Array(Math.ceil(this.n/13)),E},U.prototype.ireduce=function(E){var m=E,f;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),f=m.bitLength();while(f>this.n);var g=f0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},U.prototype.split=function(E,m){E.iushrn(this.n,0,m)},U.prototype.imulK=function(E){return E.imul(this.k)};function K(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(K,U),K.prototype.split=function(E,m){for(var f=4194303,g=Math.min(E.length,9),v=0;v>>22,x=_}x>>>=22,E.words[v-10]=x,x===0&&E.length>10?E.length-=10:E.length-=9},K.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var m=0,f=0;f>>=26,E.words[f]=v,m=g}return m!==0&&(E.words[E.length++]=m),E},s._prime=function(E){if(j[E])return j[E];var m;if(E==="k256")m=new K;else if(E==="p224")m=new J;else if(E==="p192")m=new T;else if(E==="p25519")m=new z;else throw new Error("Unknown prime "+E);return j[E]=m,m};function ue(G){if(typeof G=="string"){var E=s._prime(G);this.m=E.p,this.prime=E}else n(G.gtn(1),"modulus must be greater than 1"),this.m=G,this.prime=null}ue.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},ue.prototype._verify2=function(E,m){n((E.negative|m.negative)===0,"red works only with positives"),n(E.red&&E.red===m.red,"red works only with red numbers")},ue.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},ue.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},ue.prototype.add=function(E,m){this._verify2(E,m);var f=E.add(m);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},ue.prototype.iadd=function(E,m){this._verify2(E,m);var f=E.iadd(m);return f.cmp(this.m)>=0&&f.isub(this.m),f},ue.prototype.sub=function(E,m){this._verify2(E,m);var f=E.sub(m);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},ue.prototype.isub=function(E,m){this._verify2(E,m);var f=E.isub(m);return f.cmpn(0)<0&&f.iadd(this.m),f},ue.prototype.shl=function(E,m){return this._verify1(E),this.imod(E.ushln(m))},ue.prototype.imul=function(E,m){return this._verify2(E,m),this.imod(E.imul(m))},ue.prototype.mul=function(E,m){return this._verify2(E,m),this.imod(E.mul(m))},ue.prototype.isqr=function(E){return this.imul(E,E.clone())},ue.prototype.sqr=function(E){return this.mul(E,E)},ue.prototype.sqrt=function(E){if(E.isZero())return E.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(E,f)}for(var g=this.m.subn(1),v=0;!g.isZero()&&g.andln(1)===0;)v++,g.iushrn(1);n(!g.isZero());var x=new s(1).toRed(this),_=x.redNeg(),S=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new s(2*b*b).toRed(this);this.pow(b,S).cmp(_)!==0;)b.redIAdd(_);for(var M=this.pow(b,g),I=this.pow(E,g.addn(1).iushrn(1)),F=this.pow(E,g),ae=v;F.cmp(x)!==0;){for(var O=F,se=0;O.cmp(x)!==0;se++)O=O.redSqr();n(se=0;v--){for(var M=m.words[v],I=b-1;I>=0;I--){var F=M>>I&1;if(x!==g[0]&&(x=this.sqr(x)),F===0&&_===0){S=0;continue}_<<=1,_|=F,S++,!(S!==f&&(v!==0||I!==0))&&(x=this.mul(x,g[_]),S=0,_=0)}b=26}return x},ue.prototype.convertTo=function(E){var m=E.umod(this.m);return m===E?m.clone():m},ue.prototype.convertFrom=function(E){var m=E.clone();return m.red=null,m},s.mont=function(E){return new _e(E)};function _e(G){ue.call(this,G),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(_e,ue),_e.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},_e.prototype.convertFrom=function(E){var m=this.imod(E.mul(this.rinv));return m.red=null,m},_e.prototype.imul=function(E,m){if(E.isZero()||m.isZero())return E.words[0]=0,E.length=1,E;var f=E.imul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.mul=function(E,m){if(E.isZero()||m.isZero())return new s(0)._forceRed(this);var f=E.mul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.invm=function(E){var m=this.imod(E._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,nn)}(Wm);var xo=Wm.exports,Km={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var u=0;u>8,p=l&255;d?a.push(d,p):a.push(p)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(N>>1)-1?k=(N>>1)-B:k=B,D.isubn(k)):k=0,A[P]=k,D.iushrn(1)}return A}e.getNAF=s;function o(d,p){var y=[[],[]];d=d.clone(),p=p.clone();for(var A=0,P=0,N;d.cmpn(-A)>0||p.cmpn(-P)>0;){var D=d.andln(3)+A&3,k=p.andln(3)+P&3;D===3&&(D=-1),k===3&&(k=-1);var B;D&1?(N=d.andln(7)+A&7,(N===3||N===5)&&k===2?B=-D:B=D):B=0,y[0].push(B);var j;k&1?(N=p.andln(7)+P&7,(N===3||N===5)&&D===2?j=-k:j=k):j=0,y[1].push(j),2*A===B+1&&(A=1-A),2*P===j+1&&(P=1-P),d.iushrn(1),p.iushrn(1)}return y}e.getJSF=o;function a(d,p,y){var A="_"+p;d.prototype[p]=function(){return this[A]!==void 0?this[A]:this[A]=y.call(this)}}e.cachedProperty=a;function u(d){return typeof d=="string"?e.toArray(d,"hex"):d}e.parseBytes=u;function l(d){return new r(d,"hex","le")}e.intFromLE=l}(Ti);var Vm={exports:{}},Gm;Vm.exports=function(e){return Gm||(Gm=new aa(null)),Gm.generate(e)};function aa(t){this.rand=t}if(Vm.exports.Rand=aa,aa.prototype.generate=function(e){return this._rand(e)},aa.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Rd=ca;ca.prototype.point=function(){throw new Error("Not implemented")},ca.prototype.validate=function(){throw new Error("Not implemented")},ca.prototype._fixedNafMul=function(e,r){Td(e.precomputed);var n=e._getDoubles(),i=Cd(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Td(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},ca.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=Cd(n[P],o[P],this._bitLength),u[N]=Cd(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=Nk(n[P],n[N]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[N]=new Array(l),p=0;p=0;d--){for(var T=0;d>=0;){var z=!0;for(p=0;p=0&&T++,K=K.dblp(T),d<0)break;for(p=0;p0?y=a[p][ue-1>>1]:ue<0&&(y=a[p][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Ki.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),p.negative&&(p=p.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:p,b:y},{a:A,b:P}]},Vi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Vi.prototype.pointFromX=function(e,r){e=new en(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Vi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Vi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},On.prototype.isInfinity=function(){return this.inf},On.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},On.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},On.prototype.getX=function(){return this.x.fromRed()},On.prototype.getY=function(){return this.y.fromRed()},On.prototype.mul=function(e){return e=new en(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},On.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},On.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},On.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},On.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},On.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function qn(t,e,r,n){bu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new en(0)):(this.x=new en(e,16),this.y=new en(r,16),this.z=new en(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Jm(qn,bu.BasePoint),Vi.prototype.jpoint=function(e,r,n){return new qn(this,e,r,n)},qn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},qn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},qn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(p).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(p)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},qn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),A=u.redMul(p.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},qn.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},qn.prototype.inspect=function(){return this.isInfinity()?"":""},qn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var yu=xo,C3=yd,Dd=Rd,$k=Ti;function wu(t){Dd.call(this,"mont",t),this.a=new yu(t.a,16).toRed(this.red),this.b=new yu(t.b,16).toRed(this.red),this.i4=new yu(4).toRed(this.red).redInvm(),this.two=new yu(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}C3(wu,Dd);var Fk=wu;wu.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function Nn(t,e,r){Dd.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new yu(e,16),this.z=new yu(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}C3(Nn,Dd.BasePoint),wu.prototype.decodePoint=function(e,r){return this.point($k.toArray(e,r),1)},wu.prototype.point=function(e,r){return new Nn(this,e,r)},wu.prototype.pointFromJSON=function(e){return Nn.fromJSON(this,e)},Nn.prototype.precompute=function(){},Nn.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Nn.fromJSON=function(e,r){return new Nn(e,r[0],r[1]||e.one)},Nn.prototype.inspect=function(){return this.isInfinity()?"":""},Nn.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Nn.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)},Nn.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),u=s.redMul(i),l=r.z.redMul(a.redAdd(u).redSqr()),d=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(l,d)},Nn.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i},Nn.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Nn.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Nn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var jk=Ti,_o=xo,T3=yd,Od=Rd,Uk=jk.assert;function zs(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Od.call(this,"edwards",t),this.a=new _o(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new _o(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new _o(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Uk(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}T3(zs,Od);var qk=zs;zs.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},zs.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},zs.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)},zs.prototype.pointFromX=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var u=a.fromRed().isOdd();return(r&&!u||!r&&u)&&(a=a.redNeg()),this.point(e,a)},zs.prototype.pointFromY=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)},zs.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function Hr(t,e,r,n,i){Od.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new _o(e,16),this.y=new _o(r,16),this.z=n?new _o(n,16):this.curve.one,this.t=i&&new _o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}T3(Hr,Od.BasePoint),zs.prototype.pointFromJSON=function(e){return Hr.fromJSON(this,e)},zs.prototype.point=function(e,r,n,i){return new Hr(this,e,r,n,i)},Hr.fromJSON=function(e,r){return new Hr(e,r[0],r[1],r[2])},Hr.prototype.inspect=function(){return this.isInfinity()?"":""},Hr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Hr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),u=i.redSub(r),l=s.redMul(a),d=o.redMul(u),p=s.redMul(u),y=a.redMul(o);return this.curve.point(l,d,y,p)},Hr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,u,l;if(this.curve.twisted){a=this.curve._mulA(r);var d=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(d.redSub(this.curve.two)),s=d.redMul(a.redSub(n)),o=d.redSqr().redSub(d).redSub(d)):(u=this.z.redSqr(),l=d.redSub(u).redISub(u),i=e.redSub(r).redISub(n).redMul(l),s=d.redMul(a.redSub(n)),o=d.redMul(l))}else a=r.redAdd(n),u=this.curve._mulC(this.z).redSqr(),l=a.redSub(u).redSub(u),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)},Hr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Hr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),u=s.redAdd(i),l=n.redAdd(r),d=o.redMul(a),p=u.redMul(l),y=o.redMul(l),A=a.redMul(u);return this.curve.point(d,p,A,y)},Hr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),u=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),d=r.redMul(a).redMul(l),p,y;return this.curve.twisted?(p=r.redMul(u).redMul(s.redSub(this.curve._mulA(i))),y=a.redMul(u)):(p=r.redMul(u).redMul(s.redSub(i)),y=this.curve._mulC(a).redMul(u)),this.curve.point(d,p,y)},Hr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Hr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Hr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)},Hr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)},Hr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Hr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Hr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Hr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Hr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Hr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Hr.prototype.toP=Hr.prototype.normalize,Hr.prototype.mixedAdd=Hr.prototype.add,function(t){var e=t;e.base=Rd,e.short=Bk,e.mont=Fk,e.edwards=qk}(Ym);var Nd={},Xm,R3;function zk(){return R3||(R3=1,Xm={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Xm}(function(t){var e=t,r=al,n=Ym,i=Ti,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,d){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var p=new o(d);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:p}),p}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=zk()}catch{u=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})})(Nd);var Hk=al,Za=Km,D3=Ga;function ua(t){if(!(this instanceof ua))return new ua(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Za.toArray(t.entropy,t.entropyEnc||"hex"),r=Za.toArray(t.nonce,t.nonceEnc||"hex"),n=Za.toArray(t.pers,t.persEnc||"hex");D3(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Wk=ua;ua.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ua.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Za.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var Ld=xo,Qm=Ti,Yk=Qm.assert;function kd(t,e){if(t instanceof kd)return t;this._importDER(t,e)||(Yk(t.r&&t.s,"Signature without r or s"),this.r=new Ld(t.r,16),this.s=new Ld(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Jk=kd;function Xk(){this.place=0}function e1(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function O3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}kd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=O3(r),n=O3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];t1(i,r.length),i=i.concat(r),i.push(2),t1(i,n.length);var s=i.concat(n),o=[48];return t1(o,s.length),o=o.concat(s),Qm.encode(o,e)};var Eo=xo,N3=Wk,Zk=Ti,r1=Nd,Qk=I3,L3=Zk.assert,n1=Gk,Bd=Jk;function Gi(t){if(!(this instanceof Gi))return new Gi(t);typeof t=="string"&&(L3(Object.prototype.hasOwnProperty.call(r1,t),"Unknown curve "+t),t=r1[t]),t instanceof r1.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var eB=Gi;Gi.prototype.keyPair=function(e){return new n1(this,e)},Gi.prototype.keyFromPrivate=function(e,r){return n1.fromPrivate(this,e,r)},Gi.prototype.keyFromPublic=function(e,r){return n1.fromPublic(this,e,r)},Gi.prototype.genKeyPair=function(e){e||(e={});for(var r=new N3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Qk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new Eo(2));;){var s=new Eo(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Gi.prototype._truncateToN=function(e,r,n){var i;if(Eo.isBN(e)||typeof e=="number")e=new Eo(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new Eo(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new Eo(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Gi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new N3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new Eo(1)),d=0;;d++){var p=i.k?i.k(d):new Eo(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new Bd({r:P,s:N,recoveryParam:D})}}}}}},Gi.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new Bd(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),l=u.mul(e).umod(this.n),d=u.mul(o).umod(this.n),p;return this.curve._maxwellTrick?(p=this.g.jmulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.eqXToP(o)):(p=this.g.mulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.getX().umod(this.n).cmp(o)===0)},Gi.prototype.recoverPubKey=function(t,e,r,n){L3((3&r)===r,"The recovery param is more than two bits"),e=new Bd(e,n);var i=this.n,s=new Eo(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Gi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Bd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dl=Ti,k3=dl.assert,B3=dl.parseBytes,xu=dl.cachedProperty;function Ln(t,e){this.eddsa=t,this._secret=B3(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=B3(e.pub)}Ln.fromPublic=function(e,r){return r instanceof Ln?r:new Ln(e,{pub:r})},Ln.fromSecret=function(e,r){return r instanceof Ln?r:new Ln(e,{secret:r})},Ln.prototype.secret=function(){return this._secret},xu(Ln,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),xu(Ln,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),xu(Ln,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i}),xu(Ln,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),xu(Ln,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),xu(Ln,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Ln.prototype.sign=function(e){return k3(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Ln.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},Ln.prototype.getSecret=function(e){return k3(this._secret,"KeyPair is public only"),dl.encode(this.secret(),e)},Ln.prototype.getPublic=function(e){return dl.encode(this.pubBytes(),e)};var tB=Ln,rB=xo,$d=Ti,$3=$d.assert,Fd=$d.cachedProperty,nB=$d.parseBytes;function Qa(t,e){this.eddsa=t,typeof e!="object"&&(e=nB(e)),Array.isArray(e)&&($3(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),$3(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof rB&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Fd(Qa,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Fd(Qa,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Fd(Qa,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Fd(Qa,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Qa.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Qa.prototype.toHex=function(){return $d.encode(this.toBytes(),"hex").toUpperCase()};var iB=Qa,sB=al,oB=Nd,_u=Ti,aB=_u.assert,F3=_u.parseBytes,j3=tB,U3=iB;function vi(t){if(aB(t==="ed25519","only tested with ed25519 so far"),!(this instanceof vi))return new vi(t);t=oB[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=sB.sha512}var cB=vi;vi.prototype.sign=function(e,r){e=F3(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),u=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:u,Rencoded:o})},vi.prototype.verify=function(e,r,n){if(e=F3(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)},vi.prototype.hashInt=function(){for(var e=this.hash(),r=0;re in t?lB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,W3=(t,e)=>{for(var r in e||(e={}))hB.call(e,r)&&H3(t,r,e[r]);if(z3)for(var r of z3(e))dB.call(e,r)&&H3(t,r,e[r]);return t};const pB="ReactNative",Ri={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},gB="js";function jd(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Su(){return!nl()&&!!mm()&&navigator.product===pB}function pl(){return!jd()&&!!mm()&&!!nl()}function gl(){return Su()?Ri.reactNative:jd()?Ri.node:pl()?Ri.browser:Ri.unknown}function mB(){var t;try{return Su()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function vB(t,e){let r=il.parse(t);return r=W3(W3({},r),e),t=il.stringify(r),t}function K3(){return Px()||{name:"",description:"",url:"",icons:[""]}}function bB(){if(gl()===Ri.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=HO();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function yB(){var t;const e=gl();return e===Ri.browser?[e,((t=Ax())==null?void 0:t.host)||"unknown"].join(":"):e}function V3(t,e,r){const n=bB(),i=yB();return[[t,e].join("-"),[gB,r].join("-"),n,i].join("/")}function wB({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const u=r.split("?"),l=V3(t,e,n),d={auth:i,ua:l,projectId:s,useOnCloseEvent:o,origin:a||void 0},p=vB(u[1]||"",d);return u[0]+"?"+p}function ec(t,e){return t.filter(r=>e.includes(r)).length===t.length}function G3(t){return Object.fromEntries(t.entries())}function Y3(t){return new Map(Object.entries(t))}function tc(t=mt.FIVE_MINUTES,e){const r=mt.toMiliseconds(t||mt.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Au(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function J3(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function xB(t){return J3("topic",t)}function _B(t){return J3("id",t)}function X3(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function En(t,e){return mt.fromMiliseconds(Date.now()+mt.toMiliseconds(t))}function fa(t){return Date.now()>=mt.toMiliseconds(t)}function vr(t,e){return`${t}${e?`:${e}`:""}`}function Ud(t=[],e=[]){return[...new Set([...t,...e])]}async function EB({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=SB(s,t,e),a=gl();if(a===Ri.browser){if(!((n=nl())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,PB()?"_blank":"_self","noreferrer noopener")}else a===Ri.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function SB(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${MB(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function AB(t,e){let r="";try{if(pl()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function Z3(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function Q3(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function i1(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function PB(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function MB(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function e_(t){return Buffer.from(t,"base64").toString("utf-8")}const IB="https://rpc.walletconnect.org/v1";async function CB(t,e,r,n,i,s){switch(r.t){case"eip191":return TB(t,e,r.s);case"eip1271":return await RB(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function TB(t,e,r){return yk(qx(e),r).toLowerCase()===t.toLowerCase()}async function RB(t,e,r,n,i,s){const o=Eu(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",d=r.substring(2),p=qx(e).substring(2),y=a+p+u+l+d,A=await fetch(`${s||IB}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:DB(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:y},"latest"]})}),{result:P}=await A.json();return P?P.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function DB(){return Date.now()+Math.floor(Math.random()*1e3)}var OB=Object.defineProperty,NB=Object.defineProperties,LB=Object.getOwnPropertyDescriptors,t_=Object.getOwnPropertySymbols,kB=Object.prototype.hasOwnProperty,BB=Object.prototype.propertyIsEnumerable,r_=(t,e,r)=>e in t?OB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$B=(t,e)=>{for(var r in e||(e={}))kB.call(e,r)&&r_(t,r,e[r]);if(t_)for(var r of t_(e))BB.call(e,r)&&r_(t,r,e[r]);return t},FB=(t,e)=>NB(t,LB(e));const jB="did:pkh:",s1=t=>t==null?void 0:t.split(":"),UB=t=>{const e=t&&s1(t);if(e)return t.includes(jB)?e[3]:e[1]},o1=t=>{const e=t&&s1(t);if(e)return e[2]+":"+e[3]},qd=t=>{const e=t&&s1(t);if(e)return e.pop()};async function n_(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=i_(i,i.iss),o=qd(i.iss);return await CB(o,s,n,o1(i.iss),r)}const i_=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=qd(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${UB(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,d=t.exp?`Expiration Time: ${t.exp}`:void 0,p=t.nbf?`Not Before: ${t.nbf}`:void 0,y=t.requestId?`Request ID: ${t.requestId}`:void 0,A=t.resources?`Resources:${t.resources.map(N=>` - ${N}`).join("")}`:void 0,P=zd(t.resources);if(P){const N=ml(P);i=JB(i,N)}return[r,n,"",i,"",s,o,a,u,l,d,p,y,A].filter(N=>N!=null).join(` -`)};function qB(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function zB(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function rc(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function HB(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:WB(e,r,n)}}}function WB(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function i_(t){return rc(t),`urn:recap:${qB(t).replace(/=/g,"")}`}function ml(t){const e=zB(t.replace("urn:recap:",""));return rc(e),e}function KB(t,e,r){const n=HB(t,e,r);return i_(n)}function VB(t){return t&&t.includes("urn:recap:")}function GB(t,e){const r=ml(t),n=ml(e),i=YB(r,n);return i_(i)}function YB(t,e){rc(t),rc(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,u)=>a.localeCompare(u)).forEach(a=>{var u,l;n.att[i]=FB($B({},n.att[i]),{[a]:((u=t.att[i])==null?void 0:u[a])||((l=e.att[i])==null?void 0:l[a])})})}),n}function JB(t="",e){rc(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const u=Object.keys(e.att[a]).map(p=>({ability:p.split("/")[0],action:p.split("/")[1]}));u.sort((p,y)=>p.action.localeCompare(y.action));const l={};u.forEach(p=>{l[p.ability]||(l[p.ability]=[]),l[p.ability].push(p.action)});const d=Object.keys(l).map(p=>(i++,`(${i}) '${p}': '${l[p].join("', '")}' for '${a}'.`));n.push(d.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function s_(t){var e;const r=ml(t);rc(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function o_(t){const e=ml(t);rc(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function zd(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return VB(e)?e:void 0}const a_="base10",ni="base16",la="base64pad",vl="base64url",bl="utf8",c_=0,So=1,yl=2,XB=0,u_=1,wl=12,a1=32;function ZB(){const t=Hm.generateKeyPair();return{privateKey:Tn(t.secretKey,ni),publicKey:Tn(t.publicKey,ni)}}function c1(){const t=ta.randomBytes(a1);return Tn(t,ni)}function QB(t,e){const r=Hm.sharedKey(Rn(t,ni),Rn(e,ni),!0),n=new Dk(ll.SHA256,r).expand(a1);return Tn(n,ni)}function Hd(t){const e=ll.hash(Rn(t,ni));return Tn(e,ni)}function Ao(t){const e=ll.hash(Rn(t,bl));return Tn(e,ni)}function f_(t){return Rn(`${t}`,a_)}function nc(t){return Number(Tn(t,a_))}function e$(t){const e=f_(typeof t.type<"u"?t.type:c_);if(nc(e)===So&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Rn(t.senderPublicKey,ni):void 0,n=typeof t.iv<"u"?Rn(t.iv,ni):ta.randomBytes(wl),i=new Um.ChaCha20Poly1305(Rn(t.symKey,ni)).seal(n,Rn(t.message,bl));return l_({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function t$(t,e){const r=f_(yl),n=ta.randomBytes(wl),i=Rn(t,bl);return l_({type:r,sealed:i,iv:n,encoding:e})}function r$(t){const e=new Um.ChaCha20Poly1305(Rn(t.symKey,ni)),{sealed:r,iv:n}=xl({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Tn(i,bl)}function n$(t,e){const{sealed:r}=xl({encoded:t,encoding:e});return Tn(r,bl)}function l_(t){const{encoding:e=la}=t;if(nc(t.type)===yl)return Tn(pd([t.type,t.sealed]),e);if(nc(t.type)===So){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Tn(pd([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return Tn(pd([t.type,t.iv,t.sealed]),e)}function xl(t){const{encoded:e,encoding:r=la}=t,n=Rn(e,r),i=n.slice(XB,u_),s=u_;if(nc(i)===So){const l=s+a1,d=l+wl,p=n.slice(s,l),y=n.slice(l,d),A=n.slice(d);return{type:i,sealed:A,iv:y,senderPublicKey:p}}if(nc(i)===yl){const l=n.slice(s),d=ta.randomBytes(wl);return{type:i,sealed:l,iv:d}}const o=s+wl,a=n.slice(s,o),u=n.slice(o);return{type:i,sealed:u,iv:a}}function i$(t,e){const r=xl({encoded:t,encoding:e==null?void 0:e.encoding});return h_({type:nc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Tn(r.senderPublicKey,ni):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function h_(t){const e=(t==null?void 0:t.type)||c_;if(e===So){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function d_(t){return t.type===So&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function p_(t){return t.type===yl}function s$(t){return new A3.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function o$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function a$(t){return Buffer.from(o$(t),"base64")}function c$(t,e){const[r,n,i]=t.split("."),s=a$(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),u=`${r}.${n}`,l=new ll.SHA256().update(Buffer.from(u)).digest(),d=s$(e),p=Buffer.from(l).toString("hex");if(!d.verify(p,{r:o,s:a}))throw new Error("Invalid signature");return gm(t).payload}const u$="irn";function u1(t){return(t==null?void 0:t.relay)||{protocol:u$}}function _l(t){const e=uB[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var f$=Object.defineProperty,l$=Object.defineProperties,h$=Object.getOwnPropertyDescriptors,g_=Object.getOwnPropertySymbols,d$=Object.prototype.hasOwnProperty,p$=Object.prototype.propertyIsEnumerable,m_=(t,e,r)=>e in t?f$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v_=(t,e)=>{for(var r in e||(e={}))d$.call(e,r)&&m_(t,r,e[r]);if(g_)for(var r of g_(e))p$.call(e,r)&&m_(t,r,e[r]);return t},g$=(t,e)=>l$(t,h$(e));function m$(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function b_(t){if(!t.includes("wc:")){const u=Q3(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=il.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:v$(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:m$(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function v$(t){return t.startsWith("//")?t.substring(2):t}function b$(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function y_(t){return`${t.protocol}:${t.topic}@${t.version}?`+il.stringify(v_(g$(v_({symKey:t.symKey},b$(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Wd(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Pu(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function y$(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Pu(r.accounts))}),e}function w$(t,e){const r=[];return Object.values(t).forEach(n=>{Pu(n.accounts).includes(e)&&r.push(...n.methods)}),r}function x$(t,e){const r=[];return Object.values(t).forEach(n=>{Pu(n.accounts).includes(e)&&r.push(...n.events)}),r}function f1(t){return t.includes(":")}function El(t){return f1(t)?t.split(":")[0]:t}function _$(t){const e={};return t==null||t.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function w_(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=_$(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=Ud(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const E$={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},S$={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ut(t,e){const{message:r,code:n}=S$[t];return{message:e?`${r} ${e}`:r,code:n}}function Dr(t,e){const{message:r,code:n}=E$[t];return{message:e?`${r} ${e}`:r,code:n}}function ic(t,e){return!!Array.isArray(t)}function Sl(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function bi(t){return typeof t>"u"}function an(t,e){return e&&bi(t)?!0:typeof t=="string"&&!!t.trim().length}function l1(t,e){return typeof t=="number"&&!isNaN(t)}function A$(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return ec(i,n)?(n.forEach(o=>{const{accounts:a,methods:u,events:l}=t.namespaces[o],d=Pu(a),p=r[o];(!ec(U3(o,p),d)||!ec(p.methods,u)||!ec(p.events,l))&&(s=!1)}),s):!1}function Kd(t){return an(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function P$(t){if(an(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Kd(r)}}return!1}function M$(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(an(t,!1)){if(e(t))return!0;const r=Q3(t);return e(r)}}catch{}return!1}function I$(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function C$(t){return t==null?void 0:t.topic}function T$(t,e){let r=null;return an(t==null?void 0:t.publicKey,!1)||(r=ut("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function x_(t){let e=!0;return ic(t)?t.length&&(e=t.every(r=>an(r,!1))):e=!1,e}function R$(t,e,r){let n=null;return ic(e)&&e.length?e.forEach(i=>{n||Kd(i)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Kd(t)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function D$(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=R$(i,U3(i,s),`${e} ${r}`);o&&(n=o)}),n}function O$(t,e){let r=null;return ic(t)?t.forEach(n=>{r||P$(n)||(r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function N$(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=O$(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function L$(t,e){let r=null;return x_(t==null?void 0:t.methods)?x_(t==null?void 0:t.events)||(r=Dr("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Dr("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function __(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=L$(n,`${e}, namespace`);i&&(r=i)}),r}function k$(t,e,r){let n=null;if(t&&Sl(t)){const i=__(t,e);i&&(n=i);const s=D$(t,e,r);s&&(n=s)}else n=ut("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function h1(t,e){let r=null;if(t&&Sl(t)){const n=__(t,e);n&&(r=n);const i=N$(t,e);i&&(r=i)}else r=ut("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function E_(t){return an(t.protocol,!0)}function B$(t,e){let r=!1;return t?t&&ic(t)&&t.length&&t.forEach(n=>{r=E_(n)}):r=!0,r}function $$(t){return typeof t=="number"}function yi(t){return typeof t<"u"&&typeof t!==null}function F$(t){return!(!t||typeof t!="object"||!t.code||!l1(t.code)||!t.message||!an(t.message,!1))}function j$(t){return!(bi(t)||!an(t.method,!1))}function U$(t){return!(bi(t)||bi(t.result)&&bi(t.error)||!l1(t.id)||!an(t.jsonrpc,!1))}function q$(t){return!(bi(t)||!an(t.name,!1))}function S_(t,e){return!(!Kd(e)||!y$(t).includes(e))}function z$(t,e,r){return an(r,!1)?w$(t,e).includes(r):!1}function H$(t,e,r){return an(r,!1)?x$(t,e).includes(r):!1}function A_(t,e,r){let n=null;const i=W$(t),s=K$(e),o=Object.keys(i),a=Object.keys(s),u=P_(Object.keys(t)),l=P_(Object.keys(e)),d=u.filter(p=>!l.includes(p));return d.length&&(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. +`)};function qB(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function zB(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function rc(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function HB(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:WB(e,r,n)}}}function WB(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function s_(t){return rc(t),`urn:recap:${qB(t).replace(/=/g,"")}`}function ml(t){const e=zB(t.replace("urn:recap:",""));return rc(e),e}function KB(t,e,r){const n=HB(t,e,r);return s_(n)}function VB(t){return t&&t.includes("urn:recap:")}function GB(t,e){const r=ml(t),n=ml(e),i=YB(r,n);return s_(i)}function YB(t,e){rc(t),rc(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,u)=>a.localeCompare(u)).forEach(a=>{var u,l;n.att[i]=FB($B({},n.att[i]),{[a]:((u=t.att[i])==null?void 0:u[a])||((l=e.att[i])==null?void 0:l[a])})})}),n}function JB(t="",e){rc(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const u=Object.keys(e.att[a]).map(p=>({ability:p.split("/")[0],action:p.split("/")[1]}));u.sort((p,y)=>p.action.localeCompare(y.action));const l={};u.forEach(p=>{l[p.ability]||(l[p.ability]=[]),l[p.ability].push(p.action)});const d=Object.keys(l).map(p=>(i++,`(${i}) '${p}': '${l[p].join("', '")}' for '${a}'.`));n.push(d.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function o_(t){var e;const r=ml(t);rc(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function a_(t){const e=ml(t);rc(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function zd(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return VB(e)?e:void 0}const c_="base10",ni="base16",la="base64pad",vl="base64url",bl="utf8",u_=0,So=1,yl=2,XB=0,f_=1,wl=12,a1=32;function ZB(){const t=Hm.generateKeyPair();return{privateKey:Tn(t.secretKey,ni),publicKey:Tn(t.publicKey,ni)}}function c1(){const t=ta.randomBytes(a1);return Tn(t,ni)}function QB(t,e){const r=Hm.sharedKey(Rn(t,ni),Rn(e,ni),!0),n=new Dk(ll.SHA256,r).expand(a1);return Tn(n,ni)}function Hd(t){const e=ll.hash(Rn(t,ni));return Tn(e,ni)}function Ao(t){const e=ll.hash(Rn(t,bl));return Tn(e,ni)}function l_(t){return Rn(`${t}`,c_)}function nc(t){return Number(Tn(t,c_))}function e$(t){const e=l_(typeof t.type<"u"?t.type:u_);if(nc(e)===So&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Rn(t.senderPublicKey,ni):void 0,n=typeof t.iv<"u"?Rn(t.iv,ni):ta.randomBytes(wl),i=new Um.ChaCha20Poly1305(Rn(t.symKey,ni)).seal(n,Rn(t.message,bl));return h_({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function t$(t,e){const r=l_(yl),n=ta.randomBytes(wl),i=Rn(t,bl);return h_({type:r,sealed:i,iv:n,encoding:e})}function r$(t){const e=new Um.ChaCha20Poly1305(Rn(t.symKey,ni)),{sealed:r,iv:n}=xl({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Tn(i,bl)}function n$(t,e){const{sealed:r}=xl({encoded:t,encoding:e});return Tn(r,bl)}function h_(t){const{encoding:e=la}=t;if(nc(t.type)===yl)return Tn(pd([t.type,t.sealed]),e);if(nc(t.type)===So){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Tn(pd([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return Tn(pd([t.type,t.iv,t.sealed]),e)}function xl(t){const{encoded:e,encoding:r=la}=t,n=Rn(e,r),i=n.slice(XB,f_),s=f_;if(nc(i)===So){const l=s+a1,d=l+wl,p=n.slice(s,l),y=n.slice(l,d),A=n.slice(d);return{type:i,sealed:A,iv:y,senderPublicKey:p}}if(nc(i)===yl){const l=n.slice(s),d=ta.randomBytes(wl);return{type:i,sealed:l,iv:d}}const o=s+wl,a=n.slice(s,o),u=n.slice(o);return{type:i,sealed:u,iv:a}}function i$(t,e){const r=xl({encoded:t,encoding:e==null?void 0:e.encoding});return d_({type:nc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Tn(r.senderPublicKey,ni):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function d_(t){const e=(t==null?void 0:t.type)||u_;if(e===So){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function p_(t){return t.type===So&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function g_(t){return t.type===yl}function s$(t){return new P3.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function o$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function a$(t){return Buffer.from(o$(t),"base64")}function c$(t,e){const[r,n,i]=t.split("."),s=a$(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),u=`${r}.${n}`,l=new ll.SHA256().update(Buffer.from(u)).digest(),d=s$(e),p=Buffer.from(l).toString("hex");if(!d.verify(p,{r:o,s:a}))throw new Error("Invalid signature");return gm(t).payload}const u$="irn";function u1(t){return(t==null?void 0:t.relay)||{protocol:u$}}function _l(t){const e=uB[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var f$=Object.defineProperty,l$=Object.defineProperties,h$=Object.getOwnPropertyDescriptors,m_=Object.getOwnPropertySymbols,d$=Object.prototype.hasOwnProperty,p$=Object.prototype.propertyIsEnumerable,v_=(t,e,r)=>e in t?f$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b_=(t,e)=>{for(var r in e||(e={}))d$.call(e,r)&&v_(t,r,e[r]);if(m_)for(var r of m_(e))p$.call(e,r)&&v_(t,r,e[r]);return t},g$=(t,e)=>l$(t,h$(e));function m$(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function y_(t){if(!t.includes("wc:")){const u=e_(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=il.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:v$(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:m$(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function v$(t){return t.startsWith("//")?t.substring(2):t}function b$(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function w_(t){return`${t.protocol}:${t.topic}@${t.version}?`+il.stringify(b_(g$(b_({symKey:t.symKey},b$(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Wd(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Pu(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function y$(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Pu(r.accounts))}),e}function w$(t,e){const r=[];return Object.values(t).forEach(n=>{Pu(n.accounts).includes(e)&&r.push(...n.methods)}),r}function x$(t,e){const r=[];return Object.values(t).forEach(n=>{Pu(n.accounts).includes(e)&&r.push(...n.events)}),r}function f1(t){return t.includes(":")}function El(t){return f1(t)?t.split(":")[0]:t}function _$(t){const e={};return t==null||t.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function x_(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=_$(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=Ud(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const E$={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},S$={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ut(t,e){const{message:r,code:n}=S$[t];return{message:e?`${r} ${e}`:r,code:n}}function Dr(t,e){const{message:r,code:n}=E$[t];return{message:e?`${r} ${e}`:r,code:n}}function ic(t,e){return!!Array.isArray(t)}function Sl(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function bi(t){return typeof t>"u"}function an(t,e){return e&&bi(t)?!0:typeof t=="string"&&!!t.trim().length}function l1(t,e){return typeof t=="number"&&!isNaN(t)}function A$(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return ec(i,n)?(n.forEach(o=>{const{accounts:a,methods:u,events:l}=t.namespaces[o],d=Pu(a),p=r[o];(!ec(q3(o,p),d)||!ec(p.methods,u)||!ec(p.events,l))&&(s=!1)}),s):!1}function Kd(t){return an(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function P$(t){if(an(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Kd(r)}}return!1}function M$(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(an(t,!1)){if(e(t))return!0;const r=e_(t);return e(r)}}catch{}return!1}function I$(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function C$(t){return t==null?void 0:t.topic}function T$(t,e){let r=null;return an(t==null?void 0:t.publicKey,!1)||(r=ut("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function __(t){let e=!0;return ic(t)?t.length&&(e=t.every(r=>an(r,!1))):e=!1,e}function R$(t,e,r){let n=null;return ic(e)&&e.length?e.forEach(i=>{n||Kd(i)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Kd(t)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function D$(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=R$(i,q3(i,s),`${e} ${r}`);o&&(n=o)}),n}function O$(t,e){let r=null;return ic(t)?t.forEach(n=>{r||P$(n)||(r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function N$(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=O$(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function L$(t,e){let r=null;return __(t==null?void 0:t.methods)?__(t==null?void 0:t.events)||(r=Dr("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Dr("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function E_(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=L$(n,`${e}, namespace`);i&&(r=i)}),r}function k$(t,e,r){let n=null;if(t&&Sl(t)){const i=E_(t,e);i&&(n=i);const s=D$(t,e,r);s&&(n=s)}else n=ut("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function h1(t,e){let r=null;if(t&&Sl(t)){const n=E_(t,e);n&&(r=n);const i=N$(t,e);i&&(r=i)}else r=ut("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function S_(t){return an(t.protocol,!0)}function B$(t,e){let r=!1;return t?t&&ic(t)&&t.length&&t.forEach(n=>{r=S_(n)}):r=!0,r}function $$(t){return typeof t=="number"}function yi(t){return typeof t<"u"&&typeof t!==null}function F$(t){return!(!t||typeof t!="object"||!t.code||!l1(t.code)||!t.message||!an(t.message,!1))}function j$(t){return!(bi(t)||!an(t.method,!1))}function U$(t){return!(bi(t)||bi(t.result)&&bi(t.error)||!l1(t.id)||!an(t.jsonrpc,!1))}function q$(t){return!(bi(t)||!an(t.name,!1))}function A_(t,e){return!(!Kd(e)||!y$(t).includes(e))}function z$(t,e,r){return an(r,!1)?w$(t,e).includes(r):!1}function H$(t,e,r){return an(r,!1)?x$(t,e).includes(r):!1}function P_(t,e,r){let n=null;const i=W$(t),s=K$(e),o=Object.keys(i),a=Object.keys(s),u=M_(Object.keys(t)),l=M_(Object.keys(e)),d=u.filter(p=>!l.includes(p));return d.length&&(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${d.toString()} Received: ${Object.keys(e).toString()}`)),ec(o,a)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} Approved: ${a.toString()}`)),Object.keys(e).forEach(p=>{if(!p.includes(":")||n)return;const y=Pu(e[p].accounts);y.includes(p)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${p} Required: ${p} - Approved: ${y.toString()}`))}),o.forEach(p=>{n||(ec(i[p].methods,s[p].methods)?ec(i[p].events,s[p].events)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${p}`)):n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${p}`))}),n}function W$(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function P_(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function K$(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Pu(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function V$(t,e){return l1(t)&&t<=e.max&&t>=e.min}function M_(){const t=gl();return new Promise(e=>{switch(t){case Ri.browser:e(G$());break;case Ri.reactNative:e(Y$());break;case Ri.node:e(J$());break;default:e(!0)}})}function G$(){return pl()&&(navigator==null?void 0:navigator.onLine)}async function Y$(){if(Su()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function J$(){return!0}function X$(t){switch(gl()){case Ri.browser:Z$(t);break;case Ri.reactNative:Q$(t);break}}function Z$(t){!Su()&&pl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function Q$(t){Su()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const d1={};class Al{static get(e){return d1[e]}static set(e,r){d1[e]=r}static delete(e){delete d1[e]}}const eF="PARSE_ERROR",tF="INVALID_REQUEST",rF="METHOD_NOT_FOUND",nF="INVALID_PARAMS",I_="INTERNAL_ERROR",p1="SERVER_ERROR",iF=[-32700,-32600,-32601,-32602,-32603],Pl={[eF]:{code:-32700,message:"Parse error"},[tF]:{code:-32600,message:"Invalid Request"},[rF]:{code:-32601,message:"Method not found"},[nF]:{code:-32602,message:"Invalid params"},[I_]:{code:-32603,message:"Internal error"},[p1]:{code:-32e3,message:"Server error"}},C_=p1;function sF(t){return iF.includes(t)}function T_(t){return Object.keys(Pl).includes(t)?Pl[t]:Pl[C_]}function oF(t){const e=Object.values(Pl).find(r=>r.code===t);return e||Pl[C_]}function R_(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var D_={},Po={},O_;function aF(){if(O_)return Po;O_=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.isBrowserCryptoAvailable=Po.getSubtleCrypto=Po.getBrowerCrypto=void 0;function t(){return(nn==null?void 0:nn.crypto)||(nn==null?void 0:nn.msCrypto)||{}}Po.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Po.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Po.isBrowserCryptoAvailable=r,Po}var Mo={},N_;function cF(){if(N_)return Mo;N_=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.isBrowser=Mo.isNode=Mo.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Mo.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Mo.isNode=e;function r(){return!t()&&!e()}return Mo.isBrowser=r,Mo}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(aF(),t),e.__exportStar(cF(),t)})(D_);function ha(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function sc(t=6){return BigInt(ha(t))}function da(t,e,r){return{id:r||ha(),jsonrpc:"2.0",method:t,params:e}}function Vd(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Gd(t,e,r){return{id:t,jsonrpc:"2.0",error:uF(e)}}function uF(t,e){return typeof t>"u"?T_(I_):(typeof t=="string"&&(t=Object.assign(Object.assign({},T_(p1)),{message:t})),sF(t.code)&&(t=oF(t.code)),t)}let fF=class{},lF=class extends fF{constructor(){super()}},hF=class extends lF{constructor(e){super()}};const dF="^https?:",pF="^wss?:";function gF(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function L_(t,e){const r=gF(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function k_(t){return L_(t,dF)}function B_(t){return L_(t,pF)}function mF(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function $_(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function g1(t){return $_(t)&&"method"in t}function Yd(t){return $_(t)&&(Hs(t)||Yi(t))}function Hs(t){return"result"in t}function Yi(t){return"error"in t}let Ji=class extends hF{constructor(e){super(e),this.events=new qi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(da(e.method,e.params||[],e.id||sc().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Yi(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Yd(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const vF=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),bF=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",F_=t=>t.split("?")[0],j_=10,yF=vF();let wF=class{constructor(e){if(this.url=e,this.events=new qi.EventEmitter,this.registering=!1,!B_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(mo(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!B_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=D_.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!mF(e)},o=new yF(e,[],s);bF()?o.onerror=a=>{const u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ka(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return R_(e,F_(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>j_&&this.events.setMaxListeners(j_)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${F_(this.url)}`));return this.events.emit("register_error",r),r}};var Jd={exports:{}};Jd.exports,function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",u="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",p="[object Date]",y="[object Error]",A="[object Function]",P="[object GeneratorFunction]",N="[object Map]",D="[object Number]",k="[object Null]",B="[object Object]",j="[object Promise]",U="[object Proxy]",K="[object RegExp]",J="[object Set]",T="[object String]",z="[object Symbol]",ue="[object Undefined]",_e="[object WeakMap]",G="[object ArrayBuffer]",E="[object DataView]",m="[object Float32Array]",f="[object Float64Array]",g="[object Int8Array]",v="[object Int16Array]",x="[object Int32Array]",_="[object Uint8Array]",S="[object Uint8ClampedArray]",b="[object Uint16Array]",M="[object Uint32Array]",I=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,O={};O[m]=O[f]=O[g]=O[v]=O[x]=O[_]=O[S]=O[b]=O[M]=!0,O[a]=O[u]=O[G]=O[d]=O[E]=O[p]=O[y]=O[A]=O[N]=O[D]=O[B]=O[K]=O[J]=O[T]=O[_e]=!1;var se=typeof nn=="object"&&nn&&nn.Object===Object&&nn,ee=typeof self=="object"&&self&&self.Object===Object&&self,X=se||ee||Function("return this")(),Q=e&&!e.nodeType&&e,R=Q&&!0&&t&&!t.nodeType&&t,Z=R&&R.exports===Q,te=Z&&se.process,le=function(){try{return te&&te.binding&&te.binding("util")}catch{}}(),ie=le&&le.isTypedArray;function fe(ce,ye){for(var Ye=-1,It=ce==null?0:ce.length,jr=0,ir=[];++Ye-1}function st(ce,ye){var Ye=this.__data__,It=Xe(Ye,ce);return It<0?(++this.size,Ye.push([ce,ye])):Ye[It][1]=ye,this}Re.prototype.clear=De,Re.prototype.delete=it,Re.prototype.get=Ue,Re.prototype.has=gt,Re.prototype.set=st;function tt(ce){var ye=-1,Ye=ce==null?0:ce.length;for(this.clear();++yewn))return!1;var Ur=ir.get(ce);if(Ur&&ir.get(ye))return Ur==ye;var gn=-1,_i=!0,xn=Ye&s?new _t:void 0;for(ir.set(ce,ye),ir.set(ye,ce);++gn-1&&ce%1==0&&ce-1&&ce%1==0&&ce<=o}function up(ce){var ye=typeof ce;return ce!=null&&(ye=="object"||ye=="function")}function Pc(ce){return ce!=null&&typeof ce=="object"}var fp=ie?Te(ie):dr;function Ub(ce){return Fb(ce)?qe(ce):pr(ce)}function Fr(){return[]}function kr(){return!1}t.exports=jb}(Jd,Jd.exports);var xF=Jd.exports;const _F=ji(xF),U_="wc",q_=2,z_="core",Ws=`${U_}@2:${z_}:`,EF={logger:"error"},SF={database:":memory:"},AF="crypto",H_="client_ed25519_seed",PF=mt.ONE_DAY,MF="keychain",IF="0.3",CF="messages",TF="0.3",RF=mt.SIX_HOURS,DF="publisher",W_="irn",OF="error",K_="wss://relay.walletconnect.org",NF="relayer",ii={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},LF="_subscription",Xi={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},kF=.1,m1="2.17.2",Wr={link_mode:"link_mode",relay:"relay"},BF="0.3",$F="WALLETCONNECT_CLIENT_ID",V_="WALLETCONNECT_LINK_MODE_APPS",Ks={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},FF="subscription",jF="0.3",UF=mt.FIVE_SECONDS*1e3,qF="pairing",zF="0.3",Ml={wc_pairingDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:0},res:{ttl:mt.ONE_DAY,prompt:!1,tag:0}}},oc={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},bs={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},HF="history",WF="0.3",KF="expirer",Zi={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},VF="0.3",GF="verify-api",YF="https://verify.walletconnect.com",G_="https://verify.walletconnect.org",Il=G_,JF=`${Il}/v3`,XF=[YF,G_],ZF="echo",QF="https://echo.walletconnect.com",Vs={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},Io={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},ys={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},ac={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},cc={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Cl={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},ej=.1,tj="event-client",rj=86400,nj="https://pulse.walletconnect.org/batch";function ij(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(j);k!==B;){for(var K=P[k],J=0,T=j-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=j-D;z!==j&&U[z]===0;)z++;for(var ue=u.repeat(N);z>>0,j=new Uint8Array(B);P[N];){var U=r[P.charCodeAt(N)];if(U===255)return;for(var K=0,J=B-1;(U!==0||K>>0,j[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,N++}if(P[N]!==" "){for(var T=B-k;T!==B&&j[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=j[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:A}}var sj=ij,oj=sj;const Y_=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},aj=t=>new TextEncoder().encode(t),cj=t=>new TextDecoder().decode(t);class uj{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class fj{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return J_(this,e)}}class lj{constructor(e){this.decoders=e}or(e){return J_(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const J_=(t,e)=>new lj({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class hj{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new uj(e,r,n),this.decoder=new fj(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Xd=({name:t,prefix:e,encode:r,decode:n})=>new hj(t,e,r,n),Tl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=oj(r,e);return Xd({prefix:t,name:e,encode:n,decode:s=>Y_(i(s))})},dj=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},pj=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Xd({prefix:e,name:t,encode(i){return pj(i,n,r)},decode(i){return dj(i,n,r,t)}}),gj=Xd({prefix:"\0",name:"identity",encode:t=>cj(t),decode:t=>aj(t)});var mj=Object.freeze({__proto__:null,identity:gj});const vj=zn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var bj=Object.freeze({__proto__:null,base2:vj});const yj=zn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var wj=Object.freeze({__proto__:null,base8:yj});const xj=Tl({prefix:"9",name:"base10",alphabet:"0123456789"});var _j=Object.freeze({__proto__:null,base10:xj});const Ej=zn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Sj=zn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Aj=Object.freeze({__proto__:null,base16:Ej,base16upper:Sj});const Pj=zn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Mj=zn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ij=zn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Cj=zn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Tj=zn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Rj=zn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Dj=zn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Oj=zn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Nj=zn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Lj=Object.freeze({__proto__:null,base32:Pj,base32upper:Mj,base32pad:Ij,base32padupper:Cj,base32hex:Tj,base32hexupper:Rj,base32hexpad:Dj,base32hexpadupper:Oj,base32z:Nj});const kj=Tl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Bj=Tl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var $j=Object.freeze({__proto__:null,base36:kj,base36upper:Bj});const Fj=Tl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),jj=Tl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Uj=Object.freeze({__proto__:null,base58btc:Fj,base58flickr:jj});const qj=zn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zj=zn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Hj=zn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Wj=zn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Kj=Object.freeze({__proto__:null,base64:qj,base64pad:zj,base64url:Hj,base64urlpad:Wj});const X_=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Vj=X_.reduce((t,e,r)=>(t[r]=e,t),[]),Gj=X_.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Yj(t){return t.reduce((e,r)=>(e+=Vj[r],e),"")}function Jj(t){const e=[];for(const r of t){const n=Gj[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const Xj=Xd({prefix:"🚀",name:"base256emoji",encode:Yj,decode:Jj});var Zj=Object.freeze({__proto__:null,base256emoji:Xj}),Qj=Q_,Z_=128,eU=127,tU=~eU,rU=Math.pow(2,31);function Q_(t,e,r){e=e||[],r=r||0;for(var n=r;t>=rU;)e[r++]=t&255|Z_,t/=128;for(;t&tU;)e[r++]=t&255|Z_,t>>>=7;return e[r]=t|0,Q_.bytes=r-n+1,e}var nU=v1,iU=128,e6=127;function v1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw v1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&e6)<=iU);return v1.bytes=s-n,r}var sU=Math.pow(2,7),oU=Math.pow(2,14),aU=Math.pow(2,21),cU=Math.pow(2,28),uU=Math.pow(2,35),fU=Math.pow(2,42),lU=Math.pow(2,49),hU=Math.pow(2,56),dU=Math.pow(2,63),pU=function(t){return t(t6.encode(t,e,r),e),n6=t=>t6.encodingLength(t),b1=(t,e)=>{const r=e.byteLength,n=n6(t),i=n+n6(r),s=new Uint8Array(i+r);return r6(t,s,0),r6(r,s,n),s.set(e,i),new mU(t,r,e,s)};class mU{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const i6=({name:t,code:e,encode:r})=>new vU(t,e,r);class vU{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?b1(this.code,r):r.then(n=>b1(this.code,n))}else throw Error("Unknown type, must be binary type")}}const s6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),bU=i6({name:"sha2-256",code:18,encode:s6("SHA-256")}),yU=i6({name:"sha2-512",code:19,encode:s6("SHA-512")});var wU=Object.freeze({__proto__:null,sha256:bU,sha512:yU});const o6=0,xU="identity",a6=Y_;var _U=Object.freeze({__proto__:null,identity:{code:o6,name:xU,encode:a6,digest:t=>b1(o6,a6(t))}});new TextEncoder,new TextDecoder;const c6={...mj,...bj,...wj,..._j,...Aj,...Lj,...$j,...Uj,...Kj,...Zj};({...wU,..._U});function EU(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function u6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const f6=u6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),y1=u6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=EU(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=ut("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,V3(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?G3(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}},MU=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=AF,this.randomSessionIdentifier=c1(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=wx(i);return yx(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=ZB();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=wx(s),a=this.randomSessionIdentifier;return await LO(a,i,PF,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),u=QB(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||Hd(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=h_(o),u=mo(s);if(p_(a))return t$(u,o==null?void 0:o.encoding);if(d_(a)){const y=a.senderPublicKey,A=a.receiverPublicKey;i=await this.generateSharedKey(y,A)}const l=this.getSymKey(i),{type:d,senderPublicKey:p}=a;return e$({type:d,symKey:l,message:u,senderPublicKey:p,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=i$(s,o);if(p_(a)){const u=n$(s,o==null?void 0:o.encoding);return Ka(u)}if(d_(a)){const u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{const u=this.getSymKey(i),l=r$({symKey:u,encoded:s,encoding:o==null?void 0:o.encoding});return Ka(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=(i,s=la)=>{const o=xl({encoded:i,encoding:s});return nc(o.type)},this.getPayloadSenderPublicKey=(i,s=la)=>{const o=xl({encoded:i,encoding:s});return o.senderPublicKey?Tn(o.senderPublicKey,ni):void 0},this.core=e,this.logger=ri(r,this.name),this.keychain=n||new PU(this.core,this.logger)}get context(){return gi(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(H_)}catch{e=c1(),await this.keychain.set(H_,e)}return AU(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}};class IU extends zR{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=CF,this.version=TF,this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Ao(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Ao(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=ri(e,this.name),this.core=r}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,V3(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?G3(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class CU extends HR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new qi.EventEmitter,this.name=DF,this.queue=new Map,this.publishTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.failedPublishTimeout=mt.toMiliseconds(mt.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||RF,u=u1(s),l=(s==null?void 0:s.prompt)||!1,d=(s==null?void 0:s.tag)||0,p=(s==null?void 0:s.id)||sc().toString(),y={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:d,id:p,attestation:s==null?void 0:s.attestation}},A=`Failed to publish payload, please try again. id:${p} tag:${d}`,P=Date.now();let N,D=1;try{for(;N===void 0;){if(Date.now()-P>this.publishTimeout)throw new Error(A);this.logger.trace({id:p,attempts:D},`publisher.publish - attempt ${D}`),N=await await Au(this.rpcPublish(n,i,a,u,l,d,p,s==null?void 0:s.attestation).catch(k=>this.logger.warn(k)),this.publishTimeout,A),D++,N||await new Promise(k=>setTimeout(k,this.failedPublishTimeout))}this.relayer.events.emit(ii.publish,y),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:p,topic:n,message:i,opts:s}})}catch(k){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(k),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw k;this.queue.set(p,y)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=ri(r,this.name),this.registerEventListeners()}get context(){return gi(this.logger)}rpcPublish(e,r,n,i,s,o,a,u){var l,d,p,y;const A={method:_l(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:u},id:a};return bi((l=A.params)==null?void 0:l.prompt)&&((d=A.params)==null||delete d.prompt),bi((p=A.params)==null?void 0:p.tag)&&((y=A.params)==null||delete y.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:A}),this.relayer.request(A)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(iu.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ii.connection_stalled);return}this.checkQueue()}),this.relayer.on(ii.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class TU{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var RU=Object.defineProperty,DU=Object.defineProperties,OU=Object.getOwnPropertyDescriptors,l6=Object.getOwnPropertySymbols,NU=Object.prototype.hasOwnProperty,LU=Object.prototype.propertyIsEnumerable,h6=(t,e,r)=>e in t?RU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rl=(t,e)=>{for(var r in e||(e={}))NU.call(e,r)&&h6(t,r,e[r]);if(l6)for(var r of l6(e))LU.call(e,r)&&h6(t,r,e[r]);return t},w1=(t,e)=>DU(t,OU(e));class kU extends VR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new TU,this.events=new qi.EventEmitter,this.name=FF,this.version=jF,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Ws,this.subscribeTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=u1(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new mt.Watch;a.start(i);const u=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(u),a.stop(i),s(!0)),a.elapsed(i)>=UF&&(clearInterval(u),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ri(r,this.name),this.clientId=""}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=u1(n);await this.rpcUnsubscribe(e,r,i);const s=Dr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===Wr.relay&&await this.restartToComplete();const s={method:_l(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=Ao(e+this.clientId);if((n==null?void 0:n.transportType)===Wr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},mt.toMiliseconds(mt.ONE_SECOND)),a;const u=await Au(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return u?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ii.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Au(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Au(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:_l(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,w1(Rl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Rl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Rl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Ks.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Ks.deleted,w1(Rl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Ks.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);ic(r)&&this.onBatchSubscribe(r.map((n,i)=>w1(Rl({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(iu.pulse,async()=>{await this.checkPending()}),this.events.on(Ks.created,async e=>{const r=Ks.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Ks.deleted,async e=>{const r=Ks.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var BU=Object.defineProperty,d6=Object.getOwnPropertySymbols,$U=Object.prototype.hasOwnProperty,FU=Object.prototype.propertyIsEnumerable,p6=(t,e,r)=>e in t?BU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,g6=(t,e)=>{for(var r in e||(e={}))$U.call(e,r)&&p6(t,r,e[r]);if(d6)for(var r of d6(e))FU.call(e,r)&&p6(t,r,e[r]);return t};class jU extends WR{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new qi.EventEmitter,this.name=NF,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=mt.toMiliseconds(mt.THIRTY_SECONDS+mt.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||sc().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(u,l)=>{const d=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Xi.disconnect,d);const p=await o;this.provider.off(Xi.disconnect,d),u(p)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(jd())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(ii.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ii.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Xi.payload,this.onPayloadHandler),this.provider.on(Xi.connect,this.onConnectHandler),this.provider.on(Xi.disconnect,this.onDisconnectHandler),this.provider.on(Xi.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ri(e.logger,this.name):Qf(od({level:e.logger||OF})),this.messages=new IU(this.logger,e.core),this.subscriber=new kU(this,this.logger),this.publisher=new CU(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||K_,this.projectId=e.projectId,this.bundleId=mB(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return gi(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Wr.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",u;const l=d=>{d.topic===e&&(this.subscriber.off(Ks.created,l),u())};return await Promise.all([new Promise(d=>{u=d,this.subscriber.on(Ks.created,l)}),new Promise(async(d,p)=>{a=await this.subscriber.subscribe(e,g6({internal:{throwOnFailedPublish:o}},r)).catch(y=>{o&&p(y)})||a,d()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Au(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Xi.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Xi.disconnect,i),await Au(this.provider.connect(),mt.toMiliseconds(mt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await M_())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=En(mt.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(ii.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(jd())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Ji(new wF(wB({sdkVersion:m1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),g1(e)){if(!e.method.endsWith(LF))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:Wr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(g6({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else Yd(e)&&this.events.emit(ii.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ii.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Vd(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Xi.payload,this.onPayloadHandler),this.provider.off(Xi.connect,this.onConnectHandler),this.provider.off(Xi.disconnect,this.onDisconnectHandler),this.provider.off(Xi.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await M_();X$(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(ii.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},mt.toMiliseconds(kF))))}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var UU=Object.defineProperty,m6=Object.getOwnPropertySymbols,qU=Object.prototype.hasOwnProperty,zU=Object.prototype.propertyIsEnumerable,v6=(t,e,r)=>e in t?UU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b6=(t,e)=>{for(var r in e||(e={}))qU.call(e,r)&&v6(t,r,e[r]);if(m6)for(var r of m6(e))zU.call(e,r)&&v6(t,r,e[r]);return t};class uc extends KR{constructor(e,r,n,i=Ws,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=BF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!bi(o)?this.map.set(this.getKey(o),o):I$(o)?this.map.set(o.id,o):C$(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>_F(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const u=b6(b6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=ri(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class HU{constructor(e,r){this.core=e,this.logger=r,this.name=qF,this.version=zF,this.events=new Yg,this.initialized=!1,this.storagePrefix=Ws,this.ignoredPayloadTypes=[So],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=c1(),s=await this.core.crypto.setSymKey(i),o=En(mt.FIVE_MINUTES),a={protocol:W_},u={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=y_({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(oc.create,u),this.core.expirer.set(s,o),await this.pairings.set(s,u),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Vs.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:u,methods:l}=b_(n.uri);i.props.properties.topic=s,i.addTrace(Vs.pairing_uri_validation_success),i.addTrace(Vs.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(Vs.existing_pairing),d.active)throw i.setError(Io.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Vs.pairing_not_expired)}const p=u||En(mt.FIVE_MINUTES),y={topic:s,relay:a,expiry:p,active:!1,methods:l};this.core.expirer.set(s,p),await this.pairings.set(s,y),i.addTrace(Vs.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(oc.create,y),i.addTrace(Vs.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Vs.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Io.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(A){throw i.setError(Io.subscribe_pairing_topic_failure),A}return i.addTrace(Vs.subscribe_pairing_topic_success),y},this.activate=async({topic:n})=>{this.isInitialized();const i=En(mt.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=tc();this.events.once(vr("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Dr("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,u=this.core.crypto.keychain.get(i);return y_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:u,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=da(i,s),a=await this.core.crypto.encode(n,o),u=Ml[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{const o=Vd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=Gd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method]?Ml[u.request.method].res:Ml.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Dr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>fa(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(oc.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{Hs(i)?this.events.emit(vr("pairing_ping",s),{}):Yi(i)&&this.events.emit(vr("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(oc.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Dr("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Dr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!yi(n)){const{message:a}=ut("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!M$(n.uri)){const{message:a}=ut("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}const o=b_(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&mt.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!an(n,!1)){const{message:i}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(fa(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ut("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=ri(r,this.name),this.pairings=new uc(this.core,this.logger,this.name,this.storagePrefix)}get context(){return gi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ii.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===Wr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{g1(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):Yd(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Zi.expired,async e=>{const{topic:r}=J3(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(oc.expire,{topic:r}))})}}class WU extends qR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new qi.EventEmitter,this.name=HF,this.version=WF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:En(mt.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(bs.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Yi(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(bs.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(bs.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:da(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(bs.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(bs.created,e=>{const r=bs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.updated,e=>{const r=bs.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.deleted,e=>{const r=bs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(iu.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{mt.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(bs.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class KU extends GR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new qi.EventEmitter,this.name=KF,this.version=VF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Zi.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Zi.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return xB(e);if(typeof e=="number")return _B(e);const{message:r}=ut("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Zi.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;mt.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Zi.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(iu.pulse,()=>this.checkExpirations()),this.events.on(Zi.created,e=>{const r=Zi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.expired,e=>{const r=Zi.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.deleted,e=>{const r=Zi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class VU extends YR{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=GF,this.verifyUrlV3=JF,this.storagePrefix=Ws,this.version=q_,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&mt.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!pl()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,u=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=nl(),d=this.startAbortTimer(mt.ONE_SECOND*5),p=await new Promise((y,A)=>{const P=()=>{window.removeEventListener("message",D),l.body.removeChild(N),A("attestation aborted")};this.abortController.signal.addEventListener("abort",P);const N=l.createElement("iframe");N.src=u,N.style.display="none",N.addEventListener("error",P,{signal:this.abortController.signal});const D=k=>{if(k.data&&typeof k.data=="string")try{const B=JSON.parse(k.data);if(B.type==="verify_attestation"){if(gm(B.attestation).payload.id!==o)return;clearInterval(d),l.body.removeChild(N),this.abortController.signal.removeEventListener("abort",P),window.removeEventListener("message",D),y(B.attestation===null?"":B.attestation)}}catch(B){this.logger.warn(B)}};l.body.appendChild(N),window.addEventListener("message",D,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",p),p}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(gm(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const u=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,u)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(mt.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Il;return XF.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Il}`),s=Il),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(mt.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=c$(i,s.publicKey),a={hasExpired:mt.toMiliseconds(o.exp)this.abortController.abort(),mt.toMiliseconds(e))}}class GU extends JR{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=ZF,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${QF}/${this.projectId}/clients`;await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=ri(r,this.context)}}var YU=Object.defineProperty,y6=Object.getOwnPropertySymbols,JU=Object.prototype.hasOwnProperty,XU=Object.prototype.propertyIsEnumerable,w6=(t,e,r)=>e in t?YU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dl=(t,e)=>{for(var r in e||(e={}))JU.call(e,r)&&w6(t,r,e[r]);if(y6)for(var r of y6(e))XU.call(e,r)&&w6(t,r,e[r]);return t};class ZU extends XR{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=tj,this.storagePrefix=Ws,this.storageVersion=ej,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!i1())try{const i={eventId:Z3(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:K3(this.core.relayer.protocol,this.core.relayer.version,m1)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:u}}=i,l=Z3(),d=this.core.projectId||"",p=Date.now(),y=Dl({eventId:l,timestamp:p,props:{event:s,type:o,properties:{topic:a,trace:u}},bundleId:d,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,y),this.shouldPersist=!0),y},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(u=>u.props.properties.topic===o);if(a)return Dl(Dl({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(iu.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{mt.fromMiliseconds(Date.now())-mt.fromMiliseconds(i.timestamp)>rj&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Dl(Dl({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${nj}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${m1}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>W3().url,this.logger=ri(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var QU=Object.defineProperty,x6=Object.getOwnPropertySymbols,eq=Object.prototype.hasOwnProperty,tq=Object.prototype.propertyIsEnumerable,_6=(t,e,r)=>e in t?QU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,E6=(t,e)=>{for(var r in e||(e={}))eq.call(e,r)&&_6(t,r,e[r]);if(x6)for(var r of x6(e))tq.call(e,r)&&_6(t,r,e[r]);return t};class x1 extends UR{constructor(e){var r;super(e),this.protocol=U_,this.version=q_,this.name=z_,this.events=new qi.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:u})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:Wr.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||K_,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=od({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:EF.logger}),{logger:i,chunkLoggerController:s}=jR({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ri(i,this.name),this.heartbeat=new NT,this.crypto=new MU(this,this.logger,e==null?void 0:e.keychain),this.history=new WU(this,this.logger),this.expirer=new KU(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new hR(E6(E6({},SF),e==null?void 0:e.storageOptions)),this.relayer=new jU({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new HU(this,this.logger),this.verify=new VU(this,this.logger,this.storage),this.echoClient=new GU(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new ZU(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new x1(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem($F,n),r}get context(){return gi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(V_,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(V_)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const rq=x1,S6="wc",A6=2,P6="client",_1=`${S6}@${A6}:${P6}:`,E1={name:P6,logger:"error"},M6="WALLETCONNECT_DEEPLINK_CHOICE",nq="proposal",I6="Proposal expired",iq="session",Mu=mt.SEVEN_DAYS,sq="engine",kn={wc_sessionPropose:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:mt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:mt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1119}}},S1={min:mt.FIVE_MINUTES,max:mt.SEVEN_DAYS},Gs={idle:"IDLE",active:"ACTIVE"},oq="request",aq=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],cq="wc",uq="auth",fq="authKeys",lq="pairingTopics",hq="requests",Zd=`${cq}@${1.5}:${uq}:`,Qd=`${Zd}:PUB_KEY`;var dq=Object.defineProperty,pq=Object.defineProperties,gq=Object.getOwnPropertyDescriptors,C6=Object.getOwnPropertySymbols,mq=Object.prototype.hasOwnProperty,vq=Object.prototype.propertyIsEnumerable,T6=(t,e,r)=>e in t?dq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))mq.call(e,r)&&T6(t,r,e[r]);if(C6)for(var r of C6(e))vq.call(e,r)&&T6(t,r,e[r]);return t},ws=(t,e)=>pq(t,gq(e));class bq extends QR{constructor(e){super(e),this.name=sq,this.events=new Yg,this.initialized=!1,this.requestQueue={state:Gs.idle,queue:[]},this.sessionRequestQueue={state:Gs.idle,queue:[]},this.requestQueueDelay=mt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(kn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=ws(tn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n;let l=i,d,p=!1;try{l&&(p=this.client.core.pairing.pairings.get(l).active)}catch(U){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),U}if(!l||!p){const{topic:U,uri:K}=await this.client.core.pairing.create();l=U,d=K}if(!l){const{message:U}=ut("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(U)}const y=await this.client.core.crypto.generateKeyPair(),A=kn.wc_sessionPropose.req.ttl||mt.FIVE_MINUTES,P=En(A),N=tn({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:W_}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:P,pairingTopic:l},a&&{sessionProperties:a}),{reject:D,resolve:k,done:B}=tc(A,I6);this.events.once(vr("session_connect"),async({error:U,session:K})=>{if(U)D(U);else if(K){K.self.publicKey=y;const J=ws(tn({},K),{pairingTopic:N.pairingTopic,requiredNamespaces:N.requiredNamespaces,optionalNamespaces:N.optionalNamespaces,transportType:Wr.relay});await this.client.session.set(K.topic,J),await this.setExpiry(K.topic,K.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:K.peer.metadata}),this.cleanupDuplicatePairings(J),k(J)}});const j=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:N,throwOnFailedPublish:!0});return await this.setProposal(j,tn({id:j},N)),{uri:d,approval:B}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[ys.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(z){throw o.setError(ac.no_internet_connection),z}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(z){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(ac.proposal_not_found),z}try{await this.isValidApprove(r)}catch(z){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(ac.session_approve_namespace_validation_failure),z}const{id:a,relayProtocol:u,namespaces:l,sessionProperties:d,sessionConfig:p}=r,y=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:A,proposer:P,requiredNamespaces:N,optionalNamespaces:D}=y;let k=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:A});k||(k=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:ys.session_approve_started,properties:{topic:A,trace:[ys.session_approve_started,ys.session_namespaces_validation_success]}}));const B=await this.client.core.crypto.generateKeyPair(),j=P.publicKey,U=await this.client.core.crypto.generateSharedKey(B,j),K=tn(tn({relay:{protocol:u??"irn"},namespaces:l,controller:{publicKey:B,metadata:this.client.metadata},expiry:En(Mu)},d&&{sessionProperties:d}),p&&{sessionConfig:p}),J=Wr.relay;k.addTrace(ys.subscribing_session_topic);try{await this.client.core.relayer.subscribe(U,{transportType:J})}catch(z){throw k.setError(ac.subscribe_session_topic_failure),z}k.addTrace(ys.subscribe_session_topic_success);const T=ws(tn({},K),{topic:U,requiredNamespaces:N,optionalNamespaces:D,pairingTopic:A,acknowledged:!1,self:K.controller,peer:{publicKey:P.publicKey,metadata:P.metadata},controller:B,transportType:Wr.relay});await this.client.session.set(U,T),k.addTrace(ys.store_session);try{k.addTrace(ys.publishing_session_settle),await this.sendRequest({topic:U,method:"wc_sessionSettle",params:K,throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(ac.session_settle_publish_failure),z}),k.addTrace(ys.session_settle_publish_success),k.addTrace(ys.publishing_session_approve),await this.sendResult({id:a,topic:A,result:{relay:{protocol:u??"irn"},responderPublicKey:B},throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(ac.session_approve_publish_failure),z}),k.addTrace(ys.session_approve_publish_success)}catch(z){throw this.client.logger.error(z),this.client.session.delete(U,Dr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(U),z}return this.client.core.eventClient.deleteEvent({eventId:k.eventId}),await this.client.core.pairing.updateMetadata({topic:A,metadata:P.metadata}),await this.client.proposal.delete(a,Dr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:A}),await this.setExpiry(U,En(Mu)),{topic:U,acknowledged:()=>Promise.resolve(this.client.session.get(U))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:kn.wc_sessionPropose.reject}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(p){throw this.client.logger.error("update() -> isValidUpdate() failed"),p}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=tc(),u=ha(),l=sc().toString(),d=this.client.session.get(n).namespaces;return this.events.once(vr("session_update",u),({error:p})=>{p?a(p):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:u,relayRpcId:l}).catch(p=>{this.client.logger.error(p),this.client.session.update(n,{namespaces:d}),a(p)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(u){throw this.client.logger.error("extend() -> isValidExtend() failed"),u}const{topic:n}=r,i=ha(),{done:s,resolve:o,reject:a}=tc();return this.events.once(vr("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,En(Mu)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(u=>{a(u)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(P){throw this.client.logger.error("request() -> isValidRequest() failed"),P}const{chainId:n,request:i,topic:s,expiry:o=kn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=ha(),l=sc().toString(),{done:d,resolve:p,reject:y}=tc(o,"Request expired. Please try again.");this.events.once(vr("session_request",u),({error:P,result:N})=>{P?y(P):p(N)});const A=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return A?(await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:A}).catch(P=>y(P)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),await d()):await Promise.all([new Promise(async P=>{await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(N=>y(N)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),P()}),new Promise(async P=>{var N;if(!((N=a.sessionConfig)!=null&&N.disableDeepLink)){const D=await AB(this.client.core.storage,M6);await EB({id:u,topic:s,wcDeepLink:D})}P()}),d()]).then(P=>P[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);Hs(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Yi(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=ha(),s=sc().toString(),{done:o,resolve:a,reject:u}=tc();this.events.once(vr("session_ping",i),({error:l})=>{l?u(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=sc().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Dr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ut("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>A$(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?Wr.link_mode:Wr.relay;o===Wr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:u="",uri:l,domain:d,nonce:p,type:y,exp:A,nbf:P,methods:N=[],expiry:D}=r,k=[...r.resources||[]],{topic:B,uri:j}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:B,uri:j}});const U=await this.client.core.crypto.generateKeyPair(),K=Hd(U);if(await Promise.all([this.client.auth.authKeys.set(Qd,{responseTopic:K,publicKey:U}),this.client.auth.pairingTopics.set(K,{topic:K,pairingTopic:B})]),await this.client.core.relayer.subscribe(K,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${B}`),N.length>0){const{namespace:_}=Eu(a[0]);let S=KB(_,"request",N);zd(k)&&(S=GB(S,k.pop())),k.push(S)}const J=D&&D>kn.wc_sessionAuthenticate.req.ttl?D:kn.wc_sessionAuthenticate.req.ttl,T={authPayload:{type:y??"caip122",chains:a,statement:u,aud:l,domain:d,version:"1",nonce:p,iat:new Date().toISOString(),exp:A,nbf:P,resources:k},requester:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(J)},z={eip155:{chains:a,methods:[...new Set(["personal_sign",...N])],events:["chainChanged","accountsChanged"]}},ue={requiredNamespaces:{},optionalNamespaces:z,relays:[{protocol:"irn"}],pairingTopic:B,proposer:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(kn.wc_sessionPropose.req.ttl)},{done:_e,resolve:G,reject:E}=tc(J,"Request expired"),m=async({error:_,session:S})=>{if(this.events.off(vr("session_request",g),f),_)E(_);else if(S){S.self.publicKey=U,await this.client.session.set(S.topic,S),await this.setExpiry(S.topic,S.expiry),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:S.peer.metadata});const b=this.client.session.get(S.topic);await this.deleteProposal(v),G({session:b})}},f=async _=>{var S,b,M;if(await this.deletePendingAuthRequest(g,{message:"fulfilled",code:0}),_.error){const X=Dr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return _.error.code===X.code?void 0:(this.events.off(vr("session_connect"),m),E(_.error.message))}await this.deleteProposal(v),this.events.off(vr("session_connect"),m);const{cacaos:I,responder:F}=_.result,ae=[],O=[];for(const X of I){await r_({cacao:X,projectId:this.client.core.projectId})||(this.client.logger.error(X,"Signature verification failed"),E(Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Q}=X,R=zd(Q.resources),Z=[o1(Q.iss)],te=qd(Q.iss);if(R){const le=s_(R),ie=o_(R);ae.push(...le),Z.push(...ie)}for(const le of Z)O.push(`${le}:${te}`)}const se=await this.client.core.crypto.generateSharedKey(U,F.publicKey);let ee;ae.length>0&&(ee={topic:se,acknowledged:!0,self:{publicKey:U,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:En(Mu),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:B,namespaces:w_([...new Set(ae)],[...new Set(O)]),transportType:o},await this.client.core.relayer.subscribe(se,{transportType:o}),await this.client.session.set(se,ee),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:F.metadata}),ee=this.client.session.get(se)),(S=this.client.metadata.redirect)!=null&&S.linkMode&&(b=F.metadata.redirect)!=null&&b.linkMode&&(M=F.metadata.redirect)!=null&&M.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(se,{transportType:Wr.link_mode})),G({auths:I,session:ee})},g=ha(),v=ha();this.events.once(vr("session_connect"),m),this.events.once(vr("session_request",g),f);let x;try{if(s){const _=da("wc_sessionAuthenticate",T,g);this.client.core.history.set(B,_);const S=await this.client.core.crypto.encode("",_,{type:yl,encoding:vl});x=Wd(n,B,S)}else await Promise.all([this.sendRequest({topic:B,method:"wc_sessionAuthenticate",params:T,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:g}),this.sendRequest({topic:B,method:"wc_sessionPropose",params:ue,expiry:kn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:v})])}catch(_){throw this.events.off(vr("session_connect"),m),this.events.off(vr("session_request",g),f),_}return await this.setProposal(v,tn({id:v},ue)),await this.setAuthRequest(g,{request:ws(tn({},T),{verifyContext:{}}),pairingTopic:B,transportType:o}),{uri:x??j,response:_e}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[cc.authenticated_session_approve_started]}});try{this.isInitialized()}catch(D){throw s.setError(Cl.no_internet_connection),D}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Cl.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||Wr.relay;a===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=Hd(u),p={type:So,receiverPublicKey:u,senderPublicKey:l},y=[],A=[];for(const D of i){if(!await r_({cacao:D,projectId:this.client.core.projectId})){s.setError(Cl.invalid_cacao);const K=Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:K,encodeOpts:p}),new Error(K.message)}s.addTrace(cc.cacaos_verified);const{p:k}=D,B=zd(k.resources),j=[o1(k.iss)],U=qd(k.iss);if(B){const K=s_(B),J=o_(B);y.push(...K),j.push(...J)}for(const K of j)A.push(`${K}:${U}`)}const P=await this.client.core.crypto.generateSharedKey(l,u);s.addTrace(cc.create_authenticated_session_topic);let N;if((y==null?void 0:y.length)>0){N={topic:P,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:u,metadata:o.requester.metadata},controller:u,expiry:En(Mu),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:w_([...new Set(y)],[...new Set(A)]),transportType:a},s.addTrace(cc.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(P,{transportType:a})}catch(D){throw s.setError(Cl.subscribe_authenticated_session_topic_failure),D}s.addTrace(cc.subscribe_authenticated_session_topic_success),await this.client.session.set(P,N),s.addTrace(cc.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(cc.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:p,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(D){throw s.setError(Cl.authenticated_session_approve_publish_failure),D}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:N}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),u=Hd(o),l={type:So,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:u,error:i,encodeOpts:l,rpcOpts:kn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return n_(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:u}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Dr("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(M6).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,Dr("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Gs.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(ac.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Dr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Gs.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,En(kn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=Wr.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||En(kn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l,appLink:d}=r,p=da(i,s,u);let y;const A=!!d;try{const D=A?vl:la;y=await this.client.core.crypto.encode(n,p,{encoding:D})}catch(D){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),D}let P;if(aq.includes(i)){const D=Ao(JSON.stringify(p)),k=Ao(y);P=await this.client.core.verify.register({id:k,decryptedId:D})}const N=kn[i].req;if(N.attestation=P,o&&(N.ttl=o),a&&(N.id=a),this.client.core.history.set(n,p),A){const D=Wd(d,n,y);await global.Linking.openURL(D,this.client.name)}else{const D=kn[i].req;o&&(D.ttl=o),a&&(D.id=a),l?(D.internal=ws(tn({},D.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,y,D)):this.client.core.relayer.publish(n,y,D).catch(k=>this.client.logger.error(k))}return p.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:u}=r,l=Vd(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=p?vl:la;d=await this.client.core.crypto.encode(i,l,ws(tn({},a||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),A}if(p){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=kn[y.request.method].res;o?(A.internal=ws(tn({},A.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,A)):this.client.core.relayer.publish(i,d,A).catch(P=>this.client.logger.error(P))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:u}=r,l=Gd(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=p?vl:la;d=await this.client.core.crypto.encode(i,l,ws(tn({},o||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),A}if(p){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=a||kn[y.request.method].res;this.client.core.relayer.publish(i,d,A)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;fa(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{fa(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Gs.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Gs.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Gs.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,u=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:u}))switch(u){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=ut("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:u}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(tn({},i.params));const d=a.expiryTimestamp||En(kn.wc_sessionPropose.req.ttl),p=tn({id:u,pairingTopic:n,expiryTimestamp:d},a);await this.setProposal(u,p);const y=await this.getVerifyContext({attestationId:s,hash:Ao(JSON.stringify(i)),encryptedId:o,metadata:p.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(Io.proposal_listener_not_found)),l==null||l.addTrace(Vs.emit_session_proposal),this.client.events.emit("session_proposal",{id:u,params:p,verifyContext:y})}catch(l){await this.sendError({id:u,topic:n,error:l,rpcOpts:kn.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(Hs(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const u=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const d=await this.client.core.crypto.generateSharedKey(u,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:d});const p=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:p}),await this.client.core.pairing.activate({topic:r})}else if(Yi(n)){await this.client.proposal.delete(s,Dr("USER_DISCONNECTED"));const o=vr("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(vr("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:u,namespaces:l,sessionProperties:d,sessionConfig:p}=n.params,y=ws(tn(tn({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},d&&{sessionProperties:d}),p&&{sessionConfig:p}),{transportType:Wr.relay}),A=vr("session_connect");if(this.events.listenerCount(A)===0)throw new Error(`emitting ${A} without any listeners 997`);this.events.emit(vr("session_connect"),{session:y}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;Hs(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(vr("session_approve",i),{})):Yi(n)&&(await this.client.session.delete(r,Dr("USER_DISCONNECTED")),this.events.emit(vr("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Dr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(tn({topic:r},i));try{Al.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(u){throw Al.delete(o),u}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=vr("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_update",i),{}):Yi(n)&&this.events.emit(vr("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,En(Mu)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=vr("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_extend",i),{}):Yi(n)&&this.events.emit(vr("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=vr("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{Hs(n)?this.events.emit(vr("session_ping",i),{}):Yi(n)&&this.events.emit(vr("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(ii.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Dr("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:u,encryptedId:l,transportType:d}=r,{id:p,params:y}=a;try{await this.isValidRequest(tn({topic:o},y));const A=this.client.session.get(o),P=await this.getVerifyContext({attestationId:u,hash:Ao(JSON.stringify(da("wc_sessionRequest",y,p))),encryptedId:l,metadata:A.peer.metadata,transportType:d}),N={id:p,topic:o,params:y,verifyContext:P};await this.setPendingSessionRequest(N),d===Wr.link_mode&&(n=A.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=A.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(N):(this.addSessionRequestToSessionRequestQueue(N),this.processSessionRequestQueue())}catch(A){await this.sendError({id:p,topic:o,error:A}),this.client.logger.error(A)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=vr("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(tn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Al.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:u}=r;try{const{requester:l,authPayload:d,expiryTimestamp:p}=s.params,y=await this.getVerifyContext({attestationId:o,hash:Ao(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:u}),A={requester:l,pairingTopic:i,id:s.id,authPayload:d,verifyContext:y,expiryTimestamp:p};await this.setAuthRequest(s.id,{request:A,pairingTopic:i,transportType:u}),u===Wr.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:y})}catch(l){this.client.logger.error(l);const d=s.params.requester.publicKey,p=await this.client.core.crypto.generateKeyPair(),y=this.getAppLinkIfEnabled(s.params.requester.metadata,u),A={type:So,receiverPublicKey:d,senderPublicKey:p};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:A,rpcOpts:kn.wc_sessionAuthenticate.autoReject,appLink:y})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Gs.idle,this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=vr("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(vr("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Gs.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Gs.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:da("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(bi(n)||await this.isValidPairingTopic(n),!B$(a)){const{message:u}=ut("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!bi(i)&&Sl(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!bi(s)&&Sl(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),bi(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=k$(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!yi(r))throw new Error(ut("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),u=h1(i,"approve()");if(u)throw new Error(u.message);const l=A_(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!an(s,!0)){const{message:d}=ut("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}bi(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!yi(r)){const{message:s}=ut("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!F$(i)){const{message:s}=ut("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!yi(r)){const{message:l}=ut("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!E_(n)){const{message:l}=ut("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=T$(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const u=h1(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(fa(o)){const{message:l}=ut("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=h1(i,"update()");if(o)throw new Error(o.message);const a=A_(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!S_(a,s)){const{message:u}=ut("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!j$(i)){const{message:u}=ut("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!z$(a,s,i.method)){const{message:u}=ut("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!V$(o,S1)){const{message:u}=ut("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${S1.min} and ${S1.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!yi(r)){const{message:o}=ut("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!U$(s)){const{message:o}=ut("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!yi(r)){const{message:a}=ut("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!S_(o,s)){const{message:a}=ut("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!q$(i)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!H$(o,s,i.name)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!an(i,!1))throw new Error("uri is required parameter");if(!an(s,!1))throw new Error("domain is required parameter");if(!an(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(u=>Eu(u).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Eu(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,u={verified:{verifyUrl:o.verifyUrl||Il,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Wr.link_mode){const d=this.getAppLinkIfEnabled(o,a);return u.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",u}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(u.verified.origin=l.origin,u.verified.isScam=l.isScam,u.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(u)}`),u},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!an(i,!1)){const{message:s}=ut("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,u,l,d,p,y;return!r||n!==Wr.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(u=this.client.metadata)==null?void 0:u.redirect)==null?void 0:l.universal)!==""&&((d=r==null?void 0:r.redirect)==null?void 0:d.universal)!==void 0&&((p=r==null?void 0:r.redirect)==null?void 0:p.universal)!==""&&((y=r==null?void 0:r.redirect)==null?void 0:y.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=X3(r,"topic")||"",i=decodeURIComponent(X3(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:Wr.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(i1()||Su()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ii.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(Qd)?this.client.auth.authKeys.get(Qd):{publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===Wr.link_mode?vl:la});try{g1(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:Ao(n)})):Yd(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(u){this.client.logger.error(u)}}registerExpirerEvents(){this.client.core.expirer.on(Zi.expired,async e=>{const{topic:r,id:n}=J3(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ut("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,ut("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(oc.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(oc.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=ut("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=ut("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=ut("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(an(e,!1)){const{message:r}=ut("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=ut("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!$$(e)){const{message:r}=ut("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=ut("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class yq extends uc{constructor(e,r){super(e,r,nq,_1),this.core=e,this.logger=r}}let wq=class extends uc{constructor(e,r){super(e,r,iq,_1),this.core=e,this.logger=r}};class xq extends uc{constructor(e,r){super(e,r,oq,_1,n=>n.id),this.core=e,this.logger=r}}class _q extends uc{constructor(e,r){super(e,r,fq,Zd,()=>Qd),this.core=e,this.logger=r}}class Eq extends uc{constructor(e,r){super(e,r,lq,Zd),this.core=e,this.logger=r}}class Sq extends uc{constructor(e,r){super(e,r,hq,Zd,n=>n.id),this.core=e,this.logger=r}}class Aq{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new _q(this.core,this.logger),this.pairingTopics=new Eq(this.core,this.logger),this.requests=new Sq(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class A1 extends ZR{constructor(e){super(e),this.protocol=S6,this.version=A6,this.name=E1.name,this.events=new qi.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||E1.name,this.metadata=(e==null?void 0:e.metadata)||W3(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||E1.logger}));this.core=(e==null?void 0:e.core)||new rq(e),this.logger=ri(r,this.name),this.session=new wq(this.core,this.logger),this.proposal=new yq(this.core,this.logger),this.pendingRequest=new xq(this.core,this.logger),this.engine=new bq(this),this.auth=new Aq(this.core,this.logger)}static async init(e){const r=new A1(e);return await r.initialize(),r}get context(){return gi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var e0={exports:{}};/** + Approved: ${y.toString()}`))}),o.forEach(p=>{n||(ec(i[p].methods,s[p].methods)?ec(i[p].events,s[p].events)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${p}`)):n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${p}`))}),n}function W$(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function M_(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function K$(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Pu(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function V$(t,e){return l1(t)&&t<=e.max&&t>=e.min}function I_(){const t=gl();return new Promise(e=>{switch(t){case Ri.browser:e(G$());break;case Ri.reactNative:e(Y$());break;case Ri.node:e(J$());break;default:e(!0)}})}function G$(){return pl()&&(navigator==null?void 0:navigator.onLine)}async function Y$(){if(Su()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function J$(){return!0}function X$(t){switch(gl()){case Ri.browser:Z$(t);break;case Ri.reactNative:Q$(t);break}}function Z$(t){!Su()&&pl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function Q$(t){Su()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const d1={};class Al{static get(e){return d1[e]}static set(e,r){d1[e]=r}static delete(e){delete d1[e]}}const eF="PARSE_ERROR",tF="INVALID_REQUEST",rF="METHOD_NOT_FOUND",nF="INVALID_PARAMS",C_="INTERNAL_ERROR",p1="SERVER_ERROR",iF=[-32700,-32600,-32601,-32602,-32603],Pl={[eF]:{code:-32700,message:"Parse error"},[tF]:{code:-32600,message:"Invalid Request"},[rF]:{code:-32601,message:"Method not found"},[nF]:{code:-32602,message:"Invalid params"},[C_]:{code:-32603,message:"Internal error"},[p1]:{code:-32e3,message:"Server error"}},T_=p1;function sF(t){return iF.includes(t)}function R_(t){return Object.keys(Pl).includes(t)?Pl[t]:Pl[T_]}function oF(t){const e=Object.values(Pl).find(r=>r.code===t);return e||Pl[T_]}function D_(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var O_={},Po={},N_;function aF(){if(N_)return Po;N_=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.isBrowserCryptoAvailable=Po.getSubtleCrypto=Po.getBrowerCrypto=void 0;function t(){return(nn==null?void 0:nn.crypto)||(nn==null?void 0:nn.msCrypto)||{}}Po.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Po.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Po.isBrowserCryptoAvailable=r,Po}var Mo={},L_;function cF(){if(L_)return Mo;L_=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.isBrowser=Mo.isNode=Mo.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Mo.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Mo.isNode=e;function r(){return!t()&&!e()}return Mo.isBrowser=r,Mo}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(aF(),t),e.__exportStar(cF(),t)})(O_);function ha(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function sc(t=6){return BigInt(ha(t))}function da(t,e,r){return{id:r||ha(),jsonrpc:"2.0",method:t,params:e}}function Vd(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Gd(t,e,r){return{id:t,jsonrpc:"2.0",error:uF(e)}}function uF(t,e){return typeof t>"u"?R_(C_):(typeof t=="string"&&(t=Object.assign(Object.assign({},R_(p1)),{message:t})),sF(t.code)&&(t=oF(t.code)),t)}let fF=class{},lF=class extends fF{constructor(){super()}},hF=class extends lF{constructor(e){super()}};const dF="^https?:",pF="^wss?:";function gF(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function k_(t,e){const r=gF(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function B_(t){return k_(t,dF)}function $_(t){return k_(t,pF)}function mF(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function F_(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function g1(t){return F_(t)&&"method"in t}function Yd(t){return F_(t)&&(Hs(t)||Yi(t))}function Hs(t){return"result"in t}function Yi(t){return"error"in t}let Ji=class extends hF{constructor(e){super(e),this.events=new qi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(da(e.method,e.params||[],e.id||sc().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Yi(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Yd(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const vF=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),bF=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",j_=t=>t.split("?")[0],U_=10,yF=vF();let wF=class{constructor(e){if(this.url=e,this.events=new qi.EventEmitter,this.registering=!1,!$_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(mo(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!$_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=O_.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!mF(e)},o=new yF(e,[],s);bF()?o.onerror=a=>{const u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ka(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return D_(e,j_(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>U_&&this.events.setMaxListeners(U_)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${j_(this.url)}`));return this.events.emit("register_error",r),r}};var Jd={exports:{}};Jd.exports,function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",u="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",p="[object Date]",y="[object Error]",A="[object Function]",P="[object GeneratorFunction]",N="[object Map]",D="[object Number]",k="[object Null]",B="[object Object]",j="[object Promise]",U="[object Proxy]",K="[object RegExp]",J="[object Set]",T="[object String]",z="[object Symbol]",ue="[object Undefined]",_e="[object WeakMap]",G="[object ArrayBuffer]",E="[object DataView]",m="[object Float32Array]",f="[object Float64Array]",g="[object Int8Array]",v="[object Int16Array]",x="[object Int32Array]",_="[object Uint8Array]",S="[object Uint8ClampedArray]",b="[object Uint16Array]",M="[object Uint32Array]",I=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,O={};O[m]=O[f]=O[g]=O[v]=O[x]=O[_]=O[S]=O[b]=O[M]=!0,O[a]=O[u]=O[G]=O[d]=O[E]=O[p]=O[y]=O[A]=O[N]=O[D]=O[B]=O[K]=O[J]=O[T]=O[_e]=!1;var se=typeof nn=="object"&&nn&&nn.Object===Object&&nn,ee=typeof self=="object"&&self&&self.Object===Object&&self,X=se||ee||Function("return this")(),Q=e&&!e.nodeType&&e,R=Q&&!0&&t&&!t.nodeType&&t,Z=R&&R.exports===Q,te=Z&&se.process,le=function(){try{return te&&te.binding&&te.binding("util")}catch{}}(),ie=le&&le.isTypedArray;function fe(ce,ye){for(var Ye=-1,It=ce==null?0:ce.length,jr=0,ir=[];++Ye-1}function st(ce,ye){var Ye=this.__data__,It=Xe(Ye,ce);return It<0?(++this.size,Ye.push([ce,ye])):Ye[It][1]=ye,this}Re.prototype.clear=De,Re.prototype.delete=it,Re.prototype.get=Ue,Re.prototype.has=gt,Re.prototype.set=st;function tt(ce){var ye=-1,Ye=ce==null?0:ce.length;for(this.clear();++yewn))return!1;var Ur=ir.get(ce);if(Ur&&ir.get(ye))return Ur==ye;var gn=-1,_i=!0,xn=Ye&s?new _t:void 0;for(ir.set(ce,ye),ir.set(ye,ce);++gn-1&&ce%1==0&&ce-1&&ce%1==0&&ce<=o}function up(ce){var ye=typeof ce;return ce!=null&&(ye=="object"||ye=="function")}function Pc(ce){return ce!=null&&typeof ce=="object"}var fp=ie?Te(ie):dr;function qb(ce){return jb(ce)?qe(ce):pr(ce)}function Fr(){return[]}function kr(){return!1}t.exports=Ub}(Jd,Jd.exports);var xF=Jd.exports;const _F=ji(xF),q_="wc",z_=2,H_="core",Ws=`${q_}@2:${H_}:`,EF={logger:"error"},SF={database:":memory:"},AF="crypto",W_="client_ed25519_seed",PF=mt.ONE_DAY,MF="keychain",IF="0.3",CF="messages",TF="0.3",RF=mt.SIX_HOURS,DF="publisher",K_="irn",OF="error",V_="wss://relay.walletconnect.org",NF="relayer",ii={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},LF="_subscription",Xi={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},kF=.1,m1="2.17.2",Wr={link_mode:"link_mode",relay:"relay"},BF="0.3",$F="WALLETCONNECT_CLIENT_ID",G_="WALLETCONNECT_LINK_MODE_APPS",Ks={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},FF="subscription",jF="0.3",UF=mt.FIVE_SECONDS*1e3,qF="pairing",zF="0.3",Ml={wc_pairingDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:0},res:{ttl:mt.ONE_DAY,prompt:!1,tag:0}}},oc={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},bs={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},HF="history",WF="0.3",KF="expirer",Zi={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},VF="0.3",GF="verify-api",YF="https://verify.walletconnect.com",Y_="https://verify.walletconnect.org",Il=Y_,JF=`${Il}/v3`,XF=[YF,Y_],ZF="echo",QF="https://echo.walletconnect.com",Vs={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},Io={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},ys={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},ac={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},cc={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Cl={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},ej=.1,tj="event-client",rj=86400,nj="https://pulse.walletconnect.org/batch";function ij(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(j);k!==B;){for(var K=P[k],J=0,T=j-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=j-D;z!==j&&U[z]===0;)z++;for(var ue=u.repeat(N);z>>0,j=new Uint8Array(B);P[N];){var U=r[P.charCodeAt(N)];if(U===255)return;for(var K=0,J=B-1;(U!==0||K>>0,j[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,N++}if(P[N]!==" "){for(var T=B-k;T!==B&&j[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=j[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:A}}var sj=ij,oj=sj;const J_=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},aj=t=>new TextEncoder().encode(t),cj=t=>new TextDecoder().decode(t);class uj{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class fj{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return X_(this,e)}}class lj{constructor(e){this.decoders=e}or(e){return X_(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const X_=(t,e)=>new lj({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class hj{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new uj(e,r,n),this.decoder=new fj(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Xd=({name:t,prefix:e,encode:r,decode:n})=>new hj(t,e,r,n),Tl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=oj(r,e);return Xd({prefix:t,name:e,encode:n,decode:s=>J_(i(s))})},dj=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},pj=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Xd({prefix:e,name:t,encode(i){return pj(i,n,r)},decode(i){return dj(i,n,r,t)}}),gj=Xd({prefix:"\0",name:"identity",encode:t=>cj(t),decode:t=>aj(t)});var mj=Object.freeze({__proto__:null,identity:gj});const vj=zn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var bj=Object.freeze({__proto__:null,base2:vj});const yj=zn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var wj=Object.freeze({__proto__:null,base8:yj});const xj=Tl({prefix:"9",name:"base10",alphabet:"0123456789"});var _j=Object.freeze({__proto__:null,base10:xj});const Ej=zn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Sj=zn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Aj=Object.freeze({__proto__:null,base16:Ej,base16upper:Sj});const Pj=zn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Mj=zn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ij=zn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Cj=zn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Tj=zn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Rj=zn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Dj=zn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Oj=zn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Nj=zn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Lj=Object.freeze({__proto__:null,base32:Pj,base32upper:Mj,base32pad:Ij,base32padupper:Cj,base32hex:Tj,base32hexupper:Rj,base32hexpad:Dj,base32hexpadupper:Oj,base32z:Nj});const kj=Tl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Bj=Tl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var $j=Object.freeze({__proto__:null,base36:kj,base36upper:Bj});const Fj=Tl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),jj=Tl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Uj=Object.freeze({__proto__:null,base58btc:Fj,base58flickr:jj});const qj=zn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zj=zn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Hj=zn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Wj=zn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Kj=Object.freeze({__proto__:null,base64:qj,base64pad:zj,base64url:Hj,base64urlpad:Wj});const Z_=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Vj=Z_.reduce((t,e,r)=>(t[r]=e,t),[]),Gj=Z_.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Yj(t){return t.reduce((e,r)=>(e+=Vj[r],e),"")}function Jj(t){const e=[];for(const r of t){const n=Gj[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const Xj=Xd({prefix:"🚀",name:"base256emoji",encode:Yj,decode:Jj});var Zj=Object.freeze({__proto__:null,base256emoji:Xj}),Qj=e6,Q_=128,eU=127,tU=~eU,rU=Math.pow(2,31);function e6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=rU;)e[r++]=t&255|Q_,t/=128;for(;t&tU;)e[r++]=t&255|Q_,t>>>=7;return e[r]=t|0,e6.bytes=r-n+1,e}var nU=v1,iU=128,t6=127;function v1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw v1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&t6)<=iU);return v1.bytes=s-n,r}var sU=Math.pow(2,7),oU=Math.pow(2,14),aU=Math.pow(2,21),cU=Math.pow(2,28),uU=Math.pow(2,35),fU=Math.pow(2,42),lU=Math.pow(2,49),hU=Math.pow(2,56),dU=Math.pow(2,63),pU=function(t){return t(r6.encode(t,e,r),e),i6=t=>r6.encodingLength(t),b1=(t,e)=>{const r=e.byteLength,n=i6(t),i=n+i6(r),s=new Uint8Array(i+r);return n6(t,s,0),n6(r,s,n),s.set(e,i),new mU(t,r,e,s)};class mU{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const s6=({name:t,code:e,encode:r})=>new vU(t,e,r);class vU{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?b1(this.code,r):r.then(n=>b1(this.code,n))}else throw Error("Unknown type, must be binary type")}}const o6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),bU=s6({name:"sha2-256",code:18,encode:o6("SHA-256")}),yU=s6({name:"sha2-512",code:19,encode:o6("SHA-512")});var wU=Object.freeze({__proto__:null,sha256:bU,sha512:yU});const a6=0,xU="identity",c6=J_;var _U=Object.freeze({__proto__:null,identity:{code:a6,name:xU,encode:c6,digest:t=>b1(a6,c6(t))}});new TextEncoder,new TextDecoder;const u6={...mj,...bj,...wj,..._j,...Aj,...Lj,...$j,...Uj,...Kj,...Zj};({...wU,..._U});function EU(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function f6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const l6=f6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),y1=f6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=EU(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=ut("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,G3(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Y3(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}},MU=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=AF,this.randomSessionIdentifier=c1(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=xx(i);return wx(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=ZB();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=xx(s),a=this.randomSessionIdentifier;return await LO(a,i,PF,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),u=QB(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||Hd(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=d_(o),u=mo(s);if(g_(a))return t$(u,o==null?void 0:o.encoding);if(p_(a)){const y=a.senderPublicKey,A=a.receiverPublicKey;i=await this.generateSharedKey(y,A)}const l=this.getSymKey(i),{type:d,senderPublicKey:p}=a;return e$({type:d,symKey:l,message:u,senderPublicKey:p,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=i$(s,o);if(g_(a)){const u=n$(s,o==null?void 0:o.encoding);return Ka(u)}if(p_(a)){const u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{const u=this.getSymKey(i),l=r$({symKey:u,encoded:s,encoding:o==null?void 0:o.encoding});return Ka(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=(i,s=la)=>{const o=xl({encoded:i,encoding:s});return nc(o.type)},this.getPayloadSenderPublicKey=(i,s=la)=>{const o=xl({encoded:i,encoding:s});return o.senderPublicKey?Tn(o.senderPublicKey,ni):void 0},this.core=e,this.logger=ri(r,this.name),this.keychain=n||new PU(this.core,this.logger)}get context(){return gi(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(W_)}catch{e=c1(),await this.keychain.set(W_,e)}return AU(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}};class IU extends zR{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=CF,this.version=TF,this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Ao(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Ao(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=ri(e,this.name),this.core=r}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,G3(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Y3(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class CU extends HR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new qi.EventEmitter,this.name=DF,this.queue=new Map,this.publishTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.failedPublishTimeout=mt.toMiliseconds(mt.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||RF,u=u1(s),l=(s==null?void 0:s.prompt)||!1,d=(s==null?void 0:s.tag)||0,p=(s==null?void 0:s.id)||sc().toString(),y={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:d,id:p,attestation:s==null?void 0:s.attestation}},A=`Failed to publish payload, please try again. id:${p} tag:${d}`,P=Date.now();let N,D=1;try{for(;N===void 0;){if(Date.now()-P>this.publishTimeout)throw new Error(A);this.logger.trace({id:p,attempts:D},`publisher.publish - attempt ${D}`),N=await await Au(this.rpcPublish(n,i,a,u,l,d,p,s==null?void 0:s.attestation).catch(k=>this.logger.warn(k)),this.publishTimeout,A),D++,N||await new Promise(k=>setTimeout(k,this.failedPublishTimeout))}this.relayer.events.emit(ii.publish,y),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:p,topic:n,message:i,opts:s}})}catch(k){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(k),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw k;this.queue.set(p,y)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=ri(r,this.name),this.registerEventListeners()}get context(){return gi(this.logger)}rpcPublish(e,r,n,i,s,o,a,u){var l,d,p,y;const A={method:_l(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:u},id:a};return bi((l=A.params)==null?void 0:l.prompt)&&((d=A.params)==null||delete d.prompt),bi((p=A.params)==null?void 0:p.tag)&&((y=A.params)==null||delete y.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:A}),this.relayer.request(A)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(iu.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ii.connection_stalled);return}this.checkQueue()}),this.relayer.on(ii.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class TU{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var RU=Object.defineProperty,DU=Object.defineProperties,OU=Object.getOwnPropertyDescriptors,h6=Object.getOwnPropertySymbols,NU=Object.prototype.hasOwnProperty,LU=Object.prototype.propertyIsEnumerable,d6=(t,e,r)=>e in t?RU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rl=(t,e)=>{for(var r in e||(e={}))NU.call(e,r)&&d6(t,r,e[r]);if(h6)for(var r of h6(e))LU.call(e,r)&&d6(t,r,e[r]);return t},w1=(t,e)=>DU(t,OU(e));class kU extends VR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new TU,this.events=new qi.EventEmitter,this.name=FF,this.version=jF,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Ws,this.subscribeTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=u1(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new mt.Watch;a.start(i);const u=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(u),a.stop(i),s(!0)),a.elapsed(i)>=UF&&(clearInterval(u),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ri(r,this.name),this.clientId=""}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=u1(n);await this.rpcUnsubscribe(e,r,i);const s=Dr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===Wr.relay&&await this.restartToComplete();const s={method:_l(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=Ao(e+this.clientId);if((n==null?void 0:n.transportType)===Wr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},mt.toMiliseconds(mt.ONE_SECOND)),a;const u=await Au(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return u?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ii.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Au(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Au(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:_l(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,w1(Rl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Rl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Rl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Ks.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Ks.deleted,w1(Rl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Ks.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);ic(r)&&this.onBatchSubscribe(r.map((n,i)=>w1(Rl({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(iu.pulse,async()=>{await this.checkPending()}),this.events.on(Ks.created,async e=>{const r=Ks.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Ks.deleted,async e=>{const r=Ks.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var BU=Object.defineProperty,p6=Object.getOwnPropertySymbols,$U=Object.prototype.hasOwnProperty,FU=Object.prototype.propertyIsEnumerable,g6=(t,e,r)=>e in t?BU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,m6=(t,e)=>{for(var r in e||(e={}))$U.call(e,r)&&g6(t,r,e[r]);if(p6)for(var r of p6(e))FU.call(e,r)&&g6(t,r,e[r]);return t};class jU extends WR{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new qi.EventEmitter,this.name=NF,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=mt.toMiliseconds(mt.THIRTY_SECONDS+mt.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||sc().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(u,l)=>{const d=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Xi.disconnect,d);const p=await o;this.provider.off(Xi.disconnect,d),u(p)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(jd())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(ii.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ii.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Xi.payload,this.onPayloadHandler),this.provider.on(Xi.connect,this.onConnectHandler),this.provider.on(Xi.disconnect,this.onDisconnectHandler),this.provider.on(Xi.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ri(e.logger,this.name):Qf(od({level:e.logger||OF})),this.messages=new IU(this.logger,e.core),this.subscriber=new kU(this,this.logger),this.publisher=new CU(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||V_,this.projectId=e.projectId,this.bundleId=mB(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return gi(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Wr.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",u;const l=d=>{d.topic===e&&(this.subscriber.off(Ks.created,l),u())};return await Promise.all([new Promise(d=>{u=d,this.subscriber.on(Ks.created,l)}),new Promise(async(d,p)=>{a=await this.subscriber.subscribe(e,m6({internal:{throwOnFailedPublish:o}},r)).catch(y=>{o&&p(y)})||a,d()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Au(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Xi.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Xi.disconnect,i),await Au(this.provider.connect(),mt.toMiliseconds(mt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await I_())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=En(mt.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(ii.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(jd())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Ji(new wF(wB({sdkVersion:m1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),g1(e)){if(!e.method.endsWith(LF))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:Wr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(m6({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else Yd(e)&&this.events.emit(ii.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ii.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Vd(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Xi.payload,this.onPayloadHandler),this.provider.off(Xi.connect,this.onConnectHandler),this.provider.off(Xi.disconnect,this.onDisconnectHandler),this.provider.off(Xi.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await I_();X$(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(ii.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},mt.toMiliseconds(kF))))}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var UU=Object.defineProperty,v6=Object.getOwnPropertySymbols,qU=Object.prototype.hasOwnProperty,zU=Object.prototype.propertyIsEnumerable,b6=(t,e,r)=>e in t?UU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,y6=(t,e)=>{for(var r in e||(e={}))qU.call(e,r)&&b6(t,r,e[r]);if(v6)for(var r of v6(e))zU.call(e,r)&&b6(t,r,e[r]);return t};class uc extends KR{constructor(e,r,n,i=Ws,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=BF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!bi(o)?this.map.set(this.getKey(o),o):I$(o)?this.map.set(o.id,o):C$(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>_F(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const u=y6(y6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=ri(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class HU{constructor(e,r){this.core=e,this.logger=r,this.name=qF,this.version=zF,this.events=new Yg,this.initialized=!1,this.storagePrefix=Ws,this.ignoredPayloadTypes=[So],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=c1(),s=await this.core.crypto.setSymKey(i),o=En(mt.FIVE_MINUTES),a={protocol:K_},u={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=w_({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(oc.create,u),this.core.expirer.set(s,o),await this.pairings.set(s,u),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Vs.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:u,methods:l}=y_(n.uri);i.props.properties.topic=s,i.addTrace(Vs.pairing_uri_validation_success),i.addTrace(Vs.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(Vs.existing_pairing),d.active)throw i.setError(Io.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Vs.pairing_not_expired)}const p=u||En(mt.FIVE_MINUTES),y={topic:s,relay:a,expiry:p,active:!1,methods:l};this.core.expirer.set(s,p),await this.pairings.set(s,y),i.addTrace(Vs.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(oc.create,y),i.addTrace(Vs.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Vs.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Io.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(A){throw i.setError(Io.subscribe_pairing_topic_failure),A}return i.addTrace(Vs.subscribe_pairing_topic_success),y},this.activate=async({topic:n})=>{this.isInitialized();const i=En(mt.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=tc();this.events.once(vr("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Dr("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,u=this.core.crypto.keychain.get(i);return w_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:u,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=da(i,s),a=await this.core.crypto.encode(n,o),u=Ml[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{const o=Vd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=Gd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method]?Ml[u.request.method].res:Ml.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Dr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>fa(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(oc.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{Hs(i)?this.events.emit(vr("pairing_ping",s),{}):Yi(i)&&this.events.emit(vr("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(oc.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Dr("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Dr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!yi(n)){const{message:a}=ut("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!M$(n.uri)){const{message:a}=ut("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}const o=y_(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&mt.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!an(n,!1)){const{message:i}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(fa(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ut("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=ri(r,this.name),this.pairings=new uc(this.core,this.logger,this.name,this.storagePrefix)}get context(){return gi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ii.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===Wr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{g1(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):Yd(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Zi.expired,async e=>{const{topic:r}=X3(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(oc.expire,{topic:r}))})}}class WU extends qR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new qi.EventEmitter,this.name=HF,this.version=WF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:En(mt.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(bs.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Yi(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(bs.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(bs.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:da(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(bs.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(bs.created,e=>{const r=bs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.updated,e=>{const r=bs.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.deleted,e=>{const r=bs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(iu.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{mt.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(bs.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class KU extends GR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new qi.EventEmitter,this.name=KF,this.version=VF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Zi.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Zi.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return xB(e);if(typeof e=="number")return _B(e);const{message:r}=ut("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Zi.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;mt.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Zi.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(iu.pulse,()=>this.checkExpirations()),this.events.on(Zi.created,e=>{const r=Zi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.expired,e=>{const r=Zi.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.deleted,e=>{const r=Zi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class VU extends YR{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=GF,this.verifyUrlV3=JF,this.storagePrefix=Ws,this.version=z_,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&mt.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!pl()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,u=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=nl(),d=this.startAbortTimer(mt.ONE_SECOND*5),p=await new Promise((y,A)=>{const P=()=>{window.removeEventListener("message",D),l.body.removeChild(N),A("attestation aborted")};this.abortController.signal.addEventListener("abort",P);const N=l.createElement("iframe");N.src=u,N.style.display="none",N.addEventListener("error",P,{signal:this.abortController.signal});const D=k=>{if(k.data&&typeof k.data=="string")try{const B=JSON.parse(k.data);if(B.type==="verify_attestation"){if(gm(B.attestation).payload.id!==o)return;clearInterval(d),l.body.removeChild(N),this.abortController.signal.removeEventListener("abort",P),window.removeEventListener("message",D),y(B.attestation===null?"":B.attestation)}}catch(B){this.logger.warn(B)}};l.body.appendChild(N),window.addEventListener("message",D,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",p),p}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(gm(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const u=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,u)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(mt.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Il;return XF.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Il}`),s=Il),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(mt.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=c$(i,s.publicKey),a={hasExpired:mt.toMiliseconds(o.exp)this.abortController.abort(),mt.toMiliseconds(e))}}class GU extends JR{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=ZF,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${QF}/${this.projectId}/clients`;await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=ri(r,this.context)}}var YU=Object.defineProperty,w6=Object.getOwnPropertySymbols,JU=Object.prototype.hasOwnProperty,XU=Object.prototype.propertyIsEnumerable,x6=(t,e,r)=>e in t?YU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dl=(t,e)=>{for(var r in e||(e={}))JU.call(e,r)&&x6(t,r,e[r]);if(w6)for(var r of w6(e))XU.call(e,r)&&x6(t,r,e[r]);return t};class ZU extends XR{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=tj,this.storagePrefix=Ws,this.storageVersion=ej,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!i1())try{const i={eventId:Q3(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:V3(this.core.relayer.protocol,this.core.relayer.version,m1)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:u}}=i,l=Q3(),d=this.core.projectId||"",p=Date.now(),y=Dl({eventId:l,timestamp:p,props:{event:s,type:o,properties:{topic:a,trace:u}},bundleId:d,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,y),this.shouldPersist=!0),y},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(u=>u.props.properties.topic===o);if(a)return Dl(Dl({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(iu.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{mt.fromMiliseconds(Date.now())-mt.fromMiliseconds(i.timestamp)>rj&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Dl(Dl({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${nj}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${m1}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>K3().url,this.logger=ri(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var QU=Object.defineProperty,_6=Object.getOwnPropertySymbols,eq=Object.prototype.hasOwnProperty,tq=Object.prototype.propertyIsEnumerable,E6=(t,e,r)=>e in t?QU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,S6=(t,e)=>{for(var r in e||(e={}))eq.call(e,r)&&E6(t,r,e[r]);if(_6)for(var r of _6(e))tq.call(e,r)&&E6(t,r,e[r]);return t};class x1 extends UR{constructor(e){var r;super(e),this.protocol=q_,this.version=z_,this.name=H_,this.events=new qi.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:u})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:Wr.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||V_,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=od({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:EF.logger}),{logger:i,chunkLoggerController:s}=jR({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ri(i,this.name),this.heartbeat=new NT,this.crypto=new MU(this,this.logger,e==null?void 0:e.keychain),this.history=new WU(this,this.logger),this.expirer=new KU(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new hR(S6(S6({},SF),e==null?void 0:e.storageOptions)),this.relayer=new jU({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new HU(this,this.logger),this.verify=new VU(this,this.logger,this.storage),this.echoClient=new GU(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new ZU(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new x1(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem($F,n),r}get context(){return gi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(G_,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(G_)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const rq=x1,A6="wc",P6=2,M6="client",_1=`${A6}@${P6}:${M6}:`,E1={name:M6,logger:"error"},I6="WALLETCONNECT_DEEPLINK_CHOICE",nq="proposal",C6="Proposal expired",iq="session",Mu=mt.SEVEN_DAYS,sq="engine",kn={wc_sessionPropose:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:mt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:mt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1119}}},S1={min:mt.FIVE_MINUTES,max:mt.SEVEN_DAYS},Gs={idle:"IDLE",active:"ACTIVE"},oq="request",aq=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],cq="wc",uq="auth",fq="authKeys",lq="pairingTopics",hq="requests",Zd=`${cq}@${1.5}:${uq}:`,Qd=`${Zd}:PUB_KEY`;var dq=Object.defineProperty,pq=Object.defineProperties,gq=Object.getOwnPropertyDescriptors,T6=Object.getOwnPropertySymbols,mq=Object.prototype.hasOwnProperty,vq=Object.prototype.propertyIsEnumerable,R6=(t,e,r)=>e in t?dq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))mq.call(e,r)&&R6(t,r,e[r]);if(T6)for(var r of T6(e))vq.call(e,r)&&R6(t,r,e[r]);return t},ws=(t,e)=>pq(t,gq(e));class bq extends QR{constructor(e){super(e),this.name=sq,this.events=new Yg,this.initialized=!1,this.requestQueue={state:Gs.idle,queue:[]},this.sessionRequestQueue={state:Gs.idle,queue:[]},this.requestQueueDelay=mt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(kn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=ws(tn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n;let l=i,d,p=!1;try{l&&(p=this.client.core.pairing.pairings.get(l).active)}catch(U){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),U}if(!l||!p){const{topic:U,uri:K}=await this.client.core.pairing.create();l=U,d=K}if(!l){const{message:U}=ut("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(U)}const y=await this.client.core.crypto.generateKeyPair(),A=kn.wc_sessionPropose.req.ttl||mt.FIVE_MINUTES,P=En(A),N=tn({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:K_}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:P,pairingTopic:l},a&&{sessionProperties:a}),{reject:D,resolve:k,done:B}=tc(A,C6);this.events.once(vr("session_connect"),async({error:U,session:K})=>{if(U)D(U);else if(K){K.self.publicKey=y;const J=ws(tn({},K),{pairingTopic:N.pairingTopic,requiredNamespaces:N.requiredNamespaces,optionalNamespaces:N.optionalNamespaces,transportType:Wr.relay});await this.client.session.set(K.topic,J),await this.setExpiry(K.topic,K.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:K.peer.metadata}),this.cleanupDuplicatePairings(J),k(J)}});const j=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:N,throwOnFailedPublish:!0});return await this.setProposal(j,tn({id:j},N)),{uri:d,approval:B}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[ys.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(z){throw o.setError(ac.no_internet_connection),z}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(z){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(ac.proposal_not_found),z}try{await this.isValidApprove(r)}catch(z){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(ac.session_approve_namespace_validation_failure),z}const{id:a,relayProtocol:u,namespaces:l,sessionProperties:d,sessionConfig:p}=r,y=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:A,proposer:P,requiredNamespaces:N,optionalNamespaces:D}=y;let k=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:A});k||(k=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:ys.session_approve_started,properties:{topic:A,trace:[ys.session_approve_started,ys.session_namespaces_validation_success]}}));const B=await this.client.core.crypto.generateKeyPair(),j=P.publicKey,U=await this.client.core.crypto.generateSharedKey(B,j),K=tn(tn({relay:{protocol:u??"irn"},namespaces:l,controller:{publicKey:B,metadata:this.client.metadata},expiry:En(Mu)},d&&{sessionProperties:d}),p&&{sessionConfig:p}),J=Wr.relay;k.addTrace(ys.subscribing_session_topic);try{await this.client.core.relayer.subscribe(U,{transportType:J})}catch(z){throw k.setError(ac.subscribe_session_topic_failure),z}k.addTrace(ys.subscribe_session_topic_success);const T=ws(tn({},K),{topic:U,requiredNamespaces:N,optionalNamespaces:D,pairingTopic:A,acknowledged:!1,self:K.controller,peer:{publicKey:P.publicKey,metadata:P.metadata},controller:B,transportType:Wr.relay});await this.client.session.set(U,T),k.addTrace(ys.store_session);try{k.addTrace(ys.publishing_session_settle),await this.sendRequest({topic:U,method:"wc_sessionSettle",params:K,throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(ac.session_settle_publish_failure),z}),k.addTrace(ys.session_settle_publish_success),k.addTrace(ys.publishing_session_approve),await this.sendResult({id:a,topic:A,result:{relay:{protocol:u??"irn"},responderPublicKey:B},throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(ac.session_approve_publish_failure),z}),k.addTrace(ys.session_approve_publish_success)}catch(z){throw this.client.logger.error(z),this.client.session.delete(U,Dr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(U),z}return this.client.core.eventClient.deleteEvent({eventId:k.eventId}),await this.client.core.pairing.updateMetadata({topic:A,metadata:P.metadata}),await this.client.proposal.delete(a,Dr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:A}),await this.setExpiry(U,En(Mu)),{topic:U,acknowledged:()=>Promise.resolve(this.client.session.get(U))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:kn.wc_sessionPropose.reject}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(p){throw this.client.logger.error("update() -> isValidUpdate() failed"),p}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=tc(),u=ha(),l=sc().toString(),d=this.client.session.get(n).namespaces;return this.events.once(vr("session_update",u),({error:p})=>{p?a(p):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:u,relayRpcId:l}).catch(p=>{this.client.logger.error(p),this.client.session.update(n,{namespaces:d}),a(p)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(u){throw this.client.logger.error("extend() -> isValidExtend() failed"),u}const{topic:n}=r,i=ha(),{done:s,resolve:o,reject:a}=tc();return this.events.once(vr("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,En(Mu)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(u=>{a(u)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(P){throw this.client.logger.error("request() -> isValidRequest() failed"),P}const{chainId:n,request:i,topic:s,expiry:o=kn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=ha(),l=sc().toString(),{done:d,resolve:p,reject:y}=tc(o,"Request expired. Please try again.");this.events.once(vr("session_request",u),({error:P,result:N})=>{P?y(P):p(N)});const A=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return A?(await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:A}).catch(P=>y(P)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),await d()):await Promise.all([new Promise(async P=>{await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(N=>y(N)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),P()}),new Promise(async P=>{var N;if(!((N=a.sessionConfig)!=null&&N.disableDeepLink)){const D=await AB(this.client.core.storage,I6);await EB({id:u,topic:s,wcDeepLink:D})}P()}),d()]).then(P=>P[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);Hs(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Yi(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=ha(),s=sc().toString(),{done:o,resolve:a,reject:u}=tc();this.events.once(vr("session_ping",i),({error:l})=>{l?u(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=sc().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Dr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ut("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>A$(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?Wr.link_mode:Wr.relay;o===Wr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:u="",uri:l,domain:d,nonce:p,type:y,exp:A,nbf:P,methods:N=[],expiry:D}=r,k=[...r.resources||[]],{topic:B,uri:j}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:B,uri:j}});const U=await this.client.core.crypto.generateKeyPair(),K=Hd(U);if(await Promise.all([this.client.auth.authKeys.set(Qd,{responseTopic:K,publicKey:U}),this.client.auth.pairingTopics.set(K,{topic:K,pairingTopic:B})]),await this.client.core.relayer.subscribe(K,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${B}`),N.length>0){const{namespace:_}=Eu(a[0]);let S=KB(_,"request",N);zd(k)&&(S=GB(S,k.pop())),k.push(S)}const J=D&&D>kn.wc_sessionAuthenticate.req.ttl?D:kn.wc_sessionAuthenticate.req.ttl,T={authPayload:{type:y??"caip122",chains:a,statement:u,aud:l,domain:d,version:"1",nonce:p,iat:new Date().toISOString(),exp:A,nbf:P,resources:k},requester:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(J)},z={eip155:{chains:a,methods:[...new Set(["personal_sign",...N])],events:["chainChanged","accountsChanged"]}},ue={requiredNamespaces:{},optionalNamespaces:z,relays:[{protocol:"irn"}],pairingTopic:B,proposer:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(kn.wc_sessionPropose.req.ttl)},{done:_e,resolve:G,reject:E}=tc(J,"Request expired"),m=async({error:_,session:S})=>{if(this.events.off(vr("session_request",g),f),_)E(_);else if(S){S.self.publicKey=U,await this.client.session.set(S.topic,S),await this.setExpiry(S.topic,S.expiry),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:S.peer.metadata});const b=this.client.session.get(S.topic);await this.deleteProposal(v),G({session:b})}},f=async _=>{var S,b,M;if(await this.deletePendingAuthRequest(g,{message:"fulfilled",code:0}),_.error){const X=Dr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return _.error.code===X.code?void 0:(this.events.off(vr("session_connect"),m),E(_.error.message))}await this.deleteProposal(v),this.events.off(vr("session_connect"),m);const{cacaos:I,responder:F}=_.result,ae=[],O=[];for(const X of I){await n_({cacao:X,projectId:this.client.core.projectId})||(this.client.logger.error(X,"Signature verification failed"),E(Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Q}=X,R=zd(Q.resources),Z=[o1(Q.iss)],te=qd(Q.iss);if(R){const le=o_(R),ie=a_(R);ae.push(...le),Z.push(...ie)}for(const le of Z)O.push(`${le}:${te}`)}const se=await this.client.core.crypto.generateSharedKey(U,F.publicKey);let ee;ae.length>0&&(ee={topic:se,acknowledged:!0,self:{publicKey:U,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:En(Mu),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:B,namespaces:x_([...new Set(ae)],[...new Set(O)]),transportType:o},await this.client.core.relayer.subscribe(se,{transportType:o}),await this.client.session.set(se,ee),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:F.metadata}),ee=this.client.session.get(se)),(S=this.client.metadata.redirect)!=null&&S.linkMode&&(b=F.metadata.redirect)!=null&&b.linkMode&&(M=F.metadata.redirect)!=null&&M.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(se,{transportType:Wr.link_mode})),G({auths:I,session:ee})},g=ha(),v=ha();this.events.once(vr("session_connect"),m),this.events.once(vr("session_request",g),f);let x;try{if(s){const _=da("wc_sessionAuthenticate",T,g);this.client.core.history.set(B,_);const S=await this.client.core.crypto.encode("",_,{type:yl,encoding:vl});x=Wd(n,B,S)}else await Promise.all([this.sendRequest({topic:B,method:"wc_sessionAuthenticate",params:T,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:g}),this.sendRequest({topic:B,method:"wc_sessionPropose",params:ue,expiry:kn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:v})])}catch(_){throw this.events.off(vr("session_connect"),m),this.events.off(vr("session_request",g),f),_}return await this.setProposal(v,tn({id:v},ue)),await this.setAuthRequest(g,{request:ws(tn({},T),{verifyContext:{}}),pairingTopic:B,transportType:o}),{uri:x??j,response:_e}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[cc.authenticated_session_approve_started]}});try{this.isInitialized()}catch(D){throw s.setError(Cl.no_internet_connection),D}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Cl.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||Wr.relay;a===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=Hd(u),p={type:So,receiverPublicKey:u,senderPublicKey:l},y=[],A=[];for(const D of i){if(!await n_({cacao:D,projectId:this.client.core.projectId})){s.setError(Cl.invalid_cacao);const K=Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:K,encodeOpts:p}),new Error(K.message)}s.addTrace(cc.cacaos_verified);const{p:k}=D,B=zd(k.resources),j=[o1(k.iss)],U=qd(k.iss);if(B){const K=o_(B),J=a_(B);y.push(...K),j.push(...J)}for(const K of j)A.push(`${K}:${U}`)}const P=await this.client.core.crypto.generateSharedKey(l,u);s.addTrace(cc.create_authenticated_session_topic);let N;if((y==null?void 0:y.length)>0){N={topic:P,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:u,metadata:o.requester.metadata},controller:u,expiry:En(Mu),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:x_([...new Set(y)],[...new Set(A)]),transportType:a},s.addTrace(cc.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(P,{transportType:a})}catch(D){throw s.setError(Cl.subscribe_authenticated_session_topic_failure),D}s.addTrace(cc.subscribe_authenticated_session_topic_success),await this.client.session.set(P,N),s.addTrace(cc.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(cc.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:p,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(D){throw s.setError(Cl.authenticated_session_approve_publish_failure),D}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:N}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),u=Hd(o),l={type:So,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:u,error:i,encodeOpts:l,rpcOpts:kn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return i_(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:u}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Dr("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(I6).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,Dr("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Gs.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(ac.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Dr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Gs.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,En(kn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=Wr.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||En(kn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l,appLink:d}=r,p=da(i,s,u);let y;const A=!!d;try{const D=A?vl:la;y=await this.client.core.crypto.encode(n,p,{encoding:D})}catch(D){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),D}let P;if(aq.includes(i)){const D=Ao(JSON.stringify(p)),k=Ao(y);P=await this.client.core.verify.register({id:k,decryptedId:D})}const N=kn[i].req;if(N.attestation=P,o&&(N.ttl=o),a&&(N.id=a),this.client.core.history.set(n,p),A){const D=Wd(d,n,y);await global.Linking.openURL(D,this.client.name)}else{const D=kn[i].req;o&&(D.ttl=o),a&&(D.id=a),l?(D.internal=ws(tn({},D.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,y,D)):this.client.core.relayer.publish(n,y,D).catch(k=>this.client.logger.error(k))}return p.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:u}=r,l=Vd(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=p?vl:la;d=await this.client.core.crypto.encode(i,l,ws(tn({},a||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),A}if(p){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=kn[y.request.method].res;o?(A.internal=ws(tn({},A.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,A)):this.client.core.relayer.publish(i,d,A).catch(P=>this.client.logger.error(P))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:u}=r,l=Gd(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=p?vl:la;d=await this.client.core.crypto.encode(i,l,ws(tn({},o||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),A}if(p){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=a||kn[y.request.method].res;this.client.core.relayer.publish(i,d,A)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;fa(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{fa(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Gs.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Gs.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Gs.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,u=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:u}))switch(u){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=ut("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:u}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(tn({},i.params));const d=a.expiryTimestamp||En(kn.wc_sessionPropose.req.ttl),p=tn({id:u,pairingTopic:n,expiryTimestamp:d},a);await this.setProposal(u,p);const y=await this.getVerifyContext({attestationId:s,hash:Ao(JSON.stringify(i)),encryptedId:o,metadata:p.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(Io.proposal_listener_not_found)),l==null||l.addTrace(Vs.emit_session_proposal),this.client.events.emit("session_proposal",{id:u,params:p,verifyContext:y})}catch(l){await this.sendError({id:u,topic:n,error:l,rpcOpts:kn.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(Hs(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const u=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const d=await this.client.core.crypto.generateSharedKey(u,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:d});const p=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:p}),await this.client.core.pairing.activate({topic:r})}else if(Yi(n)){await this.client.proposal.delete(s,Dr("USER_DISCONNECTED"));const o=vr("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(vr("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:u,namespaces:l,sessionProperties:d,sessionConfig:p}=n.params,y=ws(tn(tn({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},d&&{sessionProperties:d}),p&&{sessionConfig:p}),{transportType:Wr.relay}),A=vr("session_connect");if(this.events.listenerCount(A)===0)throw new Error(`emitting ${A} without any listeners 997`);this.events.emit(vr("session_connect"),{session:y}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;Hs(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(vr("session_approve",i),{})):Yi(n)&&(await this.client.session.delete(r,Dr("USER_DISCONNECTED")),this.events.emit(vr("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Dr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(tn({topic:r},i));try{Al.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(u){throw Al.delete(o),u}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=vr("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_update",i),{}):Yi(n)&&this.events.emit(vr("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,En(Mu)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=vr("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_extend",i),{}):Yi(n)&&this.events.emit(vr("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=vr("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{Hs(n)?this.events.emit(vr("session_ping",i),{}):Yi(n)&&this.events.emit(vr("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(ii.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Dr("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:u,encryptedId:l,transportType:d}=r,{id:p,params:y}=a;try{await this.isValidRequest(tn({topic:o},y));const A=this.client.session.get(o),P=await this.getVerifyContext({attestationId:u,hash:Ao(JSON.stringify(da("wc_sessionRequest",y,p))),encryptedId:l,metadata:A.peer.metadata,transportType:d}),N={id:p,topic:o,params:y,verifyContext:P};await this.setPendingSessionRequest(N),d===Wr.link_mode&&(n=A.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=A.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(N):(this.addSessionRequestToSessionRequestQueue(N),this.processSessionRequestQueue())}catch(A){await this.sendError({id:p,topic:o,error:A}),this.client.logger.error(A)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=vr("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(tn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Al.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:u}=r;try{const{requester:l,authPayload:d,expiryTimestamp:p}=s.params,y=await this.getVerifyContext({attestationId:o,hash:Ao(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:u}),A={requester:l,pairingTopic:i,id:s.id,authPayload:d,verifyContext:y,expiryTimestamp:p};await this.setAuthRequest(s.id,{request:A,pairingTopic:i,transportType:u}),u===Wr.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:y})}catch(l){this.client.logger.error(l);const d=s.params.requester.publicKey,p=await this.client.core.crypto.generateKeyPair(),y=this.getAppLinkIfEnabled(s.params.requester.metadata,u),A={type:So,receiverPublicKey:d,senderPublicKey:p};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:A,rpcOpts:kn.wc_sessionAuthenticate.autoReject,appLink:y})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Gs.idle,this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=vr("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(vr("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Gs.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Gs.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:da("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(bi(n)||await this.isValidPairingTopic(n),!B$(a)){const{message:u}=ut("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!bi(i)&&Sl(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!bi(s)&&Sl(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),bi(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=k$(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!yi(r))throw new Error(ut("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),u=h1(i,"approve()");if(u)throw new Error(u.message);const l=P_(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!an(s,!0)){const{message:d}=ut("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}bi(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!yi(r)){const{message:s}=ut("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!F$(i)){const{message:s}=ut("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!yi(r)){const{message:l}=ut("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!S_(n)){const{message:l}=ut("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=T$(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const u=h1(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(fa(o)){const{message:l}=ut("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=h1(i,"update()");if(o)throw new Error(o.message);const a=P_(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!A_(a,s)){const{message:u}=ut("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!j$(i)){const{message:u}=ut("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!z$(a,s,i.method)){const{message:u}=ut("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!V$(o,S1)){const{message:u}=ut("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${S1.min} and ${S1.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!yi(r)){const{message:o}=ut("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!U$(s)){const{message:o}=ut("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!yi(r)){const{message:a}=ut("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!A_(o,s)){const{message:a}=ut("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!q$(i)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!H$(o,s,i.name)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!an(i,!1))throw new Error("uri is required parameter");if(!an(s,!1))throw new Error("domain is required parameter");if(!an(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(u=>Eu(u).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Eu(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,u={verified:{verifyUrl:o.verifyUrl||Il,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Wr.link_mode){const d=this.getAppLinkIfEnabled(o,a);return u.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",u}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(u.verified.origin=l.origin,u.verified.isScam=l.isScam,u.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(u)}`),u},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!an(i,!1)){const{message:s}=ut("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,u,l,d,p,y;return!r||n!==Wr.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(u=this.client.metadata)==null?void 0:u.redirect)==null?void 0:l.universal)!==""&&((d=r==null?void 0:r.redirect)==null?void 0:d.universal)!==void 0&&((p=r==null?void 0:r.redirect)==null?void 0:p.universal)!==""&&((y=r==null?void 0:r.redirect)==null?void 0:y.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=Z3(r,"topic")||"",i=decodeURIComponent(Z3(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:Wr.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(i1()||Su()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ii.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(Qd)?this.client.auth.authKeys.get(Qd):{publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===Wr.link_mode?vl:la});try{g1(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:Ao(n)})):Yd(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(u){this.client.logger.error(u)}}registerExpirerEvents(){this.client.core.expirer.on(Zi.expired,async e=>{const{topic:r,id:n}=X3(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ut("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,ut("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(oc.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(oc.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=ut("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=ut("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=ut("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(an(e,!1)){const{message:r}=ut("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=ut("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!$$(e)){const{message:r}=ut("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=ut("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class yq extends uc{constructor(e,r){super(e,r,nq,_1),this.core=e,this.logger=r}}let wq=class extends uc{constructor(e,r){super(e,r,iq,_1),this.core=e,this.logger=r}};class xq extends uc{constructor(e,r){super(e,r,oq,_1,n=>n.id),this.core=e,this.logger=r}}class _q extends uc{constructor(e,r){super(e,r,fq,Zd,()=>Qd),this.core=e,this.logger=r}}class Eq extends uc{constructor(e,r){super(e,r,lq,Zd),this.core=e,this.logger=r}}class Sq extends uc{constructor(e,r){super(e,r,hq,Zd,n=>n.id),this.core=e,this.logger=r}}class Aq{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new _q(this.core,this.logger),this.pairingTopics=new Eq(this.core,this.logger),this.requests=new Sq(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class A1 extends ZR{constructor(e){super(e),this.protocol=A6,this.version=P6,this.name=E1.name,this.events=new qi.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||E1.name,this.metadata=(e==null?void 0:e.metadata)||K3(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||E1.logger}));this.core=(e==null?void 0:e.core)||new rq(e),this.logger=ri(r,this.name),this.session=new wq(this.core,this.logger),this.proposal=new yq(this.core,this.logger),this.pendingRequest=new xq(this.core,this.logger),this.engine=new bq(this),this.auth=new Aq(this.core,this.logger)}static async init(e){const r=new A1(e);return await r.initialize(),r}get context(){return gi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var e0={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */e0.exports,function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",l=500,d="__lodash_placeholder__",p=1,y=2,A=4,P=1,N=2,D=1,k=2,B=4,j=8,U=16,K=32,J=64,T=128,z=256,ue=512,_e=30,G="...",E=800,m=16,f=1,g=2,v=3,x=1/0,_=9007199254740991,S=17976931348623157e292,b=NaN,M=4294967295,I=M-1,F=M>>>1,ae=[["ary",T],["bind",D],["bindKey",k],["curry",j],["curryRight",U],["flip",ue],["partial",K],["partialRight",J],["rearg",z]],O="[object Arguments]",se="[object Array]",ee="[object AsyncFunction]",X="[object Boolean]",Q="[object Date]",R="[object DOMException]",Z="[object Error]",te="[object Function]",le="[object GeneratorFunction]",ie="[object Map]",fe="[object Number]",ve="[object Null]",Me="[object Object]",Ne="[object Promise]",Te="[object Proxy]",$e="[object RegExp]",Ie="[object Set]",Le="[object String]",Ve="[object Symbol]",ke="[object Undefined]",ze="[object WeakMap]",He="[object WeakSet]",Ee="[object ArrayBuffer]",Qe="[object DataView]",ct="[object Float32Array]",Be="[object Float64Array]",et="[object Int8Array]",rt="[object Int16Array]",Je="[object Int32Array]",pt="[object Uint8Array]",ht="[object Uint8ClampedArray]",ft="[object Uint16Array]",Ht="[object Uint32Array]",Jt=/\b__p \+= '';/g,St=/\b(__p \+=) '' \+/g,er=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Xt=/&(?:amp|lt|gt|quot|#39);/g,Ot=/[&<>"']/g,Bt=RegExp(Xt.source),Tt=RegExp(Ot.source),vt=/<%-([\s\S]+?)%>/g,Dt=/<%([\s\S]+?)%>/g,Lt=/<%=([\s\S]+?)%>/g,bt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$t=/^\w*$/,jt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(nt.source),$=/^\s+/,H=/\s/,V=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C=/\{\n\/\* \[wrapped with (.+)\] \*/,Y=/,? & /,q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,oe=/[()=,{}\[\]\/\s]/,pe=/\\(\\)?/g,xe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Re=/\w*$/,De=/^[-+]0x[0-9a-f]+$/i,it=/^0b[01]+$/i,Ue=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,st=/^(?:0|[1-9]\d*)$/,tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,Rt=/['\n\r\u2028\u2029\\]/g,Mt="\\ud800-\\udfff",Et="\\u0300-\\u036f",dt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",ot=Et+dt+_t,wt="\\u2700-\\u27bf",lt="a-z\\xdf-\\xf6\\xf8-\\xff",at="\\xac\\xb1\\xd7\\xf7",Ae="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Pe="\\u2000-\\u206f",Ge=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="A-Z\\xc0-\\xd6\\xd8-\\xde",qe="\\ufe0e\\ufe0f",Xe=at+Ae+Pe+Ge,kt="['’]",Wt="["+Mt+"]",Zt="["+Xe+"]",Kt="["+ot+"]",de="\\d+",nr="["+wt+"]",dr="["+lt+"]",pr="[^"+Mt+Xe+de+wt+lt+je+"]",Qt="\\ud83c[\\udffb-\\udfff]",gr="(?:"+Kt+"|"+Qt+")",lr="[^"+Mt+"]",Lr="(?:\\ud83c[\\udde6-\\uddff]){2}",mr="[\\ud800-\\udbff][\\udc00-\\udfff]",wr="["+je+"]",Br="\\u200d",$r="(?:"+dr+"|"+pr+")",Ir="(?:"+wr+"|"+pr+")",hn="(?:"+kt+"(?:d|ll|m|re|s|t|ve))?",dn="(?:"+kt+"(?:D|LL|M|RE|S|T|VE))?",pn=gr+"?",sp="["+qe+"]?",$b="(?:"+Br+"(?:"+[lr,Lr,mr].join("|")+")"+sp+pn+")*",jo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",op="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ap=sp+pn+$b,Qu="(?:"+[nr,Lr,mr].join("|")+")"+ap,Fb="(?:"+[lr+Kt+"?",Kt,Lr,mr,Wt].join("|")+")",gh=RegExp(kt,"g"),jb=RegExp(Kt,"g"),ef=RegExp(Qt+"(?="+Qt+")|"+Fb+ap,"g"),cp=RegExp([wr+"?"+dr+"+"+hn+"(?="+[Zt,wr,"$"].join("|")+")",Ir+"+"+dn+"(?="+[Zt,wr+$r,"$"].join("|")+")",wr+"?"+$r+"+"+hn,wr+"+"+dn,op,jo,de,Qu].join("|"),"g"),up=RegExp("["+Br+Mt+ot+qe+"]"),Pc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ub=-1,Fr={};Fr[ct]=Fr[Be]=Fr[et]=Fr[rt]=Fr[Je]=Fr[pt]=Fr[ht]=Fr[ft]=Fr[Ht]=!0,Fr[O]=Fr[se]=Fr[Ee]=Fr[X]=Fr[Qe]=Fr[Q]=Fr[Z]=Fr[te]=Fr[ie]=Fr[fe]=Fr[Me]=Fr[$e]=Fr[Ie]=Fr[Le]=Fr[ze]=!1;var kr={};kr[O]=kr[se]=kr[Ee]=kr[Qe]=kr[X]=kr[Q]=kr[ct]=kr[Be]=kr[et]=kr[rt]=kr[Je]=kr[ie]=kr[fe]=kr[Me]=kr[$e]=kr[Ie]=kr[Le]=kr[Ve]=kr[pt]=kr[ht]=kr[ft]=kr[Ht]=!0,kr[Z]=kr[te]=kr[ze]=!1;var ce={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ye={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye={"&":"&","<":"<",">":">",""":'"',"'":"'"},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},jr=parseFloat,ir=parseInt,Yr=typeof nn=="object"&&nn&&nn.Object===Object&&nn,wn=typeof self=="object"&&self&&self.Object===Object&&self,_r=Yr||wn||Function("return this")(),Ur=e&&!e.nodeType&&e,gn=Ur&&!0&&t&&!t.nodeType&&t,_i=gn&&gn.exports===Ur,xn=_i&&Yr.process,Jr=function(){try{var be=gn&&gn.require&&gn.require("util").types;return be||xn&&xn.binding&&xn.binding("util")}catch{}}(),oi=Jr&&Jr.isArrayBuffer,Ps=Jr&&Jr.isDate,is=Jr&&Jr.isMap,ro=Jr&&Jr.isRegExp,mh=Jr&&Jr.isSet,Mc=Jr&&Jr.isTypedArray;function Bn(be,Fe,Ce){switch(Ce.length){case 0:return be.call(Fe);case 1:return be.call(Fe,Ce[0]);case 2:return be.call(Fe,Ce[0],Ce[1]);case 3:return be.call(Fe,Ce[0],Ce[1],Ce[2])}return be.apply(Fe,Ce)}function OQ(be,Fe,Ce,Ct){for(var tr=-1,Mr=be==null?0:be.length;++tr-1}function qb(be,Fe,Ce){for(var Ct=-1,tr=be==null?0:be.length;++Ct-1;);return Ce}function r9(be,Fe){for(var Ce=be.length;Ce--&&tf(Fe,be[Ce],0)>-1;);return Ce}function qQ(be,Fe){for(var Ce=be.length,Ct=0;Ce--;)be[Ce]===Fe&&++Ct;return Ct}var zQ=Kb(ce),HQ=Kb(ye);function WQ(be){return"\\"+It[be]}function KQ(be,Fe){return be==null?r:be[Fe]}function rf(be){return up.test(be)}function VQ(be){return Pc.test(be)}function GQ(be){for(var Fe,Ce=[];!(Fe=be.next()).done;)Ce.push(Fe.value);return Ce}function Jb(be){var Fe=-1,Ce=Array(be.size);return be.forEach(function(Ct,tr){Ce[++Fe]=[tr,Ct]}),Ce}function n9(be,Fe){return function(Ce){return be(Fe(Ce))}}function Ta(be,Fe){for(var Ce=-1,Ct=be.length,tr=0,Mr=[];++Ce-1}function Lee(c,h){var w=this.__data__,L=Ip(w,c);return L<0?(++this.size,w.push([c,h])):w[L][1]=h,this}Uo.prototype.clear=Ree,Uo.prototype.delete=Dee,Uo.prototype.get=Oee,Uo.prototype.has=Nee,Uo.prototype.set=Lee;function qo(c){var h=-1,w=c==null?0:c.length;for(this.clear();++h=h?c:h)),c}function cs(c,h,w,L,W,ne){var he,me=h&p,we=h&y,We=h&A;if(w&&(he=W?w(c,L,W,ne):w(c)),he!==r)return he;if(!Qr(c))return c;var Ke=sr(c);if(Ke){if(he=Fte(c),!me)return Ei(c,he)}else{var Ze=ti(c),xt=Ze==te||Ze==le;if(ka(c))return F9(c,me);if(Ze==Me||Ze==O||xt&&!W){if(he=we||xt?{}:iA(c),!me)return we?Ite(c,Xee(he,c)):Mte(c,g9(he,c))}else{if(!kr[Ze])return W?c:{};he=jte(c,Ze,me)}}ne||(ne=new Is);var Nt=ne.get(c);if(Nt)return Nt;ne.set(c,he),OA(c)?c.forEach(function(Gt){he.add(cs(Gt,h,w,Gt,c,ne))}):RA(c)&&c.forEach(function(Gt,br){he.set(br,cs(Gt,h,w,br,c,ne))});var Vt=We?we?_y:xy:we?Ai:$n,fr=Ke?r:Vt(c);return ss(fr||c,function(Gt,br){fr&&(br=Gt,Gt=c[br]),Eh(he,br,cs(Gt,h,w,br,c,ne))}),he}function Zee(c){var h=$n(c);return function(w){return m9(w,c,h)}}function m9(c,h,w){var L=w.length;if(c==null)return!L;for(c=qr(c);L--;){var W=w[L],ne=h[W],he=c[W];if(he===r&&!(W in c)||!ne(he))return!1}return!0}function v9(c,h,w){if(typeof c!="function")throw new os(o);return Th(function(){c.apply(r,w)},h)}function Sh(c,h,w,L){var W=-1,ne=lp,he=!0,me=c.length,we=[],We=h.length;if(!me)return we;w&&(h=Xr(h,Li(w))),L?(ne=qb,he=!1):h.length>=i&&(ne=vh,he=!1,h=new Tc(h));e:for(;++WW?0:W+w),L=L===r||L>W?W:ur(L),L<0&&(L+=W),L=w>L?0:LA(L);w0&&w(me)?h>1?Vn(me,h-1,w,L,W):Ca(W,me):L||(W[W.length]=me)}return W}var ny=W9(),w9=W9(!0);function no(c,h){return c&&ny(c,h,$n)}function iy(c,h){return c&&w9(c,h,$n)}function Tp(c,h){return Ia(h,function(w){return Vo(c[w])})}function Dc(c,h){h=Na(h,c);for(var w=0,L=h.length;c!=null&&wh}function tte(c,h){return c!=null&&Tr.call(c,h)}function rte(c,h){return c!=null&&h in qr(c)}function nte(c,h,w){return c>=ei(h,w)&&c=120&&Ke.length>=120)?new Tc(he&&Ke):r}Ke=c[0];var Ze=-1,xt=me[0];e:for(;++Ze-1;)me!==c&&xp.call(me,we,1),xp.call(c,we,1);return c}function R9(c,h){for(var w=c?h.length:0,L=w-1;w--;){var W=h[w];if(w==L||W!==ne){var ne=W;Ko(W)?xp.call(c,W,1):py(c,W)}}return c}function ly(c,h){return c+Sp(l9()*(h-c+1))}function mte(c,h,w,L){for(var W=-1,ne=Pn(Ep((h-c)/(w||1)),0),he=Ce(ne);ne--;)he[L?ne:++W]=c,c+=w;return he}function hy(c,h){var w="";if(!c||h<1||h>_)return w;do h%2&&(w+=c),h=Sp(h/2),h&&(c+=c);while(h);return w}function hr(c,h){return Cy(aA(c,h,Pi),c+"")}function vte(c){return p9(pf(c))}function bte(c,h){var w=pf(c);return Up(w,Rc(h,0,w.length))}function Mh(c,h,w,L){if(!Qr(c))return c;h=Na(h,c);for(var W=-1,ne=h.length,he=ne-1,me=c;me!=null&&++WW?0:W+h),w=w>W?W:w,w<0&&(w+=W),W=h>w?0:w-h>>>0,h>>>=0;for(var ne=Ce(W);++L>>1,he=c[ne];he!==null&&!Bi(he)&&(w?he<=h:he=i){var We=h?null:Dte(c);if(We)return dp(We);he=!1,W=vh,we=new Tc}else we=h?[]:me;e:for(;++L=L?c:us(c,h,w)}var $9=uee||function(c){return _r.clearTimeout(c)};function F9(c,h){if(h)return c.slice();var w=c.length,L=o9?o9(w):new c.constructor(w);return c.copy(L),L}function by(c){var h=new c.constructor(c.byteLength);return new yp(h).set(new yp(c)),h}function Ete(c,h){var w=h?by(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.byteLength)}function Ste(c){var h=new c.constructor(c.source,Re.exec(c));return h.lastIndex=c.lastIndex,h}function Ate(c){return _h?qr(_h.call(c)):{}}function j9(c,h){var w=h?by(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.length)}function U9(c,h){if(c!==h){var w=c!==r,L=c===null,W=c===c,ne=Bi(c),he=h!==r,me=h===null,we=h===h,We=Bi(h);if(!me&&!We&&!ne&&c>h||ne&&he&&we&&!me&&!We||L&&he&&we||!w&&we||!W)return 1;if(!L&&!ne&&!We&&c=me)return we;var We=w[L];return we*(We=="desc"?-1:1)}}return c.index-h.index}function q9(c,h,w,L){for(var W=-1,ne=c.length,he=w.length,me=-1,we=h.length,We=Pn(ne-he,0),Ke=Ce(we+We),Ze=!L;++me1?w[W-1]:r,he=W>2?w[2]:r;for(ne=c.length>3&&typeof ne=="function"?(W--,ne):r,he&&ci(w[0],w[1],he)&&(ne=W<3?r:ne,W=1),h=qr(h);++L-1?W[ne?h[he]:he]:r}}function G9(c){return Wo(function(h){var w=h.length,L=w,W=as.prototype.thru;for(c&&h.reverse();L--;){var ne=h[L];if(typeof ne!="function")throw new os(o);if(W&&!he&&Fp(ne)=="wrapper")var he=new as([],!0)}for(L=he?L:w;++L1&&Er.reverse(),Ke&&weme))return!1;var We=ne.get(c),Ke=ne.get(h);if(We&&Ke)return We==h&&Ke==c;var Ze=-1,xt=!0,Nt=w&N?new Tc:r;for(ne.set(c,h),ne.set(h,c);++Ze1?"& ":"")+h[L],h=h.join(w>2?", ":" "),c.replace(V,`{ + */e0.exports,function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",l=500,d="__lodash_placeholder__",p=1,y=2,A=4,P=1,N=2,D=1,k=2,B=4,j=8,U=16,K=32,J=64,T=128,z=256,ue=512,_e=30,G="...",E=800,m=16,f=1,g=2,v=3,x=1/0,_=9007199254740991,S=17976931348623157e292,b=NaN,M=4294967295,I=M-1,F=M>>>1,ae=[["ary",T],["bind",D],["bindKey",k],["curry",j],["curryRight",U],["flip",ue],["partial",K],["partialRight",J],["rearg",z]],O="[object Arguments]",se="[object Array]",ee="[object AsyncFunction]",X="[object Boolean]",Q="[object Date]",R="[object DOMException]",Z="[object Error]",te="[object Function]",le="[object GeneratorFunction]",ie="[object Map]",fe="[object Number]",ve="[object Null]",Me="[object Object]",Ne="[object Promise]",Te="[object Proxy]",$e="[object RegExp]",Ie="[object Set]",Le="[object String]",Ve="[object Symbol]",ke="[object Undefined]",ze="[object WeakMap]",He="[object WeakSet]",Ee="[object ArrayBuffer]",Qe="[object DataView]",ct="[object Float32Array]",Be="[object Float64Array]",et="[object Int8Array]",rt="[object Int16Array]",Je="[object Int32Array]",pt="[object Uint8Array]",ht="[object Uint8ClampedArray]",ft="[object Uint16Array]",Ht="[object Uint32Array]",Jt=/\b__p \+= '';/g,St=/\b(__p \+=) '' \+/g,er=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Xt=/&(?:amp|lt|gt|quot|#39);/g,Ot=/[&<>"']/g,Bt=RegExp(Xt.source),Tt=RegExp(Ot.source),vt=/<%-([\s\S]+?)%>/g,Dt=/<%([\s\S]+?)%>/g,Lt=/<%=([\s\S]+?)%>/g,bt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$t=/^\w*$/,jt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(nt.source),$=/^\s+/,H=/\s/,V=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C=/\{\n\/\* \[wrapped with (.+)\] \*/,Y=/,? & /,q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,oe=/[()=,{}\[\]\/\s]/,pe=/\\(\\)?/g,xe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Re=/\w*$/,De=/^[-+]0x[0-9a-f]+$/i,it=/^0b[01]+$/i,Ue=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,st=/^(?:0|[1-9]\d*)$/,tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,Rt=/['\n\r\u2028\u2029\\]/g,Mt="\\ud800-\\udfff",Et="\\u0300-\\u036f",dt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",ot=Et+dt+_t,wt="\\u2700-\\u27bf",lt="a-z\\xdf-\\xf6\\xf8-\\xff",at="\\xac\\xb1\\xd7\\xf7",Ae="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Pe="\\u2000-\\u206f",Ge=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="A-Z\\xc0-\\xd6\\xd8-\\xde",qe="\\ufe0e\\ufe0f",Xe=at+Ae+Pe+Ge,kt="['’]",Wt="["+Mt+"]",Zt="["+Xe+"]",Kt="["+ot+"]",de="\\d+",nr="["+wt+"]",dr="["+lt+"]",pr="[^"+Mt+Xe+de+wt+lt+je+"]",Qt="\\ud83c[\\udffb-\\udfff]",gr="(?:"+Kt+"|"+Qt+")",lr="[^"+Mt+"]",Lr="(?:\\ud83c[\\udde6-\\uddff]){2}",mr="[\\ud800-\\udbff][\\udc00-\\udfff]",wr="["+je+"]",Br="\\u200d",$r="(?:"+dr+"|"+pr+")",Ir="(?:"+wr+"|"+pr+")",hn="(?:"+kt+"(?:d|ll|m|re|s|t|ve))?",dn="(?:"+kt+"(?:D|LL|M|RE|S|T|VE))?",pn=gr+"?",sp="["+qe+"]?",Fb="(?:"+Br+"(?:"+[lr,Lr,mr].join("|")+")"+sp+pn+")*",jo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",op="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ap=sp+pn+Fb,Qu="(?:"+[nr,Lr,mr].join("|")+")"+ap,jb="(?:"+[lr+Kt+"?",Kt,Lr,mr,Wt].join("|")+")",gh=RegExp(kt,"g"),Ub=RegExp(Kt,"g"),ef=RegExp(Qt+"(?="+Qt+")|"+jb+ap,"g"),cp=RegExp([wr+"?"+dr+"+"+hn+"(?="+[Zt,wr,"$"].join("|")+")",Ir+"+"+dn+"(?="+[Zt,wr+$r,"$"].join("|")+")",wr+"?"+$r+"+"+hn,wr+"+"+dn,op,jo,de,Qu].join("|"),"g"),up=RegExp("["+Br+Mt+ot+qe+"]"),Pc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],qb=-1,Fr={};Fr[ct]=Fr[Be]=Fr[et]=Fr[rt]=Fr[Je]=Fr[pt]=Fr[ht]=Fr[ft]=Fr[Ht]=!0,Fr[O]=Fr[se]=Fr[Ee]=Fr[X]=Fr[Qe]=Fr[Q]=Fr[Z]=Fr[te]=Fr[ie]=Fr[fe]=Fr[Me]=Fr[$e]=Fr[Ie]=Fr[Le]=Fr[ze]=!1;var kr={};kr[O]=kr[se]=kr[Ee]=kr[Qe]=kr[X]=kr[Q]=kr[ct]=kr[Be]=kr[et]=kr[rt]=kr[Je]=kr[ie]=kr[fe]=kr[Me]=kr[$e]=kr[Ie]=kr[Le]=kr[Ve]=kr[pt]=kr[ht]=kr[ft]=kr[Ht]=!0,kr[Z]=kr[te]=kr[ze]=!1;var ce={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ye={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye={"&":"&","<":"<",">":">",""":'"',"'":"'"},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},jr=parseFloat,ir=parseInt,Yr=typeof nn=="object"&&nn&&nn.Object===Object&&nn,wn=typeof self=="object"&&self&&self.Object===Object&&self,_r=Yr||wn||Function("return this")(),Ur=e&&!e.nodeType&&e,gn=Ur&&!0&&t&&!t.nodeType&&t,_i=gn&&gn.exports===Ur,xn=_i&&Yr.process,Jr=function(){try{var be=gn&&gn.require&&gn.require("util").types;return be||xn&&xn.binding&&xn.binding("util")}catch{}}(),oi=Jr&&Jr.isArrayBuffer,Ps=Jr&&Jr.isDate,is=Jr&&Jr.isMap,ro=Jr&&Jr.isRegExp,mh=Jr&&Jr.isSet,Mc=Jr&&Jr.isTypedArray;function Bn(be,Fe,Ce){switch(Ce.length){case 0:return be.call(Fe);case 1:return be.call(Fe,Ce[0]);case 2:return be.call(Fe,Ce[0],Ce[1]);case 3:return be.call(Fe,Ce[0],Ce[1],Ce[2])}return be.apply(Fe,Ce)}function OQ(be,Fe,Ce,Ct){for(var tr=-1,Mr=be==null?0:be.length;++tr-1}function zb(be,Fe,Ce){for(var Ct=-1,tr=be==null?0:be.length;++Ct-1;);return Ce}function r9(be,Fe){for(var Ce=be.length;Ce--&&tf(Fe,be[Ce],0)>-1;);return Ce}function qQ(be,Fe){for(var Ce=be.length,Ct=0;Ce--;)be[Ce]===Fe&&++Ct;return Ct}var zQ=Vb(ce),HQ=Vb(ye);function WQ(be){return"\\"+It[be]}function KQ(be,Fe){return be==null?r:be[Fe]}function rf(be){return up.test(be)}function VQ(be){return Pc.test(be)}function GQ(be){for(var Fe,Ce=[];!(Fe=be.next()).done;)Ce.push(Fe.value);return Ce}function Xb(be){var Fe=-1,Ce=Array(be.size);return be.forEach(function(Ct,tr){Ce[++Fe]=[tr,Ct]}),Ce}function n9(be,Fe){return function(Ce){return be(Fe(Ce))}}function Ta(be,Fe){for(var Ce=-1,Ct=be.length,tr=0,Mr=[];++Ce-1}function Lee(c,h){var w=this.__data__,L=Ip(w,c);return L<0?(++this.size,w.push([c,h])):w[L][1]=h,this}Uo.prototype.clear=Ree,Uo.prototype.delete=Dee,Uo.prototype.get=Oee,Uo.prototype.has=Nee,Uo.prototype.set=Lee;function qo(c){var h=-1,w=c==null?0:c.length;for(this.clear();++h=h?c:h)),c}function cs(c,h,w,L,W,ne){var he,me=h&p,we=h&y,We=h&A;if(w&&(he=W?w(c,L,W,ne):w(c)),he!==r)return he;if(!Qr(c))return c;var Ke=sr(c);if(Ke){if(he=Fte(c),!me)return Ei(c,he)}else{var Ze=ti(c),xt=Ze==te||Ze==le;if(ka(c))return F9(c,me);if(Ze==Me||Ze==O||xt&&!W){if(he=we||xt?{}:iA(c),!me)return we?Ite(c,Xee(he,c)):Mte(c,g9(he,c))}else{if(!kr[Ze])return W?c:{};he=jte(c,Ze,me)}}ne||(ne=new Is);var Nt=ne.get(c);if(Nt)return Nt;ne.set(c,he),OA(c)?c.forEach(function(Gt){he.add(cs(Gt,h,w,Gt,c,ne))}):RA(c)&&c.forEach(function(Gt,br){he.set(br,cs(Gt,h,w,br,c,ne))});var Vt=We?we?Ey:_y:we?Ai:$n,fr=Ke?r:Vt(c);return ss(fr||c,function(Gt,br){fr&&(br=Gt,Gt=c[br]),Eh(he,br,cs(Gt,h,w,br,c,ne))}),he}function Zee(c){var h=$n(c);return function(w){return m9(w,c,h)}}function m9(c,h,w){var L=w.length;if(c==null)return!L;for(c=qr(c);L--;){var W=w[L],ne=h[W],he=c[W];if(he===r&&!(W in c)||!ne(he))return!1}return!0}function v9(c,h,w){if(typeof c!="function")throw new os(o);return Th(function(){c.apply(r,w)},h)}function Sh(c,h,w,L){var W=-1,ne=lp,he=!0,me=c.length,we=[],We=h.length;if(!me)return we;w&&(h=Xr(h,Li(w))),L?(ne=zb,he=!1):h.length>=i&&(ne=vh,he=!1,h=new Tc(h));e:for(;++WW?0:W+w),L=L===r||L>W?W:ur(L),L<0&&(L+=W),L=w>L?0:LA(L);w0&&w(me)?h>1?Vn(me,h-1,w,L,W):Ca(W,me):L||(W[W.length]=me)}return W}var iy=W9(),w9=W9(!0);function no(c,h){return c&&iy(c,h,$n)}function sy(c,h){return c&&w9(c,h,$n)}function Tp(c,h){return Ia(h,function(w){return Vo(c[w])})}function Dc(c,h){h=Na(h,c);for(var w=0,L=h.length;c!=null&&wh}function tte(c,h){return c!=null&&Tr.call(c,h)}function rte(c,h){return c!=null&&h in qr(c)}function nte(c,h,w){return c>=ei(h,w)&&c=120&&Ke.length>=120)?new Tc(he&&Ke):r}Ke=c[0];var Ze=-1,xt=me[0];e:for(;++Ze-1;)me!==c&&xp.call(me,we,1),xp.call(c,we,1);return c}function R9(c,h){for(var w=c?h.length:0,L=w-1;w--;){var W=h[w];if(w==L||W!==ne){var ne=W;Ko(W)?xp.call(c,W,1):gy(c,W)}}return c}function hy(c,h){return c+Sp(l9()*(h-c+1))}function mte(c,h,w,L){for(var W=-1,ne=Pn(Ep((h-c)/(w||1)),0),he=Ce(ne);ne--;)he[L?ne:++W]=c,c+=w;return he}function dy(c,h){var w="";if(!c||h<1||h>_)return w;do h%2&&(w+=c),h=Sp(h/2),h&&(c+=c);while(h);return w}function hr(c,h){return Ty(aA(c,h,Pi),c+"")}function vte(c){return p9(pf(c))}function bte(c,h){var w=pf(c);return Up(w,Rc(h,0,w.length))}function Mh(c,h,w,L){if(!Qr(c))return c;h=Na(h,c);for(var W=-1,ne=h.length,he=ne-1,me=c;me!=null&&++WW?0:W+h),w=w>W?W:w,w<0&&(w+=W),W=h>w?0:w-h>>>0,h>>>=0;for(var ne=Ce(W);++L>>1,he=c[ne];he!==null&&!Bi(he)&&(w?he<=h:he=i){var We=h?null:Dte(c);if(We)return dp(We);he=!1,W=vh,we=new Tc}else we=h?[]:me;e:for(;++L=L?c:us(c,h,w)}var $9=uee||function(c){return _r.clearTimeout(c)};function F9(c,h){if(h)return c.slice();var w=c.length,L=o9?o9(w):new c.constructor(w);return c.copy(L),L}function yy(c){var h=new c.constructor(c.byteLength);return new yp(h).set(new yp(c)),h}function Ete(c,h){var w=h?yy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.byteLength)}function Ste(c){var h=new c.constructor(c.source,Re.exec(c));return h.lastIndex=c.lastIndex,h}function Ate(c){return _h?qr(_h.call(c)):{}}function j9(c,h){var w=h?yy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.length)}function U9(c,h){if(c!==h){var w=c!==r,L=c===null,W=c===c,ne=Bi(c),he=h!==r,me=h===null,we=h===h,We=Bi(h);if(!me&&!We&&!ne&&c>h||ne&&he&&we&&!me&&!We||L&&he&&we||!w&&we||!W)return 1;if(!L&&!ne&&!We&&c=me)return we;var We=w[L];return we*(We=="desc"?-1:1)}}return c.index-h.index}function q9(c,h,w,L){for(var W=-1,ne=c.length,he=w.length,me=-1,we=h.length,We=Pn(ne-he,0),Ke=Ce(we+We),Ze=!L;++me1?w[W-1]:r,he=W>2?w[2]:r;for(ne=c.length>3&&typeof ne=="function"?(W--,ne):r,he&&ci(w[0],w[1],he)&&(ne=W<3?r:ne,W=1),h=qr(h);++L-1?W[ne?h[he]:he]:r}}function G9(c){return Wo(function(h){var w=h.length,L=w,W=as.prototype.thru;for(c&&h.reverse();L--;){var ne=h[L];if(typeof ne!="function")throw new os(o);if(W&&!he&&Fp(ne)=="wrapper")var he=new as([],!0)}for(L=he?L:w;++L1&&Er.reverse(),Ke&&weme))return!1;var We=ne.get(c),Ke=ne.get(h);if(We&&Ke)return We==h&&Ke==c;var Ze=-1,xt=!0,Nt=w&N?new Tc:r;for(ne.set(c,h),ne.set(h,c);++Ze1?"& ":"")+h[L],h=h.join(w>2?", ":" "),c.replace(V,`{ /* [wrapped with `+h+`] */ -`)}function qte(c){return sr(c)||Lc(c)||!!(u9&&c&&c[u9])}function Ko(c,h){var w=typeof c;return h=h??_,!!h&&(w=="number"||w!="symbol"&&st.test(c))&&c>-1&&c%1==0&&c0){if(++h>=E)return arguments[0]}else h=0;return c.apply(r,arguments)}}function Up(c,h){var w=-1,L=c.length,W=L-1;for(h=h===r?L:h;++w1?c[h-1]:r;return w=typeof w=="function"?(c.pop(),w):r,yA(c,w)});function wA(c){var h=re(c);return h.__chain__=!0,h}function Qre(c,h){return h(c),c}function qp(c,h){return h(c)}var ene=Wo(function(c){var h=c.length,w=h?c[0]:0,L=this.__wrapped__,W=function(ne){return ry(ne,c)};return h>1||this.__actions__.length||!(L instanceof xr)||!Ko(w)?this.thru(W):(L=L.slice(w,+w+(h?1:0)),L.__actions__.push({func:qp,args:[W],thisArg:r}),new as(L,this.__chain__).thru(function(ne){return h&&!ne.length&&ne.push(r),ne}))});function tne(){return wA(this)}function rne(){return new as(this.value(),this.__chain__)}function nne(){this.__values__===r&&(this.__values__=NA(this.value()));var c=this.__index__>=this.__values__.length,h=c?r:this.__values__[this.__index__++];return{done:c,value:h}}function ine(){return this}function sne(c){for(var h,w=this;w instanceof Mp;){var L=dA(w);L.__index__=0,L.__values__=r,h?W.__wrapped__=L:h=L;var W=L;w=w.__wrapped__}return W.__wrapped__=c,h}function one(){var c=this.__wrapped__;if(c instanceof xr){var h=c;return this.__actions__.length&&(h=new xr(this)),h=h.reverse(),h.__actions__.push({func:qp,args:[Ty],thisArg:r}),new as(h,this.__chain__)}return this.thru(Ty)}function ane(){return k9(this.__wrapped__,this.__actions__)}var cne=Np(function(c,h,w){Tr.call(c,w)?++c[w]:zo(c,w,1)});function une(c,h,w){var L=sr(c)?Y7:Qee;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}function fne(c,h){var w=sr(c)?Ia:y9;return w(c,qt(h,3))}var lne=V9(pA),hne=V9(gA);function dne(c,h){return Vn(zp(c,h),1)}function pne(c,h){return Vn(zp(c,h),x)}function gne(c,h,w){return w=w===r?1:ur(w),Vn(zp(c,h),w)}function xA(c,h){var w=sr(c)?ss:Da;return w(c,qt(h,3))}function _A(c,h){var w=sr(c)?NQ:b9;return w(c,qt(h,3))}var mne=Np(function(c,h,w){Tr.call(c,w)?c[w].push(h):zo(c,w,[h])});function vne(c,h,w,L){c=Si(c)?c:pf(c),w=w&&!L?ur(w):0;var W=c.length;return w<0&&(w=Pn(W+w,0)),Gp(c)?w<=W&&c.indexOf(h,w)>-1:!!W&&tf(c,h,w)>-1}var bne=hr(function(c,h,w){var L=-1,W=typeof h=="function",ne=Si(c)?Ce(c.length):[];return Da(c,function(he){ne[++L]=W?Bn(h,he,w):Ah(he,h,w)}),ne}),yne=Np(function(c,h,w){zo(c,w,h)});function zp(c,h){var w=sr(c)?Xr:A9;return w(c,qt(h,3))}function wne(c,h,w,L){return c==null?[]:(sr(h)||(h=h==null?[]:[h]),w=L?r:w,sr(w)||(w=w==null?[]:[w]),C9(c,h,w))}var xne=Np(function(c,h,w){c[w?0:1].push(h)},function(){return[[],[]]});function _ne(c,h,w){var L=sr(c)?zb:Q7,W=arguments.length<3;return L(c,qt(h,4),w,W,Da)}function Ene(c,h,w){var L=sr(c)?LQ:Q7,W=arguments.length<3;return L(c,qt(h,4),w,W,b9)}function Sne(c,h){var w=sr(c)?Ia:y9;return w(c,Kp(qt(h,3)))}function Ane(c){var h=sr(c)?p9:vte;return h(c)}function Pne(c,h,w){(w?ci(c,h,w):h===r)?h=1:h=ur(h);var L=sr(c)?Gee:bte;return L(c,h)}function Mne(c){var h=sr(c)?Yee:wte;return h(c)}function Ine(c){if(c==null)return 0;if(Si(c))return Gp(c)?nf(c):c.length;var h=ti(c);return h==ie||h==Ie?c.size:cy(c).length}function Cne(c,h,w){var L=sr(c)?Hb:xte;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}var Tne=hr(function(c,h){if(c==null)return[];var w=h.length;return w>1&&ci(c,h[0],h[1])?h=[]:w>2&&ci(h[0],h[1],h[2])&&(h=[h[0]]),C9(c,Vn(h,1),[])}),Hp=fee||function(){return _r.Date.now()};function Rne(c,h){if(typeof h!="function")throw new os(o);return c=ur(c),function(){if(--c<1)return h.apply(this,arguments)}}function EA(c,h,w){return h=w?r:h,h=c&&h==null?c.length:h,Ho(c,T,r,r,r,r,h)}function SA(c,h){var w;if(typeof h!="function")throw new os(o);return c=ur(c),function(){return--c>0&&(w=h.apply(this,arguments)),c<=1&&(h=r),w}}var Dy=hr(function(c,h,w){var L=D;if(w.length){var W=Ta(w,hf(Dy));L|=K}return Ho(c,L,h,w,W)}),AA=hr(function(c,h,w){var L=D|k;if(w.length){var W=Ta(w,hf(AA));L|=K}return Ho(h,L,c,w,W)});function PA(c,h,w){h=w?r:h;var L=Ho(c,j,r,r,r,r,r,h);return L.placeholder=PA.placeholder,L}function MA(c,h,w){h=w?r:h;var L=Ho(c,U,r,r,r,r,r,h);return L.placeholder=MA.placeholder,L}function IA(c,h,w){var L,W,ne,he,me,we,We=0,Ke=!1,Ze=!1,xt=!0;if(typeof c!="function")throw new os(o);h=ls(h)||0,Qr(w)&&(Ke=!!w.leading,Ze="maxWait"in w,ne=Ze?Pn(ls(w.maxWait)||0,h):ne,xt="trailing"in w?!!w.trailing:xt);function Nt(vn){var Ts=L,Yo=W;return L=W=r,We=vn,he=c.apply(Yo,Ts),he}function Vt(vn){return We=vn,me=Th(br,h),Ke?Nt(vn):he}function fr(vn){var Ts=vn-we,Yo=vn-We,VA=h-Ts;return Ze?ei(VA,ne-Yo):VA}function Gt(vn){var Ts=vn-we,Yo=vn-We;return we===r||Ts>=h||Ts<0||Ze&&Yo>=ne}function br(){var vn=Hp();if(Gt(vn))return Er(vn);me=Th(br,fr(vn))}function Er(vn){return me=r,xt&&L?Nt(vn):(L=W=r,he)}function $i(){me!==r&&$9(me),We=0,L=we=W=me=r}function ui(){return me===r?he:Er(Hp())}function Fi(){var vn=Hp(),Ts=Gt(vn);if(L=arguments,W=this,we=vn,Ts){if(me===r)return Vt(we);if(Ze)return $9(me),me=Th(br,h),Nt(we)}return me===r&&(me=Th(br,h)),he}return Fi.cancel=$i,Fi.flush=ui,Fi}var Dne=hr(function(c,h){return v9(c,1,h)}),One=hr(function(c,h,w){return v9(c,ls(h)||0,w)});function Nne(c){return Ho(c,ue)}function Wp(c,h){if(typeof c!="function"||h!=null&&typeof h!="function")throw new os(o);var w=function(){var L=arguments,W=h?h.apply(this,L):L[0],ne=w.cache;if(ne.has(W))return ne.get(W);var he=c.apply(this,L);return w.cache=ne.set(W,he)||ne,he};return w.cache=new(Wp.Cache||qo),w}Wp.Cache=qo;function Kp(c){if(typeof c!="function")throw new os(o);return function(){var h=arguments;switch(h.length){case 0:return!c.call(this);case 1:return!c.call(this,h[0]);case 2:return!c.call(this,h[0],h[1]);case 3:return!c.call(this,h[0],h[1],h[2])}return!c.apply(this,h)}}function Lne(c){return SA(2,c)}var kne=_te(function(c,h){h=h.length==1&&sr(h[0])?Xr(h[0],Li(qt())):Xr(Vn(h,1),Li(qt()));var w=h.length;return hr(function(L){for(var W=-1,ne=ei(L.length,w);++W=h}),Lc=_9(function(){return arguments}())?_9:function(c){return rn(c)&&Tr.call(c,"callee")&&!c9.call(c,"callee")},sr=Ce.isArray,Xne=oi?Li(oi):ste;function Si(c){return c!=null&&Vp(c.length)&&!Vo(c)}function mn(c){return rn(c)&&Si(c)}function Zne(c){return c===!0||c===!1||rn(c)&&ai(c)==X}var ka=hee||Hy,Qne=Ps?Li(Ps):ote;function eie(c){return rn(c)&&c.nodeType===1&&!Rh(c)}function tie(c){if(c==null)return!0;if(Si(c)&&(sr(c)||typeof c=="string"||typeof c.splice=="function"||ka(c)||df(c)||Lc(c)))return!c.length;var h=ti(c);if(h==ie||h==Ie)return!c.size;if(Ch(c))return!cy(c).length;for(var w in c)if(Tr.call(c,w))return!1;return!0}function rie(c,h){return Ph(c,h)}function nie(c,h,w){w=typeof w=="function"?w:r;var L=w?w(c,h):r;return L===r?Ph(c,h,r,w):!!L}function Ny(c){if(!rn(c))return!1;var h=ai(c);return h==Z||h==R||typeof c.message=="string"&&typeof c.name=="string"&&!Rh(c)}function iie(c){return typeof c=="number"&&f9(c)}function Vo(c){if(!Qr(c))return!1;var h=ai(c);return h==te||h==le||h==ee||h==Te}function TA(c){return typeof c=="number"&&c==ur(c)}function Vp(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=_}function Qr(c){var h=typeof c;return c!=null&&(h=="object"||h=="function")}function rn(c){return c!=null&&typeof c=="object"}var RA=is?Li(is):cte;function sie(c,h){return c===h||ay(c,h,Sy(h))}function oie(c,h,w){return w=typeof w=="function"?w:r,ay(c,h,Sy(h),w)}function aie(c){return DA(c)&&c!=+c}function cie(c){if(Wte(c))throw new tr(s);return E9(c)}function uie(c){return c===null}function fie(c){return c==null}function DA(c){return typeof c=="number"||rn(c)&&ai(c)==fe}function Rh(c){if(!rn(c)||ai(c)!=Me)return!1;var h=wp(c);if(h===null)return!0;var w=Tr.call(h,"constructor")&&h.constructor;return typeof w=="function"&&w instanceof w&&mp.call(w)==oee}var Ly=ro?Li(ro):ute;function lie(c){return TA(c)&&c>=-_&&c<=_}var OA=mh?Li(mh):fte;function Gp(c){return typeof c=="string"||!sr(c)&&rn(c)&&ai(c)==Le}function Bi(c){return typeof c=="symbol"||rn(c)&&ai(c)==Ve}var df=Mc?Li(Mc):lte;function hie(c){return c===r}function die(c){return rn(c)&&ti(c)==ze}function pie(c){return rn(c)&&ai(c)==He}var gie=$p(uy),mie=$p(function(c,h){return c<=h});function NA(c){if(!c)return[];if(Si(c))return Gp(c)?Ms(c):Ei(c);if(bh&&c[bh])return GQ(c[bh]());var h=ti(c),w=h==ie?Jb:h==Ie?dp:pf;return w(c)}function Go(c){if(!c)return c===0?c:0;if(c=ls(c),c===x||c===-x){var h=c<0?-1:1;return h*S}return c===c?c:0}function ur(c){var h=Go(c),w=h%1;return h===h?w?h-w:h:0}function LA(c){return c?Rc(ur(c),0,M):0}function ls(c){if(typeof c=="number")return c;if(Bi(c))return b;if(Qr(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=Qr(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=e9(c);var w=it.test(c);return w||gt.test(c)?ir(c.slice(2),w?2:8):De.test(c)?b:+c}function kA(c){return io(c,Ai(c))}function vie(c){return c?Rc(ur(c),-_,_):c===0?c:0}function Cr(c){return c==null?"":ki(c)}var bie=ff(function(c,h){if(Ch(h)||Si(h)){io(h,$n(h),c);return}for(var w in h)Tr.call(h,w)&&Eh(c,w,h[w])}),BA=ff(function(c,h){io(h,Ai(h),c)}),Yp=ff(function(c,h,w,L){io(h,Ai(h),c,L)}),yie=ff(function(c,h,w,L){io(h,$n(h),c,L)}),wie=Wo(ry);function xie(c,h){var w=uf(c);return h==null?w:g9(w,h)}var _ie=hr(function(c,h){c=qr(c);var w=-1,L=h.length,W=L>2?h[2]:r;for(W&&ci(h[0],h[1],W)&&(L=1);++w1),ne}),io(c,_y(c),w),L&&(w=cs(w,p|y|A,Ote));for(var W=h.length;W--;)py(w,h[W]);return w});function jie(c,h){return FA(c,Kp(qt(h)))}var Uie=Wo(function(c,h){return c==null?{}:pte(c,h)});function FA(c,h){if(c==null)return{};var w=Xr(_y(c),function(L){return[L]});return h=qt(h),T9(c,w,function(L,W){return h(L,W[0])})}function qie(c,h,w){h=Na(h,c);var L=-1,W=h.length;for(W||(W=1,c=r);++Lh){var L=c;c=h,h=L}if(w||c%1||h%1){var W=l9();return ei(c+W*(h-c+jr("1e-"+((W+"").length-1))),h)}return ly(c,h)}var Qie=lf(function(c,h,w){return h=h.toLowerCase(),c+(w?qA(h):h)});function qA(c){return $y(Cr(c).toLowerCase())}function zA(c){return c=Cr(c),c&&c.replace(tt,zQ).replace(jb,"")}function ese(c,h,w){c=Cr(c),h=ki(h);var L=c.length;w=w===r?L:Rc(ur(w),0,L);var W=w;return w-=h.length,w>=0&&c.slice(w,W)==h}function tse(c){return c=Cr(c),c&&Tt.test(c)?c.replace(Ot,HQ):c}function rse(c){return c=Cr(c),c&&Ft.test(c)?c.replace(nt,"\\$&"):c}var nse=lf(function(c,h,w){return c+(w?"-":"")+h.toLowerCase()}),ise=lf(function(c,h,w){return c+(w?" ":"")+h.toLowerCase()}),sse=K9("toLowerCase");function ose(c,h,w){c=Cr(c),h=ur(h);var L=h?nf(c):0;if(!h||L>=h)return c;var W=(h-L)/2;return Bp(Sp(W),w)+c+Bp(Ep(W),w)}function ase(c,h,w){c=Cr(c),h=ur(h);var L=h?nf(c):0;return h&&L>>0,w?(c=Cr(c),c&&(typeof h=="string"||h!=null&&!Ly(h))&&(h=ki(h),!h&&rf(c))?La(Ms(c),0,w):c.split(h,w)):[]}var pse=lf(function(c,h,w){return c+(w?" ":"")+$y(h)});function gse(c,h,w){return c=Cr(c),w=w==null?0:Rc(ur(w),0,c.length),h=ki(h),c.slice(w,w+h.length)==h}function mse(c,h,w){var L=re.templateSettings;w&&ci(c,h,w)&&(h=r),c=Cr(c),h=Yp({},h,L,Q9);var W=Yp({},h.imports,L.imports,Q9),ne=$n(W),he=Yb(W,ne),me,we,We=0,Ke=h.interpolate||At,Ze="__p += '",xt=Xb((h.escape||At).source+"|"+Ke.source+"|"+(Ke===Lt?xe:At).source+"|"+(h.evaluate||At).source+"|$","g"),Nt="//# sourceURL="+(Tr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ub+"]")+` +`)}function qte(c){return sr(c)||Lc(c)||!!(u9&&c&&c[u9])}function Ko(c,h){var w=typeof c;return h=h??_,!!h&&(w=="number"||w!="symbol"&&st.test(c))&&c>-1&&c%1==0&&c0){if(++h>=E)return arguments[0]}else h=0;return c.apply(r,arguments)}}function Up(c,h){var w=-1,L=c.length,W=L-1;for(h=h===r?L:h;++w1?c[h-1]:r;return w=typeof w=="function"?(c.pop(),w):r,yA(c,w)});function wA(c){var h=re(c);return h.__chain__=!0,h}function Qre(c,h){return h(c),c}function qp(c,h){return h(c)}var ene=Wo(function(c){var h=c.length,w=h?c[0]:0,L=this.__wrapped__,W=function(ne){return ny(ne,c)};return h>1||this.__actions__.length||!(L instanceof xr)||!Ko(w)?this.thru(W):(L=L.slice(w,+w+(h?1:0)),L.__actions__.push({func:qp,args:[W],thisArg:r}),new as(L,this.__chain__).thru(function(ne){return h&&!ne.length&&ne.push(r),ne}))});function tne(){return wA(this)}function rne(){return new as(this.value(),this.__chain__)}function nne(){this.__values__===r&&(this.__values__=NA(this.value()));var c=this.__index__>=this.__values__.length,h=c?r:this.__values__[this.__index__++];return{done:c,value:h}}function ine(){return this}function sne(c){for(var h,w=this;w instanceof Mp;){var L=dA(w);L.__index__=0,L.__values__=r,h?W.__wrapped__=L:h=L;var W=L;w=w.__wrapped__}return W.__wrapped__=c,h}function one(){var c=this.__wrapped__;if(c instanceof xr){var h=c;return this.__actions__.length&&(h=new xr(this)),h=h.reverse(),h.__actions__.push({func:qp,args:[Ry],thisArg:r}),new as(h,this.__chain__)}return this.thru(Ry)}function ane(){return k9(this.__wrapped__,this.__actions__)}var cne=Np(function(c,h,w){Tr.call(c,w)?++c[w]:zo(c,w,1)});function une(c,h,w){var L=sr(c)?Y7:Qee;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}function fne(c,h){var w=sr(c)?Ia:y9;return w(c,qt(h,3))}var lne=V9(pA),hne=V9(gA);function dne(c,h){return Vn(zp(c,h),1)}function pne(c,h){return Vn(zp(c,h),x)}function gne(c,h,w){return w=w===r?1:ur(w),Vn(zp(c,h),w)}function xA(c,h){var w=sr(c)?ss:Da;return w(c,qt(h,3))}function _A(c,h){var w=sr(c)?NQ:b9;return w(c,qt(h,3))}var mne=Np(function(c,h,w){Tr.call(c,w)?c[w].push(h):zo(c,w,[h])});function vne(c,h,w,L){c=Si(c)?c:pf(c),w=w&&!L?ur(w):0;var W=c.length;return w<0&&(w=Pn(W+w,0)),Gp(c)?w<=W&&c.indexOf(h,w)>-1:!!W&&tf(c,h,w)>-1}var bne=hr(function(c,h,w){var L=-1,W=typeof h=="function",ne=Si(c)?Ce(c.length):[];return Da(c,function(he){ne[++L]=W?Bn(h,he,w):Ah(he,h,w)}),ne}),yne=Np(function(c,h,w){zo(c,w,h)});function zp(c,h){var w=sr(c)?Xr:A9;return w(c,qt(h,3))}function wne(c,h,w,L){return c==null?[]:(sr(h)||(h=h==null?[]:[h]),w=L?r:w,sr(w)||(w=w==null?[]:[w]),C9(c,h,w))}var xne=Np(function(c,h,w){c[w?0:1].push(h)},function(){return[[],[]]});function _ne(c,h,w){var L=sr(c)?Hb:Q7,W=arguments.length<3;return L(c,qt(h,4),w,W,Da)}function Ene(c,h,w){var L=sr(c)?LQ:Q7,W=arguments.length<3;return L(c,qt(h,4),w,W,b9)}function Sne(c,h){var w=sr(c)?Ia:y9;return w(c,Kp(qt(h,3)))}function Ane(c){var h=sr(c)?p9:vte;return h(c)}function Pne(c,h,w){(w?ci(c,h,w):h===r)?h=1:h=ur(h);var L=sr(c)?Gee:bte;return L(c,h)}function Mne(c){var h=sr(c)?Yee:wte;return h(c)}function Ine(c){if(c==null)return 0;if(Si(c))return Gp(c)?nf(c):c.length;var h=ti(c);return h==ie||h==Ie?c.size:uy(c).length}function Cne(c,h,w){var L=sr(c)?Wb:xte;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}var Tne=hr(function(c,h){if(c==null)return[];var w=h.length;return w>1&&ci(c,h[0],h[1])?h=[]:w>2&&ci(h[0],h[1],h[2])&&(h=[h[0]]),C9(c,Vn(h,1),[])}),Hp=fee||function(){return _r.Date.now()};function Rne(c,h){if(typeof h!="function")throw new os(o);return c=ur(c),function(){if(--c<1)return h.apply(this,arguments)}}function EA(c,h,w){return h=w?r:h,h=c&&h==null?c.length:h,Ho(c,T,r,r,r,r,h)}function SA(c,h){var w;if(typeof h!="function")throw new os(o);return c=ur(c),function(){return--c>0&&(w=h.apply(this,arguments)),c<=1&&(h=r),w}}var Oy=hr(function(c,h,w){var L=D;if(w.length){var W=Ta(w,hf(Oy));L|=K}return Ho(c,L,h,w,W)}),AA=hr(function(c,h,w){var L=D|k;if(w.length){var W=Ta(w,hf(AA));L|=K}return Ho(h,L,c,w,W)});function PA(c,h,w){h=w?r:h;var L=Ho(c,j,r,r,r,r,r,h);return L.placeholder=PA.placeholder,L}function MA(c,h,w){h=w?r:h;var L=Ho(c,U,r,r,r,r,r,h);return L.placeholder=MA.placeholder,L}function IA(c,h,w){var L,W,ne,he,me,we,We=0,Ke=!1,Ze=!1,xt=!0;if(typeof c!="function")throw new os(o);h=ls(h)||0,Qr(w)&&(Ke=!!w.leading,Ze="maxWait"in w,ne=Ze?Pn(ls(w.maxWait)||0,h):ne,xt="trailing"in w?!!w.trailing:xt);function Nt(vn){var Ts=L,Yo=W;return L=W=r,We=vn,he=c.apply(Yo,Ts),he}function Vt(vn){return We=vn,me=Th(br,h),Ke?Nt(vn):he}function fr(vn){var Ts=vn-we,Yo=vn-We,VA=h-Ts;return Ze?ei(VA,ne-Yo):VA}function Gt(vn){var Ts=vn-we,Yo=vn-We;return we===r||Ts>=h||Ts<0||Ze&&Yo>=ne}function br(){var vn=Hp();if(Gt(vn))return Er(vn);me=Th(br,fr(vn))}function Er(vn){return me=r,xt&&L?Nt(vn):(L=W=r,he)}function $i(){me!==r&&$9(me),We=0,L=we=W=me=r}function ui(){return me===r?he:Er(Hp())}function Fi(){var vn=Hp(),Ts=Gt(vn);if(L=arguments,W=this,we=vn,Ts){if(me===r)return Vt(we);if(Ze)return $9(me),me=Th(br,h),Nt(we)}return me===r&&(me=Th(br,h)),he}return Fi.cancel=$i,Fi.flush=ui,Fi}var Dne=hr(function(c,h){return v9(c,1,h)}),One=hr(function(c,h,w){return v9(c,ls(h)||0,w)});function Nne(c){return Ho(c,ue)}function Wp(c,h){if(typeof c!="function"||h!=null&&typeof h!="function")throw new os(o);var w=function(){var L=arguments,W=h?h.apply(this,L):L[0],ne=w.cache;if(ne.has(W))return ne.get(W);var he=c.apply(this,L);return w.cache=ne.set(W,he)||ne,he};return w.cache=new(Wp.Cache||qo),w}Wp.Cache=qo;function Kp(c){if(typeof c!="function")throw new os(o);return function(){var h=arguments;switch(h.length){case 0:return!c.call(this);case 1:return!c.call(this,h[0]);case 2:return!c.call(this,h[0],h[1]);case 3:return!c.call(this,h[0],h[1],h[2])}return!c.apply(this,h)}}function Lne(c){return SA(2,c)}var kne=_te(function(c,h){h=h.length==1&&sr(h[0])?Xr(h[0],Li(qt())):Xr(Vn(h,1),Li(qt()));var w=h.length;return hr(function(L){for(var W=-1,ne=ei(L.length,w);++W=h}),Lc=_9(function(){return arguments}())?_9:function(c){return rn(c)&&Tr.call(c,"callee")&&!c9.call(c,"callee")},sr=Ce.isArray,Xne=oi?Li(oi):ste;function Si(c){return c!=null&&Vp(c.length)&&!Vo(c)}function mn(c){return rn(c)&&Si(c)}function Zne(c){return c===!0||c===!1||rn(c)&&ai(c)==X}var ka=hee||Wy,Qne=Ps?Li(Ps):ote;function eie(c){return rn(c)&&c.nodeType===1&&!Rh(c)}function tie(c){if(c==null)return!0;if(Si(c)&&(sr(c)||typeof c=="string"||typeof c.splice=="function"||ka(c)||df(c)||Lc(c)))return!c.length;var h=ti(c);if(h==ie||h==Ie)return!c.size;if(Ch(c))return!uy(c).length;for(var w in c)if(Tr.call(c,w))return!1;return!0}function rie(c,h){return Ph(c,h)}function nie(c,h,w){w=typeof w=="function"?w:r;var L=w?w(c,h):r;return L===r?Ph(c,h,r,w):!!L}function Ly(c){if(!rn(c))return!1;var h=ai(c);return h==Z||h==R||typeof c.message=="string"&&typeof c.name=="string"&&!Rh(c)}function iie(c){return typeof c=="number"&&f9(c)}function Vo(c){if(!Qr(c))return!1;var h=ai(c);return h==te||h==le||h==ee||h==Te}function TA(c){return typeof c=="number"&&c==ur(c)}function Vp(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=_}function Qr(c){var h=typeof c;return c!=null&&(h=="object"||h=="function")}function rn(c){return c!=null&&typeof c=="object"}var RA=is?Li(is):cte;function sie(c,h){return c===h||cy(c,h,Ay(h))}function oie(c,h,w){return w=typeof w=="function"?w:r,cy(c,h,Ay(h),w)}function aie(c){return DA(c)&&c!=+c}function cie(c){if(Wte(c))throw new tr(s);return E9(c)}function uie(c){return c===null}function fie(c){return c==null}function DA(c){return typeof c=="number"||rn(c)&&ai(c)==fe}function Rh(c){if(!rn(c)||ai(c)!=Me)return!1;var h=wp(c);if(h===null)return!0;var w=Tr.call(h,"constructor")&&h.constructor;return typeof w=="function"&&w instanceof w&&mp.call(w)==oee}var ky=ro?Li(ro):ute;function lie(c){return TA(c)&&c>=-_&&c<=_}var OA=mh?Li(mh):fte;function Gp(c){return typeof c=="string"||!sr(c)&&rn(c)&&ai(c)==Le}function Bi(c){return typeof c=="symbol"||rn(c)&&ai(c)==Ve}var df=Mc?Li(Mc):lte;function hie(c){return c===r}function die(c){return rn(c)&&ti(c)==ze}function pie(c){return rn(c)&&ai(c)==He}var gie=$p(fy),mie=$p(function(c,h){return c<=h});function NA(c){if(!c)return[];if(Si(c))return Gp(c)?Ms(c):Ei(c);if(bh&&c[bh])return GQ(c[bh]());var h=ti(c),w=h==ie?Xb:h==Ie?dp:pf;return w(c)}function Go(c){if(!c)return c===0?c:0;if(c=ls(c),c===x||c===-x){var h=c<0?-1:1;return h*S}return c===c?c:0}function ur(c){var h=Go(c),w=h%1;return h===h?w?h-w:h:0}function LA(c){return c?Rc(ur(c),0,M):0}function ls(c){if(typeof c=="number")return c;if(Bi(c))return b;if(Qr(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=Qr(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=e9(c);var w=it.test(c);return w||gt.test(c)?ir(c.slice(2),w?2:8):De.test(c)?b:+c}function kA(c){return io(c,Ai(c))}function vie(c){return c?Rc(ur(c),-_,_):c===0?c:0}function Cr(c){return c==null?"":ki(c)}var bie=ff(function(c,h){if(Ch(h)||Si(h)){io(h,$n(h),c);return}for(var w in h)Tr.call(h,w)&&Eh(c,w,h[w])}),BA=ff(function(c,h){io(h,Ai(h),c)}),Yp=ff(function(c,h,w,L){io(h,Ai(h),c,L)}),yie=ff(function(c,h,w,L){io(h,$n(h),c,L)}),wie=Wo(ny);function xie(c,h){var w=uf(c);return h==null?w:g9(w,h)}var _ie=hr(function(c,h){c=qr(c);var w=-1,L=h.length,W=L>2?h[2]:r;for(W&&ci(h[0],h[1],W)&&(L=1);++w1),ne}),io(c,Ey(c),w),L&&(w=cs(w,p|y|A,Ote));for(var W=h.length;W--;)gy(w,h[W]);return w});function jie(c,h){return FA(c,Kp(qt(h)))}var Uie=Wo(function(c,h){return c==null?{}:pte(c,h)});function FA(c,h){if(c==null)return{};var w=Xr(Ey(c),function(L){return[L]});return h=qt(h),T9(c,w,function(L,W){return h(L,W[0])})}function qie(c,h,w){h=Na(h,c);var L=-1,W=h.length;for(W||(W=1,c=r);++Lh){var L=c;c=h,h=L}if(w||c%1||h%1){var W=l9();return ei(c+W*(h-c+jr("1e-"+((W+"").length-1))),h)}return hy(c,h)}var Qie=lf(function(c,h,w){return h=h.toLowerCase(),c+(w?qA(h):h)});function qA(c){return Fy(Cr(c).toLowerCase())}function zA(c){return c=Cr(c),c&&c.replace(tt,zQ).replace(Ub,"")}function ese(c,h,w){c=Cr(c),h=ki(h);var L=c.length;w=w===r?L:Rc(ur(w),0,L);var W=w;return w-=h.length,w>=0&&c.slice(w,W)==h}function tse(c){return c=Cr(c),c&&Tt.test(c)?c.replace(Ot,HQ):c}function rse(c){return c=Cr(c),c&&Ft.test(c)?c.replace(nt,"\\$&"):c}var nse=lf(function(c,h,w){return c+(w?"-":"")+h.toLowerCase()}),ise=lf(function(c,h,w){return c+(w?" ":"")+h.toLowerCase()}),sse=K9("toLowerCase");function ose(c,h,w){c=Cr(c),h=ur(h);var L=h?nf(c):0;if(!h||L>=h)return c;var W=(h-L)/2;return Bp(Sp(W),w)+c+Bp(Ep(W),w)}function ase(c,h,w){c=Cr(c),h=ur(h);var L=h?nf(c):0;return h&&L>>0,w?(c=Cr(c),c&&(typeof h=="string"||h!=null&&!ky(h))&&(h=ki(h),!h&&rf(c))?La(Ms(c),0,w):c.split(h,w)):[]}var pse=lf(function(c,h,w){return c+(w?" ":"")+Fy(h)});function gse(c,h,w){return c=Cr(c),w=w==null?0:Rc(ur(w),0,c.length),h=ki(h),c.slice(w,w+h.length)==h}function mse(c,h,w){var L=re.templateSettings;w&&ci(c,h,w)&&(h=r),c=Cr(c),h=Yp({},h,L,Q9);var W=Yp({},h.imports,L.imports,Q9),ne=$n(W),he=Jb(W,ne),me,we,We=0,Ke=h.interpolate||At,Ze="__p += '",xt=Zb((h.escape||At).source+"|"+Ke.source+"|"+(Ke===Lt?xe:At).source+"|"+(h.evaluate||At).source+"|$","g"),Nt="//# sourceURL="+(Tr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++qb+"]")+` `;c.replace(xt,function(Gt,br,Er,$i,ui,Fi){return Er||(Er=$i),Ze+=c.slice(We,Fi).replace(Rt,WQ),br&&(me=!0,Ze+=`' + __e(`+br+`) + '`),ui&&(we=!0,Ze+=`'; @@ -104,14 +104,14 @@ __p += '`),Er&&(Ze+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+Ze+`return __p -}`;var fr=WA(function(){return Mr(ne,Nt+"return "+Ze).apply(r,he)});if(fr.source=Ze,Ny(fr))throw fr;return fr}function vse(c){return Cr(c).toLowerCase()}function bse(c){return Cr(c).toUpperCase()}function yse(c,h,w){if(c=Cr(c),c&&(w||h===r))return e9(c);if(!c||!(h=ki(h)))return c;var L=Ms(c),W=Ms(h),ne=t9(L,W),he=r9(L,W)+1;return La(L,ne,he).join("")}function wse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.slice(0,i9(c)+1);if(!c||!(h=ki(h)))return c;var L=Ms(c),W=r9(L,Ms(h))+1;return La(L,0,W).join("")}function xse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.replace($,"");if(!c||!(h=ki(h)))return c;var L=Ms(c),W=t9(L,Ms(h));return La(L,W).join("")}function _se(c,h){var w=_e,L=G;if(Qr(h)){var W="separator"in h?h.separator:W;w="length"in h?ur(h.length):w,L="omission"in h?ki(h.omission):L}c=Cr(c);var ne=c.length;if(rf(c)){var he=Ms(c);ne=he.length}if(w>=ne)return c;var me=w-nf(L);if(me<1)return L;var we=he?La(he,0,me).join(""):c.slice(0,me);if(W===r)return we+L;if(he&&(me+=we.length-me),Ly(W)){if(c.slice(me).search(W)){var We,Ke=we;for(W.global||(W=Xb(W.source,Cr(Re.exec(W))+"g")),W.lastIndex=0;We=W.exec(Ke);)var Ze=We.index;we=we.slice(0,Ze===r?me:Ze)}}else if(c.indexOf(ki(W),me)!=me){var xt=we.lastIndexOf(W);xt>-1&&(we=we.slice(0,xt))}return we+L}function Ese(c){return c=Cr(c),c&&Bt.test(c)?c.replace(Xt,ZQ):c}var Sse=lf(function(c,h,w){return c+(w?" ":"")+h.toUpperCase()}),$y=K9("toUpperCase");function HA(c,h,w){return c=Cr(c),h=w?r:h,h===r?VQ(c)?tee(c):$Q(c):c.match(h)||[]}var WA=hr(function(c,h){try{return Bn(c,r,h)}catch(w){return Ny(w)?w:new tr(w)}}),Ase=Wo(function(c,h){return ss(h,function(w){w=so(w),zo(c,w,Dy(c[w],c))}),c});function Pse(c){var h=c==null?0:c.length,w=qt();return c=h?Xr(c,function(L){if(typeof L[1]!="function")throw new os(o);return[w(L[0]),L[1]]}):[],hr(function(L){for(var W=-1;++W_)return[];var w=M,L=ei(c,M);h=qt(h),c-=M;for(var W=Gb(L,h);++w0||h<0)?new xr(w):(c<0?w=w.takeRight(-c):c&&(w=w.drop(c)),h!==r&&(h=ur(h),w=h<0?w.dropRight(-h):w.take(h-c)),w)},xr.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},xr.prototype.toArray=function(){return this.take(M)},no(xr.prototype,function(c,h){var w=/^(?:filter|find|map|reject)|While$/.test(h),L=/^(?:head|last)$/.test(h),W=re[L?"take"+(h=="last"?"Right":""):h],ne=L||/^find/.test(h);W&&(re.prototype[h]=function(){var he=this.__wrapped__,me=L?[1]:arguments,we=he instanceof xr,We=me[0],Ke=we||sr(he),Ze=function(br){var Er=W.apply(re,Ca([br],me));return L&&xt?Er[0]:Er};Ke&&w&&typeof We=="function"&&We.length!=1&&(we=Ke=!1);var xt=this.__chain__,Nt=!!this.__actions__.length,Vt=ne&&!xt,fr=we&&!Nt;if(!ne&&Ke){he=fr?he:new xr(this);var Gt=c.apply(he,me);return Gt.__actions__.push({func:qp,args:[Ze],thisArg:r}),new as(Gt,xt)}return Vt&&fr?c.apply(this,me):(Gt=this.thru(Ze),Vt?L?Gt.value()[0]:Gt.value():Gt)})}),ss(["pop","push","shift","sort","splice","unshift"],function(c){var h=pp[c],w=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",L=/^(?:pop|shift)$/.test(c);re.prototype[c]=function(){var W=arguments;if(L&&!this.__chain__){var ne=this.value();return h.apply(sr(ne)?ne:[],W)}return this[w](function(he){return h.apply(sr(he)?he:[],W)})}}),no(xr.prototype,function(c,h){var w=re[h];if(w){var L=w.name+"";Tr.call(cf,L)||(cf[L]=[]),cf[L].push({name:h,func:w})}}),cf[Lp(r,k).name]=[{name:"wrapper",func:r}],xr.prototype.clone=Eee,xr.prototype.reverse=See,xr.prototype.value=Aee,re.prototype.at=ene,re.prototype.chain=tne,re.prototype.commit=rne,re.prototype.next=nne,re.prototype.plant=sne,re.prototype.reverse=one,re.prototype.toJSON=re.prototype.valueOf=re.prototype.value=ane,re.prototype.first=re.prototype.head,bh&&(re.prototype[bh]=ine),re},sf=ree();gn?((gn.exports=sf)._=sf,Ur._=sf):_r._=sf}).call(nn)}(e0,e0.exports);var Pq=e0.exports,P1={exports:{}};(function(t,e){var r=typeof self<"u"?self:nn,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function u(f){return f&&DataView.prototype.isPrototypeOf(f)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(f){return f&&l.indexOf(Object.prototype.toString.call(f))>-1};function p(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function y(f){return typeof f!="string"&&(f=String(f)),f}function A(f){var g={next:function(){var v=f.shift();return{done:v===void 0,value:v}}};return a.iterable&&(g[Symbol.iterator]=function(){return g}),g}function P(f){this.map={},f instanceof P?f.forEach(function(g,v){this.append(v,g)},this):Array.isArray(f)?f.forEach(function(g){this.append(g[0],g[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(g){this.append(g,f[g])},this)}P.prototype.append=function(f,g){f=p(f),g=y(g);var v=this.map[f];this.map[f]=v?v+", "+g:g},P.prototype.delete=function(f){delete this.map[p(f)]},P.prototype.get=function(f){return f=p(f),this.has(f)?this.map[f]:null},P.prototype.has=function(f){return this.map.hasOwnProperty(p(f))},P.prototype.set=function(f,g){this.map[p(f)]=y(g)},P.prototype.forEach=function(f,g){for(var v in this.map)this.map.hasOwnProperty(v)&&f.call(g,this.map[v],v,this)},P.prototype.keys=function(){var f=[];return this.forEach(function(g,v){f.push(v)}),A(f)},P.prototype.values=function(){var f=[];return this.forEach(function(g){f.push(g)}),A(f)},P.prototype.entries=function(){var f=[];return this.forEach(function(g,v){f.push([v,g])}),A(f)},a.iterable&&(P.prototype[Symbol.iterator]=P.prototype.entries);function N(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function D(f){return new Promise(function(g,v){f.onload=function(){g(f.result)},f.onerror=function(){v(f.error)}})}function k(f){var g=new FileReader,v=D(g);return g.readAsArrayBuffer(f),v}function B(f){var g=new FileReader,v=D(g);return g.readAsText(f),v}function j(f){for(var g=new Uint8Array(f),v=new Array(g.length),x=0;x-1?g:f}function z(f,g){g=g||{};var v=g.body;if(f instanceof z){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,g.headers||(this.headers=new P(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!v&&f._bodyInit!=null&&(v=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=g.credentials||this.credentials||"same-origin",(g.headers||!this.headers)&&(this.headers=new P(g.headers)),this.method=T(g.method||this.method||"GET"),this.mode=g.mode||this.mode||null,this.signal=g.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(v)}z.prototype.clone=function(){return new z(this,{body:this._bodyInit})};function ue(f){var g=new FormData;return f.trim().split("&").forEach(function(v){if(v){var x=v.split("="),_=x.shift().replace(/\+/g," "),S=x.join("=").replace(/\+/g," ");g.append(decodeURIComponent(_),decodeURIComponent(S))}}),g}function _e(f){var g=new P,v=f.replace(/\r?\n[\t ]+/g," ");return v.split(/\r?\n/).forEach(function(x){var _=x.split(":"),S=_.shift().trim();if(S){var b=_.join(":").trim();g.append(S,b)}}),g}K.call(z.prototype);function G(f,g){g||(g={}),this.type="default",this.status=g.status===void 0?200:g.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in g?g.statusText:"OK",this.headers=new P(g.headers),this.url=g.url||"",this._initBody(f)}K.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new P(this.headers),url:this.url})},G.error=function(){var f=new G(null,{status:0,statusText:""});return f.type="error",f};var E=[301,302,303,307,308];G.redirect=function(f,g){if(E.indexOf(g)===-1)throw new RangeError("Invalid status code");return new G(null,{status:g,headers:{location:f}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(g,v){this.message=g,this.name=v;var x=Error(g);this.stack=x.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function m(f,g){return new Promise(function(v,x){var _=new z(f,g);if(_.signal&&_.signal.aborted)return x(new o.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function b(){S.abort()}S.onload=function(){var M={status:S.status,statusText:S.statusText,headers:_e(S.getAllResponseHeaders()||"")};M.url="responseURL"in S?S.responseURL:M.headers.get("X-Request-URL");var I="response"in S?S.response:S.responseText;v(new G(I,M))},S.onerror=function(){x(new TypeError("Network request failed"))},S.ontimeout=function(){x(new TypeError("Network request failed"))},S.onabort=function(){x(new o.DOMException("Aborted","AbortError"))},S.open(_.method,_.url,!0),_.credentials==="include"?S.withCredentials=!0:_.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&a.blob&&(S.responseType="blob"),_.headers.forEach(function(M,I){S.setRequestHeader(I,M)}),_.signal&&(_.signal.addEventListener("abort",b),S.onreadystatechange=function(){S.readyState===4&&_.signal.removeEventListener("abort",b)}),S.send(typeof _._bodyInit>"u"?null:_._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=P,s.Request=z,s.Response=G),o.Headers=P,o.Request=z,o.Response=G,o.fetch=m,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(P1,P1.exports);var Mq=P1.exports;const R6=ji(Mq);var Iq=Object.defineProperty,Cq=Object.defineProperties,Tq=Object.getOwnPropertyDescriptors,D6=Object.getOwnPropertySymbols,Rq=Object.prototype.hasOwnProperty,Dq=Object.prototype.propertyIsEnumerable,O6=(t,e,r)=>e in t?Iq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,N6=(t,e)=>{for(var r in e||(e={}))Rq.call(e,r)&&O6(t,r,e[r]);if(D6)for(var r of D6(e))Dq.call(e,r)&&O6(t,r,e[r]);return t},L6=(t,e)=>Cq(t,Tq(e));const Oq={Accept:"application/json","Content-Type":"application/json"},Nq="POST",k6={headers:Oq,method:Nq},B6=10;let xs=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new qi.EventEmitter,this.isAvailable=!1,this.registering=!1,!k_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=mo(e),n=await(await R6(this.url,L6(N6({},k6),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!k_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=mo({id:1,jsonrpc:"2.0",method:"test",params:[]});await R6(e,L6(N6({},k6),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ka(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return R_(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>B6&&this.events.setMaxListeners(B6)}};const $6="error",Lq="wss://relay.walletconnect.org",kq="wc",Bq="universal_provider",F6=`${kq}@2:${Bq}:`,j6="https://rpc.walletconnect.org/v1/",Iu="generic",$q=`${j6}bundler`,Qi={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Fq=Object.defineProperty,jq=Object.defineProperties,Uq=Object.getOwnPropertyDescriptors,U6=Object.getOwnPropertySymbols,qq=Object.prototype.hasOwnProperty,zq=Object.prototype.propertyIsEnumerable,q6=(t,e,r)=>e in t?Fq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,t0=(t,e)=>{for(var r in e||(e={}))qq.call(e,r)&&q6(t,r,e[r]);if(U6)for(var r of U6(e))zq.call(e,r)&&q6(t,r,e[r]);return t},Hq=(t,e)=>jq(t,Uq(e));function Di(t,e,r){var n;const i=Eu(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${j6}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function fc(t){return t.includes(":")?t.split(":")[1]:t}function z6(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Wq(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function M1(t={},e={}){const r=H6(t),n=H6(e);return Pq.merge(r,n)}function H6(t){var e,r,n,i;const s={};if(!Sl(t))return s;for(const[o,a]of Object.entries(t)){const u=f1(o)?[o]:a.chains,l=a.methods||[],d=a.events||[],p=a.rpcMap||{},y=El(o);s[y]=Hq(t0(t0({},s[y]),a),{chains:Ud(u,(e=s[y])==null?void 0:e.chains),methods:Ud(l,(r=s[y])==null?void 0:r.methods),events:Ud(d,(n=s[y])==null?void 0:n.events),rpcMap:t0(t0({},p),(i=s[y])==null?void 0:i.rpcMap)})}return s}function Kq(t){return t.includes(":")?t.split(":")[2]:t}function W6(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=f1(r)?[r]:n.chains?n.chains:z6(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function I1(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const K6={},Ar=t=>K6[t],C1=(t,e)=>{K6[t]=e};class Vq{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}var Gq=Object.defineProperty,Yq=Object.defineProperties,Jq=Object.getOwnPropertyDescriptors,V6=Object.getOwnPropertySymbols,Xq=Object.prototype.hasOwnProperty,Zq=Object.prototype.propertyIsEnumerable,G6=(t,e,r)=>e in t?Gq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Y6=(t,e)=>{for(var r in e||(e={}))Xq.call(e,r)&&G6(t,r,e[r]);if(V6)for(var r of V6(e))Zq.call(e,r)&&G6(t,r,e[r]);return t},J6=(t,e)=>Yq(t,Jq(e));class Qq{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(fc(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const u=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:J6(Y6({},o.sessionProperties||{}),{capabilities:J6(Y6({},a||{}),{[s]:u})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return u}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(da("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${$q}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class ez{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}let tz=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}},rz=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ji(new xs(n,Ar("disableProviderPing")))}},nz=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=fc(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}},iz=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}};class sz{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}let oz=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new xs(n,Ar("disableProviderPing")))}};class az{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new xs(n))}}class cz{constructor(e){this.name=Iu,this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=Eu(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}var uz=Object.defineProperty,fz=Object.defineProperties,lz=Object.getOwnPropertyDescriptors,X6=Object.getOwnPropertySymbols,hz=Object.prototype.hasOwnProperty,dz=Object.prototype.propertyIsEnumerable,Z6=(t,e,r)=>e in t?uz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,r0=(t,e)=>{for(var r in e||(e={}))hz.call(e,r)&&Z6(t,r,e[r]);if(X6)for(var r of X6(e))dz.call(e,r)&&Z6(t,r,e[r]);return t},T1=(t,e)=>fz(t,lz(e));let Q6=class YA{constructor(e){this.events=new Yg,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||$6})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new YA(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:r0({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,Vd(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Dr("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=W6(this.session.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=W6(s.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==I6)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Iu?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(ic(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await A1.init({core:this.providerOpts.core,logger:this.providerOpts.logger||$6,relayUrl:this.providerOpts.relayUrl||Lq,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>El(r)))];C1("client",this.client),C1("events",this.events),C1("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Wq(r,this.session),i=z6(n),s=M1(this.namespaces,this.optionalNamespaces),o=T1(r0({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new Qq({namespace:o});break;case"algorand":this.rpcProviders[r]=new rz({namespace:o});break;case"solana":this.rpcProviders[r]=new ez({namespace:o});break;case"cosmos":this.rpcProviders[r]=new tz({namespace:o});break;case"polkadot":this.rpcProviders[r]=new Vq({namespace:o});break;case"cip34":this.rpcProviders[r]=new nz({namespace:o});break;case"elrond":this.rpcProviders[r]=new iz({namespace:o});break;case"multiversx":this.rpcProviders[r]=new sz({namespace:o});break;case"near":this.rpcProviders[r]=new oz({namespace:o});break;case"tezos":this.rpcProviders[r]=new az({namespace:o});break;default:this.rpcProviders[Iu]?this.rpcProviders[Iu].updateNamespace(o):this.rpcProviders[Iu]=new cz({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&ic(i)&&this.events.emit("accountsChanged",i.map(Kq))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=El(i),a=I1(i)!==I1(s)?`${o}:${I1(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=T1(r0({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",T1(r0({},Dr("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Qi.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Iu]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>El(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=El(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${F6}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${F6}/${e}`)}};const pz=Q6;function gz(){return new Promise(t=>{const e=[];let r;window.addEventListener("eip6963:announceProvider",n=>{const{detail:i}=n;r&&clearTimeout(r),e.push(i),r=setTimeout(()=>t(e),200)}),r=setTimeout(()=>t(e),200),window.dispatchEvent(new Event("eip6963:requestProvider"))})}class Ys{constructor(e,r){this.scope=e,this.module=r}storeObject(e,r){this.setItem(e,JSON.stringify(r))}loadObject(e){const r=this.getItem(e);return r?JSON.parse(r):void 0}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new Ys("CBWSDK").clear(),new Ys("walletlink").clear()}}const cn={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},R1={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},e5="Unspecified error message.",mz="Unspecified server error.";function D1(t,e=e5){if(t&&Number.isInteger(t)){const r=t.toString();if(O1(R1,r))return R1[r].message;if(t5(t))return mz}return e}function vz(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(R1[e]||t5(t))}function bz(t,{shouldIncludeStack:e=!1}={}){const r={};if(t&&typeof t=="object"&&!Array.isArray(t)&&O1(t,"code")&&vz(t.code)){const n=t;r.code=n.code,n.message&&typeof n.message=="string"?(r.message=n.message,O1(n,"data")&&(r.data=n.data)):(r.message=D1(r.code),r.data={originalError:r5(t)})}else r.code=cn.rpc.internal,r.message=n5(t,"message")?t.message:e5,r.data={originalError:r5(t)};return e&&(r.stack=n5(t,"stack")?t.stack:void 0),r}function t5(t){return t>=-32099&&t<=-32e3}function r5(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function O1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function n5(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const Sr={rpc:{parse:t=>es(cn.rpc.parse,t),invalidRequest:t=>es(cn.rpc.invalidRequest,t),invalidParams:t=>es(cn.rpc.invalidParams,t),methodNotFound:t=>es(cn.rpc.methodNotFound,t),internal:t=>es(cn.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return es(e,t)},invalidInput:t=>es(cn.rpc.invalidInput,t),resourceNotFound:t=>es(cn.rpc.resourceNotFound,t),resourceUnavailable:t=>es(cn.rpc.resourceUnavailable,t),transactionRejected:t=>es(cn.rpc.transactionRejected,t),methodNotSupported:t=>es(cn.rpc.methodNotSupported,t),limitExceeded:t=>es(cn.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Cu(cn.provider.userRejectedRequest,t),unauthorized:t=>Cu(cn.provider.unauthorized,t),unsupportedMethod:t=>Cu(cn.provider.unsupportedMethod,t),disconnected:t=>Cu(cn.provider.disconnected,t),chainDisconnected:t=>Cu(cn.provider.chainDisconnected,t),unsupportedChain:t=>Cu(cn.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new o5(e,r,n)}}};function es(t,e){const[r,n]=i5(e);return new s5(t,r||D1(t),n)}function Cu(t,e){const[r,n]=i5(e);return new o5(t,r||D1(t),n)}function i5(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}class s5 extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}}class o5 extends s5{constructor(e,r,n){if(!yz(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}function yz(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function N1(){return t=>t}const Ol=N1(),wz=N1(),xz=N1();function Co(t){return Math.floor(t)}const a5=/^[0-9]*$/,c5=/^[a-f0-9]*$/;function lc(t){return L1(crypto.getRandomValues(new Uint8Array(t)))}function L1(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function n0(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function Nl(t,e=!1){const r=t.toString("hex");return Ol(e?`0x${r}`:r)}function k1(t){return Nl(F1(t),!0)}function Js(t){return xz(t.toString(10))}function pa(t){return Ol(`0x${BigInt(t).toString(16)}`)}function u5(t){return t.startsWith("0x")||t.startsWith("0X")}function B1(t){return u5(t)?t.slice(2):t}function f5(t){return u5(t)?`0x${t.slice(2)}`:`0x${t}`}function i0(t){if(typeof t!="string")return!1;const e=B1(t).toLowerCase();return c5.test(e)}function _z(t,e=!1){if(typeof t=="string"){const r=B1(t).toLowerCase();if(c5.test(r))return Ol(e?`0x${r}`:r)}throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function $1(t,e=!1){let r=_z(t,!1);return r.length%2===1&&(r=Ol(`0${r}`)),e?Ol(`0x${r}`):r}function ga(t){if(typeof t=="string"){const e=B1(t).toLowerCase();if(i0(e)&&e.length===40)return wz(f5(e))}throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function F1(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(i0(t)){const e=$1(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Sr.rpc.invalidParams(`Not binary data: ${String(t)}`)}function Ll(t){if(typeof t=="number"&&Number.isInteger(t))return Co(t);if(typeof t=="string"){if(a5.test(t))return Co(Number(t));if(i0(t))return Co(Number(BigInt($1(t,!0))))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function kl(t){if(t!==null&&(typeof t=="bigint"||Sz(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(Ll(t));if(typeof t=="string"){if(a5.test(t))return BigInt(t);if(i0(t))return BigInt($1(t,!0))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function Ez(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Sr.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function Sz(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function Az(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function Pz(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Mz(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,new TextEncoder().encode(e));return{iv:r,cipherText:n}}async function Iz(t,{iv:e,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return new TextDecoder().decode(n)}function l5(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function h5(t,e){const r=l5(t),n=await crypto.subtle.exportKey(r,e);return L1(new Uint8Array(n))}async function d5(t,e){const r=l5(t),n=n0(e).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function Cz(t,e){const r=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return Mz(e,r)}async function Tz(t,e){return JSON.parse(await Iz(e,t))}const j1={storageKey:"ownPrivateKey",keyType:"private"},U1={storageKey:"ownPublicKey",keyType:"public"},q1={storageKey:"peerPublicKey",keyType:"public"};class Rz{constructor(){this.storage=new Ys("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(q1,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(U1.storageKey),this.storage.removeItem(j1.storageKey),this.storage.removeItem(q1.storageKey)}async generateKeyPair(){const e=await Az();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(j1,e.privateKey),await this.storeKey(U1,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(j1)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(U1)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(q1)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await Pz(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const r=this.storage.getItem(e.storageKey);return r?d5(e.keyType,r):null}async storeKey(e,r){const n=await h5(e.keyType,r);this.storage.setItem(e.storageKey,n)}}const Bl="4.2.4",p5="@coinbase/wallet-sdk";async function g5(t,e){const r=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":Bl,"X-Cbw-Sdk-Platform":p5}}),{result:i,error:s}=await n.json();if(s)throw s;return i}function Dz(){return globalThis.coinbaseWalletExtension}function Oz(){var t,e;try{const r=globalThis;return(t=r.ethereum)!==null&&t!==void 0?t:(e=r.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Nz({metadata:t,preference:e}){var r,n;const{appName:i,appLogoUrl:s,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const u=Dz();if(u)return(r=u.setAppInfo)===null||r===void 0||r.call(u,i,s,o,e),u}const a=Oz();if(a!=null&&a.isCoinbaseBrowser)return(n=a.setAppInfo)===null||n===void 0||n.call(a,i,s,o,e),a}function Lz(t){if(!t||typeof t!="object"||Array.isArray(t))throw Sr.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:r}=t;if(typeof e!="string"||e.length===0)throw Sr.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Sr.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw Sr.provider.unsupportedMethod()}}const m5="accounts",v5="activeChain",b5="availableChains",y5="walletCapabilities";class kz{constructor(e){var r,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new Rz,this.storage=new Ys("CBWSDK","SCWStateManager"),this.accounts=(r=this.storage.loadObject(m5))!==null&&r!==void 0?r:[],this.chain=this.storage.loadObject(v5)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var r,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(r=e.params)!==null&&r!==void 0?r:{})}}),s=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in s.content)throw s.content.failure;const o=await d5("public",s.sender);await this.keyManager.setPeerPublicKey(o);const u=(await this.decryptResponseMessage(s)).result;if("error"in u)throw u.error;const l=u.value;this.accounts=l,this.storage.storeObject(m5,l),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",l)}async request(e){var r;if(this.accounts.length===0)throw Sr.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:pa(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return pa(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(y5);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var r,n;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const i=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(i)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,r;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(r=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&r!==void 0?r:1}}async handleSwitchChainRequest(e){var r;const n=e.params;if(!n||!(!((r=n[0])===null||r===void 0)&&r.chainId))throw Sr.rpc.invalidParams();const i=Ll(n[0].chainId);if(this.updateChain(i))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(i),o}async sendEncryptedRequest(e){const r=await this.keyManager.getSharedSecret();if(!r)throw Sr.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await Cz({action:e,chainId:this.chain.id},r),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const r=await h5("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:r,content:e,timestamp:new Date}}async decryptResponseMessage(e){var r,n;const i=e.content;if("failure"in i)throw i.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw Sr.provider.unauthorized("Invalid session");const o=await Tz(i.encrypted,s),a=(r=o.data)===null||r===void 0?void 0:r.chains;if(a){const l=Object.entries(a).map(([d,p])=>({id:Number(d),rpcUrl:p}));this.storage.storeObject(b5,l),this.updateChain(this.chain.id,l)}const u=(n=o.data)===null||n===void 0?void 0:n.capabilities;return u&&this.storage.storeObject(y5,u),o}updateChain(e,r){var n;const i=r??this.storage.loadObject(b5),s=i==null?void 0:i.find(o=>o.id===e);return s?(s!==this.chain&&(this.chain=s,this.storage.storeObject(v5,s),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",pa(s.id))),!0):!1}}const Bz=Jp(tM),{keccak_256:$z}=Bz;function w5(t){return Buffer.allocUnsafe(t).fill(0)}function Fz(t){return t.toString(2).length}function x5(t,e){let r=t.toString(16);r.length%2!==0&&(r="0"+r);const n=r.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(r=I5(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(Xs(t,e[s]));if(r==="dynamic"){var o=Xs("uint256",e.length);i.unshift(o)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([Xs("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,si.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Tu(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return si.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Tu(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=hc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+a);if(n<0)throw new Error("Supplied uint is negative");return si.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(r=Tu(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=hc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied int exceeds width: "+r+" vs "+a);const u=si.twosFromBigInt(n,256);return si.bufferBEFromBigInt(u,32)}else if(t.startsWith("ufixed")){if(r=M5(t),n=hc(e),n<0)throw new Error("Supplied ufixed is negative");return Xs("uint256",n*BigInt(2)**BigInt(r[1]))}else if(t.startsWith("fixed"))return r=M5(t),Xs("int256",hc(e)*BigInt(2)**BigInt(r[1]))}throw new Error("Unsupported or invalid type: "+t)}function Wz(t){return t==="string"||t==="bytes"||I5(t)==="dynamic"}function Kz(t){return t.lastIndexOf("]")===t.length-1}function Vz(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var o=P5(t[s]),a=e[s],u=Xs(o,a);Wz(o)?(r.push(Xs("uint256",i)),n.push(u),i+=u.length):r.push(u)}return Buffer.concat(r.concat(n))}function C5(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(si.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=Tu(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=hc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+u);i.push(si.bufferBEFromBigInt(n,r/8))}else if(o.startsWith("int")){if(r=Tu(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=hc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied int exceeds width: "+r+" vs "+u);const l=si.twosFromBigInt(n,r);i.push(si.bufferBEFromBigInt(l,r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function Gz(t,e){return si.keccak(C5(t,e))}var Yz={rawEncode:Vz,solidityPack:C5,soliditySHA3:Gz};const _s=A5,$l=Yz,T5={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},z1={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const o=(a,u,l)=>{if(r[u]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":_s.keccak(this.encodeData(u,l,r,n))];if(l===void 0)throw new Error(`missing value for field ${a} of type ${u}`);if(u==="bytes")return["bytes32",_s.keccak(l)];if(u==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",_s.keccak(l)];if(u.lastIndexOf("]")===u.length-1){const d=u.slice(0,u.lastIndexOf("[")),p=l.map(y=>o(a,d,y));return["bytes32",_s.keccak($l.rawEncode(p.map(([y])=>y),p.map(([,y])=>y)))]}return[u,l]};for(const a of r[t]){const[u,l]=o(a.name,a.type,e[a.name]);i.push(u),s.push(l)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=_s.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=_s.keccak(a),s.push(a);else if(r[o.type]!==void 0)i.push("bytes32"),a=_s.keccak(this.encodeData(o.type,a,r,n)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return $l.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return _s.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return _s.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in T5.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),_s.keccak(Buffer.concat(n))}};var Jz={TYPED_MESSAGE_SCHEMA:T5,TypedDataUtils:z1,hashForSignTypedDataLegacy:function(t){return Xz(t.data)},hashForSignTypedData_v3:function(t){return z1.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return z1.hash(t.data)}};function Xz(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?_s.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return $l.soliditySHA3(["bytes32","bytes32"],[$l.soliditySHA3(new Array(t.length).fill("string"),i),$l.soliditySHA3(n,r)])}const o0=ji(Jz),Zz="walletUsername",H1="Addresses",Qz="AppVersion";function Hn(t){return t.errorMessage!==void 0}class eH{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),a=16,u=o.slice(o.byteLength-a),l=o.slice(0,o.byteLength-a),d=new Uint8Array(u),p=new Uint8Array(l),y=new Uint8Array([...n,...d,...p]);return L1(y)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=n0(e),a=o.slice(0,12),u=o.slice(12,28),l=o.slice(28),d=new Uint8Array([...l,...u]),p={name:"AES-GCM",iv:new Uint8Array(a)};try{const y=await window.crypto.subtle.decrypt(p,s,d),A=new TextDecoder;n(A.decode(y))}catch(y){i(y)}})()})}}class tH{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}var To;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(To||(To={}));class rH{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,To.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.DISCONNECTED)},i.onopen=s=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(u=>this.sendData(u)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const u=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,u)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,To.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const R5=1e4,nH=6e4;class iH{constructor({session:e,linkAPIUrl:r,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Co(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,u)=>{const l=s[u];l!==void 0&&a(l)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,u)},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(Zz,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(Qz,s)},this.handleChainUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(s),l=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(u,l)},this.session=e,this.cipher=new eH(e.secret),this.listener=n;const i=new rH(`${r}/rpc`,WebSocket);i.setConnectionStateListener(async s=>{let o=!1;switch(s){case To.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(u=>setTimeout(u,5e3)),this.destroyed||i.connect().catch(()=>{a()})};a()}break;case To.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},R5),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case To.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(s=>{var o;switch(s.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=s.type==="IsLinkedOK"?s.linked:void 0;this.linked=a||s.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(s.metadata);break}case"Event":{this.handleIncomingEvent(s);break}}s.id!==void 0&&((o=this.requestResolutions.get(s.id))===null||o===void 0||o(s))}),this.ws=i,this.http=new tH(r,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:s,response:o}=i;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s,o)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Co(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>R5*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r={timeout:nH}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r.timeout)}),new Promise(s=>{this.requestResolutions.set(n,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Co(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Co(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id}),!0)}}class sH{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=f5(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}const D5="session:id",O5="session:secret",N5="session:linked";class Ru{constructor(e,r,n,i=!1){this.storage=e,this.id=r,this.secret=n,this.key=NP(Pg(`${r}, ${n} WalletLink`)),this._linked=!!i}static create(e){const r=lc(16),n=lc(32);return new Ru(e,r,n).save()}static load(e){const r=e.getItem(D5),n=e.getItem(N5),i=e.getItem(O5);return r&&i?new Ru(e,r,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(D5,this.id),this.storage.setItem(O5,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(N5,this._linked?"1":"0")}}function oH(){try{return window.frameElement!==null}catch{return!1}}function aH(){try{return oH()&&window.top?window.top.location:window.location}catch{return window.location}}function cH(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function L5(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const uH='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function k5(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(uH)),document.documentElement.appendChild(t)}function B5(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e2&&(o.children=arguments.length>3?a0.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return c0(t,o,n,i,null)}function c0(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++$5,__i:-1,__u:0};return i==null&&Vr.vnode!=null&&Vr.vnode(s),s}function Ul(t){return t.children}function u0(t,e){this.props=t,this.context=e}function Du(t,e){if(e==null)return t.__?Du(t.__,t.__i+1):null;for(var r;ee&&dc.sort(W1));f0.__r=0}function W5(t,e,r,n,i,s,o,a,u,l,d){var p,y,A,P,N,D,k=n&&n.__k||q5,B=e.length;for(u=lH(r,e,k,u),p=0;p0?c0(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,(u=s.__i=hH(s,r,a,p))!==-1&&(p--,(o=r[u])&&(o.__u|=2)),o==null||o.__v===null?(u==-1&&y--,typeof s.type!="function"&&(s.__u|=4)):u!==a&&(u==a-1?y--:u==a+1?y++:(u>a?y--:y++,s.__u|=4))):s=t.__k[i]=null;if(p)for(i=0;i(u!=null&&!(2&u.__u)?1:0))for(;o>=0||a=0){if((u=e[o])&&!(2&u.__u)&&i==u.key&&s===u.type)return o;o--}if(a=r.__.length&&r.__.push({}),r.__[t]}function o4(t){return tv=1,gH(c4,t)}function gH(t,e,r){var n=s4(h0++,2);if(n.t=t,!n.__c&&(n.__=[c4(void 0,e),function(a){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,a);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=un,!un.u)){var i=function(a,u,l){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(y){return!!y.__c});if(d.every(function(y){return!y.__N}))return!s||s.call(this,a,u,l);var p=n.__c.props!==a;return d.forEach(function(y){if(y.__N){var A=y.__[0];y.__=y.__N,y.__N=void 0,A!==y.__[0]&&(p=!0)}}),s&&s.call(this,a,u,l)||p};un.u=!0;var s=un.shouldComponentUpdate,o=un.componentWillUpdate;un.componentWillUpdate=function(a,u,l){if(this.__e){var d=s;s=void 0,i(a,u,l),s=d}o&&o.call(this,a,u,l)},un.shouldComponentUpdate=i}return n.__N||n.__}function mH(t,e){var r=s4(h0++,3);!yn.__s&&yH(r.__H,e)&&(r.__=t,r.i=e,un.__H.__h.push(r))}function vH(){for(var t;t=Z5.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(d0),t.__H.__h.forEach(rv),t.__H.__h=[]}catch(e){t.__H.__h=[],yn.__e(e,t.__v)}}yn.__b=function(t){un=null,Q5&&Q5(t)},yn.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),i4&&i4(t,e)},yn.__r=function(t){e4&&e4(t),h0=0;var e=(un=t.__c).__H;e&&(ev===un?(e.__h=[],un.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(d0),e.__h.forEach(rv),e.__h=[],h0=0)),ev=un},yn.diffed=function(t){t4&&t4(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Z5.push(e)!==1&&X5===yn.requestAnimationFrame||((X5=yn.requestAnimationFrame)||bH)(vH)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),ev=un=null},yn.__c=function(t,e){e.some(function(r){try{r.__h.forEach(d0),r.__h=r.__h.filter(function(n){return!n.__||rv(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],yn.__e(n,r.__v)}}),r4&&r4(t,e)},yn.unmount=function(t){n4&&n4(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{d0(n)}catch(i){e=i}}),r.__H=void 0,e&&yn.__e(e,r.__v))};var a4=typeof requestAnimationFrame=="function";function bH(t){var e,r=function(){clearTimeout(n),a4&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);a4&&(e=requestAnimationFrame(r))}function d0(t){var e=un,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),un=e}function rv(t){var e=un;t.__c=t.__(),un=e}function yH(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function c4(t,e){return typeof e=="function"?e(t):e}const wH=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",xH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",_H="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class EH{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=L5()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const r=this.nextItemKey++;return this.items.set(r,e),this.render(),()=>{this.items.delete(r),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&Q1(Or("div",null,Or(u4,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,r])=>Or(SH,Object.assign({},r,{key:e}))))),this.root)}}const u4=t=>Or("div",{class:Fl("-cbwsdk-snackbar-container")},Or("style",null,wH),Or("div",{class:"-cbwsdk-snackbar"},t.children)),SH=({autoExpand:t,message:e,menuItems:r})=>{const[n,i]=o4(!0),[s,o]=o4(t??!1);mH(()=>{const u=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{u.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return Or("div",{class:Fl("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},Or("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},Or("img",{src:xH,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",Or("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),Or("div",{class:"-gear-container"},!s&&Or("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),Or("img",{src:_H,class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&Or("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((u,l)=>Or("div",{class:Fl("-cbwsdk-snackbar-instance-menu-item",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:u.onClick,key:l},Or("svg",{width:u.svgWidth,height:u.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("path",{"fill-rule":u.defaultFillRule,"clip-rule":u.defaultClipRule,d:u.path,fill:"#AAAAAA"})),Or("span",{class:Fl("-cbwsdk-snackbar-instance-menu-item-info",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},u.info)))))};class AH{constructor(){this.attached=!1,this.snackbar=new EH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.snackbar.attach(r),this.attached=!0,k5()}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}}const PH=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class MH{constructor(){this.root=null,this.darkMode=L5()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),k5()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(Q1(null,this.root),e&&Q1(Or(IH,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const IH=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return Or(u4,{darkMode:r},Or("div",{class:"-cbwsdk-redirect-dialog"},Or("style",null,PH),Or("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),Or("div",{class:Fl("-cbwsdk-redirect-dialog-box",s)},Or("p",null,t),Or("button",{onClick:n},e))))},CH="https://keys.coinbase.com/connect",f4="https://www.walletlink.org",TH="https://go.cb-w.com/walletlink";class l4{constructor(){this.attached=!1,this.redirectDialog=new MH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const r=new URL(TH);r.searchParams.append("redirect_url",aH().href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class Ro{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=cH(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(H1);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!u&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),Ro.accountRequestCallbackIds.size>0&&(Array.from(Ro.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),Ro.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new sH,this.ui=n,this.ui.attach()}subscribe(){const e=Ru.load(this.storage)||Ru.create(this.storage),{linkAPIUrl:r}=this,n=new iH({session:e,linkAPIUrl:r,listener:this}),i=this.isMobileWeb?new l4:new AH;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=Ru.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Ys.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?Js(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?Js(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Nl(e,!0),chainId:r}})}getWalletLinkSession(){return this._session}sendRequest(e){let r=null;const n=lc(8),i=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,s),r==null||r()};return new Promise((s,o)=>{r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,a=>{if(r==null||r(),Hn(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,r){const n={type:"WEB3_REQUEST",id:e,request:r};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:r.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(r.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof l4)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e,r){if(r.method==="requestEthereumAccounts"){Ro.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,r)),Ro.accountRequestCallbackIds.clear();return}this.invokeCallback(e,r)}handleErrorResponse(e,r,n){var i;const s=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:r,errorMessage:s})}invokeCallback(e,r){const n=this.relayEventManager.callbacks.get(e);n&&(n(r),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:r}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:r}},i=lc(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(Hn(a))return o(new Error(a.errorMessage));s(a)}),Ro.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,r,n,i,s,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:o}};let u=null;const l=lc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));p(A)}),this.publishWeb3RequestEvent(l,a)})}addEthereumChain(e,r,n,i,s,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:o}};let u=null;const l=lc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));p(A)}),this.publishWeb3RequestEvent(l,a)})}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})};let i=null;const s=lc(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,u)=>{this.relayEventManager.callbacks.set(s,l=>{if(i==null||i(),Hn(l)&&l.errorCode)return u(Sr.provider.custom({code:l.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(Hn(l))return u(new Error(l.errorMessage));a(l)}),this.publishWeb3RequestEvent(s,n)})}}Ro.accountRequestCallbackIds=new Set;const h4="DefaultChainId",d4="DefaultJsonRpcUrl";class p4{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new Ys("walletlink",f4),this.callback=e.callback||null;const r=this._storage.getItem(H1);if(r){const n=r.split(" ");n[0]!==""&&(this._addresses=n.map(i=>ga(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:r,secret:n}=e.getWalletLinkSession();return{id:r,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(d4))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(d4,e)}updateProviderInfo(e,r){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(h4,r.toString(10)),Ll(r)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",pa(r)))}async watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw Sr.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw Sr.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw Sr.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw Sr.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=r.options,l=await this.initializeRelay().watchAsset(r.type,i,s,a,o,n==null?void 0:n.toString());return Hn(l)?!1:!!l.result}async addEthereumChain(e){var r,n;const i=e[0];if(((r=i.rpcUrls)===null||r===void 0?void 0:r.length)===0)throw Sr.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw Sr.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw Sr.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:u=[],chainName:l,iconUrls:d=[],nativeCurrency:p}=i,y=await o.addEthereumChain(s.toString(),a,d,u,l,p);if(Hn(y))return!1;if(((n=y.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw Sr.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const r=e[0],n=Number.parseInt(r.chainId,16),s=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(Hn(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,r){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(s=>ga(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(H1,i.join(" ")))}async request(e){const r=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return pa(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(r);case"wallet_switchEthereumChain":return this.switchEthereumChain(r);case"wallet_watchAsset":return this.watchAsset(r);default:if(!this.jsonRpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const r=ga(e);if(!this._addresses.map(i=>ga(i)).includes(r))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?ga(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?ga(e.to):null,i=e.value!=null?kl(e.value):BigInt(0),s=e.data?F1(e.data):Buffer.alloc(0),o=e.nonce!=null?Ll(e.nonce):null,a=e.gasPrice!=null?kl(e.gasPrice):null,u=e.maxFeePerGas!=null?kl(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?kl(e.maxPriorityFeePerGas):null,d=e.gas!=null?kl(e.gas):null,p=e.chainId?Ll(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:u,maxPriorityFeePerGas:l,gasLimit:d,chainId:p}}async ecRecover(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:k1(n[0]),signature:k1(n[1]),addPrefix:r==="personal_ecRecover"}});if(Hn(s))throw s;return s.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(h4))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,r;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:pa(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(Hn(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:pa(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw Sr.rpc.invalidParams();const r=e[1],n=e[0];this._ensureKnownAddress(r);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ga(r),message:k1(n),addPrefix:!0,typedDataJson:null}});if(Hn(s))throw s;return s.result}async _eth_signTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(r);if(Hn(i))throw i;return i.result}async _eth_sendRawTransaction(e){const r=F1(e[0]),i=await this.initializeRelay().submitEthereumTransaction(r,this.getChainId());if(Hn(i))throw i;return i.result}async _eth_sendTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(r);if(Hn(i))throw i;return i.result}async signTypedData(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const i=l=>{const d={eth_signTypedData_v1:o0.hashForSignTypedDataLegacy,eth_signTypedData_v3:o0.hashForSignTypedData_v3,eth_signTypedData_v4:o0.hashForSignTypedData_v4,eth_signTypedData:o0.hashForSignTypedData_v4};return Nl(d[r]({data:Ez(l)}),!0)},s=n[r==="eth_signTypedData_v1"?1:0],o=n[r==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const u=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ga(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(Hn(u))throw u;return u.result}initializeRelay(){return this._relay||(this._relay=new Ro({linkAPIUrl:f4,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const g4="SignerType",m4=new Ys("CBWSDK","SignerConfigurator");function RH(){return m4.getItem(g4)}function DH(t){m4.setItem(g4,t)}async function OH(t){const{communicator:e,metadata:r,handshakeRequest:n,callback:i}=t;LH(e,r,i).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:o}=await e.postRequestAndWaitForResponse(s);return o}function NH(t){const{signerType:e,metadata:r,communicator:n,callback:i}=t;switch(e){case"scw":return new kz({metadata:r,callback:i,communicator:n});case"walletlink":return new p4({metadata:r,callback:i})}}async function LH(t,e,r){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new p4({metadata:e,callback:r});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const kH=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. +}`;var fr=WA(function(){return Mr(ne,Nt+"return "+Ze).apply(r,he)});if(fr.source=Ze,Ly(fr))throw fr;return fr}function vse(c){return Cr(c).toLowerCase()}function bse(c){return Cr(c).toUpperCase()}function yse(c,h,w){if(c=Cr(c),c&&(w||h===r))return e9(c);if(!c||!(h=ki(h)))return c;var L=Ms(c),W=Ms(h),ne=t9(L,W),he=r9(L,W)+1;return La(L,ne,he).join("")}function wse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.slice(0,i9(c)+1);if(!c||!(h=ki(h)))return c;var L=Ms(c),W=r9(L,Ms(h))+1;return La(L,0,W).join("")}function xse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.replace($,"");if(!c||!(h=ki(h)))return c;var L=Ms(c),W=t9(L,Ms(h));return La(L,W).join("")}function _se(c,h){var w=_e,L=G;if(Qr(h)){var W="separator"in h?h.separator:W;w="length"in h?ur(h.length):w,L="omission"in h?ki(h.omission):L}c=Cr(c);var ne=c.length;if(rf(c)){var he=Ms(c);ne=he.length}if(w>=ne)return c;var me=w-nf(L);if(me<1)return L;var we=he?La(he,0,me).join(""):c.slice(0,me);if(W===r)return we+L;if(he&&(me+=we.length-me),ky(W)){if(c.slice(me).search(W)){var We,Ke=we;for(W.global||(W=Zb(W.source,Cr(Re.exec(W))+"g")),W.lastIndex=0;We=W.exec(Ke);)var Ze=We.index;we=we.slice(0,Ze===r?me:Ze)}}else if(c.indexOf(ki(W),me)!=me){var xt=we.lastIndexOf(W);xt>-1&&(we=we.slice(0,xt))}return we+L}function Ese(c){return c=Cr(c),c&&Bt.test(c)?c.replace(Xt,ZQ):c}var Sse=lf(function(c,h,w){return c+(w?" ":"")+h.toUpperCase()}),Fy=K9("toUpperCase");function HA(c,h,w){return c=Cr(c),h=w?r:h,h===r?VQ(c)?tee(c):$Q(c):c.match(h)||[]}var WA=hr(function(c,h){try{return Bn(c,r,h)}catch(w){return Ly(w)?w:new tr(w)}}),Ase=Wo(function(c,h){return ss(h,function(w){w=so(w),zo(c,w,Oy(c[w],c))}),c});function Pse(c){var h=c==null?0:c.length,w=qt();return c=h?Xr(c,function(L){if(typeof L[1]!="function")throw new os(o);return[w(L[0]),L[1]]}):[],hr(function(L){for(var W=-1;++W_)return[];var w=M,L=ei(c,M);h=qt(h),c-=M;for(var W=Yb(L,h);++w0||h<0)?new xr(w):(c<0?w=w.takeRight(-c):c&&(w=w.drop(c)),h!==r&&(h=ur(h),w=h<0?w.dropRight(-h):w.take(h-c)),w)},xr.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},xr.prototype.toArray=function(){return this.take(M)},no(xr.prototype,function(c,h){var w=/^(?:filter|find|map|reject)|While$/.test(h),L=/^(?:head|last)$/.test(h),W=re[L?"take"+(h=="last"?"Right":""):h],ne=L||/^find/.test(h);W&&(re.prototype[h]=function(){var he=this.__wrapped__,me=L?[1]:arguments,we=he instanceof xr,We=me[0],Ke=we||sr(he),Ze=function(br){var Er=W.apply(re,Ca([br],me));return L&&xt?Er[0]:Er};Ke&&w&&typeof We=="function"&&We.length!=1&&(we=Ke=!1);var xt=this.__chain__,Nt=!!this.__actions__.length,Vt=ne&&!xt,fr=we&&!Nt;if(!ne&&Ke){he=fr?he:new xr(this);var Gt=c.apply(he,me);return Gt.__actions__.push({func:qp,args:[Ze],thisArg:r}),new as(Gt,xt)}return Vt&&fr?c.apply(this,me):(Gt=this.thru(Ze),Vt?L?Gt.value()[0]:Gt.value():Gt)})}),ss(["pop","push","shift","sort","splice","unshift"],function(c){var h=pp[c],w=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",L=/^(?:pop|shift)$/.test(c);re.prototype[c]=function(){var W=arguments;if(L&&!this.__chain__){var ne=this.value();return h.apply(sr(ne)?ne:[],W)}return this[w](function(he){return h.apply(sr(he)?he:[],W)})}}),no(xr.prototype,function(c,h){var w=re[h];if(w){var L=w.name+"";Tr.call(cf,L)||(cf[L]=[]),cf[L].push({name:h,func:w})}}),cf[Lp(r,k).name]=[{name:"wrapper",func:r}],xr.prototype.clone=Eee,xr.prototype.reverse=See,xr.prototype.value=Aee,re.prototype.at=ene,re.prototype.chain=tne,re.prototype.commit=rne,re.prototype.next=nne,re.prototype.plant=sne,re.prototype.reverse=one,re.prototype.toJSON=re.prototype.valueOf=re.prototype.value=ane,re.prototype.first=re.prototype.head,bh&&(re.prototype[bh]=ine),re},sf=ree();gn?((gn.exports=sf)._=sf,Ur._=sf):_r._=sf}).call(nn)}(e0,e0.exports);var Pq=e0.exports,P1={exports:{}};(function(t,e){var r=typeof self<"u"?self:nn,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function u(f){return f&&DataView.prototype.isPrototypeOf(f)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(f){return f&&l.indexOf(Object.prototype.toString.call(f))>-1};function p(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function y(f){return typeof f!="string"&&(f=String(f)),f}function A(f){var g={next:function(){var v=f.shift();return{done:v===void 0,value:v}}};return a.iterable&&(g[Symbol.iterator]=function(){return g}),g}function P(f){this.map={},f instanceof P?f.forEach(function(g,v){this.append(v,g)},this):Array.isArray(f)?f.forEach(function(g){this.append(g[0],g[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(g){this.append(g,f[g])},this)}P.prototype.append=function(f,g){f=p(f),g=y(g);var v=this.map[f];this.map[f]=v?v+", "+g:g},P.prototype.delete=function(f){delete this.map[p(f)]},P.prototype.get=function(f){return f=p(f),this.has(f)?this.map[f]:null},P.prototype.has=function(f){return this.map.hasOwnProperty(p(f))},P.prototype.set=function(f,g){this.map[p(f)]=y(g)},P.prototype.forEach=function(f,g){for(var v in this.map)this.map.hasOwnProperty(v)&&f.call(g,this.map[v],v,this)},P.prototype.keys=function(){var f=[];return this.forEach(function(g,v){f.push(v)}),A(f)},P.prototype.values=function(){var f=[];return this.forEach(function(g){f.push(g)}),A(f)},P.prototype.entries=function(){var f=[];return this.forEach(function(g,v){f.push([v,g])}),A(f)},a.iterable&&(P.prototype[Symbol.iterator]=P.prototype.entries);function N(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function D(f){return new Promise(function(g,v){f.onload=function(){g(f.result)},f.onerror=function(){v(f.error)}})}function k(f){var g=new FileReader,v=D(g);return g.readAsArrayBuffer(f),v}function B(f){var g=new FileReader,v=D(g);return g.readAsText(f),v}function j(f){for(var g=new Uint8Array(f),v=new Array(g.length),x=0;x-1?g:f}function z(f,g){g=g||{};var v=g.body;if(f instanceof z){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,g.headers||(this.headers=new P(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!v&&f._bodyInit!=null&&(v=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=g.credentials||this.credentials||"same-origin",(g.headers||!this.headers)&&(this.headers=new P(g.headers)),this.method=T(g.method||this.method||"GET"),this.mode=g.mode||this.mode||null,this.signal=g.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(v)}z.prototype.clone=function(){return new z(this,{body:this._bodyInit})};function ue(f){var g=new FormData;return f.trim().split("&").forEach(function(v){if(v){var x=v.split("="),_=x.shift().replace(/\+/g," "),S=x.join("=").replace(/\+/g," ");g.append(decodeURIComponent(_),decodeURIComponent(S))}}),g}function _e(f){var g=new P,v=f.replace(/\r?\n[\t ]+/g," ");return v.split(/\r?\n/).forEach(function(x){var _=x.split(":"),S=_.shift().trim();if(S){var b=_.join(":").trim();g.append(S,b)}}),g}K.call(z.prototype);function G(f,g){g||(g={}),this.type="default",this.status=g.status===void 0?200:g.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in g?g.statusText:"OK",this.headers=new P(g.headers),this.url=g.url||"",this._initBody(f)}K.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new P(this.headers),url:this.url})},G.error=function(){var f=new G(null,{status:0,statusText:""});return f.type="error",f};var E=[301,302,303,307,308];G.redirect=function(f,g){if(E.indexOf(g)===-1)throw new RangeError("Invalid status code");return new G(null,{status:g,headers:{location:f}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(g,v){this.message=g,this.name=v;var x=Error(g);this.stack=x.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function m(f,g){return new Promise(function(v,x){var _=new z(f,g);if(_.signal&&_.signal.aborted)return x(new o.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function b(){S.abort()}S.onload=function(){var M={status:S.status,statusText:S.statusText,headers:_e(S.getAllResponseHeaders()||"")};M.url="responseURL"in S?S.responseURL:M.headers.get("X-Request-URL");var I="response"in S?S.response:S.responseText;v(new G(I,M))},S.onerror=function(){x(new TypeError("Network request failed"))},S.ontimeout=function(){x(new TypeError("Network request failed"))},S.onabort=function(){x(new o.DOMException("Aborted","AbortError"))},S.open(_.method,_.url,!0),_.credentials==="include"?S.withCredentials=!0:_.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&a.blob&&(S.responseType="blob"),_.headers.forEach(function(M,I){S.setRequestHeader(I,M)}),_.signal&&(_.signal.addEventListener("abort",b),S.onreadystatechange=function(){S.readyState===4&&_.signal.removeEventListener("abort",b)}),S.send(typeof _._bodyInit>"u"?null:_._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=P,s.Request=z,s.Response=G),o.Headers=P,o.Request=z,o.Response=G,o.fetch=m,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(P1,P1.exports);var Mq=P1.exports;const D6=ji(Mq);var Iq=Object.defineProperty,Cq=Object.defineProperties,Tq=Object.getOwnPropertyDescriptors,O6=Object.getOwnPropertySymbols,Rq=Object.prototype.hasOwnProperty,Dq=Object.prototype.propertyIsEnumerable,N6=(t,e,r)=>e in t?Iq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,L6=(t,e)=>{for(var r in e||(e={}))Rq.call(e,r)&&N6(t,r,e[r]);if(O6)for(var r of O6(e))Dq.call(e,r)&&N6(t,r,e[r]);return t},k6=(t,e)=>Cq(t,Tq(e));const Oq={Accept:"application/json","Content-Type":"application/json"},Nq="POST",B6={headers:Oq,method:Nq},$6=10;let xs=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new qi.EventEmitter,this.isAvailable=!1,this.registering=!1,!B_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=mo(e),n=await(await D6(this.url,k6(L6({},B6),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!B_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=mo({id:1,jsonrpc:"2.0",method:"test",params:[]});await D6(e,k6(L6({},B6),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ka(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return D_(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>$6&&this.events.setMaxListeners($6)}};const F6="error",Lq="wss://relay.walletconnect.org",kq="wc",Bq="universal_provider",j6=`${kq}@2:${Bq}:`,U6="https://rpc.walletconnect.org/v1/",Iu="generic",$q=`${U6}bundler`,Qi={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Fq=Object.defineProperty,jq=Object.defineProperties,Uq=Object.getOwnPropertyDescriptors,q6=Object.getOwnPropertySymbols,qq=Object.prototype.hasOwnProperty,zq=Object.prototype.propertyIsEnumerable,z6=(t,e,r)=>e in t?Fq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,t0=(t,e)=>{for(var r in e||(e={}))qq.call(e,r)&&z6(t,r,e[r]);if(q6)for(var r of q6(e))zq.call(e,r)&&z6(t,r,e[r]);return t},Hq=(t,e)=>jq(t,Uq(e));function Di(t,e,r){var n;const i=Eu(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${U6}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function fc(t){return t.includes(":")?t.split(":")[1]:t}function H6(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Wq(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function M1(t={},e={}){const r=W6(t),n=W6(e);return Pq.merge(r,n)}function W6(t){var e,r,n,i;const s={};if(!Sl(t))return s;for(const[o,a]of Object.entries(t)){const u=f1(o)?[o]:a.chains,l=a.methods||[],d=a.events||[],p=a.rpcMap||{},y=El(o);s[y]=Hq(t0(t0({},s[y]),a),{chains:Ud(u,(e=s[y])==null?void 0:e.chains),methods:Ud(l,(r=s[y])==null?void 0:r.methods),events:Ud(d,(n=s[y])==null?void 0:n.events),rpcMap:t0(t0({},p),(i=s[y])==null?void 0:i.rpcMap)})}return s}function Kq(t){return t.includes(":")?t.split(":")[2]:t}function K6(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=f1(r)?[r]:n.chains?n.chains:H6(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function I1(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const V6={},Ar=t=>V6[t],C1=(t,e)=>{V6[t]=e};class Vq{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}var Gq=Object.defineProperty,Yq=Object.defineProperties,Jq=Object.getOwnPropertyDescriptors,G6=Object.getOwnPropertySymbols,Xq=Object.prototype.hasOwnProperty,Zq=Object.prototype.propertyIsEnumerable,Y6=(t,e,r)=>e in t?Gq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,J6=(t,e)=>{for(var r in e||(e={}))Xq.call(e,r)&&Y6(t,r,e[r]);if(G6)for(var r of G6(e))Zq.call(e,r)&&Y6(t,r,e[r]);return t},X6=(t,e)=>Yq(t,Jq(e));class Qq{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(fc(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const u=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:X6(J6({},o.sessionProperties||{}),{capabilities:X6(J6({},a||{}),{[s]:u})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return u}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(da("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${$q}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class ez{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}let tz=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}},rz=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ji(new xs(n,Ar("disableProviderPing")))}},nz=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=fc(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}},iz=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}};class sz{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}let oz=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new xs(n,Ar("disableProviderPing")))}};class az{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new xs(n))}}class cz{constructor(e){this.name=Iu,this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=Eu(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}var uz=Object.defineProperty,fz=Object.defineProperties,lz=Object.getOwnPropertyDescriptors,Z6=Object.getOwnPropertySymbols,hz=Object.prototype.hasOwnProperty,dz=Object.prototype.propertyIsEnumerable,Q6=(t,e,r)=>e in t?uz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,r0=(t,e)=>{for(var r in e||(e={}))hz.call(e,r)&&Q6(t,r,e[r]);if(Z6)for(var r of Z6(e))dz.call(e,r)&&Q6(t,r,e[r]);return t},T1=(t,e)=>fz(t,lz(e));let R1=class YA{constructor(e){this.events=new Yg,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||F6})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new YA(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:r0({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,Vd(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Dr("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=K6(this.session.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=K6(s.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==C6)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Iu?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(ic(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await A1.init({core:this.providerOpts.core,logger:this.providerOpts.logger||F6,relayUrl:this.providerOpts.relayUrl||Lq,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>El(r)))];C1("client",this.client),C1("events",this.events),C1("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Wq(r,this.session),i=H6(n),s=M1(this.namespaces,this.optionalNamespaces),o=T1(r0({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new Qq({namespace:o});break;case"algorand":this.rpcProviders[r]=new rz({namespace:o});break;case"solana":this.rpcProviders[r]=new ez({namespace:o});break;case"cosmos":this.rpcProviders[r]=new tz({namespace:o});break;case"polkadot":this.rpcProviders[r]=new Vq({namespace:o});break;case"cip34":this.rpcProviders[r]=new nz({namespace:o});break;case"elrond":this.rpcProviders[r]=new iz({namespace:o});break;case"multiversx":this.rpcProviders[r]=new sz({namespace:o});break;case"near":this.rpcProviders[r]=new oz({namespace:o});break;case"tezos":this.rpcProviders[r]=new az({namespace:o});break;default:this.rpcProviders[Iu]?this.rpcProviders[Iu].updateNamespace(o):this.rpcProviders[Iu]=new cz({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&ic(i)&&this.events.emit("accountsChanged",i.map(Kq))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=El(i),a=I1(i)!==I1(s)?`${o}:${I1(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=T1(r0({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",T1(r0({},Dr("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Qi.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Iu]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>El(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=El(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${j6}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${j6}/${e}`)}};const pz=R1;function gz(){return new Promise(t=>{const e=[];let r;window.addEventListener("eip6963:announceProvider",n=>{const{detail:i}=n;r&&clearTimeout(r),e.push(i),r=setTimeout(()=>t(e),200)}),r=setTimeout(()=>t(e),200),window.dispatchEvent(new Event("eip6963:requestProvider"))})}class Ys{constructor(e,r){this.scope=e,this.module=r}storeObject(e,r){this.setItem(e,JSON.stringify(r))}loadObject(e){const r=this.getItem(e);return r?JSON.parse(r):void 0}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new Ys("CBWSDK").clear(),new Ys("walletlink").clear()}}const cn={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},D1={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},e5="Unspecified error message.",mz="Unspecified server error.";function O1(t,e=e5){if(t&&Number.isInteger(t)){const r=t.toString();if(N1(D1,r))return D1[r].message;if(t5(t))return mz}return e}function vz(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(D1[e]||t5(t))}function bz(t,{shouldIncludeStack:e=!1}={}){const r={};if(t&&typeof t=="object"&&!Array.isArray(t)&&N1(t,"code")&&vz(t.code)){const n=t;r.code=n.code,n.message&&typeof n.message=="string"?(r.message=n.message,N1(n,"data")&&(r.data=n.data)):(r.message=O1(r.code),r.data={originalError:r5(t)})}else r.code=cn.rpc.internal,r.message=n5(t,"message")?t.message:e5,r.data={originalError:r5(t)};return e&&(r.stack=n5(t,"stack")?t.stack:void 0),r}function t5(t){return t>=-32099&&t<=-32e3}function r5(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function N1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function n5(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const Sr={rpc:{parse:t=>es(cn.rpc.parse,t),invalidRequest:t=>es(cn.rpc.invalidRequest,t),invalidParams:t=>es(cn.rpc.invalidParams,t),methodNotFound:t=>es(cn.rpc.methodNotFound,t),internal:t=>es(cn.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return es(e,t)},invalidInput:t=>es(cn.rpc.invalidInput,t),resourceNotFound:t=>es(cn.rpc.resourceNotFound,t),resourceUnavailable:t=>es(cn.rpc.resourceUnavailable,t),transactionRejected:t=>es(cn.rpc.transactionRejected,t),methodNotSupported:t=>es(cn.rpc.methodNotSupported,t),limitExceeded:t=>es(cn.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Cu(cn.provider.userRejectedRequest,t),unauthorized:t=>Cu(cn.provider.unauthorized,t),unsupportedMethod:t=>Cu(cn.provider.unsupportedMethod,t),disconnected:t=>Cu(cn.provider.disconnected,t),chainDisconnected:t=>Cu(cn.provider.chainDisconnected,t),unsupportedChain:t=>Cu(cn.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new o5(e,r,n)}}};function es(t,e){const[r,n]=i5(e);return new s5(t,r||O1(t),n)}function Cu(t,e){const[r,n]=i5(e);return new o5(t,r||O1(t),n)}function i5(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}class s5 extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}}class o5 extends s5{constructor(e,r,n){if(!yz(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}function yz(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function L1(){return t=>t}const Ol=L1(),wz=L1(),xz=L1();function Co(t){return Math.floor(t)}const a5=/^[0-9]*$/,c5=/^[a-f0-9]*$/;function lc(t){return k1(crypto.getRandomValues(new Uint8Array(t)))}function k1(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function n0(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function Nl(t,e=!1){const r=t.toString("hex");return Ol(e?`0x${r}`:r)}function B1(t){return Nl(j1(t),!0)}function Js(t){return xz(t.toString(10))}function pa(t){return Ol(`0x${BigInt(t).toString(16)}`)}function u5(t){return t.startsWith("0x")||t.startsWith("0X")}function $1(t){return u5(t)?t.slice(2):t}function f5(t){return u5(t)?`0x${t.slice(2)}`:`0x${t}`}function i0(t){if(typeof t!="string")return!1;const e=$1(t).toLowerCase();return c5.test(e)}function _z(t,e=!1){if(typeof t=="string"){const r=$1(t).toLowerCase();if(c5.test(r))return Ol(e?`0x${r}`:r)}throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function F1(t,e=!1){let r=_z(t,!1);return r.length%2===1&&(r=Ol(`0${r}`)),e?Ol(`0x${r}`):r}function ga(t){if(typeof t=="string"){const e=$1(t).toLowerCase();if(i0(e)&&e.length===40)return wz(f5(e))}throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function j1(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(i0(t)){const e=F1(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Sr.rpc.invalidParams(`Not binary data: ${String(t)}`)}function Ll(t){if(typeof t=="number"&&Number.isInteger(t))return Co(t);if(typeof t=="string"){if(a5.test(t))return Co(Number(t));if(i0(t))return Co(Number(BigInt(F1(t,!0))))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function kl(t){if(t!==null&&(typeof t=="bigint"||Sz(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(Ll(t));if(typeof t=="string"){if(a5.test(t))return BigInt(t);if(i0(t))return BigInt(F1(t,!0))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function Ez(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Sr.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function Sz(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function Az(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function Pz(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Mz(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,new TextEncoder().encode(e));return{iv:r,cipherText:n}}async function Iz(t,{iv:e,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return new TextDecoder().decode(n)}function l5(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function h5(t,e){const r=l5(t),n=await crypto.subtle.exportKey(r,e);return k1(new Uint8Array(n))}async function d5(t,e){const r=l5(t),n=n0(e).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function Cz(t,e){const r=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return Mz(e,r)}async function Tz(t,e){return JSON.parse(await Iz(e,t))}const U1={storageKey:"ownPrivateKey",keyType:"private"},q1={storageKey:"ownPublicKey",keyType:"public"},z1={storageKey:"peerPublicKey",keyType:"public"};class Rz{constructor(){this.storage=new Ys("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(z1,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(q1.storageKey),this.storage.removeItem(U1.storageKey),this.storage.removeItem(z1.storageKey)}async generateKeyPair(){const e=await Az();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(U1,e.privateKey),await this.storeKey(q1,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(U1)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(q1)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(z1)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await Pz(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const r=this.storage.getItem(e.storageKey);return r?d5(e.keyType,r):null}async storeKey(e,r){const n=await h5(e.keyType,r);this.storage.setItem(e.storageKey,n)}}const Bl="4.2.4",p5="@coinbase/wallet-sdk";async function g5(t,e){const r=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":Bl,"X-Cbw-Sdk-Platform":p5}}),{result:i,error:s}=await n.json();if(s)throw s;return i}function Dz(){return globalThis.coinbaseWalletExtension}function Oz(){var t,e;try{const r=globalThis;return(t=r.ethereum)!==null&&t!==void 0?t:(e=r.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Nz({metadata:t,preference:e}){var r,n;const{appName:i,appLogoUrl:s,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const u=Dz();if(u)return(r=u.setAppInfo)===null||r===void 0||r.call(u,i,s,o,e),u}const a=Oz();if(a!=null&&a.isCoinbaseBrowser)return(n=a.setAppInfo)===null||n===void 0||n.call(a,i,s,o,e),a}function Lz(t){if(!t||typeof t!="object"||Array.isArray(t))throw Sr.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:r}=t;if(typeof e!="string"||e.length===0)throw Sr.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Sr.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw Sr.provider.unsupportedMethod()}}const m5="accounts",v5="activeChain",b5="availableChains",y5="walletCapabilities";class kz{constructor(e){var r,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new Rz,this.storage=new Ys("CBWSDK","SCWStateManager"),this.accounts=(r=this.storage.loadObject(m5))!==null&&r!==void 0?r:[],this.chain=this.storage.loadObject(v5)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var r,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(r=e.params)!==null&&r!==void 0?r:{})}}),s=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in s.content)throw s.content.failure;const o=await d5("public",s.sender);await this.keyManager.setPeerPublicKey(o);const u=(await this.decryptResponseMessage(s)).result;if("error"in u)throw u.error;const l=u.value;this.accounts=l,this.storage.storeObject(m5,l),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",l)}async request(e){var r;if(this.accounts.length===0)throw Sr.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:pa(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return pa(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(y5);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var r,n;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const i=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(i)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,r;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(r=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&r!==void 0?r:1}}async handleSwitchChainRequest(e){var r;const n=e.params;if(!n||!(!((r=n[0])===null||r===void 0)&&r.chainId))throw Sr.rpc.invalidParams();const i=Ll(n[0].chainId);if(this.updateChain(i))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(i),o}async sendEncryptedRequest(e){const r=await this.keyManager.getSharedSecret();if(!r)throw Sr.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await Cz({action:e,chainId:this.chain.id},r),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const r=await h5("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:r,content:e,timestamp:new Date}}async decryptResponseMessage(e){var r,n;const i=e.content;if("failure"in i)throw i.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw Sr.provider.unauthorized("Invalid session");const o=await Tz(i.encrypted,s),a=(r=o.data)===null||r===void 0?void 0:r.chains;if(a){const l=Object.entries(a).map(([d,p])=>({id:Number(d),rpcUrl:p}));this.storage.storeObject(b5,l),this.updateChain(this.chain.id,l)}const u=(n=o.data)===null||n===void 0?void 0:n.capabilities;return u&&this.storage.storeObject(y5,u),o}updateChain(e,r){var n;const i=r??this.storage.loadObject(b5),s=i==null?void 0:i.find(o=>o.id===e);return s?(s!==this.chain&&(this.chain=s,this.storage.storeObject(v5,s),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",pa(s.id))),!0):!1}}const Bz=Jp(tM),{keccak_256:$z}=Bz;function w5(t){return Buffer.allocUnsafe(t).fill(0)}function Fz(t){return t.toString(2).length}function x5(t,e){let r=t.toString(16);r.length%2!==0&&(r="0"+r);const n=r.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(r=I5(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(Xs(t,e[s]));if(r==="dynamic"){var o=Xs("uint256",e.length);i.unshift(o)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([Xs("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,si.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Tu(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return si.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Tu(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=hc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+a);if(n<0)throw new Error("Supplied uint is negative");return si.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(r=Tu(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=hc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied int exceeds width: "+r+" vs "+a);const u=si.twosFromBigInt(n,256);return si.bufferBEFromBigInt(u,32)}else if(t.startsWith("ufixed")){if(r=M5(t),n=hc(e),n<0)throw new Error("Supplied ufixed is negative");return Xs("uint256",n*BigInt(2)**BigInt(r[1]))}else if(t.startsWith("fixed"))return r=M5(t),Xs("int256",hc(e)*BigInt(2)**BigInt(r[1]))}throw new Error("Unsupported or invalid type: "+t)}function Wz(t){return t==="string"||t==="bytes"||I5(t)==="dynamic"}function Kz(t){return t.lastIndexOf("]")===t.length-1}function Vz(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var o=P5(t[s]),a=e[s],u=Xs(o,a);Wz(o)?(r.push(Xs("uint256",i)),n.push(u),i+=u.length):r.push(u)}return Buffer.concat(r.concat(n))}function C5(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(si.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=Tu(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=hc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+u);i.push(si.bufferBEFromBigInt(n,r/8))}else if(o.startsWith("int")){if(r=Tu(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=hc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied int exceeds width: "+r+" vs "+u);const l=si.twosFromBigInt(n,r);i.push(si.bufferBEFromBigInt(l,r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function Gz(t,e){return si.keccak(C5(t,e))}var Yz={rawEncode:Vz,solidityPack:C5,soliditySHA3:Gz};const _s=A5,$l=Yz,T5={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},H1={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const o=(a,u,l)=>{if(r[u]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":_s.keccak(this.encodeData(u,l,r,n))];if(l===void 0)throw new Error(`missing value for field ${a} of type ${u}`);if(u==="bytes")return["bytes32",_s.keccak(l)];if(u==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",_s.keccak(l)];if(u.lastIndexOf("]")===u.length-1){const d=u.slice(0,u.lastIndexOf("[")),p=l.map(y=>o(a,d,y));return["bytes32",_s.keccak($l.rawEncode(p.map(([y])=>y),p.map(([,y])=>y)))]}return[u,l]};for(const a of r[t]){const[u,l]=o(a.name,a.type,e[a.name]);i.push(u),s.push(l)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=_s.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=_s.keccak(a),s.push(a);else if(r[o.type]!==void 0)i.push("bytes32"),a=_s.keccak(this.encodeData(o.type,a,r,n)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return $l.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return _s.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return _s.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in T5.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),_s.keccak(Buffer.concat(n))}};var Jz={TYPED_MESSAGE_SCHEMA:T5,TypedDataUtils:H1,hashForSignTypedDataLegacy:function(t){return Xz(t.data)},hashForSignTypedData_v3:function(t){return H1.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return H1.hash(t.data)}};function Xz(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?_s.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return $l.soliditySHA3(["bytes32","bytes32"],[$l.soliditySHA3(new Array(t.length).fill("string"),i),$l.soliditySHA3(n,r)])}const o0=ji(Jz),Zz="walletUsername",W1="Addresses",Qz="AppVersion";function Hn(t){return t.errorMessage!==void 0}class eH{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),a=16,u=o.slice(o.byteLength-a),l=o.slice(0,o.byteLength-a),d=new Uint8Array(u),p=new Uint8Array(l),y=new Uint8Array([...n,...d,...p]);return k1(y)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=n0(e),a=o.slice(0,12),u=o.slice(12,28),l=o.slice(28),d=new Uint8Array([...l,...u]),p={name:"AES-GCM",iv:new Uint8Array(a)};try{const y=await window.crypto.subtle.decrypt(p,s,d),A=new TextDecoder;n(A.decode(y))}catch(y){i(y)}})()})}}class tH{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}var To;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(To||(To={}));class rH{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,To.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.DISCONNECTED)},i.onopen=s=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(u=>this.sendData(u)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const u=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,u)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,To.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const R5=1e4,nH=6e4;class iH{constructor({session:e,linkAPIUrl:r,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Co(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,u)=>{const l=s[u];l!==void 0&&a(l)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,u)},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(Zz,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(Qz,s)},this.handleChainUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(s),l=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(u,l)},this.session=e,this.cipher=new eH(e.secret),this.listener=n;const i=new rH(`${r}/rpc`,WebSocket);i.setConnectionStateListener(async s=>{let o=!1;switch(s){case To.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(u=>setTimeout(u,5e3)),this.destroyed||i.connect().catch(()=>{a()})};a()}break;case To.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},R5),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case To.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(s=>{var o;switch(s.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=s.type==="IsLinkedOK"?s.linked:void 0;this.linked=a||s.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(s.metadata);break}case"Event":{this.handleIncomingEvent(s);break}}s.id!==void 0&&((o=this.requestResolutions.get(s.id))===null||o===void 0||o(s))}),this.ws=i,this.http=new tH(r,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:s,response:o}=i;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s,o)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Co(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>R5*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r={timeout:nH}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r.timeout)}),new Promise(s=>{this.requestResolutions.set(n,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Co(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Co(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id}),!0)}}class sH{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=f5(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}const D5="session:id",O5="session:secret",N5="session:linked";class Ru{constructor(e,r,n,i=!1){this.storage=e,this.id=r,this.secret=n,this.key=NP(Pg(`${r}, ${n} WalletLink`)),this._linked=!!i}static create(e){const r=lc(16),n=lc(32);return new Ru(e,r,n).save()}static load(e){const r=e.getItem(D5),n=e.getItem(N5),i=e.getItem(O5);return r&&i?new Ru(e,r,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(D5,this.id),this.storage.setItem(O5,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(N5,this._linked?"1":"0")}}function oH(){try{return window.frameElement!==null}catch{return!1}}function aH(){try{return oH()&&window.top?window.top.location:window.location}catch{return window.location}}function cH(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function L5(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const uH='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function k5(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(uH)),document.documentElement.appendChild(t)}function B5(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e2&&(o.children=arguments.length>3?a0.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return c0(t,o,n,i,null)}function c0(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++$5,__i:-1,__u:0};return i==null&&Vr.vnode!=null&&Vr.vnode(s),s}function Ul(t){return t.children}function u0(t,e){this.props=t,this.context=e}function Du(t,e){if(e==null)return t.__?Du(t.__,t.__i+1):null;for(var r;ee&&dc.sort(K1));f0.__r=0}function W5(t,e,r,n,i,s,o,a,u,l,d){var p,y,A,P,N,D,k=n&&n.__k||q5,B=e.length;for(u=lH(r,e,k,u),p=0;p0?c0(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,(u=s.__i=hH(s,r,a,p))!==-1&&(p--,(o=r[u])&&(o.__u|=2)),o==null||o.__v===null?(u==-1&&y--,typeof s.type!="function"&&(s.__u|=4)):u!==a&&(u==a-1?y--:u==a+1?y++:(u>a?y--:y++,s.__u|=4))):s=t.__k[i]=null;if(p)for(i=0;i(u!=null&&!(2&u.__u)?1:0))for(;o>=0||a=0){if((u=e[o])&&!(2&u.__u)&&i==u.key&&s===u.type)return o;o--}if(a=r.__.length&&r.__.push({}),r.__[t]}function o4(t){return rv=1,gH(c4,t)}function gH(t,e,r){var n=s4(h0++,2);if(n.t=t,!n.__c&&(n.__=[c4(void 0,e),function(a){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,a);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=un,!un.u)){var i=function(a,u,l){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(y){return!!y.__c});if(d.every(function(y){return!y.__N}))return!s||s.call(this,a,u,l);var p=n.__c.props!==a;return d.forEach(function(y){if(y.__N){var A=y.__[0];y.__=y.__N,y.__N=void 0,A!==y.__[0]&&(p=!0)}}),s&&s.call(this,a,u,l)||p};un.u=!0;var s=un.shouldComponentUpdate,o=un.componentWillUpdate;un.componentWillUpdate=function(a,u,l){if(this.__e){var d=s;s=void 0,i(a,u,l),s=d}o&&o.call(this,a,u,l)},un.shouldComponentUpdate=i}return n.__N||n.__}function mH(t,e){var r=s4(h0++,3);!yn.__s&&yH(r.__H,e)&&(r.__=t,r.i=e,un.__H.__h.push(r))}function vH(){for(var t;t=Z5.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(d0),t.__H.__h.forEach(nv),t.__H.__h=[]}catch(e){t.__H.__h=[],yn.__e(e,t.__v)}}yn.__b=function(t){un=null,Q5&&Q5(t)},yn.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),i4&&i4(t,e)},yn.__r=function(t){e4&&e4(t),h0=0;var e=(un=t.__c).__H;e&&(tv===un?(e.__h=[],un.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(d0),e.__h.forEach(nv),e.__h=[],h0=0)),tv=un},yn.diffed=function(t){t4&&t4(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Z5.push(e)!==1&&X5===yn.requestAnimationFrame||((X5=yn.requestAnimationFrame)||bH)(vH)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),tv=un=null},yn.__c=function(t,e){e.some(function(r){try{r.__h.forEach(d0),r.__h=r.__h.filter(function(n){return!n.__||nv(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],yn.__e(n,r.__v)}}),r4&&r4(t,e)},yn.unmount=function(t){n4&&n4(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{d0(n)}catch(i){e=i}}),r.__H=void 0,e&&yn.__e(e,r.__v))};var a4=typeof requestAnimationFrame=="function";function bH(t){var e,r=function(){clearTimeout(n),a4&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);a4&&(e=requestAnimationFrame(r))}function d0(t){var e=un,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),un=e}function nv(t){var e=un;t.__c=t.__(),un=e}function yH(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function c4(t,e){return typeof e=="function"?e(t):e}const wH=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",xH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",_H="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class EH{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=L5()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const r=this.nextItemKey++;return this.items.set(r,e),this.render(),()=>{this.items.delete(r),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&ev(Or("div",null,Or(u4,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,r])=>Or(SH,Object.assign({},r,{key:e}))))),this.root)}}const u4=t=>Or("div",{class:Fl("-cbwsdk-snackbar-container")},Or("style",null,wH),Or("div",{class:"-cbwsdk-snackbar"},t.children)),SH=({autoExpand:t,message:e,menuItems:r})=>{const[n,i]=o4(!0),[s,o]=o4(t??!1);mH(()=>{const u=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{u.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return Or("div",{class:Fl("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},Or("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},Or("img",{src:xH,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",Or("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),Or("div",{class:"-gear-container"},!s&&Or("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),Or("img",{src:_H,class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&Or("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((u,l)=>Or("div",{class:Fl("-cbwsdk-snackbar-instance-menu-item",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:u.onClick,key:l},Or("svg",{width:u.svgWidth,height:u.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("path",{"fill-rule":u.defaultFillRule,"clip-rule":u.defaultClipRule,d:u.path,fill:"#AAAAAA"})),Or("span",{class:Fl("-cbwsdk-snackbar-instance-menu-item-info",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},u.info)))))};class AH{constructor(){this.attached=!1,this.snackbar=new EH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.snackbar.attach(r),this.attached=!0,k5()}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}}const PH=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class MH{constructor(){this.root=null,this.darkMode=L5()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),k5()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(ev(null,this.root),e&&ev(Or(IH,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const IH=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return Or(u4,{darkMode:r},Or("div",{class:"-cbwsdk-redirect-dialog"},Or("style",null,PH),Or("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),Or("div",{class:Fl("-cbwsdk-redirect-dialog-box",s)},Or("p",null,t),Or("button",{onClick:n},e))))},CH="https://keys.coinbase.com/connect",f4="https://www.walletlink.org",TH="https://go.cb-w.com/walletlink";class l4{constructor(){this.attached=!1,this.redirectDialog=new MH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const r=new URL(TH);r.searchParams.append("redirect_url",aH().href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class Ro{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=cH(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(W1);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!u&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),Ro.accountRequestCallbackIds.size>0&&(Array.from(Ro.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),Ro.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new sH,this.ui=n,this.ui.attach()}subscribe(){const e=Ru.load(this.storage)||Ru.create(this.storage),{linkAPIUrl:r}=this,n=new iH({session:e,linkAPIUrl:r,listener:this}),i=this.isMobileWeb?new l4:new AH;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=Ru.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Ys.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?Js(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?Js(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Nl(e,!0),chainId:r}})}getWalletLinkSession(){return this._session}sendRequest(e){let r=null;const n=lc(8),i=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,s),r==null||r()};return new Promise((s,o)=>{r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,a=>{if(r==null||r(),Hn(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,r){const n={type:"WEB3_REQUEST",id:e,request:r};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:r.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(r.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof l4)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e,r){if(r.method==="requestEthereumAccounts"){Ro.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,r)),Ro.accountRequestCallbackIds.clear();return}this.invokeCallback(e,r)}handleErrorResponse(e,r,n){var i;const s=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:r,errorMessage:s})}invokeCallback(e,r){const n=this.relayEventManager.callbacks.get(e);n&&(n(r),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:r}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:r}},i=lc(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(Hn(a))return o(new Error(a.errorMessage));s(a)}),Ro.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,r,n,i,s,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:o}};let u=null;const l=lc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));p(A)}),this.publishWeb3RequestEvent(l,a)})}addEthereumChain(e,r,n,i,s,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:o}};let u=null;const l=lc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));p(A)}),this.publishWeb3RequestEvent(l,a)})}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})};let i=null;const s=lc(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,u)=>{this.relayEventManager.callbacks.set(s,l=>{if(i==null||i(),Hn(l)&&l.errorCode)return u(Sr.provider.custom({code:l.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(Hn(l))return u(new Error(l.errorMessage));a(l)}),this.publishWeb3RequestEvent(s,n)})}}Ro.accountRequestCallbackIds=new Set;const h4="DefaultChainId",d4="DefaultJsonRpcUrl";class p4{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new Ys("walletlink",f4),this.callback=e.callback||null;const r=this._storage.getItem(W1);if(r){const n=r.split(" ");n[0]!==""&&(this._addresses=n.map(i=>ga(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:r,secret:n}=e.getWalletLinkSession();return{id:r,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(d4))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(d4,e)}updateProviderInfo(e,r){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(h4,r.toString(10)),Ll(r)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",pa(r)))}async watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw Sr.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw Sr.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw Sr.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw Sr.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=r.options,l=await this.initializeRelay().watchAsset(r.type,i,s,a,o,n==null?void 0:n.toString());return Hn(l)?!1:!!l.result}async addEthereumChain(e){var r,n;const i=e[0];if(((r=i.rpcUrls)===null||r===void 0?void 0:r.length)===0)throw Sr.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw Sr.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw Sr.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:u=[],chainName:l,iconUrls:d=[],nativeCurrency:p}=i,y=await o.addEthereumChain(s.toString(),a,d,u,l,p);if(Hn(y))return!1;if(((n=y.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw Sr.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const r=e[0],n=Number.parseInt(r.chainId,16),s=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(Hn(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,r){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(s=>ga(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(W1,i.join(" ")))}async request(e){const r=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return pa(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(r);case"wallet_switchEthereumChain":return this.switchEthereumChain(r);case"wallet_watchAsset":return this.watchAsset(r);default:if(!this.jsonRpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const r=ga(e);if(!this._addresses.map(i=>ga(i)).includes(r))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?ga(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?ga(e.to):null,i=e.value!=null?kl(e.value):BigInt(0),s=e.data?j1(e.data):Buffer.alloc(0),o=e.nonce!=null?Ll(e.nonce):null,a=e.gasPrice!=null?kl(e.gasPrice):null,u=e.maxFeePerGas!=null?kl(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?kl(e.maxPriorityFeePerGas):null,d=e.gas!=null?kl(e.gas):null,p=e.chainId?Ll(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:u,maxPriorityFeePerGas:l,gasLimit:d,chainId:p}}async ecRecover(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:B1(n[0]),signature:B1(n[1]),addPrefix:r==="personal_ecRecover"}});if(Hn(s))throw s;return s.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(h4))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,r;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:pa(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(Hn(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:pa(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw Sr.rpc.invalidParams();const r=e[1],n=e[0];this._ensureKnownAddress(r);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ga(r),message:B1(n),addPrefix:!0,typedDataJson:null}});if(Hn(s))throw s;return s.result}async _eth_signTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(r);if(Hn(i))throw i;return i.result}async _eth_sendRawTransaction(e){const r=j1(e[0]),i=await this.initializeRelay().submitEthereumTransaction(r,this.getChainId());if(Hn(i))throw i;return i.result}async _eth_sendTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(r);if(Hn(i))throw i;return i.result}async signTypedData(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const i=l=>{const d={eth_signTypedData_v1:o0.hashForSignTypedDataLegacy,eth_signTypedData_v3:o0.hashForSignTypedData_v3,eth_signTypedData_v4:o0.hashForSignTypedData_v4,eth_signTypedData:o0.hashForSignTypedData_v4};return Nl(d[r]({data:Ez(l)}),!0)},s=n[r==="eth_signTypedData_v1"?1:0],o=n[r==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const u=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ga(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(Hn(u))throw u;return u.result}initializeRelay(){return this._relay||(this._relay=new Ro({linkAPIUrl:f4,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const g4="SignerType",m4=new Ys("CBWSDK","SignerConfigurator");function RH(){return m4.getItem(g4)}function DH(t){m4.setItem(g4,t)}async function OH(t){const{communicator:e,metadata:r,handshakeRequest:n,callback:i}=t;LH(e,r,i).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:o}=await e.postRequestAndWaitForResponse(s);return o}function NH(t){const{signerType:e,metadata:r,communicator:n,callback:i}=t;switch(e){case"scw":return new kz({metadata:r,callback:i,communicator:n});case"walletlink":return new p4({metadata:r,callback:i})}}async function LH(t,e,r){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new p4({metadata:e,callback:r});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const kH=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. -Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,BH=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,r=await fetch(e,{method:"HEAD"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const n=r.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(kH)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:$H,getCrossOriginOpenerPolicy:FH}=BH(),v4=420,b4=540;function jH(t){const e=(window.innerWidth-v4)/2+window.screenX,r=(window.innerHeight-b4)/2+window.screenY;qH(t);const n=window.open(t,"Smart Wallet",`width=${v4}, height=${b4}, left=${e}, top=${r}`);if(n==null||n.focus(),!n)throw Sr.rpc.internal("Pop up window failed to open");return n}function UH(t){t&&!t.closed&&t.close()}function qH(t){const e={sdkName:p5,sdkVersion:Bl,origin:window.location.origin,coop:FH()};for(const[r,n]of Object.entries(e))t.searchParams.append(r,n.toString())}class zH{constructor({url:e=CH,metadata:r,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=u=>{if(u.origin!==this.url.origin)return;const l=u.data;i(l)&&(s(l),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{UH(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(Sr.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=jH(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:Bl,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw Sr.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=r,this.preference=n}}function HH(t){const e=bz(WH(t),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",Bl),r.searchParams.set("code",e.code.toString()),r.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:r.href})}function WH(t){var e;if(typeof t=="string")return{message:t,code:cn.rpc.internal};if(Hn(t)){const r=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:r.match(/(denied|rejected)/i)?cn.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:r,code:n,data:{method:t.method}})}return t}var y4={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,l,d){this.fn=u,this.context=l,this.once=d||!1}function s(u,l,d,p,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var A=new i(d,p||u,y),P=r?r+l:l;return u._events[P]?u._events[P].fn?u._events[P]=[u._events[P],A]:u._events[P].push(A):(u._events[P]=A,u._eventsCount++),u}function o(u,l){--u._eventsCount===0?u._events=new n:delete u._events[l]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,p;if(this._eventsCount===0)return l;for(p in d=this._events)e.call(d,p)&&l.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=r?r+l:l,p=this._events[d];if(!p)return[];if(p.fn)return[p.fn];for(var y=0,A=p.length,P=new Array(A);y(i||(i=ZH(n)),i)}}function w4(t,e){return function(){return t.apply(e,arguments)}}const{toString:tW}=Object.prototype,{getPrototypeOf:nv}=Object,p0=(t=>e=>{const r=tW.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Es=t=>(t=t.toLowerCase(),e=>p0(e)===t),g0=t=>e=>typeof e===t,{isArray:Ou}=Array,ql=g0("undefined");function rW(t){return t!==null&&!ql(t)&&t.constructor!==null&&!ql(t.constructor)&&Oi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const x4=Es("ArrayBuffer");function nW(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&x4(t.buffer),e}const iW=g0("string"),Oi=g0("function"),_4=g0("number"),m0=t=>t!==null&&typeof t=="object",sW=t=>t===!0||t===!1,v0=t=>{if(p0(t)!=="object")return!1;const e=nv(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},oW=Es("Date"),aW=Es("File"),cW=Es("Blob"),uW=Es("FileList"),fW=t=>m0(t)&&Oi(t.pipe),lW=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Oi(t.append)&&((e=p0(t))==="formdata"||e==="object"&&Oi(t.toString)&&t.toString()==="[object FormData]"))},hW=Es("URLSearchParams"),[dW,pW,gW,mW]=["ReadableStream","Request","Response","Headers"].map(Es),vW=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function zl(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Ou(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const pc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,S4=t=>!ql(t)&&t!==pc;function iv(){const{caseless:t}=S4(this)&&this||{},e={},r=(n,i)=>{const s=t&&E4(e,i)||i;v0(e[s])&&v0(n)?e[s]=iv(e[s],n):v0(n)?e[s]=iv({},n):Ou(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(zl(e,(i,s)=>{r&&Oi(i)?t[s]=w4(i,r):t[s]=i},{allOwnKeys:n}),t),yW=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),wW=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},xW=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&nv(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},_W=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},EW=t=>{if(!t)return null;if(Ou(t))return t;let e=t.length;if(!_4(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},SW=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&nv(Uint8Array)),AW=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},PW=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},MW=Es("HTMLFormElement"),IW=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),A4=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),CW=Es("RegExp"),P4=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};zl(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},TW=t=>{P4(t,(e,r)=>{if(Oi(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Oi(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},RW=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Ou(t)?n(t):n(String(t).split(e)),r},DW=()=>{},OW=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,sv="abcdefghijklmnopqrstuvwxyz",M4="0123456789",I4={DIGIT:M4,ALPHA:sv,ALPHA_DIGIT:sv+sv.toUpperCase()+M4},NW=(t=16,e=I4.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function LW(t){return!!(t&&Oi(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const kW=t=>{const e=new Array(10),r=(n,i)=>{if(m0(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Ou(n)?[]:{};return zl(n,(o,a)=>{const u=r(o,i+1);!ql(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},BW=Es("AsyncFunction"),$W=t=>t&&(m0(t)||Oi(t))&&Oi(t.then)&&Oi(t.catch),C4=((t,e)=>t?setImmediate:e?((r,n)=>(pc.addEventListener("message",({source:i,data:s})=>{i===pc&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),pc.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Oi(pc.postMessage)),FW=typeof queueMicrotask<"u"?queueMicrotask.bind(pc):typeof process<"u"&&process.nextTick||C4,Oe={isArray:Ou,isArrayBuffer:x4,isBuffer:rW,isFormData:lW,isArrayBufferView:nW,isString:iW,isNumber:_4,isBoolean:sW,isObject:m0,isPlainObject:v0,isReadableStream:dW,isRequest:pW,isResponse:gW,isHeaders:mW,isUndefined:ql,isDate:oW,isFile:aW,isBlob:cW,isRegExp:CW,isFunction:Oi,isStream:fW,isURLSearchParams:hW,isTypedArray:SW,isFileList:uW,forEach:zl,merge:iv,extend:bW,trim:vW,stripBOM:yW,inherits:wW,toFlatObject:xW,kindOf:p0,kindOfTest:Es,endsWith:_W,toArray:EW,forEachEntry:AW,matchAll:PW,isHTMLForm:MW,hasOwnProperty:A4,hasOwnProp:A4,reduceDescriptors:P4,freezeMethods:TW,toObjectSet:RW,toCamelCase:IW,noop:DW,toFiniteNumber:OW,findKey:E4,global:pc,isContextDefined:S4,ALPHABET:I4,generateString:NW,isSpecCompliantForm:LW,toJSONObject:kW,isAsyncFn:BW,isThenable:$W,setImmediate:C4,asap:FW};function ar(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Oe.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const T4=ar.prototype,R4={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{R4[t]={value:t}}),Object.defineProperties(ar,R4),Object.defineProperty(T4,"isAxiosError",{value:!0}),ar.from=(t,e,r,n,i,s)=>{const o=Object.create(T4);return Oe.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),ar.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const jW=null;function ov(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function D4(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function O4(t,e,r){return t?t.concat(e).map(function(i,s){return i=D4(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function UW(t){return Oe.isArray(t)&&!t.some(ov)}const qW=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function b0(t,e,r){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Oe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(N,D){return!Oe.isUndefined(D[N])});const n=r.metaTokens,i=r.visitor||d,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(i))throw new TypeError("visitor must be a function");function l(P){if(P===null)return"";if(Oe.isDate(P))return P.toISOString();if(!u&&Oe.isBlob(P))throw new ar("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(P)||Oe.isTypedArray(P)?u&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function d(P,N,D){let k=P;if(P&&!D&&typeof P=="object"){if(Oe.endsWith(N,"{}"))N=n?N:N.slice(0,-2),P=JSON.stringify(P);else if(Oe.isArray(P)&&UW(P)||(Oe.isFileList(P)||Oe.endsWith(N,"[]"))&&(k=Oe.toArray(P)))return N=D4(N),k.forEach(function(j,U){!(Oe.isUndefined(j)||j===null)&&e.append(o===!0?O4([N],U,s):o===null?N:N+"[]",l(j))}),!1}return ov(P)?!0:(e.append(O4(D,N,s),l(P)),!1)}const p=[],y=Object.assign(qW,{defaultVisitor:d,convertValue:l,isVisitable:ov});function A(P,N){if(!Oe.isUndefined(P)){if(p.indexOf(P)!==-1)throw Error("Circular reference detected in "+N.join("."));p.push(P),Oe.forEach(P,function(k,B){(!(Oe.isUndefined(k)||k===null)&&i.call(e,k,Oe.isString(B)?B.trim():B,N,y))===!0&&A(k,N?N.concat(B):[B])}),p.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return A(t),e}function N4(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function av(t,e){this._pairs=[],t&&b0(t,this,e)}const L4=av.prototype;L4.append=function(e,r){this._pairs.push([e,r])},L4.toString=function(e){const r=e?function(n){return e.call(this,n,N4)}:N4;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function zW(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function k4(t,e,r){if(!e)return t;const n=r&&r.encode||zW;Oe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(e,r):s=Oe.isURLSearchParams(e)?e.toString():new av(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class B4{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(n){n!==null&&e(n)})}}const $4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},HW={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:av,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},cv=typeof window<"u"&&typeof document<"u",uv=typeof navigator=="object"&&navigator||void 0,WW=cv&&(!uv||["ReactNative","NativeScript","NS"].indexOf(uv.product)<0),KW=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",VW=cv&&window.location.href||"http://localhost",Xn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:cv,hasStandardBrowserEnv:WW,hasStandardBrowserWebWorkerEnv:KW,navigator:uv,origin:VW},Symbol.toStringTag,{value:"Module"})),...HW};function GW(t,e){return b0(t,new Xn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Xn.isNode&&Oe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function YW(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function JW(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&Oe.isArray(i)?i.length:o,u?(Oe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Oe.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Oe.isArray(i[o])&&(i[o]=JW(i[o])),!a)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const r={};return Oe.forEachEntry(t,(n,i)=>{e(YW(n),i,r,0)}),r}return null}function XW(t,e,r){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const Hl={transitional:$4,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Oe.isObject(e);if(s&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return i?JSON.stringify(F4(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return GW(e,this.formSerializer).toString();if((a=Oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return b0(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),XW(e)):e}],transformResponse:[function(e){const r=this.transitional||Hl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ar.from(a,ar.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xn.classes.FormData,Blob:Xn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{Hl.headers[t]={}});const ZW=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),QW=t=>{const e={};let r,n,i;return t&&t.split(` -`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&ZW[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},j4=Symbol("internals");function Wl(t){return t&&String(t).trim().toLowerCase()}function y0(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(y0):String(t)}function eK(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const tK=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function fv(t,e,r,n,i){if(Oe.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Oe.isString(e)){if(Oe.isString(n))return e.indexOf(n)!==-1;if(Oe.isRegExp(n))return n.test(e)}}function rK(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function nK(t,e){const r=Oe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}let wi=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,u,l){const d=Wl(u);if(!d)throw new Error("header name must be a non-empty string");const p=Oe.findKey(i,d);(!p||i[p]===void 0||l===!0||l===void 0&&i[p]!==!1)&&(i[p||u]=y0(a))}const o=(a,u)=>Oe.forEach(a,(l,d)=>s(l,d,u));if(Oe.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(Oe.isString(e)&&(e=e.trim())&&!tK(e))o(QW(e),r);else if(Oe.isHeaders(e))for(const[a,u]of e.entries())s(u,a,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return eK(i);if(Oe.isFunction(r))return r.call(this,i,n);if(Oe.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||fv(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=Wl(o),o){const a=Oe.findKey(n,o);a&&(!r||fv(n,n[a],a,r))&&(delete n[a],i=!0)}}return Oe.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||fv(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Oe.forEach(this,(i,s)=>{const o=Oe.findKey(n,s);if(o){r[o]=y0(i),delete r[s];return}const a=e?rK(s):String(s).trim();a!==s&&delete r[s],r[a]=y0(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Oe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Oe.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[j4]=this[j4]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Wl(o);n[a]||(nK(i,o),n[a]=!0)}return Oe.isArray(e)?e.forEach(s):s(e),this}};wi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Oe.reduceDescriptors(wi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),Oe.freezeMethods(wi);function lv(t,e){const r=this||Hl,n=e||r,i=wi.from(n.headers);let s=n.data;return Oe.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function U4(t){return!!(t&&t.__CANCEL__)}function Nu(t,e,r){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,r),this.name="CanceledError"}Oe.inherits(Nu,ar,{__CANCEL__:!0});function q4(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new ar("Request failed with status code "+r.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function iK(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function sK(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),d=n[s];o||(o=l),r[i]=u,n[i]=l;let p=s,y=0;for(;p!==i;)y+=r[p++],p=p%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),l-o{r=d,i=null,s&&(clearTimeout(s),s=null),t.apply(null,l)};return[(...l)=>{const d=Date.now(),p=d-r;p>=n?o(l,d):(i=l,s||(s=setTimeout(()=>{s=null,o(i)},n-p)))},()=>i&&o(i)]}const w0=(t,e,r=3)=>{let n=0;const i=sK(50,250);return oK(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,u=o-n,l=i(u),d=o<=a;n=o;const p={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:l||void 0,estimated:l&&a&&d?(a-o)/l:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(p)},r)},z4=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},H4=t=>(...e)=>Oe.asap(()=>t(...e)),aK=Xn.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Xn.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Xn.origin),Xn.navigator&&/(msie|trident)/i.test(Xn.navigator.userAgent)):()=>!0,cK=Xn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];Oe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Oe.isString(n)&&o.push("path="+n),Oe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function uK(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function fK(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function W4(t,e){return t&&!uK(e)?fK(t,e):e}const K4=t=>t instanceof wi?{...t}:t;function gc(t,e){e=e||{};const r={};function n(l,d,p,y){return Oe.isPlainObject(l)&&Oe.isPlainObject(d)?Oe.merge.call({caseless:y},l,d):Oe.isPlainObject(d)?Oe.merge({},d):Oe.isArray(d)?d.slice():d}function i(l,d,p,y){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l,p,y)}else return n(l,d,p,y)}function s(l,d){if(!Oe.isUndefined(d))return n(void 0,d)}function o(l,d){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l)}else return n(void 0,d)}function a(l,d,p){if(p in e)return n(l,d);if(p in t)return n(void 0,l)}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,d,p)=>i(K4(l),K4(d),p,!0)};return Oe.forEach(Object.keys(Object.assign({},t,e)),function(d){const p=u[d]||i,y=p(t[d],e[d],d);Oe.isUndefined(y)&&p!==a||(r[d]=y)}),r}const V4=t=>{const e=gc({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=wi.from(o),e.url=k4(W4(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(Oe.isFormData(r)){if(Xn.hasStandardBrowserEnv||Xn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[l,...d]=u?u.split(";").map(p=>p.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...d].join("; "))}}if(Xn.hasStandardBrowserEnv&&(n&&Oe.isFunction(n)&&(n=n(e)),n||n!==!1&&aK(e.url))){const l=i&&s&&cK.read(s);l&&o.set(i,l)}return e},lK=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=V4(t);let s=i.data;const o=wi.from(i.headers).normalize();let{responseType:a,onUploadProgress:u,onDownloadProgress:l}=i,d,p,y,A,P;function N(){A&&A(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let D=new XMLHttpRequest;D.open(i.method.toUpperCase(),i.url,!0),D.timeout=i.timeout;function k(){if(!D)return;const j=wi.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),K={data:!a||a==="text"||a==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:j,config:t,request:D};q4(function(T){r(T),N()},function(T){n(T),N()},K),D=null}"onloadend"in D?D.onloadend=k:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(k)},D.onabort=function(){D&&(n(new ar("Request aborted",ar.ECONNABORTED,t,D)),D=null)},D.onerror=function(){n(new ar("Network Error",ar.ERR_NETWORK,t,D)),D=null},D.ontimeout=function(){let U=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const K=i.transitional||$4;i.timeoutErrorMessage&&(U=i.timeoutErrorMessage),n(new ar(U,K.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,D)),D=null},s===void 0&&o.setContentType(null),"setRequestHeader"in D&&Oe.forEach(o.toJSON(),function(U,K){D.setRequestHeader(K,U)}),Oe.isUndefined(i.withCredentials)||(D.withCredentials=!!i.withCredentials),a&&a!=="json"&&(D.responseType=i.responseType),l&&([y,P]=w0(l,!0),D.addEventListener("progress",y)),u&&D.upload&&([p,A]=w0(u),D.upload.addEventListener("progress",p),D.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(d=j=>{D&&(n(!j||j.type?new Nu(null,t,D):j),D.abort(),D=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const B=iK(i.url);if(B&&Xn.protocols.indexOf(B)===-1){n(new ar("Unsupported protocol "+B+":",ar.ERR_BAD_REQUEST,t));return}D.send(s||null)})},hK=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i;const s=function(l){if(!i){i=!0,a();const d=l instanceof Error?l:this.reason;n.abort(d instanceof ar?d:new Nu(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,s(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),t=null)};t.forEach(l=>l.addEventListener("abort",s));const{signal:u}=n;return u.unsubscribe=()=>Oe.asap(a),u}},dK=function*(t,e){let r=t.byteLength;if(r{const i=pK(t,e);let s=0,o,a=u=>{o||(o=!0,n&&n(u))};return new ReadableStream({async pull(u){try{const{done:l,value:d}=await i.next();if(l){a(),u.close();return}let p=d.byteLength;if(r){let y=s+=p;r(y)}u.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(u){return a(u),i.return()}},{highWaterMark:2})},x0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Y4=x0&&typeof ReadableStream=="function",mK=x0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),J4=(t,...e)=>{try{return!!t(...e)}catch{return!1}},vK=Y4&&J4(()=>{let t=!1;const e=new Request(Xn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),X4=64*1024,hv=Y4&&J4(()=>Oe.isReadableStream(new Response("").body)),_0={stream:hv&&(t=>t.body)};x0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!_0[e]&&(_0[e]=Oe.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,n)})})})(new Response);const bK=async t=>{if(t==null)return 0;if(Oe.isBlob(t))return t.size;if(Oe.isSpecCompliantForm(t))return(await new Request(Xn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(t)||Oe.isArrayBuffer(t))return t.byteLength;if(Oe.isURLSearchParams(t)&&(t=t+""),Oe.isString(t))return(await mK(t)).byteLength},yK=async(t,e)=>{const r=Oe.toFiniteNumber(t.getContentLength());return r??bK(e)},dv={http:jW,xhr:lK,fetch:x0&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:l,headers:d,withCredentials:p="same-origin",fetchOptions:y}=V4(t);l=l?(l+"").toLowerCase():"text";let A=hK([i,s&&s.toAbortSignal()],o),P;const N=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let D;try{if(u&&vK&&r!=="get"&&r!=="head"&&(D=await yK(d,n))!==0){let K=new Request(e,{method:"POST",body:n,duplex:"half"}),J;if(Oe.isFormData(n)&&(J=K.headers.get("content-type"))&&d.setContentType(J),K.body){const[T,z]=z4(D,w0(H4(u)));n=G4(K.body,X4,T,z)}}Oe.isString(p)||(p=p?"include":"omit");const k="credentials"in Request.prototype;P=new Request(e,{...y,signal:A,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:k?p:void 0});let B=await fetch(P);const j=hv&&(l==="stream"||l==="response");if(hv&&(a||j&&N)){const K={};["status","statusText","headers"].forEach(ue=>{K[ue]=B[ue]});const J=Oe.toFiniteNumber(B.headers.get("content-length")),[T,z]=a&&z4(J,w0(H4(a),!0))||[];B=new Response(G4(B.body,X4,T,()=>{z&&z(),N&&N()}),K)}l=l||"text";let U=await _0[Oe.findKey(_0,l)||"text"](B,t);return!j&&N&&N(),await new Promise((K,J)=>{q4(K,J,{data:U,headers:wi.from(B.headers),status:B.status,statusText:B.statusText,config:t,request:P})})}catch(k){throw N&&N(),k&&k.name==="TypeError"&&/fetch/i.test(k.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,P),{cause:k.cause||k}):ar.from(k,k&&k.code,t,P)}})};Oe.forEach(dv,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Z4=t=>`- ${t}`,wK=t=>Oe.isFunction(t)||t===null||t===!1,Q4={getAdapter:t=>{t=Oe.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : +Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,BH=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,r=await fetch(e,{method:"HEAD"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const n=r.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(kH)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:$H,getCrossOriginOpenerPolicy:FH}=BH(),v4=420,b4=540;function jH(t){const e=(window.innerWidth-v4)/2+window.screenX,r=(window.innerHeight-b4)/2+window.screenY;qH(t);const n=window.open(t,"Smart Wallet",`width=${v4}, height=${b4}, left=${e}, top=${r}`);if(n==null||n.focus(),!n)throw Sr.rpc.internal("Pop up window failed to open");return n}function UH(t){t&&!t.closed&&t.close()}function qH(t){const e={sdkName:p5,sdkVersion:Bl,origin:window.location.origin,coop:FH()};for(const[r,n]of Object.entries(e))t.searchParams.append(r,n.toString())}class zH{constructor({url:e=CH,metadata:r,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=u=>{if(u.origin!==this.url.origin)return;const l=u.data;i(l)&&(s(l),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{UH(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(Sr.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=jH(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:Bl,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw Sr.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=r,this.preference=n}}function HH(t){const e=bz(WH(t),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",Bl),r.searchParams.set("code",e.code.toString()),r.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:r.href})}function WH(t){var e;if(typeof t=="string")return{message:t,code:cn.rpc.internal};if(Hn(t)){const r=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:r.match(/(denied|rejected)/i)?cn.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:r,code:n,data:{method:t.method}})}return t}var y4={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,l,d){this.fn=u,this.context=l,this.once=d||!1}function s(u,l,d,p,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var A=new i(d,p||u,y),P=r?r+l:l;return u._events[P]?u._events[P].fn?u._events[P]=[u._events[P],A]:u._events[P].push(A):(u._events[P]=A,u._eventsCount++),u}function o(u,l){--u._eventsCount===0?u._events=new n:delete u._events[l]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,p;if(this._eventsCount===0)return l;for(p in d=this._events)e.call(d,p)&&l.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=r?r+l:l,p=this._events[d];if(!p)return[];if(p.fn)return[p.fn];for(var y=0,A=p.length,P=new Array(A);y(i||(i=ZH(n)),i)}}function w4(t,e){return function(){return t.apply(e,arguments)}}const{toString:tW}=Object.prototype,{getPrototypeOf:iv}=Object,p0=(t=>e=>{const r=tW.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Es=t=>(t=t.toLowerCase(),e=>p0(e)===t),g0=t=>e=>typeof e===t,{isArray:Ou}=Array,ql=g0("undefined");function rW(t){return t!==null&&!ql(t)&&t.constructor!==null&&!ql(t.constructor)&&Oi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const x4=Es("ArrayBuffer");function nW(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&x4(t.buffer),e}const iW=g0("string"),Oi=g0("function"),_4=g0("number"),m0=t=>t!==null&&typeof t=="object",sW=t=>t===!0||t===!1,v0=t=>{if(p0(t)!=="object")return!1;const e=iv(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},oW=Es("Date"),aW=Es("File"),cW=Es("Blob"),uW=Es("FileList"),fW=t=>m0(t)&&Oi(t.pipe),lW=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Oi(t.append)&&((e=p0(t))==="formdata"||e==="object"&&Oi(t.toString)&&t.toString()==="[object FormData]"))},hW=Es("URLSearchParams"),[dW,pW,gW,mW]=["ReadableStream","Request","Response","Headers"].map(Es),vW=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function zl(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Ou(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const pc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,S4=t=>!ql(t)&&t!==pc;function sv(){const{caseless:t}=S4(this)&&this||{},e={},r=(n,i)=>{const s=t&&E4(e,i)||i;v0(e[s])&&v0(n)?e[s]=sv(e[s],n):v0(n)?e[s]=sv({},n):Ou(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(zl(e,(i,s)=>{r&&Oi(i)?t[s]=w4(i,r):t[s]=i},{allOwnKeys:n}),t),yW=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),wW=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},xW=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&iv(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},_W=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},EW=t=>{if(!t)return null;if(Ou(t))return t;let e=t.length;if(!_4(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},SW=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&iv(Uint8Array)),AW=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},PW=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},MW=Es("HTMLFormElement"),IW=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),A4=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),CW=Es("RegExp"),P4=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};zl(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},TW=t=>{P4(t,(e,r)=>{if(Oi(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Oi(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},RW=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Ou(t)?n(t):n(String(t).split(e)),r},DW=()=>{},OW=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,ov="abcdefghijklmnopqrstuvwxyz",M4="0123456789",I4={DIGIT:M4,ALPHA:ov,ALPHA_DIGIT:ov+ov.toUpperCase()+M4},NW=(t=16,e=I4.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function LW(t){return!!(t&&Oi(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const kW=t=>{const e=new Array(10),r=(n,i)=>{if(m0(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Ou(n)?[]:{};return zl(n,(o,a)=>{const u=r(o,i+1);!ql(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},BW=Es("AsyncFunction"),$W=t=>t&&(m0(t)||Oi(t))&&Oi(t.then)&&Oi(t.catch),C4=((t,e)=>t?setImmediate:e?((r,n)=>(pc.addEventListener("message",({source:i,data:s})=>{i===pc&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),pc.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Oi(pc.postMessage)),FW=typeof queueMicrotask<"u"?queueMicrotask.bind(pc):typeof process<"u"&&process.nextTick||C4,Oe={isArray:Ou,isArrayBuffer:x4,isBuffer:rW,isFormData:lW,isArrayBufferView:nW,isString:iW,isNumber:_4,isBoolean:sW,isObject:m0,isPlainObject:v0,isReadableStream:dW,isRequest:pW,isResponse:gW,isHeaders:mW,isUndefined:ql,isDate:oW,isFile:aW,isBlob:cW,isRegExp:CW,isFunction:Oi,isStream:fW,isURLSearchParams:hW,isTypedArray:SW,isFileList:uW,forEach:zl,merge:sv,extend:bW,trim:vW,stripBOM:yW,inherits:wW,toFlatObject:xW,kindOf:p0,kindOfTest:Es,endsWith:_W,toArray:EW,forEachEntry:AW,matchAll:PW,isHTMLForm:MW,hasOwnProperty:A4,hasOwnProp:A4,reduceDescriptors:P4,freezeMethods:TW,toObjectSet:RW,toCamelCase:IW,noop:DW,toFiniteNumber:OW,findKey:E4,global:pc,isContextDefined:S4,ALPHABET:I4,generateString:NW,isSpecCompliantForm:LW,toJSONObject:kW,isAsyncFn:BW,isThenable:$W,setImmediate:C4,asap:FW};function ar(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Oe.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const T4=ar.prototype,R4={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{R4[t]={value:t}}),Object.defineProperties(ar,R4),Object.defineProperty(T4,"isAxiosError",{value:!0}),ar.from=(t,e,r,n,i,s)=>{const o=Object.create(T4);return Oe.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),ar.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const jW=null;function av(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function D4(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function O4(t,e,r){return t?t.concat(e).map(function(i,s){return i=D4(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function UW(t){return Oe.isArray(t)&&!t.some(av)}const qW=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function b0(t,e,r){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Oe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(N,D){return!Oe.isUndefined(D[N])});const n=r.metaTokens,i=r.visitor||d,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(i))throw new TypeError("visitor must be a function");function l(P){if(P===null)return"";if(Oe.isDate(P))return P.toISOString();if(!u&&Oe.isBlob(P))throw new ar("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(P)||Oe.isTypedArray(P)?u&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function d(P,N,D){let k=P;if(P&&!D&&typeof P=="object"){if(Oe.endsWith(N,"{}"))N=n?N:N.slice(0,-2),P=JSON.stringify(P);else if(Oe.isArray(P)&&UW(P)||(Oe.isFileList(P)||Oe.endsWith(N,"[]"))&&(k=Oe.toArray(P)))return N=D4(N),k.forEach(function(j,U){!(Oe.isUndefined(j)||j===null)&&e.append(o===!0?O4([N],U,s):o===null?N:N+"[]",l(j))}),!1}return av(P)?!0:(e.append(O4(D,N,s),l(P)),!1)}const p=[],y=Object.assign(qW,{defaultVisitor:d,convertValue:l,isVisitable:av});function A(P,N){if(!Oe.isUndefined(P)){if(p.indexOf(P)!==-1)throw Error("Circular reference detected in "+N.join("."));p.push(P),Oe.forEach(P,function(k,B){(!(Oe.isUndefined(k)||k===null)&&i.call(e,k,Oe.isString(B)?B.trim():B,N,y))===!0&&A(k,N?N.concat(B):[B])}),p.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return A(t),e}function N4(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function cv(t,e){this._pairs=[],t&&b0(t,this,e)}const L4=cv.prototype;L4.append=function(e,r){this._pairs.push([e,r])},L4.toString=function(e){const r=e?function(n){return e.call(this,n,N4)}:N4;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function zW(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function k4(t,e,r){if(!e)return t;const n=r&&r.encode||zW;Oe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(e,r):s=Oe.isURLSearchParams(e)?e.toString():new cv(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class B4{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(n){n!==null&&e(n)})}}const $4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},HW={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:cv,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},uv=typeof window<"u"&&typeof document<"u",fv=typeof navigator=="object"&&navigator||void 0,WW=uv&&(!fv||["ReactNative","NativeScript","NS"].indexOf(fv.product)<0),KW=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",VW=uv&&window.location.href||"http://localhost",Xn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:uv,hasStandardBrowserEnv:WW,hasStandardBrowserWebWorkerEnv:KW,navigator:fv,origin:VW},Symbol.toStringTag,{value:"Module"})),...HW};function GW(t,e){return b0(t,new Xn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Xn.isNode&&Oe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function YW(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function JW(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&Oe.isArray(i)?i.length:o,u?(Oe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Oe.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Oe.isArray(i[o])&&(i[o]=JW(i[o])),!a)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const r={};return Oe.forEachEntry(t,(n,i)=>{e(YW(n),i,r,0)}),r}return null}function XW(t,e,r){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const Hl={transitional:$4,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Oe.isObject(e);if(s&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return i?JSON.stringify(F4(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return GW(e,this.formSerializer).toString();if((a=Oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return b0(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),XW(e)):e}],transformResponse:[function(e){const r=this.transitional||Hl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ar.from(a,ar.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xn.classes.FormData,Blob:Xn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{Hl.headers[t]={}});const ZW=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),QW=t=>{const e={};let r,n,i;return t&&t.split(` +`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&ZW[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},j4=Symbol("internals");function Wl(t){return t&&String(t).trim().toLowerCase()}function y0(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(y0):String(t)}function eK(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const tK=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function lv(t,e,r,n,i){if(Oe.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Oe.isString(e)){if(Oe.isString(n))return e.indexOf(n)!==-1;if(Oe.isRegExp(n))return n.test(e)}}function rK(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function nK(t,e){const r=Oe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}let wi=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,u,l){const d=Wl(u);if(!d)throw new Error("header name must be a non-empty string");const p=Oe.findKey(i,d);(!p||i[p]===void 0||l===!0||l===void 0&&i[p]!==!1)&&(i[p||u]=y0(a))}const o=(a,u)=>Oe.forEach(a,(l,d)=>s(l,d,u));if(Oe.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(Oe.isString(e)&&(e=e.trim())&&!tK(e))o(QW(e),r);else if(Oe.isHeaders(e))for(const[a,u]of e.entries())s(u,a,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return eK(i);if(Oe.isFunction(r))return r.call(this,i,n);if(Oe.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||lv(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=Wl(o),o){const a=Oe.findKey(n,o);a&&(!r||lv(n,n[a],a,r))&&(delete n[a],i=!0)}}return Oe.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||lv(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Oe.forEach(this,(i,s)=>{const o=Oe.findKey(n,s);if(o){r[o]=y0(i),delete r[s];return}const a=e?rK(s):String(s).trim();a!==s&&delete r[s],r[a]=y0(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Oe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Oe.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[j4]=this[j4]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Wl(o);n[a]||(nK(i,o),n[a]=!0)}return Oe.isArray(e)?e.forEach(s):s(e),this}};wi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Oe.reduceDescriptors(wi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),Oe.freezeMethods(wi);function hv(t,e){const r=this||Hl,n=e||r,i=wi.from(n.headers);let s=n.data;return Oe.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function U4(t){return!!(t&&t.__CANCEL__)}function Nu(t,e,r){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,r),this.name="CanceledError"}Oe.inherits(Nu,ar,{__CANCEL__:!0});function q4(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new ar("Request failed with status code "+r.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function iK(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function sK(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),d=n[s];o||(o=l),r[i]=u,n[i]=l;let p=s,y=0;for(;p!==i;)y+=r[p++],p=p%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),l-o{r=d,i=null,s&&(clearTimeout(s),s=null),t.apply(null,l)};return[(...l)=>{const d=Date.now(),p=d-r;p>=n?o(l,d):(i=l,s||(s=setTimeout(()=>{s=null,o(i)},n-p)))},()=>i&&o(i)]}const w0=(t,e,r=3)=>{let n=0;const i=sK(50,250);return oK(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,u=o-n,l=i(u),d=o<=a;n=o;const p={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:l||void 0,estimated:l&&a&&d?(a-o)/l:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(p)},r)},z4=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},H4=t=>(...e)=>Oe.asap(()=>t(...e)),aK=Xn.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Xn.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Xn.origin),Xn.navigator&&/(msie|trident)/i.test(Xn.navigator.userAgent)):()=>!0,cK=Xn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];Oe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Oe.isString(n)&&o.push("path="+n),Oe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function uK(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function fK(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function W4(t,e){return t&&!uK(e)?fK(t,e):e}const K4=t=>t instanceof wi?{...t}:t;function gc(t,e){e=e||{};const r={};function n(l,d,p,y){return Oe.isPlainObject(l)&&Oe.isPlainObject(d)?Oe.merge.call({caseless:y},l,d):Oe.isPlainObject(d)?Oe.merge({},d):Oe.isArray(d)?d.slice():d}function i(l,d,p,y){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l,p,y)}else return n(l,d,p,y)}function s(l,d){if(!Oe.isUndefined(d))return n(void 0,d)}function o(l,d){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l)}else return n(void 0,d)}function a(l,d,p){if(p in e)return n(l,d);if(p in t)return n(void 0,l)}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,d,p)=>i(K4(l),K4(d),p,!0)};return Oe.forEach(Object.keys(Object.assign({},t,e)),function(d){const p=u[d]||i,y=p(t[d],e[d],d);Oe.isUndefined(y)&&p!==a||(r[d]=y)}),r}const V4=t=>{const e=gc({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=wi.from(o),e.url=k4(W4(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(Oe.isFormData(r)){if(Xn.hasStandardBrowserEnv||Xn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[l,...d]=u?u.split(";").map(p=>p.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...d].join("; "))}}if(Xn.hasStandardBrowserEnv&&(n&&Oe.isFunction(n)&&(n=n(e)),n||n!==!1&&aK(e.url))){const l=i&&s&&cK.read(s);l&&o.set(i,l)}return e},lK=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=V4(t);let s=i.data;const o=wi.from(i.headers).normalize();let{responseType:a,onUploadProgress:u,onDownloadProgress:l}=i,d,p,y,A,P;function N(){A&&A(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let D=new XMLHttpRequest;D.open(i.method.toUpperCase(),i.url,!0),D.timeout=i.timeout;function k(){if(!D)return;const j=wi.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),K={data:!a||a==="text"||a==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:j,config:t,request:D};q4(function(T){r(T),N()},function(T){n(T),N()},K),D=null}"onloadend"in D?D.onloadend=k:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(k)},D.onabort=function(){D&&(n(new ar("Request aborted",ar.ECONNABORTED,t,D)),D=null)},D.onerror=function(){n(new ar("Network Error",ar.ERR_NETWORK,t,D)),D=null},D.ontimeout=function(){let U=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const K=i.transitional||$4;i.timeoutErrorMessage&&(U=i.timeoutErrorMessage),n(new ar(U,K.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,D)),D=null},s===void 0&&o.setContentType(null),"setRequestHeader"in D&&Oe.forEach(o.toJSON(),function(U,K){D.setRequestHeader(K,U)}),Oe.isUndefined(i.withCredentials)||(D.withCredentials=!!i.withCredentials),a&&a!=="json"&&(D.responseType=i.responseType),l&&([y,P]=w0(l,!0),D.addEventListener("progress",y)),u&&D.upload&&([p,A]=w0(u),D.upload.addEventListener("progress",p),D.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(d=j=>{D&&(n(!j||j.type?new Nu(null,t,D):j),D.abort(),D=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const B=iK(i.url);if(B&&Xn.protocols.indexOf(B)===-1){n(new ar("Unsupported protocol "+B+":",ar.ERR_BAD_REQUEST,t));return}D.send(s||null)})},hK=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i;const s=function(l){if(!i){i=!0,a();const d=l instanceof Error?l:this.reason;n.abort(d instanceof ar?d:new Nu(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,s(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),t=null)};t.forEach(l=>l.addEventListener("abort",s));const{signal:u}=n;return u.unsubscribe=()=>Oe.asap(a),u}},dK=function*(t,e){let r=t.byteLength;if(r{const i=pK(t,e);let s=0,o,a=u=>{o||(o=!0,n&&n(u))};return new ReadableStream({async pull(u){try{const{done:l,value:d}=await i.next();if(l){a(),u.close();return}let p=d.byteLength;if(r){let y=s+=p;r(y)}u.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(u){return a(u),i.return()}},{highWaterMark:2})},x0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Y4=x0&&typeof ReadableStream=="function",mK=x0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),J4=(t,...e)=>{try{return!!t(...e)}catch{return!1}},vK=Y4&&J4(()=>{let t=!1;const e=new Request(Xn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),X4=64*1024,dv=Y4&&J4(()=>Oe.isReadableStream(new Response("").body)),_0={stream:dv&&(t=>t.body)};x0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!_0[e]&&(_0[e]=Oe.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,n)})})})(new Response);const bK=async t=>{if(t==null)return 0;if(Oe.isBlob(t))return t.size;if(Oe.isSpecCompliantForm(t))return(await new Request(Xn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(t)||Oe.isArrayBuffer(t))return t.byteLength;if(Oe.isURLSearchParams(t)&&(t=t+""),Oe.isString(t))return(await mK(t)).byteLength},yK=async(t,e)=>{const r=Oe.toFiniteNumber(t.getContentLength());return r??bK(e)},pv={http:jW,xhr:lK,fetch:x0&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:l,headers:d,withCredentials:p="same-origin",fetchOptions:y}=V4(t);l=l?(l+"").toLowerCase():"text";let A=hK([i,s&&s.toAbortSignal()],o),P;const N=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let D;try{if(u&&vK&&r!=="get"&&r!=="head"&&(D=await yK(d,n))!==0){let K=new Request(e,{method:"POST",body:n,duplex:"half"}),J;if(Oe.isFormData(n)&&(J=K.headers.get("content-type"))&&d.setContentType(J),K.body){const[T,z]=z4(D,w0(H4(u)));n=G4(K.body,X4,T,z)}}Oe.isString(p)||(p=p?"include":"omit");const k="credentials"in Request.prototype;P=new Request(e,{...y,signal:A,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:k?p:void 0});let B=await fetch(P);const j=dv&&(l==="stream"||l==="response");if(dv&&(a||j&&N)){const K={};["status","statusText","headers"].forEach(ue=>{K[ue]=B[ue]});const J=Oe.toFiniteNumber(B.headers.get("content-length")),[T,z]=a&&z4(J,w0(H4(a),!0))||[];B=new Response(G4(B.body,X4,T,()=>{z&&z(),N&&N()}),K)}l=l||"text";let U=await _0[Oe.findKey(_0,l)||"text"](B,t);return!j&&N&&N(),await new Promise((K,J)=>{q4(K,J,{data:U,headers:wi.from(B.headers),status:B.status,statusText:B.statusText,config:t,request:P})})}catch(k){throw N&&N(),k&&k.name==="TypeError"&&/fetch/i.test(k.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,P),{cause:k.cause||k}):ar.from(k,k&&k.code,t,P)}})};Oe.forEach(pv,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Z4=t=>`- ${t}`,wK=t=>Oe.isFunction(t)||t===null||t===!1,Q4={getAdapter:t=>{t=Oe.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : `+s.map(Z4).join(` -`):" "+Z4(s[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:dv};function pv(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Nu(null,t)}function e8(t){return pv(t),t.headers=wi.from(t.headers),t.data=lv.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Q4.getAdapter(t.adapter||Hl.adapter)(t).then(function(n){return pv(t),n.data=lv.call(t,t.transformResponse,n),n.headers=wi.from(n.headers),n},function(n){return U4(n)||(pv(t),n&&n.response&&(n.response.data=lv.call(t,t.transformResponse,n.response),n.response.headers=wi.from(n.response.headers))),Promise.reject(n)})}const t8="1.7.8",E0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{E0[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const r8={};E0.transitional=function(e,r,n){function i(s,o){return"[Axios v"+t8+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new ar(i(o," has been removed"+(r?" in "+r:"")),ar.ERR_DEPRECATED);return r&&!r8[o]&&(r8[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}},E0.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function xK(t,e,r){if(typeof t!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new ar("option "+s+" must be "+u,ar.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ar("Unknown option "+s,ar.ERR_BAD_OPTION)}}const S0={assertOptions:xK,validators:E0},Zs=S0.validators;let mc=class{constructor(e){this.defaults=e,this.interceptors={request:new B4,response:new B4}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` -`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=gc(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&S0.assertOptions(n,{silentJSONParsing:Zs.transitional(Zs.boolean),forcedJSONParsing:Zs.transitional(Zs.boolean),clarifyTimeoutError:Zs.transitional(Zs.boolean)},!1),i!=null&&(Oe.isFunction(i)?r.paramsSerializer={serialize:i}:S0.assertOptions(i,{encode:Zs.function,serialize:Zs.function},!0)),S0.assertOptions(r,{baseUrl:Zs.spelling("baseURL"),withXsrfToken:Zs.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Oe.merge(s.common,s[r.method]);s&&Oe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete s[P]}),r.headers=wi.concat(o,s);const a=[];let u=!0;this.interceptors.request.forEach(function(N){typeof N.runWhen=="function"&&N.runWhen(r)===!1||(u=u&&N.synchronous,a.unshift(N.fulfilled,N.rejected))});const l=[];this.interceptors.response.forEach(function(N){l.push(N.fulfilled,N.rejected)});let d,p=0,y;if(!u){const P=[e8.bind(this),void 0];for(P.unshift.apply(P,a),P.push.apply(P,l),y=P.length,d=Promise.resolve(r);p{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new Nu(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new JA(function(i){e=i}),cancel:e}}};function EK(t){return function(r){return t.apply(null,r)}}function SK(t){return Oe.isObject(t)&&t.isAxiosError===!0}const gv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(gv).forEach(([t,e])=>{gv[e]=t});function n8(t){const e=new mc(t),r=w4(mc.prototype.request,e);return Oe.extend(r,mc.prototype,e,{allOwnKeys:!0}),Oe.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return n8(gc(t,i))},r}const fn=n8(Hl);fn.Axios=mc,fn.CanceledError=Nu,fn.CancelToken=_K,fn.isCancel=U4,fn.VERSION=t8,fn.toFormData=b0,fn.AxiosError=ar,fn.Cancel=fn.CanceledError,fn.all=function(e){return Promise.all(e)},fn.spread=EK,fn.isAxiosError=SK,fn.mergeConfig=gc,fn.AxiosHeaders=wi,fn.formToJSON=t=>F4(Oe.isHTMLForm(t)?new FormData(t):t),fn.getAdapter=Q4.getAdapter,fn.HttpStatusCode=gv,fn.default=fn;const{Axios:$oe,AxiosError:i8,CanceledError:Foe,isCancel:joe,CancelToken:Uoe,VERSION:qoe,all:zoe,Cancel:Hoe,isAxiosError:Woe,spread:Koe,toFormData:Voe,AxiosHeaders:Goe,HttpStatusCode:Yoe,formToJSON:Joe,getAdapter:Xoe,mergeConfig:Zoe}=fn,s8=fn.create({timeout:6e4,headers:{"Content-Type":"application/json",token:localStorage.getItem("auth")}});function AK(t){var e,r,n;if(((e=t.data)==null?void 0:e.success)!==!0){const i=new i8((r=t.data)==null?void 0:r.errorMessage,(n=t.data)==null?void 0:n.errorCode,t.config,t.request,t);return Promise.reject(i)}else return t}function PK(t){var r;console.log(t);const e=(r=t.response)==null?void 0:r.data;if(e){console.log(e,"responseData");const n=new i8(e.errorMessage,t.code,t.config,t.request,t.response);return Promise.reject(n)}else return Promise.reject(t)}s8.interceptors.response.use(AK,PK);class MK{constructor(e){oo(this,"_apiBase","");this.request=e}setApiBase(e){this._apiBase=e||""}async getNonce(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/nonce`,e);return r.data}async getEmailCode(e,r){const{data:n}=await this.request.post(`${this._apiBase}/api/v2/user/get_code`,e,{headers:{"Captcha-Param":r}});return n.data}async emailLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async walletLogin(e){return e.account_enum==="C"?(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data:(await this.request.post(`${this._apiBase}/api/v2/business/login`,e)).data}async tonLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async bindEmail(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindTonWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindEvmWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}}const va=new MK(s8),IK={projectId:"7a4434fefbcc9af474fb5c995e47d286",metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},o8=eW({appName:"codatta",appLogoUrl:"https://avatars.githubusercontent.com/u/171659315"}),a8=Se.createContext({saveLastUsedWallet:()=>{},lastUsedWallet:null,wallets:[],initialized:!1,featuredWallets:[]});function Kl(){return Se.useContext(a8)}function CK(t){const{apiBaseUrl:e}=t,[r,n]=Se.useState([]),[i,s]=Se.useState([]),[o,a]=Se.useState(null),[u,l]=Se.useState(!1),d=A=>{console.log("saveLastUsedWallet",A)};function p(A){const P=A.filter(k=>k.featured||k.installed),N=A.filter(k=>!k.featured&&!k.installed),D=[...P,...N];n(D),s(P)}async function y(){const A=[],P=new Map;QA.forEach(D=>{const k=new Wf(D);D.name==="Coinbase Wallet"&&k.EIP6963Detected({info:{name:"Coinbase Wallet",uuid:"coinbase",icon:D.image,rdns:"coinbase"},provider:o8.getProvider()}),P.set(k.key,k),A.push(k)}),(await gz()).forEach(D=>{const k=P.get(D.info.name);if(k)k.EIP6963Detected(D);else{const B=new Wf(D);P.set(B.key,B),A.push(B)}});try{const D=JSON.parse(localStorage.getItem("xn-last-used-info")||"{}"),k=P.get(D.key);if(k){if(k.lastUsed=!0,D.provider==="UniversalProvider"){const B=await Q6.init(IK);B.session&&k.setUniversalProvider(B)}a(k)}}catch(D){console.log(D)}p(A),l(!0)}return Se.useEffect(()=>{y(),va.setApiBase(e)},[]),ge.jsx(a8.Provider,{value:{saveLastUsedWallet:d,wallets:r,initialized:u,lastUsedWallet:o,featuredWallets:i},children:t.children})}/** +`):" "+Z4(s[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:pv};function gv(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Nu(null,t)}function e8(t){return gv(t),t.headers=wi.from(t.headers),t.data=hv.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Q4.getAdapter(t.adapter||Hl.adapter)(t).then(function(n){return gv(t),n.data=hv.call(t,t.transformResponse,n),n.headers=wi.from(n.headers),n},function(n){return U4(n)||(gv(t),n&&n.response&&(n.response.data=hv.call(t,t.transformResponse,n.response),n.response.headers=wi.from(n.response.headers))),Promise.reject(n)})}const t8="1.7.8",E0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{E0[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const r8={};E0.transitional=function(e,r,n){function i(s,o){return"[Axios v"+t8+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new ar(i(o," has been removed"+(r?" in "+r:"")),ar.ERR_DEPRECATED);return r&&!r8[o]&&(r8[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}},E0.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function xK(t,e,r){if(typeof t!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new ar("option "+s+" must be "+u,ar.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ar("Unknown option "+s,ar.ERR_BAD_OPTION)}}const S0={assertOptions:xK,validators:E0},Zs=S0.validators;let mc=class{constructor(e){this.defaults=e,this.interceptors={request:new B4,response:new B4}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` +`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=gc(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&S0.assertOptions(n,{silentJSONParsing:Zs.transitional(Zs.boolean),forcedJSONParsing:Zs.transitional(Zs.boolean),clarifyTimeoutError:Zs.transitional(Zs.boolean)},!1),i!=null&&(Oe.isFunction(i)?r.paramsSerializer={serialize:i}:S0.assertOptions(i,{encode:Zs.function,serialize:Zs.function},!0)),S0.assertOptions(r,{baseUrl:Zs.spelling("baseURL"),withXsrfToken:Zs.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Oe.merge(s.common,s[r.method]);s&&Oe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete s[P]}),r.headers=wi.concat(o,s);const a=[];let u=!0;this.interceptors.request.forEach(function(N){typeof N.runWhen=="function"&&N.runWhen(r)===!1||(u=u&&N.synchronous,a.unshift(N.fulfilled,N.rejected))});const l=[];this.interceptors.response.forEach(function(N){l.push(N.fulfilled,N.rejected)});let d,p=0,y;if(!u){const P=[e8.bind(this),void 0];for(P.unshift.apply(P,a),P.push.apply(P,l),y=P.length,d=Promise.resolve(r);p{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new Nu(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new JA(function(i){e=i}),cancel:e}}};function EK(t){return function(r){return t.apply(null,r)}}function SK(t){return Oe.isObject(t)&&t.isAxiosError===!0}const mv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(mv).forEach(([t,e])=>{mv[e]=t});function n8(t){const e=new mc(t),r=w4(mc.prototype.request,e);return Oe.extend(r,mc.prototype,e,{allOwnKeys:!0}),Oe.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return n8(gc(t,i))},r}const fn=n8(Hl);fn.Axios=mc,fn.CanceledError=Nu,fn.CancelToken=_K,fn.isCancel=U4,fn.VERSION=t8,fn.toFormData=b0,fn.AxiosError=ar,fn.Cancel=fn.CanceledError,fn.all=function(e){return Promise.all(e)},fn.spread=EK,fn.isAxiosError=SK,fn.mergeConfig=gc,fn.AxiosHeaders=wi,fn.formToJSON=t=>F4(Oe.isHTMLForm(t)?new FormData(t):t),fn.getAdapter=Q4.getAdapter,fn.HttpStatusCode=mv,fn.default=fn;const{Axios:$oe,AxiosError:i8,CanceledError:Foe,isCancel:joe,CancelToken:Uoe,VERSION:qoe,all:zoe,Cancel:Hoe,isAxiosError:Woe,spread:Koe,toFormData:Voe,AxiosHeaders:Goe,HttpStatusCode:Yoe,formToJSON:Joe,getAdapter:Xoe,mergeConfig:Zoe}=fn,s8=fn.create({timeout:6e4,headers:{"Content-Type":"application/json",token:localStorage.getItem("auth")}});function AK(t){var e,r,n;if(((e=t.data)==null?void 0:e.success)!==!0){const i=new i8((r=t.data)==null?void 0:r.errorMessage,(n=t.data)==null?void 0:n.errorCode,t.config,t.request,t);return Promise.reject(i)}else return t}function PK(t){var r;console.log(t);const e=(r=t.response)==null?void 0:r.data;if(e){console.log(e,"responseData");const n=new i8(e.errorMessage,t.code,t.config,t.request,t.response);return Promise.reject(n)}else return Promise.reject(t)}s8.interceptors.response.use(AK,PK);class MK{constructor(e){oo(this,"_apiBase","");this.request=e}setApiBase(e){this._apiBase=e||""}async getNonce(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/nonce`,e);return r.data}async getEmailCode(e,r){const{data:n}=await this.request.post(`${this._apiBase}/api/v2/user/get_code`,e,{headers:{"Captcha-Param":r}});return n.data}async emailLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async walletLogin(e){return e.account_enum==="C"?(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data:(await this.request.post(`${this._apiBase}/api/v2/business/login`,e)).data}async tonLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async bindEmail(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindTonWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindEvmWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}}const va=new MK(s8),IK={projectId:"7a4434fefbcc9af474fb5c995e47d286",metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},o8=eW({appName:"codatta",appLogoUrl:"https://avatars.githubusercontent.com/u/171659315"}),a8=Se.createContext({saveLastUsedWallet:()=>{},lastUsedWallet:null,wallets:[],initialized:!1,featuredWallets:[]});function Kl(){return Se.useContext(a8)}function CK(t){const{apiBaseUrl:e}=t,[r,n]=Se.useState([]),[i,s]=Se.useState([]),[o,a]=Se.useState(null),[u,l]=Se.useState(!1),d=A=>{a(A);const N={provider:A.provider instanceof R1?"UniversalProvider":"EIP1193Provider",key:A.key,timestamp:Date.now()};localStorage.setItem("xn-last-used-info",JSON.stringify(N))};function p(A){const P=A.filter(k=>k.featured||k.installed),N=A.filter(k=>!k.featured&&!k.installed),D=[...P,...N];n(D),s(P)}async function y(){const A=[],P=new Map;QA.forEach(D=>{const k=new Wf(D);D.name==="Coinbase Wallet"&&k.EIP6963Detected({info:{name:"Coinbase Wallet",uuid:"coinbase",icon:D.image,rdns:"coinbase"},provider:o8.getProvider()}),P.set(k.key,k),A.push(k)}),(await gz()).forEach(D=>{const k=P.get(D.info.name);if(k)k.EIP6963Detected(D);else{const B=new Wf(D);P.set(B.key,B),A.push(B)}});try{const D=JSON.parse(localStorage.getItem("xn-last-used-info")||"{}"),k=P.get(D.key);if(k){if(k.lastUsed=!0,D.provider==="UniversalProvider"){const B=await R1.init(IK);B.session&&(k.setUniversalProvider(B),console.log("Restored UniversalProvider for wallet:",k.key))}else D.provider==="EIP1193Provider"&&k.installed&&console.log("Using detected EIP1193Provider for wallet:",k.key);a(k)}}catch(D){console.log(D)}p(A),l(!0)}return Se.useEffect(()=>{y(),va.setApiBase(e)},[]),ge.jsx(a8.Provider,{value:{saveLastUsedWallet:d,wallets:r,initialized:u,lastUsedWallet:o,featuredWallets:i},children:t.children})}/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -191,7 +191,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jK=ts("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]),h8=new Set;function A0(t,e,r){t||h8.has(e)||(console.warn(e),h8.add(e))}function UK(t){if(typeof Proxy>"u")return t;const e=new Map,r=(...n)=>(process.env.NODE_ENV!=="production"&&A0(!1,"motion() is deprecated. Use motion.create() instead."),t(...n));return new Proxy(r,{get:(n,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}function P0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const mv=t=>Array.isArray(t);function d8(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function vv(t,e,r,n){if(typeof e=="function"){const[i,s]=p8(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=p8(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function M0(t,e,r){const n=t.getProps();return vv(n,e,r!==void 0?r:n.custom,t)}const bv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],yv=["initial",...bv],Gl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],bc=new Set(Gl),Qs=t=>t*1e3,Do=t=>t/1e3,qK={type:"spring",stiffness:500,damping:25,restSpeed:10},zK=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),HK={type:"keyframes",duration:.8},WK={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},KK=(t,{keyframes:e})=>e.length>2?HK:bc.has(t)?t.startsWith("scale")?zK(e[1]):qK:WK;function wv(t,e){return t?t[e]||t.default||t:void 0}const VK={useManualTiming:!1},GK=t=>t!==null;function I0(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(GK),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const Wn=t=>t;function YK(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){s.has(l)&&(u.schedule(l),t()),l(o)}const u={schedule:(l,d=!1,p=!1)=>{const A=p&&n?e:r;return d&&s.add(l),A.has(l)||A.add(l),l},cancel:l=>{r.delete(l),s.delete(l)},process:l=>{if(o=l,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,u.process(l))}};return u}const C0=["read","resolveKeyframes","update","preRender","render","postRender"],JK=40;function g8(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=C0.reduce((k,B)=>(k[B]=YK(s),k),{}),{read:a,resolveKeyframes:u,update:l,preRender:d,render:p,postRender:y}=o,A=()=>{const k=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(k-i.timestamp,JK),1),i.timestamp=k,i.isProcessing=!0,a.process(i),u.process(i),l.process(i),d.process(i),p.process(i),y.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(A))},P=()=>{r=!0,n=!0,i.isProcessing||t(A)};return{schedule:C0.reduce((k,B)=>{const j=o[B];return k[B]=(U,K=!1,J=!1)=>(r||P(),j.schedule(U,K,J)),k},{}),cancel:k=>{for(let B=0;B(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,XK=1e-7,ZK=12;function QK(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=m8(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>XK&&++aQK(s,0,1,t,r);return s=>s===0||s===1?s:m8(i(s),e,n)}const v8=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,b8=t=>e=>1-t(1-e),y8=Yl(.33,1.53,.69,.99),_v=b8(y8),w8=v8(_v),x8=t=>(t*=2)<1?.5*_v(t):.5*(2-Math.pow(2,-10*(t-1))),Ev=t=>1-Math.sin(Math.acos(t)),_8=b8(Ev),E8=v8(Ev),S8=t=>/^0[^.\s]+$/u.test(t);function eV(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||S8(t):!0}let Lu=Wn,Oo=Wn;process.env.NODE_ENV!=="production"&&(Lu=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},Oo=(t,e)=>{if(!t)throw new Error(e)});const A8=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),P8=t=>e=>typeof e=="string"&&e.startsWith(t),M8=P8("--"),tV=P8("var(--"),Sv=t=>tV(t)?rV.test(t.split("/*")[0].trim()):!1,rV=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,nV=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function iV(t){const e=nV.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}const sV=4;function I8(t,e,r=1){Oo(r<=sV,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[n,i]=iV(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return A8(o)?parseFloat(o):o}return Sv(i)?I8(i,e,r+1):i}const ya=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},Jl={...ku,transform:t=>ya(0,1,t)},T0={...ku,default:1},Xl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),wa=Xl("deg"),eo=Xl("%"),zt=Xl("px"),oV=Xl("vh"),aV=Xl("vw"),C8={...eo,parse:t=>eo.parse(t)/100,transform:t=>eo.transform(t*100)},cV=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),T8=t=>t===ku||t===zt,R8=(t,e)=>parseFloat(t.split(", ")[e]),D8=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return R8(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?R8(s[1],t):0}},uV=new Set(["x","y","z"]),fV=Gl.filter(t=>!uV.has(t));function lV(t){const e=[];return fV.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const Bu={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:D8(4,13),y:D8(5,14)};Bu.translateX=Bu.x,Bu.translateY=Bu.y;const O8=t=>e=>e.test(t),N8=[ku,zt,eo,wa,aV,oV,{test:t=>t==="auto",parse:t=>t}],L8=t=>N8.find(O8(t)),yc=new Set;let Av=!1,Pv=!1;function k8(){if(Pv){const t=Array.from(yc).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=lV(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}Pv=!1,Av=!1,yc.forEach(t=>t.complete()),yc.clear()}function B8(){yc.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Pv=!0)})}function hV(){B8(),k8()}class Mv{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(yc.add(this),Av||(Av=!0,Nr.read(B8),Nr.resolveKeyframes(k8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sMath.round(t*1e5)/1e5,Iv=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function dV(t){return t==null}const pV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Cv=(t,e)=>r=>!!(typeof r=="string"&&pV.test(r)&&r.startsWith(t)||e&&!dV(r)&&Object.prototype.hasOwnProperty.call(r,e)),$8=(t,e,r)=>n=>{if(typeof n!="string")return n;const[i,s,o,a]=n.match(Iv);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},gV=t=>ya(0,255,t),Tv={...ku,transform:t=>Math.round(gV(t))},wc={test:Cv("rgb","red"),parse:$8("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+Tv.transform(t)+", "+Tv.transform(e)+", "+Tv.transform(r)+", "+Zl(Jl.transform(n))+")"};function mV(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const Rv={test:Cv("#"),parse:mV,transform:wc.transform},$u={test:Cv("hsl","hue"),parse:$8("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+eo.transform(Zl(e))+", "+eo.transform(Zl(r))+", "+Zl(Jl.transform(n))+")"},Zn={test:t=>wc.test(t)||Rv.test(t)||$u.test(t),parse:t=>wc.test(t)?wc.parse(t):$u.test(t)?$u.parse(t):Rv.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?wc.transform(t):$u.transform(t)},vV=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function bV(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Iv))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(vV))===null||r===void 0?void 0:r.length)||0)>0}const F8="number",j8="color",yV="var",wV="var(",U8="${}",xV=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ql(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(xV,u=>(Zn.test(u)?(n.color.push(s),i.push(j8),r.push(Zn.parse(u))):u.startsWith(wV)?(n.var.push(s),i.push(yV),r.push(u)):(n.number.push(s),i.push(F8),r.push(parseFloat(u))),++s,U8)).split(U8);return{values:r,split:a,indexes:n,types:i}}function q8(t){return Ql(t).values}function z8(t){const{split:e,types:r}=Ql(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function EV(t){const e=q8(t);return z8(t)(e.map(_V))}const xa={test:bV,parse:q8,createTransformer:z8,getAnimatableNone:EV},SV=new Set(["brightness","contrast","saturate","opacity"]);function AV(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(Iv)||[];if(!n)return t;const i=r.replace(n,"");let s=SV.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const PV=/\b([a-z-]*)\(.*?\)/gu,Dv={...xa,getAnimatableNone:t=>{const e=t.match(PV);return e?e.map(AV).join(" "):t}},MV={borderWidth:zt,borderTopWidth:zt,borderRightWidth:zt,borderBottomWidth:zt,borderLeftWidth:zt,borderRadius:zt,radius:zt,borderTopLeftRadius:zt,borderTopRightRadius:zt,borderBottomRightRadius:zt,borderBottomLeftRadius:zt,width:zt,maxWidth:zt,height:zt,maxHeight:zt,top:zt,right:zt,bottom:zt,left:zt,padding:zt,paddingTop:zt,paddingRight:zt,paddingBottom:zt,paddingLeft:zt,margin:zt,marginTop:zt,marginRight:zt,marginBottom:zt,marginLeft:zt,backgroundPositionX:zt,backgroundPositionY:zt},IV={rotate:wa,rotateX:wa,rotateY:wa,rotateZ:wa,scale:T0,scaleX:T0,scaleY:T0,scaleZ:T0,skew:wa,skewX:wa,skewY:wa,distance:zt,translateX:zt,translateY:zt,translateZ:zt,x:zt,y:zt,z:zt,perspective:zt,transformPerspective:zt,opacity:Jl,originX:C8,originY:C8,originZ:zt},H8={...ku,transform:Math.round},Ov={...MV,...IV,zIndex:H8,size:zt,fillOpacity:Jl,strokeOpacity:Jl,numOctaves:H8},CV={...Ov,color:Zn,backgroundColor:Zn,outlineColor:Zn,fill:Zn,stroke:Zn,borderColor:Zn,borderTopColor:Zn,borderRightColor:Zn,borderBottomColor:Zn,borderLeftColor:Zn,filter:Dv,WebkitFilter:Dv},Nv=t=>CV[t];function W8(t,e){let r=Nv(t);return r!==Dv&&(r=xa),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const TV=new Set(["auto","none","0"]);function RV(t,e,r){let n=0,i;for(;n{r.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function Lv(t){return typeof t=="function"}let R0;function DV(){R0=void 0}const to={now:()=>(R0===void 0&&to.set(Kn.isProcessing||VK.useManualTiming?Kn.timestamp:performance.now()),R0),set:t=>{R0=t,queueMicrotask(DV)}},V8=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(xa.test(t)||t==="0")&&!t.startsWith("url("));function OV(t){const e=t[0];if(t.length===1)return!0;for(let r=0;rLV?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&hV(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=to.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:u,isGenerator:l}=this.options;if(!l&&!NV(e,n,i,s))if(o)this.options.duration=0;else{u==null||u(I0(e,this.options,r)),a==null||a(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,r);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...d},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function Y8(t,e){return e?t*(1e3/e):0}const kV=5;function J8(t,e,r){const n=Math.max(e-kV,0);return Y8(r-t(n),e-n)}const kv=.001,BV=.01,X8=10,$V=.05,FV=1;function jV({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;Lu(t<=Qs(X8),"Spring duration must be 10 seconds or less");let o=1-e;o=ya($V,FV,o),t=ya(BV,X8,Do(t)),o<1?(i=l=>{const d=l*o,p=d*t,y=d-r,A=Bv(l,o),P=Math.exp(-p);return kv-y/A*P},s=l=>{const p=l*o*t,y=p*r+r,A=Math.pow(o,2)*Math.pow(l,2)*t,P=Math.exp(-p),N=Bv(Math.pow(l,2),o);return(-i(l)+kv>0?-1:1)*((y-A)*P)/N}):(i=l=>{const d=Math.exp(-l*t),p=(l-r)*t+1;return-kv+d*p},s=l=>{const d=Math.exp(-l*t),p=(r-l)*(t*t);return d*p});const a=5/t,u=qV(i,s,a);if(t=Qs(t),isNaN(u))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(u,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:t}}}const UV=12;function qV(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function WV(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!Z8(t,HV)&&Z8(t,zV)){const r=jV(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function Q8({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:u,mass:l,duration:d,velocity:p,isResolvedFromDuration:y}=WV({...n,velocity:-Do(n.velocity||0)}),A=p||0,P=u/(2*Math.sqrt(a*l)),N=s-i,D=Do(Math.sqrt(a/l)),k=Math.abs(N)<5;r||(r=k?.01:2),e||(e=k?.005:.5);let B;if(P<1){const j=Bv(D,P);B=U=>{const K=Math.exp(-P*D*U);return s-K*((A+P*D*N)/j*Math.sin(j*U)+N*Math.cos(j*U))}}else if(P===1)B=j=>s-Math.exp(-D*j)*(N+(A+D*N)*j);else{const j=D*Math.sqrt(P*P-1);B=U=>{const K=Math.exp(-P*D*U),J=Math.min(j*U,300);return s-K*((A+P*D*N)*Math.sinh(J)+j*N*Math.cosh(J))/j}}return{calculatedDuration:y&&d||null,next:j=>{const U=B(j);if(y)o.done=j>=d;else{let K=0;P<1&&(K=j===0?Qs(A):J8(B,j,U));const J=Math.abs(K)<=r,T=Math.abs(s-U)<=e;o.done=J&&T}return o.value=o.done?s:U,o}}}function eE({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:d}){const p=t[0],y={done:!1,value:p},A=z=>a!==void 0&&zu,P=z=>a===void 0?u:u===void 0||Math.abs(a-z)-N*Math.exp(-z/n),j=z=>k+B(z),U=z=>{const ue=B(z),_e=j(z);y.done=Math.abs(ue)<=l,y.value=y.done?k:_e};let K,J;const T=z=>{A(y.value)&&(K=z,J=Q8({keyframes:[y.value,P(y.value)],velocity:J8(j,z,y.value),damping:i,stiffness:s,restDelta:l,restSpeed:d}))};return T(0),{calculatedDuration:null,next:z=>{let ue=!1;return!J&&K===void 0&&(ue=!0,U(z),T(z)),K!==void 0&&z>=K?J.next(z-K):(!ue&&U(z),y)}}}const KV=Yl(.42,0,1,1),VV=Yl(0,0,.58,1),tE=Yl(.42,0,.58,1),GV=t=>Array.isArray(t)&&typeof t[0]!="number",$v=t=>Array.isArray(t)&&typeof t[0]=="number",rE={linear:Wn,easeIn:KV,easeInOut:tE,easeOut:VV,circIn:Ev,circInOut:E8,circOut:_8,backIn:_v,backInOut:w8,backOut:y8,anticipate:x8},nE=t=>{if($v(t)){Oo(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,r,n,i]=t;return Yl(e,r,n,i)}else if(typeof t=="string")return Oo(rE[t]!==void 0,`Invalid easing type '${t}'`),rE[t];return t},YV=(t,e)=>r=>e(t(r)),No=(...t)=>t.reduce(YV),Fu=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},Zr=(t,e,r)=>t+(e-t)*r;function Fv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function JV({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,u=2*r-a;i=Fv(u,a,t+1/3),s=Fv(u,a,t),o=Fv(u,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function D0(t,e){return r=>r>0?e:t}const jv=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},XV=[Rv,wc,$u],ZV=t=>XV.find(e=>e.test(t));function iE(t){const e=ZV(t);if(Lu(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let r=e.parse(t);return e===$u&&(r=JV(r)),r}const sE=(t,e)=>{const r=iE(t),n=iE(e);if(!r||!n)return D0(t,e);const i={...r};return s=>(i.red=jv(r.red,n.red,s),i.green=jv(r.green,n.green,s),i.blue=jv(r.blue,n.blue,s),i.alpha=Zr(r.alpha,n.alpha,s),wc.transform(i))},Uv=new Set(["none","hidden"]);function QV(t,e){return Uv.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function eG(t,e){return r=>Zr(t,e,r)}function qv(t){return typeof t=="number"?eG:typeof t=="string"?Sv(t)?D0:Zn.test(t)?sE:nG:Array.isArray(t)?oE:typeof t=="object"?Zn.test(t)?sE:tG:D0}function oE(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>qv(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function rG(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=xa.createTransformer(e),n=Ql(t),i=Ql(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?Uv.has(t)&&!i.values.length||Uv.has(e)&&!n.values.length?QV(t,e):No(oE(rG(n,i),i.values),r):(Lu(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),D0(t,e))};function aE(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Zr(t,e,r):qv(t)(t,e)}function iG(t,e,r){const n=[],i=r||aE,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=iG(e,n,i),a=o.length,u=l=>{let d=0;if(a>1)for(;du(ya(t[0],t[s-1],l)):u}function oG(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=Fu(0,e,n);t.push(Zr(r,1,i))}}function aG(t){const e=[0];return oG(e,t.length-1),e}function cG(t,e){return t.map(r=>r*e)}function uG(t,e){return t.map(()=>e||tE).splice(0,t.length-1)}function O0({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=GV(n)?n.map(nE):nE(n),s={done:!1,value:e[0]},o=cG(r&&r.length===e.length?r:aG(e),t),a=sG(o,e,{ease:Array.isArray(i)?i:uG(e,i)});return{calculatedDuration:t,next:u=>(s.value=a(u),s.done=u>=t,s)}}const cE=2e4;function fG(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=cE?1/0:e}const lG=t=>{const e=({timestamp:r})=>t(r);return{start:()=>Nr.update(e,!0),stop:()=>ba(e),now:()=>Kn.isProcessing?Kn.timestamp:to.now()}},hG={decay:eE,inertia:eE,tween:O0,keyframes:O0,spring:Q8},dG=t=>t/100;class zv extends G8{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:u}=this.options;u&&u()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Mv,a=(u,l)=>this.onKeyframesResolved(u,l);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=Lv(r)?r:hG[r]||O0;let u,l;a!==O0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&Oo(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),u=No(dG,aE(e[0],e[1])),e=[0,100]);const d=a({...this.options,keyframes:e});s==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=fG(d));const{calculatedDuration:p}=d,y=p+i,A=y*(n+1)-i;return{generator:d,mirroredGenerator:l,mapPercentToKeyframes:u,calculatedDuration:p,resolvedDuration:y,totalDuration:A}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:z}=this.options;return{done:!0,value:z[z.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:u,calculatedDuration:l,totalDuration:d,resolvedDuration:p}=n;if(this.startTime===null)return s.next(0);const{delay:y,repeat:A,repeatType:P,repeatDelay:N,onUpdate:D}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const k=this.currentTime-y*(this.speed>=0?1:-1),B=this.speed>=0?k<0:k>d;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let j=this.currentTime,U=s;if(A){const z=Math.min(this.currentTime,d)/p;let ue=Math.floor(z),_e=z%1;!_e&&z>=1&&(_e=1),_e===1&&ue--,ue=Math.min(ue,A+1),!!(ue%2)&&(P==="reverse"?(_e=1-_e,N&&(_e-=N/p)):P==="mirror"&&(U=o)),j=ya(0,1,_e)*p}const K=B?{done:!1,value:u[0]}:U.next(j);a&&(K.value=a(K.value));let{done:J}=K;!B&&l!==null&&(J=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&J);return T&&i!==void 0&&(K.value=I0(u,this.options,i)),D&&D(K.value),T&&this.finish(),K}get duration(){const{resolved:e}=this;return e?Do(e.calculatedDuration):0}get time(){return Do(this.currentTime)}set time(e){e=Qs(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=Do(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=lG,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const pG=new Set(["opacity","clipPath","filter","transform"]),gG=10,mG=(t,e)=>{let r="";const n=Math.max(Math.round(e/gG),2);for(let i=0;i(e===void 0&&(e=t()),e)}const vG={linearEasing:void 0};function bG(t,e){const r=Hv(t);return()=>{var n;return(n=vG[e])!==null&&n!==void 0?n:r()}}const N0=bG(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function uE(t){return!!(typeof t=="function"&&N0()||!t||typeof t=="string"&&(t in Wv||N0())||$v(t)||Array.isArray(t)&&t.every(uE))}const eh=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,Wv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:eh([0,.65,.55,1]),circOut:eh([.55,0,1,.45]),backIn:eh([.31,.01,.66,-.59]),backOut:eh([.33,1.53,.69,.99])};function fE(t,e){if(t)return typeof t=="function"&&N0()?mG(t,e):$v(t)?eh(t):Array.isArray(t)?t.map(r=>fE(r,e)||Wv.easeOut):Wv[t]}function yG(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:u}={}){const l={[e]:r};u&&(l.offset=u);const d=fE(a,i);return Array.isArray(d)&&(l.easing=d),t.animate(l,{delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function lE(t,e){t.timeline=e,t.onfinish=null}const wG=Hv(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),L0=10,xG=2e4;function _G(t){return Lv(t.type)||t.type==="spring"||!uE(t.ease)}function EG(t,e){const r=new zv({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&sthis.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:u,name:l,startTime:d}=this.options;if(!(!((n=u.owner)===null||n===void 0)&&n.current))return!1;if(typeof o=="string"&&N0()&&SG(o)&&(o=hE[o]),_G(this.options)){const{onComplete:y,onUpdate:A,motionValue:P,element:N,...D}=this.options,k=EG(e,D);e=k.keyframes,e.length===1&&(e[1]=e[0]),i=k.duration,s=k.times,o=k.ease,a="keyframes"}const p=yG(u.owner.current,l,e,{...this.options,duration:i,times:s,ease:o});return p.startTime=d??this.calcStartTime(),this.pendingTimeline?(lE(p,this.pendingTimeline),this.pendingTimeline=void 0):p.onfinish=()=>{const{onComplete:y}=this.options;u.set(I0(e,this.options,r)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:p,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return Do(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return Do(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=Qs(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return Wn;const{animation:n}=r;lE(n,e)}return Wn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:d,onComplete:p,element:y,...A}=this.options,P=new zv({...A,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),N=Qs(this.time);l.setWithVelocity(P.sample(N-L0).value,P.sample(N).value,L0)}const{onStop:u}=this.options;u&&u(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return wG()&&n&&pG.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}const AG=Hv(()=>window.ScrollTimeline!==void 0);class PG{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;nAG()&&i.attachTimeline?i.attachTimeline(e):r(i));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function MG({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:u,elapsed:l,...d}){return!!Object.keys(d).length}const Kv=(t,e,r,n={},i,s)=>o=>{const a=wv(n,t)||{},u=a.delay||n.delay||0;let{elapsed:l=0}=n;l=l-Qs(u);let d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:y=>{e.set(y),a.onUpdate&&a.onUpdate(y)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:i};MG(a)||(d={...d,...KK(t,d)}),d.duration&&(d.duration=Qs(d.duration)),d.repeatDelay&&(d.repeatDelay=Qs(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let p=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(p=!0)),p&&!s&&e.get()!==void 0){const y=I0(d.keyframes,a);if(y!==void 0)return Nr.update(()=>{d.onUpdate(y),d.onComplete()}),new PG([])}return!s&&dE.supports(d)?new dE(d):new zv(d)},IG=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),CG=t=>mv(t)?t[t.length-1]||0:t;function Vv(t,e){t.indexOf(e)===-1&&t.push(e)}function Gv(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class Yv{constructor(){this.subscriptions=[]}add(e){return Vv(this.subscriptions,e),()=>Gv(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class RG{constructor(e,r={}){this.version="11.11.17",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=to.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=to.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=TG(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&A0(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new Yv);const n=this.events[e].add(r);return e==="change"?()=>{n(),Nr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=to.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>pE)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,pE);return Y8(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function th(t,e){return new RG(t,e)}function DG(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,th(r))}function OG(t,e){const r=M0(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=CG(s[o]);DG(t,o,a)}}const Jv=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),gE="data-"+Jv("framerAppearId");function mE(t){return t.props[gE]}const Qn=t=>!!(t&&t.getVelocity);function NG(t){return!!(Qn(t)&&t.add)}function Xv(t,e){const r=t.getValue("willChange");if(NG(r))return r.add(e)}function LG({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function vE(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...u}=e;n&&(o=n);const l=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const p in u){const y=t.getValue(p,(s=t.latestValues[p])!==null&&s!==void 0?s:null),A=u[p];if(A===void 0||d&&LG(d,p))continue;const P={delay:r,...wv(o||{},p)};let N=!1;if(window.MotionHandoffAnimation){const k=mE(t);if(k){const B=window.MotionHandoffAnimation(k,p,Nr);B!==null&&(P.startTime=B,N=!0)}}Xv(t,p),y.start(Kv(p,y,A,t.shouldReduceMotion&&bc.has(p)?{type:!1}:P,t,N));const D=y.animation;D&&l.push(D)}return a&&Promise.all(l).then(()=>{Nr.update(()=>{a&&OG(t,a)})}),l}function Zv(t,e,r={}){var n;const i=M0(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(vE(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:y}=s;return kG(t,e,d+l,p,y,r)}:()=>Promise.resolve(),{when:u}=s;if(u){const[l,d]=u==="beforeChildren"?[o,a]:[a,o];return l().then(()=>d())}else return Promise.all([o(),a(r.delay)])}function kG(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,u=i===1?(l=0)=>l*n:(l=0)=>a-l*n;return Array.from(t.variantChildren).sort(BG).forEach((l,d)=>{l.notify("AnimationStart",e),o.push(Zv(l,e,{...s,delay:r+u(d)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function BG(t,e){return t.sortNodePosition(e)}function $G(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>Zv(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=Zv(t,e,r);else{const i=typeof e=="function"?M0(t,e,r.custom):e;n=Promise.all(vE(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const FG=yv.length;function bE(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?bE(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;rPromise.all(e.map(({animation:r,options:n})=>$G(t,r,n)))}function zG(t){let e=qG(t),r=yE(),n=!0;const i=u=>(l,d)=>{var p;const y=M0(t,d,u==="exit"?(p=t.presenceContext)===null||p===void 0?void 0:p.custom:void 0);if(y){const{transition:A,transitionEnd:P,...N}=y;l={...l,...N,...P}}return l};function s(u){e=u(t)}function o(u){const{props:l}=t,d=bE(t.parent)||{},p=[],y=new Set;let A={},P=1/0;for(let D=0;DP&&U,ue=!1;const _e=Array.isArray(j)?j:[j];let G=_e.reduce(i(k),{});K===!1&&(G={});const{prevResolvedValues:E={}}=B,m={...E,...G},f=x=>{z=!0,y.has(x)&&(ue=!0,y.delete(x)),B.needsAnimating[x]=!0;const _=t.getValue(x);_&&(_.liveStyle=!1)};for(const x in m){const _=G[x],S=E[x];if(A.hasOwnProperty(x))continue;let b=!1;mv(_)&&mv(S)?b=!d8(_,S):b=_!==S,b?_!=null?f(x):y.add(x):_!==void 0&&y.has(x)?f(x):B.protectedKeys[x]=!0}B.prevProp=j,B.prevResolvedValues=G,B.isActive&&(A={...A,...G}),n&&t.blockInitialAnimation&&(z=!1),z&&(!(J&&T)||ue)&&p.push(..._e.map(x=>({animation:x,options:{type:k}})))}if(y.size){const D={};y.forEach(k=>{const B=t.getBaseTarget(k),j=t.getValue(k);j&&(j.liveStyle=!0),D[k]=B??null}),p.push({animation:D})}let N=!!p.length;return n&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(N=!1),n=!1,N?e(p):Promise.resolve()}function a(u,l){var d;if(r[u].isActive===l)return Promise.resolve();(d=t.variantChildren)===null||d===void 0||d.forEach(y=>{var A;return(A=y.animationState)===null||A===void 0?void 0:A.setActive(u,l)}),r[u].isActive=l;const p=o(u);for(const y in r)r[y].protectedKeys={};return p}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=yE(),n=!0}}}function HG(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!d8(e,t):!1}function xc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function yE(){return{animate:xc(!0),whileInView:xc(),whileHover:xc(),whileTap:xc(),whileDrag:xc(),whileFocus:xc(),exit:xc()}}class _a{constructor(e){this.isMounted=!1,this.node=e}update(){}}class WG extends _a{constructor(e){super(e),e.animationState||(e.animationState=zG(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();P0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let KG=0;class VG extends _a{constructor(){super(...arguments),this.id=KG++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const GG={animation:{Feature:WG},exit:{Feature:VG}},wE=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function k0(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const YG=t=>e=>wE(e)&&t(e,k0(e));function Lo(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function ko(t,e,r,n){return Lo(t,e,YG(r),n)}const xE=(t,e)=>Math.abs(t-e);function JG(t,e){const r=xE(t.x,e.x),n=xE(t.y,e.y);return Math.sqrt(r**2+n**2)}class _E{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=eb(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,A=JG(p.offset,{x:0,y:0})>=3;if(!y&&!A)return;const{point:P}=p,{timestamp:N}=Kn;this.history.push({...P,timestamp:N});const{onStart:D,onMove:k}=this.handlers;y||(D&&D(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,p)},this.handlePointerMove=(p,y)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=Qv(y,this.transformPagePoint),Nr.update(this.updatePoint,!0)},this.handlePointerUp=(p,y)=>{this.end();const{onEnd:A,onSessionEnd:P,resumeAnimation:N}=this.handlers;if(this.dragSnapToOrigin&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=eb(p.type==="pointercancel"?this.lastMoveEventInfo:Qv(y,this.transformPagePoint),this.history);this.startEvent&&A&&A(p,D),P&&P(p,D)},!wE(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=k0(e),a=Qv(o,this.transformPagePoint),{point:u}=a,{timestamp:l}=Kn;this.history=[{...u,timestamp:l}];const{onSessionStart:d}=r;d&&d(e,eb(a,this.history)),this.removeListeners=No(ko(this.contextWindow,"pointermove",this.handlePointerMove),ko(this.contextWindow,"pointerup",this.handlePointerUp),ko(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),ba(this.updatePoint)}}function Qv(t,e){return e?{point:e(t.point)}:t}function EE(t,e){return{x:t.x-e.x,y:t.y-e.y}}function eb({point:t},e){return{point:t,delta:EE(t,SE(e)),offset:EE(t,XG(e)),velocity:ZG(e,.1)}}function XG(t){return t[0]}function SE(t){return t[t.length-1]}function ZG(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=SE(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>Qs(e)));)r--;if(!n)return{x:0,y:0};const s=Do(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function AE(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const PE=AE("dragHorizontal"),ME=AE("dragVertical");function IE(t){let e=!1;if(t==="y")e=ME();else if(t==="x")e=PE();else{const r=PE(),n=ME();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function CE(){const t=IE(!0);return t?(t(),!1):!0}function ju(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const TE=1e-4,QG=1-TE,eY=1+TE,RE=.01,tY=0-RE,rY=0+RE;function Ni(t){return t.max-t.min}function nY(t,e,r){return Math.abs(t-e)<=r}function DE(t,e,r,n=.5){t.origin=n,t.originPoint=Zr(e.min,e.max,t.origin),t.scale=Ni(r)/Ni(e),t.translate=Zr(r.min,r.max,t.origin)-t.originPoint,(t.scale>=QG&&t.scale<=eY||isNaN(t.scale))&&(t.scale=1),(t.translate>=tY&&t.translate<=rY||isNaN(t.translate))&&(t.translate=0)}function rh(t,e,r,n){DE(t.x,e.x,r.x,n?n.originX:void 0),DE(t.y,e.y,r.y,n?n.originY:void 0)}function OE(t,e,r){t.min=r.min+e.min,t.max=t.min+Ni(e)}function iY(t,e,r){OE(t.x,e.x,r.x),OE(t.y,e.y,r.y)}function NE(t,e,r){t.min=e.min-r.min,t.max=t.min+Ni(e)}function nh(t,e,r){NE(t.x,e.x,r.x),NE(t.y,e.y,r.y)}function sY(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?Zr(r,t,n.max):Math.min(t,r)),t}function LE(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function oY(t,{top:e,left:r,bottom:n,right:i}){return{x:LE(t.x,r,i),y:LE(t.y,e,n)}}function kE(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=Fu(e.min,e.max-n,t.min):n>i&&(r=Fu(t.min,t.max-i,e.min)),ya(0,1,r)}function uY(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const tb=.35;function fY(t=tb){return t===!1?t=0:t===!0&&(t=tb),{x:BE(t,"left","right"),y:BE(t,"top","bottom")}}function BE(t,e,r){return{min:$E(t,e),max:$E(t,r)}}function $E(t,e){return typeof t=="number"?t:t[e]||0}const FE=()=>({translate:0,scale:1,origin:0,originPoint:0}),Uu=()=>({x:FE(),y:FE()}),jE=()=>({min:0,max:0}),ln=()=>({x:jE(),y:jE()});function rs(t){return[t("x"),t("y")]}function UE({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function lY({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function hY(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function rb(t){return t===void 0||t===1}function nb({scale:t,scaleX:e,scaleY:r}){return!rb(t)||!rb(e)||!rb(r)}function _c(t){return nb(t)||qE(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function qE(t){return zE(t.x)||zE(t.y)}function zE(t){return t&&t!=="0%"}function B0(t,e,r){const n=t-r,i=e*n;return r+i}function HE(t,e,r,n,i){return i!==void 0&&(t=B0(t,i,n)),B0(t,r,n)+e}function ib(t,e=0,r=1,n,i){t.min=HE(t.min,e,r,n,i),t.max=HE(t.max,e,r,n,i)}function WE(t,{x:e,y:r}){ib(t.x,e.translate,e.scale,e.originPoint),ib(t.y,r.translate,r.scale,r.originPoint)}const KE=.999999999999,VE=1.0000000000001;function dY(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;aKE&&(e.x=1),e.yKE&&(e.y=1)}function qu(t,e){t.min=t.min+e,t.max=t.max+e}function GE(t,e,r,n,i=.5){const s=Zr(t.min,t.max,i);ib(t,e,r,s,n)}function zu(t,e){GE(t.x,e.x,e.scaleX,e.scale,e.originX),GE(t.y,e.y,e.scaleY,e.scale,e.originY)}function YE(t,e){return UE(hY(t.getBoundingClientRect(),e))}function pY(t,e,r){const n=YE(t,r),{scroll:i}=e;return i&&(qu(n.x,i.offset.x),qu(n.y,i.offset.y)),n}const JE=({current:t})=>t?t.ownerDocument.defaultView:null,gY=new WeakMap;class mY{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ln(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:p}=this.getProps();p?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(k0(d,"page").point)},s=(d,p)=>{const{drag:y,dragPropagation:A,onDragStart:P}=this.getProps();if(y&&!A&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=IE(y),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),rs(D=>{let k=this.getAxisMotionValue(D).get()||0;if(eo.test(k)){const{projection:B}=this.visualElement;if(B&&B.layout){const j=B.layout.layoutBox[D];j&&(k=Ni(j)*(parseFloat(k)/100))}}this.originPoint[D]=k}),P&&Nr.postRender(()=>P(d,p)),Xv(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},o=(d,p)=>{const{dragPropagation:y,dragDirectionLock:A,onDirectionLock:P,onDrag:N}=this.getProps();if(!y&&!this.openGlobalLock)return;const{offset:D}=p;if(A&&this.currentDirection===null){this.currentDirection=vY(D),this.currentDirection!==null&&P&&P(this.currentDirection);return}this.updateAxis("x",p.point,D),this.updateAxis("y",p.point,D),this.visualElement.render(),N&&N(d,p)},a=(d,p)=>this.stop(d,p),u=()=>rs(d=>{var p;return this.getAnimationState(d)==="paused"&&((p=this.getAxisMotionValue(d).animation)===null||p===void 0?void 0:p.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new _E(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:JE(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Nr.postRender(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!$0(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=sY(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&ju(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=oY(i.layoutBox,r):this.constraints=!1,this.elastic=fY(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&rs(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=uY(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!ju(e))return!1;const n=e.current;Oo(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=pY(n,i.root,this.visualElement.getTransformPagePoint());let o=aY(i.layout.layoutBox,s);if(r){const a=r(lY(o));this.hasMutatedConstraints=!!a,a&&(o=UE(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),u=this.constraints||{},l=rs(d=>{if(!$0(d,r,this.currentDirection))return;let p=u&&u[d]||{};o&&(p={min:0,max:0});const y=i?200:1e6,A=i?40:1e7,P={type:"inertia",velocity:n?e[d]:0,bounceStiffness:y,bounceDamping:A,timeConstant:750,restDelta:1,restSpeed:10,...s,...p};return this.startAxisValueAnimation(d,P)});return Promise.all(l).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return Xv(this.visualElement,e),n.start(Kv(e,n,0,r,this.visualElement,!1))}stopAnimation(){rs(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){rs(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){rs(r=>{const{drag:n}=this.getProps();if(!$0(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-Zr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!ju(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};rs(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const u=a.get();i[o]=cY({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),rs(o=>{if(!$0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:u,max:l}=this.constraints[o];a.set(Zr(u,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;gY.set(this.visualElement,this);const e=this.visualElement.current,r=ko(e,"pointerdown",u=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();ju(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Nr.read(n);const o=Lo(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(rs(d=>{const p=this.getAxisMotionValue(d);p&&(this.originPoint[d]+=u[d].translate,p.set(p.get()+u[d].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=tb,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function $0(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function vY(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class bY extends _a{constructor(e){super(e),this.removeGroupControls=Wn,this.removeListeners=Wn,this.controls=new mY(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Wn}unmount(){this.removeGroupControls(),this.removeListeners()}}const XE=t=>(e,r)=>{t&&Nr.postRender(()=>t(e,r))};class yY extends _a{constructor(){super(...arguments),this.removePointerDownListener=Wn}onPointerDown(e){this.session=new _E(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:JE(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:XE(e),onStart:XE(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&Nr.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=ko(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const F0=Se.createContext(null);function wY(){const t=Se.useContext(F0);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=Se.useId();Se.useEffect(()=>n(i),[]);const s=Se.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const sb=Se.createContext({}),ZE=Se.createContext({}),j0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function QE(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ih={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(zt.test(t))t=parseFloat(t);else return t;const r=QE(t,e.target.x),n=QE(t,e.target.y);return`${r}% ${n}%`}},xY={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=xa.parse(t);if(i.length>5)return n;const s=xa.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,u=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=u;const l=Zr(a,u,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),s(i)}},U0={};function _Y(t){Object.assign(U0,t)}const{schedule:ob}=g8(queueMicrotask,!1);class EY extends Se.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;_Y(SY),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),j0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Nr.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ob.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function eS(t){const[e,r]=wY(),n=Se.useContext(sb);return ge.jsx(EY,{...t,layoutGroup:n,switchLayoutGroup:Se.useContext(ZE),isPresent:e,safeToRemove:r})}const SY={borderRadius:{...ih,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ih,borderTopRightRadius:ih,borderBottomLeftRadius:ih,borderBottomRightRadius:ih,boxShadow:xY},tS=["TopLeft","TopRight","BottomLeft","BottomRight"],AY=tS.length,rS=t=>typeof t=="string"?parseFloat(t):t,nS=t=>typeof t=="number"||zt.test(t);function PY(t,e,r,n,i,s){i?(t.opacity=Zr(0,r.opacity!==void 0?r.opacity:1,MY(n)),t.opacityExit=Zr(e.opacity!==void 0?e.opacity:1,0,IY(n))):s&&(t.opacity=Zr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(Fu(t,e,n))}function oS(t,e){t.min=e.min,t.max=e.max}function ns(t,e){oS(t.x,e.x),oS(t.y,e.y)}function aS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function cS(t,e,r,n,i){return t-=e,t=B0(t,1/r,n),i!==void 0&&(t=B0(t,1/i,n)),t}function CY(t,e=0,r=1,n=.5,i,s=t,o=t){if(eo.test(e)&&(e=parseFloat(e),e=Zr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Zr(s.min,s.max,n);t===s&&(a-=e),t.min=cS(t.min,e,r,a,i),t.max=cS(t.max,e,r,a,i)}function uS(t,e,[r,n,i],s,o){CY(t,e[r],e[n],e[i],e.scale,s,o)}const TY=["x","scaleX","originX"],RY=["y","scaleY","originY"];function fS(t,e,r,n){uS(t.x,e,TY,r?r.x:void 0,n?n.x:void 0),uS(t.y,e,RY,r?r.y:void 0,n?n.y:void 0)}function lS(t){return t.translate===0&&t.scale===1}function hS(t){return lS(t.x)&&lS(t.y)}function dS(t,e){return t.min===e.min&&t.max===e.max}function DY(t,e){return dS(t.x,e.x)&&dS(t.y,e.y)}function pS(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function gS(t,e){return pS(t.x,e.x)&&pS(t.y,e.y)}function mS(t){return Ni(t.x)/Ni(t.y)}function vS(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class OY{constructor(){this.members=[]}add(e){Vv(this.members,e),e.scheduleRender()}remove(e){if(Gv(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function NY(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:l,rotate:d,rotateX:p,rotateY:y,skewX:A,skewY:P}=r;l&&(n=`perspective(${l}px) ${n}`),d&&(n+=`rotate(${d}deg) `),p&&(n+=`rotateX(${p}deg) `),y&&(n+=`rotateY(${y}deg) `),A&&(n+=`skewX(${A}deg) `),P&&(n+=`skewY(${P}deg) `)}const a=t.x.scale*e.x,u=t.y.scale*e.y;return(a!==1||u!==1)&&(n+=`scale(${a}, ${u})`),n||"none"}const LY=(t,e)=>t.depth-e.depth;class kY{constructor(){this.children=[],this.isDirty=!1}add(e){Vv(this.children,e),this.isDirty=!0}remove(e){Gv(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(LY),this.isDirty=!1,this.children.forEach(e)}}function q0(t){const e=Qn(t)?t.get():t;return IG(e)?e.toValue():e}function BY(t,e){const r=to.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(ba(n),t(s-e))};return Nr.read(n,!0),()=>ba(n)}function $Y(t){return t instanceof SVGElement&&t.tagName!=="svg"}function FY(t,e,r){const n=Qn(t)?t:th(t);return n.start(Kv("",n,e,r)),n.animation}const Ec={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},sh=typeof window<"u"&&window.MotionDebug!==void 0,ab=["","X","Y","Z"],jY={visibility:"hidden"},bS=1e3;let UY=0;function cb(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function yS(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=mE(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Nr,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&yS(n)}function wS({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=UY++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,sh&&(Ec.totalNodes=Ec.resolvedTargetDeltas=Ec.recalculatedProjection=0),this.nodes.forEach(HY),this.nodes.forEach(YY),this.nodes.forEach(JY),this.nodes.forEach(WY),sh&&window.MotionDebug.record(Ec)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let u=0;uthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,p&&p(),p=BY(y,250),j0.hasAnimatedSinceResize&&(j0.hasAnimatedSinceResize=!1,this.nodes.forEach(_S))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&d&&(u||l)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:y,hasRelativeTargetChanged:A,layout:P})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const N=this.options.transition||d.getDefaultTransition()||tJ,{onLayoutAnimationStart:D,onLayoutAnimationComplete:k}=d.getProps(),B=!this.targetLayout||!gS(this.targetLayout,P)||A,j=!y&&A;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||j||y&&(B||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(p,j);const U={...wv(N,"layout"),onPlay:D,onComplete:k};(d.shouldReduceMotion||this.options.layoutRoot)&&(U.delay=0,U.type=!1),this.startAnimation(U)}else y||_S(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=P})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,ba(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(XY),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&yS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u{const K=U/1e3;ES(p.x,o.x,K),ES(p.y,o.y,K),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(nh(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),QY(this.relativeTarget,this.relativeTargetOrigin,y,K),j&&DY(this.relativeTarget,j)&&(this.isProjectionDirty=!1),j||(j=ln()),ns(j,this.relativeTarget)),N&&(this.animationValues=d,PY(d,l,this.latestValues,K,B,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=K},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(ba(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nr.update(()=>{j0.hasAnimatedSinceResize=!0,this.currentAnimation=FY(0,bS,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(bS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:u,layout:l,latestValues:d}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&IS(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||ln();const p=Ni(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+p;const y=Ni(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+y}ns(a,u),zu(a,d),rh(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new OY),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(a=!0),!a)return;const l={};u.z&&cb("z",o,l,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(xS),this.root.sharedNodes.clear()}}}function qY(t){t.updateLayout()}function zY(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?rs(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],A=Ni(y);y.min=n[p].min,y.max=y.min+A}):IS(s,r.layoutBox,n)&&rs(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],A=Ni(n[p]);y.max=y.min+A,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[p].max=t.relativeTarget[p].min+A)});const a=Uu();rh(a,n,r.layoutBox);const u=Uu();o?rh(u,t.applyTransform(i,!0),r.measuredBox):rh(u,n,r.layoutBox);const l=!hS(a);let d=!1;if(!t.resumeFrom){const p=t.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:y,layout:A}=p;if(y&&A){const P=ln();nh(P,r.layoutBox,y.layoutBox);const N=ln();nh(N,n,A.layoutBox),gS(P,N)||(d=!0),p.options.layoutRoot&&(t.relativeTarget=N,t.relativeTargetOrigin=P,t.relativeParent=p)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:u,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function HY(t){sh&&Ec.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function WY(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function KY(t){t.clearSnapshot()}function xS(t){t.clearMeasurements()}function VY(t){t.isLayoutDirty=!1}function GY(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function _S(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function YY(t){t.resolveTargetDelta()}function JY(t){t.calcProjection()}function XY(t){t.resetSkewAndRotation()}function ZY(t){t.removeLeadSnapshot()}function ES(t,e,r){t.translate=Zr(e.translate,0,r),t.scale=Zr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function SS(t,e,r,n){t.min=Zr(e.min,r.min,n),t.max=Zr(e.max,r.max,n)}function QY(t,e,r,n){SS(t.x,e.x,r.x,n),SS(t.y,e.y,r.y,n)}function eJ(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const tJ={duration:.45,ease:[.4,0,.1,1]},AS=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),PS=AS("applewebkit/")&&!AS("chrome/")?Math.round:Wn;function MS(t){t.min=PS(t.min),t.max=PS(t.max)}function rJ(t){MS(t.x),MS(t.y)}function IS(t,e,r){return t==="position"||t==="preserve-aspect"&&!nY(mS(e),mS(r),.2)}function nJ(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const iJ=wS({attachResizeListener:(t,e)=>Lo(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ub={current:void 0},CS=wS({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!ub.current){const t=new iJ({});t.mount(window),t.setOptions({layoutScroll:!0}),ub.current=t}return ub.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),sJ={pan:{Feature:yY},drag:{Feature:bY,ProjectionNode:CS,MeasureLayout:eS}};function TS(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||CE())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const u=a[n];u&&Nr.postRender(()=>u(s,o))};return ko(t.current,r,i,{passive:!t.getProps()[n]})}class oJ extends _a{mount(){this.unmount=No(TS(this.node,!0),TS(this.node,!1))}unmount(){}}class aJ extends _a{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=No(Lo(this.node.current,"focus",()=>this.onFocus()),Lo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const RS=(t,e)=>e?t===e?!0:RS(t,e.parentElement):!1;function fb(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,k0(r))}class cJ extends _a{constructor(){super(...arguments),this.removeStartListeners=Wn,this.removeEndListeners=Wn,this.removeAccessibleListeners=Wn,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=ko(window,"pointerup",(a,u)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:d,globalTapTarget:p}=this.node.getProps(),y=!p&&!RS(this.node.current,a.target)?d:l;y&&Nr.update(()=>y(a,u))},{passive:!(n.onTap||n.onPointerUp)}),o=ko(window,"pointercancel",(a,u)=>this.cancelPress(a,u),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=No(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||fb("up",(u,l)=>{const{onTap:d}=this.node.getProps();d&&Nr.postRender(()=>d(u,l))})};this.removeEndListeners(),this.removeEndListeners=Lo(this.node.current,"keyup",o),fb("down",(a,u)=>{this.startPress(a,u)})},r=Lo(this.node.current,"keydown",e),n=()=>{this.isPressing&&fb("cancel",(s,o)=>this.cancelPress(s,o))},i=Lo(this.node.current,"blur",n);this.removeAccessibleListeners=No(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Nr.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!CE()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Nr.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=ko(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=Lo(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=No(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const lb=new WeakMap,hb=new WeakMap,uJ=t=>{const e=lb.get(t.target);e&&e(t)},fJ=t=>{t.forEach(uJ)};function lJ({root:t,...e}){const r=t||document;hb.has(r)||hb.set(r,{});const n=hb.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(fJ,{root:t,...e})),n[i]}function hJ(t,e,r){const n=lJ(e);return lb.set(t,r),n.observe(t),()=>{lb.delete(t),n.unobserve(t)}}const dJ={some:0,all:1};class pJ extends _a{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:dJ[i]},a=u=>{const{isIntersecting:l}=u;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:p}=this.node.getProps(),y=l?d:p;y&&y(u)};return hJ(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(gJ(e,r))&&this.startObserver()}unmount(){}}function gJ({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const mJ={inView:{Feature:pJ},tap:{Feature:cJ},focus:{Feature:aJ},hover:{Feature:oJ}},vJ={layout:{ProjectionNode:CS,MeasureLayout:eS}},db=Se.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),z0=Se.createContext({}),pb=typeof window<"u",DS=pb?Se.useLayoutEffect:Se.useEffect,OS=Se.createContext({strict:!1});function bJ(t,e,r,n,i){var s,o;const{visualElement:a}=Se.useContext(z0),u=Se.useContext(OS),l=Se.useContext(F0),d=Se.useContext(db).reducedMotion,p=Se.useRef();n=n||u.renderer,!p.current&&n&&(p.current=n(t,{visualState:e,parent:a,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d}));const y=p.current,A=Se.useContext(ZE);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&yJ(p.current,r,i,A);const P=Se.useRef(!1);Se.useInsertionEffect(()=>{y&&P.current&&y.update(r,l)});const N=r[gE],D=Se.useRef(!!N&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,N))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,N)));return DS(()=>{y&&(P.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),ob.render(y.render),D.current&&y.animationState&&y.animationState.animateChanges())}),Se.useEffect(()=>{y&&(!D.current&&y.animationState&&y.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{var k;(k=window.MotionHandoffMarkAsComplete)===null||k===void 0||k.call(window,N)}),D.current=!1))}),y}function yJ(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:u,layoutRoot:l}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:NS(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&ju(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:u,layoutRoot:l})}function NS(t){if(t)return t.options.allowProjection!==!1?t.projection:NS(t.parent)}function wJ(t,e,r){return Se.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):ju(r)&&(r.current=n))},[e])}function H0(t){return P0(t.animate)||yv.some(e=>Vl(t[e]))}function LS(t){return!!(H0(t)||t.variants)}function xJ(t,e){if(H0(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Vl(r)?r:void 0,animate:Vl(n)?n:void 0}}return t.inherit!==!1?e:{}}function _J(t){const{initial:e,animate:r}=xJ(t,Se.useContext(z0));return Se.useMemo(()=>({initial:e,animate:r}),[kS(e),kS(r)])}function kS(t){return Array.isArray(t)?t.join(" "):t}const BS={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Hu={};for(const t in BS)Hu[t]={isEnabled:e=>BS[t].some(r=>!!e[r])};function EJ(t){for(const e in t)Hu[e]={...Hu[e],...t[e]}}const SJ=Symbol.for("motionComponentSymbol");function AJ({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&EJ(t);function s(a,u){let l;const d={...Se.useContext(db),...a,layoutId:PJ(a)},{isStatic:p}=d,y=_J(a),A=n(a,p);if(!p&&pb){MJ(d,t);const P=IJ(d);l=P.MeasureLayout,y.visualElement=bJ(i,A,d,e,P.ProjectionNode)}return ge.jsxs(z0.Provider,{value:y,children:[l&&y.visualElement?ge.jsx(l,{visualElement:y.visualElement,...d}):null,r(i,a,wJ(A,y.visualElement,u),A,p,y.visualElement)]})}const o=Se.forwardRef(s);return o[SJ]=i,o}function PJ({layoutId:t}){const e=Se.useContext(sb).id;return e&&t!==void 0?e+"-"+t:t}function MJ(t,e){const r=Se.useContext(OS).strict;if(process.env.NODE_ENV!=="production"&&e&&r){const n="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?Lu(!1,n):Oo(!1,n)}}function IJ(t){const{drag:e,layout:r}=Hu;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const CJ=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function gb(t){return typeof t!="string"||t.includes("-")?!1:!!(CJ.indexOf(t)>-1||/[A-Z]/u.test(t))}function $S(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const FS=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function jS(t,e,r,n){$S(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(FS.has(i)?i:Jv(i),e.attrs[i])}function US(t,{layout:e,layoutId:r}){return bc.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!U0[t]||t==="opacity")}function mb(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(Qn(i[o])||e.style&&Qn(e.style[o])||US(o,t)||((n=r==null?void 0:r.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function qS(t,e,r){const n=mb(t,e,r);for(const i in t)if(Qn(t[i])||Qn(e[i])){const s=Gl.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function vb(t){const e=Se.useRef(null);return e.current===null&&(e.current=t()),e.current}function TJ({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:RJ(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const zS=t=>(e,r)=>{const n=Se.useContext(z0),i=Se.useContext(F0),s=()=>TJ(t,e,n,i);return r?s():vb(s)};function RJ(t,e,r,n){const i={},s=n(t,{});for(const y in s)i[y]=q0(s[y]);let{initial:o,animate:a}=t;const u=H0(t),l=LS(t);e&&l&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const p=d?a:o;if(p&&typeof p!="boolean"&&!P0(p)){const y=Array.isArray(p)?p:[p];for(let A=0;A({style:{},transform:{},transformOrigin:{},vars:{}}),HS=()=>({...bb(),attrs:{}}),WS=(t,e)=>e&&typeof t=="number"?e.transform(t):t,DJ={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},OJ=Gl.length;function NJ(t,e,r){let n="",i=!0;for(let s=0;stypeof t=="string"&&t.toLowerCase()==="svg",FJ={useVisualState:zS({scrapeMotionValuesFromProps:qS,createRenderState:HS,onMount:(t,e,{renderState:r,latestValues:n})=>{Nr.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),Nr.render(()=>{wb(r,n,xb(e.tagName),t.transformTemplate),jS(e,r)})}})},jJ={useVisualState:zS({scrapeMotionValuesFromProps:mb,createRenderState:bb})};function VS(t,e,r){for(const n in e)!Qn(e[n])&&!US(n,r)&&(t[n]=e[n])}function UJ({transformTemplate:t},e){return Se.useMemo(()=>{const r=bb();return yb(r,e,t),Object.assign({},r.vars,r.style)},[e])}function qJ(t,e){const r=t.style||{},n={};return VS(n,r,t),Object.assign(n,UJ(t,e)),n}function zJ(t,e){const r={},n=qJ(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const HJ=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function W0(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||HJ.has(t)}let GS=t=>!W0(t);function WJ(t){t&&(GS=e=>e.startsWith("on")?!W0(e):t(e))}try{WJ(require("@emotion/is-prop-valid").default)}catch{}function KJ(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(GS(i)||r===!0&&W0(i)||!e&&!W0(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function VJ(t,e,r,n){const i=Se.useMemo(()=>{const s=HS();return wb(s,e,xb(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};VS(s,t.style,t),i.style={...s,...i.style}}return i}function GJ(t=!1){return(r,n,i,{latestValues:s},o)=>{const u=(gb(r)?VJ:zJ)(n,s,o,r),l=KJ(n,typeof r=="string",t),d=r!==Se.Fragment?{...l,...u,ref:i}:{},{children:p}=n,y=Se.useMemo(()=>Qn(p)?p.get():p,[p]);return Se.createElement(r,{...d,children:y})}}function YJ(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...gb(n)?FJ:jJ,preloadedFeatures:t,useRender:GJ(i),createVisualElement:e,Component:n};return AJ(o)}}const _b={current:null},YS={current:!1};function JJ(){if(YS.current=!0,!!pb)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>_b.current=t.matches;t.addListener(e),e()}else _b.current=!1}function XJ(t,e,r){for(const n in e){const i=e[n],s=r[n];if(Qn(i))t.addValue(n,i),process.env.NODE_ENV==="development"&&A0(i.version==="11.11.17",`Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`);else if(Qn(s))t.addValue(n,th(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,th(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const JS=new WeakMap,ZJ=[...N8,Zn,xa],QJ=t=>ZJ.find(O8(t)),XS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class eX{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Mv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=to.now();this.renderScheduledAtthis.bindToMotionValue(n,r)),YS.current||JJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:_b.current,process.env.NODE_ENV!=="production"&&A0(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){JS.delete(this.current),this.projection&&this.projection.unmount(),ba(this.notifyUpdate),ba(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=bc.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Nr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Hu){const r=Hu[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ln()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=th(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(A8(i)||S8(i))?i=parseFloat(i):!QJ(i)&&xa.test(r)&&(i=W8(e,r)),this.setBaseTarget(e,Qn(i)?i.get():i)),Qn(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=vv(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Qn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new Yv),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class ZS extends eX{constructor(){super(...arguments),this.KeyframeResolver=K8}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function tX(t){return window.getComputedStyle(t)}class rX extends ZS{constructor(){super(...arguments),this.type="html",this.renderInstance=$S}readValueFromInstance(e,r){if(bc.has(r)){const n=Nv(r);return n&&n.default||0}else{const n=tX(e),i=(M8(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return YE(e,r)}build(e,r,n){yb(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return mb(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Qn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class nX extends ZS{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ln}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(bc.has(r)){const n=Nv(r);return n&&n.default||0}return r=FS.has(r)?r:Jv(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return qS(e,r,n)}build(e,r,n){wb(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){jS(e,r,n,i)}mount(e){this.isSVGTag=xb(e.tagName),super.mount(e)}}const iX=(t,e)=>gb(t)?new nX(e):new rX(e,{allowProjection:t!==Se.Fragment}),sX=YJ({...GG,...mJ,...sJ,...vJ},iX),oX=UK(sX);class aX extends Yt.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function cX({children:t,isPresent:e}){const r=Se.useId(),n=Se.useRef(null),i=Se.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=Se.useContext(db);return Se.useInsertionEffect(()=>{const{width:o,height:a,top:u,left:l}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` + */const jK=ts("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]),h8=new Set;function A0(t,e,r){t||h8.has(e)||(console.warn(e),h8.add(e))}function UK(t){if(typeof Proxy>"u")return t;const e=new Map,r=(...n)=>(process.env.NODE_ENV!=="production"&&A0(!1,"motion() is deprecated. Use motion.create() instead."),t(...n));return new Proxy(r,{get:(n,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}function P0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const vv=t=>Array.isArray(t);function d8(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function bv(t,e,r,n){if(typeof e=="function"){const[i,s]=p8(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=p8(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function M0(t,e,r){const n=t.getProps();return bv(n,e,r!==void 0?r:n.custom,t)}const yv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],wv=["initial",...yv],Gl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],bc=new Set(Gl),Qs=t=>t*1e3,Do=t=>t/1e3,qK={type:"spring",stiffness:500,damping:25,restSpeed:10},zK=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),HK={type:"keyframes",duration:.8},WK={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},KK=(t,{keyframes:e})=>e.length>2?HK:bc.has(t)?t.startsWith("scale")?zK(e[1]):qK:WK;function xv(t,e){return t?t[e]||t.default||t:void 0}const VK={useManualTiming:!1},GK=t=>t!==null;function I0(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(GK),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const Wn=t=>t;function YK(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){s.has(l)&&(u.schedule(l),t()),l(o)}const u={schedule:(l,d=!1,p=!1)=>{const A=p&&n?e:r;return d&&s.add(l),A.has(l)||A.add(l),l},cancel:l=>{r.delete(l),s.delete(l)},process:l=>{if(o=l,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,u.process(l))}};return u}const C0=["read","resolveKeyframes","update","preRender","render","postRender"],JK=40;function g8(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=C0.reduce((k,B)=>(k[B]=YK(s),k),{}),{read:a,resolveKeyframes:u,update:l,preRender:d,render:p,postRender:y}=o,A=()=>{const k=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(k-i.timestamp,JK),1),i.timestamp=k,i.isProcessing=!0,a.process(i),u.process(i),l.process(i),d.process(i),p.process(i),y.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(A))},P=()=>{r=!0,n=!0,i.isProcessing||t(A)};return{schedule:C0.reduce((k,B)=>{const j=o[B];return k[B]=(U,K=!1,J=!1)=>(r||P(),j.schedule(U,K,J)),k},{}),cancel:k=>{for(let B=0;B(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,XK=1e-7,ZK=12;function QK(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=m8(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>XK&&++aQK(s,0,1,t,r);return s=>s===0||s===1?s:m8(i(s),e,n)}const v8=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,b8=t=>e=>1-t(1-e),y8=Yl(.33,1.53,.69,.99),Ev=b8(y8),w8=v8(Ev),x8=t=>(t*=2)<1?.5*Ev(t):.5*(2-Math.pow(2,-10*(t-1))),Sv=t=>1-Math.sin(Math.acos(t)),_8=b8(Sv),E8=v8(Sv),S8=t=>/^0[^.\s]+$/u.test(t);function eV(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||S8(t):!0}let Lu=Wn,Oo=Wn;process.env.NODE_ENV!=="production"&&(Lu=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},Oo=(t,e)=>{if(!t)throw new Error(e)});const A8=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),P8=t=>e=>typeof e=="string"&&e.startsWith(t),M8=P8("--"),tV=P8("var(--"),Av=t=>tV(t)?rV.test(t.split("/*")[0].trim()):!1,rV=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,nV=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function iV(t){const e=nV.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}const sV=4;function I8(t,e,r=1){Oo(r<=sV,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[n,i]=iV(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return A8(o)?parseFloat(o):o}return Av(i)?I8(i,e,r+1):i}const ya=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},Jl={...ku,transform:t=>ya(0,1,t)},T0={...ku,default:1},Xl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),wa=Xl("deg"),eo=Xl("%"),zt=Xl("px"),oV=Xl("vh"),aV=Xl("vw"),C8={...eo,parse:t=>eo.parse(t)/100,transform:t=>eo.transform(t*100)},cV=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),T8=t=>t===ku||t===zt,R8=(t,e)=>parseFloat(t.split(", ")[e]),D8=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return R8(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?R8(s[1],t):0}},uV=new Set(["x","y","z"]),fV=Gl.filter(t=>!uV.has(t));function lV(t){const e=[];return fV.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const Bu={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:D8(4,13),y:D8(5,14)};Bu.translateX=Bu.x,Bu.translateY=Bu.y;const O8=t=>e=>e.test(t),N8=[ku,zt,eo,wa,aV,oV,{test:t=>t==="auto",parse:t=>t}],L8=t=>N8.find(O8(t)),yc=new Set;let Pv=!1,Mv=!1;function k8(){if(Mv){const t=Array.from(yc).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=lV(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}Mv=!1,Pv=!1,yc.forEach(t=>t.complete()),yc.clear()}function B8(){yc.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Mv=!0)})}function hV(){B8(),k8()}class Iv{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(yc.add(this),Pv||(Pv=!0,Nr.read(B8),Nr.resolveKeyframes(k8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sMath.round(t*1e5)/1e5,Cv=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function dV(t){return t==null}const pV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Tv=(t,e)=>r=>!!(typeof r=="string"&&pV.test(r)&&r.startsWith(t)||e&&!dV(r)&&Object.prototype.hasOwnProperty.call(r,e)),$8=(t,e,r)=>n=>{if(typeof n!="string")return n;const[i,s,o,a]=n.match(Cv);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},gV=t=>ya(0,255,t),Rv={...ku,transform:t=>Math.round(gV(t))},wc={test:Tv("rgb","red"),parse:$8("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+Rv.transform(t)+", "+Rv.transform(e)+", "+Rv.transform(r)+", "+Zl(Jl.transform(n))+")"};function mV(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const Dv={test:Tv("#"),parse:mV,transform:wc.transform},$u={test:Tv("hsl","hue"),parse:$8("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+eo.transform(Zl(e))+", "+eo.transform(Zl(r))+", "+Zl(Jl.transform(n))+")"},Zn={test:t=>wc.test(t)||Dv.test(t)||$u.test(t),parse:t=>wc.test(t)?wc.parse(t):$u.test(t)?$u.parse(t):Dv.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?wc.transform(t):$u.transform(t)},vV=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function bV(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Cv))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(vV))===null||r===void 0?void 0:r.length)||0)>0}const F8="number",j8="color",yV="var",wV="var(",U8="${}",xV=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ql(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(xV,u=>(Zn.test(u)?(n.color.push(s),i.push(j8),r.push(Zn.parse(u))):u.startsWith(wV)?(n.var.push(s),i.push(yV),r.push(u)):(n.number.push(s),i.push(F8),r.push(parseFloat(u))),++s,U8)).split(U8);return{values:r,split:a,indexes:n,types:i}}function q8(t){return Ql(t).values}function z8(t){const{split:e,types:r}=Ql(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function EV(t){const e=q8(t);return z8(t)(e.map(_V))}const xa={test:bV,parse:q8,createTransformer:z8,getAnimatableNone:EV},SV=new Set(["brightness","contrast","saturate","opacity"]);function AV(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(Cv)||[];if(!n)return t;const i=r.replace(n,"");let s=SV.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const PV=/\b([a-z-]*)\(.*?\)/gu,Ov={...xa,getAnimatableNone:t=>{const e=t.match(PV);return e?e.map(AV).join(" "):t}},MV={borderWidth:zt,borderTopWidth:zt,borderRightWidth:zt,borderBottomWidth:zt,borderLeftWidth:zt,borderRadius:zt,radius:zt,borderTopLeftRadius:zt,borderTopRightRadius:zt,borderBottomRightRadius:zt,borderBottomLeftRadius:zt,width:zt,maxWidth:zt,height:zt,maxHeight:zt,top:zt,right:zt,bottom:zt,left:zt,padding:zt,paddingTop:zt,paddingRight:zt,paddingBottom:zt,paddingLeft:zt,margin:zt,marginTop:zt,marginRight:zt,marginBottom:zt,marginLeft:zt,backgroundPositionX:zt,backgroundPositionY:zt},IV={rotate:wa,rotateX:wa,rotateY:wa,rotateZ:wa,scale:T0,scaleX:T0,scaleY:T0,scaleZ:T0,skew:wa,skewX:wa,skewY:wa,distance:zt,translateX:zt,translateY:zt,translateZ:zt,x:zt,y:zt,z:zt,perspective:zt,transformPerspective:zt,opacity:Jl,originX:C8,originY:C8,originZ:zt},H8={...ku,transform:Math.round},Nv={...MV,...IV,zIndex:H8,size:zt,fillOpacity:Jl,strokeOpacity:Jl,numOctaves:H8},CV={...Nv,color:Zn,backgroundColor:Zn,outlineColor:Zn,fill:Zn,stroke:Zn,borderColor:Zn,borderTopColor:Zn,borderRightColor:Zn,borderBottomColor:Zn,borderLeftColor:Zn,filter:Ov,WebkitFilter:Ov},Lv=t=>CV[t];function W8(t,e){let r=Lv(t);return r!==Ov&&(r=xa),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const TV=new Set(["auto","none","0"]);function RV(t,e,r){let n=0,i;for(;n{r.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function kv(t){return typeof t=="function"}let R0;function DV(){R0=void 0}const to={now:()=>(R0===void 0&&to.set(Kn.isProcessing||VK.useManualTiming?Kn.timestamp:performance.now()),R0),set:t=>{R0=t,queueMicrotask(DV)}},V8=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(xa.test(t)||t==="0")&&!t.startsWith("url("));function OV(t){const e=t[0];if(t.length===1)return!0;for(let r=0;rLV?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&hV(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=to.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:u,isGenerator:l}=this.options;if(!l&&!NV(e,n,i,s))if(o)this.options.duration=0;else{u==null||u(I0(e,this.options,r)),a==null||a(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,r);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...d},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function Y8(t,e){return e?t*(1e3/e):0}const kV=5;function J8(t,e,r){const n=Math.max(e-kV,0);return Y8(r-t(n),e-n)}const Bv=.001,BV=.01,X8=10,$V=.05,FV=1;function jV({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;Lu(t<=Qs(X8),"Spring duration must be 10 seconds or less");let o=1-e;o=ya($V,FV,o),t=ya(BV,X8,Do(t)),o<1?(i=l=>{const d=l*o,p=d*t,y=d-r,A=$v(l,o),P=Math.exp(-p);return Bv-y/A*P},s=l=>{const p=l*o*t,y=p*r+r,A=Math.pow(o,2)*Math.pow(l,2)*t,P=Math.exp(-p),N=$v(Math.pow(l,2),o);return(-i(l)+Bv>0?-1:1)*((y-A)*P)/N}):(i=l=>{const d=Math.exp(-l*t),p=(l-r)*t+1;return-Bv+d*p},s=l=>{const d=Math.exp(-l*t),p=(r-l)*(t*t);return d*p});const a=5/t,u=qV(i,s,a);if(t=Qs(t),isNaN(u))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(u,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:t}}}const UV=12;function qV(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function WV(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!Z8(t,HV)&&Z8(t,zV)){const r=jV(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function Q8({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:u,mass:l,duration:d,velocity:p,isResolvedFromDuration:y}=WV({...n,velocity:-Do(n.velocity||0)}),A=p||0,P=u/(2*Math.sqrt(a*l)),N=s-i,D=Do(Math.sqrt(a/l)),k=Math.abs(N)<5;r||(r=k?.01:2),e||(e=k?.005:.5);let B;if(P<1){const j=$v(D,P);B=U=>{const K=Math.exp(-P*D*U);return s-K*((A+P*D*N)/j*Math.sin(j*U)+N*Math.cos(j*U))}}else if(P===1)B=j=>s-Math.exp(-D*j)*(N+(A+D*N)*j);else{const j=D*Math.sqrt(P*P-1);B=U=>{const K=Math.exp(-P*D*U),J=Math.min(j*U,300);return s-K*((A+P*D*N)*Math.sinh(J)+j*N*Math.cosh(J))/j}}return{calculatedDuration:y&&d||null,next:j=>{const U=B(j);if(y)o.done=j>=d;else{let K=0;P<1&&(K=j===0?Qs(A):J8(B,j,U));const J=Math.abs(K)<=r,T=Math.abs(s-U)<=e;o.done=J&&T}return o.value=o.done?s:U,o}}}function eE({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:d}){const p=t[0],y={done:!1,value:p},A=z=>a!==void 0&&zu,P=z=>a===void 0?u:u===void 0||Math.abs(a-z)-N*Math.exp(-z/n),j=z=>k+B(z),U=z=>{const ue=B(z),_e=j(z);y.done=Math.abs(ue)<=l,y.value=y.done?k:_e};let K,J;const T=z=>{A(y.value)&&(K=z,J=Q8({keyframes:[y.value,P(y.value)],velocity:J8(j,z,y.value),damping:i,stiffness:s,restDelta:l,restSpeed:d}))};return T(0),{calculatedDuration:null,next:z=>{let ue=!1;return!J&&K===void 0&&(ue=!0,U(z),T(z)),K!==void 0&&z>=K?J.next(z-K):(!ue&&U(z),y)}}}const KV=Yl(.42,0,1,1),VV=Yl(0,0,.58,1),tE=Yl(.42,0,.58,1),GV=t=>Array.isArray(t)&&typeof t[0]!="number",Fv=t=>Array.isArray(t)&&typeof t[0]=="number",rE={linear:Wn,easeIn:KV,easeInOut:tE,easeOut:VV,circIn:Sv,circInOut:E8,circOut:_8,backIn:Ev,backInOut:w8,backOut:y8,anticipate:x8},nE=t=>{if(Fv(t)){Oo(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,r,n,i]=t;return Yl(e,r,n,i)}else if(typeof t=="string")return Oo(rE[t]!==void 0,`Invalid easing type '${t}'`),rE[t];return t},YV=(t,e)=>r=>e(t(r)),No=(...t)=>t.reduce(YV),Fu=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},Zr=(t,e,r)=>t+(e-t)*r;function jv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function JV({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,u=2*r-a;i=jv(u,a,t+1/3),s=jv(u,a,t),o=jv(u,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function D0(t,e){return r=>r>0?e:t}const Uv=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},XV=[Dv,wc,$u],ZV=t=>XV.find(e=>e.test(t));function iE(t){const e=ZV(t);if(Lu(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let r=e.parse(t);return e===$u&&(r=JV(r)),r}const sE=(t,e)=>{const r=iE(t),n=iE(e);if(!r||!n)return D0(t,e);const i={...r};return s=>(i.red=Uv(r.red,n.red,s),i.green=Uv(r.green,n.green,s),i.blue=Uv(r.blue,n.blue,s),i.alpha=Zr(r.alpha,n.alpha,s),wc.transform(i))},qv=new Set(["none","hidden"]);function QV(t,e){return qv.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function eG(t,e){return r=>Zr(t,e,r)}function zv(t){return typeof t=="number"?eG:typeof t=="string"?Av(t)?D0:Zn.test(t)?sE:nG:Array.isArray(t)?oE:typeof t=="object"?Zn.test(t)?sE:tG:D0}function oE(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>zv(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function rG(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=xa.createTransformer(e),n=Ql(t),i=Ql(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?qv.has(t)&&!i.values.length||qv.has(e)&&!n.values.length?QV(t,e):No(oE(rG(n,i),i.values),r):(Lu(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),D0(t,e))};function aE(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Zr(t,e,r):zv(t)(t,e)}function iG(t,e,r){const n=[],i=r||aE,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=iG(e,n,i),a=o.length,u=l=>{let d=0;if(a>1)for(;du(ya(t[0],t[s-1],l)):u}function oG(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=Fu(0,e,n);t.push(Zr(r,1,i))}}function aG(t){const e=[0];return oG(e,t.length-1),e}function cG(t,e){return t.map(r=>r*e)}function uG(t,e){return t.map(()=>e||tE).splice(0,t.length-1)}function O0({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=GV(n)?n.map(nE):nE(n),s={done:!1,value:e[0]},o=cG(r&&r.length===e.length?r:aG(e),t),a=sG(o,e,{ease:Array.isArray(i)?i:uG(e,i)});return{calculatedDuration:t,next:u=>(s.value=a(u),s.done=u>=t,s)}}const cE=2e4;function fG(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=cE?1/0:e}const lG=t=>{const e=({timestamp:r})=>t(r);return{start:()=>Nr.update(e,!0),stop:()=>ba(e),now:()=>Kn.isProcessing?Kn.timestamp:to.now()}},hG={decay:eE,inertia:eE,tween:O0,keyframes:O0,spring:Q8},dG=t=>t/100;class Hv extends G8{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:u}=this.options;u&&u()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Iv,a=(u,l)=>this.onKeyframesResolved(u,l);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=kv(r)?r:hG[r]||O0;let u,l;a!==O0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&Oo(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),u=No(dG,aE(e[0],e[1])),e=[0,100]);const d=a({...this.options,keyframes:e});s==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=fG(d));const{calculatedDuration:p}=d,y=p+i,A=y*(n+1)-i;return{generator:d,mirroredGenerator:l,mapPercentToKeyframes:u,calculatedDuration:p,resolvedDuration:y,totalDuration:A}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:z}=this.options;return{done:!0,value:z[z.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:u,calculatedDuration:l,totalDuration:d,resolvedDuration:p}=n;if(this.startTime===null)return s.next(0);const{delay:y,repeat:A,repeatType:P,repeatDelay:N,onUpdate:D}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const k=this.currentTime-y*(this.speed>=0?1:-1),B=this.speed>=0?k<0:k>d;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let j=this.currentTime,U=s;if(A){const z=Math.min(this.currentTime,d)/p;let ue=Math.floor(z),_e=z%1;!_e&&z>=1&&(_e=1),_e===1&&ue--,ue=Math.min(ue,A+1),!!(ue%2)&&(P==="reverse"?(_e=1-_e,N&&(_e-=N/p)):P==="mirror"&&(U=o)),j=ya(0,1,_e)*p}const K=B?{done:!1,value:u[0]}:U.next(j);a&&(K.value=a(K.value));let{done:J}=K;!B&&l!==null&&(J=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&J);return T&&i!==void 0&&(K.value=I0(u,this.options,i)),D&&D(K.value),T&&this.finish(),K}get duration(){const{resolved:e}=this;return e?Do(e.calculatedDuration):0}get time(){return Do(this.currentTime)}set time(e){e=Qs(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=Do(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=lG,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const pG=new Set(["opacity","clipPath","filter","transform"]),gG=10,mG=(t,e)=>{let r="";const n=Math.max(Math.round(e/gG),2);for(let i=0;i(e===void 0&&(e=t()),e)}const vG={linearEasing:void 0};function bG(t,e){const r=Wv(t);return()=>{var n;return(n=vG[e])!==null&&n!==void 0?n:r()}}const N0=bG(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function uE(t){return!!(typeof t=="function"&&N0()||!t||typeof t=="string"&&(t in Kv||N0())||Fv(t)||Array.isArray(t)&&t.every(uE))}const eh=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,Kv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:eh([0,.65,.55,1]),circOut:eh([.55,0,1,.45]),backIn:eh([.31,.01,.66,-.59]),backOut:eh([.33,1.53,.69,.99])};function fE(t,e){if(t)return typeof t=="function"&&N0()?mG(t,e):Fv(t)?eh(t):Array.isArray(t)?t.map(r=>fE(r,e)||Kv.easeOut):Kv[t]}function yG(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:u}={}){const l={[e]:r};u&&(l.offset=u);const d=fE(a,i);return Array.isArray(d)&&(l.easing=d),t.animate(l,{delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function lE(t,e){t.timeline=e,t.onfinish=null}const wG=Wv(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),L0=10,xG=2e4;function _G(t){return kv(t.type)||t.type==="spring"||!uE(t.ease)}function EG(t,e){const r=new Hv({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&sthis.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:u,name:l,startTime:d}=this.options;if(!(!((n=u.owner)===null||n===void 0)&&n.current))return!1;if(typeof o=="string"&&N0()&&SG(o)&&(o=hE[o]),_G(this.options)){const{onComplete:y,onUpdate:A,motionValue:P,element:N,...D}=this.options,k=EG(e,D);e=k.keyframes,e.length===1&&(e[1]=e[0]),i=k.duration,s=k.times,o=k.ease,a="keyframes"}const p=yG(u.owner.current,l,e,{...this.options,duration:i,times:s,ease:o});return p.startTime=d??this.calcStartTime(),this.pendingTimeline?(lE(p,this.pendingTimeline),this.pendingTimeline=void 0):p.onfinish=()=>{const{onComplete:y}=this.options;u.set(I0(e,this.options,r)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:p,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return Do(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return Do(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=Qs(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return Wn;const{animation:n}=r;lE(n,e)}return Wn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:d,onComplete:p,element:y,...A}=this.options,P=new Hv({...A,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),N=Qs(this.time);l.setWithVelocity(P.sample(N-L0).value,P.sample(N).value,L0)}const{onStop:u}=this.options;u&&u(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return wG()&&n&&pG.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}const AG=Wv(()=>window.ScrollTimeline!==void 0);class PG{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;nAG()&&i.attachTimeline?i.attachTimeline(e):r(i));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function MG({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:u,elapsed:l,...d}){return!!Object.keys(d).length}const Vv=(t,e,r,n={},i,s)=>o=>{const a=xv(n,t)||{},u=a.delay||n.delay||0;let{elapsed:l=0}=n;l=l-Qs(u);let d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:y=>{e.set(y),a.onUpdate&&a.onUpdate(y)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:i};MG(a)||(d={...d,...KK(t,d)}),d.duration&&(d.duration=Qs(d.duration)),d.repeatDelay&&(d.repeatDelay=Qs(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let p=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(p=!0)),p&&!s&&e.get()!==void 0){const y=I0(d.keyframes,a);if(y!==void 0)return Nr.update(()=>{d.onUpdate(y),d.onComplete()}),new PG([])}return!s&&dE.supports(d)?new dE(d):new Hv(d)},IG=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),CG=t=>vv(t)?t[t.length-1]||0:t;function Gv(t,e){t.indexOf(e)===-1&&t.push(e)}function Yv(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class Jv{constructor(){this.subscriptions=[]}add(e){return Gv(this.subscriptions,e),()=>Yv(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class RG{constructor(e,r={}){this.version="11.11.17",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=to.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=to.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=TG(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&A0(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new Jv);const n=this.events[e].add(r);return e==="change"?()=>{n(),Nr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=to.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>pE)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,pE);return Y8(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function th(t,e){return new RG(t,e)}function DG(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,th(r))}function OG(t,e){const r=M0(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=CG(s[o]);DG(t,o,a)}}const Xv=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),gE="data-"+Xv("framerAppearId");function mE(t){return t.props[gE]}const Qn=t=>!!(t&&t.getVelocity);function NG(t){return!!(Qn(t)&&t.add)}function Zv(t,e){const r=t.getValue("willChange");if(NG(r))return r.add(e)}function LG({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function vE(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...u}=e;n&&(o=n);const l=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const p in u){const y=t.getValue(p,(s=t.latestValues[p])!==null&&s!==void 0?s:null),A=u[p];if(A===void 0||d&&LG(d,p))continue;const P={delay:r,...xv(o||{},p)};let N=!1;if(window.MotionHandoffAnimation){const k=mE(t);if(k){const B=window.MotionHandoffAnimation(k,p,Nr);B!==null&&(P.startTime=B,N=!0)}}Zv(t,p),y.start(Vv(p,y,A,t.shouldReduceMotion&&bc.has(p)?{type:!1}:P,t,N));const D=y.animation;D&&l.push(D)}return a&&Promise.all(l).then(()=>{Nr.update(()=>{a&&OG(t,a)})}),l}function Qv(t,e,r={}){var n;const i=M0(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(vE(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:y}=s;return kG(t,e,d+l,p,y,r)}:()=>Promise.resolve(),{when:u}=s;if(u){const[l,d]=u==="beforeChildren"?[o,a]:[a,o];return l().then(()=>d())}else return Promise.all([o(),a(r.delay)])}function kG(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,u=i===1?(l=0)=>l*n:(l=0)=>a-l*n;return Array.from(t.variantChildren).sort(BG).forEach((l,d)=>{l.notify("AnimationStart",e),o.push(Qv(l,e,{...s,delay:r+u(d)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function BG(t,e){return t.sortNodePosition(e)}function $G(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>Qv(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=Qv(t,e,r);else{const i=typeof e=="function"?M0(t,e,r.custom):e;n=Promise.all(vE(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const FG=wv.length;function bE(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?bE(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;rPromise.all(e.map(({animation:r,options:n})=>$G(t,r,n)))}function zG(t){let e=qG(t),r=yE(),n=!0;const i=u=>(l,d)=>{var p;const y=M0(t,d,u==="exit"?(p=t.presenceContext)===null||p===void 0?void 0:p.custom:void 0);if(y){const{transition:A,transitionEnd:P,...N}=y;l={...l,...N,...P}}return l};function s(u){e=u(t)}function o(u){const{props:l}=t,d=bE(t.parent)||{},p=[],y=new Set;let A={},P=1/0;for(let D=0;DP&&U,ue=!1;const _e=Array.isArray(j)?j:[j];let G=_e.reduce(i(k),{});K===!1&&(G={});const{prevResolvedValues:E={}}=B,m={...E,...G},f=x=>{z=!0,y.has(x)&&(ue=!0,y.delete(x)),B.needsAnimating[x]=!0;const _=t.getValue(x);_&&(_.liveStyle=!1)};for(const x in m){const _=G[x],S=E[x];if(A.hasOwnProperty(x))continue;let b=!1;vv(_)&&vv(S)?b=!d8(_,S):b=_!==S,b?_!=null?f(x):y.add(x):_!==void 0&&y.has(x)?f(x):B.protectedKeys[x]=!0}B.prevProp=j,B.prevResolvedValues=G,B.isActive&&(A={...A,...G}),n&&t.blockInitialAnimation&&(z=!1),z&&(!(J&&T)||ue)&&p.push(..._e.map(x=>({animation:x,options:{type:k}})))}if(y.size){const D={};y.forEach(k=>{const B=t.getBaseTarget(k),j=t.getValue(k);j&&(j.liveStyle=!0),D[k]=B??null}),p.push({animation:D})}let N=!!p.length;return n&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(N=!1),n=!1,N?e(p):Promise.resolve()}function a(u,l){var d;if(r[u].isActive===l)return Promise.resolve();(d=t.variantChildren)===null||d===void 0||d.forEach(y=>{var A;return(A=y.animationState)===null||A===void 0?void 0:A.setActive(u,l)}),r[u].isActive=l;const p=o(u);for(const y in r)r[y].protectedKeys={};return p}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=yE(),n=!0}}}function HG(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!d8(e,t):!1}function xc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function yE(){return{animate:xc(!0),whileInView:xc(),whileHover:xc(),whileTap:xc(),whileDrag:xc(),whileFocus:xc(),exit:xc()}}class _a{constructor(e){this.isMounted=!1,this.node=e}update(){}}class WG extends _a{constructor(e){super(e),e.animationState||(e.animationState=zG(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();P0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let KG=0;class VG extends _a{constructor(){super(...arguments),this.id=KG++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const GG={animation:{Feature:WG},exit:{Feature:VG}},wE=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function k0(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const YG=t=>e=>wE(e)&&t(e,k0(e));function Lo(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function ko(t,e,r,n){return Lo(t,e,YG(r),n)}const xE=(t,e)=>Math.abs(t-e);function JG(t,e){const r=xE(t.x,e.x),n=xE(t.y,e.y);return Math.sqrt(r**2+n**2)}class _E{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=tb(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,A=JG(p.offset,{x:0,y:0})>=3;if(!y&&!A)return;const{point:P}=p,{timestamp:N}=Kn;this.history.push({...P,timestamp:N});const{onStart:D,onMove:k}=this.handlers;y||(D&&D(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,p)},this.handlePointerMove=(p,y)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=eb(y,this.transformPagePoint),Nr.update(this.updatePoint,!0)},this.handlePointerUp=(p,y)=>{this.end();const{onEnd:A,onSessionEnd:P,resumeAnimation:N}=this.handlers;if(this.dragSnapToOrigin&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=tb(p.type==="pointercancel"?this.lastMoveEventInfo:eb(y,this.transformPagePoint),this.history);this.startEvent&&A&&A(p,D),P&&P(p,D)},!wE(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=k0(e),a=eb(o,this.transformPagePoint),{point:u}=a,{timestamp:l}=Kn;this.history=[{...u,timestamp:l}];const{onSessionStart:d}=r;d&&d(e,tb(a,this.history)),this.removeListeners=No(ko(this.contextWindow,"pointermove",this.handlePointerMove),ko(this.contextWindow,"pointerup",this.handlePointerUp),ko(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),ba(this.updatePoint)}}function eb(t,e){return e?{point:e(t.point)}:t}function EE(t,e){return{x:t.x-e.x,y:t.y-e.y}}function tb({point:t},e){return{point:t,delta:EE(t,SE(e)),offset:EE(t,XG(e)),velocity:ZG(e,.1)}}function XG(t){return t[0]}function SE(t){return t[t.length-1]}function ZG(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=SE(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>Qs(e)));)r--;if(!n)return{x:0,y:0};const s=Do(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function AE(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const PE=AE("dragHorizontal"),ME=AE("dragVertical");function IE(t){let e=!1;if(t==="y")e=ME();else if(t==="x")e=PE();else{const r=PE(),n=ME();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function CE(){const t=IE(!0);return t?(t(),!1):!0}function ju(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const TE=1e-4,QG=1-TE,eY=1+TE,RE=.01,tY=0-RE,rY=0+RE;function Ni(t){return t.max-t.min}function nY(t,e,r){return Math.abs(t-e)<=r}function DE(t,e,r,n=.5){t.origin=n,t.originPoint=Zr(e.min,e.max,t.origin),t.scale=Ni(r)/Ni(e),t.translate=Zr(r.min,r.max,t.origin)-t.originPoint,(t.scale>=QG&&t.scale<=eY||isNaN(t.scale))&&(t.scale=1),(t.translate>=tY&&t.translate<=rY||isNaN(t.translate))&&(t.translate=0)}function rh(t,e,r,n){DE(t.x,e.x,r.x,n?n.originX:void 0),DE(t.y,e.y,r.y,n?n.originY:void 0)}function OE(t,e,r){t.min=r.min+e.min,t.max=t.min+Ni(e)}function iY(t,e,r){OE(t.x,e.x,r.x),OE(t.y,e.y,r.y)}function NE(t,e,r){t.min=e.min-r.min,t.max=t.min+Ni(e)}function nh(t,e,r){NE(t.x,e.x,r.x),NE(t.y,e.y,r.y)}function sY(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?Zr(r,t,n.max):Math.min(t,r)),t}function LE(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function oY(t,{top:e,left:r,bottom:n,right:i}){return{x:LE(t.x,r,i),y:LE(t.y,e,n)}}function kE(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=Fu(e.min,e.max-n,t.min):n>i&&(r=Fu(t.min,t.max-i,e.min)),ya(0,1,r)}function uY(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const rb=.35;function fY(t=rb){return t===!1?t=0:t===!0&&(t=rb),{x:BE(t,"left","right"),y:BE(t,"top","bottom")}}function BE(t,e,r){return{min:$E(t,e),max:$E(t,r)}}function $E(t,e){return typeof t=="number"?t:t[e]||0}const FE=()=>({translate:0,scale:1,origin:0,originPoint:0}),Uu=()=>({x:FE(),y:FE()}),jE=()=>({min:0,max:0}),ln=()=>({x:jE(),y:jE()});function rs(t){return[t("x"),t("y")]}function UE({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function lY({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function hY(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function nb(t){return t===void 0||t===1}function ib({scale:t,scaleX:e,scaleY:r}){return!nb(t)||!nb(e)||!nb(r)}function _c(t){return ib(t)||qE(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function qE(t){return zE(t.x)||zE(t.y)}function zE(t){return t&&t!=="0%"}function B0(t,e,r){const n=t-r,i=e*n;return r+i}function HE(t,e,r,n,i){return i!==void 0&&(t=B0(t,i,n)),B0(t,r,n)+e}function sb(t,e=0,r=1,n,i){t.min=HE(t.min,e,r,n,i),t.max=HE(t.max,e,r,n,i)}function WE(t,{x:e,y:r}){sb(t.x,e.translate,e.scale,e.originPoint),sb(t.y,r.translate,r.scale,r.originPoint)}const KE=.999999999999,VE=1.0000000000001;function dY(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;aKE&&(e.x=1),e.yKE&&(e.y=1)}function qu(t,e){t.min=t.min+e,t.max=t.max+e}function GE(t,e,r,n,i=.5){const s=Zr(t.min,t.max,i);sb(t,e,r,s,n)}function zu(t,e){GE(t.x,e.x,e.scaleX,e.scale,e.originX),GE(t.y,e.y,e.scaleY,e.scale,e.originY)}function YE(t,e){return UE(hY(t.getBoundingClientRect(),e))}function pY(t,e,r){const n=YE(t,r),{scroll:i}=e;return i&&(qu(n.x,i.offset.x),qu(n.y,i.offset.y)),n}const JE=({current:t})=>t?t.ownerDocument.defaultView:null,gY=new WeakMap;class mY{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ln(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:p}=this.getProps();p?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(k0(d,"page").point)},s=(d,p)=>{const{drag:y,dragPropagation:A,onDragStart:P}=this.getProps();if(y&&!A&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=IE(y),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),rs(D=>{let k=this.getAxisMotionValue(D).get()||0;if(eo.test(k)){const{projection:B}=this.visualElement;if(B&&B.layout){const j=B.layout.layoutBox[D];j&&(k=Ni(j)*(parseFloat(k)/100))}}this.originPoint[D]=k}),P&&Nr.postRender(()=>P(d,p)),Zv(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},o=(d,p)=>{const{dragPropagation:y,dragDirectionLock:A,onDirectionLock:P,onDrag:N}=this.getProps();if(!y&&!this.openGlobalLock)return;const{offset:D}=p;if(A&&this.currentDirection===null){this.currentDirection=vY(D),this.currentDirection!==null&&P&&P(this.currentDirection);return}this.updateAxis("x",p.point,D),this.updateAxis("y",p.point,D),this.visualElement.render(),N&&N(d,p)},a=(d,p)=>this.stop(d,p),u=()=>rs(d=>{var p;return this.getAnimationState(d)==="paused"&&((p=this.getAxisMotionValue(d).animation)===null||p===void 0?void 0:p.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new _E(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:JE(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Nr.postRender(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!$0(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=sY(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&ju(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=oY(i.layoutBox,r):this.constraints=!1,this.elastic=fY(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&rs(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=uY(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!ju(e))return!1;const n=e.current;Oo(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=pY(n,i.root,this.visualElement.getTransformPagePoint());let o=aY(i.layout.layoutBox,s);if(r){const a=r(lY(o));this.hasMutatedConstraints=!!a,a&&(o=UE(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),u=this.constraints||{},l=rs(d=>{if(!$0(d,r,this.currentDirection))return;let p=u&&u[d]||{};o&&(p={min:0,max:0});const y=i?200:1e6,A=i?40:1e7,P={type:"inertia",velocity:n?e[d]:0,bounceStiffness:y,bounceDamping:A,timeConstant:750,restDelta:1,restSpeed:10,...s,...p};return this.startAxisValueAnimation(d,P)});return Promise.all(l).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return Zv(this.visualElement,e),n.start(Vv(e,n,0,r,this.visualElement,!1))}stopAnimation(){rs(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){rs(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){rs(r=>{const{drag:n}=this.getProps();if(!$0(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-Zr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!ju(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};rs(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const u=a.get();i[o]=cY({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),rs(o=>{if(!$0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:u,max:l}=this.constraints[o];a.set(Zr(u,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;gY.set(this.visualElement,this);const e=this.visualElement.current,r=ko(e,"pointerdown",u=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();ju(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Nr.read(n);const o=Lo(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(rs(d=>{const p=this.getAxisMotionValue(d);p&&(this.originPoint[d]+=u[d].translate,p.set(p.get()+u[d].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=rb,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function $0(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function vY(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class bY extends _a{constructor(e){super(e),this.removeGroupControls=Wn,this.removeListeners=Wn,this.controls=new mY(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Wn}unmount(){this.removeGroupControls(),this.removeListeners()}}const XE=t=>(e,r)=>{t&&Nr.postRender(()=>t(e,r))};class yY extends _a{constructor(){super(...arguments),this.removePointerDownListener=Wn}onPointerDown(e){this.session=new _E(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:JE(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:XE(e),onStart:XE(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&Nr.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=ko(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const F0=Se.createContext(null);function wY(){const t=Se.useContext(F0);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=Se.useId();Se.useEffect(()=>n(i),[]);const s=Se.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const ob=Se.createContext({}),ZE=Se.createContext({}),j0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function QE(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ih={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(zt.test(t))t=parseFloat(t);else return t;const r=QE(t,e.target.x),n=QE(t,e.target.y);return`${r}% ${n}%`}},xY={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=xa.parse(t);if(i.length>5)return n;const s=xa.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,u=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=u;const l=Zr(a,u,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),s(i)}},U0={};function _Y(t){Object.assign(U0,t)}const{schedule:ab}=g8(queueMicrotask,!1);class EY extends Se.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;_Y(SY),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),j0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Nr.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ab.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function eS(t){const[e,r]=wY(),n=Se.useContext(ob);return ge.jsx(EY,{...t,layoutGroup:n,switchLayoutGroup:Se.useContext(ZE),isPresent:e,safeToRemove:r})}const SY={borderRadius:{...ih,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ih,borderTopRightRadius:ih,borderBottomLeftRadius:ih,borderBottomRightRadius:ih,boxShadow:xY},tS=["TopLeft","TopRight","BottomLeft","BottomRight"],AY=tS.length,rS=t=>typeof t=="string"?parseFloat(t):t,nS=t=>typeof t=="number"||zt.test(t);function PY(t,e,r,n,i,s){i?(t.opacity=Zr(0,r.opacity!==void 0?r.opacity:1,MY(n)),t.opacityExit=Zr(e.opacity!==void 0?e.opacity:1,0,IY(n))):s&&(t.opacity=Zr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(Fu(t,e,n))}function oS(t,e){t.min=e.min,t.max=e.max}function ns(t,e){oS(t.x,e.x),oS(t.y,e.y)}function aS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function cS(t,e,r,n,i){return t-=e,t=B0(t,1/r,n),i!==void 0&&(t=B0(t,1/i,n)),t}function CY(t,e=0,r=1,n=.5,i,s=t,o=t){if(eo.test(e)&&(e=parseFloat(e),e=Zr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Zr(s.min,s.max,n);t===s&&(a-=e),t.min=cS(t.min,e,r,a,i),t.max=cS(t.max,e,r,a,i)}function uS(t,e,[r,n,i],s,o){CY(t,e[r],e[n],e[i],e.scale,s,o)}const TY=["x","scaleX","originX"],RY=["y","scaleY","originY"];function fS(t,e,r,n){uS(t.x,e,TY,r?r.x:void 0,n?n.x:void 0),uS(t.y,e,RY,r?r.y:void 0,n?n.y:void 0)}function lS(t){return t.translate===0&&t.scale===1}function hS(t){return lS(t.x)&&lS(t.y)}function dS(t,e){return t.min===e.min&&t.max===e.max}function DY(t,e){return dS(t.x,e.x)&&dS(t.y,e.y)}function pS(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function gS(t,e){return pS(t.x,e.x)&&pS(t.y,e.y)}function mS(t){return Ni(t.x)/Ni(t.y)}function vS(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class OY{constructor(){this.members=[]}add(e){Gv(this.members,e),e.scheduleRender()}remove(e){if(Yv(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function NY(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:l,rotate:d,rotateX:p,rotateY:y,skewX:A,skewY:P}=r;l&&(n=`perspective(${l}px) ${n}`),d&&(n+=`rotate(${d}deg) `),p&&(n+=`rotateX(${p}deg) `),y&&(n+=`rotateY(${y}deg) `),A&&(n+=`skewX(${A}deg) `),P&&(n+=`skewY(${P}deg) `)}const a=t.x.scale*e.x,u=t.y.scale*e.y;return(a!==1||u!==1)&&(n+=`scale(${a}, ${u})`),n||"none"}const LY=(t,e)=>t.depth-e.depth;class kY{constructor(){this.children=[],this.isDirty=!1}add(e){Gv(this.children,e),this.isDirty=!0}remove(e){Yv(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(LY),this.isDirty=!1,this.children.forEach(e)}}function q0(t){const e=Qn(t)?t.get():t;return IG(e)?e.toValue():e}function BY(t,e){const r=to.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(ba(n),t(s-e))};return Nr.read(n,!0),()=>ba(n)}function $Y(t){return t instanceof SVGElement&&t.tagName!=="svg"}function FY(t,e,r){const n=Qn(t)?t:th(t);return n.start(Vv("",n,e,r)),n.animation}const Ec={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},sh=typeof window<"u"&&window.MotionDebug!==void 0,cb=["","X","Y","Z"],jY={visibility:"hidden"},bS=1e3;let UY=0;function ub(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function yS(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=mE(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Nr,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&yS(n)}function wS({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=UY++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,sh&&(Ec.totalNodes=Ec.resolvedTargetDeltas=Ec.recalculatedProjection=0),this.nodes.forEach(HY),this.nodes.forEach(YY),this.nodes.forEach(JY),this.nodes.forEach(WY),sh&&window.MotionDebug.record(Ec)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let u=0;uthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,p&&p(),p=BY(y,250),j0.hasAnimatedSinceResize&&(j0.hasAnimatedSinceResize=!1,this.nodes.forEach(_S))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&d&&(u||l)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:y,hasRelativeTargetChanged:A,layout:P})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const N=this.options.transition||d.getDefaultTransition()||tJ,{onLayoutAnimationStart:D,onLayoutAnimationComplete:k}=d.getProps(),B=!this.targetLayout||!gS(this.targetLayout,P)||A,j=!y&&A;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||j||y&&(B||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(p,j);const U={...xv(N,"layout"),onPlay:D,onComplete:k};(d.shouldReduceMotion||this.options.layoutRoot)&&(U.delay=0,U.type=!1),this.startAnimation(U)}else y||_S(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=P})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,ba(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(XY),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&yS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u{const K=U/1e3;ES(p.x,o.x,K),ES(p.y,o.y,K),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(nh(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),QY(this.relativeTarget,this.relativeTargetOrigin,y,K),j&&DY(this.relativeTarget,j)&&(this.isProjectionDirty=!1),j||(j=ln()),ns(j,this.relativeTarget)),N&&(this.animationValues=d,PY(d,l,this.latestValues,K,B,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=K},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(ba(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nr.update(()=>{j0.hasAnimatedSinceResize=!0,this.currentAnimation=FY(0,bS,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(bS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:u,layout:l,latestValues:d}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&IS(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||ln();const p=Ni(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+p;const y=Ni(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+y}ns(a,u),zu(a,d),rh(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new OY),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(a=!0),!a)return;const l={};u.z&&ub("z",o,l,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(xS),this.root.sharedNodes.clear()}}}function qY(t){t.updateLayout()}function zY(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?rs(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],A=Ni(y);y.min=n[p].min,y.max=y.min+A}):IS(s,r.layoutBox,n)&&rs(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],A=Ni(n[p]);y.max=y.min+A,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[p].max=t.relativeTarget[p].min+A)});const a=Uu();rh(a,n,r.layoutBox);const u=Uu();o?rh(u,t.applyTransform(i,!0),r.measuredBox):rh(u,n,r.layoutBox);const l=!hS(a);let d=!1;if(!t.resumeFrom){const p=t.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:y,layout:A}=p;if(y&&A){const P=ln();nh(P,r.layoutBox,y.layoutBox);const N=ln();nh(N,n,A.layoutBox),gS(P,N)||(d=!0),p.options.layoutRoot&&(t.relativeTarget=N,t.relativeTargetOrigin=P,t.relativeParent=p)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:u,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function HY(t){sh&&Ec.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function WY(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function KY(t){t.clearSnapshot()}function xS(t){t.clearMeasurements()}function VY(t){t.isLayoutDirty=!1}function GY(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function _S(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function YY(t){t.resolveTargetDelta()}function JY(t){t.calcProjection()}function XY(t){t.resetSkewAndRotation()}function ZY(t){t.removeLeadSnapshot()}function ES(t,e,r){t.translate=Zr(e.translate,0,r),t.scale=Zr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function SS(t,e,r,n){t.min=Zr(e.min,r.min,n),t.max=Zr(e.max,r.max,n)}function QY(t,e,r,n){SS(t.x,e.x,r.x,n),SS(t.y,e.y,r.y,n)}function eJ(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const tJ={duration:.45,ease:[.4,0,.1,1]},AS=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),PS=AS("applewebkit/")&&!AS("chrome/")?Math.round:Wn;function MS(t){t.min=PS(t.min),t.max=PS(t.max)}function rJ(t){MS(t.x),MS(t.y)}function IS(t,e,r){return t==="position"||t==="preserve-aspect"&&!nY(mS(e),mS(r),.2)}function nJ(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const iJ=wS({attachResizeListener:(t,e)=>Lo(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),fb={current:void 0},CS=wS({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!fb.current){const t=new iJ({});t.mount(window),t.setOptions({layoutScroll:!0}),fb.current=t}return fb.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),sJ={pan:{Feature:yY},drag:{Feature:bY,ProjectionNode:CS,MeasureLayout:eS}};function TS(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||CE())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const u=a[n];u&&Nr.postRender(()=>u(s,o))};return ko(t.current,r,i,{passive:!t.getProps()[n]})}class oJ extends _a{mount(){this.unmount=No(TS(this.node,!0),TS(this.node,!1))}unmount(){}}class aJ extends _a{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=No(Lo(this.node.current,"focus",()=>this.onFocus()),Lo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const RS=(t,e)=>e?t===e?!0:RS(t,e.parentElement):!1;function lb(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,k0(r))}class cJ extends _a{constructor(){super(...arguments),this.removeStartListeners=Wn,this.removeEndListeners=Wn,this.removeAccessibleListeners=Wn,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=ko(window,"pointerup",(a,u)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:d,globalTapTarget:p}=this.node.getProps(),y=!p&&!RS(this.node.current,a.target)?d:l;y&&Nr.update(()=>y(a,u))},{passive:!(n.onTap||n.onPointerUp)}),o=ko(window,"pointercancel",(a,u)=>this.cancelPress(a,u),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=No(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||lb("up",(u,l)=>{const{onTap:d}=this.node.getProps();d&&Nr.postRender(()=>d(u,l))})};this.removeEndListeners(),this.removeEndListeners=Lo(this.node.current,"keyup",o),lb("down",(a,u)=>{this.startPress(a,u)})},r=Lo(this.node.current,"keydown",e),n=()=>{this.isPressing&&lb("cancel",(s,o)=>this.cancelPress(s,o))},i=Lo(this.node.current,"blur",n);this.removeAccessibleListeners=No(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Nr.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!CE()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Nr.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=ko(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=Lo(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=No(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const hb=new WeakMap,db=new WeakMap,uJ=t=>{const e=hb.get(t.target);e&&e(t)},fJ=t=>{t.forEach(uJ)};function lJ({root:t,...e}){const r=t||document;db.has(r)||db.set(r,{});const n=db.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(fJ,{root:t,...e})),n[i]}function hJ(t,e,r){const n=lJ(e);return hb.set(t,r),n.observe(t),()=>{hb.delete(t),n.unobserve(t)}}const dJ={some:0,all:1};class pJ extends _a{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:dJ[i]},a=u=>{const{isIntersecting:l}=u;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:p}=this.node.getProps(),y=l?d:p;y&&y(u)};return hJ(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(gJ(e,r))&&this.startObserver()}unmount(){}}function gJ({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const mJ={inView:{Feature:pJ},tap:{Feature:cJ},focus:{Feature:aJ},hover:{Feature:oJ}},vJ={layout:{ProjectionNode:CS,MeasureLayout:eS}},pb=Se.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),z0=Se.createContext({}),gb=typeof window<"u",DS=gb?Se.useLayoutEffect:Se.useEffect,OS=Se.createContext({strict:!1});function bJ(t,e,r,n,i){var s,o;const{visualElement:a}=Se.useContext(z0),u=Se.useContext(OS),l=Se.useContext(F0),d=Se.useContext(pb).reducedMotion,p=Se.useRef();n=n||u.renderer,!p.current&&n&&(p.current=n(t,{visualState:e,parent:a,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d}));const y=p.current,A=Se.useContext(ZE);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&yJ(p.current,r,i,A);const P=Se.useRef(!1);Se.useInsertionEffect(()=>{y&&P.current&&y.update(r,l)});const N=r[gE],D=Se.useRef(!!N&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,N))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,N)));return DS(()=>{y&&(P.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),ab.render(y.render),D.current&&y.animationState&&y.animationState.animateChanges())}),Se.useEffect(()=>{y&&(!D.current&&y.animationState&&y.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{var k;(k=window.MotionHandoffMarkAsComplete)===null||k===void 0||k.call(window,N)}),D.current=!1))}),y}function yJ(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:u,layoutRoot:l}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:NS(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&ju(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:u,layoutRoot:l})}function NS(t){if(t)return t.options.allowProjection!==!1?t.projection:NS(t.parent)}function wJ(t,e,r){return Se.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):ju(r)&&(r.current=n))},[e])}function H0(t){return P0(t.animate)||wv.some(e=>Vl(t[e]))}function LS(t){return!!(H0(t)||t.variants)}function xJ(t,e){if(H0(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Vl(r)?r:void 0,animate:Vl(n)?n:void 0}}return t.inherit!==!1?e:{}}function _J(t){const{initial:e,animate:r}=xJ(t,Se.useContext(z0));return Se.useMemo(()=>({initial:e,animate:r}),[kS(e),kS(r)])}function kS(t){return Array.isArray(t)?t.join(" "):t}const BS={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Hu={};for(const t in BS)Hu[t]={isEnabled:e=>BS[t].some(r=>!!e[r])};function EJ(t){for(const e in t)Hu[e]={...Hu[e],...t[e]}}const SJ=Symbol.for("motionComponentSymbol");function AJ({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&EJ(t);function s(a,u){let l;const d={...Se.useContext(pb),...a,layoutId:PJ(a)},{isStatic:p}=d,y=_J(a),A=n(a,p);if(!p&&gb){MJ(d,t);const P=IJ(d);l=P.MeasureLayout,y.visualElement=bJ(i,A,d,e,P.ProjectionNode)}return ge.jsxs(z0.Provider,{value:y,children:[l&&y.visualElement?ge.jsx(l,{visualElement:y.visualElement,...d}):null,r(i,a,wJ(A,y.visualElement,u),A,p,y.visualElement)]})}const o=Se.forwardRef(s);return o[SJ]=i,o}function PJ({layoutId:t}){const e=Se.useContext(ob).id;return e&&t!==void 0?e+"-"+t:t}function MJ(t,e){const r=Se.useContext(OS).strict;if(process.env.NODE_ENV!=="production"&&e&&r){const n="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?Lu(!1,n):Oo(!1,n)}}function IJ(t){const{drag:e,layout:r}=Hu;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const CJ=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function mb(t){return typeof t!="string"||t.includes("-")?!1:!!(CJ.indexOf(t)>-1||/[A-Z]/u.test(t))}function $S(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const FS=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function jS(t,e,r,n){$S(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(FS.has(i)?i:Xv(i),e.attrs[i])}function US(t,{layout:e,layoutId:r}){return bc.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!U0[t]||t==="opacity")}function vb(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(Qn(i[o])||e.style&&Qn(e.style[o])||US(o,t)||((n=r==null?void 0:r.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function qS(t,e,r){const n=vb(t,e,r);for(const i in t)if(Qn(t[i])||Qn(e[i])){const s=Gl.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function bb(t){const e=Se.useRef(null);return e.current===null&&(e.current=t()),e.current}function TJ({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:RJ(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const zS=t=>(e,r)=>{const n=Se.useContext(z0),i=Se.useContext(F0),s=()=>TJ(t,e,n,i);return r?s():bb(s)};function RJ(t,e,r,n){const i={},s=n(t,{});for(const y in s)i[y]=q0(s[y]);let{initial:o,animate:a}=t;const u=H0(t),l=LS(t);e&&l&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const p=d?a:o;if(p&&typeof p!="boolean"&&!P0(p)){const y=Array.isArray(p)?p:[p];for(let A=0;A({style:{},transform:{},transformOrigin:{},vars:{}}),HS=()=>({...yb(),attrs:{}}),WS=(t,e)=>e&&typeof t=="number"?e.transform(t):t,DJ={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},OJ=Gl.length;function NJ(t,e,r){let n="",i=!0;for(let s=0;stypeof t=="string"&&t.toLowerCase()==="svg",FJ={useVisualState:zS({scrapeMotionValuesFromProps:qS,createRenderState:HS,onMount:(t,e,{renderState:r,latestValues:n})=>{Nr.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),Nr.render(()=>{xb(r,n,_b(e.tagName),t.transformTemplate),jS(e,r)})}})},jJ={useVisualState:zS({scrapeMotionValuesFromProps:vb,createRenderState:yb})};function VS(t,e,r){for(const n in e)!Qn(e[n])&&!US(n,r)&&(t[n]=e[n])}function UJ({transformTemplate:t},e){return Se.useMemo(()=>{const r=yb();return wb(r,e,t),Object.assign({},r.vars,r.style)},[e])}function qJ(t,e){const r=t.style||{},n={};return VS(n,r,t),Object.assign(n,UJ(t,e)),n}function zJ(t,e){const r={},n=qJ(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const HJ=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function W0(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||HJ.has(t)}let GS=t=>!W0(t);function WJ(t){t&&(GS=e=>e.startsWith("on")?!W0(e):t(e))}try{WJ(require("@emotion/is-prop-valid").default)}catch{}function KJ(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(GS(i)||r===!0&&W0(i)||!e&&!W0(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function VJ(t,e,r,n){const i=Se.useMemo(()=>{const s=HS();return xb(s,e,_b(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};VS(s,t.style,t),i.style={...s,...i.style}}return i}function GJ(t=!1){return(r,n,i,{latestValues:s},o)=>{const u=(mb(r)?VJ:zJ)(n,s,o,r),l=KJ(n,typeof r=="string",t),d=r!==Se.Fragment?{...l,...u,ref:i}:{},{children:p}=n,y=Se.useMemo(()=>Qn(p)?p.get():p,[p]);return Se.createElement(r,{...d,children:y})}}function YJ(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...mb(n)?FJ:jJ,preloadedFeatures:t,useRender:GJ(i),createVisualElement:e,Component:n};return AJ(o)}}const Eb={current:null},YS={current:!1};function JJ(){if(YS.current=!0,!!gb)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Eb.current=t.matches;t.addListener(e),e()}else Eb.current=!1}function XJ(t,e,r){for(const n in e){const i=e[n],s=r[n];if(Qn(i))t.addValue(n,i),process.env.NODE_ENV==="development"&&A0(i.version==="11.11.17",`Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`);else if(Qn(s))t.addValue(n,th(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,th(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const JS=new WeakMap,ZJ=[...N8,Zn,xa],QJ=t=>ZJ.find(O8(t)),XS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class eX{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Iv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=to.now();this.renderScheduledAtthis.bindToMotionValue(n,r)),YS.current||JJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Eb.current,process.env.NODE_ENV!=="production"&&A0(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){JS.delete(this.current),this.projection&&this.projection.unmount(),ba(this.notifyUpdate),ba(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=bc.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Nr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Hu){const r=Hu[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ln()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=th(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(A8(i)||S8(i))?i=parseFloat(i):!QJ(i)&&xa.test(r)&&(i=W8(e,r)),this.setBaseTarget(e,Qn(i)?i.get():i)),Qn(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=bv(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Qn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new Jv),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class ZS extends eX{constructor(){super(...arguments),this.KeyframeResolver=K8}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function tX(t){return window.getComputedStyle(t)}class rX extends ZS{constructor(){super(...arguments),this.type="html",this.renderInstance=$S}readValueFromInstance(e,r){if(bc.has(r)){const n=Lv(r);return n&&n.default||0}else{const n=tX(e),i=(M8(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return YE(e,r)}build(e,r,n){wb(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return vb(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Qn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class nX extends ZS{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ln}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(bc.has(r)){const n=Lv(r);return n&&n.default||0}return r=FS.has(r)?r:Xv(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return qS(e,r,n)}build(e,r,n){xb(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){jS(e,r,n,i)}mount(e){this.isSVGTag=_b(e.tagName),super.mount(e)}}const iX=(t,e)=>mb(t)?new nX(e):new rX(e,{allowProjection:t!==Se.Fragment}),sX=YJ({...GG,...mJ,...sJ,...vJ},iX),oX=UK(sX);class aX extends Yt.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function cX({children:t,isPresent:e}){const r=Se.useId(),n=Se.useRef(null),i=Se.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=Se.useContext(pb);return Se.useInsertionEffect(()=>{const{width:o,height:a,top:u,left:l}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` [data-motion-pop-id="${r}"] { position: absolute !important; width: ${o}px !important; @@ -199,7 +199,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene top: ${u}px !important; left: ${l}px !important; } - `),()=>{document.head.removeChild(d)}},[e]),ge.jsx(aX,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const uX=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=vb(fX),u=Se.useId(),l=Se.useCallback(p=>{a.set(p,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Se.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:p=>(a.set(p,!1),()=>a.delete(p))}),s?[Math.random(),l]:[r,l]);return Se.useMemo(()=>{a.forEach((p,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=ge.jsx(cX,{isPresent:r,children:t})),ge.jsx(F0.Provider,{value:d,children:t})};function fX(){return new Map}const K0=t=>t.key||"";function QS(t){const e=[];return Se.Children.forEach(t,r=>{Se.isValidElement(r)&&e.push(r)}),e}const lX=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Oo(!e,"Replace exitBeforeEnter with mode='wait'");const a=Se.useMemo(()=>QS(t),[t]),u=a.map(K0),l=Se.useRef(!0),d=Se.useRef(a),p=vb(()=>new Map),[y,A]=Se.useState(a),[P,N]=Se.useState(a);DS(()=>{l.current=!1,d.current=a;for(let B=0;B1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=Se.useContext(sb);return ge.jsx(ge.Fragment,{children:P.map(B=>{const j=K0(B),U=a===P||u.includes(j),K=()=>{if(p.has(j))p.set(j,!0);else return;let J=!0;p.forEach(T=>{T||(J=!1)}),J&&(k==null||k(),N(d.current),i&&i())};return ge.jsx(uX,{isPresent:U,initial:!l.current||n?void 0:!1,custom:U?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:U?void 0:K,children:B},j)})})},Ss=t=>ge.jsx(lX,{children:ge.jsx(oX.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Eb(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return ge.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,ge.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[ge.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),ge.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:ge.jsx(NK,{})})]})]})}function hX(t){return t.lastUsed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function e7(t){var o,a;const{wallet:e,onClick:r}=t,n=ge.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Se.useMemo(()=>hX(e),[e]);return ge.jsx(Eb,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function t7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=vX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Sb);return a[0]===""&&a.length!==1&&a.shift(),r7(a,e)||mX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},r7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?r7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Sb);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},n7=/^\[(.+)\]$/,mX=t=>{if(n7.test(t)){const e=n7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},vX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return yX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Ab(o,n,s,e)}),n},Ab=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:i7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(bX(i)){Ab(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Ab(o,i7(e,s),r,n)})})},i7=(t,e)=>{let r=t;return e.split(Sb).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},bX=t=>t.isThemeGetter,yX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,wX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},s7="!",xX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,p;for(let D=0;Dd?p-d:void 0;return{modifiers:u,hasImportantModifier:A,baseClassName:P,maybePostfixModifierPosition:N}};return r?a=>r({className:a,parseClassName:o}):o},_X=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},EX=t=>({cache:wX(t.cacheSize),parseClassName:xX(t),...gX(t)}),SX=/\s+/,AX=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(SX);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:A}=r(l);let P=!!A,N=n(P?y.substring(0,A):y);if(!N){if(!P){a=l+(a.length>0?" "+a:a);continue}if(N=n(y),!N){a=l+(a.length>0?" "+a:a);continue}P=!1}const D=_X(d).join(":"),k=p?D+s7:D,B=k+N;if(s.includes(B))continue;s.push(B);const j=i(N,P);for(let U=0;U0?" "+a:a)}return a};function PX(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;np(d),t());return r=EX(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=AX(u,r);return i(u,d),d}return function(){return s(PX.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},a7=/^\[(?:([a-z-]+):)?(.+)\]$/i,IX=/^\d+\/\d+$/,CX=new Set(["px","full","screen"]),TX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RX=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,DX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,OX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bo=t=>Wu(t)||CX.has(t)||IX.test(t),Ea=t=>Ku(t,"length",qX),Wu=t=>!!t&&!Number.isNaN(Number(t)),Pb=t=>Ku(t,"number",Wu),oh=t=>!!t&&Number.isInteger(Number(t)),LX=t=>t.endsWith("%")&&Wu(t.slice(0,-1)),cr=t=>a7.test(t),Sa=t=>TX.test(t),kX=new Set(["length","size","percentage"]),BX=t=>Ku(t,kX,c7),$X=t=>Ku(t,"position",c7),FX=new Set(["image","url"]),jX=t=>Ku(t,FX,HX),UX=t=>Ku(t,"",zX),ah=()=>!0,Ku=(t,e,r)=>{const n=a7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},qX=t=>RX.test(t)&&!DX.test(t),c7=()=>!1,zX=t=>OX.test(t),HX=t=>NX.test(t),WX=MX(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),p=Gr("invert"),y=Gr("gap"),A=Gr("gradientColorStops"),P=Gr("gradientColorStopPositions"),N=Gr("inset"),D=Gr("margin"),k=Gr("opacity"),B=Gr("padding"),j=Gr("saturate"),U=Gr("scale"),K=Gr("sepia"),J=Gr("skew"),T=Gr("space"),z=Gr("translate"),ue=()=>["auto","contain","none"],_e=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",Bo,Ea],f=()=>["auto",Wu,cr],g=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],S=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Wu,cr];return{cacheSize:500,separator:":",theme:{colors:[ah],spacing:[Bo,Ea],blur:["none","",Sa,cr],brightness:M(),borderColor:[t],borderRadius:["none","","full",Sa,cr],borderSpacing:E(),borderWidth:m(),contrast:M(),grayscale:S(),hueRotate:M(),invert:S(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[LX,Ea],inset:G(),margin:G(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:S(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Sa]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...g(),cr]}],overflow:[{overflow:_e()}],"overflow-x":[{"overflow-x":_e()}],"overflow-y":[{"overflow-y":_e()}],overscroll:[{overscroll:ue()}],"overscroll-x":[{"overscroll-x":ue()}],"overscroll-y":[{"overscroll-y":ue()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",oh,cr]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",oh,cr]}],"grid-cols":[{"grid-cols":[ah]}],"col-start-end":[{col:["auto",{span:["full",oh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[ah]}],"row-start-end":[{row:["auto",{span:[oh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[B]}],px:[{px:[B]}],py:[{py:[B]}],ps:[{ps:[B]}],pe:[{pe:[B]}],pt:[{pt:[B]}],pr:[{pr:[B]}],pb:[{pb:[B]}],pl:[{pl:[B]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Sa]},Sa]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Sa,Ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Pb]}],"font-family":[{font:[ah]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Wu,Pb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Bo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Bo,Ea]}],"underline-offset":[{"underline-offset":["auto",Bo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...g(),$X]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",BX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},jX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[A]}],"gradient-via":[{via:[A]}],"gradient-to":[{to:[A]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[Bo,cr]}],"outline-w":[{outline:[Bo,Ea]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Bo,Ea]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Sa,UX]}],"shadow-color":[{shadow:[ah]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Sa,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[p]}],saturate:[{saturate:[j]}],sepia:[{sepia:[K]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[j]}],"backdrop-sepia":[{"backdrop-sepia":[K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[U]}],"scale-x":[{"scale-x":[U]}],"scale-y":[{"scale-y":[U]}],rotate:[{rotate:[oh,cr]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[J]}],"skew-y":[{"skew-y":[J]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Bo,Ea,Pb]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function $o(...t){return WX(pX(t))}function u7(t){const{className:e}=t;return ge.jsxs("div",{className:$o("xc-flex xc-items-center xc-gap-2"),children:[ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)}),ge.jsx("div",{className:"xc-shrink-0",children:t.children}),ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)})]})}const KX="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function VX(t){const{onClick:e}=t;function r(){e&&e()}return ge.jsx(u7,{className:"xc-opacity-20",children:ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[ge.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),ge.jsx(u8,{size:16})]})})}function f7(t){const[e,r]=Se.useState(""),{featuredWallets:n,initialized:i}=Kl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Se.useMemo(()=>{const N=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!N.test(e)&&D.test(e)},[e]);function p(N){o(N)}function y(N){r(N.target.value)}async function A(){s(e)}function P(N){N.key==="Enter"&&d&&A()}return ge.jsx(Ss,{children:i&&ge.jsxs(ge.Fragment,{children:[t.header||ge.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),ge.jsxs("div",{children:[ge.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(N=>ge.jsx(e7,{wallet:N,onClick:p},`feature-${N.key}`)),l.showTonConnect&&ge.jsx(Eb,{icon:ge.jsx("img",{className:"xc-h-5 xc-w-5",src:KX}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&ge.jsx(VX,{onClick:a})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&ge.jsx("div",{className:"xc-mb-4 xc-mt-4",children:ge.jsxs(u7,{className:"xc-opacity-20",children:[" ",ge.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),l.showEmailSignIn&&ge.jsxs("div",{className:"xc-mb-4",children:[ge.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:y,onKeyDown:P}),ge.jsx("button",{disabled:!d,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:A,children:"Continue"})]})]})})}function Sc(t){const{title:e}=t;return ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[ge.jsx(OK,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),ge.jsx("span",{children:e})]})}const l7=Se.createContext({channel:"",device:"WEB",app:"",inviterCode:"",role:"C"});function Mb(){return Se.useContext(l7)}function GX(t){const{config:e}=t,[r,n]=Se.useState(e.channel),[i,s]=Se.useState(e.device),[o,a]=Se.useState(e.app),[u,l]=Se.useState(e.role||"C"),[d,p]=Se.useState(e.inviterCode);return Se.useEffect(()=>{n(e.channel),s(e.device),a(e.app),p(e.inviterCode),l(e.role||"C")},[e]),ge.jsx(l7.Provider,{value:{channel:r,device:i,app:o,inviterCode:d,role:u},children:t.children})}var YX=Object.defineProperty,JX=Object.defineProperties,XX=Object.getOwnPropertyDescriptors,V0=Object.getOwnPropertySymbols,h7=Object.prototype.hasOwnProperty,d7=Object.prototype.propertyIsEnumerable,p7=(t,e,r)=>e in t?YX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ZX=(t,e)=>{for(var r in e||(e={}))h7.call(e,r)&&p7(t,r,e[r]);if(V0)for(var r of V0(e))d7.call(e,r)&&p7(t,r,e[r]);return t},QX=(t,e)=>JX(t,XX(e)),eZ=(t,e)=>{var r={};for(var n in t)h7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&V0)for(var n of V0(t))e.indexOf(n)<0&&d7.call(t,n)&&(r[n]=t[n]);return r};function tZ(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function rZ(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var nZ=18,g7=40,iZ=`${g7}px`,sZ=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function oZ({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),p=Yt.useCallback(()=>{let y=t.current,A=e.current;if(!y||!A||u||r==="none")return;let P=y,N=P.getBoundingClientRect().left+P.offsetWidth,D=P.getBoundingClientRect().top+P.offsetHeight/2,k=N-nZ,B=D;document.querySelectorAll(sZ).length===0&&document.elementFromPoint(k,B)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function A(){let N=window.innerWidth-y.getBoundingClientRect().right;a(N>=g7)}A();let P=setInterval(A,1e3);return()=>{clearInterval(P)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let A=setTimeout(p,0),P=setTimeout(p,2e3),N=setTimeout(p,5e3),D=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(A),clearTimeout(P),clearTimeout(N),clearTimeout(D)}},[e,n,r,p]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:iZ}}var m7=Yt.createContext({}),v7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:p="increase-width",pasteTransformer:y,containerClassName:A,noScriptCSSFallback:P=aZ,render:N,children:D}=r,k=eZ(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),B,j,U,K,J;let[T,z]=Yt.useState(typeof k.defaultValue=="string"?k.defaultValue:""),ue=n??T,_e=rZ(ue),G=Yt.useCallback(ie=>{i==null||i(ie),z(ie)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),g=Yt.useRef({value:ue,onChange:G,isIOS:typeof window<"u"&&((j=(B=window==null?void 0:window.CSS)==null?void 0:B.supports)==null?void 0:j.call(B,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(U=m.current)==null?void 0:U.selectionStart,(K=m.current)==null?void 0:K.selectionEnd,(J=m.current)==null?void 0:J.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let ie=m.current,fe=f.current;if(!ie||!fe)return;g.current.value!==ie.value&&g.current.onChange(ie.value),v.current.prev=[ie.selectionStart,ie.selectionEnd,ie.selectionDirection];function ve(){if(document.activeElement!==ie){I(null),ae(null);return}let Te=ie.selectionStart,$e=ie.selectionEnd,Ie=ie.selectionDirection,Le=ie.maxLength,Ve=ie.value,ke=v.current.prev,ze=-1,He=-1,Ee;if(Ve.length!==0&&Te!==null&&$e!==null){let et=Te===$e,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let pt=0;if(ke[0]!==null&&ke[1]!==null){Ee=Je{fe&&fe.style.setProperty("--root-height",`${ie.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(ie),()=>{document.removeEventListener("selectionchange",ve,{capture:!0}),Ne.disconnect()}},[]);let[x,_]=Yt.useState(!1),[S,b]=Yt.useState(!1),[M,I]=Yt.useState(null),[F,ae]=Yt.useState(null);Yt.useEffect(()=>{tZ(()=>{var ie,fe,ve,Me;(ie=m.current)==null||ie.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(ve=m.current)==null?void 0:ve.selectionEnd,$e=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ae(Te),v.current.prev=[Ne,Te,$e])})},[ue,S]),Yt.useEffect(()=>{_e!==void 0&&ue!==_e&&_e.length{let fe=ie.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){ie.preventDefault();return}typeof _e=="string"&&fe.length<_e.length&&document.dispatchEvent(new Event("selectionchange")),G(fe)},[s,G,_e,E]),ee=Yt.useCallback(()=>{var ie;if(m.current){let fe=Math.min(m.current.value.length,s-1),ve=m.current.value.length;(ie=m.current)==null||ie.setSelectionRange(fe,ve),I(fe),ae(ve)}b(!0)},[s]),X=Yt.useCallback(ie=>{var fe,ve;let Me=m.current;if(!y&&(!g.current.isIOS||!ie.clipboardData||!Me))return;let Ne=ie.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),ie.preventDefault();let $e=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(ve=m.current)==null?void 0:ve.selectionEnd,Le=($e!==Ie?ue.slice(0,$e)+Te+ue.slice(Ie):ue.slice(0,$e)+Te+ue.slice($e)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,G(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ae(ke)},[s,G,E,ue]),Q=Yt.useMemo(()=>({position:"relative",cursor:k.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[k.disabled]),R=Yt.useMemo(()=>({position:"absolute",inset:0,width:O.willPushPWMBadge?`calc(100% + ${O.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:O.willPushPWMBadge?`inset(0 ${O.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[O.PWM_BADGE_SPACE_WIDTH,O.willPushPWMBadge,o]),Z=Yt.useMemo(()=>Yt.createElement("input",QX(ZX({autoComplete:k.autoComplete||"one-time-code"},k),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ue.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:R,maxLength:s,value:ue,ref:m,onPaste:ie=>{var fe;X(ie),(fe=k.onPaste)==null||fe.call(k,ie)},onChange:se,onMouseOver:ie=>{var fe;_(!0),(fe=k.onMouseOver)==null||fe.call(k,ie)},onMouseLeave:ie=>{var fe;_(!1),(fe=k.onMouseLeave)==null||fe.call(k,ie)},onFocus:ie=>{var fe;ee(),(fe=k.onFocus)==null||fe.call(k,ie)},onBlur:ie=>{var fe;b(!1),(fe=k.onBlur)==null||fe.call(k,ie)}})),[se,ee,X,l,R,s,F,M,k,E==null?void 0:E.source,ue]),te=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ie,fe)=>{var ve;let Me=S&&M!==null&&F!==null&&(M===F&&fe===M||fe>=M&&feN?N(te):Yt.createElement(m7.Provider,{value:te},D),[D,te,N]);return Yt.createElement(Yt.Fragment,null,P!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,P)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:A},le,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Z)))});v7.displayName="Input";function ch(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var aZ=` + `),()=>{document.head.removeChild(d)}},[e]),ge.jsx(aX,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const uX=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=bb(fX),u=Se.useId(),l=Se.useCallback(p=>{a.set(p,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Se.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:p=>(a.set(p,!1),()=>a.delete(p))}),s?[Math.random(),l]:[r,l]);return Se.useMemo(()=>{a.forEach((p,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=ge.jsx(cX,{isPresent:r,children:t})),ge.jsx(F0.Provider,{value:d,children:t})};function fX(){return new Map}const K0=t=>t.key||"";function QS(t){const e=[];return Se.Children.forEach(t,r=>{Se.isValidElement(r)&&e.push(r)}),e}const lX=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Oo(!e,"Replace exitBeforeEnter with mode='wait'");const a=Se.useMemo(()=>QS(t),[t]),u=a.map(K0),l=Se.useRef(!0),d=Se.useRef(a),p=bb(()=>new Map),[y,A]=Se.useState(a),[P,N]=Se.useState(a);DS(()=>{l.current=!1,d.current=a;for(let B=0;B1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=Se.useContext(ob);return ge.jsx(ge.Fragment,{children:P.map(B=>{const j=K0(B),U=a===P||u.includes(j),K=()=>{if(p.has(j))p.set(j,!0);else return;let J=!0;p.forEach(T=>{T||(J=!1)}),J&&(k==null||k(),N(d.current),i&&i())};return ge.jsx(uX,{isPresent:U,initial:!l.current||n?void 0:!1,custom:U?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:U?void 0:K,children:B},j)})})},Ss=t=>ge.jsx(lX,{children:ge.jsx(oX.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Sb(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return ge.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,ge.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[ge.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),ge.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:ge.jsx(NK,{})})]})]})}function hX(t){return t.lastUsed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function e7(t){var o,a;const{wallet:e,onClick:r}=t,n=ge.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Se.useMemo(()=>hX(e),[e]);return ge.jsx(Sb,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function t7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=vX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Ab);return a[0]===""&&a.length!==1&&a.shift(),r7(a,e)||mX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},r7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?r7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Ab);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},n7=/^\[(.+)\]$/,mX=t=>{if(n7.test(t)){const e=n7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},vX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return yX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Pb(o,n,s,e)}),n},Pb=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:i7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(bX(i)){Pb(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Pb(o,i7(e,s),r,n)})})},i7=(t,e)=>{let r=t;return e.split(Ab).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},bX=t=>t.isThemeGetter,yX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,wX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},s7="!",xX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,p;for(let D=0;Dd?p-d:void 0;return{modifiers:u,hasImportantModifier:A,baseClassName:P,maybePostfixModifierPosition:N}};return r?a=>r({className:a,parseClassName:o}):o},_X=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},EX=t=>({cache:wX(t.cacheSize),parseClassName:xX(t),...gX(t)}),SX=/\s+/,AX=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(SX);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:A}=r(l);let P=!!A,N=n(P?y.substring(0,A):y);if(!N){if(!P){a=l+(a.length>0?" "+a:a);continue}if(N=n(y),!N){a=l+(a.length>0?" "+a:a);continue}P=!1}const D=_X(d).join(":"),k=p?D+s7:D,B=k+N;if(s.includes(B))continue;s.push(B);const j=i(N,P);for(let U=0;U0?" "+a:a)}return a};function PX(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;np(d),t());return r=EX(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=AX(u,r);return i(u,d),d}return function(){return s(PX.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},a7=/^\[(?:([a-z-]+):)?(.+)\]$/i,IX=/^\d+\/\d+$/,CX=new Set(["px","full","screen"]),TX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RX=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,DX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,OX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bo=t=>Wu(t)||CX.has(t)||IX.test(t),Ea=t=>Ku(t,"length",qX),Wu=t=>!!t&&!Number.isNaN(Number(t)),Mb=t=>Ku(t,"number",Wu),oh=t=>!!t&&Number.isInteger(Number(t)),LX=t=>t.endsWith("%")&&Wu(t.slice(0,-1)),cr=t=>a7.test(t),Sa=t=>TX.test(t),kX=new Set(["length","size","percentage"]),BX=t=>Ku(t,kX,c7),$X=t=>Ku(t,"position",c7),FX=new Set(["image","url"]),jX=t=>Ku(t,FX,HX),UX=t=>Ku(t,"",zX),ah=()=>!0,Ku=(t,e,r)=>{const n=a7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},qX=t=>RX.test(t)&&!DX.test(t),c7=()=>!1,zX=t=>OX.test(t),HX=t=>NX.test(t),WX=MX(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),p=Gr("invert"),y=Gr("gap"),A=Gr("gradientColorStops"),P=Gr("gradientColorStopPositions"),N=Gr("inset"),D=Gr("margin"),k=Gr("opacity"),B=Gr("padding"),j=Gr("saturate"),U=Gr("scale"),K=Gr("sepia"),J=Gr("skew"),T=Gr("space"),z=Gr("translate"),ue=()=>["auto","contain","none"],_e=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",Bo,Ea],f=()=>["auto",Wu,cr],g=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],S=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Wu,cr];return{cacheSize:500,separator:":",theme:{colors:[ah],spacing:[Bo,Ea],blur:["none","",Sa,cr],brightness:M(),borderColor:[t],borderRadius:["none","","full",Sa,cr],borderSpacing:E(),borderWidth:m(),contrast:M(),grayscale:S(),hueRotate:M(),invert:S(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[LX,Ea],inset:G(),margin:G(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:S(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Sa]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...g(),cr]}],overflow:[{overflow:_e()}],"overflow-x":[{"overflow-x":_e()}],"overflow-y":[{"overflow-y":_e()}],overscroll:[{overscroll:ue()}],"overscroll-x":[{"overscroll-x":ue()}],"overscroll-y":[{"overscroll-y":ue()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",oh,cr]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",oh,cr]}],"grid-cols":[{"grid-cols":[ah]}],"col-start-end":[{col:["auto",{span:["full",oh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[ah]}],"row-start-end":[{row:["auto",{span:[oh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[B]}],px:[{px:[B]}],py:[{py:[B]}],ps:[{ps:[B]}],pe:[{pe:[B]}],pt:[{pt:[B]}],pr:[{pr:[B]}],pb:[{pb:[B]}],pl:[{pl:[B]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Sa]},Sa]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Sa,Ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Mb]}],"font-family":[{font:[ah]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Wu,Mb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Bo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Bo,Ea]}],"underline-offset":[{"underline-offset":["auto",Bo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...g(),$X]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",BX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},jX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[A]}],"gradient-via":[{via:[A]}],"gradient-to":[{to:[A]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[Bo,cr]}],"outline-w":[{outline:[Bo,Ea]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Bo,Ea]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Sa,UX]}],"shadow-color":[{shadow:[ah]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Sa,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[p]}],saturate:[{saturate:[j]}],sepia:[{sepia:[K]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[j]}],"backdrop-sepia":[{"backdrop-sepia":[K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[U]}],"scale-x":[{"scale-x":[U]}],"scale-y":[{"scale-y":[U]}],rotate:[{rotate:[oh,cr]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[J]}],"skew-y":[{"skew-y":[J]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Bo,Ea,Mb]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function $o(...t){return WX(pX(t))}function u7(t){const{className:e}=t;return ge.jsxs("div",{className:$o("xc-flex xc-items-center xc-gap-2"),children:[ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)}),ge.jsx("div",{className:"xc-shrink-0",children:t.children}),ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)})]})}const KX="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function VX(t){const{onClick:e}=t;function r(){e&&e()}return ge.jsx(u7,{className:"xc-opacity-20",children:ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[ge.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),ge.jsx(u8,{size:16})]})})}function f7(t){const[e,r]=Se.useState(""),{featuredWallets:n,initialized:i}=Kl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Se.useMemo(()=>{const N=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!N.test(e)&&D.test(e)},[e]);function p(N){o(N)}function y(N){r(N.target.value)}async function A(){s(e)}function P(N){N.key==="Enter"&&d&&A()}return ge.jsx(Ss,{children:i&&ge.jsxs(ge.Fragment,{children:[t.header||ge.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),ge.jsxs("div",{children:[ge.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(N=>ge.jsx(e7,{wallet:N,onClick:p},`feature-${N.key}`)),l.showTonConnect&&ge.jsx(Sb,{icon:ge.jsx("img",{className:"xc-h-5 xc-w-5",src:KX}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&ge.jsx(VX,{onClick:a})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&ge.jsx("div",{className:"xc-mb-4 xc-mt-4",children:ge.jsxs(u7,{className:"xc-opacity-20",children:[" ",ge.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),l.showEmailSignIn&&ge.jsxs("div",{className:"xc-mb-4",children:[ge.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:y,onKeyDown:P}),ge.jsx("button",{disabled:!d,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:A,children:"Continue"})]})]})})}function Sc(t){const{title:e}=t;return ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[ge.jsx(OK,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),ge.jsx("span",{children:e})]})}const l7=Se.createContext({channel:"",device:"WEB",app:"",inviterCode:"",role:"C"});function Ib(){return Se.useContext(l7)}function GX(t){const{config:e}=t,[r,n]=Se.useState(e.channel),[i,s]=Se.useState(e.device),[o,a]=Se.useState(e.app),[u,l]=Se.useState(e.role||"C"),[d,p]=Se.useState(e.inviterCode);return Se.useEffect(()=>{n(e.channel),s(e.device),a(e.app),p(e.inviterCode),l(e.role||"C")},[e]),ge.jsx(l7.Provider,{value:{channel:r,device:i,app:o,inviterCode:d,role:u},children:t.children})}var YX=Object.defineProperty,JX=Object.defineProperties,XX=Object.getOwnPropertyDescriptors,V0=Object.getOwnPropertySymbols,h7=Object.prototype.hasOwnProperty,d7=Object.prototype.propertyIsEnumerable,p7=(t,e,r)=>e in t?YX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ZX=(t,e)=>{for(var r in e||(e={}))h7.call(e,r)&&p7(t,r,e[r]);if(V0)for(var r of V0(e))d7.call(e,r)&&p7(t,r,e[r]);return t},QX=(t,e)=>JX(t,XX(e)),eZ=(t,e)=>{var r={};for(var n in t)h7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&V0)for(var n of V0(t))e.indexOf(n)<0&&d7.call(t,n)&&(r[n]=t[n]);return r};function tZ(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function rZ(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var nZ=18,g7=40,iZ=`${g7}px`,sZ=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function oZ({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),p=Yt.useCallback(()=>{let y=t.current,A=e.current;if(!y||!A||u||r==="none")return;let P=y,N=P.getBoundingClientRect().left+P.offsetWidth,D=P.getBoundingClientRect().top+P.offsetHeight/2,k=N-nZ,B=D;document.querySelectorAll(sZ).length===0&&document.elementFromPoint(k,B)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function A(){let N=window.innerWidth-y.getBoundingClientRect().right;a(N>=g7)}A();let P=setInterval(A,1e3);return()=>{clearInterval(P)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let A=setTimeout(p,0),P=setTimeout(p,2e3),N=setTimeout(p,5e3),D=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(A),clearTimeout(P),clearTimeout(N),clearTimeout(D)}},[e,n,r,p]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:iZ}}var m7=Yt.createContext({}),v7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:p="increase-width",pasteTransformer:y,containerClassName:A,noScriptCSSFallback:P=aZ,render:N,children:D}=r,k=eZ(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),B,j,U,K,J;let[T,z]=Yt.useState(typeof k.defaultValue=="string"?k.defaultValue:""),ue=n??T,_e=rZ(ue),G=Yt.useCallback(ie=>{i==null||i(ie),z(ie)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),g=Yt.useRef({value:ue,onChange:G,isIOS:typeof window<"u"&&((j=(B=window==null?void 0:window.CSS)==null?void 0:B.supports)==null?void 0:j.call(B,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(U=m.current)==null?void 0:U.selectionStart,(K=m.current)==null?void 0:K.selectionEnd,(J=m.current)==null?void 0:J.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let ie=m.current,fe=f.current;if(!ie||!fe)return;g.current.value!==ie.value&&g.current.onChange(ie.value),v.current.prev=[ie.selectionStart,ie.selectionEnd,ie.selectionDirection];function ve(){if(document.activeElement!==ie){I(null),ae(null);return}let Te=ie.selectionStart,$e=ie.selectionEnd,Ie=ie.selectionDirection,Le=ie.maxLength,Ve=ie.value,ke=v.current.prev,ze=-1,He=-1,Ee;if(Ve.length!==0&&Te!==null&&$e!==null){let et=Te===$e,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let pt=0;if(ke[0]!==null&&ke[1]!==null){Ee=Je{fe&&fe.style.setProperty("--root-height",`${ie.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(ie),()=>{document.removeEventListener("selectionchange",ve,{capture:!0}),Ne.disconnect()}},[]);let[x,_]=Yt.useState(!1),[S,b]=Yt.useState(!1),[M,I]=Yt.useState(null),[F,ae]=Yt.useState(null);Yt.useEffect(()=>{tZ(()=>{var ie,fe,ve,Me;(ie=m.current)==null||ie.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(ve=m.current)==null?void 0:ve.selectionEnd,$e=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ae(Te),v.current.prev=[Ne,Te,$e])})},[ue,S]),Yt.useEffect(()=>{_e!==void 0&&ue!==_e&&_e.length{let fe=ie.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){ie.preventDefault();return}typeof _e=="string"&&fe.length<_e.length&&document.dispatchEvent(new Event("selectionchange")),G(fe)},[s,G,_e,E]),ee=Yt.useCallback(()=>{var ie;if(m.current){let fe=Math.min(m.current.value.length,s-1),ve=m.current.value.length;(ie=m.current)==null||ie.setSelectionRange(fe,ve),I(fe),ae(ve)}b(!0)},[s]),X=Yt.useCallback(ie=>{var fe,ve;let Me=m.current;if(!y&&(!g.current.isIOS||!ie.clipboardData||!Me))return;let Ne=ie.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),ie.preventDefault();let $e=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(ve=m.current)==null?void 0:ve.selectionEnd,Le=($e!==Ie?ue.slice(0,$e)+Te+ue.slice(Ie):ue.slice(0,$e)+Te+ue.slice($e)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,G(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ae(ke)},[s,G,E,ue]),Q=Yt.useMemo(()=>({position:"relative",cursor:k.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[k.disabled]),R=Yt.useMemo(()=>({position:"absolute",inset:0,width:O.willPushPWMBadge?`calc(100% + ${O.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:O.willPushPWMBadge?`inset(0 ${O.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[O.PWM_BADGE_SPACE_WIDTH,O.willPushPWMBadge,o]),Z=Yt.useMemo(()=>Yt.createElement("input",QX(ZX({autoComplete:k.autoComplete||"one-time-code"},k),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ue.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:R,maxLength:s,value:ue,ref:m,onPaste:ie=>{var fe;X(ie),(fe=k.onPaste)==null||fe.call(k,ie)},onChange:se,onMouseOver:ie=>{var fe;_(!0),(fe=k.onMouseOver)==null||fe.call(k,ie)},onMouseLeave:ie=>{var fe;_(!1),(fe=k.onMouseLeave)==null||fe.call(k,ie)},onFocus:ie=>{var fe;ee(),(fe=k.onFocus)==null||fe.call(k,ie)},onBlur:ie=>{var fe;b(!1),(fe=k.onBlur)==null||fe.call(k,ie)}})),[se,ee,X,l,R,s,F,M,k,E==null?void 0:E.source,ue]),te=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ie,fe)=>{var ve;let Me=S&&M!==null&&F!==null&&(M===F&&fe===M||fe>=M&&feN?N(te):Yt.createElement(m7.Provider,{value:te},D),[D,te,N]);return Yt.createElement(Yt.Fragment,null,P!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,P)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:A},le,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Z)))});v7.displayName="Input";function ch(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var aZ=` [data-input-otp] { --nojs-bg: white !important; --nojs-fg: black !important; @@ -218,7 +218,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene --nojs-bg: black !important; --nojs-fg: white !important; } -}`;const b7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>ge.jsx(v7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));b7.displayName="InputOTP";const y7=Yt.forwardRef(({className:t,...e},r)=>ge.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));y7.displayName="InputOTPGroup";const Ac=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(m7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return ge.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&ge.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:ge.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Ac.displayName="InputOTPSlot";function cZ(t){const{spinning:e,children:r,className:n}=t;return ge.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&ge.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:ge.jsx(vc,{className:"xc-animate-spin"})})]})}function w7(t){const{email:e}=t,[r,n]=Se.useState(0),[i,s]=Se.useState(!1),[o,a]=Se.useState("");async function u(){n(60);const d=setInterval(()=>{n(p=>p===0?(clearInterval(d),0):p-1)},1e3)}async function l(d){if(a(""),!(d.length<6)){s(!0);try{await t.onInputCode(e,d)}catch(p){a(p.message)}s(!1)}}return Se.useEffect(()=>{u()},[]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(FK,{className:"xc-mb-4",size:60}),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:[ge.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),ge.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]}),ge.jsx("div",{className:"xc-mb-2 xc-h-12",children:ge.jsx(cZ,{spinning:i,className:"xc-rounded-xl",children:ge.jsx(b7,{maxLength:6,onChange:l,disabled:i,className:"disabled:xc-opacity-20",children:ge.jsx(y7,{children:ge.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[ge.jsx(Ac,{index:0}),ge.jsx(Ac,{index:1}),ge.jsx(Ac,{index:2}),ge.jsx(Ac,{index:3}),ge.jsx(Ac,{index:4}),ge.jsx(Ac,{index:5})]})})})})}),o&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:o})})]}),ge.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Resend in ${r}s`:ge.jsx("button",{id:"sendCodeButton",onClick:t.onResendCode,children:"Send again"})]}),ge.jsx("div",{id:"captcha-element"})]})}function x7(t){const{email:e}=t,[r,n]=Se.useState(!1),[i,s]=Se.useState(""),o=Se.useMemo(()=>`xn-btn-${new Date().getTime()}`,[e]);async function a(y,A){n(!0),s(""),await va.getEmailCode({account_type:"email",email:y},A),n(!1)}async function u(y){try{return await a(e,JSON.stringify(y)),{captchaResult:!0,bizResult:!0}}catch(A){return s(A.message),{captchaResult:!1,bizResult:!1}}}async function l(y){y&&t.onCodeSend()}const d=Se.useRef();function p(y){d.current=y}return Se.useEffect(()=>{if(e)return window.initAliyunCaptcha({SceneId:"tqyu8129d",prefix:"1mfsn5f",mode:"popup",element:"#captcha-element",button:`#${o}`,captchaVerifyCallback:u,onBizResultCallback:l,getInstance:p,slideStyle:{width:360,height:40},language:"en",region:"cn"}),()=>{var y,A;(y=document.getElementById("aliyunCaptcha-mask"))==null||y.remove(),(A=document.getElementById("aliyunCaptcha-window-popup"))==null||A.remove()}},[e]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(jK,{className:"xc-mb-4",size:60}),ge.jsx("button",{className:"xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2",id:o,children:r?ge.jsx(vc,{className:"xc-animate-spin"}):"I'm not a robot"})]}),i&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:i})})]})}function uZ(t){const{email:e}=t,r=Mb(),[n,i]=Se.useState("captcha");async function s(o,a){const u=await va.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:a,email:o,inviter_code:r.inviterCode,source:{device:r.device,channel:r.channel,app:r.app}});t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),n==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>i("verify-email")}),n==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:s,onResendCode:()=>i("captcha")})]})}var _7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var p=function(f,g){var v=f,x=k[g],_=null,S=0,b=null,M=[],I={},F=function(te,le){_=function(ie){for(var fe=new Array(ie),ve=0;ve=7&&ee(te),b==null&&(b=R(v,x,M)),Q(b,le)},ae=function(te,le){for(var ie=-1;ie<=7;ie+=1)if(!(te+ie<=-1||S<=te+ie))for(var fe=-1;fe<=7;fe+=1)le+fe<=-1||S<=le+fe||(_[te+ie][le+fe]=0<=ie&&ie<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(ie==0||ie==6)||2<=ie&&ie<=4&&2<=fe&&fe<=4)},O=function(){for(var te=8;te>ie&1)==1;_[Math.floor(ie/3)][ie%3+S-8-3]=fe}for(ie=0;ie<18;ie+=1)fe=!te&&(le>>ie&1)==1,_[ie%3+S-8-3][Math.floor(ie/3)]=fe},X=function(te,le){for(var ie=x<<3|le,fe=B.getBCHTypeInfo(ie),ve=0;ve<15;ve+=1){var Me=!te&&(fe>>ve&1)==1;ve<6?_[ve][8]=Me:ve<8?_[ve+1][8]=Me:_[S-15+ve][8]=Me}for(ve=0;ve<15;ve+=1)Me=!te&&(fe>>ve&1)==1,ve<8?_[8][S-ve-1]=Me:ve<9?_[8][15-ve-1+1]=Me:_[8][15-ve-1]=Me;_[S-8][8]=!te},Q=function(te,le){for(var ie=-1,fe=S-1,ve=7,Me=0,Ne=B.getMaskFunction(le),Te=S-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var $e=0;$e<2;$e+=1)if(_[fe][Te-$e]==null){var Ie=!1;Me>>ve&1)==1),Ne(fe,Te-$e)&&(Ie=!Ie),_[fe][Te-$e]=Ie,(ve-=1)==-1&&(Me+=1,ve=7)}if((fe+=ie)<0||S<=fe){fe-=ie,ie=-ie;break}}},R=function(te,le,ie){for(var fe=K.getRSBlocks(te,le),ve=J(),Me=0;Me8*Te)throw"code length overflow. ("+ve.getLengthInBits()+">"+8*Te+")";for(ve.getLengthInBits()+4<=8*Te&&ve.put(0,4);ve.getLengthInBits()%8!=0;)ve.putBit(!1);for(;!(ve.getLengthInBits()>=8*Te||(ve.put(236,8),ve.getLengthInBits()>=8*Te));)ve.put(17,8);return function($e,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Ee=0;Ee=0?rt.getAt(Je):0}}var pt=0;for(Be=0;BeIe)&&(Ne=Ie,Te=$e)}return Te}())},I.createTableTag=function(te,le){te=te||2;var ie="";ie+='";for(var ve=0;ve';ie+=""}return(ie+="")+"
"},I.createSvgTag=function(te,le,ie,fe){var ve={};typeof arguments[0]=="object"&&(te=(ve=arguments[0]).cellSize,le=ve.margin,ie=ve.alt,fe=ve.title),te=te||2,le=le===void 0?4*te:le,(ie=typeof ie=="string"?{text:ie}:ie||{}).text=ie.text||null,ie.id=ie.text?ie.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*te+2*le,Le="";for($e="l"+te+",0 0,"+te+" -"+te+",0 0,-"+te+"z ",Le+=''+Z(fe.text)+"":"",Le+=ie.text?''+Z(ie.text)+"":"",Le+='',Le+='"},I.createDataURL=function(te,le){te=te||2,le=le===void 0?4*te:le;var ie=I.getModuleCount()*te+2*le,fe=le,ve=ie-le;return m(ie,ie,function(Me,Ne){if(fe<=Me&&Me"};var Z=function(te){for(var le="",ie=0;ie":le+=">";break;case"&":le+="&";break;case'"':le+=""";break;default:le+=fe}}return le};return I.createASCII=function(te,le){if((te=te||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Ee,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:pt[Be];ft+=` +}`;const b7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>ge.jsx(v7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));b7.displayName="InputOTP";const y7=Yt.forwardRef(({className:t,...e},r)=>ge.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));y7.displayName="InputOTPGroup";const Ac=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(m7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return ge.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&ge.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:ge.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Ac.displayName="InputOTPSlot";function cZ(t){const{spinning:e,children:r,className:n}=t;return ge.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&ge.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:ge.jsx(vc,{className:"xc-animate-spin"})})]})}function w7(t){const{email:e}=t,[r,n]=Se.useState(0),[i,s]=Se.useState(!1),[o,a]=Se.useState("");async function u(){n(60);const d=setInterval(()=>{n(p=>p===0?(clearInterval(d),0):p-1)},1e3)}async function l(d){if(a(""),!(d.length<6)){s(!0);try{await t.onInputCode(e,d)}catch(p){a(p.message)}s(!1)}}return Se.useEffect(()=>{u()},[]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(FK,{className:"xc-mb-4",size:60}),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:[ge.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),ge.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]}),ge.jsx("div",{className:"xc-mb-2 xc-h-12",children:ge.jsx(cZ,{spinning:i,className:"xc-rounded-xl",children:ge.jsx(b7,{maxLength:6,onChange:l,disabled:i,className:"disabled:xc-opacity-20",children:ge.jsx(y7,{children:ge.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[ge.jsx(Ac,{index:0}),ge.jsx(Ac,{index:1}),ge.jsx(Ac,{index:2}),ge.jsx(Ac,{index:3}),ge.jsx(Ac,{index:4}),ge.jsx(Ac,{index:5})]})})})})}),o&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:o})})]}),ge.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Resend in ${r}s`:ge.jsx("button",{id:"sendCodeButton",onClick:t.onResendCode,children:"Send again"})]}),ge.jsx("div",{id:"captcha-element"})]})}function x7(t){const{email:e}=t,[r,n]=Se.useState(!1),[i,s]=Se.useState(""),o=Se.useMemo(()=>`xn-btn-${new Date().getTime()}`,[e]);async function a(y,A){n(!0),s(""),await va.getEmailCode({account_type:"email",email:y},A),n(!1)}async function u(y){try{return await a(e,JSON.stringify(y)),{captchaResult:!0,bizResult:!0}}catch(A){return s(A.message),{captchaResult:!1,bizResult:!1}}}async function l(y){y&&t.onCodeSend()}const d=Se.useRef();function p(y){d.current=y}return Se.useEffect(()=>{if(e)return window.initAliyunCaptcha({SceneId:"tqyu8129d",prefix:"1mfsn5f",mode:"popup",element:"#captcha-element",button:`#${o}`,captchaVerifyCallback:u,onBizResultCallback:l,getInstance:p,slideStyle:{width:360,height:40},language:"en",region:"cn"}),()=>{var y,A;(y=document.getElementById("aliyunCaptcha-mask"))==null||y.remove(),(A=document.getElementById("aliyunCaptcha-window-popup"))==null||A.remove()}},[e]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(jK,{className:"xc-mb-4",size:60}),ge.jsx("button",{className:"xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2",id:o,children:r?ge.jsx(vc,{className:"xc-animate-spin"}):"I'm not a robot"})]}),i&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:i})})]})}function uZ(t){const{email:e}=t,r=Ib(),[n,i]=Se.useState("captcha");async function s(o,a){const u=await va.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:a,email:o,inviter_code:r.inviterCode,source:{device:r.device,channel:r.channel,app:r.app}});t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),n==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>i("verify-email")}),n==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:s,onResendCode:()=>i("captcha")})]})}var _7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var p=function(f,g){var v=f,x=k[g],_=null,S=0,b=null,M=[],I={},F=function(te,le){_=function(ie){for(var fe=new Array(ie),ve=0;ve=7&&ee(te),b==null&&(b=R(v,x,M)),Q(b,le)},ae=function(te,le){for(var ie=-1;ie<=7;ie+=1)if(!(te+ie<=-1||S<=te+ie))for(var fe=-1;fe<=7;fe+=1)le+fe<=-1||S<=le+fe||(_[te+ie][le+fe]=0<=ie&&ie<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(ie==0||ie==6)||2<=ie&&ie<=4&&2<=fe&&fe<=4)},O=function(){for(var te=8;te>ie&1)==1;_[Math.floor(ie/3)][ie%3+S-8-3]=fe}for(ie=0;ie<18;ie+=1)fe=!te&&(le>>ie&1)==1,_[ie%3+S-8-3][Math.floor(ie/3)]=fe},X=function(te,le){for(var ie=x<<3|le,fe=B.getBCHTypeInfo(ie),ve=0;ve<15;ve+=1){var Me=!te&&(fe>>ve&1)==1;ve<6?_[ve][8]=Me:ve<8?_[ve+1][8]=Me:_[S-15+ve][8]=Me}for(ve=0;ve<15;ve+=1)Me=!te&&(fe>>ve&1)==1,ve<8?_[8][S-ve-1]=Me:ve<9?_[8][15-ve-1+1]=Me:_[8][15-ve-1]=Me;_[S-8][8]=!te},Q=function(te,le){for(var ie=-1,fe=S-1,ve=7,Me=0,Ne=B.getMaskFunction(le),Te=S-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var $e=0;$e<2;$e+=1)if(_[fe][Te-$e]==null){var Ie=!1;Me>>ve&1)==1),Ne(fe,Te-$e)&&(Ie=!Ie),_[fe][Te-$e]=Ie,(ve-=1)==-1&&(Me+=1,ve=7)}if((fe+=ie)<0||S<=fe){fe-=ie,ie=-ie;break}}},R=function(te,le,ie){for(var fe=K.getRSBlocks(te,le),ve=J(),Me=0;Me8*Te)throw"code length overflow. ("+ve.getLengthInBits()+">"+8*Te+")";for(ve.getLengthInBits()+4<=8*Te&&ve.put(0,4);ve.getLengthInBits()%8!=0;)ve.putBit(!1);for(;!(ve.getLengthInBits()>=8*Te||(ve.put(236,8),ve.getLengthInBits()>=8*Te));)ve.put(17,8);return function($e,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Ee=0;Ee=0?rt.getAt(Je):0}}var pt=0;for(Be=0;BeIe)&&(Ne=Ie,Te=$e)}return Te}())},I.createTableTag=function(te,le){te=te||2;var ie="";ie+='";for(var ve=0;ve';ie+=""}return(ie+="")+"
"},I.createSvgTag=function(te,le,ie,fe){var ve={};typeof arguments[0]=="object"&&(te=(ve=arguments[0]).cellSize,le=ve.margin,ie=ve.alt,fe=ve.title),te=te||2,le=le===void 0?4*te:le,(ie=typeof ie=="string"?{text:ie}:ie||{}).text=ie.text||null,ie.id=ie.text?ie.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*te+2*le,Le="";for($e="l"+te+",0 0,"+te+" -"+te+",0 0,-"+te+"z ",Le+=''+Z(fe.text)+"":"",Le+=ie.text?''+Z(ie.text)+"":"",Le+='',Le+='"},I.createDataURL=function(te,le){te=te||2,le=le===void 0?4*te:le;var ie=I.getModuleCount()*te+2*le,fe=le,ve=ie-le;return m(ie,ie,function(Me,Ne){if(fe<=Me&&Me"};var Z=function(te){for(var le="",ie=0;ie":le+=">";break;case"&":le+="&";break;case'"':le+=""";break;default:le+=fe}}return le};return I.createASCII=function(te,le){if((te=te||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Ee,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:pt[Be];ft+=` `}return et%2&&ze>0?ft.substring(0,ft.length-et-1)+Array(et+1).join("▀"):ft.substring(0,ft.length-1)}(le);te-=1,le=le===void 0?2*te:le;var ie,fe,ve,Me,Ne=I.getModuleCount()*te+2*le,Te=le,$e=Ne-le,Ie=Array(te+1).join("██"),Le=Array(te+1).join(" "),Ve="",ke="";for(ie=0;ie>>8),S.push(255&I)):S.push(x)}}return S}};var y,A,P,N,D,k={L:1,M:0,Q:3,H:2},B=(y=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],A=1335,P=7973,D=function(f){for(var g=0;f!=0;)g+=1,f>>>=1;return g},(N={}).getBCHTypeInfo=function(f){for(var g=f<<10;D(g)-D(A)>=0;)g^=A<=0;)g^=P<5&&(v+=3+S-5)}for(x=0;x=256;)x-=255;return f[x]}}}();function U(f,g){if(f.length===void 0)throw f.length+"/"+g;var v=function(){for(var _=0;_>>7-x%8&1)==1},put:function(x,_){for(var S=0;S<_;S+=1)v.putBit((x>>>_-S-1&1)==1)},getLengthInBits:function(){return g},putBit:function(x){var _=Math.floor(g/8);f.length<=_&&f.push(0),x&&(f[_]|=128>>>g%8),g+=1}};return v},T=function(f){var g=f,v={getMode:function(){return 1},getLength:function(S){return g.length},write:function(S){for(var b=g,M=0;M+2>>8&255)+(255&M),_.put(M,13),b+=2}if(b>>8)},writeBytes:function(v,x,_){x=x||0,_=_||v.length;for(var S=0;S<_;S+=1)g.writeByte(v[S+x])},writeString:function(v){for(var x=0;x0&&(v+=","),v+=f[x];return v+"]"}};return g},E=function(f){var g=f,v=0,x=0,_=0,S={read:function(){for(;_<8;){if(v>=g.length){if(_==0)return-1;throw"unexpected end of file./"+_}var M=g.charAt(v);if(v+=1,M=="=")return _=0,-1;M.match(/^\s$/)||(x=x<<6|b(M.charCodeAt(0)),_+=6)}var I=x>>>_-8&255;return _-=8,I}},b=function(M){if(65<=M&&M<=90)return M-65;if(97<=M&&M<=122)return M-97+26;if(48<=M&&M<=57)return M-48+52;if(M==43)return 62;if(M==47)return 63;throw"c:"+M};return S},m=function(f,g,v){for(var x=function(ae,O){var se=ae,ee=O,X=new Array(ae*O),Q={setPixel:function(te,le,ie){X[le*se+te]=ie},write:function(te){te.writeString("GIF87a"),te.writeShort(se),te.writeShort(ee),te.writeByte(128),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(255),te.writeByte(255),te.writeByte(255),te.writeString(","),te.writeShort(0),te.writeShort(0),te.writeShort(se),te.writeShort(ee),te.writeByte(0);var le=R(2);te.writeByte(2);for(var ie=0;le.length-ie>255;)te.writeByte(255),te.writeBytes(le,ie,255),ie+=255;te.writeByte(le.length-ie),te.writeBytes(le,ie,le.length-ie),te.writeByte(0),te.writeString(";")}},R=function(te){for(var le=1<>>Ee)throw"length over";for(;Te+Ee>=8;)Ne.writeByte(255&(He<>>=8-Te,$e=0,Te=0;$e|=He<0&&Ne.writeByte($e)}});Le.write(le,fe);var Ve=0,ke=String.fromCharCode(X[Ve]);for(Ve+=1;Ve=6;)Q(ae>>>O-6),O-=6},X.flush=function(){if(O>0&&(Q(ae<<6-O),ae=0,O=0),se%3!=0)for(var Z=3-se%3,te=0;te>6,128|63&N):N<55296||N>=57344?A.push(224|N>>12,128|N>>6&63,128|63&N):(P++,N=65536+((1023&N)<<10|1023&y.charCodeAt(P)),A.push(240|N>>18,128|N>>12&63,128|N>>6&63,128|63&N))}return A}(p)},(l=typeof(u=function(){return d})=="function"?u.apply(a,[]):u)===void 0||(o.exports=l)}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var u=n[o]={exports:{}};return r[o](u,u.exports,i),u.exports}i.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return i.d(a,{a}),a},i.d=(o,a)=>{for(var u in a)i.o(a,u)&&!i.o(o,u)&&Object.defineProperty(o,u,{enumerable:!0,get:a[u]})},i.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a);var s={};return(()=>{i.d(s,{default:()=>G});const o=E=>!!E&&typeof E=="object"&&!Array.isArray(E);function a(E,...m){if(!m.length)return E;const f=m.shift();return f!==void 0&&o(E)&&o(f)?(E=Object.assign({},E),Object.keys(f).forEach(g=>{const v=E[g],x=f[g];Array.isArray(v)&&Array.isArray(x)?E[g]=x:o(v)&&o(x)?E[g]=a(Object.assign({},v),x):E[g]=x}),a(E,...m)):E}function u(E,m){const f=document.createElement("a");f.download=m,f.href=E,document.body.appendChild(f),f.click(),document.body.removeChild(f)}const l={L:.07,M:.15,Q:.25,H:.3};class d{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"dots":x=this._drawDot;break;case"classy":x=this._drawClassy;break;case"classy-rounded":x=this._drawClassyRounded;break;case"rounded":x=this._drawRounded;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawSquare}x.call(this,{x:m,y:f,size:g,getNeighbor:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_basicSideRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, 0 ${-f}`)}}))}_basicCornerRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_basicCornerExtraRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`)}}))}_basicCornersRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${f/2} ${f/2}h `+f/2+"v "+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_drawDot({x:m,y:f,size:g}){this._basicDot({x:m,y:f,size:g,rotation:0})}_drawSquare({x:m,y:f,size:g}){this._basicSquare({x:m,y:f,size:g,rotation:0})}_drawRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerRounded({x:m,y:f,size:g,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawExtraRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawClassy({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}_drawClassyRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}}class p{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"square":x=this._drawSquare;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawDot}x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g+f/2} ${v}a ${f/2} ${f/2} 0 1 0 0.1 0zm 0 ${x}a ${f/2-x} ${f/2-x} 0 1 1 -0.1 0Z`)}}))}_basicSquare(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f+`zM ${g+x} ${v+x}h `+(f-2*x)+"v "+(f-2*x)+"h "+(2*x-f)+"z")}}))}_basicExtraRounded(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v+2.5*x}v `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*x}h `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*-x}v `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*-x}h `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*x}M ${g+2.5*x} ${v+x}h `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*x}v `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*x}h `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*-x}v `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*-x}`)}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}_drawExtraRounded({x:m,y:f,size:g,rotation:v}){this._basicExtraRounded({x:m,y:f,size:g,rotation:v})}}class y{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;x=this._type==="square"?this._drawSquare:this._drawDot,x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}}const A="circle",P=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],N=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class D{constructor(m,f){this._roundSize=g=>this._options.dotsOptions.roundSize?Math.floor(g):g,this._window=f,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(m.width)),this._element.setAttribute("height",String(m.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),m.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=m.image,this._instanceId=D.instanceCount++,this._options=m}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(m){const f=m.getModuleCount(),g=Math.min(this._options.width,this._options.height)-2*this._options.margin,v=this._options.shape===A?g/Math.sqrt(2):g,x=this._roundSize(v/f);let _={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=m,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:S,qrOptions:b}=this._options,M=S.imageSize*l[b.errorCorrectionLevel],I=Math.floor(M*f*f);_=function({originalHeight:F,originalWidth:ae,maxHiddenDots:O,maxHiddenAxisDots:se,dotSize:ee}){const X={x:0,y:0},Q={x:0,y:0};if(F<=0||ae<=0||O<=0||ee<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const R=F/ae;return X.x=Math.floor(Math.sqrt(O/R)),X.x<=0&&(X.x=1),se&&seO||se&&se{var M,I,F,ae,O,se;return!(this._options.imageOptions.hideBackgroundDots&&S>=(f-_.hideYDots)/2&&S<(f+_.hideYDots)/2&&b>=(f-_.hideXDots)/2&&b<(f+_.hideXDots)/2||!((M=P[S])===null||M===void 0)&&M[b]||!((I=P[S-f+7])===null||I===void 0)&&I[b]||!((F=P[S])===null||F===void 0)&&F[b-f+7]||!((ae=N[S])===null||ae===void 0)&&ae[b]||!((O=N[S-f+7])===null||O===void 0)&&O[b]||!((se=N[S])===null||se===void 0)&&se[b-f+7])}),this.drawCorners(),this._options.image&&await this.drawImage({width:_.width,height:_.height,count:f,dotSize:x})}drawBackground(){var m,f,g;const v=this._element,x=this._options;if(v){const _=(m=x.backgroundOptions)===null||m===void 0?void 0:m.gradient,S=(f=x.backgroundOptions)===null||f===void 0?void 0:f.color;let b=x.height,M=x.width;if(_||S){const I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((g=x.backgroundOptions)===null||g===void 0)&&g.round&&(b=M=Math.min(x.width,x.height),I.setAttribute("rx",String(b/2*x.backgroundOptions.round))),I.setAttribute("x",String(this._roundSize((x.width-M)/2))),I.setAttribute("y",String(this._roundSize((x.height-b)/2))),I.setAttribute("width",String(M)),I.setAttribute("height",String(b)),this._backgroundClipPath.appendChild(I),this._createColor({options:_,color:S,additionalRotation:0,x:0,y:0,height:x.height,width:x.width,name:`background-color-${this._instanceId}`})}}}drawDots(m){var f,g;if(!this._qr)throw"QR code is not defined";const v=this._options,x=this._qr.getModuleCount();if(x>v.width||x>v.height)throw"The canvas is too small.";const _=Math.min(v.width,v.height)-2*v.margin,S=v.shape===A?_/Math.sqrt(2):_,b=this._roundSize(S/x),M=this._roundSize((v.width-x*b)/2),I=this._roundSize((v.height-x*b)/2),F=new d({svg:this._element,type:v.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(f=v.dotsOptions)===null||f===void 0?void 0:f.gradient,color:v.dotsOptions.color,additionalRotation:0,x:0,y:0,height:v.height,width:v.width,name:`dot-color-${this._instanceId}`});for(let ae=0;ae!(O+se<0||ae+ee<0||O+se>=x||ae+ee>=x)&&!(m&&!m(ae+ee,O+se))&&!!this._qr&&this._qr.isDark(ae+ee,O+se)),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element));if(v.shape===A){const ae=this._roundSize((_/b-x)/2),O=x+2*ae,se=M-ae*b,ee=I-ae*b,X=[],Q=this._roundSize(O/2);for(let R=0;R=ae-1&&R<=O-ae&&Z>=ae-1&&Z<=O-ae||Math.sqrt((R-Q)*(R-Q)+(Z-Q)*(Z-Q))>Q?X[R][Z]=0:X[R][Z]=this._qr.isDark(Z-2*ae<0?Z:Z>=x?Z-2*ae:Z-ae,R-2*ae<0?R:R>=x?R-2*ae:R-ae)?1:0}for(let R=0;R{var ie;return!!(!((ie=X[R+le])===null||ie===void 0)&&ie[Z+te])}),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const m=this._element,f=this._options;if(!m)throw"Element code is not defined";const g=this._qr.getModuleCount(),v=Math.min(f.width,f.height)-2*f.margin,x=f.shape===A?v/Math.sqrt(2):v,_=this._roundSize(x/g),S=7*_,b=3*_,M=this._roundSize((f.width-g*_)/2),I=this._roundSize((f.height-g*_)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([F,ae,O])=>{var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me;const Ne=M+F*_*(g-7),Te=I+ae*_*(g-7);let $e=this._dotsClipPath,Ie=this._dotsClipPath;if((!((se=f.cornersSquareOptions)===null||se===void 0)&&se.gradient||!((ee=f.cornersSquareOptions)===null||ee===void 0)&&ee.color)&&($e=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),$e.setAttribute("id",`clip-path-corners-square-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild($e),this._cornersSquareClipPath=this._cornersDotClipPath=Ie=$e,this._createColor({options:(X=f.cornersSquareOptions)===null||X===void 0?void 0:X.gradient,color:(Q=f.cornersSquareOptions)===null||Q===void 0?void 0:Q.color,additionalRotation:O,x:Ne,y:Te,height:S,width:S,name:`corners-square-color-${F}-${ae}-${this._instanceId}`})),(R=f.cornersSquareOptions)===null||R===void 0?void 0:R.type){const Le=new p({svg:this._element,type:f.cornersSquareOptions.type,window:this._window});Le.draw(Ne,Te,S,O),Le._element&&$e&&$e.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=P[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&$e&&$e.appendChild(Le._element))}if((!((te=f.cornersDotOptions)===null||te===void 0)&&te.gradient||!((le=f.cornersDotOptions)===null||le===void 0)&&le.color)&&(Ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Ie.setAttribute("id",`clip-path-corners-dot-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild(Ie),this._cornersDotClipPath=Ie,this._createColor({options:(ie=f.cornersDotOptions)===null||ie===void 0?void 0:ie.gradient,color:(fe=f.cornersDotOptions)===null||fe===void 0?void 0:fe.color,additionalRotation:O,x:Ne+2*_,y:Te+2*_,height:b,width:b,name:`corners-dot-color-${F}-${ae}-${this._instanceId}`})),(ve=f.cornersDotOptions)===null||ve===void 0?void 0:ve.type){const Le=new y({svg:this._element,type:f.cornersDotOptions.type,window:this._window});Le.draw(Ne+2*_,Te+2*_,b,O),Le._element&&Ie&&Ie.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=N[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&Ie&&Ie.appendChild(Le._element))}})}loadImage(){return new Promise((m,f)=>{var g;const v=this._options;if(!v.image)return f("Image is not defined");if(!((g=v.nodeCanvas)===null||g===void 0)&&g.loadImage)v.nodeCanvas.loadImage(v.image).then(x=>{var _,S;if(this._image=x,this._options.imageOptions.saveAsBlob){const b=(_=v.nodeCanvas)===null||_===void 0?void 0:_.createCanvas(this._image.width,this._image.height);(S=b==null?void 0:b.getContext("2d"))===null||S===void 0||S.drawImage(x,0,0),this._imageUri=b==null?void 0:b.toDataURL()}m()}).catch(f);else{const x=new this._window.Image;typeof v.imageOptions.crossOrigin=="string"&&(x.crossOrigin=v.imageOptions.crossOrigin),this._image=x,x.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await async function(_,S){return new Promise(b=>{const M=new S.XMLHttpRequest;M.onload=function(){const I=new S.FileReader;I.onloadend=function(){b(I.result)},I.readAsDataURL(M.response)},M.open("GET",_),M.responseType="blob",M.send()})}(v.image||"",this._window)),m()},x.src=v.image}})}async drawImage({width:m,height:f,count:g,dotSize:v}){const x=this._options,_=this._roundSize((x.width-g*v)/2),S=this._roundSize((x.height-g*v)/2),b=_+this._roundSize(x.imageOptions.margin+(g*v-m)/2),M=S+this._roundSize(x.imageOptions.margin+(g*v-f)/2),I=m-2*x.imageOptions.margin,F=f-2*x.imageOptions.margin,ae=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");ae.setAttribute("href",this._imageUri||""),ae.setAttribute("x",String(b)),ae.setAttribute("y",String(M)),ae.setAttribute("width",`${I}px`),ae.setAttribute("height",`${F}px`),this._element.appendChild(ae)}_createColor({options:m,color:f,additionalRotation:g,x:v,y:x,height:_,width:S,name:b}){const M=S>_?S:_,I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(I.setAttribute("x",String(v)),I.setAttribute("y",String(x)),I.setAttribute("height",String(_)),I.setAttribute("width",String(S)),I.setAttribute("clip-path",`url('#clip-path-${b}')`),m){let F;if(m.type==="radial")F=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("fx",String(v+S/2)),F.setAttribute("fy",String(x+_/2)),F.setAttribute("cx",String(v+S/2)),F.setAttribute("cy",String(x+_/2)),F.setAttribute("r",String(M/2));else{const ae=((m.rotation||0)+g)%(2*Math.PI),O=(ae+2*Math.PI)%(2*Math.PI);let se=v+S/2,ee=x+_/2,X=v+S/2,Q=x+_/2;O>=0&&O<=.25*Math.PI||O>1.75*Math.PI&&O<=2*Math.PI?(se-=S/2,ee-=_/2*Math.tan(ae),X+=S/2,Q+=_/2*Math.tan(ae)):O>.25*Math.PI&&O<=.75*Math.PI?(ee-=_/2,se-=S/2/Math.tan(ae),Q+=_/2,X+=S/2/Math.tan(ae)):O>.75*Math.PI&&O<=1.25*Math.PI?(se+=S/2,ee+=_/2*Math.tan(ae),X-=S/2,Q-=_/2*Math.tan(ae)):O>1.25*Math.PI&&O<=1.75*Math.PI&&(ee+=_/2,se+=S/2/Math.tan(ae),Q-=_/2,X-=S/2/Math.tan(ae)),F=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("x1",String(Math.round(se))),F.setAttribute("y1",String(Math.round(ee))),F.setAttribute("x2",String(Math.round(X))),F.setAttribute("y2",String(Math.round(Q)))}m.colorStops.forEach(({offset:ae,color:O})=>{const se=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");se.setAttribute("offset",100*ae+"%"),se.setAttribute("stop-color",O),F.appendChild(se)}),I.setAttribute("fill",`url('#${b}')`),this._defs.appendChild(F)}else f&&I.setAttribute("fill",f);this._element.appendChild(I)}}D.instanceCount=0;const k=D,B="canvas",j={};for(let E=0;E<=40;E++)j[E]=E;const U={type:B,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:j[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function K(E){const m=Object.assign({},E);if(!m.colorStops||!m.colorStops.length)throw"Field 'colorStops' is required in gradient";return m.rotation?m.rotation=Number(m.rotation):m.rotation=0,m.colorStops=m.colorStops.map(f=>Object.assign(Object.assign({},f),{offset:Number(f.offset)})),m}function J(E){const m=Object.assign({},E);return m.width=Number(m.width),m.height=Number(m.height),m.margin=Number(m.margin),m.imageOptions=Object.assign(Object.assign({},m.imageOptions),{hideBackgroundDots:!!m.imageOptions.hideBackgroundDots,imageSize:Number(m.imageOptions.imageSize),margin:Number(m.imageOptions.margin)}),m.margin>Math.min(m.width,m.height)&&(m.margin=Math.min(m.width,m.height)),m.dotsOptions=Object.assign({},m.dotsOptions),m.dotsOptions.gradient&&(m.dotsOptions.gradient=K(m.dotsOptions.gradient)),m.cornersSquareOptions&&(m.cornersSquareOptions=Object.assign({},m.cornersSquareOptions),m.cornersSquareOptions.gradient&&(m.cornersSquareOptions.gradient=K(m.cornersSquareOptions.gradient))),m.cornersDotOptions&&(m.cornersDotOptions=Object.assign({},m.cornersDotOptions),m.cornersDotOptions.gradient&&(m.cornersDotOptions.gradient=K(m.cornersDotOptions.gradient))),m.backgroundOptions&&(m.backgroundOptions=Object.assign({},m.backgroundOptions),m.backgroundOptions.gradient&&(m.backgroundOptions.gradient=K(m.backgroundOptions.gradient))),m}var T=i(873),z=i.n(T);function ue(E){if(!E)throw new Error("Extension must be defined");E[0]==="."&&(E=E.substring(1));const m={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[E.toLowerCase()];if(!m)throw new Error(`Extension "${E}" is not supported`);return m}class _e{constructor(m){m!=null&&m.jsdom?this._window=new m.jsdom("",{resources:"usable"}).window:this._window=window,this._options=m?J(a(U,m)):U,this.update()}static _clearContainer(m){m&&(m.innerHTML="")}_setupSvg(){if(!this._qr)return;const m=new k(this._options,this._window);this._svg=m.getElement(),this._svgDrawingPromise=m.drawQR(this._qr).then(()=>{var f;this._svg&&((f=this._extension)===null||f===void 0||f.call(this,m.getElement(),this._options))})}_setupCanvas(){var m,f;this._qr&&(!((m=this._options.nodeCanvas)===null||m===void 0)&&m.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(f=this._svgDrawingPromise)===null||f===void 0?void 0:f.then(()=>{var g;if(!this._svg)return;const v=this._svg,x=new this._window.XMLSerializer().serializeToString(v),_=btoa(x),S=`data:${ue("svg")};base64,${_}`;if(!((g=this._options.nodeCanvas)===null||g===void 0)&&g.loadImage)return this._options.nodeCanvas.loadImage(S).then(b=>{var M,I;b.width=this._options.width,b.height=this._options.height,(I=(M=this._nodeCanvas)===null||M===void 0?void 0:M.getContext("2d"))===null||I===void 0||I.drawImage(b,0,0)});{const b=new this._window.Image;return new Promise(M=>{b.onload=()=>{var I,F;(F=(I=this._domCanvas)===null||I===void 0?void 0:I.getContext("2d"))===null||F===void 0||F.drawImage(b,0,0),M()},b.src=S})}}))}async _getElement(m="png"){if(!this._qr)throw"QR code is empty";return m.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(m){_e._clearContainer(this._container),this._options=m?J(a(this._options,m)):this._options,this._options.data&&(this._qr=z()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(f){switch(!0){case/^[0-9]*$/.test(f):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(f):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===B?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(m){if(m){if(typeof m.appendChild!="function")throw"Container should be a single DOM node";this._options.type===B?this._domCanvas&&m.appendChild(this._domCanvas):this._svg&&m.appendChild(this._svg),this._container=m}}applyExtension(m){if(!m)throw"Extension function should be defined.";this._extension=m,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(m="png"){if(!this._qr)throw"QR code is empty";const f=await this._getElement(m),g=ue(m);if(!f)return null;if(m.toLowerCase()==="svg"){const v=`\r ${new this._window.XMLSerializer().serializeToString(f)}`;return typeof Blob>"u"||this._options.jsdom?Buffer.from(v):new Blob([v],{type:g})}return new Promise(v=>{const x=f;if("toBuffer"in x)if(g==="image/png")v(x.toBuffer(g));else if(g==="image/jpeg")v(x.toBuffer(g));else{if(g!=="application/pdf")throw Error("Unsupported extension");v(x.toBuffer(g))}else"toBlob"in x&&x.toBlob(v,g,1)})}async download(m){if(!this._qr)throw"QR code is empty";if(typeof Blob>"u")throw"Cannot download in Node.js, call getRawData instead.";let f="png",g="qr";typeof m=="string"?(f=m,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):typeof m=="object"&&m!==null&&(m.name&&(g=m.name),m.extension&&(f=m.extension));const v=await this._getElement(f);if(v)if(f.toLowerCase()==="svg"){let x=new XMLSerializer().serializeToString(v);x=`\r @@ -237,11 +237,11 @@ Not Before: ${o.toISOString()}`),a&&(D+=` Request ID: ${a}`),u){let k=` Resources:`;for(const B of u){if(!S7(B))throw new Aa({field:"resources",metaMessages:["- Every resource must be a RFC 3986 URI.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${B}`]});k+=` - ${B}`}D+=k}return`${N} -${D}`}const hZ=/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/,dZ=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/,pZ=/^localhost(:[0-9]{1,5})?$/,gZ=/^[a-zA-Z0-9]{8,}$/,mZ=/^([a-zA-Z][a-zA-Z0-9+-.]*)$/,P7="7a4434fefbcc9af474fb5c995e47d286",vZ={projectId:P7,metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},bZ={namespaces:{eip155:{methods:["eth_sendTransaction","eth_signTransaction","eth_sign","personal_sign","eth_signTypedData"],chains:["eip155:1"],events:["chainChanged","accountsChanged","disconnect"],rpcMap:{1:`https://rpc.walletconnect.com?chainId=eip155:1&projectId=${P7}`}}},skipPairing:!1};function yZ(t,e){const r=window.location.host,n=window.location.href;return A7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function M7(t){var ue,_e,G;const e=Se.useRef(null),{wallet:r,onGetExtension:n,onSignFinish:i}=t,[s,o]=Se.useState(""),[a,u]=Se.useState(!1),[l,d]=Se.useState(""),[p,y]=Se.useState("scan"),A=Se.useRef(),[P,N]=Se.useState((ue=r.config)==null?void 0:ue.image),[D,k]=Se.useState(!1),{saveLastUsedWallet:B}=Kl();async function j(E){var f,g,v,x;u(!0);const m=await pz.init(vZ);m.session&&await m.disconnect();try{if(y("scan"),m.on("display_uri",ae=>{console.log("display_uri",ae),o(ae),u(!1),y("scan")}),m.on("error",ae=>{console.log(ae)}),m.on("session_update",ae=>{console.log("session_update",ae)}),!await m.connect(bZ))throw new Error("Walletconnect init failed");const S=new Wf(m);N(((f=S.config)==null?void 0:f.image)||((g=E.config)==null?void 0:g.image));const b=await S.getAddress(),M=await va.getNonce({account_type:"block_chain"});console.log("get nonce",M);const I=yZ(b,M);y("sign");const F=await S.signMessage(I,b);y("waiting"),await i(S,{message:I,nonce:M,signature:F,address:b,wallet_name:((v=S.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),B(S)}catch(_){console.log("err",_),d(_.details||_.message)}}function U(){A.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),A.current.append(e.current)}function K(E){var m;console.log(A.current),(m=A.current)==null||m.update({data:E})}Se.useEffect(()=>{s&&K(s)},[s]),Se.useEffect(()=>{j(r)},[r]),Se.useEffect(()=>{U()},[]);function J(){d(""),K(""),j(r)}function T(){k(!0),navigator.clipboard.writeText(s),setTimeout(()=>{k(!1)},2500)}function z(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return ge.jsxs("div",{children:[ge.jsx("div",{className:"xc-text-center",children:ge.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[ge.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),ge.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?ge.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):ge.jsx("img",{className:"xc-h-10 xc-w-10",src:P})})]})}),ge.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[ge.jsx("button",{disabled:!s,onClick:T,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:D?ge.jsxs(ge.Fragment,{children:[" ",ge.jsx(LK,{})," Copied!"]}):ge.jsxs(ge.Fragment,{children:[ge.jsx($K,{}),"Copy QR URL"]})}),((_e=r.config)==null?void 0:_e.getWallet)&&ge.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[ge.jsx(kK,{}),"Get Extension"]}),((G=r.config)==null?void 0:G.desktop_link)&&ge.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:z,children:[ge.jsx(f8,{}),"Desktop"]})]}),ge.jsx("div",{className:"xc-text-center",children:l?ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),ge.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:J,children:"Retry"})]}):ge.jsxs(ge.Fragment,{children:[p==="scan"&&ge.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),p==="connect"&&ge.jsx("p",{children:"Click connect in your wallet app"}),p==="sign"&&ge.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),p==="waiting"&&ge.jsx("div",{className:"xc-text-center",children:ge.jsx(vc,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const wZ="Accept connection request in the wallet",xZ="Accept sign-in request in your wallet";function _Z(t,e){const r=window.location.host,n=window.location.href;return A7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function I7(t){var p;const[e,r]=Se.useState(),{wallet:n,onSignFinish:i}=t,s=Se.useRef(),[o,a]=Se.useState("connect"),{saveLastUsedWallet:u}=Kl();async function l(y){var A;try{a("connect");const P=await n.connect();if(!P||P.length===0)throw new Error("Wallet connect error");const N=og(P[0]),D=_Z(N,y);a("sign");const k=await n.signMessage(D,N);if(!k||k.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:N,signature:k,message:D,nonce:y,wallet_name:((A=n.config)==null?void 0:A.name)||""}),u(n)}catch(P){console.log(P.details),r(P.details||P.message)}}async function d(){try{r("");const y=await va.getNonce({account_type:"block_chain"});s.current=y,l(s.current)}catch(y){console.log(y.details),r(y.message)}}return Se.useEffect(()=>{d()},[]),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[ge.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(p=n.config)==null?void 0:p.image,alt:""}),e&&ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),ge.jsx("div",{className:"xc-flex xc-gap-2",children:ge.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:d,children:"Retry"})})]}),!e&&ge.jsxs(ge.Fragment,{children:[o==="connect"&&ge.jsx("span",{className:"xc-text-center",children:wZ}),o==="sign"&&ge.jsx("span",{className:"xc-text-center",children:xZ}),o==="waiting"&&ge.jsx("span",{className:"xc-text-center",children:ge.jsx(vc,{className:"xc-animate-spin"})})]})]})}const Vu="https://static.codatta.io/codatta-connect/wallet-icons.svg",EZ="https://itunes.apple.com/app/",SZ="https://play.google.com/store/apps/details?id=",AZ="https://chromewebstore.google.com/detail/",PZ="https://chromewebstore.google.com/detail/",MZ="https://addons.mozilla.org/en-US/firefox/addon/",IZ="https://microsoftedge.microsoft.com/addons/detail/";function Gu(t){const{icon:e,title:r,link:n}=t;return ge.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[ge.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,ge.jsx(u8,{className:"xc-ml-auto xc-text-gray-400"})]})}function CZ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${EZ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${SZ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${AZ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${PZ}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${MZ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${IZ}${t.edge_addon_id}`),e}function C7(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=CZ(r);return ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),ge.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),ge.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),ge.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&ge.jsx(Gu,{link:n.chromeStoreLink,icon:`${Vu}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&ge.jsx(Gu,{link:n.appStoreLink,icon:`${Vu}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&ge.jsx(Gu,{link:n.playStoreLink,icon:`${Vu}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&ge.jsx(Gu,{link:n.edgeStoreLink,icon:`${Vu}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&ge.jsx(Gu,{link:n.braveStoreLink,icon:`${Vu}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&ge.jsx(Gu,{link:n.firefoxStoreLink,icon:`${Vu}#firefox`,title:"Mozilla Firefox"})]})]})}function TZ(t){const{wallet:e}=t,[r,n]=Se.useState(e.installed?"connect":"qr"),i=Mb();async function s(o,a){var l;const u=await va.walletLogin({account_type:"block_chain",account_enum:i.role,connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&ge.jsx(M7,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&ge.jsx(I7,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&ge.jsx(C7,{wallet:e})]})}function RZ(t){const{wallet:e,onClick:r}=t,n=ge.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return ge.jsx(Eb,{icon:n,title:i,onClick:()=>r(e)})}function T7(t){const{connector:e}=t,[r,n]=Se.useState(),[i,s]=Se.useState([]),o=Se.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d),console.log(d)}Se.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[ge.jsx(l8,{className:"xc-shrink-0 xc-opacity-50"}),ge.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),ge.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>ge.jsx(RZ,{wallet:d,onClick:l},d.name))})]})}var R7={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,$[H+1]=V>>16&255,$[H+2]=V>>8&255,$[H+3]=V&255,$[H+4]=C>>24&255,$[H+5]=C>>16&255,$[H+6]=C>>8&255,$[H+7]=C&255}function N($,H,V,C,Y){var q,oe=0;for(q=0;q>>8)-1}function D($,H,V,C){return N($,H,V,C,16)}function k($,H,V,C){return N($,H,V,C,32)}function B($,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,Ue=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=oe,wt=pe,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;dt=dt+Y|0,_t=_t+q|0,ot=ot+oe|0,wt=wt+pe|0,lt=lt+xe|0,at=at+Re|0,Ae=Ae+De|0,Pe=Pe+it|0,Ge=Ge+Ue|0,je=je+gt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=_t>>>0&255,$[5]=_t>>>8&255,$[6]=_t>>>16&255,$[7]=_t>>>24&255,$[8]=ot>>>0&255,$[9]=ot>>>8&255,$[10]=ot>>>16&255,$[11]=ot>>>24&255,$[12]=wt>>>0&255,$[13]=wt>>>8&255,$[14]=wt>>>16&255,$[15]=wt>>>24&255,$[16]=lt>>>0&255,$[17]=lt>>>8&255,$[18]=lt>>>16&255,$[19]=lt>>>24&255,$[20]=at>>>0&255,$[21]=at>>>8&255,$[22]=at>>>16&255,$[23]=at>>>24&255,$[24]=Ae>>>0&255,$[25]=Ae>>>8&255,$[26]=Ae>>>16&255,$[27]=Ae>>>24&255,$[28]=Pe>>>0&255,$[29]=Pe>>>8&255,$[30]=Pe>>>16&255,$[31]=Pe>>>24&255,$[32]=Ge>>>0&255,$[33]=Ge>>>8&255,$[34]=Ge>>>16&255,$[35]=Ge>>>24&255,$[36]=je>>>0&255,$[37]=je>>>8&255,$[38]=je>>>16&255,$[39]=je>>>24&255,$[40]=qe>>>0&255,$[41]=qe>>>8&255,$[42]=qe>>>16&255,$[43]=qe>>>24&255,$[44]=Xe>>>0&255,$[45]=Xe>>>8&255,$[46]=Xe>>>16&255,$[47]=Xe>>>24&255,$[48]=kt>>>0&255,$[49]=kt>>>8&255,$[50]=kt>>>16&255,$[51]=kt>>>24&255,$[52]=Wt>>>0&255,$[53]=Wt>>>8&255,$[54]=Wt>>>16&255,$[55]=Wt>>>24&255,$[56]=Zt>>>0&255,$[57]=Zt>>>8&255,$[58]=Zt>>>16&255,$[59]=Zt>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255}function j($,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,Ue=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=oe,wt=pe,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=at>>>0&255,$[5]=at>>>8&255,$[6]=at>>>16&255,$[7]=at>>>24&255,$[8]=qe>>>0&255,$[9]=qe>>>8&255,$[10]=qe>>>16&255,$[11]=qe>>>24&255,$[12]=Kt>>>0&255,$[13]=Kt>>>8&255,$[14]=Kt>>>16&255,$[15]=Kt>>>24&255,$[16]=Ae>>>0&255,$[17]=Ae>>>8&255,$[18]=Ae>>>16&255,$[19]=Ae>>>24&255,$[20]=Pe>>>0&255,$[21]=Pe>>>8&255,$[22]=Pe>>>16&255,$[23]=Pe>>>24&255,$[24]=Ge>>>0&255,$[25]=Ge>>>8&255,$[26]=Ge>>>16&255,$[27]=Ge>>>24&255,$[28]=je>>>0&255,$[29]=je>>>8&255,$[30]=je>>>16&255,$[31]=je>>>24&255}function U($,H,V,C){B($,H,V,C)}function K($,H,V,C){j($,H,V,C)}var J=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T($,H,V,C,Y,q,oe){var pe=new Uint8Array(16),xe=new Uint8Array(64),Re,De;for(De=0;De<16;De++)pe[De]=0;for(De=0;De<8;De++)pe[De]=q[De];for(;Y>=64;){for(U(xe,pe,oe,J),De=0;De<64;De++)$[H+De]=V[C+De]^xe[De];for(Re=1,De=8;De<16;De++)Re=Re+(pe[De]&255)|0,pe[De]=Re&255,Re>>>=8;Y-=64,H+=64,C+=64}if(Y>0)for(U(xe,pe,oe,J),De=0;De=64;){for(U(oe,q,Y,J),xe=0;xe<64;xe++)$[H+xe]=oe[xe];for(pe=1,xe=8;xe<16;xe++)pe=pe+(q[xe]&255)|0,q[xe]=pe&255,pe>>>=8;V-=64,H+=64}if(V>0)for(U(oe,q,Y,J),xe=0;xe>>13|V<<3)&8191,C=$[4]&255|($[5]&255)<<8,this.r[2]=(V>>>10|C<<6)&7939,Y=$[6]&255|($[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,q=$[8]&255|($[9]&255)<<8,this.r[4]=(Y>>>4|q<<12)&255,this.r[5]=q>>>1&8190,oe=$[10]&255|($[11]&255)<<8,this.r[6]=(q>>>14|oe<<2)&8191,pe=$[12]&255|($[13]&255)<<8,this.r[7]=(oe>>>11|pe<<5)&8065,xe=$[14]&255|($[15]&255)<<8,this.r[8]=(pe>>>8|xe<<8)&8191,this.r[9]=xe>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};G.prototype.blocks=function($,H,V){for(var C=this.fin?0:2048,Y,q,oe,pe,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Ae=this.h[3],Pe=this.h[4],Ge=this.h[5],je=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],de=this.r[3],nr=this.r[4],dr=this.r[5],pr=this.r[6],Qt=this.r[7],gr=this.r[8],lr=this.r[9];V>=16;)Y=$[H+0]&255|($[H+1]&255)<<8,wt+=Y&8191,q=$[H+2]&255|($[H+3]&255)<<8,lt+=(Y>>>13|q<<3)&8191,oe=$[H+4]&255|($[H+5]&255)<<8,at+=(q>>>10|oe<<6)&8191,pe=$[H+6]&255|($[H+7]&255)<<8,Ae+=(oe>>>7|pe<<9)&8191,xe=$[H+8]&255|($[H+9]&255)<<8,Pe+=(pe>>>4|xe<<12)&8191,Ge+=xe>>>1&8191,Re=$[H+10]&255|($[H+11]&255)<<8,je+=(xe>>>14|Re<<2)&8191,De=$[H+12]&255|($[H+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=$[H+14]&255|($[H+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,Ue=0,gt=Ue,gt+=wt*Wt,gt+=lt*(5*lr),gt+=at*(5*gr),gt+=Ae*(5*Qt),gt+=Pe*(5*pr),Ue=gt>>>13,gt&=8191,gt+=Ge*(5*dr),gt+=je*(5*nr),gt+=qe*(5*de),gt+=Xe*(5*Kt),gt+=kt*(5*Zt),Ue+=gt>>>13,gt&=8191,st=Ue,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Ae*(5*gr),st+=Pe*(5*Qt),Ue=st>>>13,st&=8191,st+=Ge*(5*pr),st+=je*(5*dr),st+=qe*(5*nr),st+=Xe*(5*de),st+=kt*(5*Kt),Ue+=st>>>13,st&=8191,tt=Ue,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Ae*(5*lr),tt+=Pe*(5*gr),Ue=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=je*(5*pr),tt+=qe*(5*dr),tt+=Xe*(5*nr),tt+=kt*(5*de),Ue+=tt>>>13,tt&=8191,At=Ue,At+=wt*de,At+=lt*Kt,At+=at*Zt,At+=Ae*Wt,At+=Pe*(5*lr),Ue=At>>>13,At&=8191,At+=Ge*(5*gr),At+=je*(5*Qt),At+=qe*(5*pr),At+=Xe*(5*dr),At+=kt*(5*nr),Ue+=At>>>13,At&=8191,Rt=Ue,Rt+=wt*nr,Rt+=lt*de,Rt+=at*Kt,Rt+=Ae*Zt,Rt+=Pe*Wt,Ue=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=je*(5*gr),Rt+=qe*(5*Qt),Rt+=Xe*(5*pr),Rt+=kt*(5*dr),Ue+=Rt>>>13,Rt&=8191,Mt=Ue,Mt+=wt*dr,Mt+=lt*nr,Mt+=at*de,Mt+=Ae*Kt,Mt+=Pe*Zt,Ue=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=je*(5*lr),Mt+=qe*(5*gr),Mt+=Xe*(5*Qt),Mt+=kt*(5*pr),Ue+=Mt>>>13,Mt&=8191,Et=Ue,Et+=wt*pr,Et+=lt*dr,Et+=at*nr,Et+=Ae*de,Et+=Pe*Kt,Ue=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=je*Wt,Et+=qe*(5*lr),Et+=Xe*(5*gr),Et+=kt*(5*Qt),Ue+=Et>>>13,Et&=8191,dt=Ue,dt+=wt*Qt,dt+=lt*pr,dt+=at*dr,dt+=Ae*nr,dt+=Pe*de,Ue=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=je*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*gr),Ue+=dt>>>13,dt&=8191,_t=Ue,_t+=wt*gr,_t+=lt*Qt,_t+=at*pr,_t+=Ae*dr,_t+=Pe*nr,Ue=_t>>>13,_t&=8191,_t+=Ge*de,_t+=je*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),Ue+=_t>>>13,_t&=8191,ot=Ue,ot+=wt*lr,ot+=lt*gr,ot+=at*Qt,ot+=Ae*pr,ot+=Pe*dr,Ue=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=je*de,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,Ue+=ot>>>13,ot&=8191,Ue=(Ue<<2)+Ue|0,Ue=Ue+gt|0,gt=Ue&8191,Ue=Ue>>>13,st+=Ue,wt=gt,lt=st,at=tt,Ae=At,Pe=Rt,Ge=Mt,je=Et,qe=dt,Xe=_t,kt=ot,H+=16,V-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Ae,this.h[4]=Pe,this.h[5]=Ge,this.h[6]=je,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},G.prototype.finish=function($,H){var V=new Uint16Array(10),C,Y,q,oe;if(this.leftover){for(oe=this.leftover,this.buffer[oe++]=1;oe<16;oe++)this.buffer[oe]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,oe=2;oe<10;oe++)this.h[oe]+=C,C=this.h[oe]>>>13,this.h[oe]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,V[0]=this.h[0]+5,C=V[0]>>>13,V[0]&=8191,oe=1;oe<10;oe++)V[oe]=this.h[oe]+C,C=V[oe]>>>13,V[oe]&=8191;for(V[9]-=8192,Y=(C^1)-1,oe=0;oe<10;oe++)V[oe]&=Y;for(Y=~Y,oe=0;oe<10;oe++)this.h[oe]=this.h[oe]&Y|V[oe];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,q=this.h[0]+this.pad[0],this.h[0]=q&65535,oe=1;oe<8;oe++)q=(this.h[oe]+this.pad[oe]|0)+(q>>>16)|0,this.h[oe]=q&65535;$[H+0]=this.h[0]>>>0&255,$[H+1]=this.h[0]>>>8&255,$[H+2]=this.h[1]>>>0&255,$[H+3]=this.h[1]>>>8&255,$[H+4]=this.h[2]>>>0&255,$[H+5]=this.h[2]>>>8&255,$[H+6]=this.h[3]>>>0&255,$[H+7]=this.h[3]>>>8&255,$[H+8]=this.h[4]>>>0&255,$[H+9]=this.h[4]>>>8&255,$[H+10]=this.h[5]>>>0&255,$[H+11]=this.h[5]>>>8&255,$[H+12]=this.h[6]>>>0&255,$[H+13]=this.h[6]>>>8&255,$[H+14]=this.h[7]>>>0&255,$[H+15]=this.h[7]>>>8&255},G.prototype.update=function($,H,V){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>V&&(Y=V),C=0;C=16&&(Y=V-V%16,this.blocks($,H,Y),H+=Y,V-=Y),V){for(C=0;C>16&1),q[V-1]&=65535;q[15]=oe[15]-32767-(q[14]>>16&1),Y=q[15]>>16&1,q[14]&=65535,_(oe,q,1-Y)}for(V=0;V<16;V++)$[2*V]=oe[V]&255,$[2*V+1]=oe[V]>>8}function b($,H){var V=new Uint8Array(32),C=new Uint8Array(32);return S(V,$),S(C,H),k(V,0,C,0)}function M($){var H=new Uint8Array(32);return S(H,$),H[0]&1}function I($,H){var V;for(V=0;V<16;V++)$[V]=H[2*V]+(H[2*V+1]<<8);$[15]&=32767}function F($,H,V){for(var C=0;C<16;C++)$[C]=H[C]+V[C]}function ae($,H,V){for(var C=0;C<16;C++)$[C]=H[C]-V[C]}function O($,H,V){var C,Y,q=0,oe=0,pe=0,xe=0,Re=0,De=0,it=0,Ue=0,gt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Ae=0,Pe=0,Ge=0,je=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,de=V[0],nr=V[1],dr=V[2],pr=V[3],Qt=V[4],gr=V[5],lr=V[6],Lr=V[7],mr=V[8],wr=V[9],Br=V[10],$r=V[11],Ir=V[12],hn=V[13],dn=V[14],pn=V[15];C=H[0],q+=C*de,oe+=C*nr,pe+=C*dr,xe+=C*pr,Re+=C*Qt,De+=C*gr,it+=C*lr,Ue+=C*Lr,gt+=C*mr,st+=C*wr,tt+=C*Br,At+=C*$r,Rt+=C*Ir,Mt+=C*hn,Et+=C*dn,dt+=C*pn,C=H[1],oe+=C*de,pe+=C*nr,xe+=C*dr,Re+=C*pr,De+=C*Qt,it+=C*gr,Ue+=C*lr,gt+=C*Lr,st+=C*mr,tt+=C*wr,At+=C*Br,Rt+=C*$r,Mt+=C*Ir,Et+=C*hn,dt+=C*dn,_t+=C*pn,C=H[2],pe+=C*de,xe+=C*nr,Re+=C*dr,De+=C*pr,it+=C*Qt,Ue+=C*gr,gt+=C*lr,st+=C*Lr,tt+=C*mr,At+=C*wr,Rt+=C*Br,Mt+=C*$r,Et+=C*Ir,dt+=C*hn,_t+=C*dn,ot+=C*pn,C=H[3],xe+=C*de,Re+=C*nr,De+=C*dr,it+=C*pr,Ue+=C*Qt,gt+=C*gr,st+=C*lr,tt+=C*Lr,At+=C*mr,Rt+=C*wr,Mt+=C*Br,Et+=C*$r,dt+=C*Ir,_t+=C*hn,ot+=C*dn,wt+=C*pn,C=H[4],Re+=C*de,De+=C*nr,it+=C*dr,Ue+=C*pr,gt+=C*Qt,st+=C*gr,tt+=C*lr,At+=C*Lr,Rt+=C*mr,Mt+=C*wr,Et+=C*Br,dt+=C*$r,_t+=C*Ir,ot+=C*hn,wt+=C*dn,lt+=C*pn,C=H[5],De+=C*de,it+=C*nr,Ue+=C*dr,gt+=C*pr,st+=C*Qt,tt+=C*gr,At+=C*lr,Rt+=C*Lr,Mt+=C*mr,Et+=C*wr,dt+=C*Br,_t+=C*$r,ot+=C*Ir,wt+=C*hn,lt+=C*dn,at+=C*pn,C=H[6],it+=C*de,Ue+=C*nr,gt+=C*dr,st+=C*pr,tt+=C*Qt,At+=C*gr,Rt+=C*lr,Mt+=C*Lr,Et+=C*mr,dt+=C*wr,_t+=C*Br,ot+=C*$r,wt+=C*Ir,lt+=C*hn,at+=C*dn,Ae+=C*pn,C=H[7],Ue+=C*de,gt+=C*nr,st+=C*dr,tt+=C*pr,At+=C*Qt,Rt+=C*gr,Mt+=C*lr,Et+=C*Lr,dt+=C*mr,_t+=C*wr,ot+=C*Br,wt+=C*$r,lt+=C*Ir,at+=C*hn,Ae+=C*dn,Pe+=C*pn,C=H[8],gt+=C*de,st+=C*nr,tt+=C*dr,At+=C*pr,Rt+=C*Qt,Mt+=C*gr,Et+=C*lr,dt+=C*Lr,_t+=C*mr,ot+=C*wr,wt+=C*Br,lt+=C*$r,at+=C*Ir,Ae+=C*hn,Pe+=C*dn,Ge+=C*pn,C=H[9],st+=C*de,tt+=C*nr,At+=C*dr,Rt+=C*pr,Mt+=C*Qt,Et+=C*gr,dt+=C*lr,_t+=C*Lr,ot+=C*mr,wt+=C*wr,lt+=C*Br,at+=C*$r,Ae+=C*Ir,Pe+=C*hn,Ge+=C*dn,je+=C*pn,C=H[10],tt+=C*de,At+=C*nr,Rt+=C*dr,Mt+=C*pr,Et+=C*Qt,dt+=C*gr,_t+=C*lr,ot+=C*Lr,wt+=C*mr,lt+=C*wr,at+=C*Br,Ae+=C*$r,Pe+=C*Ir,Ge+=C*hn,je+=C*dn,qe+=C*pn,C=H[11],At+=C*de,Rt+=C*nr,Mt+=C*dr,Et+=C*pr,dt+=C*Qt,_t+=C*gr,ot+=C*lr,wt+=C*Lr,lt+=C*mr,at+=C*wr,Ae+=C*Br,Pe+=C*$r,Ge+=C*Ir,je+=C*hn,qe+=C*dn,Xe+=C*pn,C=H[12],Rt+=C*de,Mt+=C*nr,Et+=C*dr,dt+=C*pr,_t+=C*Qt,ot+=C*gr,wt+=C*lr,lt+=C*Lr,at+=C*mr,Ae+=C*wr,Pe+=C*Br,Ge+=C*$r,je+=C*Ir,qe+=C*hn,Xe+=C*dn,kt+=C*pn,C=H[13],Mt+=C*de,Et+=C*nr,dt+=C*dr,_t+=C*pr,ot+=C*Qt,wt+=C*gr,lt+=C*lr,at+=C*Lr,Ae+=C*mr,Pe+=C*wr,Ge+=C*Br,je+=C*$r,qe+=C*Ir,Xe+=C*hn,kt+=C*dn,Wt+=C*pn,C=H[14],Et+=C*de,dt+=C*nr,_t+=C*dr,ot+=C*pr,wt+=C*Qt,lt+=C*gr,at+=C*lr,Ae+=C*Lr,Pe+=C*mr,Ge+=C*wr,je+=C*Br,qe+=C*$r,Xe+=C*Ir,kt+=C*hn,Wt+=C*dn,Zt+=C*pn,C=H[15],dt+=C*de,_t+=C*nr,ot+=C*dr,wt+=C*pr,lt+=C*Qt,at+=C*gr,Ae+=C*lr,Pe+=C*Lr,Ge+=C*mr,je+=C*wr,qe+=C*Br,Xe+=C*$r,kt+=C*Ir,Wt+=C*hn,Zt+=C*dn,Kt+=C*pn,q+=38*_t,oe+=38*ot,pe+=38*wt,xe+=38*lt,Re+=38*at,De+=38*Ae,it+=38*Pe,Ue+=38*Ge,gt+=38*je,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),$[0]=q,$[1]=oe,$[2]=pe,$[3]=xe,$[4]=Re,$[5]=De,$[6]=it,$[7]=Ue,$[8]=gt,$[9]=st,$[10]=tt,$[11]=At,$[12]=Rt,$[13]=Mt,$[14]=Et,$[15]=dt}function se($,H){O($,H,H)}function ee($,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=253;C>=0;C--)se(V,V),C!==2&&C!==4&&O(V,V,H);for(C=0;C<16;C++)$[C]=V[C]}function X($,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=250;C>=0;C--)se(V,V),C!==1&&O(V,V,H);for(C=0;C<16;C++)$[C]=V[C]}function Q($,H,V){var C=new Uint8Array(32),Y=new Float64Array(80),q,oe,pe=r(),xe=r(),Re=r(),De=r(),it=r(),Ue=r();for(oe=0;oe<31;oe++)C[oe]=H[oe];for(C[31]=H[31]&127|64,C[0]&=248,I(Y,V),oe=0;oe<16;oe++)xe[oe]=Y[oe],De[oe]=pe[oe]=Re[oe]=0;for(pe[0]=De[0]=1,oe=254;oe>=0;--oe)q=C[oe>>>3]>>>(oe&7)&1,_(pe,xe,q),_(Re,De,q),F(it,pe,Re),ae(pe,pe,Re),F(Re,xe,De),ae(xe,xe,De),se(De,it),se(Ue,pe),O(pe,Re,pe),O(Re,xe,it),F(it,pe,Re),ae(pe,pe,Re),se(xe,pe),ae(Re,De,Ue),O(pe,Re,u),F(pe,pe,De),O(Re,Re,pe),O(pe,De,Ue),O(De,xe,Y),se(xe,it),_(pe,xe,q),_(Re,De,q);for(oe=0;oe<16;oe++)Y[oe+16]=pe[oe],Y[oe+32]=Re[oe],Y[oe+48]=xe[oe],Y[oe+64]=De[oe];var gt=Y.subarray(32),st=Y.subarray(16);return ee(gt,gt),O(st,st,gt),S($,st),0}function R($,H){return Q($,H,s)}function Z($,H){return n(H,32),R($,H)}function te($,H,V){var C=new Uint8Array(32);return Q(C,V,H),K($,i,C,J)}var le=f,ie=g;function fe($,H,V,C,Y,q){var oe=new Uint8Array(32);return te(oe,Y,q),le($,H,V,C,oe)}function ve($,H,V,C,Y,q){var oe=new Uint8Array(32);return te(oe,Y,q),ie($,H,V,C,oe)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne($,H,V,C){for(var Y=new Int32Array(16),q=new Int32Array(16),oe,pe,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Ae,Pe,Ge,je,qe,Xe,kt=$[0],Wt=$[1],Zt=$[2],Kt=$[3],de=$[4],nr=$[5],dr=$[6],pr=$[7],Qt=H[0],gr=H[1],lr=H[2],Lr=H[3],mr=H[4],wr=H[5],Br=H[6],$r=H[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=V[at+0]<<24|V[at+1]<<16|V[at+2]<<8|V[at+3],q[lt]=V[at+4]<<24|V[at+5]<<16|V[at+6]<<8|V[at+7];for(lt=0;lt<80;lt++)if(oe=kt,pe=Wt,xe=Zt,Re=Kt,De=de,it=nr,Ue=dr,gt=pr,st=Qt,tt=gr,At=lr,Rt=Lr,Mt=mr,Et=wr,dt=Br,_t=$r,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(de>>>14|mr<<18)^(de>>>18|mr<<14)^(mr>>>9|de<<23),Pe=(mr>>>14|de<<18)^(mr>>>18|de<<14)^(de>>>9|mr<<23),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=de&nr^~de&dr,Pe=mr&wr^~mr&Br,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Me[lt*2],Pe=Me[lt*2+1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Y[lt%16],Pe=q[lt%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|je<<16,Ae=ot,Pe=wt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Pe=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=kt&Wt^kt&Zt^Wt&Zt,Pe=Qt&gr^Qt&lr^gr&lr,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,gt=qe&65535|Xe<<16,_t=Ge&65535|je<<16,Ae=Re,Pe=Rt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=ot,Pe=wt,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|je<<16,Wt=oe,Zt=pe,Kt=xe,de=Re,nr=De,dr=it,pr=Ue,kt=gt,gr=st,lr=tt,Lr=At,mr=Rt,wr=Mt,Br=Et,$r=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Ae=Y[at],Pe=q[at],Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=Y[(at+9)%16],Pe=q[(at+9)%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+1)%16],wt=q[(at+1)%16],Ae=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Pe=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+14)%16],wt=q[(at+14)%16],Ae=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Pe=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,q[at]=Ge&65535|je<<16;Ae=kt,Pe=Qt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[0],Pe=H[0],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[0]=kt=qe&65535|Xe<<16,H[0]=Qt=Ge&65535|je<<16,Ae=Wt,Pe=gr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[1],Pe=H[1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[1]=Wt=qe&65535|Xe<<16,H[1]=gr=Ge&65535|je<<16,Ae=Zt,Pe=lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[2],Pe=H[2],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[2]=Zt=qe&65535|Xe<<16,H[2]=lr=Ge&65535|je<<16,Ae=Kt,Pe=Lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[3],Pe=H[3],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[3]=Kt=qe&65535|Xe<<16,H[3]=Lr=Ge&65535|je<<16,Ae=de,Pe=mr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[4],Pe=H[4],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[4]=de=qe&65535|Xe<<16,H[4]=mr=Ge&65535|je<<16,Ae=nr,Pe=wr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[5],Pe=H[5],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[5]=nr=qe&65535|Xe<<16,H[5]=wr=Ge&65535|je<<16,Ae=dr,Pe=Br,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[6],Pe=H[6],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[6]=dr=qe&65535|Xe<<16,H[6]=Br=Ge&65535|je<<16,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[7],Pe=H[7],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[7]=pr=qe&65535|Xe<<16,H[7]=$r=Ge&65535|je<<16,Ir+=128,C-=128}return C}function Te($,H,V){var C=new Int32Array(8),Y=new Int32Array(8),q=new Uint8Array(256),oe,pe=V;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,H,V),V%=128,oe=0;oe=0;--Y)C=V[Y/8|0]>>(Y&7)&1,Ie($,H,C),$e(H,$),$e($,$),Ie($,H,C)}function ke($,H){var V=[r(),r(),r(),r()];v(V[0],p),v(V[1],y),v(V[2],a),O(V[3],p,y),Ve($,V,H)}function ze($,H,V){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],q;for(V||n(H,32),Te(C,H,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le($,Y),q=0;q<32;q++)H[q+32]=$[q];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Ee($,H){var V,C,Y,q;for(C=63;C>=32;--C){for(V=0,Y=C-32,q=C-12;Y>4)*He[Y],V=H[Y]>>8,H[Y]&=255;for(Y=0;Y<32;Y++)H[Y]-=V*He[Y];for(C=0;C<32;C++)H[C+1]+=H[C]>>8,$[C]=H[C]&255}function Qe($){var H=new Float64Array(64),V;for(V=0;V<64;V++)H[V]=$[V];for(V=0;V<64;V++)$[V]=0;Ee($,H)}function ct($,H,V,C){var Y=new Uint8Array(64),q=new Uint8Array(64),oe=new Uint8Array(64),pe,xe,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=V+64;for(pe=0;pe>7&&ae($[0],o,$[0]),O($[3],$[0],$[1]),0)}function et($,H,V,C){var Y,q=new Uint8Array(32),oe=new Uint8Array(64),pe=[r(),r(),r(),r()],xe=[r(),r(),r(),r()];if(V<64||Be(xe,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var $=new Uint8Array(vt),H=new Uint8Array(Dt);return ze($,H),{publicKey:$,secretKey:H}},e.sign.keyPair.fromSecretKey=function($){if(nt($),$.length!==Dt)throw new Error("bad secret key size");for(var H=new Uint8Array(vt),V=0;V=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function Ib(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function Y0(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{console.log("display_uri",ae),o(ae),u(!1),y("scan")}),m.on("error",ae=>{console.log(ae)}),m.on("session_update",ae=>{console.log("session_update",ae)}),!await m.connect(bZ))throw new Error("Walletconnect init failed");const S=new Wf(m);N(((f=S.config)==null?void 0:f.image)||((g=E.config)==null?void 0:g.image));const b=await S.getAddress(),M=await va.getNonce({account_type:"block_chain"});console.log("get nonce",M);const I=yZ(b,M);y("sign");const F=await S.signMessage(I,b);y("waiting"),await i(S,{message:I,nonce:M,signature:F,address:b,wallet_name:((v=S.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),B(S)}catch(_){console.log("err",_),d(_.details||_.message)}}function U(){A.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),A.current.append(e.current)}function K(E){var m;console.log(A.current),(m=A.current)==null||m.update({data:E})}Se.useEffect(()=>{s&&K(s)},[s]),Se.useEffect(()=>{j(r)},[r]),Se.useEffect(()=>{U()},[]);function J(){d(""),K(""),j(r)}function T(){k(!0),navigator.clipboard.writeText(s),setTimeout(()=>{k(!1)},2500)}function z(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return ge.jsxs("div",{children:[ge.jsx("div",{className:"xc-text-center",children:ge.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[ge.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),ge.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?ge.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):ge.jsx("img",{className:"xc-h-10 xc-w-10",src:P})})]})}),ge.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[ge.jsx("button",{disabled:!s,onClick:T,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:D?ge.jsxs(ge.Fragment,{children:[" ",ge.jsx(LK,{})," Copied!"]}):ge.jsxs(ge.Fragment,{children:[ge.jsx($K,{}),"Copy QR URL"]})}),((_e=r.config)==null?void 0:_e.getWallet)&&ge.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[ge.jsx(kK,{}),"Get Extension"]}),((G=r.config)==null?void 0:G.desktop_link)&&ge.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:z,children:[ge.jsx(f8,{}),"Desktop"]})]}),ge.jsx("div",{className:"xc-text-center",children:l?ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),ge.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:J,children:"Retry"})]}):ge.jsxs(ge.Fragment,{children:[p==="scan"&&ge.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),p==="connect"&&ge.jsx("p",{children:"Click connect in your wallet app"}),p==="sign"&&ge.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),p==="waiting"&&ge.jsx("div",{className:"xc-text-center",children:ge.jsx(vc,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const wZ="Accept connection request in the wallet",xZ="Accept sign-in request in your wallet";function _Z(t,e){const r=window.location.host,n=window.location.href;return A7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function I7(t){var p;const[e,r]=Se.useState(),{wallet:n,onSignFinish:i}=t,s=Se.useRef(),[o,a]=Se.useState("connect"),{saveLastUsedWallet:u}=Kl();async function l(y){var A;try{a("connect");const P=await n.connect();if(!P||P.length===0)throw new Error("Wallet connect error");const N=og(P[0]),D=_Z(N,y);a("sign");const k=await n.signMessage(D,N);if(!k||k.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:N,signature:k,message:D,nonce:y,wallet_name:((A=n.config)==null?void 0:A.name)||""}),u(n)}catch(P){console.log(P.details),r(P.details||P.message)}}async function d(){try{r("");const y=await va.getNonce({account_type:"block_chain"});s.current=y,l(s.current)}catch(y){console.log(y.details),r(y.message)}}return Se.useEffect(()=>{d()},[]),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[ge.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(p=n.config)==null?void 0:p.image,alt:""}),e&&ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),ge.jsx("div",{className:"xc-flex xc-gap-2",children:ge.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:d,children:"Retry"})})]}),!e&&ge.jsxs(ge.Fragment,{children:[o==="connect"&&ge.jsx("span",{className:"xc-text-center",children:wZ}),o==="sign"&&ge.jsx("span",{className:"xc-text-center",children:xZ}),o==="waiting"&&ge.jsx("span",{className:"xc-text-center",children:ge.jsx(vc,{className:"xc-animate-spin"})})]})]})}const Vu="https://static.codatta.io/codatta-connect/wallet-icons.svg",EZ="https://itunes.apple.com/app/",SZ="https://play.google.com/store/apps/details?id=",AZ="https://chromewebstore.google.com/detail/",PZ="https://chromewebstore.google.com/detail/",MZ="https://addons.mozilla.org/en-US/firefox/addon/",IZ="https://microsoftedge.microsoft.com/addons/detail/";function Gu(t){const{icon:e,title:r,link:n}=t;return ge.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[ge.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,ge.jsx(u8,{className:"xc-ml-auto xc-text-gray-400"})]})}function CZ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${EZ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${SZ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${AZ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${PZ}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${MZ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${IZ}${t.edge_addon_id}`),e}function C7(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=CZ(r);return ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),ge.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),ge.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),ge.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&ge.jsx(Gu,{link:n.chromeStoreLink,icon:`${Vu}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&ge.jsx(Gu,{link:n.appStoreLink,icon:`${Vu}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&ge.jsx(Gu,{link:n.playStoreLink,icon:`${Vu}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&ge.jsx(Gu,{link:n.edgeStoreLink,icon:`${Vu}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&ge.jsx(Gu,{link:n.braveStoreLink,icon:`${Vu}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&ge.jsx(Gu,{link:n.firefoxStoreLink,icon:`${Vu}#firefox`,title:"Mozilla Firefox"})]})]})}function TZ(t){const{wallet:e}=t,[r,n]=Se.useState(e.installed?"connect":"qr"),i=Ib();async function s(o,a){var l;const u=await va.walletLogin({account_type:"block_chain",account_enum:i.role,connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&ge.jsx(M7,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&ge.jsx(I7,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&ge.jsx(C7,{wallet:e})]})}function RZ(t){const{wallet:e,onClick:r}=t,n=ge.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return ge.jsx(Sb,{icon:n,title:i,onClick:()=>r(e)})}function T7(t){const{connector:e}=t,[r,n]=Se.useState(),[i,s]=Se.useState([]),o=Se.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d),console.log(d)}Se.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[ge.jsx(l8,{className:"xc-shrink-0 xc-opacity-50"}),ge.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),ge.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>ge.jsx(RZ,{wallet:d,onClick:l},d.name))})]})}var R7={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,$[H+1]=V>>16&255,$[H+2]=V>>8&255,$[H+3]=V&255,$[H+4]=C>>24&255,$[H+5]=C>>16&255,$[H+6]=C>>8&255,$[H+7]=C&255}function N($,H,V,C,Y){var q,oe=0;for(q=0;q>>8)-1}function D($,H,V,C){return N($,H,V,C,16)}function k($,H,V,C){return N($,H,V,C,32)}function B($,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,Ue=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=oe,wt=pe,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;dt=dt+Y|0,_t=_t+q|0,ot=ot+oe|0,wt=wt+pe|0,lt=lt+xe|0,at=at+Re|0,Ae=Ae+De|0,Pe=Pe+it|0,Ge=Ge+Ue|0,je=je+gt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=_t>>>0&255,$[5]=_t>>>8&255,$[6]=_t>>>16&255,$[7]=_t>>>24&255,$[8]=ot>>>0&255,$[9]=ot>>>8&255,$[10]=ot>>>16&255,$[11]=ot>>>24&255,$[12]=wt>>>0&255,$[13]=wt>>>8&255,$[14]=wt>>>16&255,$[15]=wt>>>24&255,$[16]=lt>>>0&255,$[17]=lt>>>8&255,$[18]=lt>>>16&255,$[19]=lt>>>24&255,$[20]=at>>>0&255,$[21]=at>>>8&255,$[22]=at>>>16&255,$[23]=at>>>24&255,$[24]=Ae>>>0&255,$[25]=Ae>>>8&255,$[26]=Ae>>>16&255,$[27]=Ae>>>24&255,$[28]=Pe>>>0&255,$[29]=Pe>>>8&255,$[30]=Pe>>>16&255,$[31]=Pe>>>24&255,$[32]=Ge>>>0&255,$[33]=Ge>>>8&255,$[34]=Ge>>>16&255,$[35]=Ge>>>24&255,$[36]=je>>>0&255,$[37]=je>>>8&255,$[38]=je>>>16&255,$[39]=je>>>24&255,$[40]=qe>>>0&255,$[41]=qe>>>8&255,$[42]=qe>>>16&255,$[43]=qe>>>24&255,$[44]=Xe>>>0&255,$[45]=Xe>>>8&255,$[46]=Xe>>>16&255,$[47]=Xe>>>24&255,$[48]=kt>>>0&255,$[49]=kt>>>8&255,$[50]=kt>>>16&255,$[51]=kt>>>24&255,$[52]=Wt>>>0&255,$[53]=Wt>>>8&255,$[54]=Wt>>>16&255,$[55]=Wt>>>24&255,$[56]=Zt>>>0&255,$[57]=Zt>>>8&255,$[58]=Zt>>>16&255,$[59]=Zt>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255}function j($,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,Ue=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=oe,wt=pe,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=at>>>0&255,$[5]=at>>>8&255,$[6]=at>>>16&255,$[7]=at>>>24&255,$[8]=qe>>>0&255,$[9]=qe>>>8&255,$[10]=qe>>>16&255,$[11]=qe>>>24&255,$[12]=Kt>>>0&255,$[13]=Kt>>>8&255,$[14]=Kt>>>16&255,$[15]=Kt>>>24&255,$[16]=Ae>>>0&255,$[17]=Ae>>>8&255,$[18]=Ae>>>16&255,$[19]=Ae>>>24&255,$[20]=Pe>>>0&255,$[21]=Pe>>>8&255,$[22]=Pe>>>16&255,$[23]=Pe>>>24&255,$[24]=Ge>>>0&255,$[25]=Ge>>>8&255,$[26]=Ge>>>16&255,$[27]=Ge>>>24&255,$[28]=je>>>0&255,$[29]=je>>>8&255,$[30]=je>>>16&255,$[31]=je>>>24&255}function U($,H,V,C){B($,H,V,C)}function K($,H,V,C){j($,H,V,C)}var J=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T($,H,V,C,Y,q,oe){var pe=new Uint8Array(16),xe=new Uint8Array(64),Re,De;for(De=0;De<16;De++)pe[De]=0;for(De=0;De<8;De++)pe[De]=q[De];for(;Y>=64;){for(U(xe,pe,oe,J),De=0;De<64;De++)$[H+De]=V[C+De]^xe[De];for(Re=1,De=8;De<16;De++)Re=Re+(pe[De]&255)|0,pe[De]=Re&255,Re>>>=8;Y-=64,H+=64,C+=64}if(Y>0)for(U(xe,pe,oe,J),De=0;De=64;){for(U(oe,q,Y,J),xe=0;xe<64;xe++)$[H+xe]=oe[xe];for(pe=1,xe=8;xe<16;xe++)pe=pe+(q[xe]&255)|0,q[xe]=pe&255,pe>>>=8;V-=64,H+=64}if(V>0)for(U(oe,q,Y,J),xe=0;xe>>13|V<<3)&8191,C=$[4]&255|($[5]&255)<<8,this.r[2]=(V>>>10|C<<6)&7939,Y=$[6]&255|($[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,q=$[8]&255|($[9]&255)<<8,this.r[4]=(Y>>>4|q<<12)&255,this.r[5]=q>>>1&8190,oe=$[10]&255|($[11]&255)<<8,this.r[6]=(q>>>14|oe<<2)&8191,pe=$[12]&255|($[13]&255)<<8,this.r[7]=(oe>>>11|pe<<5)&8065,xe=$[14]&255|($[15]&255)<<8,this.r[8]=(pe>>>8|xe<<8)&8191,this.r[9]=xe>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};G.prototype.blocks=function($,H,V){for(var C=this.fin?0:2048,Y,q,oe,pe,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Ae=this.h[3],Pe=this.h[4],Ge=this.h[5],je=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],de=this.r[3],nr=this.r[4],dr=this.r[5],pr=this.r[6],Qt=this.r[7],gr=this.r[8],lr=this.r[9];V>=16;)Y=$[H+0]&255|($[H+1]&255)<<8,wt+=Y&8191,q=$[H+2]&255|($[H+3]&255)<<8,lt+=(Y>>>13|q<<3)&8191,oe=$[H+4]&255|($[H+5]&255)<<8,at+=(q>>>10|oe<<6)&8191,pe=$[H+6]&255|($[H+7]&255)<<8,Ae+=(oe>>>7|pe<<9)&8191,xe=$[H+8]&255|($[H+9]&255)<<8,Pe+=(pe>>>4|xe<<12)&8191,Ge+=xe>>>1&8191,Re=$[H+10]&255|($[H+11]&255)<<8,je+=(xe>>>14|Re<<2)&8191,De=$[H+12]&255|($[H+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=$[H+14]&255|($[H+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,Ue=0,gt=Ue,gt+=wt*Wt,gt+=lt*(5*lr),gt+=at*(5*gr),gt+=Ae*(5*Qt),gt+=Pe*(5*pr),Ue=gt>>>13,gt&=8191,gt+=Ge*(5*dr),gt+=je*(5*nr),gt+=qe*(5*de),gt+=Xe*(5*Kt),gt+=kt*(5*Zt),Ue+=gt>>>13,gt&=8191,st=Ue,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Ae*(5*gr),st+=Pe*(5*Qt),Ue=st>>>13,st&=8191,st+=Ge*(5*pr),st+=je*(5*dr),st+=qe*(5*nr),st+=Xe*(5*de),st+=kt*(5*Kt),Ue+=st>>>13,st&=8191,tt=Ue,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Ae*(5*lr),tt+=Pe*(5*gr),Ue=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=je*(5*pr),tt+=qe*(5*dr),tt+=Xe*(5*nr),tt+=kt*(5*de),Ue+=tt>>>13,tt&=8191,At=Ue,At+=wt*de,At+=lt*Kt,At+=at*Zt,At+=Ae*Wt,At+=Pe*(5*lr),Ue=At>>>13,At&=8191,At+=Ge*(5*gr),At+=je*(5*Qt),At+=qe*(5*pr),At+=Xe*(5*dr),At+=kt*(5*nr),Ue+=At>>>13,At&=8191,Rt=Ue,Rt+=wt*nr,Rt+=lt*de,Rt+=at*Kt,Rt+=Ae*Zt,Rt+=Pe*Wt,Ue=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=je*(5*gr),Rt+=qe*(5*Qt),Rt+=Xe*(5*pr),Rt+=kt*(5*dr),Ue+=Rt>>>13,Rt&=8191,Mt=Ue,Mt+=wt*dr,Mt+=lt*nr,Mt+=at*de,Mt+=Ae*Kt,Mt+=Pe*Zt,Ue=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=je*(5*lr),Mt+=qe*(5*gr),Mt+=Xe*(5*Qt),Mt+=kt*(5*pr),Ue+=Mt>>>13,Mt&=8191,Et=Ue,Et+=wt*pr,Et+=lt*dr,Et+=at*nr,Et+=Ae*de,Et+=Pe*Kt,Ue=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=je*Wt,Et+=qe*(5*lr),Et+=Xe*(5*gr),Et+=kt*(5*Qt),Ue+=Et>>>13,Et&=8191,dt=Ue,dt+=wt*Qt,dt+=lt*pr,dt+=at*dr,dt+=Ae*nr,dt+=Pe*de,Ue=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=je*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*gr),Ue+=dt>>>13,dt&=8191,_t=Ue,_t+=wt*gr,_t+=lt*Qt,_t+=at*pr,_t+=Ae*dr,_t+=Pe*nr,Ue=_t>>>13,_t&=8191,_t+=Ge*de,_t+=je*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),Ue+=_t>>>13,_t&=8191,ot=Ue,ot+=wt*lr,ot+=lt*gr,ot+=at*Qt,ot+=Ae*pr,ot+=Pe*dr,Ue=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=je*de,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,Ue+=ot>>>13,ot&=8191,Ue=(Ue<<2)+Ue|0,Ue=Ue+gt|0,gt=Ue&8191,Ue=Ue>>>13,st+=Ue,wt=gt,lt=st,at=tt,Ae=At,Pe=Rt,Ge=Mt,je=Et,qe=dt,Xe=_t,kt=ot,H+=16,V-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Ae,this.h[4]=Pe,this.h[5]=Ge,this.h[6]=je,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},G.prototype.finish=function($,H){var V=new Uint16Array(10),C,Y,q,oe;if(this.leftover){for(oe=this.leftover,this.buffer[oe++]=1;oe<16;oe++)this.buffer[oe]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,oe=2;oe<10;oe++)this.h[oe]+=C,C=this.h[oe]>>>13,this.h[oe]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,V[0]=this.h[0]+5,C=V[0]>>>13,V[0]&=8191,oe=1;oe<10;oe++)V[oe]=this.h[oe]+C,C=V[oe]>>>13,V[oe]&=8191;for(V[9]-=8192,Y=(C^1)-1,oe=0;oe<10;oe++)V[oe]&=Y;for(Y=~Y,oe=0;oe<10;oe++)this.h[oe]=this.h[oe]&Y|V[oe];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,q=this.h[0]+this.pad[0],this.h[0]=q&65535,oe=1;oe<8;oe++)q=(this.h[oe]+this.pad[oe]|0)+(q>>>16)|0,this.h[oe]=q&65535;$[H+0]=this.h[0]>>>0&255,$[H+1]=this.h[0]>>>8&255,$[H+2]=this.h[1]>>>0&255,$[H+3]=this.h[1]>>>8&255,$[H+4]=this.h[2]>>>0&255,$[H+5]=this.h[2]>>>8&255,$[H+6]=this.h[3]>>>0&255,$[H+7]=this.h[3]>>>8&255,$[H+8]=this.h[4]>>>0&255,$[H+9]=this.h[4]>>>8&255,$[H+10]=this.h[5]>>>0&255,$[H+11]=this.h[5]>>>8&255,$[H+12]=this.h[6]>>>0&255,$[H+13]=this.h[6]>>>8&255,$[H+14]=this.h[7]>>>0&255,$[H+15]=this.h[7]>>>8&255},G.prototype.update=function($,H,V){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>V&&(Y=V),C=0;C=16&&(Y=V-V%16,this.blocks($,H,Y),H+=Y,V-=Y),V){for(C=0;C>16&1),q[V-1]&=65535;q[15]=oe[15]-32767-(q[14]>>16&1),Y=q[15]>>16&1,q[14]&=65535,_(oe,q,1-Y)}for(V=0;V<16;V++)$[2*V]=oe[V]&255,$[2*V+1]=oe[V]>>8}function b($,H){var V=new Uint8Array(32),C=new Uint8Array(32);return S(V,$),S(C,H),k(V,0,C,0)}function M($){var H=new Uint8Array(32);return S(H,$),H[0]&1}function I($,H){var V;for(V=0;V<16;V++)$[V]=H[2*V]+(H[2*V+1]<<8);$[15]&=32767}function F($,H,V){for(var C=0;C<16;C++)$[C]=H[C]+V[C]}function ae($,H,V){for(var C=0;C<16;C++)$[C]=H[C]-V[C]}function O($,H,V){var C,Y,q=0,oe=0,pe=0,xe=0,Re=0,De=0,it=0,Ue=0,gt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Ae=0,Pe=0,Ge=0,je=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,de=V[0],nr=V[1],dr=V[2],pr=V[3],Qt=V[4],gr=V[5],lr=V[6],Lr=V[7],mr=V[8],wr=V[9],Br=V[10],$r=V[11],Ir=V[12],hn=V[13],dn=V[14],pn=V[15];C=H[0],q+=C*de,oe+=C*nr,pe+=C*dr,xe+=C*pr,Re+=C*Qt,De+=C*gr,it+=C*lr,Ue+=C*Lr,gt+=C*mr,st+=C*wr,tt+=C*Br,At+=C*$r,Rt+=C*Ir,Mt+=C*hn,Et+=C*dn,dt+=C*pn,C=H[1],oe+=C*de,pe+=C*nr,xe+=C*dr,Re+=C*pr,De+=C*Qt,it+=C*gr,Ue+=C*lr,gt+=C*Lr,st+=C*mr,tt+=C*wr,At+=C*Br,Rt+=C*$r,Mt+=C*Ir,Et+=C*hn,dt+=C*dn,_t+=C*pn,C=H[2],pe+=C*de,xe+=C*nr,Re+=C*dr,De+=C*pr,it+=C*Qt,Ue+=C*gr,gt+=C*lr,st+=C*Lr,tt+=C*mr,At+=C*wr,Rt+=C*Br,Mt+=C*$r,Et+=C*Ir,dt+=C*hn,_t+=C*dn,ot+=C*pn,C=H[3],xe+=C*de,Re+=C*nr,De+=C*dr,it+=C*pr,Ue+=C*Qt,gt+=C*gr,st+=C*lr,tt+=C*Lr,At+=C*mr,Rt+=C*wr,Mt+=C*Br,Et+=C*$r,dt+=C*Ir,_t+=C*hn,ot+=C*dn,wt+=C*pn,C=H[4],Re+=C*de,De+=C*nr,it+=C*dr,Ue+=C*pr,gt+=C*Qt,st+=C*gr,tt+=C*lr,At+=C*Lr,Rt+=C*mr,Mt+=C*wr,Et+=C*Br,dt+=C*$r,_t+=C*Ir,ot+=C*hn,wt+=C*dn,lt+=C*pn,C=H[5],De+=C*de,it+=C*nr,Ue+=C*dr,gt+=C*pr,st+=C*Qt,tt+=C*gr,At+=C*lr,Rt+=C*Lr,Mt+=C*mr,Et+=C*wr,dt+=C*Br,_t+=C*$r,ot+=C*Ir,wt+=C*hn,lt+=C*dn,at+=C*pn,C=H[6],it+=C*de,Ue+=C*nr,gt+=C*dr,st+=C*pr,tt+=C*Qt,At+=C*gr,Rt+=C*lr,Mt+=C*Lr,Et+=C*mr,dt+=C*wr,_t+=C*Br,ot+=C*$r,wt+=C*Ir,lt+=C*hn,at+=C*dn,Ae+=C*pn,C=H[7],Ue+=C*de,gt+=C*nr,st+=C*dr,tt+=C*pr,At+=C*Qt,Rt+=C*gr,Mt+=C*lr,Et+=C*Lr,dt+=C*mr,_t+=C*wr,ot+=C*Br,wt+=C*$r,lt+=C*Ir,at+=C*hn,Ae+=C*dn,Pe+=C*pn,C=H[8],gt+=C*de,st+=C*nr,tt+=C*dr,At+=C*pr,Rt+=C*Qt,Mt+=C*gr,Et+=C*lr,dt+=C*Lr,_t+=C*mr,ot+=C*wr,wt+=C*Br,lt+=C*$r,at+=C*Ir,Ae+=C*hn,Pe+=C*dn,Ge+=C*pn,C=H[9],st+=C*de,tt+=C*nr,At+=C*dr,Rt+=C*pr,Mt+=C*Qt,Et+=C*gr,dt+=C*lr,_t+=C*Lr,ot+=C*mr,wt+=C*wr,lt+=C*Br,at+=C*$r,Ae+=C*Ir,Pe+=C*hn,Ge+=C*dn,je+=C*pn,C=H[10],tt+=C*de,At+=C*nr,Rt+=C*dr,Mt+=C*pr,Et+=C*Qt,dt+=C*gr,_t+=C*lr,ot+=C*Lr,wt+=C*mr,lt+=C*wr,at+=C*Br,Ae+=C*$r,Pe+=C*Ir,Ge+=C*hn,je+=C*dn,qe+=C*pn,C=H[11],At+=C*de,Rt+=C*nr,Mt+=C*dr,Et+=C*pr,dt+=C*Qt,_t+=C*gr,ot+=C*lr,wt+=C*Lr,lt+=C*mr,at+=C*wr,Ae+=C*Br,Pe+=C*$r,Ge+=C*Ir,je+=C*hn,qe+=C*dn,Xe+=C*pn,C=H[12],Rt+=C*de,Mt+=C*nr,Et+=C*dr,dt+=C*pr,_t+=C*Qt,ot+=C*gr,wt+=C*lr,lt+=C*Lr,at+=C*mr,Ae+=C*wr,Pe+=C*Br,Ge+=C*$r,je+=C*Ir,qe+=C*hn,Xe+=C*dn,kt+=C*pn,C=H[13],Mt+=C*de,Et+=C*nr,dt+=C*dr,_t+=C*pr,ot+=C*Qt,wt+=C*gr,lt+=C*lr,at+=C*Lr,Ae+=C*mr,Pe+=C*wr,Ge+=C*Br,je+=C*$r,qe+=C*Ir,Xe+=C*hn,kt+=C*dn,Wt+=C*pn,C=H[14],Et+=C*de,dt+=C*nr,_t+=C*dr,ot+=C*pr,wt+=C*Qt,lt+=C*gr,at+=C*lr,Ae+=C*Lr,Pe+=C*mr,Ge+=C*wr,je+=C*Br,qe+=C*$r,Xe+=C*Ir,kt+=C*hn,Wt+=C*dn,Zt+=C*pn,C=H[15],dt+=C*de,_t+=C*nr,ot+=C*dr,wt+=C*pr,lt+=C*Qt,at+=C*gr,Ae+=C*lr,Pe+=C*Lr,Ge+=C*mr,je+=C*wr,qe+=C*Br,Xe+=C*$r,kt+=C*Ir,Wt+=C*hn,Zt+=C*dn,Kt+=C*pn,q+=38*_t,oe+=38*ot,pe+=38*wt,xe+=38*lt,Re+=38*at,De+=38*Ae,it+=38*Pe,Ue+=38*Ge,gt+=38*je,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),$[0]=q,$[1]=oe,$[2]=pe,$[3]=xe,$[4]=Re,$[5]=De,$[6]=it,$[7]=Ue,$[8]=gt,$[9]=st,$[10]=tt,$[11]=At,$[12]=Rt,$[13]=Mt,$[14]=Et,$[15]=dt}function se($,H){O($,H,H)}function ee($,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=253;C>=0;C--)se(V,V),C!==2&&C!==4&&O(V,V,H);for(C=0;C<16;C++)$[C]=V[C]}function X($,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=250;C>=0;C--)se(V,V),C!==1&&O(V,V,H);for(C=0;C<16;C++)$[C]=V[C]}function Q($,H,V){var C=new Uint8Array(32),Y=new Float64Array(80),q,oe,pe=r(),xe=r(),Re=r(),De=r(),it=r(),Ue=r();for(oe=0;oe<31;oe++)C[oe]=H[oe];for(C[31]=H[31]&127|64,C[0]&=248,I(Y,V),oe=0;oe<16;oe++)xe[oe]=Y[oe],De[oe]=pe[oe]=Re[oe]=0;for(pe[0]=De[0]=1,oe=254;oe>=0;--oe)q=C[oe>>>3]>>>(oe&7)&1,_(pe,xe,q),_(Re,De,q),F(it,pe,Re),ae(pe,pe,Re),F(Re,xe,De),ae(xe,xe,De),se(De,it),se(Ue,pe),O(pe,Re,pe),O(Re,xe,it),F(it,pe,Re),ae(pe,pe,Re),se(xe,pe),ae(Re,De,Ue),O(pe,Re,u),F(pe,pe,De),O(Re,Re,pe),O(pe,De,Ue),O(De,xe,Y),se(xe,it),_(pe,xe,q),_(Re,De,q);for(oe=0;oe<16;oe++)Y[oe+16]=pe[oe],Y[oe+32]=Re[oe],Y[oe+48]=xe[oe],Y[oe+64]=De[oe];var gt=Y.subarray(32),st=Y.subarray(16);return ee(gt,gt),O(st,st,gt),S($,st),0}function R($,H){return Q($,H,s)}function Z($,H){return n(H,32),R($,H)}function te($,H,V){var C=new Uint8Array(32);return Q(C,V,H),K($,i,C,J)}var le=f,ie=g;function fe($,H,V,C,Y,q){var oe=new Uint8Array(32);return te(oe,Y,q),le($,H,V,C,oe)}function ve($,H,V,C,Y,q){var oe=new Uint8Array(32);return te(oe,Y,q),ie($,H,V,C,oe)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne($,H,V,C){for(var Y=new Int32Array(16),q=new Int32Array(16),oe,pe,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Ae,Pe,Ge,je,qe,Xe,kt=$[0],Wt=$[1],Zt=$[2],Kt=$[3],de=$[4],nr=$[5],dr=$[6],pr=$[7],Qt=H[0],gr=H[1],lr=H[2],Lr=H[3],mr=H[4],wr=H[5],Br=H[6],$r=H[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=V[at+0]<<24|V[at+1]<<16|V[at+2]<<8|V[at+3],q[lt]=V[at+4]<<24|V[at+5]<<16|V[at+6]<<8|V[at+7];for(lt=0;lt<80;lt++)if(oe=kt,pe=Wt,xe=Zt,Re=Kt,De=de,it=nr,Ue=dr,gt=pr,st=Qt,tt=gr,At=lr,Rt=Lr,Mt=mr,Et=wr,dt=Br,_t=$r,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(de>>>14|mr<<18)^(de>>>18|mr<<14)^(mr>>>9|de<<23),Pe=(mr>>>14|de<<18)^(mr>>>18|de<<14)^(de>>>9|mr<<23),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=de&nr^~de&dr,Pe=mr&wr^~mr&Br,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Me[lt*2],Pe=Me[lt*2+1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Y[lt%16],Pe=q[lt%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|je<<16,Ae=ot,Pe=wt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Pe=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=kt&Wt^kt&Zt^Wt&Zt,Pe=Qt&gr^Qt&lr^gr&lr,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,gt=qe&65535|Xe<<16,_t=Ge&65535|je<<16,Ae=Re,Pe=Rt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=ot,Pe=wt,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|je<<16,Wt=oe,Zt=pe,Kt=xe,de=Re,nr=De,dr=it,pr=Ue,kt=gt,gr=st,lr=tt,Lr=At,mr=Rt,wr=Mt,Br=Et,$r=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Ae=Y[at],Pe=q[at],Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=Y[(at+9)%16],Pe=q[(at+9)%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+1)%16],wt=q[(at+1)%16],Ae=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Pe=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+14)%16],wt=q[(at+14)%16],Ae=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Pe=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,q[at]=Ge&65535|je<<16;Ae=kt,Pe=Qt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[0],Pe=H[0],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[0]=kt=qe&65535|Xe<<16,H[0]=Qt=Ge&65535|je<<16,Ae=Wt,Pe=gr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[1],Pe=H[1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[1]=Wt=qe&65535|Xe<<16,H[1]=gr=Ge&65535|je<<16,Ae=Zt,Pe=lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[2],Pe=H[2],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[2]=Zt=qe&65535|Xe<<16,H[2]=lr=Ge&65535|je<<16,Ae=Kt,Pe=Lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[3],Pe=H[3],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[3]=Kt=qe&65535|Xe<<16,H[3]=Lr=Ge&65535|je<<16,Ae=de,Pe=mr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[4],Pe=H[4],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[4]=de=qe&65535|Xe<<16,H[4]=mr=Ge&65535|je<<16,Ae=nr,Pe=wr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[5],Pe=H[5],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[5]=nr=qe&65535|Xe<<16,H[5]=wr=Ge&65535|je<<16,Ae=dr,Pe=Br,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[6],Pe=H[6],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[6]=dr=qe&65535|Xe<<16,H[6]=Br=Ge&65535|je<<16,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[7],Pe=H[7],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[7]=pr=qe&65535|Xe<<16,H[7]=$r=Ge&65535|je<<16,Ir+=128,C-=128}return C}function Te($,H,V){var C=new Int32Array(8),Y=new Int32Array(8),q=new Uint8Array(256),oe,pe=V;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,H,V),V%=128,oe=0;oe=0;--Y)C=V[Y/8|0]>>(Y&7)&1,Ie($,H,C),$e(H,$),$e($,$),Ie($,H,C)}function ke($,H){var V=[r(),r(),r(),r()];v(V[0],p),v(V[1],y),v(V[2],a),O(V[3],p,y),Ve($,V,H)}function ze($,H,V){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],q;for(V||n(H,32),Te(C,H,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le($,Y),q=0;q<32;q++)H[q+32]=$[q];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Ee($,H){var V,C,Y,q;for(C=63;C>=32;--C){for(V=0,Y=C-32,q=C-12;Y>4)*He[Y],V=H[Y]>>8,H[Y]&=255;for(Y=0;Y<32;Y++)H[Y]-=V*He[Y];for(C=0;C<32;C++)H[C+1]+=H[C]>>8,$[C]=H[C]&255}function Qe($){var H=new Float64Array(64),V;for(V=0;V<64;V++)H[V]=$[V];for(V=0;V<64;V++)$[V]=0;Ee($,H)}function ct($,H,V,C){var Y=new Uint8Array(64),q=new Uint8Array(64),oe=new Uint8Array(64),pe,xe,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=V+64;for(pe=0;pe>7&&ae($[0],o,$[0]),O($[3],$[0],$[1]),0)}function et($,H,V,C){var Y,q=new Uint8Array(32),oe=new Uint8Array(64),pe=[r(),r(),r(),r()],xe=[r(),r(),r(),r()];if(V<64||Be(xe,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var $=new Uint8Array(vt),H=new Uint8Array(Dt);return ze($,H),{publicKey:$,secretKey:H}},e.sign.keyPair.fromSecretKey=function($){if(nt($),$.length!==Dt)throw new Error("bad secret key size");for(var H=new Uint8Array(vt),V=0;V=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function Cb(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function Y0(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new Ut("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new Ut("Delay aborted"))})})})}function As(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function fh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=As(e==null?void 0:e.signal);if(typeof t!="function")throw new Ut(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=p??null,o==null||o.abort(),o=As(p),o.signal.aborted)throw new Ut("Resource creation was aborted");n=y??null;const A=t(o.signal,...y);i=A;const P=yield A;if(i!==A&&P!==r)throw yield e(P),new Ut("Resource creation was aborted by a new resource creation");return r=P,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const p=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([p?e(p):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:p=>Pt(this,void 0,void 0,function*(){const y=r,A=i,P=n,N=s;if(yield U7(p),y===r&&A===i&&P===n&&N===s)return yield a(s,...P??[]);throw new Ut("Resource recreation was aborted by a new resource creation")})}}function ZZ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=As(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new Ut("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new Ut(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new Ut("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class Nb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=XZ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield QZ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new KZ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(j7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=B7.encode(e);yield fh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new Ut(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Fo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Fo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new Ut(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new Ut("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),Sn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Ut("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new Ut(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function QZ(t){return Pt(this,void 0,void 0,function*(){return yield ZZ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=As(n.signal).signal;if(o.aborted){r(new Ut("Bridge connection aborted"));return}const a=new URL(j7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new Ut("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}try{const p=yield t.errorHandler(l,d);p!==l&&l.close(),p&&p!==l&&e(p)}catch(p){l.close(),r(p)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new Ut("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function lh(t){return!("connectEvent"in t)}class hh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!lh(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Cb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Cb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");if(!lh(e))throw new Ut("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new Ut("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!lh(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const q7=2;class dh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new hh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getHttpConnection();return lh(n)?new dh(e,n.connectionSource):new dh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=As(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Cb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield fh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(lh(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new Ut("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Nb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield fh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Ut("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),Y0(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=As(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){Sn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(B7.decode(e.message).toUint8Array(),Y0(e.from)));if(Sn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){Sn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Fo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(Sn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new Ut(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return GZ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",q7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+YZ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new Nb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>fh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Nb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function z7(t,e){return H7(t,[e])}function H7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function eQ(t){try{return!z7(t,"tonconnect")||!z7(t.tonconnect,"walletInfo")?!1:H7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Ju{constructor(){this.storage={}}static getInstance(){return Ju.instance||(Ju.instance=new Ju),Ju.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function np(){if(!(typeof window>"u"))return window}function tQ(){const t=np();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function rQ(){if(!(typeof document>"u"))return document}function nQ(){var t;const e=(t=np())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function iQ(){if(sQ())return localStorage;if(oQ())throw new Ut("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Ju.getInstance()}function sQ(){try{return typeof localStorage<"u"}catch{return!1}}function oQ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class xi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=xi.window;if(!xi.isWindowContainsWallet(n,r))throw new Db;this.connectionStorage=new hh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getInjectedConnection();return new xi(e,n.jsBridgeKey)})}static isWalletInjected(e){return xi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return xi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?tQ().filter(([n,i])=>eQ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(q7,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{Sn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();Sn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){Sn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>Sn("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{Sn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);Sn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){Sn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{Sn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}xi.window=np();class aQ{constructor(){this.localStorage=iQ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function W7(t){return uQ(t)&&t.injected}function cQ(t){return W7(t)&&t.embedded}function uQ(t){return"jsBridgeKey"in t}const fQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class Lb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(cQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new Ob("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Fo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Fo(n),e=fQ}let r=[];try{r=xi.getCurrentlyInjectedWallets()}catch(n){Fo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=xi.isWalletInjected(o),i.embedded=xi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class ip extends Ut{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,ip.prototype)}}function lQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new ip("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function wQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Zu(t,e)),kb(e,r))}function xQ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Zu(t,e)),kb(e,r))}function _Q(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Zu(t,e)),kb(e,r))}function EQ(t,e,r){return Object.assign({type:"disconnection",scope:r},Zu(t,e))}class SQ{constructor(){this.window=np()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class AQ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new SQ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Xu({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",dQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",hQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=pQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=gQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=mQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=vQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=bQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=yQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=EQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=wQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=xQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=_Q(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const PQ="3.0.5";class ph{constructor(e){if(this.walletsList=new Lb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||nQ(),storage:(e==null?void 0:e.storage)||new aQ},this.walletsList=new Lb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new AQ({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:PQ}),!this.dappSettings.manifestUrl)throw new Tb("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new hh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Rb;const o=As(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new Ut("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield dh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield xi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Fo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=fh(p=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:p.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(p=>setTimeout(()=>p(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=As(n==null?void 0:n.signal);if(i.signal.aborted)throw new Ut("Transaction sending was aborted");this.checkConnection(),lQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=jZ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(rp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(rp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),rp.parseAndThrowError(l);const d=rp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new Z0;const n=As(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Ut("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=rQ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Fo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&UZ(e)?r=new xi(this.dappSettings.storage,e.jsBridgeKey):r=new dh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new Ut("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=zZ.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),Sn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof X0||r instanceof J0)throw Fo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new Z0}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}ph.walletsList=new Lb,ph.isWalletInjected=t=>xi.isWalletInjected(t),ph.isInsideWalletBrowser=t=>xi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function Bb(t){const{children:e,onClick:r}=t;return ge.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function K7(t){const{wallet:e,connector:r,loading:n}=t,i=Se.useRef(null),s=Se.useRef(),[o,a]=Se.useState(),[u,l]=Se.useState(),[d,p]=Se.useState("connect"),[y,A]=Se.useState(!1),[P,N]=Se.useState();function D(z){var ue;(ue=s.current)==null||ue.update({data:z})}async function k(){A(!0);try{a("");const z=await va.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ue=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:z}});if(!ue)return;N(ue),D(ue),l(z)}}catch(z){a(z.message)}A(!1)}function B(){s.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function j(){r.connect(e,{request:{tonProof:u}})}function U(){if("deepLink"in e){if(!e.deepLink||!P)return;const z=new URL(P),ue=`${e.deepLink}${z.search}`;window.open(ue)}}function K(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(P)}const J=Se.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),T=Se.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Se.useEffect(()=>{B(),k()},[]),ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-text-center xc-mb-6",children:[ge.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[ge.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),ge.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?ge.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):ge.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),ge.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),ge.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&ge.jsx(vc,{className:"xc-animate-spin"}),!y&&!n&&ge.jsxs(ge.Fragment,{children:[W7(e)&&ge.jsxs(Bb,{onClick:j,children:[ge.jsx(BK,{className:"xc-opacity-80"}),"Extension"]}),J&&ge.jsxs(Bb,{onClick:U,children:[ge.jsx(f8,{className:"xc-opacity-80"}),"Desktop"]}),T&&ge.jsx(Bb,{onClick:K,children:"Telegram Mini App"})]})]})]})}function MQ(t){const[e,r]=Se.useState(""),[n,i]=Se.useState(),[s,o]=Se.useState(),a=Mb(),[u,l]=Se.useState(!1);async function d(y){var P,N;if(!y||!((P=y.connectItems)!=null&&P.tonProof))return;l(!0);const A=await va.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(N=y.connectItems)==null?void 0:N.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(A.data),l(!1)}Se.useEffect(()=>{const y=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),A=y.onStatusChange(d);return o(y),r("select"),A},[]);function p(y){r("connect"),i(y)}return ge.jsxs(Ss,{children:[e==="select"&&ge.jsx(T7,{connector:s,onSelect:p,onBack:t.onBack}),e==="connect"&&ge.jsx(K7,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function V7(t){const{children:e,className:r}=t,n=Se.useRef(null),[i,s]=Se.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Se.useEffect(()=>{console.log("maxHeight",i)},[i]),ge.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function IQ(){return ge.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ge.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),ge.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function G7(t){const{wallets:e}=Kl(),[r,n]=Se.useState(),i=Se.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[ge.jsx(l8,{className:"xc-shrink-0 xc-opacity-50"}),ge.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),ge.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>ge.jsx(e7,{wallet:a,onClick:s},`feature-${a.key}`)):ge.jsx(IQ,{})})]})}function CQ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Se.useState(""),[l,d]=Se.useState(null),[p,y]=Se.useState("");function A(k){d(k),u("evm-wallet")}function P(k){u("email"),y(k)}async function N(k){await e(k)}function D(){u("ton-wallet")}return Se.useEffect(()=>{u("index")},[]),ge.jsx(GX,{config:t.config,children:ge.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&ge.jsx(TZ,{onBack:()=>u("index"),onLogin:N,wallet:l}),a==="ton-wallet"&&ge.jsx(MQ,{onBack:()=>u("index"),onLogin:N}),a==="email"&&ge.jsx(uZ,{email:p,onBack:()=>u("index"),onLogin:N}),a==="index"&&ge.jsx(f7,{header:r,onEmailConfirm:P,onSelectWallet:A,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&ge.jsx(G7,{onBack:()=>u("index"),onSelectWallet:A})]})})}function TQ(t){const{wallet:e,onConnect:r}=t,[n,i]=Se.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&ge.jsx(M7,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&ge.jsx(I7,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&ge.jsx(C7,{wallet:e})]})}function RQ(t){const{email:e}=t,[r,n]=Se.useState("captcha");return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),r==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>n("verify-email")}),r==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:t.onInputCode,onResendCode:()=>n("captcha")})]})}function DQ(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Se.useState(""),[a,u]=Se.useState(),[l,d]=Se.useState(),p=Se.useRef(),[y,A]=Se.useState("");function P(j){u(j),o("evm-wallet-connect")}function N(j){A(j),o("email-connect")}async function D(j,U){await e({chain_type:"eip155",client:j.client,connect_info:U}),o("index")}function k(j){d(j),o("ton-wallet-connect")}async function B(j){j&&await r({chain_type:"ton",client:p.current,connect_info:j})}return Se.useEffect(()=>{p.current=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const j=p.current.onStatusChange(B);return o("index"),j},[]),ge.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&ge.jsx(G7,{onBack:()=>o("index"),onSelectWallet:P}),s==="evm-wallet-connect"&&ge.jsx(TQ,{onBack:()=>o("index"),onConnect:D,wallet:a}),s==="ton-wallet-select"&&ge.jsx(T7,{connector:p.current,onSelect:k,onBack:()=>o("index")}),s==="ton-wallet-connect"&&ge.jsx(K7,{connector:p.current,wallet:l,onBack:()=>o("index")}),s==="email-connect"&&ge.jsx(RQ,{email:y,onBack:()=>o("index"),onInputCode:n}),s==="index"&&ge.jsx(f7,{onEmailConfirm:N,onSelectWallet:P,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Fn.CodattaConnect=DQ,Fn.CodattaConnectContextProvider=CK,Fn.CodattaSignin=CQ,Fn.coinbaseWallet=o8,Fn.useCodattaConnectContext=Kl,Object.defineProperty(Fn,Symbol.toStringTag,{value:"Module"})}); +`+e:""}`,Object.setPrototypeOf(this,Ut.prototype)}get info(){return""}}Ut.prefix="[TON_CONNECT_SDK_ERROR]";class Rb extends Ut{get info(){return"Passed DappMetadata is in incorrect format."}constructor(...e){super(...e),Object.setPrototypeOf(this,Rb.prototype)}}class J0 extends Ut{get info(){return"Passed `tonconnect-manifest.json` contains errors. Check format of your manifest. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,J0.prototype)}}class X0 extends Ut{get info(){return"Manifest not found. Make sure you added `tonconnect-manifest.json` to the root of your app or passed correct manifestUrl. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,X0.prototype)}}class Db extends Ut{get info(){return"Wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection."}constructor(...e){super(...e),Object.setPrototypeOf(this,Db.prototype)}}class Z0 extends Ut{get info(){return"Send transaction or other protocol methods called while wallet is not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,Z0.prototype)}}function UZ(t){return"jsBridgeKey"in t}class Q0 extends Ut{get info(){return"User rejects the action in the wallet."}constructor(...e){super(...e),Object.setPrototypeOf(this,Q0.prototype)}}class ep extends Ut{get info(){return"Request to the wallet contains errors."}constructor(...e){super(...e),Object.setPrototypeOf(this,ep.prototype)}}class tp extends Ut{get info(){return"App tries to send rpc request to the injected wallet while not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,tp.prototype)}}class Ob extends Ut{get info(){return"There is an attempt to connect to the injected wallet while it is not exists in the webpage."}constructor(...e){super(...e),Object.setPrototypeOf(this,Ob.prototype)}}class Nb extends Ut{get info(){return"An error occurred while fetching the wallets list."}constructor(...e){super(...e),Object.setPrototypeOf(this,Nb.prototype)}}class Ma extends Ut{constructor(...e){super(...e),Object.setPrototypeOf(this,Ma.prototype)}}const $7={[Pa.UNKNOWN_ERROR]:Ma,[Pa.USER_REJECTS_ERROR]:Q0,[Pa.BAD_REQUEST_ERROR]:ep,[Pa.UNKNOWN_APP_ERROR]:tp,[Pa.MANIFEST_NOT_FOUND_ERROR]:X0,[Pa.MANIFEST_CONTENT_ERROR]:J0};class qZ{parseError(e){let r=Ma;return e.code in $7&&(r=$7[e.code]||Ma),new r(e.message)}}const zZ=new qZ;class HZ{isError(e){return"error"in e}}const F7={[Yu.UNKNOWN_ERROR]:Ma,[Yu.USER_REJECTS_ERROR]:Q0,[Yu.BAD_REQUEST_ERROR]:ep,[Yu.UNKNOWN_APP_ERROR]:tp};class WZ extends HZ{convertToRpcRequest(e){return{method:"sendTransaction",params:[JSON.stringify(e)]}}parseAndThrowError(e){let r=Ma;throw e.error.code in F7&&(r=F7[e.error.code]||Ma),new r(e.error.message)}convertFromRpcResponse(e){return{boc:e.result}}}const rp=new WZ;class KZ{constructor(e,r){this.storage=e,this.storeKey="ton-connect-storage_http-bridge-gateway::"+r}storeLastEventId(e){return Pt(this,void 0,void 0,function*(){return this.storage.setItem(this.storeKey,e)})}removeLastEventId(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getLastEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e||null})}}function VZ(t){return t.slice(-1)==="/"?t.slice(0,-1):t}function j7(t,e){return VZ(t)+"/"+e}function GZ(t){if(!t)return!1;const e=new URL(t);return e.protocol==="tg:"||e.hostname==="t.me"}function YZ(t){return t.replaceAll(".","%2E").replaceAll("-","%2D").replaceAll("_","%5F").replaceAll("&","-").replaceAll("=","__").replaceAll("%","--")}function U7(t,e){return Pt(this,void 0,void 0,function*(){return new Promise((r,n)=>{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new Ut("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new Ut("Delay aborted"))})})})}function As(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function fh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=As(e==null?void 0:e.signal);if(typeof t!="function")throw new Ut(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=p??null,o==null||o.abort(),o=As(p),o.signal.aborted)throw new Ut("Resource creation was aborted");n=y??null;const A=t(o.signal,...y);i=A;const P=yield A;if(i!==A&&P!==r)throw yield e(P),new Ut("Resource creation was aborted by a new resource creation");return r=P,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const p=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([p?e(p):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:p=>Pt(this,void 0,void 0,function*(){const y=r,A=i,P=n,N=s;if(yield U7(p),y===r&&A===i&&P===n&&N===s)return yield a(s,...P??[]);throw new Ut("Resource recreation was aborted by a new resource creation")})}}function ZZ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=As(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new Ut("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new Ut(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new Ut("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class Lb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=XZ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield QZ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new KZ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(j7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=B7.encode(e);yield fh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new Ut(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Fo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Fo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new Ut(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new Ut("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),Sn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Ut("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new Ut(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function QZ(t){return Pt(this,void 0,void 0,function*(){return yield ZZ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=As(n.signal).signal;if(o.aborted){r(new Ut("Bridge connection aborted"));return}const a=new URL(j7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new Ut("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}try{const p=yield t.errorHandler(l,d);p!==l&&l.close(),p&&p!==l&&e(p)}catch(p){l.close(),r(p)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new Ut("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function lh(t){return!("connectEvent"in t)}class hh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!lh(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Tb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Tb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");if(!lh(e))throw new Ut("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new Ut("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!lh(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const q7=2;class dh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new hh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getHttpConnection();return lh(n)?new dh(e,n.connectionSource):new dh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=As(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Tb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield fh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(lh(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new Ut("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Lb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield fh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Ut("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),Y0(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=As(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){Sn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(B7.decode(e.message).toUint8Array(),Y0(e.from)));if(Sn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){Sn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Fo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(Sn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new Ut(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return GZ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",q7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+YZ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new Lb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>fh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Lb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function z7(t,e){return H7(t,[e])}function H7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function eQ(t){try{return!z7(t,"tonconnect")||!z7(t.tonconnect,"walletInfo")?!1:H7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Ju{constructor(){this.storage={}}static getInstance(){return Ju.instance||(Ju.instance=new Ju),Ju.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function np(){if(!(typeof window>"u"))return window}function tQ(){const t=np();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function rQ(){if(!(typeof document>"u"))return document}function nQ(){var t;const e=(t=np())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function iQ(){if(sQ())return localStorage;if(oQ())throw new Ut("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Ju.getInstance()}function sQ(){try{return typeof localStorage<"u"}catch{return!1}}function oQ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class xi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=xi.window;if(!xi.isWindowContainsWallet(n,r))throw new Ob;this.connectionStorage=new hh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getInjectedConnection();return new xi(e,n.jsBridgeKey)})}static isWalletInjected(e){return xi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return xi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?tQ().filter(([n,i])=>eQ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(q7,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{Sn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();Sn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){Sn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>Sn("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{Sn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);Sn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){Sn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{Sn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}xi.window=np();class aQ{constructor(){this.localStorage=iQ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function W7(t){return uQ(t)&&t.injected}function cQ(t){return W7(t)&&t.embedded}function uQ(t){return"jsBridgeKey"in t}const fQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class kb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(cQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new Nb("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Fo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Fo(n),e=fQ}let r=[];try{r=xi.getCurrentlyInjectedWallets()}catch(n){Fo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=xi.isWalletInjected(o),i.embedded=xi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class ip extends Ut{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,ip.prototype)}}function lQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new ip("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function wQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Zu(t,e)),Bb(e,r))}function xQ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Zu(t,e)),Bb(e,r))}function _Q(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Zu(t,e)),Bb(e,r))}function EQ(t,e,r){return Object.assign({type:"disconnection",scope:r},Zu(t,e))}class SQ{constructor(){this.window=np()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class AQ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new SQ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Xu({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",dQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",hQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=pQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=gQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=mQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=vQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=bQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=yQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=EQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=wQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=xQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=_Q(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const PQ="3.0.5";class ph{constructor(e){if(this.walletsList=new kb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||nQ(),storage:(e==null?void 0:e.storage)||new aQ},this.walletsList=new kb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new AQ({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:PQ}),!this.dappSettings.manifestUrl)throw new Rb("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new hh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Db;const o=As(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new Ut("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield dh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield xi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Fo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=fh(p=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:p.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(p=>setTimeout(()=>p(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=As(n==null?void 0:n.signal);if(i.signal.aborted)throw new Ut("Transaction sending was aborted");this.checkConnection(),lQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=jZ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(rp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(rp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),rp.parseAndThrowError(l);const d=rp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new Z0;const n=As(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Ut("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=rQ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Fo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&UZ(e)?r=new xi(this.dappSettings.storage,e.jsBridgeKey):r=new dh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new Ut("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=zZ.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),Sn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof X0||r instanceof J0)throw Fo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new Z0}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}ph.walletsList=new kb,ph.isWalletInjected=t=>xi.isWalletInjected(t),ph.isInsideWalletBrowser=t=>xi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function $b(t){const{children:e,onClick:r}=t;return ge.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function K7(t){const{wallet:e,connector:r,loading:n}=t,i=Se.useRef(null),s=Se.useRef(),[o,a]=Se.useState(),[u,l]=Se.useState(),[d,p]=Se.useState("connect"),[y,A]=Se.useState(!1),[P,N]=Se.useState();function D(z){var ue;(ue=s.current)==null||ue.update({data:z})}async function k(){A(!0);try{a("");const z=await va.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ue=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:z}});if(!ue)return;N(ue),D(ue),l(z)}}catch(z){a(z.message)}A(!1)}function B(){s.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function j(){r.connect(e,{request:{tonProof:u}})}function U(){if("deepLink"in e){if(!e.deepLink||!P)return;const z=new URL(P),ue=`${e.deepLink}${z.search}`;window.open(ue)}}function K(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(P)}const J=Se.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),T=Se.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Se.useEffect(()=>{B(),k()},[]),ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-text-center xc-mb-6",children:[ge.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[ge.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),ge.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?ge.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):ge.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),ge.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),ge.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&ge.jsx(vc,{className:"xc-animate-spin"}),!y&&!n&&ge.jsxs(ge.Fragment,{children:[W7(e)&&ge.jsxs($b,{onClick:j,children:[ge.jsx(BK,{className:"xc-opacity-80"}),"Extension"]}),J&&ge.jsxs($b,{onClick:U,children:[ge.jsx(f8,{className:"xc-opacity-80"}),"Desktop"]}),T&&ge.jsx($b,{onClick:K,children:"Telegram Mini App"})]})]})]})}function MQ(t){const[e,r]=Se.useState(""),[n,i]=Se.useState(),[s,o]=Se.useState(),a=Ib(),[u,l]=Se.useState(!1);async function d(y){var P,N;if(!y||!((P=y.connectItems)!=null&&P.tonProof))return;l(!0);const A=await va.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(N=y.connectItems)==null?void 0:N.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(A.data),l(!1)}Se.useEffect(()=>{const y=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),A=y.onStatusChange(d);return o(y),r("select"),A},[]);function p(y){r("connect"),i(y)}return ge.jsxs(Ss,{children:[e==="select"&&ge.jsx(T7,{connector:s,onSelect:p,onBack:t.onBack}),e==="connect"&&ge.jsx(K7,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function V7(t){const{children:e,className:r}=t,n=Se.useRef(null),[i,s]=Se.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Se.useEffect(()=>{console.log("maxHeight",i)},[i]),ge.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function IQ(){return ge.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ge.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),ge.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function G7(t){const{wallets:e}=Kl(),[r,n]=Se.useState(),i=Se.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[ge.jsx(l8,{className:"xc-shrink-0 xc-opacity-50"}),ge.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),ge.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>ge.jsx(e7,{wallet:a,onClick:s},`feature-${a.key}`)):ge.jsx(IQ,{})})]})}function CQ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Se.useState(""),[l,d]=Se.useState(null),[p,y]=Se.useState("");function A(k){d(k),u("evm-wallet")}function P(k){u("email"),y(k)}async function N(k){await e(k)}function D(){u("ton-wallet")}return Se.useEffect(()=>{u("index")},[]),ge.jsx(GX,{config:t.config,children:ge.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&ge.jsx(TZ,{onBack:()=>u("index"),onLogin:N,wallet:l}),a==="ton-wallet"&&ge.jsx(MQ,{onBack:()=>u("index"),onLogin:N}),a==="email"&&ge.jsx(uZ,{email:p,onBack:()=>u("index"),onLogin:N}),a==="index"&&ge.jsx(f7,{header:r,onEmailConfirm:P,onSelectWallet:A,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&ge.jsx(G7,{onBack:()=>u("index"),onSelectWallet:A})]})})}function TQ(t){const{wallet:e,onConnect:r}=t,[n,i]=Se.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&ge.jsx(M7,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&ge.jsx(I7,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&ge.jsx(C7,{wallet:e})]})}function RQ(t){const{email:e}=t,[r,n]=Se.useState("captcha");return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),r==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>n("verify-email")}),r==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:t.onInputCode,onResendCode:()=>n("captcha")})]})}function DQ(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Se.useState(""),[a,u]=Se.useState(),[l,d]=Se.useState(),p=Se.useRef(),[y,A]=Se.useState("");function P(j){u(j),o("evm-wallet-connect")}function N(j){A(j),o("email-connect")}async function D(j,U){await e({chain_type:"eip155",client:j.client,connect_info:U}),o("index")}function k(j){d(j),o("ton-wallet-connect")}async function B(j){j&&await r({chain_type:"ton",client:p.current,connect_info:j})}return Se.useEffect(()=>{p.current=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const j=p.current.onStatusChange(B);return o("index"),j},[]),ge.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&ge.jsx(G7,{onBack:()=>o("index"),onSelectWallet:P}),s==="evm-wallet-connect"&&ge.jsx(TQ,{onBack:()=>o("index"),onConnect:D,wallet:a}),s==="ton-wallet-select"&&ge.jsx(T7,{connector:p.current,onSelect:k,onBack:()=>o("index")}),s==="ton-wallet-connect"&&ge.jsx(K7,{connector:p.current,wallet:l,onBack:()=>o("index")}),s==="email-connect"&&ge.jsx(RQ,{email:y,onBack:()=>o("index"),onInputCode:n}),s==="index"&&ge.jsx(f7,{onEmailConfirm:N,onSelectWallet:P,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Fn.CodattaConnect=DQ,Fn.CodattaConnectContextProvider=CK,Fn.CodattaSignin=CQ,Fn.coinbaseWallet=o8,Fn.useCodattaConnectContext=Kl,Object.defineProperty(Fn,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/main-ChUtI_2i.js b/dist/main-C4Op-TDI.js similarity index 95% rename from dist/main-ChUtI_2i.js rename to dist/main-C4Op-TDI.js index be01045..3d459c5 100644 --- a/dist/main-ChUtI_2i.js +++ b/dist/main-C4Op-TDI.js @@ -2,13 +2,13 @@ var NR = Object.defineProperty; var LR = (t, e, r) => e in t ? NR(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; var Ds = (t, e, r) => LR(t, typeof e != "symbol" ? e + "" : e, r); import * as Gt from "react"; -import pv, { createContext as Sa, useContext as Tn, useState as Yt, useEffect as Dn, forwardRef as gv, createElement as qd, useId as mv, useCallback as vv, Component as kR, useLayoutEffect as $R, useRef as Zn, useInsertionEffect as b5, useMemo as wi, Fragment as y5, Children as BR, isValidElement as FR } from "react"; +import gv, { createContext as Sa, useContext as Tn, useState as Yt, useEffect as Dn, forwardRef as mv, createElement as qd, useId as vv, useCallback as bv, Component as kR, useLayoutEffect as $R, useRef as Zn, useInsertionEffect as y5, useMemo as wi, Fragment as w5, Children as BR, isValidElement as FR } from "react"; import "https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"; var gn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function ts(t) { return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; } -function bv(t) { +function yv(t) { if (t.__esModule) return t; var e = t.default; if (typeof e == "function") { @@ -37,11 +37,11 @@ var Ym = { exports: {} }, gf = {}; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -var d2; +var p2; function jR() { - if (d2) return gf; - d2 = 1; - var t = pv, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 }; + if (p2) return gf; + p2 = 1; + var t = gv, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 }; function o(a, u, l) { var d, p = {}, w = null, A = null; l !== void 0 && (w = "" + l), u.key !== void 0 && (w = "" + u.key), u.ref !== void 0 && (A = u.ref); @@ -61,10 +61,10 @@ var mf = {}; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -var p2; +var g2; function UR() { - return p2 || (p2 = 1, process.env.NODE_ENV !== "production" && function() { - var t = pv, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), a = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), M = Symbol.iterator, N = "@@iterator"; + return g2 || (g2 = 1, process.env.NODE_ENV !== "production" && function() { + var t = gv, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), a = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), M = Symbol.iterator, N = "@@iterator"; function L(j) { if (j === null || typeof j != "object") return null; @@ -773,17 +773,17 @@ function zR(t, e) { const r = t.exec(e); return r == null ? void 0 : r.groups; } -const g2 = /^tuple(?(\[(\d*)\])*)$/; +const m2 = /^tuple(?(\[(\d*)\])*)$/; function Jm(t) { let e = t.type; - if (g2.test(t.type) && "components" in t) { + if (m2.test(t.type) && "components" in t) { e = "("; const r = t.components.length; for (let i = 0; i < r; i++) { const s = t.components[i]; e += Jm(s), i < r - 1 && (e += ", "); } - const n = zR(g2, t.type); + const n = zR(m2, t.type); return e += `)${(n == null ? void 0 : n.array) ?? ""}`, Jm({ ...t, type: e @@ -813,13 +813,13 @@ function bi(t, e, r) { function vu(t, { includeName: e = !1 } = {}) { if (t.type !== "function" && t.type !== "event" && t.type !== "error") throw new rD(t.type); - return `${t.name}(${yv(t.inputs, { includeName: e })})`; + return `${t.name}(${wv(t.inputs, { includeName: e })})`; } -function yv(t, { includeName: e = !1 } = {}) { +function wv(t, { includeName: e = !1 } = {}) { return t ? t.map((r) => HR(r, { includeName: e })).join(e ? ", " : ",") : ""; } function HR(t, { includeName: e }) { - return t.type.startsWith("tuple") ? `(${yv(t.components, { includeName: e })})${t.type.slice(5)}` : t.type + (e && t.name ? ` ${t.name}` : ""); + return t.type.startsWith("tuple") ? `(${wv(t.components, { includeName: e })})${t.type.slice(5)}` : t.type + (e && t.name ? ` ${t.name}` : ""); } function va(t, { strict: e = !0 } = {}) { return !t || typeof t != "string" ? !1 : e ? /^0x[0-9a-fA-F]*$/.test(t) : t.startsWith("0x"); @@ -827,10 +827,10 @@ function va(t, { strict: e = !0 } = {}) { function An(t) { return va(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length; } -const w5 = "2.21.45"; +const x5 = "2.21.45"; let bf = { getDocsUrl: ({ docsBaseUrl: t, docsPath: e = "", docsSlug: r }) => e ? `${t ?? "https://viem.sh"}${e}${r ? `#${r}` : ""}` : void 0, - version: `viem@${w5}` + version: `viem@${x5}` }; class yt extends Error { constructor(e, r = {}) { @@ -877,14 +877,14 @@ class yt extends Error { configurable: !0, writable: !0, value: "BaseError" - }), this.details = n, this.docsPath = i, this.metaMessages = r.metaMessages, this.name = r.name ?? this.name, this.shortMessage = e, this.version = w5; + }), this.details = n, this.docsPath = i, this.metaMessages = r.metaMessages, this.name = r.name ?? this.name, this.shortMessage = e, this.version = x5; } walk(e) { - return x5(this, e); + return _5(this, e); } } -function x5(t, e) { - return e != null && e(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ? x5(t.cause, e) : e ? null : t; +function _5(t, e) { + return e != null && e(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ? _5(t.cause, e) : e ? null : t; } class KR extends yt { constructor({ docsPath: e }) { @@ -898,7 +898,7 @@ class KR extends yt { }); } } -class m2 extends yt { +class v2 extends yt { constructor({ docsPath: e }) { super([ "Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.", @@ -915,7 +915,7 @@ class VR extends yt { super([`Data size of ${n} bytes is too small for given parameters.`].join(` `), { metaMessages: [ - `Params: (${yv(r, { includeName: !0 })})`, + `Params: (${wv(r, { includeName: !0 })})`, `Data: ${e} (${n} bytes)` ], name: "AbiDecodingDataSizeTooSmallError" @@ -937,7 +937,7 @@ class VR extends yt { }), this.data = e, this.params = r, this.size = n; } } -class wv extends yt { +class xv extends yt { constructor() { super('Cannot decode zero data ("0x") with ABI parameters.', { name: "AbiDecodingZeroDataError" @@ -969,7 +969,7 @@ class JR extends yt { `), { name: "AbiEncodingLengthMismatchError" }); } } -class _5 extends yt { +class E5 extends yt { constructor(e, { docsPath: r }) { super([ `Encoded error signature "${e}" not found on ABI.`, @@ -987,7 +987,7 @@ class _5 extends yt { }), this.signature = e; } } -class v2 extends yt { +class b2 extends yt { constructor(e, { docsPath: r } = {}) { super([ `Function ${e ? `"${e}" ` : ""}not found on ABI.`, @@ -1055,17 +1055,17 @@ class rD extends yt { `), { name: "InvalidDefinitionTypeError" }); } } -class E5 extends yt { +class S5 extends yt { constructor({ offset: e, position: r, size: n }) { super(`Slice ${r === "start" ? "starting" : "ending"} at offset "${e}" is out-of-bounds (size: ${n}).`, { name: "SliceOffsetOutOfBoundsError" }); } } -class S5 extends yt { +class A5 extends yt { constructor({ size: e, targetSize: r, type: n }) { super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`, { name: "SizeExceedsPaddingSizeError" }); } } -class b2 extends yt { +class y2 extends yt { constructor({ size: e, targetSize: r, type: n }) { super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`, { name: "InvalidBytesLengthError" }); } @@ -1078,7 +1078,7 @@ function ma(t, { dir: e, size: r = 32 } = {}) { return t; const n = t.replace("0x", ""); if (n.length > r * 2) - throw new S5({ + throw new A5({ size: Math.ceil(n.length / 2), targetSize: r, type: "hex" @@ -1089,7 +1089,7 @@ function nD(t, { dir: e, size: r = 32 } = {}) { if (r === null) return t; if (t.length > r) - throw new S5({ + throw new A5({ size: t.length, targetSize: r, type: "bytes" @@ -1118,7 +1118,7 @@ class oD extends yt { super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" }); } } -function xv(t, { dir: e = "left" } = {}) { +function _v(t, { dir: e = "left" } = {}) { let r = typeof t == "string" ? t.replace("0x", "") : t, n = 0; for (let i = 0; i < r.length - 1 && r[e === "left" ? i : r.length - i - 1].toString() === "0"; i++) n++; @@ -1145,9 +1145,9 @@ function bu(t, e = {}) { } const aD = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); function zd(t, e = {}) { - return typeof t == "number" || typeof t == "bigint" ? Mr(t, e) : typeof t == "string" ? I0(t, e) : typeof t == "boolean" ? A5(t, e) : xi(t, e); + return typeof t == "number" || typeof t == "bigint" ? Mr(t, e) : typeof t == "string" ? I0(t, e) : typeof t == "boolean" ? P5(t, e) : xi(t, e); } -function A5(t, e = {}) { +function P5(t, e = {}) { const r = `0x${Number(t)}`; return typeof e.size == "number" ? (to(r, { size: e.size }), Tu(r, { size: e.size })) : r; } @@ -1182,8 +1182,8 @@ function I0(t, e = {}) { return xi(r, e); } const uD = /* @__PURE__ */ new TextEncoder(); -function _v(t, e = {}) { - return typeof t == "number" || typeof t == "bigint" ? lD(t, e) : typeof t == "boolean" ? fD(t, e) : va(t) ? Lo(t, e) : P5(t, e); +function Ev(t, e = {}) { + return typeof t == "number" || typeof t == "bigint" ? lD(t, e) : typeof t == "boolean" ? fD(t, e) : va(t) ? Lo(t, e) : M5(t, e); } function fD(t, e = {}) { const r = new Uint8Array(1); @@ -1197,7 +1197,7 @@ const go = { a: 97, f: 102 }; -function y2(t) { +function w2(t) { if (t >= go.zero && t <= go.nine) return t - go.zero; if (t >= go.A && t <= go.F) @@ -1212,7 +1212,7 @@ function Lo(t, e = {}) { n.length % 2 && (n = `0${n}`); const i = n.length / 2, s = new Uint8Array(i); for (let o = 0, a = 0; o < i; o++) { - const u = y2(n.charCodeAt(a++)), l = y2(n.charCodeAt(a++)); + const u = w2(n.charCodeAt(a++)), l = w2(n.charCodeAt(a++)); if (u === void 0 || l === void 0) throw new yt(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`); s[o] = u * 16 + l; @@ -1223,7 +1223,7 @@ function lD(t, e) { const r = Mr(t, e); return Lo(r); } -function P5(t, e = {}) { +function M5(t, e = {}) { const r = uD.encode(t); return typeof e.size == "number" ? (to(r, { size: e.size }), Tu(r, { dir: "right", size: e.size })) : r; } @@ -1251,15 +1251,15 @@ function Hd(t, e = !0) { if (e && t.finished) throw new Error("Hash#digest() has already been called"); } -function M5(t, e) { +function I5(t, e) { Ll(t); const r = e.outputLen; if (t.length < r) throw new Error(`digestInto() expects output buffer of length at least ${r}`); } -const rd = /* @__PURE__ */ BigInt(2 ** 32 - 1), w2 = /* @__PURE__ */ BigInt(32); +const rd = /* @__PURE__ */ BigInt(2 ** 32 - 1), x2 = /* @__PURE__ */ BigInt(32); function dD(t, e = !1) { - return e ? { h: Number(t & rd), l: Number(t >> w2 & rd) } : { h: Number(t >> w2 & rd) | 0, l: Number(t & rd) | 0 }; + return e ? { h: Number(t & rd), l: Number(t >> x2 & rd) } : { h: Number(t >> x2 & rd) | 0, l: Number(t & rd) | 0 }; } function pD(t, e = !1) { let r = new Uint32Array(t.length), n = new Uint32Array(t.length); @@ -1271,8 +1271,8 @@ function pD(t, e = !1) { } const gD = (t, e, r) => t << r | e >>> 32 - r, mD = (t, e, r) => e << r | t >>> 32 - r, vD = (t, e, r) => e << r - 32 | t >>> 64 - r, bD = (t, e, r) => t << r - 32 | e >>> 64 - r, qc = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0; /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -const yD = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), Bg = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), Ns = (t, e) => t << 32 - e | t >>> e, x2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, wD = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255; -function _2(t) { +const yD = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), Bg = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), Ns = (t, e) => t << 32 - e | t >>> e, _2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, wD = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255; +function E2(t) { for (let e = 0; e < t.length; e++) t[e] = wD(t[e]); } @@ -1305,13 +1305,13 @@ function mse(...t) { } return r; } -class I5 { +class C5 { // Safe version that clones internal state clone() { return this._cloneInto(); } } -function C5(t) { +function T5(t) { const e = (n) => t().update(C0(n)).digest(), r = t(); return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = () => t(), e; } @@ -1326,28 +1326,28 @@ function vse(t = 32) { return qc.randomBytes(t); throw new Error("crypto.getRandomValues must be defined"); } -const T5 = [], R5 = [], D5 = [], AD = /* @__PURE__ */ BigInt(0), yf = /* @__PURE__ */ BigInt(1), PD = /* @__PURE__ */ BigInt(2), MD = /* @__PURE__ */ BigInt(7), ID = /* @__PURE__ */ BigInt(256), CD = /* @__PURE__ */ BigInt(113); +const R5 = [], D5 = [], O5 = [], AD = /* @__PURE__ */ BigInt(0), yf = /* @__PURE__ */ BigInt(1), PD = /* @__PURE__ */ BigInt(2), MD = /* @__PURE__ */ BigInt(7), ID = /* @__PURE__ */ BigInt(256), CD = /* @__PURE__ */ BigInt(113); for (let t = 0, e = yf, r = 1, n = 0; t < 24; t++) { - [r, n] = [n, (2 * r + 3 * n) % 5], T5.push(2 * (5 * n + r)), R5.push((t + 1) * (t + 2) / 2 % 64); + [r, n] = [n, (2 * r + 3 * n) % 5], R5.push(2 * (5 * n + r)), D5.push((t + 1) * (t + 2) / 2 % 64); let i = AD; for (let s = 0; s < 7; s++) e = (e << yf ^ (e >> MD) * CD) % ID, e & PD && (i ^= yf << (yf << /* @__PURE__ */ BigInt(s)) - yf); - D5.push(i); + O5.push(i); } -const [TD, RD] = /* @__PURE__ */ pD(D5, !0), E2 = (t, e, r) => r > 32 ? vD(t, e, r) : gD(t, e, r), S2 = (t, e, r) => r > 32 ? bD(t, e, r) : mD(t, e, r); -function O5(t, e = 24) { +const [TD, RD] = /* @__PURE__ */ pD(O5, !0), S2 = (t, e, r) => r > 32 ? vD(t, e, r) : gD(t, e, r), A2 = (t, e, r) => r > 32 ? bD(t, e, r) : mD(t, e, r); +function N5(t, e = 24) { const r = new Uint32Array(10); for (let n = 24 - e; n < 24; n++) { for (let o = 0; o < 10; o++) r[o] = t[o] ^ t[o + 10] ^ t[o + 20] ^ t[o + 30] ^ t[o + 40]; for (let o = 0; o < 10; o += 2) { - const a = (o + 8) % 10, u = (o + 2) % 10, l = r[u], d = r[u + 1], p = E2(l, d, 1) ^ r[a], w = S2(l, d, 1) ^ r[a + 1]; + const a = (o + 8) % 10, u = (o + 2) % 10, l = r[u], d = r[u + 1], p = S2(l, d, 1) ^ r[a], w = A2(l, d, 1) ^ r[a + 1]; for (let A = 0; A < 50; A += 10) t[o + A] ^= p, t[o + A + 1] ^= w; } let i = t[2], s = t[3]; for (let o = 0; o < 24; o++) { - const a = R5[o], u = E2(i, s, a), l = S2(i, s, a), d = T5[o]; + const a = D5[o], u = S2(i, s, a), l = A2(i, s, a), d = R5[o]; i = t[d], s = t[d + 1], t[d] = u, t[d + 1] = l; } for (let o = 0; o < 50; o += 10) { @@ -1360,7 +1360,7 @@ function O5(t, e = 24) { } r.fill(0); } -class kl extends I5 { +class kl extends C5 { // NOTE: we accept arguments in bytes instead of bits here. constructor(e, r, n, i = !1, s = 24) { if (super(), this.blockLen = e, this.suffix = r, this.outputLen = n, this.enableXOF = i, this.rounds = s, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, Wd(n), 0 >= this.blockLen || this.blockLen >= 200) @@ -1368,7 +1368,7 @@ class kl extends I5 { this.state = new Uint8Array(200), this.state32 = yD(this.state); } keccak() { - x2 || _2(this.state32), O5(this.state32, this.rounds), x2 || _2(this.state32), this.posOut = 0, this.pos = 0; + _2 || E2(this.state32), N5(this.state32, this.rounds), _2 || E2(this.state32), this.posOut = 0, this.pos = 0; } update(e) { Hd(this); @@ -1409,7 +1409,7 @@ class kl extends I5 { return Wd(e), this.xofInto(new Uint8Array(e)); } digestInto(e) { - if (M5(e, this), this.finished) + if (I5(e, this), this.finished) throw new Error("digest() was already called"); return this.writeInto(e), this.destroy(), e; } @@ -1424,12 +1424,12 @@ class kl extends I5 { return e || (e = new kl(r, n, i, o, s)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = s, e.suffix = n, e.outputLen = i, e.enableXOF = o, e.destroyed = this.destroyed, e; } } -const Aa = (t, e, r) => C5(() => new kl(e, t, r)), DD = /* @__PURE__ */ Aa(6, 144, 224 / 8), OD = /* @__PURE__ */ Aa(6, 136, 256 / 8), ND = /* @__PURE__ */ Aa(6, 104, 384 / 8), LD = /* @__PURE__ */ Aa(6, 72, 512 / 8), kD = /* @__PURE__ */ Aa(1, 144, 224 / 8), N5 = /* @__PURE__ */ Aa(1, 136, 256 / 8), $D = /* @__PURE__ */ Aa(1, 104, 384 / 8), BD = /* @__PURE__ */ Aa(1, 72, 512 / 8), L5 = (t, e, r) => SD((n = {}) => new kl(e, t, n.dkLen === void 0 ? r : n.dkLen, !0)), FD = /* @__PURE__ */ L5(31, 168, 128 / 8), jD = /* @__PURE__ */ L5(31, 136, 256 / 8), UD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +const Aa = (t, e, r) => T5(() => new kl(e, t, r)), DD = /* @__PURE__ */ Aa(6, 144, 224 / 8), OD = /* @__PURE__ */ Aa(6, 136, 256 / 8), ND = /* @__PURE__ */ Aa(6, 104, 384 / 8), LD = /* @__PURE__ */ Aa(6, 72, 512 / 8), kD = /* @__PURE__ */ Aa(1, 144, 224 / 8), L5 = /* @__PURE__ */ Aa(1, 136, 256 / 8), $D = /* @__PURE__ */ Aa(1, 104, 384 / 8), BD = /* @__PURE__ */ Aa(1, 72, 512 / 8), k5 = (t, e, r) => SD((n = {}) => new kl(e, t, n.dkLen === void 0 ? r : n.dkLen, !0)), FD = /* @__PURE__ */ k5(31, 168, 128 / 8), jD = /* @__PURE__ */ k5(31, 136, 256 / 8), UD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, Keccak: kl, - keccakP: O5, + keccakP: N5, keccak_224: kD, - keccak_256: N5, + keccak_256: L5, keccak_384: $D, keccak_512: BD, sha3_224: DD, @@ -1440,10 +1440,10 @@ const Aa = (t, e, r) => C5(() => new kl(e, t, r)), DD = /* @__PURE__ */ Aa(6, 14 shake256: jD }, Symbol.toStringTag, { value: "Module" })); function $l(t, e) { - const r = e || "hex", n = N5(va(t, { strict: !1 }) ? _v(t) : t); + const r = e || "hex", n = L5(va(t, { strict: !1 }) ? Ev(t) : t); return r === "bytes" ? n : zd(n); } -const qD = (t) => $l(_v(t)); +const qD = (t) => $l(Ev(t)); function zD(t) { return qD(t); } @@ -1476,10 +1476,10 @@ const HD = (t) => { const e = typeof t == "string" ? t : WR(t); return WD(e); }; -function k5(t) { +function $5(t) { return zD(HD(t)); } -const KD = k5; +const KD = $5; class yu extends yt { constructor({ address: e }) { super(`Address "${e}" is invalid.`, { @@ -1516,13 +1516,13 @@ const Fg = /* @__PURE__ */ new T0(8192); function Bl(t, e) { if (Fg.has(`${t}.${e}`)) return Fg.get(`${t}.${e}`); - const r = t.substring(2).toLowerCase(), n = $l(P5(r), "bytes"), i = r.split(""); + const r = t.substring(2).toLowerCase(), n = $l(M5(r), "bytes"), i = r.split(""); for (let o = 0; o < 40; o += 2) n[o >> 1] >> 4 >= 8 && i[o] && (i[o] = i[o].toUpperCase()), (n[o >> 1] & 15) >= 8 && i[o + 1] && (i[o + 1] = i[o + 1].toUpperCase()); const s = `0x${i.join("")}`; return Fg.set(`${t}.${e}`, s), s; } -function Ev(t, e) { +function Sv(t, e) { if (!ko(t, { strict: !1 })) throw new yu({ address: t }); return Bl(t, e); @@ -1554,37 +1554,37 @@ function R0(t) { function Kd(t, e, r, { strict: n } = {}) { return va(t, { strict: !1 }) ? YD(t, e, r, { strict: n - }) : F5(t, e, r, { + }) : j5(t, e, r, { strict: n }); } -function $5(t, e) { +function B5(t, e) { if (typeof e == "number" && e > 0 && e > An(t) - 1) - throw new E5({ + throw new S5({ offset: e, position: "start", size: An(t) }); } -function B5(t, e, r) { +function F5(t, e, r) { if (typeof e == "number" && typeof r == "number" && An(t) !== r - e) - throw new E5({ + throw new S5({ offset: r, position: "end", size: An(t) }); } -function F5(t, e, r, { strict: n } = {}) { - $5(t, e); +function j5(t, e, r, { strict: n } = {}) { + B5(t, e); const i = t.slice(e, r); - return n && B5(i, e, r), i; + return n && F5(i, e, r), i; } function YD(t, e, r, { strict: n } = {}) { - $5(t, e); + B5(t, e); const i = `0x${t.replace("0x", "").slice((e ?? 0) * 2, (r ?? t.length) * 2)}`; - return n && B5(i, e, r), i; + return n && F5(i, e, r), i; } -function j5(t, e) { +function U5(t, e) { if (t.length !== e.length) throw new JR({ expectedLength: t.length, @@ -1593,17 +1593,17 @@ function j5(t, e) { const r = JD({ params: t, values: e - }), n = Av(r); + }), n = Pv(r); return n.length === 0 ? "0x" : n; } function JD({ params: t, values: e }) { const r = []; for (let n = 0; n < t.length; n++) - r.push(Sv({ param: t[n], value: e[n] })); + r.push(Av({ param: t[n], value: e[n] })); return r; } -function Sv({ param: t, value: e }) { - const r = Pv(t.type); +function Av({ param: t, value: e }) { + const r = Mv(t.type); if (r) { const [n, i] = r; return ZD(e, { length: n, param: { ...t, type: i } }); @@ -1628,7 +1628,7 @@ function Sv({ param: t, value: e }) { docsPath: "/docs/contract/encodeAbiParameters" }); } -function Av(t) { +function Pv(t) { let e = 0; for (let s = 0; s < t.length; s++) { const { dynamic: o, encoded: a } = t[s]; @@ -1660,11 +1660,11 @@ function ZD(t, { length: e, param: r }) { let i = !1; const s = []; for (let o = 0; o < t.length; o++) { - const a = Sv({ param: r, value: t[o] }); + const a = Av({ param: r, value: t[o] }); a.dynamic && (i = !0), s.push(a); } if (n || i) { - const o = Av(s); + const o = Pv(s); if (n) { const a = Mr(s.length, { size: 32 }); return { @@ -1702,7 +1702,7 @@ function QD(t, { param: e }) { function eO(t) { if (typeof t != "boolean") throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`); - return { dynamic: !1, encoded: ma(A5(t)) }; + return { dynamic: !1, encoded: ma(P5(t)) }; } function tO(t, { signed: e }) { return { @@ -1731,7 +1731,7 @@ function nO(t, { param: e }) { let r = !1; const n = []; for (let i = 0; i < e.components.length; i++) { - const s = e.components[i], o = Array.isArray(t) ? i : s.name, a = Sv({ + const s = e.components[i], o = Array.isArray(t) ? i : s.name, a = Av({ param: s, value: t[o] }); @@ -1739,19 +1739,19 @@ function nO(t, { param: e }) { } return { dynamic: r, - encoded: r ? Av(n) : wu(n.map(({ encoded: i }) => i)) + encoded: r ? Pv(n) : wu(n.map(({ encoded: i }) => i)) }; } -function Pv(t) { +function Mv(t) { const e = t.match(/^(.*)\[(\d+)?\]$/); return e ? ( // Return `null` if the array is dynamic. [e[2] ? Number(e[2]) : null, e[1]] ) : void 0; } -const Mv = (t) => Kd(k5(t), 0, 4); -function U5(t) { - const { abi: e, args: r = [], name: n } = t, i = va(n, { strict: !1 }), s = e.filter((a) => i ? a.type === "function" ? Mv(a) === n : a.type === "event" ? KD(a) === n : !1 : "name" in a && a.name === n); +const Iv = (t) => Kd($5(t), 0, 4); +function q5(t) { + const { abi: e, args: r = [], name: n } = t, i = va(n, { strict: !1 }), s = e.filter((a) => i ? a.type === "function" ? Iv(a) === n : a.type === "event" ? KD(a) === n : !1 : "name" in a && a.name === n); if (s.length === 0) return; if (s.length === 1) @@ -1772,7 +1772,7 @@ function U5(t) { return p ? Xm(l, p) : !1; })) { if (o && "inputs" in o && o.inputs) { - const l = q5(a.inputs, o.inputs, r); + const l = z5(a.inputs, o.inputs, r); if (l) throw new XR({ abiItem: a, @@ -1806,11 +1806,11 @@ function Xm(t, e) { })) : !1; } } -function q5(t, e, r) { +function z5(t, e, r) { for (const n in t) { const i = t[n], s = e[n]; if (i.type === "tuple" && s.type === "tuple" && "components" in i && "components" in s) - return q5(i.components, s.components, r[n]); + return z5(i.components, s.components, r[n]); const o = [i.type, s.type]; if (o.includes("address") && o.includes("bytes20") ? !0 : o.includes("address") && o.includes("string") ? ko(r[n], { strict: !1 }) : o.includes("address") && o.includes("bytes") ? ko(r[n], { strict: !1 }) : !1) return o; @@ -1819,32 +1819,32 @@ function q5(t, e, r) { function qo(t) { return typeof t == "string" ? { address: t, type: "json-rpc" } : t; } -const A2 = "/docs/contract/encodeFunctionData"; +const P2 = "/docs/contract/encodeFunctionData"; function iO(t) { const { abi: e, args: r, functionName: n } = t; let i = e[0]; if (n) { - const s = U5({ + const s = q5({ abi: e, args: r, name: n }); if (!s) - throw new v2(n, { docsPath: A2 }); + throw new b2(n, { docsPath: P2 }); i = s; } if (i.type !== "function") - throw new v2(void 0, { docsPath: A2 }); + throw new b2(void 0, { docsPath: P2 }); return { abi: [i], - functionName: Mv(vu(i)) + functionName: Iv(vu(i)) }; } function sO(t) { const { args: e } = t, { abi: r, functionName: n } = (() => { var a; return t.abi.length === 1 && ((a = t.functionName) != null && a.startsWith("0x")) ? t : iO(t); - })(), i = r[0], s = n, o = "inputs" in i && i.inputs ? j5(i.inputs, e ?? []) : void 0; + })(), i = r[0], s = n, o = "inputs" in i && i.inputs ? U5(i.inputs, e ?? []) : void 0; return R0([s, o ?? "0x"]); } const oO = { @@ -1876,7 +1876,7 @@ const oO = { name: "Panic", type: "error" }; -class P2 extends yt { +class M2 extends yt { constructor({ offset: e }) { super(`Offset \`${e}\` cannot be negative.`, { name: "NegativeOffsetError" @@ -1916,7 +1916,7 @@ const lO = { }, decrementPosition(t) { if (t < 0) - throw new P2({ offset: t }); + throw new M2({ offset: t }); const e = this.position - t; this.assertPosition(e), this.position = e; }, @@ -1925,7 +1925,7 @@ const lO = { }, incrementPosition(t) { if (t < 0) - throw new P2({ offset: t }); + throw new M2({ offset: t }); const e = this.position + t; this.assertPosition(e), this.position = e; }, @@ -2015,7 +2015,7 @@ const lO = { this.positionReadCount.set(this.position, t + 1), t > 0 && this.recursiveReadCount++; } }; -function Iv(t, { recursiveReadLimit: e = 8192 } = {}) { +function Cv(t, { recursiveReadLimit: e = 8192 } = {}) { const r = Object.create(lO); return r.bytes = t, r.dataView = new DataView(t.buffer, t.byteOffset, t.byteLength), r.positionReadCount = /* @__PURE__ */ new Map(), r.recursiveReadLimit = e, r; } @@ -2026,7 +2026,7 @@ function hO(t, e = {}) { } function dO(t, e = {}) { let r = t; - if (typeof e.size < "u" && (to(r, { size: e.size }), r = xv(r)), r.length > 1 || r[0] > 1) + if (typeof e.size < "u" && (to(r, { size: e.size }), r = _v(r)), r.length > 1 || r[0] > 1) throw new sD(r); return !!r[0]; } @@ -2037,12 +2037,12 @@ function Io(t, e = {}) { } function pO(t, e = {}) { let r = t; - return typeof e.size < "u" && (to(r, { size: e.size }), r = xv(r, { dir: "right" })), new TextDecoder().decode(r); + return typeof e.size < "u" && (to(r, { size: e.size }), r = _v(r, { dir: "right" })), new TextDecoder().decode(r); } function gO(t, e) { - const r = typeof e == "string" ? Lo(e) : e, n = Iv(r); + const r = typeof e == "string" ? Lo(e) : e, n = Cv(r); if (An(r) === 0 && t.length > 0) - throw new wv(); + throw new xv(); if (An(e) && An(e) < 32) throw new VR({ data: typeof e == "string" ? e : xi(e), @@ -2062,7 +2062,7 @@ function gO(t, e) { return s; } function au(t, e, { staticPosition: r }) { - const n = Pv(e.type); + const n = Mv(e.type); if (n) { const [i, s] = n; return vO(t, { ...e, type: s }, { length: i, staticPosition: r }); @@ -2083,16 +2083,16 @@ function au(t, e, { staticPosition: r }) { docsPath: "/docs/contract/decodeAbiParameters" }); } -const M2 = 32, Zm = 32; +const I2 = 32, Zm = 32; function mO(t) { const e = t.readBytes(32); - return [Bl(xi(F5(e, -20))), 32]; + return [Bl(xi(j5(e, -20))), 32]; } function vO(t, e, { length: r, staticPosition: n }) { if (!r) { - const o = Io(t.readBytes(Zm)), a = n + o, u = a + M2; + const o = Io(t.readBytes(Zm)), a = n + o, u = a + I2; t.setPosition(a); - const l = Io(t.readBytes(M2)), d = tl(e); + const l = Io(t.readBytes(I2)), d = tl(e); let p = 0; const w = []; for (let A = 0; A < l; ++A) { @@ -2177,7 +2177,7 @@ function _O(t, { staticPosition: e }) { const i = Io(t.readBytes(32)); if (i === 0) return t.setPosition(e + 32), ["", 32]; - const s = t.readBytes(i, 32), o = pO(xv(s)); + const s = t.readBytes(i, 32), o = pO(_v(s)); return t.setPosition(e + 32), [o, 32]; } function tl(t) { @@ -2187,16 +2187,16 @@ function tl(t) { return !0; if (e === "tuple") return (n = t.components) == null ? void 0 : n.some(tl); - const r = Pv(t.type); + const r = Mv(t.type); return !!(r && tl({ ...t, type: r[1] })); } function EO(t) { const { abi: e, data: r } = t, n = Kd(r, 0, 4); if (n === "0x") - throw new wv(); - const s = [...e || [], aO, cO].find((o) => o.type === "error" && n === Mv(vu(o))); + throw new xv(); + const s = [...e || [], aO, cO].find((o) => o.type === "error" && n === Iv(vu(o))); if (!s) - throw new _5(n, { + throw new E5(n, { docsPath: "/docs/contract/decodeErrorResult" }); return { @@ -2206,7 +2206,7 @@ function EO(t) { }; } const Ru = (t, e, r) => JSON.stringify(t, (n, i) => typeof i == "bigint" ? i.toString() : i, r); -function z5({ abiItem: t, args: e, includeFunctionName: r = !0, includeName: n = !1 }) { +function W5({ abiItem: t, args: e, includeFunctionName: r = !0, includeName: n = !1 }) { if ("name" in t && "inputs" in t && t.inputs) return `${r ? t.name : ""}(${t.inputs.map((i, s) => `${n && i.name ? `${i.name}: ` : ""}${typeof e[s] == "object" ? Ru(e[s]) : e[s]}`).join(", ")})`; } @@ -2217,7 +2217,7 @@ const SO = { ether: -9, wei: 9 }; -function W5(t, e) { +function H5(t, e) { let r = t.toString(); const n = r.startsWith("-"); n && (r = r.slice(1)), r = r.padStart(e, "0"); @@ -2227,11 +2227,11 @@ function W5(t, e) { ]; return s = s.replace(/(0+)$/, ""), `${n ? "-" : ""}${i || "0"}${s ? `.${s}` : ""}`; } -function H5(t, e = "wei") { - return W5(t, SO[e]); +function K5(t, e = "wei") { + return H5(t, SO[e]); } function Es(t, e = "wei") { - return W5(t, AO[e]); + return H5(t, AO[e]); } class PO extends yt { constructor({ address: e }) { @@ -2289,7 +2289,7 @@ class TO extends yt { chain: i && `${i == null ? void 0 : i.name} (id: ${i == null ? void 0 : i.id})`, from: r == null ? void 0 : r.address, to: p, - value: typeof w < "u" && `${H5(w)} ${((M = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : M.symbol) || "ETH"}`, + value: typeof w < "u" && `${K5(w)} ${((M = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : M.symbol) || "ETH"}`, data: s, gas: o, gasPrice: typeof a < "u" && `${Es(a)} gwei`, @@ -2314,10 +2314,10 @@ class TO extends yt { }), this.cause = e; } } -const RO = (t) => t, K5 = (t) => t; +const RO = (t) => t, V5 = (t) => t; class DO extends yt { constructor(e, { abi: r, args: n, contractAddress: i, docsPath: s, functionName: o, sender: a }) { - const u = U5({ abi: r, args: n, name: o }), l = u ? z5({ + const u = q5({ abi: r, args: n, name: o }), l = u ? W5({ abiItem: u, args: n, includeFunctionName: !1, @@ -2388,7 +2388,7 @@ class OO extends yt { const [A] = w; u = oO[A]; } else { - const A = d ? vu(d, { includeName: !0 }) : void 0, M = d && w ? z5({ + const A = d ? vu(d, { includeName: !0 }) : void 0, M = d && w ? W5({ abiItem: d, args: w, includeFunctionName: !1, @@ -2404,7 +2404,7 @@ class OO extends yt { } else i && (u = i); let l; - s instanceof _5 && (l = s.signature, a = [ + s instanceof E5 && (l = s.signature, a = [ `Unable to decode signature "${l}" as it was not found on the provided ABI.`, "Make sure you are using the correct ABI and that the error exists on it.", `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.` @@ -2462,14 +2462,14 @@ class LO extends yt { }), this.data = e; } } -class V5 extends yt { +class G5 extends yt { constructor({ body: e, cause: r, details: n, headers: i, status: s, url: o }) { super("HTTP request failed.", { cause: r, details: n, metaMessages: [ s && `Status: ${s}`, - `URL: ${K5(o)}`, + `URL: ${V5(o)}`, e && `Request body: ${Ru(e)}` ].filter(Boolean), name: "HttpRequestError" @@ -2501,7 +2501,7 @@ class kO extends yt { super("RPC Request failed.", { cause: r, details: r.message, - metaMessages: [`URL: ${K5(n)}`, `Request body: ${Ru(e)}`], + metaMessages: [`URL: ${V5(n)}`, `Request body: ${Ru(e)}`], name: "RpcRequestError" }), Object.defineProperty(this, "code", { enumerable: !0, @@ -2830,7 +2830,7 @@ class BO extends Si { } const FO = 3; function jO(t, { abi: e, address: r, args: n, docsPath: i, functionName: s, sender: o }) { - const { code: a, data: u, message: l, shortMessage: d } = t instanceof LO ? t : t instanceof yt ? t.walk((w) => "data" in w) || t.walk() : {}, p = t instanceof wv ? new NO({ functionName: s }) : [FO, uc.code].includes(a) && (u || l || d) ? new OO({ + const { code: a, data: u, message: l, shortMessage: d } = t instanceof LO ? t : t instanceof yt ? t.walk((w) => "data" in w) || t.walk() : {}, p = t instanceof xv ? new NO({ functionName: s }) : [FO, uc.code].includes(a) && (u || l || d) ? new OO({ abi: e, data: typeof u == "object" ? u.data : u, functionName: s, @@ -2850,17 +2850,17 @@ function UO(t) { return Bl(`0x${e}`); } async function qO({ hash: t, signature: e }) { - const r = va(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-C2LQAh0i.js"); + const r = va(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-CNxaHocU.js"); return `0x${(() => { if (typeof e == "object" && "r" in e && "s" in e) { - const { r: l, s: d, v: p, yParity: w } = e, A = Number(w ?? p), M = I2(A); + const { r: l, s: d, v: p, yParity: w } = e, A = Number(w ?? p), M = C2(A); return new n.Signature(el(l), el(d)).addRecoveryBit(M); } - const o = va(e) ? e : zd(e), a = bu(`0x${o.slice(130)}`), u = I2(a); + const o = va(e) ? e : zd(e), a = bu(`0x${o.slice(130)}`), u = C2(a); return n.Signature.fromCompact(o.substring(2, 130)).addRecoveryBit(u); })().recoverPublicKey(r.substring(2)).toHex(!1)}`; } -function I2(t) { +function C2(t) { if (t === 0 || t === 1) return t; if (t === 27) @@ -2873,14 +2873,14 @@ async function zO({ hash: t, signature: e }) { return UO(await qO({ hash: t, signature: e })); } function WO(t, e = "hex") { - const r = G5(t), n = Iv(new Uint8Array(r.length)); + const r = Y5(t), n = Cv(new Uint8Array(r.length)); return r.encode(n), e === "hex" ? xi(n.bytes) : n.bytes; } -function G5(t) { - return Array.isArray(t) ? HO(t.map((e) => G5(e))) : KO(t); +function Y5(t) { + return Array.isArray(t) ? HO(t.map((e) => Y5(e))) : KO(t); } function HO(t) { - const e = t.reduce((i, s) => i + s.length, 0), r = Y5(e); + const e = t.reduce((i, s) => i + s.length, 0), r = J5(e); return { length: e <= 55 ? 1 + e : 1 + r + e, encode(i) { @@ -2891,7 +2891,7 @@ function HO(t) { }; } function KO(t) { - const e = typeof t == "string" ? Lo(t) : t, r = Y5(e.length); + const e = typeof t == "string" ? Lo(t) : t, r = J5(e.length); return { length: e.length === 1 && e[0] < 128 ? 1 : e.length <= 55 ? 1 + e.length : 1 + r + e.length, encode(i) { @@ -2899,7 +2899,7 @@ function KO(t) { } }; } -function Y5(t) { +function J5(t) { if (t < 2 ** 8) return 1; if (t < 2 ** 16) @@ -2921,7 +2921,7 @@ function VO(t) { ])); return i === "bytes" ? Lo(s) : s; } -async function J5(t) { +async function X5(t) { const { authorization: e, signature: r } = t; return zO({ hash: VO(e), @@ -2934,7 +2934,7 @@ class GO extends yt { const A = D0({ from: r == null ? void 0 : r.address, to: p, - value: typeof w < "u" && `${H5(w)} ${((M = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : M.symbol) || "ETH"}`, + value: typeof w < "u" && `${K5(w)} ${((M = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : M.symbol) || "ETH"}`, data: s, gas: o, gasPrice: typeof a < "u" && `${Es(a)} gwei`, @@ -3132,7 +3132,7 @@ Object.defineProperty(Gd, "nodeMessage", { writable: !0, value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/ }); -class Cv extends yt { +class Tv extends yt { constructor({ cause: e }) { super(`An error occurred while executing: ${e == null ? void 0 : e.shortMessage}`, { cause: e, @@ -3140,7 +3140,7 @@ class Cv extends yt { }); } } -function X5(t, e) { +function Z5(t, e) { const r = (t.details || "").toLowerCase(), n = t instanceof yt ? t.walk((i) => (i == null ? void 0 : i.code) === Zc.code) : t; return n instanceof yt ? new Zc({ cause: t, @@ -3158,21 +3158,21 @@ function X5(t, e) { cause: t, maxFeePerGas: e == null ? void 0 : e.maxFeePerGas, maxPriorityFeePerGas: e == null ? void 0 : e.maxPriorityFeePerGas - }) : new Cv({ + }) : new Tv({ cause: t }); } function YO(t, { docsPath: e, ...r }) { const n = (() => { - const i = X5(t, r); - return i instanceof Cv ? t : i; + const i = Z5(t, r); + return i instanceof Tv ? t : i; })(); return new GO(n, { docsPath: e, ...r }); } -function Z5(t, { format: e }) { +function Q5(t, { format: e }) { if (!e) return {}; const r = {}; @@ -3191,7 +3191,7 @@ const JO = { eip4844: "0x3", eip7702: "0x4" }; -function Tv(t) { +function Rv(t) { const e = {}; return typeof t.authorizationList < "u" && (e.authorizationList = XO(t.authorizationList)), typeof t.accessList < "u" && (e.accessList = t.accessList), typeof t.blobVersionedHashes < "u" && (e.blobVersionedHashes = t.blobVersionedHashes), typeof t.blobs < "u" && (typeof t.blobs[0] != "string" ? e.blobs = t.blobs.map((r) => xi(r)) : e.blobs = t.blobs), typeof t.data < "u" && (e.data = t.data), typeof t.from < "u" && (e.from = t.from), typeof t.gas < "u" && (e.gas = Mr(t.gas)), typeof t.gasPrice < "u" && (e.gasPrice = Mr(t.gasPrice)), typeof t.maxFeePerBlobGas < "u" && (e.maxFeePerBlobGas = Mr(t.maxFeePerBlobGas)), typeof t.maxFeePerGas < "u" && (e.maxFeePerGas = Mr(t.maxFeePerGas)), typeof t.maxPriorityFeePerGas < "u" && (e.maxPriorityFeePerGas = Mr(t.maxPriorityFeePerGas)), typeof t.nonce < "u" && (e.nonce = Mr(t.nonce)), typeof t.to < "u" && (e.to = t.to), typeof t.type < "u" && (e.type = JO[t.type]), typeof t.value < "u" && (e.value = Mr(t.value)), e; } @@ -3206,17 +3206,17 @@ function XO(t) { ...typeof e.v < "u" && typeof e.yParity > "u" ? { v: Mr(e.v) } : {} })); } -function C2(t) { +function T2(t) { if (!(!t || t.length === 0)) return t.reduce((e, { slot: r, value: n }) => { if (r.length !== 66) - throw new b2({ + throw new y2({ size: r.length, targetSize: 66, type: "hex" }); if (n.length !== 66) - throw new b2({ + throw new y2({ size: n.length, targetSize: 66, type: "hex" @@ -3226,10 +3226,10 @@ function C2(t) { } function ZO(t) { const { balance: e, nonce: r, state: n, stateDiff: i, code: s } = t, o = {}; - if (s !== void 0 && (o.code = s), e !== void 0 && (o.balance = Mr(e)), r !== void 0 && (o.nonce = Mr(r)), n !== void 0 && (o.state = C2(n)), i !== void 0) { + if (s !== void 0 && (o.code = s), e !== void 0 && (o.balance = Mr(e)), r !== void 0 && (o.nonce = Mr(r)), n !== void 0 && (o.state = T2(n)), i !== void 0) { if (o.state) throw new MO(); - o.stateDiff = C2(i); + o.stateDiff = T2(i); } return o; } @@ -3267,7 +3267,7 @@ class tN extends yt { }); } } -class Rv extends yt { +class Dv extends yt { constructor() { super("Chain does not support EIP-1559 fees.", { name: "Eip1559FeesNotSupportedError" @@ -3368,7 +3368,7 @@ async function Yd(t, { blockHash: e, blockNumber: r, blockTag: n, includeTransac throw new nN({ blockHash: e, blockNumber: r }); return (((w = (p = (d = t.chain) == null ? void 0 : d.formatters) == null ? void 0 : p.block) == null ? void 0 : w.format) || aN)(u); } -async function Q5(t) { +async function e4(t) { const e = await t.request({ method: "eth_gasPrice" }); @@ -3398,15 +3398,15 @@ async function cN(t, e) { } catch { const [a, u] = await Promise.all([ r ? Promise.resolve(r) : bi(t, Yd, "getBlock")({}), - bi(t, Q5, "getGasPrice")({}) + bi(t, e4, "getGasPrice")({}) ]); if (typeof a.baseFeePerGas != "bigint") - throw new Rv(); + throw new Dv(); const l = u - a.baseFeePerGas; return l < 0n ? 0n : l; } } -async function T2(t, e) { +async function R2(t, e) { var w, A; const { block: r, chain: n = t.chain, request: i, type: s = "eip1559" } = e || {}, o = await (async () => { var M, N; @@ -3432,7 +3432,7 @@ async function T2(t, e) { } if (s === "eip1559") { if (typeof d.baseFeePerGas != "bigint") - throw new Rv(); + throw new Dv(); const M = typeof (i == null ? void 0 : i.maxPriorityFeePerGas) == "bigint" ? i.maxPriorityFeePerGas : await cN(t, { block: d, chain: n, @@ -3444,7 +3444,7 @@ async function T2(t, e) { }; } return { - gasPrice: (i == null ? void 0 : i.gasPrice) ?? l(await bi(t, Q5, "getGasPrice")({})) + gasPrice: (i == null ? void 0 : i.gasPrice) ?? l(await bi(t, e4, "getGasPrice")({})) }; } async function uN(t, { address: e, blockTag: r = "latest", blockNumber: n }) { @@ -3454,13 +3454,13 @@ async function uN(t, { address: e, blockTag: r = "latest", blockNumber: n }) { }, { dedupe: !!n }); return bu(i); } -function e4(t) { +function t4(t) { const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((s) => Lo(s)) : t.blobs, i = []; for (const s of n) i.push(Uint8Array.from(e.blobToKzgCommitment(s))); return r === "bytes" ? i : i.map((s) => xi(s)); } -function t4(t) { +function r4(t) { const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((o) => Lo(o)) : t.blobs, i = typeof t.commitments[0] == "string" ? t.commitments.map((o) => Lo(o)) : t.commitments, s = []; for (let o = 0; o < n.length; o++) { const a = n[o], u = i[o]; @@ -3475,7 +3475,7 @@ function fN(t, e, r, n) { t.setUint32(e + u, o, n), t.setUint32(e + l, a, n); } const lN = (t, e, r) => t & e ^ ~t & r, hN = (t, e, r) => t & e ^ t & r ^ e & r; -class dN extends I5 { +class dN extends C5 { constructor(e, r, n, i) { super(), this.blockLen = e, this.outputLen = r, this.padOffset = n, this.isLE = i, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(e), this.view = Bg(this.buffer); } @@ -3497,7 +3497,7 @@ class dN extends I5 { return this.length += e.length, this.roundClean(), this; } digestInto(e) { - Hd(this), M5(e, this), this.finished = !0; + Hd(this), I5(e, this), this.finished = !0; const { buffer: r, view: n, blockLen: i, isLE: s } = this; let { pos: o } = this; r[o++] = 128, this.buffer.subarray(o).fill(0), this.padOffset > i - o && (this.process(n, 0), o = 0); @@ -3633,9 +3633,9 @@ let gN = class extends dN { this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0); } }; -const r4 = /* @__PURE__ */ C5(() => new gN()); +const n4 = /* @__PURE__ */ T5(() => new gN()); function mN(t, e) { - return r4(va(t, { strict: !1 }) ? _v(t) : t); + return n4(va(t, { strict: !1 }) ? Ev(t) : t); } function vN(t) { const { commitment: e, version: r = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), i = mN(e); @@ -3651,9 +3651,9 @@ function bN(t) { })); return i; } -const R2 = 6, n4 = 32, Dv = 4096, i4 = n4 * Dv, D2 = i4 * R2 - // terminator byte (0x80). +const D2 = 6, i4 = 32, Ov = 4096, s4 = i4 * Ov, O2 = s4 * D2 - // terminator byte (0x80). 1 - // zero byte (0x00) appended to each field element. -1 * Dv * R2; +1 * Ov * D2; class yN extends yt { constructor({ maxSize: e, size: r }) { super("Blob size is too large.", { @@ -3671,18 +3671,18 @@ function xN(t) { const e = t.to ?? (typeof t.data == "string" ? "hex" : "bytes"), r = typeof t.data == "string" ? Lo(t.data) : t.data, n = An(r); if (!n) throw new wN(); - if (n > D2) + if (n > O2) throw new yN({ - maxSize: D2, + maxSize: O2, size: n }); const i = []; let s = !0, o = 0; for (; s; ) { - const a = Iv(new Uint8Array(i4)); + const a = Cv(new Uint8Array(s4)); let u = 0; - for (; u < Dv; ) { - const l = r.slice(o, o + (n4 - 1)); + for (; u < Ov; ) { + const l = r.slice(o, o + (i4 - 1)); if (a.pushByte(0), a.pushBytes(l), l.length < 31) { a.pushByte(128), s = !1; break; @@ -3694,7 +3694,7 @@ function xN(t) { return e === "bytes" ? i.map((a) => a.bytes) : i.map((a) => xi(a.bytes)); } function _N(t) { - const { data: e, kzg: r, to: n } = t, i = t.blobs ?? xN({ data: e, to: n }), s = t.commitments ?? e4({ blobs: i, kzg: r, to: n }), o = t.proofs ?? t4({ blobs: i, commitments: s, kzg: r, to: n }), a = []; + const { data: e, kzg: r, to: n } = t, i = t.blobs ?? xN({ data: e, to: n }), s = t.commitments ?? t4({ blobs: i, kzg: r, to: n }), o = t.proofs ?? r4({ blobs: i, commitments: s, kzg: r, to: n }), a = []; for (let u = 0; u < i.length; u++) a.push({ blob: i[u], @@ -3722,7 +3722,7 @@ async function N0(t) { }, { dedupe: !0 }); return bu(e); } -const s4 = [ +const o4 = [ "blobVersionedHashes", "chainId", "fees", @@ -3730,8 +3730,8 @@ const s4 = [ "nonce", "type" ]; -async function Ov(t, e) { - const { account: r = t.account, blobs: n, chain: i, gas: s, kzg: o, nonce: a, nonceManager: u, parameters: l = s4, type: d } = e, p = r && qo(r), w = { ...e, ...p ? { from: p == null ? void 0 : p.address } : {} }; +async function Nv(t, e) { + const { account: r = t.account, blobs: n, chain: i, gas: s, kzg: o, nonce: a, nonceManager: u, parameters: l = o4, type: d } = e, p = r && qo(r), w = { ...e, ...p ? { from: p == null ? void 0 : p.address } : {} }; let A; async function M() { return A || (A = await bi(t, Yd, "getBlock")({ blockTag: "latest" }), A); @@ -3741,7 +3741,7 @@ async function Ov(t, e) { return N || (i ? i.id : typeof e.chainId < "u" ? e.chainId : (N = await bi(t, N0, "getChainId")({}), N)); } if ((l.includes("blobVersionedHashes") || l.includes("sidecars")) && n && o) { - const B = e4({ blobs: n, kzg: o }); + const B = t4({ blobs: n, kzg: o }); if (l.includes("blobVersionedHashes")) { const $ = bN({ commitments: B, @@ -3750,7 +3750,7 @@ async function Ov(t, e) { w.blobVersionedHashes = $; } if (l.includes("sidecars")) { - const $ = t4({ blobs: n, commitments: B, kzg: o }), H = _N({ + const $ = r4({ blobs: n, commitments: B, kzg: o }), H = _N({ blobs: n, commitments: B, proofs: $, @@ -3782,7 +3782,7 @@ async function Ov(t, e) { if (l.includes("fees")) if (w.type !== "legacy" && w.type !== "eip2930") { if (typeof w.maxFeePerGas > "u" || typeof w.maxPriorityFeePerGas > "u") { - const B = await M(), { maxFeePerGas: $, maxPriorityFeePerGas: H } = await T2(t, { + const B = await M(), { maxFeePerGas: $, maxPriorityFeePerGas: H } = await R2(t, { block: B, chain: i, request: w @@ -3795,8 +3795,8 @@ async function Ov(t, e) { } } else { if (typeof e.maxFeePerGas < "u" || typeof e.maxPriorityFeePerGas < "u") - throw new Rv(); - const B = await M(), { gasPrice: $ } = await T2(t, { + throw new Dv(); + const B = await M(), { gasPrice: $ } = await R2(t, { block: B, chain: i, request: w, @@ -3827,7 +3827,7 @@ async function AN(t, e) { params: E ? [_, x ?? "latest", E] : x ? [_, x] : [_] }); }; - const { accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, blockNumber: p, blockTag: w, data: A, gas: M, gasPrice: N, maxFeePerBlobGas: L, maxFeePerGas: B, maxPriorityFeePerGas: $, nonce: H, value: W, stateOverride: V, ...te } = await Ov(t, { + const { accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, blockNumber: p, blockTag: w, data: A, gas: M, gasPrice: N, maxFeePerBlobGas: L, maxFeePerGas: B, maxPriorityFeePerGas: $, nonce: H, value: W, stateOverride: V, ...te } = await Nv(t, { ...e, parameters: ( // Some RPC Providers do not compute versioned hashes from blobs. We will need @@ -3838,16 +3838,16 @@ async function AN(t, e) { if (te.to) return te.to; if (u && u.length > 0) - return await J5({ + return await X5({ authorization: u[0] }).catch(() => { throw new yt("`to` is required. Could not infer from `authorizationList`"); }); })(); O0(e); - const Y = (o = (s = (i = t.chain) == null ? void 0 : i.formatters) == null ? void 0 : s.transactionRequest) == null ? void 0 : o.format, m = (Y || Tv)({ + const Y = (o = (s = (i = t.chain) == null ? void 0 : i.formatters) == null ? void 0 : s.transactionRequest) == null ? void 0 : o.format, m = (Y || Rv)({ // Pick out extra data that might exist on the chain's transaction request type. - ...Z5(te, { format: Y }), + ...Q5(te, { format: Y }), from: n == null ? void 0 : n.address, accessList: a, authorizationList: u, @@ -3921,10 +3921,10 @@ function IN(t) { if (!i) throw new KR({ docsPath: Ug }); if (!("inputs" in i)) - throw new m2({ docsPath: Ug }); + throw new v2({ docsPath: Ug }); if (!i.inputs || i.inputs.length === 0) - throw new m2({ docsPath: Ug }); - const s = j5(i.inputs, r); + throw new v2({ docsPath: Ug }); + const s = U5(i.inputs, r); return R0([n, s]); } async function CN(t) { @@ -3952,7 +3952,7 @@ class qg extends yt { }); } } -function o4({ chain: t, currentChainId: e }) { +function a4({ chain: t, currentChainId: e }) { if (!t) throw new MN(); if (e !== t.id) @@ -3960,22 +3960,22 @@ function o4({ chain: t, currentChainId: e }) { } function TN(t, { docsPath: e, ...r }) { const n = (() => { - const i = X5(t, r); - return i instanceof Cv ? t : i; + const i = Z5(t, r); + return i instanceof Tv ? t : i; })(); return new TO(n, { docsPath: e, ...r }); } -async function a4(t, { serializedTransaction: e }) { +async function c4(t, { serializedTransaction: e }) { return t.request({ method: "eth_sendRawTransaction", params: [e] }, { retryCount: 0 }); } const zg = new T0(128); -async function Nv(t, e) { +async function Lv(t, e) { var B, $, H, W; const { account: r = t.account, chain: n = t.chain, accessList: i, authorizationList: s, blobs: o, data: a, gas: u, gasPrice: l, maxFeePerBlobGas: d, maxFeePerGas: p, maxPriorityFeePerGas: w, nonce: A, value: M, ...N } = e; if (typeof r > "u") @@ -3989,7 +3989,7 @@ async function Nv(t, e) { if (e.to) return e.to; if (s && s.length > 0) - return await J5({ + return await X5({ authorization: s[0] }).catch(() => { throw new yt("`to` is required. Could not infer from `authorizationList`."); @@ -3997,13 +3997,13 @@ async function Nv(t, e) { })(); if ((L == null ? void 0 : L.type) === "json-rpc" || L === null) { let te; - n !== null && (te = await bi(t, N0, "getChainId")({}), o4({ + n !== null && (te = await bi(t, N0, "getChainId")({}), a4({ currentChainId: te, chain: n })); - const R = (H = ($ = (B = t.chain) == null ? void 0 : B.formatters) == null ? void 0 : $.transactionRequest) == null ? void 0 : H.format, ge = (R || Tv)({ + const R = (H = ($ = (B = t.chain) == null ? void 0 : B.formatters) == null ? void 0 : $.transactionRequest) == null ? void 0 : H.format, ge = (R || Rv)({ // Pick out extra data that might exist on the chain's transaction request type. - ...Z5(N, { format: R }), + ...Q5(N, { format: R }), accessList: i, authorizationList: s, blobs: o, @@ -4040,7 +4040,7 @@ async function Nv(t, e) { } } if ((L == null ? void 0 : L.type) === "local") { - const te = await bi(t, Ov, "prepareTransactionRequest")({ + const te = await bi(t, Nv, "prepareTransactionRequest")({ account: L, accessList: i, authorizationList: s, @@ -4054,14 +4054,14 @@ async function Nv(t, e) { maxPriorityFeePerGas: w, nonce: A, nonceManager: L.nonceManager, - parameters: [...s4, "sidecars"], + parameters: [...o4, "sidecars"], value: M, ...N, to: V }), R = (W = n == null ? void 0 : n.serializers) == null ? void 0 : W.transaction, K = await L.signTransaction(te, { serializer: R }); - return await bi(t, a4, "sendRawTransaction")({ + return await bi(t, c4, "sendRawTransaction")({ serializedTransaction: K }); } @@ -4095,7 +4095,7 @@ async function RN(t, e) { functionName: a }); try { - return await bi(t, Nv, "sendTransaction")({ + return await bi(t, Lv, "sendTransaction")({ data: `${d}${o ? o.replace("0x", "") : ""}`, to: i, account: l, @@ -4129,7 +4129,7 @@ async function DN(t, { chain: e }) { } const a1 = 256; let nd = a1, id; -function c4(t = 11) { +function u4(t = 11) { if (!id || nd + t > a1 * 2) { id = "", nd = 0; for (let e = 0; e < a1; e++) @@ -4153,7 +4153,7 @@ function ON(t) { request: p, transport: A, type: a, - uid: c4() + uid: u4() }; function N(L) { return (B) => { @@ -4253,7 +4253,7 @@ function kN(t, e = {}) { }, { delay: ({ count: l, error: d }) => { var p; - if (d && d instanceof V5) { + if (d && d instanceof G5) { const w = (p = d == null ? void 0 : d.headers) == null ? void 0 : p.get("Retry-After"); if (w != null && w.match(/\d/)) return Number.parseInt(w) * 1e3; @@ -4266,10 +4266,10 @@ function kN(t, e = {}) { }; } function $N(t) { - return "code" in t && typeof t.code == "number" ? t.code === -1 || t.code === xu.code || t.code === uc.code : t instanceof V5 && t.status ? t.status === 403 || t.status === 408 || t.status === 413 || t.status === 429 || t.status === 500 || t.status === 502 || t.status === 503 || t.status === 504 : !0; + return "code" in t && typeof t.code == "number" ? t.code === -1 || t.code === xu.code || t.code === uc.code : t instanceof G5 && t.status ? t.status === 403 || t.status === 408 || t.status === 413 || t.status === 429 || t.status === 500 || t.status === 502 || t.status === 503 || t.status === 504 : !0; } function BN({ key: t, name: e, request: r, retryCount: n = 3, retryDelay: i = 150, timeout: s, type: o }, a) { - const u = c4(); + const u = u4(); return { config: { key: t, @@ -4391,7 +4391,7 @@ function GN(t) { } function YN(t, e) { const { abi: r, args: n, bytecode: i, ...s } = e, o = IN({ abi: r, args: n, bytecode: i }); - return Nv(t, { + return Lv(t, { ...s, data: o }); @@ -4404,7 +4404,7 @@ async function XN(t) { return await t.request({ method: "wallet_getPermissions" }, { dedupe: !0 }); } async function ZN(t) { - return (await t.request({ method: "eth_requestAccounts" }, { dedupe: !0, retryCount: 0 })).map((r) => Ev(r)); + return (await t.request({ method: "eth_requestAccounts" }, { dedupe: !0, retryCount: 0 })).map((r) => Sv(r)); } async function QN(t, e) { return t.request({ @@ -4439,11 +4439,11 @@ async function tL(t, e) { ...e }); const o = await bi(t, N0, "getChainId")({}); - n !== null && o4({ + n !== null && a4({ currentChainId: o, chain: n }); - const a = (n == null ? void 0 : n.formatters) || ((l = t.chain) == null ? void 0 : l.formatters), u = ((d = a == null ? void 0 : a.transactionRequest) == null ? void 0 : d.format) || Tv; + const a = (n == null ? void 0 : n.formatters) || ((l = t.chain) == null ? void 0 : l.formatters), u = ((d = a == null ? void 0 : a.transactionRequest) == null ? void 0 : d.format) || Rv; return s.signTransaction ? s.signTransaction({ ...i, chainId: o @@ -4499,11 +4499,11 @@ function sL(t) { getAddresses: () => JN(t), getChainId: () => N0(t), getPermissions: () => XN(t), - prepareTransactionRequest: (e) => Ov(t, e), + prepareTransactionRequest: (e) => Nv(t, e), requestAddresses: () => ZN(t), requestPermissions: (e) => QN(t, e), - sendRawTransaction: (e) => a4(t, e), - sendTransaction: (e) => Nv(t, e), + sendRawTransaction: (e) => c4(t, e), + sendTransaction: (e) => Lv(t, e), signMessage: (e) => eL(t, e), signTransaction: (e) => tL(t, e), signTypedData: (e) => rL(t, e), @@ -4566,6 +4566,9 @@ class vl { get installed() { return this._installed; } + get provider() { + return this._provider; + } get client() { return this._provider ? oL({ transport: FN(this._provider) }) : null; } @@ -4614,7 +4617,7 @@ class vl { this._provider && "session" in this._provider && await this._provider.disconnect(), this._connected = !1, this._address = null; } } -var Lv = { exports: {} }, uu = typeof Reflect == "object" ? Reflect : null, O2 = uu && typeof uu.apply == "function" ? uu.apply : function(e, r, n) { +var kv = { exports: {} }, uu = typeof Reflect == "object" ? Reflect : null, N2 = uu && typeof uu.apply == "function" ? uu.apply : function(e, r, n) { return Function.prototype.apply.call(e, r, n); }, xd; uu && typeof uu.ownKeys == "function" ? xd = uu.ownKeys : Object.getOwnPropertySymbols ? xd = function(e) { @@ -4625,19 +4628,19 @@ uu && typeof uu.ownKeys == "function" ? xd = uu.ownKeys : Object.getOwnPropertyS function aL(t) { console && console.warn && console.warn(t); } -var u4 = Number.isNaN || function(e) { +var f4 = Number.isNaN || function(e) { return e !== e; }; function kr() { kr.init.call(this); } -Lv.exports = kr; -Lv.exports.once = lL; +kv.exports = kr; +kv.exports.once = lL; kr.EventEmitter = kr; kr.prototype._events = void 0; kr.prototype._eventsCount = 0; kr.prototype._maxListeners = void 0; -var N2 = 10; +var L2 = 10; function L0(t) { if (typeof t != "function") throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof t); @@ -4645,27 +4648,27 @@ function L0(t) { Object.defineProperty(kr, "defaultMaxListeners", { enumerable: !0, get: function() { - return N2; + return L2; }, set: function(t) { - if (typeof t != "number" || t < 0 || u4(t)) + if (typeof t != "number" || t < 0 || f4(t)) throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + t + "."); - N2 = t; + L2 = t; } }); kr.init = function() { (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0; }; kr.prototype.setMaxListeners = function(e) { - if (typeof e != "number" || e < 0 || u4(e)) + if (typeof e != "number" || e < 0 || f4(e)) throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + "."); return this._maxListeners = e, this; }; -function f4(t) { +function l4(t) { return t._maxListeners === void 0 ? kr.defaultMaxListeners : t._maxListeners; } kr.prototype.getMaxListeners = function() { - return f4(this); + return l4(this); }; kr.prototype.emit = function(e) { for (var r = [], n = 1; n < arguments.length; n++) r.push(arguments[n]); @@ -4685,13 +4688,13 @@ kr.prototype.emit = function(e) { if (u === void 0) return !1; if (typeof u == "function") - O2(u, this, r); + N2(u, this, r); else - for (var l = u.length, d = g4(u, l), n = 0; n < l; ++n) - O2(d[n], this, r); + for (var l = u.length, d = m4(u, l), n = 0; n < l; ++n) + N2(d[n], this, r); return !0; }; -function l4(t, e, r, n) { +function h4(t, e, r, n) { var i, s, o; if (L0(r), s = t._events, s === void 0 ? (s = t._events = /* @__PURE__ */ Object.create(null), t._eventsCount = 0) : (s.newListener !== void 0 && (t.emit( "newListener", @@ -4699,7 +4702,7 @@ function l4(t, e, r, n) { r.listener ? r.listener : r ), s = t._events), o = s[e]), o === void 0) o = s[e] = r, ++t._eventsCount; - else if (typeof o == "function" ? o = s[e] = n ? [r, o] : [o, r] : n ? o.unshift(r) : o.push(r), i = f4(t), i > 0 && o.length > i && !o.warned) { + else if (typeof o == "function" ? o = s[e] = n ? [r, o] : [o, r] : n ? o.unshift(r) : o.push(r), i = l4(t), i > 0 && o.length > i && !o.warned) { o.warned = !0; var a = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit"); a.name = "MaxListenersExceededWarning", a.emitter = t, a.type = e, a.count = o.length, aL(a); @@ -4707,25 +4710,25 @@ function l4(t, e, r, n) { return t; } kr.prototype.addListener = function(e, r) { - return l4(this, e, r, !1); + return h4(this, e, r, !1); }; kr.prototype.on = kr.prototype.addListener; kr.prototype.prependListener = function(e, r) { - return l4(this, e, r, !0); + return h4(this, e, r, !0); }; function cL() { if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments); } -function h4(t, e, r) { +function d4(t, e, r) { var n = { fired: !1, wrapFn: void 0, target: t, type: e, listener: r }, i = cL.bind(n); return i.listener = r, n.wrapFn = i, i; } kr.prototype.once = function(e, r) { - return L0(r), this.on(e, h4(this, e, r)), this; + return L0(r), this.on(e, d4(this, e, r)), this; }; kr.prototype.prependOnceListener = function(e, r) { - return L0(r), this.prependListener(e, h4(this, e, r)), this; + return L0(r), this.prependListener(e, d4(this, e, r)), this; }; kr.prototype.removeListener = function(e, r) { var n, i, s, o, a; @@ -4767,24 +4770,24 @@ kr.prototype.removeAllListeners = function(e) { this.removeListener(e, r[i]); return this; }; -function d4(t, e, r) { +function p4(t, e, r) { var n = t._events; if (n === void 0) return []; var i = n[e]; - return i === void 0 ? [] : typeof i == "function" ? r ? [i.listener || i] : [i] : r ? fL(i) : g4(i, i.length); + return i === void 0 ? [] : typeof i == "function" ? r ? [i.listener || i] : [i] : r ? fL(i) : m4(i, i.length); } kr.prototype.listeners = function(e) { - return d4(this, e, !0); + return p4(this, e, !0); }; kr.prototype.rawListeners = function(e) { - return d4(this, e, !1); + return p4(this, e, !1); }; kr.listenerCount = function(t, e) { - return typeof t.listenerCount == "function" ? t.listenerCount(e) : p4.call(t, e); + return typeof t.listenerCount == "function" ? t.listenerCount(e) : g4.call(t, e); }; -kr.prototype.listenerCount = p4; -function p4(t) { +kr.prototype.listenerCount = g4; +function g4(t) { var e = this._events; if (e !== void 0) { var r = e[t]; @@ -4798,7 +4801,7 @@ function p4(t) { kr.prototype.eventNames = function() { return this._eventsCount > 0 ? xd(this._events) : []; }; -function g4(t, e) { +function m4(t, e) { for (var r = new Array(e), n = 0; n < e; ++n) r[n] = t[n]; return r; @@ -4821,13 +4824,13 @@ function lL(t, e) { function s() { typeof t.removeListener == "function" && t.removeListener("error", i), r([].slice.call(arguments)); } - m4(t, e, s, { once: !0 }), e !== "error" && hL(t, i, { once: !0 }); + v4(t, e, s, { once: !0 }), e !== "error" && hL(t, i, { once: !0 }); }); } function hL(t, e, r) { - typeof t.on == "function" && m4(t, "error", e, r); + typeof t.on == "function" && v4(t, "error", e, r); } -function m4(t, e, r, n) { +function v4(t, e, r, n) { if (typeof t.on == "function") n.once ? t.once(e, r) : t.on(e, r); else if (typeof t.addEventListener == "function") @@ -4837,8 +4840,8 @@ function m4(t, e, r, n) { else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof t); } -var rs = Lv.exports; -const kv = /* @__PURE__ */ ts(rs); +var rs = kv.exports; +const $v = /* @__PURE__ */ ts(rs); var mt = {}; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. @@ -5002,7 +5005,7 @@ function f1(t) { }; throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined."); } -function v4(t, e) { +function b4(t, e) { var r = typeof Symbol == "function" && t[Symbol.iterator]; if (!r) return t; var n = r.call(t), i, s = [], o; @@ -5021,7 +5024,7 @@ function v4(t, e) { } function _L() { for (var t = [], e = 0; e < arguments.length; e++) - t = t.concat(v4(arguments[e])); + t = t.concat(b4(arguments[e])); return t; } function EL() { @@ -5143,16 +5146,16 @@ const DL = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __makeTemplateObject: ML, __metadata: vL, __param: mL, - __read: v4, + __read: b4, __rest: pL, __spread: _L, __spreadArrays: EL, __values: f1 -}, Symbol.toStringTag, { value: "Module" })), jl = /* @__PURE__ */ bv(DL); -var Wg = {}, wf = {}, L2; +}, Symbol.toStringTag, { value: "Module" })), jl = /* @__PURE__ */ yv(DL); +var Wg = {}, wf = {}, k2; function OL() { - if (L2) return wf; - L2 = 1, Object.defineProperty(wf, "__esModule", { value: !0 }), wf.delay = void 0; + if (k2) return wf; + k2 = 1, Object.defineProperty(wf, "__esModule", { value: !0 }), wf.delay = void 0; function t(e) { return new Promise((r) => { setTimeout(() => { @@ -5162,29 +5165,29 @@ function OL() { } return wf.delay = t, wf; } -var qa = {}, Hg = {}, za = {}, k2; +var qa = {}, Hg = {}, za = {}, $2; function NL() { - return k2 || (k2 = 1, Object.defineProperty(za, "__esModule", { value: !0 }), za.ONE_THOUSAND = za.ONE_HUNDRED = void 0, za.ONE_HUNDRED = 100, za.ONE_THOUSAND = 1e3), za; + return $2 || ($2 = 1, Object.defineProperty(za, "__esModule", { value: !0 }), za.ONE_THOUSAND = za.ONE_HUNDRED = void 0, za.ONE_HUNDRED = 100, za.ONE_THOUSAND = 1e3), za; } -var Kg = {}, $2; +var Kg = {}, B2; function LL() { - return $2 || ($2 = 1, function(t) { + return B2 || (B2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.ONE_YEAR = t.FOUR_WEEKS = t.THREE_WEEKS = t.TWO_WEEKS = t.ONE_WEEK = t.THIRTY_DAYS = t.SEVEN_DAYS = t.FIVE_DAYS = t.THREE_DAYS = t.ONE_DAY = t.TWENTY_FOUR_HOURS = t.TWELVE_HOURS = t.SIX_HOURS = t.THREE_HOURS = t.ONE_HOUR = t.SIXTY_MINUTES = t.THIRTY_MINUTES = t.TEN_MINUTES = t.FIVE_MINUTES = t.ONE_MINUTE = t.SIXTY_SECONDS = t.THIRTY_SECONDS = t.TEN_SECONDS = t.FIVE_SECONDS = t.ONE_SECOND = void 0, t.ONE_SECOND = 1, t.FIVE_SECONDS = 5, t.TEN_SECONDS = 10, t.THIRTY_SECONDS = 30, t.SIXTY_SECONDS = 60, t.ONE_MINUTE = t.SIXTY_SECONDS, t.FIVE_MINUTES = t.ONE_MINUTE * 5, t.TEN_MINUTES = t.ONE_MINUTE * 10, t.THIRTY_MINUTES = t.ONE_MINUTE * 30, t.SIXTY_MINUTES = t.ONE_MINUTE * 60, t.ONE_HOUR = t.SIXTY_MINUTES, t.THREE_HOURS = t.ONE_HOUR * 3, t.SIX_HOURS = t.ONE_HOUR * 6, t.TWELVE_HOURS = t.ONE_HOUR * 12, t.TWENTY_FOUR_HOURS = t.ONE_HOUR * 24, t.ONE_DAY = t.TWENTY_FOUR_HOURS, t.THREE_DAYS = t.ONE_DAY * 3, t.FIVE_DAYS = t.ONE_DAY * 5, t.SEVEN_DAYS = t.ONE_DAY * 7, t.THIRTY_DAYS = t.ONE_DAY * 30, t.ONE_WEEK = t.SEVEN_DAYS, t.TWO_WEEKS = t.ONE_WEEK * 2, t.THREE_WEEKS = t.ONE_WEEK * 3, t.FOUR_WEEKS = t.ONE_WEEK * 4, t.ONE_YEAR = t.ONE_DAY * 365; }(Kg)), Kg; } -var B2; -function b4() { - return B2 || (B2 = 1, function(t) { +var F2; +function y4() { + return F2 || (F2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); const e = jl; e.__exportStar(NL(), t), e.__exportStar(LL(), t); }(Hg)), Hg; } -var F2; +var j2; function kL() { - if (F2) return qa; - F2 = 1, Object.defineProperty(qa, "__esModule", { value: !0 }), qa.fromMiliseconds = qa.toMiliseconds = void 0; - const t = b4(); + if (j2) return qa; + j2 = 1, Object.defineProperty(qa, "__esModule", { value: !0 }), qa.fromMiliseconds = qa.toMiliseconds = void 0; + const t = y4(); function e(n) { return n * t.ONE_THOUSAND; } @@ -5194,18 +5197,18 @@ function kL() { } return qa.fromMiliseconds = r, qa; } -var j2; +var U2; function $L() { - return j2 || (j2 = 1, function(t) { + return U2 || (U2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); const e = jl; e.__exportStar(OL(), t), e.__exportStar(kL(), t); }(Wg)), Wg; } -var zc = {}, U2; +var zc = {}, q2; function BL() { - if (U2) return zc; - U2 = 1, Object.defineProperty(zc, "__esModule", { value: !0 }), zc.Watch = void 0; + if (q2) return zc; + q2 = 1, Object.defineProperty(zc, "__esModule", { value: !0 }), zc.Watch = void 0; class t { constructor() { this.timestamps = /* @__PURE__ */ new Map(); @@ -5235,24 +5238,24 @@ function BL() { } return zc.Watch = t, zc.default = t, zc; } -var Vg = {}, xf = {}, q2; +var Vg = {}, xf = {}, z2; function FL() { - if (q2) return xf; - q2 = 1, Object.defineProperty(xf, "__esModule", { value: !0 }), xf.IWatch = void 0; + if (z2) return xf; + z2 = 1, Object.defineProperty(xf, "__esModule", { value: !0 }), xf.IWatch = void 0; class t { } return xf.IWatch = t, xf; } -var z2; +var W2; function jL() { - return z2 || (z2 = 1, function(t) { + return W2 || (W2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), jl.__exportStar(FL(), t); }(Vg)), Vg; } (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); const e = jl; - e.__exportStar($L(), t), e.__exportStar(BL(), t), e.__exportStar(jL(), t), e.__exportStar(b4(), t); + e.__exportStar($L(), t), e.__exportStar(BL(), t), e.__exportStar(jL(), t), e.__exportStar(y4(), t); })(mt); class vc { } @@ -5261,13 +5264,13 @@ let UL = class extends vc { super(); } }; -const W2 = mt.FIVE_SECONDS, Ou = { pulse: "heartbeat_pulse" }; -let qL = class y4 extends UL { +const H2 = mt.FIVE_SECONDS, Ou = { pulse: "heartbeat_pulse" }; +let qL = class w4 extends UL { constructor(e) { - super(e), this.events = new rs.EventEmitter(), this.interval = W2, this.interval = (e == null ? void 0 : e.interval) || W2; + super(e), this.events = new rs.EventEmitter(), this.interval = H2, this.interval = (e == null ? void 0 : e.interval) || H2; } static async init(e) { - const r = new y4(e); + const r = new w4(e); return await r.init(), r; } async init() { @@ -5377,7 +5380,7 @@ function _d(t) { return _d(t.toJSON()); throw new Error("[unstorage] Cannot stringify value!"); } -function w4() { +function x4() { if (typeof Buffer > "u") throw new TypeError("[unstorage] Buffer is not supported!"); } @@ -5385,12 +5388,12 @@ const l1 = "base64:"; function XL(t) { if (typeof t == "string") return t; - w4(); + x4(); const e = Buffer.from(t).toString("base64"); return l1 + e; } function ZL(t) { - return typeof t != "string" || !t.startsWith(l1) ? t : (w4(), Buffer.from(t.slice(l1.length), "base64")); + return typeof t != "string" || !t.startsWith(l1) ? t : (x4(), Buffer.from(t.slice(l1.length), "base64")); } function pi(t) { return t ? t.split("?")[0].replace(/[/\\]/g, ":").replace(/:+/g, ":").replace(/^:|:$/g, "") : ""; @@ -5471,7 +5474,7 @@ function rk(t = {}) { if (!e.watching) { e.watching = !0; for (const l in e.mounts) - e.unwatch[l] = await H2( + e.unwatch[l] = await K2( e.mounts[l], i, l @@ -5658,7 +5661,7 @@ function rk(t = {}) { }, async dispose() { await Promise.all( - Object.values(e.mounts).map((l) => K2(l)) + Object.values(e.mounts).map((l) => V2(l)) ); }, async watch(l) { @@ -5675,12 +5678,12 @@ function rk(t = {}) { mount(l, d) { if (l = ad(l), l && e.mounts[l]) throw new Error(`already mounted at ${l}`); - return l && (e.mountpoints.push(l), e.mountpoints.sort((p, w) => w.length - p.length)), e.mounts[l] = d, e.watching && Promise.resolve(H2(d, i, l)).then((p) => { + return l && (e.mountpoints.push(l), e.mountpoints.sort((p, w) => w.length - p.length)), e.mounts[l] = d, e.watching && Promise.resolve(K2(d, i, l)).then((p) => { e.unwatch[l] = p; }).catch(console.error), u; }, async unmount(l, d = !0) { - l = ad(l), !(!l || !e.mounts[l]) && (e.watching && l in e.unwatch && (e.unwatch[l](), delete e.unwatch[l]), d && await K2(e.mounts[l]), e.mountpoints = e.mountpoints.filter((p) => p !== l), delete e.mounts[l]); + l = ad(l), !(!l || !e.mounts[l]) && (e.watching && l in e.unwatch && (e.unwatch[l](), delete e.unwatch[l]), d && await V2(e.mounts[l]), e.mountpoints = e.mountpoints.filter((p) => p !== l), delete e.mounts[l]); }, getMount(l = "") { l = pi(l) + ":"; @@ -5706,11 +5709,11 @@ function rk(t = {}) { }; return u; } -function H2(t, e, r) { +function K2(t, e, r) { return t.watch ? t.watch((n, i) => e(n, r + i)) : () => { }; } -async function K2(t) { +async function V2(t) { typeof t.dispose == "function" && await Cn(t.dispose); } function bc(t) { @@ -5718,7 +5721,7 @@ function bc(t) { t.oncomplete = t.onsuccess = () => e(t.result), t.onabort = t.onerror = () => r(t.error); }); } -function x4(t, e) { +function _4(t, e) { const r = indexedDB.open(t); r.onupgradeneeded = () => r.result.createObjectStore(e); const n = bc(r); @@ -5726,9 +5729,9 @@ function x4(t, e) { } let Gg; function Ul() { - return Gg || (Gg = x4("keyval-store", "keyval")), Gg; + return Gg || (Gg = _4("keyval-store", "keyval")), Gg; } -function V2(t, e = Ul()) { +function G2(t, e = Ul()) { return e("readonly", (r) => bc(r.get(t))); } function nk(t, e, r = Ul()) { @@ -5773,10 +5776,10 @@ const fk = "idb-keyval"; var lk = (t = {}) => { const e = t.base && t.base.length > 0 ? `${t.base}:` : "", r = (i) => e + i; let n; - return t.dbName && t.storeName && (n = x4(t.dbName, t.storeName)), { name: fk, options: t, async hasItem(i) { - return !(typeof await V2(r(i), n) > "u"); + return t.dbName && t.storeName && (n = _4(t.dbName, t.storeName)), { name: fk, options: t, async hasItem(i) { + return !(typeof await G2(r(i), n) > "u"); }, async getItem(i) { - return await V2(r(i), n) ?? null; + return await G2(r(i), n) ?? null; }, setItem(i, s) { return nk(r(i), s, n); }, removeItem(i) { @@ -5856,9 +5859,9 @@ let mk = class { this.localStorage.removeItem(e); } }; -const vk = "wc_storage_version", G2 = 1, bk = async (t, e, r) => { +const vk = "wc_storage_version", Y2 = 1, bk = async (t, e, r) => { const n = vk, i = await e.getItem(n); - if (i && i >= G2) { + if (i && i >= Y2) { r(e); return; } @@ -5877,7 +5880,7 @@ const vk = "wc_storage_version", G2 = 1, bk = async (t, e, r) => { await e.setItem(a, l), o.push(a); } } - await e.setItem(n, G2), r(e), yk(t, o); + await e.setItem(n, Y2), r(e), yk(t, o); }, yk = async (t, e) => { e.length && e.forEach(async (r) => { await t.removeItem(r); @@ -5986,7 +5989,7 @@ function Ek(t, e, r) { } return p === -1 ? t : (p < w && (l += t.slice(p)), l); } -const Y2 = _k; +const J2 = _k; var Jc = Bo; const yl = Ok().console || {}, Sk = { mapHttpRequest: cd, @@ -6078,7 +6081,7 @@ Bo.levels = { } }; Bo.stdSerializers = Sk; -Bo.stdTimeFunctions = Object.assign({}, { nullTime: _4, epochTime: E4, unixTime: Rk, isoTime: Dk }); +Bo.stdTimeFunctions = Object.assign({}, { nullTime: E4, epochTime: S4, unixTime: Rk, isoTime: Dk }); function Wc(t, e, r, n) { const i = Object.getPrototypeOf(e); e[r] = e.levelVal > e.levels.values[r] ? wl : i[r] ? i[r] : yl[r] || yl[n] || wl, Pk(t, e, r); @@ -6112,8 +6115,8 @@ function Mk(t, e, r, n) { if (a < 1 && (a = 1), s !== null && typeof s == "object") { for (; a-- && typeof i[0] == "object"; ) Object.assign(o, i.shift()); - s = i.length ? Y2(i.shift(), i) : void 0; - } else typeof s == "string" && (s = Y2(i.shift(), i)); + s = i.length ? J2(i.shift(), i) : void 0; + } else typeof s == "string" && (s = J2(i.shift(), i)); return s !== void 0 && (o.msg = s), o; } function k0(t, e, r, n) { @@ -6163,7 +6166,7 @@ function Ck(t) { return e; } function Tk(t) { - return typeof t.timestamp == "function" ? t.timestamp : t.timestamp === !1 ? _4 : E4; + return typeof t.timestamp == "function" ? t.timestamp : t.timestamp === !1 ? E4 : S4; } function cd() { return {}; @@ -6173,10 +6176,10 @@ function Jg(t) { } function wl() { } -function _4() { +function E4() { return !1; } -function E4() { +function S4() { return Date.now(); } function Rk() { @@ -6200,7 +6203,7 @@ function Ok() { return t(self) || t(window) || t(this) || {}; } } -const ql = /* @__PURE__ */ ts(Jc), Nk = { level: "info" }, zl = "custom_context", $v = 1e3 * 1024; +const ql = /* @__PURE__ */ ts(Jc), Nk = { level: "info" }, zl = "custom_context", Bv = 1e3 * 1024; let Lk = class { constructor(e) { this.nodeValue = e, this.sizeInBytes = new TextEncoder().encode(this.nodeValue).length, this.next = null; @@ -6211,7 +6214,7 @@ let Lk = class { get size() { return this.sizeInBytes; } -}, J2 = class { +}, X2 = class { constructor(e) { this.head = null, this.tail = null, this.lengthInNodes = 0, this.maxSizeInBytes = e, this.sizeInBytes = 0; } @@ -6249,9 +6252,9 @@ let Lk = class { return e = e.next, { done: !1, value: r }; } }; } -}, S4 = class { - constructor(e, r = $v) { - this.level = e ?? "error", this.levelValue = Jc.levels.values[this.level], this.MAX_LOG_SIZE_IN_BYTES = r, this.logs = new J2(this.MAX_LOG_SIZE_IN_BYTES); +}, A4 = class { + constructor(e, r = Bv) { + this.level = e ?? "error", this.levelValue = Jc.levels.values[this.level], this.MAX_LOG_SIZE_IN_BYTES = r, this.logs = new X2(this.MAX_LOG_SIZE_IN_BYTES); } forwardToConsole(e, r) { r === Jc.levels.values.error ? console.error(e) : r === Jc.levels.values.warn ? console.warn(e) : r === Jc.levels.values.debug ? console.debug(e) : r === Jc.levels.values.trace ? console.trace(e) : console.log(e); @@ -6265,7 +6268,7 @@ let Lk = class { return this.logs; } clearLogs() { - this.logs = new J2(this.MAX_LOG_SIZE_IN_BYTES); + this.logs = new X2(this.MAX_LOG_SIZE_IN_BYTES); } getLogArray() { return Array.from(this.logs); @@ -6275,8 +6278,8 @@ let Lk = class { return r.push($o({ extraMetadata: e })), new Blob(r, { type: "application/json" }); } }, kk = class { - constructor(e, r = $v) { - this.baseChunkLogger = new S4(e, r); + constructor(e, r = Bv) { + this.baseChunkLogger = new A4(e, r); } write(e) { this.baseChunkLogger.appendToLogs(e); @@ -6298,8 +6301,8 @@ let Lk = class { n.href = r, n.download = `walletconnect-logs-${(/* @__PURE__ */ new Date()).toISOString()}.txt`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(r); } }, $k = class { - constructor(e, r = $v) { - this.baseChunkLogger = new S4(e, r); + constructor(e, r = Bv) { + this.baseChunkLogger = new A4(e, r); } write(e) { this.baseChunkLogger.appendToLogs(e); @@ -6317,9 +6320,9 @@ let Lk = class { return this.baseChunkLogger.logsToBlob(e); } }; -var Bk = Object.defineProperty, Fk = Object.defineProperties, jk = Object.getOwnPropertyDescriptors, X2 = Object.getOwnPropertySymbols, Uk = Object.prototype.hasOwnProperty, qk = Object.prototype.propertyIsEnumerable, Z2 = (t, e, r) => e in t ? Bk(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Jd = (t, e) => { - for (var r in e || (e = {})) Uk.call(e, r) && Z2(t, r, e[r]); - if (X2) for (var r of X2(e)) qk.call(e, r) && Z2(t, r, e[r]); +var Bk = Object.defineProperty, Fk = Object.defineProperties, jk = Object.getOwnPropertyDescriptors, Z2 = Object.getOwnPropertySymbols, Uk = Object.prototype.hasOwnProperty, qk = Object.prototype.propertyIsEnumerable, Q2 = (t, e, r) => e in t ? Bk(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Jd = (t, e) => { + for (var r in e || (e = {})) Uk.call(e, r) && Q2(t, r, e[r]); + if (Z2) for (var r of Z2(e)) qk.call(e, r) && Q2(t, r, e[r]); return t; }, Xd = (t, e) => Fk(t, jk(e)); function $0(t) { @@ -6409,10 +6412,10 @@ let Yk = class extends vc { this.client = e; } }; -var Bv = {}, Pa = {}, B0 = {}, F0 = {}; +var Fv = {}, Pa = {}, B0 = {}, F0 = {}; Object.defineProperty(F0, "__esModule", { value: !0 }); F0.BrowserRandomSource = void 0; -const Q2 = 65536; +const ex = 65536; class c$ { constructor() { this.isAvailable = !1, this.isInstantiated = !1; @@ -6423,13 +6426,13 @@ class c$ { if (!this.isAvailable || !this._crypto) throw new Error("Browser random byte generator is not available."); const r = new Uint8Array(e); - for (let n = 0; n < r.length; n += Q2) - this._crypto.getRandomValues(r.subarray(n, n + Math.min(r.length - n, Q2))); + for (let n = 0; n < r.length; n += ex) + this._crypto.getRandomValues(r.subarray(n, n + Math.min(r.length - n, ex))); return r; } } F0.BrowserRandomSource = c$; -function A4(t) { +function P4(t) { throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } var j0 = {}, ki = {}; @@ -6443,13 +6446,13 @@ ki.wipe = u$; const f$ = {}, l$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: f$ -}, Symbol.toStringTag, { value: "Module" })), Wl = /* @__PURE__ */ bv(l$); +}, Symbol.toStringTag, { value: "Module" })), Wl = /* @__PURE__ */ yv(l$); Object.defineProperty(j0, "__esModule", { value: !0 }); j0.NodeRandomSource = void 0; const h$ = ki; class d$ { constructor() { - if (this.isAvailable = !1, this.isInstantiated = !1, typeof A4 < "u") { + if (this.isAvailable = !1, this.isInstantiated = !1, typeof P4 < "u") { const e = Wl; e && e.randomBytes && (this._crypto = e, this.isAvailable = !0, this.isInstantiated = !0); } @@ -6488,7 +6491,7 @@ class m$ { } } B0.SystemRandomSource = m$; -var ar = {}, P4 = {}; +var ar = {}, M4 = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); function e(a, u) { @@ -6518,9 +6521,9 @@ var ar = {}, P4 = {}; t.isInteger = Number.isInteger || o, t.MAX_SAFE_INTEGER = 9007199254740991, t.isSafeInteger = function(a) { return t.isInteger(a) && a >= -t.MAX_SAFE_INTEGER && a <= t.MAX_SAFE_INTEGER; }; -})(P4); +})(M4); Object.defineProperty(ar, "__esModule", { value: !0 }); -var M4 = P4; +var I4 = M4; function v$(t, e) { return e === void 0 && (e = 0), (t[e + 0] << 8 | t[e + 1]) << 16 >> 16; } @@ -6537,16 +6540,16 @@ function w$(t, e) { return e === void 0 && (e = 0), (t[e + 1] << 8 | t[e]) >>> 0; } ar.readUint16LE = w$; -function I4(t, e, r) { +function C4(t, e, r) { return e === void 0 && (e = new Uint8Array(2)), r === void 0 && (r = 0), e[r + 0] = t >>> 8, e[r + 1] = t >>> 0, e; } -ar.writeUint16BE = I4; -ar.writeInt16BE = I4; -function C4(t, e, r) { +ar.writeUint16BE = C4; +ar.writeInt16BE = C4; +function T4(t, e, r) { return e === void 0 && (e = new Uint8Array(2)), r === void 0 && (r = 0), e[r + 0] = t >>> 0, e[r + 1] = t >>> 8, e; } -ar.writeUint16LE = C4; -ar.writeInt16LE = C4; +ar.writeUint16LE = T4; +ar.writeInt16LE = T4; function d1(t, e) { return e === void 0 && (e = 0), t[e] << 24 | t[e + 1] << 16 | t[e + 2] << 8 | t[e + 3]; } @@ -6597,16 +6600,16 @@ function S$(t, e) { return n * 4294967296 + r; } ar.readUint64LE = S$; -function T4(t, e, r) { +function R4(t, e, r) { return e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0), Zd(t / 4294967296 >>> 0, e, r), Zd(t >>> 0, e, r + 4), e; } -ar.writeUint64BE = T4; -ar.writeInt64BE = T4; -function R4(t, e, r) { +ar.writeUint64BE = R4; +ar.writeInt64BE = R4; +function D4(t, e, r) { return e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0), Qd(t >>> 0, e, r), Qd(t / 4294967296 >>> 0, e, r + 4), e; } -ar.writeUint64LE = R4; -ar.writeInt64LE = R4; +ar.writeUint64LE = D4; +ar.writeInt64LE = D4; function A$(t, e, r) { if (r === void 0 && (r = 0), t % 8 !== 0) throw new Error("readUintBE supports only bitLengths divisible by 8"); @@ -6630,7 +6633,7 @@ ar.readUintLE = P$; function M$(t, e, r, n) { if (r === void 0 && (r = new Uint8Array(t / 8)), n === void 0 && (n = 0), t % 8 !== 0) throw new Error("writeUintBE supports only bitLengths divisible by 8"); - if (!M4.isSafeInteger(e)) + if (!I4.isSafeInteger(e)) throw new Error("writeUintBE value must be an integer"); for (var i = 1, s = t / 8 + n - 1; s >= n; s--) r[s] = e / i & 255, i *= 256; @@ -6640,7 +6643,7 @@ ar.writeUintBE = M$; function I$(t, e, r, n) { if (r === void 0 && (r = new Uint8Array(t / 8)), n === void 0 && (n = 0), t % 8 !== 0) throw new Error("writeUintLE supports only bitLengths divisible by 8"); - if (!M4.isSafeInteger(e)) + if (!I4.isSafeInteger(e)) throw new Error("writeUintLE value must be an integer"); for (var i = 1, s = n; s < n + t / 8; s++) r[s] = e / i & 255, i *= 256; @@ -6733,7 +6736,7 @@ ar.writeFloat64LE = k$; } t.randomStringForEntropy = u; })(Pa); -var D4 = {}; +var O4 = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); var e = ar, r = ki; @@ -6979,10 +6982,10 @@ var D4 = {}; return u.clean(), l; } t.hash = o; -})(D4); +})(O4); (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.convertSecretKeyToX25519 = t.convertPublicKeyToX25519 = t.verify = t.sign = t.extractPublicKeyFromSecretKey = t.generateKeyPair = t.generateKeyPairFromSeed = t.SEED_LENGTH = t.SECRET_KEY_LENGTH = t.PUBLIC_KEY_LENGTH = t.SIGNATURE_LENGTH = void 0; - const e = Pa, r = D4, n = ki; + const e = Pa, r = O4, n = ki; t.SIGNATURE_LENGTH = 64, t.PUBLIC_KEY_LENGTH = 32, t.SECRET_KEY_LENGTH = 64, t.SEED_LENGTH = 32; function i(Z) { const J = new Float64Array(16); @@ -7324,14 +7327,14 @@ var D4 = {}; return (0, n.wipe)(J), Q; } t.convertSecretKeyToX25519 = oe; -})(Bv); -const $$ = "EdDSA", B$ = "JWT", e0 = ".", U0 = "base64url", O4 = "utf8", N4 = "utf8", F$ = ":", j$ = "did", U$ = "key", ex = "base58btc", q$ = "z", z$ = "K36", W$ = 32; -function L4(t = 0) { +})(Fv); +const $$ = "EdDSA", B$ = "JWT", e0 = ".", U0 = "base64url", N4 = "utf8", L4 = "utf8", F$ = ":", j$ = "did", U$ = "key", tx = "base58btc", q$ = "z", z$ = "K36", W$ = 32; +function k4(t = 0) { return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); } function Sd(t, e) { e || (e = t.reduce((i, s) => i + s.length, 0)); - const r = L4(e); + const r = k4(e); let n = 0; for (const i of t) r.set(i, n), n += i.length; @@ -7444,7 +7447,7 @@ class Z$ { throw Error("Can only multibase decode strings"); } or(e) { - return k4(this, e); + return $4(this, e); } } class Q$ { @@ -7452,7 +7455,7 @@ class Q$ { this.decoders = e; } or(e) { - return k4(this, e); + return $4(this, e); } decode(e) { const r = e[0], n = this.decoders[r]; @@ -7461,7 +7464,7 @@ class Q$ { throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`); } } -const k4 = (t, e) => new Q$({ +const $4 = (t, e) => new Q$({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); @@ -7672,7 +7675,7 @@ const q0 = ({ name: t, prefix: e, encode: r, decode: n }) => new eB(t, e, r, n), base64pad: RB, base64url: DB, base64urlpad: OB -}, Symbol.toStringTag, { value: "Module" })), $4 = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), LB = $4.reduce((t, e, r) => (t[r] = e, t), []), kB = $4.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); +}, Symbol.toStringTag, { value: "Module" })), B4 = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), LB = B4.reduce((t, e, r) => (t[r] = e, t), []), kB = B4.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); function $B(t) { return t.reduce((e, r) => (e += LB[r], e), ""); } @@ -7697,7 +7700,7 @@ const FB = q0({ }, Symbol.toStringTag, { value: "Module" })); new TextEncoder(); new TextDecoder(); -const tx = { +const rx = { ...iB, ...oB, ...cB, @@ -7709,7 +7712,7 @@ const tx = { ...NB, ...jB }; -function B4(t, e, r, n) { +function F4(t, e, r, n) { return { name: t, prefix: e, @@ -7721,46 +7724,46 @@ function B4(t, e, r, n) { decoder: { decode: n } }; } -const rx = B4("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), Xg = B4("ascii", "a", (t) => { +const nx = F4("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), Xg = F4("ascii", "a", (t) => { let e = "a"; for (let r = 0; r < t.length; r++) e += String.fromCharCode(t[r]); return e; }, (t) => { t = t.substring(1); - const e = L4(t.length); + const e = k4(t.length); for (let r = 0; r < t.length; r++) e[r] = t.charCodeAt(r); return e; -}), F4 = { - utf8: rx, - "utf-8": rx, - hex: tx.base16, +}), j4 = { + utf8: nx, + "utf-8": nx, + hex: rx.base16, latin1: Xg, ascii: Xg, binary: Xg, - ...tx + ...rx }; function On(t, e = "utf8") { - const r = F4[e]; + const r = j4[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t.buffer, t.byteOffset, t.byteLength).toString("utf8") : r.encoder.encode(t).substring(1); } function Rn(t, e = "utf8") { - const r = F4[e]; + const r = j4[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t, "utf8") : r.decoder.decode(`${r.prefix}${t}`); } -function nx(t) { - return fc(On(Rn(t, U0), O4)); +function ix(t) { + return fc(On(Rn(t, U0), N4)); } function t0(t) { - return On(Rn($o(t), O4), U0); + return On(Rn($o(t), N4), U0); } -function j4(t) { - const e = Rn(z$, ex), r = q$ + On(Sd([e, t]), ex); +function U4(t) { + const e = Rn(z$, tx), r = q$ + On(Sd([e, t]), tx); return [j$, U$, r].join(F$); } function UB(t) { @@ -7770,7 +7773,7 @@ function qB(t) { return Rn(t, U0); } function zB(t) { - return Rn([t0(t.header), t0(t.payload)].join(e0), N4); + return Rn([t0(t.header), t0(t.payload)].join(e0), L4); } function WB(t) { return [ @@ -7780,17 +7783,17 @@ function WB(t) { ].join(e0); } function v1(t) { - const e = t.split(e0), r = nx(e[0]), n = nx(e[1]), i = qB(e[2]), s = Rn(e.slice(0, 2).join(e0), N4); + const e = t.split(e0), r = ix(e[0]), n = ix(e[1]), i = qB(e[2]), s = Rn(e.slice(0, 2).join(e0), L4); return { header: r, payload: n, signature: i, data: s }; } -function ix(t = Pa.randomBytes(W$)) { - return Bv.generateKeyPairFromSeed(t); +function sx(t = Pa.randomBytes(W$)) { + return Fv.generateKeyPairFromSeed(t); } async function HB(t, e, r, n, i = mt.fromMiliseconds(Date.now())) { - const s = { alg: $$, typ: B$ }, o = j4(n.publicKey), a = i + r, u = { iss: o, sub: t, aud: e, iat: i, exp: a }, l = zB({ header: s, payload: u }), d = Bv.sign(n.secretKey, l); + const s = { alg: $$, typ: B$ }, o = U4(n.publicKey), a = i + r, u = { iss: o, sub: t, aud: e, iat: i, exp: a }, l = zB({ header: s, payload: u }), d = Fv.sign(n.secretKey, l); return WB({ header: s, payload: u, signature: d }); } -var sx = function(t, e, r) { +var ox = function(t, e, r) { if (r || arguments.length === 2) for (var n = 0, i = e.length, s; n < i; n++) (s || !(n in e)) && (s || (s = Array.prototype.slice.call(e, 0, n)), s[n] = e[n]); return t.concat(s || Array.prototype.slice.call(e)); @@ -7834,7 +7837,7 @@ var sx = function(t, e, r) { } return t; }() -), XB = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/, ZB = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, ox = 3, QB = [ +), XB = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/, ZB = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, ax = 3, QB = [ ["aol", /AOLShield\/([0-9\._]+)/], ["edge", /Edge\/([0-9\._]+)/], ["edge-ios", /EdgiOS\/([0-9\._]+)/], @@ -7873,7 +7876,7 @@ var sx = function(t, e, r) { ["ios-webview", /AppleWebKit\/([0-9\.]+).*Gecko\)$/], ["curl", /^curl\/([0-9\.]+)$/], ["searchbot", XB] -], ax = [ +], cx = [ ["iOS", /iP(hone|od|ad)/], ["Android OS", /Android/], ["BlackBerry OS", /BlackBerry|BB10/], @@ -7921,13 +7924,13 @@ function rF(t) { if (r === "searchbot") return new YB(); var i = n[1] && n[1].split(".").join("_").split("_").slice(0, 3); - i ? i.length < ox && (i = sx(sx([], i, !0), sF(ox - i.length), !0)) : i = []; + i ? i.length < ax && (i = ox(ox([], i, !0), sF(ax - i.length), !0)) : i = []; var s = i.join("."), o = nF(t), a = ZB.exec(t); return a && a[1] ? new GB(r, s, o, a[1]) : new KB(r, s, o); } function nF(t) { - for (var e = 0, r = ax.length; e < r; e++) { - var n = ax[e], i = n[0], s = n[1], o = s.exec(t); + for (var e = 0, r = cx.length; e < r; e++) { + var n = cx[e], i = n[0], s = n[1], o = s.exec(t); if (o) return i; } @@ -7944,7 +7947,7 @@ function sF(t) { } var Wr = {}; Object.defineProperty(Wr, "__esModule", { value: !0 }); -Wr.getLocalStorage = Wr.getLocalStorageOrThrow = Wr.getCrypto = Wr.getCryptoOrThrow = U4 = Wr.getLocation = Wr.getLocationOrThrow = Fv = Wr.getNavigator = Wr.getNavigatorOrThrow = Kl = Wr.getDocument = Wr.getDocumentOrThrow = Wr.getFromWindowOrThrow = Wr.getFromWindow = void 0; +Wr.getLocalStorage = Wr.getLocalStorageOrThrow = Wr.getCrypto = Wr.getCryptoOrThrow = q4 = Wr.getLocation = Wr.getLocationOrThrow = jv = Wr.getNavigator = Wr.getNavigatorOrThrow = Kl = Wr.getDocument = Wr.getDocumentOrThrow = Wr.getFromWindowOrThrow = Wr.getFromWindow = void 0; function yc(t) { let e; return typeof window < "u" && typeof window[t] < "u" && (e = window[t]), e; @@ -7972,7 +7975,7 @@ Wr.getNavigatorOrThrow = cF; function uF() { return yc("navigator"); } -var Fv = Wr.getNavigator = uF; +var jv = Wr.getNavigator = uF; function fF() { return Nu("location"); } @@ -7980,7 +7983,7 @@ Wr.getLocationOrThrow = fF; function lF() { return yc("location"); } -var U4 = Wr.getLocation = lF; +var q4 = Wr.getLocation = lF; function hF() { return Nu("crypto"); } @@ -7997,14 +8000,14 @@ function gF() { return yc("localStorage"); } Wr.getLocalStorage = gF; -var jv = {}; -Object.defineProperty(jv, "__esModule", { value: !0 }); -var q4 = jv.getWindowMetadata = void 0; -const cx = Wr; +var Uv = {}; +Object.defineProperty(Uv, "__esModule", { value: !0 }); +var z4 = Uv.getWindowMetadata = void 0; +const ux = Wr; function mF() { let t, e; try { - t = cx.getDocumentOrThrow(), e = cx.getLocationOrThrow(); + t = ux.getDocumentOrThrow(), e = ux.getLocationOrThrow(); } catch { return null; } @@ -8062,8 +8065,8 @@ function mF() { name: o }; } -q4 = jv.getWindowMetadata = mF; -var xl = {}, vF = (t) => encodeURIComponent(t).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), z4 = "%[a-f0-9]{2}", ux = new RegExp("(" + z4 + ")|([^%]+?)", "gi"), fx = new RegExp("(" + z4 + ")+", "gi"); +z4 = Uv.getWindowMetadata = mF; +var xl = {}, vF = (t) => encodeURIComponent(t).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), W4 = "%[a-f0-9]{2}", fx = new RegExp("(" + W4 + ")|([^%]+?)", "gi"), lx = new RegExp("(" + W4 + ")+", "gi"); function b1(t, e) { try { return [decodeURIComponent(t.join(""))]; @@ -8079,8 +8082,8 @@ function bF(t) { try { return decodeURIComponent(t); } catch { - for (var e = t.match(ux) || [], r = 1; r < e.length; r++) - t = b1(e, r).join(""), e = t.match(ux) || []; + for (var e = t.match(fx) || [], r = 1; r < e.length; r++) + t = b1(e, r).join(""), e = t.match(fx) || []; return t; } } @@ -8088,14 +8091,14 @@ function yF(t) { for (var e = { "%FE%FF": "��", "%FF%FE": "��" - }, r = fx.exec(t); r; ) { + }, r = lx.exec(t); r; ) { try { e[r[0]] = decodeURIComponent(r[0]); } catch { var n = bF(r[0]); n !== r[0] && (e[r[0]] = n); } - r = fx.exec(t); + r = lx.exec(t); } e["%C2"] = "�"; for (var i = Object.keys(e), s = 0; s < i.length; s++) { @@ -8339,7 +8342,7 @@ var wF = function(t) { return t.pick($, V, W); }; })(xl); -var W4 = { exports: {} }; +var H4 = { exports: {} }; /** * [js-sha3]{@link https://github.com/emn178/js-sha3} * @@ -8603,12 +8606,12 @@ var W4 = { exports: {} }; for (b = 0; b < g.length; ++b) i[g[b]] = f[g[b]]; })(); -})(W4); -var EF = W4.exports; +})(H4); +var EF = H4.exports; const SF = /* @__PURE__ */ ts(EF), AF = "logger/5.7.0"; -let lx = !1, hx = !1; +let hx = !1, dx = !1; const Ad = { debug: 1, default: 2, info: 2, warning: 3, error: 4, off: 5 }; -let dx = Ad.default, Zg = null; +let px = Ad.default, Zg = null; function PF() { try { const t = []; @@ -8628,7 +8631,7 @@ function PF() { } return null; } -const px = PF(); +const gx = PF(); var y1; (function(t) { t.DEBUG = "DEBUG", t.INFO = "INFO", t.WARNING = "WARNING", t.ERROR = "ERROR", t.OFF = "OFF"; @@ -8637,7 +8640,7 @@ var ws; (function(t) { t.UNKNOWN_ERROR = "UNKNOWN_ERROR", t.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", t.UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION", t.NETWORK_ERROR = "NETWORK_ERROR", t.SERVER_ERROR = "SERVER_ERROR", t.TIMEOUT = "TIMEOUT", t.BUFFER_OVERRUN = "BUFFER_OVERRUN", t.NUMERIC_FAULT = "NUMERIC_FAULT", t.MISSING_NEW = "MISSING_NEW", t.INVALID_ARGUMENT = "INVALID_ARGUMENT", t.MISSING_ARGUMENT = "MISSING_ARGUMENT", t.UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT", t.CALL_EXCEPTION = "CALL_EXCEPTION", t.INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS", t.NONCE_EXPIRED = "NONCE_EXPIRED", t.REPLACEMENT_UNDERPRICED = "REPLACEMENT_UNDERPRICED", t.UNPREDICTABLE_GAS_LIMIT = "UNPREDICTABLE_GAS_LIMIT", t.TRANSACTION_REPLACED = "TRANSACTION_REPLACED", t.ACTION_REJECTED = "ACTION_REJECTED"; })(ws || (ws = {})); -const gx = "0123456789abcdef"; +const mx = "0123456789abcdef"; class Yr { constructor(e) { Object.defineProperty(this, "version", { @@ -8648,7 +8651,7 @@ class Yr { } _log(e, r) { const n = e.toLowerCase(); - Ad[n] == null && this.throwArgumentError("invalid log level name", "logLevel", e), !(dx > Ad[n]) && console.log.apply(console, r); + Ad[n] == null && this.throwArgumentError("invalid log level name", "logLevel", e), !(px > Ad[n]) && console.log.apply(console, r); } debug(...e) { this._log(Yr.levels.DEBUG, e); @@ -8660,7 +8663,7 @@ class Yr { this._log(Yr.levels.WARNING, e); } makeError(e, r, n) { - if (hx) + if (dx) return this.makeError("censored error", r, {}); r || (r = Yr.errors.UNKNOWN_ERROR), n || (n = {}); const i = []; @@ -8670,7 +8673,7 @@ class Yr { if (l instanceof Uint8Array) { let d = ""; for (let p = 0; p < l.length; p++) - d += gx[l[p] >> 4], d += gx[l[p] & 15]; + d += mx[l[p] >> 4], d += mx[l[p] & 15]; i.push(u + "=Uint8Array(0x" + d + ")"); } else i.push(u + "=" + JSON.stringify(l)); @@ -8732,9 +8735,9 @@ class Yr { e || this.throwArgumentError(r, n, i); } checkNormalize(e) { - px && this.throwError("platform missing String.prototype.normalize", Yr.errors.UNSUPPORTED_OPERATION, { + gx && this.throwError("platform missing String.prototype.normalize", Yr.errors.UNSUPPORTED_OPERATION, { operation: "String.prototype.normalize", - form: px + form: gx }); } checkSafeUint53(e, r) { @@ -8769,14 +8772,14 @@ class Yr { static setCensorship(e, r) { if (!e && r && this.globalLogger().throwError("cannot permanently disable censorship", Yr.errors.UNSUPPORTED_OPERATION, { operation: "setCensorship" - }), lx) { + }), hx) { if (!e) return; this.globalLogger().throwError("error censorship permanent", Yr.errors.UNSUPPORTED_OPERATION, { operation: "setCensorship" }); } - hx = !!e, lx = !!r; + dx = !!e, hx = !!r; } static setLogLevel(e) { const r = Ad[e.toLowerCase()]; @@ -8784,7 +8787,7 @@ class Yr { Yr.globalLogger().warn("invalid log level - " + e); return; } - dx = r; + px = r; } static from(e) { return new Yr(e); @@ -8793,7 +8796,7 @@ class Yr { Yr.errors = ws; Yr.levels = y1; const MF = "bytes/5.7.0", hn = new Yr(MF); -function H4(t) { +function K4(t) { return !!t.toHexString; } function fu(t) { @@ -8803,21 +8806,21 @@ function fu(t) { }), t; } function IF(t) { - return zs(t) && !(t.length % 2) || Uv(t); + return zs(t) && !(t.length % 2) || qv(t); } -function mx(t) { +function vx(t) { return typeof t == "number" && t == t && t % 1 === 0; } -function Uv(t) { +function qv(t) { if (t == null) return !1; if (t.constructor === Uint8Array) return !0; - if (typeof t == "string" || !mx(t.length) || t.length < 0) + if (typeof t == "string" || !vx(t.length) || t.length < 0) return !1; for (let e = 0; e < t.length; e++) { const r = t[e]; - if (!mx(r) || r < 0 || r >= 256) + if (!vx(r) || r < 0 || r >= 256) return !1; } return !0; @@ -8830,7 +8833,7 @@ function wn(t, e) { r.unshift(t & 255), t = parseInt(String(t / 256)); return r.length === 0 && r.push(0), fu(new Uint8Array(r)); } - if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), H4(t) && (t = t.toHexString()), zs(t)) { + if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), K4(t) && (t = t.toHexString()), zs(t)) { let r = t.substring(2); r.length % 2 && (e.hexPad === "left" ? r = "0" + r : e.hexPad === "right" ? r += "0" : hn.throwArgumentError("hex data is odd-length", "value", t)); const n = []; @@ -8838,7 +8841,7 @@ function wn(t, e) { n.push(parseInt(r.substring(i, i + 2), 16)); return fu(new Uint8Array(n)); } - return Uv(t) ? fu(new Uint8Array(t)) : hn.throwArgumentError("invalid arrayify value", "value", t); + return qv(t) ? fu(new Uint8Array(t)) : hn.throwArgumentError("invalid arrayify value", "value", t); } function CF(t) { const e = t.map((i) => wn(i)), r = e.reduce((i, s) => i + s.length, 0), n = new Uint8Array(r); @@ -8863,11 +8866,11 @@ function Ri(t, e) { } if (typeof t == "bigint") return t = t.toString(16), t.length % 2 ? "0x0" + t : "0x" + t; - if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), H4(t)) + if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), K4(t)) return t.toHexString(); if (zs(t)) return t.length % 2 && (e.hexPad === "left" ? t = "0x0" + t.substring(2) : e.hexPad === "right" ? t += "0" : hn.throwArgumentError("hex data is odd-length", "value", t)), t.toLowerCase(); - if (Uv(t)) { + if (qv(t)) { let r = "0x"; for (let n = 0; n < t.length; n++) { let i = t[n]; @@ -8884,7 +8887,7 @@ function RF(t) { return null; return (t.length - 2) / 2; } -function vx(t, e, r) { +function bx(t, e, r) { return typeof t != "string" ? t = Ri(t) : (!zs(t) || t.length % 2) && hn.throwArgumentError("invalid hexData", "value", t), e = 2 + 2 * e, "0x" + t.substring(e); } function lu(t, e) { @@ -8892,7 +8895,7 @@ function lu(t, e) { t = "0x0" + t.substring(2); return t; } -function K4(t) { +function V4(t) { const e = { r: "0x", s: "0x", @@ -8930,11 +8933,11 @@ function K4(t) { } return e.yParityAndS = e._vs, e.compact = e.r + e.yParityAndS.substring(2), e; } -function qv(t) { +function zv(t) { return "0x" + SF.keccak_256(wn(t)); } -var zv = { exports: {} }; -zv.exports; +var Wv = { exports: {} }; +Wv.exports; (function(t) { (function(e, r) { function n(m, f) { @@ -10059,8 +10062,8 @@ zv.exports; return g._forceRed(this); }; })(t, gn); -})(zv); -var DF = zv.exports; +})(Wv); +var DF = Wv.exports; const sr = /* @__PURE__ */ ts(DF); var OF = sr.BN; function NF(t) { @@ -10071,10 +10074,10 @@ var r0; (function(t) { t.current = "", t.NFC = "NFC", t.NFD = "NFD", t.NFKC = "NFKC", t.NFKD = "NFKD"; })(r0 || (r0 = {})); -var bx; +var yx; (function(t) { t.UNEXPECTED_CONTINUE = "unexpected continuation byte", t.BAD_PREFIX = "bad codepoint prefix", t.OVERRUN = "string overrun", t.MISSING_CONTINUE = "missing continuation byte", t.OUT_OF_RANGE = "out of UTF-8 range", t.UTF16_SURROGATE = "UTF-16 surrogate", t.OVERLONG = "overlong representation"; -})(bx || (bx = {})); +})(yx || (yx = {})); function em(t, e = r0.current) { e != r0.current && (kF.checkNormalize(), t = t.normalize(e)); let r = []; @@ -10098,20 +10101,20 @@ function em(t, e = r0.current) { } const $F = `Ethereum Signed Message: `; -function V4(t) { - return typeof t == "string" && (t = em(t)), qv(CF([ +function G4(t) { + return typeof t == "string" && (t = em(t)), zv(CF([ em($F), em(String(t.length)), t ])); } const BF = "address/5.7.0", $f = new Yr(BF); -function yx(t) { +function wx(t) { zs(t, 20) || $f.throwArgumentError("invalid address", "address", t), t = t.toLowerCase(); const e = t.substring(2).split(""), r = new Uint8Array(40); for (let i = 0; i < 40; i++) r[i] = e[i].charCodeAt(0); - const n = wn(qv(r)); + const n = wn(zv(r)); for (let i = 0; i < 40; i += 2) n[i >> 1] >> 4 >= 8 && (e[i] = e[i].toUpperCase()), (n[i >> 1] & 15) >= 8 && (e[i + 1] = e[i + 1].toUpperCase()); return "0x" + e.join(""); @@ -10120,17 +10123,17 @@ const FF = 9007199254740991; function jF(t) { return Math.log10 ? Math.log10(t) : Math.log(t) / Math.LN10; } -const Wv = {}; +const Hv = {}; for (let t = 0; t < 10; t++) - Wv[String(t)] = String(t); + Hv[String(t)] = String(t); for (let t = 0; t < 26; t++) - Wv[String.fromCharCode(65 + t)] = String(10 + t); -const wx = Math.floor(jF(FF)); + Hv[String.fromCharCode(65 + t)] = String(10 + t); +const xx = Math.floor(jF(FF)); function UF(t) { t = t.toUpperCase(), t = t.substring(4) + t.substring(0, 2) + "00"; - let e = t.split("").map((n) => Wv[n]).join(""); - for (; e.length >= wx; ) { - let n = e.substring(0, wx); + let e = t.split("").map((n) => Hv[n]).join(""); + for (; e.length >= xx; ) { + let n = e.substring(0, xx); e = parseInt(n, 10) % 97 + e.substring(n.length); } let r = String(98 - parseInt(e, 10) % 97); @@ -10141,11 +10144,11 @@ function UF(t) { function qF(t) { let e = null; if (typeof t != "string" && $f.throwArgumentError("invalid address", "address", t), t.match(/^(0x)?[0-9a-fA-F]{40}$/)) - t.substring(0, 2) !== "0x" && (t = "0x" + t), e = yx(t), t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && e !== t && $f.throwArgumentError("bad address checksum", "address", t); + t.substring(0, 2) !== "0x" && (t = "0x" + t), e = wx(t), t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && e !== t && $f.throwArgumentError("bad address checksum", "address", t); else if (t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { for (t.substring(2, 4) !== UF(t) && $f.throwArgumentError("bad icap checksum", "address", t), e = NF(t.substring(4)); e.length < 40; ) e = "0" + e; - e = yx("0x" + e); + e = wx("0x" + e); } else $f.throwArgumentError("invalid address", "address", t); return e; @@ -10157,12 +10160,12 @@ function _f(t, e, r) { writable: !1 }); } -var Vl = {}, xr = {}, wc = G4; -function G4(t, e) { +var Vl = {}, xr = {}, wc = Y4; +function Y4(t, e) { if (!t) throw new Error(e || "Assertion failed"); } -G4.equal = function(e, r, n) { +Y4.equal = function(e, r, n) { if (e != r) throw new Error(n || "Assertion failed: " + e + " != " + r); }; @@ -10212,31 +10215,31 @@ function KF(t, e) { xr.toArray = KF; function VF(t) { for (var e = "", r = 0; r < t.length; r++) - e += J4(t[r].toString(16)); + e += X4(t[r].toString(16)); return e; } xr.toHex = VF; -function Y4(t) { +function J4(t) { var e = t >>> 24 | t >>> 8 & 65280 | t << 8 & 16711680 | (t & 255) << 24; return e >>> 0; } -xr.htonl = Y4; +xr.htonl = J4; function GF(t, e) { for (var r = "", n = 0; n < t.length; n++) { var i = t[n]; - e === "little" && (i = Y4(i)), r += X4(i.toString(16)); + e === "little" && (i = J4(i)), r += Z4(i.toString(16)); } return r; } xr.toHex32 = GF; -function J4(t) { +function X4(t) { return t.length === 1 ? "0" + t : t; } -xr.zero2 = J4; -function X4(t) { +xr.zero2 = X4; +function Z4(t) { return t.length === 7 ? "0" + t : t.length === 6 ? "00" + t : t.length === 5 ? "000" + t : t.length === 4 ? "0000" + t : t.length === 3 ? "00000" + t : t.length === 2 ? "000000" + t : t.length === 1 ? "0000000" + t : t; } -xr.zero8 = X4; +xr.zero8 = Z4; function YF(t, e, r, n) { var i = r - e; zF(i % 4 === 0); @@ -10337,16 +10340,16 @@ function dj(t, e, r) { return n >>> 0; } xr.shr64_lo = dj; -var Lu = {}, xx = xr, pj = wc; +var Lu = {}, _x = xr, pj = wc; function W0() { this.pending = null, this.pendingTotal = 0, this.blockSize = this.constructor.blockSize, this.outSize = this.constructor.outSize, this.hmacStrength = this.constructor.hmacStrength, this.padLength = this.constructor.padLength / 8, this.endian = "big", this._delta8 = this.blockSize / 8, this._delta32 = this.blockSize / 32; } Lu.BlockHash = W0; W0.prototype.update = function(e, r) { - if (e = xx.toArray(e, r), this.pending ? this.pending = this.pending.concat(e) : this.pending = e, this.pendingTotal += e.length, this.pending.length >= this._delta8) { + if (e = _x.toArray(e, r), this.pending ? this.pending = this.pending.concat(e) : this.pending = e, this.pendingTotal += e.length, this.pending.length >= this._delta8) { e = this.pending; var n = e.length % this._delta8; - this.pending = e.slice(e.length - n, e.length), this.pending.length === 0 && (this.pending = null), e = xx.join32(e, 0, e.length - n, this.endian); + this.pending = e.slice(e.length - n, e.length), this.pending.length === 0 && (this.pending = null), e = _x.join32(e, 0, e.length - n, this.endian); for (var i = 0; i < e.length; i += this._delta32) this._update(e, i, i + this._delta32); } @@ -10372,25 +10375,25 @@ W0.prototype._pad = function() { var ku = {}, ro = {}, gj = xr, Ws = gj.rotr32; function mj(t, e, r, n) { if (t === 0) - return Z4(e, r, n); + return Q4(e, r, n); if (t === 1 || t === 3) - return e8(e, r, n); + return t8(e, r, n); if (t === 2) - return Q4(e, r, n); + return e8(e, r, n); } ro.ft_1 = mj; -function Z4(t, e, r) { +function Q4(t, e, r) { return t & e ^ ~t & r; } -ro.ch32 = Z4; -function Q4(t, e, r) { +ro.ch32 = Q4; +function e8(t, e, r) { return t & e ^ t & r ^ e & r; } -ro.maj32 = Q4; -function e8(t, e, r) { +ro.maj32 = e8; +function t8(t, e, r) { return t ^ e ^ r; } -ro.p32 = e8; +ro.p32 = t8; function vj(t) { return Ws(t, 2) ^ Ws(t, 13) ^ Ws(t, 22); } @@ -10407,7 +10410,7 @@ function wj(t) { return Ws(t, 17) ^ Ws(t, 19) ^ t >>> 10; } ro.g1_256 = wj; -var _u = xr, xj = Lu, _j = ro, tm = _u.rotl32, Ef = _u.sum32, Ej = _u.sum32_5, Sj = _j.ft_1, t8 = xj.BlockHash, Aj = [ +var _u = xr, xj = Lu, _j = ro, tm = _u.rotl32, Ef = _u.sum32, Ej = _u.sum32_5, Sj = _j.ft_1, r8 = xj.BlockHash, Aj = [ 1518500249, 1859775393, 2400959708, @@ -10416,7 +10419,7 @@ var _u = xr, xj = Lu, _j = ro, tm = _u.rotl32, Ef = _u.sum32, Ej = _u.sum32_5, S function Js() { if (!(this instanceof Js)) return new Js(); - t8.call(this), this.h = [ + r8.call(this), this.h = [ 1732584193, 4023233417, 2562383102, @@ -10424,7 +10427,7 @@ function Js() { 3285377520 ], this.W = new Array(80); } -_u.inherits(Js, t8); +_u.inherits(Js, r8); var Pj = Js; Js.blockSize = 512; Js.outSize = 160; @@ -10445,7 +10448,7 @@ Js.prototype._update = function(e, r) { Js.prototype._digest = function(e) { return e === "hex" ? _u.toHex32(this.h, "big") : _u.split32(this.h, "big"); }; -var Eu = xr, Mj = Lu, $u = ro, Ij = wc, gs = Eu.sum32, Cj = Eu.sum32_4, Tj = Eu.sum32_5, Rj = $u.ch32, Dj = $u.maj32, Oj = $u.s0_256, Nj = $u.s1_256, Lj = $u.g0_256, kj = $u.g1_256, r8 = Mj.BlockHash, $j = [ +var Eu = xr, Mj = Lu, $u = ro, Ij = wc, gs = Eu.sum32, Cj = Eu.sum32_4, Tj = Eu.sum32_5, Rj = $u.ch32, Dj = $u.maj32, Oj = $u.s0_256, Nj = $u.s1_256, Lj = $u.g0_256, kj = $u.g1_256, n8 = Mj.BlockHash, $j = [ 1116352408, 1899447441, 3049323471, @@ -10514,7 +10517,7 @@ var Eu = xr, Mj = Lu, $u = ro, Ij = wc, gs = Eu.sum32, Cj = Eu.sum32_4, Tj = Eu. function Xs() { if (!(this instanceof Xs)) return new Xs(); - r8.call(this), this.h = [ + n8.call(this), this.h = [ 1779033703, 3144134277, 1013904242, @@ -10525,8 +10528,8 @@ function Xs() { 1541459225 ], this.k = $j, this.W = new Array(64); } -Eu.inherits(Xs, r8); -var n8 = Xs; +Eu.inherits(Xs, n8); +var i8 = Xs; Xs.blockSize = 512; Xs.outSize = 256; Xs.hmacStrength = 192; @@ -10546,11 +10549,11 @@ Xs.prototype._update = function(e, r) { Xs.prototype._digest = function(e) { return e === "hex" ? Eu.toHex32(this.h, "big") : Eu.split32(this.h, "big"); }; -var x1 = xr, i8 = n8; +var x1 = xr, s8 = i8; function Fo() { if (!(this instanceof Fo)) return new Fo(); - i8.call(this), this.h = [ + s8.call(this), this.h = [ 3238371032, 914150663, 812702999, @@ -10561,7 +10564,7 @@ function Fo() { 3204075428 ]; } -x1.inherits(Fo, i8); +x1.inherits(Fo, s8); var Bj = Fo; Fo.blockSize = 512; Fo.outSize = 224; @@ -10570,7 +10573,7 @@ Fo.padLength = 64; Fo.prototype._digest = function(e) { return e === "hex" ? x1.toHex32(this.h.slice(0, 7), "big") : x1.split32(this.h.slice(0, 7), "big"); }; -var _i = xr, Fj = Lu, jj = wc, Hs = _i.rotr64_hi, Ks = _i.rotr64_lo, s8 = _i.shr64_hi, o8 = _i.shr64_lo, ta = _i.sum64, rm = _i.sum64_hi, nm = _i.sum64_lo, Uj = _i.sum64_4_hi, qj = _i.sum64_4_lo, zj = _i.sum64_5_hi, Wj = _i.sum64_5_lo, a8 = Fj.BlockHash, Hj = [ +var _i = xr, Fj = Lu, jj = wc, Hs = _i.rotr64_hi, Ks = _i.rotr64_lo, o8 = _i.shr64_hi, a8 = _i.shr64_lo, ta = _i.sum64, rm = _i.sum64_hi, nm = _i.sum64_lo, Uj = _i.sum64_4_hi, qj = _i.sum64_4_lo, zj = _i.sum64_5_hi, Wj = _i.sum64_5_lo, c8 = Fj.BlockHash, Hj = [ 1116352408, 3609767458, 1899447441, @@ -10735,7 +10738,7 @@ var _i = xr, Fj = Lu, jj = wc, Hs = _i.rotr64_hi, Ks = _i.rotr64_lo, s8 = _i.shr function Ss() { if (!(this instanceof Ss)) return new Ss(); - a8.call(this), this.h = [ + c8.call(this), this.h = [ 1779033703, 4089235720, 3144134277, @@ -10754,8 +10757,8 @@ function Ss() { 327033209 ], this.k = Hj, this.W = new Array(160); } -_i.inherits(Ss, a8); -var c8 = Ss; +_i.inherits(Ss, c8); +var u8 = Ss; Ss.blockSize = 1024; Ss.outSize = 512; Ss.hmacStrength = 192; @@ -10856,26 +10859,26 @@ function Qj(t, e) { return s < 0 && (s += 4294967296), s; } function eU(t, e) { - var r = Hs(t, e, 1), n = Hs(t, e, 8), i = s8(t, e, 7), s = r ^ n ^ i; + var r = Hs(t, e, 1), n = Hs(t, e, 8), i = o8(t, e, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } function tU(t, e) { - var r = Ks(t, e, 1), n = Ks(t, e, 8), i = o8(t, e, 7), s = r ^ n ^ i; + var r = Ks(t, e, 1), n = Ks(t, e, 8), i = a8(t, e, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } function rU(t, e) { - var r = Hs(t, e, 19), n = Hs(e, t, 29), i = s8(t, e, 6), s = r ^ n ^ i; + var r = Hs(t, e, 19), n = Hs(e, t, 29), i = o8(t, e, 6), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } function nU(t, e) { - var r = Ks(t, e, 19), n = Ks(e, t, 29), i = o8(t, e, 6), s = r ^ n ^ i; + var r = Ks(t, e, 19), n = Ks(e, t, 29), i = a8(t, e, 6), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -var _1 = xr, u8 = c8; +var _1 = xr, f8 = u8; function jo() { if (!(this instanceof jo)) return new jo(); - u8.call(this), this.h = [ + f8.call(this), this.h = [ 3418070365, 3238371032, 1654270250, @@ -10894,7 +10897,7 @@ function jo() { 3204075428 ]; } -_1.inherits(jo, u8); +_1.inherits(jo, f8); var iU = jo; jo.blockSize = 1024; jo.outSize = 384; @@ -10905,33 +10908,33 @@ jo.prototype._digest = function(e) { }; ku.sha1 = Pj; ku.sha224 = Bj; -ku.sha256 = n8; +ku.sha256 = i8; ku.sha384 = iU; -ku.sha512 = c8; -var f8 = {}, lc = xr, sU = Lu, ud = lc.rotl32, _x = lc.sum32, Sf = lc.sum32_3, Ex = lc.sum32_4, l8 = sU.BlockHash; +ku.sha512 = u8; +var l8 = {}, lc = xr, sU = Lu, ud = lc.rotl32, Ex = lc.sum32, Sf = lc.sum32_3, Sx = lc.sum32_4, h8 = sU.BlockHash; function Zs() { if (!(this instanceof Zs)) return new Zs(); - l8.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = "little"; + h8.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = "little"; } -lc.inherits(Zs, l8); -f8.ripemd160 = Zs; +lc.inherits(Zs, h8); +l8.ripemd160 = Zs; Zs.blockSize = 512; Zs.outSize = 160; Zs.hmacStrength = 192; Zs.padLength = 64; Zs.prototype._update = function(e, r) { for (var n = this.h[0], i = this.h[1], s = this.h[2], o = this.h[3], a = this.h[4], u = n, l = i, d = s, p = o, w = a, A = 0; A < 80; A++) { - var M = _x( + var M = Ex( ud( - Ex(n, Sx(A, i, s, o), e[cU[A] + r], oU(A)), + Sx(n, Ax(A, i, s, o), e[cU[A] + r], oU(A)), fU[A] ), a ); - n = a, a = o, o = ud(s, 10), s = i, i = M, M = _x( + n = a, a = o, o = ud(s, 10), s = i, i = M, M = Ex( ud( - Ex(u, Sx(79 - A, l, d, p), e[uU[A] + r], aU(A)), + Sx(u, Ax(79 - A, l, d, p), e[uU[A] + r], aU(A)), lU[A] ), w @@ -10942,7 +10945,7 @@ Zs.prototype._update = function(e, r) { Zs.prototype._digest = function(e) { return e === "hex" ? lc.toHex32(this.h, "little") : lc.split32(this.h, "little"); }; -function Sx(t, e, r, n) { +function Ax(t, e, r, n) { return t <= 15 ? e ^ r ^ n : t <= 31 ? e & r | ~e & n : t <= 47 ? (e | ~r) ^ n : t <= 63 ? e & n | r & ~n : e ^ (r | ~n); } function oU(t) { @@ -11300,7 +11303,7 @@ Su.prototype.digest = function(e) { }; (function(t) { var e = t; - e.utils = xr, e.common = Lu, e.sha = ku, e.ripemd = f8, e.hmac = pU, e.sha1 = e.sha.sha1, e.sha256 = e.sha.sha256, e.sha224 = e.sha.sha224, e.sha384 = e.sha.sha384, e.sha512 = e.sha.sha512, e.ripemd160 = e.ripemd.ripemd160; + e.utils = xr, e.common = Lu, e.sha = ku, e.ripemd = l8, e.hmac = pU, e.sha1 = e.sha.sha1, e.sha256 = e.sha.sha256, e.sha224 = e.sha.sha224, e.sha384 = e.sha.sha384, e.sha512 = e.sha.sha512, e.ripemd160 = e.ripemd.ripemd160; })(Vl); const yo = /* @__PURE__ */ ts(Vl); function Bu(t, e, r) { @@ -11315,12 +11318,12 @@ function Bu(t, e, r) { function gU() { throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs"); } -var Hv = h8; -function h8(t, e) { +var Kv = d8; +function d8(t, e) { if (!t) throw new Error(e || "Assertion failed"); } -h8.equal = function(e, r, n) { +d8.equal = function(e, r, n) { if (e != r) throw new Error(n || "Assertion failed: " + e + " != " + r); }; @@ -11363,7 +11366,7 @@ var xs = Bu(function(t, e) { }; }), $i = Bu(function(t, e) { var r = e; - r.assert = Hv, r.toArray = xs.toArray, r.zero2 = xs.zero2, r.toHex = xs.toHex, r.encode = xs.encode; + r.assert = Kv, r.toArray = xs.toArray, r.zero2 = xs.zero2, r.toHex = xs.toHex, r.encode = xs.encode; function n(u, l, d) { var p = new Array(Math.max(u.bitLength(), d) + 1); p.fill(0); @@ -11601,7 +11604,7 @@ ns.prototype.dblp = function(e) { r = r.dbl(); return r; }; -var Kv = Bu(function(t) { +var Vv = Bu(function(t) { typeof Object.create == "function" ? t.exports = function(r, n) { n && (r.super_ = n, r.prototype = Object.create(n.prototype, { constructor: { @@ -11623,7 +11626,7 @@ var Kv = Bu(function(t) { function is(t) { xc.call(this, "short", t), this.a = new sr(t.a, 16).toRed(this.red), this.b = new sr(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); } -Kv(is, xc); +Vv(is, xc); var bU = is; is.prototype._getEndomorphism = function(e) { if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { @@ -11705,7 +11708,7 @@ is.prototype._endoWnafMulAdd = function(e, r, n) { function kn(t, e, r, n) { xc.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new sr(e, 16), this.y = new sr(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); } -Kv(kn, xc.BasePoint); +Vv(kn, xc.BasePoint); is.prototype.point = function(e, r, n) { return new kn(this, e, r, n); }; @@ -11851,7 +11854,7 @@ kn.prototype.toJ = function() { function zn(t, e, r, n) { xc.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new sr(0)) : (this.x = new sr(e, 16), this.y = new sr(r, 16), this.z = new sr(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; } -Kv(zn, xc.BasePoint); +Vv(zn, xc.BasePoint); is.prototype.jpoint = function(e, r, n) { return new zn(this, e, r, n); }; @@ -12164,12 +12167,12 @@ function ba(t) { return new ba(t); this.hash = t.hash, this.predResist = !!t.predResist, this.outLen = this.hash.outSize, this.minEntropy = t.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null; var e = xs.toArray(t.entropy, t.entropyEnc || "hex"), r = xs.toArray(t.nonce, t.nonceEnc || "hex"), n = xs.toArray(t.pers, t.persEnc || "hex"); - Hv( + Kv( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._init(e, r, n); } -var d8 = ba; +var p8 = ba; ba.prototype._init = function(e, r, n) { var i = e.concat(r).concat(n); this.K = new Array(this.outLen / 8), this.V = new Array(this.outLen / 8); @@ -12185,7 +12188,7 @@ ba.prototype._update = function(e) { e && (r = r.update(e)), this.K = r.digest(), this.V = this._hmac().update(this.V).digest(), e && (this.K = this._hmac().update(this.V).update([1]).update(e).digest(), this.V = this._hmac().update(this.V).digest()); }; ba.prototype.reseed = function(e, r, n, i) { - typeof r != "string" && (i = n, n = r, r = null), e = xs.toArray(e, r), n = xs.toArray(n, i), Hv( + typeof r != "string" && (i = n, n = r, r = null), e = xs.toArray(e, r), n = xs.toArray(n, i), Kv( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._update(e.concat(n || [])), this._reseed = 1; @@ -12203,7 +12206,7 @@ var E1 = $i.assert; function Qn(t, e) { this.ec = t, this.priv = null, this.pub = null, e.priv && this._importPrivate(e.priv, e.privEnc), e.pub && this._importPublic(e.pub, e.pubEnc); } -var Vv = Qn; +var Gv = Qn; Qn.fromPublic = function(e, r, n) { return r instanceof Qn ? r : new Qn(e, { pub: r, @@ -12269,7 +12272,7 @@ function im(t, e) { i <<= 8, i |= t[o], i >>>= 0; return i <= 127 ? !1 : (e.place = o, i); } -function Ax(t) { +function Px(t) { for (var e = 0, r = t.length - 1; !t[e] && !(t[e + 1] & 128) && e < r; ) e++; return e === 0 ? t : t.slice(e); @@ -12316,7 +12319,7 @@ function sm(t, e) { } H0.prototype.toDER = function(e) { var r = this.r.toArray(), n = this.s.toArray(); - for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Ax(r), n = Ax(n); !n[0] && !(n[1] & 128); ) + for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Px(r), n = Px(n); !n[0] && !(n[1] & 128); ) n = n.slice(1); var i = [2]; sm(i, r.length), i = i.concat(r), i.push(2), sm(i, n.length); @@ -12328,28 +12331,28 @@ var xU = ( function() { throw new Error("unsupported"); } -), p8 = $i.assert; +), g8 = $i.assert; function Qi(t) { if (!(this instanceof Qi)) return new Qi(t); - typeof t == "string" && (p8( + typeof t == "string" && (g8( Object.prototype.hasOwnProperty.call(Md, t), "Unknown curve " + t ), t = Md[t]), t instanceof Md.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; } var _U = Qi; Qi.prototype.keyPair = function(e) { - return new Vv(this, e); + return new Gv(this, e); }; Qi.prototype.keyFromPrivate = function(e, r) { - return Vv.fromPrivate(this, e, r); + return Gv.fromPrivate(this, e, r); }; Qi.prototype.keyFromPublic = function(e, r) { - return Vv.fromPublic(this, e, r); + return Gv.fromPublic(this, e, r); }; Qi.prototype.genKeyPair = function(e) { e || (e = {}); - for (var r = new d8({ + for (var r = new p8({ hash: this.hash, pers: e.pers, persEnc: e.persEnc || "utf8", @@ -12368,7 +12371,7 @@ Qi.prototype._truncateToN = function(e, r) { }; Qi.prototype.sign = function(e, r, n, i) { typeof n == "object" && (i = n, n = null), i || (i = {}), r = this.keyFromPrivate(r, n), e = this._truncateToN(new sr(e, 16)); - for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new d8({ + for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new p8({ hash: this.hash, entropy: o, nonce: a, @@ -12400,7 +12403,7 @@ Qi.prototype.verify = function(e, r, n, i) { return this.curve._maxwellTrick ? (d = this.g.jmulAdd(u, n.getPublic(), l), d.isInfinity() ? !1 : d.eqXToP(s)) : (d = this.g.mulAdd(u, n.getPublic(), l), d.isInfinity() ? !1 : d.getX().umod(this.n).cmp(s) === 0); }; Qi.prototype.recoverPubKey = function(t, e, r, n) { - p8((3 & r) === r, "The recovery param is more than two bits"), e = new K0(e, n); + g8((3 & r) === r, "The recovery param is more than two bits"), e = new K0(e, n); var i = this.n, s = new sr(t), o = e.r, a = e.s, u = r & 1, l = r >> 1; if (o.cmp(this.curve.p.umod(this.curve.n)) >= 0 && l) throw new Error("Unable to find sencond key candinate"); @@ -12450,14 +12453,14 @@ class PU { const r = aa().keyFromPrivate(wn(this.privateKey)), n = wn(e); n.length !== 32 && S1.throwArgumentError("bad digest length", "digest", e); const i = r.sign(n, { canonical: !0 }); - return K4({ + return V4({ recoveryParam: i.recoveryParam, r: lu("0x" + i.r.toString(16), 32), s: lu("0x" + i.s.toString(16), 32) }); } computeSharedSecret(e) { - const r = aa().keyFromPrivate(wn(this.privateKey)), n = aa().keyFromPublic(wn(g8(e))); + const r = aa().keyFromPrivate(wn(this.privateKey)), n = aa().keyFromPublic(wn(m8(e))); return lu("0x" + r.derive(n.getPublic()).toString(16), 32); } static isSigningKey(e) { @@ -12465,25 +12468,25 @@ class PU { } } function MU(t, e) { - const r = K4(e), n = { r: wn(r.r), s: wn(r.s) }; + const r = V4(e), n = { r: wn(r.r), s: wn(r.s) }; return "0x" + aa().recoverPubKey(wn(t), n, r.recoveryParam).encode("hex", !1); } -function g8(t, e) { +function m8(t, e) { const r = wn(t); return r.length === 32 ? new PU(r).publicKey : r.length === 33 ? "0x" + aa().keyFromPublic(r).getPublic(!1, "hex") : r.length === 65 ? Ri(r) : S1.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); } -var Px; +var Mx; (function(t) { t[t.legacy = 0] = "legacy", t[t.eip2930 = 1] = "eip2930", t[t.eip1559 = 2] = "eip1559"; -})(Px || (Px = {})); +})(Mx || (Mx = {})); function IU(t) { - const e = g8(t); - return qF(vx(qv(vx(e, 1)), 12)); + const e = m8(t); + return qF(bx(zv(bx(e, 1)), 12)); } function CU(t, e) { return IU(MU(wn(t), e)); } -var Gv = {}, V0 = {}; +var Yv = {}, V0 = {}; Object.defineProperty(V0, "__esModule", { value: !0 }); var Gn = ar, A1 = ki, TU = 20; function RU(t, e, r) { @@ -12491,7 +12494,7 @@ function RU(t, e, r) { H = H + R | 0, g ^= H, g = g >>> 16 | g << 16, Y = Y + g | 0, R ^= Y, R = R >>> 20 | R << 12, W = W + K | 0, b ^= W, b = b >>> 16 | b << 16, S = S + b | 0, K ^= S, K = K >>> 20 | K << 12, V = V + ge | 0, x ^= V, x = x >>> 16 | x << 16, m = m + x | 0, ge ^= m, ge = ge >>> 20 | ge << 12, te = te + Ee | 0, _ ^= te, _ = _ >>> 16 | _ << 16, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 20 | Ee << 12, V = V + ge | 0, x ^= V, x = x >>> 24 | x << 8, m = m + x | 0, ge ^= m, ge = ge >>> 25 | ge << 7, te = te + Ee | 0, _ ^= te, _ = _ >>> 24 | _ << 8, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 25 | Ee << 7, W = W + K | 0, b ^= W, b = b >>> 24 | b << 8, S = S + b | 0, K ^= S, K = K >>> 25 | K << 7, H = H + R | 0, g ^= H, g = g >>> 24 | g << 8, Y = Y + g | 0, R ^= Y, R = R >>> 25 | R << 7, H = H + K | 0, _ ^= H, _ = _ >>> 16 | _ << 16, m = m + _ | 0, K ^= m, K = K >>> 20 | K << 12, W = W + ge | 0, g ^= W, g = g >>> 16 | g << 16, f = f + g | 0, ge ^= f, ge = ge >>> 20 | ge << 12, V = V + Ee | 0, b ^= V, b = b >>> 16 | b << 16, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 20 | Ee << 12, te = te + R | 0, x ^= te, x = x >>> 16 | x << 16, S = S + x | 0, R ^= S, R = R >>> 20 | R << 12, V = V + Ee | 0, b ^= V, b = b >>> 24 | b << 8, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 25 | Ee << 7, te = te + R | 0, x ^= te, x = x >>> 24 | x << 8, S = S + x | 0, R ^= S, R = R >>> 25 | R << 7, W = W + ge | 0, g ^= W, g = g >>> 24 | g << 8, f = f + g | 0, ge ^= f, ge = ge >>> 25 | ge << 7, H = H + K | 0, _ ^= H, _ = _ >>> 24 | _ << 8, m = m + _ | 0, K ^= m, K = K >>> 25 | K << 7; Gn.writeUint32LE(H + n | 0, t, 0), Gn.writeUint32LE(W + i | 0, t, 4), Gn.writeUint32LE(V + s | 0, t, 8), Gn.writeUint32LE(te + o | 0, t, 12), Gn.writeUint32LE(R + a | 0, t, 16), Gn.writeUint32LE(K + u | 0, t, 20), Gn.writeUint32LE(ge + l | 0, t, 24), Gn.writeUint32LE(Ee + d | 0, t, 28), Gn.writeUint32LE(Y + p | 0, t, 32), Gn.writeUint32LE(S + w | 0, t, 36), Gn.writeUint32LE(m + A | 0, t, 40), Gn.writeUint32LE(f + M | 0, t, 44), Gn.writeUint32LE(g + N | 0, t, 48), Gn.writeUint32LE(b + L | 0, t, 52), Gn.writeUint32LE(x + B | 0, t, 56), Gn.writeUint32LE(_ + $ | 0, t, 60); } -function m8(t, e, r, n, i) { +function v8(t, e, r, n, i) { if (i === void 0 && (i = 0), t.length !== 32) throw new Error("ChaCha: key size must be 32 bytes"); if (n.length < r.length) @@ -12514,9 +12517,9 @@ function m8(t, e, r, n, i) { } return A1.wipe(a), i === 0 && A1.wipe(s), n; } -V0.streamXOR = m8; +V0.streamXOR = v8; function DU(t, e, r, n) { - return n === void 0 && (n = 0), A1.wipe(r), m8(t, e, r, r, n); + return n === void 0 && (n = 0), A1.wipe(r), v8(t, e, r, r, n); } V0.stream = DU; function OU(t, e, r) { @@ -12525,7 +12528,7 @@ function OU(t, e, r) { if (n > 0) throw new Error("ChaCha: counter overflow"); } -var v8 = {}, Ia = {}; +var b8 = {}, Ia = {}; Object.defineProperty(Ia, "__esModule", { value: !0 }); function NU(t, e, r) { return ~(t - 1) & e | t - 1 & r; @@ -12535,16 +12538,16 @@ function LU(t, e) { return (t | 0) - (e | 0) - 1 >>> 31 & 1; } Ia.lessOrEqual = LU; -function b8(t, e) { +function y8(t, e) { if (t.length !== e.length) return 0; for (var r = 0, n = 0; n < t.length; n++) r |= t[n] ^ e[n]; return 1 & r - 1 >>> 8; } -Ia.compare = b8; +Ia.compare = y8; function kU(t, e) { - return t.length === 0 || e.length === 0 ? !1 : b8(t, e) !== 0; + return t.length === 0 || e.length === 0 ? !1 : y8(t, e) !== 0; } Ia.equal = kU; (function(t) { @@ -12670,10 +12673,10 @@ Ia.equal = kU; return o.length !== t.DIGEST_LENGTH || a.length !== t.DIGEST_LENGTH ? !1 : e.equal(o, a); } t.equal = s; -})(v8); +})(b8); (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - var e = V0, r = v8, n = ki, i = ar, s = Ia; + var e = V0, r = b8, n = ki, i = ar, s = Ia; t.KEY_LENGTH = 32, t.NONCE_LENGTH = 12, t.TAG_LENGTH = 16; var o = new Uint8Array(16), a = ( /** @class */ @@ -12732,15 +12735,15 @@ Ia.equal = kU; }() ); t.ChaCha20Poly1305 = a; -})(Gv); -var y8 = {}, Gl = {}, Yv = {}; -Object.defineProperty(Yv, "__esModule", { value: !0 }); +})(Yv); +var w8 = {}, Gl = {}, Jv = {}; +Object.defineProperty(Jv, "__esModule", { value: !0 }); function $U(t) { return typeof t.saveState < "u" && typeof t.restoreState < "u" && typeof t.cleanSavedState < "u"; } -Yv.isSerializableHash = $U; +Jv.isSerializableHash = $U; Object.defineProperty(Gl, "__esModule", { value: !0 }); -var Ls = Yv, BU = Ia, FU = ki, w8 = ( +var Ls = Jv, BU = Ia, FU = ki, x8 = ( /** @class */ function() { function t(e, r) { @@ -12782,23 +12785,23 @@ var Ls = Yv, BU = Ia, FU = ki, w8 = ( }, t; }() ); -Gl.HMAC = w8; +Gl.HMAC = x8; function jU(t, e, r) { - var n = new w8(t, e); + var n = new x8(t, e); n.update(r); var i = n.digest(); return n.clean(), i; } Gl.hmac = jU; Gl.equal = BU.equal; -Object.defineProperty(y8, "__esModule", { value: !0 }); -var Mx = Gl, Ix = ki, UU = ( +Object.defineProperty(w8, "__esModule", { value: !0 }); +var Ix = Gl, Cx = ki, UU = ( /** @class */ function() { function t(e, r, n, i) { n === void 0 && (n = new Uint8Array(0)), this._counter = new Uint8Array(1), this._hash = e, this._info = i; - var s = Mx.hmac(this._hash, n, r); - this._hmac = new Mx.HMAC(e, s), this._buffer = new Uint8Array(this._hmac.digestLength), this._bufpos = this._buffer.length; + var s = Ix.hmac(this._hash, n, r); + this._hmac = new Ix.HMAC(e, s), this._buffer = new Uint8Array(this._hmac.digestLength), this._bufpos = this._buffer.length; } return t.prototype._fillBuffer = function() { this._counter[0]++; @@ -12811,10 +12814,10 @@ var Mx = Gl, Ix = ki, UU = ( this._bufpos === this._buffer.length && this._fillBuffer(), r[n] = this._buffer[this._bufpos++]; return r; }, t.prototype.clean = function() { - this._hmac.clean(), Ix.wipe(this._buffer), Ix.wipe(this._counter), this._bufpos = 0; + this._hmac.clean(), Cx.wipe(this._buffer), Cx.wipe(this._counter), this._bufpos = 0; }, t; }() -), qU = y8.HKDF = UU, Yl = {}; +), qU = w8.HKDF = UU, Yl = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); var e = ar, r = ki; @@ -12968,7 +12971,7 @@ var Mx = Gl, Ix = ki, UU = ( } t.hash = o; })(Yl); -var Jv = {}; +var Xv = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.sharedKey = t.generateKeyPair = t.generateKeyPairFromSeed = t.scalarMultBase = t.scalarMult = t.SHARED_KEY_LENGTH = t.SECRET_KEY_LENGTH = t.PUBLIC_KEY_LENGTH = void 0; const e = Pa, r = ki; @@ -13098,8 +13101,8 @@ var Jv = {}; return R; } t.sharedKey = H; -})(Jv); -var x8 = {}; +})(Xv); +var _8 = {}; const zU = "elliptic", WU = "6.6.0", HU = "EC cryptography", KU = "lib/elliptic.js", VU = [ "lib" ], GU = { @@ -13156,8 +13159,8 @@ const zU = "elliptic", WU = "6.6.0", HU = "EC cryptography", KU = "lib/elliptic. devDependencies: tq, dependencies: rq }; -var Bi = {}, Xv = { exports: {} }; -Xv.exports; +var Bi = {}, Zv = { exports: {} }; +Zv.exports; (function(t) { (function(e, r) { function n(Y, S) { @@ -14307,8 +14310,8 @@ Xv.exports; return m._forceRed(this); }; })(t, gn); -})(Xv); -var zo = Xv.exports, Zv = {}; +})(Zv); +var zo = Zv.exports, Qv = {}; (function(t) { var e = t; function r(s, o) { @@ -14346,9 +14349,9 @@ var zo = Xv.exports, Zv = {}; e.toHex = i, e.encode = function(o, a) { return a === "hex" ? i(o) : o; }; -})(Zv); +})(Qv); (function(t) { - var e = t, r = zo, n = wc, i = Zv; + var e = t, r = zo, n = wc, i = Qv; e.assert = n, e.toArray = i.toArray, e.zero2 = i.zero2, e.toHex = i.toHex, e.encode = i.encode; function s(d, p, w) { var A = new Array(Math.max(d.bitLength(), w) + 1), M; @@ -14395,14 +14398,14 @@ var zo = Xv.exports, Zv = {}; } e.intFromLE = l; })(Bi); -var Qv = { exports: {} }, am; -Qv.exports = function(e) { +var eb = { exports: {} }, am; +eb.exports = function(e) { return am || (am = new la(null)), am.generate(e); }; function la(t) { this.rand = t; } -Qv.exports.Rand = la; +eb.exports.Rand = la; la.prototype.generate = function(e) { return this._rand(e); }; @@ -14425,15 +14428,15 @@ if (typeof self == "object") }); else try { - var Cx = Wl; - if (typeof Cx.randomBytes != "function") + var Tx = Wl; + if (typeof Tx.randomBytes != "function") throw new Error("Not supported"); la.prototype._rand = function(e) { - return Cx.randomBytes(e); + return Tx.randomBytes(e); }; } catch { } -var _8 = Qv.exports, eb = {}, Wa = zo, Jl = Bi, s0 = Jl.getNAF, iq = Jl.getJSF, o0 = Jl.assert; +var E8 = eb.exports, tb = {}, Wa = zo, Jl = Bi, s0 = Jl.getNAF, iq = Jl.getJSF, o0 = Jl.assert; function Ca(t, e) { this.type = t, this.p = new Wa(e.p, 16), this.red = e.prime ? Wa.red(e.prime) : Wa.mont(this.p), this.zero = new Wa(0).toRed(this.red), this.one = new Wa(1).toRed(this.red), this.two = new Wa(2).toRed(this.red), this.n = e.n && new Wa(e.n, 16), this.g = e.g && this.pointFromJSON(e.g, e.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; var r = this.n && this.p.div(this.n); @@ -14628,11 +14631,11 @@ ss.prototype.dblp = function(e) { r = r.dbl(); return r; }; -var sq = Bi, rn = zo, tb = z0, Fu = G0, oq = sq.assert; +var sq = Bi, rn = zo, rb = z0, Fu = G0, oq = sq.assert; function os(t) { Fu.call(this, "short", t), this.a = new rn(t.a, 16).toRed(this.red), this.b = new rn(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); } -tb(os, Fu); +rb(os, Fu); var aq = os; os.prototype._getEndomorphism = function(e) { if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { @@ -14714,7 +14717,7 @@ os.prototype._endoWnafMulAdd = function(e, r, n) { function $n(t, e, r, n) { Fu.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new rn(e, 16), this.y = new rn(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); } -tb($n, Fu.BasePoint); +rb($n, Fu.BasePoint); os.prototype.point = function(e, r, n) { return new $n(this, e, r, n); }; @@ -14860,7 +14863,7 @@ $n.prototype.toJ = function() { function Wn(t, e, r, n) { Fu.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new rn(0)) : (this.x = new rn(e, 16), this.y = new rn(r, 16), this.z = new rn(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; } -tb(Wn, Fu.BasePoint); +rb(Wn, Fu.BasePoint); os.prototype.jpoint = function(e, r, n) { return new Wn(this, e, r, n); }; @@ -15012,11 +15015,11 @@ Wn.prototype.inspect = function() { Wn.prototype.isInfinity = function() { return this.z.cmpn(0) === 0; }; -var Qc = zo, E8 = z0, Y0 = G0, cq = Bi; +var Qc = zo, S8 = z0, Y0 = G0, cq = Bi; function ju(t) { Y0.call(this, "mont", t), this.a = new Qc(t.a, 16).toRed(this.red), this.b = new Qc(t.b, 16).toRed(this.red), this.i4 = new Qc(4).toRed(this.red).redInvm(), this.two = new Qc(2).toRed(this.red), this.a24 = this.i4.redMul(this.a.redAdd(this.two)); } -E8(ju, Y0); +S8(ju, Y0); var uq = ju; ju.prototype.validate = function(e) { var r = e.normalize().x, n = r.redSqr(), i = n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r), s = i.redSqrt(); @@ -15025,7 +15028,7 @@ ju.prototype.validate = function(e) { function Ln(t, e, r) { Y0.BasePoint.call(this, t, "projective"), e === null && r === null ? (this.x = this.curve.one, this.z = this.curve.zero) : (this.x = new Qc(e, 16), this.z = new Qc(r, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red))); } -E8(Ln, Y0.BasePoint); +S8(Ln, Y0.BasePoint); ju.prototype.decodePoint = function(e, r) { return this.point(cq.toArray(e, r), 1); }; @@ -15082,11 +15085,11 @@ Ln.prototype.normalize = function() { Ln.prototype.getX = function() { return this.normalize(), this.x.fromRed(); }; -var fq = Bi, So = zo, S8 = z0, J0 = G0, lq = fq.assert; +var fq = Bi, So = zo, A8 = z0, J0 = G0, lq = fq.assert; function no(t) { this.twisted = (t.a | 0) !== 1, this.mOneA = this.twisted && (t.a | 0) === -1, this.extended = this.mOneA, J0.call(this, "edwards", t), this.a = new So(t.a, 16).umod(this.red.m), this.a = this.a.toRed(this.red), this.c = new So(t.c, 16).toRed(this.red), this.c2 = this.c.redSqr(), this.d = new So(t.d, 16).toRed(this.red), this.dd = this.d.redAdd(this.d), lq(!this.twisted || this.c.fromRed().cmpn(1) === 0), this.oneC = (t.c | 0) === 1; } -S8(no, J0); +A8(no, J0); var hq = no; no.prototype._mulA = function(e) { return this.mOneA ? e.redNeg() : this.a.redMul(e); @@ -15128,7 +15131,7 @@ no.prototype.validate = function(e) { function Hr(t, e, r, n, i) { J0.BasePoint.call(this, t, "projective"), e === null && r === null && n === null ? (this.x = this.curve.zero, this.y = this.curve.one, this.z = this.curve.one, this.t = this.curve.zero, this.zOne = !0) : (this.x = new So(e, 16), this.y = new So(r, 16), this.z = n ? new So(n, 16) : this.curve.one, this.t = i && new So(i, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.t && !this.t.red && (this.t = this.t.toRed(this.curve.red)), this.zOne = this.z === this.curve.one, this.curve.extended && !this.t && (this.t = this.x.redMul(this.y), this.zOne || (this.t = this.t.redMul(this.z.redInvm())))); } -S8(Hr, J0.BasePoint); +A8(Hr, J0.BasePoint); no.prototype.pointFromJSON = function(e) { return Hr.fromJSON(this, e); }; @@ -15222,10 +15225,10 @@ Hr.prototype.mixedAdd = Hr.prototype.add; (function(t) { var e = t; e.base = G0, e.short = aq, e.mont = uq, e.edwards = hq; -})(eb); -var X0 = {}, cm, Tx; +})(tb); +var X0 = {}, cm, Rx; function dq() { - return Tx || (Tx = 1, cm = { + return Rx || (Rx = 1, cm = { doubles: { step: 4, points: [ @@ -16007,7 +16010,7 @@ function dq() { }), cm; } (function(t) { - var e = t, r = Vl, n = eb, i = Bi, s = i.assert; + var e = t, r = Vl, n = tb, i = Bi, s = i.assert; function o(l) { l.type === "short" ? this.curve = new n.short(l) : l.type === "edwards" ? this.curve = new n.edwards(l) : this.curve = new n.mont(l), this.g = this.curve.g, this.n = this.curve.n, this.hash = l.hash, s(this.g.validate(), "Invalid curve"), s(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); } @@ -16156,13 +16159,13 @@ function dq() { ] }); })(X0); -var pq = Vl, oc = Zv, A8 = wc; +var pq = Vl, oc = Qv, P8 = wc; function ya(t) { if (!(this instanceof ya)) return new ya(t); this.hash = t.hash, this.predResist = !!t.predResist, this.outLen = this.hash.outSize, this.minEntropy = t.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null; var e = oc.toArray(t.entropy, t.entropyEnc || "hex"), r = oc.toArray(t.nonce, t.nonceEnc || "hex"), n = oc.toArray(t.pers, t.persEnc || "hex"); - A8( + P8( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._init(e, r, n); @@ -16183,7 +16186,7 @@ ya.prototype._update = function(e) { e && (r = r.update(e)), this.K = r.digest(), this.V = this._hmac().update(this.V).digest(), e && (this.K = this._hmac().update(this.V).update([1]).update(e).digest(), this.V = this._hmac().update(this.V).digest()); }; ya.prototype.reseed = function(e, r, n, i) { - typeof r != "string" && (i = n, n = r, r = null), e = oc.toArray(e, r), n = oc.toArray(n, i), A8( + typeof r != "string" && (i = n, n = r, r = null), e = oc.toArray(e, r), n = oc.toArray(n, i), P8( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._update(e.concat(n || [])), this._reseed = 1; @@ -16246,7 +16249,7 @@ ei.prototype.verify = function(e, r, n) { ei.prototype.inspect = function() { return ""; }; -var a0 = zo, rb = Bi, yq = rb.assert; +var a0 = zo, nb = Bi, yq = nb.assert; function Z0(t, e) { if (t instanceof Z0) return t; @@ -16267,13 +16270,13 @@ function um(t, e) { i <<= 8, i |= t[o], i >>>= 0; return i <= 127 ? !1 : (e.place = o, i); } -function Rx(t) { +function Dx(t) { for (var e = 0, r = t.length - 1; !t[e] && !(t[e + 1] & 128) && e < r; ) e++; return e === 0 ? t : t.slice(e); } Z0.prototype._importDER = function(e, r) { - e = rb.toArray(e, r); + e = nb.toArray(e, r); var n = new xq(); if (e[n.place++] !== 48) return !1; @@ -16314,35 +16317,35 @@ function fm(t, e) { } Z0.prototype.toDER = function(e) { var r = this.r.toArray(), n = this.s.toArray(); - for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Rx(r), n = Rx(n); !n[0] && !(n[1] & 128); ) + for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Dx(r), n = Dx(n); !n[0] && !(n[1] & 128); ) n = n.slice(1); var i = [2]; fm(i, r.length), i = i.concat(r), i.push(2), fm(i, n.length); var s = i.concat(n), o = [48]; - return fm(o, s.length), o = o.concat(s), rb.encode(o, e); + return fm(o, s.length), o = o.concat(s), nb.encode(o, e); }; -var Ao = zo, P8 = gq, _q = Bi, lm = X0, Eq = _8, M8 = _q.assert, nb = bq, Q0 = wq; +var Ao = zo, M8 = gq, _q = Bi, lm = X0, Eq = E8, I8 = _q.assert, ib = bq, Q0 = wq; function es(t) { if (!(this instanceof es)) return new es(t); - typeof t == "string" && (M8( + typeof t == "string" && (I8( Object.prototype.hasOwnProperty.call(lm, t), "Unknown curve " + t ), t = lm[t]), t instanceof lm.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; } var Sq = es; es.prototype.keyPair = function(e) { - return new nb(this, e); + return new ib(this, e); }; es.prototype.keyFromPrivate = function(e, r) { - return nb.fromPrivate(this, e, r); + return ib.fromPrivate(this, e, r); }; es.prototype.keyFromPublic = function(e, r) { - return nb.fromPublic(this, e, r); + return ib.fromPublic(this, e, r); }; es.prototype.genKeyPair = function(e) { e || (e = {}); - for (var r = new P8({ + for (var r = new M8({ hash: this.hash, pers: e.pers, persEnc: e.persEnc || "utf8", @@ -16371,7 +16374,7 @@ es.prototype._truncateToN = function(e, r, n) { }; es.prototype.sign = function(e, r, n, i) { typeof n == "object" && (i = n, n = null), i || (i = {}), r = this.keyFromPrivate(r, n), e = this._truncateToN(e, !1, i.msgBitLength); - for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new P8({ + for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new M8({ hash: this.hash, entropy: o, nonce: a, @@ -16403,7 +16406,7 @@ es.prototype.verify = function(e, r, n, i, s) { return this.curve._maxwellTrick ? (p = this.g.jmulAdd(l, n.getPublic(), d), p.isInfinity() ? !1 : p.eqXToP(o)) : (p = this.g.mulAdd(l, n.getPublic(), d), p.isInfinity() ? !1 : p.getX().umod(this.n).cmp(o) === 0); }; es.prototype.recoverPubKey = function(t, e, r, n) { - M8((3 & r) === r, "The recovery param is more than two bits"), e = new Q0(e, n); + I8((3 & r) === r, "The recovery param is more than two bits"), e = new Q0(e, n); var i = this.n, s = new Ao(t), o = e.r, a = e.s, u = r & 1, l = r >> 1; if (o.cmp(this.curve.p.umod(this.curve.n)) >= 0 && l) throw new Error("Unable to find sencond key candinate"); @@ -16426,9 +16429,9 @@ es.prototype.getKeyRecoveryParam = function(t, e, r, n) { } throw new Error("Unable to find valid recovery factor"); }; -var Xl = Bi, I8 = Xl.assert, Dx = Xl.parseBytes, Uu = Xl.cachedProperty; +var Xl = Bi, C8 = Xl.assert, Ox = Xl.parseBytes, Uu = Xl.cachedProperty; function Nn(t, e) { - this.eddsa = t, this._secret = Dx(e.secret), t.isPoint(e.pub) ? this._pub = e.pub : this._pubBytes = Dx(e.pub); + this.eddsa = t, this._secret = Ox(e.secret), t.isPoint(e.pub) ? this._pub = e.pub : this._pubBytes = Ox(e.pub); } Nn.fromPublic = function(e, r) { return r instanceof Nn ? r : new Nn(e, { pub: r }); @@ -16459,23 +16462,23 @@ Uu(Nn, "messagePrefix", function() { return this.hash().slice(this.eddsa.encodingLength); }); Nn.prototype.sign = function(e) { - return I8(this._secret, "KeyPair can only verify"), this.eddsa.sign(e, this); + return C8(this._secret, "KeyPair can only verify"), this.eddsa.sign(e, this); }; Nn.prototype.verify = function(e, r) { return this.eddsa.verify(e, r, this); }; Nn.prototype.getSecret = function(e) { - return I8(this._secret, "KeyPair is public only"), Xl.encode(this.secret(), e); + return C8(this._secret, "KeyPair is public only"), Xl.encode(this.secret(), e); }; Nn.prototype.getPublic = function(e) { return Xl.encode(this.pubBytes(), e); }; -var Aq = Nn, Pq = zo, ep = Bi, Ox = ep.assert, tp = ep.cachedProperty, Mq = ep.parseBytes; +var Aq = Nn, Pq = zo, ep = Bi, Nx = ep.assert, tp = ep.cachedProperty, Mq = ep.parseBytes; function _c(t, e) { - this.eddsa = t, typeof e != "object" && (e = Mq(e)), Array.isArray(e) && (Ox(e.length === t.encodingLength * 2, "Signature has invalid size"), e = { + this.eddsa = t, typeof e != "object" && (e = Mq(e)), Array.isArray(e) && (Nx(e.length === t.encodingLength * 2, "Signature has invalid size"), e = { R: e.slice(0, t.encodingLength), S: e.slice(t.encodingLength) - }), Ox(e.R && e.S, "Signature without R or S"), t.isPoint(e.R) && (this._R = e.R), e.S instanceof Pq && (this._S = e.S), this._Rencoded = Array.isArray(e.R) ? e.R : e.Rencoded, this._Sencoded = Array.isArray(e.S) ? e.S : e.Sencoded; + }), Nx(e.R && e.S, "Signature without R or S"), t.isPoint(e.R) && (this._R = e.R), e.S instanceof Pq && (this._S = e.S), this._Rencoded = Array.isArray(e.R) ? e.R : e.Rencoded, this._Sencoded = Array.isArray(e.S) ? e.S : e.Sencoded; } tp(_c, "S", function() { return this.eddsa.decodeInt(this.Sencoded()); @@ -16495,7 +16498,7 @@ _c.prototype.toBytes = function() { _c.prototype.toHex = function() { return ep.encode(this.toBytes(), "hex").toUpperCase(); }; -var Iq = _c, Cq = Vl, Tq = X0, Au = Bi, Rq = Au.assert, C8 = Au.parseBytes, T8 = Aq, Nx = Iq; +var Iq = _c, Cq = Vl, Tq = X0, Au = Bi, Rq = Au.assert, T8 = Au.parseBytes, R8 = Aq, Lx = Iq; function Ei(t) { if (Rq(t === "ed25519", "only tested with ed25519 so far"), !(this instanceof Ei)) return new Ei(t); @@ -16503,12 +16506,12 @@ function Ei(t) { } var Dq = Ei; Ei.prototype.sign = function(e, r) { - e = C8(e); + e = T8(e); var n = this.keyFromSecret(r), i = this.hashInt(n.messagePrefix(), e), s = this.g.mul(i), o = this.encodePoint(s), a = this.hashInt(o, n.pubBytes(), e).mul(n.priv()), u = i.add(a).umod(this.curve.n); return this.makeSignature({ R: s, S: u, Rencoded: o }); }; Ei.prototype.verify = function(e, r, n) { - if (e = C8(e), r = this.makeSignature(r), r.S().gte(r.eddsa.curve.n) || r.S().isNeg()) + if (e = T8(e), r = this.makeSignature(r), r.S().gte(r.eddsa.curve.n) || r.S().isNeg()) return !1; var i = this.keyFromPublic(n), s = this.hashInt(r.Rencoded(), i.pubBytes(), e), o = this.g.mul(r.S()), a = r.R().add(i.pub().mul(s)); return a.eq(o); @@ -16519,13 +16522,13 @@ Ei.prototype.hashInt = function() { return Au.intFromLE(e.digest()).umod(this.curve.n); }; Ei.prototype.keyFromPublic = function(e) { - return T8.fromPublic(this, e); + return R8.fromPublic(this, e); }; Ei.prototype.keyFromSecret = function(e) { - return T8.fromSecret(this, e); + return R8.fromSecret(this, e); }; Ei.prototype.makeSignature = function(e) { - return e instanceof Nx ? e : new Nx(this, e); + return e instanceof Lx ? e : new Lx(this, e); }; Ei.prototype.encodePoint = function(e) { var r = e.getY().toArray("le", this.encodingLength); @@ -16547,19 +16550,19 @@ Ei.prototype.isPoint = function(e) { }; (function(t) { var e = t; - e.version = nq.version, e.utils = Bi, e.rand = _8, e.curve = eb, e.curves = X0, e.ec = Sq, e.eddsa = Dq; -})(x8); + e.version = nq.version, e.utils = Bi, e.rand = E8, e.curve = tb, e.curves = X0, e.ec = Sq, e.eddsa = Dq; +})(_8); const Oq = { waku: { publish: "waku_publish", batchPublish: "waku_batchPublish", subscribe: "waku_subscribe", batchSubscribe: "waku_batchSubscribe", subscription: "waku_subscription", unsubscribe: "waku_unsubscribe", batchUnsubscribe: "waku_batchUnsubscribe", batchFetchMessages: "waku_batchFetchMessages" }, irn: { publish: "irn_publish", batchPublish: "irn_batchPublish", subscribe: "irn_subscribe", batchSubscribe: "irn_batchSubscribe", subscription: "irn_subscription", unsubscribe: "irn_unsubscribe", batchUnsubscribe: "irn_batchUnsubscribe", batchFetchMessages: "irn_batchFetchMessages" }, iridium: { publish: "iridium_publish", batchPublish: "iridium_batchPublish", subscribe: "iridium_subscribe", batchSubscribe: "iridium_batchSubscribe", subscription: "iridium_subscription", unsubscribe: "iridium_unsubscribe", batchUnsubscribe: "iridium_batchUnsubscribe", batchFetchMessages: "iridium_batchFetchMessages" } }, Nq = ":"; function hu(t) { const [e, r] = t.split(Nq); return { namespace: e, reference: r }; } -function R8(t, e) { +function D8(t, e) { return t.includes(":") ? [t] : e.chains || []; } -var Lq = Object.defineProperty, Lx = Object.getOwnPropertySymbols, kq = Object.prototype.hasOwnProperty, $q = Object.prototype.propertyIsEnumerable, kx = (t, e, r) => e in t ? Lq(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, $x = (t, e) => { - for (var r in e || (e = {})) kq.call(e, r) && kx(t, r, e[r]); - if (Lx) for (var r of Lx(e)) $q.call(e, r) && kx(t, r, e[r]); +var Lq = Object.defineProperty, kx = Object.getOwnPropertySymbols, kq = Object.prototype.hasOwnProperty, $q = Object.prototype.propertyIsEnumerable, $x = (t, e, r) => e in t ? Lq(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Bx = (t, e) => { + for (var r in e || (e = {})) kq.call(e, r) && $x(t, r, e[r]); + if (kx) for (var r of kx(e)) $q.call(e, r) && $x(t, r, e[r]); return t; }; const Bq = "ReactNative", Di = { reactNative: "react-native", node: "node", browser: "browser", unknown: "unknown" }, Fq = "js"; @@ -16567,10 +16570,10 @@ function c0() { return typeof process < "u" && typeof process.versions < "u" && typeof process.versions.node < "u"; } function qu() { - return !Kl() && !!Fv() && navigator.product === Bq; + return !Kl() && !!jv() && navigator.product === Bq; } function Zl() { - return !c0() && !!Fv() && !!Kl(); + return !c0() && !!jv() && !!Kl(); } function Ql() { return qu() ? Di.reactNative : c0() ? Di.node : Zl() ? Di.browser : Di.unknown; @@ -16585,10 +16588,10 @@ function jq() { } function Uq(t, e) { let r = xl.parse(t); - return r = $x($x({}, r), e), t = xl.stringify(r), t; + return r = Bx(Bx({}, r), e), t = xl.stringify(r), t; } -function D8() { - return q4() || { name: "", description: "", url: "", icons: [""] }; +function O8() { + return z4() || { name: "", description: "", url: "", icons: [""] }; } function qq() { if (Ql() === Di.reactNative && typeof global < "u" && typeof (global == null ? void 0 : global.Platform) < "u") { @@ -16603,23 +16606,23 @@ function qq() { function zq() { var t; const e = Ql(); - return e === Di.browser ? [e, ((t = U4()) == null ? void 0 : t.host) || "unknown"].join(":") : e; + return e === Di.browser ? [e, ((t = q4()) == null ? void 0 : t.host) || "unknown"].join(":") : e; } -function O8(t, e, r) { +function N8(t, e, r) { const n = qq(), i = zq(); return [[t, e].join("-"), [Fq, r].join("-"), n, i].join("/"); } function Wq({ protocol: t, version: e, relayUrl: r, sdkVersion: n, auth: i, projectId: s, useOnCloseEvent: o, bundleId: a }) { - const u = r.split("?"), l = O8(t, e, n), d = { auth: i, ua: l, projectId: s, useOnCloseEvent: o, origin: a || void 0 }, p = Uq(u[1] || "", d); + const u = r.split("?"), l = N8(t, e, n), d = { auth: i, ua: l, projectId: s, useOnCloseEvent: o, origin: a || void 0 }, p = Uq(u[1] || "", d); return u[0] + "?" + p; } function rc(t, e) { return t.filter((r) => e.includes(r)).length === t.length; } -function N8(t) { +function L8(t) { return Object.fromEntries(t.entries()); } -function L8(t) { +function k8(t) { return new Map(Object.entries(t)); } function Ga(t = mt.FIVE_MINUTES, e) { @@ -16647,7 +16650,7 @@ function du(t, e, r) { clearTimeout(s); }); } -function k8(t, e) { +function $8(t, e) { if (typeof e == "string" && e.startsWith(`${t}:`)) return e; if (t.toLowerCase() === "topic") { if (typeof e != "string") throw new Error('Value must be "string" for expirer target type: topic'); @@ -16659,12 +16662,12 @@ function k8(t, e) { throw new Error(`Unknown expirer target type: ${t}`); } function Hq(t) { - return k8("topic", t); + return $8("topic", t); } function Kq(t) { - return k8("id", t); + return $8("id", t); } -function $8(t) { +function B8(t) { const [e, r] = t.split(":"), n = { id: void 0, topic: void 0 }; if (e === "topic" && typeof r == "string") n.topic = r; else if (e === "id" && Number.isInteger(Number(r))) n.id = Number(r); @@ -16721,18 +16724,18 @@ async function Yq(t, e) { } return r; } -function Bx(t, e) { +function Fx(t, e) { if (!t.includes(e)) return null; const r = t.split(/([&,?,=])/), n = r.indexOf(e); return r[n + 2]; } -function Fx() { +function jx() { return typeof crypto < "u" && crypto != null && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu, (t) => { const e = Math.random() * 16 | 0; return (t === "x" ? e : e & 3 | 8).toString(16); }); } -function ib() { +function sb() { return typeof process < "u" && process.env.IS_VITEST === "true"; } function Jq() { @@ -16742,7 +16745,7 @@ function Xq(t, e = !1) { const r = Buffer.from(t).toString("base64"); return e ? r.replace(/[=]/g, "") : r; } -function B8(t) { +function F8(t) { return Buffer.from(t, "base64").toString("utf-8"); } const Zq = "https://rpc.walletconnect.org/v1"; @@ -16757,13 +16760,13 @@ async function Qq(t, e, r, n, i, s) { } } function ez(t, e, r) { - return CU(V4(e), r).toLowerCase() === t.toLowerCase(); + return CU(G4(e), r).toLowerCase() === t.toLowerCase(); } async function tz(t, e, r, n, i, s) { const o = hu(n); if (!o.namespace || !o.reference) throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`); try { - const a = "0x1626ba7e", u = "0000000000000000000000000000000000000000000000000000000000000040", l = "0000000000000000000000000000000000000000000000000000000000000041", d = r.substring(2), p = V4(e).substring(2), w = a + p + u + l + d, A = await fetch(`${s || Zq}/?chainId=${n}&projectId=${i}`, { method: "POST", body: JSON.stringify({ id: rz(), jsonrpc: "2.0", method: "eth_call", params: [{ to: t, data: w }, "latest"] }) }), { result: M } = await A.json(); + const a = "0x1626ba7e", u = "0000000000000000000000000000000000000000000000000000000000000040", l = "0000000000000000000000000000000000000000000000000000000000000041", d = r.substring(2), p = G4(e).substring(2), w = a + p + u + l + d, A = await fetch(`${s || Zq}/?chainId=${n}&projectId=${i}`, { method: "POST", body: JSON.stringify({ id: rz(), jsonrpc: "2.0", method: "eth_call", params: [{ to: t, data: w }, "latest"] }) }), { result: M } = await A.json(); return M ? M.slice(0, a.length).toLowerCase() === a.toLowerCase() : !1; } catch (a) { return console.error("isValidEip1271Signature: ", a), !1; @@ -16772,26 +16775,26 @@ async function tz(t, e, r, n, i, s) { function rz() { return Date.now() + Math.floor(Math.random() * 1e3); } -var nz = Object.defineProperty, iz = Object.defineProperties, sz = Object.getOwnPropertyDescriptors, jx = Object.getOwnPropertySymbols, oz = Object.prototype.hasOwnProperty, az = Object.prototype.propertyIsEnumerable, Ux = (t, e, r) => e in t ? nz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, cz = (t, e) => { - for (var r in e || (e = {})) oz.call(e, r) && Ux(t, r, e[r]); - if (jx) for (var r of jx(e)) az.call(e, r) && Ux(t, r, e[r]); +var nz = Object.defineProperty, iz = Object.defineProperties, sz = Object.getOwnPropertyDescriptors, Ux = Object.getOwnPropertySymbols, oz = Object.prototype.hasOwnProperty, az = Object.prototype.propertyIsEnumerable, qx = (t, e, r) => e in t ? nz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, cz = (t, e) => { + for (var r in e || (e = {})) oz.call(e, r) && qx(t, r, e[r]); + if (Ux) for (var r of Ux(e)) az.call(e, r) && qx(t, r, e[r]); return t; }, uz = (t, e) => iz(t, sz(e)); -const fz = "did:pkh:", sb = (t) => t == null ? void 0 : t.split(":"), lz = (t) => { - const e = t && sb(t); +const fz = "did:pkh:", ob = (t) => t == null ? void 0 : t.split(":"), lz = (t) => { + const e = t && ob(t); if (e) return t.includes(fz) ? e[3] : e[1]; }, M1 = (t) => { - const e = t && sb(t); + const e = t && ob(t); if (e) return e[2] + ":" + e[3]; }, u0 = (t) => { - const e = t && sb(t); + const e = t && ob(t); if (e) return e.pop(); }; -async function qx(t) { - const { cacao: e, projectId: r } = t, { s: n, p: i } = e, s = F8(i, i.iss), o = u0(i.iss); +async function zx(t) { + const { cacao: e, projectId: r } = t, { s: n, p: i } = e, s = j8(i, i.iss), o = u0(i.iss); return await Qq(o, s, n, M1(i.iss), r); } -const F8 = (t, e) => { +const j8 = (t, e) => { const r = `${t.domain} wants you to sign in with your Ethereum account:`, n = u0(e); if (!t.aud && !t.uri) throw new Error("Either `aud` or `uri` is required to construct the message"); let i = t.statement || void 0; @@ -16838,7 +16841,7 @@ function gz(t, e, r = {}) { const n = e.map((i) => ({ [`${t}/${i}`]: [r] })); return Object.assign({}, ...n); } -function j8(t) { +function U8(t) { return hc(t), `urn:recap:${hz(t).replace(/=/g, "")}`; } function _l(t) { @@ -16847,14 +16850,14 @@ function _l(t) { } function mz(t, e, r) { const n = pz(t, e, r); - return j8(n); + return U8(n); } function vz(t) { return t && t.includes("urn:recap:"); } function bz(t, e) { const r = _l(t), n = _l(e), i = yz(r, n); - return j8(i); + return U8(i); } function yz(t, e) { hc(t), hc(e); @@ -16886,14 +16889,14 @@ function wz(t = "", e) { const s = n.join(" "), o = `${r}${s}`; return `${t ? t + " " : ""}${o}`; } -function zx(t) { +function Wx(t) { var e; const r = _l(t); hc(r); const n = (e = r.att) == null ? void 0 : e.eip155; return n ? Object.keys(n).map((i) => i.split("/")[1]) : []; } -function Wx(t) { +function Hx(t) { const e = _l(t); hc(e); const r = []; @@ -16909,17 +16912,17 @@ function Cd(t) { const e = t == null ? void 0 : t[t.length - 1]; return vz(e) ? e : void 0; } -const U8 = "base10", ai = "base16", ha = "base64pad", Af = "base64url", eh = "utf8", q8 = 0, Co = 1, th = 2, xz = 0, Hx = 1, qf = 12, ob = 32; +const q8 = "base10", ai = "base16", ha = "base64pad", Af = "base64url", eh = "utf8", z8 = 0, Co = 1, th = 2, xz = 0, Kx = 1, qf = 12, ab = 32; function _z() { - const t = Jv.generateKeyPair(); + const t = Xv.generateKeyPair(); return { privateKey: On(t.secretKey, ai), publicKey: On(t.publicKey, ai) }; } function I1() { - const t = Pa.randomBytes(ob); + const t = Pa.randomBytes(ab); return On(t, ai); } function Ez(t, e) { - const r = Jv.sharedKey(Rn(t, ai), Rn(e, ai), !0), n = new qU(Yl.SHA256, r).expand(ob); + const r = Xv.sharedKey(Rn(t, ai), Rn(e, ai), !0), n = new qU(Yl.SHA256, r).expand(ab); return On(n, ai); } function Td(t) { @@ -16930,24 +16933,24 @@ function xo(t) { const e = Yl.hash(Rn(t, eh)); return On(e, ai); } -function z8(t) { - return Rn(`${t}`, U8); +function W8(t) { + return Rn(`${t}`, q8); } function dc(t) { - return Number(On(t, U8)); + return Number(On(t, q8)); } function Sz(t) { - const e = z8(typeof t.type < "u" ? t.type : q8); + const e = W8(typeof t.type < "u" ? t.type : z8); if (dc(e) === Co && typeof t.senderPublicKey > "u") throw new Error("Missing sender public key for type 1 envelope"); - const r = typeof t.senderPublicKey < "u" ? Rn(t.senderPublicKey, ai) : void 0, n = typeof t.iv < "u" ? Rn(t.iv, ai) : Pa.randomBytes(qf), i = new Gv.ChaCha20Poly1305(Rn(t.symKey, ai)).seal(n, Rn(t.message, eh)); - return W8({ type: e, sealed: i, iv: n, senderPublicKey: r, encoding: t.encoding }); + const r = typeof t.senderPublicKey < "u" ? Rn(t.senderPublicKey, ai) : void 0, n = typeof t.iv < "u" ? Rn(t.iv, ai) : Pa.randomBytes(qf), i = new Yv.ChaCha20Poly1305(Rn(t.symKey, ai)).seal(n, Rn(t.message, eh)); + return H8({ type: e, sealed: i, iv: n, senderPublicKey: r, encoding: t.encoding }); } function Az(t, e) { - const r = z8(th), n = Pa.randomBytes(qf), i = Rn(t, eh); - return W8({ type: r, sealed: i, iv: n, encoding: e }); + const r = W8(th), n = Pa.randomBytes(qf), i = Rn(t, eh); + return H8({ type: r, sealed: i, iv: n, encoding: e }); } function Pz(t) { - const e = new Gv.ChaCha20Poly1305(Rn(t.symKey, ai)), { sealed: r, iv: n } = El({ encoded: t.encoded, encoding: t == null ? void 0 : t.encoding }), i = e.open(n, r); + const e = new Yv.ChaCha20Poly1305(Rn(t.symKey, ai)), { sealed: r, iv: n } = El({ encoded: t.encoded, encoding: t == null ? void 0 : t.encoding }), i = e.open(n, r); if (i === null) throw new Error("Failed to decrypt"); return On(i, eh); } @@ -16955,7 +16958,7 @@ function Mz(t, e) { const { sealed: r } = El({ encoded: t, encoding: e }); return On(r, eh); } -function W8(t) { +function H8(t) { const { encoding: e = ha } = t; if (dc(t.type) === th) return On(Sd([t.type, t.sealed]), e); if (dc(t.type) === Co) { @@ -16965,9 +16968,9 @@ function W8(t) { return On(Sd([t.type, t.iv, t.sealed]), e); } function El(t) { - const { encoded: e, encoding: r = ha } = t, n = Rn(e, r), i = n.slice(xz, Hx), s = Hx; + const { encoded: e, encoding: r = ha } = t, n = Rn(e, r), i = n.slice(xz, Kx), s = Kx; if (dc(i) === Co) { - const l = s + ob, d = l + qf, p = n.slice(s, l), w = n.slice(l, d), A = n.slice(d); + const l = s + ab, d = l + qf, p = n.slice(s, l), w = n.slice(l, d), A = n.slice(d); return { type: i, sealed: A, iv: w, senderPublicKey: p }; } if (dc(i) === th) { @@ -16979,24 +16982,24 @@ function El(t) { } function Iz(t, e) { const r = El({ encoded: t, encoding: e == null ? void 0 : e.encoding }); - return H8({ type: dc(r.type), senderPublicKey: typeof r.senderPublicKey < "u" ? On(r.senderPublicKey, ai) : void 0, receiverPublicKey: e == null ? void 0 : e.receiverPublicKey }); + return K8({ type: dc(r.type), senderPublicKey: typeof r.senderPublicKey < "u" ? On(r.senderPublicKey, ai) : void 0, receiverPublicKey: e == null ? void 0 : e.receiverPublicKey }); } -function H8(t) { - const e = (t == null ? void 0 : t.type) || q8; +function K8(t) { + const e = (t == null ? void 0 : t.type) || z8; if (e === Co) { if (typeof (t == null ? void 0 : t.senderPublicKey) > "u") throw new Error("missing sender public key"); if (typeof (t == null ? void 0 : t.receiverPublicKey) > "u") throw new Error("missing receiver public key"); } return { type: e, senderPublicKey: t == null ? void 0 : t.senderPublicKey, receiverPublicKey: t == null ? void 0 : t.receiverPublicKey }; } -function Kx(t) { +function Vx(t) { return t.type === Co && typeof t.senderPublicKey == "string" && typeof t.receiverPublicKey == "string"; } -function Vx(t) { +function Gx(t) { return t.type === th; } function Cz(t) { - return new x8.ec("p256").keyFromPublic({ x: Buffer.from(t.x, "base64").toString("hex"), y: Buffer.from(t.y, "base64").toString("hex") }, "hex"); + return new _8.ec("p256").keyFromPublic({ x: Buffer.from(t.x, "base64").toString("hex"), y: Buffer.from(t.y, "base64").toString("hex") }, "hex"); } function Tz(t) { let e = t.replace(/-/g, "+").replace(/_/g, "/"); @@ -17022,9 +17025,9 @@ function Bf(t) { if (typeof e > "u") throw new Error(`Relay Protocol not supported: ${t}`); return e; } -var Nz = Object.defineProperty, Lz = Object.defineProperties, kz = Object.getOwnPropertyDescriptors, Gx = Object.getOwnPropertySymbols, $z = Object.prototype.hasOwnProperty, Bz = Object.prototype.propertyIsEnumerable, Yx = (t, e, r) => e in t ? Nz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Jx = (t, e) => { - for (var r in e || (e = {})) $z.call(e, r) && Yx(t, r, e[r]); - if (Gx) for (var r of Gx(e)) Bz.call(e, r) && Yx(t, r, e[r]); +var Nz = Object.defineProperty, Lz = Object.defineProperties, kz = Object.getOwnPropertyDescriptors, Yx = Object.getOwnPropertySymbols, $z = Object.prototype.hasOwnProperty, Bz = Object.prototype.propertyIsEnumerable, Jx = (t, e, r) => e in t ? Nz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Xx = (t, e) => { + for (var r in e || (e = {})) $z.call(e, r) && Jx(t, r, e[r]); + if (Yx) for (var r of Yx(e)) Bz.call(e, r) && Jx(t, r, e[r]); return t; }, Fz = (t, e) => Lz(t, kz(e)); function jz(t, e = "-") { @@ -17036,9 +17039,9 @@ function jz(t, e = "-") { } }), r; } -function Xx(t) { +function Zx(t) { if (!t.includes("wc:")) { - const u = B8(t); + const u = F8(t); u != null && u.includes("wc:") && (t = u); } t = t.includes("wc://") ? t.replace("wc://", "") : t, t = t.includes("wc:") ? t.replace("wc:", "") : t; @@ -17055,8 +17058,8 @@ function qz(t, e = "-") { t[i] && (n[s] = t[i]); }), n; } -function Zx(t) { - return `${t.protocol}:${t.topic}@${t.version}?` + xl.stringify(Jx(Fz(Jx({ symKey: t.symKey }, qz(t.relay)), { expiryTimestamp: t.expiryTimestamp }), t.methods ? { methods: t.methods.join(",") } : {})); +function Qx(t) { + return `${t.protocol}:${t.topic}@${t.version}?` + xl.stringify(Xx(Fz(Xx({ symKey: t.symKey }, qz(t.relay)), { expiryTimestamp: t.expiryTimestamp }), t.methods ? { methods: t.methods.join(",") } : {})); } function fd(t, e, r) { return `${t}?wc_ev=${r}&topic=${e}`; @@ -17086,11 +17089,11 @@ function Hz(t, e) { zu(n.accounts).includes(e) && r.push(...n.events); }), r; } -function ab(t) { +function cb(t) { return t.includes(":"); } function Ff(t) { - return ab(t) ? t.split(":")[0] : t; + return cb(t) ? t.split(":")[0] : t; } function Kz(t) { const e = {}; @@ -17099,7 +17102,7 @@ function Kz(t) { e[n] || (e[n] = { accounts: [], chains: [], events: [] }), e[n].accounts.push(r), e[n].chains.push(`${n}:${i}`); }), e; } -function Qx(t, e) { +function e3(t, e) { e = e.map((n) => n.replace("did:pkh:", "")); const r = Kz(e); for (const [n, i] of Object.entries(r)) i.methods ? i.methods = Id(i.methods, t) : i.methods = t, i.events = ["chainChanged", "accountsChanged"]; @@ -17126,7 +17129,7 @@ function mi(t) { function dn(t, e) { return e && mi(t) ? !0 : typeof t == "string" && !!t.trim().length; } -function cb(t, e) { +function ub(t, e) { return typeof t == "number" && !isNaN(t); } function Yz(t, e) { @@ -17134,7 +17137,7 @@ function Yz(t, e) { let s = !0; return rc(i, n) ? (n.forEach((o) => { const { accounts: a, methods: u, events: l } = t.namespaces[o], d = zu(a), p = r[o]; - (!rc(R8(o, p), d) || !rc(p.methods, u) || !rc(p.events, l)) && (s = !1); + (!rc(D8(o, p), d) || !rc(p.methods, u) || !rc(p.events, l)) && (s = !1); }), s) : !1; } function f0(t) { @@ -17161,7 +17164,7 @@ function Xz(t) { try { if (dn(t, !1)) { if (e(t)) return !0; - const r = B8(t); + const r = F8(t); return e(r); } } catch { @@ -17179,7 +17182,7 @@ function eW(t, e) { let r = null; return dn(t == null ? void 0 : t.publicKey, !1) || (r = ft("MISSING_OR_INVALID", `${e} controller public key should be a string`)), r; } -function e3(t) { +function t3(t) { let e = !0; return pc(t) ? t.length && (e = t.every((r) => dn(r, !1))) : e = !1, e; } @@ -17193,7 +17196,7 @@ function rW(t, e, r) { let n = null; return Object.entries(t).forEach(([i, s]) => { if (n) return; - const o = tW(i, R8(i, s), `${e} ${r}`); + const o = tW(i, D8(i, s), `${e} ${r}`); o && (n = o); }), n; } @@ -17213,9 +17216,9 @@ function iW(t, e) { } function sW(t, e) { let r = null; - return e3(t == null ? void 0 : t.methods) ? e3(t == null ? void 0 : t.events) || (r = Or("UNSUPPORTED_EVENTS", `${e}, events should be an array of strings or empty array for no events`)) : r = Or("UNSUPPORTED_METHODS", `${e}, methods should be an array of strings or empty array for no methods`), r; + return t3(t == null ? void 0 : t.methods) ? t3(t == null ? void 0 : t.events) || (r = Or("UNSUPPORTED_EVENTS", `${e}, events should be an array of strings or empty array for no events`)) : r = Or("UNSUPPORTED_METHODS", `${e}, methods should be an array of strings or empty array for no methods`), r; } -function K8(t, e) { +function V8(t, e) { let r = null; return Object.values(t).forEach((n) => { if (r) return; @@ -17226,7 +17229,7 @@ function K8(t, e) { function oW(t, e, r) { let n = null; if (t && Sl(t)) { - const i = K8(t, e); + const i = V8(t, e); i && (n = i); const s = rW(t, e, r); s && (n = s); @@ -17236,20 +17239,20 @@ function oW(t, e, r) { function hm(t, e) { let r = null; if (t && Sl(t)) { - const n = K8(t, e); + const n = V8(t, e); n && (r = n); const i = iW(t, e); i && (r = i); } else r = ft("MISSING_OR_INVALID", `${e}, namespaces should be an object with data`); return r; } -function V8(t) { +function G8(t) { return dn(t.protocol, !0); } function aW(t, e) { let r = !1; return t ? t && pc(t) && t.length && t.forEach((n) => { - r = V8(n); + r = G8(n); }) : r = !0, r; } function cW(t) { @@ -17259,18 +17262,18 @@ function gi(t) { return typeof t < "u" && typeof t !== null; } function uW(t) { - return !(!t || typeof t != "object" || !t.code || !cb(t.code) || !t.message || !dn(t.message, !1)); + return !(!t || typeof t != "object" || !t.code || !ub(t.code) || !t.message || !dn(t.message, !1)); } function fW(t) { return !(mi(t) || !dn(t.method, !1)); } function lW(t) { - return !(mi(t) || mi(t.result) && mi(t.error) || !cb(t.id) || !dn(t.jsonrpc, !1)); + return !(mi(t) || mi(t.result) && mi(t.error) || !ub(t.id) || !dn(t.jsonrpc, !1)); } function hW(t) { return !(mi(t) || !dn(t.name, !1)); } -function t3(t, e) { +function r3(t, e) { return !(!f0(e) || !zz(t).includes(e)); } function dW(t, e, r) { @@ -17279,9 +17282,9 @@ function dW(t, e, r) { function pW(t, e, r) { return dn(r, !1) ? Hz(t, e).includes(r) : !1; } -function r3(t, e, r) { +function n3(t, e, r) { let n = null; - const i = gW(t), s = mW(e), o = Object.keys(i), a = Object.keys(s), u = n3(Object.keys(t)), l = n3(Object.keys(e)), d = u.filter((p) => !l.includes(p)); + const i = gW(t), s = mW(e), o = Object.keys(i), a = Object.keys(s), u = i3(Object.keys(t)), l = i3(Object.keys(e)), d = u.filter((p) => !l.includes(p)); return d.length && (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces keys don't satisfy requiredNamespaces. Required: ${d.toString()} Received: ${Object.keys(e).toString()}`)), rc(o, a) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces chains don't satisfy required namespaces. @@ -17305,7 +17308,7 @@ function gW(t) { }); }), e; } -function n3(t) { +function i3(t) { return [...new Set(t.map((e) => e.includes(":") ? e.split(":")[0] : e))]; } function mW(t) { @@ -17321,9 +17324,9 @@ function mW(t) { }), e; } function vW(t, e) { - return cb(t) && t <= e.max && t >= e.min; + return ub(t) && t <= e.max && t >= e.min; } -function i3() { +function s3() { const t = Ql(); return new Promise((e) => { switch (t) { @@ -17382,31 +17385,31 @@ class Pf { delete dm[e]; } } -const SW = "PARSE_ERROR", AW = "INVALID_REQUEST", PW = "METHOD_NOT_FOUND", MW = "INVALID_PARAMS", G8 = "INTERNAL_ERROR", ub = "SERVER_ERROR", IW = [-32700, -32600, -32601, -32602, -32603], zf = { +const SW = "PARSE_ERROR", AW = "INVALID_REQUEST", PW = "METHOD_NOT_FOUND", MW = "INVALID_PARAMS", Y8 = "INTERNAL_ERROR", fb = "SERVER_ERROR", IW = [-32700, -32600, -32601, -32602, -32603], zf = { [SW]: { code: -32700, message: "Parse error" }, [AW]: { code: -32600, message: "Invalid Request" }, [PW]: { code: -32601, message: "Method not found" }, [MW]: { code: -32602, message: "Invalid params" }, - [G8]: { code: -32603, message: "Internal error" }, - [ub]: { code: -32e3, message: "Server error" } -}, Y8 = ub; + [Y8]: { code: -32603, message: "Internal error" }, + [fb]: { code: -32e3, message: "Server error" } +}, J8 = fb; function CW(t) { return IW.includes(t); } -function s3(t) { - return Object.keys(zf).includes(t) ? zf[t] : zf[Y8]; +function o3(t) { + return Object.keys(zf).includes(t) ? zf[t] : zf[J8]; } function TW(t) { const e = Object.values(zf).find((r) => r.code === t); - return e || zf[Y8]; + return e || zf[J8]; } -function J8(t, e, r) { +function X8(t, e, r) { return t.message.includes("getaddrinfo ENOTFOUND") || t.message.includes("connect ECONNREFUSED") ? new Error(`Unavailable ${r} RPC url at ${e}`) : t; } -var X8 = {}, mo = {}, o3; +var Z8 = {}, mo = {}, a3; function RW() { - if (o3) return mo; - o3 = 1, Object.defineProperty(mo, "__esModule", { value: !0 }), mo.isBrowserCryptoAvailable = mo.getSubtleCrypto = mo.getBrowerCrypto = void 0; + if (a3) return mo; + a3 = 1, Object.defineProperty(mo, "__esModule", { value: !0 }), mo.isBrowserCryptoAvailable = mo.getSubtleCrypto = mo.getBrowerCrypto = void 0; function t() { return (gn == null ? void 0 : gn.crypto) || (gn == null ? void 0 : gn.msCrypto) || {}; } @@ -17421,10 +17424,10 @@ function RW() { } return mo.isBrowserCryptoAvailable = r, mo; } -var vo = {}, a3; +var vo = {}, c3; function DW() { - if (a3) return vo; - a3 = 1, Object.defineProperty(vo, "__esModule", { value: !0 }), vo.isBrowser = vo.isNode = vo.isReactNative = void 0; + if (c3) return vo; + c3 = 1, Object.defineProperty(vo, "__esModule", { value: !0 }), vo.isBrowser = vo.isNode = vo.isReactNative = void 0; function t() { return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative"; } @@ -17442,7 +17445,7 @@ function DW() { Object.defineProperty(t, "__esModule", { value: !0 }); const e = jl; e.__exportStar(RW(), t), e.__exportStar(DW(), t); -})(X8); +})(Z8); function ua(t = 3) { const e = Date.now() * Math.pow(10, t), r = Math.floor(Math.random() * Math.pow(10, t)); return e + r; @@ -17473,7 +17476,7 @@ function np(t, e, r) { }; } function OW(t, e) { - return typeof t > "u" ? s3(G8) : (typeof t == "string" && (t = Object.assign(Object.assign({}, s3(ub)), { message: t })), CW(t.code) && (t = TW(t.code)), t); + return typeof t > "u" ? o3(Y8) : (typeof t == "string" && (t = Object.assign(Object.assign({}, o3(fb)), { message: t })), CW(t.code) && (t = TW(t.code)), t); } let NW = class { }, LW = class extends NW { @@ -17491,27 +17494,27 @@ function FW(t) { if (!(!e || !e.length)) return e[0]; } -function Z8(t, e) { +function Q8(t, e) { const r = FW(t); return typeof r > "u" ? !1 : new RegExp(e).test(r); } -function c3(t) { - return Z8(t, $W); -} function u3(t) { - return Z8(t, BW); + return Q8(t, $W); +} +function f3(t) { + return Q8(t, BW); } function jW(t) { return new RegExp("wss?://localhost(:d{2,5})?").test(t); } -function Q8(t) { +function eE(t) { return typeof t == "object" && "id" in t && "jsonrpc" in t && t.jsonrpc === "2.0"; } -function fb(t) { - return Q8(t) && "method" in t; +function lb(t) { + return eE(t) && "method" in t; } function ip(t) { - return Q8(t) && (js(t) || Zi(t)); + return eE(t) && (js(t) || Zi(t)); } function js(t) { return "result" in t; @@ -17580,10 +17583,10 @@ let as = class extends kW { this.hasRegisteredEventListeners || (this.connection.on("payload", (e) => this.onPayload(e)), this.connection.on("close", (e) => this.onClose(e)), this.connection.on("error", (e) => this.events.emit("error", e)), this.connection.on("register_error", (e) => this.onClose()), this.hasRegisteredEventListeners = !0); } }; -const UW = () => typeof WebSocket < "u" ? WebSocket : typeof global < "u" && typeof global.WebSocket < "u" ? global.WebSocket : typeof window < "u" && typeof window.WebSocket < "u" ? window.WebSocket : typeof self < "u" && typeof self.WebSocket < "u" ? self.WebSocket : require("ws"), qW = () => typeof WebSocket < "u" || typeof global < "u" && typeof global.WebSocket < "u" || typeof window < "u" && typeof window.WebSocket < "u" || typeof self < "u" && typeof self.WebSocket < "u", f3 = (t) => t.split("?")[0], l3 = 10, zW = UW(); +const UW = () => typeof WebSocket < "u" ? WebSocket : typeof global < "u" && typeof global.WebSocket < "u" ? global.WebSocket : typeof window < "u" && typeof window.WebSocket < "u" ? window.WebSocket : typeof self < "u" && typeof self.WebSocket < "u" ? self.WebSocket : require("ws"), qW = () => typeof WebSocket < "u" || typeof global < "u" && typeof global.WebSocket < "u" || typeof window < "u" && typeof window.WebSocket < "u" || typeof self < "u" && typeof self.WebSocket < "u", l3 = (t) => t.split("?")[0], h3 = 10, zW = UW(); let WW = class { constructor(e) { - if (this.url = e, this.events = new rs.EventEmitter(), this.registering = !1, !u3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); + if (this.url = e, this.events = new rs.EventEmitter(), this.registering = !1, !f3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); this.url = e; } get connected() { @@ -17627,7 +17630,7 @@ let WW = class { } } register(e = this.url) { - if (!u3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); + if (!f3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); if (this.registering) { const r = this.events.getMaxListeners(); return (this.events.listenerCount("register_error") >= r || this.events.listenerCount("open") >= r) && this.events.setMaxListeners(r + 1), new Promise((n, i) => { @@ -17640,7 +17643,7 @@ let WW = class { }); } return this.url = e, this.registering = !0, new Promise((r, n) => { - const i = new URLSearchParams(e).get("origin"), s = X8.isReactNative() ? { headers: { origin: i } } : { rejectUnauthorized: !jW(e) }, o = new zW(e, [], s); + const i = new URLSearchParams(e).get("origin"), s = Z8.isReactNative() ? { headers: { origin: i } } : { rejectUnauthorized: !jW(e) }, o = new zW(e, [], s); qW() ? o.onerror = (a) => { const u = a; n(this.emitError(u.error)); @@ -17667,13 +17670,13 @@ let WW = class { this.events.emit("payload", s); } parseError(e, r = this.url) { - return J8(e, f3(r), "WS"); + return X8(e, l3(r), "WS"); } resetMaxListeners() { - this.events.getMaxListeners() > l3 && this.events.setMaxListeners(l3); + this.events.getMaxListeners() > h3 && this.events.setMaxListeners(h3); } emitError(e) { - const r = this.parseError(new Error((e == null ? void 0 : e.message) || `WebSocket connection failed for host: ${f3(this.url)}`)); + const r = this.parseError(new Error((e == null ? void 0 : e.message) || `WebSocket connection failed for host: ${l3(this.url)}`)); return this.events.emit("register_error", r), r; } }; @@ -18156,7 +18159,7 @@ l0.exports; t.exports = Op; })(l0, l0.exports); var HW = l0.exports; -const KW = /* @__PURE__ */ ts(HW), eE = "wc", tE = 2, rE = "core", Qs = `${eE}@2:${rE}:`, VW = { logger: "error" }, GW = { database: ":memory:" }, YW = "crypto", h3 = "client_ed25519_seed", JW = mt.ONE_DAY, XW = "keychain", ZW = "0.3", QW = "messages", eH = "0.3", tH = mt.SIX_HOURS, rH = "publisher", nE = "irn", nH = "error", iE = "wss://relay.walletconnect.org", iH = "relayer", oi = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", publish: "relayer_publish" }, sH = "_subscription", Vi = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, oH = 0.1, T1 = "2.17.2", zr = { link_mode: "link_mode", relay: "relay" }, aH = "0.3", cH = "WALLETCONNECT_CLIENT_ID", d3 = "WALLETCONNECT_LINK_MODE_APPS", Us = { created: "subscription_created", deleted: "subscription_deleted", sync: "subscription_sync", resubscribed: "subscription_resubscribed" }, uH = "subscription", fH = "0.3", lH = mt.FIVE_SECONDS * 1e3, hH = "pairing", dH = "0.3", Mf = { wc_pairingDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1e3 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1001 } }, wc_pairingPing: { req: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1002 }, res: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1003 } }, unregistered_method: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 } } }, Za = { create: "pairing_create", expire: "pairing_expire", delete: "pairing_delete", ping: "pairing_ping" }, ms = { created: "history_created", updated: "history_updated", deleted: "history_deleted", sync: "history_sync" }, pH = "history", gH = "0.3", mH = "expirer", Ji = { created: "expirer_created", deleted: "expirer_deleted", expired: "expirer_expired", sync: "expirer_sync" }, vH = "0.3", bH = "verify-api", yH = "https://verify.walletconnect.com", sE = "https://verify.walletconnect.org", Wf = sE, wH = `${Wf}/v3`, xH = [yH, sE], _H = "echo", EH = "https://echo.walletconnect.com", Fs = { pairing_started: "pairing_started", pairing_uri_validation_success: "pairing_uri_validation_success", pairing_uri_not_expired: "pairing_uri_not_expired", store_new_pairing: "store_new_pairing", subscribing_pairing_topic: "subscribing_pairing_topic", subscribe_pairing_topic_success: "subscribe_pairing_topic_success", existing_pairing: "existing_pairing", pairing_not_expired: "pairing_not_expired", emit_inactive_pairing: "emit_inactive_pairing", emit_session_proposal: "emit_session_proposal" }, wo = { no_internet_connection: "no_internet_connection", malformed_pairing_uri: "malformed_pairing_uri", active_pairing_already_exists: "active_pairing_already_exists", subscribe_pairing_topic_failure: "subscribe_pairing_topic_failure", pairing_expired: "pairing_expired", proposal_listener_not_found: "proposal_listener_not_found" }, vs = { session_approve_started: "session_approve_started", session_namespaces_validation_success: "session_namespaces_validation_success", subscribing_session_topic: "subscribing_session_topic", subscribe_session_topic_success: "subscribe_session_topic_success", publishing_session_approve: "publishing_session_approve", session_approve_publish_success: "session_approve_publish_success", store_session: "store_session", publishing_session_settle: "publishing_session_settle", session_settle_publish_success: "session_settle_publish_success" }, Ha = { no_internet_connection: "no_internet_connection", proposal_expired: "proposal_expired", subscribe_session_topic_failure: "subscribe_session_topic_failure", session_approve_publish_failure: "session_approve_publish_failure", session_settle_publish_failure: "session_settle_publish_failure", session_approve_namespace_validation_failure: "session_approve_namespace_validation_failure", proposal_not_found: "proposal_not_found" }, Ka = { authenticated_session_approve_started: "authenticated_session_approve_started", create_authenticated_session_topic: "create_authenticated_session_topic", cacaos_verified: "cacaos_verified", store_authenticated_session: "store_authenticated_session", subscribing_authenticated_session_topic: "subscribing_authenticated_session_topic", subscribe_authenticated_session_topic_success: "subscribe_authenticated_session_topic_success", publishing_authenticated_session_approve: "publishing_authenticated_session_approve" }, If = { no_internet_connection: "no_internet_connection", invalid_cacao: "invalid_cacao", subscribe_authenticated_session_topic_failure: "subscribe_authenticated_session_topic_failure", authenticated_session_approve_publish_failure: "authenticated_session_approve_publish_failure", authenticated_session_pending_request_not_found: "authenticated_session_pending_request_not_found" }, SH = 0.1, AH = "event-client", PH = 86400, MH = "https://pulse.walletconnect.org/batch"; +const KW = /* @__PURE__ */ ts(HW), tE = "wc", rE = 2, nE = "core", Qs = `${tE}@2:${nE}:`, VW = { logger: "error" }, GW = { database: ":memory:" }, YW = "crypto", d3 = "client_ed25519_seed", JW = mt.ONE_DAY, XW = "keychain", ZW = "0.3", QW = "messages", eH = "0.3", tH = mt.SIX_HOURS, rH = "publisher", iE = "irn", nH = "error", sE = "wss://relay.walletconnect.org", iH = "relayer", oi = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", publish: "relayer_publish" }, sH = "_subscription", Vi = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, oH = 0.1, T1 = "2.17.2", zr = { link_mode: "link_mode", relay: "relay" }, aH = "0.3", cH = "WALLETCONNECT_CLIENT_ID", p3 = "WALLETCONNECT_LINK_MODE_APPS", Us = { created: "subscription_created", deleted: "subscription_deleted", sync: "subscription_sync", resubscribed: "subscription_resubscribed" }, uH = "subscription", fH = "0.3", lH = mt.FIVE_SECONDS * 1e3, hH = "pairing", dH = "0.3", Mf = { wc_pairingDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1e3 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1001 } }, wc_pairingPing: { req: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1002 }, res: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1003 } }, unregistered_method: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 } } }, Za = { create: "pairing_create", expire: "pairing_expire", delete: "pairing_delete", ping: "pairing_ping" }, ms = { created: "history_created", updated: "history_updated", deleted: "history_deleted", sync: "history_sync" }, pH = "history", gH = "0.3", mH = "expirer", Ji = { created: "expirer_created", deleted: "expirer_deleted", expired: "expirer_expired", sync: "expirer_sync" }, vH = "0.3", bH = "verify-api", yH = "https://verify.walletconnect.com", oE = "https://verify.walletconnect.org", Wf = oE, wH = `${Wf}/v3`, xH = [yH, oE], _H = "echo", EH = "https://echo.walletconnect.com", Fs = { pairing_started: "pairing_started", pairing_uri_validation_success: "pairing_uri_validation_success", pairing_uri_not_expired: "pairing_uri_not_expired", store_new_pairing: "store_new_pairing", subscribing_pairing_topic: "subscribing_pairing_topic", subscribe_pairing_topic_success: "subscribe_pairing_topic_success", existing_pairing: "existing_pairing", pairing_not_expired: "pairing_not_expired", emit_inactive_pairing: "emit_inactive_pairing", emit_session_proposal: "emit_session_proposal" }, wo = { no_internet_connection: "no_internet_connection", malformed_pairing_uri: "malformed_pairing_uri", active_pairing_already_exists: "active_pairing_already_exists", subscribe_pairing_topic_failure: "subscribe_pairing_topic_failure", pairing_expired: "pairing_expired", proposal_listener_not_found: "proposal_listener_not_found" }, vs = { session_approve_started: "session_approve_started", session_namespaces_validation_success: "session_namespaces_validation_success", subscribing_session_topic: "subscribing_session_topic", subscribe_session_topic_success: "subscribe_session_topic_success", publishing_session_approve: "publishing_session_approve", session_approve_publish_success: "session_approve_publish_success", store_session: "store_session", publishing_session_settle: "publishing_session_settle", session_settle_publish_success: "session_settle_publish_success" }, Ha = { no_internet_connection: "no_internet_connection", proposal_expired: "proposal_expired", subscribe_session_topic_failure: "subscribe_session_topic_failure", session_approve_publish_failure: "session_approve_publish_failure", session_settle_publish_failure: "session_settle_publish_failure", session_approve_namespace_validation_failure: "session_approve_namespace_validation_failure", proposal_not_found: "proposal_not_found" }, Ka = { authenticated_session_approve_started: "authenticated_session_approve_started", create_authenticated_session_topic: "create_authenticated_session_topic", cacaos_verified: "cacaos_verified", store_authenticated_session: "store_authenticated_session", subscribing_authenticated_session_topic: "subscribing_authenticated_session_topic", subscribe_authenticated_session_topic_success: "subscribe_authenticated_session_topic_success", publishing_authenticated_session_approve: "publishing_authenticated_session_approve" }, If = { no_internet_connection: "no_internet_connection", invalid_cacao: "invalid_cacao", subscribe_authenticated_session_topic_failure: "subscribe_authenticated_session_topic_failure", authenticated_session_approve_publish_failure: "authenticated_session_approve_publish_failure", authenticated_session_pending_request_not_found: "authenticated_session_pending_request_not_found" }, SH = 0.1, AH = "event-client", PH = 86400, MH = "https://pulse.walletconnect.org/batch"; function IH(t, e) { if (t.length >= 255) throw new TypeError("Alphabet too long"); for (var r = new Uint8Array(256), n = 0; n < r.length; n++) r[n] = 255; @@ -18207,7 +18210,7 @@ function IH(t, e) { return { encode: p, decodeUnsafe: w, decode: A }; } var CH = IH, TH = CH; -const oE = (t) => { +const aE = (t) => { if (t instanceof Uint8Array && t.constructor.name === "Uint8Array") return t; if (t instanceof ArrayBuffer) return new Uint8Array(t); if (ArrayBuffer.isView(t)) return new Uint8Array(t.buffer, t.byteOffset, t.byteLength); @@ -18234,7 +18237,7 @@ class NH { } else throw Error("Can only multibase decode strings"); } or(e) { - return aE(this, e); + return cE(this, e); } } class LH { @@ -18242,7 +18245,7 @@ class LH { this.decoders = e; } or(e) { - return aE(this, e); + return cE(this, e); } decode(e) { const r = e[0], n = this.decoders[r]; @@ -18250,7 +18253,7 @@ class LH { throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`); } } -const aE = (t, e) => new LH({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); +const cE = (t, e) => new LH({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); class kH { constructor(e, r, n, i) { this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new OH(e, r, n), this.decoder = new NH(e, r, i); @@ -18264,7 +18267,7 @@ class kH { } const sp = ({ name: t, prefix: e, encode: r, decode: n }) => new kH(t, e, r, n), rh = ({ prefix: t, name: e, alphabet: r }) => { const { encode: n, decode: i } = TH(r, e); - return sp({ prefix: t, name: e, encode: n, decode: (s) => oE(i(s)) }); + return sp({ prefix: t, name: e, encode: n, decode: (s) => aE(i(s)) }); }, $H = (t, e, r, n) => { const i = {}; for (let d = 0; d < e.length; ++d) i[e[d]] = d; @@ -18307,7 +18310,7 @@ const uK = rh({ name: "base58btc", prefix: "z", alphabet: "123456789ABCDEFGHJKLM var lK = Object.freeze({ __proto__: null, base58btc: uK, base58flickr: fK }); const hK = Hn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 }), dK = Hn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 }), pK = Hn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 }), gK = Hn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", bitsPerChar: 6 }); var mK = Object.freeze({ __proto__: null, base64: hK, base64pad: dK, base64url: pK, base64urlpad: gK }); -const cE = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), vK = cE.reduce((t, e, r) => (t[r] = e, t), []), bK = cE.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); +const uE = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), vK = uE.reduce((t, e, r) => (t[r] = e, t), []), bK = uE.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); function yK(t) { return t.reduce((e, r) => (e += vK[r], e), ""); } @@ -18321,35 +18324,35 @@ function wK(t) { return new Uint8Array(e); } const xK = sp({ prefix: "🚀", name: "base256emoji", encode: yK, decode: wK }); -var _K = Object.freeze({ __proto__: null, base256emoji: xK }), EK = uE, p3 = 128, SK = 127, AK = ~SK, PK = Math.pow(2, 31); -function uE(t, e, r) { +var _K = Object.freeze({ __proto__: null, base256emoji: xK }), EK = fE, g3 = 128, SK = 127, AK = ~SK, PK = Math.pow(2, 31); +function fE(t, e, r) { e = e || [], r = r || 0; - for (var n = r; t >= PK; ) e[r++] = t & 255 | p3, t /= 128; - for (; t & AK; ) e[r++] = t & 255 | p3, t >>>= 7; - return e[r] = t | 0, uE.bytes = r - n + 1, e; + for (var n = r; t >= PK; ) e[r++] = t & 255 | g3, t /= 128; + for (; t & AK; ) e[r++] = t & 255 | g3, t >>>= 7; + return e[r] = t | 0, fE.bytes = r - n + 1, e; } -var MK = R1, IK = 128, g3 = 127; +var MK = R1, IK = 128, m3 = 127; function R1(t, n) { var r = 0, n = n || 0, i = 0, s = n, o, a = t.length; do { if (s >= a) throw R1.bytes = 0, new RangeError("Could not decode varint"); - o = t[s++], r += i < 28 ? (o & g3) << i : (o & g3) * Math.pow(2, i), i += 7; + o = t[s++], r += i < 28 ? (o & m3) << i : (o & m3) * Math.pow(2, i), i += 7; } while (o >= IK); return R1.bytes = s - n, r; } var CK = Math.pow(2, 7), TK = Math.pow(2, 14), RK = Math.pow(2, 21), DK = Math.pow(2, 28), OK = Math.pow(2, 35), NK = Math.pow(2, 42), LK = Math.pow(2, 49), kK = Math.pow(2, 56), $K = Math.pow(2, 63), BK = function(t) { return t < CK ? 1 : t < TK ? 2 : t < RK ? 3 : t < DK ? 4 : t < OK ? 5 : t < NK ? 6 : t < LK ? 7 : t < kK ? 8 : t < $K ? 9 : 10; -}, FK = { encode: EK, decode: MK, encodingLength: BK }, fE = FK; -const m3 = (t, e, r = 0) => (fE.encode(t, e, r), e), v3 = (t) => fE.encodingLength(t), D1 = (t, e) => { - const r = e.byteLength, n = v3(t), i = n + v3(r), s = new Uint8Array(i + r); - return m3(t, s, 0), m3(r, s, n), s.set(e, i), new jK(t, r, e, s); +}, FK = { encode: EK, decode: MK, encodingLength: BK }, lE = FK; +const v3 = (t, e, r = 0) => (lE.encode(t, e, r), e), b3 = (t) => lE.encodingLength(t), D1 = (t, e) => { + const r = e.byteLength, n = b3(t), i = n + b3(r), s = new Uint8Array(i + r); + return v3(t, s, 0), v3(r, s, n), s.set(e, i), new jK(t, r, e, s); }; class jK { constructor(e, r, n, i) { this.code = e, this.size = r, this.digest = n, this.bytes = i; } } -const lE = ({ name: t, code: e, encode: r }) => new UK(t, e, r); +const hE = ({ name: t, code: e, encode: r }) => new UK(t, e, r); class UK { constructor(e, r, n) { this.name = e, this.code = r, this.encode = n; @@ -18361,20 +18364,20 @@ class UK { } else throw Error("Unknown type, must be binary type"); } } -const hE = (t) => async (e) => new Uint8Array(await crypto.subtle.digest(t, e)), qK = lE({ name: "sha2-256", code: 18, encode: hE("SHA-256") }), zK = lE({ name: "sha2-512", code: 19, encode: hE("SHA-512") }); +const dE = (t) => async (e) => new Uint8Array(await crypto.subtle.digest(t, e)), qK = hE({ name: "sha2-256", code: 18, encode: dE("SHA-256") }), zK = hE({ name: "sha2-512", code: 19, encode: dE("SHA-512") }); var WK = Object.freeze({ __proto__: null, sha256: qK, sha512: zK }); -const dE = 0, HK = "identity", pE = oE, KK = (t) => D1(dE, pE(t)), VK = { code: dE, name: HK, encode: pE, digest: KK }; +const pE = 0, HK = "identity", gE = aE, KK = (t) => D1(pE, gE(t)), VK = { code: pE, name: HK, encode: gE, digest: KK }; var GK = Object.freeze({ __proto__: null, identity: VK }); new TextEncoder(), new TextDecoder(); -const b3 = { ...jH, ...qH, ...WH, ...KH, ...YH, ...sK, ...cK, ...lK, ...mK, ..._K }; +const y3 = { ...jH, ...qH, ...WH, ...KH, ...YH, ...sK, ...cK, ...lK, ...mK, ..._K }; ({ ...WK, ...GK }); function YK(t = 0) { return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); } -function gE(t, e, r, n) { +function mE(t, e, r, n) { return { name: t, prefix: e, encoder: { name: t, prefix: e, encode: r }, decoder: { decode: n } }; } -const y3 = gE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), pm = gE("ascii", "a", (t) => { +const w3 = mE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), pm = mE("ascii", "a", (t) => { let e = "a"; for (let r = 0; r < t.length; r++) e += String.fromCharCode(t[r]); return e; @@ -18383,7 +18386,7 @@ const y3 = gE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) = const e = YK(t.length); for (let r = 0; r < t.length; r++) e[r] = t.charCodeAt(r); return e; -}), JK = { utf8: y3, "utf-8": y3, hex: b3.base16, latin1: pm, ascii: pm, binary: pm, ...b3 }; +}), JK = { utf8: w3, "utf-8": w3, hex: y3.base16, latin1: pm, ascii: pm, binary: pm, ...y3 }; function XK(t, e = "utf8") { const r = JK[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); @@ -18417,11 +18420,11 @@ let ZK = class { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; } async setKeyChain(e) { - await this.core.storage.setItem(this.storageKey, N8(e)); + await this.core.storage.setItem(this.storageKey, L8(e)); } async getKeyChain() { const e = await this.core.storage.getItem(this.storageKey); - return typeof e < "u" ? L8(e) : void 0; + return typeof e < "u" ? k8(e) : void 0; } async persist() { await this.setKeyChain(this.keychain); @@ -18438,15 +18441,15 @@ let ZK = class { this.initialized || (await this.keychain.init(), this.initialized = !0); }, this.hasKeys = (i) => (this.isInitialized(), this.keychain.has(i)), this.getClientId = async () => { this.isInitialized(); - const i = await this.getClientSeed(), s = ix(i); - return j4(s.publicKey); + const i = await this.getClientSeed(), s = sx(i); + return U4(s.publicKey); }, this.generateKeyPair = () => { this.isInitialized(); const i = _z(); return this.setPrivateKey(i.publicKey, i.privateKey); }, this.signJWT = async (i) => { this.isInitialized(); - const s = await this.getClientSeed(), o = ix(s), a = this.randomSessionIdentifier; + const s = await this.getClientSeed(), o = sx(s), a = this.randomSessionIdentifier; return await HB(a, i, JW, o); }, this.generateSharedKey = (i, s, o) => { this.isInitialized(); @@ -18462,9 +18465,9 @@ let ZK = class { this.isInitialized(), await this.keychain.del(i); }, this.encode = async (i, s, o) => { this.isInitialized(); - const a = H8(o), u = $o(s); - if (Vx(a)) return Az(u, o == null ? void 0 : o.encoding); - if (Kx(a)) { + const a = K8(o), u = $o(s); + if (Gx(a)) return Az(u, o == null ? void 0 : o.encoding); + if (Vx(a)) { const w = a.senderPublicKey, A = a.receiverPublicKey; i = await this.generateSharedKey(w, A); } @@ -18473,11 +18476,11 @@ let ZK = class { }, this.decode = async (i, s, o) => { this.isInitialized(); const a = Iz(s, o); - if (Vx(a)) { + if (Gx(a)) { const u = Mz(s, o == null ? void 0 : o.encoding); return fc(u); } - if (Kx(a)) { + if (Vx(a)) { const u = a.receiverPublicKey, l = a.senderPublicKey; i = await this.generateSharedKey(u, l); } @@ -18507,9 +18510,9 @@ let ZK = class { async getClientSeed() { let e = ""; try { - e = this.keychain.get(h3); + e = this.keychain.get(d3); } catch { - e = I1(), await this.keychain.set(h3, e); + e = I1(), await this.keychain.set(d3, e); } return XK(e, "base16"); } @@ -18561,11 +18564,11 @@ class eV extends Xk { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; } async setRelayerMessages(e) { - await this.core.storage.setItem(this.storageKey, N8(e)); + await this.core.storage.setItem(this.storageKey, L8(e)); } async getRelayerMessages() { const e = await this.core.storage.getItem(this.storageKey); - return typeof e < "u" ? L8(e) : void 0; + return typeof e < "u" ? k8(e) : void 0; } async persist() { await this.setRelayerMessages(this.messages); @@ -18660,9 +18663,9 @@ class rV { return Array.from(this.map.keys()); } } -var nV = Object.defineProperty, iV = Object.defineProperties, sV = Object.getOwnPropertyDescriptors, w3 = Object.getOwnPropertySymbols, oV = Object.prototype.hasOwnProperty, aV = Object.prototype.propertyIsEnumerable, x3 = (t, e, r) => e in t ? nV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Cf = (t, e) => { - for (var r in e || (e = {})) oV.call(e, r) && x3(t, r, e[r]); - if (w3) for (var r of w3(e)) aV.call(e, r) && x3(t, r, e[r]); +var nV = Object.defineProperty, iV = Object.defineProperties, sV = Object.getOwnPropertyDescriptors, x3 = Object.getOwnPropertySymbols, oV = Object.prototype.hasOwnProperty, aV = Object.prototype.propertyIsEnumerable, _3 = (t, e, r) => e in t ? nV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Cf = (t, e) => { + for (var r in e || (e = {})) oV.call(e, r) && _3(t, r, e[r]); + if (x3) for (var r of x3(e)) aV.call(e, r) && _3(t, r, e[r]); return t; }, gm = (t, e) => iV(t, sV(e)); class cV extends t$ { @@ -18911,9 +18914,9 @@ class cV extends t$ { }); } } -var uV = Object.defineProperty, _3 = Object.getOwnPropertySymbols, fV = Object.prototype.hasOwnProperty, lV = Object.prototype.propertyIsEnumerable, E3 = (t, e, r) => e in t ? uV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, S3 = (t, e) => { - for (var r in e || (e = {})) fV.call(e, r) && E3(t, r, e[r]); - if (_3) for (var r of _3(e)) lV.call(e, r) && E3(t, r, e[r]); +var uV = Object.defineProperty, E3 = Object.getOwnPropertySymbols, fV = Object.prototype.hasOwnProperty, lV = Object.prototype.propertyIsEnumerable, S3 = (t, e, r) => e in t ? uV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, A3 = (t, e) => { + for (var r in e || (e = {})) fV.call(e, r) && S3(t, r, e[r]); + if (E3) for (var r of E3(e)) lV.call(e, r) && S3(t, r, e[r]); return t; }; class hV extends Qk { @@ -18959,7 +18962,7 @@ class hV extends Qk { this.logger.error(r), this.events.emit(oi.error, r), this.logger.info("Fatal socket error received, closing transport"), this.transportClose(); }, this.registerProviderListeners = () => { this.provider.on(Vi.payload, this.onPayloadHandler), this.provider.on(Vi.connect, this.onConnectHandler), this.provider.on(Vi.disconnect, this.onDisconnectHandler), this.provider.on(Vi.error, this.onProviderErrorHandler); - }, this.core = e.core, this.logger = typeof e.logger < "u" && typeof e.logger != "string" ? ci(e.logger, this.name) : ql($0({ level: e.logger || nH })), this.messages = new eV(this.logger, e.core), this.subscriber = new cV(this, this.logger), this.publisher = new tV(this, this.logger), this.relayUrl = (e == null ? void 0 : e.relayUrl) || iE, this.projectId = e.projectId, this.bundleId = jq(), this.provider = {}; + }, this.core = e.core, this.logger = typeof e.logger < "u" && typeof e.logger != "string" ? ci(e.logger, this.name) : ql($0({ level: e.logger || nH })), this.messages = new eV(this.logger, e.core), this.subscriber = new cV(this, this.logger), this.publisher = new tV(this, this.logger), this.relayUrl = (e == null ? void 0 : e.relayUrl) || sE, this.projectId = e.projectId, this.bundleId = jq(), this.provider = {}; } async init() { if (this.logger.trace("Initialized"), this.registerEventListeners(), await Promise.all([this.messages.init(), this.subscriber.init()]), this.initialized = !0, this.subscriber.cached.length > 0) try { @@ -18993,7 +18996,7 @@ class hV extends Qk { return await Promise.all([new Promise((d) => { u = d, this.subscriber.on(Us.created, l); }), new Promise(async (d, p) => { - a = await this.subscriber.subscribe(e, S3({ internal: { throwOnFailedPublish: o } }, r)).catch((w) => { + a = await this.subscriber.subscribe(e, A3({ internal: { throwOnFailedPublish: o } }, r)).catch((w) => { o && p(w); }) || a, d(); })]), a; @@ -19051,7 +19054,7 @@ class hV extends Qk { this.connectionAttemptInProgress || (this.relayUrl = e || this.relayUrl, await this.confirmOnlineStateOrThrow(), await this.transportClose(), await this.transportOpen()); } async confirmOnlineStateOrThrow() { - if (!await i3()) throw new Error("No internet connection detected. Please restart your network and try again."); + if (!await s3()) throw new Error("No internet connection detected. Please restart your network and try again."); } async handleBatchMessageEvents(e) { if ((e == null ? void 0 : e.length) === 0) { @@ -19105,10 +19108,10 @@ class hV extends Qk { return i && this.logger.debug(`Ignoring duplicate message: ${n}`), i; } async onProviderPayload(e) { - if (this.logger.debug("Incoming Relay Payload"), this.logger.trace({ type: "payload", direction: "incoming", payload: e }), fb(e)) { + if (this.logger.debug("Incoming Relay Payload"), this.logger.trace({ type: "payload", direction: "incoming", payload: e }), lb(e)) { if (!e.method.endsWith(sH)) return; const r = e.params, { topic: n, message: i, publishedAt: s, attestation: o } = r.data, a = { topic: n, message: i, publishedAt: s, transportType: zr.relay, attestation: o }; - this.logger.debug("Emitting Relayer Payload"), this.logger.trace(S3({ type: "event", event: r.id }, a)), this.events.emit(r.id, a), await this.acknowledgePayload(e), await this.onMessageEvent(a); + this.logger.debug("Emitting Relayer Payload"), this.logger.trace(A3({ type: "event", event: r.id }, a)), this.events.emit(r.id, a), await this.acknowledgePayload(e), await this.onMessageEvent(a); } else ip(e) && this.events.emit(oi.message_ack, e); } async onMessageEvent(e) { @@ -19122,7 +19125,7 @@ class hV extends Qk { this.provider.off(Vi.payload, this.onPayloadHandler), this.provider.off(Vi.connect, this.onConnectHandler), this.provider.off(Vi.disconnect, this.onDisconnectHandler), this.provider.off(Vi.error, this.onProviderErrorHandler), clearTimeout(this.pingTimeout); } async registerEventListeners() { - let e = await i3(); + let e = await s3(); xW(async (r) => { e !== r && (e = r, r ? await this.restartTransport().catch((n) => this.logger.error(n)) : (this.hasExperiencedNetworkDisruption = !0, await this.transportDisconnect(), this.transportExplicitlyClosed = !1)); }); @@ -19146,9 +19149,9 @@ class hV extends Qk { }), await this.transportOpen()); } } -var dV = Object.defineProperty, A3 = Object.getOwnPropertySymbols, pV = Object.prototype.hasOwnProperty, gV = Object.prototype.propertyIsEnumerable, P3 = (t, e, r) => e in t ? dV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, M3 = (t, e) => { - for (var r in e || (e = {})) pV.call(e, r) && P3(t, r, e[r]); - if (A3) for (var r of A3(e)) gV.call(e, r) && P3(t, r, e[r]); +var dV = Object.defineProperty, P3 = Object.getOwnPropertySymbols, pV = Object.prototype.hasOwnProperty, gV = Object.prototype.propertyIsEnumerable, M3 = (t, e, r) => e in t ? dV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, I3 = (t, e) => { + for (var r in e || (e = {})) pV.call(e, r) && M3(t, r, e[r]); + if (P3) for (var r of P3(e)) gV.call(e, r) && M3(t, r, e[r]); return t; }; class Ec extends e$ { @@ -19161,7 +19164,7 @@ class Ec extends e$ { this.isInitialized(), this.map.has(o) ? await this.update(o, a) : (this.logger.debug("Setting value"), this.logger.trace({ type: "method", method: "set", key: o, value: a }), this.map.set(o, a), await this.persist()); }, this.get = (o) => (this.isInitialized(), this.logger.debug("Getting value"), this.logger.trace({ type: "method", method: "get", key: o }), this.getData(o)), this.getAll = (o) => (this.isInitialized(), o ? this.values.filter((a) => Object.keys(o).every((u) => KW(a[u], o[u]))) : this.values), this.update = async (o, a) => { this.isInitialized(), this.logger.debug("Updating value"), this.logger.trace({ type: "method", method: "update", key: o, update: a }); - const u = M3(M3({}, this.getData(o)), a); + const u = I3(I3({}, this.getData(o)), a); this.map.set(o, u), await this.persist(); }, this.delete = async (o, a) => { this.isInitialized(), this.map.has(o) && (this.logger.debug("Deleting value"), this.logger.trace({ type: "method", method: "delete", key: o, reason: a }), this.map.delete(o), this.addToRecentlyDeleted(o), await this.persist()); @@ -19228,19 +19231,19 @@ class Ec extends e$ { } class mV { constructor(e, r) { - this.core = e, this.logger = r, this.name = hH, this.version = dH, this.events = new kv(), this.initialized = !1, this.storagePrefix = Qs, this.ignoredPayloadTypes = [Co], this.registeredMethods = [], this.init = async () => { + this.core = e, this.logger = r, this.name = hH, this.version = dH, this.events = new $v(), this.initialized = !1, this.storagePrefix = Qs, this.ignoredPayloadTypes = [Co], this.registeredMethods = [], this.init = async () => { this.initialized || (await this.pairings.init(), await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.initialized = !0, this.logger.trace("Initialized")); }, this.register = ({ methods: n }) => { this.isInitialized(), this.registeredMethods = [.../* @__PURE__ */ new Set([...this.registeredMethods, ...n])]; }, this.create = async (n) => { this.isInitialized(); - const i = I1(), s = await this.core.crypto.setSymKey(i), o = En(mt.FIVE_MINUTES), a = { protocol: nE }, u = { topic: s, expiry: o, relay: a, active: !1, methods: n == null ? void 0 : n.methods }, l = Zx({ protocol: this.core.protocol, version: this.core.version, topic: s, symKey: i, relay: a, expiryTimestamp: o, methods: n == null ? void 0 : n.methods }); + const i = I1(), s = await this.core.crypto.setSymKey(i), o = En(mt.FIVE_MINUTES), a = { protocol: iE }, u = { topic: s, expiry: o, relay: a, active: !1, methods: n == null ? void 0 : n.methods }, l = Qx({ protocol: this.core.protocol, version: this.core.version, topic: s, symKey: i, relay: a, expiryTimestamp: o, methods: n == null ? void 0 : n.methods }); return this.events.emit(Za.create, u), this.core.expirer.set(s, o), await this.pairings.set(s, u), await this.core.relayer.subscribe(s, { transportType: n == null ? void 0 : n.transportType }), { topic: s, uri: l }; }, this.pair = async (n) => { this.isInitialized(); const i = this.core.eventClient.createEvent({ properties: { topic: n == null ? void 0 : n.uri, trace: [Fs.pairing_started] } }); this.isValidPair(n, i); - const { topic: s, symKey: o, relay: a, expiryTimestamp: u, methods: l } = Xx(n.uri); + const { topic: s, symKey: o, relay: a, expiryTimestamp: u, methods: l } = Zx(n.uri); i.props.properties.topic = s, i.addTrace(Fs.pairing_uri_validation_success), i.addTrace(Fs.pairing_uri_not_expired); let d; if (this.pairings.keys.includes(s)) { @@ -19284,7 +19287,7 @@ class mV { }, this.formatUriFromPairing = (n) => { this.isInitialized(); const { topic: i, relay: s, expiry: o, methods: a } = n, u = this.core.crypto.keychain.get(i); - return Zx({ protocol: this.core.protocol, version: this.core.version, topic: i, symKey: u, relay: s, expiryTimestamp: o, methods: a }); + return Qx({ protocol: this.core.protocol, version: this.core.version, topic: i, symKey: u, relay: s, expiryTimestamp: o, methods: a }); }, this.sendRequest = async (n, i, s) => { const o = da(i, s), a = await this.core.crypto.encode(n, o), u = Mf[i].req; return this.core.history.set(n, o), this.core.relayer.publish(n, a, u), o.id; @@ -19357,7 +19360,7 @@ class mV { const { message: a } = ft("MISSING_OR_INVALID", `pair() uri: ${n.uri}`); throw i.setError(wo.malformed_pairing_uri), new Error(a); } - const o = Xx(n == null ? void 0 : n.uri); + const o = Zx(n == null ? void 0 : n.uri); if (!((s = o == null ? void 0 : o.relay) != null && s.protocol)) { const { message: a } = ft("MISSING_OR_INVALID", "pair() uri#relay-protocol"); throw i.setError(wo.malformed_pairing_uri), new Error(a); @@ -19416,7 +19419,7 @@ class mV { if (!this.pairings.keys.includes(r) || i === zr.link_mode || this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n))) return; const s = await this.core.crypto.decode(r, n); try { - fb(s) ? (this.core.history.set(r, s), this.onRelayEventRequest({ topic: r, payload: s })) : ip(s) && (await this.core.history.resolve(s), await this.onRelayEventResponse({ topic: r, payload: s }), this.core.history.delete(r, s.id)); + lb(s) ? (this.core.history.set(r, s), this.onRelayEventRequest({ topic: r, payload: s })) : ip(s) && (await this.core.history.resolve(s), await this.onRelayEventResponse({ topic: r, payload: s }), this.core.history.delete(r, s.id)); } catch (o) { this.logger.error(o); } @@ -19424,7 +19427,7 @@ class mV { } registerExpirerEvents() { this.core.expirer.on(Ji.expired, async (e) => { - const { topic: r } = $8(e.target); + const { topic: r } = B8(e.target); r && this.pairings.keys.includes(r) && (await this.deletePairing(r, !0), this.events.emit(Za.expire, { topic: r })); }); } @@ -19660,7 +19663,7 @@ class bV extends r$ { } class yV extends n$ { constructor(e, r, n) { - super(e, r, n), this.core = e, this.logger = r, this.store = n, this.name = bH, this.verifyUrlV3 = wH, this.storagePrefix = Qs, this.version = tE, this.init = async () => { + super(e, r, n), this.core = e, this.logger = r, this.store = n, this.name = bH, this.verifyUrlV3 = wH, this.storagePrefix = Qs, this.version = rE, this.init = async () => { var i; this.isDevEnv || (this.publicKey = await this.store.getItem(this.storeKey), this.publicKey && mt.toMiliseconds((i = this.publicKey) == null ? void 0 : i.expiresAt) < Date.now() && (this.logger.debug("verify v2 public key expired"), await this.removePublicKey())); }, this.register = async (i) => { @@ -19757,7 +19760,7 @@ class yV extends n$ { const o = Dz(i, s.publicKey), a = { hasExpired: mt.toMiliseconds(o.exp) < Date.now(), payload: o }; if (a.hasExpired) throw this.logger.warn("resolve: jwt attestation expired"), new Error("JWT attestation expired"); return { origin: a.payload.origin, isScam: a.payload.isScam, isVerified: a.payload.isVerified }; - }, this.logger = ci(r, this.name), this.abortController = new AbortController(), this.isDevEnv = ib(), this.init(); + }, this.logger = ci(r, this.name), this.abortController = new AbortController(), this.isDevEnv = sb(), this.init(); } get storeKey() { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//verify:public:key"; @@ -19777,22 +19780,22 @@ class wV extends i$ { }, this.logger = ci(r, this.context); } } -var xV = Object.defineProperty, I3 = Object.getOwnPropertySymbols, _V = Object.prototype.hasOwnProperty, EV = Object.prototype.propertyIsEnumerable, C3 = (t, e, r) => e in t ? xV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Tf = (t, e) => { - for (var r in e || (e = {})) _V.call(e, r) && C3(t, r, e[r]); - if (I3) for (var r of I3(e)) EV.call(e, r) && C3(t, r, e[r]); +var xV = Object.defineProperty, C3 = Object.getOwnPropertySymbols, _V = Object.prototype.hasOwnProperty, EV = Object.prototype.propertyIsEnumerable, T3 = (t, e, r) => e in t ? xV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Tf = (t, e) => { + for (var r in e || (e = {})) _V.call(e, r) && T3(t, r, e[r]); + if (C3) for (var r of C3(e)) EV.call(e, r) && T3(t, r, e[r]); return t; }; class SV extends s$ { constructor(e, r, n = !0) { super(e, r, n), this.core = e, this.logger = r, this.context = AH, this.storagePrefix = Qs, this.storageVersion = SH, this.events = /* @__PURE__ */ new Map(), this.shouldPersist = !1, this.init = async () => { - if (!ib()) try { - const i = { eventId: Fx(), timestamp: Date.now(), domain: this.getAppDomain(), props: { event: "INIT", type: "", properties: { client_id: await this.core.crypto.getClientId(), user_agent: O8(this.core.relayer.protocol, this.core.relayer.version, T1) } } }; + if (!sb()) try { + const i = { eventId: jx(), timestamp: Date.now(), domain: this.getAppDomain(), props: { event: "INIT", type: "", properties: { client_id: await this.core.crypto.getClientId(), user_agent: N8(this.core.relayer.protocol, this.core.relayer.version, T1) } } }; await this.sendEvent([i]); } catch (i) { this.logger.warn(i); } }, this.createEvent = (i) => { - const { event: s = "ERROR", type: o = "", properties: { topic: a, trace: u } } = i, l = Fx(), d = this.core.projectId || "", p = Date.now(), w = Tf({ eventId: l, timestamp: p, props: { event: s, type: o, properties: { topic: a, trace: u } }, bundleId: d, domain: this.getAppDomain() }, this.setMethods(l)); + const { event: s = "ERROR", type: o = "", properties: { topic: a, trace: u } } = i, l = jx(), d = this.core.projectId || "", p = Date.now(), w = Tf({ eventId: l, timestamp: p, props: { event: s, type: o, properties: { topic: a, trace: u } }, bundleId: d, domain: this.getAppDomain() }, this.setMethods(l)); return this.telemetryEnabled && (this.events.set(l, w), this.shouldPersist = !0), w; }, this.getEvent = (i) => { const { eventId: s, topic: o } = i; @@ -19838,7 +19841,7 @@ class SV extends s$ { }, this.sendEvent = async (i) => { const s = this.getAppDomain() ? "" : "&sp=desktop"; return await fetch(`${MH}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${T1}${s}`, { method: "POST", body: JSON.stringify(i) }); - }, this.getAppDomain = () => D8().url, this.logger = ci(r, this.context), this.telemetryEnabled = n, n ? this.restore().then(async () => { + }, this.getAppDomain = () => O8().url, this.logger = ci(r, this.context), this.telemetryEnabled = n, n ? this.restore().then(async () => { await this.submit(), this.setEventListeners(); }) : this.persist(); } @@ -19846,27 +19849,27 @@ class SV extends s$ { return this.storagePrefix + this.storageVersion + this.core.customStoragePrefix + "//" + this.context; } } -var AV = Object.defineProperty, T3 = Object.getOwnPropertySymbols, PV = Object.prototype.hasOwnProperty, MV = Object.prototype.propertyIsEnumerable, R3 = (t, e, r) => e in t ? AV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, D3 = (t, e) => { - for (var r in e || (e = {})) PV.call(e, r) && R3(t, r, e[r]); - if (T3) for (var r of T3(e)) MV.call(e, r) && R3(t, r, e[r]); +var AV = Object.defineProperty, R3 = Object.getOwnPropertySymbols, PV = Object.prototype.hasOwnProperty, MV = Object.prototype.propertyIsEnumerable, D3 = (t, e, r) => e in t ? AV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, O3 = (t, e) => { + for (var r in e || (e = {})) PV.call(e, r) && D3(t, r, e[r]); + if (R3) for (var r of R3(e)) MV.call(e, r) && D3(t, r, e[r]); return t; }; -class lb extends Yk { +class hb extends Yk { constructor(e) { var r; - super(e), this.protocol = eE, this.version = tE, this.name = rE, this.events = new rs.EventEmitter(), this.initialized = !1, this.on = (o, a) => this.events.on(o, a), this.once = (o, a) => this.events.once(o, a), this.off = (o, a) => this.events.off(o, a), this.removeListener = (o, a) => this.events.removeListener(o, a), this.dispatchEnvelope = ({ topic: o, message: a, sessionExists: u }) => { + super(e), this.protocol = tE, this.version = rE, this.name = nE, this.events = new rs.EventEmitter(), this.initialized = !1, this.on = (o, a) => this.events.on(o, a), this.once = (o, a) => this.events.once(o, a), this.off = (o, a) => this.events.off(o, a), this.removeListener = (o, a) => this.events.removeListener(o, a), this.dispatchEnvelope = ({ topic: o, message: a, sessionExists: u }) => { if (!o || !a) return; const l = { topic: o, message: a, publishedAt: Date.now(), transportType: zr.link_mode }; this.relayer.onLinkMessageEvent(l, { sessionExists: u }); - }, this.projectId = e == null ? void 0 : e.projectId, this.relayUrl = (e == null ? void 0 : e.relayUrl) || iE, this.customStoragePrefix = e != null && e.customStoragePrefix ? `:${e.customStoragePrefix}` : ""; + }, this.projectId = e == null ? void 0 : e.projectId, this.relayUrl = (e == null ? void 0 : e.relayUrl) || sE, this.customStoragePrefix = e != null && e.customStoragePrefix ? `:${e.customStoragePrefix}` : ""; const n = $0({ level: typeof (e == null ? void 0 : e.logger) == "string" && e.logger ? e.logger : VW.logger }), { logger: i, chunkLoggerController: s } = Gk({ opts: n, maxSizeInBytes: e == null ? void 0 : e.maxLogBlobSizeInBytes, loggerOverride: e == null ? void 0 : e.logger }); this.logChunkController = s, (r = this.logChunkController) != null && r.downloadLogsBlobInBrowser && (window.downloadLogsBlobInBrowser = async () => { var o, a; (o = this.logChunkController) != null && o.downloadLogsBlobInBrowser && ((a = this.logChunkController) == null || a.downloadLogsBlobInBrowser({ clientId: await this.crypto.getClientId() })); - }), this.logger = ci(i, this.name), this.heartbeat = new qL(), this.crypto = new QK(this, this.logger, e == null ? void 0 : e.keychain), this.history = new vV(this, this.logger), this.expirer = new bV(this, this.logger), this.storage = e != null && e.storage ? e.storage : new wk(D3(D3({}, GW), e == null ? void 0 : e.storageOptions)), this.relayer = new hV({ core: this, logger: this.logger, relayUrl: this.relayUrl, projectId: this.projectId }), this.pairing = new mV(this, this.logger), this.verify = new yV(this, this.logger, this.storage), this.echoClient = new wV(this.projectId || "", this.logger), this.linkModeSupportedApps = [], this.eventClient = new SV(this, this.logger, e == null ? void 0 : e.telemetryEnabled); + }), this.logger = ci(i, this.name), this.heartbeat = new qL(), this.crypto = new QK(this, this.logger, e == null ? void 0 : e.keychain), this.history = new vV(this, this.logger), this.expirer = new bV(this, this.logger), this.storage = e != null && e.storage ? e.storage : new wk(O3(O3({}, GW), e == null ? void 0 : e.storageOptions)), this.relayer = new hV({ core: this, logger: this.logger, relayUrl: this.relayUrl, projectId: this.projectId }), this.pairing = new mV(this, this.logger), this.verify = new yV(this, this.logger, this.storage), this.echoClient = new wV(this.projectId || "", this.logger), this.linkModeSupportedApps = [], this.eventClient = new SV(this, this.logger, e == null ? void 0 : e.telemetryEnabled); } static async init(e) { - const r = new lb(e); + const r = new hb(e); await r.initialize(); const n = await r.crypto.getClientId(); return await r.storage.setItem(cH, n), r; @@ -19882,26 +19885,26 @@ class lb extends Yk { return (e = this.logChunkController) == null ? void 0 : e.logsToBlob({ clientId: await this.crypto.getClientId() }); } async addLinkModeSupportedApp(e) { - this.linkModeSupportedApps.includes(e) || (this.linkModeSupportedApps.push(e), await this.storage.setItem(d3, this.linkModeSupportedApps)); + this.linkModeSupportedApps.includes(e) || (this.linkModeSupportedApps.push(e), await this.storage.setItem(p3, this.linkModeSupportedApps)); } async initialize() { this.logger.trace("Initialized"); try { - await this.crypto.init(), await this.history.init(), await this.expirer.init(), await this.relayer.init(), await this.heartbeat.init(), await this.pairing.init(), this.eventClient.init(), this.linkModeSupportedApps = await this.storage.getItem(d3) || [], this.initialized = !0, this.logger.info("Core Initialization Success"); + await this.crypto.init(), await this.history.init(), await this.expirer.init(), await this.relayer.init(), await this.heartbeat.init(), await this.pairing.init(), this.eventClient.init(), this.linkModeSupportedApps = await this.storage.getItem(p3) || [], this.initialized = !0, this.logger.info("Core Initialization Success"); } catch (e) { throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`, e), this.logger.error(e.message), e; } } } -const IV = lb, mE = "wc", vE = 2, bE = "client", hb = `${mE}@${vE}:${bE}:`, mm = { name: bE, logger: "error" }, O3 = "WALLETCONNECT_DEEPLINK_CHOICE", CV = "proposal", yE = "Proposal expired", TV = "session", Kc = mt.SEVEN_DAYS, RV = "engine", In = { wc_sessionPropose: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1100 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1101 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1120 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1121 } }, wc_sessionSettle: { req: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1102 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1103 } }, wc_sessionUpdate: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1104 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1105 } }, wc_sessionExtend: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1106 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1107 } }, wc_sessionRequest: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1108 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1109 } }, wc_sessionEvent: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1110 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1111 } }, wc_sessionDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1112 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1113 } }, wc_sessionPing: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1114 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1115 } }, wc_sessionAuthenticate: { req: { ttl: mt.ONE_HOUR, prompt: !0, tag: 1116 }, res: { ttl: mt.ONE_HOUR, prompt: !1, tag: 1117 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1118 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1119 } } }, vm = { min: mt.FIVE_MINUTES, max: mt.SEVEN_DAYS }, ks = { idle: "IDLE", active: "ACTIVE" }, DV = "request", OV = ["wc_sessionPropose", "wc_sessionRequest", "wc_authRequest", "wc_sessionAuthenticate"], NV = "wc", LV = "auth", kV = "authKeys", $V = "pairingTopics", BV = "requests", op = `${NV}@${1.5}:${LV}:`, Rd = `${op}:PUB_KEY`; -var FV = Object.defineProperty, jV = Object.defineProperties, UV = Object.getOwnPropertyDescriptors, N3 = Object.getOwnPropertySymbols, qV = Object.prototype.hasOwnProperty, zV = Object.prototype.propertyIsEnumerable, L3 = (t, e, r) => e in t ? FV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, tn = (t, e) => { - for (var r in e || (e = {})) qV.call(e, r) && L3(t, r, e[r]); - if (N3) for (var r of N3(e)) zV.call(e, r) && L3(t, r, e[r]); +const IV = hb, vE = "wc", bE = 2, yE = "client", db = `${vE}@${bE}:${yE}:`, mm = { name: yE, logger: "error" }, N3 = "WALLETCONNECT_DEEPLINK_CHOICE", CV = "proposal", wE = "Proposal expired", TV = "session", Kc = mt.SEVEN_DAYS, RV = "engine", In = { wc_sessionPropose: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1100 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1101 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1120 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1121 } }, wc_sessionSettle: { req: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1102 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1103 } }, wc_sessionUpdate: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1104 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1105 } }, wc_sessionExtend: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1106 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1107 } }, wc_sessionRequest: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1108 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1109 } }, wc_sessionEvent: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1110 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1111 } }, wc_sessionDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1112 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1113 } }, wc_sessionPing: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1114 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1115 } }, wc_sessionAuthenticate: { req: { ttl: mt.ONE_HOUR, prompt: !0, tag: 1116 }, res: { ttl: mt.ONE_HOUR, prompt: !1, tag: 1117 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1118 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1119 } } }, vm = { min: mt.FIVE_MINUTES, max: mt.SEVEN_DAYS }, ks = { idle: "IDLE", active: "ACTIVE" }, DV = "request", OV = ["wc_sessionPropose", "wc_sessionRequest", "wc_authRequest", "wc_sessionAuthenticate"], NV = "wc", LV = "auth", kV = "authKeys", $V = "pairingTopics", BV = "requests", op = `${NV}@${1.5}:${LV}:`, Rd = `${op}:PUB_KEY`; +var FV = Object.defineProperty, jV = Object.defineProperties, UV = Object.getOwnPropertyDescriptors, L3 = Object.getOwnPropertySymbols, qV = Object.prototype.hasOwnProperty, zV = Object.prototype.propertyIsEnumerable, k3 = (t, e, r) => e in t ? FV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, tn = (t, e) => { + for (var r in e || (e = {})) qV.call(e, r) && k3(t, r, e[r]); + if (L3) for (var r of L3(e)) zV.call(e, r) && k3(t, r, e[r]); return t; }, bs = (t, e) => jV(t, UV(e)); class WV extends a$ { constructor(e) { - super(e), this.name = RV, this.events = new kv(), this.initialized = !1, this.requestQueue = { state: ks.idle, queue: [] }, this.sessionRequestQueue = { state: ks.idle, queue: [] }, this.requestQueueDelay = mt.ONE_SECOND, this.expectedPairingMethodMap = /* @__PURE__ */ new Map(), this.recentlyDeletedMap = /* @__PURE__ */ new Map(), this.recentlyDeletedLimit = 200, this.relayMessageCache = [], this.init = async () => { + super(e), this.name = RV, this.events = new $v(), this.initialized = !1, this.requestQueue = { state: ks.idle, queue: [] }, this.sessionRequestQueue = { state: ks.idle, queue: [] }, this.requestQueueDelay = mt.ONE_SECOND, this.expectedPairingMethodMap = /* @__PURE__ */ new Map(), this.recentlyDeletedMap = /* @__PURE__ */ new Map(), this.recentlyDeletedLimit = 200, this.relayMessageCache = [], this.init = async () => { this.initialized || (await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.registerPairingEvents(), await this.registerLinkModeListeners(), this.client.core.pairing.register({ methods: Object.keys(In) }), this.initialized = !0, setTimeout(() => { this.sessionRequestQueue.queue = this.getPendingSessionRequests(), this.processSessionRequestQueue(); }, mt.toMiliseconds(this.requestQueueDelay))); @@ -19924,7 +19927,7 @@ class WV extends a$ { const { message: W } = ft("NO_MATCHING_KEY", `connect() pairing topic: ${l}`); throw new Error(W); } - const w = await this.client.core.crypto.generateKeyPair(), A = In.wc_sessionPropose.req.ttl || mt.FIVE_MINUTES, M = En(A), N = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: u ?? [{ protocol: nE }], proposer: { publicKey: w, metadata: this.client.metadata }, expiryTimestamp: M, pairingTopic: l }, a && { sessionProperties: a }), { reject: L, resolve: B, done: $ } = Ga(A, yE); + const w = await this.client.core.crypto.generateKeyPair(), A = In.wc_sessionPropose.req.ttl || mt.FIVE_MINUTES, M = En(A), N = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: u ?? [{ protocol: iE }], proposer: { publicKey: w, metadata: this.client.metadata }, expiryTimestamp: M, pairingTopic: l }, a && { sessionProperties: a }), { reject: L, resolve: B, done: $ } = Ga(A, wE); this.events.once(br("session_connect"), async ({ error: W, session: V }) => { if (W) L(W); else if (V) { @@ -20045,7 +20048,7 @@ class WV extends a$ { }), new Promise(async (M) => { var N; if (!((N = a.sessionConfig) != null && N.disableDeepLink)) { - const L = await Yq(this.client.core.storage, O3); + const L = await Yq(this.client.core.storage, N3); await Vq({ id: u, topic: s, wcDeepLink: L }); } M(); @@ -20112,17 +20115,17 @@ class WV extends a$ { await this.deleteProposal(b), this.events.off(br("session_connect"), m); const { cacaos: I, responder: F } = _.result, ce = [], D = []; for (const J of I) { - await qx({ cacao: J, projectId: this.client.core.projectId }) || (this.client.logger.error(J, "Signature verification failed"), S(Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"))); + await zx({ cacao: J, projectId: this.client.core.projectId }) || (this.client.logger.error(J, "Signature verification failed"), S(Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"))); const { p: Q } = J, T = Cd(Q.resources), X = [M1(Q.iss)], re = u0(Q.iss); if (T) { - const de = zx(T), ie = Wx(T); + const de = Wx(T), ie = Hx(T); ce.push(...de), X.push(...ie); } for (const de of X) D.push(`${de}:${re}`); } const oe = await this.client.core.crypto.generateSharedKey(W, F.publicKey); let Z; - ce.length > 0 && (Z = { topic: oe, acknowledged: !0, self: { publicKey: W, metadata: this.client.metadata }, peer: F, controller: F.publicKey, expiry: En(Kc), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: $, namespaces: Qx([...new Set(ce)], [...new Set(D)]), transportType: o }, await this.client.core.relayer.subscribe(oe, { transportType: o }), await this.client.session.set(oe, Z), $ && await this.client.core.pairing.updateMetadata({ topic: $, metadata: F.metadata }), Z = this.client.session.get(oe)), (E = this.client.metadata.redirect) != null && E.linkMode && (v = F.metadata.redirect) != null && v.linkMode && (P = F.metadata.redirect) != null && P.universal && n && (this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal), this.client.session.update(oe, { transportType: zr.link_mode })), Y({ auths: I, session: Z }); + ce.length > 0 && (Z = { topic: oe, acknowledged: !0, self: { publicKey: W, metadata: this.client.metadata }, peer: F, controller: F.publicKey, expiry: En(Kc), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: $, namespaces: e3([...new Set(ce)], [...new Set(D)]), transportType: o }, await this.client.core.relayer.subscribe(oe, { transportType: o }), await this.client.session.set(oe, Z), $ && await this.client.core.pairing.updateMetadata({ topic: $, metadata: F.metadata }), Z = this.client.session.get(oe)), (E = this.client.metadata.redirect) != null && E.linkMode && (v = F.metadata.redirect) != null && v.linkMode && (P = F.metadata.redirect) != null && P.universal && n && (this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal), this.client.session.update(oe, { transportType: zr.link_mode })), Y({ auths: I, session: Z }); }, g = ua(), b = ua(); this.events.once(br("session_connect"), m), this.events.once(br("session_request", g), f); let x; @@ -20150,7 +20153,7 @@ class WV extends a$ { a === zr.relay && await this.confirmOnlineStateOrThrow(); const u = o.requester.publicKey, l = await this.client.core.crypto.generateKeyPair(), d = Td(u), p = { type: Co, receiverPublicKey: u, senderPublicKey: l }, w = [], A = []; for (const L of i) { - if (!await qx({ cacao: L, projectId: this.client.core.projectId })) { + if (!await zx({ cacao: L, projectId: this.client.core.projectId })) { s.setError(If.invalid_cacao); const V = Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"); throw await this.sendError({ id: n, topic: d, error: V, encodeOpts: p }), new Error(V.message); @@ -20158,7 +20161,7 @@ class WV extends a$ { s.addTrace(Ka.cacaos_verified); const { p: B } = L, $ = Cd(B.resources), H = [M1(B.iss)], W = u0(B.iss); if ($) { - const V = zx($), te = Wx($); + const V = Wx($), te = Hx($); w.push(...V), H.push(...te); } for (const V of H) A.push(`${V}:${W}`); @@ -20167,7 +20170,7 @@ class WV extends a$ { s.addTrace(Ka.create_authenticated_session_topic); let N; if ((w == null ? void 0 : w.length) > 0) { - N = { topic: M, acknowledged: !0, self: { publicKey: l, metadata: this.client.metadata }, peer: { publicKey: u, metadata: o.requester.metadata }, controller: u, expiry: En(Kc), authentication: i, requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: o.pairingTopic, namespaces: Qx([...new Set(w)], [...new Set(A)]), transportType: a }, s.addTrace(Ka.subscribing_authenticated_session_topic); + N = { topic: M, acknowledged: !0, self: { publicKey: l, metadata: this.client.metadata }, peer: { publicKey: u, metadata: o.requester.metadata }, controller: u, expiry: En(Kc), authentication: i, requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: o.pairingTopic, namespaces: e3([...new Set(w)], [...new Set(A)]), transportType: a }, s.addTrace(Ka.subscribing_authenticated_session_topic); try { await this.client.core.relayer.subscribe(M, { transportType: a }); } catch (L) { @@ -20192,7 +20195,7 @@ class WV extends a$ { }, this.formatAuthMessage = (r) => { this.isInitialized(); const { request: n, iss: i } = r; - return F8(n, i); + return j8(n, i); }, this.processRelayMessageCache = () => { setTimeout(async () => { if (this.relayMessageCache.length !== 0) for (; this.relayMessageCache.length > 0; ) try { @@ -20216,7 +20219,7 @@ class WV extends a$ { }, this.deleteSession = async (r) => { var n; const { topic: i, expirerHasDeleted: s = !1, emitEvent: o = !0, id: a = 0 } = r, { self: u } = this.client.session.get(i); - await this.client.core.relayer.unsubscribe(i), await this.client.session.delete(i, Or("USER_DISCONNECTED")), this.addToRecentlyDeleted(i, "session"), this.client.core.crypto.keychain.has(u.publicKey) && await this.client.core.crypto.deleteKeyPair(u.publicKey), this.client.core.crypto.keychain.has(i) && await this.client.core.crypto.deleteSymKey(i), s || this.client.core.expirer.del(i), this.client.core.storage.removeItem(O3).catch((l) => this.client.logger.warn(l)), this.getPendingSessionRequests().forEach((l) => { + await this.client.core.relayer.unsubscribe(i), await this.client.session.delete(i, Or("USER_DISCONNECTED")), this.addToRecentlyDeleted(i, "session"), this.client.core.crypto.keychain.has(u.publicKey) && await this.client.core.crypto.deleteKeyPair(u.publicKey), this.client.core.crypto.keychain.has(i) && await this.client.core.crypto.deleteSymKey(i), s || this.client.core.expirer.del(i), this.client.core.storage.removeItem(N3).catch((l) => this.client.logger.warn(l)), this.getPendingSessionRequests().forEach((l) => { l.topic === i && this.deletePendingSessionRequest(l.id, Or("USER_DISCONNECTED")); }), i === ((n = this.sessionRequestQueue.queue[0]) == null ? void 0 : n.topic) && (this.sessionRequestQueue.state = ks.idle), o && this.client.events.emit("session_delete", { id: a, topic: i }); }, this.deleteProposal = async (r, n) => { @@ -20584,7 +20587,7 @@ class WV extends a$ { this.checkRecentlyDeleted(n), await this.isValidProposalId(n); const a = this.client.proposal.get(n), u = hm(i, "approve()"); if (u) throw new Error(u.message); - const l = r3(a.requiredNamespaces, i, "approve()"); + const l = n3(a.requiredNamespaces, i, "approve()"); if (l) throw new Error(l.message); if (!dn(s, !0)) { const { message: d } = ft("MISSING_OR_INVALID", `approve() relayProtocol: ${s}`); @@ -20607,7 +20610,7 @@ class WV extends a$ { throw new Error(l); } const { relay: n, controller: i, namespaces: s, expiry: o } = r; - if (!V8(n)) { + if (!G8(n)) { const { message: l } = ft("MISSING_OR_INVALID", "onSessionSettleRequest() relay protocol should be a string"); throw new Error(l); } @@ -20628,7 +20631,7 @@ class WV extends a$ { this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); const s = this.client.session.get(n), o = hm(i, "update()"); if (o) throw new Error(o.message); - const a = r3(s.requiredNamespaces, i, "update()"); + const a = n3(s.requiredNamespaces, i, "update()"); if (a) throw new Error(a.message); }, this.isValidExtend = async (r) => { if (!gi(r)) { @@ -20645,7 +20648,7 @@ class WV extends a$ { const { topic: n, request: i, chainId: s, expiry: o } = r; this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); const { namespaces: a } = this.client.session.get(n); - if (!t3(a, s)) { + if (!r3(a, s)) { const { message: u } = ft("MISSING_OR_INVALID", `request() chainId: ${s}`); throw new Error(u); } @@ -20692,7 +20695,7 @@ class WV extends a$ { const { topic: n, event: i, chainId: s } = r; await this.isValidSessionTopic(n); const { namespaces: o } = this.client.session.get(n); - if (!t3(o, s)) { + if (!r3(o, s)) { const { message: a } = ft("MISSING_OR_INVALID", `emit() chainId: ${s}`); throw new Error(a); } @@ -20766,11 +20769,11 @@ class WV extends a$ { return this.isLinkModeEnabled(r, n) ? (i = r == null ? void 0 : r.redirect) == null ? void 0 : i.universal : void 0; }, this.handleLinkModeMessage = ({ url: r }) => { if (!r || !r.includes("wc_ev") || !r.includes("topic")) return; - const n = Bx(r, "topic") || "", i = decodeURIComponent(Bx(r, "wc_ev") || ""), s = this.client.session.keys.includes(n); + const n = Fx(r, "topic") || "", i = decodeURIComponent(Fx(r, "wc_ev") || ""), s = this.client.session.keys.includes(n); s && this.client.session.update(n, { transportType: zr.link_mode }), this.client.core.dispatchEnvelope({ topic: n, message: i, sessionExists: s }); }, this.registerLinkModeListeners = async () => { var r; - if (ib() || qu() && (r = this.client.metadata.redirect) != null && r.linkMode) { + if (sb() || qu() && (r = this.client.metadata.redirect) != null && r.linkMode) { const n = global == null ? void 0 : global.Linking; if (typeof n < "u") { n.addEventListener("url", this.handleLinkModeMessage, this.client.name); @@ -20799,14 +20802,14 @@ class WV extends a$ { async onRelayMessage(e) { const { topic: r, message: n, attestation: i, transportType: s } = e, { publicKey: o } = this.client.auth.authKeys.keys.includes(Rd) ? this.client.auth.authKeys.get(Rd) : { publicKey: void 0 }, a = await this.client.core.crypto.decode(r, n, { receiverPublicKey: o, encoding: s === zr.link_mode ? Af : ha }); try { - fb(a) ? (this.client.core.history.set(r, a), this.onRelayEventRequest({ topic: r, payload: a, attestation: i, transportType: s, encryptedId: xo(n) })) : ip(a) ? (await this.client.core.history.resolve(a), await this.onRelayEventResponse({ topic: r, payload: a, transportType: s }), this.client.core.history.delete(r, a.id)) : this.onRelayEventUnknownPayload({ topic: r, payload: a, transportType: s }); + lb(a) ? (this.client.core.history.set(r, a), this.onRelayEventRequest({ topic: r, payload: a, attestation: i, transportType: s, encryptedId: xo(n) })) : ip(a) ? (await this.client.core.history.resolve(a), await this.onRelayEventResponse({ topic: r, payload: a, transportType: s }), this.client.core.history.delete(r, a.id)) : this.onRelayEventUnknownPayload({ topic: r, payload: a, transportType: s }); } catch (u) { this.client.logger.error(u); } } registerExpirerEvents() { this.client.core.expirer.on(Ji.expired, async (e) => { - const { topic: r, id: n } = $8(e.target); + const { topic: r, id: n } = B8(e.target); if (n && this.client.pendingRequest.keys.includes(n)) return await this.deletePendingSessionRequest(n, ft("EXPIRED"), !0); if (n && this.client.auth.requests.keys.includes(n)) return await this.deletePendingAuthRequest(n, ft("EXPIRED"), !0); r ? this.client.session.keys.includes(r) && (await this.deleteSession({ topic: r, expirerHasDeleted: !0 }), this.client.events.emit("session_expire", { topic: r })) : n && (await this.deleteProposal(n, !0), this.client.events.emit("proposal_expire", { id: n })); @@ -20879,17 +20882,17 @@ class WV extends a$ { } class HV extends Ec { constructor(e, r) { - super(e, r, CV, hb), this.core = e, this.logger = r; + super(e, r, CV, db), this.core = e, this.logger = r; } } let KV = class extends Ec { constructor(e, r) { - super(e, r, TV, hb), this.core = e, this.logger = r; + super(e, r, TV, db), this.core = e, this.logger = r; } }; class VV extends Ec { constructor(e, r) { - super(e, r, DV, hb, (n) => n.id), this.core = e, this.logger = r; + super(e, r, DV, db, (n) => n.id), this.core = e, this.logger = r; } } class GV extends Ec { @@ -20915,9 +20918,9 @@ class XV { await this.authKeys.init(), await this.pairingTopics.init(), await this.requests.init(); } } -class db extends o$ { +class pb extends o$ { constructor(e) { - super(e), this.protocol = mE, this.version = vE, this.name = mm.name, this.events = new rs.EventEmitter(), this.on = (n, i) => this.events.on(n, i), this.once = (n, i) => this.events.once(n, i), this.off = (n, i) => this.events.off(n, i), this.removeListener = (n, i) => this.events.removeListener(n, i), this.removeAllListeners = (n) => this.events.removeAllListeners(n), this.connect = async (n) => { + super(e), this.protocol = vE, this.version = bE, this.name = mm.name, this.events = new rs.EventEmitter(), this.on = (n, i) => this.events.on(n, i), this.once = (n, i) => this.events.once(n, i), this.off = (n, i) => this.events.off(n, i), this.removeListener = (n, i) => this.events.removeListener(n, i), this.removeAllListeners = (n) => this.events.removeAllListeners(n), this.connect = async (n) => { try { return await this.engine.connect(n); } catch (i) { @@ -21019,12 +21022,12 @@ class db extends o$ { } catch (i) { throw this.logger.error(i.message), i; } - }, this.name = (e == null ? void 0 : e.name) || mm.name, this.metadata = (e == null ? void 0 : e.metadata) || D8(), this.signConfig = e == null ? void 0 : e.signConfig; + }, this.name = (e == null ? void 0 : e.name) || mm.name, this.metadata = (e == null ? void 0 : e.metadata) || O8(), this.signConfig = e == null ? void 0 : e.signConfig; const r = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : ql($0({ level: (e == null ? void 0 : e.logger) || mm.logger })); this.core = (e == null ? void 0 : e.core) || new IV(e), this.logger = ci(r, this.name), this.session = new KV(this.core, this.logger), this.proposal = new HV(this.core, this.logger), this.pendingRequest = new VV(this.core, this.logger), this.engine = new WV(this), this.auth = new XV(this.core, this.logger); } static async init(e) { - const r = new db(e); + const r = new pb(e); return await r.initialize(), r; } get context() { @@ -21357,7 +21360,7 @@ h0.exports; ; return be; } - function py(be, Be) { + function gy(be, Be) { for (var Ie = -1, It = be == null ? 0 : be.length; ++Ie < It; ) if (!Be(be[Ie], Ie, be)) return !1; @@ -21415,7 +21418,7 @@ h0.exports; function cA(be) { return be.match(j) || []; } - function gy(be, Be, Ie) { + function my(be, Be, Ie) { var It; return Ie(be, function(tr, Pr, xn) { if (Be(tr, Pr, xn)) @@ -21429,7 +21432,7 @@ h0.exports; return -1; } function Cc(be, Be, Ie) { - return Be === Be ? wA(be, Be, Ie) : bh(be, my, Ie); + return Be === Be ? wA(be, Be, Ie) : bh(be, vy, Ie); } function uA(be, Be, Ie, It) { for (var tr = Ie - 1, Pr = be.length; ++tr < Pr; ) @@ -21437,10 +21440,10 @@ h0.exports; return tr; return -1; } - function my(be) { + function vy(be) { return be !== be; } - function vy(be, Be) { + function by(be, Be) { var Ie = be == null ? 0 : be.length; return Ie ? jp(be, Be) / Ie : v; } @@ -21454,7 +21457,7 @@ h0.exports; return be == null ? r : be[Be]; }; } - function by(be, Be, Ie, It, tr) { + function yy(be, Be, Ie, It, tr) { return tr(be, function(Pr, xn, qr) { Ie = It ? (It = !1, Pr) : Be(Ie, Pr, xn, qr); }), Ie; @@ -21482,8 +21485,8 @@ h0.exports; return [Ie, be[Ie]]; }); } - function yy(be) { - return be && be.slice(0, Ey(be) + 1).replace(k, ""); + function wy(be) { + return be && be.slice(0, Sy(be) + 1).replace(k, ""); } function Pi(be) { return function(Be) { @@ -21498,12 +21501,12 @@ h0.exports; function Qu(be, Be) { return be.has(Be); } - function wy(be, Be) { + function xy(be, Be) { for (var Ie = -1, It = be.length; ++Ie < It && Cc(Be, be[Ie], 0) > -1; ) ; return Ie; } - function xy(be, Be) { + function _y(be, Be) { for (var Ie = be.length; Ie-- && Cc(Be, be[Ie], 0) > -1; ) ; return Ie; @@ -21537,7 +21540,7 @@ h0.exports; Ie[++Be] = [tr, It]; }), Ie; } - function _y(be, Be) { + function Ey(be, Be) { return function(Ie) { return be(Be(Ie)); }; @@ -21579,7 +21582,7 @@ h0.exports; function ls(be) { return Tc(be) ? SA(be) : aA(be); } - function Ey(be) { + function Sy(be) { for (var Be = be.length; Be-- && U.test(be.charAt(Be)); ) ; return Be; @@ -21598,24 +21601,24 @@ h0.exports; } var PA = function be(Be) { Be = Be == null ? _r : Dc.defaults(_r.Object(), Be, Dc.pick(_r, mh)); - var Ie = Be.Array, It = Be.Date, tr = Be.Error, Pr = Be.Function, xn = Be.Math, qr = Be.Object, Wp = Be.RegExp, MA = Be.String, Ui = Be.TypeError, wh = Ie.prototype, IA = Pr.prototype, Oc = qr.prototype, xh = Be["__core-js_shared__"], _h = IA.toString, Tr = Oc.hasOwnProperty, CA = 0, Sy = function() { + var Ie = Be.Array, It = Be.Date, tr = Be.Error, Pr = Be.Function, xn = Be.Math, qr = Be.Object, Wp = Be.RegExp, MA = Be.String, Ui = Be.TypeError, wh = Ie.prototype, IA = Pr.prototype, Oc = qr.prototype, xh = Be["__core-js_shared__"], _h = IA.toString, Tr = Oc.hasOwnProperty, CA = 0, Ay = function() { var c = /[^.]+$/.exec(xh && xh.keys && xh.keys.IE_PROTO || ""); return c ? "Symbol(src)_1." + c : ""; }(), Eh = Oc.toString, TA = _h.call(qr), RA = _r._, DA = Wp( "^" + _h.call(Tr).replace(rt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" - ), Sh = ui ? Be.Buffer : r, Vo = Be.Symbol, Ah = Be.Uint8Array, Ay = Sh ? Sh.allocUnsafe : r, Ph = _y(qr.getPrototypeOf, qr), Py = qr.create, My = Oc.propertyIsEnumerable, Mh = wh.splice, Iy = Vo ? Vo.isConcatSpreadable : r, ef = Vo ? Vo.iterator : r, Na = Vo ? Vo.toStringTag : r, Ih = function() { + ), Sh = ui ? Be.Buffer : r, Vo = Be.Symbol, Ah = Be.Uint8Array, Py = Sh ? Sh.allocUnsafe : r, Ph = Ey(qr.getPrototypeOf, qr), My = qr.create, Iy = Oc.propertyIsEnumerable, Mh = wh.splice, Cy = Vo ? Vo.isConcatSpreadable : r, ef = Vo ? Vo.iterator : r, Na = Vo ? Vo.toStringTag : r, Ih = function() { try { var c = Fa(qr, "defineProperty"); return c({}, "", {}), c; } catch { } - }(), OA = Be.clearTimeout !== _r.clearTimeout && Be.clearTimeout, NA = It && It.now !== _r.Date.now && It.now, LA = Be.setTimeout !== _r.setTimeout && Be.setTimeout, Ch = xn.ceil, Th = xn.floor, Hp = qr.getOwnPropertySymbols, kA = Sh ? Sh.isBuffer : r, Cy = Be.isFinite, $A = wh.join, BA = _y(qr.keys, qr), _n = xn.max, Kn = xn.min, FA = It.now, jA = Be.parseInt, Ty = xn.random, UA = wh.reverse, Kp = Fa(Be, "DataView"), tf = Fa(Be, "Map"), Vp = Fa(Be, "Promise"), Nc = Fa(Be, "Set"), rf = Fa(Be, "WeakMap"), nf = Fa(qr, "create"), Rh = rf && new rf(), Lc = {}, qA = ja(Kp), zA = ja(tf), WA = ja(Vp), HA = ja(Nc), KA = ja(rf), Dh = Vo ? Vo.prototype : r, sf = Dh ? Dh.valueOf : r, Ry = Dh ? Dh.toString : r; + }(), OA = Be.clearTimeout !== _r.clearTimeout && Be.clearTimeout, NA = It && It.now !== _r.Date.now && It.now, LA = Be.setTimeout !== _r.setTimeout && Be.setTimeout, Ch = xn.ceil, Th = xn.floor, Hp = qr.getOwnPropertySymbols, kA = Sh ? Sh.isBuffer : r, Ty = Be.isFinite, $A = wh.join, BA = Ey(qr.keys, qr), _n = xn.max, Kn = xn.min, FA = It.now, jA = Be.parseInt, Ry = xn.random, UA = wh.reverse, Kp = Fa(Be, "DataView"), tf = Fa(Be, "Map"), Vp = Fa(Be, "Promise"), Nc = Fa(Be, "Set"), rf = Fa(Be, "WeakMap"), nf = Fa(qr, "create"), Rh = rf && new rf(), Lc = {}, qA = ja(Kp), zA = ja(tf), WA = ja(Vp), HA = ja(Nc), KA = ja(rf), Dh = Vo ? Vo.prototype : r, sf = Dh ? Dh.valueOf : r, Dy = Dh ? Dh.toString : r; function ee(c) { if (en(c) && !ir(c) && !(c instanceof wr)) { if (c instanceof qi) return c; if (Tr.call(c, "__wrapped__")) - return Dw(c); + return Ow(c); } return new qi(c); } @@ -21625,8 +21628,8 @@ h0.exports; return function(h) { if (!Zr(h)) return {}; - if (Py) - return Py(h); + if (My) + return My(h); c.prototype = h; var y = new c(); return c.prototype = r, y; @@ -21700,7 +21703,7 @@ h0.exports; function YA() { var c = this.__wrapped__.value(), h = this.__dir__, y = ir(c), O = h < 0, q = y ? c.length : 0, ne = aM(0, q, this.__views__), fe = ne.start, me = ne.end, we = me - fe, We = O ? me : fe - 1, He = this.__iteratees__, Xe = He.length, wt = 0, Ot = Kn(we, this.__takeCount__); if (!y || !O && q == we && Ot == we) - return tw(c, this.__actions__); + return rw(c, this.__actions__); var Ht = []; e: for (; we-- && wt < Ot; ) { @@ -21849,7 +21852,7 @@ h0.exports; return y.set(c, h), this.size = y.size, this; } hs.prototype.clear = dP, hs.prototype.delete = pP, hs.prototype.get = gP, hs.prototype.has = mP, hs.prototype.set = vP; - function Dy(c, h) { + function Oy(c, h) { var y = ir(c), O = !y && Ua(c), q = !y && !O && Zo(c), ne = !y && !O && !q && jc(c), fe = y || O || q || ne, me = fe ? Up(c.length, MA) : [], we = me.length; for (var We in c) (h || Tr.call(c, We)) && !(fe && // Safari 9 has enumerable `arguments.length` in strict mode. @@ -21859,7 +21862,7 @@ h0.exports; fo(We, we))) && me.push(We); return me; } - function Oy(c) { + function Ny(c) { var h = c.length; return h ? c[ig(0, h - 1)] : r; } @@ -21887,7 +21890,7 @@ h0.exports; h(O, q, y(q), fe); }), O; } - function Ny(c, h) { + function Ly(c, h) { return c && Ts(h, Mn(h), c); } function xP(c, h) { @@ -21922,10 +21925,10 @@ h0.exports; } else { var Xe = Vn(c), wt = Xe == re || Xe == de; if (Zo(c)) - return iw(c, me); + return sw(c, me); if (Xe == Pe || Xe == D || wt && !q) { - if (fe = we || wt ? {} : Ew(c), !me) - return we ? ZP(c, xP(fe, c)) : XP(c, Ny(fe, c)); + if (fe = we || wt ? {} : Sw(c), !me) + return we ? ZP(c, xP(fe, c)) : XP(c, Ly(fe, c)); } else { if (!Dr[Xe]) return q ? c : {}; @@ -21936,9 +21939,9 @@ h0.exports; var Ot = ne.get(c); if (Ot) return Ot; - ne.set(c, fe), Zw(c) ? c.forEach(function(Kt) { + ne.set(c, fe), Qw(c) ? c.forEach(function(Kt) { fe.add(zi(Kt, h, y, Kt, c, ne)); - }) : Jw(c) && c.forEach(function(Kt, vr) { + }) : Xw(c) && c.forEach(function(Kt, vr) { fe.set(vr, zi(Kt, h, y, vr, c, ne)); }); var Ht = We ? we ? gg : pg : we ? hi : Mn, fr = He ? r : Ht(c); @@ -21949,10 +21952,10 @@ h0.exports; function _P(c) { var h = Mn(c); return function(y) { - return Ly(y, c, h); + return ky(y, c, h); }; } - function Ly(c, h, y) { + function ky(c, h, y) { var O = y.length; if (c == null) return !O; @@ -21963,7 +21966,7 @@ h0.exports; } return !0; } - function ky(c, h, y) { + function $y(c, h, y) { if (typeof c != "function") throw new Ui(o); return df(function() { @@ -21987,7 +21990,7 @@ h0.exports; } return we; } - var Go = uw(Cs), $y = uw(Xp, !0); + var Go = fw(Cs), By = fw(Xp, !0); function EP(c, h) { var y = !0; return Go(c, function(O, q, ne) { @@ -22004,11 +22007,11 @@ h0.exports; } function SP(c, h, y, O) { var q = c.length; - for (y = cr(y), y < 0 && (y = -y > q ? 0 : q + y), O = O === r || O > q ? q : cr(O), O < 0 && (O += q), O = y > O ? 0 : e2(O); y < O; ) + for (y = cr(y), y < 0 && (y = -y > q ? 0 : q + y), O = O === r || O > q ? q : cr(O), O < 0 && (O += q), O = y > O ? 0 : t2(O); y < O; ) c[y++] = h; return c; } - function By(c, h) { + function Fy(c, h) { var y = []; return Go(c, function(O, q, ne) { h(O, q, ne) && y.push(O); @@ -22022,12 +22025,12 @@ h0.exports; } return q; } - var Jp = fw(), Fy = fw(!0); + var Jp = lw(), jy = lw(!0); function Cs(c, h) { return c && Jp(c, h, Mn); } function Xp(c, h) { - return c && Fy(c, h, Mn); + return c && jy(c, h, Mn); } function kh(c, h) { return Wo(h, function(y) { @@ -22040,7 +22043,7 @@ h0.exports; c = c[Rs(h[y++])]; return y && y == O ? c : r; } - function jy(c, h, y) { + function Uy(c, h, y) { var O = h(c); return ir(c) ? O : Ho(O, y(c)); } @@ -22086,11 +22089,11 @@ h0.exports; }), O; } function cf(c, h, y) { - h = Jo(h, c), c = Mw(c, h); + h = Jo(h, c), c = Iw(c, h); var O = c == null ? c : c[Rs(Hi(h))]; return O == null ? r : Pn(O, c, y); } - function Uy(c) { + function qy(c) { return en(c) && ri(c) == D; } function CP(c) { @@ -22112,7 +22115,7 @@ h0.exports; fe = !0, He = !1; } if (wt && !He) - return ne || (ne = new hs()), fe || jc(c) ? ww(c, h, y, O, q, ne) : iM(c, h, we, y, O, q, ne); + return ne || (ne = new hs()), fe || jc(c) ? xw(c, h, y, O, q, ne) : iM(c, h, we, y, O, q, ne); if (!(y & M)) { var Ot = He && Tr.call(c, "__wrapped__"), Ht = Xe && Tr.call(h, "__wrapped__"); if (Ot || Ht) { @@ -22150,7 +22153,7 @@ h0.exports; } return !0; } - function qy(c) { + function zy(c) { if (!Zr(c) || pM(c)) return !1; var h = lo(c) ? DA : je; @@ -22165,8 +22168,8 @@ h0.exports; function LP(c) { return en(c) && Qh(c.length) && !!Fr[ri(c)]; } - function zy(c) { - return typeof c == "function" ? c : c == null ? di : typeof c == "object" ? ir(c) ? Ky(c[0], c[1]) : Hy(c) : l2(c); + function Wy(c) { + return typeof c == "function" ? c : c == null ? di : typeof c == "object" ? ir(c) ? Vy(c[0], c[1]) : Ky(c) : h2(c); } function tg(c) { if (!hf(c)) @@ -22187,20 +22190,20 @@ h0.exports; function rg(c, h) { return c < h; } - function Wy(c, h) { + function Hy(c, h) { var y = -1, O = li(c) ? Ie(c.length) : []; return Go(c, function(q, ne, fe) { O[++y] = h(q, ne, fe); }), O; } - function Hy(c) { + function Ky(c) { var h = vg(c); - return h.length == 1 && h[0][2] ? Aw(h[0][0], h[0][1]) : function(y) { + return h.length == 1 && h[0][2] ? Pw(h[0][0], h[0][1]) : function(y) { return y === c || eg(y, c, h); }; } - function Ky(c, h) { - return yg(c) && Sw(h) ? Aw(Rs(c), h) : function(y) { + function Vy(c, h) { + return yg(c) && Aw(h) ? Pw(Rs(c), h) : function(y) { var O = Cg(y, c); return O === r && O === h ? Tg(y, c) : uf(h, O, M | N); }; @@ -22224,16 +22227,16 @@ h0.exports; var He = ne ? ne(me, we, y + "", c, h, fe) : r, Xe = He === r; if (Xe) { var wt = ir(we), Ot = !wt && Zo(we), Ht = !wt && !Ot && jc(we); - He = we, wt || Ot || Ht ? ir(me) ? He = me : cn(me) ? He = fi(me) : Ot ? (Xe = !1, He = iw(we, !0)) : Ht ? (Xe = !1, He = sw(we, !0)) : He = [] : pf(we) || Ua(we) ? (He = me, Ua(me) ? He = t2(me) : (!Zr(me) || lo(me)) && (He = Ew(we))) : Xe = !1; + He = we, wt || Ot || Ht ? ir(me) ? He = me : cn(me) ? He = fi(me) : Ot ? (Xe = !1, He = sw(we, !0)) : Ht ? (Xe = !1, He = ow(we, !0)) : He = [] : pf(we) || Ua(we) ? (He = me, Ua(me) ? He = r2(me) : (!Zr(me) || lo(me)) && (He = Sw(we))) : Xe = !1; } Xe && (fe.set(we, He), q(He, we, O, ne, fe), fe.delete(we)), Gp(c, y, He); } - function Vy(c, h) { + function Gy(c, h) { var y = c.length; if (y) return h += h < 0 ? y : 0, fo(h, y) ? c[h] : r; } - function Gy(c, h, y) { + function Yy(c, h, y) { h.length ? h = Xr(h, function(ne) { return ir(ne) ? function(fe) { return Ba(fe, ne.length === 1 ? ne[0] : ne); @@ -22241,7 +22244,7 @@ h0.exports; }) : h = [di]; var O = -1; h = Xr(h, Pi(Ut())); - var q = Wy(c, function(ne, fe, me) { + var q = Hy(c, function(ne, fe, me) { var we = Xr(h, function(We) { return We(ne); }); @@ -22252,11 +22255,11 @@ h0.exports; }); } function BP(c, h) { - return Yy(c, h, function(y, O) { + return Jy(c, h, function(y, O) { return Tg(c, O); }); } - function Yy(c, h, y) { + function Jy(c, h, y) { for (var O = -1, q = h.length, ne = {}; ++O < q; ) { var fe = h[O], me = Ba(c, fe); y(me, fe) && ff(ne, Jo(fe, c), me); @@ -22275,7 +22278,7 @@ h0.exports; me !== c && Mh.call(me, we, 1), Mh.call(c, we, 1); return c; } - function Jy(c, h) { + function Xy(c, h) { for (var y = c ? h.length : 0, O = y - 1; y--; ) { var q = h[y]; if (y == O || q !== ne) { @@ -22286,7 +22289,7 @@ h0.exports; return c; } function ig(c, h) { - return c + Th(Ty() * (h - c + 1)); + return c + Th(Ry() * (h - c + 1)); } function jP(c, h, y, O) { for (var q = -1, ne = _n(Ch((h - c) / (y || 1)), 0), fe = Ie(ne); ne--; ) @@ -22303,10 +22306,10 @@ h0.exports; return y; } function hr(c, h) { - return _g(Pw(c, h, di), c + ""); + return _g(Mw(c, h, di), c + ""); } function UP(c) { - return Oy(Uc(c)); + return Ny(Uc(c)); } function qP(c, h) { var y = Uc(c); @@ -22328,7 +22331,7 @@ h0.exports; } return c; } - var Xy = Rh ? function(c, h) { + var Zy = Rh ? function(c, h) { return Rh.set(c, h), c; } : di, zP = Ih ? function(c, h) { return Ih(c, "toString", { @@ -22379,7 +22382,7 @@ h0.exports; } return Kn(ne, I); } - function Zy(c, h) { + function Qy(c, h) { for (var y = -1, O = c.length, q = 0, ne = []; ++y < O; ) { var fe = c[y], me = h ? h(fe) : fe; if (!y || !ds(me, we)) { @@ -22389,7 +22392,7 @@ h0.exports; } return ne; } - function Qy(c) { + function ew(c) { return typeof c == "number" ? c : Ii(c) ? v : +c; } function Mi(c) { @@ -22398,7 +22401,7 @@ h0.exports; if (ir(c)) return Xr(c, Mi) + ""; if (Ii(c)) - return Ry ? Ry.call(c) : ""; + return Dy ? Dy.call(c) : ""; var h = c + ""; return h == "0" && 1 / c == -x ? "-0" : h; } @@ -22426,9 +22429,9 @@ h0.exports; return me; } function ag(c, h) { - return h = Jo(h, c), c = Mw(c, h), c == null || delete c[Rs(Hi(h))]; + return h = Jo(h, c), c = Iw(c, h), c == null || delete c[Rs(Hi(h))]; } - function ew(c, h, y, O) { + function tw(c, h, y, O) { return ff(c, h, y(Ba(c, h)), O); } function Fh(c, h, y, O) { @@ -22436,7 +22439,7 @@ h0.exports; ; return y ? Wi(c, O ? 0 : ne, O ? ne + 1 : q) : Wi(c, O ? ne + 1 : 0, O ? q : ne); } - function tw(c, h) { + function rw(c, h) { var y = c; return y instanceof wr && (y = y.value()), kp(h, function(O, q) { return q.func.apply(q.thisArg, Ho([O], q.args)); @@ -22451,7 +22454,7 @@ h0.exports; me != q && (ne[q] = af(ne[q] || fe, c[me], h, y)); return Yo(Bn(ne, 1), h, y); } - function rw(c, h, y) { + function nw(c, h, y) { for (var O = -1, q = c.length, ne = h.length, fe = {}; ++O < q; ) { var me = O < ne ? h[O] : r; y(fe, c[O], me); @@ -22465,20 +22468,20 @@ h0.exports; return typeof c == "function" ? c : di; } function Jo(c, h) { - return ir(c) ? c : yg(c, h) ? [c] : Rw(Cr(c)); + return ir(c) ? c : yg(c, h) ? [c] : Dw(Cr(c)); } var KP = hr; function Xo(c, h, y) { var O = c.length; return y = y === r ? O : y, !h && y >= O ? c : Wi(c, h, y); } - var nw = OA || function(c) { + var iw = OA || function(c) { return _r.clearTimeout(c); }; - function iw(c, h) { + function sw(c, h) { if (h) return c.slice(); - var y = c.length, O = Ay ? Ay(y) : new c.constructor(y); + var y = c.length, O = Py ? Py(y) : new c.constructor(y); return c.copy(O), O; } function lg(c) { @@ -22496,11 +22499,11 @@ h0.exports; function YP(c) { return sf ? qr(sf.call(c)) : {}; } - function sw(c, h) { + function ow(c, h) { var y = h ? lg(c.buffer) : c.buffer; return new c.constructor(y, c.byteOffset, c.length); } - function ow(c, h) { + function aw(c, h) { if (c !== h) { var y = c !== r, O = c === null, q = c === c, ne = Ii(c), fe = h !== r, me = h === null, we = h === h, We = Ii(h); if (!me && !We && !ne && c > h || ne && fe && we && !me && !We || O && fe && we || !y && we || !q) @@ -22512,7 +22515,7 @@ h0.exports; } function JP(c, h, y) { for (var O = -1, q = c.criteria, ne = h.criteria, fe = q.length, me = y.length; ++O < fe; ) { - var we = ow(q[O], ne[O]); + var we = aw(q[O], ne[O]); if (we) { if (O >= me) return we; @@ -22522,7 +22525,7 @@ h0.exports; } return c.index - h.index; } - function aw(c, h, y, O) { + function cw(c, h, y, O) { for (var q = -1, ne = c.length, fe = y.length, me = -1, we = h.length, We = _n(ne - fe, 0), He = Ie(we + We), Xe = !O; ++me < we; ) He[me] = h[me]; for (; ++q < fe; ) @@ -22531,7 +22534,7 @@ h0.exports; He[me++] = c[q++]; return He; } - function cw(c, h, y, O) { + function uw(c, h, y, O) { for (var q = -1, ne = c.length, fe = -1, me = y.length, we = -1, We = h.length, He = _n(ne - me, 0), Xe = Ie(He + We), wt = !O; ++q < He; ) Xe[q] = c[q]; for (var Ot = q; ++we < We; ) @@ -22559,7 +22562,7 @@ h0.exports; return Ts(c, bg(c), h); } function ZP(c, h) { - return Ts(c, xw(c), h); + return Ts(c, _w(c), h); } function jh(c, h) { return function(y, O) { @@ -22577,7 +22580,7 @@ h0.exports; return h; }); } - function uw(c, h) { + function fw(c, h) { return function(y, O) { if (y == null) return y; @@ -22588,7 +22591,7 @@ h0.exports; return y; }; } - function fw(c) { + function lw(c) { return function(h, y, O) { for (var q = -1, ne = qr(h), fe = O(h), me = fe.length; me--; ) { var we = fe[c ? me : ++q]; @@ -22606,7 +22609,7 @@ h0.exports; } return ne; } - function lw(c) { + function hw(c) { return function(h) { h = Cr(h); var y = Tc(h) ? ls(h) : r, O = y ? y[0] : h.charAt(0), q = y ? Xo(y, 1).join("") : h.slice(1); @@ -22615,7 +22618,7 @@ h0.exports; } function Bc(c) { return function(h) { - return kp(u2(c2(h).replace(Xu, "")), c, ""); + return kp(f2(u2(h).replace(Xu, "")), c, ""); }; } function lf(c) { @@ -22650,7 +22653,7 @@ h0.exports; fe[me] = arguments[me]; var We = ne < 3 && fe[0] !== we && fe[ne - 1] !== we ? [] : Ko(fe, we); if (ne -= We.length, ne < y) - return mw( + return vw( c, h, Uh, @@ -22667,7 +22670,7 @@ h0.exports; } return q; } - function hw(c) { + function dw(c) { return function(h, y, O) { var q = qr(h); if (!li(h)) { @@ -22680,7 +22683,7 @@ h0.exports; return fe > -1 ? q[ne ? h[fe] : fe] : r; }; } - function dw(c) { + function pw(c) { return uo(function(h) { var y = h.length, O = y, q = qi.prototype.thru; for (c && h.reverse(); O--; ) { @@ -22712,9 +22715,9 @@ h0.exports; Er[Ci] = arguments[Ci]; if (Ot) var ii = Fc(Kt), Ti = hA(Er, ii); - if (O && (Er = aw(Er, O, q, Ot)), ne && (Er = cw(Er, ne, fe, Ot)), vr -= Ti, Ot && vr < We) { + if (O && (Er = cw(Er, O, q, Ot)), ne && (Er = uw(Er, ne, fe, Ot)), vr -= Ti, Ot && vr < We) { var un = Ko(Er, ii); - return mw( + return vw( c, h, Uh, @@ -22732,7 +22735,7 @@ h0.exports; } return Kt; } - function pw(c, h) { + function gw(c, h) { return function(y, O) { return IP(y, c, h(O), {}); }; @@ -22745,7 +22748,7 @@ h0.exports; if (y !== r && (q = y), O !== r) { if (q === r) return O; - typeof y == "string" || typeof O == "string" ? (y = Mi(y), O = Mi(O)) : (y = Qy(y), O = Qy(O)), q = c(y, O); + typeof y == "string" || typeof O == "string" ? (y = Mi(y), O = Mi(O)) : (y = ew(y), O = ew(O)), q = c(y, O); } return q; }; @@ -22779,7 +22782,7 @@ h0.exports; } return fe; } - function gw(c) { + function mw(c) { return function(h, y, O) { return O && typeof O != "number" && ni(h, y, O) && (y = O = r), h = ho(h), y === r ? (y = h, h = 0) : y = ho(y), O = O === r ? h < y ? 1 : -1 : ho(O), jP(h, y, O, c); }; @@ -22789,7 +22792,7 @@ h0.exports; return typeof h == "string" && typeof y == "string" || (h = Ki(h), y = Ki(y)), c(h, y); }; } - function mw(c, h, y, O, q, ne, fe, me, we, We) { + function vw(c, h, y, O, q, ne, fe, me, we, We) { var He = h & H, Xe = He ? fe : r, wt = He ? r : fe, Ot = He ? ne : r, Ht = He ? r : ne; h |= He ? V : te, h &= ~(He ? te : V), h & $ || (h &= ~(L | B)); var fr = [ @@ -22804,12 +22807,12 @@ h0.exports; we, We ], Kt = y.apply(r, fr); - return wg(c) && Iw(Kt, fr), Kt.placeholder = O, Cw(Kt, c, h); + return wg(c) && Cw(Kt, fr), Kt.placeholder = O, Tw(Kt, c, h); } function dg(c) { var h = xn[c]; return function(y, O) { - if (y = Ki(y), O = O == null ? 0 : Kn(cr(O), 292), O && Cy(y)) { + if (y = Ki(y), O = O == null ? 0 : Kn(cr(O), 292), O && Ty(y)) { var q = (Cr(y) + "e").split("e"), ne = h(q[0] + "e" + (+q[1] + O)); return q = (Cr(ne) + "e").split("e"), +(q[0] + "e" + (+q[1] - O)); } @@ -22819,7 +22822,7 @@ h0.exports; var rM = Nc && 1 / yh(new Nc([, -0]))[1] == x ? function(c) { return new Nc(c); } : Lg; - function vw(c) { + function bw(c) { return function(h) { var y = Vn(h); return y == ie ? zp(h) : y == Me ? yA(h) : lA(h, c(h)); @@ -22849,19 +22852,19 @@ h0.exports; if (wt && vM(Ot, wt), c = Ot[0], h = Ot[1], y = Ot[2], O = Ot[3], q = Ot[4], me = Ot[9] = Ot[9] === r ? we ? 0 : c.length : _n(Ot[9] - We, 0), !me && h & (H | W) && (h &= ~(H | W)), !h || h == L) var Ht = QP(c, h, y); else h == H || h == W ? Ht = eM(c, h, me) : (h == V || h == (L | V)) && !q.length ? Ht = tM(c, h, y, O) : Ht = Uh.apply(r, Ot); - var fr = wt ? Xy : Iw; - return Cw(fr(Ht, Ot), c, h); + var fr = wt ? Zy : Cw; + return Tw(fr(Ht, Ot), c, h); } - function bw(c, h, y, O) { + function yw(c, h, y, O) { return c === r || ds(c, Oc[y]) && !Tr.call(O, y) ? h : c; } - function yw(c, h, y, O, q, ne) { - return Zr(c) && Zr(h) && (ne.set(h, c), $h(c, h, r, yw, ne), ne.delete(h)), c; + function ww(c, h, y, O, q, ne) { + return Zr(c) && Zr(h) && (ne.set(h, c), $h(c, h, r, ww, ne), ne.delete(h)), c; } function nM(c) { return pf(c) ? r : c; } - function ww(c, h, y, O, q, ne) { + function xw(c, h, y, O, q, ne) { var fe = y & M, me = c.length, we = h.length; if (me != we && !(fe && we > me)) return !1; @@ -22921,7 +22924,7 @@ h0.exports; if (We) return We == h; O |= N, fe.set(c, h); - var He = ww(me(c), me(h), O, q, ne, fe); + var He = xw(me(c), me(h), O, q, ne, fe); return fe.delete(c), He; case Ke: if (sf) @@ -22961,13 +22964,13 @@ h0.exports; return ne.delete(c), ne.delete(h), fr; } function uo(c) { - return _g(Pw(c, r, Lw), c + ""); + return _g(Mw(c, r, kw), c + ""); } function pg(c) { - return jy(c, Mn, bg); + return Uy(c, Mn, bg); } function gg(c) { - return jy(c, hi, xw); + return Uy(c, hi, _w); } var mg = Rh ? function(c) { return Rh.get(c); @@ -22986,7 +22989,7 @@ h0.exports; } function Ut() { var c = ee.iteratee || Og; - return c = c === Og ? zy : c, arguments.length ? c(arguments[0], arguments[1]) : c; + return c = c === Og ? Wy : c, arguments.length ? c(arguments[0], arguments[1]) : c; } function Kh(c, h) { var y = c.__data__; @@ -22995,13 +22998,13 @@ h0.exports; function vg(c) { for (var h = Mn(c), y = h.length; y--; ) { var O = h[y], q = c[O]; - h[y] = [O, q, Sw(q)]; + h[y] = [O, q, Aw(q)]; } return h; } function Fa(c, h) { var y = mA(c, h); - return qy(y) ? y : r; + return zy(y) ? y : r; } function oM(c) { var h = Tr.call(c, Na), y = c[Na]; @@ -23015,9 +23018,9 @@ h0.exports; } var bg = Hp ? function(c) { return c == null ? [] : (c = qr(c), Wo(Hp(c), function(h) { - return My.call(c, h); + return Iy.call(c, h); })); - } : kg, xw = Hp ? function(c) { + } : kg, _w = Hp ? function(c) { for (var h = []; c; ) Ho(h, bg(c)), c = Ph(c); return h; @@ -23063,7 +23066,7 @@ h0.exports; var h = c.match(C); return h ? h[1].split(G) : []; } - function _w(c, h, y) { + function Ew(c, h, y) { h = Jo(h, c); for (var O = -1, q = h.length, ne = !1; ++O < q; ) { var fe = Rs(h[O]); @@ -23077,7 +23080,7 @@ h0.exports; var h = c.length, y = new c.constructor(h); return h && typeof c[0] == "string" && Tr.call(c, "index") && (y.index = c.index, y.input = c.input), y; } - function Ew(c) { + function Sw(c) { return typeof c.constructor == "function" && !hf(c) ? kc(Ph(c)) : {}; } function fM(c, h, y) { @@ -23099,7 +23102,7 @@ h0.exports; case lt: case ct: case qt: - return sw(c, y); + return ow(c, y); case ie: return new O(); case ue: @@ -23123,7 +23126,7 @@ h0.exports; `); } function hM(c) { - return ir(c) || Ua(c) || !!(Iy && c && c[Iy]); + return ir(c) || Ua(c) || !!(Cy && c && c[Cy]); } function fo(c, h) { var y = typeof c; @@ -23155,17 +23158,17 @@ h0.exports; return !!O && c === O[0]; } function pM(c) { - return !!Sy && Sy in c; + return !!Ay && Ay in c; } var gM = xh ? lo : $g; function hf(c) { var h = c && c.constructor, y = typeof h == "function" && h.prototype || Oc; return c === y; } - function Sw(c) { + function Aw(c) { return c === c && !Zr(c); } - function Aw(c, h) { + function Pw(c, h) { return function(y) { return y == null ? !1 : y[c] === h && (h !== r || c in qr(y)); }; @@ -23184,9 +23187,9 @@ h0.exports; var me = h[3]; if (me) { var we = c[3]; - c[3] = we ? aw(we, me, h[4]) : me, c[4] = we ? Ko(c[3], d) : h[4]; + c[3] = we ? cw(we, me, h[4]) : me, c[4] = we ? Ko(c[3], d) : h[4]; } - return me = h[5], me && (we = c[5], c[5] = we ? cw(we, me, h[6]) : me, c[6] = we ? Ko(c[5], d) : h[6]), me = h[7], me && (c[7] = me), O & R && (c[8] = c[8] == null ? h[8] : Kn(c[8], h[8])), c[9] == null && (c[9] = h[9]), c[0] = h[0], c[1] = q, c; + return me = h[5], me && (we = c[5], c[5] = we ? uw(we, me, h[6]) : me, c[6] = we ? Ko(c[5], d) : h[6]), me = h[7], me && (c[7] = me), O & R && (c[8] = c[8] == null ? h[8] : Kn(c[8], h[8])), c[9] == null && (c[9] = h[9]), c[0] = h[0], c[1] = q, c; } function bM(c) { var h = []; @@ -23198,7 +23201,7 @@ h0.exports; function yM(c) { return Eh.call(c); } - function Pw(c, h, y) { + function Mw(c, h, y) { return h = _n(h === r ? c.length - 1 : h, 0), function() { for (var O = arguments, q = -1, ne = _n(O.length - h, 0), fe = Ie(ne); ++q < ne; ) fe[q] = O[h + q]; @@ -23208,7 +23211,7 @@ h0.exports; return me[h] = y(fe), Pn(c, this, me); }; } - function Mw(c, h) { + function Iw(c, h) { return h.length < 2 ? c : Ba(c, Wi(h, 0, -1)); } function wM(c, h) { @@ -23222,14 +23225,14 @@ h0.exports; if (!(h === "constructor" && typeof c[h] == "function") && h != "__proto__") return c[h]; } - var Iw = Tw(Xy), df = LA || function(c, h) { + var Cw = Rw(Zy), df = LA || function(c, h) { return _r.setTimeout(c, h); - }, _g = Tw(zP); - function Cw(c, h, y) { + }, _g = Rw(zP); + function Tw(c, h, y) { var O = h + ""; return _g(c, lM(O, xM(cM(O), y))); } - function Tw(c) { + function Rw(c) { var h = 0, y = 0; return function() { var O = FA(), q = m - (O - y); @@ -23249,7 +23252,7 @@ h0.exports; } return c.length = h, c; } - var Rw = mM(function(c) { + var Dw = mM(function(c) { var h = []; return c.charCodeAt(0) === 46 && h.push(""), c.replace(Ft, function(y, O, q, ne) { h.push(q ? ne.replace(he, "$1") : O || y); @@ -23280,7 +23283,7 @@ h0.exports; h & y[1] && !vh(c, O) && c.push(O); }), c.sort(); } - function Dw(c) { + function Ow(c) { if (c instanceof wr) return c.clone(); var h = new qi(c.__wrapped__, c.__chain__); @@ -23337,21 +23340,21 @@ h0.exports; var q = c == null ? 0 : c.length; return q ? (y && typeof y != "number" && ni(c, h, y) && (y = 0, O = q), SP(c, h, y, O)) : []; } - function Ow(c, h, y) { + function Nw(c, h, y) { var O = c == null ? 0 : c.length; if (!O) return -1; var q = y == null ? 0 : cr(y); return q < 0 && (q = _n(O + q, 0)), bh(c, Ut(h, 3), q); } - function Nw(c, h, y) { + function Lw(c, h, y) { var O = c == null ? 0 : c.length; if (!O) return -1; var q = O - 1; return y !== r && (q = cr(y), q = y < 0 ? _n(O + q, 0) : Kn(q, O - 1)), bh(c, Ut(h, 3), q, !0); } - function Lw(c) { + function kw(c) { var h = c == null ? 0 : c.length; return h ? Bn(c, 1) : []; } @@ -23370,7 +23373,7 @@ h0.exports; } return O; } - function kw(c) { + function $w(c) { return c && c.length ? c[0] : r; } function kM(c, h, y) { @@ -23406,13 +23409,13 @@ h0.exports; if (!O) return -1; var q = O; - return y !== r && (q = cr(y), q = q < 0 ? _n(O + q, 0) : Kn(q, O - 1)), h === h ? xA(c, h, q) : bh(c, my, q, !0); + return y !== r && (q = cr(y), q = q < 0 ? _n(O + q, 0) : Kn(q, O - 1)), h === h ? xA(c, h, q) : bh(c, vy, q, !0); } function zM(c, h) { - return c && c.length ? Vy(c, cr(h)) : r; + return c && c.length ? Gy(c, cr(h)) : r; } - var WM = hr($w); - function $w(c, h) { + var WM = hr(Bw); + function Bw(c, h) { return c && c.length && h && h.length ? ng(c, h) : c; } function HM(c, h, y) { @@ -23423,9 +23426,9 @@ h0.exports; } var VM = uo(function(c, h) { var y = c == null ? 0 : c.length, O = Yp(c, h); - return Jy(c, Xr(h, function(q) { + return Xy(c, Xr(h, function(q) { return fo(q, y) ? +q : q; - }).sort(ow)), O; + }).sort(aw)), O; }); function GM(c, h) { var y = []; @@ -23436,7 +23439,7 @@ h0.exports; var fe = c[O]; h(fe, O, c) && (y.push(fe), q.push(O)); } - return Jy(c, q), y; + return Xy(c, q), y; } function Eg(c) { return c == null ? c : UA.call(c); @@ -23476,10 +23479,10 @@ h0.exports; return -1; } function rI(c) { - return c && c.length ? Zy(c) : []; + return c && c.length ? Qy(c) : []; } function nI(c, h) { - return c && c.length ? Zy(c, Ut(h, 2)) : []; + return c && c.length ? Qy(c, Ut(h, 2)) : []; } function iI(c) { var h = c == null ? 0 : c.length; @@ -23527,7 +23530,7 @@ h0.exports; return Xr(c, Bp(y)); }); } - function Bw(c, h) { + function Fw(c, h) { if (!(c && c.length)) return []; var y = Sg(c); @@ -23547,16 +23550,16 @@ h0.exports; return h = typeof h == "function" ? h : r, cg(Wo(c, cn), r, h); }), yI = hr(Sg); function wI(c, h) { - return rw(c || [], h || [], of); + return nw(c || [], h || [], of); } function xI(c, h) { - return rw(c || [], h || [], ff); + return nw(c || [], h || [], ff); } var _I = hr(function(c) { var h = c.length, y = h > 1 ? c[h - 1] : r; - return y = typeof y == "function" ? (c.pop(), y) : r, Bw(c, y); + return y = typeof y == "function" ? (c.pop(), y) : r, Fw(c, y); }); - function Fw(c) { + function jw(c) { var h = ee(c); return h.__chain__ = !0, h; } @@ -23579,13 +23582,13 @@ h0.exports; })); }); function AI() { - return Fw(this); + return jw(this); } function PI() { return new qi(this.value(), this.__chain__); } function MI() { - this.__values__ === r && (this.__values__ = Qw(this.value())); + this.__values__ === r && (this.__values__ = e2(this.value())); var c = this.__index__ >= this.__values__.length, h = c ? r : this.__values__[this.__index__++]; return { done: c, value: h }; } @@ -23594,7 +23597,7 @@ h0.exports; } function CI(c) { for (var h, y = this; y instanceof Oh; ) { - var O = Dw(y); + var O = Ow(y); O.__index__ = 0, O.__values__ = r, h ? q.__wrapped__ = O : h = O; var q = O; y = y.__wrapped__; @@ -23614,20 +23617,20 @@ h0.exports; return this.thru(Eg); } function RI() { - return tw(this.__wrapped__, this.__actions__); + return rw(this.__wrapped__, this.__actions__); } var DI = jh(function(c, h, y) { Tr.call(c, y) ? ++c[y] : ao(c, y, 1); }); function OI(c, h, y) { - var O = ir(c) ? py : EP; + var O = ir(c) ? gy : EP; return y && ni(c, h, y) && (h = r), O(c, Ut(h, 3)); } function NI(c, h) { - var y = ir(c) ? Wo : By; + var y = ir(c) ? Wo : Fy; return y(c, Ut(h, 3)); } - var LI = hw(Ow), kI = hw(Nw); + var LI = dw(Nw), kI = dw(Lw); function $I(c, h) { return Bn(Yh(c, h), 1); } @@ -23637,12 +23640,12 @@ h0.exports; function FI(c, h, y) { return y = y === r ? 1 : cr(y), Bn(Yh(c, h), y); } - function jw(c, h) { + function Uw(c, h) { var y = ir(c) ? ji : Go; return y(c, Ut(h, 3)); } - function Uw(c, h) { - var y = ir(c) ? iA : $y; + function qw(c, h) { + var y = ir(c) ? iA : By; return y(c, Ut(h, 3)); } var jI = jh(function(c, h, y) { @@ -23662,11 +23665,11 @@ h0.exports; ao(c, y, h); }); function Yh(c, h) { - var y = ir(c) ? Xr : Wy; + var y = ir(c) ? Xr : Hy; return y(c, Ut(h, 3)); } function WI(c, h, y, O) { - return c == null ? [] : (ir(h) || (h = h == null ? [] : [h]), y = O ? r : y, ir(y) || (y = y == null ? [] : [y]), Gy(c, h, y)); + return c == null ? [] : (ir(h) || (h = h == null ? [] : [h]), y = O ? r : y, ir(y) || (y = y == null ? [] : [y]), Yy(c, h, y)); } var HI = jh(function(c, h, y) { c[y ? 0 : 1].push(h); @@ -23674,19 +23677,19 @@ h0.exports; return [[], []]; }); function KI(c, h, y) { - var O = ir(c) ? kp : by, q = arguments.length < 3; + var O = ir(c) ? kp : yy, q = arguments.length < 3; return O(c, Ut(h, 4), y, q, Go); } function VI(c, h, y) { - var O = ir(c) ? sA : by, q = arguments.length < 3; - return O(c, Ut(h, 4), y, q, $y); + var O = ir(c) ? sA : yy, q = arguments.length < 3; + return O(c, Ut(h, 4), y, q, By); } function GI(c, h) { - var y = ir(c) ? Wo : By; + var y = ir(c) ? Wo : Fy; return y(c, Zh(Ut(h, 3))); } function YI(c) { - var h = ir(c) ? Oy : UP; + var h = ir(c) ? Ny : UP; return h(c); } function JI(c, h, y) { @@ -23714,7 +23717,7 @@ h0.exports; if (c == null) return []; var y = h.length; - return y > 1 && ni(c, h[0], h[1]) ? h = [] : y > 2 && ni(h[0], h[1], h[2]) && (h = [h[0]]), Gy(c, Bn(h, 1), []); + return y > 1 && ni(c, h[0], h[1]) ? h = [] : y > 2 && ni(h[0], h[1], h[2]) && (h = [h[0]]), Yy(c, Bn(h, 1), []); }), Jh = NA || function() { return _r.Date.now(); }; @@ -23726,10 +23729,10 @@ h0.exports; return h.apply(this, arguments); }; } - function qw(c, h, y) { + function zw(c, h, y) { return h = y ? r : h, h = c && h == null ? c.length : h, co(c, R, r, r, r, r, h); } - function zw(c, h) { + function Ww(c, h) { var y; if (typeof h != "function") throw new Ui(o); @@ -23744,25 +23747,25 @@ h0.exports; O |= V; } return co(c, O, h, y, q); - }), Ww = hr(function(c, h, y) { + }), Hw = hr(function(c, h, y) { var O = L | B; if (y.length) { - var q = Ko(y, Fc(Ww)); + var q = Ko(y, Fc(Hw)); O |= V; } return co(h, O, c, y, q); }); - function Hw(c, h, y) { + function Kw(c, h, y) { h = y ? r : h; var O = co(c, H, r, r, r, r, r, h); - return O.placeholder = Hw.placeholder, O; + return O.placeholder = Kw.placeholder, O; } - function Kw(c, h, y) { + function Vw(c, h, y) { h = y ? r : h; var O = co(c, W, r, r, r, r, r, h); - return O.placeholder = Kw.placeholder, O; + return O.placeholder = Vw.placeholder, O; } - function Vw(c, h, y) { + function Gw(c, h, y) { var O, q, ne, fe, me, we, We = 0, He = !1, Xe = !1, wt = !0; if (typeof c != "function") throw new Ui(o); @@ -23775,8 +23778,8 @@ h0.exports; return We = un, me = df(vr, h), He ? Ot(un) : fe; } function fr(un) { - var ps = un - we, po = un - We, h2 = h - ps; - return Xe ? Kn(h2, ne - po) : h2; + var ps = un - we, po = un - We, d2 = h - ps; + return Xe ? Kn(d2, ne - po) : d2; } function Kt(un) { var ps = un - we, po = un - We; @@ -23792,7 +23795,7 @@ h0.exports; return me = r, wt && O ? Ot(un) : (O = q = r, fe); } function Ci() { - me !== r && nw(me), We = 0, O = we = q = me = r; + me !== r && iw(me), We = 0, O = we = q = me = r; } function ii() { return me === r ? fe : Er(Jh()); @@ -23803,16 +23806,16 @@ h0.exports; if (me === r) return Ht(we); if (Xe) - return nw(me), me = df(vr, h), Ot(we); + return iw(me), me = df(vr, h), Ot(we); } return me === r && (me = df(vr, h)), fe; } return Ti.cancel = Ci, Ti.flush = ii, Ti; } var rC = hr(function(c, h) { - return ky(c, 1, h); + return $y(c, 1, h); }), nC = hr(function(c, h, y) { - return ky(c, Ki(h) || 0, y); + return $y(c, Ki(h) || 0, y); }); function iC(c) { return co(c, ge); @@ -23849,7 +23852,7 @@ h0.exports; }; } function sC(c) { - return zw(2, c); + return Ww(2, c); } var oC = KP(function(c, h) { h = h.length == 1 && ir(h[0]) ? Xr(h[0], Pi(Ut())) : Xr(Bn(h, 1), Pi(Ut())); @@ -23862,8 +23865,8 @@ h0.exports; }), Pg = hr(function(c, h) { var y = Ko(h, Fc(Pg)); return co(c, V, r, h, y); - }), Gw = hr(function(c, h) { - var y = Ko(h, Fc(Gw)); + }), Yw = hr(function(c, h) { + var y = Ko(h, Fc(Yw)); return co(c, te, r, h, y); }), aC = uo(function(c, h) { return co(c, K, r, r, r, h); @@ -23885,14 +23888,14 @@ h0.exports; var O = !0, q = !0; if (typeof c != "function") throw new Ui(o); - return Zr(y) && (O = "leading" in y ? !!y.leading : O, q = "trailing" in y ? !!y.trailing : q), Vw(c, h, { + return Zr(y) && (O = "leading" in y ? !!y.leading : O, q = "trailing" in y ? !!y.trailing : q), Gw(c, h, { leading: O, maxWait: h, trailing: q }); } function lC(c) { - return qw(c, 1); + return zw(c, 1); } function hC(c, h) { return Pg(fg(h), c); @@ -23916,17 +23919,17 @@ h0.exports; return h = typeof h == "function" ? h : r, zi(c, p | A, h); } function bC(c, h) { - return h == null || Ly(c, h, Mn(h)); + return h == null || ky(c, h, Mn(h)); } function ds(c, h) { return c === h || c !== c && h !== h; } var yC = Wh(Zp), wC = Wh(function(c, h) { return c >= h; - }), Ua = Uy(/* @__PURE__ */ function() { + }), Ua = qy(/* @__PURE__ */ function() { return arguments; - }()) ? Uy : function(c) { - return en(c) && Tr.call(c, "callee") && !My.call(c, "callee"); + }()) ? qy : function(c) { + return en(c) && Tr.call(c, "callee") && !Iy.call(c, "callee"); }, ir = Ie.isArray, xC = ti ? Pi(ti) : CP; function li(c) { return c != null && Qh(c.length) && !lo(c); @@ -23971,7 +23974,7 @@ h0.exports; return h == X || h == T || typeof c.message == "string" && typeof c.name == "string" && !pf(c); } function IC(c) { - return typeof c == "number" && Cy(c); + return typeof c == "number" && Ty(c); } function lo(c) { if (!Zr(c)) @@ -23979,7 +23982,7 @@ h0.exports; var h = ri(c); return h == re || h == de || h == Z || h == Ce; } - function Yw(c) { + function Jw(c) { return typeof c == "number" && c == cr(c); } function Qh(c) { @@ -23992,7 +23995,7 @@ h0.exports; function en(c) { return c != null && typeof c == "object"; } - var Jw = Fi ? Pi(Fi) : DP; + var Xw = Fi ? Pi(Fi) : DP; function CC(c, h) { return c === h || eg(c, h, vg(h)); } @@ -24000,12 +24003,12 @@ h0.exports; return y = typeof y == "function" ? y : r, eg(c, h, vg(h), y); } function RC(c) { - return Xw(c) && c != +c; + return Zw(c) && c != +c; } function DC(c) { if (gM(c)) throw new tr(s); - return qy(c); + return zy(c); } function OC(c) { return c === null; @@ -24013,7 +24016,7 @@ h0.exports; function NC(c) { return c == null; } - function Xw(c) { + function Zw(c) { return typeof c == "number" || en(c) && ri(c) == ue; } function pf(c) { @@ -24027,9 +24030,9 @@ h0.exports; } var Ig = Is ? Pi(Is) : OP; function LC(c) { - return Yw(c) && c >= -_ && c <= _; + return Jw(c) && c >= -_ && c <= _; } - var Zw = Zu ? Pi(Zu) : NP; + var Qw = Zu ? Pi(Zu) : NP; function ed(c) { return typeof c == "string" || !ir(c) && en(c) && ri(c) == Ne; } @@ -24049,7 +24052,7 @@ h0.exports; var FC = Wh(rg), jC = Wh(function(c, h) { return c <= h; }); - function Qw(c) { + function e2(c) { if (!c) return []; if (li(c)) @@ -24072,7 +24075,7 @@ h0.exports; var h = ho(c), y = h % 1; return h === h ? y ? h - y : h : 0; } - function e2(c) { + function t2(c) { return c ? $a(cr(c), 0, P) : 0; } function Ki(c) { @@ -24086,11 +24089,11 @@ h0.exports; } if (typeof c != "string") return c === 0 ? c : +c; - c = yy(c); + c = wy(c); var y = nt.test(c); return y || pt.test(c) ? nr(c.slice(2), y ? 2 : 8) : Re.test(c) ? v : +c; } - function t2(c) { + function r2(c) { return Ts(c, hi(c)); } function UC(c) { @@ -24106,7 +24109,7 @@ h0.exports; } for (var y in h) Tr.call(h, y) && of(c, y, h[y]); - }), r2 = $c(function(c, h) { + }), n2 = $c(function(c, h) { Ts(h, hi(h), c); }), td = $c(function(c, h, y, O) { Ts(h, hi(h), c, O); @@ -24115,7 +24118,7 @@ h0.exports; }), WC = uo(Yp); function HC(c, h) { var y = kc(c); - return h == null ? y : Ny(y, h); + return h == null ? y : Ly(y, h); } var KC = hr(function(c, h) { c = qr(c); @@ -24127,19 +24130,19 @@ h0.exports; } return c; }), VC = hr(function(c) { - return c.push(r, yw), Pn(n2, r, c); + return c.push(r, ww), Pn(i2, r, c); }); function GC(c, h) { - return gy(c, Ut(h, 3), Cs); + return my(c, Ut(h, 3), Cs); } function YC(c, h) { - return gy(c, Ut(h, 3), Xp); + return my(c, Ut(h, 3), Xp); } function JC(c, h) { return c == null ? c : Jp(c, Ut(h, 3), hi); } function XC(c, h) { - return c == null ? c : Fy(c, Ut(h, 3), hi); + return c == null ? c : jy(c, Ut(h, 3), hi); } function ZC(c, h) { return c && Cs(c, Ut(h, 3)); @@ -24158,21 +24161,21 @@ h0.exports; return O === r ? y : O; } function rT(c, h) { - return c != null && _w(c, h, AP); + return c != null && Ew(c, h, AP); } function Tg(c, h) { - return c != null && _w(c, h, PP); + return c != null && Ew(c, h, PP); } - var nT = pw(function(c, h, y) { + var nT = gw(function(c, h, y) { h != null && typeof h.toString != "function" && (h = Eh.call(h)), c[h] = y; - }, Dg(di)), iT = pw(function(c, h, y) { + }, Dg(di)), iT = gw(function(c, h, y) { h != null && typeof h.toString != "function" && (h = Eh.call(h)), Tr.call(c, h) ? c[h].push(y) : c[h] = [y]; }, Ut), sT = hr(cf); function Mn(c) { - return li(c) ? Dy(c) : tg(c); + return li(c) ? Oy(c) : tg(c); } function hi(c) { - return li(c) ? Dy(c, !0) : kP(c); + return li(c) ? Oy(c, !0) : kP(c); } function oT(c, h) { var y = {}; @@ -24188,7 +24191,7 @@ h0.exports; } var cT = $c(function(c, h, y) { $h(c, h, y); - }), n2 = $c(function(c, h, y, O) { + }), i2 = $c(function(c, h, y, O) { $h(c, h, y, O); }), uT = uo(function(c, h) { var y = {}; @@ -24203,18 +24206,18 @@ h0.exports; return y; }); function fT(c, h) { - return i2(c, Zh(Ut(h))); + return s2(c, Zh(Ut(h))); } var lT = uo(function(c, h) { return c == null ? {} : BP(c, h); }); - function i2(c, h) { + function s2(c, h) { if (c == null) return {}; var y = Xr(gg(c), function(O) { return [O]; }); - return h = Ut(h), Yy(c, y, function(O, q) { + return h = Ut(h), Jy(c, y, function(O, q) { return h(O, q[0]); }); } @@ -24233,7 +24236,7 @@ h0.exports; function pT(c, h, y, O) { return O = typeof O == "function" ? O : r, c == null ? c : ff(c, h, y, O); } - var s2 = vw(Mn), o2 = vw(hi); + var o2 = bw(Mn), a2 = bw(hi); function gT(c, h, y) { var O = ir(c), q = O || Zo(c) || jc(c); if (h = Ut(h, 4), y == null) { @@ -24248,10 +24251,10 @@ h0.exports; return c == null ? !0 : ag(c, h); } function vT(c, h, y) { - return c == null ? c : ew(c, h, fg(y)); + return c == null ? c : tw(c, h, fg(y)); } function bT(c, h, y, O) { - return O = typeof O == "function" ? O : r, c == null ? c : ew(c, h, fg(y), O); + return O = typeof O == "function" ? O : r, c == null ? c : tw(c, h, fg(y), O); } function Uc(c) { return c == null ? [] : qp(c, Mn(c)); @@ -24271,18 +24274,18 @@ h0.exports; c = h, h = O; } if (y || c % 1 || h % 1) { - var q = Ty(); + var q = Ry(); return Kn(c + q * (h - c + jr("1e-" + ((q + "").length - 1))), h); } return ig(c, h); } var ET = Bc(function(c, h, y) { - return h = h.toLowerCase(), c + (y ? a2(h) : h); + return h = h.toLowerCase(), c + (y ? c2(h) : h); }); - function a2(c) { + function c2(c) { return Rg(Cr(c).toLowerCase()); } - function c2(c) { + function u2(c) { return c = Cr(c), c && c.replace(et, dA).replace(Op, ""); } function ST(c, h, y) { @@ -24302,7 +24305,7 @@ h0.exports; return c + (y ? "-" : "") + h.toLowerCase(); }), IT = Bc(function(c, h, y) { return c + (y ? " " : "") + h.toLowerCase(); - }), CT = lw("toLowerCase"); + }), CT = hw("toLowerCase"); function TT(c, h, y) { c = Cr(c), h = cr(h); var O = h ? Rc(c) : 0; @@ -24345,8 +24348,8 @@ h0.exports; } function jT(c, h, y) { var O = ee.templateSettings; - y && ni(c, h, y) && (h = r), c = Cr(c), h = td({}, h, O, bw); - var q = td({}, h.imports, O.imports, bw), ne = Mn(q), fe = qp(q, ne), me, we, We = 0, He = h.interpolate || St, Xe = "__p += '", wt = Wp( + y && ni(c, h, y) && (h = r), c = Cr(c), h = td({}, h, O, yw); + var q = td({}, h.imports, O.imports, yw), ne = Mn(q), fe = qp(q, ne), me, we, We = 0, He = h.interpolate || St, Xe = "__p += '", wt = Wp( (h.escape || St).source + "|" + He.source + "|" + (He === Nt ? xe : St).source + "|" + (h.evaluate || St).source + "|$", "g" ), Ot = "//# sourceURL=" + (Tr.call(h, "sourceURL") ? (h.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++Np + "]") + ` @@ -24376,7 +24379,7 @@ function print() { __p += __j.call(arguments, '') } ` : `; `) + Xe + `return __p }`; - var fr = f2(function() { + var fr = l2(function() { return Pr(ne, Ot + "return " + Xe).apply(r, fe); }); if (fr.source = Xe, Mg(fr)) @@ -24391,18 +24394,18 @@ function print() { __p += __j.call(arguments, '') } } function zT(c, h, y) { if (c = Cr(c), c && (y || h === r)) - return yy(c); + return wy(c); if (!c || !(h = Mi(h))) return c; - var O = ls(c), q = ls(h), ne = wy(O, q), fe = xy(O, q) + 1; + var O = ls(c), q = ls(h), ne = xy(O, q), fe = _y(O, q) + 1; return Xo(O, ne, fe).join(""); } function WT(c, h, y) { if (c = Cr(c), c && (y || h === r)) - return c.slice(0, Ey(c) + 1); + return c.slice(0, Sy(c) + 1); if (!c || !(h = Mi(h))) return c; - var O = ls(c), q = xy(O, ls(h)) + 1; + var O = ls(c), q = _y(O, ls(h)) + 1; return Xo(O, 0, q).join(""); } function HT(c, h, y) { @@ -24410,7 +24413,7 @@ function print() { __p += __j.call(arguments, '') } return c.replace(k, ""); if (!c || !(h = Mi(h))) return c; - var O = ls(c), q = wy(O, ls(h)); + var O = ls(c), q = xy(O, ls(h)); return Xo(O, q).join(""); } function KT(c, h) { @@ -24451,11 +24454,11 @@ function print() { __p += __j.call(arguments, '') } } var GT = Bc(function(c, h, y) { return c + (y ? " " : "") + h.toUpperCase(); - }), Rg = lw("toUpperCase"); - function u2(c, h, y) { + }), Rg = hw("toUpperCase"); + function f2(c, h, y) { return c = Cr(c), h = y ? r : h, h === r ? vA(c) ? AA(c) : cA(c) : c.match(h) || []; } - var f2 = hr(function(c, h) { + var l2 = hr(function(c, h) { try { return Pn(c, r, h); } catch (y) { @@ -24491,18 +24494,18 @@ function print() { __p += __j.call(arguments, '') } function ZT(c, h) { return c == null || c !== c ? h : c; } - var QT = dw(), eR = dw(!0); + var QT = pw(), eR = pw(!0); function di(c) { return c; } function Og(c) { - return zy(typeof c == "function" ? c : zi(c, p)); + return Wy(typeof c == "function" ? c : zi(c, p)); } function tR(c) { - return Hy(zi(c, p)); + return Ky(zi(c, p)); } function rR(c, h) { - return Ky(c, zi(h, p)); + return Vy(c, zi(h, p)); } var nR = hr(function(c, h) { return function(y) { @@ -24536,11 +24539,11 @@ function print() { __p += __j.call(arguments, '') } } function oR(c) { return c = cr(c), hr(function(h) { - return Vy(h, c); + return Gy(h, c); }); } - var aR = hg(Xr), cR = hg(py), uR = hg($p); - function l2(c) { + var aR = hg(Xr), cR = hg(gy), uR = hg($p); + function h2(c) { return yg(c) ? Bp(Rs(c)) : FP(c); } function fR(c) { @@ -24548,7 +24551,7 @@ function print() { __p += __j.call(arguments, '') } return c == null ? r : Ba(c, h); }; } - var lR = gw(), hR = gw(!0); + var lR = mw(), hR = mw(!0); function kg() { return []; } @@ -24574,7 +24577,7 @@ function print() { __p += __j.call(arguments, '') } return q; } function vR(c) { - return ir(c) ? Xr(c, Rs) : Ii(c) ? [c] : fi(Rw(Cr(c))); + return ir(c) ? Xr(c, Rs) : Ii(c) ? [c] : fi(Dw(Cr(c))); } function bR(c) { var h = ++CA; @@ -24592,10 +24595,10 @@ function print() { __p += __j.call(arguments, '') } return c && c.length ? Lh(c, Ut(h, 2), Zp) : r; } function AR(c) { - return vy(c, di); + return by(c, di); } function PR(c, h) { - return vy(c, Ut(h, 2)); + return by(c, Ut(h, 2)); } function MR(c) { return c && c.length ? Lh(c, di, rg) : r; @@ -24614,7 +24617,7 @@ function print() { __p += __j.call(arguments, '') } function OR(c, h) { return c && c.length ? jp(c, Ut(h, 2)) : 0; } - return ee.after = tC, ee.ary = qw, ee.assign = qC, ee.assignIn = r2, ee.assignInWith = td, ee.assignWith = zC, ee.at = WC, ee.before = zw, ee.bind = Ag, ee.bindAll = YT, ee.bindKey = Ww, ee.castArray = dC, ee.chain = Fw, ee.chunk = _M, ee.compact = EM, ee.concat = SM, ee.cond = JT, ee.conforms = XT, ee.constant = Dg, ee.countBy = DI, ee.create = HC, ee.curry = Hw, ee.curryRight = Kw, ee.debounce = Vw, ee.defaults = KC, ee.defaultsDeep = VC, ee.defer = rC, ee.delay = nC, ee.difference = AM, ee.differenceBy = PM, ee.differenceWith = MM, ee.drop = IM, ee.dropRight = CM, ee.dropRightWhile = TM, ee.dropWhile = RM, ee.fill = DM, ee.filter = NI, ee.flatMap = $I, ee.flatMapDeep = BI, ee.flatMapDepth = FI, ee.flatten = Lw, ee.flattenDeep = OM, ee.flattenDepth = NM, ee.flip = iC, ee.flow = QT, ee.flowRight = eR, ee.fromPairs = LM, ee.functions = eT, ee.functionsIn = tT, ee.groupBy = jI, ee.initial = $M, ee.intersection = BM, ee.intersectionBy = FM, ee.intersectionWith = jM, ee.invert = nT, ee.invertBy = iT, ee.invokeMap = qI, ee.iteratee = Og, ee.keyBy = zI, ee.keys = Mn, ee.keysIn = hi, ee.map = Yh, ee.mapKeys = oT, ee.mapValues = aT, ee.matches = tR, ee.matchesProperty = rR, ee.memoize = Xh, ee.merge = cT, ee.mergeWith = n2, ee.method = nR, ee.methodOf = iR, ee.mixin = Ng, ee.negate = Zh, ee.nthArg = oR, ee.omit = uT, ee.omitBy = fT, ee.once = sC, ee.orderBy = WI, ee.over = aR, ee.overArgs = oC, ee.overEvery = cR, ee.overSome = uR, ee.partial = Pg, ee.partialRight = Gw, ee.partition = HI, ee.pick = lT, ee.pickBy = i2, ee.property = l2, ee.propertyOf = fR, ee.pull = WM, ee.pullAll = $w, ee.pullAllBy = HM, ee.pullAllWith = KM, ee.pullAt = VM, ee.range = lR, ee.rangeRight = hR, ee.rearg = aC, ee.reject = GI, ee.remove = GM, ee.rest = cC, ee.reverse = Eg, ee.sampleSize = JI, ee.set = dT, ee.setWith = pT, ee.shuffle = XI, ee.slice = YM, ee.sortBy = eC, ee.sortedUniq = rI, ee.sortedUniqBy = nI, ee.split = $T, ee.spread = uC, ee.tail = iI, ee.take = sI, ee.takeRight = oI, ee.takeRightWhile = aI, ee.takeWhile = cI, ee.tap = EI, ee.throttle = fC, ee.thru = Gh, ee.toArray = Qw, ee.toPairs = s2, ee.toPairsIn = o2, ee.toPath = vR, ee.toPlainObject = t2, ee.transform = gT, ee.unary = lC, ee.union = uI, ee.unionBy = fI, ee.unionWith = lI, ee.uniq = hI, ee.uniqBy = dI, ee.uniqWith = pI, ee.unset = mT, ee.unzip = Sg, ee.unzipWith = Bw, ee.update = vT, ee.updateWith = bT, ee.values = Uc, ee.valuesIn = yT, ee.without = gI, ee.words = u2, ee.wrap = hC, ee.xor = mI, ee.xorBy = vI, ee.xorWith = bI, ee.zip = yI, ee.zipObject = wI, ee.zipObjectDeep = xI, ee.zipWith = _I, ee.entries = s2, ee.entriesIn = o2, ee.extend = r2, ee.extendWith = td, Ng(ee, ee), ee.add = yR, ee.attempt = f2, ee.camelCase = ET, ee.capitalize = a2, ee.ceil = wR, ee.clamp = wT, ee.clone = pC, ee.cloneDeep = mC, ee.cloneDeepWith = vC, ee.cloneWith = gC, ee.conformsTo = bC, ee.deburr = c2, ee.defaultTo = ZT, ee.divide = xR, ee.endsWith = ST, ee.eq = ds, ee.escape = AT, ee.escapeRegExp = PT, ee.every = OI, ee.find = LI, ee.findIndex = Ow, ee.findKey = GC, ee.findLast = kI, ee.findLastIndex = Nw, ee.findLastKey = YC, ee.floor = _R, ee.forEach = jw, ee.forEachRight = Uw, ee.forIn = JC, ee.forInRight = XC, ee.forOwn = ZC, ee.forOwnRight = QC, ee.get = Cg, ee.gt = yC, ee.gte = wC, ee.has = rT, ee.hasIn = Tg, ee.head = kw, ee.identity = di, ee.includes = UI, ee.indexOf = kM, ee.inRange = xT, ee.invoke = sT, ee.isArguments = Ua, ee.isArray = ir, ee.isArrayBuffer = xC, ee.isArrayLike = li, ee.isArrayLikeObject = cn, ee.isBoolean = _C, ee.isBuffer = Zo, ee.isDate = EC, ee.isElement = SC, ee.isEmpty = AC, ee.isEqual = PC, ee.isEqualWith = MC, ee.isError = Mg, ee.isFinite = IC, ee.isFunction = lo, ee.isInteger = Yw, ee.isLength = Qh, ee.isMap = Jw, ee.isMatch = CC, ee.isMatchWith = TC, ee.isNaN = RC, ee.isNative = DC, ee.isNil = NC, ee.isNull = OC, ee.isNumber = Xw, ee.isObject = Zr, ee.isObjectLike = en, ee.isPlainObject = pf, ee.isRegExp = Ig, ee.isSafeInteger = LC, ee.isSet = Zw, ee.isString = ed, ee.isSymbol = Ii, ee.isTypedArray = jc, ee.isUndefined = kC, ee.isWeakMap = $C, ee.isWeakSet = BC, ee.join = UM, ee.kebabCase = MT, ee.last = Hi, ee.lastIndexOf = qM, ee.lowerCase = IT, ee.lowerFirst = CT, ee.lt = FC, ee.lte = jC, ee.max = ER, ee.maxBy = SR, ee.mean = AR, ee.meanBy = PR, ee.min = MR, ee.minBy = IR, ee.stubArray = kg, ee.stubFalse = $g, ee.stubObject = dR, ee.stubString = pR, ee.stubTrue = gR, ee.multiply = CR, ee.nth = zM, ee.noConflict = sR, ee.noop = Lg, ee.now = Jh, ee.pad = TT, ee.padEnd = RT, ee.padStart = DT, ee.parseInt = OT, ee.random = _T, ee.reduce = KI, ee.reduceRight = VI, ee.repeat = NT, ee.replace = LT, ee.result = hT, ee.round = TR, ee.runInContext = be, ee.sample = YI, ee.size = ZI, ee.snakeCase = kT, ee.some = QI, ee.sortedIndex = JM, ee.sortedIndexBy = XM, ee.sortedIndexOf = ZM, ee.sortedLastIndex = QM, ee.sortedLastIndexBy = eI, ee.sortedLastIndexOf = tI, ee.startCase = BT, ee.startsWith = FT, ee.subtract = RR, ee.sum = DR, ee.sumBy = OR, ee.template = jT, ee.times = mR, ee.toFinite = ho, ee.toInteger = cr, ee.toLength = e2, ee.toLower = UT, ee.toNumber = Ki, ee.toSafeInteger = UC, ee.toString = Cr, ee.toUpper = qT, ee.trim = zT, ee.trimEnd = WT, ee.trimStart = HT, ee.truncate = KT, ee.unescape = VT, ee.uniqueId = bR, ee.upperCase = GT, ee.upperFirst = Rg, ee.each = jw, ee.eachRight = Uw, ee.first = kw, Ng(ee, function() { + return ee.after = tC, ee.ary = zw, ee.assign = qC, ee.assignIn = n2, ee.assignInWith = td, ee.assignWith = zC, ee.at = WC, ee.before = Ww, ee.bind = Ag, ee.bindAll = YT, ee.bindKey = Hw, ee.castArray = dC, ee.chain = jw, ee.chunk = _M, ee.compact = EM, ee.concat = SM, ee.cond = JT, ee.conforms = XT, ee.constant = Dg, ee.countBy = DI, ee.create = HC, ee.curry = Kw, ee.curryRight = Vw, ee.debounce = Gw, ee.defaults = KC, ee.defaultsDeep = VC, ee.defer = rC, ee.delay = nC, ee.difference = AM, ee.differenceBy = PM, ee.differenceWith = MM, ee.drop = IM, ee.dropRight = CM, ee.dropRightWhile = TM, ee.dropWhile = RM, ee.fill = DM, ee.filter = NI, ee.flatMap = $I, ee.flatMapDeep = BI, ee.flatMapDepth = FI, ee.flatten = kw, ee.flattenDeep = OM, ee.flattenDepth = NM, ee.flip = iC, ee.flow = QT, ee.flowRight = eR, ee.fromPairs = LM, ee.functions = eT, ee.functionsIn = tT, ee.groupBy = jI, ee.initial = $M, ee.intersection = BM, ee.intersectionBy = FM, ee.intersectionWith = jM, ee.invert = nT, ee.invertBy = iT, ee.invokeMap = qI, ee.iteratee = Og, ee.keyBy = zI, ee.keys = Mn, ee.keysIn = hi, ee.map = Yh, ee.mapKeys = oT, ee.mapValues = aT, ee.matches = tR, ee.matchesProperty = rR, ee.memoize = Xh, ee.merge = cT, ee.mergeWith = i2, ee.method = nR, ee.methodOf = iR, ee.mixin = Ng, ee.negate = Zh, ee.nthArg = oR, ee.omit = uT, ee.omitBy = fT, ee.once = sC, ee.orderBy = WI, ee.over = aR, ee.overArgs = oC, ee.overEvery = cR, ee.overSome = uR, ee.partial = Pg, ee.partialRight = Yw, ee.partition = HI, ee.pick = lT, ee.pickBy = s2, ee.property = h2, ee.propertyOf = fR, ee.pull = WM, ee.pullAll = Bw, ee.pullAllBy = HM, ee.pullAllWith = KM, ee.pullAt = VM, ee.range = lR, ee.rangeRight = hR, ee.rearg = aC, ee.reject = GI, ee.remove = GM, ee.rest = cC, ee.reverse = Eg, ee.sampleSize = JI, ee.set = dT, ee.setWith = pT, ee.shuffle = XI, ee.slice = YM, ee.sortBy = eC, ee.sortedUniq = rI, ee.sortedUniqBy = nI, ee.split = $T, ee.spread = uC, ee.tail = iI, ee.take = sI, ee.takeRight = oI, ee.takeRightWhile = aI, ee.takeWhile = cI, ee.tap = EI, ee.throttle = fC, ee.thru = Gh, ee.toArray = e2, ee.toPairs = o2, ee.toPairsIn = a2, ee.toPath = vR, ee.toPlainObject = r2, ee.transform = gT, ee.unary = lC, ee.union = uI, ee.unionBy = fI, ee.unionWith = lI, ee.uniq = hI, ee.uniqBy = dI, ee.uniqWith = pI, ee.unset = mT, ee.unzip = Sg, ee.unzipWith = Fw, ee.update = vT, ee.updateWith = bT, ee.values = Uc, ee.valuesIn = yT, ee.without = gI, ee.words = f2, ee.wrap = hC, ee.xor = mI, ee.xorBy = vI, ee.xorWith = bI, ee.zip = yI, ee.zipObject = wI, ee.zipObjectDeep = xI, ee.zipWith = _I, ee.entries = o2, ee.entriesIn = a2, ee.extend = n2, ee.extendWith = td, Ng(ee, ee), ee.add = yR, ee.attempt = l2, ee.camelCase = ET, ee.capitalize = c2, ee.ceil = wR, ee.clamp = wT, ee.clone = pC, ee.cloneDeep = mC, ee.cloneDeepWith = vC, ee.cloneWith = gC, ee.conformsTo = bC, ee.deburr = u2, ee.defaultTo = ZT, ee.divide = xR, ee.endsWith = ST, ee.eq = ds, ee.escape = AT, ee.escapeRegExp = PT, ee.every = OI, ee.find = LI, ee.findIndex = Nw, ee.findKey = GC, ee.findLast = kI, ee.findLastIndex = Lw, ee.findLastKey = YC, ee.floor = _R, ee.forEach = Uw, ee.forEachRight = qw, ee.forIn = JC, ee.forInRight = XC, ee.forOwn = ZC, ee.forOwnRight = QC, ee.get = Cg, ee.gt = yC, ee.gte = wC, ee.has = rT, ee.hasIn = Tg, ee.head = $w, ee.identity = di, ee.includes = UI, ee.indexOf = kM, ee.inRange = xT, ee.invoke = sT, ee.isArguments = Ua, ee.isArray = ir, ee.isArrayBuffer = xC, ee.isArrayLike = li, ee.isArrayLikeObject = cn, ee.isBoolean = _C, ee.isBuffer = Zo, ee.isDate = EC, ee.isElement = SC, ee.isEmpty = AC, ee.isEqual = PC, ee.isEqualWith = MC, ee.isError = Mg, ee.isFinite = IC, ee.isFunction = lo, ee.isInteger = Jw, ee.isLength = Qh, ee.isMap = Xw, ee.isMatch = CC, ee.isMatchWith = TC, ee.isNaN = RC, ee.isNative = DC, ee.isNil = NC, ee.isNull = OC, ee.isNumber = Zw, ee.isObject = Zr, ee.isObjectLike = en, ee.isPlainObject = pf, ee.isRegExp = Ig, ee.isSafeInteger = LC, ee.isSet = Qw, ee.isString = ed, ee.isSymbol = Ii, ee.isTypedArray = jc, ee.isUndefined = kC, ee.isWeakMap = $C, ee.isWeakSet = BC, ee.join = UM, ee.kebabCase = MT, ee.last = Hi, ee.lastIndexOf = qM, ee.lowerCase = IT, ee.lowerFirst = CT, ee.lt = FC, ee.lte = jC, ee.max = ER, ee.maxBy = SR, ee.mean = AR, ee.meanBy = PR, ee.min = MR, ee.minBy = IR, ee.stubArray = kg, ee.stubFalse = $g, ee.stubObject = dR, ee.stubString = pR, ee.stubTrue = gR, ee.multiply = CR, ee.nth = zM, ee.noConflict = sR, ee.noop = Lg, ee.now = Jh, ee.pad = TT, ee.padEnd = RT, ee.padStart = DT, ee.parseInt = OT, ee.random = _T, ee.reduce = KI, ee.reduceRight = VI, ee.repeat = NT, ee.replace = LT, ee.result = hT, ee.round = TR, ee.runInContext = be, ee.sample = YI, ee.size = ZI, ee.snakeCase = kT, ee.some = QI, ee.sortedIndex = JM, ee.sortedIndexBy = XM, ee.sortedIndexOf = ZM, ee.sortedLastIndex = QM, ee.sortedLastIndexBy = eI, ee.sortedLastIndexOf = tI, ee.startCase = BT, ee.startsWith = FT, ee.subtract = RR, ee.sum = DR, ee.sumBy = OR, ee.template = jT, ee.times = mR, ee.toFinite = ho, ee.toInteger = cr, ee.toLength = t2, ee.toLower = UT, ee.toNumber = Ki, ee.toSafeInteger = UC, ee.toString = Cr, ee.toUpper = qT, ee.trim = zT, ee.trimEnd = WT, ee.trimStart = HT, ee.truncate = KT, ee.unescape = VT, ee.uniqueId = bR, ee.upperCase = GT, ee.upperFirst = Rg, ee.each = Uw, ee.eachRight = qw, ee.first = $w, Ng(ee, function() { var c = {}; return Cs(ee, function(h, y) { Tr.call(ee.prototype, y) || (c[y] = h); @@ -24986,16 +24989,16 @@ var ZV = h0.exports, O1 = { exports: {} }; e = i.fetch, e.default = i.fetch, e.fetch = i.fetch, e.Headers = i.Headers, e.Request = i.Request, e.Response = i.Response, t.exports = e; })(O1, O1.exports); var QV = O1.exports; -const k3 = /* @__PURE__ */ ts(QV); -var eG = Object.defineProperty, tG = Object.defineProperties, rG = Object.getOwnPropertyDescriptors, $3 = Object.getOwnPropertySymbols, nG = Object.prototype.hasOwnProperty, iG = Object.prototype.propertyIsEnumerable, B3 = (t, e, r) => e in t ? eG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, F3 = (t, e) => { - for (var r in e || (e = {})) nG.call(e, r) && B3(t, r, e[r]); - if ($3) for (var r of $3(e)) iG.call(e, r) && B3(t, r, e[r]); +const $3 = /* @__PURE__ */ ts(QV); +var eG = Object.defineProperty, tG = Object.defineProperties, rG = Object.getOwnPropertyDescriptors, B3 = Object.getOwnPropertySymbols, nG = Object.prototype.hasOwnProperty, iG = Object.prototype.propertyIsEnumerable, F3 = (t, e, r) => e in t ? eG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, j3 = (t, e) => { + for (var r in e || (e = {})) nG.call(e, r) && F3(t, r, e[r]); + if (B3) for (var r of B3(e)) iG.call(e, r) && F3(t, r, e[r]); return t; -}, j3 = (t, e) => tG(t, rG(e)); -const sG = { Accept: "application/json", "Content-Type": "application/json" }, oG = "POST", U3 = { headers: sG, method: oG }, q3 = 10; +}, U3 = (t, e) => tG(t, rG(e)); +const sG = { Accept: "application/json", "Content-Type": "application/json" }, oG = "POST", q3 = { headers: sG, method: oG }, z3 = 10; let As = class { constructor(e, r = !1) { - if (this.url = e, this.disableProviderPing = r, this.events = new rs.EventEmitter(), this.isAvailable = !1, this.registering = !1, !c3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); + if (this.url = e, this.disableProviderPing = r, this.events = new rs.EventEmitter(), this.isAvailable = !1, this.registering = !1, !u3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); this.url = e, this.disableProviderPing = r; } get connected() { @@ -25026,14 +25029,14 @@ let As = class { async send(e) { this.isAvailable || await this.register(); try { - const r = $o(e), n = await (await k3(this.url, j3(F3({}, U3), { body: r }))).json(); + const r = $o(e), n = await (await $3(this.url, U3(j3({}, q3), { body: r }))).json(); this.onPayload({ data: n }); } catch (r) { this.onError(e.id, r); } } async register(e = this.url) { - if (!c3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); + if (!u3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); if (this.registering) { const r = this.events.getMaxListeners(); return (this.events.listenerCount("register_error") >= r || this.events.listenerCount("open") >= r) && this.events.setMaxListeners(r + 1), new Promise((n, i) => { @@ -25049,7 +25052,7 @@ let As = class { try { if (!this.disableProviderPing) { const r = $o({ id: 1, jsonrpc: "2.0", method: "test", params: [] }); - await k3(e, j3(F3({}, U3), { body: r })); + await $3(e, U3(j3({}, q3), { body: r })); } this.onOpen(); } catch (r) { @@ -25073,27 +25076,27 @@ let As = class { this.events.emit("payload", s); } parseError(e, r = this.url) { - return J8(e, r, "HTTP"); + return X8(e, r, "HTTP"); } resetMaxListeners() { - this.events.getMaxListeners() > q3 && this.events.setMaxListeners(q3); + this.events.getMaxListeners() > z3 && this.events.setMaxListeners(z3); } }; -const z3 = "error", aG = "wss://relay.walletconnect.org", cG = "wc", uG = "universal_provider", W3 = `${cG}@2:${uG}:`, wE = "https://rpc.walletconnect.org/v1/", Xc = "generic", fG = `${wE}bundler`, cs = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; -var lG = Object.defineProperty, hG = Object.defineProperties, dG = Object.getOwnPropertyDescriptors, H3 = Object.getOwnPropertySymbols, pG = Object.prototype.hasOwnProperty, gG = Object.prototype.propertyIsEnumerable, K3 = (t, e, r) => e in t ? lG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ld = (t, e) => { - for (var r in e || (e = {})) pG.call(e, r) && K3(t, r, e[r]); - if (H3) for (var r of H3(e)) gG.call(e, r) && K3(t, r, e[r]); +const W3 = "error", aG = "wss://relay.walletconnect.org", cG = "wc", uG = "universal_provider", H3 = `${cG}@2:${uG}:`, xE = "https://rpc.walletconnect.org/v1/", Xc = "generic", fG = `${xE}bundler`, cs = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; +var lG = Object.defineProperty, hG = Object.defineProperties, dG = Object.getOwnPropertyDescriptors, K3 = Object.getOwnPropertySymbols, pG = Object.prototype.hasOwnProperty, gG = Object.prototype.propertyIsEnumerable, V3 = (t, e, r) => e in t ? lG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ld = (t, e) => { + for (var r in e || (e = {})) pG.call(e, r) && V3(t, r, e[r]); + if (K3) for (var r of K3(e)) gG.call(e, r) && V3(t, r, e[r]); return t; }, mG = (t, e) => hG(t, dG(e)); function Ni(t, e, r) { var n; const i = hu(t); - return ((n = e.rpcMap) == null ? void 0 : n[i.reference]) || `${wE}?chainId=${i.namespace}:${i.reference}&projectId=${r}`; + return ((n = e.rpcMap) == null ? void 0 : n[i.reference]) || `${xE}?chainId=${i.namespace}:${i.reference}&projectId=${r}`; } function Sc(t) { return t.includes(":") ? t.split(":")[1] : t; } -function xE(t) { +function _E(t) { return t.map((e) => `${e.split(":")[0]}:${e.split(":")[1]}`); } function vG(t, e) { @@ -25106,15 +25109,15 @@ function vG(t, e) { }), n; } function bm(t = {}, e = {}) { - const r = V3(t), n = V3(e); + const r = G3(t), n = G3(e); return ZV.merge(r, n); } -function V3(t) { +function G3(t) { var e, r, n, i; const s = {}; if (!Sl(t)) return s; for (const [o, a] of Object.entries(t)) { - const u = ab(o) ? [o] : a.chains, l = a.methods || [], d = a.events || [], p = a.rpcMap || {}, w = Ff(o); + const u = cb(o) ? [o] : a.chains, l = a.methods || [], d = a.events || [], p = a.rpcMap || {}, w = Ff(o); s[w] = mG(ld(ld({}, s[w]), a), { chains: Id(u, (e = s[w]) == null ? void 0 : e.chains), methods: Id(l, (r = s[w]) == null ? void 0 : r.methods), events: Id(d, (n = s[w]) == null ? void 0 : n.events), rpcMap: ld(ld({}, p), (i = s[w]) == null ? void 0 : i.rpcMap) }); } return s; @@ -25122,10 +25125,10 @@ function V3(t) { function bG(t) { return t.includes(":") ? t.split(":")[2] : t; } -function G3(t) { +function Y3(t) { const e = {}; for (const [r, n] of Object.entries(t)) { - const i = n.methods || [], s = n.events || [], o = n.accounts || [], a = ab(r) ? [r] : n.chains ? n.chains : xE(n.accounts); + const i = n.methods || [], s = n.events || [], o = n.accounts || [], a = cb(r) ? [r] : n.chains ? n.chains : _E(n.accounts); e[r] = { chains: a, methods: i, events: s, accounts: o }; } return e; @@ -25133,8 +25136,8 @@ function G3(t) { function ym(t) { return typeof t == "number" ? t : t.includes("0x") ? parseInt(t, 16) : (t = t.includes(":") ? t.split(":")[1] : t, isNaN(Number(t)) ? t : Number(t)); } -const _E = {}, Ar = (t) => _E[t], wm = (t, e) => { - _E[t] = e; +const EE = {}, Ar = (t) => EE[t], wm = (t, e) => { + EE[t] = e; }; class yG { constructor(e) { @@ -25186,11 +25189,11 @@ class yG { return new as(new As(n, Ar("disableProviderPing"))); } } -var wG = Object.defineProperty, xG = Object.defineProperties, _G = Object.getOwnPropertyDescriptors, Y3 = Object.getOwnPropertySymbols, EG = Object.prototype.hasOwnProperty, SG = Object.prototype.propertyIsEnumerable, J3 = (t, e, r) => e in t ? wG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, X3 = (t, e) => { - for (var r in e || (e = {})) EG.call(e, r) && J3(t, r, e[r]); - if (Y3) for (var r of Y3(e)) SG.call(e, r) && J3(t, r, e[r]); +var wG = Object.defineProperty, xG = Object.defineProperties, _G = Object.getOwnPropertyDescriptors, J3 = Object.getOwnPropertySymbols, EG = Object.prototype.hasOwnProperty, SG = Object.prototype.propertyIsEnumerable, X3 = (t, e, r) => e in t ? wG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Z3 = (t, e) => { + for (var r in e || (e = {})) EG.call(e, r) && X3(t, r, e[r]); + if (J3) for (var r of J3(e)) SG.call(e, r) && X3(t, r, e[r]); return t; -}, Z3 = (t, e) => xG(t, _G(e)); +}, Q3 = (t, e) => xG(t, _G(e)); class AG { constructor(e) { this.name = "eip155", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.httpProviders = this.createHttpProviders(), this.chainId = parseInt(this.getDefaultChain()); @@ -25275,7 +25278,7 @@ class AG { if (a != null && a[s]) return a == null ? void 0 : a[s]; const u = await this.client.request(e); try { - await this.client.session.update(e.topic, { sessionProperties: Z3(X3({}, o.sessionProperties || {}), { capabilities: Z3(X3({}, a || {}), { [s]: u }) }) }); + await this.client.session.update(e.topic, { sessionProperties: Q3(Z3({}, o.sessionProperties || {}), { capabilities: Q3(Z3({}, a || {}), { [s]: u }) }) }); } catch (l) { console.warn("Failed to update session with capabilities", l); } @@ -25769,14 +25772,14 @@ class NG { return new as(new As(n, Ar("disableProviderPing"))); } } -var LG = Object.defineProperty, kG = Object.defineProperties, $G = Object.getOwnPropertyDescriptors, Q3 = Object.getOwnPropertySymbols, BG = Object.prototype.hasOwnProperty, FG = Object.prototype.propertyIsEnumerable, e_ = (t, e, r) => e in t ? LG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, hd = (t, e) => { - for (var r in e || (e = {})) BG.call(e, r) && e_(t, r, e[r]); - if (Q3) for (var r of Q3(e)) FG.call(e, r) && e_(t, r, e[r]); +var LG = Object.defineProperty, kG = Object.defineProperties, $G = Object.getOwnPropertyDescriptors, e_ = Object.getOwnPropertySymbols, BG = Object.prototype.hasOwnProperty, FG = Object.prototype.propertyIsEnumerable, t_ = (t, e, r) => e in t ? LG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, hd = (t, e) => { + for (var r in e || (e = {})) BG.call(e, r) && t_(t, r, e[r]); + if (e_) for (var r of e_(e)) FG.call(e, r) && t_(t, r, e[r]); return t; }, xm = (t, e) => kG(t, $G(e)); -let EE = class SE { +let N1 = class SE { constructor(e) { - this.events = new kv(), this.rpcProviders = {}, this.shouldAbortPairingAttempt = !1, this.maxPairingAttempts = 10, this.disableProviderPing = !1, this.providerOpts = e, this.logger = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : ql($0({ level: (e == null ? void 0 : e.logger) || z3 })), this.disableProviderPing = (e == null ? void 0 : e.disableProviderPing) || !1; + this.events = new $v(), this.rpcProviders = {}, this.shouldAbortPairingAttempt = !1, this.maxPairingAttempts = 10, this.disableProviderPing = !1, this.providerOpts = e, this.logger = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : ql($0({ level: (e == null ? void 0 : e.logger) || W3 })), this.disableProviderPing = (e == null ? void 0 : e.disableProviderPing) || !1; } static async init(e) { const r = new SE(e); @@ -25811,7 +25814,7 @@ let EE = class SE { n && (this.uri = n, this.events.emit("display_uri", n)); const s = await i(); if (this.session = s.session, this.session) { - const o = G3(this.session.namespaces); + const o = Y3(this.session.namespaces); this.namespaces = bm(this.namespaces, o), this.persist("namespaces", this.namespaces), this.onConnect(); } return s; @@ -25840,10 +25843,10 @@ let EE = class SE { const { uri: n, approval: i } = await this.client.connect({ pairingTopic: e, requiredNamespaces: this.namespaces, optionalNamespaces: this.optionalNamespaces, sessionProperties: this.sessionProperties }); n && (this.uri = n, this.events.emit("display_uri", n)), await i().then((s) => { this.session = s; - const o = G3(s.namespaces); + const o = Y3(s.namespaces); this.namespaces = bm(this.namespaces, o), this.persist("namespaces", this.namespaces); }).catch((s) => { - if (s.message !== yE) throw s; + if (s.message !== wE) throw s; r++; }); } while (!this.session); @@ -25879,7 +25882,7 @@ let EE = class SE { this.logger.trace("Initialized"), await this.createClient(), await this.checkStorage(), this.registerEventListeners(); } async createClient() { - this.client = this.providerOpts.client || await db.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || z3, relayUrl: this.providerOpts.relayUrl || aG, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); + this.client = this.providerOpts.client || await pb.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || W3, relayUrl: this.providerOpts.relayUrl || aG, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); } createProviders() { if (!this.client) throw new Error("Sign Client not initialized"); @@ -25887,7 +25890,7 @@ let EE = class SE { const e = [...new Set(Object.keys(this.session.namespaces).map((r) => Ff(r)))]; wm("client", this.client), wm("events", this.events), wm("disableProviderPing", this.disableProviderPing), e.forEach((r) => { if (!this.session) return; - const n = vG(r, this.session), i = xE(n), s = bm(this.namespaces, this.optionalNamespaces), o = xm(hd({}, s[r]), { accounts: n, chains: i }); + const n = vG(r, this.session), i = _E(n), s = bm(this.namespaces, this.optionalNamespaces), o = xm(hd({}, s[r]), { accounts: n, chains: i }); switch (r) { case "eip155": this.rpcProviders[r] = new AG({ namespace: o }); @@ -25985,13 +25988,13 @@ let EE = class SE { this.session = void 0, this.namespaces = void 0, this.optionalNamespaces = void 0, this.sessionProperties = void 0, this.persist("namespaces", void 0), this.persist("optionalNamespaces", void 0), this.persist("sessionProperties", void 0), await this.cleanupPendingPairings({ deletePairings: !0 }); } persist(e, r) { - this.client.core.storage.setItem(`${W3}/${e}`, r); + this.client.core.storage.setItem(`${H3}/${e}`, r); } async getFromStore(e) { - return await this.client.core.storage.getItem(`${W3}/${e}`); + return await this.client.core.storage.getItem(`${H3}/${e}`); } }; -const jG = EE; +const jG = N1; function UG() { return new Promise((t) => { const e = []; @@ -26059,7 +26062,7 @@ const fn = { chainDisconnected: 4901, unsupportedChain: 4902 } -}, N1 = { +}, L1 = { "-32700": { standard: "JSON RPC 2.0", message: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text." @@ -26129,11 +26132,11 @@ const fn = { message: "Unrecognized chain ID." } }, AE = "Unspecified error message.", qG = "Unspecified server error."; -function pb(t, e = AE) { +function gb(t, e = AE) { if (t && Number.isInteger(t)) { const r = t.toString(); - if (L1(N1, r)) - return N1[r].message; + if (k1(L1, r)) + return L1[r].message; if (PE(t)) return qG; } @@ -26143,27 +26146,27 @@ function zG(t) { if (!Number.isInteger(t)) return !1; const e = t.toString(); - return !!(N1[e] || PE(t)); + return !!(L1[e] || PE(t)); } function WG(t, { shouldIncludeStack: e = !1 } = {}) { const r = {}; - if (t && typeof t == "object" && !Array.isArray(t) && L1(t, "code") && zG(t.code)) { + if (t && typeof t == "object" && !Array.isArray(t) && k1(t, "code") && zG(t.code)) { const n = t; - r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, L1(n, "data") && (r.data = n.data)) : (r.message = pb(r.code), r.data = { originalError: t_(t) }); + r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, k1(n, "data") && (r.data = n.data)) : (r.message = gb(r.code), r.data = { originalError: r_(t) }); } else - r.code = fn.rpc.internal, r.message = r_(t, "message") ? t.message : AE, r.data = { originalError: t_(t) }; - return e && (r.stack = r_(t, "stack") ? t.stack : void 0), r; + r.code = fn.rpc.internal, r.message = n_(t, "message") ? t.message : AE, r.data = { originalError: r_(t) }; + return e && (r.stack = n_(t, "stack") ? t.stack : void 0), r; } function PE(t) { return t >= -32099 && t <= -32e3; } -function t_(t) { +function r_(t) { return t && typeof t == "object" && !Array.isArray(t) ? Object.assign({}, t) : t; } -function L1(t, e) { +function k1(t, e) { return Object.prototype.hasOwnProperty.call(t, e); } -function r_(t, e) { +function n_(t, e) { return typeof t == "object" && t !== null && e in t && typeof t[e] == "string"; } const Sr = { @@ -26207,11 +26210,11 @@ const Sr = { }; function Gi(t, e) { const [r, n] = ME(e); - return new IE(t, r || pb(t), n); + return new IE(t, r || gb(t), n); } function Vc(t, e) { const [r, n] = ME(e); - return new CE(t, r || pb(t), n); + return new CE(t, r || gb(t), n); } function ME(t) { if (t) { @@ -26249,18 +26252,18 @@ class CE extends IE { function HG(t) { return Number.isInteger(t) && t >= 1e3 && t <= 4999; } -function gb() { +function mb() { return (t) => t; } -const Al = gb(), KG = gb(), VG = gb(); +const Al = mb(), KG = mb(), VG = mb(); function _o(t) { return Math.floor(t); } const TE = /^[0-9]*$/, RE = /^[a-f0-9]*$/; function Qa(t) { - return mb(crypto.getRandomValues(new Uint8Array(t))); + return vb(crypto.getRandomValues(new Uint8Array(t))); } -function mb(t) { +function vb(t) { return [...t].map((e) => e.toString(16).padStart(2, "0")).join(""); } function Dd(t) { @@ -26271,7 +26274,7 @@ function Hf(t, e = !1) { return Al(e ? `0x${r}` : r); } function _m(t) { - return Hf(k1(t), !0); + return Hf($1(t), !0); } function $s(t) { return VG(t.toString(10)); @@ -26282,7 +26285,7 @@ function pa(t) { function DE(t) { return t.startsWith("0x") || t.startsWith("0X"); } -function vb(t) { +function bb(t) { return DE(t) ? t.slice(2) : t; } function OE(t) { @@ -26291,35 +26294,35 @@ function OE(t) { function ap(t) { if (typeof t != "string") return !1; - const e = vb(t).toLowerCase(); + const e = bb(t).toLowerCase(); return RE.test(e); } function GG(t, e = !1) { if (typeof t == "string") { - const r = vb(t).toLowerCase(); + const r = bb(t).toLowerCase(); if (RE.test(r)) return Al(e ? `0x${r}` : r); } throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`); } -function bb(t, e = !1) { +function yb(t, e = !1) { let r = GG(t, !1); return r.length % 2 === 1 && (r = Al(`0${r}`)), e ? Al(`0x${r}`) : r; } function ra(t) { if (typeof t == "string") { - const e = vb(t).toLowerCase(); + const e = bb(t).toLowerCase(); if (ap(e) && e.length === 40) return KG(OE(e)); } throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`); } -function k1(t) { +function $1(t) { if (Buffer.isBuffer(t)) return t; if (typeof t == "string") { if (ap(t)) { - const e = bb(t, !1); + const e = yb(t, !1); return Buffer.from(e, "hex"); } return Buffer.from(t, "utf8"); @@ -26333,7 +26336,7 @@ function Kf(t) { if (TE.test(t)) return _o(Number(t)); if (ap(t)) - return _o(Number(BigInt(bb(t, !0)))); + return _o(Number(BigInt(yb(t, !0)))); } throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`); } @@ -26346,7 +26349,7 @@ function Rf(t) { if (TE.test(t)) return BigInt(t); if (ap(t)) - return BigInt(bb(t, !0)); + return BigInt(yb(t, !0)); } throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`); } @@ -26402,7 +26405,7 @@ function NE(t) { } async function LE(t, e) { const r = NE(t), n = await crypto.subtle.exportKey(r, e); - return mb(new Uint8Array(n)); + return vb(new Uint8Array(n)); } async function kE(t, e) { const r = NE(t), n = Dd(e).buffer; @@ -26536,11 +26539,11 @@ function aY(t) { throw Sr.provider.unsupportedMethod(); } } -const n_ = "accounts", i_ = "activeChain", s_ = "availableChains", o_ = "walletCapabilities"; +const i_ = "accounts", s_ = "activeChain", o_ = "availableChains", a_ = "walletCapabilities"; class cY { constructor(e) { var r, n, i; - this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new nY(), this.storage = new eo("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(n_)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(i_) || { + this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new nY(), this.storage = new eo("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(i_)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(s_) || { id: (i = (n = e.metadata.appChainIds) === null || n === void 0 ? void 0 : n[0]) !== null && i !== void 0 ? i : 1 }, this.handshake = this.handshake.bind(this), this.request = this.request.bind(this), this.createRequestMessage = this.createRequestMessage.bind(this), this.decryptResponseMessage = this.decryptResponseMessage.bind(this); } @@ -26560,7 +26563,7 @@ class cY { if ("error" in u) throw u.error; const l = u.value; - this.accounts = l, this.storage.storeObject(n_, l), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", l); + this.accounts = l, this.storage.storeObject(i_, l), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", l); } async request(e) { var r; @@ -26578,7 +26581,7 @@ class cY { case "eth_chainId": return pa(this.chain.id); case "wallet_getCapabilities": - return this.storage.loadObject(o_); + return this.storage.loadObject(a_); case "wallet_switchEthereumChain": return this.handleSwitchChainRequest(e); case "eth_ecRecover": @@ -26664,18 +26667,18 @@ class cY { id: Number(d), rpcUrl: p })); - this.storage.storeObject(s_, l), this.updateChain(this.chain.id, l); + this.storage.storeObject(o_, l), this.updateChain(this.chain.id, l); } const u = (n = o.data) === null || n === void 0 ? void 0 : n.capabilities; - return u && this.storage.storeObject(o_, u), o; + return u && this.storage.storeObject(a_, u), o; } updateChain(e, r) { var n; - const i = r ?? this.storage.loadObject(s_), s = i == null ? void 0 : i.find((o) => o.id === e); - return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(i_, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(s.id))), !0) : !1; + const i = r ?? this.storage.loadObject(o_), s = i == null ? void 0 : i.find((o) => o.id === e); + return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(s_, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(s.id))), !0) : !1; } } -const uY = /* @__PURE__ */ bv(UD), { keccak_256: fY } = uY; +const uY = /* @__PURE__ */ yv(UD), { keccak_256: fY } = uY; function FE(t) { return Buffer.allocUnsafe(t).fill(0); } @@ -26762,7 +26765,7 @@ function HE(t) { function pu(t) { return Number.parseInt(/^\D+(\d+)$/.exec(t)[1], 10); } -function a_(t) { +function c_(t) { var e = /^\D+(\d+)x(\d+)$/.exec(t); return [Number.parseInt(e[1], 10), Number.parseInt(e[2], 10)]; } @@ -26826,11 +26829,11 @@ function qs(t, e) { const u = si.twosFromBigInt(n, 256); return si.bufferBEFromBigInt(u, 32); } else if (t.startsWith("ufixed")) { - if (r = a_(t), n = ec(e), n < 0) + if (r = c_(t), n = ec(e), n < 0) throw new Error("Supplied ufixed is negative"); return qs("uint256", n * BigInt(2) ** BigInt(r[1])); } else if (t.startsWith("fixed")) - return r = a_(t), qs("int256", ec(e) * BigInt(2) ** BigInt(r[1])); + return r = c_(t), qs("int256", ec(e) * BigInt(2) ** BigInt(r[1])); } throw new Error("Unsupported or invalid type: " + t); } @@ -27079,7 +27082,7 @@ function EY(t) { ] ); } -const dd = /* @__PURE__ */ ts(_Y), SY = "walletUsername", $1 = "Addresses", AY = "AppVersion"; +const dd = /* @__PURE__ */ ts(_Y), SY = "walletUsername", B1 = "Addresses", AY = "AppVersion"; function jn(t) { return t.errorMessage !== void 0; } @@ -27103,7 +27106,7 @@ class PY { name: "AES-GCM", iv: n }, i, s.encode(e)), a = 16, u = o.slice(o.byteLength - a), l = o.slice(0, o.byteLength - a), d = new Uint8Array(u), p = new Uint8Array(l), w = new Uint8Array([...n, ...d, ...p]); - return mb(w); + return vb(w); } /** * @@ -27255,7 +27258,7 @@ class IY { e && (this.webSocket = null, e.onclose = null, e.onerror = null, e.onmessage = null, e.onopen = null); } } -const c_ = 1e4, CY = 6e4; +const u_ = 1e4, CY = 6e4; class TY { /** * Constructor @@ -27319,7 +27322,7 @@ class TY { case Po.CONNECTED: o = await this.handleConnected(), this.updateLastHeartbeat(), setInterval(() => { this.heartbeat(); - }, c_), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); + }, u_), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); break; case Po.CONNECTING: break; @@ -27445,7 +27448,7 @@ class TY { this.lastHeartbeatResponse = Date.now(); } heartbeat() { - if (Date.now() - this.lastHeartbeatResponse > c_ * 2) { + if (Date.now() - this.lastHeartbeatResponse > u_ * 2) { this.ws.disconnect(); return; } @@ -27498,17 +27501,17 @@ class RY { return this.callbacks.get(r) && this.callbacks.delete(r), e; } } -const u_ = "session:id", f_ = "session:secret", l_ = "session:linked"; +const f_ = "session:id", l_ = "session:secret", h_ = "session:linked"; class gu { constructor(e, r, n, i = !1) { - this.storage = e, this.id = r, this.secret = n, this.key = _D(r4(`${r}, ${n} WalletLink`)), this._linked = !!i; + this.storage = e, this.id = r, this.secret = n, this.key = _D(n4(`${r}, ${n} WalletLink`)), this._linked = !!i; } static create(e) { const r = Qa(16), n = Qa(32); return new gu(e, r, n).save(); } static load(e) { - const r = e.getItem(u_), n = e.getItem(l_), i = e.getItem(f_); + const r = e.getItem(f_), n = e.getItem(h_), i = e.getItem(l_); return r && i ? new gu(e, r, i, n === "1") : null; } get linked() { @@ -27518,10 +27521,10 @@ class gu { this._linked = e, this.persistLinked(); } save() { - return this.storage.setItem(u_, this.id), this.storage.setItem(f_, this.secret), this.persistLinked(), this; + return this.storage.setItem(f_, this.id), this.storage.setItem(l_, this.secret), this.persistLinked(), this; } persistLinked() { - this.storage.setItem(l_, this._linked ? "1" : "0"); + this.storage.setItem(h_, this._linked ? "1" : "0"); } } function DY() { @@ -27562,12 +27565,12 @@ function Gf() { for (var t, e, r = 0, n = ""; r < arguments.length; ) (t = arguments[r++]) && (e = XE(t)) && (n && (n += " "), n += e); return n; } -var up, Jr, ZE, tc, h_, QE, B1, eS, yb, F1, j1, Pl = {}, tS = [], kY = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, wb = Array.isArray; +var up, Jr, ZE, tc, d_, QE, F1, eS, wb, j1, U1, Pl = {}, tS = [], kY = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, xb = Array.isArray; function ga(t, e) { for (var r in e) t[r] = e[r]; return t; } -function xb(t) { +function _b(t) { t && t.parentNode && t.parentNode.removeChild(t); } function Nr(t, e, r) { @@ -27601,22 +27604,22 @@ function rS(t) { return rS(t); } } -function d_(t) { - (!t.__d && (t.__d = !0) && tc.push(t) && !d0.__r++ || h_ !== Jr.debounceRendering) && ((h_ = Jr.debounceRendering) || QE)(d0); +function p_(t) { + (!t.__d && (t.__d = !0) && tc.push(t) && !d0.__r++ || d_ !== Jr.debounceRendering) && ((d_ = Jr.debounceRendering) || QE)(d0); } function d0() { var t, e, r, n, i, s, o, a; - for (tc.sort(B1); t = tc.shift(); ) t.__d && (e = tc.length, n = void 0, s = (i = (r = t).__v).__e, o = [], a = [], r.__P && ((n = ga({}, i)).__v = i.__v + 1, Jr.vnode && Jr.vnode(n), _b(r.__P, n, i, r.__n, r.__P.namespaceURI, 32 & i.__u ? [s] : null, o, s ?? Pu(i), !!(32 & i.__u), a), n.__v = i.__v, n.__.__k[n.__i] = n, sS(o, n, a), n.__e != s && rS(n)), tc.length > e && tc.sort(B1)); + for (tc.sort(F1); t = tc.shift(); ) t.__d && (e = tc.length, n = void 0, s = (i = (r = t).__v).__e, o = [], a = [], r.__P && ((n = ga({}, i)).__v = i.__v + 1, Jr.vnode && Jr.vnode(n), Eb(r.__P, n, i, r.__n, r.__P.namespaceURI, 32 & i.__u ? [s] : null, o, s ?? Pu(i), !!(32 & i.__u), a), n.__v = i.__v, n.__.__k[n.__i] = n, sS(o, n, a), n.__e != s && rS(n)), tc.length > e && tc.sort(F1)); d0.__r = 0; } function nS(t, e, r, n, i, s, o, a, u, l, d) { var p, w, A, M, N, L, B = n && n.__k || tS, $ = e.length; - for (u = $Y(r, e, B, u), p = 0; p < $; p++) (A = r.__k[p]) != null && (w = A.__i === -1 ? Pl : B[A.__i] || Pl, A.__i = p, L = _b(t, A, w, i, s, o, a, u, l, d), M = A.__e, A.ref && w.ref != A.ref && (w.ref && Eb(w.ref, null, A), d.push(A.ref, A.__c || M, A)), N == null && M != null && (N = M), 4 & A.__u || w.__k === A.__k ? u = iS(A, u, t) : typeof A.type == "function" && L !== void 0 ? u = L : M && (u = M.nextSibling), A.__u &= -7); + for (u = $Y(r, e, B, u), p = 0; p < $; p++) (A = r.__k[p]) != null && (w = A.__i === -1 ? Pl : B[A.__i] || Pl, A.__i = p, L = Eb(t, A, w, i, s, o, a, u, l, d), M = A.__e, A.ref && w.ref != A.ref && (w.ref && Sb(w.ref, null, A), d.push(A.ref, A.__c || M, A)), N == null && M != null && (N = M), 4 & A.__u || w.__k === A.__k ? u = iS(A, u, t) : typeof A.type == "function" && L !== void 0 ? u = L : M && (u = M.nextSibling), A.__u &= -7); return r.__e = N, u; } function $Y(t, e, r, n) { var i, s, o, a, u, l = e.length, d = r.length, p = d, w = 0; - for (t.__k = [], i = 0; i < l; i++) (s = e[i]) != null && typeof s != "boolean" && typeof s != "function" ? (a = i + w, (s = t.__k[i] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Od(null, s, null, null, null) : wb(s) ? Od(ih, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? Od(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, o = null, (u = s.__i = BY(s, r, a, p)) !== -1 && (p--, (o = r[u]) && (o.__u |= 2)), o == null || o.__v === null ? (u == -1 && w--, typeof s.type != "function" && (s.__u |= 4)) : u !== a && (u == a - 1 ? w-- : u == a + 1 ? w++ : (u > a ? w-- : w++, s.__u |= 4))) : s = t.__k[i] = null; + for (t.__k = [], i = 0; i < l; i++) (s = e[i]) != null && typeof s != "boolean" && typeof s != "function" ? (a = i + w, (s = t.__k[i] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Od(null, s, null, null, null) : xb(s) ? Od(ih, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? Od(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, o = null, (u = s.__i = BY(s, r, a, p)) !== -1 && (p--, (o = r[u]) && (o.__u |= 2)), o == null || o.__v === null ? (u == -1 && w--, typeof s.type != "function" && (s.__u |= 4)) : u !== a && (u == a - 1 ? w-- : u == a + 1 ? w++ : (u > a ? w-- : w++, s.__u |= 4))) : s = t.__k[i] = null; if (p) for (i = 0; i < d; i++) (o = r[i]) != null && !(2 & o.__u) && (o.__e == n && (n = Pu(o)), oS(o, o)); return n; } @@ -27647,17 +27650,17 @@ function BY(t, e, r, n) { } return -1; } -function p_(t, e, r) { +function g_(t, e, r) { e[0] === "-" ? t.setProperty(e, r ?? "") : t[e] = r == null ? "" : typeof r != "number" || kY.test(e) ? r : r + "px"; } function pd(t, e, r, n, i) { var s; e: if (e === "style") if (typeof r == "string") t.style.cssText = r; else { - if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || p_(t.style, e, ""); - if (r) for (e in r) n && r[e] === n[e] || p_(t.style, e, r[e]); + if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || g_(t.style, e, ""); + if (r) for (e in r) n && r[e] === n[e] || g_(t.style, e, r[e]); } - else if (e[0] === "o" && e[1] === "n") s = e !== (e = e.replace(eS, "$1")), e = e.toLowerCase() in t || e === "onFocusOut" || e === "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = yb, t.addEventListener(e, s ? j1 : F1, s)) : t.removeEventListener(e, s ? j1 : F1, s); + else if (e[0] === "o" && e[1] === "n") s = e !== (e = e.replace(eS, "$1")), e = e.toLowerCase() in t || e === "onFocusOut" || e === "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = wb, t.addEventListener(e, s ? U1 : j1, s)) : t.removeEventListener(e, s ? U1 : j1, s); else { if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try { @@ -27668,17 +27671,17 @@ function pd(t, e, r, n, i) { typeof r == "function" || (r == null || r === !1 && e[4] !== "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && r == 1 ? "" : r)); } } -function g_(t) { +function m_(t) { return function(e) { if (this.l) { var r = this.l[e.type + t]; - if (e.t == null) e.t = yb++; + if (e.t == null) e.t = wb++; else if (e.t < r.u) return; return r(Jr.event ? Jr.event(e) : e); } }; } -function _b(t, e, r, n, i, s, o, a, u, l) { +function Eb(t, e, r, n, i, s, o, a, u, l) { var d, p, w, A, M, N, L, B, $, H, W, V, te, R, K, ge, Ee, Y = e.type; if (e.constructor !== void 0) return null; 128 & r.__u && (u = !!(32 & r.__u), s = [a = e.__e = r.__e]), (d = Jr.__b) && d(e); @@ -27702,12 +27705,12 @@ function _b(t, e, r, n, i, s, o, a, u, l) { } else do p.__d = !1, te && te(e), d = p.render(p.props, p.state, p.context), p.state = p.__s; while (p.__d && ++R < 25); - p.state = p.__s, p.getChildContext != null && (n = ga(ga({}, n), p.getChildContext())), $ && !w && p.getSnapshotBeforeUpdate != null && (N = p.getSnapshotBeforeUpdate(A, M)), a = nS(t, wb(ge = d != null && d.type === ih && d.key == null ? d.props.children : d) ? ge : [ge], e, r, n, i, s, o, a, u, l), p.base = e.__e, e.__u &= -161, p.__h.length && o.push(p), L && (p.__E = p.__ = null); + p.state = p.__s, p.getChildContext != null && (n = ga(ga({}, n), p.getChildContext())), $ && !w && p.getSnapshotBeforeUpdate != null && (N = p.getSnapshotBeforeUpdate(A, M)), a = nS(t, xb(ge = d != null && d.type === ih && d.key == null ? d.props.children : d) ? ge : [ge], e, r, n, i, s, o, a, u, l), p.base = e.__e, e.__u &= -161, p.__h.length && o.push(p), L && (p.__E = p.__ = null); } catch (S) { if (e.__v = null, u || s != null) if (S.then) { for (e.__u |= u ? 160 : 128; a && a.nodeType === 8 && a.nextSibling; ) a = a.nextSibling; s[s.indexOf(a)] = null, e.__e = a; - } else for (Ee = s.length; Ee--; ) xb(s[Ee]); + } else for (Ee = s.length; Ee--; ) _b(s[Ee]); else e.__e = r.__e, e.__k = r.__k; Jr.__e(S, e, r); } @@ -27715,7 +27718,7 @@ function _b(t, e, r, n, i, s, o, a, u, l) { return (d = Jr.diffed) && d(e), 128 & e.__u ? void 0 : a; } function sS(t, e, r) { - for (var n = 0; n < r.length; n++) Eb(r[n], r[++n], r[++n]); + for (var n = 0; n < r.length; n++) Sb(r[n], r[++n], r[++n]); Jr.__c && Jr.__c(e, t), t.some(function(i) { try { t = i.__h, i.__h = [], t.some(function(s) { @@ -27750,12 +27753,12 @@ function FY(t, e, r, n, i, s, o, a, u) { } for (l in B) A = B[l], l == "children" ? w = A : l == "dangerouslySetInnerHTML" ? d = A : l == "value" ? M = A : l == "checked" ? N = A : a && typeof A != "function" || L[l] === A || pd(t, l, A, L[l], i); if (d) a || p && (d.__html === p.__html || d.__html === t.innerHTML) || (t.innerHTML = d.__html), e.__k = []; - else if (p && (t.innerHTML = ""), nS(t, wb(w) ? w : [w], e, r, n, $ === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && Pu(r, 0), a, u), s != null) for (l = s.length; l--; ) xb(s[l]); + else if (p && (t.innerHTML = ""), nS(t, xb(w) ? w : [w], e, r, n, $ === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && Pu(r, 0), a, u), s != null) for (l = s.length; l--; ) _b(s[l]); a || (l = "value", $ === "progress" && M == null ? t.removeAttribute("value") : M !== void 0 && (M !== t[l] || $ === "progress" && !M || $ === "option" && M !== L[l]) && pd(t, l, M, L[l], i), l = "checked", N !== void 0 && N !== t[l] && pd(t, l, N, L[l], i)); } return t; } -function Eb(t, e, r) { +function Sb(t, e, r) { try { if (typeof t == "function") { var n = typeof t.__u == "function"; @@ -27767,7 +27770,7 @@ function Eb(t, e, r) { } function oS(t, e, r) { var n, i; - if (Jr.unmount && Jr.unmount(t), (n = t.ref) && (n.current && n.current !== t.__e || Eb(n, null, e)), (n = t.__c) != null) { + if (Jr.unmount && Jr.unmount(t), (n = t.ref) && (n.current && n.current !== t.__e || Sb(n, null, e)), (n = t.__c) != null) { if (n.componentWillUnmount) try { n.componentWillUnmount(); } catch (s) { @@ -27776,14 +27779,14 @@ function oS(t, e, r) { n.base = n.__P = null; } if (n = t.__k) for (i = 0; i < n.length; i++) n[i] && oS(n[i], e, r || typeof t.type != "function"); - r || xb(t.__e), t.__c = t.__ = t.__e = void 0; + r || _b(t.__e), t.__c = t.__ = t.__e = void 0; } function jY(t, e, r) { return this.constructor(t, r); } -function U1(t, e, r) { +function q1(t, e, r) { var n, i, s, o; - e === document && (e = document.documentElement), Jr.__ && Jr.__(t, e), i = (n = typeof r == "function") ? null : e.__k, s = [], o = [], _b(e, t = (!n && r || e).__k = Nr(ih, null, [t]), i || Pl, Pl, e.namespaceURI, !n && r ? [r] : i ? null : e.firstChild ? up.call(e.childNodes) : null, s, !n && r ? r : i ? i.__e : e.firstChild, n, o), sS(s, t, o); + e === document && (e = document.documentElement), Jr.__ && Jr.__(t, e), i = (n = typeof r == "function") ? null : e.__k, s = [], o = [], Eb(e, t = (!n && r || e).__k = Nr(ih, null, [t]), i || Pl, Pl, e.namespaceURI, !n && r ? [r] : i ? null : e.firstChild ? up.call(e.childNodes) : null, s, !n && r ? r : i ? i.__e : e.firstChild, n, o), sS(s, t, o); } up = tS.slice, Jr = { __e: function(t, e, r, n) { for (var i, s, o; e = e.__; ) if ((i = e.__c) && !i.__) try { @@ -27794,20 +27797,20 @@ up = tS.slice, Jr = { __e: function(t, e, r, n) { throw t; } }, ZE = 0, Nd.prototype.setState = function(t, e) { var r; - r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = ga({}, this.state), typeof t == "function" && (t = t(ga({}, r), this.props)), t && ga(r, t), t != null && this.__v && (e && this._sb.push(e), d_(this)); + r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = ga({}, this.state), typeof t == "function" && (t = t(ga({}, r), this.props)), t && ga(r, t), t != null && this.__v && (e && this._sb.push(e), p_(this)); }, Nd.prototype.forceUpdate = function(t) { - this.__v && (this.__e = !0, t && this.__h.push(t), d_(this)); -}, Nd.prototype.render = ih, tc = [], QE = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, B1 = function(t, e) { + this.__v && (this.__e = !0, t && this.__h.push(t), p_(this)); +}, Nd.prototype.render = ih, tc = [], QE = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, F1 = function(t, e) { return t.__v.__b - e.__v.__b; -}, d0.__r = 0, eS = /(PointerCapture)$|Capture$/i, yb = 0, F1 = g_(!1), j1 = g_(!0); -var p0, pn, Mm, m_, q1 = 0, aS = [], yn = Jr, v_ = yn.__b, b_ = yn.__r, y_ = yn.diffed, w_ = yn.__c, x_ = yn.unmount, __ = yn.__; +}, d0.__r = 0, eS = /(PointerCapture)$|Capture$/i, wb = 0, j1 = m_(!1), U1 = m_(!0); +var p0, pn, Mm, v_, z1 = 0, aS = [], yn = Jr, b_ = yn.__b, y_ = yn.__r, w_ = yn.diffed, x_ = yn.__c, __ = yn.unmount, E_ = yn.__; function cS(t, e) { - yn.__h && yn.__h(pn, t, q1 || e), q1 = 0; + yn.__h && yn.__h(pn, t, z1 || e), z1 = 0; var r = pn.__H || (pn.__H = { __: [], __h: [] }); return t >= r.__.length && r.__.push({}), r.__[t]; } -function E_(t) { - return q1 = 1, UY(uS, t); +function S_(t) { + return z1 = 1, UY(uS, t); } function UY(t, e, r) { var n = cS(p0++, 2); @@ -27849,41 +27852,41 @@ function qY(t, e) { } function zY() { for (var t; t = aS.shift(); ) if (t.__P && t.__H) try { - t.__H.__h.forEach(Ld), t.__H.__h.forEach(z1), t.__H.__h = []; + t.__H.__h.forEach(Ld), t.__H.__h.forEach(W1), t.__H.__h = []; } catch (e) { t.__H.__h = [], yn.__e(e, t.__v); } } yn.__b = function(t) { - pn = null, v_ && v_(t); + pn = null, b_ && b_(t); }, yn.__ = function(t, e) { - t && e.__k && e.__k.__m && (t.__m = e.__k.__m), __ && __(t, e); + t && e.__k && e.__k.__m && (t.__m = e.__k.__m), E_ && E_(t, e); }, yn.__r = function(t) { - b_ && b_(t), p0 = 0; + y_ && y_(t), p0 = 0; var e = (pn = t.__c).__H; e && (Mm === pn ? (e.__h = [], pn.__h = [], e.__.forEach(function(r) { r.__N && (r.__ = r.__N), r.i = r.__N = void 0; - })) : (e.__h.forEach(Ld), e.__h.forEach(z1), e.__h = [], p0 = 0)), Mm = pn; + })) : (e.__h.forEach(Ld), e.__h.forEach(W1), e.__h = [], p0 = 0)), Mm = pn; }, yn.diffed = function(t) { - y_ && y_(t); + w_ && w_(t); var e = t.__c; - e && e.__H && (e.__H.__h.length && (aS.push(e) !== 1 && m_ === yn.requestAnimationFrame || ((m_ = yn.requestAnimationFrame) || WY)(zY)), e.__H.__.forEach(function(r) { + e && e.__H && (e.__H.__h.length && (aS.push(e) !== 1 && v_ === yn.requestAnimationFrame || ((v_ = yn.requestAnimationFrame) || WY)(zY)), e.__H.__.forEach(function(r) { r.i && (r.__H = r.i), r.i = void 0; })), Mm = pn = null; }, yn.__c = function(t, e) { e.some(function(r) { try { r.__h.forEach(Ld), r.__h = r.__h.filter(function(n) { - return !n.__ || z1(n); + return !n.__ || W1(n); }); } catch (n) { e.some(function(i) { i.__h && (i.__h = []); }), e = [], yn.__e(n, r.__v); } - }), w_ && w_(t, e); + }), x_ && x_(t, e); }, yn.unmount = function(t) { - x_ && x_(t); + __ && __(t); var e, r = t.__c; r && r.__H && (r.__H.__.forEach(function(n) { try { @@ -27893,18 +27896,18 @@ yn.__b = function(t) { } }), r.__H = void 0, e && yn.__e(e, r.__v)); }; -var S_ = typeof requestAnimationFrame == "function"; +var A_ = typeof requestAnimationFrame == "function"; function WY(t) { var e, r = function() { - clearTimeout(n), S_ && cancelAnimationFrame(e), setTimeout(t); + clearTimeout(n), A_ && cancelAnimationFrame(e), setTimeout(t); }, n = setTimeout(r, 100); - S_ && (e = requestAnimationFrame(r)); + A_ && (e = requestAnimationFrame(r)); } function Ld(t) { var e = pn, r = t.__c; typeof r == "function" && (t.__c = void 0, r()), pn = e; } -function z1(t) { +function W1(t) { var e = pn; t.__c = t.__(), pn = e; } @@ -27934,7 +27937,7 @@ class YY { this.items.clear(), this.render(); } render() { - this.root && U1(Nr( + this.root && q1(Nr( "div", null, Nr(fS, { darkMode: this.darkMode }, Array.from(this.items.entries()).map(([e, r]) => Nr(JY, Object.assign({}, r, { key: e })))) @@ -27947,7 +27950,7 @@ const fS = (t) => Nr( Nr("style", null, KY), Nr("div", { class: "-cbwsdk-snackbar" }, t.children) ), JY = ({ autoExpand: t, message: e, menuItems: r }) => { - const [n, i] = E_(!0), [s, o] = E_(t ?? !1); + const [n, i] = S_(!0), [s, o] = S_(t ?? !1); qY(() => { const u = [ window.setTimeout(() => { @@ -28066,7 +28069,7 @@ class QY { this.render(null); } render(e) { - this.root && (U1(null, this.root), e && U1(Nr(eJ, Object.assign({}, e, { onDismiss: () => { + this.root && (q1(null, this.root), e && q1(Nr(eJ, Object.assign({}, e, { onDismiss: () => { this.clear(); }, darkMode: this.darkMode })), this.root)); } @@ -28089,8 +28092,8 @@ const eJ = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: ) ) ); -}, tJ = "https://keys.coinbase.com/connect", A_ = "https://www.walletlink.org", rJ = "https://go.cb-w.com/walletlink"; -class P_ { +}, tJ = "https://keys.coinbase.com/connect", P_ = "https://www.walletlink.org", rJ = "https://go.cb-w.com/walletlink"; +class M_ { constructor() { this.attached = !1, this.redirectDialog = new QY(); } @@ -28126,7 +28129,7 @@ class Eo { constructor(e) { this.chainCallbackParams = { chainId: "", jsonRpcUrl: "" }, this.isMobileWeb = NY(), this.linkedUpdated = (s) => { this.isLinked = s; - const o = this.storage.getItem($1); + const o = this.storage.getItem(B1); if (s && (this._session.linked = s), this.isUnlinkedErrorState = !1, o) { const a = o.split(" "), u = this.storage.getItem("IsStandaloneSigning") === "true"; a[0] !== "" && !s && this._session.linked && !u && (this.isUnlinkedErrorState = !0); @@ -28154,7 +28157,7 @@ class Eo { session: e, linkAPIUrl: r, listener: this - }), i = this.isMobileWeb ? new P_() : new XY(); + }), i = this.isMobileWeb ? new M_() : new XY(); return n.connect(), { session: e, ui: i, connection: n }; } resetAndReload() { @@ -28242,7 +28245,7 @@ class Eo { } // copied from MobileRelay openCoinbaseWalletDeeplink(e) { - if (this.ui instanceof P_) + if (this.ui instanceof M_) switch (e) { case "requestEthereumAccounts": case "switchEthereumChain": @@ -28390,11 +28393,11 @@ class Eo { } } Eo.accountRequestCallbackIds = /* @__PURE__ */ new Set(); -const M_ = "DefaultChainId", I_ = "DefaultJsonRpcUrl"; +const I_ = "DefaultChainId", C_ = "DefaultJsonRpcUrl"; class lS { constructor(e) { - this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new eo("walletlink", A_), this.callback = e.callback || null; - const r = this._storage.getItem($1); + this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new eo("walletlink", P_), this.callback = e.callback || null; + const r = this._storage.getItem(B1); if (r) { const n = r.split(" "); n[0] !== "" && (this._addresses = n.map((i) => ra(i))); @@ -28413,16 +28416,16 @@ class lS { } get jsonRpcUrl() { var e; - return (e = this._storage.getItem(I_)) !== null && e !== void 0 ? e : void 0; + return (e = this._storage.getItem(C_)) !== null && e !== void 0 ? e : void 0; } set jsonRpcUrl(e) { - this._storage.setItem(I_, e); + this._storage.setItem(C_, e); } updateProviderInfo(e, r) { var n; this.jsonRpcUrl = e; const i = this.getChainId(); - this._storage.setItem(M_, r.toString(10)), Kf(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(r))); + this._storage.setItem(I_, r.toString(10)), Kf(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(r))); } async watchAsset(e) { const r = Array.isArray(e) ? e[0] : e; @@ -28471,7 +28474,7 @@ class lS { if (!Array.isArray(e)) throw new Error("addresses is not an array"); const i = e.map((s) => ra(s)); - JSON.stringify(i) !== JSON.stringify(this._addresses) && (this._addresses = i, (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", i), this._storage.setItem($1, i.join(" "))); + JSON.stringify(i) !== JSON.stringify(this._addresses) && (this._addresses = i, (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", i), this._storage.setItem(B1, i.join(" "))); } async request(e) { const r = e.params || []; @@ -28524,7 +28527,7 @@ class lS { if (!r) throw new Error("Ethereum address is unavailable"); this._ensureKnownAddress(r); - const n = e.to ? ra(e.to) : null, i = e.value != null ? Rf(e.value) : BigInt(0), s = e.data ? k1(e.data) : Buffer.alloc(0), o = e.nonce != null ? Kf(e.nonce) : null, a = e.gasPrice != null ? Rf(e.gasPrice) : null, u = e.maxFeePerGas != null ? Rf(e.maxFeePerGas) : null, l = e.maxPriorityFeePerGas != null ? Rf(e.maxPriorityFeePerGas) : null, d = e.gas != null ? Rf(e.gas) : null, p = e.chainId ? Kf(e.chainId) : this.getChainId(); + const n = e.to ? ra(e.to) : null, i = e.value != null ? Rf(e.value) : BigInt(0), s = e.data ? $1(e.data) : Buffer.alloc(0), o = e.nonce != null ? Kf(e.nonce) : null, a = e.gasPrice != null ? Rf(e.gasPrice) : null, u = e.maxFeePerGas != null ? Rf(e.maxFeePerGas) : null, l = e.maxPriorityFeePerGas != null ? Rf(e.maxPriorityFeePerGas) : null, d = e.gas != null ? Rf(e.gas) : null, p = e.chainId ? Kf(e.chainId) : this.getChainId(); return { fromAddress: r, toAddress: n, @@ -28556,7 +28559,7 @@ class lS { } getChainId() { var e; - return Number.parseInt((e = this._storage.getItem(M_)) !== null && e !== void 0 ? e : "1", 10); + return Number.parseInt((e = this._storage.getItem(I_)) !== null && e !== void 0 ? e : "1", 10); } async _eth_requestAccounts() { var e, r; @@ -28594,7 +28597,7 @@ class lS { return i.result; } async _eth_sendRawTransaction(e) { - const r = k1(e[0]), i = await this.initializeRelay().submitEthereumTransaction(r, this.getChainId()); + const r = $1(e[0]), i = await this.initializeRelay().submitEthereumTransaction(r, this.getChainId()); if (jn(i)) throw i; return i.result; @@ -28636,7 +28639,7 @@ class lS { } initializeRelay() { return this._relay || (this._relay = new Eo({ - linkAPIUrl: A_, + linkAPIUrl: P_, storage: this._storage, metadata: this.metadata, accountsCallback: this._setAddresses.bind(this), @@ -28716,11 +28719,11 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene } } }; -}, { checkCrossOriginOpenerPolicy: fJ, getCrossOriginOpenerPolicy: lJ } = uJ(), C_ = 420, T_ = 540; +}, { checkCrossOriginOpenerPolicy: fJ, getCrossOriginOpenerPolicy: lJ } = uJ(), T_ = 420, R_ = 540; function hJ(t) { - const e = (window.innerWidth - C_) / 2 + window.screenX, r = (window.innerHeight - T_) / 2 + window.screenY; + const e = (window.innerWidth - T_) / 2 + window.screenX, r = (window.innerHeight - R_) / 2 + window.screenY; pJ(t); - const n = window.open(t, "Smart Wallet", `width=${C_}, height=${T_}, left=${e}, top=${r}`); + const n = window.open(t, "Smart Wallet", `width=${T_}, height=${R_}, left=${e}, top=${r}`); if (n == null || n.focus(), !n) throw Sr.rpc.internal("Pop up window failed to open"); return n; @@ -29017,7 +29020,7 @@ function gS(t, e) { return t.apply(e, arguments); }; } -const { toString: MJ } = Object.prototype, { getPrototypeOf: Sb } = Object, fp = /* @__PURE__ */ ((t) => (e) => { +const { toString: MJ } = Object.prototype, { getPrototypeOf: Ab } = Object, fp = /* @__PURE__ */ ((t) => (e) => { const r = MJ.call(e); return t[r] || (t[r] = r.slice(8, -1).toLowerCase()); })(/* @__PURE__ */ Object.create(null)), Ps = (t) => (t = t.toLowerCase(), (e) => fp(e) === t), lp = (t) => (e) => typeof e === t, { isArray: Wu } = Array, Ml = lp("undefined"); @@ -29032,7 +29035,7 @@ function CJ(t) { const TJ = lp("string"), Oi = lp("function"), vS = lp("number"), hp = (t) => t !== null && typeof t == "object", RJ = (t) => t === !0 || t === !1, kd = (t) => { if (fp(t) !== "object") return !1; - const e = Sb(t); + const e = Ab(t); return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in t) && !(Symbol.iterator in t); }, DJ = Ps("Date"), OJ = Ps("File"), NJ = Ps("Blob"), LJ = Ps("FileList"), kJ = (t) => hp(t) && Oi(t.pipe), $J = (t) => { let e; @@ -29063,10 +29066,10 @@ function bS(t, e) { return null; } const ic = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, yS = (t) => !Ml(t) && t !== ic; -function W1() { +function H1() { const { caseless: t } = yS(this) && this || {}, e = {}, r = (n, i) => { const s = t && bS(e, i) || i; - kd(e[s]) && kd(n) ? e[s] = W1(e[s], n) : kd(n) ? e[s] = W1({}, n) : Wu(n) ? e[s] = n.slice() : e[s] = n; + kd(e[s]) && kd(n) ? e[s] = H1(e[s], n) : kd(n) ? e[s] = H1({}, n) : Wu(n) ? e[s] = n.slice() : e[s] = n; }; for (let n = 0, i = arguments.length; n < i; n++) arguments[n] && sh(arguments[n], r); @@ -29085,7 +29088,7 @@ const WJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { do { for (i = Object.getOwnPropertyNames(t), s = i.length; s-- > 0; ) o = i[s], (!n || n(o, t, e)) && !a[o] && (e[o] = t[o], a[o] = !0); - t = r !== !1 && Sb(t); + t = r !== !1 && Ab(t); } while (t && (!r || r(t, e)) && t !== Object.prototype); return e; }, GJ = (t, e, r) => { @@ -29101,7 +29104,7 @@ const WJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { for (; e-- > 0; ) r[e] = t[e]; return r; -}, JJ = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Sb(Uint8Array)), XJ = (t, e) => { +}, JJ = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Ab(Uint8Array)), XJ = (t, e) => { const n = (t && t[Symbol.iterator]).call(t); let i; for (; (i = n.next()) && !i.done; ) { @@ -29119,7 +29122,7 @@ const WJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { function(r, n, i) { return n.toUpperCase() + i; } -), R_ = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), tX = Ps("RegExp"), wS = (t, e) => { +), D_ = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), tX = Ps("RegExp"), wS = (t, e) => { const r = Object.getOwnPropertyDescriptors(t), n = {}; sh(r, (i, s) => { let o; @@ -29148,10 +29151,10 @@ const WJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { }; return Wu(t) ? n(t) : n(String(t).split(e)), r; }, iX = () => { -}, sX = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, Im = "abcdefghijklmnopqrstuvwxyz", D_ = "0123456789", xS = { - DIGIT: D_, +}, sX = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, Im = "abcdefghijklmnopqrstuvwxyz", O_ = "0123456789", xS = { + DIGIT: O_, ALPHA: Im, - ALPHA_DIGIT: Im + Im.toUpperCase() + D_ + ALPHA_DIGIT: Im + Im.toUpperCase() + O_ }, oX = (t = 16, e = xS.ALPHA_DIGIT) => { let r = ""; const { length: n } = e; @@ -29212,7 +29215,7 @@ const cX = (t) => { isTypedArray: JJ, isFileList: LJ, forEach: sh, - merge: W1, + merge: H1, extend: WJ, trim: zJ, stripBOM: HJ, @@ -29225,8 +29228,8 @@ const cX = (t) => { forEachEntry: XJ, matchAll: ZJ, isHTMLForm: QJ, - hasOwnProperty: R_, - hasOwnProp: R_, + hasOwnProperty: D_, + hasOwnProp: D_, // an alias to avoid ESLint no-prototype-builtins detection reduceDescriptors: wS, freezeMethods: rX, @@ -29297,19 +29300,19 @@ or.from = (t, e, r, n, i, s) => { }, (a) => a !== "isAxiosError"), or.call(o, t.message, e, r, n, i), o.cause = t, o.name = t.name, s && Object.assign(o, s), o; }; const hX = null; -function H1(t) { +function K1(t) { return Oe.isPlainObject(t) || Oe.isArray(t); } function AS(t) { return Oe.endsWith(t, "[]") ? t.slice(0, -2) : t; } -function O_(t, e, r) { +function N_(t, e, r) { return t ? t.concat(e).map(function(i, s) { return i = AS(i), !r && s ? "[" + i + "]" : i; }).join(r ? "." : "") : e; } function dX(t) { - return Oe.isArray(t) && !t.some(H1); + return Oe.isArray(t) && !t.some(K1); } const pX = Oe.toFlatObject(Oe, {}, null, function(e) { return /^is[A-Z]/.test(e); @@ -29344,17 +29347,17 @@ function dp(t, e, r) { return N = AS(N), B.forEach(function(H, W) { !(Oe.isUndefined(H) || H === null) && e.append( // eslint-disable-next-line no-nested-ternary - o === !0 ? O_([N], W, s) : o === null ? N : N + "[]", + o === !0 ? N_([N], W, s) : o === null ? N : N + "[]", l(H) ); }), !1; } - return H1(M) ? !0 : (e.append(O_(L, N, s), l(M)), !1); + return K1(M) ? !0 : (e.append(N_(L, N, s), l(M)), !1); } const p = [], w = Object.assign(pX, { defaultVisitor: d, convertValue: l, - isVisitable: H1 + isVisitable: K1 }); function A(M, N) { if (!Oe.isUndefined(M)) { @@ -29375,7 +29378,7 @@ function dp(t, e, r) { throw new TypeError("data must be an object"); return A(t), e; } -function N_(t) { +function L_(t) { const e = { "!": "%21", "'": "%27", @@ -29389,17 +29392,17 @@ function N_(t) { return e[n]; }); } -function Ab(t, e) { +function Pb(t, e) { this._pairs = [], t && dp(t, this, e); } -const PS = Ab.prototype; +const PS = Pb.prototype; PS.append = function(e, r) { this._pairs.push([e, r]); }; PS.toString = function(e) { const r = e ? function(n) { - return e.call(this, n, N_); - } : N_; + return e.call(this, n, L_); + } : L_; return this._pairs.map(function(i) { return r(i[0]) + "=" + r(i[1]); }, "").join("&"); @@ -29416,13 +29419,13 @@ function MS(t, e, r) { }); const i = r && r.serialize; let s; - if (i ? s = i(e, r) : s = Oe.isURLSearchParams(e) ? e.toString() : new Ab(e, r).toString(n), s) { + if (i ? s = i(e, r) : s = Oe.isURLSearchParams(e) ? e.toString() : new Pb(e, r).toString(n), s) { const o = t.indexOf("#"); o !== -1 && (t = t.slice(0, o)), t += (t.indexOf("?") === -1 ? "?" : "&") + s; } return t; } -class L_ { +class k_ { constructor() { this.handlers = []; } @@ -29480,7 +29483,7 @@ const IS = { silentJSONParsing: !0, forcedJSONParsing: !0, clarifyTimeoutError: !1 -}, mX = typeof URLSearchParams < "u" ? URLSearchParams : Ab, vX = typeof FormData < "u" ? FormData : null, bX = typeof Blob < "u" ? Blob : null, yX = { +}, mX = typeof URLSearchParams < "u" ? URLSearchParams : Pb, vX = typeof FormData < "u" ? FormData : null, bX = typeof Blob < "u" ? Blob : null, yX = { isBrowser: !0, classes: { URLSearchParams: mX, @@ -29488,13 +29491,13 @@ const IS = { Blob: bX }, protocols: ["http", "https", "file", "blob", "url", "data"] -}, Pb = typeof window < "u" && typeof document < "u", K1 = typeof navigator == "object" && navigator || void 0, wX = Pb && (!K1 || ["ReactNative", "NativeScript", "NS"].indexOf(K1.product) < 0), xX = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef -self instanceof WorkerGlobalScope && typeof self.importScripts == "function", _X = Pb && window.location.href || "http://localhost", EX = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}, Mb = typeof window < "u" && typeof document < "u", V1 = typeof navigator == "object" && navigator || void 0, wX = Mb && (!V1 || ["ReactNative", "NativeScript", "NS"].indexOf(V1.product) < 0), xX = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef +self instanceof WorkerGlobalScope && typeof self.importScripts == "function", _X = Mb && window.location.href || "http://localhost", EX = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - hasBrowserEnv: Pb, + hasBrowserEnv: Mb, hasStandardBrowserEnv: wX, hasStandardBrowserWebWorkerEnv: xX, - navigator: K1, + navigator: V1, origin: _X }, Symbol.toStringTag, { value: "Module" })), Jn = { ...EX, @@ -29638,7 +29641,7 @@ const IX = Oe.toObjectSet([ `).forEach(function(o) { i = o.indexOf(":"), r = o.substring(0, i).trim().toLowerCase(), n = o.substring(i + 1).trim(), !(!r || e[r] && IX[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n); }), e; -}, k_ = Symbol("internals"); +}, $_ = Symbol("internals"); function Df(t) { return t && String(t).trim().toLowerCase(); } @@ -29785,7 +29788,7 @@ let yi = class { return r.forEach((i) => n.set(i)), n; } static accessor(e) { - const n = (this[k_] = this[k_] = { + const n = (this[$_] = this[$_] = { accessors: {} }).accessors, i = this.prototype; function s(o) { @@ -29883,14 +29886,14 @@ const g0 = (t, e, r = 3) => { }; t(p); }, r); -}, $_ = (t, e) => { +}, B_ = (t, e) => { const r = t != null; return [(n) => e[0]({ lengthComputable: r, total: t, loaded: n }), e[1]]; -}, B_ = (t) => (...e) => Oe.asap(() => t(...e)), $X = Jn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Jn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( +}, F_ = (t) => (...e) => Oe.asap(() => t(...e)), $X = Jn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Jn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( new URL(Jn.origin), Jn.navigator && /(msie|trident)/i.test(Jn.navigator.userAgent) ) : () => !0, BX = Jn.hasStandardBrowserEnv ? ( @@ -29929,7 +29932,7 @@ function jX(t, e) { function DS(t, e) { return t && !FX(e) ? jX(t, e) : e; } -const F_ = (t) => t instanceof yi ? { ...t } : t; +const j_ = (t) => t instanceof yi ? { ...t } : t; function gc(t, e) { e = e || {}; const r = {}; @@ -29987,7 +29990,7 @@ function gc(t, e) { socketPath: o, responseEncoding: o, validateStatus: a, - headers: (l, d, p) => i(F_(l), F_(d), p, !0) + headers: (l, d, p) => i(j_(l), j_(d), p, !0) }; return Oe.forEach(Object.keys(Object.assign({}, t, e)), function(d) { const p = u[d] || i, w = p(t[d], e[d], d); @@ -30123,7 +30126,7 @@ const OS = (t) => { } finally { await e.cancel(); } -}, j_ = (t, e, r, n) => { +}, U_ = (t, e, r, n) => { const i = HX(t, e); let s = 0, o, a = (u) => { o || (o = !0, n && n(u)); @@ -30168,8 +30171,8 @@ const OS = (t) => { } }).headers.has("Content-Type"); return t && !e; -}), U_ = 64 * 1024, V1 = NS && LS(() => Oe.isReadableStream(new Response("").body)), m0 = { - stream: V1 && ((t) => t.body) +}), q_ = 64 * 1024, G1 = NS && LS(() => Oe.isReadableStream(new Response("").body)), m0 = { + stream: G1 && ((t) => t.body) }; pp && ((t) => { ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => { @@ -30224,11 +30227,11 @@ const YX = async (t) => { duplex: "half" }), te; if (Oe.isFormData(n) && (te = V.headers.get("content-type")) && d.setContentType(te), V.body) { - const [R, K] = $_( + const [R, K] = B_( L, - g0(B_(u)) + g0(F_(u)) ); - n = j_(V.body, U_, R, K); + n = U_(V.body, q_, R, K); } } Oe.isString(p) || (p = p ? "include" : "omit"); @@ -30243,18 +30246,18 @@ const YX = async (t) => { credentials: B ? p : void 0 }); let $ = await fetch(M); - const H = V1 && (l === "stream" || l === "response"); - if (V1 && (a || H && N)) { + const H = G1 && (l === "stream" || l === "response"); + if (G1 && (a || H && N)) { const V = {}; ["status", "statusText", "headers"].forEach((ge) => { V[ge] = $[ge]; }); - const te = Oe.toFiniteNumber($.headers.get("content-length")), [R, K] = a && $_( + const te = Oe.toFiniteNumber($.headers.get("content-length")), [R, K] = a && B_( te, - g0(B_(a), !0) + g0(F_(a), !0) ) || []; $ = new Response( - j_($.body, U_, R, () => { + U_($.body, q_, R, () => { K && K(), N && N(); }), V @@ -30280,12 +30283,12 @@ const YX = async (t) => { } ) : or.from(B, B && B.code, t, M); } -}), G1 = { +}), Y1 = { http: hX, xhr: qX, fetch: XX }; -Oe.forEach(G1, (t, e) => { +Oe.forEach(Y1, (t, e) => { if (t) { try { Object.defineProperty(t, "name", { value: e }); @@ -30294,7 +30297,7 @@ Oe.forEach(G1, (t, e) => { Object.defineProperty(t, "adapterName", { value: e }); } }); -const q_ = (t) => `- ${t}`, ZX = (t) => Oe.isFunction(t) || t === null || t === !1, kS = { +const z_ = (t) => `- ${t}`, ZX = (t) => Oe.isFunction(t) || t === null || t === !1, kS = { getAdapter: (t) => { t = Oe.isArray(t) ? t : [t]; const { length: e } = t; @@ -30303,7 +30306,7 @@ const q_ = (t) => `- ${t}`, ZX = (t) => Oe.isFunction(t) || t === null || t === for (let s = 0; s < e; s++) { r = t[s]; let o; - if (n = r, !ZX(r) && (n = G1[(o = String(r)).toLowerCase()], n === void 0)) + if (n = r, !ZX(r) && (n = Y1[(o = String(r)).toLowerCase()], n === void 0)) throw new or(`Unknown adapter '${o}'`); if (n) break; @@ -30314,8 +30317,8 @@ const q_ = (t) => `- ${t}`, ZX = (t) => Oe.isFunction(t) || t === null || t === ([a, u]) => `adapter ${a} ` + (u === !1 ? "is not supported by the environment" : "is not available in the build") ); let o = e ? s.length > 1 ? `since : -` + s.map(q_).join(` -`) : " " + q_(s[0]) : "as no adapter specified"; +` + s.map(z_).join(` +`) : " " + z_(s[0]) : "as no adapter specified"; throw new or( "There is no suitable adapter to dispatch the request " + o, "ERR_NOT_SUPPORT" @@ -30323,13 +30326,13 @@ const q_ = (t) => `- ${t}`, ZX = (t) => Oe.isFunction(t) || t === null || t === } return n; }, - adapters: G1 + adapters: Y1 }; function Rm(t) { if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted) throw new Hu(null, t); } -function z_(t) { +function W_(t) { return Rm(t), t.headers = yi.from(t.headers), t.data = Tm.call( t, t.transformRequest @@ -30353,7 +30356,7 @@ const $S = "1.7.8", gp = {}; return typeof n === t || "a" + (e < 1 ? "n " : " ") + t; }; }); -const W_ = {}; +const H_ = {}; gp.transitional = function(e, r, n) { function i(s, o) { return "[Axios v" + $S + "] Transitional option '" + s + "'" + o + (n ? ". " + n : ""); @@ -30364,7 +30367,7 @@ gp.transitional = function(e, r, n) { i(o, " has been removed" + (r ? " in " + r : "")), or.ERR_DEPRECATED ); - return r && !W_[o] && (W_[o] = !0, console.warn( + return r && !H_[o] && (H_[o] = !0, console.warn( i( o, " has been deprecated since v" + r + " and will be removed in the near future" @@ -30399,8 +30402,8 @@ const Bd = { let ac = class { constructor(e) { this.defaults = e, this.interceptors = { - request: new L_(), - response: new L_() + request: new k_(), + response: new k_() }; } /** @@ -30465,7 +30468,7 @@ let ac = class { }); let d, p = 0, w; if (!u) { - const M = [z_.bind(this), void 0]; + const M = [W_.bind(this), void 0]; for (M.unshift.apply(M, a), M.push.apply(M, l), w = M.length, d = Promise.resolve(r); p < w; ) d = d.then(M[p++], M[p++]); return d; @@ -30482,7 +30485,7 @@ let ac = class { } } try { - d = z_.call(this, A); + d = W_.call(this, A); } catch (M) { return Promise.reject(M); } @@ -30601,7 +30604,7 @@ function tZ(t) { function rZ(t) { return Oe.isObject(t) && t.isAxiosError === !0; } -const Y1 = { +const J1 = { Continue: 100, SwitchingProtocols: 101, Processing: 102, @@ -30666,8 +30669,8 @@ const Y1 = { NotExtended: 510, NetworkAuthenticationRequired: 511 }; -Object.entries(Y1).forEach(([t, e]) => { - Y1[e] = t; +Object.entries(J1).forEach(([t, e]) => { + J1[e] = t; }); function FS(t) { const e = new ac(t), r = gS(ac.prototype.request, e); @@ -30693,7 +30696,7 @@ mn.mergeConfig = gc; mn.AxiosHeaders = yi; mn.formToJSON = (t) => CS(Oe.isHTMLForm(t) ? new FormData(t) : t); mn.getAdapter = kS.getAdapter; -mn.HttpStatusCode = Y1; +mn.HttpStatusCode = J1; mn.default = mn; const { Axios: noe, @@ -30815,7 +30818,13 @@ function mp() { } function boe(t) { const { apiBaseUrl: e } = t, [r, n] = Yt([]), [i, s] = Yt([]), [o, a] = Yt(null), [u, l] = Yt(!1), d = (A) => { - console.log("saveLastUsedWallet", A); + a(A); + const N = { + provider: A.provider instanceof N1 ? "UniversalProvider" : "EIP1193Provider", + key: A.key, + timestamp: Date.now() + }; + localStorage.setItem("xn-last-used-info", JSON.stringify(N)); }; function p(A) { const M = A.filter((B) => B.featured || B.installed), N = A.filter((B) => !B.featured && !B.installed), L = [...M, ...N]; @@ -30842,9 +30851,9 @@ function boe(t) { const L = JSON.parse(localStorage.getItem("xn-last-used-info") || "{}"), B = M.get(L.key); if (B) { if (B.lastUsed = !0, L.provider === "UniversalProvider") { - const $ = await EE.init(oZ); - $.session && B.setUniversalProvider($); - } + const $ = await N1.init(oZ); + $.session && (B.setUniversalProvider($), console.log("Restored UniversalProvider for wallet:", B.key)); + } else L.provider === "EIP1193Provider" && B.installed && console.log("Using detected EIP1193Provider for wallet:", B.key); a(B); } } catch (L) { @@ -30898,7 +30907,7 @@ var uZ = { * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const fZ = gv( +const fZ = mv( ({ color: t = "currentColor", size: e = 24, @@ -30933,7 +30942,7 @@ const fZ = gv( * See the LICENSE file in the root directory of this source tree. */ const us = (t, e) => { - const r = gv( + const r = mv( ({ className: n, ...i }, s) => qd(fZ, { ref: s, iconNode: e, @@ -31069,9 +31078,9 @@ const bZ = us("UserRoundCheck", [ ["path", { d: "M2 21a8 8 0 0 1 13.292-6", key: "bjp14o" }], ["circle", { cx: "10", cy: "8", r: "5", key: "o932ke" }], ["path", { d: "m16 19 2 2 4-4", key: "1b14m6" }] -]), H_ = /* @__PURE__ */ new Set(); +]), K_ = /* @__PURE__ */ new Set(); function vp(t, e, r) { - t || H_.has(e) || (console.warn(e), H_.add(e)); + t || K_.has(e) || (console.warn(e), K_.add(e)); } function yZ(t) { if (typeof Proxy > "u") @@ -31089,7 +31098,7 @@ function yZ(t) { function bp(t) { return t !== null && typeof t == "object" && typeof t.start == "function"; } -const J1 = (t) => Array.isArray(t); +const X1 = (t) => Array.isArray(t); function VS(t, e) { if (!Array.isArray(e)) return !1; @@ -31104,28 +31113,28 @@ function VS(t, e) { function Il(t) { return typeof t == "string" || Array.isArray(t); } -function K_(t) { +function V_(t) { const e = [{}, {}]; return t == null || t.values.forEach((r, n) => { e[0][n] = r.get(), e[1][n] = r.getVelocity(); }), e; } -function Mb(t, e, r, n) { +function Ib(t, e, r, n) { if (typeof e == "function") { - const [i, s] = K_(n); + const [i, s] = V_(n); e = e(r !== void 0 ? r : t.custom, i, s); } if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") { - const [i, s] = K_(n); + const [i, s] = V_(n); e = e(r !== void 0 ? r : t.custom, i, s); } return e; } function yp(t, e, r) { const n = t.getProps(); - return Mb(n, e, r !== void 0 ? r : n.custom, t); + return Ib(n, e, r !== void 0 ? r : n.custom, t); } -const Ib = [ +const Cb = [ "animate", "whileInView", "whileFocus", @@ -31133,7 +31142,7 @@ const Ib = [ "whileTap", "whileDrag", "exit" -], Cb = ["initial", ...Ib], ah = [ +], Tb = ["initial", ...Cb], ah = [ "transformPerspective", "x", "y", @@ -31169,7 +31178,7 @@ const Ib = [ ease: [0.25, 0.1, 0.35, 1], duration: 0.3 }, SZ = (t, { keyframes: e }) => e.length > 2 ? _Z : Ac.has(t) ? t.startsWith("scale") ? xZ(e[1]) : wZ : EZ; -function Tb(t, e) { +function Rb(t, e) { return t ? t[e] || t.default || t : void 0; } const AZ = { @@ -31266,7 +31275,7 @@ function ch(t, e, r, n) { const i = (s) => RZ(s, 0, 1, t, r); return (s) => s === 0 || s === 1 ? s : YS(i(s), e, n); } -const JS = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, XS = (t) => (e) => 1 - t(1 - e), ZS = /* @__PURE__ */ ch(0.33, 1.53, 0.69, 0.99), Rb = /* @__PURE__ */ XS(ZS), QS = /* @__PURE__ */ JS(Rb), e7 = (t) => (t *= 2) < 1 ? 0.5 * Rb(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Db = (t) => 1 - Math.sin(Math.acos(t)), t7 = XS(Db), r7 = JS(Db), n7 = (t) => /^0[^.\s]+$/u.test(t); +const JS = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, XS = (t) => (e) => 1 - t(1 - e), ZS = /* @__PURE__ */ ch(0.33, 1.53, 0.69, 0.99), Db = /* @__PURE__ */ XS(ZS), QS = /* @__PURE__ */ JS(Db), e7 = (t) => (t *= 2) < 1 ? 0.5 * Db(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Ob = (t) => 1 - Math.sin(Math.acos(t)), t7 = XS(Ob), r7 = JS(Ob), n7 = (t) => /^0[^.\s]+$/u.test(t); function DZ(t) { return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || n7(t) : !0; } @@ -31277,7 +31286,7 @@ process.env.NODE_ENV !== "production" && (Ku = (t, e) => { if (!t) throw new Error(e); }); -const i7 = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), s7 = (t) => (e) => typeof e == "string" && e.startsWith(t), o7 = /* @__PURE__ */ s7("--"), OZ = /* @__PURE__ */ s7("var(--"), Ob = (t) => OZ(t) ? NZ.test(t.split("/*")[0].trim()) : !1, NZ = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, LZ = ( +const i7 = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), s7 = (t) => (e) => typeof e == "string" && e.startsWith(t), o7 = /* @__PURE__ */ s7("--"), OZ = /* @__PURE__ */ s7("var(--"), Nb = (t) => OZ(t) ? NZ.test(t.split("/*")[0].trim()) : !1, NZ = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, LZ = ( // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u ); @@ -31299,7 +31308,7 @@ function a7(t, e, r = 1) { const o = s.trim(); return i7(o) ? parseFloat(o) : o; } - return Ob(i) ? a7(i, e, r + 1) : i; + return Nb(i) ? a7(i, e, r + 1) : i; } const xa = (t, e, r) => r > e ? e : r < t ? t : r, Vu = { test: (t) => typeof t == "number", @@ -31315,7 +31324,7 @@ const xa = (t, e, r) => r > e ? e : r < t ? t : r, Vu = { test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1, parse: parseFloat, transform: (e) => `${e}${t}` -}), oa = /* @__PURE__ */ uh("deg"), Gs = /* @__PURE__ */ uh("%"), Vt = /* @__PURE__ */ uh("px"), BZ = /* @__PURE__ */ uh("vh"), FZ = /* @__PURE__ */ uh("vw"), V_ = { +}), oa = /* @__PURE__ */ uh("deg"), Gs = /* @__PURE__ */ uh("%"), Vt = /* @__PURE__ */ uh("px"), BZ = /* @__PURE__ */ uh("vh"), FZ = /* @__PURE__ */ uh("vw"), G_ = { ...Gs, parse: (t) => Gs.parse(t) / 100, transform: (t) => Gs.transform(t * 100) @@ -31330,15 +31339,15 @@ const xa = (t, e, r) => r > e ? e : r < t ? t : r, Vu = { "y", "translateX", "translateY" -]), G_ = (t) => t === Vu || t === Vt, Y_ = (t, e) => parseFloat(t.split(", ")[e]), J_ = (t, e) => (r, { transform: n }) => { +]), Y_ = (t) => t === Vu || t === Vt, J_ = (t, e) => parseFloat(t.split(", ")[e]), X_ = (t, e) => (r, { transform: n }) => { if (n === "none" || !n) return 0; const i = n.match(/^matrix3d\((.+)\)$/u); if (i) - return Y_(i[1], e); + return J_(i[1], e); { const s = n.match(/^matrix\((.+)\)$/u); - return s ? Y_(s[1], t) : 0; + return s ? J_(s[1], t) : 0; } }, UZ = /* @__PURE__ */ new Set(["x", "y", "z"]), qZ = ah.filter((t) => !UZ.has(t)); function zZ(t) { @@ -31357,18 +31366,18 @@ const Mu = { bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min), right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min), // Transform - x: J_(4, 13), - y: J_(5, 14) + x: X_(4, 13), + y: X_(5, 14) }; Mu.translateX = Mu.x; Mu.translateY = Mu.y; const c7 = (t) => (e) => e.test(t), WZ = { test: (t) => t === "auto", parse: (t) => t -}, u7 = [Vu, Vt, Gs, oa, FZ, BZ, WZ], X_ = (t) => u7.find(c7(t)), cc = /* @__PURE__ */ new Set(); -let X1 = !1, Z1 = !1; +}, u7 = [Vu, Vt, Gs, oa, FZ, BZ, WZ], Z_ = (t) => u7.find(c7(t)), cc = /* @__PURE__ */ new Set(); +let Z1 = !1, Q1 = !1; function f7() { - if (Z1) { + if (Q1) { const t = Array.from(cc).filter((n) => n.needsMeasurement), e = new Set(t.map((n) => n.element)), r = /* @__PURE__ */ new Map(); e.forEach((n) => { const i = zZ(n); @@ -31384,22 +31393,22 @@ function f7() { n.suspendedScrollY !== void 0 && window.scrollTo(0, n.suspendedScrollY); }); } - Z1 = !1, X1 = !1, cc.forEach((t) => t.complete()), cc.clear(); + Q1 = !1, Z1 = !1, cc.forEach((t) => t.complete()), cc.clear(); } function l7() { cc.forEach((t) => { - t.readKeyframes(), t.needsMeasurement && (Z1 = !0); + t.readKeyframes(), t.needsMeasurement && (Q1 = !0); }); } function HZ() { l7(), f7(); } -class Nb { +class Lb { constructor(e, r, n, i, s, o = !1) { this.isComplete = !1, this.isAsync = !1, this.needsMeasurement = !1, this.isScheduled = !1, this.unresolvedKeyframes = [...e], this.onComplete = r, this.name = n, this.motionValue = i, this.element = s, this.isAsync = o; } scheduleResolve() { - this.isScheduled = !0, this.isAsync ? (cc.add(this), X1 || (X1 = !0, Lr.read(l7), Lr.resolveKeyframes(f7))) : (this.readKeyframes(), this.complete()); + this.isScheduled = !0, this.isAsync ? (cc.add(this), Z1 || (Z1 = !0, Lr.read(l7), Lr.resolveKeyframes(f7))) : (this.readKeyframes(), this.complete()); } readKeyframes() { const { unresolvedKeyframes: e, name: r, element: n, motionValue: i } = this; @@ -31435,14 +31444,14 @@ class Nb { this.isComplete || this.scheduleResolve(); } } -const Yf = (t) => Math.round(t * 1e5) / 1e5, Lb = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; +const Yf = (t) => Math.round(t * 1e5) / 1e5, kb = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; function KZ(t) { return t == null; } -const VZ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, kb = (t, e) => (r) => !!(typeof r == "string" && VZ.test(r) && r.startsWith(t) || e && !KZ(r) && Object.prototype.hasOwnProperty.call(r, e)), h7 = (t, e, r) => (n) => { +const VZ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, $b = (t, e) => (r) => !!(typeof r == "string" && VZ.test(r) && r.startsWith(t) || e && !KZ(r) && Object.prototype.hasOwnProperty.call(r, e)), h7 = (t, e, r) => (n) => { if (typeof n != "string") return n; - const [i, s, o, a] = n.match(Lb); + const [i, s, o, a] = n.match(kb); return { [t]: parseFloat(i), [e]: parseFloat(s), @@ -31453,7 +31462,7 @@ const VZ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s ...Vu, transform: (t) => Math.round(GZ(t)) }, sc = { - test: /* @__PURE__ */ kb("rgb", "red"), + test: /* @__PURE__ */ $b("rgb", "red"), parse: /* @__PURE__ */ h7("red", "green", "blue"), transform: ({ red: t, green: e, blue: r, alpha: n = 1 }) => "rgba(" + Om.transform(t) + ", " + Om.transform(e) + ", " + Om.transform(r) + ", " + Yf(Cl.transform(n)) + ")" }; @@ -31466,24 +31475,24 @@ function YZ(t) { alpha: i ? parseInt(i, 16) / 255 : 1 }; } -const Q1 = { - test: /* @__PURE__ */ kb("#"), +const ev = { + test: /* @__PURE__ */ $b("#"), parse: YZ, transform: sc.transform }, eu = { - test: /* @__PURE__ */ kb("hsl", "hue"), + test: /* @__PURE__ */ $b("hsl", "hue"), parse: /* @__PURE__ */ h7("hue", "saturation", "lightness"), transform: ({ hue: t, saturation: e, lightness: r, alpha: n = 1 }) => "hsla(" + Math.round(t) + ", " + Gs.transform(Yf(e)) + ", " + Gs.transform(Yf(r)) + ", " + Yf(Cl.transform(n)) + ")" }, Yn = { - test: (t) => sc.test(t) || Q1.test(t) || eu.test(t), - parse: (t) => sc.test(t) ? sc.parse(t) : eu.test(t) ? eu.parse(t) : Q1.parse(t), + test: (t) => sc.test(t) || ev.test(t) || eu.test(t), + parse: (t) => sc.test(t) ? sc.parse(t) : eu.test(t) ? eu.parse(t) : ev.parse(t), transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? sc.transform(t) : eu.transform(t) }, JZ = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu; function XZ(t) { var e, r; - return isNaN(t) && typeof t == "string" && (((e = t.match(Lb)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match(JZ)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; + return isNaN(t) && typeof t == "string" && (((e = t.match(kb)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match(JZ)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; } -const d7 = "number", p7 = "color", ZZ = "var", QZ = "var(", Z_ = "${}", eQ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; +const d7 = "number", p7 = "color", ZZ = "var", QZ = "var(", Q_ = "${}", eQ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; function Tl(t) { const e = t.toString(), r = [], n = { color: [], @@ -31491,7 +31500,7 @@ function Tl(t) { var: [] }, i = []; let s = 0; - const a = e.replace(eQ, (u) => (Yn.test(u) ? (n.color.push(s), i.push(p7), r.push(Yn.parse(u))) : u.startsWith(QZ) ? (n.var.push(s), i.push(ZZ), r.push(u)) : (n.number.push(s), i.push(d7), r.push(parseFloat(u))), ++s, Z_)).split(Z_); + const a = e.replace(eQ, (u) => (Yn.test(u) ? (n.color.push(s), i.push(p7), r.push(Yn.parse(u))) : u.startsWith(QZ) ? (n.var.push(s), i.push(ZZ), r.push(u)) : (n.number.push(s), i.push(d7), r.push(parseFloat(u))), ++s, Q_)).split(Q_); return { values: r, split: a, indexes: n, types: i }; } function g7(t) { @@ -31524,14 +31533,14 @@ function iQ(t) { const [e, r] = t.slice(0, -1).split("("); if (e === "drop-shadow") return t; - const [n] = r.match(Lb) || []; + const [n] = r.match(kb) || []; if (!n) return t; const i = r.replace(n, ""); let s = nQ.has(e) ? 1 : 0; return n !== r && (s *= 100), e + "(" + s + i + ")"; } -const sQ = /\b([a-z-]*)\(.*?\)/gu, ev = { +const sQ = /\b([a-z-]*)\(.*?\)/gu, tv = { ..._a, getAnimatableNone: (t) => { const e = t.match(sQ); @@ -31595,23 +31604,23 @@ const sQ = /\b([a-z-]*)\(.*?\)/gu, ev = { perspective: Vt, transformPerspective: Vt, opacity: Cl, - originX: V_, - originY: V_, + originX: G_, + originY: G_, originZ: Vt -}, Q_ = { +}, e6 = { ...Vu, transform: Math.round -}, $b = { +}, Bb = { ...oQ, ...aQ, - zIndex: Q_, + zIndex: e6, size: Vt, // SVG fillOpacity: Cl, strokeOpacity: Cl, - numOctaves: Q_ + numOctaves: e6 }, cQ = { - ...$b, + ...Bb, // Color props color: Yn, backgroundColor: Yn, @@ -31624,12 +31633,12 @@ const sQ = /\b([a-z-]*)\(.*?\)/gu, ev = { borderRightColor: Yn, borderBottomColor: Yn, borderLeftColor: Yn, - filter: ev, - WebkitFilter: ev -}, Bb = (t) => cQ[t]; + filter: tv, + WebkitFilter: tv +}, Fb = (t) => cQ[t]; function v7(t, e) { - let r = Bb(t); - return r !== ev && (r = _a), r.getAnimatableNone ? r.getAnimatableNone(e) : void 0; + let r = Fb(t); + return r !== tv && (r = _a), r.getAnimatableNone ? r.getAnimatableNone(e) : void 0; } const uQ = /* @__PURE__ */ new Set(["auto", "none", "0"]); function fQ(t, e, r) { @@ -31642,7 +31651,7 @@ function fQ(t, e, r) { for (const s of e) t[s] = v7(r, i); } -class b7 extends Nb { +class b7 extends Lb { constructor(e, r, n, i, s) { super(e, r, n, i, s, !0); } @@ -31653,16 +31662,16 @@ class b7 extends Nb { super.readKeyframes(); for (let u = 0; u < e.length; u++) { let l = e[u]; - if (typeof l == "string" && (l = l.trim(), Ob(l))) { + if (typeof l == "string" && (l = l.trim(), Nb(l))) { const d = a7(l, r.current); d !== void 0 && (e[u] = d), u === e.length - 1 && (this.finalKeyframe = l); } } if (this.resolveNoneKeyframes(), !jZ.has(n) || e.length !== 2) return; - const [i, s] = e, o = X_(i), a = X_(s); + const [i, s] = e, o = Z_(i), a = Z_(s); if (o !== a) - if (G_(o) && G_(a)) + if (Y_(o) && Y_(a)) for (let u = 0; u < e.length; u++) { const l = e[u]; typeof l == "string" && (e[u] = parseFloat(l)); @@ -31697,7 +31706,7 @@ class b7 extends Nb { }), this.resolveNoneKeyframes(); } } -function Fb(t) { +function jb(t) { return typeof t == "function"; } let Fd; @@ -31709,7 +31718,7 @@ const Ys = { set: (t) => { Fd = t, queueMicrotask(lQ); } -}, e6 = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string +}, t6 = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string (_a.test(t) || t === "0") && // And it contains numbers and/or colors !t.startsWith("url(")); function hQ(t) { @@ -31726,8 +31735,8 @@ function dQ(t, e, r, n) { return !1; if (e === "display" || e === "visibility") return !0; - const s = t[t.length - 1], o = e6(i, e), a = e6(s, e); - return Ku(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : hQ(t) || (r === "spring" || Fb(r)) && n; + const s = t[t.length - 1], o = t6(i, e), a = t6(s, e); + return Ku(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : hQ(t) || (r === "spring" || jb(r)) && n; } const pQ = 40; class y7 { @@ -31812,16 +31821,16 @@ function x7(t, e, r) { const n = Math.max(e - gQ, 0); return w7(r - t(n), e - n); } -const Nm = 1e-3, mQ = 0.01, t6 = 10, vQ = 0.05, bQ = 1; +const Nm = 1e-3, mQ = 0.01, r6 = 10, vQ = 0.05, bQ = 1; function yQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }) { let i, s; - Ku(t <= Vs(t6), "Spring duration must be 10 seconds or less"); + Ku(t <= Vs(r6), "Spring duration must be 10 seconds or less"); let o = 1 - e; - o = xa(vQ, bQ, o), t = xa(mQ, t6, To(t)), o < 1 ? (i = (l) => { - const d = l * o, p = d * t, w = d - r, A = tv(l, o), M = Math.exp(-p); + o = xa(vQ, bQ, o), t = xa(mQ, r6, To(t)), o < 1 ? (i = (l) => { + const d = l * o, p = d * t, w = d - r, A = rv(l, o), M = Math.exp(-p); return Nm - w / A * M; }, s = (l) => { - const p = l * o * t, w = p * r + r, A = Math.pow(o, 2) * Math.pow(l, 2) * t, M = Math.exp(-p), N = tv(Math.pow(l, 2), o); + const p = l * o * t, w = p * r + r, A = Math.pow(o, 2) * Math.pow(l, 2) * t, M = Math.exp(-p), N = rv(Math.pow(l, 2), o); return (-i(l) + Nm > 0 ? -1 : 1) * ((w - A) * M) / N; }) : (i = (l) => { const d = Math.exp(-l * t), p = (l - r) * t + 1; @@ -31853,11 +31862,11 @@ function xQ(t, e, r) { n = n - t(n) / e(n); return n; } -function tv(t, e) { +function rv(t, e) { return t * Math.sqrt(1 - e * e); } const _Q = ["duration", "bounce"], EQ = ["stiffness", "damping", "mass"]; -function r6(t, e) { +function n6(t, e) { return e.some((r) => t[r] !== void 0); } function SQ(t) { @@ -31869,7 +31878,7 @@ function SQ(t) { isResolvedFromDuration: !1, ...t }; - if (!r6(t, EQ) && r6(t, _Q)) { + if (!n6(t, EQ) && n6(t, _Q)) { const r = yQ(t); e = { ...e, @@ -31887,7 +31896,7 @@ function _7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { r || (r = B ? 0.01 : 2), e || (e = B ? 5e-3 : 0.5); let $; if (M < 1) { - const H = tv(L, M); + const H = rv(L, M); $ = (W) => { const V = Math.exp(-M * L * W); return s - V * ((A + M * L * N) / H * Math.sin(H * W) + N * Math.cos(H * W)); @@ -31917,7 +31926,7 @@ function _7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { } }; } -function n6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: u, restDelta: l = 0.5, restSpeed: d }) { +function i6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: u, restDelta: l = 0.5, restSpeed: d }) { const p = t[0], w = { done: !1, value: p @@ -31949,25 +31958,25 @@ function n6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 3 } }; } -const AQ = /* @__PURE__ */ ch(0.42, 0, 1, 1), PQ = /* @__PURE__ */ ch(0, 0, 0.58, 1), E7 = /* @__PURE__ */ ch(0.42, 0, 0.58, 1), MQ = (t) => Array.isArray(t) && typeof t[0] != "number", jb = (t) => Array.isArray(t) && typeof t[0] == "number", i6 = { +const AQ = /* @__PURE__ */ ch(0.42, 0, 1, 1), PQ = /* @__PURE__ */ ch(0, 0, 0.58, 1), E7 = /* @__PURE__ */ ch(0.42, 0, 0.58, 1), MQ = (t) => Array.isArray(t) && typeof t[0] != "number", Ub = (t) => Array.isArray(t) && typeof t[0] == "number", s6 = { linear: Un, easeIn: AQ, easeInOut: E7, easeOut: PQ, - circIn: Db, + circIn: Ob, circInOut: r7, circOut: t7, - backIn: Rb, + backIn: Db, backInOut: QS, backOut: ZS, anticipate: e7 -}, s6 = (t) => { - if (jb(t)) { +}, o6 = (t) => { + if (Ub(t)) { Uo(t.length === 4, "Cubic bezier arrays must contain four numerical values."); const [e, r, n, i] = t; return ch(e, r, n, i); } else if (typeof t == "string") - return Uo(i6[t] !== void 0, `Invalid easing type '${t}'`), i6[t]; + return Uo(s6[t] !== void 0, `Invalid easing type '${t}'`), s6[t]; return t; }, IQ = (t, e) => (r) => e(t(r)), Ro = (...t) => t.reduce(IQ), Iu = (t, e, r) => { const n = e - t; @@ -31998,32 +32007,32 @@ function v0(t, e) { const km = (t, e, r) => { const n = t * t, i = r * (e * e - n) + n; return i < 0 ? 0 : Math.sqrt(i); -}, TQ = [Q1, sc, eu], RQ = (t) => TQ.find((e) => e.test(t)); -function o6(t) { +}, TQ = [ev, sc, eu], RQ = (t) => TQ.find((e) => e.test(t)); +function a6(t) { const e = RQ(t); if (Ku(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e) return !1; let r = e.parse(t); return e === eu && (r = CQ(r)), r; } -const a6 = (t, e) => { - const r = o6(t), n = o6(e); +const c6 = (t, e) => { + const r = a6(t), n = a6(e); if (!r || !n) return v0(t, e); const i = { ...r }; return (s) => (i.red = km(r.red, n.red, s), i.green = km(r.green, n.green, s), i.blue = km(r.blue, n.blue, s), i.alpha = Qr(r.alpha, n.alpha, s), sc.transform(i)); -}, rv = /* @__PURE__ */ new Set(["none", "hidden"]); +}, nv = /* @__PURE__ */ new Set(["none", "hidden"]); function DQ(t, e) { - return rv.has(t) ? (r) => r <= 0 ? t : e : (r) => r >= 1 ? e : t; + return nv.has(t) ? (r) => r <= 0 ? t : e : (r) => r >= 1 ? e : t; } function OQ(t, e) { return (r) => Qr(t, e, r); } -function Ub(t) { - return typeof t == "number" ? OQ : typeof t == "string" ? Ob(t) ? v0 : Yn.test(t) ? a6 : kQ : Array.isArray(t) ? S7 : typeof t == "object" ? Yn.test(t) ? a6 : NQ : v0; +function qb(t) { + return typeof t == "number" ? OQ : typeof t == "string" ? Nb(t) ? v0 : Yn.test(t) ? c6 : kQ : Array.isArray(t) ? S7 : typeof t == "object" ? Yn.test(t) ? c6 : NQ : v0; } function S7(t, e) { - const r = [...t], n = r.length, i = t.map((s, o) => Ub(s)(s, e[o])); + const r = [...t], n = r.length, i = t.map((s, o) => qb(s)(s, e[o])); return (s) => { for (let o = 0; o < n; o++) r[o] = i[o](s); @@ -32033,7 +32042,7 @@ function S7(t, e) { function NQ(t, e) { const r = { ...t, ...e }, n = {}; for (const i in r) - t[i] !== void 0 && e[i] !== void 0 && (n[i] = Ub(t[i])(t[i], e[i])); + t[i] !== void 0 && e[i] !== void 0 && (n[i] = qb(t[i])(t[i], e[i])); return (i) => { for (const s in n) r[s] = n[s](i); @@ -32051,10 +32060,10 @@ function LQ(t, e) { } const kQ = (t, e) => { const r = _a.createTransformer(e), n = Tl(t), i = Tl(e); - return n.indexes.var.length === i.indexes.var.length && n.indexes.color.length === i.indexes.color.length && n.indexes.number.length >= i.indexes.number.length ? rv.has(t) && !i.values.length || rv.has(e) && !n.values.length ? DQ(t, e) : Ro(S7(LQ(n, i), i.values), r) : (Ku(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), v0(t, e)); + return n.indexes.var.length === i.indexes.var.length && n.indexes.color.length === i.indexes.color.length && n.indexes.number.length >= i.indexes.number.length ? nv.has(t) && !i.values.length || nv.has(e) && !n.values.length ? DQ(t, e) : Ro(S7(LQ(n, i), i.values), r) : (Ku(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), v0(t, e)); }; function A7(t, e, r) { - return typeof t == "number" && typeof e == "number" && typeof r == "number" ? Qr(t, e, r) : Ub(t)(t, e); + return typeof t == "number" && typeof e == "number" && typeof r == "number" ? Qr(t, e, r) : qb(t)(t, e); } function $Q(t, e, r) { const n = [], i = r || A7, s = t.length - 1; @@ -32103,7 +32112,7 @@ function qQ(t, e) { return t.map(() => e || E7).splice(0, t.length - 1); } function b0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" }) { - const i = MQ(n) ? n.map(s6) : s6(n), s = { + const i = MQ(n) ? n.map(o6) : o6(n), s = { done: !1, value: e[0] }, o = UQ( @@ -32119,14 +32128,14 @@ function b0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" } next: (u) => (s.value = a(u), s.done = u >= t, s) }; } -const c6 = 2e4; +const u6 = 2e4; function zQ(t) { let e = 0; const r = 50; let n = t.next(e); - for (; !n.done && e < c6; ) + for (; !n.done && e < u6; ) e += r, n = t.next(e); - return e >= c6 ? 1 / 0 : e; + return e >= u6 ? 1 / 0 : e; } const WQ = (t) => { const e = ({ timestamp: r }) => t(r); @@ -32140,13 +32149,13 @@ const WQ = (t) => { now: () => Fn.isProcessing ? Fn.timestamp : Ys.now() }; }, HQ = { - decay: n6, - inertia: n6, + decay: i6, + inertia: i6, tween: b0, keyframes: b0, spring: _7 }, KQ = (t) => t / 100; -class qb extends y7 { +class zb extends y7 { constructor(e) { super(e), this.holdTime = null, this.cancelTime = null, this.currentTime = 0, this.playbackSpeed = 1, this.pendingPlayState = "running", this.startTime = null, this.state = "idle", this.stop = () => { if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle") @@ -32155,14 +32164,14 @@ class qb extends y7 { const { onStop: u } = this.options; u && u(); }; - const { name: r, motionValue: n, element: i, keyframes: s } = this.options, o = (i == null ? void 0 : i.KeyframeResolver) || Nb, a = (u, l) => this.onKeyframesResolved(u, l); + const { name: r, motionValue: n, element: i, keyframes: s } = this.options, o = (i == null ? void 0 : i.KeyframeResolver) || Lb, a = (u, l) => this.onKeyframesResolved(u, l); this.resolver = new o(s, a, r, n, i), this.resolver.scheduleResolve(); } flatten() { super.flatten(), this._resolved && Object.assign(this._resolved, this.initPlayback(this._resolved.keyframes)); } initPlayback(e) { - const { type: r = "keyframes", repeat: n = 0, repeatDelay: i = 0, repeatType: s, velocity: o = 0 } = this.options, a = Fb(r) ? r : HQ[r] || b0; + const { type: r = "keyframes", repeat: n = 0, repeatDelay: i = 0, repeatType: s, velocity: o = 0 } = this.options, a = jb(r) ? r : HQ[r] || b0; let u, l; a !== b0 && typeof e[0] != "number" && (process.env.NODE_ENV !== "production" && Uo(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), u = Ro(KQ, A7(e[0], e[1])), e = [0, 100]); const d = a({ ...this.options, keyframes: e }); @@ -32284,7 +32293,7 @@ const VQ = /* @__PURE__ */ new Set([ r += t(Iu(0, n - 1, i)) + ", "; return `linear(${r.substring(0, r.length - 2)})`; }; -function zb(t) { +function Wb(t) { let e; return () => (e === void 0 && (e = t()), e); } @@ -32292,7 +32301,7 @@ const JQ = { linearEasing: void 0 }; function XQ(t, e) { - const r = zb(t); + const r = Wb(t); return () => { var n; return (n = JQ[e]) !== null && n !== void 0 ? n : r(); @@ -32307,9 +32316,9 @@ const y0 = /* @__PURE__ */ XQ(() => { return !0; }, "linearEasing"); function P7(t) { - return !!(typeof t == "function" && y0() || !t || typeof t == "string" && (t in nv || y0()) || jb(t) || Array.isArray(t) && t.every(P7)); + return !!(typeof t == "function" && y0() || !t || typeof t == "string" && (t in iv || y0()) || Ub(t) || Array.isArray(t) && t.every(P7)); } -const jf = ([t, e, r, n]) => `cubic-bezier(${t}, ${e}, ${r}, ${n})`, nv = { +const jf = ([t, e, r, n]) => `cubic-bezier(${t}, ${e}, ${r}, ${n})`, iv = { linear: "linear", ease: "ease", easeIn: "ease-in", @@ -32322,7 +32331,7 @@ const jf = ([t, e, r, n]) => `cubic-bezier(${t}, ${e}, ${r}, ${n})`, nv = { }; function M7(t, e) { if (t) - return typeof t == "function" && y0() ? YQ(t, e) : jb(t) ? jf(t) : Array.isArray(t) ? t.map((r) => M7(r, e) || nv.easeOut) : nv[t]; + return typeof t == "function" && y0() ? YQ(t, e) : Ub(t) ? jf(t) : Array.isArray(t) ? t.map((r) => M7(r, e) || iv.easeOut) : iv[t]; } function ZQ(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatType: o = "loop", ease: a = "easeInOut", times: u } = {}) { const l = { [e]: r }; @@ -32337,15 +32346,15 @@ function ZQ(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatTyp direction: o === "reverse" ? "alternate" : "normal" }); } -function u6(t, e) { +function f6(t, e) { t.timeline = e, t.onfinish = null; } -const QQ = /* @__PURE__ */ zb(() => Object.hasOwnProperty.call(Element.prototype, "animate")), w0 = 10, eee = 2e4; +const QQ = /* @__PURE__ */ Wb(() => Object.hasOwnProperty.call(Element.prototype, "animate")), w0 = 10, eee = 2e4; function tee(t) { - return Fb(t.type) || t.type === "spring" || !P7(t.ease); + return jb(t.type) || t.type === "spring" || !P7(t.ease); } function ree(t, e) { - const r = new qb({ + const r = new zb({ ...e, keyframes: t, repeat: 0, @@ -32372,7 +32381,7 @@ const I7 = { function nee(t) { return t in I7; } -class f6 extends y7 { +class l6 extends y7 { constructor(e) { super(e); const { name: r, motionValue: n, element: i, keyframes: s } = this.options; @@ -32388,7 +32397,7 @@ class f6 extends y7 { e = B.keyframes, e.length === 1 && (e[1] = e[0]), i = B.duration, s = B.times, o = B.ease, a = "keyframes"; } const p = ZQ(u.owner.current, l, e, { ...this.options, duration: i, times: s, ease: o }); - return p.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (u6(p, this.pendingTimeline), this.pendingTimeline = void 0) : p.onfinish = () => { + return p.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (f6(p, this.pendingTimeline), this.pendingTimeline = void 0) : p.onfinish = () => { const { onComplete: w } = this.options; u.set(wp(e, this.options, r)), w && w(), this.cancel(), this.resolveFinishedPromise(); }, { @@ -32461,7 +32470,7 @@ class f6 extends y7 { if (!r) return Un; const { animation: n } = r; - u6(n, e); + f6(n, e); } return Un; } @@ -32492,7 +32501,7 @@ class f6 extends y7 { if (r.playState === "idle" || r.playState === "finished") return; if (this.time) { - const { motionValue: l, onUpdate: d, onComplete: p, element: w, ...A } = this.options, M = new qb({ + const { motionValue: l, onUpdate: d, onComplete: p, element: w, ...A } = this.options, M = new zb({ ...A, keyframes: n, duration: i, @@ -32523,7 +32532,7 @@ class f6 extends y7 { !r.owner.getProps().onUpdate && !i && s !== "mirror" && o !== 0 && a !== "inertia"; } } -const iee = zb(() => window.ScrollTimeline !== void 0); +const iee = Wb(() => window.ScrollTimeline !== void 0); class see { constructor(e) { this.stop = () => this.runAll("stop"), this.animations = e.filter(Boolean); @@ -32592,8 +32601,8 @@ class see { function oee({ when: t, delay: e, delayChildren: r, staggerChildren: n, staggerDirection: i, repeat: s, repeatType: o, repeatDelay: a, from: u, elapsed: l, ...d }) { return !!Object.keys(d).length; } -const Wb = (t, e, r, n = {}, i, s) => (o) => { - const a = Tb(n, t) || {}, u = a.delay || n.delay || 0; +const Hb = (t, e, r, n = {}, i, s) => (o) => { + const a = Rb(n, t) || {}, u = a.delay || n.delay || 0; let { elapsed: l = 0 } = n; l = l - Vs(u); let d = { @@ -32624,21 +32633,21 @@ const Wb = (t, e, r, n = {}, i, s) => (o) => { d.onUpdate(w), d.onComplete(); }), new see([]); } - return !s && f6.supports(d) ? new f6(d) : new qb(d); -}, aee = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), cee = (t) => J1(t) ? t[t.length - 1] || 0 : t; -function Hb(t, e) { + return !s && l6.supports(d) ? new l6(d) : new zb(d); +}, aee = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), cee = (t) => X1(t) ? t[t.length - 1] || 0 : t; +function Kb(t, e) { t.indexOf(e) === -1 && t.push(e); } -function Kb(t, e) { +function Vb(t, e) { const r = t.indexOf(e); r > -1 && t.splice(r, 1); } -class Vb { +class Gb { constructor() { this.subscriptions = []; } add(e) { - return Hb(this.subscriptions, e), () => Kb(this.subscriptions, e); + return Kb(this.subscriptions, e), () => Vb(this.subscriptions, e); } notify(e, r, n) { const i = this.subscriptions.length; @@ -32658,7 +32667,7 @@ class Vb { this.subscriptions.length = 0; } } -const l6 = 30, uee = (t) => !isNaN(parseFloat(t)); +const h6 = 30, uee = (t) => !isNaN(parseFloat(t)); class fee { /** * @param init - The initiating value @@ -32724,7 +32733,7 @@ class fee { return process.env.NODE_ENV !== "production" && vp(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e); } on(e, r) { - this.events[e] || (this.events[e] = new Vb()); + this.events[e] || (this.events[e] = new Gb()); const n = this.events[e].add(r); return e === "change" ? () => { n(), Lr.read(() => { @@ -32797,9 +32806,9 @@ class fee { */ getVelocity() { const e = Ys.now(); - if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > l6) + if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > h6) return 0; - const r = Math.min(this.updatedAt - this.prevUpdatedAt, l6); + const r = Math.min(this.updatedAt - this.prevUpdatedAt, h6); return w7(parseFloat(this.current) - parseFloat(this.prevFrameValue), r); } /** @@ -32868,7 +32877,7 @@ function hee(t, e) { lee(t, o, a); } } -const Gb = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), dee = "framerAppearId", C7 = "data-" + Gb(dee); +const Yb = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), dee = "framerAppearId", C7 = "data-" + Yb(dee); function T7(t) { return t.props[C7]; } @@ -32876,7 +32885,7 @@ const Xn = (t) => !!(t && t.getVelocity); function pee(t) { return !!(Xn(t) && t.add); } -function iv(t, e) { +function sv(t, e) { const r = t.getValue("willChange"); if (pee(r)) return r.add(e); @@ -32896,7 +32905,7 @@ function R7(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { continue; const M = { delay: r, - ...Tb(o || {}, p) + ...Rb(o || {}, p) }; let N = !1; if (window.MotionHandoffAnimation) { @@ -32906,7 +32915,7 @@ function R7(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { $ !== null && (M.startTime = $, N = !0); } } - iv(t, p), w.start(Wb(p, w, A, t.shouldReduceMotion && Ac.has(p) ? { type: !1 } : M, t, N)); + sv(t, p), w.start(Hb(p, w, A, t.shouldReduceMotion && Ac.has(p) ? { type: !1 } : M, t, N)); const L = w.animation; L && l.push(L); } @@ -32916,7 +32925,7 @@ function R7(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { }); }), l; } -function sv(t, e, r = {}) { +function ov(t, e, r = {}) { var n; const i = yp(t, e, r.type === "exit" ? (n = t.presenceContext) === null || n === void 0 ? void 0 : n.custom : void 0); let { transition: s = t.getDefaultTransition() || {} } = i || {}; @@ -32934,7 +32943,7 @@ function sv(t, e, r = {}) { function mee(t, e, r = 0, n = 0, i = 1, s) { const o = [], a = (t.variantChildren.size - 1) * n, u = i === 1 ? (l = 0) => l * n : (l = 0) => a - l * n; return Array.from(t.variantChildren).sort(vee).forEach((l, d) => { - l.notify("AnimationStart", e), o.push(sv(l, e, { + l.notify("AnimationStart", e), o.push(ov(l, e, { ...s, delay: r + u(d) }).then(() => l.notify("AnimationComplete", e))); @@ -32947,10 +32956,10 @@ function bee(t, e, r = {}) { t.notify("AnimationStart", e); let n; if (Array.isArray(e)) { - const i = e.map((s) => sv(t, s, r)); + const i = e.map((s) => ov(t, s, r)); n = Promise.all(i); } else if (typeof e == "string") - n = sv(t, e, r); + n = ov(t, e, r); else { const i = typeof e == "function" ? yp(t, e, r.custom) : e; n = Promise.all(R7(t, i, r)); @@ -32959,7 +32968,7 @@ function bee(t, e, r = {}) { t.notify("AnimationComplete", e); }); } -const yee = Cb.length; +const yee = Tb.length; function D7(t) { if (!t) return; @@ -32969,17 +32978,17 @@ function D7(t) { } const e = {}; for (let r = 0; r < yee; r++) { - const n = Cb[r], i = t.props[n]; + const n = Tb[r], i = t.props[n]; (Il(i) || i === !1) && (e[n] = i); } return e; } -const wee = [...Ib].reverse(), xee = Ib.length; +const wee = [...Cb].reverse(), xee = Cb.length; function _ee(t) { return (e) => Promise.all(e.map(({ animation: r, options: n }) => bee(t, r, n))); } function Eee(t) { - let e = _ee(t), r = h6(), n = !0; + let e = _ee(t), r = d6(), n = !0; const i = (u) => (l, d) => { var p; const w = yp(t, d, u === "exit" ? (p = t.presenceContext) === null || p === void 0 ? void 0 : p.custom : void 0); @@ -33024,7 +33033,7 @@ function Eee(t) { if (A.hasOwnProperty(x)) continue; let v = !1; - J1(_) && J1(E) ? v = !VS(_, E) : v = _ !== E, v ? _ != null ? f(x) : w.add(x) : _ !== void 0 && w.has(x) ? f(x) : $.protectedKeys[x] = !0; + X1(_) && X1(E) ? v = !VS(_, E) : v = _ !== E, v ? _ != null ? f(x) : w.add(x) : _ !== void 0 && w.has(x) ? f(x) : $.protectedKeys[x] = !0; } $.prevProp = H, $.prevResolvedValues = Y, $.isActive && (A = { ...A, ...Y }), n && t.blockInitialAnimation && (K = !1), K && (!(te && R) || ge) && p.push(...Ee.map((x) => ({ animation: x, @@ -33060,7 +33069,7 @@ function Eee(t) { setAnimateFunction: s, getState: () => r, reset: () => { - r = h6(), n = !0; + r = d6(), n = !0; } }; } @@ -33075,7 +33084,7 @@ function Va(t = !1) { prevResolvedValues: {} }; } -function h6() { +function d6() { return { animate: Va(!0), whileInView: Va(), @@ -33165,9 +33174,9 @@ function Mo(t, e, r, n = { passive: !0 }) { function Do(t, e, r, n) { return Mo(t, e, Cee(r), n); } -const d6 = (t, e) => Math.abs(t - e); +const p6 = (t, e) => Math.abs(t - e); function Tee(t, e) { - const r = d6(t.x, e.x), n = d6(t.y, e.y); + const r = p6(t.x, e.x), n = p6(t.y, e.y); return Math.sqrt(r ** 2 + n ** 2); } class N7 { @@ -33209,14 +33218,14 @@ class N7 { function $m(t, e) { return e ? { point: e(t.point) } : t; } -function p6(t, e) { +function g6(t, e) { return { x: t.x - e.x, y: t.y - e.y }; } function Bm({ point: t }, e) { return { point: t, - delta: p6(t, L7(e)), - offset: p6(t, Ree(e)), + delta: g6(t, L7(e)), + offset: g6(t, Ree(e)), velocity: Dee(e, 0.1) }; } @@ -33253,15 +33262,15 @@ function k7(t) { return e === null ? (e = t, r) : !1; }; } -const g6 = k7("dragHorizontal"), m6 = k7("dragVertical"); +const m6 = k7("dragHorizontal"), v6 = k7("dragVertical"); function $7(t) { let e = !1; if (t === "y") - e = m6(); + e = v6(); else if (t === "x") - e = g6(); + e = m6(); else { - const r = g6(), n = m6(); + const r = m6(), n = v6(); r && n ? e = () => { r(), n(); } : (r && r(), n && n()); @@ -33282,28 +33291,28 @@ function Li(t) { function $ee(t, e, r) { return Math.abs(t - e) <= r; } -function v6(t, e, r, n = 0.5) { +function b6(t, e, r, n = 0.5) { t.origin = n, t.originPoint = Qr(e.min, e.max, t.origin), t.scale = Li(r) / Li(e), t.translate = Qr(r.min, r.max, t.origin) - t.originPoint, (t.scale >= Oee && t.scale <= Nee || isNaN(t.scale)) && (t.scale = 1), (t.translate >= Lee && t.translate <= kee || isNaN(t.translate)) && (t.translate = 0); } function Jf(t, e, r, n) { - v6(t.x, e.x, r.x, n ? n.originX : void 0), v6(t.y, e.y, r.y, n ? n.originY : void 0); + b6(t.x, e.x, r.x, n ? n.originX : void 0), b6(t.y, e.y, r.y, n ? n.originY : void 0); } -function b6(t, e, r) { +function y6(t, e, r) { t.min = r.min + e.min, t.max = t.min + Li(e); } function Bee(t, e, r) { - b6(t.x, e.x, r.x), b6(t.y, e.y, r.y); + y6(t.x, e.x, r.x), y6(t.y, e.y, r.y); } -function y6(t, e, r) { +function w6(t, e, r) { t.min = e.min - r.min, t.max = t.min + Li(e); } function Xf(t, e, r) { - y6(t.x, e.x, r.x), y6(t.y, e.y, r.y); + w6(t.x, e.x, r.x), w6(t.y, e.y, r.y); } function Fee(t, { min: e, max: r }, n) { return e !== void 0 && t < e ? t = n ? Qr(e, t, n.min) : Math.max(t, e) : r !== void 0 && t > r && (t = n ? Qr(r, t, n.max) : Math.min(t, r)), t; } -function w6(t, e, r) { +function x6(t, e, r) { return { min: e !== void 0 ? t.min + e : void 0, max: r !== void 0 ? t.max + r - (t.max - t.min) : void 0 @@ -33311,18 +33320,18 @@ function w6(t, e, r) { } function jee(t, { top: e, left: r, bottom: n, right: i }) { return { - x: w6(t.x, r, i), - y: w6(t.y, e, n) + x: x6(t.x, r, i), + y: x6(t.y, e, n) }; } -function x6(t, e) { +function _6(t, e) { let r = e.min - t.min, n = e.max - t.max; return e.max - e.min < t.max - t.min && ([r, n] = [n, r]), { min: r, max: n }; } function Uee(t, e) { return { - x: x6(t.x, e.x), - y: x6(t.y, e.y) + x: _6(t.x, e.x), + y: _6(t.y, e.y) }; } function qee(t, e) { @@ -33334,33 +33343,33 @@ function zee(t, e) { const r = {}; return e.min !== void 0 && (r.min = e.min - t.min), e.max !== void 0 && (r.max = e.max - t.min), r; } -const ov = 0.35; -function Wee(t = ov) { - return t === !1 ? t = 0 : t === !0 && (t = ov), { - x: _6(t, "left", "right"), - y: _6(t, "top", "bottom") +const av = 0.35; +function Wee(t = av) { + return t === !1 ? t = 0 : t === !0 && (t = av), { + x: E6(t, "left", "right"), + y: E6(t, "top", "bottom") }; } -function _6(t, e, r) { +function E6(t, e, r) { return { - min: E6(t, e), - max: E6(t, r) + min: S6(t, e), + max: S6(t, r) }; } -function E6(t, e) { +function S6(t, e) { return typeof t == "number" ? t : t[e] || 0; } -const S6 = () => ({ +const A6 = () => ({ translate: 0, scale: 1, origin: 0, originPoint: 0 }), ru = () => ({ - x: S6(), - y: S6() -}), A6 = () => ({ min: 0, max: 0 }), ln = () => ({ x: A6(), y: A6() +}), P6 = () => ({ min: 0, max: 0 }), ln = () => ({ + x: P6(), + y: P6() }); function Xi(t) { return [t("x"), t("y")]; @@ -33388,32 +33397,32 @@ function Kee(t, e) { function Fm(t) { return t === void 0 || t === 1; } -function av({ scale: t, scaleX: e, scaleY: r }) { +function cv({ scale: t, scaleX: e, scaleY: r }) { return !Fm(t) || !Fm(e) || !Fm(r); } function Ya(t) { - return av(t) || q7(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY; + return cv(t) || q7(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY; } function q7(t) { - return P6(t.x) || P6(t.y); + return M6(t.x) || M6(t.y); } -function P6(t) { +function M6(t) { return t && t !== "0%"; } function x0(t, e, r) { const n = t - r, i = e * n; return r + i; } -function M6(t, e, r, n, i) { +function I6(t, e, r, n, i) { return i !== void 0 && (t = x0(t, i, n)), x0(t, r, n) + e; } -function cv(t, e = 0, r = 1, n, i) { - t.min = M6(t.min, e, r, n, i), t.max = M6(t.max, e, r, n, i); +function uv(t, e = 0, r = 1, n, i) { + t.min = I6(t.min, e, r, n, i), t.max = I6(t.max, e, r, n, i); } function z7(t, { x: e, y: r }) { - cv(t.x, e.translate, e.scale, e.originPoint), cv(t.y, r.translate, r.scale, r.originPoint); + uv(t.x, e.translate, e.scale, e.originPoint), uv(t.y, r.translate, r.scale, r.originPoint); } -const I6 = 0.999999999999, C6 = 1.0000000000001; +const C6 = 0.999999999999, T6 = 1.0000000000001; function Vee(t, e, r, n = !1) { const i = r.length; if (!i) @@ -33428,17 +33437,17 @@ function Vee(t, e, r, n = !1) { y: -s.scroll.offset.y }), o && (e.x *= o.x.scale, e.y *= o.y.scale, z7(t, o)), n && Ya(s.latestValues) && iu(t, s.latestValues)); } - e.x < C6 && e.x > I6 && (e.x = 1), e.y < C6 && e.y > I6 && (e.y = 1); + e.x < T6 && e.x > C6 && (e.x = 1), e.y < T6 && e.y > C6 && (e.y = 1); } function nu(t, e) { t.min = t.min + e, t.max = t.max + e; } -function T6(t, e, r, n, i = 0.5) { +function R6(t, e, r, n, i = 0.5) { const s = Qr(t.min, t.max, i); - cv(t, e, r, s, n); + uv(t, e, r, s, n); } function iu(t, e) { - T6(t.x, e.x, e.scaleX, e.scale, e.originX), T6(t.y, e.y, e.scaleY, e.scale, e.originY); + R6(t.x, e.x, e.scaleX, e.scale, e.originX), R6(t.y, e.y, e.scaleY, e.scale, e.originY); } function W7(t, e) { return U7(Kee(t.getBoundingClientRect(), e)); @@ -33473,7 +33482,7 @@ class Jee { } } this.originPoint[L] = B; - }), M && Lr.postRender(() => M(d, p)), iv(this.visualElement, "transform"); + }), M && Lr.postRender(() => M(d, p)), sv(this.visualElement, "transform"); const { animationState: N } = this.visualElement; N && N.setActive("whileDrag", !0); }, o = (d, p) => { @@ -33573,7 +33582,7 @@ class Jee { } startAxisValueAnimation(e, r) { const n = this.getAxisMotionValue(e); - return iv(this.visualElement, e), n.start(Wb(e, n, 0, r, this.visualElement, !1)); + return sv(this.visualElement, e), n.start(Hb(e, n, 0, r, this.visualElement, !1)); } stopAnimation() { Xi((e) => this.getAxisMotionValue(e).stop()); @@ -33661,7 +33670,7 @@ class Jee { }; } getProps() { - const e = this.visualElement.getProps(), { drag: r = !1, dragDirectionLock: n = !1, dragPropagation: i = !1, dragConstraints: s = !1, dragElastic: o = ov, dragMomentum: a = !0 } = e; + const e = this.visualElement.getProps(), { drag: r = !1, dragDirectionLock: n = !1, dragPropagation: i = !1, dragConstraints: s = !1, dragElastic: o = av, dragMomentum: a = !0 } = e; return { ...e, drag: r, @@ -33692,7 +33701,7 @@ class Zee extends Ra { this.removeGroupControls(), this.removeListeners(); } } -const R6 = (t) => (e, r) => { +const D6 = (t) => (e, r) => { t && Lr.postRender(() => t(e, r)); }; class Qee extends Ra { @@ -33708,8 +33717,8 @@ class Qee extends Ra { createPanHandlers() { const { onPanSessionStart: e, onPanStart: r, onPan: n, onPanEnd: i } = this.node.getProps(); return { - onSessionStart: R6(e), - onStart: R6(r), + onSessionStart: D6(e), + onStart: D6(r), onMove: n, onEnd: (s, o) => { delete this.session, i && Lr.postRender(() => i(s, o)); @@ -33731,12 +33740,12 @@ function ete() { const t = Tn(_p); if (t === null) return [!0, null]; - const { isPresent: e, onExitComplete: r, register: n } = t, i = mv(); + const { isPresent: e, onExitComplete: r, register: n } = t, i = vv(); Dn(() => n(i), []); - const s = vv(() => r && r(i), [i, r]); + const s = bv(() => r && r(i), [i, r]); return !e && r ? [!1, s] : [!0]; } -const Yb = Sa({}), K7 = Sa({}), jd = { +const Jb = Sa({}), K7 = Sa({}), jd = { /** * Global flag as to whether the tree has animated since the last time * we resized the window @@ -33748,7 +33757,7 @@ const Yb = Sa({}), K7 = Sa({}), jd = { */ hasEverUpdated: !1 }; -function D6(t, e) { +function O6(t, e) { return e.max === e.min ? 0 : t / (e.max - e.min) * 100; } const Of = { @@ -33760,7 +33769,7 @@ const Of = { t = parseFloat(t); else return t; - const r = D6(t, e.target.x), n = D6(t, e.target.y); + const r = O6(t, e.target.x), n = O6(t, e.target.y); return `${r}% ${n}%`; } }, tte = { @@ -33777,7 +33786,7 @@ const Of = { function rte(t) { Object.assign(_0, t); } -const { schedule: Jb } = GS(queueMicrotask, !1); +const { schedule: Xb } = GS(queueMicrotask, !1); class nte extends kR { /** * This only mounts projection nodes for components that @@ -33802,7 +33811,7 @@ class nte extends kR { } componentDidUpdate() { const { projection: e } = this.props.visualElement; - e && (e.root.didUpdate(), Jb.postRender(() => { + e && (e.root.didUpdate(), Xb.postRender(() => { !e.currentAnimation && e.isLead() && this.safeToRemove(); })); } @@ -33819,7 +33828,7 @@ class nte extends kR { } } function V7(t) { - const [e, r] = ete(), n = Tn(Yb); + const [e, r] = ete(), n = Tn(Jb); return pe.jsx(nte, { ...t, layoutGroup: n, switchLayoutGroup: Tn(K7), isPresent: e, safeToRemove: r }); } const ite = { @@ -33837,7 +33846,7 @@ const ite = { borderBottomLeftRadius: Of, borderBottomRightRadius: Of, boxShadow: tte -}, G7 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], ste = G7.length, O6 = (t) => typeof t == "string" ? parseFloat(t) : t, N6 = (t) => typeof t == "number" || Vt.test(t); +}, G7 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], ste = G7.length, N6 = (t) => typeof t == "string" ? parseFloat(t) : t, L6 = (t) => typeof t == "number" || Vt.test(t); function ote(t, e, r, n, i, s) { i ? (t.opacity = Qr( 0, @@ -33847,67 +33856,67 @@ function ote(t, e, r, n, i, s) { ), t.opacityExit = Qr(e.opacity !== void 0 ? e.opacity : 1, 0, cte(n))) : s && (t.opacity = Qr(e.opacity !== void 0 ? e.opacity : 1, r.opacity !== void 0 ? r.opacity : 1, n)); for (let o = 0; o < ste; o++) { const a = `border${G7[o]}Radius`; - let u = L6(e, a), l = L6(r, a); + let u = k6(e, a), l = k6(r, a); if (u === void 0 && l === void 0) continue; - u || (u = 0), l || (l = 0), u === 0 || l === 0 || N6(u) === N6(l) ? (t[a] = Math.max(Qr(O6(u), O6(l), n), 0), (Gs.test(l) || Gs.test(u)) && (t[a] += "%")) : t[a] = l; + u || (u = 0), l || (l = 0), u === 0 || l === 0 || L6(u) === L6(l) ? (t[a] = Math.max(Qr(N6(u), N6(l), n), 0), (Gs.test(l) || Gs.test(u)) && (t[a] += "%")) : t[a] = l; } (e.rotate || r.rotate) && (t.rotate = Qr(e.rotate || 0, r.rotate || 0, n)); } -function L6(t, e) { +function k6(t, e) { return t[e] !== void 0 ? t[e] : t.borderRadius; } const ate = /* @__PURE__ */ Y7(0, 0.5, t7), cte = /* @__PURE__ */ Y7(0.5, 0.95, Un); function Y7(t, e, r) { return (n) => n < t ? 0 : n > e ? 1 : r(Iu(t, e, n)); } -function k6(t, e) { +function $6(t, e) { t.min = e.min, t.max = e.max; } function Yi(t, e) { - k6(t.x, e.x), k6(t.y, e.y); + $6(t.x, e.x), $6(t.y, e.y); } -function $6(t, e) { +function B6(t, e) { t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin; } -function B6(t, e, r, n, i) { +function F6(t, e, r, n, i) { return t -= e, t = x0(t, 1 / r, n), i !== void 0 && (t = x0(t, 1 / i, n)), t; } function ute(t, e = 0, r = 1, n = 0.5, i, s = t, o = t) { if (Gs.test(e) && (e = parseFloat(e), e = Qr(o.min, o.max, e / 100) - o.min), typeof e != "number") return; let a = Qr(s.min, s.max, n); - t === s && (a -= e), t.min = B6(t.min, e, r, a, i), t.max = B6(t.max, e, r, a, i); + t === s && (a -= e), t.min = F6(t.min, e, r, a, i), t.max = F6(t.max, e, r, a, i); } -function F6(t, e, [r, n, i], s, o) { +function j6(t, e, [r, n, i], s, o) { ute(t, e[r], e[n], e[i], e.scale, s, o); } const fte = ["x", "scaleX", "originX"], lte = ["y", "scaleY", "originY"]; -function j6(t, e, r, n) { - F6(t.x, e, fte, r ? r.x : void 0, n ? n.x : void 0), F6(t.y, e, lte, r ? r.y : void 0, n ? n.y : void 0); +function U6(t, e, r, n) { + j6(t.x, e, fte, r ? r.x : void 0, n ? n.x : void 0), j6(t.y, e, lte, r ? r.y : void 0, n ? n.y : void 0); } -function U6(t) { +function q6(t) { return t.translate === 0 && t.scale === 1; } function J7(t) { - return U6(t.x) && U6(t.y); + return q6(t.x) && q6(t.y); } -function q6(t, e) { +function z6(t, e) { return t.min === e.min && t.max === e.max; } function hte(t, e) { - return q6(t.x, e.x) && q6(t.y, e.y); + return z6(t.x, e.x) && z6(t.y, e.y); } -function z6(t, e) { +function W6(t, e) { return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max); } function X7(t, e) { - return z6(t.x, e.x) && z6(t.y, e.y); + return W6(t.x, e.x) && W6(t.y, e.y); } -function W6(t) { +function H6(t) { return Li(t.x) / Li(t.y); } -function H6(t, e) { +function K6(t, e) { return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint; } class dte { @@ -33915,10 +33924,10 @@ class dte { this.members = []; } add(e) { - Hb(this.members, e), e.scheduleRender(); + Kb(this.members, e), e.scheduleRender(); } remove(e) { - if (Kb(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) { + if (Vb(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) { const r = this.members[this.members.length - 1]; r && this.promote(r); } @@ -33980,10 +33989,10 @@ class mte { this.children = [], this.isDirty = !1; } add(e) { - Hb(this.children, e), this.isDirty = !0; + Kb(this.children, e), this.isDirty = !0; } remove(e) { - Kb(this.children, e), this.isDirty = !0; + Vb(this.children, e), this.isDirty = !0; } forEach(e) { this.isDirty && this.children.sort(gte), this.isDirty = !1, this.children.forEach(e); @@ -34005,14 +34014,14 @@ function bte(t) { } function yte(t, e, r) { const n = Xn(t) ? t : Rl(t); - return n.start(Wb("", n, e, r)), n.animation; + return n.start(Hb("", n, e, r)), n.animation; } const Ja = { type: "projectionFrame", totalNodes: 0, resolvedTargetDeltas: 0, recalculatedProjection: 0 -}, Uf = typeof window < "u" && window.MotionDebug !== void 0, jm = ["", "X", "Y", "Z"], wte = { visibility: "hidden" }, K6 = 1e3; +}, Uf = typeof window < "u" && window.MotionDebug !== void 0, jm = ["", "X", "Y", "Z"], wte = { visibility: "hidden" }, V6 = 1e3; let xte = 0; function Um(t, e, r, n) { const { latestValues: i } = e; @@ -34045,7 +34054,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.root === this && (this.nodes = new mte()); } addEventListener(o, a) { - return this.eventHandlers.has(o) || this.eventHandlers.set(o, new Vb()), this.eventHandlers.get(o).add(a); + return this.eventHandlers.has(o) || this.eventHandlers.set(o, new Gb()), this.eventHandlers.get(o).add(a); } notifyListeners(o, ...a) { const u = this.eventHandlers.get(o); @@ -34066,7 +34075,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check let p; const w = () => this.root.updateBlockedByResize = !1; t(o, () => { - this.root.updateBlockedByResize = !0, p && p(), p = vte(w, 250), jd.hasAnimatedSinceResize && (jd.hasAnimatedSinceResize = !1, this.nodes.forEach(G6)); + this.root.updateBlockedByResize = !0, p && p(), p = vte(w, 250), jd.hasAnimatedSinceResize && (jd.hasAnimatedSinceResize = !1, this.nodes.forEach(Y6)); }); } u && this.root.registerSharedNode(u, this), this.options.animate !== !1 && d && (u || l) && this.addEventListener("didUpdate", ({ delta: p, hasLayoutChanged: w, hasRelativeTargetChanged: A, layout: M }) => { @@ -34078,13 +34087,13 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || H || w && ($ || !this.currentAnimation)) { this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0), this.setAnimationOrigin(p, H); const W = { - ...Tb(N, "layout"), + ...Rb(N, "layout"), onPlay: L, onComplete: B }; (d.shouldReduceMotion || this.options.layoutRoot) && (W.delay = 0, W.type = !1), this.startAnimation(W); } else - w || G6(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete(); + w || Y6(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete(); this.targetLayout = M; }); } @@ -34134,7 +34143,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check } update() { if (this.updateScheduled = !1, this.isUpdateBlocked()) { - this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(V6); + this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(G6); return; } this.isUpdating || this.nodes.forEach(Mte), this.isUpdating = !1, this.nodes.forEach(Ite), this.nodes.forEach(_te), this.nodes.forEach(Ete), this.clearAllSnapshots(); @@ -34142,7 +34151,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check Fn.delta = xa(0, 1e3 / 60, a - Fn.timestamp), Fn.timestamp = a, Fn.isProcessing = !0, Dm.update.process(Fn), Dm.preRender.process(Fn), Dm.render.process(Fn), Fn.isProcessing = !1; } didUpdate() { - this.updateScheduled || (this.updateScheduled = !0, Jb.read(this.scheduleUpdate)); + this.updateScheduled || (this.updateScheduled = !0, Xb.read(this.scheduleUpdate)); } clearAllSnapshots() { this.nodes.forEach(Pte), this.sharedNodes.forEach(Dte); @@ -34244,11 +34253,11 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check const l = this.path[u]; if (!l.instance || !Ya(l.latestValues)) continue; - av(l.latestValues) && l.updateSnapshot(); + cv(l.latestValues) && l.updateSnapshot(); const d = ln(), p = l.measurePageBox(); - Yi(d, p), j6(a, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, d); + Yi(d, p), U6(a, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, d); } - return Ya(this.latestValues) && j6(a, this.latestValues), a; + return Ya(this.latestValues) && U6(a, this.latestValues), a; } setTargetDelta(o) { this.targetDelta = o, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0; @@ -34290,7 +34299,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check } } getClosestProjectingParent() { - if (!(!this.parent || av(this.parent.latestValues) || q7(this.parent.latestValues))) + if (!(!this.parent || cv(this.parent.latestValues) || q7(this.parent.latestValues))) return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent(); } isProjecting() { @@ -34313,7 +34322,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender()); return; } - !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : ($6(this.prevProjectionDelta.x, this.projectionDelta.x), $6(this.prevProjectionDelta.y, this.projectionDelta.y)), Jf(this.projectionDelta, this.layoutCorrected, M, this.latestValues), (this.treeScale.x !== w || this.treeScale.y !== A || !H6(this.projectionDelta.x, this.prevProjectionDelta.x) || !H6(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", M)), Uf && Ja.recalculatedProjection++; + !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (B6(this.prevProjectionDelta.x, this.projectionDelta.x), B6(this.prevProjectionDelta.y, this.projectionDelta.y)), Jf(this.projectionDelta, this.layoutCorrected, M, this.latestValues), (this.treeScale.x !== w || this.treeScale.y !== A || !K6(this.projectionDelta.x, this.prevProjectionDelta.x) || !K6(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", M)), Uf && Ja.recalculatedProjection++; } hide() { this.isVisible = !1; @@ -34340,12 +34349,12 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check let H; this.mixTargetDelta = (W) => { const V = W / 1e3; - Y6(p.x, o.x, V), Y6(p.y, o.y, V), this.setTargetDelta(p), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Xf(w, this.layout.layoutBox, this.relativeParent.layout.layoutBox), Ote(this.relativeTarget, this.relativeTargetOrigin, w, V), H && hte(this.relativeTarget, H) && (this.isProjectionDirty = !1), H || (H = ln()), Yi(H, this.relativeTarget)), N && (this.animationValues = d, ote(d, l, this.latestValues, V, $, B)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V; + J6(p.x, o.x, V), J6(p.y, o.y, V), this.setTargetDelta(p), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Xf(w, this.layout.layoutBox, this.relativeParent.layout.layoutBox), Ote(this.relativeTarget, this.relativeTargetOrigin, w, V), H && hte(this.relativeTarget, H) && (this.isProjectionDirty = !1), H || (H = ln()), Yi(H, this.relativeTarget)), N && (this.animationValues = d, ote(d, l, this.latestValues, V, $, B)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V; }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0); } startAnimation(o) { this.notifyListeners("animationStart"), this.currentAnimation && this.currentAnimation.stop(), this.resumingFrom && this.resumingFrom.currentAnimation && this.resumingFrom.currentAnimation.stop(), this.pendingAnimation && (wa(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = Lr.update(() => { - jd.hasAnimatedSinceResize = !0, this.currentAnimation = yte(0, K6, { + jd.hasAnimatedSinceResize = !0, this.currentAnimation = yte(0, V6, { ...o, onUpdate: (a) => { this.mixTargetDelta(a), o.onUpdate && o.onUpdate(a); @@ -34362,7 +34371,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check o && o.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete"); } finishAnimation() { - this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(K6), this.currentAnimation.stop()), this.completeAnimation(); + this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(V6), this.currentAnimation.stop()), this.completeAnimation(); } applyTransformsToTarget() { const o = this.getLead(); @@ -34471,7 +34480,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.root.nodes.forEach((o) => { var a; return (a = o.currentAnimation) === null || a === void 0 ? void 0 : a.stop(); - }), this.root.nodes.forEach(V6), this.root.sharedNodes.clear(); + }), this.root.nodes.forEach(G6), this.root.sharedNodes.clear(); } }; } @@ -34531,7 +34540,7 @@ function Ate(t) { function Pte(t) { t.clearSnapshot(); } -function V6(t) { +function G6(t) { t.clearMeasurements(); } function Mte(t) { @@ -34541,7 +34550,7 @@ function Ite(t) { const { visualElement: e } = t.options; e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform(); } -function G6(t) { +function Y6(t) { t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0; } function Cte(t) { @@ -34556,14 +34565,14 @@ function Rte(t) { function Dte(t) { t.removeLeadSnapshot(); } -function Y6(t, e, r) { +function J6(t, e, r) { t.translate = Qr(e.translate, 0, r), t.scale = Qr(e.scale, 1, r), t.origin = e.origin, t.originPoint = e.originPoint; } -function J6(t, e, r, n) { +function X6(t, e, r, n) { t.min = Qr(e.min, r.min, n), t.max = Qr(e.max, r.max, n); } function Ote(t, e, r, n) { - J6(t.x, e.x, r.x, n), J6(t.y, e.y, r.y, n); + X6(t.x, e.x, r.x, n), X6(t.y, e.y, r.y, n); } function Nte(t) { return t.animationValues && t.animationValues.opacityExit !== void 0; @@ -34571,15 +34580,15 @@ function Nte(t) { const Lte = { duration: 0.45, ease: [0.4, 0, 0.1, 1] -}, X6 = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Z6 = X6("applewebkit/") && !X6("chrome/") ? Math.round : Un; -function Q6(t) { - t.min = Z6(t.min), t.max = Z6(t.max); +}, Z6 = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Q6 = Z6("applewebkit/") && !Z6("chrome/") ? Math.round : Un; +function e5(t) { + t.min = Q6(t.min), t.max = Q6(t.max); } function kte(t) { - Q6(t.x), Q6(t.y); + e5(t.x), e5(t.y); } function e9(t, e, r) { - return t === "position" || t === "preserve-aspect" && !$ee(W6(e), W6(r), 0.2); + return t === "position" || t === "preserve-aspect" && !$ee(H6(e), H6(r), 0.2); } function $te(t) { var e; @@ -34620,7 +34629,7 @@ const Bte = Q7({ MeasureLayout: V7 } }; -function e5(t, e) { +function t5(t, e) { const r = e ? "pointerenter" : "pointerleave", n = e ? "onHoverStart" : "onHoverEnd", i = (s, o) => { if (s.pointerType === "touch" || B7()) return; @@ -34635,7 +34644,7 @@ function e5(t, e) { } class jte extends Ra { mount() { - this.unmount = Ro(e5(this.node, !0), e5(this.node, !1)); + this.unmount = Ro(t5(this.node, !0), t5(this.node, !1)); } unmount() { } @@ -34729,8 +34738,8 @@ class qte extends Ra { this.removeStartListeners(), this.removeEndListeners(), this.removeAccessibleListeners(); } } -const uv = /* @__PURE__ */ new WeakMap(), Wm = /* @__PURE__ */ new WeakMap(), zte = (t) => { - const e = uv.get(t.target); +const fv = /* @__PURE__ */ new WeakMap(), Wm = /* @__PURE__ */ new WeakMap(), zte = (t) => { + const e = fv.get(t.target); e && e(t); }, Wte = (t) => { t.forEach(zte); @@ -34743,8 +34752,8 @@ function Hte({ root: t, ...e }) { } function Kte(t, e, r) { const n = Hte(e); - return uv.set(t, r), n.observe(t), () => { - uv.delete(t), n.unobserve(t); + return fv.set(t, r), n.observe(t), () => { + fv.delete(t), n.unobserve(t); }; } const Vte = { @@ -34804,14 +34813,14 @@ const Jte = { ProjectionNode: t9, MeasureLayout: V7 } -}, Xb = Sa({ +}, Zb = Sa({ transformPagePoint: (t) => t, isStatic: !1, reducedMotion: "never" -}), Ep = Sa({}), Zb = typeof window < "u", n9 = Zb ? $R : Dn, i9 = Sa({ strict: !1 }); +}), Ep = Sa({}), Qb = typeof window < "u", n9 = Qb ? $R : Dn, i9 = Sa({ strict: !1 }); function Zte(t, e, r, n, i) { var s, o; - const { visualElement: a } = Tn(Ep), u = Tn(i9), l = Tn(_p), d = Tn(Xb).reducedMotion, p = Zn(); + const { visualElement: a } = Tn(Ep), u = Tn(i9), l = Tn(_p), d = Tn(Zb).reducedMotion, p = Zn(); n = n || u.renderer, !p.current && n && (p.current = n(t, { visualState: e, parent: a, @@ -34823,12 +34832,12 @@ function Zte(t, e, r, n, i) { const w = p.current, A = Tn(K7); w && !w.projection && i && (w.type === "html" || w.type === "svg") && Qte(p.current, r, i, A); const M = Zn(!1); - b5(() => { + y5(() => { w && M.current && w.update(r, l); }); const N = r[C7], L = Zn(!!N && !(!((s = window.MotionHandoffIsComplete) === null || s === void 0) && s.call(window, N)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, N))); return n9(() => { - w && (M.current = !0, window.MotionIsMounted = !0, w.updateFeatures(), Jb.render(w.render), L.current && w.animationState && w.animationState.animateChanges()); + w && (M.current = !0, window.MotionIsMounted = !0, w.updateFeatures(), Xb.render(w.render), L.current && w.animationState && w.animationState.animateChanges()); }), Dn(() => { w && (!L.current && w.animationState && w.animationState.animateChanges(), L.current && (queueMicrotask(() => { var B; @@ -34861,7 +34870,7 @@ function s9(t) { return t.options.allowProjection !== !1 ? t.projection : s9(t.parent); } function ere(t, e, r) { - return vv( + return bv( (n) => { n && t.mount && t.mount(n), e && (n ? e.mount(n) : e.unmount()), r && (typeof r == "function" ? r(n) : tu(r) && (r.current = n)); }, @@ -34874,7 +34883,7 @@ function ere(t, e, r) { ); } function Sp(t) { - return bp(t.animate) || Cb.some((e) => Il(t[e])); + return bp(t.animate) || Tb.some((e) => Il(t[e])); } function o9(t) { return !!(Sp(t) || t.variants); @@ -34891,12 +34900,12 @@ function tre(t, e) { } function rre(t) { const { initial: e, animate: r } = tre(t, Tn(Ep)); - return wi(() => ({ initial: e, animate: r }), [t5(e), t5(r)]); + return wi(() => ({ initial: e, animate: r }), [r5(e), r5(r)]); } -function t5(t) { +function r5(t) { return Array.isArray(t) ? t.join(" ") : t; } -const r5 = { +const n5 = { animation: [ "animate", "variants", @@ -34916,9 +34925,9 @@ const r5 = { inView: ["whileInView", "onViewportEnter", "onViewportLeave"], layout: ["layout", "layoutId"] }, Cu = {}; -for (const t in r5) +for (const t in n5) Cu[t] = { - isEnabled: (e) => r5[t].some((r) => !!e[r]) + isEnabled: (e) => n5[t].some((r) => !!e[r]) }; function nre(t) { for (const e in t) @@ -34933,22 +34942,22 @@ function sre({ preloadedFeatures: t, createVisualElement: e, useRender: r, useVi function s(a, u) { let l; const d = { - ...Tn(Xb), + ...Tn(Zb), ...a, layoutId: ore(a) }, { isStatic: p } = d, w = rre(a), A = n(a, p); - if (!p && Zb) { + if (!p && Qb) { are(d, t); const M = cre(d); l = M.MeasureLayout, w.visualElement = Zte(i, A, d, e, M.ProjectionNode); } return pe.jsxs(Ep.Provider, { value: w, children: [l && w.visualElement ? pe.jsx(l, { visualElement: w.visualElement, ...d }) : null, r(i, a, ere(A, w.visualElement, u), A, p, w.visualElement)] }); } - const o = gv(s); + const o = mv(s); return o[ire] = i, o; } function ore({ layoutId: t }) { - const e = Tn(Yb).id; + const e = Tn(Jb).id; return e && t !== void 0 ? e + "-" + t : t; } function are(t, e) { @@ -34995,7 +35004,7 @@ const ure = [ "use", "view" ]; -function Qb(t) { +function ey(t) { return ( /** * If it's not a string, it's a custom React component. Currently we only support @@ -35048,12 +35057,12 @@ const c9 = /* @__PURE__ */ new Set([ function u9(t, e, r, n) { a9(t, e, void 0, n); for (const i in e.attrs) - t.setAttribute(c9.has(i) ? i : Gb(i), e.attrs[i]); + t.setAttribute(c9.has(i) ? i : Yb(i), e.attrs[i]); } function f9(t, { layout: e, layoutId: r }) { return Ac.has(t) || t.startsWith("origin") || (e || r !== void 0) && (!!_0[t] || t === "opacity"); } -function ey(t, e, r) { +function ty(t, e, r) { var n; const { style: i } = t, s = {}; for (const o in i) @@ -35061,7 +35070,7 @@ function ey(t, e, r) { return s; } function l9(t, e, r) { - const n = ey(t, e, r); + const n = ty(t, e, r); for (const i in t) if (Xn(t[i]) || Xn(e[i])) { const s = ah.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i; @@ -35069,7 +35078,7 @@ function l9(t, e, r) { } return n; } -function ty(t) { +function ry(t) { const e = Zn(null); return e.current === null && (e.current = t()), e.current; } @@ -35082,7 +35091,7 @@ function fre({ scrapeMotionValuesFromProps: t, createRenderState: e, onMount: r } const h9 = (t) => (e, r) => { const n = Tn(Ep), i = Tn(_p), s = () => fre(t, e, n, i); - return r ? s() : ty(s); + return r ? s() : ry(s); }; function lre(t, e, r, n) { const i = {}, s = n(t, {}); @@ -35097,7 +35106,7 @@ function lre(t, e, r, n) { if (p && typeof p != "boolean" && !bp(p)) { const w = Array.isArray(p) ? p : [p]; for (let A = 0; A < w.length; A++) { - const M = Mb(t, w[A]); + const M = Ib(t, w[A]); if (M) { const { transitionEnd: N, transition: L, ...B } = M; for (const $ in B) { @@ -35115,13 +35124,13 @@ function lre(t, e, r, n) { } return i; } -const ry = () => ({ +const ny = () => ({ style: {}, transform: {}, transformOrigin: {}, vars: {} }), d9 = () => ({ - ...ry(), + ...ny(), attrs: {} }), p9 = (t, e) => e && typeof t == "number" ? e.transform(t) : t, hre = { x: "translateX", @@ -35137,7 +35146,7 @@ function pre(t, e, r) { continue; let u = !0; if (typeof a == "number" ? u = a === (o.startsWith("scale") ? 1 : 0) : u = parseFloat(a) === 0, !u || r) { - const l = p9(a, $b[o]); + const l = p9(a, Bb[o]); if (!u) { i = !1; const d = hre[o] || o; @@ -35148,7 +35157,7 @@ function pre(t, e, r) { } return n = n.trim(), r ? n = r(e, i ? "" : n) : i && (n = "none"), n; } -function ny(t, e, r) { +function iy(t, e, r) { const { style: n, vars: i, transformOrigin: s } = t; let o = !1, a = !1; for (const u in e) { @@ -35160,7 +35169,7 @@ function ny(t, e, r) { i[u] = l; continue; } else { - const d = p9(l, $b[u]); + const d = p9(l, Bb[u]); u.startsWith("origin") ? (a = !0, s[u] = d) : n[u] = d; } } @@ -35169,11 +35178,11 @@ function ny(t, e, r) { n.transformOrigin = `${u} ${l} ${d}`; } } -function n5(t, e, r) { +function i5(t, e, r) { return typeof t == "string" ? t : Vt.transform(e + r * t); } function gre(t, e, r) { - const n = n5(e, t.x, t.width), i = n5(r, t.y, t.height); + const n = i5(e, t.x, t.width), i = i5(r, t.y, t.height); return `${n} ${i}`; } const mre = { @@ -35190,7 +35199,7 @@ function bre(t, e, r = 1, n = 0, i = !0) { const o = Vt.transform(e), a = Vt.transform(r); t[s.array] = `${o} ${a}`; } -function iy(t, { +function sy(t, { attrX: e, attrY: r, attrScale: n, @@ -35202,7 +35211,7 @@ function iy(t, { // This is object creation, which we try to avoid per-frame. ...l }, d, p) { - if (ny(t, l, p), d) { + if (iy(t, l, p), d) { t.style.viewBox && (t.attrs.viewBox = t.style.viewBox); return; } @@ -35210,7 +35219,7 @@ function iy(t, { const { attrs: w, style: A, dimensions: M } = t; w.transform && (M && (A.transform = w.transform), delete w.transform), M && (i !== void 0 || s !== void 0 || A.transform) && (A.transformOrigin = gre(M, i !== void 0 ? i : 0.5, s !== void 0 ? s : 0.5)), e !== void 0 && (w.x = e), r !== void 0 && (w.y = r), n !== void 0 && (w.scale = n), o !== void 0 && bre(w, o, a, u, !1); } -const sy = (t) => typeof t == "string" && t.toLowerCase() === "svg", yre = { +const oy = (t) => typeof t == "string" && t.toLowerCase() === "svg", yre = { useVisualState: h9({ scrapeMotionValuesFromProps: l9, createRenderState: d9, @@ -35227,14 +35236,14 @@ const sy = (t) => typeof t == "string" && t.toLowerCase() === "svg", yre = { }; } }), Lr.render(() => { - iy(r, n, sy(e.tagName), t.transformTemplate), u9(e, r); + sy(r, n, oy(e.tagName), t.transformTemplate), u9(e, r); }); } }) }, wre = { useVisualState: h9({ - scrapeMotionValuesFromProps: ey, - createRenderState: ry + scrapeMotionValuesFromProps: ty, + createRenderState: ny }) }; function g9(t, e, r) { @@ -35243,8 +35252,8 @@ function g9(t, e, r) { } function xre({ transformTemplate: t }, e) { return wi(() => { - const r = ry(); - return ny(r, e, t), Object.assign({}, r.vars, r.style); + const r = ny(); + return iy(r, e, t), Object.assign({}, r.vars, r.style); }, [e]); } function _re(t, e) { @@ -35308,7 +35317,7 @@ function Pre(t, e, r) { function Mre(t, e, r, n) { const i = wi(() => { const s = d9(); - return iy(s, e, sy(n), t.transformTemplate), { + return sy(s, e, oy(n), t.transformTemplate), { ...s.attrs, style: { ...s.style } }; @@ -35321,7 +35330,7 @@ function Mre(t, e, r, n) { } function Ire(t = !1) { return (r, n, i, { latestValues: s }, o) => { - const u = (Qb(r) ? Mre : Ere)(n, s, o, r), l = Pre(n, typeof r == "string", t), d = r !== y5 ? { ...l, ...u, ref: i } : {}, { children: p } = n, w = wi(() => Xn(p) ? p.get() : p, [p]); + const u = (ey(r) ? Mre : Ere)(n, s, o, r), l = Pre(n, typeof r == "string", t), d = r !== w5 ? { ...l, ...u, ref: i } : {}, { children: p } = n, w = wi(() => Xn(p) ? p.get() : p, [p]); return qd(r, { ...d, children: w @@ -35331,7 +35340,7 @@ function Ire(t = !1) { function Cre(t, e) { return function(n, { forwardMotionProps: i } = { forwardMotionProps: !1 }) { const o = { - ...Qb(n) ? yre : wre, + ...ey(n) ? yre : wre, preloadedFeatures: t, useRender: Ire(i), createVisualElement: e, @@ -35340,14 +35349,14 @@ function Cre(t, e) { return sre(o); }; } -const fv = { current: null }, v9 = { current: !1 }; +const lv = { current: null }, v9 = { current: !1 }; function Tre() { - if (v9.current = !0, !!Zb) + if (v9.current = !0, !!Qb) if (window.matchMedia) { - const t = window.matchMedia("(prefers-reduced-motion)"), e = () => fv.current = t.matches; + const t = window.matchMedia("(prefers-reduced-motion)"), e = () => lv.current = t.matches; t.addListener(e), e(); } else - fv.current = !1; + lv.current = !1; } function Rre(t, e, r) { for (const n in e) { @@ -35369,7 +35378,7 @@ function Rre(t, e, r) { e[n] === void 0 && t.removeValue(n); return e; } -const i5 = /* @__PURE__ */ new WeakMap(), Dre = [...u7, Yn, _a], Ore = (t) => Dre.find(c7(t)), s5 = [ +const s5 = /* @__PURE__ */ new WeakMap(), Dre = [...u7, Yn, _a], Ore = (t) => Dre.find(c7(t)), o5 = [ "AnimationStart", "AnimationComplete", "Update", @@ -35390,7 +35399,7 @@ class Nre { return {}; } constructor({ parent: e, props: r, presenceContext: n, reducedMotionConfig: i, blockInitialAnimation: s, visualState: o }, a = {}) { - this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = Nb, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => { + this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = Lb, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => { this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection)); }, this.renderScheduledAt = 0, this.scheduleRender = () => { const w = Ys.now(); @@ -35405,10 +35414,10 @@ class Nre { } } mount(e) { - this.current = e, i5.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((r, n) => this.bindToMotionValue(n, r)), v9.current || Tre(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : fv.current, process.env.NODE_ENV !== "production" && vp(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext); + this.current = e, s5.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((r, n) => this.bindToMotionValue(n, r)), v9.current || Tre(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : lv.current, process.env.NODE_ENV !== "production" && vp(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext); } unmount() { - i5.delete(this.current), this.projection && this.projection.unmount(), wa(this.notifyUpdate), wa(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this); + s5.delete(this.current), this.projection && this.projection.unmount(), wa(this.notifyUpdate), wa(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this); for (const e in this.events) this.events[e].clear(); for (const e in this.features) { @@ -35466,8 +35475,8 @@ class Nre { */ update(e, r) { (e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = r; - for (let n = 0; n < s5.length; n++) { - const i = s5[n]; + for (let n = 0; n < o5.length; n++) { + const i = o5[n]; this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]); const s = "on" + i, o = e[s]; o && (this.propEventSubscriptions[i] = this.on(i, o)); @@ -35556,7 +35565,7 @@ class Nre { const { initial: n } = this.props; let i; if (typeof n == "string" || typeof n == "object") { - const o = Mb(this.props, n, (r = this.presenceContext) === null || r === void 0 ? void 0 : r.custom); + const o = Ib(this.props, n, (r = this.presenceContext) === null || r === void 0 ? void 0 : r.custom); o && (i = o[e]); } if (n && i !== void 0) @@ -35565,7 +35574,7 @@ class Nre { return s !== void 0 && !Xn(s) ? s : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e]; } on(e, r) { - return this.events[e] || (this.events[e] = new Vb()), this.events[e].add(r); + return this.events[e] || (this.events[e] = new Gb()), this.events[e].add(r); } notify(e, ...r) { this.events[e] && this.events[e].notify(...r); @@ -35594,7 +35603,7 @@ class kre extends b9 { } readValueFromInstance(e, r) { if (Ac.has(r)) { - const n = Bb(r); + const n = Fb(r); return n && n.default || 0; } else { const n = Lre(e), i = (o7(r) ? n.getPropertyValue(r) : n[r]) || 0; @@ -35605,10 +35614,10 @@ class kre extends b9 { return W7(e, r); } build(e, r, n) { - ny(e, r, n.transformTemplate); + iy(e, r, n.transformTemplate); } scrapeMotionValuesFromProps(e, r, n) { - return ey(e, r, n); + return ty(e, r, n); } handleChildMotionValue() { this.childSubscription && (this.childSubscription(), delete this.childSubscription); @@ -35627,26 +35636,26 @@ class $re extends b9 { } readValueFromInstance(e, r) { if (Ac.has(r)) { - const n = Bb(r); + const n = Fb(r); return n && n.default || 0; } - return r = c9.has(r) ? r : Gb(r), e.getAttribute(r); + return r = c9.has(r) ? r : Yb(r), e.getAttribute(r); } scrapeMotionValuesFromProps(e, r, n) { return l9(e, r, n); } build(e, r, n) { - iy(e, r, this.isSVGTag, n.transformTemplate); + sy(e, r, this.isSVGTag, n.transformTemplate); } renderInstance(e, r, n, i) { u9(e, r, n, i); } mount(e) { - this.isSVGTag = sy(e.tagName), super.mount(e); + this.isSVGTag = oy(e.tagName), super.mount(e); } } -const Bre = (t, e) => Qb(t) ? new $re(e) : new kre(e, { - allowProjection: t !== y5 +const Bre = (t, e) => ey(t) ? new $re(e) : new kre(e, { + allowProjection: t !== w5 }), Fre = /* @__PURE__ */ Cre({ ...Iee, ...Jte, @@ -35672,13 +35681,13 @@ class Ure extends Gt.Component { } } function qre({ children: t, isPresent: e }) { - const r = mv(), n = Zn(null), i = Zn({ + const r = vv(), n = Zn(null), i = Zn({ width: 0, height: 0, top: 0, left: 0 - }), { nonce: s } = Tn(Xb); - return b5(() => { + }), { nonce: s } = Tn(Zb); + return y5(() => { const { width: o, height: a, top: u, left: l } = i.current; if (e || !n.current || !o || !a) return; @@ -35698,7 +35707,7 @@ function qre({ children: t, isPresent: e }) { }, [e]), pe.jsx(Ure, { isPresent: e, childRef: n, sizeRef: i, children: Gt.cloneElement(t, { ref: n }) }); } const zre = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: i, presenceAffectsLayout: s, mode: o }) => { - const a = ty(Wre), u = mv(), l = vv((p) => { + const a = ry(Wre), u = vv(), l = bv((p) => { a.set(p, !0); for (const w of a.values()) if (!w) @@ -35730,7 +35739,7 @@ function Wre() { return /* @__PURE__ */ new Map(); } const bd = (t) => t.key || ""; -function o5(t) { +function a5(t) { const e = []; return BR.forEach(t, (r) => { FR(r) && e.push(r); @@ -35738,7 +35747,7 @@ function o5(t) { } const Hre = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExitComplete: i, presenceAffectsLayout: s = !0, mode: o = "sync" }) => { Uo(!e, "Replace exitBeforeEnter with mode='wait'"); - const a = wi(() => o5(t), [t]), u = a.map(bd), l = Zn(!0), d = Zn(a), p = ty(() => /* @__PURE__ */ new Map()), [w, A] = Yt(a), [M, N] = Yt(a); + const a = wi(() => a5(t), [t]), u = a.map(bd), l = Zn(!0), d = Zn(a), p = ry(() => /* @__PURE__ */ new Map()), [w, A] = Yt(a), [M, N] = Yt(a); n9(() => { l.current = !1, d.current = a; for (let $ = 0; $ < M.length; $++) { @@ -35753,11 +35762,11 @@ const Hre = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onEx const W = M[H], V = bd(W); u.includes(V) || ($.splice(H, 0, W), L.push(W)); } - o === "wait" && L.length && ($ = L), N(o5($)), A(a); + o === "wait" && L.length && ($ = L), N(a5($)), A(a); return; } process.env.NODE_ENV !== "production" && o === "wait" && M.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`); - const { forceRender: B } = Tn(Yb); + const { forceRender: B } = Tn(Jb); return pe.jsx(pe.Fragment, { children: M.map(($) => { const H = bd($), W = a === M || u.includes(H), V = () => { if (p.has(H)) @@ -35782,7 +35791,7 @@ const Hre = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onEx children: t.children } ) }); -function oy(t) { +function ay(t) { const { icon: e, title: r, extra: n, onClick: i } = t; function s() { i && i(); @@ -35815,7 +35824,7 @@ function Kre(t) { function y9(t) { var o, a; const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: (o = e.config) == null ? void 0 : o.image }), i = ((a = e.config) == null ? void 0 : a.name) || "", s = wi(() => Kre(e), [e]); - return /* @__PURE__ */ pe.jsx(oy, { icon: n, title: i, extra: s, onClick: () => r(e) }); + return /* @__PURE__ */ pe.jsx(ay, { icon: n, title: i, extra: s, onClick: () => r(e) }); } function w9(t) { var e, r, n = ""; @@ -35830,14 +35839,14 @@ function Vre() { for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++) (t = arguments[r]) && (e = w9(t)) && (n && (n += " "), n += e); return n; } -const Gre = Vre, ay = "-", Yre = (t) => { +const Gre = Vre, cy = "-", Yre = (t) => { const e = Xre(t), { conflictingClassGroups: r, conflictingClassGroupModifiers: n } = t; return { getClassGroupId: (o) => { - const a = o.split(ay); + const a = o.split(cy); return a[0] === "" && a.length !== 1 && a.shift(), x9(a, e) || Jre(o); }, getConflictingClassGroupIds: (o, a) => { @@ -35854,13 +35863,13 @@ const Gre = Vre, ay = "-", Yre = (t) => { return i; if (e.validators.length === 0) return; - const s = t.join(ay); + const s = t.join(cy); return (o = e.validators.find(({ validator: a }) => a(s))) == null ? void 0 : o.classGroupId; -}, a5 = /^\[(.+)\]$/, Jre = (t) => { - if (a5.test(t)) { - const e = a5.exec(t)[1], r = e == null ? void 0 : e.substring(0, e.indexOf(":")); +}, c5 = /^\[(.+)\]$/, Jre = (t) => { + if (c5.test(t)) { + const e = c5.exec(t)[1], r = e == null ? void 0 : e.substring(0, e.indexOf(":")); if (r) return "arbitrary.." + r; } @@ -35873,18 +35882,18 @@ const Gre = Vre, ay = "-", Yre = (t) => { validators: [] }; return Qre(Object.entries(t.classGroups), r).forEach(([s, o]) => { - lv(o, n, s, e); + hv(o, n, s, e); }), n; -}, lv = (t, e, r, n) => { +}, hv = (t, e, r, n) => { t.forEach((i) => { if (typeof i == "string") { - const s = i === "" ? e : c5(e, i); + const s = i === "" ? e : u5(e, i); s.classGroupId = r; return; } if (typeof i == "function") { if (Zre(i)) { - lv(i(n), e, r, n); + hv(i(n), e, r, n); return; } e.validators.push({ @@ -35894,12 +35903,12 @@ const Gre = Vre, ay = "-", Yre = (t) => { return; } Object.entries(i).forEach(([s, o]) => { - lv(o, c5(e, s), r, n); + hv(o, u5(e, s), r, n); }); }); -}, c5 = (t, e) => { +}, u5 = (t, e) => { let r = t; - return e.split(ay).forEach((n) => { + return e.split(cy).forEach((n) => { r.nextPart.has(n) || r.nextPart.set(n, { nextPart: /* @__PURE__ */ new Map(), validators: [] @@ -38140,7 +38149,7 @@ function M9(t) { `feature-${N.key}` )), l.showTonConnect && /* @__PURE__ */ pe.jsx( - oy, + ay, { icon: /* @__PURE__ */ pe.jsx("img", { className: "xc-h-5 xc-w-5", src: Mne }), title: "TON Connect", @@ -38174,7 +38183,7 @@ const I9 = Sa({ inviterCode: "", role: "C" }); -function cy() { +function uy() { return Tn(I9); } function Cne(t) { @@ -38195,9 +38204,9 @@ function Cne(t) { } ); } -var Tne = Object.defineProperty, Rne = Object.defineProperties, Dne = Object.getOwnPropertyDescriptors, S0 = Object.getOwnPropertySymbols, C9 = Object.prototype.hasOwnProperty, T9 = Object.prototype.propertyIsEnumerable, u5 = (t, e, r) => e in t ? Tne(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, One = (t, e) => { - for (var r in e || (e = {})) C9.call(e, r) && u5(t, r, e[r]); - if (S0) for (var r of S0(e)) T9.call(e, r) && u5(t, r, e[r]); +var Tne = Object.defineProperty, Rne = Object.defineProperties, Dne = Object.getOwnPropertyDescriptors, S0 = Object.getOwnPropertySymbols, C9 = Object.prototype.hasOwnProperty, T9 = Object.prototype.propertyIsEnumerable, f5 = (t, e, r) => e in t ? Tne(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, One = (t, e) => { + for (var r in e || (e = {})) C9.call(e, r) && f5(t, r, e[r]); + if (S0) for (var r of S0(e)) T9.call(e, r) && f5(t, r, e[r]); return t; }, Nne = (t, e) => Rne(t, Dne(e)), Lne = (t, e) => { var r = {}; @@ -38520,7 +38529,7 @@ function $9(t) { ] }); } function Wne(t) { - const { email: e } = t, r = cy(), [n, i] = Yt("captcha"); + const { email: e } = t, r = uy(), [n, i] = Yt("captcha"); async function s(o, a) { const u = await Ta.emailLogin({ account_type: "email", @@ -39669,7 +39678,7 @@ class sa extends yt { }); } } -function f5(t) { +function l5(t) { if (/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t) || /%[^0-9a-f]/i.test(t) || /%[0-9a-f](:?[^0-9a-f]|$)/i.test(t)) return !1; const e = Kne(t), r = e[1], n = e[2], i = e[3], s = e[4], o = e[5]; @@ -39721,7 +39730,7 @@ function j9(t) { `Provided value: ${s}` ] }); - if (!f5(d)) + if (!l5(d)) throw new sa({ field: "uri", metaMessages: [ @@ -39762,7 +39771,7 @@ function j9(t) { ] }); } - const w = Ev(t.address), A = l ? `${l}://${r}` : r, M = t.statement ? `${t.statement} + const w = Sv(t.address), A = l ? `${l}://${r}` : r, M = t.statement ? `${t.statement} ` : "", N = `${A} wants you to sign in with your Ethereum account: ${w} @@ -39779,7 +39788,7 @@ Request ID: ${a}`), u) { let B = ` Resources:`; for (const $ of u) { - if (!f5($)) + if (!l5($)) throw new sa({ field: "resources", metaMessages: [ @@ -39995,7 +40004,7 @@ function z9(t) { const M = await n.connect(); if (!M || M.length === 0) throw new Error("Wallet connect error"); - const N = Ev(M[0]), L = nie(N, w); + const N = Sv(M[0]), L = nie(N, w); a("sign"); const B = await n.signMessage(L, N); if (!B || B.length === 0) @@ -40121,7 +40130,7 @@ function W9(t) { ] }); } function lie(t) { - const { wallet: e } = t, [r, n] = Yt(e.installed ? "connect" : "qr"), i = cy(); + const { wallet: e } = t, [r, n] = Yt(e.installed ? "connect" : "qr"), i = uy(); async function s(o, a) { var l; const u = await Ta.walletLogin({ @@ -40166,7 +40175,7 @@ function lie(t) { } function hie(t) { const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: e.imageUrl }), i = e.name || ""; - return /* @__PURE__ */ pe.jsx(oy, { icon: n, title: i, onClick: () => r(e) }); + return /* @__PURE__ */ pe.jsx(ay, { icon: n, title: i, onClick: () => r(e) }); } function H9(t) { const { connector: e } = t, [r, n] = Yt(), [i, s] = Yt([]), o = wi(() => r ? i.filter((d) => d.name.toLowerCase().includes(r.toLowerCase())) : i, [r, i]); @@ -40895,7 +40904,7 @@ var V9 = { exports: {} }; for (G = 0; G < C; G++) z[G] = j[G]; Bt(j); }); - } else typeof A4 < "u" && (k = Wl, k && k.randomBytes && e.setPRNG(function(z, C) { + } else typeof P4 < "u" && (k = Wl, k && k.randomBytes && e.setPRNG(function(z, C) { var G, j = k.randomBytes(C); for (G = 0; G < C; G++) z[G] = j[G]; Bt(j); @@ -40909,26 +40918,26 @@ var fa; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.MANIFEST_NOT_FOUND_ERROR = 2] = "MANIFEST_NOT_FOUND_ERROR", t[t.MANIFEST_CONTENT_ERROR = 3] = "MANIFEST_CONTENT_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; })(fa || (fa = {})); -var l5; +var h5; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(l5 || (l5 = {})); +})(h5 || (h5 = {})); var su; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; })(su || (su = {})); -var h5; -(function(t) { - t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(h5 || (h5 = {})); var d5; (function(t) { - t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; + t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; })(d5 || (d5 = {})); var p5; (function(t) { - t.MAINNET = "-239", t.TESTNET = "-3"; + t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; })(p5 || (p5 = {})); +var g5; +(function(t) { + t.MAINNET = "-239", t.TESTNET = "-3"; +})(g5 || (g5 = {})); function gie(t, e) { const r = Dl.encodeBase64(t); return e ? encodeURIComponent(r) : r; @@ -40986,7 +40995,7 @@ function A0(t) { e[r / 2] = parseInt(t.slice(r, r + 2), 16); return e; } -class hv { +class dv { constructor(e) { this.nonceLength = 24, this.keyPair = e ? this.createKeypairFromString(e) : this.createKeypair(), this.sessionId = Km(this.keyPair.publicKey); } @@ -41082,12 +41091,12 @@ class jt extends Error { } } jt.prefix = "[TON_CONNECT_SDK_ERROR]"; -class uy extends jt { +class fy extends jt { get info() { return "Passed DappMetadata is in incorrect format."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, uy.prototype); + super(...e), Object.setPrototypeOf(this, fy.prototype); } } class Ap extends jt { @@ -41106,12 +41115,12 @@ class Pp extends jt { super(...e), Object.setPrototypeOf(this, Pp.prototype); } } -class fy extends jt { +class ly extends jt { get info() { return "Wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, fy.prototype); + super(...e), Object.setPrototypeOf(this, ly.prototype); } } class P0 extends jt { @@ -41149,20 +41158,20 @@ class Cp extends jt { super(...e), Object.setPrototypeOf(this, Cp.prototype); } } -class ly extends jt { +class hy extends jt { get info() { return "There is an attempt to connect to the injected wallet while it is not exists in the webpage."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, ly.prototype); + super(...e), Object.setPrototypeOf(this, hy.prototype); } } -class hy extends jt { +class dy extends jt { get info() { return "An error occurred while fetching the wallets list."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, hy.prototype); + super(...e), Object.setPrototypeOf(this, dy.prototype); } } class Ea extends jt { @@ -41170,7 +41179,7 @@ class Ea extends jt { super(...e), Object.setPrototypeOf(this, Ea.prototype); } } -const g5 = { +const m5 = { [fa.UNKNOWN_ERROR]: Ea, [fa.USER_REJECTS_ERROR]: Mp, [fa.BAD_REQUEST_ERROR]: Ip, @@ -41181,7 +41190,7 @@ const g5 = { class Eie { parseError(e) { let r = Ea; - return e.code in g5 && (r = g5[e.code] || Ea), new r(e.message); + return e.code in m5 && (r = m5[e.code] || Ea), new r(e.message); } } const Sie = new Eie(); @@ -41190,7 +41199,7 @@ class Aie { return "error" in e; } } -const m5 = { +const v5 = { [su.UNKNOWN_ERROR]: Ea, [su.USER_REJECTS_ERROR]: Mp, [su.BAD_REQUEST_ERROR]: Ip, @@ -41205,7 +41214,7 @@ class Pie extends Aie { } parseAndThrowError(e) { let r = Ea; - throw e.error.code in m5 && (r = m5[e.error.code] || Ea), new r(e.error.message); + throw e.error.code in v5 && (r = v5[e.error.code] || Ea), new r(e.error.message); } convertFromRpcResponse(e) { return { @@ -41576,7 +41585,7 @@ class Ol { if (r.type === "injected") return r; if ("connectEvent" in r) { - const n = new hv(r.session.sessionKeyPair); + const n = new dv(r.session.sessionKeyPair); return { type: "http", connectEvent: r.connectEvent, @@ -41591,7 +41600,7 @@ class Ol { } return { type: "http", - sessionCrypto: new hv(r.sessionCrypto), + sessionCrypto: new dv(r.sessionCrypto), connectionSource: r.connectionSource }; }); @@ -41679,7 +41688,7 @@ class Nl { var n; const i = _s(r == null ? void 0 : r.signal); (n = this.abortController) === null || n === void 0 || n.abort(), this.abortController = i, this.closeGateways(); - const s = new hv(); + const s = new dv(); this.session = { sessionCrypto: s, bridgeUrl: "bridgeUrl" in this.walletConnectionSource ? this.walletConnectionSource.bridgeUrl : "" @@ -41903,7 +41912,7 @@ class Nl { (r = this.gateway) === null || r === void 0 || r.close(), this.pendingGateways.filter((n) => n !== (e == null ? void 0 : e.except)).forEach((n) => n.close()), this.pendingGateways = []; } } -function v5(t, e) { +function b5(t, e) { return Z9(t, [e]); } function Z9(t, e) { @@ -41911,7 +41920,7 @@ function Z9(t, e) { } function Lie(t) { try { - return !v5(t, "tonconnect") || !v5(t.tonconnect, "walletInfo") ? !1 : Z9(t.tonconnect.walletInfo, [ + return !b5(t, "tonconnect") || !b5(t.tonconnect, "walletInfo") ? !1 : Z9(t.tonconnect.walletInfo, [ "name", "app_name", "image", @@ -41996,7 +42005,7 @@ class vi { this.injectedWalletKey = r, this.type = "injected", this.unsubscribeCallback = null, this.listenSubscriptions = !1, this.listeners = []; const n = vi.window; if (!vi.isWindowContainsWallet(n, r)) - throw new ly(); + throw new hy(); this.connectionStorage = new Ol(e), this.injectedWallet = n[r].tonconnect; } static fromStorage(e) { @@ -42341,7 +42350,7 @@ const Hie = [ platforms: ["chrome", "safari", "firefox", "ios", "android"] } ]; -class dv { +class pv { constructor(e) { this.walletsListCache = null, this.walletsListCacheCreationTimestamp = null, this.walletsListSource = "https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json", e != null && e.walletsListSource && (this.walletsListSource = e.walletsListSource), e != null && e.cacheTTLMs && (this.cacheTTLMs = e.cacheTTLMs); } @@ -42365,7 +42374,7 @@ class dv { let e = []; try { if (e = yield (yield fetch(this.walletsListSource)).json(), !Array.isArray(e)) - throw new hy("Wrong wallets list format, wallets list must be an array."); + throw new dy("Wrong wallets list format, wallets list must be an array."); const i = e.filter((s) => !this.isCorrectWalletConfigDTO(s)); i.length && (No(`Wallet(s) ${i.map((s) => s.name).join(", ")} config format is wrong. They were removed from the wallets list.`), e = e.filter((s) => this.isCorrectWalletConfigDTO(s))); } catch (n) { @@ -42503,7 +42512,7 @@ function ese(t, e) { custom_data: Yu(t) }; } -function dy(t, e) { +function py(t, e) { var r, n, i, s; return { valid_until: (r = String(e.validUntil)) !== null && r !== void 0 ? r : null, @@ -42518,13 +42527,13 @@ function dy(t, e) { }; } function tse(t, e, r) { - return Object.assign(Object.assign({ type: "transaction-sent-for-signature" }, Ju(t, e)), dy(e, r)); + return Object.assign(Object.assign({ type: "transaction-sent-for-signature" }, Ju(t, e)), py(e, r)); } function rse(t, e, r, n) { - return Object.assign(Object.assign({ type: "transaction-signed", is_success: !0, signed_transaction: n.boc }, Ju(t, e)), dy(e, r)); + return Object.assign(Object.assign({ type: "transaction-signed", is_success: !0, signed_transaction: n.boc }, Ju(t, e)), py(e, r)); } function nse(t, e, r, n, i) { - return Object.assign(Object.assign({ type: "transaction-signing-failed", is_success: !1, error_message: n, error_code: i ?? null }, Ju(t, e)), dy(e, r)); + return Object.assign(Object.assign({ type: "transaction-signing-failed", is_success: !1, error_message: n, error_code: i ?? null }, Ju(t, e)), py(e, r)); } function ise(t, e, r) { return Object.assign({ type: "disconnection", scope: r }, Ju(t, e)); @@ -42741,17 +42750,17 @@ class ose { const ase = "3.0.5"; class fh { constructor(e) { - if (this.walletsList = new dv(), this._wallet = null, this.provider = null, this.statusChangeSubscriptions = [], this.statusChangeErrorSubscriptions = [], this.dappSettings = { + if (this.walletsList = new pv(), this._wallet = null, this.provider = null, this.statusChangeSubscriptions = [], this.statusChangeErrorSubscriptions = [], this.dappSettings = { manifestUrl: (e == null ? void 0 : e.manifestUrl) || Bie(), storage: (e == null ? void 0 : e.storage) || new qie() - }, this.walletsList = new dv({ + }, this.walletsList = new pv({ walletsListSource: e == null ? void 0 : e.walletsListSource, cacheTTLMs: e == null ? void 0 : e.walletsListCacheTTLMs }), this.tracker = new ose({ eventDispatcher: e == null ? void 0 : e.eventDispatcher, tonConnectSdkVersion: ase }), !this.dappSettings.manifestUrl) - throw new uy("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"); + throw new fy("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"); this.bridgeConnectionStorage = new Ol(this.dappSettings.storage), e != null && e.disableAutoPauseConnection || this.addWindowFocusAndBlurSubscriptions(); } /** @@ -42803,7 +42812,7 @@ class fh { var n, i; const s = {}; if (typeof r == "object" && "tonProof" in r && (s.request = r), typeof r == "object" && ("openingDeadlineMS" in r || "signal" in r || "request" in r) && (s.request = r == null ? void 0 : r.request, s.openingDeadlineMS = r == null ? void 0 : r.openingDeadlineMS, s.signal = r == null ? void 0 : r.signal), this.connected) - throw new fy(); + throw new ly(); const o = _s(s == null ? void 0 : s.signal); if ((n = this.abortController) === null || n === void 0 || n.abort(), this.abortController = o, o.signal.aborted) throw new jt("Connection was aborted"); @@ -43007,7 +43016,7 @@ class fh { }; } } -fh.walletsList = new dv(); +fh.walletsList = new pv(); fh.isWalletInjected = (t) => vi.isWalletInjected(t); fh.isInsideWalletBrowser = (t) => vi.isInsideWalletBrowser(t); for (let t = 0; t <= 255; t++) { @@ -43108,7 +43117,7 @@ function eA(t) { ] }); } function cse(t) { - const [e, r] = Yt(""), [n, i] = Yt(), [s, o] = Yt(), a = cy(), [u, l] = Yt(!1); + const [e, r] = Yt(""), [n, i] = Yt(), [s, o] = Yt(), a = uy(), [u, l] = Yt(!1); async function d(w) { var M, N; if (!w || !((M = w.connectItems) != null && M.tonProof)) return; @@ -43163,7 +43172,7 @@ function cse(t) { ] }); } function tA(t) { - const { children: e, className: r } = t, n = Zn(null), [i, s] = pv.useState(0); + const { children: e, className: r } = t, n = Zn(null), [i, s] = gv.useState(0); function o() { var a; try { @@ -43406,7 +43415,7 @@ function xoe(t) { } export { boe as C, - I5 as H, + C5 as H, aZ as a, Ll as b, mse as c, @@ -43415,7 +43424,7 @@ export { xoe as f, gse as h, vse as r, - r4 as s, + n4 as s, C0 as t, mp as u }; diff --git a/dist/secp256k1-C2LQAh0i.js b/dist/secp256k1-CNxaHocU.js similarity index 99% rename from dist/secp256k1-C2LQAh0i.js rename to dist/secp256k1-CNxaHocU.js index b338a6a..8bd2ea5 100644 --- a/dist/secp256k1-C2LQAh0i.js +++ b/dist/secp256k1-CNxaHocU.js @@ -1,4 +1,4 @@ -import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-ChUtI_2i.js"; +import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-C4Op-TDI.js"; class Kt extends ee { constructor(n, t) { super(), this.finished = !1, this.destroyed = !1, ne(n); diff --git a/dist/types/wallet-item.class.d.ts b/dist/types/wallet-item.class.d.ts index 06ae5a0..afac606 100644 --- a/dist/types/wallet-item.class.d.ts +++ b/dist/types/wallet-item.class.d.ts @@ -16,6 +16,11 @@ export declare class WalletItem { get featured(): boolean; get key(): string; get installed(): boolean; + get provider(): { + on: (event: event, listener: import('viem').EIP1193EventMap[event]) => void; + removeListener: (event: event, listener: import('viem').EIP1193EventMap[event]) => void; + request: import('viem').EIP1193RequestFn; + } | UniversalProvider | null; get client(): WalletClient | null; get config(): WalletConfig | null; static fromWalletConfig(config: WalletConfig): WalletItem; diff --git a/package.json b/package.json index b9d6775..91f93bd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codatta-connect", - "version": "2.4.2", + "version": "2.4.3", "type": "module", "main": "./dist/index.umd.js", "module": "./dist/index.es.js", From 356587fec01ba286b2cb941816c9e4216261d41e Mon Sep 17 00:00:00 2001 From: Meow Lord Date: Wed, 18 Jun 2025 14:55:33 +0800 Subject: [PATCH 14/25] v2.4.6 --- dist/codatta-connect.d.ts | 9 +- dist/index.es.js | 11 +- dist/index.umd.js | 96 +- dist/{main-C4Op-TDI.js => main-BN1nTxTF.js} | 6918 +++++++++-------- dist/main.d.ts | 1 + ...56k1-CNxaHocU.js => secp256k1-DuMBhiq0.js} | 2 +- lib/codatta-connect-context-provider.tsx | 1 + lib/codatta-connect.tsx | 26 +- lib/components/signin-index.tsx | 79 +- lib/main.ts | 3 +- lib/vite-env.d.ts | 3 + package-lock.json | 32 +- package.json | 3 +- 13 files changed, 3635 insertions(+), 3549 deletions(-) rename dist/{main-C4Op-TDI.js => main-BN1nTxTF.js} (90%) rename dist/{secp256k1-CNxaHocU.js => secp256k1-DuMBhiq0.js} (99%) diff --git a/dist/codatta-connect.d.ts b/dist/codatta-connect.d.ts index 3a5f7d6..e5ba54c 100644 --- a/dist/codatta-connect.d.ts +++ b/dist/codatta-connect.d.ts @@ -1,3 +1,4 @@ +import { WalletItem } from './types/wallet-item.class'; import { default as TonConnect, Wallet } from '@tonconnect/sdk'; import { WalletSignInfo } from './components/wallet-connect'; import { WalletClient } from 'viem'; @@ -5,16 +6,18 @@ export interface EmvWalletConnectInfo { chain_type: 'eip155'; client: WalletClient; connect_info: WalletSignInfo; + wallet: WalletItem; } export interface TonWalletConnectInfo { chain_type: 'ton'; client: TonConnect; connect_info: Wallet; + wallet: Wallet; } export declare function CodattaConnect(props: { - onEvmWalletConnect: (connectInfo: EmvWalletConnectInfo) => Promise; - onTonWalletConnect: (connectInfo: TonWalletConnectInfo) => Promise; - onEmailConnect: (email: string, code: string) => Promise; + onEvmWalletConnect?: (connectInfo: EmvWalletConnectInfo) => Promise; + onTonWalletConnect?: (connectInfo: TonWalletConnectInfo) => Promise; + onEmailConnect?: (email: string, code: string) => Promise; config?: { showEmailSignIn?: boolean; showFeaturedWallets?: boolean; diff --git a/dist/index.es.js b/dist/index.es.js index f205774..f2f5c33 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -1,8 +1,9 @@ -import { f as o, C as n, d as e, a as C, u as s } from "./main-C4Op-TDI.js"; +import { f as o, C as e, d as n, W as C, a as s, u as d } from "./main-BN1nTxTF.js"; export { o as CodattaConnect, - n as CodattaConnectContextProvider, - e as CodattaSignin, - C as coinbaseWallet, - s as useCodattaConnectContext + e as CodattaConnectContextProvider, + n as CodattaSignin, + C as WalletItem, + s as coinbaseWallet, + d as useCodattaConnectContext }; diff --git a/dist/index.umd.js b/dist/index.umd.js index 69bcff0..16f2871 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -1,4 +1,4 @@ -(function(Fn,Se){typeof exports=="object"&&typeof module<"u"?Se(exports,require("react"),require("https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js")):typeof define=="function"&&define.amd?define(["exports","react","https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"],Se):(Fn=typeof globalThis<"u"?globalThis:Fn||self,Se(Fn["xny-connect"]={},Fn.React))})(this,function(Fn,Se){"use strict";var foe=Object.defineProperty;var loe=(Fn,Se,kc)=>Se in Fn?foe(Fn,Se,{enumerable:!0,configurable:!0,writable:!0,value:kc}):Fn[Se]=kc;var oo=(Fn,Se,kc)=>loe(Fn,typeof Se!="symbol"?Se+"":Se,kc);function kc(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const Yt=kc(Se);var nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ji(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Jp(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Xp={exports:{}},gf={};/** +(function(Mn,Ee){typeof exports=="object"&&typeof module<"u"?Ee(exports,require("react"),require("https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js")):typeof define=="function"&&define.amd?define(["exports","react","https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"],Ee):(Mn=typeof globalThis<"u"?globalThis:Mn||self,Ee(Mn["xny-connect"]={},Mn.React))})(this,function(Mn,Ee){"use strict";var foe=Object.defineProperty;var loe=(Mn,Ee,kc)=>Ee in Mn?foe(Mn,Ee,{enumerable:!0,configurable:!0,writable:!0,value:kc}):Mn[Ee]=kc;var oo=(Mn,Ee,kc)=>loe(Mn,typeof Ee!="symbol"?Ee+"":Ee,kc);function kc(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const Yt=kc(Ee);var nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ji(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Jp(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Xp={exports:{}},mf={};/** * @license React * react-jsx-runtime.production.min.js * @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ky;function XA(){if(Ky)return gf;Ky=1;var t=Se,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,u,l){var d,p={},y=null,A=null;l!==void 0&&(y=""+l),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(A=u.ref);for(d in u)n.call(u,d)&&!s.hasOwnProperty(d)&&(p[d]=u[d]);if(a&&a.defaultProps)for(d in u=a.defaultProps,u)p[d]===void 0&&(p[d]=u[d]);return{$$typeof:e,type:a,key:y,ref:A,props:p,_owner:i.current}}return gf.Fragment=r,gf.jsx=o,gf.jsxs=o,gf}var mf={};/** + */var Vy;function XA(){if(Vy)return mf;Vy=1;var t=Ee,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,u,l){var d,p={},y=null,A=null;l!==void 0&&(y=""+l),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(A=u.ref);for(d in u)n.call(u,d)&&!s.hasOwnProperty(d)&&(p[d]=u[d]);if(a&&a.defaultProps)for(d in u=a.defaultProps,u)p[d]===void 0&&(p[d]=u[d]);return{$$typeof:e,type:a,key:y,ref:A,props:p,_owner:i.current}}return mf.Fragment=r,mf.jsx=o,mf.jsxs=o,mf}var vf={};/** * @license React * react-jsx-runtime.development.js * @@ -14,42 +14,42 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Vy;function ZA(){return Vy||(Vy=1,process.env.NODE_ENV!=="production"&&function(){var t=Se,e=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),A=Symbol.for("react.offscreen"),P=Symbol.iterator,N="@@iterator";function D(q){if(q===null||typeof q!="object")return null;var oe=P&&q[P]||q[N];return typeof oe=="function"?oe:null}var k=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function B(q){{for(var oe=arguments.length,pe=new Array(oe>1?oe-1:0),xe=1;xe1?oe-1:0),xe=1;xe=1&&tt>=0&&Ue[st]!==gt[tt];)tt--;for(;st>=1&&tt>=0;st--,tt--)if(Ue[st]!==gt[tt]){if(st!==1||tt!==1)do if(st--,tt--,tt<0||Ue[st]!==gt[tt]){var At=` -`+Ue[st].replace(" at new "," at ");return q.displayName&&At.includes("")&&(At=At.replace("",q.displayName)),typeof q=="function"&&R.set(q,At),At}while(st>=1&&tt>=0);break}}}finally{Q=!1,se.current=De,O(),Error.prepareStackTrace=Re}var Rt=q?q.displayName||q.name:"",Mt=Rt?X(Rt):"";return typeof q=="function"&&R.set(q,Mt),Mt}function le(q,oe,pe){return te(q,!1)}function ie(q){var oe=q.prototype;return!!(oe&&oe.isReactComponent)}function fe(q,oe,pe){if(q==null)return"";if(typeof q=="function")return te(q,ie(q));if(typeof q=="string")return X(q);switch(q){case l:return X("Suspense");case d:return X("SuspenseList")}if(typeof q=="object")switch(q.$$typeof){case u:return le(q.render);case p:return fe(q.type,oe,pe);case y:{var xe=q,Re=xe._payload,De=xe._init;try{return fe(De(Re),oe,pe)}catch{}}}return""}var ve=Object.prototype.hasOwnProperty,Me={},Ne=k.ReactDebugCurrentFrame;function Te(q){if(q){var oe=q._owner,pe=fe(q.type,q._source,oe?oe.type:null);Ne.setExtraStackFrame(pe)}else Ne.setExtraStackFrame(null)}function $e(q,oe,pe,xe,Re){{var De=Function.call.bind(ve);for(var it in q)if(De(q,it)){var Ue=void 0;try{if(typeof q[it]!="function"){var gt=Error((xe||"React class")+": "+pe+" type `"+it+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof q[it]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw gt.name="Invariant Violation",gt}Ue=q[it](oe,it,xe,pe,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(st){Ue=st}Ue&&!(Ue instanceof Error)&&(Te(Re),B("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",xe||"React class",pe,it,typeof Ue),Te(null)),Ue instanceof Error&&!(Ue.message in Me)&&(Me[Ue.message]=!0,Te(Re),B("Failed %s type: %s",pe,Ue.message),Te(null))}}}var Ie=Array.isArray;function Le(q){return Ie(q)}function Ve(q){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,pe=oe&&q[Symbol.toStringTag]||q.constructor.name||"Object";return pe}}function ke(q){try{return ze(q),!1}catch{return!0}}function ze(q){return""+q}function He(q){if(ke(q))return B("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ve(q)),ze(q)}var Ee=k.ReactCurrentOwner,Qe={key:!0,ref:!0,__self:!0,__source:!0},ct,Be,et;et={};function rt(q){if(ve.call(q,"ref")){var oe=Object.getOwnPropertyDescriptor(q,"ref").get;if(oe&&oe.isReactWarning)return!1}return q.ref!==void 0}function Je(q){if(ve.call(q,"key")){var oe=Object.getOwnPropertyDescriptor(q,"key").get;if(oe&&oe.isReactWarning)return!1}return q.key!==void 0}function pt(q,oe){if(typeof q.ref=="string"&&Ee.current&&oe&&Ee.current.stateNode!==oe){var pe=m(Ee.current.type);et[pe]||(B('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',m(Ee.current.type),q.ref),et[pe]=!0)}}function ht(q,oe){{var pe=function(){ct||(ct=!0,B("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};pe.isReactWarning=!0,Object.defineProperty(q,"key",{get:pe,configurable:!0})}}function ft(q,oe){{var pe=function(){Be||(Be=!0,B("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};pe.isReactWarning=!0,Object.defineProperty(q,"ref",{get:pe,configurable:!0})}}var Ht=function(q,oe,pe,xe,Re,De,it){var Ue={$$typeof:e,type:q,key:oe,ref:pe,props:it,_owner:De};return Ue._store={},Object.defineProperty(Ue._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ue,"_self",{configurable:!1,enumerable:!1,writable:!1,value:xe}),Object.defineProperty(Ue,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Re}),Object.freeze&&(Object.freeze(Ue.props),Object.freeze(Ue)),Ue};function Jt(q,oe,pe,xe,Re){{var De,it={},Ue=null,gt=null;pe!==void 0&&(He(pe),Ue=""+pe),Je(oe)&&(He(oe.key),Ue=""+oe.key),rt(oe)&&(gt=oe.ref,pt(oe,Re));for(De in oe)ve.call(oe,De)&&!Qe.hasOwnProperty(De)&&(it[De]=oe[De]);if(q&&q.defaultProps){var st=q.defaultProps;for(De in st)it[De]===void 0&&(it[De]=st[De])}if(Ue||gt){var tt=typeof q=="function"?q.displayName||q.name||"Unknown":q;Ue&&ht(it,tt),gt&&ft(it,tt)}return Ht(q,Ue,gt,Re,xe,Ee.current,it)}}var St=k.ReactCurrentOwner,er=k.ReactDebugCurrentFrame;function Xt(q){if(q){var oe=q._owner,pe=fe(q.type,q._source,oe?oe.type:null);er.setExtraStackFrame(pe)}else er.setExtraStackFrame(null)}var Ot;Ot=!1;function Bt(q){return typeof q=="object"&&q!==null&&q.$$typeof===e}function Tt(){{if(St.current){var q=m(St.current.type);if(q)return` +`+Ue[st].replace(" at new "," at ");return U.displayName&&At.includes("")&&(At=At.replace("",U.displayName)),typeof U=="function"&&R.set(U,At),At}while(st>=1&&tt>=0);break}}}finally{Q=!1,se.current=De,O(),Error.prepareStackTrace=Re}var Rt=U?U.displayName||U.name:"",Mt=Rt?X(Rt):"";return typeof U=="function"&&R.set(U,Mt),Mt}function le(U,oe,pe){return te(U,!1)}function ie(U){var oe=U.prototype;return!!(oe&&oe.isReactComponent)}function fe(U,oe,pe){if(U==null)return"";if(typeof U=="function")return te(U,ie(U));if(typeof U=="string")return X(U);switch(U){case l:return X("Suspense");case d:return X("SuspenseList")}if(typeof U=="object")switch(U.$$typeof){case u:return le(U.render);case p:return fe(U.type,oe,pe);case y:{var xe=U,Re=xe._payload,De=xe._init;try{return fe(De(Re),oe,pe)}catch{}}}return""}var ve=Object.prototype.hasOwnProperty,Me={},Ne=k.ReactDebugCurrentFrame;function Te(U){if(U){var oe=U._owner,pe=fe(U.type,U._source,oe?oe.type:null);Ne.setExtraStackFrame(pe)}else Ne.setExtraStackFrame(null)}function $e(U,oe,pe,xe,Re){{var De=Function.call.bind(ve);for(var it in U)if(De(U,it)){var Ue=void 0;try{if(typeof U[it]!="function"){var gt=Error((xe||"React class")+": "+pe+" type `"+it+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof U[it]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw gt.name="Invariant Violation",gt}Ue=U[it](oe,it,xe,pe,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(st){Ue=st}Ue&&!(Ue instanceof Error)&&(Te(Re),B("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",xe||"React class",pe,it,typeof Ue),Te(null)),Ue instanceof Error&&!(Ue.message in Me)&&(Me[Ue.message]=!0,Te(Re),B("Failed %s type: %s",pe,Ue.message),Te(null))}}}var Ie=Array.isArray;function Le(U){return Ie(U)}function Ve(U){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,pe=oe&&U[Symbol.toStringTag]||U.constructor.name||"Object";return pe}}function ke(U){try{return ze(U),!1}catch{return!0}}function ze(U){return""+U}function He(U){if(ke(U))return B("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ve(U)),ze(U)}var Se=k.ReactCurrentOwner,Qe={key:!0,ref:!0,__self:!0,__source:!0},ct,Be,et;et={};function rt(U){if(ve.call(U,"ref")){var oe=Object.getOwnPropertyDescriptor(U,"ref").get;if(oe&&oe.isReactWarning)return!1}return U.ref!==void 0}function Je(U){if(ve.call(U,"key")){var oe=Object.getOwnPropertyDescriptor(U,"key").get;if(oe&&oe.isReactWarning)return!1}return U.key!==void 0}function pt(U,oe){if(typeof U.ref=="string"&&Se.current&&oe&&Se.current.stateNode!==oe){var pe=m(Se.current.type);et[pe]||(B('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',m(Se.current.type),U.ref),et[pe]=!0)}}function ht(U,oe){{var pe=function(){ct||(ct=!0,B("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};pe.isReactWarning=!0,Object.defineProperty(U,"key",{get:pe,configurable:!0})}}function ft(U,oe){{var pe=function(){Be||(Be=!0,B("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};pe.isReactWarning=!0,Object.defineProperty(U,"ref",{get:pe,configurable:!0})}}var Ht=function(U,oe,pe,xe,Re,De,it){var Ue={$$typeof:e,type:U,key:oe,ref:pe,props:it,_owner:De};return Ue._store={},Object.defineProperty(Ue._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ue,"_self",{configurable:!1,enumerable:!1,writable:!1,value:xe}),Object.defineProperty(Ue,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Re}),Object.freeze&&(Object.freeze(Ue.props),Object.freeze(Ue)),Ue};function Jt(U,oe,pe,xe,Re){{var De,it={},Ue=null,gt=null;pe!==void 0&&(He(pe),Ue=""+pe),Je(oe)&&(He(oe.key),Ue=""+oe.key),rt(oe)&&(gt=oe.ref,pt(oe,Re));for(De in oe)ve.call(oe,De)&&!Qe.hasOwnProperty(De)&&(it[De]=oe[De]);if(U&&U.defaultProps){var st=U.defaultProps;for(De in st)it[De]===void 0&&(it[De]=st[De])}if(Ue||gt){var tt=typeof U=="function"?U.displayName||U.name||"Unknown":U;Ue&&ht(it,tt),gt&&ft(it,tt)}return Ht(U,Ue,gt,Re,xe,Se.current,it)}}var St=k.ReactCurrentOwner,er=k.ReactDebugCurrentFrame;function Xt(U){if(U){var oe=U._owner,pe=fe(U.type,U._source,oe?oe.type:null);er.setExtraStackFrame(pe)}else er.setExtraStackFrame(null)}var Ot;Ot=!1;function Bt(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function Tt(){{if(St.current){var U=m(St.current.type);if(U)return` -Check the render method of \``+q+"`."}return""}}function vt(q){return""}var Dt={};function Lt(q){{var oe=Tt();if(!oe){var pe=typeof q=="string"?q:q.displayName||q.name;pe&&(oe=` +Check the render method of \``+U+"`."}return""}}function vt(U){return""}var Dt={};function Lt(U){{var oe=Tt();if(!oe){var pe=typeof U=="string"?U:U.displayName||U.name;pe&&(oe=` -Check the top-level render call using <`+pe+">.")}return oe}}function bt(q,oe){{if(!q._store||q._store.validated||q.key!=null)return;q._store.validated=!0;var pe=Lt(oe);if(Dt[pe])return;Dt[pe]=!0;var xe="";q&&q._owner&&q._owner!==St.current&&(xe=" It was passed a child from "+m(q._owner.type)+"."),Xt(q),B('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',pe,xe),Xt(null)}}function $t(q,oe){{if(typeof q!="object")return;if(Le(q))for(var pe=0;pe",Ue=" Did you accidentally export a JSX literal instead of a component?"):st=typeof q,B("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",st,Ue)}var tt=Jt(q,oe,pe,Re,De);if(tt==null)return tt;if(it){var At=oe.children;if(At!==void 0)if(xe)if(Le(At)){for(var Rt=0;Rt0?"{key: someKey, "+Et.join(": ..., ")+": ...}":"{key: someKey}";if(!Ft[Mt+dt]){var _t=Et.length>0?"{"+Et.join(": ..., ")+": ...}":"{}";B(`A props object containing a "key" prop is being spread into JSX: +Check the top-level render call using <`+pe+">.")}return oe}}function bt(U,oe){{if(!U._store||U._store.validated||U.key!=null)return;U._store.validated=!0;var pe=Lt(oe);if(Dt[pe])return;Dt[pe]=!0;var xe="";U&&U._owner&&U._owner!==St.current&&(xe=" It was passed a child from "+m(U._owner.type)+"."),Xt(U),B('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',pe,xe),Xt(null)}}function $t(U,oe){{if(typeof U!="object")return;if(Le(U))for(var pe=0;pe",Ue=" Did you accidentally export a JSX literal instead of a component?"):st=typeof U,B("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",st,Ue)}var tt=Jt(U,oe,pe,Re,De);if(tt==null)return tt;if(it){var At=oe.children;if(At!==void 0)if(xe)if(Le(At)){for(var Rt=0;Rt0?"{key: someKey, "+Et.join(": ..., ")+": ...}":"{key: someKey}";if(!Ft[Mt+dt]){var _t=Et.length>0?"{"+Et.join(": ..., ")+": ...}":"{}";B(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; - <%s key={someKey} {...props} />`,dt,Mt,_t,Mt),Ft[Mt+dt]=!0}}return q===n?nt(tt):jt(tt),tt}}function H(q,oe,pe){return $(q,oe,pe,!0)}function V(q,oe,pe){return $(q,oe,pe,!1)}var C=V,Y=H;mf.Fragment=n,mf.jsx=C,mf.jsxs=Y}()),mf}process.env.NODE_ENV==="production"?Xp.exports=XA():Xp.exports=ZA();var ge=Xp.exports;const Rs="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2",QA=[{featured:!0,name:"MetaMask",rdns:"io.metamask",image:`${Rs}#metamask`,getWallet:{chrome_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",brave_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",edge_addon_id:"ejbalbakoplchlghecdalmeeeajnimhm",firefox_addon_id:"ether-metamask",play_store_id:"io.metamask",app_store_id:"id1438144202"},deep_link:"metamask://wc",universal_link:"https://metamask.app.link/wc"},{featured:!0,name:"OKX Wallet",rdns:"com.okex.wallet",image:`${Rs}#okx`,getWallet:{chrome_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",brave_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",edge_addon_id:"pbpjkcldjiffchgbbndmhojiacbgflha",play_store_id:"com.okinc.okex.gp",app_store_id:"id1327268470"},deep_link:"okex://main/wc",universal_link:"okex://main/wc"},{featured:!0,name:"WalletConnect",image:`${Rs}#walletconnect`},{featured:!1,name:"Coinbase Wallet",image:`${Rs}#coinbase`},{featured:!1,name:"GateWallet",rdns:"io.gate.wallet",image:`${Rs}#6e528abf-7a7d-47bd-d84d-481f169b1200`,getWallet:{chrome_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",brave_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",play_store_id:"com.gateio.gateio",app_store_id:"id1294998195",mac_app_store_id:"id1609559473"},deep_link:"https://www.gate.io/mobileapp",universal_link:"https://www.gate.io/mobileapp"},{featured:!1,name:"Onekey",rdns:"so.onekey.app.wallet",image:`${Rs}#onekey`,getWallet:{chrome_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",brave_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",play_store_id:"so.onekey.app.wallet",app_store_id:"id1609559473"},deep_link:"onekey-wallet://",universal_link:"onekey://wc"},{featured:!1,name:"Infinity Wallet",image:`${Rs}#9f259366-0bcd-4817-0af9-f78773e41900`,desktop_link:"infinity://wc"},{name:"Rabby Wallet",rdns:"io.rabby",featured:!1,image:`${Rs}#rabby`,getWallet:{chrome_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",brave_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",play_store_id:"com.debank.rabbymobile",app_store_id:"id6474381673"}},{name:"Binance Web3 Wallet",featured:!1,image:`${Rs}#ebac7b39-688c-41e3-7912-a4fefba74600`,getWallet:{play_store_id:"com.binance.dev",app_store_id:"id1436799971"}},{name:"Rainbow Wallet",rdns:"me.rainbow",featured:!1,image:`${Rs}#rainbow`,getWallet:{chrome_store_id:"opfgelmcmbiajamepnmloijbpoleiama",edge_addon_id:"cpojfbodiccabbabgimdeohkkpjfpbnf",firefox_addon_id:"rainbow-extension",app_store_id:"id1457119021",play_store_id:"me.rainbow"}}];function eP(t,e){const r=t.exec(e);return r==null?void 0:r.groups}const Gy=/^tuple(?(\[(\d*)\])*)$/;function Zp(t){let e=t.type;if(Gy.test(t.type)&&"components"in t){e="(";const r=t.components.length;for(let i=0;ie(t,s)}function Bc(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new dP(t.type);return`${t.name}(${Qp(t.inputs,{includeName:e})})`}function Qp(t,{includeName:e=!1}={}){return t?t.map(r=>rP(r,{includeName:e})).join(e?", ":","):""}function rP(t,{includeName:e}){return t.type.startsWith("tuple")?`(${Qp(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}function Jo(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function _n(t){return Jo(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const Yy="2.21.45";let bf={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${Yy}`};class yt extends Error{constructor(e,r={}){var a;const n=(()=>{var u;return r.cause instanceof yt?r.cause.details:(u=r.cause)!=null&&u.message?r.cause.message:r.details})(),i=r.cause instanceof yt&&r.cause.docsPath||r.docsPath,s=(a=bf.getDocsUrl)==null?void 0:a.call(bf,{...r,docsPath:i}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...bf.version?[`Version: ${bf.version}`]:[]].join(` -`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=Yy}walk(e){return Jy(this,e)}}function Jy(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?Jy(t.cause,e):e?null:t}class nP extends yt{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` -`),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class Xy extends yt{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` + <%s key={someKey} {...props} />`,dt,Mt,_t,Mt),Ft[Mt+dt]=!0}}return U===n?nt(tt):jt(tt),tt}}function W(U,oe,pe){return $(U,oe,pe,!0)}function V(U,oe,pe){return $(U,oe,pe,!1)}var C=V,Y=W;vf.Fragment=n,vf.jsx=C,vf.jsxs=Y}()),vf}process.env.NODE_ENV==="production"?Xp.exports=XA():Xp.exports=ZA();var ge=Xp.exports;const Rs="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2",QA=[{featured:!0,name:"MetaMask",rdns:"io.metamask",image:`${Rs}#metamask`,getWallet:{chrome_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",brave_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",edge_addon_id:"ejbalbakoplchlghecdalmeeeajnimhm",firefox_addon_id:"ether-metamask",play_store_id:"io.metamask",app_store_id:"id1438144202"},deep_link:"metamask://wc",universal_link:"https://metamask.app.link/wc"},{featured:!0,name:"OKX Wallet",rdns:"com.okex.wallet",image:`${Rs}#okx`,getWallet:{chrome_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",brave_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",edge_addon_id:"pbpjkcldjiffchgbbndmhojiacbgflha",play_store_id:"com.okinc.okex.gp",app_store_id:"id1327268470"},deep_link:"okex://main/wc",universal_link:"okex://main/wc"},{featured:!0,name:"WalletConnect",image:`${Rs}#walletconnect`},{featured:!1,name:"Coinbase Wallet",image:`${Rs}#coinbase`},{featured:!1,name:"GateWallet",rdns:"io.gate.wallet",image:`${Rs}#6e528abf-7a7d-47bd-d84d-481f169b1200`,getWallet:{chrome_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",brave_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",play_store_id:"com.gateio.gateio",app_store_id:"id1294998195",mac_app_store_id:"id1609559473"},deep_link:"https://www.gate.io/mobileapp",universal_link:"https://www.gate.io/mobileapp"},{featured:!1,name:"Onekey",rdns:"so.onekey.app.wallet",image:`${Rs}#onekey`,getWallet:{chrome_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",brave_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",play_store_id:"so.onekey.app.wallet",app_store_id:"id1609559473"},deep_link:"onekey-wallet://",universal_link:"onekey://wc"},{featured:!1,name:"Infinity Wallet",image:`${Rs}#9f259366-0bcd-4817-0af9-f78773e41900`,desktop_link:"infinity://wc"},{name:"Rabby Wallet",rdns:"io.rabby",featured:!1,image:`${Rs}#rabby`,getWallet:{chrome_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",brave_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",play_store_id:"com.debank.rabbymobile",app_store_id:"id6474381673"}},{name:"Binance Web3 Wallet",featured:!1,image:`${Rs}#ebac7b39-688c-41e3-7912-a4fefba74600`,getWallet:{play_store_id:"com.binance.dev",app_store_id:"id1436799971"}},{name:"Rainbow Wallet",rdns:"me.rainbow",featured:!1,image:`${Rs}#rainbow`,getWallet:{chrome_store_id:"opfgelmcmbiajamepnmloijbpoleiama",edge_addon_id:"cpojfbodiccabbabgimdeohkkpjfpbnf",firefox_addon_id:"rainbow-extension",app_store_id:"id1457119021",play_store_id:"me.rainbow"}}];function eP(t,e){const r=t.exec(e);return r==null?void 0:r.groups}const Yy=/^tuple(?(\[(\d*)\])*)$/;function Zp(t){let e=t.type;if(Yy.test(t.type)&&"components"in t){e="(";const r=t.components.length;for(let i=0;ie(t,s)}function Bc(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new dP(t.type);return`${t.name}(${Qp(t.inputs,{includeName:e})})`}function Qp(t,{includeName:e=!1}={}){return t?t.map(r=>rP(r,{includeName:e})).join(e?", ":","):""}function rP(t,{includeName:e}){return t.type.startsWith("tuple")?`(${Qp(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}function Jo(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function _n(t){return Jo(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const Jy="2.21.45";let yf={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${Jy}`};class yt extends Error{constructor(e,r={}){var a;const n=(()=>{var u;return r.cause instanceof yt?r.cause.details:(u=r.cause)!=null&&u.message?r.cause.message:r.details})(),i=r.cause instanceof yt&&r.cause.docsPath||r.docsPath,s=(a=yf.getDocsUrl)==null?void 0:a.call(yf,{...r,docsPath:i}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...yf.version?[`Version: ${yf.version}`]:[]].join(` +`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=Jy}walk(e){return Xy(this,e)}}function Xy(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?Xy(t.cause,e):e?null:t}class nP extends yt{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` +`),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class Zy extends yt{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` `),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class iP extends yt{constructor({data:e,params:r,size:n}){super([`Data size of ${n} bytes is too small for given parameters.`].join(` `),{metaMessages:[`Params: (${Qp(r,{includeName:!0})})`,`Data: ${e} (${n} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=r,this.size=n}}class eg extends yt{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class sP extends yt{constructor({expectedLength:e,givenLength:r,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${e}`,`Given length: ${r}`].join(` `),{name:"AbiEncodingArrayLengthMismatchError"})}}class oP extends yt{constructor({expectedSize:e,value:r}){super(`Size of bytes "${r}" (bytes${_n(r)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class aP extends yt{constructor({expectedLength:e,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${r}`].join(` -`),{name:"AbiEncodingLengthMismatchError"})}}class Zy extends yt{constructor(e,{docsPath:r}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(` -`),{docsPath:r,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class Qy extends yt{constructor(e,{docsPath:r}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` +`),{name:"AbiEncodingLengthMismatchError"})}}class Qy extends yt{constructor(e,{docsPath:r}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(` +`),{docsPath:r,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class ew extends yt{constructor(e,{docsPath:r}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` `),{docsPath:r,name:"AbiFunctionNotFoundError"})}}class cP extends yt{constructor(e,r){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${Bc(e.abiItem)}\`, and`,`\`${r.type}\` in \`${Bc(r.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class uP extends yt{constructor({expectedSize:e,givenSize:r}){super(`Expected bytes${e}, got bytes${r}.`,{name:"BytesSizeMismatchError"})}}class fP extends yt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(` `),{docsPath:r,name:"InvalidAbiEncodingType"})}}class lP extends yt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` `),{docsPath:r,name:"InvalidAbiDecodingType"})}}class hP extends yt{constructor(e){super([`Value "${e}" is not a valid array.`].join(` `),{name:"InvalidArrayError"})}}class dP extends yt{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` -`),{name:"InvalidDefinitionTypeError"})}}class ew extends yt{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}class tw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}class rw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function $c(t,{dir:e,size:r=32}={}){return typeof t=="string"?Xo(t,{dir:e,size:r}):pP(t,{dir:e,size:r})}function Xo(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new tw({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function pP(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new tw({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie)throw new vP({givenSize:_n(t),maxSize:e})}function yf(t,e={}){const{signed:r}=e;e.size&&Ds(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<e.toString(16).padStart(2,"0"));function Dh(t,e={}){return typeof t=="number"||typeof t=="bigint"?Pr(t,e):typeof t=="string"?Oh(t,e):typeof t=="boolean"?nw(t,e):li(t,e)}function nw(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(Ds(r,{size:e.size}),$c(r,{size:e.size})):r}function li(t,e={}){let r="";for(let i=0;is||i=ao.zero&&t<=ao.nine)return t-ao.zero;if(t>=ao.A&&t<=ao.F)return t-(ao.A-10);if(t>=ao.a&&t<=ao.f)return t-(ao.a-10)}function co(t,e={}){let r=t;e.size&&(Ds(r,{size:e.size}),r=$c(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function SP(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Nh(t.outputLen),Nh(t.blockLen)}function Uc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function ow(t,e){jc(t);const r=e.outputLen;if(t.length>aw&Lh)}:{h:Number(t>>aw&Lh)|0,l:Number(t&Lh)|0}}function PP(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;it<>>32-r,IP=(t,e,r)=>e<>>32-r,CP=(t,e,r)=>e<>>64-r,TP=(t,e,r)=>t<>>64-r,qc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const RP=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),ng=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Os=(t,e)=>t<<32-e|t>>>e,cw=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,DP=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function uw(t){for(let e=0;ee.toString(16).padStart(2,"0"));function NP(t){jc(t);let e="";for(let r=0;rt().update(wf(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function BP(t){const e=(n,i)=>t(i).update(wf(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function $P(t=32){if(qc&&typeof qc.getRandomValues=="function")return qc.getRandomValues(new Uint8Array(t));if(qc&&typeof qc.randomBytes=="function")return qc.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const lw=[],hw=[],dw=[],FP=BigInt(0),xf=BigInt(1),jP=BigInt(2),UP=BigInt(7),qP=BigInt(256),zP=BigInt(113);for(let t=0,e=xf,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],lw.push(2*(5*n+r)),hw.push((t+1)*(t+2)/2%64);let i=FP;for(let s=0;s<7;s++)e=(e<>UP)*zP)%qP,e&jP&&(i^=xf<<(xf<r>32?CP(t,e,r):MP(t,e,r),gw=(t,e,r)=>r>32?TP(t,e,r):IP(t,e,r);function mw(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,u=(o+2)%10,l=r[u],d=r[u+1],p=pw(l,d,1)^r[a],y=gw(l,d,1)^r[a+1];for(let A=0;A<50;A+=10)t[o+A]^=p,t[o+A+1]^=y}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=hw[o],u=pw(i,s,a),l=gw(i,s,a),d=lw[o];i=t[d],s=t[d+1],t[d]=u,t[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=HP[n],t[1]^=WP[n]}r.fill(0)}class _f extends ig{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Nh(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=RP(this.state)}keccak(){cw||uw(this.state32),mw(this.state32,this.rounds),cw||uw(this.state32),this.posOut=0,this.pos=0}update(e){Uc(this);const{blockLen:r,state:n}=this;e=wf(e);const i=e.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Nh(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(ow(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new _f(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Zo=(t,e,r)=>fw(()=>new _f(e,t,r)),KP=Zo(6,144,224/8),VP=Zo(6,136,256/8),GP=Zo(6,104,384/8),YP=Zo(6,72,512/8),JP=Zo(1,144,224/8),vw=Zo(1,136,256/8),XP=Zo(1,104,384/8),ZP=Zo(1,72,512/8),bw=(t,e,r)=>BP((n={})=>new _f(e,t,n.dkLen===void 0?r:n.dkLen,!0)),QP=bw(31,168,128/8),eM=bw(31,136,256/8),tM=Object.freeze(Object.defineProperty({__proto__:null,Keccak:_f,keccakP:mw,keccak_224:JP,keccak_256:vw,keccak_384:XP,keccak_512:ZP,sha3_224:KP,sha3_256:VP,sha3_384:GP,sha3_512:YP,shake128:QP,shake256:eM},Symbol.toStringTag,{value:"Module"}));function Ef(t,e){const r=e||"hex",n=vw(Jo(t,{strict:!1})?rg(t):t);return r==="bytes"?n:Dh(n)}const rM=t=>Ef(rg(t));function nM(t){return rM(t)}function iM(t){let e=!0,r="",n=0,i="",s=!1;for(let o=0;o{const e=typeof t=="string"?t:tP(t);return iM(e)};function yw(t){return nM(sM(t))}const oM=yw;class zc extends yt{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class kh extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const sg=new kh(8192);function Sf(t,e){if(sg.has(`${t}.${e}`))return sg.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=Ef(sw(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return sg.set(`${t}.${e}`,s),s}function og(t,e){if(!uo(t,{strict:!1}))throw new zc({address:t});return Sf(t,e)}const aM=/^0x[a-fA-F0-9]{40}$/,ag=new kh(8192);function uo(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(ag.has(n))return ag.get(n);const i=aM.test(t)?t.toLowerCase()===t?!0:r?Sf(t)===t:!0:!1;return ag.set(n,i),i}function Hc(t){return typeof t[0]=="string"?Bh(t):cM(t)}function cM(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function Bh(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}function $h(t,e,r,{strict:n}={}){return Jo(t,{strict:!1})?uM(t,e,r,{strict:n}):_w(t,e,r,{strict:n})}function ww(t,e){if(typeof e=="number"&&e>0&&e>_n(t)-1)throw new ew({offset:e,position:"start",size:_n(t)})}function xw(t,e,r){if(typeof e=="number"&&typeof r=="number"&&_n(t)!==r-e)throw new ew({offset:r,position:"end",size:_n(t)})}function _w(t,e,r,{strict:n}={}){ww(t,e);const i=t.slice(e,r);return n&&xw(i,e,r),i}function uM(t,e,r,{strict:n}={}){ww(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&xw(i,e,r),i}function Ew(t,e){if(t.length!==e.length)throw new aP({expectedLength:t.length,givenLength:e.length});const r=fM({params:t,values:e}),n=ug(r);return n.length===0?"0x":n}function fM({params:t,values:e}){const r=[];for(let n=0;n0?Hc([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:Hc(s.map(({encoded:o})=>o))}}function dM(t,{param:e}){const[,r]=e.type.split("bytes"),n=_n(t);if(!r){let i=t;return n%32!==0&&(i=Xo(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:Hc([Xo(Pr(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new oP({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:Xo(t,{dir:"right"})}}function pM(t){if(typeof t!="boolean")throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Xo(nw(t))}}function gM(t,{signed:e}){return{dynamic:!1,encoded:Pr(t,{size:32,signed:e})}}function mM(t){const e=Oh(t),r=Math.ceil(_n(e)/32),n=[];for(let i=0;ii))}}function fg(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const lg=t=>$h(yw(t),0,4);function Sw(t){const{abi:e,args:r=[],name:n}=t,i=Jo(n,{strict:!1}),s=e.filter(a=>i?a.type==="function"?lg(a)===n:a.type==="event"?oM(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((l,d)=>{const p="inputs"in a&&a.inputs[d];return p?hg(l,p):!1})){if(o&&"inputs"in o&&o.inputs){const l=Aw(a.inputs,o.inputs,r);if(l)throw new cP({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||s[0]}function hg(t,e){const r=typeof t,n=e.type;switch(n){case"address":return uo(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>hg(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>hg(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Aw(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return Aw(i.components,s.components,r[n]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?uo(r[n],{strict:!1}):o.includes("address")&&o.includes("bytes")?uo(r[n],{strict:!1}):!1)return o}}function fo(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const Pw="/docs/contract/encodeFunctionData";function bM(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=Sw({abi:e,args:r,name:n});if(!s)throw new Qy(n,{docsPath:Pw});i=s}if(i.type!=="function")throw new Qy(void 0,{docsPath:Pw});return{abi:[i],functionName:lg(Bc(i))}}function yM(t){const{args:e}=t,{abi:r,functionName:n}=(()=>{var a;return t.abi.length===1&&((a=t.functionName)!=null&&a.startsWith("0x"))?t:bM(t)})(),i=r[0],s=n,o="inputs"in i&&i.inputs?Ew(i.inputs,e??[]):void 0;return Bh([s,o??"0x"])}const wM={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},xM={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},_M={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Mw extends yt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class EM extends yt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class SM extends yt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const AM={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new SM({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new EM({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Mw({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Mw({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function dg(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(AM);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function PM(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return yf(r,e)}function MM(t,e={}){let r=t;if(typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r)),r.length>1||r[0]>1)throw new mP(r);return!!r[0]}function lo(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return Fc(r,e)}function IM(t,e={}){let r=t;return typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r,{dir:"right"})),new TextDecoder().decode(r)}function CM(t,e){const r=typeof e=="string"?co(e):e,n=dg(r);if(_n(r)===0&&t.length>0)throw new eg;if(_n(e)&&_n(e)<32)throw new iP({data:typeof e=="string"?e:li(e),params:t,size:_n(e)});let i=0;const s=[];for(let o=0;o48?PM(i,{signed:r}):lo(i,{signed:r}),32]}function LM(t,e,{staticPosition:r}){const n=e.components.length===0||e.components.some(({name:o})=>!o),i=n?[]:{};let s=0;if(Af(e)){const o=lo(t.readBytes(pg)),a=r+o;for(let u=0;uo.type==="error"&&n===lg(Bc(o)));if(!s)throw new Zy(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?CM(s.inputs,$h(r,4)):void 0,errorName:s.name}}const Kc=(t,e,r)=>JSON.stringify(t,(n,i)=>typeof i=="bigint"?i.toString():i,r);function Cw({abiItem:t,args:e,includeFunctionName:r=!0,includeName:n=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${r?t.name:""}(${t.inputs.map((i,s)=>`${n&&i.name?`${i.name}: `:""}${typeof e[s]=="object"?Kc(e[s]):e[s]}`).join(", ")})`}const $M={gwei:9,wei:18},FM={ether:-9,wei:9};function Tw(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}function Rw(t,e="wei"){return Tw(t,$M[e])}function hs(t,e="wei"){return Tw(t,FM[e])}class jM extends yt{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class UM extends yt{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Fh(t){const e=Object.entries(t).map(([n,i])=>i===void 0||i===!1?null:[n,i]).filter(Boolean),r=e.reduce((n,[i])=>Math.max(n,i.length),0);return e.map(([n,i])=>` ${`${n}:`.padEnd(r+1)} ${i}`).join(` +`),{name:"InvalidDefinitionTypeError"})}}class tw extends yt{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}class rw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}class nw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function $c(t,{dir:e,size:r=32}={}){return typeof t=="string"?Xo(t,{dir:e,size:r}):pP(t,{dir:e,size:r})}function Xo(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new rw({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function pP(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new rw({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie)throw new vP({givenSize:_n(t),maxSize:e})}function wf(t,e={}){const{signed:r}=e;e.size&&Ds(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<e.toString(16).padStart(2,"0"));function Dh(t,e={}){return typeof t=="number"||typeof t=="bigint"?Pr(t,e):typeof t=="string"?Oh(t,e):typeof t=="boolean"?iw(t,e):li(t,e)}function iw(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(Ds(r,{size:e.size}),$c(r,{size:e.size})):r}function li(t,e={}){let r="";for(let i=0;is||i=ao.zero&&t<=ao.nine)return t-ao.zero;if(t>=ao.A&&t<=ao.F)return t-(ao.A-10);if(t>=ao.a&&t<=ao.f)return t-(ao.a-10)}function co(t,e={}){let r=t;e.size&&(Ds(r,{size:e.size}),r=$c(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function SP(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Nh(t.outputLen),Nh(t.blockLen)}function Uc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function aw(t,e){jc(t);const r=e.outputLen;if(t.length>cw&Lh)}:{h:Number(t>>cw&Lh)|0,l:Number(t&Lh)|0}}function PP(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;it<>>32-r,IP=(t,e,r)=>e<>>32-r,CP=(t,e,r)=>e<>>64-r,TP=(t,e,r)=>t<>>64-r,qc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const RP=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),ng=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Os=(t,e)=>t<<32-e|t>>>e,uw=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,DP=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function fw(t){for(let e=0;ee.toString(16).padStart(2,"0"));function NP(t){jc(t);let e="";for(let r=0;rt().update(xf(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function BP(t){const e=(n,i)=>t(i).update(xf(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function $P(t=32){if(qc&&typeof qc.getRandomValues=="function")return qc.getRandomValues(new Uint8Array(t));if(qc&&typeof qc.randomBytes=="function")return qc.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const hw=[],dw=[],pw=[],FP=BigInt(0),_f=BigInt(1),jP=BigInt(2),UP=BigInt(7),qP=BigInt(256),zP=BigInt(113);for(let t=0,e=_f,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],hw.push(2*(5*n+r)),dw.push((t+1)*(t+2)/2%64);let i=FP;for(let s=0;s<7;s++)e=(e<<_f^(e>>UP)*zP)%qP,e&jP&&(i^=_f<<(_f<r>32?CP(t,e,r):MP(t,e,r),mw=(t,e,r)=>r>32?TP(t,e,r):IP(t,e,r);function vw(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,u=(o+2)%10,l=r[u],d=r[u+1],p=gw(l,d,1)^r[a],y=mw(l,d,1)^r[a+1];for(let A=0;A<50;A+=10)t[o+A]^=p,t[o+A+1]^=y}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=dw[o],u=gw(i,s,a),l=mw(i,s,a),d=hw[o];i=t[d],s=t[d+1],t[d]=u,t[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=HP[n],t[1]^=WP[n]}r.fill(0)}class Ef extends ig{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Nh(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=RP(this.state)}keccak(){uw||fw(this.state32),vw(this.state32,this.rounds),uw||fw(this.state32),this.posOut=0,this.pos=0}update(e){Uc(this);const{blockLen:r,state:n}=this;e=xf(e);const i=e.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Nh(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(aw(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new Ef(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Zo=(t,e,r)=>lw(()=>new Ef(e,t,r)),KP=Zo(6,144,224/8),VP=Zo(6,136,256/8),GP=Zo(6,104,384/8),YP=Zo(6,72,512/8),JP=Zo(1,144,224/8),bw=Zo(1,136,256/8),XP=Zo(1,104,384/8),ZP=Zo(1,72,512/8),yw=(t,e,r)=>BP((n={})=>new Ef(e,t,n.dkLen===void 0?r:n.dkLen,!0)),QP=yw(31,168,128/8),eM=yw(31,136,256/8),tM=Object.freeze(Object.defineProperty({__proto__:null,Keccak:Ef,keccakP:vw,keccak_224:JP,keccak_256:bw,keccak_384:XP,keccak_512:ZP,sha3_224:KP,sha3_256:VP,sha3_384:GP,sha3_512:YP,shake128:QP,shake256:eM},Symbol.toStringTag,{value:"Module"}));function Sf(t,e){const r=e||"hex",n=bw(Jo(t,{strict:!1})?rg(t):t);return r==="bytes"?n:Dh(n)}const rM=t=>Sf(rg(t));function nM(t){return rM(t)}function iM(t){let e=!0,r="",n=0,i="",s=!1;for(let o=0;o{const e=typeof t=="string"?t:tP(t);return iM(e)};function ww(t){return nM(sM(t))}const oM=ww;class zc extends yt{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class kh extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const sg=new kh(8192);function Af(t,e){if(sg.has(`${t}.${e}`))return sg.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=Sf(ow(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return sg.set(`${t}.${e}`,s),s}function og(t,e){if(!uo(t,{strict:!1}))throw new zc({address:t});return Af(t,e)}const aM=/^0x[a-fA-F0-9]{40}$/,ag=new kh(8192);function uo(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(ag.has(n))return ag.get(n);const i=aM.test(t)?t.toLowerCase()===t?!0:r?Af(t)===t:!0:!1;return ag.set(n,i),i}function Hc(t){return typeof t[0]=="string"?Bh(t):cM(t)}function cM(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function Bh(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}function $h(t,e,r,{strict:n}={}){return Jo(t,{strict:!1})?uM(t,e,r,{strict:n}):Ew(t,e,r,{strict:n})}function xw(t,e){if(typeof e=="number"&&e>0&&e>_n(t)-1)throw new tw({offset:e,position:"start",size:_n(t)})}function _w(t,e,r){if(typeof e=="number"&&typeof r=="number"&&_n(t)!==r-e)throw new tw({offset:r,position:"end",size:_n(t)})}function Ew(t,e,r,{strict:n}={}){xw(t,e);const i=t.slice(e,r);return n&&_w(i,e,r),i}function uM(t,e,r,{strict:n}={}){xw(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&_w(i,e,r),i}function Sw(t,e){if(t.length!==e.length)throw new aP({expectedLength:t.length,givenLength:e.length});const r=fM({params:t,values:e}),n=ug(r);return n.length===0?"0x":n}function fM({params:t,values:e}){const r=[];for(let n=0;n0?Hc([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:Hc(s.map(({encoded:o})=>o))}}function dM(t,{param:e}){const[,r]=e.type.split("bytes"),n=_n(t);if(!r){let i=t;return n%32!==0&&(i=Xo(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:Hc([Xo(Pr(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new oP({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:Xo(t,{dir:"right"})}}function pM(t){if(typeof t!="boolean")throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Xo(iw(t))}}function gM(t,{signed:e}){return{dynamic:!1,encoded:Pr(t,{size:32,signed:e})}}function mM(t){const e=Oh(t),r=Math.ceil(_n(e)/32),n=[];for(let i=0;ii))}}function fg(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const lg=t=>$h(ww(t),0,4);function Aw(t){const{abi:e,args:r=[],name:n}=t,i=Jo(n,{strict:!1}),s=e.filter(a=>i?a.type==="function"?lg(a)===n:a.type==="event"?oM(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((l,d)=>{const p="inputs"in a&&a.inputs[d];return p?hg(l,p):!1})){if(o&&"inputs"in o&&o.inputs){const l=Pw(a.inputs,o.inputs,r);if(l)throw new cP({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||s[0]}function hg(t,e){const r=typeof t,n=e.type;switch(n){case"address":return uo(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>hg(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>hg(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Pw(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return Pw(i.components,s.components,r[n]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?uo(r[n],{strict:!1}):o.includes("address")&&o.includes("bytes")?uo(r[n],{strict:!1}):!1)return o}}function fo(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const Mw="/docs/contract/encodeFunctionData";function bM(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=Aw({abi:e,args:r,name:n});if(!s)throw new ew(n,{docsPath:Mw});i=s}if(i.type!=="function")throw new ew(void 0,{docsPath:Mw});return{abi:[i],functionName:lg(Bc(i))}}function yM(t){const{args:e}=t,{abi:r,functionName:n}=(()=>{var a;return t.abi.length===1&&((a=t.functionName)!=null&&a.startsWith("0x"))?t:bM(t)})(),i=r[0],s=n,o="inputs"in i&&i.inputs?Sw(i.inputs,e??[]):void 0;return Bh([s,o??"0x"])}const wM={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},xM={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},_M={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Iw extends yt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class EM extends yt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class SM extends yt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const AM={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new SM({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new EM({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Iw({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Iw({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function dg(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(AM);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function PM(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return wf(r,e)}function MM(t,e={}){let r=t;if(typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r)),r.length>1||r[0]>1)throw new mP(r);return!!r[0]}function lo(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return Fc(r,e)}function IM(t,e={}){let r=t;return typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r,{dir:"right"})),new TextDecoder().decode(r)}function CM(t,e){const r=typeof e=="string"?co(e):e,n=dg(r);if(_n(r)===0&&t.length>0)throw new eg;if(_n(e)&&_n(e)<32)throw new iP({data:typeof e=="string"?e:li(e),params:t,size:_n(e)});let i=0;const s=[];for(let o=0;o48?PM(i,{signed:r}):lo(i,{signed:r}),32]}function LM(t,e,{staticPosition:r}){const n=e.components.length===0||e.components.some(({name:o})=>!o),i=n?[]:{};let s=0;if(Pf(e)){const o=lo(t.readBytes(pg)),a=r+o;for(let u=0;uo.type==="error"&&n===lg(Bc(o)));if(!s)throw new Qy(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?CM(s.inputs,$h(r,4)):void 0,errorName:s.name}}const Kc=(t,e,r)=>JSON.stringify(t,(n,i)=>typeof i=="bigint"?i.toString():i,r);function Tw({abiItem:t,args:e,includeFunctionName:r=!0,includeName:n=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${r?t.name:""}(${t.inputs.map((i,s)=>`${n&&i.name?`${i.name}: `:""}${typeof e[s]=="object"?Kc(e[s]):e[s]}`).join(", ")})`}const $M={gwei:9,wei:18},FM={ether:-9,wei:9};function Rw(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}function Dw(t,e="wei"){return Rw(t,$M[e])}function hs(t,e="wei"){return Rw(t,FM[e])}class jM extends yt{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class UM extends yt{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Fh(t){const e=Object.entries(t).map(([n,i])=>i===void 0||i===!1?null:[n,i]).filter(Boolean),r=e.reduce((n,[i])=>Math.max(n,i.length),0);return e.map(([n,i])=>` ${`${n}:`.padEnd(r+1)} ${i}`).join(` `)}class qM extends yt{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(` -`),{name:"FeeConflictError"})}}class zM extends yt{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Fh(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class HM extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var P;const A=Fh({chain:i&&`${i==null?void 0:i.name} (id: ${i==null?void 0:i.id})`,from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Rw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",A].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const WM=t=>t,Dw=t=>t;class KM extends yt{constructor(e,{abi:r,args:n,contractAddress:i,docsPath:s,functionName:o,sender:a}){const u=Sw({abi:r,args:n,name:o}),l=u?Cw({abiItem:u,args:n,includeFunctionName:!1,includeName:!1}):void 0,d=u?Bc(u,{includeName:!0}):void 0,p=Fh({address:i&&WM(i),function:d,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:s,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],p&&"Contract Call:",p].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=e,this.contractAddress=i,this.functionName=o,this.sender=a}}class VM extends yt{constructor({abi:e,data:r,functionName:n,message:i}){let s,o,a,u;if(r&&r!=="0x")try{o=BM({abi:e,data:r});const{abiItem:d,errorName:p,args:y}=o;if(p==="Error")u=y[0];else if(p==="Panic"){const[A]=y;u=wM[A]}else{const A=d?Bc(d,{includeName:!0}):void 0,P=d&&y?Cw({abiItem:d,args:y,includeFunctionName:!1,includeName:!1}):void 0;a=[A?`Error: ${A}`:"",P&&P!=="()"?` ${[...Array((p==null?void 0:p.length)??0).keys()].map(()=>" ").join("")}${P}`:""]}}catch(d){s=d}else i&&(u=i);let l;s instanceof Zy&&(l=s.signature,a=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(u&&u!=="execution reverted"||l?[`The contract function "${n}" reverted with the following ${l?"signature":"reason"}:`,u||l].join(` -`):`The contract function "${n}" reverted.`,{cause:s,metaMessages:a,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.reason=u,this.signature=l}}class GM extends yt{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class YM extends yt{constructor({data:e,message:r}){super(r||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}class Ow extends yt{constructor({body:e,cause:r,details:n,headers:i,status:s,url:o}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${Dw(o)}`,e&&`Request body: ${Kc(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=i,this.status=s,this.url=o}}class JM extends yt{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${Dw(n)}`,`Request body: ${Kc(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code}}const XM=-1;class hi extends yt{constructor(e,{code:r,docsPath:n,metaMessages:i,name:s,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:i||(e==null?void 0:e.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||e.name,this.code=e instanceof JM?e.code:r??XM}}class Vc extends hi{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class Pf extends hi{constructor(e){super(e,{code:Pf.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Pf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Mf extends hi{constructor(e){super(e,{code:Mf.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Mf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class If extends hi{constructor(e,{method:r}={}){super(e,{code:If.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(If,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Cf extends hi{constructor(e){super(e,{code:Cf.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` -`)})}}Object.defineProperty(Cf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Ba extends hi{constructor(e){super(e,{code:Ba.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Ba,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Tf extends hi{constructor(e){super(e,{code:Tf.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` -`)})}}Object.defineProperty(Tf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Rf extends hi{constructor(e){super(e,{code:Rf.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Rf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Df extends hi{constructor(e){super(e,{code:Df.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Df,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Of extends hi{constructor(e){super(e,{code:Of.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Of,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Nf extends hi{constructor(e,{method:r}={}){super(e,{code:Nf.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not implemented.`})}}Object.defineProperty(Nf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Gc extends hi{constructor(e){super(e,{code:Gc.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Gc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Lf extends hi{constructor(e){super(e,{code:Lf.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Lf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Yc extends Vc{constructor(e){super(e,{code:Yc.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Yc,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class kf extends Vc{constructor(e){super(e,{code:kf.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(kf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Bf extends Vc{constructor(e,{method:r}={}){super(e,{code:Bf.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(Bf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class $f extends Vc{constructor(e){super(e,{code:$f.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty($f,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Ff extends Vc{constructor(e){super(e,{code:Ff.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Ff,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class jf extends Vc{constructor(e){super(e,{code:jf.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(jf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ZM extends hi{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const QM=3;function eI(t,{abi:e,address:r,args:n,docsPath:i,functionName:s,sender:o}){const{code:a,data:u,message:l,shortMessage:d}=t instanceof YM?t:t instanceof yt?t.walk(y=>"data"in y)||t.walk():{},p=t instanceof eg?new GM({functionName:s}):[QM,Ba.code].includes(a)&&(u||l||d)?new VM({abi:e,data:typeof u=="object"?u.data:u,functionName:s,message:d??l}):t;return new KM(p,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:o})}function tI(t){const e=Ef(`0x${t.substring(4)}`).substring(26);return Sf(`0x${e}`)}async function rI({hash:t,signature:e}){const r=Jo(t)?t:Dh(t),{secp256k1:n}=await Promise.resolve().then(()=>UC);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:d,v:p,yParity:y}=e,A=Number(y??p),P=Nw(A);return new n.Signature(yf(l),yf(d)).addRecoveryBit(P)}const o=Jo(e)?e:Dh(e),a=Fc(`0x${o.slice(130)}`),u=Nw(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Nw(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function nI({hash:t,signature:e}){return tI(await rI({hash:t,signature:e}))}function iI(t,e="hex"){const r=Lw(t),n=dg(new Uint8Array(r.length));return r.encode(n),e==="hex"?li(n.bytes):n.bytes}function Lw(t){return Array.isArray(t)?sI(t.map(e=>Lw(e))):oI(t)}function sI(t){const e=t.reduce((i,s)=>i+s.length,0),r=kw(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function oI(t){const e=typeof t=="string"?co(t):t,r=kw(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function kw(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new yt("Length is too large.")}function aI(t){const{chainId:e,contractAddress:r,nonce:n,to:i}=t,s=Ef(Bh(["0x05",iI([e?Pr(e):"0x",r,n?Pr(n):"0x"])]));return i==="bytes"?co(s):s}async function Bw(t){const{authorization:e,signature:r}=t;return nI({hash:aI(e),signature:r??e})}class cI extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var P;const A=Fh({from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Rw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",A].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class Jc extends yt{constructor({cause:e,message:r}={}){var i;const n=(i=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(Jc,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Jc,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class jh extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(jh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class gg extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(gg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class mg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(mg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class vg extends yt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` +`),{name:"FeeConflictError"})}}class zM extends yt{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Fh(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class HM extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var P;const A=Fh({chain:i&&`${i==null?void 0:i.name} (id: ${i==null?void 0:i.id})`,from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Dw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",A].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const WM=t=>t,Ow=t=>t;class KM extends yt{constructor(e,{abi:r,args:n,contractAddress:i,docsPath:s,functionName:o,sender:a}){const u=Aw({abi:r,args:n,name:o}),l=u?Tw({abiItem:u,args:n,includeFunctionName:!1,includeName:!1}):void 0,d=u?Bc(u,{includeName:!0}):void 0,p=Fh({address:i&&WM(i),function:d,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:s,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],p&&"Contract Call:",p].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=e,this.contractAddress=i,this.functionName=o,this.sender=a}}class VM extends yt{constructor({abi:e,data:r,functionName:n,message:i}){let s,o,a,u;if(r&&r!=="0x")try{o=BM({abi:e,data:r});const{abiItem:d,errorName:p,args:y}=o;if(p==="Error")u=y[0];else if(p==="Panic"){const[A]=y;u=wM[A]}else{const A=d?Bc(d,{includeName:!0}):void 0,P=d&&y?Tw({abiItem:d,args:y,includeFunctionName:!1,includeName:!1}):void 0;a=[A?`Error: ${A}`:"",P&&P!=="()"?` ${[...Array((p==null?void 0:p.length)??0).keys()].map(()=>" ").join("")}${P}`:""]}}catch(d){s=d}else i&&(u=i);let l;s instanceof Qy&&(l=s.signature,a=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(u&&u!=="execution reverted"||l?[`The contract function "${n}" reverted with the following ${l?"signature":"reason"}:`,u||l].join(` +`):`The contract function "${n}" reverted.`,{cause:s,metaMessages:a,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.reason=u,this.signature=l}}class GM extends yt{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class YM extends yt{constructor({data:e,message:r}){super(r||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}class Nw extends yt{constructor({body:e,cause:r,details:n,headers:i,status:s,url:o}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${Ow(o)}`,e&&`Request body: ${Kc(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=i,this.status=s,this.url=o}}class JM extends yt{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${Ow(n)}`,`Request body: ${Kc(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code}}const XM=-1;class hi extends yt{constructor(e,{code:r,docsPath:n,metaMessages:i,name:s,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:i||(e==null?void 0:e.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||e.name,this.code=e instanceof JM?e.code:r??XM}}class Vc extends hi{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class Mf extends hi{constructor(e){super(e,{code:Mf.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Mf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class If extends hi{constructor(e){super(e,{code:If.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(If,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Cf extends hi{constructor(e,{method:r}={}){super(e,{code:Cf.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(Cf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Tf extends hi{constructor(e){super(e,{code:Tf.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` +`)})}}Object.defineProperty(Tf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Ba extends hi{constructor(e){super(e,{code:Ba.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Ba,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Rf extends hi{constructor(e){super(e,{code:Rf.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` +`)})}}Object.defineProperty(Rf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Df extends hi{constructor(e){super(e,{code:Df.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Df,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Of extends hi{constructor(e){super(e,{code:Of.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Of,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Nf extends hi{constructor(e){super(e,{code:Nf.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Nf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Lf extends hi{constructor(e,{method:r}={}){super(e,{code:Lf.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not implemented.`})}}Object.defineProperty(Lf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Gc extends hi{constructor(e){super(e,{code:Gc.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Gc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class kf extends hi{constructor(e){super(e,{code:kf.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(kf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Yc extends Vc{constructor(e){super(e,{code:Yc.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Yc,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Bf extends Vc{constructor(e){super(e,{code:Bf.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Bf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class $f extends Vc{constructor(e,{method:r}={}){super(e,{code:$f.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty($f,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Ff extends Vc{constructor(e){super(e,{code:Ff.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Ff,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class jf extends Vc{constructor(e){super(e,{code:jf.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(jf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Uf extends Vc{constructor(e){super(e,{code:Uf.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Uf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ZM extends hi{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const QM=3;function eI(t,{abi:e,address:r,args:n,docsPath:i,functionName:s,sender:o}){const{code:a,data:u,message:l,shortMessage:d}=t instanceof YM?t:t instanceof yt?t.walk(y=>"data"in y)||t.walk():{},p=t instanceof eg?new GM({functionName:s}):[QM,Ba.code].includes(a)&&(u||l||d)?new VM({abi:e,data:typeof u=="object"?u.data:u,functionName:s,message:d??l}):t;return new KM(p,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:o})}function tI(t){const e=Sf(`0x${t.substring(4)}`).substring(26);return Af(`0x${e}`)}async function rI({hash:t,signature:e}){const r=Jo(t)?t:Dh(t),{secp256k1:n}=await Promise.resolve().then(()=>UC);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:d,v:p,yParity:y}=e,A=Number(y??p),P=Lw(A);return new n.Signature(wf(l),wf(d)).addRecoveryBit(P)}const o=Jo(e)?e:Dh(e),a=Fc(`0x${o.slice(130)}`),u=Lw(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Lw(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function nI({hash:t,signature:e}){return tI(await rI({hash:t,signature:e}))}function iI(t,e="hex"){const r=kw(t),n=dg(new Uint8Array(r.length));return r.encode(n),e==="hex"?li(n.bytes):n.bytes}function kw(t){return Array.isArray(t)?sI(t.map(e=>kw(e))):oI(t)}function sI(t){const e=t.reduce((i,s)=>i+s.length,0),r=Bw(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function oI(t){const e=typeof t=="string"?co(t):t,r=Bw(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function Bw(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new yt("Length is too large.")}function aI(t){const{chainId:e,contractAddress:r,nonce:n,to:i}=t,s=Sf(Bh(["0x05",iI([e?Pr(e):"0x",r,n?Pr(n):"0x"])]));return i==="bytes"?co(s):s}async function $w(t){const{authorization:e,signature:r}=t;return nI({hash:aI(e),signature:r??e})}class cI extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var P;const A=Fh({from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Dw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",A].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class Jc extends yt{constructor({cause:e,message:r}={}){var i;const n=(i=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(Jc,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Jc,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class jh extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(jh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class gg extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(gg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class mg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(mg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class vg extends yt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` `),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(vg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class bg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(bg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class yg extends yt{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` `),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(yg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class wg extends yt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(wg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class xg extends yt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(xg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class _g extends yt{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(_g,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Uh extends yt{constructor({cause:e,maxPriorityFeePerGas:r,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${r?` = ${hs(r)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${hs(n)} gwei`:""}).`].join(` -`),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(Uh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Eg extends yt{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function $w(t,e){const r=(t.details||"").toLowerCase(),n=t instanceof yt?t.walk(i=>(i==null?void 0:i.code)===Jc.code):t;return n instanceof yt?new Jc({cause:t,message:n.details}):Jc.nodeMessage.test(r)?new Jc({cause:t,message:t.details}):jh.nodeMessage.test(r)?new jh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):gg.nodeMessage.test(r)?new gg({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):mg.nodeMessage.test(r)?new mg({cause:t,nonce:e==null?void 0:e.nonce}):vg.nodeMessage.test(r)?new vg({cause:t,nonce:e==null?void 0:e.nonce}):bg.nodeMessage.test(r)?new bg({cause:t,nonce:e==null?void 0:e.nonce}):yg.nodeMessage.test(r)?new yg({cause:t}):wg.nodeMessage.test(r)?new wg({cause:t,gas:e==null?void 0:e.gas}):xg.nodeMessage.test(r)?new xg({cause:t,gas:e==null?void 0:e.gas}):_g.nodeMessage.test(r)?new _g({cause:t}):Uh.nodeMessage.test(r)?new Uh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new Eg({cause:t})}function uI(t,{docsPath:e,...r}){const n=(()=>{const i=$w(t,r);return i instanceof Eg?t:i})();return new cI(n,{docsPath:e,...r})}function Fw(t,{format:e}){if(!e)return{};const r={};function n(s){const o=Object.keys(s);for(const a of o)a in t&&(r[a]=t[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}const i=e(t||{});return n(i),r}const fI={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Sg(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=lI(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(r=>li(r)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=Pr(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=Pr(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=Pr(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=Pr(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=Pr(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=Pr(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=fI[t.type]),typeof t.value<"u"&&(e.value=Pr(t.value)),e}function lI(t){return t.map(e=>({address:e.contractAddress,r:e.r,s:e.s,chainId:Pr(e.chainId),nonce:Pr(e.nonce),...typeof e.yParity<"u"?{yParity:Pr(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:Pr(e.v)}:{}}))}function jw(t){if(!(!t||t.length===0))return t.reduce((e,{slot:r,value:n})=>{if(r.length!==66)throw new rw({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new rw({size:n.length,targetSize:66,type:"hex"});return e[r]=n,e},{})}function hI(t){const{balance:e,nonce:r,state:n,stateDiff:i,code:s}=t,o={};if(s!==void 0&&(o.code=s),e!==void 0&&(o.balance=Pr(e)),r!==void 0&&(o.nonce=Pr(r)),n!==void 0&&(o.state=jw(n)),i!==void 0){if(o.state)throw new UM;o.stateDiff=jw(i)}return o}function dI(t){if(!t)return;const e={};for(const{address:r,...n}of t){if(!uo(r,{strict:!1}))throw new zc({address:r});if(e[r])throw new jM({address:r});e[r]=hI(n)}return e}const pI=2n**256n-1n;function qh(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?fo(e):void 0;if(o&&!uo(o.address))throw new zc({address:o.address});if(s&&!uo(s))throw new zc({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new qM;if(n&&n>pI)throw new jh({maxFeePerGas:n});if(i&&n&&i>n)throw new Uh({maxFeePerGas:n,maxPriorityFeePerGas:i})}class gI extends yt{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Ag extends yt{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class mI extends yt{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${hs(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class vI extends yt{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}const bI={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function yI(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?Fc(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?Fc(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?bI[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=wI(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function wI(t){return t.map(e=>({contractAddress:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function xI(t){const e=(t.transactions??[]).map(r=>typeof r=="string"?r:yI(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function zh(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){var d,p,y;const s=n??"latest",o=i??!1,a=r!==void 0?Pr(r):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,o]},{dedupe:!0}):u=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]},{dedupe:!!a}),!u)throw new vI({blockHash:e,blockNumber:r});return(((y=(p=(d=t.chain)==null?void 0:d.formatters)==null?void 0:p.block)==null?void 0:y.format)||xI)(u)}async function Uw(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function _I(t,e){var s,o;const{block:r,chain:n=t.chain,request:i}=e||{};try{const a=((s=n==null?void 0:n.fees)==null?void 0:s.maxPriorityFeePerGas)??((o=n==null?void 0:n.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=r||await fi(t,zh,"getBlock")({}),d=await a({block:l,client:t,request:i});if(d===null)throw new Error;return d}if(typeof a<"u")return a;const u=await t.request({method:"eth_maxPriorityFeePerGas"});return yf(u)}catch{const[a,u]=await Promise.all([r?Promise.resolve(r):fi(t,zh,"getBlock")({}),fi(t,Uw,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new Ag;const l=u-a.baseFeePerGas;return l<0n?0n:l}}async function qw(t,e){var y,A;const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>{var P,N;return typeof((P=n==null?void 0:n.fees)==null?void 0:P.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):((N=n==null?void 0:n.fees)==null?void 0:N.baseFeeMultiplier)??1.2})();if(o<1)throw new gI;const u=10**(((y=o.toString().split(".")[1])==null?void 0:y.length)??0),l=P=>P*BigInt(Math.ceil(o*u))/BigInt(u),d=r||await fi(t,zh,"getBlock")({});if(typeof((A=n==null?void 0:n.fees)==null?void 0:A.estimateFeesPerGas)=="function"){const P=await n.fees.estimateFeesPerGas({block:r,client:t,multiply:l,request:i,type:s});if(P!==null)return P}if(s==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new Ag;const P=typeof(i==null?void 0:i.maxPriorityFeePerGas)=="bigint"?i.maxPriorityFeePerGas:await _I(t,{block:d,chain:n,request:i}),N=l(d.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??N+P,maxPriorityFeePerGas:P}}return{gasPrice:(i==null?void 0:i.gasPrice)??l(await fi(t,Uw,"getGasPrice")({}))}}async function EI(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,n?Pr(n):r]},{dedupe:!!n});return Fc(i)}function zw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(s=>co(s)):t.blobs,i=[];for(const s of n)i.push(Uint8Array.from(e.blobToKzgCommitment(s)));return r==="bytes"?i:i.map(s=>li(s))}function Hw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>co(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>co(o)):t.commitments,s=[];for(let o=0;oli(o))}function SI(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),u=n?4:0,l=n?0:4;t.setUint32(e+u,o,n),t.setUint32(e+l,a,n)}const AI=(t,e,r)=>t&e^~t&r,PI=(t,e,r)=>t&e^t&r^e&r;class MI extends ig{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ng(this.buffer)}update(e){Uc(this);const{view:r,buffer:n,blockLen:i}=this;e=wf(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let p=o;pd.length)throw new Error("_sha2: outputLen bigger than state");for(let p=0;p>>3,N=Os(A,17)^Os(A,19)^A>>>10;ea[p]=N+ea[p-7]+P+ea[p-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:u,G:l,H:d}=this;for(let p=0;p<64;p++){const y=Os(a,6)^Os(a,11)^Os(a,25),A=d+y+AI(a,u,l)+II[p]+ea[p]|0,N=(Os(n,2)^Os(n,13)^Os(n,22))+PI(n,i,s)|0;d=l,l=u,u=a,a=o+A|0,o=s,s=i,i=n,n=A+N|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(n,i,s,o,a,u,l,d)}roundClean(){ea.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Pg=fw(()=>new CI);function TI(t,e){return Pg(Jo(t,{strict:!1})?rg(t):t)}function RI(t){const{commitment:e,version:r=1}=t,n=t.to??(typeof e=="string"?"hex":"bytes"),i=TI(e);return i.set([r],0),n==="bytes"?i:li(i)}function DI(t){const{commitments:e,version:r}=t,n=t.to??(typeof e[0]=="string"?"hex":"bytes"),i=[];for(const s of e)i.push(RI({commitment:s,to:n,version:r}));return i}const Ww=6,Kw=32,Mg=4096,Vw=Kw*Mg,Gw=Vw*Ww-1-1*Mg*Ww;class OI extends yt{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class NI extends yt{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function LI(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),r=typeof t.data=="string"?co(t.data):t.data,n=_n(r);if(!n)throw new NI;if(n>Gw)throw new OI({maxSize:Gw,size:n});const i=[];let s=!0,o=0;for(;s;){const a=dg(new Uint8Array(Vw));let u=0;for(;ua.bytes):i.map(a=>li(a.bytes))}function kI(t){const{data:e,kzg:r,to:n}=t,i=t.blobs??LI({data:e,to:n}),s=t.commitments??zw({blobs:i,kzg:r,to:n}),o=t.proofs??Hw({blobs:i,commitments:s,kzg:r,to:n}),a=[];for(let u=0;u"u"&&p)if(u){const k=await D();y.nonce=await u.consume({address:p.address,chainId:k,client:t})}else y.nonce=await fi(t,EI,"getTransactionCount")({address:p.address,blockTag:"pending"});if((l.includes("fees")||l.includes("type"))&&typeof d>"u")try{y.type=BI(y)}catch{const k=await P();y.type=typeof(k==null?void 0:k.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(l.includes("fees"))if(y.type!=="legacy"&&y.type!=="eip2930"){if(typeof y.maxFeePerGas>"u"||typeof y.maxPriorityFeePerGas>"u"){const k=await P(),{maxFeePerGas:B,maxPriorityFeePerGas:j}=await qw(t,{block:k,chain:i,request:y});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(y.gas=await fi(t,FI,"estimateGas")({...y,account:p&&{address:p.address,type:"json-rpc"}})),qh(y),delete y.parameters,y}async function $I(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=r?Pr(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function FI(t,e){var i,s,o;const{account:r=t.account}=e,n=r?fo(r):void 0;try{let f=function(v){const{block:x,request:_,rpcStateOverride:S}=v;return t.request({method:"eth_estimateGas",params:S?[_,x??"latest",S]:x?[_,x]:[_]})};const{accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,blockNumber:p,blockTag:y,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:j,value:U,stateOverride:K,...J}=await Ig(t,{...e,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),z=(p?Pr(p):void 0)||y,ue=dI(K),_e=await(async()=>{if(J.to)return J.to;if(u&&u.length>0)return await Bw({authorization:u[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`")})})();qh(e);const G=(o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:o.format,m=(G||Sg)({...Fw(J,{format:G}),from:n==null?void 0:n.address,accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:j,to:_e,value:U});let g=BigInt(await f({block:z,request:m,rpcStateOverride:ue}));if(u){const v=await $I(t,{address:m.from}),x=await Promise.all(u.map(async _=>{const{contractAddress:S}=_,b=await f({block:z,request:{authorizationList:void 0,data:A,from:n==null?void 0:n.address,to:S,value:Pr(v)},rpcStateOverride:ue}).catch(()=>100000n);return 2n*BigInt(b)}));g+=x.reduce((_,S)=>_+S,0n)}return g}catch(a){throw uI(a,{...e,account:n,chain:t.chain})}}class jI extends yt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class UI extends yt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` -`),{name:"ChainNotFoundError"})}}const Cg="/docs/contract/encodeDeployData";function qI(t){const{abi:e,args:r,bytecode:n}=t;if(!r||r.length===0)return n;const i=e.find(o=>"type"in o&&o.type==="constructor");if(!i)throw new nP({docsPath:Cg});if(!("inputs"in i))throw new Xy({docsPath:Cg});if(!i.inputs||i.inputs.length===0)throw new Xy({docsPath:Cg});const s=Ew(i.inputs,r);return Bh([n,s])}async function zI(t){return new Promise(e=>setTimeout(e,t))}class Uf extends yt{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` -`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class Tg extends yt{constructor({docsPath:e,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:e,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function Jw({chain:t,currentChainId:e}){if(!t)throw new UI;if(e!==t.id)throw new jI({chain:t,currentChainId:e})}function HI(t,{docsPath:e,...r}){const n=(()=>{const i=$w(t,r);return i instanceof Eg?t:i})();return new HM(n,{docsPath:e,...r})}async function Xw(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const Rg=new kh(128);async function Dg(t,e){var k,B,j,U;const{account:r=t.account,chain:n=t.chain,accessList:i,authorizationList:s,blobs:o,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,value:P,...N}=e;if(typeof r>"u")throw new Uf({docsPath:"/docs/actions/wallet/sendTransaction"});const D=r?fo(r):null;try{qh(e);const K=await(async()=>{if(e.to)return e.to;if(s&&s.length>0)return await Bw({authorization:s[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`.")})})();if((D==null?void 0:D.type)==="json-rpc"||D===null){let J;n!==null&&(J=await fi(t,Hh,"getChainId")({}),Jw({currentChainId:J,chain:n}));const T=(j=(B=(k=t.chain)==null?void 0:k.formatters)==null?void 0:B.transactionRequest)==null?void 0:j.format,ue=(T||Sg)({...Fw(N,{format:T}),accessList:i,authorizationList:s,blobs:o,chainId:J,data:a,from:D==null?void 0:D.address,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,to:K,value:P}),_e=Rg.get(t.uid),G=_e?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:G,params:[ue]},{retryCount:0})}catch(E){if(_e===!1)throw E;const m=E;if(m.name==="InvalidInputRpcError"||m.name==="InvalidParamsRpcError"||m.name==="MethodNotFoundRpcError"||m.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[ue]},{retryCount:0}).then(f=>(Rg.set(t.uid,!0),f)).catch(f=>{const g=f;throw g.name==="MethodNotFoundRpcError"||g.name==="MethodNotSupportedRpcError"?(Rg.set(t.uid,!1),m):g});throw m}}if((D==null?void 0:D.type)==="local"){const J=await fi(t,Ig,"prepareTransactionRequest")({account:D,accessList:i,authorizationList:s,blobs:o,chain:n,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,nonceManager:D.nonceManager,parameters:[...Yw,"sidecars"],value:P,...N,to:K}),T=(U=n==null?void 0:n.serializers)==null?void 0:U.transaction,z=await D.signTransaction(J,{serializer:T});return await fi(t,Xw,"sendRawTransaction")({serializedTransaction:z})}throw(D==null?void 0:D.type)==="smart"?new Tg({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Tg({docsPath:"/docs/actions/wallet/sendTransaction",type:D==null?void 0:D.type})}catch(K){throw K instanceof Tg?K:HI(K,{...e,account:D,chain:e.chain||void 0})}}async function WI(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:o,functionName:a,...u}=e;if(typeof n>"u")throw new Uf({docsPath:"/docs/contract/writeContract"});const l=n?fo(n):null,d=yM({abi:r,args:s,functionName:a});try{return await fi(t,Dg,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:i,account:l,...u})}catch(p){throw eI(p,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:a,sender:l==null?void 0:l.address})}}async function KI(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:Pr(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}const Og=256;let Wh=Og,Kh;function Zw(t=11){if(!Kh||Wh+t>Og*2){Kh="",Wh=0;for(let e=0;e{const B=k(D);for(const U in P)delete B[U];const j={...D,...B};return Object.assign(j,{extend:N(j)})}}return Object.assign(P,{extend:N(P)})}const Vh=new kh(8192);function GI(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(Vh.get(r))return Vh.get(r);const n=t().finally(()=>Vh.delete(r));return Vh.set(r,n),n}function YI(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const u=async({error:l})=>{const d=typeof e=="function"?e({count:a,error:l}):e;d&&await zI(d),o({count:a+1})};try{const l=await t();i(l)}catch(l){if(a{const{dedupe:i=!1,retryDelay:s=150,retryCount:o=3,uid:a}={...e,...n},u=i?Ef(Oh(`${a}.${Kc(r)}`)):void 0;return GI(()=>YI(async()=>{try{return await t(r)}catch(l){const d=l;switch(d.code){case Pf.code:throw new Pf(d);case Mf.code:throw new Mf(d);case If.code:throw new If(d,{method:r.method});case Cf.code:throw new Cf(d);case Ba.code:throw new Ba(d);case Tf.code:throw new Tf(d);case Rf.code:throw new Rf(d);case Df.code:throw new Df(d);case Of.code:throw new Of(d);case Nf.code:throw new Nf(d,{method:r.method});case Gc.code:throw new Gc(d);case Lf.code:throw new Lf(d);case Yc.code:throw new Yc(d);case kf.code:throw new kf(d);case Bf.code:throw new Bf(d);case $f.code:throw new $f(d);case Ff.code:throw new Ff(d);case jf.code:throw new jf(d);case 5e3:throw new Yc(d);default:throw l instanceof yt?l:new ZM(d)}}},{delay:({count:l,error:d})=>{var p;if(d&&d instanceof Ow){const y=(p=d==null?void 0:d.headers)==null?void 0:p.get("Retry-After");if(y!=null&&y.match(/\d/))return Number.parseInt(y)*1e3}return~~(1<XI(l)}),{enabled:i,id:u})}}function XI(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Gc.code||t.code===Ba.code:t instanceof Ow&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function ZI({key:t,name:e,request:r,retryCount:n=3,retryDelay:i=150,timeout:s,type:o},a){const u=Zw();return{config:{key:t,name:e,request:r,retryCount:n,retryDelay:i,timeout:s,type:o},request:JI(r,{retryCount:n,retryDelay:i,uid:u}),value:a}}function QI(t,e={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=e;return({retryCount:s})=>ZI({key:r,name:n,request:t.request.bind(t),retryCount:e.retryCount??s,retryDelay:i,type:"custom"})}const eC=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,tC=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;class rC extends yt{constructor({domain:e}){super(`Invalid domain "${Kc(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class nC extends yt{constructor({primaryType:e,types:r}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class iC extends yt{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function sC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(u,l)=>{const d={...l};for(const p of u){const{name:y,type:A}=p;A==="address"&&(d[y]=d[y].toLowerCase())}return d},o=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return Kc({domain:o,message:a,primaryType:n,types:i})}function oC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(o,a)=>{for(const u of o){const{name:l,type:d}=u,p=a[l],y=d.match(tC);if(y&&(typeof p=="number"||typeof p=="bigint")){const[N,D,k]=y;Pr(p,{signed:D==="int",size:Number.parseInt(k)/8})}if(d==="address"&&typeof p=="string"&&!uo(p))throw new zc({address:p});const A=d.match(eC);if(A){const[N,D]=A;if(D&&_n(p)!==Number.parseInt(D))throw new uP({expectedSize:Number.parseInt(D),givenSize:_n(p)})}const P=i[d];P&&(cC(d),s(P,p))}};if(i.EIP712Domain&&e){if(typeof e!="object")throw new rC({domain:e});s(i.EIP712Domain,e)}if(n!=="EIP712Domain")if(i[n])s(i[n],r);else throw new nC({primaryType:n,types:i})}function aC({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},typeof(t==null?void 0:t.chainId)=="number"&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function cC(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new iC({type:t})}let Qw=class extends ig{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,SP(e);const n=wf(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew Qw(t,e).update(r).digest();e2.create=(t,e)=>new Qw(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ng=BigInt(0),Gh=BigInt(1),uC=BigInt(2);function $a(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function qf(t){if(!$a(t))throw new Error("Uint8Array expected")}function Xc(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)}const fC=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Zc(t){qf(t);let e="";for(let r=0;r=ho._0&&t<=ho._9)return t-ho._0;if(t>=ho._A&&t<=ho._F)return t-(ho._A-10);if(t>=ho._a&&t<=ho._f)return t-(ho._a-10)}function eu(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;itypeof t=="bigint"&&Ng<=t;function Yh(t,e,r){return $g(t)&&$g(e)&&$g(r)&&e<=t&&tNg;t>>=Gh,e+=1);return e}function pC(t,e){return t>>BigInt(e)&Gh}function gC(t,e,r){return t|(r?Gh:Ng)<(uC<new Uint8Array(t),n2=t=>Uint8Array.from(t);function i2(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=jg(t),i=jg(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...p)=>r(i,n,...p),u=(p=jg())=>{i=a(n2([0]),p),n=a(),p.length!==0&&(i=a(n2([1]),p),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let p=0;const y=[];for(;p{o(),u(p);let A;for(;!(A=y(l()));)u();return o(),A}}const mC={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||$a(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Hf(t,e,r={}){const n=(i,s,o)=>{const a=mC[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const u=t[i];if(!(o&&u===void 0)&&!a(u,t))throw new Error(`Invalid param ${String(i)}=${u} (${typeof u}), expected ${s}`)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const vC=()=>{throw new Error("not implemented")};function Ug(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}const bC=Object.freeze(Object.defineProperty({__proto__:null,aInRange:ja,abool:Xc,abytes:qf,bitGet:pC,bitLen:r2,bitMask:Fg,bitSet:gC,bytesToHex:Zc,bytesToNumberBE:Fa,bytesToNumberLE:kg,concatBytes:zf,createHmacDrbg:i2,ensureBytes:ds,equalBytes:hC,hexToBytes:eu,hexToNumber:Lg,inRange:Yh,isBytes:$a,memoized:Ug,notImplemented:vC,numberToBytesBE:tu,numberToBytesLE:Bg,numberToHexUnpadded:Qc,numberToVarBytesBE:lC,utf8ToBytes:dC,validateObject:Hf},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mn=BigInt(0),sn=BigInt(1),Ua=BigInt(2),yC=BigInt(3),qg=BigInt(4),s2=BigInt(5),o2=BigInt(8);BigInt(9),BigInt(16);function di(t,e){const r=t%e;return r>=Mn?r:e+r}function wC(t,e,r){if(r<=Mn||e 0");if(r===sn)return Mn;let n=sn;for(;e>Mn;)e&sn&&(n=n*t%r),t=t*t%r,e>>=sn;return n}function Ui(t,e,r){let n=t;for(;e-- >Mn;)n*=n,n%=r;return n}function zg(t,e){if(t===Mn||e<=Mn)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=di(t,e),n=e,i=Mn,s=sn;for(;r!==Mn;){const a=n/r,u=n%r,l=i-s*a;n=r,r=u,i=s,s=l}if(n!==sn)throw new Error("invert: does not exist");return di(i,e)}function xC(t){const e=(t-sn)/Ua;let r,n,i;for(r=t-sn,n=0;r%Ua===Mn;r/=Ua,n++);for(i=Ua;i(n[i]="function",n),e);return Hf(t,r)}function AC(t,e,r){if(r 0");if(r===Mn)return t.ONE;if(r===sn)return e;let n=t.ONE,i=e;for(;r>Mn;)r&sn&&(n=t.mul(n,i)),i=t.sqr(i),r>>=sn;return n}function PC(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function a2(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function c2(t,e,r=!1,n={}){if(t<=Mn)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=a2(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=_C(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:Fg(i),ZERO:Mn,ONE:sn,create:u=>di(u,t),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return Mn<=u&&uu===Mn,isOdd:u=>(u&sn)===sn,neg:u=>di(-u,t),eql:(u,l)=>u===l,sqr:u=>di(u*u,t),add:(u,l)=>di(u+l,t),sub:(u,l)=>di(u-l,t),mul:(u,l)=>di(u*l,t),pow:(u,l)=>AC(a,u,l),div:(u,l)=>di(u*zg(l,t),t),sqrN:u=>u*u,addN:(u,l)=>u+l,subN:(u,l)=>u-l,mulN:(u,l)=>u*l,inv:u=>zg(u,t),sqrt:n.sqrt||(u=>o(a,u)),invertBatch:u=>PC(a,u),cmov:(u,l,d)=>d?l:u,toBytes:u=>r?Bg(u,s):tu(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return r?kg(u):Fa(u)}});return Object.freeze(a)}function u2(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function f2(t){const e=u2(t);return e+Math.ceil(e/2)}function MC(t,e,r=!1){const n=t.length,i=u2(e),s=f2(e);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?Fa(t):kg(t),a=di(o,e-sn)+sn;return r?Bg(a,i):tu(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const IC=BigInt(0),Hg=BigInt(1),Wg=new WeakMap,l2=new WeakMap;function CC(t,e){const r=(s,o)=>{const a=o.negate();return s?a:o},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>e)throw new Error(`Wrong window size=${s}, should be [1..${e}]`)},i=s=>{n(s);const o=Math.ceil(e/s)+1,a=2**(s-1);return{windows:o,windowSize:a}};return{constTimeNegate:r,unsafeLadder(s,o){let a=t.ZERO,u=s;for(;o>IC;)o&Hg&&(a=a.add(u)),u=u.double(),o>>=Hg;return a},precomputeWindow(s,o){const{windows:a,windowSize:u}=i(o),l=[];let d=s,p=d;for(let y=0;y>=P,k>l&&(k-=A,a+=Hg);const B=D,j=D+Math.abs(k)-1,U=N%2!==0,K=k<0;k===0?p=p.add(r(U,o[B])):d=d.add(r(K,o[j]))}return{p:d,f:p}},wNAFCached(s,o,a){const u=l2.get(s)||1;let l=Wg.get(s);return l||(l=this.precomputeWindow(s,u),u!==1&&Wg.set(s,a(l))),this.wNAF(u,l,o)},setWindowSize(s,o){n(o),l2.set(s,o),Wg.delete(s)}}}function TC(t,e,r,n){if(!Array.isArray(r)||!Array.isArray(n)||n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((d,p)=>{if(!e.isValid(d))throw new Error(`wrong scalar at index ${p}`)}),r.forEach((d,p)=>{if(!(d instanceof t))throw new Error(`wrong point at index ${p}`)});const i=r2(BigInt(r.length)),s=i>12?i-3:i>4?i-2:i?2:1,o=(1<=0;d-=s){a.fill(t.ZERO);for(let y=0;y>BigInt(d)&BigInt(o));a[P]=a[P].add(r[y])}let p=t.ZERO;for(let y=a.length-1,A=t.ZERO;y>0;y--)A=A.add(a[y]),p=p.add(A);if(l=l.add(p),d!==0)for(let y=0;y{const{Err:r}=po;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=Qc(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?Qc(i.length/2|128):"";return`${Qc(t)}${s}${i}${e}`},decode(t,e){const{Err:r}=po;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");const l=e.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const d of l)o=o<<8|d;if(n+=u,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=po;if(t{const B=D.toAffine();return zf(Uint8Array.from([4]),r.toBytes(B.x),r.toBytes(B.y))}),s=e.fromBytes||(N=>{const D=N.subarray(1),k=r.fromBytes(D.subarray(0,r.BYTES)),B=r.fromBytes(D.subarray(r.BYTES,2*r.BYTES));return{x:k,y:B}});function o(N){const{a:D,b:k}=e,B=r.sqr(N),j=r.mul(B,N);return r.add(r.add(j,r.mul(N,D)),k)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(N){return Yh(N,In,e.n)}function u(N){const{allowedPrivateKeyLengths:D,nByteLength:k,wrapPrivateKey:B,n:j}=e;if(D&&typeof N!="bigint"){if($a(N)&&(N=Zc(N)),typeof N!="string"||!D.includes(N.length))throw new Error("Invalid key");N=N.padStart(k*2,"0")}let U;try{U=typeof N=="bigint"?N:Fa(ds("private key",N,k))}catch{throw new Error(`private key must be ${k} bytes, hex or bigint, not ${typeof N}`)}return B&&(U=di(U,j)),ja("private key",U,In,j),U}function l(N){if(!(N instanceof y))throw new Error("ProjectivePoint expected")}const d=Ug((N,D)=>{const{px:k,py:B,pz:j}=N;if(r.eql(j,r.ONE))return{x:k,y:B};const U=N.is0();D==null&&(D=U?r.ONE:r.inv(j));const K=r.mul(k,D),J=r.mul(B,D),T=r.mul(j,D);if(U)return{x:r.ZERO,y:r.ZERO};if(!r.eql(T,r.ONE))throw new Error("invZ was invalid");return{x:K,y:J}}),p=Ug(N=>{if(N.is0()){if(e.allowInfinityPoint&&!r.is0(N.py))return;throw new Error("bad point: ZERO")}const{x:D,y:k}=N.toAffine();if(!r.isValid(D)||!r.isValid(k))throw new Error("bad point: x or y not FE");const B=r.sqr(k),j=o(D);if(!r.eql(B,j))throw new Error("bad point: equation left != right");if(!N.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(D,k,B){if(this.px=D,this.py=k,this.pz=B,D==null||!r.isValid(D))throw new Error("x required");if(k==null||!r.isValid(k))throw new Error("y required");if(B==null||!r.isValid(B))throw new Error("z required");Object.freeze(this)}static fromAffine(D){const{x:k,y:B}=D||{};if(!D||!r.isValid(k)||!r.isValid(B))throw new Error("invalid affine point");if(D instanceof y)throw new Error("projective point not allowed");const j=U=>r.eql(U,r.ZERO);return j(k)&&j(B)?y.ZERO:new y(k,B,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(D){const k=r.invertBatch(D.map(B=>B.pz));return D.map((B,j)=>B.toAffine(k[j])).map(y.fromAffine)}static fromHex(D){const k=y.fromAffine(s(ds("pointHex",D)));return k.assertValidity(),k}static fromPrivateKey(D){return y.BASE.multiply(u(D))}static msm(D,k){return TC(y,n,D,k)}_setWindowSize(D){P.setWindowSize(this,D)}assertValidity(){p(this)}hasEvenY(){const{y:D}=this.toAffine();if(r.isOdd)return!r.isOdd(D);throw new Error("Field doesn't support isOdd")}equals(D){l(D);const{px:k,py:B,pz:j}=this,{px:U,py:K,pz:J}=D,T=r.eql(r.mul(k,J),r.mul(U,j)),z=r.eql(r.mul(B,J),r.mul(K,j));return T&&z}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){const{a:D,b:k}=e,B=r.mul(k,p2),{px:j,py:U,pz:K}=this;let J=r.ZERO,T=r.ZERO,z=r.ZERO,ue=r.mul(j,j),_e=r.mul(U,U),G=r.mul(K,K),E=r.mul(j,U);return E=r.add(E,E),z=r.mul(j,K),z=r.add(z,z),J=r.mul(D,z),T=r.mul(B,G),T=r.add(J,T),J=r.sub(_e,T),T=r.add(_e,T),T=r.mul(J,T),J=r.mul(E,J),z=r.mul(B,z),G=r.mul(D,G),E=r.sub(ue,G),E=r.mul(D,E),E=r.add(E,z),z=r.add(ue,ue),ue=r.add(z,ue),ue=r.add(ue,G),ue=r.mul(ue,E),T=r.add(T,ue),G=r.mul(U,K),G=r.add(G,G),ue=r.mul(G,E),J=r.sub(J,ue),z=r.mul(G,_e),z=r.add(z,z),z=r.add(z,z),new y(J,T,z)}add(D){l(D);const{px:k,py:B,pz:j}=this,{px:U,py:K,pz:J}=D;let T=r.ZERO,z=r.ZERO,ue=r.ZERO;const _e=e.a,G=r.mul(e.b,p2);let E=r.mul(k,U),m=r.mul(B,K),f=r.mul(j,J),g=r.add(k,B),v=r.add(U,K);g=r.mul(g,v),v=r.add(E,m),g=r.sub(g,v),v=r.add(k,j);let x=r.add(U,J);return v=r.mul(v,x),x=r.add(E,f),v=r.sub(v,x),x=r.add(B,j),T=r.add(K,J),x=r.mul(x,T),T=r.add(m,f),x=r.sub(x,T),ue=r.mul(_e,v),T=r.mul(G,f),ue=r.add(T,ue),T=r.sub(m,ue),ue=r.add(m,ue),z=r.mul(T,ue),m=r.add(E,E),m=r.add(m,E),f=r.mul(_e,f),v=r.mul(G,v),m=r.add(m,f),f=r.sub(E,f),f=r.mul(_e,f),v=r.add(v,f),E=r.mul(m,v),z=r.add(z,E),E=r.mul(x,v),T=r.mul(g,T),T=r.sub(T,E),E=r.mul(g,m),ue=r.mul(x,ue),ue=r.add(ue,E),new y(T,z,ue)}subtract(D){return this.add(D.negate())}is0(){return this.equals(y.ZERO)}wNAF(D){return P.wNAFCached(this,D,y.normalizeZ)}multiplyUnsafe(D){ja("scalar",D,go,e.n);const k=y.ZERO;if(D===go)return k;if(D===In)return this;const{endo:B}=e;if(!B)return P.unsafeLadder(this,D);let{k1neg:j,k1:U,k2neg:K,k2:J}=B.splitScalar(D),T=k,z=k,ue=this;for(;U>go||J>go;)U&In&&(T=T.add(ue)),J&In&&(z=z.add(ue)),ue=ue.double(),U>>=In,J>>=In;return j&&(T=T.negate()),K&&(z=z.negate()),z=new y(r.mul(z.px,B.beta),z.py,z.pz),T.add(z)}multiply(D){const{endo:k,n:B}=e;ja("scalar",D,In,B);let j,U;if(k){const{k1neg:K,k1:J,k2neg:T,k2:z}=k.splitScalar(D);let{p:ue,f:_e}=this.wNAF(J),{p:G,f:E}=this.wNAF(z);ue=P.constTimeNegate(K,ue),G=P.constTimeNegate(T,G),G=new y(r.mul(G.px,k.beta),G.py,G.pz),j=ue.add(G),U=_e.add(E)}else{const{p:K,f:J}=this.wNAF(D);j=K,U=J}return y.normalizeZ([j,U])[0]}multiplyAndAddUnsafe(D,k,B){const j=y.BASE,U=(J,T)=>T===go||T===In||!J.equals(j)?J.multiplyUnsafe(T):J.multiply(T),K=U(this,k).add(U(D,B));return K.is0()?void 0:K}toAffine(D){return d(this,D)}isTorsionFree(){const{h:D,isTorsionFree:k}=e;if(D===In)return!0;if(k)return k(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:D,clearCofactor:k}=e;return D===In?this:k?k(y,this):this.multiplyUnsafe(e.h)}toRawBytes(D=!0){return Xc("isCompressed",D),this.assertValidity(),i(y,this,D)}toHex(D=!0){return Xc("isCompressed",D),Zc(this.toRawBytes(D))}}y.BASE=new y(e.Gx,e.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);const A=e.nBitLength,P=CC(y,e.endo?Math.ceil(A/2):A);return{CURVE:e,ProjectivePoint:y,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:a}}function LC(t){const e=h2(t);return Hf(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function kC(t){const e=LC(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(f){return di(f,n)}function a(f){return zg(f,n)}const{ProjectivePoint:u,normPrivateKeyToScalar:l,weierstrassEquation:d,isWithinCurveOrder:p}=NC({...e,toBytes(f,g,v){const x=g.toAffine(),_=r.toBytes(x.x),S=zf;return Xc("isCompressed",v),v?S(Uint8Array.from([g.hasEvenY()?2:3]),_):S(Uint8Array.from([4]),_,r.toBytes(x.y))},fromBytes(f){const g=f.length,v=f[0],x=f.subarray(1);if(g===i&&(v===2||v===3)){const _=Fa(x);if(!Yh(_,In,r.ORDER))throw new Error("Point is not on curve");const S=d(_);let b;try{b=r.sqrt(S)}catch(F){const ae=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+ae)}const M=(b&In)===In;return(v&1)===1!==M&&(b=r.neg(b)),{x:_,y:b}}else if(g===s&&v===4){const _=r.fromBytes(x.subarray(0,r.BYTES)),S=r.fromBytes(x.subarray(r.BYTES,2*r.BYTES));return{x:_,y:S}}else throw new Error(`Point of length ${g} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`)}}),y=f=>Zc(tu(f,e.nByteLength));function A(f){const g=n>>In;return f>g}function P(f){return A(f)?o(-f):f}const N=(f,g,v)=>Fa(f.slice(g,v));class D{constructor(g,v,x){this.r=g,this.s=v,this.recovery=x,this.assertValidity()}static fromCompact(g){const v=e.nByteLength;return g=ds("compactSignature",g,v*2),new D(N(g,0,v),N(g,v,2*v))}static fromDER(g){const{r:v,s:x}=po.toSig(ds("DER",g));return new D(v,x)}assertValidity(){ja("r",this.r,In,n),ja("s",this.s,In,n)}addRecoveryBit(g){return new D(this.r,this.s,g)}recoverPublicKey(g){const{r:v,s:x,recovery:_}=this,S=J(ds("msgHash",g));if(_==null||![0,1,2,3].includes(_))throw new Error("recovery id invalid");const b=_===2||_===3?v+e.n:v;if(b>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const M=_&1?"03":"02",I=u.fromHex(M+y(b)),F=a(b),ae=o(-S*F),O=o(x*F),se=u.BASE.multiplyAndAddUnsafe(I,ae,O);if(!se)throw new Error("point at infinify");return se.assertValidity(),se}hasHighS(){return A(this.s)}normalizeS(){return this.hasHighS()?new D(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return eu(this.toDERHex())}toDERHex(){return po.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return eu(this.toCompactHex())}toCompactHex(){return y(this.r)+y(this.s)}}const k={isValidPrivateKey(f){try{return l(f),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const f=f2(e.n);return MC(e.randomBytes(f),e.n)},precompute(f=8,g=u.BASE){return g._setWindowSize(f),g.multiply(BigInt(3)),g}};function B(f,g=!0){return u.fromPrivateKey(f).toRawBytes(g)}function j(f){const g=$a(f),v=typeof f=="string",x=(g||v)&&f.length;return g?x===i||x===s:v?x===2*i||x===2*s:f instanceof u}function U(f,g,v=!0){if(j(f))throw new Error("first arg must be private key");if(!j(g))throw new Error("second arg must be public key");return u.fromHex(g).multiply(l(f)).toRawBytes(v)}const K=e.bits2int||function(f){const g=Fa(f),v=f.length*8-e.nBitLength;return v>0?g>>BigInt(v):g},J=e.bits2int_modN||function(f){return o(K(f))},T=Fg(e.nBitLength);function z(f){return ja(`num < 2^${e.nBitLength}`,f,go,T),tu(f,e.nByteLength)}function ue(f,g,v=_e){if(["recovered","canonical"].some(X=>X in v))throw new Error("sign() legacy options not supported");const{hash:x,randomBytes:_}=e;let{lowS:S,prehash:b,extraEntropy:M}=v;S==null&&(S=!0),f=ds("msgHash",f),d2(v),b&&(f=ds("prehashed msgHash",x(f)));const I=J(f),F=l(g),ae=[z(F),z(I)];if(M!=null&&M!==!1){const X=M===!0?_(r.BYTES):M;ae.push(ds("extraEntropy",X))}const O=zf(...ae),se=I;function ee(X){const Q=K(X);if(!p(Q))return;const R=a(Q),Z=u.BASE.multiply(Q).toAffine(),te=o(Z.x);if(te===go)return;const le=o(R*o(se+te*F));if(le===go)return;let ie=(Z.x===te?0:2)|Number(Z.y&In),fe=le;return S&&A(le)&&(fe=P(le),ie^=1),new D(te,fe,ie)}return{seed:O,k2sig:ee}}const _e={lowS:e.lowS,prehash:!1},G={lowS:e.lowS,prehash:!1};function E(f,g,v=_e){const{seed:x,k2sig:_}=ue(f,g,v),S=e;return i2(S.hash.outputLen,S.nByteLength,S.hmac)(x,_)}u.BASE._setWindowSize(8);function m(f,g,v,x=G){var Z;const _=f;if(g=ds("msgHash",g),v=ds("publicKey",v),"strict"in x)throw new Error("options.strict was renamed to lowS");d2(x);const{lowS:S,prehash:b}=x;let M,I;try{if(typeof _=="string"||$a(_))try{M=D.fromDER(_)}catch(te){if(!(te instanceof po.Err))throw te;M=D.fromCompact(_)}else if(typeof _=="object"&&typeof _.r=="bigint"&&typeof _.s=="bigint"){const{r:te,s:le}=_;M=new D(te,le)}else throw new Error("PARSE");I=u.fromHex(v)}catch(te){if(te.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(S&&M.hasHighS())return!1;b&&(g=e.hash(g));const{r:F,s:ae}=M,O=J(g),se=a(ae),ee=o(O*se),X=o(F*se),Q=(Z=u.BASE.multiplyAndAddUnsafe(I,ee,X))==null?void 0:Z.toAffine();return Q?o(Q.x)===F:!1}return{CURVE:e,getPublicKey:B,getSharedSecret:U,sign:E,verify:m,ProjectivePoint:u,Signature:D,utils:k}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function BC(t){return{hash:t,hmac:(e,...r)=>e2(t,e,kP(...r)),randomBytes:$P}}function $C(t,e){const r=n=>kC({...t,...BC(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const g2=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),m2=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),FC=BigInt(1),Kg=BigInt(2),v2=(t,e)=>(t+e/Kg)/e;function jC(t){const e=g2,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),u=BigInt(88),l=t*t*t%e,d=l*l*t%e,p=Ui(d,r,e)*d%e,y=Ui(p,r,e)*d%e,A=Ui(y,Kg,e)*l%e,P=Ui(A,i,e)*A%e,N=Ui(P,s,e)*P%e,D=Ui(N,a,e)*N%e,k=Ui(D,u,e)*D%e,B=Ui(k,a,e)*N%e,j=Ui(B,r,e)*d%e,U=Ui(j,o,e)*P%e,K=Ui(U,n,e)*l%e,J=Ui(K,Kg,e);if(!Vg.eql(Vg.sqr(J),t))throw new Error("Cannot find square root");return J}const Vg=c2(g2,void 0,void 0,{sqrt:jC}),b2=$C({a:BigInt(0),b:BigInt(7),Fp:Vg,n:m2,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=m2,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-FC*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=v2(s*t,e),u=v2(-n*t,e);let l=di(t-a*r-u*i,e),d=di(-a*n-u*s,e);const p=l>o,y=d>o;if(p&&(l=e-l),y&&(d=e-d),l>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:p,k1:l,k2neg:y,k2:d}}}},Pg);BigInt(0),b2.ProjectivePoint;const UC=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:b2},Symbol.toStringTag,{value:"Module"}));function qC(t,e){const{abi:r,args:n,bytecode:i,...s}=e,o=qI({abi:r,args:n,bytecode:i});return Dg(t,{...s,data:o})}async function zC(t){var r;return((r=t.account)==null?void 0:r.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(n=>Sf(n))}async function HC(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}async function WC(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>og(r))}async function KC(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function VC(t,{account:e=t.account,message:r}){if(!e)throw new Uf({docsPath:"/docs/actions/wallet/signMessage"});const n=fo(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Oh(r):r.raw instanceof Uint8Array?Dh(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function GC(t,e){var l,d,p,y;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTransaction"});const s=fo(r);qh({account:s,...e});const o=await fi(t,Hh,"getChainId")({});n!==null&&Jw({currentChainId:o,chain:n});const a=(n==null?void 0:n.formatters)||((l=t.chain)==null?void 0:l.formatters),u=((d=a==null?void 0:a.transactionRequest)==null?void 0:d.format)||Sg;return s.signTransaction?s.signTransaction({...i,chainId:o},{serializer:(y=(p=t.chain)==null?void 0:p.serializers)==null?void 0:y.transaction}):await t.request({method:"eth_signTransaction",params:[{...u(i),chainId:Pr(o),from:s.address}]},{retryCount:0})}async function YC(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new Uf({docsPath:"/docs/actions/wallet/signTypedData"});const o=fo(r),a={EIP712Domain:aC({domain:n}),...e.types};if(oC({domain:n,message:i,primaryType:s,types:a}),o.signTypedData)return o.signTypedData({domain:n,message:i,primaryType:s,types:a});const u=sC({domain:n,message:i,primaryType:s,types:a});return t.request({method:"eth_signTypedData_v4",params:[o.address,u]},{retryCount:0})}async function JC(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:Pr(e)}]},{retryCount:0})}async function XC(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}function ZC(t){return{addChain:e=>KI(t,e),deployContract:e=>qC(t,e),getAddresses:()=>zC(t),getChainId:()=>Hh(t),getPermissions:()=>HC(t),prepareTransactionRequest:e=>Ig(t,e),requestAddresses:()=>WC(t),requestPermissions:e=>KC(t,e),sendRawTransaction:e=>Xw(t,e),sendTransaction:e=>Dg(t,e),signMessage:e=>VC(t,e),signTransaction:e=>GC(t,e),signTypedData:e=>YC(t,e),switchChain:e=>JC(t,e),watchAsset:e=>XC(t,e),writeContract:e=>WI(t,e)}}function QC(t){const{key:e="wallet",name:r="Wallet Client",transport:n}=t;return VI({...t,key:e,name:r,transport:n,type:"walletClient"}).extend(ZC)}class Wf{constructor(e){oo(this,"_key");oo(this,"_config",null);oo(this,"_provider",null);oo(this,"_connected",!1);oo(this,"_address",null);oo(this,"_fatured",!1);oo(this,"_installed",!1);oo(this,"lastUsed",!1);var r;if("name"in e&&"image"in e)this._key=e.name,this._config=e,this._fatured=e.featured;else if("session"in e){if(!e.session)throw new Error("session is null");this._key=(r=e.session)==null?void 0:r.peer.metadata.name,this._provider=e,this._config={name:e.session.peer.metadata.name,image:e.session.peer.metadata.icons[0],featured:!1}}else if("info"in e)console.log(e.info,"installed"),this._key=e.info.name,this._provider=e.provider,this._installed=!0,this._config={name:e.info.name,image:e.info.icon,featured:!1},this.testConnect();else throw new Error("unknown params")}get address(){return this._address}get connected(){return this._connected}get featured(){return this._fatured}get key(){return this._key}get installed(){return this._installed}get provider(){return this._provider}get client(){return this._provider?QC({transport:QI(this._provider)}):null}get config(){return this._config}static fromWalletConfig(e){return new Wf(e)}EIP6963Detected(e){this._provider=e.provider,this._installed=!0,this._provider.on("disconnect",this.disconnect),this._provider.on("accountsChanged",r=>{this._address=r[0],this._connected=!0}),this.testConnect()}setUniversalProvider(e){this._provider=e,this.testConnect()}async testConnect(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());e&&e.length>0?(this._address=e[0],this._connected=!0):(this._address=null,this._connected=!1)}async connect(){var r;const e=await((r=this.client)==null?void 0:r.request({method:"eth_requestAccounts",params:void 0}));if(!e)throw new Error("connect failed");return e}async getAddress(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());if(!e)throw new Error("get address failed");return e[0]}async getChain(){var r;const e=await((r=this.client)==null?void 0:r.getChainId());if(!e)throw new Error("get chain failed");return e}async signMessage(e,r){var i;return await((i=this.client)==null?void 0:i.signMessage({message:e,account:r}))}async disconnect(){this._provider&&"session"in this._provider&&await this._provider.disconnect(),this._connected=!1,this._address=null}}var Gg={exports:{}},ru=typeof Reflect=="object"?Reflect:null,y2=ru&&typeof ru.apply=="function"?ru.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Jh;ru&&typeof ru.ownKeys=="function"?Jh=ru.ownKeys:Object.getOwnPropertySymbols?Jh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Jh=function(e){return Object.getOwnPropertyNames(e)};function eT(t){console&&console.warn&&console.warn(t)}var w2=Number.isNaN||function(e){return e!==e};function Rr(){Rr.init.call(this)}Gg.exports=Rr,Gg.exports.once=iT,Rr.EventEmitter=Rr,Rr.prototype._events=void 0,Rr.prototype._eventsCount=0,Rr.prototype._maxListeners=void 0;var x2=10;function Xh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Rr,"defaultMaxListeners",{enumerable:!0,get:function(){return x2},set:function(t){if(typeof t!="number"||t<0||w2(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");x2=t}}),Rr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Rr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||w2(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function _2(t){return t._maxListeners===void 0?Rr.defaultMaxListeners:t._maxListeners}Rr.prototype.getMaxListeners=function(){return _2(this)},Rr.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")y2(u,this,r);else for(var l=u.length,d=M2(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,eT(a)}return t}Rr.prototype.addListener=function(e,r){return E2(this,e,r,!1)},Rr.prototype.on=Rr.prototype.addListener,Rr.prototype.prependListener=function(e,r){return E2(this,e,r,!0)};function tT(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function S2(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=tT.bind(n);return i.listener=r,n.wrapFn=i,i}Rr.prototype.once=function(e,r){return Xh(r),this.on(e,S2(this,e,r)),this},Rr.prototype.prependOnceListener=function(e,r){return Xh(r),this.prependListener(e,S2(this,e,r)),this},Rr.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Xh(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():rT(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Rr.prototype.off=Rr.prototype.removeListener,Rr.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function A2(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?nT(i):M2(i,i.length)}Rr.prototype.listeners=function(e){return A2(this,e,!0)},Rr.prototype.rawListeners=function(e){return A2(this,e,!1)},Rr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):P2.call(t,e)},Rr.prototype.listenerCount=P2;function P2(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Rr.prototype.eventNames=function(){return this._eventsCount>0?Jh(this._events):[]};function M2(t,e){for(var r=new Array(e),n=0;n(i==null?void 0:i.code)===Jc.code):t;return n instanceof yt?new Jc({cause:t,message:n.details}):Jc.nodeMessage.test(r)?new Jc({cause:t,message:t.details}):jh.nodeMessage.test(r)?new jh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):gg.nodeMessage.test(r)?new gg({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):mg.nodeMessage.test(r)?new mg({cause:t,nonce:e==null?void 0:e.nonce}):vg.nodeMessage.test(r)?new vg({cause:t,nonce:e==null?void 0:e.nonce}):bg.nodeMessage.test(r)?new bg({cause:t,nonce:e==null?void 0:e.nonce}):yg.nodeMessage.test(r)?new yg({cause:t}):wg.nodeMessage.test(r)?new wg({cause:t,gas:e==null?void 0:e.gas}):xg.nodeMessage.test(r)?new xg({cause:t,gas:e==null?void 0:e.gas}):_g.nodeMessage.test(r)?new _g({cause:t}):Uh.nodeMessage.test(r)?new Uh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new Eg({cause:t})}function uI(t,{docsPath:e,...r}){const n=(()=>{const i=Fw(t,r);return i instanceof Eg?t:i})();return new cI(n,{docsPath:e,...r})}function jw(t,{format:e}){if(!e)return{};const r={};function n(s){const o=Object.keys(s);for(const a of o)a in t&&(r[a]=t[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}const i=e(t||{});return n(i),r}const fI={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Sg(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=lI(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(r=>li(r)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=Pr(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=Pr(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=Pr(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=Pr(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=Pr(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=Pr(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=fI[t.type]),typeof t.value<"u"&&(e.value=Pr(t.value)),e}function lI(t){return t.map(e=>({address:e.contractAddress,r:e.r,s:e.s,chainId:Pr(e.chainId),nonce:Pr(e.nonce),...typeof e.yParity<"u"?{yParity:Pr(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:Pr(e.v)}:{}}))}function Uw(t){if(!(!t||t.length===0))return t.reduce((e,{slot:r,value:n})=>{if(r.length!==66)throw new nw({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new nw({size:n.length,targetSize:66,type:"hex"});return e[r]=n,e},{})}function hI(t){const{balance:e,nonce:r,state:n,stateDiff:i,code:s}=t,o={};if(s!==void 0&&(o.code=s),e!==void 0&&(o.balance=Pr(e)),r!==void 0&&(o.nonce=Pr(r)),n!==void 0&&(o.state=Uw(n)),i!==void 0){if(o.state)throw new UM;o.stateDiff=Uw(i)}return o}function dI(t){if(!t)return;const e={};for(const{address:r,...n}of t){if(!uo(r,{strict:!1}))throw new zc({address:r});if(e[r])throw new jM({address:r});e[r]=hI(n)}return e}const pI=2n**256n-1n;function qh(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?fo(e):void 0;if(o&&!uo(o.address))throw new zc({address:o.address});if(s&&!uo(s))throw new zc({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new qM;if(n&&n>pI)throw new jh({maxFeePerGas:n});if(i&&n&&i>n)throw new Uh({maxFeePerGas:n,maxPriorityFeePerGas:i})}class gI extends yt{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Ag extends yt{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class mI extends yt{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${hs(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class vI extends yt{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}const bI={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function yI(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?Fc(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?Fc(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?bI[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=wI(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function wI(t){return t.map(e=>({contractAddress:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function xI(t){const e=(t.transactions??[]).map(r=>typeof r=="string"?r:yI(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function zh(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){var d,p,y;const s=n??"latest",o=i??!1,a=r!==void 0?Pr(r):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,o]},{dedupe:!0}):u=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]},{dedupe:!!a}),!u)throw new vI({blockHash:e,blockNumber:r});return(((y=(p=(d=t.chain)==null?void 0:d.formatters)==null?void 0:p.block)==null?void 0:y.format)||xI)(u)}async function qw(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function _I(t,e){var s,o;const{block:r,chain:n=t.chain,request:i}=e||{};try{const a=((s=n==null?void 0:n.fees)==null?void 0:s.maxPriorityFeePerGas)??((o=n==null?void 0:n.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=r||await fi(t,zh,"getBlock")({}),d=await a({block:l,client:t,request:i});if(d===null)throw new Error;return d}if(typeof a<"u")return a;const u=await t.request({method:"eth_maxPriorityFeePerGas"});return wf(u)}catch{const[a,u]=await Promise.all([r?Promise.resolve(r):fi(t,zh,"getBlock")({}),fi(t,qw,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new Ag;const l=u-a.baseFeePerGas;return l<0n?0n:l}}async function zw(t,e){var y,A;const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>{var P,N;return typeof((P=n==null?void 0:n.fees)==null?void 0:P.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):((N=n==null?void 0:n.fees)==null?void 0:N.baseFeeMultiplier)??1.2})();if(o<1)throw new gI;const u=10**(((y=o.toString().split(".")[1])==null?void 0:y.length)??0),l=P=>P*BigInt(Math.ceil(o*u))/BigInt(u),d=r||await fi(t,zh,"getBlock")({});if(typeof((A=n==null?void 0:n.fees)==null?void 0:A.estimateFeesPerGas)=="function"){const P=await n.fees.estimateFeesPerGas({block:r,client:t,multiply:l,request:i,type:s});if(P!==null)return P}if(s==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new Ag;const P=typeof(i==null?void 0:i.maxPriorityFeePerGas)=="bigint"?i.maxPriorityFeePerGas:await _I(t,{block:d,chain:n,request:i}),N=l(d.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??N+P,maxPriorityFeePerGas:P}}return{gasPrice:(i==null?void 0:i.gasPrice)??l(await fi(t,qw,"getGasPrice")({}))}}async function EI(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,n?Pr(n):r]},{dedupe:!!n});return Fc(i)}function Hw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(s=>co(s)):t.blobs,i=[];for(const s of n)i.push(Uint8Array.from(e.blobToKzgCommitment(s)));return r==="bytes"?i:i.map(s=>li(s))}function Ww(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>co(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>co(o)):t.commitments,s=[];for(let o=0;oli(o))}function SI(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),u=n?4:0,l=n?0:4;t.setUint32(e+u,o,n),t.setUint32(e+l,a,n)}const AI=(t,e,r)=>t&e^~t&r,PI=(t,e,r)=>t&e^t&r^e&r;class MI extends ig{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ng(this.buffer)}update(e){Uc(this);const{view:r,buffer:n,blockLen:i}=this;e=xf(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let p=o;pd.length)throw new Error("_sha2: outputLen bigger than state");for(let p=0;p>>3,N=Os(A,17)^Os(A,19)^A>>>10;ea[p]=N+ea[p-7]+P+ea[p-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:u,G:l,H:d}=this;for(let p=0;p<64;p++){const y=Os(a,6)^Os(a,11)^Os(a,25),A=d+y+AI(a,u,l)+II[p]+ea[p]|0,N=(Os(n,2)^Os(n,13)^Os(n,22))+PI(n,i,s)|0;d=l,l=u,u=a,a=o+A|0,o=s,s=i,i=n,n=A+N|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(n,i,s,o,a,u,l,d)}roundClean(){ea.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Pg=lw(()=>new CI);function TI(t,e){return Pg(Jo(t,{strict:!1})?rg(t):t)}function RI(t){const{commitment:e,version:r=1}=t,n=t.to??(typeof e=="string"?"hex":"bytes"),i=TI(e);return i.set([r],0),n==="bytes"?i:li(i)}function DI(t){const{commitments:e,version:r}=t,n=t.to??(typeof e[0]=="string"?"hex":"bytes"),i=[];for(const s of e)i.push(RI({commitment:s,to:n,version:r}));return i}const Kw=6,Vw=32,Mg=4096,Gw=Vw*Mg,Yw=Gw*Kw-1-1*Mg*Kw;class OI extends yt{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class NI extends yt{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function LI(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),r=typeof t.data=="string"?co(t.data):t.data,n=_n(r);if(!n)throw new NI;if(n>Yw)throw new OI({maxSize:Yw,size:n});const i=[];let s=!0,o=0;for(;s;){const a=dg(new Uint8Array(Gw));let u=0;for(;ua.bytes):i.map(a=>li(a.bytes))}function kI(t){const{data:e,kzg:r,to:n}=t,i=t.blobs??LI({data:e,to:n}),s=t.commitments??Hw({blobs:i,kzg:r,to:n}),o=t.proofs??Ww({blobs:i,commitments:s,kzg:r,to:n}),a=[];for(let u=0;u"u"&&p)if(u){const k=await D();y.nonce=await u.consume({address:p.address,chainId:k,client:t})}else y.nonce=await fi(t,EI,"getTransactionCount")({address:p.address,blockTag:"pending"});if((l.includes("fees")||l.includes("type"))&&typeof d>"u")try{y.type=BI(y)}catch{const k=await P();y.type=typeof(k==null?void 0:k.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(l.includes("fees"))if(y.type!=="legacy"&&y.type!=="eip2930"){if(typeof y.maxFeePerGas>"u"||typeof y.maxPriorityFeePerGas>"u"){const k=await P(),{maxFeePerGas:B,maxPriorityFeePerGas:q}=await zw(t,{block:k,chain:i,request:y});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(y.gas=await fi(t,FI,"estimateGas")({...y,account:p&&{address:p.address,type:"json-rpc"}})),qh(y),delete y.parameters,y}async function $I(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=r?Pr(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function FI(t,e){var i,s,o;const{account:r=t.account}=e,n=r?fo(r):void 0;try{let f=function(v){const{block:x,request:_,rpcStateOverride:S}=v;return t.request({method:"eth_estimateGas",params:S?[_,x??"latest",S]:x?[_,x]:[_]})};const{accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,blockNumber:p,blockTag:y,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:q,value:j,stateOverride:H,...J}=await Ig(t,{...e,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),z=(p?Pr(p):void 0)||y,ue=dI(H),_e=await(async()=>{if(J.to)return J.to;if(u&&u.length>0)return await $w({authorization:u[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`")})})();qh(e);const G=(o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:o.format,m=(G||Sg)({...jw(J,{format:G}),from:n==null?void 0:n.address,accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:q,to:_e,value:j});let g=BigInt(await f({block:z,request:m,rpcStateOverride:ue}));if(u){const v=await $I(t,{address:m.from}),x=await Promise.all(u.map(async _=>{const{contractAddress:S}=_,b=await f({block:z,request:{authorizationList:void 0,data:A,from:n==null?void 0:n.address,to:S,value:Pr(v)},rpcStateOverride:ue}).catch(()=>100000n);return 2n*BigInt(b)}));g+=x.reduce((_,S)=>_+S,0n)}return g}catch(a){throw uI(a,{...e,account:n,chain:t.chain})}}class jI extends yt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class UI extends yt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` +`),{name:"ChainNotFoundError"})}}const Cg="/docs/contract/encodeDeployData";function qI(t){const{abi:e,args:r,bytecode:n}=t;if(!r||r.length===0)return n;const i=e.find(o=>"type"in o&&o.type==="constructor");if(!i)throw new nP({docsPath:Cg});if(!("inputs"in i))throw new Zy({docsPath:Cg});if(!i.inputs||i.inputs.length===0)throw new Zy({docsPath:Cg});const s=Sw(i.inputs,r);return Bh([n,s])}async function zI(t){return new Promise(e=>setTimeout(e,t))}class qf extends yt{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` +`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class Tg extends yt{constructor({docsPath:e,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:e,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function Xw({chain:t,currentChainId:e}){if(!t)throw new UI;if(e!==t.id)throw new jI({chain:t,currentChainId:e})}function HI(t,{docsPath:e,...r}){const n=(()=>{const i=Fw(t,r);return i instanceof Eg?t:i})();return new HM(n,{docsPath:e,...r})}async function Zw(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const Rg=new kh(128);async function Dg(t,e){var k,B,q,j;const{account:r=t.account,chain:n=t.chain,accessList:i,authorizationList:s,blobs:o,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,value:P,...N}=e;if(typeof r>"u")throw new qf({docsPath:"/docs/actions/wallet/sendTransaction"});const D=r?fo(r):null;try{qh(e);const H=await(async()=>{if(e.to)return e.to;if(s&&s.length>0)return await $w({authorization:s[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`.")})})();if((D==null?void 0:D.type)==="json-rpc"||D===null){let J;n!==null&&(J=await fi(t,Hh,"getChainId")({}),Xw({currentChainId:J,chain:n}));const T=(q=(B=(k=t.chain)==null?void 0:k.formatters)==null?void 0:B.transactionRequest)==null?void 0:q.format,ue=(T||Sg)({...jw(N,{format:T}),accessList:i,authorizationList:s,blobs:o,chainId:J,data:a,from:D==null?void 0:D.address,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,to:H,value:P}),_e=Rg.get(t.uid),G=_e?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:G,params:[ue]},{retryCount:0})}catch(E){if(_e===!1)throw E;const m=E;if(m.name==="InvalidInputRpcError"||m.name==="InvalidParamsRpcError"||m.name==="MethodNotFoundRpcError"||m.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[ue]},{retryCount:0}).then(f=>(Rg.set(t.uid,!0),f)).catch(f=>{const g=f;throw g.name==="MethodNotFoundRpcError"||g.name==="MethodNotSupportedRpcError"?(Rg.set(t.uid,!1),m):g});throw m}}if((D==null?void 0:D.type)==="local"){const J=await fi(t,Ig,"prepareTransactionRequest")({account:D,accessList:i,authorizationList:s,blobs:o,chain:n,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,nonceManager:D.nonceManager,parameters:[...Jw,"sidecars"],value:P,...N,to:H}),T=(j=n==null?void 0:n.serializers)==null?void 0:j.transaction,z=await D.signTransaction(J,{serializer:T});return await fi(t,Zw,"sendRawTransaction")({serializedTransaction:z})}throw(D==null?void 0:D.type)==="smart"?new Tg({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Tg({docsPath:"/docs/actions/wallet/sendTransaction",type:D==null?void 0:D.type})}catch(H){throw H instanceof Tg?H:HI(H,{...e,account:D,chain:e.chain||void 0})}}async function WI(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:o,functionName:a,...u}=e;if(typeof n>"u")throw new qf({docsPath:"/docs/contract/writeContract"});const l=n?fo(n):null,d=yM({abi:r,args:s,functionName:a});try{return await fi(t,Dg,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:i,account:l,...u})}catch(p){throw eI(p,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:a,sender:l==null?void 0:l.address})}}async function KI(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:Pr(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}const Og=256;let Wh=Og,Kh;function Qw(t=11){if(!Kh||Wh+t>Og*2){Kh="",Wh=0;for(let e=0;e{const B=k(D);for(const j in P)delete B[j];const q={...D,...B};return Object.assign(q,{extend:N(q)})}}return Object.assign(P,{extend:N(P)})}const Vh=new kh(8192);function GI(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(Vh.get(r))return Vh.get(r);const n=t().finally(()=>Vh.delete(r));return Vh.set(r,n),n}function YI(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const u=async({error:l})=>{const d=typeof e=="function"?e({count:a,error:l}):e;d&&await zI(d),o({count:a+1})};try{const l=await t();i(l)}catch(l){if(a{const{dedupe:i=!1,retryDelay:s=150,retryCount:o=3,uid:a}={...e,...n},u=i?Sf(Oh(`${a}.${Kc(r)}`)):void 0;return GI(()=>YI(async()=>{try{return await t(r)}catch(l){const d=l;switch(d.code){case Mf.code:throw new Mf(d);case If.code:throw new If(d);case Cf.code:throw new Cf(d,{method:r.method});case Tf.code:throw new Tf(d);case Ba.code:throw new Ba(d);case Rf.code:throw new Rf(d);case Df.code:throw new Df(d);case Of.code:throw new Of(d);case Nf.code:throw new Nf(d);case Lf.code:throw new Lf(d,{method:r.method});case Gc.code:throw new Gc(d);case kf.code:throw new kf(d);case Yc.code:throw new Yc(d);case Bf.code:throw new Bf(d);case $f.code:throw new $f(d);case Ff.code:throw new Ff(d);case jf.code:throw new jf(d);case Uf.code:throw new Uf(d);case 5e3:throw new Yc(d);default:throw l instanceof yt?l:new ZM(d)}}},{delay:({count:l,error:d})=>{var p;if(d&&d instanceof Nw){const y=(p=d==null?void 0:d.headers)==null?void 0:p.get("Retry-After");if(y!=null&&y.match(/\d/))return Number.parseInt(y)*1e3}return~~(1<XI(l)}),{enabled:i,id:u})}}function XI(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Gc.code||t.code===Ba.code:t instanceof Nw&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function ZI({key:t,name:e,request:r,retryCount:n=3,retryDelay:i=150,timeout:s,type:o},a){const u=Qw();return{config:{key:t,name:e,request:r,retryCount:n,retryDelay:i,timeout:s,type:o},request:JI(r,{retryCount:n,retryDelay:i,uid:u}),value:a}}function QI(t,e={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=e;return({retryCount:s})=>ZI({key:r,name:n,request:t.request.bind(t),retryCount:e.retryCount??s,retryDelay:i,type:"custom"})}const eC=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,tC=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;class rC extends yt{constructor({domain:e}){super(`Invalid domain "${Kc(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class nC extends yt{constructor({primaryType:e,types:r}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class iC extends yt{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function sC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(u,l)=>{const d={...l};for(const p of u){const{name:y,type:A}=p;A==="address"&&(d[y]=d[y].toLowerCase())}return d},o=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return Kc({domain:o,message:a,primaryType:n,types:i})}function oC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(o,a)=>{for(const u of o){const{name:l,type:d}=u,p=a[l],y=d.match(tC);if(y&&(typeof p=="number"||typeof p=="bigint")){const[N,D,k]=y;Pr(p,{signed:D==="int",size:Number.parseInt(k)/8})}if(d==="address"&&typeof p=="string"&&!uo(p))throw new zc({address:p});const A=d.match(eC);if(A){const[N,D]=A;if(D&&_n(p)!==Number.parseInt(D))throw new uP({expectedSize:Number.parseInt(D),givenSize:_n(p)})}const P=i[d];P&&(cC(d),s(P,p))}};if(i.EIP712Domain&&e){if(typeof e!="object")throw new rC({domain:e});s(i.EIP712Domain,e)}if(n!=="EIP712Domain")if(i[n])s(i[n],r);else throw new nC({primaryType:n,types:i})}function aC({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},typeof(t==null?void 0:t.chainId)=="number"&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function cC(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new iC({type:t})}let e2=class extends ig{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,SP(e);const n=xf(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew e2(t,e).update(r).digest();t2.create=(t,e)=>new e2(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ng=BigInt(0),Gh=BigInt(1),uC=BigInt(2);function $a(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function zf(t){if(!$a(t))throw new Error("Uint8Array expected")}function Xc(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)}const fC=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Zc(t){zf(t);let e="";for(let r=0;r=ho._0&&t<=ho._9)return t-ho._0;if(t>=ho._A&&t<=ho._F)return t-(ho._A-10);if(t>=ho._a&&t<=ho._f)return t-(ho._a-10)}function eu(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;itypeof t=="bigint"&&Ng<=t;function Yh(t,e,r){return $g(t)&&$g(e)&&$g(r)&&e<=t&&tNg;t>>=Gh,e+=1);return e}function pC(t,e){return t>>BigInt(e)&Gh}function gC(t,e,r){return t|(r?Gh:Ng)<(uC<new Uint8Array(t),i2=t=>Uint8Array.from(t);function s2(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=jg(t),i=jg(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...p)=>r(i,n,...p),u=(p=jg())=>{i=a(i2([0]),p),n=a(),p.length!==0&&(i=a(i2([1]),p),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let p=0;const y=[];for(;p{o(),u(p);let A;for(;!(A=y(l()));)u();return o(),A}}const mC={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||$a(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Wf(t,e,r={}){const n=(i,s,o)=>{const a=mC[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const u=t[i];if(!(o&&u===void 0)&&!a(u,t))throw new Error(`Invalid param ${String(i)}=${u} (${typeof u}), expected ${s}`)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const vC=()=>{throw new Error("not implemented")};function Ug(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}const bC=Object.freeze(Object.defineProperty({__proto__:null,aInRange:ja,abool:Xc,abytes:zf,bitGet:pC,bitLen:n2,bitMask:Fg,bitSet:gC,bytesToHex:Zc,bytesToNumberBE:Fa,bytesToNumberLE:kg,concatBytes:Hf,createHmacDrbg:s2,ensureBytes:ds,equalBytes:hC,hexToBytes:eu,hexToNumber:Lg,inRange:Yh,isBytes:$a,memoized:Ug,notImplemented:vC,numberToBytesBE:tu,numberToBytesLE:Bg,numberToHexUnpadded:Qc,numberToVarBytesBE:lC,utf8ToBytes:dC,validateObject:Wf},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const In=BigInt(0),sn=BigInt(1),Ua=BigInt(2),yC=BigInt(3),qg=BigInt(4),o2=BigInt(5),a2=BigInt(8);BigInt(9),BigInt(16);function di(t,e){const r=t%e;return r>=In?r:e+r}function wC(t,e,r){if(r<=In||e 0");if(r===sn)return In;let n=sn;for(;e>In;)e&sn&&(n=n*t%r),t=t*t%r,e>>=sn;return n}function Ui(t,e,r){let n=t;for(;e-- >In;)n*=n,n%=r;return n}function zg(t,e){if(t===In||e<=In)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=di(t,e),n=e,i=In,s=sn;for(;r!==In;){const a=n/r,u=n%r,l=i-s*a;n=r,r=u,i=s,s=l}if(n!==sn)throw new Error("invert: does not exist");return di(i,e)}function xC(t){const e=(t-sn)/Ua;let r,n,i;for(r=t-sn,n=0;r%Ua===In;r/=Ua,n++);for(i=Ua;i(n[i]="function",n),e);return Wf(t,r)}function AC(t,e,r){if(r 0");if(r===In)return t.ONE;if(r===sn)return e;let n=t.ONE,i=e;for(;r>In;)r&sn&&(n=t.mul(n,i)),i=t.sqr(i),r>>=sn;return n}function PC(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function c2(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function u2(t,e,r=!1,n={}){if(t<=In)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=c2(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=_C(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:Fg(i),ZERO:In,ONE:sn,create:u=>di(u,t),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return In<=u&&uu===In,isOdd:u=>(u&sn)===sn,neg:u=>di(-u,t),eql:(u,l)=>u===l,sqr:u=>di(u*u,t),add:(u,l)=>di(u+l,t),sub:(u,l)=>di(u-l,t),mul:(u,l)=>di(u*l,t),pow:(u,l)=>AC(a,u,l),div:(u,l)=>di(u*zg(l,t),t),sqrN:u=>u*u,addN:(u,l)=>u+l,subN:(u,l)=>u-l,mulN:(u,l)=>u*l,inv:u=>zg(u,t),sqrt:n.sqrt||(u=>o(a,u)),invertBatch:u=>PC(a,u),cmov:(u,l,d)=>d?l:u,toBytes:u=>r?Bg(u,s):tu(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return r?kg(u):Fa(u)}});return Object.freeze(a)}function f2(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function l2(t){const e=f2(t);return e+Math.ceil(e/2)}function MC(t,e,r=!1){const n=t.length,i=f2(e),s=l2(e);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?Fa(t):kg(t),a=di(o,e-sn)+sn;return r?Bg(a,i):tu(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const IC=BigInt(0),Hg=BigInt(1),Wg=new WeakMap,h2=new WeakMap;function CC(t,e){const r=(s,o)=>{const a=o.negate();return s?a:o},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>e)throw new Error(`Wrong window size=${s}, should be [1..${e}]`)},i=s=>{n(s);const o=Math.ceil(e/s)+1,a=2**(s-1);return{windows:o,windowSize:a}};return{constTimeNegate:r,unsafeLadder(s,o){let a=t.ZERO,u=s;for(;o>IC;)o&Hg&&(a=a.add(u)),u=u.double(),o>>=Hg;return a},precomputeWindow(s,o){const{windows:a,windowSize:u}=i(o),l=[];let d=s,p=d;for(let y=0;y>=P,k>l&&(k-=A,a+=Hg);const B=D,q=D+Math.abs(k)-1,j=N%2!==0,H=k<0;k===0?p=p.add(r(j,o[B])):d=d.add(r(H,o[q]))}return{p:d,f:p}},wNAFCached(s,o,a){const u=h2.get(s)||1;let l=Wg.get(s);return l||(l=this.precomputeWindow(s,u),u!==1&&Wg.set(s,a(l))),this.wNAF(u,l,o)},setWindowSize(s,o){n(o),h2.set(s,o),Wg.delete(s)}}}function TC(t,e,r,n){if(!Array.isArray(r)||!Array.isArray(n)||n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((d,p)=>{if(!e.isValid(d))throw new Error(`wrong scalar at index ${p}`)}),r.forEach((d,p)=>{if(!(d instanceof t))throw new Error(`wrong point at index ${p}`)});const i=n2(BigInt(r.length)),s=i>12?i-3:i>4?i-2:i?2:1,o=(1<=0;d-=s){a.fill(t.ZERO);for(let y=0;y>BigInt(d)&BigInt(o));a[P]=a[P].add(r[y])}let p=t.ZERO;for(let y=a.length-1,A=t.ZERO;y>0;y--)A=A.add(a[y]),p=p.add(A);if(l=l.add(p),d!==0)for(let y=0;y{const{Err:r}=po;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=Qc(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?Qc(i.length/2|128):"";return`${Qc(t)}${s}${i}${e}`},decode(t,e){const{Err:r}=po;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");const l=e.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const d of l)o=o<<8|d;if(n+=u,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=po;if(t{const B=D.toAffine();return Hf(Uint8Array.from([4]),r.toBytes(B.x),r.toBytes(B.y))}),s=e.fromBytes||(N=>{const D=N.subarray(1),k=r.fromBytes(D.subarray(0,r.BYTES)),B=r.fromBytes(D.subarray(r.BYTES,2*r.BYTES));return{x:k,y:B}});function o(N){const{a:D,b:k}=e,B=r.sqr(N),q=r.mul(B,N);return r.add(r.add(q,r.mul(N,D)),k)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(N){return Yh(N,Cn,e.n)}function u(N){const{allowedPrivateKeyLengths:D,nByteLength:k,wrapPrivateKey:B,n:q}=e;if(D&&typeof N!="bigint"){if($a(N)&&(N=Zc(N)),typeof N!="string"||!D.includes(N.length))throw new Error("Invalid key");N=N.padStart(k*2,"0")}let j;try{j=typeof N=="bigint"?N:Fa(ds("private key",N,k))}catch{throw new Error(`private key must be ${k} bytes, hex or bigint, not ${typeof N}`)}return B&&(j=di(j,q)),ja("private key",j,Cn,q),j}function l(N){if(!(N instanceof y))throw new Error("ProjectivePoint expected")}const d=Ug((N,D)=>{const{px:k,py:B,pz:q}=N;if(r.eql(q,r.ONE))return{x:k,y:B};const j=N.is0();D==null&&(D=j?r.ONE:r.inv(q));const H=r.mul(k,D),J=r.mul(B,D),T=r.mul(q,D);if(j)return{x:r.ZERO,y:r.ZERO};if(!r.eql(T,r.ONE))throw new Error("invZ was invalid");return{x:H,y:J}}),p=Ug(N=>{if(N.is0()){if(e.allowInfinityPoint&&!r.is0(N.py))return;throw new Error("bad point: ZERO")}const{x:D,y:k}=N.toAffine();if(!r.isValid(D)||!r.isValid(k))throw new Error("bad point: x or y not FE");const B=r.sqr(k),q=o(D);if(!r.eql(B,q))throw new Error("bad point: equation left != right");if(!N.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(D,k,B){if(this.px=D,this.py=k,this.pz=B,D==null||!r.isValid(D))throw new Error("x required");if(k==null||!r.isValid(k))throw new Error("y required");if(B==null||!r.isValid(B))throw new Error("z required");Object.freeze(this)}static fromAffine(D){const{x:k,y:B}=D||{};if(!D||!r.isValid(k)||!r.isValid(B))throw new Error("invalid affine point");if(D instanceof y)throw new Error("projective point not allowed");const q=j=>r.eql(j,r.ZERO);return q(k)&&q(B)?y.ZERO:new y(k,B,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(D){const k=r.invertBatch(D.map(B=>B.pz));return D.map((B,q)=>B.toAffine(k[q])).map(y.fromAffine)}static fromHex(D){const k=y.fromAffine(s(ds("pointHex",D)));return k.assertValidity(),k}static fromPrivateKey(D){return y.BASE.multiply(u(D))}static msm(D,k){return TC(y,n,D,k)}_setWindowSize(D){P.setWindowSize(this,D)}assertValidity(){p(this)}hasEvenY(){const{y:D}=this.toAffine();if(r.isOdd)return!r.isOdd(D);throw new Error("Field doesn't support isOdd")}equals(D){l(D);const{px:k,py:B,pz:q}=this,{px:j,py:H,pz:J}=D,T=r.eql(r.mul(k,J),r.mul(j,q)),z=r.eql(r.mul(B,J),r.mul(H,q));return T&&z}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){const{a:D,b:k}=e,B=r.mul(k,g2),{px:q,py:j,pz:H}=this;let J=r.ZERO,T=r.ZERO,z=r.ZERO,ue=r.mul(q,q),_e=r.mul(j,j),G=r.mul(H,H),E=r.mul(q,j);return E=r.add(E,E),z=r.mul(q,H),z=r.add(z,z),J=r.mul(D,z),T=r.mul(B,G),T=r.add(J,T),J=r.sub(_e,T),T=r.add(_e,T),T=r.mul(J,T),J=r.mul(E,J),z=r.mul(B,z),G=r.mul(D,G),E=r.sub(ue,G),E=r.mul(D,E),E=r.add(E,z),z=r.add(ue,ue),ue=r.add(z,ue),ue=r.add(ue,G),ue=r.mul(ue,E),T=r.add(T,ue),G=r.mul(j,H),G=r.add(G,G),ue=r.mul(G,E),J=r.sub(J,ue),z=r.mul(G,_e),z=r.add(z,z),z=r.add(z,z),new y(J,T,z)}add(D){l(D);const{px:k,py:B,pz:q}=this,{px:j,py:H,pz:J}=D;let T=r.ZERO,z=r.ZERO,ue=r.ZERO;const _e=e.a,G=r.mul(e.b,g2);let E=r.mul(k,j),m=r.mul(B,H),f=r.mul(q,J),g=r.add(k,B),v=r.add(j,H);g=r.mul(g,v),v=r.add(E,m),g=r.sub(g,v),v=r.add(k,q);let x=r.add(j,J);return v=r.mul(v,x),x=r.add(E,f),v=r.sub(v,x),x=r.add(B,q),T=r.add(H,J),x=r.mul(x,T),T=r.add(m,f),x=r.sub(x,T),ue=r.mul(_e,v),T=r.mul(G,f),ue=r.add(T,ue),T=r.sub(m,ue),ue=r.add(m,ue),z=r.mul(T,ue),m=r.add(E,E),m=r.add(m,E),f=r.mul(_e,f),v=r.mul(G,v),m=r.add(m,f),f=r.sub(E,f),f=r.mul(_e,f),v=r.add(v,f),E=r.mul(m,v),z=r.add(z,E),E=r.mul(x,v),T=r.mul(g,T),T=r.sub(T,E),E=r.mul(g,m),ue=r.mul(x,ue),ue=r.add(ue,E),new y(T,z,ue)}subtract(D){return this.add(D.negate())}is0(){return this.equals(y.ZERO)}wNAF(D){return P.wNAFCached(this,D,y.normalizeZ)}multiplyUnsafe(D){ja("scalar",D,go,e.n);const k=y.ZERO;if(D===go)return k;if(D===Cn)return this;const{endo:B}=e;if(!B)return P.unsafeLadder(this,D);let{k1neg:q,k1:j,k2neg:H,k2:J}=B.splitScalar(D),T=k,z=k,ue=this;for(;j>go||J>go;)j&Cn&&(T=T.add(ue)),J&Cn&&(z=z.add(ue)),ue=ue.double(),j>>=Cn,J>>=Cn;return q&&(T=T.negate()),H&&(z=z.negate()),z=new y(r.mul(z.px,B.beta),z.py,z.pz),T.add(z)}multiply(D){const{endo:k,n:B}=e;ja("scalar",D,Cn,B);let q,j;if(k){const{k1neg:H,k1:J,k2neg:T,k2:z}=k.splitScalar(D);let{p:ue,f:_e}=this.wNAF(J),{p:G,f:E}=this.wNAF(z);ue=P.constTimeNegate(H,ue),G=P.constTimeNegate(T,G),G=new y(r.mul(G.px,k.beta),G.py,G.pz),q=ue.add(G),j=_e.add(E)}else{const{p:H,f:J}=this.wNAF(D);q=H,j=J}return y.normalizeZ([q,j])[0]}multiplyAndAddUnsafe(D,k,B){const q=y.BASE,j=(J,T)=>T===go||T===Cn||!J.equals(q)?J.multiplyUnsafe(T):J.multiply(T),H=j(this,k).add(j(D,B));return H.is0()?void 0:H}toAffine(D){return d(this,D)}isTorsionFree(){const{h:D,isTorsionFree:k}=e;if(D===Cn)return!0;if(k)return k(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:D,clearCofactor:k}=e;return D===Cn?this:k?k(y,this):this.multiplyUnsafe(e.h)}toRawBytes(D=!0){return Xc("isCompressed",D),this.assertValidity(),i(y,this,D)}toHex(D=!0){return Xc("isCompressed",D),Zc(this.toRawBytes(D))}}y.BASE=new y(e.Gx,e.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);const A=e.nBitLength,P=CC(y,e.endo?Math.ceil(A/2):A);return{CURVE:e,ProjectivePoint:y,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:a}}function LC(t){const e=d2(t);return Wf(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function kC(t){const e=LC(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(f){return di(f,n)}function a(f){return zg(f,n)}const{ProjectivePoint:u,normPrivateKeyToScalar:l,weierstrassEquation:d,isWithinCurveOrder:p}=NC({...e,toBytes(f,g,v){const x=g.toAffine(),_=r.toBytes(x.x),S=Hf;return Xc("isCompressed",v),v?S(Uint8Array.from([g.hasEvenY()?2:3]),_):S(Uint8Array.from([4]),_,r.toBytes(x.y))},fromBytes(f){const g=f.length,v=f[0],x=f.subarray(1);if(g===i&&(v===2||v===3)){const _=Fa(x);if(!Yh(_,Cn,r.ORDER))throw new Error("Point is not on curve");const S=d(_);let b;try{b=r.sqrt(S)}catch(F){const ae=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+ae)}const M=(b&Cn)===Cn;return(v&1)===1!==M&&(b=r.neg(b)),{x:_,y:b}}else if(g===s&&v===4){const _=r.fromBytes(x.subarray(0,r.BYTES)),S=r.fromBytes(x.subarray(r.BYTES,2*r.BYTES));return{x:_,y:S}}else throw new Error(`Point of length ${g} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`)}}),y=f=>Zc(tu(f,e.nByteLength));function A(f){const g=n>>Cn;return f>g}function P(f){return A(f)?o(-f):f}const N=(f,g,v)=>Fa(f.slice(g,v));class D{constructor(g,v,x){this.r=g,this.s=v,this.recovery=x,this.assertValidity()}static fromCompact(g){const v=e.nByteLength;return g=ds("compactSignature",g,v*2),new D(N(g,0,v),N(g,v,2*v))}static fromDER(g){const{r:v,s:x}=po.toSig(ds("DER",g));return new D(v,x)}assertValidity(){ja("r",this.r,Cn,n),ja("s",this.s,Cn,n)}addRecoveryBit(g){return new D(this.r,this.s,g)}recoverPublicKey(g){const{r:v,s:x,recovery:_}=this,S=J(ds("msgHash",g));if(_==null||![0,1,2,3].includes(_))throw new Error("recovery id invalid");const b=_===2||_===3?v+e.n:v;if(b>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const M=_&1?"03":"02",I=u.fromHex(M+y(b)),F=a(b),ae=o(-S*F),O=o(x*F),se=u.BASE.multiplyAndAddUnsafe(I,ae,O);if(!se)throw new Error("point at infinify");return se.assertValidity(),se}hasHighS(){return A(this.s)}normalizeS(){return this.hasHighS()?new D(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return eu(this.toDERHex())}toDERHex(){return po.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return eu(this.toCompactHex())}toCompactHex(){return y(this.r)+y(this.s)}}const k={isValidPrivateKey(f){try{return l(f),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const f=l2(e.n);return MC(e.randomBytes(f),e.n)},precompute(f=8,g=u.BASE){return g._setWindowSize(f),g.multiply(BigInt(3)),g}};function B(f,g=!0){return u.fromPrivateKey(f).toRawBytes(g)}function q(f){const g=$a(f),v=typeof f=="string",x=(g||v)&&f.length;return g?x===i||x===s:v?x===2*i||x===2*s:f instanceof u}function j(f,g,v=!0){if(q(f))throw new Error("first arg must be private key");if(!q(g))throw new Error("second arg must be public key");return u.fromHex(g).multiply(l(f)).toRawBytes(v)}const H=e.bits2int||function(f){const g=Fa(f),v=f.length*8-e.nBitLength;return v>0?g>>BigInt(v):g},J=e.bits2int_modN||function(f){return o(H(f))},T=Fg(e.nBitLength);function z(f){return ja(`num < 2^${e.nBitLength}`,f,go,T),tu(f,e.nByteLength)}function ue(f,g,v=_e){if(["recovered","canonical"].some(X=>X in v))throw new Error("sign() legacy options not supported");const{hash:x,randomBytes:_}=e;let{lowS:S,prehash:b,extraEntropy:M}=v;S==null&&(S=!0),f=ds("msgHash",f),p2(v),b&&(f=ds("prehashed msgHash",x(f)));const I=J(f),F=l(g),ae=[z(F),z(I)];if(M!=null&&M!==!1){const X=M===!0?_(r.BYTES):M;ae.push(ds("extraEntropy",X))}const O=Hf(...ae),se=I;function ee(X){const Q=H(X);if(!p(Q))return;const R=a(Q),Z=u.BASE.multiply(Q).toAffine(),te=o(Z.x);if(te===go)return;const le=o(R*o(se+te*F));if(le===go)return;let ie=(Z.x===te?0:2)|Number(Z.y&Cn),fe=le;return S&&A(le)&&(fe=P(le),ie^=1),new D(te,fe,ie)}return{seed:O,k2sig:ee}}const _e={lowS:e.lowS,prehash:!1},G={lowS:e.lowS,prehash:!1};function E(f,g,v=_e){const{seed:x,k2sig:_}=ue(f,g,v),S=e;return s2(S.hash.outputLen,S.nByteLength,S.hmac)(x,_)}u.BASE._setWindowSize(8);function m(f,g,v,x=G){var Z;const _=f;if(g=ds("msgHash",g),v=ds("publicKey",v),"strict"in x)throw new Error("options.strict was renamed to lowS");p2(x);const{lowS:S,prehash:b}=x;let M,I;try{if(typeof _=="string"||$a(_))try{M=D.fromDER(_)}catch(te){if(!(te instanceof po.Err))throw te;M=D.fromCompact(_)}else if(typeof _=="object"&&typeof _.r=="bigint"&&typeof _.s=="bigint"){const{r:te,s:le}=_;M=new D(te,le)}else throw new Error("PARSE");I=u.fromHex(v)}catch(te){if(te.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(S&&M.hasHighS())return!1;b&&(g=e.hash(g));const{r:F,s:ae}=M,O=J(g),se=a(ae),ee=o(O*se),X=o(F*se),Q=(Z=u.BASE.multiplyAndAddUnsafe(I,ee,X))==null?void 0:Z.toAffine();return Q?o(Q.x)===F:!1}return{CURVE:e,getPublicKey:B,getSharedSecret:j,sign:E,verify:m,ProjectivePoint:u,Signature:D,utils:k}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function BC(t){return{hash:t,hmac:(e,...r)=>t2(t,e,kP(...r)),randomBytes:$P}}function $C(t,e){const r=n=>kC({...t,...BC(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const m2=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),v2=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),FC=BigInt(1),Kg=BigInt(2),b2=(t,e)=>(t+e/Kg)/e;function jC(t){const e=m2,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),u=BigInt(88),l=t*t*t%e,d=l*l*t%e,p=Ui(d,r,e)*d%e,y=Ui(p,r,e)*d%e,A=Ui(y,Kg,e)*l%e,P=Ui(A,i,e)*A%e,N=Ui(P,s,e)*P%e,D=Ui(N,a,e)*N%e,k=Ui(D,u,e)*D%e,B=Ui(k,a,e)*N%e,q=Ui(B,r,e)*d%e,j=Ui(q,o,e)*P%e,H=Ui(j,n,e)*l%e,J=Ui(H,Kg,e);if(!Vg.eql(Vg.sqr(J),t))throw new Error("Cannot find square root");return J}const Vg=u2(m2,void 0,void 0,{sqrt:jC}),y2=$C({a:BigInt(0),b:BigInt(7),Fp:Vg,n:v2,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=v2,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-FC*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=b2(s*t,e),u=b2(-n*t,e);let l=di(t-a*r-u*i,e),d=di(-a*n-u*s,e);const p=l>o,y=d>o;if(p&&(l=e-l),y&&(d=e-d),l>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:p,k1:l,k2neg:y,k2:d}}}},Pg);BigInt(0),y2.ProjectivePoint;const UC=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:y2},Symbol.toStringTag,{value:"Module"}));function qC(t,e){const{abi:r,args:n,bytecode:i,...s}=e,o=qI({abi:r,args:n,bytecode:i});return Dg(t,{...s,data:o})}async function zC(t){var r;return((r=t.account)==null?void 0:r.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(n=>Af(n))}async function HC(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}async function WC(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>og(r))}async function KC(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function VC(t,{account:e=t.account,message:r}){if(!e)throw new qf({docsPath:"/docs/actions/wallet/signMessage"});const n=fo(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Oh(r):r.raw instanceof Uint8Array?Dh(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function GC(t,e){var l,d,p,y;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new qf({docsPath:"/docs/actions/wallet/signTransaction"});const s=fo(r);qh({account:s,...e});const o=await fi(t,Hh,"getChainId")({});n!==null&&Xw({currentChainId:o,chain:n});const a=(n==null?void 0:n.formatters)||((l=t.chain)==null?void 0:l.formatters),u=((d=a==null?void 0:a.transactionRequest)==null?void 0:d.format)||Sg;return s.signTransaction?s.signTransaction({...i,chainId:o},{serializer:(y=(p=t.chain)==null?void 0:p.serializers)==null?void 0:y.transaction}):await t.request({method:"eth_signTransaction",params:[{...u(i),chainId:Pr(o),from:s.address}]},{retryCount:0})}async function YC(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new qf({docsPath:"/docs/actions/wallet/signTypedData"});const o=fo(r),a={EIP712Domain:aC({domain:n}),...e.types};if(oC({domain:n,message:i,primaryType:s,types:a}),o.signTypedData)return o.signTypedData({domain:n,message:i,primaryType:s,types:a});const u=sC({domain:n,message:i,primaryType:s,types:a});return t.request({method:"eth_signTypedData_v4",params:[o.address,u]},{retryCount:0})}async function JC(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:Pr(e)}]},{retryCount:0})}async function XC(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}function ZC(t){return{addChain:e=>KI(t,e),deployContract:e=>qC(t,e),getAddresses:()=>zC(t),getChainId:()=>Hh(t),getPermissions:()=>HC(t),prepareTransactionRequest:e=>Ig(t,e),requestAddresses:()=>WC(t),requestPermissions:e=>KC(t,e),sendRawTransaction:e=>Zw(t,e),sendTransaction:e=>Dg(t,e),signMessage:e=>VC(t,e),signTransaction:e=>GC(t,e),signTypedData:e=>YC(t,e),switchChain:e=>JC(t,e),watchAsset:e=>XC(t,e),writeContract:e=>WI(t,e)}}function QC(t){const{key:e="wallet",name:r="Wallet Client",transport:n}=t;return VI({...t,key:e,name:r,transport:n,type:"walletClient"}).extend(ZC)}class ru{constructor(e){oo(this,"_key");oo(this,"_config",null);oo(this,"_provider",null);oo(this,"_connected",!1);oo(this,"_address",null);oo(this,"_fatured",!1);oo(this,"_installed",!1);oo(this,"lastUsed",!1);var r;if("name"in e&&"image"in e)this._key=e.name,this._config=e,this._fatured=e.featured;else if("session"in e){if(!e.session)throw new Error("session is null");this._key=(r=e.session)==null?void 0:r.peer.metadata.name,this._provider=e,this._config={name:e.session.peer.metadata.name,image:e.session.peer.metadata.icons[0],featured:!1}}else if("info"in e)console.log(e.info,"installed"),this._key=e.info.name,this._provider=e.provider,this._installed=!0,this._config={name:e.info.name,image:e.info.icon,featured:!1},this.testConnect();else throw new Error("unknown params")}get address(){return this._address}get connected(){return this._connected}get featured(){return this._fatured}get key(){return this._key}get installed(){return this._installed}get provider(){return this._provider}get client(){return this._provider?QC({transport:QI(this._provider)}):null}get config(){return this._config}static fromWalletConfig(e){return new ru(e)}EIP6963Detected(e){this._provider=e.provider,this._installed=!0,this._provider.on("disconnect",this.disconnect),this._provider.on("accountsChanged",r=>{this._address=r[0],this._connected=!0}),this.testConnect()}setUniversalProvider(e){this._provider=e,this.testConnect()}async testConnect(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());e&&e.length>0?(this._address=e[0],this._connected=!0):(this._address=null,this._connected=!1)}async connect(){var r;const e=await((r=this.client)==null?void 0:r.request({method:"eth_requestAccounts",params:void 0}));if(!e)throw new Error("connect failed");return e}async getAddress(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());if(!e)throw new Error("get address failed");return e[0]}async getChain(){var r;const e=await((r=this.client)==null?void 0:r.getChainId());if(!e)throw new Error("get chain failed");return e}async signMessage(e,r){var i;return await((i=this.client)==null?void 0:i.signMessage({message:e,account:r}))}async disconnect(){this._provider&&"session"in this._provider&&await this._provider.disconnect(),this._connected=!1,this._address=null}}var Gg={exports:{}},nu=typeof Reflect=="object"?Reflect:null,w2=nu&&typeof nu.apply=="function"?nu.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Jh;nu&&typeof nu.ownKeys=="function"?Jh=nu.ownKeys:Object.getOwnPropertySymbols?Jh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Jh=function(e){return Object.getOwnPropertyNames(e)};function eT(t){console&&console.warn&&console.warn(t)}var x2=Number.isNaN||function(e){return e!==e};function Rr(){Rr.init.call(this)}Gg.exports=Rr,Gg.exports.once=iT,Rr.EventEmitter=Rr,Rr.prototype._events=void 0,Rr.prototype._eventsCount=0,Rr.prototype._maxListeners=void 0;var _2=10;function Xh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Rr,"defaultMaxListeners",{enumerable:!0,get:function(){return _2},set:function(t){if(typeof t!="number"||t<0||x2(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");_2=t}}),Rr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Rr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||x2(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function E2(t){return t._maxListeners===void 0?Rr.defaultMaxListeners:t._maxListeners}Rr.prototype.getMaxListeners=function(){return E2(this)},Rr.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")w2(u,this,r);else for(var l=u.length,d=I2(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,eT(a)}return t}Rr.prototype.addListener=function(e,r){return S2(this,e,r,!1)},Rr.prototype.on=Rr.prototype.addListener,Rr.prototype.prependListener=function(e,r){return S2(this,e,r,!0)};function tT(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function A2(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=tT.bind(n);return i.listener=r,n.wrapFn=i,i}Rr.prototype.once=function(e,r){return Xh(r),this.on(e,A2(this,e,r)),this},Rr.prototype.prependOnceListener=function(e,r){return Xh(r),this.prependListener(e,A2(this,e,r)),this},Rr.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Xh(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():rT(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Rr.prototype.off=Rr.prototype.removeListener,Rr.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function P2(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?nT(i):I2(i,i.length)}Rr.prototype.listeners=function(e){return P2(this,e,!0)},Rr.prototype.rawListeners=function(e){return P2(this,e,!1)},Rr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):M2.call(t,e)},Rr.prototype.listenerCount=M2;function M2(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Rr.prototype.eventNames=function(){return this._eventsCount>0?Jh(this._events):[]};function I2(t,e){for(var r=new Array(e),n=0;n=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function uT(t,e){return function(r,n){e(r,n,t)}}function fT(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function lT(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(d){try{l(n.next(d))}catch(p){o(p)}}function u(d){try{l(n.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):i(d.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function hT(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return u([l,d])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function C2(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function gT(){for(var t=[],e=0;e1||a(y,A)})})}function a(y,A){try{u(n[y](A))}catch(P){p(s[0][3],P)}}function u(y){y.value instanceof Kf?Promise.resolve(y.value.v).then(l,d):p(s[0][2],y)}function l(y){a("next",y)}function d(y){a("throw",y)}function p(y,A){y(A),s.shift(),s.length&&a(s[0][0],s[0][1])}}function bT(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Kf(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function yT(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Zg=="function"?Zg(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function wT(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function xT(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function _T(t){return t&&t.__esModule?t:{default:t}}function ET(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function ST(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const Vf=Jp(Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Xg},__asyncDelegator:bT,__asyncGenerator:vT,__asyncValues:yT,__await:Kf,__awaiter:lT,__classPrivateFieldGet:ET,__classPrivateFieldSet:ST,__createBinding:dT,__decorate:cT,__exportStar:pT,__extends:oT,__generator:hT,__importDefault:_T,__importStar:xT,__makeTemplateObject:wT,__metadata:fT,__param:uT,__read:C2,__rest:aT,__spread:gT,__spreadArrays:mT,__values:Zg},Symbol.toStringTag,{value:"Module"})));var Qg={},Gf={},T2;function AT(){if(T2)return Gf;T2=1,Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Gf.delay=t,Gf}var qa={},em={},za={},R2;function PT(){return R2||(R2=1,Object.defineProperty(za,"__esModule",{value:!0}),za.ONE_THOUSAND=za.ONE_HUNDRED=void 0,za.ONE_HUNDRED=100,za.ONE_THOUSAND=1e3),za}var tm={},D2;function MT(){return D2||(D2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(tm)),tm}var O2;function N2(){return O2||(O2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(PT(),t),e.__exportStar(MT(),t)}(em)),em}var L2;function IT(){if(L2)return qa;L2=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.fromMiliseconds=qa.toMiliseconds=void 0;const t=N2();function e(n){return n*t.ONE_THOUSAND}qa.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return qa.fromMiliseconds=r,qa}var k2;function CT(){return k2||(k2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(AT(),t),e.__exportStar(IT(),t)}(Qg)),Qg}var nu={},B2;function TT(){if(B2)return nu;B2=1,Object.defineProperty(nu,"__esModule",{value:!0}),nu.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return nu.Watch=t,nu.default=t,nu}var rm={},Yf={},$2;function RT(){if($2)return Yf;$2=1,Object.defineProperty(Yf,"__esModule",{value:!0}),Yf.IWatch=void 0;class t{}return Yf.IWatch=t,Yf}var F2;function DT(){return F2||(F2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Vf.__exportStar(RT(),t)}(rm)),rm}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(CT(),t),e.__exportStar(TT(),t),e.__exportStar(DT(),t),e.__exportStar(N2(),t)})(mt);class Ha{}let OT=class extends Ha{constructor(e){super()}};const j2=mt.FIVE_SECONDS,iu={pulse:"heartbeat_pulse"};let NT=class GA extends OT{constructor(e){super(e),this.events=new qi.EventEmitter,this.interval=j2,this.interval=(e==null?void 0:e.interval)||j2}static async init(e){const r=new GA(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),mt.toMiliseconds(this.interval))}pulse(){this.events.emit(iu.pulse)}};const LT=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,kT=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,BT=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function $T(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){FT(t);return}return e}function FT(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Zh(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!BT.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(LT.test(t)||kT.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,$T)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function jT(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Cn(t,...e){try{return jT(t(...e))}catch(r){return Promise.reject(r)}}function UT(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function qT(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Qh(t){if(UT(t))return String(t);if(qT(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Qh(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function U2(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const nm="base64:";function zT(t){if(typeof t=="string")return t;U2();const e=Buffer.from(t).toString("base64");return nm+e}function HT(t){return typeof t!="string"||!t.startsWith(nm)?t:(U2(),Buffer.from(t.slice(nm.length),"base64"))}function pi(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function WT(...t){return pi(t.join(":"))}function ed(t){return t=pi(t),t?t+":":""}function doe(t){return t}const KT="memory",VT=()=>{const t=new Map;return{name:KT,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function GT(t={}){const e={mounts:{"":t.driver||VT()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const d of e.mountpoints)if(l.startsWith(d))return{base:d,relativeKey:l.slice(d.length),driver:e.mounts[d]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,d)=>e.mountpoints.filter(p=>p.startsWith(l)||d&&l.startsWith(p)).map(p=>({relativeBase:l.length>p.length?l.slice(p.length):void 0,mountpoint:p,driver:e.mounts[p]})),i=(l,d)=>{if(e.watching){d=pi(d);for(const p of e.watchListeners)p(l,d)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await q2(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,d,p)=>{const y=new Map,A=P=>{let N=y.get(P.base);return N||(N={driver:P.driver,base:P.base,items:[]},y.set(P.base,N)),N};for(const P of l){const N=typeof P=="string",D=pi(N?P:P.key),k=N?void 0:P.value,B=N||!P.options?d:{...d,...P.options},j=r(D);A(j).items.push({key:D,value:k,relativeKey:j.relativeKey,options:B})}return Promise.all([...y.values()].map(P=>p(P))).then(P=>P.flat())},u={hasItem(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return Cn(y.hasItem,p,d)},getItem(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return Cn(y.getItem,p,d).then(A=>Zh(A))},getItems(l,d){return a(l,d,p=>p.driver.getItems?Cn(p.driver.getItems,p.items.map(y=>({key:y.relativeKey,options:y.options})),d).then(y=>y.map(A=>({key:WT(p.base,A.key),value:Zh(A.value)}))):Promise.all(p.items.map(y=>Cn(p.driver.getItem,y.relativeKey,y.options).then(A=>({key:y.key,value:Zh(A)})))))},getItemRaw(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return y.getItemRaw?Cn(y.getItemRaw,p,d):Cn(y.getItem,p,d).then(A=>HT(A))},async setItem(l,d,p={}){if(d===void 0)return u.removeItem(l);l=pi(l);const{relativeKey:y,driver:A}=r(l);A.setItem&&(await Cn(A.setItem,y,Qh(d),p),A.watch||i("update",l))},async setItems(l,d){await a(l,d,async p=>{if(p.driver.setItems)return Cn(p.driver.setItems,p.items.map(y=>({key:y.relativeKey,value:Qh(y.value),options:y.options})),d);p.driver.setItem&&await Promise.all(p.items.map(y=>Cn(p.driver.setItem,y.relativeKey,Qh(y.value),y.options)))})},async setItemRaw(l,d,p={}){if(d===void 0)return u.removeItem(l,p);l=pi(l);const{relativeKey:y,driver:A}=r(l);if(A.setItemRaw)await Cn(A.setItemRaw,y,d,p);else if(A.setItem)await Cn(A.setItem,y,zT(d),p);else return;A.watch||i("update",l)},async removeItem(l,d={}){typeof d=="boolean"&&(d={removeMeta:d}),l=pi(l);const{relativeKey:p,driver:y}=r(l);y.removeItem&&(await Cn(y.removeItem,p,d),(d.removeMeta||d.removeMata)&&await Cn(y.removeItem,p+"$",d),y.watch||i("remove",l))},async getMeta(l,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),l=pi(l);const{relativeKey:p,driver:y}=r(l),A=Object.create(null);if(y.getMeta&&Object.assign(A,await Cn(y.getMeta,p,d)),!d.nativeOnly){const P=await Cn(y.getItem,p+"$",d).then(N=>Zh(N));P&&typeof P=="object"&&(typeof P.atime=="string"&&(P.atime=new Date(P.atime)),typeof P.mtime=="string"&&(P.mtime=new Date(P.mtime)),Object.assign(A,P))}return A},setMeta(l,d,p={}){return this.setItem(l+"$",d,p)},removeMeta(l,d={}){return this.removeItem(l+"$",d)},async getKeys(l,d={}){l=ed(l);const p=n(l,!0);let y=[];const A=[];for(const P of p){const N=await Cn(P.driver.getKeys,P.relativeBase,d);for(const D of N){const k=P.mountpoint+pi(D);y.some(B=>k.startsWith(B))||A.push(k)}y=[P.mountpoint,...y.filter(D=>!D.startsWith(P.mountpoint))]}return l?A.filter(P=>P.startsWith(l)&&P[P.length-1]!=="$"):A.filter(P=>P[P.length-1]!=="$")},async clear(l,d={}){l=ed(l),await Promise.all(n(l,!1).map(async p=>{if(p.driver.clear)return Cn(p.driver.clear,p.relativeBase,d);if(p.driver.removeItem){const y=await p.driver.getKeys(p.relativeBase||"",d);return Promise.all(y.map(A=>p.driver.removeItem(A,d)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>z2(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(d=>d!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,d){if(l=ed(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((p,y)=>y.length-p.length)),e.mounts[l]=d,e.watching&&Promise.resolve(q2(d,i,l)).then(p=>{e.unwatch[l]=p}).catch(console.error),u},async unmount(l,d=!0){l=ed(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),d&&await z2(e.mounts[l]),e.mountpoints=e.mountpoints.filter(p=>p!==l),delete e.mounts[l])},getMount(l=""){l=pi(l)+":";const d=r(l);return{driver:d.driver,base:d.base}},getMounts(l="",d={}){return l=pi(l),n(l,d.parents).map(y=>({driver:y.driver,base:y.mountpoint}))},keys:(l,d={})=>u.getKeys(l,d),get:(l,d={})=>u.getItem(l,d),set:(l,d,p={})=>u.setItem(l,d,p),has:(l,d={})=>u.hasItem(l,d),del:(l,d={})=>u.removeItem(l,d),remove:(l,d={})=>u.removeItem(l,d)};return u}function q2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function z2(t){typeof t.dispose=="function"&&await Cn(t.dispose)}function Wa(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function H2(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Wa(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let im;function Jf(){return im||(im=H2("keyval-store","keyval")),im}function W2(t,e=Jf()){return e("readonly",r=>Wa(r.get(t)))}function YT(t,e,r=Jf()){return r("readwrite",n=>(n.put(e,t),Wa(n.transaction)))}function JT(t,e=Jf()){return e("readwrite",r=>(r.delete(t),Wa(r.transaction)))}function XT(t=Jf()){return t("readwrite",e=>(e.clear(),Wa(e.transaction)))}function ZT(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Wa(t.transaction)}function QT(t=Jf()){return t("readonly",e=>{if(e.getAllKeys)return Wa(e.getAllKeys());const r=[];return ZT(e,n=>r.push(n.key)).then(()=>r)})}const eR=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),tR=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Ka(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return tR(t)}catch{return t}}function mo(t){return typeof t=="string"?t:eR(t)||""}const rR="idb-keyval";var nR=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=H2(t.dbName,t.storeName)),{name:rR,options:t,async hasItem(i){return!(typeof await W2(r(i),n)>"u")},async getItem(i){return await W2(r(i),n)??null},setItem(i,s){return YT(r(i),s,n)},removeItem(i){return JT(r(i),n)},getKeys(){return QT(n)},clear(){return XT(n)}}};const iR="WALLET_CONNECT_V2_INDEXED_DB",sR="keyvaluestorage";let oR=class{constructor(){this.indexedDb=GT({driver:nR({dbName:iR,storeName:sR})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,mo(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var sm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},td={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof sm<"u"&&sm.localStorage?td.exports=sm.localStorage:typeof window<"u"&&window.localStorage?td.exports=window.localStorage:td.exports=new e})();function aR(t){var e;return[t[0],Ka((e=t[1])!=null?e:"")]}let cR=class{constructor(){this.localStorage=td.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(aR)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Ka(r)}async setItem(e,r){this.localStorage.setItem(e,mo(r))}async removeItem(e){this.localStorage.removeItem(e)}};const uR="wc_storage_version",K2=1,fR=async(t,e,r)=>{const n=uR,i=await e.getItem(n);if(i&&i>=K2){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,K2),r(e),lR(t,o)},lR=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let hR=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new cR;this.storage=e;try{const r=new oR;fR(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function dR(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var pR=gR;function gR(t,e,r){var n=r&&r.stringify||dR,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?p:0,t.charCodeAt(A+1)){case 100:case 102:if(d>=u||e[d]==null)break;p=u||e[d]==null)break;p=u||e[d]===void 0)break;p",p=A+2,A++;break}l+=n(e[d]),p=A+2,A++;break;case 115:if(d>=u)break;p-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",u=Object.create(r);u.log||(u.log=Zf),Object.defineProperty(u,"levelVal",{get:d}),Object.defineProperty(u,"level",{get:p,set:y});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:_R(t)};u.levels=vo.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Zf,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=A,e&&(u._logEvent=om());function d(){return this.level==="silent"?1/0:this.levels.values[this.level]}function p(){return this._level}function y(P){if(P!=="silent"&&!this.levels.values[P])throw Error("unknown level "+P);this._level=P,ou(l,u,"error","log"),ou(l,u,"fatal","error"),ou(l,u,"warn","error"),ou(l,u,"info","log"),ou(l,u,"debug","log"),ou(l,u,"trace","log")}function A(P,N){if(!P)throw new Error("missing bindings for child Pino");N=N||{},i&&P.serializers&&(N.serializers=P.serializers);const D=N.serializers;if(i&&D){var k=Object.assign({},n,D),B=t.browser.serialize===!0?Object.keys(k):i;delete P.serializers,rd([P],B,k,this._stdErrSerialize)}function j(U){this._childLevel=(U._childLevel|0)+1,this.error=au(U,P,"error"),this.fatal=au(U,P,"fatal"),this.warn=au(U,P,"warn"),this.info=au(U,P,"info"),this.debug=au(U,P,"debug"),this.trace=au(U,P,"trace"),k&&(this.serializers=k,this._serialize=B),e&&(this._logEvent=om([].concat(U._logEvent.bindings,P)))}return j.prototype=this,new j(this)}return u}vo.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},vo.stdSerializers=mR,vo.stdTimeFunctions=Object.assign({},{nullTime:G2,epochTime:Y2,unixTime:ER,isoTime:SR});function ou(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Zf:i[r]?i[r]:Xf[r]||Xf[n]||Zf,bR(t,e,r)}function bR(t,e,r){!t.transmit&&e[r]===Zf||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Xf?Xf:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function au(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},X2=class{constructor(e,r=cm){this.level=e??"error",this.levelValue=su.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new J2(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===su.levels.values.error?console.error(e):r===su.levels.values.warn?console.warn(e):r===su.levels.values.debug?console.debug(e):r===su.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(mo({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new J2(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(mo({extraMetadata:e})),new Blob(r,{type:"application/json"})}},IR=class{constructor(e,r=cm){this.baseChunkLogger=new X2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},CR=class{constructor(e,r=cm){this.baseChunkLogger=new X2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var TR=Object.defineProperty,RR=Object.defineProperties,DR=Object.getOwnPropertyDescriptors,Z2=Object.getOwnPropertySymbols,OR=Object.prototype.hasOwnProperty,NR=Object.prototype.propertyIsEnumerable,Q2=(t,e,r)=>e in t?TR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,id=(t,e)=>{for(var r in e||(e={}))OR.call(e,r)&&Q2(t,r,e[r]);if(Z2)for(var r of Z2(e))NR.call(e,r)&&Q2(t,r,e[r]);return t},sd=(t,e)=>RR(t,DR(e));function od(t){return sd(id({},t),{level:(t==null?void 0:t.level)||PR.level})}function LR(t,e=el){return t[e]||""}function kR(t,e,r=el){return t[r]=e,t}function gi(t,e=el){let r="";return typeof t.bindings>"u"?r=LR(t,e):r=t.bindings().context||"",r}function BR(t,e,r=el){const n=gi(t,r);return n.trim()?`${n}/${e}`:e}function ri(t,e,r=el){const n=BR(t,e,r),i=t.child({context:n});return kR(i,n,r)}function $R(t){var e,r;const n=new IR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace",browser:sd(id({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function FR(t){var e;const r=new CR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function jR(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?$R(t):FR(t)}let UR=class extends Ha{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},qR=class extends Ha{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},zR=class{constructor(e,r){this.logger=e,this.core=r}},HR=class extends Ha{constructor(e,r){super(),this.relayer=e,this.logger=r}},WR=class extends Ha{constructor(e){super()}},KR=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},VR=class extends Ha{constructor(e,r){super(),this.relayer=e,this.logger=r}},GR=class extends Ha{constructor(e,r){super(),this.core=e,this.logger=r}},YR=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},JR=class{constructor(e,r){this.projectId=e,this.logger=r}},XR=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},ZR=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},QR=class{constructor(e){this.client=e}};var um={},ta={},ad={},cd={};Object.defineProperty(cd,"__esModule",{value:!0}),cd.BrowserRandomSource=void 0;const ex=65536;class eD{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let n=0;n>>16&65535,d=a&65535,p=u>>>16&65535,y=u&65535;return d*y+(l*y+d*p<<16>>>0)|0}t.mul=Math.imul||e;function r(a,u){return a+u|0}t.add=r;function n(a,u){return a-u|0}t.sub=n;function i(a,u){return a<>>32-u}t.rotl=i;function s(a,u){return a<<32-u|a>>>u}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(rx),Object.defineProperty(or,"__esModule",{value:!0});var nx=rx;function aD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}or.readInt16BE=aD;function cD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}or.readUint16BE=cD;function uD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}or.readInt16LE=uD;function fD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}or.readUint16LE=fD;function ix(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}or.writeUint16BE=ix,or.writeInt16BE=ix;function sx(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}or.writeUint16LE=sx,or.writeInt16LE=sx;function fm(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}or.readInt32BE=fm;function lm(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}or.readUint32BE=lm;function hm(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}or.readInt32LE=hm;function dm(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}or.readUint32LE=dm;function fd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}or.writeUint32BE=fd,or.writeInt32BE=fd;function ld(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}or.writeUint32LE=ld,or.writeInt32LE=ld;function lD(t,e){e===void 0&&(e=0);var r=fm(t,e),n=fm(t,e+4);return r*4294967296+n-(n>>31)*4294967296}or.readInt64BE=lD;function hD(t,e){e===void 0&&(e=0);var r=lm(t,e),n=lm(t,e+4);return r*4294967296+n}or.readUint64BE=hD;function dD(t,e){e===void 0&&(e=0);var r=hm(t,e),n=hm(t,e+4);return n*4294967296+r-(r>>31)*4294967296}or.readInt64LE=dD;function pD(t,e){e===void 0&&(e=0);var r=dm(t,e),n=dm(t,e+4);return n*4294967296+r}or.readUint64LE=pD;function ox(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fd(t/4294967296>>>0,e,r),fd(t>>>0,e,r+4),e}or.writeUint64BE=ox,or.writeInt64BE=ox;function ax(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ld(t>>>0,e,r),ld(t/4294967296>>>0,e,r+4),e}or.writeUint64LE=ax,or.writeInt64LE=ax;function gD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}or.readUintBE=gD;function mD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}or.writeUintBE=vD;function bD(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!nx.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s256)throw new Error("randomString charset is too long");let y="";const A=d.length,P=256-256%A;for(;l>0;){const N=i(Math.ceil(l*256/P),p);for(let D=0;D0;D++){const k=N[D];k0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,A=l%128<112?128:256;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._stateHi.set(u.stateHi),this._stateLo.set(u.stateLo),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.stateHi),r.wipe(u.stateLo),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,u,l,d,p,y,A){for(var P=l[0],N=l[1],D=l[2],k=l[3],B=l[4],j=l[5],U=l[6],K=l[7],J=d[0],T=d[1],z=d[2],ue=d[3],_e=d[4],G=d[5],E=d[6],m=d[7],f,g,v,x,_,S,b,M;A>=128;){for(var I=0;I<16;I++){var F=8*I+y;a[I]=e.readUint32BE(p,F),u[I]=e.readUint32BE(p,F+4)}for(var I=0;I<80;I++){var ae=P,O=N,se=D,ee=k,X=B,Q=j,R=U,Z=K,te=J,le=T,ie=z,fe=ue,ve=_e,Me=G,Ne=E,Te=m;if(f=K,g=m,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=(B>>>14|_e<<18)^(B>>>18|_e<<14)^(_e>>>9|B<<23),g=(_e>>>14|B<<18)^(_e>>>18|B<<14)^(B>>>9|_e<<23),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=B&j^~B&U,g=_e&G^~_e&E,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=i[I*2],g=i[I*2+1],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=a[I%16],g=u[I%16],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,v=b&65535|M<<16,x=_&65535|S<<16,f=v,g=x,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=(P>>>28|J<<4)^(J>>>2|P<<30)^(J>>>7|P<<25),g=(J>>>28|P<<4)^(P>>>2|J<<30)^(P>>>7|J<<25),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=P&N^P&D^N&D,g=J&T^J&z^T&z,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,Z=b&65535|M<<16,Te=_&65535|S<<16,f=ee,g=fe,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=v,g=x,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,ee=b&65535|M<<16,fe=_&65535|S<<16,N=ae,D=O,k=se,B=ee,j=X,U=Q,K=R,P=Z,T=te,z=le,ue=ie,_e=fe,G=ve,E=Me,m=Ne,J=Te,I%16===15)for(var F=0;F<16;F++)f=a[F],g=u[F],_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=a[(F+9)%16],g=u[(F+9)%16],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,v=a[(F+1)%16],x=u[(F+1)%16],f=(v>>>1|x<<31)^(v>>>8|x<<24)^v>>>7,g=(x>>>1|v<<31)^(x>>>8|v<<24)^(x>>>7|v<<25),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,v=a[(F+14)%16],x=u[(F+14)%16],f=(v>>>19|x<<13)^(x>>>29|v<<3)^v>>>6,g=(x>>>19|v<<13)^(v>>>29|x<<3)^(x>>>6|v<<26),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,a[F]=b&65535|M<<16,u[F]=_&65535|S<<16}f=P,g=J,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[0],g=d[0],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[0]=P=b&65535|M<<16,d[0]=J=_&65535|S<<16,f=N,g=T,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[1],g=d[1],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[1]=N=b&65535|M<<16,d[1]=T=_&65535|S<<16,f=D,g=z,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[2],g=d[2],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[2]=D=b&65535|M<<16,d[2]=z=_&65535|S<<16,f=k,g=ue,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[3],g=d[3],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[3]=k=b&65535|M<<16,d[3]=ue=_&65535|S<<16,f=B,g=_e,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[4],g=d[4],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[4]=B=b&65535|M<<16,d[4]=_e=_&65535|S<<16,f=j,g=G,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[5],g=d[5],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[5]=j=b&65535|M<<16,d[5]=G=_&65535|S<<16,f=U,g=E,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[6],g=d[6],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[6]=U=b&65535|M<<16,d[6]=E=_&65535|S<<16,f=K,g=m,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[7],g=d[7],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[7]=K=b&65535|M<<16,d[7]=m=_&65535|S<<16,y+=128,A-=128}return y}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(cx),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=ta,r=cx,n=Mi;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(ee){const X=new Float64Array(16);if(ee)for(let Q=0;Q>16&1),Q[le-1]&=65535;Q[15]=R[15]-32767-(Q[14]>>16&1);const te=Q[15]>>16&1;Q[14]&=65535,N(R,Q,1-te)}for(let Z=0;Z<16;Z++)ee[2*Z]=R[Z]&255,ee[2*Z+1]=R[Z]>>8}function k(ee,X){let Q=0;for(let R=0;R<32;R++)Q|=ee[R]^X[R];return(1&Q-1>>>8)-1}function B(ee,X){const Q=new Uint8Array(32),R=new Uint8Array(32);return D(Q,ee),D(R,X),k(Q,R)}function j(ee){const X=new Uint8Array(32);return D(X,ee),X[0]&1}function U(ee,X){for(let Q=0;Q<16;Q++)ee[Q]=X[2*Q]+(X[2*Q+1]<<8);ee[15]&=32767}function K(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]+Q[R]}function J(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]-Q[R]}function T(ee,X,Q){let R,Z,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=0,Ie=0,Le=0,Ve=0,ke=0,ze=0,He=0,Ee=0,Qe=0,ct=0,Be=0,et=0,rt=0,Je=0,pt=0,ht=0,ft=0,Ht=0,Jt=0,St=0,er=0,Xt=0,Ot=0,Bt=Q[0],Tt=Q[1],vt=Q[2],Dt=Q[3],Lt=Q[4],bt=Q[5],$t=Q[6],jt=Q[7],nt=Q[8],Ft=Q[9],$=Q[10],H=Q[11],V=Q[12],C=Q[13],Y=Q[14],q=Q[15];R=X[0],te+=R*Bt,le+=R*Tt,ie+=R*vt,fe+=R*Dt,ve+=R*Lt,Me+=R*bt,Ne+=R*$t,Te+=R*jt,$e+=R*nt,Ie+=R*Ft,Le+=R*$,Ve+=R*H,ke+=R*V,ze+=R*C,He+=R*Y,Ee+=R*q,R=X[1],le+=R*Bt,ie+=R*Tt,fe+=R*vt,ve+=R*Dt,Me+=R*Lt,Ne+=R*bt,Te+=R*$t,$e+=R*jt,Ie+=R*nt,Le+=R*Ft,Ve+=R*$,ke+=R*H,ze+=R*V,He+=R*C,Ee+=R*Y,Qe+=R*q,R=X[2],ie+=R*Bt,fe+=R*Tt,ve+=R*vt,Me+=R*Dt,Ne+=R*Lt,Te+=R*bt,$e+=R*$t,Ie+=R*jt,Le+=R*nt,Ve+=R*Ft,ke+=R*$,ze+=R*H,He+=R*V,Ee+=R*C,Qe+=R*Y,ct+=R*q,R=X[3],fe+=R*Bt,ve+=R*Tt,Me+=R*vt,Ne+=R*Dt,Te+=R*Lt,$e+=R*bt,Ie+=R*$t,Le+=R*jt,Ve+=R*nt,ke+=R*Ft,ze+=R*$,He+=R*H,Ee+=R*V,Qe+=R*C,ct+=R*Y,Be+=R*q,R=X[4],ve+=R*Bt,Me+=R*Tt,Ne+=R*vt,Te+=R*Dt,$e+=R*Lt,Ie+=R*bt,Le+=R*$t,Ve+=R*jt,ke+=R*nt,ze+=R*Ft,He+=R*$,Ee+=R*H,Qe+=R*V,ct+=R*C,Be+=R*Y,et+=R*q,R=X[5],Me+=R*Bt,Ne+=R*Tt,Te+=R*vt,$e+=R*Dt,Ie+=R*Lt,Le+=R*bt,Ve+=R*$t,ke+=R*jt,ze+=R*nt,He+=R*Ft,Ee+=R*$,Qe+=R*H,ct+=R*V,Be+=R*C,et+=R*Y,rt+=R*q,R=X[6],Ne+=R*Bt,Te+=R*Tt,$e+=R*vt,Ie+=R*Dt,Le+=R*Lt,Ve+=R*bt,ke+=R*$t,ze+=R*jt,He+=R*nt,Ee+=R*Ft,Qe+=R*$,ct+=R*H,Be+=R*V,et+=R*C,rt+=R*Y,Je+=R*q,R=X[7],Te+=R*Bt,$e+=R*Tt,Ie+=R*vt,Le+=R*Dt,Ve+=R*Lt,ke+=R*bt,ze+=R*$t,He+=R*jt,Ee+=R*nt,Qe+=R*Ft,ct+=R*$,Be+=R*H,et+=R*V,rt+=R*C,Je+=R*Y,pt+=R*q,R=X[8],$e+=R*Bt,Ie+=R*Tt,Le+=R*vt,Ve+=R*Dt,ke+=R*Lt,ze+=R*bt,He+=R*$t,Ee+=R*jt,Qe+=R*nt,ct+=R*Ft,Be+=R*$,et+=R*H,rt+=R*V,Je+=R*C,pt+=R*Y,ht+=R*q,R=X[9],Ie+=R*Bt,Le+=R*Tt,Ve+=R*vt,ke+=R*Dt,ze+=R*Lt,He+=R*bt,Ee+=R*$t,Qe+=R*jt,ct+=R*nt,Be+=R*Ft,et+=R*$,rt+=R*H,Je+=R*V,pt+=R*C,ht+=R*Y,ft+=R*q,R=X[10],Le+=R*Bt,Ve+=R*Tt,ke+=R*vt,ze+=R*Dt,He+=R*Lt,Ee+=R*bt,Qe+=R*$t,ct+=R*jt,Be+=R*nt,et+=R*Ft,rt+=R*$,Je+=R*H,pt+=R*V,ht+=R*C,ft+=R*Y,Ht+=R*q,R=X[11],Ve+=R*Bt,ke+=R*Tt,ze+=R*vt,He+=R*Dt,Ee+=R*Lt,Qe+=R*bt,ct+=R*$t,Be+=R*jt,et+=R*nt,rt+=R*Ft,Je+=R*$,pt+=R*H,ht+=R*V,ft+=R*C,Ht+=R*Y,Jt+=R*q,R=X[12],ke+=R*Bt,ze+=R*Tt,He+=R*vt,Ee+=R*Dt,Qe+=R*Lt,ct+=R*bt,Be+=R*$t,et+=R*jt,rt+=R*nt,Je+=R*Ft,pt+=R*$,ht+=R*H,ft+=R*V,Ht+=R*C,Jt+=R*Y,St+=R*q,R=X[13],ze+=R*Bt,He+=R*Tt,Ee+=R*vt,Qe+=R*Dt,ct+=R*Lt,Be+=R*bt,et+=R*$t,rt+=R*jt,Je+=R*nt,pt+=R*Ft,ht+=R*$,ft+=R*H,Ht+=R*V,Jt+=R*C,St+=R*Y,er+=R*q,R=X[14],He+=R*Bt,Ee+=R*Tt,Qe+=R*vt,ct+=R*Dt,Be+=R*Lt,et+=R*bt,rt+=R*$t,Je+=R*jt,pt+=R*nt,ht+=R*Ft,ft+=R*$,Ht+=R*H,Jt+=R*V,St+=R*C,er+=R*Y,Xt+=R*q,R=X[15],Ee+=R*Bt,Qe+=R*Tt,ct+=R*vt,Be+=R*Dt,et+=R*Lt,rt+=R*bt,Je+=R*$t,pt+=R*jt,ht+=R*nt,ft+=R*Ft,Ht+=R*$,Jt+=R*H,St+=R*V,er+=R*C,Xt+=R*Y,Ot+=R*q,te+=38*Qe,le+=38*ct,ie+=38*Be,fe+=38*et,ve+=38*rt,Me+=38*Je,Ne+=38*pt,Te+=38*ht,$e+=38*ft,Ie+=38*Ht,Le+=38*Jt,Ve+=38*St,ke+=38*er,ze+=38*Xt,He+=38*Ot,Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),ee[0]=te,ee[1]=le,ee[2]=ie,ee[3]=fe,ee[4]=ve,ee[5]=Me,ee[6]=Ne,ee[7]=Te,ee[8]=$e,ee[9]=Ie,ee[10]=Le,ee[11]=Ve,ee[12]=ke,ee[13]=ze,ee[14]=He,ee[15]=Ee}function z(ee,X){T(ee,X,X)}function ue(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=253;R>=0;R--)z(Q,Q),R!==2&&R!==4&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function _e(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=250;R>=0;R--)z(Q,Q),R!==1&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function G(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i(),ve=i(),Me=i();J(Q,ee[1],ee[0]),J(Me,X[1],X[0]),T(Q,Q,Me),K(R,ee[0],ee[1]),K(Me,X[0],X[1]),T(R,R,Me),T(Z,ee[3],X[3]),T(Z,Z,l),T(te,ee[2],X[2]),K(te,te,te),J(le,R,Q),J(ie,te,Z),K(fe,te,Z),K(ve,R,Q),T(ee[0],le,ie),T(ee[1],ve,fe),T(ee[2],fe,ie),T(ee[3],le,ve)}function E(ee,X,Q){for(let R=0;R<4;R++)N(ee[R],X[R],Q)}function m(ee,X){const Q=i(),R=i(),Z=i();ue(Z,X[2]),T(Q,X[0],Z),T(R,X[1],Z),D(ee,R),ee[31]^=j(Q)<<7}function f(ee,X,Q){A(ee[0],o),A(ee[1],a),A(ee[2],a),A(ee[3],o);for(let R=255;R>=0;--R){const Z=Q[R/8|0]>>(R&7)&1;E(ee,X,Z),G(X,ee),G(ee,ee),E(ee,X,Z)}}function g(ee,X){const Q=[i(),i(),i(),i()];A(Q[0],d),A(Q[1],p),A(Q[2],a),T(Q[3],d,p),f(ee,Q,X)}function v(ee){if(ee.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const X=(0,r.hash)(ee);X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(32),R=[i(),i(),i(),i()];g(R,X),m(Q,R);const Z=new Uint8Array(64);return Z.set(ee),Z.set(Q,32),{publicKey:Q,secretKey:Z}}t.generateKeyPairFromSeed=v;function x(ee){const X=(0,e.randomBytes)(32,ee),Q=v(X);return(0,n.wipe)(X),Q}t.generateKeyPair=x;function _(ee){if(ee.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(ee.subarray(32))}t.extractPublicKeyFromSecretKey=_;const S=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function b(ee,X){let Q,R,Z,te;for(R=63;R>=32;--R){for(Q=0,Z=R-32,te=R-12;Z>4)*S[Z],Q=X[Z]>>8,X[Z]&=255;for(Z=0;Z<32;Z++)X[Z]-=Q*S[Z];for(R=0;R<32;R++)X[R+1]+=X[R]>>8,ee[R]=X[R]&255}function M(ee){const X=new Float64Array(64);for(let Q=0;Q<64;Q++)X[Q]=ee[Q];for(let Q=0;Q<64;Q++)ee[Q]=0;b(ee,X)}function I(ee,X){const Q=new Float64Array(64),R=[i(),i(),i(),i()],Z=(0,r.hash)(ee.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(64);te.set(Z.subarray(32),32);const le=new r.SHA512;le.update(te.subarray(32)),le.update(X);const ie=le.digest();le.clean(),M(ie),g(R,ie),m(te,R),le.reset(),le.update(te.subarray(0,32)),le.update(ee.subarray(32)),le.update(X);const fe=le.digest();M(fe);for(let ve=0;ve<32;ve++)Q[ve]=ie[ve];for(let ve=0;ve<32;ve++)for(let Me=0;Me<32;Me++)Q[ve+Me]+=fe[ve]*Z[Me];return b(te.subarray(32),Q),te}t.sign=I;function F(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i();return A(ee[2],a),U(ee[1],X),z(Z,ee[1]),T(te,Z,u),J(Z,Z,ee[2]),K(te,ee[2],te),z(le,te),z(ie,le),T(fe,ie,le),T(Q,fe,Z),T(Q,Q,te),_e(Q,Q),T(Q,Q,Z),T(Q,Q,te),T(Q,Q,te),T(ee[0],Q,te),z(R,ee[0]),T(R,R,te),B(R,Z)&&T(ee[0],ee[0],y),z(R,ee[0]),T(R,R,te),B(R,Z)?-1:(j(ee[0])===X[31]>>7&&J(ee[0],o,ee[0]),T(ee[3],ee[0],ee[1]),0)}function ae(ee,X,Q){const R=new Uint8Array(32),Z=[i(),i(),i(),i()],te=[i(),i(),i(),i()];if(Q.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(F(te,ee))return!1;const le=new r.SHA512;le.update(Q.subarray(0,32)),le.update(ee),le.update(X);const ie=le.digest();return M(ie),f(Z,te,ie),g(te,Q.subarray(32)),G(Z,te),m(R,Z),!k(Q,R)}t.verify=ae;function O(ee){let X=[i(),i(),i(),i()];if(F(X,ee))throw new Error("Ed25519: invalid public key");let Q=i(),R=i(),Z=X[1];K(Q,a,Z),J(R,a,Z),ue(R,R),T(Q,Q,R);let te=new Uint8Array(32);return D(te,Q),te}t.convertPublicKeyToX25519=O;function se(ee){const X=(0,r.hash)(ee.subarray(0,32));X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(X.subarray(0,32));return(0,n.wipe)(X),Q}t.convertSecretKeyToX25519=se}(um);const MD="EdDSA",ID="JWT",hd=".",dd="base64url",ux="utf8",fx="utf8",CD=":",TD="did",RD="key",lx="base58btc",DD="z",OD="K36",ND=32;function hx(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function pd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=hx(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function LD(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(j);k!==B;){for(var K=P[k],J=0,T=j-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=j-D;z!==j&&U[z]===0;)z++;for(var ue=u.repeat(N);z>>0,j=new Uint8Array(B);P[N];){var U=r[P.charCodeAt(N)];if(U===255)return;for(var K=0,J=B-1;(U!==0||K>>0,j[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,N++}if(P[N]!==" "){for(var T=B-k;T!==B&&j[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=j[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:A}}var kD=LD,BD=kD;const $D=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},FD=t=>new TextEncoder().encode(t),jD=t=>new TextDecoder().decode(t);class UD{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class qD{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return dx(this,e)}}class zD{constructor(e){this.decoders=e}or(e){return dx(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const dx=(t,e)=>new zD({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class HD{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new UD(e,r,n),this.decoder=new qD(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const gd=({name:t,prefix:e,encode:r,decode:n})=>new HD(t,e,r,n),rl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=BD(r,e);return gd({prefix:t,name:e,encode:n,decode:s=>$D(i(s))})},WD=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},KD=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<gd({prefix:e,name:t,encode(i){return KD(i,n,r)},decode(i){return WD(i,n,r,t)}}),VD=gd({prefix:"\0",name:"identity",encode:t=>jD(t),decode:t=>FD(t)}),GD=Object.freeze(Object.defineProperty({__proto__:null,identity:VD},Symbol.toStringTag,{value:"Module"})),YD=jn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),JD=Object.freeze(Object.defineProperty({__proto__:null,base2:YD},Symbol.toStringTag,{value:"Module"})),XD=jn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),ZD=Object.freeze(Object.defineProperty({__proto__:null,base8:XD},Symbol.toStringTag,{value:"Module"})),QD=rl({prefix:"9",name:"base10",alphabet:"0123456789"}),eO=Object.freeze(Object.defineProperty({__proto__:null,base10:QD},Symbol.toStringTag,{value:"Module"})),tO=jn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),rO=jn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),nO=Object.freeze(Object.defineProperty({__proto__:null,base16:tO,base16upper:rO},Symbol.toStringTag,{value:"Module"})),iO=jn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),sO=jn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),oO=jn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),aO=jn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),cO=jn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),uO=jn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),fO=jn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),lO=jn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),hO=jn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),dO=Object.freeze(Object.defineProperty({__proto__:null,base32:iO,base32hex:cO,base32hexpad:fO,base32hexpadupper:lO,base32hexupper:uO,base32pad:oO,base32padupper:aO,base32upper:sO,base32z:hO},Symbol.toStringTag,{value:"Module"})),pO=rl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),gO=rl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),mO=Object.freeze(Object.defineProperty({__proto__:null,base36:pO,base36upper:gO},Symbol.toStringTag,{value:"Module"})),vO=rl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),bO=rl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),yO=Object.freeze(Object.defineProperty({__proto__:null,base58btc:vO,base58flickr:bO},Symbol.toStringTag,{value:"Module"})),wO=jn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),xO=jn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),_O=jn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),EO=jn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),SO=Object.freeze(Object.defineProperty({__proto__:null,base64:wO,base64pad:xO,base64url:_O,base64urlpad:EO},Symbol.toStringTag,{value:"Module"})),px=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),AO=px.reduce((t,e,r)=>(t[r]=e,t),[]),PO=px.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function MO(t){return t.reduce((e,r)=>(e+=AO[r],e),"")}function IO(t){const e=[];for(const r of t){const n=PO[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const CO=gd({prefix:"🚀",name:"base256emoji",encode:MO,decode:IO}),TO=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:CO},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const gx={...GD,...JD,...ZD,...eO,...nO,...dO,...mO,...yO,...SO,...TO};function mx(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const vx=mx("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),pm=mx("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=hx(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new jO:typeof navigator<"u"?KO(navigator.userAgent):GO()}function WO(t){return t!==""&&zO.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function KO(t){var e=WO(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new FO;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length-1){const D=P.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let k=e.protocol+"//"+e.host;if(D.indexOf("/")===0)k+=D;else{const B=e.pathname.split("/");B.pop();const j=B.join("/");k+=j+"/"+D}y.push(k)}else if(D.indexOf("//")===0){const k=e.protocol+D;y.push(k)}else y.push(D)}}return y}function n(...p){const y=t.getElementsByTagName("meta");for(let A=0;AP.getAttribute(D)).filter(D=>D?p.includes(D):!1);if(N.length&&N){const D=P.getAttribute("content");if(D)return D}}return""}function i(){let p=n("name","og:site_name","og:title","twitter:title");return p||(p=t.title),p}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}Px=vm.getWindowMetadata=oN;var il={},aN=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Ix="%[a-f0-9]{2}",Cx=new RegExp("("+Ix+")|([^%]+?)","gi"),Tx=new RegExp("("+Ix+")+","gi");function bm(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],bm(r),bm(n))}function cN(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(Cx)||[],r=1;r{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},hN=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;sB==null,o=Symbol("encodeFragmentIdentifier");function a(B){switch(B.arrayFormat){case"index":return j=>(U,K)=>{const J=U.length;return K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),"[",J,"]"].join("")]:[...U,[d(j,B),"[",d(J,B),"]=",d(K,B)].join("")]};case"bracket":return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),"[]"].join("")]:[...U,[d(j,B),"[]=",d(K,B)].join("")];case"colon-list-separator":return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,[d(j,B),":list="].join("")]:[...U,[d(j,B),":list=",d(K,B)].join("")];case"comma":case"separator":case"bracket-separator":{const j=B.arrayFormat==="bracket-separator"?"[]=":"=";return U=>(K,J)=>J===void 0||B.skipNull&&J===null||B.skipEmptyString&&J===""?K:(J=J===null?"":J,K.length===0?[[d(U,B),j,d(J,B)].join("")]:[[K,d(J,B)].join(B.arrayFormatSeparator)])}default:return j=>(U,K)=>K===void 0||B.skipNull&&K===null||B.skipEmptyString&&K===""?U:K===null?[...U,d(j,B)]:[...U,[d(j,B),"=",d(K,B)].join("")]}}function u(B){let j;switch(B.arrayFormat){case"index":return(U,K,J)=>{if(j=/\[(\d*)\]$/.exec(U),U=U.replace(/\[\d*\]$/,""),!j){J[U]=K;return}J[U]===void 0&&(J[U]={}),J[U][j[1]]=K};case"bracket":return(U,K,J)=>{if(j=/(\[\])$/.exec(U),U=U.replace(/\[\]$/,""),!j){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"colon-list-separator":return(U,K,J)=>{if(j=/(:list)$/.exec(U),U=U.replace(/:list$/,""),!j){J[U]=K;return}if(J[U]===void 0){J[U]=[K];return}J[U]=[].concat(J[U],K)};case"comma":case"separator":return(U,K,J)=>{const T=typeof K=="string"&&K.includes(B.arrayFormatSeparator),z=typeof K=="string"&&!T&&p(K,B).includes(B.arrayFormatSeparator);K=z?p(K,B):K;const ue=T||z?K.split(B.arrayFormatSeparator).map(_e=>p(_e,B)):K===null?K:p(K,B);J[U]=ue};case"bracket-separator":return(U,K,J)=>{const T=/(\[\])$/.test(U);if(U=U.replace(/\[\]$/,""),!T){J[U]=K&&p(K,B);return}const z=K===null?[]:K.split(B.arrayFormatSeparator).map(ue=>p(ue,B));if(J[U]===void 0){J[U]=z;return}J[U]=[].concat(J[U],z)};default:return(U,K,J)=>{if(J[U]===void 0){J[U]=K;return}J[U]=[].concat(J[U],K)}}}function l(B){if(typeof B!="string"||B.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function d(B,j){return j.encode?j.strict?e(B):encodeURIComponent(B):B}function p(B,j){return j.decode?r(B):B}function y(B){return Array.isArray(B)?B.sort():typeof B=="object"?y(Object.keys(B)).sort((j,U)=>Number(j)-Number(U)).map(j=>B[j]):B}function A(B){const j=B.indexOf("#");return j!==-1&&(B=B.slice(0,j)),B}function P(B){let j="";const U=B.indexOf("#");return U!==-1&&(j=B.slice(U)),j}function N(B){B=A(B);const j=B.indexOf("?");return j===-1?"":B.slice(j+1)}function D(B,j){return j.parseNumbers&&!Number.isNaN(Number(B))&&typeof B=="string"&&B.trim()!==""?B=Number(B):j.parseBooleans&&B!==null&&(B.toLowerCase()==="true"||B.toLowerCase()==="false")&&(B=B.toLowerCase()==="true"),B}function k(B,j){j=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},j),l(j.arrayFormatSeparator);const U=u(j),K=Object.create(null);if(typeof B!="string"||(B=B.trim().replace(/^[?#&]/,""),!B))return K;for(const J of B.split("&")){if(J==="")continue;let[T,z]=n(j.decode?J.replace(/\+/g," "):J,"=");z=z===void 0?null:["comma","separator","bracket-separator"].includes(j.arrayFormat)?z:p(z,j),U(p(T,j),z,K)}for(const J of Object.keys(K)){const T=K[J];if(typeof T=="object"&&T!==null)for(const z of Object.keys(T))T[z]=D(T[z],j);else K[J]=D(T,j)}return j.sort===!1?K:(j.sort===!0?Object.keys(K).sort():Object.keys(K).sort(j.sort)).reduce((J,T)=>{const z=K[T];return z&&typeof z=="object"&&!Array.isArray(z)?J[T]=y(z):J[T]=z,J},Object.create(null))}t.extract=N,t.parse=k,t.stringify=(B,j)=>{if(!B)return"";j=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},j),l(j.arrayFormatSeparator);const U=z=>j.skipNull&&s(B[z])||j.skipEmptyString&&B[z]==="",K=a(j),J={};for(const z of Object.keys(B))U(z)||(J[z]=B[z]);const T=Object.keys(J);return j.sort!==!1&&T.sort(j.sort),T.map(z=>{const ue=B[z];return ue===void 0?"":ue===null?d(z,j):Array.isArray(ue)?ue.length===0&&j.arrayFormat==="bracket-separator"?d(z,j)+"[]":ue.reduce(K(z),[]).join("&"):d(z,j)+"="+d(ue,j)}).filter(z=>z.length>0).join("&")},t.parseUrl=(B,j)=>{j=Object.assign({decode:!0},j);const[U,K]=n(B,"#");return Object.assign({url:U.split("?")[0]||"",query:k(N(B),j)},j&&j.parseFragmentIdentifier&&K?{fragmentIdentifier:p(K,j)}:{})},t.stringifyUrl=(B,j)=>{j=Object.assign({encode:!0,strict:!0,[o]:!0},j);const U=A(B.url).split("?")[0]||"",K=t.extract(B.url),J=t.parse(K,{sort:!1}),T=Object.assign(J,B.query);let z=t.stringify(T,j);z&&(z=`?${z}`);let ue=P(B.url);return B.fragmentIdentifier&&(ue=`#${j[o]?d(B.fragmentIdentifier,j):B.fragmentIdentifier}`),`${U}${z}${ue}`},t.pick=(B,j,U)=>{U=Object.assign({parseFragmentIdentifier:!0,[o]:!1},U);const{url:K,query:J,fragmentIdentifier:T}=t.parseUrl(B,U);return t.stringifyUrl({url:K,query:i(J,j),fragmentIdentifier:T},U)},t.exclude=(B,j,U)=>{const K=Array.isArray(j)?J=>!j.includes(J):(J,T)=>!j(J,T);return t.pick(B,K,U)}})(il);var Rx={exports:{}};/** + ***************************************************************************** */var Jg=function(t,e){return Jg=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Jg(t,e)};function oT(t,e){Jg(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Xg=function(){return Xg=Object.assign||function(e){for(var r,n=1,i=arguments.length;n=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function uT(t,e){return function(r,n){e(r,n,t)}}function fT(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function lT(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(d){try{l(n.next(d))}catch(p){o(p)}}function u(d){try{l(n.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):i(d.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function hT(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return u([l,d])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function T2(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function gT(){for(var t=[],e=0;e1||a(y,A)})})}function a(y,A){try{u(n[y](A))}catch(P){p(s[0][3],P)}}function u(y){y.value instanceof Kf?Promise.resolve(y.value.v).then(l,d):p(s[0][2],y)}function l(y){a("next",y)}function d(y){a("throw",y)}function p(y,A){y(A),s.shift(),s.length&&a(s[0][0],s[0][1])}}function bT(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Kf(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function yT(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Zg=="function"?Zg(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function wT(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function xT(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function _T(t){return t&&t.__esModule?t:{default:t}}function ET(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function ST(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const Vf=Jp(Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Xg},__asyncDelegator:bT,__asyncGenerator:vT,__asyncValues:yT,__await:Kf,__awaiter:lT,__classPrivateFieldGet:ET,__classPrivateFieldSet:ST,__createBinding:dT,__decorate:cT,__exportStar:pT,__extends:oT,__generator:hT,__importDefault:_T,__importStar:xT,__makeTemplateObject:wT,__metadata:fT,__param:uT,__read:T2,__rest:aT,__spread:gT,__spreadArrays:mT,__values:Zg},Symbol.toStringTag,{value:"Module"})));var Qg={},Gf={},R2;function AT(){if(R2)return Gf;R2=1,Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Gf.delay=t,Gf}var qa={},em={},za={},D2;function PT(){return D2||(D2=1,Object.defineProperty(za,"__esModule",{value:!0}),za.ONE_THOUSAND=za.ONE_HUNDRED=void 0,za.ONE_HUNDRED=100,za.ONE_THOUSAND=1e3),za}var tm={},O2;function MT(){return O2||(O2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(tm)),tm}var N2;function L2(){return N2||(N2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(PT(),t),e.__exportStar(MT(),t)}(em)),em}var k2;function IT(){if(k2)return qa;k2=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.fromMiliseconds=qa.toMiliseconds=void 0;const t=L2();function e(n){return n*t.ONE_THOUSAND}qa.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return qa.fromMiliseconds=r,qa}var B2;function CT(){return B2||(B2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(AT(),t),e.__exportStar(IT(),t)}(Qg)),Qg}var iu={},$2;function TT(){if($2)return iu;$2=1,Object.defineProperty(iu,"__esModule",{value:!0}),iu.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return iu.Watch=t,iu.default=t,iu}var rm={},Yf={},F2;function RT(){if(F2)return Yf;F2=1,Object.defineProperty(Yf,"__esModule",{value:!0}),Yf.IWatch=void 0;class t{}return Yf.IWatch=t,Yf}var j2;function DT(){return j2||(j2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Vf.__exportStar(RT(),t)}(rm)),rm}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(CT(),t),e.__exportStar(TT(),t),e.__exportStar(DT(),t),e.__exportStar(L2(),t)})(mt);class Ha{}let OT=class extends Ha{constructor(e){super()}};const U2=mt.FIVE_SECONDS,su={pulse:"heartbeat_pulse"};let NT=class GA extends OT{constructor(e){super(e),this.events=new qi.EventEmitter,this.interval=U2,this.interval=(e==null?void 0:e.interval)||U2}static async init(e){const r=new GA(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),mt.toMiliseconds(this.interval))}pulse(){this.events.emit(su.pulse)}};const LT=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,kT=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,BT=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function $T(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){FT(t);return}return e}function FT(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Zh(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!BT.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(LT.test(t)||kT.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,$T)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function jT(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Tn(t,...e){try{return jT(t(...e))}catch(r){return Promise.reject(r)}}function UT(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function qT(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Qh(t){if(UT(t))return String(t);if(qT(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Qh(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function q2(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const nm="base64:";function zT(t){if(typeof t=="string")return t;q2();const e=Buffer.from(t).toString("base64");return nm+e}function HT(t){return typeof t!="string"||!t.startsWith(nm)?t:(q2(),Buffer.from(t.slice(nm.length),"base64"))}function pi(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function WT(...t){return pi(t.join(":"))}function ed(t){return t=pi(t),t?t+":":""}function doe(t){return t}const KT="memory",VT=()=>{const t=new Map;return{name:KT,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function GT(t={}){const e={mounts:{"":t.driver||VT()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const d of e.mountpoints)if(l.startsWith(d))return{base:d,relativeKey:l.slice(d.length),driver:e.mounts[d]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,d)=>e.mountpoints.filter(p=>p.startsWith(l)||d&&l.startsWith(p)).map(p=>({relativeBase:l.length>p.length?l.slice(p.length):void 0,mountpoint:p,driver:e.mounts[p]})),i=(l,d)=>{if(e.watching){d=pi(d);for(const p of e.watchListeners)p(l,d)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await z2(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,d,p)=>{const y=new Map,A=P=>{let N=y.get(P.base);return N||(N={driver:P.driver,base:P.base,items:[]},y.set(P.base,N)),N};for(const P of l){const N=typeof P=="string",D=pi(N?P:P.key),k=N?void 0:P.value,B=N||!P.options?d:{...d,...P.options},q=r(D);A(q).items.push({key:D,value:k,relativeKey:q.relativeKey,options:B})}return Promise.all([...y.values()].map(P=>p(P))).then(P=>P.flat())},u={hasItem(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return Tn(y.hasItem,p,d)},getItem(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return Tn(y.getItem,p,d).then(A=>Zh(A))},getItems(l,d){return a(l,d,p=>p.driver.getItems?Tn(p.driver.getItems,p.items.map(y=>({key:y.relativeKey,options:y.options})),d).then(y=>y.map(A=>({key:WT(p.base,A.key),value:Zh(A.value)}))):Promise.all(p.items.map(y=>Tn(p.driver.getItem,y.relativeKey,y.options).then(A=>({key:y.key,value:Zh(A)})))))},getItemRaw(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return y.getItemRaw?Tn(y.getItemRaw,p,d):Tn(y.getItem,p,d).then(A=>HT(A))},async setItem(l,d,p={}){if(d===void 0)return u.removeItem(l);l=pi(l);const{relativeKey:y,driver:A}=r(l);A.setItem&&(await Tn(A.setItem,y,Qh(d),p),A.watch||i("update",l))},async setItems(l,d){await a(l,d,async p=>{if(p.driver.setItems)return Tn(p.driver.setItems,p.items.map(y=>({key:y.relativeKey,value:Qh(y.value),options:y.options})),d);p.driver.setItem&&await Promise.all(p.items.map(y=>Tn(p.driver.setItem,y.relativeKey,Qh(y.value),y.options)))})},async setItemRaw(l,d,p={}){if(d===void 0)return u.removeItem(l,p);l=pi(l);const{relativeKey:y,driver:A}=r(l);if(A.setItemRaw)await Tn(A.setItemRaw,y,d,p);else if(A.setItem)await Tn(A.setItem,y,zT(d),p);else return;A.watch||i("update",l)},async removeItem(l,d={}){typeof d=="boolean"&&(d={removeMeta:d}),l=pi(l);const{relativeKey:p,driver:y}=r(l);y.removeItem&&(await Tn(y.removeItem,p,d),(d.removeMeta||d.removeMata)&&await Tn(y.removeItem,p+"$",d),y.watch||i("remove",l))},async getMeta(l,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),l=pi(l);const{relativeKey:p,driver:y}=r(l),A=Object.create(null);if(y.getMeta&&Object.assign(A,await Tn(y.getMeta,p,d)),!d.nativeOnly){const P=await Tn(y.getItem,p+"$",d).then(N=>Zh(N));P&&typeof P=="object"&&(typeof P.atime=="string"&&(P.atime=new Date(P.atime)),typeof P.mtime=="string"&&(P.mtime=new Date(P.mtime)),Object.assign(A,P))}return A},setMeta(l,d,p={}){return this.setItem(l+"$",d,p)},removeMeta(l,d={}){return this.removeItem(l+"$",d)},async getKeys(l,d={}){l=ed(l);const p=n(l,!0);let y=[];const A=[];for(const P of p){const N=await Tn(P.driver.getKeys,P.relativeBase,d);for(const D of N){const k=P.mountpoint+pi(D);y.some(B=>k.startsWith(B))||A.push(k)}y=[P.mountpoint,...y.filter(D=>!D.startsWith(P.mountpoint))]}return l?A.filter(P=>P.startsWith(l)&&P[P.length-1]!=="$"):A.filter(P=>P[P.length-1]!=="$")},async clear(l,d={}){l=ed(l),await Promise.all(n(l,!1).map(async p=>{if(p.driver.clear)return Tn(p.driver.clear,p.relativeBase,d);if(p.driver.removeItem){const y=await p.driver.getKeys(p.relativeBase||"",d);return Promise.all(y.map(A=>p.driver.removeItem(A,d)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>H2(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(d=>d!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,d){if(l=ed(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((p,y)=>y.length-p.length)),e.mounts[l]=d,e.watching&&Promise.resolve(z2(d,i,l)).then(p=>{e.unwatch[l]=p}).catch(console.error),u},async unmount(l,d=!0){l=ed(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),d&&await H2(e.mounts[l]),e.mountpoints=e.mountpoints.filter(p=>p!==l),delete e.mounts[l])},getMount(l=""){l=pi(l)+":";const d=r(l);return{driver:d.driver,base:d.base}},getMounts(l="",d={}){return l=pi(l),n(l,d.parents).map(y=>({driver:y.driver,base:y.mountpoint}))},keys:(l,d={})=>u.getKeys(l,d),get:(l,d={})=>u.getItem(l,d),set:(l,d,p={})=>u.setItem(l,d,p),has:(l,d={})=>u.hasItem(l,d),del:(l,d={})=>u.removeItem(l,d),remove:(l,d={})=>u.removeItem(l,d)};return u}function z2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function H2(t){typeof t.dispose=="function"&&await Tn(t.dispose)}function Wa(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function W2(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Wa(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let im;function Jf(){return im||(im=W2("keyval-store","keyval")),im}function K2(t,e=Jf()){return e("readonly",r=>Wa(r.get(t)))}function YT(t,e,r=Jf()){return r("readwrite",n=>(n.put(e,t),Wa(n.transaction)))}function JT(t,e=Jf()){return e("readwrite",r=>(r.delete(t),Wa(r.transaction)))}function XT(t=Jf()){return t("readwrite",e=>(e.clear(),Wa(e.transaction)))}function ZT(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Wa(t.transaction)}function QT(t=Jf()){return t("readonly",e=>{if(e.getAllKeys)return Wa(e.getAllKeys());const r=[];return ZT(e,n=>r.push(n.key)).then(()=>r)})}const eR=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),tR=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Ka(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return tR(t)}catch{return t}}function mo(t){return typeof t=="string"?t:eR(t)||""}const rR="idb-keyval";var nR=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=W2(t.dbName,t.storeName)),{name:rR,options:t,async hasItem(i){return!(typeof await K2(r(i),n)>"u")},async getItem(i){return await K2(r(i),n)??null},setItem(i,s){return YT(r(i),s,n)},removeItem(i){return JT(r(i),n)},getKeys(){return QT(n)},clear(){return XT(n)}}};const iR="WALLET_CONNECT_V2_INDEXED_DB",sR="keyvaluestorage";let oR=class{constructor(){this.indexedDb=GT({driver:nR({dbName:iR,storeName:sR})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,mo(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var sm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},td={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof sm<"u"&&sm.localStorage?td.exports=sm.localStorage:typeof window<"u"&&window.localStorage?td.exports=window.localStorage:td.exports=new e})();function aR(t){var e;return[t[0],Ka((e=t[1])!=null?e:"")]}let cR=class{constructor(){this.localStorage=td.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(aR)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Ka(r)}async setItem(e,r){this.localStorage.setItem(e,mo(r))}async removeItem(e){this.localStorage.removeItem(e)}};const uR="wc_storage_version",V2=1,fR=async(t,e,r)=>{const n=uR,i=await e.getItem(n);if(i&&i>=V2){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,V2),r(e),lR(t,o)},lR=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let hR=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new cR;this.storage=e;try{const r=new oR;fR(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function dR(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var pR=gR;function gR(t,e,r){var n=r&&r.stringify||dR,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?p:0,t.charCodeAt(A+1)){case 100:case 102:if(d>=u||e[d]==null)break;p=u||e[d]==null)break;p=u||e[d]===void 0)break;p",p=A+2,A++;break}l+=n(e[d]),p=A+2,A++;break;case 115:if(d>=u)break;p-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",u=Object.create(r);u.log||(u.log=Zf),Object.defineProperty(u,"levelVal",{get:d}),Object.defineProperty(u,"level",{get:p,set:y});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:_R(t)};u.levels=vo.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Zf,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=A,e&&(u._logEvent=om());function d(){return this.level==="silent"?1/0:this.levels.values[this.level]}function p(){return this._level}function y(P){if(P!=="silent"&&!this.levels.values[P])throw Error("unknown level "+P);this._level=P,au(l,u,"error","log"),au(l,u,"fatal","error"),au(l,u,"warn","error"),au(l,u,"info","log"),au(l,u,"debug","log"),au(l,u,"trace","log")}function A(P,N){if(!P)throw new Error("missing bindings for child Pino");N=N||{},i&&P.serializers&&(N.serializers=P.serializers);const D=N.serializers;if(i&&D){var k=Object.assign({},n,D),B=t.browser.serialize===!0?Object.keys(k):i;delete P.serializers,rd([P],B,k,this._stdErrSerialize)}function q(j){this._childLevel=(j._childLevel|0)+1,this.error=cu(j,P,"error"),this.fatal=cu(j,P,"fatal"),this.warn=cu(j,P,"warn"),this.info=cu(j,P,"info"),this.debug=cu(j,P,"debug"),this.trace=cu(j,P,"trace"),k&&(this.serializers=k,this._serialize=B),e&&(this._logEvent=om([].concat(j._logEvent.bindings,P)))}return q.prototype=this,new q(this)}return u}vo.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},vo.stdSerializers=mR,vo.stdTimeFunctions=Object.assign({},{nullTime:Y2,epochTime:J2,unixTime:ER,isoTime:SR});function au(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Zf:i[r]?i[r]:Xf[r]||Xf[n]||Zf,bR(t,e,r)}function bR(t,e,r){!t.transmit&&e[r]===Zf||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Xf?Xf:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function cu(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},Z2=class{constructor(e,r=cm){this.level=e??"error",this.levelValue=ou.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new X2(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===ou.levels.values.error?console.error(e):r===ou.levels.values.warn?console.warn(e):r===ou.levels.values.debug?console.debug(e):r===ou.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(mo({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new X2(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(mo({extraMetadata:e})),new Blob(r,{type:"application/json"})}},IR=class{constructor(e,r=cm){this.baseChunkLogger=new Z2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},CR=class{constructor(e,r=cm){this.baseChunkLogger=new Z2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var TR=Object.defineProperty,RR=Object.defineProperties,DR=Object.getOwnPropertyDescriptors,Q2=Object.getOwnPropertySymbols,OR=Object.prototype.hasOwnProperty,NR=Object.prototype.propertyIsEnumerable,ex=(t,e,r)=>e in t?TR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,id=(t,e)=>{for(var r in e||(e={}))OR.call(e,r)&&ex(t,r,e[r]);if(Q2)for(var r of Q2(e))NR.call(e,r)&&ex(t,r,e[r]);return t},sd=(t,e)=>RR(t,DR(e));function od(t){return sd(id({},t),{level:(t==null?void 0:t.level)||PR.level})}function LR(t,e=el){return t[e]||""}function kR(t,e,r=el){return t[r]=e,t}function gi(t,e=el){let r="";return typeof t.bindings>"u"?r=LR(t,e):r=t.bindings().context||"",r}function BR(t,e,r=el){const n=gi(t,r);return n.trim()?`${n}/${e}`:e}function ri(t,e,r=el){const n=BR(t,e,r),i=t.child({context:n});return kR(i,n,r)}function $R(t){var e,r;const n=new IR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace",browser:sd(id({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function FR(t){var e;const r=new CR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function jR(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?$R(t):FR(t)}let UR=class extends Ha{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},qR=class extends Ha{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},zR=class{constructor(e,r){this.logger=e,this.core=r}},HR=class extends Ha{constructor(e,r){super(),this.relayer=e,this.logger=r}},WR=class extends Ha{constructor(e){super()}},KR=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},VR=class extends Ha{constructor(e,r){super(),this.relayer=e,this.logger=r}},GR=class extends Ha{constructor(e,r){super(),this.core=e,this.logger=r}},YR=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},JR=class{constructor(e,r){this.projectId=e,this.logger=r}},XR=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},ZR=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},QR=class{constructor(e){this.client=e}};var um={},ta={},ad={},cd={};Object.defineProperty(cd,"__esModule",{value:!0}),cd.BrowserRandomSource=void 0;const tx=65536;class eD{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let n=0;n>>16&65535,d=a&65535,p=u>>>16&65535,y=u&65535;return d*y+(l*y+d*p<<16>>>0)|0}t.mul=Math.imul||e;function r(a,u){return a+u|0}t.add=r;function n(a,u){return a-u|0}t.sub=n;function i(a,u){return a<>>32-u}t.rotl=i;function s(a,u){return a<<32-u|a>>>u}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(nx),Object.defineProperty(or,"__esModule",{value:!0});var ix=nx;function aD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}or.readInt16BE=aD;function cD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}or.readUint16BE=cD;function uD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}or.readInt16LE=uD;function fD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}or.readUint16LE=fD;function sx(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}or.writeUint16BE=sx,or.writeInt16BE=sx;function ox(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}or.writeUint16LE=ox,or.writeInt16LE=ox;function fm(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}or.readInt32BE=fm;function lm(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}or.readUint32BE=lm;function hm(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}or.readInt32LE=hm;function dm(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}or.readUint32LE=dm;function fd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}or.writeUint32BE=fd,or.writeInt32BE=fd;function ld(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}or.writeUint32LE=ld,or.writeInt32LE=ld;function lD(t,e){e===void 0&&(e=0);var r=fm(t,e),n=fm(t,e+4);return r*4294967296+n-(n>>31)*4294967296}or.readInt64BE=lD;function hD(t,e){e===void 0&&(e=0);var r=lm(t,e),n=lm(t,e+4);return r*4294967296+n}or.readUint64BE=hD;function dD(t,e){e===void 0&&(e=0);var r=hm(t,e),n=hm(t,e+4);return n*4294967296+r-(r>>31)*4294967296}or.readInt64LE=dD;function pD(t,e){e===void 0&&(e=0);var r=dm(t,e),n=dm(t,e+4);return n*4294967296+r}or.readUint64LE=pD;function ax(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fd(t/4294967296>>>0,e,r),fd(t>>>0,e,r+4),e}or.writeUint64BE=ax,or.writeInt64BE=ax;function cx(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ld(t>>>0,e,r),ld(t/4294967296>>>0,e,r+4),e}or.writeUint64LE=cx,or.writeInt64LE=cx;function gD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}or.readUintBE=gD;function mD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}or.writeUintBE=vD;function bD(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!ix.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s256)throw new Error("randomString charset is too long");let y="";const A=d.length,P=256-256%A;for(;l>0;){const N=i(Math.ceil(l*256/P),p);for(let D=0;D0;D++){const k=N[D];k0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,A=l%128<112?128:256;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._stateHi.set(u.stateHi),this._stateLo.set(u.stateLo),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.stateHi),r.wipe(u.stateLo),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,u,l,d,p,y,A){for(var P=l[0],N=l[1],D=l[2],k=l[3],B=l[4],q=l[5],j=l[6],H=l[7],J=d[0],T=d[1],z=d[2],ue=d[3],_e=d[4],G=d[5],E=d[6],m=d[7],f,g,v,x,_,S,b,M;A>=128;){for(var I=0;I<16;I++){var F=8*I+y;a[I]=e.readUint32BE(p,F),u[I]=e.readUint32BE(p,F+4)}for(var I=0;I<80;I++){var ae=P,O=N,se=D,ee=k,X=B,Q=q,R=j,Z=H,te=J,le=T,ie=z,fe=ue,ve=_e,Me=G,Ne=E,Te=m;if(f=H,g=m,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=(B>>>14|_e<<18)^(B>>>18|_e<<14)^(_e>>>9|B<<23),g=(_e>>>14|B<<18)^(_e>>>18|B<<14)^(B>>>9|_e<<23),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=B&q^~B&j,g=_e&G^~_e&E,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=i[I*2],g=i[I*2+1],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=a[I%16],g=u[I%16],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,v=b&65535|M<<16,x=_&65535|S<<16,f=v,g=x,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=(P>>>28|J<<4)^(J>>>2|P<<30)^(J>>>7|P<<25),g=(J>>>28|P<<4)^(P>>>2|J<<30)^(P>>>7|J<<25),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=P&N^P&D^N&D,g=J&T^J&z^T&z,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,Z=b&65535|M<<16,Te=_&65535|S<<16,f=ee,g=fe,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=v,g=x,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,ee=b&65535|M<<16,fe=_&65535|S<<16,N=ae,D=O,k=se,B=ee,q=X,j=Q,H=R,P=Z,T=te,z=le,ue=ie,_e=fe,G=ve,E=Me,m=Ne,J=Te,I%16===15)for(var F=0;F<16;F++)f=a[F],g=u[F],_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=a[(F+9)%16],g=u[(F+9)%16],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,v=a[(F+1)%16],x=u[(F+1)%16],f=(v>>>1|x<<31)^(v>>>8|x<<24)^v>>>7,g=(x>>>1|v<<31)^(x>>>8|v<<24)^(x>>>7|v<<25),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,v=a[(F+14)%16],x=u[(F+14)%16],f=(v>>>19|x<<13)^(x>>>29|v<<3)^v>>>6,g=(x>>>19|v<<13)^(v>>>29|x<<3)^(x>>>6|v<<26),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,a[F]=b&65535|M<<16,u[F]=_&65535|S<<16}f=P,g=J,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[0],g=d[0],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[0]=P=b&65535|M<<16,d[0]=J=_&65535|S<<16,f=N,g=T,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[1],g=d[1],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[1]=N=b&65535|M<<16,d[1]=T=_&65535|S<<16,f=D,g=z,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[2],g=d[2],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[2]=D=b&65535|M<<16,d[2]=z=_&65535|S<<16,f=k,g=ue,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[3],g=d[3],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[3]=k=b&65535|M<<16,d[3]=ue=_&65535|S<<16,f=B,g=_e,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[4],g=d[4],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[4]=B=b&65535|M<<16,d[4]=_e=_&65535|S<<16,f=q,g=G,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[5],g=d[5],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[5]=q=b&65535|M<<16,d[5]=G=_&65535|S<<16,f=j,g=E,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[6],g=d[6],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[6]=j=b&65535|M<<16,d[6]=E=_&65535|S<<16,f=H,g=m,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[7],g=d[7],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[7]=H=b&65535|M<<16,d[7]=m=_&65535|S<<16,y+=128,A-=128}return y}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ux),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=ta,r=ux,n=Mi;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(ee){const X=new Float64Array(16);if(ee)for(let Q=0;Q>16&1),Q[le-1]&=65535;Q[15]=R[15]-32767-(Q[14]>>16&1);const te=Q[15]>>16&1;Q[14]&=65535,N(R,Q,1-te)}for(let Z=0;Z<16;Z++)ee[2*Z]=R[Z]&255,ee[2*Z+1]=R[Z]>>8}function k(ee,X){let Q=0;for(let R=0;R<32;R++)Q|=ee[R]^X[R];return(1&Q-1>>>8)-1}function B(ee,X){const Q=new Uint8Array(32),R=new Uint8Array(32);return D(Q,ee),D(R,X),k(Q,R)}function q(ee){const X=new Uint8Array(32);return D(X,ee),X[0]&1}function j(ee,X){for(let Q=0;Q<16;Q++)ee[Q]=X[2*Q]+(X[2*Q+1]<<8);ee[15]&=32767}function H(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]+Q[R]}function J(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]-Q[R]}function T(ee,X,Q){let R,Z,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=0,Ie=0,Le=0,Ve=0,ke=0,ze=0,He=0,Se=0,Qe=0,ct=0,Be=0,et=0,rt=0,Je=0,pt=0,ht=0,ft=0,Ht=0,Jt=0,St=0,er=0,Xt=0,Ot=0,Bt=Q[0],Tt=Q[1],vt=Q[2],Dt=Q[3],Lt=Q[4],bt=Q[5],$t=Q[6],jt=Q[7],nt=Q[8],Ft=Q[9],$=Q[10],W=Q[11],V=Q[12],C=Q[13],Y=Q[14],U=Q[15];R=X[0],te+=R*Bt,le+=R*Tt,ie+=R*vt,fe+=R*Dt,ve+=R*Lt,Me+=R*bt,Ne+=R*$t,Te+=R*jt,$e+=R*nt,Ie+=R*Ft,Le+=R*$,Ve+=R*W,ke+=R*V,ze+=R*C,He+=R*Y,Se+=R*U,R=X[1],le+=R*Bt,ie+=R*Tt,fe+=R*vt,ve+=R*Dt,Me+=R*Lt,Ne+=R*bt,Te+=R*$t,$e+=R*jt,Ie+=R*nt,Le+=R*Ft,Ve+=R*$,ke+=R*W,ze+=R*V,He+=R*C,Se+=R*Y,Qe+=R*U,R=X[2],ie+=R*Bt,fe+=R*Tt,ve+=R*vt,Me+=R*Dt,Ne+=R*Lt,Te+=R*bt,$e+=R*$t,Ie+=R*jt,Le+=R*nt,Ve+=R*Ft,ke+=R*$,ze+=R*W,He+=R*V,Se+=R*C,Qe+=R*Y,ct+=R*U,R=X[3],fe+=R*Bt,ve+=R*Tt,Me+=R*vt,Ne+=R*Dt,Te+=R*Lt,$e+=R*bt,Ie+=R*$t,Le+=R*jt,Ve+=R*nt,ke+=R*Ft,ze+=R*$,He+=R*W,Se+=R*V,Qe+=R*C,ct+=R*Y,Be+=R*U,R=X[4],ve+=R*Bt,Me+=R*Tt,Ne+=R*vt,Te+=R*Dt,$e+=R*Lt,Ie+=R*bt,Le+=R*$t,Ve+=R*jt,ke+=R*nt,ze+=R*Ft,He+=R*$,Se+=R*W,Qe+=R*V,ct+=R*C,Be+=R*Y,et+=R*U,R=X[5],Me+=R*Bt,Ne+=R*Tt,Te+=R*vt,$e+=R*Dt,Ie+=R*Lt,Le+=R*bt,Ve+=R*$t,ke+=R*jt,ze+=R*nt,He+=R*Ft,Se+=R*$,Qe+=R*W,ct+=R*V,Be+=R*C,et+=R*Y,rt+=R*U,R=X[6],Ne+=R*Bt,Te+=R*Tt,$e+=R*vt,Ie+=R*Dt,Le+=R*Lt,Ve+=R*bt,ke+=R*$t,ze+=R*jt,He+=R*nt,Se+=R*Ft,Qe+=R*$,ct+=R*W,Be+=R*V,et+=R*C,rt+=R*Y,Je+=R*U,R=X[7],Te+=R*Bt,$e+=R*Tt,Ie+=R*vt,Le+=R*Dt,Ve+=R*Lt,ke+=R*bt,ze+=R*$t,He+=R*jt,Se+=R*nt,Qe+=R*Ft,ct+=R*$,Be+=R*W,et+=R*V,rt+=R*C,Je+=R*Y,pt+=R*U,R=X[8],$e+=R*Bt,Ie+=R*Tt,Le+=R*vt,Ve+=R*Dt,ke+=R*Lt,ze+=R*bt,He+=R*$t,Se+=R*jt,Qe+=R*nt,ct+=R*Ft,Be+=R*$,et+=R*W,rt+=R*V,Je+=R*C,pt+=R*Y,ht+=R*U,R=X[9],Ie+=R*Bt,Le+=R*Tt,Ve+=R*vt,ke+=R*Dt,ze+=R*Lt,He+=R*bt,Se+=R*$t,Qe+=R*jt,ct+=R*nt,Be+=R*Ft,et+=R*$,rt+=R*W,Je+=R*V,pt+=R*C,ht+=R*Y,ft+=R*U,R=X[10],Le+=R*Bt,Ve+=R*Tt,ke+=R*vt,ze+=R*Dt,He+=R*Lt,Se+=R*bt,Qe+=R*$t,ct+=R*jt,Be+=R*nt,et+=R*Ft,rt+=R*$,Je+=R*W,pt+=R*V,ht+=R*C,ft+=R*Y,Ht+=R*U,R=X[11],Ve+=R*Bt,ke+=R*Tt,ze+=R*vt,He+=R*Dt,Se+=R*Lt,Qe+=R*bt,ct+=R*$t,Be+=R*jt,et+=R*nt,rt+=R*Ft,Je+=R*$,pt+=R*W,ht+=R*V,ft+=R*C,Ht+=R*Y,Jt+=R*U,R=X[12],ke+=R*Bt,ze+=R*Tt,He+=R*vt,Se+=R*Dt,Qe+=R*Lt,ct+=R*bt,Be+=R*$t,et+=R*jt,rt+=R*nt,Je+=R*Ft,pt+=R*$,ht+=R*W,ft+=R*V,Ht+=R*C,Jt+=R*Y,St+=R*U,R=X[13],ze+=R*Bt,He+=R*Tt,Se+=R*vt,Qe+=R*Dt,ct+=R*Lt,Be+=R*bt,et+=R*$t,rt+=R*jt,Je+=R*nt,pt+=R*Ft,ht+=R*$,ft+=R*W,Ht+=R*V,Jt+=R*C,St+=R*Y,er+=R*U,R=X[14],He+=R*Bt,Se+=R*Tt,Qe+=R*vt,ct+=R*Dt,Be+=R*Lt,et+=R*bt,rt+=R*$t,Je+=R*jt,pt+=R*nt,ht+=R*Ft,ft+=R*$,Ht+=R*W,Jt+=R*V,St+=R*C,er+=R*Y,Xt+=R*U,R=X[15],Se+=R*Bt,Qe+=R*Tt,ct+=R*vt,Be+=R*Dt,et+=R*Lt,rt+=R*bt,Je+=R*$t,pt+=R*jt,ht+=R*nt,ft+=R*Ft,Ht+=R*$,Jt+=R*W,St+=R*V,er+=R*C,Xt+=R*Y,Ot+=R*U,te+=38*Qe,le+=38*ct,ie+=38*Be,fe+=38*et,ve+=38*rt,Me+=38*Je,Ne+=38*pt,Te+=38*ht,$e+=38*ft,Ie+=38*Ht,Le+=38*Jt,Ve+=38*St,ke+=38*er,ze+=38*Xt,He+=38*Ot,Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Se+Z+65535,Z=Math.floor(R/65536),Se=R-Z*65536,te+=Z-1+37*(Z-1),Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Se+Z+65535,Z=Math.floor(R/65536),Se=R-Z*65536,te+=Z-1+37*(Z-1),ee[0]=te,ee[1]=le,ee[2]=ie,ee[3]=fe,ee[4]=ve,ee[5]=Me,ee[6]=Ne,ee[7]=Te,ee[8]=$e,ee[9]=Ie,ee[10]=Le,ee[11]=Ve,ee[12]=ke,ee[13]=ze,ee[14]=He,ee[15]=Se}function z(ee,X){T(ee,X,X)}function ue(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=253;R>=0;R--)z(Q,Q),R!==2&&R!==4&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function _e(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=250;R>=0;R--)z(Q,Q),R!==1&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function G(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i(),ve=i(),Me=i();J(Q,ee[1],ee[0]),J(Me,X[1],X[0]),T(Q,Q,Me),H(R,ee[0],ee[1]),H(Me,X[0],X[1]),T(R,R,Me),T(Z,ee[3],X[3]),T(Z,Z,l),T(te,ee[2],X[2]),H(te,te,te),J(le,R,Q),J(ie,te,Z),H(fe,te,Z),H(ve,R,Q),T(ee[0],le,ie),T(ee[1],ve,fe),T(ee[2],fe,ie),T(ee[3],le,ve)}function E(ee,X,Q){for(let R=0;R<4;R++)N(ee[R],X[R],Q)}function m(ee,X){const Q=i(),R=i(),Z=i();ue(Z,X[2]),T(Q,X[0],Z),T(R,X[1],Z),D(ee,R),ee[31]^=q(Q)<<7}function f(ee,X,Q){A(ee[0],o),A(ee[1],a),A(ee[2],a),A(ee[3],o);for(let R=255;R>=0;--R){const Z=Q[R/8|0]>>(R&7)&1;E(ee,X,Z),G(X,ee),G(ee,ee),E(ee,X,Z)}}function g(ee,X){const Q=[i(),i(),i(),i()];A(Q[0],d),A(Q[1],p),A(Q[2],a),T(Q[3],d,p),f(ee,Q,X)}function v(ee){if(ee.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const X=(0,r.hash)(ee);X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(32),R=[i(),i(),i(),i()];g(R,X),m(Q,R);const Z=new Uint8Array(64);return Z.set(ee),Z.set(Q,32),{publicKey:Q,secretKey:Z}}t.generateKeyPairFromSeed=v;function x(ee){const X=(0,e.randomBytes)(32,ee),Q=v(X);return(0,n.wipe)(X),Q}t.generateKeyPair=x;function _(ee){if(ee.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(ee.subarray(32))}t.extractPublicKeyFromSecretKey=_;const S=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function b(ee,X){let Q,R,Z,te;for(R=63;R>=32;--R){for(Q=0,Z=R-32,te=R-12;Z>4)*S[Z],Q=X[Z]>>8,X[Z]&=255;for(Z=0;Z<32;Z++)X[Z]-=Q*S[Z];for(R=0;R<32;R++)X[R+1]+=X[R]>>8,ee[R]=X[R]&255}function M(ee){const X=new Float64Array(64);for(let Q=0;Q<64;Q++)X[Q]=ee[Q];for(let Q=0;Q<64;Q++)ee[Q]=0;b(ee,X)}function I(ee,X){const Q=new Float64Array(64),R=[i(),i(),i(),i()],Z=(0,r.hash)(ee.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(64);te.set(Z.subarray(32),32);const le=new r.SHA512;le.update(te.subarray(32)),le.update(X);const ie=le.digest();le.clean(),M(ie),g(R,ie),m(te,R),le.reset(),le.update(te.subarray(0,32)),le.update(ee.subarray(32)),le.update(X);const fe=le.digest();M(fe);for(let ve=0;ve<32;ve++)Q[ve]=ie[ve];for(let ve=0;ve<32;ve++)for(let Me=0;Me<32;Me++)Q[ve+Me]+=fe[ve]*Z[Me];return b(te.subarray(32),Q),te}t.sign=I;function F(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i();return A(ee[2],a),j(ee[1],X),z(Z,ee[1]),T(te,Z,u),J(Z,Z,ee[2]),H(te,ee[2],te),z(le,te),z(ie,le),T(fe,ie,le),T(Q,fe,Z),T(Q,Q,te),_e(Q,Q),T(Q,Q,Z),T(Q,Q,te),T(Q,Q,te),T(ee[0],Q,te),z(R,ee[0]),T(R,R,te),B(R,Z)&&T(ee[0],ee[0],y),z(R,ee[0]),T(R,R,te),B(R,Z)?-1:(q(ee[0])===X[31]>>7&&J(ee[0],o,ee[0]),T(ee[3],ee[0],ee[1]),0)}function ae(ee,X,Q){const R=new Uint8Array(32),Z=[i(),i(),i(),i()],te=[i(),i(),i(),i()];if(Q.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(F(te,ee))return!1;const le=new r.SHA512;le.update(Q.subarray(0,32)),le.update(ee),le.update(X);const ie=le.digest();return M(ie),f(Z,te,ie),g(te,Q.subarray(32)),G(Z,te),m(R,Z),!k(Q,R)}t.verify=ae;function O(ee){let X=[i(),i(),i(),i()];if(F(X,ee))throw new Error("Ed25519: invalid public key");let Q=i(),R=i(),Z=X[1];H(Q,a,Z),J(R,a,Z),ue(R,R),T(Q,Q,R);let te=new Uint8Array(32);return D(te,Q),te}t.convertPublicKeyToX25519=O;function se(ee){const X=(0,r.hash)(ee.subarray(0,32));X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(X.subarray(0,32));return(0,n.wipe)(X),Q}t.convertSecretKeyToX25519=se}(um);const MD="EdDSA",ID="JWT",hd=".",dd="base64url",fx="utf8",lx="utf8",CD=":",TD="did",RD="key",hx="base58btc",DD="z",OD="K36",ND=32;function dx(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function pd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=dx(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function LD(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,j=new Uint8Array(q);k!==B;){for(var H=P[k],J=0,T=q-1;(H!==0||J>>0,j[T]=H%a>>>0,H=H/a>>>0;if(H!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=q-D;z!==q&&j[z]===0;)z++;for(var ue=u.repeat(N);z>>0,q=new Uint8Array(B);P[N];){var j=r[P.charCodeAt(N)];if(j===255)return;for(var H=0,J=B-1;(j!==0||H>>0,q[J]=j%256>>>0,j=j/256>>>0;if(j!==0)throw new Error("Non-zero carry");k=H,N++}if(P[N]!==" "){for(var T=B-k;T!==B&&q[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=q[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:A}}var kD=LD,BD=kD;const $D=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},FD=t=>new TextEncoder().encode(t),jD=t=>new TextDecoder().decode(t);class UD{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class qD{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return px(this,e)}}class zD{constructor(e){this.decoders=e}or(e){return px(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const px=(t,e)=>new zD({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class HD{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new UD(e,r,n),this.decoder=new qD(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const gd=({name:t,prefix:e,encode:r,decode:n})=>new HD(t,e,r,n),rl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=BD(r,e);return gd({prefix:t,name:e,encode:n,decode:s=>$D(i(s))})},WD=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},KD=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<gd({prefix:e,name:t,encode(i){return KD(i,n,r)},decode(i){return WD(i,n,r,t)}}),VD=gd({prefix:"\0",name:"identity",encode:t=>jD(t),decode:t=>FD(t)}),GD=Object.freeze(Object.defineProperty({__proto__:null,identity:VD},Symbol.toStringTag,{value:"Module"})),YD=jn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),JD=Object.freeze(Object.defineProperty({__proto__:null,base2:YD},Symbol.toStringTag,{value:"Module"})),XD=jn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),ZD=Object.freeze(Object.defineProperty({__proto__:null,base8:XD},Symbol.toStringTag,{value:"Module"})),QD=rl({prefix:"9",name:"base10",alphabet:"0123456789"}),eO=Object.freeze(Object.defineProperty({__proto__:null,base10:QD},Symbol.toStringTag,{value:"Module"})),tO=jn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),rO=jn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),nO=Object.freeze(Object.defineProperty({__proto__:null,base16:tO,base16upper:rO},Symbol.toStringTag,{value:"Module"})),iO=jn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),sO=jn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),oO=jn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),aO=jn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),cO=jn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),uO=jn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),fO=jn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),lO=jn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),hO=jn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),dO=Object.freeze(Object.defineProperty({__proto__:null,base32:iO,base32hex:cO,base32hexpad:fO,base32hexpadupper:lO,base32hexupper:uO,base32pad:oO,base32padupper:aO,base32upper:sO,base32z:hO},Symbol.toStringTag,{value:"Module"})),pO=rl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),gO=rl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),mO=Object.freeze(Object.defineProperty({__proto__:null,base36:pO,base36upper:gO},Symbol.toStringTag,{value:"Module"})),vO=rl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),bO=rl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),yO=Object.freeze(Object.defineProperty({__proto__:null,base58btc:vO,base58flickr:bO},Symbol.toStringTag,{value:"Module"})),wO=jn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),xO=jn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),_O=jn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),EO=jn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),SO=Object.freeze(Object.defineProperty({__proto__:null,base64:wO,base64pad:xO,base64url:_O,base64urlpad:EO},Symbol.toStringTag,{value:"Module"})),gx=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),AO=gx.reduce((t,e,r)=>(t[r]=e,t),[]),PO=gx.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function MO(t){return t.reduce((e,r)=>(e+=AO[r],e),"")}function IO(t){const e=[];for(const r of t){const n=PO[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const CO=gd({prefix:"🚀",name:"base256emoji",encode:MO,decode:IO}),TO=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:CO},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const mx={...GD,...JD,...ZD,...eO,...nO,...dO,...mO,...yO,...SO,...TO};function vx(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const bx=vx("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),pm=vx("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=dx(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new jO:typeof navigator<"u"?KO(navigator.userAgent):GO()}function WO(t){return t!==""&&zO.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function KO(t){var e=WO(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new FO;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length-1){const D=P.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let k=e.protocol+"//"+e.host;if(D.indexOf("/")===0)k+=D;else{const B=e.pathname.split("/");B.pop();const q=B.join("/");k+=q+"/"+D}y.push(k)}else if(D.indexOf("//")===0){const k=e.protocol+D;y.push(k)}else y.push(D)}}return y}function n(...p){const y=t.getElementsByTagName("meta");for(let A=0;AP.getAttribute(D)).filter(D=>D?p.includes(D):!1);if(N.length&&N){const D=P.getAttribute("content");if(D)return D}}return""}function i(){let p=n("name","og:site_name","og:title","twitter:title");return p||(p=t.title),p}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}Mx=vm.getWindowMetadata=oN;var il={},aN=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Cx="%[a-f0-9]{2}",Tx=new RegExp("("+Cx+")|([^%]+?)","gi"),Rx=new RegExp("("+Cx+")+","gi");function bm(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],bm(r),bm(n))}function cN(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(Tx)||[],r=1;r{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},hN=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;sB==null,o=Symbol("encodeFragmentIdentifier");function a(B){switch(B.arrayFormat){case"index":return q=>(j,H)=>{const J=j.length;return H===void 0||B.skipNull&&H===null||B.skipEmptyString&&H===""?j:H===null?[...j,[d(q,B),"[",J,"]"].join("")]:[...j,[d(q,B),"[",d(J,B),"]=",d(H,B)].join("")]};case"bracket":return q=>(j,H)=>H===void 0||B.skipNull&&H===null||B.skipEmptyString&&H===""?j:H===null?[...j,[d(q,B),"[]"].join("")]:[...j,[d(q,B),"[]=",d(H,B)].join("")];case"colon-list-separator":return q=>(j,H)=>H===void 0||B.skipNull&&H===null||B.skipEmptyString&&H===""?j:H===null?[...j,[d(q,B),":list="].join("")]:[...j,[d(q,B),":list=",d(H,B)].join("")];case"comma":case"separator":case"bracket-separator":{const q=B.arrayFormat==="bracket-separator"?"[]=":"=";return j=>(H,J)=>J===void 0||B.skipNull&&J===null||B.skipEmptyString&&J===""?H:(J=J===null?"":J,H.length===0?[[d(j,B),q,d(J,B)].join("")]:[[H,d(J,B)].join(B.arrayFormatSeparator)])}default:return q=>(j,H)=>H===void 0||B.skipNull&&H===null||B.skipEmptyString&&H===""?j:H===null?[...j,d(q,B)]:[...j,[d(q,B),"=",d(H,B)].join("")]}}function u(B){let q;switch(B.arrayFormat){case"index":return(j,H,J)=>{if(q=/\[(\d*)\]$/.exec(j),j=j.replace(/\[\d*\]$/,""),!q){J[j]=H;return}J[j]===void 0&&(J[j]={}),J[j][q[1]]=H};case"bracket":return(j,H,J)=>{if(q=/(\[\])$/.exec(j),j=j.replace(/\[\]$/,""),!q){J[j]=H;return}if(J[j]===void 0){J[j]=[H];return}J[j]=[].concat(J[j],H)};case"colon-list-separator":return(j,H,J)=>{if(q=/(:list)$/.exec(j),j=j.replace(/:list$/,""),!q){J[j]=H;return}if(J[j]===void 0){J[j]=[H];return}J[j]=[].concat(J[j],H)};case"comma":case"separator":return(j,H,J)=>{const T=typeof H=="string"&&H.includes(B.arrayFormatSeparator),z=typeof H=="string"&&!T&&p(H,B).includes(B.arrayFormatSeparator);H=z?p(H,B):H;const ue=T||z?H.split(B.arrayFormatSeparator).map(_e=>p(_e,B)):H===null?H:p(H,B);J[j]=ue};case"bracket-separator":return(j,H,J)=>{const T=/(\[\])$/.test(j);if(j=j.replace(/\[\]$/,""),!T){J[j]=H&&p(H,B);return}const z=H===null?[]:H.split(B.arrayFormatSeparator).map(ue=>p(ue,B));if(J[j]===void 0){J[j]=z;return}J[j]=[].concat(J[j],z)};default:return(j,H,J)=>{if(J[j]===void 0){J[j]=H;return}J[j]=[].concat(J[j],H)}}}function l(B){if(typeof B!="string"||B.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function d(B,q){return q.encode?q.strict?e(B):encodeURIComponent(B):B}function p(B,q){return q.decode?r(B):B}function y(B){return Array.isArray(B)?B.sort():typeof B=="object"?y(Object.keys(B)).sort((q,j)=>Number(q)-Number(j)).map(q=>B[q]):B}function A(B){const q=B.indexOf("#");return q!==-1&&(B=B.slice(0,q)),B}function P(B){let q="";const j=B.indexOf("#");return j!==-1&&(q=B.slice(j)),q}function N(B){B=A(B);const q=B.indexOf("?");return q===-1?"":B.slice(q+1)}function D(B,q){return q.parseNumbers&&!Number.isNaN(Number(B))&&typeof B=="string"&&B.trim()!==""?B=Number(B):q.parseBooleans&&B!==null&&(B.toLowerCase()==="true"||B.toLowerCase()==="false")&&(B=B.toLowerCase()==="true"),B}function k(B,q){q=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},q),l(q.arrayFormatSeparator);const j=u(q),H=Object.create(null);if(typeof B!="string"||(B=B.trim().replace(/^[?#&]/,""),!B))return H;for(const J of B.split("&")){if(J==="")continue;let[T,z]=n(q.decode?J.replace(/\+/g," "):J,"=");z=z===void 0?null:["comma","separator","bracket-separator"].includes(q.arrayFormat)?z:p(z,q),j(p(T,q),z,H)}for(const J of Object.keys(H)){const T=H[J];if(typeof T=="object"&&T!==null)for(const z of Object.keys(T))T[z]=D(T[z],q);else H[J]=D(T,q)}return q.sort===!1?H:(q.sort===!0?Object.keys(H).sort():Object.keys(H).sort(q.sort)).reduce((J,T)=>{const z=H[T];return z&&typeof z=="object"&&!Array.isArray(z)?J[T]=y(z):J[T]=z,J},Object.create(null))}t.extract=N,t.parse=k,t.stringify=(B,q)=>{if(!B)return"";q=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},q),l(q.arrayFormatSeparator);const j=z=>q.skipNull&&s(B[z])||q.skipEmptyString&&B[z]==="",H=a(q),J={};for(const z of Object.keys(B))j(z)||(J[z]=B[z]);const T=Object.keys(J);return q.sort!==!1&&T.sort(q.sort),T.map(z=>{const ue=B[z];return ue===void 0?"":ue===null?d(z,q):Array.isArray(ue)?ue.length===0&&q.arrayFormat==="bracket-separator"?d(z,q)+"[]":ue.reduce(H(z),[]).join("&"):d(z,q)+"="+d(ue,q)}).filter(z=>z.length>0).join("&")},t.parseUrl=(B,q)=>{q=Object.assign({decode:!0},q);const[j,H]=n(B,"#");return Object.assign({url:j.split("?")[0]||"",query:k(N(B),q)},q&&q.parseFragmentIdentifier&&H?{fragmentIdentifier:p(H,q)}:{})},t.stringifyUrl=(B,q)=>{q=Object.assign({encode:!0,strict:!0,[o]:!0},q);const j=A(B.url).split("?")[0]||"",H=t.extract(B.url),J=t.parse(H,{sort:!1}),T=Object.assign(J,B.query);let z=t.stringify(T,q);z&&(z=`?${z}`);let ue=P(B.url);return B.fragmentIdentifier&&(ue=`#${q[o]?d(B.fragmentIdentifier,q):B.fragmentIdentifier}`),`${j}${z}${ue}`},t.pick=(B,q,j)=>{j=Object.assign({parseFragmentIdentifier:!0,[o]:!1},j);const{url:H,query:J,fragmentIdentifier:T}=t.parseUrl(B,j);return t.stringifyUrl({url:H,query:i(J,q),fragmentIdentifier:T},j)},t.exclude=(B,q,j)=>{const H=Array.isArray(q)?J=>!q.includes(J):(J,T)=>!q(J,T);return t.pick(B,H,j)}})(il);var Dx={exports:{}};/** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.8.0 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT - */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=nn:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],p=[4,1024,262144,67108864],y=[1,256,65536,16777216],A=[6,1536,393216,100663296],P=[0,8,16,24],N=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],D=[224,256,384,512],k=[128,256],B=["hex","buffer","arrayBuffer","array","digest"],j={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(O){return Object.prototype.toString.call(O)==="[object Array]"}),u&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(O){return typeof O=="object"&&O.buffer&&O.buffer.constructor===ArrayBuffer});for(var U=function(O,se,ee){return function(X){return new I(O,se,O).update(X)[ee]()}},K=function(O,se,ee){return function(X,Q){return new I(O,se,Q).update(X)[ee]()}},J=function(O,se,ee){return function(X,Q,R,Z){return f["cshake"+O].update(X,Q,R,Z)[ee]()}},T=function(O,se,ee){return function(X,Q,R,Z){return f["kmac"+O].update(X,Q,R,Z)[ee]()}},z=function(O,se,ee,X){for(var Q=0;Q>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ee>>5,this.extraBytes=(ee&31)>>3;for(var X=0;X<50;++X)this.s[X]=0}I.prototype.update=function(O){if(this.finalized)throw new Error(r);var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}for(var X=this.blocks,Q=this.byteCount,R=O.length,Z=this.blockCount,te=0,le=this.s,ie,fe;te>2]|=O[te]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(X[ie>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=Q){for(this.start=ie-Q,this.block=X[Z],ie=0;ie>8,ee=O&255;ee>0;)Q.unshift(ee),O=O>>8,ee=O&255,++X;return se?Q.push(X):Q.unshift(X),this.update(Q),Q.length},I.prototype.encodeString=function(O){var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}var X=0,Q=O.length;if(se)X=Q;else for(var R=0;R=57344?X+=3:(Z=65536+((Z&1023)<<10|O.charCodeAt(++R)&1023),X+=4)}return X+=this.encode(X*8),this.update(O),X},I.prototype.bytepad=function(O,se){for(var ee=this.encode(se),X=0;X>2]|=this.padding[se&3],this.lastByteIndex===this.byteCount)for(O[0]=O[ee],se=1;se>4&15]+l[te&15]+l[te>>12&15]+l[te>>8&15]+l[te>>20&15]+l[te>>16&15]+l[te>>28&15]+l[te>>24&15];R%O===0&&(ae(se),Q=0)}return X&&(te=se[Q],Z+=l[te>>4&15]+l[te&15],X>1&&(Z+=l[te>>12&15]+l[te>>8&15]),X>2&&(Z+=l[te>>20&15]+l[te>>16&15])),Z},I.prototype.arrayBuffer=function(){this.finalize();var O=this.blockCount,se=this.s,ee=this.outputBlocks,X=this.extraBytes,Q=0,R=0,Z=this.outputBits>>3,te;X?te=new ArrayBuffer(ee+1<<2):te=new ArrayBuffer(Z);for(var le=new Uint32Array(te);R>8&255,Z[te+2]=le>>16&255,Z[te+3]=le>>24&255;R%O===0&&ae(se)}return X&&(te=R<<2,le=se[Q],Z[te]=le&255,X>1&&(Z[te+1]=le>>8&255),X>2&&(Z[te+2]=le>>16&255)),Z};function F(O,se,ee){I.call(this,O,se,ee)}F.prototype=new I,F.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var ae=function(O){var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me,Ne,Te,$e,Ie,Le,Ve,ke,ze,He,Ee,Qe,ct,Be,et,rt,Je,pt,ht,ft,Ht,Jt,St,er,Xt,Ot,Bt,Tt,vt,Dt,Lt,bt,$t,jt,nt,Ft,$,H,V,C,Y,q,oe,pe,xe,Re,De,it,Ue,gt,st,tt;for(X=0;X<48;X+=2)Q=O[0]^O[10]^O[20]^O[30]^O[40],R=O[1]^O[11]^O[21]^O[31]^O[41],Z=O[2]^O[12]^O[22]^O[32]^O[42],te=O[3]^O[13]^O[23]^O[33]^O[43],le=O[4]^O[14]^O[24]^O[34]^O[44],ie=O[5]^O[15]^O[25]^O[35]^O[45],fe=O[6]^O[16]^O[26]^O[36]^O[46],ve=O[7]^O[17]^O[27]^O[37]^O[47],Me=O[8]^O[18]^O[28]^O[38]^O[48],Ne=O[9]^O[19]^O[29]^O[39]^O[49],se=Me^(Z<<1|te>>>31),ee=Ne^(te<<1|Z>>>31),O[0]^=se,O[1]^=ee,O[10]^=se,O[11]^=ee,O[20]^=se,O[21]^=ee,O[30]^=se,O[31]^=ee,O[40]^=se,O[41]^=ee,se=Q^(le<<1|ie>>>31),ee=R^(ie<<1|le>>>31),O[2]^=se,O[3]^=ee,O[12]^=se,O[13]^=ee,O[22]^=se,O[23]^=ee,O[32]^=se,O[33]^=ee,O[42]^=se,O[43]^=ee,se=Z^(fe<<1|ve>>>31),ee=te^(ve<<1|fe>>>31),O[4]^=se,O[5]^=ee,O[14]^=se,O[15]^=ee,O[24]^=se,O[25]^=ee,O[34]^=se,O[35]^=ee,O[44]^=se,O[45]^=ee,se=le^(Me<<1|Ne>>>31),ee=ie^(Ne<<1|Me>>>31),O[6]^=se,O[7]^=ee,O[16]^=se,O[17]^=ee,O[26]^=se,O[27]^=ee,O[36]^=se,O[37]^=ee,O[46]^=se,O[47]^=ee,se=fe^(Q<<1|R>>>31),ee=ve^(R<<1|Q>>>31),O[8]^=se,O[9]^=ee,O[18]^=se,O[19]^=ee,O[28]^=se,O[29]^=ee,O[38]^=se,O[39]^=ee,O[48]^=se,O[49]^=ee,Te=O[0],$e=O[1],nt=O[11]<<4|O[10]>>>28,Ft=O[10]<<4|O[11]>>>28,Je=O[20]<<3|O[21]>>>29,pt=O[21]<<3|O[20]>>>29,Ue=O[31]<<9|O[30]>>>23,gt=O[30]<<9|O[31]>>>23,Lt=O[40]<<18|O[41]>>>14,bt=O[41]<<18|O[40]>>>14,St=O[2]<<1|O[3]>>>31,er=O[3]<<1|O[2]>>>31,Ie=O[13]<<12|O[12]>>>20,Le=O[12]<<12|O[13]>>>20,$=O[22]<<10|O[23]>>>22,H=O[23]<<10|O[22]>>>22,ht=O[33]<<13|O[32]>>>19,ft=O[32]<<13|O[33]>>>19,st=O[42]<<2|O[43]>>>30,tt=O[43]<<2|O[42]>>>30,oe=O[5]<<30|O[4]>>>2,pe=O[4]<<30|O[5]>>>2,Xt=O[14]<<6|O[15]>>>26,Ot=O[15]<<6|O[14]>>>26,Ve=O[25]<<11|O[24]>>>21,ke=O[24]<<11|O[25]>>>21,V=O[34]<<15|O[35]>>>17,C=O[35]<<15|O[34]>>>17,Ht=O[45]<<29|O[44]>>>3,Jt=O[44]<<29|O[45]>>>3,ct=O[6]<<28|O[7]>>>4,Be=O[7]<<28|O[6]>>>4,xe=O[17]<<23|O[16]>>>9,Re=O[16]<<23|O[17]>>>9,Bt=O[26]<<25|O[27]>>>7,Tt=O[27]<<25|O[26]>>>7,ze=O[36]<<21|O[37]>>>11,He=O[37]<<21|O[36]>>>11,Y=O[47]<<24|O[46]>>>8,q=O[46]<<24|O[47]>>>8,$t=O[8]<<27|O[9]>>>5,jt=O[9]<<27|O[8]>>>5,et=O[18]<<20|O[19]>>>12,rt=O[19]<<20|O[18]>>>12,De=O[29]<<7|O[28]>>>25,it=O[28]<<7|O[29]>>>25,vt=O[38]<<8|O[39]>>>24,Dt=O[39]<<8|O[38]>>>24,Ee=O[48]<<14|O[49]>>>18,Qe=O[49]<<14|O[48]>>>18,O[0]=Te^~Ie&Ve,O[1]=$e^~Le&ke,O[10]=ct^~et&Je,O[11]=Be^~rt&pt,O[20]=St^~Xt&Bt,O[21]=er^~Ot&Tt,O[30]=$t^~nt&$,O[31]=jt^~Ft&H,O[40]=oe^~xe&De,O[41]=pe^~Re&it,O[2]=Ie^~Ve&ze,O[3]=Le^~ke&He,O[12]=et^~Je&ht,O[13]=rt^~pt&ft,O[22]=Xt^~Bt&vt,O[23]=Ot^~Tt&Dt,O[32]=nt^~$&V,O[33]=Ft^~H&C,O[42]=xe^~De&Ue,O[43]=Re^~it>,O[4]=Ve^~ze&Ee,O[5]=ke^~He&Qe,O[14]=Je^~ht&Ht,O[15]=pt^~ft&Jt,O[24]=Bt^~vt&Lt,O[25]=Tt^~Dt&bt,O[34]=$^~V&Y,O[35]=H^~C&q,O[44]=De^~Ue&st,O[45]=it^~gt&tt,O[6]=ze^~Ee&Te,O[7]=He^~Qe&$e,O[16]=ht^~Ht&ct,O[17]=ft^~Jt&Be,O[26]=vt^~Lt&St,O[27]=Dt^~bt&er,O[36]=V^~Y&$t,O[37]=C^~q&jt,O[46]=Ue^~st&oe,O[47]=gt^~tt&pe,O[8]=Ee^~Te&Ie,O[9]=Qe^~$e&Le,O[18]=Ht^~ct&et,O[19]=Jt^~Be&rt,O[28]=Lt^~St&Xt,O[29]=bt^~er&Ot,O[38]=Y^~$t&nt,O[39]=q^~jt&Ft,O[48]=st^~oe&xe,O[49]=tt^~pe&Re,O[0]^=N[X],O[1]^=N[X+1]};if(a)t.exports=f;else for(v=0;v{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const Lx=mN();var wm;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(wm||(wm={}));var ps;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(ps||(ps={}));const kx="0123456789abcdef";class Kr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();vd[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Nx>vd[n])&&console.log.apply(console,r)}debug(...e){this._log(Kr.levels.DEBUG,e)}info(...e){this._log(Kr.levels.INFO,e)}warn(...e){this._log(Kr.levels.WARNING,e)}makeError(e,r,n){if(Ox)return this.makeError("censored error",r,{});r||(r=Kr.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(u=>{const l=n[u];try{if(l instanceof Uint8Array){let d="";for(let p=0;p>4],d+=kx[l[p]&15];i.push(u+"=Uint8Array(0x"+d+")")}else i.push(u+"="+JSON.stringify(l))}catch{i.push(u+"="+JSON.stringify(n[u].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case ps.NUMERIC_FAULT:{o="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case ps.CALL_EXCEPTION:case ps.INSUFFICIENT_FUNDS:case ps.MISSING_NEW:case ps.NONCE_EXPIRED:case ps.REPLACEMENT_UNDERPRICED:case ps.TRANSACTION_REPLACED:case ps.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(u){a[u]=n[u]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Kr.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){Lx&&this.throwError("platform missing String.prototype.normalize",Kr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Lx})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Kr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Kr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return ym||(ym=new Kr(gN)),ym}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Dx){if(!e)return;this.globalLogger().throwError("error censorship permanent",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Ox=!!e,Dx=!!r}static setLogLevel(e){const r=vd[e.toLowerCase()];if(r==null){Kr.globalLogger().warn("invalid log level - "+e);return}Nx=r}static from(e){return new Kr(e)}}Kr.errors=ps,Kr.levels=wm;const vN="bytes/5.7.0",on=new Kr(vN);function Bx(t){return!!t.toHexString}function uu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return uu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function bN(t){return Ns(t)&&!(t.length%2)||xm(t)}function $x(t){return typeof t=="number"&&t==t&&t%1===0}function xm(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!$x(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function bn(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),uu(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),Bx(t)&&(t=t.toHexString()),Ns(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":on.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ibn(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),uu(n)}function wN(t,e){t=bn(t),t.length>e&&on.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),uu(r)}function Ns(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const _m="0123456789abcdef";function Ii(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=_m[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),Bx(t))return t.toHexString();if(Ns(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":on.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(xm(t)){let r="0x";for(let n=0;n>4]+_m[i&15]}return r}return on.throwArgumentError("invalid hexlify value","value",t)}function xN(t){if(typeof t!="string")t=Ii(t);else if(!Ns(t)||t.length%2)return null;return(t.length-2)/2}function Fx(t,e,r){return typeof t!="string"?t=Ii(t):(!Ns(t)||t.length%2)&&on.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function fu(t,e){for(typeof t!="string"?t=Ii(t):Ns(t)||on.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&on.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function jx(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(bN(t)){let r=bn(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64))):r.length===65?(e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64)),e.v=r[64]):on.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:on.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Ii(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=wN(bn(e._vs),32);e._vs=Ii(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&on.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=Ii(i);e.s==null?e.s=o:e.s!==o&&on.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?on.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&on.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Ns(e.r)?on.throwArgumentError("signature missing or invalid r","signature",t):e.r=fu(e.r,32),e.s==null||!Ns(e.s)?on.throwArgumentError("signature missing or invalid s","signature",t):e.s=fu(e.s,32);const r=bn(e.s);r[0]>=128&&on.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=Ii(r);e._vs&&(Ns(e._vs)||on.throwArgumentError("signature invalid _vs","signature",t),e._vs=fu(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&on.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Em(t){return"0x"+pN.keccak_256(bn(t))}var Sm={exports:{}};Sm.exports,function(t){(function(e,r){function n(m,f){if(!m)throw new Error(f||"Assertion failed")}function i(m,f){m.super_=f;var g=function(){};g.prototype=f.prototype,m.prototype=new g,m.prototype.constructor=m}function s(m,f,g){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((f==="le"||f==="be")&&(g=f,f=10),this._init(m||0,f||10,g||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,g){return f.cmp(g)>0?f:g},s.min=function(f,g){return f.cmp(g)<0?f:g},s.prototype._init=function(f,g,v){if(typeof f=="number")return this._initNumber(f,g,v);if(typeof f=="object")return this._initArray(f,g,v);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),f=f.toString().replace(/\s+/g,"");var x=0;f[0]==="-"&&(x++,this.negative=1),x=0;x-=3)S=f[x]|f[x-1]<<8|f[x-2]<<16,this.words[_]|=S<>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);else if(v==="le")for(x=0,_=0;x>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);return this._strip()};function a(m,f){var g=m.charCodeAt(f);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+m)}function u(m,f,g){var v=a(m,g);return g-1>=f&&(v|=a(m,g-1)<<4),v}s.prototype._parseHex=function(f,g,v){this.length=Math.ceil((f.length-g)/6),this.words=new Array(this.length);for(var x=0;x=g;x-=2)b=u(f,g,x)<<_,this.words[S]|=b&67108863,_>=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8;else{var M=f.length-g;for(x=M%2===0?g+1:g;x=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8}this._strip()};function l(m,f,g,v){for(var x=0,_=0,S=Math.min(m.length,g),b=f;b=49?_=M-49+10:M>=17?_=M-17+10:_=M,n(M>=0&&_1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{s.prototype.inspect=p}else s.prototype.inspect=p;function p(){return(this.red?""}var y=["","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"],A=[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,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(f,g){f=f||10,g=g|0||1;var v;if(f===16||f==="hex"){v="";for(var x=0,_=0,S=0;S>>24-x&16777215,x+=2,x>=26&&(x-=26,S--),_!==0||S!==this.length-1?v=y[6-M.length]+M+v:v=M+v}for(_!==0&&(v=_.toString(16)+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(f===(f|0)&&f>=2&&f<=36){var I=A[f],F=P[f];v="";var ae=this.clone();for(ae.negative=0;!ae.isZero();){var O=ae.modrn(F).toString(f);ae=ae.idivn(F),ae.isZero()?v=O+v:v=y[I-O.length]+O+v}for(this.isZero()&&(v="0"+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,g){return this.toArrayLike(o,f,g)}),s.prototype.toArray=function(f,g){return this.toArrayLike(Array,f,g)};var N=function(f,g){return f.allocUnsafe?f.allocUnsafe(g):new f(g)};s.prototype.toArrayLike=function(f,g,v){this._strip();var x=this.byteLength(),_=v||Math.max(1,x);n(x<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var S=N(f,_),b=g==="le"?"LE":"BE";return this["_toArrayLike"+b](S,x),S},s.prototype._toArrayLikeLE=function(f,g){for(var v=0,x=0,_=0,S=0;_>8&255),v>16&255),S===6?(v>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v=0&&(f[v--]=b>>8&255),v>=0&&(f[v--]=b>>16&255),S===6?(v>=0&&(f[v--]=b>>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v>=0)for(f[v--]=x;v>=0;)f[v--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var g=f,v=0;return g>=4096&&(v+=13,g>>>=13),g>=64&&(v+=7,g>>>=7),g>=8&&(v+=4,g>>>=4),g>=2&&(v+=2,g>>>=2),v+g},s.prototype._zeroBits=function(f){if(f===0)return 26;var g=f,v=0;return g&8191||(v+=13,g>>>=13),g&127||(v+=7,g>>>=7),g&15||(v+=4,g>>>=4),g&3||(v+=2,g>>>=2),g&1||v++,v},s.prototype.bitLength=function(){var f=this.words[this.length-1],g=this._countBits(f);return(this.length-1)*26+g};function D(m){for(var f=new Array(m.bitLength()),g=0;g>>x&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,g=0;gf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var g;this.length>f.length?g=f:g=this;for(var v=0;vf.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var g,v;this.length>f.length?(g=this,v=f):(g=f,v=this);for(var x=0;xf.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var g=Math.ceil(f/26)|0,v=f%26;this._expand(g),v>0&&g--;for(var x=0;x0&&(this.words[x]=~this.words[x]&67108863>>26-v),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,g){n(typeof f=="number"&&f>=0);var v=f/26|0,x=f%26;return this._expand(v+1),g?this.words[v]=this.words[v]|1<f.length?(v=this,x=f):(v=f,x=this);for(var _=0,S=0;S>>26;for(;_!==0&&S>>26;if(this.length=v.length,_!==0)this.words[this.length]=_,this.length++;else if(v!==this)for(;Sf.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var g=this.iadd(f);return f.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var v=this.cmp(f);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,_;v>0?(x=this,_=f):(x=f,_=this);for(var S=0,b=0;b<_.length;b++)g=(x.words[b]|0)-(_.words[b]|0)+S,S=g>>26,this.words[b]=g&67108863;for(;S!==0&&b>26,this.words[b]=g&67108863;if(S===0&&b>>26,ae=M&67108863,O=Math.min(I,f.length-1),se=Math.max(0,I-m.length+1);se<=O;se++){var ee=I-se|0;x=m.words[ee]|0,_=f.words[se]|0,S=x*_+ae,F+=S/67108864|0,ae=S&67108863}g.words[I]=ae|0,M=F|0}return M!==0?g.words[I]=M|0:g.length--,g._strip()}var B=function(f,g,v){var x=f.words,_=g.words,S=v.words,b=0,M,I,F,ae=x[0]|0,O=ae&8191,se=ae>>>13,ee=x[1]|0,X=ee&8191,Q=ee>>>13,R=x[2]|0,Z=R&8191,te=R>>>13,le=x[3]|0,ie=le&8191,fe=le>>>13,ve=x[4]|0,Me=ve&8191,Ne=ve>>>13,Te=x[5]|0,$e=Te&8191,Ie=Te>>>13,Le=x[6]|0,Ve=Le&8191,ke=Le>>>13,ze=x[7]|0,He=ze&8191,Ee=ze>>>13,Qe=x[8]|0,ct=Qe&8191,Be=Qe>>>13,et=x[9]|0,rt=et&8191,Je=et>>>13,pt=_[0]|0,ht=pt&8191,ft=pt>>>13,Ht=_[1]|0,Jt=Ht&8191,St=Ht>>>13,er=_[2]|0,Xt=er&8191,Ot=er>>>13,Bt=_[3]|0,Tt=Bt&8191,vt=Bt>>>13,Dt=_[4]|0,Lt=Dt&8191,bt=Dt>>>13,$t=_[5]|0,jt=$t&8191,nt=$t>>>13,Ft=_[6]|0,$=Ft&8191,H=Ft>>>13,V=_[7]|0,C=V&8191,Y=V>>>13,q=_[8]|0,oe=q&8191,pe=q>>>13,xe=_[9]|0,Re=xe&8191,De=xe>>>13;v.negative=f.negative^g.negative,v.length=19,M=Math.imul(O,ht),I=Math.imul(O,ft),I=I+Math.imul(se,ht)|0,F=Math.imul(se,ft);var it=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(it>>>26)|0,it&=67108863,M=Math.imul(X,ht),I=Math.imul(X,ft),I=I+Math.imul(Q,ht)|0,F=Math.imul(Q,ft),M=M+Math.imul(O,Jt)|0,I=I+Math.imul(O,St)|0,I=I+Math.imul(se,Jt)|0,F=F+Math.imul(se,St)|0;var Ue=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,M=Math.imul(Z,ht),I=Math.imul(Z,ft),I=I+Math.imul(te,ht)|0,F=Math.imul(te,ft),M=M+Math.imul(X,Jt)|0,I=I+Math.imul(X,St)|0,I=I+Math.imul(Q,Jt)|0,F=F+Math.imul(Q,St)|0,M=M+Math.imul(O,Xt)|0,I=I+Math.imul(O,Ot)|0,I=I+Math.imul(se,Xt)|0,F=F+Math.imul(se,Ot)|0;var gt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(gt>>>26)|0,gt&=67108863,M=Math.imul(ie,ht),I=Math.imul(ie,ft),I=I+Math.imul(fe,ht)|0,F=Math.imul(fe,ft),M=M+Math.imul(Z,Jt)|0,I=I+Math.imul(Z,St)|0,I=I+Math.imul(te,Jt)|0,F=F+Math.imul(te,St)|0,M=M+Math.imul(X,Xt)|0,I=I+Math.imul(X,Ot)|0,I=I+Math.imul(Q,Xt)|0,F=F+Math.imul(Q,Ot)|0,M=M+Math.imul(O,Tt)|0,I=I+Math.imul(O,vt)|0,I=I+Math.imul(se,Tt)|0,F=F+Math.imul(se,vt)|0;var st=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(st>>>26)|0,st&=67108863,M=Math.imul(Me,ht),I=Math.imul(Me,ft),I=I+Math.imul(Ne,ht)|0,F=Math.imul(Ne,ft),M=M+Math.imul(ie,Jt)|0,I=I+Math.imul(ie,St)|0,I=I+Math.imul(fe,Jt)|0,F=F+Math.imul(fe,St)|0,M=M+Math.imul(Z,Xt)|0,I=I+Math.imul(Z,Ot)|0,I=I+Math.imul(te,Xt)|0,F=F+Math.imul(te,Ot)|0,M=M+Math.imul(X,Tt)|0,I=I+Math.imul(X,vt)|0,I=I+Math.imul(Q,Tt)|0,F=F+Math.imul(Q,vt)|0,M=M+Math.imul(O,Lt)|0,I=I+Math.imul(O,bt)|0,I=I+Math.imul(se,Lt)|0,F=F+Math.imul(se,bt)|0;var tt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(tt>>>26)|0,tt&=67108863,M=Math.imul($e,ht),I=Math.imul($e,ft),I=I+Math.imul(Ie,ht)|0,F=Math.imul(Ie,ft),M=M+Math.imul(Me,Jt)|0,I=I+Math.imul(Me,St)|0,I=I+Math.imul(Ne,Jt)|0,F=F+Math.imul(Ne,St)|0,M=M+Math.imul(ie,Xt)|0,I=I+Math.imul(ie,Ot)|0,I=I+Math.imul(fe,Xt)|0,F=F+Math.imul(fe,Ot)|0,M=M+Math.imul(Z,Tt)|0,I=I+Math.imul(Z,vt)|0,I=I+Math.imul(te,Tt)|0,F=F+Math.imul(te,vt)|0,M=M+Math.imul(X,Lt)|0,I=I+Math.imul(X,bt)|0,I=I+Math.imul(Q,Lt)|0,F=F+Math.imul(Q,bt)|0,M=M+Math.imul(O,jt)|0,I=I+Math.imul(O,nt)|0,I=I+Math.imul(se,jt)|0,F=F+Math.imul(se,nt)|0;var At=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(At>>>26)|0,At&=67108863,M=Math.imul(Ve,ht),I=Math.imul(Ve,ft),I=I+Math.imul(ke,ht)|0,F=Math.imul(ke,ft),M=M+Math.imul($e,Jt)|0,I=I+Math.imul($e,St)|0,I=I+Math.imul(Ie,Jt)|0,F=F+Math.imul(Ie,St)|0,M=M+Math.imul(Me,Xt)|0,I=I+Math.imul(Me,Ot)|0,I=I+Math.imul(Ne,Xt)|0,F=F+Math.imul(Ne,Ot)|0,M=M+Math.imul(ie,Tt)|0,I=I+Math.imul(ie,vt)|0,I=I+Math.imul(fe,Tt)|0,F=F+Math.imul(fe,vt)|0,M=M+Math.imul(Z,Lt)|0,I=I+Math.imul(Z,bt)|0,I=I+Math.imul(te,Lt)|0,F=F+Math.imul(te,bt)|0,M=M+Math.imul(X,jt)|0,I=I+Math.imul(X,nt)|0,I=I+Math.imul(Q,jt)|0,F=F+Math.imul(Q,nt)|0,M=M+Math.imul(O,$)|0,I=I+Math.imul(O,H)|0,I=I+Math.imul(se,$)|0,F=F+Math.imul(se,H)|0;var Rt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,M=Math.imul(He,ht),I=Math.imul(He,ft),I=I+Math.imul(Ee,ht)|0,F=Math.imul(Ee,ft),M=M+Math.imul(Ve,Jt)|0,I=I+Math.imul(Ve,St)|0,I=I+Math.imul(ke,Jt)|0,F=F+Math.imul(ke,St)|0,M=M+Math.imul($e,Xt)|0,I=I+Math.imul($e,Ot)|0,I=I+Math.imul(Ie,Xt)|0,F=F+Math.imul(Ie,Ot)|0,M=M+Math.imul(Me,Tt)|0,I=I+Math.imul(Me,vt)|0,I=I+Math.imul(Ne,Tt)|0,F=F+Math.imul(Ne,vt)|0,M=M+Math.imul(ie,Lt)|0,I=I+Math.imul(ie,bt)|0,I=I+Math.imul(fe,Lt)|0,F=F+Math.imul(fe,bt)|0,M=M+Math.imul(Z,jt)|0,I=I+Math.imul(Z,nt)|0,I=I+Math.imul(te,jt)|0,F=F+Math.imul(te,nt)|0,M=M+Math.imul(X,$)|0,I=I+Math.imul(X,H)|0,I=I+Math.imul(Q,$)|0,F=F+Math.imul(Q,H)|0,M=M+Math.imul(O,C)|0,I=I+Math.imul(O,Y)|0,I=I+Math.imul(se,C)|0,F=F+Math.imul(se,Y)|0;var Mt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,M=Math.imul(ct,ht),I=Math.imul(ct,ft),I=I+Math.imul(Be,ht)|0,F=Math.imul(Be,ft),M=M+Math.imul(He,Jt)|0,I=I+Math.imul(He,St)|0,I=I+Math.imul(Ee,Jt)|0,F=F+Math.imul(Ee,St)|0,M=M+Math.imul(Ve,Xt)|0,I=I+Math.imul(Ve,Ot)|0,I=I+Math.imul(ke,Xt)|0,F=F+Math.imul(ke,Ot)|0,M=M+Math.imul($e,Tt)|0,I=I+Math.imul($e,vt)|0,I=I+Math.imul(Ie,Tt)|0,F=F+Math.imul(Ie,vt)|0,M=M+Math.imul(Me,Lt)|0,I=I+Math.imul(Me,bt)|0,I=I+Math.imul(Ne,Lt)|0,F=F+Math.imul(Ne,bt)|0,M=M+Math.imul(ie,jt)|0,I=I+Math.imul(ie,nt)|0,I=I+Math.imul(fe,jt)|0,F=F+Math.imul(fe,nt)|0,M=M+Math.imul(Z,$)|0,I=I+Math.imul(Z,H)|0,I=I+Math.imul(te,$)|0,F=F+Math.imul(te,H)|0,M=M+Math.imul(X,C)|0,I=I+Math.imul(X,Y)|0,I=I+Math.imul(Q,C)|0,F=F+Math.imul(Q,Y)|0,M=M+Math.imul(O,oe)|0,I=I+Math.imul(O,pe)|0,I=I+Math.imul(se,oe)|0,F=F+Math.imul(se,pe)|0;var Et=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Et>>>26)|0,Et&=67108863,M=Math.imul(rt,ht),I=Math.imul(rt,ft),I=I+Math.imul(Je,ht)|0,F=Math.imul(Je,ft),M=M+Math.imul(ct,Jt)|0,I=I+Math.imul(ct,St)|0,I=I+Math.imul(Be,Jt)|0,F=F+Math.imul(Be,St)|0,M=M+Math.imul(He,Xt)|0,I=I+Math.imul(He,Ot)|0,I=I+Math.imul(Ee,Xt)|0,F=F+Math.imul(Ee,Ot)|0,M=M+Math.imul(Ve,Tt)|0,I=I+Math.imul(Ve,vt)|0,I=I+Math.imul(ke,Tt)|0,F=F+Math.imul(ke,vt)|0,M=M+Math.imul($e,Lt)|0,I=I+Math.imul($e,bt)|0,I=I+Math.imul(Ie,Lt)|0,F=F+Math.imul(Ie,bt)|0,M=M+Math.imul(Me,jt)|0,I=I+Math.imul(Me,nt)|0,I=I+Math.imul(Ne,jt)|0,F=F+Math.imul(Ne,nt)|0,M=M+Math.imul(ie,$)|0,I=I+Math.imul(ie,H)|0,I=I+Math.imul(fe,$)|0,F=F+Math.imul(fe,H)|0,M=M+Math.imul(Z,C)|0,I=I+Math.imul(Z,Y)|0,I=I+Math.imul(te,C)|0,F=F+Math.imul(te,Y)|0,M=M+Math.imul(X,oe)|0,I=I+Math.imul(X,pe)|0,I=I+Math.imul(Q,oe)|0,F=F+Math.imul(Q,pe)|0,M=M+Math.imul(O,Re)|0,I=I+Math.imul(O,De)|0,I=I+Math.imul(se,Re)|0,F=F+Math.imul(se,De)|0;var dt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(dt>>>26)|0,dt&=67108863,M=Math.imul(rt,Jt),I=Math.imul(rt,St),I=I+Math.imul(Je,Jt)|0,F=Math.imul(Je,St),M=M+Math.imul(ct,Xt)|0,I=I+Math.imul(ct,Ot)|0,I=I+Math.imul(Be,Xt)|0,F=F+Math.imul(Be,Ot)|0,M=M+Math.imul(He,Tt)|0,I=I+Math.imul(He,vt)|0,I=I+Math.imul(Ee,Tt)|0,F=F+Math.imul(Ee,vt)|0,M=M+Math.imul(Ve,Lt)|0,I=I+Math.imul(Ve,bt)|0,I=I+Math.imul(ke,Lt)|0,F=F+Math.imul(ke,bt)|0,M=M+Math.imul($e,jt)|0,I=I+Math.imul($e,nt)|0,I=I+Math.imul(Ie,jt)|0,F=F+Math.imul(Ie,nt)|0,M=M+Math.imul(Me,$)|0,I=I+Math.imul(Me,H)|0,I=I+Math.imul(Ne,$)|0,F=F+Math.imul(Ne,H)|0,M=M+Math.imul(ie,C)|0,I=I+Math.imul(ie,Y)|0,I=I+Math.imul(fe,C)|0,F=F+Math.imul(fe,Y)|0,M=M+Math.imul(Z,oe)|0,I=I+Math.imul(Z,pe)|0,I=I+Math.imul(te,oe)|0,F=F+Math.imul(te,pe)|0,M=M+Math.imul(X,Re)|0,I=I+Math.imul(X,De)|0,I=I+Math.imul(Q,Re)|0,F=F+Math.imul(Q,De)|0;var _t=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(_t>>>26)|0,_t&=67108863,M=Math.imul(rt,Xt),I=Math.imul(rt,Ot),I=I+Math.imul(Je,Xt)|0,F=Math.imul(Je,Ot),M=M+Math.imul(ct,Tt)|0,I=I+Math.imul(ct,vt)|0,I=I+Math.imul(Be,Tt)|0,F=F+Math.imul(Be,vt)|0,M=M+Math.imul(He,Lt)|0,I=I+Math.imul(He,bt)|0,I=I+Math.imul(Ee,Lt)|0,F=F+Math.imul(Ee,bt)|0,M=M+Math.imul(Ve,jt)|0,I=I+Math.imul(Ve,nt)|0,I=I+Math.imul(ke,jt)|0,F=F+Math.imul(ke,nt)|0,M=M+Math.imul($e,$)|0,I=I+Math.imul($e,H)|0,I=I+Math.imul(Ie,$)|0,F=F+Math.imul(Ie,H)|0,M=M+Math.imul(Me,C)|0,I=I+Math.imul(Me,Y)|0,I=I+Math.imul(Ne,C)|0,F=F+Math.imul(Ne,Y)|0,M=M+Math.imul(ie,oe)|0,I=I+Math.imul(ie,pe)|0,I=I+Math.imul(fe,oe)|0,F=F+Math.imul(fe,pe)|0,M=M+Math.imul(Z,Re)|0,I=I+Math.imul(Z,De)|0,I=I+Math.imul(te,Re)|0,F=F+Math.imul(te,De)|0;var ot=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(ot>>>26)|0,ot&=67108863,M=Math.imul(rt,Tt),I=Math.imul(rt,vt),I=I+Math.imul(Je,Tt)|0,F=Math.imul(Je,vt),M=M+Math.imul(ct,Lt)|0,I=I+Math.imul(ct,bt)|0,I=I+Math.imul(Be,Lt)|0,F=F+Math.imul(Be,bt)|0,M=M+Math.imul(He,jt)|0,I=I+Math.imul(He,nt)|0,I=I+Math.imul(Ee,jt)|0,F=F+Math.imul(Ee,nt)|0,M=M+Math.imul(Ve,$)|0,I=I+Math.imul(Ve,H)|0,I=I+Math.imul(ke,$)|0,F=F+Math.imul(ke,H)|0,M=M+Math.imul($e,C)|0,I=I+Math.imul($e,Y)|0,I=I+Math.imul(Ie,C)|0,F=F+Math.imul(Ie,Y)|0,M=M+Math.imul(Me,oe)|0,I=I+Math.imul(Me,pe)|0,I=I+Math.imul(Ne,oe)|0,F=F+Math.imul(Ne,pe)|0,M=M+Math.imul(ie,Re)|0,I=I+Math.imul(ie,De)|0,I=I+Math.imul(fe,Re)|0,F=F+Math.imul(fe,De)|0;var wt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(wt>>>26)|0,wt&=67108863,M=Math.imul(rt,Lt),I=Math.imul(rt,bt),I=I+Math.imul(Je,Lt)|0,F=Math.imul(Je,bt),M=M+Math.imul(ct,jt)|0,I=I+Math.imul(ct,nt)|0,I=I+Math.imul(Be,jt)|0,F=F+Math.imul(Be,nt)|0,M=M+Math.imul(He,$)|0,I=I+Math.imul(He,H)|0,I=I+Math.imul(Ee,$)|0,F=F+Math.imul(Ee,H)|0,M=M+Math.imul(Ve,C)|0,I=I+Math.imul(Ve,Y)|0,I=I+Math.imul(ke,C)|0,F=F+Math.imul(ke,Y)|0,M=M+Math.imul($e,oe)|0,I=I+Math.imul($e,pe)|0,I=I+Math.imul(Ie,oe)|0,F=F+Math.imul(Ie,pe)|0,M=M+Math.imul(Me,Re)|0,I=I+Math.imul(Me,De)|0,I=I+Math.imul(Ne,Re)|0,F=F+Math.imul(Ne,De)|0;var lt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(lt>>>26)|0,lt&=67108863,M=Math.imul(rt,jt),I=Math.imul(rt,nt),I=I+Math.imul(Je,jt)|0,F=Math.imul(Je,nt),M=M+Math.imul(ct,$)|0,I=I+Math.imul(ct,H)|0,I=I+Math.imul(Be,$)|0,F=F+Math.imul(Be,H)|0,M=M+Math.imul(He,C)|0,I=I+Math.imul(He,Y)|0,I=I+Math.imul(Ee,C)|0,F=F+Math.imul(Ee,Y)|0,M=M+Math.imul(Ve,oe)|0,I=I+Math.imul(Ve,pe)|0,I=I+Math.imul(ke,oe)|0,F=F+Math.imul(ke,pe)|0,M=M+Math.imul($e,Re)|0,I=I+Math.imul($e,De)|0,I=I+Math.imul(Ie,Re)|0,F=F+Math.imul(Ie,De)|0;var at=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(at>>>26)|0,at&=67108863,M=Math.imul(rt,$),I=Math.imul(rt,H),I=I+Math.imul(Je,$)|0,F=Math.imul(Je,H),M=M+Math.imul(ct,C)|0,I=I+Math.imul(ct,Y)|0,I=I+Math.imul(Be,C)|0,F=F+Math.imul(Be,Y)|0,M=M+Math.imul(He,oe)|0,I=I+Math.imul(He,pe)|0,I=I+Math.imul(Ee,oe)|0,F=F+Math.imul(Ee,pe)|0,M=M+Math.imul(Ve,Re)|0,I=I+Math.imul(Ve,De)|0,I=I+Math.imul(ke,Re)|0,F=F+Math.imul(ke,De)|0;var Ae=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,M=Math.imul(rt,C),I=Math.imul(rt,Y),I=I+Math.imul(Je,C)|0,F=Math.imul(Je,Y),M=M+Math.imul(ct,oe)|0,I=I+Math.imul(ct,pe)|0,I=I+Math.imul(Be,oe)|0,F=F+Math.imul(Be,pe)|0,M=M+Math.imul(He,Re)|0,I=I+Math.imul(He,De)|0,I=I+Math.imul(Ee,Re)|0,F=F+Math.imul(Ee,De)|0;var Pe=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,M=Math.imul(rt,oe),I=Math.imul(rt,pe),I=I+Math.imul(Je,oe)|0,F=Math.imul(Je,pe),M=M+Math.imul(ct,Re)|0,I=I+Math.imul(ct,De)|0,I=I+Math.imul(Be,Re)|0,F=F+Math.imul(Be,De)|0;var Ge=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,M=Math.imul(rt,Re),I=Math.imul(rt,De),I=I+Math.imul(Je,Re)|0,F=Math.imul(Je,De);var je=(b+M|0)+((I&8191)<<13)|0;return b=(F+(I>>>13)|0)+(je>>>26)|0,je&=67108863,S[0]=it,S[1]=Ue,S[2]=gt,S[3]=st,S[4]=tt,S[5]=At,S[6]=Rt,S[7]=Mt,S[8]=Et,S[9]=dt,S[10]=_t,S[11]=ot,S[12]=wt,S[13]=lt,S[14]=at,S[15]=Ae,S[16]=Pe,S[17]=Ge,S[18]=je,b!==0&&(S[19]=b,v.length++),v};Math.imul||(B=k);function j(m,f,g){g.negative=f.negative^m.negative,g.length=m.length+f.length;for(var v=0,x=0,_=0;_>>26)|0,x+=S>>>26,S&=67108863}g.words[_]=b,v=S,S=x}return v!==0?g.words[_]=v:g.length--,g._strip()}function U(m,f,g){return j(m,f,g)}s.prototype.mulTo=function(f,g){var v,x=this.length+f.length;return this.length===10&&f.length===10?v=B(this,f,g):x<63?v=k(this,f,g):x<1024?v=j(this,f,g):v=U(this,f,g),v},s.prototype.mul=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),this.mulTo(f,g)},s.prototype.mulf=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),U(this,f,g)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var g=f<0;g&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var v=0,x=0;x>=26,v+=_/67108864|0,v+=S>>>26,this.words[x]=S&67108863}return v!==0&&(this.words[x]=v,this.length++),g?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var g=D(f);if(g.length===0)return new s(1);for(var v=this,x=0;x=0);var g=f%26,v=(f-g)/26,x=67108863>>>26-g<<26-g,_;if(g!==0){var S=0;for(_=0;_>>26-g}S&&(this.words[_]=S,this.length++)}if(v!==0){for(_=this.length-1;_>=0;_--)this.words[_+v]=this.words[_];for(_=0;_=0);var x;g?x=(g-g%26)/26:x=0;var _=f%26,S=Math.min((f-_)/26,this.length),b=67108863^67108863>>>_<<_,M=v;if(x-=S,x=Math.max(0,x),M){for(var I=0;IS)for(this.length-=S,I=0;I=0&&(F!==0||I>=x);I--){var ae=this.words[I]|0;this.words[I]=F<<26-_|ae>>>_,F=ae&b}return M&&F!==0&&(M.words[M.length++]=F),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,g,v){return n(this.negative===0),this.iushrn(f,g,v)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var g=f%26,v=(f-g)/26,x=1<=0);var g=f%26,v=(f-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(g!==0&&v++,this.length=Math.min(v,this.length),g!==0){var x=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(M/67108864|0),this.words[_+v]=S&67108863}for(;_>26,this.words[_+v]=S&67108863;if(b===0)return this._strip();for(n(b===-1),b=0,_=0;_>26,this.words[_]=S&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,g){var v=this.length-f.length,x=this.clone(),_=f,S=_.words[_.length-1]|0,b=this._countBits(S);v=26-b,v!==0&&(_=_.ushln(v),x.iushln(v),S=_.words[_.length-1]|0);var M=x.length-_.length,I;if(g!=="mod"){I=new s(null),I.length=M+1,I.words=new Array(I.length);for(var F=0;F=0;O--){var se=(x.words[_.length+O]|0)*67108864+(x.words[_.length+O-1]|0);for(se=Math.min(se/S|0,67108863),x._ishlnsubmul(_,se,O);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(_,1,O),x.isZero()||(x.negative^=1);I&&(I.words[O]=se)}return I&&I._strip(),x._strip(),g!=="div"&&v!==0&&x.iushrn(v),{div:I||null,mod:x}},s.prototype.divmod=function(f,g,v){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,_,S;return this.negative!==0&&f.negative===0?(S=this.neg().divmod(f,g),g!=="mod"&&(x=S.div.neg()),g!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.iadd(f)),{div:x,mod:_}):this.negative===0&&f.negative!==0?(S=this.divmod(f.neg(),g),g!=="mod"&&(x=S.div.neg()),{div:x,mod:S.mod}):this.negative&f.negative?(S=this.neg().divmod(f.neg(),g),g!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.isub(f)),{div:S.div,mod:_}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?g==="div"?{div:this.divn(f.words[0]),mod:null}:g==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,g)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var g=this.divmod(f);if(g.mod.isZero())return g.div;var v=g.div.negative!==0?g.mod.isub(f):g.mod,x=f.ushrn(1),_=f.andln(1),S=v.cmp(x);return S<0||_===1&&S===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},s.prototype.modrn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=(1<<26)%f,x=0,_=this.length-1;_>=0;_--)x=(v*x+(this.words[_]|0))%f;return g?-x:x},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=0,x=this.length-1;x>=0;x--){var _=(this.words[x]|0)+v*67108864;this.words[x]=_/f|0,v=_%f}return this._strip(),g?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),_=new s(0),S=new s(0),b=new s(1),M=0;g.isEven()&&v.isEven();)g.iushrn(1),v.iushrn(1),++M;for(var I=v.clone(),F=g.clone();!g.isZero();){for(var ae=0,O=1;!(g.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(g.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(I),_.isub(F)),x.iushrn(1),_.iushrn(1);for(var se=0,ee=1;!(v.words[0]&ee)&&se<26;++se,ee<<=1);if(se>0)for(v.iushrn(se);se-- >0;)(S.isOdd()||b.isOdd())&&(S.iadd(I),b.isub(F)),S.iushrn(1),b.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(S),_.isub(b)):(v.isub(g),S.isub(x),b.isub(_))}return{a:S,b,gcd:v.iushln(M)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),_=new s(0),S=v.clone();g.cmpn(1)>0&&v.cmpn(1)>0;){for(var b=0,M=1;!(g.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(g.iushrn(b);b-- >0;)x.isOdd()&&x.iadd(S),x.iushrn(1);for(var I=0,F=1;!(v.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(v.iushrn(I);I-- >0;)_.isOdd()&&_.iadd(S),_.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(_)):(v.isub(g),_.isub(x))}var ae;return g.cmpn(1)===0?ae=x:ae=_,ae.cmpn(0)<0&&ae.iadd(f),ae},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var g=this.clone(),v=f.clone();g.negative=0,v.negative=0;for(var x=0;g.isEven()&&v.isEven();x++)g.iushrn(1),v.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;v.isEven();)v.iushrn(1);var _=g.cmp(v);if(_<0){var S=g;g=v,v=S}else if(_===0||v.cmpn(1)===0)break;g.isub(v)}while(!0);return v.iushln(x)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var g=f%26,v=(f-g)/26,x=1<>>26,b&=67108863,this.words[S]=b}return _!==0&&(this.words[S]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var g=f<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var v;if(this.length>1)v=1;else{g&&(f=-f),n(f<=67108863,"Number is too big");var x=this.words[0]|0;v=x===f?0:xf.length)return 1;if(this.length=0;v--){var x=this.words[v]|0,_=f.words[v]|0;if(x!==_){x<_?g=-1:x>_&&(g=1);break}}return g},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new G(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var K={k256:null,p224:null,p192:null,p25519:null};function J(m,f){this.name=m,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}J.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},J.prototype.ireduce=function(f){var g=f,v;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),v=g.bitLength();while(v>this.n);var x=v0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},J.prototype.split=function(f,g){f.iushrn(this.n,0,g)},J.prototype.imulK=function(f){return f.imul(this.k)};function T(){J.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(T,J),T.prototype.split=function(f,g){for(var v=4194303,x=Math.min(f.length,9),_=0;_>>22,S=b}S>>>=22,f.words[_-10]=S,S===0&&f.length>10?f.length-=10:f.length-=9},T.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var g=0,v=0;v>>=26,f.words[v]=_,g=x}return g!==0&&(f.words[f.length++]=g),f},s._prime=function(f){if(K[f])return K[f];var g;if(f==="k256")g=new T;else if(f==="p224")g=new z;else if(f==="p192")g=new ue;else if(f==="p25519")g=new _e;else throw new Error("Unknown prime "+f);return K[f]=g,g};function G(m){if(typeof m=="string"){var f=s._prime(m);this.m=f.p,this.prime=f}else n(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}G.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},G.prototype._verify2=function(f,g){n((f.negative|g.negative)===0,"red works only with positives"),n(f.red&&f.red===g.red,"red works only with red numbers")},G.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(d(f,f.umod(this.m)._forceRed(this)),f)},G.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},G.prototype.add=function(f,g){this._verify2(f,g);var v=f.add(g);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},G.prototype.iadd=function(f,g){this._verify2(f,g);var v=f.iadd(g);return v.cmp(this.m)>=0&&v.isub(this.m),v},G.prototype.sub=function(f,g){this._verify2(f,g);var v=f.sub(g);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},G.prototype.isub=function(f,g){this._verify2(f,g);var v=f.isub(g);return v.cmpn(0)<0&&v.iadd(this.m),v},G.prototype.shl=function(f,g){return this._verify1(f),this.imod(f.ushln(g))},G.prototype.imul=function(f,g){return this._verify2(f,g),this.imod(f.imul(g))},G.prototype.mul=function(f,g){return this._verify2(f,g),this.imod(f.mul(g))},G.prototype.isqr=function(f){return this.imul(f,f.clone())},G.prototype.sqr=function(f){return this.mul(f,f)},G.prototype.sqrt=function(f){if(f.isZero())return f.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(f,v)}for(var x=this.m.subn(1),_=0;!x.isZero()&&x.andln(1)===0;)_++,x.iushrn(1);n(!x.isZero());var S=new s(1).toRed(this),b=S.redNeg(),M=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,M).cmp(b)!==0;)I.redIAdd(b);for(var F=this.pow(I,x),ae=this.pow(f,x.addn(1).iushrn(1)),O=this.pow(f,x),se=_;O.cmp(S)!==0;){for(var ee=O,X=0;ee.cmp(S)!==0;X++)ee=ee.redSqr();n(X=0;_--){for(var F=g.words[_],ae=I-1;ae>=0;ae--){var O=F>>ae&1;if(S!==x[0]&&(S=this.sqr(S)),O===0&&b===0){M=0;continue}b<<=1,b|=O,M++,!(M!==v&&(_!==0||ae!==0))&&(S=this.mul(S,x[b]),M=0,b=0)}I=26}return S},G.prototype.convertTo=function(f){var g=f.umod(this.m);return g===f?g.clone():g},G.prototype.convertFrom=function(f){var g=f.clone();return g.red=null,g},s.mont=function(f){return new E(f)};function E(m){G.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(E,G),E.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},E.prototype.convertFrom=function(f){var g=this.imod(f.mul(this.rinv));return g.red=null,g},E.prototype.imul=function(f,g){if(f.isZero()||g.isZero())return f.words[0]=0,f.length=1,f;var v=f.imul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.mul=function(f,g){if(f.isZero()||g.isZero())return new s(0)._forceRed(this);var v=f.mul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.invm=function(f){var g=this.imod(f._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,nn)}(Sm);var _N=Sm.exports;const rr=ji(_N);var EN=rr.BN;function SN(t){return new EN(t,36).toString(16)}const AN="strings/5.7.0",PN=new Kr(AN);var bd;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(bd||(bd={}));var Ux;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(Ux||(Ux={}));function Am(t,e=bd.current){e!=bd.current&&(PN.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return bn(r)}const MN=`Ethereum Signed Message: -`;function qx(t){return typeof t=="string"&&(t=Am(t)),Em(yN([Am(MN),Am(String(t.length)),t]))}const IN="address/5.7.0",sl=new Kr(IN);function zx(t){Ns(t,20)||sl.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=bn(Em(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const CN=9007199254740991;function TN(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const Pm={};for(let t=0;t<10;t++)Pm[String(t)]=String(t);for(let t=0;t<26;t++)Pm[String.fromCharCode(65+t)]=String(10+t);const Hx=Math.floor(TN(CN));function RN(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Pm[n]).join("");for(;e.length>=Hx;){let n=e.substring(0,Hx);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function DN(t){let e=null;if(typeof t!="string"&&sl.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=zx(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&sl.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==RN(t)&&sl.throwArgumentError("bad icap checksum","address",t),e=SN(t.substring(4));e.length<40;)e="0"+e;e=zx("0x"+e)}else sl.throwArgumentError("invalid address","address",t);return e}function ol(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var al={},yr={},Ga=Wx;function Wx(t,e){if(!t)throw new Error(e||"Assertion failed")}Wx.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var Mm={exports:{}};typeof Object.create=="function"?Mm.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Mm.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var yd=Mm.exports,ON=Ga,NN=yd;yr.inherits=NN;function LN(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function kN(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):LN(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}yr.htonl=Kx;function $N(t,e){for(var r="",n=0;n>>0}return s}yr.join32=FN;function jN(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}yr.split32=jN;function UN(t,e){return t>>>e|t<<32-e}yr.rotr32=UN;function qN(t,e){return t<>>32-e}yr.rotl32=qN;function zN(t,e){return t+e>>>0}yr.sum32=zN;function HN(t,e,r){return t+e+r>>>0}yr.sum32_3=HN;function WN(t,e,r,n){return t+e+r+n>>>0}yr.sum32_4=WN;function KN(t,e,r,n,i){return t+e+r+n+i>>>0}yr.sum32_5=KN;function VN(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}yr.sum64=VN;function GN(t,e,r,n){var i=e+n>>>0,s=(i>>0}yr.sum64_hi=GN;function YN(t,e,r,n){var i=e+n;return i>>>0}yr.sum64_lo=YN;function JN(t,e,r,n,i,s,o,a){var u=0,l=e;l=l+n>>>0,u+=l>>0,u+=l>>0,u+=l>>0}yr.sum64_4_hi=JN;function XN(t,e,r,n,i,s,o,a){var u=e+n+s+a;return u>>>0}yr.sum64_4_lo=XN;function ZN(t,e,r,n,i,s,o,a,u,l){var d=0,p=e;p=p+n>>>0,d+=p>>0,d+=p>>0,d+=p>>0,d+=p>>0}yr.sum64_5_hi=ZN;function QN(t,e,r,n,i,s,o,a,u,l){var d=e+n+s+a+l;return d>>>0}yr.sum64_5_lo=QN;function eL(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}yr.rotr64_hi=eL;function tL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.rotr64_lo=tL;function rL(t,e,r){return t>>>r}yr.shr64_hi=rL;function nL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.shr64_lo=nL;var lu={},Yx=yr,iL=Ga;function wd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}lu.BlockHash=wd,wd.prototype.update=function(e,r){if(e=Yx.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Yx.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}Ls.g0_256=uL;function fL(t){return ks(t,17)^ks(t,19)^t>>>10}Ls.g1_256=fL;var du=yr,lL=lu,hL=Ls,Im=du.rotl32,cl=du.sum32,dL=du.sum32_5,pL=hL.ft_1,Qx=lL.BlockHash,gL=[1518500249,1859775393,2400959708,3395469782];function Bs(){if(!(this instanceof Bs))return new Bs;Qx.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}du.inherits(Bs,Qx);var mL=Bs;Bs.blockSize=512,Bs.outSize=160,Bs.hmacStrength=80,Bs.padLength=64,Bs.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),nk(e.length<=this.blockSize);for(var r=e.length;r>8,y=d&255;p?u.push(p,y):u.push(y)}return u}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",u=0;u(y>>1)-1?N=(y>>1)-D:N=D,A.isubn(N)):N=0,p[P]=N,A.iushrn(1)}return p}r.getNAF=n;function i(u,l){var d=[[],[]];u=u.clone(),l=l.clone();for(var p=0,y=0,A;u.cmpn(-p)>0||l.cmpn(-y)>0;){var P=u.andln(3)+p&3,N=l.andln(3)+y&3;P===3&&(P=-1),N===3&&(N=-1);var D;P&1?(A=u.andln(7)+p&7,(A===3||A===5)&&N===2?D=-P:D=P):D=0,d[0].push(D);var k;N&1?(A=l.andln(7)+y&7,(A===3||A===5)&&P===2?k=-N:k=N):k=0,d[1].push(k),2*p===D+1&&(p=1-p),2*y===k+1&&(y=1-y),u.iushrn(1),l.iushrn(1)}return d}r.getJSF=i;function s(u,l,d){var p="_"+l;u.prototype[l]=function(){return this[p]!==void 0?this[p]:this[p]=d.call(this)}}r.cachedProperty=s;function o(u){return typeof u=="string"?r.toArray(u,"hex"):u}r.parseBytes=o;function a(u){return new rr(u,"hex","le")}r.intFromLE=a}),_d=Ci.getNAF,ok=Ci.getJSF,Ed=Ci.assert;function na(t,e){this.type=t,this.p=new rr(e.p,16),this.red=e.prime?rr.red(e.prime):rr.mont(this.p),this.zero=new rr(0).toRed(this.red),this.one=new rr(1).toRed(this.red),this.two=new rr(2).toRed(this.red),this.n=e.n&&new rr(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ja=na;na.prototype.point=function(){throw new Error("Not implemented")},na.prototype.validate=function(){throw new Error("Not implemented")},na.prototype._fixedNafMul=function(e,r){Ed(e.precomputed);var n=e._getDoubles(),i=_d(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Ed(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},na.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=_d(n[P],o[P],this._bitLength),u[N]=_d(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=ok(n[P],n[N]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[N]=new Array(l),p=0;p=0;d--){for(var T=0;d>=0;){var z=!0;for(p=0;p=0&&T++,K=K.dblp(T),d<0)break;for(p=0;p0?y=a[p][ue-1>>1]:ue<0&&(y=a[p][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},zi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),p.negative&&(p=p.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:p,b:y},{a:A,b:P}]},Hi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Hi.prototype.pointFromX=function(e,r){e=new rr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Hi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Hi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Dn.prototype.isInfinity=function(){return this.inf},Dn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Dn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Dn.prototype.getX=function(){return this.x.fromRed()},Dn.prototype.getY=function(){return this.y.fromRed()},Dn.prototype.mul=function(e){return e=new rr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Dn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Dn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Dn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Dn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Dn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Un(t,e,r,n){Ja.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new rr(0)):(this.x=new rr(e,16),this.y=new rr(r,16),this.z=new rr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Nm(Un,Ja.BasePoint),Hi.prototype.jpoint=function(e,r,n){return new Un(this,e,r,n)},Un.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},Un.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Un.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(p).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(p)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},Un.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),A=u.redMul(p.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},Un.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},Un.prototype.inspect=function(){return this.isInfinity()?"":""},Un.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Sd=vu(function(t,e){var r=e;r.base=Ja,r.short=ck,r.mont=null,r.edwards=null}),Ad=vu(function(t,e){var r=e,n=Ci.assert;function i(a){a.type==="short"?this.curve=new Sd.short(a):a.type==="edwards"?this.curve=new Sd.edwards(a):this.curve=new Sd.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,u){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(u);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:wo.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:wo.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:wo.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:wo.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:wo.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:wo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function ia(t){if(!(this instanceof ia))return new ia(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=vs.toArray(t.entropy,t.entropyEnc||"hex"),r=vs.toArray(t.nonce,t.nonceEnc||"hex"),n=vs.toArray(t.pers,t.persEnc||"hex");Om(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var p3=ia;ia.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ia.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=vs.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var uk=Ci.assert;function Pd(t,e){if(t instanceof Pd)return t;this._importDER(t,e)||(uk(t.r&&t.s,"Signature without r or s"),this.r=new rr(t.r,16),this.s=new rr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Md=Pd;function fk(){this.place=0}function Bm(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function g3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Pd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=g3(r),n=g3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];$m(i,r.length),i=i.concat(r),i.push(2),$m(i,n.length);var s=i.concat(n),o=[48];return $m(o,s.length),o=o.concat(s),Ci.encode(o,e)};var lk=function(){throw new Error("unsupported")},m3=Ci.assert;function Wi(t){if(!(this instanceof Wi))return new Wi(t);typeof t=="string"&&(m3(Object.prototype.hasOwnProperty.call(Ad,t),"Unknown curve "+t),t=Ad[t]),t instanceof Ad.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var hk=Wi;Wi.prototype.keyPair=function(e){return new km(this,e)},Wi.prototype.keyFromPrivate=function(e,r){return km.fromPrivate(this,e,r)},Wi.prototype.keyFromPublic=function(e,r){return km.fromPublic(this,e,r)},Wi.prototype.genKeyPair=function(e){e||(e={});for(var r=new p3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||lk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new rr(2));;){var s=new rr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Wi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Wi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new rr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new p3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new rr(1)),d=0;;d++){var p=i.k?i.k(d):new rr(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new Md({r:P,s:N,recoveryParam:D})}}}}}},Wi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new rr(e,16)),n=this.keyFromPublic(n,i),r=new Md(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),u=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.eqXToP(s)):(d=this.g.mulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.getX().umod(this.n).cmp(s)===0)},Wi.prototype.recoverPubKey=function(t,e,r,n){m3((3&r)===r,"The recovery param is more than two bits"),e=new Md(e,n);var i=this.n,s=new rr(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Wi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Md(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dk=vu(function(t,e){var r=e;r.version="6.5.4",r.utils=Ci,r.rand=function(){throw new Error("unsupported")},r.curve=Sd,r.curves=Ad,r.ec=hk,r.eddsa=null}),pk=dk.ec;const gk="signing-key/5.7.0",Fm=new Kr(gk);let jm=null;function sa(){return jm||(jm=new pk("secp256k1")),jm}class mk{constructor(e){ol(this,"curve","secp256k1"),ol(this,"privateKey",Ii(e)),xN(this.privateKey)!==32&&Fm.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=sa().keyFromPrivate(bn(this.privateKey));ol(this,"publicKey","0x"+r.getPublic(!1,"hex")),ol(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ol(this,"_isSigningKey",!0)}_addPoint(e){const r=sa().keyFromPublic(bn(this.publicKey)),n=sa().keyFromPublic(bn(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=sa().keyFromPrivate(bn(this.privateKey)),n=bn(e);n.length!==32&&Fm.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return jx({recoveryParam:i.recoveryParam,r:fu("0x"+i.r.toString(16),32),s:fu("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=sa().keyFromPrivate(bn(this.privateKey)),n=sa().keyFromPublic(bn(v3(e)));return fu("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function vk(t,e){const r=jx(e),n={r:bn(r.r),s:bn(r.s)};return"0x"+sa().recoverPubKey(bn(t),n,r.recoveryParam).encode("hex",!1)}function v3(t,e){const r=bn(t);return r.length===32?new mk(r).publicKey:r.length===33?"0x"+sa().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?Ii(r):Fm.throwArgumentError("invalid public or private key","key","[REDACTED]")}var b3;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(b3||(b3={}));function bk(t){const e=v3(t);return DN(Fx(Em(Fx(e,1)),12))}function yk(t,e){return bk(vk(bn(t),e))}var Um={},Id={};Object.defineProperty(Id,"__esModule",{value:!0});var Yn=or,qm=Mi,wk=20;function xk(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],p=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],P=r[31]<<24|r[30]<<16|r[29]<<8|r[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],k=e[11]<<24|e[10]<<16|e[9]<<8|e[8],B=e[15]<<24|e[14]<<16|e[13]<<8|e[12],j=n,U=i,K=s,J=o,T=a,z=u,ue=l,_e=d,G=p,E=y,m=A,f=P,g=N,v=D,x=k,_=B,S=0;S>>16|g<<16,G=G+g|0,T^=G,T=T>>>20|T<<12,U=U+z|0,v^=U,v=v>>>16|v<<16,E=E+v|0,z^=E,z=z>>>20|z<<12,K=K+ue|0,x^=K,x=x>>>16|x<<16,m=m+x|0,ue^=m,ue=ue>>>20|ue<<12,J=J+_e|0,_^=J,_=_>>>16|_<<16,f=f+_|0,_e^=f,_e=_e>>>20|_e<<12,K=K+ue|0,x^=K,x=x>>>24|x<<8,m=m+x|0,ue^=m,ue=ue>>>25|ue<<7,J=J+_e|0,_^=J,_=_>>>24|_<<8,f=f+_|0,_e^=f,_e=_e>>>25|_e<<7,U=U+z|0,v^=U,v=v>>>24|v<<8,E=E+v|0,z^=E,z=z>>>25|z<<7,j=j+T|0,g^=j,g=g>>>24|g<<8,G=G+g|0,T^=G,T=T>>>25|T<<7,j=j+z|0,_^=j,_=_>>>16|_<<16,m=m+_|0,z^=m,z=z>>>20|z<<12,U=U+ue|0,g^=U,g=g>>>16|g<<16,f=f+g|0,ue^=f,ue=ue>>>20|ue<<12,K=K+_e|0,v^=K,v=v>>>16|v<<16,G=G+v|0,_e^=G,_e=_e>>>20|_e<<12,J=J+T|0,x^=J,x=x>>>16|x<<16,E=E+x|0,T^=E,T=T>>>20|T<<12,K=K+_e|0,v^=K,v=v>>>24|v<<8,G=G+v|0,_e^=G,_e=_e>>>25|_e<<7,J=J+T|0,x^=J,x=x>>>24|x<<8,E=E+x|0,T^=E,T=T>>>25|T<<7,U=U+ue|0,g^=U,g=g>>>24|g<<8,f=f+g|0,ue^=f,ue=ue>>>25|ue<<7,j=j+z|0,_^=j,_=_>>>24|_<<8,m=m+_|0,z^=m,z=z>>>25|z<<7;Yn.writeUint32LE(j+n|0,t,0),Yn.writeUint32LE(U+i|0,t,4),Yn.writeUint32LE(K+s|0,t,8),Yn.writeUint32LE(J+o|0,t,12),Yn.writeUint32LE(T+a|0,t,16),Yn.writeUint32LE(z+u|0,t,20),Yn.writeUint32LE(ue+l|0,t,24),Yn.writeUint32LE(_e+d|0,t,28),Yn.writeUint32LE(G+p|0,t,32),Yn.writeUint32LE(E+y|0,t,36),Yn.writeUint32LE(m+A|0,t,40),Yn.writeUint32LE(f+P|0,t,44),Yn.writeUint32LE(g+N|0,t,48),Yn.writeUint32LE(v+D|0,t,52),Yn.writeUint32LE(x+k|0,t,56),Yn.writeUint32LE(_+B|0,t,60)}function y3(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var w3={},oa={};Object.defineProperty(oa,"__esModule",{value:!0});function Sk(t,e,r){return~(t-1)&e|t-1&r}oa.select=Sk;function Ak(t,e){return(t|0)-(e|0)-1>>>31&1}oa.lessOrEqual=Ak;function x3(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}oa.compare=x3;function Pk(t,e){return t.length===0||e.length===0?!1:x3(t,e)!==0}oa.equal=Pk,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=oa,r=Mi;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var u=a[0]|a[1]<<8;this._r[0]=u&8191;var l=a[2]|a[3]<<8;this._r[1]=(u>>>13|l<<3)&8191;var d=a[4]|a[5]<<8;this._r[2]=(l>>>10|d<<6)&7939;var p=a[6]|a[7]<<8;this._r[3]=(d>>>7|p<<9)&8191;var y=a[8]|a[9]<<8;this._r[4]=(p>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var A=a[10]|a[11]<<8;this._r[6]=(y>>>14|A<<2)&8191;var P=a[12]|a[13]<<8;this._r[7]=(A>>>11|P<<5)&8065;var N=a[14]|a[15]<<8;this._r[8]=(P>>>8|N<<8)&8191,this._r[9]=N>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,u,l){for(var d=this._fin?0:2048,p=this._h[0],y=this._h[1],A=this._h[2],P=this._h[3],N=this._h[4],D=this._h[5],k=this._h[6],B=this._h[7],j=this._h[8],U=this._h[9],K=this._r[0],J=this._r[1],T=this._r[2],z=this._r[3],ue=this._r[4],_e=this._r[5],G=this._r[6],E=this._r[7],m=this._r[8],f=this._r[9];l>=16;){var g=a[u+0]|a[u+1]<<8;p+=g&8191;var v=a[u+2]|a[u+3]<<8;y+=(g>>>13|v<<3)&8191;var x=a[u+4]|a[u+5]<<8;A+=(v>>>10|x<<6)&8191;var _=a[u+6]|a[u+7]<<8;P+=(x>>>7|_<<9)&8191;var S=a[u+8]|a[u+9]<<8;N+=(_>>>4|S<<12)&8191,D+=S>>>1&8191;var b=a[u+10]|a[u+11]<<8;k+=(S>>>14|b<<2)&8191;var M=a[u+12]|a[u+13]<<8;B+=(b>>>11|M<<5)&8191;var I=a[u+14]|a[u+15]<<8;j+=(M>>>8|I<<8)&8191,U+=I>>>5|d;var F=0,ae=F;ae+=p*K,ae+=y*(5*f),ae+=A*(5*m),ae+=P*(5*E),ae+=N*(5*G),F=ae>>>13,ae&=8191,ae+=D*(5*_e),ae+=k*(5*ue),ae+=B*(5*z),ae+=j*(5*T),ae+=U*(5*J),F+=ae>>>13,ae&=8191;var O=F;O+=p*J,O+=y*K,O+=A*(5*f),O+=P*(5*m),O+=N*(5*E),F=O>>>13,O&=8191,O+=D*(5*G),O+=k*(5*_e),O+=B*(5*ue),O+=j*(5*z),O+=U*(5*T),F+=O>>>13,O&=8191;var se=F;se+=p*T,se+=y*J,se+=A*K,se+=P*(5*f),se+=N*(5*m),F=se>>>13,se&=8191,se+=D*(5*E),se+=k*(5*G),se+=B*(5*_e),se+=j*(5*ue),se+=U*(5*z),F+=se>>>13,se&=8191;var ee=F;ee+=p*z,ee+=y*T,ee+=A*J,ee+=P*K,ee+=N*(5*f),F=ee>>>13,ee&=8191,ee+=D*(5*m),ee+=k*(5*E),ee+=B*(5*G),ee+=j*(5*_e),ee+=U*(5*ue),F+=ee>>>13,ee&=8191;var X=F;X+=p*ue,X+=y*z,X+=A*T,X+=P*J,X+=N*K,F=X>>>13,X&=8191,X+=D*(5*f),X+=k*(5*m),X+=B*(5*E),X+=j*(5*G),X+=U*(5*_e),F+=X>>>13,X&=8191;var Q=F;Q+=p*_e,Q+=y*ue,Q+=A*z,Q+=P*T,Q+=N*J,F=Q>>>13,Q&=8191,Q+=D*K,Q+=k*(5*f),Q+=B*(5*m),Q+=j*(5*E),Q+=U*(5*G),F+=Q>>>13,Q&=8191;var R=F;R+=p*G,R+=y*_e,R+=A*ue,R+=P*z,R+=N*T,F=R>>>13,R&=8191,R+=D*J,R+=k*K,R+=B*(5*f),R+=j*(5*m),R+=U*(5*E),F+=R>>>13,R&=8191;var Z=F;Z+=p*E,Z+=y*G,Z+=A*_e,Z+=P*ue,Z+=N*z,F=Z>>>13,Z&=8191,Z+=D*T,Z+=k*J,Z+=B*K,Z+=j*(5*f),Z+=U*(5*m),F+=Z>>>13,Z&=8191;var te=F;te+=p*m,te+=y*E,te+=A*G,te+=P*_e,te+=N*ue,F=te>>>13,te&=8191,te+=D*z,te+=k*T,te+=B*J,te+=j*K,te+=U*(5*f),F+=te>>>13,te&=8191;var le=F;le+=p*f,le+=y*m,le+=A*E,le+=P*G,le+=N*_e,F=le>>>13,le&=8191,le+=D*ue,le+=k*z,le+=B*T,le+=j*J,le+=U*K,F+=le>>>13,le&=8191,F=(F<<2)+F|0,F=F+ae|0,ae=F&8191,F=F>>>13,O+=F,p=ae,y=O,A=se,P=ee,N=X,D=Q,k=R,B=Z,j=te,U=le,u+=16,l-=16}this._h[0]=p,this._h[1]=y,this._h[2]=A,this._h[3]=P,this._h[4]=N,this._h[5]=D,this._h[6]=k,this._h[7]=B,this._h[8]=j,this._h[9]=U},o.prototype.finish=function(a,u){u===void 0&&(u=0);var l=new Uint16Array(10),d,p,y,A;if(this._leftover){for(A=this._leftover,this._buffer[A++]=1;A<16;A++)this._buffer[A]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(d=this._h[1]>>>13,this._h[1]&=8191,A=2;A<10;A++)this._h[A]+=d,d=this._h[A]>>>13,this._h[A]&=8191;for(this._h[0]+=d*5,d=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=d,d=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=d,l[0]=this._h[0]+5,d=l[0]>>>13,l[0]&=8191,A=1;A<10;A++)l[A]=this._h[A]+d,d=l[A]>>>13,l[A]&=8191;for(l[9]-=8192,p=(d^1)-1,A=0;A<10;A++)l[A]&=p;for(p=~p,A=0;A<10;A++)this._h[A]=this._h[A]&p|l[A];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,y=this._h[0]+this._pad[0],this._h[0]=y&65535,A=1;A<8;A++)y=(this._h[A]+this._pad[A]|0)+(y>>>16)|0,this._h[A]=y&65535;return a[u+0]=this._h[0]>>>0,a[u+1]=this._h[0]>>>8,a[u+2]=this._h[1]>>>0,a[u+3]=this._h[1]>>>8,a[u+4]=this._h[2]>>>0,a[u+5]=this._h[2]>>>8,a[u+6]=this._h[3]>>>0,a[u+7]=this._h[3]>>>8,a[u+8]=this._h[4]>>>0,a[u+9]=this._h[4]>>>8,a[u+10]=this._h[5]>>>0,a[u+11]=this._h[5]>>>8,a[u+12]=this._h[6]>>>0,a[u+13]=this._h[6]>>>8,a[u+14]=this._h[7]>>>0,a[u+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var u=0,l=a.length,d;if(this._leftover){d=16-this._leftover,d>l&&(d=l);for(var p=0;p=16&&(d=l-l%16,this._blocks(a,u,d),u+=d,l-=d),l){for(var p=0;p16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var A=new Uint8Array(16);A.set(l,A.length-l.length);var P=new Uint8Array(32);e.stream(this._key,A,P,4);var N=d.length+this.tagLength,D;if(y){if(y.length!==N)throw new Error("ChaCha20Poly1305: incorrect destination length");D=y}else D=new Uint8Array(N);return e.streamXOR(this._key,A,d,D,4),this._authenticate(D.subarray(D.length-this.tagLength,D.length),P,D.subarray(0,D.length-this.tagLength),p),n.wipe(A),D},u.prototype.open=function(l,d,p,y){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(d.length0&&A.update(o.subarray(y.length%16))),A.update(p),p.length%16>0&&A.update(o.subarray(p.length%16));var P=new Uint8Array(8);y&&i.writeUint64LE(y.length,P),A.update(P),i.writeUint64LE(p.length,P),A.update(P);for(var N=A.digest(),D=0;Dthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._temp,this._state,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,A=l%64<56?64:128;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._state.set(u.state),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.state),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,u,l,d,p){for(;p>=64;){for(var y=u[0],A=u[1],P=u[2],N=u[3],D=u[4],k=u[5],B=u[6],j=u[7],U=0;U<16;U++){var K=d+U*4;a[U]=e.readUint32BE(l,K)}for(var U=16;U<64;U++){var J=a[U-2],T=(J>>>17|J<<15)^(J>>>19|J<<13)^J>>>10;J=a[U-15];var z=(J>>>7|J<<25)^(J>>>18|J<<14)^J>>>3;a[U]=(T+a[U-7]|0)+(z+a[U-16]|0)}for(var U=0;U<64;U++){var T=(((D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7))+(D&k^~D&B)|0)+(j+(i[U]+a[U]|0)|0)|0,z=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&A^y&P^A&P)|0;j=B,B=k,k=D,D=N+T|0,N=P,P=A,A=y,y=T+z|0}u[0]+=y,u[1]+=A,u[2]+=P,u[3]+=N,u[4]+=D,u[5]+=k,u[6]+=B,u[7]+=j,d+=64,p-=64}return d}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ll);var Hm={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=ta,r=Mi;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(U){const K=new Float64Array(16);if(U)for(let J=0;J>16&1),J[_e-1]&=65535;J[15]=T[15]-32767-(J[14]>>16&1);const ue=J[15]>>16&1;J[14]&=65535,a(T,J,1-ue)}for(let z=0;z<16;z++)U[2*z]=T[z]&255,U[2*z+1]=T[z]>>8}function l(U,K){for(let J=0;J<16;J++)U[J]=K[2*J]+(K[2*J+1]<<8);U[15]&=32767}function d(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]+J[T]}function p(U,K,J){for(let T=0;T<16;T++)U[T]=K[T]-J[T]}function y(U,K,J){let T,z,ue=0,_e=0,G=0,E=0,m=0,f=0,g=0,v=0,x=0,_=0,S=0,b=0,M=0,I=0,F=0,ae=0,O=0,se=0,ee=0,X=0,Q=0,R=0,Z=0,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=J[0],Ie=J[1],Le=J[2],Ve=J[3],ke=J[4],ze=J[5],He=J[6],Ee=J[7],Qe=J[8],ct=J[9],Be=J[10],et=J[11],rt=J[12],Je=J[13],pt=J[14],ht=J[15];T=K[0],ue+=T*$e,_e+=T*Ie,G+=T*Le,E+=T*Ve,m+=T*ke,f+=T*ze,g+=T*He,v+=T*Ee,x+=T*Qe,_+=T*ct,S+=T*Be,b+=T*et,M+=T*rt,I+=T*Je,F+=T*pt,ae+=T*ht,T=K[1],_e+=T*$e,G+=T*Ie,E+=T*Le,m+=T*Ve,f+=T*ke,g+=T*ze,v+=T*He,x+=T*Ee,_+=T*Qe,S+=T*ct,b+=T*Be,M+=T*et,I+=T*rt,F+=T*Je,ae+=T*pt,O+=T*ht,T=K[2],G+=T*$e,E+=T*Ie,m+=T*Le,f+=T*Ve,g+=T*ke,v+=T*ze,x+=T*He,_+=T*Ee,S+=T*Qe,b+=T*ct,M+=T*Be,I+=T*et,F+=T*rt,ae+=T*Je,O+=T*pt,se+=T*ht,T=K[3],E+=T*$e,m+=T*Ie,f+=T*Le,g+=T*Ve,v+=T*ke,x+=T*ze,_+=T*He,S+=T*Ee,b+=T*Qe,M+=T*ct,I+=T*Be,F+=T*et,ae+=T*rt,O+=T*Je,se+=T*pt,ee+=T*ht,T=K[4],m+=T*$e,f+=T*Ie,g+=T*Le,v+=T*Ve,x+=T*ke,_+=T*ze,S+=T*He,b+=T*Ee,M+=T*Qe,I+=T*ct,F+=T*Be,ae+=T*et,O+=T*rt,se+=T*Je,ee+=T*pt,X+=T*ht,T=K[5],f+=T*$e,g+=T*Ie,v+=T*Le,x+=T*Ve,_+=T*ke,S+=T*ze,b+=T*He,M+=T*Ee,I+=T*Qe,F+=T*ct,ae+=T*Be,O+=T*et,se+=T*rt,ee+=T*Je,X+=T*pt,Q+=T*ht,T=K[6],g+=T*$e,v+=T*Ie,x+=T*Le,_+=T*Ve,S+=T*ke,b+=T*ze,M+=T*He,I+=T*Ee,F+=T*Qe,ae+=T*ct,O+=T*Be,se+=T*et,ee+=T*rt,X+=T*Je,Q+=T*pt,R+=T*ht,T=K[7],v+=T*$e,x+=T*Ie,_+=T*Le,S+=T*Ve,b+=T*ke,M+=T*ze,I+=T*He,F+=T*Ee,ae+=T*Qe,O+=T*ct,se+=T*Be,ee+=T*et,X+=T*rt,Q+=T*Je,R+=T*pt,Z+=T*ht,T=K[8],x+=T*$e,_+=T*Ie,S+=T*Le,b+=T*Ve,M+=T*ke,I+=T*ze,F+=T*He,ae+=T*Ee,O+=T*Qe,se+=T*ct,ee+=T*Be,X+=T*et,Q+=T*rt,R+=T*Je,Z+=T*pt,te+=T*ht,T=K[9],_+=T*$e,S+=T*Ie,b+=T*Le,M+=T*Ve,I+=T*ke,F+=T*ze,ae+=T*He,O+=T*Ee,se+=T*Qe,ee+=T*ct,X+=T*Be,Q+=T*et,R+=T*rt,Z+=T*Je,te+=T*pt,le+=T*ht,T=K[10],S+=T*$e,b+=T*Ie,M+=T*Le,I+=T*Ve,F+=T*ke,ae+=T*ze,O+=T*He,se+=T*Ee,ee+=T*Qe,X+=T*ct,Q+=T*Be,R+=T*et,Z+=T*rt,te+=T*Je,le+=T*pt,ie+=T*ht,T=K[11],b+=T*$e,M+=T*Ie,I+=T*Le,F+=T*Ve,ae+=T*ke,O+=T*ze,se+=T*He,ee+=T*Ee,X+=T*Qe,Q+=T*ct,R+=T*Be,Z+=T*et,te+=T*rt,le+=T*Je,ie+=T*pt,fe+=T*ht,T=K[12],M+=T*$e,I+=T*Ie,F+=T*Le,ae+=T*Ve,O+=T*ke,se+=T*ze,ee+=T*He,X+=T*Ee,Q+=T*Qe,R+=T*ct,Z+=T*Be,te+=T*et,le+=T*rt,ie+=T*Je,fe+=T*pt,ve+=T*ht,T=K[13],I+=T*$e,F+=T*Ie,ae+=T*Le,O+=T*Ve,se+=T*ke,ee+=T*ze,X+=T*He,Q+=T*Ee,R+=T*Qe,Z+=T*ct,te+=T*Be,le+=T*et,ie+=T*rt,fe+=T*Je,ve+=T*pt,Me+=T*ht,T=K[14],F+=T*$e,ae+=T*Ie,O+=T*Le,se+=T*Ve,ee+=T*ke,X+=T*ze,Q+=T*He,R+=T*Ee,Z+=T*Qe,te+=T*ct,le+=T*Be,ie+=T*et,fe+=T*rt,ve+=T*Je,Me+=T*pt,Ne+=T*ht,T=K[15],ae+=T*$e,O+=T*Ie,se+=T*Le,ee+=T*Ve,X+=T*ke,Q+=T*ze,R+=T*He,Z+=T*Ee,te+=T*Qe,le+=T*ct,ie+=T*Be,fe+=T*et,ve+=T*rt,Me+=T*Je,Ne+=T*pt,Te+=T*ht,ue+=38*O,_e+=38*se,G+=38*ee,E+=38*X,m+=38*Q,f+=38*R,g+=38*Z,v+=38*te,x+=38*le,_+=38*ie,S+=38*fe,b+=38*ve,M+=38*Me,I+=38*Ne,F+=38*Te,z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=g+z+65535,z=Math.floor(T/65536),g=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=g+z+65535,z=Math.floor(T/65536),g=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),U[0]=ue,U[1]=_e,U[2]=G,U[3]=E,U[4]=m,U[5]=f,U[6]=g,U[7]=v,U[8]=x,U[9]=_,U[10]=S,U[11]=b,U[12]=M,U[13]=I,U[14]=F,U[15]=ae}function A(U,K){y(U,K,K)}function P(U,K){const J=n();for(let T=0;T<16;T++)J[T]=K[T];for(let T=253;T>=0;T--)A(J,J),T!==2&&T!==4&&y(J,J,K);for(let T=0;T<16;T++)U[T]=J[T]}function N(U,K){const J=new Uint8Array(32),T=new Float64Array(80),z=n(),ue=n(),_e=n(),G=n(),E=n(),m=n();for(let x=0;x<31;x++)J[x]=U[x];J[31]=U[31]&127|64,J[0]&=248,l(T,K);for(let x=0;x<16;x++)ue[x]=T[x];z[0]=G[0]=1;for(let x=254;x>=0;--x){const _=J[x>>>3]>>>(x&7)&1;a(z,ue,_),a(_e,G,_),d(E,z,_e),p(z,z,_e),d(_e,ue,G),p(ue,ue,G),A(G,E),A(m,z),y(z,_e,z),y(_e,ue,E),d(E,z,_e),p(z,z,_e),A(ue,z),p(_e,G,m),y(z,_e,s),d(z,z,G),y(_e,_e,z),y(z,G,m),y(G,ue,T),A(ue,E),a(z,ue,_),a(_e,G,_)}for(let x=0;x<16;x++)T[x+16]=z[x],T[x+32]=_e[x],T[x+48]=ue[x],T[x+64]=G[x];const f=T.subarray(32),g=T.subarray(16);P(f,f),y(g,g,f);const v=new Uint8Array(32);return u(v,g),v}t.scalarMult=N;function D(U){return N(U,i)}t.scalarMultBase=D;function k(U){if(U.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const K=new Uint8Array(U);return{publicKey:D(K),secretKey:K}}t.generateKeyPairFromSeed=k;function B(U){const K=(0,e.randomBytes)(32,U),J=k(K);return(0,r.wipe)(K),J}t.generateKeyPair=B;function j(U,K,J=!1){if(U.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(K.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const T=N(U,K);if(J){let z=0;for(let ue=0;ue",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}};var Ti={},Wm={exports:{}};Wm.exports,function(t){(function(e,r){function n(G,E){if(!G)throw new Error(E||"Assertion failed")}function i(G,E){G.super_=E;var m=function(){};m.prototype=E.prototype,G.prototype=new m,G.prototype.constructor=G}function s(G,E,m){if(s.isBN(G))return G;this.negative=0,this.words=null,this.length=0,this.red=null,G!==null&&((E==="le"||E==="be")&&(m=E,E=10),this._init(G||0,E||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(E){return E instanceof s?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===s.wordSize&&Array.isArray(E.words)},s.max=function(E,m){return E.cmp(m)>0?E:m},s.min=function(E,m){return E.cmp(m)<0?E:m},s.prototype._init=function(E,m,f){if(typeof E=="number")return this._initNumber(E,m,f);if(typeof E=="object")return this._initArray(E,m,f);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),E=E.toString().replace(/\s+/g,"");var g=0;E[0]==="-"&&(g++,this.negative=1),g=0;g-=3)x=E[g]|E[g-1]<<8|E[g-2]<<16,this.words[v]|=x<<_&67108863,this.words[v+1]=x>>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);else if(f==="le")for(g=0,v=0;g>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);return this.strip()};function a(G,E){var m=G.charCodeAt(E);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function u(G,E,m){var f=a(G,m);return m-1>=E&&(f|=a(G,m-1)<<4),f}s.prototype._parseHex=function(E,m,f){this.length=Math.ceil((E.length-m)/6),this.words=new Array(this.length);for(var g=0;g=m;g-=2)_=u(E,m,g)<=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8;else{var S=E.length-m;for(g=S%2===0?m+1:m;g=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8}this.strip()};function l(G,E,m,f){for(var g=0,v=Math.min(G.length,m),x=E;x=49?g+=_-49+10:_>=17?g+=_-17+10:g+=_}return g}s.prototype._parseBase=function(E,m,f){this.words=[0],this.length=1;for(var g=0,v=1;v<=67108863;v*=m)g++;g--,v=v/m|0;for(var x=E.length-f,_=x%g,S=Math.min(x,x-_)+f,b=0,M=f;M1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var d=["","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"],p=[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],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(E,m){E=E||10,m=m|0||1;var f;if(E===16||E==="hex"){f="";for(var g=0,v=0,x=0;x>>24-g&16777215,g+=2,g>=26&&(g-=26,x--),v!==0||x!==this.length-1?f=d[6-S.length]+S+f:f=S+f}for(v!==0&&(f=v.toString(16)+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(E===(E|0)&&E>=2&&E<=36){var b=p[E],M=y[E];f="";var I=this.clone();for(I.negative=0;!I.isZero();){var F=I.modn(M).toString(E);I=I.idivn(M),I.isZero()?f=F+f:f=d[b-F.length]+F+f}for(this.isZero()&&(f="0"+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(E,m){return n(typeof o<"u"),this.toArrayLike(o,E,m)},s.prototype.toArray=function(E,m){return this.toArrayLike(Array,E,m)},s.prototype.toArrayLike=function(E,m,f){var g=this.byteLength(),v=f||Math.max(1,g);n(g<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var x=m==="le",_=new E(v),S,b,M=this.clone();if(x){for(b=0;!M.isZero();b++)S=M.andln(255),M.iushrn(8),_[b]=S;for(;b=4096&&(f+=13,m>>>=13),m>=64&&(f+=7,m>>>=7),m>=8&&(f+=4,m>>>=4),m>=2&&(f+=2,m>>>=2),f+m},s.prototype._zeroBits=function(E){if(E===0)return 26;var m=E,f=0;return m&8191||(f+=13,m>>>=13),m&127||(f+=7,m>>>=7),m&15||(f+=4,m>>>=4),m&3||(f+=2,m>>>=2),m&1||f++,f},s.prototype.bitLength=function(){var E=this.words[this.length-1],m=this._countBits(E);return(this.length-1)*26+m};function A(G){for(var E=new Array(G.bitLength()),m=0;m>>g}return E}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,m=0;mE.length?this.clone().ior(E):E.clone().ior(this)},s.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},s.prototype.iuand=function(E){var m;this.length>E.length?m=E:m=this;for(var f=0;fE.length?this.clone().iand(E):E.clone().iand(this)},s.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},s.prototype.iuxor=function(E){var m,f;this.length>E.length?(m=this,f=E):(m=E,f=this);for(var g=0;gE.length?this.clone().ixor(E):E.clone().ixor(this)},s.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},s.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var m=Math.ceil(E/26)|0,f=E%26;this._expand(m),f>0&&m--;for(var g=0;g0&&(this.words[g]=~this.words[g]&67108863>>26-f),this.strip()},s.prototype.notn=function(E){return this.clone().inotn(E)},s.prototype.setn=function(E,m){n(typeof E=="number"&&E>=0);var f=E/26|0,g=E%26;return this._expand(f+1),m?this.words[f]=this.words[f]|1<E.length?(f=this,g=E):(f=E,g=this);for(var v=0,x=0;x>>26;for(;v!==0&&x>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;xE.length?this.clone().iadd(E):E.clone().iadd(this)},s.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var m=this.iadd(E);return E.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var f=this.cmp(E);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var g,v;f>0?(g=this,v=E):(g=E,v=this);for(var x=0,_=0;_>26,this.words[_]=m&67108863;for(;x!==0&&_>26,this.words[_]=m&67108863;if(x===0&&_>>26,I=S&67108863,F=Math.min(b,E.length-1),ae=Math.max(0,b-G.length+1);ae<=F;ae++){var O=b-ae|0;g=G.words[O]|0,v=E.words[ae]|0,x=g*v+I,M+=x/67108864|0,I=x&67108863}m.words[b]=I|0,S=M|0}return S!==0?m.words[b]=S|0:m.length--,m.strip()}var N=function(E,m,f){var g=E.words,v=m.words,x=f.words,_=0,S,b,M,I=g[0]|0,F=I&8191,ae=I>>>13,O=g[1]|0,se=O&8191,ee=O>>>13,X=g[2]|0,Q=X&8191,R=X>>>13,Z=g[3]|0,te=Z&8191,le=Z>>>13,ie=g[4]|0,fe=ie&8191,ve=ie>>>13,Me=g[5]|0,Ne=Me&8191,Te=Me>>>13,$e=g[6]|0,Ie=$e&8191,Le=$e>>>13,Ve=g[7]|0,ke=Ve&8191,ze=Ve>>>13,He=g[8]|0,Ee=He&8191,Qe=He>>>13,ct=g[9]|0,Be=ct&8191,et=ct>>>13,rt=v[0]|0,Je=rt&8191,pt=rt>>>13,ht=v[1]|0,ft=ht&8191,Ht=ht>>>13,Jt=v[2]|0,St=Jt&8191,er=Jt>>>13,Xt=v[3]|0,Ot=Xt&8191,Bt=Xt>>>13,Tt=v[4]|0,vt=Tt&8191,Dt=Tt>>>13,Lt=v[5]|0,bt=Lt&8191,$t=Lt>>>13,jt=v[6]|0,nt=jt&8191,Ft=jt>>>13,$=v[7]|0,H=$&8191,V=$>>>13,C=v[8]|0,Y=C&8191,q=C>>>13,oe=v[9]|0,pe=oe&8191,xe=oe>>>13;f.negative=E.negative^m.negative,f.length=19,S=Math.imul(F,Je),b=Math.imul(F,pt),b=b+Math.imul(ae,Je)|0,M=Math.imul(ae,pt);var Re=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Re>>>26)|0,Re&=67108863,S=Math.imul(se,Je),b=Math.imul(se,pt),b=b+Math.imul(ee,Je)|0,M=Math.imul(ee,pt),S=S+Math.imul(F,ft)|0,b=b+Math.imul(F,Ht)|0,b=b+Math.imul(ae,ft)|0,M=M+Math.imul(ae,Ht)|0;var De=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(De>>>26)|0,De&=67108863,S=Math.imul(Q,Je),b=Math.imul(Q,pt),b=b+Math.imul(R,Je)|0,M=Math.imul(R,pt),S=S+Math.imul(se,ft)|0,b=b+Math.imul(se,Ht)|0,b=b+Math.imul(ee,ft)|0,M=M+Math.imul(ee,Ht)|0,S=S+Math.imul(F,St)|0,b=b+Math.imul(F,er)|0,b=b+Math.imul(ae,St)|0,M=M+Math.imul(ae,er)|0;var it=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(it>>>26)|0,it&=67108863,S=Math.imul(te,Je),b=Math.imul(te,pt),b=b+Math.imul(le,Je)|0,M=Math.imul(le,pt),S=S+Math.imul(Q,ft)|0,b=b+Math.imul(Q,Ht)|0,b=b+Math.imul(R,ft)|0,M=M+Math.imul(R,Ht)|0,S=S+Math.imul(se,St)|0,b=b+Math.imul(se,er)|0,b=b+Math.imul(ee,St)|0,M=M+Math.imul(ee,er)|0,S=S+Math.imul(F,Ot)|0,b=b+Math.imul(F,Bt)|0,b=b+Math.imul(ae,Ot)|0,M=M+Math.imul(ae,Bt)|0;var Ue=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,S=Math.imul(fe,Je),b=Math.imul(fe,pt),b=b+Math.imul(ve,Je)|0,M=Math.imul(ve,pt),S=S+Math.imul(te,ft)|0,b=b+Math.imul(te,Ht)|0,b=b+Math.imul(le,ft)|0,M=M+Math.imul(le,Ht)|0,S=S+Math.imul(Q,St)|0,b=b+Math.imul(Q,er)|0,b=b+Math.imul(R,St)|0,M=M+Math.imul(R,er)|0,S=S+Math.imul(se,Ot)|0,b=b+Math.imul(se,Bt)|0,b=b+Math.imul(ee,Ot)|0,M=M+Math.imul(ee,Bt)|0,S=S+Math.imul(F,vt)|0,b=b+Math.imul(F,Dt)|0,b=b+Math.imul(ae,vt)|0,M=M+Math.imul(ae,Dt)|0;var gt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(gt>>>26)|0,gt&=67108863,S=Math.imul(Ne,Je),b=Math.imul(Ne,pt),b=b+Math.imul(Te,Je)|0,M=Math.imul(Te,pt),S=S+Math.imul(fe,ft)|0,b=b+Math.imul(fe,Ht)|0,b=b+Math.imul(ve,ft)|0,M=M+Math.imul(ve,Ht)|0,S=S+Math.imul(te,St)|0,b=b+Math.imul(te,er)|0,b=b+Math.imul(le,St)|0,M=M+Math.imul(le,er)|0,S=S+Math.imul(Q,Ot)|0,b=b+Math.imul(Q,Bt)|0,b=b+Math.imul(R,Ot)|0,M=M+Math.imul(R,Bt)|0,S=S+Math.imul(se,vt)|0,b=b+Math.imul(se,Dt)|0,b=b+Math.imul(ee,vt)|0,M=M+Math.imul(ee,Dt)|0,S=S+Math.imul(F,bt)|0,b=b+Math.imul(F,$t)|0,b=b+Math.imul(ae,bt)|0,M=M+Math.imul(ae,$t)|0;var st=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(st>>>26)|0,st&=67108863,S=Math.imul(Ie,Je),b=Math.imul(Ie,pt),b=b+Math.imul(Le,Je)|0,M=Math.imul(Le,pt),S=S+Math.imul(Ne,ft)|0,b=b+Math.imul(Ne,Ht)|0,b=b+Math.imul(Te,ft)|0,M=M+Math.imul(Te,Ht)|0,S=S+Math.imul(fe,St)|0,b=b+Math.imul(fe,er)|0,b=b+Math.imul(ve,St)|0,M=M+Math.imul(ve,er)|0,S=S+Math.imul(te,Ot)|0,b=b+Math.imul(te,Bt)|0,b=b+Math.imul(le,Ot)|0,M=M+Math.imul(le,Bt)|0,S=S+Math.imul(Q,vt)|0,b=b+Math.imul(Q,Dt)|0,b=b+Math.imul(R,vt)|0,M=M+Math.imul(R,Dt)|0,S=S+Math.imul(se,bt)|0,b=b+Math.imul(se,$t)|0,b=b+Math.imul(ee,bt)|0,M=M+Math.imul(ee,$t)|0,S=S+Math.imul(F,nt)|0,b=b+Math.imul(F,Ft)|0,b=b+Math.imul(ae,nt)|0,M=M+Math.imul(ae,Ft)|0;var tt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(tt>>>26)|0,tt&=67108863,S=Math.imul(ke,Je),b=Math.imul(ke,pt),b=b+Math.imul(ze,Je)|0,M=Math.imul(ze,pt),S=S+Math.imul(Ie,ft)|0,b=b+Math.imul(Ie,Ht)|0,b=b+Math.imul(Le,ft)|0,M=M+Math.imul(Le,Ht)|0,S=S+Math.imul(Ne,St)|0,b=b+Math.imul(Ne,er)|0,b=b+Math.imul(Te,St)|0,M=M+Math.imul(Te,er)|0,S=S+Math.imul(fe,Ot)|0,b=b+Math.imul(fe,Bt)|0,b=b+Math.imul(ve,Ot)|0,M=M+Math.imul(ve,Bt)|0,S=S+Math.imul(te,vt)|0,b=b+Math.imul(te,Dt)|0,b=b+Math.imul(le,vt)|0,M=M+Math.imul(le,Dt)|0,S=S+Math.imul(Q,bt)|0,b=b+Math.imul(Q,$t)|0,b=b+Math.imul(R,bt)|0,M=M+Math.imul(R,$t)|0,S=S+Math.imul(se,nt)|0,b=b+Math.imul(se,Ft)|0,b=b+Math.imul(ee,nt)|0,M=M+Math.imul(ee,Ft)|0,S=S+Math.imul(F,H)|0,b=b+Math.imul(F,V)|0,b=b+Math.imul(ae,H)|0,M=M+Math.imul(ae,V)|0;var At=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(At>>>26)|0,At&=67108863,S=Math.imul(Ee,Je),b=Math.imul(Ee,pt),b=b+Math.imul(Qe,Je)|0,M=Math.imul(Qe,pt),S=S+Math.imul(ke,ft)|0,b=b+Math.imul(ke,Ht)|0,b=b+Math.imul(ze,ft)|0,M=M+Math.imul(ze,Ht)|0,S=S+Math.imul(Ie,St)|0,b=b+Math.imul(Ie,er)|0,b=b+Math.imul(Le,St)|0,M=M+Math.imul(Le,er)|0,S=S+Math.imul(Ne,Ot)|0,b=b+Math.imul(Ne,Bt)|0,b=b+Math.imul(Te,Ot)|0,M=M+Math.imul(Te,Bt)|0,S=S+Math.imul(fe,vt)|0,b=b+Math.imul(fe,Dt)|0,b=b+Math.imul(ve,vt)|0,M=M+Math.imul(ve,Dt)|0,S=S+Math.imul(te,bt)|0,b=b+Math.imul(te,$t)|0,b=b+Math.imul(le,bt)|0,M=M+Math.imul(le,$t)|0,S=S+Math.imul(Q,nt)|0,b=b+Math.imul(Q,Ft)|0,b=b+Math.imul(R,nt)|0,M=M+Math.imul(R,Ft)|0,S=S+Math.imul(se,H)|0,b=b+Math.imul(se,V)|0,b=b+Math.imul(ee,H)|0,M=M+Math.imul(ee,V)|0,S=S+Math.imul(F,Y)|0,b=b+Math.imul(F,q)|0,b=b+Math.imul(ae,Y)|0,M=M+Math.imul(ae,q)|0;var Rt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,S=Math.imul(Be,Je),b=Math.imul(Be,pt),b=b+Math.imul(et,Je)|0,M=Math.imul(et,pt),S=S+Math.imul(Ee,ft)|0,b=b+Math.imul(Ee,Ht)|0,b=b+Math.imul(Qe,ft)|0,M=M+Math.imul(Qe,Ht)|0,S=S+Math.imul(ke,St)|0,b=b+Math.imul(ke,er)|0,b=b+Math.imul(ze,St)|0,M=M+Math.imul(ze,er)|0,S=S+Math.imul(Ie,Ot)|0,b=b+Math.imul(Ie,Bt)|0,b=b+Math.imul(Le,Ot)|0,M=M+Math.imul(Le,Bt)|0,S=S+Math.imul(Ne,vt)|0,b=b+Math.imul(Ne,Dt)|0,b=b+Math.imul(Te,vt)|0,M=M+Math.imul(Te,Dt)|0,S=S+Math.imul(fe,bt)|0,b=b+Math.imul(fe,$t)|0,b=b+Math.imul(ve,bt)|0,M=M+Math.imul(ve,$t)|0,S=S+Math.imul(te,nt)|0,b=b+Math.imul(te,Ft)|0,b=b+Math.imul(le,nt)|0,M=M+Math.imul(le,Ft)|0,S=S+Math.imul(Q,H)|0,b=b+Math.imul(Q,V)|0,b=b+Math.imul(R,H)|0,M=M+Math.imul(R,V)|0,S=S+Math.imul(se,Y)|0,b=b+Math.imul(se,q)|0,b=b+Math.imul(ee,Y)|0,M=M+Math.imul(ee,q)|0,S=S+Math.imul(F,pe)|0,b=b+Math.imul(F,xe)|0,b=b+Math.imul(ae,pe)|0,M=M+Math.imul(ae,xe)|0;var Mt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,S=Math.imul(Be,ft),b=Math.imul(Be,Ht),b=b+Math.imul(et,ft)|0,M=Math.imul(et,Ht),S=S+Math.imul(Ee,St)|0,b=b+Math.imul(Ee,er)|0,b=b+Math.imul(Qe,St)|0,M=M+Math.imul(Qe,er)|0,S=S+Math.imul(ke,Ot)|0,b=b+Math.imul(ke,Bt)|0,b=b+Math.imul(ze,Ot)|0,M=M+Math.imul(ze,Bt)|0,S=S+Math.imul(Ie,vt)|0,b=b+Math.imul(Ie,Dt)|0,b=b+Math.imul(Le,vt)|0,M=M+Math.imul(Le,Dt)|0,S=S+Math.imul(Ne,bt)|0,b=b+Math.imul(Ne,$t)|0,b=b+Math.imul(Te,bt)|0,M=M+Math.imul(Te,$t)|0,S=S+Math.imul(fe,nt)|0,b=b+Math.imul(fe,Ft)|0,b=b+Math.imul(ve,nt)|0,M=M+Math.imul(ve,Ft)|0,S=S+Math.imul(te,H)|0,b=b+Math.imul(te,V)|0,b=b+Math.imul(le,H)|0,M=M+Math.imul(le,V)|0,S=S+Math.imul(Q,Y)|0,b=b+Math.imul(Q,q)|0,b=b+Math.imul(R,Y)|0,M=M+Math.imul(R,q)|0,S=S+Math.imul(se,pe)|0,b=b+Math.imul(se,xe)|0,b=b+Math.imul(ee,pe)|0,M=M+Math.imul(ee,xe)|0;var Et=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Et>>>26)|0,Et&=67108863,S=Math.imul(Be,St),b=Math.imul(Be,er),b=b+Math.imul(et,St)|0,M=Math.imul(et,er),S=S+Math.imul(Ee,Ot)|0,b=b+Math.imul(Ee,Bt)|0,b=b+Math.imul(Qe,Ot)|0,M=M+Math.imul(Qe,Bt)|0,S=S+Math.imul(ke,vt)|0,b=b+Math.imul(ke,Dt)|0,b=b+Math.imul(ze,vt)|0,M=M+Math.imul(ze,Dt)|0,S=S+Math.imul(Ie,bt)|0,b=b+Math.imul(Ie,$t)|0,b=b+Math.imul(Le,bt)|0,M=M+Math.imul(Le,$t)|0,S=S+Math.imul(Ne,nt)|0,b=b+Math.imul(Ne,Ft)|0,b=b+Math.imul(Te,nt)|0,M=M+Math.imul(Te,Ft)|0,S=S+Math.imul(fe,H)|0,b=b+Math.imul(fe,V)|0,b=b+Math.imul(ve,H)|0,M=M+Math.imul(ve,V)|0,S=S+Math.imul(te,Y)|0,b=b+Math.imul(te,q)|0,b=b+Math.imul(le,Y)|0,M=M+Math.imul(le,q)|0,S=S+Math.imul(Q,pe)|0,b=b+Math.imul(Q,xe)|0,b=b+Math.imul(R,pe)|0,M=M+Math.imul(R,xe)|0;var dt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(dt>>>26)|0,dt&=67108863,S=Math.imul(Be,Ot),b=Math.imul(Be,Bt),b=b+Math.imul(et,Ot)|0,M=Math.imul(et,Bt),S=S+Math.imul(Ee,vt)|0,b=b+Math.imul(Ee,Dt)|0,b=b+Math.imul(Qe,vt)|0,M=M+Math.imul(Qe,Dt)|0,S=S+Math.imul(ke,bt)|0,b=b+Math.imul(ke,$t)|0,b=b+Math.imul(ze,bt)|0,M=M+Math.imul(ze,$t)|0,S=S+Math.imul(Ie,nt)|0,b=b+Math.imul(Ie,Ft)|0,b=b+Math.imul(Le,nt)|0,M=M+Math.imul(Le,Ft)|0,S=S+Math.imul(Ne,H)|0,b=b+Math.imul(Ne,V)|0,b=b+Math.imul(Te,H)|0,M=M+Math.imul(Te,V)|0,S=S+Math.imul(fe,Y)|0,b=b+Math.imul(fe,q)|0,b=b+Math.imul(ve,Y)|0,M=M+Math.imul(ve,q)|0,S=S+Math.imul(te,pe)|0,b=b+Math.imul(te,xe)|0,b=b+Math.imul(le,pe)|0,M=M+Math.imul(le,xe)|0;var _t=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(_t>>>26)|0,_t&=67108863,S=Math.imul(Be,vt),b=Math.imul(Be,Dt),b=b+Math.imul(et,vt)|0,M=Math.imul(et,Dt),S=S+Math.imul(Ee,bt)|0,b=b+Math.imul(Ee,$t)|0,b=b+Math.imul(Qe,bt)|0,M=M+Math.imul(Qe,$t)|0,S=S+Math.imul(ke,nt)|0,b=b+Math.imul(ke,Ft)|0,b=b+Math.imul(ze,nt)|0,M=M+Math.imul(ze,Ft)|0,S=S+Math.imul(Ie,H)|0,b=b+Math.imul(Ie,V)|0,b=b+Math.imul(Le,H)|0,M=M+Math.imul(Le,V)|0,S=S+Math.imul(Ne,Y)|0,b=b+Math.imul(Ne,q)|0,b=b+Math.imul(Te,Y)|0,M=M+Math.imul(Te,q)|0,S=S+Math.imul(fe,pe)|0,b=b+Math.imul(fe,xe)|0,b=b+Math.imul(ve,pe)|0,M=M+Math.imul(ve,xe)|0;var ot=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(ot>>>26)|0,ot&=67108863,S=Math.imul(Be,bt),b=Math.imul(Be,$t),b=b+Math.imul(et,bt)|0,M=Math.imul(et,$t),S=S+Math.imul(Ee,nt)|0,b=b+Math.imul(Ee,Ft)|0,b=b+Math.imul(Qe,nt)|0,M=M+Math.imul(Qe,Ft)|0,S=S+Math.imul(ke,H)|0,b=b+Math.imul(ke,V)|0,b=b+Math.imul(ze,H)|0,M=M+Math.imul(ze,V)|0,S=S+Math.imul(Ie,Y)|0,b=b+Math.imul(Ie,q)|0,b=b+Math.imul(Le,Y)|0,M=M+Math.imul(Le,q)|0,S=S+Math.imul(Ne,pe)|0,b=b+Math.imul(Ne,xe)|0,b=b+Math.imul(Te,pe)|0,M=M+Math.imul(Te,xe)|0;var wt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(wt>>>26)|0,wt&=67108863,S=Math.imul(Be,nt),b=Math.imul(Be,Ft),b=b+Math.imul(et,nt)|0,M=Math.imul(et,Ft),S=S+Math.imul(Ee,H)|0,b=b+Math.imul(Ee,V)|0,b=b+Math.imul(Qe,H)|0,M=M+Math.imul(Qe,V)|0,S=S+Math.imul(ke,Y)|0,b=b+Math.imul(ke,q)|0,b=b+Math.imul(ze,Y)|0,M=M+Math.imul(ze,q)|0,S=S+Math.imul(Ie,pe)|0,b=b+Math.imul(Ie,xe)|0,b=b+Math.imul(Le,pe)|0,M=M+Math.imul(Le,xe)|0;var lt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul(Be,H),b=Math.imul(Be,V),b=b+Math.imul(et,H)|0,M=Math.imul(et,V),S=S+Math.imul(Ee,Y)|0,b=b+Math.imul(Ee,q)|0,b=b+Math.imul(Qe,Y)|0,M=M+Math.imul(Qe,q)|0,S=S+Math.imul(ke,pe)|0,b=b+Math.imul(ke,xe)|0,b=b+Math.imul(ze,pe)|0,M=M+Math.imul(ze,xe)|0;var at=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(at>>>26)|0,at&=67108863,S=Math.imul(Be,Y),b=Math.imul(Be,q),b=b+Math.imul(et,Y)|0,M=Math.imul(et,q),S=S+Math.imul(Ee,pe)|0,b=b+Math.imul(Ee,xe)|0,b=b+Math.imul(Qe,pe)|0,M=M+Math.imul(Qe,xe)|0;var Ae=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,S=Math.imul(Be,pe),b=Math.imul(Be,xe),b=b+Math.imul(et,pe)|0,M=Math.imul(et,xe);var Pe=(_+S|0)+((b&8191)<<13)|0;return _=(M+(b>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,x[0]=Re,x[1]=De,x[2]=it,x[3]=Ue,x[4]=gt,x[5]=st,x[6]=tt,x[7]=At,x[8]=Rt,x[9]=Mt,x[10]=Et,x[11]=dt,x[12]=_t,x[13]=ot,x[14]=wt,x[15]=lt,x[16]=at,x[17]=Ae,x[18]=Pe,_!==0&&(x[19]=_,f.length++),f};Math.imul||(N=P);function D(G,E,m){m.negative=E.negative^G.negative,m.length=G.length+E.length;for(var f=0,g=0,v=0;v>>26)|0,g+=x>>>26,x&=67108863}m.words[v]=_,f=x,x=g}return f!==0?m.words[v]=f:m.length--,m.strip()}function k(G,E,m){var f=new B;return f.mulp(G,E,m)}s.prototype.mulTo=function(E,m){var f,g=this.length+E.length;return this.length===10&&E.length===10?f=N(this,E,m):g<63?f=P(this,E,m):g<1024?f=D(this,E,m):f=k(this,E,m),f};function B(G,E){this.x=G,this.y=E}B.prototype.makeRBT=function(E){for(var m=new Array(E),f=s.prototype._countBits(E)-1,g=0;g>=1;return g},B.prototype.permute=function(E,m,f,g,v,x){for(var _=0;_>>1)v++;return 1<>>13,f[2*x+1]=v&8191,v=v>>>13;for(x=2*m;x>=26,m+=g/67108864|0,m+=v>>>26,this.words[f]=v&67108863}return m!==0&&(this.words[f]=m,this.length++),this},s.prototype.muln=function(E){return this.clone().imuln(E)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(E){var m=A(E);if(m.length===0)return new s(1);for(var f=this,g=0;g=0);var m=E%26,f=(E-m)/26,g=67108863>>>26-m<<26-m,v;if(m!==0){var x=0;for(v=0;v>>26-m}x&&(this.words[v]=x,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var g;m?g=(m-m%26)/26:g=0;var v=E%26,x=Math.min((E-v)/26,this.length),_=67108863^67108863>>>v<x)for(this.length-=x,b=0;b=0&&(M!==0||b>=g);b--){var I=this.words[b]|0;this.words[b]=M<<26-v|I>>>v,M=I&_}return S&&M!==0&&(S.words[S.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(E,m,f){return n(this.negative===0),this.iushrn(E,m,f)},s.prototype.shln=function(E){return this.clone().ishln(E)},s.prototype.ushln=function(E){return this.clone().iushln(E)},s.prototype.shrn=function(E){return this.clone().ishrn(E)},s.prototype.ushrn=function(E){return this.clone().iushrn(E)},s.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var m=E%26,f=(E-m)/26,g=1<=0);var m=E%26,f=(E-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(m!==0&&f++,this.length=Math.min(f,this.length),m!==0){var g=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(S/67108864|0),this.words[v+f]=x&67108863}for(;v>26,this.words[v+f]=x&67108863;if(_===0)return this.strip();for(n(_===-1),_=0,v=0;v>26,this.words[v]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(E,m){var f=this.length-E.length,g=this.clone(),v=E,x=v.words[v.length-1]|0,_=this._countBits(x);f=26-_,f!==0&&(v=v.ushln(f),g.iushln(f),x=v.words[v.length-1]|0);var S=g.length-v.length,b;if(m!=="mod"){b=new s(null),b.length=S+1,b.words=new Array(b.length);for(var M=0;M=0;F--){var ae=(g.words[v.length+F]|0)*67108864+(g.words[v.length+F-1]|0);for(ae=Math.min(ae/x|0,67108863),g._ishlnsubmul(v,ae,F);g.negative!==0;)ae--,g.negative=0,g._ishlnsubmul(v,1,F),g.isZero()||(g.negative^=1);b&&(b.words[F]=ae)}return b&&b.strip(),g.strip(),m!=="div"&&f!==0&&g.iushrn(f),{div:b||null,mod:g}},s.prototype.divmod=function(E,m,f){if(n(!E.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var g,v,x;return this.negative!==0&&E.negative===0?(x=this.neg().divmod(E,m),m!=="mod"&&(g=x.div.neg()),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.iadd(E)),{div:g,mod:v}):this.negative===0&&E.negative!==0?(x=this.divmod(E.neg(),m),m!=="mod"&&(g=x.div.neg()),{div:g,mod:x.mod}):this.negative&E.negative?(x=this.neg().divmod(E.neg(),m),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.isub(E)),{div:x.div,mod:v}):E.length>this.length||this.cmp(E)<0?{div:new s(0),mod:this}:E.length===1?m==="div"?{div:this.divn(E.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new s(this.modn(E.words[0]))}:this._wordDiv(E,m)},s.prototype.div=function(E){return this.divmod(E,"div",!1).div},s.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},s.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},s.prototype.divRound=function(E){var m=this.divmod(E);if(m.mod.isZero())return m.div;var f=m.div.negative!==0?m.mod.isub(E):m.mod,g=E.ushrn(1),v=E.andln(1),x=f.cmp(g);return x<0||v===1&&x===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(E){n(E<=67108863);for(var m=(1<<26)%E,f=0,g=this.length-1;g>=0;g--)f=(m*f+(this.words[g]|0))%E;return f},s.prototype.idivn=function(E){n(E<=67108863);for(var m=0,f=this.length-1;f>=0;f--){var g=(this.words[f]|0)+m*67108864;this.words[f]=g/E|0,m=g%E}return this.strip()},s.prototype.divn=function(E){return this.clone().idivn(E)},s.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=new s(0),_=new s(1),S=0;m.isEven()&&f.isEven();)m.iushrn(1),f.iushrn(1),++S;for(var b=f.clone(),M=m.clone();!m.isZero();){for(var I=0,F=1;!(m.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(m.iushrn(I);I-- >0;)(g.isOdd()||v.isOdd())&&(g.iadd(b),v.isub(M)),g.iushrn(1),v.iushrn(1);for(var ae=0,O=1;!(f.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(f.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(b),_.isub(M)),x.iushrn(1),_.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(x),v.isub(_)):(f.isub(m),x.isub(g),_.isub(v))}return{a:x,b:_,gcd:f.iushln(S)}},s.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=f.clone();m.cmpn(1)>0&&f.cmpn(1)>0;){for(var _=0,S=1;!(m.words[0]&S)&&_<26;++_,S<<=1);if(_>0)for(m.iushrn(_);_-- >0;)g.isOdd()&&g.iadd(x),g.iushrn(1);for(var b=0,M=1;!(f.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(f.iushrn(b);b-- >0;)v.isOdd()&&v.iadd(x),v.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(v)):(f.isub(m),v.isub(g))}var I;return m.cmpn(1)===0?I=g:I=v,I.cmpn(0)<0&&I.iadd(E),I},s.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var m=this.clone(),f=E.clone();m.negative=0,f.negative=0;for(var g=0;m.isEven()&&f.isEven();g++)m.iushrn(1),f.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=m.cmp(f);if(v<0){var x=m;m=f,f=x}else if(v===0||f.cmpn(1)===0)break;m.isub(f)}while(!0);return f.iushln(g)},s.prototype.invm=function(E){return this.egcd(E).a.umod(E)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(E){return this.words[0]&E},s.prototype.bincn=function(E){n(typeof E=="number");var m=E%26,f=(E-m)/26,g=1<>>26,_&=67108863,this.words[x]=_}return v!==0&&(this.words[x]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(E){var m=E<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var f;if(this.length>1)f=1;else{m&&(E=-E),n(E<=67108863,"Number is too big");var g=this.words[0]|0;f=g===E?0:gE.length)return 1;if(this.length=0;f--){var g=this.words[f]|0,v=E.words[f]|0;if(g!==v){gv&&(m=1);break}}return m},s.prototype.gtn=function(E){return this.cmpn(E)===1},s.prototype.gt=function(E){return this.cmp(E)===1},s.prototype.gten=function(E){return this.cmpn(E)>=0},s.prototype.gte=function(E){return this.cmp(E)>=0},s.prototype.ltn=function(E){return this.cmpn(E)===-1},s.prototype.lt=function(E){return this.cmp(E)===-1},s.prototype.lten=function(E){return this.cmpn(E)<=0},s.prototype.lte=function(E){return this.cmp(E)<=0},s.prototype.eqn=function(E){return this.cmpn(E)===0},s.prototype.eq=function(E){return this.cmp(E)===0},s.red=function(E){return new ue(E)},s.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(E){return this.red=E,this},s.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},s.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},s.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},s.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},s.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},s.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},s.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},s.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var j={k256:null,p224:null,p192:null,p25519:null};function U(G,E){this.name=G,this.p=new s(E,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var E=new s(null);return E.words=new Array(Math.ceil(this.n/13)),E},U.prototype.ireduce=function(E){var m=E,f;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),f=m.bitLength();while(f>this.n);var g=f0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},U.prototype.split=function(E,m){E.iushrn(this.n,0,m)},U.prototype.imulK=function(E){return E.imul(this.k)};function K(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(K,U),K.prototype.split=function(E,m){for(var f=4194303,g=Math.min(E.length,9),v=0;v>>22,x=_}x>>>=22,E.words[v-10]=x,x===0&&E.length>10?E.length-=10:E.length-=9},K.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var m=0,f=0;f>>=26,E.words[f]=v,m=g}return m!==0&&(E.words[E.length++]=m),E},s._prime=function(E){if(j[E])return j[E];var m;if(E==="k256")m=new K;else if(E==="p224")m=new J;else if(E==="p192")m=new T;else if(E==="p25519")m=new z;else throw new Error("Unknown prime "+E);return j[E]=m,m};function ue(G){if(typeof G=="string"){var E=s._prime(G);this.m=E.p,this.prime=E}else n(G.gtn(1),"modulus must be greater than 1"),this.m=G,this.prime=null}ue.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},ue.prototype._verify2=function(E,m){n((E.negative|m.negative)===0,"red works only with positives"),n(E.red&&E.red===m.red,"red works only with red numbers")},ue.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},ue.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},ue.prototype.add=function(E,m){this._verify2(E,m);var f=E.add(m);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},ue.prototype.iadd=function(E,m){this._verify2(E,m);var f=E.iadd(m);return f.cmp(this.m)>=0&&f.isub(this.m),f},ue.prototype.sub=function(E,m){this._verify2(E,m);var f=E.sub(m);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},ue.prototype.isub=function(E,m){this._verify2(E,m);var f=E.isub(m);return f.cmpn(0)<0&&f.iadd(this.m),f},ue.prototype.shl=function(E,m){return this._verify1(E),this.imod(E.ushln(m))},ue.prototype.imul=function(E,m){return this._verify2(E,m),this.imod(E.imul(m))},ue.prototype.mul=function(E,m){return this._verify2(E,m),this.imod(E.mul(m))},ue.prototype.isqr=function(E){return this.imul(E,E.clone())},ue.prototype.sqr=function(E){return this.mul(E,E)},ue.prototype.sqrt=function(E){if(E.isZero())return E.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(E,f)}for(var g=this.m.subn(1),v=0;!g.isZero()&&g.andln(1)===0;)v++,g.iushrn(1);n(!g.isZero());var x=new s(1).toRed(this),_=x.redNeg(),S=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new s(2*b*b).toRed(this);this.pow(b,S).cmp(_)!==0;)b.redIAdd(_);for(var M=this.pow(b,g),I=this.pow(E,g.addn(1).iushrn(1)),F=this.pow(E,g),ae=v;F.cmp(x)!==0;){for(var O=F,se=0;O.cmp(x)!==0;se++)O=O.redSqr();n(se=0;v--){for(var M=m.words[v],I=b-1;I>=0;I--){var F=M>>I&1;if(x!==g[0]&&(x=this.sqr(x)),F===0&&_===0){S=0;continue}_<<=1,_|=F,S++,!(S!==f&&(v!==0||I!==0))&&(x=this.mul(x,g[_]),S=0,_=0)}b=26}return x},ue.prototype.convertTo=function(E){var m=E.umod(this.m);return m===E?m.clone():m},ue.prototype.convertFrom=function(E){var m=E.clone();return m.red=null,m},s.mont=function(E){return new _e(E)};function _e(G){ue.call(this,G),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(_e,ue),_e.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},_e.prototype.convertFrom=function(E){var m=this.imod(E.mul(this.rinv));return m.red=null,m},_e.prototype.imul=function(E,m){if(E.isZero()||m.isZero())return E.words[0]=0,E.length=1,E;var f=E.imul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.mul=function(E,m){if(E.isZero()||m.isZero())return new s(0)._forceRed(this);var f=E.mul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.invm=function(E){var m=this.imod(E._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,nn)}(Wm);var xo=Wm.exports,Km={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var u=0;u>8,p=l&255;d?a.push(d,p):a.push(p)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(N>>1)-1?k=(N>>1)-B:k=B,D.isubn(k)):k=0,A[P]=k,D.iushrn(1)}return A}e.getNAF=s;function o(d,p){var y=[[],[]];d=d.clone(),p=p.clone();for(var A=0,P=0,N;d.cmpn(-A)>0||p.cmpn(-P)>0;){var D=d.andln(3)+A&3,k=p.andln(3)+P&3;D===3&&(D=-1),k===3&&(k=-1);var B;D&1?(N=d.andln(7)+A&7,(N===3||N===5)&&k===2?B=-D:B=D):B=0,y[0].push(B);var j;k&1?(N=p.andln(7)+P&7,(N===3||N===5)&&D===2?j=-k:j=k):j=0,y[1].push(j),2*A===B+1&&(A=1-A),2*P===j+1&&(P=1-P),d.iushrn(1),p.iushrn(1)}return y}e.getJSF=o;function a(d,p,y){var A="_"+p;d.prototype[p]=function(){return this[A]!==void 0?this[A]:this[A]=y.call(this)}}e.cachedProperty=a;function u(d){return typeof d=="string"?e.toArray(d,"hex"):d}e.parseBytes=u;function l(d){return new r(d,"hex","le")}e.intFromLE=l}(Ti);var Vm={exports:{}},Gm;Vm.exports=function(e){return Gm||(Gm=new aa(null)),Gm.generate(e)};function aa(t){this.rand=t}if(Vm.exports.Rand=aa,aa.prototype.generate=function(e){return this._rand(e)},aa.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Rd=ca;ca.prototype.point=function(){throw new Error("Not implemented")},ca.prototype.validate=function(){throw new Error("Not implemented")},ca.prototype._fixedNafMul=function(e,r){Td(e.precomputed);var n=e._getDoubles(),i=Cd(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Td(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},ca.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=Cd(n[P],o[P],this._bitLength),u[N]=Cd(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=Nk(n[P],n[N]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[N]=new Array(l),p=0;p=0;d--){for(var T=0;d>=0;){var z=!0;for(p=0;p=0&&T++,K=K.dblp(T),d<0)break;for(p=0;p0?y=a[p][ue-1>>1]:ue<0&&(y=a[p][-ue-1>>1].neg()),y.type==="affine"?K=K.mixedAdd(y):K=K.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Ki.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),p.negative&&(p=p.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:p,b:y},{a:A,b:P}]},Vi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Vi.prototype.pointFromX=function(e,r){e=new en(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Vi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Vi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},On.prototype.isInfinity=function(){return this.inf},On.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},On.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},On.prototype.getX=function(){return this.x.fromRed()},On.prototype.getY=function(){return this.y.fromRed()},On.prototype.mul=function(e){return e=new en(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},On.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},On.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},On.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},On.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},On.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function qn(t,e,r,n){bu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new en(0)):(this.x=new en(e,16),this.y=new en(r,16),this.z=new en(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Jm(qn,bu.BasePoint),Vi.prototype.jpoint=function(e,r,n){return new qn(this,e,r,n)},qn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},qn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},qn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(p).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(p)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},qn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),A=u.redMul(p.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},qn.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},qn.prototype.inspect=function(){return this.isInfinity()?"":""},qn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var yu=xo,C3=yd,Dd=Rd,$k=Ti;function wu(t){Dd.call(this,"mont",t),this.a=new yu(t.a,16).toRed(this.red),this.b=new yu(t.b,16).toRed(this.red),this.i4=new yu(4).toRed(this.red).redInvm(),this.two=new yu(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}C3(wu,Dd);var Fk=wu;wu.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function Nn(t,e,r){Dd.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new yu(e,16),this.z=new yu(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}C3(Nn,Dd.BasePoint),wu.prototype.decodePoint=function(e,r){return this.point($k.toArray(e,r),1)},wu.prototype.point=function(e,r){return new Nn(this,e,r)},wu.prototype.pointFromJSON=function(e){return Nn.fromJSON(this,e)},Nn.prototype.precompute=function(){},Nn.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Nn.fromJSON=function(e,r){return new Nn(e,r[0],r[1]||e.one)},Nn.prototype.inspect=function(){return this.isInfinity()?"":""},Nn.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Nn.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)},Nn.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),u=s.redMul(i),l=r.z.redMul(a.redAdd(u).redSqr()),d=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(l,d)},Nn.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i},Nn.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Nn.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Nn.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Nn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var jk=Ti,_o=xo,T3=yd,Od=Rd,Uk=jk.assert;function zs(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Od.call(this,"edwards",t),this.a=new _o(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new _o(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new _o(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Uk(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}T3(zs,Od);var qk=zs;zs.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},zs.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},zs.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)},zs.prototype.pointFromX=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var u=a.fromRed().isOdd();return(r&&!u||!r&&u)&&(a=a.redNeg()),this.point(e,a)},zs.prototype.pointFromY=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)},zs.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function Hr(t,e,r,n,i){Od.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new _o(e,16),this.y=new _o(r,16),this.z=n?new _o(n,16):this.curve.one,this.t=i&&new _o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}T3(Hr,Od.BasePoint),zs.prototype.pointFromJSON=function(e){return Hr.fromJSON(this,e)},zs.prototype.point=function(e,r,n,i){return new Hr(this,e,r,n,i)},Hr.fromJSON=function(e,r){return new Hr(e,r[0],r[1],r[2])},Hr.prototype.inspect=function(){return this.isInfinity()?"":""},Hr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Hr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),u=i.redSub(r),l=s.redMul(a),d=o.redMul(u),p=s.redMul(u),y=a.redMul(o);return this.curve.point(l,d,y,p)},Hr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,u,l;if(this.curve.twisted){a=this.curve._mulA(r);var d=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(d.redSub(this.curve.two)),s=d.redMul(a.redSub(n)),o=d.redSqr().redSub(d).redSub(d)):(u=this.z.redSqr(),l=d.redSub(u).redISub(u),i=e.redSub(r).redISub(n).redMul(l),s=d.redMul(a.redSub(n)),o=d.redMul(l))}else a=r.redAdd(n),u=this.curve._mulC(this.z).redSqr(),l=a.redSub(u).redSub(u),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)},Hr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Hr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),u=s.redAdd(i),l=n.redAdd(r),d=o.redMul(a),p=u.redMul(l),y=o.redMul(l),A=a.redMul(u);return this.curve.point(d,p,A,y)},Hr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),u=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),d=r.redMul(a).redMul(l),p,y;return this.curve.twisted?(p=r.redMul(u).redMul(s.redSub(this.curve._mulA(i))),y=a.redMul(u)):(p=r.redMul(u).redMul(s.redSub(i)),y=this.curve._mulC(a).redMul(u)),this.curve.point(d,p,y)},Hr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Hr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Hr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)},Hr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)},Hr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Hr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Hr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Hr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Hr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Hr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Hr.prototype.toP=Hr.prototype.normalize,Hr.prototype.mixedAdd=Hr.prototype.add,function(t){var e=t;e.base=Rd,e.short=Bk,e.mont=Fk,e.edwards=qk}(Ym);var Nd={},Xm,R3;function zk(){return R3||(R3=1,Xm={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Xm}(function(t){var e=t,r=al,n=Ym,i=Ti,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,d){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var p=new o(d);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:p}),p}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=zk()}catch{u=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})})(Nd);var Hk=al,Za=Km,D3=Ga;function ua(t){if(!(this instanceof ua))return new ua(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Za.toArray(t.entropy,t.entropyEnc||"hex"),r=Za.toArray(t.nonce,t.nonceEnc||"hex"),n=Za.toArray(t.pers,t.persEnc||"hex");D3(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Wk=ua;ua.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ua.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Za.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var Ld=xo,Qm=Ti,Yk=Qm.assert;function kd(t,e){if(t instanceof kd)return t;this._importDER(t,e)||(Yk(t.r&&t.s,"Signature without r or s"),this.r=new Ld(t.r,16),this.s=new Ld(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Jk=kd;function Xk(){this.place=0}function e1(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function O3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}kd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=O3(r),n=O3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];t1(i,r.length),i=i.concat(r),i.push(2),t1(i,n.length);var s=i.concat(n),o=[48];return t1(o,s.length),o=o.concat(s),Qm.encode(o,e)};var Eo=xo,N3=Wk,Zk=Ti,r1=Nd,Qk=I3,L3=Zk.assert,n1=Gk,Bd=Jk;function Gi(t){if(!(this instanceof Gi))return new Gi(t);typeof t=="string"&&(L3(Object.prototype.hasOwnProperty.call(r1,t),"Unknown curve "+t),t=r1[t]),t instanceof r1.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var eB=Gi;Gi.prototype.keyPair=function(e){return new n1(this,e)},Gi.prototype.keyFromPrivate=function(e,r){return n1.fromPrivate(this,e,r)},Gi.prototype.keyFromPublic=function(e,r){return n1.fromPublic(this,e,r)},Gi.prototype.genKeyPair=function(e){e||(e={});for(var r=new N3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Qk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new Eo(2));;){var s=new Eo(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Gi.prototype._truncateToN=function(e,r,n){var i;if(Eo.isBN(e)||typeof e=="number")e=new Eo(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new Eo(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new Eo(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Gi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new N3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new Eo(1)),d=0;;d++){var p=i.k?i.k(d):new Eo(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new Bd({r:P,s:N,recoveryParam:D})}}}}}},Gi.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new Bd(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),l=u.mul(e).umod(this.n),d=u.mul(o).umod(this.n),p;return this.curve._maxwellTrick?(p=this.g.jmulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.eqXToP(o)):(p=this.g.mulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.getX().umod(this.n).cmp(o)===0)},Gi.prototype.recoverPubKey=function(t,e,r,n){L3((3&r)===r,"The recovery param is more than two bits"),e=new Bd(e,n);var i=this.n,s=new Eo(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Gi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Bd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dl=Ti,k3=dl.assert,B3=dl.parseBytes,xu=dl.cachedProperty;function Ln(t,e){this.eddsa=t,this._secret=B3(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=B3(e.pub)}Ln.fromPublic=function(e,r){return r instanceof Ln?r:new Ln(e,{pub:r})},Ln.fromSecret=function(e,r){return r instanceof Ln?r:new Ln(e,{secret:r})},Ln.prototype.secret=function(){return this._secret},xu(Ln,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),xu(Ln,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),xu(Ln,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i}),xu(Ln,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),xu(Ln,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),xu(Ln,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Ln.prototype.sign=function(e){return k3(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Ln.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},Ln.prototype.getSecret=function(e){return k3(this._secret,"KeyPair is public only"),dl.encode(this.secret(),e)},Ln.prototype.getPublic=function(e){return dl.encode(this.pubBytes(),e)};var tB=Ln,rB=xo,$d=Ti,$3=$d.assert,Fd=$d.cachedProperty,nB=$d.parseBytes;function Qa(t,e){this.eddsa=t,typeof e!="object"&&(e=nB(e)),Array.isArray(e)&&($3(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),$3(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof rB&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Fd(Qa,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Fd(Qa,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Fd(Qa,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Fd(Qa,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Qa.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Qa.prototype.toHex=function(){return $d.encode(this.toBytes(),"hex").toUpperCase()};var iB=Qa,sB=al,oB=Nd,_u=Ti,aB=_u.assert,F3=_u.parseBytes,j3=tB,U3=iB;function vi(t){if(aB(t==="ed25519","only tested with ed25519 so far"),!(this instanceof vi))return new vi(t);t=oB[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=sB.sha512}var cB=vi;vi.prototype.sign=function(e,r){e=F3(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),u=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:u,Rencoded:o})},vi.prototype.verify=function(e,r,n){if(e=F3(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)},vi.prototype.hashInt=function(){for(var e=this.hash(),r=0;re in t?lB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,W3=(t,e)=>{for(var r in e||(e={}))hB.call(e,r)&&H3(t,r,e[r]);if(z3)for(var r of z3(e))dB.call(e,r)&&H3(t,r,e[r]);return t};const pB="ReactNative",Ri={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},gB="js";function jd(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Su(){return!nl()&&!!mm()&&navigator.product===pB}function pl(){return!jd()&&!!mm()&&!!nl()}function gl(){return Su()?Ri.reactNative:jd()?Ri.node:pl()?Ri.browser:Ri.unknown}function mB(){var t;try{return Su()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function vB(t,e){let r=il.parse(t);return r=W3(W3({},r),e),t=il.stringify(r),t}function K3(){return Px()||{name:"",description:"",url:"",icons:[""]}}function bB(){if(gl()===Ri.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=HO();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function yB(){var t;const e=gl();return e===Ri.browser?[e,((t=Ax())==null?void 0:t.host)||"unknown"].join(":"):e}function V3(t,e,r){const n=bB(),i=yB();return[[t,e].join("-"),[gB,r].join("-"),n,i].join("/")}function wB({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const u=r.split("?"),l=V3(t,e,n),d={auth:i,ua:l,projectId:s,useOnCloseEvent:o,origin:a||void 0},p=vB(u[1]||"",d);return u[0]+"?"+p}function ec(t,e){return t.filter(r=>e.includes(r)).length===t.length}function G3(t){return Object.fromEntries(t.entries())}function Y3(t){return new Map(Object.entries(t))}function tc(t=mt.FIVE_MINUTES,e){const r=mt.toMiliseconds(t||mt.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Au(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function J3(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function xB(t){return J3("topic",t)}function _B(t){return J3("id",t)}function X3(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function En(t,e){return mt.fromMiliseconds(Date.now()+mt.toMiliseconds(t))}function fa(t){return Date.now()>=mt.toMiliseconds(t)}function vr(t,e){return`${t}${e?`:${e}`:""}`}function Ud(t=[],e=[]){return[...new Set([...t,...e])]}async function EB({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=SB(s,t,e),a=gl();if(a===Ri.browser){if(!((n=nl())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,PB()?"_blank":"_self","noreferrer noopener")}else a===Ri.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function SB(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${MB(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function AB(t,e){let r="";try{if(pl()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function Z3(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function Q3(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function i1(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function PB(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function MB(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function e_(t){return Buffer.from(t,"base64").toString("utf-8")}const IB="https://rpc.walletconnect.org/v1";async function CB(t,e,r,n,i,s){switch(r.t){case"eip191":return TB(t,e,r.s);case"eip1271":return await RB(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function TB(t,e,r){return yk(qx(e),r).toLowerCase()===t.toLowerCase()}async function RB(t,e,r,n,i,s){const o=Eu(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",d=r.substring(2),p=qx(e).substring(2),y=a+p+u+l+d,A=await fetch(`${s||IB}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:DB(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:y},"latest"]})}),{result:P}=await A.json();return P?P.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function DB(){return Date.now()+Math.floor(Math.random()*1e3)}var OB=Object.defineProperty,NB=Object.defineProperties,LB=Object.getOwnPropertyDescriptors,t_=Object.getOwnPropertySymbols,kB=Object.prototype.hasOwnProperty,BB=Object.prototype.propertyIsEnumerable,r_=(t,e,r)=>e in t?OB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$B=(t,e)=>{for(var r in e||(e={}))kB.call(e,r)&&r_(t,r,e[r]);if(t_)for(var r of t_(e))BB.call(e,r)&&r_(t,r,e[r]);return t},FB=(t,e)=>NB(t,LB(e));const jB="did:pkh:",s1=t=>t==null?void 0:t.split(":"),UB=t=>{const e=t&&s1(t);if(e)return t.includes(jB)?e[3]:e[1]},o1=t=>{const e=t&&s1(t);if(e)return e[2]+":"+e[3]},qd=t=>{const e=t&&s1(t);if(e)return e.pop()};async function n_(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=i_(i,i.iss),o=qd(i.iss);return await CB(o,s,n,o1(i.iss),r)}const i_=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=qd(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${UB(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,d=t.exp?`Expiration Time: ${t.exp}`:void 0,p=t.nbf?`Not Before: ${t.nbf}`:void 0,y=t.requestId?`Request ID: ${t.requestId}`:void 0,A=t.resources?`Resources:${t.resources.map(N=>` + */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=nn:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],p=[4,1024,262144,67108864],y=[1,256,65536,16777216],A=[6,1536,393216,100663296],P=[0,8,16,24],N=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],D=[224,256,384,512],k=[128,256],B=["hex","buffer","arrayBuffer","array","digest"],q={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(O){return Object.prototype.toString.call(O)==="[object Array]"}),u&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(O){return typeof O=="object"&&O.buffer&&O.buffer.constructor===ArrayBuffer});for(var j=function(O,se,ee){return function(X){return new I(O,se,O).update(X)[ee]()}},H=function(O,se,ee){return function(X,Q){return new I(O,se,Q).update(X)[ee]()}},J=function(O,se,ee){return function(X,Q,R,Z){return f["cshake"+O].update(X,Q,R,Z)[ee]()}},T=function(O,se,ee){return function(X,Q,R,Z){return f["kmac"+O].update(X,Q,R,Z)[ee]()}},z=function(O,se,ee,X){for(var Q=0;Q>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ee>>5,this.extraBytes=(ee&31)>>3;for(var X=0;X<50;++X)this.s[X]=0}I.prototype.update=function(O){if(this.finalized)throw new Error(r);var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}for(var X=this.blocks,Q=this.byteCount,R=O.length,Z=this.blockCount,te=0,le=this.s,ie,fe;te>2]|=O[te]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(X[ie>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=Q){for(this.start=ie-Q,this.block=X[Z],ie=0;ie>8,ee=O&255;ee>0;)Q.unshift(ee),O=O>>8,ee=O&255,++X;return se?Q.push(X):Q.unshift(X),this.update(Q),Q.length},I.prototype.encodeString=function(O){var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}var X=0,Q=O.length;if(se)X=Q;else for(var R=0;R=57344?X+=3:(Z=65536+((Z&1023)<<10|O.charCodeAt(++R)&1023),X+=4)}return X+=this.encode(X*8),this.update(O),X},I.prototype.bytepad=function(O,se){for(var ee=this.encode(se),X=0;X>2]|=this.padding[se&3],this.lastByteIndex===this.byteCount)for(O[0]=O[ee],se=1;se>4&15]+l[te&15]+l[te>>12&15]+l[te>>8&15]+l[te>>20&15]+l[te>>16&15]+l[te>>28&15]+l[te>>24&15];R%O===0&&(ae(se),Q=0)}return X&&(te=se[Q],Z+=l[te>>4&15]+l[te&15],X>1&&(Z+=l[te>>12&15]+l[te>>8&15]),X>2&&(Z+=l[te>>20&15]+l[te>>16&15])),Z},I.prototype.arrayBuffer=function(){this.finalize();var O=this.blockCount,se=this.s,ee=this.outputBlocks,X=this.extraBytes,Q=0,R=0,Z=this.outputBits>>3,te;X?te=new ArrayBuffer(ee+1<<2):te=new ArrayBuffer(Z);for(var le=new Uint32Array(te);R>8&255,Z[te+2]=le>>16&255,Z[te+3]=le>>24&255;R%O===0&&ae(se)}return X&&(te=R<<2,le=se[Q],Z[te]=le&255,X>1&&(Z[te+1]=le>>8&255),X>2&&(Z[te+2]=le>>16&255)),Z};function F(O,se,ee){I.call(this,O,se,ee)}F.prototype=new I,F.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var ae=function(O){var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me,Ne,Te,$e,Ie,Le,Ve,ke,ze,He,Se,Qe,ct,Be,et,rt,Je,pt,ht,ft,Ht,Jt,St,er,Xt,Ot,Bt,Tt,vt,Dt,Lt,bt,$t,jt,nt,Ft,$,W,V,C,Y,U,oe,pe,xe,Re,De,it,Ue,gt,st,tt;for(X=0;X<48;X+=2)Q=O[0]^O[10]^O[20]^O[30]^O[40],R=O[1]^O[11]^O[21]^O[31]^O[41],Z=O[2]^O[12]^O[22]^O[32]^O[42],te=O[3]^O[13]^O[23]^O[33]^O[43],le=O[4]^O[14]^O[24]^O[34]^O[44],ie=O[5]^O[15]^O[25]^O[35]^O[45],fe=O[6]^O[16]^O[26]^O[36]^O[46],ve=O[7]^O[17]^O[27]^O[37]^O[47],Me=O[8]^O[18]^O[28]^O[38]^O[48],Ne=O[9]^O[19]^O[29]^O[39]^O[49],se=Me^(Z<<1|te>>>31),ee=Ne^(te<<1|Z>>>31),O[0]^=se,O[1]^=ee,O[10]^=se,O[11]^=ee,O[20]^=se,O[21]^=ee,O[30]^=se,O[31]^=ee,O[40]^=se,O[41]^=ee,se=Q^(le<<1|ie>>>31),ee=R^(ie<<1|le>>>31),O[2]^=se,O[3]^=ee,O[12]^=se,O[13]^=ee,O[22]^=se,O[23]^=ee,O[32]^=se,O[33]^=ee,O[42]^=se,O[43]^=ee,se=Z^(fe<<1|ve>>>31),ee=te^(ve<<1|fe>>>31),O[4]^=se,O[5]^=ee,O[14]^=se,O[15]^=ee,O[24]^=se,O[25]^=ee,O[34]^=se,O[35]^=ee,O[44]^=se,O[45]^=ee,se=le^(Me<<1|Ne>>>31),ee=ie^(Ne<<1|Me>>>31),O[6]^=se,O[7]^=ee,O[16]^=se,O[17]^=ee,O[26]^=se,O[27]^=ee,O[36]^=se,O[37]^=ee,O[46]^=se,O[47]^=ee,se=fe^(Q<<1|R>>>31),ee=ve^(R<<1|Q>>>31),O[8]^=se,O[9]^=ee,O[18]^=se,O[19]^=ee,O[28]^=se,O[29]^=ee,O[38]^=se,O[39]^=ee,O[48]^=se,O[49]^=ee,Te=O[0],$e=O[1],nt=O[11]<<4|O[10]>>>28,Ft=O[10]<<4|O[11]>>>28,Je=O[20]<<3|O[21]>>>29,pt=O[21]<<3|O[20]>>>29,Ue=O[31]<<9|O[30]>>>23,gt=O[30]<<9|O[31]>>>23,Lt=O[40]<<18|O[41]>>>14,bt=O[41]<<18|O[40]>>>14,St=O[2]<<1|O[3]>>>31,er=O[3]<<1|O[2]>>>31,Ie=O[13]<<12|O[12]>>>20,Le=O[12]<<12|O[13]>>>20,$=O[22]<<10|O[23]>>>22,W=O[23]<<10|O[22]>>>22,ht=O[33]<<13|O[32]>>>19,ft=O[32]<<13|O[33]>>>19,st=O[42]<<2|O[43]>>>30,tt=O[43]<<2|O[42]>>>30,oe=O[5]<<30|O[4]>>>2,pe=O[4]<<30|O[5]>>>2,Xt=O[14]<<6|O[15]>>>26,Ot=O[15]<<6|O[14]>>>26,Ve=O[25]<<11|O[24]>>>21,ke=O[24]<<11|O[25]>>>21,V=O[34]<<15|O[35]>>>17,C=O[35]<<15|O[34]>>>17,Ht=O[45]<<29|O[44]>>>3,Jt=O[44]<<29|O[45]>>>3,ct=O[6]<<28|O[7]>>>4,Be=O[7]<<28|O[6]>>>4,xe=O[17]<<23|O[16]>>>9,Re=O[16]<<23|O[17]>>>9,Bt=O[26]<<25|O[27]>>>7,Tt=O[27]<<25|O[26]>>>7,ze=O[36]<<21|O[37]>>>11,He=O[37]<<21|O[36]>>>11,Y=O[47]<<24|O[46]>>>8,U=O[46]<<24|O[47]>>>8,$t=O[8]<<27|O[9]>>>5,jt=O[9]<<27|O[8]>>>5,et=O[18]<<20|O[19]>>>12,rt=O[19]<<20|O[18]>>>12,De=O[29]<<7|O[28]>>>25,it=O[28]<<7|O[29]>>>25,vt=O[38]<<8|O[39]>>>24,Dt=O[39]<<8|O[38]>>>24,Se=O[48]<<14|O[49]>>>18,Qe=O[49]<<14|O[48]>>>18,O[0]=Te^~Ie&Ve,O[1]=$e^~Le&ke,O[10]=ct^~et&Je,O[11]=Be^~rt&pt,O[20]=St^~Xt&Bt,O[21]=er^~Ot&Tt,O[30]=$t^~nt&$,O[31]=jt^~Ft&W,O[40]=oe^~xe&De,O[41]=pe^~Re&it,O[2]=Ie^~Ve&ze,O[3]=Le^~ke&He,O[12]=et^~Je&ht,O[13]=rt^~pt&ft,O[22]=Xt^~Bt&vt,O[23]=Ot^~Tt&Dt,O[32]=nt^~$&V,O[33]=Ft^~W&C,O[42]=xe^~De&Ue,O[43]=Re^~it>,O[4]=Ve^~ze&Se,O[5]=ke^~He&Qe,O[14]=Je^~ht&Ht,O[15]=pt^~ft&Jt,O[24]=Bt^~vt&Lt,O[25]=Tt^~Dt&bt,O[34]=$^~V&Y,O[35]=W^~C&U,O[44]=De^~Ue&st,O[45]=it^~gt&tt,O[6]=ze^~Se&Te,O[7]=He^~Qe&$e,O[16]=ht^~Ht&ct,O[17]=ft^~Jt&Be,O[26]=vt^~Lt&St,O[27]=Dt^~bt&er,O[36]=V^~Y&$t,O[37]=C^~U&jt,O[46]=Ue^~st&oe,O[47]=gt^~tt&pe,O[8]=Se^~Te&Ie,O[9]=Qe^~$e&Le,O[18]=Ht^~ct&et,O[19]=Jt^~Be&rt,O[28]=Lt^~St&Xt,O[29]=bt^~er&Ot,O[38]=Y^~$t&nt,O[39]=U^~jt&Ft,O[48]=st^~oe&xe,O[49]=tt^~pe&Re,O[0]^=N[X],O[1]^=N[X+1]};if(a)t.exports=f;else for(v=0;v{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const kx=mN();var wm;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(wm||(wm={}));var ps;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(ps||(ps={}));const Bx="0123456789abcdef";class Kr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();vd[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Lx>vd[n])&&console.log.apply(console,r)}debug(...e){this._log(Kr.levels.DEBUG,e)}info(...e){this._log(Kr.levels.INFO,e)}warn(...e){this._log(Kr.levels.WARNING,e)}makeError(e,r,n){if(Nx)return this.makeError("censored error",r,{});r||(r=Kr.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(u=>{const l=n[u];try{if(l instanceof Uint8Array){let d="";for(let p=0;p>4],d+=Bx[l[p]&15];i.push(u+"=Uint8Array(0x"+d+")")}else i.push(u+"="+JSON.stringify(l))}catch{i.push(u+"="+JSON.stringify(n[u].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case ps.NUMERIC_FAULT:{o="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case ps.CALL_EXCEPTION:case ps.INSUFFICIENT_FUNDS:case ps.MISSING_NEW:case ps.NONCE_EXPIRED:case ps.REPLACEMENT_UNDERPRICED:case ps.TRANSACTION_REPLACED:case ps.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(u){a[u]=n[u]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Kr.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){kx&&this.throwError("platform missing String.prototype.normalize",Kr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:kx})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Kr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Kr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return ym||(ym=new Kr(gN)),ym}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Ox){if(!e)return;this.globalLogger().throwError("error censorship permanent",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Nx=!!e,Ox=!!r}static setLogLevel(e){const r=vd[e.toLowerCase()];if(r==null){Kr.globalLogger().warn("invalid log level - "+e);return}Lx=r}static from(e){return new Kr(e)}}Kr.errors=ps,Kr.levels=wm;const vN="bytes/5.7.0",on=new Kr(vN);function $x(t){return!!t.toHexString}function fu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return fu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function bN(t){return Ns(t)&&!(t.length%2)||xm(t)}function Fx(t){return typeof t=="number"&&t==t&&t%1===0}function xm(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!Fx(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function bn(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),fu(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),$x(t)&&(t=t.toHexString()),Ns(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":on.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ibn(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),fu(n)}function wN(t,e){t=bn(t),t.length>e&&on.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),fu(r)}function Ns(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const _m="0123456789abcdef";function Ii(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=_m[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),$x(t))return t.toHexString();if(Ns(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":on.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(xm(t)){let r="0x";for(let n=0;n>4]+_m[i&15]}return r}return on.throwArgumentError("invalid hexlify value","value",t)}function xN(t){if(typeof t!="string")t=Ii(t);else if(!Ns(t)||t.length%2)return null;return(t.length-2)/2}function jx(t,e,r){return typeof t!="string"?t=Ii(t):(!Ns(t)||t.length%2)&&on.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function lu(t,e){for(typeof t!="string"?t=Ii(t):Ns(t)||on.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&on.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Ux(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(bN(t)){let r=bn(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64))):r.length===65?(e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64)),e.v=r[64]):on.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:on.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Ii(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=wN(bn(e._vs),32);e._vs=Ii(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&on.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=Ii(i);e.s==null?e.s=o:e.s!==o&&on.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?on.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&on.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Ns(e.r)?on.throwArgumentError("signature missing or invalid r","signature",t):e.r=lu(e.r,32),e.s==null||!Ns(e.s)?on.throwArgumentError("signature missing or invalid s","signature",t):e.s=lu(e.s,32);const r=bn(e.s);r[0]>=128&&on.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=Ii(r);e._vs&&(Ns(e._vs)||on.throwArgumentError("signature invalid _vs","signature",t),e._vs=lu(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&on.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Em(t){return"0x"+pN.keccak_256(bn(t))}var Sm={exports:{}};Sm.exports,function(t){(function(e,r){function n(m,f){if(!m)throw new Error(f||"Assertion failed")}function i(m,f){m.super_=f;var g=function(){};g.prototype=f.prototype,m.prototype=new g,m.prototype.constructor=m}function s(m,f,g){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((f==="le"||f==="be")&&(g=f,f=10),this._init(m||0,f||10,g||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,g){return f.cmp(g)>0?f:g},s.min=function(f,g){return f.cmp(g)<0?f:g},s.prototype._init=function(f,g,v){if(typeof f=="number")return this._initNumber(f,g,v);if(typeof f=="object")return this._initArray(f,g,v);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),f=f.toString().replace(/\s+/g,"");var x=0;f[0]==="-"&&(x++,this.negative=1),x=0;x-=3)S=f[x]|f[x-1]<<8|f[x-2]<<16,this.words[_]|=S<>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);else if(v==="le")for(x=0,_=0;x>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);return this._strip()};function a(m,f){var g=m.charCodeAt(f);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+m)}function u(m,f,g){var v=a(m,g);return g-1>=f&&(v|=a(m,g-1)<<4),v}s.prototype._parseHex=function(f,g,v){this.length=Math.ceil((f.length-g)/6),this.words=new Array(this.length);for(var x=0;x=g;x-=2)b=u(f,g,x)<<_,this.words[S]|=b&67108863,_>=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8;else{var M=f.length-g;for(x=M%2===0?g+1:g;x=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8}this._strip()};function l(m,f,g,v){for(var x=0,_=0,S=Math.min(m.length,g),b=f;b=49?_=M-49+10:M>=17?_=M-17+10:_=M,n(M>=0&&_1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{s.prototype.inspect=p}else s.prototype.inspect=p;function p(){return(this.red?""}var y=["","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"],A=[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,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(f,g){f=f||10,g=g|0||1;var v;if(f===16||f==="hex"){v="";for(var x=0,_=0,S=0;S>>24-x&16777215,x+=2,x>=26&&(x-=26,S--),_!==0||S!==this.length-1?v=y[6-M.length]+M+v:v=M+v}for(_!==0&&(v=_.toString(16)+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(f===(f|0)&&f>=2&&f<=36){var I=A[f],F=P[f];v="";var ae=this.clone();for(ae.negative=0;!ae.isZero();){var O=ae.modrn(F).toString(f);ae=ae.idivn(F),ae.isZero()?v=O+v:v=y[I-O.length]+O+v}for(this.isZero()&&(v="0"+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,g){return this.toArrayLike(o,f,g)}),s.prototype.toArray=function(f,g){return this.toArrayLike(Array,f,g)};var N=function(f,g){return f.allocUnsafe?f.allocUnsafe(g):new f(g)};s.prototype.toArrayLike=function(f,g,v){this._strip();var x=this.byteLength(),_=v||Math.max(1,x);n(x<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var S=N(f,_),b=g==="le"?"LE":"BE";return this["_toArrayLike"+b](S,x),S},s.prototype._toArrayLikeLE=function(f,g){for(var v=0,x=0,_=0,S=0;_>8&255),v>16&255),S===6?(v>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v=0&&(f[v--]=b>>8&255),v>=0&&(f[v--]=b>>16&255),S===6?(v>=0&&(f[v--]=b>>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v>=0)for(f[v--]=x;v>=0;)f[v--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var g=f,v=0;return g>=4096&&(v+=13,g>>>=13),g>=64&&(v+=7,g>>>=7),g>=8&&(v+=4,g>>>=4),g>=2&&(v+=2,g>>>=2),v+g},s.prototype._zeroBits=function(f){if(f===0)return 26;var g=f,v=0;return g&8191||(v+=13,g>>>=13),g&127||(v+=7,g>>>=7),g&15||(v+=4,g>>>=4),g&3||(v+=2,g>>>=2),g&1||v++,v},s.prototype.bitLength=function(){var f=this.words[this.length-1],g=this._countBits(f);return(this.length-1)*26+g};function D(m){for(var f=new Array(m.bitLength()),g=0;g>>x&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,g=0;gf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var g;this.length>f.length?g=f:g=this;for(var v=0;vf.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var g,v;this.length>f.length?(g=this,v=f):(g=f,v=this);for(var x=0;xf.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var g=Math.ceil(f/26)|0,v=f%26;this._expand(g),v>0&&g--;for(var x=0;x0&&(this.words[x]=~this.words[x]&67108863>>26-v),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,g){n(typeof f=="number"&&f>=0);var v=f/26|0,x=f%26;return this._expand(v+1),g?this.words[v]=this.words[v]|1<f.length?(v=this,x=f):(v=f,x=this);for(var _=0,S=0;S>>26;for(;_!==0&&S>>26;if(this.length=v.length,_!==0)this.words[this.length]=_,this.length++;else if(v!==this)for(;Sf.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var g=this.iadd(f);return f.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var v=this.cmp(f);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,_;v>0?(x=this,_=f):(x=f,_=this);for(var S=0,b=0;b<_.length;b++)g=(x.words[b]|0)-(_.words[b]|0)+S,S=g>>26,this.words[b]=g&67108863;for(;S!==0&&b>26,this.words[b]=g&67108863;if(S===0&&b>>26,ae=M&67108863,O=Math.min(I,f.length-1),se=Math.max(0,I-m.length+1);se<=O;se++){var ee=I-se|0;x=m.words[ee]|0,_=f.words[se]|0,S=x*_+ae,F+=S/67108864|0,ae=S&67108863}g.words[I]=ae|0,M=F|0}return M!==0?g.words[I]=M|0:g.length--,g._strip()}var B=function(f,g,v){var x=f.words,_=g.words,S=v.words,b=0,M,I,F,ae=x[0]|0,O=ae&8191,se=ae>>>13,ee=x[1]|0,X=ee&8191,Q=ee>>>13,R=x[2]|0,Z=R&8191,te=R>>>13,le=x[3]|0,ie=le&8191,fe=le>>>13,ve=x[4]|0,Me=ve&8191,Ne=ve>>>13,Te=x[5]|0,$e=Te&8191,Ie=Te>>>13,Le=x[6]|0,Ve=Le&8191,ke=Le>>>13,ze=x[7]|0,He=ze&8191,Se=ze>>>13,Qe=x[8]|0,ct=Qe&8191,Be=Qe>>>13,et=x[9]|0,rt=et&8191,Je=et>>>13,pt=_[0]|0,ht=pt&8191,ft=pt>>>13,Ht=_[1]|0,Jt=Ht&8191,St=Ht>>>13,er=_[2]|0,Xt=er&8191,Ot=er>>>13,Bt=_[3]|0,Tt=Bt&8191,vt=Bt>>>13,Dt=_[4]|0,Lt=Dt&8191,bt=Dt>>>13,$t=_[5]|0,jt=$t&8191,nt=$t>>>13,Ft=_[6]|0,$=Ft&8191,W=Ft>>>13,V=_[7]|0,C=V&8191,Y=V>>>13,U=_[8]|0,oe=U&8191,pe=U>>>13,xe=_[9]|0,Re=xe&8191,De=xe>>>13;v.negative=f.negative^g.negative,v.length=19,M=Math.imul(O,ht),I=Math.imul(O,ft),I=I+Math.imul(se,ht)|0,F=Math.imul(se,ft);var it=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(it>>>26)|0,it&=67108863,M=Math.imul(X,ht),I=Math.imul(X,ft),I=I+Math.imul(Q,ht)|0,F=Math.imul(Q,ft),M=M+Math.imul(O,Jt)|0,I=I+Math.imul(O,St)|0,I=I+Math.imul(se,Jt)|0,F=F+Math.imul(se,St)|0;var Ue=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,M=Math.imul(Z,ht),I=Math.imul(Z,ft),I=I+Math.imul(te,ht)|0,F=Math.imul(te,ft),M=M+Math.imul(X,Jt)|0,I=I+Math.imul(X,St)|0,I=I+Math.imul(Q,Jt)|0,F=F+Math.imul(Q,St)|0,M=M+Math.imul(O,Xt)|0,I=I+Math.imul(O,Ot)|0,I=I+Math.imul(se,Xt)|0,F=F+Math.imul(se,Ot)|0;var gt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(gt>>>26)|0,gt&=67108863,M=Math.imul(ie,ht),I=Math.imul(ie,ft),I=I+Math.imul(fe,ht)|0,F=Math.imul(fe,ft),M=M+Math.imul(Z,Jt)|0,I=I+Math.imul(Z,St)|0,I=I+Math.imul(te,Jt)|0,F=F+Math.imul(te,St)|0,M=M+Math.imul(X,Xt)|0,I=I+Math.imul(X,Ot)|0,I=I+Math.imul(Q,Xt)|0,F=F+Math.imul(Q,Ot)|0,M=M+Math.imul(O,Tt)|0,I=I+Math.imul(O,vt)|0,I=I+Math.imul(se,Tt)|0,F=F+Math.imul(se,vt)|0;var st=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(st>>>26)|0,st&=67108863,M=Math.imul(Me,ht),I=Math.imul(Me,ft),I=I+Math.imul(Ne,ht)|0,F=Math.imul(Ne,ft),M=M+Math.imul(ie,Jt)|0,I=I+Math.imul(ie,St)|0,I=I+Math.imul(fe,Jt)|0,F=F+Math.imul(fe,St)|0,M=M+Math.imul(Z,Xt)|0,I=I+Math.imul(Z,Ot)|0,I=I+Math.imul(te,Xt)|0,F=F+Math.imul(te,Ot)|0,M=M+Math.imul(X,Tt)|0,I=I+Math.imul(X,vt)|0,I=I+Math.imul(Q,Tt)|0,F=F+Math.imul(Q,vt)|0,M=M+Math.imul(O,Lt)|0,I=I+Math.imul(O,bt)|0,I=I+Math.imul(se,Lt)|0,F=F+Math.imul(se,bt)|0;var tt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(tt>>>26)|0,tt&=67108863,M=Math.imul($e,ht),I=Math.imul($e,ft),I=I+Math.imul(Ie,ht)|0,F=Math.imul(Ie,ft),M=M+Math.imul(Me,Jt)|0,I=I+Math.imul(Me,St)|0,I=I+Math.imul(Ne,Jt)|0,F=F+Math.imul(Ne,St)|0,M=M+Math.imul(ie,Xt)|0,I=I+Math.imul(ie,Ot)|0,I=I+Math.imul(fe,Xt)|0,F=F+Math.imul(fe,Ot)|0,M=M+Math.imul(Z,Tt)|0,I=I+Math.imul(Z,vt)|0,I=I+Math.imul(te,Tt)|0,F=F+Math.imul(te,vt)|0,M=M+Math.imul(X,Lt)|0,I=I+Math.imul(X,bt)|0,I=I+Math.imul(Q,Lt)|0,F=F+Math.imul(Q,bt)|0,M=M+Math.imul(O,jt)|0,I=I+Math.imul(O,nt)|0,I=I+Math.imul(se,jt)|0,F=F+Math.imul(se,nt)|0;var At=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(At>>>26)|0,At&=67108863,M=Math.imul(Ve,ht),I=Math.imul(Ve,ft),I=I+Math.imul(ke,ht)|0,F=Math.imul(ke,ft),M=M+Math.imul($e,Jt)|0,I=I+Math.imul($e,St)|0,I=I+Math.imul(Ie,Jt)|0,F=F+Math.imul(Ie,St)|0,M=M+Math.imul(Me,Xt)|0,I=I+Math.imul(Me,Ot)|0,I=I+Math.imul(Ne,Xt)|0,F=F+Math.imul(Ne,Ot)|0,M=M+Math.imul(ie,Tt)|0,I=I+Math.imul(ie,vt)|0,I=I+Math.imul(fe,Tt)|0,F=F+Math.imul(fe,vt)|0,M=M+Math.imul(Z,Lt)|0,I=I+Math.imul(Z,bt)|0,I=I+Math.imul(te,Lt)|0,F=F+Math.imul(te,bt)|0,M=M+Math.imul(X,jt)|0,I=I+Math.imul(X,nt)|0,I=I+Math.imul(Q,jt)|0,F=F+Math.imul(Q,nt)|0,M=M+Math.imul(O,$)|0,I=I+Math.imul(O,W)|0,I=I+Math.imul(se,$)|0,F=F+Math.imul(se,W)|0;var Rt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,M=Math.imul(He,ht),I=Math.imul(He,ft),I=I+Math.imul(Se,ht)|0,F=Math.imul(Se,ft),M=M+Math.imul(Ve,Jt)|0,I=I+Math.imul(Ve,St)|0,I=I+Math.imul(ke,Jt)|0,F=F+Math.imul(ke,St)|0,M=M+Math.imul($e,Xt)|0,I=I+Math.imul($e,Ot)|0,I=I+Math.imul(Ie,Xt)|0,F=F+Math.imul(Ie,Ot)|0,M=M+Math.imul(Me,Tt)|0,I=I+Math.imul(Me,vt)|0,I=I+Math.imul(Ne,Tt)|0,F=F+Math.imul(Ne,vt)|0,M=M+Math.imul(ie,Lt)|0,I=I+Math.imul(ie,bt)|0,I=I+Math.imul(fe,Lt)|0,F=F+Math.imul(fe,bt)|0,M=M+Math.imul(Z,jt)|0,I=I+Math.imul(Z,nt)|0,I=I+Math.imul(te,jt)|0,F=F+Math.imul(te,nt)|0,M=M+Math.imul(X,$)|0,I=I+Math.imul(X,W)|0,I=I+Math.imul(Q,$)|0,F=F+Math.imul(Q,W)|0,M=M+Math.imul(O,C)|0,I=I+Math.imul(O,Y)|0,I=I+Math.imul(se,C)|0,F=F+Math.imul(se,Y)|0;var Mt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,M=Math.imul(ct,ht),I=Math.imul(ct,ft),I=I+Math.imul(Be,ht)|0,F=Math.imul(Be,ft),M=M+Math.imul(He,Jt)|0,I=I+Math.imul(He,St)|0,I=I+Math.imul(Se,Jt)|0,F=F+Math.imul(Se,St)|0,M=M+Math.imul(Ve,Xt)|0,I=I+Math.imul(Ve,Ot)|0,I=I+Math.imul(ke,Xt)|0,F=F+Math.imul(ke,Ot)|0,M=M+Math.imul($e,Tt)|0,I=I+Math.imul($e,vt)|0,I=I+Math.imul(Ie,Tt)|0,F=F+Math.imul(Ie,vt)|0,M=M+Math.imul(Me,Lt)|0,I=I+Math.imul(Me,bt)|0,I=I+Math.imul(Ne,Lt)|0,F=F+Math.imul(Ne,bt)|0,M=M+Math.imul(ie,jt)|0,I=I+Math.imul(ie,nt)|0,I=I+Math.imul(fe,jt)|0,F=F+Math.imul(fe,nt)|0,M=M+Math.imul(Z,$)|0,I=I+Math.imul(Z,W)|0,I=I+Math.imul(te,$)|0,F=F+Math.imul(te,W)|0,M=M+Math.imul(X,C)|0,I=I+Math.imul(X,Y)|0,I=I+Math.imul(Q,C)|0,F=F+Math.imul(Q,Y)|0,M=M+Math.imul(O,oe)|0,I=I+Math.imul(O,pe)|0,I=I+Math.imul(se,oe)|0,F=F+Math.imul(se,pe)|0;var Et=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Et>>>26)|0,Et&=67108863,M=Math.imul(rt,ht),I=Math.imul(rt,ft),I=I+Math.imul(Je,ht)|0,F=Math.imul(Je,ft),M=M+Math.imul(ct,Jt)|0,I=I+Math.imul(ct,St)|0,I=I+Math.imul(Be,Jt)|0,F=F+Math.imul(Be,St)|0,M=M+Math.imul(He,Xt)|0,I=I+Math.imul(He,Ot)|0,I=I+Math.imul(Se,Xt)|0,F=F+Math.imul(Se,Ot)|0,M=M+Math.imul(Ve,Tt)|0,I=I+Math.imul(Ve,vt)|0,I=I+Math.imul(ke,Tt)|0,F=F+Math.imul(ke,vt)|0,M=M+Math.imul($e,Lt)|0,I=I+Math.imul($e,bt)|0,I=I+Math.imul(Ie,Lt)|0,F=F+Math.imul(Ie,bt)|0,M=M+Math.imul(Me,jt)|0,I=I+Math.imul(Me,nt)|0,I=I+Math.imul(Ne,jt)|0,F=F+Math.imul(Ne,nt)|0,M=M+Math.imul(ie,$)|0,I=I+Math.imul(ie,W)|0,I=I+Math.imul(fe,$)|0,F=F+Math.imul(fe,W)|0,M=M+Math.imul(Z,C)|0,I=I+Math.imul(Z,Y)|0,I=I+Math.imul(te,C)|0,F=F+Math.imul(te,Y)|0,M=M+Math.imul(X,oe)|0,I=I+Math.imul(X,pe)|0,I=I+Math.imul(Q,oe)|0,F=F+Math.imul(Q,pe)|0,M=M+Math.imul(O,Re)|0,I=I+Math.imul(O,De)|0,I=I+Math.imul(se,Re)|0,F=F+Math.imul(se,De)|0;var dt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(dt>>>26)|0,dt&=67108863,M=Math.imul(rt,Jt),I=Math.imul(rt,St),I=I+Math.imul(Je,Jt)|0,F=Math.imul(Je,St),M=M+Math.imul(ct,Xt)|0,I=I+Math.imul(ct,Ot)|0,I=I+Math.imul(Be,Xt)|0,F=F+Math.imul(Be,Ot)|0,M=M+Math.imul(He,Tt)|0,I=I+Math.imul(He,vt)|0,I=I+Math.imul(Se,Tt)|0,F=F+Math.imul(Se,vt)|0,M=M+Math.imul(Ve,Lt)|0,I=I+Math.imul(Ve,bt)|0,I=I+Math.imul(ke,Lt)|0,F=F+Math.imul(ke,bt)|0,M=M+Math.imul($e,jt)|0,I=I+Math.imul($e,nt)|0,I=I+Math.imul(Ie,jt)|0,F=F+Math.imul(Ie,nt)|0,M=M+Math.imul(Me,$)|0,I=I+Math.imul(Me,W)|0,I=I+Math.imul(Ne,$)|0,F=F+Math.imul(Ne,W)|0,M=M+Math.imul(ie,C)|0,I=I+Math.imul(ie,Y)|0,I=I+Math.imul(fe,C)|0,F=F+Math.imul(fe,Y)|0,M=M+Math.imul(Z,oe)|0,I=I+Math.imul(Z,pe)|0,I=I+Math.imul(te,oe)|0,F=F+Math.imul(te,pe)|0,M=M+Math.imul(X,Re)|0,I=I+Math.imul(X,De)|0,I=I+Math.imul(Q,Re)|0,F=F+Math.imul(Q,De)|0;var _t=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(_t>>>26)|0,_t&=67108863,M=Math.imul(rt,Xt),I=Math.imul(rt,Ot),I=I+Math.imul(Je,Xt)|0,F=Math.imul(Je,Ot),M=M+Math.imul(ct,Tt)|0,I=I+Math.imul(ct,vt)|0,I=I+Math.imul(Be,Tt)|0,F=F+Math.imul(Be,vt)|0,M=M+Math.imul(He,Lt)|0,I=I+Math.imul(He,bt)|0,I=I+Math.imul(Se,Lt)|0,F=F+Math.imul(Se,bt)|0,M=M+Math.imul(Ve,jt)|0,I=I+Math.imul(Ve,nt)|0,I=I+Math.imul(ke,jt)|0,F=F+Math.imul(ke,nt)|0,M=M+Math.imul($e,$)|0,I=I+Math.imul($e,W)|0,I=I+Math.imul(Ie,$)|0,F=F+Math.imul(Ie,W)|0,M=M+Math.imul(Me,C)|0,I=I+Math.imul(Me,Y)|0,I=I+Math.imul(Ne,C)|0,F=F+Math.imul(Ne,Y)|0,M=M+Math.imul(ie,oe)|0,I=I+Math.imul(ie,pe)|0,I=I+Math.imul(fe,oe)|0,F=F+Math.imul(fe,pe)|0,M=M+Math.imul(Z,Re)|0,I=I+Math.imul(Z,De)|0,I=I+Math.imul(te,Re)|0,F=F+Math.imul(te,De)|0;var ot=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(ot>>>26)|0,ot&=67108863,M=Math.imul(rt,Tt),I=Math.imul(rt,vt),I=I+Math.imul(Je,Tt)|0,F=Math.imul(Je,vt),M=M+Math.imul(ct,Lt)|0,I=I+Math.imul(ct,bt)|0,I=I+Math.imul(Be,Lt)|0,F=F+Math.imul(Be,bt)|0,M=M+Math.imul(He,jt)|0,I=I+Math.imul(He,nt)|0,I=I+Math.imul(Se,jt)|0,F=F+Math.imul(Se,nt)|0,M=M+Math.imul(Ve,$)|0,I=I+Math.imul(Ve,W)|0,I=I+Math.imul(ke,$)|0,F=F+Math.imul(ke,W)|0,M=M+Math.imul($e,C)|0,I=I+Math.imul($e,Y)|0,I=I+Math.imul(Ie,C)|0,F=F+Math.imul(Ie,Y)|0,M=M+Math.imul(Me,oe)|0,I=I+Math.imul(Me,pe)|0,I=I+Math.imul(Ne,oe)|0,F=F+Math.imul(Ne,pe)|0,M=M+Math.imul(ie,Re)|0,I=I+Math.imul(ie,De)|0,I=I+Math.imul(fe,Re)|0,F=F+Math.imul(fe,De)|0;var wt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(wt>>>26)|0,wt&=67108863,M=Math.imul(rt,Lt),I=Math.imul(rt,bt),I=I+Math.imul(Je,Lt)|0,F=Math.imul(Je,bt),M=M+Math.imul(ct,jt)|0,I=I+Math.imul(ct,nt)|0,I=I+Math.imul(Be,jt)|0,F=F+Math.imul(Be,nt)|0,M=M+Math.imul(He,$)|0,I=I+Math.imul(He,W)|0,I=I+Math.imul(Se,$)|0,F=F+Math.imul(Se,W)|0,M=M+Math.imul(Ve,C)|0,I=I+Math.imul(Ve,Y)|0,I=I+Math.imul(ke,C)|0,F=F+Math.imul(ke,Y)|0,M=M+Math.imul($e,oe)|0,I=I+Math.imul($e,pe)|0,I=I+Math.imul(Ie,oe)|0,F=F+Math.imul(Ie,pe)|0,M=M+Math.imul(Me,Re)|0,I=I+Math.imul(Me,De)|0,I=I+Math.imul(Ne,Re)|0,F=F+Math.imul(Ne,De)|0;var lt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(lt>>>26)|0,lt&=67108863,M=Math.imul(rt,jt),I=Math.imul(rt,nt),I=I+Math.imul(Je,jt)|0,F=Math.imul(Je,nt),M=M+Math.imul(ct,$)|0,I=I+Math.imul(ct,W)|0,I=I+Math.imul(Be,$)|0,F=F+Math.imul(Be,W)|0,M=M+Math.imul(He,C)|0,I=I+Math.imul(He,Y)|0,I=I+Math.imul(Se,C)|0,F=F+Math.imul(Se,Y)|0,M=M+Math.imul(Ve,oe)|0,I=I+Math.imul(Ve,pe)|0,I=I+Math.imul(ke,oe)|0,F=F+Math.imul(ke,pe)|0,M=M+Math.imul($e,Re)|0,I=I+Math.imul($e,De)|0,I=I+Math.imul(Ie,Re)|0,F=F+Math.imul(Ie,De)|0;var at=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(at>>>26)|0,at&=67108863,M=Math.imul(rt,$),I=Math.imul(rt,W),I=I+Math.imul(Je,$)|0,F=Math.imul(Je,W),M=M+Math.imul(ct,C)|0,I=I+Math.imul(ct,Y)|0,I=I+Math.imul(Be,C)|0,F=F+Math.imul(Be,Y)|0,M=M+Math.imul(He,oe)|0,I=I+Math.imul(He,pe)|0,I=I+Math.imul(Se,oe)|0,F=F+Math.imul(Se,pe)|0,M=M+Math.imul(Ve,Re)|0,I=I+Math.imul(Ve,De)|0,I=I+Math.imul(ke,Re)|0,F=F+Math.imul(ke,De)|0;var Ae=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,M=Math.imul(rt,C),I=Math.imul(rt,Y),I=I+Math.imul(Je,C)|0,F=Math.imul(Je,Y),M=M+Math.imul(ct,oe)|0,I=I+Math.imul(ct,pe)|0,I=I+Math.imul(Be,oe)|0,F=F+Math.imul(Be,pe)|0,M=M+Math.imul(He,Re)|0,I=I+Math.imul(He,De)|0,I=I+Math.imul(Se,Re)|0,F=F+Math.imul(Se,De)|0;var Pe=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,M=Math.imul(rt,oe),I=Math.imul(rt,pe),I=I+Math.imul(Je,oe)|0,F=Math.imul(Je,pe),M=M+Math.imul(ct,Re)|0,I=I+Math.imul(ct,De)|0,I=I+Math.imul(Be,Re)|0,F=F+Math.imul(Be,De)|0;var Ge=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,M=Math.imul(rt,Re),I=Math.imul(rt,De),I=I+Math.imul(Je,Re)|0,F=Math.imul(Je,De);var je=(b+M|0)+((I&8191)<<13)|0;return b=(F+(I>>>13)|0)+(je>>>26)|0,je&=67108863,S[0]=it,S[1]=Ue,S[2]=gt,S[3]=st,S[4]=tt,S[5]=At,S[6]=Rt,S[7]=Mt,S[8]=Et,S[9]=dt,S[10]=_t,S[11]=ot,S[12]=wt,S[13]=lt,S[14]=at,S[15]=Ae,S[16]=Pe,S[17]=Ge,S[18]=je,b!==0&&(S[19]=b,v.length++),v};Math.imul||(B=k);function q(m,f,g){g.negative=f.negative^m.negative,g.length=m.length+f.length;for(var v=0,x=0,_=0;_>>26)|0,x+=S>>>26,S&=67108863}g.words[_]=b,v=S,S=x}return v!==0?g.words[_]=v:g.length--,g._strip()}function j(m,f,g){return q(m,f,g)}s.prototype.mulTo=function(f,g){var v,x=this.length+f.length;return this.length===10&&f.length===10?v=B(this,f,g):x<63?v=k(this,f,g):x<1024?v=q(this,f,g):v=j(this,f,g),v},s.prototype.mul=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),this.mulTo(f,g)},s.prototype.mulf=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),j(this,f,g)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var g=f<0;g&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var v=0,x=0;x>=26,v+=_/67108864|0,v+=S>>>26,this.words[x]=S&67108863}return v!==0&&(this.words[x]=v,this.length++),g?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var g=D(f);if(g.length===0)return new s(1);for(var v=this,x=0;x=0);var g=f%26,v=(f-g)/26,x=67108863>>>26-g<<26-g,_;if(g!==0){var S=0;for(_=0;_>>26-g}S&&(this.words[_]=S,this.length++)}if(v!==0){for(_=this.length-1;_>=0;_--)this.words[_+v]=this.words[_];for(_=0;_=0);var x;g?x=(g-g%26)/26:x=0;var _=f%26,S=Math.min((f-_)/26,this.length),b=67108863^67108863>>>_<<_,M=v;if(x-=S,x=Math.max(0,x),M){for(var I=0;IS)for(this.length-=S,I=0;I=0&&(F!==0||I>=x);I--){var ae=this.words[I]|0;this.words[I]=F<<26-_|ae>>>_,F=ae&b}return M&&F!==0&&(M.words[M.length++]=F),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,g,v){return n(this.negative===0),this.iushrn(f,g,v)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var g=f%26,v=(f-g)/26,x=1<=0);var g=f%26,v=(f-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(g!==0&&v++,this.length=Math.min(v,this.length),g!==0){var x=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(M/67108864|0),this.words[_+v]=S&67108863}for(;_>26,this.words[_+v]=S&67108863;if(b===0)return this._strip();for(n(b===-1),b=0,_=0;_>26,this.words[_]=S&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,g){var v=this.length-f.length,x=this.clone(),_=f,S=_.words[_.length-1]|0,b=this._countBits(S);v=26-b,v!==0&&(_=_.ushln(v),x.iushln(v),S=_.words[_.length-1]|0);var M=x.length-_.length,I;if(g!=="mod"){I=new s(null),I.length=M+1,I.words=new Array(I.length);for(var F=0;F=0;O--){var se=(x.words[_.length+O]|0)*67108864+(x.words[_.length+O-1]|0);for(se=Math.min(se/S|0,67108863),x._ishlnsubmul(_,se,O);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(_,1,O),x.isZero()||(x.negative^=1);I&&(I.words[O]=se)}return I&&I._strip(),x._strip(),g!=="div"&&v!==0&&x.iushrn(v),{div:I||null,mod:x}},s.prototype.divmod=function(f,g,v){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,_,S;return this.negative!==0&&f.negative===0?(S=this.neg().divmod(f,g),g!=="mod"&&(x=S.div.neg()),g!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.iadd(f)),{div:x,mod:_}):this.negative===0&&f.negative!==0?(S=this.divmod(f.neg(),g),g!=="mod"&&(x=S.div.neg()),{div:x,mod:S.mod}):this.negative&f.negative?(S=this.neg().divmod(f.neg(),g),g!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.isub(f)),{div:S.div,mod:_}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?g==="div"?{div:this.divn(f.words[0]),mod:null}:g==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,g)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var g=this.divmod(f);if(g.mod.isZero())return g.div;var v=g.div.negative!==0?g.mod.isub(f):g.mod,x=f.ushrn(1),_=f.andln(1),S=v.cmp(x);return S<0||_===1&&S===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},s.prototype.modrn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=(1<<26)%f,x=0,_=this.length-1;_>=0;_--)x=(v*x+(this.words[_]|0))%f;return g?-x:x},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=0,x=this.length-1;x>=0;x--){var _=(this.words[x]|0)+v*67108864;this.words[x]=_/f|0,v=_%f}return this._strip(),g?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),_=new s(0),S=new s(0),b=new s(1),M=0;g.isEven()&&v.isEven();)g.iushrn(1),v.iushrn(1),++M;for(var I=v.clone(),F=g.clone();!g.isZero();){for(var ae=0,O=1;!(g.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(g.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(I),_.isub(F)),x.iushrn(1),_.iushrn(1);for(var se=0,ee=1;!(v.words[0]&ee)&&se<26;++se,ee<<=1);if(se>0)for(v.iushrn(se);se-- >0;)(S.isOdd()||b.isOdd())&&(S.iadd(I),b.isub(F)),S.iushrn(1),b.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(S),_.isub(b)):(v.isub(g),S.isub(x),b.isub(_))}return{a:S,b,gcd:v.iushln(M)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),_=new s(0),S=v.clone();g.cmpn(1)>0&&v.cmpn(1)>0;){for(var b=0,M=1;!(g.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(g.iushrn(b);b-- >0;)x.isOdd()&&x.iadd(S),x.iushrn(1);for(var I=0,F=1;!(v.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(v.iushrn(I);I-- >0;)_.isOdd()&&_.iadd(S),_.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(_)):(v.isub(g),_.isub(x))}var ae;return g.cmpn(1)===0?ae=x:ae=_,ae.cmpn(0)<0&&ae.iadd(f),ae},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var g=this.clone(),v=f.clone();g.negative=0,v.negative=0;for(var x=0;g.isEven()&&v.isEven();x++)g.iushrn(1),v.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;v.isEven();)v.iushrn(1);var _=g.cmp(v);if(_<0){var S=g;g=v,v=S}else if(_===0||v.cmpn(1)===0)break;g.isub(v)}while(!0);return v.iushln(x)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var g=f%26,v=(f-g)/26,x=1<>>26,b&=67108863,this.words[S]=b}return _!==0&&(this.words[S]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var g=f<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var v;if(this.length>1)v=1;else{g&&(f=-f),n(f<=67108863,"Number is too big");var x=this.words[0]|0;v=x===f?0:xf.length)return 1;if(this.length=0;v--){var x=this.words[v]|0,_=f.words[v]|0;if(x!==_){x<_?g=-1:x>_&&(g=1);break}}return g},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new G(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var H={k256:null,p224:null,p192:null,p25519:null};function J(m,f){this.name=m,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}J.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},J.prototype.ireduce=function(f){var g=f,v;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),v=g.bitLength();while(v>this.n);var x=v0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},J.prototype.split=function(f,g){f.iushrn(this.n,0,g)},J.prototype.imulK=function(f){return f.imul(this.k)};function T(){J.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(T,J),T.prototype.split=function(f,g){for(var v=4194303,x=Math.min(f.length,9),_=0;_>>22,S=b}S>>>=22,f.words[_-10]=S,S===0&&f.length>10?f.length-=10:f.length-=9},T.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var g=0,v=0;v>>=26,f.words[v]=_,g=x}return g!==0&&(f.words[f.length++]=g),f},s._prime=function(f){if(H[f])return H[f];var g;if(f==="k256")g=new T;else if(f==="p224")g=new z;else if(f==="p192")g=new ue;else if(f==="p25519")g=new _e;else throw new Error("Unknown prime "+f);return H[f]=g,g};function G(m){if(typeof m=="string"){var f=s._prime(m);this.m=f.p,this.prime=f}else n(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}G.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},G.prototype._verify2=function(f,g){n((f.negative|g.negative)===0,"red works only with positives"),n(f.red&&f.red===g.red,"red works only with red numbers")},G.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(d(f,f.umod(this.m)._forceRed(this)),f)},G.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},G.prototype.add=function(f,g){this._verify2(f,g);var v=f.add(g);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},G.prototype.iadd=function(f,g){this._verify2(f,g);var v=f.iadd(g);return v.cmp(this.m)>=0&&v.isub(this.m),v},G.prototype.sub=function(f,g){this._verify2(f,g);var v=f.sub(g);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},G.prototype.isub=function(f,g){this._verify2(f,g);var v=f.isub(g);return v.cmpn(0)<0&&v.iadd(this.m),v},G.prototype.shl=function(f,g){return this._verify1(f),this.imod(f.ushln(g))},G.prototype.imul=function(f,g){return this._verify2(f,g),this.imod(f.imul(g))},G.prototype.mul=function(f,g){return this._verify2(f,g),this.imod(f.mul(g))},G.prototype.isqr=function(f){return this.imul(f,f.clone())},G.prototype.sqr=function(f){return this.mul(f,f)},G.prototype.sqrt=function(f){if(f.isZero())return f.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(f,v)}for(var x=this.m.subn(1),_=0;!x.isZero()&&x.andln(1)===0;)_++,x.iushrn(1);n(!x.isZero());var S=new s(1).toRed(this),b=S.redNeg(),M=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,M).cmp(b)!==0;)I.redIAdd(b);for(var F=this.pow(I,x),ae=this.pow(f,x.addn(1).iushrn(1)),O=this.pow(f,x),se=_;O.cmp(S)!==0;){for(var ee=O,X=0;ee.cmp(S)!==0;X++)ee=ee.redSqr();n(X=0;_--){for(var F=g.words[_],ae=I-1;ae>=0;ae--){var O=F>>ae&1;if(S!==x[0]&&(S=this.sqr(S)),O===0&&b===0){M=0;continue}b<<=1,b|=O,M++,!(M!==v&&(_!==0||ae!==0))&&(S=this.mul(S,x[b]),M=0,b=0)}I=26}return S},G.prototype.convertTo=function(f){var g=f.umod(this.m);return g===f?g.clone():g},G.prototype.convertFrom=function(f){var g=f.clone();return g.red=null,g},s.mont=function(f){return new E(f)};function E(m){G.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(E,G),E.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},E.prototype.convertFrom=function(f){var g=this.imod(f.mul(this.rinv));return g.red=null,g},E.prototype.imul=function(f,g){if(f.isZero()||g.isZero())return f.words[0]=0,f.length=1,f;var v=f.imul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.mul=function(f,g){if(f.isZero()||g.isZero())return new s(0)._forceRed(this);var v=f.mul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.invm=function(f){var g=this.imod(f._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,nn)}(Sm);var _N=Sm.exports;const rr=ji(_N);var EN=rr.BN;function SN(t){return new EN(t,36).toString(16)}const AN="strings/5.7.0",PN=new Kr(AN);var bd;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(bd||(bd={}));var qx;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(qx||(qx={}));function Am(t,e=bd.current){e!=bd.current&&(PN.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return bn(r)}const MN=`Ethereum Signed Message: +`;function zx(t){return typeof t=="string"&&(t=Am(t)),Em(yN([Am(MN),Am(String(t.length)),t]))}const IN="address/5.7.0",sl=new Kr(IN);function Hx(t){Ns(t,20)||sl.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=bn(Em(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const CN=9007199254740991;function TN(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const Pm={};for(let t=0;t<10;t++)Pm[String(t)]=String(t);for(let t=0;t<26;t++)Pm[String.fromCharCode(65+t)]=String(10+t);const Wx=Math.floor(TN(CN));function RN(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Pm[n]).join("");for(;e.length>=Wx;){let n=e.substring(0,Wx);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function DN(t){let e=null;if(typeof t!="string"&&sl.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=Hx(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&sl.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==RN(t)&&sl.throwArgumentError("bad icap checksum","address",t),e=SN(t.substring(4));e.length<40;)e="0"+e;e=Hx("0x"+e)}else sl.throwArgumentError("invalid address","address",t);return e}function ol(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var al={},yr={},Ga=Kx;function Kx(t,e){if(!t)throw new Error(e||"Assertion failed")}Kx.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var Mm={exports:{}};typeof Object.create=="function"?Mm.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Mm.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var yd=Mm.exports,ON=Ga,NN=yd;yr.inherits=NN;function LN(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function kN(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):LN(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}yr.htonl=Vx;function $N(t,e){for(var r="",n=0;n>>0}return s}yr.join32=FN;function jN(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}yr.split32=jN;function UN(t,e){return t>>>e|t<<32-e}yr.rotr32=UN;function qN(t,e){return t<>>32-e}yr.rotl32=qN;function zN(t,e){return t+e>>>0}yr.sum32=zN;function HN(t,e,r){return t+e+r>>>0}yr.sum32_3=HN;function WN(t,e,r,n){return t+e+r+n>>>0}yr.sum32_4=WN;function KN(t,e,r,n,i){return t+e+r+n+i>>>0}yr.sum32_5=KN;function VN(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}yr.sum64=VN;function GN(t,e,r,n){var i=e+n>>>0,s=(i>>0}yr.sum64_hi=GN;function YN(t,e,r,n){var i=e+n;return i>>>0}yr.sum64_lo=YN;function JN(t,e,r,n,i,s,o,a){var u=0,l=e;l=l+n>>>0,u+=l>>0,u+=l>>0,u+=l>>0}yr.sum64_4_hi=JN;function XN(t,e,r,n,i,s,o,a){var u=e+n+s+a;return u>>>0}yr.sum64_4_lo=XN;function ZN(t,e,r,n,i,s,o,a,u,l){var d=0,p=e;p=p+n>>>0,d+=p>>0,d+=p>>0,d+=p>>0,d+=p>>0}yr.sum64_5_hi=ZN;function QN(t,e,r,n,i,s,o,a,u,l){var d=e+n+s+a+l;return d>>>0}yr.sum64_5_lo=QN;function eL(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}yr.rotr64_hi=eL;function tL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.rotr64_lo=tL;function rL(t,e,r){return t>>>r}yr.shr64_hi=rL;function nL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.shr64_lo=nL;var hu={},Jx=yr,iL=Ga;function wd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}hu.BlockHash=wd,wd.prototype.update=function(e,r){if(e=Jx.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Jx.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}Ls.g0_256=uL;function fL(t){return ks(t,17)^ks(t,19)^t>>>10}Ls.g1_256=fL;var pu=yr,lL=hu,hL=Ls,Im=pu.rotl32,cl=pu.sum32,dL=pu.sum32_5,pL=hL.ft_1,e3=lL.BlockHash,gL=[1518500249,1859775393,2400959708,3395469782];function Bs(){if(!(this instanceof Bs))return new Bs;e3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}pu.inherits(Bs,e3);var mL=Bs;Bs.blockSize=512,Bs.outSize=160,Bs.hmacStrength=80,Bs.padLength=64,Bs.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),nk(e.length<=this.blockSize);for(var r=e.length;r>8,y=d&255;p?u.push(p,y):u.push(y)}return u}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",u=0;u(y>>1)-1?N=(y>>1)-D:N=D,A.isubn(N)):N=0,p[P]=N,A.iushrn(1)}return p}r.getNAF=n;function i(u,l){var d=[[],[]];u=u.clone(),l=l.clone();for(var p=0,y=0,A;u.cmpn(-p)>0||l.cmpn(-y)>0;){var P=u.andln(3)+p&3,N=l.andln(3)+y&3;P===3&&(P=-1),N===3&&(N=-1);var D;P&1?(A=u.andln(7)+p&7,(A===3||A===5)&&N===2?D=-P:D=P):D=0,d[0].push(D);var k;N&1?(A=l.andln(7)+y&7,(A===3||A===5)&&P===2?k=-N:k=N):k=0,d[1].push(k),2*p===D+1&&(p=1-p),2*y===k+1&&(y=1-y),u.iushrn(1),l.iushrn(1)}return d}r.getJSF=i;function s(u,l,d){var p="_"+l;u.prototype[l]=function(){return this[p]!==void 0?this[p]:this[p]=d.call(this)}}r.cachedProperty=s;function o(u){return typeof u=="string"?r.toArray(u,"hex"):u}r.parseBytes=o;function a(u){return new rr(u,"hex","le")}r.intFromLE=a}),_d=Ci.getNAF,ok=Ci.getJSF,Ed=Ci.assert;function na(t,e){this.type=t,this.p=new rr(e.p,16),this.red=e.prime?rr.red(e.prime):rr.mont(this.p),this.zero=new rr(0).toRed(this.red),this.one=new rr(1).toRed(this.red),this.two=new rr(2).toRed(this.red),this.n=e.n&&new rr(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ja=na;na.prototype.point=function(){throw new Error("Not implemented")},na.prototype.validate=function(){throw new Error("Not implemented")},na.prototype._fixedNafMul=function(e,r){Ed(e.precomputed);var n=e._getDoubles(),i=_d(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Ed(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},na.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=_d(n[P],o[P],this._bitLength),u[N]=_d(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=ok(n[P],n[N]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[N]=new Array(l),p=0;p=0;d--){for(var T=0;d>=0;){var z=!0;for(p=0;p=0&&T++,H=H.dblp(T),d<0)break;for(p=0;p0?y=a[p][ue-1>>1]:ue<0&&(y=a[p][-ue-1>>1].neg()),y.type==="affine"?H=H.mixedAdd(y):H=H.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},zi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),p.negative&&(p=p.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:p,b:y},{a:A,b:P}]},Hi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Hi.prototype.pointFromX=function(e,r){e=new rr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Hi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Hi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},On.prototype.isInfinity=function(){return this.inf},On.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},On.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},On.prototype.getX=function(){return this.x.fromRed()},On.prototype.getY=function(){return this.y.fromRed()},On.prototype.mul=function(e){return e=new rr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},On.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},On.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},On.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},On.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},On.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Un(t,e,r,n){Ja.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new rr(0)):(this.x=new rr(e,16),this.y=new rr(r,16),this.z=new rr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Nm(Un,Ja.BasePoint),Hi.prototype.jpoint=function(e,r,n){return new Un(this,e,r,n)},Un.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},Un.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Un.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(p).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(p)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},Un.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),A=u.redMul(p.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},Un.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},Un.prototype.inspect=function(){return this.isInfinity()?"":""},Un.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Sd=bu(function(t,e){var r=e;r.base=Ja,r.short=ck,r.mont=null,r.edwards=null}),Ad=bu(function(t,e){var r=e,n=Ci.assert;function i(a){a.type==="short"?this.curve=new Sd.short(a):a.type==="edwards"?this.curve=new Sd.edwards(a):this.curve=new Sd.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,u){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(u);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:wo.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:wo.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:wo.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:wo.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:wo.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:wo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function ia(t){if(!(this instanceof ia))return new ia(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=vs.toArray(t.entropy,t.entropyEnc||"hex"),r=vs.toArray(t.nonce,t.nonceEnc||"hex"),n=vs.toArray(t.pers,t.persEnc||"hex");Om(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var g3=ia;ia.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ia.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=vs.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var uk=Ci.assert;function Pd(t,e){if(t instanceof Pd)return t;this._importDER(t,e)||(uk(t.r&&t.s,"Signature without r or s"),this.r=new rr(t.r,16),this.s=new rr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Md=Pd;function fk(){this.place=0}function Bm(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function m3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Pd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=m3(r),n=m3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];$m(i,r.length),i=i.concat(r),i.push(2),$m(i,n.length);var s=i.concat(n),o=[48];return $m(o,s.length),o=o.concat(s),Ci.encode(o,e)};var lk=function(){throw new Error("unsupported")},v3=Ci.assert;function Wi(t){if(!(this instanceof Wi))return new Wi(t);typeof t=="string"&&(v3(Object.prototype.hasOwnProperty.call(Ad,t),"Unknown curve "+t),t=Ad[t]),t instanceof Ad.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var hk=Wi;Wi.prototype.keyPair=function(e){return new km(this,e)},Wi.prototype.keyFromPrivate=function(e,r){return km.fromPrivate(this,e,r)},Wi.prototype.keyFromPublic=function(e,r){return km.fromPublic(this,e,r)},Wi.prototype.genKeyPair=function(e){e||(e={});for(var r=new g3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||lk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new rr(2));;){var s=new rr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Wi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Wi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new rr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new g3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new rr(1)),d=0;;d++){var p=i.k?i.k(d):new rr(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new Md({r:P,s:N,recoveryParam:D})}}}}}},Wi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new rr(e,16)),n=this.keyFromPublic(n,i),r=new Md(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),u=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.eqXToP(s)):(d=this.g.mulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.getX().umod(this.n).cmp(s)===0)},Wi.prototype.recoverPubKey=function(t,e,r,n){v3((3&r)===r,"The recovery param is more than two bits"),e=new Md(e,n);var i=this.n,s=new rr(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Wi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Md(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dk=bu(function(t,e){var r=e;r.version="6.5.4",r.utils=Ci,r.rand=function(){throw new Error("unsupported")},r.curve=Sd,r.curves=Ad,r.ec=hk,r.eddsa=null}),pk=dk.ec;const gk="signing-key/5.7.0",Fm=new Kr(gk);let jm=null;function sa(){return jm||(jm=new pk("secp256k1")),jm}class mk{constructor(e){ol(this,"curve","secp256k1"),ol(this,"privateKey",Ii(e)),xN(this.privateKey)!==32&&Fm.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=sa().keyFromPrivate(bn(this.privateKey));ol(this,"publicKey","0x"+r.getPublic(!1,"hex")),ol(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ol(this,"_isSigningKey",!0)}_addPoint(e){const r=sa().keyFromPublic(bn(this.publicKey)),n=sa().keyFromPublic(bn(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=sa().keyFromPrivate(bn(this.privateKey)),n=bn(e);n.length!==32&&Fm.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Ux({recoveryParam:i.recoveryParam,r:lu("0x"+i.r.toString(16),32),s:lu("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=sa().keyFromPrivate(bn(this.privateKey)),n=sa().keyFromPublic(bn(b3(e)));return lu("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function vk(t,e){const r=Ux(e),n={r:bn(r.r),s:bn(r.s)};return"0x"+sa().recoverPubKey(bn(t),n,r.recoveryParam).encode("hex",!1)}function b3(t,e){const r=bn(t);return r.length===32?new mk(r).publicKey:r.length===33?"0x"+sa().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?Ii(r):Fm.throwArgumentError("invalid public or private key","key","[REDACTED]")}var y3;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(y3||(y3={}));function bk(t){const e=b3(t);return DN(jx(Em(jx(e,1)),12))}function yk(t,e){return bk(vk(bn(t),e))}var Um={},Id={};Object.defineProperty(Id,"__esModule",{value:!0});var Yn=or,qm=Mi,wk=20;function xk(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],p=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],P=r[31]<<24|r[30]<<16|r[29]<<8|r[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],k=e[11]<<24|e[10]<<16|e[9]<<8|e[8],B=e[15]<<24|e[14]<<16|e[13]<<8|e[12],q=n,j=i,H=s,J=o,T=a,z=u,ue=l,_e=d,G=p,E=y,m=A,f=P,g=N,v=D,x=k,_=B,S=0;S>>16|g<<16,G=G+g|0,T^=G,T=T>>>20|T<<12,j=j+z|0,v^=j,v=v>>>16|v<<16,E=E+v|0,z^=E,z=z>>>20|z<<12,H=H+ue|0,x^=H,x=x>>>16|x<<16,m=m+x|0,ue^=m,ue=ue>>>20|ue<<12,J=J+_e|0,_^=J,_=_>>>16|_<<16,f=f+_|0,_e^=f,_e=_e>>>20|_e<<12,H=H+ue|0,x^=H,x=x>>>24|x<<8,m=m+x|0,ue^=m,ue=ue>>>25|ue<<7,J=J+_e|0,_^=J,_=_>>>24|_<<8,f=f+_|0,_e^=f,_e=_e>>>25|_e<<7,j=j+z|0,v^=j,v=v>>>24|v<<8,E=E+v|0,z^=E,z=z>>>25|z<<7,q=q+T|0,g^=q,g=g>>>24|g<<8,G=G+g|0,T^=G,T=T>>>25|T<<7,q=q+z|0,_^=q,_=_>>>16|_<<16,m=m+_|0,z^=m,z=z>>>20|z<<12,j=j+ue|0,g^=j,g=g>>>16|g<<16,f=f+g|0,ue^=f,ue=ue>>>20|ue<<12,H=H+_e|0,v^=H,v=v>>>16|v<<16,G=G+v|0,_e^=G,_e=_e>>>20|_e<<12,J=J+T|0,x^=J,x=x>>>16|x<<16,E=E+x|0,T^=E,T=T>>>20|T<<12,H=H+_e|0,v^=H,v=v>>>24|v<<8,G=G+v|0,_e^=G,_e=_e>>>25|_e<<7,J=J+T|0,x^=J,x=x>>>24|x<<8,E=E+x|0,T^=E,T=T>>>25|T<<7,j=j+ue|0,g^=j,g=g>>>24|g<<8,f=f+g|0,ue^=f,ue=ue>>>25|ue<<7,q=q+z|0,_^=q,_=_>>>24|_<<8,m=m+_|0,z^=m,z=z>>>25|z<<7;Yn.writeUint32LE(q+n|0,t,0),Yn.writeUint32LE(j+i|0,t,4),Yn.writeUint32LE(H+s|0,t,8),Yn.writeUint32LE(J+o|0,t,12),Yn.writeUint32LE(T+a|0,t,16),Yn.writeUint32LE(z+u|0,t,20),Yn.writeUint32LE(ue+l|0,t,24),Yn.writeUint32LE(_e+d|0,t,28),Yn.writeUint32LE(G+p|0,t,32),Yn.writeUint32LE(E+y|0,t,36),Yn.writeUint32LE(m+A|0,t,40),Yn.writeUint32LE(f+P|0,t,44),Yn.writeUint32LE(g+N|0,t,48),Yn.writeUint32LE(v+D|0,t,52),Yn.writeUint32LE(x+k|0,t,56),Yn.writeUint32LE(_+B|0,t,60)}function w3(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var x3={},oa={};Object.defineProperty(oa,"__esModule",{value:!0});function Sk(t,e,r){return~(t-1)&e|t-1&r}oa.select=Sk;function Ak(t,e){return(t|0)-(e|0)-1>>>31&1}oa.lessOrEqual=Ak;function _3(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}oa.compare=_3;function Pk(t,e){return t.length===0||e.length===0?!1:_3(t,e)!==0}oa.equal=Pk,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=oa,r=Mi;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var u=a[0]|a[1]<<8;this._r[0]=u&8191;var l=a[2]|a[3]<<8;this._r[1]=(u>>>13|l<<3)&8191;var d=a[4]|a[5]<<8;this._r[2]=(l>>>10|d<<6)&7939;var p=a[6]|a[7]<<8;this._r[3]=(d>>>7|p<<9)&8191;var y=a[8]|a[9]<<8;this._r[4]=(p>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var A=a[10]|a[11]<<8;this._r[6]=(y>>>14|A<<2)&8191;var P=a[12]|a[13]<<8;this._r[7]=(A>>>11|P<<5)&8065;var N=a[14]|a[15]<<8;this._r[8]=(P>>>8|N<<8)&8191,this._r[9]=N>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,u,l){for(var d=this._fin?0:2048,p=this._h[0],y=this._h[1],A=this._h[2],P=this._h[3],N=this._h[4],D=this._h[5],k=this._h[6],B=this._h[7],q=this._h[8],j=this._h[9],H=this._r[0],J=this._r[1],T=this._r[2],z=this._r[3],ue=this._r[4],_e=this._r[5],G=this._r[6],E=this._r[7],m=this._r[8],f=this._r[9];l>=16;){var g=a[u+0]|a[u+1]<<8;p+=g&8191;var v=a[u+2]|a[u+3]<<8;y+=(g>>>13|v<<3)&8191;var x=a[u+4]|a[u+5]<<8;A+=(v>>>10|x<<6)&8191;var _=a[u+6]|a[u+7]<<8;P+=(x>>>7|_<<9)&8191;var S=a[u+8]|a[u+9]<<8;N+=(_>>>4|S<<12)&8191,D+=S>>>1&8191;var b=a[u+10]|a[u+11]<<8;k+=(S>>>14|b<<2)&8191;var M=a[u+12]|a[u+13]<<8;B+=(b>>>11|M<<5)&8191;var I=a[u+14]|a[u+15]<<8;q+=(M>>>8|I<<8)&8191,j+=I>>>5|d;var F=0,ae=F;ae+=p*H,ae+=y*(5*f),ae+=A*(5*m),ae+=P*(5*E),ae+=N*(5*G),F=ae>>>13,ae&=8191,ae+=D*(5*_e),ae+=k*(5*ue),ae+=B*(5*z),ae+=q*(5*T),ae+=j*(5*J),F+=ae>>>13,ae&=8191;var O=F;O+=p*J,O+=y*H,O+=A*(5*f),O+=P*(5*m),O+=N*(5*E),F=O>>>13,O&=8191,O+=D*(5*G),O+=k*(5*_e),O+=B*(5*ue),O+=q*(5*z),O+=j*(5*T),F+=O>>>13,O&=8191;var se=F;se+=p*T,se+=y*J,se+=A*H,se+=P*(5*f),se+=N*(5*m),F=se>>>13,se&=8191,se+=D*(5*E),se+=k*(5*G),se+=B*(5*_e),se+=q*(5*ue),se+=j*(5*z),F+=se>>>13,se&=8191;var ee=F;ee+=p*z,ee+=y*T,ee+=A*J,ee+=P*H,ee+=N*(5*f),F=ee>>>13,ee&=8191,ee+=D*(5*m),ee+=k*(5*E),ee+=B*(5*G),ee+=q*(5*_e),ee+=j*(5*ue),F+=ee>>>13,ee&=8191;var X=F;X+=p*ue,X+=y*z,X+=A*T,X+=P*J,X+=N*H,F=X>>>13,X&=8191,X+=D*(5*f),X+=k*(5*m),X+=B*(5*E),X+=q*(5*G),X+=j*(5*_e),F+=X>>>13,X&=8191;var Q=F;Q+=p*_e,Q+=y*ue,Q+=A*z,Q+=P*T,Q+=N*J,F=Q>>>13,Q&=8191,Q+=D*H,Q+=k*(5*f),Q+=B*(5*m),Q+=q*(5*E),Q+=j*(5*G),F+=Q>>>13,Q&=8191;var R=F;R+=p*G,R+=y*_e,R+=A*ue,R+=P*z,R+=N*T,F=R>>>13,R&=8191,R+=D*J,R+=k*H,R+=B*(5*f),R+=q*(5*m),R+=j*(5*E),F+=R>>>13,R&=8191;var Z=F;Z+=p*E,Z+=y*G,Z+=A*_e,Z+=P*ue,Z+=N*z,F=Z>>>13,Z&=8191,Z+=D*T,Z+=k*J,Z+=B*H,Z+=q*(5*f),Z+=j*(5*m),F+=Z>>>13,Z&=8191;var te=F;te+=p*m,te+=y*E,te+=A*G,te+=P*_e,te+=N*ue,F=te>>>13,te&=8191,te+=D*z,te+=k*T,te+=B*J,te+=q*H,te+=j*(5*f),F+=te>>>13,te&=8191;var le=F;le+=p*f,le+=y*m,le+=A*E,le+=P*G,le+=N*_e,F=le>>>13,le&=8191,le+=D*ue,le+=k*z,le+=B*T,le+=q*J,le+=j*H,F+=le>>>13,le&=8191,F=(F<<2)+F|0,F=F+ae|0,ae=F&8191,F=F>>>13,O+=F,p=ae,y=O,A=se,P=ee,N=X,D=Q,k=R,B=Z,q=te,j=le,u+=16,l-=16}this._h[0]=p,this._h[1]=y,this._h[2]=A,this._h[3]=P,this._h[4]=N,this._h[5]=D,this._h[6]=k,this._h[7]=B,this._h[8]=q,this._h[9]=j},o.prototype.finish=function(a,u){u===void 0&&(u=0);var l=new Uint16Array(10),d,p,y,A;if(this._leftover){for(A=this._leftover,this._buffer[A++]=1;A<16;A++)this._buffer[A]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(d=this._h[1]>>>13,this._h[1]&=8191,A=2;A<10;A++)this._h[A]+=d,d=this._h[A]>>>13,this._h[A]&=8191;for(this._h[0]+=d*5,d=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=d,d=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=d,l[0]=this._h[0]+5,d=l[0]>>>13,l[0]&=8191,A=1;A<10;A++)l[A]=this._h[A]+d,d=l[A]>>>13,l[A]&=8191;for(l[9]-=8192,p=(d^1)-1,A=0;A<10;A++)l[A]&=p;for(p=~p,A=0;A<10;A++)this._h[A]=this._h[A]&p|l[A];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,y=this._h[0]+this._pad[0],this._h[0]=y&65535,A=1;A<8;A++)y=(this._h[A]+this._pad[A]|0)+(y>>>16)|0,this._h[A]=y&65535;return a[u+0]=this._h[0]>>>0,a[u+1]=this._h[0]>>>8,a[u+2]=this._h[1]>>>0,a[u+3]=this._h[1]>>>8,a[u+4]=this._h[2]>>>0,a[u+5]=this._h[2]>>>8,a[u+6]=this._h[3]>>>0,a[u+7]=this._h[3]>>>8,a[u+8]=this._h[4]>>>0,a[u+9]=this._h[4]>>>8,a[u+10]=this._h[5]>>>0,a[u+11]=this._h[5]>>>8,a[u+12]=this._h[6]>>>0,a[u+13]=this._h[6]>>>8,a[u+14]=this._h[7]>>>0,a[u+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var u=0,l=a.length,d;if(this._leftover){d=16-this._leftover,d>l&&(d=l);for(var p=0;p=16&&(d=l-l%16,this._blocks(a,u,d),u+=d,l-=d),l){for(var p=0;p16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var A=new Uint8Array(16);A.set(l,A.length-l.length);var P=new Uint8Array(32);e.stream(this._key,A,P,4);var N=d.length+this.tagLength,D;if(y){if(y.length!==N)throw new Error("ChaCha20Poly1305: incorrect destination length");D=y}else D=new Uint8Array(N);return e.streamXOR(this._key,A,d,D,4),this._authenticate(D.subarray(D.length-this.tagLength,D.length),P,D.subarray(0,D.length-this.tagLength),p),n.wipe(A),D},u.prototype.open=function(l,d,p,y){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(d.length0&&A.update(o.subarray(y.length%16))),A.update(p),p.length%16>0&&A.update(o.subarray(p.length%16));var P=new Uint8Array(8);y&&i.writeUint64LE(y.length,P),A.update(P),i.writeUint64LE(p.length,P),A.update(P);for(var N=A.digest(),D=0;Dthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._temp,this._state,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,A=l%64<56?64:128;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._state.set(u.state),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.state),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,u,l,d,p){for(;p>=64;){for(var y=u[0],A=u[1],P=u[2],N=u[3],D=u[4],k=u[5],B=u[6],q=u[7],j=0;j<16;j++){var H=d+j*4;a[j]=e.readUint32BE(l,H)}for(var j=16;j<64;j++){var J=a[j-2],T=(J>>>17|J<<15)^(J>>>19|J<<13)^J>>>10;J=a[j-15];var z=(J>>>7|J<<25)^(J>>>18|J<<14)^J>>>3;a[j]=(T+a[j-7]|0)+(z+a[j-16]|0)}for(var j=0;j<64;j++){var T=(((D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7))+(D&k^~D&B)|0)+(q+(i[j]+a[j]|0)|0)|0,z=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&A^y&P^A&P)|0;q=B,B=k,k=D,D=N+T|0,N=P,P=A,A=y,y=T+z|0}u[0]+=y,u[1]+=A,u[2]+=P,u[3]+=N,u[4]+=D,u[5]+=k,u[6]+=B,u[7]+=q,d+=64,p-=64}return d}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ll);var Hm={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=ta,r=Mi;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(j){const H=new Float64Array(16);if(j)for(let J=0;J>16&1),J[_e-1]&=65535;J[15]=T[15]-32767-(J[14]>>16&1);const ue=J[15]>>16&1;J[14]&=65535,a(T,J,1-ue)}for(let z=0;z<16;z++)j[2*z]=T[z]&255,j[2*z+1]=T[z]>>8}function l(j,H){for(let J=0;J<16;J++)j[J]=H[2*J]+(H[2*J+1]<<8);j[15]&=32767}function d(j,H,J){for(let T=0;T<16;T++)j[T]=H[T]+J[T]}function p(j,H,J){for(let T=0;T<16;T++)j[T]=H[T]-J[T]}function y(j,H,J){let T,z,ue=0,_e=0,G=0,E=0,m=0,f=0,g=0,v=0,x=0,_=0,S=0,b=0,M=0,I=0,F=0,ae=0,O=0,se=0,ee=0,X=0,Q=0,R=0,Z=0,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=J[0],Ie=J[1],Le=J[2],Ve=J[3],ke=J[4],ze=J[5],He=J[6],Se=J[7],Qe=J[8],ct=J[9],Be=J[10],et=J[11],rt=J[12],Je=J[13],pt=J[14],ht=J[15];T=H[0],ue+=T*$e,_e+=T*Ie,G+=T*Le,E+=T*Ve,m+=T*ke,f+=T*ze,g+=T*He,v+=T*Se,x+=T*Qe,_+=T*ct,S+=T*Be,b+=T*et,M+=T*rt,I+=T*Je,F+=T*pt,ae+=T*ht,T=H[1],_e+=T*$e,G+=T*Ie,E+=T*Le,m+=T*Ve,f+=T*ke,g+=T*ze,v+=T*He,x+=T*Se,_+=T*Qe,S+=T*ct,b+=T*Be,M+=T*et,I+=T*rt,F+=T*Je,ae+=T*pt,O+=T*ht,T=H[2],G+=T*$e,E+=T*Ie,m+=T*Le,f+=T*Ve,g+=T*ke,v+=T*ze,x+=T*He,_+=T*Se,S+=T*Qe,b+=T*ct,M+=T*Be,I+=T*et,F+=T*rt,ae+=T*Je,O+=T*pt,se+=T*ht,T=H[3],E+=T*$e,m+=T*Ie,f+=T*Le,g+=T*Ve,v+=T*ke,x+=T*ze,_+=T*He,S+=T*Se,b+=T*Qe,M+=T*ct,I+=T*Be,F+=T*et,ae+=T*rt,O+=T*Je,se+=T*pt,ee+=T*ht,T=H[4],m+=T*$e,f+=T*Ie,g+=T*Le,v+=T*Ve,x+=T*ke,_+=T*ze,S+=T*He,b+=T*Se,M+=T*Qe,I+=T*ct,F+=T*Be,ae+=T*et,O+=T*rt,se+=T*Je,ee+=T*pt,X+=T*ht,T=H[5],f+=T*$e,g+=T*Ie,v+=T*Le,x+=T*Ve,_+=T*ke,S+=T*ze,b+=T*He,M+=T*Se,I+=T*Qe,F+=T*ct,ae+=T*Be,O+=T*et,se+=T*rt,ee+=T*Je,X+=T*pt,Q+=T*ht,T=H[6],g+=T*$e,v+=T*Ie,x+=T*Le,_+=T*Ve,S+=T*ke,b+=T*ze,M+=T*He,I+=T*Se,F+=T*Qe,ae+=T*ct,O+=T*Be,se+=T*et,ee+=T*rt,X+=T*Je,Q+=T*pt,R+=T*ht,T=H[7],v+=T*$e,x+=T*Ie,_+=T*Le,S+=T*Ve,b+=T*ke,M+=T*ze,I+=T*He,F+=T*Se,ae+=T*Qe,O+=T*ct,se+=T*Be,ee+=T*et,X+=T*rt,Q+=T*Je,R+=T*pt,Z+=T*ht,T=H[8],x+=T*$e,_+=T*Ie,S+=T*Le,b+=T*Ve,M+=T*ke,I+=T*ze,F+=T*He,ae+=T*Se,O+=T*Qe,se+=T*ct,ee+=T*Be,X+=T*et,Q+=T*rt,R+=T*Je,Z+=T*pt,te+=T*ht,T=H[9],_+=T*$e,S+=T*Ie,b+=T*Le,M+=T*Ve,I+=T*ke,F+=T*ze,ae+=T*He,O+=T*Se,se+=T*Qe,ee+=T*ct,X+=T*Be,Q+=T*et,R+=T*rt,Z+=T*Je,te+=T*pt,le+=T*ht,T=H[10],S+=T*$e,b+=T*Ie,M+=T*Le,I+=T*Ve,F+=T*ke,ae+=T*ze,O+=T*He,se+=T*Se,ee+=T*Qe,X+=T*ct,Q+=T*Be,R+=T*et,Z+=T*rt,te+=T*Je,le+=T*pt,ie+=T*ht,T=H[11],b+=T*$e,M+=T*Ie,I+=T*Le,F+=T*Ve,ae+=T*ke,O+=T*ze,se+=T*He,ee+=T*Se,X+=T*Qe,Q+=T*ct,R+=T*Be,Z+=T*et,te+=T*rt,le+=T*Je,ie+=T*pt,fe+=T*ht,T=H[12],M+=T*$e,I+=T*Ie,F+=T*Le,ae+=T*Ve,O+=T*ke,se+=T*ze,ee+=T*He,X+=T*Se,Q+=T*Qe,R+=T*ct,Z+=T*Be,te+=T*et,le+=T*rt,ie+=T*Je,fe+=T*pt,ve+=T*ht,T=H[13],I+=T*$e,F+=T*Ie,ae+=T*Le,O+=T*Ve,se+=T*ke,ee+=T*ze,X+=T*He,Q+=T*Se,R+=T*Qe,Z+=T*ct,te+=T*Be,le+=T*et,ie+=T*rt,fe+=T*Je,ve+=T*pt,Me+=T*ht,T=H[14],F+=T*$e,ae+=T*Ie,O+=T*Le,se+=T*Ve,ee+=T*ke,X+=T*ze,Q+=T*He,R+=T*Se,Z+=T*Qe,te+=T*ct,le+=T*Be,ie+=T*et,fe+=T*rt,ve+=T*Je,Me+=T*pt,Ne+=T*ht,T=H[15],ae+=T*$e,O+=T*Ie,se+=T*Le,ee+=T*Ve,X+=T*ke,Q+=T*ze,R+=T*He,Z+=T*Se,te+=T*Qe,le+=T*ct,ie+=T*Be,fe+=T*et,ve+=T*rt,Me+=T*Je,Ne+=T*pt,Te+=T*ht,ue+=38*O,_e+=38*se,G+=38*ee,E+=38*X,m+=38*Q,f+=38*R,g+=38*Z,v+=38*te,x+=38*le,_+=38*ie,S+=38*fe,b+=38*ve,M+=38*Me,I+=38*Ne,F+=38*Te,z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=g+z+65535,z=Math.floor(T/65536),g=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=g+z+65535,z=Math.floor(T/65536),g=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),j[0]=ue,j[1]=_e,j[2]=G,j[3]=E,j[4]=m,j[5]=f,j[6]=g,j[7]=v,j[8]=x,j[9]=_,j[10]=S,j[11]=b,j[12]=M,j[13]=I,j[14]=F,j[15]=ae}function A(j,H){y(j,H,H)}function P(j,H){const J=n();for(let T=0;T<16;T++)J[T]=H[T];for(let T=253;T>=0;T--)A(J,J),T!==2&&T!==4&&y(J,J,H);for(let T=0;T<16;T++)j[T]=J[T]}function N(j,H){const J=new Uint8Array(32),T=new Float64Array(80),z=n(),ue=n(),_e=n(),G=n(),E=n(),m=n();for(let x=0;x<31;x++)J[x]=j[x];J[31]=j[31]&127|64,J[0]&=248,l(T,H);for(let x=0;x<16;x++)ue[x]=T[x];z[0]=G[0]=1;for(let x=254;x>=0;--x){const _=J[x>>>3]>>>(x&7)&1;a(z,ue,_),a(_e,G,_),d(E,z,_e),p(z,z,_e),d(_e,ue,G),p(ue,ue,G),A(G,E),A(m,z),y(z,_e,z),y(_e,ue,E),d(E,z,_e),p(z,z,_e),A(ue,z),p(_e,G,m),y(z,_e,s),d(z,z,G),y(_e,_e,z),y(z,G,m),y(G,ue,T),A(ue,E),a(z,ue,_),a(_e,G,_)}for(let x=0;x<16;x++)T[x+16]=z[x],T[x+32]=_e[x],T[x+48]=ue[x],T[x+64]=G[x];const f=T.subarray(32),g=T.subarray(16);P(f,f),y(g,g,f);const v=new Uint8Array(32);return u(v,g),v}t.scalarMult=N;function D(j){return N(j,i)}t.scalarMultBase=D;function k(j){if(j.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const H=new Uint8Array(j);return{publicKey:D(H),secretKey:H}}t.generateKeyPairFromSeed=k;function B(j){const H=(0,e.randomBytes)(32,j),J=k(H);return(0,r.wipe)(H),J}t.generateKeyPair=B;function q(j,H,J=!1){if(j.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(H.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const T=N(j,H);if(J){let z=0;for(let ue=0;ue",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}};var Ti={},Wm={exports:{}};Wm.exports,function(t){(function(e,r){function n(G,E){if(!G)throw new Error(E||"Assertion failed")}function i(G,E){G.super_=E;var m=function(){};m.prototype=E.prototype,G.prototype=new m,G.prototype.constructor=G}function s(G,E,m){if(s.isBN(G))return G;this.negative=0,this.words=null,this.length=0,this.red=null,G!==null&&((E==="le"||E==="be")&&(m=E,E=10),this._init(G||0,E||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(E){return E instanceof s?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===s.wordSize&&Array.isArray(E.words)},s.max=function(E,m){return E.cmp(m)>0?E:m},s.min=function(E,m){return E.cmp(m)<0?E:m},s.prototype._init=function(E,m,f){if(typeof E=="number")return this._initNumber(E,m,f);if(typeof E=="object")return this._initArray(E,m,f);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),E=E.toString().replace(/\s+/g,"");var g=0;E[0]==="-"&&(g++,this.negative=1),g=0;g-=3)x=E[g]|E[g-1]<<8|E[g-2]<<16,this.words[v]|=x<<_&67108863,this.words[v+1]=x>>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);else if(f==="le")for(g=0,v=0;g>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);return this.strip()};function a(G,E){var m=G.charCodeAt(E);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function u(G,E,m){var f=a(G,m);return m-1>=E&&(f|=a(G,m-1)<<4),f}s.prototype._parseHex=function(E,m,f){this.length=Math.ceil((E.length-m)/6),this.words=new Array(this.length);for(var g=0;g=m;g-=2)_=u(E,m,g)<=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8;else{var S=E.length-m;for(g=S%2===0?m+1:m;g=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8}this.strip()};function l(G,E,m,f){for(var g=0,v=Math.min(G.length,m),x=E;x=49?g+=_-49+10:_>=17?g+=_-17+10:g+=_}return g}s.prototype._parseBase=function(E,m,f){this.words=[0],this.length=1;for(var g=0,v=1;v<=67108863;v*=m)g++;g--,v=v/m|0;for(var x=E.length-f,_=x%g,S=Math.min(x,x-_)+f,b=0,M=f;M1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var d=["","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"],p=[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],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(E,m){E=E||10,m=m|0||1;var f;if(E===16||E==="hex"){f="";for(var g=0,v=0,x=0;x>>24-g&16777215,g+=2,g>=26&&(g-=26,x--),v!==0||x!==this.length-1?f=d[6-S.length]+S+f:f=S+f}for(v!==0&&(f=v.toString(16)+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(E===(E|0)&&E>=2&&E<=36){var b=p[E],M=y[E];f="";var I=this.clone();for(I.negative=0;!I.isZero();){var F=I.modn(M).toString(E);I=I.idivn(M),I.isZero()?f=F+f:f=d[b-F.length]+F+f}for(this.isZero()&&(f="0"+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(E,m){return n(typeof o<"u"),this.toArrayLike(o,E,m)},s.prototype.toArray=function(E,m){return this.toArrayLike(Array,E,m)},s.prototype.toArrayLike=function(E,m,f){var g=this.byteLength(),v=f||Math.max(1,g);n(g<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var x=m==="le",_=new E(v),S,b,M=this.clone();if(x){for(b=0;!M.isZero();b++)S=M.andln(255),M.iushrn(8),_[b]=S;for(;b=4096&&(f+=13,m>>>=13),m>=64&&(f+=7,m>>>=7),m>=8&&(f+=4,m>>>=4),m>=2&&(f+=2,m>>>=2),f+m},s.prototype._zeroBits=function(E){if(E===0)return 26;var m=E,f=0;return m&8191||(f+=13,m>>>=13),m&127||(f+=7,m>>>=7),m&15||(f+=4,m>>>=4),m&3||(f+=2,m>>>=2),m&1||f++,f},s.prototype.bitLength=function(){var E=this.words[this.length-1],m=this._countBits(E);return(this.length-1)*26+m};function A(G){for(var E=new Array(G.bitLength()),m=0;m>>g}return E}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,m=0;mE.length?this.clone().ior(E):E.clone().ior(this)},s.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},s.prototype.iuand=function(E){var m;this.length>E.length?m=E:m=this;for(var f=0;fE.length?this.clone().iand(E):E.clone().iand(this)},s.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},s.prototype.iuxor=function(E){var m,f;this.length>E.length?(m=this,f=E):(m=E,f=this);for(var g=0;gE.length?this.clone().ixor(E):E.clone().ixor(this)},s.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},s.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var m=Math.ceil(E/26)|0,f=E%26;this._expand(m),f>0&&m--;for(var g=0;g0&&(this.words[g]=~this.words[g]&67108863>>26-f),this.strip()},s.prototype.notn=function(E){return this.clone().inotn(E)},s.prototype.setn=function(E,m){n(typeof E=="number"&&E>=0);var f=E/26|0,g=E%26;return this._expand(f+1),m?this.words[f]=this.words[f]|1<E.length?(f=this,g=E):(f=E,g=this);for(var v=0,x=0;x>>26;for(;v!==0&&x>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;xE.length?this.clone().iadd(E):E.clone().iadd(this)},s.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var m=this.iadd(E);return E.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var f=this.cmp(E);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var g,v;f>0?(g=this,v=E):(g=E,v=this);for(var x=0,_=0;_>26,this.words[_]=m&67108863;for(;x!==0&&_>26,this.words[_]=m&67108863;if(x===0&&_>>26,I=S&67108863,F=Math.min(b,E.length-1),ae=Math.max(0,b-G.length+1);ae<=F;ae++){var O=b-ae|0;g=G.words[O]|0,v=E.words[ae]|0,x=g*v+I,M+=x/67108864|0,I=x&67108863}m.words[b]=I|0,S=M|0}return S!==0?m.words[b]=S|0:m.length--,m.strip()}var N=function(E,m,f){var g=E.words,v=m.words,x=f.words,_=0,S,b,M,I=g[0]|0,F=I&8191,ae=I>>>13,O=g[1]|0,se=O&8191,ee=O>>>13,X=g[2]|0,Q=X&8191,R=X>>>13,Z=g[3]|0,te=Z&8191,le=Z>>>13,ie=g[4]|0,fe=ie&8191,ve=ie>>>13,Me=g[5]|0,Ne=Me&8191,Te=Me>>>13,$e=g[6]|0,Ie=$e&8191,Le=$e>>>13,Ve=g[7]|0,ke=Ve&8191,ze=Ve>>>13,He=g[8]|0,Se=He&8191,Qe=He>>>13,ct=g[9]|0,Be=ct&8191,et=ct>>>13,rt=v[0]|0,Je=rt&8191,pt=rt>>>13,ht=v[1]|0,ft=ht&8191,Ht=ht>>>13,Jt=v[2]|0,St=Jt&8191,er=Jt>>>13,Xt=v[3]|0,Ot=Xt&8191,Bt=Xt>>>13,Tt=v[4]|0,vt=Tt&8191,Dt=Tt>>>13,Lt=v[5]|0,bt=Lt&8191,$t=Lt>>>13,jt=v[6]|0,nt=jt&8191,Ft=jt>>>13,$=v[7]|0,W=$&8191,V=$>>>13,C=v[8]|0,Y=C&8191,U=C>>>13,oe=v[9]|0,pe=oe&8191,xe=oe>>>13;f.negative=E.negative^m.negative,f.length=19,S=Math.imul(F,Je),b=Math.imul(F,pt),b=b+Math.imul(ae,Je)|0,M=Math.imul(ae,pt);var Re=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Re>>>26)|0,Re&=67108863,S=Math.imul(se,Je),b=Math.imul(se,pt),b=b+Math.imul(ee,Je)|0,M=Math.imul(ee,pt),S=S+Math.imul(F,ft)|0,b=b+Math.imul(F,Ht)|0,b=b+Math.imul(ae,ft)|0,M=M+Math.imul(ae,Ht)|0;var De=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(De>>>26)|0,De&=67108863,S=Math.imul(Q,Je),b=Math.imul(Q,pt),b=b+Math.imul(R,Je)|0,M=Math.imul(R,pt),S=S+Math.imul(se,ft)|0,b=b+Math.imul(se,Ht)|0,b=b+Math.imul(ee,ft)|0,M=M+Math.imul(ee,Ht)|0,S=S+Math.imul(F,St)|0,b=b+Math.imul(F,er)|0,b=b+Math.imul(ae,St)|0,M=M+Math.imul(ae,er)|0;var it=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(it>>>26)|0,it&=67108863,S=Math.imul(te,Je),b=Math.imul(te,pt),b=b+Math.imul(le,Je)|0,M=Math.imul(le,pt),S=S+Math.imul(Q,ft)|0,b=b+Math.imul(Q,Ht)|0,b=b+Math.imul(R,ft)|0,M=M+Math.imul(R,Ht)|0,S=S+Math.imul(se,St)|0,b=b+Math.imul(se,er)|0,b=b+Math.imul(ee,St)|0,M=M+Math.imul(ee,er)|0,S=S+Math.imul(F,Ot)|0,b=b+Math.imul(F,Bt)|0,b=b+Math.imul(ae,Ot)|0,M=M+Math.imul(ae,Bt)|0;var Ue=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,S=Math.imul(fe,Je),b=Math.imul(fe,pt),b=b+Math.imul(ve,Je)|0,M=Math.imul(ve,pt),S=S+Math.imul(te,ft)|0,b=b+Math.imul(te,Ht)|0,b=b+Math.imul(le,ft)|0,M=M+Math.imul(le,Ht)|0,S=S+Math.imul(Q,St)|0,b=b+Math.imul(Q,er)|0,b=b+Math.imul(R,St)|0,M=M+Math.imul(R,er)|0,S=S+Math.imul(se,Ot)|0,b=b+Math.imul(se,Bt)|0,b=b+Math.imul(ee,Ot)|0,M=M+Math.imul(ee,Bt)|0,S=S+Math.imul(F,vt)|0,b=b+Math.imul(F,Dt)|0,b=b+Math.imul(ae,vt)|0,M=M+Math.imul(ae,Dt)|0;var gt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(gt>>>26)|0,gt&=67108863,S=Math.imul(Ne,Je),b=Math.imul(Ne,pt),b=b+Math.imul(Te,Je)|0,M=Math.imul(Te,pt),S=S+Math.imul(fe,ft)|0,b=b+Math.imul(fe,Ht)|0,b=b+Math.imul(ve,ft)|0,M=M+Math.imul(ve,Ht)|0,S=S+Math.imul(te,St)|0,b=b+Math.imul(te,er)|0,b=b+Math.imul(le,St)|0,M=M+Math.imul(le,er)|0,S=S+Math.imul(Q,Ot)|0,b=b+Math.imul(Q,Bt)|0,b=b+Math.imul(R,Ot)|0,M=M+Math.imul(R,Bt)|0,S=S+Math.imul(se,vt)|0,b=b+Math.imul(se,Dt)|0,b=b+Math.imul(ee,vt)|0,M=M+Math.imul(ee,Dt)|0,S=S+Math.imul(F,bt)|0,b=b+Math.imul(F,$t)|0,b=b+Math.imul(ae,bt)|0,M=M+Math.imul(ae,$t)|0;var st=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(st>>>26)|0,st&=67108863,S=Math.imul(Ie,Je),b=Math.imul(Ie,pt),b=b+Math.imul(Le,Je)|0,M=Math.imul(Le,pt),S=S+Math.imul(Ne,ft)|0,b=b+Math.imul(Ne,Ht)|0,b=b+Math.imul(Te,ft)|0,M=M+Math.imul(Te,Ht)|0,S=S+Math.imul(fe,St)|0,b=b+Math.imul(fe,er)|0,b=b+Math.imul(ve,St)|0,M=M+Math.imul(ve,er)|0,S=S+Math.imul(te,Ot)|0,b=b+Math.imul(te,Bt)|0,b=b+Math.imul(le,Ot)|0,M=M+Math.imul(le,Bt)|0,S=S+Math.imul(Q,vt)|0,b=b+Math.imul(Q,Dt)|0,b=b+Math.imul(R,vt)|0,M=M+Math.imul(R,Dt)|0,S=S+Math.imul(se,bt)|0,b=b+Math.imul(se,$t)|0,b=b+Math.imul(ee,bt)|0,M=M+Math.imul(ee,$t)|0,S=S+Math.imul(F,nt)|0,b=b+Math.imul(F,Ft)|0,b=b+Math.imul(ae,nt)|0,M=M+Math.imul(ae,Ft)|0;var tt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(tt>>>26)|0,tt&=67108863,S=Math.imul(ke,Je),b=Math.imul(ke,pt),b=b+Math.imul(ze,Je)|0,M=Math.imul(ze,pt),S=S+Math.imul(Ie,ft)|0,b=b+Math.imul(Ie,Ht)|0,b=b+Math.imul(Le,ft)|0,M=M+Math.imul(Le,Ht)|0,S=S+Math.imul(Ne,St)|0,b=b+Math.imul(Ne,er)|0,b=b+Math.imul(Te,St)|0,M=M+Math.imul(Te,er)|0,S=S+Math.imul(fe,Ot)|0,b=b+Math.imul(fe,Bt)|0,b=b+Math.imul(ve,Ot)|0,M=M+Math.imul(ve,Bt)|0,S=S+Math.imul(te,vt)|0,b=b+Math.imul(te,Dt)|0,b=b+Math.imul(le,vt)|0,M=M+Math.imul(le,Dt)|0,S=S+Math.imul(Q,bt)|0,b=b+Math.imul(Q,$t)|0,b=b+Math.imul(R,bt)|0,M=M+Math.imul(R,$t)|0,S=S+Math.imul(se,nt)|0,b=b+Math.imul(se,Ft)|0,b=b+Math.imul(ee,nt)|0,M=M+Math.imul(ee,Ft)|0,S=S+Math.imul(F,W)|0,b=b+Math.imul(F,V)|0,b=b+Math.imul(ae,W)|0,M=M+Math.imul(ae,V)|0;var At=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(At>>>26)|0,At&=67108863,S=Math.imul(Se,Je),b=Math.imul(Se,pt),b=b+Math.imul(Qe,Je)|0,M=Math.imul(Qe,pt),S=S+Math.imul(ke,ft)|0,b=b+Math.imul(ke,Ht)|0,b=b+Math.imul(ze,ft)|0,M=M+Math.imul(ze,Ht)|0,S=S+Math.imul(Ie,St)|0,b=b+Math.imul(Ie,er)|0,b=b+Math.imul(Le,St)|0,M=M+Math.imul(Le,er)|0,S=S+Math.imul(Ne,Ot)|0,b=b+Math.imul(Ne,Bt)|0,b=b+Math.imul(Te,Ot)|0,M=M+Math.imul(Te,Bt)|0,S=S+Math.imul(fe,vt)|0,b=b+Math.imul(fe,Dt)|0,b=b+Math.imul(ve,vt)|0,M=M+Math.imul(ve,Dt)|0,S=S+Math.imul(te,bt)|0,b=b+Math.imul(te,$t)|0,b=b+Math.imul(le,bt)|0,M=M+Math.imul(le,$t)|0,S=S+Math.imul(Q,nt)|0,b=b+Math.imul(Q,Ft)|0,b=b+Math.imul(R,nt)|0,M=M+Math.imul(R,Ft)|0,S=S+Math.imul(se,W)|0,b=b+Math.imul(se,V)|0,b=b+Math.imul(ee,W)|0,M=M+Math.imul(ee,V)|0,S=S+Math.imul(F,Y)|0,b=b+Math.imul(F,U)|0,b=b+Math.imul(ae,Y)|0,M=M+Math.imul(ae,U)|0;var Rt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,S=Math.imul(Be,Je),b=Math.imul(Be,pt),b=b+Math.imul(et,Je)|0,M=Math.imul(et,pt),S=S+Math.imul(Se,ft)|0,b=b+Math.imul(Se,Ht)|0,b=b+Math.imul(Qe,ft)|0,M=M+Math.imul(Qe,Ht)|0,S=S+Math.imul(ke,St)|0,b=b+Math.imul(ke,er)|0,b=b+Math.imul(ze,St)|0,M=M+Math.imul(ze,er)|0,S=S+Math.imul(Ie,Ot)|0,b=b+Math.imul(Ie,Bt)|0,b=b+Math.imul(Le,Ot)|0,M=M+Math.imul(Le,Bt)|0,S=S+Math.imul(Ne,vt)|0,b=b+Math.imul(Ne,Dt)|0,b=b+Math.imul(Te,vt)|0,M=M+Math.imul(Te,Dt)|0,S=S+Math.imul(fe,bt)|0,b=b+Math.imul(fe,$t)|0,b=b+Math.imul(ve,bt)|0,M=M+Math.imul(ve,$t)|0,S=S+Math.imul(te,nt)|0,b=b+Math.imul(te,Ft)|0,b=b+Math.imul(le,nt)|0,M=M+Math.imul(le,Ft)|0,S=S+Math.imul(Q,W)|0,b=b+Math.imul(Q,V)|0,b=b+Math.imul(R,W)|0,M=M+Math.imul(R,V)|0,S=S+Math.imul(se,Y)|0,b=b+Math.imul(se,U)|0,b=b+Math.imul(ee,Y)|0,M=M+Math.imul(ee,U)|0,S=S+Math.imul(F,pe)|0,b=b+Math.imul(F,xe)|0,b=b+Math.imul(ae,pe)|0,M=M+Math.imul(ae,xe)|0;var Mt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,S=Math.imul(Be,ft),b=Math.imul(Be,Ht),b=b+Math.imul(et,ft)|0,M=Math.imul(et,Ht),S=S+Math.imul(Se,St)|0,b=b+Math.imul(Se,er)|0,b=b+Math.imul(Qe,St)|0,M=M+Math.imul(Qe,er)|0,S=S+Math.imul(ke,Ot)|0,b=b+Math.imul(ke,Bt)|0,b=b+Math.imul(ze,Ot)|0,M=M+Math.imul(ze,Bt)|0,S=S+Math.imul(Ie,vt)|0,b=b+Math.imul(Ie,Dt)|0,b=b+Math.imul(Le,vt)|0,M=M+Math.imul(Le,Dt)|0,S=S+Math.imul(Ne,bt)|0,b=b+Math.imul(Ne,$t)|0,b=b+Math.imul(Te,bt)|0,M=M+Math.imul(Te,$t)|0,S=S+Math.imul(fe,nt)|0,b=b+Math.imul(fe,Ft)|0,b=b+Math.imul(ve,nt)|0,M=M+Math.imul(ve,Ft)|0,S=S+Math.imul(te,W)|0,b=b+Math.imul(te,V)|0,b=b+Math.imul(le,W)|0,M=M+Math.imul(le,V)|0,S=S+Math.imul(Q,Y)|0,b=b+Math.imul(Q,U)|0,b=b+Math.imul(R,Y)|0,M=M+Math.imul(R,U)|0,S=S+Math.imul(se,pe)|0,b=b+Math.imul(se,xe)|0,b=b+Math.imul(ee,pe)|0,M=M+Math.imul(ee,xe)|0;var Et=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Et>>>26)|0,Et&=67108863,S=Math.imul(Be,St),b=Math.imul(Be,er),b=b+Math.imul(et,St)|0,M=Math.imul(et,er),S=S+Math.imul(Se,Ot)|0,b=b+Math.imul(Se,Bt)|0,b=b+Math.imul(Qe,Ot)|0,M=M+Math.imul(Qe,Bt)|0,S=S+Math.imul(ke,vt)|0,b=b+Math.imul(ke,Dt)|0,b=b+Math.imul(ze,vt)|0,M=M+Math.imul(ze,Dt)|0,S=S+Math.imul(Ie,bt)|0,b=b+Math.imul(Ie,$t)|0,b=b+Math.imul(Le,bt)|0,M=M+Math.imul(Le,$t)|0,S=S+Math.imul(Ne,nt)|0,b=b+Math.imul(Ne,Ft)|0,b=b+Math.imul(Te,nt)|0,M=M+Math.imul(Te,Ft)|0,S=S+Math.imul(fe,W)|0,b=b+Math.imul(fe,V)|0,b=b+Math.imul(ve,W)|0,M=M+Math.imul(ve,V)|0,S=S+Math.imul(te,Y)|0,b=b+Math.imul(te,U)|0,b=b+Math.imul(le,Y)|0,M=M+Math.imul(le,U)|0,S=S+Math.imul(Q,pe)|0,b=b+Math.imul(Q,xe)|0,b=b+Math.imul(R,pe)|0,M=M+Math.imul(R,xe)|0;var dt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(dt>>>26)|0,dt&=67108863,S=Math.imul(Be,Ot),b=Math.imul(Be,Bt),b=b+Math.imul(et,Ot)|0,M=Math.imul(et,Bt),S=S+Math.imul(Se,vt)|0,b=b+Math.imul(Se,Dt)|0,b=b+Math.imul(Qe,vt)|0,M=M+Math.imul(Qe,Dt)|0,S=S+Math.imul(ke,bt)|0,b=b+Math.imul(ke,$t)|0,b=b+Math.imul(ze,bt)|0,M=M+Math.imul(ze,$t)|0,S=S+Math.imul(Ie,nt)|0,b=b+Math.imul(Ie,Ft)|0,b=b+Math.imul(Le,nt)|0,M=M+Math.imul(Le,Ft)|0,S=S+Math.imul(Ne,W)|0,b=b+Math.imul(Ne,V)|0,b=b+Math.imul(Te,W)|0,M=M+Math.imul(Te,V)|0,S=S+Math.imul(fe,Y)|0,b=b+Math.imul(fe,U)|0,b=b+Math.imul(ve,Y)|0,M=M+Math.imul(ve,U)|0,S=S+Math.imul(te,pe)|0,b=b+Math.imul(te,xe)|0,b=b+Math.imul(le,pe)|0,M=M+Math.imul(le,xe)|0;var _t=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(_t>>>26)|0,_t&=67108863,S=Math.imul(Be,vt),b=Math.imul(Be,Dt),b=b+Math.imul(et,vt)|0,M=Math.imul(et,Dt),S=S+Math.imul(Se,bt)|0,b=b+Math.imul(Se,$t)|0,b=b+Math.imul(Qe,bt)|0,M=M+Math.imul(Qe,$t)|0,S=S+Math.imul(ke,nt)|0,b=b+Math.imul(ke,Ft)|0,b=b+Math.imul(ze,nt)|0,M=M+Math.imul(ze,Ft)|0,S=S+Math.imul(Ie,W)|0,b=b+Math.imul(Ie,V)|0,b=b+Math.imul(Le,W)|0,M=M+Math.imul(Le,V)|0,S=S+Math.imul(Ne,Y)|0,b=b+Math.imul(Ne,U)|0,b=b+Math.imul(Te,Y)|0,M=M+Math.imul(Te,U)|0,S=S+Math.imul(fe,pe)|0,b=b+Math.imul(fe,xe)|0,b=b+Math.imul(ve,pe)|0,M=M+Math.imul(ve,xe)|0;var ot=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(ot>>>26)|0,ot&=67108863,S=Math.imul(Be,bt),b=Math.imul(Be,$t),b=b+Math.imul(et,bt)|0,M=Math.imul(et,$t),S=S+Math.imul(Se,nt)|0,b=b+Math.imul(Se,Ft)|0,b=b+Math.imul(Qe,nt)|0,M=M+Math.imul(Qe,Ft)|0,S=S+Math.imul(ke,W)|0,b=b+Math.imul(ke,V)|0,b=b+Math.imul(ze,W)|0,M=M+Math.imul(ze,V)|0,S=S+Math.imul(Ie,Y)|0,b=b+Math.imul(Ie,U)|0,b=b+Math.imul(Le,Y)|0,M=M+Math.imul(Le,U)|0,S=S+Math.imul(Ne,pe)|0,b=b+Math.imul(Ne,xe)|0,b=b+Math.imul(Te,pe)|0,M=M+Math.imul(Te,xe)|0;var wt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(wt>>>26)|0,wt&=67108863,S=Math.imul(Be,nt),b=Math.imul(Be,Ft),b=b+Math.imul(et,nt)|0,M=Math.imul(et,Ft),S=S+Math.imul(Se,W)|0,b=b+Math.imul(Se,V)|0,b=b+Math.imul(Qe,W)|0,M=M+Math.imul(Qe,V)|0,S=S+Math.imul(ke,Y)|0,b=b+Math.imul(ke,U)|0,b=b+Math.imul(ze,Y)|0,M=M+Math.imul(ze,U)|0,S=S+Math.imul(Ie,pe)|0,b=b+Math.imul(Ie,xe)|0,b=b+Math.imul(Le,pe)|0,M=M+Math.imul(Le,xe)|0;var lt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul(Be,W),b=Math.imul(Be,V),b=b+Math.imul(et,W)|0,M=Math.imul(et,V),S=S+Math.imul(Se,Y)|0,b=b+Math.imul(Se,U)|0,b=b+Math.imul(Qe,Y)|0,M=M+Math.imul(Qe,U)|0,S=S+Math.imul(ke,pe)|0,b=b+Math.imul(ke,xe)|0,b=b+Math.imul(ze,pe)|0,M=M+Math.imul(ze,xe)|0;var at=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(at>>>26)|0,at&=67108863,S=Math.imul(Be,Y),b=Math.imul(Be,U),b=b+Math.imul(et,Y)|0,M=Math.imul(et,U),S=S+Math.imul(Se,pe)|0,b=b+Math.imul(Se,xe)|0,b=b+Math.imul(Qe,pe)|0,M=M+Math.imul(Qe,xe)|0;var Ae=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,S=Math.imul(Be,pe),b=Math.imul(Be,xe),b=b+Math.imul(et,pe)|0,M=Math.imul(et,xe);var Pe=(_+S|0)+((b&8191)<<13)|0;return _=(M+(b>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,x[0]=Re,x[1]=De,x[2]=it,x[3]=Ue,x[4]=gt,x[5]=st,x[6]=tt,x[7]=At,x[8]=Rt,x[9]=Mt,x[10]=Et,x[11]=dt,x[12]=_t,x[13]=ot,x[14]=wt,x[15]=lt,x[16]=at,x[17]=Ae,x[18]=Pe,_!==0&&(x[19]=_,f.length++),f};Math.imul||(N=P);function D(G,E,m){m.negative=E.negative^G.negative,m.length=G.length+E.length;for(var f=0,g=0,v=0;v>>26)|0,g+=x>>>26,x&=67108863}m.words[v]=_,f=x,x=g}return f!==0?m.words[v]=f:m.length--,m.strip()}function k(G,E,m){var f=new B;return f.mulp(G,E,m)}s.prototype.mulTo=function(E,m){var f,g=this.length+E.length;return this.length===10&&E.length===10?f=N(this,E,m):g<63?f=P(this,E,m):g<1024?f=D(this,E,m):f=k(this,E,m),f};function B(G,E){this.x=G,this.y=E}B.prototype.makeRBT=function(E){for(var m=new Array(E),f=s.prototype._countBits(E)-1,g=0;g>=1;return g},B.prototype.permute=function(E,m,f,g,v,x){for(var _=0;_>>1)v++;return 1<>>13,f[2*x+1]=v&8191,v=v>>>13;for(x=2*m;x>=26,m+=g/67108864|0,m+=v>>>26,this.words[f]=v&67108863}return m!==0&&(this.words[f]=m,this.length++),this},s.prototype.muln=function(E){return this.clone().imuln(E)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(E){var m=A(E);if(m.length===0)return new s(1);for(var f=this,g=0;g=0);var m=E%26,f=(E-m)/26,g=67108863>>>26-m<<26-m,v;if(m!==0){var x=0;for(v=0;v>>26-m}x&&(this.words[v]=x,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var g;m?g=(m-m%26)/26:g=0;var v=E%26,x=Math.min((E-v)/26,this.length),_=67108863^67108863>>>v<x)for(this.length-=x,b=0;b=0&&(M!==0||b>=g);b--){var I=this.words[b]|0;this.words[b]=M<<26-v|I>>>v,M=I&_}return S&&M!==0&&(S.words[S.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(E,m,f){return n(this.negative===0),this.iushrn(E,m,f)},s.prototype.shln=function(E){return this.clone().ishln(E)},s.prototype.ushln=function(E){return this.clone().iushln(E)},s.prototype.shrn=function(E){return this.clone().ishrn(E)},s.prototype.ushrn=function(E){return this.clone().iushrn(E)},s.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var m=E%26,f=(E-m)/26,g=1<=0);var m=E%26,f=(E-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(m!==0&&f++,this.length=Math.min(f,this.length),m!==0){var g=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(S/67108864|0),this.words[v+f]=x&67108863}for(;v>26,this.words[v+f]=x&67108863;if(_===0)return this.strip();for(n(_===-1),_=0,v=0;v>26,this.words[v]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(E,m){var f=this.length-E.length,g=this.clone(),v=E,x=v.words[v.length-1]|0,_=this._countBits(x);f=26-_,f!==0&&(v=v.ushln(f),g.iushln(f),x=v.words[v.length-1]|0);var S=g.length-v.length,b;if(m!=="mod"){b=new s(null),b.length=S+1,b.words=new Array(b.length);for(var M=0;M=0;F--){var ae=(g.words[v.length+F]|0)*67108864+(g.words[v.length+F-1]|0);for(ae=Math.min(ae/x|0,67108863),g._ishlnsubmul(v,ae,F);g.negative!==0;)ae--,g.negative=0,g._ishlnsubmul(v,1,F),g.isZero()||(g.negative^=1);b&&(b.words[F]=ae)}return b&&b.strip(),g.strip(),m!=="div"&&f!==0&&g.iushrn(f),{div:b||null,mod:g}},s.prototype.divmod=function(E,m,f){if(n(!E.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var g,v,x;return this.negative!==0&&E.negative===0?(x=this.neg().divmod(E,m),m!=="mod"&&(g=x.div.neg()),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.iadd(E)),{div:g,mod:v}):this.negative===0&&E.negative!==0?(x=this.divmod(E.neg(),m),m!=="mod"&&(g=x.div.neg()),{div:g,mod:x.mod}):this.negative&E.negative?(x=this.neg().divmod(E.neg(),m),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.isub(E)),{div:x.div,mod:v}):E.length>this.length||this.cmp(E)<0?{div:new s(0),mod:this}:E.length===1?m==="div"?{div:this.divn(E.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new s(this.modn(E.words[0]))}:this._wordDiv(E,m)},s.prototype.div=function(E){return this.divmod(E,"div",!1).div},s.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},s.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},s.prototype.divRound=function(E){var m=this.divmod(E);if(m.mod.isZero())return m.div;var f=m.div.negative!==0?m.mod.isub(E):m.mod,g=E.ushrn(1),v=E.andln(1),x=f.cmp(g);return x<0||v===1&&x===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(E){n(E<=67108863);for(var m=(1<<26)%E,f=0,g=this.length-1;g>=0;g--)f=(m*f+(this.words[g]|0))%E;return f},s.prototype.idivn=function(E){n(E<=67108863);for(var m=0,f=this.length-1;f>=0;f--){var g=(this.words[f]|0)+m*67108864;this.words[f]=g/E|0,m=g%E}return this.strip()},s.prototype.divn=function(E){return this.clone().idivn(E)},s.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=new s(0),_=new s(1),S=0;m.isEven()&&f.isEven();)m.iushrn(1),f.iushrn(1),++S;for(var b=f.clone(),M=m.clone();!m.isZero();){for(var I=0,F=1;!(m.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(m.iushrn(I);I-- >0;)(g.isOdd()||v.isOdd())&&(g.iadd(b),v.isub(M)),g.iushrn(1),v.iushrn(1);for(var ae=0,O=1;!(f.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(f.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(b),_.isub(M)),x.iushrn(1),_.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(x),v.isub(_)):(f.isub(m),x.isub(g),_.isub(v))}return{a:x,b:_,gcd:f.iushln(S)}},s.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=f.clone();m.cmpn(1)>0&&f.cmpn(1)>0;){for(var _=0,S=1;!(m.words[0]&S)&&_<26;++_,S<<=1);if(_>0)for(m.iushrn(_);_-- >0;)g.isOdd()&&g.iadd(x),g.iushrn(1);for(var b=0,M=1;!(f.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(f.iushrn(b);b-- >0;)v.isOdd()&&v.iadd(x),v.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(v)):(f.isub(m),v.isub(g))}var I;return m.cmpn(1)===0?I=g:I=v,I.cmpn(0)<0&&I.iadd(E),I},s.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var m=this.clone(),f=E.clone();m.negative=0,f.negative=0;for(var g=0;m.isEven()&&f.isEven();g++)m.iushrn(1),f.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=m.cmp(f);if(v<0){var x=m;m=f,f=x}else if(v===0||f.cmpn(1)===0)break;m.isub(f)}while(!0);return f.iushln(g)},s.prototype.invm=function(E){return this.egcd(E).a.umod(E)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(E){return this.words[0]&E},s.prototype.bincn=function(E){n(typeof E=="number");var m=E%26,f=(E-m)/26,g=1<>>26,_&=67108863,this.words[x]=_}return v!==0&&(this.words[x]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(E){var m=E<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var f;if(this.length>1)f=1;else{m&&(E=-E),n(E<=67108863,"Number is too big");var g=this.words[0]|0;f=g===E?0:gE.length)return 1;if(this.length=0;f--){var g=this.words[f]|0,v=E.words[f]|0;if(g!==v){gv&&(m=1);break}}return m},s.prototype.gtn=function(E){return this.cmpn(E)===1},s.prototype.gt=function(E){return this.cmp(E)===1},s.prototype.gten=function(E){return this.cmpn(E)>=0},s.prototype.gte=function(E){return this.cmp(E)>=0},s.prototype.ltn=function(E){return this.cmpn(E)===-1},s.prototype.lt=function(E){return this.cmp(E)===-1},s.prototype.lten=function(E){return this.cmpn(E)<=0},s.prototype.lte=function(E){return this.cmp(E)<=0},s.prototype.eqn=function(E){return this.cmpn(E)===0},s.prototype.eq=function(E){return this.cmp(E)===0},s.red=function(E){return new ue(E)},s.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(E){return this.red=E,this},s.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},s.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},s.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},s.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},s.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},s.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},s.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},s.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var q={k256:null,p224:null,p192:null,p25519:null};function j(G,E){this.name=G,this.p=new s(E,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var E=new s(null);return E.words=new Array(Math.ceil(this.n/13)),E},j.prototype.ireduce=function(E){var m=E,f;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),f=m.bitLength();while(f>this.n);var g=f0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},j.prototype.split=function(E,m){E.iushrn(this.n,0,m)},j.prototype.imulK=function(E){return E.imul(this.k)};function H(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(H,j),H.prototype.split=function(E,m){for(var f=4194303,g=Math.min(E.length,9),v=0;v>>22,x=_}x>>>=22,E.words[v-10]=x,x===0&&E.length>10?E.length-=10:E.length-=9},H.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var m=0,f=0;f>>=26,E.words[f]=v,m=g}return m!==0&&(E.words[E.length++]=m),E},s._prime=function(E){if(q[E])return q[E];var m;if(E==="k256")m=new H;else if(E==="p224")m=new J;else if(E==="p192")m=new T;else if(E==="p25519")m=new z;else throw new Error("Unknown prime "+E);return q[E]=m,m};function ue(G){if(typeof G=="string"){var E=s._prime(G);this.m=E.p,this.prime=E}else n(G.gtn(1),"modulus must be greater than 1"),this.m=G,this.prime=null}ue.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},ue.prototype._verify2=function(E,m){n((E.negative|m.negative)===0,"red works only with positives"),n(E.red&&E.red===m.red,"red works only with red numbers")},ue.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},ue.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},ue.prototype.add=function(E,m){this._verify2(E,m);var f=E.add(m);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},ue.prototype.iadd=function(E,m){this._verify2(E,m);var f=E.iadd(m);return f.cmp(this.m)>=0&&f.isub(this.m),f},ue.prototype.sub=function(E,m){this._verify2(E,m);var f=E.sub(m);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},ue.prototype.isub=function(E,m){this._verify2(E,m);var f=E.isub(m);return f.cmpn(0)<0&&f.iadd(this.m),f},ue.prototype.shl=function(E,m){return this._verify1(E),this.imod(E.ushln(m))},ue.prototype.imul=function(E,m){return this._verify2(E,m),this.imod(E.imul(m))},ue.prototype.mul=function(E,m){return this._verify2(E,m),this.imod(E.mul(m))},ue.prototype.isqr=function(E){return this.imul(E,E.clone())},ue.prototype.sqr=function(E){return this.mul(E,E)},ue.prototype.sqrt=function(E){if(E.isZero())return E.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(E,f)}for(var g=this.m.subn(1),v=0;!g.isZero()&&g.andln(1)===0;)v++,g.iushrn(1);n(!g.isZero());var x=new s(1).toRed(this),_=x.redNeg(),S=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new s(2*b*b).toRed(this);this.pow(b,S).cmp(_)!==0;)b.redIAdd(_);for(var M=this.pow(b,g),I=this.pow(E,g.addn(1).iushrn(1)),F=this.pow(E,g),ae=v;F.cmp(x)!==0;){for(var O=F,se=0;O.cmp(x)!==0;se++)O=O.redSqr();n(se=0;v--){for(var M=m.words[v],I=b-1;I>=0;I--){var F=M>>I&1;if(x!==g[0]&&(x=this.sqr(x)),F===0&&_===0){S=0;continue}_<<=1,_|=F,S++,!(S!==f&&(v!==0||I!==0))&&(x=this.mul(x,g[_]),S=0,_=0)}b=26}return x},ue.prototype.convertTo=function(E){var m=E.umod(this.m);return m===E?m.clone():m},ue.prototype.convertFrom=function(E){var m=E.clone();return m.red=null,m},s.mont=function(E){return new _e(E)};function _e(G){ue.call(this,G),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(_e,ue),_e.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},_e.prototype.convertFrom=function(E){var m=this.imod(E.mul(this.rinv));return m.red=null,m},_e.prototype.imul=function(E,m){if(E.isZero()||m.isZero())return E.words[0]=0,E.length=1,E;var f=E.imul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.mul=function(E,m){if(E.isZero()||m.isZero())return new s(0)._forceRed(this);var f=E.mul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.invm=function(E){var m=this.imod(E._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,nn)}(Wm);var xo=Wm.exports,Km={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var u=0;u>8,p=l&255;d?a.push(d,p):a.push(p)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(N>>1)-1?k=(N>>1)-B:k=B,D.isubn(k)):k=0,A[P]=k,D.iushrn(1)}return A}e.getNAF=s;function o(d,p){var y=[[],[]];d=d.clone(),p=p.clone();for(var A=0,P=0,N;d.cmpn(-A)>0||p.cmpn(-P)>0;){var D=d.andln(3)+A&3,k=p.andln(3)+P&3;D===3&&(D=-1),k===3&&(k=-1);var B;D&1?(N=d.andln(7)+A&7,(N===3||N===5)&&k===2?B=-D:B=D):B=0,y[0].push(B);var q;k&1?(N=p.andln(7)+P&7,(N===3||N===5)&&D===2?q=-k:q=k):q=0,y[1].push(q),2*A===B+1&&(A=1-A),2*P===q+1&&(P=1-P),d.iushrn(1),p.iushrn(1)}return y}e.getJSF=o;function a(d,p,y){var A="_"+p;d.prototype[p]=function(){return this[A]!==void 0?this[A]:this[A]=y.call(this)}}e.cachedProperty=a;function u(d){return typeof d=="string"?e.toArray(d,"hex"):d}e.parseBytes=u;function l(d){return new r(d,"hex","le")}e.intFromLE=l}(Ti);var Vm={exports:{}},Gm;Vm.exports=function(e){return Gm||(Gm=new aa(null)),Gm.generate(e)};function aa(t){this.rand=t}if(Vm.exports.Rand=aa,aa.prototype.generate=function(e){return this._rand(e)},aa.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Rd=ca;ca.prototype.point=function(){throw new Error("Not implemented")},ca.prototype.validate=function(){throw new Error("Not implemented")},ca.prototype._fixedNafMul=function(e,r){Td(e.precomputed);var n=e._getDoubles(),i=Cd(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Td(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},ca.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=Cd(n[P],o[P],this._bitLength),u[N]=Cd(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=Nk(n[P],n[N]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[N]=new Array(l),p=0;p=0;d--){for(var T=0;d>=0;){var z=!0;for(p=0;p=0&&T++,H=H.dblp(T),d<0)break;for(p=0;p0?y=a[p][ue-1>>1]:ue<0&&(y=a[p][-ue-1>>1].neg()),y.type==="affine"?H=H.mixedAdd(y):H=H.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Ki.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),p.negative&&(p=p.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:p,b:y},{a:A,b:P}]},Vi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Vi.prototype.pointFromX=function(e,r){e=new en(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Vi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Vi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Nn.prototype.isInfinity=function(){return this.inf},Nn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Nn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Nn.prototype.getX=function(){return this.x.fromRed()},Nn.prototype.getY=function(){return this.y.fromRed()},Nn.prototype.mul=function(e){return e=new en(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Nn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Nn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Nn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Nn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Nn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function qn(t,e,r,n){yu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new en(0)):(this.x=new en(e,16),this.y=new en(r,16),this.z=new en(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Jm(qn,yu.BasePoint),Vi.prototype.jpoint=function(e,r,n){return new qn(this,e,r,n)},qn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},qn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},qn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(p).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(p)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},qn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),A=u.redMul(p.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},qn.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},qn.prototype.inspect=function(){return this.isInfinity()?"":""},qn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var wu=xo,T3=yd,Dd=Rd,$k=Ti;function xu(t){Dd.call(this,"mont",t),this.a=new wu(t.a,16).toRed(this.red),this.b=new wu(t.b,16).toRed(this.red),this.i4=new wu(4).toRed(this.red).redInvm(),this.two=new wu(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}T3(xu,Dd);var Fk=xu;xu.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function Ln(t,e,r){Dd.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new wu(e,16),this.z=new wu(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}T3(Ln,Dd.BasePoint),xu.prototype.decodePoint=function(e,r){return this.point($k.toArray(e,r),1)},xu.prototype.point=function(e,r){return new Ln(this,e,r)},xu.prototype.pointFromJSON=function(e){return Ln.fromJSON(this,e)},Ln.prototype.precompute=function(){},Ln.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Ln.fromJSON=function(e,r){return new Ln(e,r[0],r[1]||e.one)},Ln.prototype.inspect=function(){return this.isInfinity()?"":""},Ln.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Ln.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)},Ln.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Ln.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),u=s.redMul(i),l=r.z.redMul(a.redAdd(u).redSqr()),d=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(l,d)},Ln.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i},Ln.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Ln.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Ln.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Ln.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Ln.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var jk=Ti,_o=xo,R3=yd,Od=Rd,Uk=jk.assert;function zs(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Od.call(this,"edwards",t),this.a=new _o(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new _o(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new _o(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Uk(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}R3(zs,Od);var qk=zs;zs.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},zs.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},zs.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)},zs.prototype.pointFromX=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var u=a.fromRed().isOdd();return(r&&!u||!r&&u)&&(a=a.redNeg()),this.point(e,a)},zs.prototype.pointFromY=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)},zs.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function Hr(t,e,r,n,i){Od.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new _o(e,16),this.y=new _o(r,16),this.z=n?new _o(n,16):this.curve.one,this.t=i&&new _o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}R3(Hr,Od.BasePoint),zs.prototype.pointFromJSON=function(e){return Hr.fromJSON(this,e)},zs.prototype.point=function(e,r,n,i){return new Hr(this,e,r,n,i)},Hr.fromJSON=function(e,r){return new Hr(e,r[0],r[1],r[2])},Hr.prototype.inspect=function(){return this.isInfinity()?"":""},Hr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Hr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),u=i.redSub(r),l=s.redMul(a),d=o.redMul(u),p=s.redMul(u),y=a.redMul(o);return this.curve.point(l,d,y,p)},Hr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,u,l;if(this.curve.twisted){a=this.curve._mulA(r);var d=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(d.redSub(this.curve.two)),s=d.redMul(a.redSub(n)),o=d.redSqr().redSub(d).redSub(d)):(u=this.z.redSqr(),l=d.redSub(u).redISub(u),i=e.redSub(r).redISub(n).redMul(l),s=d.redMul(a.redSub(n)),o=d.redMul(l))}else a=r.redAdd(n),u=this.curve._mulC(this.z).redSqr(),l=a.redSub(u).redSub(u),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)},Hr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Hr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),u=s.redAdd(i),l=n.redAdd(r),d=o.redMul(a),p=u.redMul(l),y=o.redMul(l),A=a.redMul(u);return this.curve.point(d,p,A,y)},Hr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),u=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),d=r.redMul(a).redMul(l),p,y;return this.curve.twisted?(p=r.redMul(u).redMul(s.redSub(this.curve._mulA(i))),y=a.redMul(u)):(p=r.redMul(u).redMul(s.redSub(i)),y=this.curve._mulC(a).redMul(u)),this.curve.point(d,p,y)},Hr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Hr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Hr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)},Hr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)},Hr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Hr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Hr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Hr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Hr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Hr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Hr.prototype.toP=Hr.prototype.normalize,Hr.prototype.mixedAdd=Hr.prototype.add,function(t){var e=t;e.base=Rd,e.short=Bk,e.mont=Fk,e.edwards=qk}(Ym);var Nd={},Xm,D3;function zk(){return D3||(D3=1,Xm={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Xm}(function(t){var e=t,r=al,n=Ym,i=Ti,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,d){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var p=new o(d);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:p}),p}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=zk()}catch{u=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})})(Nd);var Hk=al,Za=Km,O3=Ga;function ua(t){if(!(this instanceof ua))return new ua(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Za.toArray(t.entropy,t.entropyEnc||"hex"),r=Za.toArray(t.nonce,t.nonceEnc||"hex"),n=Za.toArray(t.pers,t.persEnc||"hex");O3(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Wk=ua;ua.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ua.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Za.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var Ld=xo,Qm=Ti,Yk=Qm.assert;function kd(t,e){if(t instanceof kd)return t;this._importDER(t,e)||(Yk(t.r&&t.s,"Signature without r or s"),this.r=new Ld(t.r,16),this.s=new Ld(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Jk=kd;function Xk(){this.place=0}function e1(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function N3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}kd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=N3(r),n=N3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];t1(i,r.length),i=i.concat(r),i.push(2),t1(i,n.length);var s=i.concat(n),o=[48];return t1(o,s.length),o=o.concat(s),Qm.encode(o,e)};var Eo=xo,L3=Wk,Zk=Ti,r1=Nd,Qk=C3,k3=Zk.assert,n1=Gk,Bd=Jk;function Gi(t){if(!(this instanceof Gi))return new Gi(t);typeof t=="string"&&(k3(Object.prototype.hasOwnProperty.call(r1,t),"Unknown curve "+t),t=r1[t]),t instanceof r1.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var eB=Gi;Gi.prototype.keyPair=function(e){return new n1(this,e)},Gi.prototype.keyFromPrivate=function(e,r){return n1.fromPrivate(this,e,r)},Gi.prototype.keyFromPublic=function(e,r){return n1.fromPublic(this,e,r)},Gi.prototype.genKeyPair=function(e){e||(e={});for(var r=new L3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Qk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new Eo(2));;){var s=new Eo(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Gi.prototype._truncateToN=function(e,r,n){var i;if(Eo.isBN(e)||typeof e=="number")e=new Eo(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new Eo(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new Eo(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Gi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new L3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new Eo(1)),d=0;;d++){var p=i.k?i.k(d):new Eo(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new Bd({r:P,s:N,recoveryParam:D})}}}}}},Gi.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new Bd(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),l=u.mul(e).umod(this.n),d=u.mul(o).umod(this.n),p;return this.curve._maxwellTrick?(p=this.g.jmulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.eqXToP(o)):(p=this.g.mulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.getX().umod(this.n).cmp(o)===0)},Gi.prototype.recoverPubKey=function(t,e,r,n){k3((3&r)===r,"The recovery param is more than two bits"),e=new Bd(e,n);var i=this.n,s=new Eo(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Gi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Bd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dl=Ti,B3=dl.assert,$3=dl.parseBytes,_u=dl.cachedProperty;function kn(t,e){this.eddsa=t,this._secret=$3(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=$3(e.pub)}kn.fromPublic=function(e,r){return r instanceof kn?r:new kn(e,{pub:r})},kn.fromSecret=function(e,r){return r instanceof kn?r:new kn(e,{secret:r})},kn.prototype.secret=function(){return this._secret},_u(kn,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),_u(kn,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),_u(kn,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i}),_u(kn,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),_u(kn,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),_u(kn,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),kn.prototype.sign=function(e){return B3(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},kn.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},kn.prototype.getSecret=function(e){return B3(this._secret,"KeyPair is public only"),dl.encode(this.secret(),e)},kn.prototype.getPublic=function(e){return dl.encode(this.pubBytes(),e)};var tB=kn,rB=xo,$d=Ti,F3=$d.assert,Fd=$d.cachedProperty,nB=$d.parseBytes;function Qa(t,e){this.eddsa=t,typeof e!="object"&&(e=nB(e)),Array.isArray(e)&&(F3(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),F3(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof rB&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Fd(Qa,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Fd(Qa,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Fd(Qa,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Fd(Qa,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Qa.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Qa.prototype.toHex=function(){return $d.encode(this.toBytes(),"hex").toUpperCase()};var iB=Qa,sB=al,oB=Nd,Eu=Ti,aB=Eu.assert,j3=Eu.parseBytes,U3=tB,q3=iB;function vi(t){if(aB(t==="ed25519","only tested with ed25519 so far"),!(this instanceof vi))return new vi(t);t=oB[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=sB.sha512}var cB=vi;vi.prototype.sign=function(e,r){e=j3(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),u=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:u,Rencoded:o})},vi.prototype.verify=function(e,r,n){if(e=j3(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)},vi.prototype.hashInt=function(){for(var e=this.hash(),r=0;re in t?lB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,K3=(t,e)=>{for(var r in e||(e={}))hB.call(e,r)&&W3(t,r,e[r]);if(H3)for(var r of H3(e))dB.call(e,r)&&W3(t,r,e[r]);return t};const pB="ReactNative",Ri={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},gB="js";function jd(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Au(){return!nl()&&!!mm()&&navigator.product===pB}function pl(){return!jd()&&!!mm()&&!!nl()}function gl(){return Au()?Ri.reactNative:jd()?Ri.node:pl()?Ri.browser:Ri.unknown}function mB(){var t;try{return Au()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function vB(t,e){let r=il.parse(t);return r=K3(K3({},r),e),t=il.stringify(r),t}function V3(){return Mx()||{name:"",description:"",url:"",icons:[""]}}function bB(){if(gl()===Ri.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=HO();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function yB(){var t;const e=gl();return e===Ri.browser?[e,((t=Px())==null?void 0:t.host)||"unknown"].join(":"):e}function G3(t,e,r){const n=bB(),i=yB();return[[t,e].join("-"),[gB,r].join("-"),n,i].join("/")}function wB({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const u=r.split("?"),l=G3(t,e,n),d={auth:i,ua:l,projectId:s,useOnCloseEvent:o,origin:a||void 0},p=vB(u[1]||"",d);return u[0]+"?"+p}function ec(t,e){return t.filter(r=>e.includes(r)).length===t.length}function Y3(t){return Object.fromEntries(t.entries())}function J3(t){return new Map(Object.entries(t))}function tc(t=mt.FIVE_MINUTES,e){const r=mt.toMiliseconds(t||mt.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Pu(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function X3(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function xB(t){return X3("topic",t)}function _B(t){return X3("id",t)}function Z3(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function En(t,e){return mt.fromMiliseconds(Date.now()+mt.toMiliseconds(t))}function fa(t){return Date.now()>=mt.toMiliseconds(t)}function vr(t,e){return`${t}${e?`:${e}`:""}`}function Ud(t=[],e=[]){return[...new Set([...t,...e])]}async function EB({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=SB(s,t,e),a=gl();if(a===Ri.browser){if(!((n=nl())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,PB()?"_blank":"_self","noreferrer noopener")}else a===Ri.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function SB(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${MB(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function AB(t,e){let r="";try{if(pl()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function Q3(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function e_(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function i1(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function PB(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function MB(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function t_(t){return Buffer.from(t,"base64").toString("utf-8")}const IB="https://rpc.walletconnect.org/v1";async function CB(t,e,r,n,i,s){switch(r.t){case"eip191":return TB(t,e,r.s);case"eip1271":return await RB(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function TB(t,e,r){return yk(zx(e),r).toLowerCase()===t.toLowerCase()}async function RB(t,e,r,n,i,s){const o=Su(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",d=r.substring(2),p=zx(e).substring(2),y=a+p+u+l+d,A=await fetch(`${s||IB}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:DB(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:y},"latest"]})}),{result:P}=await A.json();return P?P.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function DB(){return Date.now()+Math.floor(Math.random()*1e3)}var OB=Object.defineProperty,NB=Object.defineProperties,LB=Object.getOwnPropertyDescriptors,r_=Object.getOwnPropertySymbols,kB=Object.prototype.hasOwnProperty,BB=Object.prototype.propertyIsEnumerable,n_=(t,e,r)=>e in t?OB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$B=(t,e)=>{for(var r in e||(e={}))kB.call(e,r)&&n_(t,r,e[r]);if(r_)for(var r of r_(e))BB.call(e,r)&&n_(t,r,e[r]);return t},FB=(t,e)=>NB(t,LB(e));const jB="did:pkh:",s1=t=>t==null?void 0:t.split(":"),UB=t=>{const e=t&&s1(t);if(e)return t.includes(jB)?e[3]:e[1]},o1=t=>{const e=t&&s1(t);if(e)return e[2]+":"+e[3]},qd=t=>{const e=t&&s1(t);if(e)return e.pop()};async function i_(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=s_(i,i.iss),o=qd(i.iss);return await CB(o,s,n,o1(i.iss),r)}const s_=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=qd(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${UB(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,d=t.exp?`Expiration Time: ${t.exp}`:void 0,p=t.nbf?`Not Before: ${t.nbf}`:void 0,y=t.requestId?`Request ID: ${t.requestId}`:void 0,A=t.resources?`Resources:${t.resources.map(N=>` - ${N}`).join("")}`:void 0,P=zd(t.resources);if(P){const N=ml(P);i=JB(i,N)}return[r,n,"",i,"",s,o,a,u,l,d,p,y,A].filter(N=>N!=null).join(` -`)};function qB(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function zB(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function rc(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function HB(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:WB(e,r,n)}}}function WB(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function s_(t){return rc(t),`urn:recap:${qB(t).replace(/=/g,"")}`}function ml(t){const e=zB(t.replace("urn:recap:",""));return rc(e),e}function KB(t,e,r){const n=HB(t,e,r);return s_(n)}function VB(t){return t&&t.includes("urn:recap:")}function GB(t,e){const r=ml(t),n=ml(e),i=YB(r,n);return s_(i)}function YB(t,e){rc(t),rc(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,u)=>a.localeCompare(u)).forEach(a=>{var u,l;n.att[i]=FB($B({},n.att[i]),{[a]:((u=t.att[i])==null?void 0:u[a])||((l=e.att[i])==null?void 0:l[a])})})}),n}function JB(t="",e){rc(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const u=Object.keys(e.att[a]).map(p=>({ability:p.split("/")[0],action:p.split("/")[1]}));u.sort((p,y)=>p.action.localeCompare(y.action));const l={};u.forEach(p=>{l[p.ability]||(l[p.ability]=[]),l[p.ability].push(p.action)});const d=Object.keys(l).map(p=>(i++,`(${i}) '${p}': '${l[p].join("', '")}' for '${a}'.`));n.push(d.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function o_(t){var e;const r=ml(t);rc(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function a_(t){const e=ml(t);rc(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function zd(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return VB(e)?e:void 0}const c_="base10",ni="base16",la="base64pad",vl="base64url",bl="utf8",u_=0,So=1,yl=2,XB=0,f_=1,wl=12,a1=32;function ZB(){const t=Hm.generateKeyPair();return{privateKey:Tn(t.secretKey,ni),publicKey:Tn(t.publicKey,ni)}}function c1(){const t=ta.randomBytes(a1);return Tn(t,ni)}function QB(t,e){const r=Hm.sharedKey(Rn(t,ni),Rn(e,ni),!0),n=new Dk(ll.SHA256,r).expand(a1);return Tn(n,ni)}function Hd(t){const e=ll.hash(Rn(t,ni));return Tn(e,ni)}function Ao(t){const e=ll.hash(Rn(t,bl));return Tn(e,ni)}function l_(t){return Rn(`${t}`,c_)}function nc(t){return Number(Tn(t,c_))}function e$(t){const e=l_(typeof t.type<"u"?t.type:u_);if(nc(e)===So&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Rn(t.senderPublicKey,ni):void 0,n=typeof t.iv<"u"?Rn(t.iv,ni):ta.randomBytes(wl),i=new Um.ChaCha20Poly1305(Rn(t.symKey,ni)).seal(n,Rn(t.message,bl));return h_({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function t$(t,e){const r=l_(yl),n=ta.randomBytes(wl),i=Rn(t,bl);return h_({type:r,sealed:i,iv:n,encoding:e})}function r$(t){const e=new Um.ChaCha20Poly1305(Rn(t.symKey,ni)),{sealed:r,iv:n}=xl({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Tn(i,bl)}function n$(t,e){const{sealed:r}=xl({encoded:t,encoding:e});return Tn(r,bl)}function h_(t){const{encoding:e=la}=t;if(nc(t.type)===yl)return Tn(pd([t.type,t.sealed]),e);if(nc(t.type)===So){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Tn(pd([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return Tn(pd([t.type,t.iv,t.sealed]),e)}function xl(t){const{encoded:e,encoding:r=la}=t,n=Rn(e,r),i=n.slice(XB,f_),s=f_;if(nc(i)===So){const l=s+a1,d=l+wl,p=n.slice(s,l),y=n.slice(l,d),A=n.slice(d);return{type:i,sealed:A,iv:y,senderPublicKey:p}}if(nc(i)===yl){const l=n.slice(s),d=ta.randomBytes(wl);return{type:i,sealed:l,iv:d}}const o=s+wl,a=n.slice(s,o),u=n.slice(o);return{type:i,sealed:u,iv:a}}function i$(t,e){const r=xl({encoded:t,encoding:e==null?void 0:e.encoding});return d_({type:nc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Tn(r.senderPublicKey,ni):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function d_(t){const e=(t==null?void 0:t.type)||u_;if(e===So){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function p_(t){return t.type===So&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function g_(t){return t.type===yl}function s$(t){return new P3.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function o$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function a$(t){return Buffer.from(o$(t),"base64")}function c$(t,e){const[r,n,i]=t.split("."),s=a$(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),u=`${r}.${n}`,l=new ll.SHA256().update(Buffer.from(u)).digest(),d=s$(e),p=Buffer.from(l).toString("hex");if(!d.verify(p,{r:o,s:a}))throw new Error("Invalid signature");return gm(t).payload}const u$="irn";function u1(t){return(t==null?void 0:t.relay)||{protocol:u$}}function _l(t){const e=uB[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var f$=Object.defineProperty,l$=Object.defineProperties,h$=Object.getOwnPropertyDescriptors,m_=Object.getOwnPropertySymbols,d$=Object.prototype.hasOwnProperty,p$=Object.prototype.propertyIsEnumerable,v_=(t,e,r)=>e in t?f$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b_=(t,e)=>{for(var r in e||(e={}))d$.call(e,r)&&v_(t,r,e[r]);if(m_)for(var r of m_(e))p$.call(e,r)&&v_(t,r,e[r]);return t},g$=(t,e)=>l$(t,h$(e));function m$(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function y_(t){if(!t.includes("wc:")){const u=e_(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=il.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:v$(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:m$(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function v$(t){return t.startsWith("//")?t.substring(2):t}function b$(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function w_(t){return`${t.protocol}:${t.topic}@${t.version}?`+il.stringify(b_(g$(b_({symKey:t.symKey},b$(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Wd(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Pu(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function y$(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Pu(r.accounts))}),e}function w$(t,e){const r=[];return Object.values(t).forEach(n=>{Pu(n.accounts).includes(e)&&r.push(...n.methods)}),r}function x$(t,e){const r=[];return Object.values(t).forEach(n=>{Pu(n.accounts).includes(e)&&r.push(...n.events)}),r}function f1(t){return t.includes(":")}function El(t){return f1(t)?t.split(":")[0]:t}function _$(t){const e={};return t==null||t.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function x_(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=_$(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=Ud(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const E$={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},S$={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ut(t,e){const{message:r,code:n}=S$[t];return{message:e?`${r} ${e}`:r,code:n}}function Dr(t,e){const{message:r,code:n}=E$[t];return{message:e?`${r} ${e}`:r,code:n}}function ic(t,e){return!!Array.isArray(t)}function Sl(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function bi(t){return typeof t>"u"}function an(t,e){return e&&bi(t)?!0:typeof t=="string"&&!!t.trim().length}function l1(t,e){return typeof t=="number"&&!isNaN(t)}function A$(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return ec(i,n)?(n.forEach(o=>{const{accounts:a,methods:u,events:l}=t.namespaces[o],d=Pu(a),p=r[o];(!ec(q3(o,p),d)||!ec(p.methods,u)||!ec(p.events,l))&&(s=!1)}),s):!1}function Kd(t){return an(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function P$(t){if(an(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Kd(r)}}return!1}function M$(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(an(t,!1)){if(e(t))return!0;const r=e_(t);return e(r)}}catch{}return!1}function I$(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function C$(t){return t==null?void 0:t.topic}function T$(t,e){let r=null;return an(t==null?void 0:t.publicKey,!1)||(r=ut("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function __(t){let e=!0;return ic(t)?t.length&&(e=t.every(r=>an(r,!1))):e=!1,e}function R$(t,e,r){let n=null;return ic(e)&&e.length?e.forEach(i=>{n||Kd(i)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Kd(t)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function D$(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=R$(i,q3(i,s),`${e} ${r}`);o&&(n=o)}),n}function O$(t,e){let r=null;return ic(t)?t.forEach(n=>{r||P$(n)||(r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function N$(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=O$(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function L$(t,e){let r=null;return __(t==null?void 0:t.methods)?__(t==null?void 0:t.events)||(r=Dr("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Dr("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function E_(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=L$(n,`${e}, namespace`);i&&(r=i)}),r}function k$(t,e,r){let n=null;if(t&&Sl(t)){const i=E_(t,e);i&&(n=i);const s=D$(t,e,r);s&&(n=s)}else n=ut("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function h1(t,e){let r=null;if(t&&Sl(t)){const n=E_(t,e);n&&(r=n);const i=N$(t,e);i&&(r=i)}else r=ut("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function S_(t){return an(t.protocol,!0)}function B$(t,e){let r=!1;return t?t&&ic(t)&&t.length&&t.forEach(n=>{r=S_(n)}):r=!0,r}function $$(t){return typeof t=="number"}function yi(t){return typeof t<"u"&&typeof t!==null}function F$(t){return!(!t||typeof t!="object"||!t.code||!l1(t.code)||!t.message||!an(t.message,!1))}function j$(t){return!(bi(t)||!an(t.method,!1))}function U$(t){return!(bi(t)||bi(t.result)&&bi(t.error)||!l1(t.id)||!an(t.jsonrpc,!1))}function q$(t){return!(bi(t)||!an(t.name,!1))}function A_(t,e){return!(!Kd(e)||!y$(t).includes(e))}function z$(t,e,r){return an(r,!1)?w$(t,e).includes(r):!1}function H$(t,e,r){return an(r,!1)?x$(t,e).includes(r):!1}function P_(t,e,r){let n=null;const i=W$(t),s=K$(e),o=Object.keys(i),a=Object.keys(s),u=M_(Object.keys(t)),l=M_(Object.keys(e)),d=u.filter(p=>!l.includes(p));return d.length&&(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. +`)};function qB(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function zB(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function rc(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function HB(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:WB(e,r,n)}}}function WB(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function o_(t){return rc(t),`urn:recap:${qB(t).replace(/=/g,"")}`}function ml(t){const e=zB(t.replace("urn:recap:",""));return rc(e),e}function KB(t,e,r){const n=HB(t,e,r);return o_(n)}function VB(t){return t&&t.includes("urn:recap:")}function GB(t,e){const r=ml(t),n=ml(e),i=YB(r,n);return o_(i)}function YB(t,e){rc(t),rc(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,u)=>a.localeCompare(u)).forEach(a=>{var u,l;n.att[i]=FB($B({},n.att[i]),{[a]:((u=t.att[i])==null?void 0:u[a])||((l=e.att[i])==null?void 0:l[a])})})}),n}function JB(t="",e){rc(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const u=Object.keys(e.att[a]).map(p=>({ability:p.split("/")[0],action:p.split("/")[1]}));u.sort((p,y)=>p.action.localeCompare(y.action));const l={};u.forEach(p=>{l[p.ability]||(l[p.ability]=[]),l[p.ability].push(p.action)});const d=Object.keys(l).map(p=>(i++,`(${i}) '${p}': '${l[p].join("', '")}' for '${a}'.`));n.push(d.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function a_(t){var e;const r=ml(t);rc(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function c_(t){const e=ml(t);rc(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function zd(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return VB(e)?e:void 0}const u_="base10",ni="base16",la="base64pad",vl="base64url",bl="utf8",f_=0,So=1,yl=2,XB=0,l_=1,wl=12,a1=32;function ZB(){const t=Hm.generateKeyPair();return{privateKey:Rn(t.secretKey,ni),publicKey:Rn(t.publicKey,ni)}}function c1(){const t=ta.randomBytes(a1);return Rn(t,ni)}function QB(t,e){const r=Hm.sharedKey(Dn(t,ni),Dn(e,ni),!0),n=new Dk(ll.SHA256,r).expand(a1);return Rn(n,ni)}function Hd(t){const e=ll.hash(Dn(t,ni));return Rn(e,ni)}function Ao(t){const e=ll.hash(Dn(t,bl));return Rn(e,ni)}function h_(t){return Dn(`${t}`,u_)}function nc(t){return Number(Rn(t,u_))}function e$(t){const e=h_(typeof t.type<"u"?t.type:f_);if(nc(e)===So&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Dn(t.senderPublicKey,ni):void 0,n=typeof t.iv<"u"?Dn(t.iv,ni):ta.randomBytes(wl),i=new Um.ChaCha20Poly1305(Dn(t.symKey,ni)).seal(n,Dn(t.message,bl));return d_({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function t$(t,e){const r=h_(yl),n=ta.randomBytes(wl),i=Dn(t,bl);return d_({type:r,sealed:i,iv:n,encoding:e})}function r$(t){const e=new Um.ChaCha20Poly1305(Dn(t.symKey,ni)),{sealed:r,iv:n}=xl({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Rn(i,bl)}function n$(t,e){const{sealed:r}=xl({encoded:t,encoding:e});return Rn(r,bl)}function d_(t){const{encoding:e=la}=t;if(nc(t.type)===yl)return Rn(pd([t.type,t.sealed]),e);if(nc(t.type)===So){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Rn(pd([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return Rn(pd([t.type,t.iv,t.sealed]),e)}function xl(t){const{encoded:e,encoding:r=la}=t,n=Dn(e,r),i=n.slice(XB,l_),s=l_;if(nc(i)===So){const l=s+a1,d=l+wl,p=n.slice(s,l),y=n.slice(l,d),A=n.slice(d);return{type:i,sealed:A,iv:y,senderPublicKey:p}}if(nc(i)===yl){const l=n.slice(s),d=ta.randomBytes(wl);return{type:i,sealed:l,iv:d}}const o=s+wl,a=n.slice(s,o),u=n.slice(o);return{type:i,sealed:u,iv:a}}function i$(t,e){const r=xl({encoded:t,encoding:e==null?void 0:e.encoding});return p_({type:nc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Rn(r.senderPublicKey,ni):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function p_(t){const e=(t==null?void 0:t.type)||f_;if(e===So){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function g_(t){return t.type===So&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function m_(t){return t.type===yl}function s$(t){return new M3.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function o$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function a$(t){return Buffer.from(o$(t),"base64")}function c$(t,e){const[r,n,i]=t.split("."),s=a$(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),u=`${r}.${n}`,l=new ll.SHA256().update(Buffer.from(u)).digest(),d=s$(e),p=Buffer.from(l).toString("hex");if(!d.verify(p,{r:o,s:a}))throw new Error("Invalid signature");return gm(t).payload}const u$="irn";function u1(t){return(t==null?void 0:t.relay)||{protocol:u$}}function _l(t){const e=uB[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var f$=Object.defineProperty,l$=Object.defineProperties,h$=Object.getOwnPropertyDescriptors,v_=Object.getOwnPropertySymbols,d$=Object.prototype.hasOwnProperty,p$=Object.prototype.propertyIsEnumerable,b_=(t,e,r)=>e in t?f$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,y_=(t,e)=>{for(var r in e||(e={}))d$.call(e,r)&&b_(t,r,e[r]);if(v_)for(var r of v_(e))p$.call(e,r)&&b_(t,r,e[r]);return t},g$=(t,e)=>l$(t,h$(e));function m$(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function w_(t){if(!t.includes("wc:")){const u=t_(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=il.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:v$(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:m$(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function v$(t){return t.startsWith("//")?t.substring(2):t}function b$(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function x_(t){return`${t.protocol}:${t.topic}@${t.version}?`+il.stringify(y_(g$(y_({symKey:t.symKey},b$(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Wd(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Mu(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function y$(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Mu(r.accounts))}),e}function w$(t,e){const r=[];return Object.values(t).forEach(n=>{Mu(n.accounts).includes(e)&&r.push(...n.methods)}),r}function x$(t,e){const r=[];return Object.values(t).forEach(n=>{Mu(n.accounts).includes(e)&&r.push(...n.events)}),r}function f1(t){return t.includes(":")}function El(t){return f1(t)?t.split(":")[0]:t}function _$(t){const e={};return t==null||t.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function __(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=_$(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=Ud(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const E$={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},S$={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ut(t,e){const{message:r,code:n}=S$[t];return{message:e?`${r} ${e}`:r,code:n}}function Dr(t,e){const{message:r,code:n}=E$[t];return{message:e?`${r} ${e}`:r,code:n}}function ic(t,e){return!!Array.isArray(t)}function Sl(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function bi(t){return typeof t>"u"}function an(t,e){return e&&bi(t)?!0:typeof t=="string"&&!!t.trim().length}function l1(t,e){return typeof t=="number"&&!isNaN(t)}function A$(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return ec(i,n)?(n.forEach(o=>{const{accounts:a,methods:u,events:l}=t.namespaces[o],d=Mu(a),p=r[o];(!ec(z3(o,p),d)||!ec(p.methods,u)||!ec(p.events,l))&&(s=!1)}),s):!1}function Kd(t){return an(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function P$(t){if(an(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Kd(r)}}return!1}function M$(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(an(t,!1)){if(e(t))return!0;const r=t_(t);return e(r)}}catch{}return!1}function I$(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function C$(t){return t==null?void 0:t.topic}function T$(t,e){let r=null;return an(t==null?void 0:t.publicKey,!1)||(r=ut("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function E_(t){let e=!0;return ic(t)?t.length&&(e=t.every(r=>an(r,!1))):e=!1,e}function R$(t,e,r){let n=null;return ic(e)&&e.length?e.forEach(i=>{n||Kd(i)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Kd(t)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function D$(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=R$(i,z3(i,s),`${e} ${r}`);o&&(n=o)}),n}function O$(t,e){let r=null;return ic(t)?t.forEach(n=>{r||P$(n)||(r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function N$(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=O$(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function L$(t,e){let r=null;return E_(t==null?void 0:t.methods)?E_(t==null?void 0:t.events)||(r=Dr("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Dr("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function S_(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=L$(n,`${e}, namespace`);i&&(r=i)}),r}function k$(t,e,r){let n=null;if(t&&Sl(t)){const i=S_(t,e);i&&(n=i);const s=D$(t,e,r);s&&(n=s)}else n=ut("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function h1(t,e){let r=null;if(t&&Sl(t)){const n=S_(t,e);n&&(r=n);const i=N$(t,e);i&&(r=i)}else r=ut("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function A_(t){return an(t.protocol,!0)}function B$(t,e){let r=!1;return t?t&&ic(t)&&t.length&&t.forEach(n=>{r=A_(n)}):r=!0,r}function $$(t){return typeof t=="number"}function yi(t){return typeof t<"u"&&typeof t!==null}function F$(t){return!(!t||typeof t!="object"||!t.code||!l1(t.code)||!t.message||!an(t.message,!1))}function j$(t){return!(bi(t)||!an(t.method,!1))}function U$(t){return!(bi(t)||bi(t.result)&&bi(t.error)||!l1(t.id)||!an(t.jsonrpc,!1))}function q$(t){return!(bi(t)||!an(t.name,!1))}function P_(t,e){return!(!Kd(e)||!y$(t).includes(e))}function z$(t,e,r){return an(r,!1)?w$(t,e).includes(r):!1}function H$(t,e,r){return an(r,!1)?x$(t,e).includes(r):!1}function M_(t,e,r){let n=null;const i=W$(t),s=K$(e),o=Object.keys(i),a=Object.keys(s),u=I_(Object.keys(t)),l=I_(Object.keys(e)),d=u.filter(p=>!l.includes(p));return d.length&&(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${d.toString()} Received: ${Object.keys(e).toString()}`)),ec(o,a)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} - Approved: ${a.toString()}`)),Object.keys(e).forEach(p=>{if(!p.includes(":")||n)return;const y=Pu(e[p].accounts);y.includes(p)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${p} + Approved: ${a.toString()}`)),Object.keys(e).forEach(p=>{if(!p.includes(":")||n)return;const y=Mu(e[p].accounts);y.includes(p)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${p} Required: ${p} - Approved: ${y.toString()}`))}),o.forEach(p=>{n||(ec(i[p].methods,s[p].methods)?ec(i[p].events,s[p].events)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${p}`)):n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${p}`))}),n}function W$(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function M_(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function K$(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Pu(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function V$(t,e){return l1(t)&&t<=e.max&&t>=e.min}function I_(){const t=gl();return new Promise(e=>{switch(t){case Ri.browser:e(G$());break;case Ri.reactNative:e(Y$());break;case Ri.node:e(J$());break;default:e(!0)}})}function G$(){return pl()&&(navigator==null?void 0:navigator.onLine)}async function Y$(){if(Su()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function J$(){return!0}function X$(t){switch(gl()){case Ri.browser:Z$(t);break;case Ri.reactNative:Q$(t);break}}function Z$(t){!Su()&&pl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function Q$(t){Su()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const d1={};class Al{static get(e){return d1[e]}static set(e,r){d1[e]=r}static delete(e){delete d1[e]}}const eF="PARSE_ERROR",tF="INVALID_REQUEST",rF="METHOD_NOT_FOUND",nF="INVALID_PARAMS",C_="INTERNAL_ERROR",p1="SERVER_ERROR",iF=[-32700,-32600,-32601,-32602,-32603],Pl={[eF]:{code:-32700,message:"Parse error"},[tF]:{code:-32600,message:"Invalid Request"},[rF]:{code:-32601,message:"Method not found"},[nF]:{code:-32602,message:"Invalid params"},[C_]:{code:-32603,message:"Internal error"},[p1]:{code:-32e3,message:"Server error"}},T_=p1;function sF(t){return iF.includes(t)}function R_(t){return Object.keys(Pl).includes(t)?Pl[t]:Pl[T_]}function oF(t){const e=Object.values(Pl).find(r=>r.code===t);return e||Pl[T_]}function D_(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var O_={},Po={},N_;function aF(){if(N_)return Po;N_=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.isBrowserCryptoAvailable=Po.getSubtleCrypto=Po.getBrowerCrypto=void 0;function t(){return(nn==null?void 0:nn.crypto)||(nn==null?void 0:nn.msCrypto)||{}}Po.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Po.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Po.isBrowserCryptoAvailable=r,Po}var Mo={},L_;function cF(){if(L_)return Mo;L_=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.isBrowser=Mo.isNode=Mo.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Mo.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Mo.isNode=e;function r(){return!t()&&!e()}return Mo.isBrowser=r,Mo}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(aF(),t),e.__exportStar(cF(),t)})(O_);function ha(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function sc(t=6){return BigInt(ha(t))}function da(t,e,r){return{id:r||ha(),jsonrpc:"2.0",method:t,params:e}}function Vd(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Gd(t,e,r){return{id:t,jsonrpc:"2.0",error:uF(e)}}function uF(t,e){return typeof t>"u"?R_(C_):(typeof t=="string"&&(t=Object.assign(Object.assign({},R_(p1)),{message:t})),sF(t.code)&&(t=oF(t.code)),t)}let fF=class{},lF=class extends fF{constructor(){super()}},hF=class extends lF{constructor(e){super()}};const dF="^https?:",pF="^wss?:";function gF(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function k_(t,e){const r=gF(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function B_(t){return k_(t,dF)}function $_(t){return k_(t,pF)}function mF(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function F_(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function g1(t){return F_(t)&&"method"in t}function Yd(t){return F_(t)&&(Hs(t)||Yi(t))}function Hs(t){return"result"in t}function Yi(t){return"error"in t}let Ji=class extends hF{constructor(e){super(e),this.events=new qi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(da(e.method,e.params||[],e.id||sc().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Yi(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Yd(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const vF=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),bF=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",j_=t=>t.split("?")[0],U_=10,yF=vF();let wF=class{constructor(e){if(this.url=e,this.events=new qi.EventEmitter,this.registering=!1,!$_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(mo(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!$_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=O_.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!mF(e)},o=new yF(e,[],s);bF()?o.onerror=a=>{const u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ka(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return D_(e,j_(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>U_&&this.events.setMaxListeners(U_)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${j_(this.url)}`));return this.events.emit("register_error",r),r}};var Jd={exports:{}};Jd.exports,function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",u="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",p="[object Date]",y="[object Error]",A="[object Function]",P="[object GeneratorFunction]",N="[object Map]",D="[object Number]",k="[object Null]",B="[object Object]",j="[object Promise]",U="[object Proxy]",K="[object RegExp]",J="[object Set]",T="[object String]",z="[object Symbol]",ue="[object Undefined]",_e="[object WeakMap]",G="[object ArrayBuffer]",E="[object DataView]",m="[object Float32Array]",f="[object Float64Array]",g="[object Int8Array]",v="[object Int16Array]",x="[object Int32Array]",_="[object Uint8Array]",S="[object Uint8ClampedArray]",b="[object Uint16Array]",M="[object Uint32Array]",I=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,O={};O[m]=O[f]=O[g]=O[v]=O[x]=O[_]=O[S]=O[b]=O[M]=!0,O[a]=O[u]=O[G]=O[d]=O[E]=O[p]=O[y]=O[A]=O[N]=O[D]=O[B]=O[K]=O[J]=O[T]=O[_e]=!1;var se=typeof nn=="object"&&nn&&nn.Object===Object&&nn,ee=typeof self=="object"&&self&&self.Object===Object&&self,X=se||ee||Function("return this")(),Q=e&&!e.nodeType&&e,R=Q&&!0&&t&&!t.nodeType&&t,Z=R&&R.exports===Q,te=Z&&se.process,le=function(){try{return te&&te.binding&&te.binding("util")}catch{}}(),ie=le&&le.isTypedArray;function fe(ce,ye){for(var Ye=-1,It=ce==null?0:ce.length,jr=0,ir=[];++Ye-1}function st(ce,ye){var Ye=this.__data__,It=Xe(Ye,ce);return It<0?(++this.size,Ye.push([ce,ye])):Ye[It][1]=ye,this}Re.prototype.clear=De,Re.prototype.delete=it,Re.prototype.get=Ue,Re.prototype.has=gt,Re.prototype.set=st;function tt(ce){var ye=-1,Ye=ce==null?0:ce.length;for(this.clear();++yewn))return!1;var Ur=ir.get(ce);if(Ur&&ir.get(ye))return Ur==ye;var gn=-1,_i=!0,xn=Ye&s?new _t:void 0;for(ir.set(ce,ye),ir.set(ye,ce);++gn-1&&ce%1==0&&ce-1&&ce%1==0&&ce<=o}function up(ce){var ye=typeof ce;return ce!=null&&(ye=="object"||ye=="function")}function Pc(ce){return ce!=null&&typeof ce=="object"}var fp=ie?Te(ie):dr;function qb(ce){return jb(ce)?qe(ce):pr(ce)}function Fr(){return[]}function kr(){return!1}t.exports=Ub}(Jd,Jd.exports);var xF=Jd.exports;const _F=ji(xF),q_="wc",z_=2,H_="core",Ws=`${q_}@2:${H_}:`,EF={logger:"error"},SF={database:":memory:"},AF="crypto",W_="client_ed25519_seed",PF=mt.ONE_DAY,MF="keychain",IF="0.3",CF="messages",TF="0.3",RF=mt.SIX_HOURS,DF="publisher",K_="irn",OF="error",V_="wss://relay.walletconnect.org",NF="relayer",ii={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},LF="_subscription",Xi={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},kF=.1,m1="2.17.2",Wr={link_mode:"link_mode",relay:"relay"},BF="0.3",$F="WALLETCONNECT_CLIENT_ID",G_="WALLETCONNECT_LINK_MODE_APPS",Ks={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},FF="subscription",jF="0.3",UF=mt.FIVE_SECONDS*1e3,qF="pairing",zF="0.3",Ml={wc_pairingDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:0},res:{ttl:mt.ONE_DAY,prompt:!1,tag:0}}},oc={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},bs={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},HF="history",WF="0.3",KF="expirer",Zi={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},VF="0.3",GF="verify-api",YF="https://verify.walletconnect.com",Y_="https://verify.walletconnect.org",Il=Y_,JF=`${Il}/v3`,XF=[YF,Y_],ZF="echo",QF="https://echo.walletconnect.com",Vs={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},Io={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},ys={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},ac={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},cc={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Cl={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},ej=.1,tj="event-client",rj=86400,nj="https://pulse.walletconnect.org/batch";function ij(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(j);k!==B;){for(var K=P[k],J=0,T=j-1;(K!==0||J>>0,U[T]=K%a>>>0,K=K/a>>>0;if(K!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=j-D;z!==j&&U[z]===0;)z++;for(var ue=u.repeat(N);z>>0,j=new Uint8Array(B);P[N];){var U=r[P.charCodeAt(N)];if(U===255)return;for(var K=0,J=B-1;(U!==0||K>>0,j[J]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");k=K,N++}if(P[N]!==" "){for(var T=B-k;T!==B&&j[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=j[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:A}}var sj=ij,oj=sj;const J_=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},aj=t=>new TextEncoder().encode(t),cj=t=>new TextDecoder().decode(t);class uj{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class fj{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return X_(this,e)}}class lj{constructor(e){this.decoders=e}or(e){return X_(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const X_=(t,e)=>new lj({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class hj{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new uj(e,r,n),this.decoder=new fj(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Xd=({name:t,prefix:e,encode:r,decode:n})=>new hj(t,e,r,n),Tl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=oj(r,e);return Xd({prefix:t,name:e,encode:n,decode:s=>J_(i(s))})},dj=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},pj=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Xd({prefix:e,name:t,encode(i){return pj(i,n,r)},decode(i){return dj(i,n,r,t)}}),gj=Xd({prefix:"\0",name:"identity",encode:t=>cj(t),decode:t=>aj(t)});var mj=Object.freeze({__proto__:null,identity:gj});const vj=zn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var bj=Object.freeze({__proto__:null,base2:vj});const yj=zn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var wj=Object.freeze({__proto__:null,base8:yj});const xj=Tl({prefix:"9",name:"base10",alphabet:"0123456789"});var _j=Object.freeze({__proto__:null,base10:xj});const Ej=zn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Sj=zn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Aj=Object.freeze({__proto__:null,base16:Ej,base16upper:Sj});const Pj=zn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Mj=zn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ij=zn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Cj=zn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Tj=zn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Rj=zn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Dj=zn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Oj=zn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Nj=zn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Lj=Object.freeze({__proto__:null,base32:Pj,base32upper:Mj,base32pad:Ij,base32padupper:Cj,base32hex:Tj,base32hexupper:Rj,base32hexpad:Dj,base32hexpadupper:Oj,base32z:Nj});const kj=Tl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Bj=Tl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var $j=Object.freeze({__proto__:null,base36:kj,base36upper:Bj});const Fj=Tl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),jj=Tl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Uj=Object.freeze({__proto__:null,base58btc:Fj,base58flickr:jj});const qj=zn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zj=zn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Hj=zn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Wj=zn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Kj=Object.freeze({__proto__:null,base64:qj,base64pad:zj,base64url:Hj,base64urlpad:Wj});const Z_=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Vj=Z_.reduce((t,e,r)=>(t[r]=e,t),[]),Gj=Z_.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Yj(t){return t.reduce((e,r)=>(e+=Vj[r],e),"")}function Jj(t){const e=[];for(const r of t){const n=Gj[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const Xj=Xd({prefix:"🚀",name:"base256emoji",encode:Yj,decode:Jj});var Zj=Object.freeze({__proto__:null,base256emoji:Xj}),Qj=e6,Q_=128,eU=127,tU=~eU,rU=Math.pow(2,31);function e6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=rU;)e[r++]=t&255|Q_,t/=128;for(;t&tU;)e[r++]=t&255|Q_,t>>>=7;return e[r]=t|0,e6.bytes=r-n+1,e}var nU=v1,iU=128,t6=127;function v1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw v1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&t6)<=iU);return v1.bytes=s-n,r}var sU=Math.pow(2,7),oU=Math.pow(2,14),aU=Math.pow(2,21),cU=Math.pow(2,28),uU=Math.pow(2,35),fU=Math.pow(2,42),lU=Math.pow(2,49),hU=Math.pow(2,56),dU=Math.pow(2,63),pU=function(t){return t(r6.encode(t,e,r),e),i6=t=>r6.encodingLength(t),b1=(t,e)=>{const r=e.byteLength,n=i6(t),i=n+i6(r),s=new Uint8Array(i+r);return n6(t,s,0),n6(r,s,n),s.set(e,i),new mU(t,r,e,s)};class mU{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const s6=({name:t,code:e,encode:r})=>new vU(t,e,r);class vU{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?b1(this.code,r):r.then(n=>b1(this.code,n))}else throw Error("Unknown type, must be binary type")}}const o6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),bU=s6({name:"sha2-256",code:18,encode:o6("SHA-256")}),yU=s6({name:"sha2-512",code:19,encode:o6("SHA-512")});var wU=Object.freeze({__proto__:null,sha256:bU,sha512:yU});const a6=0,xU="identity",c6=J_;var _U=Object.freeze({__proto__:null,identity:{code:a6,name:xU,encode:c6,digest:t=>b1(a6,c6(t))}});new TextEncoder,new TextDecoder;const u6={...mj,...bj,...wj,..._j,...Aj,...Lj,...$j,...Uj,...Kj,...Zj};({...wU,..._U});function EU(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function f6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const l6=f6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),y1=f6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=EU(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=ut("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,G3(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Y3(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}},MU=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=AF,this.randomSessionIdentifier=c1(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=xx(i);return wx(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=ZB();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=xx(s),a=this.randomSessionIdentifier;return await LO(a,i,PF,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),u=QB(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||Hd(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=d_(o),u=mo(s);if(g_(a))return t$(u,o==null?void 0:o.encoding);if(p_(a)){const y=a.senderPublicKey,A=a.receiverPublicKey;i=await this.generateSharedKey(y,A)}const l=this.getSymKey(i),{type:d,senderPublicKey:p}=a;return e$({type:d,symKey:l,message:u,senderPublicKey:p,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=i$(s,o);if(g_(a)){const u=n$(s,o==null?void 0:o.encoding);return Ka(u)}if(p_(a)){const u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{const u=this.getSymKey(i),l=r$({symKey:u,encoded:s,encoding:o==null?void 0:o.encoding});return Ka(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=(i,s=la)=>{const o=xl({encoded:i,encoding:s});return nc(o.type)},this.getPayloadSenderPublicKey=(i,s=la)=>{const o=xl({encoded:i,encoding:s});return o.senderPublicKey?Tn(o.senderPublicKey,ni):void 0},this.core=e,this.logger=ri(r,this.name),this.keychain=n||new PU(this.core,this.logger)}get context(){return gi(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(W_)}catch{e=c1(),await this.keychain.set(W_,e)}return AU(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}};class IU extends zR{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=CF,this.version=TF,this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Ao(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Ao(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=ri(e,this.name),this.core=r}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,G3(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Y3(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class CU extends HR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new qi.EventEmitter,this.name=DF,this.queue=new Map,this.publishTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.failedPublishTimeout=mt.toMiliseconds(mt.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||RF,u=u1(s),l=(s==null?void 0:s.prompt)||!1,d=(s==null?void 0:s.tag)||0,p=(s==null?void 0:s.id)||sc().toString(),y={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:d,id:p,attestation:s==null?void 0:s.attestation}},A=`Failed to publish payload, please try again. id:${p} tag:${d}`,P=Date.now();let N,D=1;try{for(;N===void 0;){if(Date.now()-P>this.publishTimeout)throw new Error(A);this.logger.trace({id:p,attempts:D},`publisher.publish - attempt ${D}`),N=await await Au(this.rpcPublish(n,i,a,u,l,d,p,s==null?void 0:s.attestation).catch(k=>this.logger.warn(k)),this.publishTimeout,A),D++,N||await new Promise(k=>setTimeout(k,this.failedPublishTimeout))}this.relayer.events.emit(ii.publish,y),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:p,topic:n,message:i,opts:s}})}catch(k){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(k),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw k;this.queue.set(p,y)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=ri(r,this.name),this.registerEventListeners()}get context(){return gi(this.logger)}rpcPublish(e,r,n,i,s,o,a,u){var l,d,p,y;const A={method:_l(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:u},id:a};return bi((l=A.params)==null?void 0:l.prompt)&&((d=A.params)==null||delete d.prompt),bi((p=A.params)==null?void 0:p.tag)&&((y=A.params)==null||delete y.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:A}),this.relayer.request(A)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(iu.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ii.connection_stalled);return}this.checkQueue()}),this.relayer.on(ii.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class TU{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var RU=Object.defineProperty,DU=Object.defineProperties,OU=Object.getOwnPropertyDescriptors,h6=Object.getOwnPropertySymbols,NU=Object.prototype.hasOwnProperty,LU=Object.prototype.propertyIsEnumerable,d6=(t,e,r)=>e in t?RU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rl=(t,e)=>{for(var r in e||(e={}))NU.call(e,r)&&d6(t,r,e[r]);if(h6)for(var r of h6(e))LU.call(e,r)&&d6(t,r,e[r]);return t},w1=(t,e)=>DU(t,OU(e));class kU extends VR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new TU,this.events=new qi.EventEmitter,this.name=FF,this.version=jF,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Ws,this.subscribeTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=u1(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new mt.Watch;a.start(i);const u=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(u),a.stop(i),s(!0)),a.elapsed(i)>=UF&&(clearInterval(u),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ri(r,this.name),this.clientId=""}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=u1(n);await this.rpcUnsubscribe(e,r,i);const s=Dr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===Wr.relay&&await this.restartToComplete();const s={method:_l(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=Ao(e+this.clientId);if((n==null?void 0:n.transportType)===Wr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},mt.toMiliseconds(mt.ONE_SECOND)),a;const u=await Au(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return u?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ii.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Au(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Au(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:_l(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,w1(Rl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Rl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Rl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Ks.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Ks.deleted,w1(Rl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Ks.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);ic(r)&&this.onBatchSubscribe(r.map((n,i)=>w1(Rl({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(iu.pulse,async()=>{await this.checkPending()}),this.events.on(Ks.created,async e=>{const r=Ks.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Ks.deleted,async e=>{const r=Ks.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var BU=Object.defineProperty,p6=Object.getOwnPropertySymbols,$U=Object.prototype.hasOwnProperty,FU=Object.prototype.propertyIsEnumerable,g6=(t,e,r)=>e in t?BU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,m6=(t,e)=>{for(var r in e||(e={}))$U.call(e,r)&&g6(t,r,e[r]);if(p6)for(var r of p6(e))FU.call(e,r)&&g6(t,r,e[r]);return t};class jU extends WR{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new qi.EventEmitter,this.name=NF,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=mt.toMiliseconds(mt.THIRTY_SECONDS+mt.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||sc().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(u,l)=>{const d=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Xi.disconnect,d);const p=await o;this.provider.off(Xi.disconnect,d),u(p)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(jd())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(ii.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ii.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Xi.payload,this.onPayloadHandler),this.provider.on(Xi.connect,this.onConnectHandler),this.provider.on(Xi.disconnect,this.onDisconnectHandler),this.provider.on(Xi.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ri(e.logger,this.name):Qf(od({level:e.logger||OF})),this.messages=new IU(this.logger,e.core),this.subscriber=new kU(this,this.logger),this.publisher=new CU(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||V_,this.projectId=e.projectId,this.bundleId=mB(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return gi(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Wr.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",u;const l=d=>{d.topic===e&&(this.subscriber.off(Ks.created,l),u())};return await Promise.all([new Promise(d=>{u=d,this.subscriber.on(Ks.created,l)}),new Promise(async(d,p)=>{a=await this.subscriber.subscribe(e,m6({internal:{throwOnFailedPublish:o}},r)).catch(y=>{o&&p(y)})||a,d()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Au(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Xi.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Xi.disconnect,i),await Au(this.provider.connect(),mt.toMiliseconds(mt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await I_())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=En(mt.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(ii.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(jd())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Ji(new wF(wB({sdkVersion:m1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),g1(e)){if(!e.method.endsWith(LF))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:Wr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(m6({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else Yd(e)&&this.events.emit(ii.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ii.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Vd(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Xi.payload,this.onPayloadHandler),this.provider.off(Xi.connect,this.onConnectHandler),this.provider.off(Xi.disconnect,this.onDisconnectHandler),this.provider.off(Xi.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await I_();X$(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(ii.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},mt.toMiliseconds(kF))))}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var UU=Object.defineProperty,v6=Object.getOwnPropertySymbols,qU=Object.prototype.hasOwnProperty,zU=Object.prototype.propertyIsEnumerable,b6=(t,e,r)=>e in t?UU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,y6=(t,e)=>{for(var r in e||(e={}))qU.call(e,r)&&b6(t,r,e[r]);if(v6)for(var r of v6(e))zU.call(e,r)&&b6(t,r,e[r]);return t};class uc extends KR{constructor(e,r,n,i=Ws,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=BF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!bi(o)?this.map.set(this.getKey(o),o):I$(o)?this.map.set(o.id,o):C$(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>_F(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const u=y6(y6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=ri(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class HU{constructor(e,r){this.core=e,this.logger=r,this.name=qF,this.version=zF,this.events=new Yg,this.initialized=!1,this.storagePrefix=Ws,this.ignoredPayloadTypes=[So],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=c1(),s=await this.core.crypto.setSymKey(i),o=En(mt.FIVE_MINUTES),a={protocol:K_},u={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=w_({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(oc.create,u),this.core.expirer.set(s,o),await this.pairings.set(s,u),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Vs.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:u,methods:l}=y_(n.uri);i.props.properties.topic=s,i.addTrace(Vs.pairing_uri_validation_success),i.addTrace(Vs.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(Vs.existing_pairing),d.active)throw i.setError(Io.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Vs.pairing_not_expired)}const p=u||En(mt.FIVE_MINUTES),y={topic:s,relay:a,expiry:p,active:!1,methods:l};this.core.expirer.set(s,p),await this.pairings.set(s,y),i.addTrace(Vs.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(oc.create,y),i.addTrace(Vs.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Vs.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Io.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(A){throw i.setError(Io.subscribe_pairing_topic_failure),A}return i.addTrace(Vs.subscribe_pairing_topic_success),y},this.activate=async({topic:n})=>{this.isInitialized();const i=En(mt.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=tc();this.events.once(vr("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Dr("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,u=this.core.crypto.keychain.get(i);return w_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:u,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=da(i,s),a=await this.core.crypto.encode(n,o),u=Ml[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{const o=Vd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=Gd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method]?Ml[u.request.method].res:Ml.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Dr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>fa(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(oc.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{Hs(i)?this.events.emit(vr("pairing_ping",s),{}):Yi(i)&&this.events.emit(vr("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(oc.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Dr("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Dr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!yi(n)){const{message:a}=ut("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!M$(n.uri)){const{message:a}=ut("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}const o=y_(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&mt.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!an(n,!1)){const{message:i}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(fa(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ut("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=ri(r,this.name),this.pairings=new uc(this.core,this.logger,this.name,this.storagePrefix)}get context(){return gi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ii.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===Wr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{g1(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):Yd(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Zi.expired,async e=>{const{topic:r}=X3(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(oc.expire,{topic:r}))})}}class WU extends qR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new qi.EventEmitter,this.name=HF,this.version=WF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:En(mt.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(bs.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Yi(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(bs.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(bs.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:da(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(bs.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(bs.created,e=>{const r=bs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.updated,e=>{const r=bs.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.deleted,e=>{const r=bs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(iu.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{mt.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(bs.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class KU extends GR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new qi.EventEmitter,this.name=KF,this.version=VF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Zi.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Zi.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return xB(e);if(typeof e=="number")return _B(e);const{message:r}=ut("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Zi.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;mt.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Zi.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(iu.pulse,()=>this.checkExpirations()),this.events.on(Zi.created,e=>{const r=Zi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.expired,e=>{const r=Zi.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.deleted,e=>{const r=Zi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class VU extends YR{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=GF,this.verifyUrlV3=JF,this.storagePrefix=Ws,this.version=z_,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&mt.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!pl()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,u=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=nl(),d=this.startAbortTimer(mt.ONE_SECOND*5),p=await new Promise((y,A)=>{const P=()=>{window.removeEventListener("message",D),l.body.removeChild(N),A("attestation aborted")};this.abortController.signal.addEventListener("abort",P);const N=l.createElement("iframe");N.src=u,N.style.display="none",N.addEventListener("error",P,{signal:this.abortController.signal});const D=k=>{if(k.data&&typeof k.data=="string")try{const B=JSON.parse(k.data);if(B.type==="verify_attestation"){if(gm(B.attestation).payload.id!==o)return;clearInterval(d),l.body.removeChild(N),this.abortController.signal.removeEventListener("abort",P),window.removeEventListener("message",D),y(B.attestation===null?"":B.attestation)}}catch(B){this.logger.warn(B)}};l.body.appendChild(N),window.addEventListener("message",D,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",p),p}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(gm(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const u=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,u)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(mt.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Il;return XF.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Il}`),s=Il),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(mt.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=c$(i,s.publicKey),a={hasExpired:mt.toMiliseconds(o.exp)this.abortController.abort(),mt.toMiliseconds(e))}}class GU extends JR{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=ZF,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${QF}/${this.projectId}/clients`;await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=ri(r,this.context)}}var YU=Object.defineProperty,w6=Object.getOwnPropertySymbols,JU=Object.prototype.hasOwnProperty,XU=Object.prototype.propertyIsEnumerable,x6=(t,e,r)=>e in t?YU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dl=(t,e)=>{for(var r in e||(e={}))JU.call(e,r)&&x6(t,r,e[r]);if(w6)for(var r of w6(e))XU.call(e,r)&&x6(t,r,e[r]);return t};class ZU extends XR{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=tj,this.storagePrefix=Ws,this.storageVersion=ej,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!i1())try{const i={eventId:Q3(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:V3(this.core.relayer.protocol,this.core.relayer.version,m1)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:u}}=i,l=Q3(),d=this.core.projectId||"",p=Date.now(),y=Dl({eventId:l,timestamp:p,props:{event:s,type:o,properties:{topic:a,trace:u}},bundleId:d,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,y),this.shouldPersist=!0),y},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(u=>u.props.properties.topic===o);if(a)return Dl(Dl({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(iu.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{mt.fromMiliseconds(Date.now())-mt.fromMiliseconds(i.timestamp)>rj&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Dl(Dl({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${nj}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${m1}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>K3().url,this.logger=ri(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var QU=Object.defineProperty,_6=Object.getOwnPropertySymbols,eq=Object.prototype.hasOwnProperty,tq=Object.prototype.propertyIsEnumerable,E6=(t,e,r)=>e in t?QU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,S6=(t,e)=>{for(var r in e||(e={}))eq.call(e,r)&&E6(t,r,e[r]);if(_6)for(var r of _6(e))tq.call(e,r)&&E6(t,r,e[r]);return t};class x1 extends UR{constructor(e){var r;super(e),this.protocol=q_,this.version=z_,this.name=H_,this.events=new qi.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:u})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:Wr.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||V_,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=od({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:EF.logger}),{logger:i,chunkLoggerController:s}=jR({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ri(i,this.name),this.heartbeat=new NT,this.crypto=new MU(this,this.logger,e==null?void 0:e.keychain),this.history=new WU(this,this.logger),this.expirer=new KU(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new hR(S6(S6({},SF),e==null?void 0:e.storageOptions)),this.relayer=new jU({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new HU(this,this.logger),this.verify=new VU(this,this.logger,this.storage),this.echoClient=new GU(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new ZU(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new x1(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem($F,n),r}get context(){return gi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(G_,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(G_)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const rq=x1,A6="wc",P6=2,M6="client",_1=`${A6}@${P6}:${M6}:`,E1={name:M6,logger:"error"},I6="WALLETCONNECT_DEEPLINK_CHOICE",nq="proposal",C6="Proposal expired",iq="session",Mu=mt.SEVEN_DAYS,sq="engine",kn={wc_sessionPropose:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:mt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:mt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1119}}},S1={min:mt.FIVE_MINUTES,max:mt.SEVEN_DAYS},Gs={idle:"IDLE",active:"ACTIVE"},oq="request",aq=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],cq="wc",uq="auth",fq="authKeys",lq="pairingTopics",hq="requests",Zd=`${cq}@${1.5}:${uq}:`,Qd=`${Zd}:PUB_KEY`;var dq=Object.defineProperty,pq=Object.defineProperties,gq=Object.getOwnPropertyDescriptors,T6=Object.getOwnPropertySymbols,mq=Object.prototype.hasOwnProperty,vq=Object.prototype.propertyIsEnumerable,R6=(t,e,r)=>e in t?dq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))mq.call(e,r)&&R6(t,r,e[r]);if(T6)for(var r of T6(e))vq.call(e,r)&&R6(t,r,e[r]);return t},ws=(t,e)=>pq(t,gq(e));class bq extends QR{constructor(e){super(e),this.name=sq,this.events=new Yg,this.initialized=!1,this.requestQueue={state:Gs.idle,queue:[]},this.sessionRequestQueue={state:Gs.idle,queue:[]},this.requestQueueDelay=mt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(kn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=ws(tn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n;let l=i,d,p=!1;try{l&&(p=this.client.core.pairing.pairings.get(l).active)}catch(U){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),U}if(!l||!p){const{topic:U,uri:K}=await this.client.core.pairing.create();l=U,d=K}if(!l){const{message:U}=ut("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(U)}const y=await this.client.core.crypto.generateKeyPair(),A=kn.wc_sessionPropose.req.ttl||mt.FIVE_MINUTES,P=En(A),N=tn({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:K_}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:P,pairingTopic:l},a&&{sessionProperties:a}),{reject:D,resolve:k,done:B}=tc(A,C6);this.events.once(vr("session_connect"),async({error:U,session:K})=>{if(U)D(U);else if(K){K.self.publicKey=y;const J=ws(tn({},K),{pairingTopic:N.pairingTopic,requiredNamespaces:N.requiredNamespaces,optionalNamespaces:N.optionalNamespaces,transportType:Wr.relay});await this.client.session.set(K.topic,J),await this.setExpiry(K.topic,K.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:K.peer.metadata}),this.cleanupDuplicatePairings(J),k(J)}});const j=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:N,throwOnFailedPublish:!0});return await this.setProposal(j,tn({id:j},N)),{uri:d,approval:B}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[ys.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(z){throw o.setError(ac.no_internet_connection),z}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(z){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(ac.proposal_not_found),z}try{await this.isValidApprove(r)}catch(z){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(ac.session_approve_namespace_validation_failure),z}const{id:a,relayProtocol:u,namespaces:l,sessionProperties:d,sessionConfig:p}=r,y=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:A,proposer:P,requiredNamespaces:N,optionalNamespaces:D}=y;let k=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:A});k||(k=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:ys.session_approve_started,properties:{topic:A,trace:[ys.session_approve_started,ys.session_namespaces_validation_success]}}));const B=await this.client.core.crypto.generateKeyPair(),j=P.publicKey,U=await this.client.core.crypto.generateSharedKey(B,j),K=tn(tn({relay:{protocol:u??"irn"},namespaces:l,controller:{publicKey:B,metadata:this.client.metadata},expiry:En(Mu)},d&&{sessionProperties:d}),p&&{sessionConfig:p}),J=Wr.relay;k.addTrace(ys.subscribing_session_topic);try{await this.client.core.relayer.subscribe(U,{transportType:J})}catch(z){throw k.setError(ac.subscribe_session_topic_failure),z}k.addTrace(ys.subscribe_session_topic_success);const T=ws(tn({},K),{topic:U,requiredNamespaces:N,optionalNamespaces:D,pairingTopic:A,acknowledged:!1,self:K.controller,peer:{publicKey:P.publicKey,metadata:P.metadata},controller:B,transportType:Wr.relay});await this.client.session.set(U,T),k.addTrace(ys.store_session);try{k.addTrace(ys.publishing_session_settle),await this.sendRequest({topic:U,method:"wc_sessionSettle",params:K,throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(ac.session_settle_publish_failure),z}),k.addTrace(ys.session_settle_publish_success),k.addTrace(ys.publishing_session_approve),await this.sendResult({id:a,topic:A,result:{relay:{protocol:u??"irn"},responderPublicKey:B},throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(ac.session_approve_publish_failure),z}),k.addTrace(ys.session_approve_publish_success)}catch(z){throw this.client.logger.error(z),this.client.session.delete(U,Dr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(U),z}return this.client.core.eventClient.deleteEvent({eventId:k.eventId}),await this.client.core.pairing.updateMetadata({topic:A,metadata:P.metadata}),await this.client.proposal.delete(a,Dr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:A}),await this.setExpiry(U,En(Mu)),{topic:U,acknowledged:()=>Promise.resolve(this.client.session.get(U))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:kn.wc_sessionPropose.reject}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(p){throw this.client.logger.error("update() -> isValidUpdate() failed"),p}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=tc(),u=ha(),l=sc().toString(),d=this.client.session.get(n).namespaces;return this.events.once(vr("session_update",u),({error:p})=>{p?a(p):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:u,relayRpcId:l}).catch(p=>{this.client.logger.error(p),this.client.session.update(n,{namespaces:d}),a(p)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(u){throw this.client.logger.error("extend() -> isValidExtend() failed"),u}const{topic:n}=r,i=ha(),{done:s,resolve:o,reject:a}=tc();return this.events.once(vr("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,En(Mu)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(u=>{a(u)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(P){throw this.client.logger.error("request() -> isValidRequest() failed"),P}const{chainId:n,request:i,topic:s,expiry:o=kn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=ha(),l=sc().toString(),{done:d,resolve:p,reject:y}=tc(o,"Request expired. Please try again.");this.events.once(vr("session_request",u),({error:P,result:N})=>{P?y(P):p(N)});const A=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return A?(await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:A}).catch(P=>y(P)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),await d()):await Promise.all([new Promise(async P=>{await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(N=>y(N)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),P()}),new Promise(async P=>{var N;if(!((N=a.sessionConfig)!=null&&N.disableDeepLink)){const D=await AB(this.client.core.storage,I6);await EB({id:u,topic:s,wcDeepLink:D})}P()}),d()]).then(P=>P[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);Hs(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Yi(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=ha(),s=sc().toString(),{done:o,resolve:a,reject:u}=tc();this.events.once(vr("session_ping",i),({error:l})=>{l?u(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=sc().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Dr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ut("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>A$(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?Wr.link_mode:Wr.relay;o===Wr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:u="",uri:l,domain:d,nonce:p,type:y,exp:A,nbf:P,methods:N=[],expiry:D}=r,k=[...r.resources||[]],{topic:B,uri:j}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:B,uri:j}});const U=await this.client.core.crypto.generateKeyPair(),K=Hd(U);if(await Promise.all([this.client.auth.authKeys.set(Qd,{responseTopic:K,publicKey:U}),this.client.auth.pairingTopics.set(K,{topic:K,pairingTopic:B})]),await this.client.core.relayer.subscribe(K,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${B}`),N.length>0){const{namespace:_}=Eu(a[0]);let S=KB(_,"request",N);zd(k)&&(S=GB(S,k.pop())),k.push(S)}const J=D&&D>kn.wc_sessionAuthenticate.req.ttl?D:kn.wc_sessionAuthenticate.req.ttl,T={authPayload:{type:y??"caip122",chains:a,statement:u,aud:l,domain:d,version:"1",nonce:p,iat:new Date().toISOString(),exp:A,nbf:P,resources:k},requester:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(J)},z={eip155:{chains:a,methods:[...new Set(["personal_sign",...N])],events:["chainChanged","accountsChanged"]}},ue={requiredNamespaces:{},optionalNamespaces:z,relays:[{protocol:"irn"}],pairingTopic:B,proposer:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:En(kn.wc_sessionPropose.req.ttl)},{done:_e,resolve:G,reject:E}=tc(J,"Request expired"),m=async({error:_,session:S})=>{if(this.events.off(vr("session_request",g),f),_)E(_);else if(S){S.self.publicKey=U,await this.client.session.set(S.topic,S),await this.setExpiry(S.topic,S.expiry),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:S.peer.metadata});const b=this.client.session.get(S.topic);await this.deleteProposal(v),G({session:b})}},f=async _=>{var S,b,M;if(await this.deletePendingAuthRequest(g,{message:"fulfilled",code:0}),_.error){const X=Dr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return _.error.code===X.code?void 0:(this.events.off(vr("session_connect"),m),E(_.error.message))}await this.deleteProposal(v),this.events.off(vr("session_connect"),m);const{cacaos:I,responder:F}=_.result,ae=[],O=[];for(const X of I){await n_({cacao:X,projectId:this.client.core.projectId})||(this.client.logger.error(X,"Signature verification failed"),E(Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Q}=X,R=zd(Q.resources),Z=[o1(Q.iss)],te=qd(Q.iss);if(R){const le=o_(R),ie=a_(R);ae.push(...le),Z.push(...ie)}for(const le of Z)O.push(`${le}:${te}`)}const se=await this.client.core.crypto.generateSharedKey(U,F.publicKey);let ee;ae.length>0&&(ee={topic:se,acknowledged:!0,self:{publicKey:U,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:En(Mu),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:B,namespaces:x_([...new Set(ae)],[...new Set(O)]),transportType:o},await this.client.core.relayer.subscribe(se,{transportType:o}),await this.client.session.set(se,ee),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:F.metadata}),ee=this.client.session.get(se)),(S=this.client.metadata.redirect)!=null&&S.linkMode&&(b=F.metadata.redirect)!=null&&b.linkMode&&(M=F.metadata.redirect)!=null&&M.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(se,{transportType:Wr.link_mode})),G({auths:I,session:ee})},g=ha(),v=ha();this.events.once(vr("session_connect"),m),this.events.once(vr("session_request",g),f);let x;try{if(s){const _=da("wc_sessionAuthenticate",T,g);this.client.core.history.set(B,_);const S=await this.client.core.crypto.encode("",_,{type:yl,encoding:vl});x=Wd(n,B,S)}else await Promise.all([this.sendRequest({topic:B,method:"wc_sessionAuthenticate",params:T,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:g}),this.sendRequest({topic:B,method:"wc_sessionPropose",params:ue,expiry:kn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:v})])}catch(_){throw this.events.off(vr("session_connect"),m),this.events.off(vr("session_request",g),f),_}return await this.setProposal(v,tn({id:v},ue)),await this.setAuthRequest(g,{request:ws(tn({},T),{verifyContext:{}}),pairingTopic:B,transportType:o}),{uri:x??j,response:_e}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[cc.authenticated_session_approve_started]}});try{this.isInitialized()}catch(D){throw s.setError(Cl.no_internet_connection),D}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Cl.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||Wr.relay;a===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=Hd(u),p={type:So,receiverPublicKey:u,senderPublicKey:l},y=[],A=[];for(const D of i){if(!await n_({cacao:D,projectId:this.client.core.projectId})){s.setError(Cl.invalid_cacao);const K=Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:K,encodeOpts:p}),new Error(K.message)}s.addTrace(cc.cacaos_verified);const{p:k}=D,B=zd(k.resources),j=[o1(k.iss)],U=qd(k.iss);if(B){const K=o_(B),J=a_(B);y.push(...K),j.push(...J)}for(const K of j)A.push(`${K}:${U}`)}const P=await this.client.core.crypto.generateSharedKey(l,u);s.addTrace(cc.create_authenticated_session_topic);let N;if((y==null?void 0:y.length)>0){N={topic:P,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:u,metadata:o.requester.metadata},controller:u,expiry:En(Mu),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:x_([...new Set(y)],[...new Set(A)]),transportType:a},s.addTrace(cc.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(P,{transportType:a})}catch(D){throw s.setError(Cl.subscribe_authenticated_session_topic_failure),D}s.addTrace(cc.subscribe_authenticated_session_topic_success),await this.client.session.set(P,N),s.addTrace(cc.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(cc.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:p,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(D){throw s.setError(Cl.authenticated_session_approve_publish_failure),D}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:N}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),u=Hd(o),l={type:So,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:u,error:i,encodeOpts:l,rpcOpts:kn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return i_(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:u}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Dr("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(I6).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,Dr("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Gs.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(ac.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Dr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Gs.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,En(kn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=Wr.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||En(kn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l,appLink:d}=r,p=da(i,s,u);let y;const A=!!d;try{const D=A?vl:la;y=await this.client.core.crypto.encode(n,p,{encoding:D})}catch(D){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),D}let P;if(aq.includes(i)){const D=Ao(JSON.stringify(p)),k=Ao(y);P=await this.client.core.verify.register({id:k,decryptedId:D})}const N=kn[i].req;if(N.attestation=P,o&&(N.ttl=o),a&&(N.id=a),this.client.core.history.set(n,p),A){const D=Wd(d,n,y);await global.Linking.openURL(D,this.client.name)}else{const D=kn[i].req;o&&(D.ttl=o),a&&(D.id=a),l?(D.internal=ws(tn({},D.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,y,D)):this.client.core.relayer.publish(n,y,D).catch(k=>this.client.logger.error(k))}return p.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:u}=r,l=Vd(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=p?vl:la;d=await this.client.core.crypto.encode(i,l,ws(tn({},a||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),A}if(p){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=kn[y.request.method].res;o?(A.internal=ws(tn({},A.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,A)):this.client.core.relayer.publish(i,d,A).catch(P=>this.client.logger.error(P))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:u}=r,l=Gd(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=p?vl:la;d=await this.client.core.crypto.encode(i,l,ws(tn({},o||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),A}if(p){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=a||kn[y.request.method].res;this.client.core.relayer.publish(i,d,A)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;fa(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{fa(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Gs.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Gs.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Gs.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,u=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:u}))switch(u){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=ut("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:u}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(tn({},i.params));const d=a.expiryTimestamp||En(kn.wc_sessionPropose.req.ttl),p=tn({id:u,pairingTopic:n,expiryTimestamp:d},a);await this.setProposal(u,p);const y=await this.getVerifyContext({attestationId:s,hash:Ao(JSON.stringify(i)),encryptedId:o,metadata:p.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(Io.proposal_listener_not_found)),l==null||l.addTrace(Vs.emit_session_proposal),this.client.events.emit("session_proposal",{id:u,params:p,verifyContext:y})}catch(l){await this.sendError({id:u,topic:n,error:l,rpcOpts:kn.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(Hs(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const u=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const d=await this.client.core.crypto.generateSharedKey(u,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:d});const p=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:p}),await this.client.core.pairing.activate({topic:r})}else if(Yi(n)){await this.client.proposal.delete(s,Dr("USER_DISCONNECTED"));const o=vr("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(vr("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:u,namespaces:l,sessionProperties:d,sessionConfig:p}=n.params,y=ws(tn(tn({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},d&&{sessionProperties:d}),p&&{sessionConfig:p}),{transportType:Wr.relay}),A=vr("session_connect");if(this.events.listenerCount(A)===0)throw new Error(`emitting ${A} without any listeners 997`);this.events.emit(vr("session_connect"),{session:y}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;Hs(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(vr("session_approve",i),{})):Yi(n)&&(await this.client.session.delete(r,Dr("USER_DISCONNECTED")),this.events.emit(vr("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Dr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(tn({topic:r},i));try{Al.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(u){throw Al.delete(o),u}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=vr("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_update",i),{}):Yi(n)&&this.events.emit(vr("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,En(Mu)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=vr("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_extend",i),{}):Yi(n)&&this.events.emit(vr("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=vr("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{Hs(n)?this.events.emit(vr("session_ping",i),{}):Yi(n)&&this.events.emit(vr("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(ii.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Dr("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:u,encryptedId:l,transportType:d}=r,{id:p,params:y}=a;try{await this.isValidRequest(tn({topic:o},y));const A=this.client.session.get(o),P=await this.getVerifyContext({attestationId:u,hash:Ao(JSON.stringify(da("wc_sessionRequest",y,p))),encryptedId:l,metadata:A.peer.metadata,transportType:d}),N={id:p,topic:o,params:y,verifyContext:P};await this.setPendingSessionRequest(N),d===Wr.link_mode&&(n=A.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=A.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(N):(this.addSessionRequestToSessionRequestQueue(N),this.processSessionRequestQueue())}catch(A){await this.sendError({id:p,topic:o,error:A}),this.client.logger.error(A)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=vr("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(tn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Al.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:u}=r;try{const{requester:l,authPayload:d,expiryTimestamp:p}=s.params,y=await this.getVerifyContext({attestationId:o,hash:Ao(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:u}),A={requester:l,pairingTopic:i,id:s.id,authPayload:d,verifyContext:y,expiryTimestamp:p};await this.setAuthRequest(s.id,{request:A,pairingTopic:i,transportType:u}),u===Wr.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:y})}catch(l){this.client.logger.error(l);const d=s.params.requester.publicKey,p=await this.client.core.crypto.generateKeyPair(),y=this.getAppLinkIfEnabled(s.params.requester.metadata,u),A={type:So,receiverPublicKey:d,senderPublicKey:p};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:A,rpcOpts:kn.wc_sessionAuthenticate.autoReject,appLink:y})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Gs.idle,this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=vr("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(vr("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Gs.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Gs.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:da("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(bi(n)||await this.isValidPairingTopic(n),!B$(a)){const{message:u}=ut("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!bi(i)&&Sl(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!bi(s)&&Sl(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),bi(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=k$(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!yi(r))throw new Error(ut("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),u=h1(i,"approve()");if(u)throw new Error(u.message);const l=P_(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!an(s,!0)){const{message:d}=ut("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}bi(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!yi(r)){const{message:s}=ut("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!F$(i)){const{message:s}=ut("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!yi(r)){const{message:l}=ut("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!S_(n)){const{message:l}=ut("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=T$(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const u=h1(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(fa(o)){const{message:l}=ut("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=h1(i,"update()");if(o)throw new Error(o.message);const a=P_(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!A_(a,s)){const{message:u}=ut("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!j$(i)){const{message:u}=ut("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!z$(a,s,i.method)){const{message:u}=ut("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!V$(o,S1)){const{message:u}=ut("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${S1.min} and ${S1.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!yi(r)){const{message:o}=ut("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!U$(s)){const{message:o}=ut("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!yi(r)){const{message:a}=ut("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!A_(o,s)){const{message:a}=ut("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!q$(i)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!H$(o,s,i.name)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!an(i,!1))throw new Error("uri is required parameter");if(!an(s,!1))throw new Error("domain is required parameter");if(!an(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(u=>Eu(u).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Eu(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,u={verified:{verifyUrl:o.verifyUrl||Il,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Wr.link_mode){const d=this.getAppLinkIfEnabled(o,a);return u.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",u}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(u.verified.origin=l.origin,u.verified.isScam=l.isScam,u.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(u)}`),u},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!an(i,!1)){const{message:s}=ut("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,u,l,d,p,y;return!r||n!==Wr.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(u=this.client.metadata)==null?void 0:u.redirect)==null?void 0:l.universal)!==""&&((d=r==null?void 0:r.redirect)==null?void 0:d.universal)!==void 0&&((p=r==null?void 0:r.redirect)==null?void 0:p.universal)!==""&&((y=r==null?void 0:r.redirect)==null?void 0:y.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=Z3(r,"topic")||"",i=decodeURIComponent(Z3(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:Wr.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(i1()||Su()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ii.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(Qd)?this.client.auth.authKeys.get(Qd):{publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===Wr.link_mode?vl:la});try{g1(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:Ao(n)})):Yd(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(u){this.client.logger.error(u)}}registerExpirerEvents(){this.client.core.expirer.on(Zi.expired,async e=>{const{topic:r,id:n}=X3(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ut("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,ut("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(oc.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(oc.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=ut("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=ut("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=ut("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(an(e,!1)){const{message:r}=ut("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=ut("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!$$(e)){const{message:r}=ut("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=ut("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class yq extends uc{constructor(e,r){super(e,r,nq,_1),this.core=e,this.logger=r}}let wq=class extends uc{constructor(e,r){super(e,r,iq,_1),this.core=e,this.logger=r}};class xq extends uc{constructor(e,r){super(e,r,oq,_1,n=>n.id),this.core=e,this.logger=r}}class _q extends uc{constructor(e,r){super(e,r,fq,Zd,()=>Qd),this.core=e,this.logger=r}}class Eq extends uc{constructor(e,r){super(e,r,lq,Zd),this.core=e,this.logger=r}}class Sq extends uc{constructor(e,r){super(e,r,hq,Zd,n=>n.id),this.core=e,this.logger=r}}class Aq{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new _q(this.core,this.logger),this.pairingTopics=new Eq(this.core,this.logger),this.requests=new Sq(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class A1 extends ZR{constructor(e){super(e),this.protocol=A6,this.version=P6,this.name=E1.name,this.events=new qi.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||E1.name,this.metadata=(e==null?void 0:e.metadata)||K3(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||E1.logger}));this.core=(e==null?void 0:e.core)||new rq(e),this.logger=ri(r,this.name),this.session=new wq(this.core,this.logger),this.proposal=new yq(this.core,this.logger),this.pendingRequest=new xq(this.core,this.logger),this.engine=new bq(this),this.auth=new Aq(this.core,this.logger)}static async init(e){const r=new A1(e);return await r.initialize(),r}get context(){return gi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var e0={exports:{}};/** + Approved: ${y.toString()}`))}),o.forEach(p=>{n||(ec(i[p].methods,s[p].methods)?ec(i[p].events,s[p].events)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${p}`)):n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${p}`))}),n}function W$(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function I_(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function K$(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Mu(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function V$(t,e){return l1(t)&&t<=e.max&&t>=e.min}function C_(){const t=gl();return new Promise(e=>{switch(t){case Ri.browser:e(G$());break;case Ri.reactNative:e(Y$());break;case Ri.node:e(J$());break;default:e(!0)}})}function G$(){return pl()&&(navigator==null?void 0:navigator.onLine)}async function Y$(){if(Au()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function J$(){return!0}function X$(t){switch(gl()){case Ri.browser:Z$(t);break;case Ri.reactNative:Q$(t);break}}function Z$(t){!Au()&&pl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function Q$(t){Au()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const d1={};class Al{static get(e){return d1[e]}static set(e,r){d1[e]=r}static delete(e){delete d1[e]}}const eF="PARSE_ERROR",tF="INVALID_REQUEST",rF="METHOD_NOT_FOUND",nF="INVALID_PARAMS",T_="INTERNAL_ERROR",p1="SERVER_ERROR",iF=[-32700,-32600,-32601,-32602,-32603],Pl={[eF]:{code:-32700,message:"Parse error"},[tF]:{code:-32600,message:"Invalid Request"},[rF]:{code:-32601,message:"Method not found"},[nF]:{code:-32602,message:"Invalid params"},[T_]:{code:-32603,message:"Internal error"},[p1]:{code:-32e3,message:"Server error"}},R_=p1;function sF(t){return iF.includes(t)}function D_(t){return Object.keys(Pl).includes(t)?Pl[t]:Pl[R_]}function oF(t){const e=Object.values(Pl).find(r=>r.code===t);return e||Pl[R_]}function O_(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var N_={},Po={},L_;function aF(){if(L_)return Po;L_=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.isBrowserCryptoAvailable=Po.getSubtleCrypto=Po.getBrowerCrypto=void 0;function t(){return(nn==null?void 0:nn.crypto)||(nn==null?void 0:nn.msCrypto)||{}}Po.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Po.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Po.isBrowserCryptoAvailable=r,Po}var Mo={},k_;function cF(){if(k_)return Mo;k_=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.isBrowser=Mo.isNode=Mo.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Mo.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Mo.isNode=e;function r(){return!t()&&!e()}return Mo.isBrowser=r,Mo}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(aF(),t),e.__exportStar(cF(),t)})(N_);function ha(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function sc(t=6){return BigInt(ha(t))}function da(t,e,r){return{id:r||ha(),jsonrpc:"2.0",method:t,params:e}}function Vd(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Gd(t,e,r){return{id:t,jsonrpc:"2.0",error:uF(e)}}function uF(t,e){return typeof t>"u"?D_(T_):(typeof t=="string"&&(t=Object.assign(Object.assign({},D_(p1)),{message:t})),sF(t.code)&&(t=oF(t.code)),t)}let fF=class{},lF=class extends fF{constructor(){super()}},hF=class extends lF{constructor(e){super()}};const dF="^https?:",pF="^wss?:";function gF(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function B_(t,e){const r=gF(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function $_(t){return B_(t,dF)}function F_(t){return B_(t,pF)}function mF(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function j_(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function g1(t){return j_(t)&&"method"in t}function Yd(t){return j_(t)&&(Hs(t)||Yi(t))}function Hs(t){return"result"in t}function Yi(t){return"error"in t}let Ji=class extends hF{constructor(e){super(e),this.events=new qi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(da(e.method,e.params||[],e.id||sc().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Yi(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Yd(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const vF=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),bF=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",U_=t=>t.split("?")[0],q_=10,yF=vF();let wF=class{constructor(e){if(this.url=e,this.events=new qi.EventEmitter,this.registering=!1,!F_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(mo(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!F_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=N_.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!mF(e)},o=new yF(e,[],s);bF()?o.onerror=a=>{const u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ka(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return O_(e,U_(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>q_&&this.events.setMaxListeners(q_)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${U_(this.url)}`));return this.events.emit("register_error",r),r}};var Jd={exports:{}};Jd.exports,function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",u="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",p="[object Date]",y="[object Error]",A="[object Function]",P="[object GeneratorFunction]",N="[object Map]",D="[object Number]",k="[object Null]",B="[object Object]",q="[object Promise]",j="[object Proxy]",H="[object RegExp]",J="[object Set]",T="[object String]",z="[object Symbol]",ue="[object Undefined]",_e="[object WeakMap]",G="[object ArrayBuffer]",E="[object DataView]",m="[object Float32Array]",f="[object Float64Array]",g="[object Int8Array]",v="[object Int16Array]",x="[object Int32Array]",_="[object Uint8Array]",S="[object Uint8ClampedArray]",b="[object Uint16Array]",M="[object Uint32Array]",I=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,O={};O[m]=O[f]=O[g]=O[v]=O[x]=O[_]=O[S]=O[b]=O[M]=!0,O[a]=O[u]=O[G]=O[d]=O[E]=O[p]=O[y]=O[A]=O[N]=O[D]=O[B]=O[H]=O[J]=O[T]=O[_e]=!1;var se=typeof nn=="object"&&nn&&nn.Object===Object&&nn,ee=typeof self=="object"&&self&&self.Object===Object&&self,X=se||ee||Function("return this")(),Q=e&&!e.nodeType&&e,R=Q&&!0&&t&&!t.nodeType&&t,Z=R&&R.exports===Q,te=Z&&se.process,le=function(){try{return te&&te.binding&&te.binding("util")}catch{}}(),ie=le&&le.isTypedArray;function fe(ce,ye){for(var Ye=-1,It=ce==null?0:ce.length,jr=0,ir=[];++Ye-1}function st(ce,ye){var Ye=this.__data__,It=Xe(Ye,ce);return It<0?(++this.size,Ye.push([ce,ye])):Ye[It][1]=ye,this}Re.prototype.clear=De,Re.prototype.delete=it,Re.prototype.get=Ue,Re.prototype.has=gt,Re.prototype.set=st;function tt(ce){var ye=-1,Ye=ce==null?0:ce.length;for(this.clear();++yewn))return!1;var Ur=ir.get(ce);if(Ur&&ir.get(ye))return Ur==ye;var gn=-1,_i=!0,xn=Ye&s?new _t:void 0;for(ir.set(ce,ye),ir.set(ye,ce);++gn-1&&ce%1==0&&ce-1&&ce%1==0&&ce<=o}function up(ce){var ye=typeof ce;return ce!=null&&(ye=="object"||ye=="function")}function Pc(ce){return ce!=null&&typeof ce=="object"}var fp=ie?Te(ie):dr;function zb(ce){return Ub(ce)?qe(ce):pr(ce)}function Fr(){return[]}function kr(){return!1}t.exports=qb}(Jd,Jd.exports);var xF=Jd.exports;const _F=ji(xF),z_="wc",H_=2,W_="core",Ws=`${z_}@2:${W_}:`,EF={logger:"error"},SF={database:":memory:"},AF="crypto",K_="client_ed25519_seed",PF=mt.ONE_DAY,MF="keychain",IF="0.3",CF="messages",TF="0.3",RF=mt.SIX_HOURS,DF="publisher",V_="irn",OF="error",G_="wss://relay.walletconnect.org",NF="relayer",ii={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},LF="_subscription",Xi={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},kF=.1,m1="2.17.2",Wr={link_mode:"link_mode",relay:"relay"},BF="0.3",$F="WALLETCONNECT_CLIENT_ID",Y_="WALLETCONNECT_LINK_MODE_APPS",Ks={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},FF="subscription",jF="0.3",UF=mt.FIVE_SECONDS*1e3,qF="pairing",zF="0.3",Ml={wc_pairingDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:0},res:{ttl:mt.ONE_DAY,prompt:!1,tag:0}}},oc={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},bs={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},HF="history",WF="0.3",KF="expirer",Zi={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},VF="0.3",GF="verify-api",YF="https://verify.walletconnect.com",J_="https://verify.walletconnect.org",Il=J_,JF=`${Il}/v3`,XF=[YF,J_],ZF="echo",QF="https://echo.walletconnect.com",Vs={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},Io={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},ys={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},ac={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},cc={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Cl={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},ej=.1,tj="event-client",rj=86400,nj="https://pulse.walletconnect.org/batch";function ij(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,j=new Uint8Array(q);k!==B;){for(var H=P[k],J=0,T=q-1;(H!==0||J>>0,j[T]=H%a>>>0,H=H/a>>>0;if(H!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=q-D;z!==q&&j[z]===0;)z++;for(var ue=u.repeat(N);z>>0,q=new Uint8Array(B);P[N];){var j=r[P.charCodeAt(N)];if(j===255)return;for(var H=0,J=B-1;(j!==0||H>>0,q[J]=j%256>>>0,j=j/256>>>0;if(j!==0)throw new Error("Non-zero carry");k=H,N++}if(P[N]!==" "){for(var T=B-k;T!==B&&q[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=q[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:A}}var sj=ij,oj=sj;const X_=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},aj=t=>new TextEncoder().encode(t),cj=t=>new TextDecoder().decode(t);class uj{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class fj{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Z_(this,e)}}class lj{constructor(e){this.decoders=e}or(e){return Z_(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Z_=(t,e)=>new lj({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class hj{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new uj(e,r,n),this.decoder=new fj(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Xd=({name:t,prefix:e,encode:r,decode:n})=>new hj(t,e,r,n),Tl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=oj(r,e);return Xd({prefix:t,name:e,encode:n,decode:s=>X_(i(s))})},dj=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},pj=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Xd({prefix:e,name:t,encode(i){return pj(i,n,r)},decode(i){return dj(i,n,r,t)}}),gj=Xd({prefix:"\0",name:"identity",encode:t=>cj(t),decode:t=>aj(t)});var mj=Object.freeze({__proto__:null,identity:gj});const vj=zn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var bj=Object.freeze({__proto__:null,base2:vj});const yj=zn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var wj=Object.freeze({__proto__:null,base8:yj});const xj=Tl({prefix:"9",name:"base10",alphabet:"0123456789"});var _j=Object.freeze({__proto__:null,base10:xj});const Ej=zn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Sj=zn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Aj=Object.freeze({__proto__:null,base16:Ej,base16upper:Sj});const Pj=zn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Mj=zn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ij=zn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Cj=zn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Tj=zn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Rj=zn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Dj=zn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Oj=zn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Nj=zn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Lj=Object.freeze({__proto__:null,base32:Pj,base32upper:Mj,base32pad:Ij,base32padupper:Cj,base32hex:Tj,base32hexupper:Rj,base32hexpad:Dj,base32hexpadupper:Oj,base32z:Nj});const kj=Tl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Bj=Tl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var $j=Object.freeze({__proto__:null,base36:kj,base36upper:Bj});const Fj=Tl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),jj=Tl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Uj=Object.freeze({__proto__:null,base58btc:Fj,base58flickr:jj});const qj=zn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zj=zn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Hj=zn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Wj=zn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Kj=Object.freeze({__proto__:null,base64:qj,base64pad:zj,base64url:Hj,base64urlpad:Wj});const Q_=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Vj=Q_.reduce((t,e,r)=>(t[r]=e,t),[]),Gj=Q_.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Yj(t){return t.reduce((e,r)=>(e+=Vj[r],e),"")}function Jj(t){const e=[];for(const r of t){const n=Gj[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const Xj=Xd({prefix:"🚀",name:"base256emoji",encode:Yj,decode:Jj});var Zj=Object.freeze({__proto__:null,base256emoji:Xj}),Qj=t6,e6=128,eU=127,tU=~eU,rU=Math.pow(2,31);function t6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=rU;)e[r++]=t&255|e6,t/=128;for(;t&tU;)e[r++]=t&255|e6,t>>>=7;return e[r]=t|0,t6.bytes=r-n+1,e}var nU=v1,iU=128,r6=127;function v1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw v1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&r6)<=iU);return v1.bytes=s-n,r}var sU=Math.pow(2,7),oU=Math.pow(2,14),aU=Math.pow(2,21),cU=Math.pow(2,28),uU=Math.pow(2,35),fU=Math.pow(2,42),lU=Math.pow(2,49),hU=Math.pow(2,56),dU=Math.pow(2,63),pU=function(t){return t(n6.encode(t,e,r),e),s6=t=>n6.encodingLength(t),b1=(t,e)=>{const r=e.byteLength,n=s6(t),i=n+s6(r),s=new Uint8Array(i+r);return i6(t,s,0),i6(r,s,n),s.set(e,i),new mU(t,r,e,s)};class mU{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const o6=({name:t,code:e,encode:r})=>new vU(t,e,r);class vU{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?b1(this.code,r):r.then(n=>b1(this.code,n))}else throw Error("Unknown type, must be binary type")}}const a6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),bU=o6({name:"sha2-256",code:18,encode:a6("SHA-256")}),yU=o6({name:"sha2-512",code:19,encode:a6("SHA-512")});var wU=Object.freeze({__proto__:null,sha256:bU,sha512:yU});const c6=0,xU="identity",u6=X_;var _U=Object.freeze({__proto__:null,identity:{code:c6,name:xU,encode:u6,digest:t=>b1(c6,u6(t))}});new TextEncoder,new TextDecoder;const f6={...mj,...bj,...wj,..._j,...Aj,...Lj,...$j,...Uj,...Kj,...Zj};({...wU,..._U});function EU(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function l6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const h6=l6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),y1=l6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=EU(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=ut("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Y3(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?J3(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}},MU=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=AF,this.randomSessionIdentifier=c1(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=_x(i);return xx(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=ZB();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=_x(s),a=this.randomSessionIdentifier;return await LO(a,i,PF,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),u=QB(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||Hd(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=p_(o),u=mo(s);if(m_(a))return t$(u,o==null?void 0:o.encoding);if(g_(a)){const y=a.senderPublicKey,A=a.receiverPublicKey;i=await this.generateSharedKey(y,A)}const l=this.getSymKey(i),{type:d,senderPublicKey:p}=a;return e$({type:d,symKey:l,message:u,senderPublicKey:p,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=i$(s,o);if(m_(a)){const u=n$(s,o==null?void 0:o.encoding);return Ka(u)}if(g_(a)){const u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{const u=this.getSymKey(i),l=r$({symKey:u,encoded:s,encoding:o==null?void 0:o.encoding});return Ka(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=(i,s=la)=>{const o=xl({encoded:i,encoding:s});return nc(o.type)},this.getPayloadSenderPublicKey=(i,s=la)=>{const o=xl({encoded:i,encoding:s});return o.senderPublicKey?Rn(o.senderPublicKey,ni):void 0},this.core=e,this.logger=ri(r,this.name),this.keychain=n||new PU(this.core,this.logger)}get context(){return gi(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(K_)}catch{e=c1(),await this.keychain.set(K_,e)}return AU(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}};class IU extends zR{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=CF,this.version=TF,this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Ao(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Ao(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=ri(e,this.name),this.core=r}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Y3(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?J3(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class CU extends HR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new qi.EventEmitter,this.name=DF,this.queue=new Map,this.publishTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.failedPublishTimeout=mt.toMiliseconds(mt.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||RF,u=u1(s),l=(s==null?void 0:s.prompt)||!1,d=(s==null?void 0:s.tag)||0,p=(s==null?void 0:s.id)||sc().toString(),y={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:d,id:p,attestation:s==null?void 0:s.attestation}},A=`Failed to publish payload, please try again. id:${p} tag:${d}`,P=Date.now();let N,D=1;try{for(;N===void 0;){if(Date.now()-P>this.publishTimeout)throw new Error(A);this.logger.trace({id:p,attempts:D},`publisher.publish - attempt ${D}`),N=await await Pu(this.rpcPublish(n,i,a,u,l,d,p,s==null?void 0:s.attestation).catch(k=>this.logger.warn(k)),this.publishTimeout,A),D++,N||await new Promise(k=>setTimeout(k,this.failedPublishTimeout))}this.relayer.events.emit(ii.publish,y),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:p,topic:n,message:i,opts:s}})}catch(k){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(k),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw k;this.queue.set(p,y)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=ri(r,this.name),this.registerEventListeners()}get context(){return gi(this.logger)}rpcPublish(e,r,n,i,s,o,a,u){var l,d,p,y;const A={method:_l(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:u},id:a};return bi((l=A.params)==null?void 0:l.prompt)&&((d=A.params)==null||delete d.prompt),bi((p=A.params)==null?void 0:p.tag)&&((y=A.params)==null||delete y.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:A}),this.relayer.request(A)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(su.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ii.connection_stalled);return}this.checkQueue()}),this.relayer.on(ii.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class TU{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var RU=Object.defineProperty,DU=Object.defineProperties,OU=Object.getOwnPropertyDescriptors,d6=Object.getOwnPropertySymbols,NU=Object.prototype.hasOwnProperty,LU=Object.prototype.propertyIsEnumerable,p6=(t,e,r)=>e in t?RU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rl=(t,e)=>{for(var r in e||(e={}))NU.call(e,r)&&p6(t,r,e[r]);if(d6)for(var r of d6(e))LU.call(e,r)&&p6(t,r,e[r]);return t},w1=(t,e)=>DU(t,OU(e));class kU extends VR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new TU,this.events=new qi.EventEmitter,this.name=FF,this.version=jF,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Ws,this.subscribeTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=u1(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new mt.Watch;a.start(i);const u=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(u),a.stop(i),s(!0)),a.elapsed(i)>=UF&&(clearInterval(u),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ri(r,this.name),this.clientId=""}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=u1(n);await this.rpcUnsubscribe(e,r,i);const s=Dr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===Wr.relay&&await this.restartToComplete();const s={method:_l(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=Ao(e+this.clientId);if((n==null?void 0:n.transportType)===Wr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},mt.toMiliseconds(mt.ONE_SECOND)),a;const u=await Pu(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return u?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ii.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Pu(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Pu(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:_l(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,w1(Rl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Rl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Rl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Ks.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Ks.deleted,w1(Rl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Ks.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);ic(r)&&this.onBatchSubscribe(r.map((n,i)=>w1(Rl({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(su.pulse,async()=>{await this.checkPending()}),this.events.on(Ks.created,async e=>{const r=Ks.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Ks.deleted,async e=>{const r=Ks.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var BU=Object.defineProperty,g6=Object.getOwnPropertySymbols,$U=Object.prototype.hasOwnProperty,FU=Object.prototype.propertyIsEnumerable,m6=(t,e,r)=>e in t?BU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v6=(t,e)=>{for(var r in e||(e={}))$U.call(e,r)&&m6(t,r,e[r]);if(g6)for(var r of g6(e))FU.call(e,r)&&m6(t,r,e[r]);return t};class jU extends WR{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new qi.EventEmitter,this.name=NF,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=mt.toMiliseconds(mt.THIRTY_SECONDS+mt.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||sc().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(u,l)=>{const d=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Xi.disconnect,d);const p=await o;this.provider.off(Xi.disconnect,d),u(p)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(jd())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(ii.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ii.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Xi.payload,this.onPayloadHandler),this.provider.on(Xi.connect,this.onConnectHandler),this.provider.on(Xi.disconnect,this.onDisconnectHandler),this.provider.on(Xi.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ri(e.logger,this.name):Qf(od({level:e.logger||OF})),this.messages=new IU(this.logger,e.core),this.subscriber=new kU(this,this.logger),this.publisher=new CU(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||G_,this.projectId=e.projectId,this.bundleId=mB(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return gi(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Wr.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",u;const l=d=>{d.topic===e&&(this.subscriber.off(Ks.created,l),u())};return await Promise.all([new Promise(d=>{u=d,this.subscriber.on(Ks.created,l)}),new Promise(async(d,p)=>{a=await this.subscriber.subscribe(e,v6({internal:{throwOnFailedPublish:o}},r)).catch(y=>{o&&p(y)})||a,d()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Pu(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Xi.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Xi.disconnect,i),await Pu(this.provider.connect(),mt.toMiliseconds(mt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await C_())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=En(mt.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(ii.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(jd())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Ji(new wF(wB({sdkVersion:m1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),g1(e)){if(!e.method.endsWith(LF))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:Wr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(v6({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else Yd(e)&&this.events.emit(ii.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ii.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Vd(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Xi.payload,this.onPayloadHandler),this.provider.off(Xi.connect,this.onConnectHandler),this.provider.off(Xi.disconnect,this.onDisconnectHandler),this.provider.off(Xi.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await C_();X$(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(ii.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},mt.toMiliseconds(kF))))}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var UU=Object.defineProperty,b6=Object.getOwnPropertySymbols,qU=Object.prototype.hasOwnProperty,zU=Object.prototype.propertyIsEnumerable,y6=(t,e,r)=>e in t?UU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,w6=(t,e)=>{for(var r in e||(e={}))qU.call(e,r)&&y6(t,r,e[r]);if(b6)for(var r of b6(e))zU.call(e,r)&&y6(t,r,e[r]);return t};class uc extends KR{constructor(e,r,n,i=Ws,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=BF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!bi(o)?this.map.set(this.getKey(o),o):I$(o)?this.map.set(o.id,o):C$(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>_F(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const u=w6(w6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=ri(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class HU{constructor(e,r){this.core=e,this.logger=r,this.name=qF,this.version=zF,this.events=new Yg,this.initialized=!1,this.storagePrefix=Ws,this.ignoredPayloadTypes=[So],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=c1(),s=await this.core.crypto.setSymKey(i),o=En(mt.FIVE_MINUTES),a={protocol:V_},u={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=x_({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(oc.create,u),this.core.expirer.set(s,o),await this.pairings.set(s,u),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Vs.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:u,methods:l}=w_(n.uri);i.props.properties.topic=s,i.addTrace(Vs.pairing_uri_validation_success),i.addTrace(Vs.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(Vs.existing_pairing),d.active)throw i.setError(Io.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Vs.pairing_not_expired)}const p=u||En(mt.FIVE_MINUTES),y={topic:s,relay:a,expiry:p,active:!1,methods:l};this.core.expirer.set(s,p),await this.pairings.set(s,y),i.addTrace(Vs.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(oc.create,y),i.addTrace(Vs.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Vs.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Io.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(A){throw i.setError(Io.subscribe_pairing_topic_failure),A}return i.addTrace(Vs.subscribe_pairing_topic_success),y},this.activate=async({topic:n})=>{this.isInitialized();const i=En(mt.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=tc();this.events.once(vr("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Dr("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,u=this.core.crypto.keychain.get(i);return x_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:u,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=da(i,s),a=await this.core.crypto.encode(n,o),u=Ml[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{const o=Vd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=Gd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method]?Ml[u.request.method].res:Ml.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Dr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>fa(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(oc.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{Hs(i)?this.events.emit(vr("pairing_ping",s),{}):Yi(i)&&this.events.emit(vr("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(oc.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Dr("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Dr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!yi(n)){const{message:a}=ut("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!M$(n.uri)){const{message:a}=ut("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}const o=w_(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&mt.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!an(n,!1)){const{message:i}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(fa(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ut("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=ri(r,this.name),this.pairings=new uc(this.core,this.logger,this.name,this.storagePrefix)}get context(){return gi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ii.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===Wr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{g1(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):Yd(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Zi.expired,async e=>{const{topic:r}=Z3(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(oc.expire,{topic:r}))})}}class WU extends qR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new qi.EventEmitter,this.name=HF,this.version=WF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:En(mt.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(bs.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Yi(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(bs.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(bs.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:da(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(bs.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(bs.created,e=>{const r=bs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.updated,e=>{const r=bs.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.deleted,e=>{const r=bs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(su.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{mt.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(bs.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class KU extends GR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new qi.EventEmitter,this.name=KF,this.version=VF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Zi.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Zi.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return xB(e);if(typeof e=="number")return _B(e);const{message:r}=ut("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Zi.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;mt.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Zi.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(su.pulse,()=>this.checkExpirations()),this.events.on(Zi.created,e=>{const r=Zi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.expired,e=>{const r=Zi.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.deleted,e=>{const r=Zi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class VU extends YR{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=GF,this.verifyUrlV3=JF,this.storagePrefix=Ws,this.version=H_,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&mt.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!pl()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,u=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=nl(),d=this.startAbortTimer(mt.ONE_SECOND*5),p=await new Promise((y,A)=>{const P=()=>{window.removeEventListener("message",D),l.body.removeChild(N),A("attestation aborted")};this.abortController.signal.addEventListener("abort",P);const N=l.createElement("iframe");N.src=u,N.style.display="none",N.addEventListener("error",P,{signal:this.abortController.signal});const D=k=>{if(k.data&&typeof k.data=="string")try{const B=JSON.parse(k.data);if(B.type==="verify_attestation"){if(gm(B.attestation).payload.id!==o)return;clearInterval(d),l.body.removeChild(N),this.abortController.signal.removeEventListener("abort",P),window.removeEventListener("message",D),y(B.attestation===null?"":B.attestation)}}catch(B){this.logger.warn(B)}};l.body.appendChild(N),window.addEventListener("message",D,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",p),p}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(gm(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const u=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,u)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(mt.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Il;return XF.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Il}`),s=Il),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(mt.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=c$(i,s.publicKey),a={hasExpired:mt.toMiliseconds(o.exp)this.abortController.abort(),mt.toMiliseconds(e))}}class GU extends JR{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=ZF,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${QF}/${this.projectId}/clients`;await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=ri(r,this.context)}}var YU=Object.defineProperty,x6=Object.getOwnPropertySymbols,JU=Object.prototype.hasOwnProperty,XU=Object.prototype.propertyIsEnumerable,_6=(t,e,r)=>e in t?YU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dl=(t,e)=>{for(var r in e||(e={}))JU.call(e,r)&&_6(t,r,e[r]);if(x6)for(var r of x6(e))XU.call(e,r)&&_6(t,r,e[r]);return t};class ZU extends XR{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=tj,this.storagePrefix=Ws,this.storageVersion=ej,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!i1())try{const i={eventId:e_(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:G3(this.core.relayer.protocol,this.core.relayer.version,m1)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:u}}=i,l=e_(),d=this.core.projectId||"",p=Date.now(),y=Dl({eventId:l,timestamp:p,props:{event:s,type:o,properties:{topic:a,trace:u}},bundleId:d,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,y),this.shouldPersist=!0),y},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(u=>u.props.properties.topic===o);if(a)return Dl(Dl({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(su.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{mt.fromMiliseconds(Date.now())-mt.fromMiliseconds(i.timestamp)>rj&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Dl(Dl({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${nj}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${m1}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>V3().url,this.logger=ri(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var QU=Object.defineProperty,E6=Object.getOwnPropertySymbols,eq=Object.prototype.hasOwnProperty,tq=Object.prototype.propertyIsEnumerable,S6=(t,e,r)=>e in t?QU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A6=(t,e)=>{for(var r in e||(e={}))eq.call(e,r)&&S6(t,r,e[r]);if(E6)for(var r of E6(e))tq.call(e,r)&&S6(t,r,e[r]);return t};class x1 extends UR{constructor(e){var r;super(e),this.protocol=z_,this.version=H_,this.name=W_,this.events=new qi.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:u})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:Wr.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||G_,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=od({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:EF.logger}),{logger:i,chunkLoggerController:s}=jR({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ri(i,this.name),this.heartbeat=new NT,this.crypto=new MU(this,this.logger,e==null?void 0:e.keychain),this.history=new WU(this,this.logger),this.expirer=new KU(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new hR(A6(A6({},SF),e==null?void 0:e.storageOptions)),this.relayer=new jU({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new HU(this,this.logger),this.verify=new VU(this,this.logger,this.storage),this.echoClient=new GU(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new ZU(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new x1(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem($F,n),r}get context(){return gi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(Y_,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(Y_)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const rq=x1,P6="wc",M6=2,I6="client",_1=`${P6}@${M6}:${I6}:`,E1={name:I6,logger:"error"},C6="WALLETCONNECT_DEEPLINK_CHOICE",nq="proposal",T6="Proposal expired",iq="session",Iu=mt.SEVEN_DAYS,sq="engine",Bn={wc_sessionPropose:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:mt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:mt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1119}}},S1={min:mt.FIVE_MINUTES,max:mt.SEVEN_DAYS},Gs={idle:"IDLE",active:"ACTIVE"},oq="request",aq=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],cq="wc",uq="auth",fq="authKeys",lq="pairingTopics",hq="requests",Zd=`${cq}@${1.5}:${uq}:`,Qd=`${Zd}:PUB_KEY`;var dq=Object.defineProperty,pq=Object.defineProperties,gq=Object.getOwnPropertyDescriptors,R6=Object.getOwnPropertySymbols,mq=Object.prototype.hasOwnProperty,vq=Object.prototype.propertyIsEnumerable,D6=(t,e,r)=>e in t?dq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))mq.call(e,r)&&D6(t,r,e[r]);if(R6)for(var r of R6(e))vq.call(e,r)&&D6(t,r,e[r]);return t},ws=(t,e)=>pq(t,gq(e));class bq extends QR{constructor(e){super(e),this.name=sq,this.events=new Yg,this.initialized=!1,this.requestQueue={state:Gs.idle,queue:[]},this.sessionRequestQueue={state:Gs.idle,queue:[]},this.requestQueueDelay=mt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Bn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=ws(tn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n;let l=i,d,p=!1;try{l&&(p=this.client.core.pairing.pairings.get(l).active)}catch(j){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),j}if(!l||!p){const{topic:j,uri:H}=await this.client.core.pairing.create();l=j,d=H}if(!l){const{message:j}=ut("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(j)}const y=await this.client.core.crypto.generateKeyPair(),A=Bn.wc_sessionPropose.req.ttl||mt.FIVE_MINUTES,P=En(A),N=tn({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:V_}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:P,pairingTopic:l},a&&{sessionProperties:a}),{reject:D,resolve:k,done:B}=tc(A,T6);this.events.once(vr("session_connect"),async({error:j,session:H})=>{if(j)D(j);else if(H){H.self.publicKey=y;const J=ws(tn({},H),{pairingTopic:N.pairingTopic,requiredNamespaces:N.requiredNamespaces,optionalNamespaces:N.optionalNamespaces,transportType:Wr.relay});await this.client.session.set(H.topic,J),await this.setExpiry(H.topic,H.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:H.peer.metadata}),this.cleanupDuplicatePairings(J),k(J)}});const q=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:N,throwOnFailedPublish:!0});return await this.setProposal(q,tn({id:q},N)),{uri:d,approval:B}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[ys.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(z){throw o.setError(ac.no_internet_connection),z}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(z){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(ac.proposal_not_found),z}try{await this.isValidApprove(r)}catch(z){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(ac.session_approve_namespace_validation_failure),z}const{id:a,relayProtocol:u,namespaces:l,sessionProperties:d,sessionConfig:p}=r,y=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:A,proposer:P,requiredNamespaces:N,optionalNamespaces:D}=y;let k=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:A});k||(k=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:ys.session_approve_started,properties:{topic:A,trace:[ys.session_approve_started,ys.session_namespaces_validation_success]}}));const B=await this.client.core.crypto.generateKeyPair(),q=P.publicKey,j=await this.client.core.crypto.generateSharedKey(B,q),H=tn(tn({relay:{protocol:u??"irn"},namespaces:l,controller:{publicKey:B,metadata:this.client.metadata},expiry:En(Iu)},d&&{sessionProperties:d}),p&&{sessionConfig:p}),J=Wr.relay;k.addTrace(ys.subscribing_session_topic);try{await this.client.core.relayer.subscribe(j,{transportType:J})}catch(z){throw k.setError(ac.subscribe_session_topic_failure),z}k.addTrace(ys.subscribe_session_topic_success);const T=ws(tn({},H),{topic:j,requiredNamespaces:N,optionalNamespaces:D,pairingTopic:A,acknowledged:!1,self:H.controller,peer:{publicKey:P.publicKey,metadata:P.metadata},controller:B,transportType:Wr.relay});await this.client.session.set(j,T),k.addTrace(ys.store_session);try{k.addTrace(ys.publishing_session_settle),await this.sendRequest({topic:j,method:"wc_sessionSettle",params:H,throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(ac.session_settle_publish_failure),z}),k.addTrace(ys.session_settle_publish_success),k.addTrace(ys.publishing_session_approve),await this.sendResult({id:a,topic:A,result:{relay:{protocol:u??"irn"},responderPublicKey:B},throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(ac.session_approve_publish_failure),z}),k.addTrace(ys.session_approve_publish_success)}catch(z){throw this.client.logger.error(z),this.client.session.delete(j,Dr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(j),z}return this.client.core.eventClient.deleteEvent({eventId:k.eventId}),await this.client.core.pairing.updateMetadata({topic:A,metadata:P.metadata}),await this.client.proposal.delete(a,Dr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:A}),await this.setExpiry(j,En(Iu)),{topic:j,acknowledged:()=>Promise.resolve(this.client.session.get(j))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:Bn.wc_sessionPropose.reject}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(p){throw this.client.logger.error("update() -> isValidUpdate() failed"),p}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=tc(),u=ha(),l=sc().toString(),d=this.client.session.get(n).namespaces;return this.events.once(vr("session_update",u),({error:p})=>{p?a(p):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:u,relayRpcId:l}).catch(p=>{this.client.logger.error(p),this.client.session.update(n,{namespaces:d}),a(p)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(u){throw this.client.logger.error("extend() -> isValidExtend() failed"),u}const{topic:n}=r,i=ha(),{done:s,resolve:o,reject:a}=tc();return this.events.once(vr("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,En(Iu)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(u=>{a(u)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(P){throw this.client.logger.error("request() -> isValidRequest() failed"),P}const{chainId:n,request:i,topic:s,expiry:o=Bn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=ha(),l=sc().toString(),{done:d,resolve:p,reject:y}=tc(o,"Request expired. Please try again.");this.events.once(vr("session_request",u),({error:P,result:N})=>{P?y(P):p(N)});const A=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return A?(await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:A}).catch(P=>y(P)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),await d()):await Promise.all([new Promise(async P=>{await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(N=>y(N)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),P()}),new Promise(async P=>{var N;if(!((N=a.sessionConfig)!=null&&N.disableDeepLink)){const D=await AB(this.client.core.storage,C6);await EB({id:u,topic:s,wcDeepLink:D})}P()}),d()]).then(P=>P[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);Hs(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Yi(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=ha(),s=sc().toString(),{done:o,resolve:a,reject:u}=tc();this.events.once(vr("session_ping",i),({error:l})=>{l?u(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=sc().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Dr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ut("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>A$(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?Wr.link_mode:Wr.relay;o===Wr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:u="",uri:l,domain:d,nonce:p,type:y,exp:A,nbf:P,methods:N=[],expiry:D}=r,k=[...r.resources||[]],{topic:B,uri:q}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:B,uri:q}});const j=await this.client.core.crypto.generateKeyPair(),H=Hd(j);if(await Promise.all([this.client.auth.authKeys.set(Qd,{responseTopic:H,publicKey:j}),this.client.auth.pairingTopics.set(H,{topic:H,pairingTopic:B})]),await this.client.core.relayer.subscribe(H,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${B}`),N.length>0){const{namespace:_}=Su(a[0]);let S=KB(_,"request",N);zd(k)&&(S=GB(S,k.pop())),k.push(S)}const J=D&&D>Bn.wc_sessionAuthenticate.req.ttl?D:Bn.wc_sessionAuthenticate.req.ttl,T={authPayload:{type:y??"caip122",chains:a,statement:u,aud:l,domain:d,version:"1",nonce:p,iat:new Date().toISOString(),exp:A,nbf:P,resources:k},requester:{publicKey:j,metadata:this.client.metadata},expiryTimestamp:En(J)},z={eip155:{chains:a,methods:[...new Set(["personal_sign",...N])],events:["chainChanged","accountsChanged"]}},ue={requiredNamespaces:{},optionalNamespaces:z,relays:[{protocol:"irn"}],pairingTopic:B,proposer:{publicKey:j,metadata:this.client.metadata},expiryTimestamp:En(Bn.wc_sessionPropose.req.ttl)},{done:_e,resolve:G,reject:E}=tc(J,"Request expired"),m=async({error:_,session:S})=>{if(this.events.off(vr("session_request",g),f),_)E(_);else if(S){S.self.publicKey=j,await this.client.session.set(S.topic,S),await this.setExpiry(S.topic,S.expiry),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:S.peer.metadata});const b=this.client.session.get(S.topic);await this.deleteProposal(v),G({session:b})}},f=async _=>{var S,b,M;if(await this.deletePendingAuthRequest(g,{message:"fulfilled",code:0}),_.error){const X=Dr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return _.error.code===X.code?void 0:(this.events.off(vr("session_connect"),m),E(_.error.message))}await this.deleteProposal(v),this.events.off(vr("session_connect"),m);const{cacaos:I,responder:F}=_.result,ae=[],O=[];for(const X of I){await i_({cacao:X,projectId:this.client.core.projectId})||(this.client.logger.error(X,"Signature verification failed"),E(Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Q}=X,R=zd(Q.resources),Z=[o1(Q.iss)],te=qd(Q.iss);if(R){const le=a_(R),ie=c_(R);ae.push(...le),Z.push(...ie)}for(const le of Z)O.push(`${le}:${te}`)}const se=await this.client.core.crypto.generateSharedKey(j,F.publicKey);let ee;ae.length>0&&(ee={topic:se,acknowledged:!0,self:{publicKey:j,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:En(Iu),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:B,namespaces:__([...new Set(ae)],[...new Set(O)]),transportType:o},await this.client.core.relayer.subscribe(se,{transportType:o}),await this.client.session.set(se,ee),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:F.metadata}),ee=this.client.session.get(se)),(S=this.client.metadata.redirect)!=null&&S.linkMode&&(b=F.metadata.redirect)!=null&&b.linkMode&&(M=F.metadata.redirect)!=null&&M.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(se,{transportType:Wr.link_mode})),G({auths:I,session:ee})},g=ha(),v=ha();this.events.once(vr("session_connect"),m),this.events.once(vr("session_request",g),f);let x;try{if(s){const _=da("wc_sessionAuthenticate",T,g);this.client.core.history.set(B,_);const S=await this.client.core.crypto.encode("",_,{type:yl,encoding:vl});x=Wd(n,B,S)}else await Promise.all([this.sendRequest({topic:B,method:"wc_sessionAuthenticate",params:T,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:g}),this.sendRequest({topic:B,method:"wc_sessionPropose",params:ue,expiry:Bn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:v})])}catch(_){throw this.events.off(vr("session_connect"),m),this.events.off(vr("session_request",g),f),_}return await this.setProposal(v,tn({id:v},ue)),await this.setAuthRequest(g,{request:ws(tn({},T),{verifyContext:{}}),pairingTopic:B,transportType:o}),{uri:x??q,response:_e}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[cc.authenticated_session_approve_started]}});try{this.isInitialized()}catch(D){throw s.setError(Cl.no_internet_connection),D}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Cl.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||Wr.relay;a===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=Hd(u),p={type:So,receiverPublicKey:u,senderPublicKey:l},y=[],A=[];for(const D of i){if(!await i_({cacao:D,projectId:this.client.core.projectId})){s.setError(Cl.invalid_cacao);const H=Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:H,encodeOpts:p}),new Error(H.message)}s.addTrace(cc.cacaos_verified);const{p:k}=D,B=zd(k.resources),q=[o1(k.iss)],j=qd(k.iss);if(B){const H=a_(B),J=c_(B);y.push(...H),q.push(...J)}for(const H of q)A.push(`${H}:${j}`)}const P=await this.client.core.crypto.generateSharedKey(l,u);s.addTrace(cc.create_authenticated_session_topic);let N;if((y==null?void 0:y.length)>0){N={topic:P,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:u,metadata:o.requester.metadata},controller:u,expiry:En(Iu),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:__([...new Set(y)],[...new Set(A)]),transportType:a},s.addTrace(cc.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(P,{transportType:a})}catch(D){throw s.setError(Cl.subscribe_authenticated_session_topic_failure),D}s.addTrace(cc.subscribe_authenticated_session_topic_success),await this.client.session.set(P,N),s.addTrace(cc.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(cc.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:p,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(D){throw s.setError(Cl.authenticated_session_approve_publish_failure),D}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:N}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),u=Hd(o),l={type:So,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:u,error:i,encodeOpts:l,rpcOpts:Bn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return s_(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:u}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Dr("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(C6).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,Dr("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Gs.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(ac.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Dr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Gs.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,En(Bn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=Wr.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||En(Bn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l,appLink:d}=r,p=da(i,s,u);let y;const A=!!d;try{const D=A?vl:la;y=await this.client.core.crypto.encode(n,p,{encoding:D})}catch(D){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),D}let P;if(aq.includes(i)){const D=Ao(JSON.stringify(p)),k=Ao(y);P=await this.client.core.verify.register({id:k,decryptedId:D})}const N=Bn[i].req;if(N.attestation=P,o&&(N.ttl=o),a&&(N.id=a),this.client.core.history.set(n,p),A){const D=Wd(d,n,y);await global.Linking.openURL(D,this.client.name)}else{const D=Bn[i].req;o&&(D.ttl=o),a&&(D.id=a),l?(D.internal=ws(tn({},D.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,y,D)):this.client.core.relayer.publish(n,y,D).catch(k=>this.client.logger.error(k))}return p.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:u}=r,l=Vd(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=p?vl:la;d=await this.client.core.crypto.encode(i,l,ws(tn({},a||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),A}if(p){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=Bn[y.request.method].res;o?(A.internal=ws(tn({},A.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,A)):this.client.core.relayer.publish(i,d,A).catch(P=>this.client.logger.error(P))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:u}=r,l=Gd(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=p?vl:la;d=await this.client.core.crypto.encode(i,l,ws(tn({},o||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),A}if(p){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=a||Bn[y.request.method].res;this.client.core.relayer.publish(i,d,A)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;fa(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{fa(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Gs.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Gs.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Gs.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,u=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:u}))switch(u){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=ut("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:u}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(tn({},i.params));const d=a.expiryTimestamp||En(Bn.wc_sessionPropose.req.ttl),p=tn({id:u,pairingTopic:n,expiryTimestamp:d},a);await this.setProposal(u,p);const y=await this.getVerifyContext({attestationId:s,hash:Ao(JSON.stringify(i)),encryptedId:o,metadata:p.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(Io.proposal_listener_not_found)),l==null||l.addTrace(Vs.emit_session_proposal),this.client.events.emit("session_proposal",{id:u,params:p,verifyContext:y})}catch(l){await this.sendError({id:u,topic:n,error:l,rpcOpts:Bn.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(Hs(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const u=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const d=await this.client.core.crypto.generateSharedKey(u,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:d});const p=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:p}),await this.client.core.pairing.activate({topic:r})}else if(Yi(n)){await this.client.proposal.delete(s,Dr("USER_DISCONNECTED"));const o=vr("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(vr("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:u,namespaces:l,sessionProperties:d,sessionConfig:p}=n.params,y=ws(tn(tn({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},d&&{sessionProperties:d}),p&&{sessionConfig:p}),{transportType:Wr.relay}),A=vr("session_connect");if(this.events.listenerCount(A)===0)throw new Error(`emitting ${A} without any listeners 997`);this.events.emit(vr("session_connect"),{session:y}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;Hs(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(vr("session_approve",i),{})):Yi(n)&&(await this.client.session.delete(r,Dr("USER_DISCONNECTED")),this.events.emit(vr("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Dr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(tn({topic:r},i));try{Al.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(u){throw Al.delete(o),u}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=vr("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_update",i),{}):Yi(n)&&this.events.emit(vr("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,En(Iu)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=vr("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_extend",i),{}):Yi(n)&&this.events.emit(vr("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=vr("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{Hs(n)?this.events.emit(vr("session_ping",i),{}):Yi(n)&&this.events.emit(vr("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(ii.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Dr("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:u,encryptedId:l,transportType:d}=r,{id:p,params:y}=a;try{await this.isValidRequest(tn({topic:o},y));const A=this.client.session.get(o),P=await this.getVerifyContext({attestationId:u,hash:Ao(JSON.stringify(da("wc_sessionRequest",y,p))),encryptedId:l,metadata:A.peer.metadata,transportType:d}),N={id:p,topic:o,params:y,verifyContext:P};await this.setPendingSessionRequest(N),d===Wr.link_mode&&(n=A.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=A.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(N):(this.addSessionRequestToSessionRequestQueue(N),this.processSessionRequestQueue())}catch(A){await this.sendError({id:p,topic:o,error:A}),this.client.logger.error(A)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=vr("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(tn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Al.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:u}=r;try{const{requester:l,authPayload:d,expiryTimestamp:p}=s.params,y=await this.getVerifyContext({attestationId:o,hash:Ao(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:u}),A={requester:l,pairingTopic:i,id:s.id,authPayload:d,verifyContext:y,expiryTimestamp:p};await this.setAuthRequest(s.id,{request:A,pairingTopic:i,transportType:u}),u===Wr.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:y})}catch(l){this.client.logger.error(l);const d=s.params.requester.publicKey,p=await this.client.core.crypto.generateKeyPair(),y=this.getAppLinkIfEnabled(s.params.requester.metadata,u),A={type:So,receiverPublicKey:d,senderPublicKey:p};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:A,rpcOpts:Bn.wc_sessionAuthenticate.autoReject,appLink:y})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Gs.idle,this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=vr("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(vr("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Gs.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Gs.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:da("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(bi(n)||await this.isValidPairingTopic(n),!B$(a)){const{message:u}=ut("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!bi(i)&&Sl(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!bi(s)&&Sl(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),bi(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=k$(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!yi(r))throw new Error(ut("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),u=h1(i,"approve()");if(u)throw new Error(u.message);const l=M_(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!an(s,!0)){const{message:d}=ut("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}bi(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!yi(r)){const{message:s}=ut("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!F$(i)){const{message:s}=ut("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!yi(r)){const{message:l}=ut("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!A_(n)){const{message:l}=ut("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=T$(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const u=h1(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(fa(o)){const{message:l}=ut("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=h1(i,"update()");if(o)throw new Error(o.message);const a=M_(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!P_(a,s)){const{message:u}=ut("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!j$(i)){const{message:u}=ut("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!z$(a,s,i.method)){const{message:u}=ut("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!V$(o,S1)){const{message:u}=ut("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${S1.min} and ${S1.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!yi(r)){const{message:o}=ut("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!U$(s)){const{message:o}=ut("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!yi(r)){const{message:a}=ut("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!P_(o,s)){const{message:a}=ut("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!q$(i)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!H$(o,s,i.name)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!an(i,!1))throw new Error("uri is required parameter");if(!an(s,!1))throw new Error("domain is required parameter");if(!an(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(u=>Su(u).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Su(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,u={verified:{verifyUrl:o.verifyUrl||Il,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Wr.link_mode){const d=this.getAppLinkIfEnabled(o,a);return u.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",u}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(u.verified.origin=l.origin,u.verified.isScam=l.isScam,u.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(u)}`),u},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!an(i,!1)){const{message:s}=ut("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,u,l,d,p,y;return!r||n!==Wr.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(u=this.client.metadata)==null?void 0:u.redirect)==null?void 0:l.universal)!==""&&((d=r==null?void 0:r.redirect)==null?void 0:d.universal)!==void 0&&((p=r==null?void 0:r.redirect)==null?void 0:p.universal)!==""&&((y=r==null?void 0:r.redirect)==null?void 0:y.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=Q3(r,"topic")||"",i=decodeURIComponent(Q3(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:Wr.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(i1()||Au()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ii.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(Qd)?this.client.auth.authKeys.get(Qd):{publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===Wr.link_mode?vl:la});try{g1(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:Ao(n)})):Yd(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(u){this.client.logger.error(u)}}registerExpirerEvents(){this.client.core.expirer.on(Zi.expired,async e=>{const{topic:r,id:n}=Z3(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ut("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,ut("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(oc.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(oc.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=ut("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=ut("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=ut("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(an(e,!1)){const{message:r}=ut("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=ut("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!$$(e)){const{message:r}=ut("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=ut("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class yq extends uc{constructor(e,r){super(e,r,nq,_1),this.core=e,this.logger=r}}let wq=class extends uc{constructor(e,r){super(e,r,iq,_1),this.core=e,this.logger=r}};class xq extends uc{constructor(e,r){super(e,r,oq,_1,n=>n.id),this.core=e,this.logger=r}}class _q extends uc{constructor(e,r){super(e,r,fq,Zd,()=>Qd),this.core=e,this.logger=r}}class Eq extends uc{constructor(e,r){super(e,r,lq,Zd),this.core=e,this.logger=r}}class Sq extends uc{constructor(e,r){super(e,r,hq,Zd,n=>n.id),this.core=e,this.logger=r}}class Aq{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new _q(this.core,this.logger),this.pairingTopics=new Eq(this.core,this.logger),this.requests=new Sq(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class A1 extends ZR{constructor(e){super(e),this.protocol=P6,this.version=M6,this.name=E1.name,this.events=new qi.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||E1.name,this.metadata=(e==null?void 0:e.metadata)||V3(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||E1.logger}));this.core=(e==null?void 0:e.core)||new rq(e),this.logger=ri(r,this.name),this.session=new wq(this.core,this.logger),this.proposal=new yq(this.core,this.logger),this.pendingRequest=new xq(this.core,this.logger),this.engine=new bq(this),this.auth=new Aq(this.core,this.logger)}static async init(e){const r=new A1(e);return await r.initialize(),r}get context(){return gi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var e0={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */e0.exports,function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",l=500,d="__lodash_placeholder__",p=1,y=2,A=4,P=1,N=2,D=1,k=2,B=4,j=8,U=16,K=32,J=64,T=128,z=256,ue=512,_e=30,G="...",E=800,m=16,f=1,g=2,v=3,x=1/0,_=9007199254740991,S=17976931348623157e292,b=NaN,M=4294967295,I=M-1,F=M>>>1,ae=[["ary",T],["bind",D],["bindKey",k],["curry",j],["curryRight",U],["flip",ue],["partial",K],["partialRight",J],["rearg",z]],O="[object Arguments]",se="[object Array]",ee="[object AsyncFunction]",X="[object Boolean]",Q="[object Date]",R="[object DOMException]",Z="[object Error]",te="[object Function]",le="[object GeneratorFunction]",ie="[object Map]",fe="[object Number]",ve="[object Null]",Me="[object Object]",Ne="[object Promise]",Te="[object Proxy]",$e="[object RegExp]",Ie="[object Set]",Le="[object String]",Ve="[object Symbol]",ke="[object Undefined]",ze="[object WeakMap]",He="[object WeakSet]",Ee="[object ArrayBuffer]",Qe="[object DataView]",ct="[object Float32Array]",Be="[object Float64Array]",et="[object Int8Array]",rt="[object Int16Array]",Je="[object Int32Array]",pt="[object Uint8Array]",ht="[object Uint8ClampedArray]",ft="[object Uint16Array]",Ht="[object Uint32Array]",Jt=/\b__p \+= '';/g,St=/\b(__p \+=) '' \+/g,er=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Xt=/&(?:amp|lt|gt|quot|#39);/g,Ot=/[&<>"']/g,Bt=RegExp(Xt.source),Tt=RegExp(Ot.source),vt=/<%-([\s\S]+?)%>/g,Dt=/<%([\s\S]+?)%>/g,Lt=/<%=([\s\S]+?)%>/g,bt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$t=/^\w*$/,jt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(nt.source),$=/^\s+/,H=/\s/,V=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C=/\{\n\/\* \[wrapped with (.+)\] \*/,Y=/,? & /,q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,oe=/[()=,{}\[\]\/\s]/,pe=/\\(\\)?/g,xe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Re=/\w*$/,De=/^[-+]0x[0-9a-f]+$/i,it=/^0b[01]+$/i,Ue=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,st=/^(?:0|[1-9]\d*)$/,tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,Rt=/['\n\r\u2028\u2029\\]/g,Mt="\\ud800-\\udfff",Et="\\u0300-\\u036f",dt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",ot=Et+dt+_t,wt="\\u2700-\\u27bf",lt="a-z\\xdf-\\xf6\\xf8-\\xff",at="\\xac\\xb1\\xd7\\xf7",Ae="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Pe="\\u2000-\\u206f",Ge=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="A-Z\\xc0-\\xd6\\xd8-\\xde",qe="\\ufe0e\\ufe0f",Xe=at+Ae+Pe+Ge,kt="['’]",Wt="["+Mt+"]",Zt="["+Xe+"]",Kt="["+ot+"]",de="\\d+",nr="["+wt+"]",dr="["+lt+"]",pr="[^"+Mt+Xe+de+wt+lt+je+"]",Qt="\\ud83c[\\udffb-\\udfff]",gr="(?:"+Kt+"|"+Qt+")",lr="[^"+Mt+"]",Lr="(?:\\ud83c[\\udde6-\\uddff]){2}",mr="[\\ud800-\\udbff][\\udc00-\\udfff]",wr="["+je+"]",Br="\\u200d",$r="(?:"+dr+"|"+pr+")",Ir="(?:"+wr+"|"+pr+")",hn="(?:"+kt+"(?:d|ll|m|re|s|t|ve))?",dn="(?:"+kt+"(?:D|LL|M|RE|S|T|VE))?",pn=gr+"?",sp="["+qe+"]?",Fb="(?:"+Br+"(?:"+[lr,Lr,mr].join("|")+")"+sp+pn+")*",jo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",op="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ap=sp+pn+Fb,Qu="(?:"+[nr,Lr,mr].join("|")+")"+ap,jb="(?:"+[lr+Kt+"?",Kt,Lr,mr,Wt].join("|")+")",gh=RegExp(kt,"g"),Ub=RegExp(Kt,"g"),ef=RegExp(Qt+"(?="+Qt+")|"+jb+ap,"g"),cp=RegExp([wr+"?"+dr+"+"+hn+"(?="+[Zt,wr,"$"].join("|")+")",Ir+"+"+dn+"(?="+[Zt,wr+$r,"$"].join("|")+")",wr+"?"+$r+"+"+hn,wr+"+"+dn,op,jo,de,Qu].join("|"),"g"),up=RegExp("["+Br+Mt+ot+qe+"]"),Pc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],qb=-1,Fr={};Fr[ct]=Fr[Be]=Fr[et]=Fr[rt]=Fr[Je]=Fr[pt]=Fr[ht]=Fr[ft]=Fr[Ht]=!0,Fr[O]=Fr[se]=Fr[Ee]=Fr[X]=Fr[Qe]=Fr[Q]=Fr[Z]=Fr[te]=Fr[ie]=Fr[fe]=Fr[Me]=Fr[$e]=Fr[Ie]=Fr[Le]=Fr[ze]=!1;var kr={};kr[O]=kr[se]=kr[Ee]=kr[Qe]=kr[X]=kr[Q]=kr[ct]=kr[Be]=kr[et]=kr[rt]=kr[Je]=kr[ie]=kr[fe]=kr[Me]=kr[$e]=kr[Ie]=kr[Le]=kr[Ve]=kr[pt]=kr[ht]=kr[ft]=kr[Ht]=!0,kr[Z]=kr[te]=kr[ze]=!1;var ce={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ye={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye={"&":"&","<":"<",">":">",""":'"',"'":"'"},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},jr=parseFloat,ir=parseInt,Yr=typeof nn=="object"&&nn&&nn.Object===Object&&nn,wn=typeof self=="object"&&self&&self.Object===Object&&self,_r=Yr||wn||Function("return this")(),Ur=e&&!e.nodeType&&e,gn=Ur&&!0&&t&&!t.nodeType&&t,_i=gn&&gn.exports===Ur,xn=_i&&Yr.process,Jr=function(){try{var be=gn&&gn.require&&gn.require("util").types;return be||xn&&xn.binding&&xn.binding("util")}catch{}}(),oi=Jr&&Jr.isArrayBuffer,Ps=Jr&&Jr.isDate,is=Jr&&Jr.isMap,ro=Jr&&Jr.isRegExp,mh=Jr&&Jr.isSet,Mc=Jr&&Jr.isTypedArray;function Bn(be,Fe,Ce){switch(Ce.length){case 0:return be.call(Fe);case 1:return be.call(Fe,Ce[0]);case 2:return be.call(Fe,Ce[0],Ce[1]);case 3:return be.call(Fe,Ce[0],Ce[1],Ce[2])}return be.apply(Fe,Ce)}function OQ(be,Fe,Ce,Ct){for(var tr=-1,Mr=be==null?0:be.length;++tr-1}function zb(be,Fe,Ce){for(var Ct=-1,tr=be==null?0:be.length;++Ct-1;);return Ce}function r9(be,Fe){for(var Ce=be.length;Ce--&&tf(Fe,be[Ce],0)>-1;);return Ce}function qQ(be,Fe){for(var Ce=be.length,Ct=0;Ce--;)be[Ce]===Fe&&++Ct;return Ct}var zQ=Vb(ce),HQ=Vb(ye);function WQ(be){return"\\"+It[be]}function KQ(be,Fe){return be==null?r:be[Fe]}function rf(be){return up.test(be)}function VQ(be){return Pc.test(be)}function GQ(be){for(var Fe,Ce=[];!(Fe=be.next()).done;)Ce.push(Fe.value);return Ce}function Xb(be){var Fe=-1,Ce=Array(be.size);return be.forEach(function(Ct,tr){Ce[++Fe]=[tr,Ct]}),Ce}function n9(be,Fe){return function(Ce){return be(Fe(Ce))}}function Ta(be,Fe){for(var Ce=-1,Ct=be.length,tr=0,Mr=[];++Ce-1}function Lee(c,h){var w=this.__data__,L=Ip(w,c);return L<0?(++this.size,w.push([c,h])):w[L][1]=h,this}Uo.prototype.clear=Ree,Uo.prototype.delete=Dee,Uo.prototype.get=Oee,Uo.prototype.has=Nee,Uo.prototype.set=Lee;function qo(c){var h=-1,w=c==null?0:c.length;for(this.clear();++h=h?c:h)),c}function cs(c,h,w,L,W,ne){var he,me=h&p,we=h&y,We=h&A;if(w&&(he=W?w(c,L,W,ne):w(c)),he!==r)return he;if(!Qr(c))return c;var Ke=sr(c);if(Ke){if(he=Fte(c),!me)return Ei(c,he)}else{var Ze=ti(c),xt=Ze==te||Ze==le;if(ka(c))return F9(c,me);if(Ze==Me||Ze==O||xt&&!W){if(he=we||xt?{}:iA(c),!me)return we?Ite(c,Xee(he,c)):Mte(c,g9(he,c))}else{if(!kr[Ze])return W?c:{};he=jte(c,Ze,me)}}ne||(ne=new Is);var Nt=ne.get(c);if(Nt)return Nt;ne.set(c,he),OA(c)?c.forEach(function(Gt){he.add(cs(Gt,h,w,Gt,c,ne))}):RA(c)&&c.forEach(function(Gt,br){he.set(br,cs(Gt,h,w,br,c,ne))});var Vt=We?we?Ey:_y:we?Ai:$n,fr=Ke?r:Vt(c);return ss(fr||c,function(Gt,br){fr&&(br=Gt,Gt=c[br]),Eh(he,br,cs(Gt,h,w,br,c,ne))}),he}function Zee(c){var h=$n(c);return function(w){return m9(w,c,h)}}function m9(c,h,w){var L=w.length;if(c==null)return!L;for(c=qr(c);L--;){var W=w[L],ne=h[W],he=c[W];if(he===r&&!(W in c)||!ne(he))return!1}return!0}function v9(c,h,w){if(typeof c!="function")throw new os(o);return Th(function(){c.apply(r,w)},h)}function Sh(c,h,w,L){var W=-1,ne=lp,he=!0,me=c.length,we=[],We=h.length;if(!me)return we;w&&(h=Xr(h,Li(w))),L?(ne=zb,he=!1):h.length>=i&&(ne=vh,he=!1,h=new Tc(h));e:for(;++WW?0:W+w),L=L===r||L>W?W:ur(L),L<0&&(L+=W),L=w>L?0:LA(L);w0&&w(me)?h>1?Vn(me,h-1,w,L,W):Ca(W,me):L||(W[W.length]=me)}return W}var iy=W9(),w9=W9(!0);function no(c,h){return c&&iy(c,h,$n)}function sy(c,h){return c&&w9(c,h,$n)}function Tp(c,h){return Ia(h,function(w){return Vo(c[w])})}function Dc(c,h){h=Na(h,c);for(var w=0,L=h.length;c!=null&&wh}function tte(c,h){return c!=null&&Tr.call(c,h)}function rte(c,h){return c!=null&&h in qr(c)}function nte(c,h,w){return c>=ei(h,w)&&c=120&&Ke.length>=120)?new Tc(he&&Ke):r}Ke=c[0];var Ze=-1,xt=me[0];e:for(;++Ze-1;)me!==c&&xp.call(me,we,1),xp.call(c,we,1);return c}function R9(c,h){for(var w=c?h.length:0,L=w-1;w--;){var W=h[w];if(w==L||W!==ne){var ne=W;Ko(W)?xp.call(c,W,1):gy(c,W)}}return c}function hy(c,h){return c+Sp(l9()*(h-c+1))}function mte(c,h,w,L){for(var W=-1,ne=Pn(Ep((h-c)/(w||1)),0),he=Ce(ne);ne--;)he[L?ne:++W]=c,c+=w;return he}function dy(c,h){var w="";if(!c||h<1||h>_)return w;do h%2&&(w+=c),h=Sp(h/2),h&&(c+=c);while(h);return w}function hr(c,h){return Ty(aA(c,h,Pi),c+"")}function vte(c){return p9(pf(c))}function bte(c,h){var w=pf(c);return Up(w,Rc(h,0,w.length))}function Mh(c,h,w,L){if(!Qr(c))return c;h=Na(h,c);for(var W=-1,ne=h.length,he=ne-1,me=c;me!=null&&++WW?0:W+h),w=w>W?W:w,w<0&&(w+=W),W=h>w?0:w-h>>>0,h>>>=0;for(var ne=Ce(W);++L>>1,he=c[ne];he!==null&&!Bi(he)&&(w?he<=h:he=i){var We=h?null:Dte(c);if(We)return dp(We);he=!1,W=vh,we=new Tc}else we=h?[]:me;e:for(;++L=L?c:us(c,h,w)}var $9=uee||function(c){return _r.clearTimeout(c)};function F9(c,h){if(h)return c.slice();var w=c.length,L=o9?o9(w):new c.constructor(w);return c.copy(L),L}function yy(c){var h=new c.constructor(c.byteLength);return new yp(h).set(new yp(c)),h}function Ete(c,h){var w=h?yy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.byteLength)}function Ste(c){var h=new c.constructor(c.source,Re.exec(c));return h.lastIndex=c.lastIndex,h}function Ate(c){return _h?qr(_h.call(c)):{}}function j9(c,h){var w=h?yy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.length)}function U9(c,h){if(c!==h){var w=c!==r,L=c===null,W=c===c,ne=Bi(c),he=h!==r,me=h===null,we=h===h,We=Bi(h);if(!me&&!We&&!ne&&c>h||ne&&he&&we&&!me&&!We||L&&he&&we||!w&&we||!W)return 1;if(!L&&!ne&&!We&&c=me)return we;var We=w[L];return we*(We=="desc"?-1:1)}}return c.index-h.index}function q9(c,h,w,L){for(var W=-1,ne=c.length,he=w.length,me=-1,we=h.length,We=Pn(ne-he,0),Ke=Ce(we+We),Ze=!L;++me1?w[W-1]:r,he=W>2?w[2]:r;for(ne=c.length>3&&typeof ne=="function"?(W--,ne):r,he&&ci(w[0],w[1],he)&&(ne=W<3?r:ne,W=1),h=qr(h);++L-1?W[ne?h[he]:he]:r}}function G9(c){return Wo(function(h){var w=h.length,L=w,W=as.prototype.thru;for(c&&h.reverse();L--;){var ne=h[L];if(typeof ne!="function")throw new os(o);if(W&&!he&&Fp(ne)=="wrapper")var he=new as([],!0)}for(L=he?L:w;++L1&&Er.reverse(),Ke&&weme))return!1;var We=ne.get(c),Ke=ne.get(h);if(We&&Ke)return We==h&&Ke==c;var Ze=-1,xt=!0,Nt=w&N?new Tc:r;for(ne.set(c,h),ne.set(h,c);++Ze1?"& ":"")+h[L],h=h.join(w>2?", ":" "),c.replace(V,`{ + */e0.exports,function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",l=500,d="__lodash_placeholder__",p=1,y=2,A=4,P=1,N=2,D=1,k=2,B=4,q=8,j=16,H=32,J=64,T=128,z=256,ue=512,_e=30,G="...",E=800,m=16,f=1,g=2,v=3,x=1/0,_=9007199254740991,S=17976931348623157e292,b=NaN,M=4294967295,I=M-1,F=M>>>1,ae=[["ary",T],["bind",D],["bindKey",k],["curry",q],["curryRight",j],["flip",ue],["partial",H],["partialRight",J],["rearg",z]],O="[object Arguments]",se="[object Array]",ee="[object AsyncFunction]",X="[object Boolean]",Q="[object Date]",R="[object DOMException]",Z="[object Error]",te="[object Function]",le="[object GeneratorFunction]",ie="[object Map]",fe="[object Number]",ve="[object Null]",Me="[object Object]",Ne="[object Promise]",Te="[object Proxy]",$e="[object RegExp]",Ie="[object Set]",Le="[object String]",Ve="[object Symbol]",ke="[object Undefined]",ze="[object WeakMap]",He="[object WeakSet]",Se="[object ArrayBuffer]",Qe="[object DataView]",ct="[object Float32Array]",Be="[object Float64Array]",et="[object Int8Array]",rt="[object Int16Array]",Je="[object Int32Array]",pt="[object Uint8Array]",ht="[object Uint8ClampedArray]",ft="[object Uint16Array]",Ht="[object Uint32Array]",Jt=/\b__p \+= '';/g,St=/\b(__p \+=) '' \+/g,er=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Xt=/&(?:amp|lt|gt|quot|#39);/g,Ot=/[&<>"']/g,Bt=RegExp(Xt.source),Tt=RegExp(Ot.source),vt=/<%-([\s\S]+?)%>/g,Dt=/<%([\s\S]+?)%>/g,Lt=/<%=([\s\S]+?)%>/g,bt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$t=/^\w*$/,jt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(nt.source),$=/^\s+/,W=/\s/,V=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C=/\{\n\/\* \[wrapped with (.+)\] \*/,Y=/,? & /,U=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,oe=/[()=,{}\[\]\/\s]/,pe=/\\(\\)?/g,xe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Re=/\w*$/,De=/^[-+]0x[0-9a-f]+$/i,it=/^0b[01]+$/i,Ue=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,st=/^(?:0|[1-9]\d*)$/,tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,Rt=/['\n\r\u2028\u2029\\]/g,Mt="\\ud800-\\udfff",Et="\\u0300-\\u036f",dt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",ot=Et+dt+_t,wt="\\u2700-\\u27bf",lt="a-z\\xdf-\\xf6\\xf8-\\xff",at="\\xac\\xb1\\xd7\\xf7",Ae="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Pe="\\u2000-\\u206f",Ge=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="A-Z\\xc0-\\xd6\\xd8-\\xde",qe="\\ufe0e\\ufe0f",Xe=at+Ae+Pe+Ge,kt="['’]",Wt="["+Mt+"]",Zt="["+Xe+"]",Kt="["+ot+"]",de="\\d+",nr="["+wt+"]",dr="["+lt+"]",pr="[^"+Mt+Xe+de+wt+lt+je+"]",Qt="\\ud83c[\\udffb-\\udfff]",gr="(?:"+Kt+"|"+Qt+")",lr="[^"+Mt+"]",Lr="(?:\\ud83c[\\udde6-\\uddff]){2}",mr="[\\ud800-\\udbff][\\udc00-\\udfff]",wr="["+je+"]",Br="\\u200d",$r="(?:"+dr+"|"+pr+")",Ir="(?:"+wr+"|"+pr+")",hn="(?:"+kt+"(?:d|ll|m|re|s|t|ve))?",dn="(?:"+kt+"(?:D|LL|M|RE|S|T|VE))?",pn=gr+"?",sp="["+qe+"]?",jb="(?:"+Br+"(?:"+[lr,Lr,mr].join("|")+")"+sp+pn+")*",jo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",op="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ap=sp+pn+jb,ef="(?:"+[nr,Lr,mr].join("|")+")"+ap,Ub="(?:"+[lr+Kt+"?",Kt,Lr,mr,Wt].join("|")+")",gh=RegExp(kt,"g"),qb=RegExp(Kt,"g"),tf=RegExp(Qt+"(?="+Qt+")|"+Ub+ap,"g"),cp=RegExp([wr+"?"+dr+"+"+hn+"(?="+[Zt,wr,"$"].join("|")+")",Ir+"+"+dn+"(?="+[Zt,wr+$r,"$"].join("|")+")",wr+"?"+$r+"+"+hn,wr+"+"+dn,op,jo,de,ef].join("|"),"g"),up=RegExp("["+Br+Mt+ot+qe+"]"),Pc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],zb=-1,Fr={};Fr[ct]=Fr[Be]=Fr[et]=Fr[rt]=Fr[Je]=Fr[pt]=Fr[ht]=Fr[ft]=Fr[Ht]=!0,Fr[O]=Fr[se]=Fr[Se]=Fr[X]=Fr[Qe]=Fr[Q]=Fr[Z]=Fr[te]=Fr[ie]=Fr[fe]=Fr[Me]=Fr[$e]=Fr[Ie]=Fr[Le]=Fr[ze]=!1;var kr={};kr[O]=kr[se]=kr[Se]=kr[Qe]=kr[X]=kr[Q]=kr[ct]=kr[Be]=kr[et]=kr[rt]=kr[Je]=kr[ie]=kr[fe]=kr[Me]=kr[$e]=kr[Ie]=kr[Le]=kr[Ve]=kr[pt]=kr[ht]=kr[ft]=kr[Ht]=!0,kr[Z]=kr[te]=kr[ze]=!1;var ce={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ye={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye={"&":"&","<":"<",">":">",""":'"',"'":"'"},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},jr=parseFloat,ir=parseInt,Yr=typeof nn=="object"&&nn&&nn.Object===Object&&nn,wn=typeof self=="object"&&self&&self.Object===Object&&self,_r=Yr||wn||Function("return this")(),Ur=e&&!e.nodeType&&e,gn=Ur&&!0&&t&&!t.nodeType&&t,_i=gn&&gn.exports===Ur,xn=_i&&Yr.process,Jr=function(){try{var be=gn&&gn.require&&gn.require("util").types;return be||xn&&xn.binding&&xn.binding("util")}catch{}}(),oi=Jr&&Jr.isArrayBuffer,Ps=Jr&&Jr.isDate,is=Jr&&Jr.isMap,ro=Jr&&Jr.isRegExp,mh=Jr&&Jr.isSet,Mc=Jr&&Jr.isTypedArray;function $n(be,Fe,Ce){switch(Ce.length){case 0:return be.call(Fe);case 1:return be.call(Fe,Ce[0]);case 2:return be.call(Fe,Ce[0],Ce[1]);case 3:return be.call(Fe,Ce[0],Ce[1],Ce[2])}return be.apply(Fe,Ce)}function OQ(be,Fe,Ce,Ct){for(var tr=-1,Mr=be==null?0:be.length;++tr-1}function Hb(be,Fe,Ce){for(var Ct=-1,tr=be==null?0:be.length;++Ct-1;);return Ce}function r9(be,Fe){for(var Ce=be.length;Ce--&&rf(Fe,be[Ce],0)>-1;);return Ce}function qQ(be,Fe){for(var Ce=be.length,Ct=0;Ce--;)be[Ce]===Fe&&++Ct;return Ct}var zQ=Gb(ce),HQ=Gb(ye);function WQ(be){return"\\"+It[be]}function KQ(be,Fe){return be==null?r:be[Fe]}function nf(be){return up.test(be)}function VQ(be){return Pc.test(be)}function GQ(be){for(var Fe,Ce=[];!(Fe=be.next()).done;)Ce.push(Fe.value);return Ce}function Zb(be){var Fe=-1,Ce=Array(be.size);return be.forEach(function(Ct,tr){Ce[++Fe]=[tr,Ct]}),Ce}function n9(be,Fe){return function(Ce){return be(Fe(Ce))}}function Ta(be,Fe){for(var Ce=-1,Ct=be.length,tr=0,Mr=[];++Ce-1}function Lee(c,h){var w=this.__data__,L=Ip(w,c);return L<0?(++this.size,w.push([c,h])):w[L][1]=h,this}Uo.prototype.clear=Ree,Uo.prototype.delete=Dee,Uo.prototype.get=Oee,Uo.prototype.has=Nee,Uo.prototype.set=Lee;function qo(c){var h=-1,w=c==null?0:c.length;for(this.clear();++h=h?c:h)),c}function cs(c,h,w,L,K,ne){var he,me=h&p,we=h&y,We=h&A;if(w&&(he=K?w(c,L,K,ne):w(c)),he!==r)return he;if(!Qr(c))return c;var Ke=sr(c);if(Ke){if(he=Fte(c),!me)return Ei(c,he)}else{var Ze=ti(c),xt=Ze==te||Ze==le;if(ka(c))return F9(c,me);if(Ze==Me||Ze==O||xt&&!K){if(he=we||xt?{}:iA(c),!me)return we?Ite(c,Xee(he,c)):Mte(c,g9(he,c))}else{if(!kr[Ze])return K?c:{};he=jte(c,Ze,me)}}ne||(ne=new Is);var Nt=ne.get(c);if(Nt)return Nt;ne.set(c,he),OA(c)?c.forEach(function(Gt){he.add(cs(Gt,h,w,Gt,c,ne))}):RA(c)&&c.forEach(function(Gt,br){he.set(br,cs(Gt,h,w,br,c,ne))});var Vt=We?we?Sy:Ey:we?Ai:Fn,fr=Ke?r:Vt(c);return ss(fr||c,function(Gt,br){fr&&(br=Gt,Gt=c[br]),Eh(he,br,cs(Gt,h,w,br,c,ne))}),he}function Zee(c){var h=Fn(c);return function(w){return m9(w,c,h)}}function m9(c,h,w){var L=w.length;if(c==null)return!L;for(c=qr(c);L--;){var K=w[L],ne=h[K],he=c[K];if(he===r&&!(K in c)||!ne(he))return!1}return!0}function v9(c,h,w){if(typeof c!="function")throw new os(o);return Th(function(){c.apply(r,w)},h)}function Sh(c,h,w,L){var K=-1,ne=lp,he=!0,me=c.length,we=[],We=h.length;if(!me)return we;w&&(h=Xr(h,Li(w))),L?(ne=Hb,he=!1):h.length>=i&&(ne=vh,he=!1,h=new Tc(h));e:for(;++KK?0:K+w),L=L===r||L>K?K:ur(L),L<0&&(L+=K),L=w>L?0:LA(L);w0&&w(me)?h>1?Vn(me,h-1,w,L,K):Ca(K,me):L||(K[K.length]=me)}return K}var sy=W9(),w9=W9(!0);function no(c,h){return c&&sy(c,h,Fn)}function oy(c,h){return c&&w9(c,h,Fn)}function Tp(c,h){return Ia(h,function(w){return Vo(c[w])})}function Dc(c,h){h=Na(h,c);for(var w=0,L=h.length;c!=null&&wh}function tte(c,h){return c!=null&&Tr.call(c,h)}function rte(c,h){return c!=null&&h in qr(c)}function nte(c,h,w){return c>=ei(h,w)&&c=120&&Ke.length>=120)?new Tc(he&&Ke):r}Ke=c[0];var Ze=-1,xt=me[0];e:for(;++Ze-1;)me!==c&&xp.call(me,we,1),xp.call(c,we,1);return c}function R9(c,h){for(var w=c?h.length:0,L=w-1;w--;){var K=h[w];if(w==L||K!==ne){var ne=K;Ko(K)?xp.call(c,K,1):my(c,K)}}return c}function dy(c,h){return c+Sp(l9()*(h-c+1))}function mte(c,h,w,L){for(var K=-1,ne=Pn(Ep((h-c)/(w||1)),0),he=Ce(ne);ne--;)he[L?ne:++K]=c,c+=w;return he}function py(c,h){var w="";if(!c||h<1||h>_)return w;do h%2&&(w+=c),h=Sp(h/2),h&&(c+=c);while(h);return w}function hr(c,h){return Ry(aA(c,h,Pi),c+"")}function vte(c){return p9(gf(c))}function bte(c,h){var w=gf(c);return Up(w,Rc(h,0,w.length))}function Mh(c,h,w,L){if(!Qr(c))return c;h=Na(h,c);for(var K=-1,ne=h.length,he=ne-1,me=c;me!=null&&++KK?0:K+h),w=w>K?K:w,w<0&&(w+=K),K=h>w?0:w-h>>>0,h>>>=0;for(var ne=Ce(K);++L>>1,he=c[ne];he!==null&&!Bi(he)&&(w?he<=h:he=i){var We=h?null:Dte(c);if(We)return dp(We);he=!1,K=vh,we=new Tc}else we=h?[]:me;e:for(;++L=L?c:us(c,h,w)}var $9=uee||function(c){return _r.clearTimeout(c)};function F9(c,h){if(h)return c.slice();var w=c.length,L=o9?o9(w):new c.constructor(w);return c.copy(L),L}function wy(c){var h=new c.constructor(c.byteLength);return new yp(h).set(new yp(c)),h}function Ete(c,h){var w=h?wy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.byteLength)}function Ste(c){var h=new c.constructor(c.source,Re.exec(c));return h.lastIndex=c.lastIndex,h}function Ate(c){return _h?qr(_h.call(c)):{}}function j9(c,h){var w=h?wy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.length)}function U9(c,h){if(c!==h){var w=c!==r,L=c===null,K=c===c,ne=Bi(c),he=h!==r,me=h===null,we=h===h,We=Bi(h);if(!me&&!We&&!ne&&c>h||ne&&he&&we&&!me&&!We||L&&he&&we||!w&&we||!K)return 1;if(!L&&!ne&&!We&&c=me)return we;var We=w[L];return we*(We=="desc"?-1:1)}}return c.index-h.index}function q9(c,h,w,L){for(var K=-1,ne=c.length,he=w.length,me=-1,we=h.length,We=Pn(ne-he,0),Ke=Ce(we+We),Ze=!L;++me1?w[K-1]:r,he=K>2?w[2]:r;for(ne=c.length>3&&typeof ne=="function"?(K--,ne):r,he&&ci(w[0],w[1],he)&&(ne=K<3?r:ne,K=1),h=qr(h);++L-1?K[ne?h[he]:he]:r}}function G9(c){return Wo(function(h){var w=h.length,L=w,K=as.prototype.thru;for(c&&h.reverse();L--;){var ne=h[L];if(typeof ne!="function")throw new os(o);if(K&&!he&&Fp(ne)=="wrapper")var he=new as([],!0)}for(L=he?L:w;++L1&&Er.reverse(),Ke&&weme))return!1;var We=ne.get(c),Ke=ne.get(h);if(We&&Ke)return We==h&&Ke==c;var Ze=-1,xt=!0,Nt=w&N?new Tc:r;for(ne.set(c,h),ne.set(h,c);++Ze1?"& ":"")+h[L],h=h.join(w>2?", ":" "),c.replace(V,`{ /* [wrapped with `+h+`] */ -`)}function qte(c){return sr(c)||Lc(c)||!!(u9&&c&&c[u9])}function Ko(c,h){var w=typeof c;return h=h??_,!!h&&(w=="number"||w!="symbol"&&st.test(c))&&c>-1&&c%1==0&&c0){if(++h>=E)return arguments[0]}else h=0;return c.apply(r,arguments)}}function Up(c,h){var w=-1,L=c.length,W=L-1;for(h=h===r?L:h;++w1?c[h-1]:r;return w=typeof w=="function"?(c.pop(),w):r,yA(c,w)});function wA(c){var h=re(c);return h.__chain__=!0,h}function Qre(c,h){return h(c),c}function qp(c,h){return h(c)}var ene=Wo(function(c){var h=c.length,w=h?c[0]:0,L=this.__wrapped__,W=function(ne){return ny(ne,c)};return h>1||this.__actions__.length||!(L instanceof xr)||!Ko(w)?this.thru(W):(L=L.slice(w,+w+(h?1:0)),L.__actions__.push({func:qp,args:[W],thisArg:r}),new as(L,this.__chain__).thru(function(ne){return h&&!ne.length&&ne.push(r),ne}))});function tne(){return wA(this)}function rne(){return new as(this.value(),this.__chain__)}function nne(){this.__values__===r&&(this.__values__=NA(this.value()));var c=this.__index__>=this.__values__.length,h=c?r:this.__values__[this.__index__++];return{done:c,value:h}}function ine(){return this}function sne(c){for(var h,w=this;w instanceof Mp;){var L=dA(w);L.__index__=0,L.__values__=r,h?W.__wrapped__=L:h=L;var W=L;w=w.__wrapped__}return W.__wrapped__=c,h}function one(){var c=this.__wrapped__;if(c instanceof xr){var h=c;return this.__actions__.length&&(h=new xr(this)),h=h.reverse(),h.__actions__.push({func:qp,args:[Ry],thisArg:r}),new as(h,this.__chain__)}return this.thru(Ry)}function ane(){return k9(this.__wrapped__,this.__actions__)}var cne=Np(function(c,h,w){Tr.call(c,w)?++c[w]:zo(c,w,1)});function une(c,h,w){var L=sr(c)?Y7:Qee;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}function fne(c,h){var w=sr(c)?Ia:y9;return w(c,qt(h,3))}var lne=V9(pA),hne=V9(gA);function dne(c,h){return Vn(zp(c,h),1)}function pne(c,h){return Vn(zp(c,h),x)}function gne(c,h,w){return w=w===r?1:ur(w),Vn(zp(c,h),w)}function xA(c,h){var w=sr(c)?ss:Da;return w(c,qt(h,3))}function _A(c,h){var w=sr(c)?NQ:b9;return w(c,qt(h,3))}var mne=Np(function(c,h,w){Tr.call(c,w)?c[w].push(h):zo(c,w,[h])});function vne(c,h,w,L){c=Si(c)?c:pf(c),w=w&&!L?ur(w):0;var W=c.length;return w<0&&(w=Pn(W+w,0)),Gp(c)?w<=W&&c.indexOf(h,w)>-1:!!W&&tf(c,h,w)>-1}var bne=hr(function(c,h,w){var L=-1,W=typeof h=="function",ne=Si(c)?Ce(c.length):[];return Da(c,function(he){ne[++L]=W?Bn(h,he,w):Ah(he,h,w)}),ne}),yne=Np(function(c,h,w){zo(c,w,h)});function zp(c,h){var w=sr(c)?Xr:A9;return w(c,qt(h,3))}function wne(c,h,w,L){return c==null?[]:(sr(h)||(h=h==null?[]:[h]),w=L?r:w,sr(w)||(w=w==null?[]:[w]),C9(c,h,w))}var xne=Np(function(c,h,w){c[w?0:1].push(h)},function(){return[[],[]]});function _ne(c,h,w){var L=sr(c)?Hb:Q7,W=arguments.length<3;return L(c,qt(h,4),w,W,Da)}function Ene(c,h,w){var L=sr(c)?LQ:Q7,W=arguments.length<3;return L(c,qt(h,4),w,W,b9)}function Sne(c,h){var w=sr(c)?Ia:y9;return w(c,Kp(qt(h,3)))}function Ane(c){var h=sr(c)?p9:vte;return h(c)}function Pne(c,h,w){(w?ci(c,h,w):h===r)?h=1:h=ur(h);var L=sr(c)?Gee:bte;return L(c,h)}function Mne(c){var h=sr(c)?Yee:wte;return h(c)}function Ine(c){if(c==null)return 0;if(Si(c))return Gp(c)?nf(c):c.length;var h=ti(c);return h==ie||h==Ie?c.size:uy(c).length}function Cne(c,h,w){var L=sr(c)?Wb:xte;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}var Tne=hr(function(c,h){if(c==null)return[];var w=h.length;return w>1&&ci(c,h[0],h[1])?h=[]:w>2&&ci(h[0],h[1],h[2])&&(h=[h[0]]),C9(c,Vn(h,1),[])}),Hp=fee||function(){return _r.Date.now()};function Rne(c,h){if(typeof h!="function")throw new os(o);return c=ur(c),function(){if(--c<1)return h.apply(this,arguments)}}function EA(c,h,w){return h=w?r:h,h=c&&h==null?c.length:h,Ho(c,T,r,r,r,r,h)}function SA(c,h){var w;if(typeof h!="function")throw new os(o);return c=ur(c),function(){return--c>0&&(w=h.apply(this,arguments)),c<=1&&(h=r),w}}var Oy=hr(function(c,h,w){var L=D;if(w.length){var W=Ta(w,hf(Oy));L|=K}return Ho(c,L,h,w,W)}),AA=hr(function(c,h,w){var L=D|k;if(w.length){var W=Ta(w,hf(AA));L|=K}return Ho(h,L,c,w,W)});function PA(c,h,w){h=w?r:h;var L=Ho(c,j,r,r,r,r,r,h);return L.placeholder=PA.placeholder,L}function MA(c,h,w){h=w?r:h;var L=Ho(c,U,r,r,r,r,r,h);return L.placeholder=MA.placeholder,L}function IA(c,h,w){var L,W,ne,he,me,we,We=0,Ke=!1,Ze=!1,xt=!0;if(typeof c!="function")throw new os(o);h=ls(h)||0,Qr(w)&&(Ke=!!w.leading,Ze="maxWait"in w,ne=Ze?Pn(ls(w.maxWait)||0,h):ne,xt="trailing"in w?!!w.trailing:xt);function Nt(vn){var Ts=L,Yo=W;return L=W=r,We=vn,he=c.apply(Yo,Ts),he}function Vt(vn){return We=vn,me=Th(br,h),Ke?Nt(vn):he}function fr(vn){var Ts=vn-we,Yo=vn-We,VA=h-Ts;return Ze?ei(VA,ne-Yo):VA}function Gt(vn){var Ts=vn-we,Yo=vn-We;return we===r||Ts>=h||Ts<0||Ze&&Yo>=ne}function br(){var vn=Hp();if(Gt(vn))return Er(vn);me=Th(br,fr(vn))}function Er(vn){return me=r,xt&&L?Nt(vn):(L=W=r,he)}function $i(){me!==r&&$9(me),We=0,L=we=W=me=r}function ui(){return me===r?he:Er(Hp())}function Fi(){var vn=Hp(),Ts=Gt(vn);if(L=arguments,W=this,we=vn,Ts){if(me===r)return Vt(we);if(Ze)return $9(me),me=Th(br,h),Nt(we)}return me===r&&(me=Th(br,h)),he}return Fi.cancel=$i,Fi.flush=ui,Fi}var Dne=hr(function(c,h){return v9(c,1,h)}),One=hr(function(c,h,w){return v9(c,ls(h)||0,w)});function Nne(c){return Ho(c,ue)}function Wp(c,h){if(typeof c!="function"||h!=null&&typeof h!="function")throw new os(o);var w=function(){var L=arguments,W=h?h.apply(this,L):L[0],ne=w.cache;if(ne.has(W))return ne.get(W);var he=c.apply(this,L);return w.cache=ne.set(W,he)||ne,he};return w.cache=new(Wp.Cache||qo),w}Wp.Cache=qo;function Kp(c){if(typeof c!="function")throw new os(o);return function(){var h=arguments;switch(h.length){case 0:return!c.call(this);case 1:return!c.call(this,h[0]);case 2:return!c.call(this,h[0],h[1]);case 3:return!c.call(this,h[0],h[1],h[2])}return!c.apply(this,h)}}function Lne(c){return SA(2,c)}var kne=_te(function(c,h){h=h.length==1&&sr(h[0])?Xr(h[0],Li(qt())):Xr(Vn(h,1),Li(qt()));var w=h.length;return hr(function(L){for(var W=-1,ne=ei(L.length,w);++W=h}),Lc=_9(function(){return arguments}())?_9:function(c){return rn(c)&&Tr.call(c,"callee")&&!c9.call(c,"callee")},sr=Ce.isArray,Xne=oi?Li(oi):ste;function Si(c){return c!=null&&Vp(c.length)&&!Vo(c)}function mn(c){return rn(c)&&Si(c)}function Zne(c){return c===!0||c===!1||rn(c)&&ai(c)==X}var ka=hee||Wy,Qne=Ps?Li(Ps):ote;function eie(c){return rn(c)&&c.nodeType===1&&!Rh(c)}function tie(c){if(c==null)return!0;if(Si(c)&&(sr(c)||typeof c=="string"||typeof c.splice=="function"||ka(c)||df(c)||Lc(c)))return!c.length;var h=ti(c);if(h==ie||h==Ie)return!c.size;if(Ch(c))return!uy(c).length;for(var w in c)if(Tr.call(c,w))return!1;return!0}function rie(c,h){return Ph(c,h)}function nie(c,h,w){w=typeof w=="function"?w:r;var L=w?w(c,h):r;return L===r?Ph(c,h,r,w):!!L}function Ly(c){if(!rn(c))return!1;var h=ai(c);return h==Z||h==R||typeof c.message=="string"&&typeof c.name=="string"&&!Rh(c)}function iie(c){return typeof c=="number"&&f9(c)}function Vo(c){if(!Qr(c))return!1;var h=ai(c);return h==te||h==le||h==ee||h==Te}function TA(c){return typeof c=="number"&&c==ur(c)}function Vp(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=_}function Qr(c){var h=typeof c;return c!=null&&(h=="object"||h=="function")}function rn(c){return c!=null&&typeof c=="object"}var RA=is?Li(is):cte;function sie(c,h){return c===h||cy(c,h,Ay(h))}function oie(c,h,w){return w=typeof w=="function"?w:r,cy(c,h,Ay(h),w)}function aie(c){return DA(c)&&c!=+c}function cie(c){if(Wte(c))throw new tr(s);return E9(c)}function uie(c){return c===null}function fie(c){return c==null}function DA(c){return typeof c=="number"||rn(c)&&ai(c)==fe}function Rh(c){if(!rn(c)||ai(c)!=Me)return!1;var h=wp(c);if(h===null)return!0;var w=Tr.call(h,"constructor")&&h.constructor;return typeof w=="function"&&w instanceof w&&mp.call(w)==oee}var ky=ro?Li(ro):ute;function lie(c){return TA(c)&&c>=-_&&c<=_}var OA=mh?Li(mh):fte;function Gp(c){return typeof c=="string"||!sr(c)&&rn(c)&&ai(c)==Le}function Bi(c){return typeof c=="symbol"||rn(c)&&ai(c)==Ve}var df=Mc?Li(Mc):lte;function hie(c){return c===r}function die(c){return rn(c)&&ti(c)==ze}function pie(c){return rn(c)&&ai(c)==He}var gie=$p(fy),mie=$p(function(c,h){return c<=h});function NA(c){if(!c)return[];if(Si(c))return Gp(c)?Ms(c):Ei(c);if(bh&&c[bh])return GQ(c[bh]());var h=ti(c),w=h==ie?Xb:h==Ie?dp:pf;return w(c)}function Go(c){if(!c)return c===0?c:0;if(c=ls(c),c===x||c===-x){var h=c<0?-1:1;return h*S}return c===c?c:0}function ur(c){var h=Go(c),w=h%1;return h===h?w?h-w:h:0}function LA(c){return c?Rc(ur(c),0,M):0}function ls(c){if(typeof c=="number")return c;if(Bi(c))return b;if(Qr(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=Qr(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=e9(c);var w=it.test(c);return w||gt.test(c)?ir(c.slice(2),w?2:8):De.test(c)?b:+c}function kA(c){return io(c,Ai(c))}function vie(c){return c?Rc(ur(c),-_,_):c===0?c:0}function Cr(c){return c==null?"":ki(c)}var bie=ff(function(c,h){if(Ch(h)||Si(h)){io(h,$n(h),c);return}for(var w in h)Tr.call(h,w)&&Eh(c,w,h[w])}),BA=ff(function(c,h){io(h,Ai(h),c)}),Yp=ff(function(c,h,w,L){io(h,Ai(h),c,L)}),yie=ff(function(c,h,w,L){io(h,$n(h),c,L)}),wie=Wo(ny);function xie(c,h){var w=uf(c);return h==null?w:g9(w,h)}var _ie=hr(function(c,h){c=qr(c);var w=-1,L=h.length,W=L>2?h[2]:r;for(W&&ci(h[0],h[1],W)&&(L=1);++w1),ne}),io(c,Ey(c),w),L&&(w=cs(w,p|y|A,Ote));for(var W=h.length;W--;)gy(w,h[W]);return w});function jie(c,h){return FA(c,Kp(qt(h)))}var Uie=Wo(function(c,h){return c==null?{}:pte(c,h)});function FA(c,h){if(c==null)return{};var w=Xr(Ey(c),function(L){return[L]});return h=qt(h),T9(c,w,function(L,W){return h(L,W[0])})}function qie(c,h,w){h=Na(h,c);var L=-1,W=h.length;for(W||(W=1,c=r);++Lh){var L=c;c=h,h=L}if(w||c%1||h%1){var W=l9();return ei(c+W*(h-c+jr("1e-"+((W+"").length-1))),h)}return hy(c,h)}var Qie=lf(function(c,h,w){return h=h.toLowerCase(),c+(w?qA(h):h)});function qA(c){return Fy(Cr(c).toLowerCase())}function zA(c){return c=Cr(c),c&&c.replace(tt,zQ).replace(Ub,"")}function ese(c,h,w){c=Cr(c),h=ki(h);var L=c.length;w=w===r?L:Rc(ur(w),0,L);var W=w;return w-=h.length,w>=0&&c.slice(w,W)==h}function tse(c){return c=Cr(c),c&&Tt.test(c)?c.replace(Ot,HQ):c}function rse(c){return c=Cr(c),c&&Ft.test(c)?c.replace(nt,"\\$&"):c}var nse=lf(function(c,h,w){return c+(w?"-":"")+h.toLowerCase()}),ise=lf(function(c,h,w){return c+(w?" ":"")+h.toLowerCase()}),sse=K9("toLowerCase");function ose(c,h,w){c=Cr(c),h=ur(h);var L=h?nf(c):0;if(!h||L>=h)return c;var W=(h-L)/2;return Bp(Sp(W),w)+c+Bp(Ep(W),w)}function ase(c,h,w){c=Cr(c),h=ur(h);var L=h?nf(c):0;return h&&L>>0,w?(c=Cr(c),c&&(typeof h=="string"||h!=null&&!ky(h))&&(h=ki(h),!h&&rf(c))?La(Ms(c),0,w):c.split(h,w)):[]}var pse=lf(function(c,h,w){return c+(w?" ":"")+Fy(h)});function gse(c,h,w){return c=Cr(c),w=w==null?0:Rc(ur(w),0,c.length),h=ki(h),c.slice(w,w+h.length)==h}function mse(c,h,w){var L=re.templateSettings;w&&ci(c,h,w)&&(h=r),c=Cr(c),h=Yp({},h,L,Q9);var W=Yp({},h.imports,L.imports,Q9),ne=$n(W),he=Jb(W,ne),me,we,We=0,Ke=h.interpolate||At,Ze="__p += '",xt=Zb((h.escape||At).source+"|"+Ke.source+"|"+(Ke===Lt?xe:At).source+"|"+(h.evaluate||At).source+"|$","g"),Nt="//# sourceURL="+(Tr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++qb+"]")+` +`)}function qte(c){return sr(c)||Lc(c)||!!(u9&&c&&c[u9])}function Ko(c,h){var w=typeof c;return h=h??_,!!h&&(w=="number"||w!="symbol"&&st.test(c))&&c>-1&&c%1==0&&c0){if(++h>=E)return arguments[0]}else h=0;return c.apply(r,arguments)}}function Up(c,h){var w=-1,L=c.length,K=L-1;for(h=h===r?L:h;++w1?c[h-1]:r;return w=typeof w=="function"?(c.pop(),w):r,yA(c,w)});function wA(c){var h=re(c);return h.__chain__=!0,h}function Qre(c,h){return h(c),c}function qp(c,h){return h(c)}var ene=Wo(function(c){var h=c.length,w=h?c[0]:0,L=this.__wrapped__,K=function(ne){return iy(ne,c)};return h>1||this.__actions__.length||!(L instanceof xr)||!Ko(w)?this.thru(K):(L=L.slice(w,+w+(h?1:0)),L.__actions__.push({func:qp,args:[K],thisArg:r}),new as(L,this.__chain__).thru(function(ne){return h&&!ne.length&&ne.push(r),ne}))});function tne(){return wA(this)}function rne(){return new as(this.value(),this.__chain__)}function nne(){this.__values__===r&&(this.__values__=NA(this.value()));var c=this.__index__>=this.__values__.length,h=c?r:this.__values__[this.__index__++];return{done:c,value:h}}function ine(){return this}function sne(c){for(var h,w=this;w instanceof Mp;){var L=dA(w);L.__index__=0,L.__values__=r,h?K.__wrapped__=L:h=L;var K=L;w=w.__wrapped__}return K.__wrapped__=c,h}function one(){var c=this.__wrapped__;if(c instanceof xr){var h=c;return this.__actions__.length&&(h=new xr(this)),h=h.reverse(),h.__actions__.push({func:qp,args:[Dy],thisArg:r}),new as(h,this.__chain__)}return this.thru(Dy)}function ane(){return k9(this.__wrapped__,this.__actions__)}var cne=Np(function(c,h,w){Tr.call(c,w)?++c[w]:zo(c,w,1)});function une(c,h,w){var L=sr(c)?Y7:Qee;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}function fne(c,h){var w=sr(c)?Ia:y9;return w(c,qt(h,3))}var lne=V9(pA),hne=V9(gA);function dne(c,h){return Vn(zp(c,h),1)}function pne(c,h){return Vn(zp(c,h),x)}function gne(c,h,w){return w=w===r?1:ur(w),Vn(zp(c,h),w)}function xA(c,h){var w=sr(c)?ss:Da;return w(c,qt(h,3))}function _A(c,h){var w=sr(c)?NQ:b9;return w(c,qt(h,3))}var mne=Np(function(c,h,w){Tr.call(c,w)?c[w].push(h):zo(c,w,[h])});function vne(c,h,w,L){c=Si(c)?c:gf(c),w=w&&!L?ur(w):0;var K=c.length;return w<0&&(w=Pn(K+w,0)),Gp(c)?w<=K&&c.indexOf(h,w)>-1:!!K&&rf(c,h,w)>-1}var bne=hr(function(c,h,w){var L=-1,K=typeof h=="function",ne=Si(c)?Ce(c.length):[];return Da(c,function(he){ne[++L]=K?$n(h,he,w):Ah(he,h,w)}),ne}),yne=Np(function(c,h,w){zo(c,w,h)});function zp(c,h){var w=sr(c)?Xr:A9;return w(c,qt(h,3))}function wne(c,h,w,L){return c==null?[]:(sr(h)||(h=h==null?[]:[h]),w=L?r:w,sr(w)||(w=w==null?[]:[w]),C9(c,h,w))}var xne=Np(function(c,h,w){c[w?0:1].push(h)},function(){return[[],[]]});function _ne(c,h,w){var L=sr(c)?Wb:Q7,K=arguments.length<3;return L(c,qt(h,4),w,K,Da)}function Ene(c,h,w){var L=sr(c)?LQ:Q7,K=arguments.length<3;return L(c,qt(h,4),w,K,b9)}function Sne(c,h){var w=sr(c)?Ia:y9;return w(c,Kp(qt(h,3)))}function Ane(c){var h=sr(c)?p9:vte;return h(c)}function Pne(c,h,w){(w?ci(c,h,w):h===r)?h=1:h=ur(h);var L=sr(c)?Gee:bte;return L(c,h)}function Mne(c){var h=sr(c)?Yee:wte;return h(c)}function Ine(c){if(c==null)return 0;if(Si(c))return Gp(c)?sf(c):c.length;var h=ti(c);return h==ie||h==Ie?c.size:fy(c).length}function Cne(c,h,w){var L=sr(c)?Kb:xte;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}var Tne=hr(function(c,h){if(c==null)return[];var w=h.length;return w>1&&ci(c,h[0],h[1])?h=[]:w>2&&ci(h[0],h[1],h[2])&&(h=[h[0]]),C9(c,Vn(h,1),[])}),Hp=fee||function(){return _r.Date.now()};function Rne(c,h){if(typeof h!="function")throw new os(o);return c=ur(c),function(){if(--c<1)return h.apply(this,arguments)}}function EA(c,h,w){return h=w?r:h,h=c&&h==null?c.length:h,Ho(c,T,r,r,r,r,h)}function SA(c,h){var w;if(typeof h!="function")throw new os(o);return c=ur(c),function(){return--c>0&&(w=h.apply(this,arguments)),c<=1&&(h=r),w}}var Ny=hr(function(c,h,w){var L=D;if(w.length){var K=Ta(w,df(Ny));L|=H}return Ho(c,L,h,w,K)}),AA=hr(function(c,h,w){var L=D|k;if(w.length){var K=Ta(w,df(AA));L|=H}return Ho(h,L,c,w,K)});function PA(c,h,w){h=w?r:h;var L=Ho(c,q,r,r,r,r,r,h);return L.placeholder=PA.placeholder,L}function MA(c,h,w){h=w?r:h;var L=Ho(c,j,r,r,r,r,r,h);return L.placeholder=MA.placeholder,L}function IA(c,h,w){var L,K,ne,he,me,we,We=0,Ke=!1,Ze=!1,xt=!0;if(typeof c!="function")throw new os(o);h=ls(h)||0,Qr(w)&&(Ke=!!w.leading,Ze="maxWait"in w,ne=Ze?Pn(ls(w.maxWait)||0,h):ne,xt="trailing"in w?!!w.trailing:xt);function Nt(vn){var Ts=L,Yo=K;return L=K=r,We=vn,he=c.apply(Yo,Ts),he}function Vt(vn){return We=vn,me=Th(br,h),Ke?Nt(vn):he}function fr(vn){var Ts=vn-we,Yo=vn-We,VA=h-Ts;return Ze?ei(VA,ne-Yo):VA}function Gt(vn){var Ts=vn-we,Yo=vn-We;return we===r||Ts>=h||Ts<0||Ze&&Yo>=ne}function br(){var vn=Hp();if(Gt(vn))return Er(vn);me=Th(br,fr(vn))}function Er(vn){return me=r,xt&&L?Nt(vn):(L=K=r,he)}function $i(){me!==r&&$9(me),We=0,L=we=K=me=r}function ui(){return me===r?he:Er(Hp())}function Fi(){var vn=Hp(),Ts=Gt(vn);if(L=arguments,K=this,we=vn,Ts){if(me===r)return Vt(we);if(Ze)return $9(me),me=Th(br,h),Nt(we)}return me===r&&(me=Th(br,h)),he}return Fi.cancel=$i,Fi.flush=ui,Fi}var Dne=hr(function(c,h){return v9(c,1,h)}),One=hr(function(c,h,w){return v9(c,ls(h)||0,w)});function Nne(c){return Ho(c,ue)}function Wp(c,h){if(typeof c!="function"||h!=null&&typeof h!="function")throw new os(o);var w=function(){var L=arguments,K=h?h.apply(this,L):L[0],ne=w.cache;if(ne.has(K))return ne.get(K);var he=c.apply(this,L);return w.cache=ne.set(K,he)||ne,he};return w.cache=new(Wp.Cache||qo),w}Wp.Cache=qo;function Kp(c){if(typeof c!="function")throw new os(o);return function(){var h=arguments;switch(h.length){case 0:return!c.call(this);case 1:return!c.call(this,h[0]);case 2:return!c.call(this,h[0],h[1]);case 3:return!c.call(this,h[0],h[1],h[2])}return!c.apply(this,h)}}function Lne(c){return SA(2,c)}var kne=_te(function(c,h){h=h.length==1&&sr(h[0])?Xr(h[0],Li(qt())):Xr(Vn(h,1),Li(qt()));var w=h.length;return hr(function(L){for(var K=-1,ne=ei(L.length,w);++K=h}),Lc=_9(function(){return arguments}())?_9:function(c){return rn(c)&&Tr.call(c,"callee")&&!c9.call(c,"callee")},sr=Ce.isArray,Xne=oi?Li(oi):ste;function Si(c){return c!=null&&Vp(c.length)&&!Vo(c)}function mn(c){return rn(c)&&Si(c)}function Zne(c){return c===!0||c===!1||rn(c)&&ai(c)==X}var ka=hee||Ky,Qne=Ps?Li(Ps):ote;function eie(c){return rn(c)&&c.nodeType===1&&!Rh(c)}function tie(c){if(c==null)return!0;if(Si(c)&&(sr(c)||typeof c=="string"||typeof c.splice=="function"||ka(c)||pf(c)||Lc(c)))return!c.length;var h=ti(c);if(h==ie||h==Ie)return!c.size;if(Ch(c))return!fy(c).length;for(var w in c)if(Tr.call(c,w))return!1;return!0}function rie(c,h){return Ph(c,h)}function nie(c,h,w){w=typeof w=="function"?w:r;var L=w?w(c,h):r;return L===r?Ph(c,h,r,w):!!L}function ky(c){if(!rn(c))return!1;var h=ai(c);return h==Z||h==R||typeof c.message=="string"&&typeof c.name=="string"&&!Rh(c)}function iie(c){return typeof c=="number"&&f9(c)}function Vo(c){if(!Qr(c))return!1;var h=ai(c);return h==te||h==le||h==ee||h==Te}function TA(c){return typeof c=="number"&&c==ur(c)}function Vp(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=_}function Qr(c){var h=typeof c;return c!=null&&(h=="object"||h=="function")}function rn(c){return c!=null&&typeof c=="object"}var RA=is?Li(is):cte;function sie(c,h){return c===h||uy(c,h,Py(h))}function oie(c,h,w){return w=typeof w=="function"?w:r,uy(c,h,Py(h),w)}function aie(c){return DA(c)&&c!=+c}function cie(c){if(Wte(c))throw new tr(s);return E9(c)}function uie(c){return c===null}function fie(c){return c==null}function DA(c){return typeof c=="number"||rn(c)&&ai(c)==fe}function Rh(c){if(!rn(c)||ai(c)!=Me)return!1;var h=wp(c);if(h===null)return!0;var w=Tr.call(h,"constructor")&&h.constructor;return typeof w=="function"&&w instanceof w&&mp.call(w)==oee}var By=ro?Li(ro):ute;function lie(c){return TA(c)&&c>=-_&&c<=_}var OA=mh?Li(mh):fte;function Gp(c){return typeof c=="string"||!sr(c)&&rn(c)&&ai(c)==Le}function Bi(c){return typeof c=="symbol"||rn(c)&&ai(c)==Ve}var pf=Mc?Li(Mc):lte;function hie(c){return c===r}function die(c){return rn(c)&&ti(c)==ze}function pie(c){return rn(c)&&ai(c)==He}var gie=$p(ly),mie=$p(function(c,h){return c<=h});function NA(c){if(!c)return[];if(Si(c))return Gp(c)?Ms(c):Ei(c);if(bh&&c[bh])return GQ(c[bh]());var h=ti(c),w=h==ie?Zb:h==Ie?dp:gf;return w(c)}function Go(c){if(!c)return c===0?c:0;if(c=ls(c),c===x||c===-x){var h=c<0?-1:1;return h*S}return c===c?c:0}function ur(c){var h=Go(c),w=h%1;return h===h?w?h-w:h:0}function LA(c){return c?Rc(ur(c),0,M):0}function ls(c){if(typeof c=="number")return c;if(Bi(c))return b;if(Qr(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=Qr(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=e9(c);var w=it.test(c);return w||gt.test(c)?ir(c.slice(2),w?2:8):De.test(c)?b:+c}function kA(c){return io(c,Ai(c))}function vie(c){return c?Rc(ur(c),-_,_):c===0?c:0}function Cr(c){return c==null?"":ki(c)}var bie=lf(function(c,h){if(Ch(h)||Si(h)){io(h,Fn(h),c);return}for(var w in h)Tr.call(h,w)&&Eh(c,w,h[w])}),BA=lf(function(c,h){io(h,Ai(h),c)}),Yp=lf(function(c,h,w,L){io(h,Ai(h),c,L)}),yie=lf(function(c,h,w,L){io(h,Fn(h),c,L)}),wie=Wo(iy);function xie(c,h){var w=ff(c);return h==null?w:g9(w,h)}var _ie=hr(function(c,h){c=qr(c);var w=-1,L=h.length,K=L>2?h[2]:r;for(K&&ci(h[0],h[1],K)&&(L=1);++w1),ne}),io(c,Sy(c),w),L&&(w=cs(w,p|y|A,Ote));for(var K=h.length;K--;)my(w,h[K]);return w});function jie(c,h){return FA(c,Kp(qt(h)))}var Uie=Wo(function(c,h){return c==null?{}:pte(c,h)});function FA(c,h){if(c==null)return{};var w=Xr(Sy(c),function(L){return[L]});return h=qt(h),T9(c,w,function(L,K){return h(L,K[0])})}function qie(c,h,w){h=Na(h,c);var L=-1,K=h.length;for(K||(K=1,c=r);++Lh){var L=c;c=h,h=L}if(w||c%1||h%1){var K=l9();return ei(c+K*(h-c+jr("1e-"+((K+"").length-1))),h)}return dy(c,h)}var Qie=hf(function(c,h,w){return h=h.toLowerCase(),c+(w?qA(h):h)});function qA(c){return jy(Cr(c).toLowerCase())}function zA(c){return c=Cr(c),c&&c.replace(tt,zQ).replace(qb,"")}function ese(c,h,w){c=Cr(c),h=ki(h);var L=c.length;w=w===r?L:Rc(ur(w),0,L);var K=w;return w-=h.length,w>=0&&c.slice(w,K)==h}function tse(c){return c=Cr(c),c&&Tt.test(c)?c.replace(Ot,HQ):c}function rse(c){return c=Cr(c),c&&Ft.test(c)?c.replace(nt,"\\$&"):c}var nse=hf(function(c,h,w){return c+(w?"-":"")+h.toLowerCase()}),ise=hf(function(c,h,w){return c+(w?" ":"")+h.toLowerCase()}),sse=K9("toLowerCase");function ose(c,h,w){c=Cr(c),h=ur(h);var L=h?sf(c):0;if(!h||L>=h)return c;var K=(h-L)/2;return Bp(Sp(K),w)+c+Bp(Ep(K),w)}function ase(c,h,w){c=Cr(c),h=ur(h);var L=h?sf(c):0;return h&&L>>0,w?(c=Cr(c),c&&(typeof h=="string"||h!=null&&!By(h))&&(h=ki(h),!h&&nf(c))?La(Ms(c),0,w):c.split(h,w)):[]}var pse=hf(function(c,h,w){return c+(w?" ":"")+jy(h)});function gse(c,h,w){return c=Cr(c),w=w==null?0:Rc(ur(w),0,c.length),h=ki(h),c.slice(w,w+h.length)==h}function mse(c,h,w){var L=re.templateSettings;w&&ci(c,h,w)&&(h=r),c=Cr(c),h=Yp({},h,L,Q9);var K=Yp({},h.imports,L.imports,Q9),ne=Fn(K),he=Xb(K,ne),me,we,We=0,Ke=h.interpolate||At,Ze="__p += '",xt=Qb((h.escape||At).source+"|"+Ke.source+"|"+(Ke===Lt?xe:At).source+"|"+(h.evaluate||At).source+"|$","g"),Nt="//# sourceURL="+(Tr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++zb+"]")+` `;c.replace(xt,function(Gt,br,Er,$i,ui,Fi){return Er||(Er=$i),Ze+=c.slice(We,Fi).replace(Rt,WQ),br&&(me=!0,Ze+=`' + __e(`+br+`) + '`),ui&&(we=!0,Ze+=`'; @@ -104,19 +104,19 @@ __p += '`),Er&&(Ze+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+Ze+`return __p -}`;var fr=WA(function(){return Mr(ne,Nt+"return "+Ze).apply(r,he)});if(fr.source=Ze,Ly(fr))throw fr;return fr}function vse(c){return Cr(c).toLowerCase()}function bse(c){return Cr(c).toUpperCase()}function yse(c,h,w){if(c=Cr(c),c&&(w||h===r))return e9(c);if(!c||!(h=ki(h)))return c;var L=Ms(c),W=Ms(h),ne=t9(L,W),he=r9(L,W)+1;return La(L,ne,he).join("")}function wse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.slice(0,i9(c)+1);if(!c||!(h=ki(h)))return c;var L=Ms(c),W=r9(L,Ms(h))+1;return La(L,0,W).join("")}function xse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.replace($,"");if(!c||!(h=ki(h)))return c;var L=Ms(c),W=t9(L,Ms(h));return La(L,W).join("")}function _se(c,h){var w=_e,L=G;if(Qr(h)){var W="separator"in h?h.separator:W;w="length"in h?ur(h.length):w,L="omission"in h?ki(h.omission):L}c=Cr(c);var ne=c.length;if(rf(c)){var he=Ms(c);ne=he.length}if(w>=ne)return c;var me=w-nf(L);if(me<1)return L;var we=he?La(he,0,me).join(""):c.slice(0,me);if(W===r)return we+L;if(he&&(me+=we.length-me),ky(W)){if(c.slice(me).search(W)){var We,Ke=we;for(W.global||(W=Zb(W.source,Cr(Re.exec(W))+"g")),W.lastIndex=0;We=W.exec(Ke);)var Ze=We.index;we=we.slice(0,Ze===r?me:Ze)}}else if(c.indexOf(ki(W),me)!=me){var xt=we.lastIndexOf(W);xt>-1&&(we=we.slice(0,xt))}return we+L}function Ese(c){return c=Cr(c),c&&Bt.test(c)?c.replace(Xt,ZQ):c}var Sse=lf(function(c,h,w){return c+(w?" ":"")+h.toUpperCase()}),Fy=K9("toUpperCase");function HA(c,h,w){return c=Cr(c),h=w?r:h,h===r?VQ(c)?tee(c):$Q(c):c.match(h)||[]}var WA=hr(function(c,h){try{return Bn(c,r,h)}catch(w){return Ly(w)?w:new tr(w)}}),Ase=Wo(function(c,h){return ss(h,function(w){w=so(w),zo(c,w,Oy(c[w],c))}),c});function Pse(c){var h=c==null?0:c.length,w=qt();return c=h?Xr(c,function(L){if(typeof L[1]!="function")throw new os(o);return[w(L[0]),L[1]]}):[],hr(function(L){for(var W=-1;++W_)return[];var w=M,L=ei(c,M);h=qt(h),c-=M;for(var W=Yb(L,h);++w0||h<0)?new xr(w):(c<0?w=w.takeRight(-c):c&&(w=w.drop(c)),h!==r&&(h=ur(h),w=h<0?w.dropRight(-h):w.take(h-c)),w)},xr.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},xr.prototype.toArray=function(){return this.take(M)},no(xr.prototype,function(c,h){var w=/^(?:filter|find|map|reject)|While$/.test(h),L=/^(?:head|last)$/.test(h),W=re[L?"take"+(h=="last"?"Right":""):h],ne=L||/^find/.test(h);W&&(re.prototype[h]=function(){var he=this.__wrapped__,me=L?[1]:arguments,we=he instanceof xr,We=me[0],Ke=we||sr(he),Ze=function(br){var Er=W.apply(re,Ca([br],me));return L&&xt?Er[0]:Er};Ke&&w&&typeof We=="function"&&We.length!=1&&(we=Ke=!1);var xt=this.__chain__,Nt=!!this.__actions__.length,Vt=ne&&!xt,fr=we&&!Nt;if(!ne&&Ke){he=fr?he:new xr(this);var Gt=c.apply(he,me);return Gt.__actions__.push({func:qp,args:[Ze],thisArg:r}),new as(Gt,xt)}return Vt&&fr?c.apply(this,me):(Gt=this.thru(Ze),Vt?L?Gt.value()[0]:Gt.value():Gt)})}),ss(["pop","push","shift","sort","splice","unshift"],function(c){var h=pp[c],w=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",L=/^(?:pop|shift)$/.test(c);re.prototype[c]=function(){var W=arguments;if(L&&!this.__chain__){var ne=this.value();return h.apply(sr(ne)?ne:[],W)}return this[w](function(he){return h.apply(sr(he)?he:[],W)})}}),no(xr.prototype,function(c,h){var w=re[h];if(w){var L=w.name+"";Tr.call(cf,L)||(cf[L]=[]),cf[L].push({name:h,func:w})}}),cf[Lp(r,k).name]=[{name:"wrapper",func:r}],xr.prototype.clone=Eee,xr.prototype.reverse=See,xr.prototype.value=Aee,re.prototype.at=ene,re.prototype.chain=tne,re.prototype.commit=rne,re.prototype.next=nne,re.prototype.plant=sne,re.prototype.reverse=one,re.prototype.toJSON=re.prototype.valueOf=re.prototype.value=ane,re.prototype.first=re.prototype.head,bh&&(re.prototype[bh]=ine),re},sf=ree();gn?((gn.exports=sf)._=sf,Ur._=sf):_r._=sf}).call(nn)}(e0,e0.exports);var Pq=e0.exports,P1={exports:{}};(function(t,e){var r=typeof self<"u"?self:nn,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function u(f){return f&&DataView.prototype.isPrototypeOf(f)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(f){return f&&l.indexOf(Object.prototype.toString.call(f))>-1};function p(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function y(f){return typeof f!="string"&&(f=String(f)),f}function A(f){var g={next:function(){var v=f.shift();return{done:v===void 0,value:v}}};return a.iterable&&(g[Symbol.iterator]=function(){return g}),g}function P(f){this.map={},f instanceof P?f.forEach(function(g,v){this.append(v,g)},this):Array.isArray(f)?f.forEach(function(g){this.append(g[0],g[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(g){this.append(g,f[g])},this)}P.prototype.append=function(f,g){f=p(f),g=y(g);var v=this.map[f];this.map[f]=v?v+", "+g:g},P.prototype.delete=function(f){delete this.map[p(f)]},P.prototype.get=function(f){return f=p(f),this.has(f)?this.map[f]:null},P.prototype.has=function(f){return this.map.hasOwnProperty(p(f))},P.prototype.set=function(f,g){this.map[p(f)]=y(g)},P.prototype.forEach=function(f,g){for(var v in this.map)this.map.hasOwnProperty(v)&&f.call(g,this.map[v],v,this)},P.prototype.keys=function(){var f=[];return this.forEach(function(g,v){f.push(v)}),A(f)},P.prototype.values=function(){var f=[];return this.forEach(function(g){f.push(g)}),A(f)},P.prototype.entries=function(){var f=[];return this.forEach(function(g,v){f.push([v,g])}),A(f)},a.iterable&&(P.prototype[Symbol.iterator]=P.prototype.entries);function N(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function D(f){return new Promise(function(g,v){f.onload=function(){g(f.result)},f.onerror=function(){v(f.error)}})}function k(f){var g=new FileReader,v=D(g);return g.readAsArrayBuffer(f),v}function B(f){var g=new FileReader,v=D(g);return g.readAsText(f),v}function j(f){for(var g=new Uint8Array(f),v=new Array(g.length),x=0;x-1?g:f}function z(f,g){g=g||{};var v=g.body;if(f instanceof z){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,g.headers||(this.headers=new P(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!v&&f._bodyInit!=null&&(v=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=g.credentials||this.credentials||"same-origin",(g.headers||!this.headers)&&(this.headers=new P(g.headers)),this.method=T(g.method||this.method||"GET"),this.mode=g.mode||this.mode||null,this.signal=g.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(v)}z.prototype.clone=function(){return new z(this,{body:this._bodyInit})};function ue(f){var g=new FormData;return f.trim().split("&").forEach(function(v){if(v){var x=v.split("="),_=x.shift().replace(/\+/g," "),S=x.join("=").replace(/\+/g," ");g.append(decodeURIComponent(_),decodeURIComponent(S))}}),g}function _e(f){var g=new P,v=f.replace(/\r?\n[\t ]+/g," ");return v.split(/\r?\n/).forEach(function(x){var _=x.split(":"),S=_.shift().trim();if(S){var b=_.join(":").trim();g.append(S,b)}}),g}K.call(z.prototype);function G(f,g){g||(g={}),this.type="default",this.status=g.status===void 0?200:g.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in g?g.statusText:"OK",this.headers=new P(g.headers),this.url=g.url||"",this._initBody(f)}K.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new P(this.headers),url:this.url})},G.error=function(){var f=new G(null,{status:0,statusText:""});return f.type="error",f};var E=[301,302,303,307,308];G.redirect=function(f,g){if(E.indexOf(g)===-1)throw new RangeError("Invalid status code");return new G(null,{status:g,headers:{location:f}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(g,v){this.message=g,this.name=v;var x=Error(g);this.stack=x.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function m(f,g){return new Promise(function(v,x){var _=new z(f,g);if(_.signal&&_.signal.aborted)return x(new o.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function b(){S.abort()}S.onload=function(){var M={status:S.status,statusText:S.statusText,headers:_e(S.getAllResponseHeaders()||"")};M.url="responseURL"in S?S.responseURL:M.headers.get("X-Request-URL");var I="response"in S?S.response:S.responseText;v(new G(I,M))},S.onerror=function(){x(new TypeError("Network request failed"))},S.ontimeout=function(){x(new TypeError("Network request failed"))},S.onabort=function(){x(new o.DOMException("Aborted","AbortError"))},S.open(_.method,_.url,!0),_.credentials==="include"?S.withCredentials=!0:_.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&a.blob&&(S.responseType="blob"),_.headers.forEach(function(M,I){S.setRequestHeader(I,M)}),_.signal&&(_.signal.addEventListener("abort",b),S.onreadystatechange=function(){S.readyState===4&&_.signal.removeEventListener("abort",b)}),S.send(typeof _._bodyInit>"u"?null:_._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=P,s.Request=z,s.Response=G),o.Headers=P,o.Request=z,o.Response=G,o.fetch=m,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(P1,P1.exports);var Mq=P1.exports;const D6=ji(Mq);var Iq=Object.defineProperty,Cq=Object.defineProperties,Tq=Object.getOwnPropertyDescriptors,O6=Object.getOwnPropertySymbols,Rq=Object.prototype.hasOwnProperty,Dq=Object.prototype.propertyIsEnumerable,N6=(t,e,r)=>e in t?Iq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,L6=(t,e)=>{for(var r in e||(e={}))Rq.call(e,r)&&N6(t,r,e[r]);if(O6)for(var r of O6(e))Dq.call(e,r)&&N6(t,r,e[r]);return t},k6=(t,e)=>Cq(t,Tq(e));const Oq={Accept:"application/json","Content-Type":"application/json"},Nq="POST",B6={headers:Oq,method:Nq},$6=10;let xs=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new qi.EventEmitter,this.isAvailable=!1,this.registering=!1,!B_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=mo(e),n=await(await D6(this.url,k6(L6({},B6),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!B_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=mo({id:1,jsonrpc:"2.0",method:"test",params:[]});await D6(e,k6(L6({},B6),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ka(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return D_(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>$6&&this.events.setMaxListeners($6)}};const F6="error",Lq="wss://relay.walletconnect.org",kq="wc",Bq="universal_provider",j6=`${kq}@2:${Bq}:`,U6="https://rpc.walletconnect.org/v1/",Iu="generic",$q=`${U6}bundler`,Qi={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Fq=Object.defineProperty,jq=Object.defineProperties,Uq=Object.getOwnPropertyDescriptors,q6=Object.getOwnPropertySymbols,qq=Object.prototype.hasOwnProperty,zq=Object.prototype.propertyIsEnumerable,z6=(t,e,r)=>e in t?Fq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,t0=(t,e)=>{for(var r in e||(e={}))qq.call(e,r)&&z6(t,r,e[r]);if(q6)for(var r of q6(e))zq.call(e,r)&&z6(t,r,e[r]);return t},Hq=(t,e)=>jq(t,Uq(e));function Di(t,e,r){var n;const i=Eu(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${U6}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function fc(t){return t.includes(":")?t.split(":")[1]:t}function H6(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Wq(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function M1(t={},e={}){const r=W6(t),n=W6(e);return Pq.merge(r,n)}function W6(t){var e,r,n,i;const s={};if(!Sl(t))return s;for(const[o,a]of Object.entries(t)){const u=f1(o)?[o]:a.chains,l=a.methods||[],d=a.events||[],p=a.rpcMap||{},y=El(o);s[y]=Hq(t0(t0({},s[y]),a),{chains:Ud(u,(e=s[y])==null?void 0:e.chains),methods:Ud(l,(r=s[y])==null?void 0:r.methods),events:Ud(d,(n=s[y])==null?void 0:n.events),rpcMap:t0(t0({},p),(i=s[y])==null?void 0:i.rpcMap)})}return s}function Kq(t){return t.includes(":")?t.split(":")[2]:t}function K6(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=f1(r)?[r]:n.chains?n.chains:H6(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function I1(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const V6={},Ar=t=>V6[t],C1=(t,e)=>{V6[t]=e};class Vq{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}var Gq=Object.defineProperty,Yq=Object.defineProperties,Jq=Object.getOwnPropertyDescriptors,G6=Object.getOwnPropertySymbols,Xq=Object.prototype.hasOwnProperty,Zq=Object.prototype.propertyIsEnumerable,Y6=(t,e,r)=>e in t?Gq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,J6=(t,e)=>{for(var r in e||(e={}))Xq.call(e,r)&&Y6(t,r,e[r]);if(G6)for(var r of G6(e))Zq.call(e,r)&&Y6(t,r,e[r]);return t},X6=(t,e)=>Yq(t,Jq(e));class Qq{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(fc(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const u=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:X6(J6({},o.sessionProperties||{}),{capabilities:X6(J6({},a||{}),{[s]:u})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return u}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(da("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${$q}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class ez{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}let tz=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}},rz=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ji(new xs(n,Ar("disableProviderPing")))}},nz=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=fc(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}},iz=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}};class sz{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}let oz=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new xs(n,Ar("disableProviderPing")))}};class az{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new xs(n))}}class cz{constructor(e){this.name=Iu,this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=Eu(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}var uz=Object.defineProperty,fz=Object.defineProperties,lz=Object.getOwnPropertyDescriptors,Z6=Object.getOwnPropertySymbols,hz=Object.prototype.hasOwnProperty,dz=Object.prototype.propertyIsEnumerable,Q6=(t,e,r)=>e in t?uz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,r0=(t,e)=>{for(var r in e||(e={}))hz.call(e,r)&&Q6(t,r,e[r]);if(Z6)for(var r of Z6(e))dz.call(e,r)&&Q6(t,r,e[r]);return t},T1=(t,e)=>fz(t,lz(e));let R1=class YA{constructor(e){this.events=new Yg,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||F6})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new YA(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:r0({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,Vd(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Dr("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=K6(this.session.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=K6(s.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==C6)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Iu?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(ic(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await A1.init({core:this.providerOpts.core,logger:this.providerOpts.logger||F6,relayUrl:this.providerOpts.relayUrl||Lq,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>El(r)))];C1("client",this.client),C1("events",this.events),C1("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Wq(r,this.session),i=H6(n),s=M1(this.namespaces,this.optionalNamespaces),o=T1(r0({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new Qq({namespace:o});break;case"algorand":this.rpcProviders[r]=new rz({namespace:o});break;case"solana":this.rpcProviders[r]=new ez({namespace:o});break;case"cosmos":this.rpcProviders[r]=new tz({namespace:o});break;case"polkadot":this.rpcProviders[r]=new Vq({namespace:o});break;case"cip34":this.rpcProviders[r]=new nz({namespace:o});break;case"elrond":this.rpcProviders[r]=new iz({namespace:o});break;case"multiversx":this.rpcProviders[r]=new sz({namespace:o});break;case"near":this.rpcProviders[r]=new oz({namespace:o});break;case"tezos":this.rpcProviders[r]=new az({namespace:o});break;default:this.rpcProviders[Iu]?this.rpcProviders[Iu].updateNamespace(o):this.rpcProviders[Iu]=new cz({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&ic(i)&&this.events.emit("accountsChanged",i.map(Kq))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=El(i),a=I1(i)!==I1(s)?`${o}:${I1(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=T1(r0({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",T1(r0({},Dr("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Qi.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Iu]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>El(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=El(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${j6}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${j6}/${e}`)}};const pz=R1;function gz(){return new Promise(t=>{const e=[];let r;window.addEventListener("eip6963:announceProvider",n=>{const{detail:i}=n;r&&clearTimeout(r),e.push(i),r=setTimeout(()=>t(e),200)}),r=setTimeout(()=>t(e),200),window.dispatchEvent(new Event("eip6963:requestProvider"))})}class Ys{constructor(e,r){this.scope=e,this.module=r}storeObject(e,r){this.setItem(e,JSON.stringify(r))}loadObject(e){const r=this.getItem(e);return r?JSON.parse(r):void 0}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new Ys("CBWSDK").clear(),new Ys("walletlink").clear()}}const cn={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},D1={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},e5="Unspecified error message.",mz="Unspecified server error.";function O1(t,e=e5){if(t&&Number.isInteger(t)){const r=t.toString();if(N1(D1,r))return D1[r].message;if(t5(t))return mz}return e}function vz(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(D1[e]||t5(t))}function bz(t,{shouldIncludeStack:e=!1}={}){const r={};if(t&&typeof t=="object"&&!Array.isArray(t)&&N1(t,"code")&&vz(t.code)){const n=t;r.code=n.code,n.message&&typeof n.message=="string"?(r.message=n.message,N1(n,"data")&&(r.data=n.data)):(r.message=O1(r.code),r.data={originalError:r5(t)})}else r.code=cn.rpc.internal,r.message=n5(t,"message")?t.message:e5,r.data={originalError:r5(t)};return e&&(r.stack=n5(t,"stack")?t.stack:void 0),r}function t5(t){return t>=-32099&&t<=-32e3}function r5(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function N1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function n5(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const Sr={rpc:{parse:t=>es(cn.rpc.parse,t),invalidRequest:t=>es(cn.rpc.invalidRequest,t),invalidParams:t=>es(cn.rpc.invalidParams,t),methodNotFound:t=>es(cn.rpc.methodNotFound,t),internal:t=>es(cn.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return es(e,t)},invalidInput:t=>es(cn.rpc.invalidInput,t),resourceNotFound:t=>es(cn.rpc.resourceNotFound,t),resourceUnavailable:t=>es(cn.rpc.resourceUnavailable,t),transactionRejected:t=>es(cn.rpc.transactionRejected,t),methodNotSupported:t=>es(cn.rpc.methodNotSupported,t),limitExceeded:t=>es(cn.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Cu(cn.provider.userRejectedRequest,t),unauthorized:t=>Cu(cn.provider.unauthorized,t),unsupportedMethod:t=>Cu(cn.provider.unsupportedMethod,t),disconnected:t=>Cu(cn.provider.disconnected,t),chainDisconnected:t=>Cu(cn.provider.chainDisconnected,t),unsupportedChain:t=>Cu(cn.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new o5(e,r,n)}}};function es(t,e){const[r,n]=i5(e);return new s5(t,r||O1(t),n)}function Cu(t,e){const[r,n]=i5(e);return new o5(t,r||O1(t),n)}function i5(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}class s5 extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}}class o5 extends s5{constructor(e,r,n){if(!yz(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}function yz(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function L1(){return t=>t}const Ol=L1(),wz=L1(),xz=L1();function Co(t){return Math.floor(t)}const a5=/^[0-9]*$/,c5=/^[a-f0-9]*$/;function lc(t){return k1(crypto.getRandomValues(new Uint8Array(t)))}function k1(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function n0(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function Nl(t,e=!1){const r=t.toString("hex");return Ol(e?`0x${r}`:r)}function B1(t){return Nl(j1(t),!0)}function Js(t){return xz(t.toString(10))}function pa(t){return Ol(`0x${BigInt(t).toString(16)}`)}function u5(t){return t.startsWith("0x")||t.startsWith("0X")}function $1(t){return u5(t)?t.slice(2):t}function f5(t){return u5(t)?`0x${t.slice(2)}`:`0x${t}`}function i0(t){if(typeof t!="string")return!1;const e=$1(t).toLowerCase();return c5.test(e)}function _z(t,e=!1){if(typeof t=="string"){const r=$1(t).toLowerCase();if(c5.test(r))return Ol(e?`0x${r}`:r)}throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function F1(t,e=!1){let r=_z(t,!1);return r.length%2===1&&(r=Ol(`0${r}`)),e?Ol(`0x${r}`):r}function ga(t){if(typeof t=="string"){const e=$1(t).toLowerCase();if(i0(e)&&e.length===40)return wz(f5(e))}throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function j1(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(i0(t)){const e=F1(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Sr.rpc.invalidParams(`Not binary data: ${String(t)}`)}function Ll(t){if(typeof t=="number"&&Number.isInteger(t))return Co(t);if(typeof t=="string"){if(a5.test(t))return Co(Number(t));if(i0(t))return Co(Number(BigInt(F1(t,!0))))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function kl(t){if(t!==null&&(typeof t=="bigint"||Sz(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(Ll(t));if(typeof t=="string"){if(a5.test(t))return BigInt(t);if(i0(t))return BigInt(F1(t,!0))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function Ez(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Sr.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function Sz(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function Az(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function Pz(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Mz(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,new TextEncoder().encode(e));return{iv:r,cipherText:n}}async function Iz(t,{iv:e,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return new TextDecoder().decode(n)}function l5(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function h5(t,e){const r=l5(t),n=await crypto.subtle.exportKey(r,e);return k1(new Uint8Array(n))}async function d5(t,e){const r=l5(t),n=n0(e).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function Cz(t,e){const r=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return Mz(e,r)}async function Tz(t,e){return JSON.parse(await Iz(e,t))}const U1={storageKey:"ownPrivateKey",keyType:"private"},q1={storageKey:"ownPublicKey",keyType:"public"},z1={storageKey:"peerPublicKey",keyType:"public"};class Rz{constructor(){this.storage=new Ys("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(z1,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(q1.storageKey),this.storage.removeItem(U1.storageKey),this.storage.removeItem(z1.storageKey)}async generateKeyPair(){const e=await Az();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(U1,e.privateKey),await this.storeKey(q1,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(U1)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(q1)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(z1)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await Pz(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const r=this.storage.getItem(e.storageKey);return r?d5(e.keyType,r):null}async storeKey(e,r){const n=await h5(e.keyType,r);this.storage.setItem(e.storageKey,n)}}const Bl="4.2.4",p5="@coinbase/wallet-sdk";async function g5(t,e){const r=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":Bl,"X-Cbw-Sdk-Platform":p5}}),{result:i,error:s}=await n.json();if(s)throw s;return i}function Dz(){return globalThis.coinbaseWalletExtension}function Oz(){var t,e;try{const r=globalThis;return(t=r.ethereum)!==null&&t!==void 0?t:(e=r.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Nz({metadata:t,preference:e}){var r,n;const{appName:i,appLogoUrl:s,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const u=Dz();if(u)return(r=u.setAppInfo)===null||r===void 0||r.call(u,i,s,o,e),u}const a=Oz();if(a!=null&&a.isCoinbaseBrowser)return(n=a.setAppInfo)===null||n===void 0||n.call(a,i,s,o,e),a}function Lz(t){if(!t||typeof t!="object"||Array.isArray(t))throw Sr.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:r}=t;if(typeof e!="string"||e.length===0)throw Sr.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Sr.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw Sr.provider.unsupportedMethod()}}const m5="accounts",v5="activeChain",b5="availableChains",y5="walletCapabilities";class kz{constructor(e){var r,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new Rz,this.storage=new Ys("CBWSDK","SCWStateManager"),this.accounts=(r=this.storage.loadObject(m5))!==null&&r!==void 0?r:[],this.chain=this.storage.loadObject(v5)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var r,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(r=e.params)!==null&&r!==void 0?r:{})}}),s=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in s.content)throw s.content.failure;const o=await d5("public",s.sender);await this.keyManager.setPeerPublicKey(o);const u=(await this.decryptResponseMessage(s)).result;if("error"in u)throw u.error;const l=u.value;this.accounts=l,this.storage.storeObject(m5,l),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",l)}async request(e){var r;if(this.accounts.length===0)throw Sr.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:pa(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return pa(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(y5);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var r,n;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const i=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(i)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,r;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(r=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&r!==void 0?r:1}}async handleSwitchChainRequest(e){var r;const n=e.params;if(!n||!(!((r=n[0])===null||r===void 0)&&r.chainId))throw Sr.rpc.invalidParams();const i=Ll(n[0].chainId);if(this.updateChain(i))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(i),o}async sendEncryptedRequest(e){const r=await this.keyManager.getSharedSecret();if(!r)throw Sr.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await Cz({action:e,chainId:this.chain.id},r),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const r=await h5("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:r,content:e,timestamp:new Date}}async decryptResponseMessage(e){var r,n;const i=e.content;if("failure"in i)throw i.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw Sr.provider.unauthorized("Invalid session");const o=await Tz(i.encrypted,s),a=(r=o.data)===null||r===void 0?void 0:r.chains;if(a){const l=Object.entries(a).map(([d,p])=>({id:Number(d),rpcUrl:p}));this.storage.storeObject(b5,l),this.updateChain(this.chain.id,l)}const u=(n=o.data)===null||n===void 0?void 0:n.capabilities;return u&&this.storage.storeObject(y5,u),o}updateChain(e,r){var n;const i=r??this.storage.loadObject(b5),s=i==null?void 0:i.find(o=>o.id===e);return s?(s!==this.chain&&(this.chain=s,this.storage.storeObject(v5,s),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",pa(s.id))),!0):!1}}const Bz=Jp(tM),{keccak_256:$z}=Bz;function w5(t){return Buffer.allocUnsafe(t).fill(0)}function Fz(t){return t.toString(2).length}function x5(t,e){let r=t.toString(16);r.length%2!==0&&(r="0"+r);const n=r.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(r=I5(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(Xs(t,e[s]));if(r==="dynamic"){var o=Xs("uint256",e.length);i.unshift(o)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([Xs("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,si.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Tu(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return si.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Tu(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=hc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+a);if(n<0)throw new Error("Supplied uint is negative");return si.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(r=Tu(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=hc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied int exceeds width: "+r+" vs "+a);const u=si.twosFromBigInt(n,256);return si.bufferBEFromBigInt(u,32)}else if(t.startsWith("ufixed")){if(r=M5(t),n=hc(e),n<0)throw new Error("Supplied ufixed is negative");return Xs("uint256",n*BigInt(2)**BigInt(r[1]))}else if(t.startsWith("fixed"))return r=M5(t),Xs("int256",hc(e)*BigInt(2)**BigInt(r[1]))}throw new Error("Unsupported or invalid type: "+t)}function Wz(t){return t==="string"||t==="bytes"||I5(t)==="dynamic"}function Kz(t){return t.lastIndexOf("]")===t.length-1}function Vz(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var o=P5(t[s]),a=e[s],u=Xs(o,a);Wz(o)?(r.push(Xs("uint256",i)),n.push(u),i+=u.length):r.push(u)}return Buffer.concat(r.concat(n))}function C5(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(si.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=Tu(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=hc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+u);i.push(si.bufferBEFromBigInt(n,r/8))}else if(o.startsWith("int")){if(r=Tu(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=hc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied int exceeds width: "+r+" vs "+u);const l=si.twosFromBigInt(n,r);i.push(si.bufferBEFromBigInt(l,r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function Gz(t,e){return si.keccak(C5(t,e))}var Yz={rawEncode:Vz,solidityPack:C5,soliditySHA3:Gz};const _s=A5,$l=Yz,T5={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},H1={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const o=(a,u,l)=>{if(r[u]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":_s.keccak(this.encodeData(u,l,r,n))];if(l===void 0)throw new Error(`missing value for field ${a} of type ${u}`);if(u==="bytes")return["bytes32",_s.keccak(l)];if(u==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",_s.keccak(l)];if(u.lastIndexOf("]")===u.length-1){const d=u.slice(0,u.lastIndexOf("[")),p=l.map(y=>o(a,d,y));return["bytes32",_s.keccak($l.rawEncode(p.map(([y])=>y),p.map(([,y])=>y)))]}return[u,l]};for(const a of r[t]){const[u,l]=o(a.name,a.type,e[a.name]);i.push(u),s.push(l)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=_s.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=_s.keccak(a),s.push(a);else if(r[o.type]!==void 0)i.push("bytes32"),a=_s.keccak(this.encodeData(o.type,a,r,n)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return $l.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return _s.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return _s.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in T5.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),_s.keccak(Buffer.concat(n))}};var Jz={TYPED_MESSAGE_SCHEMA:T5,TypedDataUtils:H1,hashForSignTypedDataLegacy:function(t){return Xz(t.data)},hashForSignTypedData_v3:function(t){return H1.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return H1.hash(t.data)}};function Xz(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?_s.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return $l.soliditySHA3(["bytes32","bytes32"],[$l.soliditySHA3(new Array(t.length).fill("string"),i),$l.soliditySHA3(n,r)])}const o0=ji(Jz),Zz="walletUsername",W1="Addresses",Qz="AppVersion";function Hn(t){return t.errorMessage!==void 0}class eH{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),a=16,u=o.slice(o.byteLength-a),l=o.slice(0,o.byteLength-a),d=new Uint8Array(u),p=new Uint8Array(l),y=new Uint8Array([...n,...d,...p]);return k1(y)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=n0(e),a=o.slice(0,12),u=o.slice(12,28),l=o.slice(28),d=new Uint8Array([...l,...u]),p={name:"AES-GCM",iv:new Uint8Array(a)};try{const y=await window.crypto.subtle.decrypt(p,s,d),A=new TextDecoder;n(A.decode(y))}catch(y){i(y)}})()})}}class tH{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}var To;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(To||(To={}));class rH{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,To.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.DISCONNECTED)},i.onopen=s=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(u=>this.sendData(u)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const u=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,u)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,To.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const R5=1e4,nH=6e4;class iH{constructor({session:e,linkAPIUrl:r,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Co(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,u)=>{const l=s[u];l!==void 0&&a(l)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,u)},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(Zz,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(Qz,s)},this.handleChainUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(s),l=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(u,l)},this.session=e,this.cipher=new eH(e.secret),this.listener=n;const i=new rH(`${r}/rpc`,WebSocket);i.setConnectionStateListener(async s=>{let o=!1;switch(s){case To.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(u=>setTimeout(u,5e3)),this.destroyed||i.connect().catch(()=>{a()})};a()}break;case To.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},R5),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case To.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(s=>{var o;switch(s.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=s.type==="IsLinkedOK"?s.linked:void 0;this.linked=a||s.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(s.metadata);break}case"Event":{this.handleIncomingEvent(s);break}}s.id!==void 0&&((o=this.requestResolutions.get(s.id))===null||o===void 0||o(s))}),this.ws=i,this.http=new tH(r,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:s,response:o}=i;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s,o)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Co(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>R5*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r={timeout:nH}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r.timeout)}),new Promise(s=>{this.requestResolutions.set(n,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Co(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Co(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id}),!0)}}class sH{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=f5(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}const D5="session:id",O5="session:secret",N5="session:linked";class Ru{constructor(e,r,n,i=!1){this.storage=e,this.id=r,this.secret=n,this.key=NP(Pg(`${r}, ${n} WalletLink`)),this._linked=!!i}static create(e){const r=lc(16),n=lc(32);return new Ru(e,r,n).save()}static load(e){const r=e.getItem(D5),n=e.getItem(N5),i=e.getItem(O5);return r&&i?new Ru(e,r,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(D5,this.id),this.storage.setItem(O5,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(N5,this._linked?"1":"0")}}function oH(){try{return window.frameElement!==null}catch{return!1}}function aH(){try{return oH()&&window.top?window.top.location:window.location}catch{return window.location}}function cH(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function L5(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const uH='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function k5(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(uH)),document.documentElement.appendChild(t)}function B5(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e2&&(o.children=arguments.length>3?a0.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return c0(t,o,n,i,null)}function c0(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++$5,__i:-1,__u:0};return i==null&&Vr.vnode!=null&&Vr.vnode(s),s}function Ul(t){return t.children}function u0(t,e){this.props=t,this.context=e}function Du(t,e){if(e==null)return t.__?Du(t.__,t.__i+1):null;for(var r;ee&&dc.sort(K1));f0.__r=0}function W5(t,e,r,n,i,s,o,a,u,l,d){var p,y,A,P,N,D,k=n&&n.__k||q5,B=e.length;for(u=lH(r,e,k,u),p=0;p0?c0(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,(u=s.__i=hH(s,r,a,p))!==-1&&(p--,(o=r[u])&&(o.__u|=2)),o==null||o.__v===null?(u==-1&&y--,typeof s.type!="function"&&(s.__u|=4)):u!==a&&(u==a-1?y--:u==a+1?y++:(u>a?y--:y++,s.__u|=4))):s=t.__k[i]=null;if(p)for(i=0;i(u!=null&&!(2&u.__u)?1:0))for(;o>=0||a=0){if((u=e[o])&&!(2&u.__u)&&i==u.key&&s===u.type)return o;o--}if(a=r.__.length&&r.__.push({}),r.__[t]}function o4(t){return rv=1,gH(c4,t)}function gH(t,e,r){var n=s4(h0++,2);if(n.t=t,!n.__c&&(n.__=[c4(void 0,e),function(a){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,a);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=un,!un.u)){var i=function(a,u,l){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(y){return!!y.__c});if(d.every(function(y){return!y.__N}))return!s||s.call(this,a,u,l);var p=n.__c.props!==a;return d.forEach(function(y){if(y.__N){var A=y.__[0];y.__=y.__N,y.__N=void 0,A!==y.__[0]&&(p=!0)}}),s&&s.call(this,a,u,l)||p};un.u=!0;var s=un.shouldComponentUpdate,o=un.componentWillUpdate;un.componentWillUpdate=function(a,u,l){if(this.__e){var d=s;s=void 0,i(a,u,l),s=d}o&&o.call(this,a,u,l)},un.shouldComponentUpdate=i}return n.__N||n.__}function mH(t,e){var r=s4(h0++,3);!yn.__s&&yH(r.__H,e)&&(r.__=t,r.i=e,un.__H.__h.push(r))}function vH(){for(var t;t=Z5.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(d0),t.__H.__h.forEach(nv),t.__H.__h=[]}catch(e){t.__H.__h=[],yn.__e(e,t.__v)}}yn.__b=function(t){un=null,Q5&&Q5(t)},yn.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),i4&&i4(t,e)},yn.__r=function(t){e4&&e4(t),h0=0;var e=(un=t.__c).__H;e&&(tv===un?(e.__h=[],un.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(d0),e.__h.forEach(nv),e.__h=[],h0=0)),tv=un},yn.diffed=function(t){t4&&t4(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Z5.push(e)!==1&&X5===yn.requestAnimationFrame||((X5=yn.requestAnimationFrame)||bH)(vH)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),tv=un=null},yn.__c=function(t,e){e.some(function(r){try{r.__h.forEach(d0),r.__h=r.__h.filter(function(n){return!n.__||nv(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],yn.__e(n,r.__v)}}),r4&&r4(t,e)},yn.unmount=function(t){n4&&n4(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{d0(n)}catch(i){e=i}}),r.__H=void 0,e&&yn.__e(e,r.__v))};var a4=typeof requestAnimationFrame=="function";function bH(t){var e,r=function(){clearTimeout(n),a4&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);a4&&(e=requestAnimationFrame(r))}function d0(t){var e=un,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),un=e}function nv(t){var e=un;t.__c=t.__(),un=e}function yH(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function c4(t,e){return typeof e=="function"?e(t):e}const wH=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",xH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",_H="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class EH{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=L5()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const r=this.nextItemKey++;return this.items.set(r,e),this.render(),()=>{this.items.delete(r),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&ev(Or("div",null,Or(u4,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,r])=>Or(SH,Object.assign({},r,{key:e}))))),this.root)}}const u4=t=>Or("div",{class:Fl("-cbwsdk-snackbar-container")},Or("style",null,wH),Or("div",{class:"-cbwsdk-snackbar"},t.children)),SH=({autoExpand:t,message:e,menuItems:r})=>{const[n,i]=o4(!0),[s,o]=o4(t??!1);mH(()=>{const u=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{u.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return Or("div",{class:Fl("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},Or("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},Or("img",{src:xH,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",Or("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),Or("div",{class:"-gear-container"},!s&&Or("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),Or("img",{src:_H,class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&Or("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((u,l)=>Or("div",{class:Fl("-cbwsdk-snackbar-instance-menu-item",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:u.onClick,key:l},Or("svg",{width:u.svgWidth,height:u.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("path",{"fill-rule":u.defaultFillRule,"clip-rule":u.defaultClipRule,d:u.path,fill:"#AAAAAA"})),Or("span",{class:Fl("-cbwsdk-snackbar-instance-menu-item-info",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},u.info)))))};class AH{constructor(){this.attached=!1,this.snackbar=new EH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.snackbar.attach(r),this.attached=!0,k5()}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}}const PH=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class MH{constructor(){this.root=null,this.darkMode=L5()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),k5()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(ev(null,this.root),e&&ev(Or(IH,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const IH=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return Or(u4,{darkMode:r},Or("div",{class:"-cbwsdk-redirect-dialog"},Or("style",null,PH),Or("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),Or("div",{class:Fl("-cbwsdk-redirect-dialog-box",s)},Or("p",null,t),Or("button",{onClick:n},e))))},CH="https://keys.coinbase.com/connect",f4="https://www.walletlink.org",TH="https://go.cb-w.com/walletlink";class l4{constructor(){this.attached=!1,this.redirectDialog=new MH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const r=new URL(TH);r.searchParams.append("redirect_url",aH().href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class Ro{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=cH(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(W1);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!u&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),Ro.accountRequestCallbackIds.size>0&&(Array.from(Ro.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),Ro.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new sH,this.ui=n,this.ui.attach()}subscribe(){const e=Ru.load(this.storage)||Ru.create(this.storage),{linkAPIUrl:r}=this,n=new iH({session:e,linkAPIUrl:r,listener:this}),i=this.isMobileWeb?new l4:new AH;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=Ru.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Ys.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?Js(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?Js(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Nl(e,!0),chainId:r}})}getWalletLinkSession(){return this._session}sendRequest(e){let r=null;const n=lc(8),i=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,s),r==null||r()};return new Promise((s,o)=>{r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,a=>{if(r==null||r(),Hn(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,r){const n={type:"WEB3_REQUEST",id:e,request:r};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:r.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(r.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof l4)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e,r){if(r.method==="requestEthereumAccounts"){Ro.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,r)),Ro.accountRequestCallbackIds.clear();return}this.invokeCallback(e,r)}handleErrorResponse(e,r,n){var i;const s=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:r,errorMessage:s})}invokeCallback(e,r){const n=this.relayEventManager.callbacks.get(e);n&&(n(r),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:r}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:r}},i=lc(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(Hn(a))return o(new Error(a.errorMessage));s(a)}),Ro.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,r,n,i,s,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:o}};let u=null;const l=lc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));p(A)}),this.publishWeb3RequestEvent(l,a)})}addEthereumChain(e,r,n,i,s,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:o}};let u=null;const l=lc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));p(A)}),this.publishWeb3RequestEvent(l,a)})}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})};let i=null;const s=lc(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,u)=>{this.relayEventManager.callbacks.set(s,l=>{if(i==null||i(),Hn(l)&&l.errorCode)return u(Sr.provider.custom({code:l.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(Hn(l))return u(new Error(l.errorMessage));a(l)}),this.publishWeb3RequestEvent(s,n)})}}Ro.accountRequestCallbackIds=new Set;const h4="DefaultChainId",d4="DefaultJsonRpcUrl";class p4{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new Ys("walletlink",f4),this.callback=e.callback||null;const r=this._storage.getItem(W1);if(r){const n=r.split(" ");n[0]!==""&&(this._addresses=n.map(i=>ga(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:r,secret:n}=e.getWalletLinkSession();return{id:r,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(d4))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(d4,e)}updateProviderInfo(e,r){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(h4,r.toString(10)),Ll(r)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",pa(r)))}async watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw Sr.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw Sr.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw Sr.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw Sr.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=r.options,l=await this.initializeRelay().watchAsset(r.type,i,s,a,o,n==null?void 0:n.toString());return Hn(l)?!1:!!l.result}async addEthereumChain(e){var r,n;const i=e[0];if(((r=i.rpcUrls)===null||r===void 0?void 0:r.length)===0)throw Sr.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw Sr.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw Sr.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:u=[],chainName:l,iconUrls:d=[],nativeCurrency:p}=i,y=await o.addEthereumChain(s.toString(),a,d,u,l,p);if(Hn(y))return!1;if(((n=y.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw Sr.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const r=e[0],n=Number.parseInt(r.chainId,16),s=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(Hn(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,r){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(s=>ga(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(W1,i.join(" ")))}async request(e){const r=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return pa(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(r);case"wallet_switchEthereumChain":return this.switchEthereumChain(r);case"wallet_watchAsset":return this.watchAsset(r);default:if(!this.jsonRpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const r=ga(e);if(!this._addresses.map(i=>ga(i)).includes(r))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?ga(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?ga(e.to):null,i=e.value!=null?kl(e.value):BigInt(0),s=e.data?j1(e.data):Buffer.alloc(0),o=e.nonce!=null?Ll(e.nonce):null,a=e.gasPrice!=null?kl(e.gasPrice):null,u=e.maxFeePerGas!=null?kl(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?kl(e.maxPriorityFeePerGas):null,d=e.gas!=null?kl(e.gas):null,p=e.chainId?Ll(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:u,maxPriorityFeePerGas:l,gasLimit:d,chainId:p}}async ecRecover(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:B1(n[0]),signature:B1(n[1]),addPrefix:r==="personal_ecRecover"}});if(Hn(s))throw s;return s.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(h4))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,r;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:pa(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(Hn(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:pa(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw Sr.rpc.invalidParams();const r=e[1],n=e[0];this._ensureKnownAddress(r);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ga(r),message:B1(n),addPrefix:!0,typedDataJson:null}});if(Hn(s))throw s;return s.result}async _eth_signTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(r);if(Hn(i))throw i;return i.result}async _eth_sendRawTransaction(e){const r=j1(e[0]),i=await this.initializeRelay().submitEthereumTransaction(r,this.getChainId());if(Hn(i))throw i;return i.result}async _eth_sendTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(r);if(Hn(i))throw i;return i.result}async signTypedData(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const i=l=>{const d={eth_signTypedData_v1:o0.hashForSignTypedDataLegacy,eth_signTypedData_v3:o0.hashForSignTypedData_v3,eth_signTypedData_v4:o0.hashForSignTypedData_v4,eth_signTypedData:o0.hashForSignTypedData_v4};return Nl(d[r]({data:Ez(l)}),!0)},s=n[r==="eth_signTypedData_v1"?1:0],o=n[r==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const u=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ga(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(Hn(u))throw u;return u.result}initializeRelay(){return this._relay||(this._relay=new Ro({linkAPIUrl:f4,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const g4="SignerType",m4=new Ys("CBWSDK","SignerConfigurator");function RH(){return m4.getItem(g4)}function DH(t){m4.setItem(g4,t)}async function OH(t){const{communicator:e,metadata:r,handshakeRequest:n,callback:i}=t;LH(e,r,i).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:o}=await e.postRequestAndWaitForResponse(s);return o}function NH(t){const{signerType:e,metadata:r,communicator:n,callback:i}=t;switch(e){case"scw":return new kz({metadata:r,callback:i,communicator:n});case"walletlink":return new p4({metadata:r,callback:i})}}async function LH(t,e,r){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new p4({metadata:e,callback:r});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const kH=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. +}`;var fr=WA(function(){return Mr(ne,Nt+"return "+Ze).apply(r,he)});if(fr.source=Ze,ky(fr))throw fr;return fr}function vse(c){return Cr(c).toLowerCase()}function bse(c){return Cr(c).toUpperCase()}function yse(c,h,w){if(c=Cr(c),c&&(w||h===r))return e9(c);if(!c||!(h=ki(h)))return c;var L=Ms(c),K=Ms(h),ne=t9(L,K),he=r9(L,K)+1;return La(L,ne,he).join("")}function wse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.slice(0,i9(c)+1);if(!c||!(h=ki(h)))return c;var L=Ms(c),K=r9(L,Ms(h))+1;return La(L,0,K).join("")}function xse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.replace($,"");if(!c||!(h=ki(h)))return c;var L=Ms(c),K=t9(L,Ms(h));return La(L,K).join("")}function _se(c,h){var w=_e,L=G;if(Qr(h)){var K="separator"in h?h.separator:K;w="length"in h?ur(h.length):w,L="omission"in h?ki(h.omission):L}c=Cr(c);var ne=c.length;if(nf(c)){var he=Ms(c);ne=he.length}if(w>=ne)return c;var me=w-sf(L);if(me<1)return L;var we=he?La(he,0,me).join(""):c.slice(0,me);if(K===r)return we+L;if(he&&(me+=we.length-me),By(K)){if(c.slice(me).search(K)){var We,Ke=we;for(K.global||(K=Qb(K.source,Cr(Re.exec(K))+"g")),K.lastIndex=0;We=K.exec(Ke);)var Ze=We.index;we=we.slice(0,Ze===r?me:Ze)}}else if(c.indexOf(ki(K),me)!=me){var xt=we.lastIndexOf(K);xt>-1&&(we=we.slice(0,xt))}return we+L}function Ese(c){return c=Cr(c),c&&Bt.test(c)?c.replace(Xt,ZQ):c}var Sse=hf(function(c,h,w){return c+(w?" ":"")+h.toUpperCase()}),jy=K9("toUpperCase");function HA(c,h,w){return c=Cr(c),h=w?r:h,h===r?VQ(c)?tee(c):$Q(c):c.match(h)||[]}var WA=hr(function(c,h){try{return $n(c,r,h)}catch(w){return ky(w)?w:new tr(w)}}),Ase=Wo(function(c,h){return ss(h,function(w){w=so(w),zo(c,w,Ny(c[w],c))}),c});function Pse(c){var h=c==null?0:c.length,w=qt();return c=h?Xr(c,function(L){if(typeof L[1]!="function")throw new os(o);return[w(L[0]),L[1]]}):[],hr(function(L){for(var K=-1;++K_)return[];var w=M,L=ei(c,M);h=qt(h),c-=M;for(var K=Jb(L,h);++w0||h<0)?new xr(w):(c<0?w=w.takeRight(-c):c&&(w=w.drop(c)),h!==r&&(h=ur(h),w=h<0?w.dropRight(-h):w.take(h-c)),w)},xr.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},xr.prototype.toArray=function(){return this.take(M)},no(xr.prototype,function(c,h){var w=/^(?:filter|find|map|reject)|While$/.test(h),L=/^(?:head|last)$/.test(h),K=re[L?"take"+(h=="last"?"Right":""):h],ne=L||/^find/.test(h);K&&(re.prototype[h]=function(){var he=this.__wrapped__,me=L?[1]:arguments,we=he instanceof xr,We=me[0],Ke=we||sr(he),Ze=function(br){var Er=K.apply(re,Ca([br],me));return L&&xt?Er[0]:Er};Ke&&w&&typeof We=="function"&&We.length!=1&&(we=Ke=!1);var xt=this.__chain__,Nt=!!this.__actions__.length,Vt=ne&&!xt,fr=we&&!Nt;if(!ne&&Ke){he=fr?he:new xr(this);var Gt=c.apply(he,me);return Gt.__actions__.push({func:qp,args:[Ze],thisArg:r}),new as(Gt,xt)}return Vt&&fr?c.apply(this,me):(Gt=this.thru(Ze),Vt?L?Gt.value()[0]:Gt.value():Gt)})}),ss(["pop","push","shift","sort","splice","unshift"],function(c){var h=pp[c],w=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",L=/^(?:pop|shift)$/.test(c);re.prototype[c]=function(){var K=arguments;if(L&&!this.__chain__){var ne=this.value();return h.apply(sr(ne)?ne:[],K)}return this[w](function(he){return h.apply(sr(he)?he:[],K)})}}),no(xr.prototype,function(c,h){var w=re[h];if(w){var L=w.name+"";Tr.call(uf,L)||(uf[L]=[]),uf[L].push({name:h,func:w})}}),uf[Lp(r,k).name]=[{name:"wrapper",func:r}],xr.prototype.clone=Eee,xr.prototype.reverse=See,xr.prototype.value=Aee,re.prototype.at=ene,re.prototype.chain=tne,re.prototype.commit=rne,re.prototype.next=nne,re.prototype.plant=sne,re.prototype.reverse=one,re.prototype.toJSON=re.prototype.valueOf=re.prototype.value=ane,re.prototype.first=re.prototype.head,bh&&(re.prototype[bh]=ine),re},of=ree();gn?((gn.exports=of)._=of,Ur._=of):_r._=of}).call(nn)}(e0,e0.exports);var Pq=e0.exports,P1={exports:{}};(function(t,e){var r=typeof self<"u"?self:nn,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function u(f){return f&&DataView.prototype.isPrototypeOf(f)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(f){return f&&l.indexOf(Object.prototype.toString.call(f))>-1};function p(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function y(f){return typeof f!="string"&&(f=String(f)),f}function A(f){var g={next:function(){var v=f.shift();return{done:v===void 0,value:v}}};return a.iterable&&(g[Symbol.iterator]=function(){return g}),g}function P(f){this.map={},f instanceof P?f.forEach(function(g,v){this.append(v,g)},this):Array.isArray(f)?f.forEach(function(g){this.append(g[0],g[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(g){this.append(g,f[g])},this)}P.prototype.append=function(f,g){f=p(f),g=y(g);var v=this.map[f];this.map[f]=v?v+", "+g:g},P.prototype.delete=function(f){delete this.map[p(f)]},P.prototype.get=function(f){return f=p(f),this.has(f)?this.map[f]:null},P.prototype.has=function(f){return this.map.hasOwnProperty(p(f))},P.prototype.set=function(f,g){this.map[p(f)]=y(g)},P.prototype.forEach=function(f,g){for(var v in this.map)this.map.hasOwnProperty(v)&&f.call(g,this.map[v],v,this)},P.prototype.keys=function(){var f=[];return this.forEach(function(g,v){f.push(v)}),A(f)},P.prototype.values=function(){var f=[];return this.forEach(function(g){f.push(g)}),A(f)},P.prototype.entries=function(){var f=[];return this.forEach(function(g,v){f.push([v,g])}),A(f)},a.iterable&&(P.prototype[Symbol.iterator]=P.prototype.entries);function N(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function D(f){return new Promise(function(g,v){f.onload=function(){g(f.result)},f.onerror=function(){v(f.error)}})}function k(f){var g=new FileReader,v=D(g);return g.readAsArrayBuffer(f),v}function B(f){var g=new FileReader,v=D(g);return g.readAsText(f),v}function q(f){for(var g=new Uint8Array(f),v=new Array(g.length),x=0;x-1?g:f}function z(f,g){g=g||{};var v=g.body;if(f instanceof z){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,g.headers||(this.headers=new P(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!v&&f._bodyInit!=null&&(v=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=g.credentials||this.credentials||"same-origin",(g.headers||!this.headers)&&(this.headers=new P(g.headers)),this.method=T(g.method||this.method||"GET"),this.mode=g.mode||this.mode||null,this.signal=g.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(v)}z.prototype.clone=function(){return new z(this,{body:this._bodyInit})};function ue(f){var g=new FormData;return f.trim().split("&").forEach(function(v){if(v){var x=v.split("="),_=x.shift().replace(/\+/g," "),S=x.join("=").replace(/\+/g," ");g.append(decodeURIComponent(_),decodeURIComponent(S))}}),g}function _e(f){var g=new P,v=f.replace(/\r?\n[\t ]+/g," ");return v.split(/\r?\n/).forEach(function(x){var _=x.split(":"),S=_.shift().trim();if(S){var b=_.join(":").trim();g.append(S,b)}}),g}H.call(z.prototype);function G(f,g){g||(g={}),this.type="default",this.status=g.status===void 0?200:g.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in g?g.statusText:"OK",this.headers=new P(g.headers),this.url=g.url||"",this._initBody(f)}H.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new P(this.headers),url:this.url})},G.error=function(){var f=new G(null,{status:0,statusText:""});return f.type="error",f};var E=[301,302,303,307,308];G.redirect=function(f,g){if(E.indexOf(g)===-1)throw new RangeError("Invalid status code");return new G(null,{status:g,headers:{location:f}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(g,v){this.message=g,this.name=v;var x=Error(g);this.stack=x.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function m(f,g){return new Promise(function(v,x){var _=new z(f,g);if(_.signal&&_.signal.aborted)return x(new o.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function b(){S.abort()}S.onload=function(){var M={status:S.status,statusText:S.statusText,headers:_e(S.getAllResponseHeaders()||"")};M.url="responseURL"in S?S.responseURL:M.headers.get("X-Request-URL");var I="response"in S?S.response:S.responseText;v(new G(I,M))},S.onerror=function(){x(new TypeError("Network request failed"))},S.ontimeout=function(){x(new TypeError("Network request failed"))},S.onabort=function(){x(new o.DOMException("Aborted","AbortError"))},S.open(_.method,_.url,!0),_.credentials==="include"?S.withCredentials=!0:_.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&a.blob&&(S.responseType="blob"),_.headers.forEach(function(M,I){S.setRequestHeader(I,M)}),_.signal&&(_.signal.addEventListener("abort",b),S.onreadystatechange=function(){S.readyState===4&&_.signal.removeEventListener("abort",b)}),S.send(typeof _._bodyInit>"u"?null:_._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=P,s.Request=z,s.Response=G),o.Headers=P,o.Request=z,o.Response=G,o.fetch=m,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(P1,P1.exports);var Mq=P1.exports;const O6=ji(Mq);var Iq=Object.defineProperty,Cq=Object.defineProperties,Tq=Object.getOwnPropertyDescriptors,N6=Object.getOwnPropertySymbols,Rq=Object.prototype.hasOwnProperty,Dq=Object.prototype.propertyIsEnumerable,L6=(t,e,r)=>e in t?Iq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,k6=(t,e)=>{for(var r in e||(e={}))Rq.call(e,r)&&L6(t,r,e[r]);if(N6)for(var r of N6(e))Dq.call(e,r)&&L6(t,r,e[r]);return t},B6=(t,e)=>Cq(t,Tq(e));const Oq={Accept:"application/json","Content-Type":"application/json"},Nq="POST",$6={headers:Oq,method:Nq},F6=10;let xs=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new qi.EventEmitter,this.isAvailable=!1,this.registering=!1,!$_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=mo(e),n=await(await O6(this.url,B6(k6({},$6),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!$_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=mo({id:1,jsonrpc:"2.0",method:"test",params:[]});await O6(e,B6(k6({},$6),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ka(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return O_(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>F6&&this.events.setMaxListeners(F6)}};const j6="error",Lq="wss://relay.walletconnect.org",kq="wc",Bq="universal_provider",U6=`${kq}@2:${Bq}:`,q6="https://rpc.walletconnect.org/v1/",Cu="generic",$q=`${q6}bundler`,Qi={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Fq=Object.defineProperty,jq=Object.defineProperties,Uq=Object.getOwnPropertyDescriptors,z6=Object.getOwnPropertySymbols,qq=Object.prototype.hasOwnProperty,zq=Object.prototype.propertyIsEnumerable,H6=(t,e,r)=>e in t?Fq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,t0=(t,e)=>{for(var r in e||(e={}))qq.call(e,r)&&H6(t,r,e[r]);if(z6)for(var r of z6(e))zq.call(e,r)&&H6(t,r,e[r]);return t},Hq=(t,e)=>jq(t,Uq(e));function Di(t,e,r){var n;const i=Su(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${q6}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function fc(t){return t.includes(":")?t.split(":")[1]:t}function W6(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Wq(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function M1(t={},e={}){const r=K6(t),n=K6(e);return Pq.merge(r,n)}function K6(t){var e,r,n,i;const s={};if(!Sl(t))return s;for(const[o,a]of Object.entries(t)){const u=f1(o)?[o]:a.chains,l=a.methods||[],d=a.events||[],p=a.rpcMap||{},y=El(o);s[y]=Hq(t0(t0({},s[y]),a),{chains:Ud(u,(e=s[y])==null?void 0:e.chains),methods:Ud(l,(r=s[y])==null?void 0:r.methods),events:Ud(d,(n=s[y])==null?void 0:n.events),rpcMap:t0(t0({},p),(i=s[y])==null?void 0:i.rpcMap)})}return s}function Kq(t){return t.includes(":")?t.split(":")[2]:t}function V6(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=f1(r)?[r]:n.chains?n.chains:W6(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function I1(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const G6={},Ar=t=>G6[t],C1=(t,e)=>{G6[t]=e};class Vq{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}var Gq=Object.defineProperty,Yq=Object.defineProperties,Jq=Object.getOwnPropertyDescriptors,Y6=Object.getOwnPropertySymbols,Xq=Object.prototype.hasOwnProperty,Zq=Object.prototype.propertyIsEnumerable,J6=(t,e,r)=>e in t?Gq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,X6=(t,e)=>{for(var r in e||(e={}))Xq.call(e,r)&&J6(t,r,e[r]);if(Y6)for(var r of Y6(e))Zq.call(e,r)&&J6(t,r,e[r]);return t},Z6=(t,e)=>Yq(t,Jq(e));class Qq{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(fc(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const u=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:Z6(X6({},o.sessionProperties||{}),{capabilities:Z6(X6({},a||{}),{[s]:u})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return u}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(da("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${$q}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class ez{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}let tz=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}},rz=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ji(new xs(n,Ar("disableProviderPing")))}},nz=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=fc(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}},iz=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}};class sz{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}let oz=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new xs(n,Ar("disableProviderPing")))}};class az{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new xs(n))}}class cz{constructor(e){this.name=Cu,this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=Su(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}var uz=Object.defineProperty,fz=Object.defineProperties,lz=Object.getOwnPropertyDescriptors,Q6=Object.getOwnPropertySymbols,hz=Object.prototype.hasOwnProperty,dz=Object.prototype.propertyIsEnumerable,e5=(t,e,r)=>e in t?uz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,r0=(t,e)=>{for(var r in e||(e={}))hz.call(e,r)&&e5(t,r,e[r]);if(Q6)for(var r of Q6(e))dz.call(e,r)&&e5(t,r,e[r]);return t},T1=(t,e)=>fz(t,lz(e));let R1=class YA{constructor(e){this.events=new Yg,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||j6})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new YA(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:r0({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,Vd(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Dr("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=V6(this.session.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=V6(s.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==T6)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Cu?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(ic(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await A1.init({core:this.providerOpts.core,logger:this.providerOpts.logger||j6,relayUrl:this.providerOpts.relayUrl||Lq,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>El(r)))];C1("client",this.client),C1("events",this.events),C1("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Wq(r,this.session),i=W6(n),s=M1(this.namespaces,this.optionalNamespaces),o=T1(r0({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new Qq({namespace:o});break;case"algorand":this.rpcProviders[r]=new rz({namespace:o});break;case"solana":this.rpcProviders[r]=new ez({namespace:o});break;case"cosmos":this.rpcProviders[r]=new tz({namespace:o});break;case"polkadot":this.rpcProviders[r]=new Vq({namespace:o});break;case"cip34":this.rpcProviders[r]=new nz({namespace:o});break;case"elrond":this.rpcProviders[r]=new iz({namespace:o});break;case"multiversx":this.rpcProviders[r]=new sz({namespace:o});break;case"near":this.rpcProviders[r]=new oz({namespace:o});break;case"tezos":this.rpcProviders[r]=new az({namespace:o});break;default:this.rpcProviders[Cu]?this.rpcProviders[Cu].updateNamespace(o):this.rpcProviders[Cu]=new cz({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&ic(i)&&this.events.emit("accountsChanged",i.map(Kq))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=El(i),a=I1(i)!==I1(s)?`${o}:${I1(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=T1(r0({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",T1(r0({},Dr("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Qi.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Cu]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>El(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=El(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${U6}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${U6}/${e}`)}};const pz=R1;function gz(){return new Promise(t=>{const e=[];let r;window.addEventListener("eip6963:announceProvider",n=>{const{detail:i}=n;r&&clearTimeout(r),e.push(i),r=setTimeout(()=>t(e),200)}),r=setTimeout(()=>t(e),200),window.dispatchEvent(new Event("eip6963:requestProvider"))})}class Ys{constructor(e,r){this.scope=e,this.module=r}storeObject(e,r){this.setItem(e,JSON.stringify(r))}loadObject(e){const r=this.getItem(e);return r?JSON.parse(r):void 0}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new Ys("CBWSDK").clear(),new Ys("walletlink").clear()}}const cn={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},D1={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},t5="Unspecified error message.",mz="Unspecified server error.";function O1(t,e=t5){if(t&&Number.isInteger(t)){const r=t.toString();if(N1(D1,r))return D1[r].message;if(r5(t))return mz}return e}function vz(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(D1[e]||r5(t))}function bz(t,{shouldIncludeStack:e=!1}={}){const r={};if(t&&typeof t=="object"&&!Array.isArray(t)&&N1(t,"code")&&vz(t.code)){const n=t;r.code=n.code,n.message&&typeof n.message=="string"?(r.message=n.message,N1(n,"data")&&(r.data=n.data)):(r.message=O1(r.code),r.data={originalError:n5(t)})}else r.code=cn.rpc.internal,r.message=i5(t,"message")?t.message:t5,r.data={originalError:n5(t)};return e&&(r.stack=i5(t,"stack")?t.stack:void 0),r}function r5(t){return t>=-32099&&t<=-32e3}function n5(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function N1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function i5(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const Sr={rpc:{parse:t=>es(cn.rpc.parse,t),invalidRequest:t=>es(cn.rpc.invalidRequest,t),invalidParams:t=>es(cn.rpc.invalidParams,t),methodNotFound:t=>es(cn.rpc.methodNotFound,t),internal:t=>es(cn.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return es(e,t)},invalidInput:t=>es(cn.rpc.invalidInput,t),resourceNotFound:t=>es(cn.rpc.resourceNotFound,t),resourceUnavailable:t=>es(cn.rpc.resourceUnavailable,t),transactionRejected:t=>es(cn.rpc.transactionRejected,t),methodNotSupported:t=>es(cn.rpc.methodNotSupported,t),limitExceeded:t=>es(cn.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Tu(cn.provider.userRejectedRequest,t),unauthorized:t=>Tu(cn.provider.unauthorized,t),unsupportedMethod:t=>Tu(cn.provider.unsupportedMethod,t),disconnected:t=>Tu(cn.provider.disconnected,t),chainDisconnected:t=>Tu(cn.provider.chainDisconnected,t),unsupportedChain:t=>Tu(cn.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new a5(e,r,n)}}};function es(t,e){const[r,n]=s5(e);return new o5(t,r||O1(t),n)}function Tu(t,e){const[r,n]=s5(e);return new a5(t,r||O1(t),n)}function s5(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}class o5 extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}}class a5 extends o5{constructor(e,r,n){if(!yz(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}function yz(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function L1(){return t=>t}const Ol=L1(),wz=L1(),xz=L1();function Co(t){return Math.floor(t)}const c5=/^[0-9]*$/,u5=/^[a-f0-9]*$/;function lc(t){return k1(crypto.getRandomValues(new Uint8Array(t)))}function k1(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function n0(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function Nl(t,e=!1){const r=t.toString("hex");return Ol(e?`0x${r}`:r)}function B1(t){return Nl(j1(t),!0)}function Js(t){return xz(t.toString(10))}function pa(t){return Ol(`0x${BigInt(t).toString(16)}`)}function f5(t){return t.startsWith("0x")||t.startsWith("0X")}function $1(t){return f5(t)?t.slice(2):t}function l5(t){return f5(t)?`0x${t.slice(2)}`:`0x${t}`}function i0(t){if(typeof t!="string")return!1;const e=$1(t).toLowerCase();return u5.test(e)}function _z(t,e=!1){if(typeof t=="string"){const r=$1(t).toLowerCase();if(u5.test(r))return Ol(e?`0x${r}`:r)}throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function F1(t,e=!1){let r=_z(t,!1);return r.length%2===1&&(r=Ol(`0${r}`)),e?Ol(`0x${r}`):r}function ga(t){if(typeof t=="string"){const e=$1(t).toLowerCase();if(i0(e)&&e.length===40)return wz(l5(e))}throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function j1(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(i0(t)){const e=F1(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Sr.rpc.invalidParams(`Not binary data: ${String(t)}`)}function Ll(t){if(typeof t=="number"&&Number.isInteger(t))return Co(t);if(typeof t=="string"){if(c5.test(t))return Co(Number(t));if(i0(t))return Co(Number(BigInt(F1(t,!0))))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function kl(t){if(t!==null&&(typeof t=="bigint"||Sz(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(Ll(t));if(typeof t=="string"){if(c5.test(t))return BigInt(t);if(i0(t))return BigInt(F1(t,!0))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function Ez(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Sr.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function Sz(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function Az(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function Pz(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Mz(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,new TextEncoder().encode(e));return{iv:r,cipherText:n}}async function Iz(t,{iv:e,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return new TextDecoder().decode(n)}function h5(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function d5(t,e){const r=h5(t),n=await crypto.subtle.exportKey(r,e);return k1(new Uint8Array(n))}async function p5(t,e){const r=h5(t),n=n0(e).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function Cz(t,e){const r=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return Mz(e,r)}async function Tz(t,e){return JSON.parse(await Iz(e,t))}const U1={storageKey:"ownPrivateKey",keyType:"private"},q1={storageKey:"ownPublicKey",keyType:"public"},z1={storageKey:"peerPublicKey",keyType:"public"};class Rz{constructor(){this.storage=new Ys("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(z1,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(q1.storageKey),this.storage.removeItem(U1.storageKey),this.storage.removeItem(z1.storageKey)}async generateKeyPair(){const e=await Az();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(U1,e.privateKey),await this.storeKey(q1,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(U1)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(q1)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(z1)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await Pz(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const r=this.storage.getItem(e.storageKey);return r?p5(e.keyType,r):null}async storeKey(e,r){const n=await d5(e.keyType,r);this.storage.setItem(e.storageKey,n)}}const Bl="4.2.4",g5="@coinbase/wallet-sdk";async function m5(t,e){const r=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":Bl,"X-Cbw-Sdk-Platform":g5}}),{result:i,error:s}=await n.json();if(s)throw s;return i}function Dz(){return globalThis.coinbaseWalletExtension}function Oz(){var t,e;try{const r=globalThis;return(t=r.ethereum)!==null&&t!==void 0?t:(e=r.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Nz({metadata:t,preference:e}){var r,n;const{appName:i,appLogoUrl:s,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const u=Dz();if(u)return(r=u.setAppInfo)===null||r===void 0||r.call(u,i,s,o,e),u}const a=Oz();if(a!=null&&a.isCoinbaseBrowser)return(n=a.setAppInfo)===null||n===void 0||n.call(a,i,s,o,e),a}function Lz(t){if(!t||typeof t!="object"||Array.isArray(t))throw Sr.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:r}=t;if(typeof e!="string"||e.length===0)throw Sr.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Sr.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw Sr.provider.unsupportedMethod()}}const v5="accounts",b5="activeChain",y5="availableChains",w5="walletCapabilities";class kz{constructor(e){var r,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new Rz,this.storage=new Ys("CBWSDK","SCWStateManager"),this.accounts=(r=this.storage.loadObject(v5))!==null&&r!==void 0?r:[],this.chain=this.storage.loadObject(b5)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var r,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(r=e.params)!==null&&r!==void 0?r:{})}}),s=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in s.content)throw s.content.failure;const o=await p5("public",s.sender);await this.keyManager.setPeerPublicKey(o);const u=(await this.decryptResponseMessage(s)).result;if("error"in u)throw u.error;const l=u.value;this.accounts=l,this.storage.storeObject(v5,l),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",l)}async request(e){var r;if(this.accounts.length===0)throw Sr.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:pa(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return pa(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(w5);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return m5(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var r,n;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const i=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(i)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,r;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(r=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&r!==void 0?r:1}}async handleSwitchChainRequest(e){var r;const n=e.params;if(!n||!(!((r=n[0])===null||r===void 0)&&r.chainId))throw Sr.rpc.invalidParams();const i=Ll(n[0].chainId);if(this.updateChain(i))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(i),o}async sendEncryptedRequest(e){const r=await this.keyManager.getSharedSecret();if(!r)throw Sr.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await Cz({action:e,chainId:this.chain.id},r),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const r=await d5("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:r,content:e,timestamp:new Date}}async decryptResponseMessage(e){var r,n;const i=e.content;if("failure"in i)throw i.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw Sr.provider.unauthorized("Invalid session");const o=await Tz(i.encrypted,s),a=(r=o.data)===null||r===void 0?void 0:r.chains;if(a){const l=Object.entries(a).map(([d,p])=>({id:Number(d),rpcUrl:p}));this.storage.storeObject(y5,l),this.updateChain(this.chain.id,l)}const u=(n=o.data)===null||n===void 0?void 0:n.capabilities;return u&&this.storage.storeObject(w5,u),o}updateChain(e,r){var n;const i=r??this.storage.loadObject(y5),s=i==null?void 0:i.find(o=>o.id===e);return s?(s!==this.chain&&(this.chain=s,this.storage.storeObject(b5,s),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",pa(s.id))),!0):!1}}const Bz=Jp(tM),{keccak_256:$z}=Bz;function x5(t){return Buffer.allocUnsafe(t).fill(0)}function Fz(t){return t.toString(2).length}function _5(t,e){let r=t.toString(16);r.length%2!==0&&(r="0"+r);const n=r.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(r=C5(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(Xs(t,e[s]));if(r==="dynamic"){var o=Xs("uint256",e.length);i.unshift(o)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([Xs("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,si.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Ru(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return si.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Ru(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=hc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+a);if(n<0)throw new Error("Supplied uint is negative");return si.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(r=Ru(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=hc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied int exceeds width: "+r+" vs "+a);const u=si.twosFromBigInt(n,256);return si.bufferBEFromBigInt(u,32)}else if(t.startsWith("ufixed")){if(r=I5(t),n=hc(e),n<0)throw new Error("Supplied ufixed is negative");return Xs("uint256",n*BigInt(2)**BigInt(r[1]))}else if(t.startsWith("fixed"))return r=I5(t),Xs("int256",hc(e)*BigInt(2)**BigInt(r[1]))}throw new Error("Unsupported or invalid type: "+t)}function Wz(t){return t==="string"||t==="bytes"||C5(t)==="dynamic"}function Kz(t){return t.lastIndexOf("]")===t.length-1}function Vz(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var o=M5(t[s]),a=e[s],u=Xs(o,a);Wz(o)?(r.push(Xs("uint256",i)),n.push(u),i+=u.length):r.push(u)}return Buffer.concat(r.concat(n))}function T5(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(si.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=Ru(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=hc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+u);i.push(si.bufferBEFromBigInt(n,r/8))}else if(o.startsWith("int")){if(r=Ru(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=hc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied int exceeds width: "+r+" vs "+u);const l=si.twosFromBigInt(n,r);i.push(si.bufferBEFromBigInt(l,r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function Gz(t,e){return si.keccak(T5(t,e))}var Yz={rawEncode:Vz,solidityPack:T5,soliditySHA3:Gz};const _s=P5,$l=Yz,R5={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},H1={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const o=(a,u,l)=>{if(r[u]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":_s.keccak(this.encodeData(u,l,r,n))];if(l===void 0)throw new Error(`missing value for field ${a} of type ${u}`);if(u==="bytes")return["bytes32",_s.keccak(l)];if(u==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",_s.keccak(l)];if(u.lastIndexOf("]")===u.length-1){const d=u.slice(0,u.lastIndexOf("[")),p=l.map(y=>o(a,d,y));return["bytes32",_s.keccak($l.rawEncode(p.map(([y])=>y),p.map(([,y])=>y)))]}return[u,l]};for(const a of r[t]){const[u,l]=o(a.name,a.type,e[a.name]);i.push(u),s.push(l)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=_s.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=_s.keccak(a),s.push(a);else if(r[o.type]!==void 0)i.push("bytes32"),a=_s.keccak(this.encodeData(o.type,a,r,n)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return $l.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return _s.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return _s.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in R5.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),_s.keccak(Buffer.concat(n))}};var Jz={TYPED_MESSAGE_SCHEMA:R5,TypedDataUtils:H1,hashForSignTypedDataLegacy:function(t){return Xz(t.data)},hashForSignTypedData_v3:function(t){return H1.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return H1.hash(t.data)}};function Xz(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?_s.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return $l.soliditySHA3(["bytes32","bytes32"],[$l.soliditySHA3(new Array(t.length).fill("string"),i),$l.soliditySHA3(n,r)])}const o0=ji(Jz),Zz="walletUsername",W1="Addresses",Qz="AppVersion";function Hn(t){return t.errorMessage!==void 0}class eH{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),a=16,u=o.slice(o.byteLength-a),l=o.slice(0,o.byteLength-a),d=new Uint8Array(u),p=new Uint8Array(l),y=new Uint8Array([...n,...d,...p]);return k1(y)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=n0(e),a=o.slice(0,12),u=o.slice(12,28),l=o.slice(28),d=new Uint8Array([...l,...u]),p={name:"AES-GCM",iv:new Uint8Array(a)};try{const y=await window.crypto.subtle.decrypt(p,s,d),A=new TextDecoder;n(A.decode(y))}catch(y){i(y)}})()})}}class tH{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}var To;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(To||(To={}));class rH{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,To.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.DISCONNECTED)},i.onopen=s=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(u=>this.sendData(u)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const u=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,u)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,To.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const D5=1e4,nH=6e4;class iH{constructor({session:e,linkAPIUrl:r,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Co(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,u)=>{const l=s[u];l!==void 0&&a(l)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,u)},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(Zz,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(Qz,s)},this.handleChainUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(s),l=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(u,l)},this.session=e,this.cipher=new eH(e.secret),this.listener=n;const i=new rH(`${r}/rpc`,WebSocket);i.setConnectionStateListener(async s=>{let o=!1;switch(s){case To.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(u=>setTimeout(u,5e3)),this.destroyed||i.connect().catch(()=>{a()})};a()}break;case To.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},D5),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case To.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(s=>{var o;switch(s.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=s.type==="IsLinkedOK"?s.linked:void 0;this.linked=a||s.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(s.metadata);break}case"Event":{this.handleIncomingEvent(s);break}}s.id!==void 0&&((o=this.requestResolutions.get(s.id))===null||o===void 0||o(s))}),this.ws=i,this.http=new tH(r,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:s,response:o}=i;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s,o)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Co(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>D5*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r={timeout:nH}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r.timeout)}),new Promise(s=>{this.requestResolutions.set(n,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Co(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Co(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id}),!0)}}class sH{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=l5(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}const O5="session:id",N5="session:secret",L5="session:linked";class Du{constructor(e,r,n,i=!1){this.storage=e,this.id=r,this.secret=n,this.key=NP(Pg(`${r}, ${n} WalletLink`)),this._linked=!!i}static create(e){const r=lc(16),n=lc(32);return new Du(e,r,n).save()}static load(e){const r=e.getItem(O5),n=e.getItem(L5),i=e.getItem(N5);return r&&i?new Du(e,r,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(O5,this.id),this.storage.setItem(N5,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(L5,this._linked?"1":"0")}}function oH(){try{return window.frameElement!==null}catch{return!1}}function aH(){try{return oH()&&window.top?window.top.location:window.location}catch{return window.location}}function cH(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function k5(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const uH='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function B5(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(uH)),document.documentElement.appendChild(t)}function $5(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e2&&(o.children=arguments.length>3?a0.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return c0(t,o,n,i,null)}function c0(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++F5,__i:-1,__u:0};return i==null&&Vr.vnode!=null&&Vr.vnode(s),s}function Ul(t){return t.children}function u0(t,e){this.props=t,this.context=e}function Ou(t,e){if(e==null)return t.__?Ou(t.__,t.__i+1):null;for(var r;ee&&dc.sort(K1));f0.__r=0}function K5(t,e,r,n,i,s,o,a,u,l,d){var p,y,A,P,N,D,k=n&&n.__k||z5,B=e.length;for(u=lH(r,e,k,u),p=0;p0?c0(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,(u=s.__i=hH(s,r,a,p))!==-1&&(p--,(o=r[u])&&(o.__u|=2)),o==null||o.__v===null?(u==-1&&y--,typeof s.type!="function"&&(s.__u|=4)):u!==a&&(u==a-1?y--:u==a+1?y++:(u>a?y--:y++,s.__u|=4))):s=t.__k[i]=null;if(p)for(i=0;i(u!=null&&!(2&u.__u)?1:0))for(;o>=0||a=0){if((u=e[o])&&!(2&u.__u)&&i==u.key&&s===u.type)return o;o--}if(a=r.__.length&&r.__.push({}),r.__[t]}function a4(t){return rv=1,gH(u4,t)}function gH(t,e,r){var n=o4(h0++,2);if(n.t=t,!n.__c&&(n.__=[u4(void 0,e),function(a){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,a);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=un,!un.u)){var i=function(a,u,l){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(y){return!!y.__c});if(d.every(function(y){return!y.__N}))return!s||s.call(this,a,u,l);var p=n.__c.props!==a;return d.forEach(function(y){if(y.__N){var A=y.__[0];y.__=y.__N,y.__N=void 0,A!==y.__[0]&&(p=!0)}}),s&&s.call(this,a,u,l)||p};un.u=!0;var s=un.shouldComponentUpdate,o=un.componentWillUpdate;un.componentWillUpdate=function(a,u,l){if(this.__e){var d=s;s=void 0,i(a,u,l),s=d}o&&o.call(this,a,u,l)},un.shouldComponentUpdate=i}return n.__N||n.__}function mH(t,e){var r=o4(h0++,3);!yn.__s&&yH(r.__H,e)&&(r.__=t,r.i=e,un.__H.__h.push(r))}function vH(){for(var t;t=Q5.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(d0),t.__H.__h.forEach(nv),t.__H.__h=[]}catch(e){t.__H.__h=[],yn.__e(e,t.__v)}}yn.__b=function(t){un=null,e4&&e4(t)},yn.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),s4&&s4(t,e)},yn.__r=function(t){t4&&t4(t),h0=0;var e=(un=t.__c).__H;e&&(tv===un?(e.__h=[],un.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(d0),e.__h.forEach(nv),e.__h=[],h0=0)),tv=un},yn.diffed=function(t){r4&&r4(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Q5.push(e)!==1&&Z5===yn.requestAnimationFrame||((Z5=yn.requestAnimationFrame)||bH)(vH)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),tv=un=null},yn.__c=function(t,e){e.some(function(r){try{r.__h.forEach(d0),r.__h=r.__h.filter(function(n){return!n.__||nv(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],yn.__e(n,r.__v)}}),n4&&n4(t,e)},yn.unmount=function(t){i4&&i4(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{d0(n)}catch(i){e=i}}),r.__H=void 0,e&&yn.__e(e,r.__v))};var c4=typeof requestAnimationFrame=="function";function bH(t){var e,r=function(){clearTimeout(n),c4&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);c4&&(e=requestAnimationFrame(r))}function d0(t){var e=un,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),un=e}function nv(t){var e=un;t.__c=t.__(),un=e}function yH(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function u4(t,e){return typeof e=="function"?e(t):e}const wH=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",xH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",_H="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class EH{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=k5()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const r=this.nextItemKey++;return this.items.set(r,e),this.render(),()=>{this.items.delete(r),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&ev(Or("div",null,Or(f4,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,r])=>Or(SH,Object.assign({},r,{key:e}))))),this.root)}}const f4=t=>Or("div",{class:Fl("-cbwsdk-snackbar-container")},Or("style",null,wH),Or("div",{class:"-cbwsdk-snackbar"},t.children)),SH=({autoExpand:t,message:e,menuItems:r})=>{const[n,i]=a4(!0),[s,o]=a4(t??!1);mH(()=>{const u=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{u.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return Or("div",{class:Fl("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},Or("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},Or("img",{src:xH,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",Or("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),Or("div",{class:"-gear-container"},!s&&Or("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),Or("img",{src:_H,class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&Or("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((u,l)=>Or("div",{class:Fl("-cbwsdk-snackbar-instance-menu-item",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:u.onClick,key:l},Or("svg",{width:u.svgWidth,height:u.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("path",{"fill-rule":u.defaultFillRule,"clip-rule":u.defaultClipRule,d:u.path,fill:"#AAAAAA"})),Or("span",{class:Fl("-cbwsdk-snackbar-instance-menu-item-info",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},u.info)))))};class AH{constructor(){this.attached=!1,this.snackbar=new EH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.snackbar.attach(r),this.attached=!0,B5()}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}}const PH=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class MH{constructor(){this.root=null,this.darkMode=k5()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),B5()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(ev(null,this.root),e&&ev(Or(IH,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const IH=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return Or(f4,{darkMode:r},Or("div",{class:"-cbwsdk-redirect-dialog"},Or("style",null,PH),Or("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),Or("div",{class:Fl("-cbwsdk-redirect-dialog-box",s)},Or("p",null,t),Or("button",{onClick:n},e))))},CH="https://keys.coinbase.com/connect",l4="https://www.walletlink.org",TH="https://go.cb-w.com/walletlink";class h4{constructor(){this.attached=!1,this.redirectDialog=new MH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const r=new URL(TH);r.searchParams.append("redirect_url",aH().href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class Ro{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=cH(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(W1);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!u&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),Ro.accountRequestCallbackIds.size>0&&(Array.from(Ro.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),Ro.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new sH,this.ui=n,this.ui.attach()}subscribe(){const e=Du.load(this.storage)||Du.create(this.storage),{linkAPIUrl:r}=this,n=new iH({session:e,linkAPIUrl:r,listener:this}),i=this.isMobileWeb?new h4:new AH;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=Du.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Ys.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?Js(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?Js(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Nl(e,!0),chainId:r}})}getWalletLinkSession(){return this._session}sendRequest(e){let r=null;const n=lc(8),i=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,s),r==null||r()};return new Promise((s,o)=>{r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,a=>{if(r==null||r(),Hn(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,r){const n={type:"WEB3_REQUEST",id:e,request:r};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:r.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(r.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof h4)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e,r){if(r.method==="requestEthereumAccounts"){Ro.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,r)),Ro.accountRequestCallbackIds.clear();return}this.invokeCallback(e,r)}handleErrorResponse(e,r,n){var i;const s=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:r,errorMessage:s})}invokeCallback(e,r){const n=this.relayEventManager.callbacks.get(e);n&&(n(r),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:r}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:r}},i=lc(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(Hn(a))return o(new Error(a.errorMessage));s(a)}),Ro.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,r,n,i,s,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:o}};let u=null;const l=lc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));p(A)}),this.publishWeb3RequestEvent(l,a)})}addEthereumChain(e,r,n,i,s,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:o}};let u=null;const l=lc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));p(A)}),this.publishWeb3RequestEvent(l,a)})}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})};let i=null;const s=lc(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,u)=>{this.relayEventManager.callbacks.set(s,l=>{if(i==null||i(),Hn(l)&&l.errorCode)return u(Sr.provider.custom({code:l.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(Hn(l))return u(new Error(l.errorMessage));a(l)}),this.publishWeb3RequestEvent(s,n)})}}Ro.accountRequestCallbackIds=new Set;const d4="DefaultChainId",p4="DefaultJsonRpcUrl";class g4{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new Ys("walletlink",l4),this.callback=e.callback||null;const r=this._storage.getItem(W1);if(r){const n=r.split(" ");n[0]!==""&&(this._addresses=n.map(i=>ga(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:r,secret:n}=e.getWalletLinkSession();return{id:r,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(p4))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(p4,e)}updateProviderInfo(e,r){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(d4,r.toString(10)),Ll(r)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",pa(r)))}async watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw Sr.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw Sr.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw Sr.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw Sr.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=r.options,l=await this.initializeRelay().watchAsset(r.type,i,s,a,o,n==null?void 0:n.toString());return Hn(l)?!1:!!l.result}async addEthereumChain(e){var r,n;const i=e[0];if(((r=i.rpcUrls)===null||r===void 0?void 0:r.length)===0)throw Sr.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw Sr.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw Sr.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:u=[],chainName:l,iconUrls:d=[],nativeCurrency:p}=i,y=await o.addEthereumChain(s.toString(),a,d,u,l,p);if(Hn(y))return!1;if(((n=y.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw Sr.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const r=e[0],n=Number.parseInt(r.chainId,16),s=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(Hn(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,r){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(s=>ga(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(W1,i.join(" ")))}async request(e){const r=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return pa(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(r);case"wallet_switchEthereumChain":return this.switchEthereumChain(r);case"wallet_watchAsset":return this.watchAsset(r);default:if(!this.jsonRpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return m5(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const r=ga(e);if(!this._addresses.map(i=>ga(i)).includes(r))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?ga(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?ga(e.to):null,i=e.value!=null?kl(e.value):BigInt(0),s=e.data?j1(e.data):Buffer.alloc(0),o=e.nonce!=null?Ll(e.nonce):null,a=e.gasPrice!=null?kl(e.gasPrice):null,u=e.maxFeePerGas!=null?kl(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?kl(e.maxPriorityFeePerGas):null,d=e.gas!=null?kl(e.gas):null,p=e.chainId?Ll(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:u,maxPriorityFeePerGas:l,gasLimit:d,chainId:p}}async ecRecover(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:B1(n[0]),signature:B1(n[1]),addPrefix:r==="personal_ecRecover"}});if(Hn(s))throw s;return s.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(d4))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,r;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:pa(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(Hn(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:pa(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw Sr.rpc.invalidParams();const r=e[1],n=e[0];this._ensureKnownAddress(r);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ga(r),message:B1(n),addPrefix:!0,typedDataJson:null}});if(Hn(s))throw s;return s.result}async _eth_signTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(r);if(Hn(i))throw i;return i.result}async _eth_sendRawTransaction(e){const r=j1(e[0]),i=await this.initializeRelay().submitEthereumTransaction(r,this.getChainId());if(Hn(i))throw i;return i.result}async _eth_sendTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(r);if(Hn(i))throw i;return i.result}async signTypedData(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const i=l=>{const d={eth_signTypedData_v1:o0.hashForSignTypedDataLegacy,eth_signTypedData_v3:o0.hashForSignTypedData_v3,eth_signTypedData_v4:o0.hashForSignTypedData_v4,eth_signTypedData:o0.hashForSignTypedData_v4};return Nl(d[r]({data:Ez(l)}),!0)},s=n[r==="eth_signTypedData_v1"?1:0],o=n[r==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const u=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ga(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(Hn(u))throw u;return u.result}initializeRelay(){return this._relay||(this._relay=new Ro({linkAPIUrl:l4,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const m4="SignerType",v4=new Ys("CBWSDK","SignerConfigurator");function RH(){return v4.getItem(m4)}function DH(t){v4.setItem(m4,t)}async function OH(t){const{communicator:e,metadata:r,handshakeRequest:n,callback:i}=t;LH(e,r,i).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:o}=await e.postRequestAndWaitForResponse(s);return o}function NH(t){const{signerType:e,metadata:r,communicator:n,callback:i}=t;switch(e){case"scw":return new kz({metadata:r,callback:i,communicator:n});case"walletlink":return new g4({metadata:r,callback:i})}}async function LH(t,e,r){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new g4({metadata:e,callback:r});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const kH=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. -Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,BH=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,r=await fetch(e,{method:"HEAD"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const n=r.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(kH)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:$H,getCrossOriginOpenerPolicy:FH}=BH(),v4=420,b4=540;function jH(t){const e=(window.innerWidth-v4)/2+window.screenX,r=(window.innerHeight-b4)/2+window.screenY;qH(t);const n=window.open(t,"Smart Wallet",`width=${v4}, height=${b4}, left=${e}, top=${r}`);if(n==null||n.focus(),!n)throw Sr.rpc.internal("Pop up window failed to open");return n}function UH(t){t&&!t.closed&&t.close()}function qH(t){const e={sdkName:p5,sdkVersion:Bl,origin:window.location.origin,coop:FH()};for(const[r,n]of Object.entries(e))t.searchParams.append(r,n.toString())}class zH{constructor({url:e=CH,metadata:r,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=u=>{if(u.origin!==this.url.origin)return;const l=u.data;i(l)&&(s(l),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{UH(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(Sr.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=jH(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:Bl,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw Sr.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=r,this.preference=n}}function HH(t){const e=bz(WH(t),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",Bl),r.searchParams.set("code",e.code.toString()),r.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:r.href})}function WH(t){var e;if(typeof t=="string")return{message:t,code:cn.rpc.internal};if(Hn(t)){const r=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:r.match(/(denied|rejected)/i)?cn.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:r,code:n,data:{method:t.method}})}return t}var y4={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,l,d){this.fn=u,this.context=l,this.once=d||!1}function s(u,l,d,p,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var A=new i(d,p||u,y),P=r?r+l:l;return u._events[P]?u._events[P].fn?u._events[P]=[u._events[P],A]:u._events[P].push(A):(u._events[P]=A,u._eventsCount++),u}function o(u,l){--u._eventsCount===0?u._events=new n:delete u._events[l]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,p;if(this._eventsCount===0)return l;for(p in d=this._events)e.call(d,p)&&l.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=r?r+l:l,p=this._events[d];if(!p)return[];if(p.fn)return[p.fn];for(var y=0,A=p.length,P=new Array(A);y(i||(i=ZH(n)),i)}}function w4(t,e){return function(){return t.apply(e,arguments)}}const{toString:tW}=Object.prototype,{getPrototypeOf:iv}=Object,p0=(t=>e=>{const r=tW.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Es=t=>(t=t.toLowerCase(),e=>p0(e)===t),g0=t=>e=>typeof e===t,{isArray:Ou}=Array,ql=g0("undefined");function rW(t){return t!==null&&!ql(t)&&t.constructor!==null&&!ql(t.constructor)&&Oi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const x4=Es("ArrayBuffer");function nW(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&x4(t.buffer),e}const iW=g0("string"),Oi=g0("function"),_4=g0("number"),m0=t=>t!==null&&typeof t=="object",sW=t=>t===!0||t===!1,v0=t=>{if(p0(t)!=="object")return!1;const e=iv(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},oW=Es("Date"),aW=Es("File"),cW=Es("Blob"),uW=Es("FileList"),fW=t=>m0(t)&&Oi(t.pipe),lW=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Oi(t.append)&&((e=p0(t))==="formdata"||e==="object"&&Oi(t.toString)&&t.toString()==="[object FormData]"))},hW=Es("URLSearchParams"),[dW,pW,gW,mW]=["ReadableStream","Request","Response","Headers"].map(Es),vW=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function zl(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Ou(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const pc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,S4=t=>!ql(t)&&t!==pc;function sv(){const{caseless:t}=S4(this)&&this||{},e={},r=(n,i)=>{const s=t&&E4(e,i)||i;v0(e[s])&&v0(n)?e[s]=sv(e[s],n):v0(n)?e[s]=sv({},n):Ou(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(zl(e,(i,s)=>{r&&Oi(i)?t[s]=w4(i,r):t[s]=i},{allOwnKeys:n}),t),yW=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),wW=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},xW=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&iv(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},_W=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},EW=t=>{if(!t)return null;if(Ou(t))return t;let e=t.length;if(!_4(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},SW=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&iv(Uint8Array)),AW=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},PW=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},MW=Es("HTMLFormElement"),IW=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),A4=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),CW=Es("RegExp"),P4=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};zl(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},TW=t=>{P4(t,(e,r)=>{if(Oi(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Oi(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},RW=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Ou(t)?n(t):n(String(t).split(e)),r},DW=()=>{},OW=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,ov="abcdefghijklmnopqrstuvwxyz",M4="0123456789",I4={DIGIT:M4,ALPHA:ov,ALPHA_DIGIT:ov+ov.toUpperCase()+M4},NW=(t=16,e=I4.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function LW(t){return!!(t&&Oi(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const kW=t=>{const e=new Array(10),r=(n,i)=>{if(m0(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Ou(n)?[]:{};return zl(n,(o,a)=>{const u=r(o,i+1);!ql(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},BW=Es("AsyncFunction"),$W=t=>t&&(m0(t)||Oi(t))&&Oi(t.then)&&Oi(t.catch),C4=((t,e)=>t?setImmediate:e?((r,n)=>(pc.addEventListener("message",({source:i,data:s})=>{i===pc&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),pc.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Oi(pc.postMessage)),FW=typeof queueMicrotask<"u"?queueMicrotask.bind(pc):typeof process<"u"&&process.nextTick||C4,Oe={isArray:Ou,isArrayBuffer:x4,isBuffer:rW,isFormData:lW,isArrayBufferView:nW,isString:iW,isNumber:_4,isBoolean:sW,isObject:m0,isPlainObject:v0,isReadableStream:dW,isRequest:pW,isResponse:gW,isHeaders:mW,isUndefined:ql,isDate:oW,isFile:aW,isBlob:cW,isRegExp:CW,isFunction:Oi,isStream:fW,isURLSearchParams:hW,isTypedArray:SW,isFileList:uW,forEach:zl,merge:sv,extend:bW,trim:vW,stripBOM:yW,inherits:wW,toFlatObject:xW,kindOf:p0,kindOfTest:Es,endsWith:_W,toArray:EW,forEachEntry:AW,matchAll:PW,isHTMLForm:MW,hasOwnProperty:A4,hasOwnProp:A4,reduceDescriptors:P4,freezeMethods:TW,toObjectSet:RW,toCamelCase:IW,noop:DW,toFiniteNumber:OW,findKey:E4,global:pc,isContextDefined:S4,ALPHABET:I4,generateString:NW,isSpecCompliantForm:LW,toJSONObject:kW,isAsyncFn:BW,isThenable:$W,setImmediate:C4,asap:FW};function ar(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Oe.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const T4=ar.prototype,R4={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{R4[t]={value:t}}),Object.defineProperties(ar,R4),Object.defineProperty(T4,"isAxiosError",{value:!0}),ar.from=(t,e,r,n,i,s)=>{const o=Object.create(T4);return Oe.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),ar.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const jW=null;function av(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function D4(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function O4(t,e,r){return t?t.concat(e).map(function(i,s){return i=D4(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function UW(t){return Oe.isArray(t)&&!t.some(av)}const qW=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function b0(t,e,r){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Oe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(N,D){return!Oe.isUndefined(D[N])});const n=r.metaTokens,i=r.visitor||d,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(i))throw new TypeError("visitor must be a function");function l(P){if(P===null)return"";if(Oe.isDate(P))return P.toISOString();if(!u&&Oe.isBlob(P))throw new ar("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(P)||Oe.isTypedArray(P)?u&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function d(P,N,D){let k=P;if(P&&!D&&typeof P=="object"){if(Oe.endsWith(N,"{}"))N=n?N:N.slice(0,-2),P=JSON.stringify(P);else if(Oe.isArray(P)&&UW(P)||(Oe.isFileList(P)||Oe.endsWith(N,"[]"))&&(k=Oe.toArray(P)))return N=D4(N),k.forEach(function(j,U){!(Oe.isUndefined(j)||j===null)&&e.append(o===!0?O4([N],U,s):o===null?N:N+"[]",l(j))}),!1}return av(P)?!0:(e.append(O4(D,N,s),l(P)),!1)}const p=[],y=Object.assign(qW,{defaultVisitor:d,convertValue:l,isVisitable:av});function A(P,N){if(!Oe.isUndefined(P)){if(p.indexOf(P)!==-1)throw Error("Circular reference detected in "+N.join("."));p.push(P),Oe.forEach(P,function(k,B){(!(Oe.isUndefined(k)||k===null)&&i.call(e,k,Oe.isString(B)?B.trim():B,N,y))===!0&&A(k,N?N.concat(B):[B])}),p.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return A(t),e}function N4(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function cv(t,e){this._pairs=[],t&&b0(t,this,e)}const L4=cv.prototype;L4.append=function(e,r){this._pairs.push([e,r])},L4.toString=function(e){const r=e?function(n){return e.call(this,n,N4)}:N4;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function zW(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function k4(t,e,r){if(!e)return t;const n=r&&r.encode||zW;Oe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(e,r):s=Oe.isURLSearchParams(e)?e.toString():new cv(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class B4{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(n){n!==null&&e(n)})}}const $4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},HW={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:cv,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},uv=typeof window<"u"&&typeof document<"u",fv=typeof navigator=="object"&&navigator||void 0,WW=uv&&(!fv||["ReactNative","NativeScript","NS"].indexOf(fv.product)<0),KW=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",VW=uv&&window.location.href||"http://localhost",Xn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:uv,hasStandardBrowserEnv:WW,hasStandardBrowserWebWorkerEnv:KW,navigator:fv,origin:VW},Symbol.toStringTag,{value:"Module"})),...HW};function GW(t,e){return b0(t,new Xn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Xn.isNode&&Oe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function YW(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function JW(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&Oe.isArray(i)?i.length:o,u?(Oe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Oe.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Oe.isArray(i[o])&&(i[o]=JW(i[o])),!a)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const r={};return Oe.forEachEntry(t,(n,i)=>{e(YW(n),i,r,0)}),r}return null}function XW(t,e,r){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const Hl={transitional:$4,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Oe.isObject(e);if(s&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return i?JSON.stringify(F4(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return GW(e,this.formSerializer).toString();if((a=Oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return b0(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),XW(e)):e}],transformResponse:[function(e){const r=this.transitional||Hl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ar.from(a,ar.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xn.classes.FormData,Blob:Xn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{Hl.headers[t]={}});const ZW=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),QW=t=>{const e={};let r,n,i;return t&&t.split(` -`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&ZW[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},j4=Symbol("internals");function Wl(t){return t&&String(t).trim().toLowerCase()}function y0(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(y0):String(t)}function eK(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const tK=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function lv(t,e,r,n,i){if(Oe.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Oe.isString(e)){if(Oe.isString(n))return e.indexOf(n)!==-1;if(Oe.isRegExp(n))return n.test(e)}}function rK(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function nK(t,e){const r=Oe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}let wi=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,u,l){const d=Wl(u);if(!d)throw new Error("header name must be a non-empty string");const p=Oe.findKey(i,d);(!p||i[p]===void 0||l===!0||l===void 0&&i[p]!==!1)&&(i[p||u]=y0(a))}const o=(a,u)=>Oe.forEach(a,(l,d)=>s(l,d,u));if(Oe.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(Oe.isString(e)&&(e=e.trim())&&!tK(e))o(QW(e),r);else if(Oe.isHeaders(e))for(const[a,u]of e.entries())s(u,a,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return eK(i);if(Oe.isFunction(r))return r.call(this,i,n);if(Oe.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||lv(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=Wl(o),o){const a=Oe.findKey(n,o);a&&(!r||lv(n,n[a],a,r))&&(delete n[a],i=!0)}}return Oe.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||lv(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Oe.forEach(this,(i,s)=>{const o=Oe.findKey(n,s);if(o){r[o]=y0(i),delete r[s];return}const a=e?rK(s):String(s).trim();a!==s&&delete r[s],r[a]=y0(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Oe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Oe.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[j4]=this[j4]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Wl(o);n[a]||(nK(i,o),n[a]=!0)}return Oe.isArray(e)?e.forEach(s):s(e),this}};wi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Oe.reduceDescriptors(wi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),Oe.freezeMethods(wi);function hv(t,e){const r=this||Hl,n=e||r,i=wi.from(n.headers);let s=n.data;return Oe.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function U4(t){return!!(t&&t.__CANCEL__)}function Nu(t,e,r){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,r),this.name="CanceledError"}Oe.inherits(Nu,ar,{__CANCEL__:!0});function q4(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new ar("Request failed with status code "+r.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function iK(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function sK(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),d=n[s];o||(o=l),r[i]=u,n[i]=l;let p=s,y=0;for(;p!==i;)y+=r[p++],p=p%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),l-o{r=d,i=null,s&&(clearTimeout(s),s=null),t.apply(null,l)};return[(...l)=>{const d=Date.now(),p=d-r;p>=n?o(l,d):(i=l,s||(s=setTimeout(()=>{s=null,o(i)},n-p)))},()=>i&&o(i)]}const w0=(t,e,r=3)=>{let n=0;const i=sK(50,250);return oK(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,u=o-n,l=i(u),d=o<=a;n=o;const p={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:l||void 0,estimated:l&&a&&d?(a-o)/l:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(p)},r)},z4=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},H4=t=>(...e)=>Oe.asap(()=>t(...e)),aK=Xn.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Xn.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Xn.origin),Xn.navigator&&/(msie|trident)/i.test(Xn.navigator.userAgent)):()=>!0,cK=Xn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];Oe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Oe.isString(n)&&o.push("path="+n),Oe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function uK(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function fK(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function W4(t,e){return t&&!uK(e)?fK(t,e):e}const K4=t=>t instanceof wi?{...t}:t;function gc(t,e){e=e||{};const r={};function n(l,d,p,y){return Oe.isPlainObject(l)&&Oe.isPlainObject(d)?Oe.merge.call({caseless:y},l,d):Oe.isPlainObject(d)?Oe.merge({},d):Oe.isArray(d)?d.slice():d}function i(l,d,p,y){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l,p,y)}else return n(l,d,p,y)}function s(l,d){if(!Oe.isUndefined(d))return n(void 0,d)}function o(l,d){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l)}else return n(void 0,d)}function a(l,d,p){if(p in e)return n(l,d);if(p in t)return n(void 0,l)}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,d,p)=>i(K4(l),K4(d),p,!0)};return Oe.forEach(Object.keys(Object.assign({},t,e)),function(d){const p=u[d]||i,y=p(t[d],e[d],d);Oe.isUndefined(y)&&p!==a||(r[d]=y)}),r}const V4=t=>{const e=gc({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=wi.from(o),e.url=k4(W4(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(Oe.isFormData(r)){if(Xn.hasStandardBrowserEnv||Xn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[l,...d]=u?u.split(";").map(p=>p.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...d].join("; "))}}if(Xn.hasStandardBrowserEnv&&(n&&Oe.isFunction(n)&&(n=n(e)),n||n!==!1&&aK(e.url))){const l=i&&s&&cK.read(s);l&&o.set(i,l)}return e},lK=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=V4(t);let s=i.data;const o=wi.from(i.headers).normalize();let{responseType:a,onUploadProgress:u,onDownloadProgress:l}=i,d,p,y,A,P;function N(){A&&A(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let D=new XMLHttpRequest;D.open(i.method.toUpperCase(),i.url,!0),D.timeout=i.timeout;function k(){if(!D)return;const j=wi.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),K={data:!a||a==="text"||a==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:j,config:t,request:D};q4(function(T){r(T),N()},function(T){n(T),N()},K),D=null}"onloadend"in D?D.onloadend=k:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(k)},D.onabort=function(){D&&(n(new ar("Request aborted",ar.ECONNABORTED,t,D)),D=null)},D.onerror=function(){n(new ar("Network Error",ar.ERR_NETWORK,t,D)),D=null},D.ontimeout=function(){let U=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const K=i.transitional||$4;i.timeoutErrorMessage&&(U=i.timeoutErrorMessage),n(new ar(U,K.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,D)),D=null},s===void 0&&o.setContentType(null),"setRequestHeader"in D&&Oe.forEach(o.toJSON(),function(U,K){D.setRequestHeader(K,U)}),Oe.isUndefined(i.withCredentials)||(D.withCredentials=!!i.withCredentials),a&&a!=="json"&&(D.responseType=i.responseType),l&&([y,P]=w0(l,!0),D.addEventListener("progress",y)),u&&D.upload&&([p,A]=w0(u),D.upload.addEventListener("progress",p),D.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(d=j=>{D&&(n(!j||j.type?new Nu(null,t,D):j),D.abort(),D=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const B=iK(i.url);if(B&&Xn.protocols.indexOf(B)===-1){n(new ar("Unsupported protocol "+B+":",ar.ERR_BAD_REQUEST,t));return}D.send(s||null)})},hK=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i;const s=function(l){if(!i){i=!0,a();const d=l instanceof Error?l:this.reason;n.abort(d instanceof ar?d:new Nu(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,s(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),t=null)};t.forEach(l=>l.addEventListener("abort",s));const{signal:u}=n;return u.unsubscribe=()=>Oe.asap(a),u}},dK=function*(t,e){let r=t.byteLength;if(r{const i=pK(t,e);let s=0,o,a=u=>{o||(o=!0,n&&n(u))};return new ReadableStream({async pull(u){try{const{done:l,value:d}=await i.next();if(l){a(),u.close();return}let p=d.byteLength;if(r){let y=s+=p;r(y)}u.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(u){return a(u),i.return()}},{highWaterMark:2})},x0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Y4=x0&&typeof ReadableStream=="function",mK=x0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),J4=(t,...e)=>{try{return!!t(...e)}catch{return!1}},vK=Y4&&J4(()=>{let t=!1;const e=new Request(Xn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),X4=64*1024,dv=Y4&&J4(()=>Oe.isReadableStream(new Response("").body)),_0={stream:dv&&(t=>t.body)};x0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!_0[e]&&(_0[e]=Oe.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,n)})})})(new Response);const bK=async t=>{if(t==null)return 0;if(Oe.isBlob(t))return t.size;if(Oe.isSpecCompliantForm(t))return(await new Request(Xn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(t)||Oe.isArrayBuffer(t))return t.byteLength;if(Oe.isURLSearchParams(t)&&(t=t+""),Oe.isString(t))return(await mK(t)).byteLength},yK=async(t,e)=>{const r=Oe.toFiniteNumber(t.getContentLength());return r??bK(e)},pv={http:jW,xhr:lK,fetch:x0&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:l,headers:d,withCredentials:p="same-origin",fetchOptions:y}=V4(t);l=l?(l+"").toLowerCase():"text";let A=hK([i,s&&s.toAbortSignal()],o),P;const N=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let D;try{if(u&&vK&&r!=="get"&&r!=="head"&&(D=await yK(d,n))!==0){let K=new Request(e,{method:"POST",body:n,duplex:"half"}),J;if(Oe.isFormData(n)&&(J=K.headers.get("content-type"))&&d.setContentType(J),K.body){const[T,z]=z4(D,w0(H4(u)));n=G4(K.body,X4,T,z)}}Oe.isString(p)||(p=p?"include":"omit");const k="credentials"in Request.prototype;P=new Request(e,{...y,signal:A,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:k?p:void 0});let B=await fetch(P);const j=dv&&(l==="stream"||l==="response");if(dv&&(a||j&&N)){const K={};["status","statusText","headers"].forEach(ue=>{K[ue]=B[ue]});const J=Oe.toFiniteNumber(B.headers.get("content-length")),[T,z]=a&&z4(J,w0(H4(a),!0))||[];B=new Response(G4(B.body,X4,T,()=>{z&&z(),N&&N()}),K)}l=l||"text";let U=await _0[Oe.findKey(_0,l)||"text"](B,t);return!j&&N&&N(),await new Promise((K,J)=>{q4(K,J,{data:U,headers:wi.from(B.headers),status:B.status,statusText:B.statusText,config:t,request:P})})}catch(k){throw N&&N(),k&&k.name==="TypeError"&&/fetch/i.test(k.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,P),{cause:k.cause||k}):ar.from(k,k&&k.code,t,P)}})};Oe.forEach(pv,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Z4=t=>`- ${t}`,wK=t=>Oe.isFunction(t)||t===null||t===!1,Q4={getAdapter:t=>{t=Oe.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : -`+s.map(Z4).join(` -`):" "+Z4(s[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:pv};function gv(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Nu(null,t)}function e8(t){return gv(t),t.headers=wi.from(t.headers),t.data=hv.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Q4.getAdapter(t.adapter||Hl.adapter)(t).then(function(n){return gv(t),n.data=hv.call(t,t.transformResponse,n),n.headers=wi.from(n.headers),n},function(n){return U4(n)||(gv(t),n&&n.response&&(n.response.data=hv.call(t,t.transformResponse,n.response),n.response.headers=wi.from(n.response.headers))),Promise.reject(n)})}const t8="1.7.8",E0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{E0[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const r8={};E0.transitional=function(e,r,n){function i(s,o){return"[Axios v"+t8+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new ar(i(o," has been removed"+(r?" in "+r:"")),ar.ERR_DEPRECATED);return r&&!r8[o]&&(r8[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}},E0.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function xK(t,e,r){if(typeof t!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new ar("option "+s+" must be "+u,ar.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ar("Unknown option "+s,ar.ERR_BAD_OPTION)}}const S0={assertOptions:xK,validators:E0},Zs=S0.validators;let mc=class{constructor(e){this.defaults=e,this.interceptors={request:new B4,response:new B4}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` -`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=gc(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&S0.assertOptions(n,{silentJSONParsing:Zs.transitional(Zs.boolean),forcedJSONParsing:Zs.transitional(Zs.boolean),clarifyTimeoutError:Zs.transitional(Zs.boolean)},!1),i!=null&&(Oe.isFunction(i)?r.paramsSerializer={serialize:i}:S0.assertOptions(i,{encode:Zs.function,serialize:Zs.function},!0)),S0.assertOptions(r,{baseUrl:Zs.spelling("baseURL"),withXsrfToken:Zs.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Oe.merge(s.common,s[r.method]);s&&Oe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete s[P]}),r.headers=wi.concat(o,s);const a=[];let u=!0;this.interceptors.request.forEach(function(N){typeof N.runWhen=="function"&&N.runWhen(r)===!1||(u=u&&N.synchronous,a.unshift(N.fulfilled,N.rejected))});const l=[];this.interceptors.response.forEach(function(N){l.push(N.fulfilled,N.rejected)});let d,p=0,y;if(!u){const P=[e8.bind(this),void 0];for(P.unshift.apply(P,a),P.push.apply(P,l),y=P.length,d=Promise.resolve(r);p{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new Nu(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new JA(function(i){e=i}),cancel:e}}};function EK(t){return function(r){return t.apply(null,r)}}function SK(t){return Oe.isObject(t)&&t.isAxiosError===!0}const mv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(mv).forEach(([t,e])=>{mv[e]=t});function n8(t){const e=new mc(t),r=w4(mc.prototype.request,e);return Oe.extend(r,mc.prototype,e,{allOwnKeys:!0}),Oe.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return n8(gc(t,i))},r}const fn=n8(Hl);fn.Axios=mc,fn.CanceledError=Nu,fn.CancelToken=_K,fn.isCancel=U4,fn.VERSION=t8,fn.toFormData=b0,fn.AxiosError=ar,fn.Cancel=fn.CanceledError,fn.all=function(e){return Promise.all(e)},fn.spread=EK,fn.isAxiosError=SK,fn.mergeConfig=gc,fn.AxiosHeaders=wi,fn.formToJSON=t=>F4(Oe.isHTMLForm(t)?new FormData(t):t),fn.getAdapter=Q4.getAdapter,fn.HttpStatusCode=mv,fn.default=fn;const{Axios:$oe,AxiosError:i8,CanceledError:Foe,isCancel:joe,CancelToken:Uoe,VERSION:qoe,all:zoe,Cancel:Hoe,isAxiosError:Woe,spread:Koe,toFormData:Voe,AxiosHeaders:Goe,HttpStatusCode:Yoe,formToJSON:Joe,getAdapter:Xoe,mergeConfig:Zoe}=fn,s8=fn.create({timeout:6e4,headers:{"Content-Type":"application/json",token:localStorage.getItem("auth")}});function AK(t){var e,r,n;if(((e=t.data)==null?void 0:e.success)!==!0){const i=new i8((r=t.data)==null?void 0:r.errorMessage,(n=t.data)==null?void 0:n.errorCode,t.config,t.request,t);return Promise.reject(i)}else return t}function PK(t){var r;console.log(t);const e=(r=t.response)==null?void 0:r.data;if(e){console.log(e,"responseData");const n=new i8(e.errorMessage,t.code,t.config,t.request,t.response);return Promise.reject(n)}else return Promise.reject(t)}s8.interceptors.response.use(AK,PK);class MK{constructor(e){oo(this,"_apiBase","");this.request=e}setApiBase(e){this._apiBase=e||""}async getNonce(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/nonce`,e);return r.data}async getEmailCode(e,r){const{data:n}=await this.request.post(`${this._apiBase}/api/v2/user/get_code`,e,{headers:{"Captcha-Param":r}});return n.data}async emailLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async walletLogin(e){return e.account_enum==="C"?(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data:(await this.request.post(`${this._apiBase}/api/v2/business/login`,e)).data}async tonLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async bindEmail(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindTonWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindEvmWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}}const va=new MK(s8),IK={projectId:"7a4434fefbcc9af474fb5c995e47d286",metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},o8=eW({appName:"codatta",appLogoUrl:"https://avatars.githubusercontent.com/u/171659315"}),a8=Se.createContext({saveLastUsedWallet:()=>{},lastUsedWallet:null,wallets:[],initialized:!1,featuredWallets:[]});function Kl(){return Se.useContext(a8)}function CK(t){const{apiBaseUrl:e}=t,[r,n]=Se.useState([]),[i,s]=Se.useState([]),[o,a]=Se.useState(null),[u,l]=Se.useState(!1),d=A=>{a(A);const N={provider:A.provider instanceof R1?"UniversalProvider":"EIP1193Provider",key:A.key,timestamp:Date.now()};localStorage.setItem("xn-last-used-info",JSON.stringify(N))};function p(A){const P=A.filter(k=>k.featured||k.installed),N=A.filter(k=>!k.featured&&!k.installed),D=[...P,...N];n(D),s(P)}async function y(){const A=[],P=new Map;QA.forEach(D=>{const k=new Wf(D);D.name==="Coinbase Wallet"&&k.EIP6963Detected({info:{name:"Coinbase Wallet",uuid:"coinbase",icon:D.image,rdns:"coinbase"},provider:o8.getProvider()}),P.set(k.key,k),A.push(k)}),(await gz()).forEach(D=>{const k=P.get(D.info.name);if(k)k.EIP6963Detected(D);else{const B=new Wf(D);P.set(B.key,B),A.push(B)}});try{const D=JSON.parse(localStorage.getItem("xn-last-used-info")||"{}"),k=P.get(D.key);if(k){if(k.lastUsed=!0,D.provider==="UniversalProvider"){const B=await R1.init(IK);B.session&&(k.setUniversalProvider(B),console.log("Restored UniversalProvider for wallet:",k.key))}else D.provider==="EIP1193Provider"&&k.installed&&console.log("Using detected EIP1193Provider for wallet:",k.key);a(k)}}catch(D){console.log(D)}p(A),l(!0)}return Se.useEffect(()=>{y(),va.setApiBase(e)},[]),ge.jsx(a8.Provider,{value:{saveLastUsedWallet:d,wallets:r,initialized:u,lastUsedWallet:o,featuredWallets:i},children:t.children})}/** +Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,BH=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,r=await fetch(e,{method:"HEAD"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const n=r.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(kH)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:$H,getCrossOriginOpenerPolicy:FH}=BH(),b4=420,y4=540;function jH(t){const e=(window.innerWidth-b4)/2+window.screenX,r=(window.innerHeight-y4)/2+window.screenY;qH(t);const n=window.open(t,"Smart Wallet",`width=${b4}, height=${y4}, left=${e}, top=${r}`);if(n==null||n.focus(),!n)throw Sr.rpc.internal("Pop up window failed to open");return n}function UH(t){t&&!t.closed&&t.close()}function qH(t){const e={sdkName:g5,sdkVersion:Bl,origin:window.location.origin,coop:FH()};for(const[r,n]of Object.entries(e))t.searchParams.append(r,n.toString())}class zH{constructor({url:e=CH,metadata:r,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=u=>{if(u.origin!==this.url.origin)return;const l=u.data;i(l)&&(s(l),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{UH(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(Sr.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=jH(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:Bl,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw Sr.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=r,this.preference=n}}function HH(t){const e=bz(WH(t),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",Bl),r.searchParams.set("code",e.code.toString()),r.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:r.href})}function WH(t){var e;if(typeof t=="string")return{message:t,code:cn.rpc.internal};if(Hn(t)){const r=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:r.match(/(denied|rejected)/i)?cn.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:r,code:n,data:{method:t.method}})}return t}var w4={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,l,d){this.fn=u,this.context=l,this.once=d||!1}function s(u,l,d,p,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var A=new i(d,p||u,y),P=r?r+l:l;return u._events[P]?u._events[P].fn?u._events[P]=[u._events[P],A]:u._events[P].push(A):(u._events[P]=A,u._eventsCount++),u}function o(u,l){--u._eventsCount===0?u._events=new n:delete u._events[l]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,p;if(this._eventsCount===0)return l;for(p in d=this._events)e.call(d,p)&&l.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=r?r+l:l,p=this._events[d];if(!p)return[];if(p.fn)return[p.fn];for(var y=0,A=p.length,P=new Array(A);y(i||(i=ZH(n)),i)}}function x4(t,e){return function(){return t.apply(e,arguments)}}const{toString:tW}=Object.prototype,{getPrototypeOf:iv}=Object,p0=(t=>e=>{const r=tW.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Es=t=>(t=t.toLowerCase(),e=>p0(e)===t),g0=t=>e=>typeof e===t,{isArray:Nu}=Array,ql=g0("undefined");function rW(t){return t!==null&&!ql(t)&&t.constructor!==null&&!ql(t.constructor)&&Oi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const _4=Es("ArrayBuffer");function nW(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&_4(t.buffer),e}const iW=g0("string"),Oi=g0("function"),E4=g0("number"),m0=t=>t!==null&&typeof t=="object",sW=t=>t===!0||t===!1,v0=t=>{if(p0(t)!=="object")return!1;const e=iv(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},oW=Es("Date"),aW=Es("File"),cW=Es("Blob"),uW=Es("FileList"),fW=t=>m0(t)&&Oi(t.pipe),lW=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Oi(t.append)&&((e=p0(t))==="formdata"||e==="object"&&Oi(t.toString)&&t.toString()==="[object FormData]"))},hW=Es("URLSearchParams"),[dW,pW,gW,mW]=["ReadableStream","Request","Response","Headers"].map(Es),vW=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function zl(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Nu(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const pc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,A4=t=>!ql(t)&&t!==pc;function sv(){const{caseless:t}=A4(this)&&this||{},e={},r=(n,i)=>{const s=t&&S4(e,i)||i;v0(e[s])&&v0(n)?e[s]=sv(e[s],n):v0(n)?e[s]=sv({},n):Nu(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(zl(e,(i,s)=>{r&&Oi(i)?t[s]=x4(i,r):t[s]=i},{allOwnKeys:n}),t),yW=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),wW=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},xW=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&iv(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},_W=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},EW=t=>{if(!t)return null;if(Nu(t))return t;let e=t.length;if(!E4(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},SW=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&iv(Uint8Array)),AW=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},PW=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},MW=Es("HTMLFormElement"),IW=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),P4=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),CW=Es("RegExp"),M4=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};zl(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},TW=t=>{M4(t,(e,r)=>{if(Oi(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Oi(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},RW=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Nu(t)?n(t):n(String(t).split(e)),r},DW=()=>{},OW=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,ov="abcdefghijklmnopqrstuvwxyz",I4="0123456789",C4={DIGIT:I4,ALPHA:ov,ALPHA_DIGIT:ov+ov.toUpperCase()+I4},NW=(t=16,e=C4.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function LW(t){return!!(t&&Oi(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const kW=t=>{const e=new Array(10),r=(n,i)=>{if(m0(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Nu(n)?[]:{};return zl(n,(o,a)=>{const u=r(o,i+1);!ql(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},BW=Es("AsyncFunction"),$W=t=>t&&(m0(t)||Oi(t))&&Oi(t.then)&&Oi(t.catch),T4=((t,e)=>t?setImmediate:e?((r,n)=>(pc.addEventListener("message",({source:i,data:s})=>{i===pc&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),pc.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Oi(pc.postMessage)),FW=typeof queueMicrotask<"u"?queueMicrotask.bind(pc):typeof process<"u"&&process.nextTick||T4,Oe={isArray:Nu,isArrayBuffer:_4,isBuffer:rW,isFormData:lW,isArrayBufferView:nW,isString:iW,isNumber:E4,isBoolean:sW,isObject:m0,isPlainObject:v0,isReadableStream:dW,isRequest:pW,isResponse:gW,isHeaders:mW,isUndefined:ql,isDate:oW,isFile:aW,isBlob:cW,isRegExp:CW,isFunction:Oi,isStream:fW,isURLSearchParams:hW,isTypedArray:SW,isFileList:uW,forEach:zl,merge:sv,extend:bW,trim:vW,stripBOM:yW,inherits:wW,toFlatObject:xW,kindOf:p0,kindOfTest:Es,endsWith:_W,toArray:EW,forEachEntry:AW,matchAll:PW,isHTMLForm:MW,hasOwnProperty:P4,hasOwnProp:P4,reduceDescriptors:M4,freezeMethods:TW,toObjectSet:RW,toCamelCase:IW,noop:DW,toFiniteNumber:OW,findKey:S4,global:pc,isContextDefined:A4,ALPHABET:C4,generateString:NW,isSpecCompliantForm:LW,toJSONObject:kW,isAsyncFn:BW,isThenable:$W,setImmediate:T4,asap:FW};function ar(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Oe.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const R4=ar.prototype,D4={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{D4[t]={value:t}}),Object.defineProperties(ar,D4),Object.defineProperty(R4,"isAxiosError",{value:!0}),ar.from=(t,e,r,n,i,s)=>{const o=Object.create(R4);return Oe.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),ar.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const jW=null;function av(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function O4(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function N4(t,e,r){return t?t.concat(e).map(function(i,s){return i=O4(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function UW(t){return Oe.isArray(t)&&!t.some(av)}const qW=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function b0(t,e,r){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Oe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(N,D){return!Oe.isUndefined(D[N])});const n=r.metaTokens,i=r.visitor||d,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(i))throw new TypeError("visitor must be a function");function l(P){if(P===null)return"";if(Oe.isDate(P))return P.toISOString();if(!u&&Oe.isBlob(P))throw new ar("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(P)||Oe.isTypedArray(P)?u&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function d(P,N,D){let k=P;if(P&&!D&&typeof P=="object"){if(Oe.endsWith(N,"{}"))N=n?N:N.slice(0,-2),P=JSON.stringify(P);else if(Oe.isArray(P)&&UW(P)||(Oe.isFileList(P)||Oe.endsWith(N,"[]"))&&(k=Oe.toArray(P)))return N=O4(N),k.forEach(function(q,j){!(Oe.isUndefined(q)||q===null)&&e.append(o===!0?N4([N],j,s):o===null?N:N+"[]",l(q))}),!1}return av(P)?!0:(e.append(N4(D,N,s),l(P)),!1)}const p=[],y=Object.assign(qW,{defaultVisitor:d,convertValue:l,isVisitable:av});function A(P,N){if(!Oe.isUndefined(P)){if(p.indexOf(P)!==-1)throw Error("Circular reference detected in "+N.join("."));p.push(P),Oe.forEach(P,function(k,B){(!(Oe.isUndefined(k)||k===null)&&i.call(e,k,Oe.isString(B)?B.trim():B,N,y))===!0&&A(k,N?N.concat(B):[B])}),p.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return A(t),e}function L4(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function cv(t,e){this._pairs=[],t&&b0(t,this,e)}const k4=cv.prototype;k4.append=function(e,r){this._pairs.push([e,r])},k4.toString=function(e){const r=e?function(n){return e.call(this,n,L4)}:L4;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function zW(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function B4(t,e,r){if(!e)return t;const n=r&&r.encode||zW;Oe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(e,r):s=Oe.isURLSearchParams(e)?e.toString():new cv(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class $4{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(n){n!==null&&e(n)})}}const F4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},HW={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:cv,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},uv=typeof window<"u"&&typeof document<"u",fv=typeof navigator=="object"&&navigator||void 0,WW=uv&&(!fv||["ReactNative","NativeScript","NS"].indexOf(fv.product)<0),KW=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",VW=uv&&window.location.href||"http://localhost",Xn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:uv,hasStandardBrowserEnv:WW,hasStandardBrowserWebWorkerEnv:KW,navigator:fv,origin:VW},Symbol.toStringTag,{value:"Module"})),...HW};function GW(t,e){return b0(t,new Xn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Xn.isNode&&Oe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function YW(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function JW(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&Oe.isArray(i)?i.length:o,u?(Oe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Oe.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Oe.isArray(i[o])&&(i[o]=JW(i[o])),!a)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const r={};return Oe.forEachEntry(t,(n,i)=>{e(YW(n),i,r,0)}),r}return null}function XW(t,e,r){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const Hl={transitional:F4,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Oe.isObject(e);if(s&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return i?JSON.stringify(j4(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return GW(e,this.formSerializer).toString();if((a=Oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return b0(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),XW(e)):e}],transformResponse:[function(e){const r=this.transitional||Hl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ar.from(a,ar.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xn.classes.FormData,Blob:Xn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{Hl.headers[t]={}});const ZW=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),QW=t=>{const e={};let r,n,i;return t&&t.split(` +`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&ZW[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},U4=Symbol("internals");function Wl(t){return t&&String(t).trim().toLowerCase()}function y0(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(y0):String(t)}function eK(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const tK=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function lv(t,e,r,n,i){if(Oe.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Oe.isString(e)){if(Oe.isString(n))return e.indexOf(n)!==-1;if(Oe.isRegExp(n))return n.test(e)}}function rK(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function nK(t,e){const r=Oe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}let wi=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,u,l){const d=Wl(u);if(!d)throw new Error("header name must be a non-empty string");const p=Oe.findKey(i,d);(!p||i[p]===void 0||l===!0||l===void 0&&i[p]!==!1)&&(i[p||u]=y0(a))}const o=(a,u)=>Oe.forEach(a,(l,d)=>s(l,d,u));if(Oe.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(Oe.isString(e)&&(e=e.trim())&&!tK(e))o(QW(e),r);else if(Oe.isHeaders(e))for(const[a,u]of e.entries())s(u,a,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return eK(i);if(Oe.isFunction(r))return r.call(this,i,n);if(Oe.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||lv(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=Wl(o),o){const a=Oe.findKey(n,o);a&&(!r||lv(n,n[a],a,r))&&(delete n[a],i=!0)}}return Oe.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||lv(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Oe.forEach(this,(i,s)=>{const o=Oe.findKey(n,s);if(o){r[o]=y0(i),delete r[s];return}const a=e?rK(s):String(s).trim();a!==s&&delete r[s],r[a]=y0(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Oe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Oe.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[U4]=this[U4]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Wl(o);n[a]||(nK(i,o),n[a]=!0)}return Oe.isArray(e)?e.forEach(s):s(e),this}};wi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Oe.reduceDescriptors(wi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),Oe.freezeMethods(wi);function hv(t,e){const r=this||Hl,n=e||r,i=wi.from(n.headers);let s=n.data;return Oe.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function q4(t){return!!(t&&t.__CANCEL__)}function Lu(t,e,r){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,r),this.name="CanceledError"}Oe.inherits(Lu,ar,{__CANCEL__:!0});function z4(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new ar("Request failed with status code "+r.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function iK(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function sK(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),d=n[s];o||(o=l),r[i]=u,n[i]=l;let p=s,y=0;for(;p!==i;)y+=r[p++],p=p%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),l-o{r=d,i=null,s&&(clearTimeout(s),s=null),t.apply(null,l)};return[(...l)=>{const d=Date.now(),p=d-r;p>=n?o(l,d):(i=l,s||(s=setTimeout(()=>{s=null,o(i)},n-p)))},()=>i&&o(i)]}const w0=(t,e,r=3)=>{let n=0;const i=sK(50,250);return oK(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,u=o-n,l=i(u),d=o<=a;n=o;const p={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:l||void 0,estimated:l&&a&&d?(a-o)/l:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(p)},r)},H4=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},W4=t=>(...e)=>Oe.asap(()=>t(...e)),aK=Xn.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Xn.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Xn.origin),Xn.navigator&&/(msie|trident)/i.test(Xn.navigator.userAgent)):()=>!0,cK=Xn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];Oe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Oe.isString(n)&&o.push("path="+n),Oe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function uK(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function fK(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function K4(t,e){return t&&!uK(e)?fK(t,e):e}const V4=t=>t instanceof wi?{...t}:t;function gc(t,e){e=e||{};const r={};function n(l,d,p,y){return Oe.isPlainObject(l)&&Oe.isPlainObject(d)?Oe.merge.call({caseless:y},l,d):Oe.isPlainObject(d)?Oe.merge({},d):Oe.isArray(d)?d.slice():d}function i(l,d,p,y){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l,p,y)}else return n(l,d,p,y)}function s(l,d){if(!Oe.isUndefined(d))return n(void 0,d)}function o(l,d){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l)}else return n(void 0,d)}function a(l,d,p){if(p in e)return n(l,d);if(p in t)return n(void 0,l)}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,d,p)=>i(V4(l),V4(d),p,!0)};return Oe.forEach(Object.keys(Object.assign({},t,e)),function(d){const p=u[d]||i,y=p(t[d],e[d],d);Oe.isUndefined(y)&&p!==a||(r[d]=y)}),r}const G4=t=>{const e=gc({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=wi.from(o),e.url=B4(K4(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(Oe.isFormData(r)){if(Xn.hasStandardBrowserEnv||Xn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[l,...d]=u?u.split(";").map(p=>p.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...d].join("; "))}}if(Xn.hasStandardBrowserEnv&&(n&&Oe.isFunction(n)&&(n=n(e)),n||n!==!1&&aK(e.url))){const l=i&&s&&cK.read(s);l&&o.set(i,l)}return e},lK=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=G4(t);let s=i.data;const o=wi.from(i.headers).normalize();let{responseType:a,onUploadProgress:u,onDownloadProgress:l}=i,d,p,y,A,P;function N(){A&&A(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let D=new XMLHttpRequest;D.open(i.method.toUpperCase(),i.url,!0),D.timeout=i.timeout;function k(){if(!D)return;const q=wi.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),H={data:!a||a==="text"||a==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:q,config:t,request:D};z4(function(T){r(T),N()},function(T){n(T),N()},H),D=null}"onloadend"in D?D.onloadend=k:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(k)},D.onabort=function(){D&&(n(new ar("Request aborted",ar.ECONNABORTED,t,D)),D=null)},D.onerror=function(){n(new ar("Network Error",ar.ERR_NETWORK,t,D)),D=null},D.ontimeout=function(){let j=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const H=i.transitional||F4;i.timeoutErrorMessage&&(j=i.timeoutErrorMessage),n(new ar(j,H.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,D)),D=null},s===void 0&&o.setContentType(null),"setRequestHeader"in D&&Oe.forEach(o.toJSON(),function(j,H){D.setRequestHeader(H,j)}),Oe.isUndefined(i.withCredentials)||(D.withCredentials=!!i.withCredentials),a&&a!=="json"&&(D.responseType=i.responseType),l&&([y,P]=w0(l,!0),D.addEventListener("progress",y)),u&&D.upload&&([p,A]=w0(u),D.upload.addEventListener("progress",p),D.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(d=q=>{D&&(n(!q||q.type?new Lu(null,t,D):q),D.abort(),D=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const B=iK(i.url);if(B&&Xn.protocols.indexOf(B)===-1){n(new ar("Unsupported protocol "+B+":",ar.ERR_BAD_REQUEST,t));return}D.send(s||null)})},hK=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i;const s=function(l){if(!i){i=!0,a();const d=l instanceof Error?l:this.reason;n.abort(d instanceof ar?d:new Lu(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,s(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),t=null)};t.forEach(l=>l.addEventListener("abort",s));const{signal:u}=n;return u.unsubscribe=()=>Oe.asap(a),u}},dK=function*(t,e){let r=t.byteLength;if(r{const i=pK(t,e);let s=0,o,a=u=>{o||(o=!0,n&&n(u))};return new ReadableStream({async pull(u){try{const{done:l,value:d}=await i.next();if(l){a(),u.close();return}let p=d.byteLength;if(r){let y=s+=p;r(y)}u.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(u){return a(u),i.return()}},{highWaterMark:2})},x0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",J4=x0&&typeof ReadableStream=="function",mK=x0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),X4=(t,...e)=>{try{return!!t(...e)}catch{return!1}},vK=J4&&X4(()=>{let t=!1;const e=new Request(Xn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Z4=64*1024,dv=J4&&X4(()=>Oe.isReadableStream(new Response("").body)),_0={stream:dv&&(t=>t.body)};x0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!_0[e]&&(_0[e]=Oe.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,n)})})})(new Response);const bK=async t=>{if(t==null)return 0;if(Oe.isBlob(t))return t.size;if(Oe.isSpecCompliantForm(t))return(await new Request(Xn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(t)||Oe.isArrayBuffer(t))return t.byteLength;if(Oe.isURLSearchParams(t)&&(t=t+""),Oe.isString(t))return(await mK(t)).byteLength},yK=async(t,e)=>{const r=Oe.toFiniteNumber(t.getContentLength());return r??bK(e)},pv={http:jW,xhr:lK,fetch:x0&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:l,headers:d,withCredentials:p="same-origin",fetchOptions:y}=G4(t);l=l?(l+"").toLowerCase():"text";let A=hK([i,s&&s.toAbortSignal()],o),P;const N=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let D;try{if(u&&vK&&r!=="get"&&r!=="head"&&(D=await yK(d,n))!==0){let H=new Request(e,{method:"POST",body:n,duplex:"half"}),J;if(Oe.isFormData(n)&&(J=H.headers.get("content-type"))&&d.setContentType(J),H.body){const[T,z]=H4(D,w0(W4(u)));n=Y4(H.body,Z4,T,z)}}Oe.isString(p)||(p=p?"include":"omit");const k="credentials"in Request.prototype;P=new Request(e,{...y,signal:A,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:k?p:void 0});let B=await fetch(P);const q=dv&&(l==="stream"||l==="response");if(dv&&(a||q&&N)){const H={};["status","statusText","headers"].forEach(ue=>{H[ue]=B[ue]});const J=Oe.toFiniteNumber(B.headers.get("content-length")),[T,z]=a&&H4(J,w0(W4(a),!0))||[];B=new Response(Y4(B.body,Z4,T,()=>{z&&z(),N&&N()}),H)}l=l||"text";let j=await _0[Oe.findKey(_0,l)||"text"](B,t);return!q&&N&&N(),await new Promise((H,J)=>{z4(H,J,{data:j,headers:wi.from(B.headers),status:B.status,statusText:B.statusText,config:t,request:P})})}catch(k){throw N&&N(),k&&k.name==="TypeError"&&/fetch/i.test(k.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,P),{cause:k.cause||k}):ar.from(k,k&&k.code,t,P)}})};Oe.forEach(pv,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Q4=t=>`- ${t}`,wK=t=>Oe.isFunction(t)||t===null||t===!1,e8={getAdapter:t=>{t=Oe.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : +`+s.map(Q4).join(` +`):" "+Q4(s[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:pv};function gv(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Lu(null,t)}function t8(t){return gv(t),t.headers=wi.from(t.headers),t.data=hv.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),e8.getAdapter(t.adapter||Hl.adapter)(t).then(function(n){return gv(t),n.data=hv.call(t,t.transformResponse,n),n.headers=wi.from(n.headers),n},function(n){return q4(n)||(gv(t),n&&n.response&&(n.response.data=hv.call(t,t.transformResponse,n.response),n.response.headers=wi.from(n.response.headers))),Promise.reject(n)})}const r8="1.7.8",E0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{E0[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const n8={};E0.transitional=function(e,r,n){function i(s,o){return"[Axios v"+r8+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new ar(i(o," has been removed"+(r?" in "+r:"")),ar.ERR_DEPRECATED);return r&&!n8[o]&&(n8[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}},E0.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function xK(t,e,r){if(typeof t!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new ar("option "+s+" must be "+u,ar.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ar("Unknown option "+s,ar.ERR_BAD_OPTION)}}const S0={assertOptions:xK,validators:E0},Zs=S0.validators;let mc=class{constructor(e){this.defaults=e,this.interceptors={request:new $4,response:new $4}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` +`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=gc(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&S0.assertOptions(n,{silentJSONParsing:Zs.transitional(Zs.boolean),forcedJSONParsing:Zs.transitional(Zs.boolean),clarifyTimeoutError:Zs.transitional(Zs.boolean)},!1),i!=null&&(Oe.isFunction(i)?r.paramsSerializer={serialize:i}:S0.assertOptions(i,{encode:Zs.function,serialize:Zs.function},!0)),S0.assertOptions(r,{baseUrl:Zs.spelling("baseURL"),withXsrfToken:Zs.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Oe.merge(s.common,s[r.method]);s&&Oe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete s[P]}),r.headers=wi.concat(o,s);const a=[];let u=!0;this.interceptors.request.forEach(function(N){typeof N.runWhen=="function"&&N.runWhen(r)===!1||(u=u&&N.synchronous,a.unshift(N.fulfilled,N.rejected))});const l=[];this.interceptors.response.forEach(function(N){l.push(N.fulfilled,N.rejected)});let d,p=0,y;if(!u){const P=[t8.bind(this),void 0];for(P.unshift.apply(P,a),P.push.apply(P,l),y=P.length,d=Promise.resolve(r);p{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new Lu(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new JA(function(i){e=i}),cancel:e}}};function EK(t){return function(r){return t.apply(null,r)}}function SK(t){return Oe.isObject(t)&&t.isAxiosError===!0}const mv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(mv).forEach(([t,e])=>{mv[e]=t});function i8(t){const e=new mc(t),r=x4(mc.prototype.request,e);return Oe.extend(r,mc.prototype,e,{allOwnKeys:!0}),Oe.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return i8(gc(t,i))},r}const fn=i8(Hl);fn.Axios=mc,fn.CanceledError=Lu,fn.CancelToken=_K,fn.isCancel=q4,fn.VERSION=r8,fn.toFormData=b0,fn.AxiosError=ar,fn.Cancel=fn.CanceledError,fn.all=function(e){return Promise.all(e)},fn.spread=EK,fn.isAxiosError=SK,fn.mergeConfig=gc,fn.AxiosHeaders=wi,fn.formToJSON=t=>j4(Oe.isHTMLForm(t)?new FormData(t):t),fn.getAdapter=e8.getAdapter,fn.HttpStatusCode=mv,fn.default=fn;const{Axios:$oe,AxiosError:s8,CanceledError:Foe,isCancel:joe,CancelToken:Uoe,VERSION:qoe,all:zoe,Cancel:Hoe,isAxiosError:Woe,spread:Koe,toFormData:Voe,AxiosHeaders:Goe,HttpStatusCode:Yoe,formToJSON:Joe,getAdapter:Xoe,mergeConfig:Zoe}=fn,o8=fn.create({timeout:6e4,headers:{"Content-Type":"application/json",token:localStorage.getItem("auth")}});function AK(t){var e,r,n;if(((e=t.data)==null?void 0:e.success)!==!0){const i=new s8((r=t.data)==null?void 0:r.errorMessage,(n=t.data)==null?void 0:n.errorCode,t.config,t.request,t);return Promise.reject(i)}else return t}function PK(t){var r;console.log(t);const e=(r=t.response)==null?void 0:r.data;if(e){console.log(e,"responseData");const n=new s8(e.errorMessage,t.code,t.config,t.request,t.response);return Promise.reject(n)}else return Promise.reject(t)}o8.interceptors.response.use(AK,PK);class MK{constructor(e){oo(this,"_apiBase","");this.request=e}setApiBase(e){this._apiBase=e||""}async getNonce(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/nonce`,e);return r.data}async getEmailCode(e,r){const{data:n}=await this.request.post(`${this._apiBase}/api/v2/user/get_code`,e,{headers:{"Captcha-Param":r}});return n.data}async emailLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async walletLogin(e){return e.account_enum==="C"?(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data:(await this.request.post(`${this._apiBase}/api/v2/business/login`,e)).data}async tonLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async bindEmail(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindTonWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindEvmWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}}const va=new MK(o8),IK={projectId:"7a4434fefbcc9af474fb5c995e47d286",metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},a8=eW({appName:"codatta",appLogoUrl:"https://avatars.githubusercontent.com/u/171659315"}),c8=Ee.createContext({saveLastUsedWallet:()=>{},lastUsedWallet:null,wallets:[],initialized:!1,featuredWallets:[]});function Kl(){return Ee.useContext(c8)}function CK(t){const{apiBaseUrl:e}=t,[r,n]=Ee.useState([]),[i,s]=Ee.useState([]),[o,a]=Ee.useState(null),[u,l]=Ee.useState(!1),d=A=>{a(A);const N={provider:A.provider instanceof R1?"UniversalProvider":"EIP1193Provider",key:A.key,timestamp:Date.now()};localStorage.setItem("xn-last-used-info",JSON.stringify(N))};function p(A){const P=A.filter(k=>k.featured||k.installed),N=A.filter(k=>!k.featured&&!k.installed),D=[...P,...N];n(D),s(P)}async function y(){const A=[],P=new Map;QA.forEach(D=>{const k=new ru(D);D.name==="Coinbase Wallet"&&k.EIP6963Detected({info:{name:"Coinbase Wallet",uuid:"coinbase",icon:D.image,rdns:"coinbase"},provider:a8.getProvider()}),P.set(k.key,k),A.push(k)}),(await gz()).forEach(D=>{const k=P.get(D.info.name);if(k)k.EIP6963Detected(D);else{const B=new ru(D);P.set(B.key,B),A.push(B)}console.log(D)});try{const D=JSON.parse(localStorage.getItem("xn-last-used-info")||"{}"),k=P.get(D.key);if(k){if(k.lastUsed=!0,D.provider==="UniversalProvider"){const B=await R1.init(IK);B.session&&(k.setUniversalProvider(B),console.log("Restored UniversalProvider for wallet:",k.key))}else D.provider==="EIP1193Provider"&&k.installed&&console.log("Using detected EIP1193Provider for wallet:",k.key);a(k)}}catch(D){console.log(D)}p(A),l(!0)}return Ee.useEffect(()=>{y(),va.setApiBase(e)},[]),ge.jsx(c8.Provider,{value:{saveLastUsedWallet:d,wallets:r,initialized:u,lastUsedWallet:o,featuredWallets:i},children:t.children})}/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const TK=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),c8=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/** + */const TK=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),u8=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -126,12 +126,12 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const DK=Se.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:s,iconNode:o,...a},u)=>Se.createElement("svg",{ref:u,...RK,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:c8("lucide",i),...a},[...o.map(([l,d])=>Se.createElement(l,d)),...Array.isArray(s)?s:[s]]));/** + */const DK=Ee.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:s,iconNode:o,...a},u)=>Ee.createElement("svg",{ref:u,...RK,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:u8("lucide",i),...a},[...o.map(([l,d])=>Ee.createElement(l,d)),...Array.isArray(s)?s:[s]]));/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ts=(t,e)=>{const r=Se.forwardRef(({className:n,...i},s)=>Se.createElement(DK,{ref:s,iconNode:e,className:c8(`lucide-${TK(t)}`,n),...i}));return r.displayName=`${t}`,r};/** + */const ts=(t,e)=>{const r=Ee.forwardRef(({className:n,...i},s)=>Ee.createElement(DK,{ref:s,iconNode:e,className:u8(`lucide-${TK(t)}`,n),...i}));return r.displayName=`${t}`,r};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -141,7 +141,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const u8=ts("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + */const f8=ts("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -166,7 +166,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const f8=ts("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** + */const l8=ts("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -186,12 +186,12 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const l8=ts("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + */const h8=ts("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jK=ts("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]),h8=new Set;function A0(t,e,r){t||h8.has(e)||(console.warn(e),h8.add(e))}function UK(t){if(typeof Proxy>"u")return t;const e=new Map,r=(...n)=>(process.env.NODE_ENV!=="production"&&A0(!1,"motion() is deprecated. Use motion.create() instead."),t(...n));return new Proxy(r,{get:(n,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}function P0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const vv=t=>Array.isArray(t);function d8(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function bv(t,e,r,n){if(typeof e=="function"){const[i,s]=p8(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=p8(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function M0(t,e,r){const n=t.getProps();return bv(n,e,r!==void 0?r:n.custom,t)}const yv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],wv=["initial",...yv],Gl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],bc=new Set(Gl),Qs=t=>t*1e3,Do=t=>t/1e3,qK={type:"spring",stiffness:500,damping:25,restSpeed:10},zK=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),HK={type:"keyframes",duration:.8},WK={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},KK=(t,{keyframes:e})=>e.length>2?HK:bc.has(t)?t.startsWith("scale")?zK(e[1]):qK:WK;function xv(t,e){return t?t[e]||t.default||t:void 0}const VK={useManualTiming:!1},GK=t=>t!==null;function I0(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(GK),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const Wn=t=>t;function YK(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){s.has(l)&&(u.schedule(l),t()),l(o)}const u={schedule:(l,d=!1,p=!1)=>{const A=p&&n?e:r;return d&&s.add(l),A.has(l)||A.add(l),l},cancel:l=>{r.delete(l),s.delete(l)},process:l=>{if(o=l,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,u.process(l))}};return u}const C0=["read","resolveKeyframes","update","preRender","render","postRender"],JK=40;function g8(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=C0.reduce((k,B)=>(k[B]=YK(s),k),{}),{read:a,resolveKeyframes:u,update:l,preRender:d,render:p,postRender:y}=o,A=()=>{const k=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(k-i.timestamp,JK),1),i.timestamp=k,i.isProcessing=!0,a.process(i),u.process(i),l.process(i),d.process(i),p.process(i),y.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(A))},P=()=>{r=!0,n=!0,i.isProcessing||t(A)};return{schedule:C0.reduce((k,B)=>{const j=o[B];return k[B]=(U,K=!1,J=!1)=>(r||P(),j.schedule(U,K,J)),k},{}),cancel:k=>{for(let B=0;B(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,XK=1e-7,ZK=12;function QK(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=m8(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>XK&&++aQK(s,0,1,t,r);return s=>s===0||s===1?s:m8(i(s),e,n)}const v8=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,b8=t=>e=>1-t(1-e),y8=Yl(.33,1.53,.69,.99),Ev=b8(y8),w8=v8(Ev),x8=t=>(t*=2)<1?.5*Ev(t):.5*(2-Math.pow(2,-10*(t-1))),Sv=t=>1-Math.sin(Math.acos(t)),_8=b8(Sv),E8=v8(Sv),S8=t=>/^0[^.\s]+$/u.test(t);function eV(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||S8(t):!0}let Lu=Wn,Oo=Wn;process.env.NODE_ENV!=="production"&&(Lu=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},Oo=(t,e)=>{if(!t)throw new Error(e)});const A8=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),P8=t=>e=>typeof e=="string"&&e.startsWith(t),M8=P8("--"),tV=P8("var(--"),Av=t=>tV(t)?rV.test(t.split("/*")[0].trim()):!1,rV=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,nV=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function iV(t){const e=nV.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}const sV=4;function I8(t,e,r=1){Oo(r<=sV,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[n,i]=iV(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return A8(o)?parseFloat(o):o}return Av(i)?I8(i,e,r+1):i}const ya=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},Jl={...ku,transform:t=>ya(0,1,t)},T0={...ku,default:1},Xl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),wa=Xl("deg"),eo=Xl("%"),zt=Xl("px"),oV=Xl("vh"),aV=Xl("vw"),C8={...eo,parse:t=>eo.parse(t)/100,transform:t=>eo.transform(t*100)},cV=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),T8=t=>t===ku||t===zt,R8=(t,e)=>parseFloat(t.split(", ")[e]),D8=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return R8(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?R8(s[1],t):0}},uV=new Set(["x","y","z"]),fV=Gl.filter(t=>!uV.has(t));function lV(t){const e=[];return fV.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const Bu={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:D8(4,13),y:D8(5,14)};Bu.translateX=Bu.x,Bu.translateY=Bu.y;const O8=t=>e=>e.test(t),N8=[ku,zt,eo,wa,aV,oV,{test:t=>t==="auto",parse:t=>t}],L8=t=>N8.find(O8(t)),yc=new Set;let Pv=!1,Mv=!1;function k8(){if(Mv){const t=Array.from(yc).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=lV(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}Mv=!1,Pv=!1,yc.forEach(t=>t.complete()),yc.clear()}function B8(){yc.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Mv=!0)})}function hV(){B8(),k8()}class Iv{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(yc.add(this),Pv||(Pv=!0,Nr.read(B8),Nr.resolveKeyframes(k8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sMath.round(t*1e5)/1e5,Cv=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function dV(t){return t==null}const pV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Tv=(t,e)=>r=>!!(typeof r=="string"&&pV.test(r)&&r.startsWith(t)||e&&!dV(r)&&Object.prototype.hasOwnProperty.call(r,e)),$8=(t,e,r)=>n=>{if(typeof n!="string")return n;const[i,s,o,a]=n.match(Cv);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},gV=t=>ya(0,255,t),Rv={...ku,transform:t=>Math.round(gV(t))},wc={test:Tv("rgb","red"),parse:$8("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+Rv.transform(t)+", "+Rv.transform(e)+", "+Rv.transform(r)+", "+Zl(Jl.transform(n))+")"};function mV(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const Dv={test:Tv("#"),parse:mV,transform:wc.transform},$u={test:Tv("hsl","hue"),parse:$8("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+eo.transform(Zl(e))+", "+eo.transform(Zl(r))+", "+Zl(Jl.transform(n))+")"},Zn={test:t=>wc.test(t)||Dv.test(t)||$u.test(t),parse:t=>wc.test(t)?wc.parse(t):$u.test(t)?$u.parse(t):Dv.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?wc.transform(t):$u.transform(t)},vV=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function bV(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Cv))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(vV))===null||r===void 0?void 0:r.length)||0)>0}const F8="number",j8="color",yV="var",wV="var(",U8="${}",xV=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ql(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(xV,u=>(Zn.test(u)?(n.color.push(s),i.push(j8),r.push(Zn.parse(u))):u.startsWith(wV)?(n.var.push(s),i.push(yV),r.push(u)):(n.number.push(s),i.push(F8),r.push(parseFloat(u))),++s,U8)).split(U8);return{values:r,split:a,indexes:n,types:i}}function q8(t){return Ql(t).values}function z8(t){const{split:e,types:r}=Ql(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function EV(t){const e=q8(t);return z8(t)(e.map(_V))}const xa={test:bV,parse:q8,createTransformer:z8,getAnimatableNone:EV},SV=new Set(["brightness","contrast","saturate","opacity"]);function AV(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(Cv)||[];if(!n)return t;const i=r.replace(n,"");let s=SV.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const PV=/\b([a-z-]*)\(.*?\)/gu,Ov={...xa,getAnimatableNone:t=>{const e=t.match(PV);return e?e.map(AV).join(" "):t}},MV={borderWidth:zt,borderTopWidth:zt,borderRightWidth:zt,borderBottomWidth:zt,borderLeftWidth:zt,borderRadius:zt,radius:zt,borderTopLeftRadius:zt,borderTopRightRadius:zt,borderBottomRightRadius:zt,borderBottomLeftRadius:zt,width:zt,maxWidth:zt,height:zt,maxHeight:zt,top:zt,right:zt,bottom:zt,left:zt,padding:zt,paddingTop:zt,paddingRight:zt,paddingBottom:zt,paddingLeft:zt,margin:zt,marginTop:zt,marginRight:zt,marginBottom:zt,marginLeft:zt,backgroundPositionX:zt,backgroundPositionY:zt},IV={rotate:wa,rotateX:wa,rotateY:wa,rotateZ:wa,scale:T0,scaleX:T0,scaleY:T0,scaleZ:T0,skew:wa,skewX:wa,skewY:wa,distance:zt,translateX:zt,translateY:zt,translateZ:zt,x:zt,y:zt,z:zt,perspective:zt,transformPerspective:zt,opacity:Jl,originX:C8,originY:C8,originZ:zt},H8={...ku,transform:Math.round},Nv={...MV,...IV,zIndex:H8,size:zt,fillOpacity:Jl,strokeOpacity:Jl,numOctaves:H8},CV={...Nv,color:Zn,backgroundColor:Zn,outlineColor:Zn,fill:Zn,stroke:Zn,borderColor:Zn,borderTopColor:Zn,borderRightColor:Zn,borderBottomColor:Zn,borderLeftColor:Zn,filter:Ov,WebkitFilter:Ov},Lv=t=>CV[t];function W8(t,e){let r=Lv(t);return r!==Ov&&(r=xa),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const TV=new Set(["auto","none","0"]);function RV(t,e,r){let n=0,i;for(;n{r.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function kv(t){return typeof t=="function"}let R0;function DV(){R0=void 0}const to={now:()=>(R0===void 0&&to.set(Kn.isProcessing||VK.useManualTiming?Kn.timestamp:performance.now()),R0),set:t=>{R0=t,queueMicrotask(DV)}},V8=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(xa.test(t)||t==="0")&&!t.startsWith("url("));function OV(t){const e=t[0];if(t.length===1)return!0;for(let r=0;rLV?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&hV(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=to.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:u,isGenerator:l}=this.options;if(!l&&!NV(e,n,i,s))if(o)this.options.duration=0;else{u==null||u(I0(e,this.options,r)),a==null||a(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,r);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...d},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function Y8(t,e){return e?t*(1e3/e):0}const kV=5;function J8(t,e,r){const n=Math.max(e-kV,0);return Y8(r-t(n),e-n)}const Bv=.001,BV=.01,X8=10,$V=.05,FV=1;function jV({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;Lu(t<=Qs(X8),"Spring duration must be 10 seconds or less");let o=1-e;o=ya($V,FV,o),t=ya(BV,X8,Do(t)),o<1?(i=l=>{const d=l*o,p=d*t,y=d-r,A=$v(l,o),P=Math.exp(-p);return Bv-y/A*P},s=l=>{const p=l*o*t,y=p*r+r,A=Math.pow(o,2)*Math.pow(l,2)*t,P=Math.exp(-p),N=$v(Math.pow(l,2),o);return(-i(l)+Bv>0?-1:1)*((y-A)*P)/N}):(i=l=>{const d=Math.exp(-l*t),p=(l-r)*t+1;return-Bv+d*p},s=l=>{const d=Math.exp(-l*t),p=(r-l)*(t*t);return d*p});const a=5/t,u=qV(i,s,a);if(t=Qs(t),isNaN(u))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(u,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:t}}}const UV=12;function qV(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function WV(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!Z8(t,HV)&&Z8(t,zV)){const r=jV(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function Q8({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:u,mass:l,duration:d,velocity:p,isResolvedFromDuration:y}=WV({...n,velocity:-Do(n.velocity||0)}),A=p||0,P=u/(2*Math.sqrt(a*l)),N=s-i,D=Do(Math.sqrt(a/l)),k=Math.abs(N)<5;r||(r=k?.01:2),e||(e=k?.005:.5);let B;if(P<1){const j=$v(D,P);B=U=>{const K=Math.exp(-P*D*U);return s-K*((A+P*D*N)/j*Math.sin(j*U)+N*Math.cos(j*U))}}else if(P===1)B=j=>s-Math.exp(-D*j)*(N+(A+D*N)*j);else{const j=D*Math.sqrt(P*P-1);B=U=>{const K=Math.exp(-P*D*U),J=Math.min(j*U,300);return s-K*((A+P*D*N)*Math.sinh(J)+j*N*Math.cosh(J))/j}}return{calculatedDuration:y&&d||null,next:j=>{const U=B(j);if(y)o.done=j>=d;else{let K=0;P<1&&(K=j===0?Qs(A):J8(B,j,U));const J=Math.abs(K)<=r,T=Math.abs(s-U)<=e;o.done=J&&T}return o.value=o.done?s:U,o}}}function eE({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:d}){const p=t[0],y={done:!1,value:p},A=z=>a!==void 0&&zu,P=z=>a===void 0?u:u===void 0||Math.abs(a-z)-N*Math.exp(-z/n),j=z=>k+B(z),U=z=>{const ue=B(z),_e=j(z);y.done=Math.abs(ue)<=l,y.value=y.done?k:_e};let K,J;const T=z=>{A(y.value)&&(K=z,J=Q8({keyframes:[y.value,P(y.value)],velocity:J8(j,z,y.value),damping:i,stiffness:s,restDelta:l,restSpeed:d}))};return T(0),{calculatedDuration:null,next:z=>{let ue=!1;return!J&&K===void 0&&(ue=!0,U(z),T(z)),K!==void 0&&z>=K?J.next(z-K):(!ue&&U(z),y)}}}const KV=Yl(.42,0,1,1),VV=Yl(0,0,.58,1),tE=Yl(.42,0,.58,1),GV=t=>Array.isArray(t)&&typeof t[0]!="number",Fv=t=>Array.isArray(t)&&typeof t[0]=="number",rE={linear:Wn,easeIn:KV,easeInOut:tE,easeOut:VV,circIn:Sv,circInOut:E8,circOut:_8,backIn:Ev,backInOut:w8,backOut:y8,anticipate:x8},nE=t=>{if(Fv(t)){Oo(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,r,n,i]=t;return Yl(e,r,n,i)}else if(typeof t=="string")return Oo(rE[t]!==void 0,`Invalid easing type '${t}'`),rE[t];return t},YV=(t,e)=>r=>e(t(r)),No=(...t)=>t.reduce(YV),Fu=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},Zr=(t,e,r)=>t+(e-t)*r;function jv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function JV({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,u=2*r-a;i=jv(u,a,t+1/3),s=jv(u,a,t),o=jv(u,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function D0(t,e){return r=>r>0?e:t}const Uv=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},XV=[Dv,wc,$u],ZV=t=>XV.find(e=>e.test(t));function iE(t){const e=ZV(t);if(Lu(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let r=e.parse(t);return e===$u&&(r=JV(r)),r}const sE=(t,e)=>{const r=iE(t),n=iE(e);if(!r||!n)return D0(t,e);const i={...r};return s=>(i.red=Uv(r.red,n.red,s),i.green=Uv(r.green,n.green,s),i.blue=Uv(r.blue,n.blue,s),i.alpha=Zr(r.alpha,n.alpha,s),wc.transform(i))},qv=new Set(["none","hidden"]);function QV(t,e){return qv.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function eG(t,e){return r=>Zr(t,e,r)}function zv(t){return typeof t=="number"?eG:typeof t=="string"?Av(t)?D0:Zn.test(t)?sE:nG:Array.isArray(t)?oE:typeof t=="object"?Zn.test(t)?sE:tG:D0}function oE(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>zv(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function rG(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=xa.createTransformer(e),n=Ql(t),i=Ql(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?qv.has(t)&&!i.values.length||qv.has(e)&&!n.values.length?QV(t,e):No(oE(rG(n,i),i.values),r):(Lu(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),D0(t,e))};function aE(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Zr(t,e,r):zv(t)(t,e)}function iG(t,e,r){const n=[],i=r||aE,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=iG(e,n,i),a=o.length,u=l=>{let d=0;if(a>1)for(;du(ya(t[0],t[s-1],l)):u}function oG(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=Fu(0,e,n);t.push(Zr(r,1,i))}}function aG(t){const e=[0];return oG(e,t.length-1),e}function cG(t,e){return t.map(r=>r*e)}function uG(t,e){return t.map(()=>e||tE).splice(0,t.length-1)}function O0({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=GV(n)?n.map(nE):nE(n),s={done:!1,value:e[0]},o=cG(r&&r.length===e.length?r:aG(e),t),a=sG(o,e,{ease:Array.isArray(i)?i:uG(e,i)});return{calculatedDuration:t,next:u=>(s.value=a(u),s.done=u>=t,s)}}const cE=2e4;function fG(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=cE?1/0:e}const lG=t=>{const e=({timestamp:r})=>t(r);return{start:()=>Nr.update(e,!0),stop:()=>ba(e),now:()=>Kn.isProcessing?Kn.timestamp:to.now()}},hG={decay:eE,inertia:eE,tween:O0,keyframes:O0,spring:Q8},dG=t=>t/100;class Hv extends G8{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:u}=this.options;u&&u()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Iv,a=(u,l)=>this.onKeyframesResolved(u,l);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=kv(r)?r:hG[r]||O0;let u,l;a!==O0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&Oo(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),u=No(dG,aE(e[0],e[1])),e=[0,100]);const d=a({...this.options,keyframes:e});s==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=fG(d));const{calculatedDuration:p}=d,y=p+i,A=y*(n+1)-i;return{generator:d,mirroredGenerator:l,mapPercentToKeyframes:u,calculatedDuration:p,resolvedDuration:y,totalDuration:A}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:z}=this.options;return{done:!0,value:z[z.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:u,calculatedDuration:l,totalDuration:d,resolvedDuration:p}=n;if(this.startTime===null)return s.next(0);const{delay:y,repeat:A,repeatType:P,repeatDelay:N,onUpdate:D}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const k=this.currentTime-y*(this.speed>=0?1:-1),B=this.speed>=0?k<0:k>d;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let j=this.currentTime,U=s;if(A){const z=Math.min(this.currentTime,d)/p;let ue=Math.floor(z),_e=z%1;!_e&&z>=1&&(_e=1),_e===1&&ue--,ue=Math.min(ue,A+1),!!(ue%2)&&(P==="reverse"?(_e=1-_e,N&&(_e-=N/p)):P==="mirror"&&(U=o)),j=ya(0,1,_e)*p}const K=B?{done:!1,value:u[0]}:U.next(j);a&&(K.value=a(K.value));let{done:J}=K;!B&&l!==null&&(J=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&J);return T&&i!==void 0&&(K.value=I0(u,this.options,i)),D&&D(K.value),T&&this.finish(),K}get duration(){const{resolved:e}=this;return e?Do(e.calculatedDuration):0}get time(){return Do(this.currentTime)}set time(e){e=Qs(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=Do(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=lG,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const pG=new Set(["opacity","clipPath","filter","transform"]),gG=10,mG=(t,e)=>{let r="";const n=Math.max(Math.round(e/gG),2);for(let i=0;i(e===void 0&&(e=t()),e)}const vG={linearEasing:void 0};function bG(t,e){const r=Wv(t);return()=>{var n;return(n=vG[e])!==null&&n!==void 0?n:r()}}const N0=bG(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function uE(t){return!!(typeof t=="function"&&N0()||!t||typeof t=="string"&&(t in Kv||N0())||Fv(t)||Array.isArray(t)&&t.every(uE))}const eh=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,Kv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:eh([0,.65,.55,1]),circOut:eh([.55,0,1,.45]),backIn:eh([.31,.01,.66,-.59]),backOut:eh([.33,1.53,.69,.99])};function fE(t,e){if(t)return typeof t=="function"&&N0()?mG(t,e):Fv(t)?eh(t):Array.isArray(t)?t.map(r=>fE(r,e)||Kv.easeOut):Kv[t]}function yG(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:u}={}){const l={[e]:r};u&&(l.offset=u);const d=fE(a,i);return Array.isArray(d)&&(l.easing=d),t.animate(l,{delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function lE(t,e){t.timeline=e,t.onfinish=null}const wG=Wv(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),L0=10,xG=2e4;function _G(t){return kv(t.type)||t.type==="spring"||!uE(t.ease)}function EG(t,e){const r=new Hv({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&sthis.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:u,name:l,startTime:d}=this.options;if(!(!((n=u.owner)===null||n===void 0)&&n.current))return!1;if(typeof o=="string"&&N0()&&SG(o)&&(o=hE[o]),_G(this.options)){const{onComplete:y,onUpdate:A,motionValue:P,element:N,...D}=this.options,k=EG(e,D);e=k.keyframes,e.length===1&&(e[1]=e[0]),i=k.duration,s=k.times,o=k.ease,a="keyframes"}const p=yG(u.owner.current,l,e,{...this.options,duration:i,times:s,ease:o});return p.startTime=d??this.calcStartTime(),this.pendingTimeline?(lE(p,this.pendingTimeline),this.pendingTimeline=void 0):p.onfinish=()=>{const{onComplete:y}=this.options;u.set(I0(e,this.options,r)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:p,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return Do(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return Do(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=Qs(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return Wn;const{animation:n}=r;lE(n,e)}return Wn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:d,onComplete:p,element:y,...A}=this.options,P=new Hv({...A,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),N=Qs(this.time);l.setWithVelocity(P.sample(N-L0).value,P.sample(N).value,L0)}const{onStop:u}=this.options;u&&u(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return wG()&&n&&pG.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}const AG=Wv(()=>window.ScrollTimeline!==void 0);class PG{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;nAG()&&i.attachTimeline?i.attachTimeline(e):r(i));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function MG({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:u,elapsed:l,...d}){return!!Object.keys(d).length}const Vv=(t,e,r,n={},i,s)=>o=>{const a=xv(n,t)||{},u=a.delay||n.delay||0;let{elapsed:l=0}=n;l=l-Qs(u);let d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:y=>{e.set(y),a.onUpdate&&a.onUpdate(y)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:i};MG(a)||(d={...d,...KK(t,d)}),d.duration&&(d.duration=Qs(d.duration)),d.repeatDelay&&(d.repeatDelay=Qs(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let p=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(p=!0)),p&&!s&&e.get()!==void 0){const y=I0(d.keyframes,a);if(y!==void 0)return Nr.update(()=>{d.onUpdate(y),d.onComplete()}),new PG([])}return!s&&dE.supports(d)?new dE(d):new Hv(d)},IG=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),CG=t=>vv(t)?t[t.length-1]||0:t;function Gv(t,e){t.indexOf(e)===-1&&t.push(e)}function Yv(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class Jv{constructor(){this.subscriptions=[]}add(e){return Gv(this.subscriptions,e),()=>Yv(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class RG{constructor(e,r={}){this.version="11.11.17",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=to.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=to.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=TG(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&A0(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new Jv);const n=this.events[e].add(r);return e==="change"?()=>{n(),Nr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=to.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>pE)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,pE);return Y8(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function th(t,e){return new RG(t,e)}function DG(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,th(r))}function OG(t,e){const r=M0(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=CG(s[o]);DG(t,o,a)}}const Xv=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),gE="data-"+Xv("framerAppearId");function mE(t){return t.props[gE]}const Qn=t=>!!(t&&t.getVelocity);function NG(t){return!!(Qn(t)&&t.add)}function Zv(t,e){const r=t.getValue("willChange");if(NG(r))return r.add(e)}function LG({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function vE(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...u}=e;n&&(o=n);const l=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const p in u){const y=t.getValue(p,(s=t.latestValues[p])!==null&&s!==void 0?s:null),A=u[p];if(A===void 0||d&&LG(d,p))continue;const P={delay:r,...xv(o||{},p)};let N=!1;if(window.MotionHandoffAnimation){const k=mE(t);if(k){const B=window.MotionHandoffAnimation(k,p,Nr);B!==null&&(P.startTime=B,N=!0)}}Zv(t,p),y.start(Vv(p,y,A,t.shouldReduceMotion&&bc.has(p)?{type:!1}:P,t,N));const D=y.animation;D&&l.push(D)}return a&&Promise.all(l).then(()=>{Nr.update(()=>{a&&OG(t,a)})}),l}function Qv(t,e,r={}){var n;const i=M0(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(vE(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:y}=s;return kG(t,e,d+l,p,y,r)}:()=>Promise.resolve(),{when:u}=s;if(u){const[l,d]=u==="beforeChildren"?[o,a]:[a,o];return l().then(()=>d())}else return Promise.all([o(),a(r.delay)])}function kG(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,u=i===1?(l=0)=>l*n:(l=0)=>a-l*n;return Array.from(t.variantChildren).sort(BG).forEach((l,d)=>{l.notify("AnimationStart",e),o.push(Qv(l,e,{...s,delay:r+u(d)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function BG(t,e){return t.sortNodePosition(e)}function $G(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>Qv(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=Qv(t,e,r);else{const i=typeof e=="function"?M0(t,e,r.custom):e;n=Promise.all(vE(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const FG=wv.length;function bE(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?bE(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;rPromise.all(e.map(({animation:r,options:n})=>$G(t,r,n)))}function zG(t){let e=qG(t),r=yE(),n=!0;const i=u=>(l,d)=>{var p;const y=M0(t,d,u==="exit"?(p=t.presenceContext)===null||p===void 0?void 0:p.custom:void 0);if(y){const{transition:A,transitionEnd:P,...N}=y;l={...l,...N,...P}}return l};function s(u){e=u(t)}function o(u){const{props:l}=t,d=bE(t.parent)||{},p=[],y=new Set;let A={},P=1/0;for(let D=0;DP&&U,ue=!1;const _e=Array.isArray(j)?j:[j];let G=_e.reduce(i(k),{});K===!1&&(G={});const{prevResolvedValues:E={}}=B,m={...E,...G},f=x=>{z=!0,y.has(x)&&(ue=!0,y.delete(x)),B.needsAnimating[x]=!0;const _=t.getValue(x);_&&(_.liveStyle=!1)};for(const x in m){const _=G[x],S=E[x];if(A.hasOwnProperty(x))continue;let b=!1;vv(_)&&vv(S)?b=!d8(_,S):b=_!==S,b?_!=null?f(x):y.add(x):_!==void 0&&y.has(x)?f(x):B.protectedKeys[x]=!0}B.prevProp=j,B.prevResolvedValues=G,B.isActive&&(A={...A,...G}),n&&t.blockInitialAnimation&&(z=!1),z&&(!(J&&T)||ue)&&p.push(..._e.map(x=>({animation:x,options:{type:k}})))}if(y.size){const D={};y.forEach(k=>{const B=t.getBaseTarget(k),j=t.getValue(k);j&&(j.liveStyle=!0),D[k]=B??null}),p.push({animation:D})}let N=!!p.length;return n&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(N=!1),n=!1,N?e(p):Promise.resolve()}function a(u,l){var d;if(r[u].isActive===l)return Promise.resolve();(d=t.variantChildren)===null||d===void 0||d.forEach(y=>{var A;return(A=y.animationState)===null||A===void 0?void 0:A.setActive(u,l)}),r[u].isActive=l;const p=o(u);for(const y in r)r[y].protectedKeys={};return p}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=yE(),n=!0}}}function HG(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!d8(e,t):!1}function xc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function yE(){return{animate:xc(!0),whileInView:xc(),whileHover:xc(),whileTap:xc(),whileDrag:xc(),whileFocus:xc(),exit:xc()}}class _a{constructor(e){this.isMounted=!1,this.node=e}update(){}}class WG extends _a{constructor(e){super(e),e.animationState||(e.animationState=zG(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();P0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let KG=0;class VG extends _a{constructor(){super(...arguments),this.id=KG++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const GG={animation:{Feature:WG},exit:{Feature:VG}},wE=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function k0(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const YG=t=>e=>wE(e)&&t(e,k0(e));function Lo(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function ko(t,e,r,n){return Lo(t,e,YG(r),n)}const xE=(t,e)=>Math.abs(t-e);function JG(t,e){const r=xE(t.x,e.x),n=xE(t.y,e.y);return Math.sqrt(r**2+n**2)}class _E{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=tb(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,A=JG(p.offset,{x:0,y:0})>=3;if(!y&&!A)return;const{point:P}=p,{timestamp:N}=Kn;this.history.push({...P,timestamp:N});const{onStart:D,onMove:k}=this.handlers;y||(D&&D(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,p)},this.handlePointerMove=(p,y)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=eb(y,this.transformPagePoint),Nr.update(this.updatePoint,!0)},this.handlePointerUp=(p,y)=>{this.end();const{onEnd:A,onSessionEnd:P,resumeAnimation:N}=this.handlers;if(this.dragSnapToOrigin&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=tb(p.type==="pointercancel"?this.lastMoveEventInfo:eb(y,this.transformPagePoint),this.history);this.startEvent&&A&&A(p,D),P&&P(p,D)},!wE(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=k0(e),a=eb(o,this.transformPagePoint),{point:u}=a,{timestamp:l}=Kn;this.history=[{...u,timestamp:l}];const{onSessionStart:d}=r;d&&d(e,tb(a,this.history)),this.removeListeners=No(ko(this.contextWindow,"pointermove",this.handlePointerMove),ko(this.contextWindow,"pointerup",this.handlePointerUp),ko(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),ba(this.updatePoint)}}function eb(t,e){return e?{point:e(t.point)}:t}function EE(t,e){return{x:t.x-e.x,y:t.y-e.y}}function tb({point:t},e){return{point:t,delta:EE(t,SE(e)),offset:EE(t,XG(e)),velocity:ZG(e,.1)}}function XG(t){return t[0]}function SE(t){return t[t.length-1]}function ZG(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=SE(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>Qs(e)));)r--;if(!n)return{x:0,y:0};const s=Do(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function AE(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const PE=AE("dragHorizontal"),ME=AE("dragVertical");function IE(t){let e=!1;if(t==="y")e=ME();else if(t==="x")e=PE();else{const r=PE(),n=ME();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function CE(){const t=IE(!0);return t?(t(),!1):!0}function ju(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const TE=1e-4,QG=1-TE,eY=1+TE,RE=.01,tY=0-RE,rY=0+RE;function Ni(t){return t.max-t.min}function nY(t,e,r){return Math.abs(t-e)<=r}function DE(t,e,r,n=.5){t.origin=n,t.originPoint=Zr(e.min,e.max,t.origin),t.scale=Ni(r)/Ni(e),t.translate=Zr(r.min,r.max,t.origin)-t.originPoint,(t.scale>=QG&&t.scale<=eY||isNaN(t.scale))&&(t.scale=1),(t.translate>=tY&&t.translate<=rY||isNaN(t.translate))&&(t.translate=0)}function rh(t,e,r,n){DE(t.x,e.x,r.x,n?n.originX:void 0),DE(t.y,e.y,r.y,n?n.originY:void 0)}function OE(t,e,r){t.min=r.min+e.min,t.max=t.min+Ni(e)}function iY(t,e,r){OE(t.x,e.x,r.x),OE(t.y,e.y,r.y)}function NE(t,e,r){t.min=e.min-r.min,t.max=t.min+Ni(e)}function nh(t,e,r){NE(t.x,e.x,r.x),NE(t.y,e.y,r.y)}function sY(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?Zr(r,t,n.max):Math.min(t,r)),t}function LE(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function oY(t,{top:e,left:r,bottom:n,right:i}){return{x:LE(t.x,r,i),y:LE(t.y,e,n)}}function kE(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=Fu(e.min,e.max-n,t.min):n>i&&(r=Fu(t.min,t.max-i,e.min)),ya(0,1,r)}function uY(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const rb=.35;function fY(t=rb){return t===!1?t=0:t===!0&&(t=rb),{x:BE(t,"left","right"),y:BE(t,"top","bottom")}}function BE(t,e,r){return{min:$E(t,e),max:$E(t,r)}}function $E(t,e){return typeof t=="number"?t:t[e]||0}const FE=()=>({translate:0,scale:1,origin:0,originPoint:0}),Uu=()=>({x:FE(),y:FE()}),jE=()=>({min:0,max:0}),ln=()=>({x:jE(),y:jE()});function rs(t){return[t("x"),t("y")]}function UE({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function lY({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function hY(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function nb(t){return t===void 0||t===1}function ib({scale:t,scaleX:e,scaleY:r}){return!nb(t)||!nb(e)||!nb(r)}function _c(t){return ib(t)||qE(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function qE(t){return zE(t.x)||zE(t.y)}function zE(t){return t&&t!=="0%"}function B0(t,e,r){const n=t-r,i=e*n;return r+i}function HE(t,e,r,n,i){return i!==void 0&&(t=B0(t,i,n)),B0(t,r,n)+e}function sb(t,e=0,r=1,n,i){t.min=HE(t.min,e,r,n,i),t.max=HE(t.max,e,r,n,i)}function WE(t,{x:e,y:r}){sb(t.x,e.translate,e.scale,e.originPoint),sb(t.y,r.translate,r.scale,r.originPoint)}const KE=.999999999999,VE=1.0000000000001;function dY(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;aKE&&(e.x=1),e.yKE&&(e.y=1)}function qu(t,e){t.min=t.min+e,t.max=t.max+e}function GE(t,e,r,n,i=.5){const s=Zr(t.min,t.max,i);sb(t,e,r,s,n)}function zu(t,e){GE(t.x,e.x,e.scaleX,e.scale,e.originX),GE(t.y,e.y,e.scaleY,e.scale,e.originY)}function YE(t,e){return UE(hY(t.getBoundingClientRect(),e))}function pY(t,e,r){const n=YE(t,r),{scroll:i}=e;return i&&(qu(n.x,i.offset.x),qu(n.y,i.offset.y)),n}const JE=({current:t})=>t?t.ownerDocument.defaultView:null,gY=new WeakMap;class mY{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ln(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:p}=this.getProps();p?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(k0(d,"page").point)},s=(d,p)=>{const{drag:y,dragPropagation:A,onDragStart:P}=this.getProps();if(y&&!A&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=IE(y),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),rs(D=>{let k=this.getAxisMotionValue(D).get()||0;if(eo.test(k)){const{projection:B}=this.visualElement;if(B&&B.layout){const j=B.layout.layoutBox[D];j&&(k=Ni(j)*(parseFloat(k)/100))}}this.originPoint[D]=k}),P&&Nr.postRender(()=>P(d,p)),Zv(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},o=(d,p)=>{const{dragPropagation:y,dragDirectionLock:A,onDirectionLock:P,onDrag:N}=this.getProps();if(!y&&!this.openGlobalLock)return;const{offset:D}=p;if(A&&this.currentDirection===null){this.currentDirection=vY(D),this.currentDirection!==null&&P&&P(this.currentDirection);return}this.updateAxis("x",p.point,D),this.updateAxis("y",p.point,D),this.visualElement.render(),N&&N(d,p)},a=(d,p)=>this.stop(d,p),u=()=>rs(d=>{var p;return this.getAnimationState(d)==="paused"&&((p=this.getAxisMotionValue(d).animation)===null||p===void 0?void 0:p.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new _E(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:JE(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Nr.postRender(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!$0(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=sY(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&ju(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=oY(i.layoutBox,r):this.constraints=!1,this.elastic=fY(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&rs(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=uY(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!ju(e))return!1;const n=e.current;Oo(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=pY(n,i.root,this.visualElement.getTransformPagePoint());let o=aY(i.layout.layoutBox,s);if(r){const a=r(lY(o));this.hasMutatedConstraints=!!a,a&&(o=UE(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),u=this.constraints||{},l=rs(d=>{if(!$0(d,r,this.currentDirection))return;let p=u&&u[d]||{};o&&(p={min:0,max:0});const y=i?200:1e6,A=i?40:1e7,P={type:"inertia",velocity:n?e[d]:0,bounceStiffness:y,bounceDamping:A,timeConstant:750,restDelta:1,restSpeed:10,...s,...p};return this.startAxisValueAnimation(d,P)});return Promise.all(l).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return Zv(this.visualElement,e),n.start(Vv(e,n,0,r,this.visualElement,!1))}stopAnimation(){rs(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){rs(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){rs(r=>{const{drag:n}=this.getProps();if(!$0(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-Zr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!ju(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};rs(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const u=a.get();i[o]=cY({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),rs(o=>{if(!$0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:u,max:l}=this.constraints[o];a.set(Zr(u,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;gY.set(this.visualElement,this);const e=this.visualElement.current,r=ko(e,"pointerdown",u=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();ju(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Nr.read(n);const o=Lo(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(rs(d=>{const p=this.getAxisMotionValue(d);p&&(this.originPoint[d]+=u[d].translate,p.set(p.get()+u[d].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=rb,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function $0(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function vY(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class bY extends _a{constructor(e){super(e),this.removeGroupControls=Wn,this.removeListeners=Wn,this.controls=new mY(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Wn}unmount(){this.removeGroupControls(),this.removeListeners()}}const XE=t=>(e,r)=>{t&&Nr.postRender(()=>t(e,r))};class yY extends _a{constructor(){super(...arguments),this.removePointerDownListener=Wn}onPointerDown(e){this.session=new _E(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:JE(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:XE(e),onStart:XE(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&Nr.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=ko(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const F0=Se.createContext(null);function wY(){const t=Se.useContext(F0);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=Se.useId();Se.useEffect(()=>n(i),[]);const s=Se.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const ob=Se.createContext({}),ZE=Se.createContext({}),j0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function QE(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ih={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(zt.test(t))t=parseFloat(t);else return t;const r=QE(t,e.target.x),n=QE(t,e.target.y);return`${r}% ${n}%`}},xY={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=xa.parse(t);if(i.length>5)return n;const s=xa.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,u=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=u;const l=Zr(a,u,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),s(i)}},U0={};function _Y(t){Object.assign(U0,t)}const{schedule:ab}=g8(queueMicrotask,!1);class EY extends Se.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;_Y(SY),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),j0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Nr.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ab.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function eS(t){const[e,r]=wY(),n=Se.useContext(ob);return ge.jsx(EY,{...t,layoutGroup:n,switchLayoutGroup:Se.useContext(ZE),isPresent:e,safeToRemove:r})}const SY={borderRadius:{...ih,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ih,borderTopRightRadius:ih,borderBottomLeftRadius:ih,borderBottomRightRadius:ih,boxShadow:xY},tS=["TopLeft","TopRight","BottomLeft","BottomRight"],AY=tS.length,rS=t=>typeof t=="string"?parseFloat(t):t,nS=t=>typeof t=="number"||zt.test(t);function PY(t,e,r,n,i,s){i?(t.opacity=Zr(0,r.opacity!==void 0?r.opacity:1,MY(n)),t.opacityExit=Zr(e.opacity!==void 0?e.opacity:1,0,IY(n))):s&&(t.opacity=Zr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(Fu(t,e,n))}function oS(t,e){t.min=e.min,t.max=e.max}function ns(t,e){oS(t.x,e.x),oS(t.y,e.y)}function aS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function cS(t,e,r,n,i){return t-=e,t=B0(t,1/r,n),i!==void 0&&(t=B0(t,1/i,n)),t}function CY(t,e=0,r=1,n=.5,i,s=t,o=t){if(eo.test(e)&&(e=parseFloat(e),e=Zr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Zr(s.min,s.max,n);t===s&&(a-=e),t.min=cS(t.min,e,r,a,i),t.max=cS(t.max,e,r,a,i)}function uS(t,e,[r,n,i],s,o){CY(t,e[r],e[n],e[i],e.scale,s,o)}const TY=["x","scaleX","originX"],RY=["y","scaleY","originY"];function fS(t,e,r,n){uS(t.x,e,TY,r?r.x:void 0,n?n.x:void 0),uS(t.y,e,RY,r?r.y:void 0,n?n.y:void 0)}function lS(t){return t.translate===0&&t.scale===1}function hS(t){return lS(t.x)&&lS(t.y)}function dS(t,e){return t.min===e.min&&t.max===e.max}function DY(t,e){return dS(t.x,e.x)&&dS(t.y,e.y)}function pS(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function gS(t,e){return pS(t.x,e.x)&&pS(t.y,e.y)}function mS(t){return Ni(t.x)/Ni(t.y)}function vS(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class OY{constructor(){this.members=[]}add(e){Gv(this.members,e),e.scheduleRender()}remove(e){if(Yv(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function NY(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:l,rotate:d,rotateX:p,rotateY:y,skewX:A,skewY:P}=r;l&&(n=`perspective(${l}px) ${n}`),d&&(n+=`rotate(${d}deg) `),p&&(n+=`rotateX(${p}deg) `),y&&(n+=`rotateY(${y}deg) `),A&&(n+=`skewX(${A}deg) `),P&&(n+=`skewY(${P}deg) `)}const a=t.x.scale*e.x,u=t.y.scale*e.y;return(a!==1||u!==1)&&(n+=`scale(${a}, ${u})`),n||"none"}const LY=(t,e)=>t.depth-e.depth;class kY{constructor(){this.children=[],this.isDirty=!1}add(e){Gv(this.children,e),this.isDirty=!0}remove(e){Yv(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(LY),this.isDirty=!1,this.children.forEach(e)}}function q0(t){const e=Qn(t)?t.get():t;return IG(e)?e.toValue():e}function BY(t,e){const r=to.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(ba(n),t(s-e))};return Nr.read(n,!0),()=>ba(n)}function $Y(t){return t instanceof SVGElement&&t.tagName!=="svg"}function FY(t,e,r){const n=Qn(t)?t:th(t);return n.start(Vv("",n,e,r)),n.animation}const Ec={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},sh=typeof window<"u"&&window.MotionDebug!==void 0,cb=["","X","Y","Z"],jY={visibility:"hidden"},bS=1e3;let UY=0;function ub(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function yS(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=mE(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Nr,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&yS(n)}function wS({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=UY++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,sh&&(Ec.totalNodes=Ec.resolvedTargetDeltas=Ec.recalculatedProjection=0),this.nodes.forEach(HY),this.nodes.forEach(YY),this.nodes.forEach(JY),this.nodes.forEach(WY),sh&&window.MotionDebug.record(Ec)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let u=0;uthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,p&&p(),p=BY(y,250),j0.hasAnimatedSinceResize&&(j0.hasAnimatedSinceResize=!1,this.nodes.forEach(_S))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&d&&(u||l)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:y,hasRelativeTargetChanged:A,layout:P})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const N=this.options.transition||d.getDefaultTransition()||tJ,{onLayoutAnimationStart:D,onLayoutAnimationComplete:k}=d.getProps(),B=!this.targetLayout||!gS(this.targetLayout,P)||A,j=!y&&A;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||j||y&&(B||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(p,j);const U={...xv(N,"layout"),onPlay:D,onComplete:k};(d.shouldReduceMotion||this.options.layoutRoot)&&(U.delay=0,U.type=!1),this.startAnimation(U)}else y||_S(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=P})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,ba(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(XY),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&yS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u{const K=U/1e3;ES(p.x,o.x,K),ES(p.y,o.y,K),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(nh(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),QY(this.relativeTarget,this.relativeTargetOrigin,y,K),j&&DY(this.relativeTarget,j)&&(this.isProjectionDirty=!1),j||(j=ln()),ns(j,this.relativeTarget)),N&&(this.animationValues=d,PY(d,l,this.latestValues,K,B,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=K},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(ba(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nr.update(()=>{j0.hasAnimatedSinceResize=!0,this.currentAnimation=FY(0,bS,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(bS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:u,layout:l,latestValues:d}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&IS(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||ln();const p=Ni(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+p;const y=Ni(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+y}ns(a,u),zu(a,d),rh(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new OY),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(a=!0),!a)return;const l={};u.z&&ub("z",o,l,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(xS),this.root.sharedNodes.clear()}}}function qY(t){t.updateLayout()}function zY(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?rs(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],A=Ni(y);y.min=n[p].min,y.max=y.min+A}):IS(s,r.layoutBox,n)&&rs(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],A=Ni(n[p]);y.max=y.min+A,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[p].max=t.relativeTarget[p].min+A)});const a=Uu();rh(a,n,r.layoutBox);const u=Uu();o?rh(u,t.applyTransform(i,!0),r.measuredBox):rh(u,n,r.layoutBox);const l=!hS(a);let d=!1;if(!t.resumeFrom){const p=t.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:y,layout:A}=p;if(y&&A){const P=ln();nh(P,r.layoutBox,y.layoutBox);const N=ln();nh(N,n,A.layoutBox),gS(P,N)||(d=!0),p.options.layoutRoot&&(t.relativeTarget=N,t.relativeTargetOrigin=P,t.relativeParent=p)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:u,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function HY(t){sh&&Ec.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function WY(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function KY(t){t.clearSnapshot()}function xS(t){t.clearMeasurements()}function VY(t){t.isLayoutDirty=!1}function GY(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function _S(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function YY(t){t.resolveTargetDelta()}function JY(t){t.calcProjection()}function XY(t){t.resetSkewAndRotation()}function ZY(t){t.removeLeadSnapshot()}function ES(t,e,r){t.translate=Zr(e.translate,0,r),t.scale=Zr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function SS(t,e,r,n){t.min=Zr(e.min,r.min,n),t.max=Zr(e.max,r.max,n)}function QY(t,e,r,n){SS(t.x,e.x,r.x,n),SS(t.y,e.y,r.y,n)}function eJ(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const tJ={duration:.45,ease:[.4,0,.1,1]},AS=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),PS=AS("applewebkit/")&&!AS("chrome/")?Math.round:Wn;function MS(t){t.min=PS(t.min),t.max=PS(t.max)}function rJ(t){MS(t.x),MS(t.y)}function IS(t,e,r){return t==="position"||t==="preserve-aspect"&&!nY(mS(e),mS(r),.2)}function nJ(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const iJ=wS({attachResizeListener:(t,e)=>Lo(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),fb={current:void 0},CS=wS({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!fb.current){const t=new iJ({});t.mount(window),t.setOptions({layoutScroll:!0}),fb.current=t}return fb.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),sJ={pan:{Feature:yY},drag:{Feature:bY,ProjectionNode:CS,MeasureLayout:eS}};function TS(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||CE())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const u=a[n];u&&Nr.postRender(()=>u(s,o))};return ko(t.current,r,i,{passive:!t.getProps()[n]})}class oJ extends _a{mount(){this.unmount=No(TS(this.node,!0),TS(this.node,!1))}unmount(){}}class aJ extends _a{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=No(Lo(this.node.current,"focus",()=>this.onFocus()),Lo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const RS=(t,e)=>e?t===e?!0:RS(t,e.parentElement):!1;function lb(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,k0(r))}class cJ extends _a{constructor(){super(...arguments),this.removeStartListeners=Wn,this.removeEndListeners=Wn,this.removeAccessibleListeners=Wn,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=ko(window,"pointerup",(a,u)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:d,globalTapTarget:p}=this.node.getProps(),y=!p&&!RS(this.node.current,a.target)?d:l;y&&Nr.update(()=>y(a,u))},{passive:!(n.onTap||n.onPointerUp)}),o=ko(window,"pointercancel",(a,u)=>this.cancelPress(a,u),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=No(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||lb("up",(u,l)=>{const{onTap:d}=this.node.getProps();d&&Nr.postRender(()=>d(u,l))})};this.removeEndListeners(),this.removeEndListeners=Lo(this.node.current,"keyup",o),lb("down",(a,u)=>{this.startPress(a,u)})},r=Lo(this.node.current,"keydown",e),n=()=>{this.isPressing&&lb("cancel",(s,o)=>this.cancelPress(s,o))},i=Lo(this.node.current,"blur",n);this.removeAccessibleListeners=No(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Nr.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!CE()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Nr.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=ko(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=Lo(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=No(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const hb=new WeakMap,db=new WeakMap,uJ=t=>{const e=hb.get(t.target);e&&e(t)},fJ=t=>{t.forEach(uJ)};function lJ({root:t,...e}){const r=t||document;db.has(r)||db.set(r,{});const n=db.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(fJ,{root:t,...e})),n[i]}function hJ(t,e,r){const n=lJ(e);return hb.set(t,r),n.observe(t),()=>{hb.delete(t),n.unobserve(t)}}const dJ={some:0,all:1};class pJ extends _a{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:dJ[i]},a=u=>{const{isIntersecting:l}=u;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:p}=this.node.getProps(),y=l?d:p;y&&y(u)};return hJ(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(gJ(e,r))&&this.startObserver()}unmount(){}}function gJ({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const mJ={inView:{Feature:pJ},tap:{Feature:cJ},focus:{Feature:aJ},hover:{Feature:oJ}},vJ={layout:{ProjectionNode:CS,MeasureLayout:eS}},pb=Se.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),z0=Se.createContext({}),gb=typeof window<"u",DS=gb?Se.useLayoutEffect:Se.useEffect,OS=Se.createContext({strict:!1});function bJ(t,e,r,n,i){var s,o;const{visualElement:a}=Se.useContext(z0),u=Se.useContext(OS),l=Se.useContext(F0),d=Se.useContext(pb).reducedMotion,p=Se.useRef();n=n||u.renderer,!p.current&&n&&(p.current=n(t,{visualState:e,parent:a,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d}));const y=p.current,A=Se.useContext(ZE);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&yJ(p.current,r,i,A);const P=Se.useRef(!1);Se.useInsertionEffect(()=>{y&&P.current&&y.update(r,l)});const N=r[gE],D=Se.useRef(!!N&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,N))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,N)));return DS(()=>{y&&(P.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),ab.render(y.render),D.current&&y.animationState&&y.animationState.animateChanges())}),Se.useEffect(()=>{y&&(!D.current&&y.animationState&&y.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{var k;(k=window.MotionHandoffMarkAsComplete)===null||k===void 0||k.call(window,N)}),D.current=!1))}),y}function yJ(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:u,layoutRoot:l}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:NS(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&ju(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:u,layoutRoot:l})}function NS(t){if(t)return t.options.allowProjection!==!1?t.projection:NS(t.parent)}function wJ(t,e,r){return Se.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):ju(r)&&(r.current=n))},[e])}function H0(t){return P0(t.animate)||wv.some(e=>Vl(t[e]))}function LS(t){return!!(H0(t)||t.variants)}function xJ(t,e){if(H0(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Vl(r)?r:void 0,animate:Vl(n)?n:void 0}}return t.inherit!==!1?e:{}}function _J(t){const{initial:e,animate:r}=xJ(t,Se.useContext(z0));return Se.useMemo(()=>({initial:e,animate:r}),[kS(e),kS(r)])}function kS(t){return Array.isArray(t)?t.join(" "):t}const BS={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Hu={};for(const t in BS)Hu[t]={isEnabled:e=>BS[t].some(r=>!!e[r])};function EJ(t){for(const e in t)Hu[e]={...Hu[e],...t[e]}}const SJ=Symbol.for("motionComponentSymbol");function AJ({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&EJ(t);function s(a,u){let l;const d={...Se.useContext(pb),...a,layoutId:PJ(a)},{isStatic:p}=d,y=_J(a),A=n(a,p);if(!p&&gb){MJ(d,t);const P=IJ(d);l=P.MeasureLayout,y.visualElement=bJ(i,A,d,e,P.ProjectionNode)}return ge.jsxs(z0.Provider,{value:y,children:[l&&y.visualElement?ge.jsx(l,{visualElement:y.visualElement,...d}):null,r(i,a,wJ(A,y.visualElement,u),A,p,y.visualElement)]})}const o=Se.forwardRef(s);return o[SJ]=i,o}function PJ({layoutId:t}){const e=Se.useContext(ob).id;return e&&t!==void 0?e+"-"+t:t}function MJ(t,e){const r=Se.useContext(OS).strict;if(process.env.NODE_ENV!=="production"&&e&&r){const n="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?Lu(!1,n):Oo(!1,n)}}function IJ(t){const{drag:e,layout:r}=Hu;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const CJ=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function mb(t){return typeof t!="string"||t.includes("-")?!1:!!(CJ.indexOf(t)>-1||/[A-Z]/u.test(t))}function $S(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const FS=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function jS(t,e,r,n){$S(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(FS.has(i)?i:Xv(i),e.attrs[i])}function US(t,{layout:e,layoutId:r}){return bc.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!U0[t]||t==="opacity")}function vb(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(Qn(i[o])||e.style&&Qn(e.style[o])||US(o,t)||((n=r==null?void 0:r.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function qS(t,e,r){const n=vb(t,e,r);for(const i in t)if(Qn(t[i])||Qn(e[i])){const s=Gl.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function bb(t){const e=Se.useRef(null);return e.current===null&&(e.current=t()),e.current}function TJ({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:RJ(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const zS=t=>(e,r)=>{const n=Se.useContext(z0),i=Se.useContext(F0),s=()=>TJ(t,e,n,i);return r?s():bb(s)};function RJ(t,e,r,n){const i={},s=n(t,{});for(const y in s)i[y]=q0(s[y]);let{initial:o,animate:a}=t;const u=H0(t),l=LS(t);e&&l&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const p=d?a:o;if(p&&typeof p!="boolean"&&!P0(p)){const y=Array.isArray(p)?p:[p];for(let A=0;A({style:{},transform:{},transformOrigin:{},vars:{}}),HS=()=>({...yb(),attrs:{}}),WS=(t,e)=>e&&typeof t=="number"?e.transform(t):t,DJ={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},OJ=Gl.length;function NJ(t,e,r){let n="",i=!0;for(let s=0;stypeof t=="string"&&t.toLowerCase()==="svg",FJ={useVisualState:zS({scrapeMotionValuesFromProps:qS,createRenderState:HS,onMount:(t,e,{renderState:r,latestValues:n})=>{Nr.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),Nr.render(()=>{xb(r,n,_b(e.tagName),t.transformTemplate),jS(e,r)})}})},jJ={useVisualState:zS({scrapeMotionValuesFromProps:vb,createRenderState:yb})};function VS(t,e,r){for(const n in e)!Qn(e[n])&&!US(n,r)&&(t[n]=e[n])}function UJ({transformTemplate:t},e){return Se.useMemo(()=>{const r=yb();return wb(r,e,t),Object.assign({},r.vars,r.style)},[e])}function qJ(t,e){const r=t.style||{},n={};return VS(n,r,t),Object.assign(n,UJ(t,e)),n}function zJ(t,e){const r={},n=qJ(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const HJ=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function W0(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||HJ.has(t)}let GS=t=>!W0(t);function WJ(t){t&&(GS=e=>e.startsWith("on")?!W0(e):t(e))}try{WJ(require("@emotion/is-prop-valid").default)}catch{}function KJ(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(GS(i)||r===!0&&W0(i)||!e&&!W0(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function VJ(t,e,r,n){const i=Se.useMemo(()=>{const s=HS();return xb(s,e,_b(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};VS(s,t.style,t),i.style={...s,...i.style}}return i}function GJ(t=!1){return(r,n,i,{latestValues:s},o)=>{const u=(mb(r)?VJ:zJ)(n,s,o,r),l=KJ(n,typeof r=="string",t),d=r!==Se.Fragment?{...l,...u,ref:i}:{},{children:p}=n,y=Se.useMemo(()=>Qn(p)?p.get():p,[p]);return Se.createElement(r,{...d,children:y})}}function YJ(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...mb(n)?FJ:jJ,preloadedFeatures:t,useRender:GJ(i),createVisualElement:e,Component:n};return AJ(o)}}const Eb={current:null},YS={current:!1};function JJ(){if(YS.current=!0,!!gb)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Eb.current=t.matches;t.addListener(e),e()}else Eb.current=!1}function XJ(t,e,r){for(const n in e){const i=e[n],s=r[n];if(Qn(i))t.addValue(n,i),process.env.NODE_ENV==="development"&&A0(i.version==="11.11.17",`Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`);else if(Qn(s))t.addValue(n,th(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,th(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const JS=new WeakMap,ZJ=[...N8,Zn,xa],QJ=t=>ZJ.find(O8(t)),XS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class eX{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Iv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=to.now();this.renderScheduledAtthis.bindToMotionValue(n,r)),YS.current||JJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Eb.current,process.env.NODE_ENV!=="production"&&A0(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){JS.delete(this.current),this.projection&&this.projection.unmount(),ba(this.notifyUpdate),ba(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=bc.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Nr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Hu){const r=Hu[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ln()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=th(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(A8(i)||S8(i))?i=parseFloat(i):!QJ(i)&&xa.test(r)&&(i=W8(e,r)),this.setBaseTarget(e,Qn(i)?i.get():i)),Qn(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=bv(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Qn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new Jv),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class ZS extends eX{constructor(){super(...arguments),this.KeyframeResolver=K8}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function tX(t){return window.getComputedStyle(t)}class rX extends ZS{constructor(){super(...arguments),this.type="html",this.renderInstance=$S}readValueFromInstance(e,r){if(bc.has(r)){const n=Lv(r);return n&&n.default||0}else{const n=tX(e),i=(M8(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return YE(e,r)}build(e,r,n){wb(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return vb(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Qn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class nX extends ZS{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ln}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(bc.has(r)){const n=Lv(r);return n&&n.default||0}return r=FS.has(r)?r:Xv(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return qS(e,r,n)}build(e,r,n){xb(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){jS(e,r,n,i)}mount(e){this.isSVGTag=_b(e.tagName),super.mount(e)}}const iX=(t,e)=>mb(t)?new nX(e):new rX(e,{allowProjection:t!==Se.Fragment}),sX=YJ({...GG,...mJ,...sJ,...vJ},iX),oX=UK(sX);class aX extends Yt.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function cX({children:t,isPresent:e}){const r=Se.useId(),n=Se.useRef(null),i=Se.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=Se.useContext(pb);return Se.useInsertionEffect(()=>{const{width:o,height:a,top:u,left:l}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` + */const jK=ts("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]),d8=new Set;function A0(t,e,r){t||d8.has(e)||(console.warn(e),d8.add(e))}function UK(t){if(typeof Proxy>"u")return t;const e=new Map,r=(...n)=>(process.env.NODE_ENV!=="production"&&A0(!1,"motion() is deprecated. Use motion.create() instead."),t(...n));return new Proxy(r,{get:(n,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}function P0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const vv=t=>Array.isArray(t);function p8(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function bv(t,e,r,n){if(typeof e=="function"){const[i,s]=g8(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=g8(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function M0(t,e,r){const n=t.getProps();return bv(n,e,r!==void 0?r:n.custom,t)}const yv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],wv=["initial",...yv],Gl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],bc=new Set(Gl),Qs=t=>t*1e3,Do=t=>t/1e3,qK={type:"spring",stiffness:500,damping:25,restSpeed:10},zK=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),HK={type:"keyframes",duration:.8},WK={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},KK=(t,{keyframes:e})=>e.length>2?HK:bc.has(t)?t.startsWith("scale")?zK(e[1]):qK:WK;function xv(t,e){return t?t[e]||t.default||t:void 0}const VK={useManualTiming:!1},GK=t=>t!==null;function I0(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(GK),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const Wn=t=>t;function YK(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){s.has(l)&&(u.schedule(l),t()),l(o)}const u={schedule:(l,d=!1,p=!1)=>{const A=p&&n?e:r;return d&&s.add(l),A.has(l)||A.add(l),l},cancel:l=>{r.delete(l),s.delete(l)},process:l=>{if(o=l,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,u.process(l))}};return u}const C0=["read","resolveKeyframes","update","preRender","render","postRender"],JK=40;function m8(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=C0.reduce((k,B)=>(k[B]=YK(s),k),{}),{read:a,resolveKeyframes:u,update:l,preRender:d,render:p,postRender:y}=o,A=()=>{const k=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(k-i.timestamp,JK),1),i.timestamp=k,i.isProcessing=!0,a.process(i),u.process(i),l.process(i),d.process(i),p.process(i),y.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(A))},P=()=>{r=!0,n=!0,i.isProcessing||t(A)};return{schedule:C0.reduce((k,B)=>{const q=o[B];return k[B]=(j,H=!1,J=!1)=>(r||P(),q.schedule(j,H,J)),k},{}),cancel:k=>{for(let B=0;B(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,XK=1e-7,ZK=12;function QK(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=v8(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>XK&&++aQK(s,0,1,t,r);return s=>s===0||s===1?s:v8(i(s),e,n)}const b8=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,y8=t=>e=>1-t(1-e),w8=Yl(.33,1.53,.69,.99),Ev=y8(w8),x8=b8(Ev),_8=t=>(t*=2)<1?.5*Ev(t):.5*(2-Math.pow(2,-10*(t-1))),Sv=t=>1-Math.sin(Math.acos(t)),E8=y8(Sv),S8=b8(Sv),A8=t=>/^0[^.\s]+$/u.test(t);function eV(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||A8(t):!0}let ku=Wn,Oo=Wn;process.env.NODE_ENV!=="production"&&(ku=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},Oo=(t,e)=>{if(!t)throw new Error(e)});const P8=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),M8=t=>e=>typeof e=="string"&&e.startsWith(t),I8=M8("--"),tV=M8("var(--"),Av=t=>tV(t)?rV.test(t.split("/*")[0].trim()):!1,rV=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,nV=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function iV(t){const e=nV.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}const sV=4;function C8(t,e,r=1){Oo(r<=sV,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[n,i]=iV(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return P8(o)?parseFloat(o):o}return Av(i)?C8(i,e,r+1):i}const ya=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},Jl={...Bu,transform:t=>ya(0,1,t)},T0={...Bu,default:1},Xl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),wa=Xl("deg"),eo=Xl("%"),zt=Xl("px"),oV=Xl("vh"),aV=Xl("vw"),T8={...eo,parse:t=>eo.parse(t)/100,transform:t=>eo.transform(t*100)},cV=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),R8=t=>t===Bu||t===zt,D8=(t,e)=>parseFloat(t.split(", ")[e]),O8=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return D8(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?D8(s[1],t):0}},uV=new Set(["x","y","z"]),fV=Gl.filter(t=>!uV.has(t));function lV(t){const e=[];return fV.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const $u={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:O8(4,13),y:O8(5,14)};$u.translateX=$u.x,$u.translateY=$u.y;const N8=t=>e=>e.test(t),L8=[Bu,zt,eo,wa,aV,oV,{test:t=>t==="auto",parse:t=>t}],k8=t=>L8.find(N8(t)),yc=new Set;let Pv=!1,Mv=!1;function B8(){if(Mv){const t=Array.from(yc).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=lV(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}Mv=!1,Pv=!1,yc.forEach(t=>t.complete()),yc.clear()}function $8(){yc.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Mv=!0)})}function hV(){$8(),B8()}class Iv{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(yc.add(this),Pv||(Pv=!0,Nr.read($8),Nr.resolveKeyframes(B8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sMath.round(t*1e5)/1e5,Cv=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function dV(t){return t==null}const pV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Tv=(t,e)=>r=>!!(typeof r=="string"&&pV.test(r)&&r.startsWith(t)||e&&!dV(r)&&Object.prototype.hasOwnProperty.call(r,e)),F8=(t,e,r)=>n=>{if(typeof n!="string")return n;const[i,s,o,a]=n.match(Cv);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},gV=t=>ya(0,255,t),Rv={...Bu,transform:t=>Math.round(gV(t))},wc={test:Tv("rgb","red"),parse:F8("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+Rv.transform(t)+", "+Rv.transform(e)+", "+Rv.transform(r)+", "+Zl(Jl.transform(n))+")"};function mV(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const Dv={test:Tv("#"),parse:mV,transform:wc.transform},Fu={test:Tv("hsl","hue"),parse:F8("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+eo.transform(Zl(e))+", "+eo.transform(Zl(r))+", "+Zl(Jl.transform(n))+")"},Zn={test:t=>wc.test(t)||Dv.test(t)||Fu.test(t),parse:t=>wc.test(t)?wc.parse(t):Fu.test(t)?Fu.parse(t):Dv.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?wc.transform(t):Fu.transform(t)},vV=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function bV(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Cv))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(vV))===null||r===void 0?void 0:r.length)||0)>0}const j8="number",U8="color",yV="var",wV="var(",q8="${}",xV=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ql(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(xV,u=>(Zn.test(u)?(n.color.push(s),i.push(U8),r.push(Zn.parse(u))):u.startsWith(wV)?(n.var.push(s),i.push(yV),r.push(u)):(n.number.push(s),i.push(j8),r.push(parseFloat(u))),++s,q8)).split(q8);return{values:r,split:a,indexes:n,types:i}}function z8(t){return Ql(t).values}function H8(t){const{split:e,types:r}=Ql(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function EV(t){const e=z8(t);return H8(t)(e.map(_V))}const xa={test:bV,parse:z8,createTransformer:H8,getAnimatableNone:EV},SV=new Set(["brightness","contrast","saturate","opacity"]);function AV(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(Cv)||[];if(!n)return t;const i=r.replace(n,"");let s=SV.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const PV=/\b([a-z-]*)\(.*?\)/gu,Ov={...xa,getAnimatableNone:t=>{const e=t.match(PV);return e?e.map(AV).join(" "):t}},MV={borderWidth:zt,borderTopWidth:zt,borderRightWidth:zt,borderBottomWidth:zt,borderLeftWidth:zt,borderRadius:zt,radius:zt,borderTopLeftRadius:zt,borderTopRightRadius:zt,borderBottomRightRadius:zt,borderBottomLeftRadius:zt,width:zt,maxWidth:zt,height:zt,maxHeight:zt,top:zt,right:zt,bottom:zt,left:zt,padding:zt,paddingTop:zt,paddingRight:zt,paddingBottom:zt,paddingLeft:zt,margin:zt,marginTop:zt,marginRight:zt,marginBottom:zt,marginLeft:zt,backgroundPositionX:zt,backgroundPositionY:zt},IV={rotate:wa,rotateX:wa,rotateY:wa,rotateZ:wa,scale:T0,scaleX:T0,scaleY:T0,scaleZ:T0,skew:wa,skewX:wa,skewY:wa,distance:zt,translateX:zt,translateY:zt,translateZ:zt,x:zt,y:zt,z:zt,perspective:zt,transformPerspective:zt,opacity:Jl,originX:T8,originY:T8,originZ:zt},W8={...Bu,transform:Math.round},Nv={...MV,...IV,zIndex:W8,size:zt,fillOpacity:Jl,strokeOpacity:Jl,numOctaves:W8},CV={...Nv,color:Zn,backgroundColor:Zn,outlineColor:Zn,fill:Zn,stroke:Zn,borderColor:Zn,borderTopColor:Zn,borderRightColor:Zn,borderBottomColor:Zn,borderLeftColor:Zn,filter:Ov,WebkitFilter:Ov},Lv=t=>CV[t];function K8(t,e){let r=Lv(t);return r!==Ov&&(r=xa),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const TV=new Set(["auto","none","0"]);function RV(t,e,r){let n=0,i;for(;n{r.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function kv(t){return typeof t=="function"}let R0;function DV(){R0=void 0}const to={now:()=>(R0===void 0&&to.set(Kn.isProcessing||VK.useManualTiming?Kn.timestamp:performance.now()),R0),set:t=>{R0=t,queueMicrotask(DV)}},G8=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(xa.test(t)||t==="0")&&!t.startsWith("url("));function OV(t){const e=t[0];if(t.length===1)return!0;for(let r=0;rLV?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&hV(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=to.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:u,isGenerator:l}=this.options;if(!l&&!NV(e,n,i,s))if(o)this.options.duration=0;else{u==null||u(I0(e,this.options,r)),a==null||a(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,r);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...d},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function J8(t,e){return e?t*(1e3/e):0}const kV=5;function X8(t,e,r){const n=Math.max(e-kV,0);return J8(r-t(n),e-n)}const Bv=.001,BV=.01,Z8=10,$V=.05,FV=1;function jV({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;ku(t<=Qs(Z8),"Spring duration must be 10 seconds or less");let o=1-e;o=ya($V,FV,o),t=ya(BV,Z8,Do(t)),o<1?(i=l=>{const d=l*o,p=d*t,y=d-r,A=$v(l,o),P=Math.exp(-p);return Bv-y/A*P},s=l=>{const p=l*o*t,y=p*r+r,A=Math.pow(o,2)*Math.pow(l,2)*t,P=Math.exp(-p),N=$v(Math.pow(l,2),o);return(-i(l)+Bv>0?-1:1)*((y-A)*P)/N}):(i=l=>{const d=Math.exp(-l*t),p=(l-r)*t+1;return-Bv+d*p},s=l=>{const d=Math.exp(-l*t),p=(r-l)*(t*t);return d*p});const a=5/t,u=qV(i,s,a);if(t=Qs(t),isNaN(u))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(u,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:t}}}const UV=12;function qV(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function WV(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!Q8(t,HV)&&Q8(t,zV)){const r=jV(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function eE({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:u,mass:l,duration:d,velocity:p,isResolvedFromDuration:y}=WV({...n,velocity:-Do(n.velocity||0)}),A=p||0,P=u/(2*Math.sqrt(a*l)),N=s-i,D=Do(Math.sqrt(a/l)),k=Math.abs(N)<5;r||(r=k?.01:2),e||(e=k?.005:.5);let B;if(P<1){const q=$v(D,P);B=j=>{const H=Math.exp(-P*D*j);return s-H*((A+P*D*N)/q*Math.sin(q*j)+N*Math.cos(q*j))}}else if(P===1)B=q=>s-Math.exp(-D*q)*(N+(A+D*N)*q);else{const q=D*Math.sqrt(P*P-1);B=j=>{const H=Math.exp(-P*D*j),J=Math.min(q*j,300);return s-H*((A+P*D*N)*Math.sinh(J)+q*N*Math.cosh(J))/q}}return{calculatedDuration:y&&d||null,next:q=>{const j=B(q);if(y)o.done=q>=d;else{let H=0;P<1&&(H=q===0?Qs(A):X8(B,q,j));const J=Math.abs(H)<=r,T=Math.abs(s-j)<=e;o.done=J&&T}return o.value=o.done?s:j,o}}}function tE({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:d}){const p=t[0],y={done:!1,value:p},A=z=>a!==void 0&&zu,P=z=>a===void 0?u:u===void 0||Math.abs(a-z)-N*Math.exp(-z/n),q=z=>k+B(z),j=z=>{const ue=B(z),_e=q(z);y.done=Math.abs(ue)<=l,y.value=y.done?k:_e};let H,J;const T=z=>{A(y.value)&&(H=z,J=eE({keyframes:[y.value,P(y.value)],velocity:X8(q,z,y.value),damping:i,stiffness:s,restDelta:l,restSpeed:d}))};return T(0),{calculatedDuration:null,next:z=>{let ue=!1;return!J&&H===void 0&&(ue=!0,j(z),T(z)),H!==void 0&&z>=H?J.next(z-H):(!ue&&j(z),y)}}}const KV=Yl(.42,0,1,1),VV=Yl(0,0,.58,1),rE=Yl(.42,0,.58,1),GV=t=>Array.isArray(t)&&typeof t[0]!="number",Fv=t=>Array.isArray(t)&&typeof t[0]=="number",nE={linear:Wn,easeIn:KV,easeInOut:rE,easeOut:VV,circIn:Sv,circInOut:S8,circOut:E8,backIn:Ev,backInOut:x8,backOut:w8,anticipate:_8},iE=t=>{if(Fv(t)){Oo(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,r,n,i]=t;return Yl(e,r,n,i)}else if(typeof t=="string")return Oo(nE[t]!==void 0,`Invalid easing type '${t}'`),nE[t];return t},YV=(t,e)=>r=>e(t(r)),No=(...t)=>t.reduce(YV),ju=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},Zr=(t,e,r)=>t+(e-t)*r;function jv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function JV({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,u=2*r-a;i=jv(u,a,t+1/3),s=jv(u,a,t),o=jv(u,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function D0(t,e){return r=>r>0?e:t}const Uv=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},XV=[Dv,wc,Fu],ZV=t=>XV.find(e=>e.test(t));function sE(t){const e=ZV(t);if(ku(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let r=e.parse(t);return e===Fu&&(r=JV(r)),r}const oE=(t,e)=>{const r=sE(t),n=sE(e);if(!r||!n)return D0(t,e);const i={...r};return s=>(i.red=Uv(r.red,n.red,s),i.green=Uv(r.green,n.green,s),i.blue=Uv(r.blue,n.blue,s),i.alpha=Zr(r.alpha,n.alpha,s),wc.transform(i))},qv=new Set(["none","hidden"]);function QV(t,e){return qv.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function eG(t,e){return r=>Zr(t,e,r)}function zv(t){return typeof t=="number"?eG:typeof t=="string"?Av(t)?D0:Zn.test(t)?oE:nG:Array.isArray(t)?aE:typeof t=="object"?Zn.test(t)?oE:tG:D0}function aE(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>zv(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function rG(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=xa.createTransformer(e),n=Ql(t),i=Ql(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?qv.has(t)&&!i.values.length||qv.has(e)&&!n.values.length?QV(t,e):No(aE(rG(n,i),i.values),r):(ku(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),D0(t,e))};function cE(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Zr(t,e,r):zv(t)(t,e)}function iG(t,e,r){const n=[],i=r||cE,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=iG(e,n,i),a=o.length,u=l=>{let d=0;if(a>1)for(;du(ya(t[0],t[s-1],l)):u}function oG(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=ju(0,e,n);t.push(Zr(r,1,i))}}function aG(t){const e=[0];return oG(e,t.length-1),e}function cG(t,e){return t.map(r=>r*e)}function uG(t,e){return t.map(()=>e||rE).splice(0,t.length-1)}function O0({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=GV(n)?n.map(iE):iE(n),s={done:!1,value:e[0]},o=cG(r&&r.length===e.length?r:aG(e),t),a=sG(o,e,{ease:Array.isArray(i)?i:uG(e,i)});return{calculatedDuration:t,next:u=>(s.value=a(u),s.done=u>=t,s)}}const uE=2e4;function fG(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=uE?1/0:e}const lG=t=>{const e=({timestamp:r})=>t(r);return{start:()=>Nr.update(e,!0),stop:()=>ba(e),now:()=>Kn.isProcessing?Kn.timestamp:to.now()}},hG={decay:tE,inertia:tE,tween:O0,keyframes:O0,spring:eE},dG=t=>t/100;class Hv extends Y8{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:u}=this.options;u&&u()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Iv,a=(u,l)=>this.onKeyframesResolved(u,l);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=kv(r)?r:hG[r]||O0;let u,l;a!==O0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&Oo(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),u=No(dG,cE(e[0],e[1])),e=[0,100]);const d=a({...this.options,keyframes:e});s==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=fG(d));const{calculatedDuration:p}=d,y=p+i,A=y*(n+1)-i;return{generator:d,mirroredGenerator:l,mapPercentToKeyframes:u,calculatedDuration:p,resolvedDuration:y,totalDuration:A}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:z}=this.options;return{done:!0,value:z[z.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:u,calculatedDuration:l,totalDuration:d,resolvedDuration:p}=n;if(this.startTime===null)return s.next(0);const{delay:y,repeat:A,repeatType:P,repeatDelay:N,onUpdate:D}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const k=this.currentTime-y*(this.speed>=0?1:-1),B=this.speed>=0?k<0:k>d;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let q=this.currentTime,j=s;if(A){const z=Math.min(this.currentTime,d)/p;let ue=Math.floor(z),_e=z%1;!_e&&z>=1&&(_e=1),_e===1&&ue--,ue=Math.min(ue,A+1),!!(ue%2)&&(P==="reverse"?(_e=1-_e,N&&(_e-=N/p)):P==="mirror"&&(j=o)),q=ya(0,1,_e)*p}const H=B?{done:!1,value:u[0]}:j.next(q);a&&(H.value=a(H.value));let{done:J}=H;!B&&l!==null&&(J=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&J);return T&&i!==void 0&&(H.value=I0(u,this.options,i)),D&&D(H.value),T&&this.finish(),H}get duration(){const{resolved:e}=this;return e?Do(e.calculatedDuration):0}get time(){return Do(this.currentTime)}set time(e){e=Qs(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=Do(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=lG,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const pG=new Set(["opacity","clipPath","filter","transform"]),gG=10,mG=(t,e)=>{let r="";const n=Math.max(Math.round(e/gG),2);for(let i=0;i(e===void 0&&(e=t()),e)}const vG={linearEasing:void 0};function bG(t,e){const r=Wv(t);return()=>{var n;return(n=vG[e])!==null&&n!==void 0?n:r()}}const N0=bG(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function fE(t){return!!(typeof t=="function"&&N0()||!t||typeof t=="string"&&(t in Kv||N0())||Fv(t)||Array.isArray(t)&&t.every(fE))}const eh=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,Kv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:eh([0,.65,.55,1]),circOut:eh([.55,0,1,.45]),backIn:eh([.31,.01,.66,-.59]),backOut:eh([.33,1.53,.69,.99])};function lE(t,e){if(t)return typeof t=="function"&&N0()?mG(t,e):Fv(t)?eh(t):Array.isArray(t)?t.map(r=>lE(r,e)||Kv.easeOut):Kv[t]}function yG(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:u}={}){const l={[e]:r};u&&(l.offset=u);const d=lE(a,i);return Array.isArray(d)&&(l.easing=d),t.animate(l,{delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function hE(t,e){t.timeline=e,t.onfinish=null}const wG=Wv(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),L0=10,xG=2e4;function _G(t){return kv(t.type)||t.type==="spring"||!fE(t.ease)}function EG(t,e){const r=new Hv({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&sthis.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:u,name:l,startTime:d}=this.options;if(!(!((n=u.owner)===null||n===void 0)&&n.current))return!1;if(typeof o=="string"&&N0()&&SG(o)&&(o=dE[o]),_G(this.options)){const{onComplete:y,onUpdate:A,motionValue:P,element:N,...D}=this.options,k=EG(e,D);e=k.keyframes,e.length===1&&(e[1]=e[0]),i=k.duration,s=k.times,o=k.ease,a="keyframes"}const p=yG(u.owner.current,l,e,{...this.options,duration:i,times:s,ease:o});return p.startTime=d??this.calcStartTime(),this.pendingTimeline?(hE(p,this.pendingTimeline),this.pendingTimeline=void 0):p.onfinish=()=>{const{onComplete:y}=this.options;u.set(I0(e,this.options,r)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:p,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return Do(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return Do(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=Qs(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return Wn;const{animation:n}=r;hE(n,e)}return Wn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:d,onComplete:p,element:y,...A}=this.options,P=new Hv({...A,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),N=Qs(this.time);l.setWithVelocity(P.sample(N-L0).value,P.sample(N).value,L0)}const{onStop:u}=this.options;u&&u(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return wG()&&n&&pG.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}const AG=Wv(()=>window.ScrollTimeline!==void 0);class PG{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;nAG()&&i.attachTimeline?i.attachTimeline(e):r(i));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function MG({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:u,elapsed:l,...d}){return!!Object.keys(d).length}const Vv=(t,e,r,n={},i,s)=>o=>{const a=xv(n,t)||{},u=a.delay||n.delay||0;let{elapsed:l=0}=n;l=l-Qs(u);let d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:y=>{e.set(y),a.onUpdate&&a.onUpdate(y)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:i};MG(a)||(d={...d,...KK(t,d)}),d.duration&&(d.duration=Qs(d.duration)),d.repeatDelay&&(d.repeatDelay=Qs(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let p=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(p=!0)),p&&!s&&e.get()!==void 0){const y=I0(d.keyframes,a);if(y!==void 0)return Nr.update(()=>{d.onUpdate(y),d.onComplete()}),new PG([])}return!s&&pE.supports(d)?new pE(d):new Hv(d)},IG=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),CG=t=>vv(t)?t[t.length-1]||0:t;function Gv(t,e){t.indexOf(e)===-1&&t.push(e)}function Yv(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class Jv{constructor(){this.subscriptions=[]}add(e){return Gv(this.subscriptions,e),()=>Yv(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class RG{constructor(e,r={}){this.version="11.11.17",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=to.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=to.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=TG(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&A0(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new Jv);const n=this.events[e].add(r);return e==="change"?()=>{n(),Nr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=to.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>gE)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,gE);return J8(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function th(t,e){return new RG(t,e)}function DG(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,th(r))}function OG(t,e){const r=M0(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=CG(s[o]);DG(t,o,a)}}const Xv=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),mE="data-"+Xv("framerAppearId");function vE(t){return t.props[mE]}const Qn=t=>!!(t&&t.getVelocity);function NG(t){return!!(Qn(t)&&t.add)}function Zv(t,e){const r=t.getValue("willChange");if(NG(r))return r.add(e)}function LG({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function bE(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...u}=e;n&&(o=n);const l=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const p in u){const y=t.getValue(p,(s=t.latestValues[p])!==null&&s!==void 0?s:null),A=u[p];if(A===void 0||d&&LG(d,p))continue;const P={delay:r,...xv(o||{},p)};let N=!1;if(window.MotionHandoffAnimation){const k=vE(t);if(k){const B=window.MotionHandoffAnimation(k,p,Nr);B!==null&&(P.startTime=B,N=!0)}}Zv(t,p),y.start(Vv(p,y,A,t.shouldReduceMotion&&bc.has(p)?{type:!1}:P,t,N));const D=y.animation;D&&l.push(D)}return a&&Promise.all(l).then(()=>{Nr.update(()=>{a&&OG(t,a)})}),l}function Qv(t,e,r={}){var n;const i=M0(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(bE(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:y}=s;return kG(t,e,d+l,p,y,r)}:()=>Promise.resolve(),{when:u}=s;if(u){const[l,d]=u==="beforeChildren"?[o,a]:[a,o];return l().then(()=>d())}else return Promise.all([o(),a(r.delay)])}function kG(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,u=i===1?(l=0)=>l*n:(l=0)=>a-l*n;return Array.from(t.variantChildren).sort(BG).forEach((l,d)=>{l.notify("AnimationStart",e),o.push(Qv(l,e,{...s,delay:r+u(d)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function BG(t,e){return t.sortNodePosition(e)}function $G(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>Qv(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=Qv(t,e,r);else{const i=typeof e=="function"?M0(t,e,r.custom):e;n=Promise.all(bE(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const FG=wv.length;function yE(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?yE(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;rPromise.all(e.map(({animation:r,options:n})=>$G(t,r,n)))}function zG(t){let e=qG(t),r=wE(),n=!0;const i=u=>(l,d)=>{var p;const y=M0(t,d,u==="exit"?(p=t.presenceContext)===null||p===void 0?void 0:p.custom:void 0);if(y){const{transition:A,transitionEnd:P,...N}=y;l={...l,...N,...P}}return l};function s(u){e=u(t)}function o(u){const{props:l}=t,d=yE(t.parent)||{},p=[],y=new Set;let A={},P=1/0;for(let D=0;DP&&j,ue=!1;const _e=Array.isArray(q)?q:[q];let G=_e.reduce(i(k),{});H===!1&&(G={});const{prevResolvedValues:E={}}=B,m={...E,...G},f=x=>{z=!0,y.has(x)&&(ue=!0,y.delete(x)),B.needsAnimating[x]=!0;const _=t.getValue(x);_&&(_.liveStyle=!1)};for(const x in m){const _=G[x],S=E[x];if(A.hasOwnProperty(x))continue;let b=!1;vv(_)&&vv(S)?b=!p8(_,S):b=_!==S,b?_!=null?f(x):y.add(x):_!==void 0&&y.has(x)?f(x):B.protectedKeys[x]=!0}B.prevProp=q,B.prevResolvedValues=G,B.isActive&&(A={...A,...G}),n&&t.blockInitialAnimation&&(z=!1),z&&(!(J&&T)||ue)&&p.push(..._e.map(x=>({animation:x,options:{type:k}})))}if(y.size){const D={};y.forEach(k=>{const B=t.getBaseTarget(k),q=t.getValue(k);q&&(q.liveStyle=!0),D[k]=B??null}),p.push({animation:D})}let N=!!p.length;return n&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(N=!1),n=!1,N?e(p):Promise.resolve()}function a(u,l){var d;if(r[u].isActive===l)return Promise.resolve();(d=t.variantChildren)===null||d===void 0||d.forEach(y=>{var A;return(A=y.animationState)===null||A===void 0?void 0:A.setActive(u,l)}),r[u].isActive=l;const p=o(u);for(const y in r)r[y].protectedKeys={};return p}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=wE(),n=!0}}}function HG(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!p8(e,t):!1}function xc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function wE(){return{animate:xc(!0),whileInView:xc(),whileHover:xc(),whileTap:xc(),whileDrag:xc(),whileFocus:xc(),exit:xc()}}class _a{constructor(e){this.isMounted=!1,this.node=e}update(){}}class WG extends _a{constructor(e){super(e),e.animationState||(e.animationState=zG(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();P0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let KG=0;class VG extends _a{constructor(){super(...arguments),this.id=KG++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const GG={animation:{Feature:WG},exit:{Feature:VG}},xE=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function k0(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const YG=t=>e=>xE(e)&&t(e,k0(e));function Lo(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function ko(t,e,r,n){return Lo(t,e,YG(r),n)}const _E=(t,e)=>Math.abs(t-e);function JG(t,e){const r=_E(t.x,e.x),n=_E(t.y,e.y);return Math.sqrt(r**2+n**2)}class EE{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=tb(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,A=JG(p.offset,{x:0,y:0})>=3;if(!y&&!A)return;const{point:P}=p,{timestamp:N}=Kn;this.history.push({...P,timestamp:N});const{onStart:D,onMove:k}=this.handlers;y||(D&&D(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,p)},this.handlePointerMove=(p,y)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=eb(y,this.transformPagePoint),Nr.update(this.updatePoint,!0)},this.handlePointerUp=(p,y)=>{this.end();const{onEnd:A,onSessionEnd:P,resumeAnimation:N}=this.handlers;if(this.dragSnapToOrigin&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=tb(p.type==="pointercancel"?this.lastMoveEventInfo:eb(y,this.transformPagePoint),this.history);this.startEvent&&A&&A(p,D),P&&P(p,D)},!xE(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=k0(e),a=eb(o,this.transformPagePoint),{point:u}=a,{timestamp:l}=Kn;this.history=[{...u,timestamp:l}];const{onSessionStart:d}=r;d&&d(e,tb(a,this.history)),this.removeListeners=No(ko(this.contextWindow,"pointermove",this.handlePointerMove),ko(this.contextWindow,"pointerup",this.handlePointerUp),ko(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),ba(this.updatePoint)}}function eb(t,e){return e?{point:e(t.point)}:t}function SE(t,e){return{x:t.x-e.x,y:t.y-e.y}}function tb({point:t},e){return{point:t,delta:SE(t,AE(e)),offset:SE(t,XG(e)),velocity:ZG(e,.1)}}function XG(t){return t[0]}function AE(t){return t[t.length-1]}function ZG(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=AE(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>Qs(e)));)r--;if(!n)return{x:0,y:0};const s=Do(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function PE(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const ME=PE("dragHorizontal"),IE=PE("dragVertical");function CE(t){let e=!1;if(t==="y")e=IE();else if(t==="x")e=ME();else{const r=ME(),n=IE();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function TE(){const t=CE(!0);return t?(t(),!1):!0}function Uu(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const RE=1e-4,QG=1-RE,eY=1+RE,DE=.01,tY=0-DE,rY=0+DE;function Ni(t){return t.max-t.min}function nY(t,e,r){return Math.abs(t-e)<=r}function OE(t,e,r,n=.5){t.origin=n,t.originPoint=Zr(e.min,e.max,t.origin),t.scale=Ni(r)/Ni(e),t.translate=Zr(r.min,r.max,t.origin)-t.originPoint,(t.scale>=QG&&t.scale<=eY||isNaN(t.scale))&&(t.scale=1),(t.translate>=tY&&t.translate<=rY||isNaN(t.translate))&&(t.translate=0)}function rh(t,e,r,n){OE(t.x,e.x,r.x,n?n.originX:void 0),OE(t.y,e.y,r.y,n?n.originY:void 0)}function NE(t,e,r){t.min=r.min+e.min,t.max=t.min+Ni(e)}function iY(t,e,r){NE(t.x,e.x,r.x),NE(t.y,e.y,r.y)}function LE(t,e,r){t.min=e.min-r.min,t.max=t.min+Ni(e)}function nh(t,e,r){LE(t.x,e.x,r.x),LE(t.y,e.y,r.y)}function sY(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?Zr(r,t,n.max):Math.min(t,r)),t}function kE(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function oY(t,{top:e,left:r,bottom:n,right:i}){return{x:kE(t.x,r,i),y:kE(t.y,e,n)}}function BE(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=ju(e.min,e.max-n,t.min):n>i&&(r=ju(t.min,t.max-i,e.min)),ya(0,1,r)}function uY(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const rb=.35;function fY(t=rb){return t===!1?t=0:t===!0&&(t=rb),{x:$E(t,"left","right"),y:$E(t,"top","bottom")}}function $E(t,e,r){return{min:FE(t,e),max:FE(t,r)}}function FE(t,e){return typeof t=="number"?t:t[e]||0}const jE=()=>({translate:0,scale:1,origin:0,originPoint:0}),qu=()=>({x:jE(),y:jE()}),UE=()=>({min:0,max:0}),ln=()=>({x:UE(),y:UE()});function rs(t){return[t("x"),t("y")]}function qE({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function lY({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function hY(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function nb(t){return t===void 0||t===1}function ib({scale:t,scaleX:e,scaleY:r}){return!nb(t)||!nb(e)||!nb(r)}function _c(t){return ib(t)||zE(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function zE(t){return HE(t.x)||HE(t.y)}function HE(t){return t&&t!=="0%"}function B0(t,e,r){const n=t-r,i=e*n;return r+i}function WE(t,e,r,n,i){return i!==void 0&&(t=B0(t,i,n)),B0(t,r,n)+e}function sb(t,e=0,r=1,n,i){t.min=WE(t.min,e,r,n,i),t.max=WE(t.max,e,r,n,i)}function KE(t,{x:e,y:r}){sb(t.x,e.translate,e.scale,e.originPoint),sb(t.y,r.translate,r.scale,r.originPoint)}const VE=.999999999999,GE=1.0000000000001;function dY(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;aVE&&(e.x=1),e.yVE&&(e.y=1)}function zu(t,e){t.min=t.min+e,t.max=t.max+e}function YE(t,e,r,n,i=.5){const s=Zr(t.min,t.max,i);sb(t,e,r,s,n)}function Hu(t,e){YE(t.x,e.x,e.scaleX,e.scale,e.originX),YE(t.y,e.y,e.scaleY,e.scale,e.originY)}function JE(t,e){return qE(hY(t.getBoundingClientRect(),e))}function pY(t,e,r){const n=JE(t,r),{scroll:i}=e;return i&&(zu(n.x,i.offset.x),zu(n.y,i.offset.y)),n}const XE=({current:t})=>t?t.ownerDocument.defaultView:null,gY=new WeakMap;class mY{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ln(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:p}=this.getProps();p?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(k0(d,"page").point)},s=(d,p)=>{const{drag:y,dragPropagation:A,onDragStart:P}=this.getProps();if(y&&!A&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=CE(y),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),rs(D=>{let k=this.getAxisMotionValue(D).get()||0;if(eo.test(k)){const{projection:B}=this.visualElement;if(B&&B.layout){const q=B.layout.layoutBox[D];q&&(k=Ni(q)*(parseFloat(k)/100))}}this.originPoint[D]=k}),P&&Nr.postRender(()=>P(d,p)),Zv(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},o=(d,p)=>{const{dragPropagation:y,dragDirectionLock:A,onDirectionLock:P,onDrag:N}=this.getProps();if(!y&&!this.openGlobalLock)return;const{offset:D}=p;if(A&&this.currentDirection===null){this.currentDirection=vY(D),this.currentDirection!==null&&P&&P(this.currentDirection);return}this.updateAxis("x",p.point,D),this.updateAxis("y",p.point,D),this.visualElement.render(),N&&N(d,p)},a=(d,p)=>this.stop(d,p),u=()=>rs(d=>{var p;return this.getAnimationState(d)==="paused"&&((p=this.getAxisMotionValue(d).animation)===null||p===void 0?void 0:p.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new EE(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:XE(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Nr.postRender(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!$0(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=sY(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&Uu(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=oY(i.layoutBox,r):this.constraints=!1,this.elastic=fY(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&rs(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=uY(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!Uu(e))return!1;const n=e.current;Oo(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=pY(n,i.root,this.visualElement.getTransformPagePoint());let o=aY(i.layout.layoutBox,s);if(r){const a=r(lY(o));this.hasMutatedConstraints=!!a,a&&(o=qE(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),u=this.constraints||{},l=rs(d=>{if(!$0(d,r,this.currentDirection))return;let p=u&&u[d]||{};o&&(p={min:0,max:0});const y=i?200:1e6,A=i?40:1e7,P={type:"inertia",velocity:n?e[d]:0,bounceStiffness:y,bounceDamping:A,timeConstant:750,restDelta:1,restSpeed:10,...s,...p};return this.startAxisValueAnimation(d,P)});return Promise.all(l).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return Zv(this.visualElement,e),n.start(Vv(e,n,0,r,this.visualElement,!1))}stopAnimation(){rs(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){rs(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){rs(r=>{const{drag:n}=this.getProps();if(!$0(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-Zr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!Uu(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};rs(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const u=a.get();i[o]=cY({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),rs(o=>{if(!$0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:u,max:l}=this.constraints[o];a.set(Zr(u,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;gY.set(this.visualElement,this);const e=this.visualElement.current,r=ko(e,"pointerdown",u=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();Uu(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Nr.read(n);const o=Lo(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(rs(d=>{const p=this.getAxisMotionValue(d);p&&(this.originPoint[d]+=u[d].translate,p.set(p.get()+u[d].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=rb,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function $0(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function vY(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class bY extends _a{constructor(e){super(e),this.removeGroupControls=Wn,this.removeListeners=Wn,this.controls=new mY(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Wn}unmount(){this.removeGroupControls(),this.removeListeners()}}const ZE=t=>(e,r)=>{t&&Nr.postRender(()=>t(e,r))};class yY extends _a{constructor(){super(...arguments),this.removePointerDownListener=Wn}onPointerDown(e){this.session=new EE(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:XE(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:ZE(e),onStart:ZE(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&Nr.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=ko(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const F0=Ee.createContext(null);function wY(){const t=Ee.useContext(F0);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=Ee.useId();Ee.useEffect(()=>n(i),[]);const s=Ee.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const ob=Ee.createContext({}),QE=Ee.createContext({}),j0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function eS(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ih={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(zt.test(t))t=parseFloat(t);else return t;const r=eS(t,e.target.x),n=eS(t,e.target.y);return`${r}% ${n}%`}},xY={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=xa.parse(t);if(i.length>5)return n;const s=xa.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,u=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=u;const l=Zr(a,u,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),s(i)}},U0={};function _Y(t){Object.assign(U0,t)}const{schedule:ab}=m8(queueMicrotask,!1);class EY extends Ee.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;_Y(SY),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),j0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Nr.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ab.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function tS(t){const[e,r]=wY(),n=Ee.useContext(ob);return ge.jsx(EY,{...t,layoutGroup:n,switchLayoutGroup:Ee.useContext(QE),isPresent:e,safeToRemove:r})}const SY={borderRadius:{...ih,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ih,borderTopRightRadius:ih,borderBottomLeftRadius:ih,borderBottomRightRadius:ih,boxShadow:xY},rS=["TopLeft","TopRight","BottomLeft","BottomRight"],AY=rS.length,nS=t=>typeof t=="string"?parseFloat(t):t,iS=t=>typeof t=="number"||zt.test(t);function PY(t,e,r,n,i,s){i?(t.opacity=Zr(0,r.opacity!==void 0?r.opacity:1,MY(n)),t.opacityExit=Zr(e.opacity!==void 0?e.opacity:1,0,IY(n))):s&&(t.opacity=Zr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(ju(t,e,n))}function aS(t,e){t.min=e.min,t.max=e.max}function ns(t,e){aS(t.x,e.x),aS(t.y,e.y)}function cS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function uS(t,e,r,n,i){return t-=e,t=B0(t,1/r,n),i!==void 0&&(t=B0(t,1/i,n)),t}function CY(t,e=0,r=1,n=.5,i,s=t,o=t){if(eo.test(e)&&(e=parseFloat(e),e=Zr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Zr(s.min,s.max,n);t===s&&(a-=e),t.min=uS(t.min,e,r,a,i),t.max=uS(t.max,e,r,a,i)}function fS(t,e,[r,n,i],s,o){CY(t,e[r],e[n],e[i],e.scale,s,o)}const TY=["x","scaleX","originX"],RY=["y","scaleY","originY"];function lS(t,e,r,n){fS(t.x,e,TY,r?r.x:void 0,n?n.x:void 0),fS(t.y,e,RY,r?r.y:void 0,n?n.y:void 0)}function hS(t){return t.translate===0&&t.scale===1}function dS(t){return hS(t.x)&&hS(t.y)}function pS(t,e){return t.min===e.min&&t.max===e.max}function DY(t,e){return pS(t.x,e.x)&&pS(t.y,e.y)}function gS(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function mS(t,e){return gS(t.x,e.x)&&gS(t.y,e.y)}function vS(t){return Ni(t.x)/Ni(t.y)}function bS(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class OY{constructor(){this.members=[]}add(e){Gv(this.members,e),e.scheduleRender()}remove(e){if(Yv(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function NY(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:l,rotate:d,rotateX:p,rotateY:y,skewX:A,skewY:P}=r;l&&(n=`perspective(${l}px) ${n}`),d&&(n+=`rotate(${d}deg) `),p&&(n+=`rotateX(${p}deg) `),y&&(n+=`rotateY(${y}deg) `),A&&(n+=`skewX(${A}deg) `),P&&(n+=`skewY(${P}deg) `)}const a=t.x.scale*e.x,u=t.y.scale*e.y;return(a!==1||u!==1)&&(n+=`scale(${a}, ${u})`),n||"none"}const LY=(t,e)=>t.depth-e.depth;class kY{constructor(){this.children=[],this.isDirty=!1}add(e){Gv(this.children,e),this.isDirty=!0}remove(e){Yv(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(LY),this.isDirty=!1,this.children.forEach(e)}}function q0(t){const e=Qn(t)?t.get():t;return IG(e)?e.toValue():e}function BY(t,e){const r=to.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(ba(n),t(s-e))};return Nr.read(n,!0),()=>ba(n)}function $Y(t){return t instanceof SVGElement&&t.tagName!=="svg"}function FY(t,e,r){const n=Qn(t)?t:th(t);return n.start(Vv("",n,e,r)),n.animation}const Ec={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},sh=typeof window<"u"&&window.MotionDebug!==void 0,cb=["","X","Y","Z"],jY={visibility:"hidden"},yS=1e3;let UY=0;function ub(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function wS(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=vE(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Nr,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&wS(n)}function xS({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=UY++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,sh&&(Ec.totalNodes=Ec.resolvedTargetDeltas=Ec.recalculatedProjection=0),this.nodes.forEach(HY),this.nodes.forEach(YY),this.nodes.forEach(JY),this.nodes.forEach(WY),sh&&window.MotionDebug.record(Ec)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let u=0;uthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,p&&p(),p=BY(y,250),j0.hasAnimatedSinceResize&&(j0.hasAnimatedSinceResize=!1,this.nodes.forEach(ES))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&d&&(u||l)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:y,hasRelativeTargetChanged:A,layout:P})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const N=this.options.transition||d.getDefaultTransition()||tJ,{onLayoutAnimationStart:D,onLayoutAnimationComplete:k}=d.getProps(),B=!this.targetLayout||!mS(this.targetLayout,P)||A,q=!y&&A;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||q||y&&(B||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(p,q);const j={...xv(N,"layout"),onPlay:D,onComplete:k};(d.shouldReduceMotion||this.options.layoutRoot)&&(j.delay=0,j.type=!1),this.startAnimation(j)}else y||ES(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=P})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,ba(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(XY),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&wS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u{const H=j/1e3;SS(p.x,o.x,H),SS(p.y,o.y,H),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(nh(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),QY(this.relativeTarget,this.relativeTargetOrigin,y,H),q&&DY(this.relativeTarget,q)&&(this.isProjectionDirty=!1),q||(q=ln()),ns(q,this.relativeTarget)),N&&(this.animationValues=d,PY(d,l,this.latestValues,H,B,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=H},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(ba(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nr.update(()=>{j0.hasAnimatedSinceResize=!0,this.currentAnimation=FY(0,yS,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(yS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:u,layout:l,latestValues:d}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&CS(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||ln();const p=Ni(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+p;const y=Ni(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+y}ns(a,u),Hu(a,d),rh(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new OY),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(a=!0),!a)return;const l={};u.z&&ub("z",o,l,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(_S),this.root.sharedNodes.clear()}}}function qY(t){t.updateLayout()}function zY(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?rs(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],A=Ni(y);y.min=n[p].min,y.max=y.min+A}):CS(s,r.layoutBox,n)&&rs(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],A=Ni(n[p]);y.max=y.min+A,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[p].max=t.relativeTarget[p].min+A)});const a=qu();rh(a,n,r.layoutBox);const u=qu();o?rh(u,t.applyTransform(i,!0),r.measuredBox):rh(u,n,r.layoutBox);const l=!dS(a);let d=!1;if(!t.resumeFrom){const p=t.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:y,layout:A}=p;if(y&&A){const P=ln();nh(P,r.layoutBox,y.layoutBox);const N=ln();nh(N,n,A.layoutBox),mS(P,N)||(d=!0),p.options.layoutRoot&&(t.relativeTarget=N,t.relativeTargetOrigin=P,t.relativeParent=p)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:u,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function HY(t){sh&&Ec.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function WY(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function KY(t){t.clearSnapshot()}function _S(t){t.clearMeasurements()}function VY(t){t.isLayoutDirty=!1}function GY(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function ES(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function YY(t){t.resolveTargetDelta()}function JY(t){t.calcProjection()}function XY(t){t.resetSkewAndRotation()}function ZY(t){t.removeLeadSnapshot()}function SS(t,e,r){t.translate=Zr(e.translate,0,r),t.scale=Zr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function AS(t,e,r,n){t.min=Zr(e.min,r.min,n),t.max=Zr(e.max,r.max,n)}function QY(t,e,r,n){AS(t.x,e.x,r.x,n),AS(t.y,e.y,r.y,n)}function eJ(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const tJ={duration:.45,ease:[.4,0,.1,1]},PS=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),MS=PS("applewebkit/")&&!PS("chrome/")?Math.round:Wn;function IS(t){t.min=MS(t.min),t.max=MS(t.max)}function rJ(t){IS(t.x),IS(t.y)}function CS(t,e,r){return t==="position"||t==="preserve-aspect"&&!nY(vS(e),vS(r),.2)}function nJ(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const iJ=xS({attachResizeListener:(t,e)=>Lo(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),fb={current:void 0},TS=xS({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!fb.current){const t=new iJ({});t.mount(window),t.setOptions({layoutScroll:!0}),fb.current=t}return fb.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),sJ={pan:{Feature:yY},drag:{Feature:bY,ProjectionNode:TS,MeasureLayout:tS}};function RS(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||TE())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const u=a[n];u&&Nr.postRender(()=>u(s,o))};return ko(t.current,r,i,{passive:!t.getProps()[n]})}class oJ extends _a{mount(){this.unmount=No(RS(this.node,!0),RS(this.node,!1))}unmount(){}}class aJ extends _a{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=No(Lo(this.node.current,"focus",()=>this.onFocus()),Lo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const DS=(t,e)=>e?t===e?!0:DS(t,e.parentElement):!1;function lb(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,k0(r))}class cJ extends _a{constructor(){super(...arguments),this.removeStartListeners=Wn,this.removeEndListeners=Wn,this.removeAccessibleListeners=Wn,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=ko(window,"pointerup",(a,u)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:d,globalTapTarget:p}=this.node.getProps(),y=!p&&!DS(this.node.current,a.target)?d:l;y&&Nr.update(()=>y(a,u))},{passive:!(n.onTap||n.onPointerUp)}),o=ko(window,"pointercancel",(a,u)=>this.cancelPress(a,u),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=No(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||lb("up",(u,l)=>{const{onTap:d}=this.node.getProps();d&&Nr.postRender(()=>d(u,l))})};this.removeEndListeners(),this.removeEndListeners=Lo(this.node.current,"keyup",o),lb("down",(a,u)=>{this.startPress(a,u)})},r=Lo(this.node.current,"keydown",e),n=()=>{this.isPressing&&lb("cancel",(s,o)=>this.cancelPress(s,o))},i=Lo(this.node.current,"blur",n);this.removeAccessibleListeners=No(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Nr.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!TE()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Nr.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=ko(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=Lo(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=No(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const hb=new WeakMap,db=new WeakMap,uJ=t=>{const e=hb.get(t.target);e&&e(t)},fJ=t=>{t.forEach(uJ)};function lJ({root:t,...e}){const r=t||document;db.has(r)||db.set(r,{});const n=db.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(fJ,{root:t,...e})),n[i]}function hJ(t,e,r){const n=lJ(e);return hb.set(t,r),n.observe(t),()=>{hb.delete(t),n.unobserve(t)}}const dJ={some:0,all:1};class pJ extends _a{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:dJ[i]},a=u=>{const{isIntersecting:l}=u;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:p}=this.node.getProps(),y=l?d:p;y&&y(u)};return hJ(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(gJ(e,r))&&this.startObserver()}unmount(){}}function gJ({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const mJ={inView:{Feature:pJ},tap:{Feature:cJ},focus:{Feature:aJ},hover:{Feature:oJ}},vJ={layout:{ProjectionNode:TS,MeasureLayout:tS}},pb=Ee.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),z0=Ee.createContext({}),gb=typeof window<"u",OS=gb?Ee.useLayoutEffect:Ee.useEffect,NS=Ee.createContext({strict:!1});function bJ(t,e,r,n,i){var s,o;const{visualElement:a}=Ee.useContext(z0),u=Ee.useContext(NS),l=Ee.useContext(F0),d=Ee.useContext(pb).reducedMotion,p=Ee.useRef();n=n||u.renderer,!p.current&&n&&(p.current=n(t,{visualState:e,parent:a,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d}));const y=p.current,A=Ee.useContext(QE);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&yJ(p.current,r,i,A);const P=Ee.useRef(!1);Ee.useInsertionEffect(()=>{y&&P.current&&y.update(r,l)});const N=r[mE],D=Ee.useRef(!!N&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,N))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,N)));return OS(()=>{y&&(P.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),ab.render(y.render),D.current&&y.animationState&&y.animationState.animateChanges())}),Ee.useEffect(()=>{y&&(!D.current&&y.animationState&&y.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{var k;(k=window.MotionHandoffMarkAsComplete)===null||k===void 0||k.call(window,N)}),D.current=!1))}),y}function yJ(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:u,layoutRoot:l}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:LS(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&Uu(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:u,layoutRoot:l})}function LS(t){if(t)return t.options.allowProjection!==!1?t.projection:LS(t.parent)}function wJ(t,e,r){return Ee.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):Uu(r)&&(r.current=n))},[e])}function H0(t){return P0(t.animate)||wv.some(e=>Vl(t[e]))}function kS(t){return!!(H0(t)||t.variants)}function xJ(t,e){if(H0(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Vl(r)?r:void 0,animate:Vl(n)?n:void 0}}return t.inherit!==!1?e:{}}function _J(t){const{initial:e,animate:r}=xJ(t,Ee.useContext(z0));return Ee.useMemo(()=>({initial:e,animate:r}),[BS(e),BS(r)])}function BS(t){return Array.isArray(t)?t.join(" "):t}const $S={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Wu={};for(const t in $S)Wu[t]={isEnabled:e=>$S[t].some(r=>!!e[r])};function EJ(t){for(const e in t)Wu[e]={...Wu[e],...t[e]}}const SJ=Symbol.for("motionComponentSymbol");function AJ({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&EJ(t);function s(a,u){let l;const d={...Ee.useContext(pb),...a,layoutId:PJ(a)},{isStatic:p}=d,y=_J(a),A=n(a,p);if(!p&&gb){MJ(d,t);const P=IJ(d);l=P.MeasureLayout,y.visualElement=bJ(i,A,d,e,P.ProjectionNode)}return ge.jsxs(z0.Provider,{value:y,children:[l&&y.visualElement?ge.jsx(l,{visualElement:y.visualElement,...d}):null,r(i,a,wJ(A,y.visualElement,u),A,p,y.visualElement)]})}const o=Ee.forwardRef(s);return o[SJ]=i,o}function PJ({layoutId:t}){const e=Ee.useContext(ob).id;return e&&t!==void 0?e+"-"+t:t}function MJ(t,e){const r=Ee.useContext(NS).strict;if(process.env.NODE_ENV!=="production"&&e&&r){const n="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?ku(!1,n):Oo(!1,n)}}function IJ(t){const{drag:e,layout:r}=Wu;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const CJ=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function mb(t){return typeof t!="string"||t.includes("-")?!1:!!(CJ.indexOf(t)>-1||/[A-Z]/u.test(t))}function FS(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const jS=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function US(t,e,r,n){FS(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(jS.has(i)?i:Xv(i),e.attrs[i])}function qS(t,{layout:e,layoutId:r}){return bc.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!U0[t]||t==="opacity")}function vb(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(Qn(i[o])||e.style&&Qn(e.style[o])||qS(o,t)||((n=r==null?void 0:r.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function zS(t,e,r){const n=vb(t,e,r);for(const i in t)if(Qn(t[i])||Qn(e[i])){const s=Gl.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function bb(t){const e=Ee.useRef(null);return e.current===null&&(e.current=t()),e.current}function TJ({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:RJ(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const HS=t=>(e,r)=>{const n=Ee.useContext(z0),i=Ee.useContext(F0),s=()=>TJ(t,e,n,i);return r?s():bb(s)};function RJ(t,e,r,n){const i={},s=n(t,{});for(const y in s)i[y]=q0(s[y]);let{initial:o,animate:a}=t;const u=H0(t),l=kS(t);e&&l&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const p=d?a:o;if(p&&typeof p!="boolean"&&!P0(p)){const y=Array.isArray(p)?p:[p];for(let A=0;A({style:{},transform:{},transformOrigin:{},vars:{}}),WS=()=>({...yb(),attrs:{}}),KS=(t,e)=>e&&typeof t=="number"?e.transform(t):t,DJ={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},OJ=Gl.length;function NJ(t,e,r){let n="",i=!0;for(let s=0;stypeof t=="string"&&t.toLowerCase()==="svg",FJ={useVisualState:HS({scrapeMotionValuesFromProps:zS,createRenderState:WS,onMount:(t,e,{renderState:r,latestValues:n})=>{Nr.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),Nr.render(()=>{xb(r,n,_b(e.tagName),t.transformTemplate),US(e,r)})}})},jJ={useVisualState:HS({scrapeMotionValuesFromProps:vb,createRenderState:yb})};function GS(t,e,r){for(const n in e)!Qn(e[n])&&!qS(n,r)&&(t[n]=e[n])}function UJ({transformTemplate:t},e){return Ee.useMemo(()=>{const r=yb();return wb(r,e,t),Object.assign({},r.vars,r.style)},[e])}function qJ(t,e){const r=t.style||{},n={};return GS(n,r,t),Object.assign(n,UJ(t,e)),n}function zJ(t,e){const r={},n=qJ(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const HJ=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function W0(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||HJ.has(t)}let YS=t=>!W0(t);function WJ(t){t&&(YS=e=>e.startsWith("on")?!W0(e):t(e))}try{WJ(require("@emotion/is-prop-valid").default)}catch{}function KJ(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(YS(i)||r===!0&&W0(i)||!e&&!W0(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function VJ(t,e,r,n){const i=Ee.useMemo(()=>{const s=WS();return xb(s,e,_b(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};GS(s,t.style,t),i.style={...s,...i.style}}return i}function GJ(t=!1){return(r,n,i,{latestValues:s},o)=>{const u=(mb(r)?VJ:zJ)(n,s,o,r),l=KJ(n,typeof r=="string",t),d=r!==Ee.Fragment?{...l,...u,ref:i}:{},{children:p}=n,y=Ee.useMemo(()=>Qn(p)?p.get():p,[p]);return Ee.createElement(r,{...d,children:y})}}function YJ(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...mb(n)?FJ:jJ,preloadedFeatures:t,useRender:GJ(i),createVisualElement:e,Component:n};return AJ(o)}}const Eb={current:null},JS={current:!1};function JJ(){if(JS.current=!0,!!gb)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Eb.current=t.matches;t.addListener(e),e()}else Eb.current=!1}function XJ(t,e,r){for(const n in e){const i=e[n],s=r[n];if(Qn(i))t.addValue(n,i),process.env.NODE_ENV==="development"&&A0(i.version==="11.11.17",`Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`);else if(Qn(s))t.addValue(n,th(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,th(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const XS=new WeakMap,ZJ=[...L8,Zn,xa],QJ=t=>ZJ.find(N8(t)),ZS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class eX{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Iv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=to.now();this.renderScheduledAtthis.bindToMotionValue(n,r)),JS.current||JJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Eb.current,process.env.NODE_ENV!=="production"&&A0(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){XS.delete(this.current),this.projection&&this.projection.unmount(),ba(this.notifyUpdate),ba(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=bc.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Nr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Wu){const r=Wu[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ln()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=th(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(P8(i)||A8(i))?i=parseFloat(i):!QJ(i)&&xa.test(r)&&(i=K8(e,r)),this.setBaseTarget(e,Qn(i)?i.get():i)),Qn(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=bv(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Qn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new Jv),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class QS extends eX{constructor(){super(...arguments),this.KeyframeResolver=V8}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function tX(t){return window.getComputedStyle(t)}class rX extends QS{constructor(){super(...arguments),this.type="html",this.renderInstance=FS}readValueFromInstance(e,r){if(bc.has(r)){const n=Lv(r);return n&&n.default||0}else{const n=tX(e),i=(I8(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return JE(e,r)}build(e,r,n){wb(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return vb(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Qn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class nX extends QS{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ln}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(bc.has(r)){const n=Lv(r);return n&&n.default||0}return r=jS.has(r)?r:Xv(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return zS(e,r,n)}build(e,r,n){xb(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){US(e,r,n,i)}mount(e){this.isSVGTag=_b(e.tagName),super.mount(e)}}const iX=(t,e)=>mb(t)?new nX(e):new rX(e,{allowProjection:t!==Ee.Fragment}),sX=YJ({...GG,...mJ,...sJ,...vJ},iX),oX=UK(sX);class aX extends Yt.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function cX({children:t,isPresent:e}){const r=Ee.useId(),n=Ee.useRef(null),i=Ee.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=Ee.useContext(pb);return Ee.useInsertionEffect(()=>{const{width:o,height:a,top:u,left:l}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` [data-motion-pop-id="${r}"] { position: absolute !important; width: ${o}px !important; @@ -199,7 +199,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene top: ${u}px !important; left: ${l}px !important; } - `),()=>{document.head.removeChild(d)}},[e]),ge.jsx(aX,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const uX=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=bb(fX),u=Se.useId(),l=Se.useCallback(p=>{a.set(p,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Se.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:p=>(a.set(p,!1),()=>a.delete(p))}),s?[Math.random(),l]:[r,l]);return Se.useMemo(()=>{a.forEach((p,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=ge.jsx(cX,{isPresent:r,children:t})),ge.jsx(F0.Provider,{value:d,children:t})};function fX(){return new Map}const K0=t=>t.key||"";function QS(t){const e=[];return Se.Children.forEach(t,r=>{Se.isValidElement(r)&&e.push(r)}),e}const lX=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Oo(!e,"Replace exitBeforeEnter with mode='wait'");const a=Se.useMemo(()=>QS(t),[t]),u=a.map(K0),l=Se.useRef(!0),d=Se.useRef(a),p=bb(()=>new Map),[y,A]=Se.useState(a),[P,N]=Se.useState(a);DS(()=>{l.current=!1,d.current=a;for(let B=0;B1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=Se.useContext(ob);return ge.jsx(ge.Fragment,{children:P.map(B=>{const j=K0(B),U=a===P||u.includes(j),K=()=>{if(p.has(j))p.set(j,!0);else return;let J=!0;p.forEach(T=>{T||(J=!1)}),J&&(k==null||k(),N(d.current),i&&i())};return ge.jsx(uX,{isPresent:U,initial:!l.current||n?void 0:!1,custom:U?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:U?void 0:K,children:B},j)})})},Ss=t=>ge.jsx(lX,{children:ge.jsx(oX.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Sb(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return ge.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,ge.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[ge.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),ge.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:ge.jsx(NK,{})})]})]})}function hX(t){return t.lastUsed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function e7(t){var o,a;const{wallet:e,onClick:r}=t,n=ge.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Se.useMemo(()=>hX(e),[e]);return ge.jsx(Sb,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function t7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=vX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Ab);return a[0]===""&&a.length!==1&&a.shift(),r7(a,e)||mX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},r7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?r7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Ab);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},n7=/^\[(.+)\]$/,mX=t=>{if(n7.test(t)){const e=n7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},vX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return yX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Pb(o,n,s,e)}),n},Pb=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:i7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(bX(i)){Pb(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Pb(o,i7(e,s),r,n)})})},i7=(t,e)=>{let r=t;return e.split(Ab).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},bX=t=>t.isThemeGetter,yX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,wX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},s7="!",xX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,p;for(let D=0;Dd?p-d:void 0;return{modifiers:u,hasImportantModifier:A,baseClassName:P,maybePostfixModifierPosition:N}};return r?a=>r({className:a,parseClassName:o}):o},_X=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},EX=t=>({cache:wX(t.cacheSize),parseClassName:xX(t),...gX(t)}),SX=/\s+/,AX=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(SX);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:A}=r(l);let P=!!A,N=n(P?y.substring(0,A):y);if(!N){if(!P){a=l+(a.length>0?" "+a:a);continue}if(N=n(y),!N){a=l+(a.length>0?" "+a:a);continue}P=!1}const D=_X(d).join(":"),k=p?D+s7:D,B=k+N;if(s.includes(B))continue;s.push(B);const j=i(N,P);for(let U=0;U0?" "+a:a)}return a};function PX(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;np(d),t());return r=EX(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=AX(u,r);return i(u,d),d}return function(){return s(PX.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},a7=/^\[(?:([a-z-]+):)?(.+)\]$/i,IX=/^\d+\/\d+$/,CX=new Set(["px","full","screen"]),TX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RX=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,DX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,OX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bo=t=>Wu(t)||CX.has(t)||IX.test(t),Ea=t=>Ku(t,"length",qX),Wu=t=>!!t&&!Number.isNaN(Number(t)),Mb=t=>Ku(t,"number",Wu),oh=t=>!!t&&Number.isInteger(Number(t)),LX=t=>t.endsWith("%")&&Wu(t.slice(0,-1)),cr=t=>a7.test(t),Sa=t=>TX.test(t),kX=new Set(["length","size","percentage"]),BX=t=>Ku(t,kX,c7),$X=t=>Ku(t,"position",c7),FX=new Set(["image","url"]),jX=t=>Ku(t,FX,HX),UX=t=>Ku(t,"",zX),ah=()=>!0,Ku=(t,e,r)=>{const n=a7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},qX=t=>RX.test(t)&&!DX.test(t),c7=()=>!1,zX=t=>OX.test(t),HX=t=>NX.test(t),WX=MX(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),p=Gr("invert"),y=Gr("gap"),A=Gr("gradientColorStops"),P=Gr("gradientColorStopPositions"),N=Gr("inset"),D=Gr("margin"),k=Gr("opacity"),B=Gr("padding"),j=Gr("saturate"),U=Gr("scale"),K=Gr("sepia"),J=Gr("skew"),T=Gr("space"),z=Gr("translate"),ue=()=>["auto","contain","none"],_e=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",Bo,Ea],f=()=>["auto",Wu,cr],g=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],S=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Wu,cr];return{cacheSize:500,separator:":",theme:{colors:[ah],spacing:[Bo,Ea],blur:["none","",Sa,cr],brightness:M(),borderColor:[t],borderRadius:["none","","full",Sa,cr],borderSpacing:E(),borderWidth:m(),contrast:M(),grayscale:S(),hueRotate:M(),invert:S(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[LX,Ea],inset:G(),margin:G(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:S(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Sa]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...g(),cr]}],overflow:[{overflow:_e()}],"overflow-x":[{"overflow-x":_e()}],"overflow-y":[{"overflow-y":_e()}],overscroll:[{overscroll:ue()}],"overscroll-x":[{"overscroll-x":ue()}],"overscroll-y":[{"overscroll-y":ue()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",oh,cr]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",oh,cr]}],"grid-cols":[{"grid-cols":[ah]}],"col-start-end":[{col:["auto",{span:["full",oh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[ah]}],"row-start-end":[{row:["auto",{span:[oh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[B]}],px:[{px:[B]}],py:[{py:[B]}],ps:[{ps:[B]}],pe:[{pe:[B]}],pt:[{pt:[B]}],pr:[{pr:[B]}],pb:[{pb:[B]}],pl:[{pl:[B]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Sa]},Sa]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Sa,Ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Mb]}],"font-family":[{font:[ah]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Wu,Mb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Bo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Bo,Ea]}],"underline-offset":[{"underline-offset":["auto",Bo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...g(),$X]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",BX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},jX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[A]}],"gradient-via":[{via:[A]}],"gradient-to":[{to:[A]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[Bo,cr]}],"outline-w":[{outline:[Bo,Ea]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Bo,Ea]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Sa,UX]}],"shadow-color":[{shadow:[ah]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Sa,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[p]}],saturate:[{saturate:[j]}],sepia:[{sepia:[K]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[j]}],"backdrop-sepia":[{"backdrop-sepia":[K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[U]}],"scale-x":[{"scale-x":[U]}],"scale-y":[{"scale-y":[U]}],rotate:[{rotate:[oh,cr]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[J]}],"skew-y":[{"skew-y":[J]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Bo,Ea,Mb]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function $o(...t){return WX(pX(t))}function u7(t){const{className:e}=t;return ge.jsxs("div",{className:$o("xc-flex xc-items-center xc-gap-2"),children:[ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)}),ge.jsx("div",{className:"xc-shrink-0",children:t.children}),ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)})]})}const KX="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function VX(t){const{onClick:e}=t;function r(){e&&e()}return ge.jsx(u7,{className:"xc-opacity-20",children:ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[ge.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),ge.jsx(u8,{size:16})]})})}function f7(t){const[e,r]=Se.useState(""),{featuredWallets:n,initialized:i}=Kl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Se.useMemo(()=>{const N=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!N.test(e)&&D.test(e)},[e]);function p(N){o(N)}function y(N){r(N.target.value)}async function A(){s(e)}function P(N){N.key==="Enter"&&d&&A()}return ge.jsx(Ss,{children:i&&ge.jsxs(ge.Fragment,{children:[t.header||ge.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),ge.jsxs("div",{children:[ge.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(N=>ge.jsx(e7,{wallet:N,onClick:p},`feature-${N.key}`)),l.showTonConnect&&ge.jsx(Sb,{icon:ge.jsx("img",{className:"xc-h-5 xc-w-5",src:KX}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&ge.jsx(VX,{onClick:a})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&ge.jsx("div",{className:"xc-mb-4 xc-mt-4",children:ge.jsxs(u7,{className:"xc-opacity-20",children:[" ",ge.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),l.showEmailSignIn&&ge.jsxs("div",{className:"xc-mb-4",children:[ge.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:y,onKeyDown:P}),ge.jsx("button",{disabled:!d,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:A,children:"Continue"})]})]})})}function Sc(t){const{title:e}=t;return ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[ge.jsx(OK,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),ge.jsx("span",{children:e})]})}const l7=Se.createContext({channel:"",device:"WEB",app:"",inviterCode:"",role:"C"});function Ib(){return Se.useContext(l7)}function GX(t){const{config:e}=t,[r,n]=Se.useState(e.channel),[i,s]=Se.useState(e.device),[o,a]=Se.useState(e.app),[u,l]=Se.useState(e.role||"C"),[d,p]=Se.useState(e.inviterCode);return Se.useEffect(()=>{n(e.channel),s(e.device),a(e.app),p(e.inviterCode),l(e.role||"C")},[e]),ge.jsx(l7.Provider,{value:{channel:r,device:i,app:o,inviterCode:d,role:u},children:t.children})}var YX=Object.defineProperty,JX=Object.defineProperties,XX=Object.getOwnPropertyDescriptors,V0=Object.getOwnPropertySymbols,h7=Object.prototype.hasOwnProperty,d7=Object.prototype.propertyIsEnumerable,p7=(t,e,r)=>e in t?YX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ZX=(t,e)=>{for(var r in e||(e={}))h7.call(e,r)&&p7(t,r,e[r]);if(V0)for(var r of V0(e))d7.call(e,r)&&p7(t,r,e[r]);return t},QX=(t,e)=>JX(t,XX(e)),eZ=(t,e)=>{var r={};for(var n in t)h7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&V0)for(var n of V0(t))e.indexOf(n)<0&&d7.call(t,n)&&(r[n]=t[n]);return r};function tZ(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function rZ(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var nZ=18,g7=40,iZ=`${g7}px`,sZ=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function oZ({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),p=Yt.useCallback(()=>{let y=t.current,A=e.current;if(!y||!A||u||r==="none")return;let P=y,N=P.getBoundingClientRect().left+P.offsetWidth,D=P.getBoundingClientRect().top+P.offsetHeight/2,k=N-nZ,B=D;document.querySelectorAll(sZ).length===0&&document.elementFromPoint(k,B)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function A(){let N=window.innerWidth-y.getBoundingClientRect().right;a(N>=g7)}A();let P=setInterval(A,1e3);return()=>{clearInterval(P)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let A=setTimeout(p,0),P=setTimeout(p,2e3),N=setTimeout(p,5e3),D=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(A),clearTimeout(P),clearTimeout(N),clearTimeout(D)}},[e,n,r,p]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:iZ}}var m7=Yt.createContext({}),v7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:p="increase-width",pasteTransformer:y,containerClassName:A,noScriptCSSFallback:P=aZ,render:N,children:D}=r,k=eZ(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),B,j,U,K,J;let[T,z]=Yt.useState(typeof k.defaultValue=="string"?k.defaultValue:""),ue=n??T,_e=rZ(ue),G=Yt.useCallback(ie=>{i==null||i(ie),z(ie)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),g=Yt.useRef({value:ue,onChange:G,isIOS:typeof window<"u"&&((j=(B=window==null?void 0:window.CSS)==null?void 0:B.supports)==null?void 0:j.call(B,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(U=m.current)==null?void 0:U.selectionStart,(K=m.current)==null?void 0:K.selectionEnd,(J=m.current)==null?void 0:J.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let ie=m.current,fe=f.current;if(!ie||!fe)return;g.current.value!==ie.value&&g.current.onChange(ie.value),v.current.prev=[ie.selectionStart,ie.selectionEnd,ie.selectionDirection];function ve(){if(document.activeElement!==ie){I(null),ae(null);return}let Te=ie.selectionStart,$e=ie.selectionEnd,Ie=ie.selectionDirection,Le=ie.maxLength,Ve=ie.value,ke=v.current.prev,ze=-1,He=-1,Ee;if(Ve.length!==0&&Te!==null&&$e!==null){let et=Te===$e,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let pt=0;if(ke[0]!==null&&ke[1]!==null){Ee=Je{fe&&fe.style.setProperty("--root-height",`${ie.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(ie),()=>{document.removeEventListener("selectionchange",ve,{capture:!0}),Ne.disconnect()}},[]);let[x,_]=Yt.useState(!1),[S,b]=Yt.useState(!1),[M,I]=Yt.useState(null),[F,ae]=Yt.useState(null);Yt.useEffect(()=>{tZ(()=>{var ie,fe,ve,Me;(ie=m.current)==null||ie.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(ve=m.current)==null?void 0:ve.selectionEnd,$e=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ae(Te),v.current.prev=[Ne,Te,$e])})},[ue,S]),Yt.useEffect(()=>{_e!==void 0&&ue!==_e&&_e.length{let fe=ie.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){ie.preventDefault();return}typeof _e=="string"&&fe.length<_e.length&&document.dispatchEvent(new Event("selectionchange")),G(fe)},[s,G,_e,E]),ee=Yt.useCallback(()=>{var ie;if(m.current){let fe=Math.min(m.current.value.length,s-1),ve=m.current.value.length;(ie=m.current)==null||ie.setSelectionRange(fe,ve),I(fe),ae(ve)}b(!0)},[s]),X=Yt.useCallback(ie=>{var fe,ve;let Me=m.current;if(!y&&(!g.current.isIOS||!ie.clipboardData||!Me))return;let Ne=ie.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),ie.preventDefault();let $e=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(ve=m.current)==null?void 0:ve.selectionEnd,Le=($e!==Ie?ue.slice(0,$e)+Te+ue.slice(Ie):ue.slice(0,$e)+Te+ue.slice($e)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,G(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ae(ke)},[s,G,E,ue]),Q=Yt.useMemo(()=>({position:"relative",cursor:k.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[k.disabled]),R=Yt.useMemo(()=>({position:"absolute",inset:0,width:O.willPushPWMBadge?`calc(100% + ${O.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:O.willPushPWMBadge?`inset(0 ${O.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[O.PWM_BADGE_SPACE_WIDTH,O.willPushPWMBadge,o]),Z=Yt.useMemo(()=>Yt.createElement("input",QX(ZX({autoComplete:k.autoComplete||"one-time-code"},k),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ue.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:R,maxLength:s,value:ue,ref:m,onPaste:ie=>{var fe;X(ie),(fe=k.onPaste)==null||fe.call(k,ie)},onChange:se,onMouseOver:ie=>{var fe;_(!0),(fe=k.onMouseOver)==null||fe.call(k,ie)},onMouseLeave:ie=>{var fe;_(!1),(fe=k.onMouseLeave)==null||fe.call(k,ie)},onFocus:ie=>{var fe;ee(),(fe=k.onFocus)==null||fe.call(k,ie)},onBlur:ie=>{var fe;b(!1),(fe=k.onBlur)==null||fe.call(k,ie)}})),[se,ee,X,l,R,s,F,M,k,E==null?void 0:E.source,ue]),te=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ie,fe)=>{var ve;let Me=S&&M!==null&&F!==null&&(M===F&&fe===M||fe>=M&&feN?N(te):Yt.createElement(m7.Provider,{value:te},D),[D,te,N]);return Yt.createElement(Yt.Fragment,null,P!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,P)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:A},le,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Z)))});v7.displayName="Input";function ch(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var aZ=` + `),()=>{document.head.removeChild(d)}},[e]),ge.jsx(aX,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const uX=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=bb(fX),u=Ee.useId(),l=Ee.useCallback(p=>{a.set(p,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Ee.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:p=>(a.set(p,!1),()=>a.delete(p))}),s?[Math.random(),l]:[r,l]);return Ee.useMemo(()=>{a.forEach((p,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=ge.jsx(cX,{isPresent:r,children:t})),ge.jsx(F0.Provider,{value:d,children:t})};function fX(){return new Map}const K0=t=>t.key||"";function e7(t){const e=[];return Ee.Children.forEach(t,r=>{Ee.isValidElement(r)&&e.push(r)}),e}const lX=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Oo(!e,"Replace exitBeforeEnter with mode='wait'");const a=Ee.useMemo(()=>e7(t),[t]),u=a.map(K0),l=Ee.useRef(!0),d=Ee.useRef(a),p=bb(()=>new Map),[y,A]=Ee.useState(a),[P,N]=Ee.useState(a);OS(()=>{l.current=!1,d.current=a;for(let B=0;B1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=Ee.useContext(ob);return ge.jsx(ge.Fragment,{children:P.map(B=>{const q=K0(B),j=a===P||u.includes(q),H=()=>{if(p.has(q))p.set(q,!0);else return;let J=!0;p.forEach(T=>{T||(J=!1)}),J&&(k==null||k(),N(d.current),i&&i())};return ge.jsx(uX,{isPresent:j,initial:!l.current||n?void 0:!1,custom:j?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:j?void 0:H,children:B},q)})})},Ss=t=>ge.jsx(lX,{children:ge.jsx(oX.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Sb(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return ge.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,ge.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[ge.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),ge.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:ge.jsx(NK,{})})]})]})}function hX(t){return t.lastUsed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function Ab(t){var o,a;const{wallet:e,onClick:r}=t,n=ge.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Ee.useMemo(()=>hX(e),[e]);return ge.jsx(Sb,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function t7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=vX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Pb);return a[0]===""&&a.length!==1&&a.shift(),r7(a,e)||mX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},r7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?r7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Pb);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},n7=/^\[(.+)\]$/,mX=t=>{if(n7.test(t)){const e=n7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},vX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return yX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Mb(o,n,s,e)}),n},Mb=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:i7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(bX(i)){Mb(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Mb(o,i7(e,s),r,n)})})},i7=(t,e)=>{let r=t;return e.split(Pb).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},bX=t=>t.isThemeGetter,yX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,wX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},s7="!",xX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,p;for(let D=0;Dd?p-d:void 0;return{modifiers:u,hasImportantModifier:A,baseClassName:P,maybePostfixModifierPosition:N}};return r?a=>r({className:a,parseClassName:o}):o},_X=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},EX=t=>({cache:wX(t.cacheSize),parseClassName:xX(t),...gX(t)}),SX=/\s+/,AX=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(SX);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:A}=r(l);let P=!!A,N=n(P?y.substring(0,A):y);if(!N){if(!P){a=l+(a.length>0?" "+a:a);continue}if(N=n(y),!N){a=l+(a.length>0?" "+a:a);continue}P=!1}const D=_X(d).join(":"),k=p?D+s7:D,B=k+N;if(s.includes(B))continue;s.push(B);const q=i(N,P);for(let j=0;j0?" "+a:a)}return a};function PX(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;np(d),t());return r=EX(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=AX(u,r);return i(u,d),d}return function(){return s(PX.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},a7=/^\[(?:([a-z-]+):)?(.+)\]$/i,IX=/^\d+\/\d+$/,CX=new Set(["px","full","screen"]),TX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RX=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,DX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,OX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bo=t=>Ku(t)||CX.has(t)||IX.test(t),Ea=t=>Vu(t,"length",qX),Ku=t=>!!t&&!Number.isNaN(Number(t)),Ib=t=>Vu(t,"number",Ku),oh=t=>!!t&&Number.isInteger(Number(t)),LX=t=>t.endsWith("%")&&Ku(t.slice(0,-1)),cr=t=>a7.test(t),Sa=t=>TX.test(t),kX=new Set(["length","size","percentage"]),BX=t=>Vu(t,kX,c7),$X=t=>Vu(t,"position",c7),FX=new Set(["image","url"]),jX=t=>Vu(t,FX,HX),UX=t=>Vu(t,"",zX),ah=()=>!0,Vu=(t,e,r)=>{const n=a7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},qX=t=>RX.test(t)&&!DX.test(t),c7=()=>!1,zX=t=>OX.test(t),HX=t=>NX.test(t),WX=MX(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),p=Gr("invert"),y=Gr("gap"),A=Gr("gradientColorStops"),P=Gr("gradientColorStopPositions"),N=Gr("inset"),D=Gr("margin"),k=Gr("opacity"),B=Gr("padding"),q=Gr("saturate"),j=Gr("scale"),H=Gr("sepia"),J=Gr("skew"),T=Gr("space"),z=Gr("translate"),ue=()=>["auto","contain","none"],_e=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",Bo,Ea],f=()=>["auto",Ku,cr],g=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],S=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Ku,cr];return{cacheSize:500,separator:":",theme:{colors:[ah],spacing:[Bo,Ea],blur:["none","",Sa,cr],brightness:M(),borderColor:[t],borderRadius:["none","","full",Sa,cr],borderSpacing:E(),borderWidth:m(),contrast:M(),grayscale:S(),hueRotate:M(),invert:S(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[LX,Ea],inset:G(),margin:G(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:S(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Sa]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...g(),cr]}],overflow:[{overflow:_e()}],"overflow-x":[{"overflow-x":_e()}],"overflow-y":[{"overflow-y":_e()}],overscroll:[{overscroll:ue()}],"overscroll-x":[{"overscroll-x":ue()}],"overscroll-y":[{"overscroll-y":ue()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",oh,cr]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",oh,cr]}],"grid-cols":[{"grid-cols":[ah]}],"col-start-end":[{col:["auto",{span:["full",oh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[ah]}],"row-start-end":[{row:["auto",{span:[oh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[B]}],px:[{px:[B]}],py:[{py:[B]}],ps:[{ps:[B]}],pe:[{pe:[B]}],pt:[{pt:[B]}],pr:[{pr:[B]}],pb:[{pb:[B]}],pl:[{pl:[B]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Sa]},Sa]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Sa,Ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ib]}],"font-family":[{font:[ah]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Ku,Ib]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Bo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Bo,Ea]}],"underline-offset":[{"underline-offset":["auto",Bo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...g(),$X]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",BX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},jX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[A]}],"gradient-via":[{via:[A]}],"gradient-to":[{to:[A]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[Bo,cr]}],"outline-w":[{outline:[Bo,Ea]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Bo,Ea]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Sa,UX]}],"shadow-color":[{shadow:[ah]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Sa,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[p]}],saturate:[{saturate:[q]}],sepia:[{sepia:[H]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[q]}],"backdrop-sepia":[{"backdrop-sepia":[H]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[oh,cr]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[J]}],"skew-y":[{"skew-y":[J]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Bo,Ea,Ib]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function $o(...t){return WX(pX(t))}function u7(t){const{className:e}=t;return ge.jsxs("div",{className:$o("xc-flex xc-items-center xc-gap-2"),children:[ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)}),ge.jsx("div",{className:"xc-shrink-0",children:t.children}),ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)})]})}const KX="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function VX(t){const{onClick:e}=t;function r(){e&&e()}return ge.jsx(u7,{className:"xc-opacity-20",children:ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[ge.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),ge.jsx(f8,{size:16})]})})}function f7(t){const[e,r]=Ee.useState(""),{featuredWallets:n,initialized:i}=Kl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Ee.useMemo(()=>n==null?void 0:n.find(D=>{var k;return((k=D.config)==null?void 0:k.rdns)==="binance"}),[n]),p=Ee.useMemo(()=>{const D=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,k=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!D.test(e)&&k.test(e)},[e]);function y(D){o(D)}function A(D){r(D.target.value)}async function P(){s(e)}function N(D){D.key==="Enter"&&p&&P()}return ge.jsx(Ss,{children:i&&ge.jsxs(ge.Fragment,{children:[t.header||ge.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),d&&ge.jsx("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:ge.jsx(Ab,{wallet:d,onClick:y},`feature-${d.key}`)}),!d&&ge.jsxs(ge.Fragment,{children:[ge.jsxs("div",{children:[ge.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(D=>ge.jsx(Ab,{wallet:D,onClick:y},`feature-${D.key}`)),l.showTonConnect&&ge.jsx(Sb,{icon:ge.jsx("img",{className:"xc-h-5 xc-w-5",src:KX}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&ge.jsx(VX,{onClick:a})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&ge.jsx("div",{className:"xc-mb-4 xc-mt-4",children:ge.jsxs(u7,{className:"xc-opacity-20",children:[" ",ge.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),l.showEmailSignIn&&ge.jsxs("div",{className:"xc-mb-4",children:[ge.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:A,onKeyDown:N}),ge.jsx("button",{disabled:!p,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:P,children:"Continue"})]})]})]})})}function Sc(t){const{title:e}=t;return ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[ge.jsx(OK,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),ge.jsx("span",{children:e})]})}const l7=Ee.createContext({channel:"",device:"WEB",app:"",inviterCode:"",role:"C"});function Cb(){return Ee.useContext(l7)}function GX(t){const{config:e}=t,[r,n]=Ee.useState(e.channel),[i,s]=Ee.useState(e.device),[o,a]=Ee.useState(e.app),[u,l]=Ee.useState(e.role||"C"),[d,p]=Ee.useState(e.inviterCode);return Ee.useEffect(()=>{n(e.channel),s(e.device),a(e.app),p(e.inviterCode),l(e.role||"C")},[e]),ge.jsx(l7.Provider,{value:{channel:r,device:i,app:o,inviterCode:d,role:u},children:t.children})}var YX=Object.defineProperty,JX=Object.defineProperties,XX=Object.getOwnPropertyDescriptors,V0=Object.getOwnPropertySymbols,h7=Object.prototype.hasOwnProperty,d7=Object.prototype.propertyIsEnumerable,p7=(t,e,r)=>e in t?YX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ZX=(t,e)=>{for(var r in e||(e={}))h7.call(e,r)&&p7(t,r,e[r]);if(V0)for(var r of V0(e))d7.call(e,r)&&p7(t,r,e[r]);return t},QX=(t,e)=>JX(t,XX(e)),eZ=(t,e)=>{var r={};for(var n in t)h7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&V0)for(var n of V0(t))e.indexOf(n)<0&&d7.call(t,n)&&(r[n]=t[n]);return r};function tZ(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function rZ(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var nZ=18,g7=40,iZ=`${g7}px`,sZ=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function oZ({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),p=Yt.useCallback(()=>{let y=t.current,A=e.current;if(!y||!A||u||r==="none")return;let P=y,N=P.getBoundingClientRect().left+P.offsetWidth,D=P.getBoundingClientRect().top+P.offsetHeight/2,k=N-nZ,B=D;document.querySelectorAll(sZ).length===0&&document.elementFromPoint(k,B)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function A(){let N=window.innerWidth-y.getBoundingClientRect().right;a(N>=g7)}A();let P=setInterval(A,1e3);return()=>{clearInterval(P)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let A=setTimeout(p,0),P=setTimeout(p,2e3),N=setTimeout(p,5e3),D=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(A),clearTimeout(P),clearTimeout(N),clearTimeout(D)}},[e,n,r,p]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:iZ}}var m7=Yt.createContext({}),v7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:p="increase-width",pasteTransformer:y,containerClassName:A,noScriptCSSFallback:P=aZ,render:N,children:D}=r,k=eZ(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),B,q,j,H,J;let[T,z]=Yt.useState(typeof k.defaultValue=="string"?k.defaultValue:""),ue=n??T,_e=rZ(ue),G=Yt.useCallback(ie=>{i==null||i(ie),z(ie)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),g=Yt.useRef({value:ue,onChange:G,isIOS:typeof window<"u"&&((q=(B=window==null?void 0:window.CSS)==null?void 0:B.supports)==null?void 0:q.call(B,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(j=m.current)==null?void 0:j.selectionStart,(H=m.current)==null?void 0:H.selectionEnd,(J=m.current)==null?void 0:J.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let ie=m.current,fe=f.current;if(!ie||!fe)return;g.current.value!==ie.value&&g.current.onChange(ie.value),v.current.prev=[ie.selectionStart,ie.selectionEnd,ie.selectionDirection];function ve(){if(document.activeElement!==ie){I(null),ae(null);return}let Te=ie.selectionStart,$e=ie.selectionEnd,Ie=ie.selectionDirection,Le=ie.maxLength,Ve=ie.value,ke=v.current.prev,ze=-1,He=-1,Se;if(Ve.length!==0&&Te!==null&&$e!==null){let et=Te===$e,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let pt=0;if(ke[0]!==null&&ke[1]!==null){Se=Je{fe&&fe.style.setProperty("--root-height",`${ie.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(ie),()=>{document.removeEventListener("selectionchange",ve,{capture:!0}),Ne.disconnect()}},[]);let[x,_]=Yt.useState(!1),[S,b]=Yt.useState(!1),[M,I]=Yt.useState(null),[F,ae]=Yt.useState(null);Yt.useEffect(()=>{tZ(()=>{var ie,fe,ve,Me;(ie=m.current)==null||ie.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(ve=m.current)==null?void 0:ve.selectionEnd,$e=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ae(Te),v.current.prev=[Ne,Te,$e])})},[ue,S]),Yt.useEffect(()=>{_e!==void 0&&ue!==_e&&_e.length{let fe=ie.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){ie.preventDefault();return}typeof _e=="string"&&fe.length<_e.length&&document.dispatchEvent(new Event("selectionchange")),G(fe)},[s,G,_e,E]),ee=Yt.useCallback(()=>{var ie;if(m.current){let fe=Math.min(m.current.value.length,s-1),ve=m.current.value.length;(ie=m.current)==null||ie.setSelectionRange(fe,ve),I(fe),ae(ve)}b(!0)},[s]),X=Yt.useCallback(ie=>{var fe,ve;let Me=m.current;if(!y&&(!g.current.isIOS||!ie.clipboardData||!Me))return;let Ne=ie.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),ie.preventDefault();let $e=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(ve=m.current)==null?void 0:ve.selectionEnd,Le=($e!==Ie?ue.slice(0,$e)+Te+ue.slice(Ie):ue.slice(0,$e)+Te+ue.slice($e)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,G(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ae(ke)},[s,G,E,ue]),Q=Yt.useMemo(()=>({position:"relative",cursor:k.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[k.disabled]),R=Yt.useMemo(()=>({position:"absolute",inset:0,width:O.willPushPWMBadge?`calc(100% + ${O.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:O.willPushPWMBadge?`inset(0 ${O.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[O.PWM_BADGE_SPACE_WIDTH,O.willPushPWMBadge,o]),Z=Yt.useMemo(()=>Yt.createElement("input",QX(ZX({autoComplete:k.autoComplete||"one-time-code"},k),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ue.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:R,maxLength:s,value:ue,ref:m,onPaste:ie=>{var fe;X(ie),(fe=k.onPaste)==null||fe.call(k,ie)},onChange:se,onMouseOver:ie=>{var fe;_(!0),(fe=k.onMouseOver)==null||fe.call(k,ie)},onMouseLeave:ie=>{var fe;_(!1),(fe=k.onMouseLeave)==null||fe.call(k,ie)},onFocus:ie=>{var fe;ee(),(fe=k.onFocus)==null||fe.call(k,ie)},onBlur:ie=>{var fe;b(!1),(fe=k.onBlur)==null||fe.call(k,ie)}})),[se,ee,X,l,R,s,F,M,k,E==null?void 0:E.source,ue]),te=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ie,fe)=>{var ve;let Me=S&&M!==null&&F!==null&&(M===F&&fe===M||fe>=M&&feN?N(te):Yt.createElement(m7.Provider,{value:te},D),[D,te,N]);return Yt.createElement(Yt.Fragment,null,P!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,P)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:A},le,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Z)))});v7.displayName="Input";function ch(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var aZ=` [data-input-otp] { --nojs-bg: white !important; --nojs-fg: black !important; @@ -218,9 +218,9 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene --nojs-bg: black !important; --nojs-fg: white !important; } -}`;const b7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>ge.jsx(v7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));b7.displayName="InputOTP";const y7=Yt.forwardRef(({className:t,...e},r)=>ge.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));y7.displayName="InputOTPGroup";const Ac=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(m7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return ge.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&ge.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:ge.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Ac.displayName="InputOTPSlot";function cZ(t){const{spinning:e,children:r,className:n}=t;return ge.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&ge.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:ge.jsx(vc,{className:"xc-animate-spin"})})]})}function w7(t){const{email:e}=t,[r,n]=Se.useState(0),[i,s]=Se.useState(!1),[o,a]=Se.useState("");async function u(){n(60);const d=setInterval(()=>{n(p=>p===0?(clearInterval(d),0):p-1)},1e3)}async function l(d){if(a(""),!(d.length<6)){s(!0);try{await t.onInputCode(e,d)}catch(p){a(p.message)}s(!1)}}return Se.useEffect(()=>{u()},[]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(FK,{className:"xc-mb-4",size:60}),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:[ge.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),ge.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]}),ge.jsx("div",{className:"xc-mb-2 xc-h-12",children:ge.jsx(cZ,{spinning:i,className:"xc-rounded-xl",children:ge.jsx(b7,{maxLength:6,onChange:l,disabled:i,className:"disabled:xc-opacity-20",children:ge.jsx(y7,{children:ge.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[ge.jsx(Ac,{index:0}),ge.jsx(Ac,{index:1}),ge.jsx(Ac,{index:2}),ge.jsx(Ac,{index:3}),ge.jsx(Ac,{index:4}),ge.jsx(Ac,{index:5})]})})})})}),o&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:o})})]}),ge.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Resend in ${r}s`:ge.jsx("button",{id:"sendCodeButton",onClick:t.onResendCode,children:"Send again"})]}),ge.jsx("div",{id:"captcha-element"})]})}function x7(t){const{email:e}=t,[r,n]=Se.useState(!1),[i,s]=Se.useState(""),o=Se.useMemo(()=>`xn-btn-${new Date().getTime()}`,[e]);async function a(y,A){n(!0),s(""),await va.getEmailCode({account_type:"email",email:y},A),n(!1)}async function u(y){try{return await a(e,JSON.stringify(y)),{captchaResult:!0,bizResult:!0}}catch(A){return s(A.message),{captchaResult:!1,bizResult:!1}}}async function l(y){y&&t.onCodeSend()}const d=Se.useRef();function p(y){d.current=y}return Se.useEffect(()=>{if(e)return window.initAliyunCaptcha({SceneId:"tqyu8129d",prefix:"1mfsn5f",mode:"popup",element:"#captcha-element",button:`#${o}`,captchaVerifyCallback:u,onBizResultCallback:l,getInstance:p,slideStyle:{width:360,height:40},language:"en",region:"cn"}),()=>{var y,A;(y=document.getElementById("aliyunCaptcha-mask"))==null||y.remove(),(A=document.getElementById("aliyunCaptcha-window-popup"))==null||A.remove()}},[e]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(jK,{className:"xc-mb-4",size:60}),ge.jsx("button",{className:"xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2",id:o,children:r?ge.jsx(vc,{className:"xc-animate-spin"}):"I'm not a robot"})]}),i&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:i})})]})}function uZ(t){const{email:e}=t,r=Ib(),[n,i]=Se.useState("captcha");async function s(o,a){const u=await va.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:a,email:o,inviter_code:r.inviterCode,source:{device:r.device,channel:r.channel,app:r.app}});t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),n==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>i("verify-email")}),n==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:s,onResendCode:()=>i("captcha")})]})}var _7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var p=function(f,g){var v=f,x=k[g],_=null,S=0,b=null,M=[],I={},F=function(te,le){_=function(ie){for(var fe=new Array(ie),ve=0;ve=7&&ee(te),b==null&&(b=R(v,x,M)),Q(b,le)},ae=function(te,le){for(var ie=-1;ie<=7;ie+=1)if(!(te+ie<=-1||S<=te+ie))for(var fe=-1;fe<=7;fe+=1)le+fe<=-1||S<=le+fe||(_[te+ie][le+fe]=0<=ie&&ie<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(ie==0||ie==6)||2<=ie&&ie<=4&&2<=fe&&fe<=4)},O=function(){for(var te=8;te>ie&1)==1;_[Math.floor(ie/3)][ie%3+S-8-3]=fe}for(ie=0;ie<18;ie+=1)fe=!te&&(le>>ie&1)==1,_[ie%3+S-8-3][Math.floor(ie/3)]=fe},X=function(te,le){for(var ie=x<<3|le,fe=B.getBCHTypeInfo(ie),ve=0;ve<15;ve+=1){var Me=!te&&(fe>>ve&1)==1;ve<6?_[ve][8]=Me:ve<8?_[ve+1][8]=Me:_[S-15+ve][8]=Me}for(ve=0;ve<15;ve+=1)Me=!te&&(fe>>ve&1)==1,ve<8?_[8][S-ve-1]=Me:ve<9?_[8][15-ve-1+1]=Me:_[8][15-ve-1]=Me;_[S-8][8]=!te},Q=function(te,le){for(var ie=-1,fe=S-1,ve=7,Me=0,Ne=B.getMaskFunction(le),Te=S-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var $e=0;$e<2;$e+=1)if(_[fe][Te-$e]==null){var Ie=!1;Me>>ve&1)==1),Ne(fe,Te-$e)&&(Ie=!Ie),_[fe][Te-$e]=Ie,(ve-=1)==-1&&(Me+=1,ve=7)}if((fe+=ie)<0||S<=fe){fe-=ie,ie=-ie;break}}},R=function(te,le,ie){for(var fe=K.getRSBlocks(te,le),ve=J(),Me=0;Me8*Te)throw"code length overflow. ("+ve.getLengthInBits()+">"+8*Te+")";for(ve.getLengthInBits()+4<=8*Te&&ve.put(0,4);ve.getLengthInBits()%8!=0;)ve.putBit(!1);for(;!(ve.getLengthInBits()>=8*Te||(ve.put(236,8),ve.getLengthInBits()>=8*Te));)ve.put(17,8);return function($e,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Ee=0;Ee=0?rt.getAt(Je):0}}var pt=0;for(Be=0;BeIe)&&(Ne=Ie,Te=$e)}return Te}())},I.createTableTag=function(te,le){te=te||2;var ie="";ie+='";for(var ve=0;ve';ie+=""}return(ie+="")+"
"},I.createSvgTag=function(te,le,ie,fe){var ve={};typeof arguments[0]=="object"&&(te=(ve=arguments[0]).cellSize,le=ve.margin,ie=ve.alt,fe=ve.title),te=te||2,le=le===void 0?4*te:le,(ie=typeof ie=="string"?{text:ie}:ie||{}).text=ie.text||null,ie.id=ie.text?ie.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*te+2*le,Le="";for($e="l"+te+",0 0,"+te+" -"+te+",0 0,-"+te+"z ",Le+=''+Z(fe.text)+"":"",Le+=ie.text?''+Z(ie.text)+"":"",Le+='',Le+='"},I.createDataURL=function(te,le){te=te||2,le=le===void 0?4*te:le;var ie=I.getModuleCount()*te+2*le,fe=le,ve=ie-le;return m(ie,ie,function(Me,Ne){if(fe<=Me&&Me"};var Z=function(te){for(var le="",ie=0;ie":le+=">";break;case"&":le+="&";break;case'"':le+=""";break;default:le+=fe}}return le};return I.createASCII=function(te,le){if((te=te||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Ee,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:pt[Be];ft+=` +}`;const b7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>ge.jsx(v7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));b7.displayName="InputOTP";const y7=Yt.forwardRef(({className:t,...e},r)=>ge.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));y7.displayName="InputOTPGroup";const Ac=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(m7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return ge.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&ge.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:ge.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Ac.displayName="InputOTPSlot";function cZ(t){const{spinning:e,children:r,className:n}=t;return ge.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&ge.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:ge.jsx(vc,{className:"xc-animate-spin"})})]})}function w7(t){const{email:e}=t,[r,n]=Ee.useState(0),[i,s]=Ee.useState(!1),[o,a]=Ee.useState("");async function u(){n(60);const d=setInterval(()=>{n(p=>p===0?(clearInterval(d),0):p-1)},1e3)}async function l(d){if(a(""),!(d.length<6)){s(!0);try{await t.onInputCode(e,d)}catch(p){a(p.message)}s(!1)}}return Ee.useEffect(()=>{u()},[]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(FK,{className:"xc-mb-4",size:60}),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:[ge.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),ge.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]}),ge.jsx("div",{className:"xc-mb-2 xc-h-12",children:ge.jsx(cZ,{spinning:i,className:"xc-rounded-xl",children:ge.jsx(b7,{maxLength:6,onChange:l,disabled:i,className:"disabled:xc-opacity-20",children:ge.jsx(y7,{children:ge.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[ge.jsx(Ac,{index:0}),ge.jsx(Ac,{index:1}),ge.jsx(Ac,{index:2}),ge.jsx(Ac,{index:3}),ge.jsx(Ac,{index:4}),ge.jsx(Ac,{index:5})]})})})})}),o&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:o})})]}),ge.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Resend in ${r}s`:ge.jsx("button",{id:"sendCodeButton",onClick:t.onResendCode,children:"Send again"})]}),ge.jsx("div",{id:"captcha-element"})]})}function x7(t){const{email:e}=t,[r,n]=Ee.useState(!1),[i,s]=Ee.useState(""),o=Ee.useMemo(()=>`xn-btn-${new Date().getTime()}`,[e]);async function a(y,A){n(!0),s(""),await va.getEmailCode({account_type:"email",email:y},A),n(!1)}async function u(y){try{return await a(e,JSON.stringify(y)),{captchaResult:!0,bizResult:!0}}catch(A){return s(A.message),{captchaResult:!1,bizResult:!1}}}async function l(y){y&&t.onCodeSend()}const d=Ee.useRef();function p(y){d.current=y}return Ee.useEffect(()=>{if(e)return window.initAliyunCaptcha({SceneId:"tqyu8129d",prefix:"1mfsn5f",mode:"popup",element:"#captcha-element",button:`#${o}`,captchaVerifyCallback:u,onBizResultCallback:l,getInstance:p,slideStyle:{width:360,height:40},language:"en",region:"cn"}),()=>{var y,A;(y=document.getElementById("aliyunCaptcha-mask"))==null||y.remove(),(A=document.getElementById("aliyunCaptcha-window-popup"))==null||A.remove()}},[e]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(jK,{className:"xc-mb-4",size:60}),ge.jsx("button",{className:"xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2",id:o,children:r?ge.jsx(vc,{className:"xc-animate-spin"}):"I'm not a robot"})]}),i&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:i})})]})}function uZ(t){const{email:e}=t,r=Cb(),[n,i]=Ee.useState("captcha");async function s(o,a){const u=await va.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:a,email:o,inviter_code:r.inviterCode,source:{device:r.device,channel:r.channel,app:r.app}});t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),n==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>i("verify-email")}),n==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:s,onResendCode:()=>i("captcha")})]})}var _7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var p=function(f,g){var v=f,x=k[g],_=null,S=0,b=null,M=[],I={},F=function(te,le){_=function(ie){for(var fe=new Array(ie),ve=0;ve=7&&ee(te),b==null&&(b=R(v,x,M)),Q(b,le)},ae=function(te,le){for(var ie=-1;ie<=7;ie+=1)if(!(te+ie<=-1||S<=te+ie))for(var fe=-1;fe<=7;fe+=1)le+fe<=-1||S<=le+fe||(_[te+ie][le+fe]=0<=ie&&ie<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(ie==0||ie==6)||2<=ie&&ie<=4&&2<=fe&&fe<=4)},O=function(){for(var te=8;te>ie&1)==1;_[Math.floor(ie/3)][ie%3+S-8-3]=fe}for(ie=0;ie<18;ie+=1)fe=!te&&(le>>ie&1)==1,_[ie%3+S-8-3][Math.floor(ie/3)]=fe},X=function(te,le){for(var ie=x<<3|le,fe=B.getBCHTypeInfo(ie),ve=0;ve<15;ve+=1){var Me=!te&&(fe>>ve&1)==1;ve<6?_[ve][8]=Me:ve<8?_[ve+1][8]=Me:_[S-15+ve][8]=Me}for(ve=0;ve<15;ve+=1)Me=!te&&(fe>>ve&1)==1,ve<8?_[8][S-ve-1]=Me:ve<9?_[8][15-ve-1+1]=Me:_[8][15-ve-1]=Me;_[S-8][8]=!te},Q=function(te,le){for(var ie=-1,fe=S-1,ve=7,Me=0,Ne=B.getMaskFunction(le),Te=S-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var $e=0;$e<2;$e+=1)if(_[fe][Te-$e]==null){var Ie=!1;Me>>ve&1)==1),Ne(fe,Te-$e)&&(Ie=!Ie),_[fe][Te-$e]=Ie,(ve-=1)==-1&&(Me+=1,ve=7)}if((fe+=ie)<0||S<=fe){fe-=ie,ie=-ie;break}}},R=function(te,le,ie){for(var fe=H.getRSBlocks(te,le),ve=J(),Me=0;Me8*Te)throw"code length overflow. ("+ve.getLengthInBits()+">"+8*Te+")";for(ve.getLengthInBits()+4<=8*Te&&ve.put(0,4);ve.getLengthInBits()%8!=0;)ve.putBit(!1);for(;!(ve.getLengthInBits()>=8*Te||(ve.put(236,8),ve.getLengthInBits()>=8*Te));)ve.put(17,8);return function($e,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Se=0;Se=0?rt.getAt(Je):0}}var pt=0;for(Be=0;BeIe)&&(Ne=Ie,Te=$e)}return Te}())},I.createTableTag=function(te,le){te=te||2;var ie="";ie+='";for(var ve=0;ve';ie+=""}return(ie+="")+"
"},I.createSvgTag=function(te,le,ie,fe){var ve={};typeof arguments[0]=="object"&&(te=(ve=arguments[0]).cellSize,le=ve.margin,ie=ve.alt,fe=ve.title),te=te||2,le=le===void 0?4*te:le,(ie=typeof ie=="string"?{text:ie}:ie||{}).text=ie.text||null,ie.id=ie.text?ie.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*te+2*le,Le="";for($e="l"+te+",0 0,"+te+" -"+te+",0 0,-"+te+"z ",Le+=''+Z(fe.text)+"":"",Le+=ie.text?''+Z(ie.text)+"":"",Le+='',Le+='"},I.createDataURL=function(te,le){te=te||2,le=le===void 0?4*te:le;var ie=I.getModuleCount()*te+2*le,fe=le,ve=ie-le;return m(ie,ie,function(Me,Ne){if(fe<=Me&&Me"};var Z=function(te){for(var le="",ie=0;ie":le+=">";break;case"&":le+="&";break;case'"':le+=""";break;default:le+=fe}}return le};return I.createASCII=function(te,le){if((te=te||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Se,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:pt[Be];ft+=` `}return et%2&&ze>0?ft.substring(0,ft.length-et-1)+Array(et+1).join("▀"):ft.substring(0,ft.length-1)}(le);te-=1,le=le===void 0?2*te:le;var ie,fe,ve,Me,Ne=I.getModuleCount()*te+2*le,Te=le,$e=Ne-le,Ie=Array(te+1).join("██"),Le=Array(te+1).join(" "),Ve="",ke="";for(ie=0;ie>>8),S.push(255&I)):S.push(x)}}return S}};var y,A,P,N,D,k={L:1,M:0,Q:3,H:2},B=(y=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],A=1335,P=7973,D=function(f){for(var g=0;f!=0;)g+=1,f>>>=1;return g},(N={}).getBCHTypeInfo=function(f){for(var g=f<<10;D(g)-D(A)>=0;)g^=A<=0;)g^=P<5&&(v+=3+S-5)}for(x=0;x=256;)x-=255;return f[x]}}}();function U(f,g){if(f.length===void 0)throw f.length+"/"+g;var v=function(){for(var _=0;_>>7-x%8&1)==1},put:function(x,_){for(var S=0;S<_;S+=1)v.putBit((x>>>_-S-1&1)==1)},getLengthInBits:function(){return g},putBit:function(x){var _=Math.floor(g/8);f.length<=_&&f.push(0),x&&(f[_]|=128>>>g%8),g+=1}};return v},T=function(f){var g=f,v={getMode:function(){return 1},getLength:function(S){return g.length},write:function(S){for(var b=g,M=0;M+2>>8&255)+(255&M),_.put(M,13),b+=2}if(b>>8)},writeBytes:function(v,x,_){x=x||0,_=_||v.length;for(var S=0;S<_;S+=1)g.writeByte(v[S+x])},writeString:function(v){for(var x=0;x0&&(v+=","),v+=f[x];return v+"]"}};return g},E=function(f){var g=f,v=0,x=0,_=0,S={read:function(){for(;_<8;){if(v>=g.length){if(_==0)return-1;throw"unexpected end of file./"+_}var M=g.charAt(v);if(v+=1,M=="=")return _=0,-1;M.match(/^\s$/)||(x=x<<6|b(M.charCodeAt(0)),_+=6)}var I=x>>>_-8&255;return _-=8,I}},b=function(M){if(65<=M&&M<=90)return M-65;if(97<=M&&M<=122)return M-97+26;if(48<=M&&M<=57)return M-48+52;if(M==43)return 62;if(M==47)return 63;throw"c:"+M};return S},m=function(f,g,v){for(var x=function(ae,O){var se=ae,ee=O,X=new Array(ae*O),Q={setPixel:function(te,le,ie){X[le*se+te]=ie},write:function(te){te.writeString("GIF87a"),te.writeShort(se),te.writeShort(ee),te.writeByte(128),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(255),te.writeByte(255),te.writeByte(255),te.writeString(","),te.writeShort(0),te.writeShort(0),te.writeShort(se),te.writeShort(ee),te.writeByte(0);var le=R(2);te.writeByte(2);for(var ie=0;le.length-ie>255;)te.writeByte(255),te.writeBytes(le,ie,255),ie+=255;te.writeByte(le.length-ie),te.writeBytes(le,ie,le.length-ie),te.writeByte(0),te.writeString(";")}},R=function(te){for(var le=1<>>Ee)throw"length over";for(;Te+Ee>=8;)Ne.writeByte(255&(He<>>=8-Te,$e=0,Te=0;$e|=He<0&&Ne.writeByte($e)}});Le.write(le,fe);var Ve=0,ke=String.fromCharCode(X[Ve]);for(Ve+=1;Ve=6;)Q(ae>>>O-6),O-=6},X.flush=function(){if(O>0&&(Q(ae<<6-O),ae=0,O=0),se%3!=0)for(var Z=3-se%3,te=0;te>6,128|63&N):N<55296||N>=57344?A.push(224|N>>12,128|N>>6&63,128|63&N):(P++,N=65536+((1023&N)<<10|1023&y.charCodeAt(P)),A.push(240|N>>18,128|N>>12&63,128|N>>6&63,128|63&N))}return A}(p)},(l=typeof(u=function(){return d})=="function"?u.apply(a,[]):u)===void 0||(o.exports=l)}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var u=n[o]={exports:{}};return r[o](u,u.exports,i),u.exports}i.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return i.d(a,{a}),a},i.d=(o,a)=>{for(var u in a)i.o(a,u)&&!i.o(o,u)&&Object.defineProperty(o,u,{enumerable:!0,get:a[u]})},i.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a);var s={};return(()=>{i.d(s,{default:()=>G});const o=E=>!!E&&typeof E=="object"&&!Array.isArray(E);function a(E,...m){if(!m.length)return E;const f=m.shift();return f!==void 0&&o(E)&&o(f)?(E=Object.assign({},E),Object.keys(f).forEach(g=>{const v=E[g],x=f[g];Array.isArray(v)&&Array.isArray(x)?E[g]=x:o(v)&&o(x)?E[g]=a(Object.assign({},v),x):E[g]=x}),a(E,...m)):E}function u(E,m){const f=document.createElement("a");f.download=m,f.href=E,document.body.appendChild(f),f.click(),document.body.removeChild(f)}const l={L:.07,M:.15,Q:.25,H:.3};class d{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"dots":x=this._drawDot;break;case"classy":x=this._drawClassy;break;case"classy-rounded":x=this._drawClassyRounded;break;case"rounded":x=this._drawRounded;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawSquare}x.call(this,{x:m,y:f,size:g,getNeighbor:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_basicSideRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, 0 ${-f}`)}}))}_basicCornerRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_basicCornerExtraRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`)}}))}_basicCornersRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${f/2} ${f/2}h `+f/2+"v "+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_drawDot({x:m,y:f,size:g}){this._basicDot({x:m,y:f,size:g,rotation:0})}_drawSquare({x:m,y:f,size:g}){this._basicSquare({x:m,y:f,size:g,rotation:0})}_drawRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerRounded({x:m,y:f,size:g,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawExtraRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawClassy({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}_drawClassyRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}}class p{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"square":x=this._drawSquare;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawDot}x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g+f/2} ${v}a ${f/2} ${f/2} 0 1 0 0.1 0zm 0 ${x}a ${f/2-x} ${f/2-x} 0 1 1 -0.1 0Z`)}}))}_basicSquare(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f+`zM ${g+x} ${v+x}h `+(f-2*x)+"v "+(f-2*x)+"h "+(2*x-f)+"z")}}))}_basicExtraRounded(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v+2.5*x}v `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*x}h `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*-x}v `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*-x}h `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*x}M ${g+2.5*x} ${v+x}h `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*x}v `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*x}h `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*-x}v `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*-x}`)}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}_drawExtraRounded({x:m,y:f,size:g,rotation:v}){this._basicExtraRounded({x:m,y:f,size:g,rotation:v})}}class y{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;x=this._type==="square"?this._drawSquare:this._drawDot,x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}}const A="circle",P=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],N=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class D{constructor(m,f){this._roundSize=g=>this._options.dotsOptions.roundSize?Math.floor(g):g,this._window=f,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(m.width)),this._element.setAttribute("height",String(m.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),m.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=m.image,this._instanceId=D.instanceCount++,this._options=m}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(m){const f=m.getModuleCount(),g=Math.min(this._options.width,this._options.height)-2*this._options.margin,v=this._options.shape===A?g/Math.sqrt(2):g,x=this._roundSize(v/f);let _={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=m,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:S,qrOptions:b}=this._options,M=S.imageSize*l[b.errorCorrectionLevel],I=Math.floor(M*f*f);_=function({originalHeight:F,originalWidth:ae,maxHiddenDots:O,maxHiddenAxisDots:se,dotSize:ee}){const X={x:0,y:0},Q={x:0,y:0};if(F<=0||ae<=0||O<=0||ee<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const R=F/ae;return X.x=Math.floor(Math.sqrt(O/R)),X.x<=0&&(X.x=1),se&&seO||se&&se{var M,I,F,ae,O,se;return!(this._options.imageOptions.hideBackgroundDots&&S>=(f-_.hideYDots)/2&&S<(f+_.hideYDots)/2&&b>=(f-_.hideXDots)/2&&b<(f+_.hideXDots)/2||!((M=P[S])===null||M===void 0)&&M[b]||!((I=P[S-f+7])===null||I===void 0)&&I[b]||!((F=P[S])===null||F===void 0)&&F[b-f+7]||!((ae=N[S])===null||ae===void 0)&&ae[b]||!((O=N[S-f+7])===null||O===void 0)&&O[b]||!((se=N[S])===null||se===void 0)&&se[b-f+7])}),this.drawCorners(),this._options.image&&await this.drawImage({width:_.width,height:_.height,count:f,dotSize:x})}drawBackground(){var m,f,g;const v=this._element,x=this._options;if(v){const _=(m=x.backgroundOptions)===null||m===void 0?void 0:m.gradient,S=(f=x.backgroundOptions)===null||f===void 0?void 0:f.color;let b=x.height,M=x.width;if(_||S){const I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((g=x.backgroundOptions)===null||g===void 0)&&g.round&&(b=M=Math.min(x.width,x.height),I.setAttribute("rx",String(b/2*x.backgroundOptions.round))),I.setAttribute("x",String(this._roundSize((x.width-M)/2))),I.setAttribute("y",String(this._roundSize((x.height-b)/2))),I.setAttribute("width",String(M)),I.setAttribute("height",String(b)),this._backgroundClipPath.appendChild(I),this._createColor({options:_,color:S,additionalRotation:0,x:0,y:0,height:x.height,width:x.width,name:`background-color-${this._instanceId}`})}}}drawDots(m){var f,g;if(!this._qr)throw"QR code is not defined";const v=this._options,x=this._qr.getModuleCount();if(x>v.width||x>v.height)throw"The canvas is too small.";const _=Math.min(v.width,v.height)-2*v.margin,S=v.shape===A?_/Math.sqrt(2):_,b=this._roundSize(S/x),M=this._roundSize((v.width-x*b)/2),I=this._roundSize((v.height-x*b)/2),F=new d({svg:this._element,type:v.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(f=v.dotsOptions)===null||f===void 0?void 0:f.gradient,color:v.dotsOptions.color,additionalRotation:0,x:0,y:0,height:v.height,width:v.width,name:`dot-color-${this._instanceId}`});for(let ae=0;ae!(O+se<0||ae+ee<0||O+se>=x||ae+ee>=x)&&!(m&&!m(ae+ee,O+se))&&!!this._qr&&this._qr.isDark(ae+ee,O+se)),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element));if(v.shape===A){const ae=this._roundSize((_/b-x)/2),O=x+2*ae,se=M-ae*b,ee=I-ae*b,X=[],Q=this._roundSize(O/2);for(let R=0;R=ae-1&&R<=O-ae&&Z>=ae-1&&Z<=O-ae||Math.sqrt((R-Q)*(R-Q)+(Z-Q)*(Z-Q))>Q?X[R][Z]=0:X[R][Z]=this._qr.isDark(Z-2*ae<0?Z:Z>=x?Z-2*ae:Z-ae,R-2*ae<0?R:R>=x?R-2*ae:R-ae)?1:0}for(let R=0;R{var ie;return!!(!((ie=X[R+le])===null||ie===void 0)&&ie[Z+te])}),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const m=this._element,f=this._options;if(!m)throw"Element code is not defined";const g=this._qr.getModuleCount(),v=Math.min(f.width,f.height)-2*f.margin,x=f.shape===A?v/Math.sqrt(2):v,_=this._roundSize(x/g),S=7*_,b=3*_,M=this._roundSize((f.width-g*_)/2),I=this._roundSize((f.height-g*_)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([F,ae,O])=>{var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me;const Ne=M+F*_*(g-7),Te=I+ae*_*(g-7);let $e=this._dotsClipPath,Ie=this._dotsClipPath;if((!((se=f.cornersSquareOptions)===null||se===void 0)&&se.gradient||!((ee=f.cornersSquareOptions)===null||ee===void 0)&&ee.color)&&($e=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),$e.setAttribute("id",`clip-path-corners-square-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild($e),this._cornersSquareClipPath=this._cornersDotClipPath=Ie=$e,this._createColor({options:(X=f.cornersSquareOptions)===null||X===void 0?void 0:X.gradient,color:(Q=f.cornersSquareOptions)===null||Q===void 0?void 0:Q.color,additionalRotation:O,x:Ne,y:Te,height:S,width:S,name:`corners-square-color-${F}-${ae}-${this._instanceId}`})),(R=f.cornersSquareOptions)===null||R===void 0?void 0:R.type){const Le=new p({svg:this._element,type:f.cornersSquareOptions.type,window:this._window});Le.draw(Ne,Te,S,O),Le._element&&$e&&$e.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=P[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&$e&&$e.appendChild(Le._element))}if((!((te=f.cornersDotOptions)===null||te===void 0)&&te.gradient||!((le=f.cornersDotOptions)===null||le===void 0)&&le.color)&&(Ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Ie.setAttribute("id",`clip-path-corners-dot-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild(Ie),this._cornersDotClipPath=Ie,this._createColor({options:(ie=f.cornersDotOptions)===null||ie===void 0?void 0:ie.gradient,color:(fe=f.cornersDotOptions)===null||fe===void 0?void 0:fe.color,additionalRotation:O,x:Ne+2*_,y:Te+2*_,height:b,width:b,name:`corners-dot-color-${F}-${ae}-${this._instanceId}`})),(ve=f.cornersDotOptions)===null||ve===void 0?void 0:ve.type){const Le=new y({svg:this._element,type:f.cornersDotOptions.type,window:this._window});Le.draw(Ne+2*_,Te+2*_,b,O),Le._element&&Ie&&Ie.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=N[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&Ie&&Ie.appendChild(Le._element))}})}loadImage(){return new Promise((m,f)=>{var g;const v=this._options;if(!v.image)return f("Image is not defined");if(!((g=v.nodeCanvas)===null||g===void 0)&&g.loadImage)v.nodeCanvas.loadImage(v.image).then(x=>{var _,S;if(this._image=x,this._options.imageOptions.saveAsBlob){const b=(_=v.nodeCanvas)===null||_===void 0?void 0:_.createCanvas(this._image.width,this._image.height);(S=b==null?void 0:b.getContext("2d"))===null||S===void 0||S.drawImage(x,0,0),this._imageUri=b==null?void 0:b.toDataURL()}m()}).catch(f);else{const x=new this._window.Image;typeof v.imageOptions.crossOrigin=="string"&&(x.crossOrigin=v.imageOptions.crossOrigin),this._image=x,x.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await async function(_,S){return new Promise(b=>{const M=new S.XMLHttpRequest;M.onload=function(){const I=new S.FileReader;I.onloadend=function(){b(I.result)},I.readAsDataURL(M.response)},M.open("GET",_),M.responseType="blob",M.send()})}(v.image||"",this._window)),m()},x.src=v.image}})}async drawImage({width:m,height:f,count:g,dotSize:v}){const x=this._options,_=this._roundSize((x.width-g*v)/2),S=this._roundSize((x.height-g*v)/2),b=_+this._roundSize(x.imageOptions.margin+(g*v-m)/2),M=S+this._roundSize(x.imageOptions.margin+(g*v-f)/2),I=m-2*x.imageOptions.margin,F=f-2*x.imageOptions.margin,ae=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");ae.setAttribute("href",this._imageUri||""),ae.setAttribute("x",String(b)),ae.setAttribute("y",String(M)),ae.setAttribute("width",`${I}px`),ae.setAttribute("height",`${F}px`),this._element.appendChild(ae)}_createColor({options:m,color:f,additionalRotation:g,x:v,y:x,height:_,width:S,name:b}){const M=S>_?S:_,I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(I.setAttribute("x",String(v)),I.setAttribute("y",String(x)),I.setAttribute("height",String(_)),I.setAttribute("width",String(S)),I.setAttribute("clip-path",`url('#clip-path-${b}')`),m){let F;if(m.type==="radial")F=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("fx",String(v+S/2)),F.setAttribute("fy",String(x+_/2)),F.setAttribute("cx",String(v+S/2)),F.setAttribute("cy",String(x+_/2)),F.setAttribute("r",String(M/2));else{const ae=((m.rotation||0)+g)%(2*Math.PI),O=(ae+2*Math.PI)%(2*Math.PI);let se=v+S/2,ee=x+_/2,X=v+S/2,Q=x+_/2;O>=0&&O<=.25*Math.PI||O>1.75*Math.PI&&O<=2*Math.PI?(se-=S/2,ee-=_/2*Math.tan(ae),X+=S/2,Q+=_/2*Math.tan(ae)):O>.25*Math.PI&&O<=.75*Math.PI?(ee-=_/2,se-=S/2/Math.tan(ae),Q+=_/2,X+=S/2/Math.tan(ae)):O>.75*Math.PI&&O<=1.25*Math.PI?(se+=S/2,ee+=_/2*Math.tan(ae),X-=S/2,Q-=_/2*Math.tan(ae)):O>1.25*Math.PI&&O<=1.75*Math.PI&&(ee+=_/2,se+=S/2/Math.tan(ae),Q-=_/2,X-=S/2/Math.tan(ae)),F=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("x1",String(Math.round(se))),F.setAttribute("y1",String(Math.round(ee))),F.setAttribute("x2",String(Math.round(X))),F.setAttribute("y2",String(Math.round(Q)))}m.colorStops.forEach(({offset:ae,color:O})=>{const se=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");se.setAttribute("offset",100*ae+"%"),se.setAttribute("stop-color",O),F.appendChild(se)}),I.setAttribute("fill",`url('#${b}')`),this._defs.appendChild(F)}else f&&I.setAttribute("fill",f);this._element.appendChild(I)}}D.instanceCount=0;const k=D,B="canvas",j={};for(let E=0;E<=40;E++)j[E]=E;const U={type:B,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:j[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function K(E){const m=Object.assign({},E);if(!m.colorStops||!m.colorStops.length)throw"Field 'colorStops' is required in gradient";return m.rotation?m.rotation=Number(m.rotation):m.rotation=0,m.colorStops=m.colorStops.map(f=>Object.assign(Object.assign({},f),{offset:Number(f.offset)})),m}function J(E){const m=Object.assign({},E);return m.width=Number(m.width),m.height=Number(m.height),m.margin=Number(m.margin),m.imageOptions=Object.assign(Object.assign({},m.imageOptions),{hideBackgroundDots:!!m.imageOptions.hideBackgroundDots,imageSize:Number(m.imageOptions.imageSize),margin:Number(m.imageOptions.margin)}),m.margin>Math.min(m.width,m.height)&&(m.margin=Math.min(m.width,m.height)),m.dotsOptions=Object.assign({},m.dotsOptions),m.dotsOptions.gradient&&(m.dotsOptions.gradient=K(m.dotsOptions.gradient)),m.cornersSquareOptions&&(m.cornersSquareOptions=Object.assign({},m.cornersSquareOptions),m.cornersSquareOptions.gradient&&(m.cornersSquareOptions.gradient=K(m.cornersSquareOptions.gradient))),m.cornersDotOptions&&(m.cornersDotOptions=Object.assign({},m.cornersDotOptions),m.cornersDotOptions.gradient&&(m.cornersDotOptions.gradient=K(m.cornersDotOptions.gradient))),m.backgroundOptions&&(m.backgroundOptions=Object.assign({},m.backgroundOptions),m.backgroundOptions.gradient&&(m.backgroundOptions.gradient=K(m.backgroundOptions.gradient))),m}var T=i(873),z=i.n(T);function ue(E){if(!E)throw new Error("Extension must be defined");E[0]==="."&&(E=E.substring(1));const m={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[E.toLowerCase()];if(!m)throw new Error(`Extension "${E}" is not supported`);return m}class _e{constructor(m){m!=null&&m.jsdom?this._window=new m.jsdom("",{resources:"usable"}).window:this._window=window,this._options=m?J(a(U,m)):U,this.update()}static _clearContainer(m){m&&(m.innerHTML="")}_setupSvg(){if(!this._qr)return;const m=new k(this._options,this._window);this._svg=m.getElement(),this._svgDrawingPromise=m.drawQR(this._qr).then(()=>{var f;this._svg&&((f=this._extension)===null||f===void 0||f.call(this,m.getElement(),this._options))})}_setupCanvas(){var m,f;this._qr&&(!((m=this._options.nodeCanvas)===null||m===void 0)&&m.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(f=this._svgDrawingPromise)===null||f===void 0?void 0:f.then(()=>{var g;if(!this._svg)return;const v=this._svg,x=new this._window.XMLSerializer().serializeToString(v),_=btoa(x),S=`data:${ue("svg")};base64,${_}`;if(!((g=this._options.nodeCanvas)===null||g===void 0)&&g.loadImage)return this._options.nodeCanvas.loadImage(S).then(b=>{var M,I;b.width=this._options.width,b.height=this._options.height,(I=(M=this._nodeCanvas)===null||M===void 0?void 0:M.getContext("2d"))===null||I===void 0||I.drawImage(b,0,0)});{const b=new this._window.Image;return new Promise(M=>{b.onload=()=>{var I,F;(F=(I=this._domCanvas)===null||I===void 0?void 0:I.getContext("2d"))===null||F===void 0||F.drawImage(b,0,0),M()},b.src=S})}}))}async _getElement(m="png"){if(!this._qr)throw"QR code is empty";return m.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(m){_e._clearContainer(this._container),this._options=m?J(a(this._options,m)):this._options,this._options.data&&(this._qr=z()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(f){switch(!0){case/^[0-9]*$/.test(f):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(f):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===B?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(m){if(m){if(typeof m.appendChild!="function")throw"Container should be a single DOM node";this._options.type===B?this._domCanvas&&m.appendChild(this._domCanvas):this._svg&&m.appendChild(this._svg),this._container=m}}applyExtension(m){if(!m)throw"Extension function should be defined.";this._extension=m,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(m="png"){if(!this._qr)throw"QR code is empty";const f=await this._getElement(m),g=ue(m);if(!f)return null;if(m.toLowerCase()==="svg"){const v=`\r +`}return Ve.substring(0,Ve.length-1)},I.renderTo2dContext=function(te,le){le=le||2;for(var ie=I.getModuleCount(),fe=0;fe>>8),S.push(255&I)):S.push(x)}}return S}};var y,A,P,N,D,k={L:1,M:0,Q:3,H:2},B=(y=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],A=1335,P=7973,D=function(f){for(var g=0;f!=0;)g+=1,f>>>=1;return g},(N={}).getBCHTypeInfo=function(f){for(var g=f<<10;D(g)-D(A)>=0;)g^=A<=0;)g^=P<5&&(v+=3+S-5)}for(x=0;x=256;)x-=255;return f[x]}}}();function j(f,g){if(f.length===void 0)throw f.length+"/"+g;var v=function(){for(var _=0;_>>7-x%8&1)==1},put:function(x,_){for(var S=0;S<_;S+=1)v.putBit((x>>>_-S-1&1)==1)},getLengthInBits:function(){return g},putBit:function(x){var _=Math.floor(g/8);f.length<=_&&f.push(0),x&&(f[_]|=128>>>g%8),g+=1}};return v},T=function(f){var g=f,v={getMode:function(){return 1},getLength:function(S){return g.length},write:function(S){for(var b=g,M=0;M+2>>8&255)+(255&M),_.put(M,13),b+=2}if(b>>8)},writeBytes:function(v,x,_){x=x||0,_=_||v.length;for(var S=0;S<_;S+=1)g.writeByte(v[S+x])},writeString:function(v){for(var x=0;x0&&(v+=","),v+=f[x];return v+"]"}};return g},E=function(f){var g=f,v=0,x=0,_=0,S={read:function(){for(;_<8;){if(v>=g.length){if(_==0)return-1;throw"unexpected end of file./"+_}var M=g.charAt(v);if(v+=1,M=="=")return _=0,-1;M.match(/^\s$/)||(x=x<<6|b(M.charCodeAt(0)),_+=6)}var I=x>>>_-8&255;return _-=8,I}},b=function(M){if(65<=M&&M<=90)return M-65;if(97<=M&&M<=122)return M-97+26;if(48<=M&&M<=57)return M-48+52;if(M==43)return 62;if(M==47)return 63;throw"c:"+M};return S},m=function(f,g,v){for(var x=function(ae,O){var se=ae,ee=O,X=new Array(ae*O),Q={setPixel:function(te,le,ie){X[le*se+te]=ie},write:function(te){te.writeString("GIF87a"),te.writeShort(se),te.writeShort(ee),te.writeByte(128),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(255),te.writeByte(255),te.writeByte(255),te.writeString(","),te.writeShort(0),te.writeShort(0),te.writeShort(se),te.writeShort(ee),te.writeByte(0);var le=R(2);te.writeByte(2);for(var ie=0;le.length-ie>255;)te.writeByte(255),te.writeBytes(le,ie,255),ie+=255;te.writeByte(le.length-ie),te.writeBytes(le,ie,le.length-ie),te.writeByte(0),te.writeString(";")}},R=function(te){for(var le=1<>>Se)throw"length over";for(;Te+Se>=8;)Ne.writeByte(255&(He<>>=8-Te,$e=0,Te=0;$e|=He<0&&Ne.writeByte($e)}});Le.write(le,fe);var Ve=0,ke=String.fromCharCode(X[Ve]);for(Ve+=1;Ve=6;)Q(ae>>>O-6),O-=6},X.flush=function(){if(O>0&&(Q(ae<<6-O),ae=0,O=0),se%3!=0)for(var Z=3-se%3,te=0;te>6,128|63&N):N<55296||N>=57344?A.push(224|N>>12,128|N>>6&63,128|63&N):(P++,N=65536+((1023&N)<<10|1023&y.charCodeAt(P)),A.push(240|N>>18,128|N>>12&63,128|N>>6&63,128|63&N))}return A}(p)},(l=typeof(u=function(){return d})=="function"?u.apply(a,[]):u)===void 0||(o.exports=l)}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var u=n[o]={exports:{}};return r[o](u,u.exports,i),u.exports}i.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return i.d(a,{a}),a},i.d=(o,a)=>{for(var u in a)i.o(a,u)&&!i.o(o,u)&&Object.defineProperty(o,u,{enumerable:!0,get:a[u]})},i.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a);var s={};return(()=>{i.d(s,{default:()=>G});const o=E=>!!E&&typeof E=="object"&&!Array.isArray(E);function a(E,...m){if(!m.length)return E;const f=m.shift();return f!==void 0&&o(E)&&o(f)?(E=Object.assign({},E),Object.keys(f).forEach(g=>{const v=E[g],x=f[g];Array.isArray(v)&&Array.isArray(x)?E[g]=x:o(v)&&o(x)?E[g]=a(Object.assign({},v),x):E[g]=x}),a(E,...m)):E}function u(E,m){const f=document.createElement("a");f.download=m,f.href=E,document.body.appendChild(f),f.click(),document.body.removeChild(f)}const l={L:.07,M:.15,Q:.25,H:.3};class d{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"dots":x=this._drawDot;break;case"classy":x=this._drawClassy;break;case"classy-rounded":x=this._drawClassyRounded;break;case"rounded":x=this._drawRounded;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawSquare}x.call(this,{x:m,y:f,size:g,getNeighbor:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_basicSideRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, 0 ${-f}`)}}))}_basicCornerRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_basicCornerExtraRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`)}}))}_basicCornersRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${f/2} ${f/2}h `+f/2+"v "+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_drawDot({x:m,y:f,size:g}){this._basicDot({x:m,y:f,size:g,rotation:0})}_drawSquare({x:m,y:f,size:g}){this._basicSquare({x:m,y:f,size:g,rotation:0})}_drawRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerRounded({x:m,y:f,size:g,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawExtraRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawClassy({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}_drawClassyRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}}class p{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"square":x=this._drawSquare;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawDot}x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g+f/2} ${v}a ${f/2} ${f/2} 0 1 0 0.1 0zm 0 ${x}a ${f/2-x} ${f/2-x} 0 1 1 -0.1 0Z`)}}))}_basicSquare(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f+`zM ${g+x} ${v+x}h `+(f-2*x)+"v "+(f-2*x)+"h "+(2*x-f)+"z")}}))}_basicExtraRounded(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v+2.5*x}v `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*x}h `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*-x}v `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*-x}h `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*x}M ${g+2.5*x} ${v+x}h `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*x}v `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*x}h `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*-x}v `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*-x}`)}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}_drawExtraRounded({x:m,y:f,size:g,rotation:v}){this._basicExtraRounded({x:m,y:f,size:g,rotation:v})}}class y{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;x=this._type==="square"?this._drawSquare:this._drawDot,x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}}const A="circle",P=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],N=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class D{constructor(m,f){this._roundSize=g=>this._options.dotsOptions.roundSize?Math.floor(g):g,this._window=f,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(m.width)),this._element.setAttribute("height",String(m.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),m.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=m.image,this._instanceId=D.instanceCount++,this._options=m}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(m){const f=m.getModuleCount(),g=Math.min(this._options.width,this._options.height)-2*this._options.margin,v=this._options.shape===A?g/Math.sqrt(2):g,x=this._roundSize(v/f);let _={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=m,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:S,qrOptions:b}=this._options,M=S.imageSize*l[b.errorCorrectionLevel],I=Math.floor(M*f*f);_=function({originalHeight:F,originalWidth:ae,maxHiddenDots:O,maxHiddenAxisDots:se,dotSize:ee}){const X={x:0,y:0},Q={x:0,y:0};if(F<=0||ae<=0||O<=0||ee<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const R=F/ae;return X.x=Math.floor(Math.sqrt(O/R)),X.x<=0&&(X.x=1),se&&seO||se&&se{var M,I,F,ae,O,se;return!(this._options.imageOptions.hideBackgroundDots&&S>=(f-_.hideYDots)/2&&S<(f+_.hideYDots)/2&&b>=(f-_.hideXDots)/2&&b<(f+_.hideXDots)/2||!((M=P[S])===null||M===void 0)&&M[b]||!((I=P[S-f+7])===null||I===void 0)&&I[b]||!((F=P[S])===null||F===void 0)&&F[b-f+7]||!((ae=N[S])===null||ae===void 0)&&ae[b]||!((O=N[S-f+7])===null||O===void 0)&&O[b]||!((se=N[S])===null||se===void 0)&&se[b-f+7])}),this.drawCorners(),this._options.image&&await this.drawImage({width:_.width,height:_.height,count:f,dotSize:x})}drawBackground(){var m,f,g;const v=this._element,x=this._options;if(v){const _=(m=x.backgroundOptions)===null||m===void 0?void 0:m.gradient,S=(f=x.backgroundOptions)===null||f===void 0?void 0:f.color;let b=x.height,M=x.width;if(_||S){const I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((g=x.backgroundOptions)===null||g===void 0)&&g.round&&(b=M=Math.min(x.width,x.height),I.setAttribute("rx",String(b/2*x.backgroundOptions.round))),I.setAttribute("x",String(this._roundSize((x.width-M)/2))),I.setAttribute("y",String(this._roundSize((x.height-b)/2))),I.setAttribute("width",String(M)),I.setAttribute("height",String(b)),this._backgroundClipPath.appendChild(I),this._createColor({options:_,color:S,additionalRotation:0,x:0,y:0,height:x.height,width:x.width,name:`background-color-${this._instanceId}`})}}}drawDots(m){var f,g;if(!this._qr)throw"QR code is not defined";const v=this._options,x=this._qr.getModuleCount();if(x>v.width||x>v.height)throw"The canvas is too small.";const _=Math.min(v.width,v.height)-2*v.margin,S=v.shape===A?_/Math.sqrt(2):_,b=this._roundSize(S/x),M=this._roundSize((v.width-x*b)/2),I=this._roundSize((v.height-x*b)/2),F=new d({svg:this._element,type:v.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(f=v.dotsOptions)===null||f===void 0?void 0:f.gradient,color:v.dotsOptions.color,additionalRotation:0,x:0,y:0,height:v.height,width:v.width,name:`dot-color-${this._instanceId}`});for(let ae=0;ae!(O+se<0||ae+ee<0||O+se>=x||ae+ee>=x)&&!(m&&!m(ae+ee,O+se))&&!!this._qr&&this._qr.isDark(ae+ee,O+se)),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element));if(v.shape===A){const ae=this._roundSize((_/b-x)/2),O=x+2*ae,se=M-ae*b,ee=I-ae*b,X=[],Q=this._roundSize(O/2);for(let R=0;R=ae-1&&R<=O-ae&&Z>=ae-1&&Z<=O-ae||Math.sqrt((R-Q)*(R-Q)+(Z-Q)*(Z-Q))>Q?X[R][Z]=0:X[R][Z]=this._qr.isDark(Z-2*ae<0?Z:Z>=x?Z-2*ae:Z-ae,R-2*ae<0?R:R>=x?R-2*ae:R-ae)?1:0}for(let R=0;R{var ie;return!!(!((ie=X[R+le])===null||ie===void 0)&&ie[Z+te])}),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const m=this._element,f=this._options;if(!m)throw"Element code is not defined";const g=this._qr.getModuleCount(),v=Math.min(f.width,f.height)-2*f.margin,x=f.shape===A?v/Math.sqrt(2):v,_=this._roundSize(x/g),S=7*_,b=3*_,M=this._roundSize((f.width-g*_)/2),I=this._roundSize((f.height-g*_)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([F,ae,O])=>{var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me;const Ne=M+F*_*(g-7),Te=I+ae*_*(g-7);let $e=this._dotsClipPath,Ie=this._dotsClipPath;if((!((se=f.cornersSquareOptions)===null||se===void 0)&&se.gradient||!((ee=f.cornersSquareOptions)===null||ee===void 0)&&ee.color)&&($e=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),$e.setAttribute("id",`clip-path-corners-square-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild($e),this._cornersSquareClipPath=this._cornersDotClipPath=Ie=$e,this._createColor({options:(X=f.cornersSquareOptions)===null||X===void 0?void 0:X.gradient,color:(Q=f.cornersSquareOptions)===null||Q===void 0?void 0:Q.color,additionalRotation:O,x:Ne,y:Te,height:S,width:S,name:`corners-square-color-${F}-${ae}-${this._instanceId}`})),(R=f.cornersSquareOptions)===null||R===void 0?void 0:R.type){const Le=new p({svg:this._element,type:f.cornersSquareOptions.type,window:this._window});Le.draw(Ne,Te,S,O),Le._element&&$e&&$e.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Se;return!!(!((Se=P[Ve+He])===null||Se===void 0)&&Se[ke+ze])}),Le._element&&$e&&$e.appendChild(Le._element))}if((!((te=f.cornersDotOptions)===null||te===void 0)&&te.gradient||!((le=f.cornersDotOptions)===null||le===void 0)&&le.color)&&(Ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Ie.setAttribute("id",`clip-path-corners-dot-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild(Ie),this._cornersDotClipPath=Ie,this._createColor({options:(ie=f.cornersDotOptions)===null||ie===void 0?void 0:ie.gradient,color:(fe=f.cornersDotOptions)===null||fe===void 0?void 0:fe.color,additionalRotation:O,x:Ne+2*_,y:Te+2*_,height:b,width:b,name:`corners-dot-color-${F}-${ae}-${this._instanceId}`})),(ve=f.cornersDotOptions)===null||ve===void 0?void 0:ve.type){const Le=new y({svg:this._element,type:f.cornersDotOptions.type,window:this._window});Le.draw(Ne+2*_,Te+2*_,b,O),Le._element&&Ie&&Ie.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Se;return!!(!((Se=N[Ve+He])===null||Se===void 0)&&Se[ke+ze])}),Le._element&&Ie&&Ie.appendChild(Le._element))}})}loadImage(){return new Promise((m,f)=>{var g;const v=this._options;if(!v.image)return f("Image is not defined");if(!((g=v.nodeCanvas)===null||g===void 0)&&g.loadImage)v.nodeCanvas.loadImage(v.image).then(x=>{var _,S;if(this._image=x,this._options.imageOptions.saveAsBlob){const b=(_=v.nodeCanvas)===null||_===void 0?void 0:_.createCanvas(this._image.width,this._image.height);(S=b==null?void 0:b.getContext("2d"))===null||S===void 0||S.drawImage(x,0,0),this._imageUri=b==null?void 0:b.toDataURL()}m()}).catch(f);else{const x=new this._window.Image;typeof v.imageOptions.crossOrigin=="string"&&(x.crossOrigin=v.imageOptions.crossOrigin),this._image=x,x.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await async function(_,S){return new Promise(b=>{const M=new S.XMLHttpRequest;M.onload=function(){const I=new S.FileReader;I.onloadend=function(){b(I.result)},I.readAsDataURL(M.response)},M.open("GET",_),M.responseType="blob",M.send()})}(v.image||"",this._window)),m()},x.src=v.image}})}async drawImage({width:m,height:f,count:g,dotSize:v}){const x=this._options,_=this._roundSize((x.width-g*v)/2),S=this._roundSize((x.height-g*v)/2),b=_+this._roundSize(x.imageOptions.margin+(g*v-m)/2),M=S+this._roundSize(x.imageOptions.margin+(g*v-f)/2),I=m-2*x.imageOptions.margin,F=f-2*x.imageOptions.margin,ae=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");ae.setAttribute("href",this._imageUri||""),ae.setAttribute("x",String(b)),ae.setAttribute("y",String(M)),ae.setAttribute("width",`${I}px`),ae.setAttribute("height",`${F}px`),this._element.appendChild(ae)}_createColor({options:m,color:f,additionalRotation:g,x:v,y:x,height:_,width:S,name:b}){const M=S>_?S:_,I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(I.setAttribute("x",String(v)),I.setAttribute("y",String(x)),I.setAttribute("height",String(_)),I.setAttribute("width",String(S)),I.setAttribute("clip-path",`url('#clip-path-${b}')`),m){let F;if(m.type==="radial")F=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("fx",String(v+S/2)),F.setAttribute("fy",String(x+_/2)),F.setAttribute("cx",String(v+S/2)),F.setAttribute("cy",String(x+_/2)),F.setAttribute("r",String(M/2));else{const ae=((m.rotation||0)+g)%(2*Math.PI),O=(ae+2*Math.PI)%(2*Math.PI);let se=v+S/2,ee=x+_/2,X=v+S/2,Q=x+_/2;O>=0&&O<=.25*Math.PI||O>1.75*Math.PI&&O<=2*Math.PI?(se-=S/2,ee-=_/2*Math.tan(ae),X+=S/2,Q+=_/2*Math.tan(ae)):O>.25*Math.PI&&O<=.75*Math.PI?(ee-=_/2,se-=S/2/Math.tan(ae),Q+=_/2,X+=S/2/Math.tan(ae)):O>.75*Math.PI&&O<=1.25*Math.PI?(se+=S/2,ee+=_/2*Math.tan(ae),X-=S/2,Q-=_/2*Math.tan(ae)):O>1.25*Math.PI&&O<=1.75*Math.PI&&(ee+=_/2,se+=S/2/Math.tan(ae),Q-=_/2,X-=S/2/Math.tan(ae)),F=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("x1",String(Math.round(se))),F.setAttribute("y1",String(Math.round(ee))),F.setAttribute("x2",String(Math.round(X))),F.setAttribute("y2",String(Math.round(Q)))}m.colorStops.forEach(({offset:ae,color:O})=>{const se=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");se.setAttribute("offset",100*ae+"%"),se.setAttribute("stop-color",O),F.appendChild(se)}),I.setAttribute("fill",`url('#${b}')`),this._defs.appendChild(F)}else f&&I.setAttribute("fill",f);this._element.appendChild(I)}}D.instanceCount=0;const k=D,B="canvas",q={};for(let E=0;E<=40;E++)q[E]=E;const j={type:B,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:q[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function H(E){const m=Object.assign({},E);if(!m.colorStops||!m.colorStops.length)throw"Field 'colorStops' is required in gradient";return m.rotation?m.rotation=Number(m.rotation):m.rotation=0,m.colorStops=m.colorStops.map(f=>Object.assign(Object.assign({},f),{offset:Number(f.offset)})),m}function J(E){const m=Object.assign({},E);return m.width=Number(m.width),m.height=Number(m.height),m.margin=Number(m.margin),m.imageOptions=Object.assign(Object.assign({},m.imageOptions),{hideBackgroundDots:!!m.imageOptions.hideBackgroundDots,imageSize:Number(m.imageOptions.imageSize),margin:Number(m.imageOptions.margin)}),m.margin>Math.min(m.width,m.height)&&(m.margin=Math.min(m.width,m.height)),m.dotsOptions=Object.assign({},m.dotsOptions),m.dotsOptions.gradient&&(m.dotsOptions.gradient=H(m.dotsOptions.gradient)),m.cornersSquareOptions&&(m.cornersSquareOptions=Object.assign({},m.cornersSquareOptions),m.cornersSquareOptions.gradient&&(m.cornersSquareOptions.gradient=H(m.cornersSquareOptions.gradient))),m.cornersDotOptions&&(m.cornersDotOptions=Object.assign({},m.cornersDotOptions),m.cornersDotOptions.gradient&&(m.cornersDotOptions.gradient=H(m.cornersDotOptions.gradient))),m.backgroundOptions&&(m.backgroundOptions=Object.assign({},m.backgroundOptions),m.backgroundOptions.gradient&&(m.backgroundOptions.gradient=H(m.backgroundOptions.gradient))),m}var T=i(873),z=i.n(T);function ue(E){if(!E)throw new Error("Extension must be defined");E[0]==="."&&(E=E.substring(1));const m={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[E.toLowerCase()];if(!m)throw new Error(`Extension "${E}" is not supported`);return m}class _e{constructor(m){m!=null&&m.jsdom?this._window=new m.jsdom("",{resources:"usable"}).window:this._window=window,this._options=m?J(a(j,m)):j,this.update()}static _clearContainer(m){m&&(m.innerHTML="")}_setupSvg(){if(!this._qr)return;const m=new k(this._options,this._window);this._svg=m.getElement(),this._svgDrawingPromise=m.drawQR(this._qr).then(()=>{var f;this._svg&&((f=this._extension)===null||f===void 0||f.call(this,m.getElement(),this._options))})}_setupCanvas(){var m,f;this._qr&&(!((m=this._options.nodeCanvas)===null||m===void 0)&&m.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(f=this._svgDrawingPromise)===null||f===void 0?void 0:f.then(()=>{var g;if(!this._svg)return;const v=this._svg,x=new this._window.XMLSerializer().serializeToString(v),_=btoa(x),S=`data:${ue("svg")};base64,${_}`;if(!((g=this._options.nodeCanvas)===null||g===void 0)&&g.loadImage)return this._options.nodeCanvas.loadImage(S).then(b=>{var M,I;b.width=this._options.width,b.height=this._options.height,(I=(M=this._nodeCanvas)===null||M===void 0?void 0:M.getContext("2d"))===null||I===void 0||I.drawImage(b,0,0)});{const b=new this._window.Image;return new Promise(M=>{b.onload=()=>{var I,F;(F=(I=this._domCanvas)===null||I===void 0?void 0:I.getContext("2d"))===null||F===void 0||F.drawImage(b,0,0),M()},b.src=S})}}))}async _getElement(m="png"){if(!this._qr)throw"QR code is empty";return m.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(m){_e._clearContainer(this._container),this._options=m?J(a(this._options,m)):this._options,this._options.data&&(this._qr=z()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(f){switch(!0){case/^[0-9]*$/.test(f):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(f):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===B?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(m){if(m){if(typeof m.appendChild!="function")throw"Container should be a single DOM node";this._options.type===B?this._domCanvas&&m.appendChild(this._domCanvas):this._svg&&m.appendChild(this._svg),this._container=m}}applyExtension(m){if(!m)throw"Extension function should be defined.";this._extension=m,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(m="png"){if(!this._qr)throw"QR code is empty";const f=await this._getElement(m),g=ue(m);if(!f)return null;if(m.toLowerCase()==="svg"){const v=`\r ${new this._window.XMLSerializer().serializeToString(f)}`;return typeof Blob>"u"||this._options.jsdom?Buffer.from(v):new Blob([v],{type:g})}return new Promise(v=>{const x=f;if("toBuffer"in x)if(g==="image/png")v(x.toBuffer(g));else if(g==="image/jpeg")v(x.toBuffer(g));else{if(g!=="application/pdf")throw Error("Unsupported extension");v(x.toBuffer(g))}else"toBlob"in x&&x.toBlob(v,g,1)})}async download(m){if(!this._qr)throw"QR code is empty";if(typeof Blob>"u")throw"Cannot download in Node.js, call getRawData instead.";let f="png",g="qr";typeof m=="string"?(f=m,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):typeof m=="object"&&m!==null&&(m.name&&(g=m.name),m.extension&&(f=m.extension));const v=await this._getElement(f);if(v)if(f.toLowerCase()==="svg"){let x=new XMLSerializer().serializeToString(v);x=`\r `+x,u(`data:${ue(f)};charset=utf-8,${encodeURIComponent(x)}`,`${g}.svg`)}else u(v.toDataURL(ue(f)),`${g}.${f}`)}}const G=_e})(),s.default})())})(_7);var fZ=_7.exports;const E7=ji(fZ);class Aa extends yt{constructor(e){const{docsPath:r,field:n,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${n}".`,{docsPath:r,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}function S7(t){if(/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t)||/%[^0-9a-f]/i.test(t)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(t))return!1;const e=lZ(t),r=e[1],n=e[2],i=e[3],s=e[4],o=e[5];if(!(r!=null&&r.length&&i.length>=0))return!1;if(n!=null&&n.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9\+\-\.]*$/.test(r.toLowerCase()))return!1;let a="";return a+=`${r}:`,n!=null&&n.length&&(a+=`//${n}`),a+=i,s!=null&&s.length&&(a+=`?${s}`),o!=null&&o.length&&(a+=`#${o}`),a}function lZ(t){return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}function A7(t){const{chainId:e,domain:r,expirationTime:n,issuedAt:i=new Date,nonce:s,notBefore:o,requestId:a,resources:u,scheme:l,uri:d,version:p}=t;{if(e!==Math.floor(e))throw new Aa({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${e}`]});if(!(hZ.test(r)||dZ.test(r)||pZ.test(r)))throw new Aa({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${r}`]});if(!gZ.test(s))throw new Aa({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${s}`]});if(!S7(d))throw new Aa({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${d}`]});if(p!=="1")throw new Aa({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${p}`]});if(l&&!mZ.test(l))throw new Aa({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${l}`]});const k=t.statement;if(k!=null&&k.includes(` `))throw new Aa({field:"statement",metaMessages:["- Statement must not include '\\n'.","",`Provided value: ${k}`]})}const y=og(t.address),A=l?`${l}://${r}`:r,P=t.statement?`${t.statement} @@ -237,11 +237,11 @@ Not Before: ${o.toISOString()}`),a&&(D+=` Request ID: ${a}`),u){let k=` Resources:`;for(const B of u){if(!S7(B))throw new Aa({field:"resources",metaMessages:["- Every resource must be a RFC 3986 URI.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${B}`]});k+=` - ${B}`}D+=k}return`${N} -${D}`}const hZ=/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/,dZ=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/,pZ=/^localhost(:[0-9]{1,5})?$/,gZ=/^[a-zA-Z0-9]{8,}$/,mZ=/^([a-zA-Z][a-zA-Z0-9+-.]*)$/,P7="7a4434fefbcc9af474fb5c995e47d286",vZ={projectId:P7,metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},bZ={namespaces:{eip155:{methods:["eth_sendTransaction","eth_signTransaction","eth_sign","personal_sign","eth_signTypedData"],chains:["eip155:1"],events:["chainChanged","accountsChanged","disconnect"],rpcMap:{1:`https://rpc.walletconnect.com?chainId=eip155:1&projectId=${P7}`}}},skipPairing:!1};function yZ(t,e){const r=window.location.host,n=window.location.href;return A7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function M7(t){var ue,_e,G;const e=Se.useRef(null),{wallet:r,onGetExtension:n,onSignFinish:i}=t,[s,o]=Se.useState(""),[a,u]=Se.useState(!1),[l,d]=Se.useState(""),[p,y]=Se.useState("scan"),A=Se.useRef(),[P,N]=Se.useState((ue=r.config)==null?void 0:ue.image),[D,k]=Se.useState(!1),{saveLastUsedWallet:B}=Kl();async function j(E){var f,g,v,x;u(!0);const m=await pz.init(vZ);m.session&&await m.disconnect();try{if(y("scan"),m.on("display_uri",ae=>{console.log("display_uri",ae),o(ae),u(!1),y("scan")}),m.on("error",ae=>{console.log(ae)}),m.on("session_update",ae=>{console.log("session_update",ae)}),!await m.connect(bZ))throw new Error("Walletconnect init failed");const S=new Wf(m);N(((f=S.config)==null?void 0:f.image)||((g=E.config)==null?void 0:g.image));const b=await S.getAddress(),M=await va.getNonce({account_type:"block_chain"});console.log("get nonce",M);const I=yZ(b,M);y("sign");const F=await S.signMessage(I,b);y("waiting"),await i(S,{message:I,nonce:M,signature:F,address:b,wallet_name:((v=S.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),B(S)}catch(_){console.log("err",_),d(_.details||_.message)}}function U(){A.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),A.current.append(e.current)}function K(E){var m;console.log(A.current),(m=A.current)==null||m.update({data:E})}Se.useEffect(()=>{s&&K(s)},[s]),Se.useEffect(()=>{j(r)},[r]),Se.useEffect(()=>{U()},[]);function J(){d(""),K(""),j(r)}function T(){k(!0),navigator.clipboard.writeText(s),setTimeout(()=>{k(!1)},2500)}function z(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return ge.jsxs("div",{children:[ge.jsx("div",{className:"xc-text-center",children:ge.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[ge.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),ge.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?ge.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):ge.jsx("img",{className:"xc-h-10 xc-w-10",src:P})})]})}),ge.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[ge.jsx("button",{disabled:!s,onClick:T,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:D?ge.jsxs(ge.Fragment,{children:[" ",ge.jsx(LK,{})," Copied!"]}):ge.jsxs(ge.Fragment,{children:[ge.jsx($K,{}),"Copy QR URL"]})}),((_e=r.config)==null?void 0:_e.getWallet)&&ge.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[ge.jsx(kK,{}),"Get Extension"]}),((G=r.config)==null?void 0:G.desktop_link)&&ge.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:z,children:[ge.jsx(f8,{}),"Desktop"]})]}),ge.jsx("div",{className:"xc-text-center",children:l?ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),ge.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:J,children:"Retry"})]}):ge.jsxs(ge.Fragment,{children:[p==="scan"&&ge.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),p==="connect"&&ge.jsx("p",{children:"Click connect in your wallet app"}),p==="sign"&&ge.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),p==="waiting"&&ge.jsx("div",{className:"xc-text-center",children:ge.jsx(vc,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const wZ="Accept connection request in the wallet",xZ="Accept sign-in request in your wallet";function _Z(t,e){const r=window.location.host,n=window.location.href;return A7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function I7(t){var p;const[e,r]=Se.useState(),{wallet:n,onSignFinish:i}=t,s=Se.useRef(),[o,a]=Se.useState("connect"),{saveLastUsedWallet:u}=Kl();async function l(y){var A;try{a("connect");const P=await n.connect();if(!P||P.length===0)throw new Error("Wallet connect error");const N=og(P[0]),D=_Z(N,y);a("sign");const k=await n.signMessage(D,N);if(!k||k.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:N,signature:k,message:D,nonce:y,wallet_name:((A=n.config)==null?void 0:A.name)||""}),u(n)}catch(P){console.log(P.details),r(P.details||P.message)}}async function d(){try{r("");const y=await va.getNonce({account_type:"block_chain"});s.current=y,l(s.current)}catch(y){console.log(y.details),r(y.message)}}return Se.useEffect(()=>{d()},[]),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[ge.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(p=n.config)==null?void 0:p.image,alt:""}),e&&ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),ge.jsx("div",{className:"xc-flex xc-gap-2",children:ge.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:d,children:"Retry"})})]}),!e&&ge.jsxs(ge.Fragment,{children:[o==="connect"&&ge.jsx("span",{className:"xc-text-center",children:wZ}),o==="sign"&&ge.jsx("span",{className:"xc-text-center",children:xZ}),o==="waiting"&&ge.jsx("span",{className:"xc-text-center",children:ge.jsx(vc,{className:"xc-animate-spin"})})]})]})}const Vu="https://static.codatta.io/codatta-connect/wallet-icons.svg",EZ="https://itunes.apple.com/app/",SZ="https://play.google.com/store/apps/details?id=",AZ="https://chromewebstore.google.com/detail/",PZ="https://chromewebstore.google.com/detail/",MZ="https://addons.mozilla.org/en-US/firefox/addon/",IZ="https://microsoftedge.microsoft.com/addons/detail/";function Gu(t){const{icon:e,title:r,link:n}=t;return ge.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[ge.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,ge.jsx(u8,{className:"xc-ml-auto xc-text-gray-400"})]})}function CZ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${EZ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${SZ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${AZ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${PZ}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${MZ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${IZ}${t.edge_addon_id}`),e}function C7(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=CZ(r);return ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),ge.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),ge.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),ge.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&ge.jsx(Gu,{link:n.chromeStoreLink,icon:`${Vu}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&ge.jsx(Gu,{link:n.appStoreLink,icon:`${Vu}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&ge.jsx(Gu,{link:n.playStoreLink,icon:`${Vu}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&ge.jsx(Gu,{link:n.edgeStoreLink,icon:`${Vu}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&ge.jsx(Gu,{link:n.braveStoreLink,icon:`${Vu}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&ge.jsx(Gu,{link:n.firefoxStoreLink,icon:`${Vu}#firefox`,title:"Mozilla Firefox"})]})]})}function TZ(t){const{wallet:e}=t,[r,n]=Se.useState(e.installed?"connect":"qr"),i=Ib();async function s(o,a){var l;const u=await va.walletLogin({account_type:"block_chain",account_enum:i.role,connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&ge.jsx(M7,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&ge.jsx(I7,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&ge.jsx(C7,{wallet:e})]})}function RZ(t){const{wallet:e,onClick:r}=t,n=ge.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return ge.jsx(Sb,{icon:n,title:i,onClick:()=>r(e)})}function T7(t){const{connector:e}=t,[r,n]=Se.useState(),[i,s]=Se.useState([]),o=Se.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d),console.log(d)}Se.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[ge.jsx(l8,{className:"xc-shrink-0 xc-opacity-50"}),ge.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),ge.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>ge.jsx(RZ,{wallet:d,onClick:l},d.name))})]})}var R7={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,$[H+1]=V>>16&255,$[H+2]=V>>8&255,$[H+3]=V&255,$[H+4]=C>>24&255,$[H+5]=C>>16&255,$[H+6]=C>>8&255,$[H+7]=C&255}function N($,H,V,C,Y){var q,oe=0;for(q=0;q>>8)-1}function D($,H,V,C){return N($,H,V,C,16)}function k($,H,V,C){return N($,H,V,C,32)}function B($,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,Ue=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=oe,wt=pe,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;dt=dt+Y|0,_t=_t+q|0,ot=ot+oe|0,wt=wt+pe|0,lt=lt+xe|0,at=at+Re|0,Ae=Ae+De|0,Pe=Pe+it|0,Ge=Ge+Ue|0,je=je+gt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=_t>>>0&255,$[5]=_t>>>8&255,$[6]=_t>>>16&255,$[7]=_t>>>24&255,$[8]=ot>>>0&255,$[9]=ot>>>8&255,$[10]=ot>>>16&255,$[11]=ot>>>24&255,$[12]=wt>>>0&255,$[13]=wt>>>8&255,$[14]=wt>>>16&255,$[15]=wt>>>24&255,$[16]=lt>>>0&255,$[17]=lt>>>8&255,$[18]=lt>>>16&255,$[19]=lt>>>24&255,$[20]=at>>>0&255,$[21]=at>>>8&255,$[22]=at>>>16&255,$[23]=at>>>24&255,$[24]=Ae>>>0&255,$[25]=Ae>>>8&255,$[26]=Ae>>>16&255,$[27]=Ae>>>24&255,$[28]=Pe>>>0&255,$[29]=Pe>>>8&255,$[30]=Pe>>>16&255,$[31]=Pe>>>24&255,$[32]=Ge>>>0&255,$[33]=Ge>>>8&255,$[34]=Ge>>>16&255,$[35]=Ge>>>24&255,$[36]=je>>>0&255,$[37]=je>>>8&255,$[38]=je>>>16&255,$[39]=je>>>24&255,$[40]=qe>>>0&255,$[41]=qe>>>8&255,$[42]=qe>>>16&255,$[43]=qe>>>24&255,$[44]=Xe>>>0&255,$[45]=Xe>>>8&255,$[46]=Xe>>>16&255,$[47]=Xe>>>24&255,$[48]=kt>>>0&255,$[49]=kt>>>8&255,$[50]=kt>>>16&255,$[51]=kt>>>24&255,$[52]=Wt>>>0&255,$[53]=Wt>>>8&255,$[54]=Wt>>>16&255,$[55]=Wt>>>24&255,$[56]=Zt>>>0&255,$[57]=Zt>>>8&255,$[58]=Zt>>>16&255,$[59]=Zt>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255}function j($,H,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,it=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,Ue=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,gt=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=oe,wt=pe,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=at>>>0&255,$[5]=at>>>8&255,$[6]=at>>>16&255,$[7]=at>>>24&255,$[8]=qe>>>0&255,$[9]=qe>>>8&255,$[10]=qe>>>16&255,$[11]=qe>>>24&255,$[12]=Kt>>>0&255,$[13]=Kt>>>8&255,$[14]=Kt>>>16&255,$[15]=Kt>>>24&255,$[16]=Ae>>>0&255,$[17]=Ae>>>8&255,$[18]=Ae>>>16&255,$[19]=Ae>>>24&255,$[20]=Pe>>>0&255,$[21]=Pe>>>8&255,$[22]=Pe>>>16&255,$[23]=Pe>>>24&255,$[24]=Ge>>>0&255,$[25]=Ge>>>8&255,$[26]=Ge>>>16&255,$[27]=Ge>>>24&255,$[28]=je>>>0&255,$[29]=je>>>8&255,$[30]=je>>>16&255,$[31]=je>>>24&255}function U($,H,V,C){B($,H,V,C)}function K($,H,V,C){j($,H,V,C)}var J=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T($,H,V,C,Y,q,oe){var pe=new Uint8Array(16),xe=new Uint8Array(64),Re,De;for(De=0;De<16;De++)pe[De]=0;for(De=0;De<8;De++)pe[De]=q[De];for(;Y>=64;){for(U(xe,pe,oe,J),De=0;De<64;De++)$[H+De]=V[C+De]^xe[De];for(Re=1,De=8;De<16;De++)Re=Re+(pe[De]&255)|0,pe[De]=Re&255,Re>>>=8;Y-=64,H+=64,C+=64}if(Y>0)for(U(xe,pe,oe,J),De=0;De=64;){for(U(oe,q,Y,J),xe=0;xe<64;xe++)$[H+xe]=oe[xe];for(pe=1,xe=8;xe<16;xe++)pe=pe+(q[xe]&255)|0,q[xe]=pe&255,pe>>>=8;V-=64,H+=64}if(V>0)for(U(oe,q,Y,J),xe=0;xe>>13|V<<3)&8191,C=$[4]&255|($[5]&255)<<8,this.r[2]=(V>>>10|C<<6)&7939,Y=$[6]&255|($[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,q=$[8]&255|($[9]&255)<<8,this.r[4]=(Y>>>4|q<<12)&255,this.r[5]=q>>>1&8190,oe=$[10]&255|($[11]&255)<<8,this.r[6]=(q>>>14|oe<<2)&8191,pe=$[12]&255|($[13]&255)<<8,this.r[7]=(oe>>>11|pe<<5)&8065,xe=$[14]&255|($[15]&255)<<8,this.r[8]=(pe>>>8|xe<<8)&8191,this.r[9]=xe>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};G.prototype.blocks=function($,H,V){for(var C=this.fin?0:2048,Y,q,oe,pe,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Ae=this.h[3],Pe=this.h[4],Ge=this.h[5],je=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],de=this.r[3],nr=this.r[4],dr=this.r[5],pr=this.r[6],Qt=this.r[7],gr=this.r[8],lr=this.r[9];V>=16;)Y=$[H+0]&255|($[H+1]&255)<<8,wt+=Y&8191,q=$[H+2]&255|($[H+3]&255)<<8,lt+=(Y>>>13|q<<3)&8191,oe=$[H+4]&255|($[H+5]&255)<<8,at+=(q>>>10|oe<<6)&8191,pe=$[H+6]&255|($[H+7]&255)<<8,Ae+=(oe>>>7|pe<<9)&8191,xe=$[H+8]&255|($[H+9]&255)<<8,Pe+=(pe>>>4|xe<<12)&8191,Ge+=xe>>>1&8191,Re=$[H+10]&255|($[H+11]&255)<<8,je+=(xe>>>14|Re<<2)&8191,De=$[H+12]&255|($[H+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=$[H+14]&255|($[H+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,Ue=0,gt=Ue,gt+=wt*Wt,gt+=lt*(5*lr),gt+=at*(5*gr),gt+=Ae*(5*Qt),gt+=Pe*(5*pr),Ue=gt>>>13,gt&=8191,gt+=Ge*(5*dr),gt+=je*(5*nr),gt+=qe*(5*de),gt+=Xe*(5*Kt),gt+=kt*(5*Zt),Ue+=gt>>>13,gt&=8191,st=Ue,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Ae*(5*gr),st+=Pe*(5*Qt),Ue=st>>>13,st&=8191,st+=Ge*(5*pr),st+=je*(5*dr),st+=qe*(5*nr),st+=Xe*(5*de),st+=kt*(5*Kt),Ue+=st>>>13,st&=8191,tt=Ue,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Ae*(5*lr),tt+=Pe*(5*gr),Ue=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=je*(5*pr),tt+=qe*(5*dr),tt+=Xe*(5*nr),tt+=kt*(5*de),Ue+=tt>>>13,tt&=8191,At=Ue,At+=wt*de,At+=lt*Kt,At+=at*Zt,At+=Ae*Wt,At+=Pe*(5*lr),Ue=At>>>13,At&=8191,At+=Ge*(5*gr),At+=je*(5*Qt),At+=qe*(5*pr),At+=Xe*(5*dr),At+=kt*(5*nr),Ue+=At>>>13,At&=8191,Rt=Ue,Rt+=wt*nr,Rt+=lt*de,Rt+=at*Kt,Rt+=Ae*Zt,Rt+=Pe*Wt,Ue=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=je*(5*gr),Rt+=qe*(5*Qt),Rt+=Xe*(5*pr),Rt+=kt*(5*dr),Ue+=Rt>>>13,Rt&=8191,Mt=Ue,Mt+=wt*dr,Mt+=lt*nr,Mt+=at*de,Mt+=Ae*Kt,Mt+=Pe*Zt,Ue=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=je*(5*lr),Mt+=qe*(5*gr),Mt+=Xe*(5*Qt),Mt+=kt*(5*pr),Ue+=Mt>>>13,Mt&=8191,Et=Ue,Et+=wt*pr,Et+=lt*dr,Et+=at*nr,Et+=Ae*de,Et+=Pe*Kt,Ue=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=je*Wt,Et+=qe*(5*lr),Et+=Xe*(5*gr),Et+=kt*(5*Qt),Ue+=Et>>>13,Et&=8191,dt=Ue,dt+=wt*Qt,dt+=lt*pr,dt+=at*dr,dt+=Ae*nr,dt+=Pe*de,Ue=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=je*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*gr),Ue+=dt>>>13,dt&=8191,_t=Ue,_t+=wt*gr,_t+=lt*Qt,_t+=at*pr,_t+=Ae*dr,_t+=Pe*nr,Ue=_t>>>13,_t&=8191,_t+=Ge*de,_t+=je*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),Ue+=_t>>>13,_t&=8191,ot=Ue,ot+=wt*lr,ot+=lt*gr,ot+=at*Qt,ot+=Ae*pr,ot+=Pe*dr,Ue=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=je*de,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,Ue+=ot>>>13,ot&=8191,Ue=(Ue<<2)+Ue|0,Ue=Ue+gt|0,gt=Ue&8191,Ue=Ue>>>13,st+=Ue,wt=gt,lt=st,at=tt,Ae=At,Pe=Rt,Ge=Mt,je=Et,qe=dt,Xe=_t,kt=ot,H+=16,V-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Ae,this.h[4]=Pe,this.h[5]=Ge,this.h[6]=je,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},G.prototype.finish=function($,H){var V=new Uint16Array(10),C,Y,q,oe;if(this.leftover){for(oe=this.leftover,this.buffer[oe++]=1;oe<16;oe++)this.buffer[oe]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,oe=2;oe<10;oe++)this.h[oe]+=C,C=this.h[oe]>>>13,this.h[oe]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,V[0]=this.h[0]+5,C=V[0]>>>13,V[0]&=8191,oe=1;oe<10;oe++)V[oe]=this.h[oe]+C,C=V[oe]>>>13,V[oe]&=8191;for(V[9]-=8192,Y=(C^1)-1,oe=0;oe<10;oe++)V[oe]&=Y;for(Y=~Y,oe=0;oe<10;oe++)this.h[oe]=this.h[oe]&Y|V[oe];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,q=this.h[0]+this.pad[0],this.h[0]=q&65535,oe=1;oe<8;oe++)q=(this.h[oe]+this.pad[oe]|0)+(q>>>16)|0,this.h[oe]=q&65535;$[H+0]=this.h[0]>>>0&255,$[H+1]=this.h[0]>>>8&255,$[H+2]=this.h[1]>>>0&255,$[H+3]=this.h[1]>>>8&255,$[H+4]=this.h[2]>>>0&255,$[H+5]=this.h[2]>>>8&255,$[H+6]=this.h[3]>>>0&255,$[H+7]=this.h[3]>>>8&255,$[H+8]=this.h[4]>>>0&255,$[H+9]=this.h[4]>>>8&255,$[H+10]=this.h[5]>>>0&255,$[H+11]=this.h[5]>>>8&255,$[H+12]=this.h[6]>>>0&255,$[H+13]=this.h[6]>>>8&255,$[H+14]=this.h[7]>>>0&255,$[H+15]=this.h[7]>>>8&255},G.prototype.update=function($,H,V){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>V&&(Y=V),C=0;C=16&&(Y=V-V%16,this.blocks($,H,Y),H+=Y,V-=Y),V){for(C=0;C>16&1),q[V-1]&=65535;q[15]=oe[15]-32767-(q[14]>>16&1),Y=q[15]>>16&1,q[14]&=65535,_(oe,q,1-Y)}for(V=0;V<16;V++)$[2*V]=oe[V]&255,$[2*V+1]=oe[V]>>8}function b($,H){var V=new Uint8Array(32),C=new Uint8Array(32);return S(V,$),S(C,H),k(V,0,C,0)}function M($){var H=new Uint8Array(32);return S(H,$),H[0]&1}function I($,H){var V;for(V=0;V<16;V++)$[V]=H[2*V]+(H[2*V+1]<<8);$[15]&=32767}function F($,H,V){for(var C=0;C<16;C++)$[C]=H[C]+V[C]}function ae($,H,V){for(var C=0;C<16;C++)$[C]=H[C]-V[C]}function O($,H,V){var C,Y,q=0,oe=0,pe=0,xe=0,Re=0,De=0,it=0,Ue=0,gt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Ae=0,Pe=0,Ge=0,je=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,de=V[0],nr=V[1],dr=V[2],pr=V[3],Qt=V[4],gr=V[5],lr=V[6],Lr=V[7],mr=V[8],wr=V[9],Br=V[10],$r=V[11],Ir=V[12],hn=V[13],dn=V[14],pn=V[15];C=H[0],q+=C*de,oe+=C*nr,pe+=C*dr,xe+=C*pr,Re+=C*Qt,De+=C*gr,it+=C*lr,Ue+=C*Lr,gt+=C*mr,st+=C*wr,tt+=C*Br,At+=C*$r,Rt+=C*Ir,Mt+=C*hn,Et+=C*dn,dt+=C*pn,C=H[1],oe+=C*de,pe+=C*nr,xe+=C*dr,Re+=C*pr,De+=C*Qt,it+=C*gr,Ue+=C*lr,gt+=C*Lr,st+=C*mr,tt+=C*wr,At+=C*Br,Rt+=C*$r,Mt+=C*Ir,Et+=C*hn,dt+=C*dn,_t+=C*pn,C=H[2],pe+=C*de,xe+=C*nr,Re+=C*dr,De+=C*pr,it+=C*Qt,Ue+=C*gr,gt+=C*lr,st+=C*Lr,tt+=C*mr,At+=C*wr,Rt+=C*Br,Mt+=C*$r,Et+=C*Ir,dt+=C*hn,_t+=C*dn,ot+=C*pn,C=H[3],xe+=C*de,Re+=C*nr,De+=C*dr,it+=C*pr,Ue+=C*Qt,gt+=C*gr,st+=C*lr,tt+=C*Lr,At+=C*mr,Rt+=C*wr,Mt+=C*Br,Et+=C*$r,dt+=C*Ir,_t+=C*hn,ot+=C*dn,wt+=C*pn,C=H[4],Re+=C*de,De+=C*nr,it+=C*dr,Ue+=C*pr,gt+=C*Qt,st+=C*gr,tt+=C*lr,At+=C*Lr,Rt+=C*mr,Mt+=C*wr,Et+=C*Br,dt+=C*$r,_t+=C*Ir,ot+=C*hn,wt+=C*dn,lt+=C*pn,C=H[5],De+=C*de,it+=C*nr,Ue+=C*dr,gt+=C*pr,st+=C*Qt,tt+=C*gr,At+=C*lr,Rt+=C*Lr,Mt+=C*mr,Et+=C*wr,dt+=C*Br,_t+=C*$r,ot+=C*Ir,wt+=C*hn,lt+=C*dn,at+=C*pn,C=H[6],it+=C*de,Ue+=C*nr,gt+=C*dr,st+=C*pr,tt+=C*Qt,At+=C*gr,Rt+=C*lr,Mt+=C*Lr,Et+=C*mr,dt+=C*wr,_t+=C*Br,ot+=C*$r,wt+=C*Ir,lt+=C*hn,at+=C*dn,Ae+=C*pn,C=H[7],Ue+=C*de,gt+=C*nr,st+=C*dr,tt+=C*pr,At+=C*Qt,Rt+=C*gr,Mt+=C*lr,Et+=C*Lr,dt+=C*mr,_t+=C*wr,ot+=C*Br,wt+=C*$r,lt+=C*Ir,at+=C*hn,Ae+=C*dn,Pe+=C*pn,C=H[8],gt+=C*de,st+=C*nr,tt+=C*dr,At+=C*pr,Rt+=C*Qt,Mt+=C*gr,Et+=C*lr,dt+=C*Lr,_t+=C*mr,ot+=C*wr,wt+=C*Br,lt+=C*$r,at+=C*Ir,Ae+=C*hn,Pe+=C*dn,Ge+=C*pn,C=H[9],st+=C*de,tt+=C*nr,At+=C*dr,Rt+=C*pr,Mt+=C*Qt,Et+=C*gr,dt+=C*lr,_t+=C*Lr,ot+=C*mr,wt+=C*wr,lt+=C*Br,at+=C*$r,Ae+=C*Ir,Pe+=C*hn,Ge+=C*dn,je+=C*pn,C=H[10],tt+=C*de,At+=C*nr,Rt+=C*dr,Mt+=C*pr,Et+=C*Qt,dt+=C*gr,_t+=C*lr,ot+=C*Lr,wt+=C*mr,lt+=C*wr,at+=C*Br,Ae+=C*$r,Pe+=C*Ir,Ge+=C*hn,je+=C*dn,qe+=C*pn,C=H[11],At+=C*de,Rt+=C*nr,Mt+=C*dr,Et+=C*pr,dt+=C*Qt,_t+=C*gr,ot+=C*lr,wt+=C*Lr,lt+=C*mr,at+=C*wr,Ae+=C*Br,Pe+=C*$r,Ge+=C*Ir,je+=C*hn,qe+=C*dn,Xe+=C*pn,C=H[12],Rt+=C*de,Mt+=C*nr,Et+=C*dr,dt+=C*pr,_t+=C*Qt,ot+=C*gr,wt+=C*lr,lt+=C*Lr,at+=C*mr,Ae+=C*wr,Pe+=C*Br,Ge+=C*$r,je+=C*Ir,qe+=C*hn,Xe+=C*dn,kt+=C*pn,C=H[13],Mt+=C*de,Et+=C*nr,dt+=C*dr,_t+=C*pr,ot+=C*Qt,wt+=C*gr,lt+=C*lr,at+=C*Lr,Ae+=C*mr,Pe+=C*wr,Ge+=C*Br,je+=C*$r,qe+=C*Ir,Xe+=C*hn,kt+=C*dn,Wt+=C*pn,C=H[14],Et+=C*de,dt+=C*nr,_t+=C*dr,ot+=C*pr,wt+=C*Qt,lt+=C*gr,at+=C*lr,Ae+=C*Lr,Pe+=C*mr,Ge+=C*wr,je+=C*Br,qe+=C*$r,Xe+=C*Ir,kt+=C*hn,Wt+=C*dn,Zt+=C*pn,C=H[15],dt+=C*de,_t+=C*nr,ot+=C*dr,wt+=C*pr,lt+=C*Qt,at+=C*gr,Ae+=C*lr,Pe+=C*Lr,Ge+=C*mr,je+=C*wr,qe+=C*Br,Xe+=C*$r,kt+=C*Ir,Wt+=C*hn,Zt+=C*dn,Kt+=C*pn,q+=38*_t,oe+=38*ot,pe+=38*wt,xe+=38*lt,Re+=38*at,De+=38*Ae,it+=38*Pe,Ue+=38*Ge,gt+=38*je,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),$[0]=q,$[1]=oe,$[2]=pe,$[3]=xe,$[4]=Re,$[5]=De,$[6]=it,$[7]=Ue,$[8]=gt,$[9]=st,$[10]=tt,$[11]=At,$[12]=Rt,$[13]=Mt,$[14]=Et,$[15]=dt}function se($,H){O($,H,H)}function ee($,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=253;C>=0;C--)se(V,V),C!==2&&C!==4&&O(V,V,H);for(C=0;C<16;C++)$[C]=V[C]}function X($,H){var V=r(),C;for(C=0;C<16;C++)V[C]=H[C];for(C=250;C>=0;C--)se(V,V),C!==1&&O(V,V,H);for(C=0;C<16;C++)$[C]=V[C]}function Q($,H,V){var C=new Uint8Array(32),Y=new Float64Array(80),q,oe,pe=r(),xe=r(),Re=r(),De=r(),it=r(),Ue=r();for(oe=0;oe<31;oe++)C[oe]=H[oe];for(C[31]=H[31]&127|64,C[0]&=248,I(Y,V),oe=0;oe<16;oe++)xe[oe]=Y[oe],De[oe]=pe[oe]=Re[oe]=0;for(pe[0]=De[0]=1,oe=254;oe>=0;--oe)q=C[oe>>>3]>>>(oe&7)&1,_(pe,xe,q),_(Re,De,q),F(it,pe,Re),ae(pe,pe,Re),F(Re,xe,De),ae(xe,xe,De),se(De,it),se(Ue,pe),O(pe,Re,pe),O(Re,xe,it),F(it,pe,Re),ae(pe,pe,Re),se(xe,pe),ae(Re,De,Ue),O(pe,Re,u),F(pe,pe,De),O(Re,Re,pe),O(pe,De,Ue),O(De,xe,Y),se(xe,it),_(pe,xe,q),_(Re,De,q);for(oe=0;oe<16;oe++)Y[oe+16]=pe[oe],Y[oe+32]=Re[oe],Y[oe+48]=xe[oe],Y[oe+64]=De[oe];var gt=Y.subarray(32),st=Y.subarray(16);return ee(gt,gt),O(st,st,gt),S($,st),0}function R($,H){return Q($,H,s)}function Z($,H){return n(H,32),R($,H)}function te($,H,V){var C=new Uint8Array(32);return Q(C,V,H),K($,i,C,J)}var le=f,ie=g;function fe($,H,V,C,Y,q){var oe=new Uint8Array(32);return te(oe,Y,q),le($,H,V,C,oe)}function ve($,H,V,C,Y,q){var oe=new Uint8Array(32);return te(oe,Y,q),ie($,H,V,C,oe)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne($,H,V,C){for(var Y=new Int32Array(16),q=new Int32Array(16),oe,pe,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Ae,Pe,Ge,je,qe,Xe,kt=$[0],Wt=$[1],Zt=$[2],Kt=$[3],de=$[4],nr=$[5],dr=$[6],pr=$[7],Qt=H[0],gr=H[1],lr=H[2],Lr=H[3],mr=H[4],wr=H[5],Br=H[6],$r=H[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=V[at+0]<<24|V[at+1]<<16|V[at+2]<<8|V[at+3],q[lt]=V[at+4]<<24|V[at+5]<<16|V[at+6]<<8|V[at+7];for(lt=0;lt<80;lt++)if(oe=kt,pe=Wt,xe=Zt,Re=Kt,De=de,it=nr,Ue=dr,gt=pr,st=Qt,tt=gr,At=lr,Rt=Lr,Mt=mr,Et=wr,dt=Br,_t=$r,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(de>>>14|mr<<18)^(de>>>18|mr<<14)^(mr>>>9|de<<23),Pe=(mr>>>14|de<<18)^(mr>>>18|de<<14)^(de>>>9|mr<<23),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=de&nr^~de&dr,Pe=mr&wr^~mr&Br,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Me[lt*2],Pe=Me[lt*2+1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Y[lt%16],Pe=q[lt%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|je<<16,Ae=ot,Pe=wt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Pe=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=kt&Wt^kt&Zt^Wt&Zt,Pe=Qt&gr^Qt&lr^gr&lr,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,gt=qe&65535|Xe<<16,_t=Ge&65535|je<<16,Ae=Re,Pe=Rt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=ot,Pe=wt,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|je<<16,Wt=oe,Zt=pe,Kt=xe,de=Re,nr=De,dr=it,pr=Ue,kt=gt,gr=st,lr=tt,Lr=At,mr=Rt,wr=Mt,Br=Et,$r=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Ae=Y[at],Pe=q[at],Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=Y[(at+9)%16],Pe=q[(at+9)%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+1)%16],wt=q[(at+1)%16],Ae=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Pe=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+14)%16],wt=q[(at+14)%16],Ae=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Pe=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,q[at]=Ge&65535|je<<16;Ae=kt,Pe=Qt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[0],Pe=H[0],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[0]=kt=qe&65535|Xe<<16,H[0]=Qt=Ge&65535|je<<16,Ae=Wt,Pe=gr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[1],Pe=H[1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[1]=Wt=qe&65535|Xe<<16,H[1]=gr=Ge&65535|je<<16,Ae=Zt,Pe=lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[2],Pe=H[2],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[2]=Zt=qe&65535|Xe<<16,H[2]=lr=Ge&65535|je<<16,Ae=Kt,Pe=Lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[3],Pe=H[3],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[3]=Kt=qe&65535|Xe<<16,H[3]=Lr=Ge&65535|je<<16,Ae=de,Pe=mr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[4],Pe=H[4],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[4]=de=qe&65535|Xe<<16,H[4]=mr=Ge&65535|je<<16,Ae=nr,Pe=wr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[5],Pe=H[5],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[5]=nr=qe&65535|Xe<<16,H[5]=wr=Ge&65535|je<<16,Ae=dr,Pe=Br,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[6],Pe=H[6],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[6]=dr=qe&65535|Xe<<16,H[6]=Br=Ge&65535|je<<16,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[7],Pe=H[7],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[7]=pr=qe&65535|Xe<<16,H[7]=$r=Ge&65535|je<<16,Ir+=128,C-=128}return C}function Te($,H,V){var C=new Int32Array(8),Y=new Int32Array(8),q=new Uint8Array(256),oe,pe=V;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,H,V),V%=128,oe=0;oe=0;--Y)C=V[Y/8|0]>>(Y&7)&1,Ie($,H,C),$e(H,$),$e($,$),Ie($,H,C)}function ke($,H){var V=[r(),r(),r(),r()];v(V[0],p),v(V[1],y),v(V[2],a),O(V[3],p,y),Ve($,V,H)}function ze($,H,V){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],q;for(V||n(H,32),Te(C,H,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le($,Y),q=0;q<32;q++)H[q+32]=$[q];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Ee($,H){var V,C,Y,q;for(C=63;C>=32;--C){for(V=0,Y=C-32,q=C-12;Y>4)*He[Y],V=H[Y]>>8,H[Y]&=255;for(Y=0;Y<32;Y++)H[Y]-=V*He[Y];for(C=0;C<32;C++)H[C+1]+=H[C]>>8,$[C]=H[C]&255}function Qe($){var H=new Float64Array(64),V;for(V=0;V<64;V++)H[V]=$[V];for(V=0;V<64;V++)$[V]=0;Ee($,H)}function ct($,H,V,C){var Y=new Uint8Array(64),q=new Uint8Array(64),oe=new Uint8Array(64),pe,xe,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=V+64;for(pe=0;pe>7&&ae($[0],o,$[0]),O($[3],$[0],$[1]),0)}function et($,H,V,C){var Y,q=new Uint8Array(32),oe=new Uint8Array(64),pe=[r(),r(),r(),r()],xe=[r(),r(),r(),r()];if(V<64||Be(xe,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var $=new Uint8Array(vt),H=new Uint8Array(Dt);return ze($,H),{publicKey:$,secretKey:H}},e.sign.keyPair.fromSecretKey=function($){if(nt($),$.length!==Dt)throw new Error("bad secret key size");for(var H=new Uint8Array(vt),V=0;V=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function Cb(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function Y0(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{console.log("display_uri",ae),o(ae),u(!1),y("scan")}),m.on("error",ae=>{console.log(ae)}),m.on("session_update",ae=>{console.log("session_update",ae)}),!await m.connect(bZ))throw new Error("Walletconnect init failed");const S=new ru(m);N(((f=S.config)==null?void 0:f.image)||((g=E.config)==null?void 0:g.image));const b=await S.getAddress(),M=await va.getNonce({account_type:"block_chain"});console.log("get nonce",M);const I=yZ(b,M);y("sign");const F=await S.signMessage(I,b);y("waiting"),await i(S,{message:I,nonce:M,signature:F,address:b,wallet_name:((v=S.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),B(S)}catch(_){console.log("err",_),d(_.details||_.message)}}function j(){A.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),A.current.append(e.current)}function H(E){var m;console.log(A.current),(m=A.current)==null||m.update({data:E})}Ee.useEffect(()=>{s&&H(s)},[s]),Ee.useEffect(()=>{q(r)},[r]),Ee.useEffect(()=>{j()},[]);function J(){d(""),H(""),q(r)}function T(){k(!0),navigator.clipboard.writeText(s),setTimeout(()=>{k(!1)},2500)}function z(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return ge.jsxs("div",{children:[ge.jsx("div",{className:"xc-text-center",children:ge.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[ge.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),ge.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?ge.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):ge.jsx("img",{className:"xc-h-10 xc-w-10",src:P})})]})}),ge.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[ge.jsx("button",{disabled:!s,onClick:T,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:D?ge.jsxs(ge.Fragment,{children:[" ",ge.jsx(LK,{})," Copied!"]}):ge.jsxs(ge.Fragment,{children:[ge.jsx($K,{}),"Copy QR URL"]})}),((_e=r.config)==null?void 0:_e.getWallet)&&ge.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[ge.jsx(kK,{}),"Get Extension"]}),((G=r.config)==null?void 0:G.desktop_link)&&ge.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:z,children:[ge.jsx(l8,{}),"Desktop"]})]}),ge.jsx("div",{className:"xc-text-center",children:l?ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),ge.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:J,children:"Retry"})]}):ge.jsxs(ge.Fragment,{children:[p==="scan"&&ge.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),p==="connect"&&ge.jsx("p",{children:"Click connect in your wallet app"}),p==="sign"&&ge.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),p==="waiting"&&ge.jsx("div",{className:"xc-text-center",children:ge.jsx(vc,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const wZ="Accept connection request in the wallet",xZ="Accept sign-in request in your wallet";function _Z(t,e){const r=window.location.host,n=window.location.href;return A7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function I7(t){var p;const[e,r]=Ee.useState(),{wallet:n,onSignFinish:i}=t,s=Ee.useRef(),[o,a]=Ee.useState("connect"),{saveLastUsedWallet:u}=Kl();async function l(y){var A;try{a("connect");const P=await n.connect();if(!P||P.length===0)throw new Error("Wallet connect error");const N=og(P[0]),D=_Z(N,y);a("sign");const k=await n.signMessage(D,N);if(!k||k.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:N,signature:k,message:D,nonce:y,wallet_name:((A=n.config)==null?void 0:A.name)||""}),u(n)}catch(P){console.log(P.details),r(P.details||P.message)}}async function d(){try{r("");const y=await va.getNonce({account_type:"block_chain"});s.current=y,l(s.current)}catch(y){console.log(y.details),r(y.message)}}return Ee.useEffect(()=>{d()},[]),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[ge.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(p=n.config)==null?void 0:p.image,alt:""}),e&&ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),ge.jsx("div",{className:"xc-flex xc-gap-2",children:ge.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:d,children:"Retry"})})]}),!e&&ge.jsxs(ge.Fragment,{children:[o==="connect"&&ge.jsx("span",{className:"xc-text-center",children:wZ}),o==="sign"&&ge.jsx("span",{className:"xc-text-center",children:xZ}),o==="waiting"&&ge.jsx("span",{className:"xc-text-center",children:ge.jsx(vc,{className:"xc-animate-spin"})})]})]})}const Gu="https://static.codatta.io/codatta-connect/wallet-icons.svg",EZ="https://itunes.apple.com/app/",SZ="https://play.google.com/store/apps/details?id=",AZ="https://chromewebstore.google.com/detail/",PZ="https://chromewebstore.google.com/detail/",MZ="https://addons.mozilla.org/en-US/firefox/addon/",IZ="https://microsoftedge.microsoft.com/addons/detail/";function Yu(t){const{icon:e,title:r,link:n}=t;return ge.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[ge.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,ge.jsx(f8,{className:"xc-ml-auto xc-text-gray-400"})]})}function CZ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${EZ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${SZ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${AZ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${PZ}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${MZ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${IZ}${t.edge_addon_id}`),e}function C7(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=CZ(r);return ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),ge.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),ge.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),ge.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&ge.jsx(Yu,{link:n.chromeStoreLink,icon:`${Gu}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&ge.jsx(Yu,{link:n.appStoreLink,icon:`${Gu}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&ge.jsx(Yu,{link:n.playStoreLink,icon:`${Gu}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&ge.jsx(Yu,{link:n.edgeStoreLink,icon:`${Gu}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&ge.jsx(Yu,{link:n.braveStoreLink,icon:`${Gu}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&ge.jsx(Yu,{link:n.firefoxStoreLink,icon:`${Gu}#firefox`,title:"Mozilla Firefox"})]})]})}function TZ(t){const{wallet:e}=t,[r,n]=Ee.useState(e.installed?"connect":"qr"),i=Cb();async function s(o,a){var l;const u=await va.walletLogin({account_type:"block_chain",account_enum:i.role,connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&ge.jsx(M7,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&ge.jsx(I7,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&ge.jsx(C7,{wallet:e})]})}function RZ(t){const{wallet:e,onClick:r}=t,n=ge.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return ge.jsx(Sb,{icon:n,title:i,onClick:()=>r(e)})}function T7(t){const{connector:e}=t,[r,n]=Ee.useState(),[i,s]=Ee.useState([]),o=Ee.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d),console.log(d)}Ee.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[ge.jsx(h8,{className:"xc-shrink-0 xc-opacity-50"}),ge.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),ge.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>ge.jsx(RZ,{wallet:d,onClick:l},d.name))})]})}var R7={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,$[W+1]=V>>16&255,$[W+2]=V>>8&255,$[W+3]=V&255,$[W+4]=C>>24&255,$[W+5]=C>>16&255,$[W+6]=C>>8&255,$[W+7]=C&255}function N($,W,V,C,Y){var U,oe=0;for(U=0;U>>8)-1}function D($,W,V,C){return N($,W,V,C,16)}function k($,W,V,C){return N($,W,V,C,32)}function B($,W,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,U=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=W[0]&255|(W[1]&255)<<8|(W[2]&255)<<16|(W[3]&255)<<24,it=W[4]&255|(W[5]&255)<<8|(W[6]&255)<<16|(W[7]&255)<<24,Ue=W[8]&255|(W[9]&255)<<8|(W[10]&255)<<16|(W[11]&255)<<24,gt=W[12]&255|(W[13]&255)<<8|(W[14]&255)<<16|(W[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=U,ot=oe,wt=pe,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;dt=dt+Y|0,_t=_t+U|0,ot=ot+oe|0,wt=wt+pe|0,lt=lt+xe|0,at=at+Re|0,Ae=Ae+De|0,Pe=Pe+it|0,Ge=Ge+Ue|0,je=je+gt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=_t>>>0&255,$[5]=_t>>>8&255,$[6]=_t>>>16&255,$[7]=_t>>>24&255,$[8]=ot>>>0&255,$[9]=ot>>>8&255,$[10]=ot>>>16&255,$[11]=ot>>>24&255,$[12]=wt>>>0&255,$[13]=wt>>>8&255,$[14]=wt>>>16&255,$[15]=wt>>>24&255,$[16]=lt>>>0&255,$[17]=lt>>>8&255,$[18]=lt>>>16&255,$[19]=lt>>>24&255,$[20]=at>>>0&255,$[21]=at>>>8&255,$[22]=at>>>16&255,$[23]=at>>>24&255,$[24]=Ae>>>0&255,$[25]=Ae>>>8&255,$[26]=Ae>>>16&255,$[27]=Ae>>>24&255,$[28]=Pe>>>0&255,$[29]=Pe>>>8&255,$[30]=Pe>>>16&255,$[31]=Pe>>>24&255,$[32]=Ge>>>0&255,$[33]=Ge>>>8&255,$[34]=Ge>>>16&255,$[35]=Ge>>>24&255,$[36]=je>>>0&255,$[37]=je>>>8&255,$[38]=je>>>16&255,$[39]=je>>>24&255,$[40]=qe>>>0&255,$[41]=qe>>>8&255,$[42]=qe>>>16&255,$[43]=qe>>>24&255,$[44]=Xe>>>0&255,$[45]=Xe>>>8&255,$[46]=Xe>>>16&255,$[47]=Xe>>>24&255,$[48]=kt>>>0&255,$[49]=kt>>>8&255,$[50]=kt>>>16&255,$[51]=kt>>>24&255,$[52]=Wt>>>0&255,$[53]=Wt>>>8&255,$[54]=Wt>>>16&255,$[55]=Wt>>>24&255,$[56]=Zt>>>0&255,$[57]=Zt>>>8&255,$[58]=Zt>>>16&255,$[59]=Zt>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255}function q($,W,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,U=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=W[0]&255|(W[1]&255)<<8|(W[2]&255)<<16|(W[3]&255)<<24,it=W[4]&255|(W[5]&255)<<8|(W[6]&255)<<16|(W[7]&255)<<24,Ue=W[8]&255|(W[9]&255)<<8|(W[10]&255)<<16|(W[11]&255)<<24,gt=W[12]&255|(W[13]&255)<<8|(W[14]&255)<<16|(W[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=U,ot=oe,wt=pe,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=at>>>0&255,$[5]=at>>>8&255,$[6]=at>>>16&255,$[7]=at>>>24&255,$[8]=qe>>>0&255,$[9]=qe>>>8&255,$[10]=qe>>>16&255,$[11]=qe>>>24&255,$[12]=Kt>>>0&255,$[13]=Kt>>>8&255,$[14]=Kt>>>16&255,$[15]=Kt>>>24&255,$[16]=Ae>>>0&255,$[17]=Ae>>>8&255,$[18]=Ae>>>16&255,$[19]=Ae>>>24&255,$[20]=Pe>>>0&255,$[21]=Pe>>>8&255,$[22]=Pe>>>16&255,$[23]=Pe>>>24&255,$[24]=Ge>>>0&255,$[25]=Ge>>>8&255,$[26]=Ge>>>16&255,$[27]=Ge>>>24&255,$[28]=je>>>0&255,$[29]=je>>>8&255,$[30]=je>>>16&255,$[31]=je>>>24&255}function j($,W,V,C){B($,W,V,C)}function H($,W,V,C){q($,W,V,C)}var J=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T($,W,V,C,Y,U,oe){var pe=new Uint8Array(16),xe=new Uint8Array(64),Re,De;for(De=0;De<16;De++)pe[De]=0;for(De=0;De<8;De++)pe[De]=U[De];for(;Y>=64;){for(j(xe,pe,oe,J),De=0;De<64;De++)$[W+De]=V[C+De]^xe[De];for(Re=1,De=8;De<16;De++)Re=Re+(pe[De]&255)|0,pe[De]=Re&255,Re>>>=8;Y-=64,W+=64,C+=64}if(Y>0)for(j(xe,pe,oe,J),De=0;De=64;){for(j(oe,U,Y,J),xe=0;xe<64;xe++)$[W+xe]=oe[xe];for(pe=1,xe=8;xe<16;xe++)pe=pe+(U[xe]&255)|0,U[xe]=pe&255,pe>>>=8;V-=64,W+=64}if(V>0)for(j(oe,U,Y,J),xe=0;xe>>13|V<<3)&8191,C=$[4]&255|($[5]&255)<<8,this.r[2]=(V>>>10|C<<6)&7939,Y=$[6]&255|($[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,U=$[8]&255|($[9]&255)<<8,this.r[4]=(Y>>>4|U<<12)&255,this.r[5]=U>>>1&8190,oe=$[10]&255|($[11]&255)<<8,this.r[6]=(U>>>14|oe<<2)&8191,pe=$[12]&255|($[13]&255)<<8,this.r[7]=(oe>>>11|pe<<5)&8065,xe=$[14]&255|($[15]&255)<<8,this.r[8]=(pe>>>8|xe<<8)&8191,this.r[9]=xe>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};G.prototype.blocks=function($,W,V){for(var C=this.fin?0:2048,Y,U,oe,pe,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Ae=this.h[3],Pe=this.h[4],Ge=this.h[5],je=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],de=this.r[3],nr=this.r[4],dr=this.r[5],pr=this.r[6],Qt=this.r[7],gr=this.r[8],lr=this.r[9];V>=16;)Y=$[W+0]&255|($[W+1]&255)<<8,wt+=Y&8191,U=$[W+2]&255|($[W+3]&255)<<8,lt+=(Y>>>13|U<<3)&8191,oe=$[W+4]&255|($[W+5]&255)<<8,at+=(U>>>10|oe<<6)&8191,pe=$[W+6]&255|($[W+7]&255)<<8,Ae+=(oe>>>7|pe<<9)&8191,xe=$[W+8]&255|($[W+9]&255)<<8,Pe+=(pe>>>4|xe<<12)&8191,Ge+=xe>>>1&8191,Re=$[W+10]&255|($[W+11]&255)<<8,je+=(xe>>>14|Re<<2)&8191,De=$[W+12]&255|($[W+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=$[W+14]&255|($[W+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,Ue=0,gt=Ue,gt+=wt*Wt,gt+=lt*(5*lr),gt+=at*(5*gr),gt+=Ae*(5*Qt),gt+=Pe*(5*pr),Ue=gt>>>13,gt&=8191,gt+=Ge*(5*dr),gt+=je*(5*nr),gt+=qe*(5*de),gt+=Xe*(5*Kt),gt+=kt*(5*Zt),Ue+=gt>>>13,gt&=8191,st=Ue,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Ae*(5*gr),st+=Pe*(5*Qt),Ue=st>>>13,st&=8191,st+=Ge*(5*pr),st+=je*(5*dr),st+=qe*(5*nr),st+=Xe*(5*de),st+=kt*(5*Kt),Ue+=st>>>13,st&=8191,tt=Ue,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Ae*(5*lr),tt+=Pe*(5*gr),Ue=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=je*(5*pr),tt+=qe*(5*dr),tt+=Xe*(5*nr),tt+=kt*(5*de),Ue+=tt>>>13,tt&=8191,At=Ue,At+=wt*de,At+=lt*Kt,At+=at*Zt,At+=Ae*Wt,At+=Pe*(5*lr),Ue=At>>>13,At&=8191,At+=Ge*(5*gr),At+=je*(5*Qt),At+=qe*(5*pr),At+=Xe*(5*dr),At+=kt*(5*nr),Ue+=At>>>13,At&=8191,Rt=Ue,Rt+=wt*nr,Rt+=lt*de,Rt+=at*Kt,Rt+=Ae*Zt,Rt+=Pe*Wt,Ue=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=je*(5*gr),Rt+=qe*(5*Qt),Rt+=Xe*(5*pr),Rt+=kt*(5*dr),Ue+=Rt>>>13,Rt&=8191,Mt=Ue,Mt+=wt*dr,Mt+=lt*nr,Mt+=at*de,Mt+=Ae*Kt,Mt+=Pe*Zt,Ue=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=je*(5*lr),Mt+=qe*(5*gr),Mt+=Xe*(5*Qt),Mt+=kt*(5*pr),Ue+=Mt>>>13,Mt&=8191,Et=Ue,Et+=wt*pr,Et+=lt*dr,Et+=at*nr,Et+=Ae*de,Et+=Pe*Kt,Ue=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=je*Wt,Et+=qe*(5*lr),Et+=Xe*(5*gr),Et+=kt*(5*Qt),Ue+=Et>>>13,Et&=8191,dt=Ue,dt+=wt*Qt,dt+=lt*pr,dt+=at*dr,dt+=Ae*nr,dt+=Pe*de,Ue=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=je*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*gr),Ue+=dt>>>13,dt&=8191,_t=Ue,_t+=wt*gr,_t+=lt*Qt,_t+=at*pr,_t+=Ae*dr,_t+=Pe*nr,Ue=_t>>>13,_t&=8191,_t+=Ge*de,_t+=je*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),Ue+=_t>>>13,_t&=8191,ot=Ue,ot+=wt*lr,ot+=lt*gr,ot+=at*Qt,ot+=Ae*pr,ot+=Pe*dr,Ue=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=je*de,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,Ue+=ot>>>13,ot&=8191,Ue=(Ue<<2)+Ue|0,Ue=Ue+gt|0,gt=Ue&8191,Ue=Ue>>>13,st+=Ue,wt=gt,lt=st,at=tt,Ae=At,Pe=Rt,Ge=Mt,je=Et,qe=dt,Xe=_t,kt=ot,W+=16,V-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Ae,this.h[4]=Pe,this.h[5]=Ge,this.h[6]=je,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},G.prototype.finish=function($,W){var V=new Uint16Array(10),C,Y,U,oe;if(this.leftover){for(oe=this.leftover,this.buffer[oe++]=1;oe<16;oe++)this.buffer[oe]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,oe=2;oe<10;oe++)this.h[oe]+=C,C=this.h[oe]>>>13,this.h[oe]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,V[0]=this.h[0]+5,C=V[0]>>>13,V[0]&=8191,oe=1;oe<10;oe++)V[oe]=this.h[oe]+C,C=V[oe]>>>13,V[oe]&=8191;for(V[9]-=8192,Y=(C^1)-1,oe=0;oe<10;oe++)V[oe]&=Y;for(Y=~Y,oe=0;oe<10;oe++)this.h[oe]=this.h[oe]&Y|V[oe];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,U=this.h[0]+this.pad[0],this.h[0]=U&65535,oe=1;oe<8;oe++)U=(this.h[oe]+this.pad[oe]|0)+(U>>>16)|0,this.h[oe]=U&65535;$[W+0]=this.h[0]>>>0&255,$[W+1]=this.h[0]>>>8&255,$[W+2]=this.h[1]>>>0&255,$[W+3]=this.h[1]>>>8&255,$[W+4]=this.h[2]>>>0&255,$[W+5]=this.h[2]>>>8&255,$[W+6]=this.h[3]>>>0&255,$[W+7]=this.h[3]>>>8&255,$[W+8]=this.h[4]>>>0&255,$[W+9]=this.h[4]>>>8&255,$[W+10]=this.h[5]>>>0&255,$[W+11]=this.h[5]>>>8&255,$[W+12]=this.h[6]>>>0&255,$[W+13]=this.h[6]>>>8&255,$[W+14]=this.h[7]>>>0&255,$[W+15]=this.h[7]>>>8&255},G.prototype.update=function($,W,V){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>V&&(Y=V),C=0;C=16&&(Y=V-V%16,this.blocks($,W,Y),W+=Y,V-=Y),V){for(C=0;C>16&1),U[V-1]&=65535;U[15]=oe[15]-32767-(U[14]>>16&1),Y=U[15]>>16&1,U[14]&=65535,_(oe,U,1-Y)}for(V=0;V<16;V++)$[2*V]=oe[V]&255,$[2*V+1]=oe[V]>>8}function b($,W){var V=new Uint8Array(32),C=new Uint8Array(32);return S(V,$),S(C,W),k(V,0,C,0)}function M($){var W=new Uint8Array(32);return S(W,$),W[0]&1}function I($,W){var V;for(V=0;V<16;V++)$[V]=W[2*V]+(W[2*V+1]<<8);$[15]&=32767}function F($,W,V){for(var C=0;C<16;C++)$[C]=W[C]+V[C]}function ae($,W,V){for(var C=0;C<16;C++)$[C]=W[C]-V[C]}function O($,W,V){var C,Y,U=0,oe=0,pe=0,xe=0,Re=0,De=0,it=0,Ue=0,gt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Ae=0,Pe=0,Ge=0,je=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,de=V[0],nr=V[1],dr=V[2],pr=V[3],Qt=V[4],gr=V[5],lr=V[6],Lr=V[7],mr=V[8],wr=V[9],Br=V[10],$r=V[11],Ir=V[12],hn=V[13],dn=V[14],pn=V[15];C=W[0],U+=C*de,oe+=C*nr,pe+=C*dr,xe+=C*pr,Re+=C*Qt,De+=C*gr,it+=C*lr,Ue+=C*Lr,gt+=C*mr,st+=C*wr,tt+=C*Br,At+=C*$r,Rt+=C*Ir,Mt+=C*hn,Et+=C*dn,dt+=C*pn,C=W[1],oe+=C*de,pe+=C*nr,xe+=C*dr,Re+=C*pr,De+=C*Qt,it+=C*gr,Ue+=C*lr,gt+=C*Lr,st+=C*mr,tt+=C*wr,At+=C*Br,Rt+=C*$r,Mt+=C*Ir,Et+=C*hn,dt+=C*dn,_t+=C*pn,C=W[2],pe+=C*de,xe+=C*nr,Re+=C*dr,De+=C*pr,it+=C*Qt,Ue+=C*gr,gt+=C*lr,st+=C*Lr,tt+=C*mr,At+=C*wr,Rt+=C*Br,Mt+=C*$r,Et+=C*Ir,dt+=C*hn,_t+=C*dn,ot+=C*pn,C=W[3],xe+=C*de,Re+=C*nr,De+=C*dr,it+=C*pr,Ue+=C*Qt,gt+=C*gr,st+=C*lr,tt+=C*Lr,At+=C*mr,Rt+=C*wr,Mt+=C*Br,Et+=C*$r,dt+=C*Ir,_t+=C*hn,ot+=C*dn,wt+=C*pn,C=W[4],Re+=C*de,De+=C*nr,it+=C*dr,Ue+=C*pr,gt+=C*Qt,st+=C*gr,tt+=C*lr,At+=C*Lr,Rt+=C*mr,Mt+=C*wr,Et+=C*Br,dt+=C*$r,_t+=C*Ir,ot+=C*hn,wt+=C*dn,lt+=C*pn,C=W[5],De+=C*de,it+=C*nr,Ue+=C*dr,gt+=C*pr,st+=C*Qt,tt+=C*gr,At+=C*lr,Rt+=C*Lr,Mt+=C*mr,Et+=C*wr,dt+=C*Br,_t+=C*$r,ot+=C*Ir,wt+=C*hn,lt+=C*dn,at+=C*pn,C=W[6],it+=C*de,Ue+=C*nr,gt+=C*dr,st+=C*pr,tt+=C*Qt,At+=C*gr,Rt+=C*lr,Mt+=C*Lr,Et+=C*mr,dt+=C*wr,_t+=C*Br,ot+=C*$r,wt+=C*Ir,lt+=C*hn,at+=C*dn,Ae+=C*pn,C=W[7],Ue+=C*de,gt+=C*nr,st+=C*dr,tt+=C*pr,At+=C*Qt,Rt+=C*gr,Mt+=C*lr,Et+=C*Lr,dt+=C*mr,_t+=C*wr,ot+=C*Br,wt+=C*$r,lt+=C*Ir,at+=C*hn,Ae+=C*dn,Pe+=C*pn,C=W[8],gt+=C*de,st+=C*nr,tt+=C*dr,At+=C*pr,Rt+=C*Qt,Mt+=C*gr,Et+=C*lr,dt+=C*Lr,_t+=C*mr,ot+=C*wr,wt+=C*Br,lt+=C*$r,at+=C*Ir,Ae+=C*hn,Pe+=C*dn,Ge+=C*pn,C=W[9],st+=C*de,tt+=C*nr,At+=C*dr,Rt+=C*pr,Mt+=C*Qt,Et+=C*gr,dt+=C*lr,_t+=C*Lr,ot+=C*mr,wt+=C*wr,lt+=C*Br,at+=C*$r,Ae+=C*Ir,Pe+=C*hn,Ge+=C*dn,je+=C*pn,C=W[10],tt+=C*de,At+=C*nr,Rt+=C*dr,Mt+=C*pr,Et+=C*Qt,dt+=C*gr,_t+=C*lr,ot+=C*Lr,wt+=C*mr,lt+=C*wr,at+=C*Br,Ae+=C*$r,Pe+=C*Ir,Ge+=C*hn,je+=C*dn,qe+=C*pn,C=W[11],At+=C*de,Rt+=C*nr,Mt+=C*dr,Et+=C*pr,dt+=C*Qt,_t+=C*gr,ot+=C*lr,wt+=C*Lr,lt+=C*mr,at+=C*wr,Ae+=C*Br,Pe+=C*$r,Ge+=C*Ir,je+=C*hn,qe+=C*dn,Xe+=C*pn,C=W[12],Rt+=C*de,Mt+=C*nr,Et+=C*dr,dt+=C*pr,_t+=C*Qt,ot+=C*gr,wt+=C*lr,lt+=C*Lr,at+=C*mr,Ae+=C*wr,Pe+=C*Br,Ge+=C*$r,je+=C*Ir,qe+=C*hn,Xe+=C*dn,kt+=C*pn,C=W[13],Mt+=C*de,Et+=C*nr,dt+=C*dr,_t+=C*pr,ot+=C*Qt,wt+=C*gr,lt+=C*lr,at+=C*Lr,Ae+=C*mr,Pe+=C*wr,Ge+=C*Br,je+=C*$r,qe+=C*Ir,Xe+=C*hn,kt+=C*dn,Wt+=C*pn,C=W[14],Et+=C*de,dt+=C*nr,_t+=C*dr,ot+=C*pr,wt+=C*Qt,lt+=C*gr,at+=C*lr,Ae+=C*Lr,Pe+=C*mr,Ge+=C*wr,je+=C*Br,qe+=C*$r,Xe+=C*Ir,kt+=C*hn,Wt+=C*dn,Zt+=C*pn,C=W[15],dt+=C*de,_t+=C*nr,ot+=C*dr,wt+=C*pr,lt+=C*Qt,at+=C*gr,Ae+=C*lr,Pe+=C*Lr,Ge+=C*mr,je+=C*wr,qe+=C*Br,Xe+=C*$r,kt+=C*Ir,Wt+=C*hn,Zt+=C*dn,Kt+=C*pn,U+=38*_t,oe+=38*ot,pe+=38*wt,xe+=38*lt,Re+=38*at,De+=38*Ae,it+=38*Pe,Ue+=38*Ge,gt+=38*je,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=U+Y+65535,Y=Math.floor(C/65536),U=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,U+=Y-1+37*(Y-1),Y=1,C=U+Y+65535,Y=Math.floor(C/65536),U=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,U+=Y-1+37*(Y-1),$[0]=U,$[1]=oe,$[2]=pe,$[3]=xe,$[4]=Re,$[5]=De,$[6]=it,$[7]=Ue,$[8]=gt,$[9]=st,$[10]=tt,$[11]=At,$[12]=Rt,$[13]=Mt,$[14]=Et,$[15]=dt}function se($,W){O($,W,W)}function ee($,W){var V=r(),C;for(C=0;C<16;C++)V[C]=W[C];for(C=253;C>=0;C--)se(V,V),C!==2&&C!==4&&O(V,V,W);for(C=0;C<16;C++)$[C]=V[C]}function X($,W){var V=r(),C;for(C=0;C<16;C++)V[C]=W[C];for(C=250;C>=0;C--)se(V,V),C!==1&&O(V,V,W);for(C=0;C<16;C++)$[C]=V[C]}function Q($,W,V){var C=new Uint8Array(32),Y=new Float64Array(80),U,oe,pe=r(),xe=r(),Re=r(),De=r(),it=r(),Ue=r();for(oe=0;oe<31;oe++)C[oe]=W[oe];for(C[31]=W[31]&127|64,C[0]&=248,I(Y,V),oe=0;oe<16;oe++)xe[oe]=Y[oe],De[oe]=pe[oe]=Re[oe]=0;for(pe[0]=De[0]=1,oe=254;oe>=0;--oe)U=C[oe>>>3]>>>(oe&7)&1,_(pe,xe,U),_(Re,De,U),F(it,pe,Re),ae(pe,pe,Re),F(Re,xe,De),ae(xe,xe,De),se(De,it),se(Ue,pe),O(pe,Re,pe),O(Re,xe,it),F(it,pe,Re),ae(pe,pe,Re),se(xe,pe),ae(Re,De,Ue),O(pe,Re,u),F(pe,pe,De),O(Re,Re,pe),O(pe,De,Ue),O(De,xe,Y),se(xe,it),_(pe,xe,U),_(Re,De,U);for(oe=0;oe<16;oe++)Y[oe+16]=pe[oe],Y[oe+32]=Re[oe],Y[oe+48]=xe[oe],Y[oe+64]=De[oe];var gt=Y.subarray(32),st=Y.subarray(16);return ee(gt,gt),O(st,st,gt),S($,st),0}function R($,W){return Q($,W,s)}function Z($,W){return n(W,32),R($,W)}function te($,W,V){var C=new Uint8Array(32);return Q(C,V,W),H($,i,C,J)}var le=f,ie=g;function fe($,W,V,C,Y,U){var oe=new Uint8Array(32);return te(oe,Y,U),le($,W,V,C,oe)}function ve($,W,V,C,Y,U){var oe=new Uint8Array(32);return te(oe,Y,U),ie($,W,V,C,oe)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne($,W,V,C){for(var Y=new Int32Array(16),U=new Int32Array(16),oe,pe,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Ae,Pe,Ge,je,qe,Xe,kt=$[0],Wt=$[1],Zt=$[2],Kt=$[3],de=$[4],nr=$[5],dr=$[6],pr=$[7],Qt=W[0],gr=W[1],lr=W[2],Lr=W[3],mr=W[4],wr=W[5],Br=W[6],$r=W[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=V[at+0]<<24|V[at+1]<<16|V[at+2]<<8|V[at+3],U[lt]=V[at+4]<<24|V[at+5]<<16|V[at+6]<<8|V[at+7];for(lt=0;lt<80;lt++)if(oe=kt,pe=Wt,xe=Zt,Re=Kt,De=de,it=nr,Ue=dr,gt=pr,st=Qt,tt=gr,At=lr,Rt=Lr,Mt=mr,Et=wr,dt=Br,_t=$r,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(de>>>14|mr<<18)^(de>>>18|mr<<14)^(mr>>>9|de<<23),Pe=(mr>>>14|de<<18)^(mr>>>18|de<<14)^(de>>>9|mr<<23),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=de&nr^~de&dr,Pe=mr&wr^~mr&Br,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Me[lt*2],Pe=Me[lt*2+1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Y[lt%16],Pe=U[lt%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|je<<16,Ae=ot,Pe=wt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Pe=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=kt&Wt^kt&Zt^Wt&Zt,Pe=Qt&gr^Qt&lr^gr&lr,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,gt=qe&65535|Xe<<16,_t=Ge&65535|je<<16,Ae=Re,Pe=Rt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=ot,Pe=wt,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|je<<16,Wt=oe,Zt=pe,Kt=xe,de=Re,nr=De,dr=it,pr=Ue,kt=gt,gr=st,lr=tt,Lr=At,mr=Rt,wr=Mt,Br=Et,$r=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Ae=Y[at],Pe=U[at],Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=Y[(at+9)%16],Pe=U[(at+9)%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+1)%16],wt=U[(at+1)%16],Ae=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Pe=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+14)%16],wt=U[(at+14)%16],Ae=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Pe=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,U[at]=Ge&65535|je<<16;Ae=kt,Pe=Qt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[0],Pe=W[0],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[0]=kt=qe&65535|Xe<<16,W[0]=Qt=Ge&65535|je<<16,Ae=Wt,Pe=gr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[1],Pe=W[1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[1]=Wt=qe&65535|Xe<<16,W[1]=gr=Ge&65535|je<<16,Ae=Zt,Pe=lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[2],Pe=W[2],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[2]=Zt=qe&65535|Xe<<16,W[2]=lr=Ge&65535|je<<16,Ae=Kt,Pe=Lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[3],Pe=W[3],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[3]=Kt=qe&65535|Xe<<16,W[3]=Lr=Ge&65535|je<<16,Ae=de,Pe=mr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[4],Pe=W[4],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[4]=de=qe&65535|Xe<<16,W[4]=mr=Ge&65535|je<<16,Ae=nr,Pe=wr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[5],Pe=W[5],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[5]=nr=qe&65535|Xe<<16,W[5]=wr=Ge&65535|je<<16,Ae=dr,Pe=Br,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[6],Pe=W[6],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[6]=dr=qe&65535|Xe<<16,W[6]=Br=Ge&65535|je<<16,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[7],Pe=W[7],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[7]=pr=qe&65535|Xe<<16,W[7]=$r=Ge&65535|je<<16,Ir+=128,C-=128}return C}function Te($,W,V){var C=new Int32Array(8),Y=new Int32Array(8),U=new Uint8Array(256),oe,pe=V;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,W,V),V%=128,oe=0;oe=0;--Y)C=V[Y/8|0]>>(Y&7)&1,Ie($,W,C),$e(W,$),$e($,$),Ie($,W,C)}function ke($,W){var V=[r(),r(),r(),r()];v(V[0],p),v(V[1],y),v(V[2],a),O(V[3],p,y),Ve($,V,W)}function ze($,W,V){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],U;for(V||n(W,32),Te(C,W,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le($,Y),U=0;U<32;U++)W[U+32]=$[U];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Se($,W){var V,C,Y,U;for(C=63;C>=32;--C){for(V=0,Y=C-32,U=C-12;Y>4)*He[Y],V=W[Y]>>8,W[Y]&=255;for(Y=0;Y<32;Y++)W[Y]-=V*He[Y];for(C=0;C<32;C++)W[C+1]+=W[C]>>8,$[C]=W[C]&255}function Qe($){var W=new Float64Array(64),V;for(V=0;V<64;V++)W[V]=$[V];for(V=0;V<64;V++)$[V]=0;Se($,W)}function ct($,W,V,C){var Y=new Uint8Array(64),U=new Uint8Array(64),oe=new Uint8Array(64),pe,xe,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=V+64;for(pe=0;pe>7&&ae($[0],o,$[0]),O($[3],$[0],$[1]),0)}function et($,W,V,C){var Y,U=new Uint8Array(32),oe=new Uint8Array(64),pe=[r(),r(),r(),r()],xe=[r(),r(),r(),r()];if(V<64||Be(xe,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var $=new Uint8Array(vt),W=new Uint8Array(Dt);return ze($,W),{publicKey:$,secretKey:W}},e.sign.keyPair.fromSecretKey=function($){if(nt($),$.length!==Dt)throw new Error("bad secret key size");for(var W=new Uint8Array(vt),V=0;V=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function Tb(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function Y0(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new Ut("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new Ut("Delay aborted"))})})})}function As(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function fh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=As(e==null?void 0:e.signal);if(typeof t!="function")throw new Ut(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=p??null,o==null||o.abort(),o=As(p),o.signal.aborted)throw new Ut("Resource creation was aborted");n=y??null;const A=t(o.signal,...y);i=A;const P=yield A;if(i!==A&&P!==r)throw yield e(P),new Ut("Resource creation was aborted by a new resource creation");return r=P,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const p=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([p?e(p):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:p=>Pt(this,void 0,void 0,function*(){const y=r,A=i,P=n,N=s;if(yield U7(p),y===r&&A===i&&P===n&&N===s)return yield a(s,...P??[]);throw new Ut("Resource recreation was aborted by a new resource creation")})}}function ZZ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=As(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new Ut("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new Ut(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new Ut("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class Lb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=XZ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield QZ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new KZ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(j7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=B7.encode(e);yield fh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new Ut(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Fo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Fo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new Ut(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new Ut("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),Sn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Ut("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new Ut(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function QZ(t){return Pt(this,void 0,void 0,function*(){return yield ZZ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=As(n.signal).signal;if(o.aborted){r(new Ut("Bridge connection aborted"));return}const a=new URL(j7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new Ut("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}try{const p=yield t.errorHandler(l,d);p!==l&&l.close(),p&&p!==l&&e(p)}catch(p){l.close(),r(p)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new Ut("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function lh(t){return!("connectEvent"in t)}class hh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!lh(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Tb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Tb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");if(!lh(e))throw new Ut("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new Ut("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!lh(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const q7=2;class dh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new hh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getHttpConnection();return lh(n)?new dh(e,n.connectionSource):new dh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=As(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Tb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield fh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(lh(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new Ut("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Lb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield fh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Ut("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),Y0(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=As(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){Sn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(B7.decode(e.message).toUint8Array(),Y0(e.from)));if(Sn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){Sn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Fo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(Sn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new Ut(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return GZ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",q7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+YZ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new Lb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>fh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Lb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function z7(t,e){return H7(t,[e])}function H7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function eQ(t){try{return!z7(t,"tonconnect")||!z7(t.tonconnect,"walletInfo")?!1:H7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Ju{constructor(){this.storage={}}static getInstance(){return Ju.instance||(Ju.instance=new Ju),Ju.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function np(){if(!(typeof window>"u"))return window}function tQ(){const t=np();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function rQ(){if(!(typeof document>"u"))return document}function nQ(){var t;const e=(t=np())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function iQ(){if(sQ())return localStorage;if(oQ())throw new Ut("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Ju.getInstance()}function sQ(){try{return typeof localStorage<"u"}catch{return!1}}function oQ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class xi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=xi.window;if(!xi.isWindowContainsWallet(n,r))throw new Ob;this.connectionStorage=new hh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getInjectedConnection();return new xi(e,n.jsBridgeKey)})}static isWalletInjected(e){return xi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return xi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?tQ().filter(([n,i])=>eQ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(q7,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{Sn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();Sn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){Sn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>Sn("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{Sn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);Sn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){Sn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{Sn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}xi.window=np();class aQ{constructor(){this.localStorage=iQ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function W7(t){return uQ(t)&&t.injected}function cQ(t){return W7(t)&&t.embedded}function uQ(t){return"jsBridgeKey"in t}const fQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class kb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(cQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new Nb("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Fo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Fo(n),e=fQ}let r=[];try{r=xi.getCurrentlyInjectedWallets()}catch(n){Fo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=xi.isWalletInjected(o),i.embedded=xi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class ip extends Ut{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,ip.prototype)}}function lQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new ip("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function wQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Zu(t,e)),Bb(e,r))}function xQ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Zu(t,e)),Bb(e,r))}function _Q(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Zu(t,e)),Bb(e,r))}function EQ(t,e,r){return Object.assign({type:"disconnection",scope:r},Zu(t,e))}class SQ{constructor(){this.window=np()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class AQ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new SQ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Xu({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",dQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",hQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=pQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=gQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=mQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=vQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=bQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=yQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=EQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=wQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=xQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=_Q(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const PQ="3.0.5";class ph{constructor(e){if(this.walletsList=new kb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||nQ(),storage:(e==null?void 0:e.storage)||new aQ},this.walletsList=new kb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new AQ({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:PQ}),!this.dappSettings.manifestUrl)throw new Rb("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new hh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Db;const o=As(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new Ut("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield dh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield xi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Fo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=fh(p=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:p.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(p=>setTimeout(()=>p(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=As(n==null?void 0:n.signal);if(i.signal.aborted)throw new Ut("Transaction sending was aborted");this.checkConnection(),lQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=jZ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(rp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(rp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),rp.parseAndThrowError(l);const d=rp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new Z0;const n=As(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Ut("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=rQ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Fo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&UZ(e)?r=new xi(this.dappSettings.storage,e.jsBridgeKey):r=new dh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new Ut("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=zZ.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),Sn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof X0||r instanceof J0)throw Fo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new Z0}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}ph.walletsList=new kb,ph.isWalletInjected=t=>xi.isWalletInjected(t),ph.isInsideWalletBrowser=t=>xi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function $b(t){const{children:e,onClick:r}=t;return ge.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function K7(t){const{wallet:e,connector:r,loading:n}=t,i=Se.useRef(null),s=Se.useRef(),[o,a]=Se.useState(),[u,l]=Se.useState(),[d,p]=Se.useState("connect"),[y,A]=Se.useState(!1),[P,N]=Se.useState();function D(z){var ue;(ue=s.current)==null||ue.update({data:z})}async function k(){A(!0);try{a("");const z=await va.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ue=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:z}});if(!ue)return;N(ue),D(ue),l(z)}}catch(z){a(z.message)}A(!1)}function B(){s.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function j(){r.connect(e,{request:{tonProof:u}})}function U(){if("deepLink"in e){if(!e.deepLink||!P)return;const z=new URL(P),ue=`${e.deepLink}${z.search}`;window.open(ue)}}function K(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(P)}const J=Se.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),T=Se.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Se.useEffect(()=>{B(),k()},[]),ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-text-center xc-mb-6",children:[ge.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[ge.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),ge.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?ge.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):ge.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),ge.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),ge.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&ge.jsx(vc,{className:"xc-animate-spin"}),!y&&!n&&ge.jsxs(ge.Fragment,{children:[W7(e)&&ge.jsxs($b,{onClick:j,children:[ge.jsx(BK,{className:"xc-opacity-80"}),"Extension"]}),J&&ge.jsxs($b,{onClick:U,children:[ge.jsx(f8,{className:"xc-opacity-80"}),"Desktop"]}),T&&ge.jsx($b,{onClick:K,children:"Telegram Mini App"})]})]})]})}function MQ(t){const[e,r]=Se.useState(""),[n,i]=Se.useState(),[s,o]=Se.useState(),a=Ib(),[u,l]=Se.useState(!1);async function d(y){var P,N;if(!y||!((P=y.connectItems)!=null&&P.tonProof))return;l(!0);const A=await va.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(N=y.connectItems)==null?void 0:N.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(A.data),l(!1)}Se.useEffect(()=>{const y=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),A=y.onStatusChange(d);return o(y),r("select"),A},[]);function p(y){r("connect"),i(y)}return ge.jsxs(Ss,{children:[e==="select"&&ge.jsx(T7,{connector:s,onSelect:p,onBack:t.onBack}),e==="connect"&&ge.jsx(K7,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function V7(t){const{children:e,className:r}=t,n=Se.useRef(null),[i,s]=Se.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Se.useEffect(()=>{console.log("maxHeight",i)},[i]),ge.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function IQ(){return ge.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ge.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),ge.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function G7(t){const{wallets:e}=Kl(),[r,n]=Se.useState(),i=Se.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[ge.jsx(l8,{className:"xc-shrink-0 xc-opacity-50"}),ge.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),ge.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>ge.jsx(e7,{wallet:a,onClick:s},`feature-${a.key}`)):ge.jsx(IQ,{})})]})}function CQ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Se.useState(""),[l,d]=Se.useState(null),[p,y]=Se.useState("");function A(k){d(k),u("evm-wallet")}function P(k){u("email"),y(k)}async function N(k){await e(k)}function D(){u("ton-wallet")}return Se.useEffect(()=>{u("index")},[]),ge.jsx(GX,{config:t.config,children:ge.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&ge.jsx(TZ,{onBack:()=>u("index"),onLogin:N,wallet:l}),a==="ton-wallet"&&ge.jsx(MQ,{onBack:()=>u("index"),onLogin:N}),a==="email"&&ge.jsx(uZ,{email:p,onBack:()=>u("index"),onLogin:N}),a==="index"&&ge.jsx(f7,{header:r,onEmailConfirm:P,onSelectWallet:A,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&ge.jsx(G7,{onBack:()=>u("index"),onSelectWallet:A})]})})}function TQ(t){const{wallet:e,onConnect:r}=t,[n,i]=Se.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&ge.jsx(M7,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&ge.jsx(I7,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&ge.jsx(C7,{wallet:e})]})}function RQ(t){const{email:e}=t,[r,n]=Se.useState("captcha");return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),r==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>n("verify-email")}),r==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:t.onInputCode,onResendCode:()=>n("captcha")})]})}function DQ(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Se.useState(""),[a,u]=Se.useState(),[l,d]=Se.useState(),p=Se.useRef(),[y,A]=Se.useState("");function P(j){u(j),o("evm-wallet-connect")}function N(j){A(j),o("email-connect")}async function D(j,U){await e({chain_type:"eip155",client:j.client,connect_info:U}),o("index")}function k(j){d(j),o("ton-wallet-connect")}async function B(j){j&&await r({chain_type:"ton",client:p.current,connect_info:j})}return Se.useEffect(()=>{p.current=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const j=p.current.onStatusChange(B);return o("index"),j},[]),ge.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&ge.jsx(G7,{onBack:()=>o("index"),onSelectWallet:P}),s==="evm-wallet-connect"&&ge.jsx(TQ,{onBack:()=>o("index"),onConnect:D,wallet:a}),s==="ton-wallet-select"&&ge.jsx(T7,{connector:p.current,onSelect:k,onBack:()=>o("index")}),s==="ton-wallet-connect"&&ge.jsx(K7,{connector:p.current,wallet:l,onBack:()=>o("index")}),s==="email-connect"&&ge.jsx(RQ,{email:y,onBack:()=>o("index"),onInputCode:n}),s==="index"&&ge.jsx(f7,{onEmailConfirm:N,onSelectWallet:P,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Fn.CodattaConnect=DQ,Fn.CodattaConnectContextProvider=CK,Fn.CodattaSignin=CQ,Fn.coinbaseWallet=o8,Fn.useCodattaConnectContext=Kl,Object.defineProperty(Fn,Symbol.toStringTag,{value:"Module"})}); +`+e:""}`,Object.setPrototypeOf(this,Ut.prototype)}get info(){return""}}Ut.prefix="[TON_CONNECT_SDK_ERROR]";class Db extends Ut{get info(){return"Passed DappMetadata is in incorrect format."}constructor(...e){super(...e),Object.setPrototypeOf(this,Db.prototype)}}class J0 extends Ut{get info(){return"Passed `tonconnect-manifest.json` contains errors. Check format of your manifest. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,J0.prototype)}}class X0 extends Ut{get info(){return"Manifest not found. Make sure you added `tonconnect-manifest.json` to the root of your app or passed correct manifestUrl. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,X0.prototype)}}class Ob extends Ut{get info(){return"Wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection."}constructor(...e){super(...e),Object.setPrototypeOf(this,Ob.prototype)}}class Z0 extends Ut{get info(){return"Send transaction or other protocol methods called while wallet is not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,Z0.prototype)}}function UZ(t){return"jsBridgeKey"in t}class Q0 extends Ut{get info(){return"User rejects the action in the wallet."}constructor(...e){super(...e),Object.setPrototypeOf(this,Q0.prototype)}}class ep extends Ut{get info(){return"Request to the wallet contains errors."}constructor(...e){super(...e),Object.setPrototypeOf(this,ep.prototype)}}class tp extends Ut{get info(){return"App tries to send rpc request to the injected wallet while not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,tp.prototype)}}class Nb extends Ut{get info(){return"There is an attempt to connect to the injected wallet while it is not exists in the webpage."}constructor(...e){super(...e),Object.setPrototypeOf(this,Nb.prototype)}}class Lb extends Ut{get info(){return"An error occurred while fetching the wallets list."}constructor(...e){super(...e),Object.setPrototypeOf(this,Lb.prototype)}}class Ma extends Ut{constructor(...e){super(...e),Object.setPrototypeOf(this,Ma.prototype)}}const $7={[Pa.UNKNOWN_ERROR]:Ma,[Pa.USER_REJECTS_ERROR]:Q0,[Pa.BAD_REQUEST_ERROR]:ep,[Pa.UNKNOWN_APP_ERROR]:tp,[Pa.MANIFEST_NOT_FOUND_ERROR]:X0,[Pa.MANIFEST_CONTENT_ERROR]:J0};class qZ{parseError(e){let r=Ma;return e.code in $7&&(r=$7[e.code]||Ma),new r(e.message)}}const zZ=new qZ;class HZ{isError(e){return"error"in e}}const F7={[Ju.UNKNOWN_ERROR]:Ma,[Ju.USER_REJECTS_ERROR]:Q0,[Ju.BAD_REQUEST_ERROR]:ep,[Ju.UNKNOWN_APP_ERROR]:tp};class WZ extends HZ{convertToRpcRequest(e){return{method:"sendTransaction",params:[JSON.stringify(e)]}}parseAndThrowError(e){let r=Ma;throw e.error.code in F7&&(r=F7[e.error.code]||Ma),new r(e.error.message)}convertFromRpcResponse(e){return{boc:e.result}}}const rp=new WZ;class KZ{constructor(e,r){this.storage=e,this.storeKey="ton-connect-storage_http-bridge-gateway::"+r}storeLastEventId(e){return Pt(this,void 0,void 0,function*(){return this.storage.setItem(this.storeKey,e)})}removeLastEventId(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getLastEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e||null})}}function VZ(t){return t.slice(-1)==="/"?t.slice(0,-1):t}function j7(t,e){return VZ(t)+"/"+e}function GZ(t){if(!t)return!1;const e=new URL(t);return e.protocol==="tg:"||e.hostname==="t.me"}function YZ(t){return t.replaceAll(".","%2E").replaceAll("-","%2D").replaceAll("_","%5F").replaceAll("&","-").replaceAll("=","__").replaceAll("%","--")}function U7(t,e){return Pt(this,void 0,void 0,function*(){return new Promise((r,n)=>{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new Ut("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new Ut("Delay aborted"))})})})}function As(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function fh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=As(e==null?void 0:e.signal);if(typeof t!="function")throw new Ut(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=p??null,o==null||o.abort(),o=As(p),o.signal.aborted)throw new Ut("Resource creation was aborted");n=y??null;const A=t(o.signal,...y);i=A;const P=yield A;if(i!==A&&P!==r)throw yield e(P),new Ut("Resource creation was aborted by a new resource creation");return r=P,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const p=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([p?e(p):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:p=>Pt(this,void 0,void 0,function*(){const y=r,A=i,P=n,N=s;if(yield U7(p),y===r&&A===i&&P===n&&N===s)return yield a(s,...P??[]);throw new Ut("Resource recreation was aborted by a new resource creation")})}}function ZZ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=As(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new Ut("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new Ut(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new Ut("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class kb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=XZ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield QZ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new KZ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(j7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=B7.encode(e);yield fh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new Ut(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Fo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Fo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new Ut(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new Ut("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),Sn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Ut("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new Ut(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function QZ(t){return Pt(this,void 0,void 0,function*(){return yield ZZ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=As(n.signal).signal;if(o.aborted){r(new Ut("Bridge connection aborted"));return}const a=new URL(j7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new Ut("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}try{const p=yield t.errorHandler(l,d);p!==l&&l.close(),p&&p!==l&&e(p)}catch(p){l.close(),r(p)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new Ut("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function lh(t){return!("connectEvent"in t)}class hh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!lh(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Rb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Rb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");if(!lh(e))throw new Ut("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new Ut("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!lh(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const q7=2;class dh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new hh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getHttpConnection();return lh(n)?new dh(e,n.connectionSource):new dh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=As(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Rb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield fh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(lh(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new Ut("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new kb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield fh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Ut("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),Y0(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=As(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){Sn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(B7.decode(e.message).toUint8Array(),Y0(e.from)));if(Sn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){Sn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Fo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(Sn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new Ut(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return GZ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",q7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+YZ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new kb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>fh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new kb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function z7(t,e){return H7(t,[e])}function H7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function eQ(t){try{return!z7(t,"tonconnect")||!z7(t.tonconnect,"walletInfo")?!1:H7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Xu{constructor(){this.storage={}}static getInstance(){return Xu.instance||(Xu.instance=new Xu),Xu.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function np(){if(!(typeof window>"u"))return window}function tQ(){const t=np();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function rQ(){if(!(typeof document>"u"))return document}function nQ(){var t;const e=(t=np())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function iQ(){if(sQ())return localStorage;if(oQ())throw new Ut("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Xu.getInstance()}function sQ(){try{return typeof localStorage<"u"}catch{return!1}}function oQ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class xi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=xi.window;if(!xi.isWindowContainsWallet(n,r))throw new Nb;this.connectionStorage=new hh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getInjectedConnection();return new xi(e,n.jsBridgeKey)})}static isWalletInjected(e){return xi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return xi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?tQ().filter(([n,i])=>eQ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(q7,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{Sn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();Sn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){Sn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>Sn("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{Sn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);Sn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){Sn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{Sn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}xi.window=np();class aQ{constructor(){this.localStorage=iQ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function W7(t){return uQ(t)&&t.injected}function cQ(t){return W7(t)&&t.embedded}function uQ(t){return"jsBridgeKey"in t}const fQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class Bb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(cQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new Lb("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Fo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Fo(n),e=fQ}let r=[];try{r=xi.getCurrentlyInjectedWallets()}catch(n){Fo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=xi.isWalletInjected(o),i.embedded=xi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class ip extends Ut{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,ip.prototype)}}function lQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new ip("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function wQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Qu(t,e)),$b(e,r))}function xQ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Qu(t,e)),$b(e,r))}function _Q(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Qu(t,e)),$b(e,r))}function EQ(t,e,r){return Object.assign({type:"disconnection",scope:r},Qu(t,e))}class SQ{constructor(){this.window=np()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class AQ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new SQ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Zu({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",dQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",hQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=pQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=gQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=mQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=vQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=bQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=yQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=EQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=wQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=xQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=_Q(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const PQ="3.0.5";class ph{constructor(e){if(this.walletsList=new Bb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||nQ(),storage:(e==null?void 0:e.storage)||new aQ},this.walletsList=new Bb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new AQ({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:PQ}),!this.dappSettings.manifestUrl)throw new Db("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new hh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Ob;const o=As(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new Ut("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield dh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield xi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Fo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=fh(p=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:p.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(p=>setTimeout(()=>p(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=As(n==null?void 0:n.signal);if(i.signal.aborted)throw new Ut("Transaction sending was aborted");this.checkConnection(),lQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=jZ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(rp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(rp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),rp.parseAndThrowError(l);const d=rp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new Z0;const n=As(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Ut("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=rQ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Fo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&UZ(e)?r=new xi(this.dappSettings.storage,e.jsBridgeKey):r=new dh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new Ut("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=zZ.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),Sn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof X0||r instanceof J0)throw Fo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new Z0}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}ph.walletsList=new Bb,ph.isWalletInjected=t=>xi.isWalletInjected(t),ph.isInsideWalletBrowser=t=>xi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function Fb(t){const{children:e,onClick:r}=t;return ge.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function K7(t){const{wallet:e,connector:r,loading:n}=t,i=Ee.useRef(null),s=Ee.useRef(),[o,a]=Ee.useState(),[u,l]=Ee.useState(),[d,p]=Ee.useState("connect"),[y,A]=Ee.useState(!1),[P,N]=Ee.useState();function D(z){var ue;(ue=s.current)==null||ue.update({data:z})}async function k(){A(!0);try{a("");const z=await va.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ue=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:z}});if(!ue)return;N(ue),D(ue),l(z)}}catch(z){a(z.message)}A(!1)}function B(){s.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function q(){r.connect(e,{request:{tonProof:u}})}function j(){if("deepLink"in e){if(!e.deepLink||!P)return;const z=new URL(P),ue=`${e.deepLink}${z.search}`;window.open(ue)}}function H(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(P)}const J=Ee.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),T=Ee.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Ee.useEffect(()=>{B(),k()},[]),ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-text-center xc-mb-6",children:[ge.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[ge.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),ge.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?ge.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):ge.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),ge.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),ge.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&ge.jsx(vc,{className:"xc-animate-spin"}),!y&&!n&&ge.jsxs(ge.Fragment,{children:[W7(e)&&ge.jsxs(Fb,{onClick:q,children:[ge.jsx(BK,{className:"xc-opacity-80"}),"Extension"]}),J&&ge.jsxs(Fb,{onClick:j,children:[ge.jsx(l8,{className:"xc-opacity-80"}),"Desktop"]}),T&&ge.jsx(Fb,{onClick:H,children:"Telegram Mini App"})]})]})]})}function MQ(t){const[e,r]=Ee.useState(""),[n,i]=Ee.useState(),[s,o]=Ee.useState(),a=Cb(),[u,l]=Ee.useState(!1);async function d(y){var P,N;if(!y||!((P=y.connectItems)!=null&&P.tonProof))return;l(!0);const A=await va.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(N=y.connectItems)==null?void 0:N.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(A.data),l(!1)}Ee.useEffect(()=>{const y=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),A=y.onStatusChange(d);return o(y),r("select"),A},[]);function p(y){r("connect"),i(y)}return ge.jsxs(Ss,{children:[e==="select"&&ge.jsx(T7,{connector:s,onSelect:p,onBack:t.onBack}),e==="connect"&&ge.jsx(K7,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function V7(t){const{children:e,className:r}=t,n=Ee.useRef(null),[i,s]=Ee.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Ee.useEffect(()=>{console.log("maxHeight",i)},[i]),ge.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function IQ(){return ge.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ge.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),ge.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function G7(t){const{wallets:e}=Kl(),[r,n]=Ee.useState(),i=Ee.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[ge.jsx(h8,{className:"xc-shrink-0 xc-opacity-50"}),ge.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),ge.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>ge.jsx(Ab,{wallet:a,onClick:s},`feature-${a.key}`)):ge.jsx(IQ,{})})]})}function CQ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Ee.useState(""),[l,d]=Ee.useState(null),[p,y]=Ee.useState("");function A(k){d(k),u("evm-wallet")}function P(k){u("email"),y(k)}async function N(k){await e(k)}function D(){u("ton-wallet")}return Ee.useEffect(()=>{u("index")},[]),ge.jsx(GX,{config:t.config,children:ge.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&ge.jsx(TZ,{onBack:()=>u("index"),onLogin:N,wallet:l}),a==="ton-wallet"&&ge.jsx(MQ,{onBack:()=>u("index"),onLogin:N}),a==="email"&&ge.jsx(uZ,{email:p,onBack:()=>u("index"),onLogin:N}),a==="index"&&ge.jsx(f7,{header:r,onEmailConfirm:P,onSelectWallet:A,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&ge.jsx(G7,{onBack:()=>u("index"),onSelectWallet:A})]})})}function TQ(t){const{wallet:e,onConnect:r}=t,[n,i]=Ee.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&ge.jsx(M7,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&ge.jsx(I7,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&ge.jsx(C7,{wallet:e})]})}function RQ(t){const{email:e}=t,[r,n]=Ee.useState("captcha");return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),r==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>n("verify-email")}),r==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:t.onInputCode,onResendCode:()=>n("captcha")})]})}function DQ(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Ee.useState(""),[a,u]=Ee.useState(),[l,d]=Ee.useState(),p=Ee.useRef(),[y,A]=Ee.useState("");function P(j){u(j),o("evm-wallet-connect")}function N(j){A(j),o("email-connect")}async function D(j,H){await(e==null?void 0:e({chain_type:"eip155",client:j.client,connect_info:H,wallet:j})),o("index")}async function k(j,H){await(n==null?void 0:n(j,H))}function B(j){d(j),o("ton-wallet-connect")}async function q(j){j&&await(r==null?void 0:r({chain_type:"ton",client:p.current,connect_info:j,wallet:j}))}return Ee.useEffect(()=>{p.current=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const j=p.current.onStatusChange(q);return o("index"),j},[]),ge.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&ge.jsx(G7,{onBack:()=>o("index"),onSelectWallet:P}),s==="evm-wallet-connect"&&ge.jsx(TQ,{onBack:()=>o("index"),onConnect:D,wallet:a}),s==="ton-wallet-select"&&ge.jsx(T7,{connector:p.current,onSelect:B,onBack:()=>o("index")}),s==="ton-wallet-connect"&&ge.jsx(K7,{connector:p.current,wallet:l,onBack:()=>o("index")}),s==="email-connect"&&ge.jsx(RQ,{email:y,onBack:()=>o("index"),onInputCode:k}),s==="index"&&ge.jsx(f7,{onEmailConfirm:N,onSelectWallet:P,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Mn.CodattaConnect=DQ,Mn.CodattaConnectContextProvider=CK,Mn.CodattaSignin=CQ,Mn.WalletItem=ru,Mn.coinbaseWallet=a8,Mn.useCodattaConnectContext=Kl,Object.defineProperty(Mn,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/main-C4Op-TDI.js b/dist/main-BN1nTxTF.js similarity index 90% rename from dist/main-C4Op-TDI.js rename to dist/main-BN1nTxTF.js index 3d459c5..a307580 100644 --- a/dist/main-C4Op-TDI.js +++ b/dist/main-BN1nTxTF.js @@ -2,13 +2,13 @@ var NR = Object.defineProperty; var LR = (t, e, r) => e in t ? NR(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; var Ds = (t, e, r) => LR(t, typeof e != "symbol" ? e + "" : e, r); import * as Gt from "react"; -import gv, { createContext as Sa, useContext as Tn, useState as Yt, useEffect as Dn, forwardRef as mv, createElement as qd, useId as vv, useCallback as bv, Component as kR, useLayoutEffect as $R, useRef as Zn, useInsertionEffect as y5, useMemo as wi, Fragment as w5, Children as BR, isValidElement as FR } from "react"; +import mv, { createContext as Sa, useContext as Tn, useState as Yt, useEffect as Dn, forwardRef as vv, createElement as qd, useId as bv, useCallback as yv, Component as kR, useLayoutEffect as $R, useRef as Zn, useInsertionEffect as w5, useMemo as ci, Fragment as x5, Children as BR, isValidElement as FR } from "react"; import "https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"; var gn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function ts(t) { return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; } -function yv(t) { +function wv(t) { if (t.__esModule) return t; var e = t.default; if (typeof e == "function") { @@ -37,11 +37,11 @@ var Ym = { exports: {} }, gf = {}; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -var p2; +var g2; function jR() { - if (p2) return gf; - p2 = 1; - var t = gv, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 }; + if (g2) return gf; + g2 = 1; + var t = mv, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 }; function o(a, u, l) { var d, p = {}, w = null, A = null; l !== void 0 && (w = "" + l), u.key !== void 0 && (w = "" + u.key), u.ref !== void 0 && (A = u.ref); @@ -61,18 +61,18 @@ var mf = {}; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -var g2; +var m2; function UR() { - return g2 || (g2 = 1, process.env.NODE_ENV !== "production" && function() { - var t = gv, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), a = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), M = Symbol.iterator, N = "@@iterator"; + return m2 || (m2 = 1, process.env.NODE_ENV !== "production" && function() { + var t = mv, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), a = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), M = Symbol.iterator, N = "@@iterator"; function L(j) { if (j === null || typeof j != "object") return null; var se = M && j[M] || j[N]; return typeof se == "function" ? se : null; } - var B = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - function $(j) { + var $ = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + function B(j) { { for (var se = arguments.length, he = new Array(se > 1 ? se - 1 : 0), xe = 1; xe < se; xe++) he[xe - 1] = arguments[xe]; @@ -81,7 +81,7 @@ function UR() { } function H(j, se, he) { { - var xe = B.ReactDebugCurrentFrame, Te = xe.getStackAddendum(); + var xe = $.ReactDebugCurrentFrame, Te = xe.getStackAddendum(); Te !== "" && (se += "%s", he = he.concat([Te])); var Re = he.map(function(nt) { return String(nt); @@ -89,10 +89,10 @@ function UR() { Re.unshift("Warning: " + se), Function.prototype.apply.call(console[j], console, Re); } } - var W = !1, V = !1, te = !1, R = !1, K = !1, ge; + var U = !1, V = !1, te = !1, R = !1, K = !1, ge; ge = Symbol.for("react.module.reference"); function Ee(j) { - return !!(typeof j == "string" || typeof j == "function" || j === n || j === s || K || j === i || j === l || j === d || R || j === A || W || V || te || typeof j == "object" && j !== null && (j.$$typeof === w || j.$$typeof === p || j.$$typeof === o || j.$$typeof === a || j.$$typeof === u || // This needs to include all possible module reference object + return !!(typeof j == "string" || typeof j == "function" || j === n || j === s || K || j === i || j === l || j === d || R || j === A || U || V || te || typeof j == "object" && j !== null && (j.$$typeof === w || j.$$typeof === p || j.$$typeof === o || j.$$typeof === a || j.$$typeof === u || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. @@ -111,7 +111,7 @@ function UR() { function m(j) { if (j == null) return null; - if (typeof j.tag == "number" && $("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof j == "function") + if (typeof j.tag == "number" && B("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof j == "function") return j.displayName || j.name || null; if (typeof j == "string") return j; @@ -212,10 +212,10 @@ function UR() { }) }); } - g < 0 && $("disabledDepth fell below zero. This is a bug in React. Please file an issue."); + g < 0 && B("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } - var oe = B.ReactCurrentDispatcher, Z; + var oe = $.ReactCurrentDispatcher, Z; function J(j, se, he) { { if (Z === void 0) @@ -341,7 +341,7 @@ function UR() { } return ""; } - var ve = Object.prototype.hasOwnProperty, Pe = {}, De = B.ReactDebugCurrentFrame; + var ve = Object.prototype.hasOwnProperty, Pe = {}, De = $.ReactDebugCurrentFrame; function Ce(j) { if (j) { var se = j._owner, he = ue(j.type, j._source, se ? se.type : null); @@ -364,7 +364,7 @@ function UR() { } catch (it) { je = it; } - je && !(je instanceof Error) && (Ce(Te), $("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", xe || "React class", he, nt, typeof je), Ce(null)), je instanceof Error && !(je.message in Pe) && (Pe[je.message] = !0, Ce(Te), $("Failed %s type: %s", he, je.message), Ce(null)); + je && !(je instanceof Error) && (Ce(Te), B("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", xe || "React class", he, nt, typeof je), Ce(null)), je instanceof Error && !(je.message in Pe) && (Pe[je.message] = !0, Ce(Te), B("Failed %s type: %s", he, je.message), Ce(null)); } } } @@ -390,9 +390,9 @@ function UR() { } function ze(j) { if (Le(j)) - return $("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(j)), qe(j); + return B("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(j)), qe(j); } - var _e = B.ReactCurrentOwner, Ze = { + var _e = $.ReactCurrentOwner, Ze = { key: !0, ref: !0, __self: !0, @@ -418,13 +418,13 @@ function UR() { function dt(j, se) { if (typeof j.ref == "string" && _e.current && se && _e.current.stateNode !== se) { var he = m(_e.current.type); - Qe[he] || ($('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', m(_e.current.type), j.ref), Qe[he] = !0); + Qe[he] || (B('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', m(_e.current.type), j.ref), Qe[he] = !0); } } function lt(j, se) { { var he = function() { - at || (at = !0, $("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); + at || (at = !0, B("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); }; he.isReactWarning = !0, Object.defineProperty(j, "key", { get: he, @@ -435,7 +435,7 @@ function UR() { function ct(j, se) { { var he = function() { - ke || (ke = !0, $("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); + ke || (ke = !0, B("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); }; he.isReactWarning = !0, Object.defineProperty(j, "ref", { get: he, @@ -490,7 +490,7 @@ function UR() { return qt(j, je, pt, Te, xe, _e.current, nt); } } - var Et = B.ReactCurrentOwner, er = B.ReactDebugCurrentFrame; + var Et = $.ReactCurrentOwner, er = $.ReactDebugCurrentFrame; function Xt(j) { if (j) { var se = j._owner, he = ue(j.type, j._source, se ? se.type : null); @@ -541,7 +541,7 @@ Check the top-level render call using <` + he + ">."); return; Rt[he] = !0; var xe = ""; - j && j._owner && j._owner !== Et.current && (xe = " It was passed a child from " + m(j._owner.type) + "."), Xt(j), $('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', he, xe), Xt(null); + j && j._owner && j._owner !== Et.current && (xe = " It was passed a child from " + m(j._owner.type) + "."), Xt(j), B('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', he, xe), Xt(null); } } function $t(j, se) { @@ -583,9 +583,9 @@ Check the top-level render call using <` + he + ">."); } else if (se.PropTypes !== void 0 && !Dt) { Dt = !0; var Te = m(se); - $("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Te || "Unknown"); + B("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Te || "Unknown"); } - typeof se.getDefaultProps == "function" && !se.getDefaultProps.isReactClassApproved && $("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); + typeof se.getDefaultProps == "function" && !se.getDefaultProps.isReactClassApproved && B("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function rt(j) { @@ -593,11 +593,11 @@ Check the top-level render call using <` + he + ">."); for (var se = Object.keys(j.props), he = 0; he < se.length; he++) { var xe = se[he]; if (xe !== "children" && xe !== "key") { - Xt(j), $("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", xe), Xt(null); + Xt(j), B("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", xe), Xt(null); break; } } - j.ref !== null && (Xt(j), $("Invalid attribute `ref` supplied to `React.Fragment`."), Xt(null)); + j.ref !== null && (Xt(j), B("Invalid attribute `ref` supplied to `React.Fragment`."), Xt(null)); } } var Bt = {}; @@ -610,7 +610,7 @@ Check the top-level render call using <` + he + ">."); var pt = gt(); pt ? je += pt : je += Ct(); var it; - j === null ? it = "null" : Ne(j) ? it = "array" : j !== void 0 && j.$$typeof === e ? (it = "<" + (m(j.type) || "Unknown") + " />", je = " Did you accidentally export a JSX literal instead of a component?") : it = typeof j, $("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", it, je); + j === null ? it = "null" : Ne(j) ? it = "array" : j !== void 0 && j.$$typeof === e ? (it = "<" + (m(j.type) || "Unknown") + " />", je = " Did you accidentally export a JSX literal instead of a component?") : it = typeof j, B("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", it, je); } var et = Jt(j, se, he, Te, Re); if (et == null) @@ -624,7 +624,7 @@ Check the top-level render call using <` + he + ">."); $t(St[Tt], j); Object.freeze && Object.freeze(St); } else - $("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); + B("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else $t(St, j); } @@ -634,7 +634,7 @@ Check the top-level render call using <` + he + ">."); }), ht = _t.length > 0 ? "{key: someKey, " + _t.join(": ..., ") + ": ...}" : "{key: someKey}"; if (!Bt[At + ht]) { var xt = _t.length > 0 ? "{" + _t.join(": ..., ") + ": ...}" : "{}"; - $(`A props object containing a "key" prop is being spread into JSX: + B(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: @@ -645,13 +645,13 @@ React keys must be passed directly to JSX without using spread: return j === n ? rt(et) : Ft(et), et; } } - function U(j, se, he) { + function q(j, se, he) { return k(j, se, he, !0); } - function z(j, se, he) { + function W(j, se, he) { return k(j, se, he, !1); } - var C = z, G = U; + var C = W, G = q; mf.Fragment = n, mf.jsx = C, mf.jsxs = G; }()), mf; } @@ -773,17 +773,17 @@ function zR(t, e) { const r = t.exec(e); return r == null ? void 0 : r.groups; } -const m2 = /^tuple(?(\[(\d*)\])*)$/; +const v2 = /^tuple(?(\[(\d*)\])*)$/; function Jm(t) { let e = t.type; - if (m2.test(t.type) && "components" in t) { + if (v2.test(t.type) && "components" in t) { e = "("; const r = t.components.length; for (let i = 0; i < r; i++) { const s = t.components[i]; e += Jm(s), i < r - 1 && (e += ", "); } - const n = zR(m2, t.type); + const n = zR(v2, t.type); return e += `)${(n == null ? void 0 : n.array) ?? ""}`, Jm({ ...t, type: e @@ -803,7 +803,7 @@ function vf(t) { function WR(t) { return t.type === "function" ? `function ${t.name}(${vf(t.inputs)})${t.stateMutability && t.stateMutability !== "nonpayable" ? ` ${t.stateMutability}` : ""}${t.outputs.length ? ` returns (${vf(t.outputs)})` : ""}` : t.type === "event" ? `event ${t.name}(${vf(t.inputs)})` : t.type === "error" ? `error ${t.name}(${vf(t.inputs)})` : t.type === "constructor" ? `constructor(${vf(t.inputs)})${t.stateMutability === "payable" ? " payable" : ""}` : t.type === "fallback" ? "fallback()" : "receive() external payable"; } -function bi(t, e, r) { +function yi(t, e, r) { const n = t[e.name]; if (typeof n == "function") return n; @@ -813,13 +813,13 @@ function bi(t, e, r) { function vu(t, { includeName: e = !1 } = {}) { if (t.type !== "function" && t.type !== "event" && t.type !== "error") throw new rD(t.type); - return `${t.name}(${wv(t.inputs, { includeName: e })})`; + return `${t.name}(${xv(t.inputs, { includeName: e })})`; } -function wv(t, { includeName: e = !1 } = {}) { +function xv(t, { includeName: e = !1 } = {}) { return t ? t.map((r) => HR(r, { includeName: e })).join(e ? ", " : ",") : ""; } function HR(t, { includeName: e }) { - return t.type.startsWith("tuple") ? `(${wv(t.components, { includeName: e })})${t.type.slice(5)}` : t.type + (e && t.name ? ` ${t.name}` : ""); + return t.type.startsWith("tuple") ? `(${xv(t.components, { includeName: e })})${t.type.slice(5)}` : t.type + (e && t.name ? ` ${t.name}` : ""); } function va(t, { strict: e = !0 } = {}) { return !t || typeof t != "string" ? !1 : e ? /^0x[0-9a-fA-F]*$/.test(t) : t.startsWith("0x"); @@ -827,10 +827,10 @@ function va(t, { strict: e = !0 } = {}) { function An(t) { return va(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length; } -const x5 = "2.21.45"; +const _5 = "2.21.45"; let bf = { getDocsUrl: ({ docsBaseUrl: t, docsPath: e = "", docsSlug: r }) => e ? `${t ?? "https://viem.sh"}${e}${r ? `#${r}` : ""}` : void 0, - version: `viem@${x5}` + version: `viem@${_5}` }; class yt extends Error { constructor(e, r = {}) { @@ -877,14 +877,14 @@ class yt extends Error { configurable: !0, writable: !0, value: "BaseError" - }), this.details = n, this.docsPath = i, this.metaMessages = r.metaMessages, this.name = r.name ?? this.name, this.shortMessage = e, this.version = x5; + }), this.details = n, this.docsPath = i, this.metaMessages = r.metaMessages, this.name = r.name ?? this.name, this.shortMessage = e, this.version = _5; } walk(e) { - return _5(this, e); + return E5(this, e); } } -function _5(t, e) { - return e != null && e(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ? _5(t.cause, e) : e ? null : t; +function E5(t, e) { + return e != null && e(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ? E5(t.cause, e) : e ? null : t; } class KR extends yt { constructor({ docsPath: e }) { @@ -898,7 +898,7 @@ class KR extends yt { }); } } -class v2 extends yt { +class b2 extends yt { constructor({ docsPath: e }) { super([ "Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.", @@ -915,7 +915,7 @@ class VR extends yt { super([`Data size of ${n} bytes is too small for given parameters.`].join(` `), { metaMessages: [ - `Params: (${wv(r, { includeName: !0 })})`, + `Params: (${xv(r, { includeName: !0 })})`, `Data: ${e} (${n} bytes)` ], name: "AbiDecodingDataSizeTooSmallError" @@ -937,7 +937,7 @@ class VR extends yt { }), this.data = e, this.params = r, this.size = n; } } -class xv extends yt { +class _v extends yt { constructor() { super('Cannot decode zero data ("0x") with ABI parameters.', { name: "AbiDecodingZeroDataError" @@ -969,7 +969,7 @@ class JR extends yt { `), { name: "AbiEncodingLengthMismatchError" }); } } -class E5 extends yt { +class S5 extends yt { constructor(e, { docsPath: r }) { super([ `Encoded error signature "${e}" not found on ABI.`, @@ -987,7 +987,7 @@ class E5 extends yt { }), this.signature = e; } } -class b2 extends yt { +class y2 extends yt { constructor(e, { docsPath: r } = {}) { super([ `Function ${e ? `"${e}" ` : ""}not found on ABI.`, @@ -1055,17 +1055,17 @@ class rD extends yt { `), { name: "InvalidDefinitionTypeError" }); } } -class S5 extends yt { +class A5 extends yt { constructor({ offset: e, position: r, size: n }) { super(`Slice ${r === "start" ? "starting" : "ending"} at offset "${e}" is out-of-bounds (size: ${n}).`, { name: "SliceOffsetOutOfBoundsError" }); } } -class A5 extends yt { +class P5 extends yt { constructor({ size: e, targetSize: r, type: n }) { super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`, { name: "SizeExceedsPaddingSizeError" }); } } -class y2 extends yt { +class w2 extends yt { constructor({ size: e, targetSize: r, type: n }) { super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`, { name: "InvalidBytesLengthError" }); } @@ -1078,7 +1078,7 @@ function ma(t, { dir: e, size: r = 32 } = {}) { return t; const n = t.replace("0x", ""); if (n.length > r * 2) - throw new A5({ + throw new P5({ size: Math.ceil(n.length / 2), targetSize: r, type: "hex" @@ -1089,7 +1089,7 @@ function nD(t, { dir: e, size: r = 32 } = {}) { if (r === null) return t; if (t.length > r) - throw new A5({ + throw new P5({ size: t.length, targetSize: r, type: "bytes" @@ -1118,7 +1118,7 @@ class oD extends yt { super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" }); } } -function _v(t, { dir: e = "left" } = {}) { +function Ev(t, { dir: e = "left" } = {}) { let r = typeof t == "string" ? t.replace("0x", "") : t, n = 0; for (let i = 0; i < r.length - 1 && r[e === "left" ? i : r.length - i - 1].toString() === "0"; i++) n++; @@ -1145,9 +1145,9 @@ function bu(t, e = {}) { } const aD = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); function zd(t, e = {}) { - return typeof t == "number" || typeof t == "bigint" ? Mr(t, e) : typeof t == "string" ? I0(t, e) : typeof t == "boolean" ? P5(t, e) : xi(t, e); + return typeof t == "number" || typeof t == "bigint" ? Mr(t, e) : typeof t == "string" ? I0(t, e) : typeof t == "boolean" ? M5(t, e) : xi(t, e); } -function P5(t, e = {}) { +function M5(t, e = {}) { const r = `0x${Number(t)}`; return typeof e.size == "number" ? (to(r, { size: e.size }), Tu(r, { size: e.size })) : r; } @@ -1182,8 +1182,8 @@ function I0(t, e = {}) { return xi(r, e); } const uD = /* @__PURE__ */ new TextEncoder(); -function Ev(t, e = {}) { - return typeof t == "number" || typeof t == "bigint" ? lD(t, e) : typeof t == "boolean" ? fD(t, e) : va(t) ? Lo(t, e) : M5(t, e); +function Sv(t, e = {}) { + return typeof t == "number" || typeof t == "bigint" ? lD(t, e) : typeof t == "boolean" ? fD(t, e) : va(t) ? Lo(t, e) : I5(t, e); } function fD(t, e = {}) { const r = new Uint8Array(1); @@ -1197,7 +1197,7 @@ const go = { a: 97, f: 102 }; -function w2(t) { +function x2(t) { if (t >= go.zero && t <= go.nine) return t - go.zero; if (t >= go.A && t <= go.F) @@ -1212,7 +1212,7 @@ function Lo(t, e = {}) { n.length % 2 && (n = `0${n}`); const i = n.length / 2, s = new Uint8Array(i); for (let o = 0, a = 0; o < i; o++) { - const u = w2(n.charCodeAt(a++)), l = w2(n.charCodeAt(a++)); + const u = x2(n.charCodeAt(a++)), l = x2(n.charCodeAt(a++)); if (u === void 0 || l === void 0) throw new yt(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`); s[o] = u * 16 + l; @@ -1223,7 +1223,7 @@ function lD(t, e) { const r = Mr(t, e); return Lo(r); } -function M5(t, e = {}) { +function I5(t, e = {}) { const r = uD.encode(t); return typeof e.size == "number" ? (to(r, { size: e.size }), Tu(r, { dir: "right", size: e.size })) : r; } @@ -1251,15 +1251,15 @@ function Hd(t, e = !0) { if (e && t.finished) throw new Error("Hash#digest() has already been called"); } -function I5(t, e) { +function C5(t, e) { Ll(t); const r = e.outputLen; if (t.length < r) throw new Error(`digestInto() expects output buffer of length at least ${r}`); } -const rd = /* @__PURE__ */ BigInt(2 ** 32 - 1), x2 = /* @__PURE__ */ BigInt(32); +const rd = /* @__PURE__ */ BigInt(2 ** 32 - 1), _2 = /* @__PURE__ */ BigInt(32); function dD(t, e = !1) { - return e ? { h: Number(t & rd), l: Number(t >> x2 & rd) } : { h: Number(t >> x2 & rd) | 0, l: Number(t & rd) | 0 }; + return e ? { h: Number(t & rd), l: Number(t >> _2 & rd) } : { h: Number(t >> _2 & rd) | 0, l: Number(t & rd) | 0 }; } function pD(t, e = !1) { let r = new Uint32Array(t.length), n = new Uint32Array(t.length); @@ -1271,8 +1271,8 @@ function pD(t, e = !1) { } const gD = (t, e, r) => t << r | e >>> 32 - r, mD = (t, e, r) => e << r | t >>> 32 - r, vD = (t, e, r) => e << r - 32 | t >>> 64 - r, bD = (t, e, r) => t << r - 32 | e >>> 64 - r, qc = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0; /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -const yD = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), Bg = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), Ns = (t, e) => t << 32 - e | t >>> e, _2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, wD = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255; -function E2(t) { +const yD = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), Bg = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), Ns = (t, e) => t << 32 - e | t >>> e, E2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, wD = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255; +function S2(t) { for (let e = 0; e < t.length; e++) t[e] = wD(t[e]); } @@ -1305,13 +1305,13 @@ function mse(...t) { } return r; } -class C5 { +class T5 { // Safe version that clones internal state clone() { return this._cloneInto(); } } -function T5(t) { +function R5(t) { const e = (n) => t().update(C0(n)).digest(), r = t(); return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = () => t(), e; } @@ -1326,28 +1326,28 @@ function vse(t = 32) { return qc.randomBytes(t); throw new Error("crypto.getRandomValues must be defined"); } -const R5 = [], D5 = [], O5 = [], AD = /* @__PURE__ */ BigInt(0), yf = /* @__PURE__ */ BigInt(1), PD = /* @__PURE__ */ BigInt(2), MD = /* @__PURE__ */ BigInt(7), ID = /* @__PURE__ */ BigInt(256), CD = /* @__PURE__ */ BigInt(113); +const D5 = [], O5 = [], N5 = [], AD = /* @__PURE__ */ BigInt(0), yf = /* @__PURE__ */ BigInt(1), PD = /* @__PURE__ */ BigInt(2), MD = /* @__PURE__ */ BigInt(7), ID = /* @__PURE__ */ BigInt(256), CD = /* @__PURE__ */ BigInt(113); for (let t = 0, e = yf, r = 1, n = 0; t < 24; t++) { - [r, n] = [n, (2 * r + 3 * n) % 5], R5.push(2 * (5 * n + r)), D5.push((t + 1) * (t + 2) / 2 % 64); + [r, n] = [n, (2 * r + 3 * n) % 5], D5.push(2 * (5 * n + r)), O5.push((t + 1) * (t + 2) / 2 % 64); let i = AD; for (let s = 0; s < 7; s++) e = (e << yf ^ (e >> MD) * CD) % ID, e & PD && (i ^= yf << (yf << /* @__PURE__ */ BigInt(s)) - yf); - O5.push(i); + N5.push(i); } -const [TD, RD] = /* @__PURE__ */ pD(O5, !0), S2 = (t, e, r) => r > 32 ? vD(t, e, r) : gD(t, e, r), A2 = (t, e, r) => r > 32 ? bD(t, e, r) : mD(t, e, r); -function N5(t, e = 24) { +const [TD, RD] = /* @__PURE__ */ pD(N5, !0), A2 = (t, e, r) => r > 32 ? vD(t, e, r) : gD(t, e, r), P2 = (t, e, r) => r > 32 ? bD(t, e, r) : mD(t, e, r); +function L5(t, e = 24) { const r = new Uint32Array(10); for (let n = 24 - e; n < 24; n++) { for (let o = 0; o < 10; o++) r[o] = t[o] ^ t[o + 10] ^ t[o + 20] ^ t[o + 30] ^ t[o + 40]; for (let o = 0; o < 10; o += 2) { - const a = (o + 8) % 10, u = (o + 2) % 10, l = r[u], d = r[u + 1], p = S2(l, d, 1) ^ r[a], w = A2(l, d, 1) ^ r[a + 1]; + const a = (o + 8) % 10, u = (o + 2) % 10, l = r[u], d = r[u + 1], p = A2(l, d, 1) ^ r[a], w = P2(l, d, 1) ^ r[a + 1]; for (let A = 0; A < 50; A += 10) t[o + A] ^= p, t[o + A + 1] ^= w; } let i = t[2], s = t[3]; for (let o = 0; o < 24; o++) { - const a = D5[o], u = S2(i, s, a), l = A2(i, s, a), d = R5[o]; + const a = O5[o], u = A2(i, s, a), l = P2(i, s, a), d = D5[o]; i = t[d], s = t[d + 1], t[d] = u, t[d + 1] = l; } for (let o = 0; o < 50; o += 10) { @@ -1360,7 +1360,7 @@ function N5(t, e = 24) { } r.fill(0); } -class kl extends C5 { +class kl extends T5 { // NOTE: we accept arguments in bytes instead of bits here. constructor(e, r, n, i = !1, s = 24) { if (super(), this.blockLen = e, this.suffix = r, this.outputLen = n, this.enableXOF = i, this.rounds = s, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, Wd(n), 0 >= this.blockLen || this.blockLen >= 200) @@ -1368,7 +1368,7 @@ class kl extends C5 { this.state = new Uint8Array(200), this.state32 = yD(this.state); } keccak() { - _2 || E2(this.state32), N5(this.state32, this.rounds), _2 || E2(this.state32), this.posOut = 0, this.pos = 0; + E2 || S2(this.state32), L5(this.state32, this.rounds), E2 || S2(this.state32), this.posOut = 0, this.pos = 0; } update(e) { Hd(this); @@ -1409,7 +1409,7 @@ class kl extends C5 { return Wd(e), this.xofInto(new Uint8Array(e)); } digestInto(e) { - if (I5(e, this), this.finished) + if (C5(e, this), this.finished) throw new Error("digest() was already called"); return this.writeInto(e), this.destroy(), e; } @@ -1424,12 +1424,12 @@ class kl extends C5 { return e || (e = new kl(r, n, i, o, s)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = s, e.suffix = n, e.outputLen = i, e.enableXOF = o, e.destroyed = this.destroyed, e; } } -const Aa = (t, e, r) => T5(() => new kl(e, t, r)), DD = /* @__PURE__ */ Aa(6, 144, 224 / 8), OD = /* @__PURE__ */ Aa(6, 136, 256 / 8), ND = /* @__PURE__ */ Aa(6, 104, 384 / 8), LD = /* @__PURE__ */ Aa(6, 72, 512 / 8), kD = /* @__PURE__ */ Aa(1, 144, 224 / 8), L5 = /* @__PURE__ */ Aa(1, 136, 256 / 8), $D = /* @__PURE__ */ Aa(1, 104, 384 / 8), BD = /* @__PURE__ */ Aa(1, 72, 512 / 8), k5 = (t, e, r) => SD((n = {}) => new kl(e, t, n.dkLen === void 0 ? r : n.dkLen, !0)), FD = /* @__PURE__ */ k5(31, 168, 128 / 8), jD = /* @__PURE__ */ k5(31, 136, 256 / 8), UD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +const Aa = (t, e, r) => R5(() => new kl(e, t, r)), DD = /* @__PURE__ */ Aa(6, 144, 224 / 8), OD = /* @__PURE__ */ Aa(6, 136, 256 / 8), ND = /* @__PURE__ */ Aa(6, 104, 384 / 8), LD = /* @__PURE__ */ Aa(6, 72, 512 / 8), kD = /* @__PURE__ */ Aa(1, 144, 224 / 8), k5 = /* @__PURE__ */ Aa(1, 136, 256 / 8), $D = /* @__PURE__ */ Aa(1, 104, 384 / 8), BD = /* @__PURE__ */ Aa(1, 72, 512 / 8), $5 = (t, e, r) => SD((n = {}) => new kl(e, t, n.dkLen === void 0 ? r : n.dkLen, !0)), FD = /* @__PURE__ */ $5(31, 168, 128 / 8), jD = /* @__PURE__ */ $5(31, 136, 256 / 8), UD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, Keccak: kl, - keccakP: N5, + keccakP: L5, keccak_224: kD, - keccak_256: L5, + keccak_256: k5, keccak_384: $D, keccak_512: BD, sha3_224: DD, @@ -1440,10 +1440,10 @@ const Aa = (t, e, r) => T5(() => new kl(e, t, r)), DD = /* @__PURE__ */ Aa(6, 14 shake256: jD }, Symbol.toStringTag, { value: "Module" })); function $l(t, e) { - const r = e || "hex", n = L5(va(t, { strict: !1 }) ? Ev(t) : t); + const r = e || "hex", n = k5(va(t, { strict: !1 }) ? Sv(t) : t); return r === "bytes" ? n : zd(n); } -const qD = (t) => $l(Ev(t)); +const qD = (t) => $l(Sv(t)); function zD(t) { return qD(t); } @@ -1476,10 +1476,10 @@ const HD = (t) => { const e = typeof t == "string" ? t : WR(t); return WD(e); }; -function $5(t) { +function B5(t) { return zD(HD(t)); } -const KD = $5; +const KD = B5; class yu extends yt { constructor({ address: e }) { super(`Address "${e}" is invalid.`, { @@ -1516,13 +1516,13 @@ const Fg = /* @__PURE__ */ new T0(8192); function Bl(t, e) { if (Fg.has(`${t}.${e}`)) return Fg.get(`${t}.${e}`); - const r = t.substring(2).toLowerCase(), n = $l(M5(r), "bytes"), i = r.split(""); + const r = t.substring(2).toLowerCase(), n = $l(I5(r), "bytes"), i = r.split(""); for (let o = 0; o < 40; o += 2) n[o >> 1] >> 4 >= 8 && i[o] && (i[o] = i[o].toUpperCase()), (n[o >> 1] & 15) >= 8 && i[o + 1] && (i[o + 1] = i[o + 1].toUpperCase()); const s = `0x${i.join("")}`; return Fg.set(`${t}.${e}`, s), s; } -function Sv(t, e) { +function Av(t, e) { if (!ko(t, { strict: !1 })) throw new yu({ address: t }); return Bl(t, e); @@ -1554,37 +1554,37 @@ function R0(t) { function Kd(t, e, r, { strict: n } = {}) { return va(t, { strict: !1 }) ? YD(t, e, r, { strict: n - }) : j5(t, e, r, { + }) : U5(t, e, r, { strict: n }); } -function B5(t, e) { +function F5(t, e) { if (typeof e == "number" && e > 0 && e > An(t) - 1) - throw new S5({ + throw new A5({ offset: e, position: "start", size: An(t) }); } -function F5(t, e, r) { +function j5(t, e, r) { if (typeof e == "number" && typeof r == "number" && An(t) !== r - e) - throw new S5({ + throw new A5({ offset: r, position: "end", size: An(t) }); } -function j5(t, e, r, { strict: n } = {}) { - B5(t, e); +function U5(t, e, r, { strict: n } = {}) { + F5(t, e); const i = t.slice(e, r); - return n && F5(i, e, r), i; + return n && j5(i, e, r), i; } function YD(t, e, r, { strict: n } = {}) { - B5(t, e); + F5(t, e); const i = `0x${t.replace("0x", "").slice((e ?? 0) * 2, (r ?? t.length) * 2)}`; - return n && F5(i, e, r), i; + return n && j5(i, e, r), i; } -function U5(t, e) { +function q5(t, e) { if (t.length !== e.length) throw new JR({ expectedLength: t.length, @@ -1593,17 +1593,17 @@ function U5(t, e) { const r = JD({ params: t, values: e - }), n = Pv(r); + }), n = Mv(r); return n.length === 0 ? "0x" : n; } function JD({ params: t, values: e }) { const r = []; for (let n = 0; n < t.length; n++) - r.push(Av({ param: t[n], value: e[n] })); + r.push(Pv({ param: t[n], value: e[n] })); return r; } -function Av({ param: t, value: e }) { - const r = Mv(t.type); +function Pv({ param: t, value: e }) { + const r = Iv(t.type); if (r) { const [n, i] = r; return ZD(e, { length: n, param: { ...t, type: i } }); @@ -1628,7 +1628,7 @@ function Av({ param: t, value: e }) { docsPath: "/docs/contract/encodeAbiParameters" }); } -function Pv(t) { +function Mv(t) { let e = 0; for (let s = 0; s < t.length; s++) { const { dynamic: o, encoded: a } = t[s]; @@ -1660,11 +1660,11 @@ function ZD(t, { length: e, param: r }) { let i = !1; const s = []; for (let o = 0; o < t.length; o++) { - const a = Av({ param: r, value: t[o] }); + const a = Pv({ param: r, value: t[o] }); a.dynamic && (i = !0), s.push(a); } if (n || i) { - const o = Pv(s); + const o = Mv(s); if (n) { const a = Mr(s.length, { size: 32 }); return { @@ -1702,7 +1702,7 @@ function QD(t, { param: e }) { function eO(t) { if (typeof t != "boolean") throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`); - return { dynamic: !1, encoded: ma(P5(t)) }; + return { dynamic: !1, encoded: ma(M5(t)) }; } function tO(t, { signed: e }) { return { @@ -1731,7 +1731,7 @@ function nO(t, { param: e }) { let r = !1; const n = []; for (let i = 0; i < e.components.length; i++) { - const s = e.components[i], o = Array.isArray(t) ? i : s.name, a = Av({ + const s = e.components[i], o = Array.isArray(t) ? i : s.name, a = Pv({ param: s, value: t[o] }); @@ -1739,19 +1739,19 @@ function nO(t, { param: e }) { } return { dynamic: r, - encoded: r ? Pv(n) : wu(n.map(({ encoded: i }) => i)) + encoded: r ? Mv(n) : wu(n.map(({ encoded: i }) => i)) }; } -function Mv(t) { +function Iv(t) { const e = t.match(/^(.*)\[(\d+)?\]$/); return e ? ( // Return `null` if the array is dynamic. [e[2] ? Number(e[2]) : null, e[1]] ) : void 0; } -const Iv = (t) => Kd($5(t), 0, 4); -function q5(t) { - const { abi: e, args: r = [], name: n } = t, i = va(n, { strict: !1 }), s = e.filter((a) => i ? a.type === "function" ? Iv(a) === n : a.type === "event" ? KD(a) === n : !1 : "name" in a && a.name === n); +const Cv = (t) => Kd(B5(t), 0, 4); +function z5(t) { + const { abi: e, args: r = [], name: n } = t, i = va(n, { strict: !1 }), s = e.filter((a) => i ? a.type === "function" ? Cv(a) === n : a.type === "event" ? KD(a) === n : !1 : "name" in a && a.name === n); if (s.length === 0) return; if (s.length === 1) @@ -1772,7 +1772,7 @@ function q5(t) { return p ? Xm(l, p) : !1; })) { if (o && "inputs" in o && o.inputs) { - const l = z5(a.inputs, o.inputs, r); + const l = W5(a.inputs, o.inputs, r); if (l) throw new XR({ abiItem: a, @@ -1806,11 +1806,11 @@ function Xm(t, e) { })) : !1; } } -function z5(t, e, r) { +function W5(t, e, r) { for (const n in t) { const i = t[n], s = e[n]; if (i.type === "tuple" && s.type === "tuple" && "components" in i && "components" in s) - return z5(i.components, s.components, r[n]); + return W5(i.components, s.components, r[n]); const o = [i.type, s.type]; if (o.includes("address") && o.includes("bytes20") ? !0 : o.includes("address") && o.includes("string") ? ko(r[n], { strict: !1 }) : o.includes("address") && o.includes("bytes") ? ko(r[n], { strict: !1 }) : !1) return o; @@ -1819,32 +1819,32 @@ function z5(t, e, r) { function qo(t) { return typeof t == "string" ? { address: t, type: "json-rpc" } : t; } -const P2 = "/docs/contract/encodeFunctionData"; +const M2 = "/docs/contract/encodeFunctionData"; function iO(t) { const { abi: e, args: r, functionName: n } = t; let i = e[0]; if (n) { - const s = q5({ + const s = z5({ abi: e, args: r, name: n }); if (!s) - throw new b2(n, { docsPath: P2 }); + throw new y2(n, { docsPath: M2 }); i = s; } if (i.type !== "function") - throw new b2(void 0, { docsPath: P2 }); + throw new y2(void 0, { docsPath: M2 }); return { abi: [i], - functionName: Iv(vu(i)) + functionName: Cv(vu(i)) }; } function sO(t) { const { args: e } = t, { abi: r, functionName: n } = (() => { var a; return t.abi.length === 1 && ((a = t.functionName) != null && a.startsWith("0x")) ? t : iO(t); - })(), i = r[0], s = n, o = "inputs" in i && i.inputs ? U5(i.inputs, e ?? []) : void 0; + })(), i = r[0], s = n, o = "inputs" in i && i.inputs ? q5(i.inputs, e ?? []) : void 0; return R0([s, o ?? "0x"]); } const oO = { @@ -1876,7 +1876,7 @@ const oO = { name: "Panic", type: "error" }; -class M2 extends yt { +class I2 extends yt { constructor({ offset: e }) { super(`Offset \`${e}\` cannot be negative.`, { name: "NegativeOffsetError" @@ -1916,7 +1916,7 @@ const lO = { }, decrementPosition(t) { if (t < 0) - throw new M2({ offset: t }); + throw new I2({ offset: t }); const e = this.position - t; this.assertPosition(e), this.position = e; }, @@ -1925,7 +1925,7 @@ const lO = { }, incrementPosition(t) { if (t < 0) - throw new M2({ offset: t }); + throw new I2({ offset: t }); const e = this.position + t; this.assertPosition(e), this.position = e; }, @@ -2015,7 +2015,7 @@ const lO = { this.positionReadCount.set(this.position, t + 1), t > 0 && this.recursiveReadCount++; } }; -function Cv(t, { recursiveReadLimit: e = 8192 } = {}) { +function Tv(t, { recursiveReadLimit: e = 8192 } = {}) { const r = Object.create(lO); return r.bytes = t, r.dataView = new DataView(t.buffer, t.byteOffset, t.byteLength), r.positionReadCount = /* @__PURE__ */ new Map(), r.recursiveReadLimit = e, r; } @@ -2026,7 +2026,7 @@ function hO(t, e = {}) { } function dO(t, e = {}) { let r = t; - if (typeof e.size < "u" && (to(r, { size: e.size }), r = _v(r)), r.length > 1 || r[0] > 1) + if (typeof e.size < "u" && (to(r, { size: e.size }), r = Ev(r)), r.length > 1 || r[0] > 1) throw new sD(r); return !!r[0]; } @@ -2037,12 +2037,12 @@ function Io(t, e = {}) { } function pO(t, e = {}) { let r = t; - return typeof e.size < "u" && (to(r, { size: e.size }), r = _v(r, { dir: "right" })), new TextDecoder().decode(r); + return typeof e.size < "u" && (to(r, { size: e.size }), r = Ev(r, { dir: "right" })), new TextDecoder().decode(r); } function gO(t, e) { - const r = typeof e == "string" ? Lo(e) : e, n = Cv(r); + const r = typeof e == "string" ? Lo(e) : e, n = Tv(r); if (An(r) === 0 && t.length > 0) - throw new xv(); + throw new _v(); if (An(e) && An(e) < 32) throw new VR({ data: typeof e == "string" ? e : xi(e), @@ -2062,7 +2062,7 @@ function gO(t, e) { return s; } function au(t, e, { staticPosition: r }) { - const n = Mv(e.type); + const n = Iv(e.type); if (n) { const [i, s] = n; return vO(t, { ...e, type: s }, { length: i, staticPosition: r }); @@ -2083,16 +2083,16 @@ function au(t, e, { staticPosition: r }) { docsPath: "/docs/contract/decodeAbiParameters" }); } -const I2 = 32, Zm = 32; +const C2 = 32, Zm = 32; function mO(t) { const e = t.readBytes(32); - return [Bl(xi(j5(e, -20))), 32]; + return [Bl(xi(U5(e, -20))), 32]; } function vO(t, e, { length: r, staticPosition: n }) { if (!r) { - const o = Io(t.readBytes(Zm)), a = n + o, u = a + I2; + const o = Io(t.readBytes(Zm)), a = n + o, u = a + C2; t.setPosition(a); - const l = Io(t.readBytes(I2)), d = tl(e); + const l = Io(t.readBytes(C2)), d = tl(e); let p = 0; const w = []; for (let A = 0; A < l; ++A) { @@ -2177,7 +2177,7 @@ function _O(t, { staticPosition: e }) { const i = Io(t.readBytes(32)); if (i === 0) return t.setPosition(e + 32), ["", 32]; - const s = t.readBytes(i, 32), o = pO(_v(s)); + const s = t.readBytes(i, 32), o = pO(Ev(s)); return t.setPosition(e + 32), [o, 32]; } function tl(t) { @@ -2187,16 +2187,16 @@ function tl(t) { return !0; if (e === "tuple") return (n = t.components) == null ? void 0 : n.some(tl); - const r = Mv(t.type); + const r = Iv(t.type); return !!(r && tl({ ...t, type: r[1] })); } function EO(t) { const { abi: e, data: r } = t, n = Kd(r, 0, 4); if (n === "0x") - throw new xv(); - const s = [...e || [], aO, cO].find((o) => o.type === "error" && n === Iv(vu(o))); + throw new _v(); + const s = [...e || [], aO, cO].find((o) => o.type === "error" && n === Cv(vu(o))); if (!s) - throw new E5(n, { + throw new S5(n, { docsPath: "/docs/contract/decodeErrorResult" }); return { @@ -2206,7 +2206,7 @@ function EO(t) { }; } const Ru = (t, e, r) => JSON.stringify(t, (n, i) => typeof i == "bigint" ? i.toString() : i, r); -function W5({ abiItem: t, args: e, includeFunctionName: r = !0, includeName: n = !1 }) { +function H5({ abiItem: t, args: e, includeFunctionName: r = !0, includeName: n = !1 }) { if ("name" in t && "inputs" in t && t.inputs) return `${r ? t.name : ""}(${t.inputs.map((i, s) => `${n && i.name ? `${i.name}: ` : ""}${typeof e[s] == "object" ? Ru(e[s]) : e[s]}`).join(", ")})`; } @@ -2217,7 +2217,7 @@ const SO = { ether: -9, wei: 9 }; -function H5(t, e) { +function K5(t, e) { let r = t.toString(); const n = r.startsWith("-"); n && (r = r.slice(1)), r = r.padStart(e, "0"); @@ -2227,11 +2227,11 @@ function H5(t, e) { ]; return s = s.replace(/(0+)$/, ""), `${n ? "-" : ""}${i || "0"}${s ? `.${s}` : ""}`; } -function K5(t, e = "wei") { - return H5(t, SO[e]); +function V5(t, e = "wei") { + return K5(t, SO[e]); } function Es(t, e = "wei") { - return H5(t, AO[e]); + return K5(t, AO[e]); } class PO extends yt { constructor({ address: e }) { @@ -2289,7 +2289,7 @@ class TO extends yt { chain: i && `${i == null ? void 0 : i.name} (id: ${i == null ? void 0 : i.id})`, from: r == null ? void 0 : r.address, to: p, - value: typeof w < "u" && `${K5(w)} ${((M = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : M.symbol) || "ETH"}`, + value: typeof w < "u" && `${V5(w)} ${((M = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : M.symbol) || "ETH"}`, data: s, gas: o, gasPrice: typeof a < "u" && `${Es(a)} gwei`, @@ -2314,10 +2314,10 @@ class TO extends yt { }), this.cause = e; } } -const RO = (t) => t, V5 = (t) => t; +const RO = (t) => t, G5 = (t) => t; class DO extends yt { constructor(e, { abi: r, args: n, contractAddress: i, docsPath: s, functionName: o, sender: a }) { - const u = q5({ abi: r, args: n, name: o }), l = u ? W5({ + const u = z5({ abi: r, args: n, name: o }), l = u ? H5({ abiItem: u, args: n, includeFunctionName: !1, @@ -2388,7 +2388,7 @@ class OO extends yt { const [A] = w; u = oO[A]; } else { - const A = d ? vu(d, { includeName: !0 }) : void 0, M = d && w ? W5({ + const A = d ? vu(d, { includeName: !0 }) : void 0, M = d && w ? H5({ abiItem: d, args: w, includeFunctionName: !1, @@ -2404,7 +2404,7 @@ class OO extends yt { } else i && (u = i); let l; - s instanceof E5 && (l = s.signature, a = [ + s instanceof S5 && (l = s.signature, a = [ `Unable to decode signature "${l}" as it was not found on the provided ABI.`, "Make sure you are using the correct ABI and that the error exists on it.", `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.` @@ -2462,14 +2462,14 @@ class LO extends yt { }), this.data = e; } } -class G5 extends yt { +class Y5 extends yt { constructor({ body: e, cause: r, details: n, headers: i, status: s, url: o }) { super("HTTP request failed.", { cause: r, details: n, metaMessages: [ s && `Status: ${s}`, - `URL: ${V5(o)}`, + `URL: ${G5(o)}`, e && `Request body: ${Ru(e)}` ].filter(Boolean), name: "HttpRequestError" @@ -2501,7 +2501,7 @@ class kO extends yt { super("RPC Request failed.", { cause: r, details: r.message, - metaMessages: [`URL: ${V5(n)}`, `Request body: ${Ru(e)}`], + metaMessages: [`URL: ${G5(n)}`, `Request body: ${Ru(e)}`], name: "RpcRequestError" }), Object.defineProperty(this, "code", { enumerable: !0, @@ -2830,7 +2830,7 @@ class BO extends Si { } const FO = 3; function jO(t, { abi: e, address: r, args: n, docsPath: i, functionName: s, sender: o }) { - const { code: a, data: u, message: l, shortMessage: d } = t instanceof LO ? t : t instanceof yt ? t.walk((w) => "data" in w) || t.walk() : {}, p = t instanceof xv ? new NO({ functionName: s }) : [FO, uc.code].includes(a) && (u || l || d) ? new OO({ + const { code: a, data: u, message: l, shortMessage: d } = t instanceof LO ? t : t instanceof yt ? t.walk((w) => "data" in w) || t.walk() : {}, p = t instanceof _v ? new NO({ functionName: s }) : [FO, uc.code].includes(a) && (u || l || d) ? new OO({ abi: e, data: typeof u == "object" ? u.data : u, functionName: s, @@ -2850,17 +2850,17 @@ function UO(t) { return Bl(`0x${e}`); } async function qO({ hash: t, signature: e }) { - const r = va(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-CNxaHocU.js"); + const r = va(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-DuMBhiq0.js"); return `0x${(() => { if (typeof e == "object" && "r" in e && "s" in e) { - const { r: l, s: d, v: p, yParity: w } = e, A = Number(w ?? p), M = C2(A); + const { r: l, s: d, v: p, yParity: w } = e, A = Number(w ?? p), M = T2(A); return new n.Signature(el(l), el(d)).addRecoveryBit(M); } - const o = va(e) ? e : zd(e), a = bu(`0x${o.slice(130)}`), u = C2(a); + const o = va(e) ? e : zd(e), a = bu(`0x${o.slice(130)}`), u = T2(a); return n.Signature.fromCompact(o.substring(2, 130)).addRecoveryBit(u); })().recoverPublicKey(r.substring(2)).toHex(!1)}`; } -function C2(t) { +function T2(t) { if (t === 0 || t === 1) return t; if (t === 27) @@ -2873,14 +2873,14 @@ async function zO({ hash: t, signature: e }) { return UO(await qO({ hash: t, signature: e })); } function WO(t, e = "hex") { - const r = Y5(t), n = Cv(new Uint8Array(r.length)); + const r = J5(t), n = Tv(new Uint8Array(r.length)); return r.encode(n), e === "hex" ? xi(n.bytes) : n.bytes; } -function Y5(t) { - return Array.isArray(t) ? HO(t.map((e) => Y5(e))) : KO(t); +function J5(t) { + return Array.isArray(t) ? HO(t.map((e) => J5(e))) : KO(t); } function HO(t) { - const e = t.reduce((i, s) => i + s.length, 0), r = J5(e); + const e = t.reduce((i, s) => i + s.length, 0), r = X5(e); return { length: e <= 55 ? 1 + e : 1 + r + e, encode(i) { @@ -2891,7 +2891,7 @@ function HO(t) { }; } function KO(t) { - const e = typeof t == "string" ? Lo(t) : t, r = J5(e.length); + const e = typeof t == "string" ? Lo(t) : t, r = X5(e.length); return { length: e.length === 1 && e[0] < 128 ? 1 : e.length <= 55 ? 1 + e.length : 1 + r + e.length, encode(i) { @@ -2899,7 +2899,7 @@ function KO(t) { } }; } -function J5(t) { +function X5(t) { if (t < 2 ** 8) return 1; if (t < 2 ** 16) @@ -2921,7 +2921,7 @@ function VO(t) { ])); return i === "bytes" ? Lo(s) : s; } -async function X5(t) { +async function Z5(t) { const { authorization: e, signature: r } = t; return zO({ hash: VO(e), @@ -2934,7 +2934,7 @@ class GO extends yt { const A = D0({ from: r == null ? void 0 : r.address, to: p, - value: typeof w < "u" && `${K5(w)} ${((M = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : M.symbol) || "ETH"}`, + value: typeof w < "u" && `${V5(w)} ${((M = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : M.symbol) || "ETH"}`, data: s, gas: o, gasPrice: typeof a < "u" && `${Es(a)} gwei`, @@ -3132,7 +3132,7 @@ Object.defineProperty(Gd, "nodeMessage", { writable: !0, value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/ }); -class Tv extends yt { +class Rv extends yt { constructor({ cause: e }) { super(`An error occurred while executing: ${e == null ? void 0 : e.shortMessage}`, { cause: e, @@ -3140,7 +3140,7 @@ class Tv extends yt { }); } } -function Z5(t, e) { +function Q5(t, e) { const r = (t.details || "").toLowerCase(), n = t instanceof yt ? t.walk((i) => (i == null ? void 0 : i.code) === Zc.code) : t; return n instanceof yt ? new Zc({ cause: t, @@ -3158,21 +3158,21 @@ function Z5(t, e) { cause: t, maxFeePerGas: e == null ? void 0 : e.maxFeePerGas, maxPriorityFeePerGas: e == null ? void 0 : e.maxPriorityFeePerGas - }) : new Tv({ + }) : new Rv({ cause: t }); } function YO(t, { docsPath: e, ...r }) { const n = (() => { - const i = Z5(t, r); - return i instanceof Tv ? t : i; + const i = Q5(t, r); + return i instanceof Rv ? t : i; })(); return new GO(n, { docsPath: e, ...r }); } -function Q5(t, { format: e }) { +function e4(t, { format: e }) { if (!e) return {}; const r = {}; @@ -3191,7 +3191,7 @@ const JO = { eip4844: "0x3", eip7702: "0x4" }; -function Rv(t) { +function Dv(t) { const e = {}; return typeof t.authorizationList < "u" && (e.authorizationList = XO(t.authorizationList)), typeof t.accessList < "u" && (e.accessList = t.accessList), typeof t.blobVersionedHashes < "u" && (e.blobVersionedHashes = t.blobVersionedHashes), typeof t.blobs < "u" && (typeof t.blobs[0] != "string" ? e.blobs = t.blobs.map((r) => xi(r)) : e.blobs = t.blobs), typeof t.data < "u" && (e.data = t.data), typeof t.from < "u" && (e.from = t.from), typeof t.gas < "u" && (e.gas = Mr(t.gas)), typeof t.gasPrice < "u" && (e.gasPrice = Mr(t.gasPrice)), typeof t.maxFeePerBlobGas < "u" && (e.maxFeePerBlobGas = Mr(t.maxFeePerBlobGas)), typeof t.maxFeePerGas < "u" && (e.maxFeePerGas = Mr(t.maxFeePerGas)), typeof t.maxPriorityFeePerGas < "u" && (e.maxPriorityFeePerGas = Mr(t.maxPriorityFeePerGas)), typeof t.nonce < "u" && (e.nonce = Mr(t.nonce)), typeof t.to < "u" && (e.to = t.to), typeof t.type < "u" && (e.type = JO[t.type]), typeof t.value < "u" && (e.value = Mr(t.value)), e; } @@ -3206,17 +3206,17 @@ function XO(t) { ...typeof e.v < "u" && typeof e.yParity > "u" ? { v: Mr(e.v) } : {} })); } -function T2(t) { +function R2(t) { if (!(!t || t.length === 0)) return t.reduce((e, { slot: r, value: n }) => { if (r.length !== 66) - throw new y2({ + throw new w2({ size: r.length, targetSize: 66, type: "hex" }); if (n.length !== 66) - throw new y2({ + throw new w2({ size: n.length, targetSize: 66, type: "hex" @@ -3226,10 +3226,10 @@ function T2(t) { } function ZO(t) { const { balance: e, nonce: r, state: n, stateDiff: i, code: s } = t, o = {}; - if (s !== void 0 && (o.code = s), e !== void 0 && (o.balance = Mr(e)), r !== void 0 && (o.nonce = Mr(r)), n !== void 0 && (o.state = T2(n)), i !== void 0) { + if (s !== void 0 && (o.code = s), e !== void 0 && (o.balance = Mr(e)), r !== void 0 && (o.nonce = Mr(r)), n !== void 0 && (o.state = R2(n)), i !== void 0) { if (o.state) throw new MO(); - o.stateDiff = T2(i); + o.stateDiff = R2(i); } return o; } @@ -3267,7 +3267,7 @@ class tN extends yt { }); } } -class Dv extends yt { +class Ov extends yt { constructor() { super("Chain does not support EIP-1559 fees.", { name: "Eip1559FeesNotSupportedError" @@ -3368,7 +3368,7 @@ async function Yd(t, { blockHash: e, blockNumber: r, blockTag: n, includeTransac throw new nN({ blockHash: e, blockNumber: r }); return (((w = (p = (d = t.chain) == null ? void 0 : d.formatters) == null ? void 0 : p.block) == null ? void 0 : w.format) || aN)(u); } -async function e4(t) { +async function t4(t) { const e = await t.request({ method: "eth_gasPrice" }); @@ -3380,7 +3380,7 @@ async function cN(t, e) { try { const a = ((s = n == null ? void 0 : n.fees) == null ? void 0 : s.maxPriorityFeePerGas) ?? ((o = n == null ? void 0 : n.fees) == null ? void 0 : o.defaultPriorityFee); if (typeof a == "function") { - const l = r || await bi(t, Yd, "getBlock")({}), d = await a({ + const l = r || await yi(t, Yd, "getBlock")({}), d = await a({ block: l, client: t, request: i @@ -3397,16 +3397,16 @@ async function cN(t, e) { return el(u); } catch { const [a, u] = await Promise.all([ - r ? Promise.resolve(r) : bi(t, Yd, "getBlock")({}), - bi(t, e4, "getGasPrice")({}) + r ? Promise.resolve(r) : yi(t, Yd, "getBlock")({}), + yi(t, t4, "getGasPrice")({}) ]); if (typeof a.baseFeePerGas != "bigint") - throw new Dv(); + throw new Ov(); const l = u - a.baseFeePerGas; return l < 0n ? 0n : l; } } -async function R2(t, e) { +async function D2(t, e) { var w, A; const { block: r, chain: n = t.chain, request: i, type: s = "eip1559" } = e || {}, o = await (async () => { var M, N; @@ -3418,7 +3418,7 @@ async function R2(t, e) { })(); if (o < 1) throw new tN(); - const u = 10 ** (((w = o.toString().split(".")[1]) == null ? void 0 : w.length) ?? 0), l = (M) => M * BigInt(Math.ceil(o * u)) / BigInt(u), d = r || await bi(t, Yd, "getBlock")({}); + const u = 10 ** (((w = o.toString().split(".")[1]) == null ? void 0 : w.length) ?? 0), l = (M) => M * BigInt(Math.ceil(o * u)) / BigInt(u), d = r || await yi(t, Yd, "getBlock")({}); if (typeof ((A = n == null ? void 0 : n.fees) == null ? void 0 : A.estimateFeesPerGas) == "function") { const M = await n.fees.estimateFeesPerGas({ block: r, @@ -3432,7 +3432,7 @@ async function R2(t, e) { } if (s === "eip1559") { if (typeof d.baseFeePerGas != "bigint") - throw new Dv(); + throw new Ov(); const M = typeof (i == null ? void 0 : i.maxPriorityFeePerGas) == "bigint" ? i.maxPriorityFeePerGas : await cN(t, { block: d, chain: n, @@ -3444,7 +3444,7 @@ async function R2(t, e) { }; } return { - gasPrice: (i == null ? void 0 : i.gasPrice) ?? l(await bi(t, e4, "getGasPrice")({})) + gasPrice: (i == null ? void 0 : i.gasPrice) ?? l(await yi(t, t4, "getGasPrice")({})) }; } async function uN(t, { address: e, blockTag: r = "latest", blockNumber: n }) { @@ -3454,13 +3454,13 @@ async function uN(t, { address: e, blockTag: r = "latest", blockNumber: n }) { }, { dedupe: !!n }); return bu(i); } -function t4(t) { +function r4(t) { const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((s) => Lo(s)) : t.blobs, i = []; for (const s of n) i.push(Uint8Array.from(e.blobToKzgCommitment(s))); return r === "bytes" ? i : i.map((s) => xi(s)); } -function r4(t) { +function n4(t) { const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((o) => Lo(o)) : t.blobs, i = typeof t.commitments[0] == "string" ? t.commitments.map((o) => Lo(o)) : t.commitments, s = []; for (let o = 0; o < n.length; o++) { const a = n[o], u = i[o]; @@ -3475,7 +3475,7 @@ function fN(t, e, r, n) { t.setUint32(e + u, o, n), t.setUint32(e + l, a, n); } const lN = (t, e, r) => t & e ^ ~t & r, hN = (t, e, r) => t & e ^ t & r ^ e & r; -class dN extends C5 { +class dN extends T5 { constructor(e, r, n, i) { super(), this.blockLen = e, this.outputLen = r, this.padOffset = n, this.isLE = i, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(e), this.view = Bg(this.buffer); } @@ -3497,7 +3497,7 @@ class dN extends C5 { return this.length += e.length, this.roundClean(), this; } digestInto(e) { - Hd(this), I5(e, this), this.finished = !0; + Hd(this), C5(e, this), this.finished = !0; const { buffer: r, view: n, blockLen: i, isLE: s } = this; let { pos: o } = this; r[o++] = 128, this.buffer.subarray(o).fill(0), this.padOffset > i - o && (this.process(n, 0), o = 0); @@ -3633,9 +3633,9 @@ let gN = class extends dN { this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0); } }; -const n4 = /* @__PURE__ */ T5(() => new gN()); +const i4 = /* @__PURE__ */ R5(() => new gN()); function mN(t, e) { - return n4(va(t, { strict: !1 }) ? Ev(t) : t); + return i4(va(t, { strict: !1 }) ? Sv(t) : t); } function vN(t) { const { commitment: e, version: r = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), i = mN(e); @@ -3651,9 +3651,9 @@ function bN(t) { })); return i; } -const D2 = 6, i4 = 32, Ov = 4096, s4 = i4 * Ov, O2 = s4 * D2 - // terminator byte (0x80). +const O2 = 6, s4 = 32, Nv = 4096, o4 = s4 * Nv, N2 = o4 * O2 - // terminator byte (0x80). 1 - // zero byte (0x00) appended to each field element. -1 * Ov * D2; +1 * Nv * O2; class yN extends yt { constructor({ maxSize: e, size: r }) { super("Blob size is too large.", { @@ -3671,18 +3671,18 @@ function xN(t) { const e = t.to ?? (typeof t.data == "string" ? "hex" : "bytes"), r = typeof t.data == "string" ? Lo(t.data) : t.data, n = An(r); if (!n) throw new wN(); - if (n > O2) + if (n > N2) throw new yN({ - maxSize: O2, + maxSize: N2, size: n }); const i = []; let s = !0, o = 0; for (; s; ) { - const a = Cv(new Uint8Array(s4)); + const a = Tv(new Uint8Array(o4)); let u = 0; - for (; u < Ov; ) { - const l = r.slice(o, o + (i4 - 1)); + for (; u < Nv; ) { + const l = r.slice(o, o + (s4 - 1)); if (a.pushByte(0), a.pushBytes(l), l.length < 31) { a.pushByte(128), s = !1; break; @@ -3694,7 +3694,7 @@ function xN(t) { return e === "bytes" ? i.map((a) => a.bytes) : i.map((a) => xi(a.bytes)); } function _N(t) { - const { data: e, kzg: r, to: n } = t, i = t.blobs ?? xN({ data: e, to: n }), s = t.commitments ?? t4({ blobs: i, kzg: r, to: n }), o = t.proofs ?? r4({ blobs: i, commitments: s, kzg: r, to: n }), a = []; + const { data: e, kzg: r, to: n } = t, i = t.blobs ?? xN({ data: e, to: n }), s = t.commitments ?? r4({ blobs: i, kzg: r, to: n }), o = t.proofs ?? n4({ blobs: i, commitments: s, kzg: r, to: n }), a = []; for (let u = 0; u < i.length; u++) a.push({ blob: i[u], @@ -3722,7 +3722,7 @@ async function N0(t) { }, { dedupe: !0 }); return bu(e); } -const o4 = [ +const a4 = [ "blobVersionedHashes", "chainId", "fees", @@ -3730,30 +3730,30 @@ const o4 = [ "nonce", "type" ]; -async function Nv(t, e) { - const { account: r = t.account, blobs: n, chain: i, gas: s, kzg: o, nonce: a, nonceManager: u, parameters: l = o4, type: d } = e, p = r && qo(r), w = { ...e, ...p ? { from: p == null ? void 0 : p.address } : {} }; +async function Lv(t, e) { + const { account: r = t.account, blobs: n, chain: i, gas: s, kzg: o, nonce: a, nonceManager: u, parameters: l = a4, type: d } = e, p = r && qo(r), w = { ...e, ...p ? { from: p == null ? void 0 : p.address } : {} }; let A; async function M() { - return A || (A = await bi(t, Yd, "getBlock")({ blockTag: "latest" }), A); + return A || (A = await yi(t, Yd, "getBlock")({ blockTag: "latest" }), A); } let N; async function L() { - return N || (i ? i.id : typeof e.chainId < "u" ? e.chainId : (N = await bi(t, N0, "getChainId")({}), N)); + return N || (i ? i.id : typeof e.chainId < "u" ? e.chainId : (N = await yi(t, N0, "getChainId")({}), N)); } if ((l.includes("blobVersionedHashes") || l.includes("sidecars")) && n && o) { - const B = t4({ blobs: n, kzg: o }); + const $ = r4({ blobs: n, kzg: o }); if (l.includes("blobVersionedHashes")) { - const $ = bN({ - commitments: B, + const B = bN({ + commitments: $, to: "hex" }); - w.blobVersionedHashes = $; + w.blobVersionedHashes = B; } if (l.includes("sidecars")) { - const $ = r4({ blobs: n, commitments: B, kzg: o }), H = _N({ + const B = n4({ blobs: n, commitments: $, kzg: o }), H = _N({ blobs: n, - commitments: B, - proofs: $, + commitments: $, + proofs: B, to: "hex" }); w.sidecars = H; @@ -3761,14 +3761,14 @@ async function Nv(t, e) { } if (l.includes("chainId") && (w.chainId = await L()), l.includes("nonce") && typeof a > "u" && p) if (u) { - const B = await L(); + const $ = await L(); w.nonce = await u.consume({ address: p.address, - chainId: B, + chainId: $, client: t }); } else - w.nonce = await bi(t, uN, "getTransactionCount")({ + w.nonce = await yi(t, uN, "getTransactionCount")({ address: p.address, blockTag: "pending" }); @@ -3776,14 +3776,14 @@ async function Nv(t, e) { try { w.type = EN(w); } catch { - const B = await M(); - w.type = typeof (B == null ? void 0 : B.baseFeePerGas) == "bigint" ? "eip1559" : "legacy"; + const $ = await M(); + w.type = typeof ($ == null ? void 0 : $.baseFeePerGas) == "bigint" ? "eip1559" : "legacy"; } if (l.includes("fees")) if (w.type !== "legacy" && w.type !== "eip2930") { if (typeof w.maxFeePerGas > "u" || typeof w.maxPriorityFeePerGas > "u") { - const B = await M(), { maxFeePerGas: $, maxPriorityFeePerGas: H } = await R2(t, { - block: B, + const $ = await M(), { maxFeePerGas: B, maxPriorityFeePerGas: H } = await D2(t, { + block: $, chain: i, request: w }); @@ -3791,20 +3791,20 @@ async function Nv(t, e) { throw new rN({ maxPriorityFeePerGas: H }); - w.maxPriorityFeePerGas = H, w.maxFeePerGas = $; + w.maxPriorityFeePerGas = H, w.maxFeePerGas = B; } } else { if (typeof e.maxFeePerGas < "u" || typeof e.maxPriorityFeePerGas < "u") - throw new Dv(); - const B = await M(), { gasPrice: $ } = await R2(t, { - block: B, + throw new Ov(); + const $ = await M(), { gasPrice: B } = await D2(t, { + block: $, chain: i, request: w, type: "legacy" }); - w.gasPrice = $; + w.gasPrice = B; } - return l.includes("gas") && typeof s > "u" && (w.gas = await bi(t, AN, "estimateGas")({ + return l.includes("gas") && typeof s > "u" && (w.gas = await yi(t, AN, "estimateGas")({ ...w, account: p && { address: p.address, type: "json-rpc" } })), O0(w), delete w.parameters, w; @@ -3827,7 +3827,7 @@ async function AN(t, e) { params: E ? [_, x ?? "latest", E] : x ? [_, x] : [_] }); }; - const { accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, blockNumber: p, blockTag: w, data: A, gas: M, gasPrice: N, maxFeePerBlobGas: L, maxFeePerGas: B, maxPriorityFeePerGas: $, nonce: H, value: W, stateOverride: V, ...te } = await Nv(t, { + const { accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, blockNumber: p, blockTag: w, data: A, gas: M, gasPrice: N, maxFeePerBlobGas: L, maxFeePerGas: $, maxPriorityFeePerGas: B, nonce: H, value: U, stateOverride: V, ...te } = await Lv(t, { ...e, parameters: ( // Some RPC Providers do not compute versioned hashes from blobs. We will need @@ -3838,16 +3838,16 @@ async function AN(t, e) { if (te.to) return te.to; if (u && u.length > 0) - return await X5({ + return await Z5({ authorization: u[0] }).catch(() => { throw new yt("`to` is required. Could not infer from `authorizationList`"); }); })(); O0(e); - const Y = (o = (s = (i = t.chain) == null ? void 0 : i.formatters) == null ? void 0 : s.transactionRequest) == null ? void 0 : o.format, m = (Y || Rv)({ + const Y = (o = (s = (i = t.chain) == null ? void 0 : i.formatters) == null ? void 0 : s.transactionRequest) == null ? void 0 : o.format, m = (Y || Dv)({ // Pick out extra data that might exist on the chain's transaction request type. - ...Q5(te, { format: Y }), + ...e4(te, { format: Y }), from: n == null ? void 0 : n.address, accessList: a, authorizationList: u, @@ -3857,11 +3857,11 @@ async function AN(t, e) { gas: M, gasPrice: N, maxFeePerBlobGas: L, - maxFeePerGas: B, - maxPriorityFeePerGas: $, + maxFeePerGas: $, + maxPriorityFeePerGas: B, nonce: H, to: Ee, - value: W + value: U }); let g = BigInt(await f({ block: K, request: m, rpcStateOverride: ge })); if (u) { @@ -3921,10 +3921,10 @@ function IN(t) { if (!i) throw new KR({ docsPath: Ug }); if (!("inputs" in i)) - throw new v2({ docsPath: Ug }); + throw new b2({ docsPath: Ug }); if (!i.inputs || i.inputs.length === 0) - throw new v2({ docsPath: Ug }); - const s = U5(i.inputs, r); + throw new b2({ docsPath: Ug }); + const s = q5(i.inputs, r); return R0([n, s]); } async function CN(t) { @@ -3952,7 +3952,7 @@ class qg extends yt { }); } } -function a4({ chain: t, currentChainId: e }) { +function c4({ chain: t, currentChainId: e }) { if (!t) throw new MN(); if (e !== t.id) @@ -3960,23 +3960,23 @@ function a4({ chain: t, currentChainId: e }) { } function TN(t, { docsPath: e, ...r }) { const n = (() => { - const i = Z5(t, r); - return i instanceof Tv ? t : i; + const i = Q5(t, r); + return i instanceof Rv ? t : i; })(); return new TO(n, { docsPath: e, ...r }); } -async function c4(t, { serializedTransaction: e }) { +async function u4(t, { serializedTransaction: e }) { return t.request({ method: "eth_sendRawTransaction", params: [e] }, { retryCount: 0 }); } const zg = new T0(128); -async function Lv(t, e) { - var B, $, H, W; +async function kv(t, e) { + var $, B, H, U; const { account: r = t.account, chain: n = t.chain, accessList: i, authorizationList: s, blobs: o, data: a, gas: u, gasPrice: l, maxFeePerBlobGas: d, maxFeePerGas: p, maxPriorityFeePerGas: w, nonce: A, value: M, ...N } = e; if (typeof r > "u") throw new Fl({ @@ -3989,7 +3989,7 @@ async function Lv(t, e) { if (e.to) return e.to; if (s && s.length > 0) - return await X5({ + return await Z5({ authorization: s[0] }).catch(() => { throw new yt("`to` is required. Could not infer from `authorizationList`."); @@ -3997,13 +3997,13 @@ async function Lv(t, e) { })(); if ((L == null ? void 0 : L.type) === "json-rpc" || L === null) { let te; - n !== null && (te = await bi(t, N0, "getChainId")({}), a4({ + n !== null && (te = await yi(t, N0, "getChainId")({}), c4({ currentChainId: te, chain: n })); - const R = (H = ($ = (B = t.chain) == null ? void 0 : B.formatters) == null ? void 0 : $.transactionRequest) == null ? void 0 : H.format, ge = (R || Rv)({ + const R = (H = (B = ($ = t.chain) == null ? void 0 : $.formatters) == null ? void 0 : B.transactionRequest) == null ? void 0 : H.format, ge = (R || Dv)({ // Pick out extra data that might exist on the chain's transaction request type. - ...Q5(N, { format: R }), + ...e4(N, { format: R }), accessList: i, authorizationList: s, blobs: o, @@ -4040,7 +4040,7 @@ async function Lv(t, e) { } } if ((L == null ? void 0 : L.type) === "local") { - const te = await bi(t, Nv, "prepareTransactionRequest")({ + const te = await yi(t, Lv, "prepareTransactionRequest")({ account: L, accessList: i, authorizationList: s, @@ -4054,14 +4054,14 @@ async function Lv(t, e) { maxPriorityFeePerGas: w, nonce: A, nonceManager: L.nonceManager, - parameters: [...o4, "sidecars"], + parameters: [...a4, "sidecars"], value: M, ...N, to: V - }), R = (W = n == null ? void 0 : n.serializers) == null ? void 0 : W.transaction, K = await L.signTransaction(te, { + }), R = (U = n == null ? void 0 : n.serializers) == null ? void 0 : U.transaction, K = await L.signTransaction(te, { serializer: R }); - return await bi(t, c4, "sendRawTransaction")({ + return await yi(t, u4, "sendRawTransaction")({ serializedTransaction: K }); } @@ -4095,7 +4095,7 @@ async function RN(t, e) { functionName: a }); try { - return await bi(t, Lv, "sendTransaction")({ + return await yi(t, kv, "sendTransaction")({ data: `${d}${o ? o.replace("0x", "") : ""}`, to: i, account: l, @@ -4129,7 +4129,7 @@ async function DN(t, { chain: e }) { } const a1 = 256; let nd = a1, id; -function u4(t = 11) { +function f4(t = 11) { if (!id || nd + t > a1 * 2) { id = "", nd = 0; for (let e = 0; e < a1; e++) @@ -4153,14 +4153,14 @@ function ON(t) { request: p, transport: A, type: a, - uid: u4() + uid: f4() }; function N(L) { - return (B) => { - const $ = B(L); - for (const W in M) - delete $[W]; - const H = { ...L, ...$ }; + return ($) => { + const B = $(L); + for (const U in M) + delete B[U]; + const H = { ...L, ...B }; return Object.assign(H, { extend: N(H) }); }; } @@ -4253,7 +4253,7 @@ function kN(t, e = {}) { }, { delay: ({ count: l, error: d }) => { var p; - if (d && d instanceof G5) { + if (d && d instanceof Y5) { const w = (p = d == null ? void 0 : d.headers) == null ? void 0 : p.get("Retry-After"); if (w != null && w.match(/\d/)) return Number.parseInt(w) * 1e3; @@ -4266,10 +4266,10 @@ function kN(t, e = {}) { }; } function $N(t) { - return "code" in t && typeof t.code == "number" ? t.code === -1 || t.code === xu.code || t.code === uc.code : t instanceof G5 && t.status ? t.status === 403 || t.status === 408 || t.status === 413 || t.status === 429 || t.status === 500 || t.status === 502 || t.status === 503 || t.status === 504 : !0; + return "code" in t && typeof t.code == "number" ? t.code === -1 || t.code === xu.code || t.code === uc.code : t instanceof Y5 && t.status ? t.status === 403 || t.status === 408 || t.status === 413 || t.status === 429 || t.status === 500 || t.status === 502 || t.status === 503 || t.status === 504 : !0; } function BN({ key: t, name: e, request: r, retryCount: n = 3, retryDelay: i = 150, timeout: s, type: o }, a) { - const u = u4(); + const u = f4(); return { config: { key: t, @@ -4338,10 +4338,10 @@ function KN(t) { for (const u of o) { const { name: l, type: d } = u, p = a[l], w = d.match(UN); if (w && (typeof p == "number" || typeof p == "bigint")) { - const [N, L, B] = w; + const [N, L, $] = w; Mr(p, { signed: L === "int", - size: Number.parseInt(B) / 8 + size: Number.parseInt($) / 8 }); } if (d === "address" && typeof p == "string" && !ko(p)) @@ -4391,7 +4391,7 @@ function GN(t) { } function YN(t, e) { const { abi: r, args: n, bytecode: i, ...s } = e, o = IN({ abi: r, args: n, bytecode: i }); - return Lv(t, { + return kv(t, { ...s, data: o }); @@ -4404,7 +4404,7 @@ async function XN(t) { return await t.request({ method: "wallet_getPermissions" }, { dedupe: !0 }); } async function ZN(t) { - return (await t.request({ method: "eth_requestAccounts" }, { dedupe: !0, retryCount: 0 })).map((r) => Sv(r)); + return (await t.request({ method: "eth_requestAccounts" }, { dedupe: !0, retryCount: 0 })).map((r) => Av(r)); } async function QN(t, e) { return t.request({ @@ -4438,12 +4438,12 @@ async function tL(t, e) { account: s, ...e }); - const o = await bi(t, N0, "getChainId")({}); - n !== null && a4({ + const o = await yi(t, N0, "getChainId")({}); + n !== null && c4({ currentChainId: o, chain: n }); - const a = (n == null ? void 0 : n.formatters) || ((l = t.chain) == null ? void 0 : l.formatters), u = ((d = a == null ? void 0 : a.transactionRequest) == null ? void 0 : d.format) || Rv; + const a = (n == null ? void 0 : n.formatters) || ((l = t.chain) == null ? void 0 : l.formatters), u = ((d = a == null ? void 0 : a.transactionRequest) == null ? void 0 : d.format) || Dv; return s.signTransaction ? s.signTransaction({ ...i, chainId: o @@ -4499,11 +4499,11 @@ function sL(t) { getAddresses: () => JN(t), getChainId: () => N0(t), getPermissions: () => XN(t), - prepareTransactionRequest: (e) => Nv(t, e), + prepareTransactionRequest: (e) => Lv(t, e), requestAddresses: () => ZN(t), requestPermissions: (e) => QN(t, e), - sendRawTransaction: (e) => c4(t, e), - sendTransaction: (e) => Lv(t, e), + sendRawTransaction: (e) => u4(t, e), + sendTransaction: (e) => kv(t, e), signMessage: (e) => eL(t, e), signTransaction: (e) => tL(t, e), signTypedData: (e) => rL(t, e), @@ -4617,7 +4617,7 @@ class vl { this._provider && "session" in this._provider && await this._provider.disconnect(), this._connected = !1, this._address = null; } } -var kv = { exports: {} }, uu = typeof Reflect == "object" ? Reflect : null, N2 = uu && typeof uu.apply == "function" ? uu.apply : function(e, r, n) { +var $v = { exports: {} }, uu = typeof Reflect == "object" ? Reflect : null, L2 = uu && typeof uu.apply == "function" ? uu.apply : function(e, r, n) { return Function.prototype.apply.call(e, r, n); }, xd; uu && typeof uu.ownKeys == "function" ? xd = uu.ownKeys : Object.getOwnPropertySymbols ? xd = function(e) { @@ -4628,19 +4628,19 @@ uu && typeof uu.ownKeys == "function" ? xd = uu.ownKeys : Object.getOwnPropertyS function aL(t) { console && console.warn && console.warn(t); } -var f4 = Number.isNaN || function(e) { +var l4 = Number.isNaN || function(e) { return e !== e; }; function kr() { kr.init.call(this); } -kv.exports = kr; -kv.exports.once = lL; +$v.exports = kr; +$v.exports.once = lL; kr.EventEmitter = kr; kr.prototype._events = void 0; kr.prototype._eventsCount = 0; kr.prototype._maxListeners = void 0; -var L2 = 10; +var k2 = 10; function L0(t) { if (typeof t != "function") throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof t); @@ -4648,27 +4648,27 @@ function L0(t) { Object.defineProperty(kr, "defaultMaxListeners", { enumerable: !0, get: function() { - return L2; + return k2; }, set: function(t) { - if (typeof t != "number" || t < 0 || f4(t)) + if (typeof t != "number" || t < 0 || l4(t)) throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + t + "."); - L2 = t; + k2 = t; } }); kr.init = function() { (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0; }; kr.prototype.setMaxListeners = function(e) { - if (typeof e != "number" || e < 0 || f4(e)) + if (typeof e != "number" || e < 0 || l4(e)) throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + "."); return this._maxListeners = e, this; }; -function l4(t) { +function h4(t) { return t._maxListeners === void 0 ? kr.defaultMaxListeners : t._maxListeners; } kr.prototype.getMaxListeners = function() { - return l4(this); + return h4(this); }; kr.prototype.emit = function(e) { for (var r = [], n = 1; n < arguments.length; n++) r.push(arguments[n]); @@ -4688,13 +4688,13 @@ kr.prototype.emit = function(e) { if (u === void 0) return !1; if (typeof u == "function") - N2(u, this, r); + L2(u, this, r); else - for (var l = u.length, d = m4(u, l), n = 0; n < l; ++n) - N2(d[n], this, r); + for (var l = u.length, d = v4(u, l), n = 0; n < l; ++n) + L2(d[n], this, r); return !0; }; -function h4(t, e, r, n) { +function d4(t, e, r, n) { var i, s, o; if (L0(r), s = t._events, s === void 0 ? (s = t._events = /* @__PURE__ */ Object.create(null), t._eventsCount = 0) : (s.newListener !== void 0 && (t.emit( "newListener", @@ -4702,7 +4702,7 @@ function h4(t, e, r, n) { r.listener ? r.listener : r ), s = t._events), o = s[e]), o === void 0) o = s[e] = r, ++t._eventsCount; - else if (typeof o == "function" ? o = s[e] = n ? [r, o] : [o, r] : n ? o.unshift(r) : o.push(r), i = l4(t), i > 0 && o.length > i && !o.warned) { + else if (typeof o == "function" ? o = s[e] = n ? [r, o] : [o, r] : n ? o.unshift(r) : o.push(r), i = h4(t), i > 0 && o.length > i && !o.warned) { o.warned = !0; var a = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit"); a.name = "MaxListenersExceededWarning", a.emitter = t, a.type = e, a.count = o.length, aL(a); @@ -4710,25 +4710,25 @@ function h4(t, e, r, n) { return t; } kr.prototype.addListener = function(e, r) { - return h4(this, e, r, !1); + return d4(this, e, r, !1); }; kr.prototype.on = kr.prototype.addListener; kr.prototype.prependListener = function(e, r) { - return h4(this, e, r, !0); + return d4(this, e, r, !0); }; function cL() { if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments); } -function d4(t, e, r) { +function p4(t, e, r) { var n = { fired: !1, wrapFn: void 0, target: t, type: e, listener: r }, i = cL.bind(n); return i.listener = r, n.wrapFn = i, i; } kr.prototype.once = function(e, r) { - return L0(r), this.on(e, d4(this, e, r)), this; + return L0(r), this.on(e, p4(this, e, r)), this; }; kr.prototype.prependOnceListener = function(e, r) { - return L0(r), this.prependListener(e, d4(this, e, r)), this; + return L0(r), this.prependListener(e, p4(this, e, r)), this; }; kr.prototype.removeListener = function(e, r) { var n, i, s, o, a; @@ -4770,24 +4770,24 @@ kr.prototype.removeAllListeners = function(e) { this.removeListener(e, r[i]); return this; }; -function p4(t, e, r) { +function g4(t, e, r) { var n = t._events; if (n === void 0) return []; var i = n[e]; - return i === void 0 ? [] : typeof i == "function" ? r ? [i.listener || i] : [i] : r ? fL(i) : m4(i, i.length); + return i === void 0 ? [] : typeof i == "function" ? r ? [i.listener || i] : [i] : r ? fL(i) : v4(i, i.length); } kr.prototype.listeners = function(e) { - return p4(this, e, !0); + return g4(this, e, !0); }; kr.prototype.rawListeners = function(e) { - return p4(this, e, !1); + return g4(this, e, !1); }; kr.listenerCount = function(t, e) { - return typeof t.listenerCount == "function" ? t.listenerCount(e) : g4.call(t, e); + return typeof t.listenerCount == "function" ? t.listenerCount(e) : m4.call(t, e); }; -kr.prototype.listenerCount = g4; -function g4(t) { +kr.prototype.listenerCount = m4; +function m4(t) { var e = this._events; if (e !== void 0) { var r = e[t]; @@ -4801,7 +4801,7 @@ function g4(t) { kr.prototype.eventNames = function() { return this._eventsCount > 0 ? xd(this._events) : []; }; -function m4(t, e) { +function v4(t, e) { for (var r = new Array(e), n = 0; n < e; ++n) r[n] = t[n]; return r; @@ -4824,13 +4824,13 @@ function lL(t, e) { function s() { typeof t.removeListener == "function" && t.removeListener("error", i), r([].slice.call(arguments)); } - v4(t, e, s, { once: !0 }), e !== "error" && hL(t, i, { once: !0 }); + b4(t, e, s, { once: !0 }), e !== "error" && hL(t, i, { once: !0 }); }); } function hL(t, e, r) { - typeof t.on == "function" && v4(t, "error", e, r); + typeof t.on == "function" && b4(t, "error", e, r); } -function v4(t, e, r, n) { +function b4(t, e, r, n) { if (typeof t.on == "function") n.once ? t.once(e, r) : t.on(e, r); else if (typeof t.addEventListener == "function") @@ -4840,8 +4840,8 @@ function v4(t, e, r, n) { else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof t); } -var rs = kv.exports; -const $v = /* @__PURE__ */ ts(rs); +var rs = $v.exports; +const Bv = /* @__PURE__ */ ts(rs); var mt = {}; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. @@ -5005,7 +5005,7 @@ function f1(t) { }; throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined."); } -function b4(t, e) { +function y4(t, e) { var r = typeof Symbol == "function" && t[Symbol.iterator]; if (!r) return t; var n = r.call(t), i, s = [], o; @@ -5024,7 +5024,7 @@ function b4(t, e) { } function _L() { for (var t = [], e = 0; e < arguments.length; e++) - t = t.concat(b4(arguments[e])); + t = t.concat(y4(arguments[e])); return t; } function EL() { @@ -5146,16 +5146,16 @@ const DL = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __makeTemplateObject: ML, __metadata: vL, __param: mL, - __read: b4, + __read: y4, __rest: pL, __spread: _L, __spreadArrays: EL, __values: f1 -}, Symbol.toStringTag, { value: "Module" })), jl = /* @__PURE__ */ yv(DL); -var Wg = {}, wf = {}, k2; +}, Symbol.toStringTag, { value: "Module" })), jl = /* @__PURE__ */ wv(DL); +var Wg = {}, wf = {}, $2; function OL() { - if (k2) return wf; - k2 = 1, Object.defineProperty(wf, "__esModule", { value: !0 }), wf.delay = void 0; + if ($2) return wf; + $2 = 1, Object.defineProperty(wf, "__esModule", { value: !0 }), wf.delay = void 0; function t(e) { return new Promise((r) => { setTimeout(() => { @@ -5165,29 +5165,29 @@ function OL() { } return wf.delay = t, wf; } -var qa = {}, Hg = {}, za = {}, $2; +var qa = {}, Hg = {}, za = {}, B2; function NL() { - return $2 || ($2 = 1, Object.defineProperty(za, "__esModule", { value: !0 }), za.ONE_THOUSAND = za.ONE_HUNDRED = void 0, za.ONE_HUNDRED = 100, za.ONE_THOUSAND = 1e3), za; + return B2 || (B2 = 1, Object.defineProperty(za, "__esModule", { value: !0 }), za.ONE_THOUSAND = za.ONE_HUNDRED = void 0, za.ONE_HUNDRED = 100, za.ONE_THOUSAND = 1e3), za; } -var Kg = {}, B2; +var Kg = {}, F2; function LL() { - return B2 || (B2 = 1, function(t) { + return F2 || (F2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.ONE_YEAR = t.FOUR_WEEKS = t.THREE_WEEKS = t.TWO_WEEKS = t.ONE_WEEK = t.THIRTY_DAYS = t.SEVEN_DAYS = t.FIVE_DAYS = t.THREE_DAYS = t.ONE_DAY = t.TWENTY_FOUR_HOURS = t.TWELVE_HOURS = t.SIX_HOURS = t.THREE_HOURS = t.ONE_HOUR = t.SIXTY_MINUTES = t.THIRTY_MINUTES = t.TEN_MINUTES = t.FIVE_MINUTES = t.ONE_MINUTE = t.SIXTY_SECONDS = t.THIRTY_SECONDS = t.TEN_SECONDS = t.FIVE_SECONDS = t.ONE_SECOND = void 0, t.ONE_SECOND = 1, t.FIVE_SECONDS = 5, t.TEN_SECONDS = 10, t.THIRTY_SECONDS = 30, t.SIXTY_SECONDS = 60, t.ONE_MINUTE = t.SIXTY_SECONDS, t.FIVE_MINUTES = t.ONE_MINUTE * 5, t.TEN_MINUTES = t.ONE_MINUTE * 10, t.THIRTY_MINUTES = t.ONE_MINUTE * 30, t.SIXTY_MINUTES = t.ONE_MINUTE * 60, t.ONE_HOUR = t.SIXTY_MINUTES, t.THREE_HOURS = t.ONE_HOUR * 3, t.SIX_HOURS = t.ONE_HOUR * 6, t.TWELVE_HOURS = t.ONE_HOUR * 12, t.TWENTY_FOUR_HOURS = t.ONE_HOUR * 24, t.ONE_DAY = t.TWENTY_FOUR_HOURS, t.THREE_DAYS = t.ONE_DAY * 3, t.FIVE_DAYS = t.ONE_DAY * 5, t.SEVEN_DAYS = t.ONE_DAY * 7, t.THIRTY_DAYS = t.ONE_DAY * 30, t.ONE_WEEK = t.SEVEN_DAYS, t.TWO_WEEKS = t.ONE_WEEK * 2, t.THREE_WEEKS = t.ONE_WEEK * 3, t.FOUR_WEEKS = t.ONE_WEEK * 4, t.ONE_YEAR = t.ONE_DAY * 365; }(Kg)), Kg; } -var F2; -function y4() { - return F2 || (F2 = 1, function(t) { +var j2; +function w4() { + return j2 || (j2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); const e = jl; e.__exportStar(NL(), t), e.__exportStar(LL(), t); }(Hg)), Hg; } -var j2; +var U2; function kL() { - if (j2) return qa; - j2 = 1, Object.defineProperty(qa, "__esModule", { value: !0 }), qa.fromMiliseconds = qa.toMiliseconds = void 0; - const t = y4(); + if (U2) return qa; + U2 = 1, Object.defineProperty(qa, "__esModule", { value: !0 }), qa.fromMiliseconds = qa.toMiliseconds = void 0; + const t = w4(); function e(n) { return n * t.ONE_THOUSAND; } @@ -5197,18 +5197,18 @@ function kL() { } return qa.fromMiliseconds = r, qa; } -var U2; +var q2; function $L() { - return U2 || (U2 = 1, function(t) { + return q2 || (q2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); const e = jl; e.__exportStar(OL(), t), e.__exportStar(kL(), t); }(Wg)), Wg; } -var zc = {}, q2; +var zc = {}, z2; function BL() { - if (q2) return zc; - q2 = 1, Object.defineProperty(zc, "__esModule", { value: !0 }), zc.Watch = void 0; + if (z2) return zc; + z2 = 1, Object.defineProperty(zc, "__esModule", { value: !0 }), zc.Watch = void 0; class t { constructor() { this.timestamps = /* @__PURE__ */ new Map(); @@ -5238,24 +5238,24 @@ function BL() { } return zc.Watch = t, zc.default = t, zc; } -var Vg = {}, xf = {}, z2; +var Vg = {}, xf = {}, W2; function FL() { - if (z2) return xf; - z2 = 1, Object.defineProperty(xf, "__esModule", { value: !0 }), xf.IWatch = void 0; + if (W2) return xf; + W2 = 1, Object.defineProperty(xf, "__esModule", { value: !0 }), xf.IWatch = void 0; class t { } return xf.IWatch = t, xf; } -var W2; +var H2; function jL() { - return W2 || (W2 = 1, function(t) { + return H2 || (H2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), jl.__exportStar(FL(), t); }(Vg)), Vg; } (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); const e = jl; - e.__exportStar($L(), t), e.__exportStar(BL(), t), e.__exportStar(jL(), t), e.__exportStar(y4(), t); + e.__exportStar($L(), t), e.__exportStar(BL(), t), e.__exportStar(jL(), t), e.__exportStar(w4(), t); })(mt); class vc { } @@ -5264,13 +5264,13 @@ let UL = class extends vc { super(); } }; -const H2 = mt.FIVE_SECONDS, Ou = { pulse: "heartbeat_pulse" }; -let qL = class w4 extends UL { +const K2 = mt.FIVE_SECONDS, Ou = { pulse: "heartbeat_pulse" }; +let qL = class x4 extends UL { constructor(e) { - super(e), this.events = new rs.EventEmitter(), this.interval = H2, this.interval = (e == null ? void 0 : e.interval) || H2; + super(e), this.events = new rs.EventEmitter(), this.interval = K2, this.interval = (e == null ? void 0 : e.interval) || K2; } static async init(e) { - const r = new w4(e); + const r = new x4(e); return await r.init(), r; } async init() { @@ -5380,7 +5380,7 @@ function _d(t) { return _d(t.toJSON()); throw new Error("[unstorage] Cannot stringify value!"); } -function x4() { +function _4() { if (typeof Buffer > "u") throw new TypeError("[unstorage] Buffer is not supported!"); } @@ -5388,21 +5388,21 @@ const l1 = "base64:"; function XL(t) { if (typeof t == "string") return t; - x4(); + _4(); const e = Buffer.from(t).toString("base64"); return l1 + e; } function ZL(t) { - return typeof t != "string" || !t.startsWith(l1) ? t : (x4(), Buffer.from(t.slice(l1.length), "base64")); + return typeof t != "string" || !t.startsWith(l1) ? t : (_4(), Buffer.from(t.slice(l1.length), "base64")); } -function pi(t) { +function gi(t) { return t ? t.split("?")[0].replace(/[/\\]/g, ":").replace(/:+/g, ":").replace(/^:|:$/g, "") : ""; } function QL(...t) { - return pi(t.join(":")); + return gi(t.join(":")); } function ad(t) { - return t = pi(t), t ? t + ":" : ""; + return t = gi(t), t ? t + ":" : ""; } const ek = "memory", tk = () => { const t = /* @__PURE__ */ new Map(); @@ -5466,7 +5466,7 @@ function rk(t = {}) { driver: e.mounts[p] })), i = (l, d) => { if (e.watching) { - d = pi(d); + d = gi(d); for (const p of e.watchListeners) p(l, d); } @@ -5474,7 +5474,7 @@ function rk(t = {}) { if (!e.watching) { e.watching = !0; for (const l in e.mounts) - e.unwatch[l] = await K2( + e.unwatch[l] = await V2( e.mounts[l], i, l @@ -5496,12 +5496,12 @@ function rk(t = {}) { }, w.set(M.base, N)), N; }; for (const M of l) { - const N = typeof M == "string", L = pi(N ? M : M.key), B = N ? void 0 : M.value, $ = N || !M.options ? d : { ...d, ...M.options }, H = r(L); + const N = typeof M == "string", L = gi(N ? M : M.key), $ = N ? void 0 : M.value, B = N || !M.options ? d : { ...d, ...M.options }, H = r(L); A(H).items.push({ key: L, - value: B, + value: $, relativeKey: H.relativeKey, - options: $ + options: B }); } return Promise.all([...w.values()].map((M) => p(M))).then( @@ -5510,12 +5510,12 @@ function rk(t = {}) { }, u = { // Item hasItem(l, d = {}) { - l = pi(l); + l = gi(l); const { relativeKey: p, driver: w } = r(l); return Cn(w.hasItem, p, d); }, getItem(l, d = {}) { - l = pi(l); + l = gi(l); const { relativeKey: p, driver: w } = r(l); return Cn(w.getItem, p, d).then( (A) => od(A) @@ -5546,7 +5546,7 @@ function rk(t = {}) { )); }, getItemRaw(l, d = {}) { - l = pi(l); + l = gi(l); const { relativeKey: p, driver: w } = r(l); return w.getItemRaw ? Cn(w.getItemRaw, p, d) : Cn(w.getItem, p, d).then( (A) => ZL(A) @@ -5555,7 +5555,7 @@ function rk(t = {}) { async setItem(l, d, p = {}) { if (d === void 0) return u.removeItem(l); - l = pi(l); + l = gi(l); const { relativeKey: w, driver: A } = r(l); A.setItem && (await Cn(A.setItem, w, _d(d), p), A.watch || i("update", l)); }, @@ -5584,7 +5584,7 @@ function rk(t = {}) { async setItemRaw(l, d, p = {}) { if (d === void 0) return u.removeItem(l, p); - l = pi(l); + l = gi(l); const { relativeKey: w, driver: A } = r(l); if (A.setItemRaw) await Cn(A.setItemRaw, w, d, p); @@ -5595,13 +5595,13 @@ function rk(t = {}) { A.watch || i("update", l); }, async removeItem(l, d = {}) { - typeof d == "boolean" && (d = { removeMeta: d }), l = pi(l); + typeof d == "boolean" && (d = { removeMeta: d }), l = gi(l); const { relativeKey: p, driver: w } = r(l); w.removeItem && (await Cn(w.removeItem, p, d), (d.removeMeta || d.removeMata) && await Cn(w.removeItem, p + "$", d), w.watch || i("remove", l)); }, // Meta async getMeta(l, d = {}) { - typeof d == "boolean" && (d = { nativeOnly: d }), l = pi(l); + typeof d == "boolean" && (d = { nativeOnly: d }), l = gi(l); const { relativeKey: p, driver: w } = r(l), A = /* @__PURE__ */ Object.create(null); if (w.getMeta && Object.assign(A, await Cn(w.getMeta, p, d)), !d.nativeOnly) { const M = await Cn( @@ -5632,8 +5632,8 @@ function rk(t = {}) { d ); for (const L of N) { - const B = M.mountpoint + pi(L); - w.some(($) => B.startsWith($)) || A.push(B); + const $ = M.mountpoint + gi(L); + w.some((B) => $.startsWith(B)) || A.push($); } w = [ M.mountpoint, @@ -5661,7 +5661,7 @@ function rk(t = {}) { }, async dispose() { await Promise.all( - Object.values(e.mounts).map((l) => V2(l)) + Object.values(e.mounts).map((l) => G2(l)) ); }, async watch(l) { @@ -5678,15 +5678,15 @@ function rk(t = {}) { mount(l, d) { if (l = ad(l), l && e.mounts[l]) throw new Error(`already mounted at ${l}`); - return l && (e.mountpoints.push(l), e.mountpoints.sort((p, w) => w.length - p.length)), e.mounts[l] = d, e.watching && Promise.resolve(K2(d, i, l)).then((p) => { + return l && (e.mountpoints.push(l), e.mountpoints.sort((p, w) => w.length - p.length)), e.mounts[l] = d, e.watching && Promise.resolve(V2(d, i, l)).then((p) => { e.unwatch[l] = p; }).catch(console.error), u; }, async unmount(l, d = !0) { - l = ad(l), !(!l || !e.mounts[l]) && (e.watching && l in e.unwatch && (e.unwatch[l](), delete e.unwatch[l]), d && await V2(e.mounts[l]), e.mountpoints = e.mountpoints.filter((p) => p !== l), delete e.mounts[l]); + l = ad(l), !(!l || !e.mounts[l]) && (e.watching && l in e.unwatch && (e.unwatch[l](), delete e.unwatch[l]), d && await G2(e.mounts[l]), e.mountpoints = e.mountpoints.filter((p) => p !== l), delete e.mounts[l]); }, getMount(l = "") { - l = pi(l) + ":"; + l = gi(l) + ":"; const d = r(l); return { driver: d.driver, @@ -5694,7 +5694,7 @@ function rk(t = {}) { }; }, getMounts(l = "", d = {}) { - return l = pi(l), n(l, d.parents).map((w) => ({ + return l = gi(l), n(l, d.parents).map((w) => ({ driver: w.driver, base: w.mountpoint })); @@ -5709,11 +5709,11 @@ function rk(t = {}) { }; return u; } -function K2(t, e, r) { +function V2(t, e, r) { return t.watch ? t.watch((n, i) => e(n, r + i)) : () => { }; } -async function V2(t) { +async function G2(t) { typeof t.dispose == "function" && await Cn(t.dispose); } function bc(t) { @@ -5721,7 +5721,7 @@ function bc(t) { t.oncomplete = t.onsuccess = () => e(t.result), t.onabort = t.onerror = () => r(t.error); }); } -function _4(t, e) { +function E4(t, e) { const r = indexedDB.open(t); r.onupgradeneeded = () => r.result.createObjectStore(e); const n = bc(r); @@ -5729,9 +5729,9 @@ function _4(t, e) { } let Gg; function Ul() { - return Gg || (Gg = _4("keyval-store", "keyval")), Gg; + return Gg || (Gg = E4("keyval-store", "keyval")), Gg; } -function G2(t, e = Ul()) { +function Y2(t, e = Ul()) { return e("readonly", (r) => bc(r.get(t))); } function nk(t, e, r = Ul()) { @@ -5776,10 +5776,10 @@ const fk = "idb-keyval"; var lk = (t = {}) => { const e = t.base && t.base.length > 0 ? `${t.base}:` : "", r = (i) => e + i; let n; - return t.dbName && t.storeName && (n = _4(t.dbName, t.storeName)), { name: fk, options: t, async hasItem(i) { - return !(typeof await G2(r(i), n) > "u"); + return t.dbName && t.storeName && (n = E4(t.dbName, t.storeName)), { name: fk, options: t, async hasItem(i) { + return !(typeof await Y2(r(i), n) > "u"); }, async getItem(i) { - return await G2(r(i), n) ?? null; + return await Y2(r(i), n) ?? null; }, setItem(i, s) { return nk(r(i), s, n); }, removeItem(i) { @@ -5859,9 +5859,9 @@ let mk = class { this.localStorage.removeItem(e); } }; -const vk = "wc_storage_version", Y2 = 1, bk = async (t, e, r) => { +const vk = "wc_storage_version", J2 = 1, bk = async (t, e, r) => { const n = vk, i = await e.getItem(n); - if (i && i >= Y2) { + if (i && i >= J2) { r(e); return; } @@ -5880,7 +5880,7 @@ const vk = "wc_storage_version", Y2 = 1, bk = async (t, e, r) => { await e.setItem(a, l), o.push(a); } } - await e.setItem(n, Y2), r(e), yk(t, o); + await e.setItem(n, J2), r(e), yk(t, o); }, yk = async (t, e) => { e.length && e.forEach(async (r) => { await t.removeItem(r); @@ -5989,7 +5989,7 @@ function Ek(t, e, r) { } return p === -1 ? t : (p < w && (l += t.slice(p)), l); } -const J2 = _k; +const X2 = _k; var Jc = Bo; const yl = Ok().console || {}, Sk = { mapHttpRequest: cd, @@ -6050,12 +6050,12 @@ function Bo(t) { N = N || {}, i && M.serializers && (N.serializers = M.serializers); const L = N.serializers; if (i && L) { - var B = Object.assign({}, n, L), $ = t.browser.serialize === !0 ? Object.keys(B) : i; - delete M.serializers, k0([M], $, B, this._stdErrSerialize); + var $ = Object.assign({}, n, L), B = t.browser.serialize === !0 ? Object.keys($) : i; + delete M.serializers, k0([M], B, $, this._stdErrSerialize); } - function H(W) { - this._childLevel = (W._childLevel | 0) + 1, this.error = Hc(W, M, "error"), this.fatal = Hc(W, M, "fatal"), this.warn = Hc(W, M, "warn"), this.info = Hc(W, M, "info"), this.debug = Hc(W, M, "debug"), this.trace = Hc(W, M, "trace"), B && (this.serializers = B, this._serialize = $), e && (this._logEvent = h1( - [].concat(W._logEvent.bindings, M) + function H(U) { + this._childLevel = (U._childLevel | 0) + 1, this.error = Hc(U, M, "error"), this.fatal = Hc(U, M, "fatal"), this.warn = Hc(U, M, "warn"), this.info = Hc(U, M, "info"), this.debug = Hc(U, M, "debug"), this.trace = Hc(U, M, "trace"), $ && (this.serializers = $, this._serialize = B), e && (this._logEvent = h1( + [].concat(U._logEvent.bindings, M) )); } return H.prototype = this, new H(this); @@ -6081,7 +6081,7 @@ Bo.levels = { } }; Bo.stdSerializers = Sk; -Bo.stdTimeFunctions = Object.assign({}, { nullTime: E4, epochTime: S4, unixTime: Rk, isoTime: Dk }); +Bo.stdTimeFunctions = Object.assign({}, { nullTime: S4, epochTime: A4, unixTime: Rk, isoTime: Dk }); function Wc(t, e, r, n) { const i = Object.getPrototypeOf(e); e[r] = e.levelVal > e.levels.values[r] ? wl : i[r] ? i[r] : yl[r] || yl[n] || wl, Pk(t, e, r); @@ -6115,8 +6115,8 @@ function Mk(t, e, r, n) { if (a < 1 && (a = 1), s !== null && typeof s == "object") { for (; a-- && typeof i[0] == "object"; ) Object.assign(o, i.shift()); - s = i.length ? J2(i.shift(), i) : void 0; - } else typeof s == "string" && (s = J2(i.shift(), i)); + s = i.length ? X2(i.shift(), i) : void 0; + } else typeof s == "string" && (s = X2(i.shift(), i)); return s !== void 0 && (o.msg = s), o; } function k0(t, e, r, n) { @@ -6166,7 +6166,7 @@ function Ck(t) { return e; } function Tk(t) { - return typeof t.timestamp == "function" ? t.timestamp : t.timestamp === !1 ? E4 : S4; + return typeof t.timestamp == "function" ? t.timestamp : t.timestamp === !1 ? S4 : A4; } function cd() { return {}; @@ -6176,10 +6176,10 @@ function Jg(t) { } function wl() { } -function E4() { +function S4() { return !1; } -function S4() { +function A4() { return Date.now(); } function Rk() { @@ -6203,7 +6203,7 @@ function Ok() { return t(self) || t(window) || t(this) || {}; } } -const ql = /* @__PURE__ */ ts(Jc), Nk = { level: "info" }, zl = "custom_context", Bv = 1e3 * 1024; +const ql = /* @__PURE__ */ ts(Jc), Nk = { level: "info" }, zl = "custom_context", Fv = 1e3 * 1024; let Lk = class { constructor(e) { this.nodeValue = e, this.sizeInBytes = new TextEncoder().encode(this.nodeValue).length, this.next = null; @@ -6214,7 +6214,7 @@ let Lk = class { get size() { return this.sizeInBytes; } -}, X2 = class { +}, Z2 = class { constructor(e) { this.head = null, this.tail = null, this.lengthInNodes = 0, this.maxSizeInBytes = e, this.sizeInBytes = 0; } @@ -6252,9 +6252,9 @@ let Lk = class { return e = e.next, { done: !1, value: r }; } }; } -}, A4 = class { - constructor(e, r = Bv) { - this.level = e ?? "error", this.levelValue = Jc.levels.values[this.level], this.MAX_LOG_SIZE_IN_BYTES = r, this.logs = new X2(this.MAX_LOG_SIZE_IN_BYTES); +}, P4 = class { + constructor(e, r = Fv) { + this.level = e ?? "error", this.levelValue = Jc.levels.values[this.level], this.MAX_LOG_SIZE_IN_BYTES = r, this.logs = new Z2(this.MAX_LOG_SIZE_IN_BYTES); } forwardToConsole(e, r) { r === Jc.levels.values.error ? console.error(e) : r === Jc.levels.values.warn ? console.warn(e) : r === Jc.levels.values.debug ? console.debug(e) : r === Jc.levels.values.trace ? console.trace(e) : console.log(e); @@ -6268,7 +6268,7 @@ let Lk = class { return this.logs; } clearLogs() { - this.logs = new X2(this.MAX_LOG_SIZE_IN_BYTES); + this.logs = new Z2(this.MAX_LOG_SIZE_IN_BYTES); } getLogArray() { return Array.from(this.logs); @@ -6278,8 +6278,8 @@ let Lk = class { return r.push($o({ extraMetadata: e })), new Blob(r, { type: "application/json" }); } }, kk = class { - constructor(e, r = Bv) { - this.baseChunkLogger = new A4(e, r); + constructor(e, r = Fv) { + this.baseChunkLogger = new P4(e, r); } write(e) { this.baseChunkLogger.appendToLogs(e); @@ -6301,8 +6301,8 @@ let Lk = class { n.href = r, n.download = `walletconnect-logs-${(/* @__PURE__ */ new Date()).toISOString()}.txt`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(r); } }, $k = class { - constructor(e, r = Bv) { - this.baseChunkLogger = new A4(e, r); + constructor(e, r = Fv) { + this.baseChunkLogger = new P4(e, r); } write(e) { this.baseChunkLogger.appendToLogs(e); @@ -6320,9 +6320,9 @@ let Lk = class { return this.baseChunkLogger.logsToBlob(e); } }; -var Bk = Object.defineProperty, Fk = Object.defineProperties, jk = Object.getOwnPropertyDescriptors, Z2 = Object.getOwnPropertySymbols, Uk = Object.prototype.hasOwnProperty, qk = Object.prototype.propertyIsEnumerable, Q2 = (t, e, r) => e in t ? Bk(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Jd = (t, e) => { - for (var r in e || (e = {})) Uk.call(e, r) && Q2(t, r, e[r]); - if (Z2) for (var r of Z2(e)) qk.call(e, r) && Q2(t, r, e[r]); +var Bk = Object.defineProperty, Fk = Object.defineProperties, jk = Object.getOwnPropertyDescriptors, Q2 = Object.getOwnPropertySymbols, Uk = Object.prototype.hasOwnProperty, qk = Object.prototype.propertyIsEnumerable, ex = (t, e, r) => e in t ? Bk(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Jd = (t, e) => { + for (var r in e || (e = {})) Uk.call(e, r) && ex(t, r, e[r]); + if (Q2) for (var r of Q2(e)) qk.call(e, r) && ex(t, r, e[r]); return t; }, Xd = (t, e) => Fk(t, jk(e)); function $0(t) { @@ -6342,7 +6342,7 @@ function Hk(t, e, r = zl) { const n = Ai(t, r); return n.trim() ? `${n}/${e}` : e; } -function ci(t, e, r = zl) { +function ui(t, e, r = zl) { const n = Hk(t, e, r), i = t.child({ context: n }); return Wk(i, n, r); } @@ -6412,10 +6412,10 @@ let Yk = class extends vc { this.client = e; } }; -var Fv = {}, Pa = {}, B0 = {}, F0 = {}; +var jv = {}, Pa = {}, B0 = {}, F0 = {}; Object.defineProperty(F0, "__esModule", { value: !0 }); F0.BrowserRandomSource = void 0; -const ex = 65536; +const tx = 65536; class c$ { constructor() { this.isAvailable = !1, this.isInstantiated = !1; @@ -6426,13 +6426,13 @@ class c$ { if (!this.isAvailable || !this._crypto) throw new Error("Browser random byte generator is not available."); const r = new Uint8Array(e); - for (let n = 0; n < r.length; n += ex) - this._crypto.getRandomValues(r.subarray(n, n + Math.min(r.length - n, ex))); + for (let n = 0; n < r.length; n += tx) + this._crypto.getRandomValues(r.subarray(n, n + Math.min(r.length - n, tx))); return r; } } F0.BrowserRandomSource = c$; -function P4(t) { +function M4(t) { throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } var j0 = {}, ki = {}; @@ -6446,13 +6446,13 @@ ki.wipe = u$; const f$ = {}, l$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: f$ -}, Symbol.toStringTag, { value: "Module" })), Wl = /* @__PURE__ */ yv(l$); +}, Symbol.toStringTag, { value: "Module" })), Wl = /* @__PURE__ */ wv(l$); Object.defineProperty(j0, "__esModule", { value: !0 }); j0.NodeRandomSource = void 0; const h$ = ki; class d$ { constructor() { - if (this.isAvailable = !1, this.isInstantiated = !1, typeof P4 < "u") { + if (this.isAvailable = !1, this.isInstantiated = !1, typeof M4 < "u") { const e = Wl; e && e.randomBytes && (this._crypto = e, this.isAvailable = !0, this.isInstantiated = !0); } @@ -6491,7 +6491,7 @@ class m$ { } } B0.SystemRandomSource = m$; -var ar = {}, M4 = {}; +var ar = {}, I4 = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); function e(a, u) { @@ -6521,9 +6521,9 @@ var ar = {}, M4 = {}; t.isInteger = Number.isInteger || o, t.MAX_SAFE_INTEGER = 9007199254740991, t.isSafeInteger = function(a) { return t.isInteger(a) && a >= -t.MAX_SAFE_INTEGER && a <= t.MAX_SAFE_INTEGER; }; -})(M4); +})(I4); Object.defineProperty(ar, "__esModule", { value: !0 }); -var I4 = M4; +var C4 = I4; function v$(t, e) { return e === void 0 && (e = 0), (t[e + 0] << 8 | t[e + 1]) << 16 >> 16; } @@ -6540,16 +6540,16 @@ function w$(t, e) { return e === void 0 && (e = 0), (t[e + 1] << 8 | t[e]) >>> 0; } ar.readUint16LE = w$; -function C4(t, e, r) { +function T4(t, e, r) { return e === void 0 && (e = new Uint8Array(2)), r === void 0 && (r = 0), e[r + 0] = t >>> 8, e[r + 1] = t >>> 0, e; } -ar.writeUint16BE = C4; -ar.writeInt16BE = C4; -function T4(t, e, r) { +ar.writeUint16BE = T4; +ar.writeInt16BE = T4; +function R4(t, e, r) { return e === void 0 && (e = new Uint8Array(2)), r === void 0 && (r = 0), e[r + 0] = t >>> 0, e[r + 1] = t >>> 8, e; } -ar.writeUint16LE = T4; -ar.writeInt16LE = T4; +ar.writeUint16LE = R4; +ar.writeInt16LE = R4; function d1(t, e) { return e === void 0 && (e = 0), t[e] << 24 | t[e + 1] << 16 | t[e + 2] << 8 | t[e + 3]; } @@ -6600,16 +6600,16 @@ function S$(t, e) { return n * 4294967296 + r; } ar.readUint64LE = S$; -function R4(t, e, r) { +function D4(t, e, r) { return e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0), Zd(t / 4294967296 >>> 0, e, r), Zd(t >>> 0, e, r + 4), e; } -ar.writeUint64BE = R4; -ar.writeInt64BE = R4; -function D4(t, e, r) { +ar.writeUint64BE = D4; +ar.writeInt64BE = D4; +function O4(t, e, r) { return e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0), Qd(t >>> 0, e, r), Qd(t / 4294967296 >>> 0, e, r + 4), e; } -ar.writeUint64LE = D4; -ar.writeInt64LE = D4; +ar.writeUint64LE = O4; +ar.writeInt64LE = O4; function A$(t, e, r) { if (r === void 0 && (r = 0), t % 8 !== 0) throw new Error("readUintBE supports only bitLengths divisible by 8"); @@ -6633,7 +6633,7 @@ ar.readUintLE = P$; function M$(t, e, r, n) { if (r === void 0 && (r = new Uint8Array(t / 8)), n === void 0 && (n = 0), t % 8 !== 0) throw new Error("writeUintBE supports only bitLengths divisible by 8"); - if (!I4.isSafeInteger(e)) + if (!C4.isSafeInteger(e)) throw new Error("writeUintBE value must be an integer"); for (var i = 1, s = t / 8 + n - 1; s >= n; s--) r[s] = e / i & 255, i *= 256; @@ -6643,7 +6643,7 @@ ar.writeUintBE = M$; function I$(t, e, r, n) { if (r === void 0 && (r = new Uint8Array(t / 8)), n === void 0 && (n = 0), t % 8 !== 0) throw new Error("writeUintLE supports only bitLengths divisible by 8"); - if (!I4.isSafeInteger(e)) + if (!C4.isSafeInteger(e)) throw new Error("writeUintLE value must be an integer"); for (var i = 1, s = n; s < n + t / 8; s++) r[s] = e / i & 255, i *= 256; @@ -6722,8 +6722,8 @@ ar.writeFloat64LE = k$; for (; l > 0; ) { const N = i(Math.ceil(l * 256 / M), p); for (let L = 0; L < N.length && l > 0; L++) { - const B = N[L]; - B < M && (w += d.charAt(B % A), l--); + const $ = N[L]; + $ < M && (w += d.charAt($ % A), l--); } (0, n.wipe)(N); } @@ -6736,7 +6736,7 @@ ar.writeFloat64LE = k$; } t.randomStringForEntropy = u; })(Pa); -var O4 = {}; +var N4 = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); var e = ar, r = ki; @@ -6960,18 +6960,18 @@ var O4 = {}; 1246189591 ]); function s(a, u, l, d, p, w, A) { - for (var M = l[0], N = l[1], L = l[2], B = l[3], $ = l[4], H = l[5], W = l[6], V = l[7], te = d[0], R = d[1], K = d[2], ge = d[3], Ee = d[4], Y = d[5], S = d[6], m = d[7], f, g, b, x, _, E, v, P; A >= 128; ) { + for (var M = l[0], N = l[1], L = l[2], $ = l[3], B = l[4], H = l[5], U = l[6], V = l[7], te = d[0], R = d[1], K = d[2], ge = d[3], Ee = d[4], Y = d[5], S = d[6], m = d[7], f, g, b, x, _, E, v, P; A >= 128; ) { for (var I = 0; I < 16; I++) { var F = 8 * I + w; a[I] = e.readUint32BE(p, F), u[I] = e.readUint32BE(p, F + 4); } for (var I = 0; I < 80; I++) { - var ce = M, D = N, oe = L, Z = B, J = $, Q = H, T = W, X = V, re = te, de = R, ie = K, ue = ge, ve = Ee, Pe = Y, De = S, Ce = m; - if (f = V, g = m, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = ($ >>> 14 | Ee << 18) ^ ($ >>> 18 | Ee << 14) ^ (Ee >>> 9 | $ << 23), g = (Ee >>> 14 | $ << 18) ^ (Ee >>> 18 | $ << 14) ^ ($ >>> 9 | Ee << 23), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = $ & H ^ ~$ & W, g = Ee & Y ^ ~Ee & S, _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = i[I * 2], g = i[I * 2 + 1], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = a[I % 16], g = u[I % 16], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, b = v & 65535 | P << 16, x = _ & 65535 | E << 16, f = b, g = x, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = (M >>> 28 | te << 4) ^ (te >>> 2 | M << 30) ^ (te >>> 7 | M << 25), g = (te >>> 28 | M << 4) ^ (M >>> 2 | te << 30) ^ (M >>> 7 | te << 25), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = M & N ^ M & L ^ N & L, g = te & R ^ te & K ^ R & K, _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, X = v & 65535 | P << 16, Ce = _ & 65535 | E << 16, f = Z, g = ue, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = b, g = x, _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, Z = v & 65535 | P << 16, ue = _ & 65535 | E << 16, N = ce, L = D, B = oe, $ = Z, H = J, W = Q, V = T, M = X, R = re, K = de, ge = ie, Ee = ue, Y = ve, S = Pe, m = De, te = Ce, I % 16 === 15) + var ce = M, D = N, oe = L, Z = $, J = B, Q = H, T = U, X = V, re = te, de = R, ie = K, ue = ge, ve = Ee, Pe = Y, De = S, Ce = m; + if (f = V, g = m, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = (B >>> 14 | Ee << 18) ^ (B >>> 18 | Ee << 14) ^ (Ee >>> 9 | B << 23), g = (Ee >>> 14 | B << 18) ^ (Ee >>> 18 | B << 14) ^ (B >>> 9 | Ee << 23), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = B & H ^ ~B & U, g = Ee & Y ^ ~Ee & S, _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = i[I * 2], g = i[I * 2 + 1], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = a[I % 16], g = u[I % 16], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, b = v & 65535 | P << 16, x = _ & 65535 | E << 16, f = b, g = x, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = (M >>> 28 | te << 4) ^ (te >>> 2 | M << 30) ^ (te >>> 7 | M << 25), g = (te >>> 28 | M << 4) ^ (M >>> 2 | te << 30) ^ (M >>> 7 | te << 25), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = M & N ^ M & L ^ N & L, g = te & R ^ te & K ^ R & K, _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, X = v & 65535 | P << 16, Ce = _ & 65535 | E << 16, f = Z, g = ue, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = b, g = x, _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, Z = v & 65535 | P << 16, ue = _ & 65535 | E << 16, N = ce, L = D, $ = oe, B = Z, H = J, U = Q, V = T, M = X, R = re, K = de, ge = ie, Ee = ue, Y = ve, S = Pe, m = De, te = Ce, I % 16 === 15) for (var F = 0; F < 16; F++) f = a[F], g = u[F], _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = a[(F + 9) % 16], g = u[(F + 9) % 16], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, b = a[(F + 1) % 16], x = u[(F + 1) % 16], f = (b >>> 1 | x << 31) ^ (b >>> 8 | x << 24) ^ b >>> 7, g = (x >>> 1 | b << 31) ^ (x >>> 8 | b << 24) ^ (x >>> 7 | b << 25), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, b = a[(F + 14) % 16], x = u[(F + 14) % 16], f = (b >>> 19 | x << 13) ^ (x >>> 29 | b << 3) ^ b >>> 6, g = (x >>> 19 | b << 13) ^ (b >>> 29 | x << 3) ^ (x >>> 6 | b << 26), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, a[F] = v & 65535 | P << 16, u[F] = _ & 65535 | E << 16; } - f = M, g = te, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[0], g = d[0], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[0] = M = v & 65535 | P << 16, d[0] = te = _ & 65535 | E << 16, f = N, g = R, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[1], g = d[1], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[1] = N = v & 65535 | P << 16, d[1] = R = _ & 65535 | E << 16, f = L, g = K, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[2], g = d[2], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[2] = L = v & 65535 | P << 16, d[2] = K = _ & 65535 | E << 16, f = B, g = ge, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[3], g = d[3], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[3] = B = v & 65535 | P << 16, d[3] = ge = _ & 65535 | E << 16, f = $, g = Ee, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[4], g = d[4], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[4] = $ = v & 65535 | P << 16, d[4] = Ee = _ & 65535 | E << 16, f = H, g = Y, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[5], g = d[5], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[5] = H = v & 65535 | P << 16, d[5] = Y = _ & 65535 | E << 16, f = W, g = S, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[6], g = d[6], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[6] = W = v & 65535 | P << 16, d[6] = S = _ & 65535 | E << 16, f = V, g = m, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[7], g = d[7], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[7] = V = v & 65535 | P << 16, d[7] = m = _ & 65535 | E << 16, w += 128, A -= 128; + f = M, g = te, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[0], g = d[0], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[0] = M = v & 65535 | P << 16, d[0] = te = _ & 65535 | E << 16, f = N, g = R, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[1], g = d[1], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[1] = N = v & 65535 | P << 16, d[1] = R = _ & 65535 | E << 16, f = L, g = K, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[2], g = d[2], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[2] = L = v & 65535 | P << 16, d[2] = K = _ & 65535 | E << 16, f = $, g = ge, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[3], g = d[3], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[3] = $ = v & 65535 | P << 16, d[3] = ge = _ & 65535 | E << 16, f = B, g = Ee, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[4], g = d[4], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[4] = B = v & 65535 | P << 16, d[4] = Ee = _ & 65535 | E << 16, f = H, g = Y, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[5], g = d[5], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[5] = H = v & 65535 | P << 16, d[5] = Y = _ & 65535 | E << 16, f = U, g = S, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[6], g = d[6], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[6] = U = v & 65535 | P << 16, d[6] = S = _ & 65535 | E << 16, f = V, g = m, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[7], g = d[7], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[7] = V = v & 65535 | P << 16, d[7] = m = _ & 65535 | E << 16, w += 128, A -= 128; } return w; } @@ -6982,10 +6982,10 @@ var O4 = {}; return u.clean(), l; } t.hash = o; -})(O4); +})(N4); (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.convertSecretKeyToX25519 = t.convertPublicKeyToX25519 = t.verify = t.sign = t.extractPublicKeyFromSecretKey = t.generateKeyPair = t.generateKeyPairFromSeed = t.SEED_LENGTH = t.SECRET_KEY_LENGTH = t.PUBLIC_KEY_LENGTH = t.SIGNATURE_LENGTH = void 0; - const e = Pa, r = O4, n = ki; + const e = Pa, r = N4, n = ki; t.SIGNATURE_LENGTH = 64, t.PUBLIC_KEY_LENGTH = 32, t.SECRET_KEY_LENGTH = 64, t.SEED_LENGTH = 32; function i(Z) { const J = new Float64Array(16); @@ -7117,21 +7117,21 @@ var O4 = {}; for (let X = 0; X < 16; X++) Z[2 * X] = T[X] & 255, Z[2 * X + 1] = T[X] >> 8; } - function B(Z, J) { + function $(Z, J) { let Q = 0; for (let T = 0; T < 32; T++) Q |= Z[T] ^ J[T]; return (1 & Q - 1 >>> 8) - 1; } - function $(Z, J) { + function B(Z, J) { const Q = new Uint8Array(32), T = new Uint8Array(32); - return L(Q, Z), L(T, J), B(Q, T); + return L(Q, Z), L(T, J), $(Q, T); } function H(Z) { const J = new Uint8Array(32); return L(J, Z), J[0] & 1; } - function W(Z, J) { + function U(Z, J) { for (let Q = 0; Q < 16; Q++) Z[Q] = J[2 * Q] + (J[2 * Q + 1] << 8); Z[15] &= 32767; @@ -7145,8 +7145,8 @@ var O4 = {}; Z[T] = J[T] - Q[T]; } function R(Z, J, Q) { - let T, X, re = 0, de = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = 0, Me = 0, Ne = 0, Ke = 0, Le = 0, qe = 0, ze = 0, _e = 0, Ze = 0, at = 0, ke = 0, Qe = 0, tt = 0, Ye = 0, dt = 0, lt = 0, ct = 0, qt = 0, Jt = 0, Et = 0, er = 0, Xt = 0, Dt = 0, kt = Q[0], Ct = Q[1], gt = Q[2], Rt = Q[3], Nt = Q[4], vt = Q[5], $t = Q[6], Ft = Q[7], rt = Q[8], Bt = Q[9], k = Q[10], U = Q[11], z = Q[12], C = Q[13], G = Q[14], j = Q[15]; - T = J[0], re += T * kt, de += T * Ct, ie += T * gt, ue += T * Rt, ve += T * Nt, Pe += T * vt, De += T * $t, Ce += T * Ft, $e += T * rt, Me += T * Bt, Ne += T * k, Ke += T * U, Le += T * z, qe += T * C, ze += T * G, _e += T * j, T = J[1], de += T * kt, ie += T * Ct, ue += T * gt, ve += T * Rt, Pe += T * Nt, De += T * vt, Ce += T * $t, $e += T * Ft, Me += T * rt, Ne += T * Bt, Ke += T * k, Le += T * U, qe += T * z, ze += T * C, _e += T * G, Ze += T * j, T = J[2], ie += T * kt, ue += T * Ct, ve += T * gt, Pe += T * Rt, De += T * Nt, Ce += T * vt, $e += T * $t, Me += T * Ft, Ne += T * rt, Ke += T * Bt, Le += T * k, qe += T * U, ze += T * z, _e += T * C, Ze += T * G, at += T * j, T = J[3], ue += T * kt, ve += T * Ct, Pe += T * gt, De += T * Rt, Ce += T * Nt, $e += T * vt, Me += T * $t, Ne += T * Ft, Ke += T * rt, Le += T * Bt, qe += T * k, ze += T * U, _e += T * z, Ze += T * C, at += T * G, ke += T * j, T = J[4], ve += T * kt, Pe += T * Ct, De += T * gt, Ce += T * Rt, $e += T * Nt, Me += T * vt, Ne += T * $t, Ke += T * Ft, Le += T * rt, qe += T * Bt, ze += T * k, _e += T * U, Ze += T * z, at += T * C, ke += T * G, Qe += T * j, T = J[5], Pe += T * kt, De += T * Ct, Ce += T * gt, $e += T * Rt, Me += T * Nt, Ne += T * vt, Ke += T * $t, Le += T * Ft, qe += T * rt, ze += T * Bt, _e += T * k, Ze += T * U, at += T * z, ke += T * C, Qe += T * G, tt += T * j, T = J[6], De += T * kt, Ce += T * Ct, $e += T * gt, Me += T * Rt, Ne += T * Nt, Ke += T * vt, Le += T * $t, qe += T * Ft, ze += T * rt, _e += T * Bt, Ze += T * k, at += T * U, ke += T * z, Qe += T * C, tt += T * G, Ye += T * j, T = J[7], Ce += T * kt, $e += T * Ct, Me += T * gt, Ne += T * Rt, Ke += T * Nt, Le += T * vt, qe += T * $t, ze += T * Ft, _e += T * rt, Ze += T * Bt, at += T * k, ke += T * U, Qe += T * z, tt += T * C, Ye += T * G, dt += T * j, T = J[8], $e += T * kt, Me += T * Ct, Ne += T * gt, Ke += T * Rt, Le += T * Nt, qe += T * vt, ze += T * $t, _e += T * Ft, Ze += T * rt, at += T * Bt, ke += T * k, Qe += T * U, tt += T * z, Ye += T * C, dt += T * G, lt += T * j, T = J[9], Me += T * kt, Ne += T * Ct, Ke += T * gt, Le += T * Rt, qe += T * Nt, ze += T * vt, _e += T * $t, Ze += T * Ft, at += T * rt, ke += T * Bt, Qe += T * k, tt += T * U, Ye += T * z, dt += T * C, lt += T * G, ct += T * j, T = J[10], Ne += T * kt, Ke += T * Ct, Le += T * gt, qe += T * Rt, ze += T * Nt, _e += T * vt, Ze += T * $t, at += T * Ft, ke += T * rt, Qe += T * Bt, tt += T * k, Ye += T * U, dt += T * z, lt += T * C, ct += T * G, qt += T * j, T = J[11], Ke += T * kt, Le += T * Ct, qe += T * gt, ze += T * Rt, _e += T * Nt, Ze += T * vt, at += T * $t, ke += T * Ft, Qe += T * rt, tt += T * Bt, Ye += T * k, dt += T * U, lt += T * z, ct += T * C, qt += T * G, Jt += T * j, T = J[12], Le += T * kt, qe += T * Ct, ze += T * gt, _e += T * Rt, Ze += T * Nt, at += T * vt, ke += T * $t, Qe += T * Ft, tt += T * rt, Ye += T * Bt, dt += T * k, lt += T * U, ct += T * z, qt += T * C, Jt += T * G, Et += T * j, T = J[13], qe += T * kt, ze += T * Ct, _e += T * gt, Ze += T * Rt, at += T * Nt, ke += T * vt, Qe += T * $t, tt += T * Ft, Ye += T * rt, dt += T * Bt, lt += T * k, ct += T * U, qt += T * z, Jt += T * C, Et += T * G, er += T * j, T = J[14], ze += T * kt, _e += T * Ct, Ze += T * gt, at += T * Rt, ke += T * Nt, Qe += T * vt, tt += T * $t, Ye += T * Ft, dt += T * rt, lt += T * Bt, ct += T * k, qt += T * U, Jt += T * z, Et += T * C, er += T * G, Xt += T * j, T = J[15], _e += T * kt, Ze += T * Ct, at += T * gt, ke += T * Rt, Qe += T * Nt, tt += T * vt, Ye += T * $t, dt += T * Ft, lt += T * rt, ct += T * Bt, qt += T * k, Jt += T * U, Et += T * z, er += T * C, Xt += T * G, Dt += T * j, re += 38 * Ze, de += 38 * at, ie += 38 * ke, ue += 38 * Qe, ve += 38 * tt, Pe += 38 * Ye, De += 38 * dt, Ce += 38 * lt, $e += 38 * ct, Me += 38 * qt, Ne += 38 * Jt, Ke += 38 * Et, Le += 38 * er, qe += 38 * Xt, ze += 38 * Dt, X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = de + X + 65535, X = Math.floor(T / 65536), de = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = de + X + 65535, X = Math.floor(T / 65536), de = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), Z[0] = re, Z[1] = de, Z[2] = ie, Z[3] = ue, Z[4] = ve, Z[5] = Pe, Z[6] = De, Z[7] = Ce, Z[8] = $e, Z[9] = Me, Z[10] = Ne, Z[11] = Ke, Z[12] = Le, Z[13] = qe, Z[14] = ze, Z[15] = _e; + let T, X, re = 0, de = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = 0, Me = 0, Ne = 0, Ke = 0, Le = 0, qe = 0, ze = 0, _e = 0, Ze = 0, at = 0, ke = 0, Qe = 0, tt = 0, Ye = 0, dt = 0, lt = 0, ct = 0, qt = 0, Jt = 0, Et = 0, er = 0, Xt = 0, Dt = 0, kt = Q[0], Ct = Q[1], gt = Q[2], Rt = Q[3], Nt = Q[4], vt = Q[5], $t = Q[6], Ft = Q[7], rt = Q[8], Bt = Q[9], k = Q[10], q = Q[11], W = Q[12], C = Q[13], G = Q[14], j = Q[15]; + T = J[0], re += T * kt, de += T * Ct, ie += T * gt, ue += T * Rt, ve += T * Nt, Pe += T * vt, De += T * $t, Ce += T * Ft, $e += T * rt, Me += T * Bt, Ne += T * k, Ke += T * q, Le += T * W, qe += T * C, ze += T * G, _e += T * j, T = J[1], de += T * kt, ie += T * Ct, ue += T * gt, ve += T * Rt, Pe += T * Nt, De += T * vt, Ce += T * $t, $e += T * Ft, Me += T * rt, Ne += T * Bt, Ke += T * k, Le += T * q, qe += T * W, ze += T * C, _e += T * G, Ze += T * j, T = J[2], ie += T * kt, ue += T * Ct, ve += T * gt, Pe += T * Rt, De += T * Nt, Ce += T * vt, $e += T * $t, Me += T * Ft, Ne += T * rt, Ke += T * Bt, Le += T * k, qe += T * q, ze += T * W, _e += T * C, Ze += T * G, at += T * j, T = J[3], ue += T * kt, ve += T * Ct, Pe += T * gt, De += T * Rt, Ce += T * Nt, $e += T * vt, Me += T * $t, Ne += T * Ft, Ke += T * rt, Le += T * Bt, qe += T * k, ze += T * q, _e += T * W, Ze += T * C, at += T * G, ke += T * j, T = J[4], ve += T * kt, Pe += T * Ct, De += T * gt, Ce += T * Rt, $e += T * Nt, Me += T * vt, Ne += T * $t, Ke += T * Ft, Le += T * rt, qe += T * Bt, ze += T * k, _e += T * q, Ze += T * W, at += T * C, ke += T * G, Qe += T * j, T = J[5], Pe += T * kt, De += T * Ct, Ce += T * gt, $e += T * Rt, Me += T * Nt, Ne += T * vt, Ke += T * $t, Le += T * Ft, qe += T * rt, ze += T * Bt, _e += T * k, Ze += T * q, at += T * W, ke += T * C, Qe += T * G, tt += T * j, T = J[6], De += T * kt, Ce += T * Ct, $e += T * gt, Me += T * Rt, Ne += T * Nt, Ke += T * vt, Le += T * $t, qe += T * Ft, ze += T * rt, _e += T * Bt, Ze += T * k, at += T * q, ke += T * W, Qe += T * C, tt += T * G, Ye += T * j, T = J[7], Ce += T * kt, $e += T * Ct, Me += T * gt, Ne += T * Rt, Ke += T * Nt, Le += T * vt, qe += T * $t, ze += T * Ft, _e += T * rt, Ze += T * Bt, at += T * k, ke += T * q, Qe += T * W, tt += T * C, Ye += T * G, dt += T * j, T = J[8], $e += T * kt, Me += T * Ct, Ne += T * gt, Ke += T * Rt, Le += T * Nt, qe += T * vt, ze += T * $t, _e += T * Ft, Ze += T * rt, at += T * Bt, ke += T * k, Qe += T * q, tt += T * W, Ye += T * C, dt += T * G, lt += T * j, T = J[9], Me += T * kt, Ne += T * Ct, Ke += T * gt, Le += T * Rt, qe += T * Nt, ze += T * vt, _e += T * $t, Ze += T * Ft, at += T * rt, ke += T * Bt, Qe += T * k, tt += T * q, Ye += T * W, dt += T * C, lt += T * G, ct += T * j, T = J[10], Ne += T * kt, Ke += T * Ct, Le += T * gt, qe += T * Rt, ze += T * Nt, _e += T * vt, Ze += T * $t, at += T * Ft, ke += T * rt, Qe += T * Bt, tt += T * k, Ye += T * q, dt += T * W, lt += T * C, ct += T * G, qt += T * j, T = J[11], Ke += T * kt, Le += T * Ct, qe += T * gt, ze += T * Rt, _e += T * Nt, Ze += T * vt, at += T * $t, ke += T * Ft, Qe += T * rt, tt += T * Bt, Ye += T * k, dt += T * q, lt += T * W, ct += T * C, qt += T * G, Jt += T * j, T = J[12], Le += T * kt, qe += T * Ct, ze += T * gt, _e += T * Rt, Ze += T * Nt, at += T * vt, ke += T * $t, Qe += T * Ft, tt += T * rt, Ye += T * Bt, dt += T * k, lt += T * q, ct += T * W, qt += T * C, Jt += T * G, Et += T * j, T = J[13], qe += T * kt, ze += T * Ct, _e += T * gt, Ze += T * Rt, at += T * Nt, ke += T * vt, Qe += T * $t, tt += T * Ft, Ye += T * rt, dt += T * Bt, lt += T * k, ct += T * q, qt += T * W, Jt += T * C, Et += T * G, er += T * j, T = J[14], ze += T * kt, _e += T * Ct, Ze += T * gt, at += T * Rt, ke += T * Nt, Qe += T * vt, tt += T * $t, Ye += T * Ft, dt += T * rt, lt += T * Bt, ct += T * k, qt += T * q, Jt += T * W, Et += T * C, er += T * G, Xt += T * j, T = J[15], _e += T * kt, Ze += T * Ct, at += T * gt, ke += T * Rt, Qe += T * Nt, tt += T * vt, Ye += T * $t, dt += T * Ft, lt += T * rt, ct += T * Bt, qt += T * k, Jt += T * q, Et += T * W, er += T * C, Xt += T * G, Dt += T * j, re += 38 * Ze, de += 38 * at, ie += 38 * ke, ue += 38 * Qe, ve += 38 * tt, Pe += 38 * Ye, De += 38 * dt, Ce += 38 * lt, $e += 38 * ct, Me += 38 * qt, Ne += 38 * Jt, Ke += 38 * Et, Le += 38 * er, qe += 38 * Xt, ze += 38 * Dt, X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = de + X + 65535, X = Math.floor(T / 65536), de = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = de + X + 65535, X = Math.floor(T / 65536), de = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), Z[0] = re, Z[1] = de, Z[2] = ie, Z[3] = ue, Z[4] = ve, Z[5] = Pe, Z[6] = De, Z[7] = Ce, Z[8] = $e, Z[9] = Me, Z[10] = Ne, Z[11] = Ke, Z[12] = Le, Z[13] = qe, Z[14] = ze, Z[15] = _e; } function K(Z, J) { R(Z, J, J); @@ -7296,7 +7296,7 @@ var O4 = {}; t.sign = I; function F(Z, J) { const Q = i(), T = i(), X = i(), re = i(), de = i(), ie = i(), ue = i(); - return A(Z[2], a), W(Z[1], J), K(X, Z[1]), R(re, X, u), te(X, X, Z[2]), V(re, Z[2], re), K(de, re), K(ie, de), R(ue, ie, de), R(Q, ue, X), R(Q, Q, re), Ee(Q, Q), R(Q, Q, X), R(Q, Q, re), R(Q, Q, re), R(Z[0], Q, re), K(T, Z[0]), R(T, T, re), $(T, X) && R(Z[0], Z[0], w), K(T, Z[0]), R(T, T, re), $(T, X) ? -1 : (H(Z[0]) === J[31] >> 7 && te(Z[0], o, Z[0]), R(Z[3], Z[0], Z[1]), 0); + return A(Z[2], a), U(Z[1], J), K(X, Z[1]), R(re, X, u), te(X, X, Z[2]), V(re, Z[2], re), K(de, re), K(ie, de), R(ue, ie, de), R(Q, ue, X), R(Q, Q, re), Ee(Q, Q), R(Q, Q, X), R(Q, Q, re), R(Q, Q, re), R(Z[0], Q, re), K(T, Z[0]), R(T, T, re), B(T, X) && R(Z[0], Z[0], w), K(T, Z[0]), R(T, T, re), B(T, X) ? -1 : (H(Z[0]) === J[31] >> 7 && te(Z[0], o, Z[0]), R(Z[3], Z[0], Z[1]), 0); } function ce(Z, J, Q) { const T = new Uint8Array(32), X = [i(), i(), i(), i()], re = [i(), i(), i(), i()]; @@ -7307,7 +7307,7 @@ var O4 = {}; const de = new r.SHA512(); de.update(Q.subarray(0, 32)), de.update(Z), de.update(J); const ie = de.digest(); - return P(ie), f(X, re, ie), g(re, Q.subarray(32)), Y(X, re), m(T, X), !B(Q, T); + return P(ie), f(X, re, ie), g(re, Q.subarray(32)), Y(X, re), m(T, X), !$(Q, T); } t.verify = ce; function D(Z) { @@ -7327,14 +7327,14 @@ var O4 = {}; return (0, n.wipe)(J), Q; } t.convertSecretKeyToX25519 = oe; -})(Fv); -const $$ = "EdDSA", B$ = "JWT", e0 = ".", U0 = "base64url", N4 = "utf8", L4 = "utf8", F$ = ":", j$ = "did", U$ = "key", tx = "base58btc", q$ = "z", z$ = "K36", W$ = 32; -function k4(t = 0) { +})(jv); +const $$ = "EdDSA", B$ = "JWT", e0 = ".", U0 = "base64url", L4 = "utf8", k4 = "utf8", F$ = ":", j$ = "did", U$ = "key", rx = "base58btc", q$ = "z", z$ = "K36", W$ = 32; +function $4(t = 0) { return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); } function Sd(t, e) { e || (e = t.reduce((i, s) => i + s.length, 0)); - const r = k4(e); + const r = $4(e); let n = 0; for (const i of t) r.set(i, n), n += i.length; @@ -7357,19 +7357,19 @@ function H$(t, e) { throw new TypeError("Expected Uint8Array"); if (M.length === 0) return ""; - for (var N = 0, L = 0, B = 0, $ = M.length; B !== $ && M[B] === 0; ) - B++, N++; - for (var H = ($ - B) * d + 1 >>> 0, W = new Uint8Array(H); B !== $; ) { - for (var V = M[B], te = 0, R = H - 1; (V !== 0 || te < L) && R !== -1; R--, te++) - V += 256 * W[R] >>> 0, W[R] = V % a >>> 0, V = V / a >>> 0; + for (var N = 0, L = 0, $ = 0, B = M.length; $ !== B && M[$] === 0; ) + $++, N++; + for (var H = (B - $) * d + 1 >>> 0, U = new Uint8Array(H); $ !== B; ) { + for (var V = M[$], te = 0, R = H - 1; (V !== 0 || te < L) && R !== -1; R--, te++) + V += 256 * U[R] >>> 0, U[R] = V % a >>> 0, V = V / a >>> 0; if (V !== 0) throw new Error("Non-zero carry"); - L = te, B++; + L = te, $++; } - for (var K = H - L; K !== H && W[K] === 0; ) + for (var K = H - L; K !== H && U[K] === 0; ) K++; for (var ge = u.repeat(N); K < H; ++K) - ge += t.charAt(W[K]); + ge += t.charAt(U[K]); return ge; } function w(M) { @@ -7379,22 +7379,22 @@ function H$(t, e) { return new Uint8Array(); var N = 0; if (M[N] !== " ") { - for (var L = 0, B = 0; M[N] === u; ) + for (var L = 0, $ = 0; M[N] === u; ) L++, N++; - for (var $ = (M.length - N) * l + 1 >>> 0, H = new Uint8Array($); M[N]; ) { - var W = r[M.charCodeAt(N)]; - if (W === 255) + for (var B = (M.length - N) * l + 1 >>> 0, H = new Uint8Array(B); M[N]; ) { + var U = r[M.charCodeAt(N)]; + if (U === 255) return; - for (var V = 0, te = $ - 1; (W !== 0 || V < B) && te !== -1; te--, V++) - W += a * H[te] >>> 0, H[te] = W % 256 >>> 0, W = W / 256 >>> 0; - if (W !== 0) + for (var V = 0, te = B - 1; (U !== 0 || V < $) && te !== -1; te--, V++) + U += a * H[te] >>> 0, H[te] = U % 256 >>> 0, U = U / 256 >>> 0; + if (U !== 0) throw new Error("Non-zero carry"); - B = V, N++; + $ = V, N++; } if (M[N] !== " ") { - for (var R = $ - B; R !== $ && H[R] === 0; ) + for (var R = B - $; R !== B && H[R] === 0; ) R++; - for (var K = new Uint8Array(L + ($ - R)), ge = L; R !== $; ) + for (var K = new Uint8Array(L + (B - R)), ge = L; R !== B; ) K[ge++] = H[R++]; return K; } @@ -7447,7 +7447,7 @@ class Z$ { throw Error("Can only multibase decode strings"); } or(e) { - return $4(this, e); + return B4(this, e); } } class Q$ { @@ -7455,7 +7455,7 @@ class Q$ { this.decoders = e; } or(e) { - return $4(this, e); + return B4(this, e); } decode(e) { const r = e[0], n = this.decoders[r]; @@ -7464,7 +7464,7 @@ class Q$ { throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`); } } -const $4 = (t, e) => new Q$({ +const B4 = (t, e) => new Q$({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); @@ -7675,7 +7675,7 @@ const q0 = ({ name: t, prefix: e, encode: r, decode: n }) => new eB(t, e, r, n), base64pad: RB, base64url: DB, base64urlpad: OB -}, Symbol.toStringTag, { value: "Module" })), B4 = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), LB = B4.reduce((t, e, r) => (t[r] = e, t), []), kB = B4.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); +}, Symbol.toStringTag, { value: "Module" })), F4 = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), LB = F4.reduce((t, e, r) => (t[r] = e, t), []), kB = F4.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); function $B(t) { return t.reduce((e, r) => (e += LB[r], e), ""); } @@ -7700,7 +7700,7 @@ const FB = q0({ }, Symbol.toStringTag, { value: "Module" })); new TextEncoder(); new TextDecoder(); -const rx = { +const nx = { ...iB, ...oB, ...cB, @@ -7712,7 +7712,7 @@ const rx = { ...NB, ...jB }; -function F4(t, e, r, n) { +function j4(t, e, r, n) { return { name: t, prefix: e, @@ -7724,46 +7724,46 @@ function F4(t, e, r, n) { decoder: { decode: n } }; } -const nx = F4("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), Xg = F4("ascii", "a", (t) => { +const ix = j4("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), Xg = j4("ascii", "a", (t) => { let e = "a"; for (let r = 0; r < t.length; r++) e += String.fromCharCode(t[r]); return e; }, (t) => { t = t.substring(1); - const e = k4(t.length); + const e = $4(t.length); for (let r = 0; r < t.length; r++) e[r] = t.charCodeAt(r); return e; -}), j4 = { - utf8: nx, - "utf-8": nx, - hex: rx.base16, +}), U4 = { + utf8: ix, + "utf-8": ix, + hex: nx.base16, latin1: Xg, ascii: Xg, binary: Xg, - ...rx + ...nx }; function On(t, e = "utf8") { - const r = j4[e]; + const r = U4[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t.buffer, t.byteOffset, t.byteLength).toString("utf8") : r.encoder.encode(t).substring(1); } function Rn(t, e = "utf8") { - const r = j4[e]; + const r = U4[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t, "utf8") : r.decoder.decode(`${r.prefix}${t}`); } -function ix(t) { - return fc(On(Rn(t, U0), N4)); +function sx(t) { + return fc(On(Rn(t, U0), L4)); } function t0(t) { - return On(Rn($o(t), N4), U0); + return On(Rn($o(t), L4), U0); } -function U4(t) { - const e = Rn(z$, tx), r = q$ + On(Sd([e, t]), tx); +function q4(t) { + const e = Rn(z$, rx), r = q$ + On(Sd([e, t]), rx); return [j$, U$, r].join(F$); } function UB(t) { @@ -7773,7 +7773,7 @@ function qB(t) { return Rn(t, U0); } function zB(t) { - return Rn([t0(t.header), t0(t.payload)].join(e0), L4); + return Rn([t0(t.header), t0(t.payload)].join(e0), k4); } function WB(t) { return [ @@ -7783,17 +7783,17 @@ function WB(t) { ].join(e0); } function v1(t) { - const e = t.split(e0), r = ix(e[0]), n = ix(e[1]), i = qB(e[2]), s = Rn(e.slice(0, 2).join(e0), L4); + const e = t.split(e0), r = sx(e[0]), n = sx(e[1]), i = qB(e[2]), s = Rn(e.slice(0, 2).join(e0), k4); return { header: r, payload: n, signature: i, data: s }; } -function sx(t = Pa.randomBytes(W$)) { - return Fv.generateKeyPairFromSeed(t); +function ox(t = Pa.randomBytes(W$)) { + return jv.generateKeyPairFromSeed(t); } async function HB(t, e, r, n, i = mt.fromMiliseconds(Date.now())) { - const s = { alg: $$, typ: B$ }, o = U4(n.publicKey), a = i + r, u = { iss: o, sub: t, aud: e, iat: i, exp: a }, l = zB({ header: s, payload: u }), d = Fv.sign(n.secretKey, l); + const s = { alg: $$, typ: B$ }, o = q4(n.publicKey), a = i + r, u = { iss: o, sub: t, aud: e, iat: i, exp: a }, l = zB({ header: s, payload: u }), d = jv.sign(n.secretKey, l); return WB({ header: s, payload: u, signature: d }); } -var ox = function(t, e, r) { +var ax = function(t, e, r) { if (r || arguments.length === 2) for (var n = 0, i = e.length, s; n < i; n++) (s || !(n in e)) && (s || (s = Array.prototype.slice.call(e, 0, n)), s[n] = e[n]); return t.concat(s || Array.prototype.slice.call(e)); @@ -7837,7 +7837,7 @@ var ox = function(t, e, r) { } return t; }() -), XB = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/, ZB = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, ax = 3, QB = [ +), XB = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/, ZB = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, cx = 3, QB = [ ["aol", /AOLShield\/([0-9\._]+)/], ["edge", /Edge\/([0-9\._]+)/], ["edge-ios", /EdgiOS\/([0-9\._]+)/], @@ -7876,7 +7876,7 @@ var ox = function(t, e, r) { ["ios-webview", /AppleWebKit\/([0-9\.]+).*Gecko\)$/], ["curl", /^curl\/([0-9\.]+)$/], ["searchbot", XB] -], cx = [ +], ux = [ ["iOS", /iP(hone|od|ad)/], ["Android OS", /Android/], ["BlackBerry OS", /BlackBerry|BB10/], @@ -7924,13 +7924,13 @@ function rF(t) { if (r === "searchbot") return new YB(); var i = n[1] && n[1].split(".").join("_").split("_").slice(0, 3); - i ? i.length < ax && (i = ox(ox([], i, !0), sF(ax - i.length), !0)) : i = []; + i ? i.length < cx && (i = ax(ax([], i, !0), sF(cx - i.length), !0)) : i = []; var s = i.join("."), o = nF(t), a = ZB.exec(t); return a && a[1] ? new GB(r, s, o, a[1]) : new KB(r, s, o); } function nF(t) { - for (var e = 0, r = cx.length; e < r; e++) { - var n = cx[e], i = n[0], s = n[1], o = s.exec(t); + for (var e = 0, r = ux.length; e < r; e++) { + var n = ux[e], i = n[0], s = n[1], o = s.exec(t); if (o) return i; } @@ -7947,7 +7947,7 @@ function sF(t) { } var Wr = {}; Object.defineProperty(Wr, "__esModule", { value: !0 }); -Wr.getLocalStorage = Wr.getLocalStorageOrThrow = Wr.getCrypto = Wr.getCryptoOrThrow = q4 = Wr.getLocation = Wr.getLocationOrThrow = jv = Wr.getNavigator = Wr.getNavigatorOrThrow = Kl = Wr.getDocument = Wr.getDocumentOrThrow = Wr.getFromWindowOrThrow = Wr.getFromWindow = void 0; +Wr.getLocalStorage = Wr.getLocalStorageOrThrow = Wr.getCrypto = Wr.getCryptoOrThrow = z4 = Wr.getLocation = Wr.getLocationOrThrow = Uv = Wr.getNavigator = Wr.getNavigatorOrThrow = Kl = Wr.getDocument = Wr.getDocumentOrThrow = Wr.getFromWindowOrThrow = Wr.getFromWindow = void 0; function yc(t) { let e; return typeof window < "u" && typeof window[t] < "u" && (e = window[t]), e; @@ -7975,7 +7975,7 @@ Wr.getNavigatorOrThrow = cF; function uF() { return yc("navigator"); } -var jv = Wr.getNavigator = uF; +var Uv = Wr.getNavigator = uF; function fF() { return Nu("location"); } @@ -7983,7 +7983,7 @@ Wr.getLocationOrThrow = fF; function lF() { return yc("location"); } -var q4 = Wr.getLocation = lF; +var z4 = Wr.getLocation = lF; function hF() { return Nu("crypto"); } @@ -8000,14 +8000,14 @@ function gF() { return yc("localStorage"); } Wr.getLocalStorage = gF; -var Uv = {}; -Object.defineProperty(Uv, "__esModule", { value: !0 }); -var z4 = Uv.getWindowMetadata = void 0; -const ux = Wr; +var qv = {}; +Object.defineProperty(qv, "__esModule", { value: !0 }); +var W4 = qv.getWindowMetadata = void 0; +const fx = Wr; function mF() { let t, e; try { - t = ux.getDocumentOrThrow(), e = ux.getLocationOrThrow(); + t = fx.getDocumentOrThrow(), e = fx.getLocationOrThrow(); } catch { return null; } @@ -8019,19 +8019,19 @@ function mF() { const L = M.getAttribute("href"); if (L) if (L.toLowerCase().indexOf("https:") === -1 && L.toLowerCase().indexOf("http:") === -1 && L.indexOf("//") !== 0) { - let B = e.protocol + "//" + e.host; + let $ = e.protocol + "//" + e.host; if (L.indexOf("/") === 0) - B += L; + $ += L; else { - const $ = e.pathname.split("/"); - $.pop(); - const H = $.join("/"); - B += H + "/" + L; + const B = e.pathname.split("/"); + B.pop(); + const H = B.join("/"); + $ += H + "/" + L; } - w.push(B); + w.push($); } else if (L.indexOf("//") === 0) { - const B = e.protocol + L; - w.push(B); + const $ = e.protocol + L; + w.push($); } else w.push(L); } @@ -8065,8 +8065,8 @@ function mF() { name: o }; } -z4 = Uv.getWindowMetadata = mF; -var xl = {}, vF = (t) => encodeURIComponent(t).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), W4 = "%[a-f0-9]{2}", fx = new RegExp("(" + W4 + ")|([^%]+?)", "gi"), lx = new RegExp("(" + W4 + ")+", "gi"); +W4 = qv.getWindowMetadata = mF; +var xl = {}, vF = (t) => encodeURIComponent(t).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), H4 = "%[a-f0-9]{2}", lx = new RegExp("(" + H4 + ")|([^%]+?)", "gi"), hx = new RegExp("(" + H4 + ")+", "gi"); function b1(t, e) { try { return [decodeURIComponent(t.join(""))]; @@ -8082,8 +8082,8 @@ function bF(t) { try { return decodeURIComponent(t); } catch { - for (var e = t.match(fx) || [], r = 1; r < e.length; r++) - t = b1(e, r).join(""), e = t.match(fx) || []; + for (var e = t.match(lx) || [], r = 1; r < e.length; r++) + t = b1(e, r).join(""), e = t.match(lx) || []; return t; } } @@ -8091,14 +8091,14 @@ function yF(t) { for (var e = { "%FE%FF": "��", "%FF%FE": "��" - }, r = lx.exec(t); r; ) { + }, r = hx.exec(t); r; ) { try { e[r[0]] = decodeURIComponent(r[0]); } catch { var n = bF(r[0]); n !== r[0] && (e[r[0]] = n); } - r = lx.exec(t); + r = hx.exec(t); } e["%C2"] = "�"; for (var i = Object.keys(e), s = 0; s < i.length; s++) { @@ -8133,129 +8133,129 @@ var wF = function(t) { return r; }; (function(t) { - const e = vF, r = wF, n = xF, i = _F, s = ($) => $ == null, o = Symbol("encodeFragmentIdentifier"); - function a($) { - switch ($.arrayFormat) { + const e = vF, r = wF, n = xF, i = _F, s = (B) => B == null, o = Symbol("encodeFragmentIdentifier"); + function a(B) { + switch (B.arrayFormat) { case "index": - return (H) => (W, V) => { - const te = W.length; - return V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? W : V === null ? [...W, [d(H, $), "[", te, "]"].join("")] : [ - ...W, - [d(H, $), "[", d(te, $), "]=", d(V, $)].join("") + return (H) => (U, V) => { + const te = U.length; + return V === void 0 || B.skipNull && V === null || B.skipEmptyString && V === "" ? U : V === null ? [...U, [d(H, B), "[", te, "]"].join("")] : [ + ...U, + [d(H, B), "[", d(te, B), "]=", d(V, B)].join("") ]; }; case "bracket": - return (H) => (W, V) => V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? W : V === null ? [...W, [d(H, $), "[]"].join("")] : [...W, [d(H, $), "[]=", d(V, $)].join("")]; + return (H) => (U, V) => V === void 0 || B.skipNull && V === null || B.skipEmptyString && V === "" ? U : V === null ? [...U, [d(H, B), "[]"].join("")] : [...U, [d(H, B), "[]=", d(V, B)].join("")]; case "colon-list-separator": - return (H) => (W, V) => V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? W : V === null ? [...W, [d(H, $), ":list="].join("")] : [...W, [d(H, $), ":list=", d(V, $)].join("")]; + return (H) => (U, V) => V === void 0 || B.skipNull && V === null || B.skipEmptyString && V === "" ? U : V === null ? [...U, [d(H, B), ":list="].join("")] : [...U, [d(H, B), ":list=", d(V, B)].join("")]; case "comma": case "separator": case "bracket-separator": { - const H = $.arrayFormat === "bracket-separator" ? "[]=" : "="; - return (W) => (V, te) => te === void 0 || $.skipNull && te === null || $.skipEmptyString && te === "" ? V : (te = te === null ? "" : te, V.length === 0 ? [[d(W, $), H, d(te, $)].join("")] : [[V, d(te, $)].join($.arrayFormatSeparator)]); + const H = B.arrayFormat === "bracket-separator" ? "[]=" : "="; + return (U) => (V, te) => te === void 0 || B.skipNull && te === null || B.skipEmptyString && te === "" ? V : (te = te === null ? "" : te, V.length === 0 ? [[d(U, B), H, d(te, B)].join("")] : [[V, d(te, B)].join(B.arrayFormatSeparator)]); } default: - return (H) => (W, V) => V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? W : V === null ? [...W, d(H, $)] : [...W, [d(H, $), "=", d(V, $)].join("")]; + return (H) => (U, V) => V === void 0 || B.skipNull && V === null || B.skipEmptyString && V === "" ? U : V === null ? [...U, d(H, B)] : [...U, [d(H, B), "=", d(V, B)].join("")]; } } - function u($) { + function u(B) { let H; - switch ($.arrayFormat) { + switch (B.arrayFormat) { case "index": - return (W, V, te) => { - if (H = /\[(\d*)\]$/.exec(W), W = W.replace(/\[\d*\]$/, ""), !H) { - te[W] = V; + return (U, V, te) => { + if (H = /\[(\d*)\]$/.exec(U), U = U.replace(/\[\d*\]$/, ""), !H) { + te[U] = V; return; } - te[W] === void 0 && (te[W] = {}), te[W][H[1]] = V; + te[U] === void 0 && (te[U] = {}), te[U][H[1]] = V; }; case "bracket": - return (W, V, te) => { - if (H = /(\[\])$/.exec(W), W = W.replace(/\[\]$/, ""), !H) { - te[W] = V; + return (U, V, te) => { + if (H = /(\[\])$/.exec(U), U = U.replace(/\[\]$/, ""), !H) { + te[U] = V; return; } - if (te[W] === void 0) { - te[W] = [V]; + if (te[U] === void 0) { + te[U] = [V]; return; } - te[W] = [].concat(te[W], V); + te[U] = [].concat(te[U], V); }; case "colon-list-separator": - return (W, V, te) => { - if (H = /(:list)$/.exec(W), W = W.replace(/:list$/, ""), !H) { - te[W] = V; + return (U, V, te) => { + if (H = /(:list)$/.exec(U), U = U.replace(/:list$/, ""), !H) { + te[U] = V; return; } - if (te[W] === void 0) { - te[W] = [V]; + if (te[U] === void 0) { + te[U] = [V]; return; } - te[W] = [].concat(te[W], V); + te[U] = [].concat(te[U], V); }; case "comma": case "separator": - return (W, V, te) => { - const R = typeof V == "string" && V.includes($.arrayFormatSeparator), K = typeof V == "string" && !R && p(V, $).includes($.arrayFormatSeparator); - V = K ? p(V, $) : V; - const ge = R || K ? V.split($.arrayFormatSeparator).map((Ee) => p(Ee, $)) : V === null ? V : p(V, $); - te[W] = ge; + return (U, V, te) => { + const R = typeof V == "string" && V.includes(B.arrayFormatSeparator), K = typeof V == "string" && !R && p(V, B).includes(B.arrayFormatSeparator); + V = K ? p(V, B) : V; + const ge = R || K ? V.split(B.arrayFormatSeparator).map((Ee) => p(Ee, B)) : V === null ? V : p(V, B); + te[U] = ge; }; case "bracket-separator": - return (W, V, te) => { - const R = /(\[\])$/.test(W); - if (W = W.replace(/\[\]$/, ""), !R) { - te[W] = V && p(V, $); + return (U, V, te) => { + const R = /(\[\])$/.test(U); + if (U = U.replace(/\[\]$/, ""), !R) { + te[U] = V && p(V, B); return; } - const K = V === null ? [] : V.split($.arrayFormatSeparator).map((ge) => p(ge, $)); - if (te[W] === void 0) { - te[W] = K; + const K = V === null ? [] : V.split(B.arrayFormatSeparator).map((ge) => p(ge, B)); + if (te[U] === void 0) { + te[U] = K; return; } - te[W] = [].concat(te[W], K); + te[U] = [].concat(te[U], K); }; default: - return (W, V, te) => { - if (te[W] === void 0) { - te[W] = V; + return (U, V, te) => { + if (te[U] === void 0) { + te[U] = V; return; } - te[W] = [].concat(te[W], V); + te[U] = [].concat(te[U], V); }; } } - function l($) { - if (typeof $ != "string" || $.length !== 1) + function l(B) { + if (typeof B != "string" || B.length !== 1) throw new TypeError("arrayFormatSeparator must be single character string"); } - function d($, H) { - return H.encode ? H.strict ? e($) : encodeURIComponent($) : $; + function d(B, H) { + return H.encode ? H.strict ? e(B) : encodeURIComponent(B) : B; } - function p($, H) { - return H.decode ? r($) : $; + function p(B, H) { + return H.decode ? r(B) : B; } - function w($) { - return Array.isArray($) ? $.sort() : typeof $ == "object" ? w(Object.keys($)).sort((H, W) => Number(H) - Number(W)).map((H) => $[H]) : $; + function w(B) { + return Array.isArray(B) ? B.sort() : typeof B == "object" ? w(Object.keys(B)).sort((H, U) => Number(H) - Number(U)).map((H) => B[H]) : B; } - function A($) { - const H = $.indexOf("#"); - return H !== -1 && ($ = $.slice(0, H)), $; + function A(B) { + const H = B.indexOf("#"); + return H !== -1 && (B = B.slice(0, H)), B; } - function M($) { + function M(B) { let H = ""; - const W = $.indexOf("#"); - return W !== -1 && (H = $.slice(W)), H; + const U = B.indexOf("#"); + return U !== -1 && (H = B.slice(U)), H; } - function N($) { - $ = A($); - const H = $.indexOf("?"); - return H === -1 ? "" : $.slice(H + 1); + function N(B) { + B = A(B); + const H = B.indexOf("?"); + return H === -1 ? "" : B.slice(H + 1); } - function L($, H) { - return H.parseNumbers && !Number.isNaN(Number($)) && typeof $ == "string" && $.trim() !== "" ? $ = Number($) : H.parseBooleans && $ !== null && ($.toLowerCase() === "true" || $.toLowerCase() === "false") && ($ = $.toLowerCase() === "true"), $; + function L(B, H) { + return H.parseNumbers && !Number.isNaN(Number(B)) && typeof B == "string" && B.trim() !== "" ? B = Number(B) : H.parseBooleans && B !== null && (B.toLowerCase() === "true" || B.toLowerCase() === "false") && (B = B.toLowerCase() === "true"), B; } - function B($, H) { + function $(B, H) { H = Object.assign({ decode: !0, sort: !0, @@ -8264,14 +8264,14 @@ var wF = function(t) { parseNumbers: !1, parseBooleans: !1 }, H), l(H.arrayFormatSeparator); - const W = u(H), V = /* @__PURE__ */ Object.create(null); - if (typeof $ != "string" || ($ = $.trim().replace(/^[?#&]/, ""), !$)) + const U = u(H), V = /* @__PURE__ */ Object.create(null); + if (typeof B != "string" || (B = B.trim().replace(/^[?#&]/, ""), !B)) return V; - for (const te of $.split("&")) { + for (const te of B.split("&")) { if (te === "") continue; let [R, K] = n(H.decode ? te.replace(/\+/g, " ") : te, "="); - K = K === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(H.arrayFormat) ? K : p(K, H), W(p(R, H), K, V); + K = K === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(H.arrayFormat) ? K : p(K, H), U(p(R, H), K, V); } for (const te of Object.keys(V)) { const R = V[te]; @@ -8286,8 +8286,8 @@ var wF = function(t) { return K && typeof K == "object" && !Array.isArray(K) ? te[R] = w(K) : te[R] = K, te; }, /* @__PURE__ */ Object.create(null)); } - t.extract = N, t.parse = B, t.stringify = ($, H) => { - if (!$) + t.extract = N, t.parse = $, t.stringify = (B, H) => { + if (!B) return ""; H = Object.assign({ encode: !0, @@ -8295,54 +8295,54 @@ var wF = function(t) { arrayFormat: "none", arrayFormatSeparator: "," }, H), l(H.arrayFormatSeparator); - const W = (K) => H.skipNull && s($[K]) || H.skipEmptyString && $[K] === "", V = a(H), te = {}; - for (const K of Object.keys($)) - W(K) || (te[K] = $[K]); + const U = (K) => H.skipNull && s(B[K]) || H.skipEmptyString && B[K] === "", V = a(H), te = {}; + for (const K of Object.keys(B)) + U(K) || (te[K] = B[K]); const R = Object.keys(te); return H.sort !== !1 && R.sort(H.sort), R.map((K) => { - const ge = $[K]; + const ge = B[K]; return ge === void 0 ? "" : ge === null ? d(K, H) : Array.isArray(ge) ? ge.length === 0 && H.arrayFormat === "bracket-separator" ? d(K, H) + "[]" : ge.reduce(V(K), []).join("&") : d(K, H) + "=" + d(ge, H); }).filter((K) => K.length > 0).join("&"); - }, t.parseUrl = ($, H) => { + }, t.parseUrl = (B, H) => { H = Object.assign({ decode: !0 }, H); - const [W, V] = n($, "#"); + const [U, V] = n(B, "#"); return Object.assign( { - url: W.split("?")[0] || "", - query: B(N($), H) + url: U.split("?")[0] || "", + query: $(N(B), H) }, H && H.parseFragmentIdentifier && V ? { fragmentIdentifier: p(V, H) } : {} ); - }, t.stringifyUrl = ($, H) => { + }, t.stringifyUrl = (B, H) => { H = Object.assign({ encode: !0, strict: !0, [o]: !0 }, H); - const W = A($.url).split("?")[0] || "", V = t.extract($.url), te = t.parse(V, { sort: !1 }), R = Object.assign(te, $.query); + const U = A(B.url).split("?")[0] || "", V = t.extract(B.url), te = t.parse(V, { sort: !1 }), R = Object.assign(te, B.query); let K = t.stringify(R, H); K && (K = `?${K}`); - let ge = M($.url); - return $.fragmentIdentifier && (ge = `#${H[o] ? d($.fragmentIdentifier, H) : $.fragmentIdentifier}`), `${W}${K}${ge}`; - }, t.pick = ($, H, W) => { - W = Object.assign({ + let ge = M(B.url); + return B.fragmentIdentifier && (ge = `#${H[o] ? d(B.fragmentIdentifier, H) : B.fragmentIdentifier}`), `${U}${K}${ge}`; + }, t.pick = (B, H, U) => { + U = Object.assign({ parseFragmentIdentifier: !0, [o]: !1 - }, W); - const { url: V, query: te, fragmentIdentifier: R } = t.parseUrl($, W); + }, U); + const { url: V, query: te, fragmentIdentifier: R } = t.parseUrl(B, U); return t.stringifyUrl({ url: V, query: i(te, H), fragmentIdentifier: R - }, W); - }, t.exclude = ($, H, W) => { + }, U); + }, t.exclude = (B, H, U) => { const V = Array.isArray(H) ? (te) => !H.includes(te) : (te, R) => !H(te, R); - return t.pick($, V, W); + return t.pick(B, V, U); }; })(xl); -var H4 = { exports: {} }; +var K4 = { exports: {} }; /** * [js-sha3]{@link https://github.com/emn178/js-sha3} * @@ -8406,7 +8406,7 @@ var H4 = { exports: {} }; 0, 2147516424, 2147483648 - ], L = [224, 256, 384, 512], B = [128, 256], $ = ["hex", "buffer", "arrayBuffer", "array", "digest"], H = { + ], L = [224, 256, 384, 512], $ = [128, 256], B = ["hex", "buffer", "arrayBuffer", "array", "digest"], H = { 128: 168, 256: 136 }; @@ -8415,7 +8415,7 @@ var H4 = { exports: {} }; }), u && (i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView) && (ArrayBuffer.isView = function(D) { return typeof D == "object" && D.buffer && D.buffer.constructor === ArrayBuffer; }); - for (var W = function(D, oe, Z) { + for (var U = function(D, oe, Z) { return function(J) { return new I(D, oe, D).update(J)[Z](); }; @@ -8432,18 +8432,18 @@ var H4 = { exports: {} }; return f["kmac" + D].update(J, Q, T, X)[Z](); }; }, K = function(D, oe, Z, J) { - for (var Q = 0; Q < $.length; ++Q) { - var T = $[Q]; + for (var Q = 0; Q < B.length; ++Q) { + var T = B[Q]; D[T] = oe(Z, J, T); } return D; }, ge = function(D, oe) { - var Z = W(D, oe, "hex"); + var Z = U(D, oe, "hex"); return Z.create = function() { return new I(D, oe, D); }, Z.update = function(J) { return Z.create().update(J); - }, K(Z, W, D, oe); + }, K(Z, U, D, oe); }, Ee = function(D, oe) { var Z = V(D, oe, "hex"); return Z.create = function(J) { @@ -8468,9 +8468,9 @@ var H4 = { exports: {} }; }, m = [ { name: "keccak", padding: w, bits: L, createMethod: ge }, { name: "sha3", padding: A, bits: L, createMethod: ge }, - { name: "shake", padding: d, bits: B, createMethod: Ee }, - { name: "cshake", padding: p, bits: B, createMethod: Y }, - { name: "kmac", padding: p, bits: B, createMethod: S } + { name: "shake", padding: d, bits: $, createMethod: Ee }, + { name: "cshake", padding: p, bits: $, createMethod: Y }, + { name: "kmac", padding: p, bits: $, createMethod: S } ], f = {}, g = [], b = 0; b < m.length; ++b) for (var x = m[b], _ = x.bits, E = 0; E < _.length; ++E) { var v = x.name + "_" + _[E]; @@ -8596,9 +8596,9 @@ var H4 = { exports: {} }; return this.encode(this.outputBits, !0), I.prototype.finalize.call(this); }; var ce = function(D) { - var oe, Z, J, Q, T, X, re, de, ie, ue, ve, Pe, De, Ce, $e, Me, Ne, Ke, Le, qe, ze, _e, Ze, at, ke, Qe, tt, Ye, dt, lt, ct, qt, Jt, Et, er, Xt, Dt, kt, Ct, gt, Rt, Nt, vt, $t, Ft, rt, Bt, k, U, z, C, G, j, se, he, xe, Te, Re, nt, je, pt, it, et; + var oe, Z, J, Q, T, X, re, de, ie, ue, ve, Pe, De, Ce, $e, Me, Ne, Ke, Le, qe, ze, _e, Ze, at, ke, Qe, tt, Ye, dt, lt, ct, qt, Jt, Et, er, Xt, Dt, kt, Ct, gt, Rt, Nt, vt, $t, Ft, rt, Bt, k, q, W, C, G, j, se, he, xe, Te, Re, nt, je, pt, it, et; for (J = 0; J < 48; J += 2) - Q = D[0] ^ D[10] ^ D[20] ^ D[30] ^ D[40], T = D[1] ^ D[11] ^ D[21] ^ D[31] ^ D[41], X = D[2] ^ D[12] ^ D[22] ^ D[32] ^ D[42], re = D[3] ^ D[13] ^ D[23] ^ D[33] ^ D[43], de = D[4] ^ D[14] ^ D[24] ^ D[34] ^ D[44], ie = D[5] ^ D[15] ^ D[25] ^ D[35] ^ D[45], ue = D[6] ^ D[16] ^ D[26] ^ D[36] ^ D[46], ve = D[7] ^ D[17] ^ D[27] ^ D[37] ^ D[47], Pe = D[8] ^ D[18] ^ D[28] ^ D[38] ^ D[48], De = D[9] ^ D[19] ^ D[29] ^ D[39] ^ D[49], oe = Pe ^ (X << 1 | re >>> 31), Z = De ^ (re << 1 | X >>> 31), D[0] ^= oe, D[1] ^= Z, D[10] ^= oe, D[11] ^= Z, D[20] ^= oe, D[21] ^= Z, D[30] ^= oe, D[31] ^= Z, D[40] ^= oe, D[41] ^= Z, oe = Q ^ (de << 1 | ie >>> 31), Z = T ^ (ie << 1 | de >>> 31), D[2] ^= oe, D[3] ^= Z, D[12] ^= oe, D[13] ^= Z, D[22] ^= oe, D[23] ^= Z, D[32] ^= oe, D[33] ^= Z, D[42] ^= oe, D[43] ^= Z, oe = X ^ (ue << 1 | ve >>> 31), Z = re ^ (ve << 1 | ue >>> 31), D[4] ^= oe, D[5] ^= Z, D[14] ^= oe, D[15] ^= Z, D[24] ^= oe, D[25] ^= Z, D[34] ^= oe, D[35] ^= Z, D[44] ^= oe, D[45] ^= Z, oe = de ^ (Pe << 1 | De >>> 31), Z = ie ^ (De << 1 | Pe >>> 31), D[6] ^= oe, D[7] ^= Z, D[16] ^= oe, D[17] ^= Z, D[26] ^= oe, D[27] ^= Z, D[36] ^= oe, D[37] ^= Z, D[46] ^= oe, D[47] ^= Z, oe = ue ^ (Q << 1 | T >>> 31), Z = ve ^ (T << 1 | Q >>> 31), D[8] ^= oe, D[9] ^= Z, D[18] ^= oe, D[19] ^= Z, D[28] ^= oe, D[29] ^= Z, D[38] ^= oe, D[39] ^= Z, D[48] ^= oe, D[49] ^= Z, Ce = D[0], $e = D[1], rt = D[11] << 4 | D[10] >>> 28, Bt = D[10] << 4 | D[11] >>> 28, Ye = D[20] << 3 | D[21] >>> 29, dt = D[21] << 3 | D[20] >>> 29, je = D[31] << 9 | D[30] >>> 23, pt = D[30] << 9 | D[31] >>> 23, Nt = D[40] << 18 | D[41] >>> 14, vt = D[41] << 18 | D[40] >>> 14, Et = D[2] << 1 | D[3] >>> 31, er = D[3] << 1 | D[2] >>> 31, Me = D[13] << 12 | D[12] >>> 20, Ne = D[12] << 12 | D[13] >>> 20, k = D[22] << 10 | D[23] >>> 22, U = D[23] << 10 | D[22] >>> 22, lt = D[33] << 13 | D[32] >>> 19, ct = D[32] << 13 | D[33] >>> 19, it = D[42] << 2 | D[43] >>> 30, et = D[43] << 2 | D[42] >>> 30, se = D[5] << 30 | D[4] >>> 2, he = D[4] << 30 | D[5] >>> 2, Xt = D[14] << 6 | D[15] >>> 26, Dt = D[15] << 6 | D[14] >>> 26, Ke = D[25] << 11 | D[24] >>> 21, Le = D[24] << 11 | D[25] >>> 21, z = D[34] << 15 | D[35] >>> 17, C = D[35] << 15 | D[34] >>> 17, qt = D[45] << 29 | D[44] >>> 3, Jt = D[44] << 29 | D[45] >>> 3, at = D[6] << 28 | D[7] >>> 4, ke = D[7] << 28 | D[6] >>> 4, xe = D[17] << 23 | D[16] >>> 9, Te = D[16] << 23 | D[17] >>> 9, kt = D[26] << 25 | D[27] >>> 7, Ct = D[27] << 25 | D[26] >>> 7, qe = D[36] << 21 | D[37] >>> 11, ze = D[37] << 21 | D[36] >>> 11, G = D[47] << 24 | D[46] >>> 8, j = D[46] << 24 | D[47] >>> 8, $t = D[8] << 27 | D[9] >>> 5, Ft = D[9] << 27 | D[8] >>> 5, Qe = D[18] << 20 | D[19] >>> 12, tt = D[19] << 20 | D[18] >>> 12, Re = D[29] << 7 | D[28] >>> 25, nt = D[28] << 7 | D[29] >>> 25, gt = D[38] << 8 | D[39] >>> 24, Rt = D[39] << 8 | D[38] >>> 24, _e = D[48] << 14 | D[49] >>> 18, Ze = D[49] << 14 | D[48] >>> 18, D[0] = Ce ^ ~Me & Ke, D[1] = $e ^ ~Ne & Le, D[10] = at ^ ~Qe & Ye, D[11] = ke ^ ~tt & dt, D[20] = Et ^ ~Xt & kt, D[21] = er ^ ~Dt & Ct, D[30] = $t ^ ~rt & k, D[31] = Ft ^ ~Bt & U, D[40] = se ^ ~xe & Re, D[41] = he ^ ~Te & nt, D[2] = Me ^ ~Ke & qe, D[3] = Ne ^ ~Le & ze, D[12] = Qe ^ ~Ye & lt, D[13] = tt ^ ~dt & ct, D[22] = Xt ^ ~kt & gt, D[23] = Dt ^ ~Ct & Rt, D[32] = rt ^ ~k & z, D[33] = Bt ^ ~U & C, D[42] = xe ^ ~Re & je, D[43] = Te ^ ~nt & pt, D[4] = Ke ^ ~qe & _e, D[5] = Le ^ ~ze & Ze, D[14] = Ye ^ ~lt & qt, D[15] = dt ^ ~ct & Jt, D[24] = kt ^ ~gt & Nt, D[25] = Ct ^ ~Rt & vt, D[34] = k ^ ~z & G, D[35] = U ^ ~C & j, D[44] = Re ^ ~je & it, D[45] = nt ^ ~pt & et, D[6] = qe ^ ~_e & Ce, D[7] = ze ^ ~Ze & $e, D[16] = lt ^ ~qt & at, D[17] = ct ^ ~Jt & ke, D[26] = gt ^ ~Nt & Et, D[27] = Rt ^ ~vt & er, D[36] = z ^ ~G & $t, D[37] = C ^ ~j & Ft, D[46] = je ^ ~it & se, D[47] = pt ^ ~et & he, D[8] = _e ^ ~Ce & Me, D[9] = Ze ^ ~$e & Ne, D[18] = qt ^ ~at & Qe, D[19] = Jt ^ ~ke & tt, D[28] = Nt ^ ~Et & Xt, D[29] = vt ^ ~er & Dt, D[38] = G ^ ~$t & rt, D[39] = j ^ ~Ft & Bt, D[48] = it ^ ~se & xe, D[49] = et ^ ~he & Te, D[0] ^= N[J], D[1] ^= N[J + 1]; + Q = D[0] ^ D[10] ^ D[20] ^ D[30] ^ D[40], T = D[1] ^ D[11] ^ D[21] ^ D[31] ^ D[41], X = D[2] ^ D[12] ^ D[22] ^ D[32] ^ D[42], re = D[3] ^ D[13] ^ D[23] ^ D[33] ^ D[43], de = D[4] ^ D[14] ^ D[24] ^ D[34] ^ D[44], ie = D[5] ^ D[15] ^ D[25] ^ D[35] ^ D[45], ue = D[6] ^ D[16] ^ D[26] ^ D[36] ^ D[46], ve = D[7] ^ D[17] ^ D[27] ^ D[37] ^ D[47], Pe = D[8] ^ D[18] ^ D[28] ^ D[38] ^ D[48], De = D[9] ^ D[19] ^ D[29] ^ D[39] ^ D[49], oe = Pe ^ (X << 1 | re >>> 31), Z = De ^ (re << 1 | X >>> 31), D[0] ^= oe, D[1] ^= Z, D[10] ^= oe, D[11] ^= Z, D[20] ^= oe, D[21] ^= Z, D[30] ^= oe, D[31] ^= Z, D[40] ^= oe, D[41] ^= Z, oe = Q ^ (de << 1 | ie >>> 31), Z = T ^ (ie << 1 | de >>> 31), D[2] ^= oe, D[3] ^= Z, D[12] ^= oe, D[13] ^= Z, D[22] ^= oe, D[23] ^= Z, D[32] ^= oe, D[33] ^= Z, D[42] ^= oe, D[43] ^= Z, oe = X ^ (ue << 1 | ve >>> 31), Z = re ^ (ve << 1 | ue >>> 31), D[4] ^= oe, D[5] ^= Z, D[14] ^= oe, D[15] ^= Z, D[24] ^= oe, D[25] ^= Z, D[34] ^= oe, D[35] ^= Z, D[44] ^= oe, D[45] ^= Z, oe = de ^ (Pe << 1 | De >>> 31), Z = ie ^ (De << 1 | Pe >>> 31), D[6] ^= oe, D[7] ^= Z, D[16] ^= oe, D[17] ^= Z, D[26] ^= oe, D[27] ^= Z, D[36] ^= oe, D[37] ^= Z, D[46] ^= oe, D[47] ^= Z, oe = ue ^ (Q << 1 | T >>> 31), Z = ve ^ (T << 1 | Q >>> 31), D[8] ^= oe, D[9] ^= Z, D[18] ^= oe, D[19] ^= Z, D[28] ^= oe, D[29] ^= Z, D[38] ^= oe, D[39] ^= Z, D[48] ^= oe, D[49] ^= Z, Ce = D[0], $e = D[1], rt = D[11] << 4 | D[10] >>> 28, Bt = D[10] << 4 | D[11] >>> 28, Ye = D[20] << 3 | D[21] >>> 29, dt = D[21] << 3 | D[20] >>> 29, je = D[31] << 9 | D[30] >>> 23, pt = D[30] << 9 | D[31] >>> 23, Nt = D[40] << 18 | D[41] >>> 14, vt = D[41] << 18 | D[40] >>> 14, Et = D[2] << 1 | D[3] >>> 31, er = D[3] << 1 | D[2] >>> 31, Me = D[13] << 12 | D[12] >>> 20, Ne = D[12] << 12 | D[13] >>> 20, k = D[22] << 10 | D[23] >>> 22, q = D[23] << 10 | D[22] >>> 22, lt = D[33] << 13 | D[32] >>> 19, ct = D[32] << 13 | D[33] >>> 19, it = D[42] << 2 | D[43] >>> 30, et = D[43] << 2 | D[42] >>> 30, se = D[5] << 30 | D[4] >>> 2, he = D[4] << 30 | D[5] >>> 2, Xt = D[14] << 6 | D[15] >>> 26, Dt = D[15] << 6 | D[14] >>> 26, Ke = D[25] << 11 | D[24] >>> 21, Le = D[24] << 11 | D[25] >>> 21, W = D[34] << 15 | D[35] >>> 17, C = D[35] << 15 | D[34] >>> 17, qt = D[45] << 29 | D[44] >>> 3, Jt = D[44] << 29 | D[45] >>> 3, at = D[6] << 28 | D[7] >>> 4, ke = D[7] << 28 | D[6] >>> 4, xe = D[17] << 23 | D[16] >>> 9, Te = D[16] << 23 | D[17] >>> 9, kt = D[26] << 25 | D[27] >>> 7, Ct = D[27] << 25 | D[26] >>> 7, qe = D[36] << 21 | D[37] >>> 11, ze = D[37] << 21 | D[36] >>> 11, G = D[47] << 24 | D[46] >>> 8, j = D[46] << 24 | D[47] >>> 8, $t = D[8] << 27 | D[9] >>> 5, Ft = D[9] << 27 | D[8] >>> 5, Qe = D[18] << 20 | D[19] >>> 12, tt = D[19] << 20 | D[18] >>> 12, Re = D[29] << 7 | D[28] >>> 25, nt = D[28] << 7 | D[29] >>> 25, gt = D[38] << 8 | D[39] >>> 24, Rt = D[39] << 8 | D[38] >>> 24, _e = D[48] << 14 | D[49] >>> 18, Ze = D[49] << 14 | D[48] >>> 18, D[0] = Ce ^ ~Me & Ke, D[1] = $e ^ ~Ne & Le, D[10] = at ^ ~Qe & Ye, D[11] = ke ^ ~tt & dt, D[20] = Et ^ ~Xt & kt, D[21] = er ^ ~Dt & Ct, D[30] = $t ^ ~rt & k, D[31] = Ft ^ ~Bt & q, D[40] = se ^ ~xe & Re, D[41] = he ^ ~Te & nt, D[2] = Me ^ ~Ke & qe, D[3] = Ne ^ ~Le & ze, D[12] = Qe ^ ~Ye & lt, D[13] = tt ^ ~dt & ct, D[22] = Xt ^ ~kt & gt, D[23] = Dt ^ ~Ct & Rt, D[32] = rt ^ ~k & W, D[33] = Bt ^ ~q & C, D[42] = xe ^ ~Re & je, D[43] = Te ^ ~nt & pt, D[4] = Ke ^ ~qe & _e, D[5] = Le ^ ~ze & Ze, D[14] = Ye ^ ~lt & qt, D[15] = dt ^ ~ct & Jt, D[24] = kt ^ ~gt & Nt, D[25] = Ct ^ ~Rt & vt, D[34] = k ^ ~W & G, D[35] = q ^ ~C & j, D[44] = Re ^ ~je & it, D[45] = nt ^ ~pt & et, D[6] = qe ^ ~_e & Ce, D[7] = ze ^ ~Ze & $e, D[16] = lt ^ ~qt & at, D[17] = ct ^ ~Jt & ke, D[26] = gt ^ ~Nt & Et, D[27] = Rt ^ ~vt & er, D[36] = W ^ ~G & $t, D[37] = C ^ ~j & Ft, D[46] = je ^ ~it & se, D[47] = pt ^ ~et & he, D[8] = _e ^ ~Ce & Me, D[9] = Ze ^ ~$e & Ne, D[18] = qt ^ ~at & Qe, D[19] = Jt ^ ~ke & tt, D[28] = Nt ^ ~Et & Xt, D[29] = vt ^ ~er & Dt, D[38] = G ^ ~$t & rt, D[39] = j ^ ~Ft & Bt, D[48] = it ^ ~se & xe, D[49] = et ^ ~he & Te, D[0] ^= N[J], D[1] ^= N[J + 1]; }; if (a) t.exports = f; @@ -8606,12 +8606,12 @@ var H4 = { exports: {} }; for (b = 0; b < g.length; ++b) i[g[b]] = f[g[b]]; })(); -})(H4); -var EF = H4.exports; +})(K4); +var EF = K4.exports; const SF = /* @__PURE__ */ ts(EF), AF = "logger/5.7.0"; -let hx = !1, dx = !1; +let dx = !1, px = !1; const Ad = { debug: 1, default: 2, info: 2, warning: 3, error: 4, off: 5 }; -let px = Ad.default, Zg = null; +let gx = Ad.default, Zg = null; function PF() { try { const t = []; @@ -8631,7 +8631,7 @@ function PF() { } return null; } -const gx = PF(); +const mx = PF(); var y1; (function(t) { t.DEBUG = "DEBUG", t.INFO = "INFO", t.WARNING = "WARNING", t.ERROR = "ERROR", t.OFF = "OFF"; @@ -8640,7 +8640,7 @@ var ws; (function(t) { t.UNKNOWN_ERROR = "UNKNOWN_ERROR", t.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", t.UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION", t.NETWORK_ERROR = "NETWORK_ERROR", t.SERVER_ERROR = "SERVER_ERROR", t.TIMEOUT = "TIMEOUT", t.BUFFER_OVERRUN = "BUFFER_OVERRUN", t.NUMERIC_FAULT = "NUMERIC_FAULT", t.MISSING_NEW = "MISSING_NEW", t.INVALID_ARGUMENT = "INVALID_ARGUMENT", t.MISSING_ARGUMENT = "MISSING_ARGUMENT", t.UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT", t.CALL_EXCEPTION = "CALL_EXCEPTION", t.INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS", t.NONCE_EXPIRED = "NONCE_EXPIRED", t.REPLACEMENT_UNDERPRICED = "REPLACEMENT_UNDERPRICED", t.UNPREDICTABLE_GAS_LIMIT = "UNPREDICTABLE_GAS_LIMIT", t.TRANSACTION_REPLACED = "TRANSACTION_REPLACED", t.ACTION_REJECTED = "ACTION_REJECTED"; })(ws || (ws = {})); -const mx = "0123456789abcdef"; +const vx = "0123456789abcdef"; class Yr { constructor(e) { Object.defineProperty(this, "version", { @@ -8651,7 +8651,7 @@ class Yr { } _log(e, r) { const n = e.toLowerCase(); - Ad[n] == null && this.throwArgumentError("invalid log level name", "logLevel", e), !(px > Ad[n]) && console.log.apply(console, r); + Ad[n] == null && this.throwArgumentError("invalid log level name", "logLevel", e), !(gx > Ad[n]) && console.log.apply(console, r); } debug(...e) { this._log(Yr.levels.DEBUG, e); @@ -8663,7 +8663,7 @@ class Yr { this._log(Yr.levels.WARNING, e); } makeError(e, r, n) { - if (dx) + if (px) return this.makeError("censored error", r, {}); r || (r = Yr.errors.UNKNOWN_ERROR), n || (n = {}); const i = []; @@ -8673,7 +8673,7 @@ class Yr { if (l instanceof Uint8Array) { let d = ""; for (let p = 0; p < l.length; p++) - d += mx[l[p] >> 4], d += mx[l[p] & 15]; + d += vx[l[p] >> 4], d += vx[l[p] & 15]; i.push(u + "=Uint8Array(0x" + d + ")"); } else i.push(u + "=" + JSON.stringify(l)); @@ -8735,9 +8735,9 @@ class Yr { e || this.throwArgumentError(r, n, i); } checkNormalize(e) { - gx && this.throwError("platform missing String.prototype.normalize", Yr.errors.UNSUPPORTED_OPERATION, { + mx && this.throwError("platform missing String.prototype.normalize", Yr.errors.UNSUPPORTED_OPERATION, { operation: "String.prototype.normalize", - form: gx + form: mx }); } checkSafeUint53(e, r) { @@ -8772,14 +8772,14 @@ class Yr { static setCensorship(e, r) { if (!e && r && this.globalLogger().throwError("cannot permanently disable censorship", Yr.errors.UNSUPPORTED_OPERATION, { operation: "setCensorship" - }), hx) { + }), dx) { if (!e) return; this.globalLogger().throwError("error censorship permanent", Yr.errors.UNSUPPORTED_OPERATION, { operation: "setCensorship" }); } - dx = !!e, hx = !!r; + px = !!e, dx = !!r; } static setLogLevel(e) { const r = Ad[e.toLowerCase()]; @@ -8787,7 +8787,7 @@ class Yr { Yr.globalLogger().warn("invalid log level - " + e); return; } - px = r; + gx = r; } static from(e) { return new Yr(e); @@ -8796,7 +8796,7 @@ class Yr { Yr.errors = ws; Yr.levels = y1; const MF = "bytes/5.7.0", hn = new Yr(MF); -function K4(t) { +function V4(t) { return !!t.toHexString; } function fu(t) { @@ -8806,21 +8806,21 @@ function fu(t) { }), t; } function IF(t) { - return zs(t) && !(t.length % 2) || qv(t); + return zs(t) && !(t.length % 2) || zv(t); } -function vx(t) { +function bx(t) { return typeof t == "number" && t == t && t % 1 === 0; } -function qv(t) { +function zv(t) { if (t == null) return !1; if (t.constructor === Uint8Array) return !0; - if (typeof t == "string" || !vx(t.length) || t.length < 0) + if (typeof t == "string" || !bx(t.length) || t.length < 0) return !1; for (let e = 0; e < t.length; e++) { const r = t[e]; - if (!vx(r) || r < 0 || r >= 256) + if (!bx(r) || r < 0 || r >= 256) return !1; } return !0; @@ -8833,7 +8833,7 @@ function wn(t, e) { r.unshift(t & 255), t = parseInt(String(t / 256)); return r.length === 0 && r.push(0), fu(new Uint8Array(r)); } - if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), K4(t) && (t = t.toHexString()), zs(t)) { + if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), V4(t) && (t = t.toHexString()), zs(t)) { let r = t.substring(2); r.length % 2 && (e.hexPad === "left" ? r = "0" + r : e.hexPad === "right" ? r += "0" : hn.throwArgumentError("hex data is odd-length", "value", t)); const n = []; @@ -8841,7 +8841,7 @@ function wn(t, e) { n.push(parseInt(r.substring(i, i + 2), 16)); return fu(new Uint8Array(n)); } - return qv(t) ? fu(new Uint8Array(t)) : hn.throwArgumentError("invalid arrayify value", "value", t); + return zv(t) ? fu(new Uint8Array(t)) : hn.throwArgumentError("invalid arrayify value", "value", t); } function CF(t) { const e = t.map((i) => wn(i)), r = e.reduce((i, s) => i + s.length, 0), n = new Uint8Array(r); @@ -8866,11 +8866,11 @@ function Ri(t, e) { } if (typeof t == "bigint") return t = t.toString(16), t.length % 2 ? "0x0" + t : "0x" + t; - if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), K4(t)) + if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), V4(t)) return t.toHexString(); if (zs(t)) return t.length % 2 && (e.hexPad === "left" ? t = "0x0" + t.substring(2) : e.hexPad === "right" ? t += "0" : hn.throwArgumentError("hex data is odd-length", "value", t)), t.toLowerCase(); - if (qv(t)) { + if (zv(t)) { let r = "0x"; for (let n = 0; n < t.length; n++) { let i = t[n]; @@ -8887,7 +8887,7 @@ function RF(t) { return null; return (t.length - 2) / 2; } -function bx(t, e, r) { +function yx(t, e, r) { return typeof t != "string" ? t = Ri(t) : (!zs(t) || t.length % 2) && hn.throwArgumentError("invalid hexData", "value", t), e = 2 + 2 * e, "0x" + t.substring(e); } function lu(t, e) { @@ -8895,7 +8895,7 @@ function lu(t, e) { t = "0x0" + t.substring(2); return t; } -function V4(t) { +function G4(t) { const e = { r: "0x", s: "0x", @@ -8933,11 +8933,11 @@ function V4(t) { } return e.yParityAndS = e._vs, e.compact = e.r + e.yParityAndS.substring(2), e; } -function zv(t) { +function Wv(t) { return "0x" + SF.keccak_256(wn(t)); } -var Wv = { exports: {} }; -Wv.exports; +var Hv = { exports: {} }; +Hv.exports; (function(t) { (function(e, r) { function n(m, f) { @@ -9383,7 +9383,7 @@ Wv.exports; }, s.prototype.sub = function(f) { return this.clone().isub(f); }; - function B(m, f, g) { + function $(m, f, g) { g.negative = f.negative ^ m.negative; var b = m.length + f.length | 0; g.length = b, b = b - 1 | 0; @@ -9398,8 +9398,8 @@ Wv.exports; } return P !== 0 ? g.words[I] = P | 0 : g.length--, g._strip(); } - var $ = function(f, g, b) { - var x = f.words, _ = g.words, E = b.words, v = 0, P, I, F, ce = x[0] | 0, D = ce & 8191, oe = ce >>> 13, Z = x[1] | 0, J = Z & 8191, Q = Z >>> 13, T = x[2] | 0, X = T & 8191, re = T >>> 13, de = x[3] | 0, ie = de & 8191, ue = de >>> 13, ve = x[4] | 0, Pe = ve & 8191, De = ve >>> 13, Ce = x[5] | 0, $e = Ce & 8191, Me = Ce >>> 13, Ne = x[6] | 0, Ke = Ne & 8191, Le = Ne >>> 13, qe = x[7] | 0, ze = qe & 8191, _e = qe >>> 13, Ze = x[8] | 0, at = Ze & 8191, ke = Ze >>> 13, Qe = x[9] | 0, tt = Qe & 8191, Ye = Qe >>> 13, dt = _[0] | 0, lt = dt & 8191, ct = dt >>> 13, qt = _[1] | 0, Jt = qt & 8191, Et = qt >>> 13, er = _[2] | 0, Xt = er & 8191, Dt = er >>> 13, kt = _[3] | 0, Ct = kt & 8191, gt = kt >>> 13, Rt = _[4] | 0, Nt = Rt & 8191, vt = Rt >>> 13, $t = _[5] | 0, Ft = $t & 8191, rt = $t >>> 13, Bt = _[6] | 0, k = Bt & 8191, U = Bt >>> 13, z = _[7] | 0, C = z & 8191, G = z >>> 13, j = _[8] | 0, se = j & 8191, he = j >>> 13, xe = _[9] | 0, Te = xe & 8191, Re = xe >>> 13; + var B = function(f, g, b) { + var x = f.words, _ = g.words, E = b.words, v = 0, P, I, F, ce = x[0] | 0, D = ce & 8191, oe = ce >>> 13, Z = x[1] | 0, J = Z & 8191, Q = Z >>> 13, T = x[2] | 0, X = T & 8191, re = T >>> 13, de = x[3] | 0, ie = de & 8191, ue = de >>> 13, ve = x[4] | 0, Pe = ve & 8191, De = ve >>> 13, Ce = x[5] | 0, $e = Ce & 8191, Me = Ce >>> 13, Ne = x[6] | 0, Ke = Ne & 8191, Le = Ne >>> 13, qe = x[7] | 0, ze = qe & 8191, _e = qe >>> 13, Ze = x[8] | 0, at = Ze & 8191, ke = Ze >>> 13, Qe = x[9] | 0, tt = Qe & 8191, Ye = Qe >>> 13, dt = _[0] | 0, lt = dt & 8191, ct = dt >>> 13, qt = _[1] | 0, Jt = qt & 8191, Et = qt >>> 13, er = _[2] | 0, Xt = er & 8191, Dt = er >>> 13, kt = _[3] | 0, Ct = kt & 8191, gt = kt >>> 13, Rt = _[4] | 0, Nt = Rt & 8191, vt = Rt >>> 13, $t = _[5] | 0, Ft = $t & 8191, rt = $t >>> 13, Bt = _[6] | 0, k = Bt & 8191, q = Bt >>> 13, W = _[7] | 0, C = W & 8191, G = W >>> 13, j = _[8] | 0, se = j & 8191, he = j >>> 13, xe = _[9] | 0, Te = xe & 8191, Re = xe >>> 13; b.negative = f.negative ^ g.negative, b.length = 19, P = Math.imul(D, lt), I = Math.imul(D, ct), I = I + Math.imul(oe, lt) | 0, F = Math.imul(oe, ct); var nt = (v + P | 0) + ((I & 8191) << 13) | 0; v = (F + (I >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, P = Math.imul(J, lt), I = Math.imul(J, ct), I = I + Math.imul(Q, lt) | 0, F = Math.imul(Q, ct), P = P + Math.imul(D, Jt) | 0, I = I + Math.imul(D, Et) | 0, I = I + Math.imul(oe, Jt) | 0, F = F + Math.imul(oe, Et) | 0; @@ -9412,25 +9412,25 @@ Wv.exports; var et = (v + P | 0) + ((I & 8191) << 13) | 0; v = (F + (I >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, P = Math.imul($e, lt), I = Math.imul($e, ct), I = I + Math.imul(Me, lt) | 0, F = Math.imul(Me, ct), P = P + Math.imul(Pe, Jt) | 0, I = I + Math.imul(Pe, Et) | 0, I = I + Math.imul(De, Jt) | 0, F = F + Math.imul(De, Et) | 0, P = P + Math.imul(ie, Xt) | 0, I = I + Math.imul(ie, Dt) | 0, I = I + Math.imul(ue, Xt) | 0, F = F + Math.imul(ue, Dt) | 0, P = P + Math.imul(X, Ct) | 0, I = I + Math.imul(X, gt) | 0, I = I + Math.imul(re, Ct) | 0, F = F + Math.imul(re, gt) | 0, P = P + Math.imul(J, Nt) | 0, I = I + Math.imul(J, vt) | 0, I = I + Math.imul(Q, Nt) | 0, F = F + Math.imul(Q, vt) | 0, P = P + Math.imul(D, Ft) | 0, I = I + Math.imul(D, rt) | 0, I = I + Math.imul(oe, Ft) | 0, F = F + Math.imul(oe, rt) | 0; var St = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, P = Math.imul(Ke, lt), I = Math.imul(Ke, ct), I = I + Math.imul(Le, lt) | 0, F = Math.imul(Le, ct), P = P + Math.imul($e, Jt) | 0, I = I + Math.imul($e, Et) | 0, I = I + Math.imul(Me, Jt) | 0, F = F + Math.imul(Me, Et) | 0, P = P + Math.imul(Pe, Xt) | 0, I = I + Math.imul(Pe, Dt) | 0, I = I + Math.imul(De, Xt) | 0, F = F + Math.imul(De, Dt) | 0, P = P + Math.imul(ie, Ct) | 0, I = I + Math.imul(ie, gt) | 0, I = I + Math.imul(ue, Ct) | 0, F = F + Math.imul(ue, gt) | 0, P = P + Math.imul(X, Nt) | 0, I = I + Math.imul(X, vt) | 0, I = I + Math.imul(re, Nt) | 0, F = F + Math.imul(re, vt) | 0, P = P + Math.imul(J, Ft) | 0, I = I + Math.imul(J, rt) | 0, I = I + Math.imul(Q, Ft) | 0, F = F + Math.imul(Q, rt) | 0, P = P + Math.imul(D, k) | 0, I = I + Math.imul(D, U) | 0, I = I + Math.imul(oe, k) | 0, F = F + Math.imul(oe, U) | 0; + v = (F + (I >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, P = Math.imul(Ke, lt), I = Math.imul(Ke, ct), I = I + Math.imul(Le, lt) | 0, F = Math.imul(Le, ct), P = P + Math.imul($e, Jt) | 0, I = I + Math.imul($e, Et) | 0, I = I + Math.imul(Me, Jt) | 0, F = F + Math.imul(Me, Et) | 0, P = P + Math.imul(Pe, Xt) | 0, I = I + Math.imul(Pe, Dt) | 0, I = I + Math.imul(De, Xt) | 0, F = F + Math.imul(De, Dt) | 0, P = P + Math.imul(ie, Ct) | 0, I = I + Math.imul(ie, gt) | 0, I = I + Math.imul(ue, Ct) | 0, F = F + Math.imul(ue, gt) | 0, P = P + Math.imul(X, Nt) | 0, I = I + Math.imul(X, vt) | 0, I = I + Math.imul(re, Nt) | 0, F = F + Math.imul(re, vt) | 0, P = P + Math.imul(J, Ft) | 0, I = I + Math.imul(J, rt) | 0, I = I + Math.imul(Q, Ft) | 0, F = F + Math.imul(Q, rt) | 0, P = P + Math.imul(D, k) | 0, I = I + Math.imul(D, q) | 0, I = I + Math.imul(oe, k) | 0, F = F + Math.imul(oe, q) | 0; var Tt = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, P = Math.imul(ze, lt), I = Math.imul(ze, ct), I = I + Math.imul(_e, lt) | 0, F = Math.imul(_e, ct), P = P + Math.imul(Ke, Jt) | 0, I = I + Math.imul(Ke, Et) | 0, I = I + Math.imul(Le, Jt) | 0, F = F + Math.imul(Le, Et) | 0, P = P + Math.imul($e, Xt) | 0, I = I + Math.imul($e, Dt) | 0, I = I + Math.imul(Me, Xt) | 0, F = F + Math.imul(Me, Dt) | 0, P = P + Math.imul(Pe, Ct) | 0, I = I + Math.imul(Pe, gt) | 0, I = I + Math.imul(De, Ct) | 0, F = F + Math.imul(De, gt) | 0, P = P + Math.imul(ie, Nt) | 0, I = I + Math.imul(ie, vt) | 0, I = I + Math.imul(ue, Nt) | 0, F = F + Math.imul(ue, vt) | 0, P = P + Math.imul(X, Ft) | 0, I = I + Math.imul(X, rt) | 0, I = I + Math.imul(re, Ft) | 0, F = F + Math.imul(re, rt) | 0, P = P + Math.imul(J, k) | 0, I = I + Math.imul(J, U) | 0, I = I + Math.imul(Q, k) | 0, F = F + Math.imul(Q, U) | 0, P = P + Math.imul(D, C) | 0, I = I + Math.imul(D, G) | 0, I = I + Math.imul(oe, C) | 0, F = F + Math.imul(oe, G) | 0; + v = (F + (I >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, P = Math.imul(ze, lt), I = Math.imul(ze, ct), I = I + Math.imul(_e, lt) | 0, F = Math.imul(_e, ct), P = P + Math.imul(Ke, Jt) | 0, I = I + Math.imul(Ke, Et) | 0, I = I + Math.imul(Le, Jt) | 0, F = F + Math.imul(Le, Et) | 0, P = P + Math.imul($e, Xt) | 0, I = I + Math.imul($e, Dt) | 0, I = I + Math.imul(Me, Xt) | 0, F = F + Math.imul(Me, Dt) | 0, P = P + Math.imul(Pe, Ct) | 0, I = I + Math.imul(Pe, gt) | 0, I = I + Math.imul(De, Ct) | 0, F = F + Math.imul(De, gt) | 0, P = P + Math.imul(ie, Nt) | 0, I = I + Math.imul(ie, vt) | 0, I = I + Math.imul(ue, Nt) | 0, F = F + Math.imul(ue, vt) | 0, P = P + Math.imul(X, Ft) | 0, I = I + Math.imul(X, rt) | 0, I = I + Math.imul(re, Ft) | 0, F = F + Math.imul(re, rt) | 0, P = P + Math.imul(J, k) | 0, I = I + Math.imul(J, q) | 0, I = I + Math.imul(Q, k) | 0, F = F + Math.imul(Q, q) | 0, P = P + Math.imul(D, C) | 0, I = I + Math.imul(D, G) | 0, I = I + Math.imul(oe, C) | 0, F = F + Math.imul(oe, G) | 0; var At = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, P = Math.imul(at, lt), I = Math.imul(at, ct), I = I + Math.imul(ke, lt) | 0, F = Math.imul(ke, ct), P = P + Math.imul(ze, Jt) | 0, I = I + Math.imul(ze, Et) | 0, I = I + Math.imul(_e, Jt) | 0, F = F + Math.imul(_e, Et) | 0, P = P + Math.imul(Ke, Xt) | 0, I = I + Math.imul(Ke, Dt) | 0, I = I + Math.imul(Le, Xt) | 0, F = F + Math.imul(Le, Dt) | 0, P = P + Math.imul($e, Ct) | 0, I = I + Math.imul($e, gt) | 0, I = I + Math.imul(Me, Ct) | 0, F = F + Math.imul(Me, gt) | 0, P = P + Math.imul(Pe, Nt) | 0, I = I + Math.imul(Pe, vt) | 0, I = I + Math.imul(De, Nt) | 0, F = F + Math.imul(De, vt) | 0, P = P + Math.imul(ie, Ft) | 0, I = I + Math.imul(ie, rt) | 0, I = I + Math.imul(ue, Ft) | 0, F = F + Math.imul(ue, rt) | 0, P = P + Math.imul(X, k) | 0, I = I + Math.imul(X, U) | 0, I = I + Math.imul(re, k) | 0, F = F + Math.imul(re, U) | 0, P = P + Math.imul(J, C) | 0, I = I + Math.imul(J, G) | 0, I = I + Math.imul(Q, C) | 0, F = F + Math.imul(Q, G) | 0, P = P + Math.imul(D, se) | 0, I = I + Math.imul(D, he) | 0, I = I + Math.imul(oe, se) | 0, F = F + Math.imul(oe, he) | 0; + v = (F + (I >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, P = Math.imul(at, lt), I = Math.imul(at, ct), I = I + Math.imul(ke, lt) | 0, F = Math.imul(ke, ct), P = P + Math.imul(ze, Jt) | 0, I = I + Math.imul(ze, Et) | 0, I = I + Math.imul(_e, Jt) | 0, F = F + Math.imul(_e, Et) | 0, P = P + Math.imul(Ke, Xt) | 0, I = I + Math.imul(Ke, Dt) | 0, I = I + Math.imul(Le, Xt) | 0, F = F + Math.imul(Le, Dt) | 0, P = P + Math.imul($e, Ct) | 0, I = I + Math.imul($e, gt) | 0, I = I + Math.imul(Me, Ct) | 0, F = F + Math.imul(Me, gt) | 0, P = P + Math.imul(Pe, Nt) | 0, I = I + Math.imul(Pe, vt) | 0, I = I + Math.imul(De, Nt) | 0, F = F + Math.imul(De, vt) | 0, P = P + Math.imul(ie, Ft) | 0, I = I + Math.imul(ie, rt) | 0, I = I + Math.imul(ue, Ft) | 0, F = F + Math.imul(ue, rt) | 0, P = P + Math.imul(X, k) | 0, I = I + Math.imul(X, q) | 0, I = I + Math.imul(re, k) | 0, F = F + Math.imul(re, q) | 0, P = P + Math.imul(J, C) | 0, I = I + Math.imul(J, G) | 0, I = I + Math.imul(Q, C) | 0, F = F + Math.imul(Q, G) | 0, P = P + Math.imul(D, se) | 0, I = I + Math.imul(D, he) | 0, I = I + Math.imul(oe, se) | 0, F = F + Math.imul(oe, he) | 0; var _t = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, P = Math.imul(tt, lt), I = Math.imul(tt, ct), I = I + Math.imul(Ye, lt) | 0, F = Math.imul(Ye, ct), P = P + Math.imul(at, Jt) | 0, I = I + Math.imul(at, Et) | 0, I = I + Math.imul(ke, Jt) | 0, F = F + Math.imul(ke, Et) | 0, P = P + Math.imul(ze, Xt) | 0, I = I + Math.imul(ze, Dt) | 0, I = I + Math.imul(_e, Xt) | 0, F = F + Math.imul(_e, Dt) | 0, P = P + Math.imul(Ke, Ct) | 0, I = I + Math.imul(Ke, gt) | 0, I = I + Math.imul(Le, Ct) | 0, F = F + Math.imul(Le, gt) | 0, P = P + Math.imul($e, Nt) | 0, I = I + Math.imul($e, vt) | 0, I = I + Math.imul(Me, Nt) | 0, F = F + Math.imul(Me, vt) | 0, P = P + Math.imul(Pe, Ft) | 0, I = I + Math.imul(Pe, rt) | 0, I = I + Math.imul(De, Ft) | 0, F = F + Math.imul(De, rt) | 0, P = P + Math.imul(ie, k) | 0, I = I + Math.imul(ie, U) | 0, I = I + Math.imul(ue, k) | 0, F = F + Math.imul(ue, U) | 0, P = P + Math.imul(X, C) | 0, I = I + Math.imul(X, G) | 0, I = I + Math.imul(re, C) | 0, F = F + Math.imul(re, G) | 0, P = P + Math.imul(J, se) | 0, I = I + Math.imul(J, he) | 0, I = I + Math.imul(Q, se) | 0, F = F + Math.imul(Q, he) | 0, P = P + Math.imul(D, Te) | 0, I = I + Math.imul(D, Re) | 0, I = I + Math.imul(oe, Te) | 0, F = F + Math.imul(oe, Re) | 0; + v = (F + (I >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, P = Math.imul(tt, lt), I = Math.imul(tt, ct), I = I + Math.imul(Ye, lt) | 0, F = Math.imul(Ye, ct), P = P + Math.imul(at, Jt) | 0, I = I + Math.imul(at, Et) | 0, I = I + Math.imul(ke, Jt) | 0, F = F + Math.imul(ke, Et) | 0, P = P + Math.imul(ze, Xt) | 0, I = I + Math.imul(ze, Dt) | 0, I = I + Math.imul(_e, Xt) | 0, F = F + Math.imul(_e, Dt) | 0, P = P + Math.imul(Ke, Ct) | 0, I = I + Math.imul(Ke, gt) | 0, I = I + Math.imul(Le, Ct) | 0, F = F + Math.imul(Le, gt) | 0, P = P + Math.imul($e, Nt) | 0, I = I + Math.imul($e, vt) | 0, I = I + Math.imul(Me, Nt) | 0, F = F + Math.imul(Me, vt) | 0, P = P + Math.imul(Pe, Ft) | 0, I = I + Math.imul(Pe, rt) | 0, I = I + Math.imul(De, Ft) | 0, F = F + Math.imul(De, rt) | 0, P = P + Math.imul(ie, k) | 0, I = I + Math.imul(ie, q) | 0, I = I + Math.imul(ue, k) | 0, F = F + Math.imul(ue, q) | 0, P = P + Math.imul(X, C) | 0, I = I + Math.imul(X, G) | 0, I = I + Math.imul(re, C) | 0, F = F + Math.imul(re, G) | 0, P = P + Math.imul(J, se) | 0, I = I + Math.imul(J, he) | 0, I = I + Math.imul(Q, se) | 0, F = F + Math.imul(Q, he) | 0, P = P + Math.imul(D, Te) | 0, I = I + Math.imul(D, Re) | 0, I = I + Math.imul(oe, Te) | 0, F = F + Math.imul(oe, Re) | 0; var ht = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, P = Math.imul(tt, Jt), I = Math.imul(tt, Et), I = I + Math.imul(Ye, Jt) | 0, F = Math.imul(Ye, Et), P = P + Math.imul(at, Xt) | 0, I = I + Math.imul(at, Dt) | 0, I = I + Math.imul(ke, Xt) | 0, F = F + Math.imul(ke, Dt) | 0, P = P + Math.imul(ze, Ct) | 0, I = I + Math.imul(ze, gt) | 0, I = I + Math.imul(_e, Ct) | 0, F = F + Math.imul(_e, gt) | 0, P = P + Math.imul(Ke, Nt) | 0, I = I + Math.imul(Ke, vt) | 0, I = I + Math.imul(Le, Nt) | 0, F = F + Math.imul(Le, vt) | 0, P = P + Math.imul($e, Ft) | 0, I = I + Math.imul($e, rt) | 0, I = I + Math.imul(Me, Ft) | 0, F = F + Math.imul(Me, rt) | 0, P = P + Math.imul(Pe, k) | 0, I = I + Math.imul(Pe, U) | 0, I = I + Math.imul(De, k) | 0, F = F + Math.imul(De, U) | 0, P = P + Math.imul(ie, C) | 0, I = I + Math.imul(ie, G) | 0, I = I + Math.imul(ue, C) | 0, F = F + Math.imul(ue, G) | 0, P = P + Math.imul(X, se) | 0, I = I + Math.imul(X, he) | 0, I = I + Math.imul(re, se) | 0, F = F + Math.imul(re, he) | 0, P = P + Math.imul(J, Te) | 0, I = I + Math.imul(J, Re) | 0, I = I + Math.imul(Q, Te) | 0, F = F + Math.imul(Q, Re) | 0; + v = (F + (I >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, P = Math.imul(tt, Jt), I = Math.imul(tt, Et), I = I + Math.imul(Ye, Jt) | 0, F = Math.imul(Ye, Et), P = P + Math.imul(at, Xt) | 0, I = I + Math.imul(at, Dt) | 0, I = I + Math.imul(ke, Xt) | 0, F = F + Math.imul(ke, Dt) | 0, P = P + Math.imul(ze, Ct) | 0, I = I + Math.imul(ze, gt) | 0, I = I + Math.imul(_e, Ct) | 0, F = F + Math.imul(_e, gt) | 0, P = P + Math.imul(Ke, Nt) | 0, I = I + Math.imul(Ke, vt) | 0, I = I + Math.imul(Le, Nt) | 0, F = F + Math.imul(Le, vt) | 0, P = P + Math.imul($e, Ft) | 0, I = I + Math.imul($e, rt) | 0, I = I + Math.imul(Me, Ft) | 0, F = F + Math.imul(Me, rt) | 0, P = P + Math.imul(Pe, k) | 0, I = I + Math.imul(Pe, q) | 0, I = I + Math.imul(De, k) | 0, F = F + Math.imul(De, q) | 0, P = P + Math.imul(ie, C) | 0, I = I + Math.imul(ie, G) | 0, I = I + Math.imul(ue, C) | 0, F = F + Math.imul(ue, G) | 0, P = P + Math.imul(X, se) | 0, I = I + Math.imul(X, he) | 0, I = I + Math.imul(re, se) | 0, F = F + Math.imul(re, he) | 0, P = P + Math.imul(J, Te) | 0, I = I + Math.imul(J, Re) | 0, I = I + Math.imul(Q, Te) | 0, F = F + Math.imul(Q, Re) | 0; var xt = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, P = Math.imul(tt, Xt), I = Math.imul(tt, Dt), I = I + Math.imul(Ye, Xt) | 0, F = Math.imul(Ye, Dt), P = P + Math.imul(at, Ct) | 0, I = I + Math.imul(at, gt) | 0, I = I + Math.imul(ke, Ct) | 0, F = F + Math.imul(ke, gt) | 0, P = P + Math.imul(ze, Nt) | 0, I = I + Math.imul(ze, vt) | 0, I = I + Math.imul(_e, Nt) | 0, F = F + Math.imul(_e, vt) | 0, P = P + Math.imul(Ke, Ft) | 0, I = I + Math.imul(Ke, rt) | 0, I = I + Math.imul(Le, Ft) | 0, F = F + Math.imul(Le, rt) | 0, P = P + Math.imul($e, k) | 0, I = I + Math.imul($e, U) | 0, I = I + Math.imul(Me, k) | 0, F = F + Math.imul(Me, U) | 0, P = P + Math.imul(Pe, C) | 0, I = I + Math.imul(Pe, G) | 0, I = I + Math.imul(De, C) | 0, F = F + Math.imul(De, G) | 0, P = P + Math.imul(ie, se) | 0, I = I + Math.imul(ie, he) | 0, I = I + Math.imul(ue, se) | 0, F = F + Math.imul(ue, he) | 0, P = P + Math.imul(X, Te) | 0, I = I + Math.imul(X, Re) | 0, I = I + Math.imul(re, Te) | 0, F = F + Math.imul(re, Re) | 0; + v = (F + (I >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, P = Math.imul(tt, Xt), I = Math.imul(tt, Dt), I = I + Math.imul(Ye, Xt) | 0, F = Math.imul(Ye, Dt), P = P + Math.imul(at, Ct) | 0, I = I + Math.imul(at, gt) | 0, I = I + Math.imul(ke, Ct) | 0, F = F + Math.imul(ke, gt) | 0, P = P + Math.imul(ze, Nt) | 0, I = I + Math.imul(ze, vt) | 0, I = I + Math.imul(_e, Nt) | 0, F = F + Math.imul(_e, vt) | 0, P = P + Math.imul(Ke, Ft) | 0, I = I + Math.imul(Ke, rt) | 0, I = I + Math.imul(Le, Ft) | 0, F = F + Math.imul(Le, rt) | 0, P = P + Math.imul($e, k) | 0, I = I + Math.imul($e, q) | 0, I = I + Math.imul(Me, k) | 0, F = F + Math.imul(Me, q) | 0, P = P + Math.imul(Pe, C) | 0, I = I + Math.imul(Pe, G) | 0, I = I + Math.imul(De, C) | 0, F = F + Math.imul(De, G) | 0, P = P + Math.imul(ie, se) | 0, I = I + Math.imul(ie, he) | 0, I = I + Math.imul(ue, se) | 0, F = F + Math.imul(ue, he) | 0, P = P + Math.imul(X, Te) | 0, I = I + Math.imul(X, Re) | 0, I = I + Math.imul(re, Te) | 0, F = F + Math.imul(re, Re) | 0; var st = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, P = Math.imul(tt, Ct), I = Math.imul(tt, gt), I = I + Math.imul(Ye, Ct) | 0, F = Math.imul(Ye, gt), P = P + Math.imul(at, Nt) | 0, I = I + Math.imul(at, vt) | 0, I = I + Math.imul(ke, Nt) | 0, F = F + Math.imul(ke, vt) | 0, P = P + Math.imul(ze, Ft) | 0, I = I + Math.imul(ze, rt) | 0, I = I + Math.imul(_e, Ft) | 0, F = F + Math.imul(_e, rt) | 0, P = P + Math.imul(Ke, k) | 0, I = I + Math.imul(Ke, U) | 0, I = I + Math.imul(Le, k) | 0, F = F + Math.imul(Le, U) | 0, P = P + Math.imul($e, C) | 0, I = I + Math.imul($e, G) | 0, I = I + Math.imul(Me, C) | 0, F = F + Math.imul(Me, G) | 0, P = P + Math.imul(Pe, se) | 0, I = I + Math.imul(Pe, he) | 0, I = I + Math.imul(De, se) | 0, F = F + Math.imul(De, he) | 0, P = P + Math.imul(ie, Te) | 0, I = I + Math.imul(ie, Re) | 0, I = I + Math.imul(ue, Te) | 0, F = F + Math.imul(ue, Re) | 0; + v = (F + (I >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, P = Math.imul(tt, Ct), I = Math.imul(tt, gt), I = I + Math.imul(Ye, Ct) | 0, F = Math.imul(Ye, gt), P = P + Math.imul(at, Nt) | 0, I = I + Math.imul(at, vt) | 0, I = I + Math.imul(ke, Nt) | 0, F = F + Math.imul(ke, vt) | 0, P = P + Math.imul(ze, Ft) | 0, I = I + Math.imul(ze, rt) | 0, I = I + Math.imul(_e, Ft) | 0, F = F + Math.imul(_e, rt) | 0, P = P + Math.imul(Ke, k) | 0, I = I + Math.imul(Ke, q) | 0, I = I + Math.imul(Le, k) | 0, F = F + Math.imul(Le, q) | 0, P = P + Math.imul($e, C) | 0, I = I + Math.imul($e, G) | 0, I = I + Math.imul(Me, C) | 0, F = F + Math.imul(Me, G) | 0, P = P + Math.imul(Pe, se) | 0, I = I + Math.imul(Pe, he) | 0, I = I + Math.imul(De, se) | 0, F = F + Math.imul(De, he) | 0, P = P + Math.imul(ie, Te) | 0, I = I + Math.imul(ie, Re) | 0, I = I + Math.imul(ue, Te) | 0, F = F + Math.imul(ue, Re) | 0; var bt = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, P = Math.imul(tt, Nt), I = Math.imul(tt, vt), I = I + Math.imul(Ye, Nt) | 0, F = Math.imul(Ye, vt), P = P + Math.imul(at, Ft) | 0, I = I + Math.imul(at, rt) | 0, I = I + Math.imul(ke, Ft) | 0, F = F + Math.imul(ke, rt) | 0, P = P + Math.imul(ze, k) | 0, I = I + Math.imul(ze, U) | 0, I = I + Math.imul(_e, k) | 0, F = F + Math.imul(_e, U) | 0, P = P + Math.imul(Ke, C) | 0, I = I + Math.imul(Ke, G) | 0, I = I + Math.imul(Le, C) | 0, F = F + Math.imul(Le, G) | 0, P = P + Math.imul($e, se) | 0, I = I + Math.imul($e, he) | 0, I = I + Math.imul(Me, se) | 0, F = F + Math.imul(Me, he) | 0, P = P + Math.imul(Pe, Te) | 0, I = I + Math.imul(Pe, Re) | 0, I = I + Math.imul(De, Te) | 0, F = F + Math.imul(De, Re) | 0; + v = (F + (I >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, P = Math.imul(tt, Nt), I = Math.imul(tt, vt), I = I + Math.imul(Ye, Nt) | 0, F = Math.imul(Ye, vt), P = P + Math.imul(at, Ft) | 0, I = I + Math.imul(at, rt) | 0, I = I + Math.imul(ke, Ft) | 0, F = F + Math.imul(ke, rt) | 0, P = P + Math.imul(ze, k) | 0, I = I + Math.imul(ze, q) | 0, I = I + Math.imul(_e, k) | 0, F = F + Math.imul(_e, q) | 0, P = P + Math.imul(Ke, C) | 0, I = I + Math.imul(Ke, G) | 0, I = I + Math.imul(Le, C) | 0, F = F + Math.imul(Le, G) | 0, P = P + Math.imul($e, se) | 0, I = I + Math.imul($e, he) | 0, I = I + Math.imul(Me, se) | 0, F = F + Math.imul(Me, he) | 0, P = P + Math.imul(Pe, Te) | 0, I = I + Math.imul(Pe, Re) | 0, I = I + Math.imul(De, Te) | 0, F = F + Math.imul(De, Re) | 0; var ut = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, P = Math.imul(tt, Ft), I = Math.imul(tt, rt), I = I + Math.imul(Ye, Ft) | 0, F = Math.imul(Ye, rt), P = P + Math.imul(at, k) | 0, I = I + Math.imul(at, U) | 0, I = I + Math.imul(ke, k) | 0, F = F + Math.imul(ke, U) | 0, P = P + Math.imul(ze, C) | 0, I = I + Math.imul(ze, G) | 0, I = I + Math.imul(_e, C) | 0, F = F + Math.imul(_e, G) | 0, P = P + Math.imul(Ke, se) | 0, I = I + Math.imul(Ke, he) | 0, I = I + Math.imul(Le, se) | 0, F = F + Math.imul(Le, he) | 0, P = P + Math.imul($e, Te) | 0, I = I + Math.imul($e, Re) | 0, I = I + Math.imul(Me, Te) | 0, F = F + Math.imul(Me, Re) | 0; + v = (F + (I >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, P = Math.imul(tt, Ft), I = Math.imul(tt, rt), I = I + Math.imul(Ye, Ft) | 0, F = Math.imul(Ye, rt), P = P + Math.imul(at, k) | 0, I = I + Math.imul(at, q) | 0, I = I + Math.imul(ke, k) | 0, F = F + Math.imul(ke, q) | 0, P = P + Math.imul(ze, C) | 0, I = I + Math.imul(ze, G) | 0, I = I + Math.imul(_e, C) | 0, F = F + Math.imul(_e, G) | 0, P = P + Math.imul(Ke, se) | 0, I = I + Math.imul(Ke, he) | 0, I = I + Math.imul(Le, se) | 0, F = F + Math.imul(Le, he) | 0, P = P + Math.imul($e, Te) | 0, I = I + Math.imul($e, Re) | 0, I = I + Math.imul(Me, Te) | 0, F = F + Math.imul(Me, Re) | 0; var ot = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, P = Math.imul(tt, k), I = Math.imul(tt, U), I = I + Math.imul(Ye, k) | 0, F = Math.imul(Ye, U), P = P + Math.imul(at, C) | 0, I = I + Math.imul(at, G) | 0, I = I + Math.imul(ke, C) | 0, F = F + Math.imul(ke, G) | 0, P = P + Math.imul(ze, se) | 0, I = I + Math.imul(ze, he) | 0, I = I + Math.imul(_e, se) | 0, F = F + Math.imul(_e, he) | 0, P = P + Math.imul(Ke, Te) | 0, I = I + Math.imul(Ke, Re) | 0, I = I + Math.imul(Le, Te) | 0, F = F + Math.imul(Le, Re) | 0; + v = (F + (I >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, P = Math.imul(tt, k), I = Math.imul(tt, q), I = I + Math.imul(Ye, k) | 0, F = Math.imul(Ye, q), P = P + Math.imul(at, C) | 0, I = I + Math.imul(at, G) | 0, I = I + Math.imul(ke, C) | 0, F = F + Math.imul(ke, G) | 0, P = P + Math.imul(ze, se) | 0, I = I + Math.imul(ze, he) | 0, I = I + Math.imul(_e, se) | 0, F = F + Math.imul(_e, he) | 0, P = P + Math.imul(Ke, Te) | 0, I = I + Math.imul(Ke, Re) | 0, I = I + Math.imul(Le, Te) | 0, F = F + Math.imul(Le, Re) | 0; var Se = (v + P | 0) + ((I & 8191) << 13) | 0; v = (F + (I >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, P = Math.imul(tt, C), I = Math.imul(tt, G), I = I + Math.imul(Ye, C) | 0, F = Math.imul(Ye, G), P = P + Math.imul(at, se) | 0, I = I + Math.imul(at, he) | 0, I = I + Math.imul(ke, se) | 0, F = F + Math.imul(ke, he) | 0, P = P + Math.imul(ze, Te) | 0, I = I + Math.imul(ze, Re) | 0, I = I + Math.imul(_e, Te) | 0, F = F + Math.imul(_e, Re) | 0; var Ae = (v + P | 0) + ((I & 8191) << 13) | 0; @@ -9440,7 +9440,7 @@ Wv.exports; var Fe = (v + P | 0) + ((I & 8191) << 13) | 0; return v = (F + (I >>> 13) | 0) + (Fe >>> 26) | 0, Fe &= 67108863, E[0] = nt, E[1] = je, E[2] = pt, E[3] = it, E[4] = et, E[5] = St, E[6] = Tt, E[7] = At, E[8] = _t, E[9] = ht, E[10] = xt, E[11] = st, E[12] = bt, E[13] = ut, E[14] = ot, E[15] = Se, E[16] = Ae, E[17] = Ve, E[18] = Fe, v !== 0 && (E[19] = v, b.length++), b; }; - Math.imul || ($ = B); + Math.imul || (B = $); function H(m, f, g) { g.negative = f.negative ^ m.negative, g.length = m.length + f.length; for (var b = 0, x = 0, _ = 0; _ < g.length - 1; _++) { @@ -9454,18 +9454,18 @@ Wv.exports; } return b !== 0 ? g.words[_] = b : g.length--, g._strip(); } - function W(m, f, g) { + function U(m, f, g) { return H(m, f, g); } s.prototype.mulTo = function(f, g) { var b, x = this.length + f.length; - return this.length === 10 && f.length === 10 ? b = $(this, f, g) : x < 63 ? b = B(this, f, g) : x < 1024 ? b = H(this, f, g) : b = W(this, f, g), b; + return this.length === 10 && f.length === 10 ? b = B(this, f, g) : x < 63 ? b = $(this, f, g) : x < 1024 ? b = H(this, f, g) : b = U(this, f, g), b; }, s.prototype.mul = function(f) { var g = new s(null); return g.words = new Array(this.length + f.length), this.mulTo(f, g); }, s.prototype.mulf = function(f) { var g = new s(null); - return g.words = new Array(this.length + f.length), W(this, f, g); + return g.words = new Array(this.length + f.length), U(this, f, g); }, s.prototype.imul = function(f) { return this.clone().mulTo(f, this); }, s.prototype.imuln = function(f) { @@ -10062,8 +10062,8 @@ Wv.exports; return g._forceRed(this); }; })(t, gn); -})(Wv); -var DF = Wv.exports; +})(Hv); +var DF = Hv.exports; const sr = /* @__PURE__ */ ts(DF); var OF = sr.BN; function NF(t) { @@ -10074,10 +10074,10 @@ var r0; (function(t) { t.current = "", t.NFC = "NFC", t.NFD = "NFD", t.NFKC = "NFKC", t.NFKD = "NFKD"; })(r0 || (r0 = {})); -var yx; +var wx; (function(t) { t.UNEXPECTED_CONTINUE = "unexpected continuation byte", t.BAD_PREFIX = "bad codepoint prefix", t.OVERRUN = "string overrun", t.MISSING_CONTINUE = "missing continuation byte", t.OUT_OF_RANGE = "out of UTF-8 range", t.UTF16_SURROGATE = "UTF-16 surrogate", t.OVERLONG = "overlong representation"; -})(yx || (yx = {})); +})(wx || (wx = {})); function em(t, e = r0.current) { e != r0.current && (kF.checkNormalize(), t = t.normalize(e)); let r = []; @@ -10101,20 +10101,20 @@ function em(t, e = r0.current) { } const $F = `Ethereum Signed Message: `; -function G4(t) { - return typeof t == "string" && (t = em(t)), zv(CF([ +function Y4(t) { + return typeof t == "string" && (t = em(t)), Wv(CF([ em($F), em(String(t.length)), t ])); } const BF = "address/5.7.0", $f = new Yr(BF); -function wx(t) { +function xx(t) { zs(t, 20) || $f.throwArgumentError("invalid address", "address", t), t = t.toLowerCase(); const e = t.substring(2).split(""), r = new Uint8Array(40); for (let i = 0; i < 40; i++) r[i] = e[i].charCodeAt(0); - const n = wn(zv(r)); + const n = wn(Wv(r)); for (let i = 0; i < 40; i += 2) n[i >> 1] >> 4 >= 8 && (e[i] = e[i].toUpperCase()), (n[i >> 1] & 15) >= 8 && (e[i + 1] = e[i + 1].toUpperCase()); return "0x" + e.join(""); @@ -10123,17 +10123,17 @@ const FF = 9007199254740991; function jF(t) { return Math.log10 ? Math.log10(t) : Math.log(t) / Math.LN10; } -const Hv = {}; +const Kv = {}; for (let t = 0; t < 10; t++) - Hv[String(t)] = String(t); + Kv[String(t)] = String(t); for (let t = 0; t < 26; t++) - Hv[String.fromCharCode(65 + t)] = String(10 + t); -const xx = Math.floor(jF(FF)); + Kv[String.fromCharCode(65 + t)] = String(10 + t); +const _x = Math.floor(jF(FF)); function UF(t) { t = t.toUpperCase(), t = t.substring(4) + t.substring(0, 2) + "00"; - let e = t.split("").map((n) => Hv[n]).join(""); - for (; e.length >= xx; ) { - let n = e.substring(0, xx); + let e = t.split("").map((n) => Kv[n]).join(""); + for (; e.length >= _x; ) { + let n = e.substring(0, _x); e = parseInt(n, 10) % 97 + e.substring(n.length); } let r = String(98 - parseInt(e, 10) % 97); @@ -10144,11 +10144,11 @@ function UF(t) { function qF(t) { let e = null; if (typeof t != "string" && $f.throwArgumentError("invalid address", "address", t), t.match(/^(0x)?[0-9a-fA-F]{40}$/)) - t.substring(0, 2) !== "0x" && (t = "0x" + t), e = wx(t), t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && e !== t && $f.throwArgumentError("bad address checksum", "address", t); + t.substring(0, 2) !== "0x" && (t = "0x" + t), e = xx(t), t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && e !== t && $f.throwArgumentError("bad address checksum", "address", t); else if (t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { for (t.substring(2, 4) !== UF(t) && $f.throwArgumentError("bad icap checksum", "address", t), e = NF(t.substring(4)); e.length < 40; ) e = "0" + e; - e = wx("0x" + e); + e = xx("0x" + e); } else $f.throwArgumentError("invalid address", "address", t); return e; @@ -10160,12 +10160,12 @@ function _f(t, e, r) { writable: !1 }); } -var Vl = {}, xr = {}, wc = Y4; -function Y4(t, e) { +var Vl = {}, xr = {}, wc = J4; +function J4(t, e) { if (!t) throw new Error(e || "Assertion failed"); } -Y4.equal = function(e, r, n) { +J4.equal = function(e, r, n) { if (e != r) throw new Error(n || "Assertion failed: " + e + " != " + r); }; @@ -10215,31 +10215,31 @@ function KF(t, e) { xr.toArray = KF; function VF(t) { for (var e = "", r = 0; r < t.length; r++) - e += X4(t[r].toString(16)); + e += Z4(t[r].toString(16)); return e; } xr.toHex = VF; -function J4(t) { +function X4(t) { var e = t >>> 24 | t >>> 8 & 65280 | t << 8 & 16711680 | (t & 255) << 24; return e >>> 0; } -xr.htonl = J4; +xr.htonl = X4; function GF(t, e) { for (var r = "", n = 0; n < t.length; n++) { var i = t[n]; - e === "little" && (i = J4(i)), r += Z4(i.toString(16)); + e === "little" && (i = X4(i)), r += Q4(i.toString(16)); } return r; } xr.toHex32 = GF; -function X4(t) { +function Z4(t) { return t.length === 1 ? "0" + t : t; } -xr.zero2 = X4; -function Z4(t) { +xr.zero2 = Z4; +function Q4(t) { return t.length === 7 ? "0" + t : t.length === 6 ? "00" + t : t.length === 5 ? "000" + t : t.length === 4 ? "0000" + t : t.length === 3 ? "00000" + t : t.length === 2 ? "000000" + t : t.length === 1 ? "0000000" + t : t; } -xr.zero8 = Z4; +xr.zero8 = Q4; function YF(t, e, r, n) { var i = r - e; zF(i % 4 === 0); @@ -10340,16 +10340,16 @@ function dj(t, e, r) { return n >>> 0; } xr.shr64_lo = dj; -var Lu = {}, _x = xr, pj = wc; +var Lu = {}, Ex = xr, pj = wc; function W0() { this.pending = null, this.pendingTotal = 0, this.blockSize = this.constructor.blockSize, this.outSize = this.constructor.outSize, this.hmacStrength = this.constructor.hmacStrength, this.padLength = this.constructor.padLength / 8, this.endian = "big", this._delta8 = this.blockSize / 8, this._delta32 = this.blockSize / 32; } Lu.BlockHash = W0; W0.prototype.update = function(e, r) { - if (e = _x.toArray(e, r), this.pending ? this.pending = this.pending.concat(e) : this.pending = e, this.pendingTotal += e.length, this.pending.length >= this._delta8) { + if (e = Ex.toArray(e, r), this.pending ? this.pending = this.pending.concat(e) : this.pending = e, this.pendingTotal += e.length, this.pending.length >= this._delta8) { e = this.pending; var n = e.length % this._delta8; - this.pending = e.slice(e.length - n, e.length), this.pending.length === 0 && (this.pending = null), e = _x.join32(e, 0, e.length - n, this.endian); + this.pending = e.slice(e.length - n, e.length), this.pending.length === 0 && (this.pending = null), e = Ex.join32(e, 0, e.length - n, this.endian); for (var i = 0; i < e.length; i += this._delta32) this._update(e, i, i + this._delta32); } @@ -10375,25 +10375,25 @@ W0.prototype._pad = function() { var ku = {}, ro = {}, gj = xr, Ws = gj.rotr32; function mj(t, e, r, n) { if (t === 0) - return Q4(e, r, n); + return e8(e, r, n); if (t === 1 || t === 3) - return t8(e, r, n); + return r8(e, r, n); if (t === 2) - return e8(e, r, n); + return t8(e, r, n); } ro.ft_1 = mj; -function Q4(t, e, r) { +function e8(t, e, r) { return t & e ^ ~t & r; } -ro.ch32 = Q4; -function e8(t, e, r) { +ro.ch32 = e8; +function t8(t, e, r) { return t & e ^ t & r ^ e & r; } -ro.maj32 = e8; -function t8(t, e, r) { +ro.maj32 = t8; +function r8(t, e, r) { return t ^ e ^ r; } -ro.p32 = t8; +ro.p32 = r8; function vj(t) { return Ws(t, 2) ^ Ws(t, 13) ^ Ws(t, 22); } @@ -10410,7 +10410,7 @@ function wj(t) { return Ws(t, 17) ^ Ws(t, 19) ^ t >>> 10; } ro.g1_256 = wj; -var _u = xr, xj = Lu, _j = ro, tm = _u.rotl32, Ef = _u.sum32, Ej = _u.sum32_5, Sj = _j.ft_1, r8 = xj.BlockHash, Aj = [ +var _u = xr, xj = Lu, _j = ro, tm = _u.rotl32, Ef = _u.sum32, Ej = _u.sum32_5, Sj = _j.ft_1, n8 = xj.BlockHash, Aj = [ 1518500249, 1859775393, 2400959708, @@ -10419,7 +10419,7 @@ var _u = xr, xj = Lu, _j = ro, tm = _u.rotl32, Ef = _u.sum32, Ej = _u.sum32_5, S function Js() { if (!(this instanceof Js)) return new Js(); - r8.call(this), this.h = [ + n8.call(this), this.h = [ 1732584193, 4023233417, 2562383102, @@ -10427,7 +10427,7 @@ function Js() { 3285377520 ], this.W = new Array(80); } -_u.inherits(Js, r8); +_u.inherits(Js, n8); var Pj = Js; Js.blockSize = 512; Js.outSize = 160; @@ -10448,7 +10448,7 @@ Js.prototype._update = function(e, r) { Js.prototype._digest = function(e) { return e === "hex" ? _u.toHex32(this.h, "big") : _u.split32(this.h, "big"); }; -var Eu = xr, Mj = Lu, $u = ro, Ij = wc, gs = Eu.sum32, Cj = Eu.sum32_4, Tj = Eu.sum32_5, Rj = $u.ch32, Dj = $u.maj32, Oj = $u.s0_256, Nj = $u.s1_256, Lj = $u.g0_256, kj = $u.g1_256, n8 = Mj.BlockHash, $j = [ +var Eu = xr, Mj = Lu, $u = ro, Ij = wc, gs = Eu.sum32, Cj = Eu.sum32_4, Tj = Eu.sum32_5, Rj = $u.ch32, Dj = $u.maj32, Oj = $u.s0_256, Nj = $u.s1_256, Lj = $u.g0_256, kj = $u.g1_256, i8 = Mj.BlockHash, $j = [ 1116352408, 1899447441, 3049323471, @@ -10517,7 +10517,7 @@ var Eu = xr, Mj = Lu, $u = ro, Ij = wc, gs = Eu.sum32, Cj = Eu.sum32_4, Tj = Eu. function Xs() { if (!(this instanceof Xs)) return new Xs(); - n8.call(this), this.h = [ + i8.call(this), this.h = [ 1779033703, 3144134277, 1013904242, @@ -10528,8 +10528,8 @@ function Xs() { 1541459225 ], this.k = $j, this.W = new Array(64); } -Eu.inherits(Xs, n8); -var i8 = Xs; +Eu.inherits(Xs, i8); +var s8 = Xs; Xs.blockSize = 512; Xs.outSize = 256; Xs.hmacStrength = 192; @@ -10549,11 +10549,11 @@ Xs.prototype._update = function(e, r) { Xs.prototype._digest = function(e) { return e === "hex" ? Eu.toHex32(this.h, "big") : Eu.split32(this.h, "big"); }; -var x1 = xr, s8 = i8; +var x1 = xr, o8 = s8; function Fo() { if (!(this instanceof Fo)) return new Fo(); - s8.call(this), this.h = [ + o8.call(this), this.h = [ 3238371032, 914150663, 812702999, @@ -10564,7 +10564,7 @@ function Fo() { 3204075428 ]; } -x1.inherits(Fo, s8); +x1.inherits(Fo, o8); var Bj = Fo; Fo.blockSize = 512; Fo.outSize = 224; @@ -10573,7 +10573,7 @@ Fo.padLength = 64; Fo.prototype._digest = function(e) { return e === "hex" ? x1.toHex32(this.h.slice(0, 7), "big") : x1.split32(this.h.slice(0, 7), "big"); }; -var _i = xr, Fj = Lu, jj = wc, Hs = _i.rotr64_hi, Ks = _i.rotr64_lo, o8 = _i.shr64_hi, a8 = _i.shr64_lo, ta = _i.sum64, rm = _i.sum64_hi, nm = _i.sum64_lo, Uj = _i.sum64_4_hi, qj = _i.sum64_4_lo, zj = _i.sum64_5_hi, Wj = _i.sum64_5_lo, c8 = Fj.BlockHash, Hj = [ +var _i = xr, Fj = Lu, jj = wc, Hs = _i.rotr64_hi, Ks = _i.rotr64_lo, a8 = _i.shr64_hi, c8 = _i.shr64_lo, ta = _i.sum64, rm = _i.sum64_hi, nm = _i.sum64_lo, Uj = _i.sum64_4_hi, qj = _i.sum64_4_lo, zj = _i.sum64_5_hi, Wj = _i.sum64_5_lo, u8 = Fj.BlockHash, Hj = [ 1116352408, 3609767458, 1899447441, @@ -10738,7 +10738,7 @@ var _i = xr, Fj = Lu, jj = wc, Hs = _i.rotr64_hi, Ks = _i.rotr64_lo, o8 = _i.shr function Ss() { if (!(this instanceof Ss)) return new Ss(); - c8.call(this), this.h = [ + u8.call(this), this.h = [ 1779033703, 4089235720, 3144134277, @@ -10757,8 +10757,8 @@ function Ss() { 327033209 ], this.k = Hj, this.W = new Array(160); } -_i.inherits(Ss, c8); -var u8 = Ss; +_i.inherits(Ss, u8); +var f8 = Ss; Ss.blockSize = 1024; Ss.outSize = 512; Ss.hmacStrength = 192; @@ -10791,10 +10791,10 @@ Ss.prototype._prepareBlock = function(e, r) { }; Ss.prototype._update = function(e, r) { this._prepareBlock(e, r); - var n = this.W, i = this.h[0], s = this.h[1], o = this.h[2], a = this.h[3], u = this.h[4], l = this.h[5], d = this.h[6], p = this.h[7], w = this.h[8], A = this.h[9], M = this.h[10], N = this.h[11], L = this.h[12], B = this.h[13], $ = this.h[14], H = this.h[15]; + var n = this.W, i = this.h[0], s = this.h[1], o = this.h[2], a = this.h[3], u = this.h[4], l = this.h[5], d = this.h[6], p = this.h[7], w = this.h[8], A = this.h[9], M = this.h[10], N = this.h[11], L = this.h[12], $ = this.h[13], B = this.h[14], H = this.h[15]; jj(this.k.length === n.length); - for (var W = 0; W < n.length; W += 2) { - var V = $, te = H, R = Zj(w, A), K = Qj(w, A), ge = Kj(w, A, M, N, L), Ee = Vj(w, A, M, N, L, B), Y = this.k[W], S = this.k[W + 1], m = n[W], f = n[W + 1], g = zj( + for (var U = 0; U < n.length; U += 2) { + var V = B, te = H, R = Zj(w, A), K = Qj(w, A), ge = Kj(w, A, M, N, L), Ee = Vj(w, A, M, N, L, $), Y = this.k[U], S = this.k[U + 1], m = n[U], f = n[U + 1], g = zj( V, te, R, @@ -10819,9 +10819,9 @@ Ss.prototype._update = function(e, r) { ); V = Jj(i, s), te = Xj(i, s), R = Gj(i, s, o, a, u), K = Yj(i, s, o, a, u, l); var x = rm(V, te, R, K), _ = nm(V, te, R, K); - $ = L, H = B, L = M, B = N, M = w, N = A, w = rm(d, p, g, b), A = nm(p, p, g, b), d = u, p = l, u = o, l = a, o = i, a = s, i = rm(g, b, x, _), s = nm(g, b, x, _); + B = L, H = $, L = M, $ = N, M = w, N = A, w = rm(d, p, g, b), A = nm(p, p, g, b), d = u, p = l, u = o, l = a, o = i, a = s, i = rm(g, b, x, _), s = nm(g, b, x, _); } - ta(this.h, 0, i, s), ta(this.h, 2, o, a), ta(this.h, 4, u, l), ta(this.h, 6, d, p), ta(this.h, 8, w, A), ta(this.h, 10, M, N), ta(this.h, 12, L, B), ta(this.h, 14, $, H); + ta(this.h, 0, i, s), ta(this.h, 2, o, a), ta(this.h, 4, u, l), ta(this.h, 6, d, p), ta(this.h, 8, w, A), ta(this.h, 10, M, N), ta(this.h, 12, L, $), ta(this.h, 14, B, H); }; Ss.prototype._digest = function(e) { return e === "hex" ? _i.toHex32(this.h, "big") : _i.split32(this.h, "big"); @@ -10859,26 +10859,26 @@ function Qj(t, e) { return s < 0 && (s += 4294967296), s; } function eU(t, e) { - var r = Hs(t, e, 1), n = Hs(t, e, 8), i = o8(t, e, 7), s = r ^ n ^ i; + var r = Hs(t, e, 1), n = Hs(t, e, 8), i = a8(t, e, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } function tU(t, e) { - var r = Ks(t, e, 1), n = Ks(t, e, 8), i = a8(t, e, 7), s = r ^ n ^ i; + var r = Ks(t, e, 1), n = Ks(t, e, 8), i = c8(t, e, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } function rU(t, e) { - var r = Hs(t, e, 19), n = Hs(e, t, 29), i = o8(t, e, 6), s = r ^ n ^ i; + var r = Hs(t, e, 19), n = Hs(e, t, 29), i = a8(t, e, 6), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } function nU(t, e) { - var r = Ks(t, e, 19), n = Ks(e, t, 29), i = a8(t, e, 6), s = r ^ n ^ i; + var r = Ks(t, e, 19), n = Ks(e, t, 29), i = c8(t, e, 6), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -var _1 = xr, f8 = u8; +var _1 = xr, l8 = f8; function jo() { if (!(this instanceof jo)) return new jo(); - f8.call(this), this.h = [ + l8.call(this), this.h = [ 3418070365, 3238371032, 1654270250, @@ -10897,7 +10897,7 @@ function jo() { 3204075428 ]; } -_1.inherits(jo, f8); +_1.inherits(jo, l8); var iU = jo; jo.blockSize = 1024; jo.outSize = 384; @@ -10908,33 +10908,33 @@ jo.prototype._digest = function(e) { }; ku.sha1 = Pj; ku.sha224 = Bj; -ku.sha256 = i8; +ku.sha256 = s8; ku.sha384 = iU; -ku.sha512 = u8; -var l8 = {}, lc = xr, sU = Lu, ud = lc.rotl32, Ex = lc.sum32, Sf = lc.sum32_3, Sx = lc.sum32_4, h8 = sU.BlockHash; +ku.sha512 = f8; +var h8 = {}, lc = xr, sU = Lu, ud = lc.rotl32, Sx = lc.sum32, Sf = lc.sum32_3, Ax = lc.sum32_4, d8 = sU.BlockHash; function Zs() { if (!(this instanceof Zs)) return new Zs(); - h8.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = "little"; + d8.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = "little"; } -lc.inherits(Zs, h8); -l8.ripemd160 = Zs; +lc.inherits(Zs, d8); +h8.ripemd160 = Zs; Zs.blockSize = 512; Zs.outSize = 160; Zs.hmacStrength = 192; Zs.padLength = 64; Zs.prototype._update = function(e, r) { for (var n = this.h[0], i = this.h[1], s = this.h[2], o = this.h[3], a = this.h[4], u = n, l = i, d = s, p = o, w = a, A = 0; A < 80; A++) { - var M = Ex( + var M = Sx( ud( - Sx(n, Ax(A, i, s, o), e[cU[A] + r], oU(A)), + Ax(n, Px(A, i, s, o), e[cU[A] + r], oU(A)), fU[A] ), a ); - n = a, a = o, o = ud(s, 10), s = i, i = M, M = Ex( + n = a, a = o, o = ud(s, 10), s = i, i = M, M = Sx( ud( - Sx(u, Ax(79 - A, l, d, p), e[uU[A] + r], aU(A)), + Ax(u, Px(79 - A, l, d, p), e[uU[A] + r], aU(A)), lU[A] ), w @@ -10945,7 +10945,7 @@ Zs.prototype._update = function(e, r) { Zs.prototype._digest = function(e) { return e === "hex" ? lc.toHex32(this.h, "little") : lc.split32(this.h, "little"); }; -function Ax(t, e, r, n) { +function Px(t, e, r, n) { return t <= 15 ? e ^ r ^ n : t <= 31 ? e & r | ~e & n : t <= 47 ? (e | ~r) ^ n : t <= 63 ? e & n | r & ~n : e ^ (r | ~n); } function oU(t) { @@ -11303,7 +11303,7 @@ Su.prototype.digest = function(e) { }; (function(t) { var e = t; - e.utils = xr, e.common = Lu, e.sha = ku, e.ripemd = l8, e.hmac = pU, e.sha1 = e.sha.sha1, e.sha256 = e.sha.sha256, e.sha224 = e.sha.sha224, e.sha384 = e.sha.sha384, e.sha512 = e.sha.sha512, e.ripemd160 = e.ripemd.ripemd160; + e.utils = xr, e.common = Lu, e.sha = ku, e.ripemd = h8, e.hmac = pU, e.sha1 = e.sha.sha1, e.sha256 = e.sha.sha256, e.sha224 = e.sha.sha224, e.sha384 = e.sha.sha384, e.sha512 = e.sha.sha512, e.ripemd160 = e.ripemd.ripemd160; })(Vl); const yo = /* @__PURE__ */ ts(Vl); function Bu(t, e, r) { @@ -11318,12 +11318,12 @@ function Bu(t, e, r) { function gU() { throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs"); } -var Kv = d8; -function d8(t, e) { +var Vv = p8; +function p8(t, e) { if (!t) throw new Error(e || "Assertion failed"); } -d8.equal = function(e, r, n) { +p8.equal = function(e, r, n) { if (e != r) throw new Error(n || "Assertion failed: " + e + " != " + r); }; @@ -11366,7 +11366,7 @@ var xs = Bu(function(t, e) { }; }), $i = Bu(function(t, e) { var r = e; - r.assert = Kv, r.toArray = xs.toArray, r.zero2 = xs.zero2, r.toHex = xs.toHex, r.encode = xs.encode; + r.assert = Vv, r.toArray = xs.toArray, r.zero2 = xs.zero2, r.toHex = xs.toHex, r.encode = xs.encode; function n(u, l, d) { var p = new Array(Math.max(u.bitLength(), d) + 1); p.fill(0); @@ -11388,8 +11388,8 @@ var xs = Bu(function(t, e) { M === 3 && (M = -1), N === 3 && (N = -1); var L; M & 1 ? (A = u.andln(7) + p & 7, (A === 3 || A === 5) && N === 2 ? L = -M : L = M) : L = 0, d[0].push(L); - var B; - N & 1 ? (A = l.andln(7) + w & 7, (A === 3 || A === 5) && M === 2 ? B = -N : B = N) : B = 0, d[1].push(B), 2 * p === L + 1 && (p = 1 - p), 2 * w === B + 1 && (w = 1 - w), u.iushrn(1), l.iushrn(1); + var $; + N & 1 ? (A = l.andln(7) + w & 7, (A === 3 || A === 5) && M === 2 ? $ = -N : $ = N) : $ = 0, d[1].push($), 2 * p === L + 1 && (p = 1 - p), 2 * w === $ + 1 && (w = 1 - w), u.iushrn(1), l.iushrn(1); } return d; } @@ -11477,7 +11477,7 @@ Ma.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 7 */ ]; r[M].y.cmp(r[N].y) === 0 ? (L[1] = r[M].add(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())) : r[M].y.cmp(r[N].y.redNeg()) === 0 ? (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].add(r[N].neg())) : (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())); - var B = [ + var $ = [ -3, /* -1 -1 */ -1, @@ -11496,10 +11496,10 @@ Ma.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 1 0 */ 3 /* 1 1 */ - ], $ = mU(n[M], n[N]); - for (l = Math.max($[0].length, l), u[M] = new Array(l), u[N] = new Array(l), p = 0; p < l; p++) { - var H = $[0][p] | 0, W = $[1][p] | 0; - u[M][p] = B[(H + 1) * 3 + (W + 1)], u[N][p] = 0, a[M] = L; + ], B = mU(n[M], n[N]); + for (l = Math.max(B[0].length, l), u[M] = new Array(l), u[N] = new Array(l), p = 0; p < l; p++) { + var H = B[0][p] | 0, U = B[1][p] | 0; + u[M][p] = $[(H + 1) * 3 + (U + 1)], u[N][p] = 0, a[M] = L; } } var V = this.jpoint(null, null, null), te = this._wnafT4; @@ -11604,7 +11604,7 @@ ns.prototype.dblp = function(e) { r = r.dbl(); return r; }; -var Vv = Bu(function(t) { +var Gv = Bu(function(t) { typeof Object.create == "function" ? t.exports = function(r, n) { n && (r.super_ = n, r.prototype = Object.create(n.prototype, { constructor: { @@ -11626,7 +11626,7 @@ var Vv = Bu(function(t) { function is(t) { xc.call(this, "short", t), this.a = new sr(t.a, 16).toRed(this.red), this.b = new sr(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); } -Vv(is, xc); +Gv(is, xc); var bU = is; is.prototype._getEndomorphism = function(e) { if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { @@ -11661,17 +11661,17 @@ is.prototype._getEndoRoots = function(e) { return [o, a]; }; is.prototype._getEndoBasis = function(e) { - for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new sr(1), o = new sr(0), a = new sr(0), u = new sr(1), l, d, p, w, A, M, N, L = 0, B, $; n.cmpn(0) !== 0; ) { + for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new sr(1), o = new sr(0), a = new sr(0), u = new sr(1), l, d, p, w, A, M, N, L = 0, $, B; n.cmpn(0) !== 0; ) { var H = i.div(n); - B = i.sub(H.mul(n)), $ = a.sub(H.mul(s)); - var W = u.sub(H.mul(o)); - if (!p && B.cmp(r) < 0) - l = N.neg(), d = s, p = B.neg(), w = $; + $ = i.sub(H.mul(n)), B = a.sub(H.mul(s)); + var U = u.sub(H.mul(o)); + if (!p && $.cmp(r) < 0) + l = N.neg(), d = s, p = $.neg(), w = B; else if (p && ++L === 2) break; - N = B, i = n, n = B, a = s, s = $, u = o, o = W; + N = $, i = n, n = $, a = s, s = B, u = o, o = U; } - A = B.neg(), M = $; + A = $.neg(), M = B; var V = p.sqr().add(w.sqr()), te = A.sqr().add(M.sqr()); return te.cmp(V) >= 0 && (A = l, M = d), p.negative && (p = p.neg(), w = w.neg()), A.negative && (A = A.neg(), M = M.neg()), [ { a: p, b: w }, @@ -11708,7 +11708,7 @@ is.prototype._endoWnafMulAdd = function(e, r, n) { function kn(t, e, r, n) { xc.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new sr(e, 16), this.y = new sr(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); } -Vv(kn, xc.BasePoint); +Gv(kn, xc.BasePoint); is.prototype.point = function(e, r, n) { return new kn(this, e, r, n); }; @@ -11854,7 +11854,7 @@ kn.prototype.toJ = function() { function zn(t, e, r, n) { xc.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new sr(0)) : (this.x = new sr(e, 16), this.y = new sr(r, 16), this.z = new sr(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; } -Vv(zn, xc.BasePoint); +Gv(zn, xc.BasePoint); is.prototype.jpoint = function(e, r, n) { return new zn(this, e, r, n); }; @@ -11905,10 +11905,10 @@ zn.prototype.dblp = function(e) { } var i = this.curve.a, s = this.curve.tinv, o = this.x, a = this.y, u = this.z, l = u.redSqr().redSqr(), d = a.redAdd(a); for (r = 0; r < e; r++) { - var p = o.redSqr(), w = d.redSqr(), A = w.redSqr(), M = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), N = o.redMul(w), L = M.redSqr().redISub(N.redAdd(N)), B = N.redISub(L), $ = M.redMul(B); - $ = $.redIAdd($).redISub(A); + var p = o.redSqr(), w = d.redSqr(), A = w.redSqr(), M = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), N = o.redMul(w), L = M.redSqr().redISub(N.redAdd(N)), $ = N.redISub(L), B = M.redMul($); + B = B.redIAdd(B).redISub(A); var H = d.redMul(u); - r + 1 < e && (l = l.redMul(A)), o = L, u = H, d = $; + r + 1 < e && (l = l.redMul(A)), o = L, u = H, d = B; } return this.curve.jpoint(o, d.redMul(s), u); }; @@ -11925,8 +11925,8 @@ zn.prototype._zeroDbl = function() { } else { var p = this.x.redSqr(), w = this.y.redSqr(), A = w.redSqr(), M = this.x.redAdd(w).redSqr().redISub(p).redISub(A); M = M.redIAdd(M); - var N = p.redAdd(p).redIAdd(p), L = N.redSqr(), B = A.redIAdd(A); - B = B.redIAdd(B), B = B.redIAdd(B), e = L.redISub(M).redISub(M), r = N.redMul(M.redISub(e)).redISub(B), n = this.y.redMul(this.z), n = n.redIAdd(n); + var N = p.redAdd(p).redIAdd(p), L = N.redSqr(), $ = A.redIAdd(A); + $ = $.redIAdd($), $ = $.redIAdd($), e = L.redISub(M).redISub(M), r = N.redMul(M.redISub(e)).redISub($), n = this.y.redMul(this.z), n = n.redIAdd(n); } return this.curve.jpoint(e, r, n); }; @@ -11946,8 +11946,8 @@ zn.prototype._threeDbl = function() { N = N.redIAdd(N); var L = N.redAdd(N); e = M.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(p); - var B = w.redSqr(); - B = B.redIAdd(B), B = B.redIAdd(B), B = B.redIAdd(B), r = M.redMul(N.redISub(e)).redISub(B); + var $ = w.redSqr(); + $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($), r = M.redMul(N.redISub(e)).redISub($); } return this.curve.jpoint(e, r, n); }; @@ -12167,12 +12167,12 @@ function ba(t) { return new ba(t); this.hash = t.hash, this.predResist = !!t.predResist, this.outLen = this.hash.outSize, this.minEntropy = t.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null; var e = xs.toArray(t.entropy, t.entropyEnc || "hex"), r = xs.toArray(t.nonce, t.nonceEnc || "hex"), n = xs.toArray(t.pers, t.persEnc || "hex"); - Kv( + Vv( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._init(e, r, n); } -var p8 = ba; +var g8 = ba; ba.prototype._init = function(e, r, n) { var i = e.concat(r).concat(n); this.K = new Array(this.outLen / 8), this.V = new Array(this.outLen / 8); @@ -12188,7 +12188,7 @@ ba.prototype._update = function(e) { e && (r = r.update(e)), this.K = r.digest(), this.V = this._hmac().update(this.V).digest(), e && (this.K = this._hmac().update(this.V).update([1]).update(e).digest(), this.V = this._hmac().update(this.V).digest()); }; ba.prototype.reseed = function(e, r, n, i) { - typeof r != "string" && (i = n, n = r, r = null), e = xs.toArray(e, r), n = xs.toArray(n, i), Kv( + typeof r != "string" && (i = n, n = r, r = null), e = xs.toArray(e, r), n = xs.toArray(n, i), Vv( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._update(e.concat(n || [])), this._reseed = 1; @@ -12206,7 +12206,7 @@ var E1 = $i.assert; function Qn(t, e) { this.ec = t, this.priv = null, this.pub = null, e.priv && this._importPrivate(e.priv, e.privEnc), e.pub && this._importPublic(e.pub, e.pubEnc); } -var Gv = Qn; +var Yv = Qn; Qn.fromPublic = function(e, r, n) { return r instanceof Qn ? r : new Qn(e, { pub: r, @@ -12272,7 +12272,7 @@ function im(t, e) { i <<= 8, i |= t[o], i >>>= 0; return i <= 127 ? !1 : (e.place = o, i); } -function Px(t) { +function Mx(t) { for (var e = 0, r = t.length - 1; !t[e] && !(t[e + 1] & 128) && e < r; ) e++; return e === 0 ? t : t.slice(e); @@ -12319,7 +12319,7 @@ function sm(t, e) { } H0.prototype.toDER = function(e) { var r = this.r.toArray(), n = this.s.toArray(); - for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Px(r), n = Px(n); !n[0] && !(n[1] & 128); ) + for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Mx(r), n = Mx(n); !n[0] && !(n[1] & 128); ) n = n.slice(1); var i = [2]; sm(i, r.length), i = i.concat(r), i.push(2), sm(i, n.length); @@ -12331,28 +12331,28 @@ var xU = ( function() { throw new Error("unsupported"); } -), g8 = $i.assert; +), m8 = $i.assert; function Qi(t) { if (!(this instanceof Qi)) return new Qi(t); - typeof t == "string" && (g8( + typeof t == "string" && (m8( Object.prototype.hasOwnProperty.call(Md, t), "Unknown curve " + t ), t = Md[t]), t instanceof Md.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; } var _U = Qi; Qi.prototype.keyPair = function(e) { - return new Gv(this, e); + return new Yv(this, e); }; Qi.prototype.keyFromPrivate = function(e, r) { - return Gv.fromPrivate(this, e, r); + return Yv.fromPrivate(this, e, r); }; Qi.prototype.keyFromPublic = function(e, r) { - return Gv.fromPublic(this, e, r); + return Yv.fromPublic(this, e, r); }; Qi.prototype.genKeyPair = function(e) { e || (e = {}); - for (var r = new p8({ + for (var r = new g8({ hash: this.hash, pers: e.pers, persEnc: e.persEnc || "utf8", @@ -12371,7 +12371,7 @@ Qi.prototype._truncateToN = function(e, r) { }; Qi.prototype.sign = function(e, r, n, i) { typeof n == "object" && (i = n, n = null), i || (i = {}), r = this.keyFromPrivate(r, n), e = this._truncateToN(new sr(e, 16)); - for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new p8({ + for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new g8({ hash: this.hash, entropy: o, nonce: a, @@ -12403,7 +12403,7 @@ Qi.prototype.verify = function(e, r, n, i) { return this.curve._maxwellTrick ? (d = this.g.jmulAdd(u, n.getPublic(), l), d.isInfinity() ? !1 : d.eqXToP(s)) : (d = this.g.mulAdd(u, n.getPublic(), l), d.isInfinity() ? !1 : d.getX().umod(this.n).cmp(s) === 0); }; Qi.prototype.recoverPubKey = function(t, e, r, n) { - g8((3 & r) === r, "The recovery param is more than two bits"), e = new K0(e, n); + m8((3 & r) === r, "The recovery param is more than two bits"), e = new K0(e, n); var i = this.n, s = new sr(t), o = e.r, a = e.s, u = r & 1, l = r >> 1; if (o.cmp(this.curve.p.umod(this.curve.n)) >= 0 && l) throw new Error("Unable to find sencond key candinate"); @@ -12453,14 +12453,14 @@ class PU { const r = aa().keyFromPrivate(wn(this.privateKey)), n = wn(e); n.length !== 32 && S1.throwArgumentError("bad digest length", "digest", e); const i = r.sign(n, { canonical: !0 }); - return V4({ + return G4({ recoveryParam: i.recoveryParam, r: lu("0x" + i.r.toString(16), 32), s: lu("0x" + i.s.toString(16), 32) }); } computeSharedSecret(e) { - const r = aa().keyFromPrivate(wn(this.privateKey)), n = aa().keyFromPublic(wn(m8(e))); + const r = aa().keyFromPrivate(wn(this.privateKey)), n = aa().keyFromPublic(wn(v8(e))); return lu("0x" + r.derive(n.getPublic()).toString(16), 32); } static isSigningKey(e) { @@ -12468,33 +12468,33 @@ class PU { } } function MU(t, e) { - const r = V4(e), n = { r: wn(r.r), s: wn(r.s) }; + const r = G4(e), n = { r: wn(r.r), s: wn(r.s) }; return "0x" + aa().recoverPubKey(wn(t), n, r.recoveryParam).encode("hex", !1); } -function m8(t, e) { +function v8(t, e) { const r = wn(t); return r.length === 32 ? new PU(r).publicKey : r.length === 33 ? "0x" + aa().keyFromPublic(r).getPublic(!1, "hex") : r.length === 65 ? Ri(r) : S1.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); } -var Mx; +var Ix; (function(t) { t[t.legacy = 0] = "legacy", t[t.eip2930 = 1] = "eip2930", t[t.eip1559 = 2] = "eip1559"; -})(Mx || (Mx = {})); +})(Ix || (Ix = {})); function IU(t) { - const e = m8(t); - return qF(bx(zv(bx(e, 1)), 12)); + const e = v8(t); + return qF(yx(Wv(yx(e, 1)), 12)); } function CU(t, e) { return IU(MU(wn(t), e)); } -var Yv = {}, V0 = {}; +var Jv = {}, V0 = {}; Object.defineProperty(V0, "__esModule", { value: !0 }); var Gn = ar, A1 = ki, TU = 20; function RU(t, e, r) { - for (var n = 1634760805, i = 857760878, s = 2036477234, o = 1797285236, a = r[3] << 24 | r[2] << 16 | r[1] << 8 | r[0], u = r[7] << 24 | r[6] << 16 | r[5] << 8 | r[4], l = r[11] << 24 | r[10] << 16 | r[9] << 8 | r[8], d = r[15] << 24 | r[14] << 16 | r[13] << 8 | r[12], p = r[19] << 24 | r[18] << 16 | r[17] << 8 | r[16], w = r[23] << 24 | r[22] << 16 | r[21] << 8 | r[20], A = r[27] << 24 | r[26] << 16 | r[25] << 8 | r[24], M = r[31] << 24 | r[30] << 16 | r[29] << 8 | r[28], N = e[3] << 24 | e[2] << 16 | e[1] << 8 | e[0], L = e[7] << 24 | e[6] << 16 | e[5] << 8 | e[4], B = e[11] << 24 | e[10] << 16 | e[9] << 8 | e[8], $ = e[15] << 24 | e[14] << 16 | e[13] << 8 | e[12], H = n, W = i, V = s, te = o, R = a, K = u, ge = l, Ee = d, Y = p, S = w, m = A, f = M, g = N, b = L, x = B, _ = $, E = 0; E < TU; E += 2) - H = H + R | 0, g ^= H, g = g >>> 16 | g << 16, Y = Y + g | 0, R ^= Y, R = R >>> 20 | R << 12, W = W + K | 0, b ^= W, b = b >>> 16 | b << 16, S = S + b | 0, K ^= S, K = K >>> 20 | K << 12, V = V + ge | 0, x ^= V, x = x >>> 16 | x << 16, m = m + x | 0, ge ^= m, ge = ge >>> 20 | ge << 12, te = te + Ee | 0, _ ^= te, _ = _ >>> 16 | _ << 16, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 20 | Ee << 12, V = V + ge | 0, x ^= V, x = x >>> 24 | x << 8, m = m + x | 0, ge ^= m, ge = ge >>> 25 | ge << 7, te = te + Ee | 0, _ ^= te, _ = _ >>> 24 | _ << 8, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 25 | Ee << 7, W = W + K | 0, b ^= W, b = b >>> 24 | b << 8, S = S + b | 0, K ^= S, K = K >>> 25 | K << 7, H = H + R | 0, g ^= H, g = g >>> 24 | g << 8, Y = Y + g | 0, R ^= Y, R = R >>> 25 | R << 7, H = H + K | 0, _ ^= H, _ = _ >>> 16 | _ << 16, m = m + _ | 0, K ^= m, K = K >>> 20 | K << 12, W = W + ge | 0, g ^= W, g = g >>> 16 | g << 16, f = f + g | 0, ge ^= f, ge = ge >>> 20 | ge << 12, V = V + Ee | 0, b ^= V, b = b >>> 16 | b << 16, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 20 | Ee << 12, te = te + R | 0, x ^= te, x = x >>> 16 | x << 16, S = S + x | 0, R ^= S, R = R >>> 20 | R << 12, V = V + Ee | 0, b ^= V, b = b >>> 24 | b << 8, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 25 | Ee << 7, te = te + R | 0, x ^= te, x = x >>> 24 | x << 8, S = S + x | 0, R ^= S, R = R >>> 25 | R << 7, W = W + ge | 0, g ^= W, g = g >>> 24 | g << 8, f = f + g | 0, ge ^= f, ge = ge >>> 25 | ge << 7, H = H + K | 0, _ ^= H, _ = _ >>> 24 | _ << 8, m = m + _ | 0, K ^= m, K = K >>> 25 | K << 7; - Gn.writeUint32LE(H + n | 0, t, 0), Gn.writeUint32LE(W + i | 0, t, 4), Gn.writeUint32LE(V + s | 0, t, 8), Gn.writeUint32LE(te + o | 0, t, 12), Gn.writeUint32LE(R + a | 0, t, 16), Gn.writeUint32LE(K + u | 0, t, 20), Gn.writeUint32LE(ge + l | 0, t, 24), Gn.writeUint32LE(Ee + d | 0, t, 28), Gn.writeUint32LE(Y + p | 0, t, 32), Gn.writeUint32LE(S + w | 0, t, 36), Gn.writeUint32LE(m + A | 0, t, 40), Gn.writeUint32LE(f + M | 0, t, 44), Gn.writeUint32LE(g + N | 0, t, 48), Gn.writeUint32LE(b + L | 0, t, 52), Gn.writeUint32LE(x + B | 0, t, 56), Gn.writeUint32LE(_ + $ | 0, t, 60); + for (var n = 1634760805, i = 857760878, s = 2036477234, o = 1797285236, a = r[3] << 24 | r[2] << 16 | r[1] << 8 | r[0], u = r[7] << 24 | r[6] << 16 | r[5] << 8 | r[4], l = r[11] << 24 | r[10] << 16 | r[9] << 8 | r[8], d = r[15] << 24 | r[14] << 16 | r[13] << 8 | r[12], p = r[19] << 24 | r[18] << 16 | r[17] << 8 | r[16], w = r[23] << 24 | r[22] << 16 | r[21] << 8 | r[20], A = r[27] << 24 | r[26] << 16 | r[25] << 8 | r[24], M = r[31] << 24 | r[30] << 16 | r[29] << 8 | r[28], N = e[3] << 24 | e[2] << 16 | e[1] << 8 | e[0], L = e[7] << 24 | e[6] << 16 | e[5] << 8 | e[4], $ = e[11] << 24 | e[10] << 16 | e[9] << 8 | e[8], B = e[15] << 24 | e[14] << 16 | e[13] << 8 | e[12], H = n, U = i, V = s, te = o, R = a, K = u, ge = l, Ee = d, Y = p, S = w, m = A, f = M, g = N, b = L, x = $, _ = B, E = 0; E < TU; E += 2) + H = H + R | 0, g ^= H, g = g >>> 16 | g << 16, Y = Y + g | 0, R ^= Y, R = R >>> 20 | R << 12, U = U + K | 0, b ^= U, b = b >>> 16 | b << 16, S = S + b | 0, K ^= S, K = K >>> 20 | K << 12, V = V + ge | 0, x ^= V, x = x >>> 16 | x << 16, m = m + x | 0, ge ^= m, ge = ge >>> 20 | ge << 12, te = te + Ee | 0, _ ^= te, _ = _ >>> 16 | _ << 16, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 20 | Ee << 12, V = V + ge | 0, x ^= V, x = x >>> 24 | x << 8, m = m + x | 0, ge ^= m, ge = ge >>> 25 | ge << 7, te = te + Ee | 0, _ ^= te, _ = _ >>> 24 | _ << 8, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 25 | Ee << 7, U = U + K | 0, b ^= U, b = b >>> 24 | b << 8, S = S + b | 0, K ^= S, K = K >>> 25 | K << 7, H = H + R | 0, g ^= H, g = g >>> 24 | g << 8, Y = Y + g | 0, R ^= Y, R = R >>> 25 | R << 7, H = H + K | 0, _ ^= H, _ = _ >>> 16 | _ << 16, m = m + _ | 0, K ^= m, K = K >>> 20 | K << 12, U = U + ge | 0, g ^= U, g = g >>> 16 | g << 16, f = f + g | 0, ge ^= f, ge = ge >>> 20 | ge << 12, V = V + Ee | 0, b ^= V, b = b >>> 16 | b << 16, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 20 | Ee << 12, te = te + R | 0, x ^= te, x = x >>> 16 | x << 16, S = S + x | 0, R ^= S, R = R >>> 20 | R << 12, V = V + Ee | 0, b ^= V, b = b >>> 24 | b << 8, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 25 | Ee << 7, te = te + R | 0, x ^= te, x = x >>> 24 | x << 8, S = S + x | 0, R ^= S, R = R >>> 25 | R << 7, U = U + ge | 0, g ^= U, g = g >>> 24 | g << 8, f = f + g | 0, ge ^= f, ge = ge >>> 25 | ge << 7, H = H + K | 0, _ ^= H, _ = _ >>> 24 | _ << 8, m = m + _ | 0, K ^= m, K = K >>> 25 | K << 7; + Gn.writeUint32LE(H + n | 0, t, 0), Gn.writeUint32LE(U + i | 0, t, 4), Gn.writeUint32LE(V + s | 0, t, 8), Gn.writeUint32LE(te + o | 0, t, 12), Gn.writeUint32LE(R + a | 0, t, 16), Gn.writeUint32LE(K + u | 0, t, 20), Gn.writeUint32LE(ge + l | 0, t, 24), Gn.writeUint32LE(Ee + d | 0, t, 28), Gn.writeUint32LE(Y + p | 0, t, 32), Gn.writeUint32LE(S + w | 0, t, 36), Gn.writeUint32LE(m + A | 0, t, 40), Gn.writeUint32LE(f + M | 0, t, 44), Gn.writeUint32LE(g + N | 0, t, 48), Gn.writeUint32LE(b + L | 0, t, 52), Gn.writeUint32LE(x + $ | 0, t, 56), Gn.writeUint32LE(_ + B | 0, t, 60); } -function v8(t, e, r, n, i) { +function b8(t, e, r, n, i) { if (i === void 0 && (i = 0), t.length !== 32) throw new Error("ChaCha: key size must be 32 bytes"); if (n.length < r.length) @@ -12517,9 +12517,9 @@ function v8(t, e, r, n, i) { } return A1.wipe(a), i === 0 && A1.wipe(s), n; } -V0.streamXOR = v8; +V0.streamXOR = b8; function DU(t, e, r, n) { - return n === void 0 && (n = 0), A1.wipe(r), v8(t, e, r, r, n); + return n === void 0 && (n = 0), A1.wipe(r), b8(t, e, r, r, n); } V0.stream = DU; function OU(t, e, r) { @@ -12528,7 +12528,7 @@ function OU(t, e, r) { if (n > 0) throw new Error("ChaCha: counter overflow"); } -var b8 = {}, Ia = {}; +var y8 = {}, Ia = {}; Object.defineProperty(Ia, "__esModule", { value: !0 }); function NU(t, e, r) { return ~(t - 1) & e | t - 1 & r; @@ -12538,16 +12538,16 @@ function LU(t, e) { return (t | 0) - (e | 0) - 1 >>> 31 & 1; } Ia.lessOrEqual = LU; -function y8(t, e) { +function w8(t, e) { if (t.length !== e.length) return 0; for (var r = 0, n = 0; n < t.length; n++) r |= t[n] ^ e[n]; return 1 & r - 1 >>> 8; } -Ia.compare = y8; +Ia.compare = w8; function kU(t, e) { - return t.length === 0 || e.length === 0 ? !1 : y8(t, e) !== 0; + return t.length === 0 || e.length === 0 ? !1 : w8(t, e) !== 0; } Ia.equal = kU; (function(t) { @@ -12577,7 +12577,7 @@ Ia.equal = kU; this._r[8] = (M >>> 8 | N << 8) & 8191, this._r[9] = N >>> 5 & 127, this._pad[0] = a[16] | a[17] << 8, this._pad[1] = a[18] | a[19] << 8, this._pad[2] = a[20] | a[21] << 8, this._pad[3] = a[22] | a[23] << 8, this._pad[4] = a[24] | a[25] << 8, this._pad[5] = a[26] | a[27] << 8, this._pad[6] = a[28] | a[29] << 8, this._pad[7] = a[30] | a[31] << 8; } return o.prototype._blocks = function(a, u, l) { - for (var d = this._fin ? 0 : 2048, p = this._h[0], w = this._h[1], A = this._h[2], M = this._h[3], N = this._h[4], L = this._h[5], B = this._h[6], $ = this._h[7], H = this._h[8], W = this._h[9], V = this._r[0], te = this._r[1], R = this._r[2], K = this._r[3], ge = this._r[4], Ee = this._r[5], Y = this._r[6], S = this._r[7], m = this._r[8], f = this._r[9]; l >= 16; ) { + for (var d = this._fin ? 0 : 2048, p = this._h[0], w = this._h[1], A = this._h[2], M = this._h[3], N = this._h[4], L = this._h[5], $ = this._h[6], B = this._h[7], H = this._h[8], U = this._h[9], V = this._r[0], te = this._r[1], R = this._r[2], K = this._r[3], ge = this._r[4], Ee = this._r[5], Y = this._r[6], S = this._r[7], m = this._r[8], f = this._r[9]; l >= 16; ) { var g = a[u + 0] | a[u + 1] << 8; p += g & 8191; var b = a[u + 2] | a[u + 3] << 8; @@ -12589,33 +12589,33 @@ Ia.equal = kU; var E = a[u + 8] | a[u + 9] << 8; N += (_ >>> 4 | E << 12) & 8191, L += E >>> 1 & 8191; var v = a[u + 10] | a[u + 11] << 8; - B += (E >>> 14 | v << 2) & 8191; + $ += (E >>> 14 | v << 2) & 8191; var P = a[u + 12] | a[u + 13] << 8; - $ += (v >>> 11 | P << 5) & 8191; + B += (v >>> 11 | P << 5) & 8191; var I = a[u + 14] | a[u + 15] << 8; - H += (P >>> 8 | I << 8) & 8191, W += I >>> 5 | d; + H += (P >>> 8 | I << 8) & 8191, U += I >>> 5 | d; var F = 0, ce = F; - ce += p * V, ce += w * (5 * f), ce += A * (5 * m), ce += M * (5 * S), ce += N * (5 * Y), F = ce >>> 13, ce &= 8191, ce += L * (5 * Ee), ce += B * (5 * ge), ce += $ * (5 * K), ce += H * (5 * R), ce += W * (5 * te), F += ce >>> 13, ce &= 8191; + ce += p * V, ce += w * (5 * f), ce += A * (5 * m), ce += M * (5 * S), ce += N * (5 * Y), F = ce >>> 13, ce &= 8191, ce += L * (5 * Ee), ce += $ * (5 * ge), ce += B * (5 * K), ce += H * (5 * R), ce += U * (5 * te), F += ce >>> 13, ce &= 8191; var D = F; - D += p * te, D += w * V, D += A * (5 * f), D += M * (5 * m), D += N * (5 * S), F = D >>> 13, D &= 8191, D += L * (5 * Y), D += B * (5 * Ee), D += $ * (5 * ge), D += H * (5 * K), D += W * (5 * R), F += D >>> 13, D &= 8191; + D += p * te, D += w * V, D += A * (5 * f), D += M * (5 * m), D += N * (5 * S), F = D >>> 13, D &= 8191, D += L * (5 * Y), D += $ * (5 * Ee), D += B * (5 * ge), D += H * (5 * K), D += U * (5 * R), F += D >>> 13, D &= 8191; var oe = F; - oe += p * R, oe += w * te, oe += A * V, oe += M * (5 * f), oe += N * (5 * m), F = oe >>> 13, oe &= 8191, oe += L * (5 * S), oe += B * (5 * Y), oe += $ * (5 * Ee), oe += H * (5 * ge), oe += W * (5 * K), F += oe >>> 13, oe &= 8191; + oe += p * R, oe += w * te, oe += A * V, oe += M * (5 * f), oe += N * (5 * m), F = oe >>> 13, oe &= 8191, oe += L * (5 * S), oe += $ * (5 * Y), oe += B * (5 * Ee), oe += H * (5 * ge), oe += U * (5 * K), F += oe >>> 13, oe &= 8191; var Z = F; - Z += p * K, Z += w * R, Z += A * te, Z += M * V, Z += N * (5 * f), F = Z >>> 13, Z &= 8191, Z += L * (5 * m), Z += B * (5 * S), Z += $ * (5 * Y), Z += H * (5 * Ee), Z += W * (5 * ge), F += Z >>> 13, Z &= 8191; + Z += p * K, Z += w * R, Z += A * te, Z += M * V, Z += N * (5 * f), F = Z >>> 13, Z &= 8191, Z += L * (5 * m), Z += $ * (5 * S), Z += B * (5 * Y), Z += H * (5 * Ee), Z += U * (5 * ge), F += Z >>> 13, Z &= 8191; var J = F; - J += p * ge, J += w * K, J += A * R, J += M * te, J += N * V, F = J >>> 13, J &= 8191, J += L * (5 * f), J += B * (5 * m), J += $ * (5 * S), J += H * (5 * Y), J += W * (5 * Ee), F += J >>> 13, J &= 8191; + J += p * ge, J += w * K, J += A * R, J += M * te, J += N * V, F = J >>> 13, J &= 8191, J += L * (5 * f), J += $ * (5 * m), J += B * (5 * S), J += H * (5 * Y), J += U * (5 * Ee), F += J >>> 13, J &= 8191; var Q = F; - Q += p * Ee, Q += w * ge, Q += A * K, Q += M * R, Q += N * te, F = Q >>> 13, Q &= 8191, Q += L * V, Q += B * (5 * f), Q += $ * (5 * m), Q += H * (5 * S), Q += W * (5 * Y), F += Q >>> 13, Q &= 8191; + Q += p * Ee, Q += w * ge, Q += A * K, Q += M * R, Q += N * te, F = Q >>> 13, Q &= 8191, Q += L * V, Q += $ * (5 * f), Q += B * (5 * m), Q += H * (5 * S), Q += U * (5 * Y), F += Q >>> 13, Q &= 8191; var T = F; - T += p * Y, T += w * Ee, T += A * ge, T += M * K, T += N * R, F = T >>> 13, T &= 8191, T += L * te, T += B * V, T += $ * (5 * f), T += H * (5 * m), T += W * (5 * S), F += T >>> 13, T &= 8191; + T += p * Y, T += w * Ee, T += A * ge, T += M * K, T += N * R, F = T >>> 13, T &= 8191, T += L * te, T += $ * V, T += B * (5 * f), T += H * (5 * m), T += U * (5 * S), F += T >>> 13, T &= 8191; var X = F; - X += p * S, X += w * Y, X += A * Ee, X += M * ge, X += N * K, F = X >>> 13, X &= 8191, X += L * R, X += B * te, X += $ * V, X += H * (5 * f), X += W * (5 * m), F += X >>> 13, X &= 8191; + X += p * S, X += w * Y, X += A * Ee, X += M * ge, X += N * K, F = X >>> 13, X &= 8191, X += L * R, X += $ * te, X += B * V, X += H * (5 * f), X += U * (5 * m), F += X >>> 13, X &= 8191; var re = F; - re += p * m, re += w * S, re += A * Y, re += M * Ee, re += N * ge, F = re >>> 13, re &= 8191, re += L * K, re += B * R, re += $ * te, re += H * V, re += W * (5 * f), F += re >>> 13, re &= 8191; + re += p * m, re += w * S, re += A * Y, re += M * Ee, re += N * ge, F = re >>> 13, re &= 8191, re += L * K, re += $ * R, re += B * te, re += H * V, re += U * (5 * f), F += re >>> 13, re &= 8191; var de = F; - de += p * f, de += w * m, de += A * S, de += M * Y, de += N * Ee, F = de >>> 13, de &= 8191, de += L * ge, de += B * K, de += $ * R, de += H * te, de += W * V, F += de >>> 13, de &= 8191, F = (F << 2) + F | 0, F = F + ce | 0, ce = F & 8191, F = F >>> 13, D += F, p = ce, w = D, A = oe, M = Z, N = J, L = Q, B = T, $ = X, H = re, W = de, u += 16, l -= 16; + de += p * f, de += w * m, de += A * S, de += M * Y, de += N * Ee, F = de >>> 13, de &= 8191, de += L * ge, de += $ * K, de += B * R, de += H * te, de += U * V, F += de >>> 13, de &= 8191, F = (F << 2) + F | 0, F = F + ce | 0, ce = F & 8191, F = F >>> 13, D += F, p = ce, w = D, A = oe, M = Z, N = J, L = Q, $ = T, B = X, H = re, U = de, u += 16, l -= 16; } - this._h[0] = p, this._h[1] = w, this._h[2] = A, this._h[3] = M, this._h[4] = N, this._h[5] = L, this._h[6] = B, this._h[7] = $, this._h[8] = H, this._h[9] = W; + this._h[0] = p, this._h[1] = w, this._h[2] = A, this._h[3] = M, this._h[4] = N, this._h[5] = L, this._h[6] = $, this._h[7] = B, this._h[8] = H, this._h[9] = U; }, o.prototype.finish = function(a, u) { u === void 0 && (u = 0); var l = new Uint16Array(10), d, p, w, A; @@ -12673,10 +12673,10 @@ Ia.equal = kU; return o.length !== t.DIGEST_LENGTH || a.length !== t.DIGEST_LENGTH ? !1 : e.equal(o, a); } t.equal = s; -})(b8); +})(y8); (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - var e = V0, r = b8, n = ki, i = ar, s = Ia; + var e = V0, r = y8, n = ki, i = ar, s = Ia; t.KEY_LENGTH = 32, t.NONCE_LENGTH = 12, t.TAG_LENGTH = 16; var o = new Uint8Array(16), a = ( /** @class */ @@ -12713,14 +12713,14 @@ Ia.equal = kU; var N = new Uint8Array(this.tagLength); if (this._authenticate(N, M, d.subarray(0, d.length - this.tagLength), p), !s.equal(N, d.subarray(d.length - this.tagLength, d.length))) return null; - var L = d.length - this.tagLength, B; + var L = d.length - this.tagLength, $; if (w) { if (w.length !== L) throw new Error("ChaCha20Poly1305: incorrect destination length"); - B = w; + $ = w; } else - B = new Uint8Array(L); - return e.streamXOR(this._key, A, d.subarray(0, d.length - this.tagLength), B, 4), n.wipe(A), B; + $ = new Uint8Array(L); + return e.streamXOR(this._key, A, d.subarray(0, d.length - this.tagLength), $, 4), n.wipe(A), $; }, u.prototype.clean = function() { return n.wipe(this._key), this; }, u.prototype._authenticate = function(l, d, p, w) { @@ -12735,15 +12735,15 @@ Ia.equal = kU; }() ); t.ChaCha20Poly1305 = a; -})(Yv); -var w8 = {}, Gl = {}, Jv = {}; -Object.defineProperty(Jv, "__esModule", { value: !0 }); +})(Jv); +var x8 = {}, Gl = {}, Xv = {}; +Object.defineProperty(Xv, "__esModule", { value: !0 }); function $U(t) { return typeof t.saveState < "u" && typeof t.restoreState < "u" && typeof t.cleanSavedState < "u"; } -Jv.isSerializableHash = $U; +Xv.isSerializableHash = $U; Object.defineProperty(Gl, "__esModule", { value: !0 }); -var Ls = Jv, BU = Ia, FU = ki, x8 = ( +var Ls = Xv, BU = Ia, FU = ki, _8 = ( /** @class */ function() { function t(e, r) { @@ -12785,23 +12785,23 @@ var Ls = Jv, BU = Ia, FU = ki, x8 = ( }, t; }() ); -Gl.HMAC = x8; +Gl.HMAC = _8; function jU(t, e, r) { - var n = new x8(t, e); + var n = new _8(t, e); n.update(r); var i = n.digest(); return n.clean(), i; } Gl.hmac = jU; Gl.equal = BU.equal; -Object.defineProperty(w8, "__esModule", { value: !0 }); -var Ix = Gl, Cx = ki, UU = ( +Object.defineProperty(x8, "__esModule", { value: !0 }); +var Cx = Gl, Tx = ki, UU = ( /** @class */ function() { function t(e, r, n, i) { n === void 0 && (n = new Uint8Array(0)), this._counter = new Uint8Array(1), this._hash = e, this._info = i; - var s = Ix.hmac(this._hash, n, r); - this._hmac = new Ix.HMAC(e, s), this._buffer = new Uint8Array(this._hmac.digestLength), this._bufpos = this._buffer.length; + var s = Cx.hmac(this._hash, n, r); + this._hmac = new Cx.HMAC(e, s), this._buffer = new Uint8Array(this._hmac.digestLength), this._bufpos = this._buffer.length; } return t.prototype._fillBuffer = function() { this._counter[0]++; @@ -12814,10 +12814,10 @@ var Ix = Gl, Cx = ki, UU = ( this._bufpos === this._buffer.length && this._fillBuffer(), r[n] = this._buffer[this._bufpos++]; return r; }, t.prototype.clean = function() { - this._hmac.clean(), Cx.wipe(this._buffer), Cx.wipe(this._counter), this._bufpos = 0; + this._hmac.clean(), Tx.wipe(this._buffer), Tx.wipe(this._counter), this._bufpos = 0; }, t; }() -), qU = w8.HKDF = UU, Yl = {}; +), qU = x8.HKDF = UU, Yl = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); var e = ar, r = ki; @@ -12945,21 +12945,21 @@ var Ix = Gl, Cx = ki, UU = ( ]); function s(a, u, l, d, p) { for (; p >= 64; ) { - for (var w = u[0], A = u[1], M = u[2], N = u[3], L = u[4], B = u[5], $ = u[6], H = u[7], W = 0; W < 16; W++) { - var V = d + W * 4; - a[W] = e.readUint32BE(l, V); + for (var w = u[0], A = u[1], M = u[2], N = u[3], L = u[4], $ = u[5], B = u[6], H = u[7], U = 0; U < 16; U++) { + var V = d + U * 4; + a[U] = e.readUint32BE(l, V); } - for (var W = 16; W < 64; W++) { - var te = a[W - 2], R = (te >>> 17 | te << 15) ^ (te >>> 19 | te << 13) ^ te >>> 10; - te = a[W - 15]; + for (var U = 16; U < 64; U++) { + var te = a[U - 2], R = (te >>> 17 | te << 15) ^ (te >>> 19 | te << 13) ^ te >>> 10; + te = a[U - 15]; var K = (te >>> 7 | te << 25) ^ (te >>> 18 | te << 14) ^ te >>> 3; - a[W] = (R + a[W - 7] | 0) + (K + a[W - 16] | 0); + a[U] = (R + a[U - 7] | 0) + (K + a[U - 16] | 0); } - for (var W = 0; W < 64; W++) { - var R = (((L >>> 6 | L << 26) ^ (L >>> 11 | L << 21) ^ (L >>> 25 | L << 7)) + (L & B ^ ~L & $) | 0) + (H + (i[W] + a[W] | 0) | 0) | 0, K = ((w >>> 2 | w << 30) ^ (w >>> 13 | w << 19) ^ (w >>> 22 | w << 10)) + (w & A ^ w & M ^ A & M) | 0; - H = $, $ = B, B = L, L = N + R | 0, N = M, M = A, A = w, w = R + K | 0; + for (var U = 0; U < 64; U++) { + var R = (((L >>> 6 | L << 26) ^ (L >>> 11 | L << 21) ^ (L >>> 25 | L << 7)) + (L & $ ^ ~L & B) | 0) + (H + (i[U] + a[U] | 0) | 0) | 0, K = ((w >>> 2 | w << 30) ^ (w >>> 13 | w << 19) ^ (w >>> 22 | w << 10)) + (w & A ^ w & M ^ A & M) | 0; + H = B, B = $, $ = L, L = N + R | 0, N = M, M = A, A = w, w = R + K | 0; } - u[0] += w, u[1] += A, u[2] += M, u[3] += N, u[4] += L, u[5] += B, u[6] += $, u[7] += H, d += 64, p -= 64; + u[0] += w, u[1] += A, u[2] += M, u[3] += N, u[4] += L, u[5] += $, u[6] += B, u[7] += H, d += 64, p -= 64; } return d; } @@ -12971,37 +12971,37 @@ var Ix = Gl, Cx = ki, UU = ( } t.hash = o; })(Yl); -var Xv = {}; +var Zv = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.sharedKey = t.generateKeyPair = t.generateKeyPairFromSeed = t.scalarMultBase = t.scalarMult = t.SHARED_KEY_LENGTH = t.SECRET_KEY_LENGTH = t.PUBLIC_KEY_LENGTH = void 0; const e = Pa, r = ki; t.PUBLIC_KEY_LENGTH = 32, t.SECRET_KEY_LENGTH = 32, t.SHARED_KEY_LENGTH = 32; - function n(W) { + function n(U) { const V = new Float64Array(16); - if (W) - for (let te = 0; te < W.length; te++) - V[te] = W[te]; + if (U) + for (let te = 0; te < U.length; te++) + V[te] = U[te]; return V; } const i = new Uint8Array(32); i[0] = 9; const s = n([56129, 1]); - function o(W) { + function o(U) { let V = 1; for (let te = 0; te < 16; te++) { - let R = W[te] + V + 65535; - V = Math.floor(R / 65536), W[te] = R - V * 65536; + let R = U[te] + V + 65535; + V = Math.floor(R / 65536), U[te] = R - V * 65536; } - W[0] += V - 1 + 37 * (V - 1); + U[0] += V - 1 + 37 * (V - 1); } - function a(W, V, te) { + function a(U, V, te) { const R = ~(te - 1); for (let K = 0; K < 16; K++) { - const ge = R & (W[K] ^ V[K]); - W[K] ^= ge, V[K] ^= ge; + const ge = R & (U[K] ^ V[K]); + U[K] ^= ge, V[K] ^= ge; } } - function u(W, V) { + function u(U, V) { const te = n(), R = n(); for (let K = 0; K < 16; K++) R[K] = V[K]; @@ -13015,42 +13015,42 @@ var Xv = {}; te[14] &= 65535, a(R, te, 1 - ge); } for (let K = 0; K < 16; K++) - W[2 * K] = R[K] & 255, W[2 * K + 1] = R[K] >> 8; + U[2 * K] = R[K] & 255, U[2 * K + 1] = R[K] >> 8; } - function l(W, V) { + function l(U, V) { for (let te = 0; te < 16; te++) - W[te] = V[2 * te] + (V[2 * te + 1] << 8); - W[15] &= 32767; + U[te] = V[2 * te] + (V[2 * te + 1] << 8); + U[15] &= 32767; } - function d(W, V, te) { + function d(U, V, te) { for (let R = 0; R < 16; R++) - W[R] = V[R] + te[R]; + U[R] = V[R] + te[R]; } - function p(W, V, te) { + function p(U, V, te) { for (let R = 0; R < 16; R++) - W[R] = V[R] - te[R]; + U[R] = V[R] - te[R]; } - function w(W, V, te) { + function w(U, V, te) { let R, K, ge = 0, Ee = 0, Y = 0, S = 0, m = 0, f = 0, g = 0, b = 0, x = 0, _ = 0, E = 0, v = 0, P = 0, I = 0, F = 0, ce = 0, D = 0, oe = 0, Z = 0, J = 0, Q = 0, T = 0, X = 0, re = 0, de = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = te[0], Me = te[1], Ne = te[2], Ke = te[3], Le = te[4], qe = te[5], ze = te[6], _e = te[7], Ze = te[8], at = te[9], ke = te[10], Qe = te[11], tt = te[12], Ye = te[13], dt = te[14], lt = te[15]; - R = V[0], ge += R * $e, Ee += R * Me, Y += R * Ne, S += R * Ke, m += R * Le, f += R * qe, g += R * ze, b += R * _e, x += R * Ze, _ += R * at, E += R * ke, v += R * Qe, P += R * tt, I += R * Ye, F += R * dt, ce += R * lt, R = V[1], Ee += R * $e, Y += R * Me, S += R * Ne, m += R * Ke, f += R * Le, g += R * qe, b += R * ze, x += R * _e, _ += R * Ze, E += R * at, v += R * ke, P += R * Qe, I += R * tt, F += R * Ye, ce += R * dt, D += R * lt, R = V[2], Y += R * $e, S += R * Me, m += R * Ne, f += R * Ke, g += R * Le, b += R * qe, x += R * ze, _ += R * _e, E += R * Ze, v += R * at, P += R * ke, I += R * Qe, F += R * tt, ce += R * Ye, D += R * dt, oe += R * lt, R = V[3], S += R * $e, m += R * Me, f += R * Ne, g += R * Ke, b += R * Le, x += R * qe, _ += R * ze, E += R * _e, v += R * Ze, P += R * at, I += R * ke, F += R * Qe, ce += R * tt, D += R * Ye, oe += R * dt, Z += R * lt, R = V[4], m += R * $e, f += R * Me, g += R * Ne, b += R * Ke, x += R * Le, _ += R * qe, E += R * ze, v += R * _e, P += R * Ze, I += R * at, F += R * ke, ce += R * Qe, D += R * tt, oe += R * Ye, Z += R * dt, J += R * lt, R = V[5], f += R * $e, g += R * Me, b += R * Ne, x += R * Ke, _ += R * Le, E += R * qe, v += R * ze, P += R * _e, I += R * Ze, F += R * at, ce += R * ke, D += R * Qe, oe += R * tt, Z += R * Ye, J += R * dt, Q += R * lt, R = V[6], g += R * $e, b += R * Me, x += R * Ne, _ += R * Ke, E += R * Le, v += R * qe, P += R * ze, I += R * _e, F += R * Ze, ce += R * at, D += R * ke, oe += R * Qe, Z += R * tt, J += R * Ye, Q += R * dt, T += R * lt, R = V[7], b += R * $e, x += R * Me, _ += R * Ne, E += R * Ke, v += R * Le, P += R * qe, I += R * ze, F += R * _e, ce += R * Ze, D += R * at, oe += R * ke, Z += R * Qe, J += R * tt, Q += R * Ye, T += R * dt, X += R * lt, R = V[8], x += R * $e, _ += R * Me, E += R * Ne, v += R * Ke, P += R * Le, I += R * qe, F += R * ze, ce += R * _e, D += R * Ze, oe += R * at, Z += R * ke, J += R * Qe, Q += R * tt, T += R * Ye, X += R * dt, re += R * lt, R = V[9], _ += R * $e, E += R * Me, v += R * Ne, P += R * Ke, I += R * Le, F += R * qe, ce += R * ze, D += R * _e, oe += R * Ze, Z += R * at, J += R * ke, Q += R * Qe, T += R * tt, X += R * Ye, re += R * dt, de += R * lt, R = V[10], E += R * $e, v += R * Me, P += R * Ne, I += R * Ke, F += R * Le, ce += R * qe, D += R * ze, oe += R * _e, Z += R * Ze, J += R * at, Q += R * ke, T += R * Qe, X += R * tt, re += R * Ye, de += R * dt, ie += R * lt, R = V[11], v += R * $e, P += R * Me, I += R * Ne, F += R * Ke, ce += R * Le, D += R * qe, oe += R * ze, Z += R * _e, J += R * Ze, Q += R * at, T += R * ke, X += R * Qe, re += R * tt, de += R * Ye, ie += R * dt, ue += R * lt, R = V[12], P += R * $e, I += R * Me, F += R * Ne, ce += R * Ke, D += R * Le, oe += R * qe, Z += R * ze, J += R * _e, Q += R * Ze, T += R * at, X += R * ke, re += R * Qe, de += R * tt, ie += R * Ye, ue += R * dt, ve += R * lt, R = V[13], I += R * $e, F += R * Me, ce += R * Ne, D += R * Ke, oe += R * Le, Z += R * qe, J += R * ze, Q += R * _e, T += R * Ze, X += R * at, re += R * ke, de += R * Qe, ie += R * tt, ue += R * Ye, ve += R * dt, Pe += R * lt, R = V[14], F += R * $e, ce += R * Me, D += R * Ne, oe += R * Ke, Z += R * Le, J += R * qe, Q += R * ze, T += R * _e, X += R * Ze, re += R * at, de += R * ke, ie += R * Qe, ue += R * tt, ve += R * Ye, Pe += R * dt, De += R * lt, R = V[15], ce += R * $e, D += R * Me, oe += R * Ne, Z += R * Ke, J += R * Le, Q += R * qe, T += R * ze, X += R * _e, re += R * Ze, de += R * at, ie += R * ke, ue += R * Qe, ve += R * tt, Pe += R * Ye, De += R * dt, Ce += R * lt, ge += 38 * D, Ee += 38 * oe, Y += 38 * Z, S += 38 * J, m += 38 * Q, f += 38 * T, g += 38 * X, b += 38 * re, x += 38 * de, _ += 38 * ie, E += 38 * ue, v += 38 * ve, P += 38 * Pe, I += 38 * De, F += 38 * Ce, K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = _ + K + 65535, K = Math.floor(R / 65536), _ = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = P + K + 65535, K = Math.floor(R / 65536), P = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = _ + K + 65535, K = Math.floor(R / 65536), _ = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = P + K + 65535, K = Math.floor(R / 65536), P = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), W[0] = ge, W[1] = Ee, W[2] = Y, W[3] = S, W[4] = m, W[5] = f, W[6] = g, W[7] = b, W[8] = x, W[9] = _, W[10] = E, W[11] = v, W[12] = P, W[13] = I, W[14] = F, W[15] = ce; + R = V[0], ge += R * $e, Ee += R * Me, Y += R * Ne, S += R * Ke, m += R * Le, f += R * qe, g += R * ze, b += R * _e, x += R * Ze, _ += R * at, E += R * ke, v += R * Qe, P += R * tt, I += R * Ye, F += R * dt, ce += R * lt, R = V[1], Ee += R * $e, Y += R * Me, S += R * Ne, m += R * Ke, f += R * Le, g += R * qe, b += R * ze, x += R * _e, _ += R * Ze, E += R * at, v += R * ke, P += R * Qe, I += R * tt, F += R * Ye, ce += R * dt, D += R * lt, R = V[2], Y += R * $e, S += R * Me, m += R * Ne, f += R * Ke, g += R * Le, b += R * qe, x += R * ze, _ += R * _e, E += R * Ze, v += R * at, P += R * ke, I += R * Qe, F += R * tt, ce += R * Ye, D += R * dt, oe += R * lt, R = V[3], S += R * $e, m += R * Me, f += R * Ne, g += R * Ke, b += R * Le, x += R * qe, _ += R * ze, E += R * _e, v += R * Ze, P += R * at, I += R * ke, F += R * Qe, ce += R * tt, D += R * Ye, oe += R * dt, Z += R * lt, R = V[4], m += R * $e, f += R * Me, g += R * Ne, b += R * Ke, x += R * Le, _ += R * qe, E += R * ze, v += R * _e, P += R * Ze, I += R * at, F += R * ke, ce += R * Qe, D += R * tt, oe += R * Ye, Z += R * dt, J += R * lt, R = V[5], f += R * $e, g += R * Me, b += R * Ne, x += R * Ke, _ += R * Le, E += R * qe, v += R * ze, P += R * _e, I += R * Ze, F += R * at, ce += R * ke, D += R * Qe, oe += R * tt, Z += R * Ye, J += R * dt, Q += R * lt, R = V[6], g += R * $e, b += R * Me, x += R * Ne, _ += R * Ke, E += R * Le, v += R * qe, P += R * ze, I += R * _e, F += R * Ze, ce += R * at, D += R * ke, oe += R * Qe, Z += R * tt, J += R * Ye, Q += R * dt, T += R * lt, R = V[7], b += R * $e, x += R * Me, _ += R * Ne, E += R * Ke, v += R * Le, P += R * qe, I += R * ze, F += R * _e, ce += R * Ze, D += R * at, oe += R * ke, Z += R * Qe, J += R * tt, Q += R * Ye, T += R * dt, X += R * lt, R = V[8], x += R * $e, _ += R * Me, E += R * Ne, v += R * Ke, P += R * Le, I += R * qe, F += R * ze, ce += R * _e, D += R * Ze, oe += R * at, Z += R * ke, J += R * Qe, Q += R * tt, T += R * Ye, X += R * dt, re += R * lt, R = V[9], _ += R * $e, E += R * Me, v += R * Ne, P += R * Ke, I += R * Le, F += R * qe, ce += R * ze, D += R * _e, oe += R * Ze, Z += R * at, J += R * ke, Q += R * Qe, T += R * tt, X += R * Ye, re += R * dt, de += R * lt, R = V[10], E += R * $e, v += R * Me, P += R * Ne, I += R * Ke, F += R * Le, ce += R * qe, D += R * ze, oe += R * _e, Z += R * Ze, J += R * at, Q += R * ke, T += R * Qe, X += R * tt, re += R * Ye, de += R * dt, ie += R * lt, R = V[11], v += R * $e, P += R * Me, I += R * Ne, F += R * Ke, ce += R * Le, D += R * qe, oe += R * ze, Z += R * _e, J += R * Ze, Q += R * at, T += R * ke, X += R * Qe, re += R * tt, de += R * Ye, ie += R * dt, ue += R * lt, R = V[12], P += R * $e, I += R * Me, F += R * Ne, ce += R * Ke, D += R * Le, oe += R * qe, Z += R * ze, J += R * _e, Q += R * Ze, T += R * at, X += R * ke, re += R * Qe, de += R * tt, ie += R * Ye, ue += R * dt, ve += R * lt, R = V[13], I += R * $e, F += R * Me, ce += R * Ne, D += R * Ke, oe += R * Le, Z += R * qe, J += R * ze, Q += R * _e, T += R * Ze, X += R * at, re += R * ke, de += R * Qe, ie += R * tt, ue += R * Ye, ve += R * dt, Pe += R * lt, R = V[14], F += R * $e, ce += R * Me, D += R * Ne, oe += R * Ke, Z += R * Le, J += R * qe, Q += R * ze, T += R * _e, X += R * Ze, re += R * at, de += R * ke, ie += R * Qe, ue += R * tt, ve += R * Ye, Pe += R * dt, De += R * lt, R = V[15], ce += R * $e, D += R * Me, oe += R * Ne, Z += R * Ke, J += R * Le, Q += R * qe, T += R * ze, X += R * _e, re += R * Ze, de += R * at, ie += R * ke, ue += R * Qe, ve += R * tt, Pe += R * Ye, De += R * dt, Ce += R * lt, ge += 38 * D, Ee += 38 * oe, Y += 38 * Z, S += 38 * J, m += 38 * Q, f += 38 * T, g += 38 * X, b += 38 * re, x += 38 * de, _ += 38 * ie, E += 38 * ue, v += 38 * ve, P += 38 * Pe, I += 38 * De, F += 38 * Ce, K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = _ + K + 65535, K = Math.floor(R / 65536), _ = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = P + K + 65535, K = Math.floor(R / 65536), P = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = _ + K + 65535, K = Math.floor(R / 65536), _ = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = P + K + 65535, K = Math.floor(R / 65536), P = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), U[0] = ge, U[1] = Ee, U[2] = Y, U[3] = S, U[4] = m, U[5] = f, U[6] = g, U[7] = b, U[8] = x, U[9] = _, U[10] = E, U[11] = v, U[12] = P, U[13] = I, U[14] = F, U[15] = ce; } - function A(W, V) { - w(W, V, V); + function A(U, V) { + w(U, V, V); } - function M(W, V) { + function M(U, V) { const te = n(); for (let R = 0; R < 16; R++) te[R] = V[R]; for (let R = 253; R >= 0; R--) A(te, te), R !== 2 && R !== 4 && w(te, te, V); for (let R = 0; R < 16; R++) - W[R] = te[R]; + U[R] = te[R]; } - function N(W, V) { + function N(U, V) { const te = new Uint8Array(32), R = new Float64Array(80), K = n(), ge = n(), Ee = n(), Y = n(), S = n(), m = n(); for (let x = 0; x < 31; x++) - te[x] = W[x]; - te[31] = W[31] & 127 | 64, te[0] &= 248, l(R, V); + te[x] = U[x]; + te[31] = U[31] & 127 | 64, te[0] &= 248, l(R, V); for (let x = 0; x < 16; x++) ge[x] = R[x]; K[0] = Y[0] = 1; @@ -13066,31 +13066,31 @@ var Xv = {}; return u(b, g), b; } t.scalarMult = N; - function L(W) { - return N(W, i); + function L(U) { + return N(U, i); } t.scalarMultBase = L; - function B(W) { - if (W.length !== t.SECRET_KEY_LENGTH) + function $(U) { + if (U.length !== t.SECRET_KEY_LENGTH) throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`); - const V = new Uint8Array(W); + const V = new Uint8Array(U); return { publicKey: L(V), secretKey: V }; } - t.generateKeyPairFromSeed = B; - function $(W) { - const V = (0, e.randomBytes)(32, W), te = B(V); + t.generateKeyPairFromSeed = $; + function B(U) { + const V = (0, e.randomBytes)(32, U), te = $(V); return (0, r.wipe)(V), te; } - t.generateKeyPair = $; - function H(W, V, te = !1) { - if (W.length !== t.PUBLIC_KEY_LENGTH) + t.generateKeyPair = B; + function H(U, V, te = !1) { + if (U.length !== t.PUBLIC_KEY_LENGTH) throw new Error("X25519: incorrect secret key length"); if (V.length !== t.PUBLIC_KEY_LENGTH) throw new Error("X25519: incorrect public key length"); - const R = N(W, V); + const R = N(U, V); if (te) { let K = 0; for (let ge = 0; ge < R.length; ge++) @@ -13101,8 +13101,8 @@ var Xv = {}; return R; } t.sharedKey = H; -})(Xv); -var _8 = {}; +})(Zv); +var E8 = {}; const zU = "elliptic", WU = "6.6.0", HU = "EC cryptography", KU = "lib/elliptic.js", VU = [ "lib" ], GU = { @@ -13159,8 +13159,8 @@ const zU = "elliptic", WU = "6.6.0", HU = "EC cryptography", KU = "lib/elliptic. devDependencies: tq, dependencies: rq }; -var Bi = {}, Zv = { exports: {} }; -Zv.exports; +var Bi = {}, Qv = { exports: {} }; +Qv.exports; (function(t) { (function(e, r) { function n(Y, S) { @@ -13592,7 +13592,7 @@ Zv.exports; return E !== 0 ? m.words[v] = E | 0 : m.length--, m.strip(); } var N = function(S, m, f) { - var g = S.words, b = m.words, x = f.words, _ = 0, E, v, P, I = g[0] | 0, F = I & 8191, ce = I >>> 13, D = g[1] | 0, oe = D & 8191, Z = D >>> 13, J = g[2] | 0, Q = J & 8191, T = J >>> 13, X = g[3] | 0, re = X & 8191, de = X >>> 13, ie = g[4] | 0, ue = ie & 8191, ve = ie >>> 13, Pe = g[5] | 0, De = Pe & 8191, Ce = Pe >>> 13, $e = g[6] | 0, Me = $e & 8191, Ne = $e >>> 13, Ke = g[7] | 0, Le = Ke & 8191, qe = Ke >>> 13, ze = g[8] | 0, _e = ze & 8191, Ze = ze >>> 13, at = g[9] | 0, ke = at & 8191, Qe = at >>> 13, tt = b[0] | 0, Ye = tt & 8191, dt = tt >>> 13, lt = b[1] | 0, ct = lt & 8191, qt = lt >>> 13, Jt = b[2] | 0, Et = Jt & 8191, er = Jt >>> 13, Xt = b[3] | 0, Dt = Xt & 8191, kt = Xt >>> 13, Ct = b[4] | 0, gt = Ct & 8191, Rt = Ct >>> 13, Nt = b[5] | 0, vt = Nt & 8191, $t = Nt >>> 13, Ft = b[6] | 0, rt = Ft & 8191, Bt = Ft >>> 13, k = b[7] | 0, U = k & 8191, z = k >>> 13, C = b[8] | 0, G = C & 8191, j = C >>> 13, se = b[9] | 0, he = se & 8191, xe = se >>> 13; + var g = S.words, b = m.words, x = f.words, _ = 0, E, v, P, I = g[0] | 0, F = I & 8191, ce = I >>> 13, D = g[1] | 0, oe = D & 8191, Z = D >>> 13, J = g[2] | 0, Q = J & 8191, T = J >>> 13, X = g[3] | 0, re = X & 8191, de = X >>> 13, ie = g[4] | 0, ue = ie & 8191, ve = ie >>> 13, Pe = g[5] | 0, De = Pe & 8191, Ce = Pe >>> 13, $e = g[6] | 0, Me = $e & 8191, Ne = $e >>> 13, Ke = g[7] | 0, Le = Ke & 8191, qe = Ke >>> 13, ze = g[8] | 0, _e = ze & 8191, Ze = ze >>> 13, at = g[9] | 0, ke = at & 8191, Qe = at >>> 13, tt = b[0] | 0, Ye = tt & 8191, dt = tt >>> 13, lt = b[1] | 0, ct = lt & 8191, qt = lt >>> 13, Jt = b[2] | 0, Et = Jt & 8191, er = Jt >>> 13, Xt = b[3] | 0, Dt = Xt & 8191, kt = Xt >>> 13, Ct = b[4] | 0, gt = Ct & 8191, Rt = Ct >>> 13, Nt = b[5] | 0, vt = Nt & 8191, $t = Nt >>> 13, Ft = b[6] | 0, rt = Ft & 8191, Bt = Ft >>> 13, k = b[7] | 0, q = k & 8191, W = k >>> 13, C = b[8] | 0, G = C & 8191, j = C >>> 13, se = b[9] | 0, he = se & 8191, xe = se >>> 13; f.negative = S.negative ^ m.negative, f.length = 19, E = Math.imul(F, Ye), v = Math.imul(F, dt), v = v + Math.imul(ce, Ye) | 0, P = Math.imul(ce, dt); var Te = (_ + E | 0) + ((v & 8191) << 13) | 0; _ = (P + (v >>> 13) | 0) + (Te >>> 26) | 0, Te &= 67108863, E = Math.imul(oe, Ye), v = Math.imul(oe, dt), v = v + Math.imul(Z, Ye) | 0, P = Math.imul(Z, dt), E = E + Math.imul(F, ct) | 0, v = v + Math.imul(F, qt) | 0, v = v + Math.imul(ce, ct) | 0, P = P + Math.imul(ce, qt) | 0; @@ -13607,25 +13607,25 @@ Zv.exports; var it = (_ + E | 0) + ((v & 8191) << 13) | 0; _ = (P + (v >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, E = Math.imul(Me, Ye), v = Math.imul(Me, dt), v = v + Math.imul(Ne, Ye) | 0, P = Math.imul(Ne, dt), E = E + Math.imul(De, ct) | 0, v = v + Math.imul(De, qt) | 0, v = v + Math.imul(Ce, ct) | 0, P = P + Math.imul(Ce, qt) | 0, E = E + Math.imul(ue, Et) | 0, v = v + Math.imul(ue, er) | 0, v = v + Math.imul(ve, Et) | 0, P = P + Math.imul(ve, er) | 0, E = E + Math.imul(re, Dt) | 0, v = v + Math.imul(re, kt) | 0, v = v + Math.imul(de, Dt) | 0, P = P + Math.imul(de, kt) | 0, E = E + Math.imul(Q, gt) | 0, v = v + Math.imul(Q, Rt) | 0, v = v + Math.imul(T, gt) | 0, P = P + Math.imul(T, Rt) | 0, E = E + Math.imul(oe, vt) | 0, v = v + Math.imul(oe, $t) | 0, v = v + Math.imul(Z, vt) | 0, P = P + Math.imul(Z, $t) | 0, E = E + Math.imul(F, rt) | 0, v = v + Math.imul(F, Bt) | 0, v = v + Math.imul(ce, rt) | 0, P = P + Math.imul(ce, Bt) | 0; var et = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, E = Math.imul(Le, Ye), v = Math.imul(Le, dt), v = v + Math.imul(qe, Ye) | 0, P = Math.imul(qe, dt), E = E + Math.imul(Me, ct) | 0, v = v + Math.imul(Me, qt) | 0, v = v + Math.imul(Ne, ct) | 0, P = P + Math.imul(Ne, qt) | 0, E = E + Math.imul(De, Et) | 0, v = v + Math.imul(De, er) | 0, v = v + Math.imul(Ce, Et) | 0, P = P + Math.imul(Ce, er) | 0, E = E + Math.imul(ue, Dt) | 0, v = v + Math.imul(ue, kt) | 0, v = v + Math.imul(ve, Dt) | 0, P = P + Math.imul(ve, kt) | 0, E = E + Math.imul(re, gt) | 0, v = v + Math.imul(re, Rt) | 0, v = v + Math.imul(de, gt) | 0, P = P + Math.imul(de, Rt) | 0, E = E + Math.imul(Q, vt) | 0, v = v + Math.imul(Q, $t) | 0, v = v + Math.imul(T, vt) | 0, P = P + Math.imul(T, $t) | 0, E = E + Math.imul(oe, rt) | 0, v = v + Math.imul(oe, Bt) | 0, v = v + Math.imul(Z, rt) | 0, P = P + Math.imul(Z, Bt) | 0, E = E + Math.imul(F, U) | 0, v = v + Math.imul(F, z) | 0, v = v + Math.imul(ce, U) | 0, P = P + Math.imul(ce, z) | 0; + _ = (P + (v >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, E = Math.imul(Le, Ye), v = Math.imul(Le, dt), v = v + Math.imul(qe, Ye) | 0, P = Math.imul(qe, dt), E = E + Math.imul(Me, ct) | 0, v = v + Math.imul(Me, qt) | 0, v = v + Math.imul(Ne, ct) | 0, P = P + Math.imul(Ne, qt) | 0, E = E + Math.imul(De, Et) | 0, v = v + Math.imul(De, er) | 0, v = v + Math.imul(Ce, Et) | 0, P = P + Math.imul(Ce, er) | 0, E = E + Math.imul(ue, Dt) | 0, v = v + Math.imul(ue, kt) | 0, v = v + Math.imul(ve, Dt) | 0, P = P + Math.imul(ve, kt) | 0, E = E + Math.imul(re, gt) | 0, v = v + Math.imul(re, Rt) | 0, v = v + Math.imul(de, gt) | 0, P = P + Math.imul(de, Rt) | 0, E = E + Math.imul(Q, vt) | 0, v = v + Math.imul(Q, $t) | 0, v = v + Math.imul(T, vt) | 0, P = P + Math.imul(T, $t) | 0, E = E + Math.imul(oe, rt) | 0, v = v + Math.imul(oe, Bt) | 0, v = v + Math.imul(Z, rt) | 0, P = P + Math.imul(Z, Bt) | 0, E = E + Math.imul(F, q) | 0, v = v + Math.imul(F, W) | 0, v = v + Math.imul(ce, q) | 0, P = P + Math.imul(ce, W) | 0; var St = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, E = Math.imul(_e, Ye), v = Math.imul(_e, dt), v = v + Math.imul(Ze, Ye) | 0, P = Math.imul(Ze, dt), E = E + Math.imul(Le, ct) | 0, v = v + Math.imul(Le, qt) | 0, v = v + Math.imul(qe, ct) | 0, P = P + Math.imul(qe, qt) | 0, E = E + Math.imul(Me, Et) | 0, v = v + Math.imul(Me, er) | 0, v = v + Math.imul(Ne, Et) | 0, P = P + Math.imul(Ne, er) | 0, E = E + Math.imul(De, Dt) | 0, v = v + Math.imul(De, kt) | 0, v = v + Math.imul(Ce, Dt) | 0, P = P + Math.imul(Ce, kt) | 0, E = E + Math.imul(ue, gt) | 0, v = v + Math.imul(ue, Rt) | 0, v = v + Math.imul(ve, gt) | 0, P = P + Math.imul(ve, Rt) | 0, E = E + Math.imul(re, vt) | 0, v = v + Math.imul(re, $t) | 0, v = v + Math.imul(de, vt) | 0, P = P + Math.imul(de, $t) | 0, E = E + Math.imul(Q, rt) | 0, v = v + Math.imul(Q, Bt) | 0, v = v + Math.imul(T, rt) | 0, P = P + Math.imul(T, Bt) | 0, E = E + Math.imul(oe, U) | 0, v = v + Math.imul(oe, z) | 0, v = v + Math.imul(Z, U) | 0, P = P + Math.imul(Z, z) | 0, E = E + Math.imul(F, G) | 0, v = v + Math.imul(F, j) | 0, v = v + Math.imul(ce, G) | 0, P = P + Math.imul(ce, j) | 0; + _ = (P + (v >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, E = Math.imul(_e, Ye), v = Math.imul(_e, dt), v = v + Math.imul(Ze, Ye) | 0, P = Math.imul(Ze, dt), E = E + Math.imul(Le, ct) | 0, v = v + Math.imul(Le, qt) | 0, v = v + Math.imul(qe, ct) | 0, P = P + Math.imul(qe, qt) | 0, E = E + Math.imul(Me, Et) | 0, v = v + Math.imul(Me, er) | 0, v = v + Math.imul(Ne, Et) | 0, P = P + Math.imul(Ne, er) | 0, E = E + Math.imul(De, Dt) | 0, v = v + Math.imul(De, kt) | 0, v = v + Math.imul(Ce, Dt) | 0, P = P + Math.imul(Ce, kt) | 0, E = E + Math.imul(ue, gt) | 0, v = v + Math.imul(ue, Rt) | 0, v = v + Math.imul(ve, gt) | 0, P = P + Math.imul(ve, Rt) | 0, E = E + Math.imul(re, vt) | 0, v = v + Math.imul(re, $t) | 0, v = v + Math.imul(de, vt) | 0, P = P + Math.imul(de, $t) | 0, E = E + Math.imul(Q, rt) | 0, v = v + Math.imul(Q, Bt) | 0, v = v + Math.imul(T, rt) | 0, P = P + Math.imul(T, Bt) | 0, E = E + Math.imul(oe, q) | 0, v = v + Math.imul(oe, W) | 0, v = v + Math.imul(Z, q) | 0, P = P + Math.imul(Z, W) | 0, E = E + Math.imul(F, G) | 0, v = v + Math.imul(F, j) | 0, v = v + Math.imul(ce, G) | 0, P = P + Math.imul(ce, j) | 0; var Tt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, E = Math.imul(ke, Ye), v = Math.imul(ke, dt), v = v + Math.imul(Qe, Ye) | 0, P = Math.imul(Qe, dt), E = E + Math.imul(_e, ct) | 0, v = v + Math.imul(_e, qt) | 0, v = v + Math.imul(Ze, ct) | 0, P = P + Math.imul(Ze, qt) | 0, E = E + Math.imul(Le, Et) | 0, v = v + Math.imul(Le, er) | 0, v = v + Math.imul(qe, Et) | 0, P = P + Math.imul(qe, er) | 0, E = E + Math.imul(Me, Dt) | 0, v = v + Math.imul(Me, kt) | 0, v = v + Math.imul(Ne, Dt) | 0, P = P + Math.imul(Ne, kt) | 0, E = E + Math.imul(De, gt) | 0, v = v + Math.imul(De, Rt) | 0, v = v + Math.imul(Ce, gt) | 0, P = P + Math.imul(Ce, Rt) | 0, E = E + Math.imul(ue, vt) | 0, v = v + Math.imul(ue, $t) | 0, v = v + Math.imul(ve, vt) | 0, P = P + Math.imul(ve, $t) | 0, E = E + Math.imul(re, rt) | 0, v = v + Math.imul(re, Bt) | 0, v = v + Math.imul(de, rt) | 0, P = P + Math.imul(de, Bt) | 0, E = E + Math.imul(Q, U) | 0, v = v + Math.imul(Q, z) | 0, v = v + Math.imul(T, U) | 0, P = P + Math.imul(T, z) | 0, E = E + Math.imul(oe, G) | 0, v = v + Math.imul(oe, j) | 0, v = v + Math.imul(Z, G) | 0, P = P + Math.imul(Z, j) | 0, E = E + Math.imul(F, he) | 0, v = v + Math.imul(F, xe) | 0, v = v + Math.imul(ce, he) | 0, P = P + Math.imul(ce, xe) | 0; + _ = (P + (v >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, E = Math.imul(ke, Ye), v = Math.imul(ke, dt), v = v + Math.imul(Qe, Ye) | 0, P = Math.imul(Qe, dt), E = E + Math.imul(_e, ct) | 0, v = v + Math.imul(_e, qt) | 0, v = v + Math.imul(Ze, ct) | 0, P = P + Math.imul(Ze, qt) | 0, E = E + Math.imul(Le, Et) | 0, v = v + Math.imul(Le, er) | 0, v = v + Math.imul(qe, Et) | 0, P = P + Math.imul(qe, er) | 0, E = E + Math.imul(Me, Dt) | 0, v = v + Math.imul(Me, kt) | 0, v = v + Math.imul(Ne, Dt) | 0, P = P + Math.imul(Ne, kt) | 0, E = E + Math.imul(De, gt) | 0, v = v + Math.imul(De, Rt) | 0, v = v + Math.imul(Ce, gt) | 0, P = P + Math.imul(Ce, Rt) | 0, E = E + Math.imul(ue, vt) | 0, v = v + Math.imul(ue, $t) | 0, v = v + Math.imul(ve, vt) | 0, P = P + Math.imul(ve, $t) | 0, E = E + Math.imul(re, rt) | 0, v = v + Math.imul(re, Bt) | 0, v = v + Math.imul(de, rt) | 0, P = P + Math.imul(de, Bt) | 0, E = E + Math.imul(Q, q) | 0, v = v + Math.imul(Q, W) | 0, v = v + Math.imul(T, q) | 0, P = P + Math.imul(T, W) | 0, E = E + Math.imul(oe, G) | 0, v = v + Math.imul(oe, j) | 0, v = v + Math.imul(Z, G) | 0, P = P + Math.imul(Z, j) | 0, E = E + Math.imul(F, he) | 0, v = v + Math.imul(F, xe) | 0, v = v + Math.imul(ce, he) | 0, P = P + Math.imul(ce, xe) | 0; var At = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, E = Math.imul(ke, ct), v = Math.imul(ke, qt), v = v + Math.imul(Qe, ct) | 0, P = Math.imul(Qe, qt), E = E + Math.imul(_e, Et) | 0, v = v + Math.imul(_e, er) | 0, v = v + Math.imul(Ze, Et) | 0, P = P + Math.imul(Ze, er) | 0, E = E + Math.imul(Le, Dt) | 0, v = v + Math.imul(Le, kt) | 0, v = v + Math.imul(qe, Dt) | 0, P = P + Math.imul(qe, kt) | 0, E = E + Math.imul(Me, gt) | 0, v = v + Math.imul(Me, Rt) | 0, v = v + Math.imul(Ne, gt) | 0, P = P + Math.imul(Ne, Rt) | 0, E = E + Math.imul(De, vt) | 0, v = v + Math.imul(De, $t) | 0, v = v + Math.imul(Ce, vt) | 0, P = P + Math.imul(Ce, $t) | 0, E = E + Math.imul(ue, rt) | 0, v = v + Math.imul(ue, Bt) | 0, v = v + Math.imul(ve, rt) | 0, P = P + Math.imul(ve, Bt) | 0, E = E + Math.imul(re, U) | 0, v = v + Math.imul(re, z) | 0, v = v + Math.imul(de, U) | 0, P = P + Math.imul(de, z) | 0, E = E + Math.imul(Q, G) | 0, v = v + Math.imul(Q, j) | 0, v = v + Math.imul(T, G) | 0, P = P + Math.imul(T, j) | 0, E = E + Math.imul(oe, he) | 0, v = v + Math.imul(oe, xe) | 0, v = v + Math.imul(Z, he) | 0, P = P + Math.imul(Z, xe) | 0; + _ = (P + (v >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, E = Math.imul(ke, ct), v = Math.imul(ke, qt), v = v + Math.imul(Qe, ct) | 0, P = Math.imul(Qe, qt), E = E + Math.imul(_e, Et) | 0, v = v + Math.imul(_e, er) | 0, v = v + Math.imul(Ze, Et) | 0, P = P + Math.imul(Ze, er) | 0, E = E + Math.imul(Le, Dt) | 0, v = v + Math.imul(Le, kt) | 0, v = v + Math.imul(qe, Dt) | 0, P = P + Math.imul(qe, kt) | 0, E = E + Math.imul(Me, gt) | 0, v = v + Math.imul(Me, Rt) | 0, v = v + Math.imul(Ne, gt) | 0, P = P + Math.imul(Ne, Rt) | 0, E = E + Math.imul(De, vt) | 0, v = v + Math.imul(De, $t) | 0, v = v + Math.imul(Ce, vt) | 0, P = P + Math.imul(Ce, $t) | 0, E = E + Math.imul(ue, rt) | 0, v = v + Math.imul(ue, Bt) | 0, v = v + Math.imul(ve, rt) | 0, P = P + Math.imul(ve, Bt) | 0, E = E + Math.imul(re, q) | 0, v = v + Math.imul(re, W) | 0, v = v + Math.imul(de, q) | 0, P = P + Math.imul(de, W) | 0, E = E + Math.imul(Q, G) | 0, v = v + Math.imul(Q, j) | 0, v = v + Math.imul(T, G) | 0, P = P + Math.imul(T, j) | 0, E = E + Math.imul(oe, he) | 0, v = v + Math.imul(oe, xe) | 0, v = v + Math.imul(Z, he) | 0, P = P + Math.imul(Z, xe) | 0; var _t = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, E = Math.imul(ke, Et), v = Math.imul(ke, er), v = v + Math.imul(Qe, Et) | 0, P = Math.imul(Qe, er), E = E + Math.imul(_e, Dt) | 0, v = v + Math.imul(_e, kt) | 0, v = v + Math.imul(Ze, Dt) | 0, P = P + Math.imul(Ze, kt) | 0, E = E + Math.imul(Le, gt) | 0, v = v + Math.imul(Le, Rt) | 0, v = v + Math.imul(qe, gt) | 0, P = P + Math.imul(qe, Rt) | 0, E = E + Math.imul(Me, vt) | 0, v = v + Math.imul(Me, $t) | 0, v = v + Math.imul(Ne, vt) | 0, P = P + Math.imul(Ne, $t) | 0, E = E + Math.imul(De, rt) | 0, v = v + Math.imul(De, Bt) | 0, v = v + Math.imul(Ce, rt) | 0, P = P + Math.imul(Ce, Bt) | 0, E = E + Math.imul(ue, U) | 0, v = v + Math.imul(ue, z) | 0, v = v + Math.imul(ve, U) | 0, P = P + Math.imul(ve, z) | 0, E = E + Math.imul(re, G) | 0, v = v + Math.imul(re, j) | 0, v = v + Math.imul(de, G) | 0, P = P + Math.imul(de, j) | 0, E = E + Math.imul(Q, he) | 0, v = v + Math.imul(Q, xe) | 0, v = v + Math.imul(T, he) | 0, P = P + Math.imul(T, xe) | 0; + _ = (P + (v >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, E = Math.imul(ke, Et), v = Math.imul(ke, er), v = v + Math.imul(Qe, Et) | 0, P = Math.imul(Qe, er), E = E + Math.imul(_e, Dt) | 0, v = v + Math.imul(_e, kt) | 0, v = v + Math.imul(Ze, Dt) | 0, P = P + Math.imul(Ze, kt) | 0, E = E + Math.imul(Le, gt) | 0, v = v + Math.imul(Le, Rt) | 0, v = v + Math.imul(qe, gt) | 0, P = P + Math.imul(qe, Rt) | 0, E = E + Math.imul(Me, vt) | 0, v = v + Math.imul(Me, $t) | 0, v = v + Math.imul(Ne, vt) | 0, P = P + Math.imul(Ne, $t) | 0, E = E + Math.imul(De, rt) | 0, v = v + Math.imul(De, Bt) | 0, v = v + Math.imul(Ce, rt) | 0, P = P + Math.imul(Ce, Bt) | 0, E = E + Math.imul(ue, q) | 0, v = v + Math.imul(ue, W) | 0, v = v + Math.imul(ve, q) | 0, P = P + Math.imul(ve, W) | 0, E = E + Math.imul(re, G) | 0, v = v + Math.imul(re, j) | 0, v = v + Math.imul(de, G) | 0, P = P + Math.imul(de, j) | 0, E = E + Math.imul(Q, he) | 0, v = v + Math.imul(Q, xe) | 0, v = v + Math.imul(T, he) | 0, P = P + Math.imul(T, xe) | 0; var ht = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, E = Math.imul(ke, Dt), v = Math.imul(ke, kt), v = v + Math.imul(Qe, Dt) | 0, P = Math.imul(Qe, kt), E = E + Math.imul(_e, gt) | 0, v = v + Math.imul(_e, Rt) | 0, v = v + Math.imul(Ze, gt) | 0, P = P + Math.imul(Ze, Rt) | 0, E = E + Math.imul(Le, vt) | 0, v = v + Math.imul(Le, $t) | 0, v = v + Math.imul(qe, vt) | 0, P = P + Math.imul(qe, $t) | 0, E = E + Math.imul(Me, rt) | 0, v = v + Math.imul(Me, Bt) | 0, v = v + Math.imul(Ne, rt) | 0, P = P + Math.imul(Ne, Bt) | 0, E = E + Math.imul(De, U) | 0, v = v + Math.imul(De, z) | 0, v = v + Math.imul(Ce, U) | 0, P = P + Math.imul(Ce, z) | 0, E = E + Math.imul(ue, G) | 0, v = v + Math.imul(ue, j) | 0, v = v + Math.imul(ve, G) | 0, P = P + Math.imul(ve, j) | 0, E = E + Math.imul(re, he) | 0, v = v + Math.imul(re, xe) | 0, v = v + Math.imul(de, he) | 0, P = P + Math.imul(de, xe) | 0; + _ = (P + (v >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, E = Math.imul(ke, Dt), v = Math.imul(ke, kt), v = v + Math.imul(Qe, Dt) | 0, P = Math.imul(Qe, kt), E = E + Math.imul(_e, gt) | 0, v = v + Math.imul(_e, Rt) | 0, v = v + Math.imul(Ze, gt) | 0, P = P + Math.imul(Ze, Rt) | 0, E = E + Math.imul(Le, vt) | 0, v = v + Math.imul(Le, $t) | 0, v = v + Math.imul(qe, vt) | 0, P = P + Math.imul(qe, $t) | 0, E = E + Math.imul(Me, rt) | 0, v = v + Math.imul(Me, Bt) | 0, v = v + Math.imul(Ne, rt) | 0, P = P + Math.imul(Ne, Bt) | 0, E = E + Math.imul(De, q) | 0, v = v + Math.imul(De, W) | 0, v = v + Math.imul(Ce, q) | 0, P = P + Math.imul(Ce, W) | 0, E = E + Math.imul(ue, G) | 0, v = v + Math.imul(ue, j) | 0, v = v + Math.imul(ve, G) | 0, P = P + Math.imul(ve, j) | 0, E = E + Math.imul(re, he) | 0, v = v + Math.imul(re, xe) | 0, v = v + Math.imul(de, he) | 0, P = P + Math.imul(de, xe) | 0; var xt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, E = Math.imul(ke, gt), v = Math.imul(ke, Rt), v = v + Math.imul(Qe, gt) | 0, P = Math.imul(Qe, Rt), E = E + Math.imul(_e, vt) | 0, v = v + Math.imul(_e, $t) | 0, v = v + Math.imul(Ze, vt) | 0, P = P + Math.imul(Ze, $t) | 0, E = E + Math.imul(Le, rt) | 0, v = v + Math.imul(Le, Bt) | 0, v = v + Math.imul(qe, rt) | 0, P = P + Math.imul(qe, Bt) | 0, E = E + Math.imul(Me, U) | 0, v = v + Math.imul(Me, z) | 0, v = v + Math.imul(Ne, U) | 0, P = P + Math.imul(Ne, z) | 0, E = E + Math.imul(De, G) | 0, v = v + Math.imul(De, j) | 0, v = v + Math.imul(Ce, G) | 0, P = P + Math.imul(Ce, j) | 0, E = E + Math.imul(ue, he) | 0, v = v + Math.imul(ue, xe) | 0, v = v + Math.imul(ve, he) | 0, P = P + Math.imul(ve, xe) | 0; + _ = (P + (v >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, E = Math.imul(ke, gt), v = Math.imul(ke, Rt), v = v + Math.imul(Qe, gt) | 0, P = Math.imul(Qe, Rt), E = E + Math.imul(_e, vt) | 0, v = v + Math.imul(_e, $t) | 0, v = v + Math.imul(Ze, vt) | 0, P = P + Math.imul(Ze, $t) | 0, E = E + Math.imul(Le, rt) | 0, v = v + Math.imul(Le, Bt) | 0, v = v + Math.imul(qe, rt) | 0, P = P + Math.imul(qe, Bt) | 0, E = E + Math.imul(Me, q) | 0, v = v + Math.imul(Me, W) | 0, v = v + Math.imul(Ne, q) | 0, P = P + Math.imul(Ne, W) | 0, E = E + Math.imul(De, G) | 0, v = v + Math.imul(De, j) | 0, v = v + Math.imul(Ce, G) | 0, P = P + Math.imul(Ce, j) | 0, E = E + Math.imul(ue, he) | 0, v = v + Math.imul(ue, xe) | 0, v = v + Math.imul(ve, he) | 0, P = P + Math.imul(ve, xe) | 0; var st = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, E = Math.imul(ke, vt), v = Math.imul(ke, $t), v = v + Math.imul(Qe, vt) | 0, P = Math.imul(Qe, $t), E = E + Math.imul(_e, rt) | 0, v = v + Math.imul(_e, Bt) | 0, v = v + Math.imul(Ze, rt) | 0, P = P + Math.imul(Ze, Bt) | 0, E = E + Math.imul(Le, U) | 0, v = v + Math.imul(Le, z) | 0, v = v + Math.imul(qe, U) | 0, P = P + Math.imul(qe, z) | 0, E = E + Math.imul(Me, G) | 0, v = v + Math.imul(Me, j) | 0, v = v + Math.imul(Ne, G) | 0, P = P + Math.imul(Ne, j) | 0, E = E + Math.imul(De, he) | 0, v = v + Math.imul(De, xe) | 0, v = v + Math.imul(Ce, he) | 0, P = P + Math.imul(Ce, xe) | 0; + _ = (P + (v >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, E = Math.imul(ke, vt), v = Math.imul(ke, $t), v = v + Math.imul(Qe, vt) | 0, P = Math.imul(Qe, $t), E = E + Math.imul(_e, rt) | 0, v = v + Math.imul(_e, Bt) | 0, v = v + Math.imul(Ze, rt) | 0, P = P + Math.imul(Ze, Bt) | 0, E = E + Math.imul(Le, q) | 0, v = v + Math.imul(Le, W) | 0, v = v + Math.imul(qe, q) | 0, P = P + Math.imul(qe, W) | 0, E = E + Math.imul(Me, G) | 0, v = v + Math.imul(Me, j) | 0, v = v + Math.imul(Ne, G) | 0, P = P + Math.imul(Ne, j) | 0, E = E + Math.imul(De, he) | 0, v = v + Math.imul(De, xe) | 0, v = v + Math.imul(Ce, he) | 0, P = P + Math.imul(Ce, xe) | 0; var bt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, E = Math.imul(ke, rt), v = Math.imul(ke, Bt), v = v + Math.imul(Qe, rt) | 0, P = Math.imul(Qe, Bt), E = E + Math.imul(_e, U) | 0, v = v + Math.imul(_e, z) | 0, v = v + Math.imul(Ze, U) | 0, P = P + Math.imul(Ze, z) | 0, E = E + Math.imul(Le, G) | 0, v = v + Math.imul(Le, j) | 0, v = v + Math.imul(qe, G) | 0, P = P + Math.imul(qe, j) | 0, E = E + Math.imul(Me, he) | 0, v = v + Math.imul(Me, xe) | 0, v = v + Math.imul(Ne, he) | 0, P = P + Math.imul(Ne, xe) | 0; + _ = (P + (v >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, E = Math.imul(ke, rt), v = Math.imul(ke, Bt), v = v + Math.imul(Qe, rt) | 0, P = Math.imul(Qe, Bt), E = E + Math.imul(_e, q) | 0, v = v + Math.imul(_e, W) | 0, v = v + Math.imul(Ze, q) | 0, P = P + Math.imul(Ze, W) | 0, E = E + Math.imul(Le, G) | 0, v = v + Math.imul(Le, j) | 0, v = v + Math.imul(qe, G) | 0, P = P + Math.imul(qe, j) | 0, E = E + Math.imul(Me, he) | 0, v = v + Math.imul(Me, xe) | 0, v = v + Math.imul(Ne, he) | 0, P = P + Math.imul(Ne, xe) | 0; var ut = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, E = Math.imul(ke, U), v = Math.imul(ke, z), v = v + Math.imul(Qe, U) | 0, P = Math.imul(Qe, z), E = E + Math.imul(_e, G) | 0, v = v + Math.imul(_e, j) | 0, v = v + Math.imul(Ze, G) | 0, P = P + Math.imul(Ze, j) | 0, E = E + Math.imul(Le, he) | 0, v = v + Math.imul(Le, xe) | 0, v = v + Math.imul(qe, he) | 0, P = P + Math.imul(qe, xe) | 0; + _ = (P + (v >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, E = Math.imul(ke, q), v = Math.imul(ke, W), v = v + Math.imul(Qe, q) | 0, P = Math.imul(Qe, W), E = E + Math.imul(_e, G) | 0, v = v + Math.imul(_e, j) | 0, v = v + Math.imul(Ze, G) | 0, P = P + Math.imul(Ze, j) | 0, E = E + Math.imul(Le, he) | 0, v = v + Math.imul(Le, xe) | 0, v = v + Math.imul(qe, he) | 0, P = P + Math.imul(qe, xe) | 0; var ot = (_ + E | 0) + ((v & 8191) << 13) | 0; _ = (P + (v >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, E = Math.imul(ke, G), v = Math.imul(ke, j), v = v + Math.imul(Qe, G) | 0, P = Math.imul(Qe, j), E = E + Math.imul(_e, he) | 0, v = v + Math.imul(_e, xe) | 0, v = v + Math.imul(Ze, he) | 0, P = P + Math.imul(Ze, xe) | 0; var Se = (_ + E | 0) + ((v & 8191) << 13) | 0; @@ -13647,30 +13647,30 @@ Zv.exports; } return f !== 0 ? m.words[b] = f : m.length--, m.strip(); } - function B(Y, S, m) { - var f = new $(); + function $(Y, S, m) { + var f = new B(); return f.mulp(Y, S, m); } s.prototype.mulTo = function(S, m) { var f, g = this.length + S.length; - return this.length === 10 && S.length === 10 ? f = N(this, S, m) : g < 63 ? f = M(this, S, m) : g < 1024 ? f = L(this, S, m) : f = B(this, S, m), f; + return this.length === 10 && S.length === 10 ? f = N(this, S, m) : g < 63 ? f = M(this, S, m) : g < 1024 ? f = L(this, S, m) : f = $(this, S, m), f; }; - function $(Y, S) { + function B(Y, S) { this.x = Y, this.y = S; } - $.prototype.makeRBT = function(S) { + B.prototype.makeRBT = function(S) { for (var m = new Array(S), f = s.prototype._countBits(S) - 1, g = 0; g < S; g++) m[g] = this.revBin(g, f, S); return m; - }, $.prototype.revBin = function(S, m, f) { + }, B.prototype.revBin = function(S, m, f) { if (S === 0 || S === f - 1) return S; for (var g = 0, b = 0; b < m; b++) g |= (S & 1) << m - b - 1, S >>= 1; return g; - }, $.prototype.permute = function(S, m, f, g, b, x) { + }, B.prototype.permute = function(S, m, f, g, b, x) { for (var _ = 0; _ < x; _++) g[_] = m[S[_]], b[_] = f[S[_]]; - }, $.prototype.transform = function(S, m, f, g, b, x) { + }, B.prototype.transform = function(S, m, f, g, b, x) { this.permute(x, S, m, f, g, b); for (var _ = 1; _ < b; _ <<= 1) for (var E = _ << 1, v = Math.cos(2 * Math.PI / E), P = Math.sin(2 * Math.PI / E), I = 0; I < b; I += E) @@ -13678,34 +13678,34 @@ Zv.exports; var oe = f[I + D], Z = g[I + D], J = f[I + D + _], Q = g[I + D + _], T = F * J - ce * Q; Q = F * Q + ce * J, J = T, f[I + D] = oe + J, g[I + D] = Z + Q, f[I + D + _] = oe - J, g[I + D + _] = Z - Q, D !== E && (T = v * F - P * ce, ce = v * ce + P * F, F = T); } - }, $.prototype.guessLen13b = function(S, m) { + }, B.prototype.guessLen13b = function(S, m) { var f = Math.max(m, S) | 1, g = f & 1, b = 0; for (f = f / 2 | 0; f; f = f >>> 1) b++; return 1 << b + 1 + g; - }, $.prototype.conjugate = function(S, m, f) { + }, B.prototype.conjugate = function(S, m, f) { if (!(f <= 1)) for (var g = 0; g < f / 2; g++) { var b = S[g]; S[g] = S[f - g - 1], S[f - g - 1] = b, b = m[g], m[g] = -m[f - g - 1], m[f - g - 1] = -b; } - }, $.prototype.normalize13b = function(S, m) { + }, B.prototype.normalize13b = function(S, m) { for (var f = 0, g = 0; g < m / 2; g++) { var b = Math.round(S[2 * g + 1] / m) * 8192 + Math.round(S[2 * g] / m) + f; S[g] = b & 67108863, b < 67108864 ? f = 0 : f = b / 67108864 | 0; } return S; - }, $.prototype.convert13b = function(S, m, f, g) { + }, B.prototype.convert13b = function(S, m, f, g) { for (var b = 0, x = 0; x < m; x++) b = b + (S[x] | 0), f[2 * x] = b & 8191, b = b >>> 13, f[2 * x + 1] = b & 8191, b = b >>> 13; for (x = 2 * m; x < g; ++x) f[x] = 0; n(b === 0), n((b & -8192) === 0); - }, $.prototype.stub = function(S) { + }, B.prototype.stub = function(S) { for (var m = new Array(S), f = 0; f < S; f++) m[f] = 0; return m; - }, $.prototype.mulp = function(S, m, f) { + }, B.prototype.mulp = function(S, m, f) { var g = 2 * this.guessLen13b(S.length, m.length), b = this.makeRBT(g), x = this.stub(g), _ = new Array(g), E = new Array(g), v = new Array(g), P = new Array(g), I = new Array(g), F = new Array(g), ce = f.words; ce.length = g, this.convert13b(S.words, S.length, _, g), this.convert13b(m.words, m.length, P, g), this.transform(_, x, E, v, g, b), this.transform(P, x, I, F, g, b); for (var D = 0; D < g; D++) { @@ -13718,7 +13718,7 @@ Zv.exports; return m.words = new Array(this.length + S.length), this.mulTo(S, m); }, s.prototype.mulf = function(S) { var m = new s(null); - return m.words = new Array(this.length + S.length), B(this, S, m); + return m.words = new Array(this.length + S.length), $(this, S, m); }, s.prototype.imul = function(S) { return this.clone().mulTo(S, this); }, s.prototype.imuln = function(S) { @@ -14101,32 +14101,32 @@ Zv.exports; p192: null, p25519: null }; - function W(Y, S) { + function U(Y, S) { this.name = Y, this.p = new s(S, 16), this.n = this.p.bitLength(), this.k = new s(1).iushln(this.n).isub(this.p), this.tmp = this._tmp(); } - W.prototype._tmp = function() { + U.prototype._tmp = function() { var S = new s(null); return S.words = new Array(Math.ceil(this.n / 13)), S; - }, W.prototype.ireduce = function(S) { + }, U.prototype.ireduce = function(S) { var m = S, f; do this.split(m, this.tmp), m = this.imulK(m), m = m.iadd(this.tmp), f = m.bitLength(); while (f > this.n); var g = f < this.n ? -1 : m.ucmp(this.p); return g === 0 ? (m.words[0] = 0, m.length = 1) : g > 0 ? m.isub(this.p) : m.strip !== void 0 ? m.strip() : m._strip(), m; - }, W.prototype.split = function(S, m) { + }, U.prototype.split = function(S, m) { S.iushrn(this.n, 0, m); - }, W.prototype.imulK = function(S) { + }, U.prototype.imulK = function(S) { return S.imul(this.k); }; function V() { - W.call( + U.call( this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f" ); } - i(V, W), V.prototype.split = function(S, m) { + i(V, U), V.prototype.split = function(S, m) { for (var f = 4194303, g = Math.min(S.length, 9), b = 0; b < g; b++) m.words[b] = S.words[b]; if (m.length = g, S.length <= 9) { @@ -14148,29 +14148,29 @@ Zv.exports; return S.words[S.length - 1] === 0 && (S.length--, S.words[S.length - 1] === 0 && S.length--), S; }; function te() { - W.call( + U.call( this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001" ); } - i(te, W); + i(te, U); function R() { - W.call( + U.call( this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff" ); } - i(R, W); + i(R, U); function K() { - W.call( + U.call( this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed" ); } - i(K, W), K.prototype.imulK = function(S) { + i(K, U), K.prototype.imulK = function(S) { for (var m = 0, f = 0; f < S.length; f++) { var g = (S.words[f] | 0) * 19 + m, b = g & 67108863; g >>>= 26, S.words[f] = b, m = g; @@ -14310,8 +14310,8 @@ Zv.exports; return m._forceRed(this); }; })(t, gn); -})(Zv); -var zo = Zv.exports, Qv = {}; +})(Qv); +var zo = Qv.exports, eb = {}; (function(t) { var e = t; function r(s, o) { @@ -14349,9 +14349,9 @@ var zo = Zv.exports, Qv = {}; e.toHex = i, e.encode = function(o, a) { return a === "hex" ? i(o) : o; }; -})(Qv); +})(eb); (function(t) { - var e = t, r = zo, n = wc, i = Qv; + var e = t, r = zo, n = wc, i = eb; e.assert = n, e.toArray = i.toArray, e.zero2 = i.zero2, e.toHex = i.toHex, e.encode = i.encode; function s(d, p, w) { var A = new Array(Math.max(d.bitLength(), w) + 1), M; @@ -14359,8 +14359,8 @@ var zo = Zv.exports, Qv = {}; A[M] = 0; var N = 1 << p + 1, L = d.clone(); for (M = 0; M < A.length; M++) { - var B, $ = L.andln(N - 1); - L.isOdd() ? ($ > (N >> 1) - 1 ? B = (N >> 1) - $ : B = $, L.isubn(B)) : B = 0, A[M] = B, L.iushrn(1); + var $, B = L.andln(N - 1); + L.isOdd() ? (B > (N >> 1) - 1 ? $ = (N >> 1) - B : $ = B, L.isubn($)) : $ = 0, A[M] = $, L.iushrn(1); } return A; } @@ -14372,12 +14372,12 @@ var zo = Zv.exports, Qv = {}; ]; d = d.clone(), p = p.clone(); for (var A = 0, M = 0, N; d.cmpn(-A) > 0 || p.cmpn(-M) > 0; ) { - var L = d.andln(3) + A & 3, B = p.andln(3) + M & 3; - L === 3 && (L = -1), B === 3 && (B = -1); - var $; - L & 1 ? (N = d.andln(7) + A & 7, (N === 3 || N === 5) && B === 2 ? $ = -L : $ = L) : $ = 0, w[0].push($); + var L = d.andln(3) + A & 3, $ = p.andln(3) + M & 3; + L === 3 && (L = -1), $ === 3 && ($ = -1); + var B; + L & 1 ? (N = d.andln(7) + A & 7, (N === 3 || N === 5) && $ === 2 ? B = -L : B = L) : B = 0, w[0].push(B); var H; - B & 1 ? (N = p.andln(7) + M & 7, (N === 3 || N === 5) && L === 2 ? H = -B : H = B) : H = 0, w[1].push(H), 2 * A === $ + 1 && (A = 1 - A), 2 * M === H + 1 && (M = 1 - M), d.iushrn(1), p.iushrn(1); + $ & 1 ? (N = p.andln(7) + M & 7, (N === 3 || N === 5) && L === 2 ? H = -$ : H = $) : H = 0, w[1].push(H), 2 * A === B + 1 && (A = 1 - A), 2 * M === H + 1 && (M = 1 - M), d.iushrn(1), p.iushrn(1); } return w; } @@ -14398,14 +14398,14 @@ var zo = Zv.exports, Qv = {}; } e.intFromLE = l; })(Bi); -var eb = { exports: {} }, am; -eb.exports = function(e) { +var tb = { exports: {} }, am; +tb.exports = function(e) { return am || (am = new la(null)), am.generate(e); }; function la(t) { this.rand = t; } -eb.exports.Rand = la; +tb.exports.Rand = la; la.prototype.generate = function(e) { return this._rand(e); }; @@ -14428,15 +14428,15 @@ if (typeof self == "object") }); else try { - var Tx = Wl; - if (typeof Tx.randomBytes != "function") + var Rx = Wl; + if (typeof Rx.randomBytes != "function") throw new Error("Not supported"); la.prototype._rand = function(e) { - return Tx.randomBytes(e); + return Rx.randomBytes(e); }; } catch { } -var E8 = eb.exports, tb = {}, Wa = zo, Jl = Bi, s0 = Jl.getNAF, iq = Jl.getJSF, o0 = Jl.assert; +var S8 = tb.exports, rb = {}, Wa = zo, Jl = Bi, s0 = Jl.getNAF, iq = Jl.getJSF, o0 = Jl.assert; function Ca(t, e) { this.type = t, this.p = new Wa(e.p, 16), this.red = e.prime ? Wa.red(e.prime) : Wa.mont(this.p), this.zero = new Wa(0).toRed(this.red), this.one = new Wa(1).toRed(this.red), this.two = new Wa(2).toRed(this.red), this.n = e.n && new Wa(e.n, 16), this.g = e.g && this.pointFromJSON(e.g, e.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; var r = this.n && this.p.div(this.n); @@ -14504,7 +14504,7 @@ Ca.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 7 */ ]; r[M].y.cmp(r[N].y) === 0 ? (L[1] = r[M].add(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())) : r[M].y.cmp(r[N].y.redNeg()) === 0 ? (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].add(r[N].neg())) : (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())); - var B = [ + var $ = [ -3, /* -1 -1 */ -1, @@ -14523,10 +14523,10 @@ Ca.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 1 0 */ 3 /* 1 1 */ - ], $ = iq(n[M], n[N]); - for (l = Math.max($[0].length, l), u[M] = new Array(l), u[N] = new Array(l), p = 0; p < l; p++) { - var H = $[0][p] | 0, W = $[1][p] | 0; - u[M][p] = B[(H + 1) * 3 + (W + 1)], u[N][p] = 0, a[M] = L; + ], B = iq(n[M], n[N]); + for (l = Math.max(B[0].length, l), u[M] = new Array(l), u[N] = new Array(l), p = 0; p < l; p++) { + var H = B[0][p] | 0, U = B[1][p] | 0; + u[M][p] = $[(H + 1) * 3 + (U + 1)], u[N][p] = 0, a[M] = L; } } var V = this.jpoint(null, null, null), te = this._wnafT4; @@ -14631,11 +14631,11 @@ ss.prototype.dblp = function(e) { r = r.dbl(); return r; }; -var sq = Bi, rn = zo, rb = z0, Fu = G0, oq = sq.assert; +var sq = Bi, rn = zo, nb = z0, Fu = G0, oq = sq.assert; function os(t) { Fu.call(this, "short", t), this.a = new rn(t.a, 16).toRed(this.red), this.b = new rn(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); } -rb(os, Fu); +nb(os, Fu); var aq = os; os.prototype._getEndomorphism = function(e) { if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { @@ -14670,17 +14670,17 @@ os.prototype._getEndoRoots = function(e) { return [o, a]; }; os.prototype._getEndoBasis = function(e) { - for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new rn(1), o = new rn(0), a = new rn(0), u = new rn(1), l, d, p, w, A, M, N, L = 0, B, $; n.cmpn(0) !== 0; ) { + for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new rn(1), o = new rn(0), a = new rn(0), u = new rn(1), l, d, p, w, A, M, N, L = 0, $, B; n.cmpn(0) !== 0; ) { var H = i.div(n); - B = i.sub(H.mul(n)), $ = a.sub(H.mul(s)); - var W = u.sub(H.mul(o)); - if (!p && B.cmp(r) < 0) - l = N.neg(), d = s, p = B.neg(), w = $; + $ = i.sub(H.mul(n)), B = a.sub(H.mul(s)); + var U = u.sub(H.mul(o)); + if (!p && $.cmp(r) < 0) + l = N.neg(), d = s, p = $.neg(), w = B; else if (p && ++L === 2) break; - N = B, i = n, n = B, a = s, s = $, u = o, o = W; + N = $, i = n, n = $, a = s, s = B, u = o, o = U; } - A = B.neg(), M = $; + A = $.neg(), M = B; var V = p.sqr().add(w.sqr()), te = A.sqr().add(M.sqr()); return te.cmp(V) >= 0 && (A = l, M = d), p.negative && (p = p.neg(), w = w.neg()), A.negative && (A = A.neg(), M = M.neg()), [ { a: p, b: w }, @@ -14717,7 +14717,7 @@ os.prototype._endoWnafMulAdd = function(e, r, n) { function $n(t, e, r, n) { Fu.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new rn(e, 16), this.y = new rn(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); } -rb($n, Fu.BasePoint); +nb($n, Fu.BasePoint); os.prototype.point = function(e, r, n) { return new $n(this, e, r, n); }; @@ -14863,7 +14863,7 @@ $n.prototype.toJ = function() { function Wn(t, e, r, n) { Fu.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new rn(0)) : (this.x = new rn(e, 16), this.y = new rn(r, 16), this.z = new rn(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; } -rb(Wn, Fu.BasePoint); +nb(Wn, Fu.BasePoint); os.prototype.jpoint = function(e, r, n) { return new Wn(this, e, r, n); }; @@ -14914,10 +14914,10 @@ Wn.prototype.dblp = function(e) { } var i = this.curve.a, s = this.curve.tinv, o = this.x, a = this.y, u = this.z, l = u.redSqr().redSqr(), d = a.redAdd(a); for (r = 0; r < e; r++) { - var p = o.redSqr(), w = d.redSqr(), A = w.redSqr(), M = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), N = o.redMul(w), L = M.redSqr().redISub(N.redAdd(N)), B = N.redISub(L), $ = M.redMul(B); - $ = $.redIAdd($).redISub(A); + var p = o.redSqr(), w = d.redSqr(), A = w.redSqr(), M = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), N = o.redMul(w), L = M.redSqr().redISub(N.redAdd(N)), $ = N.redISub(L), B = M.redMul($); + B = B.redIAdd(B).redISub(A); var H = d.redMul(u); - r + 1 < e && (l = l.redMul(A)), o = L, u = H, d = $; + r + 1 < e && (l = l.redMul(A)), o = L, u = H, d = B; } return this.curve.jpoint(o, d.redMul(s), u); }; @@ -14934,8 +14934,8 @@ Wn.prototype._zeroDbl = function() { } else { var p = this.x.redSqr(), w = this.y.redSqr(), A = w.redSqr(), M = this.x.redAdd(w).redSqr().redISub(p).redISub(A); M = M.redIAdd(M); - var N = p.redAdd(p).redIAdd(p), L = N.redSqr(), B = A.redIAdd(A); - B = B.redIAdd(B), B = B.redIAdd(B), e = L.redISub(M).redISub(M), r = N.redMul(M.redISub(e)).redISub(B), n = this.y.redMul(this.z), n = n.redIAdd(n); + var N = p.redAdd(p).redIAdd(p), L = N.redSqr(), $ = A.redIAdd(A); + $ = $.redIAdd($), $ = $.redIAdd($), e = L.redISub(M).redISub(M), r = N.redMul(M.redISub(e)).redISub($), n = this.y.redMul(this.z), n = n.redIAdd(n); } return this.curve.jpoint(e, r, n); }; @@ -14955,8 +14955,8 @@ Wn.prototype._threeDbl = function() { N = N.redIAdd(N); var L = N.redAdd(N); e = M.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(p); - var B = w.redSqr(); - B = B.redIAdd(B), B = B.redIAdd(B), B = B.redIAdd(B), r = M.redMul(N.redISub(e)).redISub(B); + var $ = w.redSqr(); + $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($), r = M.redMul(N.redISub(e)).redISub($); } return this.curve.jpoint(e, r, n); }; @@ -15015,11 +15015,11 @@ Wn.prototype.inspect = function() { Wn.prototype.isInfinity = function() { return this.z.cmpn(0) === 0; }; -var Qc = zo, S8 = z0, Y0 = G0, cq = Bi; +var Qc = zo, A8 = z0, Y0 = G0, cq = Bi; function ju(t) { Y0.call(this, "mont", t), this.a = new Qc(t.a, 16).toRed(this.red), this.b = new Qc(t.b, 16).toRed(this.red), this.i4 = new Qc(4).toRed(this.red).redInvm(), this.two = new Qc(2).toRed(this.red), this.a24 = this.i4.redMul(this.a.redAdd(this.two)); } -S8(ju, Y0); +A8(ju, Y0); var uq = ju; ju.prototype.validate = function(e) { var r = e.normalize().x, n = r.redSqr(), i = n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r), s = i.redSqrt(); @@ -15028,7 +15028,7 @@ ju.prototype.validate = function(e) { function Ln(t, e, r) { Y0.BasePoint.call(this, t, "projective"), e === null && r === null ? (this.x = this.curve.one, this.z = this.curve.zero) : (this.x = new Qc(e, 16), this.z = new Qc(r, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red))); } -S8(Ln, Y0.BasePoint); +A8(Ln, Y0.BasePoint); ju.prototype.decodePoint = function(e, r) { return this.point(cq.toArray(e, r), 1); }; @@ -15085,11 +15085,11 @@ Ln.prototype.normalize = function() { Ln.prototype.getX = function() { return this.normalize(), this.x.fromRed(); }; -var fq = Bi, So = zo, A8 = z0, J0 = G0, lq = fq.assert; +var fq = Bi, So = zo, P8 = z0, J0 = G0, lq = fq.assert; function no(t) { this.twisted = (t.a | 0) !== 1, this.mOneA = this.twisted && (t.a | 0) === -1, this.extended = this.mOneA, J0.call(this, "edwards", t), this.a = new So(t.a, 16).umod(this.red.m), this.a = this.a.toRed(this.red), this.c = new So(t.c, 16).toRed(this.red), this.c2 = this.c.redSqr(), this.d = new So(t.d, 16).toRed(this.red), this.dd = this.d.redAdd(this.d), lq(!this.twisted || this.c.fromRed().cmpn(1) === 0), this.oneC = (t.c | 0) === 1; } -A8(no, J0); +P8(no, J0); var hq = no; no.prototype._mulA = function(e) { return this.mOneA ? e.redNeg() : this.a.redMul(e); @@ -15131,7 +15131,7 @@ no.prototype.validate = function(e) { function Hr(t, e, r, n, i) { J0.BasePoint.call(this, t, "projective"), e === null && r === null && n === null ? (this.x = this.curve.zero, this.y = this.curve.one, this.z = this.curve.one, this.t = this.curve.zero, this.zOne = !0) : (this.x = new So(e, 16), this.y = new So(r, 16), this.z = n ? new So(n, 16) : this.curve.one, this.t = i && new So(i, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.t && !this.t.red && (this.t = this.t.toRed(this.curve.red)), this.zOne = this.z === this.curve.one, this.curve.extended && !this.t && (this.t = this.x.redMul(this.y), this.zOne || (this.t = this.t.redMul(this.z.redInvm())))); } -A8(Hr, J0.BasePoint); +P8(Hr, J0.BasePoint); no.prototype.pointFromJSON = function(e) { return Hr.fromJSON(this, e); }; @@ -15225,10 +15225,10 @@ Hr.prototype.mixedAdd = Hr.prototype.add; (function(t) { var e = t; e.base = G0, e.short = aq, e.mont = uq, e.edwards = hq; -})(tb); -var X0 = {}, cm, Rx; +})(rb); +var X0 = {}, cm, Dx; function dq() { - return Rx || (Rx = 1, cm = { + return Dx || (Dx = 1, cm = { doubles: { step: 4, points: [ @@ -16010,7 +16010,7 @@ function dq() { }), cm; } (function(t) { - var e = t, r = Vl, n = tb, i = Bi, s = i.assert; + var e = t, r = Vl, n = rb, i = Bi, s = i.assert; function o(l) { l.type === "short" ? this.curve = new n.short(l) : l.type === "edwards" ? this.curve = new n.edwards(l) : this.curve = new n.mont(l), this.g = this.curve.g, this.n = this.curve.n, this.hash = l.hash, s(this.g.validate(), "Invalid curve"), s(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); } @@ -16159,13 +16159,13 @@ function dq() { ] }); })(X0); -var pq = Vl, oc = Qv, P8 = wc; +var pq = Vl, oc = eb, M8 = wc; function ya(t) { if (!(this instanceof ya)) return new ya(t); this.hash = t.hash, this.predResist = !!t.predResist, this.outLen = this.hash.outSize, this.minEntropy = t.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null; var e = oc.toArray(t.entropy, t.entropyEnc || "hex"), r = oc.toArray(t.nonce, t.nonceEnc || "hex"), n = oc.toArray(t.pers, t.persEnc || "hex"); - P8( + M8( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._init(e, r, n); @@ -16186,7 +16186,7 @@ ya.prototype._update = function(e) { e && (r = r.update(e)), this.K = r.digest(), this.V = this._hmac().update(this.V).digest(), e && (this.K = this._hmac().update(this.V).update([1]).update(e).digest(), this.V = this._hmac().update(this.V).digest()); }; ya.prototype.reseed = function(e, r, n, i) { - typeof r != "string" && (i = n, n = r, r = null), e = oc.toArray(e, r), n = oc.toArray(n, i), P8( + typeof r != "string" && (i = n, n = r, r = null), e = oc.toArray(e, r), n = oc.toArray(n, i), M8( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._update(e.concat(n || [])), this._reseed = 1; @@ -16249,7 +16249,7 @@ ei.prototype.verify = function(e, r, n) { ei.prototype.inspect = function() { return ""; }; -var a0 = zo, nb = Bi, yq = nb.assert; +var a0 = zo, ib = Bi, yq = ib.assert; function Z0(t, e) { if (t instanceof Z0) return t; @@ -16270,13 +16270,13 @@ function um(t, e) { i <<= 8, i |= t[o], i >>>= 0; return i <= 127 ? !1 : (e.place = o, i); } -function Dx(t) { +function Ox(t) { for (var e = 0, r = t.length - 1; !t[e] && !(t[e + 1] & 128) && e < r; ) e++; return e === 0 ? t : t.slice(e); } Z0.prototype._importDER = function(e, r) { - e = nb.toArray(e, r); + e = ib.toArray(e, r); var n = new xq(); if (e[n.place++] !== 48) return !1; @@ -16317,35 +16317,35 @@ function fm(t, e) { } Z0.prototype.toDER = function(e) { var r = this.r.toArray(), n = this.s.toArray(); - for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Dx(r), n = Dx(n); !n[0] && !(n[1] & 128); ) + for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Ox(r), n = Ox(n); !n[0] && !(n[1] & 128); ) n = n.slice(1); var i = [2]; fm(i, r.length), i = i.concat(r), i.push(2), fm(i, n.length); var s = i.concat(n), o = [48]; - return fm(o, s.length), o = o.concat(s), nb.encode(o, e); + return fm(o, s.length), o = o.concat(s), ib.encode(o, e); }; -var Ao = zo, M8 = gq, _q = Bi, lm = X0, Eq = E8, I8 = _q.assert, ib = bq, Q0 = wq; +var Ao = zo, I8 = gq, _q = Bi, lm = X0, Eq = S8, C8 = _q.assert, sb = bq, Q0 = wq; function es(t) { if (!(this instanceof es)) return new es(t); - typeof t == "string" && (I8( + typeof t == "string" && (C8( Object.prototype.hasOwnProperty.call(lm, t), "Unknown curve " + t ), t = lm[t]), t instanceof lm.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; } var Sq = es; es.prototype.keyPair = function(e) { - return new ib(this, e); + return new sb(this, e); }; es.prototype.keyFromPrivate = function(e, r) { - return ib.fromPrivate(this, e, r); + return sb.fromPrivate(this, e, r); }; es.prototype.keyFromPublic = function(e, r) { - return ib.fromPublic(this, e, r); + return sb.fromPublic(this, e, r); }; es.prototype.genKeyPair = function(e) { e || (e = {}); - for (var r = new M8({ + for (var r = new I8({ hash: this.hash, pers: e.pers, persEnc: e.persEnc || "utf8", @@ -16374,7 +16374,7 @@ es.prototype._truncateToN = function(e, r, n) { }; es.prototype.sign = function(e, r, n, i) { typeof n == "object" && (i = n, n = null), i || (i = {}), r = this.keyFromPrivate(r, n), e = this._truncateToN(e, !1, i.msgBitLength); - for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new M8({ + for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new I8({ hash: this.hash, entropy: o, nonce: a, @@ -16406,7 +16406,7 @@ es.prototype.verify = function(e, r, n, i, s) { return this.curve._maxwellTrick ? (p = this.g.jmulAdd(l, n.getPublic(), d), p.isInfinity() ? !1 : p.eqXToP(o)) : (p = this.g.mulAdd(l, n.getPublic(), d), p.isInfinity() ? !1 : p.getX().umod(this.n).cmp(o) === 0); }; es.prototype.recoverPubKey = function(t, e, r, n) { - I8((3 & r) === r, "The recovery param is more than two bits"), e = new Q0(e, n); + C8((3 & r) === r, "The recovery param is more than two bits"), e = new Q0(e, n); var i = this.n, s = new Ao(t), o = e.r, a = e.s, u = r & 1, l = r >> 1; if (o.cmp(this.curve.p.umod(this.curve.n)) >= 0 && l) throw new Error("Unable to find sencond key candinate"); @@ -16429,9 +16429,9 @@ es.prototype.getKeyRecoveryParam = function(t, e, r, n) { } throw new Error("Unable to find valid recovery factor"); }; -var Xl = Bi, C8 = Xl.assert, Ox = Xl.parseBytes, Uu = Xl.cachedProperty; +var Xl = Bi, T8 = Xl.assert, Nx = Xl.parseBytes, Uu = Xl.cachedProperty; function Nn(t, e) { - this.eddsa = t, this._secret = Ox(e.secret), t.isPoint(e.pub) ? this._pub = e.pub : this._pubBytes = Ox(e.pub); + this.eddsa = t, this._secret = Nx(e.secret), t.isPoint(e.pub) ? this._pub = e.pub : this._pubBytes = Nx(e.pub); } Nn.fromPublic = function(e, r) { return r instanceof Nn ? r : new Nn(e, { pub: r }); @@ -16462,23 +16462,23 @@ Uu(Nn, "messagePrefix", function() { return this.hash().slice(this.eddsa.encodingLength); }); Nn.prototype.sign = function(e) { - return C8(this._secret, "KeyPair can only verify"), this.eddsa.sign(e, this); + return T8(this._secret, "KeyPair can only verify"), this.eddsa.sign(e, this); }; Nn.prototype.verify = function(e, r) { return this.eddsa.verify(e, r, this); }; Nn.prototype.getSecret = function(e) { - return C8(this._secret, "KeyPair is public only"), Xl.encode(this.secret(), e); + return T8(this._secret, "KeyPair is public only"), Xl.encode(this.secret(), e); }; Nn.prototype.getPublic = function(e) { return Xl.encode(this.pubBytes(), e); }; -var Aq = Nn, Pq = zo, ep = Bi, Nx = ep.assert, tp = ep.cachedProperty, Mq = ep.parseBytes; +var Aq = Nn, Pq = zo, ep = Bi, Lx = ep.assert, tp = ep.cachedProperty, Mq = ep.parseBytes; function _c(t, e) { - this.eddsa = t, typeof e != "object" && (e = Mq(e)), Array.isArray(e) && (Nx(e.length === t.encodingLength * 2, "Signature has invalid size"), e = { + this.eddsa = t, typeof e != "object" && (e = Mq(e)), Array.isArray(e) && (Lx(e.length === t.encodingLength * 2, "Signature has invalid size"), e = { R: e.slice(0, t.encodingLength), S: e.slice(t.encodingLength) - }), Nx(e.R && e.S, "Signature without R or S"), t.isPoint(e.R) && (this._R = e.R), e.S instanceof Pq && (this._S = e.S), this._Rencoded = Array.isArray(e.R) ? e.R : e.Rencoded, this._Sencoded = Array.isArray(e.S) ? e.S : e.Sencoded; + }), Lx(e.R && e.S, "Signature without R or S"), t.isPoint(e.R) && (this._R = e.R), e.S instanceof Pq && (this._S = e.S), this._Rencoded = Array.isArray(e.R) ? e.R : e.Rencoded, this._Sencoded = Array.isArray(e.S) ? e.S : e.Sencoded; } tp(_c, "S", function() { return this.eddsa.decodeInt(this.Sencoded()); @@ -16498,7 +16498,7 @@ _c.prototype.toBytes = function() { _c.prototype.toHex = function() { return ep.encode(this.toBytes(), "hex").toUpperCase(); }; -var Iq = _c, Cq = Vl, Tq = X0, Au = Bi, Rq = Au.assert, T8 = Au.parseBytes, R8 = Aq, Lx = Iq; +var Iq = _c, Cq = Vl, Tq = X0, Au = Bi, Rq = Au.assert, R8 = Au.parseBytes, D8 = Aq, kx = Iq; function Ei(t) { if (Rq(t === "ed25519", "only tested with ed25519 so far"), !(this instanceof Ei)) return new Ei(t); @@ -16506,12 +16506,12 @@ function Ei(t) { } var Dq = Ei; Ei.prototype.sign = function(e, r) { - e = T8(e); + e = R8(e); var n = this.keyFromSecret(r), i = this.hashInt(n.messagePrefix(), e), s = this.g.mul(i), o = this.encodePoint(s), a = this.hashInt(o, n.pubBytes(), e).mul(n.priv()), u = i.add(a).umod(this.curve.n); return this.makeSignature({ R: s, S: u, Rencoded: o }); }; Ei.prototype.verify = function(e, r, n) { - if (e = T8(e), r = this.makeSignature(r), r.S().gte(r.eddsa.curve.n) || r.S().isNeg()) + if (e = R8(e), r = this.makeSignature(r), r.S().gte(r.eddsa.curve.n) || r.S().isNeg()) return !1; var i = this.keyFromPublic(n), s = this.hashInt(r.Rencoded(), i.pubBytes(), e), o = this.g.mul(r.S()), a = r.R().add(i.pub().mul(s)); return a.eq(o); @@ -16522,13 +16522,13 @@ Ei.prototype.hashInt = function() { return Au.intFromLE(e.digest()).umod(this.curve.n); }; Ei.prototype.keyFromPublic = function(e) { - return R8.fromPublic(this, e); + return D8.fromPublic(this, e); }; Ei.prototype.keyFromSecret = function(e) { - return R8.fromSecret(this, e); + return D8.fromSecret(this, e); }; Ei.prototype.makeSignature = function(e) { - return e instanceof Lx ? e : new Lx(this, e); + return e instanceof kx ? e : new kx(this, e); }; Ei.prototype.encodePoint = function(e) { var r = e.getY().toArray("le", this.encodingLength); @@ -16550,19 +16550,19 @@ Ei.prototype.isPoint = function(e) { }; (function(t) { var e = t; - e.version = nq.version, e.utils = Bi, e.rand = E8, e.curve = tb, e.curves = X0, e.ec = Sq, e.eddsa = Dq; -})(_8); + e.version = nq.version, e.utils = Bi, e.rand = S8, e.curve = rb, e.curves = X0, e.ec = Sq, e.eddsa = Dq; +})(E8); const Oq = { waku: { publish: "waku_publish", batchPublish: "waku_batchPublish", subscribe: "waku_subscribe", batchSubscribe: "waku_batchSubscribe", subscription: "waku_subscription", unsubscribe: "waku_unsubscribe", batchUnsubscribe: "waku_batchUnsubscribe", batchFetchMessages: "waku_batchFetchMessages" }, irn: { publish: "irn_publish", batchPublish: "irn_batchPublish", subscribe: "irn_subscribe", batchSubscribe: "irn_batchSubscribe", subscription: "irn_subscription", unsubscribe: "irn_unsubscribe", batchUnsubscribe: "irn_batchUnsubscribe", batchFetchMessages: "irn_batchFetchMessages" }, iridium: { publish: "iridium_publish", batchPublish: "iridium_batchPublish", subscribe: "iridium_subscribe", batchSubscribe: "iridium_batchSubscribe", subscription: "iridium_subscription", unsubscribe: "iridium_unsubscribe", batchUnsubscribe: "iridium_batchUnsubscribe", batchFetchMessages: "iridium_batchFetchMessages" } }, Nq = ":"; function hu(t) { const [e, r] = t.split(Nq); return { namespace: e, reference: r }; } -function D8(t, e) { +function O8(t, e) { return t.includes(":") ? [t] : e.chains || []; } -var Lq = Object.defineProperty, kx = Object.getOwnPropertySymbols, kq = Object.prototype.hasOwnProperty, $q = Object.prototype.propertyIsEnumerable, $x = (t, e, r) => e in t ? Lq(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Bx = (t, e) => { - for (var r in e || (e = {})) kq.call(e, r) && $x(t, r, e[r]); - if (kx) for (var r of kx(e)) $q.call(e, r) && $x(t, r, e[r]); +var Lq = Object.defineProperty, $x = Object.getOwnPropertySymbols, kq = Object.prototype.hasOwnProperty, $q = Object.prototype.propertyIsEnumerable, Bx = (t, e, r) => e in t ? Lq(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Fx = (t, e) => { + for (var r in e || (e = {})) kq.call(e, r) && Bx(t, r, e[r]); + if ($x) for (var r of $x(e)) $q.call(e, r) && Bx(t, r, e[r]); return t; }; const Bq = "ReactNative", Di = { reactNative: "react-native", node: "node", browser: "browser", unknown: "unknown" }, Fq = "js"; @@ -16570,10 +16570,10 @@ function c0() { return typeof process < "u" && typeof process.versions < "u" && typeof process.versions.node < "u"; } function qu() { - return !Kl() && !!jv() && navigator.product === Bq; + return !Kl() && !!Uv() && navigator.product === Bq; } function Zl() { - return !c0() && !!jv() && !!Kl(); + return !c0() && !!Uv() && !!Kl(); } function Ql() { return qu() ? Di.reactNative : c0() ? Di.node : Zl() ? Di.browser : Di.unknown; @@ -16588,10 +16588,10 @@ function jq() { } function Uq(t, e) { let r = xl.parse(t); - return r = Bx(Bx({}, r), e), t = xl.stringify(r), t; + return r = Fx(Fx({}, r), e), t = xl.stringify(r), t; } -function O8() { - return z4() || { name: "", description: "", url: "", icons: [""] }; +function N8() { + return W4() || { name: "", description: "", url: "", icons: [""] }; } function qq() { if (Ql() === Di.reactNative && typeof global < "u" && typeof (global == null ? void 0 : global.Platform) < "u") { @@ -16606,23 +16606,23 @@ function qq() { function zq() { var t; const e = Ql(); - return e === Di.browser ? [e, ((t = q4()) == null ? void 0 : t.host) || "unknown"].join(":") : e; + return e === Di.browser ? [e, ((t = z4()) == null ? void 0 : t.host) || "unknown"].join(":") : e; } -function N8(t, e, r) { +function L8(t, e, r) { const n = qq(), i = zq(); return [[t, e].join("-"), [Fq, r].join("-"), n, i].join("/"); } function Wq({ protocol: t, version: e, relayUrl: r, sdkVersion: n, auth: i, projectId: s, useOnCloseEvent: o, bundleId: a }) { - const u = r.split("?"), l = N8(t, e, n), d = { auth: i, ua: l, projectId: s, useOnCloseEvent: o, origin: a || void 0 }, p = Uq(u[1] || "", d); + const u = r.split("?"), l = L8(t, e, n), d = { auth: i, ua: l, projectId: s, useOnCloseEvent: o, origin: a || void 0 }, p = Uq(u[1] || "", d); return u[0] + "?" + p; } function rc(t, e) { return t.filter((r) => e.includes(r)).length === t.length; } -function L8(t) { +function k8(t) { return Object.fromEntries(t.entries()); } -function k8(t) { +function $8(t) { return new Map(Object.entries(t)); } function Ga(t = mt.FIVE_MINUTES, e) { @@ -16650,7 +16650,7 @@ function du(t, e, r) { clearTimeout(s); }); } -function $8(t, e) { +function B8(t, e) { if (typeof e == "string" && e.startsWith(`${t}:`)) return e; if (t.toLowerCase() === "topic") { if (typeof e != "string") throw new Error('Value must be "string" for expirer target type: topic'); @@ -16662,12 +16662,12 @@ function $8(t, e) { throw new Error(`Unknown expirer target type: ${t}`); } function Hq(t) { - return $8("topic", t); + return B8("topic", t); } function Kq(t) { - return $8("id", t); + return B8("id", t); } -function B8(t) { +function F8(t) { const [e, r] = t.split(":"), n = { id: void 0, topic: void 0 }; if (e === "topic" && typeof r == "string") n.topic = r; else if (e === "id" && Number.isInteger(Number(r))) n.id = Number(r); @@ -16724,18 +16724,18 @@ async function Yq(t, e) { } return r; } -function Fx(t, e) { +function jx(t, e) { if (!t.includes(e)) return null; const r = t.split(/([&,?,=])/), n = r.indexOf(e); return r[n + 2]; } -function jx() { +function Ux() { return typeof crypto < "u" && crypto != null && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu, (t) => { const e = Math.random() * 16 | 0; return (t === "x" ? e : e & 3 | 8).toString(16); }); } -function sb() { +function ob() { return typeof process < "u" && process.env.IS_VITEST === "true"; } function Jq() { @@ -16745,7 +16745,7 @@ function Xq(t, e = !1) { const r = Buffer.from(t).toString("base64"); return e ? r.replace(/[=]/g, "") : r; } -function F8(t) { +function j8(t) { return Buffer.from(t, "base64").toString("utf-8"); } const Zq = "https://rpc.walletconnect.org/v1"; @@ -16760,13 +16760,13 @@ async function Qq(t, e, r, n, i, s) { } } function ez(t, e, r) { - return CU(G4(e), r).toLowerCase() === t.toLowerCase(); + return CU(Y4(e), r).toLowerCase() === t.toLowerCase(); } async function tz(t, e, r, n, i, s) { const o = hu(n); if (!o.namespace || !o.reference) throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`); try { - const a = "0x1626ba7e", u = "0000000000000000000000000000000000000000000000000000000000000040", l = "0000000000000000000000000000000000000000000000000000000000000041", d = r.substring(2), p = G4(e).substring(2), w = a + p + u + l + d, A = await fetch(`${s || Zq}/?chainId=${n}&projectId=${i}`, { method: "POST", body: JSON.stringify({ id: rz(), jsonrpc: "2.0", method: "eth_call", params: [{ to: t, data: w }, "latest"] }) }), { result: M } = await A.json(); + const a = "0x1626ba7e", u = "0000000000000000000000000000000000000000000000000000000000000040", l = "0000000000000000000000000000000000000000000000000000000000000041", d = r.substring(2), p = Y4(e).substring(2), w = a + p + u + l + d, A = await fetch(`${s || Zq}/?chainId=${n}&projectId=${i}`, { method: "POST", body: JSON.stringify({ id: rz(), jsonrpc: "2.0", method: "eth_call", params: [{ to: t, data: w }, "latest"] }) }), { result: M } = await A.json(); return M ? M.slice(0, a.length).toLowerCase() === a.toLowerCase() : !1; } catch (a) { return console.error("isValidEip1271Signature: ", a), !1; @@ -16775,26 +16775,26 @@ async function tz(t, e, r, n, i, s) { function rz() { return Date.now() + Math.floor(Math.random() * 1e3); } -var nz = Object.defineProperty, iz = Object.defineProperties, sz = Object.getOwnPropertyDescriptors, Ux = Object.getOwnPropertySymbols, oz = Object.prototype.hasOwnProperty, az = Object.prototype.propertyIsEnumerable, qx = (t, e, r) => e in t ? nz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, cz = (t, e) => { - for (var r in e || (e = {})) oz.call(e, r) && qx(t, r, e[r]); - if (Ux) for (var r of Ux(e)) az.call(e, r) && qx(t, r, e[r]); +var nz = Object.defineProperty, iz = Object.defineProperties, sz = Object.getOwnPropertyDescriptors, qx = Object.getOwnPropertySymbols, oz = Object.prototype.hasOwnProperty, az = Object.prototype.propertyIsEnumerable, zx = (t, e, r) => e in t ? nz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, cz = (t, e) => { + for (var r in e || (e = {})) oz.call(e, r) && zx(t, r, e[r]); + if (qx) for (var r of qx(e)) az.call(e, r) && zx(t, r, e[r]); return t; }, uz = (t, e) => iz(t, sz(e)); -const fz = "did:pkh:", ob = (t) => t == null ? void 0 : t.split(":"), lz = (t) => { - const e = t && ob(t); +const fz = "did:pkh:", ab = (t) => t == null ? void 0 : t.split(":"), lz = (t) => { + const e = t && ab(t); if (e) return t.includes(fz) ? e[3] : e[1]; }, M1 = (t) => { - const e = t && ob(t); + const e = t && ab(t); if (e) return e[2] + ":" + e[3]; }, u0 = (t) => { - const e = t && ob(t); + const e = t && ab(t); if (e) return e.pop(); }; -async function zx(t) { - const { cacao: e, projectId: r } = t, { s: n, p: i } = e, s = j8(i, i.iss), o = u0(i.iss); +async function Wx(t) { + const { cacao: e, projectId: r } = t, { s: n, p: i } = e, s = U8(i, i.iss), o = u0(i.iss); return await Qq(o, s, n, M1(i.iss), r); } -const j8 = (t, e) => { +const U8 = (t, e) => { const r = `${t.domain} wants you to sign in with your Ethereum account:`, n = u0(e); if (!t.aud && !t.uri) throw new Error("Either `aud` or `uri` is required to construct the message"); let i = t.statement || void 0; @@ -16841,7 +16841,7 @@ function gz(t, e, r = {}) { const n = e.map((i) => ({ [`${t}/${i}`]: [r] })); return Object.assign({}, ...n); } -function U8(t) { +function q8(t) { return hc(t), `urn:recap:${hz(t).replace(/=/g, "")}`; } function _l(t) { @@ -16850,14 +16850,14 @@ function _l(t) { } function mz(t, e, r) { const n = pz(t, e, r); - return U8(n); + return q8(n); } function vz(t) { return t && t.includes("urn:recap:"); } function bz(t, e) { const r = _l(t), n = _l(e), i = yz(r, n); - return U8(i); + return q8(i); } function yz(t, e) { hc(t), hc(e); @@ -16889,14 +16889,14 @@ function wz(t = "", e) { const s = n.join(" "), o = `${r}${s}`; return `${t ? t + " " : ""}${o}`; } -function Wx(t) { +function Hx(t) { var e; const r = _l(t); hc(r); const n = (e = r.att) == null ? void 0 : e.eip155; return n ? Object.keys(n).map((i) => i.split("/")[1]) : []; } -function Hx(t) { +function Kx(t) { const e = _l(t); hc(e); const r = []; @@ -16912,17 +16912,17 @@ function Cd(t) { const e = t == null ? void 0 : t[t.length - 1]; return vz(e) ? e : void 0; } -const q8 = "base10", ai = "base16", ha = "base64pad", Af = "base64url", eh = "utf8", z8 = 0, Co = 1, th = 2, xz = 0, Kx = 1, qf = 12, ab = 32; +const z8 = "base10", ai = "base16", ha = "base64pad", Af = "base64url", eh = "utf8", W8 = 0, Co = 1, th = 2, xz = 0, Vx = 1, qf = 12, cb = 32; function _z() { - const t = Xv.generateKeyPair(); + const t = Zv.generateKeyPair(); return { privateKey: On(t.secretKey, ai), publicKey: On(t.publicKey, ai) }; } function I1() { - const t = Pa.randomBytes(ab); + const t = Pa.randomBytes(cb); return On(t, ai); } function Ez(t, e) { - const r = Xv.sharedKey(Rn(t, ai), Rn(e, ai), !0), n = new qU(Yl.SHA256, r).expand(ab); + const r = Zv.sharedKey(Rn(t, ai), Rn(e, ai), !0), n = new qU(Yl.SHA256, r).expand(cb); return On(n, ai); } function Td(t) { @@ -16933,24 +16933,24 @@ function xo(t) { const e = Yl.hash(Rn(t, eh)); return On(e, ai); } -function W8(t) { - return Rn(`${t}`, q8); +function H8(t) { + return Rn(`${t}`, z8); } function dc(t) { - return Number(On(t, q8)); + return Number(On(t, z8)); } function Sz(t) { - const e = W8(typeof t.type < "u" ? t.type : z8); + const e = H8(typeof t.type < "u" ? t.type : W8); if (dc(e) === Co && typeof t.senderPublicKey > "u") throw new Error("Missing sender public key for type 1 envelope"); - const r = typeof t.senderPublicKey < "u" ? Rn(t.senderPublicKey, ai) : void 0, n = typeof t.iv < "u" ? Rn(t.iv, ai) : Pa.randomBytes(qf), i = new Yv.ChaCha20Poly1305(Rn(t.symKey, ai)).seal(n, Rn(t.message, eh)); - return H8({ type: e, sealed: i, iv: n, senderPublicKey: r, encoding: t.encoding }); + const r = typeof t.senderPublicKey < "u" ? Rn(t.senderPublicKey, ai) : void 0, n = typeof t.iv < "u" ? Rn(t.iv, ai) : Pa.randomBytes(qf), i = new Jv.ChaCha20Poly1305(Rn(t.symKey, ai)).seal(n, Rn(t.message, eh)); + return K8({ type: e, sealed: i, iv: n, senderPublicKey: r, encoding: t.encoding }); } function Az(t, e) { - const r = W8(th), n = Pa.randomBytes(qf), i = Rn(t, eh); - return H8({ type: r, sealed: i, iv: n, encoding: e }); + const r = H8(th), n = Pa.randomBytes(qf), i = Rn(t, eh); + return K8({ type: r, sealed: i, iv: n, encoding: e }); } function Pz(t) { - const e = new Yv.ChaCha20Poly1305(Rn(t.symKey, ai)), { sealed: r, iv: n } = El({ encoded: t.encoded, encoding: t == null ? void 0 : t.encoding }), i = e.open(n, r); + const e = new Jv.ChaCha20Poly1305(Rn(t.symKey, ai)), { sealed: r, iv: n } = El({ encoded: t.encoded, encoding: t == null ? void 0 : t.encoding }), i = e.open(n, r); if (i === null) throw new Error("Failed to decrypt"); return On(i, eh); } @@ -16958,7 +16958,7 @@ function Mz(t, e) { const { sealed: r } = El({ encoded: t, encoding: e }); return On(r, eh); } -function H8(t) { +function K8(t) { const { encoding: e = ha } = t; if (dc(t.type) === th) return On(Sd([t.type, t.sealed]), e); if (dc(t.type) === Co) { @@ -16968,9 +16968,9 @@ function H8(t) { return On(Sd([t.type, t.iv, t.sealed]), e); } function El(t) { - const { encoded: e, encoding: r = ha } = t, n = Rn(e, r), i = n.slice(xz, Kx), s = Kx; + const { encoded: e, encoding: r = ha } = t, n = Rn(e, r), i = n.slice(xz, Vx), s = Vx; if (dc(i) === Co) { - const l = s + ab, d = l + qf, p = n.slice(s, l), w = n.slice(l, d), A = n.slice(d); + const l = s + cb, d = l + qf, p = n.slice(s, l), w = n.slice(l, d), A = n.slice(d); return { type: i, sealed: A, iv: w, senderPublicKey: p }; } if (dc(i) === th) { @@ -16982,24 +16982,24 @@ function El(t) { } function Iz(t, e) { const r = El({ encoded: t, encoding: e == null ? void 0 : e.encoding }); - return K8({ type: dc(r.type), senderPublicKey: typeof r.senderPublicKey < "u" ? On(r.senderPublicKey, ai) : void 0, receiverPublicKey: e == null ? void 0 : e.receiverPublicKey }); + return V8({ type: dc(r.type), senderPublicKey: typeof r.senderPublicKey < "u" ? On(r.senderPublicKey, ai) : void 0, receiverPublicKey: e == null ? void 0 : e.receiverPublicKey }); } -function K8(t) { - const e = (t == null ? void 0 : t.type) || z8; +function V8(t) { + const e = (t == null ? void 0 : t.type) || W8; if (e === Co) { if (typeof (t == null ? void 0 : t.senderPublicKey) > "u") throw new Error("missing sender public key"); if (typeof (t == null ? void 0 : t.receiverPublicKey) > "u") throw new Error("missing receiver public key"); } return { type: e, senderPublicKey: t == null ? void 0 : t.senderPublicKey, receiverPublicKey: t == null ? void 0 : t.receiverPublicKey }; } -function Vx(t) { +function Gx(t) { return t.type === Co && typeof t.senderPublicKey == "string" && typeof t.receiverPublicKey == "string"; } -function Gx(t) { +function Yx(t) { return t.type === th; } function Cz(t) { - return new _8.ec("p256").keyFromPublic({ x: Buffer.from(t.x, "base64").toString("hex"), y: Buffer.from(t.y, "base64").toString("hex") }, "hex"); + return new E8.ec("p256").keyFromPublic({ x: Buffer.from(t.x, "base64").toString("hex"), y: Buffer.from(t.y, "base64").toString("hex") }, "hex"); } function Tz(t) { let e = t.replace(/-/g, "+").replace(/_/g, "/"); @@ -17025,9 +17025,9 @@ function Bf(t) { if (typeof e > "u") throw new Error(`Relay Protocol not supported: ${t}`); return e; } -var Nz = Object.defineProperty, Lz = Object.defineProperties, kz = Object.getOwnPropertyDescriptors, Yx = Object.getOwnPropertySymbols, $z = Object.prototype.hasOwnProperty, Bz = Object.prototype.propertyIsEnumerable, Jx = (t, e, r) => e in t ? Nz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Xx = (t, e) => { - for (var r in e || (e = {})) $z.call(e, r) && Jx(t, r, e[r]); - if (Yx) for (var r of Yx(e)) Bz.call(e, r) && Jx(t, r, e[r]); +var Nz = Object.defineProperty, Lz = Object.defineProperties, kz = Object.getOwnPropertyDescriptors, Jx = Object.getOwnPropertySymbols, $z = Object.prototype.hasOwnProperty, Bz = Object.prototype.propertyIsEnumerable, Xx = (t, e, r) => e in t ? Nz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Zx = (t, e) => { + for (var r in e || (e = {})) $z.call(e, r) && Xx(t, r, e[r]); + if (Jx) for (var r of Jx(e)) Bz.call(e, r) && Xx(t, r, e[r]); return t; }, Fz = (t, e) => Lz(t, kz(e)); function jz(t, e = "-") { @@ -17039,9 +17039,9 @@ function jz(t, e = "-") { } }), r; } -function Zx(t) { +function Qx(t) { if (!t.includes("wc:")) { - const u = F8(t); + const u = j8(t); u != null && u.includes("wc:") && (t = u); } t = t.includes("wc://") ? t.replace("wc://", "") : t, t = t.includes("wc:") ? t.replace("wc:", "") : t; @@ -17058,8 +17058,8 @@ function qz(t, e = "-") { t[i] && (n[s] = t[i]); }), n; } -function Qx(t) { - return `${t.protocol}:${t.topic}@${t.version}?` + xl.stringify(Xx(Fz(Xx({ symKey: t.symKey }, qz(t.relay)), { expiryTimestamp: t.expiryTimestamp }), t.methods ? { methods: t.methods.join(",") } : {})); +function e3(t) { + return `${t.protocol}:${t.topic}@${t.version}?` + xl.stringify(Zx(Fz(Zx({ symKey: t.symKey }, qz(t.relay)), { expiryTimestamp: t.expiryTimestamp }), t.methods ? { methods: t.methods.join(",") } : {})); } function fd(t, e, r) { return `${t}?wc_ev=${r}&topic=${e}`; @@ -17089,11 +17089,11 @@ function Hz(t, e) { zu(n.accounts).includes(e) && r.push(...n.events); }), r; } -function cb(t) { +function ub(t) { return t.includes(":"); } function Ff(t) { - return cb(t) ? t.split(":")[0] : t; + return ub(t) ? t.split(":")[0] : t; } function Kz(t) { const e = {}; @@ -17102,7 +17102,7 @@ function Kz(t) { e[n] || (e[n] = { accounts: [], chains: [], events: [] }), e[n].accounts.push(r), e[n].chains.push(`${n}:${i}`); }), e; } -function e3(t, e) { +function t3(t, e) { e = e.map((n) => n.replace("did:pkh:", "")); const r = Kz(e); for (const [n, i] of Object.entries(r)) i.methods ? i.methods = Id(i.methods, t) : i.methods = t, i.events = ["chainChanged", "accountsChanged"]; @@ -17123,13 +17123,13 @@ function pc(t, e) { function Sl(t) { return Object.getPrototypeOf(t) === Object.prototype && Object.keys(t).length; } -function mi(t) { +function vi(t) { return typeof t > "u"; } function dn(t, e) { - return e && mi(t) ? !0 : typeof t == "string" && !!t.trim().length; + return e && vi(t) ? !0 : typeof t == "string" && !!t.trim().length; } -function ub(t, e) { +function fb(t, e) { return typeof t == "number" && !isNaN(t); } function Yz(t, e) { @@ -17137,7 +17137,7 @@ function Yz(t, e) { let s = !0; return rc(i, n) ? (n.forEach((o) => { const { accounts: a, methods: u, events: l } = t.namespaces[o], d = zu(a), p = r[o]; - (!rc(D8(o, p), d) || !rc(p.methods, u) || !rc(p.events, l)) && (s = !1); + (!rc(O8(o, p), d) || !rc(p.methods, u) || !rc(p.events, l)) && (s = !1); }), s) : !1; } function f0(t) { @@ -17164,7 +17164,7 @@ function Xz(t) { try { if (dn(t, !1)) { if (e(t)) return !0; - const r = F8(t); + const r = j8(t); return e(r); } } catch { @@ -17182,7 +17182,7 @@ function eW(t, e) { let r = null; return dn(t == null ? void 0 : t.publicKey, !1) || (r = ft("MISSING_OR_INVALID", `${e} controller public key should be a string`)), r; } -function t3(t) { +function r3(t) { let e = !0; return pc(t) ? t.length && (e = t.every((r) => dn(r, !1))) : e = !1, e; } @@ -17196,7 +17196,7 @@ function rW(t, e, r) { let n = null; return Object.entries(t).forEach(([i, s]) => { if (n) return; - const o = tW(i, D8(i, s), `${e} ${r}`); + const o = tW(i, O8(i, s), `${e} ${r}`); o && (n = o); }), n; } @@ -17216,9 +17216,9 @@ function iW(t, e) { } function sW(t, e) { let r = null; - return t3(t == null ? void 0 : t.methods) ? t3(t == null ? void 0 : t.events) || (r = Or("UNSUPPORTED_EVENTS", `${e}, events should be an array of strings or empty array for no events`)) : r = Or("UNSUPPORTED_METHODS", `${e}, methods should be an array of strings or empty array for no methods`), r; + return r3(t == null ? void 0 : t.methods) ? r3(t == null ? void 0 : t.events) || (r = Or("UNSUPPORTED_EVENTS", `${e}, events should be an array of strings or empty array for no events`)) : r = Or("UNSUPPORTED_METHODS", `${e}, methods should be an array of strings or empty array for no methods`), r; } -function V8(t, e) { +function G8(t, e) { let r = null; return Object.values(t).forEach((n) => { if (r) return; @@ -17229,7 +17229,7 @@ function V8(t, e) { function oW(t, e, r) { let n = null; if (t && Sl(t)) { - const i = V8(t, e); + const i = G8(t, e); i && (n = i); const s = rW(t, e, r); s && (n = s); @@ -17239,41 +17239,41 @@ function oW(t, e, r) { function hm(t, e) { let r = null; if (t && Sl(t)) { - const n = V8(t, e); + const n = G8(t, e); n && (r = n); const i = iW(t, e); i && (r = i); } else r = ft("MISSING_OR_INVALID", `${e}, namespaces should be an object with data`); return r; } -function G8(t) { +function Y8(t) { return dn(t.protocol, !0); } function aW(t, e) { let r = !1; return t ? t && pc(t) && t.length && t.forEach((n) => { - r = G8(n); + r = Y8(n); }) : r = !0, r; } function cW(t) { return typeof t == "number"; } -function gi(t) { +function mi(t) { return typeof t < "u" && typeof t !== null; } function uW(t) { - return !(!t || typeof t != "object" || !t.code || !ub(t.code) || !t.message || !dn(t.message, !1)); + return !(!t || typeof t != "object" || !t.code || !fb(t.code) || !t.message || !dn(t.message, !1)); } function fW(t) { - return !(mi(t) || !dn(t.method, !1)); + return !(vi(t) || !dn(t.method, !1)); } function lW(t) { - return !(mi(t) || mi(t.result) && mi(t.error) || !ub(t.id) || !dn(t.jsonrpc, !1)); + return !(vi(t) || vi(t.result) && vi(t.error) || !fb(t.id) || !dn(t.jsonrpc, !1)); } function hW(t) { - return !(mi(t) || !dn(t.name, !1)); + return !(vi(t) || !dn(t.name, !1)); } -function r3(t, e) { +function n3(t, e) { return !(!f0(e) || !zz(t).includes(e)); } function dW(t, e, r) { @@ -17282,9 +17282,9 @@ function dW(t, e, r) { function pW(t, e, r) { return dn(r, !1) ? Hz(t, e).includes(r) : !1; } -function n3(t, e, r) { +function i3(t, e, r) { let n = null; - const i = gW(t), s = mW(e), o = Object.keys(i), a = Object.keys(s), u = i3(Object.keys(t)), l = i3(Object.keys(e)), d = u.filter((p) => !l.includes(p)); + const i = gW(t), s = mW(e), o = Object.keys(i), a = Object.keys(s), u = s3(Object.keys(t)), l = s3(Object.keys(e)), d = u.filter((p) => !l.includes(p)); return d.length && (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces keys don't satisfy requiredNamespaces. Required: ${d.toString()} Received: ${Object.keys(e).toString()}`)), rc(o, a) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces chains don't satisfy required namespaces. @@ -17308,7 +17308,7 @@ function gW(t) { }); }), e; } -function i3(t) { +function s3(t) { return [...new Set(t.map((e) => e.includes(":") ? e.split(":")[0] : e))]; } function mW(t) { @@ -17324,9 +17324,9 @@ function mW(t) { }), e; } function vW(t, e) { - return ub(t) && t <= e.max && t >= e.min; + return fb(t) && t <= e.max && t >= e.min; } -function s3() { +function o3() { const t = Ql(); return new Promise((e) => { switch (t) { @@ -17385,31 +17385,31 @@ class Pf { delete dm[e]; } } -const SW = "PARSE_ERROR", AW = "INVALID_REQUEST", PW = "METHOD_NOT_FOUND", MW = "INVALID_PARAMS", Y8 = "INTERNAL_ERROR", fb = "SERVER_ERROR", IW = [-32700, -32600, -32601, -32602, -32603], zf = { +const SW = "PARSE_ERROR", AW = "INVALID_REQUEST", PW = "METHOD_NOT_FOUND", MW = "INVALID_PARAMS", J8 = "INTERNAL_ERROR", lb = "SERVER_ERROR", IW = [-32700, -32600, -32601, -32602, -32603], zf = { [SW]: { code: -32700, message: "Parse error" }, [AW]: { code: -32600, message: "Invalid Request" }, [PW]: { code: -32601, message: "Method not found" }, [MW]: { code: -32602, message: "Invalid params" }, - [Y8]: { code: -32603, message: "Internal error" }, - [fb]: { code: -32e3, message: "Server error" } -}, J8 = fb; + [J8]: { code: -32603, message: "Internal error" }, + [lb]: { code: -32e3, message: "Server error" } +}, X8 = lb; function CW(t) { return IW.includes(t); } -function o3(t) { - return Object.keys(zf).includes(t) ? zf[t] : zf[J8]; +function a3(t) { + return Object.keys(zf).includes(t) ? zf[t] : zf[X8]; } function TW(t) { const e = Object.values(zf).find((r) => r.code === t); - return e || zf[J8]; + return e || zf[X8]; } -function X8(t, e, r) { +function Z8(t, e, r) { return t.message.includes("getaddrinfo ENOTFOUND") || t.message.includes("connect ECONNREFUSED") ? new Error(`Unavailable ${r} RPC url at ${e}`) : t; } -var Z8 = {}, mo = {}, a3; +var Q8 = {}, mo = {}, c3; function RW() { - if (a3) return mo; - a3 = 1, Object.defineProperty(mo, "__esModule", { value: !0 }), mo.isBrowserCryptoAvailable = mo.getSubtleCrypto = mo.getBrowerCrypto = void 0; + if (c3) return mo; + c3 = 1, Object.defineProperty(mo, "__esModule", { value: !0 }), mo.isBrowserCryptoAvailable = mo.getSubtleCrypto = mo.getBrowerCrypto = void 0; function t() { return (gn == null ? void 0 : gn.crypto) || (gn == null ? void 0 : gn.msCrypto) || {}; } @@ -17424,10 +17424,10 @@ function RW() { } return mo.isBrowserCryptoAvailable = r, mo; } -var vo = {}, c3; +var vo = {}, u3; function DW() { - if (c3) return vo; - c3 = 1, Object.defineProperty(vo, "__esModule", { value: !0 }), vo.isBrowser = vo.isNode = vo.isReactNative = void 0; + if (u3) return vo; + u3 = 1, Object.defineProperty(vo, "__esModule", { value: !0 }), vo.isBrowser = vo.isNode = vo.isReactNative = void 0; function t() { return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative"; } @@ -17445,7 +17445,7 @@ function DW() { Object.defineProperty(t, "__esModule", { value: !0 }); const e = jl; e.__exportStar(RW(), t), e.__exportStar(DW(), t); -})(Z8); +})(Q8); function ua(t = 3) { const e = Date.now() * Math.pow(10, t), r = Math.floor(Math.random() * Math.pow(10, t)); return e + r; @@ -17476,7 +17476,7 @@ function np(t, e, r) { }; } function OW(t, e) { - return typeof t > "u" ? o3(Y8) : (typeof t == "string" && (t = Object.assign(Object.assign({}, o3(fb)), { message: t })), CW(t.code) && (t = TW(t.code)), t); + return typeof t > "u" ? a3(J8) : (typeof t == "string" && (t = Object.assign(Object.assign({}, a3(lb)), { message: t })), CW(t.code) && (t = TW(t.code)), t); } let NW = class { }, LW = class extends NW { @@ -17494,27 +17494,27 @@ function FW(t) { if (!(!e || !e.length)) return e[0]; } -function Q8(t, e) { +function eE(t, e) { const r = FW(t); return typeof r > "u" ? !1 : new RegExp(e).test(r); } -function u3(t) { - return Q8(t, $W); -} function f3(t) { - return Q8(t, BW); + return eE(t, $W); +} +function l3(t) { + return eE(t, BW); } function jW(t) { return new RegExp("wss?://localhost(:d{2,5})?").test(t); } -function eE(t) { +function tE(t) { return typeof t == "object" && "id" in t && "jsonrpc" in t && t.jsonrpc === "2.0"; } -function lb(t) { - return eE(t) && "method" in t; +function hb(t) { + return tE(t) && "method" in t; } function ip(t) { - return eE(t) && (js(t) || Zi(t)); + return tE(t) && (js(t) || Zi(t)); } function js(t) { return "result" in t; @@ -17583,10 +17583,10 @@ let as = class extends kW { this.hasRegisteredEventListeners || (this.connection.on("payload", (e) => this.onPayload(e)), this.connection.on("close", (e) => this.onClose(e)), this.connection.on("error", (e) => this.events.emit("error", e)), this.connection.on("register_error", (e) => this.onClose()), this.hasRegisteredEventListeners = !0); } }; -const UW = () => typeof WebSocket < "u" ? WebSocket : typeof global < "u" && typeof global.WebSocket < "u" ? global.WebSocket : typeof window < "u" && typeof window.WebSocket < "u" ? window.WebSocket : typeof self < "u" && typeof self.WebSocket < "u" ? self.WebSocket : require("ws"), qW = () => typeof WebSocket < "u" || typeof global < "u" && typeof global.WebSocket < "u" || typeof window < "u" && typeof window.WebSocket < "u" || typeof self < "u" && typeof self.WebSocket < "u", l3 = (t) => t.split("?")[0], h3 = 10, zW = UW(); +const UW = () => typeof WebSocket < "u" ? WebSocket : typeof global < "u" && typeof global.WebSocket < "u" ? global.WebSocket : typeof window < "u" && typeof window.WebSocket < "u" ? window.WebSocket : typeof self < "u" && typeof self.WebSocket < "u" ? self.WebSocket : require("ws"), qW = () => typeof WebSocket < "u" || typeof global < "u" && typeof global.WebSocket < "u" || typeof window < "u" && typeof window.WebSocket < "u" || typeof self < "u" && typeof self.WebSocket < "u", h3 = (t) => t.split("?")[0], d3 = 10, zW = UW(); let WW = class { constructor(e) { - if (this.url = e, this.events = new rs.EventEmitter(), this.registering = !1, !f3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); + if (this.url = e, this.events = new rs.EventEmitter(), this.registering = !1, !l3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); this.url = e; } get connected() { @@ -17630,7 +17630,7 @@ let WW = class { } } register(e = this.url) { - if (!f3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); + if (!l3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); if (this.registering) { const r = this.events.getMaxListeners(); return (this.events.listenerCount("register_error") >= r || this.events.listenerCount("open") >= r) && this.events.setMaxListeners(r + 1), new Promise((n, i) => { @@ -17643,7 +17643,7 @@ let WW = class { }); } return this.url = e, this.registering = !0, new Promise((r, n) => { - const i = new URLSearchParams(e).get("origin"), s = Z8.isReactNative() ? { headers: { origin: i } } : { rejectUnauthorized: !jW(e) }, o = new zW(e, [], s); + const i = new URLSearchParams(e).get("origin"), s = Q8.isReactNative() ? { headers: { origin: i } } : { rejectUnauthorized: !jW(e) }, o = new zW(e, [], s); qW() ? o.onerror = (a) => { const u = a; n(this.emitError(u.error)); @@ -17670,21 +17670,21 @@ let WW = class { this.events.emit("payload", s); } parseError(e, r = this.url) { - return X8(e, l3(r), "WS"); + return Z8(e, h3(r), "WS"); } resetMaxListeners() { - this.events.getMaxListeners() > h3 && this.events.setMaxListeners(h3); + this.events.getMaxListeners() > d3 && this.events.setMaxListeners(d3); } emitError(e) { - const r = this.parseError(new Error((e == null ? void 0 : e.message) || `WebSocket connection failed for host: ${l3(this.url)}`)); + const r = this.parseError(new Error((e == null ? void 0 : e.message) || `WebSocket connection failed for host: ${h3(this.url)}`)); return this.events.emit("register_error", r), r; } }; var l0 = { exports: {} }; l0.exports; (function(t, e) { - var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", u = "[object Array]", l = "[object AsyncFunction]", d = "[object Boolean]", p = "[object Date]", w = "[object Error]", A = "[object Function]", M = "[object GeneratorFunction]", N = "[object Map]", L = "[object Number]", B = "[object Null]", $ = "[object Object]", H = "[object Promise]", W = "[object Proxy]", V = "[object RegExp]", te = "[object Set]", R = "[object String]", K = "[object Symbol]", ge = "[object Undefined]", Ee = "[object WeakMap]", Y = "[object ArrayBuffer]", S = "[object DataView]", m = "[object Float32Array]", f = "[object Float64Array]", g = "[object Int8Array]", b = "[object Int16Array]", x = "[object Int32Array]", _ = "[object Uint8Array]", E = "[object Uint8ClampedArray]", v = "[object Uint16Array]", P = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, F = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, D = {}; - D[m] = D[f] = D[g] = D[b] = D[x] = D[_] = D[E] = D[v] = D[P] = !0, D[a] = D[u] = D[Y] = D[d] = D[S] = D[p] = D[w] = D[A] = D[N] = D[L] = D[$] = D[V] = D[te] = D[R] = D[Ee] = !1; + var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", u = "[object Array]", l = "[object AsyncFunction]", d = "[object Boolean]", p = "[object Date]", w = "[object Error]", A = "[object Function]", M = "[object GeneratorFunction]", N = "[object Map]", L = "[object Number]", $ = "[object Null]", B = "[object Object]", H = "[object Promise]", U = "[object Proxy]", V = "[object RegExp]", te = "[object Set]", R = "[object String]", K = "[object Symbol]", ge = "[object Undefined]", Ee = "[object WeakMap]", Y = "[object ArrayBuffer]", S = "[object DataView]", m = "[object Float32Array]", f = "[object Float64Array]", g = "[object Int8Array]", b = "[object Int16Array]", x = "[object Int32Array]", _ = "[object Uint8Array]", E = "[object Uint8ClampedArray]", v = "[object Uint16Array]", P = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, F = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, D = {}; + D[m] = D[f] = D[g] = D[b] = D[x] = D[_] = D[E] = D[v] = D[P] = !0, D[a] = D[u] = D[Y] = D[d] = D[S] = D[p] = D[w] = D[A] = D[N] = D[L] = D[B] = D[V] = D[te] = D[R] = D[Ee] = !1; var oe = typeof gn == "object" && gn && gn.Object === Object && gn, Z = typeof self == "object" && self && self.Object === Object && self, J = oe || Z || Function("return this")(), Q = e && !e.nodeType && e, T = Q && !0 && t && !t.nodeType && t, X = T && T.exports === Q, re = X && oe.process, de = function() { try { return re && re.binding && re.binding("util"); @@ -17747,7 +17747,7 @@ l0.exports; return ae ? "Symbol(src)_1." + ae : ""; }(), tt = _e.toString, Ye = RegExp( "^" + at.call(ke).replace(I, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" - ), dt = X ? J.Buffer : void 0, lt = J.Symbol, ct = J.Uint8Array, qt = _e.propertyIsEnumerable, Jt = qe.splice, Et = lt ? lt.toStringTag : void 0, er = Object.getOwnPropertySymbols, Xt = dt ? dt.isBuffer : void 0, Dt = Ke(Object.keys, Object), kt = yr(J, "DataView"), Ct = yr(J, "Map"), gt = yr(J, "Promise"), Rt = yr(J, "Set"), Nt = yr(J, "WeakMap"), vt = yr(Object, "create"), $t = io(kt), Ft = io(Ct), rt = io(gt), Bt = io(Rt), k = io(Nt), U = lt ? lt.prototype : void 0, z = U ? U.valueOf : void 0; + ), dt = X ? J.Buffer : void 0, lt = J.Symbol, ct = J.Uint8Array, qt = _e.propertyIsEnumerable, Jt = qe.splice, Et = lt ? lt.toStringTag : void 0, er = Object.getOwnPropertySymbols, Xt = dt ? dt.isBuffer : void 0, Dt = Ke(Object.keys, Object), kt = yr(J, "DataView"), Ct = yr(J, "Map"), gt = yr(J, "Promise"), Rt = yr(J, "Set"), Nt = yr(J, "WeakMap"), vt = yr(Object, "create"), $t = io(kt), Ft = io(Ct), rt = io(gt), Bt = io(Rt), k = io(Nt), q = lt ? lt.prototype : void 0, W = q ? q.valueOf : void 0; function C(ae) { var ye = -1, Ge = ae == null ? 0 : ae.length; for (this.clear(); ++ye < Ge; ) { @@ -17898,7 +17898,7 @@ l0.exports; return Mc(ae) ? Pt : ve(Pt, Ge(ae)); } function zt(ae) { - return ae == null ? ae === void 0 ? ge : B : Et && Et in Object(ae) ? $r(ae) : Rp(ae); + return ae == null ? ae === void 0 ? ge : $ : Et && Et in Object(ae) ? $r(ae) : Rp(ae); } function Zt(ae) { return Da(ae) && zt(ae) == a; @@ -17908,8 +17908,8 @@ l0.exports; } function le(ae, ye, Ge, Pt, jr, nr) { var Kr = Mc(ae), vn = Mc(ye), _r = Kr ? u : Ir(ae), Ur = vn ? u : Ir(ye); - _r = _r == a ? $ : _r, Ur = Ur == a ? $ : Ur; - var an = _r == $, ui = Ur == $, bn = _r == Ur; + _r = _r == a ? B : _r, Ur = Ur == a ? B : Ur; + var an = _r == B, fi = Ur == B, bn = _r == Ur; if (bn && Xu(ae)) { if (!Xu(ye)) return !1; @@ -17918,7 +17918,7 @@ l0.exports; if (bn && !an) return nr || (nr = new ut()), Kr || mh(ae) ? Qt(ae, ye, Ge, Pt, jr, nr) : gr(ae, ye, _r, Ge, Pt, jr, nr); if (!(Ge & i)) { - var Vr = an && ke.call(ae, "__wrapped__"), ti = ui && ke.call(ye, "__wrapped__"); + var Vr = an && ke.call(ae, "__wrapped__"), ti = fi && ke.call(ye, "__wrapped__"); if (Vr || ti) { var fs = Vr ? ae.value() : ae, Fi = ti ? ye.value() : ye; return nr || (nr = new ut()), jr(fs, Fi, Ge, Pt, nr); @@ -17950,7 +17950,7 @@ l0.exports; var Ur = nr.get(ae); if (Ur && nr.get(ye)) return Ur == ye; - var an = -1, ui = !0, bn = Ge & s ? new xt() : void 0; + var an = -1, fi = !0, bn = Ge & s ? new xt() : void 0; for (nr.set(ae, ye), nr.set(ye, ae); ++an < vn; ) { var Vr = ae[an], ti = ye[an]; if (Pt) @@ -17958,7 +17958,7 @@ l0.exports; if (fs !== void 0) { if (fs) continue; - ui = !1; + fi = !1; break; } if (bn) { @@ -17966,15 +17966,15 @@ l0.exports; if (!$e(bn, Is) && (Vr === Fi || jr(Vr, Fi, Ge, Pt, nr))) return bn.push(Is); })) { - ui = !1; + fi = !1; break; } } else if (!(Vr === ti || jr(Vr, ti, Ge, Pt, nr))) { - ui = !1; + fi = !1; break; } } - return nr.delete(ae), nr.delete(ye), ui; + return nr.delete(ae), nr.delete(ye), fi; } function gr(ae, ye, Ge, Pt, jr, nr, Kr) { switch (Ge) { @@ -18006,8 +18006,8 @@ l0.exports; var an = Qt(vn(ae), vn(ye), Pt, jr, nr, Kr); return Kr.delete(ae), an; case K: - if (z) - return z.call(ae) == z.call(ye); + if (W) + return W.call(ae) == W.call(ye); } return !1; } @@ -18015,8 +18015,8 @@ l0.exports; var Kr = Ge & i, vn = Rr(ae), _r = vn.length, Ur = Rr(ye), an = Ur.length; if (_r != an && !Kr) return !1; - for (var ui = _r; ui--; ) { - var bn = vn[ui]; + for (var fi = _r; fi--; ) { + var bn = vn[fi]; if (!(Kr ? bn in ye : ke.call(ye, bn))) return !1; } @@ -18025,8 +18025,8 @@ l0.exports; return Vr == ye; var ti = !0; nr.set(ae, ye), nr.set(ye, ae); - for (var fs = Kr; ++ui < _r; ) { - bn = vn[ui]; + for (var fs = Kr; ++fi < _r; ) { + bn = vn[fi]; var Fi = ae[bn], Is = ye[bn]; if (Pt) var Zu = Kr ? Pt(Is, Fi, bn, ye, ae, nr) : Pt(Fi, Is, bn, ae, ye, nr); @@ -18069,7 +18069,7 @@ l0.exports; })); } : Fr, Ir = zt; (kt && Ir(new kt(new ArrayBuffer(1))) != S || Ct && Ir(new Ct()) != N || gt && Ir(gt.resolve()) != H || Rt && Ir(new Rt()) != te || Nt && Ir(new Nt()) != Ee) && (Ir = function(ae) { - var ye = zt(ae), Ge = ye == $ ? ae.constructor : void 0, Pt = Ge ? io(Ge) : ""; + var ye = zt(ae), Ge = ye == B ? ae.constructor : void 0, Pt = Ge ? io(Ge) : ""; if (Pt) switch (Pt) { case $t: @@ -18134,7 +18134,7 @@ l0.exports; if (!gh(ae)) return !1; var ye = zt(ae); - return ye == A || ye == M || ye == l || ye == W; + return ye == A || ye == M || ye == l || ye == U; } function ph(ae) { return typeof ae == "number" && ae > -1 && ae % 1 == 0 && ae <= o; @@ -18159,7 +18159,7 @@ l0.exports; t.exports = Op; })(l0, l0.exports); var HW = l0.exports; -const KW = /* @__PURE__ */ ts(HW), tE = "wc", rE = 2, nE = "core", Qs = `${tE}@2:${nE}:`, VW = { logger: "error" }, GW = { database: ":memory:" }, YW = "crypto", d3 = "client_ed25519_seed", JW = mt.ONE_DAY, XW = "keychain", ZW = "0.3", QW = "messages", eH = "0.3", tH = mt.SIX_HOURS, rH = "publisher", iE = "irn", nH = "error", sE = "wss://relay.walletconnect.org", iH = "relayer", oi = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", publish: "relayer_publish" }, sH = "_subscription", Vi = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, oH = 0.1, T1 = "2.17.2", zr = { link_mode: "link_mode", relay: "relay" }, aH = "0.3", cH = "WALLETCONNECT_CLIENT_ID", p3 = "WALLETCONNECT_LINK_MODE_APPS", Us = { created: "subscription_created", deleted: "subscription_deleted", sync: "subscription_sync", resubscribed: "subscription_resubscribed" }, uH = "subscription", fH = "0.3", lH = mt.FIVE_SECONDS * 1e3, hH = "pairing", dH = "0.3", Mf = { wc_pairingDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1e3 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1001 } }, wc_pairingPing: { req: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1002 }, res: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1003 } }, unregistered_method: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 } } }, Za = { create: "pairing_create", expire: "pairing_expire", delete: "pairing_delete", ping: "pairing_ping" }, ms = { created: "history_created", updated: "history_updated", deleted: "history_deleted", sync: "history_sync" }, pH = "history", gH = "0.3", mH = "expirer", Ji = { created: "expirer_created", deleted: "expirer_deleted", expired: "expirer_expired", sync: "expirer_sync" }, vH = "0.3", bH = "verify-api", yH = "https://verify.walletconnect.com", oE = "https://verify.walletconnect.org", Wf = oE, wH = `${Wf}/v3`, xH = [yH, oE], _H = "echo", EH = "https://echo.walletconnect.com", Fs = { pairing_started: "pairing_started", pairing_uri_validation_success: "pairing_uri_validation_success", pairing_uri_not_expired: "pairing_uri_not_expired", store_new_pairing: "store_new_pairing", subscribing_pairing_topic: "subscribing_pairing_topic", subscribe_pairing_topic_success: "subscribe_pairing_topic_success", existing_pairing: "existing_pairing", pairing_not_expired: "pairing_not_expired", emit_inactive_pairing: "emit_inactive_pairing", emit_session_proposal: "emit_session_proposal" }, wo = { no_internet_connection: "no_internet_connection", malformed_pairing_uri: "malformed_pairing_uri", active_pairing_already_exists: "active_pairing_already_exists", subscribe_pairing_topic_failure: "subscribe_pairing_topic_failure", pairing_expired: "pairing_expired", proposal_listener_not_found: "proposal_listener_not_found" }, vs = { session_approve_started: "session_approve_started", session_namespaces_validation_success: "session_namespaces_validation_success", subscribing_session_topic: "subscribing_session_topic", subscribe_session_topic_success: "subscribe_session_topic_success", publishing_session_approve: "publishing_session_approve", session_approve_publish_success: "session_approve_publish_success", store_session: "store_session", publishing_session_settle: "publishing_session_settle", session_settle_publish_success: "session_settle_publish_success" }, Ha = { no_internet_connection: "no_internet_connection", proposal_expired: "proposal_expired", subscribe_session_topic_failure: "subscribe_session_topic_failure", session_approve_publish_failure: "session_approve_publish_failure", session_settle_publish_failure: "session_settle_publish_failure", session_approve_namespace_validation_failure: "session_approve_namespace_validation_failure", proposal_not_found: "proposal_not_found" }, Ka = { authenticated_session_approve_started: "authenticated_session_approve_started", create_authenticated_session_topic: "create_authenticated_session_topic", cacaos_verified: "cacaos_verified", store_authenticated_session: "store_authenticated_session", subscribing_authenticated_session_topic: "subscribing_authenticated_session_topic", subscribe_authenticated_session_topic_success: "subscribe_authenticated_session_topic_success", publishing_authenticated_session_approve: "publishing_authenticated_session_approve" }, If = { no_internet_connection: "no_internet_connection", invalid_cacao: "invalid_cacao", subscribe_authenticated_session_topic_failure: "subscribe_authenticated_session_topic_failure", authenticated_session_approve_publish_failure: "authenticated_session_approve_publish_failure", authenticated_session_pending_request_not_found: "authenticated_session_pending_request_not_found" }, SH = 0.1, AH = "event-client", PH = 86400, MH = "https://pulse.walletconnect.org/batch"; +const KW = /* @__PURE__ */ ts(HW), rE = "wc", nE = 2, iE = "core", Qs = `${rE}@2:${iE}:`, VW = { logger: "error" }, GW = { database: ":memory:" }, YW = "crypto", p3 = "client_ed25519_seed", JW = mt.ONE_DAY, XW = "keychain", ZW = "0.3", QW = "messages", eH = "0.3", tH = mt.SIX_HOURS, rH = "publisher", sE = "irn", nH = "error", oE = "wss://relay.walletconnect.org", iH = "relayer", oi = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", publish: "relayer_publish" }, sH = "_subscription", Vi = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, oH = 0.1, T1 = "2.17.2", zr = { link_mode: "link_mode", relay: "relay" }, aH = "0.3", cH = "WALLETCONNECT_CLIENT_ID", g3 = "WALLETCONNECT_LINK_MODE_APPS", Us = { created: "subscription_created", deleted: "subscription_deleted", sync: "subscription_sync", resubscribed: "subscription_resubscribed" }, uH = "subscription", fH = "0.3", lH = mt.FIVE_SECONDS * 1e3, hH = "pairing", dH = "0.3", Mf = { wc_pairingDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1e3 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1001 } }, wc_pairingPing: { req: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1002 }, res: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1003 } }, unregistered_method: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 } } }, Za = { create: "pairing_create", expire: "pairing_expire", delete: "pairing_delete", ping: "pairing_ping" }, ms = { created: "history_created", updated: "history_updated", deleted: "history_deleted", sync: "history_sync" }, pH = "history", gH = "0.3", mH = "expirer", Ji = { created: "expirer_created", deleted: "expirer_deleted", expired: "expirer_expired", sync: "expirer_sync" }, vH = "0.3", bH = "verify-api", yH = "https://verify.walletconnect.com", aE = "https://verify.walletconnect.org", Wf = aE, wH = `${Wf}/v3`, xH = [yH, aE], _H = "echo", EH = "https://echo.walletconnect.com", Fs = { pairing_started: "pairing_started", pairing_uri_validation_success: "pairing_uri_validation_success", pairing_uri_not_expired: "pairing_uri_not_expired", store_new_pairing: "store_new_pairing", subscribing_pairing_topic: "subscribing_pairing_topic", subscribe_pairing_topic_success: "subscribe_pairing_topic_success", existing_pairing: "existing_pairing", pairing_not_expired: "pairing_not_expired", emit_inactive_pairing: "emit_inactive_pairing", emit_session_proposal: "emit_session_proposal" }, wo = { no_internet_connection: "no_internet_connection", malformed_pairing_uri: "malformed_pairing_uri", active_pairing_already_exists: "active_pairing_already_exists", subscribe_pairing_topic_failure: "subscribe_pairing_topic_failure", pairing_expired: "pairing_expired", proposal_listener_not_found: "proposal_listener_not_found" }, vs = { session_approve_started: "session_approve_started", session_namespaces_validation_success: "session_namespaces_validation_success", subscribing_session_topic: "subscribing_session_topic", subscribe_session_topic_success: "subscribe_session_topic_success", publishing_session_approve: "publishing_session_approve", session_approve_publish_success: "session_approve_publish_success", store_session: "store_session", publishing_session_settle: "publishing_session_settle", session_settle_publish_success: "session_settle_publish_success" }, Ha = { no_internet_connection: "no_internet_connection", proposal_expired: "proposal_expired", subscribe_session_topic_failure: "subscribe_session_topic_failure", session_approve_publish_failure: "session_approve_publish_failure", session_settle_publish_failure: "session_settle_publish_failure", session_approve_namespace_validation_failure: "session_approve_namespace_validation_failure", proposal_not_found: "proposal_not_found" }, Ka = { authenticated_session_approve_started: "authenticated_session_approve_started", create_authenticated_session_topic: "create_authenticated_session_topic", cacaos_verified: "cacaos_verified", store_authenticated_session: "store_authenticated_session", subscribing_authenticated_session_topic: "subscribing_authenticated_session_topic", subscribe_authenticated_session_topic_success: "subscribe_authenticated_session_topic_success", publishing_authenticated_session_approve: "publishing_authenticated_session_approve" }, If = { no_internet_connection: "no_internet_connection", invalid_cacao: "invalid_cacao", subscribe_authenticated_session_topic_failure: "subscribe_authenticated_session_topic_failure", authenticated_session_approve_publish_failure: "authenticated_session_approve_publish_failure", authenticated_session_pending_request_not_found: "authenticated_session_pending_request_not_found" }, SH = 0.1, AH = "event-client", PH = 86400, MH = "https://pulse.walletconnect.org/batch"; function IH(t, e) { if (t.length >= 255) throw new TypeError("Alphabet too long"); for (var r = new Uint8Array(256), n = 0; n < r.length; n++) r[n] = 255; @@ -18172,14 +18172,14 @@ function IH(t, e) { function p(M) { if (M instanceof Uint8Array || (ArrayBuffer.isView(M) ? M = new Uint8Array(M.buffer, M.byteOffset, M.byteLength) : Array.isArray(M) && (M = Uint8Array.from(M))), !(M instanceof Uint8Array)) throw new TypeError("Expected Uint8Array"); if (M.length === 0) return ""; - for (var N = 0, L = 0, B = 0, $ = M.length; B !== $ && M[B] === 0; ) B++, N++; - for (var H = ($ - B) * d + 1 >>> 0, W = new Uint8Array(H); B !== $; ) { - for (var V = M[B], te = 0, R = H - 1; (V !== 0 || te < L) && R !== -1; R--, te++) V += 256 * W[R] >>> 0, W[R] = V % a >>> 0, V = V / a >>> 0; + for (var N = 0, L = 0, $ = 0, B = M.length; $ !== B && M[$] === 0; ) $++, N++; + for (var H = (B - $) * d + 1 >>> 0, U = new Uint8Array(H); $ !== B; ) { + for (var V = M[$], te = 0, R = H - 1; (V !== 0 || te < L) && R !== -1; R--, te++) V += 256 * U[R] >>> 0, U[R] = V % a >>> 0, V = V / a >>> 0; if (V !== 0) throw new Error("Non-zero carry"); - L = te, B++; + L = te, $++; } - for (var K = H - L; K !== H && W[K] === 0; ) K++; - for (var ge = u.repeat(N); K < H; ++K) ge += t.charAt(W[K]); + for (var K = H - L; K !== H && U[K] === 0; ) K++; + for (var ge = u.repeat(N); K < H; ++K) ge += t.charAt(U[K]); return ge; } function w(M) { @@ -18187,17 +18187,17 @@ function IH(t, e) { if (M.length === 0) return new Uint8Array(); var N = 0; if (M[N] !== " ") { - for (var L = 0, B = 0; M[N] === u; ) L++, N++; - for (var $ = (M.length - N) * l + 1 >>> 0, H = new Uint8Array($); M[N]; ) { - var W = r[M.charCodeAt(N)]; - if (W === 255) return; - for (var V = 0, te = $ - 1; (W !== 0 || V < B) && te !== -1; te--, V++) W += a * H[te] >>> 0, H[te] = W % 256 >>> 0, W = W / 256 >>> 0; - if (W !== 0) throw new Error("Non-zero carry"); - B = V, N++; + for (var L = 0, $ = 0; M[N] === u; ) L++, N++; + for (var B = (M.length - N) * l + 1 >>> 0, H = new Uint8Array(B); M[N]; ) { + var U = r[M.charCodeAt(N)]; + if (U === 255) return; + for (var V = 0, te = B - 1; (U !== 0 || V < $) && te !== -1; te--, V++) U += a * H[te] >>> 0, H[te] = U % 256 >>> 0, U = U / 256 >>> 0; + if (U !== 0) throw new Error("Non-zero carry"); + $ = V, N++; } if (M[N] !== " ") { - for (var R = $ - B; R !== $ && H[R] === 0; ) R++; - for (var K = new Uint8Array(L + ($ - R)), ge = L; R !== $; ) K[ge++] = H[R++]; + for (var R = B - $; R !== B && H[R] === 0; ) R++; + for (var K = new Uint8Array(L + (B - R)), ge = L; R !== B; ) K[ge++] = H[R++]; return K; } } @@ -18210,7 +18210,7 @@ function IH(t, e) { return { encode: p, decodeUnsafe: w, decode: A }; } var CH = IH, TH = CH; -const aE = (t) => { +const cE = (t) => { if (t instanceof Uint8Array && t.constructor.name === "Uint8Array") return t; if (t instanceof ArrayBuffer) return new Uint8Array(t); if (ArrayBuffer.isView(t)) return new Uint8Array(t.buffer, t.byteOffset, t.byteLength); @@ -18237,7 +18237,7 @@ class NH { } else throw Error("Can only multibase decode strings"); } or(e) { - return cE(this, e); + return uE(this, e); } } class LH { @@ -18245,7 +18245,7 @@ class LH { this.decoders = e; } or(e) { - return cE(this, e); + return uE(this, e); } decode(e) { const r = e[0], n = this.decoders[r]; @@ -18253,7 +18253,7 @@ class LH { throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`); } } -const cE = (t, e) => new LH({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); +const uE = (t, e) => new LH({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); class kH { constructor(e, r, n, i) { this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new OH(e, r, n), this.decoder = new NH(e, r, i); @@ -18267,7 +18267,7 @@ class kH { } const sp = ({ name: t, prefix: e, encode: r, decode: n }) => new kH(t, e, r, n), rh = ({ prefix: t, name: e, alphabet: r }) => { const { encode: n, decode: i } = TH(r, e); - return sp({ prefix: t, name: e, encode: n, decode: (s) => aE(i(s)) }); + return sp({ prefix: t, name: e, encode: n, decode: (s) => cE(i(s)) }); }, $H = (t, e, r, n) => { const i = {}; for (let d = 0; d < e.length; ++d) i[e[d]] = d; @@ -18310,7 +18310,7 @@ const uK = rh({ name: "base58btc", prefix: "z", alphabet: "123456789ABCDEFGHJKLM var lK = Object.freeze({ __proto__: null, base58btc: uK, base58flickr: fK }); const hK = Hn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 }), dK = Hn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 }), pK = Hn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 }), gK = Hn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", bitsPerChar: 6 }); var mK = Object.freeze({ __proto__: null, base64: hK, base64pad: dK, base64url: pK, base64urlpad: gK }); -const uE = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), vK = uE.reduce((t, e, r) => (t[r] = e, t), []), bK = uE.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); +const fE = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), vK = fE.reduce((t, e, r) => (t[r] = e, t), []), bK = fE.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); function yK(t) { return t.reduce((e, r) => (e += vK[r], e), ""); } @@ -18324,35 +18324,35 @@ function wK(t) { return new Uint8Array(e); } const xK = sp({ prefix: "🚀", name: "base256emoji", encode: yK, decode: wK }); -var _K = Object.freeze({ __proto__: null, base256emoji: xK }), EK = fE, g3 = 128, SK = 127, AK = ~SK, PK = Math.pow(2, 31); -function fE(t, e, r) { +var _K = Object.freeze({ __proto__: null, base256emoji: xK }), EK = lE, m3 = 128, SK = 127, AK = ~SK, PK = Math.pow(2, 31); +function lE(t, e, r) { e = e || [], r = r || 0; - for (var n = r; t >= PK; ) e[r++] = t & 255 | g3, t /= 128; - for (; t & AK; ) e[r++] = t & 255 | g3, t >>>= 7; - return e[r] = t | 0, fE.bytes = r - n + 1, e; + for (var n = r; t >= PK; ) e[r++] = t & 255 | m3, t /= 128; + for (; t & AK; ) e[r++] = t & 255 | m3, t >>>= 7; + return e[r] = t | 0, lE.bytes = r - n + 1, e; } -var MK = R1, IK = 128, m3 = 127; +var MK = R1, IK = 128, v3 = 127; function R1(t, n) { var r = 0, n = n || 0, i = 0, s = n, o, a = t.length; do { if (s >= a) throw R1.bytes = 0, new RangeError("Could not decode varint"); - o = t[s++], r += i < 28 ? (o & m3) << i : (o & m3) * Math.pow(2, i), i += 7; + o = t[s++], r += i < 28 ? (o & v3) << i : (o & v3) * Math.pow(2, i), i += 7; } while (o >= IK); return R1.bytes = s - n, r; } var CK = Math.pow(2, 7), TK = Math.pow(2, 14), RK = Math.pow(2, 21), DK = Math.pow(2, 28), OK = Math.pow(2, 35), NK = Math.pow(2, 42), LK = Math.pow(2, 49), kK = Math.pow(2, 56), $K = Math.pow(2, 63), BK = function(t) { return t < CK ? 1 : t < TK ? 2 : t < RK ? 3 : t < DK ? 4 : t < OK ? 5 : t < NK ? 6 : t < LK ? 7 : t < kK ? 8 : t < $K ? 9 : 10; -}, FK = { encode: EK, decode: MK, encodingLength: BK }, lE = FK; -const v3 = (t, e, r = 0) => (lE.encode(t, e, r), e), b3 = (t) => lE.encodingLength(t), D1 = (t, e) => { - const r = e.byteLength, n = b3(t), i = n + b3(r), s = new Uint8Array(i + r); - return v3(t, s, 0), v3(r, s, n), s.set(e, i), new jK(t, r, e, s); +}, FK = { encode: EK, decode: MK, encodingLength: BK }, hE = FK; +const b3 = (t, e, r = 0) => (hE.encode(t, e, r), e), y3 = (t) => hE.encodingLength(t), D1 = (t, e) => { + const r = e.byteLength, n = y3(t), i = n + y3(r), s = new Uint8Array(i + r); + return b3(t, s, 0), b3(r, s, n), s.set(e, i), new jK(t, r, e, s); }; class jK { constructor(e, r, n, i) { this.code = e, this.size = r, this.digest = n, this.bytes = i; } } -const hE = ({ name: t, code: e, encode: r }) => new UK(t, e, r); +const dE = ({ name: t, code: e, encode: r }) => new UK(t, e, r); class UK { constructor(e, r, n) { this.name = e, this.code = r, this.encode = n; @@ -18364,20 +18364,20 @@ class UK { } else throw Error("Unknown type, must be binary type"); } } -const dE = (t) => async (e) => new Uint8Array(await crypto.subtle.digest(t, e)), qK = hE({ name: "sha2-256", code: 18, encode: dE("SHA-256") }), zK = hE({ name: "sha2-512", code: 19, encode: dE("SHA-512") }); +const pE = (t) => async (e) => new Uint8Array(await crypto.subtle.digest(t, e)), qK = dE({ name: "sha2-256", code: 18, encode: pE("SHA-256") }), zK = dE({ name: "sha2-512", code: 19, encode: pE("SHA-512") }); var WK = Object.freeze({ __proto__: null, sha256: qK, sha512: zK }); -const pE = 0, HK = "identity", gE = aE, KK = (t) => D1(pE, gE(t)), VK = { code: pE, name: HK, encode: gE, digest: KK }; +const gE = 0, HK = "identity", mE = cE, KK = (t) => D1(gE, mE(t)), VK = { code: gE, name: HK, encode: mE, digest: KK }; var GK = Object.freeze({ __proto__: null, identity: VK }); new TextEncoder(), new TextDecoder(); -const y3 = { ...jH, ...qH, ...WH, ...KH, ...YH, ...sK, ...cK, ...lK, ...mK, ..._K }; +const w3 = { ...jH, ...qH, ...WH, ...KH, ...YH, ...sK, ...cK, ...lK, ...mK, ..._K }; ({ ...WK, ...GK }); function YK(t = 0) { return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); } -function mE(t, e, r, n) { +function vE(t, e, r, n) { return { name: t, prefix: e, encoder: { name: t, prefix: e, encode: r }, decoder: { decode: n } }; } -const w3 = mE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), pm = mE("ascii", "a", (t) => { +const x3 = vE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), pm = vE("ascii", "a", (t) => { let e = "a"; for (let r = 0; r < t.length; r++) e += String.fromCharCode(t[r]); return e; @@ -18386,7 +18386,7 @@ const w3 = mE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) = const e = YK(t.length); for (let r = 0; r < t.length; r++) e[r] = t.charCodeAt(r); return e; -}), JK = { utf8: w3, "utf-8": w3, hex: y3.base16, latin1: pm, ascii: pm, binary: pm, ...y3 }; +}), JK = { utf8: x3, "utf-8": x3, hex: w3.base16, latin1: pm, ascii: pm, binary: pm, ...w3 }; function XK(t, e = "utf8") { const r = JK[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); @@ -18411,7 +18411,7 @@ let ZK = class { return i; }, this.del = async (n) => { this.isInitialized(), this.keychain.delete(n), await this.persist(); - }, this.core = e, this.logger = ci(r, this.name); + }, this.core = e, this.logger = ui(r, this.name); } get context() { return Ai(this.logger); @@ -18420,11 +18420,11 @@ let ZK = class { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; } async setKeyChain(e) { - await this.core.storage.setItem(this.storageKey, L8(e)); + await this.core.storage.setItem(this.storageKey, k8(e)); } async getKeyChain() { const e = await this.core.storage.getItem(this.storageKey); - return typeof e < "u" ? k8(e) : void 0; + return typeof e < "u" ? $8(e) : void 0; } async persist() { await this.setKeyChain(this.keychain); @@ -18441,15 +18441,15 @@ let ZK = class { this.initialized || (await this.keychain.init(), this.initialized = !0); }, this.hasKeys = (i) => (this.isInitialized(), this.keychain.has(i)), this.getClientId = async () => { this.isInitialized(); - const i = await this.getClientSeed(), s = sx(i); - return U4(s.publicKey); + const i = await this.getClientSeed(), s = ox(i); + return q4(s.publicKey); }, this.generateKeyPair = () => { this.isInitialized(); const i = _z(); return this.setPrivateKey(i.publicKey, i.privateKey); }, this.signJWT = async (i) => { this.isInitialized(); - const s = await this.getClientSeed(), o = sx(s), a = this.randomSessionIdentifier; + const s = await this.getClientSeed(), o = ox(s), a = this.randomSessionIdentifier; return await HB(a, i, JW, o); }, this.generateSharedKey = (i, s, o) => { this.isInitialized(); @@ -18465,9 +18465,9 @@ let ZK = class { this.isInitialized(), await this.keychain.del(i); }, this.encode = async (i, s, o) => { this.isInitialized(); - const a = K8(o), u = $o(s); - if (Gx(a)) return Az(u, o == null ? void 0 : o.encoding); - if (Vx(a)) { + const a = V8(o), u = $o(s); + if (Yx(a)) return Az(u, o == null ? void 0 : o.encoding); + if (Gx(a)) { const w = a.senderPublicKey, A = a.receiverPublicKey; i = await this.generateSharedKey(w, A); } @@ -18476,11 +18476,11 @@ let ZK = class { }, this.decode = async (i, s, o) => { this.isInitialized(); const a = Iz(s, o); - if (Gx(a)) { + if (Yx(a)) { const u = Mz(s, o == null ? void 0 : o.encoding); return fc(u); } - if (Vx(a)) { + if (Gx(a)) { const u = a.receiverPublicKey, l = a.senderPublicKey; i = await this.generateSharedKey(u, l); } @@ -18496,7 +18496,7 @@ let ZK = class { }, this.getPayloadSenderPublicKey = (i, s = ha) => { const o = El({ encoded: i, encoding: s }); return o.senderPublicKey ? On(o.senderPublicKey, ai) : void 0; - }, this.core = e, this.logger = ci(r, this.name), this.keychain = n || new ZK(this.core, this.logger); + }, this.core = e, this.logger = ui(r, this.name), this.keychain = n || new ZK(this.core, this.logger); } get context() { return Ai(this.logger); @@ -18510,9 +18510,9 @@ let ZK = class { async getClientSeed() { let e = ""; try { - e = this.keychain.get(d3); + e = this.keychain.get(p3); } catch { - e = I1(), await this.keychain.set(d3, e); + e = I1(), await this.keychain.set(p3, e); } return XK(e, "base16"); } @@ -18555,7 +18555,7 @@ class eV extends Xk { return typeof s[o] < "u"; }, this.del = async (n) => { this.isInitialized(), this.messages.delete(n), await this.persist(); - }, this.logger = ci(e, this.name), this.core = r; + }, this.logger = ui(e, this.name), this.core = r; } get context() { return Ai(this.logger); @@ -18564,11 +18564,11 @@ class eV extends Xk { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; } async setRelayerMessages(e) { - await this.core.storage.setItem(this.storageKey, L8(e)); + await this.core.storage.setItem(this.storageKey, k8(e)); } async getRelayerMessages() { const e = await this.core.storage.getItem(this.storageKey); - return typeof e < "u" ? k8(e) : void 0; + return typeof e < "u" ? $8(e) : void 0; } async persist() { await this.setRelayerMessages(this.messages); @@ -18590,11 +18590,11 @@ class tV extends Zk { try { for (; N === void 0; ) { if (Date.now() - M > this.publishTimeout) throw new Error(A); - this.logger.trace({ id: p, attempts: L }, `publisher.publish - attempt ${L}`), N = await await du(this.rpcPublish(n, i, a, u, l, d, p, s == null ? void 0 : s.attestation).catch((B) => this.logger.warn(B)), this.publishTimeout, A), L++, N || await new Promise((B) => setTimeout(B, this.failedPublishTimeout)); + this.logger.trace({ id: p, attempts: L }, `publisher.publish - attempt ${L}`), N = await await du(this.rpcPublish(n, i, a, u, l, d, p, s == null ? void 0 : s.attestation).catch(($) => this.logger.warn($)), this.publishTimeout, A), L++, N || await new Promise(($) => setTimeout($, this.failedPublishTimeout)); } this.relayer.events.emit(oi.publish, w), this.logger.debug("Successfully Published Payload"), this.logger.trace({ type: "method", method: "publish", params: { id: p, topic: n, message: i, opts: s } }); - } catch (B) { - if (this.logger.debug("Failed to Publish Payload"), this.logger.error(B), (o = s == null ? void 0 : s.internal) != null && o.throwOnFailedPublish) throw B; + } catch ($) { + if (this.logger.debug("Failed to Publish Payload"), this.logger.error($), (o = s == null ? void 0 : s.internal) != null && o.throwOnFailedPublish) throw $; this.queue.set(p, w); } }, this.on = (n, i) => { @@ -18605,7 +18605,7 @@ class tV extends Zk { this.events.off(n, i); }, this.removeListener = (n, i) => { this.events.removeListener(n, i); - }, this.relayer = e, this.logger = ci(r, this.name), this.registerEventListeners(); + }, this.relayer = e, this.logger = ui(r, this.name), this.registerEventListeners(); } get context() { return Ai(this.logger); @@ -18613,7 +18613,7 @@ class tV extends Zk { rpcPublish(e, r, n, i, s, o, a, u) { var l, d, p, w; const A = { method: Bf(i.protocol).publish, params: { topic: e, message: r, ttl: n, prompt: s, tag: o, attestation: u }, id: a }; - return mi((l = A.params) == null ? void 0 : l.prompt) && ((d = A.params) == null || delete d.prompt), mi((p = A.params) == null ? void 0 : p.tag) && ((w = A.params) == null || delete w.tag), this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "message", direction: "outgoing", request: A }), this.relayer.request(A); + return vi((l = A.params) == null ? void 0 : l.prompt) && ((d = A.params) == null || delete d.prompt), vi((p = A.params) == null ? void 0 : p.tag) && ((w = A.params) == null || delete w.tag), this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "message", direction: "outgoing", request: A }), this.relayer.request(A); } removeRequestFromQueue(e) { this.queue.delete(e); @@ -18663,9 +18663,9 @@ class rV { return Array.from(this.map.keys()); } } -var nV = Object.defineProperty, iV = Object.defineProperties, sV = Object.getOwnPropertyDescriptors, x3 = Object.getOwnPropertySymbols, oV = Object.prototype.hasOwnProperty, aV = Object.prototype.propertyIsEnumerable, _3 = (t, e, r) => e in t ? nV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Cf = (t, e) => { - for (var r in e || (e = {})) oV.call(e, r) && _3(t, r, e[r]); - if (x3) for (var r of x3(e)) aV.call(e, r) && _3(t, r, e[r]); +var nV = Object.defineProperty, iV = Object.defineProperties, sV = Object.getOwnPropertyDescriptors, _3 = Object.getOwnPropertySymbols, oV = Object.prototype.hasOwnProperty, aV = Object.prototype.propertyIsEnumerable, E3 = (t, e, r) => e in t ? nV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Cf = (t, e) => { + for (var r in e || (e = {})) oV.call(e, r) && E3(t, r, e[r]); + if (_3) for (var r of _3(e)) aV.call(e, r) && E3(t, r, e[r]); return t; }, gm = (t, e) => iV(t, sV(e)); class cV extends t$ { @@ -18708,7 +18708,7 @@ class cV extends t$ { await this.onDisconnect(); }, this.restart = async () => { this.restartInProgress = !0, await this.restore(), await this.reset(), this.restartInProgress = !1; - }, this.relayer = e, this.logger = ci(r, this.name), this.clientId = ""; + }, this.relayer = e, this.logger = ui(r, this.name), this.clientId = ""; } get context() { return Ai(this.logger); @@ -18914,9 +18914,9 @@ class cV extends t$ { }); } } -var uV = Object.defineProperty, E3 = Object.getOwnPropertySymbols, fV = Object.prototype.hasOwnProperty, lV = Object.prototype.propertyIsEnumerable, S3 = (t, e, r) => e in t ? uV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, A3 = (t, e) => { - for (var r in e || (e = {})) fV.call(e, r) && S3(t, r, e[r]); - if (E3) for (var r of E3(e)) lV.call(e, r) && S3(t, r, e[r]); +var uV = Object.defineProperty, S3 = Object.getOwnPropertySymbols, fV = Object.prototype.hasOwnProperty, lV = Object.prototype.propertyIsEnumerable, A3 = (t, e, r) => e in t ? uV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, P3 = (t, e) => { + for (var r in e || (e = {})) fV.call(e, r) && A3(t, r, e[r]); + if (S3) for (var r of S3(e)) lV.call(e, r) && A3(t, r, e[r]); return t; }; class hV extends Qk { @@ -18962,7 +18962,7 @@ class hV extends Qk { this.logger.error(r), this.events.emit(oi.error, r), this.logger.info("Fatal socket error received, closing transport"), this.transportClose(); }, this.registerProviderListeners = () => { this.provider.on(Vi.payload, this.onPayloadHandler), this.provider.on(Vi.connect, this.onConnectHandler), this.provider.on(Vi.disconnect, this.onDisconnectHandler), this.provider.on(Vi.error, this.onProviderErrorHandler); - }, this.core = e.core, this.logger = typeof e.logger < "u" && typeof e.logger != "string" ? ci(e.logger, this.name) : ql($0({ level: e.logger || nH })), this.messages = new eV(this.logger, e.core), this.subscriber = new cV(this, this.logger), this.publisher = new tV(this, this.logger), this.relayUrl = (e == null ? void 0 : e.relayUrl) || sE, this.projectId = e.projectId, this.bundleId = jq(), this.provider = {}; + }, this.core = e.core, this.logger = typeof e.logger < "u" && typeof e.logger != "string" ? ui(e.logger, this.name) : ql($0({ level: e.logger || nH })), this.messages = new eV(this.logger, e.core), this.subscriber = new cV(this, this.logger), this.publisher = new tV(this, this.logger), this.relayUrl = (e == null ? void 0 : e.relayUrl) || oE, this.projectId = e.projectId, this.bundleId = jq(), this.provider = {}; } async init() { if (this.logger.trace("Initialized"), this.registerEventListeners(), await Promise.all([this.messages.init(), this.subscriber.init()]), this.initialized = !0, this.subscriber.cached.length > 0) try { @@ -18996,7 +18996,7 @@ class hV extends Qk { return await Promise.all([new Promise((d) => { u = d, this.subscriber.on(Us.created, l); }), new Promise(async (d, p) => { - a = await this.subscriber.subscribe(e, A3({ internal: { throwOnFailedPublish: o } }, r)).catch((w) => { + a = await this.subscriber.subscribe(e, P3({ internal: { throwOnFailedPublish: o } }, r)).catch((w) => { o && p(w); }) || a, d(); })]), a; @@ -19054,7 +19054,7 @@ class hV extends Qk { this.connectionAttemptInProgress || (this.relayUrl = e || this.relayUrl, await this.confirmOnlineStateOrThrow(), await this.transportClose(), await this.transportOpen()); } async confirmOnlineStateOrThrow() { - if (!await s3()) throw new Error("No internet connection detected. Please restart your network and try again."); + if (!await o3()) throw new Error("No internet connection detected. Please restart your network and try again."); } async handleBatchMessageEvents(e) { if ((e == null ? void 0 : e.length) === 0) { @@ -19108,10 +19108,10 @@ class hV extends Qk { return i && this.logger.debug(`Ignoring duplicate message: ${n}`), i; } async onProviderPayload(e) { - if (this.logger.debug("Incoming Relay Payload"), this.logger.trace({ type: "payload", direction: "incoming", payload: e }), lb(e)) { + if (this.logger.debug("Incoming Relay Payload"), this.logger.trace({ type: "payload", direction: "incoming", payload: e }), hb(e)) { if (!e.method.endsWith(sH)) return; const r = e.params, { topic: n, message: i, publishedAt: s, attestation: o } = r.data, a = { topic: n, message: i, publishedAt: s, transportType: zr.relay, attestation: o }; - this.logger.debug("Emitting Relayer Payload"), this.logger.trace(A3({ type: "event", event: r.id }, a)), this.events.emit(r.id, a), await this.acknowledgePayload(e), await this.onMessageEvent(a); + this.logger.debug("Emitting Relayer Payload"), this.logger.trace(P3({ type: "event", event: r.id }, a)), this.events.emit(r.id, a), await this.acknowledgePayload(e), await this.onMessageEvent(a); } else ip(e) && this.events.emit(oi.message_ack, e); } async onMessageEvent(e) { @@ -19125,7 +19125,7 @@ class hV extends Qk { this.provider.off(Vi.payload, this.onPayloadHandler), this.provider.off(Vi.connect, this.onConnectHandler), this.provider.off(Vi.disconnect, this.onDisconnectHandler), this.provider.off(Vi.error, this.onProviderErrorHandler), clearTimeout(this.pingTimeout); } async registerEventListeners() { - let e = await s3(); + let e = await o3(); xW(async (r) => { e !== r && (e = r, r ? await this.restartTransport().catch((n) => this.logger.error(n)) : (this.hasExperiencedNetworkDisruption = !0, await this.transportDisconnect(), this.transportExplicitlyClosed = !1)); }); @@ -19149,26 +19149,26 @@ class hV extends Qk { }), await this.transportOpen()); } } -var dV = Object.defineProperty, P3 = Object.getOwnPropertySymbols, pV = Object.prototype.hasOwnProperty, gV = Object.prototype.propertyIsEnumerable, M3 = (t, e, r) => e in t ? dV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, I3 = (t, e) => { - for (var r in e || (e = {})) pV.call(e, r) && M3(t, r, e[r]); - if (P3) for (var r of P3(e)) gV.call(e, r) && M3(t, r, e[r]); +var dV = Object.defineProperty, M3 = Object.getOwnPropertySymbols, pV = Object.prototype.hasOwnProperty, gV = Object.prototype.propertyIsEnumerable, I3 = (t, e, r) => e in t ? dV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, C3 = (t, e) => { + for (var r in e || (e = {})) pV.call(e, r) && I3(t, r, e[r]); + if (M3) for (var r of M3(e)) gV.call(e, r) && I3(t, r, e[r]); return t; }; class Ec extends e$ { constructor(e, r, n, i = Qs, s = void 0) { super(e, r, n, i), this.core = e, this.logger = r, this.name = n, this.map = /* @__PURE__ */ new Map(), this.version = aH, this.cached = [], this.initialized = !1, this.storagePrefix = Qs, this.recentlyDeleted = [], this.recentlyDeletedLimit = 200, this.init = async () => { this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((o) => { - this.getKey && o !== null && !mi(o) ? this.map.set(this.getKey(o), o) : Zz(o) ? this.map.set(o.id, o) : Qz(o) && this.map.set(o.topic, o); + this.getKey && o !== null && !vi(o) ? this.map.set(this.getKey(o), o) : Zz(o) ? this.map.set(o.id, o) : Qz(o) && this.map.set(o.topic, o); }), this.cached = [], this.initialized = !0); }, this.set = async (o, a) => { this.isInitialized(), this.map.has(o) ? await this.update(o, a) : (this.logger.debug("Setting value"), this.logger.trace({ type: "method", method: "set", key: o, value: a }), this.map.set(o, a), await this.persist()); }, this.get = (o) => (this.isInitialized(), this.logger.debug("Getting value"), this.logger.trace({ type: "method", method: "get", key: o }), this.getData(o)), this.getAll = (o) => (this.isInitialized(), o ? this.values.filter((a) => Object.keys(o).every((u) => KW(a[u], o[u]))) : this.values), this.update = async (o, a) => { this.isInitialized(), this.logger.debug("Updating value"), this.logger.trace({ type: "method", method: "update", key: o, update: a }); - const u = I3(I3({}, this.getData(o)), a); + const u = C3(C3({}, this.getData(o)), a); this.map.set(o, u), await this.persist(); }, this.delete = async (o, a) => { this.isInitialized(), this.map.has(o) && (this.logger.debug("Deleting value"), this.logger.trace({ type: "method", method: "delete", key: o, reason: a }), this.map.delete(o), this.addToRecentlyDeleted(o), await this.persist()); - }, this.logger = ci(r, this.name), this.storagePrefix = i, this.getKey = s; + }, this.logger = ui(r, this.name), this.storagePrefix = i, this.getKey = s; } get context() { return Ai(this.logger); @@ -19231,19 +19231,19 @@ class Ec extends e$ { } class mV { constructor(e, r) { - this.core = e, this.logger = r, this.name = hH, this.version = dH, this.events = new $v(), this.initialized = !1, this.storagePrefix = Qs, this.ignoredPayloadTypes = [Co], this.registeredMethods = [], this.init = async () => { + this.core = e, this.logger = r, this.name = hH, this.version = dH, this.events = new Bv(), this.initialized = !1, this.storagePrefix = Qs, this.ignoredPayloadTypes = [Co], this.registeredMethods = [], this.init = async () => { this.initialized || (await this.pairings.init(), await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.initialized = !0, this.logger.trace("Initialized")); }, this.register = ({ methods: n }) => { this.isInitialized(), this.registeredMethods = [.../* @__PURE__ */ new Set([...this.registeredMethods, ...n])]; }, this.create = async (n) => { this.isInitialized(); - const i = I1(), s = await this.core.crypto.setSymKey(i), o = En(mt.FIVE_MINUTES), a = { protocol: iE }, u = { topic: s, expiry: o, relay: a, active: !1, methods: n == null ? void 0 : n.methods }, l = Qx({ protocol: this.core.protocol, version: this.core.version, topic: s, symKey: i, relay: a, expiryTimestamp: o, methods: n == null ? void 0 : n.methods }); + const i = I1(), s = await this.core.crypto.setSymKey(i), o = En(mt.FIVE_MINUTES), a = { protocol: sE }, u = { topic: s, expiry: o, relay: a, active: !1, methods: n == null ? void 0 : n.methods }, l = e3({ protocol: this.core.protocol, version: this.core.version, topic: s, symKey: i, relay: a, expiryTimestamp: o, methods: n == null ? void 0 : n.methods }); return this.events.emit(Za.create, u), this.core.expirer.set(s, o), await this.pairings.set(s, u), await this.core.relayer.subscribe(s, { transportType: n == null ? void 0 : n.transportType }), { topic: s, uri: l }; }, this.pair = async (n) => { this.isInitialized(); const i = this.core.eventClient.createEvent({ properties: { topic: n == null ? void 0 : n.uri, trace: [Fs.pairing_started] } }); this.isValidPair(n, i); - const { topic: s, symKey: o, relay: a, expiryTimestamp: u, methods: l } = Zx(n.uri); + const { topic: s, symKey: o, relay: a, expiryTimestamp: u, methods: l } = Qx(n.uri); i.props.properties.topic = s, i.addTrace(Fs.pairing_uri_validation_success), i.addTrace(Fs.pairing_uri_not_expired); let d; if (this.pairings.keys.includes(s)) { @@ -19287,7 +19287,7 @@ class mV { }, this.formatUriFromPairing = (n) => { this.isInitialized(); const { topic: i, relay: s, expiry: o, methods: a } = n, u = this.core.crypto.keychain.get(i); - return Qx({ protocol: this.core.protocol, version: this.core.version, topic: i, symKey: u, relay: s, expiryTimestamp: o, methods: a }); + return e3({ protocol: this.core.protocol, version: this.core.version, topic: i, symKey: u, relay: s, expiryTimestamp: o, methods: a }); }, this.sendRequest = async (n, i, s) => { const o = da(i, s), a = await this.core.crypto.encode(n, o), u = Mf[i].req; return this.core.history.set(n, o), this.core.relayer.publish(n, a, u), o.id; @@ -19352,7 +19352,7 @@ class mV { this.registeredMethods.includes(n) || this.logger.error(Or("WC_METHOD_UNSUPPORTED", n)); }, this.isValidPair = (n, i) => { var s; - if (!gi(n)) { + if (!mi(n)) { const { message: a } = ft("MISSING_OR_INVALID", `pair() params: ${n}`); throw i.setError(wo.malformed_pairing_uri), new Error(a); } @@ -19360,7 +19360,7 @@ class mV { const { message: a } = ft("MISSING_OR_INVALID", `pair() uri: ${n.uri}`); throw i.setError(wo.malformed_pairing_uri), new Error(a); } - const o = Zx(n == null ? void 0 : n.uri); + const o = Qx(n == null ? void 0 : n.uri); if (!((s = o == null ? void 0 : o.relay) != null && s.protocol)) { const { message: a } = ft("MISSING_OR_INVALID", "pair() uri#relay-protocol"); throw i.setError(wo.malformed_pairing_uri), new Error(a); @@ -19375,14 +19375,14 @@ class mV { throw new Error(a); } }, this.isValidPing = async (n) => { - if (!gi(n)) { + if (!mi(n)) { const { message: s } = ft("MISSING_OR_INVALID", `ping() params: ${n}`); throw new Error(s); } const { topic: i } = n; await this.isValidPairingTopic(i); }, this.isValidDisconnect = async (n) => { - if (!gi(n)) { + if (!mi(n)) { const { message: s } = ft("MISSING_OR_INVALID", `disconnect() params: ${n}`); throw new Error(s); } @@ -19402,7 +19402,7 @@ class mV { const { message: i } = ft("EXPIRED", `pairing topic: ${n}`); throw new Error(i); } - }, this.core = e, this.logger = ci(r, this.name), this.pairings = new Ec(this.core, this.logger, this.name, this.storagePrefix); + }, this.core = e, this.logger = ui(r, this.name), this.pairings = new Ec(this.core, this.logger, this.name, this.storagePrefix); } get context() { return Ai(this.logger); @@ -19419,7 +19419,7 @@ class mV { if (!this.pairings.keys.includes(r) || i === zr.link_mode || this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n))) return; const s = await this.core.crypto.decode(r, n); try { - lb(s) ? (this.core.history.set(r, s), this.onRelayEventRequest({ topic: r, payload: s })) : ip(s) && (await this.core.history.resolve(s), await this.onRelayEventResponse({ topic: r, payload: s }), this.core.history.delete(r, s.id)); + hb(s) ? (this.core.history.set(r, s), this.onRelayEventRequest({ topic: r, payload: s })) : ip(s) && (await this.core.history.resolve(s), await this.onRelayEventResponse({ topic: r, payload: s }), this.core.history.delete(r, s.id)); } catch (o) { this.logger.error(o); } @@ -19427,7 +19427,7 @@ class mV { } registerExpirerEvents() { this.core.expirer.on(Ji.expired, async (e) => { - const { topic: r } = B8(e.target); + const { topic: r } = F8(e.target); r && this.pairings.keys.includes(r) && (await this.deletePairing(r, !0), this.events.emit(Za.expire, { topic: r })); }); } @@ -19459,7 +19459,7 @@ class vV extends Jk { this.events.off(n, i); }, this.removeListener = (n, i) => { this.events.removeListener(n, i); - }, this.logger = ci(r, this.name); + }, this.logger = ui(r, this.name); } get context() { return Ai(this.logger); @@ -19579,7 +19579,7 @@ class bV extends r$ { this.events.off(n, i); }, this.removeListener = (n, i) => { this.events.removeListener(n, i); - }, this.logger = ci(r, this.name); + }, this.logger = ui(r, this.name); } get context() { return Ai(this.logger); @@ -19663,7 +19663,7 @@ class bV extends r$ { } class yV extends n$ { constructor(e, r, n) { - super(e, r, n), this.core = e, this.logger = r, this.store = n, this.name = bH, this.verifyUrlV3 = wH, this.storagePrefix = Qs, this.version = rE, this.init = async () => { + super(e, r, n), this.core = e, this.logger = r, this.store = n, this.name = bH, this.verifyUrlV3 = wH, this.storagePrefix = Qs, this.version = nE, this.init = async () => { var i; this.isDevEnv || (this.publicKey = await this.store.getItem(this.storeKey), this.publicKey && mt.toMiliseconds((i = this.publicKey) == null ? void 0 : i.expiresAt) < Date.now() && (this.logger.debug("verify v2 public key expired"), await this.removePublicKey())); }, this.register = async (i) => { @@ -19677,15 +19677,15 @@ class yV extends n$ { this.abortController.signal.addEventListener("abort", M); const N = l.createElement("iframe"); N.src = u, N.style.display = "none", N.addEventListener("error", M, { signal: this.abortController.signal }); - const L = (B) => { - if (B.data && typeof B.data == "string") try { - const $ = JSON.parse(B.data); - if ($.type === "verify_attestation") { - if (v1($.attestation).payload.id !== o) return; - clearInterval(d), l.body.removeChild(N), this.abortController.signal.removeEventListener("abort", M), window.removeEventListener("message", L), w($.attestation === null ? "" : $.attestation); + const L = ($) => { + if ($.data && typeof $.data == "string") try { + const B = JSON.parse($.data); + if (B.type === "verify_attestation") { + if (v1(B.attestation).payload.id !== o) return; + clearInterval(d), l.body.removeChild(N), this.abortController.signal.removeEventListener("abort", M), window.removeEventListener("message", L), w(B.attestation === null ? "" : B.attestation); } - } catch ($) { - this.logger.warn($); + } catch (B) { + this.logger.warn(B); } }; l.body.appendChild(N), window.addEventListener("message", L, { signal: this.abortController.signal }); @@ -19760,7 +19760,7 @@ class yV extends n$ { const o = Dz(i, s.publicKey), a = { hasExpired: mt.toMiliseconds(o.exp) < Date.now(), payload: o }; if (a.hasExpired) throw this.logger.warn("resolve: jwt attestation expired"), new Error("JWT attestation expired"); return { origin: a.payload.origin, isScam: a.payload.isScam, isVerified: a.payload.isVerified }; - }, this.logger = ci(r, this.name), this.abortController = new AbortController(), this.isDevEnv = sb(), this.init(); + }, this.logger = ui(r, this.name), this.abortController = new AbortController(), this.isDevEnv = ob(), this.init(); } get storeKey() { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//verify:public:key"; @@ -19777,25 +19777,25 @@ class wV extends i$ { super(e, r), this.projectId = e, this.logger = r, this.context = _H, this.registerDeviceToken = async (n) => { const { clientId: i, token: s, notificationType: o, enableEncrypted: a = !1 } = n, u = `${EH}/${this.projectId}/clients`; await fetch(u, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ client_id: i, type: o, token: s, always_raw: a }) }); - }, this.logger = ci(r, this.context); + }, this.logger = ui(r, this.context); } } -var xV = Object.defineProperty, C3 = Object.getOwnPropertySymbols, _V = Object.prototype.hasOwnProperty, EV = Object.prototype.propertyIsEnumerable, T3 = (t, e, r) => e in t ? xV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Tf = (t, e) => { - for (var r in e || (e = {})) _V.call(e, r) && T3(t, r, e[r]); - if (C3) for (var r of C3(e)) EV.call(e, r) && T3(t, r, e[r]); +var xV = Object.defineProperty, T3 = Object.getOwnPropertySymbols, _V = Object.prototype.hasOwnProperty, EV = Object.prototype.propertyIsEnumerable, R3 = (t, e, r) => e in t ? xV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Tf = (t, e) => { + for (var r in e || (e = {})) _V.call(e, r) && R3(t, r, e[r]); + if (T3) for (var r of T3(e)) EV.call(e, r) && R3(t, r, e[r]); return t; }; class SV extends s$ { constructor(e, r, n = !0) { super(e, r, n), this.core = e, this.logger = r, this.context = AH, this.storagePrefix = Qs, this.storageVersion = SH, this.events = /* @__PURE__ */ new Map(), this.shouldPersist = !1, this.init = async () => { - if (!sb()) try { - const i = { eventId: jx(), timestamp: Date.now(), domain: this.getAppDomain(), props: { event: "INIT", type: "", properties: { client_id: await this.core.crypto.getClientId(), user_agent: N8(this.core.relayer.protocol, this.core.relayer.version, T1) } } }; + if (!ob()) try { + const i = { eventId: Ux(), timestamp: Date.now(), domain: this.getAppDomain(), props: { event: "INIT", type: "", properties: { client_id: await this.core.crypto.getClientId(), user_agent: L8(this.core.relayer.protocol, this.core.relayer.version, T1) } } }; await this.sendEvent([i]); } catch (i) { this.logger.warn(i); } }, this.createEvent = (i) => { - const { event: s = "ERROR", type: o = "", properties: { topic: a, trace: u } } = i, l = jx(), d = this.core.projectId || "", p = Date.now(), w = Tf({ eventId: l, timestamp: p, props: { event: s, type: o, properties: { topic: a, trace: u } }, bundleId: d, domain: this.getAppDomain() }, this.setMethods(l)); + const { event: s = "ERROR", type: o = "", properties: { topic: a, trace: u } } = i, l = Ux(), d = this.core.projectId || "", p = Date.now(), w = Tf({ eventId: l, timestamp: p, props: { event: s, type: o, properties: { topic: a, trace: u } }, bundleId: d, domain: this.getAppDomain() }, this.setMethods(l)); return this.telemetryEnabled && (this.events.set(l, w), this.shouldPersist = !0), w; }, this.getEvent = (i) => { const { eventId: s, topic: o } = i; @@ -19841,7 +19841,7 @@ class SV extends s$ { }, this.sendEvent = async (i) => { const s = this.getAppDomain() ? "" : "&sp=desktop"; return await fetch(`${MH}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${T1}${s}`, { method: "POST", body: JSON.stringify(i) }); - }, this.getAppDomain = () => O8().url, this.logger = ci(r, this.context), this.telemetryEnabled = n, n ? this.restore().then(async () => { + }, this.getAppDomain = () => N8().url, this.logger = ui(r, this.context), this.telemetryEnabled = n, n ? this.restore().then(async () => { await this.submit(), this.setEventListeners(); }) : this.persist(); } @@ -19849,27 +19849,27 @@ class SV extends s$ { return this.storagePrefix + this.storageVersion + this.core.customStoragePrefix + "//" + this.context; } } -var AV = Object.defineProperty, R3 = Object.getOwnPropertySymbols, PV = Object.prototype.hasOwnProperty, MV = Object.prototype.propertyIsEnumerable, D3 = (t, e, r) => e in t ? AV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, O3 = (t, e) => { - for (var r in e || (e = {})) PV.call(e, r) && D3(t, r, e[r]); - if (R3) for (var r of R3(e)) MV.call(e, r) && D3(t, r, e[r]); +var AV = Object.defineProperty, D3 = Object.getOwnPropertySymbols, PV = Object.prototype.hasOwnProperty, MV = Object.prototype.propertyIsEnumerable, O3 = (t, e, r) => e in t ? AV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, N3 = (t, e) => { + for (var r in e || (e = {})) PV.call(e, r) && O3(t, r, e[r]); + if (D3) for (var r of D3(e)) MV.call(e, r) && O3(t, r, e[r]); return t; }; -class hb extends Yk { +class db extends Yk { constructor(e) { var r; - super(e), this.protocol = tE, this.version = rE, this.name = nE, this.events = new rs.EventEmitter(), this.initialized = !1, this.on = (o, a) => this.events.on(o, a), this.once = (o, a) => this.events.once(o, a), this.off = (o, a) => this.events.off(o, a), this.removeListener = (o, a) => this.events.removeListener(o, a), this.dispatchEnvelope = ({ topic: o, message: a, sessionExists: u }) => { + super(e), this.protocol = rE, this.version = nE, this.name = iE, this.events = new rs.EventEmitter(), this.initialized = !1, this.on = (o, a) => this.events.on(o, a), this.once = (o, a) => this.events.once(o, a), this.off = (o, a) => this.events.off(o, a), this.removeListener = (o, a) => this.events.removeListener(o, a), this.dispatchEnvelope = ({ topic: o, message: a, sessionExists: u }) => { if (!o || !a) return; const l = { topic: o, message: a, publishedAt: Date.now(), transportType: zr.link_mode }; this.relayer.onLinkMessageEvent(l, { sessionExists: u }); - }, this.projectId = e == null ? void 0 : e.projectId, this.relayUrl = (e == null ? void 0 : e.relayUrl) || sE, this.customStoragePrefix = e != null && e.customStoragePrefix ? `:${e.customStoragePrefix}` : ""; + }, this.projectId = e == null ? void 0 : e.projectId, this.relayUrl = (e == null ? void 0 : e.relayUrl) || oE, this.customStoragePrefix = e != null && e.customStoragePrefix ? `:${e.customStoragePrefix}` : ""; const n = $0({ level: typeof (e == null ? void 0 : e.logger) == "string" && e.logger ? e.logger : VW.logger }), { logger: i, chunkLoggerController: s } = Gk({ opts: n, maxSizeInBytes: e == null ? void 0 : e.maxLogBlobSizeInBytes, loggerOverride: e == null ? void 0 : e.logger }); this.logChunkController = s, (r = this.logChunkController) != null && r.downloadLogsBlobInBrowser && (window.downloadLogsBlobInBrowser = async () => { var o, a; (o = this.logChunkController) != null && o.downloadLogsBlobInBrowser && ((a = this.logChunkController) == null || a.downloadLogsBlobInBrowser({ clientId: await this.crypto.getClientId() })); - }), this.logger = ci(i, this.name), this.heartbeat = new qL(), this.crypto = new QK(this, this.logger, e == null ? void 0 : e.keychain), this.history = new vV(this, this.logger), this.expirer = new bV(this, this.logger), this.storage = e != null && e.storage ? e.storage : new wk(O3(O3({}, GW), e == null ? void 0 : e.storageOptions)), this.relayer = new hV({ core: this, logger: this.logger, relayUrl: this.relayUrl, projectId: this.projectId }), this.pairing = new mV(this, this.logger), this.verify = new yV(this, this.logger, this.storage), this.echoClient = new wV(this.projectId || "", this.logger), this.linkModeSupportedApps = [], this.eventClient = new SV(this, this.logger, e == null ? void 0 : e.telemetryEnabled); + }), this.logger = ui(i, this.name), this.heartbeat = new qL(), this.crypto = new QK(this, this.logger, e == null ? void 0 : e.keychain), this.history = new vV(this, this.logger), this.expirer = new bV(this, this.logger), this.storage = e != null && e.storage ? e.storage : new wk(N3(N3({}, GW), e == null ? void 0 : e.storageOptions)), this.relayer = new hV({ core: this, logger: this.logger, relayUrl: this.relayUrl, projectId: this.projectId }), this.pairing = new mV(this, this.logger), this.verify = new yV(this, this.logger, this.storage), this.echoClient = new wV(this.projectId || "", this.logger), this.linkModeSupportedApps = [], this.eventClient = new SV(this, this.logger, e == null ? void 0 : e.telemetryEnabled); } static async init(e) { - const r = new hb(e); + const r = new db(e); await r.initialize(); const n = await r.crypto.getClientId(); return await r.storage.setItem(cH, n), r; @@ -19885,26 +19885,26 @@ class hb extends Yk { return (e = this.logChunkController) == null ? void 0 : e.logsToBlob({ clientId: await this.crypto.getClientId() }); } async addLinkModeSupportedApp(e) { - this.linkModeSupportedApps.includes(e) || (this.linkModeSupportedApps.push(e), await this.storage.setItem(p3, this.linkModeSupportedApps)); + this.linkModeSupportedApps.includes(e) || (this.linkModeSupportedApps.push(e), await this.storage.setItem(g3, this.linkModeSupportedApps)); } async initialize() { this.logger.trace("Initialized"); try { - await this.crypto.init(), await this.history.init(), await this.expirer.init(), await this.relayer.init(), await this.heartbeat.init(), await this.pairing.init(), this.eventClient.init(), this.linkModeSupportedApps = await this.storage.getItem(p3) || [], this.initialized = !0, this.logger.info("Core Initialization Success"); + await this.crypto.init(), await this.history.init(), await this.expirer.init(), await this.relayer.init(), await this.heartbeat.init(), await this.pairing.init(), this.eventClient.init(), this.linkModeSupportedApps = await this.storage.getItem(g3) || [], this.initialized = !0, this.logger.info("Core Initialization Success"); } catch (e) { throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`, e), this.logger.error(e.message), e; } } } -const IV = hb, vE = "wc", bE = 2, yE = "client", db = `${vE}@${bE}:${yE}:`, mm = { name: yE, logger: "error" }, N3 = "WALLETCONNECT_DEEPLINK_CHOICE", CV = "proposal", wE = "Proposal expired", TV = "session", Kc = mt.SEVEN_DAYS, RV = "engine", In = { wc_sessionPropose: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1100 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1101 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1120 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1121 } }, wc_sessionSettle: { req: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1102 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1103 } }, wc_sessionUpdate: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1104 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1105 } }, wc_sessionExtend: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1106 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1107 } }, wc_sessionRequest: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1108 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1109 } }, wc_sessionEvent: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1110 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1111 } }, wc_sessionDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1112 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1113 } }, wc_sessionPing: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1114 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1115 } }, wc_sessionAuthenticate: { req: { ttl: mt.ONE_HOUR, prompt: !0, tag: 1116 }, res: { ttl: mt.ONE_HOUR, prompt: !1, tag: 1117 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1118 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1119 } } }, vm = { min: mt.FIVE_MINUTES, max: mt.SEVEN_DAYS }, ks = { idle: "IDLE", active: "ACTIVE" }, DV = "request", OV = ["wc_sessionPropose", "wc_sessionRequest", "wc_authRequest", "wc_sessionAuthenticate"], NV = "wc", LV = "auth", kV = "authKeys", $V = "pairingTopics", BV = "requests", op = `${NV}@${1.5}:${LV}:`, Rd = `${op}:PUB_KEY`; -var FV = Object.defineProperty, jV = Object.defineProperties, UV = Object.getOwnPropertyDescriptors, L3 = Object.getOwnPropertySymbols, qV = Object.prototype.hasOwnProperty, zV = Object.prototype.propertyIsEnumerable, k3 = (t, e, r) => e in t ? FV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, tn = (t, e) => { - for (var r in e || (e = {})) qV.call(e, r) && k3(t, r, e[r]); - if (L3) for (var r of L3(e)) zV.call(e, r) && k3(t, r, e[r]); +const IV = db, bE = "wc", yE = 2, wE = "client", pb = `${bE}@${yE}:${wE}:`, mm = { name: wE, logger: "error" }, L3 = "WALLETCONNECT_DEEPLINK_CHOICE", CV = "proposal", xE = "Proposal expired", TV = "session", Kc = mt.SEVEN_DAYS, RV = "engine", In = { wc_sessionPropose: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1100 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1101 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1120 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1121 } }, wc_sessionSettle: { req: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1102 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1103 } }, wc_sessionUpdate: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1104 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1105 } }, wc_sessionExtend: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1106 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1107 } }, wc_sessionRequest: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1108 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1109 } }, wc_sessionEvent: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1110 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1111 } }, wc_sessionDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1112 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1113 } }, wc_sessionPing: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1114 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1115 } }, wc_sessionAuthenticate: { req: { ttl: mt.ONE_HOUR, prompt: !0, tag: 1116 }, res: { ttl: mt.ONE_HOUR, prompt: !1, tag: 1117 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1118 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1119 } } }, vm = { min: mt.FIVE_MINUTES, max: mt.SEVEN_DAYS }, ks = { idle: "IDLE", active: "ACTIVE" }, DV = "request", OV = ["wc_sessionPropose", "wc_sessionRequest", "wc_authRequest", "wc_sessionAuthenticate"], NV = "wc", LV = "auth", kV = "authKeys", $V = "pairingTopics", BV = "requests", op = `${NV}@${1.5}:${LV}:`, Rd = `${op}:PUB_KEY`; +var FV = Object.defineProperty, jV = Object.defineProperties, UV = Object.getOwnPropertyDescriptors, k3 = Object.getOwnPropertySymbols, qV = Object.prototype.hasOwnProperty, zV = Object.prototype.propertyIsEnumerable, $3 = (t, e, r) => e in t ? FV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, tn = (t, e) => { + for (var r in e || (e = {})) qV.call(e, r) && $3(t, r, e[r]); + if (k3) for (var r of k3(e)) zV.call(e, r) && $3(t, r, e[r]); return t; }, bs = (t, e) => jV(t, UV(e)); class WV extends a$ { constructor(e) { - super(e), this.name = RV, this.events = new $v(), this.initialized = !1, this.requestQueue = { state: ks.idle, queue: [] }, this.sessionRequestQueue = { state: ks.idle, queue: [] }, this.requestQueueDelay = mt.ONE_SECOND, this.expectedPairingMethodMap = /* @__PURE__ */ new Map(), this.recentlyDeletedMap = /* @__PURE__ */ new Map(), this.recentlyDeletedLimit = 200, this.relayMessageCache = [], this.init = async () => { + super(e), this.name = RV, this.events = new Bv(), this.initialized = !1, this.requestQueue = { state: ks.idle, queue: [] }, this.sessionRequestQueue = { state: ks.idle, queue: [] }, this.requestQueueDelay = mt.ONE_SECOND, this.expectedPairingMethodMap = /* @__PURE__ */ new Map(), this.recentlyDeletedMap = /* @__PURE__ */ new Map(), this.recentlyDeletedLimit = 200, this.relayMessageCache = [], this.init = async () => { this.initialized || (await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.registerPairingEvents(), await this.registerLinkModeListeners(), this.client.core.pairing.register({ methods: Object.keys(In) }), this.initialized = !0, setTimeout(() => { this.sessionRequestQueue.queue = this.getPendingSessionRequests(), this.processSessionRequestQueue(); }, mt.toMiliseconds(this.requestQueueDelay))); @@ -19916,28 +19916,28 @@ class WV extends a$ { let l = i, d, p = !1; try { l && (p = this.client.core.pairing.pairings.get(l).active); - } catch (W) { - throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`), W; + } catch (U) { + throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`), U; } if (!l || !p) { - const { topic: W, uri: V } = await this.client.core.pairing.create(); - l = W, d = V; + const { topic: U, uri: V } = await this.client.core.pairing.create(); + l = U, d = V; } if (!l) { - const { message: W } = ft("NO_MATCHING_KEY", `connect() pairing topic: ${l}`); - throw new Error(W); + const { message: U } = ft("NO_MATCHING_KEY", `connect() pairing topic: ${l}`); + throw new Error(U); } - const w = await this.client.core.crypto.generateKeyPair(), A = In.wc_sessionPropose.req.ttl || mt.FIVE_MINUTES, M = En(A), N = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: u ?? [{ protocol: iE }], proposer: { publicKey: w, metadata: this.client.metadata }, expiryTimestamp: M, pairingTopic: l }, a && { sessionProperties: a }), { reject: L, resolve: B, done: $ } = Ga(A, wE); - this.events.once(br("session_connect"), async ({ error: W, session: V }) => { - if (W) L(W); + const w = await this.client.core.crypto.generateKeyPair(), A = In.wc_sessionPropose.req.ttl || mt.FIVE_MINUTES, M = En(A), N = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: u ?? [{ protocol: sE }], proposer: { publicKey: w, metadata: this.client.metadata }, expiryTimestamp: M, pairingTopic: l }, a && { sessionProperties: a }), { reject: L, resolve: $, done: B } = Ga(A, xE); + this.events.once(br("session_connect"), async ({ error: U, session: V }) => { + if (U) L(U); else if (V) { V.self.publicKey = w; const te = bs(tn({}, V), { pairingTopic: N.pairingTopic, requiredNamespaces: N.requiredNamespaces, optionalNamespaces: N.optionalNamespaces, transportType: zr.relay }); - await this.client.session.set(V.topic, te), await this.setExpiry(V.topic, V.expiry), l && await this.client.core.pairing.updateMetadata({ topic: l, metadata: V.peer.metadata }), this.cleanupDuplicatePairings(te), B(te); + await this.client.session.set(V.topic, te), await this.setExpiry(V.topic, V.expiry), l && await this.client.core.pairing.updateMetadata({ topic: l, metadata: V.peer.metadata }), this.cleanupDuplicatePairings(te), $(te); } }); const H = await this.sendRequest({ topic: l, method: "wc_sessionPropose", params: N, throwOnFailedPublish: !0 }); - return await this.setProposal(H, tn({ id: H }, N)), { uri: d, approval: $ }; + return await this.setProposal(H, tn({ id: H }, N)), { uri: d, approval: B }; }, this.pair = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); try { @@ -19966,28 +19966,28 @@ class WV extends a$ { const { id: a, relayProtocol: u, namespaces: l, sessionProperties: d, sessionConfig: p } = r, w = this.client.proposal.get(a); this.client.core.eventClient.deleteEvent({ eventId: o.eventId }); const { pairingTopic: A, proposer: M, requiredNamespaces: N, optionalNamespaces: L } = w; - let B = (i = this.client.core.eventClient) == null ? void 0 : i.getEvent({ topic: A }); - B || (B = (s = this.client.core.eventClient) == null ? void 0 : s.createEvent({ type: vs.session_approve_started, properties: { topic: A, trace: [vs.session_approve_started, vs.session_namespaces_validation_success] } })); - const $ = await this.client.core.crypto.generateKeyPair(), H = M.publicKey, W = await this.client.core.crypto.generateSharedKey($, H), V = tn(tn({ relay: { protocol: u ?? "irn" }, namespaces: l, controller: { publicKey: $, metadata: this.client.metadata }, expiry: En(Kc) }, d && { sessionProperties: d }), p && { sessionConfig: p }), te = zr.relay; - B.addTrace(vs.subscribing_session_topic); + let $ = (i = this.client.core.eventClient) == null ? void 0 : i.getEvent({ topic: A }); + $ || ($ = (s = this.client.core.eventClient) == null ? void 0 : s.createEvent({ type: vs.session_approve_started, properties: { topic: A, trace: [vs.session_approve_started, vs.session_namespaces_validation_success] } })); + const B = await this.client.core.crypto.generateKeyPair(), H = M.publicKey, U = await this.client.core.crypto.generateSharedKey(B, H), V = tn(tn({ relay: { protocol: u ?? "irn" }, namespaces: l, controller: { publicKey: B, metadata: this.client.metadata }, expiry: En(Kc) }, d && { sessionProperties: d }), p && { sessionConfig: p }), te = zr.relay; + $.addTrace(vs.subscribing_session_topic); try { - await this.client.core.relayer.subscribe(W, { transportType: te }); + await this.client.core.relayer.subscribe(U, { transportType: te }); } catch (K) { - throw B.setError(Ha.subscribe_session_topic_failure), K; + throw $.setError(Ha.subscribe_session_topic_failure), K; } - B.addTrace(vs.subscribe_session_topic_success); - const R = bs(tn({}, V), { topic: W, requiredNamespaces: N, optionalNamespaces: L, pairingTopic: A, acknowledged: !1, self: V.controller, peer: { publicKey: M.publicKey, metadata: M.metadata }, controller: $, transportType: zr.relay }); - await this.client.session.set(W, R), B.addTrace(vs.store_session); + $.addTrace(vs.subscribe_session_topic_success); + const R = bs(tn({}, V), { topic: U, requiredNamespaces: N, optionalNamespaces: L, pairingTopic: A, acknowledged: !1, self: V.controller, peer: { publicKey: M.publicKey, metadata: M.metadata }, controller: B, transportType: zr.relay }); + await this.client.session.set(U, R), $.addTrace(vs.store_session); try { - B.addTrace(vs.publishing_session_settle), await this.sendRequest({ topic: W, method: "wc_sessionSettle", params: V, throwOnFailedPublish: !0 }).catch((K) => { - throw B == null || B.setError(Ha.session_settle_publish_failure), K; - }), B.addTrace(vs.session_settle_publish_success), B.addTrace(vs.publishing_session_approve), await this.sendResult({ id: a, topic: A, result: { relay: { protocol: u ?? "irn" }, responderPublicKey: $ }, throwOnFailedPublish: !0 }).catch((K) => { - throw B == null || B.setError(Ha.session_approve_publish_failure), K; - }), B.addTrace(vs.session_approve_publish_success); + $.addTrace(vs.publishing_session_settle), await this.sendRequest({ topic: U, method: "wc_sessionSettle", params: V, throwOnFailedPublish: !0 }).catch((K) => { + throw $ == null || $.setError(Ha.session_settle_publish_failure), K; + }), $.addTrace(vs.session_settle_publish_success), $.addTrace(vs.publishing_session_approve), await this.sendResult({ id: a, topic: A, result: { relay: { protocol: u ?? "irn" }, responderPublicKey: B }, throwOnFailedPublish: !0 }).catch((K) => { + throw $ == null || $.setError(Ha.session_approve_publish_failure), K; + }), $.addTrace(vs.session_approve_publish_success); } catch (K) { - throw this.client.logger.error(K), this.client.session.delete(W, Or("USER_DISCONNECTED")), await this.client.core.relayer.unsubscribe(W), K; + throw this.client.logger.error(K), this.client.session.delete(U, Or("USER_DISCONNECTED")), await this.client.core.relayer.unsubscribe(U), K; } - return this.client.core.eventClient.deleteEvent({ eventId: B.eventId }), await this.client.core.pairing.updateMetadata({ topic: A, metadata: M.metadata }), await this.client.proposal.delete(a, Or("USER_DISCONNECTED")), await this.client.core.pairing.activate({ topic: A }), await this.setExpiry(W, En(Kc)), { topic: W, acknowledged: () => Promise.resolve(this.client.session.get(W)) }; + return this.client.core.eventClient.deleteEvent({ eventId: $.eventId }), await this.client.core.pairing.updateMetadata({ topic: A, metadata: M.metadata }), await this.client.proposal.delete(a, Or("USER_DISCONNECTED")), await this.client.core.pairing.activate({ topic: A }), await this.setExpiry(U, En(Kc)), { topic: U, acknowledged: () => Promise.resolve(this.client.session.get(U)) }; }, this.reject = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); try { @@ -20048,7 +20048,7 @@ class WV extends a$ { }), new Promise(async (M) => { var N; if (!((N = a.sessionConfig) != null && N.disableDeepLink)) { - const L = await Yq(this.client.core.storage, N3); + const L = await Yq(this.client.core.storage, L3); await Vq({ id: u, topic: s, wcDeepLink: L }); } M(); @@ -20091,18 +20091,18 @@ class WV extends a$ { this.isInitialized(), this.isValidAuthenticate(r); const s = n && this.client.core.linkModeSupportedApps.includes(n) && ((i = this.client.metadata.redirect) == null ? void 0 : i.linkMode), o = s ? zr.link_mode : zr.relay; o === zr.relay && await this.confirmOnlineStateOrThrow(); - const { chains: a, statement: u = "", uri: l, domain: d, nonce: p, type: w, exp: A, nbf: M, methods: N = [], expiry: L } = r, B = [...r.resources || []], { topic: $, uri: H } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); - this.client.logger.info({ message: "Generated new pairing", pairing: { topic: $, uri: H } }); - const W = await this.client.core.crypto.generateKeyPair(), V = Td(W); - if (await Promise.all([this.client.auth.authKeys.set(Rd, { responseTopic: V, publicKey: W }), this.client.auth.pairingTopics.set(V, { topic: V, pairingTopic: $ })]), await this.client.core.relayer.subscribe(V, { transportType: o }), this.client.logger.info(`sending request to new pairing topic: ${$}`), N.length > 0) { + const { chains: a, statement: u = "", uri: l, domain: d, nonce: p, type: w, exp: A, nbf: M, methods: N = [], expiry: L } = r, $ = [...r.resources || []], { topic: B, uri: H } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); + this.client.logger.info({ message: "Generated new pairing", pairing: { topic: B, uri: H } }); + const U = await this.client.core.crypto.generateKeyPair(), V = Td(U); + if (await Promise.all([this.client.auth.authKeys.set(Rd, { responseTopic: V, publicKey: U }), this.client.auth.pairingTopics.set(V, { topic: V, pairingTopic: B })]), await this.client.core.relayer.subscribe(V, { transportType: o }), this.client.logger.info(`sending request to new pairing topic: ${B}`), N.length > 0) { const { namespace: _ } = hu(a[0]); let E = mz(_, "request", N); - Cd(B) && (E = bz(E, B.pop())), B.push(E); + Cd($) && (E = bz(E, $.pop())), $.push(E); } - const te = L && L > In.wc_sessionAuthenticate.req.ttl ? L : In.wc_sessionAuthenticate.req.ttl, R = { authPayload: { type: w ?? "caip122", chains: a, statement: u, aud: l, domain: d, version: "1", nonce: p, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: A, nbf: M, resources: B }, requester: { publicKey: W, metadata: this.client.metadata }, expiryTimestamp: En(te) }, K = { eip155: { chains: a, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...N])], events: ["chainChanged", "accountsChanged"] } }, ge = { requiredNamespaces: {}, optionalNamespaces: K, relays: [{ protocol: "irn" }], pairingTopic: $, proposer: { publicKey: W, metadata: this.client.metadata }, expiryTimestamp: En(In.wc_sessionPropose.req.ttl) }, { done: Ee, resolve: Y, reject: S } = Ga(te, "Request expired"), m = async ({ error: _, session: E }) => { + const te = L && L > In.wc_sessionAuthenticate.req.ttl ? L : In.wc_sessionAuthenticate.req.ttl, R = { authPayload: { type: w ?? "caip122", chains: a, statement: u, aud: l, domain: d, version: "1", nonce: p, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: A, nbf: M, resources: $ }, requester: { publicKey: U, metadata: this.client.metadata }, expiryTimestamp: En(te) }, K = { eip155: { chains: a, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...N])], events: ["chainChanged", "accountsChanged"] } }, ge = { requiredNamespaces: {}, optionalNamespaces: K, relays: [{ protocol: "irn" }], pairingTopic: B, proposer: { publicKey: U, metadata: this.client.metadata }, expiryTimestamp: En(In.wc_sessionPropose.req.ttl) }, { done: Ee, resolve: Y, reject: S } = Ga(te, "Request expired"), m = async ({ error: _, session: E }) => { if (this.events.off(br("session_request", g), f), _) S(_); else if (E) { - E.self.publicKey = W, await this.client.session.set(E.topic, E), await this.setExpiry(E.topic, E.expiry), $ && await this.client.core.pairing.updateMetadata({ topic: $, metadata: E.peer.metadata }); + E.self.publicKey = U, await this.client.session.set(E.topic, E), await this.setExpiry(E.topic, E.expiry), B && await this.client.core.pairing.updateMetadata({ topic: B, metadata: E.peer.metadata }); const v = this.client.session.get(E.topic); await this.deleteProposal(b), Y({ session: v }); } @@ -20115,31 +20115,31 @@ class WV extends a$ { await this.deleteProposal(b), this.events.off(br("session_connect"), m); const { cacaos: I, responder: F } = _.result, ce = [], D = []; for (const J of I) { - await zx({ cacao: J, projectId: this.client.core.projectId }) || (this.client.logger.error(J, "Signature verification failed"), S(Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"))); + await Wx({ cacao: J, projectId: this.client.core.projectId }) || (this.client.logger.error(J, "Signature verification failed"), S(Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"))); const { p: Q } = J, T = Cd(Q.resources), X = [M1(Q.iss)], re = u0(Q.iss); if (T) { - const de = Wx(T), ie = Hx(T); + const de = Hx(T), ie = Kx(T); ce.push(...de), X.push(...ie); } for (const de of X) D.push(`${de}:${re}`); } - const oe = await this.client.core.crypto.generateSharedKey(W, F.publicKey); + const oe = await this.client.core.crypto.generateSharedKey(U, F.publicKey); let Z; - ce.length > 0 && (Z = { topic: oe, acknowledged: !0, self: { publicKey: W, metadata: this.client.metadata }, peer: F, controller: F.publicKey, expiry: En(Kc), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: $, namespaces: e3([...new Set(ce)], [...new Set(D)]), transportType: o }, await this.client.core.relayer.subscribe(oe, { transportType: o }), await this.client.session.set(oe, Z), $ && await this.client.core.pairing.updateMetadata({ topic: $, metadata: F.metadata }), Z = this.client.session.get(oe)), (E = this.client.metadata.redirect) != null && E.linkMode && (v = F.metadata.redirect) != null && v.linkMode && (P = F.metadata.redirect) != null && P.universal && n && (this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal), this.client.session.update(oe, { transportType: zr.link_mode })), Y({ auths: I, session: Z }); + ce.length > 0 && (Z = { topic: oe, acknowledged: !0, self: { publicKey: U, metadata: this.client.metadata }, peer: F, controller: F.publicKey, expiry: En(Kc), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: B, namespaces: t3([...new Set(ce)], [...new Set(D)]), transportType: o }, await this.client.core.relayer.subscribe(oe, { transportType: o }), await this.client.session.set(oe, Z), B && await this.client.core.pairing.updateMetadata({ topic: B, metadata: F.metadata }), Z = this.client.session.get(oe)), (E = this.client.metadata.redirect) != null && E.linkMode && (v = F.metadata.redirect) != null && v.linkMode && (P = F.metadata.redirect) != null && P.universal && n && (this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal), this.client.session.update(oe, { transportType: zr.link_mode })), Y({ auths: I, session: Z }); }, g = ua(), b = ua(); this.events.once(br("session_connect"), m), this.events.once(br("session_request", g), f); let x; try { if (s) { const _ = da("wc_sessionAuthenticate", R, g); - this.client.core.history.set($, _); + this.client.core.history.set(B, _); const E = await this.client.core.crypto.encode("", _, { type: th, encoding: Af }); - x = fd(n, $, E); - } else await Promise.all([this.sendRequest({ topic: $, method: "wc_sessionAuthenticate", params: R, expiry: r.expiry, throwOnFailedPublish: !0, clientRpcId: g }), this.sendRequest({ topic: $, method: "wc_sessionPropose", params: ge, expiry: In.wc_sessionPropose.req.ttl, throwOnFailedPublish: !0, clientRpcId: b })]); + x = fd(n, B, E); + } else await Promise.all([this.sendRequest({ topic: B, method: "wc_sessionAuthenticate", params: R, expiry: r.expiry, throwOnFailedPublish: !0, clientRpcId: g }), this.sendRequest({ topic: B, method: "wc_sessionPropose", params: ge, expiry: In.wc_sessionPropose.req.ttl, throwOnFailedPublish: !0, clientRpcId: b })]); } catch (_) { throw this.events.off(br("session_connect"), m), this.events.off(br("session_request", g), f), _; } - return await this.setProposal(b, tn({ id: b }, ge)), await this.setAuthRequest(g, { request: bs(tn({}, R), { verifyContext: {} }), pairingTopic: $, transportType: o }), { uri: x ?? H, response: Ee }; + return await this.setProposal(b, tn({ id: b }, ge)), await this.setAuthRequest(g, { request: bs(tn({}, R), { verifyContext: {} }), pairingTopic: B, transportType: o }), { uri: x ?? H, response: Ee }; }, this.approveSessionAuthenticate = async (r) => { const { id: n, auths: i } = r, s = this.client.core.eventClient.createEvent({ properties: { topic: n.toString(), trace: [Ka.authenticated_session_approve_started] } }); try { @@ -20153,24 +20153,24 @@ class WV extends a$ { a === zr.relay && await this.confirmOnlineStateOrThrow(); const u = o.requester.publicKey, l = await this.client.core.crypto.generateKeyPair(), d = Td(u), p = { type: Co, receiverPublicKey: u, senderPublicKey: l }, w = [], A = []; for (const L of i) { - if (!await zx({ cacao: L, projectId: this.client.core.projectId })) { + if (!await Wx({ cacao: L, projectId: this.client.core.projectId })) { s.setError(If.invalid_cacao); const V = Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"); throw await this.sendError({ id: n, topic: d, error: V, encodeOpts: p }), new Error(V.message); } s.addTrace(Ka.cacaos_verified); - const { p: B } = L, $ = Cd(B.resources), H = [M1(B.iss)], W = u0(B.iss); - if ($) { - const V = Wx($), te = Hx($); + const { p: $ } = L, B = Cd($.resources), H = [M1($.iss)], U = u0($.iss); + if (B) { + const V = Hx(B), te = Kx(B); w.push(...V), H.push(...te); } - for (const V of H) A.push(`${V}:${W}`); + for (const V of H) A.push(`${V}:${U}`); } const M = await this.client.core.crypto.generateSharedKey(l, u); s.addTrace(Ka.create_authenticated_session_topic); let N; if ((w == null ? void 0 : w.length) > 0) { - N = { topic: M, acknowledged: !0, self: { publicKey: l, metadata: this.client.metadata }, peer: { publicKey: u, metadata: o.requester.metadata }, controller: u, expiry: En(Kc), authentication: i, requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: o.pairingTopic, namespaces: e3([...new Set(w)], [...new Set(A)]), transportType: a }, s.addTrace(Ka.subscribing_authenticated_session_topic); + N = { topic: M, acknowledged: !0, self: { publicKey: l, metadata: this.client.metadata }, peer: { publicKey: u, metadata: o.requester.metadata }, controller: u, expiry: En(Kc), authentication: i, requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: o.pairingTopic, namespaces: t3([...new Set(w)], [...new Set(A)]), transportType: a }, s.addTrace(Ka.subscribing_authenticated_session_topic); try { await this.client.core.relayer.subscribe(M, { transportType: a }); } catch (L) { @@ -20195,7 +20195,7 @@ class WV extends a$ { }, this.formatAuthMessage = (r) => { this.isInitialized(); const { request: n, iss: i } = r; - return j8(n, i); + return U8(n, i); }, this.processRelayMessageCache = () => { setTimeout(async () => { if (this.relayMessageCache.length !== 0) for (; this.relayMessageCache.length > 0; ) try { @@ -20219,7 +20219,7 @@ class WV extends a$ { }, this.deleteSession = async (r) => { var n; const { topic: i, expirerHasDeleted: s = !1, emitEvent: o = !0, id: a = 0 } = r, { self: u } = this.client.session.get(i); - await this.client.core.relayer.unsubscribe(i), await this.client.session.delete(i, Or("USER_DISCONNECTED")), this.addToRecentlyDeleted(i, "session"), this.client.core.crypto.keychain.has(u.publicKey) && await this.client.core.crypto.deleteKeyPair(u.publicKey), this.client.core.crypto.keychain.has(i) && await this.client.core.crypto.deleteSymKey(i), s || this.client.core.expirer.del(i), this.client.core.storage.removeItem(N3).catch((l) => this.client.logger.warn(l)), this.getPendingSessionRequests().forEach((l) => { + await this.client.core.relayer.unsubscribe(i), await this.client.session.delete(i, Or("USER_DISCONNECTED")), this.addToRecentlyDeleted(i, "session"), this.client.core.crypto.keychain.has(u.publicKey) && await this.client.core.crypto.deleteKeyPair(u.publicKey), this.client.core.crypto.keychain.has(i) && await this.client.core.crypto.deleteSymKey(i), s || this.client.core.expirer.del(i), this.client.core.storage.removeItem(L3).catch((l) => this.client.logger.warn(l)), this.getPendingSessionRequests().forEach((l) => { l.topic === i && this.deletePendingSessionRequest(l.id, Or("USER_DISCONNECTED")); }), i === ((n = this.sessionRequestQueue.queue[0]) == null ? void 0 : n.topic) && (this.sessionRequestQueue.state = ks.idle), o && this.client.events.emit("session_delete", { id: a, topic: i }); }, this.deleteProposal = async (r, n) => { @@ -20255,8 +20255,8 @@ class WV extends a$ { } let M; if (OV.includes(i)) { - const L = xo(JSON.stringify(p)), B = xo(w); - M = await this.client.core.verify.register({ id: B, decryptedId: L }); + const L = xo(JSON.stringify(p)), $ = xo(w); + M = await this.client.core.verify.register({ id: $, decryptedId: L }); } const N = In[i].req; if (N.attestation = M, o && (N.ttl = o), a && (N.id = a), this.client.core.history.set(n, p), A) { @@ -20264,7 +20264,7 @@ class WV extends a$ { await global.Linking.openURL(L, this.client.name); } else { const L = In[i].req; - o && (L.ttl = o), a && (L.id = a), l ? (L.internal = bs(tn({}, L.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(n, w, L)) : this.client.core.relayer.publish(n, w, L).catch((B) => this.client.logger.error(B)); + o && (L.ttl = o), a && (L.id = a), l ? (L.internal = bs(tn({}, L.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(n, w, L)) : this.client.core.relayer.publish(n, w, L).catch(($) => this.client.logger.error($)); } return p.id; }, this.sendResult = async (r) => { @@ -20568,34 +20568,34 @@ class WV extends a$ { const n = this.client.proposal.getAll().find((i) => i.pairingTopic === r.topic); n && this.onSessionProposeRequest({ topic: r.topic, payload: da("wc_sessionPropose", { requiredNamespaces: n.requiredNamespaces, optionalNamespaces: n.optionalNamespaces, relays: n.relays, proposer: n.proposer, sessionProperties: n.sessionProperties }, n.id) }); }, this.isValidConnect = async (r) => { - if (!gi(r)) { + if (!mi(r)) { const { message: u } = ft("MISSING_OR_INVALID", `connect() params: ${JSON.stringify(r)}`); throw new Error(u); } const { pairingTopic: n, requiredNamespaces: i, optionalNamespaces: s, sessionProperties: o, relays: a } = r; - if (mi(n) || await this.isValidPairingTopic(n), !aW(a)) { + if (vi(n) || await this.isValidPairingTopic(n), !aW(a)) { const { message: u } = ft("MISSING_OR_INVALID", `connect() relays: ${a}`); throw new Error(u); } - !mi(i) && Sl(i) !== 0 && this.validateNamespaces(i, "requiredNamespaces"), !mi(s) && Sl(s) !== 0 && this.validateNamespaces(s, "optionalNamespaces"), mi(o) || this.validateSessionProps(o, "sessionProperties"); + !vi(i) && Sl(i) !== 0 && this.validateNamespaces(i, "requiredNamespaces"), !vi(s) && Sl(s) !== 0 && this.validateNamespaces(s, "optionalNamespaces"), vi(o) || this.validateSessionProps(o, "sessionProperties"); }, this.validateNamespaces = (r, n) => { const i = oW(r, "connect()", n); if (i) throw new Error(i.message); }, this.isValidApprove = async (r) => { - if (!gi(r)) throw new Error(ft("MISSING_OR_INVALID", `approve() params: ${r}`).message); + if (!mi(r)) throw new Error(ft("MISSING_OR_INVALID", `approve() params: ${r}`).message); const { id: n, namespaces: i, relayProtocol: s, sessionProperties: o } = r; this.checkRecentlyDeleted(n), await this.isValidProposalId(n); const a = this.client.proposal.get(n), u = hm(i, "approve()"); if (u) throw new Error(u.message); - const l = n3(a.requiredNamespaces, i, "approve()"); + const l = i3(a.requiredNamespaces, i, "approve()"); if (l) throw new Error(l.message); if (!dn(s, !0)) { const { message: d } = ft("MISSING_OR_INVALID", `approve() relayProtocol: ${s}`); throw new Error(d); } - mi(o) || this.validateSessionProps(o, "sessionProperties"); + vi(o) || this.validateSessionProps(o, "sessionProperties"); }, this.isValidReject = async (r) => { - if (!gi(r)) { + if (!mi(r)) { const { message: s } = ft("MISSING_OR_INVALID", `reject() params: ${r}`); throw new Error(s); } @@ -20605,12 +20605,12 @@ class WV extends a$ { throw new Error(s); } }, this.isValidSessionSettleRequest = (r) => { - if (!gi(r)) { + if (!mi(r)) { const { message: l } = ft("MISSING_OR_INVALID", `onSessionSettleRequest() params: ${r}`); throw new Error(l); } const { relay: n, controller: i, namespaces: s, expiry: o } = r; - if (!G8(n)) { + if (!Y8(n)) { const { message: l } = ft("MISSING_OR_INVALID", "onSessionSettleRequest() relay protocol should be a string"); throw new Error(l); } @@ -20623,7 +20623,7 @@ class WV extends a$ { throw new Error(l); } }, this.isValidUpdate = async (r) => { - if (!gi(r)) { + if (!mi(r)) { const { message: u } = ft("MISSING_OR_INVALID", `update() params: ${r}`); throw new Error(u); } @@ -20631,24 +20631,24 @@ class WV extends a$ { this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); const s = this.client.session.get(n), o = hm(i, "update()"); if (o) throw new Error(o.message); - const a = n3(s.requiredNamespaces, i, "update()"); + const a = i3(s.requiredNamespaces, i, "update()"); if (a) throw new Error(a.message); }, this.isValidExtend = async (r) => { - if (!gi(r)) { + if (!mi(r)) { const { message: i } = ft("MISSING_OR_INVALID", `extend() params: ${r}`); throw new Error(i); } const { topic: n } = r; this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); }, this.isValidRequest = async (r) => { - if (!gi(r)) { + if (!mi(r)) { const { message: u } = ft("MISSING_OR_INVALID", `request() params: ${r}`); throw new Error(u); } const { topic: n, request: i, chainId: s, expiry: o } = r; this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); const { namespaces: a } = this.client.session.get(n); - if (!r3(a, s)) { + if (!n3(a, s)) { const { message: u } = ft("MISSING_OR_INVALID", `request() chainId: ${s}`); throw new Error(u); } @@ -20666,7 +20666,7 @@ class WV extends a$ { } }, this.isValidRespond = async (r) => { var n; - if (!gi(r)) { + if (!mi(r)) { const { message: o } = ft("MISSING_OR_INVALID", `respond() params: ${r}`); throw new Error(o); } @@ -20681,21 +20681,21 @@ class WV extends a$ { throw new Error(o); } }, this.isValidPing = async (r) => { - if (!gi(r)) { + if (!mi(r)) { const { message: i } = ft("MISSING_OR_INVALID", `ping() params: ${r}`); throw new Error(i); } const { topic: n } = r; await this.isValidSessionOrPairingTopic(n); }, this.isValidEmit = async (r) => { - if (!gi(r)) { + if (!mi(r)) { const { message: a } = ft("MISSING_OR_INVALID", `emit() params: ${r}`); throw new Error(a); } const { topic: n, event: i, chainId: s } = r; await this.isValidSessionTopic(n); const { namespaces: o } = this.client.session.get(n); - if (!r3(o, s)) { + if (!n3(o, s)) { const { message: a } = ft("MISSING_OR_INVALID", `emit() chainId: ${s}`); throw new Error(a); } @@ -20708,7 +20708,7 @@ class WV extends a$ { throw new Error(a); } }, this.isValidDisconnect = async (r) => { - if (!gi(r)) { + if (!mi(r)) { const { message: i } = ft("MISSING_OR_INVALID", `disconnect() params: ${r}`); throw new Error(i); } @@ -20769,11 +20769,11 @@ class WV extends a$ { return this.isLinkModeEnabled(r, n) ? (i = r == null ? void 0 : r.redirect) == null ? void 0 : i.universal : void 0; }, this.handleLinkModeMessage = ({ url: r }) => { if (!r || !r.includes("wc_ev") || !r.includes("topic")) return; - const n = Fx(r, "topic") || "", i = decodeURIComponent(Fx(r, "wc_ev") || ""), s = this.client.session.keys.includes(n); + const n = jx(r, "topic") || "", i = decodeURIComponent(jx(r, "wc_ev") || ""), s = this.client.session.keys.includes(n); s && this.client.session.update(n, { transportType: zr.link_mode }), this.client.core.dispatchEnvelope({ topic: n, message: i, sessionExists: s }); }, this.registerLinkModeListeners = async () => { var r; - if (sb() || qu() && (r = this.client.metadata.redirect) != null && r.linkMode) { + if (ob() || qu() && (r = this.client.metadata.redirect) != null && r.linkMode) { const n = global == null ? void 0 : global.Linking; if (typeof n < "u") { n.addEventListener("url", this.handleLinkModeMessage, this.client.name); @@ -20802,14 +20802,14 @@ class WV extends a$ { async onRelayMessage(e) { const { topic: r, message: n, attestation: i, transportType: s } = e, { publicKey: o } = this.client.auth.authKeys.keys.includes(Rd) ? this.client.auth.authKeys.get(Rd) : { publicKey: void 0 }, a = await this.client.core.crypto.decode(r, n, { receiverPublicKey: o, encoding: s === zr.link_mode ? Af : ha }); try { - lb(a) ? (this.client.core.history.set(r, a), this.onRelayEventRequest({ topic: r, payload: a, attestation: i, transportType: s, encryptedId: xo(n) })) : ip(a) ? (await this.client.core.history.resolve(a), await this.onRelayEventResponse({ topic: r, payload: a, transportType: s }), this.client.core.history.delete(r, a.id)) : this.onRelayEventUnknownPayload({ topic: r, payload: a, transportType: s }); + hb(a) ? (this.client.core.history.set(r, a), this.onRelayEventRequest({ topic: r, payload: a, attestation: i, transportType: s, encryptedId: xo(n) })) : ip(a) ? (await this.client.core.history.resolve(a), await this.onRelayEventResponse({ topic: r, payload: a, transportType: s }), this.client.core.history.delete(r, a.id)) : this.onRelayEventUnknownPayload({ topic: r, payload: a, transportType: s }); } catch (u) { this.client.logger.error(u); } } registerExpirerEvents() { this.client.core.expirer.on(Ji.expired, async (e) => { - const { topic: r, id: n } = B8(e.target); + const { topic: r, id: n } = F8(e.target); if (n && this.client.pendingRequest.keys.includes(n)) return await this.deletePendingSessionRequest(n, ft("EXPIRED"), !0); if (n && this.client.auth.requests.keys.includes(n)) return await this.deletePendingAuthRequest(n, ft("EXPIRED"), !0); r ? this.client.session.keys.includes(r) && (await this.deleteSession({ topic: r, expirerHasDeleted: !0 }), this.client.events.emit("session_expire", { topic: r })) : n && (await this.deleteProposal(n, !0), this.client.events.emit("proposal_expire", { id: n })); @@ -20882,17 +20882,17 @@ class WV extends a$ { } class HV extends Ec { constructor(e, r) { - super(e, r, CV, db), this.core = e, this.logger = r; + super(e, r, CV, pb), this.core = e, this.logger = r; } } let KV = class extends Ec { constructor(e, r) { - super(e, r, TV, db), this.core = e, this.logger = r; + super(e, r, TV, pb), this.core = e, this.logger = r; } }; class VV extends Ec { constructor(e, r) { - super(e, r, DV, db, (n) => n.id), this.core = e, this.logger = r; + super(e, r, DV, pb, (n) => n.id), this.core = e, this.logger = r; } } class GV extends Ec { @@ -20918,9 +20918,9 @@ class XV { await this.authKeys.init(), await this.pairingTopics.init(), await this.requests.init(); } } -class pb extends o$ { +class gb extends o$ { constructor(e) { - super(e), this.protocol = vE, this.version = bE, this.name = mm.name, this.events = new rs.EventEmitter(), this.on = (n, i) => this.events.on(n, i), this.once = (n, i) => this.events.once(n, i), this.off = (n, i) => this.events.off(n, i), this.removeListener = (n, i) => this.events.removeListener(n, i), this.removeAllListeners = (n) => this.events.removeAllListeners(n), this.connect = async (n) => { + super(e), this.protocol = bE, this.version = yE, this.name = mm.name, this.events = new rs.EventEmitter(), this.on = (n, i) => this.events.on(n, i), this.once = (n, i) => this.events.once(n, i), this.off = (n, i) => this.events.off(n, i), this.removeListener = (n, i) => this.events.removeListener(n, i), this.removeAllListeners = (n) => this.events.removeAllListeners(n), this.connect = async (n) => { try { return await this.engine.connect(n); } catch (i) { @@ -21022,12 +21022,12 @@ class pb extends o$ { } catch (i) { throw this.logger.error(i.message), i; } - }, this.name = (e == null ? void 0 : e.name) || mm.name, this.metadata = (e == null ? void 0 : e.metadata) || O8(), this.signConfig = e == null ? void 0 : e.signConfig; + }, this.name = (e == null ? void 0 : e.name) || mm.name, this.metadata = (e == null ? void 0 : e.metadata) || N8(), this.signConfig = e == null ? void 0 : e.signConfig; const r = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : ql($0({ level: (e == null ? void 0 : e.logger) || mm.logger })); - this.core = (e == null ? void 0 : e.core) || new IV(e), this.logger = ci(r, this.name), this.session = new KV(this.core, this.logger), this.proposal = new HV(this.core, this.logger), this.pendingRequest = new VV(this.core, this.logger), this.engine = new WV(this), this.auth = new XV(this.core, this.logger); + this.core = (e == null ? void 0 : e.core) || new IV(e), this.logger = ui(r, this.name), this.session = new KV(this.core, this.logger), this.proposal = new HV(this.core, this.logger), this.pendingRequest = new VV(this.core, this.logger), this.engine = new WV(this), this.auth = new XV(this.core, this.logger); } static async init(e) { - const r = new pb(e); + const r = new gb(e); return await r.initialize(), r; } get context() { @@ -21057,17 +21057,17 @@ var h0 = { exports: {} }; h0.exports; (function(t, e) { (function() { - var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", u = "__lodash_hash_undefined__", l = 500, d = "__lodash_placeholder__", p = 1, w = 2, A = 4, M = 1, N = 2, L = 1, B = 2, $ = 4, H = 8, W = 16, V = 32, te = 64, R = 128, K = 256, ge = 512, Ee = 30, Y = "...", S = 800, m = 16, f = 1, g = 2, b = 3, x = 1 / 0, _ = 9007199254740991, E = 17976931348623157e292, v = NaN, P = 4294967295, I = P - 1, F = P >>> 1, ce = [ + var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", u = "__lodash_hash_undefined__", l = 500, d = "__lodash_placeholder__", p = 1, w = 2, A = 4, M = 1, N = 2, L = 1, $ = 2, B = 4, H = 8, U = 16, V = 32, te = 64, R = 128, K = 256, ge = 512, Ee = 30, Y = "...", S = 800, m = 16, f = 1, g = 2, b = 3, x = 1 / 0, _ = 9007199254740991, E = 17976931348623157e292, v = NaN, P = 4294967295, I = P - 1, F = P >>> 1, ce = [ ["ary", R], ["bind", L], - ["bindKey", B], + ["bindKey", $], ["curry", H], - ["curryRight", W], + ["curryRight", U], ["flip", ge], ["partial", V], ["partialRight", te], ["rearg", K] - ], D = "[object Arguments]", oe = "[object Array]", Z = "[object AsyncFunction]", J = "[object Boolean]", Q = "[object Date]", T = "[object DOMException]", X = "[object Error]", re = "[object Function]", de = "[object GeneratorFunction]", ie = "[object Map]", ue = "[object Number]", ve = "[object Null]", Pe = "[object Object]", De = "[object Promise]", Ce = "[object Proxy]", $e = "[object RegExp]", Me = "[object Set]", Ne = "[object String]", Ke = "[object Symbol]", Le = "[object Undefined]", qe = "[object WeakMap]", ze = "[object WeakSet]", _e = "[object ArrayBuffer]", Ze = "[object DataView]", at = "[object Float32Array]", ke = "[object Float64Array]", Qe = "[object Int8Array]", tt = "[object Int16Array]", Ye = "[object Int32Array]", dt = "[object Uint8Array]", lt = "[object Uint8ClampedArray]", ct = "[object Uint16Array]", qt = "[object Uint32Array]", Jt = /\b__p \+= '';/g, Et = /\b(__p \+=) '' \+/g, er = /(__e\(.*?\)|\b__t\)) \+\n'';/g, Xt = /&(?:amp|lt|gt|quot|#39);/g, Dt = /[&<>"']/g, kt = RegExp(Xt.source), Ct = RegExp(Dt.source), gt = /<%-([\s\S]+?)%>/g, Rt = /<%([\s\S]+?)%>/g, Nt = /<%=([\s\S]+?)%>/g, vt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $t = /^\w*$/, Ft = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, rt = /[\\^$.*+?()[\]{}|]/g, Bt = RegExp(rt.source), k = /^\s+/, U = /\s/, z = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, C = /\{\n\/\* \[wrapped with (.+)\] \*/, G = /,? & /, j = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, se = /[()=,{}\[\]\/\s]/, he = /\\(\\)?/g, xe = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Te = /\w*$/, Re = /^[-+]0x[0-9a-f]+$/i, nt = /^0b[01]+$/i, je = /^\[object .+?Constructor\]$/, pt = /^0o[0-7]+$/i, it = /^(?:0|[1-9]\d*)$/, et = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, St = /($^)/, Tt = /['\n\r\u2028\u2029\\]/g, At = "\\ud800-\\udfff", _t = "\\u0300-\\u036f", ht = "\\ufe20-\\ufe2f", xt = "\\u20d0-\\u20ff", st = _t + ht + xt, bt = "\\u2700-\\u27bf", ut = "a-z\\xdf-\\xf6\\xf8-\\xff", ot = "\\xac\\xb1\\xd7\\xf7", Se = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Ae = "\\u2000-\\u206f", Ve = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Fe = "A-Z\\xc0-\\xd6\\xd8-\\xde", Ue = "\\ufe0e\\ufe0f", Je = ot + Se + Ae + Ve, Lt = "['’]", zt = "[" + At + "]", Zt = "[" + Je + "]", Wt = "[" + st + "]", le = "\\d+", rr = "[" + bt + "]", dr = "[" + ut + "]", pr = "[^" + At + Je + le + bt + ut + Fe + "]", Qt = "\\ud83c[\\udffb-\\udfff]", gr = "(?:" + Wt + "|" + Qt + ")", lr = "[^" + At + "]", Rr = "(?:\\ud83c[\\udde6-\\uddff]){2}", mr = "[\\ud800-\\udbff][\\udc00-\\udfff]", yr = "[" + Fe + "]", $r = "\\u200d", Br = "(?:" + dr + "|" + pr + ")", Ir = "(?:" + yr + "|" + pr + ")", nn = "(?:" + Lt + "(?:d|ll|m|re|s|t|ve))?", sn = "(?:" + Lt + "(?:D|LL|M|RE|S|T|VE))?", on = gr + "?", lh = "[" + Ue + "]?", Rp = "(?:" + $r + "(?:" + [lr, Rr, mr].join("|") + ")" + lh + on + ")*", io = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", hh = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", dh = lh + on + Rp, Mc = "(?:" + [rr, Rr, mr].join("|") + ")" + dh, Dp = "(?:" + [lr + Wt + "?", Wt, Rr, mr, zt].join("|") + ")", Xu = RegExp(Lt, "g"), Op = RegExp(Wt, "g"), Ic = RegExp(Qt + "(?=" + Qt + ")|" + Dp + dh, "g"), ph = RegExp([ + ], D = "[object Arguments]", oe = "[object Array]", Z = "[object AsyncFunction]", J = "[object Boolean]", Q = "[object Date]", T = "[object DOMException]", X = "[object Error]", re = "[object Function]", de = "[object GeneratorFunction]", ie = "[object Map]", ue = "[object Number]", ve = "[object Null]", Pe = "[object Object]", De = "[object Promise]", Ce = "[object Proxy]", $e = "[object RegExp]", Me = "[object Set]", Ne = "[object String]", Ke = "[object Symbol]", Le = "[object Undefined]", qe = "[object WeakMap]", ze = "[object WeakSet]", _e = "[object ArrayBuffer]", Ze = "[object DataView]", at = "[object Float32Array]", ke = "[object Float64Array]", Qe = "[object Int8Array]", tt = "[object Int16Array]", Ye = "[object Int32Array]", dt = "[object Uint8Array]", lt = "[object Uint8ClampedArray]", ct = "[object Uint16Array]", qt = "[object Uint32Array]", Jt = /\b__p \+= '';/g, Et = /\b(__p \+=) '' \+/g, er = /(__e\(.*?\)|\b__t\)) \+\n'';/g, Xt = /&(?:amp|lt|gt|quot|#39);/g, Dt = /[&<>"']/g, kt = RegExp(Xt.source), Ct = RegExp(Dt.source), gt = /<%-([\s\S]+?)%>/g, Rt = /<%([\s\S]+?)%>/g, Nt = /<%=([\s\S]+?)%>/g, vt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $t = /^\w*$/, Ft = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, rt = /[\\^$.*+?()[\]{}|]/g, Bt = RegExp(rt.source), k = /^\s+/, q = /\s/, W = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, C = /\{\n\/\* \[wrapped with (.+)\] \*/, G = /,? & /, j = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, se = /[()=,{}\[\]\/\s]/, he = /\\(\\)?/g, xe = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Te = /\w*$/, Re = /^[-+]0x[0-9a-f]+$/i, nt = /^0b[01]+$/i, je = /^\[object .+?Constructor\]$/, pt = /^0o[0-7]+$/i, it = /^(?:0|[1-9]\d*)$/, et = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, St = /($^)/, Tt = /['\n\r\u2028\u2029\\]/g, At = "\\ud800-\\udfff", _t = "\\u0300-\\u036f", ht = "\\ufe20-\\ufe2f", xt = "\\u20d0-\\u20ff", st = _t + ht + xt, bt = "\\u2700-\\u27bf", ut = "a-z\\xdf-\\xf6\\xf8-\\xff", ot = "\\xac\\xb1\\xd7\\xf7", Se = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Ae = "\\u2000-\\u206f", Ve = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Fe = "A-Z\\xc0-\\xd6\\xd8-\\xde", Ue = "\\ufe0e\\ufe0f", Je = ot + Se + Ae + Ve, Lt = "['’]", zt = "[" + At + "]", Zt = "[" + Je + "]", Wt = "[" + st + "]", le = "\\d+", rr = "[" + bt + "]", dr = "[" + ut + "]", pr = "[^" + At + Je + le + bt + ut + Fe + "]", Qt = "\\ud83c[\\udffb-\\udfff]", gr = "(?:" + Wt + "|" + Qt + ")", lr = "[^" + At + "]", Rr = "(?:\\ud83c[\\udde6-\\uddff]){2}", mr = "[\\ud800-\\udbff][\\udc00-\\udfff]", yr = "[" + Fe + "]", $r = "\\u200d", Br = "(?:" + dr + "|" + pr + ")", Ir = "(?:" + yr + "|" + pr + ")", nn = "(?:" + Lt + "(?:d|ll|m|re|s|t|ve))?", sn = "(?:" + Lt + "(?:D|LL|M|RE|S|T|VE))?", on = gr + "?", lh = "[" + Ue + "]?", Rp = "(?:" + $r + "(?:" + [lr, Rr, mr].join("|") + ")" + lh + on + ")*", io = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", hh = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", dh = lh + on + Rp, Mc = "(?:" + [rr, Rr, mr].join("|") + ")" + dh, Dp = "(?:" + [lr + Wt + "?", Wt, Rr, mr, zt].join("|") + ")", Xu = RegExp(Lt, "g"), Op = RegExp(Wt, "g"), Ic = RegExp(Qt + "(?=" + Qt + ")|" + Dp + dh, "g"), ph = RegExp([ yr + "?" + dr + "+" + nn + "(?=" + [Zt, yr, "$"].join("|") + ")", Ir + "+" + sn + "(?=" + [Zt, yr + Br, "$"].join("|") + ")", yr + "?" + Br + "+" + nn, @@ -21323,7 +21323,7 @@ h0.exports; "\r": "r", "\u2028": "u2028", "\u2029": "u2029" - }, jr = parseFloat, nr = parseInt, Kr = typeof gn == "object" && gn && gn.Object === Object && gn, vn = typeof self == "object" && self && self.Object === Object && self, _r = Kr || vn || Function("return this")(), Ur = e && !e.nodeType && e, an = Ur && !0 && t && !t.nodeType && t, ui = an && an.exports === Ur, bn = ui && Kr.process, Vr = function() { + }, jr = parseFloat, nr = parseInt, Kr = typeof gn == "object" && gn && gn.Object === Object && gn, vn = typeof self == "object" && self && self.Object === Object && self, _r = Kr || vn || Function("return this")(), Ur = e && !e.nodeType && e, an = Ur && !0 && t && !t.nodeType && t, fi = an && an.exports === Ur, bn = fi && Kr.process, Vr = function() { try { var be = an && an.require && an.require("util").types; return be || bn && bn.binding && bn.binding("util"); @@ -21360,7 +21360,7 @@ h0.exports; ; return be; } - function gy(be, Be) { + function my(be, Be) { for (var Ie = -1, It = be == null ? 0 : be.length; ++Ie < It; ) if (!Be(be[Ie], Ie, be)) return !1; @@ -21418,7 +21418,7 @@ h0.exports; function cA(be) { return be.match(j) || []; } - function my(be, Be, Ie) { + function vy(be, Be, Ie) { var It; return Ie(be, function(tr, Pr, xn) { if (Be(tr, Pr, xn)) @@ -21432,7 +21432,7 @@ h0.exports; return -1; } function Cc(be, Be, Ie) { - return Be === Be ? wA(be, Be, Ie) : bh(be, vy, Ie); + return Be === Be ? wA(be, Be, Ie) : bh(be, by, Ie); } function uA(be, Be, Ie, It) { for (var tr = Ie - 1, Pr = be.length; ++tr < Pr; ) @@ -21440,10 +21440,10 @@ h0.exports; return tr; return -1; } - function vy(be) { + function by(be) { return be !== be; } - function by(be, Be) { + function yy(be, Be) { var Ie = be == null ? 0 : be.length; return Ie ? jp(be, Be) / Ie : v; } @@ -21457,7 +21457,7 @@ h0.exports; return be == null ? r : be[Be]; }; } - function yy(be, Be, Ie, It, tr) { + function wy(be, Be, Ie, It, tr) { return tr(be, function(Pr, xn, qr) { Ie = It ? (It = !1, Pr) : Be(Ie, Pr, xn, qr); }), Ie; @@ -21485,8 +21485,8 @@ h0.exports; return [Ie, be[Ie]]; }); } - function wy(be) { - return be && be.slice(0, Sy(be) + 1).replace(k, ""); + function xy(be) { + return be && be.slice(0, Ay(be) + 1).replace(k, ""); } function Pi(be) { return function(Be) { @@ -21501,12 +21501,12 @@ h0.exports; function Qu(be, Be) { return be.has(Be); } - function xy(be, Be) { + function _y(be, Be) { for (var Ie = -1, It = be.length; ++Ie < It && Cc(Be, be[Ie], 0) > -1; ) ; return Ie; } - function _y(be, Be) { + function Ey(be, Be) { for (var Ie = be.length; Ie-- && Cc(Be, be[Ie], 0) > -1; ) ; return Ie; @@ -21540,7 +21540,7 @@ h0.exports; Ie[++Be] = [tr, It]; }), Ie; } - function Ey(be, Be) { + function Sy(be, Be) { return function(Ie) { return be(Be(Ie)); }; @@ -21582,8 +21582,8 @@ h0.exports; function ls(be) { return Tc(be) ? SA(be) : aA(be); } - function Sy(be) { - for (var Be = be.length; Be-- && U.test(be.charAt(Be)); ) + function Ay(be) { + for (var Be = be.length; Be-- && q.test(be.charAt(Be)); ) ; return Be; } @@ -21601,24 +21601,24 @@ h0.exports; } var PA = function be(Be) { Be = Be == null ? _r : Dc.defaults(_r.Object(), Be, Dc.pick(_r, mh)); - var Ie = Be.Array, It = Be.Date, tr = Be.Error, Pr = Be.Function, xn = Be.Math, qr = Be.Object, Wp = Be.RegExp, MA = Be.String, Ui = Be.TypeError, wh = Ie.prototype, IA = Pr.prototype, Oc = qr.prototype, xh = Be["__core-js_shared__"], _h = IA.toString, Tr = Oc.hasOwnProperty, CA = 0, Ay = function() { + var Ie = Be.Array, It = Be.Date, tr = Be.Error, Pr = Be.Function, xn = Be.Math, qr = Be.Object, Wp = Be.RegExp, MA = Be.String, Ui = Be.TypeError, wh = Ie.prototype, IA = Pr.prototype, Oc = qr.prototype, xh = Be["__core-js_shared__"], _h = IA.toString, Tr = Oc.hasOwnProperty, CA = 0, Py = function() { var c = /[^.]+$/.exec(xh && xh.keys && xh.keys.IE_PROTO || ""); return c ? "Symbol(src)_1." + c : ""; }(), Eh = Oc.toString, TA = _h.call(qr), RA = _r._, DA = Wp( "^" + _h.call(Tr).replace(rt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" - ), Sh = ui ? Be.Buffer : r, Vo = Be.Symbol, Ah = Be.Uint8Array, Py = Sh ? Sh.allocUnsafe : r, Ph = Ey(qr.getPrototypeOf, qr), My = qr.create, Iy = Oc.propertyIsEnumerable, Mh = wh.splice, Cy = Vo ? Vo.isConcatSpreadable : r, ef = Vo ? Vo.iterator : r, Na = Vo ? Vo.toStringTag : r, Ih = function() { + ), Sh = fi ? Be.Buffer : r, Vo = Be.Symbol, Ah = Be.Uint8Array, My = Sh ? Sh.allocUnsafe : r, Ph = Sy(qr.getPrototypeOf, qr), Iy = qr.create, Cy = Oc.propertyIsEnumerable, Mh = wh.splice, Ty = Vo ? Vo.isConcatSpreadable : r, ef = Vo ? Vo.iterator : r, Na = Vo ? Vo.toStringTag : r, Ih = function() { try { var c = Fa(qr, "defineProperty"); return c({}, "", {}), c; } catch { } - }(), OA = Be.clearTimeout !== _r.clearTimeout && Be.clearTimeout, NA = It && It.now !== _r.Date.now && It.now, LA = Be.setTimeout !== _r.setTimeout && Be.setTimeout, Ch = xn.ceil, Th = xn.floor, Hp = qr.getOwnPropertySymbols, kA = Sh ? Sh.isBuffer : r, Ty = Be.isFinite, $A = wh.join, BA = Ey(qr.keys, qr), _n = xn.max, Kn = xn.min, FA = It.now, jA = Be.parseInt, Ry = xn.random, UA = wh.reverse, Kp = Fa(Be, "DataView"), tf = Fa(Be, "Map"), Vp = Fa(Be, "Promise"), Nc = Fa(Be, "Set"), rf = Fa(Be, "WeakMap"), nf = Fa(qr, "create"), Rh = rf && new rf(), Lc = {}, qA = ja(Kp), zA = ja(tf), WA = ja(Vp), HA = ja(Nc), KA = ja(rf), Dh = Vo ? Vo.prototype : r, sf = Dh ? Dh.valueOf : r, Dy = Dh ? Dh.toString : r; + }(), OA = Be.clearTimeout !== _r.clearTimeout && Be.clearTimeout, NA = It && It.now !== _r.Date.now && It.now, LA = Be.setTimeout !== _r.setTimeout && Be.setTimeout, Ch = xn.ceil, Th = xn.floor, Hp = qr.getOwnPropertySymbols, kA = Sh ? Sh.isBuffer : r, Ry = Be.isFinite, $A = wh.join, BA = Sy(qr.keys, qr), _n = xn.max, Kn = xn.min, FA = It.now, jA = Be.parseInt, Dy = xn.random, UA = wh.reverse, Kp = Fa(Be, "DataView"), tf = Fa(Be, "Map"), Vp = Fa(Be, "Promise"), Nc = Fa(Be, "Set"), rf = Fa(Be, "WeakMap"), nf = Fa(qr, "create"), Rh = rf && new rf(), Lc = {}, qA = ja(Kp), zA = ja(tf), WA = ja(Vp), HA = ja(Nc), KA = ja(rf), Dh = Vo ? Vo.prototype : r, sf = Dh ? Dh.valueOf : r, Oy = Dh ? Dh.toString : r; function ee(c) { if (en(c) && !ir(c) && !(c instanceof wr)) { if (c instanceof qi) return c; if (Tr.call(c, "__wrapped__")) - return Ow(c); + return Nw(c); } return new qi(c); } @@ -21628,8 +21628,8 @@ h0.exports; return function(h) { if (!Zr(h)) return {}; - if (My) - return My(h); + if (Iy) + return Iy(h); c.prototype = h; var y = new c(); return c.prototype = r, y; @@ -21690,7 +21690,7 @@ h0.exports; } function VA() { var c = new wr(this.__wrapped__); - return c.__actions__ = fi(this.__actions__), c.__dir__ = this.__dir__, c.__filtered__ = this.__filtered__, c.__iteratees__ = fi(this.__iteratees__), c.__takeCount__ = this.__takeCount__, c.__views__ = fi(this.__views__), c; + return c.__actions__ = li(this.__actions__), c.__dir__ = this.__dir__, c.__filtered__ = this.__filtered__, c.__iteratees__ = li(this.__iteratees__), c.__takeCount__ = this.__takeCount__, c.__views__ = li(this.__views__), c; } function GA() { if (this.__filtered__) { @@ -21701,9 +21701,9 @@ h0.exports; return c; } function YA() { - var c = this.__wrapped__.value(), h = this.__dir__, y = ir(c), O = h < 0, q = y ? c.length : 0, ne = aM(0, q, this.__views__), fe = ne.start, me = ne.end, we = me - fe, We = O ? me : fe - 1, He = this.__iteratees__, Xe = He.length, wt = 0, Ot = Kn(we, this.__takeCount__); - if (!y || !O && q == we && Ot == we) - return rw(c, this.__actions__); + var c = this.__wrapped__.value(), h = this.__dir__, y = ir(c), O = h < 0, z = y ? c.length : 0, ne = aM(0, z, this.__views__), fe = ne.start, me = ne.end, we = me - fe, We = O ? me : fe - 1, He = this.__iteratees__, Xe = He.length, wt = 0, Ot = Kn(we, this.__takeCount__); + if (!y || !O && z == we && Ot == we) + return nw(c, this.__actions__); var Ht = []; e: for (; we-- && wt < Ot; ) { @@ -21852,25 +21852,25 @@ h0.exports; return y.set(c, h), this.size = y.size, this; } hs.prototype.clear = dP, hs.prototype.delete = pP, hs.prototype.get = gP, hs.prototype.has = mP, hs.prototype.set = vP; - function Oy(c, h) { - var y = ir(c), O = !y && Ua(c), q = !y && !O && Zo(c), ne = !y && !O && !q && jc(c), fe = y || O || q || ne, me = fe ? Up(c.length, MA) : [], we = me.length; + function Ny(c, h) { + var y = ir(c), O = !y && Ua(c), z = !y && !O && Zo(c), ne = !y && !O && !z && jc(c), fe = y || O || z || ne, me = fe ? Up(c.length, MA) : [], we = me.length; for (var We in c) (h || Tr.call(c, We)) && !(fe && // Safari 9 has enumerable `arguments.length` in strict mode. (We == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. - q && (We == "offset" || We == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. + z && (We == "offset" || We == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. ne && (We == "buffer" || We == "byteLength" || We == "byteOffset") || // Skip index properties. fo(We, we))) && me.push(We); return me; } - function Ny(c) { + function Ly(c) { var h = c.length; return h ? c[ig(0, h - 1)] : r; } function bP(c, h) { - return Vh(fi(c), $a(h, 0, c.length)); + return Vh(li(c), $a(h, 0, c.length)); } function yP(c) { - return Vh(fi(c)); + return Vh(li(c)); } function Gp(c, h, y) { (y !== r && !ds(c[h], y) || y === r && !(h in c)) && ao(c, h, y); @@ -21886,15 +21886,15 @@ h0.exports; return -1; } function wP(c, h, y, O) { - return Go(c, function(q, ne, fe) { - h(O, q, y(q), fe); + return Go(c, function(z, ne, fe) { + h(O, z, y(z), fe); }), O; } - function Ly(c, h) { + function ky(c, h) { return c && Ts(h, Mn(h), c); } function xP(c, h) { - return c && Ts(h, hi(h), c); + return c && Ts(h, di(h), c); } function ao(c, h, y) { h == "__proto__" && Ih ? Ih(c, h, { @@ -21905,33 +21905,33 @@ h0.exports; }) : c[h] = y; } function Yp(c, h) { - for (var y = -1, O = h.length, q = Ie(O), ne = c == null; ++y < O; ) - q[y] = ne ? r : Cg(c, h[y]); - return q; + for (var y = -1, O = h.length, z = Ie(O), ne = c == null; ++y < O; ) + z[y] = ne ? r : Cg(c, h[y]); + return z; } function $a(c, h, y) { return c === c && (y !== r && (c = c <= y ? c : y), h !== r && (c = c >= h ? c : h)), c; } - function zi(c, h, y, O, q, ne) { + function zi(c, h, y, O, z, ne) { var fe, me = h & p, we = h & w, We = h & A; - if (y && (fe = q ? y(c, O, q, ne) : y(c)), fe !== r) + if (y && (fe = z ? y(c, O, z, ne) : y(c)), fe !== r) return fe; if (!Zr(c)) return c; var He = ir(c); if (He) { if (fe = uM(c), !me) - return fi(c, fe); + return li(c, fe); } else { var Xe = Vn(c), wt = Xe == re || Xe == de; if (Zo(c)) - return sw(c, me); - if (Xe == Pe || Xe == D || wt && !q) { - if (fe = we || wt ? {} : Sw(c), !me) - return we ? ZP(c, xP(fe, c)) : XP(c, Ly(fe, c)); + return ow(c, me); + if (Xe == Pe || Xe == D || wt && !z) { + if (fe = we || wt ? {} : Aw(c), !me) + return we ? ZP(c, xP(fe, c)) : XP(c, ky(fe, c)); } else { if (!Dr[Xe]) - return q ? c : {}; + return z ? c : {}; fe = fM(c, Xe, me); } } @@ -21939,12 +21939,12 @@ h0.exports; var Ot = ne.get(c); if (Ot) return Ot; - ne.set(c, fe), Qw(c) ? c.forEach(function(Kt) { + ne.set(c, fe), e2(c) ? c.forEach(function(Kt) { fe.add(zi(Kt, h, y, Kt, c, ne)); - }) : Xw(c) && c.forEach(function(Kt, vr) { + }) : Zw(c) && c.forEach(function(Kt, vr) { fe.set(vr, zi(Kt, h, y, vr, c, ne)); }); - var Ht = We ? we ? gg : pg : we ? hi : Mn, fr = He ? r : Ht(c); + var Ht = We ? we ? gg : pg : we ? di : Mn, fr = He ? r : Ht(c); return ji(fr || c, function(Kt, vr) { fr && (vr = Kt, Kt = c[vr]), of(fe, vr, zi(Kt, h, y, vr, c, ne)); }), fe; @@ -21952,21 +21952,21 @@ h0.exports; function _P(c) { var h = Mn(c); return function(y) { - return ky(y, c, h); + return $y(y, c, h); }; } - function ky(c, h, y) { + function $y(c, h, y) { var O = y.length; if (c == null) return !O; for (c = qr(c); O--; ) { - var q = y[O], ne = h[q], fe = c[q]; - if (fe === r && !(q in c) || !ne(fe)) + var z = y[O], ne = h[z], fe = c[z]; + if (fe === r && !(z in c) || !ne(fe)) return !1; } return !0; } - function $y(c, h, y) { + function By(c, h, y) { if (typeof c != "function") throw new Ui(o); return df(function() { @@ -21974,13 +21974,13 @@ h0.exports; }, h); } function af(c, h, y, O) { - var q = -1, ne = vh, fe = !0, me = c.length, we = [], We = h.length; + var z = -1, ne = vh, fe = !0, me = c.length, we = [], We = h.length; if (!me) return we; y && (h = Xr(h, Pi(y))), O ? (ne = Lp, fe = !1) : h.length >= i && (ne = Qu, fe = !1, h = new ka(h)); e: - for (; ++q < me; ) { - var He = c[q], Xe = y == null ? He : y(He); + for (; ++z < me; ) { + var He = c[z], Xe = y == null ? He : y(He); if (He = O || He !== 0 ? He : 0, fe && Xe === Xe) { for (var wt = We; wt--; ) if (h[wt] === Xe) @@ -21990,15 +21990,15 @@ h0.exports; } return we; } - var Go = fw(Cs), By = fw(Xp, !0); + var Go = lw(Cs), Fy = lw(Xp, !0); function EP(c, h) { var y = !0; - return Go(c, function(O, q, ne) { - return y = !!h(O, q, ne), y; + return Go(c, function(O, z, ne) { + return y = !!h(O, z, ne), y; }), y; } function Lh(c, h, y) { - for (var O = -1, q = c.length; ++O < q; ) { + for (var O = -1, z = c.length; ++O < z; ) { var ne = c[O], fe = h(ne); if (fe != null && (me === r ? fe === fe && !Ii(fe) : y(fe, me))) var me = fe, we = ne; @@ -22006,31 +22006,31 @@ h0.exports; return we; } function SP(c, h, y, O) { - var q = c.length; - for (y = cr(y), y < 0 && (y = -y > q ? 0 : q + y), O = O === r || O > q ? q : cr(O), O < 0 && (O += q), O = y > O ? 0 : t2(O); y < O; ) + var z = c.length; + for (y = cr(y), y < 0 && (y = -y > z ? 0 : z + y), O = O === r || O > z ? z : cr(O), O < 0 && (O += z), O = y > O ? 0 : r2(O); y < O; ) c[y++] = h; return c; } - function Fy(c, h) { + function jy(c, h) { var y = []; - return Go(c, function(O, q, ne) { - h(O, q, ne) && y.push(O); + return Go(c, function(O, z, ne) { + h(O, z, ne) && y.push(O); }), y; } - function Bn(c, h, y, O, q) { + function Bn(c, h, y, O, z) { var ne = -1, fe = c.length; - for (y || (y = hM), q || (q = []); ++ne < fe; ) { + for (y || (y = hM), z || (z = []); ++ne < fe; ) { var me = c[ne]; - h > 0 && y(me) ? h > 1 ? Bn(me, h - 1, y, O, q) : Ho(q, me) : O || (q[q.length] = me); + h > 0 && y(me) ? h > 1 ? Bn(me, h - 1, y, O, z) : Ho(z, me) : O || (z[z.length] = me); } - return q; + return z; } - var Jp = lw(), jy = lw(!0); + var Jp = hw(), Uy = hw(!0); function Cs(c, h) { return c && Jp(c, h, Mn); } function Xp(c, h) { - return c && jy(c, h, Mn); + return c && Uy(c, h, Mn); } function kh(c, h) { return Wo(h, function(y) { @@ -22043,7 +22043,7 @@ h0.exports; c = c[Rs(h[y++])]; return y && y == O ? c : r; } - function Uy(c, h, y) { + function qy(c, h, y) { var O = h(c); return ir(c) ? O : Ho(O, y(c)); } @@ -22063,14 +22063,14 @@ h0.exports; return c >= Kn(h, y) && c < _n(h, y); } function Qp(c, h, y) { - for (var O = y ? Lp : vh, q = c[0].length, ne = c.length, fe = ne, me = Ie(ne), we = 1 / 0, We = []; fe--; ) { + for (var O = y ? Lp : vh, z = c[0].length, ne = c.length, fe = ne, me = Ie(ne), we = 1 / 0, We = []; fe--; ) { var He = c[fe]; - fe && h && (He = Xr(He, Pi(h))), we = Kn(He.length, we), me[fe] = !y && (h || q >= 120 && He.length >= 120) ? new ka(fe && He) : r; + fe && h && (He = Xr(He, Pi(h))), we = Kn(He.length, we), me[fe] = !y && (h || z >= 120 && He.length >= 120) ? new ka(fe && He) : r; } He = c[0]; var Xe = -1, wt = me[0]; e: - for (; ++Xe < q && We.length < we; ) { + for (; ++Xe < z && We.length < we; ) { var Ot = He[Xe], Ht = h ? h(Ot) : Ot; if (Ot = y || Ot !== 0 ? Ot : 0, !(wt ? Qu(wt, Ht) : O(We, Ht, y))) { for (fe = ne; --fe; ) { @@ -22084,16 +22084,16 @@ h0.exports; return We; } function IP(c, h, y, O) { - return Cs(c, function(q, ne, fe) { - h(O, y(q), ne, fe); + return Cs(c, function(z, ne, fe) { + h(O, y(z), ne, fe); }), O; } function cf(c, h, y) { - h = Jo(h, c), c = Iw(c, h); + h = Jo(h, c), c = Cw(c, h); var O = c == null ? c : c[Rs(Hi(h))]; return O == null ? r : Pn(O, c, y); } - function qy(c) { + function zy(c) { return en(c) && ri(c) == D; } function CP(c) { @@ -22102,10 +22102,10 @@ h0.exports; function TP(c) { return en(c) && ri(c) == Q; } - function uf(c, h, y, O, q) { - return c === h ? !0 : c == null || h == null || !en(c) && !en(h) ? c !== c && h !== h : RP(c, h, y, O, uf, q); + function uf(c, h, y, O, z) { + return c === h ? !0 : c == null || h == null || !en(c) && !en(h) ? c !== c && h !== h : RP(c, h, y, O, uf, z); } - function RP(c, h, y, O, q, ne) { + function RP(c, h, y, O, z, ne) { var fe = ir(c), me = ir(h), we = fe ? oe : Vn(c), We = me ? oe : Vn(h); we = we == D ? Pe : we, We = We == D ? Pe : We; var He = we == Pe, Xe = We == Pe, wt = we == We; @@ -22115,30 +22115,30 @@ h0.exports; fe = !0, He = !1; } if (wt && !He) - return ne || (ne = new hs()), fe || jc(c) ? xw(c, h, y, O, q, ne) : iM(c, h, we, y, O, q, ne); + return ne || (ne = new hs()), fe || jc(c) ? _w(c, h, y, O, z, ne) : iM(c, h, we, y, O, z, ne); if (!(y & M)) { var Ot = He && Tr.call(c, "__wrapped__"), Ht = Xe && Tr.call(h, "__wrapped__"); if (Ot || Ht) { var fr = Ot ? c.value() : c, Kt = Ht ? h.value() : h; - return ne || (ne = new hs()), q(fr, Kt, y, O, ne); + return ne || (ne = new hs()), z(fr, Kt, y, O, ne); } } - return wt ? (ne || (ne = new hs()), sM(c, h, y, O, q, ne)) : !1; + return wt ? (ne || (ne = new hs()), sM(c, h, y, O, z, ne)) : !1; } function DP(c) { return en(c) && Vn(c) == ie; } function eg(c, h, y, O) { - var q = y.length, ne = q, fe = !O; + var z = y.length, ne = z, fe = !O; if (c == null) return !ne; - for (c = qr(c); q--; ) { - var me = y[q]; + for (c = qr(c); z--; ) { + var me = y[z]; if (fe && me[2] ? me[1] !== c[me[0]] : !(me[0] in c)) return !1; } - for (; ++q < ne; ) { - me = y[q]; + for (; ++z < ne; ) { + me = y[z]; var we = me[0], We = c[we], He = me[1]; if (fe && me[2]) { if (We === r && !(we in c)) @@ -22153,7 +22153,7 @@ h0.exports; } return !0; } - function zy(c) { + function Wy(c) { if (!Zr(c) || pM(c)) return !1; var h = lo(c) ? DA : je; @@ -22168,8 +22168,8 @@ h0.exports; function LP(c) { return en(c) && Qh(c.length) && !!Fr[ri(c)]; } - function Wy(c) { - return typeof c == "function" ? c : c == null ? di : typeof c == "object" ? ir(c) ? Vy(c[0], c[1]) : Ky(c) : h2(c); + function Hy(c) { + return typeof c == "function" ? c : c == null ? pi : typeof c == "object" ? ir(c) ? Gy(c[0], c[1]) : Vy(c) : d2(c); } function tg(c) { if (!hf(c)) @@ -22190,35 +22190,35 @@ h0.exports; function rg(c, h) { return c < h; } - function Hy(c, h) { - var y = -1, O = li(c) ? Ie(c.length) : []; - return Go(c, function(q, ne, fe) { - O[++y] = h(q, ne, fe); + function Ky(c, h) { + var y = -1, O = hi(c) ? Ie(c.length) : []; + return Go(c, function(z, ne, fe) { + O[++y] = h(z, ne, fe); }), O; } - function Ky(c) { + function Vy(c) { var h = vg(c); - return h.length == 1 && h[0][2] ? Pw(h[0][0], h[0][1]) : function(y) { + return h.length == 1 && h[0][2] ? Mw(h[0][0], h[0][1]) : function(y) { return y === c || eg(y, c, h); }; } - function Vy(c, h) { - return yg(c) && Aw(h) ? Pw(Rs(c), h) : function(y) { + function Gy(c, h) { + return yg(c) && Pw(h) ? Mw(Rs(c), h) : function(y) { var O = Cg(y, c); return O === r && O === h ? Tg(y, c) : uf(h, O, M | N); }; } - function $h(c, h, y, O, q) { + function $h(c, h, y, O, z) { c !== h && Jp(h, function(ne, fe) { - if (q || (q = new hs()), Zr(ne)) - $P(c, h, fe, y, $h, O, q); + if (z || (z = new hs()), Zr(ne)) + $P(c, h, fe, y, $h, O, z); else { - var me = O ? O(xg(c, fe), ne, fe + "", c, h, q) : r; + var me = O ? O(xg(c, fe), ne, fe + "", c, h, z) : r; me === r && (me = ne), Gp(c, fe, me); } - }, hi); + }, di); } - function $P(c, h, y, O, q, ne, fe) { + function $P(c, h, y, O, z, ne, fe) { var me = xg(c, y), we = xg(h, y), We = fe.get(we); if (We) { Gp(c, y, We); @@ -22227,40 +22227,40 @@ h0.exports; var He = ne ? ne(me, we, y + "", c, h, fe) : r, Xe = He === r; if (Xe) { var wt = ir(we), Ot = !wt && Zo(we), Ht = !wt && !Ot && jc(we); - He = we, wt || Ot || Ht ? ir(me) ? He = me : cn(me) ? He = fi(me) : Ot ? (Xe = !1, He = sw(we, !0)) : Ht ? (Xe = !1, He = ow(we, !0)) : He = [] : pf(we) || Ua(we) ? (He = me, Ua(me) ? He = r2(me) : (!Zr(me) || lo(me)) && (He = Sw(we))) : Xe = !1; + He = we, wt || Ot || Ht ? ir(me) ? He = me : cn(me) ? He = li(me) : Ot ? (Xe = !1, He = ow(we, !0)) : Ht ? (Xe = !1, He = aw(we, !0)) : He = [] : pf(we) || Ua(we) ? (He = me, Ua(me) ? He = n2(me) : (!Zr(me) || lo(me)) && (He = Aw(we))) : Xe = !1; } - Xe && (fe.set(we, He), q(He, we, O, ne, fe), fe.delete(we)), Gp(c, y, He); + Xe && (fe.set(we, He), z(He, we, O, ne, fe), fe.delete(we)), Gp(c, y, He); } - function Gy(c, h) { + function Yy(c, h) { var y = c.length; if (y) return h += h < 0 ? y : 0, fo(h, y) ? c[h] : r; } - function Yy(c, h, y) { + function Jy(c, h, y) { h.length ? h = Xr(h, function(ne) { return ir(ne) ? function(fe) { return Ba(fe, ne.length === 1 ? ne[0] : ne); } : ne; - }) : h = [di]; + }) : h = [pi]; var O = -1; h = Xr(h, Pi(Ut())); - var q = Hy(c, function(ne, fe, me) { + var z = Ky(c, function(ne, fe, me) { var we = Xr(h, function(We) { return We(ne); }); return { criteria: we, index: ++O, value: ne }; }); - return fA(q, function(ne, fe) { + return fA(z, function(ne, fe) { return JP(ne, fe, y); }); } function BP(c, h) { - return Jy(c, h, function(y, O) { + return Xy(c, h, function(y, O) { return Tg(c, O); }); } - function Jy(c, h, y) { - for (var O = -1, q = h.length, ne = {}; ++O < q; ) { + function Xy(c, h, y) { + for (var O = -1, z = h.length, ne = {}; ++O < z; ) { var fe = h[O], me = Ba(c, fe); y(me, fe) && ff(ne, Jo(fe, c), me); } @@ -22272,28 +22272,28 @@ h0.exports; }; } function ng(c, h, y, O) { - var q = O ? uA : Cc, ne = -1, fe = h.length, me = c; - for (c === h && (h = fi(h)), y && (me = Xr(c, Pi(y))); ++ne < fe; ) - for (var we = 0, We = h[ne], He = y ? y(We) : We; (we = q(me, He, we, O)) > -1; ) + var z = O ? uA : Cc, ne = -1, fe = h.length, me = c; + for (c === h && (h = li(h)), y && (me = Xr(c, Pi(y))); ++ne < fe; ) + for (var we = 0, We = h[ne], He = y ? y(We) : We; (we = z(me, He, we, O)) > -1; ) me !== c && Mh.call(me, we, 1), Mh.call(c, we, 1); return c; } - function Xy(c, h) { + function Zy(c, h) { for (var y = c ? h.length : 0, O = y - 1; y--; ) { - var q = h[y]; - if (y == O || q !== ne) { - var ne = q; - fo(q) ? Mh.call(c, q, 1) : ag(c, q); + var z = h[y]; + if (y == O || z !== ne) { + var ne = z; + fo(z) ? Mh.call(c, z, 1) : ag(c, z); } } return c; } function ig(c, h) { - return c + Th(Ry() * (h - c + 1)); + return c + Th(Dy() * (h - c + 1)); } function jP(c, h, y, O) { - for (var q = -1, ne = _n(Ch((h - c) / (y || 1)), 0), fe = Ie(ne); ne--; ) - fe[O ? ne : ++q] = c, c += y; + for (var z = -1, ne = _n(Ch((h - c) / (y || 1)), 0), fe = Ie(ne); ne--; ) + fe[O ? ne : ++z] = c, c += y; return fe; } function sg(c, h) { @@ -22306,10 +22306,10 @@ h0.exports; return y; } function hr(c, h) { - return _g(Mw(c, h, di), c + ""); + return _g(Iw(c, h, pi), c + ""); } function UP(c) { - return Ny(Uc(c)); + return Ly(Uc(c)); } function qP(c, h) { var y = Uc(c); @@ -22319,80 +22319,80 @@ h0.exports; if (!Zr(c)) return c; h = Jo(h, c); - for (var q = -1, ne = h.length, fe = ne - 1, me = c; me != null && ++q < ne; ) { - var we = Rs(h[q]), We = y; + for (var z = -1, ne = h.length, fe = ne - 1, me = c; me != null && ++z < ne; ) { + var we = Rs(h[z]), We = y; if (we === "__proto__" || we === "constructor" || we === "prototype") return c; - if (q != fe) { + if (z != fe) { var He = me[we]; - We = O ? O(He, we, me) : r, We === r && (We = Zr(He) ? He : fo(h[q + 1]) ? [] : {}); + We = O ? O(He, we, me) : r, We === r && (We = Zr(He) ? He : fo(h[z + 1]) ? [] : {}); } of(me, we, We), me = me[we]; } return c; } - var Zy = Rh ? function(c, h) { + var Qy = Rh ? function(c, h) { return Rh.set(c, h), c; - } : di, zP = Ih ? function(c, h) { + } : pi, zP = Ih ? function(c, h) { return Ih(c, "toString", { configurable: !0, enumerable: !1, value: Dg(h), writable: !0 }); - } : di; + } : pi; function WP(c) { return Vh(Uc(c)); } function Wi(c, h, y) { - var O = -1, q = c.length; - h < 0 && (h = -h > q ? 0 : q + h), y = y > q ? q : y, y < 0 && (y += q), q = h > y ? 0 : y - h >>> 0, h >>>= 0; - for (var ne = Ie(q); ++O < q; ) + var O = -1, z = c.length; + h < 0 && (h = -h > z ? 0 : z + h), y = y > z ? z : y, y < 0 && (y += z), z = h > y ? 0 : y - h >>> 0, h >>>= 0; + for (var ne = Ie(z); ++O < z; ) ne[O] = c[O + h]; return ne; } function HP(c, h) { var y; - return Go(c, function(O, q, ne) { - return y = h(O, q, ne), !y; + return Go(c, function(O, z, ne) { + return y = h(O, z, ne), !y; }), !!y; } function Bh(c, h, y) { - var O = 0, q = c == null ? O : c.length; - if (typeof h == "number" && h === h && q <= F) { - for (; O < q; ) { - var ne = O + q >>> 1, fe = c[ne]; - fe !== null && !Ii(fe) && (y ? fe <= h : fe < h) ? O = ne + 1 : q = ne; + var O = 0, z = c == null ? O : c.length; + if (typeof h == "number" && h === h && z <= F) { + for (; O < z; ) { + var ne = O + z >>> 1, fe = c[ne]; + fe !== null && !Ii(fe) && (y ? fe <= h : fe < h) ? O = ne + 1 : z = ne; } - return q; + return z; } - return og(c, h, di, y); + return og(c, h, pi, y); } function og(c, h, y, O) { - var q = 0, ne = c == null ? 0 : c.length; + var z = 0, ne = c == null ? 0 : c.length; if (ne === 0) return 0; h = y(h); - for (var fe = h !== h, me = h === null, we = Ii(h), We = h === r; q < ne; ) { - var He = Th((q + ne) / 2), Xe = y(c[He]), wt = Xe !== r, Ot = Xe === null, Ht = Xe === Xe, fr = Ii(Xe); + for (var fe = h !== h, me = h === null, we = Ii(h), We = h === r; z < ne; ) { + var He = Th((z + ne) / 2), Xe = y(c[He]), wt = Xe !== r, Ot = Xe === null, Ht = Xe === Xe, fr = Ii(Xe); if (fe) var Kt = O || Ht; else We ? Kt = Ht && (O || wt) : me ? Kt = Ht && wt && (O || !Ot) : we ? Kt = Ht && wt && !Ot && (O || !fr) : Ot || fr ? Kt = !1 : Kt = O ? Xe <= h : Xe < h; - Kt ? q = He + 1 : ne = He; + Kt ? z = He + 1 : ne = He; } return Kn(ne, I); } - function Qy(c, h) { - for (var y = -1, O = c.length, q = 0, ne = []; ++y < O; ) { + function ew(c, h) { + for (var y = -1, O = c.length, z = 0, ne = []; ++y < O; ) { var fe = c[y], me = h ? h(fe) : fe; if (!y || !ds(me, we)) { var we = me; - ne[q++] = fe === 0 ? 0 : fe; + ne[z++] = fe === 0 ? 0 : fe; } } return ne; } - function ew(c) { + function tw(c) { return typeof c == "number" ? c : Ii(c) ? v : +c; } function Mi(c) { @@ -22401,19 +22401,19 @@ h0.exports; if (ir(c)) return Xr(c, Mi) + ""; if (Ii(c)) - return Dy ? Dy.call(c) : ""; + return Oy ? Oy.call(c) : ""; var h = c + ""; return h == "0" && 1 / c == -x ? "-0" : h; } function Yo(c, h, y) { - var O = -1, q = vh, ne = c.length, fe = !0, me = [], we = me; + var O = -1, z = vh, ne = c.length, fe = !0, me = [], we = me; if (y) - fe = !1, q = Lp; + fe = !1, z = Lp; else if (ne >= i) { var We = h ? null : rM(c); if (We) return yh(We); - fe = !1, q = Qu, we = new ka(); + fe = !1, z = Qu, we = new ka(); } else we = h ? [] : me; e: @@ -22424,38 +22424,38 @@ h0.exports; if (we[wt] === Xe) continue e; h && we.push(Xe), me.push(He); - } else q(we, Xe, y) || (we !== me && we.push(Xe), me.push(He)); + } else z(we, Xe, y) || (we !== me && we.push(Xe), me.push(He)); } return me; } function ag(c, h) { - return h = Jo(h, c), c = Iw(c, h), c == null || delete c[Rs(Hi(h))]; + return h = Jo(h, c), c = Cw(c, h), c == null || delete c[Rs(Hi(h))]; } - function tw(c, h, y, O) { + function rw(c, h, y, O) { return ff(c, h, y(Ba(c, h)), O); } function Fh(c, h, y, O) { - for (var q = c.length, ne = O ? q : -1; (O ? ne-- : ++ne < q) && h(c[ne], ne, c); ) + for (var z = c.length, ne = O ? z : -1; (O ? ne-- : ++ne < z) && h(c[ne], ne, c); ) ; - return y ? Wi(c, O ? 0 : ne, O ? ne + 1 : q) : Wi(c, O ? ne + 1 : 0, O ? q : ne); + return y ? Wi(c, O ? 0 : ne, O ? ne + 1 : z) : Wi(c, O ? ne + 1 : 0, O ? z : ne); } - function rw(c, h) { + function nw(c, h) { var y = c; - return y instanceof wr && (y = y.value()), kp(h, function(O, q) { - return q.func.apply(q.thisArg, Ho([O], q.args)); + return y instanceof wr && (y = y.value()), kp(h, function(O, z) { + return z.func.apply(z.thisArg, Ho([O], z.args)); }, y); } function cg(c, h, y) { var O = c.length; if (O < 2) return O ? Yo(c[0]) : []; - for (var q = -1, ne = Ie(O); ++q < O; ) - for (var fe = c[q], me = -1; ++me < O; ) - me != q && (ne[q] = af(ne[q] || fe, c[me], h, y)); + for (var z = -1, ne = Ie(O); ++z < O; ) + for (var fe = c[z], me = -1; ++me < O; ) + me != z && (ne[z] = af(ne[z] || fe, c[me], h, y)); return Yo(Bn(ne, 1), h, y); } - function nw(c, h, y) { - for (var O = -1, q = c.length, ne = h.length, fe = {}; ++O < q; ) { + function iw(c, h, y) { + for (var O = -1, z = c.length, ne = h.length, fe = {}; ++O < z; ) { var me = O < ne ? h[O] : r; y(fe, c[O], me); } @@ -22465,23 +22465,23 @@ h0.exports; return cn(c) ? c : []; } function fg(c) { - return typeof c == "function" ? c : di; + return typeof c == "function" ? c : pi; } function Jo(c, h) { - return ir(c) ? c : yg(c, h) ? [c] : Dw(Cr(c)); + return ir(c) ? c : yg(c, h) ? [c] : Ow(Cr(c)); } var KP = hr; function Xo(c, h, y) { var O = c.length; return y = y === r ? O : y, !h && y >= O ? c : Wi(c, h, y); } - var iw = OA || function(c) { + var sw = OA || function(c) { return _r.clearTimeout(c); }; - function sw(c, h) { + function ow(c, h) { if (h) return c.slice(); - var y = c.length, O = Py ? Py(y) : new c.constructor(y); + var y = c.length, O = My ? My(y) : new c.constructor(y); return c.copy(O), O; } function lg(c) { @@ -22499,23 +22499,23 @@ h0.exports; function YP(c) { return sf ? qr(sf.call(c)) : {}; } - function ow(c, h) { + function aw(c, h) { var y = h ? lg(c.buffer) : c.buffer; return new c.constructor(y, c.byteOffset, c.length); } - function aw(c, h) { + function cw(c, h) { if (c !== h) { - var y = c !== r, O = c === null, q = c === c, ne = Ii(c), fe = h !== r, me = h === null, we = h === h, We = Ii(h); - if (!me && !We && !ne && c > h || ne && fe && we && !me && !We || O && fe && we || !y && we || !q) + var y = c !== r, O = c === null, z = c === c, ne = Ii(c), fe = h !== r, me = h === null, we = h === h, We = Ii(h); + if (!me && !We && !ne && c > h || ne && fe && we && !me && !We || O && fe && we || !y && we || !z) return 1; - if (!O && !ne && !We && c < h || We && y && q && !O && !ne || me && y && q || !fe && q || !we) + if (!O && !ne && !We && c < h || We && y && z && !O && !ne || me && y && z || !fe && z || !we) return -1; } return 0; } function JP(c, h, y) { - for (var O = -1, q = c.criteria, ne = h.criteria, fe = q.length, me = y.length; ++O < fe; ) { - var we = aw(q[O], ne[O]); + for (var O = -1, z = c.criteria, ne = h.criteria, fe = z.length, me = y.length; ++O < fe; ) { + var we = cw(z[O], ne[O]); if (we) { if (O >= me) return we; @@ -22525,36 +22525,36 @@ h0.exports; } return c.index - h.index; } - function cw(c, h, y, O) { - for (var q = -1, ne = c.length, fe = y.length, me = -1, we = h.length, We = _n(ne - fe, 0), He = Ie(we + We), Xe = !O; ++me < we; ) + function uw(c, h, y, O) { + for (var z = -1, ne = c.length, fe = y.length, me = -1, we = h.length, We = _n(ne - fe, 0), He = Ie(we + We), Xe = !O; ++me < we; ) He[me] = h[me]; - for (; ++q < fe; ) - (Xe || q < ne) && (He[y[q]] = c[q]); + for (; ++z < fe; ) + (Xe || z < ne) && (He[y[z]] = c[z]); for (; We--; ) - He[me++] = c[q++]; + He[me++] = c[z++]; return He; } - function uw(c, h, y, O) { - for (var q = -1, ne = c.length, fe = -1, me = y.length, we = -1, We = h.length, He = _n(ne - me, 0), Xe = Ie(He + We), wt = !O; ++q < He; ) - Xe[q] = c[q]; - for (var Ot = q; ++we < We; ) + function fw(c, h, y, O) { + for (var z = -1, ne = c.length, fe = -1, me = y.length, we = -1, We = h.length, He = _n(ne - me, 0), Xe = Ie(He + We), wt = !O; ++z < He; ) + Xe[z] = c[z]; + for (var Ot = z; ++we < We; ) Xe[Ot + we] = h[we]; for (; ++fe < me; ) - (wt || q < ne) && (Xe[Ot + y[fe]] = c[q++]); + (wt || z < ne) && (Xe[Ot + y[fe]] = c[z++]); return Xe; } - function fi(c, h) { + function li(c, h) { var y = -1, O = c.length; for (h || (h = Ie(O)); ++y < O; ) h[y] = c[y]; return h; } function Ts(c, h, y, O) { - var q = !y; + var z = !y; y || (y = {}); for (var ne = -1, fe = h.length; ++ne < fe; ) { var me = h[ne], we = O ? O(y[me], c[me], me, y, c) : r; - we === r && (we = c[me]), q ? ao(y, me, we) : of(y, me, we); + we === r && (we = c[me]), z ? ao(y, me, we) : of(y, me, we); } return y; } @@ -22562,39 +22562,39 @@ h0.exports; return Ts(c, bg(c), h); } function ZP(c, h) { - return Ts(c, _w(c), h); + return Ts(c, Ew(c), h); } function jh(c, h) { return function(y, O) { - var q = ir(y) ? nA : wP, ne = h ? h() : {}; - return q(y, c, Ut(O, 2), ne); + var z = ir(y) ? nA : wP, ne = h ? h() : {}; + return z(y, c, Ut(O, 2), ne); }; } function $c(c) { return hr(function(h, y) { - var O = -1, q = y.length, ne = q > 1 ? y[q - 1] : r, fe = q > 2 ? y[2] : r; - for (ne = c.length > 3 && typeof ne == "function" ? (q--, ne) : r, fe && ni(y[0], y[1], fe) && (ne = q < 3 ? r : ne, q = 1), h = qr(h); ++O < q; ) { + var O = -1, z = y.length, ne = z > 1 ? y[z - 1] : r, fe = z > 2 ? y[2] : r; + for (ne = c.length > 3 && typeof ne == "function" ? (z--, ne) : r, fe && ni(y[0], y[1], fe) && (ne = z < 3 ? r : ne, z = 1), h = qr(h); ++O < z; ) { var me = y[O]; me && c(h, me, O, ne); } return h; }); } - function fw(c, h) { + function lw(c, h) { return function(y, O) { if (y == null) return y; - if (!li(y)) + if (!hi(y)) return c(y, O); - for (var q = y.length, ne = h ? q : -1, fe = qr(y); (h ? ne-- : ++ne < q) && O(fe[ne], ne, fe) !== !1; ) + for (var z = y.length, ne = h ? z : -1, fe = qr(y); (h ? ne-- : ++ne < z) && O(fe[ne], ne, fe) !== !1; ) ; return y; }; } - function lw(c) { + function hw(c) { return function(h, y, O) { - for (var q = -1, ne = qr(h), fe = O(h), me = fe.length; me--; ) { - var we = fe[c ? me : ++q]; + for (var z = -1, ne = qr(h), fe = O(h), me = fe.length; me--; ) { + var we = fe[c ? me : ++z]; if (y(ne[we], we, ne) === !1) break; } @@ -22602,23 +22602,23 @@ h0.exports; }; } function QP(c, h, y) { - var O = h & L, q = lf(c); + var O = h & L, z = lf(c); function ne() { - var fe = this && this !== _r && this instanceof ne ? q : c; + var fe = this && this !== _r && this instanceof ne ? z : c; return fe.apply(O ? y : this, arguments); } return ne; } - function hw(c) { + function dw(c) { return function(h) { h = Cr(h); - var y = Tc(h) ? ls(h) : r, O = y ? y[0] : h.charAt(0), q = y ? Xo(y, 1).join("") : h.slice(1); - return O[c]() + q; + var y = Tc(h) ? ls(h) : r, O = y ? y[0] : h.charAt(0), z = y ? Xo(y, 1).join("") : h.slice(1); + return O[c]() + z; }; } function Bc(c) { return function(h) { - return kp(f2(u2(h).replace(Xu, "")), c, ""); + return kp(l2(f2(h).replace(Xu, "")), c, ""); }; } function lf(c) { @@ -22648,16 +22648,16 @@ h0.exports; } function eM(c, h, y) { var O = lf(c); - function q() { - for (var ne = arguments.length, fe = Ie(ne), me = ne, we = Fc(q); me--; ) + function z() { + for (var ne = arguments.length, fe = Ie(ne), me = ne, we = Fc(z); me--; ) fe[me] = arguments[me]; var We = ne < 3 && fe[0] !== we && fe[ne - 1] !== we ? [] : Ko(fe, we); if (ne -= We.length, ne < y) - return vw( + return bw( c, h, Uh, - q.placeholder, + z.placeholder, r, fe, We, @@ -22665,32 +22665,32 @@ h0.exports; r, y - ne ); - var He = this && this !== _r && this instanceof q ? O : c; + var He = this && this !== _r && this instanceof z ? O : c; return Pn(He, this, fe); } - return q; + return z; } - function dw(c) { + function pw(c) { return function(h, y, O) { - var q = qr(h); - if (!li(h)) { + var z = qr(h); + if (!hi(h)) { var ne = Ut(y, 3); h = Mn(h), y = function(me) { - return ne(q[me], me, q); + return ne(z[me], me, z); }; } var fe = c(h, y, O); - return fe > -1 ? q[ne ? h[fe] : fe] : r; + return fe > -1 ? z[ne ? h[fe] : fe] : r; }; } - function pw(c) { + function gw(c) { return uo(function(h) { - var y = h.length, O = y, q = qi.prototype.thru; + var y = h.length, O = y, z = qi.prototype.thru; for (c && h.reverse(); O--; ) { var ne = h[O]; if (typeof ne != "function") throw new Ui(o); - if (q && !fe && Hh(ne) == "wrapper") + if (z && !fe && Hh(ne) == "wrapper") var fe = new qi([], !0); } for (O = fe ? O : y; ++O < y; ) { @@ -22708,16 +22708,16 @@ h0.exports; }; }); } - function Uh(c, h, y, O, q, ne, fe, me, we, We) { - var He = h & R, Xe = h & L, wt = h & B, Ot = h & (H | W), Ht = h & ge, fr = wt ? r : lf(c); + function Uh(c, h, y, O, z, ne, fe, me, we, We) { + var He = h & R, Xe = h & L, wt = h & $, Ot = h & (H | U), Ht = h & ge, fr = wt ? r : lf(c); function Kt() { for (var vr = arguments.length, Er = Ie(vr), Ci = vr; Ci--; ) Er[Ci] = arguments[Ci]; if (Ot) var ii = Fc(Kt), Ti = hA(Er, ii); - if (O && (Er = cw(Er, O, q, Ot)), ne && (Er = uw(Er, ne, fe, Ot)), vr -= Ti, Ot && vr < We) { + if (O && (Er = uw(Er, O, z, Ot)), ne && (Er = fw(Er, ne, fe, Ot)), vr -= Ti, Ot && vr < We) { var un = Ko(Er, ii); - return vw( + return bw( c, h, Uh, @@ -22735,30 +22735,30 @@ h0.exports; } return Kt; } - function gw(c, h) { + function mw(c, h) { return function(y, O) { return IP(y, c, h(O), {}); }; } function qh(c, h) { return function(y, O) { - var q; + var z; if (y === r && O === r) return h; - if (y !== r && (q = y), O !== r) { - if (q === r) + if (y !== r && (z = y), O !== r) { + if (z === r) return O; - typeof y == "string" || typeof O == "string" ? (y = Mi(y), O = Mi(O)) : (y = ew(y), O = ew(O)), q = c(y, O); + typeof y == "string" || typeof O == "string" ? (y = Mi(y), O = Mi(O)) : (y = tw(y), O = tw(O)), z = c(y, O); } - return q; + return z; }; } function hg(c) { return uo(function(h) { return h = Xr(h, Pi(Ut())), hr(function(y) { var O = this; - return c(h, function(q) { - return Pn(q, O, y); + return c(h, function(z) { + return Pn(z, O, y); }); }); }); @@ -22772,17 +22772,17 @@ h0.exports; return Tc(h) ? Xo(ls(O), 0, c).join("") : O.slice(0, c); } function tM(c, h, y, O) { - var q = h & L, ne = lf(c); + var z = h & L, ne = lf(c); function fe() { for (var me = -1, we = arguments.length, We = -1, He = O.length, Xe = Ie(He + we), wt = this && this !== _r && this instanceof fe ? ne : c; ++We < He; ) Xe[We] = O[We]; for (; we--; ) Xe[We++] = arguments[++me]; - return Pn(wt, q ? y : this, Xe); + return Pn(wt, z ? y : this, Xe); } return fe; } - function mw(c) { + function vw(c) { return function(h, y, O) { return O && typeof O != "number" && ni(h, y, O) && (y = O = r), h = ho(h), y === r ? (y = h, h = 0) : y = ho(y), O = O === r ? h < y ? 1 : -1 : ho(O), jP(h, y, O, c); }; @@ -22792,13 +22792,13 @@ h0.exports; return typeof h == "string" && typeof y == "string" || (h = Ki(h), y = Ki(y)), c(h, y); }; } - function vw(c, h, y, O, q, ne, fe, me, we, We) { + function bw(c, h, y, O, z, ne, fe, me, we, We) { var He = h & H, Xe = He ? fe : r, wt = He ? r : fe, Ot = He ? ne : r, Ht = He ? r : ne; - h |= He ? V : te, h &= ~(He ? te : V), h & $ || (h &= ~(L | B)); + h |= He ? V : te, h &= ~(He ? te : V), h & B || (h &= ~(L | $)); var fr = [ c, h, - q, + z, Ot, Xe, Ht, @@ -22807,14 +22807,14 @@ h0.exports; we, We ], Kt = y.apply(r, fr); - return wg(c) && Cw(Kt, fr), Kt.placeholder = O, Tw(Kt, c, h); + return wg(c) && Tw(Kt, fr), Kt.placeholder = O, Rw(Kt, c, h); } function dg(c) { var h = xn[c]; return function(y, O) { - if (y = Ki(y), O = O == null ? 0 : Kn(cr(O), 292), O && Ty(y)) { - var q = (Cr(y) + "e").split("e"), ne = h(q[0] + "e" + (+q[1] + O)); - return q = (Cr(ne) + "e").split("e"), +(q[0] + "e" + (+q[1] - O)); + if (y = Ki(y), O = O == null ? 0 : Kn(cr(O), 292), O && Ry(y)) { + var z = (Cr(y) + "e").split("e"), ne = h(z[0] + "e" + (+z[1] + O)); + return z = (Cr(ne) + "e").split("e"), +(z[0] + "e" + (+z[1] - O)); } return h(y); }; @@ -22822,49 +22822,49 @@ h0.exports; var rM = Nc && 1 / yh(new Nc([, -0]))[1] == x ? function(c) { return new Nc(c); } : Lg; - function bw(c) { + function yw(c) { return function(h) { var y = Vn(h); return y == ie ? zp(h) : y == Me ? yA(h) : lA(h, c(h)); }; } - function co(c, h, y, O, q, ne, fe, me) { - var we = h & B; + function co(c, h, y, O, z, ne, fe, me) { + var we = h & $; if (!we && typeof c != "function") throw new Ui(o); var We = O ? O.length : 0; - if (We || (h &= ~(V | te), O = q = r), fe = fe === r ? fe : _n(cr(fe), 0), me = me === r ? me : cr(me), We -= q ? q.length : 0, h & te) { - var He = O, Xe = q; - O = q = r; + if (We || (h &= ~(V | te), O = z = r), fe = fe === r ? fe : _n(cr(fe), 0), me = me === r ? me : cr(me), We -= z ? z.length : 0, h & te) { + var He = O, Xe = z; + O = z = r; } var wt = we ? r : mg(c), Ot = [ c, h, y, O, - q, + z, He, Xe, ne, fe, me ]; - if (wt && vM(Ot, wt), c = Ot[0], h = Ot[1], y = Ot[2], O = Ot[3], q = Ot[4], me = Ot[9] = Ot[9] === r ? we ? 0 : c.length : _n(Ot[9] - We, 0), !me && h & (H | W) && (h &= ~(H | W)), !h || h == L) + if (wt && vM(Ot, wt), c = Ot[0], h = Ot[1], y = Ot[2], O = Ot[3], z = Ot[4], me = Ot[9] = Ot[9] === r ? we ? 0 : c.length : _n(Ot[9] - We, 0), !me && h & (H | U) && (h &= ~(H | U)), !h || h == L) var Ht = QP(c, h, y); - else h == H || h == W ? Ht = eM(c, h, me) : (h == V || h == (L | V)) && !q.length ? Ht = tM(c, h, y, O) : Ht = Uh.apply(r, Ot); - var fr = wt ? Zy : Cw; - return Tw(fr(Ht, Ot), c, h); + else h == H || h == U ? Ht = eM(c, h, me) : (h == V || h == (L | V)) && !z.length ? Ht = tM(c, h, y, O) : Ht = Uh.apply(r, Ot); + var fr = wt ? Qy : Tw; + return Rw(fr(Ht, Ot), c, h); } - function yw(c, h, y, O) { + function ww(c, h, y, O) { return c === r || ds(c, Oc[y]) && !Tr.call(O, y) ? h : c; } - function ww(c, h, y, O, q, ne) { - return Zr(c) && Zr(h) && (ne.set(h, c), $h(c, h, r, ww, ne), ne.delete(h)), c; + function xw(c, h, y, O, z, ne) { + return Zr(c) && Zr(h) && (ne.set(h, c), $h(c, h, r, xw, ne), ne.delete(h)), c; } function nM(c) { return pf(c) ? r : c; } - function xw(c, h, y, O, q, ne) { + function _w(c, h, y, O, z, ne) { var fe = y & M, me = c.length, we = h.length; if (me != we && !(fe && we > me)) return !1; @@ -22884,20 +22884,20 @@ h0.exports; } if (Ot) { if (!$p(h, function(vr, Er) { - if (!Qu(Ot, Er) && (Ht === vr || q(Ht, vr, y, O, ne))) + if (!Qu(Ot, Er) && (Ht === vr || z(Ht, vr, y, O, ne))) return Ot.push(Er); })) { wt = !1; break; } - } else if (!(Ht === fr || q(Ht, fr, y, O, ne))) { + } else if (!(Ht === fr || z(Ht, fr, y, O, ne))) { wt = !1; break; } } return ne.delete(c), ne.delete(h), wt; } - function iM(c, h, y, O, q, ne, fe) { + function iM(c, h, y, O, z, ne, fe) { switch (y) { case Ze: if (c.byteLength != h.byteLength || c.byteOffset != h.byteOffset) @@ -22924,7 +22924,7 @@ h0.exports; if (We) return We == h; O |= N, fe.set(c, h); - var He = xw(me(c), me(h), O, q, ne, fe); + var He = _w(me(c), me(h), O, z, ne, fe); return fe.delete(c), He; case Ke: if (sf) @@ -22932,7 +22932,7 @@ h0.exports; } return !1; } - function sM(c, h, y, O, q, ne) { + function sM(c, h, y, O, z, ne) { var fe = y & M, me = pg(c), we = me.length, We = pg(h), He = We.length; if (we != He && !fe) return !1; @@ -22951,7 +22951,7 @@ h0.exports; var vr = c[wt], Er = h[wt]; if (O) var Ci = fe ? O(Er, vr, wt, h, c, ne) : O(vr, Er, wt, c, h, ne); - if (!(Ci === r ? vr === Er || q(vr, Er, y, O, ne) : Ci)) { + if (!(Ci === r ? vr === Er || z(vr, Er, y, O, ne) : Ci)) { fr = !1; break; } @@ -22964,22 +22964,22 @@ h0.exports; return ne.delete(c), ne.delete(h), fr; } function uo(c) { - return _g(Mw(c, r, kw), c + ""); + return _g(Iw(c, r, $w), c + ""); } function pg(c) { - return Uy(c, Mn, bg); + return qy(c, Mn, bg); } function gg(c) { - return Uy(c, hi, _w); + return qy(c, di, Ew); } var mg = Rh ? function(c) { return Rh.get(c); } : Lg; function Hh(c) { for (var h = c.name + "", y = Lc[h], O = Tr.call(Lc, h) ? y.length : 0; O--; ) { - var q = y[O], ne = q.func; + var z = y[O], ne = z.func; if (ne == null || ne == c) - return q.name; + return z.name; } return h; } @@ -22989,7 +22989,7 @@ h0.exports; } function Ut() { var c = ee.iteratee || Og; - return c = c === Og ? Wy : c, arguments.length ? c(arguments[0], arguments[1]) : c; + return c = c === Og ? Hy : c, arguments.length ? c(arguments[0], arguments[1]) : c; } function Kh(c, h) { var y = c.__data__; @@ -22997,14 +22997,14 @@ h0.exports; } function vg(c) { for (var h = Mn(c), y = h.length; y--; ) { - var O = h[y], q = c[O]; - h[y] = [O, q, Aw(q)]; + var O = h[y], z = c[O]; + h[y] = [O, z, Pw(z)]; } return h; } function Fa(c, h) { var y = mA(c, h); - return zy(y) ? y : r; + return Wy(y) ? y : r; } function oM(c) { var h = Tr.call(c, Na), y = c[Na]; @@ -23013,14 +23013,14 @@ h0.exports; var O = !0; } catch { } - var q = Eh.call(c); - return O && (h ? c[Na] = y : delete c[Na]), q; + var z = Eh.call(c); + return O && (h ? c[Na] = y : delete c[Na]), z; } var bg = Hp ? function(c) { return c == null ? [] : (c = qr(c), Wo(Hp(c), function(h) { - return Iy.call(c, h); + return Cy.call(c, h); })); - } : kg, _w = Hp ? function(c) { + } : kg, Ew = Hp ? function(c) { for (var h = []; c; ) Ho(h, bg(c)), c = Ph(c); return h; @@ -23043,7 +23043,7 @@ h0.exports; return h; }); function aM(c, h, y) { - for (var O = -1, q = y.length; ++O < q; ) { + for (var O = -1, z = y.length; ++O < z; ) { var ne = y[O], fe = ne.size; switch (ne.type) { case "drop": @@ -23066,21 +23066,21 @@ h0.exports; var h = c.match(C); return h ? h[1].split(G) : []; } - function Ew(c, h, y) { + function Sw(c, h, y) { h = Jo(h, c); - for (var O = -1, q = h.length, ne = !1; ++O < q; ) { + for (var O = -1, z = h.length, ne = !1; ++O < z; ) { var fe = Rs(h[O]); if (!(ne = c != null && y(c, fe))) break; c = c[fe]; } - return ne || ++O != q ? ne : (q = c == null ? 0 : c.length, !!q && Qh(q) && fo(fe, q) && (ir(c) || Ua(c))); + return ne || ++O != z ? ne : (z = c == null ? 0 : c.length, !!z && Qh(z) && fo(fe, z) && (ir(c) || Ua(c))); } function uM(c) { var h = c.length, y = new c.constructor(h); return h && typeof c[0] == "string" && Tr.call(c, "index") && (y.index = c.index, y.input = c.input), y; } - function Sw(c) { + function Aw(c) { return typeof c.constructor == "function" && !hf(c) ? kc(Ph(c)) : {}; } function fM(c, h, y) { @@ -23102,7 +23102,7 @@ h0.exports; case lt: case ct: case qt: - return ow(c, y); + return aw(c, y); case ie: return new O(); case ue: @@ -23121,12 +23121,12 @@ h0.exports; if (!y) return c; var O = y - 1; - return h[O] = (y > 1 ? "& " : "") + h[O], h = h.join(y > 2 ? ", " : " "), c.replace(z, `{ + return h[O] = (y > 1 ? "& " : "") + h[O], h = h.join(y > 2 ? ", " : " "), c.replace(W, `{ /* [wrapped with ` + h + `] */ `); } function hM(c) { - return ir(c) || Ua(c) || !!(Cy && c && c[Cy]); + return ir(c) || Ua(c) || !!(Ty && c && c[Ty]); } function fo(c, h) { var y = typeof c; @@ -23136,7 +23136,7 @@ h0.exports; if (!Zr(y)) return !1; var O = typeof h; - return (O == "number" ? li(y) && fo(h, y.length) : O == "string" && h in y) ? ds(y[h], c) : !1; + return (O == "number" ? hi(y) && fo(h, y.length) : O == "string" && h in y) ? ds(y[h], c) : !1; } function yg(c, h) { if (ir(c)) @@ -23158,17 +23158,17 @@ h0.exports; return !!O && c === O[0]; } function pM(c) { - return !!Ay && Ay in c; + return !!Py && Py in c; } var gM = xh ? lo : $g; function hf(c) { var h = c && c.constructor, y = typeof h == "function" && h.prototype || Oc; return c === y; } - function Aw(c) { + function Pw(c) { return c === c && !Zr(c); } - function Pw(c, h) { + function Mw(c, h) { return function(y) { return y == null ? !1 : y[c] === h && (h !== r || c in qr(y)); }; @@ -23180,16 +23180,16 @@ h0.exports; return h; } function vM(c, h) { - var y = c[1], O = h[1], q = y | O, ne = q < (L | B | R), fe = O == R && y == H || O == R && y == K && c[7].length <= h[8] || O == (R | K) && h[7].length <= h[8] && y == H; + var y = c[1], O = h[1], z = y | O, ne = z < (L | $ | R), fe = O == R && y == H || O == R && y == K && c[7].length <= h[8] || O == (R | K) && h[7].length <= h[8] && y == H; if (!(ne || fe)) return c; - O & L && (c[2] = h[2], q |= y & L ? 0 : $); + O & L && (c[2] = h[2], z |= y & L ? 0 : B); var me = h[3]; if (me) { var we = c[3]; - c[3] = we ? cw(we, me, h[4]) : me, c[4] = we ? Ko(c[3], d) : h[4]; + c[3] = we ? uw(we, me, h[4]) : me, c[4] = we ? Ko(c[3], d) : h[4]; } - return me = h[5], me && (we = c[5], c[5] = we ? uw(we, me, h[6]) : me, c[6] = we ? Ko(c[5], d) : h[6]), me = h[7], me && (c[7] = me), O & R && (c[8] = c[8] == null ? h[8] : Kn(c[8], h[8])), c[9] == null && (c[9] = h[9]), c[0] = h[0], c[1] = q, c; + return me = h[5], me && (we = c[5], c[5] = we ? fw(we, me, h[6]) : me, c[6] = we ? Ko(c[5], d) : h[6]), me = h[7], me && (c[7] = me), O & R && (c[8] = c[8] == null ? h[8] : Kn(c[8], h[8])), c[9] == null && (c[9] = h[9]), c[0] = h[0], c[1] = z, c; } function bM(c) { var h = []; @@ -23201,23 +23201,23 @@ h0.exports; function yM(c) { return Eh.call(c); } - function Mw(c, h, y) { + function Iw(c, h, y) { return h = _n(h === r ? c.length - 1 : h, 0), function() { - for (var O = arguments, q = -1, ne = _n(O.length - h, 0), fe = Ie(ne); ++q < ne; ) - fe[q] = O[h + q]; - q = -1; - for (var me = Ie(h + 1); ++q < h; ) - me[q] = O[q]; + for (var O = arguments, z = -1, ne = _n(O.length - h, 0), fe = Ie(ne); ++z < ne; ) + fe[z] = O[h + z]; + z = -1; + for (var me = Ie(h + 1); ++z < h; ) + me[z] = O[z]; return me[h] = y(fe), Pn(c, this, me); }; } - function Iw(c, h) { + function Cw(c, h) { return h.length < 2 ? c : Ba(c, Wi(h, 0, -1)); } function wM(c, h) { - for (var y = c.length, O = Kn(h.length, y), q = fi(c); O--; ) { + for (var y = c.length, O = Kn(h.length, y), z = li(c); O--; ) { var ne = h[O]; - c[O] = fo(ne, y) ? q[ne] : r; + c[O] = fo(ne, y) ? z[ne] : r; } return c; } @@ -23225,18 +23225,18 @@ h0.exports; if (!(h === "constructor" && typeof c[h] == "function") && h != "__proto__") return c[h]; } - var Cw = Rw(Zy), df = LA || function(c, h) { + var Tw = Dw(Qy), df = LA || function(c, h) { return _r.setTimeout(c, h); - }, _g = Rw(zP); - function Tw(c, h, y) { + }, _g = Dw(zP); + function Rw(c, h, y) { var O = h + ""; return _g(c, lM(O, xM(cM(O), y))); } - function Rw(c) { + function Dw(c) { var h = 0, y = 0; return function() { - var O = FA(), q = m - (O - y); - if (y = O, q > 0) { + var O = FA(), z = m - (O - y); + if (y = O, z > 0) { if (++h >= S) return arguments[0]; } else @@ -23245,17 +23245,17 @@ h0.exports; }; } function Vh(c, h) { - var y = -1, O = c.length, q = O - 1; + var y = -1, O = c.length, z = O - 1; for (h = h === r ? O : h; ++y < h; ) { - var ne = ig(y, q), fe = c[ne]; + var ne = ig(y, z), fe = c[ne]; c[ne] = c[y], c[y] = fe; } return c.length = h, c; } - var Dw = mM(function(c) { + var Ow = mM(function(c) { var h = []; - return c.charCodeAt(0) === 46 && h.push(""), c.replace(Ft, function(y, O, q, ne) { - h.push(q ? ne.replace(he, "$1") : O || y); + return c.charCodeAt(0) === 46 && h.push(""), c.replace(Ft, function(y, O, z, ne) { + h.push(z ? ne.replace(he, "$1") : O || y); }), h; }); function Rs(c) { @@ -23283,27 +23283,27 @@ h0.exports; h & y[1] && !vh(c, O) && c.push(O); }), c.sort(); } - function Ow(c) { + function Nw(c) { if (c instanceof wr) return c.clone(); var h = new qi(c.__wrapped__, c.__chain__); - return h.__actions__ = fi(c.__actions__), h.__index__ = c.__index__, h.__values__ = c.__values__, h; + return h.__actions__ = li(c.__actions__), h.__index__ = c.__index__, h.__values__ = c.__values__, h; } function _M(c, h, y) { (y ? ni(c, h, y) : h === r) ? h = 1 : h = _n(cr(h), 0); var O = c == null ? 0 : c.length; if (!O || h < 1) return []; - for (var q = 0, ne = 0, fe = Ie(Ch(O / h)); q < O; ) - fe[ne++] = Wi(c, q, q += h); + for (var z = 0, ne = 0, fe = Ie(Ch(O / h)); z < O; ) + fe[ne++] = Wi(c, z, z += h); return fe; } function EM(c) { - for (var h = -1, y = c == null ? 0 : c.length, O = 0, q = []; ++h < y; ) { + for (var h = -1, y = c == null ? 0 : c.length, O = 0, z = []; ++h < y; ) { var ne = c[h]; - ne && (q[O++] = ne); + ne && (z[O++] = ne); } - return q; + return z; } function SM() { var c = arguments.length; @@ -23311,7 +23311,7 @@ h0.exports; return []; for (var h = Ie(c - 1), y = arguments[0], O = c; O--; ) h[O - 1] = arguments[O]; - return Ho(ir(y) ? fi(y) : [y], Bn(h, 1)); + return Ho(ir(y) ? li(y) : [y], Bn(h, 1)); } var AM = hr(function(c, h) { return cn(c) ? af(c, Bn(h, 1, cn, !0)) : []; @@ -23337,24 +23337,24 @@ h0.exports; return c && c.length ? Fh(c, Ut(h, 3), !0) : []; } function DM(c, h, y, O) { - var q = c == null ? 0 : c.length; - return q ? (y && typeof y != "number" && ni(c, h, y) && (y = 0, O = q), SP(c, h, y, O)) : []; + var z = c == null ? 0 : c.length; + return z ? (y && typeof y != "number" && ni(c, h, y) && (y = 0, O = z), SP(c, h, y, O)) : []; } - function Nw(c, h, y) { + function Lw(c, h, y) { var O = c == null ? 0 : c.length; if (!O) return -1; - var q = y == null ? 0 : cr(y); - return q < 0 && (q = _n(O + q, 0)), bh(c, Ut(h, 3), q); + var z = y == null ? 0 : cr(y); + return z < 0 && (z = _n(O + z, 0)), bh(c, Ut(h, 3), z); } - function Lw(c, h, y) { + function kw(c, h, y) { var O = c == null ? 0 : c.length; if (!O) return -1; - var q = O - 1; - return y !== r && (q = cr(y), q = y < 0 ? _n(O + q, 0) : Kn(q, O - 1)), bh(c, Ut(h, 3), q, !0); + var z = O - 1; + return y !== r && (z = cr(y), z = y < 0 ? _n(O + z, 0) : Kn(z, O - 1)), bh(c, Ut(h, 3), z, !0); } - function kw(c) { + function $w(c) { var h = c == null ? 0 : c.length; return h ? Bn(c, 1) : []; } @@ -23368,20 +23368,20 @@ h0.exports; } function LM(c) { for (var h = -1, y = c == null ? 0 : c.length, O = {}; ++h < y; ) { - var q = c[h]; - O[q[0]] = q[1]; + var z = c[h]; + O[z[0]] = z[1]; } return O; } - function $w(c) { + function Bw(c) { return c && c.length ? c[0] : r; } function kM(c, h, y) { var O = c == null ? 0 : c.length; if (!O) return -1; - var q = y == null ? 0 : cr(y); - return q < 0 && (q = _n(O + q, 0)), Cc(c, h, q); + var z = y == null ? 0 : cr(y); + return z < 0 && (z = _n(O + z, 0)), Cc(c, h, z); } function $M(c) { var h = c == null ? 0 : c.length; @@ -23408,14 +23408,14 @@ h0.exports; var O = c == null ? 0 : c.length; if (!O) return -1; - var q = O; - return y !== r && (q = cr(y), q = q < 0 ? _n(O + q, 0) : Kn(q, O - 1)), h === h ? xA(c, h, q) : bh(c, vy, q, !0); + var z = O; + return y !== r && (z = cr(y), z = z < 0 ? _n(O + z, 0) : Kn(z, O - 1)), h === h ? xA(c, h, z) : bh(c, by, z, !0); } function zM(c, h) { - return c && c.length ? Gy(c, cr(h)) : r; + return c && c.length ? Yy(c, cr(h)) : r; } - var WM = hr(Bw); - function Bw(c, h) { + var WM = hr(Fw); + function Fw(c, h) { return c && c.length && h && h.length ? ng(c, h) : c; } function HM(c, h, y) { @@ -23426,20 +23426,20 @@ h0.exports; } var VM = uo(function(c, h) { var y = c == null ? 0 : c.length, O = Yp(c, h); - return Xy(c, Xr(h, function(q) { - return fo(q, y) ? +q : q; - }).sort(aw)), O; + return Zy(c, Xr(h, function(z) { + return fo(z, y) ? +z : z; + }).sort(cw)), O; }); function GM(c, h) { var y = []; if (!(c && c.length)) return y; - var O = -1, q = [], ne = c.length; + var O = -1, z = [], ne = c.length; for (h = Ut(h, 3); ++O < ne; ) { var fe = c[O]; - h(fe, O, c) && (y.push(fe), q.push(O)); + h(fe, O, c) && (y.push(fe), z.push(O)); } - return Xy(c, q), y; + return Zy(c, z), y; } function Eg(c) { return c == null ? c : UA.call(c); @@ -23479,10 +23479,10 @@ h0.exports; return -1; } function rI(c) { - return c && c.length ? Qy(c) : []; + return c && c.length ? ew(c) : []; } function nI(c, h) { - return c && c.length ? Qy(c, Ut(h, 2)) : []; + return c && c.length ? ew(c, Ut(h, 2)) : []; } function iI(c) { var h = c == null ? 0 : c.length; @@ -23530,7 +23530,7 @@ h0.exports; return Xr(c, Bp(y)); }); } - function Fw(c, h) { + function jw(c, h) { if (!(c && c.length)) return []; var y = Sg(c); @@ -23550,16 +23550,16 @@ h0.exports; return h = typeof h == "function" ? h : r, cg(Wo(c, cn), r, h); }), yI = hr(Sg); function wI(c, h) { - return nw(c || [], h || [], of); + return iw(c || [], h || [], of); } function xI(c, h) { - return nw(c || [], h || [], ff); + return iw(c || [], h || [], ff); } var _I = hr(function(c) { var h = c.length, y = h > 1 ? c[h - 1] : r; - return y = typeof y == "function" ? (c.pop(), y) : r, Fw(c, y); + return y = typeof y == "function" ? (c.pop(), y) : r, jw(c, y); }); - function jw(c) { + function Uw(c) { var h = ee(c); return h.__chain__ = !0, h; } @@ -23570,25 +23570,25 @@ h0.exports; return h(c); } var SI = uo(function(c) { - var h = c.length, y = h ? c[0] : 0, O = this.__wrapped__, q = function(ne) { + var h = c.length, y = h ? c[0] : 0, O = this.__wrapped__, z = function(ne) { return Yp(ne, c); }; - return h > 1 || this.__actions__.length || !(O instanceof wr) || !fo(y) ? this.thru(q) : (O = O.slice(y, +y + (h ? 1 : 0)), O.__actions__.push({ + return h > 1 || this.__actions__.length || !(O instanceof wr) || !fo(y) ? this.thru(z) : (O = O.slice(y, +y + (h ? 1 : 0)), O.__actions__.push({ func: Gh, - args: [q], + args: [z], thisArg: r }), new qi(O, this.__chain__).thru(function(ne) { return h && !ne.length && ne.push(r), ne; })); }); function AI() { - return jw(this); + return Uw(this); } function PI() { return new qi(this.value(), this.__chain__); } function MI() { - this.__values__ === r && (this.__values__ = e2(this.value())); + this.__values__ === r && (this.__values__ = t2(this.value())); var c = this.__index__ >= this.__values__.length, h = c ? r : this.__values__[this.__index__++]; return { done: c, value: h }; } @@ -23597,12 +23597,12 @@ h0.exports; } function CI(c) { for (var h, y = this; y instanceof Oh; ) { - var O = Ow(y); - O.__index__ = 0, O.__values__ = r, h ? q.__wrapped__ = O : h = O; - var q = O; + var O = Nw(y); + O.__index__ = 0, O.__values__ = r, h ? z.__wrapped__ = O : h = O; + var z = O; y = y.__wrapped__; } - return q.__wrapped__ = c, h; + return z.__wrapped__ = c, h; } function TI() { var c = this.__wrapped__; @@ -23617,20 +23617,20 @@ h0.exports; return this.thru(Eg); } function RI() { - return rw(this.__wrapped__, this.__actions__); + return nw(this.__wrapped__, this.__actions__); } var DI = jh(function(c, h, y) { Tr.call(c, y) ? ++c[y] : ao(c, y, 1); }); function OI(c, h, y) { - var O = ir(c) ? gy : EP; + var O = ir(c) ? my : EP; return y && ni(c, h, y) && (h = r), O(c, Ut(h, 3)); } function NI(c, h) { - var y = ir(c) ? Wo : Fy; + var y = ir(c) ? Wo : jy; return y(c, Ut(h, 3)); } - var LI = dw(Nw), kI = dw(Lw); + var LI = pw(Lw), kI = pw(kw); function $I(c, h) { return Bn(Yh(c, h), 1); } @@ -23640,36 +23640,36 @@ h0.exports; function FI(c, h, y) { return y = y === r ? 1 : cr(y), Bn(Yh(c, h), y); } - function Uw(c, h) { + function qw(c, h) { var y = ir(c) ? ji : Go; return y(c, Ut(h, 3)); } - function qw(c, h) { - var y = ir(c) ? iA : By; + function zw(c, h) { + var y = ir(c) ? iA : Fy; return y(c, Ut(h, 3)); } var jI = jh(function(c, h, y) { Tr.call(c, y) ? c[y].push(h) : ao(c, y, [h]); }); function UI(c, h, y, O) { - c = li(c) ? c : Uc(c), y = y && !O ? cr(y) : 0; - var q = c.length; - return y < 0 && (y = _n(q + y, 0)), ed(c) ? y <= q && c.indexOf(h, y) > -1 : !!q && Cc(c, h, y) > -1; + c = hi(c) ? c : Uc(c), y = y && !O ? cr(y) : 0; + var z = c.length; + return y < 0 && (y = _n(z + y, 0)), ed(c) ? y <= z && c.indexOf(h, y) > -1 : !!z && Cc(c, h, y) > -1; } var qI = hr(function(c, h, y) { - var O = -1, q = typeof h == "function", ne = li(c) ? Ie(c.length) : []; + var O = -1, z = typeof h == "function", ne = hi(c) ? Ie(c.length) : []; return Go(c, function(fe) { - ne[++O] = q ? Pn(h, fe, y) : cf(fe, h, y); + ne[++O] = z ? Pn(h, fe, y) : cf(fe, h, y); }), ne; }), zI = jh(function(c, h, y) { ao(c, y, h); }); function Yh(c, h) { - var y = ir(c) ? Xr : Hy; + var y = ir(c) ? Xr : Ky; return y(c, Ut(h, 3)); } function WI(c, h, y, O) { - return c == null ? [] : (ir(h) || (h = h == null ? [] : [h]), y = O ? r : y, ir(y) || (y = y == null ? [] : [y]), Yy(c, h, y)); + return c == null ? [] : (ir(h) || (h = h == null ? [] : [h]), y = O ? r : y, ir(y) || (y = y == null ? [] : [y]), Jy(c, h, y)); } var HI = jh(function(c, h, y) { c[y ? 0 : 1].push(h); @@ -23677,19 +23677,19 @@ h0.exports; return [[], []]; }); function KI(c, h, y) { - var O = ir(c) ? kp : yy, q = arguments.length < 3; - return O(c, Ut(h, 4), y, q, Go); + var O = ir(c) ? kp : wy, z = arguments.length < 3; + return O(c, Ut(h, 4), y, z, Go); } function VI(c, h, y) { - var O = ir(c) ? sA : yy, q = arguments.length < 3; - return O(c, Ut(h, 4), y, q, By); + var O = ir(c) ? sA : wy, z = arguments.length < 3; + return O(c, Ut(h, 4), y, z, Fy); } function GI(c, h) { - var y = ir(c) ? Wo : Fy; + var y = ir(c) ? Wo : jy; return y(c, Zh(Ut(h, 3))); } function YI(c) { - var h = ir(c) ? Ny : UP; + var h = ir(c) ? Ly : UP; return h(c); } function JI(c, h, y) { @@ -23704,7 +23704,7 @@ h0.exports; function ZI(c) { if (c == null) return 0; - if (li(c)) + if (hi(c)) return ed(c) ? Rc(c) : c.length; var h = Vn(c); return h == ie || h == Me ? c.size : tg(c).length; @@ -23717,7 +23717,7 @@ h0.exports; if (c == null) return []; var y = h.length; - return y > 1 && ni(c, h[0], h[1]) ? h = [] : y > 2 && ni(h[0], h[1], h[2]) && (h = [h[0]]), Yy(c, Bn(h, 1), []); + return y > 1 && ni(c, h[0], h[1]) ? h = [] : y > 2 && ni(h[0], h[1], h[2]) && (h = [h[0]]), Jy(c, Bn(h, 1), []); }), Jh = NA || function() { return _r.Date.now(); }; @@ -23729,10 +23729,10 @@ h0.exports; return h.apply(this, arguments); }; } - function zw(c, h, y) { + function Ww(c, h, y) { return h = y ? r : h, h = c && h == null ? c.length : h, co(c, R, r, r, r, r, h); } - function Ww(c, h) { + function Hw(c, h) { var y; if (typeof h != "function") throw new Ui(o); @@ -23743,43 +23743,43 @@ h0.exports; var Ag = hr(function(c, h, y) { var O = L; if (y.length) { - var q = Ko(y, Fc(Ag)); + var z = Ko(y, Fc(Ag)); O |= V; } - return co(c, O, h, y, q); - }), Hw = hr(function(c, h, y) { - var O = L | B; + return co(c, O, h, y, z); + }), Kw = hr(function(c, h, y) { + var O = L | $; if (y.length) { - var q = Ko(y, Fc(Hw)); + var z = Ko(y, Fc(Kw)); O |= V; } - return co(h, O, c, y, q); + return co(h, O, c, y, z); }); - function Kw(c, h, y) { - h = y ? r : h; - var O = co(c, H, r, r, r, r, r, h); - return O.placeholder = Kw.placeholder, O; - } function Vw(c, h, y) { h = y ? r : h; - var O = co(c, W, r, r, r, r, r, h); + var O = co(c, H, r, r, r, r, r, h); return O.placeholder = Vw.placeholder, O; } function Gw(c, h, y) { - var O, q, ne, fe, me, we, We = 0, He = !1, Xe = !1, wt = !0; + h = y ? r : h; + var O = co(c, U, r, r, r, r, r, h); + return O.placeholder = Gw.placeholder, O; + } + function Yw(c, h, y) { + var O, z, ne, fe, me, we, We = 0, He = !1, Xe = !1, wt = !0; if (typeof c != "function") throw new Ui(o); h = Ki(h) || 0, Zr(y) && (He = !!y.leading, Xe = "maxWait" in y, ne = Xe ? _n(Ki(y.maxWait) || 0, h) : ne, wt = "trailing" in y ? !!y.trailing : wt); function Ot(un) { - var ps = O, po = q; - return O = q = r, We = un, fe = c.apply(po, ps), fe; + var ps = O, po = z; + return O = z = r, We = un, fe = c.apply(po, ps), fe; } function Ht(un) { return We = un, me = df(vr, h), He ? Ot(un) : fe; } function fr(un) { - var ps = un - we, po = un - We, d2 = h - ps; - return Xe ? Kn(d2, ne - po) : d2; + var ps = un - we, po = un - We, p2 = h - ps; + return Xe ? Kn(p2, ne - po) : p2; } function Kt(un) { var ps = un - we, po = un - We; @@ -23792,30 +23792,30 @@ h0.exports; me = df(vr, fr(un)); } function Er(un) { - return me = r, wt && O ? Ot(un) : (O = q = r, fe); + return me = r, wt && O ? Ot(un) : (O = z = r, fe); } function Ci() { - me !== r && iw(me), We = 0, O = we = q = me = r; + me !== r && sw(me), We = 0, O = we = z = me = r; } function ii() { return me === r ? fe : Er(Jh()); } function Ti() { var un = Jh(), ps = Kt(un); - if (O = arguments, q = this, we = un, ps) { + if (O = arguments, z = this, we = un, ps) { if (me === r) return Ht(we); if (Xe) - return iw(me), me = df(vr, h), Ot(we); + return sw(me), me = df(vr, h), Ot(we); } return me === r && (me = df(vr, h)), fe; } return Ti.cancel = Ci, Ti.flush = ii, Ti; } var rC = hr(function(c, h) { - return $y(c, 1, h); + return By(c, 1, h); }), nC = hr(function(c, h, y) { - return $y(c, Ki(h) || 0, y); + return By(c, Ki(h) || 0, y); }); function iC(c) { return co(c, ge); @@ -23824,11 +23824,11 @@ h0.exports; if (typeof c != "function" || h != null && typeof h != "function") throw new Ui(o); var y = function() { - var O = arguments, q = h ? h.apply(this, O) : O[0], ne = y.cache; - if (ne.has(q)) - return ne.get(q); + var O = arguments, z = h ? h.apply(this, O) : O[0], ne = y.cache; + if (ne.has(z)) + return ne.get(z); var fe = c.apply(this, O); - return y.cache = ne.set(q, fe) || ne, fe; + return y.cache = ne.set(z, fe) || ne, fe; }; return y.cache = new (Xh.Cache || oo)(), y; } @@ -23852,21 +23852,21 @@ h0.exports; }; } function sC(c) { - return Ww(2, c); + return Hw(2, c); } var oC = KP(function(c, h) { h = h.length == 1 && ir(h[0]) ? Xr(h[0], Pi(Ut())) : Xr(Bn(h, 1), Pi(Ut())); var y = h.length; return hr(function(O) { - for (var q = -1, ne = Kn(O.length, y); ++q < ne; ) - O[q] = h[q].call(this, O[q]); + for (var z = -1, ne = Kn(O.length, y); ++z < ne; ) + O[z] = h[z].call(this, O[z]); return Pn(c, this, O); }); }), Pg = hr(function(c, h) { var y = Ko(h, Fc(Pg)); return co(c, V, r, h, y); - }), Yw = hr(function(c, h) { - var y = Ko(h, Fc(Yw)); + }), Jw = hr(function(c, h) { + var y = Ko(h, Fc(Jw)); return co(c, te, r, h, y); }), aC = uo(function(c, h) { return co(c, K, r, r, r, h); @@ -23880,22 +23880,22 @@ h0.exports; if (typeof c != "function") throw new Ui(o); return h = h == null ? 0 : _n(cr(h), 0), hr(function(y) { - var O = y[h], q = Xo(y, 0, h); - return O && Ho(q, O), Pn(c, this, q); + var O = y[h], z = Xo(y, 0, h); + return O && Ho(z, O), Pn(c, this, z); }); } function fC(c, h, y) { - var O = !0, q = !0; + var O = !0, z = !0; if (typeof c != "function") throw new Ui(o); - return Zr(y) && (O = "leading" in y ? !!y.leading : O, q = "trailing" in y ? !!y.trailing : q), Gw(c, h, { + return Zr(y) && (O = "leading" in y ? !!y.leading : O, z = "trailing" in y ? !!y.trailing : z), Yw(c, h, { leading: O, maxWait: h, - trailing: q + trailing: z }); } function lC(c) { - return zw(c, 1); + return Ww(c, 1); } function hC(c, h) { return Pg(fg(h), c); @@ -23919,23 +23919,23 @@ h0.exports; return h = typeof h == "function" ? h : r, zi(c, p | A, h); } function bC(c, h) { - return h == null || ky(c, h, Mn(h)); + return h == null || $y(c, h, Mn(h)); } function ds(c, h) { return c === h || c !== c && h !== h; } var yC = Wh(Zp), wC = Wh(function(c, h) { return c >= h; - }), Ua = qy(/* @__PURE__ */ function() { + }), Ua = zy(/* @__PURE__ */ function() { return arguments; - }()) ? qy : function(c) { - return en(c) && Tr.call(c, "callee") && !Iy.call(c, "callee"); + }()) ? zy : function(c) { + return en(c) && Tr.call(c, "callee") && !Cy.call(c, "callee"); }, ir = Ie.isArray, xC = ti ? Pi(ti) : CP; - function li(c) { + function hi(c) { return c != null && Qh(c.length) && !lo(c); } function cn(c) { - return en(c) && li(c); + return en(c) && hi(c); } function _C(c) { return c === !0 || c === !1 || en(c) && ri(c) == J; @@ -23947,7 +23947,7 @@ h0.exports; function AC(c) { if (c == null) return !0; - if (li(c) && (ir(c) || typeof c == "string" || typeof c.splice == "function" || Zo(c) || jc(c) || Ua(c))) + if (hi(c) && (ir(c) || typeof c == "string" || typeof c.splice == "function" || Zo(c) || jc(c) || Ua(c))) return !c.length; var h = Vn(c); if (h == ie || h == Me) @@ -23974,7 +23974,7 @@ h0.exports; return h == X || h == T || typeof c.message == "string" && typeof c.name == "string" && !pf(c); } function IC(c) { - return typeof c == "number" && Ty(c); + return typeof c == "number" && Ry(c); } function lo(c) { if (!Zr(c)) @@ -23982,7 +23982,7 @@ h0.exports; var h = ri(c); return h == re || h == de || h == Z || h == Ce; } - function Jw(c) { + function Xw(c) { return typeof c == "number" && c == cr(c); } function Qh(c) { @@ -23995,7 +23995,7 @@ h0.exports; function en(c) { return c != null && typeof c == "object"; } - var Xw = Fi ? Pi(Fi) : DP; + var Zw = Fi ? Pi(Fi) : DP; function CC(c, h) { return c === h || eg(c, h, vg(h)); } @@ -24003,12 +24003,12 @@ h0.exports; return y = typeof y == "function" ? y : r, eg(c, h, vg(h), y); } function RC(c) { - return Zw(c) && c != +c; + return Qw(c) && c != +c; } function DC(c) { if (gM(c)) throw new tr(s); - return zy(c); + return Wy(c); } function OC(c) { return c === null; @@ -24016,7 +24016,7 @@ h0.exports; function NC(c) { return c == null; } - function Zw(c) { + function Qw(c) { return typeof c == "number" || en(c) && ri(c) == ue; } function pf(c) { @@ -24030,9 +24030,9 @@ h0.exports; } var Ig = Is ? Pi(Is) : OP; function LC(c) { - return Jw(c) && c >= -_ && c <= _; + return Xw(c) && c >= -_ && c <= _; } - var Qw = Zu ? Pi(Zu) : NP; + var e2 = Zu ? Pi(Zu) : NP; function ed(c) { return typeof c == "string" || !ir(c) && en(c) && ri(c) == Ne; } @@ -24052,11 +24052,11 @@ h0.exports; var FC = Wh(rg), jC = Wh(function(c, h) { return c <= h; }); - function e2(c) { + function t2(c) { if (!c) return []; - if (li(c)) - return ed(c) ? ls(c) : fi(c); + if (hi(c)) + return ed(c) ? ls(c) : li(c); if (ef && c[ef]) return bA(c[ef]()); var h = Vn(c), y = h == ie ? zp : h == Me ? yh : Uc; @@ -24075,7 +24075,7 @@ h0.exports; var h = ho(c), y = h % 1; return h === h ? y ? h - y : h : 0; } - function t2(c) { + function r2(c) { return c ? $a(cr(c), 0, P) : 0; } function Ki(c) { @@ -24089,12 +24089,12 @@ h0.exports; } if (typeof c != "string") return c === 0 ? c : +c; - c = wy(c); + c = xy(c); var y = nt.test(c); return y || pt.test(c) ? nr(c.slice(2), y ? 2 : 8) : Re.test(c) ? v : +c; } - function r2(c) { - return Ts(c, hi(c)); + function n2(c) { + return Ts(c, di(c)); } function UC(c) { return c ? $a(cr(c), -_, _) : c === 0 ? c : 0; @@ -24103,46 +24103,46 @@ h0.exports; return c == null ? "" : Mi(c); } var qC = $c(function(c, h) { - if (hf(h) || li(h)) { + if (hf(h) || hi(h)) { Ts(h, Mn(h), c); return; } for (var y in h) Tr.call(h, y) && of(c, y, h[y]); - }), n2 = $c(function(c, h) { - Ts(h, hi(h), c); + }), i2 = $c(function(c, h) { + Ts(h, di(h), c); }), td = $c(function(c, h, y, O) { - Ts(h, hi(h), c, O); + Ts(h, di(h), c, O); }), zC = $c(function(c, h, y, O) { Ts(h, Mn(h), c, O); }), WC = uo(Yp); function HC(c, h) { var y = kc(c); - return h == null ? y : Ly(y, h); + return h == null ? y : ky(y, h); } var KC = hr(function(c, h) { c = qr(c); - var y = -1, O = h.length, q = O > 2 ? h[2] : r; - for (q && ni(h[0], h[1], q) && (O = 1); ++y < O; ) - for (var ne = h[y], fe = hi(ne), me = -1, we = fe.length; ++me < we; ) { + var y = -1, O = h.length, z = O > 2 ? h[2] : r; + for (z && ni(h[0], h[1], z) && (O = 1); ++y < O; ) + for (var ne = h[y], fe = di(ne), me = -1, we = fe.length; ++me < we; ) { var We = fe[me], He = c[We]; (He === r || ds(He, Oc[We]) && !Tr.call(c, We)) && (c[We] = ne[We]); } return c; }), VC = hr(function(c) { - return c.push(r, ww), Pn(i2, r, c); + return c.push(r, xw), Pn(s2, r, c); }); function GC(c, h) { - return my(c, Ut(h, 3), Cs); + return vy(c, Ut(h, 3), Cs); } function YC(c, h) { - return my(c, Ut(h, 3), Xp); + return vy(c, Ut(h, 3), Xp); } function JC(c, h) { - return c == null ? c : Jp(c, Ut(h, 3), hi); + return c == null ? c : Jp(c, Ut(h, 3), di); } function XC(c, h) { - return c == null ? c : jy(c, Ut(h, 3), hi); + return c == null ? c : Uy(c, Ut(h, 3), di); } function ZC(c, h) { return c && Cs(c, Ut(h, 3)); @@ -24154,44 +24154,44 @@ h0.exports; return c == null ? [] : kh(c, Mn(c)); } function tT(c) { - return c == null ? [] : kh(c, hi(c)); + return c == null ? [] : kh(c, di(c)); } function Cg(c, h, y) { var O = c == null ? r : Ba(c, h); return O === r ? y : O; } function rT(c, h) { - return c != null && Ew(c, h, AP); + return c != null && Sw(c, h, AP); } function Tg(c, h) { - return c != null && Ew(c, h, PP); + return c != null && Sw(c, h, PP); } - var nT = gw(function(c, h, y) { + var nT = mw(function(c, h, y) { h != null && typeof h.toString != "function" && (h = Eh.call(h)), c[h] = y; - }, Dg(di)), iT = gw(function(c, h, y) { + }, Dg(pi)), iT = mw(function(c, h, y) { h != null && typeof h.toString != "function" && (h = Eh.call(h)), Tr.call(c, h) ? c[h].push(y) : c[h] = [y]; }, Ut), sT = hr(cf); function Mn(c) { - return li(c) ? Oy(c) : tg(c); + return hi(c) ? Ny(c) : tg(c); } - function hi(c) { - return li(c) ? Oy(c, !0) : kP(c); + function di(c) { + return hi(c) ? Ny(c, !0) : kP(c); } function oT(c, h) { var y = {}; - return h = Ut(h, 3), Cs(c, function(O, q, ne) { - ao(y, h(O, q, ne), O); + return h = Ut(h, 3), Cs(c, function(O, z, ne) { + ao(y, h(O, z, ne), O); }), y; } function aT(c, h) { var y = {}; - return h = Ut(h, 3), Cs(c, function(O, q, ne) { - ao(y, q, h(O, q, ne)); + return h = Ut(h, 3), Cs(c, function(O, z, ne) { + ao(y, z, h(O, z, ne)); }), y; } var cT = $c(function(c, h, y) { $h(c, h, y); - }), i2 = $c(function(c, h, y, O) { + }), s2 = $c(function(c, h, y, O) { $h(c, h, y, O); }), uT = uo(function(c, h) { var y = {}; @@ -24201,32 +24201,32 @@ h0.exports; h = Xr(h, function(ne) { return ne = Jo(ne, c), O || (O = ne.length > 1), ne; }), Ts(c, gg(c), y), O && (y = zi(y, p | w | A, nM)); - for (var q = h.length; q--; ) - ag(y, h[q]); + for (var z = h.length; z--; ) + ag(y, h[z]); return y; }); function fT(c, h) { - return s2(c, Zh(Ut(h))); + return o2(c, Zh(Ut(h))); } var lT = uo(function(c, h) { return c == null ? {} : BP(c, h); }); - function s2(c, h) { + function o2(c, h) { if (c == null) return {}; var y = Xr(gg(c), function(O) { return [O]; }); - return h = Ut(h), Jy(c, y, function(O, q) { - return h(O, q[0]); + return h = Ut(h), Xy(c, y, function(O, z) { + return h(O, z[0]); }); } function hT(c, h, y) { h = Jo(h, c); - var O = -1, q = h.length; - for (q || (q = 1, c = r); ++O < q; ) { + var O = -1, z = h.length; + for (z || (z = 1, c = r); ++O < z; ) { var ne = c == null ? r : c[Rs(h[O])]; - ne === r && (O = q, ne = y), c = lo(ne) ? ne.call(c) : ne; + ne === r && (O = z, ne = y), c = lo(ne) ? ne.call(c) : ne; } return c; } @@ -24236,14 +24236,14 @@ h0.exports; function pT(c, h, y, O) { return O = typeof O == "function" ? O : r, c == null ? c : ff(c, h, y, O); } - var o2 = bw(Mn), a2 = bw(hi); + var a2 = yw(Mn), c2 = yw(di); function gT(c, h, y) { - var O = ir(c), q = O || Zo(c) || jc(c); + var O = ir(c), z = O || Zo(c) || jc(c); if (h = Ut(h, 4), y == null) { var ne = c && c.constructor; - q ? y = O ? new ne() : [] : Zr(c) ? y = lo(ne) ? kc(Ph(c)) : {} : y = {}; + z ? y = O ? new ne() : [] : Zr(c) ? y = lo(ne) ? kc(Ph(c)) : {} : y = {}; } - return (q ? ji : Cs)(c, function(fe, me, we) { + return (z ? ji : Cs)(c, function(fe, me, we) { return h(y, fe, me, we); }), y; } @@ -24251,16 +24251,16 @@ h0.exports; return c == null ? !0 : ag(c, h); } function vT(c, h, y) { - return c == null ? c : tw(c, h, fg(y)); + return c == null ? c : rw(c, h, fg(y)); } function bT(c, h, y, O) { - return O = typeof O == "function" ? O : r, c == null ? c : tw(c, h, fg(y), O); + return O = typeof O == "function" ? O : r, c == null ? c : rw(c, h, fg(y), O); } function Uc(c) { return c == null ? [] : qp(c, Mn(c)); } function yT(c) { - return c == null ? [] : qp(c, hi(c)); + return c == null ? [] : qp(c, di(c)); } function wT(c, h, y) { return y === r && (y = h, h = r), y !== r && (y = Ki(y), y = y === y ? y : 0), h !== r && (h = Ki(h), h = h === h ? h : 0), $a(Ki(c), h, y); @@ -24274,26 +24274,26 @@ h0.exports; c = h, h = O; } if (y || c % 1 || h % 1) { - var q = Ry(); - return Kn(c + q * (h - c + jr("1e-" + ((q + "").length - 1))), h); + var z = Dy(); + return Kn(c + z * (h - c + jr("1e-" + ((z + "").length - 1))), h); } return ig(c, h); } var ET = Bc(function(c, h, y) { - return h = h.toLowerCase(), c + (y ? c2(h) : h); + return h = h.toLowerCase(), c + (y ? u2(h) : h); }); - function c2(c) { + function u2(c) { return Rg(Cr(c).toLowerCase()); } - function u2(c) { + function f2(c) { return c = Cr(c), c && c.replace(et, dA).replace(Op, ""); } function ST(c, h, y) { c = Cr(c), h = Mi(h); var O = c.length; y = y === r ? O : $a(cr(y), 0, O); - var q = y; - return y -= h.length, y >= 0 && c.slice(y, q) == h; + var z = y; + return y -= h.length, y >= 0 && c.slice(y, z) == h; } function AT(c) { return c = Cr(c), c && Ct.test(c) ? c.replace(Dt, pA) : c; @@ -24305,14 +24305,14 @@ h0.exports; return c + (y ? "-" : "") + h.toLowerCase(); }), IT = Bc(function(c, h, y) { return c + (y ? " " : "") + h.toLowerCase(); - }), CT = hw("toLowerCase"); + }), CT = dw("toLowerCase"); function TT(c, h, y) { c = Cr(c), h = cr(h); var O = h ? Rc(c) : 0; if (!h || O >= h) return c; - var q = (h - O) / 2; - return zh(Th(q), y) + c + zh(Ch(q), y); + var z = (h - O) / 2; + return zh(Th(z), y) + c + zh(Ch(z), y); } function RT(c, h, y) { c = Cr(c), h = cr(h); @@ -24348,8 +24348,8 @@ h0.exports; } function jT(c, h, y) { var O = ee.templateSettings; - y && ni(c, h, y) && (h = r), c = Cr(c), h = td({}, h, O, yw); - var q = td({}, h.imports, O.imports, yw), ne = Mn(q), fe = qp(q, ne), me, we, We = 0, He = h.interpolate || St, Xe = "__p += '", wt = Wp( + y && ni(c, h, y) && (h = r), c = Cr(c), h = td({}, h, O, ww); + var z = td({}, h.imports, O.imports, ww), ne = Mn(z), fe = qp(z, ne), me, we, We = 0, He = h.interpolate || St, Xe = "__p += '", wt = Wp( (h.escape || St).source + "|" + He.source + "|" + (He === Nt ? xe : St).source + "|" + (h.evaluate || St).source + "|$", "g" ), Ot = "//# sourceURL=" + (Tr.call(h, "sourceURL") ? (h.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++Np + "]") + ` @@ -24379,7 +24379,7 @@ function print() { __p += __j.call(arguments, '') } ` : `; `) + Xe + `return __p }`; - var fr = l2(function() { + var fr = h2(function() { return Pr(ne, Ot + "return " + Xe).apply(r, fe); }); if (fr.source = Xe, Mg(fr)) @@ -24394,32 +24394,32 @@ function print() { __p += __j.call(arguments, '') } } function zT(c, h, y) { if (c = Cr(c), c && (y || h === r)) - return wy(c); + return xy(c); if (!c || !(h = Mi(h))) return c; - var O = ls(c), q = ls(h), ne = xy(O, q), fe = _y(O, q) + 1; + var O = ls(c), z = ls(h), ne = _y(O, z), fe = Ey(O, z) + 1; return Xo(O, ne, fe).join(""); } function WT(c, h, y) { if (c = Cr(c), c && (y || h === r)) - return c.slice(0, Sy(c) + 1); + return c.slice(0, Ay(c) + 1); if (!c || !(h = Mi(h))) return c; - var O = ls(c), q = _y(O, ls(h)) + 1; - return Xo(O, 0, q).join(""); + var O = ls(c), z = Ey(O, ls(h)) + 1; + return Xo(O, 0, z).join(""); } function HT(c, h, y) { if (c = Cr(c), c && (y || h === r)) return c.replace(k, ""); if (!c || !(h = Mi(h))) return c; - var O = ls(c), q = xy(O, ls(h)); - return Xo(O, q).join(""); + var O = ls(c), z = _y(O, ls(h)); + return Xo(O, z).join(""); } function KT(c, h) { var y = Ee, O = Y; if (Zr(h)) { - var q = "separator" in h ? h.separator : q; + var z = "separator" in h ? h.separator : z; y = "length" in h ? cr(h.length) : y, O = "omission" in h ? Mi(h.omission) : O; } c = Cr(c); @@ -24434,17 +24434,17 @@ function print() { __p += __j.call(arguments, '') } if (me < 1) return O; var we = fe ? Xo(fe, 0, me).join("") : c.slice(0, me); - if (q === r) + if (z === r) return we + O; - if (fe && (me += we.length - me), Ig(q)) { - if (c.slice(me).search(q)) { + if (fe && (me += we.length - me), Ig(z)) { + if (c.slice(me).search(z)) { var We, He = we; - for (q.global || (q = Wp(q.source, Cr(Te.exec(q)) + "g")), q.lastIndex = 0; We = q.exec(He); ) + for (z.global || (z = Wp(z.source, Cr(Te.exec(z)) + "g")), z.lastIndex = 0; We = z.exec(He); ) var Xe = We.index; we = we.slice(0, Xe === r ? me : Xe); } - } else if (c.indexOf(Mi(q), me) != me) { - var wt = we.lastIndexOf(q); + } else if (c.indexOf(Mi(z), me) != me) { + var wt = we.lastIndexOf(z); wt > -1 && (we = we.slice(0, wt)); } return we + O; @@ -24454,11 +24454,11 @@ function print() { __p += __j.call(arguments, '') } } var GT = Bc(function(c, h, y) { return c + (y ? " " : "") + h.toUpperCase(); - }), Rg = hw("toUpperCase"); - function f2(c, h, y) { + }), Rg = dw("toUpperCase"); + function l2(c, h, y) { return c = Cr(c), h = y ? r : h, h === r ? vA(c) ? AA(c) : cA(c) : c.match(h) || []; } - var l2 = hr(function(c, h) { + var h2 = hr(function(c, h) { try { return Pn(c, r, h); } catch (y) { @@ -24476,8 +24476,8 @@ function print() { __p += __j.call(arguments, '') } throw new Ui(o); return [y(O[0]), O[1]]; }) : [], hr(function(O) { - for (var q = -1; ++q < h; ) { - var ne = c[q]; + for (var z = -1; ++z < h; ) { + var ne = c[z]; if (Pn(ne[0], this, O)) return Pn(ne[1], this, O); } @@ -24494,18 +24494,18 @@ function print() { __p += __j.call(arguments, '') } function ZT(c, h) { return c == null || c !== c ? h : c; } - var QT = pw(), eR = pw(!0); - function di(c) { + var QT = gw(), eR = gw(!0); + function pi(c) { return c; } function Og(c) { - return Wy(typeof c == "function" ? c : zi(c, p)); + return Hy(typeof c == "function" ? c : zi(c, p)); } function tR(c) { - return Ky(zi(c, p)); + return Vy(zi(c, p)); } function rR(c, h) { - return Vy(c, zi(h, p)); + return Gy(c, zi(h, p)); } var nR = hr(function(c, h) { return function(y) { @@ -24517,15 +24517,15 @@ function print() { __p += __j.call(arguments, '') } }; }); function Ng(c, h, y) { - var O = Mn(h), q = kh(h, O); - y == null && !(Zr(h) && (q.length || !O.length)) && (y = h, h = c, c = this, q = kh(h, Mn(h))); + var O = Mn(h), z = kh(h, O); + y == null && !(Zr(h) && (z.length || !O.length)) && (y = h, h = c, c = this, z = kh(h, Mn(h))); var ne = !(Zr(y) && "chain" in y) || !!y.chain, fe = lo(c); - return ji(q, function(me) { + return ji(z, function(me) { var we = h[me]; c[me] = we, fe && (c.prototype[me] = function() { var We = this.__chain__; if (ne || We) { - var He = c(this.__wrapped__), Xe = He.__actions__ = fi(this.__actions__); + var He = c(this.__wrapped__), Xe = He.__actions__ = li(this.__actions__); return Xe.push({ func: we, args: arguments, thisArg: c }), He.__chain__ = We, He; } return we.apply(c, Ho([this.value()], arguments)); @@ -24539,11 +24539,11 @@ function print() { __p += __j.call(arguments, '') } } function oR(c) { return c = cr(c), hr(function(h) { - return Gy(h, c); + return Yy(h, c); }); } - var aR = hg(Xr), cR = hg(gy), uR = hg($p); - function h2(c) { + var aR = hg(Xr), cR = hg(my), uR = hg($p); + function d2(c) { return yg(c) ? Bp(Rs(c)) : FP(c); } function fR(c) { @@ -24551,7 +24551,7 @@ function print() { __p += __j.call(arguments, '') } return c == null ? r : Ba(c, h); }; } - var lR = mw(), hR = mw(!0); + var lR = vw(), hR = vw(!0); function kg() { return []; } @@ -24572,12 +24572,12 @@ function print() { __p += __j.call(arguments, '') } return []; var y = P, O = Kn(c, P); h = Ut(h), c -= P; - for (var q = Up(O, h); ++y < c; ) + for (var z = Up(O, h); ++y < c; ) h(y); - return q; + return z; } function vR(c) { - return ir(c) ? Xr(c, Rs) : Ii(c) ? [c] : fi(Dw(Cr(c))); + return ir(c) ? Xr(c, Rs) : Ii(c) ? [c] : li(Ow(Cr(c))); } function bR(c) { var h = ++CA; @@ -24589,19 +24589,19 @@ function print() { __p += __j.call(arguments, '') } return c / h; }, 1), _R = dg("floor"); function ER(c) { - return c && c.length ? Lh(c, di, Zp) : r; + return c && c.length ? Lh(c, pi, Zp) : r; } function SR(c, h) { return c && c.length ? Lh(c, Ut(h, 2), Zp) : r; } function AR(c) { - return by(c, di); + return yy(c, pi); } function PR(c, h) { - return by(c, Ut(h, 2)); + return yy(c, Ut(h, 2)); } function MR(c) { - return c && c.length ? Lh(c, di, rg) : r; + return c && c.length ? Lh(c, pi, rg) : r; } function IR(c, h) { return c && c.length ? Lh(c, Ut(h, 2), rg) : r; @@ -24612,12 +24612,12 @@ function print() { __p += __j.call(arguments, '') } return c - h; }, 0); function DR(c) { - return c && c.length ? jp(c, di) : 0; + return c && c.length ? jp(c, pi) : 0; } function OR(c, h) { return c && c.length ? jp(c, Ut(h, 2)) : 0; } - return ee.after = tC, ee.ary = zw, ee.assign = qC, ee.assignIn = n2, ee.assignInWith = td, ee.assignWith = zC, ee.at = WC, ee.before = Ww, ee.bind = Ag, ee.bindAll = YT, ee.bindKey = Hw, ee.castArray = dC, ee.chain = jw, ee.chunk = _M, ee.compact = EM, ee.concat = SM, ee.cond = JT, ee.conforms = XT, ee.constant = Dg, ee.countBy = DI, ee.create = HC, ee.curry = Kw, ee.curryRight = Vw, ee.debounce = Gw, ee.defaults = KC, ee.defaultsDeep = VC, ee.defer = rC, ee.delay = nC, ee.difference = AM, ee.differenceBy = PM, ee.differenceWith = MM, ee.drop = IM, ee.dropRight = CM, ee.dropRightWhile = TM, ee.dropWhile = RM, ee.fill = DM, ee.filter = NI, ee.flatMap = $I, ee.flatMapDeep = BI, ee.flatMapDepth = FI, ee.flatten = kw, ee.flattenDeep = OM, ee.flattenDepth = NM, ee.flip = iC, ee.flow = QT, ee.flowRight = eR, ee.fromPairs = LM, ee.functions = eT, ee.functionsIn = tT, ee.groupBy = jI, ee.initial = $M, ee.intersection = BM, ee.intersectionBy = FM, ee.intersectionWith = jM, ee.invert = nT, ee.invertBy = iT, ee.invokeMap = qI, ee.iteratee = Og, ee.keyBy = zI, ee.keys = Mn, ee.keysIn = hi, ee.map = Yh, ee.mapKeys = oT, ee.mapValues = aT, ee.matches = tR, ee.matchesProperty = rR, ee.memoize = Xh, ee.merge = cT, ee.mergeWith = i2, ee.method = nR, ee.methodOf = iR, ee.mixin = Ng, ee.negate = Zh, ee.nthArg = oR, ee.omit = uT, ee.omitBy = fT, ee.once = sC, ee.orderBy = WI, ee.over = aR, ee.overArgs = oC, ee.overEvery = cR, ee.overSome = uR, ee.partial = Pg, ee.partialRight = Yw, ee.partition = HI, ee.pick = lT, ee.pickBy = s2, ee.property = h2, ee.propertyOf = fR, ee.pull = WM, ee.pullAll = Bw, ee.pullAllBy = HM, ee.pullAllWith = KM, ee.pullAt = VM, ee.range = lR, ee.rangeRight = hR, ee.rearg = aC, ee.reject = GI, ee.remove = GM, ee.rest = cC, ee.reverse = Eg, ee.sampleSize = JI, ee.set = dT, ee.setWith = pT, ee.shuffle = XI, ee.slice = YM, ee.sortBy = eC, ee.sortedUniq = rI, ee.sortedUniqBy = nI, ee.split = $T, ee.spread = uC, ee.tail = iI, ee.take = sI, ee.takeRight = oI, ee.takeRightWhile = aI, ee.takeWhile = cI, ee.tap = EI, ee.throttle = fC, ee.thru = Gh, ee.toArray = e2, ee.toPairs = o2, ee.toPairsIn = a2, ee.toPath = vR, ee.toPlainObject = r2, ee.transform = gT, ee.unary = lC, ee.union = uI, ee.unionBy = fI, ee.unionWith = lI, ee.uniq = hI, ee.uniqBy = dI, ee.uniqWith = pI, ee.unset = mT, ee.unzip = Sg, ee.unzipWith = Fw, ee.update = vT, ee.updateWith = bT, ee.values = Uc, ee.valuesIn = yT, ee.without = gI, ee.words = f2, ee.wrap = hC, ee.xor = mI, ee.xorBy = vI, ee.xorWith = bI, ee.zip = yI, ee.zipObject = wI, ee.zipObjectDeep = xI, ee.zipWith = _I, ee.entries = o2, ee.entriesIn = a2, ee.extend = n2, ee.extendWith = td, Ng(ee, ee), ee.add = yR, ee.attempt = l2, ee.camelCase = ET, ee.capitalize = c2, ee.ceil = wR, ee.clamp = wT, ee.clone = pC, ee.cloneDeep = mC, ee.cloneDeepWith = vC, ee.cloneWith = gC, ee.conformsTo = bC, ee.deburr = u2, ee.defaultTo = ZT, ee.divide = xR, ee.endsWith = ST, ee.eq = ds, ee.escape = AT, ee.escapeRegExp = PT, ee.every = OI, ee.find = LI, ee.findIndex = Nw, ee.findKey = GC, ee.findLast = kI, ee.findLastIndex = Lw, ee.findLastKey = YC, ee.floor = _R, ee.forEach = Uw, ee.forEachRight = qw, ee.forIn = JC, ee.forInRight = XC, ee.forOwn = ZC, ee.forOwnRight = QC, ee.get = Cg, ee.gt = yC, ee.gte = wC, ee.has = rT, ee.hasIn = Tg, ee.head = $w, ee.identity = di, ee.includes = UI, ee.indexOf = kM, ee.inRange = xT, ee.invoke = sT, ee.isArguments = Ua, ee.isArray = ir, ee.isArrayBuffer = xC, ee.isArrayLike = li, ee.isArrayLikeObject = cn, ee.isBoolean = _C, ee.isBuffer = Zo, ee.isDate = EC, ee.isElement = SC, ee.isEmpty = AC, ee.isEqual = PC, ee.isEqualWith = MC, ee.isError = Mg, ee.isFinite = IC, ee.isFunction = lo, ee.isInteger = Jw, ee.isLength = Qh, ee.isMap = Xw, ee.isMatch = CC, ee.isMatchWith = TC, ee.isNaN = RC, ee.isNative = DC, ee.isNil = NC, ee.isNull = OC, ee.isNumber = Zw, ee.isObject = Zr, ee.isObjectLike = en, ee.isPlainObject = pf, ee.isRegExp = Ig, ee.isSafeInteger = LC, ee.isSet = Qw, ee.isString = ed, ee.isSymbol = Ii, ee.isTypedArray = jc, ee.isUndefined = kC, ee.isWeakMap = $C, ee.isWeakSet = BC, ee.join = UM, ee.kebabCase = MT, ee.last = Hi, ee.lastIndexOf = qM, ee.lowerCase = IT, ee.lowerFirst = CT, ee.lt = FC, ee.lte = jC, ee.max = ER, ee.maxBy = SR, ee.mean = AR, ee.meanBy = PR, ee.min = MR, ee.minBy = IR, ee.stubArray = kg, ee.stubFalse = $g, ee.stubObject = dR, ee.stubString = pR, ee.stubTrue = gR, ee.multiply = CR, ee.nth = zM, ee.noConflict = sR, ee.noop = Lg, ee.now = Jh, ee.pad = TT, ee.padEnd = RT, ee.padStart = DT, ee.parseInt = OT, ee.random = _T, ee.reduce = KI, ee.reduceRight = VI, ee.repeat = NT, ee.replace = LT, ee.result = hT, ee.round = TR, ee.runInContext = be, ee.sample = YI, ee.size = ZI, ee.snakeCase = kT, ee.some = QI, ee.sortedIndex = JM, ee.sortedIndexBy = XM, ee.sortedIndexOf = ZM, ee.sortedLastIndex = QM, ee.sortedLastIndexBy = eI, ee.sortedLastIndexOf = tI, ee.startCase = BT, ee.startsWith = FT, ee.subtract = RR, ee.sum = DR, ee.sumBy = OR, ee.template = jT, ee.times = mR, ee.toFinite = ho, ee.toInteger = cr, ee.toLength = t2, ee.toLower = UT, ee.toNumber = Ki, ee.toSafeInteger = UC, ee.toString = Cr, ee.toUpper = qT, ee.trim = zT, ee.trimEnd = WT, ee.trimStart = HT, ee.truncate = KT, ee.unescape = VT, ee.uniqueId = bR, ee.upperCase = GT, ee.upperFirst = Rg, ee.each = Uw, ee.eachRight = qw, ee.first = $w, Ng(ee, function() { + return ee.after = tC, ee.ary = Ww, ee.assign = qC, ee.assignIn = i2, ee.assignInWith = td, ee.assignWith = zC, ee.at = WC, ee.before = Hw, ee.bind = Ag, ee.bindAll = YT, ee.bindKey = Kw, ee.castArray = dC, ee.chain = Uw, ee.chunk = _M, ee.compact = EM, ee.concat = SM, ee.cond = JT, ee.conforms = XT, ee.constant = Dg, ee.countBy = DI, ee.create = HC, ee.curry = Vw, ee.curryRight = Gw, ee.debounce = Yw, ee.defaults = KC, ee.defaultsDeep = VC, ee.defer = rC, ee.delay = nC, ee.difference = AM, ee.differenceBy = PM, ee.differenceWith = MM, ee.drop = IM, ee.dropRight = CM, ee.dropRightWhile = TM, ee.dropWhile = RM, ee.fill = DM, ee.filter = NI, ee.flatMap = $I, ee.flatMapDeep = BI, ee.flatMapDepth = FI, ee.flatten = $w, ee.flattenDeep = OM, ee.flattenDepth = NM, ee.flip = iC, ee.flow = QT, ee.flowRight = eR, ee.fromPairs = LM, ee.functions = eT, ee.functionsIn = tT, ee.groupBy = jI, ee.initial = $M, ee.intersection = BM, ee.intersectionBy = FM, ee.intersectionWith = jM, ee.invert = nT, ee.invertBy = iT, ee.invokeMap = qI, ee.iteratee = Og, ee.keyBy = zI, ee.keys = Mn, ee.keysIn = di, ee.map = Yh, ee.mapKeys = oT, ee.mapValues = aT, ee.matches = tR, ee.matchesProperty = rR, ee.memoize = Xh, ee.merge = cT, ee.mergeWith = s2, ee.method = nR, ee.methodOf = iR, ee.mixin = Ng, ee.negate = Zh, ee.nthArg = oR, ee.omit = uT, ee.omitBy = fT, ee.once = sC, ee.orderBy = WI, ee.over = aR, ee.overArgs = oC, ee.overEvery = cR, ee.overSome = uR, ee.partial = Pg, ee.partialRight = Jw, ee.partition = HI, ee.pick = lT, ee.pickBy = o2, ee.property = d2, ee.propertyOf = fR, ee.pull = WM, ee.pullAll = Fw, ee.pullAllBy = HM, ee.pullAllWith = KM, ee.pullAt = VM, ee.range = lR, ee.rangeRight = hR, ee.rearg = aC, ee.reject = GI, ee.remove = GM, ee.rest = cC, ee.reverse = Eg, ee.sampleSize = JI, ee.set = dT, ee.setWith = pT, ee.shuffle = XI, ee.slice = YM, ee.sortBy = eC, ee.sortedUniq = rI, ee.sortedUniqBy = nI, ee.split = $T, ee.spread = uC, ee.tail = iI, ee.take = sI, ee.takeRight = oI, ee.takeRightWhile = aI, ee.takeWhile = cI, ee.tap = EI, ee.throttle = fC, ee.thru = Gh, ee.toArray = t2, ee.toPairs = a2, ee.toPairsIn = c2, ee.toPath = vR, ee.toPlainObject = n2, ee.transform = gT, ee.unary = lC, ee.union = uI, ee.unionBy = fI, ee.unionWith = lI, ee.uniq = hI, ee.uniqBy = dI, ee.uniqWith = pI, ee.unset = mT, ee.unzip = Sg, ee.unzipWith = jw, ee.update = vT, ee.updateWith = bT, ee.values = Uc, ee.valuesIn = yT, ee.without = gI, ee.words = l2, ee.wrap = hC, ee.xor = mI, ee.xorBy = vI, ee.xorWith = bI, ee.zip = yI, ee.zipObject = wI, ee.zipObjectDeep = xI, ee.zipWith = _I, ee.entries = a2, ee.entriesIn = c2, ee.extend = i2, ee.extendWith = td, Ng(ee, ee), ee.add = yR, ee.attempt = h2, ee.camelCase = ET, ee.capitalize = u2, ee.ceil = wR, ee.clamp = wT, ee.clone = pC, ee.cloneDeep = mC, ee.cloneDeepWith = vC, ee.cloneWith = gC, ee.conformsTo = bC, ee.deburr = f2, ee.defaultTo = ZT, ee.divide = xR, ee.endsWith = ST, ee.eq = ds, ee.escape = AT, ee.escapeRegExp = PT, ee.every = OI, ee.find = LI, ee.findIndex = Lw, ee.findKey = GC, ee.findLast = kI, ee.findLastIndex = kw, ee.findLastKey = YC, ee.floor = _R, ee.forEach = qw, ee.forEachRight = zw, ee.forIn = JC, ee.forInRight = XC, ee.forOwn = ZC, ee.forOwnRight = QC, ee.get = Cg, ee.gt = yC, ee.gte = wC, ee.has = rT, ee.hasIn = Tg, ee.head = Bw, ee.identity = pi, ee.includes = UI, ee.indexOf = kM, ee.inRange = xT, ee.invoke = sT, ee.isArguments = Ua, ee.isArray = ir, ee.isArrayBuffer = xC, ee.isArrayLike = hi, ee.isArrayLikeObject = cn, ee.isBoolean = _C, ee.isBuffer = Zo, ee.isDate = EC, ee.isElement = SC, ee.isEmpty = AC, ee.isEqual = PC, ee.isEqualWith = MC, ee.isError = Mg, ee.isFinite = IC, ee.isFunction = lo, ee.isInteger = Xw, ee.isLength = Qh, ee.isMap = Zw, ee.isMatch = CC, ee.isMatchWith = TC, ee.isNaN = RC, ee.isNative = DC, ee.isNil = NC, ee.isNull = OC, ee.isNumber = Qw, ee.isObject = Zr, ee.isObjectLike = en, ee.isPlainObject = pf, ee.isRegExp = Ig, ee.isSafeInteger = LC, ee.isSet = e2, ee.isString = ed, ee.isSymbol = Ii, ee.isTypedArray = jc, ee.isUndefined = kC, ee.isWeakMap = $C, ee.isWeakSet = BC, ee.join = UM, ee.kebabCase = MT, ee.last = Hi, ee.lastIndexOf = qM, ee.lowerCase = IT, ee.lowerFirst = CT, ee.lt = FC, ee.lte = jC, ee.max = ER, ee.maxBy = SR, ee.mean = AR, ee.meanBy = PR, ee.min = MR, ee.minBy = IR, ee.stubArray = kg, ee.stubFalse = $g, ee.stubObject = dR, ee.stubString = pR, ee.stubTrue = gR, ee.multiply = CR, ee.nth = zM, ee.noConflict = sR, ee.noop = Lg, ee.now = Jh, ee.pad = TT, ee.padEnd = RT, ee.padStart = DT, ee.parseInt = OT, ee.random = _T, ee.reduce = KI, ee.reduceRight = VI, ee.repeat = NT, ee.replace = LT, ee.result = hT, ee.round = TR, ee.runInContext = be, ee.sample = YI, ee.size = ZI, ee.snakeCase = kT, ee.some = QI, ee.sortedIndex = JM, ee.sortedIndexBy = XM, ee.sortedIndexOf = ZM, ee.sortedLastIndex = QM, ee.sortedLastIndexBy = eI, ee.sortedLastIndexOf = tI, ee.startCase = BT, ee.startsWith = FT, ee.subtract = RR, ee.sum = DR, ee.sumBy = OR, ee.template = jT, ee.times = mR, ee.toFinite = ho, ee.toInteger = cr, ee.toLength = r2, ee.toLower = UT, ee.toNumber = Ki, ee.toSafeInteger = UC, ee.toString = Cr, ee.toUpper = qT, ee.trim = zT, ee.trimEnd = WT, ee.trimStart = HT, ee.truncate = KT, ee.unescape = VT, ee.uniqueId = bR, ee.upperCase = GT, ee.upperFirst = Rg, ee.each = qw, ee.eachRight = zw, ee.first = Bw, Ng(ee, function() { var c = {}; return Cs(ee, function(h, y) { Tr.call(ee.prototype, y) || (c[y] = h); @@ -24637,10 +24637,10 @@ function print() { __p += __j.call(arguments, '') } }; }), ji(["filter", "map", "takeWhile"], function(c, h) { var y = h + 1, O = y == f || y == b; - wr.prototype[c] = function(q) { + wr.prototype[c] = function(z) { var ne = this.clone(); return ne.__iteratees__.push({ - iteratee: Ut(q, 3), + iteratee: Ut(z, 3), type: y }), ne.__filtered__ = ne.__filtered__ || O, ne; }; @@ -24655,7 +24655,7 @@ function print() { __p += __j.call(arguments, '') } return this.__filtered__ ? new wr(this) : this[y](1); }; }), wr.prototype.compact = function() { - return this.filter(di); + return this.filter(pi); }, wr.prototype.find = function(c) { return this.filter(c).head(); }, wr.prototype.findLast = function(c) { @@ -24675,10 +24675,10 @@ function print() { __p += __j.call(arguments, '') } }, wr.prototype.toArray = function() { return this.take(P); }, Cs(wr.prototype, function(c, h) { - var y = /^(?:filter|find|map|reject)|While$/.test(h), O = /^(?:head|last)$/.test(h), q = ee[O ? "take" + (h == "last" ? "Right" : "") : h], ne = O || /^find/.test(h); - q && (ee.prototype[h] = function() { + var y = /^(?:filter|find|map|reject)|While$/.test(h), O = /^(?:head|last)$/.test(h), z = ee[O ? "take" + (h == "last" ? "Right" : "") : h], ne = O || /^find/.test(h); + z && (ee.prototype[h] = function() { var fe = this.__wrapped__, me = O ? [1] : arguments, we = fe instanceof wr, We = me[0], He = we || ir(fe), Xe = function(vr) { - var Er = q.apply(ee, Ho([vr], me)); + var Er = z.apply(ee, Ho([vr], me)); return O && wt ? Er[0] : Er; }; He && y && typeof We == "function" && We.length != 1 && (we = He = !1); @@ -24693,13 +24693,13 @@ function print() { __p += __j.call(arguments, '') } }), ji(["pop", "push", "shift", "sort", "splice", "unshift"], function(c) { var h = wh[c], y = /^(?:push|sort|unshift)$/.test(c) ? "tap" : "thru", O = /^(?:pop|shift)$/.test(c); ee.prototype[c] = function() { - var q = arguments; + var z = arguments; if (O && !this.__chain__) { var ne = this.value(); - return h.apply(ir(ne) ? ne : [], q); + return h.apply(ir(ne) ? ne : [], z); } return this[y](function(fe) { - return h.apply(ir(fe) ? fe : [], q); + return h.apply(ir(fe) ? fe : [], z); }); }; }), Cs(wr.prototype, function(c, h) { @@ -24708,7 +24708,7 @@ function print() { __p += __j.call(arguments, '') } var O = y.name + ""; Tr.call(Lc, O) || (Lc[O] = []), Lc[O].push({ name: h, func: y }); } - }), Lc[Uh(r, B).name] = [{ + }), Lc[Uh(r, $).name] = [{ name: "wrapper", func: r }], wr.prototype.clone = VA, wr.prototype.reverse = GA, wr.prototype.value = YA, ee.prototype.at = SI, ee.prototype.chain = AI, ee.prototype.commit = PI, ee.prototype.next = MI, ee.prototype.plant = CI, ee.prototype.reverse = TI, ee.prototype.toJSON = ee.prototype.valueOf = ee.prototype.value = RI, ee.prototype.first = ee.prototype.head, ef && (ee.prototype[ef] = II), ee; @@ -24829,11 +24829,11 @@ var ZV = h0.exports, O1 = { exports: {} }; }; }); } - function B(f) { + function $(f) { var g = new FileReader(), b = L(g); return g.readAsArrayBuffer(f), b; } - function $(f) { + function B(f) { var g = new FileReader(), b = L(g); return g.readAsText(f), b; } @@ -24842,7 +24842,7 @@ var ZV = h0.exports, O1 = { exports: {} }; b[x] = String.fromCharCode(g[x]); return b.join(""); } - function W(f) { + function U(f) { if (f.slice) return f.slice(0); var g = new Uint8Array(f.byteLength); @@ -24850,7 +24850,7 @@ var ZV = h0.exports, O1 = { exports: {} }; } function V() { return this.bodyUsed = !1, this._initBody = function(f) { - this._bodyInit = f, f ? typeof f == "string" ? this._bodyText = f : a.blob && Blob.prototype.isPrototypeOf(f) ? this._bodyBlob = f : a.formData && FormData.prototype.isPrototypeOf(f) ? this._bodyFormData = f : a.searchParams && URLSearchParams.prototype.isPrototypeOf(f) ? this._bodyText = f.toString() : a.arrayBuffer && a.blob && u(f) ? (this._bodyArrayBuffer = W(f.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(f) || d(f)) ? this._bodyArrayBuffer = W(f) : this._bodyText = f = Object.prototype.toString.call(f) : this._bodyText = "", this.headers.get("content-type") || (typeof f == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : a.searchParams && URLSearchParams.prototype.isPrototypeOf(f) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8")); + this._bodyInit = f, f ? typeof f == "string" ? this._bodyText = f : a.blob && Blob.prototype.isPrototypeOf(f) ? this._bodyBlob = f : a.formData && FormData.prototype.isPrototypeOf(f) ? this._bodyFormData = f : a.searchParams && URLSearchParams.prototype.isPrototypeOf(f) ? this._bodyText = f.toString() : a.arrayBuffer && a.blob && u(f) ? (this._bodyArrayBuffer = U(f.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(f) || d(f)) ? this._bodyArrayBuffer = U(f) : this._bodyText = f = Object.prototype.toString.call(f) : this._bodyText = "", this.headers.get("content-type") || (typeof f == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : a.searchParams && URLSearchParams.prototype.isPrototypeOf(f) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8")); }, a.blob && (this.blob = function() { var f = N(this); if (f) @@ -24863,13 +24863,13 @@ var ZV = h0.exports, O1 = { exports: {} }; throw new Error("could not read FormData body as blob"); return Promise.resolve(new Blob([this._bodyText])); }, this.arrayBuffer = function() { - return this._bodyArrayBuffer ? N(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(B); + return this._bodyArrayBuffer ? N(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then($); }), this.text = function() { var f = N(this); if (f) return f; if (this._bodyBlob) - return $(this._bodyBlob); + return B(this._bodyBlob); if (this._bodyArrayBuffer) return Promise.resolve(H(this._bodyArrayBuffer)); if (this._bodyFormData) @@ -24989,16 +24989,16 @@ var ZV = h0.exports, O1 = { exports: {} }; e = i.fetch, e.default = i.fetch, e.fetch = i.fetch, e.Headers = i.Headers, e.Request = i.Request, e.Response = i.Response, t.exports = e; })(O1, O1.exports); var QV = O1.exports; -const $3 = /* @__PURE__ */ ts(QV); -var eG = Object.defineProperty, tG = Object.defineProperties, rG = Object.getOwnPropertyDescriptors, B3 = Object.getOwnPropertySymbols, nG = Object.prototype.hasOwnProperty, iG = Object.prototype.propertyIsEnumerable, F3 = (t, e, r) => e in t ? eG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, j3 = (t, e) => { - for (var r in e || (e = {})) nG.call(e, r) && F3(t, r, e[r]); - if (B3) for (var r of B3(e)) iG.call(e, r) && F3(t, r, e[r]); +const B3 = /* @__PURE__ */ ts(QV); +var eG = Object.defineProperty, tG = Object.defineProperties, rG = Object.getOwnPropertyDescriptors, F3 = Object.getOwnPropertySymbols, nG = Object.prototype.hasOwnProperty, iG = Object.prototype.propertyIsEnumerable, j3 = (t, e, r) => e in t ? eG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, U3 = (t, e) => { + for (var r in e || (e = {})) nG.call(e, r) && j3(t, r, e[r]); + if (F3) for (var r of F3(e)) iG.call(e, r) && j3(t, r, e[r]); return t; -}, U3 = (t, e) => tG(t, rG(e)); -const sG = { Accept: "application/json", "Content-Type": "application/json" }, oG = "POST", q3 = { headers: sG, method: oG }, z3 = 10; +}, q3 = (t, e) => tG(t, rG(e)); +const sG = { Accept: "application/json", "Content-Type": "application/json" }, oG = "POST", z3 = { headers: sG, method: oG }, W3 = 10; let As = class { constructor(e, r = !1) { - if (this.url = e, this.disableProviderPing = r, this.events = new rs.EventEmitter(), this.isAvailable = !1, this.registering = !1, !u3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); + if (this.url = e, this.disableProviderPing = r, this.events = new rs.EventEmitter(), this.isAvailable = !1, this.registering = !1, !f3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); this.url = e, this.disableProviderPing = r; } get connected() { @@ -25029,14 +25029,14 @@ let As = class { async send(e) { this.isAvailable || await this.register(); try { - const r = $o(e), n = await (await $3(this.url, U3(j3({}, q3), { body: r }))).json(); + const r = $o(e), n = await (await B3(this.url, q3(U3({}, z3), { body: r }))).json(); this.onPayload({ data: n }); } catch (r) { this.onError(e.id, r); } } async register(e = this.url) { - if (!u3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); + if (!f3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); if (this.registering) { const r = this.events.getMaxListeners(); return (this.events.listenerCount("register_error") >= r || this.events.listenerCount("open") >= r) && this.events.setMaxListeners(r + 1), new Promise((n, i) => { @@ -25052,7 +25052,7 @@ let As = class { try { if (!this.disableProviderPing) { const r = $o({ id: 1, jsonrpc: "2.0", method: "test", params: [] }); - await $3(e, U3(j3({}, q3), { body: r })); + await B3(e, q3(U3({}, z3), { body: r })); } this.onOpen(); } catch (r) { @@ -25076,27 +25076,27 @@ let As = class { this.events.emit("payload", s); } parseError(e, r = this.url) { - return X8(e, r, "HTTP"); + return Z8(e, r, "HTTP"); } resetMaxListeners() { - this.events.getMaxListeners() > z3 && this.events.setMaxListeners(z3); + this.events.getMaxListeners() > W3 && this.events.setMaxListeners(W3); } }; -const W3 = "error", aG = "wss://relay.walletconnect.org", cG = "wc", uG = "universal_provider", H3 = `${cG}@2:${uG}:`, xE = "https://rpc.walletconnect.org/v1/", Xc = "generic", fG = `${xE}bundler`, cs = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; -var lG = Object.defineProperty, hG = Object.defineProperties, dG = Object.getOwnPropertyDescriptors, K3 = Object.getOwnPropertySymbols, pG = Object.prototype.hasOwnProperty, gG = Object.prototype.propertyIsEnumerable, V3 = (t, e, r) => e in t ? lG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ld = (t, e) => { - for (var r in e || (e = {})) pG.call(e, r) && V3(t, r, e[r]); - if (K3) for (var r of K3(e)) gG.call(e, r) && V3(t, r, e[r]); +const H3 = "error", aG = "wss://relay.walletconnect.org", cG = "wc", uG = "universal_provider", K3 = `${cG}@2:${uG}:`, _E = "https://rpc.walletconnect.org/v1/", Xc = "generic", fG = `${_E}bundler`, cs = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; +var lG = Object.defineProperty, hG = Object.defineProperties, dG = Object.getOwnPropertyDescriptors, V3 = Object.getOwnPropertySymbols, pG = Object.prototype.hasOwnProperty, gG = Object.prototype.propertyIsEnumerable, G3 = (t, e, r) => e in t ? lG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ld = (t, e) => { + for (var r in e || (e = {})) pG.call(e, r) && G3(t, r, e[r]); + if (V3) for (var r of V3(e)) gG.call(e, r) && G3(t, r, e[r]); return t; }, mG = (t, e) => hG(t, dG(e)); function Ni(t, e, r) { var n; const i = hu(t); - return ((n = e.rpcMap) == null ? void 0 : n[i.reference]) || `${xE}?chainId=${i.namespace}:${i.reference}&projectId=${r}`; + return ((n = e.rpcMap) == null ? void 0 : n[i.reference]) || `${_E}?chainId=${i.namespace}:${i.reference}&projectId=${r}`; } function Sc(t) { return t.includes(":") ? t.split(":")[1] : t; } -function _E(t) { +function EE(t) { return t.map((e) => `${e.split(":")[0]}:${e.split(":")[1]}`); } function vG(t, e) { @@ -25109,15 +25109,15 @@ function vG(t, e) { }), n; } function bm(t = {}, e = {}) { - const r = G3(t), n = G3(e); + const r = Y3(t), n = Y3(e); return ZV.merge(r, n); } -function G3(t) { +function Y3(t) { var e, r, n, i; const s = {}; if (!Sl(t)) return s; for (const [o, a] of Object.entries(t)) { - const u = cb(o) ? [o] : a.chains, l = a.methods || [], d = a.events || [], p = a.rpcMap || {}, w = Ff(o); + const u = ub(o) ? [o] : a.chains, l = a.methods || [], d = a.events || [], p = a.rpcMap || {}, w = Ff(o); s[w] = mG(ld(ld({}, s[w]), a), { chains: Id(u, (e = s[w]) == null ? void 0 : e.chains), methods: Id(l, (r = s[w]) == null ? void 0 : r.methods), events: Id(d, (n = s[w]) == null ? void 0 : n.events), rpcMap: ld(ld({}, p), (i = s[w]) == null ? void 0 : i.rpcMap) }); } return s; @@ -25125,10 +25125,10 @@ function G3(t) { function bG(t) { return t.includes(":") ? t.split(":")[2] : t; } -function Y3(t) { +function J3(t) { const e = {}; for (const [r, n] of Object.entries(t)) { - const i = n.methods || [], s = n.events || [], o = n.accounts || [], a = cb(r) ? [r] : n.chains ? n.chains : _E(n.accounts); + const i = n.methods || [], s = n.events || [], o = n.accounts || [], a = ub(r) ? [r] : n.chains ? n.chains : EE(n.accounts); e[r] = { chains: a, methods: i, events: s, accounts: o }; } return e; @@ -25136,8 +25136,8 @@ function Y3(t) { function ym(t) { return typeof t == "number" ? t : t.includes("0x") ? parseInt(t, 16) : (t = t.includes(":") ? t.split(":")[1] : t, isNaN(Number(t)) ? t : Number(t)); } -const EE = {}, Ar = (t) => EE[t], wm = (t, e) => { - EE[t] = e; +const SE = {}, Ar = (t) => SE[t], wm = (t, e) => { + SE[t] = e; }; class yG { constructor(e) { @@ -25189,11 +25189,11 @@ class yG { return new as(new As(n, Ar("disableProviderPing"))); } } -var wG = Object.defineProperty, xG = Object.defineProperties, _G = Object.getOwnPropertyDescriptors, J3 = Object.getOwnPropertySymbols, EG = Object.prototype.hasOwnProperty, SG = Object.prototype.propertyIsEnumerable, X3 = (t, e, r) => e in t ? wG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Z3 = (t, e) => { - for (var r in e || (e = {})) EG.call(e, r) && X3(t, r, e[r]); - if (J3) for (var r of J3(e)) SG.call(e, r) && X3(t, r, e[r]); +var wG = Object.defineProperty, xG = Object.defineProperties, _G = Object.getOwnPropertyDescriptors, X3 = Object.getOwnPropertySymbols, EG = Object.prototype.hasOwnProperty, SG = Object.prototype.propertyIsEnumerable, Z3 = (t, e, r) => e in t ? wG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Q3 = (t, e) => { + for (var r in e || (e = {})) EG.call(e, r) && Z3(t, r, e[r]); + if (X3) for (var r of X3(e)) SG.call(e, r) && Z3(t, r, e[r]); return t; -}, Q3 = (t, e) => xG(t, _G(e)); +}, e_ = (t, e) => xG(t, _G(e)); class AG { constructor(e) { this.name = "eip155", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.httpProviders = this.createHttpProviders(), this.chainId = parseInt(this.getDefaultChain()); @@ -25278,7 +25278,7 @@ class AG { if (a != null && a[s]) return a == null ? void 0 : a[s]; const u = await this.client.request(e); try { - await this.client.session.update(e.topic, { sessionProperties: Q3(Z3({}, o.sessionProperties || {}), { capabilities: Q3(Z3({}, a || {}), { [s]: u }) }) }); + await this.client.session.update(e.topic, { sessionProperties: e_(Q3({}, o.sessionProperties || {}), { capabilities: e_(Q3({}, a || {}), { [s]: u }) }) }); } catch (l) { console.warn("Failed to update session with capabilities", l); } @@ -25772,17 +25772,17 @@ class NG { return new as(new As(n, Ar("disableProviderPing"))); } } -var LG = Object.defineProperty, kG = Object.defineProperties, $G = Object.getOwnPropertyDescriptors, e_ = Object.getOwnPropertySymbols, BG = Object.prototype.hasOwnProperty, FG = Object.prototype.propertyIsEnumerable, t_ = (t, e, r) => e in t ? LG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, hd = (t, e) => { - for (var r in e || (e = {})) BG.call(e, r) && t_(t, r, e[r]); - if (e_) for (var r of e_(e)) FG.call(e, r) && t_(t, r, e[r]); +var LG = Object.defineProperty, kG = Object.defineProperties, $G = Object.getOwnPropertyDescriptors, t_ = Object.getOwnPropertySymbols, BG = Object.prototype.hasOwnProperty, FG = Object.prototype.propertyIsEnumerable, r_ = (t, e, r) => e in t ? LG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, hd = (t, e) => { + for (var r in e || (e = {})) BG.call(e, r) && r_(t, r, e[r]); + if (t_) for (var r of t_(e)) FG.call(e, r) && r_(t, r, e[r]); return t; }, xm = (t, e) => kG(t, $G(e)); -let N1 = class SE { +let N1 = class AE { constructor(e) { - this.events = new $v(), this.rpcProviders = {}, this.shouldAbortPairingAttempt = !1, this.maxPairingAttempts = 10, this.disableProviderPing = !1, this.providerOpts = e, this.logger = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : ql($0({ level: (e == null ? void 0 : e.logger) || W3 })), this.disableProviderPing = (e == null ? void 0 : e.disableProviderPing) || !1; + this.events = new Bv(), this.rpcProviders = {}, this.shouldAbortPairingAttempt = !1, this.maxPairingAttempts = 10, this.disableProviderPing = !1, this.providerOpts = e, this.logger = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : ql($0({ level: (e == null ? void 0 : e.logger) || H3 })), this.disableProviderPing = (e == null ? void 0 : e.disableProviderPing) || !1; } static async init(e) { - const r = new SE(e); + const r = new AE(e); return await r.initialize(), r; } async request(e, r, n) { @@ -25814,7 +25814,7 @@ let N1 = class SE { n && (this.uri = n, this.events.emit("display_uri", n)); const s = await i(); if (this.session = s.session, this.session) { - const o = Y3(this.session.namespaces); + const o = J3(this.session.namespaces); this.namespaces = bm(this.namespaces, o), this.persist("namespaces", this.namespaces), this.onConnect(); } return s; @@ -25843,10 +25843,10 @@ let N1 = class SE { const { uri: n, approval: i } = await this.client.connect({ pairingTopic: e, requiredNamespaces: this.namespaces, optionalNamespaces: this.optionalNamespaces, sessionProperties: this.sessionProperties }); n && (this.uri = n, this.events.emit("display_uri", n)), await i().then((s) => { this.session = s; - const o = Y3(s.namespaces); + const o = J3(s.namespaces); this.namespaces = bm(this.namespaces, o), this.persist("namespaces", this.namespaces); }).catch((s) => { - if (s.message !== wE) throw s; + if (s.message !== xE) throw s; r++; }); } while (!this.session); @@ -25882,7 +25882,7 @@ let N1 = class SE { this.logger.trace("Initialized"), await this.createClient(), await this.checkStorage(), this.registerEventListeners(); } async createClient() { - this.client = this.providerOpts.client || await pb.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || W3, relayUrl: this.providerOpts.relayUrl || aG, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); + this.client = this.providerOpts.client || await gb.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || H3, relayUrl: this.providerOpts.relayUrl || aG, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); } createProviders() { if (!this.client) throw new Error("Sign Client not initialized"); @@ -25890,7 +25890,7 @@ let N1 = class SE { const e = [...new Set(Object.keys(this.session.namespaces).map((r) => Ff(r)))]; wm("client", this.client), wm("events", this.events), wm("disableProviderPing", this.disableProviderPing), e.forEach((r) => { if (!this.session) return; - const n = vG(r, this.session), i = _E(n), s = bm(this.namespaces, this.optionalNamespaces), o = xm(hd({}, s[r]), { accounts: n, chains: i }); + const n = vG(r, this.session), i = EE(n), s = bm(this.namespaces, this.optionalNamespaces), o = xm(hd({}, s[r]), { accounts: n, chains: i }); switch (r) { case "eip155": this.rpcProviders[r] = new AG({ namespace: o }); @@ -25988,10 +25988,10 @@ let N1 = class SE { this.session = void 0, this.namespaces = void 0, this.optionalNamespaces = void 0, this.sessionProperties = void 0, this.persist("namespaces", void 0), this.persist("optionalNamespaces", void 0), this.persist("sessionProperties", void 0), await this.cleanupPendingPairings({ deletePairings: !0 }); } persist(e, r) { - this.client.core.storage.setItem(`${H3}/${e}`, r); + this.client.core.storage.setItem(`${K3}/${e}`, r); } async getFromStore(e) { - return await this.client.core.storage.getItem(`${H3}/${e}`); + return await this.client.core.storage.getItem(`${K3}/${e}`); } }; const jG = N1; @@ -26131,13 +26131,13 @@ const fn = { standard: "EIP-3085", message: "Unrecognized chain ID." } -}, AE = "Unspecified error message.", qG = "Unspecified server error."; -function gb(t, e = AE) { +}, PE = "Unspecified error message.", qG = "Unspecified server error."; +function mb(t, e = PE) { if (t && Number.isInteger(t)) { const r = t.toString(); if (k1(L1, r)) return L1[r].message; - if (PE(t)) + if (ME(t)) return qG; } return e; @@ -26146,27 +26146,27 @@ function zG(t) { if (!Number.isInteger(t)) return !1; const e = t.toString(); - return !!(L1[e] || PE(t)); + return !!(L1[e] || ME(t)); } function WG(t, { shouldIncludeStack: e = !1 } = {}) { const r = {}; if (t && typeof t == "object" && !Array.isArray(t) && k1(t, "code") && zG(t.code)) { const n = t; - r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, k1(n, "data") && (r.data = n.data)) : (r.message = gb(r.code), r.data = { originalError: r_(t) }); + r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, k1(n, "data") && (r.data = n.data)) : (r.message = mb(r.code), r.data = { originalError: n_(t) }); } else - r.code = fn.rpc.internal, r.message = n_(t, "message") ? t.message : AE, r.data = { originalError: r_(t) }; - return e && (r.stack = n_(t, "stack") ? t.stack : void 0), r; + r.code = fn.rpc.internal, r.message = i_(t, "message") ? t.message : PE, r.data = { originalError: n_(t) }; + return e && (r.stack = i_(t, "stack") ? t.stack : void 0), r; } -function PE(t) { +function ME(t) { return t >= -32099 && t <= -32e3; } -function r_(t) { +function n_(t) { return t && typeof t == "object" && !Array.isArray(t) ? Object.assign({}, t) : t; } function k1(t, e) { return Object.prototype.hasOwnProperty.call(t, e); } -function n_(t, e) { +function i_(t, e) { return typeof t == "object" && t !== null && e in t && typeof t[e] == "string"; } const Sr = { @@ -26204,19 +26204,19 @@ const Sr = { const { code: e, message: r, data: n } = t; if (!r || typeof r != "string") throw new Error('"message" must be a nonempty string'); - return new CE(e, r, n); + return new TE(e, r, n); } } }; function Gi(t, e) { - const [r, n] = ME(e); - return new IE(t, r || gb(t), n); + const [r, n] = IE(e); + return new CE(t, r || mb(t), n); } function Vc(t, e) { - const [r, n] = ME(e); - return new CE(t, r || gb(t), n); + const [r, n] = IE(e); + return new TE(t, r || mb(t), n); } -function ME(t) { +function IE(t) { if (t) { if (typeof t == "string") return [t]; @@ -26229,7 +26229,7 @@ function ME(t) { } return []; } -class IE extends Error { +class CE extends Error { constructor(e, r, n) { if (!Number.isInteger(e)) throw new Error('"code" must be an integer.'); @@ -26238,7 +26238,7 @@ class IE extends Error { super(r), this.code = e, n !== void 0 && (this.data = n); } } -class CE extends IE { +class TE extends CE { /** * Create an Ethereum Provider JSON-RPC error. * `code` must be an integer in the 1000 <= 4999 range. @@ -26252,18 +26252,18 @@ class CE extends IE { function HG(t) { return Number.isInteger(t) && t >= 1e3 && t <= 4999; } -function mb() { +function vb() { return (t) => t; } -const Al = mb(), KG = mb(), VG = mb(); +const Al = vb(), KG = vb(), VG = vb(); function _o(t) { return Math.floor(t); } -const TE = /^[0-9]*$/, RE = /^[a-f0-9]*$/; +const RE = /^[0-9]*$/, DE = /^[a-f0-9]*$/; function Qa(t) { - return vb(crypto.getRandomValues(new Uint8Array(t))); + return bb(crypto.getRandomValues(new Uint8Array(t))); } -function vb(t) { +function bb(t) { return [...t].map((e) => e.toString(16).padStart(2, "0")).join(""); } function Dd(t) { @@ -26282,38 +26282,38 @@ function $s(t) { function pa(t) { return Al(`0x${BigInt(t).toString(16)}`); } -function DE(t) { +function OE(t) { return t.startsWith("0x") || t.startsWith("0X"); } -function bb(t) { - return DE(t) ? t.slice(2) : t; +function yb(t) { + return OE(t) ? t.slice(2) : t; } -function OE(t) { - return DE(t) ? `0x${t.slice(2)}` : `0x${t}`; +function NE(t) { + return OE(t) ? `0x${t.slice(2)}` : `0x${t}`; } function ap(t) { if (typeof t != "string") return !1; - const e = bb(t).toLowerCase(); - return RE.test(e); + const e = yb(t).toLowerCase(); + return DE.test(e); } function GG(t, e = !1) { if (typeof t == "string") { - const r = bb(t).toLowerCase(); - if (RE.test(r)) + const r = yb(t).toLowerCase(); + if (DE.test(r)) return Al(e ? `0x${r}` : r); } throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`); } -function yb(t, e = !1) { +function wb(t, e = !1) { let r = GG(t, !1); return r.length % 2 === 1 && (r = Al(`0${r}`)), e ? Al(`0x${r}`) : r; } function ra(t) { if (typeof t == "string") { - const e = bb(t).toLowerCase(); + const e = yb(t).toLowerCase(); if (ap(e) && e.length === 40) - return KG(OE(e)); + return KG(NE(e)); } throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`); } @@ -26322,7 +26322,7 @@ function $1(t) { return t; if (typeof t == "string") { if (ap(t)) { - const e = yb(t, !1); + const e = wb(t, !1); return Buffer.from(e, "hex"); } return Buffer.from(t, "utf8"); @@ -26333,10 +26333,10 @@ function Kf(t) { if (typeof t == "number" && Number.isInteger(t)) return _o(t); if (typeof t == "string") { - if (TE.test(t)) + if (RE.test(t)) return _o(Number(t)); if (ap(t)) - return _o(Number(BigInt(yb(t, !0)))); + return _o(Number(BigInt(wb(t, !0)))); } throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`); } @@ -26346,10 +26346,10 @@ function Rf(t) { if (typeof t == "number") return BigInt(Kf(t)); if (typeof t == "string") { - if (TE.test(t)) + if (RE.test(t)) return BigInt(t); if (ap(t)) - return BigInt(yb(t, !0)); + return BigInt(wb(t, !0)); } throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`); } @@ -26395,7 +26395,7 @@ async function eY(t, { iv: e, cipherText: r }) { }, t, r); return new TextDecoder().decode(n); } -function NE(t) { +function LE(t) { switch (t) { case "public": return "spki"; @@ -26403,12 +26403,12 @@ function NE(t) { return "pkcs8"; } } -async function LE(t, e) { - const r = NE(t), n = await crypto.subtle.exportKey(r, e); - return vb(new Uint8Array(n)); -} async function kE(t, e) { - const r = NE(t), n = Dd(e).buffer; + const r = LE(t), n = await crypto.subtle.exportKey(r, e); + return bb(new Uint8Array(n)); +} +async function $E(t, e) { + const r = LE(t), n = Dd(e).buffer; return await crypto.subtle.importKey(r, new Uint8Array(n), { name: "ECDH", namedCurve: "P-256" @@ -26467,15 +26467,15 @@ class nY { // storage methods async loadKey(e) { const r = this.storage.getItem(e.storageKey); - return r ? kE(e.keyType, r) : null; + return r ? $E(e.keyType, r) : null; } async storeKey(e, r) { - const n = await LE(e.keyType, r); + const n = await kE(e.keyType, r); this.storage.setItem(e.storageKey, n); } } -const nh = "4.2.4", $E = "@coinbase/wallet-sdk"; -async function BE(t, e) { +const nh = "4.2.4", BE = "@coinbase/wallet-sdk"; +async function FE(t, e) { const r = Object.assign(Object.assign({}, t), { jsonrpc: "2.0", id: crypto.randomUUID() }), n = await window.fetch(e, { method: "POST", body: JSON.stringify(r), @@ -26483,7 +26483,7 @@ async function BE(t, e) { headers: { "Content-Type": "application/json", "X-Cbw-Sdk-Version": nh, - "X-Cbw-Sdk-Platform": $E + "X-Cbw-Sdk-Platform": BE } }), { result: i, error: s } = await n.json(); if (s) @@ -26539,11 +26539,11 @@ function aY(t) { throw Sr.provider.unsupportedMethod(); } } -const i_ = "accounts", s_ = "activeChain", o_ = "availableChains", a_ = "walletCapabilities"; +const s_ = "accounts", o_ = "activeChain", a_ = "availableChains", c_ = "walletCapabilities"; class cY { constructor(e) { var r, n, i; - this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new nY(), this.storage = new eo("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(i_)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(s_) || { + this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new nY(), this.storage = new eo("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(s_)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(o_) || { id: (i = (n = e.metadata.appChainIds) === null || n === void 0 ? void 0 : n[0]) !== null && i !== void 0 ? i : 1 }, this.handshake = this.handshake.bind(this), this.request = this.request.bind(this), this.createRequestMessage = this.createRequestMessage.bind(this), this.decryptResponseMessage = this.decryptResponseMessage.bind(this); } @@ -26557,13 +26557,13 @@ class cY { }), s = await this.communicator.postRequestAndWaitForResponse(i); if ("failure" in s.content) throw s.content.failure; - const o = await kE("public", s.sender); + const o = await $E("public", s.sender); await this.keyManager.setPeerPublicKey(o); const u = (await this.decryptResponseMessage(s)).result; if ("error" in u) throw u.error; const l = u.value; - this.accounts = l, this.storage.storeObject(i_, l), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", l); + this.accounts = l, this.storage.storeObject(s_, l), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", l); } async request(e) { var r; @@ -26581,7 +26581,7 @@ class cY { case "eth_chainId": return pa(this.chain.id); case "wallet_getCapabilities": - return this.storage.loadObject(a_); + return this.storage.loadObject(c_); case "wallet_switchEthereumChain": return this.handleSwitchChainRequest(e); case "eth_ecRecover": @@ -26602,7 +26602,7 @@ class cY { default: if (!this.chain.rpcUrl) throw Sr.rpc.internal("No RPC URL set for chain"); - return BE(e, this.chain.rpcUrl); + return FE(e, this.chain.rpcUrl); } } async sendRequestToPopup(e) { @@ -26645,7 +26645,7 @@ class cY { return this.communicator.postRequestAndWaitForResponse(i); } async createRequestMessage(e) { - const r = await LE("public", await this.keyManager.getOwnPublicKey()); + const r = await kE("public", await this.keyManager.getOwnPublicKey()); return { id: crypto.randomUUID(), sender: r, @@ -26667,25 +26667,25 @@ class cY { id: Number(d), rpcUrl: p })); - this.storage.storeObject(o_, l), this.updateChain(this.chain.id, l); + this.storage.storeObject(a_, l), this.updateChain(this.chain.id, l); } const u = (n = o.data) === null || n === void 0 ? void 0 : n.capabilities; - return u && this.storage.storeObject(a_, u), o; + return u && this.storage.storeObject(c_, u), o; } updateChain(e, r) { var n; - const i = r ?? this.storage.loadObject(o_), s = i == null ? void 0 : i.find((o) => o.id === e); - return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(s_, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(s.id))), !0) : !1; + const i = r ?? this.storage.loadObject(a_), s = i == null ? void 0 : i.find((o) => o.id === e); + return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(o_, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(s.id))), !0) : !1; } } -const uY = /* @__PURE__ */ yv(UD), { keccak_256: fY } = uY; -function FE(t) { +const uY = /* @__PURE__ */ wv(UD), { keccak_256: fY } = uY; +function jE(t) { return Buffer.allocUnsafe(t).fill(0); } function lY(t) { return t.toString(2).length; } -function jE(t, e) { +function UE(t, e) { let r = t.toString(16); r.length % 2 !== 0 && (r = "0" + r); const n = r.match(/.{1,2}/g).map((i) => parseInt(i, 16)); @@ -26703,25 +26703,25 @@ function hY(t, e) { n = t; return n &= (1n << BigInt(e)) - 1n, n; } -function UE(t, e, r) { - const n = FE(e); +function qE(t, e, r) { + const n = jE(e); return t = cp(t), r ? t.length < e ? (t.copy(n), n) : t.slice(0, e) : t.length < e ? (t.copy(n, e - t.length), n) : t.slice(-e); } function dY(t, e) { - return UE(t, e, !0); + return qE(t, e, !0); } function cp(t) { if (!Buffer.isBuffer(t)) if (Array.isArray(t)) t = Buffer.from(t); else if (typeof t == "string") - qE(t) ? t = Buffer.from(mY(zE(t)), "hex") : t = Buffer.from(t); + zE(t) ? t = Buffer.from(mY(WE(t)), "hex") : t = Buffer.from(t); else if (typeof t == "number") t = intToBuffer(t); else if (t == null) t = Buffer.allocUnsafe(0); else if (typeof t == "bigint") - t = jE(t); + t = UE(t); else if (t.toArray) t = Buffer.from(t.toArray()); else @@ -26739,37 +26739,37 @@ function gY(t, e) { function mY(t) { return t.length % 2 ? "0" + t : t; } -function qE(t) { +function zE(t) { return typeof t == "string" && t.match(/^0x[0-9A-Fa-f]*$/); } -function zE(t) { +function WE(t) { return typeof t == "string" && t.startsWith("0x") ? t.slice(2) : t; } -var WE = { - zeros: FE, - setLength: UE, +var HE = { + zeros: jE, + setLength: qE, setLengthRight: dY, - isHexString: qE, - stripHexPrefix: zE, + isHexString: zE, + stripHexPrefix: WE, toBuffer: cp, bufferToHex: pY, keccak: gY, bitLengthFromBigInt: lY, - bufferBEFromBigInt: jE, + bufferBEFromBigInt: UE, twosFromBigInt: hY }; -const si = WE; -function HE(t) { +const si = HE; +function KE(t) { return t.startsWith("int[") ? "int256" + t.slice(3) : t === "int" ? "int256" : t.startsWith("uint[") ? "uint256" + t.slice(4) : t === "uint" ? "uint256" : t.startsWith("fixed[") ? "fixed128x128" + t.slice(5) : t === "fixed" ? "fixed128x128" : t.startsWith("ufixed[") ? "ufixed128x128" + t.slice(6) : t === "ufixed" ? "ufixed128x128" : t; } function pu(t) { return Number.parseInt(/^\D+(\d+)$/.exec(t)[1], 10); } -function c_(t) { +function u_(t) { var e = /^\D+(\d+)x(\d+)$/.exec(t); return [Number.parseInt(e[1], 10), Number.parseInt(e[2], 10)]; } -function KE(t) { +function VE(t) { var e = t.match(/(.*)\[(.*?)\]$/); return e ? e[2] === "" ? "dynamic" : Number.parseInt(e[2], 10) : null; } @@ -26792,7 +26792,7 @@ function qs(t, e) { if (bY(t)) { if (typeof e.length > "u") throw new Error("Not an array?"); - if (r = KE(t), r !== "dynamic" && r !== 0 && e.length > r) + if (r = VE(t), r !== "dynamic" && r !== 0 && e.length > r) throw new Error("Elements exceed array size: " + r); i = [], t = t.slice(0, t.lastIndexOf("[")), typeof e == "string" && (e = JSON.parse(e)); for (s in e) @@ -26829,16 +26829,16 @@ function qs(t, e) { const u = si.twosFromBigInt(n, 256); return si.bufferBEFromBigInt(u, 32); } else if (t.startsWith("ufixed")) { - if (r = c_(t), n = ec(e), n < 0) + if (r = u_(t), n = ec(e), n < 0) throw new Error("Supplied ufixed is negative"); return qs("uint256", n * BigInt(2) ** BigInt(r[1])); } else if (t.startsWith("fixed")) - return r = c_(t), qs("int256", ec(e) * BigInt(2) ** BigInt(r[1])); + return r = u_(t), qs("int256", ec(e) * BigInt(2) ** BigInt(r[1])); } throw new Error("Unsupported or invalid type: " + t); } function vY(t) { - return t === "string" || t === "bytes" || KE(t) === "dynamic"; + return t === "string" || t === "bytes" || VE(t) === "dynamic"; } function bY(t) { return t.lastIndexOf("]") === t.length - 1; @@ -26846,16 +26846,16 @@ function bY(t) { function yY(t, e) { var r = [], n = [], i = 32 * t.length; for (var s in t) { - var o = HE(t[s]), a = e[s], u = qs(o, a); + var o = KE(t[s]), a = e[s], u = qs(o, a); vY(o) ? (r.push(qs("uint256", i)), n.push(u), i += u.length) : r.push(u); } return Buffer.concat(r.concat(n)); } -function VE(t, e) { +function GE(t, e) { if (t.length !== e.length) throw new Error("Number of types are not matching the values"); for (var r, n, i = [], s = 0; s < t.length; s++) { - var o = HE(t[s]), a = e[s]; + var o = KE(t[s]), a = e[s]; if (o === "bytes") i.push(a); else if (o === "string") @@ -26891,14 +26891,14 @@ function VE(t, e) { return Buffer.concat(i); } function wY(t, e) { - return si.keccak(VE(t, e)); + return si.keccak(GE(t, e)); } var xY = { rawEncode: yY, - solidityPack: VE, + solidityPack: GE, soliditySHA3: wY }; -const ys = WE, Vf = xY, GE = { +const ys = HE, Vf = xY, YE = { type: "object", properties: { types: { @@ -27035,7 +27035,7 @@ const ys = WE, Vf = xY, GE = { */ sanitizeData(t) { const e = {}; - for (const r in GE.properties) + for (const r in YE.properties) t[r] && (e[r] = t[r]); return e.types && (e.types = Object.assign({ EIP712Domain: [] }, e.types)), e; }, @@ -27051,7 +27051,7 @@ const ys = WE, Vf = xY, GE = { } }; var _Y = { - TYPED_MESSAGE_SCHEMA: GE, + TYPED_MESSAGE_SCHEMA: YE, TypedDataUtils: Pm, hashForSignTypedDataLegacy: function(t) { return EY(t.data); @@ -27106,7 +27106,7 @@ class PY { name: "AES-GCM", iv: n }, i, s.encode(e)), a = 16, u = o.slice(o.byteLength - a), l = o.slice(0, o.byteLength - a), d = new Uint8Array(u), p = new Uint8Array(l), w = new Uint8Array([...n, ...d, ...p]); - return vb(w); + return bb(w); } /** * @@ -27258,7 +27258,7 @@ class IY { e && (this.webSocket = null, e.onclose = null, e.onerror = null, e.onmessage = null, e.onopen = null); } } -const u_ = 1e4, CY = 6e4; +const f_ = 1e4, CY = 6e4; class TY { /** * Constructor @@ -27322,7 +27322,7 @@ class TY { case Po.CONNECTED: o = await this.handleConnected(), this.updateLastHeartbeat(), setInterval(() => { this.heartbeat(); - }, u_), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); + }, f_), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); break; case Po.CONNECTING: break; @@ -27448,7 +27448,7 @@ class TY { this.lastHeartbeatResponse = Date.now(); } heartbeat() { - if (Date.now() - this.lastHeartbeatResponse > u_ * 2) { + if (Date.now() - this.lastHeartbeatResponse > f_ * 2) { this.ws.disconnect(); return; } @@ -27497,21 +27497,21 @@ class RY { } makeRequestId() { this._nextRequestId = (this._nextRequestId + 1) % 2147483647; - const e = this._nextRequestId, r = OE(e.toString(16)); + const e = this._nextRequestId, r = NE(e.toString(16)); return this.callbacks.get(r) && this.callbacks.delete(r), e; } } -const f_ = "session:id", l_ = "session:secret", h_ = "session:linked"; +const l_ = "session:id", h_ = "session:secret", d_ = "session:linked"; class gu { constructor(e, r, n, i = !1) { - this.storage = e, this.id = r, this.secret = n, this.key = _D(n4(`${r}, ${n} WalletLink`)), this._linked = !!i; + this.storage = e, this.id = r, this.secret = n, this.key = _D(i4(`${r}, ${n} WalletLink`)), this._linked = !!i; } static create(e) { const r = Qa(16), n = Qa(32); return new gu(e, r, n).save(); } static load(e) { - const r = e.getItem(f_), n = e.getItem(h_), i = e.getItem(l_); + const r = e.getItem(l_), n = e.getItem(d_), i = e.getItem(h_); return r && i ? new gu(e, r, i, n === "1") : null; } get linked() { @@ -27521,10 +27521,10 @@ class gu { this._linked = e, this.persistLinked(); } save() { - return this.storage.setItem(f_, this.id), this.storage.setItem(l_, this.secret), this.persistLinked(), this; + return this.storage.setItem(l_, this.id), this.storage.setItem(h_, this.secret), this.persistLinked(), this; } persistLinked() { - this.storage.setItem(h_, this._linked ? "1" : "0"); + this.storage.setItem(d_, this._linked ? "1" : "0"); } } function DY() { @@ -27545,32 +27545,32 @@ function NY() { var t; return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t = window == null ? void 0 : window.navigator) === null || t === void 0 ? void 0 : t.userAgent); } -function YE() { +function JE() { var t, e; return (e = (t = window == null ? void 0 : window.matchMedia) === null || t === void 0 ? void 0 : t.call(window, "(prefers-color-scheme: dark)").matches) !== null && e !== void 0 ? e : !1; } const LY = '@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}'; -function JE() { +function XE() { const t = document.createElement("style"); t.type = "text/css", t.appendChild(document.createTextNode(LY)), document.documentElement.appendChild(t); } -function XE(t) { +function ZE(t) { var e, r, n = ""; if (typeof t == "string" || typeof t == "number") n += t; - else if (typeof t == "object") if (Array.isArray(t)) for (e = 0; e < t.length; e++) t[e] && (r = XE(t[e])) && (n && (n += " "), n += r); + else if (typeof t == "object") if (Array.isArray(t)) for (e = 0; e < t.length; e++) t[e] && (r = ZE(t[e])) && (n && (n += " "), n += r); else for (e in t) t[e] && (n && (n += " "), n += e); return n; } function Gf() { - for (var t, e, r = 0, n = ""; r < arguments.length; ) (t = arguments[r++]) && (e = XE(t)) && (n && (n += " "), n += e); + for (var t, e, r = 0, n = ""; r < arguments.length; ) (t = arguments[r++]) && (e = ZE(t)) && (n && (n += " "), n += e); return n; } -var up, Jr, ZE, tc, d_, QE, F1, eS, wb, j1, U1, Pl = {}, tS = [], kY = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, xb = Array.isArray; +var up, Jr, QE, tc, p_, eS, F1, tS, xb, j1, U1, Pl = {}, rS = [], kY = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, _b = Array.isArray; function ga(t, e) { for (var r in e) t[r] = e[r]; return t; } -function _b(t) { +function Eb(t) { t && t.parentNode && t.parentNode.removeChild(t); } function Nr(t, e, r) { @@ -27580,7 +27580,7 @@ function Nr(t, e, r) { return Od(t, o, n, i, null); } function Od(t, e, r, n, i) { - var s = { type: t, props: e, key: r, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++ZE, __i: -1, __u: 0 }; + var s = { type: t, props: e, key: r, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++QE, __i: -1, __u: 0 }; return i == null && Jr.vnode != null && Jr.vnode(s), s; } function ih(t) { @@ -27594,39 +27594,39 @@ function Pu(t, e) { for (var r; e < t.__k.length; e++) if ((r = t.__k[e]) != null && r.__e != null) return r.__e; return typeof t.type == "function" ? Pu(t) : null; } -function rS(t) { +function nS(t) { var e, r; if ((t = t.__) != null && t.__c != null) { for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) if ((r = t.__k[e]) != null && r.__e != null) { t.__e = t.__c.base = r.__e; break; } - return rS(t); + return nS(t); } } -function p_(t) { - (!t.__d && (t.__d = !0) && tc.push(t) && !d0.__r++ || d_ !== Jr.debounceRendering) && ((d_ = Jr.debounceRendering) || QE)(d0); +function g_(t) { + (!t.__d && (t.__d = !0) && tc.push(t) && !d0.__r++ || p_ !== Jr.debounceRendering) && ((p_ = Jr.debounceRendering) || eS)(d0); } function d0() { var t, e, r, n, i, s, o, a; - for (tc.sort(F1); t = tc.shift(); ) t.__d && (e = tc.length, n = void 0, s = (i = (r = t).__v).__e, o = [], a = [], r.__P && ((n = ga({}, i)).__v = i.__v + 1, Jr.vnode && Jr.vnode(n), Eb(r.__P, n, i, r.__n, r.__P.namespaceURI, 32 & i.__u ? [s] : null, o, s ?? Pu(i), !!(32 & i.__u), a), n.__v = i.__v, n.__.__k[n.__i] = n, sS(o, n, a), n.__e != s && rS(n)), tc.length > e && tc.sort(F1)); + for (tc.sort(F1); t = tc.shift(); ) t.__d && (e = tc.length, n = void 0, s = (i = (r = t).__v).__e, o = [], a = [], r.__P && ((n = ga({}, i)).__v = i.__v + 1, Jr.vnode && Jr.vnode(n), Sb(r.__P, n, i, r.__n, r.__P.namespaceURI, 32 & i.__u ? [s] : null, o, s ?? Pu(i), !!(32 & i.__u), a), n.__v = i.__v, n.__.__k[n.__i] = n, oS(o, n, a), n.__e != s && nS(n)), tc.length > e && tc.sort(F1)); d0.__r = 0; } -function nS(t, e, r, n, i, s, o, a, u, l, d) { - var p, w, A, M, N, L, B = n && n.__k || tS, $ = e.length; - for (u = $Y(r, e, B, u), p = 0; p < $; p++) (A = r.__k[p]) != null && (w = A.__i === -1 ? Pl : B[A.__i] || Pl, A.__i = p, L = Eb(t, A, w, i, s, o, a, u, l, d), M = A.__e, A.ref && w.ref != A.ref && (w.ref && Sb(w.ref, null, A), d.push(A.ref, A.__c || M, A)), N == null && M != null && (N = M), 4 & A.__u || w.__k === A.__k ? u = iS(A, u, t) : typeof A.type == "function" && L !== void 0 ? u = L : M && (u = M.nextSibling), A.__u &= -7); +function iS(t, e, r, n, i, s, o, a, u, l, d) { + var p, w, A, M, N, L, $ = n && n.__k || rS, B = e.length; + for (u = $Y(r, e, $, u), p = 0; p < B; p++) (A = r.__k[p]) != null && (w = A.__i === -1 ? Pl : $[A.__i] || Pl, A.__i = p, L = Sb(t, A, w, i, s, o, a, u, l, d), M = A.__e, A.ref && w.ref != A.ref && (w.ref && Ab(w.ref, null, A), d.push(A.ref, A.__c || M, A)), N == null && M != null && (N = M), 4 & A.__u || w.__k === A.__k ? u = sS(A, u, t) : typeof A.type == "function" && L !== void 0 ? u = L : M && (u = M.nextSibling), A.__u &= -7); return r.__e = N, u; } function $Y(t, e, r, n) { var i, s, o, a, u, l = e.length, d = r.length, p = d, w = 0; - for (t.__k = [], i = 0; i < l; i++) (s = e[i]) != null && typeof s != "boolean" && typeof s != "function" ? (a = i + w, (s = t.__k[i] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Od(null, s, null, null, null) : xb(s) ? Od(ih, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? Od(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, o = null, (u = s.__i = BY(s, r, a, p)) !== -1 && (p--, (o = r[u]) && (o.__u |= 2)), o == null || o.__v === null ? (u == -1 && w--, typeof s.type != "function" && (s.__u |= 4)) : u !== a && (u == a - 1 ? w-- : u == a + 1 ? w++ : (u > a ? w-- : w++, s.__u |= 4))) : s = t.__k[i] = null; - if (p) for (i = 0; i < d; i++) (o = r[i]) != null && !(2 & o.__u) && (o.__e == n && (n = Pu(o)), oS(o, o)); + for (t.__k = [], i = 0; i < l; i++) (s = e[i]) != null && typeof s != "boolean" && typeof s != "function" ? (a = i + w, (s = t.__k[i] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Od(null, s, null, null, null) : _b(s) ? Od(ih, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? Od(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, o = null, (u = s.__i = BY(s, r, a, p)) !== -1 && (p--, (o = r[u]) && (o.__u |= 2)), o == null || o.__v === null ? (u == -1 && w--, typeof s.type != "function" && (s.__u |= 4)) : u !== a && (u == a - 1 ? w-- : u == a + 1 ? w++ : (u > a ? w-- : w++, s.__u |= 4))) : s = t.__k[i] = null; + if (p) for (i = 0; i < d; i++) (o = r[i]) != null && !(2 & o.__u) && (o.__e == n && (n = Pu(o)), aS(o, o)); return n; } -function iS(t, e, r) { +function sS(t, e, r) { var n, i; if (typeof t.type == "function") { - for (n = t.__k, i = 0; n && i < n.length; i++) n[i] && (n[i].__ = t, e = iS(n[i], e, r)); + for (n = t.__k, i = 0; n && i < n.length; i++) n[i] && (n[i].__ = t, e = sS(n[i], e, r)); return e; } t.__e != e && (e && t.type && !r.contains(e) && (e = Pu(t)), r.insertBefore(t.__e, e || null), e = t.__e); @@ -27650,17 +27650,17 @@ function BY(t, e, r, n) { } return -1; } -function g_(t, e, r) { +function m_(t, e, r) { e[0] === "-" ? t.setProperty(e, r ?? "") : t[e] = r == null ? "" : typeof r != "number" || kY.test(e) ? r : r + "px"; } function pd(t, e, r, n, i) { var s; e: if (e === "style") if (typeof r == "string") t.style.cssText = r; else { - if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || g_(t.style, e, ""); - if (r) for (e in r) n && r[e] === n[e] || g_(t.style, e, r[e]); + if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || m_(t.style, e, ""); + if (r) for (e in r) n && r[e] === n[e] || m_(t.style, e, r[e]); } - else if (e[0] === "o" && e[1] === "n") s = e !== (e = e.replace(eS, "$1")), e = e.toLowerCase() in t || e === "onFocusOut" || e === "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = wb, t.addEventListener(e, s ? U1 : j1, s)) : t.removeEventListener(e, s ? U1 : j1, s); + else if (e[0] === "o" && e[1] === "n") s = e !== (e = e.replace(tS, "$1")), e = e.toLowerCase() in t || e === "onFocusOut" || e === "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = xb, t.addEventListener(e, s ? U1 : j1, s)) : t.removeEventListener(e, s ? U1 : j1, s); else { if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try { @@ -27671,54 +27671,54 @@ function pd(t, e, r, n, i) { typeof r == "function" || (r == null || r === !1 && e[4] !== "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && r == 1 ? "" : r)); } } -function m_(t) { +function v_(t) { return function(e) { if (this.l) { var r = this.l[e.type + t]; - if (e.t == null) e.t = wb++; + if (e.t == null) e.t = xb++; else if (e.t < r.u) return; return r(Jr.event ? Jr.event(e) : e); } }; } -function Eb(t, e, r, n, i, s, o, a, u, l) { - var d, p, w, A, M, N, L, B, $, H, W, V, te, R, K, ge, Ee, Y = e.type; +function Sb(t, e, r, n, i, s, o, a, u, l) { + var d, p, w, A, M, N, L, $, B, H, U, V, te, R, K, ge, Ee, Y = e.type; if (e.constructor !== void 0) return null; 128 & r.__u && (u = !!(32 & r.__u), s = [a = e.__e = r.__e]), (d = Jr.__b) && d(e); e: if (typeof Y == "function") try { - if (B = e.props, $ = "prototype" in Y && Y.prototype.render, H = (d = Y.contextType) && n[d.__c], W = d ? H ? H.props.value : d.__ : n, r.__c ? L = (p = e.__c = r.__c).__ = p.__E : ($ ? e.__c = p = new Y(B, W) : (e.__c = p = new Nd(B, W), p.constructor = Y, p.render = jY), H && H.sub(p), p.props = B, p.state || (p.state = {}), p.context = W, p.__n = n, w = p.__d = !0, p.__h = [], p._sb = []), $ && p.__s == null && (p.__s = p.state), $ && Y.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = ga({}, p.__s)), ga(p.__s, Y.getDerivedStateFromProps(B, p.__s))), A = p.props, M = p.state, p.__v = e, w) $ && Y.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), $ && p.componentDidMount != null && p.__h.push(p.componentDidMount); + if ($ = e.props, B = "prototype" in Y && Y.prototype.render, H = (d = Y.contextType) && n[d.__c], U = d ? H ? H.props.value : d.__ : n, r.__c ? L = (p = e.__c = r.__c).__ = p.__E : (B ? e.__c = p = new Y($, U) : (e.__c = p = new Nd($, U), p.constructor = Y, p.render = jY), H && H.sub(p), p.props = $, p.state || (p.state = {}), p.context = U, p.__n = n, w = p.__d = !0, p.__h = [], p._sb = []), B && p.__s == null && (p.__s = p.state), B && Y.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = ga({}, p.__s)), ga(p.__s, Y.getDerivedStateFromProps($, p.__s))), A = p.props, M = p.state, p.__v = e, w) B && Y.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), B && p.componentDidMount != null && p.__h.push(p.componentDidMount); else { - if ($ && Y.getDerivedStateFromProps == null && B !== A && p.componentWillReceiveProps != null && p.componentWillReceiveProps(B, W), !p.__e && (p.shouldComponentUpdate != null && p.shouldComponentUpdate(B, p.__s, W) === !1 || e.__v === r.__v)) { - for (e.__v !== r.__v && (p.props = B, p.state = p.__s, p.__d = !1), e.__e = r.__e, e.__k = r.__k, e.__k.some(function(S) { + if (B && Y.getDerivedStateFromProps == null && $ !== A && p.componentWillReceiveProps != null && p.componentWillReceiveProps($, U), !p.__e && (p.shouldComponentUpdate != null && p.shouldComponentUpdate($, p.__s, U) === !1 || e.__v === r.__v)) { + for (e.__v !== r.__v && (p.props = $, p.state = p.__s, p.__d = !1), e.__e = r.__e, e.__k = r.__k, e.__k.some(function(S) { S && (S.__ = e); }), V = 0; V < p._sb.length; V++) p.__h.push(p._sb[V]); p._sb = [], p.__h.length && o.push(p); break e; } - p.componentWillUpdate != null && p.componentWillUpdate(B, p.__s, W), $ && p.componentDidUpdate != null && p.__h.push(function() { + p.componentWillUpdate != null && p.componentWillUpdate($, p.__s, U), B && p.componentDidUpdate != null && p.__h.push(function() { p.componentDidUpdate(A, M, N); }); } - if (p.context = W, p.props = B, p.__P = t, p.__e = !1, te = Jr.__r, R = 0, $) { + if (p.context = U, p.props = $, p.__P = t, p.__e = !1, te = Jr.__r, R = 0, B) { for (p.state = p.__s, p.__d = !1, te && te(e), d = p.render(p.props, p.state, p.context), K = 0; K < p._sb.length; K++) p.__h.push(p._sb[K]); p._sb = []; } else do p.__d = !1, te && te(e), d = p.render(p.props, p.state, p.context), p.state = p.__s; while (p.__d && ++R < 25); - p.state = p.__s, p.getChildContext != null && (n = ga(ga({}, n), p.getChildContext())), $ && !w && p.getSnapshotBeforeUpdate != null && (N = p.getSnapshotBeforeUpdate(A, M)), a = nS(t, xb(ge = d != null && d.type === ih && d.key == null ? d.props.children : d) ? ge : [ge], e, r, n, i, s, o, a, u, l), p.base = e.__e, e.__u &= -161, p.__h.length && o.push(p), L && (p.__E = p.__ = null); + p.state = p.__s, p.getChildContext != null && (n = ga(ga({}, n), p.getChildContext())), B && !w && p.getSnapshotBeforeUpdate != null && (N = p.getSnapshotBeforeUpdate(A, M)), a = iS(t, _b(ge = d != null && d.type === ih && d.key == null ? d.props.children : d) ? ge : [ge], e, r, n, i, s, o, a, u, l), p.base = e.__e, e.__u &= -161, p.__h.length && o.push(p), L && (p.__E = p.__ = null); } catch (S) { if (e.__v = null, u || s != null) if (S.then) { for (e.__u |= u ? 160 : 128; a && a.nodeType === 8 && a.nextSibling; ) a = a.nextSibling; s[s.indexOf(a)] = null, e.__e = a; - } else for (Ee = s.length; Ee--; ) _b(s[Ee]); + } else for (Ee = s.length; Ee--; ) Eb(s[Ee]); else e.__e = r.__e, e.__k = r.__k; Jr.__e(S, e, r); } else s == null && e.__v === r.__v ? (e.__k = r.__k, e.__e = r.__e) : a = e.__e = FY(r.__e, e, r, n, i, s, o, u, l); return (d = Jr.diffed) && d(e), 128 & e.__u ? void 0 : a; } -function sS(t, e, r) { - for (var n = 0; n < r.length; n++) Sb(r[n], r[++n], r[++n]); +function oS(t, e, r) { + for (var n = 0; n < r.length; n++) Ab(r[n], r[++n], r[++n]); Jr.__c && Jr.__c(e, t), t.some(function(i) { try { t = i.__h, i.__h = [], t.some(function(s) { @@ -27730,35 +27730,35 @@ function sS(t, e, r) { }); } function FY(t, e, r, n, i, s, o, a, u) { - var l, d, p, w, A, M, N, L = r.props, B = e.props, $ = e.type; - if ($ === "svg" ? i = "http://www.w3.org/2000/svg" : $ === "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) { - for (l = 0; l < s.length; l++) if ((A = s[l]) && "setAttribute" in A == !!$ && ($ ? A.localName === $ : A.nodeType === 3)) { + var l, d, p, w, A, M, N, L = r.props, $ = e.props, B = e.type; + if (B === "svg" ? i = "http://www.w3.org/2000/svg" : B === "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) { + for (l = 0; l < s.length; l++) if ((A = s[l]) && "setAttribute" in A == !!B && (B ? A.localName === B : A.nodeType === 3)) { t = A, s[l] = null; break; } } if (t == null) { - if ($ === null) return document.createTextNode(B); - t = document.createElementNS(i, $, B.is && B), a && (Jr.__m && Jr.__m(e, s), a = !1), s = null; + if (B === null) return document.createTextNode($); + t = document.createElementNS(i, B, $.is && $), a && (Jr.__m && Jr.__m(e, s), a = !1), s = null; } - if ($ === null) L === B || a && t.data === B || (t.data = B); + if (B === null) L === $ || a && t.data === $ || (t.data = $); else { if (s = s && up.call(t.childNodes), L = r.props || Pl, !a && s != null) for (L = {}, l = 0; l < t.attributes.length; l++) L[(A = t.attributes[l]).name] = A.value; for (l in L) if (A = L[l], l != "children") { if (l == "dangerouslySetInnerHTML") p = A; - else if (!(l in B)) { - if (l == "value" && "defaultValue" in B || l == "checked" && "defaultChecked" in B) continue; + else if (!(l in $)) { + if (l == "value" && "defaultValue" in $ || l == "checked" && "defaultChecked" in $) continue; pd(t, l, null, A, i); } } - for (l in B) A = B[l], l == "children" ? w = A : l == "dangerouslySetInnerHTML" ? d = A : l == "value" ? M = A : l == "checked" ? N = A : a && typeof A != "function" || L[l] === A || pd(t, l, A, L[l], i); + for (l in $) A = $[l], l == "children" ? w = A : l == "dangerouslySetInnerHTML" ? d = A : l == "value" ? M = A : l == "checked" ? N = A : a && typeof A != "function" || L[l] === A || pd(t, l, A, L[l], i); if (d) a || p && (d.__html === p.__html || d.__html === t.innerHTML) || (t.innerHTML = d.__html), e.__k = []; - else if (p && (t.innerHTML = ""), nS(t, xb(w) ? w : [w], e, r, n, $ === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && Pu(r, 0), a, u), s != null) for (l = s.length; l--; ) _b(s[l]); - a || (l = "value", $ === "progress" && M == null ? t.removeAttribute("value") : M !== void 0 && (M !== t[l] || $ === "progress" && !M || $ === "option" && M !== L[l]) && pd(t, l, M, L[l], i), l = "checked", N !== void 0 && N !== t[l] && pd(t, l, N, L[l], i)); + else if (p && (t.innerHTML = ""), iS(t, _b(w) ? w : [w], e, r, n, B === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && Pu(r, 0), a, u), s != null) for (l = s.length; l--; ) Eb(s[l]); + a || (l = "value", B === "progress" && M == null ? t.removeAttribute("value") : M !== void 0 && (M !== t[l] || B === "progress" && !M || B === "option" && M !== L[l]) && pd(t, l, M, L[l], i), l = "checked", N !== void 0 && N !== t[l] && pd(t, l, N, L[l], i)); } return t; } -function Sb(t, e, r) { +function Ab(t, e, r) { try { if (typeof t == "function") { var n = typeof t.__u == "function"; @@ -27768,9 +27768,9 @@ function Sb(t, e, r) { Jr.__e(i, r); } } -function oS(t, e, r) { +function aS(t, e, r) { var n, i; - if (Jr.unmount && Jr.unmount(t), (n = t.ref) && (n.current && n.current !== t.__e || Sb(n, null, e)), (n = t.__c) != null) { + if (Jr.unmount && Jr.unmount(t), (n = t.ref) && (n.current && n.current !== t.__e || Ab(n, null, e)), (n = t.__c) != null) { if (n.componentWillUnmount) try { n.componentWillUnmount(); } catch (s) { @@ -27778,43 +27778,43 @@ function oS(t, e, r) { } n.base = n.__P = null; } - if (n = t.__k) for (i = 0; i < n.length; i++) n[i] && oS(n[i], e, r || typeof t.type != "function"); - r || _b(t.__e), t.__c = t.__ = t.__e = void 0; + if (n = t.__k) for (i = 0; i < n.length; i++) n[i] && aS(n[i], e, r || typeof t.type != "function"); + r || Eb(t.__e), t.__c = t.__ = t.__e = void 0; } function jY(t, e, r) { return this.constructor(t, r); } function q1(t, e, r) { var n, i, s, o; - e === document && (e = document.documentElement), Jr.__ && Jr.__(t, e), i = (n = typeof r == "function") ? null : e.__k, s = [], o = [], Eb(e, t = (!n && r || e).__k = Nr(ih, null, [t]), i || Pl, Pl, e.namespaceURI, !n && r ? [r] : i ? null : e.firstChild ? up.call(e.childNodes) : null, s, !n && r ? r : i ? i.__e : e.firstChild, n, o), sS(s, t, o); + e === document && (e = document.documentElement), Jr.__ && Jr.__(t, e), i = (n = typeof r == "function") ? null : e.__k, s = [], o = [], Sb(e, t = (!n && r || e).__k = Nr(ih, null, [t]), i || Pl, Pl, e.namespaceURI, !n && r ? [r] : i ? null : e.firstChild ? up.call(e.childNodes) : null, s, !n && r ? r : i ? i.__e : e.firstChild, n, o), oS(s, t, o); } -up = tS.slice, Jr = { __e: function(t, e, r, n) { +up = rS.slice, Jr = { __e: function(t, e, r, n) { for (var i, s, o; e = e.__; ) if ((i = e.__c) && !i.__) try { if ((s = i.constructor) && s.getDerivedStateFromError != null && (i.setState(s.getDerivedStateFromError(t)), o = i.__d), i.componentDidCatch != null && (i.componentDidCatch(t, n || {}), o = i.__d), o) return i.__E = i; } catch (a) { t = a; } throw t; -} }, ZE = 0, Nd.prototype.setState = function(t, e) { +} }, QE = 0, Nd.prototype.setState = function(t, e) { var r; - r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = ga({}, this.state), typeof t == "function" && (t = t(ga({}, r), this.props)), t && ga(r, t), t != null && this.__v && (e && this._sb.push(e), p_(this)); + r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = ga({}, this.state), typeof t == "function" && (t = t(ga({}, r), this.props)), t && ga(r, t), t != null && this.__v && (e && this._sb.push(e), g_(this)); }, Nd.prototype.forceUpdate = function(t) { - this.__v && (this.__e = !0, t && this.__h.push(t), p_(this)); -}, Nd.prototype.render = ih, tc = [], QE = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, F1 = function(t, e) { + this.__v && (this.__e = !0, t && this.__h.push(t), g_(this)); +}, Nd.prototype.render = ih, tc = [], eS = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, F1 = function(t, e) { return t.__v.__b - e.__v.__b; -}, d0.__r = 0, eS = /(PointerCapture)$|Capture$/i, wb = 0, j1 = m_(!1), U1 = m_(!0); -var p0, pn, Mm, v_, z1 = 0, aS = [], yn = Jr, b_ = yn.__b, y_ = yn.__r, w_ = yn.diffed, x_ = yn.__c, __ = yn.unmount, E_ = yn.__; -function cS(t, e) { +}, d0.__r = 0, tS = /(PointerCapture)$|Capture$/i, xb = 0, j1 = v_(!1), U1 = v_(!0); +var p0, pn, Mm, b_, z1 = 0, cS = [], yn = Jr, y_ = yn.__b, w_ = yn.__r, x_ = yn.diffed, __ = yn.__c, E_ = yn.unmount, S_ = yn.__; +function uS(t, e) { yn.__h && yn.__h(pn, t, z1 || e), z1 = 0; var r = pn.__H || (pn.__H = { __: [], __h: [] }); return t >= r.__.length && r.__.push({}), r.__[t]; } -function S_(t) { - return z1 = 1, UY(uS, t); +function A_(t) { + return z1 = 1, UY(fS, t); } function UY(t, e, r) { - var n = cS(p0++, 2); - if (n.t = t, !n.__c && (n.__ = [uS(void 0, e), function(a) { + var n = uS(p0++, 2); + if (n.t = t, !n.__c && (n.__ = [fS(void 0, e), function(a) { var u = n.__N ? n.__N[0] : n.__[0], l = n.t(u, a); u !== l && (n.__N = [l, n.__[1]], n.__c.setState({})); }], n.__c = pn, !pn.u)) { @@ -27847,30 +27847,30 @@ function UY(t, e, r) { return n.__N || n.__; } function qY(t, e) { - var r = cS(p0++, 3); + var r = uS(p0++, 3); !yn.__s && HY(r.__H, e) && (r.__ = t, r.i = e, pn.__H.__h.push(r)); } function zY() { - for (var t; t = aS.shift(); ) if (t.__P && t.__H) try { + for (var t; t = cS.shift(); ) if (t.__P && t.__H) try { t.__H.__h.forEach(Ld), t.__H.__h.forEach(W1), t.__H.__h = []; } catch (e) { t.__H.__h = [], yn.__e(e, t.__v); } } yn.__b = function(t) { - pn = null, b_ && b_(t); + pn = null, y_ && y_(t); }, yn.__ = function(t, e) { - t && e.__k && e.__k.__m && (t.__m = e.__k.__m), E_ && E_(t, e); + t && e.__k && e.__k.__m && (t.__m = e.__k.__m), S_ && S_(t, e); }, yn.__r = function(t) { - y_ && y_(t), p0 = 0; + w_ && w_(t), p0 = 0; var e = (pn = t.__c).__H; e && (Mm === pn ? (e.__h = [], pn.__h = [], e.__.forEach(function(r) { r.__N && (r.__ = r.__N), r.i = r.__N = void 0; })) : (e.__h.forEach(Ld), e.__h.forEach(W1), e.__h = [], p0 = 0)), Mm = pn; }, yn.diffed = function(t) { - w_ && w_(t); + x_ && x_(t); var e = t.__c; - e && e.__H && (e.__H.__h.length && (aS.push(e) !== 1 && v_ === yn.requestAnimationFrame || ((v_ = yn.requestAnimationFrame) || WY)(zY)), e.__H.__.forEach(function(r) { + e && e.__H && (e.__H.__h.length && (cS.push(e) !== 1 && b_ === yn.requestAnimationFrame || ((b_ = yn.requestAnimationFrame) || WY)(zY)), e.__H.__.forEach(function(r) { r.i && (r.__H = r.i), r.i = void 0; })), Mm = pn = null; }, yn.__c = function(t, e) { @@ -27884,9 +27884,9 @@ yn.__b = function(t) { i.__h && (i.__h = []); }), e = [], yn.__e(n, r.__v); } - }), x_ && x_(t, e); + }), __ && __(t, e); }, yn.unmount = function(t) { - __ && __(t); + E_ && E_(t); var e, r = t.__c; r && r.__H && (r.__H.__.forEach(function(n) { try { @@ -27896,12 +27896,12 @@ yn.__b = function(t) { } }), r.__H = void 0, e && yn.__e(e, r.__v)); }; -var A_ = typeof requestAnimationFrame == "function"; +var P_ = typeof requestAnimationFrame == "function"; function WY(t) { var e, r = function() { - clearTimeout(n), A_ && cancelAnimationFrame(e), setTimeout(t); + clearTimeout(n), P_ && cancelAnimationFrame(e), setTimeout(t); }, n = setTimeout(r, 100); - A_ && (e = requestAnimationFrame(r)); + P_ && (e = requestAnimationFrame(r)); } function Ld(t) { var e = pn, r = t.__c; @@ -27916,13 +27916,13 @@ function HY(t, e) { return r !== t[n]; }); } -function uS(t, e) { +function fS(t, e) { return typeof e == "function" ? e(t) : e; } const KY = ".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}", VY = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+", GY = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4="; class YY { constructor() { - this.items = /* @__PURE__ */ new Map(), this.nextItemKey = 0, this.root = null, this.darkMode = YE(); + this.items = /* @__PURE__ */ new Map(), this.nextItemKey = 0, this.root = null, this.darkMode = JE(); } attach(e) { this.root = document.createElement("div"), this.root.className = "-cbwsdk-snackbar-root", e.appendChild(this.root), this.render(); @@ -27940,17 +27940,17 @@ class YY { this.root && q1(Nr( "div", null, - Nr(fS, { darkMode: this.darkMode }, Array.from(this.items.entries()).map(([e, r]) => Nr(JY, Object.assign({}, r, { key: e })))) + Nr(lS, { darkMode: this.darkMode }, Array.from(this.items.entries()).map(([e, r]) => Nr(JY, Object.assign({}, r, { key: e })))) ), this.root); } } -const fS = (t) => Nr( +const lS = (t) => Nr( "div", { class: Gf("-cbwsdk-snackbar-container") }, Nr("style", null, KY), Nr("div", { class: "-cbwsdk-snackbar" }, t.children) ), JY = ({ autoExpand: t, message: e, menuItems: r }) => { - const [n, i] = S_(!0), [s, o] = S_(t ?? !1); + const [n, i] = A_(!0), [s, o] = A_(t ?? !1); qY(() => { const u = [ window.setTimeout(() => { @@ -28007,7 +28007,7 @@ class XY { if (this.attached) throw new Error("Coinbase Wallet SDK UI is already attached"); const e = document.documentElement, r = document.createElement("div"); - r.className = "-cbwsdk-css-reset", e.appendChild(r), this.snackbar.attach(r), this.attached = !0, JE(); + r.className = "-cbwsdk-css-reset", e.appendChild(r), this.snackbar.attach(r), this.attached = !0, XE(); } showConnecting(e) { let r; @@ -28056,11 +28056,11 @@ class XY { const ZY = ".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}"; class QY { constructor() { - this.root = null, this.darkMode = YE(); + this.root = null, this.darkMode = JE(); } attach() { const e = document.documentElement; - this.root = document.createElement("div"), this.root.className = "-cbwsdk-css-reset", e.appendChild(this.root), JE(); + this.root = document.createElement("div"), this.root.className = "-cbwsdk-css-reset", e.appendChild(this.root), XE(); } present(e) { this.render(e); @@ -28077,7 +28077,7 @@ class QY { const eJ = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: i }) => { const s = r ? "dark" : "light"; return Nr( - fS, + lS, { darkMode: r }, Nr( "div", @@ -28092,8 +28092,8 @@ const eJ = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: ) ) ); -}, tJ = "https://keys.coinbase.com/connect", P_ = "https://www.walletlink.org", rJ = "https://go.cb-w.com/walletlink"; -class M_ { +}, tJ = "https://keys.coinbase.com/connect", M_ = "https://www.walletlink.org", rJ = "https://go.cb-w.com/walletlink"; +class I_ { constructor() { this.attached = !1, this.redirectDialog = new QY(); } @@ -28157,7 +28157,7 @@ class Eo { session: e, linkAPIUrl: r, listener: this - }), i = this.isMobileWeb ? new M_() : new XY(); + }), i = this.isMobileWeb ? new I_() : new XY(); return n.connect(), { session: e, ui: i, connection: n }; } resetAndReload() { @@ -28245,7 +28245,7 @@ class Eo { } // copied from MobileRelay openCoinbaseWalletDeeplink(e) { - if (this.ui instanceof M_) + if (this.ui instanceof I_) switch (e) { case "requestEthereumAccounts": case "switchEthereumChain": @@ -28393,10 +28393,10 @@ class Eo { } } Eo.accountRequestCallbackIds = /* @__PURE__ */ new Set(); -const I_ = "DefaultChainId", C_ = "DefaultJsonRpcUrl"; -class lS { +const C_ = "DefaultChainId", T_ = "DefaultJsonRpcUrl"; +class hS { constructor(e) { - this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new eo("walletlink", P_), this.callback = e.callback || null; + this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new eo("walletlink", M_), this.callback = e.callback || null; const r = this._storage.getItem(B1); if (r) { const n = r.split(" "); @@ -28416,16 +28416,16 @@ class lS { } get jsonRpcUrl() { var e; - return (e = this._storage.getItem(C_)) !== null && e !== void 0 ? e : void 0; + return (e = this._storage.getItem(T_)) !== null && e !== void 0 ? e : void 0; } set jsonRpcUrl(e) { - this._storage.setItem(C_, e); + this._storage.setItem(T_, e); } updateProviderInfo(e, r) { var n; this.jsonRpcUrl = e; const i = this.getChainId(); - this._storage.setItem(I_, r.toString(10)), Kf(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(r))); + this._storage.setItem(C_, r.toString(10)), Kf(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(r))); } async watchAsset(e) { const r = Array.isArray(e) ? e[0] : e; @@ -28514,7 +28514,7 @@ class lS { default: if (!this.jsonRpcUrl) throw Sr.rpc.internal("No RPC URL set for chain"); - return BE(e, this.jsonRpcUrl); + return FE(e, this.jsonRpcUrl); } } _ensureKnownAddress(e) { @@ -28559,7 +28559,7 @@ class lS { } getChainId() { var e; - return Number.parseInt((e = this._storage.getItem(I_)) !== null && e !== void 0 ? e : "1", 10); + return Number.parseInt((e = this._storage.getItem(C_)) !== null && e !== void 0 ? e : "1", 10); } async _eth_requestAccounts() { var e, r; @@ -28639,7 +28639,7 @@ class lS { } initializeRelay() { return this._relay || (this._relay = new Eo({ - linkAPIUrl: P_, + linkAPIUrl: M_, storage: this._storage, metadata: this.metadata, accountsCallback: this._setAddresses.bind(this), @@ -28647,12 +28647,12 @@ class lS { })), this._relay; } } -const hS = "SignerType", dS = new eo("CBWSDK", "SignerConfigurator"); +const dS = "SignerType", pS = new eo("CBWSDK", "SignerConfigurator"); function nJ() { - return dS.getItem(hS); + return pS.getItem(dS); } function iJ(t) { - dS.setItem(hS, t); + pS.setItem(dS, t); } async function sJ(t) { const { communicator: e, metadata: r, handshakeRequest: n, callback: i } = t; @@ -28675,7 +28675,7 @@ function oJ(t) { communicator: n }); case "walletlink": - return new lS({ + return new hS({ metadata: r, callback: i }); @@ -28683,7 +28683,7 @@ function oJ(t) { } async function aJ(t, e, r) { await t.onMessage(({ event: i }) => i === "WalletLinkSessionRequest"); - const n = new lS({ + const n = new hS({ metadata: e, callback: r }); @@ -28719,11 +28719,11 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene } } }; -}, { checkCrossOriginOpenerPolicy: fJ, getCrossOriginOpenerPolicy: lJ } = uJ(), T_ = 420, R_ = 540; +}, { checkCrossOriginOpenerPolicy: fJ, getCrossOriginOpenerPolicy: lJ } = uJ(), R_ = 420, D_ = 540; function hJ(t) { - const e = (window.innerWidth - T_) / 2 + window.screenX, r = (window.innerHeight - R_) / 2 + window.screenY; + const e = (window.innerWidth - R_) / 2 + window.screenX, r = (window.innerHeight - D_) / 2 + window.screenY; pJ(t); - const n = window.open(t, "Smart Wallet", `width=${T_}, height=${R_}, left=${e}, top=${r}`); + const n = window.open(t, "Smart Wallet", `width=${R_}, height=${D_}, left=${e}, top=${r}`); if (n == null || n.focus(), !n) throw Sr.rpc.internal("Pop up window failed to open"); return n; @@ -28733,7 +28733,7 @@ function dJ(t) { } function pJ(t) { const e = { - sdkName: $E, + sdkName: BE, sdkVersion: nh, origin: window.location.origin, coop: lJ() @@ -28801,7 +28801,7 @@ function vJ(t) { } return t; } -var pS = { exports: {} }; +var gS = { exports: {} }; (function(t) { var e = Object.prototype.hasOwnProperty, r = "~"; function n() { @@ -28841,9 +28841,9 @@ var pS = { exports: {} }; }, a.prototype.emit = function(l, d, p, w, A, M) { var N = r ? r + l : l; if (!this._events[N]) return !1; - var L = this._events[N], B = arguments.length, $, H; + var L = this._events[N], $ = arguments.length, B, H; if (L.fn) { - switch (L.once && this.removeListener(l, L.fn, void 0, !0), B) { + switch (L.once && this.removeListener(l, L.fn, void 0, !0), $) { case 1: return L.fn.call(L.context), !0; case 2: @@ -28857,13 +28857,13 @@ var pS = { exports: {} }; case 6: return L.fn.call(L.context, d, p, w, A, M), !0; } - for (H = 1, $ = new Array(B - 1); H < B; H++) - $[H - 1] = arguments[H]; - L.fn.apply(L.context, $); + for (H = 1, B = new Array($ - 1); H < $; H++) + B[H - 1] = arguments[H]; + L.fn.apply(L.context, B); } else { - var W = L.length, V; - for (H = 0; H < W; H++) - switch (L[H].once && this.removeListener(l, L[H].fn, void 0, !0), B) { + var U = L.length, V; + for (H = 0; H < U; H++) + switch (L[H].once && this.removeListener(l, L[H].fn, void 0, !0), $) { case 1: L[H].fn.call(L[H].context); break; @@ -28877,9 +28877,9 @@ var pS = { exports: {} }; L[H].fn.call(L[H].context, d, p, w); break; default: - if (!$) for (V = 1, $ = new Array(B - 1); V < B; V++) - $[V - 1] = arguments[V]; - L[H].fn.apply(L[H].context, $); + if (!B) for (V = 1, B = new Array($ - 1); V < $; V++) + B[V - 1] = arguments[V]; + L[H].fn.apply(L[H].context, B); } } return !0; @@ -28896,7 +28896,7 @@ var pS = { exports: {} }; if (M.fn) M.fn === d && (!w || M.once) && (!p || M.context === p) && o(this, A); else { - for (var N = 0, L = [], B = M.length; N < B; N++) + for (var N = 0, L = [], $ = M.length; N < $; N++) (M[N].fn !== d || w && !M[N].once || p && M[N].context !== p) && L.push(M[N]); L.length ? this._events[A] = L.length === 1 ? L[0] : L : o(this, A); } @@ -28905,8 +28905,8 @@ var pS = { exports: {} }; var d; return l ? (d = r ? r + l : l, this._events[d] && o(this, d)) : (this._events = new n(), this._eventsCount = 0), this; }, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = r, a.EventEmitter = a, t.exports = a; -})(pS); -var bJ = pS.exports; +})(gS); +var bJ = gS.exports; const yJ = /* @__PURE__ */ ts(bJ); class wJ extends yJ { } @@ -29015,27 +29015,27 @@ function PJ(t) { getProvider: () => (i || (i = SJ(n)), i) }; } -function gS(t, e) { +function mS(t, e) { return function() { return t.apply(e, arguments); }; } -const { toString: MJ } = Object.prototype, { getPrototypeOf: Ab } = Object, fp = /* @__PURE__ */ ((t) => (e) => { +const { toString: MJ } = Object.prototype, { getPrototypeOf: Pb } = Object, fp = /* @__PURE__ */ ((t) => (e) => { const r = MJ.call(e); return t[r] || (t[r] = r.slice(8, -1).toLowerCase()); })(/* @__PURE__ */ Object.create(null)), Ps = (t) => (t = t.toLowerCase(), (e) => fp(e) === t), lp = (t) => (e) => typeof e === t, { isArray: Wu } = Array, Ml = lp("undefined"); function IJ(t) { return t !== null && !Ml(t) && t.constructor !== null && !Ml(t.constructor) && Oi(t.constructor.isBuffer) && t.constructor.isBuffer(t); } -const mS = Ps("ArrayBuffer"); +const vS = Ps("ArrayBuffer"); function CJ(t) { let e; - return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && mS(t.buffer), e; + return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && vS(t.buffer), e; } -const TJ = lp("string"), Oi = lp("function"), vS = lp("number"), hp = (t) => t !== null && typeof t == "object", RJ = (t) => t === !0 || t === !1, kd = (t) => { +const TJ = lp("string"), Oi = lp("function"), bS = lp("number"), hp = (t) => t !== null && typeof t == "object", RJ = (t) => t === !0 || t === !1, kd = (t) => { if (fp(t) !== "object") return !1; - const e = Ab(t); + const e = Pb(t); return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in t) && !(Symbol.iterator in t); }, DJ = Ps("Date"), OJ = Ps("File"), NJ = Ps("Blob"), LJ = Ps("FileList"), kJ = (t) => hp(t) && Oi(t.pipe), $J = (t) => { let e; @@ -29056,7 +29056,7 @@ function sh(t, e, { allOwnKeys: r = !1 } = {}) { a = s[n], e.call(null, t[a], a, t); } } -function bS(t, e) { +function yS(t, e) { e = e.toLowerCase(); const r = Object.keys(t); let n = r.length, i; @@ -29065,10 +29065,10 @@ function bS(t, e) { return i; return null; } -const ic = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, yS = (t) => !Ml(t) && t !== ic; +const ic = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, wS = (t) => !Ml(t) && t !== ic; function H1() { - const { caseless: t } = yS(this) && this || {}, e = {}, r = (n, i) => { - const s = t && bS(e, i) || i; + const { caseless: t } = wS(this) && this || {}, e = {}, r = (n, i) => { + const s = t && yS(e, i) || i; kd(e[s]) && kd(n) ? e[s] = H1(e[s], n) : kd(n) ? e[s] = H1({}, n) : Wu(n) ? e[s] = n.slice() : e[s] = n; }; for (let n = 0, i = arguments.length; n < i; n++) @@ -29076,7 +29076,7 @@ function H1() { return e; } const WJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { - r && Oi(i) ? t[s] = gS(i, r) : t[s] = i; + r && Oi(i) ? t[s] = mS(i, r) : t[s] = i; }, { allOwnKeys: n }), t), HJ = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), KJ = (t, e, r, n) => { t.prototype = Object.create(e.prototype, n), t.prototype.constructor = t, Object.defineProperty(t, "super", { value: e.prototype @@ -29088,7 +29088,7 @@ const WJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { do { for (i = Object.getOwnPropertyNames(t), s = i.length; s-- > 0; ) o = i[s], (!n || n(o, t, e)) && !a[o] && (e[o] = t[o], a[o] = !0); - t = r !== !1 && Ab(t); + t = r !== !1 && Pb(t); } while (t && (!r || r(t, e)) && t !== Object.prototype); return e; }, GJ = (t, e, r) => { @@ -29099,12 +29099,12 @@ const WJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { if (!t) return null; if (Wu(t)) return t; let e = t.length; - if (!vS(e)) return null; + if (!bS(e)) return null; const r = new Array(e); for (; e-- > 0; ) r[e] = t[e]; return r; -}, JJ = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Ab(Uint8Array)), XJ = (t, e) => { +}, JJ = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Pb(Uint8Array)), XJ = (t, e) => { const n = (t && t[Symbol.iterator]).call(t); let i; for (; (i = n.next()) && !i.done; ) { @@ -29122,14 +29122,14 @@ const WJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { function(r, n, i) { return n.toUpperCase() + i; } -), D_ = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), tX = Ps("RegExp"), wS = (t, e) => { +), O_ = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), tX = Ps("RegExp"), xS = (t, e) => { const r = Object.getOwnPropertyDescriptors(t), n = {}; sh(r, (i, s) => { let o; (o = e(i, s, t)) !== !1 && (n[s] = o || i); }), Object.defineProperties(t, n); }, rX = (t) => { - wS(t, (e, r) => { + xS(t, (e, r) => { if (Oi(t) && ["arguments", "caller", "callee"].indexOf(r) !== -1) return !1; const n = t[r]; @@ -29151,11 +29151,11 @@ const WJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { }; return Wu(t) ? n(t) : n(String(t).split(e)), r; }, iX = () => { -}, sX = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, Im = "abcdefghijklmnopqrstuvwxyz", O_ = "0123456789", xS = { - DIGIT: O_, +}, sX = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, Im = "abcdefghijklmnopqrstuvwxyz", N_ = "0123456789", _S = { + DIGIT: N_, ALPHA: Im, - ALPHA_DIGIT: Im + Im.toUpperCase() + O_ -}, oX = (t = 16, e = xS.ALPHA_DIGIT) => { + ALPHA_DIGIT: Im + Im.toUpperCase() + N_ +}, oX = (t = 16, e = _S.ALPHA_DIGIT) => { let r = ""; const { length: n } = e; for (; t--; ) @@ -29182,21 +29182,21 @@ const cX = (t) => { return n; }; return r(t, 0); -}, uX = Ps("AsyncFunction"), fX = (t) => t && (hp(t) || Oi(t)) && Oi(t.then) && Oi(t.catch), _S = ((t, e) => t ? setImmediate : e ? ((r, n) => (ic.addEventListener("message", ({ source: i, data: s }) => { +}, uX = Ps("AsyncFunction"), fX = (t) => t && (hp(t) || Oi(t)) && Oi(t.then) && Oi(t.catch), ES = ((t, e) => t ? setImmediate : e ? ((r, n) => (ic.addEventListener("message", ({ source: i, data: s }) => { i === ic && s === r && n.length && n.shift()(); }, !1), (i) => { n.push(i), ic.postMessage(r, "*"); }))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))( typeof setImmediate == "function", Oi(ic.postMessage) -), lX = typeof queueMicrotask < "u" ? queueMicrotask.bind(ic) : typeof process < "u" && process.nextTick || _S, Oe = { +), lX = typeof queueMicrotask < "u" ? queueMicrotask.bind(ic) : typeof process < "u" && process.nextTick || ES, Oe = { isArray: Wu, - isArrayBuffer: mS, + isArrayBuffer: vS, isBuffer: IJ, isFormData: $J, isArrayBufferView: CJ, isString: TJ, - isNumber: vS, + isNumber: bS, isBoolean: RJ, isObject: hp, isPlainObject: kd, @@ -29228,25 +29228,25 @@ const cX = (t) => { forEachEntry: XJ, matchAll: ZJ, isHTMLForm: QJ, - hasOwnProperty: D_, - hasOwnProp: D_, + hasOwnProperty: O_, + hasOwnProp: O_, // an alias to avoid ESLint no-prototype-builtins detection - reduceDescriptors: wS, + reduceDescriptors: xS, freezeMethods: rX, toObjectSet: nX, toCamelCase: eX, noop: iX, toFiniteNumber: sX, - findKey: bS, + findKey: yS, global: ic, - isContextDefined: yS, - ALPHABET: xS, + isContextDefined: wS, + ALPHABET: _S, generateString: oX, isSpecCompliantForm: aX, toJSONObject: cX, isAsyncFn: uX, isThenable: fX, - setImmediate: _S, + setImmediate: ES, asap: lX }; function or(t, e, r, n, i) { @@ -29273,7 +29273,7 @@ Oe.inherits(or, Error, { }; } }); -const ES = or.prototype, SS = {}; +const SS = or.prototype, AS = {}; [ "ERR_BAD_OPTION_VALUE", "ERR_BAD_OPTION", @@ -29289,12 +29289,12 @@ const ES = or.prototype, SS = {}; "ERR_INVALID_URL" // eslint-disable-next-line func-names ].forEach((t) => { - SS[t] = { value: t }; + AS[t] = { value: t }; }); -Object.defineProperties(or, SS); -Object.defineProperty(ES, "isAxiosError", { value: !0 }); +Object.defineProperties(or, AS); +Object.defineProperty(SS, "isAxiosError", { value: !0 }); or.from = (t, e, r, n, i, s) => { - const o = Object.create(ES); + const o = Object.create(SS); return Oe.toFlatObject(t, o, function(u) { return u !== Error.prototype; }, (a) => a !== "isAxiosError"), or.call(o, t.message, e, r, n, i), o.cause = t, o.name = t.name, s && Object.assign(o, s), o; @@ -29303,12 +29303,12 @@ const hX = null; function K1(t) { return Oe.isPlainObject(t) || Oe.isArray(t); } -function AS(t) { +function PS(t) { return Oe.endsWith(t, "[]") ? t.slice(0, -2) : t; } -function N_(t, e, r) { +function L_(t, e, r) { return t ? t.concat(e).map(function(i, s) { - return i = AS(i), !r && s ? "[" + i + "]" : i; + return i = PS(i), !r && s ? "[" + i + "]" : i; }).join(r ? "." : "") : e; } function dX(t) { @@ -29339,20 +29339,20 @@ function dp(t, e, r) { return Oe.isArrayBuffer(M) || Oe.isTypedArray(M) ? u && typeof Blob == "function" ? new Blob([M]) : Buffer.from(M) : M; } function d(M, N, L) { - let B = M; + let $ = M; if (M && !L && typeof M == "object") { if (Oe.endsWith(N, "{}")) N = n ? N : N.slice(0, -2), M = JSON.stringify(M); - else if (Oe.isArray(M) && dX(M) || (Oe.isFileList(M) || Oe.endsWith(N, "[]")) && (B = Oe.toArray(M))) - return N = AS(N), B.forEach(function(H, W) { + else if (Oe.isArray(M) && dX(M) || (Oe.isFileList(M) || Oe.endsWith(N, "[]")) && ($ = Oe.toArray(M))) + return N = PS(N), $.forEach(function(H, U) { !(Oe.isUndefined(H) || H === null) && e.append( // eslint-disable-next-line no-nested-ternary - o === !0 ? N_([N], W, s) : o === null ? N : N + "[]", + o === !0 ? L_([N], U, s) : o === null ? N : N + "[]", l(H) ); }), !1; } - return K1(M) ? !0 : (e.append(N_(L, N, s), l(M)), !1); + return K1(M) ? !0 : (e.append(L_(L, N, s), l(M)), !1); } const p = [], w = Object.assign(pX, { defaultVisitor: d, @@ -29363,14 +29363,14 @@ function dp(t, e, r) { if (!Oe.isUndefined(M)) { if (p.indexOf(M) !== -1) throw Error("Circular reference detected in " + N.join(".")); - p.push(M), Oe.forEach(M, function(B, $) { - (!(Oe.isUndefined(B) || B === null) && i.call( + p.push(M), Oe.forEach(M, function($, B) { + (!(Oe.isUndefined($) || $ === null) && i.call( e, - B, - Oe.isString($) ? $.trim() : $, + $, + Oe.isString(B) ? B.trim() : B, N, w - )) === !0 && A(B, N ? N.concat($) : [$]); + )) === !0 && A($, N ? N.concat(B) : [B]); }), p.pop(); } } @@ -29378,7 +29378,7 @@ function dp(t, e, r) { throw new TypeError("data must be an object"); return A(t), e; } -function L_(t) { +function k_(t) { const e = { "!": "%21", "'": "%27", @@ -29392,17 +29392,17 @@ function L_(t) { return e[n]; }); } -function Pb(t, e) { +function Mb(t, e) { this._pairs = [], t && dp(t, this, e); } -const PS = Pb.prototype; -PS.append = function(e, r) { +const MS = Mb.prototype; +MS.append = function(e, r) { this._pairs.push([e, r]); }; -PS.toString = function(e) { +MS.toString = function(e) { const r = e ? function(n) { - return e.call(this, n, L_); - } : L_; + return e.call(this, n, k_); + } : k_; return this._pairs.map(function(i) { return r(i[0]) + "=" + r(i[1]); }, "").join("&"); @@ -29410,7 +29410,7 @@ PS.toString = function(e) { function gX(t) { return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]"); } -function MS(t, e, r) { +function IS(t, e, r) { if (!e) return t; const n = r && r.encode || gX; @@ -29419,13 +29419,13 @@ function MS(t, e, r) { }); const i = r && r.serialize; let s; - if (i ? s = i(e, r) : s = Oe.isURLSearchParams(e) ? e.toString() : new Pb(e, r).toString(n), s) { + if (i ? s = i(e, r) : s = Oe.isURLSearchParams(e) ? e.toString() : new Mb(e, r).toString(n), s) { const o = t.indexOf("#"); o !== -1 && (t = t.slice(0, o)), t += (t.indexOf("?") === -1 ? "?" : "&") + s; } return t; } -class k_ { +class $_ { constructor() { this.handlers = []; } @@ -29479,11 +29479,11 @@ class k_ { }); } } -const IS = { +const CS = { silentJSONParsing: !0, forcedJSONParsing: !0, clarifyTimeoutError: !1 -}, mX = typeof URLSearchParams < "u" ? URLSearchParams : Pb, vX = typeof FormData < "u" ? FormData : null, bX = typeof Blob < "u" ? Blob : null, yX = { +}, mX = typeof URLSearchParams < "u" ? URLSearchParams : Mb, vX = typeof FormData < "u" ? FormData : null, bX = typeof Blob < "u" ? Blob : null, yX = { isBrowser: !0, classes: { URLSearchParams: mX, @@ -29491,10 +29491,10 @@ const IS = { Blob: bX }, protocols: ["http", "https", "file", "blob", "url", "data"] -}, Mb = typeof window < "u" && typeof document < "u", V1 = typeof navigator == "object" && navigator || void 0, wX = Mb && (!V1 || ["ReactNative", "NativeScript", "NS"].indexOf(V1.product) < 0), xX = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef -self instanceof WorkerGlobalScope && typeof self.importScripts == "function", _X = Mb && window.location.href || "http://localhost", EX = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}, Ib = typeof window < "u" && typeof document < "u", V1 = typeof navigator == "object" && navigator || void 0, wX = Ib && (!V1 || ["ReactNative", "NativeScript", "NS"].indexOf(V1.product) < 0), xX = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef +self instanceof WorkerGlobalScope && typeof self.importScripts == "function", _X = Ib && window.location.href || "http://localhost", EX = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - hasBrowserEnv: Mb, + hasBrowserEnv: Ib, hasStandardBrowserEnv: wX, hasStandardBrowserWebWorkerEnv: xX, navigator: V1, @@ -29522,7 +29522,7 @@ function PX(t) { s = r[n], e[s] = t[s]; return e; } -function CS(t) { +function TS(t) { function e(r, n, i, s) { let o = r[s++]; if (o === "__proto__") return !0; @@ -29548,12 +29548,12 @@ function MX(t, e, r) { return (r || JSON.stringify)(t); } const oh = { - transitional: IS, + transitional: CS, adapter: ["xhr", "http", "fetch"], transformRequest: [function(e, r) { const n = r.getContentType() || "", i = n.indexOf("application/json") > -1, s = Oe.isObject(e); if (s && Oe.isHTMLForm(e) && (e = new FormData(e)), Oe.isFormData(e)) - return i ? JSON.stringify(CS(e)) : e; + return i ? JSON.stringify(TS(e)) : e; if (Oe.isArrayBuffer(e) || Oe.isBuffer(e) || Oe.isStream(e) || Oe.isFile(e) || Oe.isBlob(e) || Oe.isReadableStream(e)) return e; if (Oe.isArrayBufferView(e)) @@ -29641,7 +29641,7 @@ const IX = Oe.toObjectSet([ `).forEach(function(o) { i = o.indexOf(":"), r = o.substring(0, i).trim().toLowerCase(), n = o.substring(i + 1).trim(), !(!r || e[r] && IX[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n); }), e; -}, $_ = Symbol("internals"); +}, B_ = Symbol("internals"); function Df(t) { return t && String(t).trim().toLowerCase(); } @@ -29680,7 +29680,7 @@ function OX(t, e) { }); }); } -let yi = class { +let wi = class { constructor(e) { e && this.set(e); } @@ -29788,7 +29788,7 @@ let yi = class { return r.forEach((i) => n.set(i)), n; } static accessor(e) { - const n = (this[$_] = this[$_] = { + const n = (this[B_] = this[B_] = { accessors: {} }).accessors, i = this.prototype; function s(o) { @@ -29798,8 +29798,8 @@ let yi = class { return Oe.isArray(e) ? e.forEach(s) : s(e), this; } }; -yi.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]); -Oe.reduceDescriptors(yi.prototype, ({ value: t }, e) => { +wi.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]); +Oe.reduceDescriptors(wi.prototype, ({ value: t }, e) => { let r = e[0].toUpperCase() + e.slice(1); return { get: () => t, @@ -29808,15 +29808,15 @@ Oe.reduceDescriptors(yi.prototype, ({ value: t }, e) => { } }; }); -Oe.freezeMethods(yi); +Oe.freezeMethods(wi); function Tm(t, e) { - const r = this || oh, n = e || r, i = yi.from(n.headers); + const r = this || oh, n = e || r, i = wi.from(n.headers); let s = n.data; return Oe.forEach(t, function(a) { s = a.call(r, s, i.normalize(), e ? e.status : void 0); }), i.normalize(), s; } -function TS(t) { +function RS(t) { return !!(t && t.__CANCEL__); } function Hu(t, e, r) { @@ -29825,7 +29825,7 @@ function Hu(t, e, r) { Oe.inherits(Hu, or, { __CANCEL__: !0 }); -function RS(t, e, r) { +function DS(t, e, r) { const n = r.config.validateStatus; !r.status || !n || n(r.status) ? t(r) : e(new or( "Request failed with status code " + r.status, @@ -29886,14 +29886,14 @@ const g0 = (t, e, r = 3) => { }; t(p); }, r); -}, B_ = (t, e) => { +}, F_ = (t, e) => { const r = t != null; return [(n) => e[0]({ lengthComputable: r, total: t, loaded: n }), e[1]]; -}, F_ = (t) => (...e) => Oe.asap(() => t(...e)), $X = Jn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Jn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( +}, j_ = (t) => (...e) => Oe.asap(() => t(...e)), $X = Jn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Jn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( new URL(Jn.origin), Jn.navigator && /(msie|trident)/i.test(Jn.navigator.userAgent) ) : () => !0, BX = Jn.hasStandardBrowserEnv ? ( @@ -29929,10 +29929,10 @@ function FX(t) { function jX(t, e) { return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t; } -function DS(t, e) { +function OS(t, e) { return t && !FX(e) ? jX(t, e) : e; } -const j_ = (t) => t instanceof yi ? { ...t } : t; +const U_ = (t) => t instanceof wi ? { ...t } : t; function gc(t, e) { e = e || {}; const r = {}; @@ -29990,17 +29990,17 @@ function gc(t, e) { socketPath: o, responseEncoding: o, validateStatus: a, - headers: (l, d, p) => i(j_(l), j_(d), p, !0) + headers: (l, d, p) => i(U_(l), U_(d), p, !0) }; return Oe.forEach(Object.keys(Object.assign({}, t, e)), function(d) { const p = u[d] || i, w = p(t[d], e[d], d); Oe.isUndefined(w) && p !== a || (r[d] = w); }), r; } -const OS = (t) => { +const NS = (t) => { const e = gc({}, t); let { data: r, withXSRFToken: n, xsrfHeaderName: i, xsrfCookieName: s, headers: o, auth: a } = e; - e.headers = o = yi.from(o), e.url = MS(DS(e.baseURL, e.url), t.params, t.paramsSerializer), a && o.set( + e.headers = o = wi.from(o), e.url = IS(OS(e.baseURL, e.url), t.params, t.paramsSerializer), a && o.set( "Authorization", "Basic " + btoa((a.username || "") + ":" + (a.password ? unescape(encodeURIComponent(a.password)) : "")) ); @@ -30020,19 +30020,19 @@ const OS = (t) => { return e; }, UX = typeof XMLHttpRequest < "u", qX = UX && function(t) { return new Promise(function(r, n) { - const i = OS(t); + const i = NS(t); let s = i.data; - const o = yi.from(i.headers).normalize(); + const o = wi.from(i.headers).normalize(); let { responseType: a, onUploadProgress: u, onDownloadProgress: l } = i, d, p, w, A, M; function N() { A && A(), M && M(), i.cancelToken && i.cancelToken.unsubscribe(d), i.signal && i.signal.removeEventListener("abort", d); } let L = new XMLHttpRequest(); L.open(i.method.toUpperCase(), i.url, !0), L.timeout = i.timeout; - function B() { + function $() { if (!L) return; - const H = yi.from( + const H = wi.from( "getAllResponseHeaders" in L && L.getAllResponseHeaders() ), V = { data: !a || a === "text" || a === "json" ? L.responseText : L.response, @@ -30042,35 +30042,35 @@ const OS = (t) => { config: t, request: L }; - RS(function(R) { + DS(function(R) { r(R), N(); }, function(R) { n(R), N(); }, V), L = null; } - "onloadend" in L ? L.onloadend = B : L.onreadystatechange = function() { - !L || L.readyState !== 4 || L.status === 0 && !(L.responseURL && L.responseURL.indexOf("file:") === 0) || setTimeout(B); + "onloadend" in L ? L.onloadend = $ : L.onreadystatechange = function() { + !L || L.readyState !== 4 || L.status === 0 && !(L.responseURL && L.responseURL.indexOf("file:") === 0) || setTimeout($); }, L.onabort = function() { L && (n(new or("Request aborted", or.ECONNABORTED, t, L)), L = null); }, L.onerror = function() { n(new or("Network Error", or.ERR_NETWORK, t, L)), L = null; }, L.ontimeout = function() { - let W = i.timeout ? "timeout of " + i.timeout + "ms exceeded" : "timeout exceeded"; - const V = i.transitional || IS; - i.timeoutErrorMessage && (W = i.timeoutErrorMessage), n(new or( - W, + let U = i.timeout ? "timeout of " + i.timeout + "ms exceeded" : "timeout exceeded"; + const V = i.transitional || CS; + i.timeoutErrorMessage && (U = i.timeoutErrorMessage), n(new or( + U, V.clarifyTimeoutError ? or.ETIMEDOUT : or.ECONNABORTED, t, L )), L = null; - }, s === void 0 && o.setContentType(null), "setRequestHeader" in L && Oe.forEach(o.toJSON(), function(W, V) { - L.setRequestHeader(V, W); + }, s === void 0 && o.setContentType(null), "setRequestHeader" in L && Oe.forEach(o.toJSON(), function(U, V) { + L.setRequestHeader(V, U); }), Oe.isUndefined(i.withCredentials) || (L.withCredentials = !!i.withCredentials), a && a !== "json" && (L.responseType = i.responseType), l && ([w, M] = g0(l, !0), L.addEventListener("progress", w)), u && L.upload && ([p, A] = g0(u), L.upload.addEventListener("progress", p), L.upload.addEventListener("loadend", A)), (i.cancelToken || i.signal) && (d = (H) => { L && (n(!H || H.type ? new Hu(null, t, L) : H), L.abort(), L = null); }, i.cancelToken && i.cancelToken.subscribe(d), i.signal && (i.signal.aborted ? d() : i.signal.addEventListener("abort", d))); - const $ = NX(i.url); - if ($ && Jn.protocols.indexOf($) === -1) { - n(new or("Unsupported protocol " + $ + ":", or.ERR_BAD_REQUEST, t)); + const B = NX(i.url); + if (B && Jn.protocols.indexOf(B) === -1) { + n(new or("Unsupported protocol " + B + ":", or.ERR_BAD_REQUEST, t)); return; } L.send(s || null); @@ -30126,7 +30126,7 @@ const OS = (t) => { } finally { await e.cancel(); } -}, U_ = (t, e, r, n) => { +}, q_ = (t, e, r, n) => { const i = HX(t, e); let s = 0, o, a = (u) => { o || (o = !0, n && n(u)); @@ -30155,13 +30155,13 @@ const OS = (t) => { }, { highWaterMark: 2 }); -}, pp = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", NS = pp && typeof ReadableStream == "function", VX = pp && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), LS = (t, ...e) => { +}, pp = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", LS = pp && typeof ReadableStream == "function", VX = pp && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), kS = (t, ...e) => { try { return !!t(...e); } catch { return !1; } -}, GX = NS && LS(() => { +}, GX = LS && kS(() => { let t = !1; const e = new Request(Jn.origin, { body: new ReadableStream(), @@ -30171,7 +30171,7 @@ const OS = (t) => { } }).headers.has("Content-Type"); return t && !e; -}), q_ = 64 * 1024, G1 = NS && LS(() => Oe.isReadableStream(new Response("").body)), m0 = { +}), z_ = 64 * 1024, G1 = LS && kS(() => Oe.isReadableStream(new Response("").body)), m0 = { stream: G1 && ((t) => t.body) }; pp && ((t) => { @@ -30212,7 +30212,7 @@ const YX = async (t) => { headers: d, withCredentials: p = "same-origin", fetchOptions: w - } = OS(t); + } = NS(t); l = l ? (l + "").toLowerCase() : "text"; let A = zX([i, s && s.toAbortSignal()], o), M; const N = A && A.unsubscribe && (() => { @@ -30227,15 +30227,15 @@ const YX = async (t) => { duplex: "half" }), te; if (Oe.isFormData(n) && (te = V.headers.get("content-type")) && d.setContentType(te), V.body) { - const [R, K] = B_( + const [R, K] = F_( L, - g0(F_(u)) + g0(j_(u)) ); - n = U_(V.body, q_, R, K); + n = q_(V.body, z_, R, K); } } Oe.isString(p) || (p = p ? "include" : "omit"); - const B = "credentials" in Request.prototype; + const $ = "credentials" in Request.prototype; M = new Request(e, { ...w, signal: A, @@ -30243,45 +30243,45 @@ const YX = async (t) => { headers: d.normalize().toJSON(), body: n, duplex: "half", - credentials: B ? p : void 0 + credentials: $ ? p : void 0 }); - let $ = await fetch(M); + let B = await fetch(M); const H = G1 && (l === "stream" || l === "response"); if (G1 && (a || H && N)) { const V = {}; ["status", "statusText", "headers"].forEach((ge) => { - V[ge] = $[ge]; + V[ge] = B[ge]; }); - const te = Oe.toFiniteNumber($.headers.get("content-length")), [R, K] = a && B_( + const te = Oe.toFiniteNumber(B.headers.get("content-length")), [R, K] = a && F_( te, - g0(F_(a), !0) + g0(j_(a), !0) ) || []; - $ = new Response( - U_($.body, q_, R, () => { + B = new Response( + q_(B.body, z_, R, () => { K && K(), N && N(); }), V ); } l = l || "text"; - let W = await m0[Oe.findKey(m0, l) || "text"]($, t); + let U = await m0[Oe.findKey(m0, l) || "text"](B, t); return !H && N && N(), await new Promise((V, te) => { - RS(V, te, { - data: W, - headers: yi.from($.headers), - status: $.status, - statusText: $.statusText, + DS(V, te, { + data: U, + headers: wi.from(B.headers), + status: B.status, + statusText: B.statusText, config: t, request: M }); }); - } catch (B) { - throw N && N(), B && B.name === "TypeError" && /fetch/i.test(B.message) ? Object.assign( + } catch ($) { + throw N && N(), $ && $.name === "TypeError" && /fetch/i.test($.message) ? Object.assign( new or("Network Error", or.ERR_NETWORK, t, M), { - cause: B.cause || B + cause: $.cause || $ } - ) : or.from(B, B && B.code, t, M); + ) : or.from($, $ && $.code, t, M); } }), Y1 = { http: hX, @@ -30297,7 +30297,7 @@ Oe.forEach(Y1, (t, e) => { Object.defineProperty(t, "adapterName", { value: e }); } }); -const z_ = (t) => `- ${t}`, ZX = (t) => Oe.isFunction(t) || t === null || t === !1, kS = { +const W_ = (t) => `- ${t}`, ZX = (t) => Oe.isFunction(t) || t === null || t === !1, $S = { getAdapter: (t) => { t = Oe.isArray(t) ? t : [t]; const { length: e } = t; @@ -30317,8 +30317,8 @@ const z_ = (t) => `- ${t}`, ZX = (t) => Oe.isFunction(t) || t === null || t === ([a, u]) => `adapter ${a} ` + (u === !1 ? "is not supported by the environment" : "is not available in the build") ); let o = e ? s.length > 1 ? `since : -` + s.map(z_).join(` -`) : " " + z_(s[0]) : "as no adapter specified"; +` + s.map(W_).join(` +`) : " " + W_(s[0]) : "as no adapter specified"; throw new or( "There is no suitable adapter to dispatch the request " + o, "ERR_NOT_SUPPORT" @@ -30332,34 +30332,34 @@ function Rm(t) { if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted) throw new Hu(null, t); } -function W_(t) { - return Rm(t), t.headers = yi.from(t.headers), t.data = Tm.call( +function H_(t) { + return Rm(t), t.headers = wi.from(t.headers), t.data = Tm.call( t, t.transformRequest - ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), kS.getAdapter(t.adapter || oh.adapter)(t).then(function(n) { + ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), $S.getAdapter(t.adapter || oh.adapter)(t).then(function(n) { return Rm(t), n.data = Tm.call( t, t.transformResponse, n - ), n.headers = yi.from(n.headers), n; + ), n.headers = wi.from(n.headers), n; }, function(n) { - return TS(n) || (Rm(t), n && n.response && (n.response.data = Tm.call( + return RS(n) || (Rm(t), n && n.response && (n.response.data = Tm.call( t, t.transformResponse, n.response - ), n.response.headers = yi.from(n.response.headers))), Promise.reject(n); + ), n.response.headers = wi.from(n.response.headers))), Promise.reject(n); }); } -const $S = "1.7.8", gp = {}; +const BS = "1.7.8", gp = {}; ["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => { gp[t] = function(n) { return typeof n === t || "a" + (e < 1 ? "n " : " ") + t; }; }); -const H_ = {}; +const K_ = {}; gp.transitional = function(e, r, n) { function i(s, o) { - return "[Axios v" + $S + "] Transitional option '" + s + "'" + o + (n ? ". " + n : ""); + return "[Axios v" + BS + "] Transitional option '" + s + "'" + o + (n ? ". " + n : ""); } return (s, o, a) => { if (e === !1) @@ -30367,7 +30367,7 @@ gp.transitional = function(e, r, n) { i(o, " has been removed" + (r ? " in " + r : "")), or.ERR_DEPRECATED ); - return r && !H_[o] && (H_[o] = !0, console.warn( + return r && !K_[o] && (K_[o] = !0, console.warn( i( o, " has been deprecated since v" + r + " and will be removed in the near future" @@ -30402,8 +30402,8 @@ const Bd = { let ac = class { constructor(e) { this.defaults = e, this.interceptors = { - request: new k_(), - response: new k_() + request: new $_(), + response: new $_() }; } /** @@ -30456,7 +30456,7 @@ let ac = class { (M) => { delete s[M]; } - ), r.headers = yi.concat(o, s); + ), r.headers = wi.concat(o, s); const a = []; let u = !0; this.interceptors.request.forEach(function(N) { @@ -30468,7 +30468,7 @@ let ac = class { }); let d, p = 0, w; if (!u) { - const M = [W_.bind(this), void 0]; + const M = [H_.bind(this), void 0]; for (M.unshift.apply(M, a), M.push.apply(M, l), w = M.length, d = Promise.resolve(r); p < w; ) d = d.then(M[p++], M[p++]); return d; @@ -30485,7 +30485,7 @@ let ac = class { } } try { - d = W_.call(this, A); + d = H_.call(this, A); } catch (M) { return Promise.reject(M); } @@ -30495,8 +30495,8 @@ let ac = class { } getUri(e) { e = gc(this.defaults, e); - const r = DS(e.baseURL, e.url); - return MS(r, e.params, e.paramsSerializer); + const r = OS(e.baseURL, e.url); + return IS(r, e.params, e.paramsSerializer); } }; Oe.forEach(["delete", "get", "head", "options"], function(e) { @@ -30523,7 +30523,7 @@ Oe.forEach(["post", "put", "patch"], function(e) { } ac.prototype[e] = r(), ac.prototype[e + "Form"] = r(!0); }); -let eZ = class BS { +let eZ = class FS { constructor(e) { if (typeof e != "function") throw new TypeError("executor must be a function."); @@ -30589,7 +30589,7 @@ let eZ = class BS { static source() { let e; return { - token: new BS(function(i) { + token: new FS(function(i) { e = i; }), cancel: e @@ -30672,18 +30672,18 @@ const J1 = { Object.entries(J1).forEach(([t, e]) => { J1[e] = t; }); -function FS(t) { - const e = new ac(t), r = gS(ac.prototype.request, e); +function jS(t) { + const e = new ac(t), r = mS(ac.prototype.request, e); return Oe.extend(r, ac.prototype, e, { allOwnKeys: !0 }), Oe.extend(r, e, null, { allOwnKeys: !0 }), r.create = function(i) { - return FS(gc(t, i)); + return jS(gc(t, i)); }, r; } -const mn = FS(oh); +const mn = jS(oh); mn.Axios = ac; mn.CanceledError = Hu; mn.CancelToken = eZ; -mn.isCancel = TS; -mn.VERSION = $S; +mn.isCancel = RS; +mn.VERSION = BS; mn.toFormData = dp; mn.AxiosError = or; mn.Cancel = mn.CanceledError; @@ -30693,14 +30693,14 @@ mn.all = function(e) { mn.spread = tZ; mn.isAxiosError = rZ; mn.mergeConfig = gc; -mn.AxiosHeaders = yi; -mn.formToJSON = (t) => CS(Oe.isHTMLForm(t) ? new FormData(t) : t); -mn.getAdapter = kS.getAdapter; +mn.AxiosHeaders = wi; +mn.formToJSON = (t) => TS(Oe.isHTMLForm(t) ? new FormData(t) : t); +mn.getAdapter = $S.getAdapter; mn.HttpStatusCode = J1; mn.default = mn; const { Axios: noe, - AxiosError: jS, + AxiosError: US, CanceledError: ioe, isCancel: soe, CancelToken: ooe, @@ -30715,7 +30715,7 @@ const { formToJSON: goe, getAdapter: moe, mergeConfig: voe -} = mn, US = mn.create({ +} = mn, qS = mn.create({ timeout: 6e4, headers: { "Content-Type": "application/json", @@ -30725,7 +30725,7 @@ const { function nZ(t) { var e, r, n; if (((e = t.data) == null ? void 0 : e.success) !== !0) { - const i = new jS( + const i = new US( (r = t.data) == null ? void 0 : r.errorMessage, (n = t.data) == null ? void 0 : n.errorCode, t.config, @@ -30742,7 +30742,7 @@ function iZ(t) { const e = (r = t.response) == null ? void 0 : r.data; if (e) { console.log(e, "responseData"); - const n = new jS( + const n = new US( e.errorMessage, t.code, t.config, @@ -30753,7 +30753,7 @@ function iZ(t) { } else return Promise.reject(t); } -US.interceptors.response.use( +qS.interceptors.response.use( nZ, iZ ); @@ -30794,7 +30794,7 @@ class sZ { return (await this.request.post("/api/v2/user/account/bind", e)).data; } } -const Ta = new sZ(US), oZ = { +const Ta = new sZ(qS), oZ = { projectId: "7a4434fefbcc9af474fb5c995e47d286", metadata: { name: "codatta", @@ -30805,7 +30805,7 @@ const Ta = new sZ(US), oZ = { }, aZ = PJ({ appName: "codatta", appLogoUrl: "https://avatars.githubusercontent.com/u/171659315" -}), qS = Sa({ +}), zS = Sa({ saveLastUsedWallet: () => { }, lastUsedWallet: null, @@ -30814,7 +30814,7 @@ const Ta = new sZ(US), oZ = { featuredWallets: [] }); function mp() { - return Tn(qS); + return Tn(zS); } function boe(t) { const { apiBaseUrl: e } = t, [r, n] = Yt([]), [i, s] = Yt([]), [o, a] = Yt(null), [u, l] = Yt(!1), d = (A) => { @@ -30827,34 +30827,35 @@ function boe(t) { localStorage.setItem("xn-last-used-info", JSON.stringify(N)); }; function p(A) { - const M = A.filter((B) => B.featured || B.installed), N = A.filter((B) => !B.featured && !B.installed), L = [...M, ...N]; + const M = A.filter(($) => $.featured || $.installed), N = A.filter(($) => !$.featured && !$.installed), L = [...M, ...N]; n(L), s(M); } async function w() { const A = [], M = /* @__PURE__ */ new Map(); qR.forEach((L) => { - const B = new vl(L); - L.name === "Coinbase Wallet" && B.EIP6963Detected({ + const $ = new vl(L); + L.name === "Coinbase Wallet" && $.EIP6963Detected({ info: { name: "Coinbase Wallet", uuid: "coinbase", icon: L.image, rdns: "coinbase" }, provider: aZ.getProvider() - }), M.set(B.key, B), A.push(B); + }), M.set($.key, $), A.push($); }), (await UG()).forEach((L) => { - const B = M.get(L.info.name); - if (B) - B.EIP6963Detected(L); + const $ = M.get(L.info.name); + if ($) + $.EIP6963Detected(L); else { - const $ = new vl(L); - M.set($.key, $), A.push($); + const B = new vl(L); + M.set(B.key, B), A.push(B); } + console.log(L); }); try { - const L = JSON.parse(localStorage.getItem("xn-last-used-info") || "{}"), B = M.get(L.key); - if (B) { - if (B.lastUsed = !0, L.provider === "UniversalProvider") { - const $ = await N1.init(oZ); - $.session && (B.setUniversalProvider($), console.log("Restored UniversalProvider for wallet:", B.key)); - } else L.provider === "EIP1193Provider" && B.installed && console.log("Using detected EIP1193Provider for wallet:", B.key); - a(B); + const L = JSON.parse(localStorage.getItem("xn-last-used-info") || "{}"), $ = M.get(L.key); + if ($) { + if ($.lastUsed = !0, L.provider === "UniversalProvider") { + const B = await N1.init(oZ); + B.session && ($.setUniversalProvider(B), console.log("Restored UniversalProvider for wallet:", $.key)); + } else L.provider === "EIP1193Provider" && $.installed && console.log("Using detected EIP1193Provider for wallet:", $.key); + a($); } } catch (L) { console.log(L); @@ -30864,7 +30865,7 @@ function boe(t) { return Dn(() => { w(), Ta.setApiBase(e); }, []), /* @__PURE__ */ pe.jsx( - qS.Provider, + zS.Provider, { value: { saveLastUsedWallet: d, @@ -30883,7 +30884,7 @@ function boe(t) { * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const cZ = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), zS = (...t) => t.filter((e, r, n) => !!e && e.trim() !== "" && n.indexOf(e) === r).join(" ").trim(); +const cZ = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), WS = (...t) => t.filter((e, r, n) => !!e && e.trim() !== "" && n.indexOf(e) === r).join(" ").trim(); /** * @license lucide-react v0.460.0 - ISC * @@ -30907,7 +30908,7 @@ var uZ = { * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const fZ = mv( +const fZ = vv( ({ color: t = "currentColor", size: e = 24, @@ -30926,7 +30927,7 @@ const fZ = mv( height: e, stroke: t, strokeWidth: n ? Number(r) * 24 / Number(e) : r, - className: zS("lucide", i), + className: WS("lucide", i), ...a }, [ @@ -30942,11 +30943,11 @@ const fZ = mv( * See the LICENSE file in the root directory of this source tree. */ const us = (t, e) => { - const r = mv( + const r = vv( ({ className: n, ...i }, s) => qd(fZ, { ref: s, iconNode: e, - className: zS(`lucide-${cZ(t)}`, n), + className: WS(`lucide-${cZ(t)}`, n), ...i }) ); @@ -30968,7 +30969,7 @@ const lZ = us("ArrowLeft", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const WS = us("ArrowRight", [ +const HS = us("ArrowRight", [ ["path", { d: "M5 12h14", key: "1ays0h" }], ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }] ]); @@ -31019,7 +31020,7 @@ const gZ = us("Globe", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const HS = us("Laptop", [ +const KS = us("Laptop", [ [ "path", { @@ -31064,7 +31065,7 @@ const vZ = us("Mail", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const KS = us("Search", [ +const VS = us("Search", [ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }], ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }] ]); @@ -31078,9 +31079,9 @@ const bZ = us("UserRoundCheck", [ ["path", { d: "M2 21a8 8 0 0 1 13.292-6", key: "bjp14o" }], ["circle", { cx: "10", cy: "8", r: "5", key: "o932ke" }], ["path", { d: "m16 19 2 2 4-4", key: "1b14m6" }] -]), K_ = /* @__PURE__ */ new Set(); +]), V_ = /* @__PURE__ */ new Set(); function vp(t, e, r) { - t || K_.has(e) || (console.warn(e), K_.add(e)); + t || V_.has(e) || (console.warn(e), V_.add(e)); } function yZ(t) { if (typeof Proxy > "u") @@ -31099,7 +31100,7 @@ function bp(t) { return t !== null && typeof t == "object" && typeof t.start == "function"; } const X1 = (t) => Array.isArray(t); -function VS(t, e) { +function GS(t, e) { if (!Array.isArray(e)) return !1; const r = e.length; @@ -31113,28 +31114,28 @@ function VS(t, e) { function Il(t) { return typeof t == "string" || Array.isArray(t); } -function V_(t) { +function G_(t) { const e = [{}, {}]; return t == null || t.values.forEach((r, n) => { e[0][n] = r.get(), e[1][n] = r.getVelocity(); }), e; } -function Ib(t, e, r, n) { +function Cb(t, e, r, n) { if (typeof e == "function") { - const [i, s] = V_(n); + const [i, s] = G_(n); e = e(r !== void 0 ? r : t.custom, i, s); } if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") { - const [i, s] = V_(n); + const [i, s] = G_(n); e = e(r !== void 0 ? r : t.custom, i, s); } return e; } function yp(t, e, r) { const n = t.getProps(); - return Ib(n, e, r !== void 0 ? r : n.custom, t); + return Cb(n, e, r !== void 0 ? r : n.custom, t); } -const Cb = [ +const Tb = [ "animate", "whileInView", "whileFocus", @@ -31142,7 +31143,7 @@ const Cb = [ "whileTap", "whileDrag", "exit" -], Tb = ["initial", ...Cb], ah = [ +], Rb = ["initial", ...Tb], ah = [ "transformPerspective", "x", "y", @@ -31178,7 +31179,7 @@ const Cb = [ ease: [0.25, 0.1, 0.35, 1], duration: 0.3 }, SZ = (t, { keyframes: e }) => e.length > 2 ? _Z : Ac.has(t) ? t.startsWith("scale") ? xZ(e[1]) : wZ : EZ; -function Rb(t, e) { +function Db(t, e) { return t ? t[e] || t.default || t : void 0; } const AZ = { @@ -31241,31 +31242,31 @@ const gd = [ "postRender" // Compute ], IZ = 40; -function GS(t, e) { +function YS(t, e) { let r = !1, n = !0; const i = { delta: 0, timestamp: 0, isProcessing: !1 - }, s = () => r = !0, o = gd.reduce((B, $) => (B[$] = MZ(s), B), {}), { read: a, resolveKeyframes: u, update: l, preRender: d, render: p, postRender: w } = o, A = () => { - const B = performance.now(); - r = !1, i.delta = n ? 1e3 / 60 : Math.max(Math.min(B - i.timestamp, IZ), 1), i.timestamp = B, i.isProcessing = !0, a.process(i), u.process(i), l.process(i), d.process(i), p.process(i), w.process(i), i.isProcessing = !1, r && e && (n = !1, t(A)); + }, s = () => r = !0, o = gd.reduce(($, B) => ($[B] = MZ(s), $), {}), { read: a, resolveKeyframes: u, update: l, preRender: d, render: p, postRender: w } = o, A = () => { + const $ = performance.now(); + r = !1, i.delta = n ? 1e3 / 60 : Math.max(Math.min($ - i.timestamp, IZ), 1), i.timestamp = $, i.isProcessing = !0, a.process(i), u.process(i), l.process(i), d.process(i), p.process(i), w.process(i), i.isProcessing = !1, r && e && (n = !1, t(A)); }, M = () => { r = !0, n = !0, i.isProcessing || t(A); }; - return { schedule: gd.reduce((B, $) => { - const H = o[$]; - return B[$] = (W, V = !1, te = !1) => (r || M(), H.schedule(W, V, te)), B; - }, {}), cancel: (B) => { - for (let $ = 0; $ < gd.length; $++) - o[gd[$]].cancel(B); + return { schedule: gd.reduce(($, B) => { + const H = o[B]; + return $[B] = (U, V = !1, te = !1) => (r || M(), H.schedule(U, V, te)), $; + }, {}), cancel: ($) => { + for (let B = 0; B < gd.length; B++) + o[gd[B]].cancel($); }, state: i, steps: o }; } -const { schedule: Lr, cancel: wa, state: Fn, steps: Dm } = GS(typeof requestAnimationFrame < "u" ? requestAnimationFrame : Un, !0), YS = (t, e, r) => (((1 - 3 * r + 3 * e) * t + (3 * r - 6 * e)) * t + 3 * e) * t, CZ = 1e-7, TZ = 12; +const { schedule: Lr, cancel: wa, state: Fn, steps: Dm } = YS(typeof requestAnimationFrame < "u" ? requestAnimationFrame : Un, !0), JS = (t, e, r) => (((1 - 3 * r + 3 * e) * t + (3 * r - 6 * e)) * t + 3 * e) * t, CZ = 1e-7, TZ = 12; function RZ(t, e, r, n, i) { let s, o, a = 0; do - o = e + (r - e) / 2, s = YS(o, n, i) - t, s > 0 ? r = o : e = o; + o = e + (r - e) / 2, s = JS(o, n, i) - t, s > 0 ? r = o : e = o; while (Math.abs(s) > CZ && ++a < TZ); return o; } @@ -31273,11 +31274,11 @@ function ch(t, e, r, n) { if (t === e && r === n) return Un; const i = (s) => RZ(s, 0, 1, t, r); - return (s) => s === 0 || s === 1 ? s : YS(i(s), e, n); + return (s) => s === 0 || s === 1 ? s : JS(i(s), e, n); } -const JS = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, XS = (t) => (e) => 1 - t(1 - e), ZS = /* @__PURE__ */ ch(0.33, 1.53, 0.69, 0.99), Db = /* @__PURE__ */ XS(ZS), QS = /* @__PURE__ */ JS(Db), e7 = (t) => (t *= 2) < 1 ? 0.5 * Db(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Ob = (t) => 1 - Math.sin(Math.acos(t)), t7 = XS(Ob), r7 = JS(Ob), n7 = (t) => /^0[^.\s]+$/u.test(t); +const XS = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, ZS = (t) => (e) => 1 - t(1 - e), QS = /* @__PURE__ */ ch(0.33, 1.53, 0.69, 0.99), Ob = /* @__PURE__ */ ZS(QS), e7 = /* @__PURE__ */ XS(Ob), t7 = (t) => (t *= 2) < 1 ? 0.5 * Ob(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Nb = (t) => 1 - Math.sin(Math.acos(t)), r7 = ZS(Nb), n7 = XS(Nb), i7 = (t) => /^0[^.\s]+$/u.test(t); function DZ(t) { - return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || n7(t) : !0; + return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || i7(t) : !0; } let Ku = Un, Uo = Un; process.env.NODE_ENV !== "production" && (Ku = (t, e) => { @@ -31286,7 +31287,7 @@ process.env.NODE_ENV !== "production" && (Ku = (t, e) => { if (!t) throw new Error(e); }); -const i7 = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), s7 = (t) => (e) => typeof e == "string" && e.startsWith(t), o7 = /* @__PURE__ */ s7("--"), OZ = /* @__PURE__ */ s7("var(--"), Nb = (t) => OZ(t) ? NZ.test(t.split("/*")[0].trim()) : !1, NZ = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, LZ = ( +const s7 = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), o7 = (t) => (e) => typeof e == "string" && e.startsWith(t), a7 = /* @__PURE__ */ o7("--"), OZ = /* @__PURE__ */ o7("var(--"), Lb = (t) => OZ(t) ? NZ.test(t.split("/*")[0].trim()) : !1, NZ = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, LZ = ( // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u ); @@ -31298,7 +31299,7 @@ function kZ(t) { return [`--${r ?? n}`, i]; } const $Z = 4; -function a7(t, e, r = 1) { +function c7(t, e, r = 1) { Uo(r <= $Z, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`); const [n, i] = kZ(t); if (!n) @@ -31306,9 +31307,9 @@ function a7(t, e, r = 1) { const s = window.getComputedStyle(e).getPropertyValue(n); if (s) { const o = s.trim(); - return i7(o) ? parseFloat(o) : o; + return s7(o) ? parseFloat(o) : o; } - return Nb(i) ? a7(i, e, r + 1) : i; + return Lb(i) ? c7(i, e, r + 1) : i; } const xa = (t, e, r) => r > e ? e : r < t ? t : r, Vu = { test: (t) => typeof t == "number", @@ -31324,7 +31325,7 @@ const xa = (t, e, r) => r > e ? e : r < t ? t : r, Vu = { test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1, parse: parseFloat, transform: (e) => `${e}${t}` -}), oa = /* @__PURE__ */ uh("deg"), Gs = /* @__PURE__ */ uh("%"), Vt = /* @__PURE__ */ uh("px"), BZ = /* @__PURE__ */ uh("vh"), FZ = /* @__PURE__ */ uh("vw"), G_ = { +}), oa = /* @__PURE__ */ uh("deg"), Gs = /* @__PURE__ */ uh("%"), Vt = /* @__PURE__ */ uh("px"), BZ = /* @__PURE__ */ uh("vh"), FZ = /* @__PURE__ */ uh("vw"), Y_ = { ...Gs, parse: (t) => Gs.parse(t) / 100, transform: (t) => Gs.transform(t * 100) @@ -31339,15 +31340,15 @@ const xa = (t, e, r) => r > e ? e : r < t ? t : r, Vu = { "y", "translateX", "translateY" -]), Y_ = (t) => t === Vu || t === Vt, J_ = (t, e) => parseFloat(t.split(", ")[e]), X_ = (t, e) => (r, { transform: n }) => { +]), J_ = (t) => t === Vu || t === Vt, X_ = (t, e) => parseFloat(t.split(", ")[e]), Z_ = (t, e) => (r, { transform: n }) => { if (n === "none" || !n) return 0; const i = n.match(/^matrix3d\((.+)\)$/u); if (i) - return J_(i[1], e); + return X_(i[1], e); { const s = n.match(/^matrix\((.+)\)$/u); - return s ? J_(s[1], t) : 0; + return s ? X_(s[1], t) : 0; } }, UZ = /* @__PURE__ */ new Set(["x", "y", "z"]), qZ = ah.filter((t) => !UZ.has(t)); function zZ(t) { @@ -31366,17 +31367,17 @@ const Mu = { bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min), right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min), // Transform - x: X_(4, 13), - y: X_(5, 14) + x: Z_(4, 13), + y: Z_(5, 14) }; Mu.translateX = Mu.x; Mu.translateY = Mu.y; -const c7 = (t) => (e) => e.test(t), WZ = { +const u7 = (t) => (e) => e.test(t), WZ = { test: (t) => t === "auto", parse: (t) => t -}, u7 = [Vu, Vt, Gs, oa, FZ, BZ, WZ], Z_ = (t) => u7.find(c7(t)), cc = /* @__PURE__ */ new Set(); +}, f7 = [Vu, Vt, Gs, oa, FZ, BZ, WZ], Q_ = (t) => f7.find(u7(t)), cc = /* @__PURE__ */ new Set(); let Z1 = !1, Q1 = !1; -function f7() { +function l7() { if (Q1) { const t = Array.from(cc).filter((n) => n.needsMeasurement), e = new Set(t.map((n) => n.element)), r = /* @__PURE__ */ new Map(); e.forEach((n) => { @@ -31395,20 +31396,20 @@ function f7() { } Q1 = !1, Z1 = !1, cc.forEach((t) => t.complete()), cc.clear(); } -function l7() { +function h7() { cc.forEach((t) => { t.readKeyframes(), t.needsMeasurement && (Q1 = !0); }); } function HZ() { - l7(), f7(); + h7(), l7(); } -class Lb { +class kb { constructor(e, r, n, i, s, o = !1) { this.isComplete = !1, this.isAsync = !1, this.needsMeasurement = !1, this.isScheduled = !1, this.unresolvedKeyframes = [...e], this.onComplete = r, this.name = n, this.motionValue = i, this.element = s, this.isAsync = o; } scheduleResolve() { - this.isScheduled = !0, this.isAsync ? (cc.add(this), Z1 || (Z1 = !0, Lr.read(l7), Lr.resolveKeyframes(f7))) : (this.readKeyframes(), this.complete()); + this.isScheduled = !0, this.isAsync ? (cc.add(this), Z1 || (Z1 = !0, Lr.read(h7), Lr.resolveKeyframes(l7))) : (this.readKeyframes(), this.complete()); } readKeyframes() { const { unresolvedKeyframes: e, name: r, element: n, motionValue: i } = this; @@ -31444,14 +31445,14 @@ class Lb { this.isComplete || this.scheduleResolve(); } } -const Yf = (t) => Math.round(t * 1e5) / 1e5, kb = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; +const Yf = (t) => Math.round(t * 1e5) / 1e5, $b = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; function KZ(t) { return t == null; } -const VZ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, $b = (t, e) => (r) => !!(typeof r == "string" && VZ.test(r) && r.startsWith(t) || e && !KZ(r) && Object.prototype.hasOwnProperty.call(r, e)), h7 = (t, e, r) => (n) => { +const VZ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, Bb = (t, e) => (r) => !!(typeof r == "string" && VZ.test(r) && r.startsWith(t) || e && !KZ(r) && Object.prototype.hasOwnProperty.call(r, e)), d7 = (t, e, r) => (n) => { if (typeof n != "string") return n; - const [i, s, o, a] = n.match(kb); + const [i, s, o, a] = n.match($b); return { [t]: parseFloat(i), [e]: parseFloat(s), @@ -31462,8 +31463,8 @@ const VZ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s ...Vu, transform: (t) => Math.round(GZ(t)) }, sc = { - test: /* @__PURE__ */ $b("rgb", "red"), - parse: /* @__PURE__ */ h7("red", "green", "blue"), + test: /* @__PURE__ */ Bb("rgb", "red"), + parse: /* @__PURE__ */ d7("red", "green", "blue"), transform: ({ red: t, green: e, blue: r, alpha: n = 1 }) => "rgba(" + Om.transform(t) + ", " + Om.transform(e) + ", " + Om.transform(r) + ", " + Yf(Cl.transform(n)) + ")" }; function YZ(t) { @@ -31476,12 +31477,12 @@ function YZ(t) { }; } const ev = { - test: /* @__PURE__ */ $b("#"), + test: /* @__PURE__ */ Bb("#"), parse: YZ, transform: sc.transform }, eu = { - test: /* @__PURE__ */ $b("hsl", "hue"), - parse: /* @__PURE__ */ h7("hue", "saturation", "lightness"), + test: /* @__PURE__ */ Bb("hsl", "hue"), + parse: /* @__PURE__ */ d7("hue", "saturation", "lightness"), transform: ({ hue: t, saturation: e, lightness: r, alpha: n = 1 }) => "hsla(" + Math.round(t) + ", " + Gs.transform(Yf(e)) + ", " + Gs.transform(Yf(r)) + ", " + Yf(Cl.transform(n)) + ")" }, Yn = { test: (t) => sc.test(t) || ev.test(t) || eu.test(t), @@ -31490,9 +31491,9 @@ const ev = { }, JZ = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu; function XZ(t) { var e, r; - return isNaN(t) && typeof t == "string" && (((e = t.match(kb)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match(JZ)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; + return isNaN(t) && typeof t == "string" && (((e = t.match($b)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match(JZ)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; } -const d7 = "number", p7 = "color", ZZ = "var", QZ = "var(", Q_ = "${}", eQ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; +const p7 = "number", g7 = "color", ZZ = "var", QZ = "var(", e6 = "${}", eQ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; function Tl(t) { const e = t.toString(), r = [], n = { color: [], @@ -31500,40 +31501,40 @@ function Tl(t) { var: [] }, i = []; let s = 0; - const a = e.replace(eQ, (u) => (Yn.test(u) ? (n.color.push(s), i.push(p7), r.push(Yn.parse(u))) : u.startsWith(QZ) ? (n.var.push(s), i.push(ZZ), r.push(u)) : (n.number.push(s), i.push(d7), r.push(parseFloat(u))), ++s, Q_)).split(Q_); + const a = e.replace(eQ, (u) => (Yn.test(u) ? (n.color.push(s), i.push(g7), r.push(Yn.parse(u))) : u.startsWith(QZ) ? (n.var.push(s), i.push(ZZ), r.push(u)) : (n.number.push(s), i.push(p7), r.push(parseFloat(u))), ++s, e6)).split(e6); return { values: r, split: a, indexes: n, types: i }; } -function g7(t) { +function m7(t) { return Tl(t).values; } -function m7(t) { +function v7(t) { const { split: e, types: r } = Tl(t), n = e.length; return (i) => { let s = ""; for (let o = 0; o < n; o++) if (s += e[o], i[o] !== void 0) { const a = r[o]; - a === d7 ? s += Yf(i[o]) : a === p7 ? s += Yn.transform(i[o]) : s += i[o]; + a === p7 ? s += Yf(i[o]) : a === g7 ? s += Yn.transform(i[o]) : s += i[o]; } return s; }; } const tQ = (t) => typeof t == "number" ? 0 : t; function rQ(t) { - const e = g7(t); - return m7(t)(e.map(tQ)); + const e = m7(t); + return v7(t)(e.map(tQ)); } const _a = { test: XZ, - parse: g7, - createTransformer: m7, + parse: m7, + createTransformer: v7, getAnimatableNone: rQ }, nQ = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]); function iQ(t) { const [e, r] = t.slice(0, -1).split("("); if (e === "drop-shadow") return t; - const [n] = r.match(kb) || []; + const [n] = r.match($b) || []; if (!n) return t; const i = r.replace(n, ""); @@ -31604,23 +31605,23 @@ const sQ = /\b([a-z-]*)\(.*?\)/gu, tv = { perspective: Vt, transformPerspective: Vt, opacity: Cl, - originX: G_, - originY: G_, + originX: Y_, + originY: Y_, originZ: Vt -}, e6 = { +}, t6 = { ...Vu, transform: Math.round -}, Bb = { +}, Fb = { ...oQ, ...aQ, - zIndex: e6, + zIndex: t6, size: Vt, // SVG fillOpacity: Cl, strokeOpacity: Cl, - numOctaves: e6 + numOctaves: t6 }, cQ = { - ...Bb, + ...Fb, // Color props color: Yn, backgroundColor: Yn, @@ -31635,9 +31636,9 @@ const sQ = /\b([a-z-]*)\(.*?\)/gu, tv = { borderLeftColor: Yn, filter: tv, WebkitFilter: tv -}, Fb = (t) => cQ[t]; -function v7(t, e) { - let r = Fb(t); +}, jb = (t) => cQ[t]; +function b7(t, e) { + let r = jb(t); return r !== tv && (r = _a), r.getAnimatableNone ? r.getAnimatableNone(e) : void 0; } const uQ = /* @__PURE__ */ new Set(["auto", "none", "0"]); @@ -31649,9 +31650,9 @@ function fQ(t, e, r) { } if (i && r) for (const s of e) - t[s] = v7(r, i); + t[s] = b7(r, i); } -class b7 extends Lb { +class y7 extends kb { constructor(e, r, n, i, s) { super(e, r, n, i, s, !0); } @@ -31662,16 +31663,16 @@ class b7 extends Lb { super.readKeyframes(); for (let u = 0; u < e.length; u++) { let l = e[u]; - if (typeof l == "string" && (l = l.trim(), Nb(l))) { - const d = a7(l, r.current); + if (typeof l == "string" && (l = l.trim(), Lb(l))) { + const d = c7(l, r.current); d !== void 0 && (e[u] = d), u === e.length - 1 && (this.finalKeyframe = l); } } if (this.resolveNoneKeyframes(), !jZ.has(n) || e.length !== 2) return; - const [i, s] = e, o = Z_(i), a = Z_(s); + const [i, s] = e, o = Q_(i), a = Q_(s); if (o !== a) - if (Y_(o) && Y_(a)) + if (J_(o) && J_(a)) for (let u = 0; u < e.length; u++) { const l = e[u]; typeof l == "string" && (e[u] = parseFloat(l)); @@ -31706,7 +31707,7 @@ class b7 extends Lb { }), this.resolveNoneKeyframes(); } } -function jb(t) { +function Ub(t) { return typeof t == "function"; } let Fd; @@ -31718,7 +31719,7 @@ const Ys = { set: (t) => { Fd = t, queueMicrotask(lQ); } -}, t6 = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string +}, r6 = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string (_a.test(t) || t === "0") && // And it contains numbers and/or colors !t.startsWith("url(")); function hQ(t) { @@ -31735,11 +31736,11 @@ function dQ(t, e, r, n) { return !1; if (e === "display" || e === "visibility") return !0; - const s = t[t.length - 1], o = t6(i, e), a = t6(s, e); - return Ku(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : hQ(t) || (r === "spring" || jb(r)) && n; + const s = t[t.length - 1], o = r6(i, e), a = r6(s, e); + return Ku(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : hQ(t) || (r === "spring" || Ub(r)) && n; } const pQ = 40; -class y7 { +class w7 { constructor({ autoplay: e = !0, delay: r = 0, type: n = "keyframes", repeat: i = 0, repeatDelay: s = 0, repeatType: o = "loop", ...a }) { this.isStopped = !1, this.hasAttemptedResolve = !1, this.createdAt = Ys.now(), this.options = { autoplay: e, @@ -31813,20 +31814,20 @@ class y7 { }); } } -function w7(t, e) { +function x7(t, e) { return e ? t * (1e3 / e) : 0; } const gQ = 5; -function x7(t, e, r) { +function _7(t, e, r) { const n = Math.max(e - gQ, 0); - return w7(r - t(n), e - n); + return x7(r - t(n), e - n); } -const Nm = 1e-3, mQ = 0.01, r6 = 10, vQ = 0.05, bQ = 1; +const Nm = 1e-3, mQ = 0.01, n6 = 10, vQ = 0.05, bQ = 1; function yQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }) { let i, s; - Ku(t <= Vs(r6), "Spring duration must be 10 seconds or less"); + Ku(t <= Vs(n6), "Spring duration must be 10 seconds or less"); let o = 1 - e; - o = xa(vQ, bQ, o), t = xa(mQ, r6, To(t)), o < 1 ? (i = (l) => { + o = xa(vQ, bQ, o), t = xa(mQ, n6, To(t)), o < 1 ? (i = (l) => { const d = l * o, p = d * t, w = d - r, A = rv(l, o), M = Math.exp(-p); return Nm - w / A * M; }, s = (l) => { @@ -31866,7 +31867,7 @@ function rv(t, e) { return t * Math.sqrt(1 - e * e); } const _Q = ["duration", "bounce"], EQ = ["stiffness", "damping", "mass"]; -function n6(t, e) { +function i6(t, e) { return e.some((r) => t[r] !== void 0); } function SQ(t) { @@ -31878,7 +31879,7 @@ function SQ(t) { isResolvedFromDuration: !1, ...t }; - if (!n6(t, EQ) && n6(t, _Q)) { + if (!i6(t, EQ) && i6(t, _Q)) { const r = yQ(t); e = { ...e, @@ -31888,61 +31889,61 @@ function SQ(t) { } return e; } -function _7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { +function E7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { const i = t[0], s = t[t.length - 1], o = { done: !1, value: i }, { stiffness: a, damping: u, mass: l, duration: d, velocity: p, isResolvedFromDuration: w } = SQ({ ...n, velocity: -To(n.velocity || 0) - }), A = p || 0, M = u / (2 * Math.sqrt(a * l)), N = s - i, L = To(Math.sqrt(a / l)), B = Math.abs(N) < 5; - r || (r = B ? 0.01 : 2), e || (e = B ? 5e-3 : 0.5); - let $; + }), A = p || 0, M = u / (2 * Math.sqrt(a * l)), N = s - i, L = To(Math.sqrt(a / l)), $ = Math.abs(N) < 5; + r || (r = $ ? 0.01 : 2), e || (e = $ ? 5e-3 : 0.5); + let B; if (M < 1) { const H = rv(L, M); - $ = (W) => { - const V = Math.exp(-M * L * W); - return s - V * ((A + M * L * N) / H * Math.sin(H * W) + N * Math.cos(H * W)); + B = (U) => { + const V = Math.exp(-M * L * U); + return s - V * ((A + M * L * N) / H * Math.sin(H * U) + N * Math.cos(H * U)); }; } else if (M === 1) - $ = (H) => s - Math.exp(-L * H) * (N + (A + L * N) * H); + B = (H) => s - Math.exp(-L * H) * (N + (A + L * N) * H); else { const H = L * Math.sqrt(M * M - 1); - $ = (W) => { - const V = Math.exp(-M * L * W), te = Math.min(H * W, 300); + B = (U) => { + const V = Math.exp(-M * L * U), te = Math.min(H * U, 300); return s - V * ((A + M * L * N) * Math.sinh(te) + H * N * Math.cosh(te)) / H; }; } return { calculatedDuration: w && d || null, next: (H) => { - const W = $(H); + const U = B(H); if (w) o.done = H >= d; else { let V = 0; - M < 1 && (V = H === 0 ? Vs(A) : x7($, H, W)); - const te = Math.abs(V) <= r, R = Math.abs(s - W) <= e; + M < 1 && (V = H === 0 ? Vs(A) : _7(B, H, U)); + const te = Math.abs(V) <= r, R = Math.abs(s - U) <= e; o.done = te && R; } - return o.value = o.done ? s : W, o; + return o.value = o.done ? s : U, o; } }; } -function i6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: u, restDelta: l = 0.5, restSpeed: d }) { +function s6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: u, restDelta: l = 0.5, restSpeed: d }) { const p = t[0], w = { done: !1, value: p }, A = (K) => a !== void 0 && K < a || u !== void 0 && K > u, M = (K) => a === void 0 ? u : u === void 0 || Math.abs(a - K) < Math.abs(u - K) ? a : u; let N = r * e; - const L = p + N, B = o === void 0 ? L : o(L); - B !== L && (N = B - p); - const $ = (K) => -N * Math.exp(-K / n), H = (K) => B + $(K), W = (K) => { - const ge = $(K), Ee = H(K); - w.done = Math.abs(ge) <= l, w.value = w.done ? B : Ee; + const L = p + N, $ = o === void 0 ? L : o(L); + $ !== L && (N = $ - p); + const B = (K) => -N * Math.exp(-K / n), H = (K) => $ + B(K), U = (K) => { + const ge = B(K), Ee = H(K); + w.done = Math.abs(ge) <= l, w.value = w.done ? $ : Ee; }; let V, te; const R = (K) => { - A(w.value) && (V = K, te = _7({ + A(w.value) && (V = K, te = E7({ keyframes: [w.value, M(w.value)], - velocity: x7(H, K, w.value), + velocity: _7(H, K, w.value), // TODO: This should be passing * 1000 damping: i, stiffness: s, @@ -31954,29 +31955,29 @@ function i6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 3 calculatedDuration: null, next: (K) => { let ge = !1; - return !te && V === void 0 && (ge = !0, W(K), R(K)), V !== void 0 && K >= V ? te.next(K - V) : (!ge && W(K), w); + return !te && V === void 0 && (ge = !0, U(K), R(K)), V !== void 0 && K >= V ? te.next(K - V) : (!ge && U(K), w); } }; } -const AQ = /* @__PURE__ */ ch(0.42, 0, 1, 1), PQ = /* @__PURE__ */ ch(0, 0, 0.58, 1), E7 = /* @__PURE__ */ ch(0.42, 0, 0.58, 1), MQ = (t) => Array.isArray(t) && typeof t[0] != "number", Ub = (t) => Array.isArray(t) && typeof t[0] == "number", s6 = { +const AQ = /* @__PURE__ */ ch(0.42, 0, 1, 1), PQ = /* @__PURE__ */ ch(0, 0, 0.58, 1), S7 = /* @__PURE__ */ ch(0.42, 0, 0.58, 1), MQ = (t) => Array.isArray(t) && typeof t[0] != "number", qb = (t) => Array.isArray(t) && typeof t[0] == "number", o6 = { linear: Un, easeIn: AQ, - easeInOut: E7, + easeInOut: S7, easeOut: PQ, - circIn: Ob, - circInOut: r7, - circOut: t7, - backIn: Db, - backInOut: QS, - backOut: ZS, - anticipate: e7 -}, o6 = (t) => { - if (Ub(t)) { + circIn: Nb, + circInOut: n7, + circOut: r7, + backIn: Ob, + backInOut: e7, + backOut: QS, + anticipate: t7 +}, a6 = (t) => { + if (qb(t)) { Uo(t.length === 4, "Cubic bezier arrays must contain four numerical values."); const [e, r, n, i] = t; return ch(e, r, n, i); } else if (typeof t == "string") - return Uo(s6[t] !== void 0, `Invalid easing type '${t}'`), s6[t]; + return Uo(o6[t] !== void 0, `Invalid easing type '${t}'`), o6[t]; return t; }, IQ = (t, e) => (r) => e(t(r)), Ro = (...t) => t.reduce(IQ), Iu = (t, e, r) => { const n = e - t; @@ -32008,15 +32009,15 @@ const km = (t, e, r) => { const n = t * t, i = r * (e * e - n) + n; return i < 0 ? 0 : Math.sqrt(i); }, TQ = [ev, sc, eu], RQ = (t) => TQ.find((e) => e.test(t)); -function a6(t) { +function c6(t) { const e = RQ(t); if (Ku(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e) return !1; let r = e.parse(t); return e === eu && (r = CQ(r)), r; } -const c6 = (t, e) => { - const r = a6(t), n = a6(e); +const u6 = (t, e) => { + const r = c6(t), n = c6(e); if (!r || !n) return v0(t, e); const i = { ...r }; @@ -32028,11 +32029,11 @@ function DQ(t, e) { function OQ(t, e) { return (r) => Qr(t, e, r); } -function qb(t) { - return typeof t == "number" ? OQ : typeof t == "string" ? Nb(t) ? v0 : Yn.test(t) ? c6 : kQ : Array.isArray(t) ? S7 : typeof t == "object" ? Yn.test(t) ? c6 : NQ : v0; +function zb(t) { + return typeof t == "number" ? OQ : typeof t == "string" ? Lb(t) ? v0 : Yn.test(t) ? u6 : kQ : Array.isArray(t) ? A7 : typeof t == "object" ? Yn.test(t) ? u6 : NQ : v0; } -function S7(t, e) { - const r = [...t], n = r.length, i = t.map((s, o) => qb(s)(s, e[o])); +function A7(t, e) { + const r = [...t], n = r.length, i = t.map((s, o) => zb(s)(s, e[o])); return (s) => { for (let o = 0; o < n; o++) r[o] = i[o](s); @@ -32042,7 +32043,7 @@ function S7(t, e) { function NQ(t, e) { const r = { ...t, ...e }, n = {}; for (const i in r) - t[i] !== void 0 && e[i] !== void 0 && (n[i] = qb(t[i])(t[i], e[i])); + t[i] !== void 0 && e[i] !== void 0 && (n[i] = zb(t[i])(t[i], e[i])); return (i) => { for (const s in n) r[s] = n[s](i); @@ -32060,13 +32061,13 @@ function LQ(t, e) { } const kQ = (t, e) => { const r = _a.createTransformer(e), n = Tl(t), i = Tl(e); - return n.indexes.var.length === i.indexes.var.length && n.indexes.color.length === i.indexes.color.length && n.indexes.number.length >= i.indexes.number.length ? nv.has(t) && !i.values.length || nv.has(e) && !n.values.length ? DQ(t, e) : Ro(S7(LQ(n, i), i.values), r) : (Ku(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), v0(t, e)); + return n.indexes.var.length === i.indexes.var.length && n.indexes.color.length === i.indexes.color.length && n.indexes.number.length >= i.indexes.number.length ? nv.has(t) && !i.values.length || nv.has(e) && !n.values.length ? DQ(t, e) : Ro(A7(LQ(n, i), i.values), r) : (Ku(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), v0(t, e)); }; -function A7(t, e, r) { - return typeof t == "number" && typeof e == "number" && typeof r == "number" ? Qr(t, e, r) : qb(t)(t, e); +function P7(t, e, r) { + return typeof t == "number" && typeof e == "number" && typeof r == "number" ? Qr(t, e, r) : zb(t)(t, e); } function $Q(t, e, r) { - const n = [], i = r || A7, s = t.length - 1; + const n = [], i = r || P7, s = t.length - 1; for (let o = 0; o < s; o++) { let a = i(t[o], t[o + 1]); if (e) { @@ -32109,10 +32110,10 @@ function UQ(t, e) { return t.map((r) => r * e); } function qQ(t, e) { - return t.map(() => e || E7).splice(0, t.length - 1); + return t.map(() => e || S7).splice(0, t.length - 1); } function b0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" }) { - const i = MQ(n) ? n.map(o6) : o6(n), s = { + const i = MQ(n) ? n.map(a6) : a6(n), s = { done: !1, value: e[0] }, o = UQ( @@ -32128,14 +32129,14 @@ function b0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" } next: (u) => (s.value = a(u), s.done = u >= t, s) }; } -const u6 = 2e4; +const f6 = 2e4; function zQ(t) { let e = 0; const r = 50; let n = t.next(e); - for (; !n.done && e < u6; ) + for (; !n.done && e < f6; ) e += r, n = t.next(e); - return e >= u6 ? 1 / 0 : e; + return e >= f6 ? 1 / 0 : e; } const WQ = (t) => { const e = ({ timestamp: r }) => t(r); @@ -32149,13 +32150,13 @@ const WQ = (t) => { now: () => Fn.isProcessing ? Fn.timestamp : Ys.now() }; }, HQ = { - decay: i6, - inertia: i6, + decay: s6, + inertia: s6, tween: b0, keyframes: b0, - spring: _7 + spring: E7 }, KQ = (t) => t / 100; -class zb extends y7 { +class Wb extends w7 { constructor(e) { super(e), this.holdTime = null, this.cancelTime = null, this.currentTime = 0, this.playbackSpeed = 1, this.pendingPlayState = "running", this.startTime = null, this.state = "idle", this.stop = () => { if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle") @@ -32164,16 +32165,16 @@ class zb extends y7 { const { onStop: u } = this.options; u && u(); }; - const { name: r, motionValue: n, element: i, keyframes: s } = this.options, o = (i == null ? void 0 : i.KeyframeResolver) || Lb, a = (u, l) => this.onKeyframesResolved(u, l); + const { name: r, motionValue: n, element: i, keyframes: s } = this.options, o = (i == null ? void 0 : i.KeyframeResolver) || kb, a = (u, l) => this.onKeyframesResolved(u, l); this.resolver = new o(s, a, r, n, i), this.resolver.scheduleResolve(); } flatten() { super.flatten(), this._resolved && Object.assign(this._resolved, this.initPlayback(this._resolved.keyframes)); } initPlayback(e) { - const { type: r = "keyframes", repeat: n = 0, repeatDelay: i = 0, repeatType: s, velocity: o = 0 } = this.options, a = jb(r) ? r : HQ[r] || b0; + const { type: r = "keyframes", repeat: n = 0, repeatDelay: i = 0, repeatType: s, velocity: o = 0 } = this.options, a = Ub(r) ? r : HQ[r] || b0; let u, l; - a !== b0 && typeof e[0] != "number" && (process.env.NODE_ENV !== "production" && Uo(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), u = Ro(KQ, A7(e[0], e[1])), e = [0, 100]); + a !== b0 && typeof e[0] != "number" && (process.env.NODE_ENV !== "production" && Uo(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), u = Ro(KQ, P7(e[0], e[1])), e = [0, 100]); const d = a({ ...this.options, keyframes: e }); s === "mirror" && (l = a({ ...this.options, @@ -32205,18 +32206,18 @@ class zb extends y7 { return s.next(0); const { delay: w, repeat: A, repeatType: M, repeatDelay: N, onUpdate: L } = this.options; this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - d / this.speed, this.startTime)), r ? this.currentTime = e : this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = Math.round(e - this.startTime) * this.speed; - const B = this.currentTime - w * (this.speed >= 0 ? 1 : -1), $ = this.speed >= 0 ? B < 0 : B > d; - this.currentTime = Math.max(B, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = d); - let H = this.currentTime, W = s; + const $ = this.currentTime - w * (this.speed >= 0 ? 1 : -1), B = this.speed >= 0 ? $ < 0 : $ > d; + this.currentTime = Math.max($, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = d); + let H = this.currentTime, U = s; if (A) { const K = Math.min(this.currentTime, d) / p; let ge = Math.floor(K), Ee = K % 1; - !Ee && K >= 1 && (Ee = 1), Ee === 1 && ge--, ge = Math.min(ge, A + 1), !!(ge % 2) && (M === "reverse" ? (Ee = 1 - Ee, N && (Ee -= N / p)) : M === "mirror" && (W = o)), H = xa(0, 1, Ee) * p; + !Ee && K >= 1 && (Ee = 1), Ee === 1 && ge--, ge = Math.min(ge, A + 1), !!(ge % 2) && (M === "reverse" ? (Ee = 1 - Ee, N && (Ee -= N / p)) : M === "mirror" && (U = o)), H = xa(0, 1, Ee) * p; } - const V = $ ? { done: !1, value: u[0] } : W.next(H); + const V = B ? { done: !1, value: u[0] } : U.next(H); a && (V.value = a(V.value)); let { done: te } = V; - !$ && l !== null && (te = this.speed >= 0 ? this.currentTime >= d : this.currentTime <= 0); + !B && l !== null && (te = this.speed >= 0 ? this.currentTime >= d : this.currentTime <= 0); const R = this.holdTime === null && (this.state === "finished" || this.state === "running" && te); return R && i !== void 0 && (V.value = wp(u, this.options, i)), L && L(V.value), R && this.finish(), V; } @@ -32293,7 +32294,7 @@ const VQ = /* @__PURE__ */ new Set([ r += t(Iu(0, n - 1, i)) + ", "; return `linear(${r.substring(0, r.length - 2)})`; }; -function Wb(t) { +function Hb(t) { let e; return () => (e === void 0 && (e = t()), e); } @@ -32301,7 +32302,7 @@ const JQ = { linearEasing: void 0 }; function XQ(t, e) { - const r = Wb(t); + const r = Hb(t); return () => { var n; return (n = JQ[e]) !== null && n !== void 0 ? n : r(); @@ -32315,8 +32316,8 @@ const y0 = /* @__PURE__ */ XQ(() => { } return !0; }, "linearEasing"); -function P7(t) { - return !!(typeof t == "function" && y0() || !t || typeof t == "string" && (t in iv || y0()) || Ub(t) || Array.isArray(t) && t.every(P7)); +function M7(t) { + return !!(typeof t == "function" && y0() || !t || typeof t == "string" && (t in iv || y0()) || qb(t) || Array.isArray(t) && t.every(M7)); } const jf = ([t, e, r, n]) => `cubic-bezier(${t}, ${e}, ${r}, ${n})`, iv = { linear: "linear", @@ -32329,14 +32330,14 @@ const jf = ([t, e, r, n]) => `cubic-bezier(${t}, ${e}, ${r}, ${n})`, iv = { backIn: /* @__PURE__ */ jf([0.31, 0.01, 0.66, -0.59]), backOut: /* @__PURE__ */ jf([0.33, 1.53, 0.69, 0.99]) }; -function M7(t, e) { +function I7(t, e) { if (t) - return typeof t == "function" && y0() ? YQ(t, e) : Ub(t) ? jf(t) : Array.isArray(t) ? t.map((r) => M7(r, e) || iv.easeOut) : iv[t]; + return typeof t == "function" && y0() ? YQ(t, e) : qb(t) ? jf(t) : Array.isArray(t) ? t.map((r) => I7(r, e) || iv.easeOut) : iv[t]; } function ZQ(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatType: o = "loop", ease: a = "easeInOut", times: u } = {}) { const l = { [e]: r }; u && (l.offset = u); - const d = M7(a, i); + const d = I7(a, i); return Array.isArray(d) && (l.easing = d), t.animate(l, { delay: n, duration: i, @@ -32346,15 +32347,15 @@ function ZQ(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatTyp direction: o === "reverse" ? "alternate" : "normal" }); } -function f6(t, e) { +function l6(t, e) { t.timeline = e, t.onfinish = null; } -const QQ = /* @__PURE__ */ Wb(() => Object.hasOwnProperty.call(Element.prototype, "animate")), w0 = 10, eee = 2e4; +const QQ = /* @__PURE__ */ Hb(() => Object.hasOwnProperty.call(Element.prototype, "animate")), w0 = 10, eee = 2e4; function tee(t) { - return jb(t.type) || t.type === "spring" || !P7(t.ease); + return Ub(t.type) || t.type === "spring" || !M7(t.ease); } function ree(t, e) { - const r = new zb({ + const r = new Wb({ ...e, keyframes: t, repeat: 0, @@ -32373,31 +32374,31 @@ function ree(t, e) { ease: "linear" }; } -const I7 = { - anticipate: e7, - backInOut: QS, - circInOut: r7 +const C7 = { + anticipate: t7, + backInOut: e7, + circInOut: n7 }; function nee(t) { - return t in I7; + return t in C7; } -class l6 extends y7 { +class h6 extends w7 { constructor(e) { super(e); const { name: r, motionValue: n, element: i, keyframes: s } = this.options; - this.resolver = new b7(s, (o, a) => this.onKeyframesResolved(o, a), r, n, i), this.resolver.scheduleResolve(); + this.resolver = new y7(s, (o, a) => this.onKeyframesResolved(o, a), r, n, i), this.resolver.scheduleResolve(); } initPlayback(e, r) { var n; let { duration: i = 300, times: s, ease: o, type: a, motionValue: u, name: l, startTime: d } = this.options; if (!(!((n = u.owner) === null || n === void 0) && n.current)) return !1; - if (typeof o == "string" && y0() && nee(o) && (o = I7[o]), tee(this.options)) { - const { onComplete: w, onUpdate: A, motionValue: M, element: N, ...L } = this.options, B = ree(e, L); - e = B.keyframes, e.length === 1 && (e[1] = e[0]), i = B.duration, s = B.times, o = B.ease, a = "keyframes"; + if (typeof o == "string" && y0() && nee(o) && (o = C7[o]), tee(this.options)) { + const { onComplete: w, onUpdate: A, motionValue: M, element: N, ...L } = this.options, $ = ree(e, L); + e = $.keyframes, e.length === 1 && (e[1] = e[0]), i = $.duration, s = $.times, o = $.ease, a = "keyframes"; } const p = ZQ(u.owner.current, l, e, { ...this.options, duration: i, times: s, ease: o }); - return p.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (f6(p, this.pendingTimeline), this.pendingTimeline = void 0) : p.onfinish = () => { + return p.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (l6(p, this.pendingTimeline), this.pendingTimeline = void 0) : p.onfinish = () => { const { onComplete: w } = this.options; u.set(wp(e, this.options, r)), w && w(), this.cancel(), this.resolveFinishedPromise(); }, { @@ -32470,7 +32471,7 @@ class l6 extends y7 { if (!r) return Un; const { animation: n } = r; - f6(n, e); + l6(n, e); } return Un; } @@ -32501,7 +32502,7 @@ class l6 extends y7 { if (r.playState === "idle" || r.playState === "finished") return; if (this.time) { - const { motionValue: l, onUpdate: d, onComplete: p, element: w, ...A } = this.options, M = new zb({ + const { motionValue: l, onUpdate: d, onComplete: p, element: w, ...A } = this.options, M = new Wb({ ...A, keyframes: n, duration: i, @@ -32532,7 +32533,7 @@ class l6 extends y7 { !r.owner.getProps().onUpdate && !i && s !== "mirror" && o !== 0 && a !== "inertia"; } } -const iee = Wb(() => window.ScrollTimeline !== void 0); +const iee = Hb(() => window.ScrollTimeline !== void 0); class see { constructor(e) { this.stop = () => this.runAll("stop"), this.animations = e.filter(Boolean); @@ -32601,8 +32602,8 @@ class see { function oee({ when: t, delay: e, delayChildren: r, staggerChildren: n, staggerDirection: i, repeat: s, repeatType: o, repeatDelay: a, from: u, elapsed: l, ...d }) { return !!Object.keys(d).length; } -const Hb = (t, e, r, n = {}, i, s) => (o) => { - const a = Rb(n, t) || {}, u = a.delay || n.delay || 0; +const Kb = (t, e, r, n = {}, i, s) => (o) => { + const a = Db(n, t) || {}, u = a.delay || n.delay || 0; let { elapsed: l = 0 } = n; l = l - Vs(u); let d = { @@ -32633,21 +32634,21 @@ const Hb = (t, e, r, n = {}, i, s) => (o) => { d.onUpdate(w), d.onComplete(); }), new see([]); } - return !s && l6.supports(d) ? new l6(d) : new zb(d); + return !s && h6.supports(d) ? new h6(d) : new Wb(d); }, aee = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), cee = (t) => X1(t) ? t[t.length - 1] || 0 : t; -function Kb(t, e) { +function Vb(t, e) { t.indexOf(e) === -1 && t.push(e); } -function Vb(t, e) { +function Gb(t, e) { const r = t.indexOf(e); r > -1 && t.splice(r, 1); } -class Gb { +class Yb { constructor() { this.subscriptions = []; } add(e) { - return Kb(this.subscriptions, e), () => Vb(this.subscriptions, e); + return Vb(this.subscriptions, e), () => Gb(this.subscriptions, e); } notify(e, r, n) { const i = this.subscriptions.length; @@ -32667,7 +32668,7 @@ class Gb { this.subscriptions.length = 0; } } -const h6 = 30, uee = (t) => !isNaN(parseFloat(t)); +const d6 = 30, uee = (t) => !isNaN(parseFloat(t)); class fee { /** * @param init - The initiating value @@ -32733,7 +32734,7 @@ class fee { return process.env.NODE_ENV !== "production" && vp(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e); } on(e, r) { - this.events[e] || (this.events[e] = new Gb()); + this.events[e] || (this.events[e] = new Yb()); const n = this.events[e].add(r); return e === "change" ? () => { n(), Lr.read(() => { @@ -32806,10 +32807,10 @@ class fee { */ getVelocity() { const e = Ys.now(); - if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > h6) + if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > d6) return 0; - const r = Math.min(this.updatedAt - this.prevUpdatedAt, h6); - return w7(parseFloat(this.current) - parseFloat(this.prevFrameValue), r); + const r = Math.min(this.updatedAt - this.prevUpdatedAt, d6); + return x7(parseFloat(this.current) - parseFloat(this.prevFrameValue), r); } /** * Registers a new animation to control this `MotionValue`. Only one @@ -32877,9 +32878,9 @@ function hee(t, e) { lee(t, o, a); } } -const Yb = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), dee = "framerAppearId", C7 = "data-" + Yb(dee); -function T7(t) { - return t.props[C7]; +const Jb = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), dee = "framerAppearId", T7 = "data-" + Jb(dee); +function R7(t) { + return t.props[T7]; } const Xn = (t) => !!(t && t.getVelocity); function pee(t) { @@ -32894,7 +32895,7 @@ function gee({ protectedKeys: t, needsAnimating: e }, r) { const n = t.hasOwnProperty(r) && e[r] !== !0; return e[r] = !1, n; } -function R7(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { +function D7(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { var s; let { transition: o = t.getDefaultTransition(), transitionEnd: a, ...u } = e; n && (o = n); @@ -32905,17 +32906,17 @@ function R7(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { continue; const M = { delay: r, - ...Rb(o || {}, p) + ...Db(o || {}, p) }; let N = !1; if (window.MotionHandoffAnimation) { - const B = T7(t); - if (B) { - const $ = window.MotionHandoffAnimation(B, p, Lr); - $ !== null && (M.startTime = $, N = !0); + const $ = R7(t); + if ($) { + const B = window.MotionHandoffAnimation($, p, Lr); + B !== null && (M.startTime = B, N = !0); } } - sv(t, p), w.start(Hb(p, w, A, t.shouldReduceMotion && Ac.has(p) ? { type: !1 } : M, t, N)); + sv(t, p), w.start(Kb(p, w, A, t.shouldReduceMotion && Ac.has(p) ? { type: !1 } : M, t, N)); const L = w.animation; L && l.push(L); } @@ -32930,7 +32931,7 @@ function ov(t, e, r = {}) { const i = yp(t, e, r.type === "exit" ? (n = t.presenceContext) === null || n === void 0 ? void 0 : n.custom : void 0); let { transition: s = t.getDefaultTransition() || {} } = i || {}; r.transitionOverride && (s = r.transitionOverride); - const o = i ? () => Promise.all(R7(t, i, r)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (l = 0) => { + const o = i ? () => Promise.all(D7(t, i, r)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (l = 0) => { const { delayChildren: d = 0, staggerChildren: p, staggerDirection: w } = s; return mee(t, e, d + l, p, w, r); } : () => Promise.resolve(), { when: u } = s; @@ -32962,33 +32963,33 @@ function bee(t, e, r = {}) { n = ov(t, e, r); else { const i = typeof e == "function" ? yp(t, e, r.custom) : e; - n = Promise.all(R7(t, i, r)); + n = Promise.all(D7(t, i, r)); } return n.then(() => { t.notify("AnimationComplete", e); }); } -const yee = Tb.length; -function D7(t) { +const yee = Rb.length; +function O7(t) { if (!t) return; if (!t.isControllingVariants) { - const r = t.parent ? D7(t.parent) || {} : {}; + const r = t.parent ? O7(t.parent) || {} : {}; return t.props.initial !== void 0 && (r.initial = t.props.initial), r; } const e = {}; for (let r = 0; r < yee; r++) { - const n = Tb[r], i = t.props[n]; + const n = Rb[r], i = t.props[n]; (Il(i) || i === !1) && (e[n] = i); } return e; } -const wee = [...Cb].reverse(), xee = Cb.length; +const wee = [...Tb].reverse(), xee = Tb.length; function _ee(t) { return (e) => Promise.all(e.map(({ animation: r, options: n }) => bee(t, r, n))); } function Eee(t) { - let e = _ee(t), r = d6(), n = !0; + let e = _ee(t), r = p6(), n = !0; const i = (u) => (l, d) => { var p; const w = yp(t, d, u === "exit" ? (p = t.presenceContext) === null || p === void 0 ? void 0 : p.custom : void 0); @@ -33002,29 +33003,29 @@ function Eee(t) { e = u(t); } function o(u) { - const { props: l } = t, d = D7(t.parent) || {}, p = [], w = /* @__PURE__ */ new Set(); + const { props: l } = t, d = O7(t.parent) || {}, p = [], w = /* @__PURE__ */ new Set(); let A = {}, M = 1 / 0; for (let L = 0; L < xee; L++) { - const B = wee[L], $ = r[B], H = l[B] !== void 0 ? l[B] : d[B], W = Il(H), V = B === u ? $.isActive : null; + const $ = wee[L], B = r[$], H = l[$] !== void 0 ? l[$] : d[$], U = Il(H), V = $ === u ? B.isActive : null; V === !1 && (M = L); - let te = H === d[B] && H !== l[B] && W; - if (te && n && t.manuallyAnimateOnMount && (te = !1), $.protectedKeys = { ...A }, // If it isn't active and hasn't *just* been set as inactive - !$.isActive && V === null || // If we didn't and don't have any defined prop for this animation type - !H && !$.prevProp || // Or if the prop doesn't define an animation + let te = H === d[$] && H !== l[$] && U; + if (te && n && t.manuallyAnimateOnMount && (te = !1), B.protectedKeys = { ...A }, // If it isn't active and hasn't *just* been set as inactive + !B.isActive && V === null || // If we didn't and don't have any defined prop for this animation type + !H && !B.prevProp || // Or if the prop doesn't define an animation bp(H) || typeof H == "boolean") continue; - const R = See($.prevProp, H); + const R = See(B.prevProp, H); let K = R || // If we're making this variant active, we want to always make it active - B === u && $.isActive && !te && W || // If we removed a higher-priority variant (i is in reverse order) - L > M && W, ge = !1; + $ === u && B.isActive && !te && U || // If we removed a higher-priority variant (i is in reverse order) + L > M && U, ge = !1; const Ee = Array.isArray(H) ? H : [H]; - let Y = Ee.reduce(i(B), {}); + let Y = Ee.reduce(i($), {}); V === !1 && (Y = {}); - const { prevResolvedValues: S = {} } = $, m = { + const { prevResolvedValues: S = {} } = B, m = { ...S, ...Y }, f = (x) => { - K = !0, w.has(x) && (ge = !0, w.delete(x)), $.needsAnimating[x] = !0; + K = !0, w.has(x) && (ge = !0, w.delete(x)), B.needsAnimating[x] = !0; const _ = t.getValue(x); _ && (_.liveStyle = !1); }; @@ -33033,18 +33034,18 @@ function Eee(t) { if (A.hasOwnProperty(x)) continue; let v = !1; - X1(_) && X1(E) ? v = !VS(_, E) : v = _ !== E, v ? _ != null ? f(x) : w.add(x) : _ !== void 0 && w.has(x) ? f(x) : $.protectedKeys[x] = !0; + X1(_) && X1(E) ? v = !GS(_, E) : v = _ !== E, v ? _ != null ? f(x) : w.add(x) : _ !== void 0 && w.has(x) ? f(x) : B.protectedKeys[x] = !0; } - $.prevProp = H, $.prevResolvedValues = Y, $.isActive && (A = { ...A, ...Y }), n && t.blockInitialAnimation && (K = !1), K && (!(te && R) || ge) && p.push(...Ee.map((x) => ({ + B.prevProp = H, B.prevResolvedValues = Y, B.isActive && (A = { ...A, ...Y }), n && t.blockInitialAnimation && (K = !1), K && (!(te && R) || ge) && p.push(...Ee.map((x) => ({ animation: x, - options: { type: B } + options: { type: $ } }))); } if (w.size) { const L = {}; - w.forEach((B) => { - const $ = t.getBaseTarget(B), H = t.getValue(B); - H && (H.liveStyle = !0), L[B] = $ ?? null; + w.forEach(($) => { + const B = t.getBaseTarget($), H = t.getValue($); + H && (H.liveStyle = !0), L[$] = B ?? null; }), p.push({ animation: L }); } let N = !!p.length; @@ -33069,12 +33070,12 @@ function Eee(t) { setAnimateFunction: s, getState: () => r, reset: () => { - r = d6(), n = !0; + r = p6(), n = !0; } }; } function See(t, e) { - return typeof e == "string" ? e !== t : Array.isArray(e) ? !VS(e, t) : !1; + return typeof e == "string" ? e !== t : Array.isArray(e) ? !GS(e, t) : !1; } function Va(t = !1) { return { @@ -33084,7 +33085,7 @@ function Va(t = !1) { prevResolvedValues: {} }; } -function d6() { +function p6() { return { animate: Va(!0), whileInView: Va(), @@ -33158,7 +33159,7 @@ const Iee = { exit: { Feature: Mee } -}, O7 = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1; +}, N7 = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1; function xp(t, e = "page") { return { point: { @@ -33167,19 +33168,19 @@ function xp(t, e = "page") { } }; } -const Cee = (t) => (e) => O7(e) && t(e, xp(e)); +const Cee = (t) => (e) => N7(e) && t(e, xp(e)); function Mo(t, e, r, n = { passive: !0 }) { return t.addEventListener(e, r, n), () => t.removeEventListener(e, r); } function Do(t, e, r, n) { return Mo(t, e, Cee(r), n); } -const p6 = (t, e) => Math.abs(t - e); +const g6 = (t, e) => Math.abs(t - e); function Tee(t, e) { - const r = p6(t.x, e.x), n = p6(t.y, e.y); + const r = g6(t.x, e.x), n = g6(t.y, e.y); return Math.sqrt(r ** 2 + n ** 2); } -class N7 { +class L7 { constructor(e, r, { transformPagePoint: n, contextWindow: i, dragSnapToOrigin: s = !1 } = {}) { if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.updatePoint = () => { if (!(this.lastMoveEvent && this.lastMoveEventInfo)) @@ -33189,8 +33190,8 @@ class N7 { return; const { point: M } = p, { timestamp: N } = Fn; this.history.push({ ...M, timestamp: N }); - const { onStart: L, onMove: B } = this.handlers; - w || (L && L(this.lastMoveEvent, p), this.startEvent = this.lastMoveEvent), B && B(this.lastMoveEvent, p); + const { onStart: L, onMove: $ } = this.handlers; + w || (L && L(this.lastMoveEvent, p), this.startEvent = this.lastMoveEvent), $ && $(this.lastMoveEvent, p); }, this.handlePointerMove = (p, w) => { this.lastMoveEvent = p, this.lastMoveEventInfo = $m(w, this.transformPagePoint), Lr.update(this.updatePoint, !0); }, this.handlePointerUp = (p, w) => { @@ -33200,7 +33201,7 @@ class N7 { return; const L = Bm(p.type === "pointercancel" ? this.lastMoveEventInfo : $m(w, this.transformPagePoint), this.history); this.startEvent && A && A(p, L), M && M(p, L); - }, !O7(e)) + }, !N7(e)) return; this.dragSnapToOrigin = s, this.handlers = r, this.transformPagePoint = n, this.contextWindow = i || window; const o = xp(e), a = $m(o, this.transformPagePoint), { point: u } = a, { timestamp: l } = Fn; @@ -33218,28 +33219,28 @@ class N7 { function $m(t, e) { return e ? { point: e(t.point) } : t; } -function g6(t, e) { +function m6(t, e) { return { x: t.x - e.x, y: t.y - e.y }; } function Bm({ point: t }, e) { return { point: t, - delta: g6(t, L7(e)), - offset: g6(t, Ree(e)), + delta: m6(t, k7(e)), + offset: m6(t, Ree(e)), velocity: Dee(e, 0.1) }; } function Ree(t) { return t[0]; } -function L7(t) { +function k7(t) { return t[t.length - 1]; } function Dee(t, e) { if (t.length < 2) return { x: 0, y: 0 }; let r = t.length - 1, n = null; - const i = L7(t); + const i = k7(t); for (; r >= 0 && (n = t[r], !(i.timestamp - n.timestamp > Vs(e))); ) r--; if (!n) @@ -33253,7 +33254,7 @@ function Dee(t, e) { }; return o.x === 1 / 0 && (o.x = 0), o.y === 1 / 0 && (o.y = 0), o; } -function k7(t) { +function $7(t) { let e = null; return () => { const r = () => { @@ -33262,57 +33263,57 @@ function k7(t) { return e === null ? (e = t, r) : !1; }; } -const m6 = k7("dragHorizontal"), v6 = k7("dragVertical"); -function $7(t) { +const v6 = $7("dragHorizontal"), b6 = $7("dragVertical"); +function B7(t) { let e = !1; if (t === "y") - e = v6(); + e = b6(); else if (t === "x") - e = m6(); + e = v6(); else { - const r = m6(), n = v6(); + const r = v6(), n = b6(); r && n ? e = () => { r(), n(); } : (r && r(), n && n()); } return e; } -function B7() { - const t = $7(!0); +function F7() { + const t = B7(!0); return t ? (t(), !1) : !0; } function tu(t) { return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current"); } -const F7 = 1e-4, Oee = 1 - F7, Nee = 1 + F7, j7 = 0.01, Lee = 0 - j7, kee = 0 + j7; +const j7 = 1e-4, Oee = 1 - j7, Nee = 1 + j7, U7 = 0.01, Lee = 0 - U7, kee = 0 + U7; function Li(t) { return t.max - t.min; } function $ee(t, e, r) { return Math.abs(t - e) <= r; } -function b6(t, e, r, n = 0.5) { +function y6(t, e, r, n = 0.5) { t.origin = n, t.originPoint = Qr(e.min, e.max, t.origin), t.scale = Li(r) / Li(e), t.translate = Qr(r.min, r.max, t.origin) - t.originPoint, (t.scale >= Oee && t.scale <= Nee || isNaN(t.scale)) && (t.scale = 1), (t.translate >= Lee && t.translate <= kee || isNaN(t.translate)) && (t.translate = 0); } function Jf(t, e, r, n) { - b6(t.x, e.x, r.x, n ? n.originX : void 0), b6(t.y, e.y, r.y, n ? n.originY : void 0); + y6(t.x, e.x, r.x, n ? n.originX : void 0), y6(t.y, e.y, r.y, n ? n.originY : void 0); } -function y6(t, e, r) { +function w6(t, e, r) { t.min = r.min + e.min, t.max = t.min + Li(e); } function Bee(t, e, r) { - y6(t.x, e.x, r.x), y6(t.y, e.y, r.y); + w6(t.x, e.x, r.x), w6(t.y, e.y, r.y); } -function w6(t, e, r) { +function x6(t, e, r) { t.min = e.min - r.min, t.max = t.min + Li(e); } function Xf(t, e, r) { - w6(t.x, e.x, r.x), w6(t.y, e.y, r.y); + x6(t.x, e.x, r.x), x6(t.y, e.y, r.y); } function Fee(t, { min: e, max: r }, n) { return e !== void 0 && t < e ? t = n ? Qr(e, t, n.min) : Math.max(t, e) : r !== void 0 && t > r && (t = n ? Qr(r, t, n.max) : Math.min(t, r)), t; } -function x6(t, e, r) { +function _6(t, e, r) { return { min: e !== void 0 ? t.min + e : void 0, max: r !== void 0 ? t.max + r - (t.max - t.min) : void 0 @@ -33320,18 +33321,18 @@ function x6(t, e, r) { } function jee(t, { top: e, left: r, bottom: n, right: i }) { return { - x: x6(t.x, r, i), - y: x6(t.y, e, n) + x: _6(t.x, r, i), + y: _6(t.y, e, n) }; } -function _6(t, e) { +function E6(t, e) { let r = e.min - t.min, n = e.max - t.max; return e.max - e.min < t.max - t.min && ([r, n] = [n, r]), { min: r, max: n }; } function Uee(t, e) { return { - x: _6(t.x, e.x), - y: _6(t.y, e.y) + x: E6(t.x, e.x), + y: E6(t.y, e.y) }; } function qee(t, e) { @@ -33346,35 +33347,35 @@ function zee(t, e) { const av = 0.35; function Wee(t = av) { return t === !1 ? t = 0 : t === !0 && (t = av), { - x: E6(t, "left", "right"), - y: E6(t, "top", "bottom") + x: S6(t, "left", "right"), + y: S6(t, "top", "bottom") }; } -function E6(t, e, r) { +function S6(t, e, r) { return { - min: S6(t, e), - max: S6(t, r) + min: A6(t, e), + max: A6(t, r) }; } -function S6(t, e) { +function A6(t, e) { return typeof t == "number" ? t : t[e] || 0; } -const A6 = () => ({ +const P6 = () => ({ translate: 0, scale: 1, origin: 0, originPoint: 0 }), ru = () => ({ - x: A6(), - y: A6() -}), P6 = () => ({ min: 0, max: 0 }), ln = () => ({ x: P6(), y: P6() +}), M6 = () => ({ min: 0, max: 0 }), ln = () => ({ + x: M6(), + y: M6() }); function Xi(t) { return [t("x"), t("y")]; } -function U7({ top: t, left: e, right: r, bottom: n }) { +function q7({ top: t, left: e, right: r, bottom: n }) { return { x: { min: e, max: r }, y: { min: t, max: n } @@ -33401,28 +33402,28 @@ function cv({ scale: t, scaleX: e, scaleY: r }) { return !Fm(t) || !Fm(e) || !Fm(r); } function Ya(t) { - return cv(t) || q7(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY; + return cv(t) || z7(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY; } -function q7(t) { - return M6(t.x) || M6(t.y); +function z7(t) { + return I6(t.x) || I6(t.y); } -function M6(t) { +function I6(t) { return t && t !== "0%"; } function x0(t, e, r) { const n = t - r, i = e * n; return r + i; } -function I6(t, e, r, n, i) { +function C6(t, e, r, n, i) { return i !== void 0 && (t = x0(t, i, n)), x0(t, r, n) + e; } function uv(t, e = 0, r = 1, n, i) { - t.min = I6(t.min, e, r, n, i), t.max = I6(t.max, e, r, n, i); + t.min = C6(t.min, e, r, n, i), t.max = C6(t.max, e, r, n, i); } -function z7(t, { x: e, y: r }) { +function W7(t, { x: e, y: r }) { uv(t.x, e.translate, e.scale, e.originPoint), uv(t.y, r.translate, r.scale, r.originPoint); } -const C6 = 0.999999999999, T6 = 1.0000000000001; +const T6 = 0.999999999999, R6 = 1.0000000000001; function Vee(t, e, r, n = !1) { const i = r.length; if (!i) @@ -33435,28 +33436,28 @@ function Vee(t, e, r, n = !1) { u && u.props.style && u.props.style.display === "contents" || (n && s.options.layoutScroll && s.scroll && s !== s.root && iu(t, { x: -s.scroll.offset.x, y: -s.scroll.offset.y - }), o && (e.x *= o.x.scale, e.y *= o.y.scale, z7(t, o)), n && Ya(s.latestValues) && iu(t, s.latestValues)); + }), o && (e.x *= o.x.scale, e.y *= o.y.scale, W7(t, o)), n && Ya(s.latestValues) && iu(t, s.latestValues)); } - e.x < T6 && e.x > C6 && (e.x = 1), e.y < T6 && e.y > C6 && (e.y = 1); + e.x < R6 && e.x > T6 && (e.x = 1), e.y < R6 && e.y > T6 && (e.y = 1); } function nu(t, e) { t.min = t.min + e, t.max = t.max + e; } -function R6(t, e, r, n, i = 0.5) { +function D6(t, e, r, n, i = 0.5) { const s = Qr(t.min, t.max, i); uv(t, e, r, s, n); } function iu(t, e) { - R6(t.x, e.x, e.scaleX, e.scale, e.originX), R6(t.y, e.y, e.scaleY, e.scale, e.originY); + D6(t.x, e.x, e.scaleX, e.scale, e.originX), D6(t.y, e.y, e.scaleY, e.scale, e.originY); } -function W7(t, e) { - return U7(Kee(t.getBoundingClientRect(), e)); +function H7(t, e) { + return q7(Kee(t.getBoundingClientRect(), e)); } function Gee(t, e, r) { - const n = W7(t, r), { scroll: i } = e; + const n = H7(t, r), { scroll: i } = e; return i && (nu(n.x, i.offset.x), nu(n.y, i.offset.y)), n; } -const H7 = ({ current: t }) => t ? t.ownerDocument.defaultView : null, Yee = /* @__PURE__ */ new WeakMap(); +const K7 = ({ current: t }) => t ? t.ownerDocument.defaultView : null, Yee = /* @__PURE__ */ new WeakMap(); class Jee { constructor(e) { this.openGlobalLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = ln(), this.visualElement = e; @@ -33470,18 +33471,18 @@ class Jee { p ? this.pauseAnimation() : this.stopAnimation(), r && this.snapToCursor(xp(d, "page").point); }, s = (d, p) => { const { drag: w, dragPropagation: A, onDragStart: M } = this.getProps(); - if (w && !A && (this.openGlobalLock && this.openGlobalLock(), this.openGlobalLock = $7(w), !this.openGlobalLock)) + if (w && !A && (this.openGlobalLock && this.openGlobalLock(), this.openGlobalLock = B7(w), !this.openGlobalLock)) return; this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), Xi((L) => { - let B = this.getAxisMotionValue(L).get() || 0; - if (Gs.test(B)) { - const { projection: $ } = this.visualElement; - if ($ && $.layout) { - const H = $.layout.layoutBox[L]; - H && (B = Li(H) * (parseFloat(B) / 100)); + let $ = this.getAxisMotionValue(L).get() || 0; + if (Gs.test($)) { + const { projection: B } = this.visualElement; + if (B && B.layout) { + const H = B.layout.layoutBox[L]; + H && ($ = Li(H) * (parseFloat($) / 100)); } } - this.originPoint[L] = B; + this.originPoint[L] = $; }), M && Lr.postRender(() => M(d, p)), sv(this.visualElement, "transform"); const { animationState: N } = this.visualElement; N && N.setActive("whileDrag", !0); @@ -33499,7 +33500,7 @@ class Jee { var p; return this.getAnimationState(d) === "paused" && ((p = this.getAxisMotionValue(d).animation) === null || p === void 0 ? void 0 : p.play()); }), { dragSnapToOrigin: l } = this.getProps(); - this.panSession = new N7(e, { + this.panSession = new L7(e, { onSessionStart: i, onStart: s, onMove: o, @@ -33508,7 +33509,7 @@ class Jee { }, { transformPagePoint: this.visualElement.getTransformPagePoint(), dragSnapToOrigin: l, - contextWindow: H7(this.visualElement) + contextWindow: K7(this.visualElement) }); } stop(e, r) { @@ -33555,7 +33556,7 @@ class Jee { let o = Uee(i.layout.layoutBox, s); if (r) { const a = r(Hee(o)); - this.hasMutatedConstraints = !!a, a && (o = U7(a)); + this.hasMutatedConstraints = !!a, a && (o = q7(a)); } return o; } @@ -33582,7 +33583,7 @@ class Jee { } startAxisValueAnimation(e, r) { const n = this.getAxisMotionValue(e); - return sv(this.visualElement, e), n.start(Hb(e, n, 0, r, this.visualElement, !1)); + return sv(this.visualElement, e), n.start(Kb(e, n, 0, r, this.visualElement, !1)); } stopAnimation() { Xi((e) => this.getAxisMotionValue(e).stop()); @@ -33701,7 +33702,7 @@ class Zee extends Ra { this.removeGroupControls(), this.removeListeners(); } } -const D6 = (t) => (e, r) => { +const O6 = (t) => (e, r) => { t && Lr.postRender(() => t(e, r)); }; class Qee extends Ra { @@ -33709,16 +33710,16 @@ class Qee extends Ra { super(...arguments), this.removePointerDownListener = Un; } onPointerDown(e) { - this.session = new N7(e, this.createPanHandlers(), { + this.session = new L7(e, this.createPanHandlers(), { transformPagePoint: this.node.getTransformPagePoint(), - contextWindow: H7(this.node) + contextWindow: K7(this.node) }); } createPanHandlers() { const { onPanSessionStart: e, onPanStart: r, onPan: n, onPanEnd: i } = this.node.getProps(); return { - onSessionStart: D6(e), - onStart: D6(r), + onSessionStart: O6(e), + onStart: O6(r), onMove: n, onEnd: (s, o) => { delete this.session, i && Lr.postRender(() => i(s, o)); @@ -33740,12 +33741,12 @@ function ete() { const t = Tn(_p); if (t === null) return [!0, null]; - const { isPresent: e, onExitComplete: r, register: n } = t, i = vv(); + const { isPresent: e, onExitComplete: r, register: n } = t, i = bv(); Dn(() => n(i), []); - const s = bv(() => r && r(i), [i, r]); + const s = yv(() => r && r(i), [i, r]); return !e && r ? [!1, s] : [!0]; } -const Jb = Sa({}), K7 = Sa({}), jd = { +const Xb = Sa({}), V7 = Sa({}), jd = { /** * Global flag as to whether the tree has animated since the last time * we resized the window @@ -33757,7 +33758,7 @@ const Jb = Sa({}), K7 = Sa({}), jd = { */ hasEverUpdated: !1 }; -function O6(t, e) { +function N6(t, e) { return e.max === e.min ? 0 : t / (e.max - e.min) * 100; } const Of = { @@ -33769,7 +33770,7 @@ const Of = { t = parseFloat(t); else return t; - const r = O6(t, e.target.x), n = O6(t, e.target.y); + const r = N6(t, e.target.x), n = N6(t, e.target.y); return `${r}% ${n}%`; } }, tte = { @@ -33786,7 +33787,7 @@ const Of = { function rte(t) { Object.assign(_0, t); } -const { schedule: Xb } = GS(queueMicrotask, !1); +const { schedule: Zb } = YS(queueMicrotask, !1); class nte extends kR { /** * This only mounts projection nodes for components that @@ -33811,7 +33812,7 @@ class nte extends kR { } componentDidUpdate() { const { projection: e } = this.props.visualElement; - e && (e.root.didUpdate(), Xb.postRender(() => { + e && (e.root.didUpdate(), Zb.postRender(() => { !e.currentAnimation && e.isLead() && this.safeToRemove(); })); } @@ -33827,9 +33828,9 @@ class nte extends kR { return null; } } -function V7(t) { - const [e, r] = ete(), n = Tn(Jb); - return pe.jsx(nte, { ...t, layoutGroup: n, switchLayoutGroup: Tn(K7), isPresent: e, safeToRemove: r }); +function G7(t) { + const [e, r] = ete(), n = Tn(Xb); + return pe.jsx(nte, { ...t, layoutGroup: n, switchLayoutGroup: Tn(V7), isPresent: e, safeToRemove: r }); } const ite = { borderRadius: { @@ -33846,7 +33847,7 @@ const ite = { borderBottomLeftRadius: Of, borderBottomRightRadius: Of, boxShadow: tte -}, G7 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], ste = G7.length, N6 = (t) => typeof t == "string" ? parseFloat(t) : t, L6 = (t) => typeof t == "number" || Vt.test(t); +}, Y7 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], ste = Y7.length, L6 = (t) => typeof t == "string" ? parseFloat(t) : t, k6 = (t) => typeof t == "number" || Vt.test(t); function ote(t, e, r, n, i, s) { i ? (t.opacity = Qr( 0, @@ -33855,68 +33856,68 @@ function ote(t, e, r, n, i, s) { ate(n) ), t.opacityExit = Qr(e.opacity !== void 0 ? e.opacity : 1, 0, cte(n))) : s && (t.opacity = Qr(e.opacity !== void 0 ? e.opacity : 1, r.opacity !== void 0 ? r.opacity : 1, n)); for (let o = 0; o < ste; o++) { - const a = `border${G7[o]}Radius`; - let u = k6(e, a), l = k6(r, a); + const a = `border${Y7[o]}Radius`; + let u = $6(e, a), l = $6(r, a); if (u === void 0 && l === void 0) continue; - u || (u = 0), l || (l = 0), u === 0 || l === 0 || L6(u) === L6(l) ? (t[a] = Math.max(Qr(N6(u), N6(l), n), 0), (Gs.test(l) || Gs.test(u)) && (t[a] += "%")) : t[a] = l; + u || (u = 0), l || (l = 0), u === 0 || l === 0 || k6(u) === k6(l) ? (t[a] = Math.max(Qr(L6(u), L6(l), n), 0), (Gs.test(l) || Gs.test(u)) && (t[a] += "%")) : t[a] = l; } (e.rotate || r.rotate) && (t.rotate = Qr(e.rotate || 0, r.rotate || 0, n)); } -function k6(t, e) { +function $6(t, e) { return t[e] !== void 0 ? t[e] : t.borderRadius; } -const ate = /* @__PURE__ */ Y7(0, 0.5, t7), cte = /* @__PURE__ */ Y7(0.5, 0.95, Un); -function Y7(t, e, r) { +const ate = /* @__PURE__ */ J7(0, 0.5, r7), cte = /* @__PURE__ */ J7(0.5, 0.95, Un); +function J7(t, e, r) { return (n) => n < t ? 0 : n > e ? 1 : r(Iu(t, e, n)); } -function $6(t, e) { +function B6(t, e) { t.min = e.min, t.max = e.max; } function Yi(t, e) { - $6(t.x, e.x), $6(t.y, e.y); + B6(t.x, e.x), B6(t.y, e.y); } -function B6(t, e) { +function F6(t, e) { t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin; } -function F6(t, e, r, n, i) { +function j6(t, e, r, n, i) { return t -= e, t = x0(t, 1 / r, n), i !== void 0 && (t = x0(t, 1 / i, n)), t; } function ute(t, e = 0, r = 1, n = 0.5, i, s = t, o = t) { if (Gs.test(e) && (e = parseFloat(e), e = Qr(o.min, o.max, e / 100) - o.min), typeof e != "number") return; let a = Qr(s.min, s.max, n); - t === s && (a -= e), t.min = F6(t.min, e, r, a, i), t.max = F6(t.max, e, r, a, i); + t === s && (a -= e), t.min = j6(t.min, e, r, a, i), t.max = j6(t.max, e, r, a, i); } -function j6(t, e, [r, n, i], s, o) { +function U6(t, e, [r, n, i], s, o) { ute(t, e[r], e[n], e[i], e.scale, s, o); } const fte = ["x", "scaleX", "originX"], lte = ["y", "scaleY", "originY"]; -function U6(t, e, r, n) { - j6(t.x, e, fte, r ? r.x : void 0, n ? n.x : void 0), j6(t.y, e, lte, r ? r.y : void 0, n ? n.y : void 0); +function q6(t, e, r, n) { + U6(t.x, e, fte, r ? r.x : void 0, n ? n.x : void 0), U6(t.y, e, lte, r ? r.y : void 0, n ? n.y : void 0); } -function q6(t) { +function z6(t) { return t.translate === 0 && t.scale === 1; } -function J7(t) { - return q6(t.x) && q6(t.y); +function X7(t) { + return z6(t.x) && z6(t.y); } -function z6(t, e) { +function W6(t, e) { return t.min === e.min && t.max === e.max; } function hte(t, e) { - return z6(t.x, e.x) && z6(t.y, e.y); + return W6(t.x, e.x) && W6(t.y, e.y); } -function W6(t, e) { +function H6(t, e) { return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max); } -function X7(t, e) { - return W6(t.x, e.x) && W6(t.y, e.y); +function Z7(t, e) { + return H6(t.x, e.x) && H6(t.y, e.y); } -function H6(t) { +function K6(t) { return Li(t.x) / Li(t.y); } -function K6(t, e) { +function V6(t, e) { return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint; } class dte { @@ -33924,10 +33925,10 @@ class dte { this.members = []; } add(e) { - Kb(this.members, e), e.scheduleRender(); + Vb(this.members, e), e.scheduleRender(); } remove(e) { - if (Vb(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) { + if (Gb(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) { const r = this.members[this.members.length - 1]; r && this.promote(r); } @@ -33989,10 +33990,10 @@ class mte { this.children = [], this.isDirty = !1; } add(e) { - Kb(this.children, e), this.isDirty = !0; + Vb(this.children, e), this.isDirty = !0; } remove(e) { - Vb(this.children, e), this.isDirty = !0; + Gb(this.children, e), this.isDirty = !0; } forEach(e) { this.isDirty && this.children.sort(gte), this.isDirty = !1, this.children.forEach(e); @@ -34014,34 +34015,34 @@ function bte(t) { } function yte(t, e, r) { const n = Xn(t) ? t : Rl(t); - return n.start(Hb("", n, e, r)), n.animation; + return n.start(Kb("", n, e, r)), n.animation; } const Ja = { type: "projectionFrame", totalNodes: 0, resolvedTargetDeltas: 0, recalculatedProjection: 0 -}, Uf = typeof window < "u" && window.MotionDebug !== void 0, jm = ["", "X", "Y", "Z"], wte = { visibility: "hidden" }, V6 = 1e3; +}, Uf = typeof window < "u" && window.MotionDebug !== void 0, jm = ["", "X", "Y", "Z"], wte = { visibility: "hidden" }, G6 = 1e3; let xte = 0; function Um(t, e, r, n) { const { latestValues: i } = e; i[t] && (r[t] = i[t], e.setStaticValue(t, 0), n && (n[t] = 0)); } -function Z7(t) { +function Q7(t) { if (t.hasCheckedOptimisedAppear = !0, t.root === t) return; const { visualElement: e } = t.options; if (!e) return; - const r = T7(e); + const r = R7(e); if (window.MotionHasOptimisedAnimation(r, "transform")) { const { layout: i, layoutId: s } = t.options; window.MotionCancelOptimisedAnimation(r, "transform", Lr, !(i || s)); } const { parent: n } = t; - n && !n.hasCheckedOptimisedAppear && Z7(n); + n && !n.hasCheckedOptimisedAppear && Q7(n); } -function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, checkIsScrollRoot: n, resetTransform: i }) { +function e9({ attachResizeListener: t, defaultParent: e, measureScroll: r, checkIsScrollRoot: n, resetTransform: i }) { return class { constructor(o = {}, a = e == null ? void 0 : e()) { this.id = xte++, this.animationId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => { @@ -34054,7 +34055,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.root === this && (this.nodes = new mte()); } addEventListener(o, a) { - return this.eventHandlers.has(o) || this.eventHandlers.set(o, new Gb()), this.eventHandlers.get(o).add(a); + return this.eventHandlers.has(o) || this.eventHandlers.set(o, new Yb()), this.eventHandlers.get(o).add(a); } notifyListeners(o, ...a) { const u = this.eventHandlers.get(o); @@ -34075,7 +34076,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check let p; const w = () => this.root.updateBlockedByResize = !1; t(o, () => { - this.root.updateBlockedByResize = !0, p && p(), p = vte(w, 250), jd.hasAnimatedSinceResize && (jd.hasAnimatedSinceResize = !1, this.nodes.forEach(Y6)); + this.root.updateBlockedByResize = !0, p && p(), p = vte(w, 250), jd.hasAnimatedSinceResize && (jd.hasAnimatedSinceResize = !1, this.nodes.forEach(J6)); }); } u && this.root.registerSharedNode(u, this), this.options.animate !== !1 && d && (u || l) && this.addEventListener("didUpdate", ({ delta: p, hasLayoutChanged: w, hasRelativeTargetChanged: A, layout: M }) => { @@ -34083,17 +34084,17 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.target = void 0, this.relativeTarget = void 0; return; } - const N = this.options.transition || d.getDefaultTransition() || Lte, { onLayoutAnimationStart: L, onLayoutAnimationComplete: B } = d.getProps(), $ = !this.targetLayout || !X7(this.targetLayout, M) || A, H = !w && A; - if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || H || w && ($ || !this.currentAnimation)) { + const N = this.options.transition || d.getDefaultTransition() || Lte, { onLayoutAnimationStart: L, onLayoutAnimationComplete: $ } = d.getProps(), B = !this.targetLayout || !Z7(this.targetLayout, M) || A, H = !w && A; + if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || H || w && (B || !this.currentAnimation)) { this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0), this.setAnimationOrigin(p, H); - const W = { - ...Rb(N, "layout"), + const U = { + ...Db(N, "layout"), onPlay: L, - onComplete: B + onComplete: $ }; - (d.shouldReduceMotion || this.options.layoutRoot) && (W.delay = 0, W.type = !1), this.startAnimation(W); + (d.shouldReduceMotion || this.options.layoutRoot) && (U.delay = 0, U.type = !1), this.startAnimation(U); } else - w || Y6(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete(); + w || J6(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete(); this.targetLayout = M; }); } @@ -34128,7 +34129,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.options.onExitComplete && this.options.onExitComplete(); return; } - if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && Z7(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty) + if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && Q7(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty) return; this.isLayoutDirty = !0; for (let d = 0; d < this.path.length; d++) { @@ -34143,7 +34144,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check } update() { if (this.updateScheduled = !1, this.isUpdateBlocked()) { - this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(G6); + this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(Y6); return; } this.isUpdating || this.nodes.forEach(Mte), this.isUpdating = !1, this.nodes.forEach(Ite), this.nodes.forEach(_te), this.nodes.forEach(Ete), this.clearAllSnapshots(); @@ -34151,7 +34152,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check Fn.delta = xa(0, 1e3 / 60, a - Fn.timestamp), Fn.timestamp = a, Fn.isProcessing = !0, Dm.update.process(Fn), Dm.preRender.process(Fn), Dm.render.process(Fn), Fn.isProcessing = !1; } didUpdate() { - this.updateScheduled || (this.updateScheduled = !0, Xb.read(this.scheduleUpdate)); + this.updateScheduled || (this.updateScheduled = !0, Zb.read(this.scheduleUpdate)); } clearAllSnapshots() { this.nodes.forEach(Pte), this.sharedNodes.forEach(Dte); @@ -34197,7 +34198,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check resetTransform() { if (!i) return; - const o = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, a = this.projectionDelta && !J7(this.projectionDelta), u = this.getTransformTemplate(), l = u ? u(this.latestValues, "") : void 0, d = l !== this.prevTransformTemplateValue; + const o = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, a = this.projectionDelta && !X7(this.projectionDelta), u = this.getTransformTemplate(), l = u ? u(this.latestValues, "") : void 0, d = l !== this.prevTransformTemplateValue; o && (a || Ya(this.latestValues) || d) && (i(this.instance, l), this.shouldResetTransform = !1, this.scheduleRender()); } measure(o = !0) { @@ -34255,9 +34256,9 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check continue; cv(l.latestValues) && l.updateSnapshot(); const d = ln(), p = l.measurePageBox(); - Yi(d, p), U6(a, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, d); + Yi(d, p), q6(a, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, d); } - return Ya(this.latestValues) && U6(a, this.latestValues), a; + return Ya(this.latestValues) && q6(a, this.latestValues), a; } setTargetDelta(o) { this.targetDelta = o, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0; @@ -34289,7 +34290,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check A && A.layout && this.animationProgress !== 1 ? (this.relativeParent = A, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), Xf(this.relativeTargetOrigin, this.layout.layoutBox, A.layout.layoutBox), Yi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; } if (!(!this.relativeTarget && !this.targetDelta)) { - if (this.target || (this.target = ln(), this.targetWithTransforms = ln()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), Bee(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : Yi(this.target, this.layout.layoutBox), z7(this.target, this.targetDelta)) : Yi(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget) { + if (this.target || (this.target = ln(), this.targetWithTransforms = ln()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), Bee(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : Yi(this.target, this.layout.layoutBox), W7(this.target, this.targetDelta)) : Yi(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget) { this.attemptToResolveRelativeTarget = !1; const A = this.getClosestProjectingParent(); A && !!A.resumingFrom == !!this.resumingFrom && !A.options.layoutScroll && A.target && this.animationProgress !== 1 ? (this.relativeParent = A, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), Xf(this.relativeTargetOrigin, this.target, A.target), Yi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; @@ -34299,7 +34300,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check } } getClosestProjectingParent() { - if (!(!this.parent || cv(this.parent.latestValues) || q7(this.parent.latestValues))) + if (!(!this.parent || cv(this.parent.latestValues) || z7(this.parent.latestValues))) return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent(); } isProjecting() { @@ -34322,7 +34323,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender()); return; } - !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (B6(this.prevProjectionDelta.x, this.projectionDelta.x), B6(this.prevProjectionDelta.y, this.projectionDelta.y)), Jf(this.projectionDelta, this.layoutCorrected, M, this.latestValues), (this.treeScale.x !== w || this.treeScale.y !== A || !K6(this.projectionDelta.x, this.prevProjectionDelta.x) || !K6(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", M)), Uf && Ja.recalculatedProjection++; + !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (F6(this.prevProjectionDelta.x, this.projectionDelta.x), F6(this.prevProjectionDelta.y, this.projectionDelta.y)), Jf(this.projectionDelta, this.layoutCorrected, M, this.latestValues), (this.treeScale.x !== w || this.treeScale.y !== A || !V6(this.projectionDelta.x, this.prevProjectionDelta.x) || !V6(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", M)), Uf && Ja.recalculatedProjection++; } hide() { this.isVisible = !1; @@ -34344,17 +34345,17 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check setAnimationOrigin(o, a = !1) { const u = this.snapshot, l = u ? u.latestValues : {}, d = { ...this.latestValues }, p = ru(); (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !a; - const w = ln(), A = u ? u.source : void 0, M = this.layout ? this.layout.source : void 0, N = A !== M, L = this.getStack(), B = !L || L.members.length <= 1, $ = !!(N && !B && this.options.crossfade === !0 && !this.path.some(Nte)); + const w = ln(), A = u ? u.source : void 0, M = this.layout ? this.layout.source : void 0, N = A !== M, L = this.getStack(), $ = !L || L.members.length <= 1, B = !!(N && !$ && this.options.crossfade === !0 && !this.path.some(Nte)); this.animationProgress = 0; let H; - this.mixTargetDelta = (W) => { - const V = W / 1e3; - J6(p.x, o.x, V), J6(p.y, o.y, V), this.setTargetDelta(p), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Xf(w, this.layout.layoutBox, this.relativeParent.layout.layoutBox), Ote(this.relativeTarget, this.relativeTargetOrigin, w, V), H && hte(this.relativeTarget, H) && (this.isProjectionDirty = !1), H || (H = ln()), Yi(H, this.relativeTarget)), N && (this.animationValues = d, ote(d, l, this.latestValues, V, $, B)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V; + this.mixTargetDelta = (U) => { + const V = U / 1e3; + X6(p.x, o.x, V), X6(p.y, o.y, V), this.setTargetDelta(p), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Xf(w, this.layout.layoutBox, this.relativeParent.layout.layoutBox), Ote(this.relativeTarget, this.relativeTargetOrigin, w, V), H && hte(this.relativeTarget, H) && (this.isProjectionDirty = !1), H || (H = ln()), Yi(H, this.relativeTarget)), N && (this.animationValues = d, ote(d, l, this.latestValues, V, B, $)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V; }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0); } startAnimation(o) { this.notifyListeners("animationStart"), this.currentAnimation && this.currentAnimation.stop(), this.resumingFrom && this.resumingFrom.currentAnimation && this.resumingFrom.currentAnimation.stop(), this.pendingAnimation && (wa(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = Lr.update(() => { - jd.hasAnimatedSinceResize = !0, this.currentAnimation = yte(0, V6, { + jd.hasAnimatedSinceResize = !0, this.currentAnimation = yte(0, G6, { ...o, onUpdate: (a) => { this.mixTargetDelta(a), o.onUpdate && o.onUpdate(a); @@ -34371,13 +34372,13 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check o && o.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete"); } finishAnimation() { - this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(V6), this.currentAnimation.stop()), this.completeAnimation(); + this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(G6), this.currentAnimation.stop()), this.completeAnimation(); } applyTransformsToTarget() { const o = this.getLead(); let { targetWithTransforms: a, target: u, layout: l, latestValues: d } = o; if (!(!a || !u || !l)) { - if (this !== o && this.layout && l && e9(this.options.animationType, this.layout.layoutBox, l.layoutBox)) { + if (this !== o && this.layout && l && t9(this.options.animationType, this.layout.layoutBox, l.layoutBox)) { u = this.target || ln(); const p = Li(this.layout.layoutBox.x); u.x.min = o.target.x.min, u.x.max = u.x.min + p; @@ -34462,13 +34463,13 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check for (const N in _0) { if (w[N] === void 0) continue; - const { correct: L, applyTo: B } = _0[N], $ = l.transform === "none" ? w[N] : L(w[N], p); - if (B) { - const H = B.length; - for (let W = 0; W < H; W++) - l[B[W]] = $; + const { correct: L, applyTo: $ } = _0[N], B = l.transform === "none" ? w[N] : L(w[N], p); + if ($) { + const H = $.length; + for (let U = 0; U < H; U++) + l[$[U]] = B; } else - l[N] = $; + l[N] = B; } return this.options.layoutId && (l.pointerEvents = p === this ? Ud(o == null ? void 0 : o.pointerEvents) || "" : "none"), l; } @@ -34480,7 +34481,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.root.nodes.forEach((o) => { var a; return (a = o.currentAnimation) === null || a === void 0 ? void 0 : a.stop(); - }), this.root.nodes.forEach(G6), this.root.sharedNodes.clear(); + }), this.root.nodes.forEach(Y6), this.root.sharedNodes.clear(); } }; } @@ -34495,7 +34496,7 @@ function Ete(t) { s === "size" ? Xi((p) => { const w = o ? r.measuredBox[p] : r.layoutBox[p], A = Li(w); w.min = n[p].min, w.max = w.min + A; - }) : e9(s, r.layoutBox, n) && Xi((p) => { + }) : t9(s, r.layoutBox, n) && Xi((p) => { const w = o ? r.measuredBox[p] : r.layoutBox[p], A = Li(n[p]); w.max = w.min + A, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[p].max = t.relativeTarget[p].min + A); }); @@ -34503,7 +34504,7 @@ function Ete(t) { Jf(a, n, r.layoutBox); const u = ru(); o ? Jf(u, t.applyTransform(i, !0), r.measuredBox) : Jf(u, n, r.layoutBox); - const l = !J7(a); + const l = !X7(a); let d = !1; if (!t.resumeFrom) { const p = t.getClosestProjectingParent(); @@ -34513,7 +34514,7 @@ function Ete(t) { const M = ln(); Xf(M, r.layoutBox, w.layoutBox); const N = ln(); - Xf(N, n, A.layoutBox), X7(M, N) || (d = !0), p.options.layoutRoot && (t.relativeTarget = N, t.relativeTargetOrigin = M, t.relativeParent = p); + Xf(N, n, A.layoutBox), Z7(M, N) || (d = !0), p.options.layoutRoot && (t.relativeTarget = N, t.relativeTargetOrigin = M, t.relativeParent = p); } } } @@ -34540,7 +34541,7 @@ function Ate(t) { function Pte(t) { t.clearSnapshot(); } -function G6(t) { +function Y6(t) { t.clearMeasurements(); } function Mte(t) { @@ -34550,7 +34551,7 @@ function Ite(t) { const { visualElement: e } = t.options; e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform(); } -function Y6(t) { +function J6(t) { t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0; } function Cte(t) { @@ -34565,14 +34566,14 @@ function Rte(t) { function Dte(t) { t.removeLeadSnapshot(); } -function J6(t, e, r) { +function X6(t, e, r) { t.translate = Qr(e.translate, 0, r), t.scale = Qr(e.scale, 1, r), t.origin = e.origin, t.originPoint = e.originPoint; } -function X6(t, e, r, n) { +function Z6(t, e, r, n) { t.min = Qr(e.min, r.min, n), t.max = Qr(e.max, r.max, n); } function Ote(t, e, r, n) { - X6(t.x, e.x, r.x, n), X6(t.y, e.y, r.y, n); + Z6(t.x, e.x, r.x, n), Z6(t.y, e.y, r.y, n); } function Nte(t) { return t.animationValues && t.animationValues.opacityExit !== void 0; @@ -34580,21 +34581,21 @@ function Nte(t) { const Lte = { duration: 0.45, ease: [0.4, 0, 0.1, 1] -}, Z6 = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Q6 = Z6("applewebkit/") && !Z6("chrome/") ? Math.round : Un; -function e5(t) { - t.min = Q6(t.min), t.max = Q6(t.max); +}, Q6 = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), e5 = Q6("applewebkit/") && !Q6("chrome/") ? Math.round : Un; +function t5(t) { + t.min = e5(t.min), t.max = e5(t.max); } function kte(t) { - e5(t.x), e5(t.y); + t5(t.x), t5(t.y); } -function e9(t, e, r) { - return t === "position" || t === "preserve-aspect" && !$ee(H6(e), H6(r), 0.2); +function t9(t, e, r) { + return t === "position" || t === "preserve-aspect" && !$ee(K6(e), K6(r), 0.2); } function $te(t) { var e; return t !== t.root && ((e = t.scroll) === null || e === void 0 ? void 0 : e.wasRoot); } -const Bte = Q7({ +const Bte = e9({ attachResizeListener: (t, e) => Mo(t, "resize", e), measureScroll: () => ({ x: document.documentElement.scrollLeft || document.body.scrollLeft, @@ -34603,7 +34604,7 @@ const Bte = Q7({ checkIsScrollRoot: () => !0 }), qm = { current: void 0 -}, t9 = Q7({ +}, r9 = e9({ measureScroll: (t) => ({ x: t.scrollLeft, y: t.scrollTop @@ -34625,13 +34626,13 @@ const Bte = Q7({ }, drag: { Feature: Zee, - ProjectionNode: t9, - MeasureLayout: V7 + ProjectionNode: r9, + MeasureLayout: G7 } }; -function t5(t, e) { +function r5(t, e) { const r = e ? "pointerenter" : "pointerleave", n = e ? "onHoverStart" : "onHoverEnd", i = (s, o) => { - if (s.pointerType === "touch" || B7()) + if (s.pointerType === "touch" || F7()) return; const a = t.getProps(); t.animationState && a.whileHover && t.animationState.setActive("whileHover", e); @@ -34644,7 +34645,7 @@ function t5(t, e) { } class jte extends Ra { mount() { - this.unmount = Ro(t5(this.node, !0), t5(this.node, !1)); + this.unmount = Ro(r5(this.node, !0), r5(this.node, !1)); } unmount() { } @@ -34671,7 +34672,7 @@ class Ute extends Ra { unmount() { } } -const r9 = (t, e) => e ? t === e ? !0 : r9(t, e.parentElement) : !1; +const n9 = (t, e) => e ? t === e ? !0 : n9(t, e.parentElement) : !1; function zm(t, e) { if (!e) return; @@ -34687,7 +34688,7 @@ class qte extends Ra { const n = this.node.getProps(), s = Do(window, "pointerup", (a, u) => { if (!this.checkPressEnd()) return; - const { onTap: l, onTapCancel: d, globalTapTarget: p } = this.node.getProps(), w = !p && !r9(this.node.current, a.target) ? d : l; + const { onTap: l, onTapCancel: d, globalTapTarget: p } = this.node.getProps(), w = !p && !n9(this.node.current, a.target) ? d : l; w && Lr.update(() => w(a, u)); }, { passive: !(n.onTap || n.onPointerUp) @@ -34720,7 +34721,7 @@ class qte extends Ra { i && this.node.animationState && this.node.animationState.setActive("whileTap", !0), n && Lr.postRender(() => n(e, r)); } checkPressEnd() { - return this.removeEndListeners(), this.isPressing = !1, this.node.getProps().whileTap && this.node.animationState && this.node.animationState.setActive("whileTap", !1), !B7(); + return this.removeEndListeners(), this.isPressing = !1, this.node.getProps().whileTap && this.node.animationState && this.node.animationState.setActive("whileTap", !1), !F7(); } cancelPress(e, r) { if (!this.checkPressEnd()) @@ -34810,17 +34811,17 @@ const Jte = { } }, Xte = { layout: { - ProjectionNode: t9, - MeasureLayout: V7 + ProjectionNode: r9, + MeasureLayout: G7 } -}, Zb = Sa({ +}, Qb = Sa({ transformPagePoint: (t) => t, isStatic: !1, reducedMotion: "never" -}), Ep = Sa({}), Qb = typeof window < "u", n9 = Qb ? $R : Dn, i9 = Sa({ strict: !1 }); +}), Ep = Sa({}), ey = typeof window < "u", i9 = ey ? $R : Dn, s9 = Sa({ strict: !1 }); function Zte(t, e, r, n, i) { var s, o; - const { visualElement: a } = Tn(Ep), u = Tn(i9), l = Tn(_p), d = Tn(Zb).reducedMotion, p = Zn(); + const { visualElement: a } = Tn(Ep), u = Tn(s9), l = Tn(_p), d = Tn(Qb).reducedMotion, p = Zn(); n = n || u.renderer, !p.current && n && (p.current = n(t, { visualState: e, parent: a, @@ -34829,25 +34830,25 @@ function Zte(t, e, r, n, i) { blockInitialAnimation: l ? l.initial === !1 : !1, reducedMotionConfig: d })); - const w = p.current, A = Tn(K7); + const w = p.current, A = Tn(V7); w && !w.projection && i && (w.type === "html" || w.type === "svg") && Qte(p.current, r, i, A); const M = Zn(!1); - y5(() => { + w5(() => { w && M.current && w.update(r, l); }); - const N = r[C7], L = Zn(!!N && !(!((s = window.MotionHandoffIsComplete) === null || s === void 0) && s.call(window, N)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, N))); - return n9(() => { - w && (M.current = !0, window.MotionIsMounted = !0, w.updateFeatures(), Xb.render(w.render), L.current && w.animationState && w.animationState.animateChanges()); + const N = r[T7], L = Zn(!!N && !(!((s = window.MotionHandoffIsComplete) === null || s === void 0) && s.call(window, N)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, N))); + return i9(() => { + w && (M.current = !0, window.MotionIsMounted = !0, w.updateFeatures(), Zb.render(w.render), L.current && w.animationState && w.animationState.animateChanges()); }), Dn(() => { w && (!L.current && w.animationState && w.animationState.animateChanges(), L.current && (queueMicrotask(() => { - var B; - (B = window.MotionHandoffMarkAsComplete) === null || B === void 0 || B.call(window, N); + var $; + ($ = window.MotionHandoffMarkAsComplete) === null || $ === void 0 || $.call(window, N); }), L.current = !1)); }), w; } function Qte(t, e, r, n) { const { layoutId: i, layout: s, drag: o, dragConstraints: a, layoutScroll: u, layoutRoot: l } = e; - t.projection = new r(t.latestValues, e["data-framer-portal-id"] ? void 0 : s9(t.parent)), t.projection.setOptions({ + t.projection = new r(t.latestValues, e["data-framer-portal-id"] ? void 0 : o9(t.parent)), t.projection.setOptions({ layoutId: i, layout: s, alwaysMeasureLayout: !!o || a && tu(a), @@ -34865,12 +34866,12 @@ function Qte(t, e, r, n) { layoutRoot: l }); } -function s9(t) { +function o9(t) { if (t) - return t.options.allowProjection !== !1 ? t.projection : s9(t.parent); + return t.options.allowProjection !== !1 ? t.projection : o9(t.parent); } function ere(t, e, r) { - return bv( + return yv( (n) => { n && t.mount && t.mount(n), e && (n ? e.mount(n) : e.unmount()), r && (typeof r == "function" ? r(n) : tu(r) && (r.current = n)); }, @@ -34883,9 +34884,9 @@ function ere(t, e, r) { ); } function Sp(t) { - return bp(t.animate) || Tb.some((e) => Il(t[e])); + return bp(t.animate) || Rb.some((e) => Il(t[e])); } -function o9(t) { +function a9(t) { return !!(Sp(t) || t.variants); } function tre(t, e) { @@ -34900,12 +34901,12 @@ function tre(t, e) { } function rre(t) { const { initial: e, animate: r } = tre(t, Tn(Ep)); - return wi(() => ({ initial: e, animate: r }), [r5(e), r5(r)]); + return ci(() => ({ initial: e, animate: r }), [n5(e), n5(r)]); } -function r5(t) { +function n5(t) { return Array.isArray(t) ? t.join(" ") : t; } -const n5 = { +const i5 = { animation: [ "animate", "variants", @@ -34925,9 +34926,9 @@ const n5 = { inView: ["whileInView", "onViewportEnter", "onViewportLeave"], layout: ["layout", "layoutId"] }, Cu = {}; -for (const t in n5) +for (const t in i5) Cu[t] = { - isEnabled: (e) => n5[t].some((r) => !!e[r]) + isEnabled: (e) => i5[t].some((r) => !!e[r]) }; function nre(t) { for (const e in t) @@ -34942,26 +34943,26 @@ function sre({ preloadedFeatures: t, createVisualElement: e, useRender: r, useVi function s(a, u) { let l; const d = { - ...Tn(Zb), + ...Tn(Qb), ...a, layoutId: ore(a) }, { isStatic: p } = d, w = rre(a), A = n(a, p); - if (!p && Qb) { + if (!p && ey) { are(d, t); const M = cre(d); l = M.MeasureLayout, w.visualElement = Zte(i, A, d, e, M.ProjectionNode); } return pe.jsxs(Ep.Provider, { value: w, children: [l && w.visualElement ? pe.jsx(l, { visualElement: w.visualElement, ...d }) : null, r(i, a, ere(A, w.visualElement, u), A, p, w.visualElement)] }); } - const o = mv(s); + const o = vv(s); return o[ire] = i, o; } function ore({ layoutId: t }) { - const e = Tn(Jb).id; + const e = Tn(Xb).id; return e && t !== void 0 ? e + "-" + t : t; } function are(t, e) { - const r = Tn(i9).strict; + const r = Tn(s9).strict; if (process.env.NODE_ENV !== "production" && e && r) { const n = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead."; t.ignoreStrict ? Ku(!1, n) : Uo(!1, n); @@ -35004,7 +35005,7 @@ const ure = [ "use", "view" ]; -function ey(t) { +function ty(t) { return ( /** * If it's not a string, it's a custom React component. Currently we only support @@ -35024,12 +35025,12 @@ function ey(t) { ) ); } -function a9(t, { style: e, vars: r }, n, i) { +function c9(t, { style: e, vars: r }, n, i) { Object.assign(t.style, e, i && i.getProjectionStyles(n)); for (const s in r) t.style.setProperty(s, r[s]); } -const c9 = /* @__PURE__ */ new Set([ +const u9 = /* @__PURE__ */ new Set([ "baseFrequency", "diffuseConstant", "kernelMatrix", @@ -35054,23 +35055,23 @@ const c9 = /* @__PURE__ */ new Set([ "textLength", "lengthAdjust" ]); -function u9(t, e, r, n) { - a9(t, e, void 0, n); +function f9(t, e, r, n) { + c9(t, e, void 0, n); for (const i in e.attrs) - t.setAttribute(c9.has(i) ? i : Yb(i), e.attrs[i]); + t.setAttribute(u9.has(i) ? i : Jb(i), e.attrs[i]); } -function f9(t, { layout: e, layoutId: r }) { +function l9(t, { layout: e, layoutId: r }) { return Ac.has(t) || t.startsWith("origin") || (e || r !== void 0) && (!!_0[t] || t === "opacity"); } -function ty(t, e, r) { +function ry(t, e, r) { var n; const { style: i } = t, s = {}; for (const o in i) - (Xn(i[o]) || e.style && Xn(e.style[o]) || f9(o, t) || ((n = r == null ? void 0 : r.getValue(o)) === null || n === void 0 ? void 0 : n.liveStyle) !== void 0) && (s[o] = i[o]); + (Xn(i[o]) || e.style && Xn(e.style[o]) || l9(o, t) || ((n = r == null ? void 0 : r.getValue(o)) === null || n === void 0 ? void 0 : n.liveStyle) !== void 0) && (s[o] = i[o]); return s; } -function l9(t, e, r) { - const n = ty(t, e, r); +function h9(t, e, r) { + const n = ry(t, e, r); for (const i in t) if (Xn(t[i]) || Xn(e[i])) { const s = ah.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i; @@ -35078,7 +35079,7 @@ function l9(t, e, r) { } return n; } -function ry(t) { +function ny(t) { const e = Zn(null); return e.current === null && (e.current = t()), e.current; } @@ -35089,16 +35090,16 @@ function fre({ scrapeMotionValuesFromProps: t, createRenderState: e, onMount: r }; return r && (o.mount = (a) => r(n, a, o)), o; } -const h9 = (t) => (e, r) => { +const d9 = (t) => (e, r) => { const n = Tn(Ep), i = Tn(_p), s = () => fre(t, e, n, i); - return r ? s() : ry(s); + return r ? s() : ny(s); }; function lre(t, e, r, n) { const i = {}, s = n(t, {}); for (const w in s) i[w] = Ud(s[w]); let { initial: o, animate: a } = t; - const u = Sp(t), l = o9(t); + const u = Sp(t), l = a9(t); e && l && !u && t.inherit !== !1 && (o === void 0 && (o = e.initial), a === void 0 && (a = e.animate)); let d = r ? r.initial === !1 : !1; d = d || o === !1; @@ -35106,33 +35107,33 @@ function lre(t, e, r, n) { if (p && typeof p != "boolean" && !bp(p)) { const w = Array.isArray(p) ? p : [p]; for (let A = 0; A < w.length; A++) { - const M = Ib(t, w[A]); + const M = Cb(t, w[A]); if (M) { - const { transitionEnd: N, transition: L, ...B } = M; - for (const $ in B) { - let H = B[$]; + const { transitionEnd: N, transition: L, ...$ } = M; + for (const B in $) { + let H = $[B]; if (Array.isArray(H)) { - const W = d ? H.length - 1 : 0; - H = H[W]; + const U = d ? H.length - 1 : 0; + H = H[U]; } - H !== null && (i[$] = H); + H !== null && (i[B] = H); } - for (const $ in N) - i[$] = N[$]; + for (const B in N) + i[B] = N[B]; } } } return i; } -const ny = () => ({ +const iy = () => ({ style: {}, transform: {}, transformOrigin: {}, vars: {} -}), d9 = () => ({ - ...ny(), +}), p9 = () => ({ + ...iy(), attrs: {} -}), p9 = (t, e) => e && typeof t == "number" ? e.transform(t) : t, hre = { +}), g9 = (t, e) => e && typeof t == "number" ? e.transform(t) : t, hre = { x: "translateX", y: "translateY", z: "translateZ", @@ -35146,7 +35147,7 @@ function pre(t, e, r) { continue; let u = !0; if (typeof a == "number" ? u = a === (o.startsWith("scale") ? 1 : 0) : u = parseFloat(a) === 0, !u || r) { - const l = p9(a, Bb[o]); + const l = g9(a, Fb[o]); if (!u) { i = !1; const d = hre[o] || o; @@ -35157,7 +35158,7 @@ function pre(t, e, r) { } return n = n.trim(), r ? n = r(e, i ? "" : n) : i && (n = "none"), n; } -function iy(t, e, r) { +function sy(t, e, r) { const { style: n, vars: i, transformOrigin: s } = t; let o = !1, a = !1; for (const u in e) { @@ -35165,11 +35166,11 @@ function iy(t, e, r) { if (Ac.has(u)) { o = !0; continue; - } else if (o7(u)) { + } else if (a7(u)) { i[u] = l; continue; } else { - const d = p9(l, Bb[u]); + const d = g9(l, Fb[u]); u.startsWith("origin") ? (a = !0, s[u] = d) : n[u] = d; } } @@ -35178,11 +35179,11 @@ function iy(t, e, r) { n.transformOrigin = `${u} ${l} ${d}`; } } -function i5(t, e, r) { +function s5(t, e, r) { return typeof t == "string" ? t : Vt.transform(e + r * t); } function gre(t, e, r) { - const n = i5(e, t.x, t.width), i = i5(r, t.y, t.height); + const n = s5(e, t.x, t.width), i = s5(r, t.y, t.height); return `${n} ${i}`; } const mre = { @@ -35199,7 +35200,7 @@ function bre(t, e, r = 1, n = 0, i = !0) { const o = Vt.transform(e), a = Vt.transform(r); t[s.array] = `${o} ${a}`; } -function sy(t, { +function oy(t, { attrX: e, attrY: r, attrScale: n, @@ -35211,7 +35212,7 @@ function sy(t, { // This is object creation, which we try to avoid per-frame. ...l }, d, p) { - if (iy(t, l, p), d) { + if (sy(t, l, p), d) { t.style.viewBox && (t.attrs.viewBox = t.style.viewBox); return; } @@ -35219,10 +35220,10 @@ function sy(t, { const { attrs: w, style: A, dimensions: M } = t; w.transform && (M && (A.transform = w.transform), delete w.transform), M && (i !== void 0 || s !== void 0 || A.transform) && (A.transformOrigin = gre(M, i !== void 0 ? i : 0.5, s !== void 0 ? s : 0.5)), e !== void 0 && (w.x = e), r !== void 0 && (w.y = r), n !== void 0 && (w.scale = n), o !== void 0 && bre(w, o, a, u, !1); } -const oy = (t) => typeof t == "string" && t.toLowerCase() === "svg", yre = { - useVisualState: h9({ - scrapeMotionValuesFromProps: l9, - createRenderState: d9, +const ay = (t) => typeof t == "string" && t.toLowerCase() === "svg", yre = { + useVisualState: d9({ + scrapeMotionValuesFromProps: h9, + createRenderState: p9, onMount: (t, e, { renderState: r, latestValues: n }) => { Lr.read(() => { try { @@ -35236,29 +35237,29 @@ const oy = (t) => typeof t == "string" && t.toLowerCase() === "svg", yre = { }; } }), Lr.render(() => { - sy(r, n, oy(e.tagName), t.transformTemplate), u9(e, r); + oy(r, n, ay(e.tagName), t.transformTemplate), f9(e, r); }); } }) }, wre = { - useVisualState: h9({ - scrapeMotionValuesFromProps: ty, - createRenderState: ny + useVisualState: d9({ + scrapeMotionValuesFromProps: ry, + createRenderState: iy }) }; -function g9(t, e, r) { +function m9(t, e, r) { for (const n in e) - !Xn(e[n]) && !f9(n, r) && (t[n] = e[n]); + !Xn(e[n]) && !l9(n, r) && (t[n] = e[n]); } function xre({ transformTemplate: t }, e) { - return wi(() => { - const r = ny(); - return iy(r, e, t), Object.assign({}, r.vars, r.style); + return ci(() => { + const r = iy(); + return sy(r, e, t), Object.assign({}, r.vars, r.style); }, [e]); } function _re(t, e) { const r = t.style || {}, n = {}; - return g9(n, r, t), Object.assign(n, xre(t, e)), n; + return m9(n, r, t), Object.assign(n, xre(t, e)), n; } function Ere(t, e) { const r = {}, n = _re(t, e); @@ -35299,9 +35300,9 @@ const Sre = /* @__PURE__ */ new Set([ function E0(t) { return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || Sre.has(t); } -let m9 = (t) => !E0(t); +let v9 = (t) => !E0(t); function Are(t) { - t && (m9 = (e) => e.startsWith("on") ? !E0(e) : t(e)); + t && (v9 = (e) => e.startsWith("on") ? !E0(e) : t(e)); } try { Are(require("@emotion/is-prop-valid").default); @@ -35310,27 +35311,27 @@ try { function Pre(t, e, r) { const n = {}; for (const i in t) - i === "values" && typeof t.values == "object" || (m9(i) || r === !0 && E0(i) || !e && !E0(i) || // If trying to use native HTML drag events, forward drag listeners + i === "values" && typeof t.values == "object" || (v9(i) || r === !0 && E0(i) || !e && !E0(i) || // If trying to use native HTML drag events, forward drag listeners t.draggable && i.startsWith("onDrag")) && (n[i] = t[i]); return n; } function Mre(t, e, r, n) { - const i = wi(() => { - const s = d9(); - return sy(s, e, oy(n), t.transformTemplate), { + const i = ci(() => { + const s = p9(); + return oy(s, e, ay(n), t.transformTemplate), { ...s.attrs, style: { ...s.style } }; }, [e]); if (t.style) { const s = {}; - g9(s, t.style, t), i.style = { ...s, ...i.style }; + m9(s, t.style, t), i.style = { ...s, ...i.style }; } return i; } function Ire(t = !1) { return (r, n, i, { latestValues: s }, o) => { - const u = (ey(r) ? Mre : Ere)(n, s, o, r), l = Pre(n, typeof r == "string", t), d = r !== w5 ? { ...l, ...u, ref: i } : {}, { children: p } = n, w = wi(() => Xn(p) ? p.get() : p, [p]); + const u = (ty(r) ? Mre : Ere)(n, s, o, r), l = Pre(n, typeof r == "string", t), d = r !== x5 ? { ...l, ...u, ref: i } : {}, { children: p } = n, w = ci(() => Xn(p) ? p.get() : p, [p]); return qd(r, { ...d, children: w @@ -35340,7 +35341,7 @@ function Ire(t = !1) { function Cre(t, e) { return function(n, { forwardMotionProps: i } = { forwardMotionProps: !1 }) { const o = { - ...ey(n) ? yre : wre, + ...ty(n) ? yre : wre, preloadedFeatures: t, useRender: Ire(i), createVisualElement: e, @@ -35349,9 +35350,9 @@ function Cre(t, e) { return sre(o); }; } -const lv = { current: null }, v9 = { current: !1 }; +const lv = { current: null }, b9 = { current: !1 }; function Tre() { - if (v9.current = !0, !!Qb) + if (b9.current = !0, !!ey) if (window.matchMedia) { const t = window.matchMedia("(prefers-reduced-motion)"), e = () => lv.current = t.matches; t.addListener(e), e(); @@ -35378,7 +35379,7 @@ function Rre(t, e, r) { e[n] === void 0 && t.removeValue(n); return e; } -const s5 = /* @__PURE__ */ new WeakMap(), Dre = [...u7, Yn, _a], Ore = (t) => Dre.find(c7(t)), o5 = [ +const o5 = /* @__PURE__ */ new WeakMap(), Dre = [...f7, Yn, _a], Ore = (t) => Dre.find(u7(t)), a5 = [ "AnimationStart", "AnimationComplete", "Update", @@ -35399,14 +35400,14 @@ class Nre { return {}; } constructor({ parent: e, props: r, presenceContext: n, reducedMotionConfig: i, blockInitialAnimation: s, visualState: o }, a = {}) { - this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = Lb, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => { + this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = kb, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => { this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection)); }, this.renderScheduledAt = 0, this.scheduleRender = () => { const w = Ys.now(); this.renderScheduledAt < w && (this.renderScheduledAt = w, Lr.render(this.render, !1, !0)); }; const { latestValues: u, renderState: l } = o; - this.latestValues = u, this.baseTarget = { ...u }, this.initialValues = r.initial ? { ...u } : {}, this.renderState = l, this.parent = e, this.props = r, this.presenceContext = n, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!s, this.isControllingVariants = Sp(r), this.isVariantNode = o9(r), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current); + this.latestValues = u, this.baseTarget = { ...u }, this.initialValues = r.initial ? { ...u } : {}, this.renderState = l, this.parent = e, this.props = r, this.presenceContext = n, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!s, this.isControllingVariants = Sp(r), this.isVariantNode = a9(r), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current); const { willChange: d, ...p } = this.scrapeMotionValuesFromProps(r, {}, this); for (const w in p) { const A = p[w]; @@ -35414,10 +35415,10 @@ class Nre { } } mount(e) { - this.current = e, s5.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((r, n) => this.bindToMotionValue(n, r)), v9.current || Tre(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : lv.current, process.env.NODE_ENV !== "production" && vp(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext); + this.current = e, o5.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((r, n) => this.bindToMotionValue(n, r)), b9.current || Tre(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : lv.current, process.env.NODE_ENV !== "production" && vp(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext); } unmount() { - s5.delete(this.current), this.projection && this.projection.unmount(), wa(this.notifyUpdate), wa(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this); + o5.delete(this.current), this.projection && this.projection.unmount(), wa(this.notifyUpdate), wa(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this); for (const e in this.events) this.events[e].clear(); for (const e in this.features) { @@ -35475,8 +35476,8 @@ class Nre { */ update(e, r) { (e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = r; - for (let n = 0; n < o5.length; n++) { - const i = o5[n]; + for (let n = 0; n < a5.length; n++) { + const i = a5[n]; this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]); const s = "on" + i, o = e[s]; o && (this.propEventSubscriptions[i] = this.on(i, o)); @@ -35547,7 +35548,7 @@ class Nre { readValue(e, r) { var n; let i = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : (n = this.getBaseTargetFromProps(this.props, e)) !== null && n !== void 0 ? n : this.readValueFromInstance(this.current, e, this.options); - return i != null && (typeof i == "string" && (i7(i) || n7(i)) ? i = parseFloat(i) : !Ore(i) && _a.test(r) && (i = v7(e, r)), this.setBaseTarget(e, Xn(i) ? i.get() : i)), Xn(i) ? i.get() : i; + return i != null && (typeof i == "string" && (s7(i) || i7(i)) ? i = parseFloat(i) : !Ore(i) && _a.test(r) && (i = b7(e, r)), this.setBaseTarget(e, Xn(i) ? i.get() : i)), Xn(i) ? i.get() : i; } /** * Set the base target to later animate back to. This is currently @@ -35565,7 +35566,7 @@ class Nre { const { initial: n } = this.props; let i; if (typeof n == "string" || typeof n == "object") { - const o = Ib(this.props, n, (r = this.presenceContext) === null || r === void 0 ? void 0 : r.custom); + const o = Cb(this.props, n, (r = this.presenceContext) === null || r === void 0 ? void 0 : r.custom); o && (i = o[e]); } if (n && i !== void 0) @@ -35574,15 +35575,15 @@ class Nre { return s !== void 0 && !Xn(s) ? s : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e]; } on(e, r) { - return this.events[e] || (this.events[e] = new Gb()), this.events[e].add(r); + return this.events[e] || (this.events[e] = new Yb()), this.events[e].add(r); } notify(e, ...r) { this.events[e] && this.events[e].notify(...r); } } -class b9 extends Nre { +class y9 extends Nre { constructor() { - super(...arguments), this.KeyframeResolver = b7; + super(...arguments), this.KeyframeResolver = y7; } sortInstanceNodePosition(e, r) { return e.compareDocumentPosition(r) & 2 ? 1 : -1; @@ -35597,27 +35598,27 @@ class b9 extends Nre { function Lre(t) { return window.getComputedStyle(t); } -class kre extends b9 { +class kre extends y9 { constructor() { - super(...arguments), this.type = "html", this.renderInstance = a9; + super(...arguments), this.type = "html", this.renderInstance = c9; } readValueFromInstance(e, r) { if (Ac.has(r)) { - const n = Fb(r); + const n = jb(r); return n && n.default || 0; } else { - const n = Lre(e), i = (o7(r) ? n.getPropertyValue(r) : n[r]) || 0; + const n = Lre(e), i = (a7(r) ? n.getPropertyValue(r) : n[r]) || 0; return typeof i == "string" ? i.trim() : i; } } measureInstanceViewportBox(e, { transformPagePoint: r }) { - return W7(e, r); + return H7(e, r); } build(e, r, n) { - iy(e, r, n.transformTemplate); + sy(e, r, n.transformTemplate); } scrapeMotionValuesFromProps(e, r, n) { - return ty(e, r, n); + return ry(e, r, n); } handleChildMotionValue() { this.childSubscription && (this.childSubscription(), delete this.childSubscription); @@ -35627,7 +35628,7 @@ class kre extends b9 { })); } } -class $re extends b9 { +class $re extends y9 { constructor() { super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = ln; } @@ -35636,26 +35637,26 @@ class $re extends b9 { } readValueFromInstance(e, r) { if (Ac.has(r)) { - const n = Fb(r); + const n = jb(r); return n && n.default || 0; } - return r = c9.has(r) ? r : Yb(r), e.getAttribute(r); + return r = u9.has(r) ? r : Jb(r), e.getAttribute(r); } scrapeMotionValuesFromProps(e, r, n) { - return l9(e, r, n); + return h9(e, r, n); } build(e, r, n) { - sy(e, r, this.isSVGTag, n.transformTemplate); + oy(e, r, this.isSVGTag, n.transformTemplate); } renderInstance(e, r, n, i) { - u9(e, r, n, i); + f9(e, r, n, i); } mount(e) { - this.isSVGTag = oy(e.tagName), super.mount(e); + this.isSVGTag = ay(e.tagName), super.mount(e); } } -const Bre = (t, e) => ey(t) ? new $re(e) : new kre(e, { - allowProjection: t !== w5 +const Bre = (t, e) => ty(t) ? new $re(e) : new kre(e, { + allowProjection: t !== x5 }), Fre = /* @__PURE__ */ Cre({ ...Iee, ...Jte, @@ -35681,13 +35682,13 @@ class Ure extends Gt.Component { } } function qre({ children: t, isPresent: e }) { - const r = vv(), n = Zn(null), i = Zn({ + const r = bv(), n = Zn(null), i = Zn({ width: 0, height: 0, top: 0, left: 0 - }), { nonce: s } = Tn(Zb); - return y5(() => { + }), { nonce: s } = Tn(Qb); + return w5(() => { const { width: o, height: a, top: u, left: l } = i.current; if (e || !n.current || !o || !a) return; @@ -35707,13 +35708,13 @@ function qre({ children: t, isPresent: e }) { }, [e]), pe.jsx(Ure, { isPresent: e, childRef: n, sizeRef: i, children: Gt.cloneElement(t, { ref: n }) }); } const zre = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: i, presenceAffectsLayout: s, mode: o }) => { - const a = ry(Wre), u = vv(), l = bv((p) => { + const a = ny(Wre), u = bv(), l = yv((p) => { a.set(p, !0); for (const w of a.values()) if (!w) return; n && n(); - }, [a, n]), d = wi( + }, [a, n]), d = ci( () => ({ id: u, initial: e, @@ -35729,7 +35730,7 @@ const zre = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: */ s ? [Math.random(), l] : [r, l] ); - return wi(() => { + return ci(() => { a.forEach((p, w) => a.set(w, !1)); }, [r]), Gt.useEffect(() => { !r && !a.size && n && n(); @@ -35739,7 +35740,7 @@ function Wre() { return /* @__PURE__ */ new Map(); } const bd = (t) => t.key || ""; -function a5(t) { +function c5(t) { const e = []; return BR.forEach(t, (r) => { FR(r) && e.push(r); @@ -35747,28 +35748,28 @@ function a5(t) { } const Hre = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExitComplete: i, presenceAffectsLayout: s = !0, mode: o = "sync" }) => { Uo(!e, "Replace exitBeforeEnter with mode='wait'"); - const a = wi(() => a5(t), [t]), u = a.map(bd), l = Zn(!0), d = Zn(a), p = ry(() => /* @__PURE__ */ new Map()), [w, A] = Yt(a), [M, N] = Yt(a); - n9(() => { + const a = ci(() => c5(t), [t]), u = a.map(bd), l = Zn(!0), d = Zn(a), p = ny(() => /* @__PURE__ */ new Map()), [w, A] = Yt(a), [M, N] = Yt(a); + i9(() => { l.current = !1, d.current = a; - for (let $ = 0; $ < M.length; $++) { - const H = bd(M[$]); + for (let B = 0; B < M.length; B++) { + const H = bd(M[B]); u.includes(H) ? p.delete(H) : p.get(H) !== !0 && p.set(H, !1); } }, [M, u.length, u.join("-")]); const L = []; if (a !== w) { - let $ = [...a]; + let B = [...a]; for (let H = 0; H < M.length; H++) { - const W = M[H], V = bd(W); - u.includes(V) || ($.splice(H, 0, W), L.push(W)); + const U = M[H], V = bd(U); + u.includes(V) || (B.splice(H, 0, U), L.push(U)); } - o === "wait" && L.length && ($ = L), N(a5($)), A(a); + o === "wait" && L.length && (B = L), N(c5(B)), A(a); return; } process.env.NODE_ENV !== "production" && o === "wait" && M.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`); - const { forceRender: B } = Tn(Jb); - return pe.jsx(pe.Fragment, { children: M.map(($) => { - const H = bd($), W = a === M || u.includes(H), V = () => { + const { forceRender: $ } = Tn(Xb); + return pe.jsx(pe.Fragment, { children: M.map((B) => { + const H = bd(B), U = a === M || u.includes(H), V = () => { if (p.has(H)) p.set(H, !0); else @@ -35776,9 +35777,9 @@ const Hre = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onEx let te = !0; p.forEach((R) => { R || (te = !1); - }), te && (B == null || B(), N(d.current), i && i()); + }), te && ($ == null || $(), N(d.current), i && i()); }; - return pe.jsx(zre, { isPresent: W, initial: !l.current || n ? void 0 : !1, custom: W ? void 0 : r, presenceAffectsLayout: s, mode: o, onExitComplete: W ? void 0 : V, children: $ }, H); + return pe.jsx(zre, { isPresent: U, initial: !l.current || n ? void 0 : !1, custom: U ? void 0 : r, presenceAffectsLayout: s, mode: o, onExitComplete: U ? void 0 : V, children: B }, H); }) }); }, Ms = (t) => /* @__PURE__ */ pe.jsx(Hre, { children: /* @__PURE__ */ pe.jsx( jre.div, @@ -35791,7 +35792,7 @@ const Hre = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onEx children: t.children } ) }); -function ay(t) { +function cy(t) { const { icon: e, title: r, extra: n, onClick: i } = t; function s() { i && i(); @@ -35821,10 +35822,10 @@ function Kre(t) { "Installed" ] }) : null; } -function y9(t) { +function hv(t) { var o, a; - const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: (o = e.config) == null ? void 0 : o.image }), i = ((a = e.config) == null ? void 0 : a.name) || "", s = wi(() => Kre(e), [e]); - return /* @__PURE__ */ pe.jsx(ay, { icon: n, title: i, extra: s, onClick: () => r(e) }); + const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: (o = e.config) == null ? void 0 : o.image }), i = ((a = e.config) == null ? void 0 : a.name) || "", s = ci(() => Kre(e), [e]); + return /* @__PURE__ */ pe.jsx(cy, { icon: n, title: i, extra: s, onClick: () => r(e) }); } function w9(t) { var e, r, n = ""; @@ -35839,14 +35840,14 @@ function Vre() { for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++) (t = arguments[r]) && (e = w9(t)) && (n && (n += " "), n += e); return n; } -const Gre = Vre, cy = "-", Yre = (t) => { +const Gre = Vre, uy = "-", Yre = (t) => { const e = Xre(t), { conflictingClassGroups: r, conflictingClassGroupModifiers: n } = t; return { getClassGroupId: (o) => { - const a = o.split(cy); + const a = o.split(uy); return a[0] === "" && a.length !== 1 && a.shift(), x9(a, e) || Jre(o); }, getConflictingClassGroupIds: (o, a) => { @@ -35863,13 +35864,13 @@ const Gre = Vre, cy = "-", Yre = (t) => { return i; if (e.validators.length === 0) return; - const s = t.join(cy); + const s = t.join(uy); return (o = e.validators.find(({ validator: a }) => a(s))) == null ? void 0 : o.classGroupId; -}, c5 = /^\[(.+)\]$/, Jre = (t) => { - if (c5.test(t)) { - const e = c5.exec(t)[1], r = e == null ? void 0 : e.substring(0, e.indexOf(":")); +}, u5 = /^\[(.+)\]$/, Jre = (t) => { + if (u5.test(t)) { + const e = u5.exec(t)[1], r = e == null ? void 0 : e.substring(0, e.indexOf(":")); if (r) return "arbitrary.." + r; } @@ -35882,18 +35883,18 @@ const Gre = Vre, cy = "-", Yre = (t) => { validators: [] }; return Qre(Object.entries(t.classGroups), r).forEach(([s, o]) => { - hv(o, n, s, e); + dv(o, n, s, e); }), n; -}, hv = (t, e, r, n) => { +}, dv = (t, e, r, n) => { t.forEach((i) => { if (typeof i == "string") { - const s = i === "" ? e : u5(e, i); + const s = i === "" ? e : f5(e, i); s.classGroupId = r; return; } if (typeof i == "function") { if (Zre(i)) { - hv(i(n), e, r, n); + dv(i(n), e, r, n); return; } e.validators.push({ @@ -35903,12 +35904,12 @@ const Gre = Vre, cy = "-", Yre = (t) => { return; } Object.entries(i).forEach(([s, o]) => { - hv(o, u5(e, s), r, n); + dv(o, f5(e, s), r, n); }); }); -}, u5 = (t, e) => { +}, f5 = (t, e) => { let r = t; - return e.split(cy).forEach((n) => { + return e.split(uy).forEach((n) => { r.nextPart.has(n) || r.nextPart.set(n, { nextPart: /* @__PURE__ */ new Map(), validators: [] @@ -35949,18 +35950,18 @@ const Gre = Vre, cy = "-", Yre = (t) => { const u = []; let l = 0, d = 0, p; for (let L = 0; L < a.length; L++) { - let B = a[L]; + let $ = a[L]; if (l === 0) { - if (B === i && (n || a.slice(L, L + s) === e)) { + if ($ === i && (n || a.slice(L, L + s) === e)) { u.push(a.slice(d, L)), d = L + s; continue; } - if (B === "/") { + if ($ === "/") { p = L; continue; } } - B === "[" ? l++ : B === "]" && l--; + $ === "[" ? l++ : $ === "]" && l--; } const w = u.length === 0 ? a : a.substring(d), A = w.startsWith(_9), M = A ? w.substring(1) : w, N = p && p > d ? p - d : void 0; return { @@ -36012,14 +36013,14 @@ const Gre = Vre, cy = "-", Yre = (t) => { } M = !1; } - const L = rne(d).join(":"), B = p ? L + _9 : L, $ = B + N; - if (s.includes($)) + const L = rne(d).join(":"), $ = p ? L + _9 : L, B = $ + N; + if (s.includes(B)) continue; - s.push($); + s.push(B); const H = i(N, M); - for (let W = 0; W < H.length; ++W) { - const V = H[W]; - s.push(B + V); + for (let U = 0; U < H.length; ++U) { + const V = H[U]; + s.push($ + V); } a = l + (a.length > 0 ? " " + a : a); } @@ -36068,7 +36069,7 @@ const Gr = (t) => { // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough. lne.test(t) && !hne.test(t) ), A9 = () => !1, Ene = (t) => dne.test(t), Sne = (t) => pne.test(t), Ane = () => { - const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), u = Gr("contrast"), l = Gr("grayscale"), d = Gr("hueRotate"), p = Gr("invert"), w = Gr("gap"), A = Gr("gradientColorStops"), M = Gr("gradientColorStopPositions"), N = Gr("inset"), L = Gr("margin"), B = Gr("opacity"), $ = Gr("padding"), H = Gr("saturate"), W = Gr("scale"), V = Gr("sepia"), te = Gr("skew"), R = Gr("space"), K = Gr("translate"), ge = () => ["auto", "contain", "none"], Ee = () => ["auto", "hidden", "clip", "visible", "scroll"], Y = () => ["auto", ur, e], S = () => [ur, e], m = () => ["", bo, na], f = () => ["auto", mu, ur], g = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], b = () => ["solid", "dashed", "dotted", "double", "none"], x = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], _ = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], E = () => ["", "0", ur], v = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], P = () => [mu, ur]; + const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), u = Gr("contrast"), l = Gr("grayscale"), d = Gr("hueRotate"), p = Gr("invert"), w = Gr("gap"), A = Gr("gradientColorStops"), M = Gr("gradientColorStopPositions"), N = Gr("inset"), L = Gr("margin"), $ = Gr("opacity"), B = Gr("padding"), H = Gr("saturate"), U = Gr("scale"), V = Gr("sepia"), te = Gr("skew"), R = Gr("space"), K = Gr("translate"), ge = () => ["auto", "contain", "none"], Ee = () => ["auto", "hidden", "clip", "visible", "scroll"], Y = () => ["auto", ur, e], S = () => [ur, e], m = () => ["", bo, na], f = () => ["auto", mu, ur], g = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], b = () => ["solid", "dashed", "dotted", "double", "none"], x = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], _ = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], E = () => ["", "0", ur], v = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], P = () => [mu, ur]; return { cacheSize: 500, separator: ":", @@ -36536,63 +36537,63 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/padding */ p: [{ - p: [$] + p: [B] }], /** * Padding X * @see https://tailwindcss.com/docs/padding */ px: [{ - px: [$] + px: [B] }], /** * Padding Y * @see https://tailwindcss.com/docs/padding */ py: [{ - py: [$] + py: [B] }], /** * Padding Start * @see https://tailwindcss.com/docs/padding */ ps: [{ - ps: [$] + ps: [B] }], /** * Padding End * @see https://tailwindcss.com/docs/padding */ pe: [{ - pe: [$] + pe: [B] }], /** * Padding Top * @see https://tailwindcss.com/docs/padding */ pt: [{ - pt: [$] + pt: [B] }], /** * Padding Right * @see https://tailwindcss.com/docs/padding */ pr: [{ - pr: [$] + pr: [B] }], /** * Padding Bottom * @see https://tailwindcss.com/docs/padding */ pb: [{ - pb: [$] + pb: [B] }], /** * Padding Left * @see https://tailwindcss.com/docs/padding */ pl: [{ - pl: [$] + pl: [B] }], /** * Margin @@ -36850,7 +36851,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/placeholder-opacity */ "placeholder-opacity": [{ - "placeholder-opacity": [B] + "placeholder-opacity": [$] }], /** * Text Alignment @@ -36871,7 +36872,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/text-opacity */ "text-opacity": [{ - "text-opacity": [B] + "text-opacity": [$] }], /** * Text Decoration @@ -36986,7 +36987,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/background-opacity */ "bg-opacity": [{ - "bg-opacity": [B] + "bg-opacity": [$] }], /** * Background Origin @@ -37250,7 +37251,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/border-opacity */ "border-opacity": [{ - "border-opacity": [B] + "border-opacity": [$] }], /** * Border Style @@ -37288,7 +37289,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/divide-opacity */ "divide-opacity": [{ - "divide-opacity": [B] + "divide-opacity": [$] }], /** * Divide Style @@ -37419,7 +37420,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/ring-opacity */ "ring-opacity": [{ - "ring-opacity": [B] + "ring-opacity": [$] }], /** * Ring Offset Width @@ -37455,7 +37456,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/opacity */ opacity: [{ - opacity: [B] + opacity: [$] }], /** * Mix Blend Mode @@ -37598,7 +37599,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/backdrop-opacity */ "backdrop-opacity": [{ - "backdrop-opacity": [B] + "backdrop-opacity": [$] }], /** * Backdrop Saturate @@ -37706,21 +37707,21 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/scale */ scale: [{ - scale: [W] + scale: [U] }], /** * Scale X * @see https://tailwindcss.com/docs/scale */ "scale-x": [{ - "scale-x": [W] + "scale-x": [U] }], /** * Scale Y * @see https://tailwindcss.com/docs/scale */ "scale-y": [{ - "scale-y": [W] + "scale-y": [U] }], /** * Rotate @@ -38116,56 +38117,69 @@ function Ine(t) { } return /* @__PURE__ */ pe.jsx(P9, { className: "xc-opacity-20", children: /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-cursor-pointer", onClick: r, children: [ /* @__PURE__ */ pe.jsx("span", { className: "xc-text-sm", children: "View more wallets" }), - /* @__PURE__ */ pe.jsx(WS, { size: 16 }) + /* @__PURE__ */ pe.jsx(HS, { size: 16 }) ] }) }); } function M9(t) { - const [e, r] = Yt(""), { featuredWallets: n, initialized: i } = mp(), { onEmailConfirm: s, onSelectWallet: o, onSelectMoreWallets: a, onSelectTonConnect: u, config: l } = t, d = wi(() => { - const N = /[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu, L = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; - return !N.test(e) && L.test(e); + const [e, r] = Yt(""), { featuredWallets: n, initialized: i } = mp(), { onEmailConfirm: s, onSelectWallet: o, onSelectMoreWallets: a, onSelectTonConnect: u, config: l } = t, d = ci(() => n == null ? void 0 : n.find((L) => { + var $; + return (($ = L.config) == null ? void 0 : $.rdns) === "binance"; + }), [n]), p = ci(() => { + const L = /[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu, $ = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; + return !L.test(e) && $.test(e); }, [e]); - function p(N) { - o(N); + function w(L) { + o(L); } - function w(N) { - r(N.target.value); + function A(L) { + r(L.target.value); } - async function A() { + async function M() { s(e); } - function M(N) { - N.key === "Enter" && d && A(); + function N(L) { + L.key === "Enter" && p && M(); } return /* @__PURE__ */ pe.jsx(Ms, { children: i && /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ t.header || /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6 xc-text-xl xc-font-bold", children: "Log in or sign up" }), - /* @__PURE__ */ pe.jsxs("div", { children: [ - /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: [ - l.showFeaturedWallets && n && n.map((N) => /* @__PURE__ */ pe.jsx( - y9, - { - wallet: N, - onClick: p - }, - `feature-${N.key}` - )), - l.showTonConnect && /* @__PURE__ */ pe.jsx( - ay, - { - icon: /* @__PURE__ */ pe.jsx("img", { className: "xc-h-5 xc-w-5", src: Mne }), - title: "TON Connect", - onClick: u - } - ) + d && /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: /* @__PURE__ */ pe.jsx( + hv, + { + wallet: d, + onClick: w + }, + `feature-${d.key}` + ) }), + !d && /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ + /* @__PURE__ */ pe.jsxs("div", { children: [ + /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: [ + l.showFeaturedWallets && n && n.map((L) => /* @__PURE__ */ pe.jsx( + hv, + { + wallet: L, + onClick: w + }, + `feature-${L.key}` + )), + l.showTonConnect && /* @__PURE__ */ pe.jsx( + cy, + { + icon: /* @__PURE__ */ pe.jsx("img", { className: "xc-h-5 xc-w-5", src: Mne }), + title: "TON Connect", + onClick: u + } + ) + ] }), + l.showMoreWallets && /* @__PURE__ */ pe.jsx(Ine, { onClick: a }) ] }), - l.showMoreWallets && /* @__PURE__ */ pe.jsx(Ine, { onClick: a }) - ] }), - l.showEmailSignIn && (l.showFeaturedWallets || l.showTonConnect) && /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4 xc-mt-4", children: /* @__PURE__ */ pe.jsxs(P9, { className: "xc-opacity-20", children: [ - " ", - /* @__PURE__ */ pe.jsx("span", { className: "xc-text-sm xc-opacity-20", children: "OR" }) - ] }) }), - l.showEmailSignIn && /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-4", children: [ - /* @__PURE__ */ pe.jsx("input", { className: "xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3", placeholder: "Enter your email", type: "email", onChange: w, onKeyDown: M }), - /* @__PURE__ */ pe.jsx("button", { disabled: !d, className: "xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all", onClick: A, children: "Continue" }) + l.showEmailSignIn && (l.showFeaturedWallets || l.showTonConnect) && /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4 xc-mt-4", children: /* @__PURE__ */ pe.jsxs(P9, { className: "xc-opacity-20", children: [ + " ", + /* @__PURE__ */ pe.jsx("span", { className: "xc-text-sm xc-opacity-20", children: "OR" }) + ] }) }), + l.showEmailSignIn && /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-4", children: [ + /* @__PURE__ */ pe.jsx("input", { className: "xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3", placeholder: "Enter your email", type: "email", onChange: A, onKeyDown: N }), + /* @__PURE__ */ pe.jsx("button", { disabled: !p, className: "xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all", onClick: M, children: "Continue" }) + ] }) ] }) ] }) }); } @@ -38183,7 +38197,7 @@ const I9 = Sa({ inviterCode: "", role: "C" }); -function uy() { +function fy() { return Tn(I9); } function Cne(t) { @@ -38204,9 +38218,9 @@ function Cne(t) { } ); } -var Tne = Object.defineProperty, Rne = Object.defineProperties, Dne = Object.getOwnPropertyDescriptors, S0 = Object.getOwnPropertySymbols, C9 = Object.prototype.hasOwnProperty, T9 = Object.prototype.propertyIsEnumerable, f5 = (t, e, r) => e in t ? Tne(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, One = (t, e) => { - for (var r in e || (e = {})) C9.call(e, r) && f5(t, r, e[r]); - if (S0) for (var r of S0(e)) T9.call(e, r) && f5(t, r, e[r]); +var Tne = Object.defineProperty, Rne = Object.defineProperties, Dne = Object.getOwnPropertyDescriptors, S0 = Object.getOwnPropertySymbols, C9 = Object.prototype.hasOwnProperty, T9 = Object.prototype.propertyIsEnumerable, l5 = (t, e, r) => e in t ? Tne(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, One = (t, e) => { + for (var r in e || (e = {})) C9.call(e, r) && l5(t, r, e[r]); + if (S0) for (var r of S0(e)) T9.call(e, r) && l5(t, r, e[r]); return t; }, Nne = (t, e) => Rne(t, Dne(e)), Lne = (t, e) => { var r = {}; @@ -38229,8 +38243,8 @@ function Une({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isF let [i, s] = Gt.useState(!1), [o, a] = Gt.useState(!1), [u, l] = Gt.useState(!1), d = Gt.useMemo(() => r === "none" ? !1 : (r === "increase-width" || r === "experimental-no-flickering") && i && o, [i, o, r]), p = Gt.useCallback(() => { let w = t.current, A = e.current; if (!w || !A || u || r === "none") return; - let M = w, N = M.getBoundingClientRect().left + M.offsetWidth, L = M.getBoundingClientRect().top + M.offsetHeight / 2, B = N - Bne, $ = L; - document.querySelectorAll(jne).length === 0 && document.elementFromPoint(B, $) === w || (s(!0), l(!0)); + let M = w, N = M.getBoundingClientRect().left + M.offsetWidth, L = M.getBoundingClientRect().top + M.offsetHeight / 2, $ = N - Bne, B = L; + document.querySelectorAll(jne).length === 0 && document.elementFromPoint($, B) === w || (s(!0), l(!0)); }, [t, e, u, r]); return Gt.useEffect(() => { let w = t.current; @@ -38256,10 +38270,10 @@ function Une({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isF }, [e, n, r, p]), { hasPWMBadge: i, willPushPWMBadge: d, PWM_BADGE_SPACE_WIDTH: Fne }; } var D9 = Gt.createContext({}), O9 = Gt.forwardRef((t, e) => { - var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: u, inputMode: l = "numeric", onComplete: d, pushPasswordManagerStrategy: p = "increase-width", pasteTransformer: w, containerClassName: A, noScriptCSSFallback: M = qne, render: N, children: L } = r, B = Lne(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), $, H, W, V, te; - let [R, K] = Gt.useState(typeof B.defaultValue == "string" ? B.defaultValue : ""), ge = n ?? R, Ee = $ne(ge), Y = Gt.useCallback((ie) => { + var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: u, inputMode: l = "numeric", onComplete: d, pushPasswordManagerStrategy: p = "increase-width", pasteTransformer: w, containerClassName: A, noScriptCSSFallback: M = qne, render: N, children: L } = r, $ = Lne(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), B, H, U, V, te; + let [R, K] = Gt.useState(typeof $.defaultValue == "string" ? $.defaultValue : ""), ge = n ?? R, Ee = $ne(ge), Y = Gt.useCallback((ie) => { i == null || i(ie), K(ie); - }, [i]), S = Gt.useMemo(() => a ? typeof a == "string" ? new RegExp(a) : a : null, [a]), m = Gt.useRef(null), f = Gt.useRef(null), g = Gt.useRef({ value: ge, onChange: Y, isIOS: typeof window < "u" && ((H = ($ = window == null ? void 0 : window.CSS) == null ? void 0 : $.supports) == null ? void 0 : H.call($, "-webkit-touch-callout", "none")) }), b = Gt.useRef({ prev: [(W = m.current) == null ? void 0 : W.selectionStart, (V = m.current) == null ? void 0 : V.selectionEnd, (te = m.current) == null ? void 0 : te.selectionDirection] }); + }, [i]), S = Gt.useMemo(() => a ? typeof a == "string" ? new RegExp(a) : a : null, [a]), m = Gt.useRef(null), f = Gt.useRef(null), g = Gt.useRef({ value: ge, onChange: Y, isIOS: typeof window < "u" && ((H = (B = window == null ? void 0 : window.CSS) == null ? void 0 : B.supports) == null ? void 0 : H.call(B, "-webkit-touch-callout", "none")) }), b = Gt.useRef({ prev: [(U = m.current) == null ? void 0 : U.selectionStart, (V = m.current) == null ? void 0 : V.selectionEnd, (te = m.current) == null ? void 0 : te.selectionDirection] }); Gt.useImperativeHandle(e, () => m.current, []), Gt.useEffect(() => { let ie = m.current, ue = f.current; if (!ie || !ue) return; @@ -38343,26 +38357,26 @@ var D9 = Gt.createContext({}), O9 = Gt.forwardRef((t, e) => { Pe.value = Ne, Y(Ne); let Ke = Math.min(Ne.length, s - 1), Le = Ne.length; Pe.setSelectionRange(Ke, Le), I(Ke), ce(Le); - }, [s, Y, S, ge]), Q = Gt.useMemo(() => ({ position: "relative", cursor: B.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [B.disabled]), T = Gt.useMemo(() => ({ position: "absolute", inset: 0, width: D.willPushPWMBadge ? `calc(100% + ${D.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: D.willPushPWMBadge ? `inset(0 ${D.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: o, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [D.PWM_BADGE_SPACE_WIDTH, D.willPushPWMBadge, o]), X = Gt.useMemo(() => Gt.createElement("input", Nne(One({ autoComplete: B.autoComplete || "one-time-code" }, B), { "data-input-otp": !0, "data-input-otp-placeholder-shown": ge.length === 0 || void 0, "data-input-otp-mss": P, "data-input-otp-mse": F, inputMode: l, pattern: S == null ? void 0 : S.source, "aria-placeholder": u, style: T, maxLength: s, value: ge, ref: m, onPaste: (ie) => { + }, [s, Y, S, ge]), Q = Gt.useMemo(() => ({ position: "relative", cursor: $.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [$.disabled]), T = Gt.useMemo(() => ({ position: "absolute", inset: 0, width: D.willPushPWMBadge ? `calc(100% + ${D.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: D.willPushPWMBadge ? `inset(0 ${D.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: o, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [D.PWM_BADGE_SPACE_WIDTH, D.willPushPWMBadge, o]), X = Gt.useMemo(() => Gt.createElement("input", Nne(One({ autoComplete: $.autoComplete || "one-time-code" }, $), { "data-input-otp": !0, "data-input-otp-placeholder-shown": ge.length === 0 || void 0, "data-input-otp-mss": P, "data-input-otp-mse": F, inputMode: l, pattern: S == null ? void 0 : S.source, "aria-placeholder": u, style: T, maxLength: s, value: ge, ref: m, onPaste: (ie) => { var ue; - J(ie), (ue = B.onPaste) == null || ue.call(B, ie); + J(ie), (ue = $.onPaste) == null || ue.call($, ie); }, onChange: oe, onMouseOver: (ie) => { var ue; - _(!0), (ue = B.onMouseOver) == null || ue.call(B, ie); + _(!0), (ue = $.onMouseOver) == null || ue.call($, ie); }, onMouseLeave: (ie) => { var ue; - _(!1), (ue = B.onMouseLeave) == null || ue.call(B, ie); + _(!1), (ue = $.onMouseLeave) == null || ue.call($, ie); }, onFocus: (ie) => { var ue; - Z(), (ue = B.onFocus) == null || ue.call(B, ie); + Z(), (ue = $.onFocus) == null || ue.call($, ie); }, onBlur: (ie) => { var ue; - v(!1), (ue = B.onBlur) == null || ue.call(B, ie); - } })), [oe, Z, J, l, T, s, F, P, B, S == null ? void 0 : S.source, ge]), re = Gt.useMemo(() => ({ slots: Array.from({ length: s }).map((ie, ue) => { + v(!1), (ue = $.onBlur) == null || ue.call($, ie); + } })), [oe, Z, J, l, T, s, F, P, $, S == null ? void 0 : S.source, ge]), re = Gt.useMemo(() => ({ slots: Array.from({ length: s }).map((ie, ue) => { var ve; let Pe = E && P !== null && F !== null && (P === F && ue === P || ue >= P && ue < F), De = ge[ue] !== void 0 ? ge[ue] : null, Ce = ge[0] !== void 0 ? null : (ve = u == null ? void 0 : u[ue]) != null ? ve : null; return { char: De, placeholderChar: Ce, isActive: Pe, hasFakeCaret: Pe && De === null }; - }), isFocused: E, isHovering: !B.disabled && x }), [E, x, s, F, P, B.disabled, ge]), de = Gt.useMemo(() => N ? N(re) : Gt.createElement(D9.Provider, { value: re }, L), [L, re, N]); + }), isFocused: E, isHovering: !$.disabled && x }), [E, x, s, F, P, $.disabled, ge]), de = Gt.useMemo(() => N ? N(re) : Gt.createElement(D9.Provider, { value: re }, L), [L, re, N]); return Gt.createElement(Gt.Fragment, null, M !== null && Gt.createElement("noscript", null, Gt.createElement("style", null, M)), Gt.createElement("div", { ref: f, "data-input-otp-container": !0, style: Q, className: A }, de, Gt.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, X))); }); O9.displayName = "Input"; @@ -38481,7 +38495,7 @@ function k9(t) { ] }); } function $9(t) { - const { email: e } = t, [r, n] = Yt(!1), [i, s] = Yt(""), o = wi(() => `xn-btn-${(/* @__PURE__ */ new Date()).getTime()}`, [e]); + const { email: e } = t, [r, n] = Yt(!1), [i, s] = Yt(""), o = ci(() => `xn-btn-${(/* @__PURE__ */ new Date()).getTime()}`, [e]); async function a(w, A) { n(!0), s(""), await Ta.getEmailCode({ account_type: "email", email: w }, A), n(!1); } @@ -38529,7 +38543,7 @@ function $9(t) { ] }); } function Wne(t) { - const { email: e } = t, r = uy(), [n, i] = Yt("captcha"); + const { email: e } = t, r = fy(), [n, i] = Yt("captcha"); async function s(o, a) { const u = await Ta.emailLogin({ account_type: "email", @@ -38560,7 +38574,7 @@ var B9 = { exports: {} }; var r = { 873: (o, a) => { var u, l, d = function() { var p = function(f, g) { - var b = f, x = B[g], _ = null, E = 0, v = null, P = [], I = {}, F = function(re, de) { + var b = f, x = $[g], _ = null, E = 0, v = null, P = [], I = {}, F = function(re, de) { _ = function(ie) { for (var ue = new Array(ie), ve = 0; ve < ie; ve += 1) { ue[ve] = new Array(ie); @@ -38574,25 +38588,25 @@ var B9 = { exports: {} }; for (var re = 8; re < E - 8; re += 1) _[re][6] == null && (_[re][6] = re % 2 == 0); for (var de = 8; de < E - 8; de += 1) _[6][de] == null && (_[6][de] = de % 2 == 0); }, oe = function() { - for (var re = $.getPatternPosition(b), de = 0; de < re.length; de += 1) for (var ie = 0; ie < re.length; ie += 1) { + for (var re = B.getPatternPosition(b), de = 0; de < re.length; de += 1) for (var ie = 0; ie < re.length; ie += 1) { var ue = re[de], ve = re[ie]; if (_[ue][ve] == null) for (var Pe = -2; Pe <= 2; Pe += 1) for (var De = -2; De <= 2; De += 1) _[ue + Pe][ve + De] = Pe == -2 || Pe == 2 || De == -2 || De == 2 || Pe == 0 && De == 0; } }, Z = function(re) { - for (var de = $.getBCHTypeNumber(b), ie = 0; ie < 18; ie += 1) { + for (var de = B.getBCHTypeNumber(b), ie = 0; ie < 18; ie += 1) { var ue = !re && (de >> ie & 1) == 1; _[Math.floor(ie / 3)][ie % 3 + E - 8 - 3] = ue; } for (ie = 0; ie < 18; ie += 1) ue = !re && (de >> ie & 1) == 1, _[ie % 3 + E - 8 - 3][Math.floor(ie / 3)] = ue; }, J = function(re, de) { - for (var ie = x << 3 | de, ue = $.getBCHTypeInfo(ie), ve = 0; ve < 15; ve += 1) { + for (var ie = x << 3 | de, ue = B.getBCHTypeInfo(ie), ve = 0; ve < 15; ve += 1) { var Pe = !re && (ue >> ve & 1) == 1; ve < 6 ? _[ve][8] = Pe : ve < 8 ? _[ve + 1][8] = Pe : _[E - 15 + ve][8] = Pe; } for (ve = 0; ve < 15; ve += 1) Pe = !re && (ue >> ve & 1) == 1, ve < 8 ? _[8][E - ve - 1] = Pe : ve < 9 ? _[8][15 - ve - 1 + 1] = Pe : _[8][15 - ve - 1] = Pe; _[E - 8][8] = !re; }, Q = function(re, de) { - for (var ie = -1, ue = E - 1, ve = 7, Pe = 0, De = $.getMaskFunction(de), Ce = E - 1; Ce > 0; Ce -= 2) for (Ce == 6 && (Ce -= 1); ; ) { + for (var ie = -1, ue = E - 1, ve = 7, Pe = 0, De = B.getMaskFunction(de), Ce = E - 1; Ce > 0; Ce -= 2) for (Ce == 6 && (Ce -= 1); ; ) { for (var $e = 0; $e < 2; $e += 1) if (_[ue][Ce - $e] == null) { var Me = !1; Pe < re.length && (Me = (re[Pe] >>> ve & 1) == 1), De(ue, Ce - $e) && (Me = !Me), _[ue][Ce - $e] = Me, (ve -= 1) == -1 && (Pe += 1, ve = 7); @@ -38605,7 +38619,7 @@ var B9 = { exports: {} }; }, T = function(re, de, ie) { for (var ue = V.getRSBlocks(re, de), ve = te(), Pe = 0; Pe < ie.length; Pe += 1) { var De = ie[Pe]; - ve.put(De.getMode(), 4), ve.put(De.getLength(), $.getLengthInBits(De.getMode(), re)), De.write(ve); + ve.put(De.getMode(), 4), ve.put(De.getLength(), B.getLengthInBits(De.getMode(), re)), De.write(ve); } var Ce = 0; for (Pe = 0; Pe < ue.length; Pe += 1) Ce += ue[Pe].dataCount; @@ -38618,7 +38632,7 @@ var B9 = { exports: {} }; Ke = Math.max(Ke, Ze), Le = Math.max(Le, at), qe[_e] = new Array(Ze); for (var ke = 0; ke < qe[_e].length; ke += 1) qe[_e][ke] = 255 & $e.getBuffer()[ke + Ne]; Ne += Ze; - var Qe = $.getErrorCorrectPolynomial(at), tt = W(qe[_e], Qe.getLength() - 1).mod(Qe); + var Qe = B.getErrorCorrectPolynomial(at), tt = U(qe[_e], Qe.getLength() - 1).mod(Qe); for (ze[_e] = new Array(Qe.getLength() - 1), ke = 0; ke < ze[_e].length; ke += 1) { var Ye = ke + tt.getLength() - ze[_e].length; ze[_e][ke] = Ye >= 0 ? tt.getAt(Ye) : 0; @@ -38661,7 +38675,7 @@ var B9 = { exports: {} }; for (var re = 1; re < 40; re++) { for (var de = V.getRSBlocks(re, x), ie = te(), ue = 0; ue < P.length; ue++) { var ve = P[ue]; - ie.put(ve.getMode(), 4), ie.put(ve.getLength(), $.getLengthInBits(ve.getMode(), re)), ve.write(ie); + ie.put(ve.getMode(), 4), ie.put(ve.getLength(), B.getLengthInBits(ve.getMode(), re)), ve.write(ie); } var Pe = 0; for (ue = 0; ue < de.length; ue++) Pe += de[ue].dataCount; @@ -38672,7 +38686,7 @@ var B9 = { exports: {} }; F(!1, function() { for (var De = 0, Ce = 0, $e = 0; $e < 8; $e += 1) { F(!0, $e); - var Me = $.getLostPoint(I); + var Me = B.getLostPoint(I); ($e == 0 || De > Me) && (De = Me, Ce = $e); } return Ce; @@ -38787,7 +38801,7 @@ var B9 = { exports: {} }; return E; }; }; - var w, A, M, N, L, B = { L: 1, M: 0, Q: 3, H: 2 }, $ = (w = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], A = 1335, M = 7973, L = function(f) { + var w, A, M, N, L, $ = { L: 1, M: 0, Q: 3, H: 2 }, B = (w = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], A = 1335, M = 7973, L = function(f) { for (var g = 0; f != 0; ) g += 1, f >>>= 1; return g; }, (N = {}).getBCHTypeInfo = function(f) { @@ -38836,7 +38850,7 @@ var B9 = { exports: {} }; throw "bad maskPattern:" + f; } }, N.getErrorCorrectPolynomial = function(f) { - for (var g = W([1], 0), b = 0; b < f; b += 1) g = g.multiply(W([1, H.gexp(b)], 0)); + for (var g = U([1], 0), b = 0; b < f; b += 1) g = g.multiply(U([1, H.gexp(b)], 0)); return g; }, N.getLengthInBits = function(f, g) { if (1 <= g && g < 10) switch (f) { @@ -38904,7 +38918,7 @@ var B9 = { exports: {} }; return f[x]; } }; }(); - function W(f, g) { + function U(f, g) { if (f.length === void 0) throw f.length + "/" + g; var b = function() { for (var _ = 0; _ < f.length && f[_] == 0; ) _ += 1; @@ -38916,12 +38930,12 @@ var B9 = { exports: {} }; return b.length; }, multiply: function(_) { for (var E = new Array(x.getLength() + _.getLength() - 1), v = 0; v < x.getLength(); v += 1) for (var P = 0; P < _.getLength(); P += 1) E[v + P] ^= H.gexp(H.glog(x.getAt(v)) + H.glog(_.getAt(P))); - return W(E, 0); + return U(E, 0); }, mod: function(_) { if (x.getLength() - _.getLength() < 0) return x; for (var E = H.glog(x.getAt(0)) - H.glog(_.getAt(0)), v = new Array(x.getLength()), P = 0; P < x.getLength(); P += 1) v[P] = x.getAt(P); for (P = 0; P < _.getLength(); P += 1) v[P] ^= H.gexp(H.glog(_.getAt(P)) + E); - return W(v, 0).mod(_); + return U(v, 0).mod(_); } }; return x; } @@ -38932,13 +38946,13 @@ var B9 = { exports: {} }; }, b = { getRSBlocks: function(x, _) { var E = function(Z, J) { switch (J) { - case B.L: + case $.L: return f[4 * (Z - 1) + 0]; - case B.M: + case $.M: return f[4 * (Z - 1) + 1]; - case B.Q: + case $.Q: return f[4 * (Z - 1) + 2]; - case B.H: + case $.H: return f[4 * (Z - 1) + 3]; default: return; @@ -39544,9 +39558,9 @@ var B9 = { exports: {} }; } } L.instanceCount = 0; - const B = L, $ = "canvas", H = {}; + const $ = L, B = "canvas", H = {}; for (let S = 0; S <= 40; S++) H[S] = S; - const W = { type: $, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: H[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: !0, hideBackgroundDots: !0, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: !0 }, backgroundOptions: { round: 0, color: "#fff" } }; + const U = { type: B, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: H[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: !0, hideBackgroundDots: !0, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: !0 }, backgroundOptions: { round: 0, color: "#fff" } }; function V(S) { const m = Object.assign({}, S); if (!m.colorStops || !m.colorStops.length) throw "Field 'colorStops' is required in gradient"; @@ -39566,14 +39580,14 @@ var B9 = { exports: {} }; } class Ee { constructor(m) { - m != null && m.jsdom ? this._window = new m.jsdom("", { resources: "usable" }).window : this._window = window, this._options = m ? te(a(W, m)) : W, this.update(); + m != null && m.jsdom ? this._window = new m.jsdom("", { resources: "usable" }).window : this._window = window, this._options = m ? te(a(U, m)) : U, this.update(); } static _clearContainer(m) { m && (m.innerHTML = ""); } _setupSvg() { if (!this._qr) return; - const m = new B(this._options, this._window); + const m = new $(this._options, this._window); this._svg = m.getElement(), this._svgDrawingPromise = m.drawQR(this._qr).then(() => { var f; this._svg && ((f = this._extension) === null || f === void 0 || f.call(this, m.getElement(), this._options)); @@ -39614,12 +39628,12 @@ var B9 = { exports: {} }; default: return "Byte"; } - }(this._options.data)), this._qr.make(), this._options.type === $ ? this._setupCanvas() : this._setupSvg(), this.append(this._container)); + }(this._options.data)), this._qr.make(), this._options.type === B ? this._setupCanvas() : this._setupSvg(), this.append(this._container)); } append(m) { if (m) { if (typeof m.appendChild != "function") throw "Container should be a single DOM node"; - this._options.type === $ ? this._domCanvas && m.appendChild(this._domCanvas) : this._svg && m.appendChild(this._svg), this._container = m; + this._options.type === B ? this._domCanvas && m.appendChild(this._domCanvas) : this._svg && m.appendChild(this._svg), this._container = m; } } applyExtension(m) { @@ -39678,7 +39692,7 @@ class sa extends yt { }); } } -function l5(t) { +function h5(t) { if (/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t) || /%[^0-9a-f]/i.test(t) || /%[0-9a-f](:?[^0-9a-f]|$)/i.test(t)) return !1; const e = Kne(t), r = e[1], n = e[2], i = e[3], s = e[4], o = e[5]; @@ -39730,7 +39744,7 @@ function j9(t) { `Provided value: ${s}` ] }); - if (!l5(d)) + if (!h5(d)) throw new sa({ field: "uri", metaMessages: [ @@ -39759,19 +39773,19 @@ function j9(t) { `Provided value: ${l}` ] }); - const B = t.statement; - if (B != null && B.includes(` + const $ = t.statement; + if ($ != null && $.includes(` `)) throw new sa({ field: "statement", metaMessages: [ "- Statement must not include '\\n'.", "", - `Provided value: ${B}` + `Provided value: ${$}` ] }); } - const w = Sv(t.address), A = l ? `${l}://${r}` : r, M = t.statement ? `${t.statement} + const w = Av(t.address), A = l ? `${l}://${r}` : r, M = t.statement ? `${t.statement} ` : "", N = `${A} wants you to sign in with your Ethereum account: ${w} @@ -39785,23 +39799,23 @@ Issued At: ${i.toISOString()}`; Expiration Time: ${n.toISOString()}`), o && (L += ` Not Before: ${o.toISOString()}`), a && (L += ` Request ID: ${a}`), u) { - let B = ` + let $ = ` Resources:`; - for (const $ of u) { - if (!l5($)) + for (const B of u) { + if (!h5(B)) throw new sa({ field: "resources", metaMessages: [ "- Every resource must be a RFC 3986 URI.", "- See https://www.rfc-editor.org/rfc/rfc3986", "", - `Provided value: ${$}` + `Provided value: ${B}` ] }); - B += ` -- ${$}`; + $ += ` +- ${B}`; } - L += B; + L += $; } return `${N} ${L}`; @@ -39846,7 +39860,7 @@ function eie(t, e) { } function q9(t) { var ge, Ee, Y; - const e = Zn(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Yt(""), [a, u] = Yt(!1), [l, d] = Yt(""), [p, w] = Yt("scan"), A = Zn(), [M, N] = Yt((ge = r.config) == null ? void 0 : ge.image), [L, B] = Yt(!1), { saveLastUsedWallet: $ } = mp(); + const e = Zn(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Yt(""), [a, u] = Yt(!1), [l, d] = Yt(""), [p, w] = Yt("scan"), A = Zn(), [M, N] = Yt((ge = r.config) == null ? void 0 : ge.image), [L, $] = Yt(!1), { saveLastUsedWallet: B } = mp(); async function H(S) { var f, g, b, x; u(!0); @@ -39873,12 +39887,12 @@ function q9(t) { signature: F, address: v, wallet_name: ((b = E.config) == null ? void 0 : b.name) || ((x = S.config) == null ? void 0 : x.name) || "" - }), $(E); + }), B(E); } catch (_) { console.log("err", _), d(_.details || _.message); } } - function W() { + function U() { A.current = new F9({ width: 264, height: 264, @@ -39908,14 +39922,14 @@ function q9(t) { }, [s]), Dn(() => { H(r); }, [r]), Dn(() => { - W(); + U(); }, []); function te() { d(""), V(""), H(r); } function R() { - B(!0), navigator.clipboard.writeText(s), setTimeout(() => { - B(!1); + $(!0), navigator.clipboard.writeText(s), setTimeout(() => { + $(!1); }, 2500); } function K() { @@ -39965,7 +39979,7 @@ function q9(t) { className: "xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black", onClick: K, children: [ - /* @__PURE__ */ pe.jsx(HS, {}), + /* @__PURE__ */ pe.jsx(KS, {}), "Desktop" ] } @@ -40004,12 +40018,12 @@ function z9(t) { const M = await n.connect(); if (!M || M.length === 0) throw new Error("Wallet connect error"); - const N = Sv(M[0]), L = nie(N, w); + const N = Av(M[0]), L = nie(N, w); a("sign"); - const B = await n.signMessage(L, N); - if (!B || B.length === 0) + const $ = await n.signMessage(L, N); + if (!$ || $.length === 0) throw new Error("user sign error"); - a("waiting"), await i(n, { address: N, signature: B, message: L, nonce: w, wallet_name: ((A = n.config) == null ? void 0 : A.name) || "" }), u(n); + a("waiting"), await i(n, { address: N, signature: $, message: L, nonce: w, wallet_name: ((A = n.config) == null ? void 0 : A.name) || "" }), u(n); } catch (M) { console.log(M.details), r(M.details || M.message); } @@ -40050,7 +40064,7 @@ function Yc(t) { children: [ /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-1 xc-h-6 xc-w-6", src: e, alt: "" }), r, - /* @__PURE__ */ pe.jsx(WS, { className: "xc-ml-auto xc-text-gray-400" }) + /* @__PURE__ */ pe.jsx(HS, { className: "xc-ml-auto xc-text-gray-400" }) ] } ); @@ -40130,7 +40144,7 @@ function W9(t) { ] }); } function lie(t) { - const { wallet: e } = t, [r, n] = Yt(e.installed ? "connect" : "qr"), i = uy(); + const { wallet: e } = t, [r, n] = Yt(e.installed ? "connect" : "qr"), i = fy(); async function s(o, a) { var l; const u = await Ta.walletLogin({ @@ -40175,10 +40189,10 @@ function lie(t) { } function hie(t) { const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: e.imageUrl }), i = e.name || ""; - return /* @__PURE__ */ pe.jsx(ay, { icon: n, title: i, onClick: () => r(e) }); + return /* @__PURE__ */ pe.jsx(cy, { icon: n, title: i, onClick: () => r(e) }); } function H9(t) { - const { connector: e } = t, [r, n] = Yt(), [i, s] = Yt([]), o = wi(() => r ? i.filter((d) => d.name.toLowerCase().includes(r.toLowerCase())) : i, [r, i]); + const { connector: e } = t, [r, n] = Yt(), [i, s] = Yt([]), o = ci(() => r ? i.filter((d) => d.name.toLowerCase().includes(r.toLowerCase())) : i, [r, i]); function a(d) { n(d.target.value); } @@ -40195,7 +40209,7 @@ function H9(t) { return /* @__PURE__ */ pe.jsxs(Ms, { children: [ /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ pe.jsx(Pc, { title: "Select wallet", onBack: t.onBack }) }), /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ - /* @__PURE__ */ pe.jsx(KS, { className: "xc-shrink-0 xc-opacity-50" }), + /* @__PURE__ */ pe.jsx(VS, { className: "xc-shrink-0 xc-opacity-50" }), /* @__PURE__ */ pe.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: a }) ] }), /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: o == null ? void 0 : o.map((d) => /* @__PURE__ */ pe.jsx(hie, { wallet: d, onClick: l }, d.name)) }) @@ -40246,213 +40260,213 @@ var V9 = { exports: {} }; (function(t) { (function(e) { var r = function(k) { - var U, z = new Float64Array(16); - if (k) for (U = 0; U < k.length; U++) z[U] = k[U]; - return z; + var q, W = new Float64Array(16); + if (k) for (q = 0; q < k.length; q++) W[q] = k[q]; + return W; }, n = function() { throw new Error("no PRNG"); }, i = new Uint8Array(16), s = new Uint8Array(32); s[0] = 9; var o = r(), a = r([1]), u = r([56129, 1]), l = r([30883, 4953, 19914, 30187, 55467, 16705, 2637, 112, 59544, 30585, 16505, 36039, 65139, 11119, 27886, 20995]), d = r([61785, 9906, 39828, 60374, 45398, 33411, 5274, 224, 53552, 61171, 33010, 6542, 64743, 22239, 55772, 9222]), p = r([54554, 36645, 11616, 51542, 42930, 38181, 51040, 26924, 56412, 64982, 57905, 49316, 21502, 52590, 14035, 8553]), w = r([26200, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214]), A = r([41136, 18958, 6951, 50414, 58488, 44335, 6150, 12099, 55207, 15867, 153, 11085, 57099, 20417, 9344, 11139]); - function M(k, U, z, C) { - k[U] = z >> 24 & 255, k[U + 1] = z >> 16 & 255, k[U + 2] = z >> 8 & 255, k[U + 3] = z & 255, k[U + 4] = C >> 24 & 255, k[U + 5] = C >> 16 & 255, k[U + 6] = C >> 8 & 255, k[U + 7] = C & 255; + function M(k, q, W, C) { + k[q] = W >> 24 & 255, k[q + 1] = W >> 16 & 255, k[q + 2] = W >> 8 & 255, k[q + 3] = W & 255, k[q + 4] = C >> 24 & 255, k[q + 5] = C >> 16 & 255, k[q + 6] = C >> 8 & 255, k[q + 7] = C & 255; } - function N(k, U, z, C, G) { + function N(k, q, W, C, G) { var j, se = 0; - for (j = 0; j < G; j++) se |= k[U + j] ^ z[C + j]; + for (j = 0; j < G; j++) se |= k[q + j] ^ W[C + j]; return (1 & se - 1 >>> 8) - 1; } - function L(k, U, z, C) { - return N(k, U, z, C, 16); + function L(k, q, W, C) { + return N(k, q, W, C, 16); } - function B(k, U, z, C) { - return N(k, U, z, C, 32); + function $(k, q, W, C) { + return N(k, q, W, C, 32); } - function $(k, U, z, C) { - for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = z[0] & 255 | (z[1] & 255) << 8 | (z[2] & 255) << 16 | (z[3] & 255) << 24, se = z[4] & 255 | (z[5] & 255) << 8 | (z[6] & 255) << 16 | (z[7] & 255) << 24, he = z[8] & 255 | (z[9] & 255) << 8 | (z[10] & 255) << 16 | (z[11] & 255) << 24, xe = z[12] & 255 | (z[13] & 255) << 8 | (z[14] & 255) << 16 | (z[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = U[0] & 255 | (U[1] & 255) << 8 | (U[2] & 255) << 16 | (U[3] & 255) << 24, nt = U[4] & 255 | (U[5] & 255) << 8 | (U[6] & 255) << 16 | (U[7] & 255) << 24, je = U[8] & 255 | (U[9] & 255) << 8 | (U[10] & 255) << 16 | (U[11] & 255) << 24, pt = U[12] & 255 | (U[13] & 255) << 8 | (U[14] & 255) << 16 | (U[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = z[16] & 255 | (z[17] & 255) << 8 | (z[18] & 255) << 16 | (z[19] & 255) << 24, St = z[20] & 255 | (z[21] & 255) << 8 | (z[22] & 255) << 16 | (z[23] & 255) << 24, Tt = z[24] & 255 | (z[25] & 255) << 8 | (z[26] & 255) << 16 | (z[27] & 255) << 24, At = z[28] & 255 | (z[29] & 255) << 8 | (z[30] & 255) << 16 | (z[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = he, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, le, rr = 0; rr < 20; rr += 2) + function B(k, q, W, C) { + for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = W[0] & 255 | (W[1] & 255) << 8 | (W[2] & 255) << 16 | (W[3] & 255) << 24, se = W[4] & 255 | (W[5] & 255) << 8 | (W[6] & 255) << 16 | (W[7] & 255) << 24, he = W[8] & 255 | (W[9] & 255) << 8 | (W[10] & 255) << 16 | (W[11] & 255) << 24, xe = W[12] & 255 | (W[13] & 255) << 8 | (W[14] & 255) << 16 | (W[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = q[0] & 255 | (q[1] & 255) << 8 | (q[2] & 255) << 16 | (q[3] & 255) << 24, nt = q[4] & 255 | (q[5] & 255) << 8 | (q[6] & 255) << 16 | (q[7] & 255) << 24, je = q[8] & 255 | (q[9] & 255) << 8 | (q[10] & 255) << 16 | (q[11] & 255) << 24, pt = q[12] & 255 | (q[13] & 255) << 8 | (q[14] & 255) << 16 | (q[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = W[16] & 255 | (W[17] & 255) << 8 | (W[18] & 255) << 16 | (W[19] & 255) << 24, St = W[20] & 255 | (W[21] & 255) << 8 | (W[22] & 255) << 16 | (W[23] & 255) << 24, Tt = W[24] & 255 | (W[25] & 255) << 8 | (W[26] & 255) << 16 | (W[27] & 255) << 24, At = W[28] & 255 | (W[29] & 255) << 8 | (W[30] & 255) << 16 | (W[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = he, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, le, rr = 0; rr < 20; rr += 2) le = ht + Lt | 0, ut ^= le << 7 | le >>> 25, le = ut + ht | 0, Ve ^= le << 9 | le >>> 23, le = Ve + ut | 0, Lt ^= le << 13 | le >>> 19, le = Lt + Ve | 0, ht ^= le << 18 | le >>> 14, le = ot + xt | 0, Fe ^= le << 7 | le >>> 25, le = Fe + ot | 0, zt ^= le << 9 | le >>> 23, le = zt + Fe | 0, xt ^= le << 13 | le >>> 19, le = xt + zt | 0, ot ^= le << 18 | le >>> 14, le = Ue + Se | 0, Zt ^= le << 7 | le >>> 25, le = Zt + Ue | 0, st ^= le << 9 | le >>> 23, le = st + Zt | 0, Se ^= le << 13 | le >>> 19, le = Se + st | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Je | 0, bt ^= le << 7 | le >>> 25, le = bt + Wt | 0, Ae ^= le << 9 | le >>> 23, le = Ae + bt | 0, Je ^= le << 13 | le >>> 19, le = Je + Ae | 0, Wt ^= le << 18 | le >>> 14, le = ht + bt | 0, xt ^= le << 7 | le >>> 25, le = xt + ht | 0, st ^= le << 9 | le >>> 23, le = st + xt | 0, bt ^= le << 13 | le >>> 19, le = bt + st | 0, ht ^= le << 18 | le >>> 14, le = ot + ut | 0, Se ^= le << 7 | le >>> 25, le = Se + ot | 0, Ae ^= le << 9 | le >>> 23, le = Ae + Se | 0, ut ^= le << 13 | le >>> 19, le = ut + Ae | 0, ot ^= le << 18 | le >>> 14, le = Ue + Fe | 0, Je ^= le << 7 | le >>> 25, le = Je + Ue | 0, Ve ^= le << 9 | le >>> 23, le = Ve + Je | 0, Fe ^= le << 13 | le >>> 19, le = Fe + Ve | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Zt | 0, Lt ^= le << 7 | le >>> 25, le = Lt + Wt | 0, zt ^= le << 9 | le >>> 23, le = zt + Lt | 0, Zt ^= le << 13 | le >>> 19, le = Zt + zt | 0, Wt ^= le << 18 | le >>> 14; ht = ht + G | 0, xt = xt + j | 0, st = st + se | 0, bt = bt + he | 0, ut = ut + xe | 0, ot = ot + Te | 0, Se = Se + Re | 0, Ae = Ae + nt | 0, Ve = Ve + je | 0, Fe = Fe + pt | 0, Ue = Ue + it | 0, Je = Je + et | 0, Lt = Lt + St | 0, zt = zt + Tt | 0, Zt = Zt + At | 0, Wt = Wt + _t | 0, k[0] = ht >>> 0 & 255, k[1] = ht >>> 8 & 255, k[2] = ht >>> 16 & 255, k[3] = ht >>> 24 & 255, k[4] = xt >>> 0 & 255, k[5] = xt >>> 8 & 255, k[6] = xt >>> 16 & 255, k[7] = xt >>> 24 & 255, k[8] = st >>> 0 & 255, k[9] = st >>> 8 & 255, k[10] = st >>> 16 & 255, k[11] = st >>> 24 & 255, k[12] = bt >>> 0 & 255, k[13] = bt >>> 8 & 255, k[14] = bt >>> 16 & 255, k[15] = bt >>> 24 & 255, k[16] = ut >>> 0 & 255, k[17] = ut >>> 8 & 255, k[18] = ut >>> 16 & 255, k[19] = ut >>> 24 & 255, k[20] = ot >>> 0 & 255, k[21] = ot >>> 8 & 255, k[22] = ot >>> 16 & 255, k[23] = ot >>> 24 & 255, k[24] = Se >>> 0 & 255, k[25] = Se >>> 8 & 255, k[26] = Se >>> 16 & 255, k[27] = Se >>> 24 & 255, k[28] = Ae >>> 0 & 255, k[29] = Ae >>> 8 & 255, k[30] = Ae >>> 16 & 255, k[31] = Ae >>> 24 & 255, k[32] = Ve >>> 0 & 255, k[33] = Ve >>> 8 & 255, k[34] = Ve >>> 16 & 255, k[35] = Ve >>> 24 & 255, k[36] = Fe >>> 0 & 255, k[37] = Fe >>> 8 & 255, k[38] = Fe >>> 16 & 255, k[39] = Fe >>> 24 & 255, k[40] = Ue >>> 0 & 255, k[41] = Ue >>> 8 & 255, k[42] = Ue >>> 16 & 255, k[43] = Ue >>> 24 & 255, k[44] = Je >>> 0 & 255, k[45] = Je >>> 8 & 255, k[46] = Je >>> 16 & 255, k[47] = Je >>> 24 & 255, k[48] = Lt >>> 0 & 255, k[49] = Lt >>> 8 & 255, k[50] = Lt >>> 16 & 255, k[51] = Lt >>> 24 & 255, k[52] = zt >>> 0 & 255, k[53] = zt >>> 8 & 255, k[54] = zt >>> 16 & 255, k[55] = zt >>> 24 & 255, k[56] = Zt >>> 0 & 255, k[57] = Zt >>> 8 & 255, k[58] = Zt >>> 16 & 255, k[59] = Zt >>> 24 & 255, k[60] = Wt >>> 0 & 255, k[61] = Wt >>> 8 & 255, k[62] = Wt >>> 16 & 255, k[63] = Wt >>> 24 & 255; } - function H(k, U, z, C) { - for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = z[0] & 255 | (z[1] & 255) << 8 | (z[2] & 255) << 16 | (z[3] & 255) << 24, se = z[4] & 255 | (z[5] & 255) << 8 | (z[6] & 255) << 16 | (z[7] & 255) << 24, he = z[8] & 255 | (z[9] & 255) << 8 | (z[10] & 255) << 16 | (z[11] & 255) << 24, xe = z[12] & 255 | (z[13] & 255) << 8 | (z[14] & 255) << 16 | (z[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = U[0] & 255 | (U[1] & 255) << 8 | (U[2] & 255) << 16 | (U[3] & 255) << 24, nt = U[4] & 255 | (U[5] & 255) << 8 | (U[6] & 255) << 16 | (U[7] & 255) << 24, je = U[8] & 255 | (U[9] & 255) << 8 | (U[10] & 255) << 16 | (U[11] & 255) << 24, pt = U[12] & 255 | (U[13] & 255) << 8 | (U[14] & 255) << 16 | (U[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = z[16] & 255 | (z[17] & 255) << 8 | (z[18] & 255) << 16 | (z[19] & 255) << 24, St = z[20] & 255 | (z[21] & 255) << 8 | (z[22] & 255) << 16 | (z[23] & 255) << 24, Tt = z[24] & 255 | (z[25] & 255) << 8 | (z[26] & 255) << 16 | (z[27] & 255) << 24, At = z[28] & 255 | (z[29] & 255) << 8 | (z[30] & 255) << 16 | (z[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = he, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, le, rr = 0; rr < 20; rr += 2) + function H(k, q, W, C) { + for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = W[0] & 255 | (W[1] & 255) << 8 | (W[2] & 255) << 16 | (W[3] & 255) << 24, se = W[4] & 255 | (W[5] & 255) << 8 | (W[6] & 255) << 16 | (W[7] & 255) << 24, he = W[8] & 255 | (W[9] & 255) << 8 | (W[10] & 255) << 16 | (W[11] & 255) << 24, xe = W[12] & 255 | (W[13] & 255) << 8 | (W[14] & 255) << 16 | (W[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = q[0] & 255 | (q[1] & 255) << 8 | (q[2] & 255) << 16 | (q[3] & 255) << 24, nt = q[4] & 255 | (q[5] & 255) << 8 | (q[6] & 255) << 16 | (q[7] & 255) << 24, je = q[8] & 255 | (q[9] & 255) << 8 | (q[10] & 255) << 16 | (q[11] & 255) << 24, pt = q[12] & 255 | (q[13] & 255) << 8 | (q[14] & 255) << 16 | (q[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = W[16] & 255 | (W[17] & 255) << 8 | (W[18] & 255) << 16 | (W[19] & 255) << 24, St = W[20] & 255 | (W[21] & 255) << 8 | (W[22] & 255) << 16 | (W[23] & 255) << 24, Tt = W[24] & 255 | (W[25] & 255) << 8 | (W[26] & 255) << 16 | (W[27] & 255) << 24, At = W[28] & 255 | (W[29] & 255) << 8 | (W[30] & 255) << 16 | (W[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = he, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, le, rr = 0; rr < 20; rr += 2) le = ht + Lt | 0, ut ^= le << 7 | le >>> 25, le = ut + ht | 0, Ve ^= le << 9 | le >>> 23, le = Ve + ut | 0, Lt ^= le << 13 | le >>> 19, le = Lt + Ve | 0, ht ^= le << 18 | le >>> 14, le = ot + xt | 0, Fe ^= le << 7 | le >>> 25, le = Fe + ot | 0, zt ^= le << 9 | le >>> 23, le = zt + Fe | 0, xt ^= le << 13 | le >>> 19, le = xt + zt | 0, ot ^= le << 18 | le >>> 14, le = Ue + Se | 0, Zt ^= le << 7 | le >>> 25, le = Zt + Ue | 0, st ^= le << 9 | le >>> 23, le = st + Zt | 0, Se ^= le << 13 | le >>> 19, le = Se + st | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Je | 0, bt ^= le << 7 | le >>> 25, le = bt + Wt | 0, Ae ^= le << 9 | le >>> 23, le = Ae + bt | 0, Je ^= le << 13 | le >>> 19, le = Je + Ae | 0, Wt ^= le << 18 | le >>> 14, le = ht + bt | 0, xt ^= le << 7 | le >>> 25, le = xt + ht | 0, st ^= le << 9 | le >>> 23, le = st + xt | 0, bt ^= le << 13 | le >>> 19, le = bt + st | 0, ht ^= le << 18 | le >>> 14, le = ot + ut | 0, Se ^= le << 7 | le >>> 25, le = Se + ot | 0, Ae ^= le << 9 | le >>> 23, le = Ae + Se | 0, ut ^= le << 13 | le >>> 19, le = ut + Ae | 0, ot ^= le << 18 | le >>> 14, le = Ue + Fe | 0, Je ^= le << 7 | le >>> 25, le = Je + Ue | 0, Ve ^= le << 9 | le >>> 23, le = Ve + Je | 0, Fe ^= le << 13 | le >>> 19, le = Fe + Ve | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Zt | 0, Lt ^= le << 7 | le >>> 25, le = Lt + Wt | 0, zt ^= le << 9 | le >>> 23, le = zt + Lt | 0, Zt ^= le << 13 | le >>> 19, le = Zt + zt | 0, Wt ^= le << 18 | le >>> 14; k[0] = ht >>> 0 & 255, k[1] = ht >>> 8 & 255, k[2] = ht >>> 16 & 255, k[3] = ht >>> 24 & 255, k[4] = ot >>> 0 & 255, k[5] = ot >>> 8 & 255, k[6] = ot >>> 16 & 255, k[7] = ot >>> 24 & 255, k[8] = Ue >>> 0 & 255, k[9] = Ue >>> 8 & 255, k[10] = Ue >>> 16 & 255, k[11] = Ue >>> 24 & 255, k[12] = Wt >>> 0 & 255, k[13] = Wt >>> 8 & 255, k[14] = Wt >>> 16 & 255, k[15] = Wt >>> 24 & 255, k[16] = Se >>> 0 & 255, k[17] = Se >>> 8 & 255, k[18] = Se >>> 16 & 255, k[19] = Se >>> 24 & 255, k[20] = Ae >>> 0 & 255, k[21] = Ae >>> 8 & 255, k[22] = Ae >>> 16 & 255, k[23] = Ae >>> 24 & 255, k[24] = Ve >>> 0 & 255, k[25] = Ve >>> 8 & 255, k[26] = Ve >>> 16 & 255, k[27] = Ve >>> 24 & 255, k[28] = Fe >>> 0 & 255, k[29] = Fe >>> 8 & 255, k[30] = Fe >>> 16 & 255, k[31] = Fe >>> 24 & 255; } - function W(k, U, z, C) { - $(k, U, z, C); + function U(k, q, W, C) { + B(k, q, W, C); } - function V(k, U, z, C) { - H(k, U, z, C); + function V(k, q, W, C) { + H(k, q, W, C); } var te = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); - function R(k, U, z, C, G, j, se) { + function R(k, q, W, C, G, j, se) { var he = new Uint8Array(16), xe = new Uint8Array(64), Te, Re; for (Re = 0; Re < 16; Re++) he[Re] = 0; for (Re = 0; Re < 8; Re++) he[Re] = j[Re]; for (; G >= 64; ) { - for (W(xe, he, se, te), Re = 0; Re < 64; Re++) k[U + Re] = z[C + Re] ^ xe[Re]; + for (U(xe, he, se, te), Re = 0; Re < 64; Re++) k[q + Re] = W[C + Re] ^ xe[Re]; for (Te = 1, Re = 8; Re < 16; Re++) Te = Te + (he[Re] & 255) | 0, he[Re] = Te & 255, Te >>>= 8; - G -= 64, U += 64, C += 64; + G -= 64, q += 64, C += 64; } if (G > 0) - for (W(xe, he, se, te), Re = 0; Re < G; Re++) k[U + Re] = z[C + Re] ^ xe[Re]; + for (U(xe, he, se, te), Re = 0; Re < G; Re++) k[q + Re] = W[C + Re] ^ xe[Re]; return 0; } - function K(k, U, z, C, G) { + function K(k, q, W, C, G) { var j = new Uint8Array(16), se = new Uint8Array(64), he, xe; for (xe = 0; xe < 16; xe++) j[xe] = 0; for (xe = 0; xe < 8; xe++) j[xe] = C[xe]; - for (; z >= 64; ) { - for (W(se, j, G, te), xe = 0; xe < 64; xe++) k[U + xe] = se[xe]; + for (; W >= 64; ) { + for (U(se, j, G, te), xe = 0; xe < 64; xe++) k[q + xe] = se[xe]; for (he = 1, xe = 8; xe < 16; xe++) he = he + (j[xe] & 255) | 0, j[xe] = he & 255, he >>>= 8; - z -= 64, U += 64; + W -= 64, q += 64; } - if (z > 0) - for (W(se, j, G, te), xe = 0; xe < z; xe++) k[U + xe] = se[xe]; + if (W > 0) + for (U(se, j, G, te), xe = 0; xe < W; xe++) k[q + xe] = se[xe]; return 0; } - function ge(k, U, z, C, G) { + function ge(k, q, W, C, G) { var j = new Uint8Array(32); V(j, C, G, te); for (var se = new Uint8Array(8), he = 0; he < 8; he++) se[he] = C[he + 16]; - return K(k, U, z, se, j); + return K(k, q, W, se, j); } - function Ee(k, U, z, C, G, j, se) { + function Ee(k, q, W, C, G, j, se) { var he = new Uint8Array(32); V(he, j, se, te); for (var xe = new Uint8Array(8), Te = 0; Te < 8; Te++) xe[Te] = j[Te + 16]; - return R(k, U, z, C, G, xe, he); + return R(k, q, W, C, G, xe, he); } var Y = function(k) { this.buffer = new Uint8Array(16), this.r = new Uint16Array(10), this.h = new Uint16Array(10), this.pad = new Uint16Array(8), this.leftover = 0, this.fin = 0; - var U, z, C, G, j, se, he, xe; - U = k[0] & 255 | (k[1] & 255) << 8, this.r[0] = U & 8191, z = k[2] & 255 | (k[3] & 255) << 8, this.r[1] = (U >>> 13 | z << 3) & 8191, C = k[4] & 255 | (k[5] & 255) << 8, this.r[2] = (z >>> 10 | C << 6) & 7939, G = k[6] & 255 | (k[7] & 255) << 8, this.r[3] = (C >>> 7 | G << 9) & 8191, j = k[8] & 255 | (k[9] & 255) << 8, this.r[4] = (G >>> 4 | j << 12) & 255, this.r[5] = j >>> 1 & 8190, se = k[10] & 255 | (k[11] & 255) << 8, this.r[6] = (j >>> 14 | se << 2) & 8191, he = k[12] & 255 | (k[13] & 255) << 8, this.r[7] = (se >>> 11 | he << 5) & 8065, xe = k[14] & 255 | (k[15] & 255) << 8, this.r[8] = (he >>> 8 | xe << 8) & 8191, this.r[9] = xe >>> 5 & 127, this.pad[0] = k[16] & 255 | (k[17] & 255) << 8, this.pad[1] = k[18] & 255 | (k[19] & 255) << 8, this.pad[2] = k[20] & 255 | (k[21] & 255) << 8, this.pad[3] = k[22] & 255 | (k[23] & 255) << 8, this.pad[4] = k[24] & 255 | (k[25] & 255) << 8, this.pad[5] = k[26] & 255 | (k[27] & 255) << 8, this.pad[6] = k[28] & 255 | (k[29] & 255) << 8, this.pad[7] = k[30] & 255 | (k[31] & 255) << 8; + var q, W, C, G, j, se, he, xe; + q = k[0] & 255 | (k[1] & 255) << 8, this.r[0] = q & 8191, W = k[2] & 255 | (k[3] & 255) << 8, this.r[1] = (q >>> 13 | W << 3) & 8191, C = k[4] & 255 | (k[5] & 255) << 8, this.r[2] = (W >>> 10 | C << 6) & 7939, G = k[6] & 255 | (k[7] & 255) << 8, this.r[3] = (C >>> 7 | G << 9) & 8191, j = k[8] & 255 | (k[9] & 255) << 8, this.r[4] = (G >>> 4 | j << 12) & 255, this.r[5] = j >>> 1 & 8190, se = k[10] & 255 | (k[11] & 255) << 8, this.r[6] = (j >>> 14 | se << 2) & 8191, he = k[12] & 255 | (k[13] & 255) << 8, this.r[7] = (se >>> 11 | he << 5) & 8065, xe = k[14] & 255 | (k[15] & 255) << 8, this.r[8] = (he >>> 8 | xe << 8) & 8191, this.r[9] = xe >>> 5 & 127, this.pad[0] = k[16] & 255 | (k[17] & 255) << 8, this.pad[1] = k[18] & 255 | (k[19] & 255) << 8, this.pad[2] = k[20] & 255 | (k[21] & 255) << 8, this.pad[3] = k[22] & 255 | (k[23] & 255) << 8, this.pad[4] = k[24] & 255 | (k[25] & 255) << 8, this.pad[5] = k[26] & 255 | (k[27] & 255) << 8, this.pad[6] = k[28] & 255 | (k[29] & 255) << 8, this.pad[7] = k[30] & 255 | (k[31] & 255) << 8; }; - Y.prototype.blocks = function(k, U, z) { - for (var C = this.fin ? 0 : 2048, G, j, se, he, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt = this.h[0], ut = this.h[1], ot = this.h[2], Se = this.h[3], Ae = this.h[4], Ve = this.h[5], Fe = this.h[6], Ue = this.h[7], Je = this.h[8], Lt = this.h[9], zt = this.r[0], Zt = this.r[1], Wt = this.r[2], le = this.r[3], rr = this.r[4], dr = this.r[5], pr = this.r[6], Qt = this.r[7], gr = this.r[8], lr = this.r[9]; z >= 16; ) - G = k[U + 0] & 255 | (k[U + 1] & 255) << 8, bt += G & 8191, j = k[U + 2] & 255 | (k[U + 3] & 255) << 8, ut += (G >>> 13 | j << 3) & 8191, se = k[U + 4] & 255 | (k[U + 5] & 255) << 8, ot += (j >>> 10 | se << 6) & 8191, he = k[U + 6] & 255 | (k[U + 7] & 255) << 8, Se += (se >>> 7 | he << 9) & 8191, xe = k[U + 8] & 255 | (k[U + 9] & 255) << 8, Ae += (he >>> 4 | xe << 12) & 8191, Ve += xe >>> 1 & 8191, Te = k[U + 10] & 255 | (k[U + 11] & 255) << 8, Fe += (xe >>> 14 | Te << 2) & 8191, Re = k[U + 12] & 255 | (k[U + 13] & 255) << 8, Ue += (Te >>> 11 | Re << 5) & 8191, nt = k[U + 14] & 255 | (k[U + 15] & 255) << 8, Je += (Re >>> 8 | nt << 8) & 8191, Lt += nt >>> 5 | C, je = 0, pt = je, pt += bt * zt, pt += ut * (5 * lr), pt += ot * (5 * gr), pt += Se * (5 * Qt), pt += Ae * (5 * pr), je = pt >>> 13, pt &= 8191, pt += Ve * (5 * dr), pt += Fe * (5 * rr), pt += Ue * (5 * le), pt += Je * (5 * Wt), pt += Lt * (5 * Zt), je += pt >>> 13, pt &= 8191, it = je, it += bt * Zt, it += ut * zt, it += ot * (5 * lr), it += Se * (5 * gr), it += Ae * (5 * Qt), je = it >>> 13, it &= 8191, it += Ve * (5 * pr), it += Fe * (5 * dr), it += Ue * (5 * rr), it += Je * (5 * le), it += Lt * (5 * Wt), je += it >>> 13, it &= 8191, et = je, et += bt * Wt, et += ut * Zt, et += ot * zt, et += Se * (5 * lr), et += Ae * (5 * gr), je = et >>> 13, et &= 8191, et += Ve * (5 * Qt), et += Fe * (5 * pr), et += Ue * (5 * dr), et += Je * (5 * rr), et += Lt * (5 * le), je += et >>> 13, et &= 8191, St = je, St += bt * le, St += ut * Wt, St += ot * Zt, St += Se * zt, St += Ae * (5 * lr), je = St >>> 13, St &= 8191, St += Ve * (5 * gr), St += Fe * (5 * Qt), St += Ue * (5 * pr), St += Je * (5 * dr), St += Lt * (5 * rr), je += St >>> 13, St &= 8191, Tt = je, Tt += bt * rr, Tt += ut * le, Tt += ot * Wt, Tt += Se * Zt, Tt += Ae * zt, je = Tt >>> 13, Tt &= 8191, Tt += Ve * (5 * lr), Tt += Fe * (5 * gr), Tt += Ue * (5 * Qt), Tt += Je * (5 * pr), Tt += Lt * (5 * dr), je += Tt >>> 13, Tt &= 8191, At = je, At += bt * dr, At += ut * rr, At += ot * le, At += Se * Wt, At += Ae * Zt, je = At >>> 13, At &= 8191, At += Ve * zt, At += Fe * (5 * lr), At += Ue * (5 * gr), At += Je * (5 * Qt), At += Lt * (5 * pr), je += At >>> 13, At &= 8191, _t = je, _t += bt * pr, _t += ut * dr, _t += ot * rr, _t += Se * le, _t += Ae * Wt, je = _t >>> 13, _t &= 8191, _t += Ve * Zt, _t += Fe * zt, _t += Ue * (5 * lr), _t += Je * (5 * gr), _t += Lt * (5 * Qt), je += _t >>> 13, _t &= 8191, ht = je, ht += bt * Qt, ht += ut * pr, ht += ot * dr, ht += Se * rr, ht += Ae * le, je = ht >>> 13, ht &= 8191, ht += Ve * Wt, ht += Fe * Zt, ht += Ue * zt, ht += Je * (5 * lr), ht += Lt * (5 * gr), je += ht >>> 13, ht &= 8191, xt = je, xt += bt * gr, xt += ut * Qt, xt += ot * pr, xt += Se * dr, xt += Ae * rr, je = xt >>> 13, xt &= 8191, xt += Ve * le, xt += Fe * Wt, xt += Ue * Zt, xt += Je * zt, xt += Lt * (5 * lr), je += xt >>> 13, xt &= 8191, st = je, st += bt * lr, st += ut * gr, st += ot * Qt, st += Se * pr, st += Ae * dr, je = st >>> 13, st &= 8191, st += Ve * rr, st += Fe * le, st += Ue * Wt, st += Je * Zt, st += Lt * zt, je += st >>> 13, st &= 8191, je = (je << 2) + je | 0, je = je + pt | 0, pt = je & 8191, je = je >>> 13, it += je, bt = pt, ut = it, ot = et, Se = St, Ae = Tt, Ve = At, Fe = _t, Ue = ht, Je = xt, Lt = st, U += 16, z -= 16; + Y.prototype.blocks = function(k, q, W) { + for (var C = this.fin ? 0 : 2048, G, j, se, he, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt = this.h[0], ut = this.h[1], ot = this.h[2], Se = this.h[3], Ae = this.h[4], Ve = this.h[5], Fe = this.h[6], Ue = this.h[7], Je = this.h[8], Lt = this.h[9], zt = this.r[0], Zt = this.r[1], Wt = this.r[2], le = this.r[3], rr = this.r[4], dr = this.r[5], pr = this.r[6], Qt = this.r[7], gr = this.r[8], lr = this.r[9]; W >= 16; ) + G = k[q + 0] & 255 | (k[q + 1] & 255) << 8, bt += G & 8191, j = k[q + 2] & 255 | (k[q + 3] & 255) << 8, ut += (G >>> 13 | j << 3) & 8191, se = k[q + 4] & 255 | (k[q + 5] & 255) << 8, ot += (j >>> 10 | se << 6) & 8191, he = k[q + 6] & 255 | (k[q + 7] & 255) << 8, Se += (se >>> 7 | he << 9) & 8191, xe = k[q + 8] & 255 | (k[q + 9] & 255) << 8, Ae += (he >>> 4 | xe << 12) & 8191, Ve += xe >>> 1 & 8191, Te = k[q + 10] & 255 | (k[q + 11] & 255) << 8, Fe += (xe >>> 14 | Te << 2) & 8191, Re = k[q + 12] & 255 | (k[q + 13] & 255) << 8, Ue += (Te >>> 11 | Re << 5) & 8191, nt = k[q + 14] & 255 | (k[q + 15] & 255) << 8, Je += (Re >>> 8 | nt << 8) & 8191, Lt += nt >>> 5 | C, je = 0, pt = je, pt += bt * zt, pt += ut * (5 * lr), pt += ot * (5 * gr), pt += Se * (5 * Qt), pt += Ae * (5 * pr), je = pt >>> 13, pt &= 8191, pt += Ve * (5 * dr), pt += Fe * (5 * rr), pt += Ue * (5 * le), pt += Je * (5 * Wt), pt += Lt * (5 * Zt), je += pt >>> 13, pt &= 8191, it = je, it += bt * Zt, it += ut * zt, it += ot * (5 * lr), it += Se * (5 * gr), it += Ae * (5 * Qt), je = it >>> 13, it &= 8191, it += Ve * (5 * pr), it += Fe * (5 * dr), it += Ue * (5 * rr), it += Je * (5 * le), it += Lt * (5 * Wt), je += it >>> 13, it &= 8191, et = je, et += bt * Wt, et += ut * Zt, et += ot * zt, et += Se * (5 * lr), et += Ae * (5 * gr), je = et >>> 13, et &= 8191, et += Ve * (5 * Qt), et += Fe * (5 * pr), et += Ue * (5 * dr), et += Je * (5 * rr), et += Lt * (5 * le), je += et >>> 13, et &= 8191, St = je, St += bt * le, St += ut * Wt, St += ot * Zt, St += Se * zt, St += Ae * (5 * lr), je = St >>> 13, St &= 8191, St += Ve * (5 * gr), St += Fe * (5 * Qt), St += Ue * (5 * pr), St += Je * (5 * dr), St += Lt * (5 * rr), je += St >>> 13, St &= 8191, Tt = je, Tt += bt * rr, Tt += ut * le, Tt += ot * Wt, Tt += Se * Zt, Tt += Ae * zt, je = Tt >>> 13, Tt &= 8191, Tt += Ve * (5 * lr), Tt += Fe * (5 * gr), Tt += Ue * (5 * Qt), Tt += Je * (5 * pr), Tt += Lt * (5 * dr), je += Tt >>> 13, Tt &= 8191, At = je, At += bt * dr, At += ut * rr, At += ot * le, At += Se * Wt, At += Ae * Zt, je = At >>> 13, At &= 8191, At += Ve * zt, At += Fe * (5 * lr), At += Ue * (5 * gr), At += Je * (5 * Qt), At += Lt * (5 * pr), je += At >>> 13, At &= 8191, _t = je, _t += bt * pr, _t += ut * dr, _t += ot * rr, _t += Se * le, _t += Ae * Wt, je = _t >>> 13, _t &= 8191, _t += Ve * Zt, _t += Fe * zt, _t += Ue * (5 * lr), _t += Je * (5 * gr), _t += Lt * (5 * Qt), je += _t >>> 13, _t &= 8191, ht = je, ht += bt * Qt, ht += ut * pr, ht += ot * dr, ht += Se * rr, ht += Ae * le, je = ht >>> 13, ht &= 8191, ht += Ve * Wt, ht += Fe * Zt, ht += Ue * zt, ht += Je * (5 * lr), ht += Lt * (5 * gr), je += ht >>> 13, ht &= 8191, xt = je, xt += bt * gr, xt += ut * Qt, xt += ot * pr, xt += Se * dr, xt += Ae * rr, je = xt >>> 13, xt &= 8191, xt += Ve * le, xt += Fe * Wt, xt += Ue * Zt, xt += Je * zt, xt += Lt * (5 * lr), je += xt >>> 13, xt &= 8191, st = je, st += bt * lr, st += ut * gr, st += ot * Qt, st += Se * pr, st += Ae * dr, je = st >>> 13, st &= 8191, st += Ve * rr, st += Fe * le, st += Ue * Wt, st += Je * Zt, st += Lt * zt, je += st >>> 13, st &= 8191, je = (je << 2) + je | 0, je = je + pt | 0, pt = je & 8191, je = je >>> 13, it += je, bt = pt, ut = it, ot = et, Se = St, Ae = Tt, Ve = At, Fe = _t, Ue = ht, Je = xt, Lt = st, q += 16, W -= 16; this.h[0] = bt, this.h[1] = ut, this.h[2] = ot, this.h[3] = Se, this.h[4] = Ae, this.h[5] = Ve, this.h[6] = Fe, this.h[7] = Ue, this.h[8] = Je, this.h[9] = Lt; - }, Y.prototype.finish = function(k, U) { - var z = new Uint16Array(10), C, G, j, se; + }, Y.prototype.finish = function(k, q) { + var W = new Uint16Array(10), C, G, j, se; if (this.leftover) { for (se = this.leftover, this.buffer[se++] = 1; se < 16; se++) this.buffer[se] = 0; this.fin = 1, this.blocks(this.buffer, 0, 16); } for (C = this.h[1] >>> 13, this.h[1] &= 8191, se = 2; se < 10; se++) this.h[se] += C, C = this.h[se] >>> 13, this.h[se] &= 8191; - for (this.h[0] += C * 5, C = this.h[0] >>> 13, this.h[0] &= 8191, this.h[1] += C, C = this.h[1] >>> 13, this.h[1] &= 8191, this.h[2] += C, z[0] = this.h[0] + 5, C = z[0] >>> 13, z[0] &= 8191, se = 1; se < 10; se++) - z[se] = this.h[se] + C, C = z[se] >>> 13, z[se] &= 8191; - for (z[9] -= 8192, G = (C ^ 1) - 1, se = 0; se < 10; se++) z[se] &= G; - for (G = ~G, se = 0; se < 10; se++) this.h[se] = this.h[se] & G | z[se]; + for (this.h[0] += C * 5, C = this.h[0] >>> 13, this.h[0] &= 8191, this.h[1] += C, C = this.h[1] >>> 13, this.h[1] &= 8191, this.h[2] += C, W[0] = this.h[0] + 5, C = W[0] >>> 13, W[0] &= 8191, se = 1; se < 10; se++) + W[se] = this.h[se] + C, C = W[se] >>> 13, W[se] &= 8191; + for (W[9] -= 8192, G = (C ^ 1) - 1, se = 0; se < 10; se++) W[se] &= G; + for (G = ~G, se = 0; se < 10; se++) this.h[se] = this.h[se] & G | W[se]; for (this.h[0] = (this.h[0] | this.h[1] << 13) & 65535, this.h[1] = (this.h[1] >>> 3 | this.h[2] << 10) & 65535, this.h[2] = (this.h[2] >>> 6 | this.h[3] << 7) & 65535, this.h[3] = (this.h[3] >>> 9 | this.h[4] << 4) & 65535, this.h[4] = (this.h[4] >>> 12 | this.h[5] << 1 | this.h[6] << 14) & 65535, this.h[5] = (this.h[6] >>> 2 | this.h[7] << 11) & 65535, this.h[6] = (this.h[7] >>> 5 | this.h[8] << 8) & 65535, this.h[7] = (this.h[8] >>> 8 | this.h[9] << 5) & 65535, j = this.h[0] + this.pad[0], this.h[0] = j & 65535, se = 1; se < 8; se++) j = (this.h[se] + this.pad[se] | 0) + (j >>> 16) | 0, this.h[se] = j & 65535; - k[U + 0] = this.h[0] >>> 0 & 255, k[U + 1] = this.h[0] >>> 8 & 255, k[U + 2] = this.h[1] >>> 0 & 255, k[U + 3] = this.h[1] >>> 8 & 255, k[U + 4] = this.h[2] >>> 0 & 255, k[U + 5] = this.h[2] >>> 8 & 255, k[U + 6] = this.h[3] >>> 0 & 255, k[U + 7] = this.h[3] >>> 8 & 255, k[U + 8] = this.h[4] >>> 0 & 255, k[U + 9] = this.h[4] >>> 8 & 255, k[U + 10] = this.h[5] >>> 0 & 255, k[U + 11] = this.h[5] >>> 8 & 255, k[U + 12] = this.h[6] >>> 0 & 255, k[U + 13] = this.h[6] >>> 8 & 255, k[U + 14] = this.h[7] >>> 0 & 255, k[U + 15] = this.h[7] >>> 8 & 255; - }, Y.prototype.update = function(k, U, z) { + k[q + 0] = this.h[0] >>> 0 & 255, k[q + 1] = this.h[0] >>> 8 & 255, k[q + 2] = this.h[1] >>> 0 & 255, k[q + 3] = this.h[1] >>> 8 & 255, k[q + 4] = this.h[2] >>> 0 & 255, k[q + 5] = this.h[2] >>> 8 & 255, k[q + 6] = this.h[3] >>> 0 & 255, k[q + 7] = this.h[3] >>> 8 & 255, k[q + 8] = this.h[4] >>> 0 & 255, k[q + 9] = this.h[4] >>> 8 & 255, k[q + 10] = this.h[5] >>> 0 & 255, k[q + 11] = this.h[5] >>> 8 & 255, k[q + 12] = this.h[6] >>> 0 & 255, k[q + 13] = this.h[6] >>> 8 & 255, k[q + 14] = this.h[7] >>> 0 & 255, k[q + 15] = this.h[7] >>> 8 & 255; + }, Y.prototype.update = function(k, q, W) { var C, G; if (this.leftover) { - for (G = 16 - this.leftover, G > z && (G = z), C = 0; C < G; C++) - this.buffer[this.leftover + C] = k[U + C]; - if (z -= G, U += G, this.leftover += G, this.leftover < 16) + for (G = 16 - this.leftover, G > W && (G = W), C = 0; C < G; C++) + this.buffer[this.leftover + C] = k[q + C]; + if (W -= G, q += G, this.leftover += G, this.leftover < 16) return; this.blocks(this.buffer, 0, 16), this.leftover = 0; } - if (z >= 16 && (G = z - z % 16, this.blocks(k, U, G), U += G, z -= G), z) { - for (C = 0; C < z; C++) - this.buffer[this.leftover + C] = k[U + C]; - this.leftover += z; + if (W >= 16 && (G = W - W % 16, this.blocks(k, q, G), q += G, W -= G), W) { + for (C = 0; C < W; C++) + this.buffer[this.leftover + C] = k[q + C]; + this.leftover += W; } }; - function S(k, U, z, C, G, j) { + function S(k, q, W, C, G, j) { var se = new Y(j); - return se.update(z, C, G), se.finish(k, U), 0; + return se.update(W, C, G), se.finish(k, q), 0; } - function m(k, U, z, C, G, j) { + function m(k, q, W, C, G, j) { var se = new Uint8Array(16); - return S(se, 0, z, C, G, j), L(k, U, se, 0); + return S(se, 0, W, C, G, j), L(k, q, se, 0); } - function f(k, U, z, C, G) { + function f(k, q, W, C, G) { var j; - if (z < 32) return -1; - for (Ee(k, 0, U, 0, z, C, G), S(k, 16, k, 32, z - 32, k), j = 0; j < 16; j++) k[j] = 0; + if (W < 32) return -1; + for (Ee(k, 0, q, 0, W, C, G), S(k, 16, k, 32, W - 32, k), j = 0; j < 16; j++) k[j] = 0; return 0; } - function g(k, U, z, C, G) { + function g(k, q, W, C, G) { var j, se = new Uint8Array(32); - if (z < 32 || (ge(se, 0, 32, C, G), m(U, 16, U, 32, z - 32, se) !== 0)) return -1; - for (Ee(k, 0, U, 0, z, C, G), j = 0; j < 32; j++) k[j] = 0; + if (W < 32 || (ge(se, 0, 32, C, G), m(q, 16, q, 32, W - 32, se) !== 0)) return -1; + for (Ee(k, 0, q, 0, W, C, G), j = 0; j < 32; j++) k[j] = 0; return 0; } - function b(k, U) { - var z; - for (z = 0; z < 16; z++) k[z] = U[z] | 0; + function b(k, q) { + var W; + for (W = 0; W < 16; W++) k[W] = q[W] | 0; } function x(k) { - var U, z, C = 1; - for (U = 0; U < 16; U++) - z = k[U] + C + 65535, C = Math.floor(z / 65536), k[U] = z - C * 65536; + var q, W, C = 1; + for (q = 0; q < 16; q++) + W = k[q] + C + 65535, C = Math.floor(W / 65536), k[q] = W - C * 65536; k[0] += C - 1 + 37 * (C - 1); } - function _(k, U, z) { - for (var C, G = ~(z - 1), j = 0; j < 16; j++) - C = G & (k[j] ^ U[j]), k[j] ^= C, U[j] ^= C; + function _(k, q, W) { + for (var C, G = ~(W - 1), j = 0; j < 16; j++) + C = G & (k[j] ^ q[j]), k[j] ^= C, q[j] ^= C; } - function E(k, U) { - var z, C, G, j = r(), se = r(); - for (z = 0; z < 16; z++) se[z] = U[z]; + function E(k, q) { + var W, C, G, j = r(), se = r(); + for (W = 0; W < 16; W++) se[W] = q[W]; for (x(se), x(se), x(se), C = 0; C < 2; C++) { - for (j[0] = se[0] - 65517, z = 1; z < 15; z++) - j[z] = se[z] - 65535 - (j[z - 1] >> 16 & 1), j[z - 1] &= 65535; + for (j[0] = se[0] - 65517, W = 1; W < 15; W++) + j[W] = se[W] - 65535 - (j[W - 1] >> 16 & 1), j[W - 1] &= 65535; j[15] = se[15] - 32767 - (j[14] >> 16 & 1), G = j[15] >> 16 & 1, j[14] &= 65535, _(se, j, 1 - G); } - for (z = 0; z < 16; z++) - k[2 * z] = se[z] & 255, k[2 * z + 1] = se[z] >> 8; + for (W = 0; W < 16; W++) + k[2 * W] = se[W] & 255, k[2 * W + 1] = se[W] >> 8; } - function v(k, U) { - var z = new Uint8Array(32), C = new Uint8Array(32); - return E(z, k), E(C, U), B(z, 0, C, 0); + function v(k, q) { + var W = new Uint8Array(32), C = new Uint8Array(32); + return E(W, k), E(C, q), $(W, 0, C, 0); } function P(k) { - var U = new Uint8Array(32); - return E(U, k), U[0] & 1; + var q = new Uint8Array(32); + return E(q, k), q[0] & 1; } - function I(k, U) { - var z; - for (z = 0; z < 16; z++) k[z] = U[2 * z] + (U[2 * z + 1] << 8); + function I(k, q) { + var W; + for (W = 0; W < 16; W++) k[W] = q[2 * W] + (q[2 * W + 1] << 8); k[15] &= 32767; } - function F(k, U, z) { - for (var C = 0; C < 16; C++) k[C] = U[C] + z[C]; + function F(k, q, W) { + for (var C = 0; C < 16; C++) k[C] = q[C] + W[C]; } - function ce(k, U, z) { - for (var C = 0; C < 16; C++) k[C] = U[C] - z[C]; + function ce(k, q, W) { + for (var C = 0; C < 16; C++) k[C] = q[C] - W[C]; } - function D(k, U, z) { - var C, G, j = 0, se = 0, he = 0, xe = 0, Te = 0, Re = 0, nt = 0, je = 0, pt = 0, it = 0, et = 0, St = 0, Tt = 0, At = 0, _t = 0, ht = 0, xt = 0, st = 0, bt = 0, ut = 0, ot = 0, Se = 0, Ae = 0, Ve = 0, Fe = 0, Ue = 0, Je = 0, Lt = 0, zt = 0, Zt = 0, Wt = 0, le = z[0], rr = z[1], dr = z[2], pr = z[3], Qt = z[4], gr = z[5], lr = z[6], Rr = z[7], mr = z[8], yr = z[9], $r = z[10], Br = z[11], Ir = z[12], nn = z[13], sn = z[14], on = z[15]; - C = U[0], j += C * le, se += C * rr, he += C * dr, xe += C * pr, Te += C * Qt, Re += C * gr, nt += C * lr, je += C * Rr, pt += C * mr, it += C * yr, et += C * $r, St += C * Br, Tt += C * Ir, At += C * nn, _t += C * sn, ht += C * on, C = U[1], se += C * le, he += C * rr, xe += C * dr, Te += C * pr, Re += C * Qt, nt += C * gr, je += C * lr, pt += C * Rr, it += C * mr, et += C * yr, St += C * $r, Tt += C * Br, At += C * Ir, _t += C * nn, ht += C * sn, xt += C * on, C = U[2], he += C * le, xe += C * rr, Te += C * dr, Re += C * pr, nt += C * Qt, je += C * gr, pt += C * lr, it += C * Rr, et += C * mr, St += C * yr, Tt += C * $r, At += C * Br, _t += C * Ir, ht += C * nn, xt += C * sn, st += C * on, C = U[3], xe += C * le, Te += C * rr, Re += C * dr, nt += C * pr, je += C * Qt, pt += C * gr, it += C * lr, et += C * Rr, St += C * mr, Tt += C * yr, At += C * $r, _t += C * Br, ht += C * Ir, xt += C * nn, st += C * sn, bt += C * on, C = U[4], Te += C * le, Re += C * rr, nt += C * dr, je += C * pr, pt += C * Qt, it += C * gr, et += C * lr, St += C * Rr, Tt += C * mr, At += C * yr, _t += C * $r, ht += C * Br, xt += C * Ir, st += C * nn, bt += C * sn, ut += C * on, C = U[5], Re += C * le, nt += C * rr, je += C * dr, pt += C * pr, it += C * Qt, et += C * gr, St += C * lr, Tt += C * Rr, At += C * mr, _t += C * yr, ht += C * $r, xt += C * Br, st += C * Ir, bt += C * nn, ut += C * sn, ot += C * on, C = U[6], nt += C * le, je += C * rr, pt += C * dr, it += C * pr, et += C * Qt, St += C * gr, Tt += C * lr, At += C * Rr, _t += C * mr, ht += C * yr, xt += C * $r, st += C * Br, bt += C * Ir, ut += C * nn, ot += C * sn, Se += C * on, C = U[7], je += C * le, pt += C * rr, it += C * dr, et += C * pr, St += C * Qt, Tt += C * gr, At += C * lr, _t += C * Rr, ht += C * mr, xt += C * yr, st += C * $r, bt += C * Br, ut += C * Ir, ot += C * nn, Se += C * sn, Ae += C * on, C = U[8], pt += C * le, it += C * rr, et += C * dr, St += C * pr, Tt += C * Qt, At += C * gr, _t += C * lr, ht += C * Rr, xt += C * mr, st += C * yr, bt += C * $r, ut += C * Br, ot += C * Ir, Se += C * nn, Ae += C * sn, Ve += C * on, C = U[9], it += C * le, et += C * rr, St += C * dr, Tt += C * pr, At += C * Qt, _t += C * gr, ht += C * lr, xt += C * Rr, st += C * mr, bt += C * yr, ut += C * $r, ot += C * Br, Se += C * Ir, Ae += C * nn, Ve += C * sn, Fe += C * on, C = U[10], et += C * le, St += C * rr, Tt += C * dr, At += C * pr, _t += C * Qt, ht += C * gr, xt += C * lr, st += C * Rr, bt += C * mr, ut += C * yr, ot += C * $r, Se += C * Br, Ae += C * Ir, Ve += C * nn, Fe += C * sn, Ue += C * on, C = U[11], St += C * le, Tt += C * rr, At += C * dr, _t += C * pr, ht += C * Qt, xt += C * gr, st += C * lr, bt += C * Rr, ut += C * mr, ot += C * yr, Se += C * $r, Ae += C * Br, Ve += C * Ir, Fe += C * nn, Ue += C * sn, Je += C * on, C = U[12], Tt += C * le, At += C * rr, _t += C * dr, ht += C * pr, xt += C * Qt, st += C * gr, bt += C * lr, ut += C * Rr, ot += C * mr, Se += C * yr, Ae += C * $r, Ve += C * Br, Fe += C * Ir, Ue += C * nn, Je += C * sn, Lt += C * on, C = U[13], At += C * le, _t += C * rr, ht += C * dr, xt += C * pr, st += C * Qt, bt += C * gr, ut += C * lr, ot += C * Rr, Se += C * mr, Ae += C * yr, Ve += C * $r, Fe += C * Br, Ue += C * Ir, Je += C * nn, Lt += C * sn, zt += C * on, C = U[14], _t += C * le, ht += C * rr, xt += C * dr, st += C * pr, bt += C * Qt, ut += C * gr, ot += C * lr, Se += C * Rr, Ae += C * mr, Ve += C * yr, Fe += C * $r, Ue += C * Br, Je += C * Ir, Lt += C * nn, zt += C * sn, Zt += C * on, C = U[15], ht += C * le, xt += C * rr, st += C * dr, bt += C * pr, ut += C * Qt, ot += C * gr, Se += C * lr, Ae += C * Rr, Ve += C * mr, Fe += C * yr, Ue += C * $r, Je += C * Br, Lt += C * Ir, zt += C * nn, Zt += C * sn, Wt += C * on, j += 38 * xt, se += 38 * st, he += 38 * bt, xe += 38 * ut, Te += 38 * ot, Re += 38 * Se, nt += 38 * Ae, je += 38 * Ve, pt += 38 * Fe, it += 38 * Ue, et += 38 * Je, St += 38 * Lt, Tt += 38 * zt, At += 38 * Zt, _t += 38 * Wt, G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = he + G + 65535, G = Math.floor(C / 65536), he = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = he + G + 65535, G = Math.floor(C / 65536), he = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), k[0] = j, k[1] = se, k[2] = he, k[3] = xe, k[4] = Te, k[5] = Re, k[6] = nt, k[7] = je, k[8] = pt, k[9] = it, k[10] = et, k[11] = St, k[12] = Tt, k[13] = At, k[14] = _t, k[15] = ht; + function D(k, q, W) { + var C, G, j = 0, se = 0, he = 0, xe = 0, Te = 0, Re = 0, nt = 0, je = 0, pt = 0, it = 0, et = 0, St = 0, Tt = 0, At = 0, _t = 0, ht = 0, xt = 0, st = 0, bt = 0, ut = 0, ot = 0, Se = 0, Ae = 0, Ve = 0, Fe = 0, Ue = 0, Je = 0, Lt = 0, zt = 0, Zt = 0, Wt = 0, le = W[0], rr = W[1], dr = W[2], pr = W[3], Qt = W[4], gr = W[5], lr = W[6], Rr = W[7], mr = W[8], yr = W[9], $r = W[10], Br = W[11], Ir = W[12], nn = W[13], sn = W[14], on = W[15]; + C = q[0], j += C * le, se += C * rr, he += C * dr, xe += C * pr, Te += C * Qt, Re += C * gr, nt += C * lr, je += C * Rr, pt += C * mr, it += C * yr, et += C * $r, St += C * Br, Tt += C * Ir, At += C * nn, _t += C * sn, ht += C * on, C = q[1], se += C * le, he += C * rr, xe += C * dr, Te += C * pr, Re += C * Qt, nt += C * gr, je += C * lr, pt += C * Rr, it += C * mr, et += C * yr, St += C * $r, Tt += C * Br, At += C * Ir, _t += C * nn, ht += C * sn, xt += C * on, C = q[2], he += C * le, xe += C * rr, Te += C * dr, Re += C * pr, nt += C * Qt, je += C * gr, pt += C * lr, it += C * Rr, et += C * mr, St += C * yr, Tt += C * $r, At += C * Br, _t += C * Ir, ht += C * nn, xt += C * sn, st += C * on, C = q[3], xe += C * le, Te += C * rr, Re += C * dr, nt += C * pr, je += C * Qt, pt += C * gr, it += C * lr, et += C * Rr, St += C * mr, Tt += C * yr, At += C * $r, _t += C * Br, ht += C * Ir, xt += C * nn, st += C * sn, bt += C * on, C = q[4], Te += C * le, Re += C * rr, nt += C * dr, je += C * pr, pt += C * Qt, it += C * gr, et += C * lr, St += C * Rr, Tt += C * mr, At += C * yr, _t += C * $r, ht += C * Br, xt += C * Ir, st += C * nn, bt += C * sn, ut += C * on, C = q[5], Re += C * le, nt += C * rr, je += C * dr, pt += C * pr, it += C * Qt, et += C * gr, St += C * lr, Tt += C * Rr, At += C * mr, _t += C * yr, ht += C * $r, xt += C * Br, st += C * Ir, bt += C * nn, ut += C * sn, ot += C * on, C = q[6], nt += C * le, je += C * rr, pt += C * dr, it += C * pr, et += C * Qt, St += C * gr, Tt += C * lr, At += C * Rr, _t += C * mr, ht += C * yr, xt += C * $r, st += C * Br, bt += C * Ir, ut += C * nn, ot += C * sn, Se += C * on, C = q[7], je += C * le, pt += C * rr, it += C * dr, et += C * pr, St += C * Qt, Tt += C * gr, At += C * lr, _t += C * Rr, ht += C * mr, xt += C * yr, st += C * $r, bt += C * Br, ut += C * Ir, ot += C * nn, Se += C * sn, Ae += C * on, C = q[8], pt += C * le, it += C * rr, et += C * dr, St += C * pr, Tt += C * Qt, At += C * gr, _t += C * lr, ht += C * Rr, xt += C * mr, st += C * yr, bt += C * $r, ut += C * Br, ot += C * Ir, Se += C * nn, Ae += C * sn, Ve += C * on, C = q[9], it += C * le, et += C * rr, St += C * dr, Tt += C * pr, At += C * Qt, _t += C * gr, ht += C * lr, xt += C * Rr, st += C * mr, bt += C * yr, ut += C * $r, ot += C * Br, Se += C * Ir, Ae += C * nn, Ve += C * sn, Fe += C * on, C = q[10], et += C * le, St += C * rr, Tt += C * dr, At += C * pr, _t += C * Qt, ht += C * gr, xt += C * lr, st += C * Rr, bt += C * mr, ut += C * yr, ot += C * $r, Se += C * Br, Ae += C * Ir, Ve += C * nn, Fe += C * sn, Ue += C * on, C = q[11], St += C * le, Tt += C * rr, At += C * dr, _t += C * pr, ht += C * Qt, xt += C * gr, st += C * lr, bt += C * Rr, ut += C * mr, ot += C * yr, Se += C * $r, Ae += C * Br, Ve += C * Ir, Fe += C * nn, Ue += C * sn, Je += C * on, C = q[12], Tt += C * le, At += C * rr, _t += C * dr, ht += C * pr, xt += C * Qt, st += C * gr, bt += C * lr, ut += C * Rr, ot += C * mr, Se += C * yr, Ae += C * $r, Ve += C * Br, Fe += C * Ir, Ue += C * nn, Je += C * sn, Lt += C * on, C = q[13], At += C * le, _t += C * rr, ht += C * dr, xt += C * pr, st += C * Qt, bt += C * gr, ut += C * lr, ot += C * Rr, Se += C * mr, Ae += C * yr, Ve += C * $r, Fe += C * Br, Ue += C * Ir, Je += C * nn, Lt += C * sn, zt += C * on, C = q[14], _t += C * le, ht += C * rr, xt += C * dr, st += C * pr, bt += C * Qt, ut += C * gr, ot += C * lr, Se += C * Rr, Ae += C * mr, Ve += C * yr, Fe += C * $r, Ue += C * Br, Je += C * Ir, Lt += C * nn, zt += C * sn, Zt += C * on, C = q[15], ht += C * le, xt += C * rr, st += C * dr, bt += C * pr, ut += C * Qt, ot += C * gr, Se += C * lr, Ae += C * Rr, Ve += C * mr, Fe += C * yr, Ue += C * $r, Je += C * Br, Lt += C * Ir, zt += C * nn, Zt += C * sn, Wt += C * on, j += 38 * xt, se += 38 * st, he += 38 * bt, xe += 38 * ut, Te += 38 * ot, Re += 38 * Se, nt += 38 * Ae, je += 38 * Ve, pt += 38 * Fe, it += 38 * Ue, et += 38 * Je, St += 38 * Lt, Tt += 38 * zt, At += 38 * Zt, _t += 38 * Wt, G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = he + G + 65535, G = Math.floor(C / 65536), he = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = he + G + 65535, G = Math.floor(C / 65536), he = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), k[0] = j, k[1] = se, k[2] = he, k[3] = xe, k[4] = Te, k[5] = Re, k[6] = nt, k[7] = je, k[8] = pt, k[9] = it, k[10] = et, k[11] = St, k[12] = Tt, k[13] = At, k[14] = _t, k[15] = ht; } - function oe(k, U) { - D(k, U, U); + function oe(k, q) { + D(k, q, q); } - function Z(k, U) { - var z = r(), C; - for (C = 0; C < 16; C++) z[C] = U[C]; + function Z(k, q) { + var W = r(), C; + for (C = 0; C < 16; C++) W[C] = q[C]; for (C = 253; C >= 0; C--) - oe(z, z), C !== 2 && C !== 4 && D(z, z, U); - for (C = 0; C < 16; C++) k[C] = z[C]; + oe(W, W), C !== 2 && C !== 4 && D(W, W, q); + for (C = 0; C < 16; C++) k[C] = W[C]; } - function J(k, U) { - var z = r(), C; - for (C = 0; C < 16; C++) z[C] = U[C]; + function J(k, q) { + var W = r(), C; + for (C = 0; C < 16; C++) W[C] = q[C]; for (C = 250; C >= 0; C--) - oe(z, z), C !== 1 && D(z, z, U); - for (C = 0; C < 16; C++) k[C] = z[C]; + oe(W, W), C !== 1 && D(W, W, q); + for (C = 0; C < 16; C++) k[C] = W[C]; } - function Q(k, U, z) { + function Q(k, q, W) { var C = new Uint8Array(32), G = new Float64Array(80), j, se, he = r(), xe = r(), Te = r(), Re = r(), nt = r(), je = r(); - for (se = 0; se < 31; se++) C[se] = U[se]; - for (C[31] = U[31] & 127 | 64, C[0] &= 248, I(G, z), se = 0; se < 16; se++) + for (se = 0; se < 31; se++) C[se] = q[se]; + for (C[31] = q[31] & 127 | 64, C[0] &= 248, I(G, W), se = 0; se < 16; se++) xe[se] = G[se], Re[se] = he[se] = Te[se] = 0; for (he[0] = Re[0] = 1, se = 254; se >= 0; --se) j = C[se >>> 3] >>> (se & 7) & 1, _(he, xe, j), _(Te, Re, j), F(nt, he, Te), ce(he, he, Te), F(Te, xe, Re), ce(xe, xe, Re), oe(Re, nt), oe(je, he), D(he, Te, he), D(Te, xe, nt), F(nt, he, Te), ce(he, he, Te), oe(xe, he), ce(Te, Re, je), D(he, Te, u), F(he, he, Re), D(Te, Te, he), D(he, Re, je), D(Re, xe, G), oe(xe, nt), _(he, xe, j), _(Te, Re, j); @@ -40461,24 +40475,24 @@ var V9 = { exports: {} }; var pt = G.subarray(32), it = G.subarray(16); return Z(pt, pt), D(it, it, pt), E(k, it), 0; } - function T(k, U) { - return Q(k, U, s); + function T(k, q) { + return Q(k, q, s); } - function X(k, U) { - return n(U, 32), T(k, U); + function X(k, q) { + return n(q, 32), T(k, q); } - function re(k, U, z) { + function re(k, q, W) { var C = new Uint8Array(32); - return Q(C, z, U), V(k, i, C, te); + return Q(C, W, q), V(k, i, C, te); } var de = f, ie = g; - function ue(k, U, z, C, G, j) { + function ue(k, q, W, C, G, j) { var se = new Uint8Array(32); - return re(se, G, j), de(k, U, z, C, se); + return re(se, G, j), de(k, q, W, C, se); } - function ve(k, U, z, C, G, j) { + function ve(k, q, W, C, G, j) { var se = new Uint8Array(32); - return re(se, G, j), ie(k, U, z, C, se); + return re(se, G, j), ie(k, q, W, C, se); } var Pe = [ 1116352408, @@ -40642,100 +40656,100 @@ var V9 = { exports: {} }; 1816402316, 1246189591 ]; - function De(k, U, z, C) { - for (var G = new Int32Array(16), j = new Int32Array(16), se, he, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt, ut, ot, Se, Ae, Ve, Fe, Ue, Je, Lt = k[0], zt = k[1], Zt = k[2], Wt = k[3], le = k[4], rr = k[5], dr = k[6], pr = k[7], Qt = U[0], gr = U[1], lr = U[2], Rr = U[3], mr = U[4], yr = U[5], $r = U[6], Br = U[7], Ir = 0; C >= 128; ) { + function De(k, q, W, C) { + for (var G = new Int32Array(16), j = new Int32Array(16), se, he, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt, ut, ot, Se, Ae, Ve, Fe, Ue, Je, Lt = k[0], zt = k[1], Zt = k[2], Wt = k[3], le = k[4], rr = k[5], dr = k[6], pr = k[7], Qt = q[0], gr = q[1], lr = q[2], Rr = q[3], mr = q[4], yr = q[5], $r = q[6], Br = q[7], Ir = 0; C >= 128; ) { for (ut = 0; ut < 16; ut++) - ot = 8 * ut + Ir, G[ut] = z[ot + 0] << 24 | z[ot + 1] << 16 | z[ot + 2] << 8 | z[ot + 3], j[ut] = z[ot + 4] << 24 | z[ot + 5] << 16 | z[ot + 6] << 8 | z[ot + 7]; + ot = 8 * ut + Ir, G[ut] = W[ot + 0] << 24 | W[ot + 1] << 16 | W[ot + 2] << 8 | W[ot + 3], j[ut] = W[ot + 4] << 24 | W[ot + 5] << 16 | W[ot + 6] << 8 | W[ot + 7]; for (ut = 0; ut < 80; ut++) if (se = Lt, he = zt, xe = Zt, Te = Wt, Re = le, nt = rr, je = dr, pt = pr, it = Qt, et = gr, St = lr, Tt = Rr, At = mr, _t = yr, ht = $r, xt = Br, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (le >>> 14 | mr << 18) ^ (le >>> 18 | mr << 14) ^ (mr >>> 9 | le << 23), Ae = (mr >>> 14 | le << 18) ^ (mr >>> 18 | le << 14) ^ (le >>> 9 | mr << 23), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = le & rr ^ ~le & dr, Ae = mr & yr ^ ~mr & $r, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Pe[ut * 2], Ae = Pe[ut * 2 + 1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = G[ut % 16], Ae = j[ut % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, st = Ue & 65535 | Je << 16, bt = Ve & 65535 | Fe << 16, Se = st, Ae = bt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (Lt >>> 28 | Qt << 4) ^ (Qt >>> 2 | Lt << 30) ^ (Qt >>> 7 | Lt << 25), Ae = (Qt >>> 28 | Lt << 4) ^ (Lt >>> 2 | Qt << 30) ^ (Lt >>> 7 | Qt << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Lt & zt ^ Lt & Zt ^ zt & Zt, Ae = Qt & gr ^ Qt & lr ^ gr & lr, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, pt = Ue & 65535 | Je << 16, xt = Ve & 65535 | Fe << 16, Se = Te, Ae = Tt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = st, Ae = bt, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, Te = Ue & 65535 | Je << 16, Tt = Ve & 65535 | Fe << 16, zt = se, Zt = he, Wt = xe, le = Te, rr = Re, dr = nt, pr = je, Lt = pt, gr = it, lr = et, Rr = St, mr = Tt, yr = At, $r = _t, Br = ht, Qt = xt, ut % 16 === 15) for (ot = 0; ot < 16; ot++) Se = G[ot], Ae = j[ot], Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = G[(ot + 9) % 16], Ae = j[(ot + 9) % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, st = G[(ot + 1) % 16], bt = j[(ot + 1) % 16], Se = (st >>> 1 | bt << 31) ^ (st >>> 8 | bt << 24) ^ st >>> 7, Ae = (bt >>> 1 | st << 31) ^ (bt >>> 8 | st << 24) ^ (bt >>> 7 | st << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, st = G[(ot + 14) % 16], bt = j[(ot + 14) % 16], Se = (st >>> 19 | bt << 13) ^ (bt >>> 29 | st << 3) ^ st >>> 6, Ae = (bt >>> 19 | st << 13) ^ (st >>> 29 | bt << 3) ^ (bt >>> 6 | st << 26), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, G[ot] = Ue & 65535 | Je << 16, j[ot] = Ve & 65535 | Fe << 16; - Se = Lt, Ae = Qt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[0], Ae = U[0], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[0] = Lt = Ue & 65535 | Je << 16, U[0] = Qt = Ve & 65535 | Fe << 16, Se = zt, Ae = gr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[1], Ae = U[1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[1] = zt = Ue & 65535 | Je << 16, U[1] = gr = Ve & 65535 | Fe << 16, Se = Zt, Ae = lr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[2], Ae = U[2], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[2] = Zt = Ue & 65535 | Je << 16, U[2] = lr = Ve & 65535 | Fe << 16, Se = Wt, Ae = Rr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[3], Ae = U[3], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[3] = Wt = Ue & 65535 | Je << 16, U[3] = Rr = Ve & 65535 | Fe << 16, Se = le, Ae = mr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[4], Ae = U[4], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[4] = le = Ue & 65535 | Je << 16, U[4] = mr = Ve & 65535 | Fe << 16, Se = rr, Ae = yr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[5], Ae = U[5], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[5] = rr = Ue & 65535 | Je << 16, U[5] = yr = Ve & 65535 | Fe << 16, Se = dr, Ae = $r, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[6], Ae = U[6], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[6] = dr = Ue & 65535 | Je << 16, U[6] = $r = Ve & 65535 | Fe << 16, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[7], Ae = U[7], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[7] = pr = Ue & 65535 | Je << 16, U[7] = Br = Ve & 65535 | Fe << 16, Ir += 128, C -= 128; + Se = Lt, Ae = Qt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[0], Ae = q[0], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[0] = Lt = Ue & 65535 | Je << 16, q[0] = Qt = Ve & 65535 | Fe << 16, Se = zt, Ae = gr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[1], Ae = q[1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[1] = zt = Ue & 65535 | Je << 16, q[1] = gr = Ve & 65535 | Fe << 16, Se = Zt, Ae = lr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[2], Ae = q[2], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[2] = Zt = Ue & 65535 | Je << 16, q[2] = lr = Ve & 65535 | Fe << 16, Se = Wt, Ae = Rr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[3], Ae = q[3], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[3] = Wt = Ue & 65535 | Je << 16, q[3] = Rr = Ve & 65535 | Fe << 16, Se = le, Ae = mr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[4], Ae = q[4], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[4] = le = Ue & 65535 | Je << 16, q[4] = mr = Ve & 65535 | Fe << 16, Se = rr, Ae = yr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[5], Ae = q[5], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[5] = rr = Ue & 65535 | Je << 16, q[5] = yr = Ve & 65535 | Fe << 16, Se = dr, Ae = $r, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[6], Ae = q[6], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[6] = dr = Ue & 65535 | Je << 16, q[6] = $r = Ve & 65535 | Fe << 16, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[7], Ae = q[7], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[7] = pr = Ue & 65535 | Je << 16, q[7] = Br = Ve & 65535 | Fe << 16, Ir += 128, C -= 128; } return C; } - function Ce(k, U, z) { - var C = new Int32Array(8), G = new Int32Array(8), j = new Uint8Array(256), se, he = z; - for (C[0] = 1779033703, C[1] = 3144134277, C[2] = 1013904242, C[3] = 2773480762, C[4] = 1359893119, C[5] = 2600822924, C[6] = 528734635, C[7] = 1541459225, G[0] = 4089235720, G[1] = 2227873595, G[2] = 4271175723, G[3] = 1595750129, G[4] = 2917565137, G[5] = 725511199, G[6] = 4215389547, G[7] = 327033209, De(C, G, U, z), z %= 128, se = 0; se < z; se++) j[se] = U[he - z + se]; - for (j[z] = 128, z = 256 - 128 * (z < 112 ? 1 : 0), j[z - 9] = 0, M(j, z - 8, he / 536870912 | 0, he << 3), De(C, G, j, z), se = 0; se < 8; se++) M(k, 8 * se, C[se], G[se]); + function Ce(k, q, W) { + var C = new Int32Array(8), G = new Int32Array(8), j = new Uint8Array(256), se, he = W; + for (C[0] = 1779033703, C[1] = 3144134277, C[2] = 1013904242, C[3] = 2773480762, C[4] = 1359893119, C[5] = 2600822924, C[6] = 528734635, C[7] = 1541459225, G[0] = 4089235720, G[1] = 2227873595, G[2] = 4271175723, G[3] = 1595750129, G[4] = 2917565137, G[5] = 725511199, G[6] = 4215389547, G[7] = 327033209, De(C, G, q, W), W %= 128, se = 0; se < W; se++) j[se] = q[he - W + se]; + for (j[W] = 128, W = 256 - 128 * (W < 112 ? 1 : 0), j[W - 9] = 0, M(j, W - 8, he / 536870912 | 0, he << 3), De(C, G, j, W), se = 0; se < 8; se++) M(k, 8 * se, C[se], G[se]); return 0; } - function $e(k, U) { - var z = r(), C = r(), G = r(), j = r(), se = r(), he = r(), xe = r(), Te = r(), Re = r(); - ce(z, k[1], k[0]), ce(Re, U[1], U[0]), D(z, z, Re), F(C, k[0], k[1]), F(Re, U[0], U[1]), D(C, C, Re), D(G, k[3], U[3]), D(G, G, d), D(j, k[2], U[2]), F(j, j, j), ce(se, C, z), ce(he, j, G), F(xe, j, G), F(Te, C, z), D(k[0], se, he), D(k[1], Te, xe), D(k[2], xe, he), D(k[3], se, Te); + function $e(k, q) { + var W = r(), C = r(), G = r(), j = r(), se = r(), he = r(), xe = r(), Te = r(), Re = r(); + ce(W, k[1], k[0]), ce(Re, q[1], q[0]), D(W, W, Re), F(C, k[0], k[1]), F(Re, q[0], q[1]), D(C, C, Re), D(G, k[3], q[3]), D(G, G, d), D(j, k[2], q[2]), F(j, j, j), ce(se, C, W), ce(he, j, G), F(xe, j, G), F(Te, C, W), D(k[0], se, he), D(k[1], Te, xe), D(k[2], xe, he), D(k[3], se, Te); } - function Me(k, U, z) { + function Me(k, q, W) { var C; for (C = 0; C < 4; C++) - _(k[C], U[C], z); + _(k[C], q[C], W); } - function Ne(k, U) { - var z = r(), C = r(), G = r(); - Z(G, U[2]), D(z, U[0], G), D(C, U[1], G), E(k, C), k[31] ^= P(z) << 7; + function Ne(k, q) { + var W = r(), C = r(), G = r(); + Z(G, q[2]), D(W, q[0], G), D(C, q[1], G), E(k, C), k[31] ^= P(W) << 7; } - function Ke(k, U, z) { + function Ke(k, q, W) { var C, G; for (b(k[0], o), b(k[1], a), b(k[2], a), b(k[3], o), G = 255; G >= 0; --G) - C = z[G / 8 | 0] >> (G & 7) & 1, Me(k, U, C), $e(U, k), $e(k, k), Me(k, U, C); + C = W[G / 8 | 0] >> (G & 7) & 1, Me(k, q, C), $e(q, k), $e(k, k), Me(k, q, C); } - function Le(k, U) { - var z = [r(), r(), r(), r()]; - b(z[0], p), b(z[1], w), b(z[2], a), D(z[3], p, w), Ke(k, z, U); + function Le(k, q) { + var W = [r(), r(), r(), r()]; + b(W[0], p), b(W[1], w), b(W[2], a), D(W[3], p, w), Ke(k, W, q); } - function qe(k, U, z) { + function qe(k, q, W) { var C = new Uint8Array(64), G = [r(), r(), r(), r()], j; - for (z || n(U, 32), Ce(C, U, 32), C[0] &= 248, C[31] &= 127, C[31] |= 64, Le(G, C), Ne(k, G), j = 0; j < 32; j++) U[j + 32] = k[j]; + for (W || n(q, 32), Ce(C, q, 32), C[0] &= 248, C[31] &= 127, C[31] |= 64, Le(G, C), Ne(k, G), j = 0; j < 32; j++) q[j + 32] = k[j]; return 0; } var ze = new Float64Array([237, 211, 245, 92, 26, 99, 18, 88, 214, 156, 247, 162, 222, 249, 222, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16]); - function _e(k, U) { - var z, C, G, j; + function _e(k, q) { + var W, C, G, j; for (C = 63; C >= 32; --C) { - for (z = 0, G = C - 32, j = C - 12; G < j; ++G) - U[G] += z - 16 * U[C] * ze[G - (C - 32)], z = Math.floor((U[G] + 128) / 256), U[G] -= z * 256; - U[G] += z, U[C] = 0; + for (W = 0, G = C - 32, j = C - 12; G < j; ++G) + q[G] += W - 16 * q[C] * ze[G - (C - 32)], W = Math.floor((q[G] + 128) / 256), q[G] -= W * 256; + q[G] += W, q[C] = 0; } - for (z = 0, G = 0; G < 32; G++) - U[G] += z - (U[31] >> 4) * ze[G], z = U[G] >> 8, U[G] &= 255; - for (G = 0; G < 32; G++) U[G] -= z * ze[G]; + for (W = 0, G = 0; G < 32; G++) + q[G] += W - (q[31] >> 4) * ze[G], W = q[G] >> 8, q[G] &= 255; + for (G = 0; G < 32; G++) q[G] -= W * ze[G]; for (C = 0; C < 32; C++) - U[C + 1] += U[C] >> 8, k[C] = U[C] & 255; + q[C + 1] += q[C] >> 8, k[C] = q[C] & 255; } function Ze(k) { - var U = new Float64Array(64), z; - for (z = 0; z < 64; z++) U[z] = k[z]; - for (z = 0; z < 64; z++) k[z] = 0; - _e(k, U); + var q = new Float64Array(64), W; + for (W = 0; W < 64; W++) q[W] = k[W]; + for (W = 0; W < 64; W++) k[W] = 0; + _e(k, q); } - function at(k, U, z, C) { + function at(k, q, W, C) { var G = new Uint8Array(64), j = new Uint8Array(64), se = new Uint8Array(64), he, xe, Te = new Float64Array(64), Re = [r(), r(), r(), r()]; Ce(G, C, 32), G[0] &= 248, G[31] &= 127, G[31] |= 64; - var nt = z + 64; - for (he = 0; he < z; he++) k[64 + he] = U[he]; + var nt = W + 64; + for (he = 0; he < W; he++) k[64 + he] = q[he]; for (he = 0; he < 32; he++) k[32 + he] = G[32 + he]; - for (Ce(se, k.subarray(32), z + 32), Ze(se), Le(Re, se), Ne(k, Re), he = 32; he < 64; he++) k[he] = C[he]; - for (Ce(j, k, z + 64), Ze(j), he = 0; he < 64; he++) Te[he] = 0; + for (Ce(se, k.subarray(32), W + 32), Ze(se), Le(Re, se), Ne(k, Re), he = 32; he < 64; he++) k[he] = C[he]; + for (Ce(j, k, W + 64), Ze(j), he = 0; he < 64; he++) Te[he] = 0; for (he = 0; he < 32; he++) Te[he] = se[he]; for (he = 0; he < 32; he++) for (xe = 0; xe < 32; xe++) Te[he + xe] += j[he] * G[xe]; return _e(k.subarray(32), Te), nt; } - function ke(k, U) { - var z = r(), C = r(), G = r(), j = r(), se = r(), he = r(), xe = r(); - return b(k[2], a), I(k[1], U), oe(G, k[1]), D(j, G, l), ce(G, G, k[2]), F(j, k[2], j), oe(se, j), oe(he, se), D(xe, he, se), D(z, xe, G), D(z, z, j), J(z, z), D(z, z, G), D(z, z, j), D(z, z, j), D(k[0], z, j), oe(C, k[0]), D(C, C, j), v(C, G) && D(k[0], k[0], A), oe(C, k[0]), D(C, C, j), v(C, G) ? -1 : (P(k[0]) === U[31] >> 7 && ce(k[0], o, k[0]), D(k[3], k[0], k[1]), 0); + function ke(k, q) { + var W = r(), C = r(), G = r(), j = r(), se = r(), he = r(), xe = r(); + return b(k[2], a), I(k[1], q), oe(G, k[1]), D(j, G, l), ce(G, G, k[2]), F(j, k[2], j), oe(se, j), oe(he, se), D(xe, he, se), D(W, xe, G), D(W, W, j), J(W, W), D(W, W, G), D(W, W, j), D(W, W, j), D(k[0], W, j), oe(C, k[0]), D(C, C, j), v(C, G) && D(k[0], k[0], A), oe(C, k[0]), D(C, C, j), v(C, G) ? -1 : (P(k[0]) === q[31] >> 7 && ce(k[0], o, k[0]), D(k[3], k[0], k[1]), 0); } - function Qe(k, U, z, C) { + function Qe(k, q, W, C) { var G, j = new Uint8Array(32), se = new Uint8Array(64), he = [r(), r(), r(), r()], xe = [r(), r(), r(), r()]; - if (z < 64 || ke(xe, C)) return -1; - for (G = 0; G < z; G++) k[G] = U[G]; + if (W < 64 || ke(xe, C)) return -1; + for (G = 0; G < W; G++) k[G] = q[G]; for (G = 0; G < 32; G++) k[G + 32] = C[G]; - if (Ce(se, k, z), Ze(se), Ke(he, xe, se), Le(xe, U.subarray(32)), $e(he, xe), Ne(j, he), z -= 64, B(U, 0, j, 0)) { - for (G = 0; G < z; G++) k[G] = 0; + if (Ce(se, k, W), Ze(se), Ke(he, xe, se), Le(xe, q.subarray(32)), $e(he, xe), Ne(j, he), W -= 64, $(q, 0, j, 0)) { + for (G = 0; G < W; G++) k[G] = 0; return -1; } - for (G = 0; G < z; G++) k[G] = U[G + 64]; - return z; + for (G = 0; G < W; G++) k[G] = q[G + 64]; + return W; } var tt = 32, Ye = 24, dt = 32, lt = 16, ct = 32, qt = 32, Jt = 32, Et = 32, er = 32, Xt = Ye, Dt = dt, kt = lt, Ct = 64, gt = 32, Rt = 64, Nt = 32, vt = 64; e.lowlevel = { @@ -40747,7 +40761,7 @@ var V9 = { exports: {} }; crypto_onetimeauth: S, crypto_onetimeauth_verify: m, crypto_verify_16: L, - crypto_verify_32: B, + crypto_verify_32: $, crypto_secretbox: f, crypto_secretbox_open: g, crypto_scalarmult: Q, @@ -40794,13 +40808,13 @@ var V9 = { exports: {} }; scalarmult: Ke, scalarbase: Le }; - function $t(k, U) { + function $t(k, q) { if (k.length !== tt) throw new Error("bad key size"); - if (U.length !== Ye) throw new Error("bad nonce size"); + if (q.length !== Ye) throw new Error("bad nonce size"); } - function Ft(k, U) { + function Ft(k, q) { if (k.length !== Jt) throw new Error("bad public key size"); - if (U.length !== Et) throw new Error("bad secret key size"); + if (q.length !== Et) throw new Error("bad secret key size"); } function rt() { for (var k = 0; k < arguments.length; k++) @@ -40808,105 +40822,105 @@ var V9 = { exports: {} }; throw new TypeError("unexpected type, use Uint8Array"); } function Bt(k) { - for (var U = 0; U < k.length; U++) k[U] = 0; + for (var q = 0; q < k.length; q++) k[q] = 0; } e.randomBytes = function(k) { - var U = new Uint8Array(k); - return n(U, k), U; - }, e.secretbox = function(k, U, z) { - rt(k, U, z), $t(z, U); + var q = new Uint8Array(k); + return n(q, k), q; + }, e.secretbox = function(k, q, W) { + rt(k, q, W), $t(W, q); for (var C = new Uint8Array(dt + k.length), G = new Uint8Array(C.length), j = 0; j < k.length; j++) C[j + dt] = k[j]; - return f(G, C, C.length, U, z), G.subarray(lt); - }, e.secretbox.open = function(k, U, z) { - rt(k, U, z), $t(z, U); + return f(G, C, C.length, q, W), G.subarray(lt); + }, e.secretbox.open = function(k, q, W) { + rt(k, q, W), $t(W, q); for (var C = new Uint8Array(lt + k.length), G = new Uint8Array(C.length), j = 0; j < k.length; j++) C[j + lt] = k[j]; - return C.length < 32 || g(G, C, C.length, U, z) !== 0 ? null : G.subarray(dt); - }, e.secretbox.keyLength = tt, e.secretbox.nonceLength = Ye, e.secretbox.overheadLength = lt, e.scalarMult = function(k, U) { - if (rt(k, U), k.length !== qt) throw new Error("bad n size"); - if (U.length !== ct) throw new Error("bad p size"); - var z = new Uint8Array(ct); - return Q(z, k, U), z; + return C.length < 32 || g(G, C, C.length, q, W) !== 0 ? null : G.subarray(dt); + }, e.secretbox.keyLength = tt, e.secretbox.nonceLength = Ye, e.secretbox.overheadLength = lt, e.scalarMult = function(k, q) { + if (rt(k, q), k.length !== qt) throw new Error("bad n size"); + if (q.length !== ct) throw new Error("bad p size"); + var W = new Uint8Array(ct); + return Q(W, k, q), W; }, e.scalarMult.base = function(k) { if (rt(k), k.length !== qt) throw new Error("bad n size"); - var U = new Uint8Array(ct); - return T(U, k), U; - }, e.scalarMult.scalarLength = qt, e.scalarMult.groupElementLength = ct, e.box = function(k, U, z, C) { - var G = e.box.before(z, C); - return e.secretbox(k, U, G); - }, e.box.before = function(k, U) { - rt(k, U), Ft(k, U); - var z = new Uint8Array(er); - return re(z, k, U), z; - }, e.box.after = e.secretbox, e.box.open = function(k, U, z, C) { - var G = e.box.before(z, C); - return e.secretbox.open(k, U, G); + var q = new Uint8Array(ct); + return T(q, k), q; + }, e.scalarMult.scalarLength = qt, e.scalarMult.groupElementLength = ct, e.box = function(k, q, W, C) { + var G = e.box.before(W, C); + return e.secretbox(k, q, G); + }, e.box.before = function(k, q) { + rt(k, q), Ft(k, q); + var W = new Uint8Array(er); + return re(W, k, q), W; + }, e.box.after = e.secretbox, e.box.open = function(k, q, W, C) { + var G = e.box.before(W, C); + return e.secretbox.open(k, q, G); }, e.box.open.after = e.secretbox.open, e.box.keyPair = function() { - var k = new Uint8Array(Jt), U = new Uint8Array(Et); - return X(k, U), { publicKey: k, secretKey: U }; + var k = new Uint8Array(Jt), q = new Uint8Array(Et); + return X(k, q), { publicKey: k, secretKey: q }; }, e.box.keyPair.fromSecretKey = function(k) { if (rt(k), k.length !== Et) throw new Error("bad secret key size"); - var U = new Uint8Array(Jt); - return T(U, k), { publicKey: U, secretKey: new Uint8Array(k) }; - }, e.box.publicKeyLength = Jt, e.box.secretKeyLength = Et, e.box.sharedKeyLength = er, e.box.nonceLength = Xt, e.box.overheadLength = e.secretbox.overheadLength, e.sign = function(k, U) { - if (rt(k, U), U.length !== Rt) + var q = new Uint8Array(Jt); + return T(q, k), { publicKey: q, secretKey: new Uint8Array(k) }; + }, e.box.publicKeyLength = Jt, e.box.secretKeyLength = Et, e.box.sharedKeyLength = er, e.box.nonceLength = Xt, e.box.overheadLength = e.secretbox.overheadLength, e.sign = function(k, q) { + if (rt(k, q), q.length !== Rt) throw new Error("bad secret key size"); - var z = new Uint8Array(Ct + k.length); - return at(z, k, k.length, U), z; - }, e.sign.open = function(k, U) { - if (rt(k, U), U.length !== gt) + var W = new Uint8Array(Ct + k.length); + return at(W, k, k.length, q), W; + }, e.sign.open = function(k, q) { + if (rt(k, q), q.length !== gt) throw new Error("bad public key size"); - var z = new Uint8Array(k.length), C = Qe(z, k, k.length, U); + var W = new Uint8Array(k.length), C = Qe(W, k, k.length, q); if (C < 0) return null; - for (var G = new Uint8Array(C), j = 0; j < G.length; j++) G[j] = z[j]; + for (var G = new Uint8Array(C), j = 0; j < G.length; j++) G[j] = W[j]; return G; - }, e.sign.detached = function(k, U) { - for (var z = e.sign(k, U), C = new Uint8Array(Ct), G = 0; G < C.length; G++) C[G] = z[G]; + }, e.sign.detached = function(k, q) { + for (var W = e.sign(k, q), C = new Uint8Array(Ct), G = 0; G < C.length; G++) C[G] = W[G]; return C; - }, e.sign.detached.verify = function(k, U, z) { - if (rt(k, U, z), U.length !== Ct) + }, e.sign.detached.verify = function(k, q, W) { + if (rt(k, q, W), q.length !== Ct) throw new Error("bad signature size"); - if (z.length !== gt) + if (W.length !== gt) throw new Error("bad public key size"); var C = new Uint8Array(Ct + k.length), G = new Uint8Array(Ct + k.length), j; - for (j = 0; j < Ct; j++) C[j] = U[j]; + for (j = 0; j < Ct; j++) C[j] = q[j]; for (j = 0; j < k.length; j++) C[j + Ct] = k[j]; - return Qe(G, C, C.length, z) >= 0; + return Qe(G, C, C.length, W) >= 0; }, e.sign.keyPair = function() { - var k = new Uint8Array(gt), U = new Uint8Array(Rt); - return qe(k, U), { publicKey: k, secretKey: U }; + var k = new Uint8Array(gt), q = new Uint8Array(Rt); + return qe(k, q), { publicKey: k, secretKey: q }; }, e.sign.keyPair.fromSecretKey = function(k) { if (rt(k), k.length !== Rt) throw new Error("bad secret key size"); - for (var U = new Uint8Array(gt), z = 0; z < U.length; z++) U[z] = k[32 + z]; - return { publicKey: U, secretKey: new Uint8Array(k) }; + for (var q = new Uint8Array(gt), W = 0; W < q.length; W++) q[W] = k[32 + W]; + return { publicKey: q, secretKey: new Uint8Array(k) }; }, e.sign.keyPair.fromSeed = function(k) { if (rt(k), k.length !== Nt) throw new Error("bad seed size"); - for (var U = new Uint8Array(gt), z = new Uint8Array(Rt), C = 0; C < 32; C++) z[C] = k[C]; - return qe(U, z, !0), { publicKey: U, secretKey: z }; + for (var q = new Uint8Array(gt), W = new Uint8Array(Rt), C = 0; C < 32; C++) W[C] = k[C]; + return qe(q, W, !0), { publicKey: q, secretKey: W }; }, e.sign.publicKeyLength = gt, e.sign.secretKeyLength = Rt, e.sign.seedLength = Nt, e.sign.signatureLength = Ct, e.hash = function(k) { rt(k); - var U = new Uint8Array(vt); - return Ce(U, k, k.length), U; - }, e.hash.hashLength = vt, e.verify = function(k, U) { - return rt(k, U), k.length === 0 || U.length === 0 || k.length !== U.length ? !1 : N(k, 0, U, 0, k.length) === 0; + var q = new Uint8Array(vt); + return Ce(q, k, k.length), q; + }, e.hash.hashLength = vt, e.verify = function(k, q) { + return rt(k, q), k.length === 0 || q.length === 0 || k.length !== q.length ? !1 : N(k, 0, q, 0, k.length) === 0; }, e.setPRNG = function(k) { n = k; }, function() { var k = typeof self < "u" ? self.crypto || self.msCrypto : null; if (k && k.getRandomValues) { - var U = 65536; - e.setPRNG(function(z, C) { + var q = 65536; + e.setPRNG(function(W, C) { var G, j = new Uint8Array(C); - for (G = 0; G < C; G += U) - k.getRandomValues(j.subarray(G, G + Math.min(C - G, U))); - for (G = 0; G < C; G++) z[G] = j[G]; + for (G = 0; G < C; G += q) + k.getRandomValues(j.subarray(G, G + Math.min(C - G, q))); + for (G = 0; G < C; G++) W[G] = j[G]; Bt(j); }); - } else typeof P4 < "u" && (k = Wl, k && k.randomBytes && e.setPRNG(function(z, C) { + } else typeof M4 < "u" && (k = Wl, k && k.randomBytes && e.setPRNG(function(W, C) { var G, j = k.randomBytes(C); - for (G = 0; G < C; G++) z[G] = j[G]; + for (G = 0; G < C; G++) W[G] = j[G]; Bt(j); })); }(); @@ -40918,26 +40932,26 @@ var fa; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.MANIFEST_NOT_FOUND_ERROR = 2] = "MANIFEST_NOT_FOUND_ERROR", t[t.MANIFEST_CONTENT_ERROR = 3] = "MANIFEST_CONTENT_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; })(fa || (fa = {})); -var h5; +var d5; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(h5 || (h5 = {})); +})(d5 || (d5 = {})); var su; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; })(su || (su = {})); -var d5; -(function(t) { - t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(d5 || (d5 = {})); var p5; (function(t) { - t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; + t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; })(p5 || (p5 = {})); var g5; (function(t) { - t.MAINNET = "-239", t.TESTNET = "-3"; + t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; })(g5 || (g5 = {})); +var m5; +(function(t) { + t.MAINNET = "-239", t.TESTNET = "-3"; +})(m5 || (m5 = {})); function gie(t, e) { const r = Dl.encodeBase64(t); return e ? encodeURIComponent(r) : r; @@ -40995,7 +41009,7 @@ function A0(t) { e[r / 2] = parseInt(t.slice(r, r + 2), 16); return e; } -class dv { +class pv { constructor(e) { this.nonceLength = 24, this.keyPair = e ? this.createKeypairFromString(e) : this.createKeypair(), this.sessionId = Km(this.keyPair.publicKey); } @@ -41091,12 +41105,12 @@ class jt extends Error { } } jt.prefix = "[TON_CONNECT_SDK_ERROR]"; -class fy extends jt { +class ly extends jt { get info() { return "Passed DappMetadata is in incorrect format."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, fy.prototype); + super(...e), Object.setPrototypeOf(this, ly.prototype); } } class Ap extends jt { @@ -41115,12 +41129,12 @@ class Pp extends jt { super(...e), Object.setPrototypeOf(this, Pp.prototype); } } -class ly extends jt { +class hy extends jt { get info() { return "Wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, ly.prototype); + super(...e), Object.setPrototypeOf(this, hy.prototype); } } class P0 extends jt { @@ -41158,20 +41172,20 @@ class Cp extends jt { super(...e), Object.setPrototypeOf(this, Cp.prototype); } } -class hy extends jt { +class dy extends jt { get info() { return "There is an attempt to connect to the injected wallet while it is not exists in the webpage."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, hy.prototype); + super(...e), Object.setPrototypeOf(this, dy.prototype); } } -class dy extends jt { +class py extends jt { get info() { return "An error occurred while fetching the wallets list."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, dy.prototype); + super(...e), Object.setPrototypeOf(this, py.prototype); } } class Ea extends jt { @@ -41179,7 +41193,7 @@ class Ea extends jt { super(...e), Object.setPrototypeOf(this, Ea.prototype); } } -const m5 = { +const v5 = { [fa.UNKNOWN_ERROR]: Ea, [fa.USER_REJECTS_ERROR]: Mp, [fa.BAD_REQUEST_ERROR]: Ip, @@ -41190,7 +41204,7 @@ const m5 = { class Eie { parseError(e) { let r = Ea; - return e.code in m5 && (r = m5[e.code] || Ea), new r(e.message); + return e.code in v5 && (r = v5[e.code] || Ea), new r(e.message); } } const Sie = new Eie(); @@ -41199,7 +41213,7 @@ class Aie { return "error" in e; } } -const v5 = { +const b5 = { [su.UNKNOWN_ERROR]: Ea, [su.USER_REJECTS_ERROR]: Mp, [su.BAD_REQUEST_ERROR]: Ip, @@ -41214,7 +41228,7 @@ class Pie extends Aie { } parseAndThrowError(e) { let r = Ea; - throw e.error.code in v5 && (r = v5[e.error.code] || Ea), new r(e.error.message); + throw e.error.code in b5 && (r = b5[e.error.code] || Ea), new r(e.error.message); } convertFromRpcResponse(e) { return { @@ -41585,7 +41599,7 @@ class Ol { if (r.type === "injected") return r; if ("connectEvent" in r) { - const n = new dv(r.session.sessionKeyPair); + const n = new pv(r.session.sessionKeyPair); return { type: "http", connectEvent: r.connectEvent, @@ -41600,7 +41614,7 @@ class Ol { } return { type: "http", - sessionCrypto: new dv(r.sessionCrypto), + sessionCrypto: new pv(r.sessionCrypto), connectionSource: r.connectionSource }; }); @@ -41688,7 +41702,7 @@ class Nl { var n; const i = _s(r == null ? void 0 : r.signal); (n = this.abortController) === null || n === void 0 || n.abort(), this.abortController = i, this.closeGateways(); - const s = new dv(); + const s = new pv(); this.session = { sessionCrypto: s, bridgeUrl: "bridgeUrl" in this.walletConnectionSource ? this.walletConnectionSource.bridgeUrl : "" @@ -41912,7 +41926,7 @@ class Nl { (r = this.gateway) === null || r === void 0 || r.close(), this.pendingGateways.filter((n) => n !== (e == null ? void 0 : e.except)).forEach((n) => n.close()), this.pendingGateways = []; } } -function b5(t, e) { +function y5(t, e) { return Z9(t, [e]); } function Z9(t, e) { @@ -41920,7 +41934,7 @@ function Z9(t, e) { } function Lie(t) { try { - return !b5(t, "tonconnect") || !b5(t.tonconnect, "walletInfo") ? !1 : Z9(t.tonconnect.walletInfo, [ + return !y5(t, "tonconnect") || !y5(t.tonconnect, "walletInfo") ? !1 : Z9(t.tonconnect.walletInfo, [ "name", "app_name", "image", @@ -42000,25 +42014,25 @@ function jie() { function Uie() { return typeof process < "u" && process.versions != null && process.versions.node != null; } -class vi { +class bi { constructor(e, r) { this.injectedWalletKey = r, this.type = "injected", this.unsubscribeCallback = null, this.listenSubscriptions = !1, this.listeners = []; - const n = vi.window; - if (!vi.isWindowContainsWallet(n, r)) - throw new hy(); + const n = bi.window; + if (!bi.isWindowContainsWallet(n, r)) + throw new dy(); this.connectionStorage = new Ol(e), this.injectedWallet = n[r].tonconnect; } static fromStorage(e) { return Mt(this, void 0, void 0, function* () { const n = yield new Ol(e).getInjectedConnection(); - return new vi(e, n.jsBridgeKey); + return new bi(e, n.jsBridgeKey); }); } static isWalletInjected(e) { - return vi.isWindowContainsWallet(this.window, e); + return bi.isWindowContainsWallet(this.window, e); } static isInsideWalletBrowser(e) { - return vi.isWindowContainsWallet(this.window, e) ? this.window[e].tonconnect.isWalletBrowser : !1; + return bi.isWindowContainsWallet(this.window, e) ? this.window[e].tonconnect.isWalletBrowser : !1; } static getCurrentlyInjectedWallets() { return this.window ? kie().filter(([n, i]) => Lie(i)).map(([n, i]) => ({ @@ -42120,7 +42134,7 @@ class vi { }); } } -vi.window = Tp(); +bi.window = Tp(); class qie { constructor() { this.localStorage = Fie(); @@ -42350,7 +42364,7 @@ const Hie = [ platforms: ["chrome", "safari", "firefox", "ios", "android"] } ]; -class pv { +class gv { constructor(e) { this.walletsListCache = null, this.walletsListCacheCreationTimestamp = null, this.walletsListSource = "https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json", e != null && e.walletsListSource && (this.walletsListSource = e.walletsListSource), e != null && e.cacheTTLMs && (this.cacheTTLMs = e.cacheTTLMs); } @@ -42374,7 +42388,7 @@ class pv { let e = []; try { if (e = yield (yield fetch(this.walletsListSource)).json(), !Array.isArray(e)) - throw new dy("Wrong wallets list format, wallets list must be an array."); + throw new py("Wrong wallets list format, wallets list must be an array."); const i = e.filter((s) => !this.isCorrectWalletConfigDTO(s)); i.length && (No(`Wallet(s) ${i.map((s) => s.name).join(", ")} config format is wrong. They were removed from the wallets list.`), e = e.filter((s) => this.isCorrectWalletConfigDTO(s))); } catch (n) { @@ -42382,7 +42396,7 @@ class pv { } let r = []; try { - r = vi.getCurrentlyInjectedWallets(); + r = bi.getCurrentlyInjectedWallets(); } catch (n) { No(n); } @@ -42402,7 +42416,7 @@ class pv { return r.bridge.forEach((s) => { if (s.type === "sse" && (i.bridgeUrl = s.url, i.universalLink = r.universal_url, i.deepLink = r.deepLink), s.type === "js") { const o = s.key; - i.jsBridgeKey = o, i.injected = vi.isWalletInjected(o), i.embedded = vi.isInsideWalletBrowser(o); + i.jsBridgeKey = o, i.injected = bi.isWalletInjected(o), i.embedded = bi.isInsideWalletBrowser(o); } }), i; }); @@ -42512,7 +42526,7 @@ function ese(t, e) { custom_data: Yu(t) }; } -function py(t, e) { +function gy(t, e) { var r, n, i, s; return { valid_until: (r = String(e.validUntil)) !== null && r !== void 0 ? r : null, @@ -42527,13 +42541,13 @@ function py(t, e) { }; } function tse(t, e, r) { - return Object.assign(Object.assign({ type: "transaction-sent-for-signature" }, Ju(t, e)), py(e, r)); + return Object.assign(Object.assign({ type: "transaction-sent-for-signature" }, Ju(t, e)), gy(e, r)); } function rse(t, e, r, n) { - return Object.assign(Object.assign({ type: "transaction-signed", is_success: !0, signed_transaction: n.boc }, Ju(t, e)), py(e, r)); + return Object.assign(Object.assign({ type: "transaction-signed", is_success: !0, signed_transaction: n.boc }, Ju(t, e)), gy(e, r)); } function nse(t, e, r, n, i) { - return Object.assign(Object.assign({ type: "transaction-signing-failed", is_success: !1, error_message: n, error_code: i ?? null }, Ju(t, e)), py(e, r)); + return Object.assign(Object.assign({ type: "transaction-signing-failed", is_success: !1, error_message: n, error_code: i ?? null }, Ju(t, e)), gy(e, r)); } function ise(t, e, r) { return Object.assign({ type: "disconnection", scope: r }, Ju(t, e)); @@ -42750,17 +42764,17 @@ class ose { const ase = "3.0.5"; class fh { constructor(e) { - if (this.walletsList = new pv(), this._wallet = null, this.provider = null, this.statusChangeSubscriptions = [], this.statusChangeErrorSubscriptions = [], this.dappSettings = { + if (this.walletsList = new gv(), this._wallet = null, this.provider = null, this.statusChangeSubscriptions = [], this.statusChangeErrorSubscriptions = [], this.dappSettings = { manifestUrl: (e == null ? void 0 : e.manifestUrl) || Bie(), storage: (e == null ? void 0 : e.storage) || new qie() - }, this.walletsList = new pv({ + }, this.walletsList = new gv({ walletsListSource: e == null ? void 0 : e.walletsListSource, cacheTTLMs: e == null ? void 0 : e.walletsListCacheTTLMs }), this.tracker = new ose({ eventDispatcher: e == null ? void 0 : e.eventDispatcher, tonConnectSdkVersion: ase }), !this.dappSettings.manifestUrl) - throw new fy("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"); + throw new ly("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"); this.bridgeConnectionStorage = new Ol(this.dappSettings.storage), e != null && e.disableAutoPauseConnection || this.addWindowFocusAndBlurSubscriptions(); } /** @@ -42812,7 +42826,7 @@ class fh { var n, i; const s = {}; if (typeof r == "object" && "tonProof" in r && (s.request = r), typeof r == "object" && ("openingDeadlineMS" in r || "signal" in r || "request" in r) && (s.request = r == null ? void 0 : r.request, s.openingDeadlineMS = r == null ? void 0 : r.openingDeadlineMS, s.signal = r == null ? void 0 : r.signal), this.connected) - throw new ly(); + throw new hy(); const o = _s(s == null ? void 0 : s.signal); if ((n = this.abortController) === null || n === void 0 || n.abort(), this.abortController = o, o.signal.aborted) throw new jt("Connection was aborted"); @@ -42851,7 +42865,7 @@ class fh { a = yield Nl.fromStorage(this.dappSettings.storage); break; case "injected": - a = yield vi.fromStorage(this.dappSettings.storage); + a = yield bi.fromStorage(this.dappSettings.storage); break; default: if (o) @@ -42957,7 +42971,7 @@ class fh { } createProvider(e) { let r; - return !Array.isArray(e) && _ie(e) ? r = new vi(this.dappSettings.storage, e.jsBridgeKey) : r = new Nl(this.dappSettings.storage, e), r.listen(this.walletEventsListener.bind(this)), r; + return !Array.isArray(e) && _ie(e) ? r = new bi(this.dappSettings.storage, e.jsBridgeKey) : r = new Nl(this.dappSettings.storage, e), r.listen(this.walletEventsListener.bind(this)), r; } walletEventsListener(e) { switch (e.event) { @@ -43016,9 +43030,9 @@ class fh { }; } } -fh.walletsList = new pv(); -fh.isWalletInjected = (t) => vi.isWalletInjected(t); -fh.isInsideWalletBrowser = (t) => vi.isInsideWalletBrowser(t); +fh.walletsList = new gv(); +fh.isWalletInjected = (t) => bi.isWalletInjected(t); +fh.isInsideWalletBrowser = (t) => bi.isInsideWalletBrowser(t); for (let t = 0; t <= 255; t++) { let e = t.toString(16); e.length < 2 && (e = "0" + e); @@ -43035,7 +43049,7 @@ function eA(t) { data: K }); } - async function B() { + async function $() { A(!0); try { a(""); @@ -43055,7 +43069,7 @@ function eA(t) { } A(!1); } - function $() { + function B() { s.current = new F9({ width: 264, height: 264, @@ -43078,7 +43092,7 @@ function eA(t) { request: { tonProof: u } }); } - function W() { + function U() { if ("deepLink" in e) { if (!e.deepLink || !M) return; const K = new URL(M), ge = `${e.deepLink}${K.search}`; @@ -43088,9 +43102,9 @@ function eA(t) { function V() { "universalLink" in e && e.universalLink && /t.me/.test(e.universalLink) && window.open(M); } - const te = wi(() => !!("deepLink" in e && e.deepLink), [e]), R = wi(() => !!("universalLink" in e && e.universalLink && /t.me/.test(e.universalLink)), [e]); + const te = ci(() => !!("deepLink" in e && e.deepLink), [e]), R = ci(() => !!("universalLink" in e && e.universalLink && /t.me/.test(e.universalLink)), [e]); return Dn(() => { - $(), B(); + B(), $(); }, []), /* @__PURE__ */ pe.jsxs(Ms, { children: [ /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ pe.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), /* @__PURE__ */ pe.jsxs("div", { className: "xc-text-center xc-mb-6", children: [ @@ -43107,8 +43121,8 @@ function eA(t) { /* @__PURE__ */ pe.jsx(gZ, { className: "xc-opacity-80" }), "Extension" ] }), - te && /* @__PURE__ */ pe.jsxs(Gm, { onClick: W, children: [ - /* @__PURE__ */ pe.jsx(HS, { className: "xc-opacity-80" }), + te && /* @__PURE__ */ pe.jsxs(Gm, { onClick: U, children: [ + /* @__PURE__ */ pe.jsx(KS, { className: "xc-opacity-80" }), "Desktop" ] }), R && /* @__PURE__ */ pe.jsx(Gm, { onClick: V, children: "Telegram Mini App" }) @@ -43117,7 +43131,7 @@ function eA(t) { ] }); } function cse(t) { - const [e, r] = Yt(""), [n, i] = Yt(), [s, o] = Yt(), a = uy(), [u, l] = Yt(!1); + const [e, r] = Yt(""), [n, i] = Yt(), [s, o] = Yt(), a = fy(), [u, l] = Yt(!1); async function d(w) { var M, N; if (!w || !((M = w.connectItems) != null && M.tonProof)) return; @@ -43172,7 +43186,7 @@ function cse(t) { ] }); } function tA(t) { - const { children: e, className: r } = t, n = Zn(null), [i, s] = gv.useState(0); + const { children: e, className: r } = t, n = Zn(null), [i, s] = mv.useState(0); function o() { var a; try { @@ -43215,7 +43229,7 @@ function use() { ] }); } function rA(t) { - const { wallets: e } = mp(), [r, n] = Yt(), i = wi(() => r ? e.filter((a) => a.key.toLowerCase().includes(r.toLowerCase())) : e, [r]); + const { wallets: e } = mp(), [r, n] = Yt(), i = ci(() => r ? e.filter((a) => a.key.toLowerCase().includes(r.toLowerCase())) : e, [r]); function s(a) { t.onSelectWallet(a); } @@ -43225,11 +43239,11 @@ function rA(t) { return /* @__PURE__ */ pe.jsxs(Ms, { children: [ /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ pe.jsx(Pc, { title: "Select wallet", onBack: t.onBack }) }), /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ - /* @__PURE__ */ pe.jsx(KS, { className: "xc-shrink-0 xc-opacity-50" }), + /* @__PURE__ */ pe.jsx(VS, { className: "xc-shrink-0 xc-opacity-50" }), /* @__PURE__ */ pe.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: o }) ] }), /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: i.length ? i.map((a) => /* @__PURE__ */ pe.jsx( - y9, + hv, { wallet: a, onClick: s @@ -43240,14 +43254,14 @@ function rA(t) { } function woe(t) { const { onLogin: e, header: r, showEmailSignIn: n = !0, showMoreWallets: i = !0, showTonConnect: s = !0, showFeaturedWallets: o = !0 } = t, [a, u] = Yt(""), [l, d] = Yt(null), [p, w] = Yt(""); - function A(B) { - d(B), u("evm-wallet"); + function A($) { + d($), u("evm-wallet"); } - function M(B) { - u("email"), w(B); + function M($) { + u("email"), w($); } - async function N(B) { - await e(B); + async function N($) { + await e($); } function L() { u("ton-wallet"); @@ -43339,35 +43353,40 @@ function xoe(t) { showMoreWallets: !0, showTonConnect: !0 } } = t, [s, o] = Yt(""), [a, u] = Yt(), [l, d] = Yt(), p = Zn(), [w, A] = Yt(""); - function M(H) { - u(H), o("evm-wallet-connect"); + function M(U) { + u(U), o("evm-wallet-connect"); } - function N(H) { - A(H), o("email-connect"); + function N(U) { + A(U), o("email-connect"); } - async function L(H, W) { - await e({ + async function L(U, V) { + await (e == null ? void 0 : e({ chain_type: "eip155", - client: H.client, - connect_info: W - }), o("index"); + client: U.client, + connect_info: V, + wallet: U + })), o("index"); + } + async function $(U, V) { + await (n == null ? void 0 : n(U, V)); } - function B(H) { - d(H), o("ton-wallet-connect"); + function B(U) { + d(U), o("ton-wallet-connect"); } - async function $(H) { - H && await r({ + async function H(U) { + U && await (r == null ? void 0 : r({ chain_type: "ton", client: p.current, - connect_info: H - }); + connect_info: U, + wallet: U + })); } return Dn(() => { p.current = new fh({ manifestUrl: "https://static.codatta.io/static/tonconnect-manifest.json?v=2" }); - const H = p.current.onStatusChange($); - return o("index"), H; + const U = p.current.onStatusChange(H); + return o("index"), U; }, []), /* @__PURE__ */ pe.jsxs(tA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ s === "evm-wallet-select" && /* @__PURE__ */ pe.jsx( rA, @@ -43400,7 +43419,7 @@ function xoe(t) { onBack: () => o("index") } ), - s === "email-connect" && /* @__PURE__ */ pe.jsx(lse, { email: w, onBack: () => o("index"), onInputCode: n }), + s === "email-connect" && /* @__PURE__ */ pe.jsx(lse, { email: w, onBack: () => o("index"), onInputCode: $ }), s === "index" && /* @__PURE__ */ pe.jsx( M9, { @@ -43415,7 +43434,8 @@ function xoe(t) { } export { boe as C, - C5 as H, + T5 as H, + vl as W, aZ as a, Ll as b, mse as c, @@ -43424,7 +43444,7 @@ export { xoe as f, gse as h, vse as r, - n4 as s, + i4 as s, C0 as t, mp as u }; diff --git a/dist/main.d.ts b/dist/main.d.ts index 8d36622..545843f 100644 --- a/dist/main.d.ts +++ b/dist/main.d.ts @@ -1,3 +1,4 @@ export * from './codatta-connect-context-provider'; export * from './codatta-signin'; export * from './codatta-connect'; +export * from './types/wallet-item.class'; diff --git a/dist/secp256k1-CNxaHocU.js b/dist/secp256k1-DuMBhiq0.js similarity index 99% rename from dist/secp256k1-CNxaHocU.js rename to dist/secp256k1-DuMBhiq0.js index 8bd2ea5..2be3b1b 100644 --- a/dist/secp256k1-CNxaHocU.js +++ b/dist/secp256k1-DuMBhiq0.js @@ -1,4 +1,4 @@ -import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-C4Op-TDI.js"; +import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-BN1nTxTF.js"; class Kt extends ee { constructor(n, t) { super(), this.finished = !1, this.destroyed = !1, ne(n); diff --git a/lib/codatta-connect-context-provider.tsx b/lib/codatta-connect-context-provider.tsx index 38914f9..58a09d8 100644 --- a/lib/codatta-connect-context-provider.tsx +++ b/lib/codatta-connect-context-provider.tsx @@ -116,6 +116,7 @@ export function CodattaConnectContextProvider(props: CodattaConnectContextProvid walletMap.set(walletItem.key, walletItem) wallets.push(walletItem) } + console.log(detail) }) // handle last used wallet info and restore walletconnect UniveralProvider diff --git a/lib/codatta-connect.tsx b/lib/codatta-connect.tsx index fca22e1..63df861 100644 --- a/lib/codatta-connect.tsx +++ b/lib/codatta-connect.tsx @@ -14,19 +14,21 @@ import { WalletClient } from 'viem' export interface EmvWalletConnectInfo { chain_type: 'eip155' client: WalletClient, - connect_info: WalletSignInfo + connect_info: WalletSignInfo, + wallet: WalletItem } export interface TonWalletConnectInfo { chain_type: 'ton' client: TonConnect, - connect_info: Wallet + connect_info: Wallet, + wallet: Wallet } export function CodattaConnect(props: { - onEvmWalletConnect: (connectInfo:EmvWalletConnectInfo) => Promise - onTonWalletConnect: (connectInfo:TonWalletConnectInfo) => Promise - onEmailConnect: (email:string, code:string) => Promise + onEvmWalletConnect?: (connectInfo:EmvWalletConnectInfo) => Promise + onTonWalletConnect?: (connectInfo:TonWalletConnectInfo) => Promise + onEmailConnect?: (email:string, code:string) => Promise config?: { showEmailSignIn?: boolean showFeaturedWallets?: boolean @@ -57,14 +59,19 @@ export function CodattaConnect(props: { } async function handleConnect(wallet: WalletItem, signInfo: WalletSignInfo) { - await onEvmWalletConnect({ + await onEvmWalletConnect?.({ chain_type: 'eip155', client: wallet.client!, connect_info: signInfo, + wallet: wallet, }) setStep('index') } + async function handleEmailConnect(email: string, code: string) { + await onEmailConnect?.(email, code) + } + function handleSelectTonWallet(wallet: WalletInfoRemote | WalletInfoInjectable) { setTonWallet(wallet) setStep('ton-wallet-connect') @@ -72,10 +79,11 @@ export function CodattaConnect(props: { async function handleStatusChange(wallet: Wallet | null) { if (!wallet) return - await onTonWalletConnect({ + await onTonWalletConnect?.({ chain_type: 'ton', client: connector.current!, - connect_info: wallet + connect_info: wallet, + wallet: wallet, }) } @@ -120,7 +128,7 @@ export function CodattaConnect(props: { > )} {step === 'email-connect' && ( - setStep('index')} onInputCode={onEmailConnect} /> + setStep('index')} onInputCode={handleEmailConnect} /> )} {step === 'index' && ( { + return featuredWallets?.find((item) => item.config?.rdns === 'binance') + }, [featuredWallets]) + const isEmail = useMemo(() => { const hasChinese = /[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu @@ -70,41 +74,56 @@ export default function SingInIndex(props: { return ( {initialized && <> - - {props.header ||
Log in or sign up
} -
-
- {config.showFeaturedWallets && featuredWallets && - featuredWallets.map((wallet) => ( - - ))} - {config.showTonConnect && ( - } - title="TON Connect" - onClick={onSelectTonConnect} - > - )} -
- {config.showMoreWallets && } -
+ {props.header ||
Log in or sign up
} - {config.showEmailSignIn && (config.showFeaturedWallets || config.showTonConnect) &&
- OR -
+ {/* if in binance wallet, show binance wallet */} + {binanceWallet && ( +
+ +
+ ) } - {config.showEmailSignIn && ( -
- - + {/* if not in binance wallet, show other wallets */} + {!binanceWallet && <> +
+
+ {config.showFeaturedWallets && featuredWallets && + featuredWallets.map((wallet) => ( + + ))} + {config.showTonConnect && ( + } + title="TON Connect" + onClick={onSelectTonConnect} + > + )} +
+ {config.showMoreWallets && }
- )} + + {config.showEmailSignIn && (config.showFeaturedWallets || config.showTonConnect) &&
+ OR +
+ } + + {config.showEmailSignIn && ( +
+ + +
+ )} + } } ) diff --git a/lib/main.ts b/lib/main.ts index 040f608..3b5bb35 100644 --- a/lib/main.ts +++ b/lib/main.ts @@ -1,4 +1,5 @@ import './index.css' export * from './codatta-connect-context-provider' export * from './codatta-signin' -export * from './codatta-connect' \ No newline at end of file +export * from './codatta-connect' +export * from './types/wallet-item.class' \ No newline at end of file diff --git a/lib/vite-env.d.ts b/lib/vite-env.d.ts index d676aa0..a623e08 100644 --- a/lib/vite-env.d.ts +++ b/lib/vite-env.d.ts @@ -2,4 +2,7 @@ interface Window { initAliyunCaptcha: any + ethereum?: { + isBinance: boolean + } } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 6c5b34c..910bb81 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,14 @@ { "name": "codatta-connect", - "version": "2.0.5", + "version": "2.4.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "codatta-connect", - "version": "2.0.5", + "version": "2.4.5", "dependencies": { + "@binance/w3w-utils": "^1.1.6", "@coinbase/wallet-sdk": "^4.2.4", "@tonconnect/sdk": "^3.0.5", "@types/node": "^22.9.0", @@ -304,6 +305,27 @@ "node": ">=6.9.0" } }, + "node_modules/@binance/w3w-types": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@binance/w3w-types/-/w3w-types-1.1.4.tgz", + "integrity": "sha512-CCnneapNTVY1+RseZNIhExVp3ux8LihcXRkGwmvJtZTTJJIC7xQlTWy9olkAsz+opqWK+heAcyYGmt4RUt1M5g==", + "license": "Apache-2.0", + "dependencies": { + "eventemitter3": "^5.0.0" + } + }, + "node_modules/@binance/w3w-utils": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/@binance/w3w-utils/-/w3w-utils-1.1.6.tgz", + "integrity": "sha512-NGT629vS9tRlbigtNn9wHtTYNB00oyDcsajO/kpAcDiQn4ktYs7+oTIr/qLvjP8Z3opTXpbooqMPITDY7DI0IA==", + "license": "ISC", + "dependencies": { + "@binance/w3w-types": "1.1.4", + "eventemitter3": "^5.0.0", + "hash.js": "^1.1.7", + "js-base64": "^3.7.5" + } + }, "node_modules/@coinbase/wallet-sdk": { "version": "4.2.4", "resolved": "https://registry.npmmirror.com/@coinbase/wallet-sdk/-/wallet-sdk-4.2.4.tgz", @@ -3935,6 +3957,12 @@ "resolved": "https://registry.npmmirror.com/jju/-/jju-1.4.0.tgz", "integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==" }, + "node_modules/js-base64": { + "version": "3.7.7", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.7.tgz", + "integrity": "sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw==", + "license": "BSD-3-Clause" + }, "node_modules/js-sha3": { "version": "0.8.0", "resolved": "https://registry.npmmirror.com/js-sha3/-/js-sha3-0.8.0.tgz", diff --git a/package.json b/package.json index 91f93bd..6eb23cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codatta-connect", - "version": "2.4.3", + "version": "2.4.6", "type": "module", "main": "./dist/index.umd.js", "module": "./dist/index.es.js", @@ -14,6 +14,7 @@ "build": "vite build -c vite.config.build.ts" }, "dependencies": { + "@binance/w3w-utils": "^1.1.6", "@coinbase/wallet-sdk": "^4.2.4", "@tonconnect/sdk": "^3.0.5", "@types/node": "^22.9.0", From 07fb8402db5bd04a23f42b73c3149b848759a6bd Mon Sep 17 00:00:00 2001 From: Meow Lord Date: Wed, 18 Jun 2025 15:35:20 +0800 Subject: [PATCH 15/25] single wallet mode --- dist/codatta-connect-context-provider.d.ts | 1 + dist/components/single-wallet-option.d.ts | 5 + dist/index.es.js | 2 +- dist/index.umd.js | 104 +- dist/{main-BN1nTxTF.js => main-BX-27dZd.js} | 6621 +++++++++-------- ...56k1-DuMBhiq0.js => secp256k1-CjFIzVvG.js} | 2 +- lib/codatta-connect-context-provider.tsx | 19 +- lib/components/signin-index.tsx | 19 +- lib/components/single-wallet-option.tsx | 19 + lib/components/ton-wallet-select.tsx | 1 - lib/components/wallet-qr.tsx | 1 - lib/types/wallet-item.class.ts | 1 - package.json | 2 +- src/layout/app-layout.tsx | 2 +- src/views/login-view.tsx | 2 +- 15 files changed, 3419 insertions(+), 3382 deletions(-) create mode 100644 dist/components/single-wallet-option.d.ts rename dist/{main-BN1nTxTF.js => main-BX-27dZd.js} (90%) rename dist/{secp256k1-DuMBhiq0.js => secp256k1-CjFIzVvG.js} (99%) create mode 100644 lib/components/single-wallet-option.tsx diff --git a/dist/codatta-connect-context-provider.d.ts b/dist/codatta-connect-context-provider.d.ts index 982ea2b..8b4ac0b 100644 --- a/dist/codatta-connect-context-provider.d.ts +++ b/dist/codatta-connect-context-provider.d.ts @@ -13,6 +13,7 @@ export declare function useCodattaConnectContext(): CodattaConnectContext; interface CodattaConnectContextProviderProps { children: React.ReactNode; apiBaseUrl?: string; + singleWalletName?: string; } export declare function CodattaConnectContextProvider(props: CodattaConnectContextProviderProps): import("react/jsx-runtime").JSX.Element; export {}; diff --git a/dist/components/single-wallet-option.d.ts b/dist/components/single-wallet-option.d.ts new file mode 100644 index 0000000..b885e7b --- /dev/null +++ b/dist/components/single-wallet-option.d.ts @@ -0,0 +1,5 @@ +import { WalletItem } from '../types/wallet-item.class'; +export default function SingleWalletOption(props: { + wallet: WalletItem; + onClick: (wallet: WalletItem) => void; +}): import("react/jsx-runtime").JSX.Element; diff --git a/dist/index.es.js b/dist/index.es.js index f2f5c33..6f57226 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -1,4 +1,4 @@ -import { f as o, C as e, d as n, W as C, a as s, u as d } from "./main-BN1nTxTF.js"; +import { f as o, C as e, d as n, W as C, a as s, u as d } from "./main-BX-27dZd.js"; export { o as CodattaConnect, e as CodattaConnectContextProvider, diff --git a/dist/index.umd.js b/dist/index.umd.js index 16f2871..a231d4e 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -1,4 +1,4 @@ -(function(Mn,Ee){typeof exports=="object"&&typeof module<"u"?Ee(exports,require("react"),require("https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js")):typeof define=="function"&&define.amd?define(["exports","react","https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"],Ee):(Mn=typeof globalThis<"u"?globalThis:Mn||self,Ee(Mn["xny-connect"]={},Mn.React))})(this,function(Mn,Ee){"use strict";var foe=Object.defineProperty;var loe=(Mn,Ee,kc)=>Ee in Mn?foe(Mn,Ee,{enumerable:!0,configurable:!0,writable:!0,value:kc}):Mn[Ee]=kc;var oo=(Mn,Ee,kc)=>loe(Mn,typeof Ee!="symbol"?Ee+"":Ee,kc);function kc(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const Yt=kc(Ee);var nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ji(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Jp(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Xp={exports:{}},mf={};/** +(function(Mn,Se){typeof exports=="object"&&typeof module<"u"?Se(exports,require("react"),require("https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js")):typeof define=="function"&&define.amd?define(["exports","react","https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"],Se):(Mn=typeof globalThis<"u"?globalThis:Mn||self,Se(Mn["xny-connect"]={},Mn.React))})(this,function(Mn,Se){"use strict";var loe=Object.defineProperty;var hoe=(Mn,Se,kc)=>Se in Mn?loe(Mn,Se,{enumerable:!0,configurable:!0,writable:!0,value:kc}):Mn[Se]=kc;var oo=(Mn,Se,kc)=>hoe(Mn,typeof Se!="symbol"?Se+"":Se,kc);function kc(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const Yt=kc(Se);var nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ji(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Jp(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Xp={exports:{}},mf={};/** * @license React * react-jsx-runtime.production.min.js * @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Vy;function XA(){if(Vy)return mf;Vy=1;var t=Ee,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,u,l){var d,p={},y=null,A=null;l!==void 0&&(y=""+l),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(A=u.ref);for(d in u)n.call(u,d)&&!s.hasOwnProperty(d)&&(p[d]=u[d]);if(a&&a.defaultProps)for(d in u=a.defaultProps,u)p[d]===void 0&&(p[d]=u[d]);return{$$typeof:e,type:a,key:y,ref:A,props:p,_owner:i.current}}return mf.Fragment=r,mf.jsx=o,mf.jsxs=o,mf}var vf={};/** + */var Ky;function XA(){if(Ky)return mf;Ky=1;var t=Se,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,u,l){var d,p={},y=null,A=null;l!==void 0&&(y=""+l),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(A=u.ref);for(d in u)n.call(u,d)&&!s.hasOwnProperty(d)&&(p[d]=u[d]);if(a&&a.defaultProps)for(d in u=a.defaultProps,u)p[d]===void 0&&(p[d]=u[d]);return{$$typeof:e,type:a,key:y,ref:A,props:p,_owner:i.current}}return mf.Fragment=r,mf.jsx=o,mf.jsxs=o,mf}var vf={};/** * @license React * react-jsx-runtime.development.js * @@ -14,42 +14,42 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Gy;function ZA(){return Gy||(Gy=1,process.env.NODE_ENV!=="production"&&function(){var t=Ee,e=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),A=Symbol.for("react.offscreen"),P=Symbol.iterator,N="@@iterator";function D(U){if(U===null||typeof U!="object")return null;var oe=P&&U[P]||U[N];return typeof oe=="function"?oe:null}var k=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function B(U){{for(var oe=arguments.length,pe=new Array(oe>1?oe-1:0),xe=1;xe1?oe-1:0),xe=1;xe=1&&tt>=0&&Ue[st]!==gt[tt];)tt--;for(;st>=1&&tt>=0;st--,tt--)if(Ue[st]!==gt[tt]){if(st!==1||tt!==1)do if(st--,tt--,tt<0||Ue[st]!==gt[tt]){var At=` -`+Ue[st].replace(" at new "," at ");return U.displayName&&At.includes("")&&(At=At.replace("",U.displayName)),typeof U=="function"&&R.set(U,At),At}while(st>=1&&tt>=0);break}}}finally{Q=!1,se.current=De,O(),Error.prepareStackTrace=Re}var Rt=U?U.displayName||U.name:"",Mt=Rt?X(Rt):"";return typeof U=="function"&&R.set(U,Mt),Mt}function le(U,oe,pe){return te(U,!1)}function ie(U){var oe=U.prototype;return!!(oe&&oe.isReactComponent)}function fe(U,oe,pe){if(U==null)return"";if(typeof U=="function")return te(U,ie(U));if(typeof U=="string")return X(U);switch(U){case l:return X("Suspense");case d:return X("SuspenseList")}if(typeof U=="object")switch(U.$$typeof){case u:return le(U.render);case p:return fe(U.type,oe,pe);case y:{var xe=U,Re=xe._payload,De=xe._init;try{return fe(De(Re),oe,pe)}catch{}}}return""}var ve=Object.prototype.hasOwnProperty,Me={},Ne=k.ReactDebugCurrentFrame;function Te(U){if(U){var oe=U._owner,pe=fe(U.type,U._source,oe?oe.type:null);Ne.setExtraStackFrame(pe)}else Ne.setExtraStackFrame(null)}function $e(U,oe,pe,xe,Re){{var De=Function.call.bind(ve);for(var it in U)if(De(U,it)){var Ue=void 0;try{if(typeof U[it]!="function"){var gt=Error((xe||"React class")+": "+pe+" type `"+it+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof U[it]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw gt.name="Invariant Violation",gt}Ue=U[it](oe,it,xe,pe,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(st){Ue=st}Ue&&!(Ue instanceof Error)&&(Te(Re),B("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",xe||"React class",pe,it,typeof Ue),Te(null)),Ue instanceof Error&&!(Ue.message in Me)&&(Me[Ue.message]=!0,Te(Re),B("Failed %s type: %s",pe,Ue.message),Te(null))}}}var Ie=Array.isArray;function Le(U){return Ie(U)}function Ve(U){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,pe=oe&&U[Symbol.toStringTag]||U.constructor.name||"Object";return pe}}function ke(U){try{return ze(U),!1}catch{return!0}}function ze(U){return""+U}function He(U){if(ke(U))return B("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ve(U)),ze(U)}var Se=k.ReactCurrentOwner,Qe={key:!0,ref:!0,__self:!0,__source:!0},ct,Be,et;et={};function rt(U){if(ve.call(U,"ref")){var oe=Object.getOwnPropertyDescriptor(U,"ref").get;if(oe&&oe.isReactWarning)return!1}return U.ref!==void 0}function Je(U){if(ve.call(U,"key")){var oe=Object.getOwnPropertyDescriptor(U,"key").get;if(oe&&oe.isReactWarning)return!1}return U.key!==void 0}function pt(U,oe){if(typeof U.ref=="string"&&Se.current&&oe&&Se.current.stateNode!==oe){var pe=m(Se.current.type);et[pe]||(B('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',m(Se.current.type),U.ref),et[pe]=!0)}}function ht(U,oe){{var pe=function(){ct||(ct=!0,B("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};pe.isReactWarning=!0,Object.defineProperty(U,"key",{get:pe,configurable:!0})}}function ft(U,oe){{var pe=function(){Be||(Be=!0,B("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};pe.isReactWarning=!0,Object.defineProperty(U,"ref",{get:pe,configurable:!0})}}var Ht=function(U,oe,pe,xe,Re,De,it){var Ue={$$typeof:e,type:U,key:oe,ref:pe,props:it,_owner:De};return Ue._store={},Object.defineProperty(Ue._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ue,"_self",{configurable:!1,enumerable:!1,writable:!1,value:xe}),Object.defineProperty(Ue,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Re}),Object.freeze&&(Object.freeze(Ue.props),Object.freeze(Ue)),Ue};function Jt(U,oe,pe,xe,Re){{var De,it={},Ue=null,gt=null;pe!==void 0&&(He(pe),Ue=""+pe),Je(oe)&&(He(oe.key),Ue=""+oe.key),rt(oe)&&(gt=oe.ref,pt(oe,Re));for(De in oe)ve.call(oe,De)&&!Qe.hasOwnProperty(De)&&(it[De]=oe[De]);if(U&&U.defaultProps){var st=U.defaultProps;for(De in st)it[De]===void 0&&(it[De]=st[De])}if(Ue||gt){var tt=typeof U=="function"?U.displayName||U.name||"Unknown":U;Ue&&ht(it,tt),gt&&ft(it,tt)}return Ht(U,Ue,gt,Re,xe,Se.current,it)}}var St=k.ReactCurrentOwner,er=k.ReactDebugCurrentFrame;function Xt(U){if(U){var oe=U._owner,pe=fe(U.type,U._source,oe?oe.type:null);er.setExtraStackFrame(pe)}else er.setExtraStackFrame(null)}var Ot;Ot=!1;function Bt(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function Tt(){{if(St.current){var U=m(St.current.type);if(U)return` +`+Ue[st].replace(" at new "," at ");return U.displayName&&At.includes("")&&(At=At.replace("",U.displayName)),typeof U=="function"&&R.set(U,At),At}while(st>=1&&tt>=0);break}}}finally{Q=!1,se.current=De,N(),Error.prepareStackTrace=Re}var Rt=U?U.displayName||U.name:"",Mt=Rt?X(Rt):"";return typeof U=="function"&&R.set(U,Mt),Mt}function le(U,oe,ge){return te(U,!1)}function ie(U){var oe=U.prototype;return!!(oe&&oe.isReactComponent)}function fe(U,oe,ge){if(U==null)return"";if(typeof U=="function")return te(U,ie(U));if(typeof U=="string")return X(U);switch(U){case l:return X("Suspense");case d:return X("SuspenseList")}if(typeof U=="object")switch(U.$$typeof){case u:return le(U.render);case p:return fe(U.type,oe,ge);case y:{var xe=U,Re=xe._payload,De=xe._init;try{return fe(De(Re),oe,ge)}catch{}}}return""}var ve=Object.prototype.hasOwnProperty,Me={},Ne=k.ReactDebugCurrentFrame;function Te(U){if(U){var oe=U._owner,ge=fe(U.type,U._source,oe?oe.type:null);Ne.setExtraStackFrame(ge)}else Ne.setExtraStackFrame(null)}function $e(U,oe,ge,xe,Re){{var De=Function.call.bind(ve);for(var it in U)if(De(U,it)){var Ue=void 0;try{if(typeof U[it]!="function"){var gt=Error((xe||"React class")+": "+ge+" type `"+it+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof U[it]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw gt.name="Invariant Violation",gt}Ue=U[it](oe,it,xe,ge,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(st){Ue=st}Ue&&!(Ue instanceof Error)&&(Te(Re),B("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",xe||"React class",ge,it,typeof Ue),Te(null)),Ue instanceof Error&&!(Ue.message in Me)&&(Me[Ue.message]=!0,Te(Re),B("Failed %s type: %s",ge,Ue.message),Te(null))}}}var Ie=Array.isArray;function Le(U){return Ie(U)}function Ve(U){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,ge=oe&&U[Symbol.toStringTag]||U.constructor.name||"Object";return ge}}function ke(U){try{return ze(U),!1}catch{return!0}}function ze(U){return""+U}function He(U){if(ke(U))return B("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ve(U)),ze(U)}var Ee=k.ReactCurrentOwner,Qe={key:!0,ref:!0,__self:!0,__source:!0},ct,Be,et;et={};function rt(U){if(ve.call(U,"ref")){var oe=Object.getOwnPropertyDescriptor(U,"ref").get;if(oe&&oe.isReactWarning)return!1}return U.ref!==void 0}function Je(U){if(ve.call(U,"key")){var oe=Object.getOwnPropertyDescriptor(U,"key").get;if(oe&&oe.isReactWarning)return!1}return U.key!==void 0}function pt(U,oe){if(typeof U.ref=="string"&&Ee.current&&oe&&Ee.current.stateNode!==oe){var ge=m(Ee.current.type);et[ge]||(B('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',m(Ee.current.type),U.ref),et[ge]=!0)}}function ht(U,oe){{var ge=function(){ct||(ct=!0,B("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};ge.isReactWarning=!0,Object.defineProperty(U,"key",{get:ge,configurable:!0})}}function ft(U,oe){{var ge=function(){Be||(Be=!0,B("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};ge.isReactWarning=!0,Object.defineProperty(U,"ref",{get:ge,configurable:!0})}}var Ht=function(U,oe,ge,xe,Re,De,it){var Ue={$$typeof:e,type:U,key:oe,ref:ge,props:it,_owner:De};return Ue._store={},Object.defineProperty(Ue._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ue,"_self",{configurable:!1,enumerable:!1,writable:!1,value:xe}),Object.defineProperty(Ue,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Re}),Object.freeze&&(Object.freeze(Ue.props),Object.freeze(Ue)),Ue};function Jt(U,oe,ge,xe,Re){{var De,it={},Ue=null,gt=null;ge!==void 0&&(He(ge),Ue=""+ge),Je(oe)&&(He(oe.key),Ue=""+oe.key),rt(oe)&&(gt=oe.ref,pt(oe,Re));for(De in oe)ve.call(oe,De)&&!Qe.hasOwnProperty(De)&&(it[De]=oe[De]);if(U&&U.defaultProps){var st=U.defaultProps;for(De in st)it[De]===void 0&&(it[De]=st[De])}if(Ue||gt){var tt=typeof U=="function"?U.displayName||U.name||"Unknown":U;Ue&&ht(it,tt),gt&&ft(it,tt)}return Ht(U,Ue,gt,Re,xe,Ee.current,it)}}var St=k.ReactCurrentOwner,er=k.ReactDebugCurrentFrame;function Xt(U){if(U){var oe=U._owner,ge=fe(U.type,U._source,oe?oe.type:null);er.setExtraStackFrame(ge)}else er.setExtraStackFrame(null)}var Ot;Ot=!1;function Bt(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function Tt(){{if(St.current){var U=m(St.current.type);if(U)return` -Check the render method of \``+U+"`."}return""}}function vt(U){return""}var Dt={};function Lt(U){{var oe=Tt();if(!oe){var pe=typeof U=="string"?U:U.displayName||U.name;pe&&(oe=` +Check the render method of \``+U+"`."}return""}}function vt(U){return""}var Dt={};function Lt(U){{var oe=Tt();if(!oe){var ge=typeof U=="string"?U:U.displayName||U.name;ge&&(oe=` -Check the top-level render call using <`+pe+">.")}return oe}}function bt(U,oe){{if(!U._store||U._store.validated||U.key!=null)return;U._store.validated=!0;var pe=Lt(oe);if(Dt[pe])return;Dt[pe]=!0;var xe="";U&&U._owner&&U._owner!==St.current&&(xe=" It was passed a child from "+m(U._owner.type)+"."),Xt(U),B('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',pe,xe),Xt(null)}}function $t(U,oe){{if(typeof U!="object")return;if(Le(U))for(var pe=0;pe",Ue=" Did you accidentally export a JSX literal instead of a component?"):st=typeof U,B("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",st,Ue)}var tt=Jt(U,oe,pe,Re,De);if(tt==null)return tt;if(it){var At=oe.children;if(At!==void 0)if(xe)if(Le(At)){for(var Rt=0;Rt0?"{key: someKey, "+Et.join(": ..., ")+": ...}":"{key: someKey}";if(!Ft[Mt+dt]){var _t=Et.length>0?"{"+Et.join(": ..., ")+": ...}":"{}";B(`A props object containing a "key" prop is being spread into JSX: +Check the top-level render call using <`+ge+">.")}return oe}}function bt(U,oe){{if(!U._store||U._store.validated||U.key!=null)return;U._store.validated=!0;var ge=Lt(oe);if(Dt[ge])return;Dt[ge]=!0;var xe="";U&&U._owner&&U._owner!==St.current&&(xe=" It was passed a child from "+m(U._owner.type)+"."),Xt(U),B('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ge,xe),Xt(null)}}function $t(U,oe){{if(typeof U!="object")return;if(Le(U))for(var ge=0;ge",Ue=" Did you accidentally export a JSX literal instead of a component?"):st=typeof U,B("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",st,Ue)}var tt=Jt(U,oe,ge,Re,De);if(tt==null)return tt;if(it){var At=oe.children;if(At!==void 0)if(xe)if(Le(At)){for(var Rt=0;Rt0?"{key: someKey, "+Et.join(": ..., ")+": ...}":"{key: someKey}";if(!Ft[Mt+dt]){var _t=Et.length>0?"{"+Et.join(": ..., ")+": ...}":"{}";B(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; - <%s key={someKey} {...props} />`,dt,Mt,_t,Mt),Ft[Mt+dt]=!0}}return U===n?nt(tt):jt(tt),tt}}function W(U,oe,pe){return $(U,oe,pe,!0)}function V(U,oe,pe){return $(U,oe,pe,!1)}var C=V,Y=W;vf.Fragment=n,vf.jsx=C,vf.jsxs=Y}()),vf}process.env.NODE_ENV==="production"?Xp.exports=XA():Xp.exports=ZA();var ge=Xp.exports;const Rs="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2",QA=[{featured:!0,name:"MetaMask",rdns:"io.metamask",image:`${Rs}#metamask`,getWallet:{chrome_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",brave_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",edge_addon_id:"ejbalbakoplchlghecdalmeeeajnimhm",firefox_addon_id:"ether-metamask",play_store_id:"io.metamask",app_store_id:"id1438144202"},deep_link:"metamask://wc",universal_link:"https://metamask.app.link/wc"},{featured:!0,name:"OKX Wallet",rdns:"com.okex.wallet",image:`${Rs}#okx`,getWallet:{chrome_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",brave_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",edge_addon_id:"pbpjkcldjiffchgbbndmhojiacbgflha",play_store_id:"com.okinc.okex.gp",app_store_id:"id1327268470"},deep_link:"okex://main/wc",universal_link:"okex://main/wc"},{featured:!0,name:"WalletConnect",image:`${Rs}#walletconnect`},{featured:!1,name:"Coinbase Wallet",image:`${Rs}#coinbase`},{featured:!1,name:"GateWallet",rdns:"io.gate.wallet",image:`${Rs}#6e528abf-7a7d-47bd-d84d-481f169b1200`,getWallet:{chrome_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",brave_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",play_store_id:"com.gateio.gateio",app_store_id:"id1294998195",mac_app_store_id:"id1609559473"},deep_link:"https://www.gate.io/mobileapp",universal_link:"https://www.gate.io/mobileapp"},{featured:!1,name:"Onekey",rdns:"so.onekey.app.wallet",image:`${Rs}#onekey`,getWallet:{chrome_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",brave_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",play_store_id:"so.onekey.app.wallet",app_store_id:"id1609559473"},deep_link:"onekey-wallet://",universal_link:"onekey://wc"},{featured:!1,name:"Infinity Wallet",image:`${Rs}#9f259366-0bcd-4817-0af9-f78773e41900`,desktop_link:"infinity://wc"},{name:"Rabby Wallet",rdns:"io.rabby",featured:!1,image:`${Rs}#rabby`,getWallet:{chrome_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",brave_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",play_store_id:"com.debank.rabbymobile",app_store_id:"id6474381673"}},{name:"Binance Web3 Wallet",featured:!1,image:`${Rs}#ebac7b39-688c-41e3-7912-a4fefba74600`,getWallet:{play_store_id:"com.binance.dev",app_store_id:"id1436799971"}},{name:"Rainbow Wallet",rdns:"me.rainbow",featured:!1,image:`${Rs}#rainbow`,getWallet:{chrome_store_id:"opfgelmcmbiajamepnmloijbpoleiama",edge_addon_id:"cpojfbodiccabbabgimdeohkkpjfpbnf",firefox_addon_id:"rainbow-extension",app_store_id:"id1457119021",play_store_id:"me.rainbow"}}];function eP(t,e){const r=t.exec(e);return r==null?void 0:r.groups}const Yy=/^tuple(?(\[(\d*)\])*)$/;function Zp(t){let e=t.type;if(Yy.test(t.type)&&"components"in t){e="(";const r=t.components.length;for(let i=0;ie(t,s)}function Bc(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new dP(t.type);return`${t.name}(${Qp(t.inputs,{includeName:e})})`}function Qp(t,{includeName:e=!1}={}){return t?t.map(r=>rP(r,{includeName:e})).join(e?", ":","):""}function rP(t,{includeName:e}){return t.type.startsWith("tuple")?`(${Qp(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}function Jo(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function _n(t){return Jo(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const Jy="2.21.45";let yf={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${Jy}`};class yt extends Error{constructor(e,r={}){var a;const n=(()=>{var u;return r.cause instanceof yt?r.cause.details:(u=r.cause)!=null&&u.message?r.cause.message:r.details})(),i=r.cause instanceof yt&&r.cause.docsPath||r.docsPath,s=(a=yf.getDocsUrl)==null?void 0:a.call(yf,{...r,docsPath:i}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...yf.version?[`Version: ${yf.version}`]:[]].join(` -`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=Jy}walk(e){return Xy(this,e)}}function Xy(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?Xy(t.cause,e):e?null:t}class nP extends yt{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` -`),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class Zy extends yt{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` + <%s key={someKey} {...props} />`,dt,Mt,_t,Mt),Ft[Mt+dt]=!0}}return U===n?nt(tt):jt(tt),tt}}function W(U,oe,ge){return $(U,oe,ge,!0)}function V(U,oe,ge){return $(U,oe,ge,!1)}var C=V,Y=W;vf.Fragment=n,vf.jsx=C,vf.jsxs=Y}()),vf}process.env.NODE_ENV==="production"?Xp.exports=XA():Xp.exports=ZA();var de=Xp.exports;const Rs="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2",QA=[{featured:!0,name:"MetaMask",rdns:"io.metamask",image:`${Rs}#metamask`,getWallet:{chrome_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",brave_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",edge_addon_id:"ejbalbakoplchlghecdalmeeeajnimhm",firefox_addon_id:"ether-metamask",play_store_id:"io.metamask",app_store_id:"id1438144202"},deep_link:"metamask://wc",universal_link:"https://metamask.app.link/wc"},{featured:!0,name:"OKX Wallet",rdns:"com.okex.wallet",image:`${Rs}#okx`,getWallet:{chrome_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",brave_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",edge_addon_id:"pbpjkcldjiffchgbbndmhojiacbgflha",play_store_id:"com.okinc.okex.gp",app_store_id:"id1327268470"},deep_link:"okex://main/wc",universal_link:"okex://main/wc"},{featured:!0,name:"WalletConnect",image:`${Rs}#walletconnect`},{featured:!1,name:"Coinbase Wallet",image:`${Rs}#coinbase`},{featured:!1,name:"GateWallet",rdns:"io.gate.wallet",image:`${Rs}#6e528abf-7a7d-47bd-d84d-481f169b1200`,getWallet:{chrome_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",brave_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",play_store_id:"com.gateio.gateio",app_store_id:"id1294998195",mac_app_store_id:"id1609559473"},deep_link:"https://www.gate.io/mobileapp",universal_link:"https://www.gate.io/mobileapp"},{featured:!1,name:"Onekey",rdns:"so.onekey.app.wallet",image:`${Rs}#onekey`,getWallet:{chrome_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",brave_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",play_store_id:"so.onekey.app.wallet",app_store_id:"id1609559473"},deep_link:"onekey-wallet://",universal_link:"onekey://wc"},{featured:!1,name:"Infinity Wallet",image:`${Rs}#9f259366-0bcd-4817-0af9-f78773e41900`,desktop_link:"infinity://wc"},{name:"Rabby Wallet",rdns:"io.rabby",featured:!1,image:`${Rs}#rabby`,getWallet:{chrome_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",brave_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",play_store_id:"com.debank.rabbymobile",app_store_id:"id6474381673"}},{name:"Binance Web3 Wallet",featured:!1,image:`${Rs}#ebac7b39-688c-41e3-7912-a4fefba74600`,getWallet:{play_store_id:"com.binance.dev",app_store_id:"id1436799971"}},{name:"Rainbow Wallet",rdns:"me.rainbow",featured:!1,image:`${Rs}#rainbow`,getWallet:{chrome_store_id:"opfgelmcmbiajamepnmloijbpoleiama",edge_addon_id:"cpojfbodiccabbabgimdeohkkpjfpbnf",firefox_addon_id:"rainbow-extension",app_store_id:"id1457119021",play_store_id:"me.rainbow"}}];function eP(t,e){const r=t.exec(e);return r==null?void 0:r.groups}const Gy=/^tuple(?(\[(\d*)\])*)$/;function Zp(t){let e=t.type;if(Gy.test(t.type)&&"components"in t){e="(";const r=t.components.length;for(let i=0;ie(t,s)}function Bc(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new dP(t.type);return`${t.name}(${Qp(t.inputs,{includeName:e})})`}function Qp(t,{includeName:e=!1}={}){return t?t.map(r=>rP(r,{includeName:e})).join(e?", ":","):""}function rP(t,{includeName:e}){return t.type.startsWith("tuple")?`(${Qp(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}function Jo(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function _n(t){return Jo(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const Yy="2.21.45";let yf={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${Yy}`};class yt extends Error{constructor(e,r={}){var a;const n=(()=>{var u;return r.cause instanceof yt?r.cause.details:(u=r.cause)!=null&&u.message?r.cause.message:r.details})(),i=r.cause instanceof yt&&r.cause.docsPath||r.docsPath,s=(a=yf.getDocsUrl)==null?void 0:a.call(yf,{...r,docsPath:i}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...yf.version?[`Version: ${yf.version}`]:[]].join(` +`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=Yy}walk(e){return Jy(this,e)}}function Jy(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?Jy(t.cause,e):e?null:t}class nP extends yt{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` +`),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class Xy extends yt{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` `),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class iP extends yt{constructor({data:e,params:r,size:n}){super([`Data size of ${n} bytes is too small for given parameters.`].join(` `),{metaMessages:[`Params: (${Qp(r,{includeName:!0})})`,`Data: ${e} (${n} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=r,this.size=n}}class eg extends yt{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class sP extends yt{constructor({expectedLength:e,givenLength:r,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${e}`,`Given length: ${r}`].join(` `),{name:"AbiEncodingArrayLengthMismatchError"})}}class oP extends yt{constructor({expectedSize:e,value:r}){super(`Size of bytes "${r}" (bytes${_n(r)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class aP extends yt{constructor({expectedLength:e,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${r}`].join(` -`),{name:"AbiEncodingLengthMismatchError"})}}class Qy extends yt{constructor(e,{docsPath:r}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(` -`),{docsPath:r,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class ew extends yt{constructor(e,{docsPath:r}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` +`),{name:"AbiEncodingLengthMismatchError"})}}class Zy extends yt{constructor(e,{docsPath:r}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(` +`),{docsPath:r,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class Qy extends yt{constructor(e,{docsPath:r}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` `),{docsPath:r,name:"AbiFunctionNotFoundError"})}}class cP extends yt{constructor(e,r){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${Bc(e.abiItem)}\`, and`,`\`${r.type}\` in \`${Bc(r.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class uP extends yt{constructor({expectedSize:e,givenSize:r}){super(`Expected bytes${e}, got bytes${r}.`,{name:"BytesSizeMismatchError"})}}class fP extends yt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(` `),{docsPath:r,name:"InvalidAbiEncodingType"})}}class lP extends yt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` `),{docsPath:r,name:"InvalidAbiDecodingType"})}}class hP extends yt{constructor(e){super([`Value "${e}" is not a valid array.`].join(` `),{name:"InvalidArrayError"})}}class dP extends yt{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` -`),{name:"InvalidDefinitionTypeError"})}}class tw extends yt{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}class rw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}class nw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function $c(t,{dir:e,size:r=32}={}){return typeof t=="string"?Xo(t,{dir:e,size:r}):pP(t,{dir:e,size:r})}function Xo(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new rw({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function pP(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new rw({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie)throw new vP({givenSize:_n(t),maxSize:e})}function wf(t,e={}){const{signed:r}=e;e.size&&Ds(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<e.toString(16).padStart(2,"0"));function Dh(t,e={}){return typeof t=="number"||typeof t=="bigint"?Pr(t,e):typeof t=="string"?Oh(t,e):typeof t=="boolean"?iw(t,e):li(t,e)}function iw(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(Ds(r,{size:e.size}),$c(r,{size:e.size})):r}function li(t,e={}){let r="";for(let i=0;is||i=ao.zero&&t<=ao.nine)return t-ao.zero;if(t>=ao.A&&t<=ao.F)return t-(ao.A-10);if(t>=ao.a&&t<=ao.f)return t-(ao.a-10)}function co(t,e={}){let r=t;e.size&&(Ds(r,{size:e.size}),r=$c(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function SP(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Nh(t.outputLen),Nh(t.blockLen)}function Uc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function aw(t,e){jc(t);const r=e.outputLen;if(t.length>cw&Lh)}:{h:Number(t>>cw&Lh)|0,l:Number(t&Lh)|0}}function PP(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;it<>>32-r,IP=(t,e,r)=>e<>>32-r,CP=(t,e,r)=>e<>>64-r,TP=(t,e,r)=>t<>>64-r,qc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const RP=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),ng=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Os=(t,e)=>t<<32-e|t>>>e,uw=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,DP=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function fw(t){for(let e=0;ee.toString(16).padStart(2,"0"));function NP(t){jc(t);let e="";for(let r=0;rt().update(xf(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function BP(t){const e=(n,i)=>t(i).update(xf(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function $P(t=32){if(qc&&typeof qc.getRandomValues=="function")return qc.getRandomValues(new Uint8Array(t));if(qc&&typeof qc.randomBytes=="function")return qc.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const hw=[],dw=[],pw=[],FP=BigInt(0),_f=BigInt(1),jP=BigInt(2),UP=BigInt(7),qP=BigInt(256),zP=BigInt(113);for(let t=0,e=_f,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],hw.push(2*(5*n+r)),dw.push((t+1)*(t+2)/2%64);let i=FP;for(let s=0;s<7;s++)e=(e<<_f^(e>>UP)*zP)%qP,e&jP&&(i^=_f<<(_f<r>32?CP(t,e,r):MP(t,e,r),mw=(t,e,r)=>r>32?TP(t,e,r):IP(t,e,r);function vw(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,u=(o+2)%10,l=r[u],d=r[u+1],p=gw(l,d,1)^r[a],y=mw(l,d,1)^r[a+1];for(let A=0;A<50;A+=10)t[o+A]^=p,t[o+A+1]^=y}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=dw[o],u=gw(i,s,a),l=mw(i,s,a),d=hw[o];i=t[d],s=t[d+1],t[d]=u,t[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=HP[n],t[1]^=WP[n]}r.fill(0)}class Ef extends ig{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Nh(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=RP(this.state)}keccak(){uw||fw(this.state32),vw(this.state32,this.rounds),uw||fw(this.state32),this.posOut=0,this.pos=0}update(e){Uc(this);const{blockLen:r,state:n}=this;e=xf(e);const i=e.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Nh(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(aw(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new Ef(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Zo=(t,e,r)=>lw(()=>new Ef(e,t,r)),KP=Zo(6,144,224/8),VP=Zo(6,136,256/8),GP=Zo(6,104,384/8),YP=Zo(6,72,512/8),JP=Zo(1,144,224/8),bw=Zo(1,136,256/8),XP=Zo(1,104,384/8),ZP=Zo(1,72,512/8),yw=(t,e,r)=>BP((n={})=>new Ef(e,t,n.dkLen===void 0?r:n.dkLen,!0)),QP=yw(31,168,128/8),eM=yw(31,136,256/8),tM=Object.freeze(Object.defineProperty({__proto__:null,Keccak:Ef,keccakP:vw,keccak_224:JP,keccak_256:bw,keccak_384:XP,keccak_512:ZP,sha3_224:KP,sha3_256:VP,sha3_384:GP,sha3_512:YP,shake128:QP,shake256:eM},Symbol.toStringTag,{value:"Module"}));function Sf(t,e){const r=e||"hex",n=bw(Jo(t,{strict:!1})?rg(t):t);return r==="bytes"?n:Dh(n)}const rM=t=>Sf(rg(t));function nM(t){return rM(t)}function iM(t){let e=!0,r="",n=0,i="",s=!1;for(let o=0;o{const e=typeof t=="string"?t:tP(t);return iM(e)};function ww(t){return nM(sM(t))}const oM=ww;class zc extends yt{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class kh extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const sg=new kh(8192);function Af(t,e){if(sg.has(`${t}.${e}`))return sg.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=Sf(ow(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return sg.set(`${t}.${e}`,s),s}function og(t,e){if(!uo(t,{strict:!1}))throw new zc({address:t});return Af(t,e)}const aM=/^0x[a-fA-F0-9]{40}$/,ag=new kh(8192);function uo(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(ag.has(n))return ag.get(n);const i=aM.test(t)?t.toLowerCase()===t?!0:r?Af(t)===t:!0:!1;return ag.set(n,i),i}function Hc(t){return typeof t[0]=="string"?Bh(t):cM(t)}function cM(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function Bh(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}function $h(t,e,r,{strict:n}={}){return Jo(t,{strict:!1})?uM(t,e,r,{strict:n}):Ew(t,e,r,{strict:n})}function xw(t,e){if(typeof e=="number"&&e>0&&e>_n(t)-1)throw new tw({offset:e,position:"start",size:_n(t)})}function _w(t,e,r){if(typeof e=="number"&&typeof r=="number"&&_n(t)!==r-e)throw new tw({offset:r,position:"end",size:_n(t)})}function Ew(t,e,r,{strict:n}={}){xw(t,e);const i=t.slice(e,r);return n&&_w(i,e,r),i}function uM(t,e,r,{strict:n}={}){xw(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&_w(i,e,r),i}function Sw(t,e){if(t.length!==e.length)throw new aP({expectedLength:t.length,givenLength:e.length});const r=fM({params:t,values:e}),n=ug(r);return n.length===0?"0x":n}function fM({params:t,values:e}){const r=[];for(let n=0;n0?Hc([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:Hc(s.map(({encoded:o})=>o))}}function dM(t,{param:e}){const[,r]=e.type.split("bytes"),n=_n(t);if(!r){let i=t;return n%32!==0&&(i=Xo(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:Hc([Xo(Pr(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new oP({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:Xo(t,{dir:"right"})}}function pM(t){if(typeof t!="boolean")throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Xo(iw(t))}}function gM(t,{signed:e}){return{dynamic:!1,encoded:Pr(t,{size:32,signed:e})}}function mM(t){const e=Oh(t),r=Math.ceil(_n(e)/32),n=[];for(let i=0;ii))}}function fg(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const lg=t=>$h(ww(t),0,4);function Aw(t){const{abi:e,args:r=[],name:n}=t,i=Jo(n,{strict:!1}),s=e.filter(a=>i?a.type==="function"?lg(a)===n:a.type==="event"?oM(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((l,d)=>{const p="inputs"in a&&a.inputs[d];return p?hg(l,p):!1})){if(o&&"inputs"in o&&o.inputs){const l=Pw(a.inputs,o.inputs,r);if(l)throw new cP({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||s[0]}function hg(t,e){const r=typeof t,n=e.type;switch(n){case"address":return uo(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>hg(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>hg(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Pw(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return Pw(i.components,s.components,r[n]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?uo(r[n],{strict:!1}):o.includes("address")&&o.includes("bytes")?uo(r[n],{strict:!1}):!1)return o}}function fo(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const Mw="/docs/contract/encodeFunctionData";function bM(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=Aw({abi:e,args:r,name:n});if(!s)throw new ew(n,{docsPath:Mw});i=s}if(i.type!=="function")throw new ew(void 0,{docsPath:Mw});return{abi:[i],functionName:lg(Bc(i))}}function yM(t){const{args:e}=t,{abi:r,functionName:n}=(()=>{var a;return t.abi.length===1&&((a=t.functionName)!=null&&a.startsWith("0x"))?t:bM(t)})(),i=r[0],s=n,o="inputs"in i&&i.inputs?Sw(i.inputs,e??[]):void 0;return Bh([s,o??"0x"])}const wM={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},xM={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},_M={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Iw extends yt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class EM extends yt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class SM extends yt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const AM={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new SM({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new EM({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Iw({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Iw({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function dg(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(AM);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function PM(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return wf(r,e)}function MM(t,e={}){let r=t;if(typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r)),r.length>1||r[0]>1)throw new mP(r);return!!r[0]}function lo(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return Fc(r,e)}function IM(t,e={}){let r=t;return typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r,{dir:"right"})),new TextDecoder().decode(r)}function CM(t,e){const r=typeof e=="string"?co(e):e,n=dg(r);if(_n(r)===0&&t.length>0)throw new eg;if(_n(e)&&_n(e)<32)throw new iP({data:typeof e=="string"?e:li(e),params:t,size:_n(e)});let i=0;const s=[];for(let o=0;o48?PM(i,{signed:r}):lo(i,{signed:r}),32]}function LM(t,e,{staticPosition:r}){const n=e.components.length===0||e.components.some(({name:o})=>!o),i=n?[]:{};let s=0;if(Pf(e)){const o=lo(t.readBytes(pg)),a=r+o;for(let u=0;uo.type==="error"&&n===lg(Bc(o)));if(!s)throw new Qy(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?CM(s.inputs,$h(r,4)):void 0,errorName:s.name}}const Kc=(t,e,r)=>JSON.stringify(t,(n,i)=>typeof i=="bigint"?i.toString():i,r);function Tw({abiItem:t,args:e,includeFunctionName:r=!0,includeName:n=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${r?t.name:""}(${t.inputs.map((i,s)=>`${n&&i.name?`${i.name}: `:""}${typeof e[s]=="object"?Kc(e[s]):e[s]}`).join(", ")})`}const $M={gwei:9,wei:18},FM={ether:-9,wei:9};function Rw(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}function Dw(t,e="wei"){return Rw(t,$M[e])}function hs(t,e="wei"){return Rw(t,FM[e])}class jM extends yt{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class UM extends yt{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Fh(t){const e=Object.entries(t).map(([n,i])=>i===void 0||i===!1?null:[n,i]).filter(Boolean),r=e.reduce((n,[i])=>Math.max(n,i.length),0);return e.map(([n,i])=>` ${`${n}:`.padEnd(r+1)} ${i}`).join(` +`),{name:"InvalidDefinitionTypeError"})}}class ew extends yt{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}class tw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}class rw extends yt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function $c(t,{dir:e,size:r=32}={}){return typeof t=="string"?Xo(t,{dir:e,size:r}):pP(t,{dir:e,size:r})}function Xo(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new tw({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function pP(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new tw({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie)throw new vP({givenSize:_n(t),maxSize:e})}function wf(t,e={}){const{signed:r}=e;e.size&&Ds(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<e.toString(16).padStart(2,"0"));function Dh(t,e={}){return typeof t=="number"||typeof t=="bigint"?Pr(t,e):typeof t=="string"?Oh(t,e):typeof t=="boolean"?nw(t,e):li(t,e)}function nw(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(Ds(r,{size:e.size}),$c(r,{size:e.size})):r}function li(t,e={}){let r="";for(let i=0;is||i=ao.zero&&t<=ao.nine)return t-ao.zero;if(t>=ao.A&&t<=ao.F)return t-(ao.A-10);if(t>=ao.a&&t<=ao.f)return t-(ao.a-10)}function co(t,e={}){let r=t;e.size&&(Ds(r,{size:e.size}),r=$c(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function SP(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Nh(t.outputLen),Nh(t.blockLen)}function Uc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function ow(t,e){jc(t);const r=e.outputLen;if(t.length>aw&Lh)}:{h:Number(t>>aw&Lh)|0,l:Number(t&Lh)|0}}function PP(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;it<>>32-r,IP=(t,e,r)=>e<>>32-r,CP=(t,e,r)=>e<>>64-r,TP=(t,e,r)=>t<>>64-r,qc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const RP=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),ng=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Os=(t,e)=>t<<32-e|t>>>e,cw=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,DP=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function uw(t){for(let e=0;ee.toString(16).padStart(2,"0"));function NP(t){jc(t);let e="";for(let r=0;rt().update(xf(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function BP(t){const e=(n,i)=>t(i).update(xf(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function $P(t=32){if(qc&&typeof qc.getRandomValues=="function")return qc.getRandomValues(new Uint8Array(t));if(qc&&typeof qc.randomBytes=="function")return qc.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const lw=[],hw=[],dw=[],FP=BigInt(0),_f=BigInt(1),jP=BigInt(2),UP=BigInt(7),qP=BigInt(256),zP=BigInt(113);for(let t=0,e=_f,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],lw.push(2*(5*n+r)),hw.push((t+1)*(t+2)/2%64);let i=FP;for(let s=0;s<7;s++)e=(e<<_f^(e>>UP)*zP)%qP,e&jP&&(i^=_f<<(_f<r>32?CP(t,e,r):MP(t,e,r),gw=(t,e,r)=>r>32?TP(t,e,r):IP(t,e,r);function mw(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,u=(o+2)%10,l=r[u],d=r[u+1],p=pw(l,d,1)^r[a],y=gw(l,d,1)^r[a+1];for(let A=0;A<50;A+=10)t[o+A]^=p,t[o+A+1]^=y}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=hw[o],u=pw(i,s,a),l=gw(i,s,a),d=lw[o];i=t[d],s=t[d+1],t[d]=u,t[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=HP[n],t[1]^=WP[n]}r.fill(0)}class Ef extends ig{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Nh(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=RP(this.state)}keccak(){cw||uw(this.state32),mw(this.state32,this.rounds),cw||uw(this.state32),this.posOut=0,this.pos=0}update(e){Uc(this);const{blockLen:r,state:n}=this;e=xf(e);const i=e.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Nh(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(ow(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new Ef(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Zo=(t,e,r)=>fw(()=>new Ef(e,t,r)),KP=Zo(6,144,224/8),VP=Zo(6,136,256/8),GP=Zo(6,104,384/8),YP=Zo(6,72,512/8),JP=Zo(1,144,224/8),vw=Zo(1,136,256/8),XP=Zo(1,104,384/8),ZP=Zo(1,72,512/8),bw=(t,e,r)=>BP((n={})=>new Ef(e,t,n.dkLen===void 0?r:n.dkLen,!0)),QP=bw(31,168,128/8),eM=bw(31,136,256/8),tM=Object.freeze(Object.defineProperty({__proto__:null,Keccak:Ef,keccakP:mw,keccak_224:JP,keccak_256:vw,keccak_384:XP,keccak_512:ZP,sha3_224:KP,sha3_256:VP,sha3_384:GP,sha3_512:YP,shake128:QP,shake256:eM},Symbol.toStringTag,{value:"Module"}));function Sf(t,e){const r=e||"hex",n=vw(Jo(t,{strict:!1})?rg(t):t);return r==="bytes"?n:Dh(n)}const rM=t=>Sf(rg(t));function nM(t){return rM(t)}function iM(t){let e=!0,r="",n=0,i="",s=!1;for(let o=0;o{const e=typeof t=="string"?t:tP(t);return iM(e)};function yw(t){return nM(sM(t))}const oM=yw;class zc extends yt{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class kh extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const sg=new kh(8192);function Af(t,e){if(sg.has(`${t}.${e}`))return sg.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=Sf(sw(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return sg.set(`${t}.${e}`,s),s}function og(t,e){if(!uo(t,{strict:!1}))throw new zc({address:t});return Af(t,e)}const aM=/^0x[a-fA-F0-9]{40}$/,ag=new kh(8192);function uo(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(ag.has(n))return ag.get(n);const i=aM.test(t)?t.toLowerCase()===t?!0:r?Af(t)===t:!0:!1;return ag.set(n,i),i}function Hc(t){return typeof t[0]=="string"?Bh(t):cM(t)}function cM(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function Bh(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}function $h(t,e,r,{strict:n}={}){return Jo(t,{strict:!1})?uM(t,e,r,{strict:n}):_w(t,e,r,{strict:n})}function ww(t,e){if(typeof e=="number"&&e>0&&e>_n(t)-1)throw new ew({offset:e,position:"start",size:_n(t)})}function xw(t,e,r){if(typeof e=="number"&&typeof r=="number"&&_n(t)!==r-e)throw new ew({offset:r,position:"end",size:_n(t)})}function _w(t,e,r,{strict:n}={}){ww(t,e);const i=t.slice(e,r);return n&&xw(i,e,r),i}function uM(t,e,r,{strict:n}={}){ww(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&xw(i,e,r),i}function Ew(t,e){if(t.length!==e.length)throw new aP({expectedLength:t.length,givenLength:e.length});const r=fM({params:t,values:e}),n=ug(r);return n.length===0?"0x":n}function fM({params:t,values:e}){const r=[];for(let n=0;n0?Hc([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:Hc(s.map(({encoded:o})=>o))}}function dM(t,{param:e}){const[,r]=e.type.split("bytes"),n=_n(t);if(!r){let i=t;return n%32!==0&&(i=Xo(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:Hc([Xo(Pr(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new oP({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:Xo(t,{dir:"right"})}}function pM(t){if(typeof t!="boolean")throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Xo(nw(t))}}function gM(t,{signed:e}){return{dynamic:!1,encoded:Pr(t,{size:32,signed:e})}}function mM(t){const e=Oh(t),r=Math.ceil(_n(e)/32),n=[];for(let i=0;ii))}}function fg(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const lg=t=>$h(yw(t),0,4);function Sw(t){const{abi:e,args:r=[],name:n}=t,i=Jo(n,{strict:!1}),s=e.filter(a=>i?a.type==="function"?lg(a)===n:a.type==="event"?oM(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((l,d)=>{const p="inputs"in a&&a.inputs[d];return p?hg(l,p):!1})){if(o&&"inputs"in o&&o.inputs){const l=Aw(a.inputs,o.inputs,r);if(l)throw new cP({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||s[0]}function hg(t,e){const r=typeof t,n=e.type;switch(n){case"address":return uo(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>hg(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>hg(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Aw(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return Aw(i.components,s.components,r[n]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?uo(r[n],{strict:!1}):o.includes("address")&&o.includes("bytes")?uo(r[n],{strict:!1}):!1)return o}}function fo(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const Pw="/docs/contract/encodeFunctionData";function bM(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=Sw({abi:e,args:r,name:n});if(!s)throw new Qy(n,{docsPath:Pw});i=s}if(i.type!=="function")throw new Qy(void 0,{docsPath:Pw});return{abi:[i],functionName:lg(Bc(i))}}function yM(t){const{args:e}=t,{abi:r,functionName:n}=(()=>{var a;return t.abi.length===1&&((a=t.functionName)!=null&&a.startsWith("0x"))?t:bM(t)})(),i=r[0],s=n,o="inputs"in i&&i.inputs?Ew(i.inputs,e??[]):void 0;return Bh([s,o??"0x"])}const wM={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},xM={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},_M={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Mw extends yt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class EM extends yt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class SM extends yt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const AM={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new SM({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new EM({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Mw({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Mw({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function dg(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(AM);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function PM(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return wf(r,e)}function MM(t,e={}){let r=t;if(typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r)),r.length>1||r[0]>1)throw new mP(r);return!!r[0]}function lo(t,e={}){typeof e.size<"u"&&Ds(t,{size:e.size});const r=li(t,e);return Fc(r,e)}function IM(t,e={}){let r=t;return typeof e.size<"u"&&(Ds(r,{size:e.size}),r=tg(r,{dir:"right"})),new TextDecoder().decode(r)}function CM(t,e){const r=typeof e=="string"?co(e):e,n=dg(r);if(_n(r)===0&&t.length>0)throw new eg;if(_n(e)&&_n(e)<32)throw new iP({data:typeof e=="string"?e:li(e),params:t,size:_n(e)});let i=0;const s=[];for(let o=0;o48?PM(i,{signed:r}):lo(i,{signed:r}),32]}function LM(t,e,{staticPosition:r}){const n=e.components.length===0||e.components.some(({name:o})=>!o),i=n?[]:{};let s=0;if(Pf(e)){const o=lo(t.readBytes(pg)),a=r+o;for(let u=0;uo.type==="error"&&n===lg(Bc(o)));if(!s)throw new Zy(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?CM(s.inputs,$h(r,4)):void 0,errorName:s.name}}const Kc=(t,e,r)=>JSON.stringify(t,(n,i)=>typeof i=="bigint"?i.toString():i,r);function Cw({abiItem:t,args:e,includeFunctionName:r=!0,includeName:n=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${r?t.name:""}(${t.inputs.map((i,s)=>`${n&&i.name?`${i.name}: `:""}${typeof e[s]=="object"?Kc(e[s]):e[s]}`).join(", ")})`}const $M={gwei:9,wei:18},FM={ether:-9,wei:9};function Tw(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}function Rw(t,e="wei"){return Tw(t,$M[e])}function hs(t,e="wei"){return Tw(t,FM[e])}class jM extends yt{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class UM extends yt{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Fh(t){const e=Object.entries(t).map(([n,i])=>i===void 0||i===!1?null:[n,i]).filter(Boolean),r=e.reduce((n,[i])=>Math.max(n,i.length),0);return e.map(([n,i])=>` ${`${n}:`.padEnd(r+1)} ${i}`).join(` `)}class qM extends yt{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(` -`),{name:"FeeConflictError"})}}class zM extends yt{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Fh(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class HM extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var P;const A=Fh({chain:i&&`${i==null?void 0:i.name} (id: ${i==null?void 0:i.id})`,from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Dw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",A].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const WM=t=>t,Ow=t=>t;class KM extends yt{constructor(e,{abi:r,args:n,contractAddress:i,docsPath:s,functionName:o,sender:a}){const u=Aw({abi:r,args:n,name:o}),l=u?Tw({abiItem:u,args:n,includeFunctionName:!1,includeName:!1}):void 0,d=u?Bc(u,{includeName:!0}):void 0,p=Fh({address:i&&WM(i),function:d,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:s,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],p&&"Contract Call:",p].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=e,this.contractAddress=i,this.functionName=o,this.sender=a}}class VM extends yt{constructor({abi:e,data:r,functionName:n,message:i}){let s,o,a,u;if(r&&r!=="0x")try{o=BM({abi:e,data:r});const{abiItem:d,errorName:p,args:y}=o;if(p==="Error")u=y[0];else if(p==="Panic"){const[A]=y;u=wM[A]}else{const A=d?Bc(d,{includeName:!0}):void 0,P=d&&y?Tw({abiItem:d,args:y,includeFunctionName:!1,includeName:!1}):void 0;a=[A?`Error: ${A}`:"",P&&P!=="()"?` ${[...Array((p==null?void 0:p.length)??0).keys()].map(()=>" ").join("")}${P}`:""]}}catch(d){s=d}else i&&(u=i);let l;s instanceof Qy&&(l=s.signature,a=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(u&&u!=="execution reverted"||l?[`The contract function "${n}" reverted with the following ${l?"signature":"reason"}:`,u||l].join(` -`):`The contract function "${n}" reverted.`,{cause:s,metaMessages:a,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.reason=u,this.signature=l}}class GM extends yt{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class YM extends yt{constructor({data:e,message:r}){super(r||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}class Nw extends yt{constructor({body:e,cause:r,details:n,headers:i,status:s,url:o}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${Ow(o)}`,e&&`Request body: ${Kc(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=i,this.status=s,this.url=o}}class JM extends yt{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${Ow(n)}`,`Request body: ${Kc(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code}}const XM=-1;class hi extends yt{constructor(e,{code:r,docsPath:n,metaMessages:i,name:s,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:i||(e==null?void 0:e.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||e.name,this.code=e instanceof JM?e.code:r??XM}}class Vc extends hi{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class Mf extends hi{constructor(e){super(e,{code:Mf.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Mf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class If extends hi{constructor(e){super(e,{code:If.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(If,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Cf extends hi{constructor(e,{method:r}={}){super(e,{code:Cf.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(Cf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Tf extends hi{constructor(e){super(e,{code:Tf.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` +`),{name:"FeeConflictError"})}}class zM extends yt{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Fh(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class HM extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var P;const A=Fh({chain:i&&`${i==null?void 0:i.name} (id: ${i==null?void 0:i.id})`,from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Rw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",A].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const WM=t=>t,Dw=t=>t;class KM extends yt{constructor(e,{abi:r,args:n,contractAddress:i,docsPath:s,functionName:o,sender:a}){const u=Sw({abi:r,args:n,name:o}),l=u?Cw({abiItem:u,args:n,includeFunctionName:!1,includeName:!1}):void 0,d=u?Bc(u,{includeName:!0}):void 0,p=Fh({address:i&&WM(i),function:d,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:s,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],p&&"Contract Call:",p].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=e,this.contractAddress=i,this.functionName=o,this.sender=a}}class VM extends yt{constructor({abi:e,data:r,functionName:n,message:i}){let s,o,a,u;if(r&&r!=="0x")try{o=BM({abi:e,data:r});const{abiItem:d,errorName:p,args:y}=o;if(p==="Error")u=y[0];else if(p==="Panic"){const[A]=y;u=wM[A]}else{const A=d?Bc(d,{includeName:!0}):void 0,P=d&&y?Cw({abiItem:d,args:y,includeFunctionName:!1,includeName:!1}):void 0;a=[A?`Error: ${A}`:"",P&&P!=="()"?` ${[...Array((p==null?void 0:p.length)??0).keys()].map(()=>" ").join("")}${P}`:""]}}catch(d){s=d}else i&&(u=i);let l;s instanceof Zy&&(l=s.signature,a=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(u&&u!=="execution reverted"||l?[`The contract function "${n}" reverted with the following ${l?"signature":"reason"}:`,u||l].join(` +`):`The contract function "${n}" reverted.`,{cause:s,metaMessages:a,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.reason=u,this.signature=l}}class GM extends yt{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class YM extends yt{constructor({data:e,message:r}){super(r||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}class Ow extends yt{constructor({body:e,cause:r,details:n,headers:i,status:s,url:o}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${Dw(o)}`,e&&`Request body: ${Kc(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=i,this.status=s,this.url=o}}class JM extends yt{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${Dw(n)}`,`Request body: ${Kc(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code}}const XM=-1;class hi extends yt{constructor(e,{code:r,docsPath:n,metaMessages:i,name:s,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:i||(e==null?void 0:e.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||e.name,this.code=e instanceof JM?e.code:r??XM}}class Vc extends hi{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class Mf extends hi{constructor(e){super(e,{code:Mf.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Mf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class If extends hi{constructor(e){super(e,{code:If.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(If,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Cf extends hi{constructor(e,{method:r}={}){super(e,{code:Cf.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(Cf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Tf extends hi{constructor(e){super(e,{code:Tf.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` `)})}}Object.defineProperty(Tf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Ba extends hi{constructor(e){super(e,{code:Ba.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Ba,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Rf extends hi{constructor(e){super(e,{code:Rf.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` -`)})}}Object.defineProperty(Rf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Df extends hi{constructor(e){super(e,{code:Df.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Df,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Of extends hi{constructor(e){super(e,{code:Of.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Of,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Nf extends hi{constructor(e){super(e,{code:Nf.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Nf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Lf extends hi{constructor(e,{method:r}={}){super(e,{code:Lf.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not implemented.`})}}Object.defineProperty(Lf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Gc extends hi{constructor(e){super(e,{code:Gc.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Gc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class kf extends hi{constructor(e){super(e,{code:kf.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(kf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Yc extends Vc{constructor(e){super(e,{code:Yc.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Yc,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Bf extends Vc{constructor(e){super(e,{code:Bf.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Bf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class $f extends Vc{constructor(e,{method:r}={}){super(e,{code:$f.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty($f,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Ff extends Vc{constructor(e){super(e,{code:Ff.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Ff,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class jf extends Vc{constructor(e){super(e,{code:jf.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(jf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Uf extends Vc{constructor(e){super(e,{code:Uf.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Uf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ZM extends hi{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const QM=3;function eI(t,{abi:e,address:r,args:n,docsPath:i,functionName:s,sender:o}){const{code:a,data:u,message:l,shortMessage:d}=t instanceof YM?t:t instanceof yt?t.walk(y=>"data"in y)||t.walk():{},p=t instanceof eg?new GM({functionName:s}):[QM,Ba.code].includes(a)&&(u||l||d)?new VM({abi:e,data:typeof u=="object"?u.data:u,functionName:s,message:d??l}):t;return new KM(p,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:o})}function tI(t){const e=Sf(`0x${t.substring(4)}`).substring(26);return Af(`0x${e}`)}async function rI({hash:t,signature:e}){const r=Jo(t)?t:Dh(t),{secp256k1:n}=await Promise.resolve().then(()=>UC);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:d,v:p,yParity:y}=e,A=Number(y??p),P=Lw(A);return new n.Signature(wf(l),wf(d)).addRecoveryBit(P)}const o=Jo(e)?e:Dh(e),a=Fc(`0x${o.slice(130)}`),u=Lw(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Lw(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function nI({hash:t,signature:e}){return tI(await rI({hash:t,signature:e}))}function iI(t,e="hex"){const r=kw(t),n=dg(new Uint8Array(r.length));return r.encode(n),e==="hex"?li(n.bytes):n.bytes}function kw(t){return Array.isArray(t)?sI(t.map(e=>kw(e))):oI(t)}function sI(t){const e=t.reduce((i,s)=>i+s.length,0),r=Bw(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function oI(t){const e=typeof t=="string"?co(t):t,r=Bw(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function Bw(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new yt("Length is too large.")}function aI(t){const{chainId:e,contractAddress:r,nonce:n,to:i}=t,s=Sf(Bh(["0x05",iI([e?Pr(e):"0x",r,n?Pr(n):"0x"])]));return i==="bytes"?co(s):s}async function $w(t){const{authorization:e,signature:r}=t;return nI({hash:aI(e),signature:r??e})}class cI extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var P;const A=Fh({from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Dw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",A].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class Jc extends yt{constructor({cause:e,message:r}={}){var i;const n=(i=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(Jc,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Jc,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class jh extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(jh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class gg extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(gg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class mg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(mg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class vg extends yt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` +`)})}}Object.defineProperty(Rf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Df extends hi{constructor(e){super(e,{code:Df.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Df,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Of extends hi{constructor(e){super(e,{code:Of.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Of,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Nf extends hi{constructor(e){super(e,{code:Nf.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Nf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Lf extends hi{constructor(e,{method:r}={}){super(e,{code:Lf.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not implemented.`})}}Object.defineProperty(Lf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Gc extends hi{constructor(e){super(e,{code:Gc.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Gc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class kf extends hi{constructor(e){super(e,{code:kf.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(kf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Yc extends Vc{constructor(e){super(e,{code:Yc.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Yc,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Bf extends Vc{constructor(e){super(e,{code:Bf.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Bf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class $f extends Vc{constructor(e,{method:r}={}){super(e,{code:$f.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty($f,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Ff extends Vc{constructor(e){super(e,{code:Ff.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Ff,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class jf extends Vc{constructor(e){super(e,{code:jf.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(jf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Uf extends Vc{constructor(e){super(e,{code:Uf.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Uf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ZM extends hi{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const QM=3;function eI(t,{abi:e,address:r,args:n,docsPath:i,functionName:s,sender:o}){const{code:a,data:u,message:l,shortMessage:d}=t instanceof YM?t:t instanceof yt?t.walk(y=>"data"in y)||t.walk():{},p=t instanceof eg?new GM({functionName:s}):[QM,Ba.code].includes(a)&&(u||l||d)?new VM({abi:e,data:typeof u=="object"?u.data:u,functionName:s,message:d??l}):t;return new KM(p,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:o})}function tI(t){const e=Sf(`0x${t.substring(4)}`).substring(26);return Af(`0x${e}`)}async function rI({hash:t,signature:e}){const r=Jo(t)?t:Dh(t),{secp256k1:n}=await Promise.resolve().then(()=>UC);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:d,v:p,yParity:y}=e,A=Number(y??p),P=Nw(A);return new n.Signature(wf(l),wf(d)).addRecoveryBit(P)}const o=Jo(e)?e:Dh(e),a=Fc(`0x${o.slice(130)}`),u=Nw(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Nw(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function nI({hash:t,signature:e}){return tI(await rI({hash:t,signature:e}))}function iI(t,e="hex"){const r=Lw(t),n=dg(new Uint8Array(r.length));return r.encode(n),e==="hex"?li(n.bytes):n.bytes}function Lw(t){return Array.isArray(t)?sI(t.map(e=>Lw(e))):oI(t)}function sI(t){const e=t.reduce((i,s)=>i+s.length,0),r=kw(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function oI(t){const e=typeof t=="string"?co(t):t,r=kw(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function kw(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new yt("Length is too large.")}function aI(t){const{chainId:e,contractAddress:r,nonce:n,to:i}=t,s=Sf(Bh(["0x05",iI([e?Pr(e):"0x",r,n?Pr(n):"0x"])]));return i==="bytes"?co(s):s}async function Bw(t){const{authorization:e,signature:r}=t;return nI({hash:aI(e),signature:r??e})}class cI extends yt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var P;const A=Fh({from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Rw(y)} ${((P=i==null?void 0:i.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${hs(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${hs(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${hs(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",A].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class Jc extends yt{constructor({cause:e,message:r}={}){var i;const n=(i=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(Jc,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Jc,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class jh extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(jh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class gg extends yt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${hs(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(gg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class mg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(mg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class vg extends yt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` `),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(vg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class bg extends yt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(bg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class yg extends yt{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` `),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(yg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class wg extends yt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(wg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class xg extends yt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(xg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class _g extends yt{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(_g,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Uh extends yt{constructor({cause:e,maxPriorityFeePerGas:r,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${r?` = ${hs(r)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${hs(n)} gwei`:""}).`].join(` -`),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(Uh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Eg extends yt{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function Fw(t,e){const r=(t.details||"").toLowerCase(),n=t instanceof yt?t.walk(i=>(i==null?void 0:i.code)===Jc.code):t;return n instanceof yt?new Jc({cause:t,message:n.details}):Jc.nodeMessage.test(r)?new Jc({cause:t,message:t.details}):jh.nodeMessage.test(r)?new jh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):gg.nodeMessage.test(r)?new gg({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):mg.nodeMessage.test(r)?new mg({cause:t,nonce:e==null?void 0:e.nonce}):vg.nodeMessage.test(r)?new vg({cause:t,nonce:e==null?void 0:e.nonce}):bg.nodeMessage.test(r)?new bg({cause:t,nonce:e==null?void 0:e.nonce}):yg.nodeMessage.test(r)?new yg({cause:t}):wg.nodeMessage.test(r)?new wg({cause:t,gas:e==null?void 0:e.gas}):xg.nodeMessage.test(r)?new xg({cause:t,gas:e==null?void 0:e.gas}):_g.nodeMessage.test(r)?new _g({cause:t}):Uh.nodeMessage.test(r)?new Uh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new Eg({cause:t})}function uI(t,{docsPath:e,...r}){const n=(()=>{const i=Fw(t,r);return i instanceof Eg?t:i})();return new cI(n,{docsPath:e,...r})}function jw(t,{format:e}){if(!e)return{};const r={};function n(s){const o=Object.keys(s);for(const a of o)a in t&&(r[a]=t[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}const i=e(t||{});return n(i),r}const fI={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Sg(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=lI(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(r=>li(r)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=Pr(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=Pr(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=Pr(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=Pr(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=Pr(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=Pr(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=fI[t.type]),typeof t.value<"u"&&(e.value=Pr(t.value)),e}function lI(t){return t.map(e=>({address:e.contractAddress,r:e.r,s:e.s,chainId:Pr(e.chainId),nonce:Pr(e.nonce),...typeof e.yParity<"u"?{yParity:Pr(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:Pr(e.v)}:{}}))}function Uw(t){if(!(!t||t.length===0))return t.reduce((e,{slot:r,value:n})=>{if(r.length!==66)throw new nw({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new nw({size:n.length,targetSize:66,type:"hex"});return e[r]=n,e},{})}function hI(t){const{balance:e,nonce:r,state:n,stateDiff:i,code:s}=t,o={};if(s!==void 0&&(o.code=s),e!==void 0&&(o.balance=Pr(e)),r!==void 0&&(o.nonce=Pr(r)),n!==void 0&&(o.state=Uw(n)),i!==void 0){if(o.state)throw new UM;o.stateDiff=Uw(i)}return o}function dI(t){if(!t)return;const e={};for(const{address:r,...n}of t){if(!uo(r,{strict:!1}))throw new zc({address:r});if(e[r])throw new jM({address:r});e[r]=hI(n)}return e}const pI=2n**256n-1n;function qh(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?fo(e):void 0;if(o&&!uo(o.address))throw new zc({address:o.address});if(s&&!uo(s))throw new zc({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new qM;if(n&&n>pI)throw new jh({maxFeePerGas:n});if(i&&n&&i>n)throw new Uh({maxFeePerGas:n,maxPriorityFeePerGas:i})}class gI extends yt{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Ag extends yt{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class mI extends yt{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${hs(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class vI extends yt{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}const bI={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function yI(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?Fc(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?Fc(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?bI[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=wI(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function wI(t){return t.map(e=>({contractAddress:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function xI(t){const e=(t.transactions??[]).map(r=>typeof r=="string"?r:yI(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function zh(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){var d,p,y;const s=n??"latest",o=i??!1,a=r!==void 0?Pr(r):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,o]},{dedupe:!0}):u=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]},{dedupe:!!a}),!u)throw new vI({blockHash:e,blockNumber:r});return(((y=(p=(d=t.chain)==null?void 0:d.formatters)==null?void 0:p.block)==null?void 0:y.format)||xI)(u)}async function qw(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function _I(t,e){var s,o;const{block:r,chain:n=t.chain,request:i}=e||{};try{const a=((s=n==null?void 0:n.fees)==null?void 0:s.maxPriorityFeePerGas)??((o=n==null?void 0:n.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=r||await fi(t,zh,"getBlock")({}),d=await a({block:l,client:t,request:i});if(d===null)throw new Error;return d}if(typeof a<"u")return a;const u=await t.request({method:"eth_maxPriorityFeePerGas"});return wf(u)}catch{const[a,u]=await Promise.all([r?Promise.resolve(r):fi(t,zh,"getBlock")({}),fi(t,qw,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new Ag;const l=u-a.baseFeePerGas;return l<0n?0n:l}}async function zw(t,e){var y,A;const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>{var P,N;return typeof((P=n==null?void 0:n.fees)==null?void 0:P.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):((N=n==null?void 0:n.fees)==null?void 0:N.baseFeeMultiplier)??1.2})();if(o<1)throw new gI;const u=10**(((y=o.toString().split(".")[1])==null?void 0:y.length)??0),l=P=>P*BigInt(Math.ceil(o*u))/BigInt(u),d=r||await fi(t,zh,"getBlock")({});if(typeof((A=n==null?void 0:n.fees)==null?void 0:A.estimateFeesPerGas)=="function"){const P=await n.fees.estimateFeesPerGas({block:r,client:t,multiply:l,request:i,type:s});if(P!==null)return P}if(s==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new Ag;const P=typeof(i==null?void 0:i.maxPriorityFeePerGas)=="bigint"?i.maxPriorityFeePerGas:await _I(t,{block:d,chain:n,request:i}),N=l(d.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??N+P,maxPriorityFeePerGas:P}}return{gasPrice:(i==null?void 0:i.gasPrice)??l(await fi(t,qw,"getGasPrice")({}))}}async function EI(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,n?Pr(n):r]},{dedupe:!!n});return Fc(i)}function Hw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(s=>co(s)):t.blobs,i=[];for(const s of n)i.push(Uint8Array.from(e.blobToKzgCommitment(s)));return r==="bytes"?i:i.map(s=>li(s))}function Ww(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>co(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>co(o)):t.commitments,s=[];for(let o=0;oli(o))}function SI(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),u=n?4:0,l=n?0:4;t.setUint32(e+u,o,n),t.setUint32(e+l,a,n)}const AI=(t,e,r)=>t&e^~t&r,PI=(t,e,r)=>t&e^t&r^e&r;class MI extends ig{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ng(this.buffer)}update(e){Uc(this);const{view:r,buffer:n,blockLen:i}=this;e=xf(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let p=o;pd.length)throw new Error("_sha2: outputLen bigger than state");for(let p=0;p>>3,N=Os(A,17)^Os(A,19)^A>>>10;ea[p]=N+ea[p-7]+P+ea[p-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:u,G:l,H:d}=this;for(let p=0;p<64;p++){const y=Os(a,6)^Os(a,11)^Os(a,25),A=d+y+AI(a,u,l)+II[p]+ea[p]|0,N=(Os(n,2)^Os(n,13)^Os(n,22))+PI(n,i,s)|0;d=l,l=u,u=a,a=o+A|0,o=s,s=i,i=n,n=A+N|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(n,i,s,o,a,u,l,d)}roundClean(){ea.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Pg=lw(()=>new CI);function TI(t,e){return Pg(Jo(t,{strict:!1})?rg(t):t)}function RI(t){const{commitment:e,version:r=1}=t,n=t.to??(typeof e=="string"?"hex":"bytes"),i=TI(e);return i.set([r],0),n==="bytes"?i:li(i)}function DI(t){const{commitments:e,version:r}=t,n=t.to??(typeof e[0]=="string"?"hex":"bytes"),i=[];for(const s of e)i.push(RI({commitment:s,to:n,version:r}));return i}const Kw=6,Vw=32,Mg=4096,Gw=Vw*Mg,Yw=Gw*Kw-1-1*Mg*Kw;class OI extends yt{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class NI extends yt{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function LI(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),r=typeof t.data=="string"?co(t.data):t.data,n=_n(r);if(!n)throw new NI;if(n>Yw)throw new OI({maxSize:Yw,size:n});const i=[];let s=!0,o=0;for(;s;){const a=dg(new Uint8Array(Gw));let u=0;for(;ua.bytes):i.map(a=>li(a.bytes))}function kI(t){const{data:e,kzg:r,to:n}=t,i=t.blobs??LI({data:e,to:n}),s=t.commitments??Hw({blobs:i,kzg:r,to:n}),o=t.proofs??Ww({blobs:i,commitments:s,kzg:r,to:n}),a=[];for(let u=0;u"u"&&p)if(u){const k=await D();y.nonce=await u.consume({address:p.address,chainId:k,client:t})}else y.nonce=await fi(t,EI,"getTransactionCount")({address:p.address,blockTag:"pending"});if((l.includes("fees")||l.includes("type"))&&typeof d>"u")try{y.type=BI(y)}catch{const k=await P();y.type=typeof(k==null?void 0:k.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(l.includes("fees"))if(y.type!=="legacy"&&y.type!=="eip2930"){if(typeof y.maxFeePerGas>"u"||typeof y.maxPriorityFeePerGas>"u"){const k=await P(),{maxFeePerGas:B,maxPriorityFeePerGas:q}=await zw(t,{block:k,chain:i,request:y});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(y.gas=await fi(t,FI,"estimateGas")({...y,account:p&&{address:p.address,type:"json-rpc"}})),qh(y),delete y.parameters,y}async function $I(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=r?Pr(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function FI(t,e){var i,s,o;const{account:r=t.account}=e,n=r?fo(r):void 0;try{let f=function(v){const{block:x,request:_,rpcStateOverride:S}=v;return t.request({method:"eth_estimateGas",params:S?[_,x??"latest",S]:x?[_,x]:[_]})};const{accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,blockNumber:p,blockTag:y,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:q,value:j,stateOverride:H,...J}=await Ig(t,{...e,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),z=(p?Pr(p):void 0)||y,ue=dI(H),_e=await(async()=>{if(J.to)return J.to;if(u&&u.length>0)return await $w({authorization:u[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`")})})();qh(e);const G=(o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:o.format,m=(G||Sg)({...jw(J,{format:G}),from:n==null?void 0:n.address,accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,data:A,gas:P,gasPrice:N,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:q,to:_e,value:j});let g=BigInt(await f({block:z,request:m,rpcStateOverride:ue}));if(u){const v=await $I(t,{address:m.from}),x=await Promise.all(u.map(async _=>{const{contractAddress:S}=_,b=await f({block:z,request:{authorizationList:void 0,data:A,from:n==null?void 0:n.address,to:S,value:Pr(v)},rpcStateOverride:ue}).catch(()=>100000n);return 2n*BigInt(b)}));g+=x.reduce((_,S)=>_+S,0n)}return g}catch(a){throw uI(a,{...e,account:n,chain:t.chain})}}class jI extends yt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class UI extends yt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` -`),{name:"ChainNotFoundError"})}}const Cg="/docs/contract/encodeDeployData";function qI(t){const{abi:e,args:r,bytecode:n}=t;if(!r||r.length===0)return n;const i=e.find(o=>"type"in o&&o.type==="constructor");if(!i)throw new nP({docsPath:Cg});if(!("inputs"in i))throw new Zy({docsPath:Cg});if(!i.inputs||i.inputs.length===0)throw new Zy({docsPath:Cg});const s=Sw(i.inputs,r);return Bh([n,s])}async function zI(t){return new Promise(e=>setTimeout(e,t))}class qf extends yt{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` -`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class Tg extends yt{constructor({docsPath:e,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:e,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function Xw({chain:t,currentChainId:e}){if(!t)throw new UI;if(e!==t.id)throw new jI({chain:t,currentChainId:e})}function HI(t,{docsPath:e,...r}){const n=(()=>{const i=Fw(t,r);return i instanceof Eg?t:i})();return new HM(n,{docsPath:e,...r})}async function Zw(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const Rg=new kh(128);async function Dg(t,e){var k,B,q,j;const{account:r=t.account,chain:n=t.chain,accessList:i,authorizationList:s,blobs:o,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,value:P,...N}=e;if(typeof r>"u")throw new qf({docsPath:"/docs/actions/wallet/sendTransaction"});const D=r?fo(r):null;try{qh(e);const H=await(async()=>{if(e.to)return e.to;if(s&&s.length>0)return await $w({authorization:s[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`.")})})();if((D==null?void 0:D.type)==="json-rpc"||D===null){let J;n!==null&&(J=await fi(t,Hh,"getChainId")({}),Xw({currentChainId:J,chain:n}));const T=(q=(B=(k=t.chain)==null?void 0:k.formatters)==null?void 0:B.transactionRequest)==null?void 0:q.format,ue=(T||Sg)({...jw(N,{format:T}),accessList:i,authorizationList:s,blobs:o,chainId:J,data:a,from:D==null?void 0:D.address,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,to:H,value:P}),_e=Rg.get(t.uid),G=_e?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:G,params:[ue]},{retryCount:0})}catch(E){if(_e===!1)throw E;const m=E;if(m.name==="InvalidInputRpcError"||m.name==="InvalidParamsRpcError"||m.name==="MethodNotFoundRpcError"||m.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[ue]},{retryCount:0}).then(f=>(Rg.set(t.uid,!0),f)).catch(f=>{const g=f;throw g.name==="MethodNotFoundRpcError"||g.name==="MethodNotSupportedRpcError"?(Rg.set(t.uid,!1),m):g});throw m}}if((D==null?void 0:D.type)==="local"){const J=await fi(t,Ig,"prepareTransactionRequest")({account:D,accessList:i,authorizationList:s,blobs:o,chain:n,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,nonceManager:D.nonceManager,parameters:[...Jw,"sidecars"],value:P,...N,to:H}),T=(j=n==null?void 0:n.serializers)==null?void 0:j.transaction,z=await D.signTransaction(J,{serializer:T});return await fi(t,Zw,"sendRawTransaction")({serializedTransaction:z})}throw(D==null?void 0:D.type)==="smart"?new Tg({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Tg({docsPath:"/docs/actions/wallet/sendTransaction",type:D==null?void 0:D.type})}catch(H){throw H instanceof Tg?H:HI(H,{...e,account:D,chain:e.chain||void 0})}}async function WI(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:o,functionName:a,...u}=e;if(typeof n>"u")throw new qf({docsPath:"/docs/contract/writeContract"});const l=n?fo(n):null,d=yM({abi:r,args:s,functionName:a});try{return await fi(t,Dg,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:i,account:l,...u})}catch(p){throw eI(p,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:a,sender:l==null?void 0:l.address})}}async function KI(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:Pr(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}const Og=256;let Wh=Og,Kh;function Qw(t=11){if(!Kh||Wh+t>Og*2){Kh="",Wh=0;for(let e=0;e{const B=k(D);for(const j in P)delete B[j];const q={...D,...B};return Object.assign(q,{extend:N(q)})}}return Object.assign(P,{extend:N(P)})}const Vh=new kh(8192);function GI(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(Vh.get(r))return Vh.get(r);const n=t().finally(()=>Vh.delete(r));return Vh.set(r,n),n}function YI(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const u=async({error:l})=>{const d=typeof e=="function"?e({count:a,error:l}):e;d&&await zI(d),o({count:a+1})};try{const l=await t();i(l)}catch(l){if(a{const{dedupe:i=!1,retryDelay:s=150,retryCount:o=3,uid:a}={...e,...n},u=i?Sf(Oh(`${a}.${Kc(r)}`)):void 0;return GI(()=>YI(async()=>{try{return await t(r)}catch(l){const d=l;switch(d.code){case Mf.code:throw new Mf(d);case If.code:throw new If(d);case Cf.code:throw new Cf(d,{method:r.method});case Tf.code:throw new Tf(d);case Ba.code:throw new Ba(d);case Rf.code:throw new Rf(d);case Df.code:throw new Df(d);case Of.code:throw new Of(d);case Nf.code:throw new Nf(d);case Lf.code:throw new Lf(d,{method:r.method});case Gc.code:throw new Gc(d);case kf.code:throw new kf(d);case Yc.code:throw new Yc(d);case Bf.code:throw new Bf(d);case $f.code:throw new $f(d);case Ff.code:throw new Ff(d);case jf.code:throw new jf(d);case Uf.code:throw new Uf(d);case 5e3:throw new Yc(d);default:throw l instanceof yt?l:new ZM(d)}}},{delay:({count:l,error:d})=>{var p;if(d&&d instanceof Nw){const y=(p=d==null?void 0:d.headers)==null?void 0:p.get("Retry-After");if(y!=null&&y.match(/\d/))return Number.parseInt(y)*1e3}return~~(1<XI(l)}),{enabled:i,id:u})}}function XI(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Gc.code||t.code===Ba.code:t instanceof Nw&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function ZI({key:t,name:e,request:r,retryCount:n=3,retryDelay:i=150,timeout:s,type:o},a){const u=Qw();return{config:{key:t,name:e,request:r,retryCount:n,retryDelay:i,timeout:s,type:o},request:JI(r,{retryCount:n,retryDelay:i,uid:u}),value:a}}function QI(t,e={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=e;return({retryCount:s})=>ZI({key:r,name:n,request:t.request.bind(t),retryCount:e.retryCount??s,retryDelay:i,type:"custom"})}const eC=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,tC=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;class rC extends yt{constructor({domain:e}){super(`Invalid domain "${Kc(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class nC extends yt{constructor({primaryType:e,types:r}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class iC extends yt{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function sC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(u,l)=>{const d={...l};for(const p of u){const{name:y,type:A}=p;A==="address"&&(d[y]=d[y].toLowerCase())}return d},o=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return Kc({domain:o,message:a,primaryType:n,types:i})}function oC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(o,a)=>{for(const u of o){const{name:l,type:d}=u,p=a[l],y=d.match(tC);if(y&&(typeof p=="number"||typeof p=="bigint")){const[N,D,k]=y;Pr(p,{signed:D==="int",size:Number.parseInt(k)/8})}if(d==="address"&&typeof p=="string"&&!uo(p))throw new zc({address:p});const A=d.match(eC);if(A){const[N,D]=A;if(D&&_n(p)!==Number.parseInt(D))throw new uP({expectedSize:Number.parseInt(D),givenSize:_n(p)})}const P=i[d];P&&(cC(d),s(P,p))}};if(i.EIP712Domain&&e){if(typeof e!="object")throw new rC({domain:e});s(i.EIP712Domain,e)}if(n!=="EIP712Domain")if(i[n])s(i[n],r);else throw new nC({primaryType:n,types:i})}function aC({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},typeof(t==null?void 0:t.chainId)=="number"&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function cC(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new iC({type:t})}let e2=class extends ig{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,SP(e);const n=xf(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew e2(t,e).update(r).digest();t2.create=(t,e)=>new e2(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ng=BigInt(0),Gh=BigInt(1),uC=BigInt(2);function $a(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function zf(t){if(!$a(t))throw new Error("Uint8Array expected")}function Xc(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)}const fC=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Zc(t){zf(t);let e="";for(let r=0;r=ho._0&&t<=ho._9)return t-ho._0;if(t>=ho._A&&t<=ho._F)return t-(ho._A-10);if(t>=ho._a&&t<=ho._f)return t-(ho._a-10)}function eu(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;itypeof t=="bigint"&&Ng<=t;function Yh(t,e,r){return $g(t)&&$g(e)&&$g(r)&&e<=t&&tNg;t>>=Gh,e+=1);return e}function pC(t,e){return t>>BigInt(e)&Gh}function gC(t,e,r){return t|(r?Gh:Ng)<(uC<new Uint8Array(t),i2=t=>Uint8Array.from(t);function s2(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=jg(t),i=jg(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...p)=>r(i,n,...p),u=(p=jg())=>{i=a(i2([0]),p),n=a(),p.length!==0&&(i=a(i2([1]),p),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let p=0;const y=[];for(;p{o(),u(p);let A;for(;!(A=y(l()));)u();return o(),A}}const mC={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||$a(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Wf(t,e,r={}){const n=(i,s,o)=>{const a=mC[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const u=t[i];if(!(o&&u===void 0)&&!a(u,t))throw new Error(`Invalid param ${String(i)}=${u} (${typeof u}), expected ${s}`)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const vC=()=>{throw new Error("not implemented")};function Ug(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}const bC=Object.freeze(Object.defineProperty({__proto__:null,aInRange:ja,abool:Xc,abytes:zf,bitGet:pC,bitLen:n2,bitMask:Fg,bitSet:gC,bytesToHex:Zc,bytesToNumberBE:Fa,bytesToNumberLE:kg,concatBytes:Hf,createHmacDrbg:s2,ensureBytes:ds,equalBytes:hC,hexToBytes:eu,hexToNumber:Lg,inRange:Yh,isBytes:$a,memoized:Ug,notImplemented:vC,numberToBytesBE:tu,numberToBytesLE:Bg,numberToHexUnpadded:Qc,numberToVarBytesBE:lC,utf8ToBytes:dC,validateObject:Wf},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const In=BigInt(0),sn=BigInt(1),Ua=BigInt(2),yC=BigInt(3),qg=BigInt(4),o2=BigInt(5),a2=BigInt(8);BigInt(9),BigInt(16);function di(t,e){const r=t%e;return r>=In?r:e+r}function wC(t,e,r){if(r<=In||e 0");if(r===sn)return In;let n=sn;for(;e>In;)e&sn&&(n=n*t%r),t=t*t%r,e>>=sn;return n}function Ui(t,e,r){let n=t;for(;e-- >In;)n*=n,n%=r;return n}function zg(t,e){if(t===In||e<=In)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=di(t,e),n=e,i=In,s=sn;for(;r!==In;){const a=n/r,u=n%r,l=i-s*a;n=r,r=u,i=s,s=l}if(n!==sn)throw new Error("invert: does not exist");return di(i,e)}function xC(t){const e=(t-sn)/Ua;let r,n,i;for(r=t-sn,n=0;r%Ua===In;r/=Ua,n++);for(i=Ua;i(n[i]="function",n),e);return Wf(t,r)}function AC(t,e,r){if(r 0");if(r===In)return t.ONE;if(r===sn)return e;let n=t.ONE,i=e;for(;r>In;)r&sn&&(n=t.mul(n,i)),i=t.sqr(i),r>>=sn;return n}function PC(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function c2(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function u2(t,e,r=!1,n={}){if(t<=In)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=c2(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=_C(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:Fg(i),ZERO:In,ONE:sn,create:u=>di(u,t),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return In<=u&&uu===In,isOdd:u=>(u&sn)===sn,neg:u=>di(-u,t),eql:(u,l)=>u===l,sqr:u=>di(u*u,t),add:(u,l)=>di(u+l,t),sub:(u,l)=>di(u-l,t),mul:(u,l)=>di(u*l,t),pow:(u,l)=>AC(a,u,l),div:(u,l)=>di(u*zg(l,t),t),sqrN:u=>u*u,addN:(u,l)=>u+l,subN:(u,l)=>u-l,mulN:(u,l)=>u*l,inv:u=>zg(u,t),sqrt:n.sqrt||(u=>o(a,u)),invertBatch:u=>PC(a,u),cmov:(u,l,d)=>d?l:u,toBytes:u=>r?Bg(u,s):tu(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return r?kg(u):Fa(u)}});return Object.freeze(a)}function f2(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function l2(t){const e=f2(t);return e+Math.ceil(e/2)}function MC(t,e,r=!1){const n=t.length,i=f2(e),s=l2(e);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?Fa(t):kg(t),a=di(o,e-sn)+sn;return r?Bg(a,i):tu(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const IC=BigInt(0),Hg=BigInt(1),Wg=new WeakMap,h2=new WeakMap;function CC(t,e){const r=(s,o)=>{const a=o.negate();return s?a:o},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>e)throw new Error(`Wrong window size=${s}, should be [1..${e}]`)},i=s=>{n(s);const o=Math.ceil(e/s)+1,a=2**(s-1);return{windows:o,windowSize:a}};return{constTimeNegate:r,unsafeLadder(s,o){let a=t.ZERO,u=s;for(;o>IC;)o&Hg&&(a=a.add(u)),u=u.double(),o>>=Hg;return a},precomputeWindow(s,o){const{windows:a,windowSize:u}=i(o),l=[];let d=s,p=d;for(let y=0;y>=P,k>l&&(k-=A,a+=Hg);const B=D,q=D+Math.abs(k)-1,j=N%2!==0,H=k<0;k===0?p=p.add(r(j,o[B])):d=d.add(r(H,o[q]))}return{p:d,f:p}},wNAFCached(s,o,a){const u=h2.get(s)||1;let l=Wg.get(s);return l||(l=this.precomputeWindow(s,u),u!==1&&Wg.set(s,a(l))),this.wNAF(u,l,o)},setWindowSize(s,o){n(o),h2.set(s,o),Wg.delete(s)}}}function TC(t,e,r,n){if(!Array.isArray(r)||!Array.isArray(n)||n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((d,p)=>{if(!e.isValid(d))throw new Error(`wrong scalar at index ${p}`)}),r.forEach((d,p)=>{if(!(d instanceof t))throw new Error(`wrong point at index ${p}`)});const i=n2(BigInt(r.length)),s=i>12?i-3:i>4?i-2:i?2:1,o=(1<=0;d-=s){a.fill(t.ZERO);for(let y=0;y>BigInt(d)&BigInt(o));a[P]=a[P].add(r[y])}let p=t.ZERO;for(let y=a.length-1,A=t.ZERO;y>0;y--)A=A.add(a[y]),p=p.add(A);if(l=l.add(p),d!==0)for(let y=0;y{const{Err:r}=po;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=Qc(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?Qc(i.length/2|128):"";return`${Qc(t)}${s}${i}${e}`},decode(t,e){const{Err:r}=po;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");const l=e.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const d of l)o=o<<8|d;if(n+=u,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=po;if(t{const B=D.toAffine();return Hf(Uint8Array.from([4]),r.toBytes(B.x),r.toBytes(B.y))}),s=e.fromBytes||(N=>{const D=N.subarray(1),k=r.fromBytes(D.subarray(0,r.BYTES)),B=r.fromBytes(D.subarray(r.BYTES,2*r.BYTES));return{x:k,y:B}});function o(N){const{a:D,b:k}=e,B=r.sqr(N),q=r.mul(B,N);return r.add(r.add(q,r.mul(N,D)),k)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(N){return Yh(N,Cn,e.n)}function u(N){const{allowedPrivateKeyLengths:D,nByteLength:k,wrapPrivateKey:B,n:q}=e;if(D&&typeof N!="bigint"){if($a(N)&&(N=Zc(N)),typeof N!="string"||!D.includes(N.length))throw new Error("Invalid key");N=N.padStart(k*2,"0")}let j;try{j=typeof N=="bigint"?N:Fa(ds("private key",N,k))}catch{throw new Error(`private key must be ${k} bytes, hex or bigint, not ${typeof N}`)}return B&&(j=di(j,q)),ja("private key",j,Cn,q),j}function l(N){if(!(N instanceof y))throw new Error("ProjectivePoint expected")}const d=Ug((N,D)=>{const{px:k,py:B,pz:q}=N;if(r.eql(q,r.ONE))return{x:k,y:B};const j=N.is0();D==null&&(D=j?r.ONE:r.inv(q));const H=r.mul(k,D),J=r.mul(B,D),T=r.mul(q,D);if(j)return{x:r.ZERO,y:r.ZERO};if(!r.eql(T,r.ONE))throw new Error("invZ was invalid");return{x:H,y:J}}),p=Ug(N=>{if(N.is0()){if(e.allowInfinityPoint&&!r.is0(N.py))return;throw new Error("bad point: ZERO")}const{x:D,y:k}=N.toAffine();if(!r.isValid(D)||!r.isValid(k))throw new Error("bad point: x or y not FE");const B=r.sqr(k),q=o(D);if(!r.eql(B,q))throw new Error("bad point: equation left != right");if(!N.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(D,k,B){if(this.px=D,this.py=k,this.pz=B,D==null||!r.isValid(D))throw new Error("x required");if(k==null||!r.isValid(k))throw new Error("y required");if(B==null||!r.isValid(B))throw new Error("z required");Object.freeze(this)}static fromAffine(D){const{x:k,y:B}=D||{};if(!D||!r.isValid(k)||!r.isValid(B))throw new Error("invalid affine point");if(D instanceof y)throw new Error("projective point not allowed");const q=j=>r.eql(j,r.ZERO);return q(k)&&q(B)?y.ZERO:new y(k,B,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(D){const k=r.invertBatch(D.map(B=>B.pz));return D.map((B,q)=>B.toAffine(k[q])).map(y.fromAffine)}static fromHex(D){const k=y.fromAffine(s(ds("pointHex",D)));return k.assertValidity(),k}static fromPrivateKey(D){return y.BASE.multiply(u(D))}static msm(D,k){return TC(y,n,D,k)}_setWindowSize(D){P.setWindowSize(this,D)}assertValidity(){p(this)}hasEvenY(){const{y:D}=this.toAffine();if(r.isOdd)return!r.isOdd(D);throw new Error("Field doesn't support isOdd")}equals(D){l(D);const{px:k,py:B,pz:q}=this,{px:j,py:H,pz:J}=D,T=r.eql(r.mul(k,J),r.mul(j,q)),z=r.eql(r.mul(B,J),r.mul(H,q));return T&&z}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){const{a:D,b:k}=e,B=r.mul(k,g2),{px:q,py:j,pz:H}=this;let J=r.ZERO,T=r.ZERO,z=r.ZERO,ue=r.mul(q,q),_e=r.mul(j,j),G=r.mul(H,H),E=r.mul(q,j);return E=r.add(E,E),z=r.mul(q,H),z=r.add(z,z),J=r.mul(D,z),T=r.mul(B,G),T=r.add(J,T),J=r.sub(_e,T),T=r.add(_e,T),T=r.mul(J,T),J=r.mul(E,J),z=r.mul(B,z),G=r.mul(D,G),E=r.sub(ue,G),E=r.mul(D,E),E=r.add(E,z),z=r.add(ue,ue),ue=r.add(z,ue),ue=r.add(ue,G),ue=r.mul(ue,E),T=r.add(T,ue),G=r.mul(j,H),G=r.add(G,G),ue=r.mul(G,E),J=r.sub(J,ue),z=r.mul(G,_e),z=r.add(z,z),z=r.add(z,z),new y(J,T,z)}add(D){l(D);const{px:k,py:B,pz:q}=this,{px:j,py:H,pz:J}=D;let T=r.ZERO,z=r.ZERO,ue=r.ZERO;const _e=e.a,G=r.mul(e.b,g2);let E=r.mul(k,j),m=r.mul(B,H),f=r.mul(q,J),g=r.add(k,B),v=r.add(j,H);g=r.mul(g,v),v=r.add(E,m),g=r.sub(g,v),v=r.add(k,q);let x=r.add(j,J);return v=r.mul(v,x),x=r.add(E,f),v=r.sub(v,x),x=r.add(B,q),T=r.add(H,J),x=r.mul(x,T),T=r.add(m,f),x=r.sub(x,T),ue=r.mul(_e,v),T=r.mul(G,f),ue=r.add(T,ue),T=r.sub(m,ue),ue=r.add(m,ue),z=r.mul(T,ue),m=r.add(E,E),m=r.add(m,E),f=r.mul(_e,f),v=r.mul(G,v),m=r.add(m,f),f=r.sub(E,f),f=r.mul(_e,f),v=r.add(v,f),E=r.mul(m,v),z=r.add(z,E),E=r.mul(x,v),T=r.mul(g,T),T=r.sub(T,E),E=r.mul(g,m),ue=r.mul(x,ue),ue=r.add(ue,E),new y(T,z,ue)}subtract(D){return this.add(D.negate())}is0(){return this.equals(y.ZERO)}wNAF(D){return P.wNAFCached(this,D,y.normalizeZ)}multiplyUnsafe(D){ja("scalar",D,go,e.n);const k=y.ZERO;if(D===go)return k;if(D===Cn)return this;const{endo:B}=e;if(!B)return P.unsafeLadder(this,D);let{k1neg:q,k1:j,k2neg:H,k2:J}=B.splitScalar(D),T=k,z=k,ue=this;for(;j>go||J>go;)j&Cn&&(T=T.add(ue)),J&Cn&&(z=z.add(ue)),ue=ue.double(),j>>=Cn,J>>=Cn;return q&&(T=T.negate()),H&&(z=z.negate()),z=new y(r.mul(z.px,B.beta),z.py,z.pz),T.add(z)}multiply(D){const{endo:k,n:B}=e;ja("scalar",D,Cn,B);let q,j;if(k){const{k1neg:H,k1:J,k2neg:T,k2:z}=k.splitScalar(D);let{p:ue,f:_e}=this.wNAF(J),{p:G,f:E}=this.wNAF(z);ue=P.constTimeNegate(H,ue),G=P.constTimeNegate(T,G),G=new y(r.mul(G.px,k.beta),G.py,G.pz),q=ue.add(G),j=_e.add(E)}else{const{p:H,f:J}=this.wNAF(D);q=H,j=J}return y.normalizeZ([q,j])[0]}multiplyAndAddUnsafe(D,k,B){const q=y.BASE,j=(J,T)=>T===go||T===Cn||!J.equals(q)?J.multiplyUnsafe(T):J.multiply(T),H=j(this,k).add(j(D,B));return H.is0()?void 0:H}toAffine(D){return d(this,D)}isTorsionFree(){const{h:D,isTorsionFree:k}=e;if(D===Cn)return!0;if(k)return k(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:D,clearCofactor:k}=e;return D===Cn?this:k?k(y,this):this.multiplyUnsafe(e.h)}toRawBytes(D=!0){return Xc("isCompressed",D),this.assertValidity(),i(y,this,D)}toHex(D=!0){return Xc("isCompressed",D),Zc(this.toRawBytes(D))}}y.BASE=new y(e.Gx,e.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);const A=e.nBitLength,P=CC(y,e.endo?Math.ceil(A/2):A);return{CURVE:e,ProjectivePoint:y,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:a}}function LC(t){const e=d2(t);return Wf(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function kC(t){const e=LC(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(f){return di(f,n)}function a(f){return zg(f,n)}const{ProjectivePoint:u,normPrivateKeyToScalar:l,weierstrassEquation:d,isWithinCurveOrder:p}=NC({...e,toBytes(f,g,v){const x=g.toAffine(),_=r.toBytes(x.x),S=Hf;return Xc("isCompressed",v),v?S(Uint8Array.from([g.hasEvenY()?2:3]),_):S(Uint8Array.from([4]),_,r.toBytes(x.y))},fromBytes(f){const g=f.length,v=f[0],x=f.subarray(1);if(g===i&&(v===2||v===3)){const _=Fa(x);if(!Yh(_,Cn,r.ORDER))throw new Error("Point is not on curve");const S=d(_);let b;try{b=r.sqrt(S)}catch(F){const ae=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+ae)}const M=(b&Cn)===Cn;return(v&1)===1!==M&&(b=r.neg(b)),{x:_,y:b}}else if(g===s&&v===4){const _=r.fromBytes(x.subarray(0,r.BYTES)),S=r.fromBytes(x.subarray(r.BYTES,2*r.BYTES));return{x:_,y:S}}else throw new Error(`Point of length ${g} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`)}}),y=f=>Zc(tu(f,e.nByteLength));function A(f){const g=n>>Cn;return f>g}function P(f){return A(f)?o(-f):f}const N=(f,g,v)=>Fa(f.slice(g,v));class D{constructor(g,v,x){this.r=g,this.s=v,this.recovery=x,this.assertValidity()}static fromCompact(g){const v=e.nByteLength;return g=ds("compactSignature",g,v*2),new D(N(g,0,v),N(g,v,2*v))}static fromDER(g){const{r:v,s:x}=po.toSig(ds("DER",g));return new D(v,x)}assertValidity(){ja("r",this.r,Cn,n),ja("s",this.s,Cn,n)}addRecoveryBit(g){return new D(this.r,this.s,g)}recoverPublicKey(g){const{r:v,s:x,recovery:_}=this,S=J(ds("msgHash",g));if(_==null||![0,1,2,3].includes(_))throw new Error("recovery id invalid");const b=_===2||_===3?v+e.n:v;if(b>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const M=_&1?"03":"02",I=u.fromHex(M+y(b)),F=a(b),ae=o(-S*F),O=o(x*F),se=u.BASE.multiplyAndAddUnsafe(I,ae,O);if(!se)throw new Error("point at infinify");return se.assertValidity(),se}hasHighS(){return A(this.s)}normalizeS(){return this.hasHighS()?new D(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return eu(this.toDERHex())}toDERHex(){return po.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return eu(this.toCompactHex())}toCompactHex(){return y(this.r)+y(this.s)}}const k={isValidPrivateKey(f){try{return l(f),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const f=l2(e.n);return MC(e.randomBytes(f),e.n)},precompute(f=8,g=u.BASE){return g._setWindowSize(f),g.multiply(BigInt(3)),g}};function B(f,g=!0){return u.fromPrivateKey(f).toRawBytes(g)}function q(f){const g=$a(f),v=typeof f=="string",x=(g||v)&&f.length;return g?x===i||x===s:v?x===2*i||x===2*s:f instanceof u}function j(f,g,v=!0){if(q(f))throw new Error("first arg must be private key");if(!q(g))throw new Error("second arg must be public key");return u.fromHex(g).multiply(l(f)).toRawBytes(v)}const H=e.bits2int||function(f){const g=Fa(f),v=f.length*8-e.nBitLength;return v>0?g>>BigInt(v):g},J=e.bits2int_modN||function(f){return o(H(f))},T=Fg(e.nBitLength);function z(f){return ja(`num < 2^${e.nBitLength}`,f,go,T),tu(f,e.nByteLength)}function ue(f,g,v=_e){if(["recovered","canonical"].some(X=>X in v))throw new Error("sign() legacy options not supported");const{hash:x,randomBytes:_}=e;let{lowS:S,prehash:b,extraEntropy:M}=v;S==null&&(S=!0),f=ds("msgHash",f),p2(v),b&&(f=ds("prehashed msgHash",x(f)));const I=J(f),F=l(g),ae=[z(F),z(I)];if(M!=null&&M!==!1){const X=M===!0?_(r.BYTES):M;ae.push(ds("extraEntropy",X))}const O=Hf(...ae),se=I;function ee(X){const Q=H(X);if(!p(Q))return;const R=a(Q),Z=u.BASE.multiply(Q).toAffine(),te=o(Z.x);if(te===go)return;const le=o(R*o(se+te*F));if(le===go)return;let ie=(Z.x===te?0:2)|Number(Z.y&Cn),fe=le;return S&&A(le)&&(fe=P(le),ie^=1),new D(te,fe,ie)}return{seed:O,k2sig:ee}}const _e={lowS:e.lowS,prehash:!1},G={lowS:e.lowS,prehash:!1};function E(f,g,v=_e){const{seed:x,k2sig:_}=ue(f,g,v),S=e;return s2(S.hash.outputLen,S.nByteLength,S.hmac)(x,_)}u.BASE._setWindowSize(8);function m(f,g,v,x=G){var Z;const _=f;if(g=ds("msgHash",g),v=ds("publicKey",v),"strict"in x)throw new Error("options.strict was renamed to lowS");p2(x);const{lowS:S,prehash:b}=x;let M,I;try{if(typeof _=="string"||$a(_))try{M=D.fromDER(_)}catch(te){if(!(te instanceof po.Err))throw te;M=D.fromCompact(_)}else if(typeof _=="object"&&typeof _.r=="bigint"&&typeof _.s=="bigint"){const{r:te,s:le}=_;M=new D(te,le)}else throw new Error("PARSE");I=u.fromHex(v)}catch(te){if(te.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(S&&M.hasHighS())return!1;b&&(g=e.hash(g));const{r:F,s:ae}=M,O=J(g),se=a(ae),ee=o(O*se),X=o(F*se),Q=(Z=u.BASE.multiplyAndAddUnsafe(I,ee,X))==null?void 0:Z.toAffine();return Q?o(Q.x)===F:!1}return{CURVE:e,getPublicKey:B,getSharedSecret:j,sign:E,verify:m,ProjectivePoint:u,Signature:D,utils:k}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function BC(t){return{hash:t,hmac:(e,...r)=>t2(t,e,kP(...r)),randomBytes:$P}}function $C(t,e){const r=n=>kC({...t,...BC(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const m2=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),v2=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),FC=BigInt(1),Kg=BigInt(2),b2=(t,e)=>(t+e/Kg)/e;function jC(t){const e=m2,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),u=BigInt(88),l=t*t*t%e,d=l*l*t%e,p=Ui(d,r,e)*d%e,y=Ui(p,r,e)*d%e,A=Ui(y,Kg,e)*l%e,P=Ui(A,i,e)*A%e,N=Ui(P,s,e)*P%e,D=Ui(N,a,e)*N%e,k=Ui(D,u,e)*D%e,B=Ui(k,a,e)*N%e,q=Ui(B,r,e)*d%e,j=Ui(q,o,e)*P%e,H=Ui(j,n,e)*l%e,J=Ui(H,Kg,e);if(!Vg.eql(Vg.sqr(J),t))throw new Error("Cannot find square root");return J}const Vg=u2(m2,void 0,void 0,{sqrt:jC}),y2=$C({a:BigInt(0),b:BigInt(7),Fp:Vg,n:v2,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=v2,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-FC*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=b2(s*t,e),u=b2(-n*t,e);let l=di(t-a*r-u*i,e),d=di(-a*n-u*s,e);const p=l>o,y=d>o;if(p&&(l=e-l),y&&(d=e-d),l>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:p,k1:l,k2neg:y,k2:d}}}},Pg);BigInt(0),y2.ProjectivePoint;const UC=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:y2},Symbol.toStringTag,{value:"Module"}));function qC(t,e){const{abi:r,args:n,bytecode:i,...s}=e,o=qI({abi:r,args:n,bytecode:i});return Dg(t,{...s,data:o})}async function zC(t){var r;return((r=t.account)==null?void 0:r.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(n=>Af(n))}async function HC(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}async function WC(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>og(r))}async function KC(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function VC(t,{account:e=t.account,message:r}){if(!e)throw new qf({docsPath:"/docs/actions/wallet/signMessage"});const n=fo(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Oh(r):r.raw instanceof Uint8Array?Dh(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function GC(t,e){var l,d,p,y;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new qf({docsPath:"/docs/actions/wallet/signTransaction"});const s=fo(r);qh({account:s,...e});const o=await fi(t,Hh,"getChainId")({});n!==null&&Xw({currentChainId:o,chain:n});const a=(n==null?void 0:n.formatters)||((l=t.chain)==null?void 0:l.formatters),u=((d=a==null?void 0:a.transactionRequest)==null?void 0:d.format)||Sg;return s.signTransaction?s.signTransaction({...i,chainId:o},{serializer:(y=(p=t.chain)==null?void 0:p.serializers)==null?void 0:y.transaction}):await t.request({method:"eth_signTransaction",params:[{...u(i),chainId:Pr(o),from:s.address}]},{retryCount:0})}async function YC(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new qf({docsPath:"/docs/actions/wallet/signTypedData"});const o=fo(r),a={EIP712Domain:aC({domain:n}),...e.types};if(oC({domain:n,message:i,primaryType:s,types:a}),o.signTypedData)return o.signTypedData({domain:n,message:i,primaryType:s,types:a});const u=sC({domain:n,message:i,primaryType:s,types:a});return t.request({method:"eth_signTypedData_v4",params:[o.address,u]},{retryCount:0})}async function JC(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:Pr(e)}]},{retryCount:0})}async function XC(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}function ZC(t){return{addChain:e=>KI(t,e),deployContract:e=>qC(t,e),getAddresses:()=>zC(t),getChainId:()=>Hh(t),getPermissions:()=>HC(t),prepareTransactionRequest:e=>Ig(t,e),requestAddresses:()=>WC(t),requestPermissions:e=>KC(t,e),sendRawTransaction:e=>Zw(t,e),sendTransaction:e=>Dg(t,e),signMessage:e=>VC(t,e),signTransaction:e=>GC(t,e),signTypedData:e=>YC(t,e),switchChain:e=>JC(t,e),watchAsset:e=>XC(t,e),writeContract:e=>WI(t,e)}}function QC(t){const{key:e="wallet",name:r="Wallet Client",transport:n}=t;return VI({...t,key:e,name:r,transport:n,type:"walletClient"}).extend(ZC)}class ru{constructor(e){oo(this,"_key");oo(this,"_config",null);oo(this,"_provider",null);oo(this,"_connected",!1);oo(this,"_address",null);oo(this,"_fatured",!1);oo(this,"_installed",!1);oo(this,"lastUsed",!1);var r;if("name"in e&&"image"in e)this._key=e.name,this._config=e,this._fatured=e.featured;else if("session"in e){if(!e.session)throw new Error("session is null");this._key=(r=e.session)==null?void 0:r.peer.metadata.name,this._provider=e,this._config={name:e.session.peer.metadata.name,image:e.session.peer.metadata.icons[0],featured:!1}}else if("info"in e)console.log(e.info,"installed"),this._key=e.info.name,this._provider=e.provider,this._installed=!0,this._config={name:e.info.name,image:e.info.icon,featured:!1},this.testConnect();else throw new Error("unknown params")}get address(){return this._address}get connected(){return this._connected}get featured(){return this._fatured}get key(){return this._key}get installed(){return this._installed}get provider(){return this._provider}get client(){return this._provider?QC({transport:QI(this._provider)}):null}get config(){return this._config}static fromWalletConfig(e){return new ru(e)}EIP6963Detected(e){this._provider=e.provider,this._installed=!0,this._provider.on("disconnect",this.disconnect),this._provider.on("accountsChanged",r=>{this._address=r[0],this._connected=!0}),this.testConnect()}setUniversalProvider(e){this._provider=e,this.testConnect()}async testConnect(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());e&&e.length>0?(this._address=e[0],this._connected=!0):(this._address=null,this._connected=!1)}async connect(){var r;const e=await((r=this.client)==null?void 0:r.request({method:"eth_requestAccounts",params:void 0}));if(!e)throw new Error("connect failed");return e}async getAddress(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());if(!e)throw new Error("get address failed");return e[0]}async getChain(){var r;const e=await((r=this.client)==null?void 0:r.getChainId());if(!e)throw new Error("get chain failed");return e}async signMessage(e,r){var i;return await((i=this.client)==null?void 0:i.signMessage({message:e,account:r}))}async disconnect(){this._provider&&"session"in this._provider&&await this._provider.disconnect(),this._connected=!1,this._address=null}}var Gg={exports:{}},nu=typeof Reflect=="object"?Reflect:null,w2=nu&&typeof nu.apply=="function"?nu.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Jh;nu&&typeof nu.ownKeys=="function"?Jh=nu.ownKeys:Object.getOwnPropertySymbols?Jh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Jh=function(e){return Object.getOwnPropertyNames(e)};function eT(t){console&&console.warn&&console.warn(t)}var x2=Number.isNaN||function(e){return e!==e};function Rr(){Rr.init.call(this)}Gg.exports=Rr,Gg.exports.once=iT,Rr.EventEmitter=Rr,Rr.prototype._events=void 0,Rr.prototype._eventsCount=0,Rr.prototype._maxListeners=void 0;var _2=10;function Xh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Rr,"defaultMaxListeners",{enumerable:!0,get:function(){return _2},set:function(t){if(typeof t!="number"||t<0||x2(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");_2=t}}),Rr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Rr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||x2(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function E2(t){return t._maxListeners===void 0?Rr.defaultMaxListeners:t._maxListeners}Rr.prototype.getMaxListeners=function(){return E2(this)},Rr.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")w2(u,this,r);else for(var l=u.length,d=I2(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,eT(a)}return t}Rr.prototype.addListener=function(e,r){return S2(this,e,r,!1)},Rr.prototype.on=Rr.prototype.addListener,Rr.prototype.prependListener=function(e,r){return S2(this,e,r,!0)};function tT(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function A2(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=tT.bind(n);return i.listener=r,n.wrapFn=i,i}Rr.prototype.once=function(e,r){return Xh(r),this.on(e,A2(this,e,r)),this},Rr.prototype.prependOnceListener=function(e,r){return Xh(r),this.prependListener(e,A2(this,e,r)),this},Rr.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Xh(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():rT(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Rr.prototype.off=Rr.prototype.removeListener,Rr.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function P2(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?nT(i):I2(i,i.length)}Rr.prototype.listeners=function(e){return P2(this,e,!0)},Rr.prototype.rawListeners=function(e){return P2(this,e,!1)},Rr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):M2.call(t,e)},Rr.prototype.listenerCount=M2;function M2(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Rr.prototype.eventNames=function(){return this._eventsCount>0?Jh(this._events):[]};function I2(t,e){for(var r=new Array(e),n=0;n(i==null?void 0:i.code)===Jc.code):t;return n instanceof yt?new Jc({cause:t,message:n.details}):Jc.nodeMessage.test(r)?new Jc({cause:t,message:t.details}):jh.nodeMessage.test(r)?new jh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):gg.nodeMessage.test(r)?new gg({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):mg.nodeMessage.test(r)?new mg({cause:t,nonce:e==null?void 0:e.nonce}):vg.nodeMessage.test(r)?new vg({cause:t,nonce:e==null?void 0:e.nonce}):bg.nodeMessage.test(r)?new bg({cause:t,nonce:e==null?void 0:e.nonce}):yg.nodeMessage.test(r)?new yg({cause:t}):wg.nodeMessage.test(r)?new wg({cause:t,gas:e==null?void 0:e.gas}):xg.nodeMessage.test(r)?new xg({cause:t,gas:e==null?void 0:e.gas}):_g.nodeMessage.test(r)?new _g({cause:t}):Uh.nodeMessage.test(r)?new Uh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new Eg({cause:t})}function uI(t,{docsPath:e,...r}){const n=(()=>{const i=$w(t,r);return i instanceof Eg?t:i})();return new cI(n,{docsPath:e,...r})}function Fw(t,{format:e}){if(!e)return{};const r={};function n(s){const o=Object.keys(s);for(const a of o)a in t&&(r[a]=t[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}const i=e(t||{});return n(i),r}const fI={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Sg(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=lI(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(r=>li(r)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=Pr(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=Pr(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=Pr(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=Pr(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=Pr(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=Pr(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=fI[t.type]),typeof t.value<"u"&&(e.value=Pr(t.value)),e}function lI(t){return t.map(e=>({address:e.contractAddress,r:e.r,s:e.s,chainId:Pr(e.chainId),nonce:Pr(e.nonce),...typeof e.yParity<"u"?{yParity:Pr(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:Pr(e.v)}:{}}))}function jw(t){if(!(!t||t.length===0))return t.reduce((e,{slot:r,value:n})=>{if(r.length!==66)throw new rw({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new rw({size:n.length,targetSize:66,type:"hex"});return e[r]=n,e},{})}function hI(t){const{balance:e,nonce:r,state:n,stateDiff:i,code:s}=t,o={};if(s!==void 0&&(o.code=s),e!==void 0&&(o.balance=Pr(e)),r!==void 0&&(o.nonce=Pr(r)),n!==void 0&&(o.state=jw(n)),i!==void 0){if(o.state)throw new UM;o.stateDiff=jw(i)}return o}function dI(t){if(!t)return;const e={};for(const{address:r,...n}of t){if(!uo(r,{strict:!1}))throw new zc({address:r});if(e[r])throw new jM({address:r});e[r]=hI(n)}return e}const pI=2n**256n-1n;function qh(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?fo(e):void 0;if(o&&!uo(o.address))throw new zc({address:o.address});if(s&&!uo(s))throw new zc({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new qM;if(n&&n>pI)throw new jh({maxFeePerGas:n});if(i&&n&&i>n)throw new Uh({maxFeePerGas:n,maxPriorityFeePerGas:i})}class gI extends yt{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Ag extends yt{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class mI extends yt{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${hs(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class vI extends yt{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}const bI={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function yI(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?Fc(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?Fc(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?bI[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=wI(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function wI(t){return t.map(e=>({contractAddress:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function xI(t){const e=(t.transactions??[]).map(r=>typeof r=="string"?r:yI(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function zh(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){var d,p,y;const s=n??"latest",o=i??!1,a=r!==void 0?Pr(r):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,o]},{dedupe:!0}):u=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]},{dedupe:!!a}),!u)throw new vI({blockHash:e,blockNumber:r});return(((y=(p=(d=t.chain)==null?void 0:d.formatters)==null?void 0:p.block)==null?void 0:y.format)||xI)(u)}async function Uw(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function _I(t,e){var s,o;const{block:r,chain:n=t.chain,request:i}=e||{};try{const a=((s=n==null?void 0:n.fees)==null?void 0:s.maxPriorityFeePerGas)??((o=n==null?void 0:n.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=r||await fi(t,zh,"getBlock")({}),d=await a({block:l,client:t,request:i});if(d===null)throw new Error;return d}if(typeof a<"u")return a;const u=await t.request({method:"eth_maxPriorityFeePerGas"});return wf(u)}catch{const[a,u]=await Promise.all([r?Promise.resolve(r):fi(t,zh,"getBlock")({}),fi(t,Uw,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new Ag;const l=u-a.baseFeePerGas;return l<0n?0n:l}}async function qw(t,e){var y,A;const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>{var P,O;return typeof((P=n==null?void 0:n.fees)==null?void 0:P.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):((O=n==null?void 0:n.fees)==null?void 0:O.baseFeeMultiplier)??1.2})();if(o<1)throw new gI;const u=10**(((y=o.toString().split(".")[1])==null?void 0:y.length)??0),l=P=>P*BigInt(Math.ceil(o*u))/BigInt(u),d=r||await fi(t,zh,"getBlock")({});if(typeof((A=n==null?void 0:n.fees)==null?void 0:A.estimateFeesPerGas)=="function"){const P=await n.fees.estimateFeesPerGas({block:r,client:t,multiply:l,request:i,type:s});if(P!==null)return P}if(s==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new Ag;const P=typeof(i==null?void 0:i.maxPriorityFeePerGas)=="bigint"?i.maxPriorityFeePerGas:await _I(t,{block:d,chain:n,request:i}),O=l(d.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??O+P,maxPriorityFeePerGas:P}}return{gasPrice:(i==null?void 0:i.gasPrice)??l(await fi(t,Uw,"getGasPrice")({}))}}async function EI(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,n?Pr(n):r]},{dedupe:!!n});return Fc(i)}function zw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(s=>co(s)):t.blobs,i=[];for(const s of n)i.push(Uint8Array.from(e.blobToKzgCommitment(s)));return r==="bytes"?i:i.map(s=>li(s))}function Hw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>co(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>co(o)):t.commitments,s=[];for(let o=0;oli(o))}function SI(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),u=n?4:0,l=n?0:4;t.setUint32(e+u,o,n),t.setUint32(e+l,a,n)}const AI=(t,e,r)=>t&e^~t&r,PI=(t,e,r)=>t&e^t&r^e&r;class MI extends ig{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ng(this.buffer)}update(e){Uc(this);const{view:r,buffer:n,blockLen:i}=this;e=xf(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let p=o;pd.length)throw new Error("_sha2: outputLen bigger than state");for(let p=0;p>>3,O=Os(A,17)^Os(A,19)^A>>>10;ea[p]=O+ea[p-7]+P+ea[p-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:u,G:l,H:d}=this;for(let p=0;p<64;p++){const y=Os(a,6)^Os(a,11)^Os(a,25),A=d+y+AI(a,u,l)+II[p]+ea[p]|0,O=(Os(n,2)^Os(n,13)^Os(n,22))+PI(n,i,s)|0;d=l,l=u,u=a,a=o+A|0,o=s,s=i,i=n,n=A+O|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(n,i,s,o,a,u,l,d)}roundClean(){ea.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Pg=fw(()=>new CI);function TI(t,e){return Pg(Jo(t,{strict:!1})?rg(t):t)}function RI(t){const{commitment:e,version:r=1}=t,n=t.to??(typeof e=="string"?"hex":"bytes"),i=TI(e);return i.set([r],0),n==="bytes"?i:li(i)}function DI(t){const{commitments:e,version:r}=t,n=t.to??(typeof e[0]=="string"?"hex":"bytes"),i=[];for(const s of e)i.push(RI({commitment:s,to:n,version:r}));return i}const Ww=6,Kw=32,Mg=4096,Vw=Kw*Mg,Gw=Vw*Ww-1-1*Mg*Ww;class OI extends yt{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class NI extends yt{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function LI(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),r=typeof t.data=="string"?co(t.data):t.data,n=_n(r);if(!n)throw new NI;if(n>Gw)throw new OI({maxSize:Gw,size:n});const i=[];let s=!0,o=0;for(;s;){const a=dg(new Uint8Array(Vw));let u=0;for(;ua.bytes):i.map(a=>li(a.bytes))}function kI(t){const{data:e,kzg:r,to:n}=t,i=t.blobs??LI({data:e,to:n}),s=t.commitments??zw({blobs:i,kzg:r,to:n}),o=t.proofs??Hw({blobs:i,commitments:s,kzg:r,to:n}),a=[];for(let u=0;u"u"&&p)if(u){const k=await D();y.nonce=await u.consume({address:p.address,chainId:k,client:t})}else y.nonce=await fi(t,EI,"getTransactionCount")({address:p.address,blockTag:"pending"});if((l.includes("fees")||l.includes("type"))&&typeof d>"u")try{y.type=BI(y)}catch{const k=await P();y.type=typeof(k==null?void 0:k.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(l.includes("fees"))if(y.type!=="legacy"&&y.type!=="eip2930"){if(typeof y.maxFeePerGas>"u"||typeof y.maxPriorityFeePerGas>"u"){const k=await P(),{maxFeePerGas:B,maxPriorityFeePerGas:q}=await qw(t,{block:k,chain:i,request:y});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(y.gas=await fi(t,FI,"estimateGas")({...y,account:p&&{address:p.address,type:"json-rpc"}})),qh(y),delete y.parameters,y}async function $I(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=r?Pr(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function FI(t,e){var i,s,o;const{account:r=t.account}=e,n=r?fo(r):void 0;try{let f=function(v){const{block:x,request:_,rpcStateOverride:S}=v;return t.request({method:"eth_estimateGas",params:S?[_,x??"latest",S]:x?[_,x]:[_]})};const{accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,blockNumber:p,blockTag:y,data:A,gas:P,gasPrice:O,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:q,value:j,stateOverride:H,...J}=await Ig(t,{...e,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),z=(p?Pr(p):void 0)||y,ue=dI(H),_e=await(async()=>{if(J.to)return J.to;if(u&&u.length>0)return await Bw({authorization:u[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`")})})();qh(e);const G=(o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:o.format,m=(G||Sg)({...Fw(J,{format:G}),from:n==null?void 0:n.address,accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,data:A,gas:P,gasPrice:O,maxFeePerBlobGas:D,maxFeePerGas:k,maxPriorityFeePerGas:B,nonce:q,to:_e,value:j});let g=BigInt(await f({block:z,request:m,rpcStateOverride:ue}));if(u){const v=await $I(t,{address:m.from}),x=await Promise.all(u.map(async _=>{const{contractAddress:S}=_,b=await f({block:z,request:{authorizationList:void 0,data:A,from:n==null?void 0:n.address,to:S,value:Pr(v)},rpcStateOverride:ue}).catch(()=>100000n);return 2n*BigInt(b)}));g+=x.reduce((_,S)=>_+S,0n)}return g}catch(a){throw uI(a,{...e,account:n,chain:t.chain})}}class jI extends yt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class UI extends yt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` +`),{name:"ChainNotFoundError"})}}const Cg="/docs/contract/encodeDeployData";function qI(t){const{abi:e,args:r,bytecode:n}=t;if(!r||r.length===0)return n;const i=e.find(o=>"type"in o&&o.type==="constructor");if(!i)throw new nP({docsPath:Cg});if(!("inputs"in i))throw new Xy({docsPath:Cg});if(!i.inputs||i.inputs.length===0)throw new Xy({docsPath:Cg});const s=Ew(i.inputs,r);return Bh([n,s])}async function zI(t){return new Promise(e=>setTimeout(e,t))}class qf extends yt{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` +`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class Tg extends yt{constructor({docsPath:e,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:e,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function Jw({chain:t,currentChainId:e}){if(!t)throw new UI;if(e!==t.id)throw new jI({chain:t,currentChainId:e})}function HI(t,{docsPath:e,...r}){const n=(()=>{const i=$w(t,r);return i instanceof Eg?t:i})();return new HM(n,{docsPath:e,...r})}async function Xw(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const Rg=new kh(128);async function Dg(t,e){var k,B,q,j;const{account:r=t.account,chain:n=t.chain,accessList:i,authorizationList:s,blobs:o,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,value:P,...O}=e;if(typeof r>"u")throw new qf({docsPath:"/docs/actions/wallet/sendTransaction"});const D=r?fo(r):null;try{qh(e);const H=await(async()=>{if(e.to)return e.to;if(s&&s.length>0)return await Bw({authorization:s[0]}).catch(()=>{throw new yt("`to` is required. Could not infer from `authorizationList`.")})})();if((D==null?void 0:D.type)==="json-rpc"||D===null){let J;n!==null&&(J=await fi(t,Hh,"getChainId")({}),Jw({currentChainId:J,chain:n}));const T=(q=(B=(k=t.chain)==null?void 0:k.formatters)==null?void 0:B.transactionRequest)==null?void 0:q.format,ue=(T||Sg)({...Fw(O,{format:T}),accessList:i,authorizationList:s,blobs:o,chainId:J,data:a,from:D==null?void 0:D.address,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,to:H,value:P}),_e=Rg.get(t.uid),G=_e?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:G,params:[ue]},{retryCount:0})}catch(E){if(_e===!1)throw E;const m=E;if(m.name==="InvalidInputRpcError"||m.name==="InvalidParamsRpcError"||m.name==="MethodNotFoundRpcError"||m.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[ue]},{retryCount:0}).then(f=>(Rg.set(t.uid,!0),f)).catch(f=>{const g=f;throw g.name==="MethodNotFoundRpcError"||g.name==="MethodNotSupportedRpcError"?(Rg.set(t.uid,!1),m):g});throw m}}if((D==null?void 0:D.type)==="local"){const J=await fi(t,Ig,"prepareTransactionRequest")({account:D,accessList:i,authorizationList:s,blobs:o,chain:n,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:A,nonceManager:D.nonceManager,parameters:[...Yw,"sidecars"],value:P,...O,to:H}),T=(j=n==null?void 0:n.serializers)==null?void 0:j.transaction,z=await D.signTransaction(J,{serializer:T});return await fi(t,Xw,"sendRawTransaction")({serializedTransaction:z})}throw(D==null?void 0:D.type)==="smart"?new Tg({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Tg({docsPath:"/docs/actions/wallet/sendTransaction",type:D==null?void 0:D.type})}catch(H){throw H instanceof Tg?H:HI(H,{...e,account:D,chain:e.chain||void 0})}}async function WI(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:o,functionName:a,...u}=e;if(typeof n>"u")throw new qf({docsPath:"/docs/contract/writeContract"});const l=n?fo(n):null,d=yM({abi:r,args:s,functionName:a});try{return await fi(t,Dg,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:i,account:l,...u})}catch(p){throw eI(p,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:a,sender:l==null?void 0:l.address})}}async function KI(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:Pr(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}const Og=256;let Wh=Og,Kh;function Zw(t=11){if(!Kh||Wh+t>Og*2){Kh="",Wh=0;for(let e=0;e{const B=k(D);for(const j in P)delete B[j];const q={...D,...B};return Object.assign(q,{extend:O(q)})}}return Object.assign(P,{extend:O(P)})}const Vh=new kh(8192);function GI(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(Vh.get(r))return Vh.get(r);const n=t().finally(()=>Vh.delete(r));return Vh.set(r,n),n}function YI(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const u=async({error:l})=>{const d=typeof e=="function"?e({count:a,error:l}):e;d&&await zI(d),o({count:a+1})};try{const l=await t();i(l)}catch(l){if(a{const{dedupe:i=!1,retryDelay:s=150,retryCount:o=3,uid:a}={...e,...n},u=i?Sf(Oh(`${a}.${Kc(r)}`)):void 0;return GI(()=>YI(async()=>{try{return await t(r)}catch(l){const d=l;switch(d.code){case Mf.code:throw new Mf(d);case If.code:throw new If(d);case Cf.code:throw new Cf(d,{method:r.method});case Tf.code:throw new Tf(d);case Ba.code:throw new Ba(d);case Rf.code:throw new Rf(d);case Df.code:throw new Df(d);case Of.code:throw new Of(d);case Nf.code:throw new Nf(d);case Lf.code:throw new Lf(d,{method:r.method});case Gc.code:throw new Gc(d);case kf.code:throw new kf(d);case Yc.code:throw new Yc(d);case Bf.code:throw new Bf(d);case $f.code:throw new $f(d);case Ff.code:throw new Ff(d);case jf.code:throw new jf(d);case Uf.code:throw new Uf(d);case 5e3:throw new Yc(d);default:throw l instanceof yt?l:new ZM(d)}}},{delay:({count:l,error:d})=>{var p;if(d&&d instanceof Ow){const y=(p=d==null?void 0:d.headers)==null?void 0:p.get("Retry-After");if(y!=null&&y.match(/\d/))return Number.parseInt(y)*1e3}return~~(1<XI(l)}),{enabled:i,id:u})}}function XI(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Gc.code||t.code===Ba.code:t instanceof Ow&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function ZI({key:t,name:e,request:r,retryCount:n=3,retryDelay:i=150,timeout:s,type:o},a){const u=Zw();return{config:{key:t,name:e,request:r,retryCount:n,retryDelay:i,timeout:s,type:o},request:JI(r,{retryCount:n,retryDelay:i,uid:u}),value:a}}function QI(t,e={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=e;return({retryCount:s})=>ZI({key:r,name:n,request:t.request.bind(t),retryCount:e.retryCount??s,retryDelay:i,type:"custom"})}const eC=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,tC=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;class rC extends yt{constructor({domain:e}){super(`Invalid domain "${Kc(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class nC extends yt{constructor({primaryType:e,types:r}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class iC extends yt{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function sC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(u,l)=>{const d={...l};for(const p of u){const{name:y,type:A}=p;A==="address"&&(d[y]=d[y].toLowerCase())}return d},o=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return Kc({domain:o,message:a,primaryType:n,types:i})}function oC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(o,a)=>{for(const u of o){const{name:l,type:d}=u,p=a[l],y=d.match(tC);if(y&&(typeof p=="number"||typeof p=="bigint")){const[O,D,k]=y;Pr(p,{signed:D==="int",size:Number.parseInt(k)/8})}if(d==="address"&&typeof p=="string"&&!uo(p))throw new zc({address:p});const A=d.match(eC);if(A){const[O,D]=A;if(D&&_n(p)!==Number.parseInt(D))throw new uP({expectedSize:Number.parseInt(D),givenSize:_n(p)})}const P=i[d];P&&(cC(d),s(P,p))}};if(i.EIP712Domain&&e){if(typeof e!="object")throw new rC({domain:e});s(i.EIP712Domain,e)}if(n!=="EIP712Domain")if(i[n])s(i[n],r);else throw new nC({primaryType:n,types:i})}function aC({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},typeof(t==null?void 0:t.chainId)=="number"&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function cC(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new iC({type:t})}let Qw=class extends ig{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,SP(e);const n=xf(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew Qw(t,e).update(r).digest();e2.create=(t,e)=>new Qw(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ng=BigInt(0),Gh=BigInt(1),uC=BigInt(2);function $a(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function zf(t){if(!$a(t))throw new Error("Uint8Array expected")}function Xc(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)}const fC=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Zc(t){zf(t);let e="";for(let r=0;r=ho._0&&t<=ho._9)return t-ho._0;if(t>=ho._A&&t<=ho._F)return t-(ho._A-10);if(t>=ho._a&&t<=ho._f)return t-(ho._a-10)}function eu(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;itypeof t=="bigint"&&Ng<=t;function Yh(t,e,r){return $g(t)&&$g(e)&&$g(r)&&e<=t&&tNg;t>>=Gh,e+=1);return e}function pC(t,e){return t>>BigInt(e)&Gh}function gC(t,e,r){return t|(r?Gh:Ng)<(uC<new Uint8Array(t),n2=t=>Uint8Array.from(t);function i2(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=jg(t),i=jg(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...p)=>r(i,n,...p),u=(p=jg())=>{i=a(n2([0]),p),n=a(),p.length!==0&&(i=a(n2([1]),p),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let p=0;const y=[];for(;p{o(),u(p);let A;for(;!(A=y(l()));)u();return o(),A}}const mC={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||$a(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Wf(t,e,r={}){const n=(i,s,o)=>{const a=mC[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const u=t[i];if(!(o&&u===void 0)&&!a(u,t))throw new Error(`Invalid param ${String(i)}=${u} (${typeof u}), expected ${s}`)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const vC=()=>{throw new Error("not implemented")};function Ug(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}const bC=Object.freeze(Object.defineProperty({__proto__:null,aInRange:ja,abool:Xc,abytes:zf,bitGet:pC,bitLen:r2,bitMask:Fg,bitSet:gC,bytesToHex:Zc,bytesToNumberBE:Fa,bytesToNumberLE:kg,concatBytes:Hf,createHmacDrbg:i2,ensureBytes:ds,equalBytes:hC,hexToBytes:eu,hexToNumber:Lg,inRange:Yh,isBytes:$a,memoized:Ug,notImplemented:vC,numberToBytesBE:tu,numberToBytesLE:Bg,numberToHexUnpadded:Qc,numberToVarBytesBE:lC,utf8ToBytes:dC,validateObject:Wf},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const In=BigInt(0),sn=BigInt(1),Ua=BigInt(2),yC=BigInt(3),qg=BigInt(4),s2=BigInt(5),o2=BigInt(8);BigInt(9),BigInt(16);function di(t,e){const r=t%e;return r>=In?r:e+r}function wC(t,e,r){if(r<=In||e 0");if(r===sn)return In;let n=sn;for(;e>In;)e&sn&&(n=n*t%r),t=t*t%r,e>>=sn;return n}function Ui(t,e,r){let n=t;for(;e-- >In;)n*=n,n%=r;return n}function zg(t,e){if(t===In||e<=In)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=di(t,e),n=e,i=In,s=sn;for(;r!==In;){const a=n/r,u=n%r,l=i-s*a;n=r,r=u,i=s,s=l}if(n!==sn)throw new Error("invert: does not exist");return di(i,e)}function xC(t){const e=(t-sn)/Ua;let r,n,i;for(r=t-sn,n=0;r%Ua===In;r/=Ua,n++);for(i=Ua;i(n[i]="function",n),e);return Wf(t,r)}function AC(t,e,r){if(r 0");if(r===In)return t.ONE;if(r===sn)return e;let n=t.ONE,i=e;for(;r>In;)r&sn&&(n=t.mul(n,i)),i=t.sqr(i),r>>=sn;return n}function PC(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function a2(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function c2(t,e,r=!1,n={}){if(t<=In)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=a2(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=_C(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:Fg(i),ZERO:In,ONE:sn,create:u=>di(u,t),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return In<=u&&uu===In,isOdd:u=>(u&sn)===sn,neg:u=>di(-u,t),eql:(u,l)=>u===l,sqr:u=>di(u*u,t),add:(u,l)=>di(u+l,t),sub:(u,l)=>di(u-l,t),mul:(u,l)=>di(u*l,t),pow:(u,l)=>AC(a,u,l),div:(u,l)=>di(u*zg(l,t),t),sqrN:u=>u*u,addN:(u,l)=>u+l,subN:(u,l)=>u-l,mulN:(u,l)=>u*l,inv:u=>zg(u,t),sqrt:n.sqrt||(u=>o(a,u)),invertBatch:u=>PC(a,u),cmov:(u,l,d)=>d?l:u,toBytes:u=>r?Bg(u,s):tu(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return r?kg(u):Fa(u)}});return Object.freeze(a)}function u2(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function f2(t){const e=u2(t);return e+Math.ceil(e/2)}function MC(t,e,r=!1){const n=t.length,i=u2(e),s=f2(e);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?Fa(t):kg(t),a=di(o,e-sn)+sn;return r?Bg(a,i):tu(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const IC=BigInt(0),Hg=BigInt(1),Wg=new WeakMap,l2=new WeakMap;function CC(t,e){const r=(s,o)=>{const a=o.negate();return s?a:o},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>e)throw new Error(`Wrong window size=${s}, should be [1..${e}]`)},i=s=>{n(s);const o=Math.ceil(e/s)+1,a=2**(s-1);return{windows:o,windowSize:a}};return{constTimeNegate:r,unsafeLadder(s,o){let a=t.ZERO,u=s;for(;o>IC;)o&Hg&&(a=a.add(u)),u=u.double(),o>>=Hg;return a},precomputeWindow(s,o){const{windows:a,windowSize:u}=i(o),l=[];let d=s,p=d;for(let y=0;y>=P,k>l&&(k-=A,a+=Hg);const B=D,q=D+Math.abs(k)-1,j=O%2!==0,H=k<0;k===0?p=p.add(r(j,o[B])):d=d.add(r(H,o[q]))}return{p:d,f:p}},wNAFCached(s,o,a){const u=l2.get(s)||1;let l=Wg.get(s);return l||(l=this.precomputeWindow(s,u),u!==1&&Wg.set(s,a(l))),this.wNAF(u,l,o)},setWindowSize(s,o){n(o),l2.set(s,o),Wg.delete(s)}}}function TC(t,e,r,n){if(!Array.isArray(r)||!Array.isArray(n)||n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((d,p)=>{if(!e.isValid(d))throw new Error(`wrong scalar at index ${p}`)}),r.forEach((d,p)=>{if(!(d instanceof t))throw new Error(`wrong point at index ${p}`)});const i=r2(BigInt(r.length)),s=i>12?i-3:i>4?i-2:i?2:1,o=(1<=0;d-=s){a.fill(t.ZERO);for(let y=0;y>BigInt(d)&BigInt(o));a[P]=a[P].add(r[y])}let p=t.ZERO;for(let y=a.length-1,A=t.ZERO;y>0;y--)A=A.add(a[y]),p=p.add(A);if(l=l.add(p),d!==0)for(let y=0;y{const{Err:r}=po;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=Qc(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?Qc(i.length/2|128):"";return`${Qc(t)}${s}${i}${e}`},decode(t,e){const{Err:r}=po;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");const l=e.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const d of l)o=o<<8|d;if(n+=u,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=po;if(t{const B=D.toAffine();return Hf(Uint8Array.from([4]),r.toBytes(B.x),r.toBytes(B.y))}),s=e.fromBytes||(O=>{const D=O.subarray(1),k=r.fromBytes(D.subarray(0,r.BYTES)),B=r.fromBytes(D.subarray(r.BYTES,2*r.BYTES));return{x:k,y:B}});function o(O){const{a:D,b:k}=e,B=r.sqr(O),q=r.mul(B,O);return r.add(r.add(q,r.mul(O,D)),k)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(O){return Yh(O,Cn,e.n)}function u(O){const{allowedPrivateKeyLengths:D,nByteLength:k,wrapPrivateKey:B,n:q}=e;if(D&&typeof O!="bigint"){if($a(O)&&(O=Zc(O)),typeof O!="string"||!D.includes(O.length))throw new Error("Invalid key");O=O.padStart(k*2,"0")}let j;try{j=typeof O=="bigint"?O:Fa(ds("private key",O,k))}catch{throw new Error(`private key must be ${k} bytes, hex or bigint, not ${typeof O}`)}return B&&(j=di(j,q)),ja("private key",j,Cn,q),j}function l(O){if(!(O instanceof y))throw new Error("ProjectivePoint expected")}const d=Ug((O,D)=>{const{px:k,py:B,pz:q}=O;if(r.eql(q,r.ONE))return{x:k,y:B};const j=O.is0();D==null&&(D=j?r.ONE:r.inv(q));const H=r.mul(k,D),J=r.mul(B,D),T=r.mul(q,D);if(j)return{x:r.ZERO,y:r.ZERO};if(!r.eql(T,r.ONE))throw new Error("invZ was invalid");return{x:H,y:J}}),p=Ug(O=>{if(O.is0()){if(e.allowInfinityPoint&&!r.is0(O.py))return;throw new Error("bad point: ZERO")}const{x:D,y:k}=O.toAffine();if(!r.isValid(D)||!r.isValid(k))throw new Error("bad point: x or y not FE");const B=r.sqr(k),q=o(D);if(!r.eql(B,q))throw new Error("bad point: equation left != right");if(!O.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(D,k,B){if(this.px=D,this.py=k,this.pz=B,D==null||!r.isValid(D))throw new Error("x required");if(k==null||!r.isValid(k))throw new Error("y required");if(B==null||!r.isValid(B))throw new Error("z required");Object.freeze(this)}static fromAffine(D){const{x:k,y:B}=D||{};if(!D||!r.isValid(k)||!r.isValid(B))throw new Error("invalid affine point");if(D instanceof y)throw new Error("projective point not allowed");const q=j=>r.eql(j,r.ZERO);return q(k)&&q(B)?y.ZERO:new y(k,B,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(D){const k=r.invertBatch(D.map(B=>B.pz));return D.map((B,q)=>B.toAffine(k[q])).map(y.fromAffine)}static fromHex(D){const k=y.fromAffine(s(ds("pointHex",D)));return k.assertValidity(),k}static fromPrivateKey(D){return y.BASE.multiply(u(D))}static msm(D,k){return TC(y,n,D,k)}_setWindowSize(D){P.setWindowSize(this,D)}assertValidity(){p(this)}hasEvenY(){const{y:D}=this.toAffine();if(r.isOdd)return!r.isOdd(D);throw new Error("Field doesn't support isOdd")}equals(D){l(D);const{px:k,py:B,pz:q}=this,{px:j,py:H,pz:J}=D,T=r.eql(r.mul(k,J),r.mul(j,q)),z=r.eql(r.mul(B,J),r.mul(H,q));return T&&z}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){const{a:D,b:k}=e,B=r.mul(k,p2),{px:q,py:j,pz:H}=this;let J=r.ZERO,T=r.ZERO,z=r.ZERO,ue=r.mul(q,q),_e=r.mul(j,j),G=r.mul(H,H),E=r.mul(q,j);return E=r.add(E,E),z=r.mul(q,H),z=r.add(z,z),J=r.mul(D,z),T=r.mul(B,G),T=r.add(J,T),J=r.sub(_e,T),T=r.add(_e,T),T=r.mul(J,T),J=r.mul(E,J),z=r.mul(B,z),G=r.mul(D,G),E=r.sub(ue,G),E=r.mul(D,E),E=r.add(E,z),z=r.add(ue,ue),ue=r.add(z,ue),ue=r.add(ue,G),ue=r.mul(ue,E),T=r.add(T,ue),G=r.mul(j,H),G=r.add(G,G),ue=r.mul(G,E),J=r.sub(J,ue),z=r.mul(G,_e),z=r.add(z,z),z=r.add(z,z),new y(J,T,z)}add(D){l(D);const{px:k,py:B,pz:q}=this,{px:j,py:H,pz:J}=D;let T=r.ZERO,z=r.ZERO,ue=r.ZERO;const _e=e.a,G=r.mul(e.b,p2);let E=r.mul(k,j),m=r.mul(B,H),f=r.mul(q,J),g=r.add(k,B),v=r.add(j,H);g=r.mul(g,v),v=r.add(E,m),g=r.sub(g,v),v=r.add(k,q);let x=r.add(j,J);return v=r.mul(v,x),x=r.add(E,f),v=r.sub(v,x),x=r.add(B,q),T=r.add(H,J),x=r.mul(x,T),T=r.add(m,f),x=r.sub(x,T),ue=r.mul(_e,v),T=r.mul(G,f),ue=r.add(T,ue),T=r.sub(m,ue),ue=r.add(m,ue),z=r.mul(T,ue),m=r.add(E,E),m=r.add(m,E),f=r.mul(_e,f),v=r.mul(G,v),m=r.add(m,f),f=r.sub(E,f),f=r.mul(_e,f),v=r.add(v,f),E=r.mul(m,v),z=r.add(z,E),E=r.mul(x,v),T=r.mul(g,T),T=r.sub(T,E),E=r.mul(g,m),ue=r.mul(x,ue),ue=r.add(ue,E),new y(T,z,ue)}subtract(D){return this.add(D.negate())}is0(){return this.equals(y.ZERO)}wNAF(D){return P.wNAFCached(this,D,y.normalizeZ)}multiplyUnsafe(D){ja("scalar",D,go,e.n);const k=y.ZERO;if(D===go)return k;if(D===Cn)return this;const{endo:B}=e;if(!B)return P.unsafeLadder(this,D);let{k1neg:q,k1:j,k2neg:H,k2:J}=B.splitScalar(D),T=k,z=k,ue=this;for(;j>go||J>go;)j&Cn&&(T=T.add(ue)),J&Cn&&(z=z.add(ue)),ue=ue.double(),j>>=Cn,J>>=Cn;return q&&(T=T.negate()),H&&(z=z.negate()),z=new y(r.mul(z.px,B.beta),z.py,z.pz),T.add(z)}multiply(D){const{endo:k,n:B}=e;ja("scalar",D,Cn,B);let q,j;if(k){const{k1neg:H,k1:J,k2neg:T,k2:z}=k.splitScalar(D);let{p:ue,f:_e}=this.wNAF(J),{p:G,f:E}=this.wNAF(z);ue=P.constTimeNegate(H,ue),G=P.constTimeNegate(T,G),G=new y(r.mul(G.px,k.beta),G.py,G.pz),q=ue.add(G),j=_e.add(E)}else{const{p:H,f:J}=this.wNAF(D);q=H,j=J}return y.normalizeZ([q,j])[0]}multiplyAndAddUnsafe(D,k,B){const q=y.BASE,j=(J,T)=>T===go||T===Cn||!J.equals(q)?J.multiplyUnsafe(T):J.multiply(T),H=j(this,k).add(j(D,B));return H.is0()?void 0:H}toAffine(D){return d(this,D)}isTorsionFree(){const{h:D,isTorsionFree:k}=e;if(D===Cn)return!0;if(k)return k(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:D,clearCofactor:k}=e;return D===Cn?this:k?k(y,this):this.multiplyUnsafe(e.h)}toRawBytes(D=!0){return Xc("isCompressed",D),this.assertValidity(),i(y,this,D)}toHex(D=!0){return Xc("isCompressed",D),Zc(this.toRawBytes(D))}}y.BASE=new y(e.Gx,e.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);const A=e.nBitLength,P=CC(y,e.endo?Math.ceil(A/2):A);return{CURVE:e,ProjectivePoint:y,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:a}}function LC(t){const e=h2(t);return Wf(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function kC(t){const e=LC(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(f){return di(f,n)}function a(f){return zg(f,n)}const{ProjectivePoint:u,normPrivateKeyToScalar:l,weierstrassEquation:d,isWithinCurveOrder:p}=NC({...e,toBytes(f,g,v){const x=g.toAffine(),_=r.toBytes(x.x),S=Hf;return Xc("isCompressed",v),v?S(Uint8Array.from([g.hasEvenY()?2:3]),_):S(Uint8Array.from([4]),_,r.toBytes(x.y))},fromBytes(f){const g=f.length,v=f[0],x=f.subarray(1);if(g===i&&(v===2||v===3)){const _=Fa(x);if(!Yh(_,Cn,r.ORDER))throw new Error("Point is not on curve");const S=d(_);let b;try{b=r.sqrt(S)}catch(F){const ce=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+ce)}const M=(b&Cn)===Cn;return(v&1)===1!==M&&(b=r.neg(b)),{x:_,y:b}}else if(g===s&&v===4){const _=r.fromBytes(x.subarray(0,r.BYTES)),S=r.fromBytes(x.subarray(r.BYTES,2*r.BYTES));return{x:_,y:S}}else throw new Error(`Point of length ${g} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`)}}),y=f=>Zc(tu(f,e.nByteLength));function A(f){const g=n>>Cn;return f>g}function P(f){return A(f)?o(-f):f}const O=(f,g,v)=>Fa(f.slice(g,v));class D{constructor(g,v,x){this.r=g,this.s=v,this.recovery=x,this.assertValidity()}static fromCompact(g){const v=e.nByteLength;return g=ds("compactSignature",g,v*2),new D(O(g,0,v),O(g,v,2*v))}static fromDER(g){const{r:v,s:x}=po.toSig(ds("DER",g));return new D(v,x)}assertValidity(){ja("r",this.r,Cn,n),ja("s",this.s,Cn,n)}addRecoveryBit(g){return new D(this.r,this.s,g)}recoverPublicKey(g){const{r:v,s:x,recovery:_}=this,S=J(ds("msgHash",g));if(_==null||![0,1,2,3].includes(_))throw new Error("recovery id invalid");const b=_===2||_===3?v+e.n:v;if(b>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const M=_&1?"03":"02",I=u.fromHex(M+y(b)),F=a(b),ce=o(-S*F),N=o(x*F),se=u.BASE.multiplyAndAddUnsafe(I,ce,N);if(!se)throw new Error("point at infinify");return se.assertValidity(),se}hasHighS(){return A(this.s)}normalizeS(){return this.hasHighS()?new D(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return eu(this.toDERHex())}toDERHex(){return po.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return eu(this.toCompactHex())}toCompactHex(){return y(this.r)+y(this.s)}}const k={isValidPrivateKey(f){try{return l(f),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const f=f2(e.n);return MC(e.randomBytes(f),e.n)},precompute(f=8,g=u.BASE){return g._setWindowSize(f),g.multiply(BigInt(3)),g}};function B(f,g=!0){return u.fromPrivateKey(f).toRawBytes(g)}function q(f){const g=$a(f),v=typeof f=="string",x=(g||v)&&f.length;return g?x===i||x===s:v?x===2*i||x===2*s:f instanceof u}function j(f,g,v=!0){if(q(f))throw new Error("first arg must be private key");if(!q(g))throw new Error("second arg must be public key");return u.fromHex(g).multiply(l(f)).toRawBytes(v)}const H=e.bits2int||function(f){const g=Fa(f),v=f.length*8-e.nBitLength;return v>0?g>>BigInt(v):g},J=e.bits2int_modN||function(f){return o(H(f))},T=Fg(e.nBitLength);function z(f){return ja(`num < 2^${e.nBitLength}`,f,go,T),tu(f,e.nByteLength)}function ue(f,g,v=_e){if(["recovered","canonical"].some(X=>X in v))throw new Error("sign() legacy options not supported");const{hash:x,randomBytes:_}=e;let{lowS:S,prehash:b,extraEntropy:M}=v;S==null&&(S=!0),f=ds("msgHash",f),d2(v),b&&(f=ds("prehashed msgHash",x(f)));const I=J(f),F=l(g),ce=[z(F),z(I)];if(M!=null&&M!==!1){const X=M===!0?_(r.BYTES):M;ce.push(ds("extraEntropy",X))}const N=Hf(...ce),se=I;function ee(X){const Q=H(X);if(!p(Q))return;const R=a(Q),Z=u.BASE.multiply(Q).toAffine(),te=o(Z.x);if(te===go)return;const le=o(R*o(se+te*F));if(le===go)return;let ie=(Z.x===te?0:2)|Number(Z.y&Cn),fe=le;return S&&A(le)&&(fe=P(le),ie^=1),new D(te,fe,ie)}return{seed:N,k2sig:ee}}const _e={lowS:e.lowS,prehash:!1},G={lowS:e.lowS,prehash:!1};function E(f,g,v=_e){const{seed:x,k2sig:_}=ue(f,g,v),S=e;return i2(S.hash.outputLen,S.nByteLength,S.hmac)(x,_)}u.BASE._setWindowSize(8);function m(f,g,v,x=G){var Z;const _=f;if(g=ds("msgHash",g),v=ds("publicKey",v),"strict"in x)throw new Error("options.strict was renamed to lowS");d2(x);const{lowS:S,prehash:b}=x;let M,I;try{if(typeof _=="string"||$a(_))try{M=D.fromDER(_)}catch(te){if(!(te instanceof po.Err))throw te;M=D.fromCompact(_)}else if(typeof _=="object"&&typeof _.r=="bigint"&&typeof _.s=="bigint"){const{r:te,s:le}=_;M=new D(te,le)}else throw new Error("PARSE");I=u.fromHex(v)}catch(te){if(te.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(S&&M.hasHighS())return!1;b&&(g=e.hash(g));const{r:F,s:ce}=M,N=J(g),se=a(ce),ee=o(N*se),X=o(F*se),Q=(Z=u.BASE.multiplyAndAddUnsafe(I,ee,X))==null?void 0:Z.toAffine();return Q?o(Q.x)===F:!1}return{CURVE:e,getPublicKey:B,getSharedSecret:j,sign:E,verify:m,ProjectivePoint:u,Signature:D,utils:k}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function BC(t){return{hash:t,hmac:(e,...r)=>e2(t,e,kP(...r)),randomBytes:$P}}function $C(t,e){const r=n=>kC({...t,...BC(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const g2=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),m2=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),FC=BigInt(1),Kg=BigInt(2),v2=(t,e)=>(t+e/Kg)/e;function jC(t){const e=g2,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),u=BigInt(88),l=t*t*t%e,d=l*l*t%e,p=Ui(d,r,e)*d%e,y=Ui(p,r,e)*d%e,A=Ui(y,Kg,e)*l%e,P=Ui(A,i,e)*A%e,O=Ui(P,s,e)*P%e,D=Ui(O,a,e)*O%e,k=Ui(D,u,e)*D%e,B=Ui(k,a,e)*O%e,q=Ui(B,r,e)*d%e,j=Ui(q,o,e)*P%e,H=Ui(j,n,e)*l%e,J=Ui(H,Kg,e);if(!Vg.eql(Vg.sqr(J),t))throw new Error("Cannot find square root");return J}const Vg=c2(g2,void 0,void 0,{sqrt:jC}),b2=$C({a:BigInt(0),b:BigInt(7),Fp:Vg,n:m2,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=m2,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-FC*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=v2(s*t,e),u=v2(-n*t,e);let l=di(t-a*r-u*i,e),d=di(-a*n-u*s,e);const p=l>o,y=d>o;if(p&&(l=e-l),y&&(d=e-d),l>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:p,k1:l,k2neg:y,k2:d}}}},Pg);BigInt(0),b2.ProjectivePoint;const UC=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:b2},Symbol.toStringTag,{value:"Module"}));function qC(t,e){const{abi:r,args:n,bytecode:i,...s}=e,o=qI({abi:r,args:n,bytecode:i});return Dg(t,{...s,data:o})}async function zC(t){var r;return((r=t.account)==null?void 0:r.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(n=>Af(n))}async function HC(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}async function WC(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>og(r))}async function KC(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function VC(t,{account:e=t.account,message:r}){if(!e)throw new qf({docsPath:"/docs/actions/wallet/signMessage"});const n=fo(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Oh(r):r.raw instanceof Uint8Array?Dh(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function GC(t,e){var l,d,p,y;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new qf({docsPath:"/docs/actions/wallet/signTransaction"});const s=fo(r);qh({account:s,...e});const o=await fi(t,Hh,"getChainId")({});n!==null&&Jw({currentChainId:o,chain:n});const a=(n==null?void 0:n.formatters)||((l=t.chain)==null?void 0:l.formatters),u=((d=a==null?void 0:a.transactionRequest)==null?void 0:d.format)||Sg;return s.signTransaction?s.signTransaction({...i,chainId:o},{serializer:(y=(p=t.chain)==null?void 0:p.serializers)==null?void 0:y.transaction}):await t.request({method:"eth_signTransaction",params:[{...u(i),chainId:Pr(o),from:s.address}]},{retryCount:0})}async function YC(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new qf({docsPath:"/docs/actions/wallet/signTypedData"});const o=fo(r),a={EIP712Domain:aC({domain:n}),...e.types};if(oC({domain:n,message:i,primaryType:s,types:a}),o.signTypedData)return o.signTypedData({domain:n,message:i,primaryType:s,types:a});const u=sC({domain:n,message:i,primaryType:s,types:a});return t.request({method:"eth_signTypedData_v4",params:[o.address,u]},{retryCount:0})}async function JC(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:Pr(e)}]},{retryCount:0})}async function XC(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}function ZC(t){return{addChain:e=>KI(t,e),deployContract:e=>qC(t,e),getAddresses:()=>zC(t),getChainId:()=>Hh(t),getPermissions:()=>HC(t),prepareTransactionRequest:e=>Ig(t,e),requestAddresses:()=>WC(t),requestPermissions:e=>KC(t,e),sendRawTransaction:e=>Xw(t,e),sendTransaction:e=>Dg(t,e),signMessage:e=>VC(t,e),signTransaction:e=>GC(t,e),signTypedData:e=>YC(t,e),switchChain:e=>JC(t,e),watchAsset:e=>XC(t,e),writeContract:e=>WI(t,e)}}function QC(t){const{key:e="wallet",name:r="Wallet Client",transport:n}=t;return VI({...t,key:e,name:r,transport:n,type:"walletClient"}).extend(ZC)}class ru{constructor(e){oo(this,"_key");oo(this,"_config",null);oo(this,"_provider",null);oo(this,"_connected",!1);oo(this,"_address",null);oo(this,"_fatured",!1);oo(this,"_installed",!1);oo(this,"lastUsed",!1);var r;if("name"in e&&"image"in e)this._key=e.name,this._config=e,this._fatured=e.featured;else if("session"in e){if(!e.session)throw new Error("session is null");this._key=(r=e.session)==null?void 0:r.peer.metadata.name,this._provider=e,this._config={name:e.session.peer.metadata.name,image:e.session.peer.metadata.icons[0],featured:!1}}else if("info"in e)this._key=e.info.name,this._provider=e.provider,this._installed=!0,this._config={name:e.info.name,image:e.info.icon,featured:!1},this.testConnect();else throw new Error("unknown params")}get address(){return this._address}get connected(){return this._connected}get featured(){return this._fatured}get key(){return this._key}get installed(){return this._installed}get provider(){return this._provider}get client(){return this._provider?QC({transport:QI(this._provider)}):null}get config(){return this._config}static fromWalletConfig(e){return new ru(e)}EIP6963Detected(e){this._provider=e.provider,this._installed=!0,this._provider.on("disconnect",this.disconnect),this._provider.on("accountsChanged",r=>{this._address=r[0],this._connected=!0}),this.testConnect()}setUniversalProvider(e){this._provider=e,this.testConnect()}async testConnect(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());e&&e.length>0?(this._address=e[0],this._connected=!0):(this._address=null,this._connected=!1)}async connect(){var r;const e=await((r=this.client)==null?void 0:r.request({method:"eth_requestAccounts",params:void 0}));if(!e)throw new Error("connect failed");return e}async getAddress(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());if(!e)throw new Error("get address failed");return e[0]}async getChain(){var r;const e=await((r=this.client)==null?void 0:r.getChainId());if(!e)throw new Error("get chain failed");return e}async signMessage(e,r){var i;return await((i=this.client)==null?void 0:i.signMessage({message:e,account:r}))}async disconnect(){this._provider&&"session"in this._provider&&await this._provider.disconnect(),this._connected=!1,this._address=null}}var Gg={exports:{}},nu=typeof Reflect=="object"?Reflect:null,y2=nu&&typeof nu.apply=="function"?nu.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Jh;nu&&typeof nu.ownKeys=="function"?Jh=nu.ownKeys:Object.getOwnPropertySymbols?Jh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Jh=function(e){return Object.getOwnPropertyNames(e)};function eT(t){console&&console.warn&&console.warn(t)}var w2=Number.isNaN||function(e){return e!==e};function Rr(){Rr.init.call(this)}Gg.exports=Rr,Gg.exports.once=iT,Rr.EventEmitter=Rr,Rr.prototype._events=void 0,Rr.prototype._eventsCount=0,Rr.prototype._maxListeners=void 0;var x2=10;function Xh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Rr,"defaultMaxListeners",{enumerable:!0,get:function(){return x2},set:function(t){if(typeof t!="number"||t<0||w2(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");x2=t}}),Rr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Rr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||w2(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function _2(t){return t._maxListeners===void 0?Rr.defaultMaxListeners:t._maxListeners}Rr.prototype.getMaxListeners=function(){return _2(this)},Rr.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")y2(u,this,r);else for(var l=u.length,d=M2(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,eT(a)}return t}Rr.prototype.addListener=function(e,r){return E2(this,e,r,!1)},Rr.prototype.on=Rr.prototype.addListener,Rr.prototype.prependListener=function(e,r){return E2(this,e,r,!0)};function tT(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function S2(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=tT.bind(n);return i.listener=r,n.wrapFn=i,i}Rr.prototype.once=function(e,r){return Xh(r),this.on(e,S2(this,e,r)),this},Rr.prototype.prependOnceListener=function(e,r){return Xh(r),this.prependListener(e,S2(this,e,r)),this},Rr.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Xh(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():rT(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Rr.prototype.off=Rr.prototype.removeListener,Rr.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function A2(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?nT(i):M2(i,i.length)}Rr.prototype.listeners=function(e){return A2(this,e,!0)},Rr.prototype.rawListeners=function(e){return A2(this,e,!1)},Rr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):P2.call(t,e)},Rr.prototype.listenerCount=P2;function P2(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Rr.prototype.eventNames=function(){return this._eventsCount>0?Jh(this._events):[]};function M2(t,e){for(var r=new Array(e),n=0;n=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function uT(t,e){return function(r,n){e(r,n,t)}}function fT(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function lT(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(d){try{l(n.next(d))}catch(p){o(p)}}function u(d){try{l(n.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):i(d.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function hT(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return u([l,d])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function T2(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function gT(){for(var t=[],e=0;e1||a(y,A)})})}function a(y,A){try{u(n[y](A))}catch(P){p(s[0][3],P)}}function u(y){y.value instanceof Kf?Promise.resolve(y.value.v).then(l,d):p(s[0][2],y)}function l(y){a("next",y)}function d(y){a("throw",y)}function p(y,A){y(A),s.shift(),s.length&&a(s[0][0],s[0][1])}}function bT(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Kf(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function yT(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Zg=="function"?Zg(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function wT(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function xT(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function _T(t){return t&&t.__esModule?t:{default:t}}function ET(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function ST(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const Vf=Jp(Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Xg},__asyncDelegator:bT,__asyncGenerator:vT,__asyncValues:yT,__await:Kf,__awaiter:lT,__classPrivateFieldGet:ET,__classPrivateFieldSet:ST,__createBinding:dT,__decorate:cT,__exportStar:pT,__extends:oT,__generator:hT,__importDefault:_T,__importStar:xT,__makeTemplateObject:wT,__metadata:fT,__param:uT,__read:T2,__rest:aT,__spread:gT,__spreadArrays:mT,__values:Zg},Symbol.toStringTag,{value:"Module"})));var Qg={},Gf={},R2;function AT(){if(R2)return Gf;R2=1,Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Gf.delay=t,Gf}var qa={},em={},za={},D2;function PT(){return D2||(D2=1,Object.defineProperty(za,"__esModule",{value:!0}),za.ONE_THOUSAND=za.ONE_HUNDRED=void 0,za.ONE_HUNDRED=100,za.ONE_THOUSAND=1e3),za}var tm={},O2;function MT(){return O2||(O2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(tm)),tm}var N2;function L2(){return N2||(N2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(PT(),t),e.__exportStar(MT(),t)}(em)),em}var k2;function IT(){if(k2)return qa;k2=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.fromMiliseconds=qa.toMiliseconds=void 0;const t=L2();function e(n){return n*t.ONE_THOUSAND}qa.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return qa.fromMiliseconds=r,qa}var B2;function CT(){return B2||(B2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(AT(),t),e.__exportStar(IT(),t)}(Qg)),Qg}var iu={},$2;function TT(){if($2)return iu;$2=1,Object.defineProperty(iu,"__esModule",{value:!0}),iu.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return iu.Watch=t,iu.default=t,iu}var rm={},Yf={},F2;function RT(){if(F2)return Yf;F2=1,Object.defineProperty(Yf,"__esModule",{value:!0}),Yf.IWatch=void 0;class t{}return Yf.IWatch=t,Yf}var j2;function DT(){return j2||(j2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Vf.__exportStar(RT(),t)}(rm)),rm}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(CT(),t),e.__exportStar(TT(),t),e.__exportStar(DT(),t),e.__exportStar(L2(),t)})(mt);class Ha{}let OT=class extends Ha{constructor(e){super()}};const U2=mt.FIVE_SECONDS,su={pulse:"heartbeat_pulse"};let NT=class GA extends OT{constructor(e){super(e),this.events=new qi.EventEmitter,this.interval=U2,this.interval=(e==null?void 0:e.interval)||U2}static async init(e){const r=new GA(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),mt.toMiliseconds(this.interval))}pulse(){this.events.emit(su.pulse)}};const LT=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,kT=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,BT=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function $T(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){FT(t);return}return e}function FT(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Zh(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!BT.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(LT.test(t)||kT.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,$T)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function jT(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Tn(t,...e){try{return jT(t(...e))}catch(r){return Promise.reject(r)}}function UT(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function qT(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Qh(t){if(UT(t))return String(t);if(qT(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Qh(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function q2(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const nm="base64:";function zT(t){if(typeof t=="string")return t;q2();const e=Buffer.from(t).toString("base64");return nm+e}function HT(t){return typeof t!="string"||!t.startsWith(nm)?t:(q2(),Buffer.from(t.slice(nm.length),"base64"))}function pi(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function WT(...t){return pi(t.join(":"))}function ed(t){return t=pi(t),t?t+":":""}function doe(t){return t}const KT="memory",VT=()=>{const t=new Map;return{name:KT,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function GT(t={}){const e={mounts:{"":t.driver||VT()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const d of e.mountpoints)if(l.startsWith(d))return{base:d,relativeKey:l.slice(d.length),driver:e.mounts[d]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,d)=>e.mountpoints.filter(p=>p.startsWith(l)||d&&l.startsWith(p)).map(p=>({relativeBase:l.length>p.length?l.slice(p.length):void 0,mountpoint:p,driver:e.mounts[p]})),i=(l,d)=>{if(e.watching){d=pi(d);for(const p of e.watchListeners)p(l,d)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await z2(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,d,p)=>{const y=new Map,A=P=>{let N=y.get(P.base);return N||(N={driver:P.driver,base:P.base,items:[]},y.set(P.base,N)),N};for(const P of l){const N=typeof P=="string",D=pi(N?P:P.key),k=N?void 0:P.value,B=N||!P.options?d:{...d,...P.options},q=r(D);A(q).items.push({key:D,value:k,relativeKey:q.relativeKey,options:B})}return Promise.all([...y.values()].map(P=>p(P))).then(P=>P.flat())},u={hasItem(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return Tn(y.hasItem,p,d)},getItem(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return Tn(y.getItem,p,d).then(A=>Zh(A))},getItems(l,d){return a(l,d,p=>p.driver.getItems?Tn(p.driver.getItems,p.items.map(y=>({key:y.relativeKey,options:y.options})),d).then(y=>y.map(A=>({key:WT(p.base,A.key),value:Zh(A.value)}))):Promise.all(p.items.map(y=>Tn(p.driver.getItem,y.relativeKey,y.options).then(A=>({key:y.key,value:Zh(A)})))))},getItemRaw(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return y.getItemRaw?Tn(y.getItemRaw,p,d):Tn(y.getItem,p,d).then(A=>HT(A))},async setItem(l,d,p={}){if(d===void 0)return u.removeItem(l);l=pi(l);const{relativeKey:y,driver:A}=r(l);A.setItem&&(await Tn(A.setItem,y,Qh(d),p),A.watch||i("update",l))},async setItems(l,d){await a(l,d,async p=>{if(p.driver.setItems)return Tn(p.driver.setItems,p.items.map(y=>({key:y.relativeKey,value:Qh(y.value),options:y.options})),d);p.driver.setItem&&await Promise.all(p.items.map(y=>Tn(p.driver.setItem,y.relativeKey,Qh(y.value),y.options)))})},async setItemRaw(l,d,p={}){if(d===void 0)return u.removeItem(l,p);l=pi(l);const{relativeKey:y,driver:A}=r(l);if(A.setItemRaw)await Tn(A.setItemRaw,y,d,p);else if(A.setItem)await Tn(A.setItem,y,zT(d),p);else return;A.watch||i("update",l)},async removeItem(l,d={}){typeof d=="boolean"&&(d={removeMeta:d}),l=pi(l);const{relativeKey:p,driver:y}=r(l);y.removeItem&&(await Tn(y.removeItem,p,d),(d.removeMeta||d.removeMata)&&await Tn(y.removeItem,p+"$",d),y.watch||i("remove",l))},async getMeta(l,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),l=pi(l);const{relativeKey:p,driver:y}=r(l),A=Object.create(null);if(y.getMeta&&Object.assign(A,await Tn(y.getMeta,p,d)),!d.nativeOnly){const P=await Tn(y.getItem,p+"$",d).then(N=>Zh(N));P&&typeof P=="object"&&(typeof P.atime=="string"&&(P.atime=new Date(P.atime)),typeof P.mtime=="string"&&(P.mtime=new Date(P.mtime)),Object.assign(A,P))}return A},setMeta(l,d,p={}){return this.setItem(l+"$",d,p)},removeMeta(l,d={}){return this.removeItem(l+"$",d)},async getKeys(l,d={}){l=ed(l);const p=n(l,!0);let y=[];const A=[];for(const P of p){const N=await Tn(P.driver.getKeys,P.relativeBase,d);for(const D of N){const k=P.mountpoint+pi(D);y.some(B=>k.startsWith(B))||A.push(k)}y=[P.mountpoint,...y.filter(D=>!D.startsWith(P.mountpoint))]}return l?A.filter(P=>P.startsWith(l)&&P[P.length-1]!=="$"):A.filter(P=>P[P.length-1]!=="$")},async clear(l,d={}){l=ed(l),await Promise.all(n(l,!1).map(async p=>{if(p.driver.clear)return Tn(p.driver.clear,p.relativeBase,d);if(p.driver.removeItem){const y=await p.driver.getKeys(p.relativeBase||"",d);return Promise.all(y.map(A=>p.driver.removeItem(A,d)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>H2(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(d=>d!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,d){if(l=ed(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((p,y)=>y.length-p.length)),e.mounts[l]=d,e.watching&&Promise.resolve(z2(d,i,l)).then(p=>{e.unwatch[l]=p}).catch(console.error),u},async unmount(l,d=!0){l=ed(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),d&&await H2(e.mounts[l]),e.mountpoints=e.mountpoints.filter(p=>p!==l),delete e.mounts[l])},getMount(l=""){l=pi(l)+":";const d=r(l);return{driver:d.driver,base:d.base}},getMounts(l="",d={}){return l=pi(l),n(l,d.parents).map(y=>({driver:y.driver,base:y.mountpoint}))},keys:(l,d={})=>u.getKeys(l,d),get:(l,d={})=>u.getItem(l,d),set:(l,d,p={})=>u.setItem(l,d,p),has:(l,d={})=>u.hasItem(l,d),del:(l,d={})=>u.removeItem(l,d),remove:(l,d={})=>u.removeItem(l,d)};return u}function z2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function H2(t){typeof t.dispose=="function"&&await Tn(t.dispose)}function Wa(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function W2(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Wa(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let im;function Jf(){return im||(im=W2("keyval-store","keyval")),im}function K2(t,e=Jf()){return e("readonly",r=>Wa(r.get(t)))}function YT(t,e,r=Jf()){return r("readwrite",n=>(n.put(e,t),Wa(n.transaction)))}function JT(t,e=Jf()){return e("readwrite",r=>(r.delete(t),Wa(r.transaction)))}function XT(t=Jf()){return t("readwrite",e=>(e.clear(),Wa(e.transaction)))}function ZT(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Wa(t.transaction)}function QT(t=Jf()){return t("readonly",e=>{if(e.getAllKeys)return Wa(e.getAllKeys());const r=[];return ZT(e,n=>r.push(n.key)).then(()=>r)})}const eR=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),tR=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Ka(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return tR(t)}catch{return t}}function mo(t){return typeof t=="string"?t:eR(t)||""}const rR="idb-keyval";var nR=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=W2(t.dbName,t.storeName)),{name:rR,options:t,async hasItem(i){return!(typeof await K2(r(i),n)>"u")},async getItem(i){return await K2(r(i),n)??null},setItem(i,s){return YT(r(i),s,n)},removeItem(i){return JT(r(i),n)},getKeys(){return QT(n)},clear(){return XT(n)}}};const iR="WALLET_CONNECT_V2_INDEXED_DB",sR="keyvaluestorage";let oR=class{constructor(){this.indexedDb=GT({driver:nR({dbName:iR,storeName:sR})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,mo(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var sm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},td={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof sm<"u"&&sm.localStorage?td.exports=sm.localStorage:typeof window<"u"&&window.localStorage?td.exports=window.localStorage:td.exports=new e})();function aR(t){var e;return[t[0],Ka((e=t[1])!=null?e:"")]}let cR=class{constructor(){this.localStorage=td.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(aR)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Ka(r)}async setItem(e,r){this.localStorage.setItem(e,mo(r))}async removeItem(e){this.localStorage.removeItem(e)}};const uR="wc_storage_version",V2=1,fR=async(t,e,r)=>{const n=uR,i=await e.getItem(n);if(i&&i>=V2){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,V2),r(e),lR(t,o)},lR=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let hR=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new cR;this.storage=e;try{const r=new oR;fR(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function dR(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var pR=gR;function gR(t,e,r){var n=r&&r.stringify||dR,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?p:0,t.charCodeAt(A+1)){case 100:case 102:if(d>=u||e[d]==null)break;p=u||e[d]==null)break;p=u||e[d]===void 0)break;p",p=A+2,A++;break}l+=n(e[d]),p=A+2,A++;break;case 115:if(d>=u)break;p-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",u=Object.create(r);u.log||(u.log=Zf),Object.defineProperty(u,"levelVal",{get:d}),Object.defineProperty(u,"level",{get:p,set:y});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:_R(t)};u.levels=vo.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Zf,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=A,e&&(u._logEvent=om());function d(){return this.level==="silent"?1/0:this.levels.values[this.level]}function p(){return this._level}function y(P){if(P!=="silent"&&!this.levels.values[P])throw Error("unknown level "+P);this._level=P,au(l,u,"error","log"),au(l,u,"fatal","error"),au(l,u,"warn","error"),au(l,u,"info","log"),au(l,u,"debug","log"),au(l,u,"trace","log")}function A(P,N){if(!P)throw new Error("missing bindings for child Pino");N=N||{},i&&P.serializers&&(N.serializers=P.serializers);const D=N.serializers;if(i&&D){var k=Object.assign({},n,D),B=t.browser.serialize===!0?Object.keys(k):i;delete P.serializers,rd([P],B,k,this._stdErrSerialize)}function q(j){this._childLevel=(j._childLevel|0)+1,this.error=cu(j,P,"error"),this.fatal=cu(j,P,"fatal"),this.warn=cu(j,P,"warn"),this.info=cu(j,P,"info"),this.debug=cu(j,P,"debug"),this.trace=cu(j,P,"trace"),k&&(this.serializers=k,this._serialize=B),e&&(this._logEvent=om([].concat(j._logEvent.bindings,P)))}return q.prototype=this,new q(this)}return u}vo.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},vo.stdSerializers=mR,vo.stdTimeFunctions=Object.assign({},{nullTime:Y2,epochTime:J2,unixTime:ER,isoTime:SR});function au(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Zf:i[r]?i[r]:Xf[r]||Xf[n]||Zf,bR(t,e,r)}function bR(t,e,r){!t.transmit&&e[r]===Zf||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Xf?Xf:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function cu(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},Z2=class{constructor(e,r=cm){this.level=e??"error",this.levelValue=ou.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new X2(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===ou.levels.values.error?console.error(e):r===ou.levels.values.warn?console.warn(e):r===ou.levels.values.debug?console.debug(e):r===ou.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(mo({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new X2(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(mo({extraMetadata:e})),new Blob(r,{type:"application/json"})}},IR=class{constructor(e,r=cm){this.baseChunkLogger=new Z2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},CR=class{constructor(e,r=cm){this.baseChunkLogger=new Z2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var TR=Object.defineProperty,RR=Object.defineProperties,DR=Object.getOwnPropertyDescriptors,Q2=Object.getOwnPropertySymbols,OR=Object.prototype.hasOwnProperty,NR=Object.prototype.propertyIsEnumerable,ex=(t,e,r)=>e in t?TR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,id=(t,e)=>{for(var r in e||(e={}))OR.call(e,r)&&ex(t,r,e[r]);if(Q2)for(var r of Q2(e))NR.call(e,r)&&ex(t,r,e[r]);return t},sd=(t,e)=>RR(t,DR(e));function od(t){return sd(id({},t),{level:(t==null?void 0:t.level)||PR.level})}function LR(t,e=el){return t[e]||""}function kR(t,e,r=el){return t[r]=e,t}function gi(t,e=el){let r="";return typeof t.bindings>"u"?r=LR(t,e):r=t.bindings().context||"",r}function BR(t,e,r=el){const n=gi(t,r);return n.trim()?`${n}/${e}`:e}function ri(t,e,r=el){const n=BR(t,e,r),i=t.child({context:n});return kR(i,n,r)}function $R(t){var e,r;const n=new IR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace",browser:sd(id({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function FR(t){var e;const r=new CR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function jR(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?$R(t):FR(t)}let UR=class extends Ha{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},qR=class extends Ha{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},zR=class{constructor(e,r){this.logger=e,this.core=r}},HR=class extends Ha{constructor(e,r){super(),this.relayer=e,this.logger=r}},WR=class extends Ha{constructor(e){super()}},KR=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},VR=class extends Ha{constructor(e,r){super(),this.relayer=e,this.logger=r}},GR=class extends Ha{constructor(e,r){super(),this.core=e,this.logger=r}},YR=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},JR=class{constructor(e,r){this.projectId=e,this.logger=r}},XR=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},ZR=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},QR=class{constructor(e){this.client=e}};var um={},ta={},ad={},cd={};Object.defineProperty(cd,"__esModule",{value:!0}),cd.BrowserRandomSource=void 0;const tx=65536;class eD{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let n=0;n>>16&65535,d=a&65535,p=u>>>16&65535,y=u&65535;return d*y+(l*y+d*p<<16>>>0)|0}t.mul=Math.imul||e;function r(a,u){return a+u|0}t.add=r;function n(a,u){return a-u|0}t.sub=n;function i(a,u){return a<>>32-u}t.rotl=i;function s(a,u){return a<<32-u|a>>>u}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(nx),Object.defineProperty(or,"__esModule",{value:!0});var ix=nx;function aD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}or.readInt16BE=aD;function cD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}or.readUint16BE=cD;function uD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}or.readInt16LE=uD;function fD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}or.readUint16LE=fD;function sx(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}or.writeUint16BE=sx,or.writeInt16BE=sx;function ox(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}or.writeUint16LE=ox,or.writeInt16LE=ox;function fm(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}or.readInt32BE=fm;function lm(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}or.readUint32BE=lm;function hm(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}or.readInt32LE=hm;function dm(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}or.readUint32LE=dm;function fd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}or.writeUint32BE=fd,or.writeInt32BE=fd;function ld(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}or.writeUint32LE=ld,or.writeInt32LE=ld;function lD(t,e){e===void 0&&(e=0);var r=fm(t,e),n=fm(t,e+4);return r*4294967296+n-(n>>31)*4294967296}or.readInt64BE=lD;function hD(t,e){e===void 0&&(e=0);var r=lm(t,e),n=lm(t,e+4);return r*4294967296+n}or.readUint64BE=hD;function dD(t,e){e===void 0&&(e=0);var r=hm(t,e),n=hm(t,e+4);return n*4294967296+r-(r>>31)*4294967296}or.readInt64LE=dD;function pD(t,e){e===void 0&&(e=0);var r=dm(t,e),n=dm(t,e+4);return n*4294967296+r}or.readUint64LE=pD;function ax(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fd(t/4294967296>>>0,e,r),fd(t>>>0,e,r+4),e}or.writeUint64BE=ax,or.writeInt64BE=ax;function cx(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ld(t>>>0,e,r),ld(t/4294967296>>>0,e,r+4),e}or.writeUint64LE=cx,or.writeInt64LE=cx;function gD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}or.readUintBE=gD;function mD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}or.writeUintBE=vD;function bD(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!ix.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s256)throw new Error("randomString charset is too long");let y="";const A=d.length,P=256-256%A;for(;l>0;){const N=i(Math.ceil(l*256/P),p);for(let D=0;D0;D++){const k=N[D];k0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,A=l%128<112?128:256;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._stateHi.set(u.stateHi),this._stateLo.set(u.stateLo),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.stateHi),r.wipe(u.stateLo),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,u,l,d,p,y,A){for(var P=l[0],N=l[1],D=l[2],k=l[3],B=l[4],q=l[5],j=l[6],H=l[7],J=d[0],T=d[1],z=d[2],ue=d[3],_e=d[4],G=d[5],E=d[6],m=d[7],f,g,v,x,_,S,b,M;A>=128;){for(var I=0;I<16;I++){var F=8*I+y;a[I]=e.readUint32BE(p,F),u[I]=e.readUint32BE(p,F+4)}for(var I=0;I<80;I++){var ae=P,O=N,se=D,ee=k,X=B,Q=q,R=j,Z=H,te=J,le=T,ie=z,fe=ue,ve=_e,Me=G,Ne=E,Te=m;if(f=H,g=m,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=(B>>>14|_e<<18)^(B>>>18|_e<<14)^(_e>>>9|B<<23),g=(_e>>>14|B<<18)^(_e>>>18|B<<14)^(B>>>9|_e<<23),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=B&q^~B&j,g=_e&G^~_e&E,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=i[I*2],g=i[I*2+1],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=a[I%16],g=u[I%16],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,v=b&65535|M<<16,x=_&65535|S<<16,f=v,g=x,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=(P>>>28|J<<4)^(J>>>2|P<<30)^(J>>>7|P<<25),g=(J>>>28|P<<4)^(P>>>2|J<<30)^(P>>>7|J<<25),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=P&N^P&D^N&D,g=J&T^J&z^T&z,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,Z=b&65535|M<<16,Te=_&65535|S<<16,f=ee,g=fe,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=v,g=x,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,ee=b&65535|M<<16,fe=_&65535|S<<16,N=ae,D=O,k=se,B=ee,q=X,j=Q,H=R,P=Z,T=te,z=le,ue=ie,_e=fe,G=ve,E=Me,m=Ne,J=Te,I%16===15)for(var F=0;F<16;F++)f=a[F],g=u[F],_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=a[(F+9)%16],g=u[(F+9)%16],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,v=a[(F+1)%16],x=u[(F+1)%16],f=(v>>>1|x<<31)^(v>>>8|x<<24)^v>>>7,g=(x>>>1|v<<31)^(x>>>8|v<<24)^(x>>>7|v<<25),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,v=a[(F+14)%16],x=u[(F+14)%16],f=(v>>>19|x<<13)^(x>>>29|v<<3)^v>>>6,g=(x>>>19|v<<13)^(v>>>29|x<<3)^(x>>>6|v<<26),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,a[F]=b&65535|M<<16,u[F]=_&65535|S<<16}f=P,g=J,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[0],g=d[0],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[0]=P=b&65535|M<<16,d[0]=J=_&65535|S<<16,f=N,g=T,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[1],g=d[1],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[1]=N=b&65535|M<<16,d[1]=T=_&65535|S<<16,f=D,g=z,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[2],g=d[2],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[2]=D=b&65535|M<<16,d[2]=z=_&65535|S<<16,f=k,g=ue,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[3],g=d[3],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[3]=k=b&65535|M<<16,d[3]=ue=_&65535|S<<16,f=B,g=_e,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[4],g=d[4],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[4]=B=b&65535|M<<16,d[4]=_e=_&65535|S<<16,f=q,g=G,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[5],g=d[5],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[5]=q=b&65535|M<<16,d[5]=G=_&65535|S<<16,f=j,g=E,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[6],g=d[6],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[6]=j=b&65535|M<<16,d[6]=E=_&65535|S<<16,f=H,g=m,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[7],g=d[7],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[7]=H=b&65535|M<<16,d[7]=m=_&65535|S<<16,y+=128,A-=128}return y}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ux),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=ta,r=ux,n=Mi;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(ee){const X=new Float64Array(16);if(ee)for(let Q=0;Q>16&1),Q[le-1]&=65535;Q[15]=R[15]-32767-(Q[14]>>16&1);const te=Q[15]>>16&1;Q[14]&=65535,N(R,Q,1-te)}for(let Z=0;Z<16;Z++)ee[2*Z]=R[Z]&255,ee[2*Z+1]=R[Z]>>8}function k(ee,X){let Q=0;for(let R=0;R<32;R++)Q|=ee[R]^X[R];return(1&Q-1>>>8)-1}function B(ee,X){const Q=new Uint8Array(32),R=new Uint8Array(32);return D(Q,ee),D(R,X),k(Q,R)}function q(ee){const X=new Uint8Array(32);return D(X,ee),X[0]&1}function j(ee,X){for(let Q=0;Q<16;Q++)ee[Q]=X[2*Q]+(X[2*Q+1]<<8);ee[15]&=32767}function H(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]+Q[R]}function J(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]-Q[R]}function T(ee,X,Q){let R,Z,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=0,Ie=0,Le=0,Ve=0,ke=0,ze=0,He=0,Se=0,Qe=0,ct=0,Be=0,et=0,rt=0,Je=0,pt=0,ht=0,ft=0,Ht=0,Jt=0,St=0,er=0,Xt=0,Ot=0,Bt=Q[0],Tt=Q[1],vt=Q[2],Dt=Q[3],Lt=Q[4],bt=Q[5],$t=Q[6],jt=Q[7],nt=Q[8],Ft=Q[9],$=Q[10],W=Q[11],V=Q[12],C=Q[13],Y=Q[14],U=Q[15];R=X[0],te+=R*Bt,le+=R*Tt,ie+=R*vt,fe+=R*Dt,ve+=R*Lt,Me+=R*bt,Ne+=R*$t,Te+=R*jt,$e+=R*nt,Ie+=R*Ft,Le+=R*$,Ve+=R*W,ke+=R*V,ze+=R*C,He+=R*Y,Se+=R*U,R=X[1],le+=R*Bt,ie+=R*Tt,fe+=R*vt,ve+=R*Dt,Me+=R*Lt,Ne+=R*bt,Te+=R*$t,$e+=R*jt,Ie+=R*nt,Le+=R*Ft,Ve+=R*$,ke+=R*W,ze+=R*V,He+=R*C,Se+=R*Y,Qe+=R*U,R=X[2],ie+=R*Bt,fe+=R*Tt,ve+=R*vt,Me+=R*Dt,Ne+=R*Lt,Te+=R*bt,$e+=R*$t,Ie+=R*jt,Le+=R*nt,Ve+=R*Ft,ke+=R*$,ze+=R*W,He+=R*V,Se+=R*C,Qe+=R*Y,ct+=R*U,R=X[3],fe+=R*Bt,ve+=R*Tt,Me+=R*vt,Ne+=R*Dt,Te+=R*Lt,$e+=R*bt,Ie+=R*$t,Le+=R*jt,Ve+=R*nt,ke+=R*Ft,ze+=R*$,He+=R*W,Se+=R*V,Qe+=R*C,ct+=R*Y,Be+=R*U,R=X[4],ve+=R*Bt,Me+=R*Tt,Ne+=R*vt,Te+=R*Dt,$e+=R*Lt,Ie+=R*bt,Le+=R*$t,Ve+=R*jt,ke+=R*nt,ze+=R*Ft,He+=R*$,Se+=R*W,Qe+=R*V,ct+=R*C,Be+=R*Y,et+=R*U,R=X[5],Me+=R*Bt,Ne+=R*Tt,Te+=R*vt,$e+=R*Dt,Ie+=R*Lt,Le+=R*bt,Ve+=R*$t,ke+=R*jt,ze+=R*nt,He+=R*Ft,Se+=R*$,Qe+=R*W,ct+=R*V,Be+=R*C,et+=R*Y,rt+=R*U,R=X[6],Ne+=R*Bt,Te+=R*Tt,$e+=R*vt,Ie+=R*Dt,Le+=R*Lt,Ve+=R*bt,ke+=R*$t,ze+=R*jt,He+=R*nt,Se+=R*Ft,Qe+=R*$,ct+=R*W,Be+=R*V,et+=R*C,rt+=R*Y,Je+=R*U,R=X[7],Te+=R*Bt,$e+=R*Tt,Ie+=R*vt,Le+=R*Dt,Ve+=R*Lt,ke+=R*bt,ze+=R*$t,He+=R*jt,Se+=R*nt,Qe+=R*Ft,ct+=R*$,Be+=R*W,et+=R*V,rt+=R*C,Je+=R*Y,pt+=R*U,R=X[8],$e+=R*Bt,Ie+=R*Tt,Le+=R*vt,Ve+=R*Dt,ke+=R*Lt,ze+=R*bt,He+=R*$t,Se+=R*jt,Qe+=R*nt,ct+=R*Ft,Be+=R*$,et+=R*W,rt+=R*V,Je+=R*C,pt+=R*Y,ht+=R*U,R=X[9],Ie+=R*Bt,Le+=R*Tt,Ve+=R*vt,ke+=R*Dt,ze+=R*Lt,He+=R*bt,Se+=R*$t,Qe+=R*jt,ct+=R*nt,Be+=R*Ft,et+=R*$,rt+=R*W,Je+=R*V,pt+=R*C,ht+=R*Y,ft+=R*U,R=X[10],Le+=R*Bt,Ve+=R*Tt,ke+=R*vt,ze+=R*Dt,He+=R*Lt,Se+=R*bt,Qe+=R*$t,ct+=R*jt,Be+=R*nt,et+=R*Ft,rt+=R*$,Je+=R*W,pt+=R*V,ht+=R*C,ft+=R*Y,Ht+=R*U,R=X[11],Ve+=R*Bt,ke+=R*Tt,ze+=R*vt,He+=R*Dt,Se+=R*Lt,Qe+=R*bt,ct+=R*$t,Be+=R*jt,et+=R*nt,rt+=R*Ft,Je+=R*$,pt+=R*W,ht+=R*V,ft+=R*C,Ht+=R*Y,Jt+=R*U,R=X[12],ke+=R*Bt,ze+=R*Tt,He+=R*vt,Se+=R*Dt,Qe+=R*Lt,ct+=R*bt,Be+=R*$t,et+=R*jt,rt+=R*nt,Je+=R*Ft,pt+=R*$,ht+=R*W,ft+=R*V,Ht+=R*C,Jt+=R*Y,St+=R*U,R=X[13],ze+=R*Bt,He+=R*Tt,Se+=R*vt,Qe+=R*Dt,ct+=R*Lt,Be+=R*bt,et+=R*$t,rt+=R*jt,Je+=R*nt,pt+=R*Ft,ht+=R*$,ft+=R*W,Ht+=R*V,Jt+=R*C,St+=R*Y,er+=R*U,R=X[14],He+=R*Bt,Se+=R*Tt,Qe+=R*vt,ct+=R*Dt,Be+=R*Lt,et+=R*bt,rt+=R*$t,Je+=R*jt,pt+=R*nt,ht+=R*Ft,ft+=R*$,Ht+=R*W,Jt+=R*V,St+=R*C,er+=R*Y,Xt+=R*U,R=X[15],Se+=R*Bt,Qe+=R*Tt,ct+=R*vt,Be+=R*Dt,et+=R*Lt,rt+=R*bt,Je+=R*$t,pt+=R*jt,ht+=R*nt,ft+=R*Ft,Ht+=R*$,Jt+=R*W,St+=R*V,er+=R*C,Xt+=R*Y,Ot+=R*U,te+=38*Qe,le+=38*ct,ie+=38*Be,fe+=38*et,ve+=38*rt,Me+=38*Je,Ne+=38*pt,Te+=38*ht,$e+=38*ft,Ie+=38*Ht,Le+=38*Jt,Ve+=38*St,ke+=38*er,ze+=38*Xt,He+=38*Ot,Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Se+Z+65535,Z=Math.floor(R/65536),Se=R-Z*65536,te+=Z-1+37*(Z-1),Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Se+Z+65535,Z=Math.floor(R/65536),Se=R-Z*65536,te+=Z-1+37*(Z-1),ee[0]=te,ee[1]=le,ee[2]=ie,ee[3]=fe,ee[4]=ve,ee[5]=Me,ee[6]=Ne,ee[7]=Te,ee[8]=$e,ee[9]=Ie,ee[10]=Le,ee[11]=Ve,ee[12]=ke,ee[13]=ze,ee[14]=He,ee[15]=Se}function z(ee,X){T(ee,X,X)}function ue(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=253;R>=0;R--)z(Q,Q),R!==2&&R!==4&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function _e(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=250;R>=0;R--)z(Q,Q),R!==1&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function G(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i(),ve=i(),Me=i();J(Q,ee[1],ee[0]),J(Me,X[1],X[0]),T(Q,Q,Me),H(R,ee[0],ee[1]),H(Me,X[0],X[1]),T(R,R,Me),T(Z,ee[3],X[3]),T(Z,Z,l),T(te,ee[2],X[2]),H(te,te,te),J(le,R,Q),J(ie,te,Z),H(fe,te,Z),H(ve,R,Q),T(ee[0],le,ie),T(ee[1],ve,fe),T(ee[2],fe,ie),T(ee[3],le,ve)}function E(ee,X,Q){for(let R=0;R<4;R++)N(ee[R],X[R],Q)}function m(ee,X){const Q=i(),R=i(),Z=i();ue(Z,X[2]),T(Q,X[0],Z),T(R,X[1],Z),D(ee,R),ee[31]^=q(Q)<<7}function f(ee,X,Q){A(ee[0],o),A(ee[1],a),A(ee[2],a),A(ee[3],o);for(let R=255;R>=0;--R){const Z=Q[R/8|0]>>(R&7)&1;E(ee,X,Z),G(X,ee),G(ee,ee),E(ee,X,Z)}}function g(ee,X){const Q=[i(),i(),i(),i()];A(Q[0],d),A(Q[1],p),A(Q[2],a),T(Q[3],d,p),f(ee,Q,X)}function v(ee){if(ee.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const X=(0,r.hash)(ee);X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(32),R=[i(),i(),i(),i()];g(R,X),m(Q,R);const Z=new Uint8Array(64);return Z.set(ee),Z.set(Q,32),{publicKey:Q,secretKey:Z}}t.generateKeyPairFromSeed=v;function x(ee){const X=(0,e.randomBytes)(32,ee),Q=v(X);return(0,n.wipe)(X),Q}t.generateKeyPair=x;function _(ee){if(ee.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(ee.subarray(32))}t.extractPublicKeyFromSecretKey=_;const S=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function b(ee,X){let Q,R,Z,te;for(R=63;R>=32;--R){for(Q=0,Z=R-32,te=R-12;Z>4)*S[Z],Q=X[Z]>>8,X[Z]&=255;for(Z=0;Z<32;Z++)X[Z]-=Q*S[Z];for(R=0;R<32;R++)X[R+1]+=X[R]>>8,ee[R]=X[R]&255}function M(ee){const X=new Float64Array(64);for(let Q=0;Q<64;Q++)X[Q]=ee[Q];for(let Q=0;Q<64;Q++)ee[Q]=0;b(ee,X)}function I(ee,X){const Q=new Float64Array(64),R=[i(),i(),i(),i()],Z=(0,r.hash)(ee.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(64);te.set(Z.subarray(32),32);const le=new r.SHA512;le.update(te.subarray(32)),le.update(X);const ie=le.digest();le.clean(),M(ie),g(R,ie),m(te,R),le.reset(),le.update(te.subarray(0,32)),le.update(ee.subarray(32)),le.update(X);const fe=le.digest();M(fe);for(let ve=0;ve<32;ve++)Q[ve]=ie[ve];for(let ve=0;ve<32;ve++)for(let Me=0;Me<32;Me++)Q[ve+Me]+=fe[ve]*Z[Me];return b(te.subarray(32),Q),te}t.sign=I;function F(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i();return A(ee[2],a),j(ee[1],X),z(Z,ee[1]),T(te,Z,u),J(Z,Z,ee[2]),H(te,ee[2],te),z(le,te),z(ie,le),T(fe,ie,le),T(Q,fe,Z),T(Q,Q,te),_e(Q,Q),T(Q,Q,Z),T(Q,Q,te),T(Q,Q,te),T(ee[0],Q,te),z(R,ee[0]),T(R,R,te),B(R,Z)&&T(ee[0],ee[0],y),z(R,ee[0]),T(R,R,te),B(R,Z)?-1:(q(ee[0])===X[31]>>7&&J(ee[0],o,ee[0]),T(ee[3],ee[0],ee[1]),0)}function ae(ee,X,Q){const R=new Uint8Array(32),Z=[i(),i(),i(),i()],te=[i(),i(),i(),i()];if(Q.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(F(te,ee))return!1;const le=new r.SHA512;le.update(Q.subarray(0,32)),le.update(ee),le.update(X);const ie=le.digest();return M(ie),f(Z,te,ie),g(te,Q.subarray(32)),G(Z,te),m(R,Z),!k(Q,R)}t.verify=ae;function O(ee){let X=[i(),i(),i(),i()];if(F(X,ee))throw new Error("Ed25519: invalid public key");let Q=i(),R=i(),Z=X[1];H(Q,a,Z),J(R,a,Z),ue(R,R),T(Q,Q,R);let te=new Uint8Array(32);return D(te,Q),te}t.convertPublicKeyToX25519=O;function se(ee){const X=(0,r.hash)(ee.subarray(0,32));X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(X.subarray(0,32));return(0,n.wipe)(X),Q}t.convertSecretKeyToX25519=se}(um);const MD="EdDSA",ID="JWT",hd=".",dd="base64url",fx="utf8",lx="utf8",CD=":",TD="did",RD="key",hx="base58btc",DD="z",OD="K36",ND=32;function dx(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function pd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=dx(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function LD(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,j=new Uint8Array(q);k!==B;){for(var H=P[k],J=0,T=q-1;(H!==0||J>>0,j[T]=H%a>>>0,H=H/a>>>0;if(H!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=q-D;z!==q&&j[z]===0;)z++;for(var ue=u.repeat(N);z>>0,q=new Uint8Array(B);P[N];){var j=r[P.charCodeAt(N)];if(j===255)return;for(var H=0,J=B-1;(j!==0||H>>0,q[J]=j%256>>>0,j=j/256>>>0;if(j!==0)throw new Error("Non-zero carry");k=H,N++}if(P[N]!==" "){for(var T=B-k;T!==B&&q[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=q[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:A}}var kD=LD,BD=kD;const $D=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},FD=t=>new TextEncoder().encode(t),jD=t=>new TextDecoder().decode(t);class UD{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class qD{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return px(this,e)}}class zD{constructor(e){this.decoders=e}or(e){return px(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const px=(t,e)=>new zD({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class HD{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new UD(e,r,n),this.decoder=new qD(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const gd=({name:t,prefix:e,encode:r,decode:n})=>new HD(t,e,r,n),rl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=BD(r,e);return gd({prefix:t,name:e,encode:n,decode:s=>$D(i(s))})},WD=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},KD=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<gd({prefix:e,name:t,encode(i){return KD(i,n,r)},decode(i){return WD(i,n,r,t)}}),VD=gd({prefix:"\0",name:"identity",encode:t=>jD(t),decode:t=>FD(t)}),GD=Object.freeze(Object.defineProperty({__proto__:null,identity:VD},Symbol.toStringTag,{value:"Module"})),YD=jn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),JD=Object.freeze(Object.defineProperty({__proto__:null,base2:YD},Symbol.toStringTag,{value:"Module"})),XD=jn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),ZD=Object.freeze(Object.defineProperty({__proto__:null,base8:XD},Symbol.toStringTag,{value:"Module"})),QD=rl({prefix:"9",name:"base10",alphabet:"0123456789"}),eO=Object.freeze(Object.defineProperty({__proto__:null,base10:QD},Symbol.toStringTag,{value:"Module"})),tO=jn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),rO=jn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),nO=Object.freeze(Object.defineProperty({__proto__:null,base16:tO,base16upper:rO},Symbol.toStringTag,{value:"Module"})),iO=jn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),sO=jn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),oO=jn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),aO=jn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),cO=jn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),uO=jn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),fO=jn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),lO=jn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),hO=jn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),dO=Object.freeze(Object.defineProperty({__proto__:null,base32:iO,base32hex:cO,base32hexpad:fO,base32hexpadupper:lO,base32hexupper:uO,base32pad:oO,base32padupper:aO,base32upper:sO,base32z:hO},Symbol.toStringTag,{value:"Module"})),pO=rl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),gO=rl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),mO=Object.freeze(Object.defineProperty({__proto__:null,base36:pO,base36upper:gO},Symbol.toStringTag,{value:"Module"})),vO=rl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),bO=rl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),yO=Object.freeze(Object.defineProperty({__proto__:null,base58btc:vO,base58flickr:bO},Symbol.toStringTag,{value:"Module"})),wO=jn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),xO=jn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),_O=jn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),EO=jn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),SO=Object.freeze(Object.defineProperty({__proto__:null,base64:wO,base64pad:xO,base64url:_O,base64urlpad:EO},Symbol.toStringTag,{value:"Module"})),gx=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),AO=gx.reduce((t,e,r)=>(t[r]=e,t),[]),PO=gx.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function MO(t){return t.reduce((e,r)=>(e+=AO[r],e),"")}function IO(t){const e=[];for(const r of t){const n=PO[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const CO=gd({prefix:"🚀",name:"base256emoji",encode:MO,decode:IO}),TO=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:CO},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const mx={...GD,...JD,...ZD,...eO,...nO,...dO,...mO,...yO,...SO,...TO};function vx(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const bx=vx("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),pm=vx("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=dx(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new jO:typeof navigator<"u"?KO(navigator.userAgent):GO()}function WO(t){return t!==""&&zO.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function KO(t){var e=WO(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new FO;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length-1){const D=P.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let k=e.protocol+"//"+e.host;if(D.indexOf("/")===0)k+=D;else{const B=e.pathname.split("/");B.pop();const q=B.join("/");k+=q+"/"+D}y.push(k)}else if(D.indexOf("//")===0){const k=e.protocol+D;y.push(k)}else y.push(D)}}return y}function n(...p){const y=t.getElementsByTagName("meta");for(let A=0;AP.getAttribute(D)).filter(D=>D?p.includes(D):!1);if(N.length&&N){const D=P.getAttribute("content");if(D)return D}}return""}function i(){let p=n("name","og:site_name","og:title","twitter:title");return p||(p=t.title),p}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}Mx=vm.getWindowMetadata=oN;var il={},aN=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Cx="%[a-f0-9]{2}",Tx=new RegExp("("+Cx+")|([^%]+?)","gi"),Rx=new RegExp("("+Cx+")+","gi");function bm(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],bm(r),bm(n))}function cN(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(Tx)||[],r=1;r{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},hN=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;sB==null,o=Symbol("encodeFragmentIdentifier");function a(B){switch(B.arrayFormat){case"index":return q=>(j,H)=>{const J=j.length;return H===void 0||B.skipNull&&H===null||B.skipEmptyString&&H===""?j:H===null?[...j,[d(q,B),"[",J,"]"].join("")]:[...j,[d(q,B),"[",d(J,B),"]=",d(H,B)].join("")]};case"bracket":return q=>(j,H)=>H===void 0||B.skipNull&&H===null||B.skipEmptyString&&H===""?j:H===null?[...j,[d(q,B),"[]"].join("")]:[...j,[d(q,B),"[]=",d(H,B)].join("")];case"colon-list-separator":return q=>(j,H)=>H===void 0||B.skipNull&&H===null||B.skipEmptyString&&H===""?j:H===null?[...j,[d(q,B),":list="].join("")]:[...j,[d(q,B),":list=",d(H,B)].join("")];case"comma":case"separator":case"bracket-separator":{const q=B.arrayFormat==="bracket-separator"?"[]=":"=";return j=>(H,J)=>J===void 0||B.skipNull&&J===null||B.skipEmptyString&&J===""?H:(J=J===null?"":J,H.length===0?[[d(j,B),q,d(J,B)].join("")]:[[H,d(J,B)].join(B.arrayFormatSeparator)])}default:return q=>(j,H)=>H===void 0||B.skipNull&&H===null||B.skipEmptyString&&H===""?j:H===null?[...j,d(q,B)]:[...j,[d(q,B),"=",d(H,B)].join("")]}}function u(B){let q;switch(B.arrayFormat){case"index":return(j,H,J)=>{if(q=/\[(\d*)\]$/.exec(j),j=j.replace(/\[\d*\]$/,""),!q){J[j]=H;return}J[j]===void 0&&(J[j]={}),J[j][q[1]]=H};case"bracket":return(j,H,J)=>{if(q=/(\[\])$/.exec(j),j=j.replace(/\[\]$/,""),!q){J[j]=H;return}if(J[j]===void 0){J[j]=[H];return}J[j]=[].concat(J[j],H)};case"colon-list-separator":return(j,H,J)=>{if(q=/(:list)$/.exec(j),j=j.replace(/:list$/,""),!q){J[j]=H;return}if(J[j]===void 0){J[j]=[H];return}J[j]=[].concat(J[j],H)};case"comma":case"separator":return(j,H,J)=>{const T=typeof H=="string"&&H.includes(B.arrayFormatSeparator),z=typeof H=="string"&&!T&&p(H,B).includes(B.arrayFormatSeparator);H=z?p(H,B):H;const ue=T||z?H.split(B.arrayFormatSeparator).map(_e=>p(_e,B)):H===null?H:p(H,B);J[j]=ue};case"bracket-separator":return(j,H,J)=>{const T=/(\[\])$/.test(j);if(j=j.replace(/\[\]$/,""),!T){J[j]=H&&p(H,B);return}const z=H===null?[]:H.split(B.arrayFormatSeparator).map(ue=>p(ue,B));if(J[j]===void 0){J[j]=z;return}J[j]=[].concat(J[j],z)};default:return(j,H,J)=>{if(J[j]===void 0){J[j]=H;return}J[j]=[].concat(J[j],H)}}}function l(B){if(typeof B!="string"||B.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function d(B,q){return q.encode?q.strict?e(B):encodeURIComponent(B):B}function p(B,q){return q.decode?r(B):B}function y(B){return Array.isArray(B)?B.sort():typeof B=="object"?y(Object.keys(B)).sort((q,j)=>Number(q)-Number(j)).map(q=>B[q]):B}function A(B){const q=B.indexOf("#");return q!==-1&&(B=B.slice(0,q)),B}function P(B){let q="";const j=B.indexOf("#");return j!==-1&&(q=B.slice(j)),q}function N(B){B=A(B);const q=B.indexOf("?");return q===-1?"":B.slice(q+1)}function D(B,q){return q.parseNumbers&&!Number.isNaN(Number(B))&&typeof B=="string"&&B.trim()!==""?B=Number(B):q.parseBooleans&&B!==null&&(B.toLowerCase()==="true"||B.toLowerCase()==="false")&&(B=B.toLowerCase()==="true"),B}function k(B,q){q=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},q),l(q.arrayFormatSeparator);const j=u(q),H=Object.create(null);if(typeof B!="string"||(B=B.trim().replace(/^[?#&]/,""),!B))return H;for(const J of B.split("&")){if(J==="")continue;let[T,z]=n(q.decode?J.replace(/\+/g," "):J,"=");z=z===void 0?null:["comma","separator","bracket-separator"].includes(q.arrayFormat)?z:p(z,q),j(p(T,q),z,H)}for(const J of Object.keys(H)){const T=H[J];if(typeof T=="object"&&T!==null)for(const z of Object.keys(T))T[z]=D(T[z],q);else H[J]=D(T,q)}return q.sort===!1?H:(q.sort===!0?Object.keys(H).sort():Object.keys(H).sort(q.sort)).reduce((J,T)=>{const z=H[T];return z&&typeof z=="object"&&!Array.isArray(z)?J[T]=y(z):J[T]=z,J},Object.create(null))}t.extract=N,t.parse=k,t.stringify=(B,q)=>{if(!B)return"";q=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},q),l(q.arrayFormatSeparator);const j=z=>q.skipNull&&s(B[z])||q.skipEmptyString&&B[z]==="",H=a(q),J={};for(const z of Object.keys(B))j(z)||(J[z]=B[z]);const T=Object.keys(J);return q.sort!==!1&&T.sort(q.sort),T.map(z=>{const ue=B[z];return ue===void 0?"":ue===null?d(z,q):Array.isArray(ue)?ue.length===0&&q.arrayFormat==="bracket-separator"?d(z,q)+"[]":ue.reduce(H(z),[]).join("&"):d(z,q)+"="+d(ue,q)}).filter(z=>z.length>0).join("&")},t.parseUrl=(B,q)=>{q=Object.assign({decode:!0},q);const[j,H]=n(B,"#");return Object.assign({url:j.split("?")[0]||"",query:k(N(B),q)},q&&q.parseFragmentIdentifier&&H?{fragmentIdentifier:p(H,q)}:{})},t.stringifyUrl=(B,q)=>{q=Object.assign({encode:!0,strict:!0,[o]:!0},q);const j=A(B.url).split("?")[0]||"",H=t.extract(B.url),J=t.parse(H,{sort:!1}),T=Object.assign(J,B.query);let z=t.stringify(T,q);z&&(z=`?${z}`);let ue=P(B.url);return B.fragmentIdentifier&&(ue=`#${q[o]?d(B.fragmentIdentifier,q):B.fragmentIdentifier}`),`${j}${z}${ue}`},t.pick=(B,q,j)=>{j=Object.assign({parseFragmentIdentifier:!0,[o]:!1},j);const{url:H,query:J,fragmentIdentifier:T}=t.parseUrl(B,j);return t.stringifyUrl({url:H,query:i(J,q),fragmentIdentifier:T},j)},t.exclude=(B,q,j)=>{const H=Array.isArray(q)?J=>!q.includes(J):(J,T)=>!q(J,T);return t.pick(B,H,j)}})(il);var Dx={exports:{}};/** + ***************************************************************************** */var Jg=function(t,e){return Jg=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Jg(t,e)};function oT(t,e){Jg(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Xg=function(){return Xg=Object.assign||function(e){for(var r,n=1,i=arguments.length;n=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function uT(t,e){return function(r,n){e(r,n,t)}}function fT(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function lT(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(d){try{l(n.next(d))}catch(p){o(p)}}function u(d){try{l(n.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):i(d.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function hT(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return u([l,d])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function C2(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function gT(){for(var t=[],e=0;e1||a(y,A)})})}function a(y,A){try{u(n[y](A))}catch(P){p(s[0][3],P)}}function u(y){y.value instanceof Kf?Promise.resolve(y.value.v).then(l,d):p(s[0][2],y)}function l(y){a("next",y)}function d(y){a("throw",y)}function p(y,A){y(A),s.shift(),s.length&&a(s[0][0],s[0][1])}}function bT(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Kf(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function yT(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Zg=="function"?Zg(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function wT(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function xT(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function _T(t){return t&&t.__esModule?t:{default:t}}function ET(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function ST(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const Vf=Jp(Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Xg},__asyncDelegator:bT,__asyncGenerator:vT,__asyncValues:yT,__await:Kf,__awaiter:lT,__classPrivateFieldGet:ET,__classPrivateFieldSet:ST,__createBinding:dT,__decorate:cT,__exportStar:pT,__extends:oT,__generator:hT,__importDefault:_T,__importStar:xT,__makeTemplateObject:wT,__metadata:fT,__param:uT,__read:C2,__rest:aT,__spread:gT,__spreadArrays:mT,__values:Zg},Symbol.toStringTag,{value:"Module"})));var Qg={},Gf={},T2;function AT(){if(T2)return Gf;T2=1,Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Gf.delay=t,Gf}var qa={},em={},za={},R2;function PT(){return R2||(R2=1,Object.defineProperty(za,"__esModule",{value:!0}),za.ONE_THOUSAND=za.ONE_HUNDRED=void 0,za.ONE_HUNDRED=100,za.ONE_THOUSAND=1e3),za}var tm={},D2;function MT(){return D2||(D2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(tm)),tm}var O2;function N2(){return O2||(O2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(PT(),t),e.__exportStar(MT(),t)}(em)),em}var L2;function IT(){if(L2)return qa;L2=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.fromMiliseconds=qa.toMiliseconds=void 0;const t=N2();function e(n){return n*t.ONE_THOUSAND}qa.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return qa.fromMiliseconds=r,qa}var k2;function CT(){return k2||(k2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(AT(),t),e.__exportStar(IT(),t)}(Qg)),Qg}var iu={},B2;function TT(){if(B2)return iu;B2=1,Object.defineProperty(iu,"__esModule",{value:!0}),iu.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return iu.Watch=t,iu.default=t,iu}var rm={},Yf={},$2;function RT(){if($2)return Yf;$2=1,Object.defineProperty(Yf,"__esModule",{value:!0}),Yf.IWatch=void 0;class t{}return Yf.IWatch=t,Yf}var F2;function DT(){return F2||(F2=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Vf.__exportStar(RT(),t)}(rm)),rm}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(CT(),t),e.__exportStar(TT(),t),e.__exportStar(DT(),t),e.__exportStar(N2(),t)})(mt);class Ha{}let OT=class extends Ha{constructor(e){super()}};const j2=mt.FIVE_SECONDS,su={pulse:"heartbeat_pulse"};let NT=class GA extends OT{constructor(e){super(e),this.events=new qi.EventEmitter,this.interval=j2,this.interval=(e==null?void 0:e.interval)||j2}static async init(e){const r=new GA(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),mt.toMiliseconds(this.interval))}pulse(){this.events.emit(su.pulse)}};const LT=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,kT=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,BT=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function $T(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){FT(t);return}return e}function FT(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Zh(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!BT.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(LT.test(t)||kT.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,$T)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function jT(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Tn(t,...e){try{return jT(t(...e))}catch(r){return Promise.reject(r)}}function UT(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function qT(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Qh(t){if(UT(t))return String(t);if(qT(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Qh(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function U2(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const nm="base64:";function zT(t){if(typeof t=="string")return t;U2();const e=Buffer.from(t).toString("base64");return nm+e}function HT(t){return typeof t!="string"||!t.startsWith(nm)?t:(U2(),Buffer.from(t.slice(nm.length),"base64"))}function pi(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function WT(...t){return pi(t.join(":"))}function ed(t){return t=pi(t),t?t+":":""}function poe(t){return t}const KT="memory",VT=()=>{const t=new Map;return{name:KT,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function GT(t={}){const e={mounts:{"":t.driver||VT()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const d of e.mountpoints)if(l.startsWith(d))return{base:d,relativeKey:l.slice(d.length),driver:e.mounts[d]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,d)=>e.mountpoints.filter(p=>p.startsWith(l)||d&&l.startsWith(p)).map(p=>({relativeBase:l.length>p.length?l.slice(p.length):void 0,mountpoint:p,driver:e.mounts[p]})),i=(l,d)=>{if(e.watching){d=pi(d);for(const p of e.watchListeners)p(l,d)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await q2(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,d,p)=>{const y=new Map,A=P=>{let O=y.get(P.base);return O||(O={driver:P.driver,base:P.base,items:[]},y.set(P.base,O)),O};for(const P of l){const O=typeof P=="string",D=pi(O?P:P.key),k=O?void 0:P.value,B=O||!P.options?d:{...d,...P.options},q=r(D);A(q).items.push({key:D,value:k,relativeKey:q.relativeKey,options:B})}return Promise.all([...y.values()].map(P=>p(P))).then(P=>P.flat())},u={hasItem(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return Tn(y.hasItem,p,d)},getItem(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return Tn(y.getItem,p,d).then(A=>Zh(A))},getItems(l,d){return a(l,d,p=>p.driver.getItems?Tn(p.driver.getItems,p.items.map(y=>({key:y.relativeKey,options:y.options})),d).then(y=>y.map(A=>({key:WT(p.base,A.key),value:Zh(A.value)}))):Promise.all(p.items.map(y=>Tn(p.driver.getItem,y.relativeKey,y.options).then(A=>({key:y.key,value:Zh(A)})))))},getItemRaw(l,d={}){l=pi(l);const{relativeKey:p,driver:y}=r(l);return y.getItemRaw?Tn(y.getItemRaw,p,d):Tn(y.getItem,p,d).then(A=>HT(A))},async setItem(l,d,p={}){if(d===void 0)return u.removeItem(l);l=pi(l);const{relativeKey:y,driver:A}=r(l);A.setItem&&(await Tn(A.setItem,y,Qh(d),p),A.watch||i("update",l))},async setItems(l,d){await a(l,d,async p=>{if(p.driver.setItems)return Tn(p.driver.setItems,p.items.map(y=>({key:y.relativeKey,value:Qh(y.value),options:y.options})),d);p.driver.setItem&&await Promise.all(p.items.map(y=>Tn(p.driver.setItem,y.relativeKey,Qh(y.value),y.options)))})},async setItemRaw(l,d,p={}){if(d===void 0)return u.removeItem(l,p);l=pi(l);const{relativeKey:y,driver:A}=r(l);if(A.setItemRaw)await Tn(A.setItemRaw,y,d,p);else if(A.setItem)await Tn(A.setItem,y,zT(d),p);else return;A.watch||i("update",l)},async removeItem(l,d={}){typeof d=="boolean"&&(d={removeMeta:d}),l=pi(l);const{relativeKey:p,driver:y}=r(l);y.removeItem&&(await Tn(y.removeItem,p,d),(d.removeMeta||d.removeMata)&&await Tn(y.removeItem,p+"$",d),y.watch||i("remove",l))},async getMeta(l,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),l=pi(l);const{relativeKey:p,driver:y}=r(l),A=Object.create(null);if(y.getMeta&&Object.assign(A,await Tn(y.getMeta,p,d)),!d.nativeOnly){const P=await Tn(y.getItem,p+"$",d).then(O=>Zh(O));P&&typeof P=="object"&&(typeof P.atime=="string"&&(P.atime=new Date(P.atime)),typeof P.mtime=="string"&&(P.mtime=new Date(P.mtime)),Object.assign(A,P))}return A},setMeta(l,d,p={}){return this.setItem(l+"$",d,p)},removeMeta(l,d={}){return this.removeItem(l+"$",d)},async getKeys(l,d={}){l=ed(l);const p=n(l,!0);let y=[];const A=[];for(const P of p){const O=await Tn(P.driver.getKeys,P.relativeBase,d);for(const D of O){const k=P.mountpoint+pi(D);y.some(B=>k.startsWith(B))||A.push(k)}y=[P.mountpoint,...y.filter(D=>!D.startsWith(P.mountpoint))]}return l?A.filter(P=>P.startsWith(l)&&P[P.length-1]!=="$"):A.filter(P=>P[P.length-1]!=="$")},async clear(l,d={}){l=ed(l),await Promise.all(n(l,!1).map(async p=>{if(p.driver.clear)return Tn(p.driver.clear,p.relativeBase,d);if(p.driver.removeItem){const y=await p.driver.getKeys(p.relativeBase||"",d);return Promise.all(y.map(A=>p.driver.removeItem(A,d)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>z2(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(d=>d!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,d){if(l=ed(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((p,y)=>y.length-p.length)),e.mounts[l]=d,e.watching&&Promise.resolve(q2(d,i,l)).then(p=>{e.unwatch[l]=p}).catch(console.error),u},async unmount(l,d=!0){l=ed(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),d&&await z2(e.mounts[l]),e.mountpoints=e.mountpoints.filter(p=>p!==l),delete e.mounts[l])},getMount(l=""){l=pi(l)+":";const d=r(l);return{driver:d.driver,base:d.base}},getMounts(l="",d={}){return l=pi(l),n(l,d.parents).map(y=>({driver:y.driver,base:y.mountpoint}))},keys:(l,d={})=>u.getKeys(l,d),get:(l,d={})=>u.getItem(l,d),set:(l,d,p={})=>u.setItem(l,d,p),has:(l,d={})=>u.hasItem(l,d),del:(l,d={})=>u.removeItem(l,d),remove:(l,d={})=>u.removeItem(l,d)};return u}function q2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function z2(t){typeof t.dispose=="function"&&await Tn(t.dispose)}function Wa(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function H2(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Wa(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let im;function Jf(){return im||(im=H2("keyval-store","keyval")),im}function W2(t,e=Jf()){return e("readonly",r=>Wa(r.get(t)))}function YT(t,e,r=Jf()){return r("readwrite",n=>(n.put(e,t),Wa(n.transaction)))}function JT(t,e=Jf()){return e("readwrite",r=>(r.delete(t),Wa(r.transaction)))}function XT(t=Jf()){return t("readwrite",e=>(e.clear(),Wa(e.transaction)))}function ZT(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Wa(t.transaction)}function QT(t=Jf()){return t("readonly",e=>{if(e.getAllKeys)return Wa(e.getAllKeys());const r=[];return ZT(e,n=>r.push(n.key)).then(()=>r)})}const eR=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),tR=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Ka(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return tR(t)}catch{return t}}function mo(t){return typeof t=="string"?t:eR(t)||""}const rR="idb-keyval";var nR=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=H2(t.dbName,t.storeName)),{name:rR,options:t,async hasItem(i){return!(typeof await W2(r(i),n)>"u")},async getItem(i){return await W2(r(i),n)??null},setItem(i,s){return YT(r(i),s,n)},removeItem(i){return JT(r(i),n)},getKeys(){return QT(n)},clear(){return XT(n)}}};const iR="WALLET_CONNECT_V2_INDEXED_DB",sR="keyvaluestorage";let oR=class{constructor(){this.indexedDb=GT({driver:nR({dbName:iR,storeName:sR})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,mo(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var sm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},td={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof sm<"u"&&sm.localStorage?td.exports=sm.localStorage:typeof window<"u"&&window.localStorage?td.exports=window.localStorage:td.exports=new e})();function aR(t){var e;return[t[0],Ka((e=t[1])!=null?e:"")]}let cR=class{constructor(){this.localStorage=td.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(aR)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Ka(r)}async setItem(e,r){this.localStorage.setItem(e,mo(r))}async removeItem(e){this.localStorage.removeItem(e)}};const uR="wc_storage_version",K2=1,fR=async(t,e,r)=>{const n=uR,i=await e.getItem(n);if(i&&i>=K2){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,K2),r(e),lR(t,o)},lR=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let hR=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new cR;this.storage=e;try{const r=new oR;fR(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function dR(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var pR=gR;function gR(t,e,r){var n=r&&r.stringify||dR,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?p:0,t.charCodeAt(A+1)){case 100:case 102:if(d>=u||e[d]==null)break;p=u||e[d]==null)break;p=u||e[d]===void 0)break;p",p=A+2,A++;break}l+=n(e[d]),p=A+2,A++;break;case 115:if(d>=u)break;p-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",u=Object.create(r);u.log||(u.log=Zf),Object.defineProperty(u,"levelVal",{get:d}),Object.defineProperty(u,"level",{get:p,set:y});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:_R(t)};u.levels=vo.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Zf,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=A,e&&(u._logEvent=om());function d(){return this.level==="silent"?1/0:this.levels.values[this.level]}function p(){return this._level}function y(P){if(P!=="silent"&&!this.levels.values[P])throw Error("unknown level "+P);this._level=P,au(l,u,"error","log"),au(l,u,"fatal","error"),au(l,u,"warn","error"),au(l,u,"info","log"),au(l,u,"debug","log"),au(l,u,"trace","log")}function A(P,O){if(!P)throw new Error("missing bindings for child Pino");O=O||{},i&&P.serializers&&(O.serializers=P.serializers);const D=O.serializers;if(i&&D){var k=Object.assign({},n,D),B=t.browser.serialize===!0?Object.keys(k):i;delete P.serializers,rd([P],B,k,this._stdErrSerialize)}function q(j){this._childLevel=(j._childLevel|0)+1,this.error=cu(j,P,"error"),this.fatal=cu(j,P,"fatal"),this.warn=cu(j,P,"warn"),this.info=cu(j,P,"info"),this.debug=cu(j,P,"debug"),this.trace=cu(j,P,"trace"),k&&(this.serializers=k,this._serialize=B),e&&(this._logEvent=om([].concat(j._logEvent.bindings,P)))}return q.prototype=this,new q(this)}return u}vo.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},vo.stdSerializers=mR,vo.stdTimeFunctions=Object.assign({},{nullTime:G2,epochTime:Y2,unixTime:ER,isoTime:SR});function au(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Zf:i[r]?i[r]:Xf[r]||Xf[n]||Zf,bR(t,e,r)}function bR(t,e,r){!t.transmit&&e[r]===Zf||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Xf?Xf:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function cu(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},X2=class{constructor(e,r=cm){this.level=e??"error",this.levelValue=ou.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new J2(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===ou.levels.values.error?console.error(e):r===ou.levels.values.warn?console.warn(e):r===ou.levels.values.debug?console.debug(e):r===ou.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(mo({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new J2(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(mo({extraMetadata:e})),new Blob(r,{type:"application/json"})}},IR=class{constructor(e,r=cm){this.baseChunkLogger=new X2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},CR=class{constructor(e,r=cm){this.baseChunkLogger=new X2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var TR=Object.defineProperty,RR=Object.defineProperties,DR=Object.getOwnPropertyDescriptors,Z2=Object.getOwnPropertySymbols,OR=Object.prototype.hasOwnProperty,NR=Object.prototype.propertyIsEnumerable,Q2=(t,e,r)=>e in t?TR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,id=(t,e)=>{for(var r in e||(e={}))OR.call(e,r)&&Q2(t,r,e[r]);if(Z2)for(var r of Z2(e))NR.call(e,r)&&Q2(t,r,e[r]);return t},sd=(t,e)=>RR(t,DR(e));function od(t){return sd(id({},t),{level:(t==null?void 0:t.level)||PR.level})}function LR(t,e=el){return t[e]||""}function kR(t,e,r=el){return t[r]=e,t}function gi(t,e=el){let r="";return typeof t.bindings>"u"?r=LR(t,e):r=t.bindings().context||"",r}function BR(t,e,r=el){const n=gi(t,r);return n.trim()?`${n}/${e}`:e}function ri(t,e,r=el){const n=BR(t,e,r),i=t.child({context:n});return kR(i,n,r)}function $R(t){var e,r;const n=new IR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace",browser:sd(id({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function FR(t){var e;const r=new CR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Qf(sd(id({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function jR(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?$R(t):FR(t)}let UR=class extends Ha{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},qR=class extends Ha{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},zR=class{constructor(e,r){this.logger=e,this.core=r}},HR=class extends Ha{constructor(e,r){super(),this.relayer=e,this.logger=r}},WR=class extends Ha{constructor(e){super()}},KR=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},VR=class extends Ha{constructor(e,r){super(),this.relayer=e,this.logger=r}},GR=class extends Ha{constructor(e,r){super(),this.core=e,this.logger=r}},YR=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},JR=class{constructor(e,r){this.projectId=e,this.logger=r}},XR=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},ZR=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},QR=class{constructor(e){this.client=e}};var um={},ta={},ad={},cd={};Object.defineProperty(cd,"__esModule",{value:!0}),cd.BrowserRandomSource=void 0;const ex=65536;class eD{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let n=0;n>>16&65535,d=a&65535,p=u>>>16&65535,y=u&65535;return d*y+(l*y+d*p<<16>>>0)|0}t.mul=Math.imul||e;function r(a,u){return a+u|0}t.add=r;function n(a,u){return a-u|0}t.sub=n;function i(a,u){return a<>>32-u}t.rotl=i;function s(a,u){return a<<32-u|a>>>u}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(rx),Object.defineProperty(or,"__esModule",{value:!0});var nx=rx;function aD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}or.readInt16BE=aD;function cD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}or.readUint16BE=cD;function uD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}or.readInt16LE=uD;function fD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}or.readUint16LE=fD;function ix(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}or.writeUint16BE=ix,or.writeInt16BE=ix;function sx(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}or.writeUint16LE=sx,or.writeInt16LE=sx;function fm(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}or.readInt32BE=fm;function lm(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}or.readUint32BE=lm;function hm(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}or.readInt32LE=hm;function dm(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}or.readUint32LE=dm;function fd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}or.writeUint32BE=fd,or.writeInt32BE=fd;function ld(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}or.writeUint32LE=ld,or.writeInt32LE=ld;function lD(t,e){e===void 0&&(e=0);var r=fm(t,e),n=fm(t,e+4);return r*4294967296+n-(n>>31)*4294967296}or.readInt64BE=lD;function hD(t,e){e===void 0&&(e=0);var r=lm(t,e),n=lm(t,e+4);return r*4294967296+n}or.readUint64BE=hD;function dD(t,e){e===void 0&&(e=0);var r=hm(t,e),n=hm(t,e+4);return n*4294967296+r-(r>>31)*4294967296}or.readInt64LE=dD;function pD(t,e){e===void 0&&(e=0);var r=dm(t,e),n=dm(t,e+4);return n*4294967296+r}or.readUint64LE=pD;function ox(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fd(t/4294967296>>>0,e,r),fd(t>>>0,e,r+4),e}or.writeUint64BE=ox,or.writeInt64BE=ox;function ax(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ld(t>>>0,e,r),ld(t/4294967296>>>0,e,r+4),e}or.writeUint64LE=ax,or.writeInt64LE=ax;function gD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}or.readUintBE=gD;function mD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}or.writeUintBE=vD;function bD(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!nx.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s256)throw new Error("randomString charset is too long");let y="";const A=d.length,P=256-256%A;for(;l>0;){const O=i(Math.ceil(l*256/P),p);for(let D=0;D0;D++){const k=O[D];k0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,A=l%128<112?128:256;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._stateHi.set(u.stateHi),this._stateLo.set(u.stateLo),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.stateHi),r.wipe(u.stateLo),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,u,l,d,p,y,A){for(var P=l[0],O=l[1],D=l[2],k=l[3],B=l[4],q=l[5],j=l[6],H=l[7],J=d[0],T=d[1],z=d[2],ue=d[3],_e=d[4],G=d[5],E=d[6],m=d[7],f,g,v,x,_,S,b,M;A>=128;){for(var I=0;I<16;I++){var F=8*I+y;a[I]=e.readUint32BE(p,F),u[I]=e.readUint32BE(p,F+4)}for(var I=0;I<80;I++){var ce=P,N=O,se=D,ee=k,X=B,Q=q,R=j,Z=H,te=J,le=T,ie=z,fe=ue,ve=_e,Me=G,Ne=E,Te=m;if(f=H,g=m,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=(B>>>14|_e<<18)^(B>>>18|_e<<14)^(_e>>>9|B<<23),g=(_e>>>14|B<<18)^(_e>>>18|B<<14)^(B>>>9|_e<<23),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=B&q^~B&j,g=_e&G^~_e&E,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=i[I*2],g=i[I*2+1],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=a[I%16],g=u[I%16],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,v=b&65535|M<<16,x=_&65535|S<<16,f=v,g=x,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=(P>>>28|J<<4)^(J>>>2|P<<30)^(J>>>7|P<<25),g=(J>>>28|P<<4)^(P>>>2|J<<30)^(P>>>7|J<<25),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,f=P&O^P&D^O&D,g=J&T^J&z^T&z,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,Z=b&65535|M<<16,Te=_&65535|S<<16,f=ee,g=fe,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=v,g=x,_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,ee=b&65535|M<<16,fe=_&65535|S<<16,O=ce,D=N,k=se,B=ee,q=X,j=Q,H=R,P=Z,T=te,z=le,ue=ie,_e=fe,G=ve,E=Me,m=Ne,J=Te,I%16===15)for(var F=0;F<16;F++)f=a[F],g=u[F],_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=a[(F+9)%16],g=u[(F+9)%16],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,v=a[(F+1)%16],x=u[(F+1)%16],f=(v>>>1|x<<31)^(v>>>8|x<<24)^v>>>7,g=(x>>>1|v<<31)^(x>>>8|v<<24)^(x>>>7|v<<25),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,v=a[(F+14)%16],x=u[(F+14)%16],f=(v>>>19|x<<13)^(x>>>29|v<<3)^v>>>6,g=(x>>>19|v<<13)^(v>>>29|x<<3)^(x>>>6|v<<26),_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,a[F]=b&65535|M<<16,u[F]=_&65535|S<<16}f=P,g=J,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[0],g=d[0],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[0]=P=b&65535|M<<16,d[0]=J=_&65535|S<<16,f=O,g=T,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[1],g=d[1],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[1]=O=b&65535|M<<16,d[1]=T=_&65535|S<<16,f=D,g=z,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[2],g=d[2],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[2]=D=b&65535|M<<16,d[2]=z=_&65535|S<<16,f=k,g=ue,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[3],g=d[3],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[3]=k=b&65535|M<<16,d[3]=ue=_&65535|S<<16,f=B,g=_e,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[4],g=d[4],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[4]=B=b&65535|M<<16,d[4]=_e=_&65535|S<<16,f=q,g=G,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[5],g=d[5],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[5]=q=b&65535|M<<16,d[5]=G=_&65535|S<<16,f=j,g=E,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[6],g=d[6],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[6]=j=b&65535|M<<16,d[6]=E=_&65535|S<<16,f=H,g=m,_=g&65535,S=g>>>16,b=f&65535,M=f>>>16,f=l[7],g=d[7],_+=g&65535,S+=g>>>16,b+=f&65535,M+=f>>>16,S+=_>>>16,b+=S>>>16,M+=b>>>16,l[7]=H=b&65535|M<<16,d[7]=m=_&65535|S<<16,y+=128,A-=128}return y}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(cx),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=ta,r=cx,n=Mi;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(ee){const X=new Float64Array(16);if(ee)for(let Q=0;Q>16&1),Q[le-1]&=65535;Q[15]=R[15]-32767-(Q[14]>>16&1);const te=Q[15]>>16&1;Q[14]&=65535,O(R,Q,1-te)}for(let Z=0;Z<16;Z++)ee[2*Z]=R[Z]&255,ee[2*Z+1]=R[Z]>>8}function k(ee,X){let Q=0;for(let R=0;R<32;R++)Q|=ee[R]^X[R];return(1&Q-1>>>8)-1}function B(ee,X){const Q=new Uint8Array(32),R=new Uint8Array(32);return D(Q,ee),D(R,X),k(Q,R)}function q(ee){const X=new Uint8Array(32);return D(X,ee),X[0]&1}function j(ee,X){for(let Q=0;Q<16;Q++)ee[Q]=X[2*Q]+(X[2*Q+1]<<8);ee[15]&=32767}function H(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]+Q[R]}function J(ee,X,Q){for(let R=0;R<16;R++)ee[R]=X[R]-Q[R]}function T(ee,X,Q){let R,Z,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=0,Ie=0,Le=0,Ve=0,ke=0,ze=0,He=0,Ee=0,Qe=0,ct=0,Be=0,et=0,rt=0,Je=0,pt=0,ht=0,ft=0,Ht=0,Jt=0,St=0,er=0,Xt=0,Ot=0,Bt=Q[0],Tt=Q[1],vt=Q[2],Dt=Q[3],Lt=Q[4],bt=Q[5],$t=Q[6],jt=Q[7],nt=Q[8],Ft=Q[9],$=Q[10],W=Q[11],V=Q[12],C=Q[13],Y=Q[14],U=Q[15];R=X[0],te+=R*Bt,le+=R*Tt,ie+=R*vt,fe+=R*Dt,ve+=R*Lt,Me+=R*bt,Ne+=R*$t,Te+=R*jt,$e+=R*nt,Ie+=R*Ft,Le+=R*$,Ve+=R*W,ke+=R*V,ze+=R*C,He+=R*Y,Ee+=R*U,R=X[1],le+=R*Bt,ie+=R*Tt,fe+=R*vt,ve+=R*Dt,Me+=R*Lt,Ne+=R*bt,Te+=R*$t,$e+=R*jt,Ie+=R*nt,Le+=R*Ft,Ve+=R*$,ke+=R*W,ze+=R*V,He+=R*C,Ee+=R*Y,Qe+=R*U,R=X[2],ie+=R*Bt,fe+=R*Tt,ve+=R*vt,Me+=R*Dt,Ne+=R*Lt,Te+=R*bt,$e+=R*$t,Ie+=R*jt,Le+=R*nt,Ve+=R*Ft,ke+=R*$,ze+=R*W,He+=R*V,Ee+=R*C,Qe+=R*Y,ct+=R*U,R=X[3],fe+=R*Bt,ve+=R*Tt,Me+=R*vt,Ne+=R*Dt,Te+=R*Lt,$e+=R*bt,Ie+=R*$t,Le+=R*jt,Ve+=R*nt,ke+=R*Ft,ze+=R*$,He+=R*W,Ee+=R*V,Qe+=R*C,ct+=R*Y,Be+=R*U,R=X[4],ve+=R*Bt,Me+=R*Tt,Ne+=R*vt,Te+=R*Dt,$e+=R*Lt,Ie+=R*bt,Le+=R*$t,Ve+=R*jt,ke+=R*nt,ze+=R*Ft,He+=R*$,Ee+=R*W,Qe+=R*V,ct+=R*C,Be+=R*Y,et+=R*U,R=X[5],Me+=R*Bt,Ne+=R*Tt,Te+=R*vt,$e+=R*Dt,Ie+=R*Lt,Le+=R*bt,Ve+=R*$t,ke+=R*jt,ze+=R*nt,He+=R*Ft,Ee+=R*$,Qe+=R*W,ct+=R*V,Be+=R*C,et+=R*Y,rt+=R*U,R=X[6],Ne+=R*Bt,Te+=R*Tt,$e+=R*vt,Ie+=R*Dt,Le+=R*Lt,Ve+=R*bt,ke+=R*$t,ze+=R*jt,He+=R*nt,Ee+=R*Ft,Qe+=R*$,ct+=R*W,Be+=R*V,et+=R*C,rt+=R*Y,Je+=R*U,R=X[7],Te+=R*Bt,$e+=R*Tt,Ie+=R*vt,Le+=R*Dt,Ve+=R*Lt,ke+=R*bt,ze+=R*$t,He+=R*jt,Ee+=R*nt,Qe+=R*Ft,ct+=R*$,Be+=R*W,et+=R*V,rt+=R*C,Je+=R*Y,pt+=R*U,R=X[8],$e+=R*Bt,Ie+=R*Tt,Le+=R*vt,Ve+=R*Dt,ke+=R*Lt,ze+=R*bt,He+=R*$t,Ee+=R*jt,Qe+=R*nt,ct+=R*Ft,Be+=R*$,et+=R*W,rt+=R*V,Je+=R*C,pt+=R*Y,ht+=R*U,R=X[9],Ie+=R*Bt,Le+=R*Tt,Ve+=R*vt,ke+=R*Dt,ze+=R*Lt,He+=R*bt,Ee+=R*$t,Qe+=R*jt,ct+=R*nt,Be+=R*Ft,et+=R*$,rt+=R*W,Je+=R*V,pt+=R*C,ht+=R*Y,ft+=R*U,R=X[10],Le+=R*Bt,Ve+=R*Tt,ke+=R*vt,ze+=R*Dt,He+=R*Lt,Ee+=R*bt,Qe+=R*$t,ct+=R*jt,Be+=R*nt,et+=R*Ft,rt+=R*$,Je+=R*W,pt+=R*V,ht+=R*C,ft+=R*Y,Ht+=R*U,R=X[11],Ve+=R*Bt,ke+=R*Tt,ze+=R*vt,He+=R*Dt,Ee+=R*Lt,Qe+=R*bt,ct+=R*$t,Be+=R*jt,et+=R*nt,rt+=R*Ft,Je+=R*$,pt+=R*W,ht+=R*V,ft+=R*C,Ht+=R*Y,Jt+=R*U,R=X[12],ke+=R*Bt,ze+=R*Tt,He+=R*vt,Ee+=R*Dt,Qe+=R*Lt,ct+=R*bt,Be+=R*$t,et+=R*jt,rt+=R*nt,Je+=R*Ft,pt+=R*$,ht+=R*W,ft+=R*V,Ht+=R*C,Jt+=R*Y,St+=R*U,R=X[13],ze+=R*Bt,He+=R*Tt,Ee+=R*vt,Qe+=R*Dt,ct+=R*Lt,Be+=R*bt,et+=R*$t,rt+=R*jt,Je+=R*nt,pt+=R*Ft,ht+=R*$,ft+=R*W,Ht+=R*V,Jt+=R*C,St+=R*Y,er+=R*U,R=X[14],He+=R*Bt,Ee+=R*Tt,Qe+=R*vt,ct+=R*Dt,Be+=R*Lt,et+=R*bt,rt+=R*$t,Je+=R*jt,pt+=R*nt,ht+=R*Ft,ft+=R*$,Ht+=R*W,Jt+=R*V,St+=R*C,er+=R*Y,Xt+=R*U,R=X[15],Ee+=R*Bt,Qe+=R*Tt,ct+=R*vt,Be+=R*Dt,et+=R*Lt,rt+=R*bt,Je+=R*$t,pt+=R*jt,ht+=R*nt,ft+=R*Ft,Ht+=R*$,Jt+=R*W,St+=R*V,er+=R*C,Xt+=R*Y,Ot+=R*U,te+=38*Qe,le+=38*ct,ie+=38*Be,fe+=38*et,ve+=38*rt,Me+=38*Je,Ne+=38*pt,Te+=38*ht,$e+=38*ft,Ie+=38*Ht,Le+=38*Jt,Ve+=38*St,ke+=38*er,ze+=38*Xt,He+=38*Ot,Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),Z=1,R=te+Z+65535,Z=Math.floor(R/65536),te=R-Z*65536,R=le+Z+65535,Z=Math.floor(R/65536),le=R-Z*65536,R=ie+Z+65535,Z=Math.floor(R/65536),ie=R-Z*65536,R=fe+Z+65535,Z=Math.floor(R/65536),fe=R-Z*65536,R=ve+Z+65535,Z=Math.floor(R/65536),ve=R-Z*65536,R=Me+Z+65535,Z=Math.floor(R/65536),Me=R-Z*65536,R=Ne+Z+65535,Z=Math.floor(R/65536),Ne=R-Z*65536,R=Te+Z+65535,Z=Math.floor(R/65536),Te=R-Z*65536,R=$e+Z+65535,Z=Math.floor(R/65536),$e=R-Z*65536,R=Ie+Z+65535,Z=Math.floor(R/65536),Ie=R-Z*65536,R=Le+Z+65535,Z=Math.floor(R/65536),Le=R-Z*65536,R=Ve+Z+65535,Z=Math.floor(R/65536),Ve=R-Z*65536,R=ke+Z+65535,Z=Math.floor(R/65536),ke=R-Z*65536,R=ze+Z+65535,Z=Math.floor(R/65536),ze=R-Z*65536,R=He+Z+65535,Z=Math.floor(R/65536),He=R-Z*65536,R=Ee+Z+65535,Z=Math.floor(R/65536),Ee=R-Z*65536,te+=Z-1+37*(Z-1),ee[0]=te,ee[1]=le,ee[2]=ie,ee[3]=fe,ee[4]=ve,ee[5]=Me,ee[6]=Ne,ee[7]=Te,ee[8]=$e,ee[9]=Ie,ee[10]=Le,ee[11]=Ve,ee[12]=ke,ee[13]=ze,ee[14]=He,ee[15]=Ee}function z(ee,X){T(ee,X,X)}function ue(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=253;R>=0;R--)z(Q,Q),R!==2&&R!==4&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function _e(ee,X){const Q=i();let R;for(R=0;R<16;R++)Q[R]=X[R];for(R=250;R>=0;R--)z(Q,Q),R!==1&&T(Q,Q,X);for(R=0;R<16;R++)ee[R]=Q[R]}function G(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i(),ve=i(),Me=i();J(Q,ee[1],ee[0]),J(Me,X[1],X[0]),T(Q,Q,Me),H(R,ee[0],ee[1]),H(Me,X[0],X[1]),T(R,R,Me),T(Z,ee[3],X[3]),T(Z,Z,l),T(te,ee[2],X[2]),H(te,te,te),J(le,R,Q),J(ie,te,Z),H(fe,te,Z),H(ve,R,Q),T(ee[0],le,ie),T(ee[1],ve,fe),T(ee[2],fe,ie),T(ee[3],le,ve)}function E(ee,X,Q){for(let R=0;R<4;R++)O(ee[R],X[R],Q)}function m(ee,X){const Q=i(),R=i(),Z=i();ue(Z,X[2]),T(Q,X[0],Z),T(R,X[1],Z),D(ee,R),ee[31]^=q(Q)<<7}function f(ee,X,Q){A(ee[0],o),A(ee[1],a),A(ee[2],a),A(ee[3],o);for(let R=255;R>=0;--R){const Z=Q[R/8|0]>>(R&7)&1;E(ee,X,Z),G(X,ee),G(ee,ee),E(ee,X,Z)}}function g(ee,X){const Q=[i(),i(),i(),i()];A(Q[0],d),A(Q[1],p),A(Q[2],a),T(Q[3],d,p),f(ee,Q,X)}function v(ee){if(ee.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const X=(0,r.hash)(ee);X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(32),R=[i(),i(),i(),i()];g(R,X),m(Q,R);const Z=new Uint8Array(64);return Z.set(ee),Z.set(Q,32),{publicKey:Q,secretKey:Z}}t.generateKeyPairFromSeed=v;function x(ee){const X=(0,e.randomBytes)(32,ee),Q=v(X);return(0,n.wipe)(X),Q}t.generateKeyPair=x;function _(ee){if(ee.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(ee.subarray(32))}t.extractPublicKeyFromSecretKey=_;const S=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function b(ee,X){let Q,R,Z,te;for(R=63;R>=32;--R){for(Q=0,Z=R-32,te=R-12;Z>4)*S[Z],Q=X[Z]>>8,X[Z]&=255;for(Z=0;Z<32;Z++)X[Z]-=Q*S[Z];for(R=0;R<32;R++)X[R+1]+=X[R]>>8,ee[R]=X[R]&255}function M(ee){const X=new Float64Array(64);for(let Q=0;Q<64;Q++)X[Q]=ee[Q];for(let Q=0;Q<64;Q++)ee[Q]=0;b(ee,X)}function I(ee,X){const Q=new Float64Array(64),R=[i(),i(),i(),i()],Z=(0,r.hash)(ee.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(64);te.set(Z.subarray(32),32);const le=new r.SHA512;le.update(te.subarray(32)),le.update(X);const ie=le.digest();le.clean(),M(ie),g(R,ie),m(te,R),le.reset(),le.update(te.subarray(0,32)),le.update(ee.subarray(32)),le.update(X);const fe=le.digest();M(fe);for(let ve=0;ve<32;ve++)Q[ve]=ie[ve];for(let ve=0;ve<32;ve++)for(let Me=0;Me<32;Me++)Q[ve+Me]+=fe[ve]*Z[Me];return b(te.subarray(32),Q),te}t.sign=I;function F(ee,X){const Q=i(),R=i(),Z=i(),te=i(),le=i(),ie=i(),fe=i();return A(ee[2],a),j(ee[1],X),z(Z,ee[1]),T(te,Z,u),J(Z,Z,ee[2]),H(te,ee[2],te),z(le,te),z(ie,le),T(fe,ie,le),T(Q,fe,Z),T(Q,Q,te),_e(Q,Q),T(Q,Q,Z),T(Q,Q,te),T(Q,Q,te),T(ee[0],Q,te),z(R,ee[0]),T(R,R,te),B(R,Z)&&T(ee[0],ee[0],y),z(R,ee[0]),T(R,R,te),B(R,Z)?-1:(q(ee[0])===X[31]>>7&&J(ee[0],o,ee[0]),T(ee[3],ee[0],ee[1]),0)}function ce(ee,X,Q){const R=new Uint8Array(32),Z=[i(),i(),i(),i()],te=[i(),i(),i(),i()];if(Q.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(F(te,ee))return!1;const le=new r.SHA512;le.update(Q.subarray(0,32)),le.update(ee),le.update(X);const ie=le.digest();return M(ie),f(Z,te,ie),g(te,Q.subarray(32)),G(Z,te),m(R,Z),!k(Q,R)}t.verify=ce;function N(ee){let X=[i(),i(),i(),i()];if(F(X,ee))throw new Error("Ed25519: invalid public key");let Q=i(),R=i(),Z=X[1];H(Q,a,Z),J(R,a,Z),ue(R,R),T(Q,Q,R);let te=new Uint8Array(32);return D(te,Q),te}t.convertPublicKeyToX25519=N;function se(ee){const X=(0,r.hash)(ee.subarray(0,32));X[0]&=248,X[31]&=127,X[31]|=64;const Q=new Uint8Array(X.subarray(0,32));return(0,n.wipe)(X),Q}t.convertSecretKeyToX25519=se}(um);const MD="EdDSA",ID="JWT",hd=".",dd="base64url",ux="utf8",fx="utf8",CD=":",TD="did",RD="key",lx="base58btc",DD="z",OD="K36",ND=32;function hx(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function pd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=hx(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function LD(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,j=new Uint8Array(q);k!==B;){for(var H=P[k],J=0,T=q-1;(H!==0||J>>0,j[T]=H%a>>>0,H=H/a>>>0;if(H!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=q-D;z!==q&&j[z]===0;)z++;for(var ue=u.repeat(O);z>>0,q=new Uint8Array(B);P[O];){var j=r[P.charCodeAt(O)];if(j===255)return;for(var H=0,J=B-1;(j!==0||H>>0,q[J]=j%256>>>0,j=j/256>>>0;if(j!==0)throw new Error("Non-zero carry");k=H,O++}if(P[O]!==" "){for(var T=B-k;T!==B&&q[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=q[T++];return z}}}function A(P){var O=y(P);if(O)return O;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:A}}var kD=LD,BD=kD;const $D=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},FD=t=>new TextEncoder().encode(t),jD=t=>new TextDecoder().decode(t);class UD{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class qD{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return dx(this,e)}}class zD{constructor(e){this.decoders=e}or(e){return dx(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const dx=(t,e)=>new zD({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class HD{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new UD(e,r,n),this.decoder=new qD(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const gd=({name:t,prefix:e,encode:r,decode:n})=>new HD(t,e,r,n),rl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=BD(r,e);return gd({prefix:t,name:e,encode:n,decode:s=>$D(i(s))})},WD=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},KD=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<gd({prefix:e,name:t,encode(i){return KD(i,n,r)},decode(i){return WD(i,n,r,t)}}),VD=gd({prefix:"\0",name:"identity",encode:t=>jD(t),decode:t=>FD(t)}),GD=Object.freeze(Object.defineProperty({__proto__:null,identity:VD},Symbol.toStringTag,{value:"Module"})),YD=jn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),JD=Object.freeze(Object.defineProperty({__proto__:null,base2:YD},Symbol.toStringTag,{value:"Module"})),XD=jn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),ZD=Object.freeze(Object.defineProperty({__proto__:null,base8:XD},Symbol.toStringTag,{value:"Module"})),QD=rl({prefix:"9",name:"base10",alphabet:"0123456789"}),eO=Object.freeze(Object.defineProperty({__proto__:null,base10:QD},Symbol.toStringTag,{value:"Module"})),tO=jn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),rO=jn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),nO=Object.freeze(Object.defineProperty({__proto__:null,base16:tO,base16upper:rO},Symbol.toStringTag,{value:"Module"})),iO=jn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),sO=jn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),oO=jn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),aO=jn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),cO=jn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),uO=jn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),fO=jn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),lO=jn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),hO=jn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),dO=Object.freeze(Object.defineProperty({__proto__:null,base32:iO,base32hex:cO,base32hexpad:fO,base32hexpadupper:lO,base32hexupper:uO,base32pad:oO,base32padupper:aO,base32upper:sO,base32z:hO},Symbol.toStringTag,{value:"Module"})),pO=rl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),gO=rl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),mO=Object.freeze(Object.defineProperty({__proto__:null,base36:pO,base36upper:gO},Symbol.toStringTag,{value:"Module"})),vO=rl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),bO=rl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),yO=Object.freeze(Object.defineProperty({__proto__:null,base58btc:vO,base58flickr:bO},Symbol.toStringTag,{value:"Module"})),wO=jn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),xO=jn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),_O=jn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),EO=jn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),SO=Object.freeze(Object.defineProperty({__proto__:null,base64:wO,base64pad:xO,base64url:_O,base64urlpad:EO},Symbol.toStringTag,{value:"Module"})),px=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),AO=px.reduce((t,e,r)=>(t[r]=e,t),[]),PO=px.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function MO(t){return t.reduce((e,r)=>(e+=AO[r],e),"")}function IO(t){const e=[];for(const r of t){const n=PO[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const CO=gd({prefix:"🚀",name:"base256emoji",encode:MO,decode:IO}),TO=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:CO},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const gx={...GD,...JD,...ZD,...eO,...nO,...dO,...mO,...yO,...SO,...TO};function mx(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const vx=mx("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),pm=mx("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=hx(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new jO:typeof navigator<"u"?KO(navigator.userAgent):GO()}function WO(t){return t!==""&&zO.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function KO(t){var e=WO(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new FO;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length-1){const D=P.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let k=e.protocol+"//"+e.host;if(D.indexOf("/")===0)k+=D;else{const B=e.pathname.split("/");B.pop();const q=B.join("/");k+=q+"/"+D}y.push(k)}else if(D.indexOf("//")===0){const k=e.protocol+D;y.push(k)}else y.push(D)}}return y}function n(...p){const y=t.getElementsByTagName("meta");for(let A=0;AP.getAttribute(D)).filter(D=>D?p.includes(D):!1);if(O.length&&O){const D=P.getAttribute("content");if(D)return D}}return""}function i(){let p=n("name","og:site_name","og:title","twitter:title");return p||(p=t.title),p}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}Px=vm.getWindowMetadata=oN;var il={},aN=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Ix="%[a-f0-9]{2}",Cx=new RegExp("("+Ix+")|([^%]+?)","gi"),Tx=new RegExp("("+Ix+")+","gi");function bm(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],bm(r),bm(n))}function cN(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(Cx)||[],r=1;r{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},hN=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;sB==null,o=Symbol("encodeFragmentIdentifier");function a(B){switch(B.arrayFormat){case"index":return q=>(j,H)=>{const J=j.length;return H===void 0||B.skipNull&&H===null||B.skipEmptyString&&H===""?j:H===null?[...j,[d(q,B),"[",J,"]"].join("")]:[...j,[d(q,B),"[",d(J,B),"]=",d(H,B)].join("")]};case"bracket":return q=>(j,H)=>H===void 0||B.skipNull&&H===null||B.skipEmptyString&&H===""?j:H===null?[...j,[d(q,B),"[]"].join("")]:[...j,[d(q,B),"[]=",d(H,B)].join("")];case"colon-list-separator":return q=>(j,H)=>H===void 0||B.skipNull&&H===null||B.skipEmptyString&&H===""?j:H===null?[...j,[d(q,B),":list="].join("")]:[...j,[d(q,B),":list=",d(H,B)].join("")];case"comma":case"separator":case"bracket-separator":{const q=B.arrayFormat==="bracket-separator"?"[]=":"=";return j=>(H,J)=>J===void 0||B.skipNull&&J===null||B.skipEmptyString&&J===""?H:(J=J===null?"":J,H.length===0?[[d(j,B),q,d(J,B)].join("")]:[[H,d(J,B)].join(B.arrayFormatSeparator)])}default:return q=>(j,H)=>H===void 0||B.skipNull&&H===null||B.skipEmptyString&&H===""?j:H===null?[...j,d(q,B)]:[...j,[d(q,B),"=",d(H,B)].join("")]}}function u(B){let q;switch(B.arrayFormat){case"index":return(j,H,J)=>{if(q=/\[(\d*)\]$/.exec(j),j=j.replace(/\[\d*\]$/,""),!q){J[j]=H;return}J[j]===void 0&&(J[j]={}),J[j][q[1]]=H};case"bracket":return(j,H,J)=>{if(q=/(\[\])$/.exec(j),j=j.replace(/\[\]$/,""),!q){J[j]=H;return}if(J[j]===void 0){J[j]=[H];return}J[j]=[].concat(J[j],H)};case"colon-list-separator":return(j,H,J)=>{if(q=/(:list)$/.exec(j),j=j.replace(/:list$/,""),!q){J[j]=H;return}if(J[j]===void 0){J[j]=[H];return}J[j]=[].concat(J[j],H)};case"comma":case"separator":return(j,H,J)=>{const T=typeof H=="string"&&H.includes(B.arrayFormatSeparator),z=typeof H=="string"&&!T&&p(H,B).includes(B.arrayFormatSeparator);H=z?p(H,B):H;const ue=T||z?H.split(B.arrayFormatSeparator).map(_e=>p(_e,B)):H===null?H:p(H,B);J[j]=ue};case"bracket-separator":return(j,H,J)=>{const T=/(\[\])$/.test(j);if(j=j.replace(/\[\]$/,""),!T){J[j]=H&&p(H,B);return}const z=H===null?[]:H.split(B.arrayFormatSeparator).map(ue=>p(ue,B));if(J[j]===void 0){J[j]=z;return}J[j]=[].concat(J[j],z)};default:return(j,H,J)=>{if(J[j]===void 0){J[j]=H;return}J[j]=[].concat(J[j],H)}}}function l(B){if(typeof B!="string"||B.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function d(B,q){return q.encode?q.strict?e(B):encodeURIComponent(B):B}function p(B,q){return q.decode?r(B):B}function y(B){return Array.isArray(B)?B.sort():typeof B=="object"?y(Object.keys(B)).sort((q,j)=>Number(q)-Number(j)).map(q=>B[q]):B}function A(B){const q=B.indexOf("#");return q!==-1&&(B=B.slice(0,q)),B}function P(B){let q="";const j=B.indexOf("#");return j!==-1&&(q=B.slice(j)),q}function O(B){B=A(B);const q=B.indexOf("?");return q===-1?"":B.slice(q+1)}function D(B,q){return q.parseNumbers&&!Number.isNaN(Number(B))&&typeof B=="string"&&B.trim()!==""?B=Number(B):q.parseBooleans&&B!==null&&(B.toLowerCase()==="true"||B.toLowerCase()==="false")&&(B=B.toLowerCase()==="true"),B}function k(B,q){q=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},q),l(q.arrayFormatSeparator);const j=u(q),H=Object.create(null);if(typeof B!="string"||(B=B.trim().replace(/^[?#&]/,""),!B))return H;for(const J of B.split("&")){if(J==="")continue;let[T,z]=n(q.decode?J.replace(/\+/g," "):J,"=");z=z===void 0?null:["comma","separator","bracket-separator"].includes(q.arrayFormat)?z:p(z,q),j(p(T,q),z,H)}for(const J of Object.keys(H)){const T=H[J];if(typeof T=="object"&&T!==null)for(const z of Object.keys(T))T[z]=D(T[z],q);else H[J]=D(T,q)}return q.sort===!1?H:(q.sort===!0?Object.keys(H).sort():Object.keys(H).sort(q.sort)).reduce((J,T)=>{const z=H[T];return z&&typeof z=="object"&&!Array.isArray(z)?J[T]=y(z):J[T]=z,J},Object.create(null))}t.extract=O,t.parse=k,t.stringify=(B,q)=>{if(!B)return"";q=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},q),l(q.arrayFormatSeparator);const j=z=>q.skipNull&&s(B[z])||q.skipEmptyString&&B[z]==="",H=a(q),J={};for(const z of Object.keys(B))j(z)||(J[z]=B[z]);const T=Object.keys(J);return q.sort!==!1&&T.sort(q.sort),T.map(z=>{const ue=B[z];return ue===void 0?"":ue===null?d(z,q):Array.isArray(ue)?ue.length===0&&q.arrayFormat==="bracket-separator"?d(z,q)+"[]":ue.reduce(H(z),[]).join("&"):d(z,q)+"="+d(ue,q)}).filter(z=>z.length>0).join("&")},t.parseUrl=(B,q)=>{q=Object.assign({decode:!0},q);const[j,H]=n(B,"#");return Object.assign({url:j.split("?")[0]||"",query:k(O(B),q)},q&&q.parseFragmentIdentifier&&H?{fragmentIdentifier:p(H,q)}:{})},t.stringifyUrl=(B,q)=>{q=Object.assign({encode:!0,strict:!0,[o]:!0},q);const j=A(B.url).split("?")[0]||"",H=t.extract(B.url),J=t.parse(H,{sort:!1}),T=Object.assign(J,B.query);let z=t.stringify(T,q);z&&(z=`?${z}`);let ue=P(B.url);return B.fragmentIdentifier&&(ue=`#${q[o]?d(B.fragmentIdentifier,q):B.fragmentIdentifier}`),`${j}${z}${ue}`},t.pick=(B,q,j)=>{j=Object.assign({parseFragmentIdentifier:!0,[o]:!1},j);const{url:H,query:J,fragmentIdentifier:T}=t.parseUrl(B,j);return t.stringifyUrl({url:H,query:i(J,q),fragmentIdentifier:T},j)},t.exclude=(B,q,j)=>{const H=Array.isArray(q)?J=>!q.includes(J):(J,T)=>!q(J,T);return t.pick(B,H,j)}})(il);var Rx={exports:{}};/** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.8.0 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT - */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=nn:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],p=[4,1024,262144,67108864],y=[1,256,65536,16777216],A=[6,1536,393216,100663296],P=[0,8,16,24],N=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],D=[224,256,384,512],k=[128,256],B=["hex","buffer","arrayBuffer","array","digest"],q={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(O){return Object.prototype.toString.call(O)==="[object Array]"}),u&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(O){return typeof O=="object"&&O.buffer&&O.buffer.constructor===ArrayBuffer});for(var j=function(O,se,ee){return function(X){return new I(O,se,O).update(X)[ee]()}},H=function(O,se,ee){return function(X,Q){return new I(O,se,Q).update(X)[ee]()}},J=function(O,se,ee){return function(X,Q,R,Z){return f["cshake"+O].update(X,Q,R,Z)[ee]()}},T=function(O,se,ee){return function(X,Q,R,Z){return f["kmac"+O].update(X,Q,R,Z)[ee]()}},z=function(O,se,ee,X){for(var Q=0;Q>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ee>>5,this.extraBytes=(ee&31)>>3;for(var X=0;X<50;++X)this.s[X]=0}I.prototype.update=function(O){if(this.finalized)throw new Error(r);var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}for(var X=this.blocks,Q=this.byteCount,R=O.length,Z=this.blockCount,te=0,le=this.s,ie,fe;te>2]|=O[te]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(X[ie>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=Q){for(this.start=ie-Q,this.block=X[Z],ie=0;ie>8,ee=O&255;ee>0;)Q.unshift(ee),O=O>>8,ee=O&255,++X;return se?Q.push(X):Q.unshift(X),this.update(Q),Q.length},I.prototype.encodeString=function(O){var se,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!u||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);se=!0}var X=0,Q=O.length;if(se)X=Q;else for(var R=0;R=57344?X+=3:(Z=65536+((Z&1023)<<10|O.charCodeAt(++R)&1023),X+=4)}return X+=this.encode(X*8),this.update(O),X},I.prototype.bytepad=function(O,se){for(var ee=this.encode(se),X=0;X>2]|=this.padding[se&3],this.lastByteIndex===this.byteCount)for(O[0]=O[ee],se=1;se>4&15]+l[te&15]+l[te>>12&15]+l[te>>8&15]+l[te>>20&15]+l[te>>16&15]+l[te>>28&15]+l[te>>24&15];R%O===0&&(ae(se),Q=0)}return X&&(te=se[Q],Z+=l[te>>4&15]+l[te&15],X>1&&(Z+=l[te>>12&15]+l[te>>8&15]),X>2&&(Z+=l[te>>20&15]+l[te>>16&15])),Z},I.prototype.arrayBuffer=function(){this.finalize();var O=this.blockCount,se=this.s,ee=this.outputBlocks,X=this.extraBytes,Q=0,R=0,Z=this.outputBits>>3,te;X?te=new ArrayBuffer(ee+1<<2):te=new ArrayBuffer(Z);for(var le=new Uint32Array(te);R>8&255,Z[te+2]=le>>16&255,Z[te+3]=le>>24&255;R%O===0&&ae(se)}return X&&(te=R<<2,le=se[Q],Z[te]=le&255,X>1&&(Z[te+1]=le>>8&255),X>2&&(Z[te+2]=le>>16&255)),Z};function F(O,se,ee){I.call(this,O,se,ee)}F.prototype=new I,F.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var ae=function(O){var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me,Ne,Te,$e,Ie,Le,Ve,ke,ze,He,Se,Qe,ct,Be,et,rt,Je,pt,ht,ft,Ht,Jt,St,er,Xt,Ot,Bt,Tt,vt,Dt,Lt,bt,$t,jt,nt,Ft,$,W,V,C,Y,U,oe,pe,xe,Re,De,it,Ue,gt,st,tt;for(X=0;X<48;X+=2)Q=O[0]^O[10]^O[20]^O[30]^O[40],R=O[1]^O[11]^O[21]^O[31]^O[41],Z=O[2]^O[12]^O[22]^O[32]^O[42],te=O[3]^O[13]^O[23]^O[33]^O[43],le=O[4]^O[14]^O[24]^O[34]^O[44],ie=O[5]^O[15]^O[25]^O[35]^O[45],fe=O[6]^O[16]^O[26]^O[36]^O[46],ve=O[7]^O[17]^O[27]^O[37]^O[47],Me=O[8]^O[18]^O[28]^O[38]^O[48],Ne=O[9]^O[19]^O[29]^O[39]^O[49],se=Me^(Z<<1|te>>>31),ee=Ne^(te<<1|Z>>>31),O[0]^=se,O[1]^=ee,O[10]^=se,O[11]^=ee,O[20]^=se,O[21]^=ee,O[30]^=se,O[31]^=ee,O[40]^=se,O[41]^=ee,se=Q^(le<<1|ie>>>31),ee=R^(ie<<1|le>>>31),O[2]^=se,O[3]^=ee,O[12]^=se,O[13]^=ee,O[22]^=se,O[23]^=ee,O[32]^=se,O[33]^=ee,O[42]^=se,O[43]^=ee,se=Z^(fe<<1|ve>>>31),ee=te^(ve<<1|fe>>>31),O[4]^=se,O[5]^=ee,O[14]^=se,O[15]^=ee,O[24]^=se,O[25]^=ee,O[34]^=se,O[35]^=ee,O[44]^=se,O[45]^=ee,se=le^(Me<<1|Ne>>>31),ee=ie^(Ne<<1|Me>>>31),O[6]^=se,O[7]^=ee,O[16]^=se,O[17]^=ee,O[26]^=se,O[27]^=ee,O[36]^=se,O[37]^=ee,O[46]^=se,O[47]^=ee,se=fe^(Q<<1|R>>>31),ee=ve^(R<<1|Q>>>31),O[8]^=se,O[9]^=ee,O[18]^=se,O[19]^=ee,O[28]^=se,O[29]^=ee,O[38]^=se,O[39]^=ee,O[48]^=se,O[49]^=ee,Te=O[0],$e=O[1],nt=O[11]<<4|O[10]>>>28,Ft=O[10]<<4|O[11]>>>28,Je=O[20]<<3|O[21]>>>29,pt=O[21]<<3|O[20]>>>29,Ue=O[31]<<9|O[30]>>>23,gt=O[30]<<9|O[31]>>>23,Lt=O[40]<<18|O[41]>>>14,bt=O[41]<<18|O[40]>>>14,St=O[2]<<1|O[3]>>>31,er=O[3]<<1|O[2]>>>31,Ie=O[13]<<12|O[12]>>>20,Le=O[12]<<12|O[13]>>>20,$=O[22]<<10|O[23]>>>22,W=O[23]<<10|O[22]>>>22,ht=O[33]<<13|O[32]>>>19,ft=O[32]<<13|O[33]>>>19,st=O[42]<<2|O[43]>>>30,tt=O[43]<<2|O[42]>>>30,oe=O[5]<<30|O[4]>>>2,pe=O[4]<<30|O[5]>>>2,Xt=O[14]<<6|O[15]>>>26,Ot=O[15]<<6|O[14]>>>26,Ve=O[25]<<11|O[24]>>>21,ke=O[24]<<11|O[25]>>>21,V=O[34]<<15|O[35]>>>17,C=O[35]<<15|O[34]>>>17,Ht=O[45]<<29|O[44]>>>3,Jt=O[44]<<29|O[45]>>>3,ct=O[6]<<28|O[7]>>>4,Be=O[7]<<28|O[6]>>>4,xe=O[17]<<23|O[16]>>>9,Re=O[16]<<23|O[17]>>>9,Bt=O[26]<<25|O[27]>>>7,Tt=O[27]<<25|O[26]>>>7,ze=O[36]<<21|O[37]>>>11,He=O[37]<<21|O[36]>>>11,Y=O[47]<<24|O[46]>>>8,U=O[46]<<24|O[47]>>>8,$t=O[8]<<27|O[9]>>>5,jt=O[9]<<27|O[8]>>>5,et=O[18]<<20|O[19]>>>12,rt=O[19]<<20|O[18]>>>12,De=O[29]<<7|O[28]>>>25,it=O[28]<<7|O[29]>>>25,vt=O[38]<<8|O[39]>>>24,Dt=O[39]<<8|O[38]>>>24,Se=O[48]<<14|O[49]>>>18,Qe=O[49]<<14|O[48]>>>18,O[0]=Te^~Ie&Ve,O[1]=$e^~Le&ke,O[10]=ct^~et&Je,O[11]=Be^~rt&pt,O[20]=St^~Xt&Bt,O[21]=er^~Ot&Tt,O[30]=$t^~nt&$,O[31]=jt^~Ft&W,O[40]=oe^~xe&De,O[41]=pe^~Re&it,O[2]=Ie^~Ve&ze,O[3]=Le^~ke&He,O[12]=et^~Je&ht,O[13]=rt^~pt&ft,O[22]=Xt^~Bt&vt,O[23]=Ot^~Tt&Dt,O[32]=nt^~$&V,O[33]=Ft^~W&C,O[42]=xe^~De&Ue,O[43]=Re^~it>,O[4]=Ve^~ze&Se,O[5]=ke^~He&Qe,O[14]=Je^~ht&Ht,O[15]=pt^~ft&Jt,O[24]=Bt^~vt&Lt,O[25]=Tt^~Dt&bt,O[34]=$^~V&Y,O[35]=W^~C&U,O[44]=De^~Ue&st,O[45]=it^~gt&tt,O[6]=ze^~Se&Te,O[7]=He^~Qe&$e,O[16]=ht^~Ht&ct,O[17]=ft^~Jt&Be,O[26]=vt^~Lt&St,O[27]=Dt^~bt&er,O[36]=V^~Y&$t,O[37]=C^~U&jt,O[46]=Ue^~st&oe,O[47]=gt^~tt&pe,O[8]=Se^~Te&Ie,O[9]=Qe^~$e&Le,O[18]=Ht^~ct&et,O[19]=Jt^~Be&rt,O[28]=Lt^~St&Xt,O[29]=bt^~er&Ot,O[38]=Y^~$t&nt,O[39]=U^~jt&Ft,O[48]=st^~oe&xe,O[49]=tt^~pe&Re,O[0]^=N[X],O[1]^=N[X+1]};if(a)t.exports=f;else for(v=0;v{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const kx=mN();var wm;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(wm||(wm={}));var ps;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(ps||(ps={}));const Bx="0123456789abcdef";class Kr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();vd[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Lx>vd[n])&&console.log.apply(console,r)}debug(...e){this._log(Kr.levels.DEBUG,e)}info(...e){this._log(Kr.levels.INFO,e)}warn(...e){this._log(Kr.levels.WARNING,e)}makeError(e,r,n){if(Nx)return this.makeError("censored error",r,{});r||(r=Kr.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(u=>{const l=n[u];try{if(l instanceof Uint8Array){let d="";for(let p=0;p>4],d+=Bx[l[p]&15];i.push(u+"=Uint8Array(0x"+d+")")}else i.push(u+"="+JSON.stringify(l))}catch{i.push(u+"="+JSON.stringify(n[u].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case ps.NUMERIC_FAULT:{o="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case ps.CALL_EXCEPTION:case ps.INSUFFICIENT_FUNDS:case ps.MISSING_NEW:case ps.NONCE_EXPIRED:case ps.REPLACEMENT_UNDERPRICED:case ps.TRANSACTION_REPLACED:case ps.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(u){a[u]=n[u]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Kr.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){kx&&this.throwError("platform missing String.prototype.normalize",Kr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:kx})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Kr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Kr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return ym||(ym=new Kr(gN)),ym}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Ox){if(!e)return;this.globalLogger().throwError("error censorship permanent",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Nx=!!e,Ox=!!r}static setLogLevel(e){const r=vd[e.toLowerCase()];if(r==null){Kr.globalLogger().warn("invalid log level - "+e);return}Lx=r}static from(e){return new Kr(e)}}Kr.errors=ps,Kr.levels=wm;const vN="bytes/5.7.0",on=new Kr(vN);function $x(t){return!!t.toHexString}function fu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return fu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function bN(t){return Ns(t)&&!(t.length%2)||xm(t)}function Fx(t){return typeof t=="number"&&t==t&&t%1===0}function xm(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!Fx(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function bn(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),fu(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),$x(t)&&(t=t.toHexString()),Ns(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":on.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ibn(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),fu(n)}function wN(t,e){t=bn(t),t.length>e&&on.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),fu(r)}function Ns(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const _m="0123456789abcdef";function Ii(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=_m[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),$x(t))return t.toHexString();if(Ns(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":on.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(xm(t)){let r="0x";for(let n=0;n>4]+_m[i&15]}return r}return on.throwArgumentError("invalid hexlify value","value",t)}function xN(t){if(typeof t!="string")t=Ii(t);else if(!Ns(t)||t.length%2)return null;return(t.length-2)/2}function jx(t,e,r){return typeof t!="string"?t=Ii(t):(!Ns(t)||t.length%2)&&on.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function lu(t,e){for(typeof t!="string"?t=Ii(t):Ns(t)||on.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&on.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Ux(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(bN(t)){let r=bn(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64))):r.length===65?(e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64)),e.v=r[64]):on.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:on.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Ii(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=wN(bn(e._vs),32);e._vs=Ii(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&on.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=Ii(i);e.s==null?e.s=o:e.s!==o&&on.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?on.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&on.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Ns(e.r)?on.throwArgumentError("signature missing or invalid r","signature",t):e.r=lu(e.r,32),e.s==null||!Ns(e.s)?on.throwArgumentError("signature missing or invalid s","signature",t):e.s=lu(e.s,32);const r=bn(e.s);r[0]>=128&&on.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=Ii(r);e._vs&&(Ns(e._vs)||on.throwArgumentError("signature invalid _vs","signature",t),e._vs=lu(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&on.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Em(t){return"0x"+pN.keccak_256(bn(t))}var Sm={exports:{}};Sm.exports,function(t){(function(e,r){function n(m,f){if(!m)throw new Error(f||"Assertion failed")}function i(m,f){m.super_=f;var g=function(){};g.prototype=f.prototype,m.prototype=new g,m.prototype.constructor=m}function s(m,f,g){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((f==="le"||f==="be")&&(g=f,f=10),this._init(m||0,f||10,g||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,g){return f.cmp(g)>0?f:g},s.min=function(f,g){return f.cmp(g)<0?f:g},s.prototype._init=function(f,g,v){if(typeof f=="number")return this._initNumber(f,g,v);if(typeof f=="object")return this._initArray(f,g,v);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),f=f.toString().replace(/\s+/g,"");var x=0;f[0]==="-"&&(x++,this.negative=1),x=0;x-=3)S=f[x]|f[x-1]<<8|f[x-2]<<16,this.words[_]|=S<>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);else if(v==="le")for(x=0,_=0;x>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);return this._strip()};function a(m,f){var g=m.charCodeAt(f);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+m)}function u(m,f,g){var v=a(m,g);return g-1>=f&&(v|=a(m,g-1)<<4),v}s.prototype._parseHex=function(f,g,v){this.length=Math.ceil((f.length-g)/6),this.words=new Array(this.length);for(var x=0;x=g;x-=2)b=u(f,g,x)<<_,this.words[S]|=b&67108863,_>=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8;else{var M=f.length-g;for(x=M%2===0?g+1:g;x=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8}this._strip()};function l(m,f,g,v){for(var x=0,_=0,S=Math.min(m.length,g),b=f;b=49?_=M-49+10:M>=17?_=M-17+10:_=M,n(M>=0&&_1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{s.prototype.inspect=p}else s.prototype.inspect=p;function p(){return(this.red?""}var y=["","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"],A=[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,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(f,g){f=f||10,g=g|0||1;var v;if(f===16||f==="hex"){v="";for(var x=0,_=0,S=0;S>>24-x&16777215,x+=2,x>=26&&(x-=26,S--),_!==0||S!==this.length-1?v=y[6-M.length]+M+v:v=M+v}for(_!==0&&(v=_.toString(16)+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(f===(f|0)&&f>=2&&f<=36){var I=A[f],F=P[f];v="";var ae=this.clone();for(ae.negative=0;!ae.isZero();){var O=ae.modrn(F).toString(f);ae=ae.idivn(F),ae.isZero()?v=O+v:v=y[I-O.length]+O+v}for(this.isZero()&&(v="0"+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,g){return this.toArrayLike(o,f,g)}),s.prototype.toArray=function(f,g){return this.toArrayLike(Array,f,g)};var N=function(f,g){return f.allocUnsafe?f.allocUnsafe(g):new f(g)};s.prototype.toArrayLike=function(f,g,v){this._strip();var x=this.byteLength(),_=v||Math.max(1,x);n(x<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var S=N(f,_),b=g==="le"?"LE":"BE";return this["_toArrayLike"+b](S,x),S},s.prototype._toArrayLikeLE=function(f,g){for(var v=0,x=0,_=0,S=0;_>8&255),v>16&255),S===6?(v>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v=0&&(f[v--]=b>>8&255),v>=0&&(f[v--]=b>>16&255),S===6?(v>=0&&(f[v--]=b>>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v>=0)for(f[v--]=x;v>=0;)f[v--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var g=f,v=0;return g>=4096&&(v+=13,g>>>=13),g>=64&&(v+=7,g>>>=7),g>=8&&(v+=4,g>>>=4),g>=2&&(v+=2,g>>>=2),v+g},s.prototype._zeroBits=function(f){if(f===0)return 26;var g=f,v=0;return g&8191||(v+=13,g>>>=13),g&127||(v+=7,g>>>=7),g&15||(v+=4,g>>>=4),g&3||(v+=2,g>>>=2),g&1||v++,v},s.prototype.bitLength=function(){var f=this.words[this.length-1],g=this._countBits(f);return(this.length-1)*26+g};function D(m){for(var f=new Array(m.bitLength()),g=0;g>>x&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,g=0;gf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var g;this.length>f.length?g=f:g=this;for(var v=0;vf.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var g,v;this.length>f.length?(g=this,v=f):(g=f,v=this);for(var x=0;xf.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var g=Math.ceil(f/26)|0,v=f%26;this._expand(g),v>0&&g--;for(var x=0;x0&&(this.words[x]=~this.words[x]&67108863>>26-v),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,g){n(typeof f=="number"&&f>=0);var v=f/26|0,x=f%26;return this._expand(v+1),g?this.words[v]=this.words[v]|1<f.length?(v=this,x=f):(v=f,x=this);for(var _=0,S=0;S>>26;for(;_!==0&&S>>26;if(this.length=v.length,_!==0)this.words[this.length]=_,this.length++;else if(v!==this)for(;Sf.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var g=this.iadd(f);return f.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var v=this.cmp(f);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,_;v>0?(x=this,_=f):(x=f,_=this);for(var S=0,b=0;b<_.length;b++)g=(x.words[b]|0)-(_.words[b]|0)+S,S=g>>26,this.words[b]=g&67108863;for(;S!==0&&b>26,this.words[b]=g&67108863;if(S===0&&b>>26,ae=M&67108863,O=Math.min(I,f.length-1),se=Math.max(0,I-m.length+1);se<=O;se++){var ee=I-se|0;x=m.words[ee]|0,_=f.words[se]|0,S=x*_+ae,F+=S/67108864|0,ae=S&67108863}g.words[I]=ae|0,M=F|0}return M!==0?g.words[I]=M|0:g.length--,g._strip()}var B=function(f,g,v){var x=f.words,_=g.words,S=v.words,b=0,M,I,F,ae=x[0]|0,O=ae&8191,se=ae>>>13,ee=x[1]|0,X=ee&8191,Q=ee>>>13,R=x[2]|0,Z=R&8191,te=R>>>13,le=x[3]|0,ie=le&8191,fe=le>>>13,ve=x[4]|0,Me=ve&8191,Ne=ve>>>13,Te=x[5]|0,$e=Te&8191,Ie=Te>>>13,Le=x[6]|0,Ve=Le&8191,ke=Le>>>13,ze=x[7]|0,He=ze&8191,Se=ze>>>13,Qe=x[8]|0,ct=Qe&8191,Be=Qe>>>13,et=x[9]|0,rt=et&8191,Je=et>>>13,pt=_[0]|0,ht=pt&8191,ft=pt>>>13,Ht=_[1]|0,Jt=Ht&8191,St=Ht>>>13,er=_[2]|0,Xt=er&8191,Ot=er>>>13,Bt=_[3]|0,Tt=Bt&8191,vt=Bt>>>13,Dt=_[4]|0,Lt=Dt&8191,bt=Dt>>>13,$t=_[5]|0,jt=$t&8191,nt=$t>>>13,Ft=_[6]|0,$=Ft&8191,W=Ft>>>13,V=_[7]|0,C=V&8191,Y=V>>>13,U=_[8]|0,oe=U&8191,pe=U>>>13,xe=_[9]|0,Re=xe&8191,De=xe>>>13;v.negative=f.negative^g.negative,v.length=19,M=Math.imul(O,ht),I=Math.imul(O,ft),I=I+Math.imul(se,ht)|0,F=Math.imul(se,ft);var it=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(it>>>26)|0,it&=67108863,M=Math.imul(X,ht),I=Math.imul(X,ft),I=I+Math.imul(Q,ht)|0,F=Math.imul(Q,ft),M=M+Math.imul(O,Jt)|0,I=I+Math.imul(O,St)|0,I=I+Math.imul(se,Jt)|0,F=F+Math.imul(se,St)|0;var Ue=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,M=Math.imul(Z,ht),I=Math.imul(Z,ft),I=I+Math.imul(te,ht)|0,F=Math.imul(te,ft),M=M+Math.imul(X,Jt)|0,I=I+Math.imul(X,St)|0,I=I+Math.imul(Q,Jt)|0,F=F+Math.imul(Q,St)|0,M=M+Math.imul(O,Xt)|0,I=I+Math.imul(O,Ot)|0,I=I+Math.imul(se,Xt)|0,F=F+Math.imul(se,Ot)|0;var gt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(gt>>>26)|0,gt&=67108863,M=Math.imul(ie,ht),I=Math.imul(ie,ft),I=I+Math.imul(fe,ht)|0,F=Math.imul(fe,ft),M=M+Math.imul(Z,Jt)|0,I=I+Math.imul(Z,St)|0,I=I+Math.imul(te,Jt)|0,F=F+Math.imul(te,St)|0,M=M+Math.imul(X,Xt)|0,I=I+Math.imul(X,Ot)|0,I=I+Math.imul(Q,Xt)|0,F=F+Math.imul(Q,Ot)|0,M=M+Math.imul(O,Tt)|0,I=I+Math.imul(O,vt)|0,I=I+Math.imul(se,Tt)|0,F=F+Math.imul(se,vt)|0;var st=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(st>>>26)|0,st&=67108863,M=Math.imul(Me,ht),I=Math.imul(Me,ft),I=I+Math.imul(Ne,ht)|0,F=Math.imul(Ne,ft),M=M+Math.imul(ie,Jt)|0,I=I+Math.imul(ie,St)|0,I=I+Math.imul(fe,Jt)|0,F=F+Math.imul(fe,St)|0,M=M+Math.imul(Z,Xt)|0,I=I+Math.imul(Z,Ot)|0,I=I+Math.imul(te,Xt)|0,F=F+Math.imul(te,Ot)|0,M=M+Math.imul(X,Tt)|0,I=I+Math.imul(X,vt)|0,I=I+Math.imul(Q,Tt)|0,F=F+Math.imul(Q,vt)|0,M=M+Math.imul(O,Lt)|0,I=I+Math.imul(O,bt)|0,I=I+Math.imul(se,Lt)|0,F=F+Math.imul(se,bt)|0;var tt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(tt>>>26)|0,tt&=67108863,M=Math.imul($e,ht),I=Math.imul($e,ft),I=I+Math.imul(Ie,ht)|0,F=Math.imul(Ie,ft),M=M+Math.imul(Me,Jt)|0,I=I+Math.imul(Me,St)|0,I=I+Math.imul(Ne,Jt)|0,F=F+Math.imul(Ne,St)|0,M=M+Math.imul(ie,Xt)|0,I=I+Math.imul(ie,Ot)|0,I=I+Math.imul(fe,Xt)|0,F=F+Math.imul(fe,Ot)|0,M=M+Math.imul(Z,Tt)|0,I=I+Math.imul(Z,vt)|0,I=I+Math.imul(te,Tt)|0,F=F+Math.imul(te,vt)|0,M=M+Math.imul(X,Lt)|0,I=I+Math.imul(X,bt)|0,I=I+Math.imul(Q,Lt)|0,F=F+Math.imul(Q,bt)|0,M=M+Math.imul(O,jt)|0,I=I+Math.imul(O,nt)|0,I=I+Math.imul(se,jt)|0,F=F+Math.imul(se,nt)|0;var At=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(At>>>26)|0,At&=67108863,M=Math.imul(Ve,ht),I=Math.imul(Ve,ft),I=I+Math.imul(ke,ht)|0,F=Math.imul(ke,ft),M=M+Math.imul($e,Jt)|0,I=I+Math.imul($e,St)|0,I=I+Math.imul(Ie,Jt)|0,F=F+Math.imul(Ie,St)|0,M=M+Math.imul(Me,Xt)|0,I=I+Math.imul(Me,Ot)|0,I=I+Math.imul(Ne,Xt)|0,F=F+Math.imul(Ne,Ot)|0,M=M+Math.imul(ie,Tt)|0,I=I+Math.imul(ie,vt)|0,I=I+Math.imul(fe,Tt)|0,F=F+Math.imul(fe,vt)|0,M=M+Math.imul(Z,Lt)|0,I=I+Math.imul(Z,bt)|0,I=I+Math.imul(te,Lt)|0,F=F+Math.imul(te,bt)|0,M=M+Math.imul(X,jt)|0,I=I+Math.imul(X,nt)|0,I=I+Math.imul(Q,jt)|0,F=F+Math.imul(Q,nt)|0,M=M+Math.imul(O,$)|0,I=I+Math.imul(O,W)|0,I=I+Math.imul(se,$)|0,F=F+Math.imul(se,W)|0;var Rt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,M=Math.imul(He,ht),I=Math.imul(He,ft),I=I+Math.imul(Se,ht)|0,F=Math.imul(Se,ft),M=M+Math.imul(Ve,Jt)|0,I=I+Math.imul(Ve,St)|0,I=I+Math.imul(ke,Jt)|0,F=F+Math.imul(ke,St)|0,M=M+Math.imul($e,Xt)|0,I=I+Math.imul($e,Ot)|0,I=I+Math.imul(Ie,Xt)|0,F=F+Math.imul(Ie,Ot)|0,M=M+Math.imul(Me,Tt)|0,I=I+Math.imul(Me,vt)|0,I=I+Math.imul(Ne,Tt)|0,F=F+Math.imul(Ne,vt)|0,M=M+Math.imul(ie,Lt)|0,I=I+Math.imul(ie,bt)|0,I=I+Math.imul(fe,Lt)|0,F=F+Math.imul(fe,bt)|0,M=M+Math.imul(Z,jt)|0,I=I+Math.imul(Z,nt)|0,I=I+Math.imul(te,jt)|0,F=F+Math.imul(te,nt)|0,M=M+Math.imul(X,$)|0,I=I+Math.imul(X,W)|0,I=I+Math.imul(Q,$)|0,F=F+Math.imul(Q,W)|0,M=M+Math.imul(O,C)|0,I=I+Math.imul(O,Y)|0,I=I+Math.imul(se,C)|0,F=F+Math.imul(se,Y)|0;var Mt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,M=Math.imul(ct,ht),I=Math.imul(ct,ft),I=I+Math.imul(Be,ht)|0,F=Math.imul(Be,ft),M=M+Math.imul(He,Jt)|0,I=I+Math.imul(He,St)|0,I=I+Math.imul(Se,Jt)|0,F=F+Math.imul(Se,St)|0,M=M+Math.imul(Ve,Xt)|0,I=I+Math.imul(Ve,Ot)|0,I=I+Math.imul(ke,Xt)|0,F=F+Math.imul(ke,Ot)|0,M=M+Math.imul($e,Tt)|0,I=I+Math.imul($e,vt)|0,I=I+Math.imul(Ie,Tt)|0,F=F+Math.imul(Ie,vt)|0,M=M+Math.imul(Me,Lt)|0,I=I+Math.imul(Me,bt)|0,I=I+Math.imul(Ne,Lt)|0,F=F+Math.imul(Ne,bt)|0,M=M+Math.imul(ie,jt)|0,I=I+Math.imul(ie,nt)|0,I=I+Math.imul(fe,jt)|0,F=F+Math.imul(fe,nt)|0,M=M+Math.imul(Z,$)|0,I=I+Math.imul(Z,W)|0,I=I+Math.imul(te,$)|0,F=F+Math.imul(te,W)|0,M=M+Math.imul(X,C)|0,I=I+Math.imul(X,Y)|0,I=I+Math.imul(Q,C)|0,F=F+Math.imul(Q,Y)|0,M=M+Math.imul(O,oe)|0,I=I+Math.imul(O,pe)|0,I=I+Math.imul(se,oe)|0,F=F+Math.imul(se,pe)|0;var Et=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Et>>>26)|0,Et&=67108863,M=Math.imul(rt,ht),I=Math.imul(rt,ft),I=I+Math.imul(Je,ht)|0,F=Math.imul(Je,ft),M=M+Math.imul(ct,Jt)|0,I=I+Math.imul(ct,St)|0,I=I+Math.imul(Be,Jt)|0,F=F+Math.imul(Be,St)|0,M=M+Math.imul(He,Xt)|0,I=I+Math.imul(He,Ot)|0,I=I+Math.imul(Se,Xt)|0,F=F+Math.imul(Se,Ot)|0,M=M+Math.imul(Ve,Tt)|0,I=I+Math.imul(Ve,vt)|0,I=I+Math.imul(ke,Tt)|0,F=F+Math.imul(ke,vt)|0,M=M+Math.imul($e,Lt)|0,I=I+Math.imul($e,bt)|0,I=I+Math.imul(Ie,Lt)|0,F=F+Math.imul(Ie,bt)|0,M=M+Math.imul(Me,jt)|0,I=I+Math.imul(Me,nt)|0,I=I+Math.imul(Ne,jt)|0,F=F+Math.imul(Ne,nt)|0,M=M+Math.imul(ie,$)|0,I=I+Math.imul(ie,W)|0,I=I+Math.imul(fe,$)|0,F=F+Math.imul(fe,W)|0,M=M+Math.imul(Z,C)|0,I=I+Math.imul(Z,Y)|0,I=I+Math.imul(te,C)|0,F=F+Math.imul(te,Y)|0,M=M+Math.imul(X,oe)|0,I=I+Math.imul(X,pe)|0,I=I+Math.imul(Q,oe)|0,F=F+Math.imul(Q,pe)|0,M=M+Math.imul(O,Re)|0,I=I+Math.imul(O,De)|0,I=I+Math.imul(se,Re)|0,F=F+Math.imul(se,De)|0;var dt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(dt>>>26)|0,dt&=67108863,M=Math.imul(rt,Jt),I=Math.imul(rt,St),I=I+Math.imul(Je,Jt)|0,F=Math.imul(Je,St),M=M+Math.imul(ct,Xt)|0,I=I+Math.imul(ct,Ot)|0,I=I+Math.imul(Be,Xt)|0,F=F+Math.imul(Be,Ot)|0,M=M+Math.imul(He,Tt)|0,I=I+Math.imul(He,vt)|0,I=I+Math.imul(Se,Tt)|0,F=F+Math.imul(Se,vt)|0,M=M+Math.imul(Ve,Lt)|0,I=I+Math.imul(Ve,bt)|0,I=I+Math.imul(ke,Lt)|0,F=F+Math.imul(ke,bt)|0,M=M+Math.imul($e,jt)|0,I=I+Math.imul($e,nt)|0,I=I+Math.imul(Ie,jt)|0,F=F+Math.imul(Ie,nt)|0,M=M+Math.imul(Me,$)|0,I=I+Math.imul(Me,W)|0,I=I+Math.imul(Ne,$)|0,F=F+Math.imul(Ne,W)|0,M=M+Math.imul(ie,C)|0,I=I+Math.imul(ie,Y)|0,I=I+Math.imul(fe,C)|0,F=F+Math.imul(fe,Y)|0,M=M+Math.imul(Z,oe)|0,I=I+Math.imul(Z,pe)|0,I=I+Math.imul(te,oe)|0,F=F+Math.imul(te,pe)|0,M=M+Math.imul(X,Re)|0,I=I+Math.imul(X,De)|0,I=I+Math.imul(Q,Re)|0,F=F+Math.imul(Q,De)|0;var _t=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(_t>>>26)|0,_t&=67108863,M=Math.imul(rt,Xt),I=Math.imul(rt,Ot),I=I+Math.imul(Je,Xt)|0,F=Math.imul(Je,Ot),M=M+Math.imul(ct,Tt)|0,I=I+Math.imul(ct,vt)|0,I=I+Math.imul(Be,Tt)|0,F=F+Math.imul(Be,vt)|0,M=M+Math.imul(He,Lt)|0,I=I+Math.imul(He,bt)|0,I=I+Math.imul(Se,Lt)|0,F=F+Math.imul(Se,bt)|0,M=M+Math.imul(Ve,jt)|0,I=I+Math.imul(Ve,nt)|0,I=I+Math.imul(ke,jt)|0,F=F+Math.imul(ke,nt)|0,M=M+Math.imul($e,$)|0,I=I+Math.imul($e,W)|0,I=I+Math.imul(Ie,$)|0,F=F+Math.imul(Ie,W)|0,M=M+Math.imul(Me,C)|0,I=I+Math.imul(Me,Y)|0,I=I+Math.imul(Ne,C)|0,F=F+Math.imul(Ne,Y)|0,M=M+Math.imul(ie,oe)|0,I=I+Math.imul(ie,pe)|0,I=I+Math.imul(fe,oe)|0,F=F+Math.imul(fe,pe)|0,M=M+Math.imul(Z,Re)|0,I=I+Math.imul(Z,De)|0,I=I+Math.imul(te,Re)|0,F=F+Math.imul(te,De)|0;var ot=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(ot>>>26)|0,ot&=67108863,M=Math.imul(rt,Tt),I=Math.imul(rt,vt),I=I+Math.imul(Je,Tt)|0,F=Math.imul(Je,vt),M=M+Math.imul(ct,Lt)|0,I=I+Math.imul(ct,bt)|0,I=I+Math.imul(Be,Lt)|0,F=F+Math.imul(Be,bt)|0,M=M+Math.imul(He,jt)|0,I=I+Math.imul(He,nt)|0,I=I+Math.imul(Se,jt)|0,F=F+Math.imul(Se,nt)|0,M=M+Math.imul(Ve,$)|0,I=I+Math.imul(Ve,W)|0,I=I+Math.imul(ke,$)|0,F=F+Math.imul(ke,W)|0,M=M+Math.imul($e,C)|0,I=I+Math.imul($e,Y)|0,I=I+Math.imul(Ie,C)|0,F=F+Math.imul(Ie,Y)|0,M=M+Math.imul(Me,oe)|0,I=I+Math.imul(Me,pe)|0,I=I+Math.imul(Ne,oe)|0,F=F+Math.imul(Ne,pe)|0,M=M+Math.imul(ie,Re)|0,I=I+Math.imul(ie,De)|0,I=I+Math.imul(fe,Re)|0,F=F+Math.imul(fe,De)|0;var wt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(wt>>>26)|0,wt&=67108863,M=Math.imul(rt,Lt),I=Math.imul(rt,bt),I=I+Math.imul(Je,Lt)|0,F=Math.imul(Je,bt),M=M+Math.imul(ct,jt)|0,I=I+Math.imul(ct,nt)|0,I=I+Math.imul(Be,jt)|0,F=F+Math.imul(Be,nt)|0,M=M+Math.imul(He,$)|0,I=I+Math.imul(He,W)|0,I=I+Math.imul(Se,$)|0,F=F+Math.imul(Se,W)|0,M=M+Math.imul(Ve,C)|0,I=I+Math.imul(Ve,Y)|0,I=I+Math.imul(ke,C)|0,F=F+Math.imul(ke,Y)|0,M=M+Math.imul($e,oe)|0,I=I+Math.imul($e,pe)|0,I=I+Math.imul(Ie,oe)|0,F=F+Math.imul(Ie,pe)|0,M=M+Math.imul(Me,Re)|0,I=I+Math.imul(Me,De)|0,I=I+Math.imul(Ne,Re)|0,F=F+Math.imul(Ne,De)|0;var lt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(lt>>>26)|0,lt&=67108863,M=Math.imul(rt,jt),I=Math.imul(rt,nt),I=I+Math.imul(Je,jt)|0,F=Math.imul(Je,nt),M=M+Math.imul(ct,$)|0,I=I+Math.imul(ct,W)|0,I=I+Math.imul(Be,$)|0,F=F+Math.imul(Be,W)|0,M=M+Math.imul(He,C)|0,I=I+Math.imul(He,Y)|0,I=I+Math.imul(Se,C)|0,F=F+Math.imul(Se,Y)|0,M=M+Math.imul(Ve,oe)|0,I=I+Math.imul(Ve,pe)|0,I=I+Math.imul(ke,oe)|0,F=F+Math.imul(ke,pe)|0,M=M+Math.imul($e,Re)|0,I=I+Math.imul($e,De)|0,I=I+Math.imul(Ie,Re)|0,F=F+Math.imul(Ie,De)|0;var at=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(at>>>26)|0,at&=67108863,M=Math.imul(rt,$),I=Math.imul(rt,W),I=I+Math.imul(Je,$)|0,F=Math.imul(Je,W),M=M+Math.imul(ct,C)|0,I=I+Math.imul(ct,Y)|0,I=I+Math.imul(Be,C)|0,F=F+Math.imul(Be,Y)|0,M=M+Math.imul(He,oe)|0,I=I+Math.imul(He,pe)|0,I=I+Math.imul(Se,oe)|0,F=F+Math.imul(Se,pe)|0,M=M+Math.imul(Ve,Re)|0,I=I+Math.imul(Ve,De)|0,I=I+Math.imul(ke,Re)|0,F=F+Math.imul(ke,De)|0;var Ae=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,M=Math.imul(rt,C),I=Math.imul(rt,Y),I=I+Math.imul(Je,C)|0,F=Math.imul(Je,Y),M=M+Math.imul(ct,oe)|0,I=I+Math.imul(ct,pe)|0,I=I+Math.imul(Be,oe)|0,F=F+Math.imul(Be,pe)|0,M=M+Math.imul(He,Re)|0,I=I+Math.imul(He,De)|0,I=I+Math.imul(Se,Re)|0,F=F+Math.imul(Se,De)|0;var Pe=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,M=Math.imul(rt,oe),I=Math.imul(rt,pe),I=I+Math.imul(Je,oe)|0,F=Math.imul(Je,pe),M=M+Math.imul(ct,Re)|0,I=I+Math.imul(ct,De)|0,I=I+Math.imul(Be,Re)|0,F=F+Math.imul(Be,De)|0;var Ge=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,M=Math.imul(rt,Re),I=Math.imul(rt,De),I=I+Math.imul(Je,Re)|0,F=Math.imul(Je,De);var je=(b+M|0)+((I&8191)<<13)|0;return b=(F+(I>>>13)|0)+(je>>>26)|0,je&=67108863,S[0]=it,S[1]=Ue,S[2]=gt,S[3]=st,S[4]=tt,S[5]=At,S[6]=Rt,S[7]=Mt,S[8]=Et,S[9]=dt,S[10]=_t,S[11]=ot,S[12]=wt,S[13]=lt,S[14]=at,S[15]=Ae,S[16]=Pe,S[17]=Ge,S[18]=je,b!==0&&(S[19]=b,v.length++),v};Math.imul||(B=k);function q(m,f,g){g.negative=f.negative^m.negative,g.length=m.length+f.length;for(var v=0,x=0,_=0;_>>26)|0,x+=S>>>26,S&=67108863}g.words[_]=b,v=S,S=x}return v!==0?g.words[_]=v:g.length--,g._strip()}function j(m,f,g){return q(m,f,g)}s.prototype.mulTo=function(f,g){var v,x=this.length+f.length;return this.length===10&&f.length===10?v=B(this,f,g):x<63?v=k(this,f,g):x<1024?v=q(this,f,g):v=j(this,f,g),v},s.prototype.mul=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),this.mulTo(f,g)},s.prototype.mulf=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),j(this,f,g)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var g=f<0;g&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var v=0,x=0;x>=26,v+=_/67108864|0,v+=S>>>26,this.words[x]=S&67108863}return v!==0&&(this.words[x]=v,this.length++),g?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var g=D(f);if(g.length===0)return new s(1);for(var v=this,x=0;x=0);var g=f%26,v=(f-g)/26,x=67108863>>>26-g<<26-g,_;if(g!==0){var S=0;for(_=0;_>>26-g}S&&(this.words[_]=S,this.length++)}if(v!==0){for(_=this.length-1;_>=0;_--)this.words[_+v]=this.words[_];for(_=0;_=0);var x;g?x=(g-g%26)/26:x=0;var _=f%26,S=Math.min((f-_)/26,this.length),b=67108863^67108863>>>_<<_,M=v;if(x-=S,x=Math.max(0,x),M){for(var I=0;IS)for(this.length-=S,I=0;I=0&&(F!==0||I>=x);I--){var ae=this.words[I]|0;this.words[I]=F<<26-_|ae>>>_,F=ae&b}return M&&F!==0&&(M.words[M.length++]=F),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,g,v){return n(this.negative===0),this.iushrn(f,g,v)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var g=f%26,v=(f-g)/26,x=1<=0);var g=f%26,v=(f-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(g!==0&&v++,this.length=Math.min(v,this.length),g!==0){var x=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(M/67108864|0),this.words[_+v]=S&67108863}for(;_>26,this.words[_+v]=S&67108863;if(b===0)return this._strip();for(n(b===-1),b=0,_=0;_>26,this.words[_]=S&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,g){var v=this.length-f.length,x=this.clone(),_=f,S=_.words[_.length-1]|0,b=this._countBits(S);v=26-b,v!==0&&(_=_.ushln(v),x.iushln(v),S=_.words[_.length-1]|0);var M=x.length-_.length,I;if(g!=="mod"){I=new s(null),I.length=M+1,I.words=new Array(I.length);for(var F=0;F=0;O--){var se=(x.words[_.length+O]|0)*67108864+(x.words[_.length+O-1]|0);for(se=Math.min(se/S|0,67108863),x._ishlnsubmul(_,se,O);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(_,1,O),x.isZero()||(x.negative^=1);I&&(I.words[O]=se)}return I&&I._strip(),x._strip(),g!=="div"&&v!==0&&x.iushrn(v),{div:I||null,mod:x}},s.prototype.divmod=function(f,g,v){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,_,S;return this.negative!==0&&f.negative===0?(S=this.neg().divmod(f,g),g!=="mod"&&(x=S.div.neg()),g!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.iadd(f)),{div:x,mod:_}):this.negative===0&&f.negative!==0?(S=this.divmod(f.neg(),g),g!=="mod"&&(x=S.div.neg()),{div:x,mod:S.mod}):this.negative&f.negative?(S=this.neg().divmod(f.neg(),g),g!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.isub(f)),{div:S.div,mod:_}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?g==="div"?{div:this.divn(f.words[0]),mod:null}:g==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,g)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var g=this.divmod(f);if(g.mod.isZero())return g.div;var v=g.div.negative!==0?g.mod.isub(f):g.mod,x=f.ushrn(1),_=f.andln(1),S=v.cmp(x);return S<0||_===1&&S===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},s.prototype.modrn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=(1<<26)%f,x=0,_=this.length-1;_>=0;_--)x=(v*x+(this.words[_]|0))%f;return g?-x:x},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=0,x=this.length-1;x>=0;x--){var _=(this.words[x]|0)+v*67108864;this.words[x]=_/f|0,v=_%f}return this._strip(),g?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),_=new s(0),S=new s(0),b=new s(1),M=0;g.isEven()&&v.isEven();)g.iushrn(1),v.iushrn(1),++M;for(var I=v.clone(),F=g.clone();!g.isZero();){for(var ae=0,O=1;!(g.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(g.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(I),_.isub(F)),x.iushrn(1),_.iushrn(1);for(var se=0,ee=1;!(v.words[0]&ee)&&se<26;++se,ee<<=1);if(se>0)for(v.iushrn(se);se-- >0;)(S.isOdd()||b.isOdd())&&(S.iadd(I),b.isub(F)),S.iushrn(1),b.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(S),_.isub(b)):(v.isub(g),S.isub(x),b.isub(_))}return{a:S,b,gcd:v.iushln(M)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),_=new s(0),S=v.clone();g.cmpn(1)>0&&v.cmpn(1)>0;){for(var b=0,M=1;!(g.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(g.iushrn(b);b-- >0;)x.isOdd()&&x.iadd(S),x.iushrn(1);for(var I=0,F=1;!(v.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(v.iushrn(I);I-- >0;)_.isOdd()&&_.iadd(S),_.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(_)):(v.isub(g),_.isub(x))}var ae;return g.cmpn(1)===0?ae=x:ae=_,ae.cmpn(0)<0&&ae.iadd(f),ae},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var g=this.clone(),v=f.clone();g.negative=0,v.negative=0;for(var x=0;g.isEven()&&v.isEven();x++)g.iushrn(1),v.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;v.isEven();)v.iushrn(1);var _=g.cmp(v);if(_<0){var S=g;g=v,v=S}else if(_===0||v.cmpn(1)===0)break;g.isub(v)}while(!0);return v.iushln(x)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var g=f%26,v=(f-g)/26,x=1<>>26,b&=67108863,this.words[S]=b}return _!==0&&(this.words[S]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var g=f<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var v;if(this.length>1)v=1;else{g&&(f=-f),n(f<=67108863,"Number is too big");var x=this.words[0]|0;v=x===f?0:xf.length)return 1;if(this.length=0;v--){var x=this.words[v]|0,_=f.words[v]|0;if(x!==_){x<_?g=-1:x>_&&(g=1);break}}return g},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new G(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var H={k256:null,p224:null,p192:null,p25519:null};function J(m,f){this.name=m,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}J.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},J.prototype.ireduce=function(f){var g=f,v;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),v=g.bitLength();while(v>this.n);var x=v0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},J.prototype.split=function(f,g){f.iushrn(this.n,0,g)},J.prototype.imulK=function(f){return f.imul(this.k)};function T(){J.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(T,J),T.prototype.split=function(f,g){for(var v=4194303,x=Math.min(f.length,9),_=0;_>>22,S=b}S>>>=22,f.words[_-10]=S,S===0&&f.length>10?f.length-=10:f.length-=9},T.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var g=0,v=0;v>>=26,f.words[v]=_,g=x}return g!==0&&(f.words[f.length++]=g),f},s._prime=function(f){if(H[f])return H[f];var g;if(f==="k256")g=new T;else if(f==="p224")g=new z;else if(f==="p192")g=new ue;else if(f==="p25519")g=new _e;else throw new Error("Unknown prime "+f);return H[f]=g,g};function G(m){if(typeof m=="string"){var f=s._prime(m);this.m=f.p,this.prime=f}else n(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}G.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},G.prototype._verify2=function(f,g){n((f.negative|g.negative)===0,"red works only with positives"),n(f.red&&f.red===g.red,"red works only with red numbers")},G.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(d(f,f.umod(this.m)._forceRed(this)),f)},G.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},G.prototype.add=function(f,g){this._verify2(f,g);var v=f.add(g);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},G.prototype.iadd=function(f,g){this._verify2(f,g);var v=f.iadd(g);return v.cmp(this.m)>=0&&v.isub(this.m),v},G.prototype.sub=function(f,g){this._verify2(f,g);var v=f.sub(g);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},G.prototype.isub=function(f,g){this._verify2(f,g);var v=f.isub(g);return v.cmpn(0)<0&&v.iadd(this.m),v},G.prototype.shl=function(f,g){return this._verify1(f),this.imod(f.ushln(g))},G.prototype.imul=function(f,g){return this._verify2(f,g),this.imod(f.imul(g))},G.prototype.mul=function(f,g){return this._verify2(f,g),this.imod(f.mul(g))},G.prototype.isqr=function(f){return this.imul(f,f.clone())},G.prototype.sqr=function(f){return this.mul(f,f)},G.prototype.sqrt=function(f){if(f.isZero())return f.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(f,v)}for(var x=this.m.subn(1),_=0;!x.isZero()&&x.andln(1)===0;)_++,x.iushrn(1);n(!x.isZero());var S=new s(1).toRed(this),b=S.redNeg(),M=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,M).cmp(b)!==0;)I.redIAdd(b);for(var F=this.pow(I,x),ae=this.pow(f,x.addn(1).iushrn(1)),O=this.pow(f,x),se=_;O.cmp(S)!==0;){for(var ee=O,X=0;ee.cmp(S)!==0;X++)ee=ee.redSqr();n(X=0;_--){for(var F=g.words[_],ae=I-1;ae>=0;ae--){var O=F>>ae&1;if(S!==x[0]&&(S=this.sqr(S)),O===0&&b===0){M=0;continue}b<<=1,b|=O,M++,!(M!==v&&(_!==0||ae!==0))&&(S=this.mul(S,x[b]),M=0,b=0)}I=26}return S},G.prototype.convertTo=function(f){var g=f.umod(this.m);return g===f?g.clone():g},G.prototype.convertFrom=function(f){var g=f.clone();return g.red=null,g},s.mont=function(f){return new E(f)};function E(m){G.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(E,G),E.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},E.prototype.convertFrom=function(f){var g=this.imod(f.mul(this.rinv));return g.red=null,g},E.prototype.imul=function(f,g){if(f.isZero()||g.isZero())return f.words[0]=0,f.length=1,f;var v=f.imul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.mul=function(f,g){if(f.isZero()||g.isZero())return new s(0)._forceRed(this);var v=f.mul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.invm=function(f){var g=this.imod(f._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,nn)}(Sm);var _N=Sm.exports;const rr=ji(_N);var EN=rr.BN;function SN(t){return new EN(t,36).toString(16)}const AN="strings/5.7.0",PN=new Kr(AN);var bd;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(bd||(bd={}));var qx;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(qx||(qx={}));function Am(t,e=bd.current){e!=bd.current&&(PN.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return bn(r)}const MN=`Ethereum Signed Message: -`;function zx(t){return typeof t=="string"&&(t=Am(t)),Em(yN([Am(MN),Am(String(t.length)),t]))}const IN="address/5.7.0",sl=new Kr(IN);function Hx(t){Ns(t,20)||sl.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=bn(Em(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const CN=9007199254740991;function TN(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const Pm={};for(let t=0;t<10;t++)Pm[String(t)]=String(t);for(let t=0;t<26;t++)Pm[String.fromCharCode(65+t)]=String(10+t);const Wx=Math.floor(TN(CN));function RN(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Pm[n]).join("");for(;e.length>=Wx;){let n=e.substring(0,Wx);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function DN(t){let e=null;if(typeof t!="string"&&sl.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=Hx(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&sl.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==RN(t)&&sl.throwArgumentError("bad icap checksum","address",t),e=SN(t.substring(4));e.length<40;)e="0"+e;e=Hx("0x"+e)}else sl.throwArgumentError("invalid address","address",t);return e}function ol(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var al={},yr={},Ga=Kx;function Kx(t,e){if(!t)throw new Error(e||"Assertion failed")}Kx.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var Mm={exports:{}};typeof Object.create=="function"?Mm.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Mm.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var yd=Mm.exports,ON=Ga,NN=yd;yr.inherits=NN;function LN(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function kN(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):LN(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}yr.htonl=Vx;function $N(t,e){for(var r="",n=0;n>>0}return s}yr.join32=FN;function jN(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}yr.split32=jN;function UN(t,e){return t>>>e|t<<32-e}yr.rotr32=UN;function qN(t,e){return t<>>32-e}yr.rotl32=qN;function zN(t,e){return t+e>>>0}yr.sum32=zN;function HN(t,e,r){return t+e+r>>>0}yr.sum32_3=HN;function WN(t,e,r,n){return t+e+r+n>>>0}yr.sum32_4=WN;function KN(t,e,r,n,i){return t+e+r+n+i>>>0}yr.sum32_5=KN;function VN(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}yr.sum64=VN;function GN(t,e,r,n){var i=e+n>>>0,s=(i>>0}yr.sum64_hi=GN;function YN(t,e,r,n){var i=e+n;return i>>>0}yr.sum64_lo=YN;function JN(t,e,r,n,i,s,o,a){var u=0,l=e;l=l+n>>>0,u+=l>>0,u+=l>>0,u+=l>>0}yr.sum64_4_hi=JN;function XN(t,e,r,n,i,s,o,a){var u=e+n+s+a;return u>>>0}yr.sum64_4_lo=XN;function ZN(t,e,r,n,i,s,o,a,u,l){var d=0,p=e;p=p+n>>>0,d+=p>>0,d+=p>>0,d+=p>>0,d+=p>>0}yr.sum64_5_hi=ZN;function QN(t,e,r,n,i,s,o,a,u,l){var d=e+n+s+a+l;return d>>>0}yr.sum64_5_lo=QN;function eL(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}yr.rotr64_hi=eL;function tL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.rotr64_lo=tL;function rL(t,e,r){return t>>>r}yr.shr64_hi=rL;function nL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.shr64_lo=nL;var hu={},Jx=yr,iL=Ga;function wd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}hu.BlockHash=wd,wd.prototype.update=function(e,r){if(e=Jx.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Jx.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}Ls.g0_256=uL;function fL(t){return ks(t,17)^ks(t,19)^t>>>10}Ls.g1_256=fL;var pu=yr,lL=hu,hL=Ls,Im=pu.rotl32,cl=pu.sum32,dL=pu.sum32_5,pL=hL.ft_1,e3=lL.BlockHash,gL=[1518500249,1859775393,2400959708,3395469782];function Bs(){if(!(this instanceof Bs))return new Bs;e3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}pu.inherits(Bs,e3);var mL=Bs;Bs.blockSize=512,Bs.outSize=160,Bs.hmacStrength=80,Bs.padLength=64,Bs.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),nk(e.length<=this.blockSize);for(var r=e.length;r>8,y=d&255;p?u.push(p,y):u.push(y)}return u}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",u=0;u(y>>1)-1?N=(y>>1)-D:N=D,A.isubn(N)):N=0,p[P]=N,A.iushrn(1)}return p}r.getNAF=n;function i(u,l){var d=[[],[]];u=u.clone(),l=l.clone();for(var p=0,y=0,A;u.cmpn(-p)>0||l.cmpn(-y)>0;){var P=u.andln(3)+p&3,N=l.andln(3)+y&3;P===3&&(P=-1),N===3&&(N=-1);var D;P&1?(A=u.andln(7)+p&7,(A===3||A===5)&&N===2?D=-P:D=P):D=0,d[0].push(D);var k;N&1?(A=l.andln(7)+y&7,(A===3||A===5)&&P===2?k=-N:k=N):k=0,d[1].push(k),2*p===D+1&&(p=1-p),2*y===k+1&&(y=1-y),u.iushrn(1),l.iushrn(1)}return d}r.getJSF=i;function s(u,l,d){var p="_"+l;u.prototype[l]=function(){return this[p]!==void 0?this[p]:this[p]=d.call(this)}}r.cachedProperty=s;function o(u){return typeof u=="string"?r.toArray(u,"hex"):u}r.parseBytes=o;function a(u){return new rr(u,"hex","le")}r.intFromLE=a}),_d=Ci.getNAF,ok=Ci.getJSF,Ed=Ci.assert;function na(t,e){this.type=t,this.p=new rr(e.p,16),this.red=e.prime?rr.red(e.prime):rr.mont(this.p),this.zero=new rr(0).toRed(this.red),this.one=new rr(1).toRed(this.red),this.two=new rr(2).toRed(this.red),this.n=e.n&&new rr(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ja=na;na.prototype.point=function(){throw new Error("Not implemented")},na.prototype.validate=function(){throw new Error("Not implemented")},na.prototype._fixedNafMul=function(e,r){Ed(e.precomputed);var n=e._getDoubles(),i=_d(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Ed(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},na.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=_d(n[P],o[P],this._bitLength),u[N]=_d(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=ok(n[P],n[N]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[N]=new Array(l),p=0;p=0;d--){for(var T=0;d>=0;){var z=!0;for(p=0;p=0&&T++,H=H.dblp(T),d<0)break;for(p=0;p0?y=a[p][ue-1>>1]:ue<0&&(y=a[p][-ue-1>>1].neg()),y.type==="affine"?H=H.mixedAdd(y):H=H.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},zi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),p.negative&&(p=p.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:p,b:y},{a:A,b:P}]},Hi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Hi.prototype.pointFromX=function(e,r){e=new rr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Hi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Hi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},On.prototype.isInfinity=function(){return this.inf},On.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},On.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},On.prototype.getX=function(){return this.x.fromRed()},On.prototype.getY=function(){return this.y.fromRed()},On.prototype.mul=function(e){return e=new rr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},On.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},On.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},On.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},On.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},On.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Un(t,e,r,n){Ja.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new rr(0)):(this.x=new rr(e,16),this.y=new rr(r,16),this.z=new rr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Nm(Un,Ja.BasePoint),Hi.prototype.jpoint=function(e,r,n){return new Un(this,e,r,n)},Un.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},Un.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Un.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(p).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(p)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},Un.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),A=u.redMul(p.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},Un.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},Un.prototype.inspect=function(){return this.isInfinity()?"":""},Un.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Sd=bu(function(t,e){var r=e;r.base=Ja,r.short=ck,r.mont=null,r.edwards=null}),Ad=bu(function(t,e){var r=e,n=Ci.assert;function i(a){a.type==="short"?this.curve=new Sd.short(a):a.type==="edwards"?this.curve=new Sd.edwards(a):this.curve=new Sd.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,u){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(u);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:wo.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:wo.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:wo.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:wo.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:wo.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:wo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function ia(t){if(!(this instanceof ia))return new ia(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=vs.toArray(t.entropy,t.entropyEnc||"hex"),r=vs.toArray(t.nonce,t.nonceEnc||"hex"),n=vs.toArray(t.pers,t.persEnc||"hex");Om(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var g3=ia;ia.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ia.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=vs.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var uk=Ci.assert;function Pd(t,e){if(t instanceof Pd)return t;this._importDER(t,e)||(uk(t.r&&t.s,"Signature without r or s"),this.r=new rr(t.r,16),this.s=new rr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Md=Pd;function fk(){this.place=0}function Bm(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function m3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Pd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=m3(r),n=m3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];$m(i,r.length),i=i.concat(r),i.push(2),$m(i,n.length);var s=i.concat(n),o=[48];return $m(o,s.length),o=o.concat(s),Ci.encode(o,e)};var lk=function(){throw new Error("unsupported")},v3=Ci.assert;function Wi(t){if(!(this instanceof Wi))return new Wi(t);typeof t=="string"&&(v3(Object.prototype.hasOwnProperty.call(Ad,t),"Unknown curve "+t),t=Ad[t]),t instanceof Ad.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var hk=Wi;Wi.prototype.keyPair=function(e){return new km(this,e)},Wi.prototype.keyFromPrivate=function(e,r){return km.fromPrivate(this,e,r)},Wi.prototype.keyFromPublic=function(e,r){return km.fromPublic(this,e,r)},Wi.prototype.genKeyPair=function(e){e||(e={});for(var r=new g3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||lk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new rr(2));;){var s=new rr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Wi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Wi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new rr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new g3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new rr(1)),d=0;;d++){var p=i.k?i.k(d):new rr(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new Md({r:P,s:N,recoveryParam:D})}}}}}},Wi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new rr(e,16)),n=this.keyFromPublic(n,i),r=new Md(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),u=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.eqXToP(s)):(d=this.g.mulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.getX().umod(this.n).cmp(s)===0)},Wi.prototype.recoverPubKey=function(t,e,r,n){v3((3&r)===r,"The recovery param is more than two bits"),e=new Md(e,n);var i=this.n,s=new rr(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Wi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Md(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dk=bu(function(t,e){var r=e;r.version="6.5.4",r.utils=Ci,r.rand=function(){throw new Error("unsupported")},r.curve=Sd,r.curves=Ad,r.ec=hk,r.eddsa=null}),pk=dk.ec;const gk="signing-key/5.7.0",Fm=new Kr(gk);let jm=null;function sa(){return jm||(jm=new pk("secp256k1")),jm}class mk{constructor(e){ol(this,"curve","secp256k1"),ol(this,"privateKey",Ii(e)),xN(this.privateKey)!==32&&Fm.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=sa().keyFromPrivate(bn(this.privateKey));ol(this,"publicKey","0x"+r.getPublic(!1,"hex")),ol(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ol(this,"_isSigningKey",!0)}_addPoint(e){const r=sa().keyFromPublic(bn(this.publicKey)),n=sa().keyFromPublic(bn(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=sa().keyFromPrivate(bn(this.privateKey)),n=bn(e);n.length!==32&&Fm.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Ux({recoveryParam:i.recoveryParam,r:lu("0x"+i.r.toString(16),32),s:lu("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=sa().keyFromPrivate(bn(this.privateKey)),n=sa().keyFromPublic(bn(b3(e)));return lu("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function vk(t,e){const r=Ux(e),n={r:bn(r.r),s:bn(r.s)};return"0x"+sa().recoverPubKey(bn(t),n,r.recoveryParam).encode("hex",!1)}function b3(t,e){const r=bn(t);return r.length===32?new mk(r).publicKey:r.length===33?"0x"+sa().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?Ii(r):Fm.throwArgumentError("invalid public or private key","key","[REDACTED]")}var y3;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(y3||(y3={}));function bk(t){const e=b3(t);return DN(jx(Em(jx(e,1)),12))}function yk(t,e){return bk(vk(bn(t),e))}var Um={},Id={};Object.defineProperty(Id,"__esModule",{value:!0});var Yn=or,qm=Mi,wk=20;function xk(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],p=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],P=r[31]<<24|r[30]<<16|r[29]<<8|r[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],k=e[11]<<24|e[10]<<16|e[9]<<8|e[8],B=e[15]<<24|e[14]<<16|e[13]<<8|e[12],q=n,j=i,H=s,J=o,T=a,z=u,ue=l,_e=d,G=p,E=y,m=A,f=P,g=N,v=D,x=k,_=B,S=0;S>>16|g<<16,G=G+g|0,T^=G,T=T>>>20|T<<12,j=j+z|0,v^=j,v=v>>>16|v<<16,E=E+v|0,z^=E,z=z>>>20|z<<12,H=H+ue|0,x^=H,x=x>>>16|x<<16,m=m+x|0,ue^=m,ue=ue>>>20|ue<<12,J=J+_e|0,_^=J,_=_>>>16|_<<16,f=f+_|0,_e^=f,_e=_e>>>20|_e<<12,H=H+ue|0,x^=H,x=x>>>24|x<<8,m=m+x|0,ue^=m,ue=ue>>>25|ue<<7,J=J+_e|0,_^=J,_=_>>>24|_<<8,f=f+_|0,_e^=f,_e=_e>>>25|_e<<7,j=j+z|0,v^=j,v=v>>>24|v<<8,E=E+v|0,z^=E,z=z>>>25|z<<7,q=q+T|0,g^=q,g=g>>>24|g<<8,G=G+g|0,T^=G,T=T>>>25|T<<7,q=q+z|0,_^=q,_=_>>>16|_<<16,m=m+_|0,z^=m,z=z>>>20|z<<12,j=j+ue|0,g^=j,g=g>>>16|g<<16,f=f+g|0,ue^=f,ue=ue>>>20|ue<<12,H=H+_e|0,v^=H,v=v>>>16|v<<16,G=G+v|0,_e^=G,_e=_e>>>20|_e<<12,J=J+T|0,x^=J,x=x>>>16|x<<16,E=E+x|0,T^=E,T=T>>>20|T<<12,H=H+_e|0,v^=H,v=v>>>24|v<<8,G=G+v|0,_e^=G,_e=_e>>>25|_e<<7,J=J+T|0,x^=J,x=x>>>24|x<<8,E=E+x|0,T^=E,T=T>>>25|T<<7,j=j+ue|0,g^=j,g=g>>>24|g<<8,f=f+g|0,ue^=f,ue=ue>>>25|ue<<7,q=q+z|0,_^=q,_=_>>>24|_<<8,m=m+_|0,z^=m,z=z>>>25|z<<7;Yn.writeUint32LE(q+n|0,t,0),Yn.writeUint32LE(j+i|0,t,4),Yn.writeUint32LE(H+s|0,t,8),Yn.writeUint32LE(J+o|0,t,12),Yn.writeUint32LE(T+a|0,t,16),Yn.writeUint32LE(z+u|0,t,20),Yn.writeUint32LE(ue+l|0,t,24),Yn.writeUint32LE(_e+d|0,t,28),Yn.writeUint32LE(G+p|0,t,32),Yn.writeUint32LE(E+y|0,t,36),Yn.writeUint32LE(m+A|0,t,40),Yn.writeUint32LE(f+P|0,t,44),Yn.writeUint32LE(g+N|0,t,48),Yn.writeUint32LE(v+D|0,t,52),Yn.writeUint32LE(x+k|0,t,56),Yn.writeUint32LE(_+B|0,t,60)}function w3(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var x3={},oa={};Object.defineProperty(oa,"__esModule",{value:!0});function Sk(t,e,r){return~(t-1)&e|t-1&r}oa.select=Sk;function Ak(t,e){return(t|0)-(e|0)-1>>>31&1}oa.lessOrEqual=Ak;function _3(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}oa.compare=_3;function Pk(t,e){return t.length===0||e.length===0?!1:_3(t,e)!==0}oa.equal=Pk,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=oa,r=Mi;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var u=a[0]|a[1]<<8;this._r[0]=u&8191;var l=a[2]|a[3]<<8;this._r[1]=(u>>>13|l<<3)&8191;var d=a[4]|a[5]<<8;this._r[2]=(l>>>10|d<<6)&7939;var p=a[6]|a[7]<<8;this._r[3]=(d>>>7|p<<9)&8191;var y=a[8]|a[9]<<8;this._r[4]=(p>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var A=a[10]|a[11]<<8;this._r[6]=(y>>>14|A<<2)&8191;var P=a[12]|a[13]<<8;this._r[7]=(A>>>11|P<<5)&8065;var N=a[14]|a[15]<<8;this._r[8]=(P>>>8|N<<8)&8191,this._r[9]=N>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,u,l){for(var d=this._fin?0:2048,p=this._h[0],y=this._h[1],A=this._h[2],P=this._h[3],N=this._h[4],D=this._h[5],k=this._h[6],B=this._h[7],q=this._h[8],j=this._h[9],H=this._r[0],J=this._r[1],T=this._r[2],z=this._r[3],ue=this._r[4],_e=this._r[5],G=this._r[6],E=this._r[7],m=this._r[8],f=this._r[9];l>=16;){var g=a[u+0]|a[u+1]<<8;p+=g&8191;var v=a[u+2]|a[u+3]<<8;y+=(g>>>13|v<<3)&8191;var x=a[u+4]|a[u+5]<<8;A+=(v>>>10|x<<6)&8191;var _=a[u+6]|a[u+7]<<8;P+=(x>>>7|_<<9)&8191;var S=a[u+8]|a[u+9]<<8;N+=(_>>>4|S<<12)&8191,D+=S>>>1&8191;var b=a[u+10]|a[u+11]<<8;k+=(S>>>14|b<<2)&8191;var M=a[u+12]|a[u+13]<<8;B+=(b>>>11|M<<5)&8191;var I=a[u+14]|a[u+15]<<8;q+=(M>>>8|I<<8)&8191,j+=I>>>5|d;var F=0,ae=F;ae+=p*H,ae+=y*(5*f),ae+=A*(5*m),ae+=P*(5*E),ae+=N*(5*G),F=ae>>>13,ae&=8191,ae+=D*(5*_e),ae+=k*(5*ue),ae+=B*(5*z),ae+=q*(5*T),ae+=j*(5*J),F+=ae>>>13,ae&=8191;var O=F;O+=p*J,O+=y*H,O+=A*(5*f),O+=P*(5*m),O+=N*(5*E),F=O>>>13,O&=8191,O+=D*(5*G),O+=k*(5*_e),O+=B*(5*ue),O+=q*(5*z),O+=j*(5*T),F+=O>>>13,O&=8191;var se=F;se+=p*T,se+=y*J,se+=A*H,se+=P*(5*f),se+=N*(5*m),F=se>>>13,se&=8191,se+=D*(5*E),se+=k*(5*G),se+=B*(5*_e),se+=q*(5*ue),se+=j*(5*z),F+=se>>>13,se&=8191;var ee=F;ee+=p*z,ee+=y*T,ee+=A*J,ee+=P*H,ee+=N*(5*f),F=ee>>>13,ee&=8191,ee+=D*(5*m),ee+=k*(5*E),ee+=B*(5*G),ee+=q*(5*_e),ee+=j*(5*ue),F+=ee>>>13,ee&=8191;var X=F;X+=p*ue,X+=y*z,X+=A*T,X+=P*J,X+=N*H,F=X>>>13,X&=8191,X+=D*(5*f),X+=k*(5*m),X+=B*(5*E),X+=q*(5*G),X+=j*(5*_e),F+=X>>>13,X&=8191;var Q=F;Q+=p*_e,Q+=y*ue,Q+=A*z,Q+=P*T,Q+=N*J,F=Q>>>13,Q&=8191,Q+=D*H,Q+=k*(5*f),Q+=B*(5*m),Q+=q*(5*E),Q+=j*(5*G),F+=Q>>>13,Q&=8191;var R=F;R+=p*G,R+=y*_e,R+=A*ue,R+=P*z,R+=N*T,F=R>>>13,R&=8191,R+=D*J,R+=k*H,R+=B*(5*f),R+=q*(5*m),R+=j*(5*E),F+=R>>>13,R&=8191;var Z=F;Z+=p*E,Z+=y*G,Z+=A*_e,Z+=P*ue,Z+=N*z,F=Z>>>13,Z&=8191,Z+=D*T,Z+=k*J,Z+=B*H,Z+=q*(5*f),Z+=j*(5*m),F+=Z>>>13,Z&=8191;var te=F;te+=p*m,te+=y*E,te+=A*G,te+=P*_e,te+=N*ue,F=te>>>13,te&=8191,te+=D*z,te+=k*T,te+=B*J,te+=q*H,te+=j*(5*f),F+=te>>>13,te&=8191;var le=F;le+=p*f,le+=y*m,le+=A*E,le+=P*G,le+=N*_e,F=le>>>13,le&=8191,le+=D*ue,le+=k*z,le+=B*T,le+=q*J,le+=j*H,F+=le>>>13,le&=8191,F=(F<<2)+F|0,F=F+ae|0,ae=F&8191,F=F>>>13,O+=F,p=ae,y=O,A=se,P=ee,N=X,D=Q,k=R,B=Z,q=te,j=le,u+=16,l-=16}this._h[0]=p,this._h[1]=y,this._h[2]=A,this._h[3]=P,this._h[4]=N,this._h[5]=D,this._h[6]=k,this._h[7]=B,this._h[8]=q,this._h[9]=j},o.prototype.finish=function(a,u){u===void 0&&(u=0);var l=new Uint16Array(10),d,p,y,A;if(this._leftover){for(A=this._leftover,this._buffer[A++]=1;A<16;A++)this._buffer[A]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(d=this._h[1]>>>13,this._h[1]&=8191,A=2;A<10;A++)this._h[A]+=d,d=this._h[A]>>>13,this._h[A]&=8191;for(this._h[0]+=d*5,d=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=d,d=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=d,l[0]=this._h[0]+5,d=l[0]>>>13,l[0]&=8191,A=1;A<10;A++)l[A]=this._h[A]+d,d=l[A]>>>13,l[A]&=8191;for(l[9]-=8192,p=(d^1)-1,A=0;A<10;A++)l[A]&=p;for(p=~p,A=0;A<10;A++)this._h[A]=this._h[A]&p|l[A];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,y=this._h[0]+this._pad[0],this._h[0]=y&65535,A=1;A<8;A++)y=(this._h[A]+this._pad[A]|0)+(y>>>16)|0,this._h[A]=y&65535;return a[u+0]=this._h[0]>>>0,a[u+1]=this._h[0]>>>8,a[u+2]=this._h[1]>>>0,a[u+3]=this._h[1]>>>8,a[u+4]=this._h[2]>>>0,a[u+5]=this._h[2]>>>8,a[u+6]=this._h[3]>>>0,a[u+7]=this._h[3]>>>8,a[u+8]=this._h[4]>>>0,a[u+9]=this._h[4]>>>8,a[u+10]=this._h[5]>>>0,a[u+11]=this._h[5]>>>8,a[u+12]=this._h[6]>>>0,a[u+13]=this._h[6]>>>8,a[u+14]=this._h[7]>>>0,a[u+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var u=0,l=a.length,d;if(this._leftover){d=16-this._leftover,d>l&&(d=l);for(var p=0;p=16&&(d=l-l%16,this._blocks(a,u,d),u+=d,l-=d),l){for(var p=0;p16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var A=new Uint8Array(16);A.set(l,A.length-l.length);var P=new Uint8Array(32);e.stream(this._key,A,P,4);var N=d.length+this.tagLength,D;if(y){if(y.length!==N)throw new Error("ChaCha20Poly1305: incorrect destination length");D=y}else D=new Uint8Array(N);return e.streamXOR(this._key,A,d,D,4),this._authenticate(D.subarray(D.length-this.tagLength,D.length),P,D.subarray(0,D.length-this.tagLength),p),n.wipe(A),D},u.prototype.open=function(l,d,p,y){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(d.length0&&A.update(o.subarray(y.length%16))),A.update(p),p.length%16>0&&A.update(o.subarray(p.length%16));var P=new Uint8Array(8);y&&i.writeUint64LE(y.length,P),A.update(P),i.writeUint64LE(p.length,P),A.update(P);for(var N=A.digest(),D=0;Dthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._temp,this._state,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,A=l%64<56?64:128;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._state.set(u.state),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.state),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,u,l,d,p){for(;p>=64;){for(var y=u[0],A=u[1],P=u[2],N=u[3],D=u[4],k=u[5],B=u[6],q=u[7],j=0;j<16;j++){var H=d+j*4;a[j]=e.readUint32BE(l,H)}for(var j=16;j<64;j++){var J=a[j-2],T=(J>>>17|J<<15)^(J>>>19|J<<13)^J>>>10;J=a[j-15];var z=(J>>>7|J<<25)^(J>>>18|J<<14)^J>>>3;a[j]=(T+a[j-7]|0)+(z+a[j-16]|0)}for(var j=0;j<64;j++){var T=(((D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7))+(D&k^~D&B)|0)+(q+(i[j]+a[j]|0)|0)|0,z=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&A^y&P^A&P)|0;q=B,B=k,k=D,D=N+T|0,N=P,P=A,A=y,y=T+z|0}u[0]+=y,u[1]+=A,u[2]+=P,u[3]+=N,u[4]+=D,u[5]+=k,u[6]+=B,u[7]+=q,d+=64,p-=64}return d}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ll);var Hm={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=ta,r=Mi;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(j){const H=new Float64Array(16);if(j)for(let J=0;J>16&1),J[_e-1]&=65535;J[15]=T[15]-32767-(J[14]>>16&1);const ue=J[15]>>16&1;J[14]&=65535,a(T,J,1-ue)}for(let z=0;z<16;z++)j[2*z]=T[z]&255,j[2*z+1]=T[z]>>8}function l(j,H){for(let J=0;J<16;J++)j[J]=H[2*J]+(H[2*J+1]<<8);j[15]&=32767}function d(j,H,J){for(let T=0;T<16;T++)j[T]=H[T]+J[T]}function p(j,H,J){for(let T=0;T<16;T++)j[T]=H[T]-J[T]}function y(j,H,J){let T,z,ue=0,_e=0,G=0,E=0,m=0,f=0,g=0,v=0,x=0,_=0,S=0,b=0,M=0,I=0,F=0,ae=0,O=0,se=0,ee=0,X=0,Q=0,R=0,Z=0,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=J[0],Ie=J[1],Le=J[2],Ve=J[3],ke=J[4],ze=J[5],He=J[6],Se=J[7],Qe=J[8],ct=J[9],Be=J[10],et=J[11],rt=J[12],Je=J[13],pt=J[14],ht=J[15];T=H[0],ue+=T*$e,_e+=T*Ie,G+=T*Le,E+=T*Ve,m+=T*ke,f+=T*ze,g+=T*He,v+=T*Se,x+=T*Qe,_+=T*ct,S+=T*Be,b+=T*et,M+=T*rt,I+=T*Je,F+=T*pt,ae+=T*ht,T=H[1],_e+=T*$e,G+=T*Ie,E+=T*Le,m+=T*Ve,f+=T*ke,g+=T*ze,v+=T*He,x+=T*Se,_+=T*Qe,S+=T*ct,b+=T*Be,M+=T*et,I+=T*rt,F+=T*Je,ae+=T*pt,O+=T*ht,T=H[2],G+=T*$e,E+=T*Ie,m+=T*Le,f+=T*Ve,g+=T*ke,v+=T*ze,x+=T*He,_+=T*Se,S+=T*Qe,b+=T*ct,M+=T*Be,I+=T*et,F+=T*rt,ae+=T*Je,O+=T*pt,se+=T*ht,T=H[3],E+=T*$e,m+=T*Ie,f+=T*Le,g+=T*Ve,v+=T*ke,x+=T*ze,_+=T*He,S+=T*Se,b+=T*Qe,M+=T*ct,I+=T*Be,F+=T*et,ae+=T*rt,O+=T*Je,se+=T*pt,ee+=T*ht,T=H[4],m+=T*$e,f+=T*Ie,g+=T*Le,v+=T*Ve,x+=T*ke,_+=T*ze,S+=T*He,b+=T*Se,M+=T*Qe,I+=T*ct,F+=T*Be,ae+=T*et,O+=T*rt,se+=T*Je,ee+=T*pt,X+=T*ht,T=H[5],f+=T*$e,g+=T*Ie,v+=T*Le,x+=T*Ve,_+=T*ke,S+=T*ze,b+=T*He,M+=T*Se,I+=T*Qe,F+=T*ct,ae+=T*Be,O+=T*et,se+=T*rt,ee+=T*Je,X+=T*pt,Q+=T*ht,T=H[6],g+=T*$e,v+=T*Ie,x+=T*Le,_+=T*Ve,S+=T*ke,b+=T*ze,M+=T*He,I+=T*Se,F+=T*Qe,ae+=T*ct,O+=T*Be,se+=T*et,ee+=T*rt,X+=T*Je,Q+=T*pt,R+=T*ht,T=H[7],v+=T*$e,x+=T*Ie,_+=T*Le,S+=T*Ve,b+=T*ke,M+=T*ze,I+=T*He,F+=T*Se,ae+=T*Qe,O+=T*ct,se+=T*Be,ee+=T*et,X+=T*rt,Q+=T*Je,R+=T*pt,Z+=T*ht,T=H[8],x+=T*$e,_+=T*Ie,S+=T*Le,b+=T*Ve,M+=T*ke,I+=T*ze,F+=T*He,ae+=T*Se,O+=T*Qe,se+=T*ct,ee+=T*Be,X+=T*et,Q+=T*rt,R+=T*Je,Z+=T*pt,te+=T*ht,T=H[9],_+=T*$e,S+=T*Ie,b+=T*Le,M+=T*Ve,I+=T*ke,F+=T*ze,ae+=T*He,O+=T*Se,se+=T*Qe,ee+=T*ct,X+=T*Be,Q+=T*et,R+=T*rt,Z+=T*Je,te+=T*pt,le+=T*ht,T=H[10],S+=T*$e,b+=T*Ie,M+=T*Le,I+=T*Ve,F+=T*ke,ae+=T*ze,O+=T*He,se+=T*Se,ee+=T*Qe,X+=T*ct,Q+=T*Be,R+=T*et,Z+=T*rt,te+=T*Je,le+=T*pt,ie+=T*ht,T=H[11],b+=T*$e,M+=T*Ie,I+=T*Le,F+=T*Ve,ae+=T*ke,O+=T*ze,se+=T*He,ee+=T*Se,X+=T*Qe,Q+=T*ct,R+=T*Be,Z+=T*et,te+=T*rt,le+=T*Je,ie+=T*pt,fe+=T*ht,T=H[12],M+=T*$e,I+=T*Ie,F+=T*Le,ae+=T*Ve,O+=T*ke,se+=T*ze,ee+=T*He,X+=T*Se,Q+=T*Qe,R+=T*ct,Z+=T*Be,te+=T*et,le+=T*rt,ie+=T*Je,fe+=T*pt,ve+=T*ht,T=H[13],I+=T*$e,F+=T*Ie,ae+=T*Le,O+=T*Ve,se+=T*ke,ee+=T*ze,X+=T*He,Q+=T*Se,R+=T*Qe,Z+=T*ct,te+=T*Be,le+=T*et,ie+=T*rt,fe+=T*Je,ve+=T*pt,Me+=T*ht,T=H[14],F+=T*$e,ae+=T*Ie,O+=T*Le,se+=T*Ve,ee+=T*ke,X+=T*ze,Q+=T*He,R+=T*Se,Z+=T*Qe,te+=T*ct,le+=T*Be,ie+=T*et,fe+=T*rt,ve+=T*Je,Me+=T*pt,Ne+=T*ht,T=H[15],ae+=T*$e,O+=T*Ie,se+=T*Le,ee+=T*Ve,X+=T*ke,Q+=T*ze,R+=T*He,Z+=T*Se,te+=T*Qe,le+=T*ct,ie+=T*Be,fe+=T*et,ve+=T*rt,Me+=T*Je,Ne+=T*pt,Te+=T*ht,ue+=38*O,_e+=38*se,G+=38*ee,E+=38*X,m+=38*Q,f+=38*R,g+=38*Z,v+=38*te,x+=38*le,_+=38*ie,S+=38*fe,b+=38*ve,M+=38*Me,I+=38*Ne,F+=38*Te,z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=g+z+65535,z=Math.floor(T/65536),g=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=g+z+65535,z=Math.floor(T/65536),g=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ae+z+65535,z=Math.floor(T/65536),ae=T-z*65536,ue+=z-1+37*(z-1),j[0]=ue,j[1]=_e,j[2]=G,j[3]=E,j[4]=m,j[5]=f,j[6]=g,j[7]=v,j[8]=x,j[9]=_,j[10]=S,j[11]=b,j[12]=M,j[13]=I,j[14]=F,j[15]=ae}function A(j,H){y(j,H,H)}function P(j,H){const J=n();for(let T=0;T<16;T++)J[T]=H[T];for(let T=253;T>=0;T--)A(J,J),T!==2&&T!==4&&y(J,J,H);for(let T=0;T<16;T++)j[T]=J[T]}function N(j,H){const J=new Uint8Array(32),T=new Float64Array(80),z=n(),ue=n(),_e=n(),G=n(),E=n(),m=n();for(let x=0;x<31;x++)J[x]=j[x];J[31]=j[31]&127|64,J[0]&=248,l(T,H);for(let x=0;x<16;x++)ue[x]=T[x];z[0]=G[0]=1;for(let x=254;x>=0;--x){const _=J[x>>>3]>>>(x&7)&1;a(z,ue,_),a(_e,G,_),d(E,z,_e),p(z,z,_e),d(_e,ue,G),p(ue,ue,G),A(G,E),A(m,z),y(z,_e,z),y(_e,ue,E),d(E,z,_e),p(z,z,_e),A(ue,z),p(_e,G,m),y(z,_e,s),d(z,z,G),y(_e,_e,z),y(z,G,m),y(G,ue,T),A(ue,E),a(z,ue,_),a(_e,G,_)}for(let x=0;x<16;x++)T[x+16]=z[x],T[x+32]=_e[x],T[x+48]=ue[x],T[x+64]=G[x];const f=T.subarray(32),g=T.subarray(16);P(f,f),y(g,g,f);const v=new Uint8Array(32);return u(v,g),v}t.scalarMult=N;function D(j){return N(j,i)}t.scalarMultBase=D;function k(j){if(j.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const H=new Uint8Array(j);return{publicKey:D(H),secretKey:H}}t.generateKeyPairFromSeed=k;function B(j){const H=(0,e.randomBytes)(32,j),J=k(H);return(0,r.wipe)(H),J}t.generateKeyPair=B;function q(j,H,J=!1){if(j.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(H.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const T=N(j,H);if(J){let z=0;for(let ue=0;ue",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}};var Ti={},Wm={exports:{}};Wm.exports,function(t){(function(e,r){function n(G,E){if(!G)throw new Error(E||"Assertion failed")}function i(G,E){G.super_=E;var m=function(){};m.prototype=E.prototype,G.prototype=new m,G.prototype.constructor=G}function s(G,E,m){if(s.isBN(G))return G;this.negative=0,this.words=null,this.length=0,this.red=null,G!==null&&((E==="le"||E==="be")&&(m=E,E=10),this._init(G||0,E||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(E){return E instanceof s?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===s.wordSize&&Array.isArray(E.words)},s.max=function(E,m){return E.cmp(m)>0?E:m},s.min=function(E,m){return E.cmp(m)<0?E:m},s.prototype._init=function(E,m,f){if(typeof E=="number")return this._initNumber(E,m,f);if(typeof E=="object")return this._initArray(E,m,f);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),E=E.toString().replace(/\s+/g,"");var g=0;E[0]==="-"&&(g++,this.negative=1),g=0;g-=3)x=E[g]|E[g-1]<<8|E[g-2]<<16,this.words[v]|=x<<_&67108863,this.words[v+1]=x>>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);else if(f==="le")for(g=0,v=0;g>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);return this.strip()};function a(G,E){var m=G.charCodeAt(E);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function u(G,E,m){var f=a(G,m);return m-1>=E&&(f|=a(G,m-1)<<4),f}s.prototype._parseHex=function(E,m,f){this.length=Math.ceil((E.length-m)/6),this.words=new Array(this.length);for(var g=0;g=m;g-=2)_=u(E,m,g)<=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8;else{var S=E.length-m;for(g=S%2===0?m+1:m;g=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8}this.strip()};function l(G,E,m,f){for(var g=0,v=Math.min(G.length,m),x=E;x=49?g+=_-49+10:_>=17?g+=_-17+10:g+=_}return g}s.prototype._parseBase=function(E,m,f){this.words=[0],this.length=1;for(var g=0,v=1;v<=67108863;v*=m)g++;g--,v=v/m|0;for(var x=E.length-f,_=x%g,S=Math.min(x,x-_)+f,b=0,M=f;M1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var d=["","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"],p=[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],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(E,m){E=E||10,m=m|0||1;var f;if(E===16||E==="hex"){f="";for(var g=0,v=0,x=0;x>>24-g&16777215,g+=2,g>=26&&(g-=26,x--),v!==0||x!==this.length-1?f=d[6-S.length]+S+f:f=S+f}for(v!==0&&(f=v.toString(16)+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(E===(E|0)&&E>=2&&E<=36){var b=p[E],M=y[E];f="";var I=this.clone();for(I.negative=0;!I.isZero();){var F=I.modn(M).toString(E);I=I.idivn(M),I.isZero()?f=F+f:f=d[b-F.length]+F+f}for(this.isZero()&&(f="0"+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(E,m){return n(typeof o<"u"),this.toArrayLike(o,E,m)},s.prototype.toArray=function(E,m){return this.toArrayLike(Array,E,m)},s.prototype.toArrayLike=function(E,m,f){var g=this.byteLength(),v=f||Math.max(1,g);n(g<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var x=m==="le",_=new E(v),S,b,M=this.clone();if(x){for(b=0;!M.isZero();b++)S=M.andln(255),M.iushrn(8),_[b]=S;for(;b=4096&&(f+=13,m>>>=13),m>=64&&(f+=7,m>>>=7),m>=8&&(f+=4,m>>>=4),m>=2&&(f+=2,m>>>=2),f+m},s.prototype._zeroBits=function(E){if(E===0)return 26;var m=E,f=0;return m&8191||(f+=13,m>>>=13),m&127||(f+=7,m>>>=7),m&15||(f+=4,m>>>=4),m&3||(f+=2,m>>>=2),m&1||f++,f},s.prototype.bitLength=function(){var E=this.words[this.length-1],m=this._countBits(E);return(this.length-1)*26+m};function A(G){for(var E=new Array(G.bitLength()),m=0;m>>g}return E}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,m=0;mE.length?this.clone().ior(E):E.clone().ior(this)},s.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},s.prototype.iuand=function(E){var m;this.length>E.length?m=E:m=this;for(var f=0;fE.length?this.clone().iand(E):E.clone().iand(this)},s.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},s.prototype.iuxor=function(E){var m,f;this.length>E.length?(m=this,f=E):(m=E,f=this);for(var g=0;gE.length?this.clone().ixor(E):E.clone().ixor(this)},s.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},s.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var m=Math.ceil(E/26)|0,f=E%26;this._expand(m),f>0&&m--;for(var g=0;g0&&(this.words[g]=~this.words[g]&67108863>>26-f),this.strip()},s.prototype.notn=function(E){return this.clone().inotn(E)},s.prototype.setn=function(E,m){n(typeof E=="number"&&E>=0);var f=E/26|0,g=E%26;return this._expand(f+1),m?this.words[f]=this.words[f]|1<E.length?(f=this,g=E):(f=E,g=this);for(var v=0,x=0;x>>26;for(;v!==0&&x>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;xE.length?this.clone().iadd(E):E.clone().iadd(this)},s.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var m=this.iadd(E);return E.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var f=this.cmp(E);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var g,v;f>0?(g=this,v=E):(g=E,v=this);for(var x=0,_=0;_>26,this.words[_]=m&67108863;for(;x!==0&&_>26,this.words[_]=m&67108863;if(x===0&&_>>26,I=S&67108863,F=Math.min(b,E.length-1),ae=Math.max(0,b-G.length+1);ae<=F;ae++){var O=b-ae|0;g=G.words[O]|0,v=E.words[ae]|0,x=g*v+I,M+=x/67108864|0,I=x&67108863}m.words[b]=I|0,S=M|0}return S!==0?m.words[b]=S|0:m.length--,m.strip()}var N=function(E,m,f){var g=E.words,v=m.words,x=f.words,_=0,S,b,M,I=g[0]|0,F=I&8191,ae=I>>>13,O=g[1]|0,se=O&8191,ee=O>>>13,X=g[2]|0,Q=X&8191,R=X>>>13,Z=g[3]|0,te=Z&8191,le=Z>>>13,ie=g[4]|0,fe=ie&8191,ve=ie>>>13,Me=g[5]|0,Ne=Me&8191,Te=Me>>>13,$e=g[6]|0,Ie=$e&8191,Le=$e>>>13,Ve=g[7]|0,ke=Ve&8191,ze=Ve>>>13,He=g[8]|0,Se=He&8191,Qe=He>>>13,ct=g[9]|0,Be=ct&8191,et=ct>>>13,rt=v[0]|0,Je=rt&8191,pt=rt>>>13,ht=v[1]|0,ft=ht&8191,Ht=ht>>>13,Jt=v[2]|0,St=Jt&8191,er=Jt>>>13,Xt=v[3]|0,Ot=Xt&8191,Bt=Xt>>>13,Tt=v[4]|0,vt=Tt&8191,Dt=Tt>>>13,Lt=v[5]|0,bt=Lt&8191,$t=Lt>>>13,jt=v[6]|0,nt=jt&8191,Ft=jt>>>13,$=v[7]|0,W=$&8191,V=$>>>13,C=v[8]|0,Y=C&8191,U=C>>>13,oe=v[9]|0,pe=oe&8191,xe=oe>>>13;f.negative=E.negative^m.negative,f.length=19,S=Math.imul(F,Je),b=Math.imul(F,pt),b=b+Math.imul(ae,Je)|0,M=Math.imul(ae,pt);var Re=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Re>>>26)|0,Re&=67108863,S=Math.imul(se,Je),b=Math.imul(se,pt),b=b+Math.imul(ee,Je)|0,M=Math.imul(ee,pt),S=S+Math.imul(F,ft)|0,b=b+Math.imul(F,Ht)|0,b=b+Math.imul(ae,ft)|0,M=M+Math.imul(ae,Ht)|0;var De=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(De>>>26)|0,De&=67108863,S=Math.imul(Q,Je),b=Math.imul(Q,pt),b=b+Math.imul(R,Je)|0,M=Math.imul(R,pt),S=S+Math.imul(se,ft)|0,b=b+Math.imul(se,Ht)|0,b=b+Math.imul(ee,ft)|0,M=M+Math.imul(ee,Ht)|0,S=S+Math.imul(F,St)|0,b=b+Math.imul(F,er)|0,b=b+Math.imul(ae,St)|0,M=M+Math.imul(ae,er)|0;var it=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(it>>>26)|0,it&=67108863,S=Math.imul(te,Je),b=Math.imul(te,pt),b=b+Math.imul(le,Je)|0,M=Math.imul(le,pt),S=S+Math.imul(Q,ft)|0,b=b+Math.imul(Q,Ht)|0,b=b+Math.imul(R,ft)|0,M=M+Math.imul(R,Ht)|0,S=S+Math.imul(se,St)|0,b=b+Math.imul(se,er)|0,b=b+Math.imul(ee,St)|0,M=M+Math.imul(ee,er)|0,S=S+Math.imul(F,Ot)|0,b=b+Math.imul(F,Bt)|0,b=b+Math.imul(ae,Ot)|0,M=M+Math.imul(ae,Bt)|0;var Ue=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,S=Math.imul(fe,Je),b=Math.imul(fe,pt),b=b+Math.imul(ve,Je)|0,M=Math.imul(ve,pt),S=S+Math.imul(te,ft)|0,b=b+Math.imul(te,Ht)|0,b=b+Math.imul(le,ft)|0,M=M+Math.imul(le,Ht)|0,S=S+Math.imul(Q,St)|0,b=b+Math.imul(Q,er)|0,b=b+Math.imul(R,St)|0,M=M+Math.imul(R,er)|0,S=S+Math.imul(se,Ot)|0,b=b+Math.imul(se,Bt)|0,b=b+Math.imul(ee,Ot)|0,M=M+Math.imul(ee,Bt)|0,S=S+Math.imul(F,vt)|0,b=b+Math.imul(F,Dt)|0,b=b+Math.imul(ae,vt)|0,M=M+Math.imul(ae,Dt)|0;var gt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(gt>>>26)|0,gt&=67108863,S=Math.imul(Ne,Je),b=Math.imul(Ne,pt),b=b+Math.imul(Te,Je)|0,M=Math.imul(Te,pt),S=S+Math.imul(fe,ft)|0,b=b+Math.imul(fe,Ht)|0,b=b+Math.imul(ve,ft)|0,M=M+Math.imul(ve,Ht)|0,S=S+Math.imul(te,St)|0,b=b+Math.imul(te,er)|0,b=b+Math.imul(le,St)|0,M=M+Math.imul(le,er)|0,S=S+Math.imul(Q,Ot)|0,b=b+Math.imul(Q,Bt)|0,b=b+Math.imul(R,Ot)|0,M=M+Math.imul(R,Bt)|0,S=S+Math.imul(se,vt)|0,b=b+Math.imul(se,Dt)|0,b=b+Math.imul(ee,vt)|0,M=M+Math.imul(ee,Dt)|0,S=S+Math.imul(F,bt)|0,b=b+Math.imul(F,$t)|0,b=b+Math.imul(ae,bt)|0,M=M+Math.imul(ae,$t)|0;var st=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(st>>>26)|0,st&=67108863,S=Math.imul(Ie,Je),b=Math.imul(Ie,pt),b=b+Math.imul(Le,Je)|0,M=Math.imul(Le,pt),S=S+Math.imul(Ne,ft)|0,b=b+Math.imul(Ne,Ht)|0,b=b+Math.imul(Te,ft)|0,M=M+Math.imul(Te,Ht)|0,S=S+Math.imul(fe,St)|0,b=b+Math.imul(fe,er)|0,b=b+Math.imul(ve,St)|0,M=M+Math.imul(ve,er)|0,S=S+Math.imul(te,Ot)|0,b=b+Math.imul(te,Bt)|0,b=b+Math.imul(le,Ot)|0,M=M+Math.imul(le,Bt)|0,S=S+Math.imul(Q,vt)|0,b=b+Math.imul(Q,Dt)|0,b=b+Math.imul(R,vt)|0,M=M+Math.imul(R,Dt)|0,S=S+Math.imul(se,bt)|0,b=b+Math.imul(se,$t)|0,b=b+Math.imul(ee,bt)|0,M=M+Math.imul(ee,$t)|0,S=S+Math.imul(F,nt)|0,b=b+Math.imul(F,Ft)|0,b=b+Math.imul(ae,nt)|0,M=M+Math.imul(ae,Ft)|0;var tt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(tt>>>26)|0,tt&=67108863,S=Math.imul(ke,Je),b=Math.imul(ke,pt),b=b+Math.imul(ze,Je)|0,M=Math.imul(ze,pt),S=S+Math.imul(Ie,ft)|0,b=b+Math.imul(Ie,Ht)|0,b=b+Math.imul(Le,ft)|0,M=M+Math.imul(Le,Ht)|0,S=S+Math.imul(Ne,St)|0,b=b+Math.imul(Ne,er)|0,b=b+Math.imul(Te,St)|0,M=M+Math.imul(Te,er)|0,S=S+Math.imul(fe,Ot)|0,b=b+Math.imul(fe,Bt)|0,b=b+Math.imul(ve,Ot)|0,M=M+Math.imul(ve,Bt)|0,S=S+Math.imul(te,vt)|0,b=b+Math.imul(te,Dt)|0,b=b+Math.imul(le,vt)|0,M=M+Math.imul(le,Dt)|0,S=S+Math.imul(Q,bt)|0,b=b+Math.imul(Q,$t)|0,b=b+Math.imul(R,bt)|0,M=M+Math.imul(R,$t)|0,S=S+Math.imul(se,nt)|0,b=b+Math.imul(se,Ft)|0,b=b+Math.imul(ee,nt)|0,M=M+Math.imul(ee,Ft)|0,S=S+Math.imul(F,W)|0,b=b+Math.imul(F,V)|0,b=b+Math.imul(ae,W)|0,M=M+Math.imul(ae,V)|0;var At=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(At>>>26)|0,At&=67108863,S=Math.imul(Se,Je),b=Math.imul(Se,pt),b=b+Math.imul(Qe,Je)|0,M=Math.imul(Qe,pt),S=S+Math.imul(ke,ft)|0,b=b+Math.imul(ke,Ht)|0,b=b+Math.imul(ze,ft)|0,M=M+Math.imul(ze,Ht)|0,S=S+Math.imul(Ie,St)|0,b=b+Math.imul(Ie,er)|0,b=b+Math.imul(Le,St)|0,M=M+Math.imul(Le,er)|0,S=S+Math.imul(Ne,Ot)|0,b=b+Math.imul(Ne,Bt)|0,b=b+Math.imul(Te,Ot)|0,M=M+Math.imul(Te,Bt)|0,S=S+Math.imul(fe,vt)|0,b=b+Math.imul(fe,Dt)|0,b=b+Math.imul(ve,vt)|0,M=M+Math.imul(ve,Dt)|0,S=S+Math.imul(te,bt)|0,b=b+Math.imul(te,$t)|0,b=b+Math.imul(le,bt)|0,M=M+Math.imul(le,$t)|0,S=S+Math.imul(Q,nt)|0,b=b+Math.imul(Q,Ft)|0,b=b+Math.imul(R,nt)|0,M=M+Math.imul(R,Ft)|0,S=S+Math.imul(se,W)|0,b=b+Math.imul(se,V)|0,b=b+Math.imul(ee,W)|0,M=M+Math.imul(ee,V)|0,S=S+Math.imul(F,Y)|0,b=b+Math.imul(F,U)|0,b=b+Math.imul(ae,Y)|0,M=M+Math.imul(ae,U)|0;var Rt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,S=Math.imul(Be,Je),b=Math.imul(Be,pt),b=b+Math.imul(et,Je)|0,M=Math.imul(et,pt),S=S+Math.imul(Se,ft)|0,b=b+Math.imul(Se,Ht)|0,b=b+Math.imul(Qe,ft)|0,M=M+Math.imul(Qe,Ht)|0,S=S+Math.imul(ke,St)|0,b=b+Math.imul(ke,er)|0,b=b+Math.imul(ze,St)|0,M=M+Math.imul(ze,er)|0,S=S+Math.imul(Ie,Ot)|0,b=b+Math.imul(Ie,Bt)|0,b=b+Math.imul(Le,Ot)|0,M=M+Math.imul(Le,Bt)|0,S=S+Math.imul(Ne,vt)|0,b=b+Math.imul(Ne,Dt)|0,b=b+Math.imul(Te,vt)|0,M=M+Math.imul(Te,Dt)|0,S=S+Math.imul(fe,bt)|0,b=b+Math.imul(fe,$t)|0,b=b+Math.imul(ve,bt)|0,M=M+Math.imul(ve,$t)|0,S=S+Math.imul(te,nt)|0,b=b+Math.imul(te,Ft)|0,b=b+Math.imul(le,nt)|0,M=M+Math.imul(le,Ft)|0,S=S+Math.imul(Q,W)|0,b=b+Math.imul(Q,V)|0,b=b+Math.imul(R,W)|0,M=M+Math.imul(R,V)|0,S=S+Math.imul(se,Y)|0,b=b+Math.imul(se,U)|0,b=b+Math.imul(ee,Y)|0,M=M+Math.imul(ee,U)|0,S=S+Math.imul(F,pe)|0,b=b+Math.imul(F,xe)|0,b=b+Math.imul(ae,pe)|0,M=M+Math.imul(ae,xe)|0;var Mt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,S=Math.imul(Be,ft),b=Math.imul(Be,Ht),b=b+Math.imul(et,ft)|0,M=Math.imul(et,Ht),S=S+Math.imul(Se,St)|0,b=b+Math.imul(Se,er)|0,b=b+Math.imul(Qe,St)|0,M=M+Math.imul(Qe,er)|0,S=S+Math.imul(ke,Ot)|0,b=b+Math.imul(ke,Bt)|0,b=b+Math.imul(ze,Ot)|0,M=M+Math.imul(ze,Bt)|0,S=S+Math.imul(Ie,vt)|0,b=b+Math.imul(Ie,Dt)|0,b=b+Math.imul(Le,vt)|0,M=M+Math.imul(Le,Dt)|0,S=S+Math.imul(Ne,bt)|0,b=b+Math.imul(Ne,$t)|0,b=b+Math.imul(Te,bt)|0,M=M+Math.imul(Te,$t)|0,S=S+Math.imul(fe,nt)|0,b=b+Math.imul(fe,Ft)|0,b=b+Math.imul(ve,nt)|0,M=M+Math.imul(ve,Ft)|0,S=S+Math.imul(te,W)|0,b=b+Math.imul(te,V)|0,b=b+Math.imul(le,W)|0,M=M+Math.imul(le,V)|0,S=S+Math.imul(Q,Y)|0,b=b+Math.imul(Q,U)|0,b=b+Math.imul(R,Y)|0,M=M+Math.imul(R,U)|0,S=S+Math.imul(se,pe)|0,b=b+Math.imul(se,xe)|0,b=b+Math.imul(ee,pe)|0,M=M+Math.imul(ee,xe)|0;var Et=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Et>>>26)|0,Et&=67108863,S=Math.imul(Be,St),b=Math.imul(Be,er),b=b+Math.imul(et,St)|0,M=Math.imul(et,er),S=S+Math.imul(Se,Ot)|0,b=b+Math.imul(Se,Bt)|0,b=b+Math.imul(Qe,Ot)|0,M=M+Math.imul(Qe,Bt)|0,S=S+Math.imul(ke,vt)|0,b=b+Math.imul(ke,Dt)|0,b=b+Math.imul(ze,vt)|0,M=M+Math.imul(ze,Dt)|0,S=S+Math.imul(Ie,bt)|0,b=b+Math.imul(Ie,$t)|0,b=b+Math.imul(Le,bt)|0,M=M+Math.imul(Le,$t)|0,S=S+Math.imul(Ne,nt)|0,b=b+Math.imul(Ne,Ft)|0,b=b+Math.imul(Te,nt)|0,M=M+Math.imul(Te,Ft)|0,S=S+Math.imul(fe,W)|0,b=b+Math.imul(fe,V)|0,b=b+Math.imul(ve,W)|0,M=M+Math.imul(ve,V)|0,S=S+Math.imul(te,Y)|0,b=b+Math.imul(te,U)|0,b=b+Math.imul(le,Y)|0,M=M+Math.imul(le,U)|0,S=S+Math.imul(Q,pe)|0,b=b+Math.imul(Q,xe)|0,b=b+Math.imul(R,pe)|0,M=M+Math.imul(R,xe)|0;var dt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(dt>>>26)|0,dt&=67108863,S=Math.imul(Be,Ot),b=Math.imul(Be,Bt),b=b+Math.imul(et,Ot)|0,M=Math.imul(et,Bt),S=S+Math.imul(Se,vt)|0,b=b+Math.imul(Se,Dt)|0,b=b+Math.imul(Qe,vt)|0,M=M+Math.imul(Qe,Dt)|0,S=S+Math.imul(ke,bt)|0,b=b+Math.imul(ke,$t)|0,b=b+Math.imul(ze,bt)|0,M=M+Math.imul(ze,$t)|0,S=S+Math.imul(Ie,nt)|0,b=b+Math.imul(Ie,Ft)|0,b=b+Math.imul(Le,nt)|0,M=M+Math.imul(Le,Ft)|0,S=S+Math.imul(Ne,W)|0,b=b+Math.imul(Ne,V)|0,b=b+Math.imul(Te,W)|0,M=M+Math.imul(Te,V)|0,S=S+Math.imul(fe,Y)|0,b=b+Math.imul(fe,U)|0,b=b+Math.imul(ve,Y)|0,M=M+Math.imul(ve,U)|0,S=S+Math.imul(te,pe)|0,b=b+Math.imul(te,xe)|0,b=b+Math.imul(le,pe)|0,M=M+Math.imul(le,xe)|0;var _t=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(_t>>>26)|0,_t&=67108863,S=Math.imul(Be,vt),b=Math.imul(Be,Dt),b=b+Math.imul(et,vt)|0,M=Math.imul(et,Dt),S=S+Math.imul(Se,bt)|0,b=b+Math.imul(Se,$t)|0,b=b+Math.imul(Qe,bt)|0,M=M+Math.imul(Qe,$t)|0,S=S+Math.imul(ke,nt)|0,b=b+Math.imul(ke,Ft)|0,b=b+Math.imul(ze,nt)|0,M=M+Math.imul(ze,Ft)|0,S=S+Math.imul(Ie,W)|0,b=b+Math.imul(Ie,V)|0,b=b+Math.imul(Le,W)|0,M=M+Math.imul(Le,V)|0,S=S+Math.imul(Ne,Y)|0,b=b+Math.imul(Ne,U)|0,b=b+Math.imul(Te,Y)|0,M=M+Math.imul(Te,U)|0,S=S+Math.imul(fe,pe)|0,b=b+Math.imul(fe,xe)|0,b=b+Math.imul(ve,pe)|0,M=M+Math.imul(ve,xe)|0;var ot=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(ot>>>26)|0,ot&=67108863,S=Math.imul(Be,bt),b=Math.imul(Be,$t),b=b+Math.imul(et,bt)|0,M=Math.imul(et,$t),S=S+Math.imul(Se,nt)|0,b=b+Math.imul(Se,Ft)|0,b=b+Math.imul(Qe,nt)|0,M=M+Math.imul(Qe,Ft)|0,S=S+Math.imul(ke,W)|0,b=b+Math.imul(ke,V)|0,b=b+Math.imul(ze,W)|0,M=M+Math.imul(ze,V)|0,S=S+Math.imul(Ie,Y)|0,b=b+Math.imul(Ie,U)|0,b=b+Math.imul(Le,Y)|0,M=M+Math.imul(Le,U)|0,S=S+Math.imul(Ne,pe)|0,b=b+Math.imul(Ne,xe)|0,b=b+Math.imul(Te,pe)|0,M=M+Math.imul(Te,xe)|0;var wt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(wt>>>26)|0,wt&=67108863,S=Math.imul(Be,nt),b=Math.imul(Be,Ft),b=b+Math.imul(et,nt)|0,M=Math.imul(et,Ft),S=S+Math.imul(Se,W)|0,b=b+Math.imul(Se,V)|0,b=b+Math.imul(Qe,W)|0,M=M+Math.imul(Qe,V)|0,S=S+Math.imul(ke,Y)|0,b=b+Math.imul(ke,U)|0,b=b+Math.imul(ze,Y)|0,M=M+Math.imul(ze,U)|0,S=S+Math.imul(Ie,pe)|0,b=b+Math.imul(Ie,xe)|0,b=b+Math.imul(Le,pe)|0,M=M+Math.imul(Le,xe)|0;var lt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul(Be,W),b=Math.imul(Be,V),b=b+Math.imul(et,W)|0,M=Math.imul(et,V),S=S+Math.imul(Se,Y)|0,b=b+Math.imul(Se,U)|0,b=b+Math.imul(Qe,Y)|0,M=M+Math.imul(Qe,U)|0,S=S+Math.imul(ke,pe)|0,b=b+Math.imul(ke,xe)|0,b=b+Math.imul(ze,pe)|0,M=M+Math.imul(ze,xe)|0;var at=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(at>>>26)|0,at&=67108863,S=Math.imul(Be,Y),b=Math.imul(Be,U),b=b+Math.imul(et,Y)|0,M=Math.imul(et,U),S=S+Math.imul(Se,pe)|0,b=b+Math.imul(Se,xe)|0,b=b+Math.imul(Qe,pe)|0,M=M+Math.imul(Qe,xe)|0;var Ae=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,S=Math.imul(Be,pe),b=Math.imul(Be,xe),b=b+Math.imul(et,pe)|0,M=Math.imul(et,xe);var Pe=(_+S|0)+((b&8191)<<13)|0;return _=(M+(b>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,x[0]=Re,x[1]=De,x[2]=it,x[3]=Ue,x[4]=gt,x[5]=st,x[6]=tt,x[7]=At,x[8]=Rt,x[9]=Mt,x[10]=Et,x[11]=dt,x[12]=_t,x[13]=ot,x[14]=wt,x[15]=lt,x[16]=at,x[17]=Ae,x[18]=Pe,_!==0&&(x[19]=_,f.length++),f};Math.imul||(N=P);function D(G,E,m){m.negative=E.negative^G.negative,m.length=G.length+E.length;for(var f=0,g=0,v=0;v>>26)|0,g+=x>>>26,x&=67108863}m.words[v]=_,f=x,x=g}return f!==0?m.words[v]=f:m.length--,m.strip()}function k(G,E,m){var f=new B;return f.mulp(G,E,m)}s.prototype.mulTo=function(E,m){var f,g=this.length+E.length;return this.length===10&&E.length===10?f=N(this,E,m):g<63?f=P(this,E,m):g<1024?f=D(this,E,m):f=k(this,E,m),f};function B(G,E){this.x=G,this.y=E}B.prototype.makeRBT=function(E){for(var m=new Array(E),f=s.prototype._countBits(E)-1,g=0;g>=1;return g},B.prototype.permute=function(E,m,f,g,v,x){for(var _=0;_>>1)v++;return 1<>>13,f[2*x+1]=v&8191,v=v>>>13;for(x=2*m;x>=26,m+=g/67108864|0,m+=v>>>26,this.words[f]=v&67108863}return m!==0&&(this.words[f]=m,this.length++),this},s.prototype.muln=function(E){return this.clone().imuln(E)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(E){var m=A(E);if(m.length===0)return new s(1);for(var f=this,g=0;g=0);var m=E%26,f=(E-m)/26,g=67108863>>>26-m<<26-m,v;if(m!==0){var x=0;for(v=0;v>>26-m}x&&(this.words[v]=x,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var g;m?g=(m-m%26)/26:g=0;var v=E%26,x=Math.min((E-v)/26,this.length),_=67108863^67108863>>>v<x)for(this.length-=x,b=0;b=0&&(M!==0||b>=g);b--){var I=this.words[b]|0;this.words[b]=M<<26-v|I>>>v,M=I&_}return S&&M!==0&&(S.words[S.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(E,m,f){return n(this.negative===0),this.iushrn(E,m,f)},s.prototype.shln=function(E){return this.clone().ishln(E)},s.prototype.ushln=function(E){return this.clone().iushln(E)},s.prototype.shrn=function(E){return this.clone().ishrn(E)},s.prototype.ushrn=function(E){return this.clone().iushrn(E)},s.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var m=E%26,f=(E-m)/26,g=1<=0);var m=E%26,f=(E-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(m!==0&&f++,this.length=Math.min(f,this.length),m!==0){var g=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(S/67108864|0),this.words[v+f]=x&67108863}for(;v>26,this.words[v+f]=x&67108863;if(_===0)return this.strip();for(n(_===-1),_=0,v=0;v>26,this.words[v]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(E,m){var f=this.length-E.length,g=this.clone(),v=E,x=v.words[v.length-1]|0,_=this._countBits(x);f=26-_,f!==0&&(v=v.ushln(f),g.iushln(f),x=v.words[v.length-1]|0);var S=g.length-v.length,b;if(m!=="mod"){b=new s(null),b.length=S+1,b.words=new Array(b.length);for(var M=0;M=0;F--){var ae=(g.words[v.length+F]|0)*67108864+(g.words[v.length+F-1]|0);for(ae=Math.min(ae/x|0,67108863),g._ishlnsubmul(v,ae,F);g.negative!==0;)ae--,g.negative=0,g._ishlnsubmul(v,1,F),g.isZero()||(g.negative^=1);b&&(b.words[F]=ae)}return b&&b.strip(),g.strip(),m!=="div"&&f!==0&&g.iushrn(f),{div:b||null,mod:g}},s.prototype.divmod=function(E,m,f){if(n(!E.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var g,v,x;return this.negative!==0&&E.negative===0?(x=this.neg().divmod(E,m),m!=="mod"&&(g=x.div.neg()),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.iadd(E)),{div:g,mod:v}):this.negative===0&&E.negative!==0?(x=this.divmod(E.neg(),m),m!=="mod"&&(g=x.div.neg()),{div:g,mod:x.mod}):this.negative&E.negative?(x=this.neg().divmod(E.neg(),m),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.isub(E)),{div:x.div,mod:v}):E.length>this.length||this.cmp(E)<0?{div:new s(0),mod:this}:E.length===1?m==="div"?{div:this.divn(E.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new s(this.modn(E.words[0]))}:this._wordDiv(E,m)},s.prototype.div=function(E){return this.divmod(E,"div",!1).div},s.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},s.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},s.prototype.divRound=function(E){var m=this.divmod(E);if(m.mod.isZero())return m.div;var f=m.div.negative!==0?m.mod.isub(E):m.mod,g=E.ushrn(1),v=E.andln(1),x=f.cmp(g);return x<0||v===1&&x===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(E){n(E<=67108863);for(var m=(1<<26)%E,f=0,g=this.length-1;g>=0;g--)f=(m*f+(this.words[g]|0))%E;return f},s.prototype.idivn=function(E){n(E<=67108863);for(var m=0,f=this.length-1;f>=0;f--){var g=(this.words[f]|0)+m*67108864;this.words[f]=g/E|0,m=g%E}return this.strip()},s.prototype.divn=function(E){return this.clone().idivn(E)},s.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=new s(0),_=new s(1),S=0;m.isEven()&&f.isEven();)m.iushrn(1),f.iushrn(1),++S;for(var b=f.clone(),M=m.clone();!m.isZero();){for(var I=0,F=1;!(m.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(m.iushrn(I);I-- >0;)(g.isOdd()||v.isOdd())&&(g.iadd(b),v.isub(M)),g.iushrn(1),v.iushrn(1);for(var ae=0,O=1;!(f.words[0]&O)&&ae<26;++ae,O<<=1);if(ae>0)for(f.iushrn(ae);ae-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(b),_.isub(M)),x.iushrn(1),_.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(x),v.isub(_)):(f.isub(m),x.isub(g),_.isub(v))}return{a:x,b:_,gcd:f.iushln(S)}},s.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=f.clone();m.cmpn(1)>0&&f.cmpn(1)>0;){for(var _=0,S=1;!(m.words[0]&S)&&_<26;++_,S<<=1);if(_>0)for(m.iushrn(_);_-- >0;)g.isOdd()&&g.iadd(x),g.iushrn(1);for(var b=0,M=1;!(f.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(f.iushrn(b);b-- >0;)v.isOdd()&&v.iadd(x),v.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(v)):(f.isub(m),v.isub(g))}var I;return m.cmpn(1)===0?I=g:I=v,I.cmpn(0)<0&&I.iadd(E),I},s.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var m=this.clone(),f=E.clone();m.negative=0,f.negative=0;for(var g=0;m.isEven()&&f.isEven();g++)m.iushrn(1),f.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=m.cmp(f);if(v<0){var x=m;m=f,f=x}else if(v===0||f.cmpn(1)===0)break;m.isub(f)}while(!0);return f.iushln(g)},s.prototype.invm=function(E){return this.egcd(E).a.umod(E)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(E){return this.words[0]&E},s.prototype.bincn=function(E){n(typeof E=="number");var m=E%26,f=(E-m)/26,g=1<>>26,_&=67108863,this.words[x]=_}return v!==0&&(this.words[x]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(E){var m=E<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var f;if(this.length>1)f=1;else{m&&(E=-E),n(E<=67108863,"Number is too big");var g=this.words[0]|0;f=g===E?0:gE.length)return 1;if(this.length=0;f--){var g=this.words[f]|0,v=E.words[f]|0;if(g!==v){gv&&(m=1);break}}return m},s.prototype.gtn=function(E){return this.cmpn(E)===1},s.prototype.gt=function(E){return this.cmp(E)===1},s.prototype.gten=function(E){return this.cmpn(E)>=0},s.prototype.gte=function(E){return this.cmp(E)>=0},s.prototype.ltn=function(E){return this.cmpn(E)===-1},s.prototype.lt=function(E){return this.cmp(E)===-1},s.prototype.lten=function(E){return this.cmpn(E)<=0},s.prototype.lte=function(E){return this.cmp(E)<=0},s.prototype.eqn=function(E){return this.cmpn(E)===0},s.prototype.eq=function(E){return this.cmp(E)===0},s.red=function(E){return new ue(E)},s.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(E){return this.red=E,this},s.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},s.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},s.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},s.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},s.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},s.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},s.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},s.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var q={k256:null,p224:null,p192:null,p25519:null};function j(G,E){this.name=G,this.p=new s(E,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var E=new s(null);return E.words=new Array(Math.ceil(this.n/13)),E},j.prototype.ireduce=function(E){var m=E,f;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),f=m.bitLength();while(f>this.n);var g=f0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},j.prototype.split=function(E,m){E.iushrn(this.n,0,m)},j.prototype.imulK=function(E){return E.imul(this.k)};function H(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(H,j),H.prototype.split=function(E,m){for(var f=4194303,g=Math.min(E.length,9),v=0;v>>22,x=_}x>>>=22,E.words[v-10]=x,x===0&&E.length>10?E.length-=10:E.length-=9},H.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var m=0,f=0;f>>=26,E.words[f]=v,m=g}return m!==0&&(E.words[E.length++]=m),E},s._prime=function(E){if(q[E])return q[E];var m;if(E==="k256")m=new H;else if(E==="p224")m=new J;else if(E==="p192")m=new T;else if(E==="p25519")m=new z;else throw new Error("Unknown prime "+E);return q[E]=m,m};function ue(G){if(typeof G=="string"){var E=s._prime(G);this.m=E.p,this.prime=E}else n(G.gtn(1),"modulus must be greater than 1"),this.m=G,this.prime=null}ue.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},ue.prototype._verify2=function(E,m){n((E.negative|m.negative)===0,"red works only with positives"),n(E.red&&E.red===m.red,"red works only with red numbers")},ue.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},ue.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},ue.prototype.add=function(E,m){this._verify2(E,m);var f=E.add(m);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},ue.prototype.iadd=function(E,m){this._verify2(E,m);var f=E.iadd(m);return f.cmp(this.m)>=0&&f.isub(this.m),f},ue.prototype.sub=function(E,m){this._verify2(E,m);var f=E.sub(m);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},ue.prototype.isub=function(E,m){this._verify2(E,m);var f=E.isub(m);return f.cmpn(0)<0&&f.iadd(this.m),f},ue.prototype.shl=function(E,m){return this._verify1(E),this.imod(E.ushln(m))},ue.prototype.imul=function(E,m){return this._verify2(E,m),this.imod(E.imul(m))},ue.prototype.mul=function(E,m){return this._verify2(E,m),this.imod(E.mul(m))},ue.prototype.isqr=function(E){return this.imul(E,E.clone())},ue.prototype.sqr=function(E){return this.mul(E,E)},ue.prototype.sqrt=function(E){if(E.isZero())return E.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(E,f)}for(var g=this.m.subn(1),v=0;!g.isZero()&&g.andln(1)===0;)v++,g.iushrn(1);n(!g.isZero());var x=new s(1).toRed(this),_=x.redNeg(),S=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new s(2*b*b).toRed(this);this.pow(b,S).cmp(_)!==0;)b.redIAdd(_);for(var M=this.pow(b,g),I=this.pow(E,g.addn(1).iushrn(1)),F=this.pow(E,g),ae=v;F.cmp(x)!==0;){for(var O=F,se=0;O.cmp(x)!==0;se++)O=O.redSqr();n(se=0;v--){for(var M=m.words[v],I=b-1;I>=0;I--){var F=M>>I&1;if(x!==g[0]&&(x=this.sqr(x)),F===0&&_===0){S=0;continue}_<<=1,_|=F,S++,!(S!==f&&(v!==0||I!==0))&&(x=this.mul(x,g[_]),S=0,_=0)}b=26}return x},ue.prototype.convertTo=function(E){var m=E.umod(this.m);return m===E?m.clone():m},ue.prototype.convertFrom=function(E){var m=E.clone();return m.red=null,m},s.mont=function(E){return new _e(E)};function _e(G){ue.call(this,G),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(_e,ue),_e.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},_e.prototype.convertFrom=function(E){var m=this.imod(E.mul(this.rinv));return m.red=null,m},_e.prototype.imul=function(E,m){if(E.isZero()||m.isZero())return E.words[0]=0,E.length=1,E;var f=E.imul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.mul=function(E,m){if(E.isZero()||m.isZero())return new s(0)._forceRed(this);var f=E.mul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.invm=function(E){var m=this.imod(E._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,nn)}(Wm);var xo=Wm.exports,Km={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var u=0;u>8,p=l&255;d?a.push(d,p):a.push(p)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(N>>1)-1?k=(N>>1)-B:k=B,D.isubn(k)):k=0,A[P]=k,D.iushrn(1)}return A}e.getNAF=s;function o(d,p){var y=[[],[]];d=d.clone(),p=p.clone();for(var A=0,P=0,N;d.cmpn(-A)>0||p.cmpn(-P)>0;){var D=d.andln(3)+A&3,k=p.andln(3)+P&3;D===3&&(D=-1),k===3&&(k=-1);var B;D&1?(N=d.andln(7)+A&7,(N===3||N===5)&&k===2?B=-D:B=D):B=0,y[0].push(B);var q;k&1?(N=p.andln(7)+P&7,(N===3||N===5)&&D===2?q=-k:q=k):q=0,y[1].push(q),2*A===B+1&&(A=1-A),2*P===q+1&&(P=1-P),d.iushrn(1),p.iushrn(1)}return y}e.getJSF=o;function a(d,p,y){var A="_"+p;d.prototype[p]=function(){return this[A]!==void 0?this[A]:this[A]=y.call(this)}}e.cachedProperty=a;function u(d){return typeof d=="string"?e.toArray(d,"hex"):d}e.parseBytes=u;function l(d){return new r(d,"hex","le")}e.intFromLE=l}(Ti);var Vm={exports:{}},Gm;Vm.exports=function(e){return Gm||(Gm=new aa(null)),Gm.generate(e)};function aa(t){this.rand=t}if(Vm.exports.Rand=aa,aa.prototype.generate=function(e){return this._rand(e)},aa.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Rd=ca;ca.prototype.point=function(){throw new Error("Not implemented")},ca.prototype.validate=function(){throw new Error("Not implemented")},ca.prototype._fixedNafMul=function(e,r){Td(e.precomputed);var n=e._getDoubles(),i=Cd(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Td(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},ca.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var P=d-1,N=d;if(o[P]!==1||o[N]!==1){u[P]=Cd(n[P],o[P],this._bitLength),u[N]=Cd(n[N],o[N],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[N].length,l);continue}var D=[r[P],null,null,r[N]];r[P].y.cmp(r[N].y)===0?(D[1]=r[P].add(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg())):r[P].y.cmp(r[N].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].add(r[N].neg())):(D[1]=r[P].toJ().mixedAdd(r[N]),D[2]=r[P].toJ().mixedAdd(r[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=Nk(n[P],n[N]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[N]=new Array(l),p=0;p=0;d--){for(var T=0;d>=0;){var z=!0;for(p=0;p=0&&T++,H=H.dblp(T),d<0)break;for(p=0;p0?y=a[p][ue-1>>1]:ue<0&&(y=a[p][-ue-1>>1].neg()),y.type==="affine"?H=H.mixedAdd(y):H=H.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Ki.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),p.negative&&(p=p.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:p,b:y},{a:A,b:P}]},Vi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Vi.prototype.pointFromX=function(e,r){e=new en(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Vi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Vi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Nn.prototype.isInfinity=function(){return this.inf},Nn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Nn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Nn.prototype.getX=function(){return this.x.fromRed()},Nn.prototype.getY=function(){return this.y.fromRed()},Nn.prototype.mul=function(e){return e=new en(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Nn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Nn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Nn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Nn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Nn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function qn(t,e,r,n){yu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new en(0)):(this.x=new en(e,16),this.y=new en(r,16),this.z=new en(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Jm(qn,yu.BasePoint),Vi.prototype.jpoint=function(e,r,n){return new qn(this,e,r,n)},qn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},qn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},qn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(p).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(p)),N=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,N)},qn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),A=u.redMul(p.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},qn.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},qn.prototype.inspect=function(){return this.isInfinity()?"":""},qn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var wu=xo,T3=yd,Dd=Rd,$k=Ti;function xu(t){Dd.call(this,"mont",t),this.a=new wu(t.a,16).toRed(this.red),this.b=new wu(t.b,16).toRed(this.red),this.i4=new wu(4).toRed(this.red).redInvm(),this.two=new wu(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}T3(xu,Dd);var Fk=xu;xu.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function Ln(t,e,r){Dd.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new wu(e,16),this.z=new wu(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}T3(Ln,Dd.BasePoint),xu.prototype.decodePoint=function(e,r){return this.point($k.toArray(e,r),1)},xu.prototype.point=function(e,r){return new Ln(this,e,r)},xu.prototype.pointFromJSON=function(e){return Ln.fromJSON(this,e)},Ln.prototype.precompute=function(){},Ln.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Ln.fromJSON=function(e,r){return new Ln(e,r[0],r[1]||e.one)},Ln.prototype.inspect=function(){return this.isInfinity()?"":""},Ln.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Ln.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)},Ln.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Ln.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),u=s.redMul(i),l=r.z.redMul(a.redAdd(u).redSqr()),d=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(l,d)},Ln.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i},Ln.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Ln.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Ln.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Ln.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Ln.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var jk=Ti,_o=xo,R3=yd,Od=Rd,Uk=jk.assert;function zs(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Od.call(this,"edwards",t),this.a=new _o(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new _o(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new _o(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Uk(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}R3(zs,Od);var qk=zs;zs.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},zs.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},zs.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)},zs.prototype.pointFromX=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var u=a.fromRed().isOdd();return(r&&!u||!r&&u)&&(a=a.redNeg()),this.point(e,a)},zs.prototype.pointFromY=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)},zs.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function Hr(t,e,r,n,i){Od.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new _o(e,16),this.y=new _o(r,16),this.z=n?new _o(n,16):this.curve.one,this.t=i&&new _o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}R3(Hr,Od.BasePoint),zs.prototype.pointFromJSON=function(e){return Hr.fromJSON(this,e)},zs.prototype.point=function(e,r,n,i){return new Hr(this,e,r,n,i)},Hr.fromJSON=function(e,r){return new Hr(e,r[0],r[1],r[2])},Hr.prototype.inspect=function(){return this.isInfinity()?"":""},Hr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Hr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),u=i.redSub(r),l=s.redMul(a),d=o.redMul(u),p=s.redMul(u),y=a.redMul(o);return this.curve.point(l,d,y,p)},Hr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,u,l;if(this.curve.twisted){a=this.curve._mulA(r);var d=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(d.redSub(this.curve.two)),s=d.redMul(a.redSub(n)),o=d.redSqr().redSub(d).redSub(d)):(u=this.z.redSqr(),l=d.redSub(u).redISub(u),i=e.redSub(r).redISub(n).redMul(l),s=d.redMul(a.redSub(n)),o=d.redMul(l))}else a=r.redAdd(n),u=this.curve._mulC(this.z).redSqr(),l=a.redSub(u).redSub(u),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)},Hr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Hr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),u=s.redAdd(i),l=n.redAdd(r),d=o.redMul(a),p=u.redMul(l),y=o.redMul(l),A=a.redMul(u);return this.curve.point(d,p,A,y)},Hr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),u=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),d=r.redMul(a).redMul(l),p,y;return this.curve.twisted?(p=r.redMul(u).redMul(s.redSub(this.curve._mulA(i))),y=a.redMul(u)):(p=r.redMul(u).redMul(s.redSub(i)),y=this.curve._mulC(a).redMul(u)),this.curve.point(d,p,y)},Hr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Hr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Hr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)},Hr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)},Hr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Hr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Hr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Hr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Hr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Hr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Hr.prototype.toP=Hr.prototype.normalize,Hr.prototype.mixedAdd=Hr.prototype.add,function(t){var e=t;e.base=Rd,e.short=Bk,e.mont=Fk,e.edwards=qk}(Ym);var Nd={},Xm,D3;function zk(){return D3||(D3=1,Xm={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Xm}(function(t){var e=t,r=al,n=Ym,i=Ti,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,d){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var p=new o(d);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:p}),p}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=zk()}catch{u=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})})(Nd);var Hk=al,Za=Km,O3=Ga;function ua(t){if(!(this instanceof ua))return new ua(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Za.toArray(t.entropy,t.entropyEnc||"hex"),r=Za.toArray(t.nonce,t.nonceEnc||"hex"),n=Za.toArray(t.pers,t.persEnc||"hex");O3(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Wk=ua;ua.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ua.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Za.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var Ld=xo,Qm=Ti,Yk=Qm.assert;function kd(t,e){if(t instanceof kd)return t;this._importDER(t,e)||(Yk(t.r&&t.s,"Signature without r or s"),this.r=new Ld(t.r,16),this.s=new Ld(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Jk=kd;function Xk(){this.place=0}function e1(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function N3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}kd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=N3(r),n=N3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];t1(i,r.length),i=i.concat(r),i.push(2),t1(i,n.length);var s=i.concat(n),o=[48];return t1(o,s.length),o=o.concat(s),Qm.encode(o,e)};var Eo=xo,L3=Wk,Zk=Ti,r1=Nd,Qk=C3,k3=Zk.assert,n1=Gk,Bd=Jk;function Gi(t){if(!(this instanceof Gi))return new Gi(t);typeof t=="string"&&(k3(Object.prototype.hasOwnProperty.call(r1,t),"Unknown curve "+t),t=r1[t]),t instanceof r1.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var eB=Gi;Gi.prototype.keyPair=function(e){return new n1(this,e)},Gi.prototype.keyFromPrivate=function(e,r){return n1.fromPrivate(this,e,r)},Gi.prototype.keyFromPublic=function(e,r){return n1.fromPublic(this,e,r)},Gi.prototype.genKeyPair=function(e){e||(e={});for(var r=new L3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Qk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new Eo(2));;){var s=new Eo(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Gi.prototype._truncateToN=function(e,r,n){var i;if(Eo.isBN(e)||typeof e=="number")e=new Eo(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new Eo(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new Eo(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Gi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new L3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new Eo(1)),d=0;;d++){var p=i.k?i.k(d):new Eo(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var N=p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),D^=1),new Bd({r:P,s:N,recoveryParam:D})}}}}}},Gi.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new Bd(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),l=u.mul(e).umod(this.n),d=u.mul(o).umod(this.n),p;return this.curve._maxwellTrick?(p=this.g.jmulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.eqXToP(o)):(p=this.g.mulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.getX().umod(this.n).cmp(o)===0)},Gi.prototype.recoverPubKey=function(t,e,r,n){k3((3&r)===r,"The recovery param is more than two bits"),e=new Bd(e,n);var i=this.n,s=new Eo(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Gi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Bd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dl=Ti,B3=dl.assert,$3=dl.parseBytes,_u=dl.cachedProperty;function kn(t,e){this.eddsa=t,this._secret=$3(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=$3(e.pub)}kn.fromPublic=function(e,r){return r instanceof kn?r:new kn(e,{pub:r})},kn.fromSecret=function(e,r){return r instanceof kn?r:new kn(e,{secret:r})},kn.prototype.secret=function(){return this._secret},_u(kn,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),_u(kn,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),_u(kn,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i}),_u(kn,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),_u(kn,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),_u(kn,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),kn.prototype.sign=function(e){return B3(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},kn.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},kn.prototype.getSecret=function(e){return B3(this._secret,"KeyPair is public only"),dl.encode(this.secret(),e)},kn.prototype.getPublic=function(e){return dl.encode(this.pubBytes(),e)};var tB=kn,rB=xo,$d=Ti,F3=$d.assert,Fd=$d.cachedProperty,nB=$d.parseBytes;function Qa(t,e){this.eddsa=t,typeof e!="object"&&(e=nB(e)),Array.isArray(e)&&(F3(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),F3(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof rB&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Fd(Qa,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Fd(Qa,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Fd(Qa,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Fd(Qa,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Qa.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Qa.prototype.toHex=function(){return $d.encode(this.toBytes(),"hex").toUpperCase()};var iB=Qa,sB=al,oB=Nd,Eu=Ti,aB=Eu.assert,j3=Eu.parseBytes,U3=tB,q3=iB;function vi(t){if(aB(t==="ed25519","only tested with ed25519 so far"),!(this instanceof vi))return new vi(t);t=oB[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=sB.sha512}var cB=vi;vi.prototype.sign=function(e,r){e=j3(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),u=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:u,Rencoded:o})},vi.prototype.verify=function(e,r,n){if(e=j3(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)},vi.prototype.hashInt=function(){for(var e=this.hash(),r=0;re in t?lB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,K3=(t,e)=>{for(var r in e||(e={}))hB.call(e,r)&&W3(t,r,e[r]);if(H3)for(var r of H3(e))dB.call(e,r)&&W3(t,r,e[r]);return t};const pB="ReactNative",Ri={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},gB="js";function jd(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Au(){return!nl()&&!!mm()&&navigator.product===pB}function pl(){return!jd()&&!!mm()&&!!nl()}function gl(){return Au()?Ri.reactNative:jd()?Ri.node:pl()?Ri.browser:Ri.unknown}function mB(){var t;try{return Au()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function vB(t,e){let r=il.parse(t);return r=K3(K3({},r),e),t=il.stringify(r),t}function V3(){return Mx()||{name:"",description:"",url:"",icons:[""]}}function bB(){if(gl()===Ri.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=HO();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function yB(){var t;const e=gl();return e===Ri.browser?[e,((t=Px())==null?void 0:t.host)||"unknown"].join(":"):e}function G3(t,e,r){const n=bB(),i=yB();return[[t,e].join("-"),[gB,r].join("-"),n,i].join("/")}function wB({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const u=r.split("?"),l=G3(t,e,n),d={auth:i,ua:l,projectId:s,useOnCloseEvent:o,origin:a||void 0},p=vB(u[1]||"",d);return u[0]+"?"+p}function ec(t,e){return t.filter(r=>e.includes(r)).length===t.length}function Y3(t){return Object.fromEntries(t.entries())}function J3(t){return new Map(Object.entries(t))}function tc(t=mt.FIVE_MINUTES,e){const r=mt.toMiliseconds(t||mt.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Pu(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function X3(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function xB(t){return X3("topic",t)}function _B(t){return X3("id",t)}function Z3(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function En(t,e){return mt.fromMiliseconds(Date.now()+mt.toMiliseconds(t))}function fa(t){return Date.now()>=mt.toMiliseconds(t)}function vr(t,e){return`${t}${e?`:${e}`:""}`}function Ud(t=[],e=[]){return[...new Set([...t,...e])]}async function EB({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=SB(s,t,e),a=gl();if(a===Ri.browser){if(!((n=nl())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,PB()?"_blank":"_self","noreferrer noopener")}else a===Ri.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function SB(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${MB(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function AB(t,e){let r="";try{if(pl()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function Q3(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function e_(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function i1(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function PB(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function MB(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function t_(t){return Buffer.from(t,"base64").toString("utf-8")}const IB="https://rpc.walletconnect.org/v1";async function CB(t,e,r,n,i,s){switch(r.t){case"eip191":return TB(t,e,r.s);case"eip1271":return await RB(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function TB(t,e,r){return yk(zx(e),r).toLowerCase()===t.toLowerCase()}async function RB(t,e,r,n,i,s){const o=Su(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",d=r.substring(2),p=zx(e).substring(2),y=a+p+u+l+d,A=await fetch(`${s||IB}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:DB(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:y},"latest"]})}),{result:P}=await A.json();return P?P.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function DB(){return Date.now()+Math.floor(Math.random()*1e3)}var OB=Object.defineProperty,NB=Object.defineProperties,LB=Object.getOwnPropertyDescriptors,r_=Object.getOwnPropertySymbols,kB=Object.prototype.hasOwnProperty,BB=Object.prototype.propertyIsEnumerable,n_=(t,e,r)=>e in t?OB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$B=(t,e)=>{for(var r in e||(e={}))kB.call(e,r)&&n_(t,r,e[r]);if(r_)for(var r of r_(e))BB.call(e,r)&&n_(t,r,e[r]);return t},FB=(t,e)=>NB(t,LB(e));const jB="did:pkh:",s1=t=>t==null?void 0:t.split(":"),UB=t=>{const e=t&&s1(t);if(e)return t.includes(jB)?e[3]:e[1]},o1=t=>{const e=t&&s1(t);if(e)return e[2]+":"+e[3]},qd=t=>{const e=t&&s1(t);if(e)return e.pop()};async function i_(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=s_(i,i.iss),o=qd(i.iss);return await CB(o,s,n,o1(i.iss),r)}const s_=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=qd(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${UB(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,d=t.exp?`Expiration Time: ${t.exp}`:void 0,p=t.nbf?`Not Before: ${t.nbf}`:void 0,y=t.requestId?`Request ID: ${t.requestId}`:void 0,A=t.resources?`Resources:${t.resources.map(N=>` -- ${N}`).join("")}`:void 0,P=zd(t.resources);if(P){const N=ml(P);i=JB(i,N)}return[r,n,"",i,"",s,o,a,u,l,d,p,y,A].filter(N=>N!=null).join(` -`)};function qB(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function zB(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function rc(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function HB(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:WB(e,r,n)}}}function WB(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function o_(t){return rc(t),`urn:recap:${qB(t).replace(/=/g,"")}`}function ml(t){const e=zB(t.replace("urn:recap:",""));return rc(e),e}function KB(t,e,r){const n=HB(t,e,r);return o_(n)}function VB(t){return t&&t.includes("urn:recap:")}function GB(t,e){const r=ml(t),n=ml(e),i=YB(r,n);return o_(i)}function YB(t,e){rc(t),rc(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,u)=>a.localeCompare(u)).forEach(a=>{var u,l;n.att[i]=FB($B({},n.att[i]),{[a]:((u=t.att[i])==null?void 0:u[a])||((l=e.att[i])==null?void 0:l[a])})})}),n}function JB(t="",e){rc(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const u=Object.keys(e.att[a]).map(p=>({ability:p.split("/")[0],action:p.split("/")[1]}));u.sort((p,y)=>p.action.localeCompare(y.action));const l={};u.forEach(p=>{l[p.ability]||(l[p.ability]=[]),l[p.ability].push(p.action)});const d=Object.keys(l).map(p=>(i++,`(${i}) '${p}': '${l[p].join("', '")}' for '${a}'.`));n.push(d.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function a_(t){var e;const r=ml(t);rc(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function c_(t){const e=ml(t);rc(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function zd(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return VB(e)?e:void 0}const u_="base10",ni="base16",la="base64pad",vl="base64url",bl="utf8",f_=0,So=1,yl=2,XB=0,l_=1,wl=12,a1=32;function ZB(){const t=Hm.generateKeyPair();return{privateKey:Rn(t.secretKey,ni),publicKey:Rn(t.publicKey,ni)}}function c1(){const t=ta.randomBytes(a1);return Rn(t,ni)}function QB(t,e){const r=Hm.sharedKey(Dn(t,ni),Dn(e,ni),!0),n=new Dk(ll.SHA256,r).expand(a1);return Rn(n,ni)}function Hd(t){const e=ll.hash(Dn(t,ni));return Rn(e,ni)}function Ao(t){const e=ll.hash(Dn(t,bl));return Rn(e,ni)}function h_(t){return Dn(`${t}`,u_)}function nc(t){return Number(Rn(t,u_))}function e$(t){const e=h_(typeof t.type<"u"?t.type:f_);if(nc(e)===So&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Dn(t.senderPublicKey,ni):void 0,n=typeof t.iv<"u"?Dn(t.iv,ni):ta.randomBytes(wl),i=new Um.ChaCha20Poly1305(Dn(t.symKey,ni)).seal(n,Dn(t.message,bl));return d_({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function t$(t,e){const r=h_(yl),n=ta.randomBytes(wl),i=Dn(t,bl);return d_({type:r,sealed:i,iv:n,encoding:e})}function r$(t){const e=new Um.ChaCha20Poly1305(Dn(t.symKey,ni)),{sealed:r,iv:n}=xl({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Rn(i,bl)}function n$(t,e){const{sealed:r}=xl({encoded:t,encoding:e});return Rn(r,bl)}function d_(t){const{encoding:e=la}=t;if(nc(t.type)===yl)return Rn(pd([t.type,t.sealed]),e);if(nc(t.type)===So){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Rn(pd([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return Rn(pd([t.type,t.iv,t.sealed]),e)}function xl(t){const{encoded:e,encoding:r=la}=t,n=Dn(e,r),i=n.slice(XB,l_),s=l_;if(nc(i)===So){const l=s+a1,d=l+wl,p=n.slice(s,l),y=n.slice(l,d),A=n.slice(d);return{type:i,sealed:A,iv:y,senderPublicKey:p}}if(nc(i)===yl){const l=n.slice(s),d=ta.randomBytes(wl);return{type:i,sealed:l,iv:d}}const o=s+wl,a=n.slice(s,o),u=n.slice(o);return{type:i,sealed:u,iv:a}}function i$(t,e){const r=xl({encoded:t,encoding:e==null?void 0:e.encoding});return p_({type:nc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Rn(r.senderPublicKey,ni):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function p_(t){const e=(t==null?void 0:t.type)||f_;if(e===So){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function g_(t){return t.type===So&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function m_(t){return t.type===yl}function s$(t){return new M3.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function o$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function a$(t){return Buffer.from(o$(t),"base64")}function c$(t,e){const[r,n,i]=t.split("."),s=a$(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),u=`${r}.${n}`,l=new ll.SHA256().update(Buffer.from(u)).digest(),d=s$(e),p=Buffer.from(l).toString("hex");if(!d.verify(p,{r:o,s:a}))throw new Error("Invalid signature");return gm(t).payload}const u$="irn";function u1(t){return(t==null?void 0:t.relay)||{protocol:u$}}function _l(t){const e=uB[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var f$=Object.defineProperty,l$=Object.defineProperties,h$=Object.getOwnPropertyDescriptors,v_=Object.getOwnPropertySymbols,d$=Object.prototype.hasOwnProperty,p$=Object.prototype.propertyIsEnumerable,b_=(t,e,r)=>e in t?f$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,y_=(t,e)=>{for(var r in e||(e={}))d$.call(e,r)&&b_(t,r,e[r]);if(v_)for(var r of v_(e))p$.call(e,r)&&b_(t,r,e[r]);return t},g$=(t,e)=>l$(t,h$(e));function m$(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function w_(t){if(!t.includes("wc:")){const u=t_(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=il.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:v$(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:m$(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function v$(t){return t.startsWith("//")?t.substring(2):t}function b$(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function x_(t){return`${t.protocol}:${t.topic}@${t.version}?`+il.stringify(y_(g$(y_({symKey:t.symKey},b$(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Wd(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Mu(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function y$(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Mu(r.accounts))}),e}function w$(t,e){const r=[];return Object.values(t).forEach(n=>{Mu(n.accounts).includes(e)&&r.push(...n.methods)}),r}function x$(t,e){const r=[];return Object.values(t).forEach(n=>{Mu(n.accounts).includes(e)&&r.push(...n.events)}),r}function f1(t){return t.includes(":")}function El(t){return f1(t)?t.split(":")[0]:t}function _$(t){const e={};return t==null||t.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function __(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=_$(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=Ud(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const E$={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},S$={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ut(t,e){const{message:r,code:n}=S$[t];return{message:e?`${r} ${e}`:r,code:n}}function Dr(t,e){const{message:r,code:n}=E$[t];return{message:e?`${r} ${e}`:r,code:n}}function ic(t,e){return!!Array.isArray(t)}function Sl(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function bi(t){return typeof t>"u"}function an(t,e){return e&&bi(t)?!0:typeof t=="string"&&!!t.trim().length}function l1(t,e){return typeof t=="number"&&!isNaN(t)}function A$(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return ec(i,n)?(n.forEach(o=>{const{accounts:a,methods:u,events:l}=t.namespaces[o],d=Mu(a),p=r[o];(!ec(z3(o,p),d)||!ec(p.methods,u)||!ec(p.events,l))&&(s=!1)}),s):!1}function Kd(t){return an(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function P$(t){if(an(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Kd(r)}}return!1}function M$(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(an(t,!1)){if(e(t))return!0;const r=t_(t);return e(r)}}catch{}return!1}function I$(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function C$(t){return t==null?void 0:t.topic}function T$(t,e){let r=null;return an(t==null?void 0:t.publicKey,!1)||(r=ut("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function E_(t){let e=!0;return ic(t)?t.length&&(e=t.every(r=>an(r,!1))):e=!1,e}function R$(t,e,r){let n=null;return ic(e)&&e.length?e.forEach(i=>{n||Kd(i)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Kd(t)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function D$(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=R$(i,z3(i,s),`${e} ${r}`);o&&(n=o)}),n}function O$(t,e){let r=null;return ic(t)?t.forEach(n=>{r||P$(n)||(r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function N$(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=O$(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function L$(t,e){let r=null;return E_(t==null?void 0:t.methods)?E_(t==null?void 0:t.events)||(r=Dr("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Dr("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function S_(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=L$(n,`${e}, namespace`);i&&(r=i)}),r}function k$(t,e,r){let n=null;if(t&&Sl(t)){const i=S_(t,e);i&&(n=i);const s=D$(t,e,r);s&&(n=s)}else n=ut("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function h1(t,e){let r=null;if(t&&Sl(t)){const n=S_(t,e);n&&(r=n);const i=N$(t,e);i&&(r=i)}else r=ut("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function A_(t){return an(t.protocol,!0)}function B$(t,e){let r=!1;return t?t&&ic(t)&&t.length&&t.forEach(n=>{r=A_(n)}):r=!0,r}function $$(t){return typeof t=="number"}function yi(t){return typeof t<"u"&&typeof t!==null}function F$(t){return!(!t||typeof t!="object"||!t.code||!l1(t.code)||!t.message||!an(t.message,!1))}function j$(t){return!(bi(t)||!an(t.method,!1))}function U$(t){return!(bi(t)||bi(t.result)&&bi(t.error)||!l1(t.id)||!an(t.jsonrpc,!1))}function q$(t){return!(bi(t)||!an(t.name,!1))}function P_(t,e){return!(!Kd(e)||!y$(t).includes(e))}function z$(t,e,r){return an(r,!1)?w$(t,e).includes(r):!1}function H$(t,e,r){return an(r,!1)?x$(t,e).includes(r):!1}function M_(t,e,r){let n=null;const i=W$(t),s=K$(e),o=Object.keys(i),a=Object.keys(s),u=I_(Object.keys(t)),l=I_(Object.keys(e)),d=u.filter(p=>!l.includes(p));return d.length&&(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. + */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=nn:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],p=[4,1024,262144,67108864],y=[1,256,65536,16777216],A=[6,1536,393216,100663296],P=[0,8,16,24],O=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],D=[224,256,384,512],k=[128,256],B=["hex","buffer","arrayBuffer","array","digest"],q={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(N){return Object.prototype.toString.call(N)==="[object Array]"}),u&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(N){return typeof N=="object"&&N.buffer&&N.buffer.constructor===ArrayBuffer});for(var j=function(N,se,ee){return function(X){return new I(N,se,N).update(X)[ee]()}},H=function(N,se,ee){return function(X,Q){return new I(N,se,Q).update(X)[ee]()}},J=function(N,se,ee){return function(X,Q,R,Z){return f["cshake"+N].update(X,Q,R,Z)[ee]()}},T=function(N,se,ee){return function(X,Q,R,Z){return f["kmac"+N].update(X,Q,R,Z)[ee]()}},z=function(N,se,ee,X){for(var Q=0;Q>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ee>>5,this.extraBytes=(ee&31)>>3;for(var X=0;X<50;++X)this.s[X]=0}I.prototype.update=function(N){if(this.finalized)throw new Error(r);var se,ee=typeof N;if(ee!=="string"){if(ee==="object"){if(N===null)throw new Error(e);if(u&&N.constructor===ArrayBuffer)N=new Uint8Array(N);else if(!Array.isArray(N)&&(!u||!ArrayBuffer.isView(N)))throw new Error(e)}else throw new Error(e);se=!0}for(var X=this.blocks,Q=this.byteCount,R=N.length,Z=this.blockCount,te=0,le=this.s,ie,fe;te>2]|=N[te]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(X[ie>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=Q){for(this.start=ie-Q,this.block=X[Z],ie=0;ie>8,ee=N&255;ee>0;)Q.unshift(ee),N=N>>8,ee=N&255,++X;return se?Q.push(X):Q.unshift(X),this.update(Q),Q.length},I.prototype.encodeString=function(N){var se,ee=typeof N;if(ee!=="string"){if(ee==="object"){if(N===null)throw new Error(e);if(u&&N.constructor===ArrayBuffer)N=new Uint8Array(N);else if(!Array.isArray(N)&&(!u||!ArrayBuffer.isView(N)))throw new Error(e)}else throw new Error(e);se=!0}var X=0,Q=N.length;if(se)X=Q;else for(var R=0;R=57344?X+=3:(Z=65536+((Z&1023)<<10|N.charCodeAt(++R)&1023),X+=4)}return X+=this.encode(X*8),this.update(N),X},I.prototype.bytepad=function(N,se){for(var ee=this.encode(se),X=0;X>2]|=this.padding[se&3],this.lastByteIndex===this.byteCount)for(N[0]=N[ee],se=1;se>4&15]+l[te&15]+l[te>>12&15]+l[te>>8&15]+l[te>>20&15]+l[te>>16&15]+l[te>>28&15]+l[te>>24&15];R%N===0&&(ce(se),Q=0)}return X&&(te=se[Q],Z+=l[te>>4&15]+l[te&15],X>1&&(Z+=l[te>>12&15]+l[te>>8&15]),X>2&&(Z+=l[te>>20&15]+l[te>>16&15])),Z},I.prototype.arrayBuffer=function(){this.finalize();var N=this.blockCount,se=this.s,ee=this.outputBlocks,X=this.extraBytes,Q=0,R=0,Z=this.outputBits>>3,te;X?te=new ArrayBuffer(ee+1<<2):te=new ArrayBuffer(Z);for(var le=new Uint32Array(te);R>8&255,Z[te+2]=le>>16&255,Z[te+3]=le>>24&255;R%N===0&&ce(se)}return X&&(te=R<<2,le=se[Q],Z[te]=le&255,X>1&&(Z[te+1]=le>>8&255),X>2&&(Z[te+2]=le>>16&255)),Z};function F(N,se,ee){I.call(this,N,se,ee)}F.prototype=new I,F.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var ce=function(N){var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me,Ne,Te,$e,Ie,Le,Ve,ke,ze,He,Ee,Qe,ct,Be,et,rt,Je,pt,ht,ft,Ht,Jt,St,er,Xt,Ot,Bt,Tt,vt,Dt,Lt,bt,$t,jt,nt,Ft,$,W,V,C,Y,U,oe,ge,xe,Re,De,it,Ue,gt,st,tt;for(X=0;X<48;X+=2)Q=N[0]^N[10]^N[20]^N[30]^N[40],R=N[1]^N[11]^N[21]^N[31]^N[41],Z=N[2]^N[12]^N[22]^N[32]^N[42],te=N[3]^N[13]^N[23]^N[33]^N[43],le=N[4]^N[14]^N[24]^N[34]^N[44],ie=N[5]^N[15]^N[25]^N[35]^N[45],fe=N[6]^N[16]^N[26]^N[36]^N[46],ve=N[7]^N[17]^N[27]^N[37]^N[47],Me=N[8]^N[18]^N[28]^N[38]^N[48],Ne=N[9]^N[19]^N[29]^N[39]^N[49],se=Me^(Z<<1|te>>>31),ee=Ne^(te<<1|Z>>>31),N[0]^=se,N[1]^=ee,N[10]^=se,N[11]^=ee,N[20]^=se,N[21]^=ee,N[30]^=se,N[31]^=ee,N[40]^=se,N[41]^=ee,se=Q^(le<<1|ie>>>31),ee=R^(ie<<1|le>>>31),N[2]^=se,N[3]^=ee,N[12]^=se,N[13]^=ee,N[22]^=se,N[23]^=ee,N[32]^=se,N[33]^=ee,N[42]^=se,N[43]^=ee,se=Z^(fe<<1|ve>>>31),ee=te^(ve<<1|fe>>>31),N[4]^=se,N[5]^=ee,N[14]^=se,N[15]^=ee,N[24]^=se,N[25]^=ee,N[34]^=se,N[35]^=ee,N[44]^=se,N[45]^=ee,se=le^(Me<<1|Ne>>>31),ee=ie^(Ne<<1|Me>>>31),N[6]^=se,N[7]^=ee,N[16]^=se,N[17]^=ee,N[26]^=se,N[27]^=ee,N[36]^=se,N[37]^=ee,N[46]^=se,N[47]^=ee,se=fe^(Q<<1|R>>>31),ee=ve^(R<<1|Q>>>31),N[8]^=se,N[9]^=ee,N[18]^=se,N[19]^=ee,N[28]^=se,N[29]^=ee,N[38]^=se,N[39]^=ee,N[48]^=se,N[49]^=ee,Te=N[0],$e=N[1],nt=N[11]<<4|N[10]>>>28,Ft=N[10]<<4|N[11]>>>28,Je=N[20]<<3|N[21]>>>29,pt=N[21]<<3|N[20]>>>29,Ue=N[31]<<9|N[30]>>>23,gt=N[30]<<9|N[31]>>>23,Lt=N[40]<<18|N[41]>>>14,bt=N[41]<<18|N[40]>>>14,St=N[2]<<1|N[3]>>>31,er=N[3]<<1|N[2]>>>31,Ie=N[13]<<12|N[12]>>>20,Le=N[12]<<12|N[13]>>>20,$=N[22]<<10|N[23]>>>22,W=N[23]<<10|N[22]>>>22,ht=N[33]<<13|N[32]>>>19,ft=N[32]<<13|N[33]>>>19,st=N[42]<<2|N[43]>>>30,tt=N[43]<<2|N[42]>>>30,oe=N[5]<<30|N[4]>>>2,ge=N[4]<<30|N[5]>>>2,Xt=N[14]<<6|N[15]>>>26,Ot=N[15]<<6|N[14]>>>26,Ve=N[25]<<11|N[24]>>>21,ke=N[24]<<11|N[25]>>>21,V=N[34]<<15|N[35]>>>17,C=N[35]<<15|N[34]>>>17,Ht=N[45]<<29|N[44]>>>3,Jt=N[44]<<29|N[45]>>>3,ct=N[6]<<28|N[7]>>>4,Be=N[7]<<28|N[6]>>>4,xe=N[17]<<23|N[16]>>>9,Re=N[16]<<23|N[17]>>>9,Bt=N[26]<<25|N[27]>>>7,Tt=N[27]<<25|N[26]>>>7,ze=N[36]<<21|N[37]>>>11,He=N[37]<<21|N[36]>>>11,Y=N[47]<<24|N[46]>>>8,U=N[46]<<24|N[47]>>>8,$t=N[8]<<27|N[9]>>>5,jt=N[9]<<27|N[8]>>>5,et=N[18]<<20|N[19]>>>12,rt=N[19]<<20|N[18]>>>12,De=N[29]<<7|N[28]>>>25,it=N[28]<<7|N[29]>>>25,vt=N[38]<<8|N[39]>>>24,Dt=N[39]<<8|N[38]>>>24,Ee=N[48]<<14|N[49]>>>18,Qe=N[49]<<14|N[48]>>>18,N[0]=Te^~Ie&Ve,N[1]=$e^~Le&ke,N[10]=ct^~et&Je,N[11]=Be^~rt&pt,N[20]=St^~Xt&Bt,N[21]=er^~Ot&Tt,N[30]=$t^~nt&$,N[31]=jt^~Ft&W,N[40]=oe^~xe&De,N[41]=ge^~Re&it,N[2]=Ie^~Ve&ze,N[3]=Le^~ke&He,N[12]=et^~Je&ht,N[13]=rt^~pt&ft,N[22]=Xt^~Bt&vt,N[23]=Ot^~Tt&Dt,N[32]=nt^~$&V,N[33]=Ft^~W&C,N[42]=xe^~De&Ue,N[43]=Re^~it>,N[4]=Ve^~ze&Ee,N[5]=ke^~He&Qe,N[14]=Je^~ht&Ht,N[15]=pt^~ft&Jt,N[24]=Bt^~vt&Lt,N[25]=Tt^~Dt&bt,N[34]=$^~V&Y,N[35]=W^~C&U,N[44]=De^~Ue&st,N[45]=it^~gt&tt,N[6]=ze^~Ee&Te,N[7]=He^~Qe&$e,N[16]=ht^~Ht&ct,N[17]=ft^~Jt&Be,N[26]=vt^~Lt&St,N[27]=Dt^~bt&er,N[36]=V^~Y&$t,N[37]=C^~U&jt,N[46]=Ue^~st&oe,N[47]=gt^~tt&ge,N[8]=Ee^~Te&Ie,N[9]=Qe^~$e&Le,N[18]=Ht^~ct&et,N[19]=Jt^~Be&rt,N[28]=Lt^~St&Xt,N[29]=bt^~er&Ot,N[38]=Y^~$t&nt,N[39]=U^~jt&Ft,N[48]=st^~oe&xe,N[49]=tt^~ge&Re,N[0]^=O[X],N[1]^=O[X+1]};if(a)t.exports=f;else for(v=0;v{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const Lx=mN();var wm;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(wm||(wm={}));var ps;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(ps||(ps={}));const kx="0123456789abcdef";class Kr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();vd[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Nx>vd[n])&&console.log.apply(console,r)}debug(...e){this._log(Kr.levels.DEBUG,e)}info(...e){this._log(Kr.levels.INFO,e)}warn(...e){this._log(Kr.levels.WARNING,e)}makeError(e,r,n){if(Ox)return this.makeError("censored error",r,{});r||(r=Kr.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(u=>{const l=n[u];try{if(l instanceof Uint8Array){let d="";for(let p=0;p>4],d+=kx[l[p]&15];i.push(u+"=Uint8Array(0x"+d+")")}else i.push(u+"="+JSON.stringify(l))}catch{i.push(u+"="+JSON.stringify(n[u].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case ps.NUMERIC_FAULT:{o="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case ps.CALL_EXCEPTION:case ps.INSUFFICIENT_FUNDS:case ps.MISSING_NEW:case ps.NONCE_EXPIRED:case ps.REPLACEMENT_UNDERPRICED:case ps.TRANSACTION_REPLACED:case ps.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(u){a[u]=n[u]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Kr.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){Lx&&this.throwError("platform missing String.prototype.normalize",Kr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Lx})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Kr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Kr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return ym||(ym=new Kr(gN)),ym}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Dx){if(!e)return;this.globalLogger().throwError("error censorship permanent",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Ox=!!e,Dx=!!r}static setLogLevel(e){const r=vd[e.toLowerCase()];if(r==null){Kr.globalLogger().warn("invalid log level - "+e);return}Nx=r}static from(e){return new Kr(e)}}Kr.errors=ps,Kr.levels=wm;const vN="bytes/5.7.0",on=new Kr(vN);function Bx(t){return!!t.toHexString}function fu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return fu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function bN(t){return Ns(t)&&!(t.length%2)||xm(t)}function $x(t){return typeof t=="number"&&t==t&&t%1===0}function xm(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!$x(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function bn(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),fu(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),Bx(t)&&(t=t.toHexString()),Ns(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":on.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ibn(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),fu(n)}function wN(t,e){t=bn(t),t.length>e&&on.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),fu(r)}function Ns(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const _m="0123456789abcdef";function Ii(t,e){if(e||(e={}),typeof t=="number"){on.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=_m[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),Bx(t))return t.toHexString();if(Ns(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":on.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(xm(t)){let r="0x";for(let n=0;n>4]+_m[i&15]}return r}return on.throwArgumentError("invalid hexlify value","value",t)}function xN(t){if(typeof t!="string")t=Ii(t);else if(!Ns(t)||t.length%2)return null;return(t.length-2)/2}function Fx(t,e,r){return typeof t!="string"?t=Ii(t):(!Ns(t)||t.length%2)&&on.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function lu(t,e){for(typeof t!="string"?t=Ii(t):Ns(t)||on.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&on.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function jx(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(bN(t)){let r=bn(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64))):r.length===65?(e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64)),e.v=r[64]):on.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:on.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Ii(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=wN(bn(e._vs),32);e._vs=Ii(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&on.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=Ii(i);e.s==null?e.s=o:e.s!==o&&on.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?on.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&on.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Ns(e.r)?on.throwArgumentError("signature missing or invalid r","signature",t):e.r=lu(e.r,32),e.s==null||!Ns(e.s)?on.throwArgumentError("signature missing or invalid s","signature",t):e.s=lu(e.s,32);const r=bn(e.s);r[0]>=128&&on.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=Ii(r);e._vs&&(Ns(e._vs)||on.throwArgumentError("signature invalid _vs","signature",t),e._vs=lu(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&on.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Em(t){return"0x"+pN.keccak_256(bn(t))}var Sm={exports:{}};Sm.exports,function(t){(function(e,r){function n(m,f){if(!m)throw new Error(f||"Assertion failed")}function i(m,f){m.super_=f;var g=function(){};g.prototype=f.prototype,m.prototype=new g,m.prototype.constructor=m}function s(m,f,g){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((f==="le"||f==="be")&&(g=f,f=10),this._init(m||0,f||10,g||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,g){return f.cmp(g)>0?f:g},s.min=function(f,g){return f.cmp(g)<0?f:g},s.prototype._init=function(f,g,v){if(typeof f=="number")return this._initNumber(f,g,v);if(typeof f=="object")return this._initArray(f,g,v);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),f=f.toString().replace(/\s+/g,"");var x=0;f[0]==="-"&&(x++,this.negative=1),x=0;x-=3)S=f[x]|f[x-1]<<8|f[x-2]<<16,this.words[_]|=S<>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);else if(v==="le")for(x=0,_=0;x>>26-b&67108863,b+=24,b>=26&&(b-=26,_++);return this._strip()};function a(m,f){var g=m.charCodeAt(f);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+m)}function u(m,f,g){var v=a(m,g);return g-1>=f&&(v|=a(m,g-1)<<4),v}s.prototype._parseHex=function(f,g,v){this.length=Math.ceil((f.length-g)/6),this.words=new Array(this.length);for(var x=0;x=g;x-=2)b=u(f,g,x)<<_,this.words[S]|=b&67108863,_>=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8;else{var M=f.length-g;for(x=M%2===0?g+1:g;x=18?(_-=18,S+=1,this.words[S]|=b>>>26):_+=8}this._strip()};function l(m,f,g,v){for(var x=0,_=0,S=Math.min(m.length,g),b=f;b=49?_=M-49+10:M>=17?_=M-17+10:_=M,n(M>=0&&_1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{s.prototype.inspect=p}else s.prototype.inspect=p;function p(){return(this.red?""}var y=["","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"],A=[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,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(f,g){f=f||10,g=g|0||1;var v;if(f===16||f==="hex"){v="";for(var x=0,_=0,S=0;S>>24-x&16777215,x+=2,x>=26&&(x-=26,S--),_!==0||S!==this.length-1?v=y[6-M.length]+M+v:v=M+v}for(_!==0&&(v=_.toString(16)+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(f===(f|0)&&f>=2&&f<=36){var I=A[f],F=P[f];v="";var ce=this.clone();for(ce.negative=0;!ce.isZero();){var N=ce.modrn(F).toString(f);ce=ce.idivn(F),ce.isZero()?v=N+v:v=y[I-N.length]+N+v}for(this.isZero()&&(v="0"+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,g){return this.toArrayLike(o,f,g)}),s.prototype.toArray=function(f,g){return this.toArrayLike(Array,f,g)};var O=function(f,g){return f.allocUnsafe?f.allocUnsafe(g):new f(g)};s.prototype.toArrayLike=function(f,g,v){this._strip();var x=this.byteLength(),_=v||Math.max(1,x);n(x<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var S=O(f,_),b=g==="le"?"LE":"BE";return this["_toArrayLike"+b](S,x),S},s.prototype._toArrayLikeLE=function(f,g){for(var v=0,x=0,_=0,S=0;_>8&255),v>16&255),S===6?(v>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v=0&&(f[v--]=b>>8&255),v>=0&&(f[v--]=b>>16&255),S===6?(v>=0&&(f[v--]=b>>24&255),x=0,S=0):(x=b>>>24,S+=2)}if(v>=0)for(f[v--]=x;v>=0;)f[v--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var g=f,v=0;return g>=4096&&(v+=13,g>>>=13),g>=64&&(v+=7,g>>>=7),g>=8&&(v+=4,g>>>=4),g>=2&&(v+=2,g>>>=2),v+g},s.prototype._zeroBits=function(f){if(f===0)return 26;var g=f,v=0;return g&8191||(v+=13,g>>>=13),g&127||(v+=7,g>>>=7),g&15||(v+=4,g>>>=4),g&3||(v+=2,g>>>=2),g&1||v++,v},s.prototype.bitLength=function(){var f=this.words[this.length-1],g=this._countBits(f);return(this.length-1)*26+g};function D(m){for(var f=new Array(m.bitLength()),g=0;g>>x&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,g=0;gf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var g;this.length>f.length?g=f:g=this;for(var v=0;vf.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var g,v;this.length>f.length?(g=this,v=f):(g=f,v=this);for(var x=0;xf.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var g=Math.ceil(f/26)|0,v=f%26;this._expand(g),v>0&&g--;for(var x=0;x0&&(this.words[x]=~this.words[x]&67108863>>26-v),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,g){n(typeof f=="number"&&f>=0);var v=f/26|0,x=f%26;return this._expand(v+1),g?this.words[v]=this.words[v]|1<f.length?(v=this,x=f):(v=f,x=this);for(var _=0,S=0;S>>26;for(;_!==0&&S>>26;if(this.length=v.length,_!==0)this.words[this.length]=_,this.length++;else if(v!==this)for(;Sf.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var g=this.iadd(f);return f.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var v=this.cmp(f);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,_;v>0?(x=this,_=f):(x=f,_=this);for(var S=0,b=0;b<_.length;b++)g=(x.words[b]|0)-(_.words[b]|0)+S,S=g>>26,this.words[b]=g&67108863;for(;S!==0&&b>26,this.words[b]=g&67108863;if(S===0&&b>>26,ce=M&67108863,N=Math.min(I,f.length-1),se=Math.max(0,I-m.length+1);se<=N;se++){var ee=I-se|0;x=m.words[ee]|0,_=f.words[se]|0,S=x*_+ce,F+=S/67108864|0,ce=S&67108863}g.words[I]=ce|0,M=F|0}return M!==0?g.words[I]=M|0:g.length--,g._strip()}var B=function(f,g,v){var x=f.words,_=g.words,S=v.words,b=0,M,I,F,ce=x[0]|0,N=ce&8191,se=ce>>>13,ee=x[1]|0,X=ee&8191,Q=ee>>>13,R=x[2]|0,Z=R&8191,te=R>>>13,le=x[3]|0,ie=le&8191,fe=le>>>13,ve=x[4]|0,Me=ve&8191,Ne=ve>>>13,Te=x[5]|0,$e=Te&8191,Ie=Te>>>13,Le=x[6]|0,Ve=Le&8191,ke=Le>>>13,ze=x[7]|0,He=ze&8191,Ee=ze>>>13,Qe=x[8]|0,ct=Qe&8191,Be=Qe>>>13,et=x[9]|0,rt=et&8191,Je=et>>>13,pt=_[0]|0,ht=pt&8191,ft=pt>>>13,Ht=_[1]|0,Jt=Ht&8191,St=Ht>>>13,er=_[2]|0,Xt=er&8191,Ot=er>>>13,Bt=_[3]|0,Tt=Bt&8191,vt=Bt>>>13,Dt=_[4]|0,Lt=Dt&8191,bt=Dt>>>13,$t=_[5]|0,jt=$t&8191,nt=$t>>>13,Ft=_[6]|0,$=Ft&8191,W=Ft>>>13,V=_[7]|0,C=V&8191,Y=V>>>13,U=_[8]|0,oe=U&8191,ge=U>>>13,xe=_[9]|0,Re=xe&8191,De=xe>>>13;v.negative=f.negative^g.negative,v.length=19,M=Math.imul(N,ht),I=Math.imul(N,ft),I=I+Math.imul(se,ht)|0,F=Math.imul(se,ft);var it=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(it>>>26)|0,it&=67108863,M=Math.imul(X,ht),I=Math.imul(X,ft),I=I+Math.imul(Q,ht)|0,F=Math.imul(Q,ft),M=M+Math.imul(N,Jt)|0,I=I+Math.imul(N,St)|0,I=I+Math.imul(se,Jt)|0,F=F+Math.imul(se,St)|0;var Ue=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,M=Math.imul(Z,ht),I=Math.imul(Z,ft),I=I+Math.imul(te,ht)|0,F=Math.imul(te,ft),M=M+Math.imul(X,Jt)|0,I=I+Math.imul(X,St)|0,I=I+Math.imul(Q,Jt)|0,F=F+Math.imul(Q,St)|0,M=M+Math.imul(N,Xt)|0,I=I+Math.imul(N,Ot)|0,I=I+Math.imul(se,Xt)|0,F=F+Math.imul(se,Ot)|0;var gt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(gt>>>26)|0,gt&=67108863,M=Math.imul(ie,ht),I=Math.imul(ie,ft),I=I+Math.imul(fe,ht)|0,F=Math.imul(fe,ft),M=M+Math.imul(Z,Jt)|0,I=I+Math.imul(Z,St)|0,I=I+Math.imul(te,Jt)|0,F=F+Math.imul(te,St)|0,M=M+Math.imul(X,Xt)|0,I=I+Math.imul(X,Ot)|0,I=I+Math.imul(Q,Xt)|0,F=F+Math.imul(Q,Ot)|0,M=M+Math.imul(N,Tt)|0,I=I+Math.imul(N,vt)|0,I=I+Math.imul(se,Tt)|0,F=F+Math.imul(se,vt)|0;var st=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(st>>>26)|0,st&=67108863,M=Math.imul(Me,ht),I=Math.imul(Me,ft),I=I+Math.imul(Ne,ht)|0,F=Math.imul(Ne,ft),M=M+Math.imul(ie,Jt)|0,I=I+Math.imul(ie,St)|0,I=I+Math.imul(fe,Jt)|0,F=F+Math.imul(fe,St)|0,M=M+Math.imul(Z,Xt)|0,I=I+Math.imul(Z,Ot)|0,I=I+Math.imul(te,Xt)|0,F=F+Math.imul(te,Ot)|0,M=M+Math.imul(X,Tt)|0,I=I+Math.imul(X,vt)|0,I=I+Math.imul(Q,Tt)|0,F=F+Math.imul(Q,vt)|0,M=M+Math.imul(N,Lt)|0,I=I+Math.imul(N,bt)|0,I=I+Math.imul(se,Lt)|0,F=F+Math.imul(se,bt)|0;var tt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(tt>>>26)|0,tt&=67108863,M=Math.imul($e,ht),I=Math.imul($e,ft),I=I+Math.imul(Ie,ht)|0,F=Math.imul(Ie,ft),M=M+Math.imul(Me,Jt)|0,I=I+Math.imul(Me,St)|0,I=I+Math.imul(Ne,Jt)|0,F=F+Math.imul(Ne,St)|0,M=M+Math.imul(ie,Xt)|0,I=I+Math.imul(ie,Ot)|0,I=I+Math.imul(fe,Xt)|0,F=F+Math.imul(fe,Ot)|0,M=M+Math.imul(Z,Tt)|0,I=I+Math.imul(Z,vt)|0,I=I+Math.imul(te,Tt)|0,F=F+Math.imul(te,vt)|0,M=M+Math.imul(X,Lt)|0,I=I+Math.imul(X,bt)|0,I=I+Math.imul(Q,Lt)|0,F=F+Math.imul(Q,bt)|0,M=M+Math.imul(N,jt)|0,I=I+Math.imul(N,nt)|0,I=I+Math.imul(se,jt)|0,F=F+Math.imul(se,nt)|0;var At=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(At>>>26)|0,At&=67108863,M=Math.imul(Ve,ht),I=Math.imul(Ve,ft),I=I+Math.imul(ke,ht)|0,F=Math.imul(ke,ft),M=M+Math.imul($e,Jt)|0,I=I+Math.imul($e,St)|0,I=I+Math.imul(Ie,Jt)|0,F=F+Math.imul(Ie,St)|0,M=M+Math.imul(Me,Xt)|0,I=I+Math.imul(Me,Ot)|0,I=I+Math.imul(Ne,Xt)|0,F=F+Math.imul(Ne,Ot)|0,M=M+Math.imul(ie,Tt)|0,I=I+Math.imul(ie,vt)|0,I=I+Math.imul(fe,Tt)|0,F=F+Math.imul(fe,vt)|0,M=M+Math.imul(Z,Lt)|0,I=I+Math.imul(Z,bt)|0,I=I+Math.imul(te,Lt)|0,F=F+Math.imul(te,bt)|0,M=M+Math.imul(X,jt)|0,I=I+Math.imul(X,nt)|0,I=I+Math.imul(Q,jt)|0,F=F+Math.imul(Q,nt)|0,M=M+Math.imul(N,$)|0,I=I+Math.imul(N,W)|0,I=I+Math.imul(se,$)|0,F=F+Math.imul(se,W)|0;var Rt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,M=Math.imul(He,ht),I=Math.imul(He,ft),I=I+Math.imul(Ee,ht)|0,F=Math.imul(Ee,ft),M=M+Math.imul(Ve,Jt)|0,I=I+Math.imul(Ve,St)|0,I=I+Math.imul(ke,Jt)|0,F=F+Math.imul(ke,St)|0,M=M+Math.imul($e,Xt)|0,I=I+Math.imul($e,Ot)|0,I=I+Math.imul(Ie,Xt)|0,F=F+Math.imul(Ie,Ot)|0,M=M+Math.imul(Me,Tt)|0,I=I+Math.imul(Me,vt)|0,I=I+Math.imul(Ne,Tt)|0,F=F+Math.imul(Ne,vt)|0,M=M+Math.imul(ie,Lt)|0,I=I+Math.imul(ie,bt)|0,I=I+Math.imul(fe,Lt)|0,F=F+Math.imul(fe,bt)|0,M=M+Math.imul(Z,jt)|0,I=I+Math.imul(Z,nt)|0,I=I+Math.imul(te,jt)|0,F=F+Math.imul(te,nt)|0,M=M+Math.imul(X,$)|0,I=I+Math.imul(X,W)|0,I=I+Math.imul(Q,$)|0,F=F+Math.imul(Q,W)|0,M=M+Math.imul(N,C)|0,I=I+Math.imul(N,Y)|0,I=I+Math.imul(se,C)|0,F=F+Math.imul(se,Y)|0;var Mt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,M=Math.imul(ct,ht),I=Math.imul(ct,ft),I=I+Math.imul(Be,ht)|0,F=Math.imul(Be,ft),M=M+Math.imul(He,Jt)|0,I=I+Math.imul(He,St)|0,I=I+Math.imul(Ee,Jt)|0,F=F+Math.imul(Ee,St)|0,M=M+Math.imul(Ve,Xt)|0,I=I+Math.imul(Ve,Ot)|0,I=I+Math.imul(ke,Xt)|0,F=F+Math.imul(ke,Ot)|0,M=M+Math.imul($e,Tt)|0,I=I+Math.imul($e,vt)|0,I=I+Math.imul(Ie,Tt)|0,F=F+Math.imul(Ie,vt)|0,M=M+Math.imul(Me,Lt)|0,I=I+Math.imul(Me,bt)|0,I=I+Math.imul(Ne,Lt)|0,F=F+Math.imul(Ne,bt)|0,M=M+Math.imul(ie,jt)|0,I=I+Math.imul(ie,nt)|0,I=I+Math.imul(fe,jt)|0,F=F+Math.imul(fe,nt)|0,M=M+Math.imul(Z,$)|0,I=I+Math.imul(Z,W)|0,I=I+Math.imul(te,$)|0,F=F+Math.imul(te,W)|0,M=M+Math.imul(X,C)|0,I=I+Math.imul(X,Y)|0,I=I+Math.imul(Q,C)|0,F=F+Math.imul(Q,Y)|0,M=M+Math.imul(N,oe)|0,I=I+Math.imul(N,ge)|0,I=I+Math.imul(se,oe)|0,F=F+Math.imul(se,ge)|0;var Et=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Et>>>26)|0,Et&=67108863,M=Math.imul(rt,ht),I=Math.imul(rt,ft),I=I+Math.imul(Je,ht)|0,F=Math.imul(Je,ft),M=M+Math.imul(ct,Jt)|0,I=I+Math.imul(ct,St)|0,I=I+Math.imul(Be,Jt)|0,F=F+Math.imul(Be,St)|0,M=M+Math.imul(He,Xt)|0,I=I+Math.imul(He,Ot)|0,I=I+Math.imul(Ee,Xt)|0,F=F+Math.imul(Ee,Ot)|0,M=M+Math.imul(Ve,Tt)|0,I=I+Math.imul(Ve,vt)|0,I=I+Math.imul(ke,Tt)|0,F=F+Math.imul(ke,vt)|0,M=M+Math.imul($e,Lt)|0,I=I+Math.imul($e,bt)|0,I=I+Math.imul(Ie,Lt)|0,F=F+Math.imul(Ie,bt)|0,M=M+Math.imul(Me,jt)|0,I=I+Math.imul(Me,nt)|0,I=I+Math.imul(Ne,jt)|0,F=F+Math.imul(Ne,nt)|0,M=M+Math.imul(ie,$)|0,I=I+Math.imul(ie,W)|0,I=I+Math.imul(fe,$)|0,F=F+Math.imul(fe,W)|0,M=M+Math.imul(Z,C)|0,I=I+Math.imul(Z,Y)|0,I=I+Math.imul(te,C)|0,F=F+Math.imul(te,Y)|0,M=M+Math.imul(X,oe)|0,I=I+Math.imul(X,ge)|0,I=I+Math.imul(Q,oe)|0,F=F+Math.imul(Q,ge)|0,M=M+Math.imul(N,Re)|0,I=I+Math.imul(N,De)|0,I=I+Math.imul(se,Re)|0,F=F+Math.imul(se,De)|0;var dt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(dt>>>26)|0,dt&=67108863,M=Math.imul(rt,Jt),I=Math.imul(rt,St),I=I+Math.imul(Je,Jt)|0,F=Math.imul(Je,St),M=M+Math.imul(ct,Xt)|0,I=I+Math.imul(ct,Ot)|0,I=I+Math.imul(Be,Xt)|0,F=F+Math.imul(Be,Ot)|0,M=M+Math.imul(He,Tt)|0,I=I+Math.imul(He,vt)|0,I=I+Math.imul(Ee,Tt)|0,F=F+Math.imul(Ee,vt)|0,M=M+Math.imul(Ve,Lt)|0,I=I+Math.imul(Ve,bt)|0,I=I+Math.imul(ke,Lt)|0,F=F+Math.imul(ke,bt)|0,M=M+Math.imul($e,jt)|0,I=I+Math.imul($e,nt)|0,I=I+Math.imul(Ie,jt)|0,F=F+Math.imul(Ie,nt)|0,M=M+Math.imul(Me,$)|0,I=I+Math.imul(Me,W)|0,I=I+Math.imul(Ne,$)|0,F=F+Math.imul(Ne,W)|0,M=M+Math.imul(ie,C)|0,I=I+Math.imul(ie,Y)|0,I=I+Math.imul(fe,C)|0,F=F+Math.imul(fe,Y)|0,M=M+Math.imul(Z,oe)|0,I=I+Math.imul(Z,ge)|0,I=I+Math.imul(te,oe)|0,F=F+Math.imul(te,ge)|0,M=M+Math.imul(X,Re)|0,I=I+Math.imul(X,De)|0,I=I+Math.imul(Q,Re)|0,F=F+Math.imul(Q,De)|0;var _t=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(_t>>>26)|0,_t&=67108863,M=Math.imul(rt,Xt),I=Math.imul(rt,Ot),I=I+Math.imul(Je,Xt)|0,F=Math.imul(Je,Ot),M=M+Math.imul(ct,Tt)|0,I=I+Math.imul(ct,vt)|0,I=I+Math.imul(Be,Tt)|0,F=F+Math.imul(Be,vt)|0,M=M+Math.imul(He,Lt)|0,I=I+Math.imul(He,bt)|0,I=I+Math.imul(Ee,Lt)|0,F=F+Math.imul(Ee,bt)|0,M=M+Math.imul(Ve,jt)|0,I=I+Math.imul(Ve,nt)|0,I=I+Math.imul(ke,jt)|0,F=F+Math.imul(ke,nt)|0,M=M+Math.imul($e,$)|0,I=I+Math.imul($e,W)|0,I=I+Math.imul(Ie,$)|0,F=F+Math.imul(Ie,W)|0,M=M+Math.imul(Me,C)|0,I=I+Math.imul(Me,Y)|0,I=I+Math.imul(Ne,C)|0,F=F+Math.imul(Ne,Y)|0,M=M+Math.imul(ie,oe)|0,I=I+Math.imul(ie,ge)|0,I=I+Math.imul(fe,oe)|0,F=F+Math.imul(fe,ge)|0,M=M+Math.imul(Z,Re)|0,I=I+Math.imul(Z,De)|0,I=I+Math.imul(te,Re)|0,F=F+Math.imul(te,De)|0;var ot=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(ot>>>26)|0,ot&=67108863,M=Math.imul(rt,Tt),I=Math.imul(rt,vt),I=I+Math.imul(Je,Tt)|0,F=Math.imul(Je,vt),M=M+Math.imul(ct,Lt)|0,I=I+Math.imul(ct,bt)|0,I=I+Math.imul(Be,Lt)|0,F=F+Math.imul(Be,bt)|0,M=M+Math.imul(He,jt)|0,I=I+Math.imul(He,nt)|0,I=I+Math.imul(Ee,jt)|0,F=F+Math.imul(Ee,nt)|0,M=M+Math.imul(Ve,$)|0,I=I+Math.imul(Ve,W)|0,I=I+Math.imul(ke,$)|0,F=F+Math.imul(ke,W)|0,M=M+Math.imul($e,C)|0,I=I+Math.imul($e,Y)|0,I=I+Math.imul(Ie,C)|0,F=F+Math.imul(Ie,Y)|0,M=M+Math.imul(Me,oe)|0,I=I+Math.imul(Me,ge)|0,I=I+Math.imul(Ne,oe)|0,F=F+Math.imul(Ne,ge)|0,M=M+Math.imul(ie,Re)|0,I=I+Math.imul(ie,De)|0,I=I+Math.imul(fe,Re)|0,F=F+Math.imul(fe,De)|0;var wt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(wt>>>26)|0,wt&=67108863,M=Math.imul(rt,Lt),I=Math.imul(rt,bt),I=I+Math.imul(Je,Lt)|0,F=Math.imul(Je,bt),M=M+Math.imul(ct,jt)|0,I=I+Math.imul(ct,nt)|0,I=I+Math.imul(Be,jt)|0,F=F+Math.imul(Be,nt)|0,M=M+Math.imul(He,$)|0,I=I+Math.imul(He,W)|0,I=I+Math.imul(Ee,$)|0,F=F+Math.imul(Ee,W)|0,M=M+Math.imul(Ve,C)|0,I=I+Math.imul(Ve,Y)|0,I=I+Math.imul(ke,C)|0,F=F+Math.imul(ke,Y)|0,M=M+Math.imul($e,oe)|0,I=I+Math.imul($e,ge)|0,I=I+Math.imul(Ie,oe)|0,F=F+Math.imul(Ie,ge)|0,M=M+Math.imul(Me,Re)|0,I=I+Math.imul(Me,De)|0,I=I+Math.imul(Ne,Re)|0,F=F+Math.imul(Ne,De)|0;var lt=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(lt>>>26)|0,lt&=67108863,M=Math.imul(rt,jt),I=Math.imul(rt,nt),I=I+Math.imul(Je,jt)|0,F=Math.imul(Je,nt),M=M+Math.imul(ct,$)|0,I=I+Math.imul(ct,W)|0,I=I+Math.imul(Be,$)|0,F=F+Math.imul(Be,W)|0,M=M+Math.imul(He,C)|0,I=I+Math.imul(He,Y)|0,I=I+Math.imul(Ee,C)|0,F=F+Math.imul(Ee,Y)|0,M=M+Math.imul(Ve,oe)|0,I=I+Math.imul(Ve,ge)|0,I=I+Math.imul(ke,oe)|0,F=F+Math.imul(ke,ge)|0,M=M+Math.imul($e,Re)|0,I=I+Math.imul($e,De)|0,I=I+Math.imul(Ie,Re)|0,F=F+Math.imul(Ie,De)|0;var at=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(at>>>26)|0,at&=67108863,M=Math.imul(rt,$),I=Math.imul(rt,W),I=I+Math.imul(Je,$)|0,F=Math.imul(Je,W),M=M+Math.imul(ct,C)|0,I=I+Math.imul(ct,Y)|0,I=I+Math.imul(Be,C)|0,F=F+Math.imul(Be,Y)|0,M=M+Math.imul(He,oe)|0,I=I+Math.imul(He,ge)|0,I=I+Math.imul(Ee,oe)|0,F=F+Math.imul(Ee,ge)|0,M=M+Math.imul(Ve,Re)|0,I=I+Math.imul(Ve,De)|0,I=I+Math.imul(ke,Re)|0,F=F+Math.imul(ke,De)|0;var Ae=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,M=Math.imul(rt,C),I=Math.imul(rt,Y),I=I+Math.imul(Je,C)|0,F=Math.imul(Je,Y),M=M+Math.imul(ct,oe)|0,I=I+Math.imul(ct,ge)|0,I=I+Math.imul(Be,oe)|0,F=F+Math.imul(Be,ge)|0,M=M+Math.imul(He,Re)|0,I=I+Math.imul(He,De)|0,I=I+Math.imul(Ee,Re)|0,F=F+Math.imul(Ee,De)|0;var Pe=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,M=Math.imul(rt,oe),I=Math.imul(rt,ge),I=I+Math.imul(Je,oe)|0,F=Math.imul(Je,ge),M=M+Math.imul(ct,Re)|0,I=I+Math.imul(ct,De)|0,I=I+Math.imul(Be,Re)|0,F=F+Math.imul(Be,De)|0;var Ge=(b+M|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,M=Math.imul(rt,Re),I=Math.imul(rt,De),I=I+Math.imul(Je,Re)|0,F=Math.imul(Je,De);var je=(b+M|0)+((I&8191)<<13)|0;return b=(F+(I>>>13)|0)+(je>>>26)|0,je&=67108863,S[0]=it,S[1]=Ue,S[2]=gt,S[3]=st,S[4]=tt,S[5]=At,S[6]=Rt,S[7]=Mt,S[8]=Et,S[9]=dt,S[10]=_t,S[11]=ot,S[12]=wt,S[13]=lt,S[14]=at,S[15]=Ae,S[16]=Pe,S[17]=Ge,S[18]=je,b!==0&&(S[19]=b,v.length++),v};Math.imul||(B=k);function q(m,f,g){g.negative=f.negative^m.negative,g.length=m.length+f.length;for(var v=0,x=0,_=0;_>>26)|0,x+=S>>>26,S&=67108863}g.words[_]=b,v=S,S=x}return v!==0?g.words[_]=v:g.length--,g._strip()}function j(m,f,g){return q(m,f,g)}s.prototype.mulTo=function(f,g){var v,x=this.length+f.length;return this.length===10&&f.length===10?v=B(this,f,g):x<63?v=k(this,f,g):x<1024?v=q(this,f,g):v=j(this,f,g),v},s.prototype.mul=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),this.mulTo(f,g)},s.prototype.mulf=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),j(this,f,g)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var g=f<0;g&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var v=0,x=0;x>=26,v+=_/67108864|0,v+=S>>>26,this.words[x]=S&67108863}return v!==0&&(this.words[x]=v,this.length++),g?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var g=D(f);if(g.length===0)return new s(1);for(var v=this,x=0;x=0);var g=f%26,v=(f-g)/26,x=67108863>>>26-g<<26-g,_;if(g!==0){var S=0;for(_=0;_>>26-g}S&&(this.words[_]=S,this.length++)}if(v!==0){for(_=this.length-1;_>=0;_--)this.words[_+v]=this.words[_];for(_=0;_=0);var x;g?x=(g-g%26)/26:x=0;var _=f%26,S=Math.min((f-_)/26,this.length),b=67108863^67108863>>>_<<_,M=v;if(x-=S,x=Math.max(0,x),M){for(var I=0;IS)for(this.length-=S,I=0;I=0&&(F!==0||I>=x);I--){var ce=this.words[I]|0;this.words[I]=F<<26-_|ce>>>_,F=ce&b}return M&&F!==0&&(M.words[M.length++]=F),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,g,v){return n(this.negative===0),this.iushrn(f,g,v)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var g=f%26,v=(f-g)/26,x=1<=0);var g=f%26,v=(f-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(g!==0&&v++,this.length=Math.min(v,this.length),g!==0){var x=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(M/67108864|0),this.words[_+v]=S&67108863}for(;_>26,this.words[_+v]=S&67108863;if(b===0)return this._strip();for(n(b===-1),b=0,_=0;_>26,this.words[_]=S&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,g){var v=this.length-f.length,x=this.clone(),_=f,S=_.words[_.length-1]|0,b=this._countBits(S);v=26-b,v!==0&&(_=_.ushln(v),x.iushln(v),S=_.words[_.length-1]|0);var M=x.length-_.length,I;if(g!=="mod"){I=new s(null),I.length=M+1,I.words=new Array(I.length);for(var F=0;F=0;N--){var se=(x.words[_.length+N]|0)*67108864+(x.words[_.length+N-1]|0);for(se=Math.min(se/S|0,67108863),x._ishlnsubmul(_,se,N);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(_,1,N),x.isZero()||(x.negative^=1);I&&(I.words[N]=se)}return I&&I._strip(),x._strip(),g!=="div"&&v!==0&&x.iushrn(v),{div:I||null,mod:x}},s.prototype.divmod=function(f,g,v){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,_,S;return this.negative!==0&&f.negative===0?(S=this.neg().divmod(f,g),g!=="mod"&&(x=S.div.neg()),g!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.iadd(f)),{div:x,mod:_}):this.negative===0&&f.negative!==0?(S=this.divmod(f.neg(),g),g!=="mod"&&(x=S.div.neg()),{div:x,mod:S.mod}):this.negative&f.negative?(S=this.neg().divmod(f.neg(),g),g!=="div"&&(_=S.mod.neg(),v&&_.negative!==0&&_.isub(f)),{div:S.div,mod:_}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?g==="div"?{div:this.divn(f.words[0]),mod:null}:g==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,g)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var g=this.divmod(f);if(g.mod.isZero())return g.div;var v=g.div.negative!==0?g.mod.isub(f):g.mod,x=f.ushrn(1),_=f.andln(1),S=v.cmp(x);return S<0||_===1&&S===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},s.prototype.modrn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=(1<<26)%f,x=0,_=this.length-1;_>=0;_--)x=(v*x+(this.words[_]|0))%f;return g?-x:x},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=0,x=this.length-1;x>=0;x--){var _=(this.words[x]|0)+v*67108864;this.words[x]=_/f|0,v=_%f}return this._strip(),g?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),_=new s(0),S=new s(0),b=new s(1),M=0;g.isEven()&&v.isEven();)g.iushrn(1),v.iushrn(1),++M;for(var I=v.clone(),F=g.clone();!g.isZero();){for(var ce=0,N=1;!(g.words[0]&N)&&ce<26;++ce,N<<=1);if(ce>0)for(g.iushrn(ce);ce-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(I),_.isub(F)),x.iushrn(1),_.iushrn(1);for(var se=0,ee=1;!(v.words[0]&ee)&&se<26;++se,ee<<=1);if(se>0)for(v.iushrn(se);se-- >0;)(S.isOdd()||b.isOdd())&&(S.iadd(I),b.isub(F)),S.iushrn(1),b.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(S),_.isub(b)):(v.isub(g),S.isub(x),b.isub(_))}return{a:S,b,gcd:v.iushln(M)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),_=new s(0),S=v.clone();g.cmpn(1)>0&&v.cmpn(1)>0;){for(var b=0,M=1;!(g.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(g.iushrn(b);b-- >0;)x.isOdd()&&x.iadd(S),x.iushrn(1);for(var I=0,F=1;!(v.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(v.iushrn(I);I-- >0;)_.isOdd()&&_.iadd(S),_.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(_)):(v.isub(g),_.isub(x))}var ce;return g.cmpn(1)===0?ce=x:ce=_,ce.cmpn(0)<0&&ce.iadd(f),ce},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var g=this.clone(),v=f.clone();g.negative=0,v.negative=0;for(var x=0;g.isEven()&&v.isEven();x++)g.iushrn(1),v.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;v.isEven();)v.iushrn(1);var _=g.cmp(v);if(_<0){var S=g;g=v,v=S}else if(_===0||v.cmpn(1)===0)break;g.isub(v)}while(!0);return v.iushln(x)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var g=f%26,v=(f-g)/26,x=1<>>26,b&=67108863,this.words[S]=b}return _!==0&&(this.words[S]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var g=f<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var v;if(this.length>1)v=1;else{g&&(f=-f),n(f<=67108863,"Number is too big");var x=this.words[0]|0;v=x===f?0:xf.length)return 1;if(this.length=0;v--){var x=this.words[v]|0,_=f.words[v]|0;if(x!==_){x<_?g=-1:x>_&&(g=1);break}}return g},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new G(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var H={k256:null,p224:null,p192:null,p25519:null};function J(m,f){this.name=m,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}J.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},J.prototype.ireduce=function(f){var g=f,v;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),v=g.bitLength();while(v>this.n);var x=v0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},J.prototype.split=function(f,g){f.iushrn(this.n,0,g)},J.prototype.imulK=function(f){return f.imul(this.k)};function T(){J.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(T,J),T.prototype.split=function(f,g){for(var v=4194303,x=Math.min(f.length,9),_=0;_>>22,S=b}S>>>=22,f.words[_-10]=S,S===0&&f.length>10?f.length-=10:f.length-=9},T.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var g=0,v=0;v>>=26,f.words[v]=_,g=x}return g!==0&&(f.words[f.length++]=g),f},s._prime=function(f){if(H[f])return H[f];var g;if(f==="k256")g=new T;else if(f==="p224")g=new z;else if(f==="p192")g=new ue;else if(f==="p25519")g=new _e;else throw new Error("Unknown prime "+f);return H[f]=g,g};function G(m){if(typeof m=="string"){var f=s._prime(m);this.m=f.p,this.prime=f}else n(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}G.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},G.prototype._verify2=function(f,g){n((f.negative|g.negative)===0,"red works only with positives"),n(f.red&&f.red===g.red,"red works only with red numbers")},G.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(d(f,f.umod(this.m)._forceRed(this)),f)},G.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},G.prototype.add=function(f,g){this._verify2(f,g);var v=f.add(g);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},G.prototype.iadd=function(f,g){this._verify2(f,g);var v=f.iadd(g);return v.cmp(this.m)>=0&&v.isub(this.m),v},G.prototype.sub=function(f,g){this._verify2(f,g);var v=f.sub(g);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},G.prototype.isub=function(f,g){this._verify2(f,g);var v=f.isub(g);return v.cmpn(0)<0&&v.iadd(this.m),v},G.prototype.shl=function(f,g){return this._verify1(f),this.imod(f.ushln(g))},G.prototype.imul=function(f,g){return this._verify2(f,g),this.imod(f.imul(g))},G.prototype.mul=function(f,g){return this._verify2(f,g),this.imod(f.mul(g))},G.prototype.isqr=function(f){return this.imul(f,f.clone())},G.prototype.sqr=function(f){return this.mul(f,f)},G.prototype.sqrt=function(f){if(f.isZero())return f.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(f,v)}for(var x=this.m.subn(1),_=0;!x.isZero()&&x.andln(1)===0;)_++,x.iushrn(1);n(!x.isZero());var S=new s(1).toRed(this),b=S.redNeg(),M=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,M).cmp(b)!==0;)I.redIAdd(b);for(var F=this.pow(I,x),ce=this.pow(f,x.addn(1).iushrn(1)),N=this.pow(f,x),se=_;N.cmp(S)!==0;){for(var ee=N,X=0;ee.cmp(S)!==0;X++)ee=ee.redSqr();n(X=0;_--){for(var F=g.words[_],ce=I-1;ce>=0;ce--){var N=F>>ce&1;if(S!==x[0]&&(S=this.sqr(S)),N===0&&b===0){M=0;continue}b<<=1,b|=N,M++,!(M!==v&&(_!==0||ce!==0))&&(S=this.mul(S,x[b]),M=0,b=0)}I=26}return S},G.prototype.convertTo=function(f){var g=f.umod(this.m);return g===f?g.clone():g},G.prototype.convertFrom=function(f){var g=f.clone();return g.red=null,g},s.mont=function(f){return new E(f)};function E(m){G.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(E,G),E.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},E.prototype.convertFrom=function(f){var g=this.imod(f.mul(this.rinv));return g.red=null,g},E.prototype.imul=function(f,g){if(f.isZero()||g.isZero())return f.words[0]=0,f.length=1,f;var v=f.imul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.mul=function(f,g){if(f.isZero()||g.isZero())return new s(0)._forceRed(this);var v=f.mul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=v.isub(x).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},E.prototype.invm=function(f){var g=this.imod(f._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,nn)}(Sm);var _N=Sm.exports;const rr=ji(_N);var EN=rr.BN;function SN(t){return new EN(t,36).toString(16)}const AN="strings/5.7.0",PN=new Kr(AN);var bd;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(bd||(bd={}));var Ux;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(Ux||(Ux={}));function Am(t,e=bd.current){e!=bd.current&&(PN.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return bn(r)}const MN=`Ethereum Signed Message: +`;function qx(t){return typeof t=="string"&&(t=Am(t)),Em(yN([Am(MN),Am(String(t.length)),t]))}const IN="address/5.7.0",sl=new Kr(IN);function zx(t){Ns(t,20)||sl.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=bn(Em(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const CN=9007199254740991;function TN(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const Pm={};for(let t=0;t<10;t++)Pm[String(t)]=String(t);for(let t=0;t<26;t++)Pm[String.fromCharCode(65+t)]=String(10+t);const Hx=Math.floor(TN(CN));function RN(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Pm[n]).join("");for(;e.length>=Hx;){let n=e.substring(0,Hx);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function DN(t){let e=null;if(typeof t!="string"&&sl.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=zx(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&sl.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==RN(t)&&sl.throwArgumentError("bad icap checksum","address",t),e=SN(t.substring(4));e.length<40;)e="0"+e;e=zx("0x"+e)}else sl.throwArgumentError("invalid address","address",t);return e}function ol(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var al={},yr={},Ga=Wx;function Wx(t,e){if(!t)throw new Error(e||"Assertion failed")}Wx.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var Mm={exports:{}};typeof Object.create=="function"?Mm.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Mm.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var yd=Mm.exports,ON=Ga,NN=yd;yr.inherits=NN;function LN(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function kN(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):LN(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}yr.htonl=Kx;function $N(t,e){for(var r="",n=0;n>>0}return s}yr.join32=FN;function jN(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}yr.split32=jN;function UN(t,e){return t>>>e|t<<32-e}yr.rotr32=UN;function qN(t,e){return t<>>32-e}yr.rotl32=qN;function zN(t,e){return t+e>>>0}yr.sum32=zN;function HN(t,e,r){return t+e+r>>>0}yr.sum32_3=HN;function WN(t,e,r,n){return t+e+r+n>>>0}yr.sum32_4=WN;function KN(t,e,r,n,i){return t+e+r+n+i>>>0}yr.sum32_5=KN;function VN(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}yr.sum64=VN;function GN(t,e,r,n){var i=e+n>>>0,s=(i>>0}yr.sum64_hi=GN;function YN(t,e,r,n){var i=e+n;return i>>>0}yr.sum64_lo=YN;function JN(t,e,r,n,i,s,o,a){var u=0,l=e;l=l+n>>>0,u+=l>>0,u+=l>>0,u+=l>>0}yr.sum64_4_hi=JN;function XN(t,e,r,n,i,s,o,a){var u=e+n+s+a;return u>>>0}yr.sum64_4_lo=XN;function ZN(t,e,r,n,i,s,o,a,u,l){var d=0,p=e;p=p+n>>>0,d+=p>>0,d+=p>>0,d+=p>>0,d+=p>>0}yr.sum64_5_hi=ZN;function QN(t,e,r,n,i,s,o,a,u,l){var d=e+n+s+a+l;return d>>>0}yr.sum64_5_lo=QN;function eL(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}yr.rotr64_hi=eL;function tL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.rotr64_lo=tL;function rL(t,e,r){return t>>>r}yr.shr64_hi=rL;function nL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}yr.shr64_lo=nL;var hu={},Yx=yr,iL=Ga;function wd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}hu.BlockHash=wd,wd.prototype.update=function(e,r){if(e=Yx.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Yx.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}Ls.g0_256=uL;function fL(t){return ks(t,17)^ks(t,19)^t>>>10}Ls.g1_256=fL;var pu=yr,lL=hu,hL=Ls,Im=pu.rotl32,cl=pu.sum32,dL=pu.sum32_5,pL=hL.ft_1,Qx=lL.BlockHash,gL=[1518500249,1859775393,2400959708,3395469782];function Bs(){if(!(this instanceof Bs))return new Bs;Qx.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}pu.inherits(Bs,Qx);var mL=Bs;Bs.blockSize=512,Bs.outSize=160,Bs.hmacStrength=80,Bs.padLength=64,Bs.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),nk(e.length<=this.blockSize);for(var r=e.length;r>8,y=d&255;p?u.push(p,y):u.push(y)}return u}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",u=0;u(y>>1)-1?O=(y>>1)-D:O=D,A.isubn(O)):O=0,p[P]=O,A.iushrn(1)}return p}r.getNAF=n;function i(u,l){var d=[[],[]];u=u.clone(),l=l.clone();for(var p=0,y=0,A;u.cmpn(-p)>0||l.cmpn(-y)>0;){var P=u.andln(3)+p&3,O=l.andln(3)+y&3;P===3&&(P=-1),O===3&&(O=-1);var D;P&1?(A=u.andln(7)+p&7,(A===3||A===5)&&O===2?D=-P:D=P):D=0,d[0].push(D);var k;O&1?(A=l.andln(7)+y&7,(A===3||A===5)&&P===2?k=-O:k=O):k=0,d[1].push(k),2*p===D+1&&(p=1-p),2*y===k+1&&(y=1-y),u.iushrn(1),l.iushrn(1)}return d}r.getJSF=i;function s(u,l,d){var p="_"+l;u.prototype[l]=function(){return this[p]!==void 0?this[p]:this[p]=d.call(this)}}r.cachedProperty=s;function o(u){return typeof u=="string"?r.toArray(u,"hex"):u}r.parseBytes=o;function a(u){return new rr(u,"hex","le")}r.intFromLE=a}),_d=Ci.getNAF,ok=Ci.getJSF,Ed=Ci.assert;function na(t,e){this.type=t,this.p=new rr(e.p,16),this.red=e.prime?rr.red(e.prime):rr.mont(this.p),this.zero=new rr(0).toRed(this.red),this.one=new rr(1).toRed(this.red),this.two=new rr(2).toRed(this.red),this.n=e.n&&new rr(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ja=na;na.prototype.point=function(){throw new Error("Not implemented")},na.prototype.validate=function(){throw new Error("Not implemented")},na.prototype._fixedNafMul=function(e,r){Ed(e.precomputed);var n=e._getDoubles(),i=_d(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Ed(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},na.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var P=d-1,O=d;if(o[P]!==1||o[O]!==1){u[P]=_d(n[P],o[P],this._bitLength),u[O]=_d(n[O],o[O],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[O].length,l);continue}var D=[r[P],null,null,r[O]];r[P].y.cmp(r[O].y)===0?(D[1]=r[P].add(r[O]),D[2]=r[P].toJ().mixedAdd(r[O].neg())):r[P].y.cmp(r[O].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[O]),D[2]=r[P].add(r[O].neg())):(D[1]=r[P].toJ().mixedAdd(r[O]),D[2]=r[P].toJ().mixedAdd(r[O].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=ok(n[P],n[O]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[O]=new Array(l),p=0;p=0;d--){for(var T=0;d>=0;){var z=!0;for(p=0;p=0&&T++,H=H.dblp(T),d<0)break;for(p=0;p0?y=a[p][ue-1>>1]:ue<0&&(y=a[p][-ue-1>>1].neg()),y.type==="affine"?H=H.mixedAdd(y):H=H.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},zi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),p.negative&&(p=p.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:p,b:y},{a:A,b:P}]},Hi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Hi.prototype.pointFromX=function(e,r){e=new rr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Hi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Hi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},On.prototype.isInfinity=function(){return this.inf},On.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},On.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},On.prototype.getX=function(){return this.x.fromRed()},On.prototype.getY=function(){return this.y.fromRed()},On.prototype.mul=function(e){return e=new rr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},On.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},On.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},On.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},On.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},On.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Un(t,e,r,n){Ja.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new rr(0)):(this.x=new rr(e,16),this.y=new rr(r,16),this.z=new rr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Nm(Un,Ja.BasePoint),Hi.prototype.jpoint=function(e,r,n){return new Un(this,e,r,n)},Un.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},Un.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Un.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(p).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(p)),O=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,O)},Un.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),A=u.redMul(p.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},Un.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},Un.prototype.inspect=function(){return this.isInfinity()?"":""},Un.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Sd=bu(function(t,e){var r=e;r.base=Ja,r.short=ck,r.mont=null,r.edwards=null}),Ad=bu(function(t,e){var r=e,n=Ci.assert;function i(a){a.type==="short"?this.curve=new Sd.short(a):a.type==="edwards"?this.curve=new Sd.edwards(a):this.curve=new Sd.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,u){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(u);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:wo.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:wo.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:wo.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:wo.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:wo.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:wo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function ia(t){if(!(this instanceof ia))return new ia(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=vs.toArray(t.entropy,t.entropyEnc||"hex"),r=vs.toArray(t.nonce,t.nonceEnc||"hex"),n=vs.toArray(t.pers,t.persEnc||"hex");Om(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var p3=ia;ia.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ia.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=vs.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var uk=Ci.assert;function Pd(t,e){if(t instanceof Pd)return t;this._importDER(t,e)||(uk(t.r&&t.s,"Signature without r or s"),this.r=new rr(t.r,16),this.s=new rr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Md=Pd;function fk(){this.place=0}function Bm(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function g3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Pd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=g3(r),n=g3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];$m(i,r.length),i=i.concat(r),i.push(2),$m(i,n.length);var s=i.concat(n),o=[48];return $m(o,s.length),o=o.concat(s),Ci.encode(o,e)};var lk=function(){throw new Error("unsupported")},m3=Ci.assert;function Wi(t){if(!(this instanceof Wi))return new Wi(t);typeof t=="string"&&(m3(Object.prototype.hasOwnProperty.call(Ad,t),"Unknown curve "+t),t=Ad[t]),t instanceof Ad.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var hk=Wi;Wi.prototype.keyPair=function(e){return new km(this,e)},Wi.prototype.keyFromPrivate=function(e,r){return km.fromPrivate(this,e,r)},Wi.prototype.keyFromPublic=function(e,r){return km.fromPublic(this,e,r)},Wi.prototype.genKeyPair=function(e){e||(e={});for(var r=new p3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||lk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new rr(2));;){var s=new rr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Wi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Wi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new rr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new p3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new rr(1)),d=0;;d++){var p=i.k?i.k(d):new rr(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var O=p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(O=O.umod(this.n),O.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&O.cmp(this.nh)>0&&(O=this.n.sub(O),D^=1),new Md({r:P,s:O,recoveryParam:D})}}}}}},Wi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new rr(e,16)),n=this.keyFromPublic(n,i),r=new Md(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),u=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.eqXToP(s)):(d=this.g.mulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.getX().umod(this.n).cmp(s)===0)},Wi.prototype.recoverPubKey=function(t,e,r,n){m3((3&r)===r,"The recovery param is more than two bits"),e=new Md(e,n);var i=this.n,s=new rr(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Wi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Md(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dk=bu(function(t,e){var r=e;r.version="6.5.4",r.utils=Ci,r.rand=function(){throw new Error("unsupported")},r.curve=Sd,r.curves=Ad,r.ec=hk,r.eddsa=null}),pk=dk.ec;const gk="signing-key/5.7.0",Fm=new Kr(gk);let jm=null;function sa(){return jm||(jm=new pk("secp256k1")),jm}class mk{constructor(e){ol(this,"curve","secp256k1"),ol(this,"privateKey",Ii(e)),xN(this.privateKey)!==32&&Fm.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=sa().keyFromPrivate(bn(this.privateKey));ol(this,"publicKey","0x"+r.getPublic(!1,"hex")),ol(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ol(this,"_isSigningKey",!0)}_addPoint(e){const r=sa().keyFromPublic(bn(this.publicKey)),n=sa().keyFromPublic(bn(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=sa().keyFromPrivate(bn(this.privateKey)),n=bn(e);n.length!==32&&Fm.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return jx({recoveryParam:i.recoveryParam,r:lu("0x"+i.r.toString(16),32),s:lu("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=sa().keyFromPrivate(bn(this.privateKey)),n=sa().keyFromPublic(bn(v3(e)));return lu("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function vk(t,e){const r=jx(e),n={r:bn(r.r),s:bn(r.s)};return"0x"+sa().recoverPubKey(bn(t),n,r.recoveryParam).encode("hex",!1)}function v3(t,e){const r=bn(t);return r.length===32?new mk(r).publicKey:r.length===33?"0x"+sa().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?Ii(r):Fm.throwArgumentError("invalid public or private key","key","[REDACTED]")}var b3;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(b3||(b3={}));function bk(t){const e=v3(t);return DN(Fx(Em(Fx(e,1)),12))}function yk(t,e){return bk(vk(bn(t),e))}var Um={},Id={};Object.defineProperty(Id,"__esModule",{value:!0});var Yn=or,qm=Mi,wk=20;function xk(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],p=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],P=r[31]<<24|r[30]<<16|r[29]<<8|r[28],O=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],k=e[11]<<24|e[10]<<16|e[9]<<8|e[8],B=e[15]<<24|e[14]<<16|e[13]<<8|e[12],q=n,j=i,H=s,J=o,T=a,z=u,ue=l,_e=d,G=p,E=y,m=A,f=P,g=O,v=D,x=k,_=B,S=0;S>>16|g<<16,G=G+g|0,T^=G,T=T>>>20|T<<12,j=j+z|0,v^=j,v=v>>>16|v<<16,E=E+v|0,z^=E,z=z>>>20|z<<12,H=H+ue|0,x^=H,x=x>>>16|x<<16,m=m+x|0,ue^=m,ue=ue>>>20|ue<<12,J=J+_e|0,_^=J,_=_>>>16|_<<16,f=f+_|0,_e^=f,_e=_e>>>20|_e<<12,H=H+ue|0,x^=H,x=x>>>24|x<<8,m=m+x|0,ue^=m,ue=ue>>>25|ue<<7,J=J+_e|0,_^=J,_=_>>>24|_<<8,f=f+_|0,_e^=f,_e=_e>>>25|_e<<7,j=j+z|0,v^=j,v=v>>>24|v<<8,E=E+v|0,z^=E,z=z>>>25|z<<7,q=q+T|0,g^=q,g=g>>>24|g<<8,G=G+g|0,T^=G,T=T>>>25|T<<7,q=q+z|0,_^=q,_=_>>>16|_<<16,m=m+_|0,z^=m,z=z>>>20|z<<12,j=j+ue|0,g^=j,g=g>>>16|g<<16,f=f+g|0,ue^=f,ue=ue>>>20|ue<<12,H=H+_e|0,v^=H,v=v>>>16|v<<16,G=G+v|0,_e^=G,_e=_e>>>20|_e<<12,J=J+T|0,x^=J,x=x>>>16|x<<16,E=E+x|0,T^=E,T=T>>>20|T<<12,H=H+_e|0,v^=H,v=v>>>24|v<<8,G=G+v|0,_e^=G,_e=_e>>>25|_e<<7,J=J+T|0,x^=J,x=x>>>24|x<<8,E=E+x|0,T^=E,T=T>>>25|T<<7,j=j+ue|0,g^=j,g=g>>>24|g<<8,f=f+g|0,ue^=f,ue=ue>>>25|ue<<7,q=q+z|0,_^=q,_=_>>>24|_<<8,m=m+_|0,z^=m,z=z>>>25|z<<7;Yn.writeUint32LE(q+n|0,t,0),Yn.writeUint32LE(j+i|0,t,4),Yn.writeUint32LE(H+s|0,t,8),Yn.writeUint32LE(J+o|0,t,12),Yn.writeUint32LE(T+a|0,t,16),Yn.writeUint32LE(z+u|0,t,20),Yn.writeUint32LE(ue+l|0,t,24),Yn.writeUint32LE(_e+d|0,t,28),Yn.writeUint32LE(G+p|0,t,32),Yn.writeUint32LE(E+y|0,t,36),Yn.writeUint32LE(m+A|0,t,40),Yn.writeUint32LE(f+P|0,t,44),Yn.writeUint32LE(g+O|0,t,48),Yn.writeUint32LE(v+D|0,t,52),Yn.writeUint32LE(x+k|0,t,56),Yn.writeUint32LE(_+B|0,t,60)}function y3(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var w3={},oa={};Object.defineProperty(oa,"__esModule",{value:!0});function Sk(t,e,r){return~(t-1)&e|t-1&r}oa.select=Sk;function Ak(t,e){return(t|0)-(e|0)-1>>>31&1}oa.lessOrEqual=Ak;function x3(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}oa.compare=x3;function Pk(t,e){return t.length===0||e.length===0?!1:x3(t,e)!==0}oa.equal=Pk,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=oa,r=Mi;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var u=a[0]|a[1]<<8;this._r[0]=u&8191;var l=a[2]|a[3]<<8;this._r[1]=(u>>>13|l<<3)&8191;var d=a[4]|a[5]<<8;this._r[2]=(l>>>10|d<<6)&7939;var p=a[6]|a[7]<<8;this._r[3]=(d>>>7|p<<9)&8191;var y=a[8]|a[9]<<8;this._r[4]=(p>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var A=a[10]|a[11]<<8;this._r[6]=(y>>>14|A<<2)&8191;var P=a[12]|a[13]<<8;this._r[7]=(A>>>11|P<<5)&8065;var O=a[14]|a[15]<<8;this._r[8]=(P>>>8|O<<8)&8191,this._r[9]=O>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,u,l){for(var d=this._fin?0:2048,p=this._h[0],y=this._h[1],A=this._h[2],P=this._h[3],O=this._h[4],D=this._h[5],k=this._h[6],B=this._h[7],q=this._h[8],j=this._h[9],H=this._r[0],J=this._r[1],T=this._r[2],z=this._r[3],ue=this._r[4],_e=this._r[5],G=this._r[6],E=this._r[7],m=this._r[8],f=this._r[9];l>=16;){var g=a[u+0]|a[u+1]<<8;p+=g&8191;var v=a[u+2]|a[u+3]<<8;y+=(g>>>13|v<<3)&8191;var x=a[u+4]|a[u+5]<<8;A+=(v>>>10|x<<6)&8191;var _=a[u+6]|a[u+7]<<8;P+=(x>>>7|_<<9)&8191;var S=a[u+8]|a[u+9]<<8;O+=(_>>>4|S<<12)&8191,D+=S>>>1&8191;var b=a[u+10]|a[u+11]<<8;k+=(S>>>14|b<<2)&8191;var M=a[u+12]|a[u+13]<<8;B+=(b>>>11|M<<5)&8191;var I=a[u+14]|a[u+15]<<8;q+=(M>>>8|I<<8)&8191,j+=I>>>5|d;var F=0,ce=F;ce+=p*H,ce+=y*(5*f),ce+=A*(5*m),ce+=P*(5*E),ce+=O*(5*G),F=ce>>>13,ce&=8191,ce+=D*(5*_e),ce+=k*(5*ue),ce+=B*(5*z),ce+=q*(5*T),ce+=j*(5*J),F+=ce>>>13,ce&=8191;var N=F;N+=p*J,N+=y*H,N+=A*(5*f),N+=P*(5*m),N+=O*(5*E),F=N>>>13,N&=8191,N+=D*(5*G),N+=k*(5*_e),N+=B*(5*ue),N+=q*(5*z),N+=j*(5*T),F+=N>>>13,N&=8191;var se=F;se+=p*T,se+=y*J,se+=A*H,se+=P*(5*f),se+=O*(5*m),F=se>>>13,se&=8191,se+=D*(5*E),se+=k*(5*G),se+=B*(5*_e),se+=q*(5*ue),se+=j*(5*z),F+=se>>>13,se&=8191;var ee=F;ee+=p*z,ee+=y*T,ee+=A*J,ee+=P*H,ee+=O*(5*f),F=ee>>>13,ee&=8191,ee+=D*(5*m),ee+=k*(5*E),ee+=B*(5*G),ee+=q*(5*_e),ee+=j*(5*ue),F+=ee>>>13,ee&=8191;var X=F;X+=p*ue,X+=y*z,X+=A*T,X+=P*J,X+=O*H,F=X>>>13,X&=8191,X+=D*(5*f),X+=k*(5*m),X+=B*(5*E),X+=q*(5*G),X+=j*(5*_e),F+=X>>>13,X&=8191;var Q=F;Q+=p*_e,Q+=y*ue,Q+=A*z,Q+=P*T,Q+=O*J,F=Q>>>13,Q&=8191,Q+=D*H,Q+=k*(5*f),Q+=B*(5*m),Q+=q*(5*E),Q+=j*(5*G),F+=Q>>>13,Q&=8191;var R=F;R+=p*G,R+=y*_e,R+=A*ue,R+=P*z,R+=O*T,F=R>>>13,R&=8191,R+=D*J,R+=k*H,R+=B*(5*f),R+=q*(5*m),R+=j*(5*E),F+=R>>>13,R&=8191;var Z=F;Z+=p*E,Z+=y*G,Z+=A*_e,Z+=P*ue,Z+=O*z,F=Z>>>13,Z&=8191,Z+=D*T,Z+=k*J,Z+=B*H,Z+=q*(5*f),Z+=j*(5*m),F+=Z>>>13,Z&=8191;var te=F;te+=p*m,te+=y*E,te+=A*G,te+=P*_e,te+=O*ue,F=te>>>13,te&=8191,te+=D*z,te+=k*T,te+=B*J,te+=q*H,te+=j*(5*f),F+=te>>>13,te&=8191;var le=F;le+=p*f,le+=y*m,le+=A*E,le+=P*G,le+=O*_e,F=le>>>13,le&=8191,le+=D*ue,le+=k*z,le+=B*T,le+=q*J,le+=j*H,F+=le>>>13,le&=8191,F=(F<<2)+F|0,F=F+ce|0,ce=F&8191,F=F>>>13,N+=F,p=ce,y=N,A=se,P=ee,O=X,D=Q,k=R,B=Z,q=te,j=le,u+=16,l-=16}this._h[0]=p,this._h[1]=y,this._h[2]=A,this._h[3]=P,this._h[4]=O,this._h[5]=D,this._h[6]=k,this._h[7]=B,this._h[8]=q,this._h[9]=j},o.prototype.finish=function(a,u){u===void 0&&(u=0);var l=new Uint16Array(10),d,p,y,A;if(this._leftover){for(A=this._leftover,this._buffer[A++]=1;A<16;A++)this._buffer[A]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(d=this._h[1]>>>13,this._h[1]&=8191,A=2;A<10;A++)this._h[A]+=d,d=this._h[A]>>>13,this._h[A]&=8191;for(this._h[0]+=d*5,d=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=d,d=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=d,l[0]=this._h[0]+5,d=l[0]>>>13,l[0]&=8191,A=1;A<10;A++)l[A]=this._h[A]+d,d=l[A]>>>13,l[A]&=8191;for(l[9]-=8192,p=(d^1)-1,A=0;A<10;A++)l[A]&=p;for(p=~p,A=0;A<10;A++)this._h[A]=this._h[A]&p|l[A];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,y=this._h[0]+this._pad[0],this._h[0]=y&65535,A=1;A<8;A++)y=(this._h[A]+this._pad[A]|0)+(y>>>16)|0,this._h[A]=y&65535;return a[u+0]=this._h[0]>>>0,a[u+1]=this._h[0]>>>8,a[u+2]=this._h[1]>>>0,a[u+3]=this._h[1]>>>8,a[u+4]=this._h[2]>>>0,a[u+5]=this._h[2]>>>8,a[u+6]=this._h[3]>>>0,a[u+7]=this._h[3]>>>8,a[u+8]=this._h[4]>>>0,a[u+9]=this._h[4]>>>8,a[u+10]=this._h[5]>>>0,a[u+11]=this._h[5]>>>8,a[u+12]=this._h[6]>>>0,a[u+13]=this._h[6]>>>8,a[u+14]=this._h[7]>>>0,a[u+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var u=0,l=a.length,d;if(this._leftover){d=16-this._leftover,d>l&&(d=l);for(var p=0;p=16&&(d=l-l%16,this._blocks(a,u,d),u+=d,l-=d),l){for(var p=0;p16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var A=new Uint8Array(16);A.set(l,A.length-l.length);var P=new Uint8Array(32);e.stream(this._key,A,P,4);var O=d.length+this.tagLength,D;if(y){if(y.length!==O)throw new Error("ChaCha20Poly1305: incorrect destination length");D=y}else D=new Uint8Array(O);return e.streamXOR(this._key,A,d,D,4),this._authenticate(D.subarray(D.length-this.tagLength,D.length),P,D.subarray(0,D.length-this.tagLength),p),n.wipe(A),D},u.prototype.open=function(l,d,p,y){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(d.length0&&A.update(o.subarray(y.length%16))),A.update(p),p.length%16>0&&A.update(o.subarray(p.length%16));var P=new Uint8Array(8);y&&i.writeUint64LE(y.length,P),A.update(P),i.writeUint64LE(p.length,P),A.update(P);for(var O=A.digest(),D=0;Dthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._temp,this._state,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,A=l%64<56?64:128;this._buffer[d]=128;for(var P=d+1;P0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._state.set(u.state),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.state),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,u,l,d,p){for(;p>=64;){for(var y=u[0],A=u[1],P=u[2],O=u[3],D=u[4],k=u[5],B=u[6],q=u[7],j=0;j<16;j++){var H=d+j*4;a[j]=e.readUint32BE(l,H)}for(var j=16;j<64;j++){var J=a[j-2],T=(J>>>17|J<<15)^(J>>>19|J<<13)^J>>>10;J=a[j-15];var z=(J>>>7|J<<25)^(J>>>18|J<<14)^J>>>3;a[j]=(T+a[j-7]|0)+(z+a[j-16]|0)}for(var j=0;j<64;j++){var T=(((D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7))+(D&k^~D&B)|0)+(q+(i[j]+a[j]|0)|0)|0,z=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&A^y&P^A&P)|0;q=B,B=k,k=D,D=O+T|0,O=P,P=A,A=y,y=T+z|0}u[0]+=y,u[1]+=A,u[2]+=P,u[3]+=O,u[4]+=D,u[5]+=k,u[6]+=B,u[7]+=q,d+=64,p-=64}return d}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(ll);var Hm={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=ta,r=Mi;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(j){const H=new Float64Array(16);if(j)for(let J=0;J>16&1),J[_e-1]&=65535;J[15]=T[15]-32767-(J[14]>>16&1);const ue=J[15]>>16&1;J[14]&=65535,a(T,J,1-ue)}for(let z=0;z<16;z++)j[2*z]=T[z]&255,j[2*z+1]=T[z]>>8}function l(j,H){for(let J=0;J<16;J++)j[J]=H[2*J]+(H[2*J+1]<<8);j[15]&=32767}function d(j,H,J){for(let T=0;T<16;T++)j[T]=H[T]+J[T]}function p(j,H,J){for(let T=0;T<16;T++)j[T]=H[T]-J[T]}function y(j,H,J){let T,z,ue=0,_e=0,G=0,E=0,m=0,f=0,g=0,v=0,x=0,_=0,S=0,b=0,M=0,I=0,F=0,ce=0,N=0,se=0,ee=0,X=0,Q=0,R=0,Z=0,te=0,le=0,ie=0,fe=0,ve=0,Me=0,Ne=0,Te=0,$e=J[0],Ie=J[1],Le=J[2],Ve=J[3],ke=J[4],ze=J[5],He=J[6],Ee=J[7],Qe=J[8],ct=J[9],Be=J[10],et=J[11],rt=J[12],Je=J[13],pt=J[14],ht=J[15];T=H[0],ue+=T*$e,_e+=T*Ie,G+=T*Le,E+=T*Ve,m+=T*ke,f+=T*ze,g+=T*He,v+=T*Ee,x+=T*Qe,_+=T*ct,S+=T*Be,b+=T*et,M+=T*rt,I+=T*Je,F+=T*pt,ce+=T*ht,T=H[1],_e+=T*$e,G+=T*Ie,E+=T*Le,m+=T*Ve,f+=T*ke,g+=T*ze,v+=T*He,x+=T*Ee,_+=T*Qe,S+=T*ct,b+=T*Be,M+=T*et,I+=T*rt,F+=T*Je,ce+=T*pt,N+=T*ht,T=H[2],G+=T*$e,E+=T*Ie,m+=T*Le,f+=T*Ve,g+=T*ke,v+=T*ze,x+=T*He,_+=T*Ee,S+=T*Qe,b+=T*ct,M+=T*Be,I+=T*et,F+=T*rt,ce+=T*Je,N+=T*pt,se+=T*ht,T=H[3],E+=T*$e,m+=T*Ie,f+=T*Le,g+=T*Ve,v+=T*ke,x+=T*ze,_+=T*He,S+=T*Ee,b+=T*Qe,M+=T*ct,I+=T*Be,F+=T*et,ce+=T*rt,N+=T*Je,se+=T*pt,ee+=T*ht,T=H[4],m+=T*$e,f+=T*Ie,g+=T*Le,v+=T*Ve,x+=T*ke,_+=T*ze,S+=T*He,b+=T*Ee,M+=T*Qe,I+=T*ct,F+=T*Be,ce+=T*et,N+=T*rt,se+=T*Je,ee+=T*pt,X+=T*ht,T=H[5],f+=T*$e,g+=T*Ie,v+=T*Le,x+=T*Ve,_+=T*ke,S+=T*ze,b+=T*He,M+=T*Ee,I+=T*Qe,F+=T*ct,ce+=T*Be,N+=T*et,se+=T*rt,ee+=T*Je,X+=T*pt,Q+=T*ht,T=H[6],g+=T*$e,v+=T*Ie,x+=T*Le,_+=T*Ve,S+=T*ke,b+=T*ze,M+=T*He,I+=T*Ee,F+=T*Qe,ce+=T*ct,N+=T*Be,se+=T*et,ee+=T*rt,X+=T*Je,Q+=T*pt,R+=T*ht,T=H[7],v+=T*$e,x+=T*Ie,_+=T*Le,S+=T*Ve,b+=T*ke,M+=T*ze,I+=T*He,F+=T*Ee,ce+=T*Qe,N+=T*ct,se+=T*Be,ee+=T*et,X+=T*rt,Q+=T*Je,R+=T*pt,Z+=T*ht,T=H[8],x+=T*$e,_+=T*Ie,S+=T*Le,b+=T*Ve,M+=T*ke,I+=T*ze,F+=T*He,ce+=T*Ee,N+=T*Qe,se+=T*ct,ee+=T*Be,X+=T*et,Q+=T*rt,R+=T*Je,Z+=T*pt,te+=T*ht,T=H[9],_+=T*$e,S+=T*Ie,b+=T*Le,M+=T*Ve,I+=T*ke,F+=T*ze,ce+=T*He,N+=T*Ee,se+=T*Qe,ee+=T*ct,X+=T*Be,Q+=T*et,R+=T*rt,Z+=T*Je,te+=T*pt,le+=T*ht,T=H[10],S+=T*$e,b+=T*Ie,M+=T*Le,I+=T*Ve,F+=T*ke,ce+=T*ze,N+=T*He,se+=T*Ee,ee+=T*Qe,X+=T*ct,Q+=T*Be,R+=T*et,Z+=T*rt,te+=T*Je,le+=T*pt,ie+=T*ht,T=H[11],b+=T*$e,M+=T*Ie,I+=T*Le,F+=T*Ve,ce+=T*ke,N+=T*ze,se+=T*He,ee+=T*Ee,X+=T*Qe,Q+=T*ct,R+=T*Be,Z+=T*et,te+=T*rt,le+=T*Je,ie+=T*pt,fe+=T*ht,T=H[12],M+=T*$e,I+=T*Ie,F+=T*Le,ce+=T*Ve,N+=T*ke,se+=T*ze,ee+=T*He,X+=T*Ee,Q+=T*Qe,R+=T*ct,Z+=T*Be,te+=T*et,le+=T*rt,ie+=T*Je,fe+=T*pt,ve+=T*ht,T=H[13],I+=T*$e,F+=T*Ie,ce+=T*Le,N+=T*Ve,se+=T*ke,ee+=T*ze,X+=T*He,Q+=T*Ee,R+=T*Qe,Z+=T*ct,te+=T*Be,le+=T*et,ie+=T*rt,fe+=T*Je,ve+=T*pt,Me+=T*ht,T=H[14],F+=T*$e,ce+=T*Ie,N+=T*Le,se+=T*Ve,ee+=T*ke,X+=T*ze,Q+=T*He,R+=T*Ee,Z+=T*Qe,te+=T*ct,le+=T*Be,ie+=T*et,fe+=T*rt,ve+=T*Je,Me+=T*pt,Ne+=T*ht,T=H[15],ce+=T*$e,N+=T*Ie,se+=T*Le,ee+=T*Ve,X+=T*ke,Q+=T*ze,R+=T*He,Z+=T*Ee,te+=T*Qe,le+=T*ct,ie+=T*Be,fe+=T*et,ve+=T*rt,Me+=T*Je,Ne+=T*pt,Te+=T*ht,ue+=38*N,_e+=38*se,G+=38*ee,E+=38*X,m+=38*Q,f+=38*R,g+=38*Z,v+=38*te,x+=38*le,_+=38*ie,S+=38*fe,b+=38*ve,M+=38*Me,I+=38*Ne,F+=38*Te,z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=g+z+65535,z=Math.floor(T/65536),g=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ce+z+65535,z=Math.floor(T/65536),ce=T-z*65536,ue+=z-1+37*(z-1),z=1,T=ue+z+65535,z=Math.floor(T/65536),ue=T-z*65536,T=_e+z+65535,z=Math.floor(T/65536),_e=T-z*65536,T=G+z+65535,z=Math.floor(T/65536),G=T-z*65536,T=E+z+65535,z=Math.floor(T/65536),E=T-z*65536,T=m+z+65535,z=Math.floor(T/65536),m=T-z*65536,T=f+z+65535,z=Math.floor(T/65536),f=T-z*65536,T=g+z+65535,z=Math.floor(T/65536),g=T-z*65536,T=v+z+65535,z=Math.floor(T/65536),v=T-z*65536,T=x+z+65535,z=Math.floor(T/65536),x=T-z*65536,T=_+z+65535,z=Math.floor(T/65536),_=T-z*65536,T=S+z+65535,z=Math.floor(T/65536),S=T-z*65536,T=b+z+65535,z=Math.floor(T/65536),b=T-z*65536,T=M+z+65535,z=Math.floor(T/65536),M=T-z*65536,T=I+z+65535,z=Math.floor(T/65536),I=T-z*65536,T=F+z+65535,z=Math.floor(T/65536),F=T-z*65536,T=ce+z+65535,z=Math.floor(T/65536),ce=T-z*65536,ue+=z-1+37*(z-1),j[0]=ue,j[1]=_e,j[2]=G,j[3]=E,j[4]=m,j[5]=f,j[6]=g,j[7]=v,j[8]=x,j[9]=_,j[10]=S,j[11]=b,j[12]=M,j[13]=I,j[14]=F,j[15]=ce}function A(j,H){y(j,H,H)}function P(j,H){const J=n();for(let T=0;T<16;T++)J[T]=H[T];for(let T=253;T>=0;T--)A(J,J),T!==2&&T!==4&&y(J,J,H);for(let T=0;T<16;T++)j[T]=J[T]}function O(j,H){const J=new Uint8Array(32),T=new Float64Array(80),z=n(),ue=n(),_e=n(),G=n(),E=n(),m=n();for(let x=0;x<31;x++)J[x]=j[x];J[31]=j[31]&127|64,J[0]&=248,l(T,H);for(let x=0;x<16;x++)ue[x]=T[x];z[0]=G[0]=1;for(let x=254;x>=0;--x){const _=J[x>>>3]>>>(x&7)&1;a(z,ue,_),a(_e,G,_),d(E,z,_e),p(z,z,_e),d(_e,ue,G),p(ue,ue,G),A(G,E),A(m,z),y(z,_e,z),y(_e,ue,E),d(E,z,_e),p(z,z,_e),A(ue,z),p(_e,G,m),y(z,_e,s),d(z,z,G),y(_e,_e,z),y(z,G,m),y(G,ue,T),A(ue,E),a(z,ue,_),a(_e,G,_)}for(let x=0;x<16;x++)T[x+16]=z[x],T[x+32]=_e[x],T[x+48]=ue[x],T[x+64]=G[x];const f=T.subarray(32),g=T.subarray(16);P(f,f),y(g,g,f);const v=new Uint8Array(32);return u(v,g),v}t.scalarMult=O;function D(j){return O(j,i)}t.scalarMultBase=D;function k(j){if(j.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const H=new Uint8Array(j);return{publicKey:D(H),secretKey:H}}t.generateKeyPairFromSeed=k;function B(j){const H=(0,e.randomBytes)(32,j),J=k(H);return(0,r.wipe)(H),J}t.generateKeyPair=B;function q(j,H,J=!1){if(j.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(H.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const T=O(j,H);if(J){let z=0;for(let ue=0;ue",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}};var Ti={},Wm={exports:{}};Wm.exports,function(t){(function(e,r){function n(G,E){if(!G)throw new Error(E||"Assertion failed")}function i(G,E){G.super_=E;var m=function(){};m.prototype=E.prototype,G.prototype=new m,G.prototype.constructor=G}function s(G,E,m){if(s.isBN(G))return G;this.negative=0,this.words=null,this.length=0,this.red=null,G!==null&&((E==="le"||E==="be")&&(m=E,E=10),this._init(G||0,E||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=tl.Buffer}catch{}s.isBN=function(E){return E instanceof s?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===s.wordSize&&Array.isArray(E.words)},s.max=function(E,m){return E.cmp(m)>0?E:m},s.min=function(E,m){return E.cmp(m)<0?E:m},s.prototype._init=function(E,m,f){if(typeof E=="number")return this._initNumber(E,m,f);if(typeof E=="object")return this._initArray(E,m,f);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),E=E.toString().replace(/\s+/g,"");var g=0;E[0]==="-"&&(g++,this.negative=1),g=0;g-=3)x=E[g]|E[g-1]<<8|E[g-2]<<16,this.words[v]|=x<<_&67108863,this.words[v+1]=x>>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);else if(f==="le")for(g=0,v=0;g>>26-_&67108863,_+=24,_>=26&&(_-=26,v++);return this.strip()};function a(G,E){var m=G.charCodeAt(E);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function u(G,E,m){var f=a(G,m);return m-1>=E&&(f|=a(G,m-1)<<4),f}s.prototype._parseHex=function(E,m,f){this.length=Math.ceil((E.length-m)/6),this.words=new Array(this.length);for(var g=0;g=m;g-=2)_=u(E,m,g)<=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8;else{var S=E.length-m;for(g=S%2===0?m+1:m;g=18?(v-=18,x+=1,this.words[x]|=_>>>26):v+=8}this.strip()};function l(G,E,m,f){for(var g=0,v=Math.min(G.length,m),x=E;x=49?g+=_-49+10:_>=17?g+=_-17+10:g+=_}return g}s.prototype._parseBase=function(E,m,f){this.words=[0],this.length=1;for(var g=0,v=1;v<=67108863;v*=m)g++;g--,v=v/m|0;for(var x=E.length-f,_=x%g,S=Math.min(x,x-_)+f,b=0,M=f;M1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var d=["","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"],p=[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],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(E,m){E=E||10,m=m|0||1;var f;if(E===16||E==="hex"){f="";for(var g=0,v=0,x=0;x>>24-g&16777215,g+=2,g>=26&&(g-=26,x--),v!==0||x!==this.length-1?f=d[6-S.length]+S+f:f=S+f}for(v!==0&&(f=v.toString(16)+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(E===(E|0)&&E>=2&&E<=36){var b=p[E],M=y[E];f="";var I=this.clone();for(I.negative=0;!I.isZero();){var F=I.modn(M).toString(E);I=I.idivn(M),I.isZero()?f=F+f:f=d[b-F.length]+F+f}for(this.isZero()&&(f="0"+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(E,m){return n(typeof o<"u"),this.toArrayLike(o,E,m)},s.prototype.toArray=function(E,m){return this.toArrayLike(Array,E,m)},s.prototype.toArrayLike=function(E,m,f){var g=this.byteLength(),v=f||Math.max(1,g);n(g<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var x=m==="le",_=new E(v),S,b,M=this.clone();if(x){for(b=0;!M.isZero();b++)S=M.andln(255),M.iushrn(8),_[b]=S;for(;b=4096&&(f+=13,m>>>=13),m>=64&&(f+=7,m>>>=7),m>=8&&(f+=4,m>>>=4),m>=2&&(f+=2,m>>>=2),f+m},s.prototype._zeroBits=function(E){if(E===0)return 26;var m=E,f=0;return m&8191||(f+=13,m>>>=13),m&127||(f+=7,m>>>=7),m&15||(f+=4,m>>>=4),m&3||(f+=2,m>>>=2),m&1||f++,f},s.prototype.bitLength=function(){var E=this.words[this.length-1],m=this._countBits(E);return(this.length-1)*26+m};function A(G){for(var E=new Array(G.bitLength()),m=0;m>>g}return E}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,m=0;mE.length?this.clone().ior(E):E.clone().ior(this)},s.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},s.prototype.iuand=function(E){var m;this.length>E.length?m=E:m=this;for(var f=0;fE.length?this.clone().iand(E):E.clone().iand(this)},s.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},s.prototype.iuxor=function(E){var m,f;this.length>E.length?(m=this,f=E):(m=E,f=this);for(var g=0;gE.length?this.clone().ixor(E):E.clone().ixor(this)},s.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},s.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var m=Math.ceil(E/26)|0,f=E%26;this._expand(m),f>0&&m--;for(var g=0;g0&&(this.words[g]=~this.words[g]&67108863>>26-f),this.strip()},s.prototype.notn=function(E){return this.clone().inotn(E)},s.prototype.setn=function(E,m){n(typeof E=="number"&&E>=0);var f=E/26|0,g=E%26;return this._expand(f+1),m?this.words[f]=this.words[f]|1<E.length?(f=this,g=E):(f=E,g=this);for(var v=0,x=0;x>>26;for(;v!==0&&x>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;xE.length?this.clone().iadd(E):E.clone().iadd(this)},s.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var m=this.iadd(E);return E.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var f=this.cmp(E);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var g,v;f>0?(g=this,v=E):(g=E,v=this);for(var x=0,_=0;_>26,this.words[_]=m&67108863;for(;x!==0&&_>26,this.words[_]=m&67108863;if(x===0&&_>>26,I=S&67108863,F=Math.min(b,E.length-1),ce=Math.max(0,b-G.length+1);ce<=F;ce++){var N=b-ce|0;g=G.words[N]|0,v=E.words[ce]|0,x=g*v+I,M+=x/67108864|0,I=x&67108863}m.words[b]=I|0,S=M|0}return S!==0?m.words[b]=S|0:m.length--,m.strip()}var O=function(E,m,f){var g=E.words,v=m.words,x=f.words,_=0,S,b,M,I=g[0]|0,F=I&8191,ce=I>>>13,N=g[1]|0,se=N&8191,ee=N>>>13,X=g[2]|0,Q=X&8191,R=X>>>13,Z=g[3]|0,te=Z&8191,le=Z>>>13,ie=g[4]|0,fe=ie&8191,ve=ie>>>13,Me=g[5]|0,Ne=Me&8191,Te=Me>>>13,$e=g[6]|0,Ie=$e&8191,Le=$e>>>13,Ve=g[7]|0,ke=Ve&8191,ze=Ve>>>13,He=g[8]|0,Ee=He&8191,Qe=He>>>13,ct=g[9]|0,Be=ct&8191,et=ct>>>13,rt=v[0]|0,Je=rt&8191,pt=rt>>>13,ht=v[1]|0,ft=ht&8191,Ht=ht>>>13,Jt=v[2]|0,St=Jt&8191,er=Jt>>>13,Xt=v[3]|0,Ot=Xt&8191,Bt=Xt>>>13,Tt=v[4]|0,vt=Tt&8191,Dt=Tt>>>13,Lt=v[5]|0,bt=Lt&8191,$t=Lt>>>13,jt=v[6]|0,nt=jt&8191,Ft=jt>>>13,$=v[7]|0,W=$&8191,V=$>>>13,C=v[8]|0,Y=C&8191,U=C>>>13,oe=v[9]|0,ge=oe&8191,xe=oe>>>13;f.negative=E.negative^m.negative,f.length=19,S=Math.imul(F,Je),b=Math.imul(F,pt),b=b+Math.imul(ce,Je)|0,M=Math.imul(ce,pt);var Re=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Re>>>26)|0,Re&=67108863,S=Math.imul(se,Je),b=Math.imul(se,pt),b=b+Math.imul(ee,Je)|0,M=Math.imul(ee,pt),S=S+Math.imul(F,ft)|0,b=b+Math.imul(F,Ht)|0,b=b+Math.imul(ce,ft)|0,M=M+Math.imul(ce,Ht)|0;var De=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(De>>>26)|0,De&=67108863,S=Math.imul(Q,Je),b=Math.imul(Q,pt),b=b+Math.imul(R,Je)|0,M=Math.imul(R,pt),S=S+Math.imul(se,ft)|0,b=b+Math.imul(se,Ht)|0,b=b+Math.imul(ee,ft)|0,M=M+Math.imul(ee,Ht)|0,S=S+Math.imul(F,St)|0,b=b+Math.imul(F,er)|0,b=b+Math.imul(ce,St)|0,M=M+Math.imul(ce,er)|0;var it=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(it>>>26)|0,it&=67108863,S=Math.imul(te,Je),b=Math.imul(te,pt),b=b+Math.imul(le,Je)|0,M=Math.imul(le,pt),S=S+Math.imul(Q,ft)|0,b=b+Math.imul(Q,Ht)|0,b=b+Math.imul(R,ft)|0,M=M+Math.imul(R,Ht)|0,S=S+Math.imul(se,St)|0,b=b+Math.imul(se,er)|0,b=b+Math.imul(ee,St)|0,M=M+Math.imul(ee,er)|0,S=S+Math.imul(F,Ot)|0,b=b+Math.imul(F,Bt)|0,b=b+Math.imul(ce,Ot)|0,M=M+Math.imul(ce,Bt)|0;var Ue=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,S=Math.imul(fe,Je),b=Math.imul(fe,pt),b=b+Math.imul(ve,Je)|0,M=Math.imul(ve,pt),S=S+Math.imul(te,ft)|0,b=b+Math.imul(te,Ht)|0,b=b+Math.imul(le,ft)|0,M=M+Math.imul(le,Ht)|0,S=S+Math.imul(Q,St)|0,b=b+Math.imul(Q,er)|0,b=b+Math.imul(R,St)|0,M=M+Math.imul(R,er)|0,S=S+Math.imul(se,Ot)|0,b=b+Math.imul(se,Bt)|0,b=b+Math.imul(ee,Ot)|0,M=M+Math.imul(ee,Bt)|0,S=S+Math.imul(F,vt)|0,b=b+Math.imul(F,Dt)|0,b=b+Math.imul(ce,vt)|0,M=M+Math.imul(ce,Dt)|0;var gt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(gt>>>26)|0,gt&=67108863,S=Math.imul(Ne,Je),b=Math.imul(Ne,pt),b=b+Math.imul(Te,Je)|0,M=Math.imul(Te,pt),S=S+Math.imul(fe,ft)|0,b=b+Math.imul(fe,Ht)|0,b=b+Math.imul(ve,ft)|0,M=M+Math.imul(ve,Ht)|0,S=S+Math.imul(te,St)|0,b=b+Math.imul(te,er)|0,b=b+Math.imul(le,St)|0,M=M+Math.imul(le,er)|0,S=S+Math.imul(Q,Ot)|0,b=b+Math.imul(Q,Bt)|0,b=b+Math.imul(R,Ot)|0,M=M+Math.imul(R,Bt)|0,S=S+Math.imul(se,vt)|0,b=b+Math.imul(se,Dt)|0,b=b+Math.imul(ee,vt)|0,M=M+Math.imul(ee,Dt)|0,S=S+Math.imul(F,bt)|0,b=b+Math.imul(F,$t)|0,b=b+Math.imul(ce,bt)|0,M=M+Math.imul(ce,$t)|0;var st=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(st>>>26)|0,st&=67108863,S=Math.imul(Ie,Je),b=Math.imul(Ie,pt),b=b+Math.imul(Le,Je)|0,M=Math.imul(Le,pt),S=S+Math.imul(Ne,ft)|0,b=b+Math.imul(Ne,Ht)|0,b=b+Math.imul(Te,ft)|0,M=M+Math.imul(Te,Ht)|0,S=S+Math.imul(fe,St)|0,b=b+Math.imul(fe,er)|0,b=b+Math.imul(ve,St)|0,M=M+Math.imul(ve,er)|0,S=S+Math.imul(te,Ot)|0,b=b+Math.imul(te,Bt)|0,b=b+Math.imul(le,Ot)|0,M=M+Math.imul(le,Bt)|0,S=S+Math.imul(Q,vt)|0,b=b+Math.imul(Q,Dt)|0,b=b+Math.imul(R,vt)|0,M=M+Math.imul(R,Dt)|0,S=S+Math.imul(se,bt)|0,b=b+Math.imul(se,$t)|0,b=b+Math.imul(ee,bt)|0,M=M+Math.imul(ee,$t)|0,S=S+Math.imul(F,nt)|0,b=b+Math.imul(F,Ft)|0,b=b+Math.imul(ce,nt)|0,M=M+Math.imul(ce,Ft)|0;var tt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(tt>>>26)|0,tt&=67108863,S=Math.imul(ke,Je),b=Math.imul(ke,pt),b=b+Math.imul(ze,Je)|0,M=Math.imul(ze,pt),S=S+Math.imul(Ie,ft)|0,b=b+Math.imul(Ie,Ht)|0,b=b+Math.imul(Le,ft)|0,M=M+Math.imul(Le,Ht)|0,S=S+Math.imul(Ne,St)|0,b=b+Math.imul(Ne,er)|0,b=b+Math.imul(Te,St)|0,M=M+Math.imul(Te,er)|0,S=S+Math.imul(fe,Ot)|0,b=b+Math.imul(fe,Bt)|0,b=b+Math.imul(ve,Ot)|0,M=M+Math.imul(ve,Bt)|0,S=S+Math.imul(te,vt)|0,b=b+Math.imul(te,Dt)|0,b=b+Math.imul(le,vt)|0,M=M+Math.imul(le,Dt)|0,S=S+Math.imul(Q,bt)|0,b=b+Math.imul(Q,$t)|0,b=b+Math.imul(R,bt)|0,M=M+Math.imul(R,$t)|0,S=S+Math.imul(se,nt)|0,b=b+Math.imul(se,Ft)|0,b=b+Math.imul(ee,nt)|0,M=M+Math.imul(ee,Ft)|0,S=S+Math.imul(F,W)|0,b=b+Math.imul(F,V)|0,b=b+Math.imul(ce,W)|0,M=M+Math.imul(ce,V)|0;var At=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(At>>>26)|0,At&=67108863,S=Math.imul(Ee,Je),b=Math.imul(Ee,pt),b=b+Math.imul(Qe,Je)|0,M=Math.imul(Qe,pt),S=S+Math.imul(ke,ft)|0,b=b+Math.imul(ke,Ht)|0,b=b+Math.imul(ze,ft)|0,M=M+Math.imul(ze,Ht)|0,S=S+Math.imul(Ie,St)|0,b=b+Math.imul(Ie,er)|0,b=b+Math.imul(Le,St)|0,M=M+Math.imul(Le,er)|0,S=S+Math.imul(Ne,Ot)|0,b=b+Math.imul(Ne,Bt)|0,b=b+Math.imul(Te,Ot)|0,M=M+Math.imul(Te,Bt)|0,S=S+Math.imul(fe,vt)|0,b=b+Math.imul(fe,Dt)|0,b=b+Math.imul(ve,vt)|0,M=M+Math.imul(ve,Dt)|0,S=S+Math.imul(te,bt)|0,b=b+Math.imul(te,$t)|0,b=b+Math.imul(le,bt)|0,M=M+Math.imul(le,$t)|0,S=S+Math.imul(Q,nt)|0,b=b+Math.imul(Q,Ft)|0,b=b+Math.imul(R,nt)|0,M=M+Math.imul(R,Ft)|0,S=S+Math.imul(se,W)|0,b=b+Math.imul(se,V)|0,b=b+Math.imul(ee,W)|0,M=M+Math.imul(ee,V)|0,S=S+Math.imul(F,Y)|0,b=b+Math.imul(F,U)|0,b=b+Math.imul(ce,Y)|0,M=M+Math.imul(ce,U)|0;var Rt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,S=Math.imul(Be,Je),b=Math.imul(Be,pt),b=b+Math.imul(et,Je)|0,M=Math.imul(et,pt),S=S+Math.imul(Ee,ft)|0,b=b+Math.imul(Ee,Ht)|0,b=b+Math.imul(Qe,ft)|0,M=M+Math.imul(Qe,Ht)|0,S=S+Math.imul(ke,St)|0,b=b+Math.imul(ke,er)|0,b=b+Math.imul(ze,St)|0,M=M+Math.imul(ze,er)|0,S=S+Math.imul(Ie,Ot)|0,b=b+Math.imul(Ie,Bt)|0,b=b+Math.imul(Le,Ot)|0,M=M+Math.imul(Le,Bt)|0,S=S+Math.imul(Ne,vt)|0,b=b+Math.imul(Ne,Dt)|0,b=b+Math.imul(Te,vt)|0,M=M+Math.imul(Te,Dt)|0,S=S+Math.imul(fe,bt)|0,b=b+Math.imul(fe,$t)|0,b=b+Math.imul(ve,bt)|0,M=M+Math.imul(ve,$t)|0,S=S+Math.imul(te,nt)|0,b=b+Math.imul(te,Ft)|0,b=b+Math.imul(le,nt)|0,M=M+Math.imul(le,Ft)|0,S=S+Math.imul(Q,W)|0,b=b+Math.imul(Q,V)|0,b=b+Math.imul(R,W)|0,M=M+Math.imul(R,V)|0,S=S+Math.imul(se,Y)|0,b=b+Math.imul(se,U)|0,b=b+Math.imul(ee,Y)|0,M=M+Math.imul(ee,U)|0,S=S+Math.imul(F,ge)|0,b=b+Math.imul(F,xe)|0,b=b+Math.imul(ce,ge)|0,M=M+Math.imul(ce,xe)|0;var Mt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,S=Math.imul(Be,ft),b=Math.imul(Be,Ht),b=b+Math.imul(et,ft)|0,M=Math.imul(et,Ht),S=S+Math.imul(Ee,St)|0,b=b+Math.imul(Ee,er)|0,b=b+Math.imul(Qe,St)|0,M=M+Math.imul(Qe,er)|0,S=S+Math.imul(ke,Ot)|0,b=b+Math.imul(ke,Bt)|0,b=b+Math.imul(ze,Ot)|0,M=M+Math.imul(ze,Bt)|0,S=S+Math.imul(Ie,vt)|0,b=b+Math.imul(Ie,Dt)|0,b=b+Math.imul(Le,vt)|0,M=M+Math.imul(Le,Dt)|0,S=S+Math.imul(Ne,bt)|0,b=b+Math.imul(Ne,$t)|0,b=b+Math.imul(Te,bt)|0,M=M+Math.imul(Te,$t)|0,S=S+Math.imul(fe,nt)|0,b=b+Math.imul(fe,Ft)|0,b=b+Math.imul(ve,nt)|0,M=M+Math.imul(ve,Ft)|0,S=S+Math.imul(te,W)|0,b=b+Math.imul(te,V)|0,b=b+Math.imul(le,W)|0,M=M+Math.imul(le,V)|0,S=S+Math.imul(Q,Y)|0,b=b+Math.imul(Q,U)|0,b=b+Math.imul(R,Y)|0,M=M+Math.imul(R,U)|0,S=S+Math.imul(se,ge)|0,b=b+Math.imul(se,xe)|0,b=b+Math.imul(ee,ge)|0,M=M+Math.imul(ee,xe)|0;var Et=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Et>>>26)|0,Et&=67108863,S=Math.imul(Be,St),b=Math.imul(Be,er),b=b+Math.imul(et,St)|0,M=Math.imul(et,er),S=S+Math.imul(Ee,Ot)|0,b=b+Math.imul(Ee,Bt)|0,b=b+Math.imul(Qe,Ot)|0,M=M+Math.imul(Qe,Bt)|0,S=S+Math.imul(ke,vt)|0,b=b+Math.imul(ke,Dt)|0,b=b+Math.imul(ze,vt)|0,M=M+Math.imul(ze,Dt)|0,S=S+Math.imul(Ie,bt)|0,b=b+Math.imul(Ie,$t)|0,b=b+Math.imul(Le,bt)|0,M=M+Math.imul(Le,$t)|0,S=S+Math.imul(Ne,nt)|0,b=b+Math.imul(Ne,Ft)|0,b=b+Math.imul(Te,nt)|0,M=M+Math.imul(Te,Ft)|0,S=S+Math.imul(fe,W)|0,b=b+Math.imul(fe,V)|0,b=b+Math.imul(ve,W)|0,M=M+Math.imul(ve,V)|0,S=S+Math.imul(te,Y)|0,b=b+Math.imul(te,U)|0,b=b+Math.imul(le,Y)|0,M=M+Math.imul(le,U)|0,S=S+Math.imul(Q,ge)|0,b=b+Math.imul(Q,xe)|0,b=b+Math.imul(R,ge)|0,M=M+Math.imul(R,xe)|0;var dt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(dt>>>26)|0,dt&=67108863,S=Math.imul(Be,Ot),b=Math.imul(Be,Bt),b=b+Math.imul(et,Ot)|0,M=Math.imul(et,Bt),S=S+Math.imul(Ee,vt)|0,b=b+Math.imul(Ee,Dt)|0,b=b+Math.imul(Qe,vt)|0,M=M+Math.imul(Qe,Dt)|0,S=S+Math.imul(ke,bt)|0,b=b+Math.imul(ke,$t)|0,b=b+Math.imul(ze,bt)|0,M=M+Math.imul(ze,$t)|0,S=S+Math.imul(Ie,nt)|0,b=b+Math.imul(Ie,Ft)|0,b=b+Math.imul(Le,nt)|0,M=M+Math.imul(Le,Ft)|0,S=S+Math.imul(Ne,W)|0,b=b+Math.imul(Ne,V)|0,b=b+Math.imul(Te,W)|0,M=M+Math.imul(Te,V)|0,S=S+Math.imul(fe,Y)|0,b=b+Math.imul(fe,U)|0,b=b+Math.imul(ve,Y)|0,M=M+Math.imul(ve,U)|0,S=S+Math.imul(te,ge)|0,b=b+Math.imul(te,xe)|0,b=b+Math.imul(le,ge)|0,M=M+Math.imul(le,xe)|0;var _t=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(_t>>>26)|0,_t&=67108863,S=Math.imul(Be,vt),b=Math.imul(Be,Dt),b=b+Math.imul(et,vt)|0,M=Math.imul(et,Dt),S=S+Math.imul(Ee,bt)|0,b=b+Math.imul(Ee,$t)|0,b=b+Math.imul(Qe,bt)|0,M=M+Math.imul(Qe,$t)|0,S=S+Math.imul(ke,nt)|0,b=b+Math.imul(ke,Ft)|0,b=b+Math.imul(ze,nt)|0,M=M+Math.imul(ze,Ft)|0,S=S+Math.imul(Ie,W)|0,b=b+Math.imul(Ie,V)|0,b=b+Math.imul(Le,W)|0,M=M+Math.imul(Le,V)|0,S=S+Math.imul(Ne,Y)|0,b=b+Math.imul(Ne,U)|0,b=b+Math.imul(Te,Y)|0,M=M+Math.imul(Te,U)|0,S=S+Math.imul(fe,ge)|0,b=b+Math.imul(fe,xe)|0,b=b+Math.imul(ve,ge)|0,M=M+Math.imul(ve,xe)|0;var ot=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(ot>>>26)|0,ot&=67108863,S=Math.imul(Be,bt),b=Math.imul(Be,$t),b=b+Math.imul(et,bt)|0,M=Math.imul(et,$t),S=S+Math.imul(Ee,nt)|0,b=b+Math.imul(Ee,Ft)|0,b=b+Math.imul(Qe,nt)|0,M=M+Math.imul(Qe,Ft)|0,S=S+Math.imul(ke,W)|0,b=b+Math.imul(ke,V)|0,b=b+Math.imul(ze,W)|0,M=M+Math.imul(ze,V)|0,S=S+Math.imul(Ie,Y)|0,b=b+Math.imul(Ie,U)|0,b=b+Math.imul(Le,Y)|0,M=M+Math.imul(Le,U)|0,S=S+Math.imul(Ne,ge)|0,b=b+Math.imul(Ne,xe)|0,b=b+Math.imul(Te,ge)|0,M=M+Math.imul(Te,xe)|0;var wt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(wt>>>26)|0,wt&=67108863,S=Math.imul(Be,nt),b=Math.imul(Be,Ft),b=b+Math.imul(et,nt)|0,M=Math.imul(et,Ft),S=S+Math.imul(Ee,W)|0,b=b+Math.imul(Ee,V)|0,b=b+Math.imul(Qe,W)|0,M=M+Math.imul(Qe,V)|0,S=S+Math.imul(ke,Y)|0,b=b+Math.imul(ke,U)|0,b=b+Math.imul(ze,Y)|0,M=M+Math.imul(ze,U)|0,S=S+Math.imul(Ie,ge)|0,b=b+Math.imul(Ie,xe)|0,b=b+Math.imul(Le,ge)|0,M=M+Math.imul(Le,xe)|0;var lt=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul(Be,W),b=Math.imul(Be,V),b=b+Math.imul(et,W)|0,M=Math.imul(et,V),S=S+Math.imul(Ee,Y)|0,b=b+Math.imul(Ee,U)|0,b=b+Math.imul(Qe,Y)|0,M=M+Math.imul(Qe,U)|0,S=S+Math.imul(ke,ge)|0,b=b+Math.imul(ke,xe)|0,b=b+Math.imul(ze,ge)|0,M=M+Math.imul(ze,xe)|0;var at=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(at>>>26)|0,at&=67108863,S=Math.imul(Be,Y),b=Math.imul(Be,U),b=b+Math.imul(et,Y)|0,M=Math.imul(et,U),S=S+Math.imul(Ee,ge)|0,b=b+Math.imul(Ee,xe)|0,b=b+Math.imul(Qe,ge)|0,M=M+Math.imul(Qe,xe)|0;var Ae=(_+S|0)+((b&8191)<<13)|0;_=(M+(b>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,S=Math.imul(Be,ge),b=Math.imul(Be,xe),b=b+Math.imul(et,ge)|0,M=Math.imul(et,xe);var Pe=(_+S|0)+((b&8191)<<13)|0;return _=(M+(b>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,x[0]=Re,x[1]=De,x[2]=it,x[3]=Ue,x[4]=gt,x[5]=st,x[6]=tt,x[7]=At,x[8]=Rt,x[9]=Mt,x[10]=Et,x[11]=dt,x[12]=_t,x[13]=ot,x[14]=wt,x[15]=lt,x[16]=at,x[17]=Ae,x[18]=Pe,_!==0&&(x[19]=_,f.length++),f};Math.imul||(O=P);function D(G,E,m){m.negative=E.negative^G.negative,m.length=G.length+E.length;for(var f=0,g=0,v=0;v>>26)|0,g+=x>>>26,x&=67108863}m.words[v]=_,f=x,x=g}return f!==0?m.words[v]=f:m.length--,m.strip()}function k(G,E,m){var f=new B;return f.mulp(G,E,m)}s.prototype.mulTo=function(E,m){var f,g=this.length+E.length;return this.length===10&&E.length===10?f=O(this,E,m):g<63?f=P(this,E,m):g<1024?f=D(this,E,m):f=k(this,E,m),f};function B(G,E){this.x=G,this.y=E}B.prototype.makeRBT=function(E){for(var m=new Array(E),f=s.prototype._countBits(E)-1,g=0;g>=1;return g},B.prototype.permute=function(E,m,f,g,v,x){for(var _=0;_>>1)v++;return 1<>>13,f[2*x+1]=v&8191,v=v>>>13;for(x=2*m;x>=26,m+=g/67108864|0,m+=v>>>26,this.words[f]=v&67108863}return m!==0&&(this.words[f]=m,this.length++),this},s.prototype.muln=function(E){return this.clone().imuln(E)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(E){var m=A(E);if(m.length===0)return new s(1);for(var f=this,g=0;g=0);var m=E%26,f=(E-m)/26,g=67108863>>>26-m<<26-m,v;if(m!==0){var x=0;for(v=0;v>>26-m}x&&(this.words[v]=x,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var g;m?g=(m-m%26)/26:g=0;var v=E%26,x=Math.min((E-v)/26,this.length),_=67108863^67108863>>>v<x)for(this.length-=x,b=0;b=0&&(M!==0||b>=g);b--){var I=this.words[b]|0;this.words[b]=M<<26-v|I>>>v,M=I&_}return S&&M!==0&&(S.words[S.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(E,m,f){return n(this.negative===0),this.iushrn(E,m,f)},s.prototype.shln=function(E){return this.clone().ishln(E)},s.prototype.ushln=function(E){return this.clone().iushln(E)},s.prototype.shrn=function(E){return this.clone().ishrn(E)},s.prototype.ushrn=function(E){return this.clone().iushrn(E)},s.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var m=E%26,f=(E-m)/26,g=1<=0);var m=E%26,f=(E-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(m!==0&&f++,this.length=Math.min(f,this.length),m!==0){var g=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(S/67108864|0),this.words[v+f]=x&67108863}for(;v>26,this.words[v+f]=x&67108863;if(_===0)return this.strip();for(n(_===-1),_=0,v=0;v>26,this.words[v]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(E,m){var f=this.length-E.length,g=this.clone(),v=E,x=v.words[v.length-1]|0,_=this._countBits(x);f=26-_,f!==0&&(v=v.ushln(f),g.iushln(f),x=v.words[v.length-1]|0);var S=g.length-v.length,b;if(m!=="mod"){b=new s(null),b.length=S+1,b.words=new Array(b.length);for(var M=0;M=0;F--){var ce=(g.words[v.length+F]|0)*67108864+(g.words[v.length+F-1]|0);for(ce=Math.min(ce/x|0,67108863),g._ishlnsubmul(v,ce,F);g.negative!==0;)ce--,g.negative=0,g._ishlnsubmul(v,1,F),g.isZero()||(g.negative^=1);b&&(b.words[F]=ce)}return b&&b.strip(),g.strip(),m!=="div"&&f!==0&&g.iushrn(f),{div:b||null,mod:g}},s.prototype.divmod=function(E,m,f){if(n(!E.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var g,v,x;return this.negative!==0&&E.negative===0?(x=this.neg().divmod(E,m),m!=="mod"&&(g=x.div.neg()),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.iadd(E)),{div:g,mod:v}):this.negative===0&&E.negative!==0?(x=this.divmod(E.neg(),m),m!=="mod"&&(g=x.div.neg()),{div:g,mod:x.mod}):this.negative&E.negative?(x=this.neg().divmod(E.neg(),m),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.isub(E)),{div:x.div,mod:v}):E.length>this.length||this.cmp(E)<0?{div:new s(0),mod:this}:E.length===1?m==="div"?{div:this.divn(E.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new s(this.modn(E.words[0]))}:this._wordDiv(E,m)},s.prototype.div=function(E){return this.divmod(E,"div",!1).div},s.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},s.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},s.prototype.divRound=function(E){var m=this.divmod(E);if(m.mod.isZero())return m.div;var f=m.div.negative!==0?m.mod.isub(E):m.mod,g=E.ushrn(1),v=E.andln(1),x=f.cmp(g);return x<0||v===1&&x===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(E){n(E<=67108863);for(var m=(1<<26)%E,f=0,g=this.length-1;g>=0;g--)f=(m*f+(this.words[g]|0))%E;return f},s.prototype.idivn=function(E){n(E<=67108863);for(var m=0,f=this.length-1;f>=0;f--){var g=(this.words[f]|0)+m*67108864;this.words[f]=g/E|0,m=g%E}return this.strip()},s.prototype.divn=function(E){return this.clone().idivn(E)},s.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=new s(0),_=new s(1),S=0;m.isEven()&&f.isEven();)m.iushrn(1),f.iushrn(1),++S;for(var b=f.clone(),M=m.clone();!m.isZero();){for(var I=0,F=1;!(m.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(m.iushrn(I);I-- >0;)(g.isOdd()||v.isOdd())&&(g.iadd(b),v.isub(M)),g.iushrn(1),v.iushrn(1);for(var ce=0,N=1;!(f.words[0]&N)&&ce<26;++ce,N<<=1);if(ce>0)for(f.iushrn(ce);ce-- >0;)(x.isOdd()||_.isOdd())&&(x.iadd(b),_.isub(M)),x.iushrn(1),_.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(x),v.isub(_)):(f.isub(m),x.isub(g),_.isub(v))}return{a:x,b:_,gcd:f.iushln(S)}},s.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=f.clone();m.cmpn(1)>0&&f.cmpn(1)>0;){for(var _=0,S=1;!(m.words[0]&S)&&_<26;++_,S<<=1);if(_>0)for(m.iushrn(_);_-- >0;)g.isOdd()&&g.iadd(x),g.iushrn(1);for(var b=0,M=1;!(f.words[0]&M)&&b<26;++b,M<<=1);if(b>0)for(f.iushrn(b);b-- >0;)v.isOdd()&&v.iadd(x),v.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(v)):(f.isub(m),v.isub(g))}var I;return m.cmpn(1)===0?I=g:I=v,I.cmpn(0)<0&&I.iadd(E),I},s.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var m=this.clone(),f=E.clone();m.negative=0,f.negative=0;for(var g=0;m.isEven()&&f.isEven();g++)m.iushrn(1),f.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=m.cmp(f);if(v<0){var x=m;m=f,f=x}else if(v===0||f.cmpn(1)===0)break;m.isub(f)}while(!0);return f.iushln(g)},s.prototype.invm=function(E){return this.egcd(E).a.umod(E)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(E){return this.words[0]&E},s.prototype.bincn=function(E){n(typeof E=="number");var m=E%26,f=(E-m)/26,g=1<>>26,_&=67108863,this.words[x]=_}return v!==0&&(this.words[x]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(E){var m=E<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var f;if(this.length>1)f=1;else{m&&(E=-E),n(E<=67108863,"Number is too big");var g=this.words[0]|0;f=g===E?0:gE.length)return 1;if(this.length=0;f--){var g=this.words[f]|0,v=E.words[f]|0;if(g!==v){gv&&(m=1);break}}return m},s.prototype.gtn=function(E){return this.cmpn(E)===1},s.prototype.gt=function(E){return this.cmp(E)===1},s.prototype.gten=function(E){return this.cmpn(E)>=0},s.prototype.gte=function(E){return this.cmp(E)>=0},s.prototype.ltn=function(E){return this.cmpn(E)===-1},s.prototype.lt=function(E){return this.cmp(E)===-1},s.prototype.lten=function(E){return this.cmpn(E)<=0},s.prototype.lte=function(E){return this.cmp(E)<=0},s.prototype.eqn=function(E){return this.cmpn(E)===0},s.prototype.eq=function(E){return this.cmp(E)===0},s.red=function(E){return new ue(E)},s.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(E){return this.red=E,this},s.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},s.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},s.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},s.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},s.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},s.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},s.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},s.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var q={k256:null,p224:null,p192:null,p25519:null};function j(G,E){this.name=G,this.p=new s(E,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var E=new s(null);return E.words=new Array(Math.ceil(this.n/13)),E},j.prototype.ireduce=function(E){var m=E,f;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),f=m.bitLength();while(f>this.n);var g=f0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},j.prototype.split=function(E,m){E.iushrn(this.n,0,m)},j.prototype.imulK=function(E){return E.imul(this.k)};function H(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(H,j),H.prototype.split=function(E,m){for(var f=4194303,g=Math.min(E.length,9),v=0;v>>22,x=_}x>>>=22,E.words[v-10]=x,x===0&&E.length>10?E.length-=10:E.length-=9},H.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var m=0,f=0;f>>=26,E.words[f]=v,m=g}return m!==0&&(E.words[E.length++]=m),E},s._prime=function(E){if(q[E])return q[E];var m;if(E==="k256")m=new H;else if(E==="p224")m=new J;else if(E==="p192")m=new T;else if(E==="p25519")m=new z;else throw new Error("Unknown prime "+E);return q[E]=m,m};function ue(G){if(typeof G=="string"){var E=s._prime(G);this.m=E.p,this.prime=E}else n(G.gtn(1),"modulus must be greater than 1"),this.m=G,this.prime=null}ue.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},ue.prototype._verify2=function(E,m){n((E.negative|m.negative)===0,"red works only with positives"),n(E.red&&E.red===m.red,"red works only with red numbers")},ue.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},ue.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},ue.prototype.add=function(E,m){this._verify2(E,m);var f=E.add(m);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},ue.prototype.iadd=function(E,m){this._verify2(E,m);var f=E.iadd(m);return f.cmp(this.m)>=0&&f.isub(this.m),f},ue.prototype.sub=function(E,m){this._verify2(E,m);var f=E.sub(m);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},ue.prototype.isub=function(E,m){this._verify2(E,m);var f=E.isub(m);return f.cmpn(0)<0&&f.iadd(this.m),f},ue.prototype.shl=function(E,m){return this._verify1(E),this.imod(E.ushln(m))},ue.prototype.imul=function(E,m){return this._verify2(E,m),this.imod(E.imul(m))},ue.prototype.mul=function(E,m){return this._verify2(E,m),this.imod(E.mul(m))},ue.prototype.isqr=function(E){return this.imul(E,E.clone())},ue.prototype.sqr=function(E){return this.mul(E,E)},ue.prototype.sqrt=function(E){if(E.isZero())return E.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(E,f)}for(var g=this.m.subn(1),v=0;!g.isZero()&&g.andln(1)===0;)v++,g.iushrn(1);n(!g.isZero());var x=new s(1).toRed(this),_=x.redNeg(),S=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new s(2*b*b).toRed(this);this.pow(b,S).cmp(_)!==0;)b.redIAdd(_);for(var M=this.pow(b,g),I=this.pow(E,g.addn(1).iushrn(1)),F=this.pow(E,g),ce=v;F.cmp(x)!==0;){for(var N=F,se=0;N.cmp(x)!==0;se++)N=N.redSqr();n(se=0;v--){for(var M=m.words[v],I=b-1;I>=0;I--){var F=M>>I&1;if(x!==g[0]&&(x=this.sqr(x)),F===0&&_===0){S=0;continue}_<<=1,_|=F,S++,!(S!==f&&(v!==0||I!==0))&&(x=this.mul(x,g[_]),S=0,_=0)}b=26}return x},ue.prototype.convertTo=function(E){var m=E.umod(this.m);return m===E?m.clone():m},ue.prototype.convertFrom=function(E){var m=E.clone();return m.red=null,m},s.mont=function(E){return new _e(E)};function _e(G){ue.call(this,G),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(_e,ue),_e.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},_e.prototype.convertFrom=function(E){var m=this.imod(E.mul(this.rinv));return m.red=null,m},_e.prototype.imul=function(E,m){if(E.isZero()||m.isZero())return E.words[0]=0,E.length=1,E;var f=E.imul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.mul=function(E,m){if(E.isZero()||m.isZero())return new s(0)._forceRed(this);var f=E.mul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},_e.prototype.invm=function(E){var m=this.imod(E._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,nn)}(Wm);var xo=Wm.exports,Km={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var u=0;u>8,p=l&255;d?a.push(d,p):a.push(p)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(O>>1)-1?k=(O>>1)-B:k=B,D.isubn(k)):k=0,A[P]=k,D.iushrn(1)}return A}e.getNAF=s;function o(d,p){var y=[[],[]];d=d.clone(),p=p.clone();for(var A=0,P=0,O;d.cmpn(-A)>0||p.cmpn(-P)>0;){var D=d.andln(3)+A&3,k=p.andln(3)+P&3;D===3&&(D=-1),k===3&&(k=-1);var B;D&1?(O=d.andln(7)+A&7,(O===3||O===5)&&k===2?B=-D:B=D):B=0,y[0].push(B);var q;k&1?(O=p.andln(7)+P&7,(O===3||O===5)&&D===2?q=-k:q=k):q=0,y[1].push(q),2*A===B+1&&(A=1-A),2*P===q+1&&(P=1-P),d.iushrn(1),p.iushrn(1)}return y}e.getJSF=o;function a(d,p,y){var A="_"+p;d.prototype[p]=function(){return this[A]!==void 0?this[A]:this[A]=y.call(this)}}e.cachedProperty=a;function u(d){return typeof d=="string"?e.toArray(d,"hex"):d}e.parseBytes=u;function l(d){return new r(d,"hex","le")}e.intFromLE=l}(Ti);var Vm={exports:{}},Gm;Vm.exports=function(e){return Gm||(Gm=new aa(null)),Gm.generate(e)};function aa(t){this.rand=t}if(Vm.exports.Rand=aa,aa.prototype.generate=function(e){return this._rand(e)},aa.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Rd=ca;ca.prototype.point=function(){throw new Error("Not implemented")},ca.prototype.validate=function(){throw new Error("Not implemented")},ca.prototype._fixedNafMul=function(e,r){Td(e.precomputed);var n=e._getDoubles(),i=Cd(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Td(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},ca.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var P=d-1,O=d;if(o[P]!==1||o[O]!==1){u[P]=Cd(n[P],o[P],this._bitLength),u[O]=Cd(n[O],o[O],this._bitLength),l=Math.max(u[P].length,l),l=Math.max(u[O].length,l);continue}var D=[r[P],null,null,r[O]];r[P].y.cmp(r[O].y)===0?(D[1]=r[P].add(r[O]),D[2]=r[P].toJ().mixedAdd(r[O].neg())):r[P].y.cmp(r[O].y.redNeg())===0?(D[1]=r[P].toJ().mixedAdd(r[O]),D[2]=r[P].add(r[O].neg())):(D[1]=r[P].toJ().mixedAdd(r[O]),D[2]=r[P].toJ().mixedAdd(r[O].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],B=Nk(n[P],n[O]);for(l=Math.max(B[0].length,l),u[P]=new Array(l),u[O]=new Array(l),p=0;p=0;d--){for(var T=0;d>=0;){var z=!0;for(p=0;p=0&&T++,H=H.dblp(T),d<0)break;for(p=0;p0?y=a[p][ue-1>>1]:ue<0&&(y=a[p][-ue-1>>1].neg()),y.type==="affine"?H=H.mixedAdd(y):H=H.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Ki.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(A=l,P=d),p.negative&&(p=p.neg(),y=y.neg()),A.negative&&(A=A.neg(),P=P.neg()),[{a:p,b:y},{a:A,b:P}]},Vi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Vi.prototype.pointFromX=function(e,r){e=new en(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Vi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Vi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Nn.prototype.isInfinity=function(){return this.inf},Nn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Nn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Nn.prototype.getX=function(){return this.x.fromRed()},Nn.prototype.getY=function(){return this.y.fromRed()},Nn.prototype.mul=function(e){return e=new en(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Nn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Nn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Nn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Nn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Nn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function qn(t,e,r,n){yu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new en(0)):(this.x=new en(e,16),this.y=new en(r,16),this.z=new en(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Jm(qn,yu.BasePoint),Vi.prototype.jpoint=function(e,r,n){return new qn(this,e,r,n)},qn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},qn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},qn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),A=l.redSqr().redIAdd(p).redISub(y).redISub(y),P=l.redMul(y.redISub(A)).redISub(o.redMul(p)),O=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(A,P,O)},qn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),A=u.redMul(p.redISub(y)).redISub(s.redMul(d)),P=this.z.redMul(a);return this.curve.jpoint(y,A,P)},qn.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},qn.prototype.inspect=function(){return this.isInfinity()?"":""},qn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var wu=xo,C3=yd,Dd=Rd,$k=Ti;function xu(t){Dd.call(this,"mont",t),this.a=new wu(t.a,16).toRed(this.red),this.b=new wu(t.b,16).toRed(this.red),this.i4=new wu(4).toRed(this.red).redInvm(),this.two=new wu(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}C3(xu,Dd);var Fk=xu;xu.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function Ln(t,e,r){Dd.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new wu(e,16),this.z=new wu(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}C3(Ln,Dd.BasePoint),xu.prototype.decodePoint=function(e,r){return this.point($k.toArray(e,r),1)},xu.prototype.point=function(e,r){return new Ln(this,e,r)},xu.prototype.pointFromJSON=function(e){return Ln.fromJSON(this,e)},Ln.prototype.precompute=function(){},Ln.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Ln.fromJSON=function(e,r){return new Ln(e,r[0],r[1]||e.one)},Ln.prototype.inspect=function(){return this.isInfinity()?"":""},Ln.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Ln.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)},Ln.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Ln.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),u=s.redMul(i),l=r.z.redMul(a.redAdd(u).redSqr()),d=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(l,d)},Ln.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i},Ln.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Ln.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Ln.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Ln.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Ln.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var jk=Ti,_o=xo,T3=yd,Od=Rd,Uk=jk.assert;function zs(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Od.call(this,"edwards",t),this.a=new _o(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new _o(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new _o(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Uk(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}T3(zs,Od);var qk=zs;zs.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},zs.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},zs.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)},zs.prototype.pointFromX=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var u=a.fromRed().isOdd();return(r&&!u||!r&&u)&&(a=a.redNeg()),this.point(e,a)},zs.prototype.pointFromY=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)},zs.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function Hr(t,e,r,n,i){Od.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new _o(e,16),this.y=new _o(r,16),this.z=n?new _o(n,16):this.curve.one,this.t=i&&new _o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}T3(Hr,Od.BasePoint),zs.prototype.pointFromJSON=function(e){return Hr.fromJSON(this,e)},zs.prototype.point=function(e,r,n,i){return new Hr(this,e,r,n,i)},Hr.fromJSON=function(e,r){return new Hr(e,r[0],r[1],r[2])},Hr.prototype.inspect=function(){return this.isInfinity()?"":""},Hr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Hr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),u=i.redSub(r),l=s.redMul(a),d=o.redMul(u),p=s.redMul(u),y=a.redMul(o);return this.curve.point(l,d,y,p)},Hr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,u,l;if(this.curve.twisted){a=this.curve._mulA(r);var d=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(d.redSub(this.curve.two)),s=d.redMul(a.redSub(n)),o=d.redSqr().redSub(d).redSub(d)):(u=this.z.redSqr(),l=d.redSub(u).redISub(u),i=e.redSub(r).redISub(n).redMul(l),s=d.redMul(a.redSub(n)),o=d.redMul(l))}else a=r.redAdd(n),u=this.curve._mulC(this.z).redSqr(),l=a.redSub(u).redSub(u),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)},Hr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Hr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),u=s.redAdd(i),l=n.redAdd(r),d=o.redMul(a),p=u.redMul(l),y=o.redMul(l),A=a.redMul(u);return this.curve.point(d,p,A,y)},Hr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),u=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),d=r.redMul(a).redMul(l),p,y;return this.curve.twisted?(p=r.redMul(u).redMul(s.redSub(this.curve._mulA(i))),y=a.redMul(u)):(p=r.redMul(u).redMul(s.redSub(i)),y=this.curve._mulC(a).redMul(u)),this.curve.point(d,p,y)},Hr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Hr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Hr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)},Hr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)},Hr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Hr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Hr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Hr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Hr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Hr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Hr.prototype.toP=Hr.prototype.normalize,Hr.prototype.mixedAdd=Hr.prototype.add,function(t){var e=t;e.base=Rd,e.short=Bk,e.mont=Fk,e.edwards=qk}(Ym);var Nd={},Xm,R3;function zk(){return R3||(R3=1,Xm={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Xm}(function(t){var e=t,r=al,n=Ym,i=Ti,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,d){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var p=new o(d);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:p}),p}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=zk()}catch{u=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})})(Nd);var Hk=al,Za=Km,D3=Ga;function ua(t){if(!(this instanceof ua))return new ua(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Za.toArray(t.entropy,t.entropyEnc||"hex"),r=Za.toArray(t.nonce,t.nonceEnc||"hex"),n=Za.toArray(t.pers,t.persEnc||"hex");D3(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Wk=ua;ua.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ua.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Za.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var Ld=xo,Qm=Ti,Yk=Qm.assert;function kd(t,e){if(t instanceof kd)return t;this._importDER(t,e)||(Yk(t.r&&t.s,"Signature without r or s"),this.r=new Ld(t.r,16),this.s=new Ld(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Jk=kd;function Xk(){this.place=0}function e1(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function O3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}kd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=O3(r),n=O3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];t1(i,r.length),i=i.concat(r),i.push(2),t1(i,n.length);var s=i.concat(n),o=[48];return t1(o,s.length),o=o.concat(s),Qm.encode(o,e)};var Eo=xo,N3=Wk,Zk=Ti,r1=Nd,Qk=I3,L3=Zk.assert,n1=Gk,Bd=Jk;function Gi(t){if(!(this instanceof Gi))return new Gi(t);typeof t=="string"&&(L3(Object.prototype.hasOwnProperty.call(r1,t),"Unknown curve "+t),t=r1[t]),t instanceof r1.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var eB=Gi;Gi.prototype.keyPair=function(e){return new n1(this,e)},Gi.prototype.keyFromPrivate=function(e,r){return n1.fromPrivate(this,e,r)},Gi.prototype.keyFromPublic=function(e,r){return n1.fromPublic(this,e,r)},Gi.prototype.genKeyPair=function(e){e||(e={});for(var r=new N3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Qk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new Eo(2));;){var s=new Eo(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Gi.prototype._truncateToN=function(e,r,n){var i;if(Eo.isBN(e)||typeof e=="number")e=new Eo(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new Eo(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new Eo(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Gi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new N3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new Eo(1)),d=0;;d++){var p=i.k?i.k(d):new Eo(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var A=y.getX(),P=A.umod(this.n);if(P.cmpn(0)!==0){var O=p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e));if(O=O.umod(this.n),O.cmpn(0)!==0){var D=(y.getY().isOdd()?1:0)|(A.cmp(P)!==0?2:0);return i.canonical&&O.cmp(this.nh)>0&&(O=this.n.sub(O),D^=1),new Bd({r:P,s:O,recoveryParam:D})}}}}}},Gi.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new Bd(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),l=u.mul(e).umod(this.n),d=u.mul(o).umod(this.n),p;return this.curve._maxwellTrick?(p=this.g.jmulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.eqXToP(o)):(p=this.g.mulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.getX().umod(this.n).cmp(o)===0)},Gi.prototype.recoverPubKey=function(t,e,r,n){L3((3&r)===r,"The recovery param is more than two bits"),e=new Bd(e,n);var i=this.n,s=new Eo(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Gi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Bd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var dl=Ti,k3=dl.assert,B3=dl.parseBytes,_u=dl.cachedProperty;function kn(t,e){this.eddsa=t,this._secret=B3(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=B3(e.pub)}kn.fromPublic=function(e,r){return r instanceof kn?r:new kn(e,{pub:r})},kn.fromSecret=function(e,r){return r instanceof kn?r:new kn(e,{secret:r})},kn.prototype.secret=function(){return this._secret},_u(kn,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),_u(kn,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),_u(kn,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i}),_u(kn,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),_u(kn,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),_u(kn,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),kn.prototype.sign=function(e){return k3(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},kn.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},kn.prototype.getSecret=function(e){return k3(this._secret,"KeyPair is public only"),dl.encode(this.secret(),e)},kn.prototype.getPublic=function(e){return dl.encode(this.pubBytes(),e)};var tB=kn,rB=xo,$d=Ti,$3=$d.assert,Fd=$d.cachedProperty,nB=$d.parseBytes;function Qa(t,e){this.eddsa=t,typeof e!="object"&&(e=nB(e)),Array.isArray(e)&&($3(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),$3(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof rB&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Fd(Qa,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Fd(Qa,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Fd(Qa,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Fd(Qa,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Qa.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Qa.prototype.toHex=function(){return $d.encode(this.toBytes(),"hex").toUpperCase()};var iB=Qa,sB=al,oB=Nd,Eu=Ti,aB=Eu.assert,F3=Eu.parseBytes,j3=tB,U3=iB;function vi(t){if(aB(t==="ed25519","only tested with ed25519 so far"),!(this instanceof vi))return new vi(t);t=oB[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=sB.sha512}var cB=vi;vi.prototype.sign=function(e,r){e=F3(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),u=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:u,Rencoded:o})},vi.prototype.verify=function(e,r,n){if(e=F3(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)},vi.prototype.hashInt=function(){for(var e=this.hash(),r=0;re in t?lB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,W3=(t,e)=>{for(var r in e||(e={}))hB.call(e,r)&&H3(t,r,e[r]);if(z3)for(var r of z3(e))dB.call(e,r)&&H3(t,r,e[r]);return t};const pB="ReactNative",Ri={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},gB="js";function jd(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Au(){return!nl()&&!!mm()&&navigator.product===pB}function pl(){return!jd()&&!!mm()&&!!nl()}function gl(){return Au()?Ri.reactNative:jd()?Ri.node:pl()?Ri.browser:Ri.unknown}function mB(){var t;try{return Au()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function vB(t,e){let r=il.parse(t);return r=W3(W3({},r),e),t=il.stringify(r),t}function K3(){return Px()||{name:"",description:"",url:"",icons:[""]}}function bB(){if(gl()===Ri.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=HO();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function yB(){var t;const e=gl();return e===Ri.browser?[e,((t=Ax())==null?void 0:t.host)||"unknown"].join(":"):e}function V3(t,e,r){const n=bB(),i=yB();return[[t,e].join("-"),[gB,r].join("-"),n,i].join("/")}function wB({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const u=r.split("?"),l=V3(t,e,n),d={auth:i,ua:l,projectId:s,useOnCloseEvent:o,origin:a||void 0},p=vB(u[1]||"",d);return u[0]+"?"+p}function ec(t,e){return t.filter(r=>e.includes(r)).length===t.length}function G3(t){return Object.fromEntries(t.entries())}function Y3(t){return new Map(Object.entries(t))}function tc(t=mt.FIVE_MINUTES,e){const r=mt.toMiliseconds(t||mt.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Pu(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function J3(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function xB(t){return J3("topic",t)}function _B(t){return J3("id",t)}function X3(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function En(t,e){return mt.fromMiliseconds(Date.now()+mt.toMiliseconds(t))}function fa(t){return Date.now()>=mt.toMiliseconds(t)}function vr(t,e){return`${t}${e?`:${e}`:""}`}function Ud(t=[],e=[]){return[...new Set([...t,...e])]}async function EB({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=SB(s,t,e),a=gl();if(a===Ri.browser){if(!((n=nl())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,PB()?"_blank":"_self","noreferrer noopener")}else a===Ri.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function SB(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${MB(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function AB(t,e){let r="";try{if(pl()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function Z3(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function Q3(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function i1(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function PB(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function MB(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function e_(t){return Buffer.from(t,"base64").toString("utf-8")}const IB="https://rpc.walletconnect.org/v1";async function CB(t,e,r,n,i,s){switch(r.t){case"eip191":return TB(t,e,r.s);case"eip1271":return await RB(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function TB(t,e,r){return yk(qx(e),r).toLowerCase()===t.toLowerCase()}async function RB(t,e,r,n,i,s){const o=Su(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",d=r.substring(2),p=qx(e).substring(2),y=a+p+u+l+d,A=await fetch(`${s||IB}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:DB(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:y},"latest"]})}),{result:P}=await A.json();return P?P.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function DB(){return Date.now()+Math.floor(Math.random()*1e3)}var OB=Object.defineProperty,NB=Object.defineProperties,LB=Object.getOwnPropertyDescriptors,t_=Object.getOwnPropertySymbols,kB=Object.prototype.hasOwnProperty,BB=Object.prototype.propertyIsEnumerable,r_=(t,e,r)=>e in t?OB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$B=(t,e)=>{for(var r in e||(e={}))kB.call(e,r)&&r_(t,r,e[r]);if(t_)for(var r of t_(e))BB.call(e,r)&&r_(t,r,e[r]);return t},FB=(t,e)=>NB(t,LB(e));const jB="did:pkh:",s1=t=>t==null?void 0:t.split(":"),UB=t=>{const e=t&&s1(t);if(e)return t.includes(jB)?e[3]:e[1]},o1=t=>{const e=t&&s1(t);if(e)return e[2]+":"+e[3]},qd=t=>{const e=t&&s1(t);if(e)return e.pop()};async function n_(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=i_(i,i.iss),o=qd(i.iss);return await CB(o,s,n,o1(i.iss),r)}const i_=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=qd(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${UB(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,d=t.exp?`Expiration Time: ${t.exp}`:void 0,p=t.nbf?`Not Before: ${t.nbf}`:void 0,y=t.requestId?`Request ID: ${t.requestId}`:void 0,A=t.resources?`Resources:${t.resources.map(O=>` +- ${O}`).join("")}`:void 0,P=zd(t.resources);if(P){const O=ml(P);i=JB(i,O)}return[r,n,"",i,"",s,o,a,u,l,d,p,y,A].filter(O=>O!=null).join(` +`)};function qB(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function zB(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function rc(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function HB(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:WB(e,r,n)}}}function WB(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function s_(t){return rc(t),`urn:recap:${qB(t).replace(/=/g,"")}`}function ml(t){const e=zB(t.replace("urn:recap:",""));return rc(e),e}function KB(t,e,r){const n=HB(t,e,r);return s_(n)}function VB(t){return t&&t.includes("urn:recap:")}function GB(t,e){const r=ml(t),n=ml(e),i=YB(r,n);return s_(i)}function YB(t,e){rc(t),rc(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,u)=>a.localeCompare(u)).forEach(a=>{var u,l;n.att[i]=FB($B({},n.att[i]),{[a]:((u=t.att[i])==null?void 0:u[a])||((l=e.att[i])==null?void 0:l[a])})})}),n}function JB(t="",e){rc(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const u=Object.keys(e.att[a]).map(p=>({ability:p.split("/")[0],action:p.split("/")[1]}));u.sort((p,y)=>p.action.localeCompare(y.action));const l={};u.forEach(p=>{l[p.ability]||(l[p.ability]=[]),l[p.ability].push(p.action)});const d=Object.keys(l).map(p=>(i++,`(${i}) '${p}': '${l[p].join("', '")}' for '${a}'.`));n.push(d.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function o_(t){var e;const r=ml(t);rc(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function a_(t){const e=ml(t);rc(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function zd(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return VB(e)?e:void 0}const c_="base10",ni="base16",la="base64pad",vl="base64url",bl="utf8",u_=0,So=1,yl=2,XB=0,f_=1,wl=12,a1=32;function ZB(){const t=Hm.generateKeyPair();return{privateKey:Rn(t.secretKey,ni),publicKey:Rn(t.publicKey,ni)}}function c1(){const t=ta.randomBytes(a1);return Rn(t,ni)}function QB(t,e){const r=Hm.sharedKey(Dn(t,ni),Dn(e,ni),!0),n=new Dk(ll.SHA256,r).expand(a1);return Rn(n,ni)}function Hd(t){const e=ll.hash(Dn(t,ni));return Rn(e,ni)}function Ao(t){const e=ll.hash(Dn(t,bl));return Rn(e,ni)}function l_(t){return Dn(`${t}`,c_)}function nc(t){return Number(Rn(t,c_))}function e$(t){const e=l_(typeof t.type<"u"?t.type:u_);if(nc(e)===So&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Dn(t.senderPublicKey,ni):void 0,n=typeof t.iv<"u"?Dn(t.iv,ni):ta.randomBytes(wl),i=new Um.ChaCha20Poly1305(Dn(t.symKey,ni)).seal(n,Dn(t.message,bl));return h_({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function t$(t,e){const r=l_(yl),n=ta.randomBytes(wl),i=Dn(t,bl);return h_({type:r,sealed:i,iv:n,encoding:e})}function r$(t){const e=new Um.ChaCha20Poly1305(Dn(t.symKey,ni)),{sealed:r,iv:n}=xl({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Rn(i,bl)}function n$(t,e){const{sealed:r}=xl({encoded:t,encoding:e});return Rn(r,bl)}function h_(t){const{encoding:e=la}=t;if(nc(t.type)===yl)return Rn(pd([t.type,t.sealed]),e);if(nc(t.type)===So){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Rn(pd([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return Rn(pd([t.type,t.iv,t.sealed]),e)}function xl(t){const{encoded:e,encoding:r=la}=t,n=Dn(e,r),i=n.slice(XB,f_),s=f_;if(nc(i)===So){const l=s+a1,d=l+wl,p=n.slice(s,l),y=n.slice(l,d),A=n.slice(d);return{type:i,sealed:A,iv:y,senderPublicKey:p}}if(nc(i)===yl){const l=n.slice(s),d=ta.randomBytes(wl);return{type:i,sealed:l,iv:d}}const o=s+wl,a=n.slice(s,o),u=n.slice(o);return{type:i,sealed:u,iv:a}}function i$(t,e){const r=xl({encoded:t,encoding:e==null?void 0:e.encoding});return d_({type:nc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Rn(r.senderPublicKey,ni):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function d_(t){const e=(t==null?void 0:t.type)||u_;if(e===So){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function p_(t){return t.type===So&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function g_(t){return t.type===yl}function s$(t){return new P3.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function o$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function a$(t){return Buffer.from(o$(t),"base64")}function c$(t,e){const[r,n,i]=t.split("."),s=a$(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),u=`${r}.${n}`,l=new ll.SHA256().update(Buffer.from(u)).digest(),d=s$(e),p=Buffer.from(l).toString("hex");if(!d.verify(p,{r:o,s:a}))throw new Error("Invalid signature");return gm(t).payload}const u$="irn";function u1(t){return(t==null?void 0:t.relay)||{protocol:u$}}function _l(t){const e=uB[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var f$=Object.defineProperty,l$=Object.defineProperties,h$=Object.getOwnPropertyDescriptors,m_=Object.getOwnPropertySymbols,d$=Object.prototype.hasOwnProperty,p$=Object.prototype.propertyIsEnumerable,v_=(t,e,r)=>e in t?f$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b_=(t,e)=>{for(var r in e||(e={}))d$.call(e,r)&&v_(t,r,e[r]);if(m_)for(var r of m_(e))p$.call(e,r)&&v_(t,r,e[r]);return t},g$=(t,e)=>l$(t,h$(e));function m$(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function y_(t){if(!t.includes("wc:")){const u=e_(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=il.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:v$(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:m$(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function v$(t){return t.startsWith("//")?t.substring(2):t}function b$(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function w_(t){return`${t.protocol}:${t.topic}@${t.version}?`+il.stringify(b_(g$(b_({symKey:t.symKey},b$(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Wd(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Mu(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function y$(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Mu(r.accounts))}),e}function w$(t,e){const r=[];return Object.values(t).forEach(n=>{Mu(n.accounts).includes(e)&&r.push(...n.methods)}),r}function x$(t,e){const r=[];return Object.values(t).forEach(n=>{Mu(n.accounts).includes(e)&&r.push(...n.events)}),r}function f1(t){return t.includes(":")}function El(t){return f1(t)?t.split(":")[0]:t}function _$(t){const e={};return t==null||t.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function x_(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=_$(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=Ud(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const E$={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},S$={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ut(t,e){const{message:r,code:n}=S$[t];return{message:e?`${r} ${e}`:r,code:n}}function Dr(t,e){const{message:r,code:n}=E$[t];return{message:e?`${r} ${e}`:r,code:n}}function ic(t,e){return!!Array.isArray(t)}function Sl(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function bi(t){return typeof t>"u"}function an(t,e){return e&&bi(t)?!0:typeof t=="string"&&!!t.trim().length}function l1(t,e){return typeof t=="number"&&!isNaN(t)}function A$(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return ec(i,n)?(n.forEach(o=>{const{accounts:a,methods:u,events:l}=t.namespaces[o],d=Mu(a),p=r[o];(!ec(q3(o,p),d)||!ec(p.methods,u)||!ec(p.events,l))&&(s=!1)}),s):!1}function Kd(t){return an(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function P$(t){if(an(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Kd(r)}}return!1}function M$(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(an(t,!1)){if(e(t))return!0;const r=e_(t);return e(r)}}catch{}return!1}function I$(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function C$(t){return t==null?void 0:t.topic}function T$(t,e){let r=null;return an(t==null?void 0:t.publicKey,!1)||(r=ut("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function __(t){let e=!0;return ic(t)?t.length&&(e=t.every(r=>an(r,!1))):e=!1,e}function R$(t,e,r){let n=null;return ic(e)&&e.length?e.forEach(i=>{n||Kd(i)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Kd(t)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function D$(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=R$(i,q3(i,s),`${e} ${r}`);o&&(n=o)}),n}function O$(t,e){let r=null;return ic(t)?t.forEach(n=>{r||P$(n)||(r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function N$(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=O$(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function L$(t,e){let r=null;return __(t==null?void 0:t.methods)?__(t==null?void 0:t.events)||(r=Dr("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Dr("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function E_(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=L$(n,`${e}, namespace`);i&&(r=i)}),r}function k$(t,e,r){let n=null;if(t&&Sl(t)){const i=E_(t,e);i&&(n=i);const s=D$(t,e,r);s&&(n=s)}else n=ut("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function h1(t,e){let r=null;if(t&&Sl(t)){const n=E_(t,e);n&&(r=n);const i=N$(t,e);i&&(r=i)}else r=ut("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function S_(t){return an(t.protocol,!0)}function B$(t,e){let r=!1;return t?t&&ic(t)&&t.length&&t.forEach(n=>{r=S_(n)}):r=!0,r}function $$(t){return typeof t=="number"}function yi(t){return typeof t<"u"&&typeof t!==null}function F$(t){return!(!t||typeof t!="object"||!t.code||!l1(t.code)||!t.message||!an(t.message,!1))}function j$(t){return!(bi(t)||!an(t.method,!1))}function U$(t){return!(bi(t)||bi(t.result)&&bi(t.error)||!l1(t.id)||!an(t.jsonrpc,!1))}function q$(t){return!(bi(t)||!an(t.name,!1))}function A_(t,e){return!(!Kd(e)||!y$(t).includes(e))}function z$(t,e,r){return an(r,!1)?w$(t,e).includes(r):!1}function H$(t,e,r){return an(r,!1)?x$(t,e).includes(r):!1}function P_(t,e,r){let n=null;const i=W$(t),s=K$(e),o=Object.keys(i),a=Object.keys(s),u=M_(Object.keys(t)),l=M_(Object.keys(e)),d=u.filter(p=>!l.includes(p));return d.length&&(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${d.toString()} Received: ${Object.keys(e).toString()}`)),ec(o,a)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} Approved: ${a.toString()}`)),Object.keys(e).forEach(p=>{if(!p.includes(":")||n)return;const y=Mu(e[p].accounts);y.includes(p)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${p} Required: ${p} - Approved: ${y.toString()}`))}),o.forEach(p=>{n||(ec(i[p].methods,s[p].methods)?ec(i[p].events,s[p].events)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${p}`)):n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${p}`))}),n}function W$(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function I_(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function K$(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Mu(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function V$(t,e){return l1(t)&&t<=e.max&&t>=e.min}function C_(){const t=gl();return new Promise(e=>{switch(t){case Ri.browser:e(G$());break;case Ri.reactNative:e(Y$());break;case Ri.node:e(J$());break;default:e(!0)}})}function G$(){return pl()&&(navigator==null?void 0:navigator.onLine)}async function Y$(){if(Au()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function J$(){return!0}function X$(t){switch(gl()){case Ri.browser:Z$(t);break;case Ri.reactNative:Q$(t);break}}function Z$(t){!Au()&&pl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function Q$(t){Au()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const d1={};class Al{static get(e){return d1[e]}static set(e,r){d1[e]=r}static delete(e){delete d1[e]}}const eF="PARSE_ERROR",tF="INVALID_REQUEST",rF="METHOD_NOT_FOUND",nF="INVALID_PARAMS",T_="INTERNAL_ERROR",p1="SERVER_ERROR",iF=[-32700,-32600,-32601,-32602,-32603],Pl={[eF]:{code:-32700,message:"Parse error"},[tF]:{code:-32600,message:"Invalid Request"},[rF]:{code:-32601,message:"Method not found"},[nF]:{code:-32602,message:"Invalid params"},[T_]:{code:-32603,message:"Internal error"},[p1]:{code:-32e3,message:"Server error"}},R_=p1;function sF(t){return iF.includes(t)}function D_(t){return Object.keys(Pl).includes(t)?Pl[t]:Pl[R_]}function oF(t){const e=Object.values(Pl).find(r=>r.code===t);return e||Pl[R_]}function O_(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var N_={},Po={},L_;function aF(){if(L_)return Po;L_=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.isBrowserCryptoAvailable=Po.getSubtleCrypto=Po.getBrowerCrypto=void 0;function t(){return(nn==null?void 0:nn.crypto)||(nn==null?void 0:nn.msCrypto)||{}}Po.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Po.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Po.isBrowserCryptoAvailable=r,Po}var Mo={},k_;function cF(){if(k_)return Mo;k_=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.isBrowser=Mo.isNode=Mo.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Mo.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Mo.isNode=e;function r(){return!t()&&!e()}return Mo.isBrowser=r,Mo}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(aF(),t),e.__exportStar(cF(),t)})(N_);function ha(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function sc(t=6){return BigInt(ha(t))}function da(t,e,r){return{id:r||ha(),jsonrpc:"2.0",method:t,params:e}}function Vd(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Gd(t,e,r){return{id:t,jsonrpc:"2.0",error:uF(e)}}function uF(t,e){return typeof t>"u"?D_(T_):(typeof t=="string"&&(t=Object.assign(Object.assign({},D_(p1)),{message:t})),sF(t.code)&&(t=oF(t.code)),t)}let fF=class{},lF=class extends fF{constructor(){super()}},hF=class extends lF{constructor(e){super()}};const dF="^https?:",pF="^wss?:";function gF(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function B_(t,e){const r=gF(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function $_(t){return B_(t,dF)}function F_(t){return B_(t,pF)}function mF(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function j_(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function g1(t){return j_(t)&&"method"in t}function Yd(t){return j_(t)&&(Hs(t)||Yi(t))}function Hs(t){return"result"in t}function Yi(t){return"error"in t}let Ji=class extends hF{constructor(e){super(e),this.events=new qi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(da(e.method,e.params||[],e.id||sc().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Yi(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Yd(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const vF=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),bF=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",U_=t=>t.split("?")[0],q_=10,yF=vF();let wF=class{constructor(e){if(this.url=e,this.events=new qi.EventEmitter,this.registering=!1,!F_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(mo(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!F_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=N_.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!mF(e)},o=new yF(e,[],s);bF()?o.onerror=a=>{const u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ka(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return O_(e,U_(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>q_&&this.events.setMaxListeners(q_)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${U_(this.url)}`));return this.events.emit("register_error",r),r}};var Jd={exports:{}};Jd.exports,function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",u="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",p="[object Date]",y="[object Error]",A="[object Function]",P="[object GeneratorFunction]",N="[object Map]",D="[object Number]",k="[object Null]",B="[object Object]",q="[object Promise]",j="[object Proxy]",H="[object RegExp]",J="[object Set]",T="[object String]",z="[object Symbol]",ue="[object Undefined]",_e="[object WeakMap]",G="[object ArrayBuffer]",E="[object DataView]",m="[object Float32Array]",f="[object Float64Array]",g="[object Int8Array]",v="[object Int16Array]",x="[object Int32Array]",_="[object Uint8Array]",S="[object Uint8ClampedArray]",b="[object Uint16Array]",M="[object Uint32Array]",I=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,O={};O[m]=O[f]=O[g]=O[v]=O[x]=O[_]=O[S]=O[b]=O[M]=!0,O[a]=O[u]=O[G]=O[d]=O[E]=O[p]=O[y]=O[A]=O[N]=O[D]=O[B]=O[H]=O[J]=O[T]=O[_e]=!1;var se=typeof nn=="object"&&nn&&nn.Object===Object&&nn,ee=typeof self=="object"&&self&&self.Object===Object&&self,X=se||ee||Function("return this")(),Q=e&&!e.nodeType&&e,R=Q&&!0&&t&&!t.nodeType&&t,Z=R&&R.exports===Q,te=Z&&se.process,le=function(){try{return te&&te.binding&&te.binding("util")}catch{}}(),ie=le&&le.isTypedArray;function fe(ce,ye){for(var Ye=-1,It=ce==null?0:ce.length,jr=0,ir=[];++Ye-1}function st(ce,ye){var Ye=this.__data__,It=Xe(Ye,ce);return It<0?(++this.size,Ye.push([ce,ye])):Ye[It][1]=ye,this}Re.prototype.clear=De,Re.prototype.delete=it,Re.prototype.get=Ue,Re.prototype.has=gt,Re.prototype.set=st;function tt(ce){var ye=-1,Ye=ce==null?0:ce.length;for(this.clear();++yewn))return!1;var Ur=ir.get(ce);if(Ur&&ir.get(ye))return Ur==ye;var gn=-1,_i=!0,xn=Ye&s?new _t:void 0;for(ir.set(ce,ye),ir.set(ye,ce);++gn-1&&ce%1==0&&ce-1&&ce%1==0&&ce<=o}function up(ce){var ye=typeof ce;return ce!=null&&(ye=="object"||ye=="function")}function Pc(ce){return ce!=null&&typeof ce=="object"}var fp=ie?Te(ie):dr;function zb(ce){return Ub(ce)?qe(ce):pr(ce)}function Fr(){return[]}function kr(){return!1}t.exports=qb}(Jd,Jd.exports);var xF=Jd.exports;const _F=ji(xF),z_="wc",H_=2,W_="core",Ws=`${z_}@2:${W_}:`,EF={logger:"error"},SF={database:":memory:"},AF="crypto",K_="client_ed25519_seed",PF=mt.ONE_DAY,MF="keychain",IF="0.3",CF="messages",TF="0.3",RF=mt.SIX_HOURS,DF="publisher",V_="irn",OF="error",G_="wss://relay.walletconnect.org",NF="relayer",ii={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},LF="_subscription",Xi={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},kF=.1,m1="2.17.2",Wr={link_mode:"link_mode",relay:"relay"},BF="0.3",$F="WALLETCONNECT_CLIENT_ID",Y_="WALLETCONNECT_LINK_MODE_APPS",Ks={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},FF="subscription",jF="0.3",UF=mt.FIVE_SECONDS*1e3,qF="pairing",zF="0.3",Ml={wc_pairingDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:0},res:{ttl:mt.ONE_DAY,prompt:!1,tag:0}}},oc={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},bs={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},HF="history",WF="0.3",KF="expirer",Zi={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},VF="0.3",GF="verify-api",YF="https://verify.walletconnect.com",J_="https://verify.walletconnect.org",Il=J_,JF=`${Il}/v3`,XF=[YF,J_],ZF="echo",QF="https://echo.walletconnect.com",Vs={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},Io={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},ys={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},ac={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},cc={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Cl={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},ej=.1,tj="event-client",rj=86400,nj="https://pulse.walletconnect.org/batch";function ij(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,j=new Uint8Array(q);k!==B;){for(var H=P[k],J=0,T=q-1;(H!==0||J>>0,j[T]=H%a>>>0,H=H/a>>>0;if(H!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=q-D;z!==q&&j[z]===0;)z++;for(var ue=u.repeat(N);z>>0,q=new Uint8Array(B);P[N];){var j=r[P.charCodeAt(N)];if(j===255)return;for(var H=0,J=B-1;(j!==0||H>>0,q[J]=j%256>>>0,j=j/256>>>0;if(j!==0)throw new Error("Non-zero carry");k=H,N++}if(P[N]!==" "){for(var T=B-k;T!==B&&q[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=q[T++];return z}}}function A(P){var N=y(P);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:A}}var sj=ij,oj=sj;const X_=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},aj=t=>new TextEncoder().encode(t),cj=t=>new TextDecoder().decode(t);class uj{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class fj{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Z_(this,e)}}class lj{constructor(e){this.decoders=e}or(e){return Z_(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Z_=(t,e)=>new lj({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class hj{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new uj(e,r,n),this.decoder=new fj(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Xd=({name:t,prefix:e,encode:r,decode:n})=>new hj(t,e,r,n),Tl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=oj(r,e);return Xd({prefix:t,name:e,encode:n,decode:s=>X_(i(s))})},dj=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},pj=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Xd({prefix:e,name:t,encode(i){return pj(i,n,r)},decode(i){return dj(i,n,r,t)}}),gj=Xd({prefix:"\0",name:"identity",encode:t=>cj(t),decode:t=>aj(t)});var mj=Object.freeze({__proto__:null,identity:gj});const vj=zn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var bj=Object.freeze({__proto__:null,base2:vj});const yj=zn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var wj=Object.freeze({__proto__:null,base8:yj});const xj=Tl({prefix:"9",name:"base10",alphabet:"0123456789"});var _j=Object.freeze({__proto__:null,base10:xj});const Ej=zn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Sj=zn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Aj=Object.freeze({__proto__:null,base16:Ej,base16upper:Sj});const Pj=zn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Mj=zn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ij=zn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Cj=zn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Tj=zn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Rj=zn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Dj=zn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Oj=zn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Nj=zn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Lj=Object.freeze({__proto__:null,base32:Pj,base32upper:Mj,base32pad:Ij,base32padupper:Cj,base32hex:Tj,base32hexupper:Rj,base32hexpad:Dj,base32hexpadupper:Oj,base32z:Nj});const kj=Tl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Bj=Tl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var $j=Object.freeze({__proto__:null,base36:kj,base36upper:Bj});const Fj=Tl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),jj=Tl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Uj=Object.freeze({__proto__:null,base58btc:Fj,base58flickr:jj});const qj=zn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zj=zn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Hj=zn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Wj=zn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Kj=Object.freeze({__proto__:null,base64:qj,base64pad:zj,base64url:Hj,base64urlpad:Wj});const Q_=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Vj=Q_.reduce((t,e,r)=>(t[r]=e,t),[]),Gj=Q_.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Yj(t){return t.reduce((e,r)=>(e+=Vj[r],e),"")}function Jj(t){const e=[];for(const r of t){const n=Gj[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const Xj=Xd({prefix:"🚀",name:"base256emoji",encode:Yj,decode:Jj});var Zj=Object.freeze({__proto__:null,base256emoji:Xj}),Qj=t6,e6=128,eU=127,tU=~eU,rU=Math.pow(2,31);function t6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=rU;)e[r++]=t&255|e6,t/=128;for(;t&tU;)e[r++]=t&255|e6,t>>>=7;return e[r]=t|0,t6.bytes=r-n+1,e}var nU=v1,iU=128,r6=127;function v1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw v1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&r6)<=iU);return v1.bytes=s-n,r}var sU=Math.pow(2,7),oU=Math.pow(2,14),aU=Math.pow(2,21),cU=Math.pow(2,28),uU=Math.pow(2,35),fU=Math.pow(2,42),lU=Math.pow(2,49),hU=Math.pow(2,56),dU=Math.pow(2,63),pU=function(t){return t(n6.encode(t,e,r),e),s6=t=>n6.encodingLength(t),b1=(t,e)=>{const r=e.byteLength,n=s6(t),i=n+s6(r),s=new Uint8Array(i+r);return i6(t,s,0),i6(r,s,n),s.set(e,i),new mU(t,r,e,s)};class mU{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const o6=({name:t,code:e,encode:r})=>new vU(t,e,r);class vU{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?b1(this.code,r):r.then(n=>b1(this.code,n))}else throw Error("Unknown type, must be binary type")}}const a6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),bU=o6({name:"sha2-256",code:18,encode:a6("SHA-256")}),yU=o6({name:"sha2-512",code:19,encode:a6("SHA-512")});var wU=Object.freeze({__proto__:null,sha256:bU,sha512:yU});const c6=0,xU="identity",u6=X_;var _U=Object.freeze({__proto__:null,identity:{code:c6,name:xU,encode:u6,digest:t=>b1(c6,u6(t))}});new TextEncoder,new TextDecoder;const f6={...mj,...bj,...wj,..._j,...Aj,...Lj,...$j,...Uj,...Kj,...Zj};({...wU,..._U});function EU(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function l6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const h6=l6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),y1=l6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=EU(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=ut("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Y3(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?J3(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}},MU=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=AF,this.randomSessionIdentifier=c1(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=_x(i);return xx(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=ZB();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=_x(s),a=this.randomSessionIdentifier;return await LO(a,i,PF,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),u=QB(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||Hd(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=p_(o),u=mo(s);if(m_(a))return t$(u,o==null?void 0:o.encoding);if(g_(a)){const y=a.senderPublicKey,A=a.receiverPublicKey;i=await this.generateSharedKey(y,A)}const l=this.getSymKey(i),{type:d,senderPublicKey:p}=a;return e$({type:d,symKey:l,message:u,senderPublicKey:p,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=i$(s,o);if(m_(a)){const u=n$(s,o==null?void 0:o.encoding);return Ka(u)}if(g_(a)){const u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{const u=this.getSymKey(i),l=r$({symKey:u,encoded:s,encoding:o==null?void 0:o.encoding});return Ka(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=(i,s=la)=>{const o=xl({encoded:i,encoding:s});return nc(o.type)},this.getPayloadSenderPublicKey=(i,s=la)=>{const o=xl({encoded:i,encoding:s});return o.senderPublicKey?Rn(o.senderPublicKey,ni):void 0},this.core=e,this.logger=ri(r,this.name),this.keychain=n||new PU(this.core,this.logger)}get context(){return gi(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(K_)}catch{e=c1(),await this.keychain.set(K_,e)}return AU(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}};class IU extends zR{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=CF,this.version=TF,this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Ao(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Ao(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=ri(e,this.name),this.core=r}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Y3(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?J3(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class CU extends HR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new qi.EventEmitter,this.name=DF,this.queue=new Map,this.publishTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.failedPublishTimeout=mt.toMiliseconds(mt.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||RF,u=u1(s),l=(s==null?void 0:s.prompt)||!1,d=(s==null?void 0:s.tag)||0,p=(s==null?void 0:s.id)||sc().toString(),y={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:d,id:p,attestation:s==null?void 0:s.attestation}},A=`Failed to publish payload, please try again. id:${p} tag:${d}`,P=Date.now();let N,D=1;try{for(;N===void 0;){if(Date.now()-P>this.publishTimeout)throw new Error(A);this.logger.trace({id:p,attempts:D},`publisher.publish - attempt ${D}`),N=await await Pu(this.rpcPublish(n,i,a,u,l,d,p,s==null?void 0:s.attestation).catch(k=>this.logger.warn(k)),this.publishTimeout,A),D++,N||await new Promise(k=>setTimeout(k,this.failedPublishTimeout))}this.relayer.events.emit(ii.publish,y),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:p,topic:n,message:i,opts:s}})}catch(k){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(k),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw k;this.queue.set(p,y)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=ri(r,this.name),this.registerEventListeners()}get context(){return gi(this.logger)}rpcPublish(e,r,n,i,s,o,a,u){var l,d,p,y;const A={method:_l(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:u},id:a};return bi((l=A.params)==null?void 0:l.prompt)&&((d=A.params)==null||delete d.prompt),bi((p=A.params)==null?void 0:p.tag)&&((y=A.params)==null||delete y.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:A}),this.relayer.request(A)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(su.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ii.connection_stalled);return}this.checkQueue()}),this.relayer.on(ii.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class TU{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var RU=Object.defineProperty,DU=Object.defineProperties,OU=Object.getOwnPropertyDescriptors,d6=Object.getOwnPropertySymbols,NU=Object.prototype.hasOwnProperty,LU=Object.prototype.propertyIsEnumerable,p6=(t,e,r)=>e in t?RU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rl=(t,e)=>{for(var r in e||(e={}))NU.call(e,r)&&p6(t,r,e[r]);if(d6)for(var r of d6(e))LU.call(e,r)&&p6(t,r,e[r]);return t},w1=(t,e)=>DU(t,OU(e));class kU extends VR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new TU,this.events=new qi.EventEmitter,this.name=FF,this.version=jF,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Ws,this.subscribeTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=u1(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new mt.Watch;a.start(i);const u=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(u),a.stop(i),s(!0)),a.elapsed(i)>=UF&&(clearInterval(u),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ri(r,this.name),this.clientId=""}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=u1(n);await this.rpcUnsubscribe(e,r,i);const s=Dr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===Wr.relay&&await this.restartToComplete();const s={method:_l(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=Ao(e+this.clientId);if((n==null?void 0:n.transportType)===Wr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},mt.toMiliseconds(mt.ONE_SECOND)),a;const u=await Pu(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return u?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ii.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Pu(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Pu(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:_l(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,w1(Rl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Rl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Rl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Ks.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Ks.deleted,w1(Rl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Ks.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);ic(r)&&this.onBatchSubscribe(r.map((n,i)=>w1(Rl({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(su.pulse,async()=>{await this.checkPending()}),this.events.on(Ks.created,async e=>{const r=Ks.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Ks.deleted,async e=>{const r=Ks.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var BU=Object.defineProperty,g6=Object.getOwnPropertySymbols,$U=Object.prototype.hasOwnProperty,FU=Object.prototype.propertyIsEnumerable,m6=(t,e,r)=>e in t?BU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v6=(t,e)=>{for(var r in e||(e={}))$U.call(e,r)&&m6(t,r,e[r]);if(g6)for(var r of g6(e))FU.call(e,r)&&m6(t,r,e[r]);return t};class jU extends WR{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new qi.EventEmitter,this.name=NF,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=mt.toMiliseconds(mt.THIRTY_SECONDS+mt.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||sc().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(u,l)=>{const d=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Xi.disconnect,d);const p=await o;this.provider.off(Xi.disconnect,d),u(p)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(jd())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(ii.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ii.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Xi.payload,this.onPayloadHandler),this.provider.on(Xi.connect,this.onConnectHandler),this.provider.on(Xi.disconnect,this.onDisconnectHandler),this.provider.on(Xi.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ri(e.logger,this.name):Qf(od({level:e.logger||OF})),this.messages=new IU(this.logger,e.core),this.subscriber=new kU(this,this.logger),this.publisher=new CU(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||G_,this.projectId=e.projectId,this.bundleId=mB(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return gi(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Wr.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",u;const l=d=>{d.topic===e&&(this.subscriber.off(Ks.created,l),u())};return await Promise.all([new Promise(d=>{u=d,this.subscriber.on(Ks.created,l)}),new Promise(async(d,p)=>{a=await this.subscriber.subscribe(e,v6({internal:{throwOnFailedPublish:o}},r)).catch(y=>{o&&p(y)})||a,d()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Pu(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Xi.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Xi.disconnect,i),await Pu(this.provider.connect(),mt.toMiliseconds(mt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await C_())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=En(mt.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(ii.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(jd())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Ji(new wF(wB({sdkVersion:m1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),g1(e)){if(!e.method.endsWith(LF))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:Wr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(v6({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else Yd(e)&&this.events.emit(ii.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ii.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Vd(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Xi.payload,this.onPayloadHandler),this.provider.off(Xi.connect,this.onConnectHandler),this.provider.off(Xi.disconnect,this.onDisconnectHandler),this.provider.off(Xi.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await C_();X$(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(ii.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},mt.toMiliseconds(kF))))}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var UU=Object.defineProperty,b6=Object.getOwnPropertySymbols,qU=Object.prototype.hasOwnProperty,zU=Object.prototype.propertyIsEnumerable,y6=(t,e,r)=>e in t?UU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,w6=(t,e)=>{for(var r in e||(e={}))qU.call(e,r)&&y6(t,r,e[r]);if(b6)for(var r of b6(e))zU.call(e,r)&&y6(t,r,e[r]);return t};class uc extends KR{constructor(e,r,n,i=Ws,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=BF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!bi(o)?this.map.set(this.getKey(o),o):I$(o)?this.map.set(o.id,o):C$(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>_F(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const u=w6(w6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=ri(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class HU{constructor(e,r){this.core=e,this.logger=r,this.name=qF,this.version=zF,this.events=new Yg,this.initialized=!1,this.storagePrefix=Ws,this.ignoredPayloadTypes=[So],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=c1(),s=await this.core.crypto.setSymKey(i),o=En(mt.FIVE_MINUTES),a={protocol:V_},u={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=x_({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(oc.create,u),this.core.expirer.set(s,o),await this.pairings.set(s,u),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Vs.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:u,methods:l}=w_(n.uri);i.props.properties.topic=s,i.addTrace(Vs.pairing_uri_validation_success),i.addTrace(Vs.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(Vs.existing_pairing),d.active)throw i.setError(Io.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Vs.pairing_not_expired)}const p=u||En(mt.FIVE_MINUTES),y={topic:s,relay:a,expiry:p,active:!1,methods:l};this.core.expirer.set(s,p),await this.pairings.set(s,y),i.addTrace(Vs.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(oc.create,y),i.addTrace(Vs.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Vs.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Io.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(A){throw i.setError(Io.subscribe_pairing_topic_failure),A}return i.addTrace(Vs.subscribe_pairing_topic_success),y},this.activate=async({topic:n})=>{this.isInitialized();const i=En(mt.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=tc();this.events.once(vr("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Dr("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,u=this.core.crypto.keychain.get(i);return x_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:u,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=da(i,s),a=await this.core.crypto.encode(n,o),u=Ml[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{const o=Vd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=Gd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method]?Ml[u.request.method].res:Ml.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Dr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>fa(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(oc.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{Hs(i)?this.events.emit(vr("pairing_ping",s),{}):Yi(i)&&this.events.emit(vr("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(oc.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Dr("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Dr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!yi(n)){const{message:a}=ut("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!M$(n.uri)){const{message:a}=ut("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}const o=w_(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&mt.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!an(n,!1)){const{message:i}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(fa(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ut("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=ri(r,this.name),this.pairings=new uc(this.core,this.logger,this.name,this.storagePrefix)}get context(){return gi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ii.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===Wr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{g1(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):Yd(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Zi.expired,async e=>{const{topic:r}=Z3(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(oc.expire,{topic:r}))})}}class WU extends qR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new qi.EventEmitter,this.name=HF,this.version=WF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:En(mt.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(bs.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Yi(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(bs.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(bs.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:da(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(bs.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(bs.created,e=>{const r=bs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.updated,e=>{const r=bs.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.deleted,e=>{const r=bs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(su.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{mt.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(bs.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class KU extends GR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new qi.EventEmitter,this.name=KF,this.version=VF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Zi.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Zi.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return xB(e);if(typeof e=="number")return _B(e);const{message:r}=ut("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Zi.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;mt.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Zi.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(su.pulse,()=>this.checkExpirations()),this.events.on(Zi.created,e=>{const r=Zi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.expired,e=>{const r=Zi.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.deleted,e=>{const r=Zi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class VU extends YR{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=GF,this.verifyUrlV3=JF,this.storagePrefix=Ws,this.version=H_,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&mt.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!pl()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,u=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=nl(),d=this.startAbortTimer(mt.ONE_SECOND*5),p=await new Promise((y,A)=>{const P=()=>{window.removeEventListener("message",D),l.body.removeChild(N),A("attestation aborted")};this.abortController.signal.addEventListener("abort",P);const N=l.createElement("iframe");N.src=u,N.style.display="none",N.addEventListener("error",P,{signal:this.abortController.signal});const D=k=>{if(k.data&&typeof k.data=="string")try{const B=JSON.parse(k.data);if(B.type==="verify_attestation"){if(gm(B.attestation).payload.id!==o)return;clearInterval(d),l.body.removeChild(N),this.abortController.signal.removeEventListener("abort",P),window.removeEventListener("message",D),y(B.attestation===null?"":B.attestation)}}catch(B){this.logger.warn(B)}};l.body.appendChild(N),window.addEventListener("message",D,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",p),p}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(gm(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const u=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,u)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(mt.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Il;return XF.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Il}`),s=Il),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(mt.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=c$(i,s.publicKey),a={hasExpired:mt.toMiliseconds(o.exp)this.abortController.abort(),mt.toMiliseconds(e))}}class GU extends JR{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=ZF,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${QF}/${this.projectId}/clients`;await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=ri(r,this.context)}}var YU=Object.defineProperty,x6=Object.getOwnPropertySymbols,JU=Object.prototype.hasOwnProperty,XU=Object.prototype.propertyIsEnumerable,_6=(t,e,r)=>e in t?YU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dl=(t,e)=>{for(var r in e||(e={}))JU.call(e,r)&&_6(t,r,e[r]);if(x6)for(var r of x6(e))XU.call(e,r)&&_6(t,r,e[r]);return t};class ZU extends XR{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=tj,this.storagePrefix=Ws,this.storageVersion=ej,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!i1())try{const i={eventId:e_(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:G3(this.core.relayer.protocol,this.core.relayer.version,m1)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:u}}=i,l=e_(),d=this.core.projectId||"",p=Date.now(),y=Dl({eventId:l,timestamp:p,props:{event:s,type:o,properties:{topic:a,trace:u}},bundleId:d,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,y),this.shouldPersist=!0),y},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(u=>u.props.properties.topic===o);if(a)return Dl(Dl({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(su.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{mt.fromMiliseconds(Date.now())-mt.fromMiliseconds(i.timestamp)>rj&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Dl(Dl({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${nj}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${m1}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>V3().url,this.logger=ri(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var QU=Object.defineProperty,E6=Object.getOwnPropertySymbols,eq=Object.prototype.hasOwnProperty,tq=Object.prototype.propertyIsEnumerable,S6=(t,e,r)=>e in t?QU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A6=(t,e)=>{for(var r in e||(e={}))eq.call(e,r)&&S6(t,r,e[r]);if(E6)for(var r of E6(e))tq.call(e,r)&&S6(t,r,e[r]);return t};class x1 extends UR{constructor(e){var r;super(e),this.protocol=z_,this.version=H_,this.name=W_,this.events=new qi.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:u})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:Wr.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||G_,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=od({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:EF.logger}),{logger:i,chunkLoggerController:s}=jR({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ri(i,this.name),this.heartbeat=new NT,this.crypto=new MU(this,this.logger,e==null?void 0:e.keychain),this.history=new WU(this,this.logger),this.expirer=new KU(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new hR(A6(A6({},SF),e==null?void 0:e.storageOptions)),this.relayer=new jU({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new HU(this,this.logger),this.verify=new VU(this,this.logger,this.storage),this.echoClient=new GU(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new ZU(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new x1(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem($F,n),r}get context(){return gi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(Y_,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(Y_)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const rq=x1,P6="wc",M6=2,I6="client",_1=`${P6}@${M6}:${I6}:`,E1={name:I6,logger:"error"},C6="WALLETCONNECT_DEEPLINK_CHOICE",nq="proposal",T6="Proposal expired",iq="session",Iu=mt.SEVEN_DAYS,sq="engine",Bn={wc_sessionPropose:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:mt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:mt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1119}}},S1={min:mt.FIVE_MINUTES,max:mt.SEVEN_DAYS},Gs={idle:"IDLE",active:"ACTIVE"},oq="request",aq=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],cq="wc",uq="auth",fq="authKeys",lq="pairingTopics",hq="requests",Zd=`${cq}@${1.5}:${uq}:`,Qd=`${Zd}:PUB_KEY`;var dq=Object.defineProperty,pq=Object.defineProperties,gq=Object.getOwnPropertyDescriptors,R6=Object.getOwnPropertySymbols,mq=Object.prototype.hasOwnProperty,vq=Object.prototype.propertyIsEnumerable,D6=(t,e,r)=>e in t?dq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))mq.call(e,r)&&D6(t,r,e[r]);if(R6)for(var r of R6(e))vq.call(e,r)&&D6(t,r,e[r]);return t},ws=(t,e)=>pq(t,gq(e));class bq extends QR{constructor(e){super(e),this.name=sq,this.events=new Yg,this.initialized=!1,this.requestQueue={state:Gs.idle,queue:[]},this.sessionRequestQueue={state:Gs.idle,queue:[]},this.requestQueueDelay=mt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Bn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=ws(tn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n;let l=i,d,p=!1;try{l&&(p=this.client.core.pairing.pairings.get(l).active)}catch(j){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),j}if(!l||!p){const{topic:j,uri:H}=await this.client.core.pairing.create();l=j,d=H}if(!l){const{message:j}=ut("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(j)}const y=await this.client.core.crypto.generateKeyPair(),A=Bn.wc_sessionPropose.req.ttl||mt.FIVE_MINUTES,P=En(A),N=tn({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:V_}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:P,pairingTopic:l},a&&{sessionProperties:a}),{reject:D,resolve:k,done:B}=tc(A,T6);this.events.once(vr("session_connect"),async({error:j,session:H})=>{if(j)D(j);else if(H){H.self.publicKey=y;const J=ws(tn({},H),{pairingTopic:N.pairingTopic,requiredNamespaces:N.requiredNamespaces,optionalNamespaces:N.optionalNamespaces,transportType:Wr.relay});await this.client.session.set(H.topic,J),await this.setExpiry(H.topic,H.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:H.peer.metadata}),this.cleanupDuplicatePairings(J),k(J)}});const q=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:N,throwOnFailedPublish:!0});return await this.setProposal(q,tn({id:q},N)),{uri:d,approval:B}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[ys.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(z){throw o.setError(ac.no_internet_connection),z}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(z){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(ac.proposal_not_found),z}try{await this.isValidApprove(r)}catch(z){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(ac.session_approve_namespace_validation_failure),z}const{id:a,relayProtocol:u,namespaces:l,sessionProperties:d,sessionConfig:p}=r,y=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:A,proposer:P,requiredNamespaces:N,optionalNamespaces:D}=y;let k=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:A});k||(k=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:ys.session_approve_started,properties:{topic:A,trace:[ys.session_approve_started,ys.session_namespaces_validation_success]}}));const B=await this.client.core.crypto.generateKeyPair(),q=P.publicKey,j=await this.client.core.crypto.generateSharedKey(B,q),H=tn(tn({relay:{protocol:u??"irn"},namespaces:l,controller:{publicKey:B,metadata:this.client.metadata},expiry:En(Iu)},d&&{sessionProperties:d}),p&&{sessionConfig:p}),J=Wr.relay;k.addTrace(ys.subscribing_session_topic);try{await this.client.core.relayer.subscribe(j,{transportType:J})}catch(z){throw k.setError(ac.subscribe_session_topic_failure),z}k.addTrace(ys.subscribe_session_topic_success);const T=ws(tn({},H),{topic:j,requiredNamespaces:N,optionalNamespaces:D,pairingTopic:A,acknowledged:!1,self:H.controller,peer:{publicKey:P.publicKey,metadata:P.metadata},controller:B,transportType:Wr.relay});await this.client.session.set(j,T),k.addTrace(ys.store_session);try{k.addTrace(ys.publishing_session_settle),await this.sendRequest({topic:j,method:"wc_sessionSettle",params:H,throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(ac.session_settle_publish_failure),z}),k.addTrace(ys.session_settle_publish_success),k.addTrace(ys.publishing_session_approve),await this.sendResult({id:a,topic:A,result:{relay:{protocol:u??"irn"},responderPublicKey:B},throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(ac.session_approve_publish_failure),z}),k.addTrace(ys.session_approve_publish_success)}catch(z){throw this.client.logger.error(z),this.client.session.delete(j,Dr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(j),z}return this.client.core.eventClient.deleteEvent({eventId:k.eventId}),await this.client.core.pairing.updateMetadata({topic:A,metadata:P.metadata}),await this.client.proposal.delete(a,Dr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:A}),await this.setExpiry(j,En(Iu)),{topic:j,acknowledged:()=>Promise.resolve(this.client.session.get(j))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:Bn.wc_sessionPropose.reject}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(p){throw this.client.logger.error("update() -> isValidUpdate() failed"),p}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=tc(),u=ha(),l=sc().toString(),d=this.client.session.get(n).namespaces;return this.events.once(vr("session_update",u),({error:p})=>{p?a(p):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:u,relayRpcId:l}).catch(p=>{this.client.logger.error(p),this.client.session.update(n,{namespaces:d}),a(p)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(u){throw this.client.logger.error("extend() -> isValidExtend() failed"),u}const{topic:n}=r,i=ha(),{done:s,resolve:o,reject:a}=tc();return this.events.once(vr("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,En(Iu)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(u=>{a(u)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(P){throw this.client.logger.error("request() -> isValidRequest() failed"),P}const{chainId:n,request:i,topic:s,expiry:o=Bn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=ha(),l=sc().toString(),{done:d,resolve:p,reject:y}=tc(o,"Request expired. Please try again.");this.events.once(vr("session_request",u),({error:P,result:N})=>{P?y(P):p(N)});const A=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return A?(await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:A}).catch(P=>y(P)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),await d()):await Promise.all([new Promise(async P=>{await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(N=>y(N)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),P()}),new Promise(async P=>{var N;if(!((N=a.sessionConfig)!=null&&N.disableDeepLink)){const D=await AB(this.client.core.storage,C6);await EB({id:u,topic:s,wcDeepLink:D})}P()}),d()]).then(P=>P[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);Hs(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Yi(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=ha(),s=sc().toString(),{done:o,resolve:a,reject:u}=tc();this.events.once(vr("session_ping",i),({error:l})=>{l?u(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=sc().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Dr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ut("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>A$(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?Wr.link_mode:Wr.relay;o===Wr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:u="",uri:l,domain:d,nonce:p,type:y,exp:A,nbf:P,methods:N=[],expiry:D}=r,k=[...r.resources||[]],{topic:B,uri:q}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:B,uri:q}});const j=await this.client.core.crypto.generateKeyPair(),H=Hd(j);if(await Promise.all([this.client.auth.authKeys.set(Qd,{responseTopic:H,publicKey:j}),this.client.auth.pairingTopics.set(H,{topic:H,pairingTopic:B})]),await this.client.core.relayer.subscribe(H,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${B}`),N.length>0){const{namespace:_}=Su(a[0]);let S=KB(_,"request",N);zd(k)&&(S=GB(S,k.pop())),k.push(S)}const J=D&&D>Bn.wc_sessionAuthenticate.req.ttl?D:Bn.wc_sessionAuthenticate.req.ttl,T={authPayload:{type:y??"caip122",chains:a,statement:u,aud:l,domain:d,version:"1",nonce:p,iat:new Date().toISOString(),exp:A,nbf:P,resources:k},requester:{publicKey:j,metadata:this.client.metadata},expiryTimestamp:En(J)},z={eip155:{chains:a,methods:[...new Set(["personal_sign",...N])],events:["chainChanged","accountsChanged"]}},ue={requiredNamespaces:{},optionalNamespaces:z,relays:[{protocol:"irn"}],pairingTopic:B,proposer:{publicKey:j,metadata:this.client.metadata},expiryTimestamp:En(Bn.wc_sessionPropose.req.ttl)},{done:_e,resolve:G,reject:E}=tc(J,"Request expired"),m=async({error:_,session:S})=>{if(this.events.off(vr("session_request",g),f),_)E(_);else if(S){S.self.publicKey=j,await this.client.session.set(S.topic,S),await this.setExpiry(S.topic,S.expiry),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:S.peer.metadata});const b=this.client.session.get(S.topic);await this.deleteProposal(v),G({session:b})}},f=async _=>{var S,b,M;if(await this.deletePendingAuthRequest(g,{message:"fulfilled",code:0}),_.error){const X=Dr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return _.error.code===X.code?void 0:(this.events.off(vr("session_connect"),m),E(_.error.message))}await this.deleteProposal(v),this.events.off(vr("session_connect"),m);const{cacaos:I,responder:F}=_.result,ae=[],O=[];for(const X of I){await i_({cacao:X,projectId:this.client.core.projectId})||(this.client.logger.error(X,"Signature verification failed"),E(Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Q}=X,R=zd(Q.resources),Z=[o1(Q.iss)],te=qd(Q.iss);if(R){const le=a_(R),ie=c_(R);ae.push(...le),Z.push(...ie)}for(const le of Z)O.push(`${le}:${te}`)}const se=await this.client.core.crypto.generateSharedKey(j,F.publicKey);let ee;ae.length>0&&(ee={topic:se,acknowledged:!0,self:{publicKey:j,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:En(Iu),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:B,namespaces:__([...new Set(ae)],[...new Set(O)]),transportType:o},await this.client.core.relayer.subscribe(se,{transportType:o}),await this.client.session.set(se,ee),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:F.metadata}),ee=this.client.session.get(se)),(S=this.client.metadata.redirect)!=null&&S.linkMode&&(b=F.metadata.redirect)!=null&&b.linkMode&&(M=F.metadata.redirect)!=null&&M.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(se,{transportType:Wr.link_mode})),G({auths:I,session:ee})},g=ha(),v=ha();this.events.once(vr("session_connect"),m),this.events.once(vr("session_request",g),f);let x;try{if(s){const _=da("wc_sessionAuthenticate",T,g);this.client.core.history.set(B,_);const S=await this.client.core.crypto.encode("",_,{type:yl,encoding:vl});x=Wd(n,B,S)}else await Promise.all([this.sendRequest({topic:B,method:"wc_sessionAuthenticate",params:T,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:g}),this.sendRequest({topic:B,method:"wc_sessionPropose",params:ue,expiry:Bn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:v})])}catch(_){throw this.events.off(vr("session_connect"),m),this.events.off(vr("session_request",g),f),_}return await this.setProposal(v,tn({id:v},ue)),await this.setAuthRequest(g,{request:ws(tn({},T),{verifyContext:{}}),pairingTopic:B,transportType:o}),{uri:x??q,response:_e}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[cc.authenticated_session_approve_started]}});try{this.isInitialized()}catch(D){throw s.setError(Cl.no_internet_connection),D}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Cl.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||Wr.relay;a===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=Hd(u),p={type:So,receiverPublicKey:u,senderPublicKey:l},y=[],A=[];for(const D of i){if(!await i_({cacao:D,projectId:this.client.core.projectId})){s.setError(Cl.invalid_cacao);const H=Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:H,encodeOpts:p}),new Error(H.message)}s.addTrace(cc.cacaos_verified);const{p:k}=D,B=zd(k.resources),q=[o1(k.iss)],j=qd(k.iss);if(B){const H=a_(B),J=c_(B);y.push(...H),q.push(...J)}for(const H of q)A.push(`${H}:${j}`)}const P=await this.client.core.crypto.generateSharedKey(l,u);s.addTrace(cc.create_authenticated_session_topic);let N;if((y==null?void 0:y.length)>0){N={topic:P,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:u,metadata:o.requester.metadata},controller:u,expiry:En(Iu),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:__([...new Set(y)],[...new Set(A)]),transportType:a},s.addTrace(cc.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(P,{transportType:a})}catch(D){throw s.setError(Cl.subscribe_authenticated_session_topic_failure),D}s.addTrace(cc.subscribe_authenticated_session_topic_success),await this.client.session.set(P,N),s.addTrace(cc.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(cc.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:p,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(D){throw s.setError(Cl.authenticated_session_approve_publish_failure),D}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:N}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),u=Hd(o),l={type:So,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:u,error:i,encodeOpts:l,rpcOpts:Bn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return s_(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:u}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Dr("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(C6).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,Dr("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Gs.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(ac.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Dr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Gs.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,En(Bn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=Wr.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||En(Bn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l,appLink:d}=r,p=da(i,s,u);let y;const A=!!d;try{const D=A?vl:la;y=await this.client.core.crypto.encode(n,p,{encoding:D})}catch(D){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),D}let P;if(aq.includes(i)){const D=Ao(JSON.stringify(p)),k=Ao(y);P=await this.client.core.verify.register({id:k,decryptedId:D})}const N=Bn[i].req;if(N.attestation=P,o&&(N.ttl=o),a&&(N.id=a),this.client.core.history.set(n,p),A){const D=Wd(d,n,y);await global.Linking.openURL(D,this.client.name)}else{const D=Bn[i].req;o&&(D.ttl=o),a&&(D.id=a),l?(D.internal=ws(tn({},D.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,y,D)):this.client.core.relayer.publish(n,y,D).catch(k=>this.client.logger.error(k))}return p.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:u}=r,l=Vd(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=p?vl:la;d=await this.client.core.crypto.encode(i,l,ws(tn({},a||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),A}if(p){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=Bn[y.request.method].res;o?(A.internal=ws(tn({},A.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,A)):this.client.core.relayer.publish(i,d,A).catch(P=>this.client.logger.error(P))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:u}=r,l=Gd(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=p?vl:la;d=await this.client.core.crypto.encode(i,l,ws(tn({},o||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),A}if(p){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=a||Bn[y.request.method].res;this.client.core.relayer.publish(i,d,A)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;fa(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{fa(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Gs.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Gs.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Gs.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,u=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:u}))switch(u){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=ut("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:u}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(tn({},i.params));const d=a.expiryTimestamp||En(Bn.wc_sessionPropose.req.ttl),p=tn({id:u,pairingTopic:n,expiryTimestamp:d},a);await this.setProposal(u,p);const y=await this.getVerifyContext({attestationId:s,hash:Ao(JSON.stringify(i)),encryptedId:o,metadata:p.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(Io.proposal_listener_not_found)),l==null||l.addTrace(Vs.emit_session_proposal),this.client.events.emit("session_proposal",{id:u,params:p,verifyContext:y})}catch(l){await this.sendError({id:u,topic:n,error:l,rpcOpts:Bn.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(Hs(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const u=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const d=await this.client.core.crypto.generateSharedKey(u,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:d});const p=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:p}),await this.client.core.pairing.activate({topic:r})}else if(Yi(n)){await this.client.proposal.delete(s,Dr("USER_DISCONNECTED"));const o=vr("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(vr("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:u,namespaces:l,sessionProperties:d,sessionConfig:p}=n.params,y=ws(tn(tn({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},d&&{sessionProperties:d}),p&&{sessionConfig:p}),{transportType:Wr.relay}),A=vr("session_connect");if(this.events.listenerCount(A)===0)throw new Error(`emitting ${A} without any listeners 997`);this.events.emit(vr("session_connect"),{session:y}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;Hs(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(vr("session_approve",i),{})):Yi(n)&&(await this.client.session.delete(r,Dr("USER_DISCONNECTED")),this.events.emit(vr("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Dr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(tn({topic:r},i));try{Al.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(u){throw Al.delete(o),u}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=vr("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_update",i),{}):Yi(n)&&this.events.emit(vr("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,En(Iu)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=vr("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_extend",i),{}):Yi(n)&&this.events.emit(vr("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=vr("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{Hs(n)?this.events.emit(vr("session_ping",i),{}):Yi(n)&&this.events.emit(vr("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(ii.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Dr("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:u,encryptedId:l,transportType:d}=r,{id:p,params:y}=a;try{await this.isValidRequest(tn({topic:o},y));const A=this.client.session.get(o),P=await this.getVerifyContext({attestationId:u,hash:Ao(JSON.stringify(da("wc_sessionRequest",y,p))),encryptedId:l,metadata:A.peer.metadata,transportType:d}),N={id:p,topic:o,params:y,verifyContext:P};await this.setPendingSessionRequest(N),d===Wr.link_mode&&(n=A.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=A.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(N):(this.addSessionRequestToSessionRequestQueue(N),this.processSessionRequestQueue())}catch(A){await this.sendError({id:p,topic:o,error:A}),this.client.logger.error(A)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=vr("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(tn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Al.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:u}=r;try{const{requester:l,authPayload:d,expiryTimestamp:p}=s.params,y=await this.getVerifyContext({attestationId:o,hash:Ao(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:u}),A={requester:l,pairingTopic:i,id:s.id,authPayload:d,verifyContext:y,expiryTimestamp:p};await this.setAuthRequest(s.id,{request:A,pairingTopic:i,transportType:u}),u===Wr.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:y})}catch(l){this.client.logger.error(l);const d=s.params.requester.publicKey,p=await this.client.core.crypto.generateKeyPair(),y=this.getAppLinkIfEnabled(s.params.requester.metadata,u),A={type:So,receiverPublicKey:d,senderPublicKey:p};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:A,rpcOpts:Bn.wc_sessionAuthenticate.autoReject,appLink:y})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Gs.idle,this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=vr("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(vr("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Gs.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Gs.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:da("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(bi(n)||await this.isValidPairingTopic(n),!B$(a)){const{message:u}=ut("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!bi(i)&&Sl(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!bi(s)&&Sl(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),bi(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=k$(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!yi(r))throw new Error(ut("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),u=h1(i,"approve()");if(u)throw new Error(u.message);const l=M_(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!an(s,!0)){const{message:d}=ut("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}bi(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!yi(r)){const{message:s}=ut("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!F$(i)){const{message:s}=ut("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!yi(r)){const{message:l}=ut("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!A_(n)){const{message:l}=ut("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=T$(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const u=h1(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(fa(o)){const{message:l}=ut("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=h1(i,"update()");if(o)throw new Error(o.message);const a=M_(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!P_(a,s)){const{message:u}=ut("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!j$(i)){const{message:u}=ut("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!z$(a,s,i.method)){const{message:u}=ut("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!V$(o,S1)){const{message:u}=ut("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${S1.min} and ${S1.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!yi(r)){const{message:o}=ut("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!U$(s)){const{message:o}=ut("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!yi(r)){const{message:a}=ut("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!P_(o,s)){const{message:a}=ut("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!q$(i)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!H$(o,s,i.name)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!an(i,!1))throw new Error("uri is required parameter");if(!an(s,!1))throw new Error("domain is required parameter");if(!an(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(u=>Su(u).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Su(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,u={verified:{verifyUrl:o.verifyUrl||Il,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Wr.link_mode){const d=this.getAppLinkIfEnabled(o,a);return u.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",u}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(u.verified.origin=l.origin,u.verified.isScam=l.isScam,u.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(u)}`),u},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!an(i,!1)){const{message:s}=ut("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,u,l,d,p,y;return!r||n!==Wr.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(u=this.client.metadata)==null?void 0:u.redirect)==null?void 0:l.universal)!==""&&((d=r==null?void 0:r.redirect)==null?void 0:d.universal)!==void 0&&((p=r==null?void 0:r.redirect)==null?void 0:p.universal)!==""&&((y=r==null?void 0:r.redirect)==null?void 0:y.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=Q3(r,"topic")||"",i=decodeURIComponent(Q3(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:Wr.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(i1()||Au()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ii.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(Qd)?this.client.auth.authKeys.get(Qd):{publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===Wr.link_mode?vl:la});try{g1(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:Ao(n)})):Yd(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(u){this.client.logger.error(u)}}registerExpirerEvents(){this.client.core.expirer.on(Zi.expired,async e=>{const{topic:r,id:n}=Z3(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ut("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,ut("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(oc.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(oc.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=ut("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=ut("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=ut("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(an(e,!1)){const{message:r}=ut("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=ut("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!$$(e)){const{message:r}=ut("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=ut("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class yq extends uc{constructor(e,r){super(e,r,nq,_1),this.core=e,this.logger=r}}let wq=class extends uc{constructor(e,r){super(e,r,iq,_1),this.core=e,this.logger=r}};class xq extends uc{constructor(e,r){super(e,r,oq,_1,n=>n.id),this.core=e,this.logger=r}}class _q extends uc{constructor(e,r){super(e,r,fq,Zd,()=>Qd),this.core=e,this.logger=r}}class Eq extends uc{constructor(e,r){super(e,r,lq,Zd),this.core=e,this.logger=r}}class Sq extends uc{constructor(e,r){super(e,r,hq,Zd,n=>n.id),this.core=e,this.logger=r}}class Aq{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new _q(this.core,this.logger),this.pairingTopics=new Eq(this.core,this.logger),this.requests=new Sq(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class A1 extends ZR{constructor(e){super(e),this.protocol=P6,this.version=M6,this.name=E1.name,this.events=new qi.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||E1.name,this.metadata=(e==null?void 0:e.metadata)||V3(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||E1.logger}));this.core=(e==null?void 0:e.core)||new rq(e),this.logger=ri(r,this.name),this.session=new wq(this.core,this.logger),this.proposal=new yq(this.core,this.logger),this.pendingRequest=new xq(this.core,this.logger),this.engine=new bq(this),this.auth=new Aq(this.core,this.logger)}static async init(e){const r=new A1(e);return await r.initialize(),r}get context(){return gi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var e0={exports:{}};/** + Approved: ${y.toString()}`))}),o.forEach(p=>{n||(ec(i[p].methods,s[p].methods)?ec(i[p].events,s[p].events)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${p}`)):n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${p}`))}),n}function W$(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function M_(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function K$(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Mu(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function V$(t,e){return l1(t)&&t<=e.max&&t>=e.min}function I_(){const t=gl();return new Promise(e=>{switch(t){case Ri.browser:e(G$());break;case Ri.reactNative:e(Y$());break;case Ri.node:e(J$());break;default:e(!0)}})}function G$(){return pl()&&(navigator==null?void 0:navigator.onLine)}async function Y$(){if(Au()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function J$(){return!0}function X$(t){switch(gl()){case Ri.browser:Z$(t);break;case Ri.reactNative:Q$(t);break}}function Z$(t){!Au()&&pl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function Q$(t){Au()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const d1={};class Al{static get(e){return d1[e]}static set(e,r){d1[e]=r}static delete(e){delete d1[e]}}const eF="PARSE_ERROR",tF="INVALID_REQUEST",rF="METHOD_NOT_FOUND",nF="INVALID_PARAMS",C_="INTERNAL_ERROR",p1="SERVER_ERROR",iF=[-32700,-32600,-32601,-32602,-32603],Pl={[eF]:{code:-32700,message:"Parse error"},[tF]:{code:-32600,message:"Invalid Request"},[rF]:{code:-32601,message:"Method not found"},[nF]:{code:-32602,message:"Invalid params"},[C_]:{code:-32603,message:"Internal error"},[p1]:{code:-32e3,message:"Server error"}},T_=p1;function sF(t){return iF.includes(t)}function R_(t){return Object.keys(Pl).includes(t)?Pl[t]:Pl[T_]}function oF(t){const e=Object.values(Pl).find(r=>r.code===t);return e||Pl[T_]}function D_(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var O_={},Po={},N_;function aF(){if(N_)return Po;N_=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.isBrowserCryptoAvailable=Po.getSubtleCrypto=Po.getBrowerCrypto=void 0;function t(){return(nn==null?void 0:nn.crypto)||(nn==null?void 0:nn.msCrypto)||{}}Po.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Po.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Po.isBrowserCryptoAvailable=r,Po}var Mo={},L_;function cF(){if(L_)return Mo;L_=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.isBrowser=Mo.isNode=Mo.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Mo.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Mo.isNode=e;function r(){return!t()&&!e()}return Mo.isBrowser=r,Mo}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vf;e.__exportStar(aF(),t),e.__exportStar(cF(),t)})(O_);function ha(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function sc(t=6){return BigInt(ha(t))}function da(t,e,r){return{id:r||ha(),jsonrpc:"2.0",method:t,params:e}}function Vd(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Gd(t,e,r){return{id:t,jsonrpc:"2.0",error:uF(e)}}function uF(t,e){return typeof t>"u"?R_(C_):(typeof t=="string"&&(t=Object.assign(Object.assign({},R_(p1)),{message:t})),sF(t.code)&&(t=oF(t.code)),t)}let fF=class{},lF=class extends fF{constructor(){super()}},hF=class extends lF{constructor(e){super()}};const dF="^https?:",pF="^wss?:";function gF(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function k_(t,e){const r=gF(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function B_(t){return k_(t,dF)}function $_(t){return k_(t,pF)}function mF(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function F_(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function g1(t){return F_(t)&&"method"in t}function Yd(t){return F_(t)&&(Hs(t)||Yi(t))}function Hs(t){return"result"in t}function Yi(t){return"error"in t}let Ji=class extends hF{constructor(e){super(e),this.events=new qi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(da(e.method,e.params||[],e.id||sc().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Yi(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Yd(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const vF=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),bF=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",j_=t=>t.split("?")[0],U_=10,yF=vF();let wF=class{constructor(e){if(this.url=e,this.events=new qi.EventEmitter,this.registering=!1,!$_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(mo(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!$_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=O_.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!mF(e)},o=new yF(e,[],s);bF()?o.onerror=a=>{const u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ka(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return D_(e,j_(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>U_&&this.events.setMaxListeners(U_)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${j_(this.url)}`));return this.events.emit("register_error",r),r}};var Jd={exports:{}};Jd.exports,function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",u="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",p="[object Date]",y="[object Error]",A="[object Function]",P="[object GeneratorFunction]",O="[object Map]",D="[object Number]",k="[object Null]",B="[object Object]",q="[object Promise]",j="[object Proxy]",H="[object RegExp]",J="[object Set]",T="[object String]",z="[object Symbol]",ue="[object Undefined]",_e="[object WeakMap]",G="[object ArrayBuffer]",E="[object DataView]",m="[object Float32Array]",f="[object Float64Array]",g="[object Int8Array]",v="[object Int16Array]",x="[object Int32Array]",_="[object Uint8Array]",S="[object Uint8ClampedArray]",b="[object Uint16Array]",M="[object Uint32Array]",I=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,ce=/^(?:0|[1-9]\d*)$/,N={};N[m]=N[f]=N[g]=N[v]=N[x]=N[_]=N[S]=N[b]=N[M]=!0,N[a]=N[u]=N[G]=N[d]=N[E]=N[p]=N[y]=N[A]=N[O]=N[D]=N[B]=N[H]=N[J]=N[T]=N[_e]=!1;var se=typeof nn=="object"&&nn&&nn.Object===Object&&nn,ee=typeof self=="object"&&self&&self.Object===Object&&self,X=se||ee||Function("return this")(),Q=e&&!e.nodeType&&e,R=Q&&!0&&t&&!t.nodeType&&t,Z=R&&R.exports===Q,te=Z&&se.process,le=function(){try{return te&&te.binding&&te.binding("util")}catch{}}(),ie=le&&le.isTypedArray;function fe(ae,ye){for(var Ye=-1,It=ae==null?0:ae.length,jr=0,ir=[];++Ye-1}function st(ae,ye){var Ye=this.__data__,It=Xe(Ye,ae);return It<0?(++this.size,Ye.push([ae,ye])):Ye[It][1]=ye,this}Re.prototype.clear=De,Re.prototype.delete=it,Re.prototype.get=Ue,Re.prototype.has=gt,Re.prototype.set=st;function tt(ae){var ye=-1,Ye=ae==null?0:ae.length;for(this.clear();++yewn))return!1;var Ur=ir.get(ae);if(Ur&&ir.get(ye))return Ur==ye;var gn=-1,_i=!0,xn=Ye&s?new _t:void 0;for(ir.set(ae,ye),ir.set(ye,ae);++gn-1&&ae%1==0&&ae-1&&ae%1==0&&ae<=o}function up(ae){var ye=typeof ae;return ae!=null&&(ye=="object"||ye=="function")}function Pc(ae){return ae!=null&&typeof ae=="object"}var fp=ie?Te(ie):dr;function qb(ae){return jb(ae)?qe(ae):pr(ae)}function Fr(){return[]}function kr(){return!1}t.exports=Ub}(Jd,Jd.exports);var xF=Jd.exports;const _F=ji(xF),q_="wc",z_=2,H_="core",Ws=`${q_}@2:${H_}:`,EF={logger:"error"},SF={database:":memory:"},AF="crypto",W_="client_ed25519_seed",PF=mt.ONE_DAY,MF="keychain",IF="0.3",CF="messages",TF="0.3",RF=mt.SIX_HOURS,DF="publisher",K_="irn",OF="error",V_="wss://relay.walletconnect.org",NF="relayer",ii={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},LF="_subscription",Xi={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},kF=.1,m1="2.17.2",Wr={link_mode:"link_mode",relay:"relay"},BF="0.3",$F="WALLETCONNECT_CLIENT_ID",G_="WALLETCONNECT_LINK_MODE_APPS",Ks={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},FF="subscription",jF="0.3",UF=mt.FIVE_SECONDS*1e3,qF="pairing",zF="0.3",Ml={wc_pairingDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:mt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:0},res:{ttl:mt.ONE_DAY,prompt:!1,tag:0}}},oc={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},bs={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},HF="history",WF="0.3",KF="expirer",Zi={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},VF="0.3",GF="verify-api",YF="https://verify.walletconnect.com",Y_="https://verify.walletconnect.org",Il=Y_,JF=`${Il}/v3`,XF=[YF,Y_],ZF="echo",QF="https://echo.walletconnect.com",Vs={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},Io={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},ys={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},ac={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},cc={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Cl={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},ej=.1,tj="event-client",rj=86400,nj="https://pulse.walletconnect.org/batch";function ij(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,j=new Uint8Array(q);k!==B;){for(var H=P[k],J=0,T=q-1;(H!==0||J>>0,j[T]=H%a>>>0,H=H/a>>>0;if(H!==0)throw new Error("Non-zero carry");D=J,k++}for(var z=q-D;z!==q&&j[z]===0;)z++;for(var ue=u.repeat(O);z>>0,q=new Uint8Array(B);P[O];){var j=r[P.charCodeAt(O)];if(j===255)return;for(var H=0,J=B-1;(j!==0||H>>0,q[J]=j%256>>>0,j=j/256>>>0;if(j!==0)throw new Error("Non-zero carry");k=H,O++}if(P[O]!==" "){for(var T=B-k;T!==B&&q[T]===0;)T++;for(var z=new Uint8Array(D+(B-T)),ue=D;T!==B;)z[ue++]=q[T++];return z}}}function A(P){var O=y(P);if(O)return O;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:A}}var sj=ij,oj=sj;const J_=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},aj=t=>new TextEncoder().encode(t),cj=t=>new TextDecoder().decode(t);class uj{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class fj{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return X_(this,e)}}class lj{constructor(e){this.decoders=e}or(e){return X_(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const X_=(t,e)=>new lj({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class hj{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new uj(e,r,n),this.decoder=new fj(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Xd=({name:t,prefix:e,encode:r,decode:n})=>new hj(t,e,r,n),Tl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=oj(r,e);return Xd({prefix:t,name:e,encode:n,decode:s=>J_(i(s))})},dj=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},pj=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Xd({prefix:e,name:t,encode(i){return pj(i,n,r)},decode(i){return dj(i,n,r,t)}}),gj=Xd({prefix:"\0",name:"identity",encode:t=>cj(t),decode:t=>aj(t)});var mj=Object.freeze({__proto__:null,identity:gj});const vj=zn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var bj=Object.freeze({__proto__:null,base2:vj});const yj=zn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var wj=Object.freeze({__proto__:null,base8:yj});const xj=Tl({prefix:"9",name:"base10",alphabet:"0123456789"});var _j=Object.freeze({__proto__:null,base10:xj});const Ej=zn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Sj=zn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Aj=Object.freeze({__proto__:null,base16:Ej,base16upper:Sj});const Pj=zn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Mj=zn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ij=zn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Cj=zn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Tj=zn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Rj=zn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Dj=zn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Oj=zn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Nj=zn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Lj=Object.freeze({__proto__:null,base32:Pj,base32upper:Mj,base32pad:Ij,base32padupper:Cj,base32hex:Tj,base32hexupper:Rj,base32hexpad:Dj,base32hexpadupper:Oj,base32z:Nj});const kj=Tl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Bj=Tl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var $j=Object.freeze({__proto__:null,base36:kj,base36upper:Bj});const Fj=Tl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),jj=Tl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Uj=Object.freeze({__proto__:null,base58btc:Fj,base58flickr:jj});const qj=zn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zj=zn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Hj=zn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Wj=zn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Kj=Object.freeze({__proto__:null,base64:qj,base64pad:zj,base64url:Hj,base64urlpad:Wj});const Z_=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Vj=Z_.reduce((t,e,r)=>(t[r]=e,t),[]),Gj=Z_.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Yj(t){return t.reduce((e,r)=>(e+=Vj[r],e),"")}function Jj(t){const e=[];for(const r of t){const n=Gj[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const Xj=Xd({prefix:"🚀",name:"base256emoji",encode:Yj,decode:Jj});var Zj=Object.freeze({__proto__:null,base256emoji:Xj}),Qj=e6,Q_=128,eU=127,tU=~eU,rU=Math.pow(2,31);function e6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=rU;)e[r++]=t&255|Q_,t/=128;for(;t&tU;)e[r++]=t&255|Q_,t>>>=7;return e[r]=t|0,e6.bytes=r-n+1,e}var nU=v1,iU=128,t6=127;function v1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw v1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&t6)<=iU);return v1.bytes=s-n,r}var sU=Math.pow(2,7),oU=Math.pow(2,14),aU=Math.pow(2,21),cU=Math.pow(2,28),uU=Math.pow(2,35),fU=Math.pow(2,42),lU=Math.pow(2,49),hU=Math.pow(2,56),dU=Math.pow(2,63),pU=function(t){return t(r6.encode(t,e,r),e),i6=t=>r6.encodingLength(t),b1=(t,e)=>{const r=e.byteLength,n=i6(t),i=n+i6(r),s=new Uint8Array(i+r);return n6(t,s,0),n6(r,s,n),s.set(e,i),new mU(t,r,e,s)};class mU{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const s6=({name:t,code:e,encode:r})=>new vU(t,e,r);class vU{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?b1(this.code,r):r.then(n=>b1(this.code,n))}else throw Error("Unknown type, must be binary type")}}const o6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),bU=s6({name:"sha2-256",code:18,encode:o6("SHA-256")}),yU=s6({name:"sha2-512",code:19,encode:o6("SHA-512")});var wU=Object.freeze({__proto__:null,sha256:bU,sha512:yU});const a6=0,xU="identity",c6=J_;var _U=Object.freeze({__proto__:null,identity:{code:a6,name:xU,encode:c6,digest:t=>b1(a6,c6(t))}});new TextEncoder,new TextDecoder;const u6={...mj,...bj,...wj,..._j,...Aj,...Lj,...$j,...Uj,...Kj,...Zj};({...wU,..._U});function EU(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function f6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const l6=f6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),y1=f6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=EU(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=ut("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,G3(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Y3(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}},MU=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=AF,this.randomSessionIdentifier=c1(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=xx(i);return wx(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=ZB();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=xx(s),a=this.randomSessionIdentifier;return await LO(a,i,PF,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),u=QB(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||Hd(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=d_(o),u=mo(s);if(g_(a))return t$(u,o==null?void 0:o.encoding);if(p_(a)){const y=a.senderPublicKey,A=a.receiverPublicKey;i=await this.generateSharedKey(y,A)}const l=this.getSymKey(i),{type:d,senderPublicKey:p}=a;return e$({type:d,symKey:l,message:u,senderPublicKey:p,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=i$(s,o);if(g_(a)){const u=n$(s,o==null?void 0:o.encoding);return Ka(u)}if(p_(a)){const u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{const u=this.getSymKey(i),l=r$({symKey:u,encoded:s,encoding:o==null?void 0:o.encoding});return Ka(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=(i,s=la)=>{const o=xl({encoded:i,encoding:s});return nc(o.type)},this.getPayloadSenderPublicKey=(i,s=la)=>{const o=xl({encoded:i,encoding:s});return o.senderPublicKey?Rn(o.senderPublicKey,ni):void 0},this.core=e,this.logger=ri(r,this.name),this.keychain=n||new PU(this.core,this.logger)}get context(){return gi(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(W_)}catch{e=c1(),await this.keychain.set(W_,e)}return AU(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}};class IU extends zR{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=CF,this.version=TF,this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Ao(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Ao(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=ri(e,this.name),this.core=r}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,G3(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Y3(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class CU extends HR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new qi.EventEmitter,this.name=DF,this.queue=new Map,this.publishTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.failedPublishTimeout=mt.toMiliseconds(mt.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||RF,u=u1(s),l=(s==null?void 0:s.prompt)||!1,d=(s==null?void 0:s.tag)||0,p=(s==null?void 0:s.id)||sc().toString(),y={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:d,id:p,attestation:s==null?void 0:s.attestation}},A=`Failed to publish payload, please try again. id:${p} tag:${d}`,P=Date.now();let O,D=1;try{for(;O===void 0;){if(Date.now()-P>this.publishTimeout)throw new Error(A);this.logger.trace({id:p,attempts:D},`publisher.publish - attempt ${D}`),O=await await Pu(this.rpcPublish(n,i,a,u,l,d,p,s==null?void 0:s.attestation).catch(k=>this.logger.warn(k)),this.publishTimeout,A),D++,O||await new Promise(k=>setTimeout(k,this.failedPublishTimeout))}this.relayer.events.emit(ii.publish,y),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:p,topic:n,message:i,opts:s}})}catch(k){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(k),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw k;this.queue.set(p,y)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=ri(r,this.name),this.registerEventListeners()}get context(){return gi(this.logger)}rpcPublish(e,r,n,i,s,o,a,u){var l,d,p,y;const A={method:_l(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:u},id:a};return bi((l=A.params)==null?void 0:l.prompt)&&((d=A.params)==null||delete d.prompt),bi((p=A.params)==null?void 0:p.tag)&&((y=A.params)==null||delete y.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:A}),this.relayer.request(A)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(su.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ii.connection_stalled);return}this.checkQueue()}),this.relayer.on(ii.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class TU{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var RU=Object.defineProperty,DU=Object.defineProperties,OU=Object.getOwnPropertyDescriptors,h6=Object.getOwnPropertySymbols,NU=Object.prototype.hasOwnProperty,LU=Object.prototype.propertyIsEnumerable,d6=(t,e,r)=>e in t?RU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rl=(t,e)=>{for(var r in e||(e={}))NU.call(e,r)&&d6(t,r,e[r]);if(h6)for(var r of h6(e))LU.call(e,r)&&d6(t,r,e[r]);return t},w1=(t,e)=>DU(t,OU(e));class kU extends VR{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new TU,this.events=new qi.EventEmitter,this.name=FF,this.version=jF,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Ws,this.subscribeTimeout=mt.toMiliseconds(mt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=u1(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new mt.Watch;a.start(i);const u=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(u),a.stop(i),s(!0)),a.elapsed(i)>=UF&&(clearInterval(u),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ri(r,this.name),this.clientId=""}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=u1(n);await this.rpcUnsubscribe(e,r,i);const s=Dr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===Wr.relay&&await this.restartToComplete();const s={method:_l(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=Ao(e+this.clientId);if((n==null?void 0:n.transportType)===Wr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},mt.toMiliseconds(mt.ONE_SECOND)),a;const u=await Pu(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return u?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ii.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Pu(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:_l(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Pu(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(ii.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:_l(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,w1(Rl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Rl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Rl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Ks.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Ks.deleted,w1(Rl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Ks.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);ic(r)&&this.onBatchSubscribe(r.map((n,i)=>w1(Rl({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(su.pulse,async()=>{await this.checkPending()}),this.events.on(Ks.created,async e=>{const r=Ks.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Ks.deleted,async e=>{const r=Ks.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var BU=Object.defineProperty,p6=Object.getOwnPropertySymbols,$U=Object.prototype.hasOwnProperty,FU=Object.prototype.propertyIsEnumerable,g6=(t,e,r)=>e in t?BU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,m6=(t,e)=>{for(var r in e||(e={}))$U.call(e,r)&&g6(t,r,e[r]);if(p6)for(var r of p6(e))FU.call(e,r)&&g6(t,r,e[r]);return t};class jU extends WR{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new qi.EventEmitter,this.name=NF,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=mt.toMiliseconds(mt.THIRTY_SECONDS+mt.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||sc().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(u,l)=>{const d=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Xi.disconnect,d);const p=await o;this.provider.off(Xi.disconnect,d),u(p)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(jd())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(ii.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ii.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Xi.payload,this.onPayloadHandler),this.provider.on(Xi.connect,this.onConnectHandler),this.provider.on(Xi.disconnect,this.onDisconnectHandler),this.provider.on(Xi.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ri(e.logger,this.name):Qf(od({level:e.logger||OF})),this.messages=new IU(this.logger,e.core),this.subscriber=new kU(this,this.logger),this.publisher=new CU(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||V_,this.projectId=e.projectId,this.bundleId=mB(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return gi(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Wr.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",u;const l=d=>{d.topic===e&&(this.subscriber.off(Ks.created,l),u())};return await Promise.all([new Promise(d=>{u=d,this.subscriber.on(Ks.created,l)}),new Promise(async(d,p)=>{a=await this.subscriber.subscribe(e,m6({internal:{throwOnFailedPublish:o}},r)).catch(y=>{o&&p(y)})||a,d()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Pu(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Xi.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Xi.disconnect,i),await Pu(this.provider.connect(),mt.toMiliseconds(mt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await I_())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=En(mt.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(ii.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(jd())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Ji(new wF(wB({sdkVersion:m1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),g1(e)){if(!e.method.endsWith(LF))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:Wr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(m6({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else Yd(e)&&this.events.emit(ii.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ii.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Vd(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Xi.payload,this.onPayloadHandler),this.provider.off(Xi.connect,this.onConnectHandler),this.provider.off(Xi.disconnect,this.onDisconnectHandler),this.provider.off(Xi.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await I_();X$(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(ii.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},mt.toMiliseconds(kF))))}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var UU=Object.defineProperty,v6=Object.getOwnPropertySymbols,qU=Object.prototype.hasOwnProperty,zU=Object.prototype.propertyIsEnumerable,b6=(t,e,r)=>e in t?UU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,y6=(t,e)=>{for(var r in e||(e={}))qU.call(e,r)&&b6(t,r,e[r]);if(v6)for(var r of v6(e))zU.call(e,r)&&b6(t,r,e[r]);return t};class uc extends KR{constructor(e,r,n,i=Ws,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=BF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!bi(o)?this.map.set(this.getKey(o),o):I$(o)?this.map.set(o.id,o):C$(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>_F(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const u=y6(y6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=ri(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class HU{constructor(e,r){this.core=e,this.logger=r,this.name=qF,this.version=zF,this.events=new Yg,this.initialized=!1,this.storagePrefix=Ws,this.ignoredPayloadTypes=[So],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=c1(),s=await this.core.crypto.setSymKey(i),o=En(mt.FIVE_MINUTES),a={protocol:K_},u={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=w_({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(oc.create,u),this.core.expirer.set(s,o),await this.pairings.set(s,u),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Vs.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:u,methods:l}=y_(n.uri);i.props.properties.topic=s,i.addTrace(Vs.pairing_uri_validation_success),i.addTrace(Vs.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(Vs.existing_pairing),d.active)throw i.setError(Io.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Vs.pairing_not_expired)}const p=u||En(mt.FIVE_MINUTES),y={topic:s,relay:a,expiry:p,active:!1,methods:l};this.core.expirer.set(s,p),await this.pairings.set(s,y),i.addTrace(Vs.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(oc.create,y),i.addTrace(Vs.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Vs.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Io.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(A){throw i.setError(Io.subscribe_pairing_topic_failure),A}return i.addTrace(Vs.subscribe_pairing_topic_success),y},this.activate=async({topic:n})=>{this.isInitialized();const i=En(mt.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=tc();this.events.once(vr("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Dr("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,u=this.core.crypto.keychain.get(i);return w_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:u,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=da(i,s),a=await this.core.crypto.encode(n,o),u=Ml[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{const o=Vd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=Gd(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ml[u.request.method]?Ml[u.request.method].res:Ml.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Dr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>fa(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(oc.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{Hs(i)?this.events.emit(vr("pairing_ping",s),{}):Yi(i)&&this.events.emit(vr("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(oc.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Dr("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Dr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!yi(n)){const{message:a}=ut("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!M$(n.uri)){const{message:a}=ut("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}const o=y_(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&mt.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!yi(n)){const{message:s}=ut("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!an(n,!1)){const{message:i}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(fa(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ut("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=ri(r,this.name),this.pairings=new uc(this.core,this.logger,this.name,this.storagePrefix)}get context(){return gi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ii.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===Wr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{g1(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):Yd(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Zi.expired,async e=>{const{topic:r}=X3(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(oc.expire,{topic:r}))})}}class WU extends qR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new qi.EventEmitter,this.name=HF,this.version=WF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:En(mt.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(bs.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Yi(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(bs.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(bs.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:da(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(bs.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(bs.created,e=>{const r=bs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.updated,e=>{const r=bs.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(bs.deleted,e=>{const r=bs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(su.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{mt.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(bs.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class KU extends GR{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new qi.EventEmitter,this.name=KF,this.version=VF,this.cached=[],this.initialized=!1,this.storagePrefix=Ws,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Zi.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Zi.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ri(r,this.name)}get context(){return gi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return xB(e);if(typeof e=="number")return _B(e);const{message:r}=ut("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Zi.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;mt.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Zi.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(su.pulse,()=>this.checkExpirations()),this.events.on(Zi.created,e=>{const r=Zi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.expired,e=>{const r=Zi.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Zi.deleted,e=>{const r=Zi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class VU extends YR{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=GF,this.verifyUrlV3=JF,this.storagePrefix=Ws,this.version=z_,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&mt.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!pl()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,u=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=nl(),d=this.startAbortTimer(mt.ONE_SECOND*5),p=await new Promise((y,A)=>{const P=()=>{window.removeEventListener("message",D),l.body.removeChild(O),A("attestation aborted")};this.abortController.signal.addEventListener("abort",P);const O=l.createElement("iframe");O.src=u,O.style.display="none",O.addEventListener("error",P,{signal:this.abortController.signal});const D=k=>{if(k.data&&typeof k.data=="string")try{const B=JSON.parse(k.data);if(B.type==="verify_attestation"){if(gm(B.attestation).payload.id!==o)return;clearInterval(d),l.body.removeChild(O),this.abortController.signal.removeEventListener("abort",P),window.removeEventListener("message",D),y(B.attestation===null?"":B.attestation)}}catch(B){this.logger.warn(B)}};l.body.appendChild(O),window.addEventListener("message",D,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",p),p}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(gm(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const u=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,u)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(mt.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Il;return XF.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Il}`),s=Il),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(mt.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=c$(i,s.publicKey),a={hasExpired:mt.toMiliseconds(o.exp)this.abortController.abort(),mt.toMiliseconds(e))}}class GU extends JR{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=ZF,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${QF}/${this.projectId}/clients`;await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=ri(r,this.context)}}var YU=Object.defineProperty,w6=Object.getOwnPropertySymbols,JU=Object.prototype.hasOwnProperty,XU=Object.prototype.propertyIsEnumerable,x6=(t,e,r)=>e in t?YU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dl=(t,e)=>{for(var r in e||(e={}))JU.call(e,r)&&x6(t,r,e[r]);if(w6)for(var r of w6(e))XU.call(e,r)&&x6(t,r,e[r]);return t};class ZU extends XR{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=tj,this.storagePrefix=Ws,this.storageVersion=ej,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!i1())try{const i={eventId:Q3(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:V3(this.core.relayer.protocol,this.core.relayer.version,m1)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:u}}=i,l=Q3(),d=this.core.projectId||"",p=Date.now(),y=Dl({eventId:l,timestamp:p,props:{event:s,type:o,properties:{topic:a,trace:u}},bundleId:d,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,y),this.shouldPersist=!0),y},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(u=>u.props.properties.topic===o);if(a)return Dl(Dl({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(su.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{mt.fromMiliseconds(Date.now())-mt.fromMiliseconds(i.timestamp)>rj&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Dl(Dl({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${nj}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${m1}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>K3().url,this.logger=ri(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var QU=Object.defineProperty,_6=Object.getOwnPropertySymbols,eq=Object.prototype.hasOwnProperty,tq=Object.prototype.propertyIsEnumerable,E6=(t,e,r)=>e in t?QU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,S6=(t,e)=>{for(var r in e||(e={}))eq.call(e,r)&&E6(t,r,e[r]);if(_6)for(var r of _6(e))tq.call(e,r)&&E6(t,r,e[r]);return t};class x1 extends UR{constructor(e){var r;super(e),this.protocol=q_,this.version=z_,this.name=H_,this.events=new qi.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:u})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:Wr.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||V_,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=od({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:EF.logger}),{logger:i,chunkLoggerController:s}=jR({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ri(i,this.name),this.heartbeat=new NT,this.crypto=new MU(this,this.logger,e==null?void 0:e.keychain),this.history=new WU(this,this.logger),this.expirer=new KU(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new hR(S6(S6({},SF),e==null?void 0:e.storageOptions)),this.relayer=new jU({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new HU(this,this.logger),this.verify=new VU(this,this.logger,this.storage),this.echoClient=new GU(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new ZU(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new x1(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem($F,n),r}get context(){return gi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(G_,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(G_)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const rq=x1,A6="wc",P6=2,M6="client",_1=`${A6}@${P6}:${M6}:`,E1={name:M6,logger:"error"},I6="WALLETCONNECT_DEEPLINK_CHOICE",nq="proposal",C6="Proposal expired",iq="session",Iu=mt.SEVEN_DAYS,sq="engine",Bn={wc_sessionPropose:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:mt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:mt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:mt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:mt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:mt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:mt.FIVE_MINUTES,prompt:!1,tag:1119}}},S1={min:mt.FIVE_MINUTES,max:mt.SEVEN_DAYS},Gs={idle:"IDLE",active:"ACTIVE"},oq="request",aq=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],cq="wc",uq="auth",fq="authKeys",lq="pairingTopics",hq="requests",Zd=`${cq}@${1.5}:${uq}:`,Qd=`${Zd}:PUB_KEY`;var dq=Object.defineProperty,pq=Object.defineProperties,gq=Object.getOwnPropertyDescriptors,T6=Object.getOwnPropertySymbols,mq=Object.prototype.hasOwnProperty,vq=Object.prototype.propertyIsEnumerable,R6=(t,e,r)=>e in t?dq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))mq.call(e,r)&&R6(t,r,e[r]);if(T6)for(var r of T6(e))vq.call(e,r)&&R6(t,r,e[r]);return t},ws=(t,e)=>pq(t,gq(e));class bq extends QR{constructor(e){super(e),this.name=sq,this.events=new Yg,this.initialized=!1,this.requestQueue={state:Gs.idle,queue:[]},this.sessionRequestQueue={state:Gs.idle,queue:[]},this.requestQueueDelay=mt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Bn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=ws(tn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n;let l=i,d,p=!1;try{l&&(p=this.client.core.pairing.pairings.get(l).active)}catch(j){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),j}if(!l||!p){const{topic:j,uri:H}=await this.client.core.pairing.create();l=j,d=H}if(!l){const{message:j}=ut("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(j)}const y=await this.client.core.crypto.generateKeyPair(),A=Bn.wc_sessionPropose.req.ttl||mt.FIVE_MINUTES,P=En(A),O=tn({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:K_}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:P,pairingTopic:l},a&&{sessionProperties:a}),{reject:D,resolve:k,done:B}=tc(A,C6);this.events.once(vr("session_connect"),async({error:j,session:H})=>{if(j)D(j);else if(H){H.self.publicKey=y;const J=ws(tn({},H),{pairingTopic:O.pairingTopic,requiredNamespaces:O.requiredNamespaces,optionalNamespaces:O.optionalNamespaces,transportType:Wr.relay});await this.client.session.set(H.topic,J),await this.setExpiry(H.topic,H.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:H.peer.metadata}),this.cleanupDuplicatePairings(J),k(J)}});const q=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:O,throwOnFailedPublish:!0});return await this.setProposal(q,tn({id:q},O)),{uri:d,approval:B}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[ys.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(z){throw o.setError(ac.no_internet_connection),z}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(z){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(ac.proposal_not_found),z}try{await this.isValidApprove(r)}catch(z){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(ac.session_approve_namespace_validation_failure),z}const{id:a,relayProtocol:u,namespaces:l,sessionProperties:d,sessionConfig:p}=r,y=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:A,proposer:P,requiredNamespaces:O,optionalNamespaces:D}=y;let k=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:A});k||(k=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:ys.session_approve_started,properties:{topic:A,trace:[ys.session_approve_started,ys.session_namespaces_validation_success]}}));const B=await this.client.core.crypto.generateKeyPair(),q=P.publicKey,j=await this.client.core.crypto.generateSharedKey(B,q),H=tn(tn({relay:{protocol:u??"irn"},namespaces:l,controller:{publicKey:B,metadata:this.client.metadata},expiry:En(Iu)},d&&{sessionProperties:d}),p&&{sessionConfig:p}),J=Wr.relay;k.addTrace(ys.subscribing_session_topic);try{await this.client.core.relayer.subscribe(j,{transportType:J})}catch(z){throw k.setError(ac.subscribe_session_topic_failure),z}k.addTrace(ys.subscribe_session_topic_success);const T=ws(tn({},H),{topic:j,requiredNamespaces:O,optionalNamespaces:D,pairingTopic:A,acknowledged:!1,self:H.controller,peer:{publicKey:P.publicKey,metadata:P.metadata},controller:B,transportType:Wr.relay});await this.client.session.set(j,T),k.addTrace(ys.store_session);try{k.addTrace(ys.publishing_session_settle),await this.sendRequest({topic:j,method:"wc_sessionSettle",params:H,throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(ac.session_settle_publish_failure),z}),k.addTrace(ys.session_settle_publish_success),k.addTrace(ys.publishing_session_approve),await this.sendResult({id:a,topic:A,result:{relay:{protocol:u??"irn"},responderPublicKey:B},throwOnFailedPublish:!0}).catch(z=>{throw k==null||k.setError(ac.session_approve_publish_failure),z}),k.addTrace(ys.session_approve_publish_success)}catch(z){throw this.client.logger.error(z),this.client.session.delete(j,Dr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(j),z}return this.client.core.eventClient.deleteEvent({eventId:k.eventId}),await this.client.core.pairing.updateMetadata({topic:A,metadata:P.metadata}),await this.client.proposal.delete(a,Dr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:A}),await this.setExpiry(j,En(Iu)),{topic:j,acknowledged:()=>Promise.resolve(this.client.session.get(j))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:Bn.wc_sessionPropose.reject}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(p){throw this.client.logger.error("update() -> isValidUpdate() failed"),p}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=tc(),u=ha(),l=sc().toString(),d=this.client.session.get(n).namespaces;return this.events.once(vr("session_update",u),({error:p})=>{p?a(p):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:u,relayRpcId:l}).catch(p=>{this.client.logger.error(p),this.client.session.update(n,{namespaces:d}),a(p)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(u){throw this.client.logger.error("extend() -> isValidExtend() failed"),u}const{topic:n}=r,i=ha(),{done:s,resolve:o,reject:a}=tc();return this.events.once(vr("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,En(Iu)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(u=>{a(u)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(P){throw this.client.logger.error("request() -> isValidRequest() failed"),P}const{chainId:n,request:i,topic:s,expiry:o=Bn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=ha(),l=sc().toString(),{done:d,resolve:p,reject:y}=tc(o,"Request expired. Please try again.");this.events.once(vr("session_request",u),({error:P,result:O})=>{P?y(P):p(O)});const A=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return A?(await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:A}).catch(P=>y(P)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),await d()):await Promise.all([new Promise(async P=>{await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:ws(tn({},i),{expiryTimestamp:En(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(O=>y(O)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),P()}),new Promise(async P=>{var O;if(!((O=a.sessionConfig)!=null&&O.disableDeepLink)){const D=await AB(this.client.core.storage,I6);await EB({id:u,topic:s,wcDeepLink:D})}P()}),d()]).then(P=>P[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);Hs(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Yi(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=ha(),s=sc().toString(),{done:o,resolve:a,reject:u}=tc();this.events.once(vr("session_ping",i),({error:l})=>{l?u(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=sc().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Dr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ut("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>A$(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?Wr.link_mode:Wr.relay;o===Wr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:u="",uri:l,domain:d,nonce:p,type:y,exp:A,nbf:P,methods:O=[],expiry:D}=r,k=[...r.resources||[]],{topic:B,uri:q}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:B,uri:q}});const j=await this.client.core.crypto.generateKeyPair(),H=Hd(j);if(await Promise.all([this.client.auth.authKeys.set(Qd,{responseTopic:H,publicKey:j}),this.client.auth.pairingTopics.set(H,{topic:H,pairingTopic:B})]),await this.client.core.relayer.subscribe(H,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${B}`),O.length>0){const{namespace:_}=Su(a[0]);let S=KB(_,"request",O);zd(k)&&(S=GB(S,k.pop())),k.push(S)}const J=D&&D>Bn.wc_sessionAuthenticate.req.ttl?D:Bn.wc_sessionAuthenticate.req.ttl,T={authPayload:{type:y??"caip122",chains:a,statement:u,aud:l,domain:d,version:"1",nonce:p,iat:new Date().toISOString(),exp:A,nbf:P,resources:k},requester:{publicKey:j,metadata:this.client.metadata},expiryTimestamp:En(J)},z={eip155:{chains:a,methods:[...new Set(["personal_sign",...O])],events:["chainChanged","accountsChanged"]}},ue={requiredNamespaces:{},optionalNamespaces:z,relays:[{protocol:"irn"}],pairingTopic:B,proposer:{publicKey:j,metadata:this.client.metadata},expiryTimestamp:En(Bn.wc_sessionPropose.req.ttl)},{done:_e,resolve:G,reject:E}=tc(J,"Request expired"),m=async({error:_,session:S})=>{if(this.events.off(vr("session_request",g),f),_)E(_);else if(S){S.self.publicKey=j,await this.client.session.set(S.topic,S),await this.setExpiry(S.topic,S.expiry),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:S.peer.metadata});const b=this.client.session.get(S.topic);await this.deleteProposal(v),G({session:b})}},f=async _=>{var S,b,M;if(await this.deletePendingAuthRequest(g,{message:"fulfilled",code:0}),_.error){const X=Dr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return _.error.code===X.code?void 0:(this.events.off(vr("session_connect"),m),E(_.error.message))}await this.deleteProposal(v),this.events.off(vr("session_connect"),m);const{cacaos:I,responder:F}=_.result,ce=[],N=[];for(const X of I){await n_({cacao:X,projectId:this.client.core.projectId})||(this.client.logger.error(X,"Signature verification failed"),E(Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Q}=X,R=zd(Q.resources),Z=[o1(Q.iss)],te=qd(Q.iss);if(R){const le=o_(R),ie=a_(R);ce.push(...le),Z.push(...ie)}for(const le of Z)N.push(`${le}:${te}`)}const se=await this.client.core.crypto.generateSharedKey(j,F.publicKey);let ee;ce.length>0&&(ee={topic:se,acknowledged:!0,self:{publicKey:j,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:En(Iu),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:B,namespaces:x_([...new Set(ce)],[...new Set(N)]),transportType:o},await this.client.core.relayer.subscribe(se,{transportType:o}),await this.client.session.set(se,ee),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:F.metadata}),ee=this.client.session.get(se)),(S=this.client.metadata.redirect)!=null&&S.linkMode&&(b=F.metadata.redirect)!=null&&b.linkMode&&(M=F.metadata.redirect)!=null&&M.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(se,{transportType:Wr.link_mode})),G({auths:I,session:ee})},g=ha(),v=ha();this.events.once(vr("session_connect"),m),this.events.once(vr("session_request",g),f);let x;try{if(s){const _=da("wc_sessionAuthenticate",T,g);this.client.core.history.set(B,_);const S=await this.client.core.crypto.encode("",_,{type:yl,encoding:vl});x=Wd(n,B,S)}else await Promise.all([this.sendRequest({topic:B,method:"wc_sessionAuthenticate",params:T,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:g}),this.sendRequest({topic:B,method:"wc_sessionPropose",params:ue,expiry:Bn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:v})])}catch(_){throw this.events.off(vr("session_connect"),m),this.events.off(vr("session_request",g),f),_}return await this.setProposal(v,tn({id:v},ue)),await this.setAuthRequest(g,{request:ws(tn({},T),{verifyContext:{}}),pairingTopic:B,transportType:o}),{uri:x??q,response:_e}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[cc.authenticated_session_approve_started]}});try{this.isInitialized()}catch(D){throw s.setError(Cl.no_internet_connection),D}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Cl.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||Wr.relay;a===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=Hd(u),p={type:So,receiverPublicKey:u,senderPublicKey:l},y=[],A=[];for(const D of i){if(!await n_({cacao:D,projectId:this.client.core.projectId})){s.setError(Cl.invalid_cacao);const H=Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:H,encodeOpts:p}),new Error(H.message)}s.addTrace(cc.cacaos_verified);const{p:k}=D,B=zd(k.resources),q=[o1(k.iss)],j=qd(k.iss);if(B){const H=o_(B),J=a_(B);y.push(...H),q.push(...J)}for(const H of q)A.push(`${H}:${j}`)}const P=await this.client.core.crypto.generateSharedKey(l,u);s.addTrace(cc.create_authenticated_session_topic);let O;if((y==null?void 0:y.length)>0){O={topic:P,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:u,metadata:o.requester.metadata},controller:u,expiry:En(Iu),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:x_([...new Set(y)],[...new Set(A)]),transportType:a},s.addTrace(cc.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(P,{transportType:a})}catch(D){throw s.setError(Cl.subscribe_authenticated_session_topic_failure),D}s.addTrace(cc.subscribe_authenticated_session_topic_success),await this.client.session.set(P,O),s.addTrace(cc.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(cc.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:p,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(D){throw s.setError(Cl.authenticated_session_approve_publish_failure),D}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:O}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),u=Hd(o),l={type:So,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:u,error:i,encodeOpts:l,rpcOpts:Bn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return i_(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:u}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Dr("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(I6).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,Dr("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Gs.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(ac.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Dr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Gs.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,En(Bn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=Wr.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||En(Bn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l,appLink:d}=r,p=da(i,s,u);let y;const A=!!d;try{const D=A?vl:la;y=await this.client.core.crypto.encode(n,p,{encoding:D})}catch(D){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),D}let P;if(aq.includes(i)){const D=Ao(JSON.stringify(p)),k=Ao(y);P=await this.client.core.verify.register({id:k,decryptedId:D})}const O=Bn[i].req;if(O.attestation=P,o&&(O.ttl=o),a&&(O.id=a),this.client.core.history.set(n,p),A){const D=Wd(d,n,y);await global.Linking.openURL(D,this.client.name)}else{const D=Bn[i].req;o&&(D.ttl=o),a&&(D.id=a),l?(D.internal=ws(tn({},D.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,y,D)):this.client.core.relayer.publish(n,y,D).catch(k=>this.client.logger.error(k))}return p.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:u}=r,l=Vd(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=p?vl:la;d=await this.client.core.crypto.encode(i,l,ws(tn({},a||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),A}if(p){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=Bn[y.request.method].res;o?(A.internal=ws(tn({},A.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,A)):this.client.core.relayer.publish(i,d,A).catch(P=>this.client.logger.error(P))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:u}=r,l=Gd(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const A=p?vl:la;d=await this.client.core.crypto.encode(i,l,ws(tn({},o||{}),{encoding:A}))}catch(A){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),A}let y;try{y=await this.client.core.history.get(i,n)}catch(A){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),A}if(p){const A=Wd(u,i,d);await global.Linking.openURL(A,this.client.name)}else{const A=a||Bn[y.request.method].res;this.client.core.relayer.publish(i,d,A)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;fa(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{fa(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Gs.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Gs.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Gs.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,u=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:u}))switch(u){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=ut("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:u}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(tn({},i.params));const d=a.expiryTimestamp||En(Bn.wc_sessionPropose.req.ttl),p=tn({id:u,pairingTopic:n,expiryTimestamp:d},a);await this.setProposal(u,p);const y=await this.getVerifyContext({attestationId:s,hash:Ao(JSON.stringify(i)),encryptedId:o,metadata:p.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(Io.proposal_listener_not_found)),l==null||l.addTrace(Vs.emit_session_proposal),this.client.events.emit("session_proposal",{id:u,params:p,verifyContext:y})}catch(l){await this.sendError({id:u,topic:n,error:l,rpcOpts:Bn.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(Hs(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const u=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const d=await this.client.core.crypto.generateSharedKey(u,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:d});const p=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:p}),await this.client.core.pairing.activate({topic:r})}else if(Yi(n)){await this.client.proposal.delete(s,Dr("USER_DISCONNECTED"));const o=vr("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(vr("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:u,namespaces:l,sessionProperties:d,sessionConfig:p}=n.params,y=ws(tn(tn({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},d&&{sessionProperties:d}),p&&{sessionConfig:p}),{transportType:Wr.relay}),A=vr("session_connect");if(this.events.listenerCount(A)===0)throw new Error(`emitting ${A} without any listeners 997`);this.events.emit(vr("session_connect"),{session:y}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;Hs(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(vr("session_approve",i),{})):Yi(n)&&(await this.client.session.delete(r,Dr("USER_DISCONNECTED")),this.events.emit(vr("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Dr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(tn({topic:r},i));try{Al.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(u){throw Al.delete(o),u}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=vr("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_update",i),{}):Yi(n)&&this.events.emit(vr("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,En(Iu)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=vr("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_extend",i),{}):Yi(n)&&this.events.emit(vr("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=vr("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{Hs(n)?this.events.emit(vr("session_ping",i),{}):Yi(n)&&this.events.emit(vr("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(ii.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Dr("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:u,encryptedId:l,transportType:d}=r,{id:p,params:y}=a;try{await this.isValidRequest(tn({topic:o},y));const A=this.client.session.get(o),P=await this.getVerifyContext({attestationId:u,hash:Ao(JSON.stringify(da("wc_sessionRequest",y,p))),encryptedId:l,metadata:A.peer.metadata,transportType:d}),O={id:p,topic:o,params:y,verifyContext:P};await this.setPendingSessionRequest(O),d===Wr.link_mode&&(n=A.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=A.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(O):(this.addSessionRequestToSessionRequestQueue(O),this.processSessionRequestQueue())}catch(A){await this.sendError({id:p,topic:o,error:A}),this.client.logger.error(A)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=vr("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Al.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(tn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Al.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),Hs(n)?this.events.emit(vr("session_request",i),{result:n.result}):Yi(n)&&this.events.emit(vr("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:u}=r;try{const{requester:l,authPayload:d,expiryTimestamp:p}=s.params,y=await this.getVerifyContext({attestationId:o,hash:Ao(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:u}),A={requester:l,pairingTopic:i,id:s.id,authPayload:d,verifyContext:y,expiryTimestamp:p};await this.setAuthRequest(s.id,{request:A,pairingTopic:i,transportType:u}),u===Wr.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:y})}catch(l){this.client.logger.error(l);const d=s.params.requester.publicKey,p=await this.client.core.crypto.generateKeyPair(),y=this.getAppLinkIfEnabled(s.params.requester.metadata,u),A={type:So,receiverPublicKey:d,senderPublicKey:p};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:A,rpcOpts:Bn.wc_sessionAuthenticate.autoReject,appLink:y})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Gs.idle,this.processSessionRequestQueue()},mt.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=vr("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(vr("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Gs.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Gs.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:da("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(bi(n)||await this.isValidPairingTopic(n),!B$(a)){const{message:u}=ut("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!bi(i)&&Sl(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!bi(s)&&Sl(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),bi(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=k$(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!yi(r))throw new Error(ut("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),u=h1(i,"approve()");if(u)throw new Error(u.message);const l=P_(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!an(s,!0)){const{message:d}=ut("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}bi(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!yi(r)){const{message:s}=ut("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!F$(i)){const{message:s}=ut("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!yi(r)){const{message:l}=ut("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!S_(n)){const{message:l}=ut("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=T$(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const u=h1(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(fa(o)){const{message:l}=ut("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=h1(i,"update()");if(o)throw new Error(o.message);const a=P_(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!yi(r)){const{message:u}=ut("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!A_(a,s)){const{message:u}=ut("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!j$(i)){const{message:u}=ut("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!z$(a,s,i.method)){const{message:u}=ut("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!V$(o,S1)){const{message:u}=ut("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${S1.min} and ${S1.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!yi(r)){const{message:o}=ut("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!U$(s)){const{message:o}=ut("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!yi(r)){const{message:a}=ut("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!A_(o,s)){const{message:a}=ut("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!q$(i)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!H$(o,s,i.name)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!yi(r)){const{message:i}=ut("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!an(i,!1))throw new Error("uri is required parameter");if(!an(s,!1))throw new Error("domain is required parameter");if(!an(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(u=>Su(u).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Su(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,u={verified:{verifyUrl:o.verifyUrl||Il,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Wr.link_mode){const d=this.getAppLinkIfEnabled(o,a);return u.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",u}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(u.verified.origin=l.origin,u.verified.isScam=l.isScam,u.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(u)}`),u},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!an(i,!1)){const{message:s}=ut("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,u,l,d,p,y;return!r||n!==Wr.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(u=this.client.metadata)==null?void 0:u.redirect)==null?void 0:l.universal)!==""&&((d=r==null?void 0:r.redirect)==null?void 0:d.universal)!==void 0&&((p=r==null?void 0:r.redirect)==null?void 0:p.universal)!==""&&((y=r==null?void 0:r.redirect)==null?void 0:y.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=Z3(r,"topic")||"",i=decodeURIComponent(Z3(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:Wr.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(i1()||Au()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ii.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(Qd)?this.client.auth.authKeys.get(Qd):{publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===Wr.link_mode?vl:la});try{g1(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:Ao(n)})):Yd(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(u){this.client.logger.error(u)}}registerExpirerEvents(){this.client.core.expirer.on(Zi.expired,async e=>{const{topic:r,id:n}=X3(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ut("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,ut("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(oc.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(oc.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=ut("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!an(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=ut("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=ut("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(an(e,!1)){const{message:r}=ut("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=ut("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!$$(e)){const{message:r}=ut("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(fa(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=ut("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class yq extends uc{constructor(e,r){super(e,r,nq,_1),this.core=e,this.logger=r}}let wq=class extends uc{constructor(e,r){super(e,r,iq,_1),this.core=e,this.logger=r}};class xq extends uc{constructor(e,r){super(e,r,oq,_1,n=>n.id),this.core=e,this.logger=r}}class _q extends uc{constructor(e,r){super(e,r,fq,Zd,()=>Qd),this.core=e,this.logger=r}}class Eq extends uc{constructor(e,r){super(e,r,lq,Zd),this.core=e,this.logger=r}}class Sq extends uc{constructor(e,r){super(e,r,hq,Zd,n=>n.id),this.core=e,this.logger=r}}class Aq{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new _q(this.core,this.logger),this.pairingTopics=new Eq(this.core,this.logger),this.requests=new Sq(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class A1 extends ZR{constructor(e){super(e),this.protocol=A6,this.version=P6,this.name=E1.name,this.events=new qi.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||E1.name,this.metadata=(e==null?void 0:e.metadata)||K3(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||E1.logger}));this.core=(e==null?void 0:e.core)||new rq(e),this.logger=ri(r,this.name),this.session=new wq(this.core,this.logger),this.proposal=new yq(this.core,this.logger),this.pendingRequest=new xq(this.core,this.logger),this.engine=new bq(this),this.auth=new Aq(this.core,this.logger)}static async init(e){const r=new A1(e);return await r.initialize(),r}get context(){return gi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var e0={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */e0.exports,function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",l=500,d="__lodash_placeholder__",p=1,y=2,A=4,P=1,N=2,D=1,k=2,B=4,q=8,j=16,H=32,J=64,T=128,z=256,ue=512,_e=30,G="...",E=800,m=16,f=1,g=2,v=3,x=1/0,_=9007199254740991,S=17976931348623157e292,b=NaN,M=4294967295,I=M-1,F=M>>>1,ae=[["ary",T],["bind",D],["bindKey",k],["curry",q],["curryRight",j],["flip",ue],["partial",H],["partialRight",J],["rearg",z]],O="[object Arguments]",se="[object Array]",ee="[object AsyncFunction]",X="[object Boolean]",Q="[object Date]",R="[object DOMException]",Z="[object Error]",te="[object Function]",le="[object GeneratorFunction]",ie="[object Map]",fe="[object Number]",ve="[object Null]",Me="[object Object]",Ne="[object Promise]",Te="[object Proxy]",$e="[object RegExp]",Ie="[object Set]",Le="[object String]",Ve="[object Symbol]",ke="[object Undefined]",ze="[object WeakMap]",He="[object WeakSet]",Se="[object ArrayBuffer]",Qe="[object DataView]",ct="[object Float32Array]",Be="[object Float64Array]",et="[object Int8Array]",rt="[object Int16Array]",Je="[object Int32Array]",pt="[object Uint8Array]",ht="[object Uint8ClampedArray]",ft="[object Uint16Array]",Ht="[object Uint32Array]",Jt=/\b__p \+= '';/g,St=/\b(__p \+=) '' \+/g,er=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Xt=/&(?:amp|lt|gt|quot|#39);/g,Ot=/[&<>"']/g,Bt=RegExp(Xt.source),Tt=RegExp(Ot.source),vt=/<%-([\s\S]+?)%>/g,Dt=/<%([\s\S]+?)%>/g,Lt=/<%=([\s\S]+?)%>/g,bt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$t=/^\w*$/,jt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(nt.source),$=/^\s+/,W=/\s/,V=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C=/\{\n\/\* \[wrapped with (.+)\] \*/,Y=/,? & /,U=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,oe=/[()=,{}\[\]\/\s]/,pe=/\\(\\)?/g,xe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Re=/\w*$/,De=/^[-+]0x[0-9a-f]+$/i,it=/^0b[01]+$/i,Ue=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,st=/^(?:0|[1-9]\d*)$/,tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,Rt=/['\n\r\u2028\u2029\\]/g,Mt="\\ud800-\\udfff",Et="\\u0300-\\u036f",dt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",ot=Et+dt+_t,wt="\\u2700-\\u27bf",lt="a-z\\xdf-\\xf6\\xf8-\\xff",at="\\xac\\xb1\\xd7\\xf7",Ae="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Pe="\\u2000-\\u206f",Ge=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="A-Z\\xc0-\\xd6\\xd8-\\xde",qe="\\ufe0e\\ufe0f",Xe=at+Ae+Pe+Ge,kt="['’]",Wt="["+Mt+"]",Zt="["+Xe+"]",Kt="["+ot+"]",de="\\d+",nr="["+wt+"]",dr="["+lt+"]",pr="[^"+Mt+Xe+de+wt+lt+je+"]",Qt="\\ud83c[\\udffb-\\udfff]",gr="(?:"+Kt+"|"+Qt+")",lr="[^"+Mt+"]",Lr="(?:\\ud83c[\\udde6-\\uddff]){2}",mr="[\\ud800-\\udbff][\\udc00-\\udfff]",wr="["+je+"]",Br="\\u200d",$r="(?:"+dr+"|"+pr+")",Ir="(?:"+wr+"|"+pr+")",hn="(?:"+kt+"(?:d|ll|m|re|s|t|ve))?",dn="(?:"+kt+"(?:D|LL|M|RE|S|T|VE))?",pn=gr+"?",sp="["+qe+"]?",jb="(?:"+Br+"(?:"+[lr,Lr,mr].join("|")+")"+sp+pn+")*",jo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",op="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ap=sp+pn+jb,ef="(?:"+[nr,Lr,mr].join("|")+")"+ap,Ub="(?:"+[lr+Kt+"?",Kt,Lr,mr,Wt].join("|")+")",gh=RegExp(kt,"g"),qb=RegExp(Kt,"g"),tf=RegExp(Qt+"(?="+Qt+")|"+Ub+ap,"g"),cp=RegExp([wr+"?"+dr+"+"+hn+"(?="+[Zt,wr,"$"].join("|")+")",Ir+"+"+dn+"(?="+[Zt,wr+$r,"$"].join("|")+")",wr+"?"+$r+"+"+hn,wr+"+"+dn,op,jo,de,ef].join("|"),"g"),up=RegExp("["+Br+Mt+ot+qe+"]"),Pc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],zb=-1,Fr={};Fr[ct]=Fr[Be]=Fr[et]=Fr[rt]=Fr[Je]=Fr[pt]=Fr[ht]=Fr[ft]=Fr[Ht]=!0,Fr[O]=Fr[se]=Fr[Se]=Fr[X]=Fr[Qe]=Fr[Q]=Fr[Z]=Fr[te]=Fr[ie]=Fr[fe]=Fr[Me]=Fr[$e]=Fr[Ie]=Fr[Le]=Fr[ze]=!1;var kr={};kr[O]=kr[se]=kr[Se]=kr[Qe]=kr[X]=kr[Q]=kr[ct]=kr[Be]=kr[et]=kr[rt]=kr[Je]=kr[ie]=kr[fe]=kr[Me]=kr[$e]=kr[Ie]=kr[Le]=kr[Ve]=kr[pt]=kr[ht]=kr[ft]=kr[Ht]=!0,kr[Z]=kr[te]=kr[ze]=!1;var ce={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ye={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye={"&":"&","<":"<",">":">",""":'"',"'":"'"},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},jr=parseFloat,ir=parseInt,Yr=typeof nn=="object"&&nn&&nn.Object===Object&&nn,wn=typeof self=="object"&&self&&self.Object===Object&&self,_r=Yr||wn||Function("return this")(),Ur=e&&!e.nodeType&&e,gn=Ur&&!0&&t&&!t.nodeType&&t,_i=gn&&gn.exports===Ur,xn=_i&&Yr.process,Jr=function(){try{var be=gn&&gn.require&&gn.require("util").types;return be||xn&&xn.binding&&xn.binding("util")}catch{}}(),oi=Jr&&Jr.isArrayBuffer,Ps=Jr&&Jr.isDate,is=Jr&&Jr.isMap,ro=Jr&&Jr.isRegExp,mh=Jr&&Jr.isSet,Mc=Jr&&Jr.isTypedArray;function $n(be,Fe,Ce){switch(Ce.length){case 0:return be.call(Fe);case 1:return be.call(Fe,Ce[0]);case 2:return be.call(Fe,Ce[0],Ce[1]);case 3:return be.call(Fe,Ce[0],Ce[1],Ce[2])}return be.apply(Fe,Ce)}function OQ(be,Fe,Ce,Ct){for(var tr=-1,Mr=be==null?0:be.length;++tr-1}function Hb(be,Fe,Ce){for(var Ct=-1,tr=be==null?0:be.length;++Ct-1;);return Ce}function r9(be,Fe){for(var Ce=be.length;Ce--&&rf(Fe,be[Ce],0)>-1;);return Ce}function qQ(be,Fe){for(var Ce=be.length,Ct=0;Ce--;)be[Ce]===Fe&&++Ct;return Ct}var zQ=Gb(ce),HQ=Gb(ye);function WQ(be){return"\\"+It[be]}function KQ(be,Fe){return be==null?r:be[Fe]}function nf(be){return up.test(be)}function VQ(be){return Pc.test(be)}function GQ(be){for(var Fe,Ce=[];!(Fe=be.next()).done;)Ce.push(Fe.value);return Ce}function Zb(be){var Fe=-1,Ce=Array(be.size);return be.forEach(function(Ct,tr){Ce[++Fe]=[tr,Ct]}),Ce}function n9(be,Fe){return function(Ce){return be(Fe(Ce))}}function Ta(be,Fe){for(var Ce=-1,Ct=be.length,tr=0,Mr=[];++Ce-1}function Lee(c,h){var w=this.__data__,L=Ip(w,c);return L<0?(++this.size,w.push([c,h])):w[L][1]=h,this}Uo.prototype.clear=Ree,Uo.prototype.delete=Dee,Uo.prototype.get=Oee,Uo.prototype.has=Nee,Uo.prototype.set=Lee;function qo(c){var h=-1,w=c==null?0:c.length;for(this.clear();++h=h?c:h)),c}function cs(c,h,w,L,K,ne){var he,me=h&p,we=h&y,We=h&A;if(w&&(he=K?w(c,L,K,ne):w(c)),he!==r)return he;if(!Qr(c))return c;var Ke=sr(c);if(Ke){if(he=Fte(c),!me)return Ei(c,he)}else{var Ze=ti(c),xt=Ze==te||Ze==le;if(ka(c))return F9(c,me);if(Ze==Me||Ze==O||xt&&!K){if(he=we||xt?{}:iA(c),!me)return we?Ite(c,Xee(he,c)):Mte(c,g9(he,c))}else{if(!kr[Ze])return K?c:{};he=jte(c,Ze,me)}}ne||(ne=new Is);var Nt=ne.get(c);if(Nt)return Nt;ne.set(c,he),OA(c)?c.forEach(function(Gt){he.add(cs(Gt,h,w,Gt,c,ne))}):RA(c)&&c.forEach(function(Gt,br){he.set(br,cs(Gt,h,w,br,c,ne))});var Vt=We?we?Sy:Ey:we?Ai:Fn,fr=Ke?r:Vt(c);return ss(fr||c,function(Gt,br){fr&&(br=Gt,Gt=c[br]),Eh(he,br,cs(Gt,h,w,br,c,ne))}),he}function Zee(c){var h=Fn(c);return function(w){return m9(w,c,h)}}function m9(c,h,w){var L=w.length;if(c==null)return!L;for(c=qr(c);L--;){var K=w[L],ne=h[K],he=c[K];if(he===r&&!(K in c)||!ne(he))return!1}return!0}function v9(c,h,w){if(typeof c!="function")throw new os(o);return Th(function(){c.apply(r,w)},h)}function Sh(c,h,w,L){var K=-1,ne=lp,he=!0,me=c.length,we=[],We=h.length;if(!me)return we;w&&(h=Xr(h,Li(w))),L?(ne=Hb,he=!1):h.length>=i&&(ne=vh,he=!1,h=new Tc(h));e:for(;++KK?0:K+w),L=L===r||L>K?K:ur(L),L<0&&(L+=K),L=w>L?0:LA(L);w0&&w(me)?h>1?Vn(me,h-1,w,L,K):Ca(K,me):L||(K[K.length]=me)}return K}var sy=W9(),w9=W9(!0);function no(c,h){return c&&sy(c,h,Fn)}function oy(c,h){return c&&w9(c,h,Fn)}function Tp(c,h){return Ia(h,function(w){return Vo(c[w])})}function Dc(c,h){h=Na(h,c);for(var w=0,L=h.length;c!=null&&wh}function tte(c,h){return c!=null&&Tr.call(c,h)}function rte(c,h){return c!=null&&h in qr(c)}function nte(c,h,w){return c>=ei(h,w)&&c=120&&Ke.length>=120)?new Tc(he&&Ke):r}Ke=c[0];var Ze=-1,xt=me[0];e:for(;++Ze-1;)me!==c&&xp.call(me,we,1),xp.call(c,we,1);return c}function R9(c,h){for(var w=c?h.length:0,L=w-1;w--;){var K=h[w];if(w==L||K!==ne){var ne=K;Ko(K)?xp.call(c,K,1):my(c,K)}}return c}function dy(c,h){return c+Sp(l9()*(h-c+1))}function mte(c,h,w,L){for(var K=-1,ne=Pn(Ep((h-c)/(w||1)),0),he=Ce(ne);ne--;)he[L?ne:++K]=c,c+=w;return he}function py(c,h){var w="";if(!c||h<1||h>_)return w;do h%2&&(w+=c),h=Sp(h/2),h&&(c+=c);while(h);return w}function hr(c,h){return Ry(aA(c,h,Pi),c+"")}function vte(c){return p9(gf(c))}function bte(c,h){var w=gf(c);return Up(w,Rc(h,0,w.length))}function Mh(c,h,w,L){if(!Qr(c))return c;h=Na(h,c);for(var K=-1,ne=h.length,he=ne-1,me=c;me!=null&&++KK?0:K+h),w=w>K?K:w,w<0&&(w+=K),K=h>w?0:w-h>>>0,h>>>=0;for(var ne=Ce(K);++L>>1,he=c[ne];he!==null&&!Bi(he)&&(w?he<=h:he=i){var We=h?null:Dte(c);if(We)return dp(We);he=!1,K=vh,we=new Tc}else we=h?[]:me;e:for(;++L=L?c:us(c,h,w)}var $9=uee||function(c){return _r.clearTimeout(c)};function F9(c,h){if(h)return c.slice();var w=c.length,L=o9?o9(w):new c.constructor(w);return c.copy(L),L}function wy(c){var h=new c.constructor(c.byteLength);return new yp(h).set(new yp(c)),h}function Ete(c,h){var w=h?wy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.byteLength)}function Ste(c){var h=new c.constructor(c.source,Re.exec(c));return h.lastIndex=c.lastIndex,h}function Ate(c){return _h?qr(_h.call(c)):{}}function j9(c,h){var w=h?wy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.length)}function U9(c,h){if(c!==h){var w=c!==r,L=c===null,K=c===c,ne=Bi(c),he=h!==r,me=h===null,we=h===h,We=Bi(h);if(!me&&!We&&!ne&&c>h||ne&&he&&we&&!me&&!We||L&&he&&we||!w&&we||!K)return 1;if(!L&&!ne&&!We&&c=me)return we;var We=w[L];return we*(We=="desc"?-1:1)}}return c.index-h.index}function q9(c,h,w,L){for(var K=-1,ne=c.length,he=w.length,me=-1,we=h.length,We=Pn(ne-he,0),Ke=Ce(we+We),Ze=!L;++me1?w[K-1]:r,he=K>2?w[2]:r;for(ne=c.length>3&&typeof ne=="function"?(K--,ne):r,he&&ci(w[0],w[1],he)&&(ne=K<3?r:ne,K=1),h=qr(h);++L-1?K[ne?h[he]:he]:r}}function G9(c){return Wo(function(h){var w=h.length,L=w,K=as.prototype.thru;for(c&&h.reverse();L--;){var ne=h[L];if(typeof ne!="function")throw new os(o);if(K&&!he&&Fp(ne)=="wrapper")var he=new as([],!0)}for(L=he?L:w;++L1&&Er.reverse(),Ke&&weme))return!1;var We=ne.get(c),Ke=ne.get(h);if(We&&Ke)return We==h&&Ke==c;var Ze=-1,xt=!0,Nt=w&N?new Tc:r;for(ne.set(c,h),ne.set(h,c);++Ze1?"& ":"")+h[L],h=h.join(w>2?", ":" "),c.replace(V,`{ + */e0.exports,function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",l=500,d="__lodash_placeholder__",p=1,y=2,A=4,P=1,O=2,D=1,k=2,B=4,q=8,j=16,H=32,J=64,T=128,z=256,ue=512,_e=30,G="...",E=800,m=16,f=1,g=2,v=3,x=1/0,_=9007199254740991,S=17976931348623157e292,b=NaN,M=4294967295,I=M-1,F=M>>>1,ce=[["ary",T],["bind",D],["bindKey",k],["curry",q],["curryRight",j],["flip",ue],["partial",H],["partialRight",J],["rearg",z]],N="[object Arguments]",se="[object Array]",ee="[object AsyncFunction]",X="[object Boolean]",Q="[object Date]",R="[object DOMException]",Z="[object Error]",te="[object Function]",le="[object GeneratorFunction]",ie="[object Map]",fe="[object Number]",ve="[object Null]",Me="[object Object]",Ne="[object Promise]",Te="[object Proxy]",$e="[object RegExp]",Ie="[object Set]",Le="[object String]",Ve="[object Symbol]",ke="[object Undefined]",ze="[object WeakMap]",He="[object WeakSet]",Ee="[object ArrayBuffer]",Qe="[object DataView]",ct="[object Float32Array]",Be="[object Float64Array]",et="[object Int8Array]",rt="[object Int16Array]",Je="[object Int32Array]",pt="[object Uint8Array]",ht="[object Uint8ClampedArray]",ft="[object Uint16Array]",Ht="[object Uint32Array]",Jt=/\b__p \+= '';/g,St=/\b(__p \+=) '' \+/g,er=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Xt=/&(?:amp|lt|gt|quot|#39);/g,Ot=/[&<>"']/g,Bt=RegExp(Xt.source),Tt=RegExp(Ot.source),vt=/<%-([\s\S]+?)%>/g,Dt=/<%([\s\S]+?)%>/g,Lt=/<%=([\s\S]+?)%>/g,bt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$t=/^\w*$/,jt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(nt.source),$=/^\s+/,W=/\s/,V=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C=/\{\n\/\* \[wrapped with (.+)\] \*/,Y=/,? & /,U=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,oe=/[()=,{}\[\]\/\s]/,ge=/\\(\\)?/g,xe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Re=/\w*$/,De=/^[-+]0x[0-9a-f]+$/i,it=/^0b[01]+$/i,Ue=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,st=/^(?:0|[1-9]\d*)$/,tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,Rt=/['\n\r\u2028\u2029\\]/g,Mt="\\ud800-\\udfff",Et="\\u0300-\\u036f",dt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",ot=Et+dt+_t,wt="\\u2700-\\u27bf",lt="a-z\\xdf-\\xf6\\xf8-\\xff",at="\\xac\\xb1\\xd7\\xf7",Ae="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Pe="\\u2000-\\u206f",Ge=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="A-Z\\xc0-\\xd6\\xd8-\\xde",qe="\\ufe0e\\ufe0f",Xe=at+Ae+Pe+Ge,kt="['’]",Wt="["+Mt+"]",Zt="["+Xe+"]",Kt="["+ot+"]",pe="\\d+",nr="["+wt+"]",dr="["+lt+"]",pr="[^"+Mt+Xe+pe+wt+lt+je+"]",Qt="\\ud83c[\\udffb-\\udfff]",gr="(?:"+Kt+"|"+Qt+")",lr="[^"+Mt+"]",Lr="(?:\\ud83c[\\udde6-\\uddff]){2}",mr="[\\ud800-\\udbff][\\udc00-\\udfff]",wr="["+je+"]",Br="\\u200d",$r="(?:"+dr+"|"+pr+")",Ir="(?:"+wr+"|"+pr+")",hn="(?:"+kt+"(?:d|ll|m|re|s|t|ve))?",dn="(?:"+kt+"(?:D|LL|M|RE|S|T|VE))?",pn=gr+"?",sp="["+qe+"]?",Fb="(?:"+Br+"(?:"+[lr,Lr,mr].join("|")+")"+sp+pn+")*",jo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",op="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ap=sp+pn+Fb,ef="(?:"+[nr,Lr,mr].join("|")+")"+ap,jb="(?:"+[lr+Kt+"?",Kt,Lr,mr,Wt].join("|")+")",gh=RegExp(kt,"g"),Ub=RegExp(Kt,"g"),tf=RegExp(Qt+"(?="+Qt+")|"+jb+ap,"g"),cp=RegExp([wr+"?"+dr+"+"+hn+"(?="+[Zt,wr,"$"].join("|")+")",Ir+"+"+dn+"(?="+[Zt,wr+$r,"$"].join("|")+")",wr+"?"+$r+"+"+hn,wr+"+"+dn,op,jo,pe,ef].join("|"),"g"),up=RegExp("["+Br+Mt+ot+qe+"]"),Pc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],qb=-1,Fr={};Fr[ct]=Fr[Be]=Fr[et]=Fr[rt]=Fr[Je]=Fr[pt]=Fr[ht]=Fr[ft]=Fr[Ht]=!0,Fr[N]=Fr[se]=Fr[Ee]=Fr[X]=Fr[Qe]=Fr[Q]=Fr[Z]=Fr[te]=Fr[ie]=Fr[fe]=Fr[Me]=Fr[$e]=Fr[Ie]=Fr[Le]=Fr[ze]=!1;var kr={};kr[N]=kr[se]=kr[Ee]=kr[Qe]=kr[X]=kr[Q]=kr[ct]=kr[Be]=kr[et]=kr[rt]=kr[Je]=kr[ie]=kr[fe]=kr[Me]=kr[$e]=kr[Ie]=kr[Le]=kr[Ve]=kr[pt]=kr[ht]=kr[ft]=kr[Ht]=!0,kr[Z]=kr[te]=kr[ze]=!1;var ae={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ye={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye={"&":"&","<":"<",">":">",""":'"',"'":"'"},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},jr=parseFloat,ir=parseInt,Yr=typeof nn=="object"&&nn&&nn.Object===Object&&nn,wn=typeof self=="object"&&self&&self.Object===Object&&self,_r=Yr||wn||Function("return this")(),Ur=e&&!e.nodeType&&e,gn=Ur&&!0&&t&&!t.nodeType&&t,_i=gn&&gn.exports===Ur,xn=_i&&Yr.process,Jr=function(){try{var be=gn&&gn.require&&gn.require("util").types;return be||xn&&xn.binding&&xn.binding("util")}catch{}}(),oi=Jr&&Jr.isArrayBuffer,Ps=Jr&&Jr.isDate,is=Jr&&Jr.isMap,ro=Jr&&Jr.isRegExp,mh=Jr&&Jr.isSet,Mc=Jr&&Jr.isTypedArray;function $n(be,Fe,Ce){switch(Ce.length){case 0:return be.call(Fe);case 1:return be.call(Fe,Ce[0]);case 2:return be.call(Fe,Ce[0],Ce[1]);case 3:return be.call(Fe,Ce[0],Ce[1],Ce[2])}return be.apply(Fe,Ce)}function NQ(be,Fe,Ce,Ct){for(var tr=-1,Mr=be==null?0:be.length;++tr-1}function zb(be,Fe,Ce){for(var Ct=-1,tr=be==null?0:be.length;++Ct-1;);return Ce}function r9(be,Fe){for(var Ce=be.length;Ce--&&rf(Fe,be[Ce],0)>-1;);return Ce}function zQ(be,Fe){for(var Ce=be.length,Ct=0;Ce--;)be[Ce]===Fe&&++Ct;return Ct}var HQ=Vb(ae),WQ=Vb(ye);function KQ(be){return"\\"+It[be]}function VQ(be,Fe){return be==null?r:be[Fe]}function nf(be){return up.test(be)}function GQ(be){return Pc.test(be)}function YQ(be){for(var Fe,Ce=[];!(Fe=be.next()).done;)Ce.push(Fe.value);return Ce}function Xb(be){var Fe=-1,Ce=Array(be.size);return be.forEach(function(Ct,tr){Ce[++Fe]=[tr,Ct]}),Ce}function n9(be,Fe){return function(Ce){return be(Fe(Ce))}}function Ta(be,Fe){for(var Ce=-1,Ct=be.length,tr=0,Mr=[];++Ce-1}function kee(c,h){var w=this.__data__,L=Ip(w,c);return L<0?(++this.size,w.push([c,h])):w[L][1]=h,this}Uo.prototype.clear=Dee,Uo.prototype.delete=Oee,Uo.prototype.get=Nee,Uo.prototype.has=Lee,Uo.prototype.set=kee;function qo(c){var h=-1,w=c==null?0:c.length;for(this.clear();++h=h?c:h)),c}function cs(c,h,w,L,K,ne){var he,me=h&p,we=h&y,We=h&A;if(w&&(he=K?w(c,L,K,ne):w(c)),he!==r)return he;if(!Qr(c))return c;var Ke=sr(c);if(Ke){if(he=jte(c),!me)return Ei(c,he)}else{var Ze=ti(c),xt=Ze==te||Ze==le;if(ka(c))return F9(c,me);if(Ze==Me||Ze==N||xt&&!K){if(he=we||xt?{}:iA(c),!me)return we?Cte(c,Zee(he,c)):Ite(c,g9(he,c))}else{if(!kr[Ze])return K?c:{};he=Ute(c,Ze,me)}}ne||(ne=new Is);var Nt=ne.get(c);if(Nt)return Nt;ne.set(c,he),OA(c)?c.forEach(function(Gt){he.add(cs(Gt,h,w,Gt,c,ne))}):RA(c)&&c.forEach(function(Gt,br){he.set(br,cs(Gt,h,w,br,c,ne))});var Vt=We?we?Ey:_y:we?Ai:Fn,fr=Ke?r:Vt(c);return ss(fr||c,function(Gt,br){fr&&(br=Gt,Gt=c[br]),Eh(he,br,cs(Gt,h,w,br,c,ne))}),he}function Qee(c){var h=Fn(c);return function(w){return m9(w,c,h)}}function m9(c,h,w){var L=w.length;if(c==null)return!L;for(c=qr(c);L--;){var K=w[L],ne=h[K],he=c[K];if(he===r&&!(K in c)||!ne(he))return!1}return!0}function v9(c,h,w){if(typeof c!="function")throw new os(o);return Th(function(){c.apply(r,w)},h)}function Sh(c,h,w,L){var K=-1,ne=lp,he=!0,me=c.length,we=[],We=h.length;if(!me)return we;w&&(h=Xr(h,Li(w))),L?(ne=zb,he=!1):h.length>=i&&(ne=vh,he=!1,h=new Tc(h));e:for(;++KK?0:K+w),L=L===r||L>K?K:ur(L),L<0&&(L+=K),L=w>L?0:LA(L);w0&&w(me)?h>1?Vn(me,h-1,w,L,K):Ca(K,me):L||(K[K.length]=me)}return K}var iy=W9(),w9=W9(!0);function no(c,h){return c&&iy(c,h,Fn)}function sy(c,h){return c&&w9(c,h,Fn)}function Tp(c,h){return Ia(h,function(w){return Vo(c[w])})}function Dc(c,h){h=Na(h,c);for(var w=0,L=h.length;c!=null&&wh}function rte(c,h){return c!=null&&Tr.call(c,h)}function nte(c,h){return c!=null&&h in qr(c)}function ite(c,h,w){return c>=ei(h,w)&&c=120&&Ke.length>=120)?new Tc(he&&Ke):r}Ke=c[0];var Ze=-1,xt=me[0];e:for(;++Ze-1;)me!==c&&xp.call(me,we,1),xp.call(c,we,1);return c}function R9(c,h){for(var w=c?h.length:0,L=w-1;w--;){var K=h[w];if(w==L||K!==ne){var ne=K;Ko(K)?xp.call(c,K,1):gy(c,K)}}return c}function hy(c,h){return c+Sp(l9()*(h-c+1))}function vte(c,h,w,L){for(var K=-1,ne=Pn(Ep((h-c)/(w||1)),0),he=Ce(ne);ne--;)he[L?ne:++K]=c,c+=w;return he}function dy(c,h){var w="";if(!c||h<1||h>_)return w;do h%2&&(w+=c),h=Sp(h/2),h&&(c+=c);while(h);return w}function hr(c,h){return Ty(aA(c,h,Pi),c+"")}function bte(c){return p9(gf(c))}function yte(c,h){var w=gf(c);return Up(w,Rc(h,0,w.length))}function Mh(c,h,w,L){if(!Qr(c))return c;h=Na(h,c);for(var K=-1,ne=h.length,he=ne-1,me=c;me!=null&&++KK?0:K+h),w=w>K?K:w,w<0&&(w+=K),K=h>w?0:w-h>>>0,h>>>=0;for(var ne=Ce(K);++L>>1,he=c[ne];he!==null&&!Bi(he)&&(w?he<=h:he=i){var We=h?null:Ote(c);if(We)return dp(We);he=!1,K=vh,we=new Tc}else we=h?[]:me;e:for(;++L=L?c:us(c,h,w)}var $9=fee||function(c){return _r.clearTimeout(c)};function F9(c,h){if(h)return c.slice();var w=c.length,L=o9?o9(w):new c.constructor(w);return c.copy(L),L}function yy(c){var h=new c.constructor(c.byteLength);return new yp(h).set(new yp(c)),h}function Ste(c,h){var w=h?yy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.byteLength)}function Ate(c){var h=new c.constructor(c.source,Re.exec(c));return h.lastIndex=c.lastIndex,h}function Pte(c){return _h?qr(_h.call(c)):{}}function j9(c,h){var w=h?yy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.length)}function U9(c,h){if(c!==h){var w=c!==r,L=c===null,K=c===c,ne=Bi(c),he=h!==r,me=h===null,we=h===h,We=Bi(h);if(!me&&!We&&!ne&&c>h||ne&&he&&we&&!me&&!We||L&&he&&we||!w&&we||!K)return 1;if(!L&&!ne&&!We&&c=me)return we;var We=w[L];return we*(We=="desc"?-1:1)}}return c.index-h.index}function q9(c,h,w,L){for(var K=-1,ne=c.length,he=w.length,me=-1,we=h.length,We=Pn(ne-he,0),Ke=Ce(we+We),Ze=!L;++me1?w[K-1]:r,he=K>2?w[2]:r;for(ne=c.length>3&&typeof ne=="function"?(K--,ne):r,he&&ci(w[0],w[1],he)&&(ne=K<3?r:ne,K=1),h=qr(h);++L-1?K[ne?h[he]:he]:r}}function G9(c){return Wo(function(h){var w=h.length,L=w,K=as.prototype.thru;for(c&&h.reverse();L--;){var ne=h[L];if(typeof ne!="function")throw new os(o);if(K&&!he&&Fp(ne)=="wrapper")var he=new as([],!0)}for(L=he?L:w;++L1&&Er.reverse(),Ke&&weme))return!1;var We=ne.get(c),Ke=ne.get(h);if(We&&Ke)return We==h&&Ke==c;var Ze=-1,xt=!0,Nt=w&O?new Tc:r;for(ne.set(c,h),ne.set(h,c);++Ze1?"& ":"")+h[L],h=h.join(w>2?", ":" "),c.replace(V,`{ /* [wrapped with `+h+`] */ -`)}function qte(c){return sr(c)||Lc(c)||!!(u9&&c&&c[u9])}function Ko(c,h){var w=typeof c;return h=h??_,!!h&&(w=="number"||w!="symbol"&&st.test(c))&&c>-1&&c%1==0&&c0){if(++h>=E)return arguments[0]}else h=0;return c.apply(r,arguments)}}function Up(c,h){var w=-1,L=c.length,K=L-1;for(h=h===r?L:h;++w1?c[h-1]:r;return w=typeof w=="function"?(c.pop(),w):r,yA(c,w)});function wA(c){var h=re(c);return h.__chain__=!0,h}function Qre(c,h){return h(c),c}function qp(c,h){return h(c)}var ene=Wo(function(c){var h=c.length,w=h?c[0]:0,L=this.__wrapped__,K=function(ne){return iy(ne,c)};return h>1||this.__actions__.length||!(L instanceof xr)||!Ko(w)?this.thru(K):(L=L.slice(w,+w+(h?1:0)),L.__actions__.push({func:qp,args:[K],thisArg:r}),new as(L,this.__chain__).thru(function(ne){return h&&!ne.length&&ne.push(r),ne}))});function tne(){return wA(this)}function rne(){return new as(this.value(),this.__chain__)}function nne(){this.__values__===r&&(this.__values__=NA(this.value()));var c=this.__index__>=this.__values__.length,h=c?r:this.__values__[this.__index__++];return{done:c,value:h}}function ine(){return this}function sne(c){for(var h,w=this;w instanceof Mp;){var L=dA(w);L.__index__=0,L.__values__=r,h?K.__wrapped__=L:h=L;var K=L;w=w.__wrapped__}return K.__wrapped__=c,h}function one(){var c=this.__wrapped__;if(c instanceof xr){var h=c;return this.__actions__.length&&(h=new xr(this)),h=h.reverse(),h.__actions__.push({func:qp,args:[Dy],thisArg:r}),new as(h,this.__chain__)}return this.thru(Dy)}function ane(){return k9(this.__wrapped__,this.__actions__)}var cne=Np(function(c,h,w){Tr.call(c,w)?++c[w]:zo(c,w,1)});function une(c,h,w){var L=sr(c)?Y7:Qee;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}function fne(c,h){var w=sr(c)?Ia:y9;return w(c,qt(h,3))}var lne=V9(pA),hne=V9(gA);function dne(c,h){return Vn(zp(c,h),1)}function pne(c,h){return Vn(zp(c,h),x)}function gne(c,h,w){return w=w===r?1:ur(w),Vn(zp(c,h),w)}function xA(c,h){var w=sr(c)?ss:Da;return w(c,qt(h,3))}function _A(c,h){var w=sr(c)?NQ:b9;return w(c,qt(h,3))}var mne=Np(function(c,h,w){Tr.call(c,w)?c[w].push(h):zo(c,w,[h])});function vne(c,h,w,L){c=Si(c)?c:gf(c),w=w&&!L?ur(w):0;var K=c.length;return w<0&&(w=Pn(K+w,0)),Gp(c)?w<=K&&c.indexOf(h,w)>-1:!!K&&rf(c,h,w)>-1}var bne=hr(function(c,h,w){var L=-1,K=typeof h=="function",ne=Si(c)?Ce(c.length):[];return Da(c,function(he){ne[++L]=K?$n(h,he,w):Ah(he,h,w)}),ne}),yne=Np(function(c,h,w){zo(c,w,h)});function zp(c,h){var w=sr(c)?Xr:A9;return w(c,qt(h,3))}function wne(c,h,w,L){return c==null?[]:(sr(h)||(h=h==null?[]:[h]),w=L?r:w,sr(w)||(w=w==null?[]:[w]),C9(c,h,w))}var xne=Np(function(c,h,w){c[w?0:1].push(h)},function(){return[[],[]]});function _ne(c,h,w){var L=sr(c)?Wb:Q7,K=arguments.length<3;return L(c,qt(h,4),w,K,Da)}function Ene(c,h,w){var L=sr(c)?LQ:Q7,K=arguments.length<3;return L(c,qt(h,4),w,K,b9)}function Sne(c,h){var w=sr(c)?Ia:y9;return w(c,Kp(qt(h,3)))}function Ane(c){var h=sr(c)?p9:vte;return h(c)}function Pne(c,h,w){(w?ci(c,h,w):h===r)?h=1:h=ur(h);var L=sr(c)?Gee:bte;return L(c,h)}function Mne(c){var h=sr(c)?Yee:wte;return h(c)}function Ine(c){if(c==null)return 0;if(Si(c))return Gp(c)?sf(c):c.length;var h=ti(c);return h==ie||h==Ie?c.size:fy(c).length}function Cne(c,h,w){var L=sr(c)?Kb:xte;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}var Tne=hr(function(c,h){if(c==null)return[];var w=h.length;return w>1&&ci(c,h[0],h[1])?h=[]:w>2&&ci(h[0],h[1],h[2])&&(h=[h[0]]),C9(c,Vn(h,1),[])}),Hp=fee||function(){return _r.Date.now()};function Rne(c,h){if(typeof h!="function")throw new os(o);return c=ur(c),function(){if(--c<1)return h.apply(this,arguments)}}function EA(c,h,w){return h=w?r:h,h=c&&h==null?c.length:h,Ho(c,T,r,r,r,r,h)}function SA(c,h){var w;if(typeof h!="function")throw new os(o);return c=ur(c),function(){return--c>0&&(w=h.apply(this,arguments)),c<=1&&(h=r),w}}var Ny=hr(function(c,h,w){var L=D;if(w.length){var K=Ta(w,df(Ny));L|=H}return Ho(c,L,h,w,K)}),AA=hr(function(c,h,w){var L=D|k;if(w.length){var K=Ta(w,df(AA));L|=H}return Ho(h,L,c,w,K)});function PA(c,h,w){h=w?r:h;var L=Ho(c,q,r,r,r,r,r,h);return L.placeholder=PA.placeholder,L}function MA(c,h,w){h=w?r:h;var L=Ho(c,j,r,r,r,r,r,h);return L.placeholder=MA.placeholder,L}function IA(c,h,w){var L,K,ne,he,me,we,We=0,Ke=!1,Ze=!1,xt=!0;if(typeof c!="function")throw new os(o);h=ls(h)||0,Qr(w)&&(Ke=!!w.leading,Ze="maxWait"in w,ne=Ze?Pn(ls(w.maxWait)||0,h):ne,xt="trailing"in w?!!w.trailing:xt);function Nt(vn){var Ts=L,Yo=K;return L=K=r,We=vn,he=c.apply(Yo,Ts),he}function Vt(vn){return We=vn,me=Th(br,h),Ke?Nt(vn):he}function fr(vn){var Ts=vn-we,Yo=vn-We,VA=h-Ts;return Ze?ei(VA,ne-Yo):VA}function Gt(vn){var Ts=vn-we,Yo=vn-We;return we===r||Ts>=h||Ts<0||Ze&&Yo>=ne}function br(){var vn=Hp();if(Gt(vn))return Er(vn);me=Th(br,fr(vn))}function Er(vn){return me=r,xt&&L?Nt(vn):(L=K=r,he)}function $i(){me!==r&&$9(me),We=0,L=we=K=me=r}function ui(){return me===r?he:Er(Hp())}function Fi(){var vn=Hp(),Ts=Gt(vn);if(L=arguments,K=this,we=vn,Ts){if(me===r)return Vt(we);if(Ze)return $9(me),me=Th(br,h),Nt(we)}return me===r&&(me=Th(br,h)),he}return Fi.cancel=$i,Fi.flush=ui,Fi}var Dne=hr(function(c,h){return v9(c,1,h)}),One=hr(function(c,h,w){return v9(c,ls(h)||0,w)});function Nne(c){return Ho(c,ue)}function Wp(c,h){if(typeof c!="function"||h!=null&&typeof h!="function")throw new os(o);var w=function(){var L=arguments,K=h?h.apply(this,L):L[0],ne=w.cache;if(ne.has(K))return ne.get(K);var he=c.apply(this,L);return w.cache=ne.set(K,he)||ne,he};return w.cache=new(Wp.Cache||qo),w}Wp.Cache=qo;function Kp(c){if(typeof c!="function")throw new os(o);return function(){var h=arguments;switch(h.length){case 0:return!c.call(this);case 1:return!c.call(this,h[0]);case 2:return!c.call(this,h[0],h[1]);case 3:return!c.call(this,h[0],h[1],h[2])}return!c.apply(this,h)}}function Lne(c){return SA(2,c)}var kne=_te(function(c,h){h=h.length==1&&sr(h[0])?Xr(h[0],Li(qt())):Xr(Vn(h,1),Li(qt()));var w=h.length;return hr(function(L){for(var K=-1,ne=ei(L.length,w);++K=h}),Lc=_9(function(){return arguments}())?_9:function(c){return rn(c)&&Tr.call(c,"callee")&&!c9.call(c,"callee")},sr=Ce.isArray,Xne=oi?Li(oi):ste;function Si(c){return c!=null&&Vp(c.length)&&!Vo(c)}function mn(c){return rn(c)&&Si(c)}function Zne(c){return c===!0||c===!1||rn(c)&&ai(c)==X}var ka=hee||Ky,Qne=Ps?Li(Ps):ote;function eie(c){return rn(c)&&c.nodeType===1&&!Rh(c)}function tie(c){if(c==null)return!0;if(Si(c)&&(sr(c)||typeof c=="string"||typeof c.splice=="function"||ka(c)||pf(c)||Lc(c)))return!c.length;var h=ti(c);if(h==ie||h==Ie)return!c.size;if(Ch(c))return!fy(c).length;for(var w in c)if(Tr.call(c,w))return!1;return!0}function rie(c,h){return Ph(c,h)}function nie(c,h,w){w=typeof w=="function"?w:r;var L=w?w(c,h):r;return L===r?Ph(c,h,r,w):!!L}function ky(c){if(!rn(c))return!1;var h=ai(c);return h==Z||h==R||typeof c.message=="string"&&typeof c.name=="string"&&!Rh(c)}function iie(c){return typeof c=="number"&&f9(c)}function Vo(c){if(!Qr(c))return!1;var h=ai(c);return h==te||h==le||h==ee||h==Te}function TA(c){return typeof c=="number"&&c==ur(c)}function Vp(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=_}function Qr(c){var h=typeof c;return c!=null&&(h=="object"||h=="function")}function rn(c){return c!=null&&typeof c=="object"}var RA=is?Li(is):cte;function sie(c,h){return c===h||uy(c,h,Py(h))}function oie(c,h,w){return w=typeof w=="function"?w:r,uy(c,h,Py(h),w)}function aie(c){return DA(c)&&c!=+c}function cie(c){if(Wte(c))throw new tr(s);return E9(c)}function uie(c){return c===null}function fie(c){return c==null}function DA(c){return typeof c=="number"||rn(c)&&ai(c)==fe}function Rh(c){if(!rn(c)||ai(c)!=Me)return!1;var h=wp(c);if(h===null)return!0;var w=Tr.call(h,"constructor")&&h.constructor;return typeof w=="function"&&w instanceof w&&mp.call(w)==oee}var By=ro?Li(ro):ute;function lie(c){return TA(c)&&c>=-_&&c<=_}var OA=mh?Li(mh):fte;function Gp(c){return typeof c=="string"||!sr(c)&&rn(c)&&ai(c)==Le}function Bi(c){return typeof c=="symbol"||rn(c)&&ai(c)==Ve}var pf=Mc?Li(Mc):lte;function hie(c){return c===r}function die(c){return rn(c)&&ti(c)==ze}function pie(c){return rn(c)&&ai(c)==He}var gie=$p(ly),mie=$p(function(c,h){return c<=h});function NA(c){if(!c)return[];if(Si(c))return Gp(c)?Ms(c):Ei(c);if(bh&&c[bh])return GQ(c[bh]());var h=ti(c),w=h==ie?Zb:h==Ie?dp:gf;return w(c)}function Go(c){if(!c)return c===0?c:0;if(c=ls(c),c===x||c===-x){var h=c<0?-1:1;return h*S}return c===c?c:0}function ur(c){var h=Go(c),w=h%1;return h===h?w?h-w:h:0}function LA(c){return c?Rc(ur(c),0,M):0}function ls(c){if(typeof c=="number")return c;if(Bi(c))return b;if(Qr(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=Qr(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=e9(c);var w=it.test(c);return w||gt.test(c)?ir(c.slice(2),w?2:8):De.test(c)?b:+c}function kA(c){return io(c,Ai(c))}function vie(c){return c?Rc(ur(c),-_,_):c===0?c:0}function Cr(c){return c==null?"":ki(c)}var bie=lf(function(c,h){if(Ch(h)||Si(h)){io(h,Fn(h),c);return}for(var w in h)Tr.call(h,w)&&Eh(c,w,h[w])}),BA=lf(function(c,h){io(h,Ai(h),c)}),Yp=lf(function(c,h,w,L){io(h,Ai(h),c,L)}),yie=lf(function(c,h,w,L){io(h,Fn(h),c,L)}),wie=Wo(iy);function xie(c,h){var w=ff(c);return h==null?w:g9(w,h)}var _ie=hr(function(c,h){c=qr(c);var w=-1,L=h.length,K=L>2?h[2]:r;for(K&&ci(h[0],h[1],K)&&(L=1);++w1),ne}),io(c,Sy(c),w),L&&(w=cs(w,p|y|A,Ote));for(var K=h.length;K--;)my(w,h[K]);return w});function jie(c,h){return FA(c,Kp(qt(h)))}var Uie=Wo(function(c,h){return c==null?{}:pte(c,h)});function FA(c,h){if(c==null)return{};var w=Xr(Sy(c),function(L){return[L]});return h=qt(h),T9(c,w,function(L,K){return h(L,K[0])})}function qie(c,h,w){h=Na(h,c);var L=-1,K=h.length;for(K||(K=1,c=r);++Lh){var L=c;c=h,h=L}if(w||c%1||h%1){var K=l9();return ei(c+K*(h-c+jr("1e-"+((K+"").length-1))),h)}return dy(c,h)}var Qie=hf(function(c,h,w){return h=h.toLowerCase(),c+(w?qA(h):h)});function qA(c){return jy(Cr(c).toLowerCase())}function zA(c){return c=Cr(c),c&&c.replace(tt,zQ).replace(qb,"")}function ese(c,h,w){c=Cr(c),h=ki(h);var L=c.length;w=w===r?L:Rc(ur(w),0,L);var K=w;return w-=h.length,w>=0&&c.slice(w,K)==h}function tse(c){return c=Cr(c),c&&Tt.test(c)?c.replace(Ot,HQ):c}function rse(c){return c=Cr(c),c&&Ft.test(c)?c.replace(nt,"\\$&"):c}var nse=hf(function(c,h,w){return c+(w?"-":"")+h.toLowerCase()}),ise=hf(function(c,h,w){return c+(w?" ":"")+h.toLowerCase()}),sse=K9("toLowerCase");function ose(c,h,w){c=Cr(c),h=ur(h);var L=h?sf(c):0;if(!h||L>=h)return c;var K=(h-L)/2;return Bp(Sp(K),w)+c+Bp(Ep(K),w)}function ase(c,h,w){c=Cr(c),h=ur(h);var L=h?sf(c):0;return h&&L>>0,w?(c=Cr(c),c&&(typeof h=="string"||h!=null&&!By(h))&&(h=ki(h),!h&&nf(c))?La(Ms(c),0,w):c.split(h,w)):[]}var pse=hf(function(c,h,w){return c+(w?" ":"")+jy(h)});function gse(c,h,w){return c=Cr(c),w=w==null?0:Rc(ur(w),0,c.length),h=ki(h),c.slice(w,w+h.length)==h}function mse(c,h,w){var L=re.templateSettings;w&&ci(c,h,w)&&(h=r),c=Cr(c),h=Yp({},h,L,Q9);var K=Yp({},h.imports,L.imports,Q9),ne=Fn(K),he=Xb(K,ne),me,we,We=0,Ke=h.interpolate||At,Ze="__p += '",xt=Qb((h.escape||At).source+"|"+Ke.source+"|"+(Ke===Lt?xe:At).source+"|"+(h.evaluate||At).source+"|$","g"),Nt="//# sourceURL="+(Tr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++zb+"]")+` -`;c.replace(xt,function(Gt,br,Er,$i,ui,Fi){return Er||(Er=$i),Ze+=c.slice(We,Fi).replace(Rt,WQ),br&&(me=!0,Ze+=`' + +`)}function zte(c){return sr(c)||Lc(c)||!!(u9&&c&&c[u9])}function Ko(c,h){var w=typeof c;return h=h??_,!!h&&(w=="number"||w!="symbol"&&st.test(c))&&c>-1&&c%1==0&&c0){if(++h>=E)return arguments[0]}else h=0;return c.apply(r,arguments)}}function Up(c,h){var w=-1,L=c.length,K=L-1;for(h=h===r?L:h;++w1?c[h-1]:r;return w=typeof w=="function"?(c.pop(),w):r,yA(c,w)});function wA(c){var h=re(c);return h.__chain__=!0,h}function ene(c,h){return h(c),c}function qp(c,h){return h(c)}var tne=Wo(function(c){var h=c.length,w=h?c[0]:0,L=this.__wrapped__,K=function(ne){return ny(ne,c)};return h>1||this.__actions__.length||!(L instanceof xr)||!Ko(w)?this.thru(K):(L=L.slice(w,+w+(h?1:0)),L.__actions__.push({func:qp,args:[K],thisArg:r}),new as(L,this.__chain__).thru(function(ne){return h&&!ne.length&&ne.push(r),ne}))});function rne(){return wA(this)}function nne(){return new as(this.value(),this.__chain__)}function ine(){this.__values__===r&&(this.__values__=NA(this.value()));var c=this.__index__>=this.__values__.length,h=c?r:this.__values__[this.__index__++];return{done:c,value:h}}function sne(){return this}function one(c){for(var h,w=this;w instanceof Mp;){var L=dA(w);L.__index__=0,L.__values__=r,h?K.__wrapped__=L:h=L;var K=L;w=w.__wrapped__}return K.__wrapped__=c,h}function ane(){var c=this.__wrapped__;if(c instanceof xr){var h=c;return this.__actions__.length&&(h=new xr(this)),h=h.reverse(),h.__actions__.push({func:qp,args:[Ry],thisArg:r}),new as(h,this.__chain__)}return this.thru(Ry)}function cne(){return k9(this.__wrapped__,this.__actions__)}var une=Np(function(c,h,w){Tr.call(c,w)?++c[w]:zo(c,w,1)});function fne(c,h,w){var L=sr(c)?Y7:ete;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}function lne(c,h){var w=sr(c)?Ia:y9;return w(c,qt(h,3))}var hne=V9(pA),dne=V9(gA);function pne(c,h){return Vn(zp(c,h),1)}function gne(c,h){return Vn(zp(c,h),x)}function mne(c,h,w){return w=w===r?1:ur(w),Vn(zp(c,h),w)}function xA(c,h){var w=sr(c)?ss:Da;return w(c,qt(h,3))}function _A(c,h){var w=sr(c)?LQ:b9;return w(c,qt(h,3))}var vne=Np(function(c,h,w){Tr.call(c,w)?c[w].push(h):zo(c,w,[h])});function bne(c,h,w,L){c=Si(c)?c:gf(c),w=w&&!L?ur(w):0;var K=c.length;return w<0&&(w=Pn(K+w,0)),Gp(c)?w<=K&&c.indexOf(h,w)>-1:!!K&&rf(c,h,w)>-1}var yne=hr(function(c,h,w){var L=-1,K=typeof h=="function",ne=Si(c)?Ce(c.length):[];return Da(c,function(he){ne[++L]=K?$n(h,he,w):Ah(he,h,w)}),ne}),wne=Np(function(c,h,w){zo(c,w,h)});function zp(c,h){var w=sr(c)?Xr:A9;return w(c,qt(h,3))}function xne(c,h,w,L){return c==null?[]:(sr(h)||(h=h==null?[]:[h]),w=L?r:w,sr(w)||(w=w==null?[]:[w]),C9(c,h,w))}var _ne=Np(function(c,h,w){c[w?0:1].push(h)},function(){return[[],[]]});function Ene(c,h,w){var L=sr(c)?Hb:Q7,K=arguments.length<3;return L(c,qt(h,4),w,K,Da)}function Sne(c,h,w){var L=sr(c)?kQ:Q7,K=arguments.length<3;return L(c,qt(h,4),w,K,b9)}function Ane(c,h){var w=sr(c)?Ia:y9;return w(c,Kp(qt(h,3)))}function Pne(c){var h=sr(c)?p9:bte;return h(c)}function Mne(c,h,w){(w?ci(c,h,w):h===r)?h=1:h=ur(h);var L=sr(c)?Yee:yte;return L(c,h)}function Ine(c){var h=sr(c)?Jee:xte;return h(c)}function Cne(c){if(c==null)return 0;if(Si(c))return Gp(c)?sf(c):c.length;var h=ti(c);return h==ie||h==Ie?c.size:uy(c).length}function Tne(c,h,w){var L=sr(c)?Wb:_te;return w&&ci(c,h,w)&&(h=r),L(c,qt(h,3))}var Rne=hr(function(c,h){if(c==null)return[];var w=h.length;return w>1&&ci(c,h[0],h[1])?h=[]:w>2&&ci(h[0],h[1],h[2])&&(h=[h[0]]),C9(c,Vn(h,1),[])}),Hp=lee||function(){return _r.Date.now()};function Dne(c,h){if(typeof h!="function")throw new os(o);return c=ur(c),function(){if(--c<1)return h.apply(this,arguments)}}function EA(c,h,w){return h=w?r:h,h=c&&h==null?c.length:h,Ho(c,T,r,r,r,r,h)}function SA(c,h){var w;if(typeof h!="function")throw new os(o);return c=ur(c),function(){return--c>0&&(w=h.apply(this,arguments)),c<=1&&(h=r),w}}var Oy=hr(function(c,h,w){var L=D;if(w.length){var K=Ta(w,df(Oy));L|=H}return Ho(c,L,h,w,K)}),AA=hr(function(c,h,w){var L=D|k;if(w.length){var K=Ta(w,df(AA));L|=H}return Ho(h,L,c,w,K)});function PA(c,h,w){h=w?r:h;var L=Ho(c,q,r,r,r,r,r,h);return L.placeholder=PA.placeholder,L}function MA(c,h,w){h=w?r:h;var L=Ho(c,j,r,r,r,r,r,h);return L.placeholder=MA.placeholder,L}function IA(c,h,w){var L,K,ne,he,me,we,We=0,Ke=!1,Ze=!1,xt=!0;if(typeof c!="function")throw new os(o);h=ls(h)||0,Qr(w)&&(Ke=!!w.leading,Ze="maxWait"in w,ne=Ze?Pn(ls(w.maxWait)||0,h):ne,xt="trailing"in w?!!w.trailing:xt);function Nt(vn){var Ts=L,Yo=K;return L=K=r,We=vn,he=c.apply(Yo,Ts),he}function Vt(vn){return We=vn,me=Th(br,h),Ke?Nt(vn):he}function fr(vn){var Ts=vn-we,Yo=vn-We,VA=h-Ts;return Ze?ei(VA,ne-Yo):VA}function Gt(vn){var Ts=vn-we,Yo=vn-We;return we===r||Ts>=h||Ts<0||Ze&&Yo>=ne}function br(){var vn=Hp();if(Gt(vn))return Er(vn);me=Th(br,fr(vn))}function Er(vn){return me=r,xt&&L?Nt(vn):(L=K=r,he)}function $i(){me!==r&&$9(me),We=0,L=we=K=me=r}function ui(){return me===r?he:Er(Hp())}function Fi(){var vn=Hp(),Ts=Gt(vn);if(L=arguments,K=this,we=vn,Ts){if(me===r)return Vt(we);if(Ze)return $9(me),me=Th(br,h),Nt(we)}return me===r&&(me=Th(br,h)),he}return Fi.cancel=$i,Fi.flush=ui,Fi}var One=hr(function(c,h){return v9(c,1,h)}),Nne=hr(function(c,h,w){return v9(c,ls(h)||0,w)});function Lne(c){return Ho(c,ue)}function Wp(c,h){if(typeof c!="function"||h!=null&&typeof h!="function")throw new os(o);var w=function(){var L=arguments,K=h?h.apply(this,L):L[0],ne=w.cache;if(ne.has(K))return ne.get(K);var he=c.apply(this,L);return w.cache=ne.set(K,he)||ne,he};return w.cache=new(Wp.Cache||qo),w}Wp.Cache=qo;function Kp(c){if(typeof c!="function")throw new os(o);return function(){var h=arguments;switch(h.length){case 0:return!c.call(this);case 1:return!c.call(this,h[0]);case 2:return!c.call(this,h[0],h[1]);case 3:return!c.call(this,h[0],h[1],h[2])}return!c.apply(this,h)}}function kne(c){return SA(2,c)}var Bne=Ete(function(c,h){h=h.length==1&&sr(h[0])?Xr(h[0],Li(qt())):Xr(Vn(h,1),Li(qt()));var w=h.length;return hr(function(L){for(var K=-1,ne=ei(L.length,w);++K=h}),Lc=_9(function(){return arguments}())?_9:function(c){return rn(c)&&Tr.call(c,"callee")&&!c9.call(c,"callee")},sr=Ce.isArray,Zne=oi?Li(oi):ote;function Si(c){return c!=null&&Vp(c.length)&&!Vo(c)}function mn(c){return rn(c)&&Si(c)}function Qne(c){return c===!0||c===!1||rn(c)&&ai(c)==X}var ka=dee||Wy,eie=Ps?Li(Ps):ate;function tie(c){return rn(c)&&c.nodeType===1&&!Rh(c)}function rie(c){if(c==null)return!0;if(Si(c)&&(sr(c)||typeof c=="string"||typeof c.splice=="function"||ka(c)||pf(c)||Lc(c)))return!c.length;var h=ti(c);if(h==ie||h==Ie)return!c.size;if(Ch(c))return!uy(c).length;for(var w in c)if(Tr.call(c,w))return!1;return!0}function nie(c,h){return Ph(c,h)}function iie(c,h,w){w=typeof w=="function"?w:r;var L=w?w(c,h):r;return L===r?Ph(c,h,r,w):!!L}function Ly(c){if(!rn(c))return!1;var h=ai(c);return h==Z||h==R||typeof c.message=="string"&&typeof c.name=="string"&&!Rh(c)}function sie(c){return typeof c=="number"&&f9(c)}function Vo(c){if(!Qr(c))return!1;var h=ai(c);return h==te||h==le||h==ee||h==Te}function TA(c){return typeof c=="number"&&c==ur(c)}function Vp(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=_}function Qr(c){var h=typeof c;return c!=null&&(h=="object"||h=="function")}function rn(c){return c!=null&&typeof c=="object"}var RA=is?Li(is):ute;function oie(c,h){return c===h||cy(c,h,Ay(h))}function aie(c,h,w){return w=typeof w=="function"?w:r,cy(c,h,Ay(h),w)}function cie(c){return DA(c)&&c!=+c}function uie(c){if(Kte(c))throw new tr(s);return E9(c)}function fie(c){return c===null}function lie(c){return c==null}function DA(c){return typeof c=="number"||rn(c)&&ai(c)==fe}function Rh(c){if(!rn(c)||ai(c)!=Me)return!1;var h=wp(c);if(h===null)return!0;var w=Tr.call(h,"constructor")&&h.constructor;return typeof w=="function"&&w instanceof w&&mp.call(w)==aee}var ky=ro?Li(ro):fte;function hie(c){return TA(c)&&c>=-_&&c<=_}var OA=mh?Li(mh):lte;function Gp(c){return typeof c=="string"||!sr(c)&&rn(c)&&ai(c)==Le}function Bi(c){return typeof c=="symbol"||rn(c)&&ai(c)==Ve}var pf=Mc?Li(Mc):hte;function die(c){return c===r}function pie(c){return rn(c)&&ti(c)==ze}function gie(c){return rn(c)&&ai(c)==He}var mie=$p(fy),vie=$p(function(c,h){return c<=h});function NA(c){if(!c)return[];if(Si(c))return Gp(c)?Ms(c):Ei(c);if(bh&&c[bh])return YQ(c[bh]());var h=ti(c),w=h==ie?Xb:h==Ie?dp:gf;return w(c)}function Go(c){if(!c)return c===0?c:0;if(c=ls(c),c===x||c===-x){var h=c<0?-1:1;return h*S}return c===c?c:0}function ur(c){var h=Go(c),w=h%1;return h===h?w?h-w:h:0}function LA(c){return c?Rc(ur(c),0,M):0}function ls(c){if(typeof c=="number")return c;if(Bi(c))return b;if(Qr(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=Qr(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=e9(c);var w=it.test(c);return w||gt.test(c)?ir(c.slice(2),w?2:8):De.test(c)?b:+c}function kA(c){return io(c,Ai(c))}function bie(c){return c?Rc(ur(c),-_,_):c===0?c:0}function Cr(c){return c==null?"":ki(c)}var yie=lf(function(c,h){if(Ch(h)||Si(h)){io(h,Fn(h),c);return}for(var w in h)Tr.call(h,w)&&Eh(c,w,h[w])}),BA=lf(function(c,h){io(h,Ai(h),c)}),Yp=lf(function(c,h,w,L){io(h,Ai(h),c,L)}),wie=lf(function(c,h,w,L){io(h,Fn(h),c,L)}),xie=Wo(ny);function _ie(c,h){var w=ff(c);return h==null?w:g9(w,h)}var Eie=hr(function(c,h){c=qr(c);var w=-1,L=h.length,K=L>2?h[2]:r;for(K&&ci(h[0],h[1],K)&&(L=1);++w1),ne}),io(c,Ey(c),w),L&&(w=cs(w,p|y|A,Nte));for(var K=h.length;K--;)gy(w,h[K]);return w});function Uie(c,h){return FA(c,Kp(qt(h)))}var qie=Wo(function(c,h){return c==null?{}:gte(c,h)});function FA(c,h){if(c==null)return{};var w=Xr(Ey(c),function(L){return[L]});return h=qt(h),T9(c,w,function(L,K){return h(L,K[0])})}function zie(c,h,w){h=Na(h,c);var L=-1,K=h.length;for(K||(K=1,c=r);++Lh){var L=c;c=h,h=L}if(w||c%1||h%1){var K=l9();return ei(c+K*(h-c+jr("1e-"+((K+"").length-1))),h)}return hy(c,h)}var ese=hf(function(c,h,w){return h=h.toLowerCase(),c+(w?qA(h):h)});function qA(c){return Fy(Cr(c).toLowerCase())}function zA(c){return c=Cr(c),c&&c.replace(tt,HQ).replace(Ub,"")}function tse(c,h,w){c=Cr(c),h=ki(h);var L=c.length;w=w===r?L:Rc(ur(w),0,L);var K=w;return w-=h.length,w>=0&&c.slice(w,K)==h}function rse(c){return c=Cr(c),c&&Tt.test(c)?c.replace(Ot,WQ):c}function nse(c){return c=Cr(c),c&&Ft.test(c)?c.replace(nt,"\\$&"):c}var ise=hf(function(c,h,w){return c+(w?"-":"")+h.toLowerCase()}),sse=hf(function(c,h,w){return c+(w?" ":"")+h.toLowerCase()}),ose=K9("toLowerCase");function ase(c,h,w){c=Cr(c),h=ur(h);var L=h?sf(c):0;if(!h||L>=h)return c;var K=(h-L)/2;return Bp(Sp(K),w)+c+Bp(Ep(K),w)}function cse(c,h,w){c=Cr(c),h=ur(h);var L=h?sf(c):0;return h&&L>>0,w?(c=Cr(c),c&&(typeof h=="string"||h!=null&&!ky(h))&&(h=ki(h),!h&&nf(c))?La(Ms(c),0,w):c.split(h,w)):[]}var gse=hf(function(c,h,w){return c+(w?" ":"")+Fy(h)});function mse(c,h,w){return c=Cr(c),w=w==null?0:Rc(ur(w),0,c.length),h=ki(h),c.slice(w,w+h.length)==h}function vse(c,h,w){var L=re.templateSettings;w&&ci(c,h,w)&&(h=r),c=Cr(c),h=Yp({},h,L,Q9);var K=Yp({},h.imports,L.imports,Q9),ne=Fn(K),he=Jb(K,ne),me,we,We=0,Ke=h.interpolate||At,Ze="__p += '",xt=Zb((h.escape||At).source+"|"+Ke.source+"|"+(Ke===Lt?xe:At).source+"|"+(h.evaluate||At).source+"|$","g"),Nt="//# sourceURL="+(Tr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++qb+"]")+` +`;c.replace(xt,function(Gt,br,Er,$i,ui,Fi){return Er||(Er=$i),Ze+=c.slice(We,Fi).replace(Rt,KQ),br&&(me=!0,Ze+=`' + __e(`+br+`) + '`),ui&&(we=!0,Ze+=`'; `+ui+`; @@ -104,19 +104,19 @@ __p += '`),Er&&(Ze+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+Ze+`return __p -}`;var fr=WA(function(){return Mr(ne,Nt+"return "+Ze).apply(r,he)});if(fr.source=Ze,ky(fr))throw fr;return fr}function vse(c){return Cr(c).toLowerCase()}function bse(c){return Cr(c).toUpperCase()}function yse(c,h,w){if(c=Cr(c),c&&(w||h===r))return e9(c);if(!c||!(h=ki(h)))return c;var L=Ms(c),K=Ms(h),ne=t9(L,K),he=r9(L,K)+1;return La(L,ne,he).join("")}function wse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.slice(0,i9(c)+1);if(!c||!(h=ki(h)))return c;var L=Ms(c),K=r9(L,Ms(h))+1;return La(L,0,K).join("")}function xse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.replace($,"");if(!c||!(h=ki(h)))return c;var L=Ms(c),K=t9(L,Ms(h));return La(L,K).join("")}function _se(c,h){var w=_e,L=G;if(Qr(h)){var K="separator"in h?h.separator:K;w="length"in h?ur(h.length):w,L="omission"in h?ki(h.omission):L}c=Cr(c);var ne=c.length;if(nf(c)){var he=Ms(c);ne=he.length}if(w>=ne)return c;var me=w-sf(L);if(me<1)return L;var we=he?La(he,0,me).join(""):c.slice(0,me);if(K===r)return we+L;if(he&&(me+=we.length-me),By(K)){if(c.slice(me).search(K)){var We,Ke=we;for(K.global||(K=Qb(K.source,Cr(Re.exec(K))+"g")),K.lastIndex=0;We=K.exec(Ke);)var Ze=We.index;we=we.slice(0,Ze===r?me:Ze)}}else if(c.indexOf(ki(K),me)!=me){var xt=we.lastIndexOf(K);xt>-1&&(we=we.slice(0,xt))}return we+L}function Ese(c){return c=Cr(c),c&&Bt.test(c)?c.replace(Xt,ZQ):c}var Sse=hf(function(c,h,w){return c+(w?" ":"")+h.toUpperCase()}),jy=K9("toUpperCase");function HA(c,h,w){return c=Cr(c),h=w?r:h,h===r?VQ(c)?tee(c):$Q(c):c.match(h)||[]}var WA=hr(function(c,h){try{return $n(c,r,h)}catch(w){return ky(w)?w:new tr(w)}}),Ase=Wo(function(c,h){return ss(h,function(w){w=so(w),zo(c,w,Ny(c[w],c))}),c});function Pse(c){var h=c==null?0:c.length,w=qt();return c=h?Xr(c,function(L){if(typeof L[1]!="function")throw new os(o);return[w(L[0]),L[1]]}):[],hr(function(L){for(var K=-1;++K_)return[];var w=M,L=ei(c,M);h=qt(h),c-=M;for(var K=Jb(L,h);++w0||h<0)?new xr(w):(c<0?w=w.takeRight(-c):c&&(w=w.drop(c)),h!==r&&(h=ur(h),w=h<0?w.dropRight(-h):w.take(h-c)),w)},xr.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},xr.prototype.toArray=function(){return this.take(M)},no(xr.prototype,function(c,h){var w=/^(?:filter|find|map|reject)|While$/.test(h),L=/^(?:head|last)$/.test(h),K=re[L?"take"+(h=="last"?"Right":""):h],ne=L||/^find/.test(h);K&&(re.prototype[h]=function(){var he=this.__wrapped__,me=L?[1]:arguments,we=he instanceof xr,We=me[0],Ke=we||sr(he),Ze=function(br){var Er=K.apply(re,Ca([br],me));return L&&xt?Er[0]:Er};Ke&&w&&typeof We=="function"&&We.length!=1&&(we=Ke=!1);var xt=this.__chain__,Nt=!!this.__actions__.length,Vt=ne&&!xt,fr=we&&!Nt;if(!ne&&Ke){he=fr?he:new xr(this);var Gt=c.apply(he,me);return Gt.__actions__.push({func:qp,args:[Ze],thisArg:r}),new as(Gt,xt)}return Vt&&fr?c.apply(this,me):(Gt=this.thru(Ze),Vt?L?Gt.value()[0]:Gt.value():Gt)})}),ss(["pop","push","shift","sort","splice","unshift"],function(c){var h=pp[c],w=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",L=/^(?:pop|shift)$/.test(c);re.prototype[c]=function(){var K=arguments;if(L&&!this.__chain__){var ne=this.value();return h.apply(sr(ne)?ne:[],K)}return this[w](function(he){return h.apply(sr(he)?he:[],K)})}}),no(xr.prototype,function(c,h){var w=re[h];if(w){var L=w.name+"";Tr.call(uf,L)||(uf[L]=[]),uf[L].push({name:h,func:w})}}),uf[Lp(r,k).name]=[{name:"wrapper",func:r}],xr.prototype.clone=Eee,xr.prototype.reverse=See,xr.prototype.value=Aee,re.prototype.at=ene,re.prototype.chain=tne,re.prototype.commit=rne,re.prototype.next=nne,re.prototype.plant=sne,re.prototype.reverse=one,re.prototype.toJSON=re.prototype.valueOf=re.prototype.value=ane,re.prototype.first=re.prototype.head,bh&&(re.prototype[bh]=ine),re},of=ree();gn?((gn.exports=of)._=of,Ur._=of):_r._=of}).call(nn)}(e0,e0.exports);var Pq=e0.exports,P1={exports:{}};(function(t,e){var r=typeof self<"u"?self:nn,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function u(f){return f&&DataView.prototype.isPrototypeOf(f)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(f){return f&&l.indexOf(Object.prototype.toString.call(f))>-1};function p(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function y(f){return typeof f!="string"&&(f=String(f)),f}function A(f){var g={next:function(){var v=f.shift();return{done:v===void 0,value:v}}};return a.iterable&&(g[Symbol.iterator]=function(){return g}),g}function P(f){this.map={},f instanceof P?f.forEach(function(g,v){this.append(v,g)},this):Array.isArray(f)?f.forEach(function(g){this.append(g[0],g[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(g){this.append(g,f[g])},this)}P.prototype.append=function(f,g){f=p(f),g=y(g);var v=this.map[f];this.map[f]=v?v+", "+g:g},P.prototype.delete=function(f){delete this.map[p(f)]},P.prototype.get=function(f){return f=p(f),this.has(f)?this.map[f]:null},P.prototype.has=function(f){return this.map.hasOwnProperty(p(f))},P.prototype.set=function(f,g){this.map[p(f)]=y(g)},P.prototype.forEach=function(f,g){for(var v in this.map)this.map.hasOwnProperty(v)&&f.call(g,this.map[v],v,this)},P.prototype.keys=function(){var f=[];return this.forEach(function(g,v){f.push(v)}),A(f)},P.prototype.values=function(){var f=[];return this.forEach(function(g){f.push(g)}),A(f)},P.prototype.entries=function(){var f=[];return this.forEach(function(g,v){f.push([v,g])}),A(f)},a.iterable&&(P.prototype[Symbol.iterator]=P.prototype.entries);function N(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function D(f){return new Promise(function(g,v){f.onload=function(){g(f.result)},f.onerror=function(){v(f.error)}})}function k(f){var g=new FileReader,v=D(g);return g.readAsArrayBuffer(f),v}function B(f){var g=new FileReader,v=D(g);return g.readAsText(f),v}function q(f){for(var g=new Uint8Array(f),v=new Array(g.length),x=0;x-1?g:f}function z(f,g){g=g||{};var v=g.body;if(f instanceof z){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,g.headers||(this.headers=new P(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!v&&f._bodyInit!=null&&(v=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=g.credentials||this.credentials||"same-origin",(g.headers||!this.headers)&&(this.headers=new P(g.headers)),this.method=T(g.method||this.method||"GET"),this.mode=g.mode||this.mode||null,this.signal=g.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(v)}z.prototype.clone=function(){return new z(this,{body:this._bodyInit})};function ue(f){var g=new FormData;return f.trim().split("&").forEach(function(v){if(v){var x=v.split("="),_=x.shift().replace(/\+/g," "),S=x.join("=").replace(/\+/g," ");g.append(decodeURIComponent(_),decodeURIComponent(S))}}),g}function _e(f){var g=new P,v=f.replace(/\r?\n[\t ]+/g," ");return v.split(/\r?\n/).forEach(function(x){var _=x.split(":"),S=_.shift().trim();if(S){var b=_.join(":").trim();g.append(S,b)}}),g}H.call(z.prototype);function G(f,g){g||(g={}),this.type="default",this.status=g.status===void 0?200:g.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in g?g.statusText:"OK",this.headers=new P(g.headers),this.url=g.url||"",this._initBody(f)}H.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new P(this.headers),url:this.url})},G.error=function(){var f=new G(null,{status:0,statusText:""});return f.type="error",f};var E=[301,302,303,307,308];G.redirect=function(f,g){if(E.indexOf(g)===-1)throw new RangeError("Invalid status code");return new G(null,{status:g,headers:{location:f}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(g,v){this.message=g,this.name=v;var x=Error(g);this.stack=x.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function m(f,g){return new Promise(function(v,x){var _=new z(f,g);if(_.signal&&_.signal.aborted)return x(new o.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function b(){S.abort()}S.onload=function(){var M={status:S.status,statusText:S.statusText,headers:_e(S.getAllResponseHeaders()||"")};M.url="responseURL"in S?S.responseURL:M.headers.get("X-Request-URL");var I="response"in S?S.response:S.responseText;v(new G(I,M))},S.onerror=function(){x(new TypeError("Network request failed"))},S.ontimeout=function(){x(new TypeError("Network request failed"))},S.onabort=function(){x(new o.DOMException("Aborted","AbortError"))},S.open(_.method,_.url,!0),_.credentials==="include"?S.withCredentials=!0:_.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&a.blob&&(S.responseType="blob"),_.headers.forEach(function(M,I){S.setRequestHeader(I,M)}),_.signal&&(_.signal.addEventListener("abort",b),S.onreadystatechange=function(){S.readyState===4&&_.signal.removeEventListener("abort",b)}),S.send(typeof _._bodyInit>"u"?null:_._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=P,s.Request=z,s.Response=G),o.Headers=P,o.Request=z,o.Response=G,o.fetch=m,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(P1,P1.exports);var Mq=P1.exports;const O6=ji(Mq);var Iq=Object.defineProperty,Cq=Object.defineProperties,Tq=Object.getOwnPropertyDescriptors,N6=Object.getOwnPropertySymbols,Rq=Object.prototype.hasOwnProperty,Dq=Object.prototype.propertyIsEnumerable,L6=(t,e,r)=>e in t?Iq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,k6=(t,e)=>{for(var r in e||(e={}))Rq.call(e,r)&&L6(t,r,e[r]);if(N6)for(var r of N6(e))Dq.call(e,r)&&L6(t,r,e[r]);return t},B6=(t,e)=>Cq(t,Tq(e));const Oq={Accept:"application/json","Content-Type":"application/json"},Nq="POST",$6={headers:Oq,method:Nq},F6=10;let xs=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new qi.EventEmitter,this.isAvailable=!1,this.registering=!1,!$_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=mo(e),n=await(await O6(this.url,B6(k6({},$6),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!$_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=mo({id:1,jsonrpc:"2.0",method:"test",params:[]});await O6(e,B6(k6({},$6),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ka(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return O_(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>F6&&this.events.setMaxListeners(F6)}};const j6="error",Lq="wss://relay.walletconnect.org",kq="wc",Bq="universal_provider",U6=`${kq}@2:${Bq}:`,q6="https://rpc.walletconnect.org/v1/",Cu="generic",$q=`${q6}bundler`,Qi={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Fq=Object.defineProperty,jq=Object.defineProperties,Uq=Object.getOwnPropertyDescriptors,z6=Object.getOwnPropertySymbols,qq=Object.prototype.hasOwnProperty,zq=Object.prototype.propertyIsEnumerable,H6=(t,e,r)=>e in t?Fq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,t0=(t,e)=>{for(var r in e||(e={}))qq.call(e,r)&&H6(t,r,e[r]);if(z6)for(var r of z6(e))zq.call(e,r)&&H6(t,r,e[r]);return t},Hq=(t,e)=>jq(t,Uq(e));function Di(t,e,r){var n;const i=Su(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${q6}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function fc(t){return t.includes(":")?t.split(":")[1]:t}function W6(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Wq(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function M1(t={},e={}){const r=K6(t),n=K6(e);return Pq.merge(r,n)}function K6(t){var e,r,n,i;const s={};if(!Sl(t))return s;for(const[o,a]of Object.entries(t)){const u=f1(o)?[o]:a.chains,l=a.methods||[],d=a.events||[],p=a.rpcMap||{},y=El(o);s[y]=Hq(t0(t0({},s[y]),a),{chains:Ud(u,(e=s[y])==null?void 0:e.chains),methods:Ud(l,(r=s[y])==null?void 0:r.methods),events:Ud(d,(n=s[y])==null?void 0:n.events),rpcMap:t0(t0({},p),(i=s[y])==null?void 0:i.rpcMap)})}return s}function Kq(t){return t.includes(":")?t.split(":")[2]:t}function V6(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=f1(r)?[r]:n.chains?n.chains:W6(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function I1(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const G6={},Ar=t=>G6[t],C1=(t,e)=>{G6[t]=e};class Vq{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}var Gq=Object.defineProperty,Yq=Object.defineProperties,Jq=Object.getOwnPropertyDescriptors,Y6=Object.getOwnPropertySymbols,Xq=Object.prototype.hasOwnProperty,Zq=Object.prototype.propertyIsEnumerable,J6=(t,e,r)=>e in t?Gq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,X6=(t,e)=>{for(var r in e||(e={}))Xq.call(e,r)&&J6(t,r,e[r]);if(Y6)for(var r of Y6(e))Zq.call(e,r)&&J6(t,r,e[r]);return t},Z6=(t,e)=>Yq(t,Jq(e));class Qq{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(fc(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const u=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:Z6(X6({},o.sessionProperties||{}),{capabilities:Z6(X6({},a||{}),{[s]:u})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return u}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(da("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${$q}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class ez{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}let tz=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}},rz=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ji(new xs(n,Ar("disableProviderPing")))}},nz=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=fc(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}},iz=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}};class sz{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}let oz=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new xs(n,Ar("disableProviderPing")))}};class az{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new xs(n))}}class cz{constructor(e){this.name=Cu,this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=Su(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}var uz=Object.defineProperty,fz=Object.defineProperties,lz=Object.getOwnPropertyDescriptors,Q6=Object.getOwnPropertySymbols,hz=Object.prototype.hasOwnProperty,dz=Object.prototype.propertyIsEnumerable,e5=(t,e,r)=>e in t?uz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,r0=(t,e)=>{for(var r in e||(e={}))hz.call(e,r)&&e5(t,r,e[r]);if(Q6)for(var r of Q6(e))dz.call(e,r)&&e5(t,r,e[r]);return t},T1=(t,e)=>fz(t,lz(e));let R1=class YA{constructor(e){this.events=new Yg,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||j6})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new YA(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:r0({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,Vd(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Dr("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=V6(this.session.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=V6(s.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==T6)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Cu?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(ic(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await A1.init({core:this.providerOpts.core,logger:this.providerOpts.logger||j6,relayUrl:this.providerOpts.relayUrl||Lq,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>El(r)))];C1("client",this.client),C1("events",this.events),C1("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Wq(r,this.session),i=W6(n),s=M1(this.namespaces,this.optionalNamespaces),o=T1(r0({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new Qq({namespace:o});break;case"algorand":this.rpcProviders[r]=new rz({namespace:o});break;case"solana":this.rpcProviders[r]=new ez({namespace:o});break;case"cosmos":this.rpcProviders[r]=new tz({namespace:o});break;case"polkadot":this.rpcProviders[r]=new Vq({namespace:o});break;case"cip34":this.rpcProviders[r]=new nz({namespace:o});break;case"elrond":this.rpcProviders[r]=new iz({namespace:o});break;case"multiversx":this.rpcProviders[r]=new sz({namespace:o});break;case"near":this.rpcProviders[r]=new oz({namespace:o});break;case"tezos":this.rpcProviders[r]=new az({namespace:o});break;default:this.rpcProviders[Cu]?this.rpcProviders[Cu].updateNamespace(o):this.rpcProviders[Cu]=new cz({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&ic(i)&&this.events.emit("accountsChanged",i.map(Kq))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=El(i),a=I1(i)!==I1(s)?`${o}:${I1(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=T1(r0({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",T1(r0({},Dr("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Qi.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Cu]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>El(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=El(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${U6}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${U6}/${e}`)}};const pz=R1;function gz(){return new Promise(t=>{const e=[];let r;window.addEventListener("eip6963:announceProvider",n=>{const{detail:i}=n;r&&clearTimeout(r),e.push(i),r=setTimeout(()=>t(e),200)}),r=setTimeout(()=>t(e),200),window.dispatchEvent(new Event("eip6963:requestProvider"))})}class Ys{constructor(e,r){this.scope=e,this.module=r}storeObject(e,r){this.setItem(e,JSON.stringify(r))}loadObject(e){const r=this.getItem(e);return r?JSON.parse(r):void 0}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new Ys("CBWSDK").clear(),new Ys("walletlink").clear()}}const cn={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},D1={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},t5="Unspecified error message.",mz="Unspecified server error.";function O1(t,e=t5){if(t&&Number.isInteger(t)){const r=t.toString();if(N1(D1,r))return D1[r].message;if(r5(t))return mz}return e}function vz(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(D1[e]||r5(t))}function bz(t,{shouldIncludeStack:e=!1}={}){const r={};if(t&&typeof t=="object"&&!Array.isArray(t)&&N1(t,"code")&&vz(t.code)){const n=t;r.code=n.code,n.message&&typeof n.message=="string"?(r.message=n.message,N1(n,"data")&&(r.data=n.data)):(r.message=O1(r.code),r.data={originalError:n5(t)})}else r.code=cn.rpc.internal,r.message=i5(t,"message")?t.message:t5,r.data={originalError:n5(t)};return e&&(r.stack=i5(t,"stack")?t.stack:void 0),r}function r5(t){return t>=-32099&&t<=-32e3}function n5(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function N1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function i5(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const Sr={rpc:{parse:t=>es(cn.rpc.parse,t),invalidRequest:t=>es(cn.rpc.invalidRequest,t),invalidParams:t=>es(cn.rpc.invalidParams,t),methodNotFound:t=>es(cn.rpc.methodNotFound,t),internal:t=>es(cn.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return es(e,t)},invalidInput:t=>es(cn.rpc.invalidInput,t),resourceNotFound:t=>es(cn.rpc.resourceNotFound,t),resourceUnavailable:t=>es(cn.rpc.resourceUnavailable,t),transactionRejected:t=>es(cn.rpc.transactionRejected,t),methodNotSupported:t=>es(cn.rpc.methodNotSupported,t),limitExceeded:t=>es(cn.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Tu(cn.provider.userRejectedRequest,t),unauthorized:t=>Tu(cn.provider.unauthorized,t),unsupportedMethod:t=>Tu(cn.provider.unsupportedMethod,t),disconnected:t=>Tu(cn.provider.disconnected,t),chainDisconnected:t=>Tu(cn.provider.chainDisconnected,t),unsupportedChain:t=>Tu(cn.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new a5(e,r,n)}}};function es(t,e){const[r,n]=s5(e);return new o5(t,r||O1(t),n)}function Tu(t,e){const[r,n]=s5(e);return new a5(t,r||O1(t),n)}function s5(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}class o5 extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}}class a5 extends o5{constructor(e,r,n){if(!yz(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}function yz(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function L1(){return t=>t}const Ol=L1(),wz=L1(),xz=L1();function Co(t){return Math.floor(t)}const c5=/^[0-9]*$/,u5=/^[a-f0-9]*$/;function lc(t){return k1(crypto.getRandomValues(new Uint8Array(t)))}function k1(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function n0(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function Nl(t,e=!1){const r=t.toString("hex");return Ol(e?`0x${r}`:r)}function B1(t){return Nl(j1(t),!0)}function Js(t){return xz(t.toString(10))}function pa(t){return Ol(`0x${BigInt(t).toString(16)}`)}function f5(t){return t.startsWith("0x")||t.startsWith("0X")}function $1(t){return f5(t)?t.slice(2):t}function l5(t){return f5(t)?`0x${t.slice(2)}`:`0x${t}`}function i0(t){if(typeof t!="string")return!1;const e=$1(t).toLowerCase();return u5.test(e)}function _z(t,e=!1){if(typeof t=="string"){const r=$1(t).toLowerCase();if(u5.test(r))return Ol(e?`0x${r}`:r)}throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function F1(t,e=!1){let r=_z(t,!1);return r.length%2===1&&(r=Ol(`0${r}`)),e?Ol(`0x${r}`):r}function ga(t){if(typeof t=="string"){const e=$1(t).toLowerCase();if(i0(e)&&e.length===40)return wz(l5(e))}throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function j1(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(i0(t)){const e=F1(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Sr.rpc.invalidParams(`Not binary data: ${String(t)}`)}function Ll(t){if(typeof t=="number"&&Number.isInteger(t))return Co(t);if(typeof t=="string"){if(c5.test(t))return Co(Number(t));if(i0(t))return Co(Number(BigInt(F1(t,!0))))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function kl(t){if(t!==null&&(typeof t=="bigint"||Sz(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(Ll(t));if(typeof t=="string"){if(c5.test(t))return BigInt(t);if(i0(t))return BigInt(F1(t,!0))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function Ez(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Sr.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function Sz(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function Az(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function Pz(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Mz(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,new TextEncoder().encode(e));return{iv:r,cipherText:n}}async function Iz(t,{iv:e,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return new TextDecoder().decode(n)}function h5(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function d5(t,e){const r=h5(t),n=await crypto.subtle.exportKey(r,e);return k1(new Uint8Array(n))}async function p5(t,e){const r=h5(t),n=n0(e).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function Cz(t,e){const r=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return Mz(e,r)}async function Tz(t,e){return JSON.parse(await Iz(e,t))}const U1={storageKey:"ownPrivateKey",keyType:"private"},q1={storageKey:"ownPublicKey",keyType:"public"},z1={storageKey:"peerPublicKey",keyType:"public"};class Rz{constructor(){this.storage=new Ys("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(z1,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(q1.storageKey),this.storage.removeItem(U1.storageKey),this.storage.removeItem(z1.storageKey)}async generateKeyPair(){const e=await Az();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(U1,e.privateKey),await this.storeKey(q1,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(U1)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(q1)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(z1)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await Pz(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const r=this.storage.getItem(e.storageKey);return r?p5(e.keyType,r):null}async storeKey(e,r){const n=await d5(e.keyType,r);this.storage.setItem(e.storageKey,n)}}const Bl="4.2.4",g5="@coinbase/wallet-sdk";async function m5(t,e){const r=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":Bl,"X-Cbw-Sdk-Platform":g5}}),{result:i,error:s}=await n.json();if(s)throw s;return i}function Dz(){return globalThis.coinbaseWalletExtension}function Oz(){var t,e;try{const r=globalThis;return(t=r.ethereum)!==null&&t!==void 0?t:(e=r.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Nz({metadata:t,preference:e}){var r,n;const{appName:i,appLogoUrl:s,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const u=Dz();if(u)return(r=u.setAppInfo)===null||r===void 0||r.call(u,i,s,o,e),u}const a=Oz();if(a!=null&&a.isCoinbaseBrowser)return(n=a.setAppInfo)===null||n===void 0||n.call(a,i,s,o,e),a}function Lz(t){if(!t||typeof t!="object"||Array.isArray(t))throw Sr.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:r}=t;if(typeof e!="string"||e.length===0)throw Sr.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Sr.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw Sr.provider.unsupportedMethod()}}const v5="accounts",b5="activeChain",y5="availableChains",w5="walletCapabilities";class kz{constructor(e){var r,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new Rz,this.storage=new Ys("CBWSDK","SCWStateManager"),this.accounts=(r=this.storage.loadObject(v5))!==null&&r!==void 0?r:[],this.chain=this.storage.loadObject(b5)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var r,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(r=e.params)!==null&&r!==void 0?r:{})}}),s=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in s.content)throw s.content.failure;const o=await p5("public",s.sender);await this.keyManager.setPeerPublicKey(o);const u=(await this.decryptResponseMessage(s)).result;if("error"in u)throw u.error;const l=u.value;this.accounts=l,this.storage.storeObject(v5,l),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",l)}async request(e){var r;if(this.accounts.length===0)throw Sr.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:pa(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return pa(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(w5);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return m5(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var r,n;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const i=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(i)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,r;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(r=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&r!==void 0?r:1}}async handleSwitchChainRequest(e){var r;const n=e.params;if(!n||!(!((r=n[0])===null||r===void 0)&&r.chainId))throw Sr.rpc.invalidParams();const i=Ll(n[0].chainId);if(this.updateChain(i))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(i),o}async sendEncryptedRequest(e){const r=await this.keyManager.getSharedSecret();if(!r)throw Sr.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await Cz({action:e,chainId:this.chain.id},r),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const r=await d5("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:r,content:e,timestamp:new Date}}async decryptResponseMessage(e){var r,n;const i=e.content;if("failure"in i)throw i.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw Sr.provider.unauthorized("Invalid session");const o=await Tz(i.encrypted,s),a=(r=o.data)===null||r===void 0?void 0:r.chains;if(a){const l=Object.entries(a).map(([d,p])=>({id:Number(d),rpcUrl:p}));this.storage.storeObject(y5,l),this.updateChain(this.chain.id,l)}const u=(n=o.data)===null||n===void 0?void 0:n.capabilities;return u&&this.storage.storeObject(w5,u),o}updateChain(e,r){var n;const i=r??this.storage.loadObject(y5),s=i==null?void 0:i.find(o=>o.id===e);return s?(s!==this.chain&&(this.chain=s,this.storage.storeObject(b5,s),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",pa(s.id))),!0):!1}}const Bz=Jp(tM),{keccak_256:$z}=Bz;function x5(t){return Buffer.allocUnsafe(t).fill(0)}function Fz(t){return t.toString(2).length}function _5(t,e){let r=t.toString(16);r.length%2!==0&&(r="0"+r);const n=r.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(r=C5(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(Xs(t,e[s]));if(r==="dynamic"){var o=Xs("uint256",e.length);i.unshift(o)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([Xs("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,si.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Ru(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return si.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Ru(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=hc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+a);if(n<0)throw new Error("Supplied uint is negative");return si.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(r=Ru(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=hc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied int exceeds width: "+r+" vs "+a);const u=si.twosFromBigInt(n,256);return si.bufferBEFromBigInt(u,32)}else if(t.startsWith("ufixed")){if(r=I5(t),n=hc(e),n<0)throw new Error("Supplied ufixed is negative");return Xs("uint256",n*BigInt(2)**BigInt(r[1]))}else if(t.startsWith("fixed"))return r=I5(t),Xs("int256",hc(e)*BigInt(2)**BigInt(r[1]))}throw new Error("Unsupported or invalid type: "+t)}function Wz(t){return t==="string"||t==="bytes"||C5(t)==="dynamic"}function Kz(t){return t.lastIndexOf("]")===t.length-1}function Vz(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var o=M5(t[s]),a=e[s],u=Xs(o,a);Wz(o)?(r.push(Xs("uint256",i)),n.push(u),i+=u.length):r.push(u)}return Buffer.concat(r.concat(n))}function T5(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(si.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=Ru(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=hc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+u);i.push(si.bufferBEFromBigInt(n,r/8))}else if(o.startsWith("int")){if(r=Ru(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=hc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied int exceeds width: "+r+" vs "+u);const l=si.twosFromBigInt(n,r);i.push(si.bufferBEFromBigInt(l,r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function Gz(t,e){return si.keccak(T5(t,e))}var Yz={rawEncode:Vz,solidityPack:T5,soliditySHA3:Gz};const _s=P5,$l=Yz,R5={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},H1={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const o=(a,u,l)=>{if(r[u]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":_s.keccak(this.encodeData(u,l,r,n))];if(l===void 0)throw new Error(`missing value for field ${a} of type ${u}`);if(u==="bytes")return["bytes32",_s.keccak(l)];if(u==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",_s.keccak(l)];if(u.lastIndexOf("]")===u.length-1){const d=u.slice(0,u.lastIndexOf("[")),p=l.map(y=>o(a,d,y));return["bytes32",_s.keccak($l.rawEncode(p.map(([y])=>y),p.map(([,y])=>y)))]}return[u,l]};for(const a of r[t]){const[u,l]=o(a.name,a.type,e[a.name]);i.push(u),s.push(l)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=_s.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=_s.keccak(a),s.push(a);else if(r[o.type]!==void 0)i.push("bytes32"),a=_s.keccak(this.encodeData(o.type,a,r,n)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return $l.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return _s.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return _s.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in R5.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),_s.keccak(Buffer.concat(n))}};var Jz={TYPED_MESSAGE_SCHEMA:R5,TypedDataUtils:H1,hashForSignTypedDataLegacy:function(t){return Xz(t.data)},hashForSignTypedData_v3:function(t){return H1.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return H1.hash(t.data)}};function Xz(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?_s.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return $l.soliditySHA3(["bytes32","bytes32"],[$l.soliditySHA3(new Array(t.length).fill("string"),i),$l.soliditySHA3(n,r)])}const o0=ji(Jz),Zz="walletUsername",W1="Addresses",Qz="AppVersion";function Hn(t){return t.errorMessage!==void 0}class eH{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),a=16,u=o.slice(o.byteLength-a),l=o.slice(0,o.byteLength-a),d=new Uint8Array(u),p=new Uint8Array(l),y=new Uint8Array([...n,...d,...p]);return k1(y)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=n0(e),a=o.slice(0,12),u=o.slice(12,28),l=o.slice(28),d=new Uint8Array([...l,...u]),p={name:"AES-GCM",iv:new Uint8Array(a)};try{const y=await window.crypto.subtle.decrypt(p,s,d),A=new TextDecoder;n(A.decode(y))}catch(y){i(y)}})()})}}class tH{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}var To;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(To||(To={}));class rH{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,To.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.DISCONNECTED)},i.onopen=s=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(u=>this.sendData(u)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const u=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,u)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,To.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const D5=1e4,nH=6e4;class iH{constructor({session:e,linkAPIUrl:r,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Co(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,u)=>{const l=s[u];l!==void 0&&a(l)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,u)},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(Zz,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(Qz,s)},this.handleChainUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(s),l=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(u,l)},this.session=e,this.cipher=new eH(e.secret),this.listener=n;const i=new rH(`${r}/rpc`,WebSocket);i.setConnectionStateListener(async s=>{let o=!1;switch(s){case To.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(u=>setTimeout(u,5e3)),this.destroyed||i.connect().catch(()=>{a()})};a()}break;case To.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},D5),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case To.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(s=>{var o;switch(s.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=s.type==="IsLinkedOK"?s.linked:void 0;this.linked=a||s.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(s.metadata);break}case"Event":{this.handleIncomingEvent(s);break}}s.id!==void 0&&((o=this.requestResolutions.get(s.id))===null||o===void 0||o(s))}),this.ws=i,this.http=new tH(r,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:s,response:o}=i;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s,o)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Co(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>D5*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r={timeout:nH}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r.timeout)}),new Promise(s=>{this.requestResolutions.set(n,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Co(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Co(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id}),!0)}}class sH{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=l5(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}const O5="session:id",N5="session:secret",L5="session:linked";class Du{constructor(e,r,n,i=!1){this.storage=e,this.id=r,this.secret=n,this.key=NP(Pg(`${r}, ${n} WalletLink`)),this._linked=!!i}static create(e){const r=lc(16),n=lc(32);return new Du(e,r,n).save()}static load(e){const r=e.getItem(O5),n=e.getItem(L5),i=e.getItem(N5);return r&&i?new Du(e,r,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(O5,this.id),this.storage.setItem(N5,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(L5,this._linked?"1":"0")}}function oH(){try{return window.frameElement!==null}catch{return!1}}function aH(){try{return oH()&&window.top?window.top.location:window.location}catch{return window.location}}function cH(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function k5(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const uH='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function B5(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(uH)),document.documentElement.appendChild(t)}function $5(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e2&&(o.children=arguments.length>3?a0.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return c0(t,o,n,i,null)}function c0(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++F5,__i:-1,__u:0};return i==null&&Vr.vnode!=null&&Vr.vnode(s),s}function Ul(t){return t.children}function u0(t,e){this.props=t,this.context=e}function Ou(t,e){if(e==null)return t.__?Ou(t.__,t.__i+1):null;for(var r;ee&&dc.sort(K1));f0.__r=0}function K5(t,e,r,n,i,s,o,a,u,l,d){var p,y,A,P,N,D,k=n&&n.__k||z5,B=e.length;for(u=lH(r,e,k,u),p=0;p0?c0(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,(u=s.__i=hH(s,r,a,p))!==-1&&(p--,(o=r[u])&&(o.__u|=2)),o==null||o.__v===null?(u==-1&&y--,typeof s.type!="function"&&(s.__u|=4)):u!==a&&(u==a-1?y--:u==a+1?y++:(u>a?y--:y++,s.__u|=4))):s=t.__k[i]=null;if(p)for(i=0;i(u!=null&&!(2&u.__u)?1:0))for(;o>=0||a=0){if((u=e[o])&&!(2&u.__u)&&i==u.key&&s===u.type)return o;o--}if(a=r.__.length&&r.__.push({}),r.__[t]}function a4(t){return rv=1,gH(u4,t)}function gH(t,e,r){var n=o4(h0++,2);if(n.t=t,!n.__c&&(n.__=[u4(void 0,e),function(a){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,a);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=un,!un.u)){var i=function(a,u,l){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(y){return!!y.__c});if(d.every(function(y){return!y.__N}))return!s||s.call(this,a,u,l);var p=n.__c.props!==a;return d.forEach(function(y){if(y.__N){var A=y.__[0];y.__=y.__N,y.__N=void 0,A!==y.__[0]&&(p=!0)}}),s&&s.call(this,a,u,l)||p};un.u=!0;var s=un.shouldComponentUpdate,o=un.componentWillUpdate;un.componentWillUpdate=function(a,u,l){if(this.__e){var d=s;s=void 0,i(a,u,l),s=d}o&&o.call(this,a,u,l)},un.shouldComponentUpdate=i}return n.__N||n.__}function mH(t,e){var r=o4(h0++,3);!yn.__s&&yH(r.__H,e)&&(r.__=t,r.i=e,un.__H.__h.push(r))}function vH(){for(var t;t=Q5.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(d0),t.__H.__h.forEach(nv),t.__H.__h=[]}catch(e){t.__H.__h=[],yn.__e(e,t.__v)}}yn.__b=function(t){un=null,e4&&e4(t)},yn.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),s4&&s4(t,e)},yn.__r=function(t){t4&&t4(t),h0=0;var e=(un=t.__c).__H;e&&(tv===un?(e.__h=[],un.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(d0),e.__h.forEach(nv),e.__h=[],h0=0)),tv=un},yn.diffed=function(t){r4&&r4(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Q5.push(e)!==1&&Z5===yn.requestAnimationFrame||((Z5=yn.requestAnimationFrame)||bH)(vH)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),tv=un=null},yn.__c=function(t,e){e.some(function(r){try{r.__h.forEach(d0),r.__h=r.__h.filter(function(n){return!n.__||nv(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],yn.__e(n,r.__v)}}),n4&&n4(t,e)},yn.unmount=function(t){i4&&i4(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{d0(n)}catch(i){e=i}}),r.__H=void 0,e&&yn.__e(e,r.__v))};var c4=typeof requestAnimationFrame=="function";function bH(t){var e,r=function(){clearTimeout(n),c4&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);c4&&(e=requestAnimationFrame(r))}function d0(t){var e=un,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),un=e}function nv(t){var e=un;t.__c=t.__(),un=e}function yH(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function u4(t,e){return typeof e=="function"?e(t):e}const wH=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",xH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",_H="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class EH{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=k5()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const r=this.nextItemKey++;return this.items.set(r,e),this.render(),()=>{this.items.delete(r),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&ev(Or("div",null,Or(f4,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,r])=>Or(SH,Object.assign({},r,{key:e}))))),this.root)}}const f4=t=>Or("div",{class:Fl("-cbwsdk-snackbar-container")},Or("style",null,wH),Or("div",{class:"-cbwsdk-snackbar"},t.children)),SH=({autoExpand:t,message:e,menuItems:r})=>{const[n,i]=a4(!0),[s,o]=a4(t??!1);mH(()=>{const u=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{u.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return Or("div",{class:Fl("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},Or("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},Or("img",{src:xH,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",Or("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),Or("div",{class:"-gear-container"},!s&&Or("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),Or("img",{src:_H,class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&Or("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((u,l)=>Or("div",{class:Fl("-cbwsdk-snackbar-instance-menu-item",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:u.onClick,key:l},Or("svg",{width:u.svgWidth,height:u.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("path",{"fill-rule":u.defaultFillRule,"clip-rule":u.defaultClipRule,d:u.path,fill:"#AAAAAA"})),Or("span",{class:Fl("-cbwsdk-snackbar-instance-menu-item-info",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},u.info)))))};class AH{constructor(){this.attached=!1,this.snackbar=new EH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.snackbar.attach(r),this.attached=!0,B5()}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}}const PH=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class MH{constructor(){this.root=null,this.darkMode=k5()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),B5()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(ev(null,this.root),e&&ev(Or(IH,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const IH=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return Or(f4,{darkMode:r},Or("div",{class:"-cbwsdk-redirect-dialog"},Or("style",null,PH),Or("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),Or("div",{class:Fl("-cbwsdk-redirect-dialog-box",s)},Or("p",null,t),Or("button",{onClick:n},e))))},CH="https://keys.coinbase.com/connect",l4="https://www.walletlink.org",TH="https://go.cb-w.com/walletlink";class h4{constructor(){this.attached=!1,this.redirectDialog=new MH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const r=new URL(TH);r.searchParams.append("redirect_url",aH().href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class Ro{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=cH(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(W1);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!u&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),Ro.accountRequestCallbackIds.size>0&&(Array.from(Ro.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),Ro.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new sH,this.ui=n,this.ui.attach()}subscribe(){const e=Du.load(this.storage)||Du.create(this.storage),{linkAPIUrl:r}=this,n=new iH({session:e,linkAPIUrl:r,listener:this}),i=this.isMobileWeb?new h4:new AH;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=Du.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Ys.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?Js(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?Js(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Nl(e,!0),chainId:r}})}getWalletLinkSession(){return this._session}sendRequest(e){let r=null;const n=lc(8),i=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,s),r==null||r()};return new Promise((s,o)=>{r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,a=>{if(r==null||r(),Hn(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,r){const n={type:"WEB3_REQUEST",id:e,request:r};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:r.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(r.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof h4)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e,r){if(r.method==="requestEthereumAccounts"){Ro.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,r)),Ro.accountRequestCallbackIds.clear();return}this.invokeCallback(e,r)}handleErrorResponse(e,r,n){var i;const s=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:r,errorMessage:s})}invokeCallback(e,r){const n=this.relayEventManager.callbacks.get(e);n&&(n(r),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:r}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:r}},i=lc(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(Hn(a))return o(new Error(a.errorMessage));s(a)}),Ro.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,r,n,i,s,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:o}};let u=null;const l=lc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));p(A)}),this.publishWeb3RequestEvent(l,a)})}addEthereumChain(e,r,n,i,s,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:o}};let u=null;const l=lc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));p(A)}),this.publishWeb3RequestEvent(l,a)})}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})};let i=null;const s=lc(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,u)=>{this.relayEventManager.callbacks.set(s,l=>{if(i==null||i(),Hn(l)&&l.errorCode)return u(Sr.provider.custom({code:l.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(Hn(l))return u(new Error(l.errorMessage));a(l)}),this.publishWeb3RequestEvent(s,n)})}}Ro.accountRequestCallbackIds=new Set;const d4="DefaultChainId",p4="DefaultJsonRpcUrl";class g4{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new Ys("walletlink",l4),this.callback=e.callback||null;const r=this._storage.getItem(W1);if(r){const n=r.split(" ");n[0]!==""&&(this._addresses=n.map(i=>ga(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:r,secret:n}=e.getWalletLinkSession();return{id:r,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(p4))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(p4,e)}updateProviderInfo(e,r){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(d4,r.toString(10)),Ll(r)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",pa(r)))}async watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw Sr.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw Sr.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw Sr.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw Sr.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=r.options,l=await this.initializeRelay().watchAsset(r.type,i,s,a,o,n==null?void 0:n.toString());return Hn(l)?!1:!!l.result}async addEthereumChain(e){var r,n;const i=e[0];if(((r=i.rpcUrls)===null||r===void 0?void 0:r.length)===0)throw Sr.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw Sr.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw Sr.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:u=[],chainName:l,iconUrls:d=[],nativeCurrency:p}=i,y=await o.addEthereumChain(s.toString(),a,d,u,l,p);if(Hn(y))return!1;if(((n=y.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw Sr.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const r=e[0],n=Number.parseInt(r.chainId,16),s=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(Hn(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,r){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(s=>ga(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(W1,i.join(" ")))}async request(e){const r=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return pa(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(r);case"wallet_switchEthereumChain":return this.switchEthereumChain(r);case"wallet_watchAsset":return this.watchAsset(r);default:if(!this.jsonRpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return m5(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const r=ga(e);if(!this._addresses.map(i=>ga(i)).includes(r))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?ga(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?ga(e.to):null,i=e.value!=null?kl(e.value):BigInt(0),s=e.data?j1(e.data):Buffer.alloc(0),o=e.nonce!=null?Ll(e.nonce):null,a=e.gasPrice!=null?kl(e.gasPrice):null,u=e.maxFeePerGas!=null?kl(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?kl(e.maxPriorityFeePerGas):null,d=e.gas!=null?kl(e.gas):null,p=e.chainId?Ll(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:u,maxPriorityFeePerGas:l,gasLimit:d,chainId:p}}async ecRecover(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:B1(n[0]),signature:B1(n[1]),addPrefix:r==="personal_ecRecover"}});if(Hn(s))throw s;return s.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(d4))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,r;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:pa(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(Hn(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:pa(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw Sr.rpc.invalidParams();const r=e[1],n=e[0];this._ensureKnownAddress(r);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ga(r),message:B1(n),addPrefix:!0,typedDataJson:null}});if(Hn(s))throw s;return s.result}async _eth_signTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(r);if(Hn(i))throw i;return i.result}async _eth_sendRawTransaction(e){const r=j1(e[0]),i=await this.initializeRelay().submitEthereumTransaction(r,this.getChainId());if(Hn(i))throw i;return i.result}async _eth_sendTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(r);if(Hn(i))throw i;return i.result}async signTypedData(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const i=l=>{const d={eth_signTypedData_v1:o0.hashForSignTypedDataLegacy,eth_signTypedData_v3:o0.hashForSignTypedData_v3,eth_signTypedData_v4:o0.hashForSignTypedData_v4,eth_signTypedData:o0.hashForSignTypedData_v4};return Nl(d[r]({data:Ez(l)}),!0)},s=n[r==="eth_signTypedData_v1"?1:0],o=n[r==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const u=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ga(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(Hn(u))throw u;return u.result}initializeRelay(){return this._relay||(this._relay=new Ro({linkAPIUrl:l4,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const m4="SignerType",v4=new Ys("CBWSDK","SignerConfigurator");function RH(){return v4.getItem(m4)}function DH(t){v4.setItem(m4,t)}async function OH(t){const{communicator:e,metadata:r,handshakeRequest:n,callback:i}=t;LH(e,r,i).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:o}=await e.postRequestAndWaitForResponse(s);return o}function NH(t){const{signerType:e,metadata:r,communicator:n,callback:i}=t;switch(e){case"scw":return new kz({metadata:r,callback:i,communicator:n});case"walletlink":return new g4({metadata:r,callback:i})}}async function LH(t,e,r){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new g4({metadata:e,callback:r});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const kH=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. +}`;var fr=WA(function(){return Mr(ne,Nt+"return "+Ze).apply(r,he)});if(fr.source=Ze,Ly(fr))throw fr;return fr}function bse(c){return Cr(c).toLowerCase()}function yse(c){return Cr(c).toUpperCase()}function wse(c,h,w){if(c=Cr(c),c&&(w||h===r))return e9(c);if(!c||!(h=ki(h)))return c;var L=Ms(c),K=Ms(h),ne=t9(L,K),he=r9(L,K)+1;return La(L,ne,he).join("")}function xse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.slice(0,i9(c)+1);if(!c||!(h=ki(h)))return c;var L=Ms(c),K=r9(L,Ms(h))+1;return La(L,0,K).join("")}function _se(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.replace($,"");if(!c||!(h=ki(h)))return c;var L=Ms(c),K=t9(L,Ms(h));return La(L,K).join("")}function Ese(c,h){var w=_e,L=G;if(Qr(h)){var K="separator"in h?h.separator:K;w="length"in h?ur(h.length):w,L="omission"in h?ki(h.omission):L}c=Cr(c);var ne=c.length;if(nf(c)){var he=Ms(c);ne=he.length}if(w>=ne)return c;var me=w-sf(L);if(me<1)return L;var we=he?La(he,0,me).join(""):c.slice(0,me);if(K===r)return we+L;if(he&&(me+=we.length-me),ky(K)){if(c.slice(me).search(K)){var We,Ke=we;for(K.global||(K=Zb(K.source,Cr(Re.exec(K))+"g")),K.lastIndex=0;We=K.exec(Ke);)var Ze=We.index;we=we.slice(0,Ze===r?me:Ze)}}else if(c.indexOf(ki(K),me)!=me){var xt=we.lastIndexOf(K);xt>-1&&(we=we.slice(0,xt))}return we+L}function Sse(c){return c=Cr(c),c&&Bt.test(c)?c.replace(Xt,QQ):c}var Ase=hf(function(c,h,w){return c+(w?" ":"")+h.toUpperCase()}),Fy=K9("toUpperCase");function HA(c,h,w){return c=Cr(c),h=w?r:h,h===r?GQ(c)?ree(c):FQ(c):c.match(h)||[]}var WA=hr(function(c,h){try{return $n(c,r,h)}catch(w){return Ly(w)?w:new tr(w)}}),Pse=Wo(function(c,h){return ss(h,function(w){w=so(w),zo(c,w,Oy(c[w],c))}),c});function Mse(c){var h=c==null?0:c.length,w=qt();return c=h?Xr(c,function(L){if(typeof L[1]!="function")throw new os(o);return[w(L[0]),L[1]]}):[],hr(function(L){for(var K=-1;++K_)return[];var w=M,L=ei(c,M);h=qt(h),c-=M;for(var K=Yb(L,h);++w0||h<0)?new xr(w):(c<0?w=w.takeRight(-c):c&&(w=w.drop(c)),h!==r&&(h=ur(h),w=h<0?w.dropRight(-h):w.take(h-c)),w)},xr.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},xr.prototype.toArray=function(){return this.take(M)},no(xr.prototype,function(c,h){var w=/^(?:filter|find|map|reject)|While$/.test(h),L=/^(?:head|last)$/.test(h),K=re[L?"take"+(h=="last"?"Right":""):h],ne=L||/^find/.test(h);K&&(re.prototype[h]=function(){var he=this.__wrapped__,me=L?[1]:arguments,we=he instanceof xr,We=me[0],Ke=we||sr(he),Ze=function(br){var Er=K.apply(re,Ca([br],me));return L&&xt?Er[0]:Er};Ke&&w&&typeof We=="function"&&We.length!=1&&(we=Ke=!1);var xt=this.__chain__,Nt=!!this.__actions__.length,Vt=ne&&!xt,fr=we&&!Nt;if(!ne&&Ke){he=fr?he:new xr(this);var Gt=c.apply(he,me);return Gt.__actions__.push({func:qp,args:[Ze],thisArg:r}),new as(Gt,xt)}return Vt&&fr?c.apply(this,me):(Gt=this.thru(Ze),Vt?L?Gt.value()[0]:Gt.value():Gt)})}),ss(["pop","push","shift","sort","splice","unshift"],function(c){var h=pp[c],w=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",L=/^(?:pop|shift)$/.test(c);re.prototype[c]=function(){var K=arguments;if(L&&!this.__chain__){var ne=this.value();return h.apply(sr(ne)?ne:[],K)}return this[w](function(he){return h.apply(sr(he)?he:[],K)})}}),no(xr.prototype,function(c,h){var w=re[h];if(w){var L=w.name+"";Tr.call(uf,L)||(uf[L]=[]),uf[L].push({name:h,func:w})}}),uf[Lp(r,k).name]=[{name:"wrapper",func:r}],xr.prototype.clone=See,xr.prototype.reverse=Aee,xr.prototype.value=Pee,re.prototype.at=tne,re.prototype.chain=rne,re.prototype.commit=nne,re.prototype.next=ine,re.prototype.plant=one,re.prototype.reverse=ane,re.prototype.toJSON=re.prototype.valueOf=re.prototype.value=cne,re.prototype.first=re.prototype.head,bh&&(re.prototype[bh]=sne),re},of=nee();gn?((gn.exports=of)._=of,Ur._=of):_r._=of}).call(nn)}(e0,e0.exports);var Pq=e0.exports,P1={exports:{}};(function(t,e){var r=typeof self<"u"?self:nn,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function u(f){return f&&DataView.prototype.isPrototypeOf(f)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(f){return f&&l.indexOf(Object.prototype.toString.call(f))>-1};function p(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function y(f){return typeof f!="string"&&(f=String(f)),f}function A(f){var g={next:function(){var v=f.shift();return{done:v===void 0,value:v}}};return a.iterable&&(g[Symbol.iterator]=function(){return g}),g}function P(f){this.map={},f instanceof P?f.forEach(function(g,v){this.append(v,g)},this):Array.isArray(f)?f.forEach(function(g){this.append(g[0],g[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(g){this.append(g,f[g])},this)}P.prototype.append=function(f,g){f=p(f),g=y(g);var v=this.map[f];this.map[f]=v?v+", "+g:g},P.prototype.delete=function(f){delete this.map[p(f)]},P.prototype.get=function(f){return f=p(f),this.has(f)?this.map[f]:null},P.prototype.has=function(f){return this.map.hasOwnProperty(p(f))},P.prototype.set=function(f,g){this.map[p(f)]=y(g)},P.prototype.forEach=function(f,g){for(var v in this.map)this.map.hasOwnProperty(v)&&f.call(g,this.map[v],v,this)},P.prototype.keys=function(){var f=[];return this.forEach(function(g,v){f.push(v)}),A(f)},P.prototype.values=function(){var f=[];return this.forEach(function(g){f.push(g)}),A(f)},P.prototype.entries=function(){var f=[];return this.forEach(function(g,v){f.push([v,g])}),A(f)},a.iterable&&(P.prototype[Symbol.iterator]=P.prototype.entries);function O(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function D(f){return new Promise(function(g,v){f.onload=function(){g(f.result)},f.onerror=function(){v(f.error)}})}function k(f){var g=new FileReader,v=D(g);return g.readAsArrayBuffer(f),v}function B(f){var g=new FileReader,v=D(g);return g.readAsText(f),v}function q(f){for(var g=new Uint8Array(f),v=new Array(g.length),x=0;x-1?g:f}function z(f,g){g=g||{};var v=g.body;if(f instanceof z){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,g.headers||(this.headers=new P(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!v&&f._bodyInit!=null&&(v=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=g.credentials||this.credentials||"same-origin",(g.headers||!this.headers)&&(this.headers=new P(g.headers)),this.method=T(g.method||this.method||"GET"),this.mode=g.mode||this.mode||null,this.signal=g.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(v)}z.prototype.clone=function(){return new z(this,{body:this._bodyInit})};function ue(f){var g=new FormData;return f.trim().split("&").forEach(function(v){if(v){var x=v.split("="),_=x.shift().replace(/\+/g," "),S=x.join("=").replace(/\+/g," ");g.append(decodeURIComponent(_),decodeURIComponent(S))}}),g}function _e(f){var g=new P,v=f.replace(/\r?\n[\t ]+/g," ");return v.split(/\r?\n/).forEach(function(x){var _=x.split(":"),S=_.shift().trim();if(S){var b=_.join(":").trim();g.append(S,b)}}),g}H.call(z.prototype);function G(f,g){g||(g={}),this.type="default",this.status=g.status===void 0?200:g.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in g?g.statusText:"OK",this.headers=new P(g.headers),this.url=g.url||"",this._initBody(f)}H.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new P(this.headers),url:this.url})},G.error=function(){var f=new G(null,{status:0,statusText:""});return f.type="error",f};var E=[301,302,303,307,308];G.redirect=function(f,g){if(E.indexOf(g)===-1)throw new RangeError("Invalid status code");return new G(null,{status:g,headers:{location:f}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(g,v){this.message=g,this.name=v;var x=Error(g);this.stack=x.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function m(f,g){return new Promise(function(v,x){var _=new z(f,g);if(_.signal&&_.signal.aborted)return x(new o.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function b(){S.abort()}S.onload=function(){var M={status:S.status,statusText:S.statusText,headers:_e(S.getAllResponseHeaders()||"")};M.url="responseURL"in S?S.responseURL:M.headers.get("X-Request-URL");var I="response"in S?S.response:S.responseText;v(new G(I,M))},S.onerror=function(){x(new TypeError("Network request failed"))},S.ontimeout=function(){x(new TypeError("Network request failed"))},S.onabort=function(){x(new o.DOMException("Aborted","AbortError"))},S.open(_.method,_.url,!0),_.credentials==="include"?S.withCredentials=!0:_.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&a.blob&&(S.responseType="blob"),_.headers.forEach(function(M,I){S.setRequestHeader(I,M)}),_.signal&&(_.signal.addEventListener("abort",b),S.onreadystatechange=function(){S.readyState===4&&_.signal.removeEventListener("abort",b)}),S.send(typeof _._bodyInit>"u"?null:_._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=P,s.Request=z,s.Response=G),o.Headers=P,o.Request=z,o.Response=G,o.fetch=m,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(P1,P1.exports);var Mq=P1.exports;const D6=ji(Mq);var Iq=Object.defineProperty,Cq=Object.defineProperties,Tq=Object.getOwnPropertyDescriptors,O6=Object.getOwnPropertySymbols,Rq=Object.prototype.hasOwnProperty,Dq=Object.prototype.propertyIsEnumerable,N6=(t,e,r)=>e in t?Iq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,L6=(t,e)=>{for(var r in e||(e={}))Rq.call(e,r)&&N6(t,r,e[r]);if(O6)for(var r of O6(e))Dq.call(e,r)&&N6(t,r,e[r]);return t},k6=(t,e)=>Cq(t,Tq(e));const Oq={Accept:"application/json","Content-Type":"application/json"},Nq="POST",B6={headers:Oq,method:Nq},$6=10;let xs=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new qi.EventEmitter,this.isAvailable=!1,this.registering=!1,!B_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=mo(e),n=await(await D6(this.url,k6(L6({},B6),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!B_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=mo({id:1,jsonrpc:"2.0",method:"test",params:[]});await D6(e,k6(L6({},B6),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Ka(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gd(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return D_(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>$6&&this.events.setMaxListeners($6)}};const F6="error",Lq="wss://relay.walletconnect.org",kq="wc",Bq="universal_provider",j6=`${kq}@2:${Bq}:`,U6="https://rpc.walletconnect.org/v1/",Cu="generic",$q=`${U6}bundler`,Qi={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Fq=Object.defineProperty,jq=Object.defineProperties,Uq=Object.getOwnPropertyDescriptors,q6=Object.getOwnPropertySymbols,qq=Object.prototype.hasOwnProperty,zq=Object.prototype.propertyIsEnumerable,z6=(t,e,r)=>e in t?Fq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,t0=(t,e)=>{for(var r in e||(e={}))qq.call(e,r)&&z6(t,r,e[r]);if(q6)for(var r of q6(e))zq.call(e,r)&&z6(t,r,e[r]);return t},Hq=(t,e)=>jq(t,Uq(e));function Di(t,e,r){var n;const i=Su(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${U6}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function fc(t){return t.includes(":")?t.split(":")[1]:t}function H6(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Wq(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function M1(t={},e={}){const r=W6(t),n=W6(e);return Pq.merge(r,n)}function W6(t){var e,r,n,i;const s={};if(!Sl(t))return s;for(const[o,a]of Object.entries(t)){const u=f1(o)?[o]:a.chains,l=a.methods||[],d=a.events||[],p=a.rpcMap||{},y=El(o);s[y]=Hq(t0(t0({},s[y]),a),{chains:Ud(u,(e=s[y])==null?void 0:e.chains),methods:Ud(l,(r=s[y])==null?void 0:r.methods),events:Ud(d,(n=s[y])==null?void 0:n.events),rpcMap:t0(t0({},p),(i=s[y])==null?void 0:i.rpcMap)})}return s}function Kq(t){return t.includes(":")?t.split(":")[2]:t}function K6(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=f1(r)?[r]:n.chains?n.chains:H6(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function I1(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const V6={},Ar=t=>V6[t],C1=(t,e)=>{V6[t]=e};class Vq{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}var Gq=Object.defineProperty,Yq=Object.defineProperties,Jq=Object.getOwnPropertyDescriptors,G6=Object.getOwnPropertySymbols,Xq=Object.prototype.hasOwnProperty,Zq=Object.prototype.propertyIsEnumerable,Y6=(t,e,r)=>e in t?Gq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,J6=(t,e)=>{for(var r in e||(e={}))Xq.call(e,r)&&Y6(t,r,e[r]);if(G6)for(var r of G6(e))Zq.call(e,r)&&Y6(t,r,e[r]);return t},X6=(t,e)=>Yq(t,Jq(e));class Qq{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(fc(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const u=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:X6(J6({},o.sessionProperties||{}),{capabilities:X6(J6({},a||{}),{[s]:u})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return u}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(da("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${$q}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class ez{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}let tz=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}},rz=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ji(new xs(n,Ar("disableProviderPing")))}},nz=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=fc(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}},iz=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}};class sz{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=fc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}let oz=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new xs(n,Ar("disableProviderPing")))}};class az{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Ji(new xs(n))}}class cz{constructor(e){this.name=Cu,this.namespace=e.namespace,this.events=Ar("events"),this.client=Ar("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Qi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=Su(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ji(new xs(n,Ar("disableProviderPing")))}}var uz=Object.defineProperty,fz=Object.defineProperties,lz=Object.getOwnPropertyDescriptors,Z6=Object.getOwnPropertySymbols,hz=Object.prototype.hasOwnProperty,dz=Object.prototype.propertyIsEnumerable,Q6=(t,e,r)=>e in t?uz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,r0=(t,e)=>{for(var r in e||(e={}))hz.call(e,r)&&Q6(t,r,e[r]);if(Z6)for(var r of Z6(e))dz.call(e,r)&&Q6(t,r,e[r]);return t},T1=(t,e)=>fz(t,lz(e));let R1=class YA{constructor(e){this.events=new Yg,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Qf(od({level:(e==null?void 0:e.logger)||F6})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new YA(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:r0({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,Vd(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Dr("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=K6(this.session.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=K6(s.namespaces);this.namespaces=M1(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==C6)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Cu?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(ic(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await A1.init({core:this.providerOpts.core,logger:this.providerOpts.logger||F6,relayUrl:this.providerOpts.relayUrl||Lq,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>El(r)))];C1("client",this.client),C1("events",this.events),C1("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Wq(r,this.session),i=H6(n),s=M1(this.namespaces,this.optionalNamespaces),o=T1(r0({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new Qq({namespace:o});break;case"algorand":this.rpcProviders[r]=new rz({namespace:o});break;case"solana":this.rpcProviders[r]=new ez({namespace:o});break;case"cosmos":this.rpcProviders[r]=new tz({namespace:o});break;case"polkadot":this.rpcProviders[r]=new Vq({namespace:o});break;case"cip34":this.rpcProviders[r]=new nz({namespace:o});break;case"elrond":this.rpcProviders[r]=new iz({namespace:o});break;case"multiversx":this.rpcProviders[r]=new sz({namespace:o});break;case"near":this.rpcProviders[r]=new oz({namespace:o});break;case"tezos":this.rpcProviders[r]=new az({namespace:o});break;default:this.rpcProviders[Cu]?this.rpcProviders[Cu].updateNamespace(o):this.rpcProviders[Cu]=new cz({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&ic(i)&&this.events.emit("accountsChanged",i.map(Kq))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=El(i),a=I1(i)!==I1(s)?`${o}:${I1(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=T1(r0({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",T1(r0({},Dr("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Qi.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Cu]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>El(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=El(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${j6}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${j6}/${e}`)}};const pz=R1;function gz(){return new Promise(t=>{const e=[];let r;window.addEventListener("eip6963:announceProvider",n=>{const{detail:i}=n;r&&clearTimeout(r),e.push(i),r=setTimeout(()=>t(e),200)}),r=setTimeout(()=>t(e),200),window.dispatchEvent(new Event("eip6963:requestProvider"))})}class Ys{constructor(e,r){this.scope=e,this.module=r}storeObject(e,r){this.setItem(e,JSON.stringify(r))}loadObject(e){const r=this.getItem(e);return r?JSON.parse(r):void 0}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new Ys("CBWSDK").clear(),new Ys("walletlink").clear()}}const cn={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},D1={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},e5="Unspecified error message.",mz="Unspecified server error.";function O1(t,e=e5){if(t&&Number.isInteger(t)){const r=t.toString();if(N1(D1,r))return D1[r].message;if(t5(t))return mz}return e}function vz(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(D1[e]||t5(t))}function bz(t,{shouldIncludeStack:e=!1}={}){const r={};if(t&&typeof t=="object"&&!Array.isArray(t)&&N1(t,"code")&&vz(t.code)){const n=t;r.code=n.code,n.message&&typeof n.message=="string"?(r.message=n.message,N1(n,"data")&&(r.data=n.data)):(r.message=O1(r.code),r.data={originalError:r5(t)})}else r.code=cn.rpc.internal,r.message=n5(t,"message")?t.message:e5,r.data={originalError:r5(t)};return e&&(r.stack=n5(t,"stack")?t.stack:void 0),r}function t5(t){return t>=-32099&&t<=-32e3}function r5(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function N1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function n5(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const Sr={rpc:{parse:t=>es(cn.rpc.parse,t),invalidRequest:t=>es(cn.rpc.invalidRequest,t),invalidParams:t=>es(cn.rpc.invalidParams,t),methodNotFound:t=>es(cn.rpc.methodNotFound,t),internal:t=>es(cn.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return es(e,t)},invalidInput:t=>es(cn.rpc.invalidInput,t),resourceNotFound:t=>es(cn.rpc.resourceNotFound,t),resourceUnavailable:t=>es(cn.rpc.resourceUnavailable,t),transactionRejected:t=>es(cn.rpc.transactionRejected,t),methodNotSupported:t=>es(cn.rpc.methodNotSupported,t),limitExceeded:t=>es(cn.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Tu(cn.provider.userRejectedRequest,t),unauthorized:t=>Tu(cn.provider.unauthorized,t),unsupportedMethod:t=>Tu(cn.provider.unsupportedMethod,t),disconnected:t=>Tu(cn.provider.disconnected,t),chainDisconnected:t=>Tu(cn.provider.chainDisconnected,t),unsupportedChain:t=>Tu(cn.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new o5(e,r,n)}}};function es(t,e){const[r,n]=i5(e);return new s5(t,r||O1(t),n)}function Tu(t,e){const[r,n]=i5(e);return new o5(t,r||O1(t),n)}function i5(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}class s5 extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}}class o5 extends s5{constructor(e,r,n){if(!yz(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}function yz(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function L1(){return t=>t}const Ol=L1(),wz=L1(),xz=L1();function Co(t){return Math.floor(t)}const a5=/^[0-9]*$/,c5=/^[a-f0-9]*$/;function lc(t){return k1(crypto.getRandomValues(new Uint8Array(t)))}function k1(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function n0(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function Nl(t,e=!1){const r=t.toString("hex");return Ol(e?`0x${r}`:r)}function B1(t){return Nl(j1(t),!0)}function Js(t){return xz(t.toString(10))}function pa(t){return Ol(`0x${BigInt(t).toString(16)}`)}function u5(t){return t.startsWith("0x")||t.startsWith("0X")}function $1(t){return u5(t)?t.slice(2):t}function f5(t){return u5(t)?`0x${t.slice(2)}`:`0x${t}`}function i0(t){if(typeof t!="string")return!1;const e=$1(t).toLowerCase();return c5.test(e)}function _z(t,e=!1){if(typeof t=="string"){const r=$1(t).toLowerCase();if(c5.test(r))return Ol(e?`0x${r}`:r)}throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function F1(t,e=!1){let r=_z(t,!1);return r.length%2===1&&(r=Ol(`0${r}`)),e?Ol(`0x${r}`):r}function ga(t){if(typeof t=="string"){const e=$1(t).toLowerCase();if(i0(e)&&e.length===40)return wz(f5(e))}throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function j1(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(i0(t)){const e=F1(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Sr.rpc.invalidParams(`Not binary data: ${String(t)}`)}function Ll(t){if(typeof t=="number"&&Number.isInteger(t))return Co(t);if(typeof t=="string"){if(a5.test(t))return Co(Number(t));if(i0(t))return Co(Number(BigInt(F1(t,!0))))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function kl(t){if(t!==null&&(typeof t=="bigint"||Sz(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(Ll(t));if(typeof t=="string"){if(a5.test(t))return BigInt(t);if(i0(t))return BigInt(F1(t,!0))}throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`)}function Ez(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Sr.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function Sz(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function Az(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function Pz(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Mz(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,new TextEncoder().encode(e));return{iv:r,cipherText:n}}async function Iz(t,{iv:e,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return new TextDecoder().decode(n)}function l5(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function h5(t,e){const r=l5(t),n=await crypto.subtle.exportKey(r,e);return k1(new Uint8Array(n))}async function d5(t,e){const r=l5(t),n=n0(e).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function Cz(t,e){const r=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return Mz(e,r)}async function Tz(t,e){return JSON.parse(await Iz(e,t))}const U1={storageKey:"ownPrivateKey",keyType:"private"},q1={storageKey:"ownPublicKey",keyType:"public"},z1={storageKey:"peerPublicKey",keyType:"public"};class Rz{constructor(){this.storage=new Ys("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(z1,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(q1.storageKey),this.storage.removeItem(U1.storageKey),this.storage.removeItem(z1.storageKey)}async generateKeyPair(){const e=await Az();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(U1,e.privateKey),await this.storeKey(q1,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(U1)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(q1)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(z1)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await Pz(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const r=this.storage.getItem(e.storageKey);return r?d5(e.keyType,r):null}async storeKey(e,r){const n=await h5(e.keyType,r);this.storage.setItem(e.storageKey,n)}}const Bl="4.2.4",p5="@coinbase/wallet-sdk";async function g5(t,e){const r=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":Bl,"X-Cbw-Sdk-Platform":p5}}),{result:i,error:s}=await n.json();if(s)throw s;return i}function Dz(){return globalThis.coinbaseWalletExtension}function Oz(){var t,e;try{const r=globalThis;return(t=r.ethereum)!==null&&t!==void 0?t:(e=r.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Nz({metadata:t,preference:e}){var r,n;const{appName:i,appLogoUrl:s,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const u=Dz();if(u)return(r=u.setAppInfo)===null||r===void 0||r.call(u,i,s,o,e),u}const a=Oz();if(a!=null&&a.isCoinbaseBrowser)return(n=a.setAppInfo)===null||n===void 0||n.call(a,i,s,o,e),a}function Lz(t){if(!t||typeof t!="object"||Array.isArray(t))throw Sr.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:r}=t;if(typeof e!="string"||e.length===0)throw Sr.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Sr.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw Sr.provider.unsupportedMethod()}}const m5="accounts",v5="activeChain",b5="availableChains",y5="walletCapabilities";class kz{constructor(e){var r,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new Rz,this.storage=new Ys("CBWSDK","SCWStateManager"),this.accounts=(r=this.storage.loadObject(m5))!==null&&r!==void 0?r:[],this.chain=this.storage.loadObject(v5)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var r,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(r=e.params)!==null&&r!==void 0?r:{})}}),s=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in s.content)throw s.content.failure;const o=await d5("public",s.sender);await this.keyManager.setPeerPublicKey(o);const u=(await this.decryptResponseMessage(s)).result;if("error"in u)throw u.error;const l=u.value;this.accounts=l,this.storage.storeObject(m5,l),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",l)}async request(e){var r;if(this.accounts.length===0)throw Sr.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:pa(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return pa(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(y5);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var r,n;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const i=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(i)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,r;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(r=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&r!==void 0?r:1}}async handleSwitchChainRequest(e){var r;const n=e.params;if(!n||!(!((r=n[0])===null||r===void 0)&&r.chainId))throw Sr.rpc.invalidParams();const i=Ll(n[0].chainId);if(this.updateChain(i))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(i),o}async sendEncryptedRequest(e){const r=await this.keyManager.getSharedSecret();if(!r)throw Sr.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await Cz({action:e,chainId:this.chain.id},r),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const r=await h5("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:r,content:e,timestamp:new Date}}async decryptResponseMessage(e){var r,n;const i=e.content;if("failure"in i)throw i.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw Sr.provider.unauthorized("Invalid session");const o=await Tz(i.encrypted,s),a=(r=o.data)===null||r===void 0?void 0:r.chains;if(a){const l=Object.entries(a).map(([d,p])=>({id:Number(d),rpcUrl:p}));this.storage.storeObject(b5,l),this.updateChain(this.chain.id,l)}const u=(n=o.data)===null||n===void 0?void 0:n.capabilities;return u&&this.storage.storeObject(y5,u),o}updateChain(e,r){var n;const i=r??this.storage.loadObject(b5),s=i==null?void 0:i.find(o=>o.id===e);return s?(s!==this.chain&&(this.chain=s,this.storage.storeObject(v5,s),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",pa(s.id))),!0):!1}}const Bz=Jp(tM),{keccak_256:$z}=Bz;function w5(t){return Buffer.allocUnsafe(t).fill(0)}function Fz(t){return t.toString(2).length}function x5(t,e){let r=t.toString(16);r.length%2!==0&&(r="0"+r);const n=r.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(r=I5(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(Xs(t,e[s]));if(r==="dynamic"){var o=Xs("uint256",e.length);i.unshift(o)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([Xs("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,si.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Ru(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return si.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Ru(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=hc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+a);if(n<0)throw new Error("Supplied uint is negative");return si.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(r=Ru(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=hc(e);const a=si.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied int exceeds width: "+r+" vs "+a);const u=si.twosFromBigInt(n,256);return si.bufferBEFromBigInt(u,32)}else if(t.startsWith("ufixed")){if(r=M5(t),n=hc(e),n<0)throw new Error("Supplied ufixed is negative");return Xs("uint256",n*BigInt(2)**BigInt(r[1]))}else if(t.startsWith("fixed"))return r=M5(t),Xs("int256",hc(e)*BigInt(2)**BigInt(r[1]))}throw new Error("Unsupported or invalid type: "+t)}function Wz(t){return t==="string"||t==="bytes"||I5(t)==="dynamic"}function Kz(t){return t.lastIndexOf("]")===t.length-1}function Vz(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var o=P5(t[s]),a=e[s],u=Xs(o,a);Wz(o)?(r.push(Xs("uint256",i)),n.push(u),i+=u.length):r.push(u)}return Buffer.concat(r.concat(n))}function C5(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(si.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=Ru(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=hc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+u);i.push(si.bufferBEFromBigInt(n,r/8))}else if(o.startsWith("int")){if(r=Ru(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=hc(a);const u=si.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied int exceeds width: "+r+" vs "+u);const l=si.twosFromBigInt(n,r);i.push(si.bufferBEFromBigInt(l,r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function Gz(t,e){return si.keccak(C5(t,e))}var Yz={rawEncode:Vz,solidityPack:C5,soliditySHA3:Gz};const _s=A5,$l=Yz,T5={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},H1={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const o=(a,u,l)=>{if(r[u]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":_s.keccak(this.encodeData(u,l,r,n))];if(l===void 0)throw new Error(`missing value for field ${a} of type ${u}`);if(u==="bytes")return["bytes32",_s.keccak(l)];if(u==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",_s.keccak(l)];if(u.lastIndexOf("]")===u.length-1){const d=u.slice(0,u.lastIndexOf("[")),p=l.map(y=>o(a,d,y));return["bytes32",_s.keccak($l.rawEncode(p.map(([y])=>y),p.map(([,y])=>y)))]}return[u,l]};for(const a of r[t]){const[u,l]=o(a.name,a.type,e[a.name]);i.push(u),s.push(l)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=_s.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=_s.keccak(a),s.push(a);else if(r[o.type]!==void 0)i.push("bytes32"),a=_s.keccak(this.encodeData(o.type,a,r,n)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return $l.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return _s.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return _s.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in T5.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),_s.keccak(Buffer.concat(n))}};var Jz={TYPED_MESSAGE_SCHEMA:T5,TypedDataUtils:H1,hashForSignTypedDataLegacy:function(t){return Xz(t.data)},hashForSignTypedData_v3:function(t){return H1.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return H1.hash(t.data)}};function Xz(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?_s.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return $l.soliditySHA3(["bytes32","bytes32"],[$l.soliditySHA3(new Array(t.length).fill("string"),i),$l.soliditySHA3(n,r)])}const o0=ji(Jz),Zz="walletUsername",W1="Addresses",Qz="AppVersion";function Hn(t){return t.errorMessage!==void 0}class eH{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),a=16,u=o.slice(o.byteLength-a),l=o.slice(0,o.byteLength-a),d=new Uint8Array(u),p=new Uint8Array(l),y=new Uint8Array([...n,...d,...p]);return k1(y)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",n0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=n0(e),a=o.slice(0,12),u=o.slice(12,28),l=o.slice(28),d=new Uint8Array([...l,...u]),p={name:"AES-GCM",iv:new Uint8Array(a)};try{const y=await window.crypto.subtle.decrypt(p,s,d),A=new TextDecoder;n(A.decode(y))}catch(y){i(y)}})()})}}class tH{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}var To;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(To||(To={}));class rH{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,To.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.DISCONNECTED)},i.onopen=s=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(u=>this.sendData(u)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const u=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,u)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,To.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const R5=1e4,nH=6e4;class iH{constructor({session:e,linkAPIUrl:r,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Co(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,u)=>{const l=s[u];l!==void 0&&a(l)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,u)},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(Zz,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(Qz,s)},this.handleChainUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(s),l=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(u,l)},this.session=e,this.cipher=new eH(e.secret),this.listener=n;const i=new rH(`${r}/rpc`,WebSocket);i.setConnectionStateListener(async s=>{let o=!1;switch(s){case To.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(u=>setTimeout(u,5e3)),this.destroyed||i.connect().catch(()=>{a()})};a()}break;case To.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},R5),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case To.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(s=>{var o;switch(s.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=s.type==="IsLinkedOK"?s.linked:void 0;this.linked=a||s.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(s.metadata);break}case"Event":{this.handleIncomingEvent(s);break}}s.id!==void 0&&((o=this.requestResolutions.get(s.id))===null||o===void 0||o(s))}),this.ws=i,this.http=new tH(r,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:s,response:o}=i;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s,o)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Co(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>R5*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r={timeout:nH}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r.timeout)}),new Promise(s=>{this.requestResolutions.set(n,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Co(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Co(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id}),!0)}}class sH{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=f5(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}const D5="session:id",O5="session:secret",N5="session:linked";class Du{constructor(e,r,n,i=!1){this.storage=e,this.id=r,this.secret=n,this.key=NP(Pg(`${r}, ${n} WalletLink`)),this._linked=!!i}static create(e){const r=lc(16),n=lc(32);return new Du(e,r,n).save()}static load(e){const r=e.getItem(D5),n=e.getItem(N5),i=e.getItem(O5);return r&&i?new Du(e,r,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(D5,this.id),this.storage.setItem(O5,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(N5,this._linked?"1":"0")}}function oH(){try{return window.frameElement!==null}catch{return!1}}function aH(){try{return oH()&&window.top?window.top.location:window.location}catch{return window.location}}function cH(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function L5(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const uH='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function k5(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(uH)),document.documentElement.appendChild(t)}function B5(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e2&&(o.children=arguments.length>3?a0.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return c0(t,o,n,i,null)}function c0(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++$5,__i:-1,__u:0};return i==null&&Vr.vnode!=null&&Vr.vnode(s),s}function Ul(t){return t.children}function u0(t,e){this.props=t,this.context=e}function Ou(t,e){if(e==null)return t.__?Ou(t.__,t.__i+1):null;for(var r;ee&&dc.sort(K1));f0.__r=0}function W5(t,e,r,n,i,s,o,a,u,l,d){var p,y,A,P,O,D,k=n&&n.__k||q5,B=e.length;for(u=lH(r,e,k,u),p=0;p0?c0(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,(u=s.__i=hH(s,r,a,p))!==-1&&(p--,(o=r[u])&&(o.__u|=2)),o==null||o.__v===null?(u==-1&&y--,typeof s.type!="function"&&(s.__u|=4)):u!==a&&(u==a-1?y--:u==a+1?y++:(u>a?y--:y++,s.__u|=4))):s=t.__k[i]=null;if(p)for(i=0;i(u!=null&&!(2&u.__u)?1:0))for(;o>=0||a=0){if((u=e[o])&&!(2&u.__u)&&i==u.key&&s===u.type)return o;o--}if(a=r.__.length&&r.__.push({}),r.__[t]}function o4(t){return rv=1,gH(c4,t)}function gH(t,e,r){var n=s4(h0++,2);if(n.t=t,!n.__c&&(n.__=[c4(void 0,e),function(a){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,a);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=un,!un.u)){var i=function(a,u,l){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(y){return!!y.__c});if(d.every(function(y){return!y.__N}))return!s||s.call(this,a,u,l);var p=n.__c.props!==a;return d.forEach(function(y){if(y.__N){var A=y.__[0];y.__=y.__N,y.__N=void 0,A!==y.__[0]&&(p=!0)}}),s&&s.call(this,a,u,l)||p};un.u=!0;var s=un.shouldComponentUpdate,o=un.componentWillUpdate;un.componentWillUpdate=function(a,u,l){if(this.__e){var d=s;s=void 0,i(a,u,l),s=d}o&&o.call(this,a,u,l)},un.shouldComponentUpdate=i}return n.__N||n.__}function mH(t,e){var r=s4(h0++,3);!yn.__s&&yH(r.__H,e)&&(r.__=t,r.i=e,un.__H.__h.push(r))}function vH(){for(var t;t=Z5.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(d0),t.__H.__h.forEach(nv),t.__H.__h=[]}catch(e){t.__H.__h=[],yn.__e(e,t.__v)}}yn.__b=function(t){un=null,Q5&&Q5(t)},yn.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),i4&&i4(t,e)},yn.__r=function(t){e4&&e4(t),h0=0;var e=(un=t.__c).__H;e&&(tv===un?(e.__h=[],un.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(d0),e.__h.forEach(nv),e.__h=[],h0=0)),tv=un},yn.diffed=function(t){t4&&t4(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Z5.push(e)!==1&&X5===yn.requestAnimationFrame||((X5=yn.requestAnimationFrame)||bH)(vH)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),tv=un=null},yn.__c=function(t,e){e.some(function(r){try{r.__h.forEach(d0),r.__h=r.__h.filter(function(n){return!n.__||nv(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],yn.__e(n,r.__v)}}),r4&&r4(t,e)},yn.unmount=function(t){n4&&n4(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{d0(n)}catch(i){e=i}}),r.__H=void 0,e&&yn.__e(e,r.__v))};var a4=typeof requestAnimationFrame=="function";function bH(t){var e,r=function(){clearTimeout(n),a4&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);a4&&(e=requestAnimationFrame(r))}function d0(t){var e=un,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),un=e}function nv(t){var e=un;t.__c=t.__(),un=e}function yH(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function c4(t,e){return typeof e=="function"?e(t):e}const wH=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",xH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",_H="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class EH{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=L5()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const r=this.nextItemKey++;return this.items.set(r,e),this.render(),()=>{this.items.delete(r),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&ev(Or("div",null,Or(u4,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,r])=>Or(SH,Object.assign({},r,{key:e}))))),this.root)}}const u4=t=>Or("div",{class:Fl("-cbwsdk-snackbar-container")},Or("style",null,wH),Or("div",{class:"-cbwsdk-snackbar"},t.children)),SH=({autoExpand:t,message:e,menuItems:r})=>{const[n,i]=o4(!0),[s,o]=o4(t??!1);mH(()=>{const u=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{u.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return Or("div",{class:Fl("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},Or("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},Or("img",{src:xH,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",Or("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),Or("div",{class:"-gear-container"},!s&&Or("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),Or("img",{src:_H,class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&Or("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((u,l)=>Or("div",{class:Fl("-cbwsdk-snackbar-instance-menu-item",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:u.onClick,key:l},Or("svg",{width:u.svgWidth,height:u.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("path",{"fill-rule":u.defaultFillRule,"clip-rule":u.defaultClipRule,d:u.path,fill:"#AAAAAA"})),Or("span",{class:Fl("-cbwsdk-snackbar-instance-menu-item-info",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},u.info)))))};class AH{constructor(){this.attached=!1,this.snackbar=new EH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.snackbar.attach(r),this.attached=!0,k5()}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}}const PH=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class MH{constructor(){this.root=null,this.darkMode=L5()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),k5()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(ev(null,this.root),e&&ev(Or(IH,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const IH=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return Or(u4,{darkMode:r},Or("div",{class:"-cbwsdk-redirect-dialog"},Or("style",null,PH),Or("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),Or("div",{class:Fl("-cbwsdk-redirect-dialog-box",s)},Or("p",null,t),Or("button",{onClick:n},e))))},CH="https://keys.coinbase.com/connect",f4="https://www.walletlink.org",TH="https://go.cb-w.com/walletlink";class l4{constructor(){this.attached=!1,this.redirectDialog=new MH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const r=new URL(TH);r.searchParams.append("redirect_url",aH().href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class Ro{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=cH(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(W1);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!u&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),Ro.accountRequestCallbackIds.size>0&&(Array.from(Ro.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),Ro.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new sH,this.ui=n,this.ui.attach()}subscribe(){const e=Du.load(this.storage)||Du.create(this.storage),{linkAPIUrl:r}=this,n=new iH({session:e,linkAPIUrl:r,listener:this}),i=this.isMobileWeb?new l4:new AH;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=Du.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Ys.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?Js(e.gasPriceInWei):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Js(e.weiValue),data:Nl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Js(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?Js(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?Js(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?Js(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Nl(e,!0),chainId:r}})}getWalletLinkSession(){return this._session}sendRequest(e){let r=null;const n=lc(8),i=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,s),r==null||r()};return new Promise((s,o)=>{r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,a=>{if(r==null||r(),Hn(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,r){const n={type:"WEB3_REQUEST",id:e,request:r};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:r.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(r.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof l4)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e,r){if(r.method==="requestEthereumAccounts"){Ro.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,r)),Ro.accountRequestCallbackIds.clear();return}this.invokeCallback(e,r)}handleErrorResponse(e,r,n){var i;const s=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:r,errorMessage:s})}invokeCallback(e,r){const n=this.relayEventManager.callbacks.get(e);n&&(n(r),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:r}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:r}},i=lc(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(Hn(a))return o(new Error(a.errorMessage));s(a)}),Ro.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,r,n,i,s,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:o}};let u=null;const l=lc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));p(A)}),this.publishWeb3RequestEvent(l,a)})}addEthereumChain(e,r,n,i,s,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:o}};let u=null;const l=lc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,A=>{if(u==null||u(),Hn(A))return y(new Error(A.errorMessage));p(A)}),this.publishWeb3RequestEvent(l,a)})}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})};let i=null;const s=lc(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,u)=>{this.relayEventManager.callbacks.set(s,l=>{if(i==null||i(),Hn(l)&&l.errorCode)return u(Sr.provider.custom({code:l.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(Hn(l))return u(new Error(l.errorMessage));a(l)}),this.publishWeb3RequestEvent(s,n)})}}Ro.accountRequestCallbackIds=new Set;const h4="DefaultChainId",d4="DefaultJsonRpcUrl";class p4{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new Ys("walletlink",f4),this.callback=e.callback||null;const r=this._storage.getItem(W1);if(r){const n=r.split(" ");n[0]!==""&&(this._addresses=n.map(i=>ga(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:r,secret:n}=e.getWalletLinkSession();return{id:r,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(d4))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(d4,e)}updateProviderInfo(e,r){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(h4,r.toString(10)),Ll(r)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",pa(r)))}async watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw Sr.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw Sr.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw Sr.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw Sr.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=r.options,l=await this.initializeRelay().watchAsset(r.type,i,s,a,o,n==null?void 0:n.toString());return Hn(l)?!1:!!l.result}async addEthereumChain(e){var r,n;const i=e[0];if(((r=i.rpcUrls)===null||r===void 0?void 0:r.length)===0)throw Sr.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw Sr.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw Sr.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:u=[],chainName:l,iconUrls:d=[],nativeCurrency:p}=i,y=await o.addEthereumChain(s.toString(),a,d,u,l,p);if(Hn(y))return!1;if(((n=y.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw Sr.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const r=e[0],n=Number.parseInt(r.chainId,16),s=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(Hn(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,r){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(s=>ga(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(W1,i.join(" ")))}async request(e){const r=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return pa(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(r);case"wallet_switchEthereumChain":return this.switchEthereumChain(r);case"wallet_watchAsset":return this.watchAsset(r);default:if(!this.jsonRpcUrl)throw Sr.rpc.internal("No RPC URL set for chain");return g5(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const r=ga(e);if(!this._addresses.map(i=>ga(i)).includes(r))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?ga(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?ga(e.to):null,i=e.value!=null?kl(e.value):BigInt(0),s=e.data?j1(e.data):Buffer.alloc(0),o=e.nonce!=null?Ll(e.nonce):null,a=e.gasPrice!=null?kl(e.gasPrice):null,u=e.maxFeePerGas!=null?kl(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?kl(e.maxPriorityFeePerGas):null,d=e.gas!=null?kl(e.gas):null,p=e.chainId?Ll(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:u,maxPriorityFeePerGas:l,gasLimit:d,chainId:p}}async ecRecover(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:B1(n[0]),signature:B1(n[1]),addPrefix:r==="personal_ecRecover"}});if(Hn(s))throw s;return s.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(h4))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,r;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:pa(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(Hn(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:pa(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw Sr.rpc.invalidParams();const r=e[1],n=e[0];this._ensureKnownAddress(r);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ga(r),message:B1(n),addPrefix:!0,typedDataJson:null}});if(Hn(s))throw s;return s.result}async _eth_signTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(r);if(Hn(i))throw i;return i.result}async _eth_sendRawTransaction(e){const r=j1(e[0]),i=await this.initializeRelay().submitEthereumTransaction(r,this.getChainId());if(Hn(i))throw i;return i.result}async _eth_sendTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(r);if(Hn(i))throw i;return i.result}async signTypedData(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Sr.rpc.invalidParams();const i=l=>{const d={eth_signTypedData_v1:o0.hashForSignTypedDataLegacy,eth_signTypedData_v3:o0.hashForSignTypedData_v3,eth_signTypedData_v4:o0.hashForSignTypedData_v4,eth_signTypedData:o0.hashForSignTypedData_v4};return Nl(d[r]({data:Ez(l)}),!0)},s=n[r==="eth_signTypedData_v1"?1:0],o=n[r==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const u=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ga(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(Hn(u))throw u;return u.result}initializeRelay(){return this._relay||(this._relay=new Ro({linkAPIUrl:f4,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const g4="SignerType",m4=new Ys("CBWSDK","SignerConfigurator");function RH(){return m4.getItem(g4)}function DH(t){m4.setItem(g4,t)}async function OH(t){const{communicator:e,metadata:r,handshakeRequest:n,callback:i}=t;LH(e,r,i).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:o}=await e.postRequestAndWaitForResponse(s);return o}function NH(t){const{signerType:e,metadata:r,communicator:n,callback:i}=t;switch(e){case"scw":return new kz({metadata:r,callback:i,communicator:n});case"walletlink":return new p4({metadata:r,callback:i})}}async function LH(t,e,r){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new p4({metadata:e,callback:r});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const kH=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. -Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,BH=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,r=await fetch(e,{method:"HEAD"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const n=r.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(kH)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:$H,getCrossOriginOpenerPolicy:FH}=BH(),b4=420,y4=540;function jH(t){const e=(window.innerWidth-b4)/2+window.screenX,r=(window.innerHeight-y4)/2+window.screenY;qH(t);const n=window.open(t,"Smart Wallet",`width=${b4}, height=${y4}, left=${e}, top=${r}`);if(n==null||n.focus(),!n)throw Sr.rpc.internal("Pop up window failed to open");return n}function UH(t){t&&!t.closed&&t.close()}function qH(t){const e={sdkName:g5,sdkVersion:Bl,origin:window.location.origin,coop:FH()};for(const[r,n]of Object.entries(e))t.searchParams.append(r,n.toString())}class zH{constructor({url:e=CH,metadata:r,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=u=>{if(u.origin!==this.url.origin)return;const l=u.data;i(l)&&(s(l),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{UH(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(Sr.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=jH(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:Bl,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw Sr.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=r,this.preference=n}}function HH(t){const e=bz(WH(t),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",Bl),r.searchParams.set("code",e.code.toString()),r.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:r.href})}function WH(t){var e;if(typeof t=="string")return{message:t,code:cn.rpc.internal};if(Hn(t)){const r=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:r.match(/(denied|rejected)/i)?cn.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:r,code:n,data:{method:t.method}})}return t}var w4={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,l,d){this.fn=u,this.context=l,this.once=d||!1}function s(u,l,d,p,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var A=new i(d,p||u,y),P=r?r+l:l;return u._events[P]?u._events[P].fn?u._events[P]=[u._events[P],A]:u._events[P].push(A):(u._events[P]=A,u._eventsCount++),u}function o(u,l){--u._eventsCount===0?u._events=new n:delete u._events[l]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,p;if(this._eventsCount===0)return l;for(p in d=this._events)e.call(d,p)&&l.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=r?r+l:l,p=this._events[d];if(!p)return[];if(p.fn)return[p.fn];for(var y=0,A=p.length,P=new Array(A);y(i||(i=ZH(n)),i)}}function x4(t,e){return function(){return t.apply(e,arguments)}}const{toString:tW}=Object.prototype,{getPrototypeOf:iv}=Object,p0=(t=>e=>{const r=tW.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Es=t=>(t=t.toLowerCase(),e=>p0(e)===t),g0=t=>e=>typeof e===t,{isArray:Nu}=Array,ql=g0("undefined");function rW(t){return t!==null&&!ql(t)&&t.constructor!==null&&!ql(t.constructor)&&Oi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const _4=Es("ArrayBuffer");function nW(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&_4(t.buffer),e}const iW=g0("string"),Oi=g0("function"),E4=g0("number"),m0=t=>t!==null&&typeof t=="object",sW=t=>t===!0||t===!1,v0=t=>{if(p0(t)!=="object")return!1;const e=iv(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},oW=Es("Date"),aW=Es("File"),cW=Es("Blob"),uW=Es("FileList"),fW=t=>m0(t)&&Oi(t.pipe),lW=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Oi(t.append)&&((e=p0(t))==="formdata"||e==="object"&&Oi(t.toString)&&t.toString()==="[object FormData]"))},hW=Es("URLSearchParams"),[dW,pW,gW,mW]=["ReadableStream","Request","Response","Headers"].map(Es),vW=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function zl(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Nu(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const pc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,A4=t=>!ql(t)&&t!==pc;function sv(){const{caseless:t}=A4(this)&&this||{},e={},r=(n,i)=>{const s=t&&S4(e,i)||i;v0(e[s])&&v0(n)?e[s]=sv(e[s],n):v0(n)?e[s]=sv({},n):Nu(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(zl(e,(i,s)=>{r&&Oi(i)?t[s]=x4(i,r):t[s]=i},{allOwnKeys:n}),t),yW=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),wW=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},xW=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&iv(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},_W=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},EW=t=>{if(!t)return null;if(Nu(t))return t;let e=t.length;if(!E4(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},SW=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&iv(Uint8Array)),AW=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},PW=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},MW=Es("HTMLFormElement"),IW=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),P4=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),CW=Es("RegExp"),M4=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};zl(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},TW=t=>{M4(t,(e,r)=>{if(Oi(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Oi(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},RW=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Nu(t)?n(t):n(String(t).split(e)),r},DW=()=>{},OW=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,ov="abcdefghijklmnopqrstuvwxyz",I4="0123456789",C4={DIGIT:I4,ALPHA:ov,ALPHA_DIGIT:ov+ov.toUpperCase()+I4},NW=(t=16,e=C4.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function LW(t){return!!(t&&Oi(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const kW=t=>{const e=new Array(10),r=(n,i)=>{if(m0(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Nu(n)?[]:{};return zl(n,(o,a)=>{const u=r(o,i+1);!ql(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},BW=Es("AsyncFunction"),$W=t=>t&&(m0(t)||Oi(t))&&Oi(t.then)&&Oi(t.catch),T4=((t,e)=>t?setImmediate:e?((r,n)=>(pc.addEventListener("message",({source:i,data:s})=>{i===pc&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),pc.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Oi(pc.postMessage)),FW=typeof queueMicrotask<"u"?queueMicrotask.bind(pc):typeof process<"u"&&process.nextTick||T4,Oe={isArray:Nu,isArrayBuffer:_4,isBuffer:rW,isFormData:lW,isArrayBufferView:nW,isString:iW,isNumber:E4,isBoolean:sW,isObject:m0,isPlainObject:v0,isReadableStream:dW,isRequest:pW,isResponse:gW,isHeaders:mW,isUndefined:ql,isDate:oW,isFile:aW,isBlob:cW,isRegExp:CW,isFunction:Oi,isStream:fW,isURLSearchParams:hW,isTypedArray:SW,isFileList:uW,forEach:zl,merge:sv,extend:bW,trim:vW,stripBOM:yW,inherits:wW,toFlatObject:xW,kindOf:p0,kindOfTest:Es,endsWith:_W,toArray:EW,forEachEntry:AW,matchAll:PW,isHTMLForm:MW,hasOwnProperty:P4,hasOwnProp:P4,reduceDescriptors:M4,freezeMethods:TW,toObjectSet:RW,toCamelCase:IW,noop:DW,toFiniteNumber:OW,findKey:S4,global:pc,isContextDefined:A4,ALPHABET:C4,generateString:NW,isSpecCompliantForm:LW,toJSONObject:kW,isAsyncFn:BW,isThenable:$W,setImmediate:T4,asap:FW};function ar(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Oe.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const R4=ar.prototype,D4={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{D4[t]={value:t}}),Object.defineProperties(ar,D4),Object.defineProperty(R4,"isAxiosError",{value:!0}),ar.from=(t,e,r,n,i,s)=>{const o=Object.create(R4);return Oe.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),ar.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const jW=null;function av(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function O4(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function N4(t,e,r){return t?t.concat(e).map(function(i,s){return i=O4(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function UW(t){return Oe.isArray(t)&&!t.some(av)}const qW=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function b0(t,e,r){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Oe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(N,D){return!Oe.isUndefined(D[N])});const n=r.metaTokens,i=r.visitor||d,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(i))throw new TypeError("visitor must be a function");function l(P){if(P===null)return"";if(Oe.isDate(P))return P.toISOString();if(!u&&Oe.isBlob(P))throw new ar("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(P)||Oe.isTypedArray(P)?u&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function d(P,N,D){let k=P;if(P&&!D&&typeof P=="object"){if(Oe.endsWith(N,"{}"))N=n?N:N.slice(0,-2),P=JSON.stringify(P);else if(Oe.isArray(P)&&UW(P)||(Oe.isFileList(P)||Oe.endsWith(N,"[]"))&&(k=Oe.toArray(P)))return N=O4(N),k.forEach(function(q,j){!(Oe.isUndefined(q)||q===null)&&e.append(o===!0?N4([N],j,s):o===null?N:N+"[]",l(q))}),!1}return av(P)?!0:(e.append(N4(D,N,s),l(P)),!1)}const p=[],y=Object.assign(qW,{defaultVisitor:d,convertValue:l,isVisitable:av});function A(P,N){if(!Oe.isUndefined(P)){if(p.indexOf(P)!==-1)throw Error("Circular reference detected in "+N.join("."));p.push(P),Oe.forEach(P,function(k,B){(!(Oe.isUndefined(k)||k===null)&&i.call(e,k,Oe.isString(B)?B.trim():B,N,y))===!0&&A(k,N?N.concat(B):[B])}),p.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return A(t),e}function L4(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function cv(t,e){this._pairs=[],t&&b0(t,this,e)}const k4=cv.prototype;k4.append=function(e,r){this._pairs.push([e,r])},k4.toString=function(e){const r=e?function(n){return e.call(this,n,L4)}:L4;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function zW(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function B4(t,e,r){if(!e)return t;const n=r&&r.encode||zW;Oe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(e,r):s=Oe.isURLSearchParams(e)?e.toString():new cv(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class $4{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(n){n!==null&&e(n)})}}const F4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},HW={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:cv,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},uv=typeof window<"u"&&typeof document<"u",fv=typeof navigator=="object"&&navigator||void 0,WW=uv&&(!fv||["ReactNative","NativeScript","NS"].indexOf(fv.product)<0),KW=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",VW=uv&&window.location.href||"http://localhost",Xn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:uv,hasStandardBrowserEnv:WW,hasStandardBrowserWebWorkerEnv:KW,navigator:fv,origin:VW},Symbol.toStringTag,{value:"Module"})),...HW};function GW(t,e){return b0(t,new Xn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Xn.isNode&&Oe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function YW(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function JW(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&Oe.isArray(i)?i.length:o,u?(Oe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Oe.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Oe.isArray(i[o])&&(i[o]=JW(i[o])),!a)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const r={};return Oe.forEachEntry(t,(n,i)=>{e(YW(n),i,r,0)}),r}return null}function XW(t,e,r){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const Hl={transitional:F4,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Oe.isObject(e);if(s&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return i?JSON.stringify(j4(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return GW(e,this.formSerializer).toString();if((a=Oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return b0(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),XW(e)):e}],transformResponse:[function(e){const r=this.transitional||Hl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ar.from(a,ar.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xn.classes.FormData,Blob:Xn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{Hl.headers[t]={}});const ZW=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),QW=t=>{const e={};let r,n,i;return t&&t.split(` -`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&ZW[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},U4=Symbol("internals");function Wl(t){return t&&String(t).trim().toLowerCase()}function y0(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(y0):String(t)}function eK(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const tK=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function lv(t,e,r,n,i){if(Oe.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Oe.isString(e)){if(Oe.isString(n))return e.indexOf(n)!==-1;if(Oe.isRegExp(n))return n.test(e)}}function rK(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function nK(t,e){const r=Oe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}let wi=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,u,l){const d=Wl(u);if(!d)throw new Error("header name must be a non-empty string");const p=Oe.findKey(i,d);(!p||i[p]===void 0||l===!0||l===void 0&&i[p]!==!1)&&(i[p||u]=y0(a))}const o=(a,u)=>Oe.forEach(a,(l,d)=>s(l,d,u));if(Oe.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(Oe.isString(e)&&(e=e.trim())&&!tK(e))o(QW(e),r);else if(Oe.isHeaders(e))for(const[a,u]of e.entries())s(u,a,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return eK(i);if(Oe.isFunction(r))return r.call(this,i,n);if(Oe.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||lv(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=Wl(o),o){const a=Oe.findKey(n,o);a&&(!r||lv(n,n[a],a,r))&&(delete n[a],i=!0)}}return Oe.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||lv(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Oe.forEach(this,(i,s)=>{const o=Oe.findKey(n,s);if(o){r[o]=y0(i),delete r[s];return}const a=e?rK(s):String(s).trim();a!==s&&delete r[s],r[a]=y0(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Oe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Oe.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[U4]=this[U4]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Wl(o);n[a]||(nK(i,o),n[a]=!0)}return Oe.isArray(e)?e.forEach(s):s(e),this}};wi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Oe.reduceDescriptors(wi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),Oe.freezeMethods(wi);function hv(t,e){const r=this||Hl,n=e||r,i=wi.from(n.headers);let s=n.data;return Oe.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function q4(t){return!!(t&&t.__CANCEL__)}function Lu(t,e,r){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,r),this.name="CanceledError"}Oe.inherits(Lu,ar,{__CANCEL__:!0});function z4(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new ar("Request failed with status code "+r.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function iK(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function sK(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),d=n[s];o||(o=l),r[i]=u,n[i]=l;let p=s,y=0;for(;p!==i;)y+=r[p++],p=p%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),l-o{r=d,i=null,s&&(clearTimeout(s),s=null),t.apply(null,l)};return[(...l)=>{const d=Date.now(),p=d-r;p>=n?o(l,d):(i=l,s||(s=setTimeout(()=>{s=null,o(i)},n-p)))},()=>i&&o(i)]}const w0=(t,e,r=3)=>{let n=0;const i=sK(50,250);return oK(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,u=o-n,l=i(u),d=o<=a;n=o;const p={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:l||void 0,estimated:l&&a&&d?(a-o)/l:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(p)},r)},H4=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},W4=t=>(...e)=>Oe.asap(()=>t(...e)),aK=Xn.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Xn.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Xn.origin),Xn.navigator&&/(msie|trident)/i.test(Xn.navigator.userAgent)):()=>!0,cK=Xn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];Oe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Oe.isString(n)&&o.push("path="+n),Oe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function uK(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function fK(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function K4(t,e){return t&&!uK(e)?fK(t,e):e}const V4=t=>t instanceof wi?{...t}:t;function gc(t,e){e=e||{};const r={};function n(l,d,p,y){return Oe.isPlainObject(l)&&Oe.isPlainObject(d)?Oe.merge.call({caseless:y},l,d):Oe.isPlainObject(d)?Oe.merge({},d):Oe.isArray(d)?d.slice():d}function i(l,d,p,y){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l,p,y)}else return n(l,d,p,y)}function s(l,d){if(!Oe.isUndefined(d))return n(void 0,d)}function o(l,d){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l)}else return n(void 0,d)}function a(l,d,p){if(p in e)return n(l,d);if(p in t)return n(void 0,l)}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,d,p)=>i(V4(l),V4(d),p,!0)};return Oe.forEach(Object.keys(Object.assign({},t,e)),function(d){const p=u[d]||i,y=p(t[d],e[d],d);Oe.isUndefined(y)&&p!==a||(r[d]=y)}),r}const G4=t=>{const e=gc({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=wi.from(o),e.url=B4(K4(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(Oe.isFormData(r)){if(Xn.hasStandardBrowserEnv||Xn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[l,...d]=u?u.split(";").map(p=>p.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...d].join("; "))}}if(Xn.hasStandardBrowserEnv&&(n&&Oe.isFunction(n)&&(n=n(e)),n||n!==!1&&aK(e.url))){const l=i&&s&&cK.read(s);l&&o.set(i,l)}return e},lK=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=G4(t);let s=i.data;const o=wi.from(i.headers).normalize();let{responseType:a,onUploadProgress:u,onDownloadProgress:l}=i,d,p,y,A,P;function N(){A&&A(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let D=new XMLHttpRequest;D.open(i.method.toUpperCase(),i.url,!0),D.timeout=i.timeout;function k(){if(!D)return;const q=wi.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),H={data:!a||a==="text"||a==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:q,config:t,request:D};z4(function(T){r(T),N()},function(T){n(T),N()},H),D=null}"onloadend"in D?D.onloadend=k:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(k)},D.onabort=function(){D&&(n(new ar("Request aborted",ar.ECONNABORTED,t,D)),D=null)},D.onerror=function(){n(new ar("Network Error",ar.ERR_NETWORK,t,D)),D=null},D.ontimeout=function(){let j=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const H=i.transitional||F4;i.timeoutErrorMessage&&(j=i.timeoutErrorMessage),n(new ar(j,H.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,D)),D=null},s===void 0&&o.setContentType(null),"setRequestHeader"in D&&Oe.forEach(o.toJSON(),function(j,H){D.setRequestHeader(H,j)}),Oe.isUndefined(i.withCredentials)||(D.withCredentials=!!i.withCredentials),a&&a!=="json"&&(D.responseType=i.responseType),l&&([y,P]=w0(l,!0),D.addEventListener("progress",y)),u&&D.upload&&([p,A]=w0(u),D.upload.addEventListener("progress",p),D.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(d=q=>{D&&(n(!q||q.type?new Lu(null,t,D):q),D.abort(),D=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const B=iK(i.url);if(B&&Xn.protocols.indexOf(B)===-1){n(new ar("Unsupported protocol "+B+":",ar.ERR_BAD_REQUEST,t));return}D.send(s||null)})},hK=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i;const s=function(l){if(!i){i=!0,a();const d=l instanceof Error?l:this.reason;n.abort(d instanceof ar?d:new Lu(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,s(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),t=null)};t.forEach(l=>l.addEventListener("abort",s));const{signal:u}=n;return u.unsubscribe=()=>Oe.asap(a),u}},dK=function*(t,e){let r=t.byteLength;if(r{const i=pK(t,e);let s=0,o,a=u=>{o||(o=!0,n&&n(u))};return new ReadableStream({async pull(u){try{const{done:l,value:d}=await i.next();if(l){a(),u.close();return}let p=d.byteLength;if(r){let y=s+=p;r(y)}u.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(u){return a(u),i.return()}},{highWaterMark:2})},x0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",J4=x0&&typeof ReadableStream=="function",mK=x0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),X4=(t,...e)=>{try{return!!t(...e)}catch{return!1}},vK=J4&&X4(()=>{let t=!1;const e=new Request(Xn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Z4=64*1024,dv=J4&&X4(()=>Oe.isReadableStream(new Response("").body)),_0={stream:dv&&(t=>t.body)};x0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!_0[e]&&(_0[e]=Oe.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,n)})})})(new Response);const bK=async t=>{if(t==null)return 0;if(Oe.isBlob(t))return t.size;if(Oe.isSpecCompliantForm(t))return(await new Request(Xn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(t)||Oe.isArrayBuffer(t))return t.byteLength;if(Oe.isURLSearchParams(t)&&(t=t+""),Oe.isString(t))return(await mK(t)).byteLength},yK=async(t,e)=>{const r=Oe.toFiniteNumber(t.getContentLength());return r??bK(e)},pv={http:jW,xhr:lK,fetch:x0&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:l,headers:d,withCredentials:p="same-origin",fetchOptions:y}=G4(t);l=l?(l+"").toLowerCase():"text";let A=hK([i,s&&s.toAbortSignal()],o),P;const N=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let D;try{if(u&&vK&&r!=="get"&&r!=="head"&&(D=await yK(d,n))!==0){let H=new Request(e,{method:"POST",body:n,duplex:"half"}),J;if(Oe.isFormData(n)&&(J=H.headers.get("content-type"))&&d.setContentType(J),H.body){const[T,z]=H4(D,w0(W4(u)));n=Y4(H.body,Z4,T,z)}}Oe.isString(p)||(p=p?"include":"omit");const k="credentials"in Request.prototype;P=new Request(e,{...y,signal:A,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:k?p:void 0});let B=await fetch(P);const q=dv&&(l==="stream"||l==="response");if(dv&&(a||q&&N)){const H={};["status","statusText","headers"].forEach(ue=>{H[ue]=B[ue]});const J=Oe.toFiniteNumber(B.headers.get("content-length")),[T,z]=a&&H4(J,w0(W4(a),!0))||[];B=new Response(Y4(B.body,Z4,T,()=>{z&&z(),N&&N()}),H)}l=l||"text";let j=await _0[Oe.findKey(_0,l)||"text"](B,t);return!q&&N&&N(),await new Promise((H,J)=>{z4(H,J,{data:j,headers:wi.from(B.headers),status:B.status,statusText:B.statusText,config:t,request:P})})}catch(k){throw N&&N(),k&&k.name==="TypeError"&&/fetch/i.test(k.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,P),{cause:k.cause||k}):ar.from(k,k&&k.code,t,P)}})};Oe.forEach(pv,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Q4=t=>`- ${t}`,wK=t=>Oe.isFunction(t)||t===null||t===!1,e8={getAdapter:t=>{t=Oe.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : -`+s.map(Q4).join(` -`):" "+Q4(s[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:pv};function gv(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Lu(null,t)}function t8(t){return gv(t),t.headers=wi.from(t.headers),t.data=hv.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),e8.getAdapter(t.adapter||Hl.adapter)(t).then(function(n){return gv(t),n.data=hv.call(t,t.transformResponse,n),n.headers=wi.from(n.headers),n},function(n){return q4(n)||(gv(t),n&&n.response&&(n.response.data=hv.call(t,t.transformResponse,n.response),n.response.headers=wi.from(n.response.headers))),Promise.reject(n)})}const r8="1.7.8",E0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{E0[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const n8={};E0.transitional=function(e,r,n){function i(s,o){return"[Axios v"+r8+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new ar(i(o," has been removed"+(r?" in "+r:"")),ar.ERR_DEPRECATED);return r&&!n8[o]&&(n8[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}},E0.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function xK(t,e,r){if(typeof t!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new ar("option "+s+" must be "+u,ar.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ar("Unknown option "+s,ar.ERR_BAD_OPTION)}}const S0={assertOptions:xK,validators:E0},Zs=S0.validators;let mc=class{constructor(e){this.defaults=e,this.interceptors={request:new $4,response:new $4}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` -`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=gc(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&S0.assertOptions(n,{silentJSONParsing:Zs.transitional(Zs.boolean),forcedJSONParsing:Zs.transitional(Zs.boolean),clarifyTimeoutError:Zs.transitional(Zs.boolean)},!1),i!=null&&(Oe.isFunction(i)?r.paramsSerializer={serialize:i}:S0.assertOptions(i,{encode:Zs.function,serialize:Zs.function},!0)),S0.assertOptions(r,{baseUrl:Zs.spelling("baseURL"),withXsrfToken:Zs.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Oe.merge(s.common,s[r.method]);s&&Oe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete s[P]}),r.headers=wi.concat(o,s);const a=[];let u=!0;this.interceptors.request.forEach(function(N){typeof N.runWhen=="function"&&N.runWhen(r)===!1||(u=u&&N.synchronous,a.unshift(N.fulfilled,N.rejected))});const l=[];this.interceptors.response.forEach(function(N){l.push(N.fulfilled,N.rejected)});let d,p=0,y;if(!u){const P=[t8.bind(this),void 0];for(P.unshift.apply(P,a),P.push.apply(P,l),y=P.length,d=Promise.resolve(r);p{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new Lu(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new JA(function(i){e=i}),cancel:e}}};function EK(t){return function(r){return t.apply(null,r)}}function SK(t){return Oe.isObject(t)&&t.isAxiosError===!0}const mv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(mv).forEach(([t,e])=>{mv[e]=t});function i8(t){const e=new mc(t),r=x4(mc.prototype.request,e);return Oe.extend(r,mc.prototype,e,{allOwnKeys:!0}),Oe.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return i8(gc(t,i))},r}const fn=i8(Hl);fn.Axios=mc,fn.CanceledError=Lu,fn.CancelToken=_K,fn.isCancel=q4,fn.VERSION=r8,fn.toFormData=b0,fn.AxiosError=ar,fn.Cancel=fn.CanceledError,fn.all=function(e){return Promise.all(e)},fn.spread=EK,fn.isAxiosError=SK,fn.mergeConfig=gc,fn.AxiosHeaders=wi,fn.formToJSON=t=>j4(Oe.isHTMLForm(t)?new FormData(t):t),fn.getAdapter=e8.getAdapter,fn.HttpStatusCode=mv,fn.default=fn;const{Axios:$oe,AxiosError:s8,CanceledError:Foe,isCancel:joe,CancelToken:Uoe,VERSION:qoe,all:zoe,Cancel:Hoe,isAxiosError:Woe,spread:Koe,toFormData:Voe,AxiosHeaders:Goe,HttpStatusCode:Yoe,formToJSON:Joe,getAdapter:Xoe,mergeConfig:Zoe}=fn,o8=fn.create({timeout:6e4,headers:{"Content-Type":"application/json",token:localStorage.getItem("auth")}});function AK(t){var e,r,n;if(((e=t.data)==null?void 0:e.success)!==!0){const i=new s8((r=t.data)==null?void 0:r.errorMessage,(n=t.data)==null?void 0:n.errorCode,t.config,t.request,t);return Promise.reject(i)}else return t}function PK(t){var r;console.log(t);const e=(r=t.response)==null?void 0:r.data;if(e){console.log(e,"responseData");const n=new s8(e.errorMessage,t.code,t.config,t.request,t.response);return Promise.reject(n)}else return Promise.reject(t)}o8.interceptors.response.use(AK,PK);class MK{constructor(e){oo(this,"_apiBase","");this.request=e}setApiBase(e){this._apiBase=e||""}async getNonce(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/nonce`,e);return r.data}async getEmailCode(e,r){const{data:n}=await this.request.post(`${this._apiBase}/api/v2/user/get_code`,e,{headers:{"Captcha-Param":r}});return n.data}async emailLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async walletLogin(e){return e.account_enum==="C"?(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data:(await this.request.post(`${this._apiBase}/api/v2/business/login`,e)).data}async tonLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async bindEmail(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindTonWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindEvmWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}}const va=new MK(o8),IK={projectId:"7a4434fefbcc9af474fb5c995e47d286",metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},a8=eW({appName:"codatta",appLogoUrl:"https://avatars.githubusercontent.com/u/171659315"}),c8=Ee.createContext({saveLastUsedWallet:()=>{},lastUsedWallet:null,wallets:[],initialized:!1,featuredWallets:[]});function Kl(){return Ee.useContext(c8)}function CK(t){const{apiBaseUrl:e}=t,[r,n]=Ee.useState([]),[i,s]=Ee.useState([]),[o,a]=Ee.useState(null),[u,l]=Ee.useState(!1),d=A=>{a(A);const N={provider:A.provider instanceof R1?"UniversalProvider":"EIP1193Provider",key:A.key,timestamp:Date.now()};localStorage.setItem("xn-last-used-info",JSON.stringify(N))};function p(A){const P=A.filter(k=>k.featured||k.installed),N=A.filter(k=>!k.featured&&!k.installed),D=[...P,...N];n(D),s(P)}async function y(){const A=[],P=new Map;QA.forEach(D=>{const k=new ru(D);D.name==="Coinbase Wallet"&&k.EIP6963Detected({info:{name:"Coinbase Wallet",uuid:"coinbase",icon:D.image,rdns:"coinbase"},provider:a8.getProvider()}),P.set(k.key,k),A.push(k)}),(await gz()).forEach(D=>{const k=P.get(D.info.name);if(k)k.EIP6963Detected(D);else{const B=new ru(D);P.set(B.key,B),A.push(B)}console.log(D)});try{const D=JSON.parse(localStorage.getItem("xn-last-used-info")||"{}"),k=P.get(D.key);if(k){if(k.lastUsed=!0,D.provider==="UniversalProvider"){const B=await R1.init(IK);B.session&&(k.setUniversalProvider(B),console.log("Restored UniversalProvider for wallet:",k.key))}else D.provider==="EIP1193Provider"&&k.installed&&console.log("Using detected EIP1193Provider for wallet:",k.key);a(k)}}catch(D){console.log(D)}p(A),l(!0)}return Ee.useEffect(()=>{y(),va.setApiBase(e)},[]),ge.jsx(c8.Provider,{value:{saveLastUsedWallet:d,wallets:r,initialized:u,lastUsedWallet:o,featuredWallets:i},children:t.children})}/** +Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,BH=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,r=await fetch(e,{method:"HEAD"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const n=r.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(kH)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:$H,getCrossOriginOpenerPolicy:FH}=BH(),v4=420,b4=540;function jH(t){const e=(window.innerWidth-v4)/2+window.screenX,r=(window.innerHeight-b4)/2+window.screenY;qH(t);const n=window.open(t,"Smart Wallet",`width=${v4}, height=${b4}, left=${e}, top=${r}`);if(n==null||n.focus(),!n)throw Sr.rpc.internal("Pop up window failed to open");return n}function UH(t){t&&!t.closed&&t.close()}function qH(t){const e={sdkName:p5,sdkVersion:Bl,origin:window.location.origin,coop:FH()};for(const[r,n]of Object.entries(e))t.searchParams.append(r,n.toString())}class zH{constructor({url:e=CH,metadata:r,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=u=>{if(u.origin!==this.url.origin)return;const l=u.data;i(l)&&(s(l),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{UH(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(Sr.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=jH(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:Bl,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw Sr.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=r,this.preference=n}}function HH(t){const e=bz(WH(t),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",Bl),r.searchParams.set("code",e.code.toString()),r.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:r.href})}function WH(t){var e;if(typeof t=="string")return{message:t,code:cn.rpc.internal};if(Hn(t)){const r=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:r.match(/(denied|rejected)/i)?cn.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:r,code:n,data:{method:t.method}})}return t}var y4={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,l,d){this.fn=u,this.context=l,this.once=d||!1}function s(u,l,d,p,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var A=new i(d,p||u,y),P=r?r+l:l;return u._events[P]?u._events[P].fn?u._events[P]=[u._events[P],A]:u._events[P].push(A):(u._events[P]=A,u._eventsCount++),u}function o(u,l){--u._eventsCount===0?u._events=new n:delete u._events[l]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,p;if(this._eventsCount===0)return l;for(p in d=this._events)e.call(d,p)&&l.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=r?r+l:l,p=this._events[d];if(!p)return[];if(p.fn)return[p.fn];for(var y=0,A=p.length,P=new Array(A);y(i||(i=ZH(n)),i)}}function w4(t,e){return function(){return t.apply(e,arguments)}}const{toString:tW}=Object.prototype,{getPrototypeOf:iv}=Object,p0=(t=>e=>{const r=tW.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Es=t=>(t=t.toLowerCase(),e=>p0(e)===t),g0=t=>e=>typeof e===t,{isArray:Nu}=Array,ql=g0("undefined");function rW(t){return t!==null&&!ql(t)&&t.constructor!==null&&!ql(t.constructor)&&Oi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const x4=Es("ArrayBuffer");function nW(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&x4(t.buffer),e}const iW=g0("string"),Oi=g0("function"),_4=g0("number"),m0=t=>t!==null&&typeof t=="object",sW=t=>t===!0||t===!1,v0=t=>{if(p0(t)!=="object")return!1;const e=iv(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},oW=Es("Date"),aW=Es("File"),cW=Es("Blob"),uW=Es("FileList"),fW=t=>m0(t)&&Oi(t.pipe),lW=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Oi(t.append)&&((e=p0(t))==="formdata"||e==="object"&&Oi(t.toString)&&t.toString()==="[object FormData]"))},hW=Es("URLSearchParams"),[dW,pW,gW,mW]=["ReadableStream","Request","Response","Headers"].map(Es),vW=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function zl(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Nu(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const pc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,S4=t=>!ql(t)&&t!==pc;function sv(){const{caseless:t}=S4(this)&&this||{},e={},r=(n,i)=>{const s=t&&E4(e,i)||i;v0(e[s])&&v0(n)?e[s]=sv(e[s],n):v0(n)?e[s]=sv({},n):Nu(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(zl(e,(i,s)=>{r&&Oi(i)?t[s]=w4(i,r):t[s]=i},{allOwnKeys:n}),t),yW=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),wW=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},xW=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&iv(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},_W=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},EW=t=>{if(!t)return null;if(Nu(t))return t;let e=t.length;if(!_4(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},SW=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&iv(Uint8Array)),AW=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},PW=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},MW=Es("HTMLFormElement"),IW=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),A4=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),CW=Es("RegExp"),P4=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};zl(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},TW=t=>{P4(t,(e,r)=>{if(Oi(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Oi(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},RW=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Nu(t)?n(t):n(String(t).split(e)),r},DW=()=>{},OW=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,ov="abcdefghijklmnopqrstuvwxyz",M4="0123456789",I4={DIGIT:M4,ALPHA:ov,ALPHA_DIGIT:ov+ov.toUpperCase()+M4},NW=(t=16,e=I4.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function LW(t){return!!(t&&Oi(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const kW=t=>{const e=new Array(10),r=(n,i)=>{if(m0(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Nu(n)?[]:{};return zl(n,(o,a)=>{const u=r(o,i+1);!ql(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},BW=Es("AsyncFunction"),$W=t=>t&&(m0(t)||Oi(t))&&Oi(t.then)&&Oi(t.catch),C4=((t,e)=>t?setImmediate:e?((r,n)=>(pc.addEventListener("message",({source:i,data:s})=>{i===pc&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),pc.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Oi(pc.postMessage)),FW=typeof queueMicrotask<"u"?queueMicrotask.bind(pc):typeof process<"u"&&process.nextTick||C4,Oe={isArray:Nu,isArrayBuffer:x4,isBuffer:rW,isFormData:lW,isArrayBufferView:nW,isString:iW,isNumber:_4,isBoolean:sW,isObject:m0,isPlainObject:v0,isReadableStream:dW,isRequest:pW,isResponse:gW,isHeaders:mW,isUndefined:ql,isDate:oW,isFile:aW,isBlob:cW,isRegExp:CW,isFunction:Oi,isStream:fW,isURLSearchParams:hW,isTypedArray:SW,isFileList:uW,forEach:zl,merge:sv,extend:bW,trim:vW,stripBOM:yW,inherits:wW,toFlatObject:xW,kindOf:p0,kindOfTest:Es,endsWith:_W,toArray:EW,forEachEntry:AW,matchAll:PW,isHTMLForm:MW,hasOwnProperty:A4,hasOwnProp:A4,reduceDescriptors:P4,freezeMethods:TW,toObjectSet:RW,toCamelCase:IW,noop:DW,toFiniteNumber:OW,findKey:E4,global:pc,isContextDefined:S4,ALPHABET:I4,generateString:NW,isSpecCompliantForm:LW,toJSONObject:kW,isAsyncFn:BW,isThenable:$W,setImmediate:C4,asap:FW};function ar(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Oe.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const T4=ar.prototype,R4={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{R4[t]={value:t}}),Object.defineProperties(ar,R4),Object.defineProperty(T4,"isAxiosError",{value:!0}),ar.from=(t,e,r,n,i,s)=>{const o=Object.create(T4);return Oe.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),ar.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const jW=null;function av(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function D4(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function O4(t,e,r){return t?t.concat(e).map(function(i,s){return i=D4(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function UW(t){return Oe.isArray(t)&&!t.some(av)}const qW=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function b0(t,e,r){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Oe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(O,D){return!Oe.isUndefined(D[O])});const n=r.metaTokens,i=r.visitor||d,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(i))throw new TypeError("visitor must be a function");function l(P){if(P===null)return"";if(Oe.isDate(P))return P.toISOString();if(!u&&Oe.isBlob(P))throw new ar("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(P)||Oe.isTypedArray(P)?u&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function d(P,O,D){let k=P;if(P&&!D&&typeof P=="object"){if(Oe.endsWith(O,"{}"))O=n?O:O.slice(0,-2),P=JSON.stringify(P);else if(Oe.isArray(P)&&UW(P)||(Oe.isFileList(P)||Oe.endsWith(O,"[]"))&&(k=Oe.toArray(P)))return O=D4(O),k.forEach(function(q,j){!(Oe.isUndefined(q)||q===null)&&e.append(o===!0?O4([O],j,s):o===null?O:O+"[]",l(q))}),!1}return av(P)?!0:(e.append(O4(D,O,s),l(P)),!1)}const p=[],y=Object.assign(qW,{defaultVisitor:d,convertValue:l,isVisitable:av});function A(P,O){if(!Oe.isUndefined(P)){if(p.indexOf(P)!==-1)throw Error("Circular reference detected in "+O.join("."));p.push(P),Oe.forEach(P,function(k,B){(!(Oe.isUndefined(k)||k===null)&&i.call(e,k,Oe.isString(B)?B.trim():B,O,y))===!0&&A(k,O?O.concat(B):[B])}),p.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return A(t),e}function N4(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function cv(t,e){this._pairs=[],t&&b0(t,this,e)}const L4=cv.prototype;L4.append=function(e,r){this._pairs.push([e,r])},L4.toString=function(e){const r=e?function(n){return e.call(this,n,N4)}:N4;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function zW(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function k4(t,e,r){if(!e)return t;const n=r&&r.encode||zW;Oe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(e,r):s=Oe.isURLSearchParams(e)?e.toString():new cv(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class B4{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(n){n!==null&&e(n)})}}const $4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},HW={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:cv,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},uv=typeof window<"u"&&typeof document<"u",fv=typeof navigator=="object"&&navigator||void 0,WW=uv&&(!fv||["ReactNative","NativeScript","NS"].indexOf(fv.product)<0),KW=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",VW=uv&&window.location.href||"http://localhost",Xn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:uv,hasStandardBrowserEnv:WW,hasStandardBrowserWebWorkerEnv:KW,navigator:fv,origin:VW},Symbol.toStringTag,{value:"Module"})),...HW};function GW(t,e){return b0(t,new Xn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Xn.isNode&&Oe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function YW(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function JW(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&Oe.isArray(i)?i.length:o,u?(Oe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Oe.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Oe.isArray(i[o])&&(i[o]=JW(i[o])),!a)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const r={};return Oe.forEachEntry(t,(n,i)=>{e(YW(n),i,r,0)}),r}return null}function XW(t,e,r){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const Hl={transitional:$4,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Oe.isObject(e);if(s&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return i?JSON.stringify(F4(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return GW(e,this.formSerializer).toString();if((a=Oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return b0(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),XW(e)):e}],transformResponse:[function(e){const r=this.transitional||Hl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ar.from(a,ar.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xn.classes.FormData,Blob:Xn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{Hl.headers[t]={}});const ZW=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),QW=t=>{const e={};let r,n,i;return t&&t.split(` +`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&ZW[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},j4=Symbol("internals");function Wl(t){return t&&String(t).trim().toLowerCase()}function y0(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(y0):String(t)}function eK(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const tK=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function lv(t,e,r,n,i){if(Oe.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Oe.isString(e)){if(Oe.isString(n))return e.indexOf(n)!==-1;if(Oe.isRegExp(n))return n.test(e)}}function rK(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function nK(t,e){const r=Oe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}let wi=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,u,l){const d=Wl(u);if(!d)throw new Error("header name must be a non-empty string");const p=Oe.findKey(i,d);(!p||i[p]===void 0||l===!0||l===void 0&&i[p]!==!1)&&(i[p||u]=y0(a))}const o=(a,u)=>Oe.forEach(a,(l,d)=>s(l,d,u));if(Oe.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(Oe.isString(e)&&(e=e.trim())&&!tK(e))o(QW(e),r);else if(Oe.isHeaders(e))for(const[a,u]of e.entries())s(u,a,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return eK(i);if(Oe.isFunction(r))return r.call(this,i,n);if(Oe.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Wl(e),e){const n=Oe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||lv(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=Wl(o),o){const a=Oe.findKey(n,o);a&&(!r||lv(n,n[a],a,r))&&(delete n[a],i=!0)}}return Oe.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||lv(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Oe.forEach(this,(i,s)=>{const o=Oe.findKey(n,s);if(o){r[o]=y0(i),delete r[s];return}const a=e?rK(s):String(s).trim();a!==s&&delete r[s],r[a]=y0(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Oe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Oe.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[j4]=this[j4]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Wl(o);n[a]||(nK(i,o),n[a]=!0)}return Oe.isArray(e)?e.forEach(s):s(e),this}};wi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Oe.reduceDescriptors(wi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),Oe.freezeMethods(wi);function hv(t,e){const r=this||Hl,n=e||r,i=wi.from(n.headers);let s=n.data;return Oe.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function U4(t){return!!(t&&t.__CANCEL__)}function Lu(t,e,r){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,r),this.name="CanceledError"}Oe.inherits(Lu,ar,{__CANCEL__:!0});function q4(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new ar("Request failed with status code "+r.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function iK(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function sK(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),d=n[s];o||(o=l),r[i]=u,n[i]=l;let p=s,y=0;for(;p!==i;)y+=r[p++],p=p%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),l-o{r=d,i=null,s&&(clearTimeout(s),s=null),t.apply(null,l)};return[(...l)=>{const d=Date.now(),p=d-r;p>=n?o(l,d):(i=l,s||(s=setTimeout(()=>{s=null,o(i)},n-p)))},()=>i&&o(i)]}const w0=(t,e,r=3)=>{let n=0;const i=sK(50,250);return oK(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,u=o-n,l=i(u),d=o<=a;n=o;const p={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:l||void 0,estimated:l&&a&&d?(a-o)/l:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(p)},r)},z4=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},H4=t=>(...e)=>Oe.asap(()=>t(...e)),aK=Xn.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Xn.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Xn.origin),Xn.navigator&&/(msie|trident)/i.test(Xn.navigator.userAgent)):()=>!0,cK=Xn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];Oe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Oe.isString(n)&&o.push("path="+n),Oe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function uK(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function fK(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function W4(t,e){return t&&!uK(e)?fK(t,e):e}const K4=t=>t instanceof wi?{...t}:t;function gc(t,e){e=e||{};const r={};function n(l,d,p,y){return Oe.isPlainObject(l)&&Oe.isPlainObject(d)?Oe.merge.call({caseless:y},l,d):Oe.isPlainObject(d)?Oe.merge({},d):Oe.isArray(d)?d.slice():d}function i(l,d,p,y){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l,p,y)}else return n(l,d,p,y)}function s(l,d){if(!Oe.isUndefined(d))return n(void 0,d)}function o(l,d){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l)}else return n(void 0,d)}function a(l,d,p){if(p in e)return n(l,d);if(p in t)return n(void 0,l)}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,d,p)=>i(K4(l),K4(d),p,!0)};return Oe.forEach(Object.keys(Object.assign({},t,e)),function(d){const p=u[d]||i,y=p(t[d],e[d],d);Oe.isUndefined(y)&&p!==a||(r[d]=y)}),r}const V4=t=>{const e=gc({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=wi.from(o),e.url=k4(W4(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(Oe.isFormData(r)){if(Xn.hasStandardBrowserEnv||Xn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[l,...d]=u?u.split(";").map(p=>p.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...d].join("; "))}}if(Xn.hasStandardBrowserEnv&&(n&&Oe.isFunction(n)&&(n=n(e)),n||n!==!1&&aK(e.url))){const l=i&&s&&cK.read(s);l&&o.set(i,l)}return e},lK=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=V4(t);let s=i.data;const o=wi.from(i.headers).normalize();let{responseType:a,onUploadProgress:u,onDownloadProgress:l}=i,d,p,y,A,P;function O(){A&&A(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let D=new XMLHttpRequest;D.open(i.method.toUpperCase(),i.url,!0),D.timeout=i.timeout;function k(){if(!D)return;const q=wi.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),H={data:!a||a==="text"||a==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:q,config:t,request:D};q4(function(T){r(T),O()},function(T){n(T),O()},H),D=null}"onloadend"in D?D.onloadend=k:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(k)},D.onabort=function(){D&&(n(new ar("Request aborted",ar.ECONNABORTED,t,D)),D=null)},D.onerror=function(){n(new ar("Network Error",ar.ERR_NETWORK,t,D)),D=null},D.ontimeout=function(){let j=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const H=i.transitional||$4;i.timeoutErrorMessage&&(j=i.timeoutErrorMessage),n(new ar(j,H.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,D)),D=null},s===void 0&&o.setContentType(null),"setRequestHeader"in D&&Oe.forEach(o.toJSON(),function(j,H){D.setRequestHeader(H,j)}),Oe.isUndefined(i.withCredentials)||(D.withCredentials=!!i.withCredentials),a&&a!=="json"&&(D.responseType=i.responseType),l&&([y,P]=w0(l,!0),D.addEventListener("progress",y)),u&&D.upload&&([p,A]=w0(u),D.upload.addEventListener("progress",p),D.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(d=q=>{D&&(n(!q||q.type?new Lu(null,t,D):q),D.abort(),D=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const B=iK(i.url);if(B&&Xn.protocols.indexOf(B)===-1){n(new ar("Unsupported protocol "+B+":",ar.ERR_BAD_REQUEST,t));return}D.send(s||null)})},hK=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i;const s=function(l){if(!i){i=!0,a();const d=l instanceof Error?l:this.reason;n.abort(d instanceof ar?d:new Lu(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,s(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),t=null)};t.forEach(l=>l.addEventListener("abort",s));const{signal:u}=n;return u.unsubscribe=()=>Oe.asap(a),u}},dK=function*(t,e){let r=t.byteLength;if(r{const i=pK(t,e);let s=0,o,a=u=>{o||(o=!0,n&&n(u))};return new ReadableStream({async pull(u){try{const{done:l,value:d}=await i.next();if(l){a(),u.close();return}let p=d.byteLength;if(r){let y=s+=p;r(y)}u.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(u){return a(u),i.return()}},{highWaterMark:2})},x0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Y4=x0&&typeof ReadableStream=="function",mK=x0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),J4=(t,...e)=>{try{return!!t(...e)}catch{return!1}},vK=Y4&&J4(()=>{let t=!1;const e=new Request(Xn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),X4=64*1024,dv=Y4&&J4(()=>Oe.isReadableStream(new Response("").body)),_0={stream:dv&&(t=>t.body)};x0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!_0[e]&&(_0[e]=Oe.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,n)})})})(new Response);const bK=async t=>{if(t==null)return 0;if(Oe.isBlob(t))return t.size;if(Oe.isSpecCompliantForm(t))return(await new Request(Xn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(t)||Oe.isArrayBuffer(t))return t.byteLength;if(Oe.isURLSearchParams(t)&&(t=t+""),Oe.isString(t))return(await mK(t)).byteLength},yK=async(t,e)=>{const r=Oe.toFiniteNumber(t.getContentLength());return r??bK(e)},pv={http:jW,xhr:lK,fetch:x0&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:l,headers:d,withCredentials:p="same-origin",fetchOptions:y}=V4(t);l=l?(l+"").toLowerCase():"text";let A=hK([i,s&&s.toAbortSignal()],o),P;const O=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let D;try{if(u&&vK&&r!=="get"&&r!=="head"&&(D=await yK(d,n))!==0){let H=new Request(e,{method:"POST",body:n,duplex:"half"}),J;if(Oe.isFormData(n)&&(J=H.headers.get("content-type"))&&d.setContentType(J),H.body){const[T,z]=z4(D,w0(H4(u)));n=G4(H.body,X4,T,z)}}Oe.isString(p)||(p=p?"include":"omit");const k="credentials"in Request.prototype;P=new Request(e,{...y,signal:A,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:k?p:void 0});let B=await fetch(P);const q=dv&&(l==="stream"||l==="response");if(dv&&(a||q&&O)){const H={};["status","statusText","headers"].forEach(ue=>{H[ue]=B[ue]});const J=Oe.toFiniteNumber(B.headers.get("content-length")),[T,z]=a&&z4(J,w0(H4(a),!0))||[];B=new Response(G4(B.body,X4,T,()=>{z&&z(),O&&O()}),H)}l=l||"text";let j=await _0[Oe.findKey(_0,l)||"text"](B,t);return!q&&O&&O(),await new Promise((H,J)=>{q4(H,J,{data:j,headers:wi.from(B.headers),status:B.status,statusText:B.statusText,config:t,request:P})})}catch(k){throw O&&O(),k&&k.name==="TypeError"&&/fetch/i.test(k.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,P),{cause:k.cause||k}):ar.from(k,k&&k.code,t,P)}})};Oe.forEach(pv,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Z4=t=>`- ${t}`,wK=t=>Oe.isFunction(t)||t===null||t===!1,Q4={getAdapter:t=>{t=Oe.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : +`+s.map(Z4).join(` +`):" "+Z4(s[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:pv};function gv(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Lu(null,t)}function e8(t){return gv(t),t.headers=wi.from(t.headers),t.data=hv.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Q4.getAdapter(t.adapter||Hl.adapter)(t).then(function(n){return gv(t),n.data=hv.call(t,t.transformResponse,n),n.headers=wi.from(n.headers),n},function(n){return U4(n)||(gv(t),n&&n.response&&(n.response.data=hv.call(t,t.transformResponse,n.response),n.response.headers=wi.from(n.response.headers))),Promise.reject(n)})}const t8="1.7.8",E0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{E0[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const r8={};E0.transitional=function(e,r,n){function i(s,o){return"[Axios v"+t8+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new ar(i(o," has been removed"+(r?" in "+r:"")),ar.ERR_DEPRECATED);return r&&!r8[o]&&(r8[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}},E0.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function xK(t,e,r){if(typeof t!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new ar("option "+s+" must be "+u,ar.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ar("Unknown option "+s,ar.ERR_BAD_OPTION)}}const S0={assertOptions:xK,validators:E0},Zs=S0.validators;let mc=class{constructor(e){this.defaults=e,this.interceptors={request:new B4,response:new B4}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` +`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=gc(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&S0.assertOptions(n,{silentJSONParsing:Zs.transitional(Zs.boolean),forcedJSONParsing:Zs.transitional(Zs.boolean),clarifyTimeoutError:Zs.transitional(Zs.boolean)},!1),i!=null&&(Oe.isFunction(i)?r.paramsSerializer={serialize:i}:S0.assertOptions(i,{encode:Zs.function,serialize:Zs.function},!0)),S0.assertOptions(r,{baseUrl:Zs.spelling("baseURL"),withXsrfToken:Zs.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Oe.merge(s.common,s[r.method]);s&&Oe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete s[P]}),r.headers=wi.concat(o,s);const a=[];let u=!0;this.interceptors.request.forEach(function(O){typeof O.runWhen=="function"&&O.runWhen(r)===!1||(u=u&&O.synchronous,a.unshift(O.fulfilled,O.rejected))});const l=[];this.interceptors.response.forEach(function(O){l.push(O.fulfilled,O.rejected)});let d,p=0,y;if(!u){const P=[e8.bind(this),void 0];for(P.unshift.apply(P,a),P.push.apply(P,l),y=P.length,d=Promise.resolve(r);p{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new Lu(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new JA(function(i){e=i}),cancel:e}}};function EK(t){return function(r){return t.apply(null,r)}}function SK(t){return Oe.isObject(t)&&t.isAxiosError===!0}const mv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(mv).forEach(([t,e])=>{mv[e]=t});function n8(t){const e=new mc(t),r=w4(mc.prototype.request,e);return Oe.extend(r,mc.prototype,e,{allOwnKeys:!0}),Oe.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return n8(gc(t,i))},r}const fn=n8(Hl);fn.Axios=mc,fn.CanceledError=Lu,fn.CancelToken=_K,fn.isCancel=U4,fn.VERSION=t8,fn.toFormData=b0,fn.AxiosError=ar,fn.Cancel=fn.CanceledError,fn.all=function(e){return Promise.all(e)},fn.spread=EK,fn.isAxiosError=SK,fn.mergeConfig=gc,fn.AxiosHeaders=wi,fn.formToJSON=t=>F4(Oe.isHTMLForm(t)?new FormData(t):t),fn.getAdapter=Q4.getAdapter,fn.HttpStatusCode=mv,fn.default=fn;const{Axios:Foe,AxiosError:i8,CanceledError:joe,isCancel:Uoe,CancelToken:qoe,VERSION:zoe,all:Hoe,Cancel:Woe,isAxiosError:Koe,spread:Voe,toFormData:Goe,AxiosHeaders:Yoe,HttpStatusCode:Joe,formToJSON:Xoe,getAdapter:Zoe,mergeConfig:Qoe}=fn,s8=fn.create({timeout:6e4,headers:{"Content-Type":"application/json",token:localStorage.getItem("auth")}});function AK(t){var e,r,n;if(((e=t.data)==null?void 0:e.success)!==!0){const i=new i8((r=t.data)==null?void 0:r.errorMessage,(n=t.data)==null?void 0:n.errorCode,t.config,t.request,t);return Promise.reject(i)}else return t}function PK(t){var r;console.log(t);const e=(r=t.response)==null?void 0:r.data;if(e){console.log(e,"responseData");const n=new i8(e.errorMessage,t.code,t.config,t.request,t.response);return Promise.reject(n)}else return Promise.reject(t)}s8.interceptors.response.use(AK,PK);class MK{constructor(e){oo(this,"_apiBase","");this.request=e}setApiBase(e){this._apiBase=e||""}async getNonce(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/nonce`,e);return r.data}async getEmailCode(e,r){const{data:n}=await this.request.post(`${this._apiBase}/api/v2/user/get_code`,e,{headers:{"Captcha-Param":r}});return n.data}async emailLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async walletLogin(e){return e.account_enum==="C"?(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data:(await this.request.post(`${this._apiBase}/api/v2/business/login`,e)).data}async tonLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async bindEmail(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindTonWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindEvmWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}}const va=new MK(s8),IK={projectId:"7a4434fefbcc9af474fb5c995e47d286",metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},o8=eW({appName:"codatta",appLogoUrl:"https://avatars.githubusercontent.com/u/171659315"}),a8=Se.createContext({saveLastUsedWallet:()=>{},lastUsedWallet:null,wallets:[],initialized:!1,featuredWallets:[]});function Kl(){return Se.useContext(a8)}function CK(t){const{apiBaseUrl:e}=t,[r,n]=Se.useState([]),[i,s]=Se.useState([]),[o,a]=Se.useState(null),[u,l]=Se.useState(!1),d=A=>{a(A);const O={provider:A.provider instanceof R1?"UniversalProvider":"EIP1193Provider",key:A.key,timestamp:Date.now()};localStorage.setItem("xn-last-used-info",JSON.stringify(O))};function p(A){const P=A.find(O=>{var D;return((D=O.config)==null?void 0:D.name)===t.singleWalletName});if(P)s([P]);else{const O=A.filter(B=>B.featured||B.installed),D=A.filter(B=>!B.featured&&!B.installed),k=[...O,...D];n(k),s(O)}}async function y(){const A=[],P=new Map;QA.forEach(D=>{const k=new ru(D);D.name==="Coinbase Wallet"&&k.EIP6963Detected({info:{name:"Coinbase Wallet",uuid:"coinbase",icon:D.image,rdns:"coinbase"},provider:o8.getProvider()}),P.set(k.key,k),A.push(k)}),(await gz()).forEach(D=>{const k=P.get(D.info.name);if(k)k.EIP6963Detected(D);else{const B=new ru(D);P.set(B.key,B),A.push(B)}});try{const D=JSON.parse(localStorage.getItem("xn-last-used-info")||"{}"),k=P.get(D.key);if(k){if(k.lastUsed=!0,D.provider==="UniversalProvider"){const B=await R1.init(IK);B.session&&(k.setUniversalProvider(B),console.log("Restored UniversalProvider for wallet:",k.key))}else D.provider==="EIP1193Provider"&&k.installed&&console.log("Using detected EIP1193Provider for wallet:",k.key);a(k)}}catch(D){console.log(D)}p(A),l(!0)}return Se.useEffect(()=>{y(),va.setApiBase(e)},[]),de.jsx(a8.Provider,{value:{saveLastUsedWallet:d,wallets:r,initialized:u,lastUsedWallet:o,featuredWallets:i},children:t.children})}/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const TK=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),u8=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/** + */const TK=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),c8=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -126,12 +126,12 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const DK=Ee.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:s,iconNode:o,...a},u)=>Ee.createElement("svg",{ref:u,...RK,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:u8("lucide",i),...a},[...o.map(([l,d])=>Ee.createElement(l,d)),...Array.isArray(s)?s:[s]]));/** + */const DK=Se.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:s,iconNode:o,...a},u)=>Se.createElement("svg",{ref:u,...RK,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:c8("lucide",i),...a},[...o.map(([l,d])=>Se.createElement(l,d)),...Array.isArray(s)?s:[s]]));/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ts=(t,e)=>{const r=Ee.forwardRef(({className:n,...i},s)=>Ee.createElement(DK,{ref:s,iconNode:e,className:u8(`lucide-${TK(t)}`,n),...i}));return r.displayName=`${t}`,r};/** + */const ts=(t,e)=>{const r=Se.forwardRef(({className:n,...i},s)=>Se.createElement(DK,{ref:s,iconNode:e,className:c8(`lucide-${TK(t)}`,n),...i}));return r.displayName=`${t}`,r};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -141,7 +141,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const f8=ts("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + */const u8=ts("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -166,7 +166,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const l8=ts("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** + */const f8=ts("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -186,12 +186,12 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const h8=ts("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + */const l8=ts("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jK=ts("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]),d8=new Set;function A0(t,e,r){t||d8.has(e)||(console.warn(e),d8.add(e))}function UK(t){if(typeof Proxy>"u")return t;const e=new Map,r=(...n)=>(process.env.NODE_ENV!=="production"&&A0(!1,"motion() is deprecated. Use motion.create() instead."),t(...n));return new Proxy(r,{get:(n,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}function P0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const vv=t=>Array.isArray(t);function p8(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function bv(t,e,r,n){if(typeof e=="function"){const[i,s]=g8(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=g8(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function M0(t,e,r){const n=t.getProps();return bv(n,e,r!==void 0?r:n.custom,t)}const yv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],wv=["initial",...yv],Gl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],bc=new Set(Gl),Qs=t=>t*1e3,Do=t=>t/1e3,qK={type:"spring",stiffness:500,damping:25,restSpeed:10},zK=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),HK={type:"keyframes",duration:.8},WK={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},KK=(t,{keyframes:e})=>e.length>2?HK:bc.has(t)?t.startsWith("scale")?zK(e[1]):qK:WK;function xv(t,e){return t?t[e]||t.default||t:void 0}const VK={useManualTiming:!1},GK=t=>t!==null;function I0(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(GK),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const Wn=t=>t;function YK(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){s.has(l)&&(u.schedule(l),t()),l(o)}const u={schedule:(l,d=!1,p=!1)=>{const A=p&&n?e:r;return d&&s.add(l),A.has(l)||A.add(l),l},cancel:l=>{r.delete(l),s.delete(l)},process:l=>{if(o=l,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,u.process(l))}};return u}const C0=["read","resolveKeyframes","update","preRender","render","postRender"],JK=40;function m8(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=C0.reduce((k,B)=>(k[B]=YK(s),k),{}),{read:a,resolveKeyframes:u,update:l,preRender:d,render:p,postRender:y}=o,A=()=>{const k=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(k-i.timestamp,JK),1),i.timestamp=k,i.isProcessing=!0,a.process(i),u.process(i),l.process(i),d.process(i),p.process(i),y.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(A))},P=()=>{r=!0,n=!0,i.isProcessing||t(A)};return{schedule:C0.reduce((k,B)=>{const q=o[B];return k[B]=(j,H=!1,J=!1)=>(r||P(),q.schedule(j,H,J)),k},{}),cancel:k=>{for(let B=0;B(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,XK=1e-7,ZK=12;function QK(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=v8(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>XK&&++aQK(s,0,1,t,r);return s=>s===0||s===1?s:v8(i(s),e,n)}const b8=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,y8=t=>e=>1-t(1-e),w8=Yl(.33,1.53,.69,.99),Ev=y8(w8),x8=b8(Ev),_8=t=>(t*=2)<1?.5*Ev(t):.5*(2-Math.pow(2,-10*(t-1))),Sv=t=>1-Math.sin(Math.acos(t)),E8=y8(Sv),S8=b8(Sv),A8=t=>/^0[^.\s]+$/u.test(t);function eV(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||A8(t):!0}let ku=Wn,Oo=Wn;process.env.NODE_ENV!=="production"&&(ku=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},Oo=(t,e)=>{if(!t)throw new Error(e)});const P8=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),M8=t=>e=>typeof e=="string"&&e.startsWith(t),I8=M8("--"),tV=M8("var(--"),Av=t=>tV(t)?rV.test(t.split("/*")[0].trim()):!1,rV=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,nV=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function iV(t){const e=nV.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}const sV=4;function C8(t,e,r=1){Oo(r<=sV,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[n,i]=iV(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return P8(o)?parseFloat(o):o}return Av(i)?C8(i,e,r+1):i}const ya=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},Jl={...Bu,transform:t=>ya(0,1,t)},T0={...Bu,default:1},Xl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),wa=Xl("deg"),eo=Xl("%"),zt=Xl("px"),oV=Xl("vh"),aV=Xl("vw"),T8={...eo,parse:t=>eo.parse(t)/100,transform:t=>eo.transform(t*100)},cV=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),R8=t=>t===Bu||t===zt,D8=(t,e)=>parseFloat(t.split(", ")[e]),O8=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return D8(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?D8(s[1],t):0}},uV=new Set(["x","y","z"]),fV=Gl.filter(t=>!uV.has(t));function lV(t){const e=[];return fV.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const $u={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:O8(4,13),y:O8(5,14)};$u.translateX=$u.x,$u.translateY=$u.y;const N8=t=>e=>e.test(t),L8=[Bu,zt,eo,wa,aV,oV,{test:t=>t==="auto",parse:t=>t}],k8=t=>L8.find(N8(t)),yc=new Set;let Pv=!1,Mv=!1;function B8(){if(Mv){const t=Array.from(yc).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=lV(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}Mv=!1,Pv=!1,yc.forEach(t=>t.complete()),yc.clear()}function $8(){yc.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Mv=!0)})}function hV(){$8(),B8()}class Iv{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(yc.add(this),Pv||(Pv=!0,Nr.read($8),Nr.resolveKeyframes(B8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sMath.round(t*1e5)/1e5,Cv=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function dV(t){return t==null}const pV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Tv=(t,e)=>r=>!!(typeof r=="string"&&pV.test(r)&&r.startsWith(t)||e&&!dV(r)&&Object.prototype.hasOwnProperty.call(r,e)),F8=(t,e,r)=>n=>{if(typeof n!="string")return n;const[i,s,o,a]=n.match(Cv);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},gV=t=>ya(0,255,t),Rv={...Bu,transform:t=>Math.round(gV(t))},wc={test:Tv("rgb","red"),parse:F8("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+Rv.transform(t)+", "+Rv.transform(e)+", "+Rv.transform(r)+", "+Zl(Jl.transform(n))+")"};function mV(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const Dv={test:Tv("#"),parse:mV,transform:wc.transform},Fu={test:Tv("hsl","hue"),parse:F8("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+eo.transform(Zl(e))+", "+eo.transform(Zl(r))+", "+Zl(Jl.transform(n))+")"},Zn={test:t=>wc.test(t)||Dv.test(t)||Fu.test(t),parse:t=>wc.test(t)?wc.parse(t):Fu.test(t)?Fu.parse(t):Dv.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?wc.transform(t):Fu.transform(t)},vV=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function bV(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Cv))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(vV))===null||r===void 0?void 0:r.length)||0)>0}const j8="number",U8="color",yV="var",wV="var(",q8="${}",xV=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ql(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(xV,u=>(Zn.test(u)?(n.color.push(s),i.push(U8),r.push(Zn.parse(u))):u.startsWith(wV)?(n.var.push(s),i.push(yV),r.push(u)):(n.number.push(s),i.push(j8),r.push(parseFloat(u))),++s,q8)).split(q8);return{values:r,split:a,indexes:n,types:i}}function z8(t){return Ql(t).values}function H8(t){const{split:e,types:r}=Ql(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function EV(t){const e=z8(t);return H8(t)(e.map(_V))}const xa={test:bV,parse:z8,createTransformer:H8,getAnimatableNone:EV},SV=new Set(["brightness","contrast","saturate","opacity"]);function AV(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(Cv)||[];if(!n)return t;const i=r.replace(n,"");let s=SV.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const PV=/\b([a-z-]*)\(.*?\)/gu,Ov={...xa,getAnimatableNone:t=>{const e=t.match(PV);return e?e.map(AV).join(" "):t}},MV={borderWidth:zt,borderTopWidth:zt,borderRightWidth:zt,borderBottomWidth:zt,borderLeftWidth:zt,borderRadius:zt,radius:zt,borderTopLeftRadius:zt,borderTopRightRadius:zt,borderBottomRightRadius:zt,borderBottomLeftRadius:zt,width:zt,maxWidth:zt,height:zt,maxHeight:zt,top:zt,right:zt,bottom:zt,left:zt,padding:zt,paddingTop:zt,paddingRight:zt,paddingBottom:zt,paddingLeft:zt,margin:zt,marginTop:zt,marginRight:zt,marginBottom:zt,marginLeft:zt,backgroundPositionX:zt,backgroundPositionY:zt},IV={rotate:wa,rotateX:wa,rotateY:wa,rotateZ:wa,scale:T0,scaleX:T0,scaleY:T0,scaleZ:T0,skew:wa,skewX:wa,skewY:wa,distance:zt,translateX:zt,translateY:zt,translateZ:zt,x:zt,y:zt,z:zt,perspective:zt,transformPerspective:zt,opacity:Jl,originX:T8,originY:T8,originZ:zt},W8={...Bu,transform:Math.round},Nv={...MV,...IV,zIndex:W8,size:zt,fillOpacity:Jl,strokeOpacity:Jl,numOctaves:W8},CV={...Nv,color:Zn,backgroundColor:Zn,outlineColor:Zn,fill:Zn,stroke:Zn,borderColor:Zn,borderTopColor:Zn,borderRightColor:Zn,borderBottomColor:Zn,borderLeftColor:Zn,filter:Ov,WebkitFilter:Ov},Lv=t=>CV[t];function K8(t,e){let r=Lv(t);return r!==Ov&&(r=xa),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const TV=new Set(["auto","none","0"]);function RV(t,e,r){let n=0,i;for(;n{r.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function kv(t){return typeof t=="function"}let R0;function DV(){R0=void 0}const to={now:()=>(R0===void 0&&to.set(Kn.isProcessing||VK.useManualTiming?Kn.timestamp:performance.now()),R0),set:t=>{R0=t,queueMicrotask(DV)}},G8=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(xa.test(t)||t==="0")&&!t.startsWith("url("));function OV(t){const e=t[0];if(t.length===1)return!0;for(let r=0;rLV?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&hV(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=to.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:u,isGenerator:l}=this.options;if(!l&&!NV(e,n,i,s))if(o)this.options.duration=0;else{u==null||u(I0(e,this.options,r)),a==null||a(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,r);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...d},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function J8(t,e){return e?t*(1e3/e):0}const kV=5;function X8(t,e,r){const n=Math.max(e-kV,0);return J8(r-t(n),e-n)}const Bv=.001,BV=.01,Z8=10,$V=.05,FV=1;function jV({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;ku(t<=Qs(Z8),"Spring duration must be 10 seconds or less");let o=1-e;o=ya($V,FV,o),t=ya(BV,Z8,Do(t)),o<1?(i=l=>{const d=l*o,p=d*t,y=d-r,A=$v(l,o),P=Math.exp(-p);return Bv-y/A*P},s=l=>{const p=l*o*t,y=p*r+r,A=Math.pow(o,2)*Math.pow(l,2)*t,P=Math.exp(-p),N=$v(Math.pow(l,2),o);return(-i(l)+Bv>0?-1:1)*((y-A)*P)/N}):(i=l=>{const d=Math.exp(-l*t),p=(l-r)*t+1;return-Bv+d*p},s=l=>{const d=Math.exp(-l*t),p=(r-l)*(t*t);return d*p});const a=5/t,u=qV(i,s,a);if(t=Qs(t),isNaN(u))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(u,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:t}}}const UV=12;function qV(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function WV(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!Q8(t,HV)&&Q8(t,zV)){const r=jV(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function eE({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:u,mass:l,duration:d,velocity:p,isResolvedFromDuration:y}=WV({...n,velocity:-Do(n.velocity||0)}),A=p||0,P=u/(2*Math.sqrt(a*l)),N=s-i,D=Do(Math.sqrt(a/l)),k=Math.abs(N)<5;r||(r=k?.01:2),e||(e=k?.005:.5);let B;if(P<1){const q=$v(D,P);B=j=>{const H=Math.exp(-P*D*j);return s-H*((A+P*D*N)/q*Math.sin(q*j)+N*Math.cos(q*j))}}else if(P===1)B=q=>s-Math.exp(-D*q)*(N+(A+D*N)*q);else{const q=D*Math.sqrt(P*P-1);B=j=>{const H=Math.exp(-P*D*j),J=Math.min(q*j,300);return s-H*((A+P*D*N)*Math.sinh(J)+q*N*Math.cosh(J))/q}}return{calculatedDuration:y&&d||null,next:q=>{const j=B(q);if(y)o.done=q>=d;else{let H=0;P<1&&(H=q===0?Qs(A):X8(B,q,j));const J=Math.abs(H)<=r,T=Math.abs(s-j)<=e;o.done=J&&T}return o.value=o.done?s:j,o}}}function tE({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:d}){const p=t[0],y={done:!1,value:p},A=z=>a!==void 0&&zu,P=z=>a===void 0?u:u===void 0||Math.abs(a-z)-N*Math.exp(-z/n),q=z=>k+B(z),j=z=>{const ue=B(z),_e=q(z);y.done=Math.abs(ue)<=l,y.value=y.done?k:_e};let H,J;const T=z=>{A(y.value)&&(H=z,J=eE({keyframes:[y.value,P(y.value)],velocity:X8(q,z,y.value),damping:i,stiffness:s,restDelta:l,restSpeed:d}))};return T(0),{calculatedDuration:null,next:z=>{let ue=!1;return!J&&H===void 0&&(ue=!0,j(z),T(z)),H!==void 0&&z>=H?J.next(z-H):(!ue&&j(z),y)}}}const KV=Yl(.42,0,1,1),VV=Yl(0,0,.58,1),rE=Yl(.42,0,.58,1),GV=t=>Array.isArray(t)&&typeof t[0]!="number",Fv=t=>Array.isArray(t)&&typeof t[0]=="number",nE={linear:Wn,easeIn:KV,easeInOut:rE,easeOut:VV,circIn:Sv,circInOut:S8,circOut:E8,backIn:Ev,backInOut:x8,backOut:w8,anticipate:_8},iE=t=>{if(Fv(t)){Oo(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,r,n,i]=t;return Yl(e,r,n,i)}else if(typeof t=="string")return Oo(nE[t]!==void 0,`Invalid easing type '${t}'`),nE[t];return t},YV=(t,e)=>r=>e(t(r)),No=(...t)=>t.reduce(YV),ju=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},Zr=(t,e,r)=>t+(e-t)*r;function jv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function JV({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,u=2*r-a;i=jv(u,a,t+1/3),s=jv(u,a,t),o=jv(u,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function D0(t,e){return r=>r>0?e:t}const Uv=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},XV=[Dv,wc,Fu],ZV=t=>XV.find(e=>e.test(t));function sE(t){const e=ZV(t);if(ku(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let r=e.parse(t);return e===Fu&&(r=JV(r)),r}const oE=(t,e)=>{const r=sE(t),n=sE(e);if(!r||!n)return D0(t,e);const i={...r};return s=>(i.red=Uv(r.red,n.red,s),i.green=Uv(r.green,n.green,s),i.blue=Uv(r.blue,n.blue,s),i.alpha=Zr(r.alpha,n.alpha,s),wc.transform(i))},qv=new Set(["none","hidden"]);function QV(t,e){return qv.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function eG(t,e){return r=>Zr(t,e,r)}function zv(t){return typeof t=="number"?eG:typeof t=="string"?Av(t)?D0:Zn.test(t)?oE:nG:Array.isArray(t)?aE:typeof t=="object"?Zn.test(t)?oE:tG:D0}function aE(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>zv(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function rG(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=xa.createTransformer(e),n=Ql(t),i=Ql(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?qv.has(t)&&!i.values.length||qv.has(e)&&!n.values.length?QV(t,e):No(aE(rG(n,i),i.values),r):(ku(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),D0(t,e))};function cE(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Zr(t,e,r):zv(t)(t,e)}function iG(t,e,r){const n=[],i=r||cE,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=iG(e,n,i),a=o.length,u=l=>{let d=0;if(a>1)for(;du(ya(t[0],t[s-1],l)):u}function oG(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=ju(0,e,n);t.push(Zr(r,1,i))}}function aG(t){const e=[0];return oG(e,t.length-1),e}function cG(t,e){return t.map(r=>r*e)}function uG(t,e){return t.map(()=>e||rE).splice(0,t.length-1)}function O0({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=GV(n)?n.map(iE):iE(n),s={done:!1,value:e[0]},o=cG(r&&r.length===e.length?r:aG(e),t),a=sG(o,e,{ease:Array.isArray(i)?i:uG(e,i)});return{calculatedDuration:t,next:u=>(s.value=a(u),s.done=u>=t,s)}}const uE=2e4;function fG(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=uE?1/0:e}const lG=t=>{const e=({timestamp:r})=>t(r);return{start:()=>Nr.update(e,!0),stop:()=>ba(e),now:()=>Kn.isProcessing?Kn.timestamp:to.now()}},hG={decay:tE,inertia:tE,tween:O0,keyframes:O0,spring:eE},dG=t=>t/100;class Hv extends Y8{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:u}=this.options;u&&u()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Iv,a=(u,l)=>this.onKeyframesResolved(u,l);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=kv(r)?r:hG[r]||O0;let u,l;a!==O0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&Oo(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),u=No(dG,cE(e[0],e[1])),e=[0,100]);const d=a({...this.options,keyframes:e});s==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=fG(d));const{calculatedDuration:p}=d,y=p+i,A=y*(n+1)-i;return{generator:d,mirroredGenerator:l,mapPercentToKeyframes:u,calculatedDuration:p,resolvedDuration:y,totalDuration:A}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:z}=this.options;return{done:!0,value:z[z.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:u,calculatedDuration:l,totalDuration:d,resolvedDuration:p}=n;if(this.startTime===null)return s.next(0);const{delay:y,repeat:A,repeatType:P,repeatDelay:N,onUpdate:D}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const k=this.currentTime-y*(this.speed>=0?1:-1),B=this.speed>=0?k<0:k>d;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let q=this.currentTime,j=s;if(A){const z=Math.min(this.currentTime,d)/p;let ue=Math.floor(z),_e=z%1;!_e&&z>=1&&(_e=1),_e===1&&ue--,ue=Math.min(ue,A+1),!!(ue%2)&&(P==="reverse"?(_e=1-_e,N&&(_e-=N/p)):P==="mirror"&&(j=o)),q=ya(0,1,_e)*p}const H=B?{done:!1,value:u[0]}:j.next(q);a&&(H.value=a(H.value));let{done:J}=H;!B&&l!==null&&(J=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&J);return T&&i!==void 0&&(H.value=I0(u,this.options,i)),D&&D(H.value),T&&this.finish(),H}get duration(){const{resolved:e}=this;return e?Do(e.calculatedDuration):0}get time(){return Do(this.currentTime)}set time(e){e=Qs(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=Do(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=lG,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const pG=new Set(["opacity","clipPath","filter","transform"]),gG=10,mG=(t,e)=>{let r="";const n=Math.max(Math.round(e/gG),2);for(let i=0;i(e===void 0&&(e=t()),e)}const vG={linearEasing:void 0};function bG(t,e){const r=Wv(t);return()=>{var n;return(n=vG[e])!==null&&n!==void 0?n:r()}}const N0=bG(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function fE(t){return!!(typeof t=="function"&&N0()||!t||typeof t=="string"&&(t in Kv||N0())||Fv(t)||Array.isArray(t)&&t.every(fE))}const eh=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,Kv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:eh([0,.65,.55,1]),circOut:eh([.55,0,1,.45]),backIn:eh([.31,.01,.66,-.59]),backOut:eh([.33,1.53,.69,.99])};function lE(t,e){if(t)return typeof t=="function"&&N0()?mG(t,e):Fv(t)?eh(t):Array.isArray(t)?t.map(r=>lE(r,e)||Kv.easeOut):Kv[t]}function yG(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:u}={}){const l={[e]:r};u&&(l.offset=u);const d=lE(a,i);return Array.isArray(d)&&(l.easing=d),t.animate(l,{delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function hE(t,e){t.timeline=e,t.onfinish=null}const wG=Wv(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),L0=10,xG=2e4;function _G(t){return kv(t.type)||t.type==="spring"||!fE(t.ease)}function EG(t,e){const r=new Hv({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&sthis.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:u,name:l,startTime:d}=this.options;if(!(!((n=u.owner)===null||n===void 0)&&n.current))return!1;if(typeof o=="string"&&N0()&&SG(o)&&(o=dE[o]),_G(this.options)){const{onComplete:y,onUpdate:A,motionValue:P,element:N,...D}=this.options,k=EG(e,D);e=k.keyframes,e.length===1&&(e[1]=e[0]),i=k.duration,s=k.times,o=k.ease,a="keyframes"}const p=yG(u.owner.current,l,e,{...this.options,duration:i,times:s,ease:o});return p.startTime=d??this.calcStartTime(),this.pendingTimeline?(hE(p,this.pendingTimeline),this.pendingTimeline=void 0):p.onfinish=()=>{const{onComplete:y}=this.options;u.set(I0(e,this.options,r)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:p,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return Do(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return Do(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=Qs(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return Wn;const{animation:n}=r;hE(n,e)}return Wn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:d,onComplete:p,element:y,...A}=this.options,P=new Hv({...A,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),N=Qs(this.time);l.setWithVelocity(P.sample(N-L0).value,P.sample(N).value,L0)}const{onStop:u}=this.options;u&&u(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return wG()&&n&&pG.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}const AG=Wv(()=>window.ScrollTimeline!==void 0);class PG{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;nAG()&&i.attachTimeline?i.attachTimeline(e):r(i));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function MG({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:u,elapsed:l,...d}){return!!Object.keys(d).length}const Vv=(t,e,r,n={},i,s)=>o=>{const a=xv(n,t)||{},u=a.delay||n.delay||0;let{elapsed:l=0}=n;l=l-Qs(u);let d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:y=>{e.set(y),a.onUpdate&&a.onUpdate(y)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:i};MG(a)||(d={...d,...KK(t,d)}),d.duration&&(d.duration=Qs(d.duration)),d.repeatDelay&&(d.repeatDelay=Qs(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let p=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(p=!0)),p&&!s&&e.get()!==void 0){const y=I0(d.keyframes,a);if(y!==void 0)return Nr.update(()=>{d.onUpdate(y),d.onComplete()}),new PG([])}return!s&&pE.supports(d)?new pE(d):new Hv(d)},IG=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),CG=t=>vv(t)?t[t.length-1]||0:t;function Gv(t,e){t.indexOf(e)===-1&&t.push(e)}function Yv(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class Jv{constructor(){this.subscriptions=[]}add(e){return Gv(this.subscriptions,e),()=>Yv(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class RG{constructor(e,r={}){this.version="11.11.17",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=to.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=to.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=TG(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&A0(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new Jv);const n=this.events[e].add(r);return e==="change"?()=>{n(),Nr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=to.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>gE)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,gE);return J8(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function th(t,e){return new RG(t,e)}function DG(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,th(r))}function OG(t,e){const r=M0(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=CG(s[o]);DG(t,o,a)}}const Xv=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),mE="data-"+Xv("framerAppearId");function vE(t){return t.props[mE]}const Qn=t=>!!(t&&t.getVelocity);function NG(t){return!!(Qn(t)&&t.add)}function Zv(t,e){const r=t.getValue("willChange");if(NG(r))return r.add(e)}function LG({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function bE(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...u}=e;n&&(o=n);const l=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const p in u){const y=t.getValue(p,(s=t.latestValues[p])!==null&&s!==void 0?s:null),A=u[p];if(A===void 0||d&&LG(d,p))continue;const P={delay:r,...xv(o||{},p)};let N=!1;if(window.MotionHandoffAnimation){const k=vE(t);if(k){const B=window.MotionHandoffAnimation(k,p,Nr);B!==null&&(P.startTime=B,N=!0)}}Zv(t,p),y.start(Vv(p,y,A,t.shouldReduceMotion&&bc.has(p)?{type:!1}:P,t,N));const D=y.animation;D&&l.push(D)}return a&&Promise.all(l).then(()=>{Nr.update(()=>{a&&OG(t,a)})}),l}function Qv(t,e,r={}){var n;const i=M0(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(bE(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:y}=s;return kG(t,e,d+l,p,y,r)}:()=>Promise.resolve(),{when:u}=s;if(u){const[l,d]=u==="beforeChildren"?[o,a]:[a,o];return l().then(()=>d())}else return Promise.all([o(),a(r.delay)])}function kG(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,u=i===1?(l=0)=>l*n:(l=0)=>a-l*n;return Array.from(t.variantChildren).sort(BG).forEach((l,d)=>{l.notify("AnimationStart",e),o.push(Qv(l,e,{...s,delay:r+u(d)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function BG(t,e){return t.sortNodePosition(e)}function $G(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>Qv(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=Qv(t,e,r);else{const i=typeof e=="function"?M0(t,e,r.custom):e;n=Promise.all(bE(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const FG=wv.length;function yE(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?yE(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;rPromise.all(e.map(({animation:r,options:n})=>$G(t,r,n)))}function zG(t){let e=qG(t),r=wE(),n=!0;const i=u=>(l,d)=>{var p;const y=M0(t,d,u==="exit"?(p=t.presenceContext)===null||p===void 0?void 0:p.custom:void 0);if(y){const{transition:A,transitionEnd:P,...N}=y;l={...l,...N,...P}}return l};function s(u){e=u(t)}function o(u){const{props:l}=t,d=yE(t.parent)||{},p=[],y=new Set;let A={},P=1/0;for(let D=0;DP&&j,ue=!1;const _e=Array.isArray(q)?q:[q];let G=_e.reduce(i(k),{});H===!1&&(G={});const{prevResolvedValues:E={}}=B,m={...E,...G},f=x=>{z=!0,y.has(x)&&(ue=!0,y.delete(x)),B.needsAnimating[x]=!0;const _=t.getValue(x);_&&(_.liveStyle=!1)};for(const x in m){const _=G[x],S=E[x];if(A.hasOwnProperty(x))continue;let b=!1;vv(_)&&vv(S)?b=!p8(_,S):b=_!==S,b?_!=null?f(x):y.add(x):_!==void 0&&y.has(x)?f(x):B.protectedKeys[x]=!0}B.prevProp=q,B.prevResolvedValues=G,B.isActive&&(A={...A,...G}),n&&t.blockInitialAnimation&&(z=!1),z&&(!(J&&T)||ue)&&p.push(..._e.map(x=>({animation:x,options:{type:k}})))}if(y.size){const D={};y.forEach(k=>{const B=t.getBaseTarget(k),q=t.getValue(k);q&&(q.liveStyle=!0),D[k]=B??null}),p.push({animation:D})}let N=!!p.length;return n&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(N=!1),n=!1,N?e(p):Promise.resolve()}function a(u,l){var d;if(r[u].isActive===l)return Promise.resolve();(d=t.variantChildren)===null||d===void 0||d.forEach(y=>{var A;return(A=y.animationState)===null||A===void 0?void 0:A.setActive(u,l)}),r[u].isActive=l;const p=o(u);for(const y in r)r[y].protectedKeys={};return p}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=wE(),n=!0}}}function HG(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!p8(e,t):!1}function xc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function wE(){return{animate:xc(!0),whileInView:xc(),whileHover:xc(),whileTap:xc(),whileDrag:xc(),whileFocus:xc(),exit:xc()}}class _a{constructor(e){this.isMounted=!1,this.node=e}update(){}}class WG extends _a{constructor(e){super(e),e.animationState||(e.animationState=zG(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();P0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let KG=0;class VG extends _a{constructor(){super(...arguments),this.id=KG++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const GG={animation:{Feature:WG},exit:{Feature:VG}},xE=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function k0(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const YG=t=>e=>xE(e)&&t(e,k0(e));function Lo(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function ko(t,e,r,n){return Lo(t,e,YG(r),n)}const _E=(t,e)=>Math.abs(t-e);function JG(t,e){const r=_E(t.x,e.x),n=_E(t.y,e.y);return Math.sqrt(r**2+n**2)}class EE{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=tb(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,A=JG(p.offset,{x:0,y:0})>=3;if(!y&&!A)return;const{point:P}=p,{timestamp:N}=Kn;this.history.push({...P,timestamp:N});const{onStart:D,onMove:k}=this.handlers;y||(D&&D(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,p)},this.handlePointerMove=(p,y)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=eb(y,this.transformPagePoint),Nr.update(this.updatePoint,!0)},this.handlePointerUp=(p,y)=>{this.end();const{onEnd:A,onSessionEnd:P,resumeAnimation:N}=this.handlers;if(this.dragSnapToOrigin&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=tb(p.type==="pointercancel"?this.lastMoveEventInfo:eb(y,this.transformPagePoint),this.history);this.startEvent&&A&&A(p,D),P&&P(p,D)},!xE(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=k0(e),a=eb(o,this.transformPagePoint),{point:u}=a,{timestamp:l}=Kn;this.history=[{...u,timestamp:l}];const{onSessionStart:d}=r;d&&d(e,tb(a,this.history)),this.removeListeners=No(ko(this.contextWindow,"pointermove",this.handlePointerMove),ko(this.contextWindow,"pointerup",this.handlePointerUp),ko(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),ba(this.updatePoint)}}function eb(t,e){return e?{point:e(t.point)}:t}function SE(t,e){return{x:t.x-e.x,y:t.y-e.y}}function tb({point:t},e){return{point:t,delta:SE(t,AE(e)),offset:SE(t,XG(e)),velocity:ZG(e,.1)}}function XG(t){return t[0]}function AE(t){return t[t.length-1]}function ZG(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=AE(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>Qs(e)));)r--;if(!n)return{x:0,y:0};const s=Do(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function PE(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const ME=PE("dragHorizontal"),IE=PE("dragVertical");function CE(t){let e=!1;if(t==="y")e=IE();else if(t==="x")e=ME();else{const r=ME(),n=IE();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function TE(){const t=CE(!0);return t?(t(),!1):!0}function Uu(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const RE=1e-4,QG=1-RE,eY=1+RE,DE=.01,tY=0-DE,rY=0+DE;function Ni(t){return t.max-t.min}function nY(t,e,r){return Math.abs(t-e)<=r}function OE(t,e,r,n=.5){t.origin=n,t.originPoint=Zr(e.min,e.max,t.origin),t.scale=Ni(r)/Ni(e),t.translate=Zr(r.min,r.max,t.origin)-t.originPoint,(t.scale>=QG&&t.scale<=eY||isNaN(t.scale))&&(t.scale=1),(t.translate>=tY&&t.translate<=rY||isNaN(t.translate))&&(t.translate=0)}function rh(t,e,r,n){OE(t.x,e.x,r.x,n?n.originX:void 0),OE(t.y,e.y,r.y,n?n.originY:void 0)}function NE(t,e,r){t.min=r.min+e.min,t.max=t.min+Ni(e)}function iY(t,e,r){NE(t.x,e.x,r.x),NE(t.y,e.y,r.y)}function LE(t,e,r){t.min=e.min-r.min,t.max=t.min+Ni(e)}function nh(t,e,r){LE(t.x,e.x,r.x),LE(t.y,e.y,r.y)}function sY(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?Zr(r,t,n.max):Math.min(t,r)),t}function kE(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function oY(t,{top:e,left:r,bottom:n,right:i}){return{x:kE(t.x,r,i),y:kE(t.y,e,n)}}function BE(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=ju(e.min,e.max-n,t.min):n>i&&(r=ju(t.min,t.max-i,e.min)),ya(0,1,r)}function uY(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const rb=.35;function fY(t=rb){return t===!1?t=0:t===!0&&(t=rb),{x:$E(t,"left","right"),y:$E(t,"top","bottom")}}function $E(t,e,r){return{min:FE(t,e),max:FE(t,r)}}function FE(t,e){return typeof t=="number"?t:t[e]||0}const jE=()=>({translate:0,scale:1,origin:0,originPoint:0}),qu=()=>({x:jE(),y:jE()}),UE=()=>({min:0,max:0}),ln=()=>({x:UE(),y:UE()});function rs(t){return[t("x"),t("y")]}function qE({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function lY({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function hY(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function nb(t){return t===void 0||t===1}function ib({scale:t,scaleX:e,scaleY:r}){return!nb(t)||!nb(e)||!nb(r)}function _c(t){return ib(t)||zE(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function zE(t){return HE(t.x)||HE(t.y)}function HE(t){return t&&t!=="0%"}function B0(t,e,r){const n=t-r,i=e*n;return r+i}function WE(t,e,r,n,i){return i!==void 0&&(t=B0(t,i,n)),B0(t,r,n)+e}function sb(t,e=0,r=1,n,i){t.min=WE(t.min,e,r,n,i),t.max=WE(t.max,e,r,n,i)}function KE(t,{x:e,y:r}){sb(t.x,e.translate,e.scale,e.originPoint),sb(t.y,r.translate,r.scale,r.originPoint)}const VE=.999999999999,GE=1.0000000000001;function dY(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;aVE&&(e.x=1),e.yVE&&(e.y=1)}function zu(t,e){t.min=t.min+e,t.max=t.max+e}function YE(t,e,r,n,i=.5){const s=Zr(t.min,t.max,i);sb(t,e,r,s,n)}function Hu(t,e){YE(t.x,e.x,e.scaleX,e.scale,e.originX),YE(t.y,e.y,e.scaleY,e.scale,e.originY)}function JE(t,e){return qE(hY(t.getBoundingClientRect(),e))}function pY(t,e,r){const n=JE(t,r),{scroll:i}=e;return i&&(zu(n.x,i.offset.x),zu(n.y,i.offset.y)),n}const XE=({current:t})=>t?t.ownerDocument.defaultView:null,gY=new WeakMap;class mY{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ln(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:p}=this.getProps();p?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(k0(d,"page").point)},s=(d,p)=>{const{drag:y,dragPropagation:A,onDragStart:P}=this.getProps();if(y&&!A&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=CE(y),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),rs(D=>{let k=this.getAxisMotionValue(D).get()||0;if(eo.test(k)){const{projection:B}=this.visualElement;if(B&&B.layout){const q=B.layout.layoutBox[D];q&&(k=Ni(q)*(parseFloat(k)/100))}}this.originPoint[D]=k}),P&&Nr.postRender(()=>P(d,p)),Zv(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},o=(d,p)=>{const{dragPropagation:y,dragDirectionLock:A,onDirectionLock:P,onDrag:N}=this.getProps();if(!y&&!this.openGlobalLock)return;const{offset:D}=p;if(A&&this.currentDirection===null){this.currentDirection=vY(D),this.currentDirection!==null&&P&&P(this.currentDirection);return}this.updateAxis("x",p.point,D),this.updateAxis("y",p.point,D),this.visualElement.render(),N&&N(d,p)},a=(d,p)=>this.stop(d,p),u=()=>rs(d=>{var p;return this.getAnimationState(d)==="paused"&&((p=this.getAxisMotionValue(d).animation)===null||p===void 0?void 0:p.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new EE(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:XE(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Nr.postRender(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!$0(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=sY(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&Uu(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=oY(i.layoutBox,r):this.constraints=!1,this.elastic=fY(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&rs(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=uY(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!Uu(e))return!1;const n=e.current;Oo(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=pY(n,i.root,this.visualElement.getTransformPagePoint());let o=aY(i.layout.layoutBox,s);if(r){const a=r(lY(o));this.hasMutatedConstraints=!!a,a&&(o=qE(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),u=this.constraints||{},l=rs(d=>{if(!$0(d,r,this.currentDirection))return;let p=u&&u[d]||{};o&&(p={min:0,max:0});const y=i?200:1e6,A=i?40:1e7,P={type:"inertia",velocity:n?e[d]:0,bounceStiffness:y,bounceDamping:A,timeConstant:750,restDelta:1,restSpeed:10,...s,...p};return this.startAxisValueAnimation(d,P)});return Promise.all(l).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return Zv(this.visualElement,e),n.start(Vv(e,n,0,r,this.visualElement,!1))}stopAnimation(){rs(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){rs(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){rs(r=>{const{drag:n}=this.getProps();if(!$0(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-Zr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!Uu(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};rs(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const u=a.get();i[o]=cY({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),rs(o=>{if(!$0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:u,max:l}=this.constraints[o];a.set(Zr(u,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;gY.set(this.visualElement,this);const e=this.visualElement.current,r=ko(e,"pointerdown",u=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();Uu(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Nr.read(n);const o=Lo(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(rs(d=>{const p=this.getAxisMotionValue(d);p&&(this.originPoint[d]+=u[d].translate,p.set(p.get()+u[d].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=rb,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function $0(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function vY(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class bY extends _a{constructor(e){super(e),this.removeGroupControls=Wn,this.removeListeners=Wn,this.controls=new mY(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Wn}unmount(){this.removeGroupControls(),this.removeListeners()}}const ZE=t=>(e,r)=>{t&&Nr.postRender(()=>t(e,r))};class yY extends _a{constructor(){super(...arguments),this.removePointerDownListener=Wn}onPointerDown(e){this.session=new EE(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:XE(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:ZE(e),onStart:ZE(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&Nr.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=ko(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const F0=Ee.createContext(null);function wY(){const t=Ee.useContext(F0);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=Ee.useId();Ee.useEffect(()=>n(i),[]);const s=Ee.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const ob=Ee.createContext({}),QE=Ee.createContext({}),j0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function eS(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ih={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(zt.test(t))t=parseFloat(t);else return t;const r=eS(t,e.target.x),n=eS(t,e.target.y);return`${r}% ${n}%`}},xY={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=xa.parse(t);if(i.length>5)return n;const s=xa.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,u=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=u;const l=Zr(a,u,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),s(i)}},U0={};function _Y(t){Object.assign(U0,t)}const{schedule:ab}=m8(queueMicrotask,!1);class EY extends Ee.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;_Y(SY),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),j0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Nr.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ab.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function tS(t){const[e,r]=wY(),n=Ee.useContext(ob);return ge.jsx(EY,{...t,layoutGroup:n,switchLayoutGroup:Ee.useContext(QE),isPresent:e,safeToRemove:r})}const SY={borderRadius:{...ih,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ih,borderTopRightRadius:ih,borderBottomLeftRadius:ih,borderBottomRightRadius:ih,boxShadow:xY},rS=["TopLeft","TopRight","BottomLeft","BottomRight"],AY=rS.length,nS=t=>typeof t=="string"?parseFloat(t):t,iS=t=>typeof t=="number"||zt.test(t);function PY(t,e,r,n,i,s){i?(t.opacity=Zr(0,r.opacity!==void 0?r.opacity:1,MY(n)),t.opacityExit=Zr(e.opacity!==void 0?e.opacity:1,0,IY(n))):s&&(t.opacity=Zr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(ju(t,e,n))}function aS(t,e){t.min=e.min,t.max=e.max}function ns(t,e){aS(t.x,e.x),aS(t.y,e.y)}function cS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function uS(t,e,r,n,i){return t-=e,t=B0(t,1/r,n),i!==void 0&&(t=B0(t,1/i,n)),t}function CY(t,e=0,r=1,n=.5,i,s=t,o=t){if(eo.test(e)&&(e=parseFloat(e),e=Zr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Zr(s.min,s.max,n);t===s&&(a-=e),t.min=uS(t.min,e,r,a,i),t.max=uS(t.max,e,r,a,i)}function fS(t,e,[r,n,i],s,o){CY(t,e[r],e[n],e[i],e.scale,s,o)}const TY=["x","scaleX","originX"],RY=["y","scaleY","originY"];function lS(t,e,r,n){fS(t.x,e,TY,r?r.x:void 0,n?n.x:void 0),fS(t.y,e,RY,r?r.y:void 0,n?n.y:void 0)}function hS(t){return t.translate===0&&t.scale===1}function dS(t){return hS(t.x)&&hS(t.y)}function pS(t,e){return t.min===e.min&&t.max===e.max}function DY(t,e){return pS(t.x,e.x)&&pS(t.y,e.y)}function gS(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function mS(t,e){return gS(t.x,e.x)&&gS(t.y,e.y)}function vS(t){return Ni(t.x)/Ni(t.y)}function bS(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class OY{constructor(){this.members=[]}add(e){Gv(this.members,e),e.scheduleRender()}remove(e){if(Yv(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function NY(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:l,rotate:d,rotateX:p,rotateY:y,skewX:A,skewY:P}=r;l&&(n=`perspective(${l}px) ${n}`),d&&(n+=`rotate(${d}deg) `),p&&(n+=`rotateX(${p}deg) `),y&&(n+=`rotateY(${y}deg) `),A&&(n+=`skewX(${A}deg) `),P&&(n+=`skewY(${P}deg) `)}const a=t.x.scale*e.x,u=t.y.scale*e.y;return(a!==1||u!==1)&&(n+=`scale(${a}, ${u})`),n||"none"}const LY=(t,e)=>t.depth-e.depth;class kY{constructor(){this.children=[],this.isDirty=!1}add(e){Gv(this.children,e),this.isDirty=!0}remove(e){Yv(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(LY),this.isDirty=!1,this.children.forEach(e)}}function q0(t){const e=Qn(t)?t.get():t;return IG(e)?e.toValue():e}function BY(t,e){const r=to.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(ba(n),t(s-e))};return Nr.read(n,!0),()=>ba(n)}function $Y(t){return t instanceof SVGElement&&t.tagName!=="svg"}function FY(t,e,r){const n=Qn(t)?t:th(t);return n.start(Vv("",n,e,r)),n.animation}const Ec={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},sh=typeof window<"u"&&window.MotionDebug!==void 0,cb=["","X","Y","Z"],jY={visibility:"hidden"},yS=1e3;let UY=0;function ub(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function wS(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=vE(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Nr,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&wS(n)}function xS({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=UY++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,sh&&(Ec.totalNodes=Ec.resolvedTargetDeltas=Ec.recalculatedProjection=0),this.nodes.forEach(HY),this.nodes.forEach(YY),this.nodes.forEach(JY),this.nodes.forEach(WY),sh&&window.MotionDebug.record(Ec)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let u=0;uthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,p&&p(),p=BY(y,250),j0.hasAnimatedSinceResize&&(j0.hasAnimatedSinceResize=!1,this.nodes.forEach(ES))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&d&&(u||l)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:y,hasRelativeTargetChanged:A,layout:P})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const N=this.options.transition||d.getDefaultTransition()||tJ,{onLayoutAnimationStart:D,onLayoutAnimationComplete:k}=d.getProps(),B=!this.targetLayout||!mS(this.targetLayout,P)||A,q=!y&&A;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||q||y&&(B||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(p,q);const j={...xv(N,"layout"),onPlay:D,onComplete:k};(d.shouldReduceMotion||this.options.layoutRoot)&&(j.delay=0,j.type=!1),this.startAnimation(j)}else y||ES(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=P})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,ba(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(XY),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&wS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u{const H=j/1e3;SS(p.x,o.x,H),SS(p.y,o.y,H),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(nh(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),QY(this.relativeTarget,this.relativeTargetOrigin,y,H),q&&DY(this.relativeTarget,q)&&(this.isProjectionDirty=!1),q||(q=ln()),ns(q,this.relativeTarget)),N&&(this.animationValues=d,PY(d,l,this.latestValues,H,B,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=H},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(ba(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nr.update(()=>{j0.hasAnimatedSinceResize=!0,this.currentAnimation=FY(0,yS,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(yS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:u,layout:l,latestValues:d}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&CS(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||ln();const p=Ni(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+p;const y=Ni(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+y}ns(a,u),Hu(a,d),rh(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new OY),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(a=!0),!a)return;const l={};u.z&&ub("z",o,l,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(_S),this.root.sharedNodes.clear()}}}function qY(t){t.updateLayout()}function zY(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?rs(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],A=Ni(y);y.min=n[p].min,y.max=y.min+A}):CS(s,r.layoutBox,n)&&rs(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],A=Ni(n[p]);y.max=y.min+A,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[p].max=t.relativeTarget[p].min+A)});const a=qu();rh(a,n,r.layoutBox);const u=qu();o?rh(u,t.applyTransform(i,!0),r.measuredBox):rh(u,n,r.layoutBox);const l=!dS(a);let d=!1;if(!t.resumeFrom){const p=t.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:y,layout:A}=p;if(y&&A){const P=ln();nh(P,r.layoutBox,y.layoutBox);const N=ln();nh(N,n,A.layoutBox),mS(P,N)||(d=!0),p.options.layoutRoot&&(t.relativeTarget=N,t.relativeTargetOrigin=P,t.relativeParent=p)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:u,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function HY(t){sh&&Ec.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function WY(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function KY(t){t.clearSnapshot()}function _S(t){t.clearMeasurements()}function VY(t){t.isLayoutDirty=!1}function GY(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function ES(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function YY(t){t.resolveTargetDelta()}function JY(t){t.calcProjection()}function XY(t){t.resetSkewAndRotation()}function ZY(t){t.removeLeadSnapshot()}function SS(t,e,r){t.translate=Zr(e.translate,0,r),t.scale=Zr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function AS(t,e,r,n){t.min=Zr(e.min,r.min,n),t.max=Zr(e.max,r.max,n)}function QY(t,e,r,n){AS(t.x,e.x,r.x,n),AS(t.y,e.y,r.y,n)}function eJ(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const tJ={duration:.45,ease:[.4,0,.1,1]},PS=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),MS=PS("applewebkit/")&&!PS("chrome/")?Math.round:Wn;function IS(t){t.min=MS(t.min),t.max=MS(t.max)}function rJ(t){IS(t.x),IS(t.y)}function CS(t,e,r){return t==="position"||t==="preserve-aspect"&&!nY(vS(e),vS(r),.2)}function nJ(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const iJ=xS({attachResizeListener:(t,e)=>Lo(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),fb={current:void 0},TS=xS({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!fb.current){const t=new iJ({});t.mount(window),t.setOptions({layoutScroll:!0}),fb.current=t}return fb.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),sJ={pan:{Feature:yY},drag:{Feature:bY,ProjectionNode:TS,MeasureLayout:tS}};function RS(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||TE())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const u=a[n];u&&Nr.postRender(()=>u(s,o))};return ko(t.current,r,i,{passive:!t.getProps()[n]})}class oJ extends _a{mount(){this.unmount=No(RS(this.node,!0),RS(this.node,!1))}unmount(){}}class aJ extends _a{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=No(Lo(this.node.current,"focus",()=>this.onFocus()),Lo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const DS=(t,e)=>e?t===e?!0:DS(t,e.parentElement):!1;function lb(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,k0(r))}class cJ extends _a{constructor(){super(...arguments),this.removeStartListeners=Wn,this.removeEndListeners=Wn,this.removeAccessibleListeners=Wn,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=ko(window,"pointerup",(a,u)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:d,globalTapTarget:p}=this.node.getProps(),y=!p&&!DS(this.node.current,a.target)?d:l;y&&Nr.update(()=>y(a,u))},{passive:!(n.onTap||n.onPointerUp)}),o=ko(window,"pointercancel",(a,u)=>this.cancelPress(a,u),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=No(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||lb("up",(u,l)=>{const{onTap:d}=this.node.getProps();d&&Nr.postRender(()=>d(u,l))})};this.removeEndListeners(),this.removeEndListeners=Lo(this.node.current,"keyup",o),lb("down",(a,u)=>{this.startPress(a,u)})},r=Lo(this.node.current,"keydown",e),n=()=>{this.isPressing&&lb("cancel",(s,o)=>this.cancelPress(s,o))},i=Lo(this.node.current,"blur",n);this.removeAccessibleListeners=No(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Nr.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!TE()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Nr.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=ko(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=Lo(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=No(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const hb=new WeakMap,db=new WeakMap,uJ=t=>{const e=hb.get(t.target);e&&e(t)},fJ=t=>{t.forEach(uJ)};function lJ({root:t,...e}){const r=t||document;db.has(r)||db.set(r,{});const n=db.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(fJ,{root:t,...e})),n[i]}function hJ(t,e,r){const n=lJ(e);return hb.set(t,r),n.observe(t),()=>{hb.delete(t),n.unobserve(t)}}const dJ={some:0,all:1};class pJ extends _a{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:dJ[i]},a=u=>{const{isIntersecting:l}=u;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:p}=this.node.getProps(),y=l?d:p;y&&y(u)};return hJ(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(gJ(e,r))&&this.startObserver()}unmount(){}}function gJ({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const mJ={inView:{Feature:pJ},tap:{Feature:cJ},focus:{Feature:aJ},hover:{Feature:oJ}},vJ={layout:{ProjectionNode:TS,MeasureLayout:tS}},pb=Ee.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),z0=Ee.createContext({}),gb=typeof window<"u",OS=gb?Ee.useLayoutEffect:Ee.useEffect,NS=Ee.createContext({strict:!1});function bJ(t,e,r,n,i){var s,o;const{visualElement:a}=Ee.useContext(z0),u=Ee.useContext(NS),l=Ee.useContext(F0),d=Ee.useContext(pb).reducedMotion,p=Ee.useRef();n=n||u.renderer,!p.current&&n&&(p.current=n(t,{visualState:e,parent:a,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d}));const y=p.current,A=Ee.useContext(QE);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&yJ(p.current,r,i,A);const P=Ee.useRef(!1);Ee.useInsertionEffect(()=>{y&&P.current&&y.update(r,l)});const N=r[mE],D=Ee.useRef(!!N&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,N))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,N)));return OS(()=>{y&&(P.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),ab.render(y.render),D.current&&y.animationState&&y.animationState.animateChanges())}),Ee.useEffect(()=>{y&&(!D.current&&y.animationState&&y.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{var k;(k=window.MotionHandoffMarkAsComplete)===null||k===void 0||k.call(window,N)}),D.current=!1))}),y}function yJ(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:u,layoutRoot:l}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:LS(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&Uu(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:u,layoutRoot:l})}function LS(t){if(t)return t.options.allowProjection!==!1?t.projection:LS(t.parent)}function wJ(t,e,r){return Ee.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):Uu(r)&&(r.current=n))},[e])}function H0(t){return P0(t.animate)||wv.some(e=>Vl(t[e]))}function kS(t){return!!(H0(t)||t.variants)}function xJ(t,e){if(H0(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Vl(r)?r:void 0,animate:Vl(n)?n:void 0}}return t.inherit!==!1?e:{}}function _J(t){const{initial:e,animate:r}=xJ(t,Ee.useContext(z0));return Ee.useMemo(()=>({initial:e,animate:r}),[BS(e),BS(r)])}function BS(t){return Array.isArray(t)?t.join(" "):t}const $S={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Wu={};for(const t in $S)Wu[t]={isEnabled:e=>$S[t].some(r=>!!e[r])};function EJ(t){for(const e in t)Wu[e]={...Wu[e],...t[e]}}const SJ=Symbol.for("motionComponentSymbol");function AJ({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&EJ(t);function s(a,u){let l;const d={...Ee.useContext(pb),...a,layoutId:PJ(a)},{isStatic:p}=d,y=_J(a),A=n(a,p);if(!p&&gb){MJ(d,t);const P=IJ(d);l=P.MeasureLayout,y.visualElement=bJ(i,A,d,e,P.ProjectionNode)}return ge.jsxs(z0.Provider,{value:y,children:[l&&y.visualElement?ge.jsx(l,{visualElement:y.visualElement,...d}):null,r(i,a,wJ(A,y.visualElement,u),A,p,y.visualElement)]})}const o=Ee.forwardRef(s);return o[SJ]=i,o}function PJ({layoutId:t}){const e=Ee.useContext(ob).id;return e&&t!==void 0?e+"-"+t:t}function MJ(t,e){const r=Ee.useContext(NS).strict;if(process.env.NODE_ENV!=="production"&&e&&r){const n="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?ku(!1,n):Oo(!1,n)}}function IJ(t){const{drag:e,layout:r}=Wu;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const CJ=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function mb(t){return typeof t!="string"||t.includes("-")?!1:!!(CJ.indexOf(t)>-1||/[A-Z]/u.test(t))}function FS(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const jS=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function US(t,e,r,n){FS(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(jS.has(i)?i:Xv(i),e.attrs[i])}function qS(t,{layout:e,layoutId:r}){return bc.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!U0[t]||t==="opacity")}function vb(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(Qn(i[o])||e.style&&Qn(e.style[o])||qS(o,t)||((n=r==null?void 0:r.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function zS(t,e,r){const n=vb(t,e,r);for(const i in t)if(Qn(t[i])||Qn(e[i])){const s=Gl.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function bb(t){const e=Ee.useRef(null);return e.current===null&&(e.current=t()),e.current}function TJ({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:RJ(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const HS=t=>(e,r)=>{const n=Ee.useContext(z0),i=Ee.useContext(F0),s=()=>TJ(t,e,n,i);return r?s():bb(s)};function RJ(t,e,r,n){const i={},s=n(t,{});for(const y in s)i[y]=q0(s[y]);let{initial:o,animate:a}=t;const u=H0(t),l=kS(t);e&&l&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const p=d?a:o;if(p&&typeof p!="boolean"&&!P0(p)){const y=Array.isArray(p)?p:[p];for(let A=0;A({style:{},transform:{},transformOrigin:{},vars:{}}),WS=()=>({...yb(),attrs:{}}),KS=(t,e)=>e&&typeof t=="number"?e.transform(t):t,DJ={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},OJ=Gl.length;function NJ(t,e,r){let n="",i=!0;for(let s=0;stypeof t=="string"&&t.toLowerCase()==="svg",FJ={useVisualState:HS({scrapeMotionValuesFromProps:zS,createRenderState:WS,onMount:(t,e,{renderState:r,latestValues:n})=>{Nr.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),Nr.render(()=>{xb(r,n,_b(e.tagName),t.transformTemplate),US(e,r)})}})},jJ={useVisualState:HS({scrapeMotionValuesFromProps:vb,createRenderState:yb})};function GS(t,e,r){for(const n in e)!Qn(e[n])&&!qS(n,r)&&(t[n]=e[n])}function UJ({transformTemplate:t},e){return Ee.useMemo(()=>{const r=yb();return wb(r,e,t),Object.assign({},r.vars,r.style)},[e])}function qJ(t,e){const r=t.style||{},n={};return GS(n,r,t),Object.assign(n,UJ(t,e)),n}function zJ(t,e){const r={},n=qJ(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const HJ=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function W0(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||HJ.has(t)}let YS=t=>!W0(t);function WJ(t){t&&(YS=e=>e.startsWith("on")?!W0(e):t(e))}try{WJ(require("@emotion/is-prop-valid").default)}catch{}function KJ(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(YS(i)||r===!0&&W0(i)||!e&&!W0(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function VJ(t,e,r,n){const i=Ee.useMemo(()=>{const s=WS();return xb(s,e,_b(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};GS(s,t.style,t),i.style={...s,...i.style}}return i}function GJ(t=!1){return(r,n,i,{latestValues:s},o)=>{const u=(mb(r)?VJ:zJ)(n,s,o,r),l=KJ(n,typeof r=="string",t),d=r!==Ee.Fragment?{...l,...u,ref:i}:{},{children:p}=n,y=Ee.useMemo(()=>Qn(p)?p.get():p,[p]);return Ee.createElement(r,{...d,children:y})}}function YJ(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...mb(n)?FJ:jJ,preloadedFeatures:t,useRender:GJ(i),createVisualElement:e,Component:n};return AJ(o)}}const Eb={current:null},JS={current:!1};function JJ(){if(JS.current=!0,!!gb)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Eb.current=t.matches;t.addListener(e),e()}else Eb.current=!1}function XJ(t,e,r){for(const n in e){const i=e[n],s=r[n];if(Qn(i))t.addValue(n,i),process.env.NODE_ENV==="development"&&A0(i.version==="11.11.17",`Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`);else if(Qn(s))t.addValue(n,th(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,th(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const XS=new WeakMap,ZJ=[...L8,Zn,xa],QJ=t=>ZJ.find(N8(t)),ZS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class eX{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Iv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=to.now();this.renderScheduledAtthis.bindToMotionValue(n,r)),JS.current||JJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Eb.current,process.env.NODE_ENV!=="production"&&A0(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){XS.delete(this.current),this.projection&&this.projection.unmount(),ba(this.notifyUpdate),ba(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=bc.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Nr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Wu){const r=Wu[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ln()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=th(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(P8(i)||A8(i))?i=parseFloat(i):!QJ(i)&&xa.test(r)&&(i=K8(e,r)),this.setBaseTarget(e,Qn(i)?i.get():i)),Qn(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=bv(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Qn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new Jv),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class QS extends eX{constructor(){super(...arguments),this.KeyframeResolver=V8}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function tX(t){return window.getComputedStyle(t)}class rX extends QS{constructor(){super(...arguments),this.type="html",this.renderInstance=FS}readValueFromInstance(e,r){if(bc.has(r)){const n=Lv(r);return n&&n.default||0}else{const n=tX(e),i=(I8(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return JE(e,r)}build(e,r,n){wb(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return vb(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Qn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class nX extends QS{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ln}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(bc.has(r)){const n=Lv(r);return n&&n.default||0}return r=jS.has(r)?r:Xv(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return zS(e,r,n)}build(e,r,n){xb(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){US(e,r,n,i)}mount(e){this.isSVGTag=_b(e.tagName),super.mount(e)}}const iX=(t,e)=>mb(t)?new nX(e):new rX(e,{allowProjection:t!==Ee.Fragment}),sX=YJ({...GG,...mJ,...sJ,...vJ},iX),oX=UK(sX);class aX extends Yt.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function cX({children:t,isPresent:e}){const r=Ee.useId(),n=Ee.useRef(null),i=Ee.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=Ee.useContext(pb);return Ee.useInsertionEffect(()=>{const{width:o,height:a,top:u,left:l}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` + */const jK=ts("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]),h8=new Set;function A0(t,e,r){t||h8.has(e)||(console.warn(e),h8.add(e))}function UK(t){if(typeof Proxy>"u")return t;const e=new Map,r=(...n)=>(process.env.NODE_ENV!=="production"&&A0(!1,"motion() is deprecated. Use motion.create() instead."),t(...n));return new Proxy(r,{get:(n,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}function P0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const vv=t=>Array.isArray(t);function d8(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function bv(t,e,r,n){if(typeof e=="function"){const[i,s]=p8(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=p8(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function M0(t,e,r){const n=t.getProps();return bv(n,e,r!==void 0?r:n.custom,t)}const yv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],wv=["initial",...yv],Gl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],bc=new Set(Gl),Qs=t=>t*1e3,Do=t=>t/1e3,qK={type:"spring",stiffness:500,damping:25,restSpeed:10},zK=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),HK={type:"keyframes",duration:.8},WK={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},KK=(t,{keyframes:e})=>e.length>2?HK:bc.has(t)?t.startsWith("scale")?zK(e[1]):qK:WK;function xv(t,e){return t?t[e]||t.default||t:void 0}const VK={useManualTiming:!1},GK=t=>t!==null;function I0(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(GK),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const Wn=t=>t;function YK(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){s.has(l)&&(u.schedule(l),t()),l(o)}const u={schedule:(l,d=!1,p=!1)=>{const A=p&&n?e:r;return d&&s.add(l),A.has(l)||A.add(l),l},cancel:l=>{r.delete(l),s.delete(l)},process:l=>{if(o=l,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,u.process(l))}};return u}const C0=["read","resolveKeyframes","update","preRender","render","postRender"],JK=40;function g8(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=C0.reduce((k,B)=>(k[B]=YK(s),k),{}),{read:a,resolveKeyframes:u,update:l,preRender:d,render:p,postRender:y}=o,A=()=>{const k=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(k-i.timestamp,JK),1),i.timestamp=k,i.isProcessing=!0,a.process(i),u.process(i),l.process(i),d.process(i),p.process(i),y.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(A))},P=()=>{r=!0,n=!0,i.isProcessing||t(A)};return{schedule:C0.reduce((k,B)=>{const q=o[B];return k[B]=(j,H=!1,J=!1)=>(r||P(),q.schedule(j,H,J)),k},{}),cancel:k=>{for(let B=0;B(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,XK=1e-7,ZK=12;function QK(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=m8(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>XK&&++aQK(s,0,1,t,r);return s=>s===0||s===1?s:m8(i(s),e,n)}const v8=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,b8=t=>e=>1-t(1-e),y8=Yl(.33,1.53,.69,.99),Ev=b8(y8),w8=v8(Ev),x8=t=>(t*=2)<1?.5*Ev(t):.5*(2-Math.pow(2,-10*(t-1))),Sv=t=>1-Math.sin(Math.acos(t)),_8=b8(Sv),E8=v8(Sv),S8=t=>/^0[^.\s]+$/u.test(t);function eV(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||S8(t):!0}let ku=Wn,Oo=Wn;process.env.NODE_ENV!=="production"&&(ku=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},Oo=(t,e)=>{if(!t)throw new Error(e)});const A8=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),P8=t=>e=>typeof e=="string"&&e.startsWith(t),M8=P8("--"),tV=P8("var(--"),Av=t=>tV(t)?rV.test(t.split("/*")[0].trim()):!1,rV=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,nV=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function iV(t){const e=nV.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}const sV=4;function I8(t,e,r=1){Oo(r<=sV,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[n,i]=iV(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return A8(o)?parseFloat(o):o}return Av(i)?I8(i,e,r+1):i}const ya=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},Jl={...Bu,transform:t=>ya(0,1,t)},T0={...Bu,default:1},Xl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),wa=Xl("deg"),eo=Xl("%"),zt=Xl("px"),oV=Xl("vh"),aV=Xl("vw"),C8={...eo,parse:t=>eo.parse(t)/100,transform:t=>eo.transform(t*100)},cV=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),T8=t=>t===Bu||t===zt,R8=(t,e)=>parseFloat(t.split(", ")[e]),D8=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return R8(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?R8(s[1],t):0}},uV=new Set(["x","y","z"]),fV=Gl.filter(t=>!uV.has(t));function lV(t){const e=[];return fV.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const $u={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:D8(4,13),y:D8(5,14)};$u.translateX=$u.x,$u.translateY=$u.y;const O8=t=>e=>e.test(t),N8=[Bu,zt,eo,wa,aV,oV,{test:t=>t==="auto",parse:t=>t}],L8=t=>N8.find(O8(t)),yc=new Set;let Pv=!1,Mv=!1;function k8(){if(Mv){const t=Array.from(yc).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=lV(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}Mv=!1,Pv=!1,yc.forEach(t=>t.complete()),yc.clear()}function B8(){yc.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Mv=!0)})}function hV(){B8(),k8()}class Iv{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(yc.add(this),Pv||(Pv=!0,Nr.read(B8),Nr.resolveKeyframes(k8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sMath.round(t*1e5)/1e5,Cv=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function dV(t){return t==null}const pV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Tv=(t,e)=>r=>!!(typeof r=="string"&&pV.test(r)&&r.startsWith(t)||e&&!dV(r)&&Object.prototype.hasOwnProperty.call(r,e)),$8=(t,e,r)=>n=>{if(typeof n!="string")return n;const[i,s,o,a]=n.match(Cv);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},gV=t=>ya(0,255,t),Rv={...Bu,transform:t=>Math.round(gV(t))},wc={test:Tv("rgb","red"),parse:$8("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+Rv.transform(t)+", "+Rv.transform(e)+", "+Rv.transform(r)+", "+Zl(Jl.transform(n))+")"};function mV(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const Dv={test:Tv("#"),parse:mV,transform:wc.transform},Fu={test:Tv("hsl","hue"),parse:$8("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+eo.transform(Zl(e))+", "+eo.transform(Zl(r))+", "+Zl(Jl.transform(n))+")"},Zn={test:t=>wc.test(t)||Dv.test(t)||Fu.test(t),parse:t=>wc.test(t)?wc.parse(t):Fu.test(t)?Fu.parse(t):Dv.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?wc.transform(t):Fu.transform(t)},vV=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function bV(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Cv))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(vV))===null||r===void 0?void 0:r.length)||0)>0}const F8="number",j8="color",yV="var",wV="var(",U8="${}",xV=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ql(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(xV,u=>(Zn.test(u)?(n.color.push(s),i.push(j8),r.push(Zn.parse(u))):u.startsWith(wV)?(n.var.push(s),i.push(yV),r.push(u)):(n.number.push(s),i.push(F8),r.push(parseFloat(u))),++s,U8)).split(U8);return{values:r,split:a,indexes:n,types:i}}function q8(t){return Ql(t).values}function z8(t){const{split:e,types:r}=Ql(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function EV(t){const e=q8(t);return z8(t)(e.map(_V))}const xa={test:bV,parse:q8,createTransformer:z8,getAnimatableNone:EV},SV=new Set(["brightness","contrast","saturate","opacity"]);function AV(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(Cv)||[];if(!n)return t;const i=r.replace(n,"");let s=SV.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const PV=/\b([a-z-]*)\(.*?\)/gu,Ov={...xa,getAnimatableNone:t=>{const e=t.match(PV);return e?e.map(AV).join(" "):t}},MV={borderWidth:zt,borderTopWidth:zt,borderRightWidth:zt,borderBottomWidth:zt,borderLeftWidth:zt,borderRadius:zt,radius:zt,borderTopLeftRadius:zt,borderTopRightRadius:zt,borderBottomRightRadius:zt,borderBottomLeftRadius:zt,width:zt,maxWidth:zt,height:zt,maxHeight:zt,top:zt,right:zt,bottom:zt,left:zt,padding:zt,paddingTop:zt,paddingRight:zt,paddingBottom:zt,paddingLeft:zt,margin:zt,marginTop:zt,marginRight:zt,marginBottom:zt,marginLeft:zt,backgroundPositionX:zt,backgroundPositionY:zt},IV={rotate:wa,rotateX:wa,rotateY:wa,rotateZ:wa,scale:T0,scaleX:T0,scaleY:T0,scaleZ:T0,skew:wa,skewX:wa,skewY:wa,distance:zt,translateX:zt,translateY:zt,translateZ:zt,x:zt,y:zt,z:zt,perspective:zt,transformPerspective:zt,opacity:Jl,originX:C8,originY:C8,originZ:zt},H8={...Bu,transform:Math.round},Nv={...MV,...IV,zIndex:H8,size:zt,fillOpacity:Jl,strokeOpacity:Jl,numOctaves:H8},CV={...Nv,color:Zn,backgroundColor:Zn,outlineColor:Zn,fill:Zn,stroke:Zn,borderColor:Zn,borderTopColor:Zn,borderRightColor:Zn,borderBottomColor:Zn,borderLeftColor:Zn,filter:Ov,WebkitFilter:Ov},Lv=t=>CV[t];function W8(t,e){let r=Lv(t);return r!==Ov&&(r=xa),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const TV=new Set(["auto","none","0"]);function RV(t,e,r){let n=0,i;for(;n{r.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function kv(t){return typeof t=="function"}let R0;function DV(){R0=void 0}const to={now:()=>(R0===void 0&&to.set(Kn.isProcessing||VK.useManualTiming?Kn.timestamp:performance.now()),R0),set:t=>{R0=t,queueMicrotask(DV)}},V8=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(xa.test(t)||t==="0")&&!t.startsWith("url("));function OV(t){const e=t[0];if(t.length===1)return!0;for(let r=0;rLV?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&hV(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=to.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:u,isGenerator:l}=this.options;if(!l&&!NV(e,n,i,s))if(o)this.options.duration=0;else{u==null||u(I0(e,this.options,r)),a==null||a(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,r);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...d},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function Y8(t,e){return e?t*(1e3/e):0}const kV=5;function J8(t,e,r){const n=Math.max(e-kV,0);return Y8(r-t(n),e-n)}const Bv=.001,BV=.01,X8=10,$V=.05,FV=1;function jV({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;ku(t<=Qs(X8),"Spring duration must be 10 seconds or less");let o=1-e;o=ya($V,FV,o),t=ya(BV,X8,Do(t)),o<1?(i=l=>{const d=l*o,p=d*t,y=d-r,A=$v(l,o),P=Math.exp(-p);return Bv-y/A*P},s=l=>{const p=l*o*t,y=p*r+r,A=Math.pow(o,2)*Math.pow(l,2)*t,P=Math.exp(-p),O=$v(Math.pow(l,2),o);return(-i(l)+Bv>0?-1:1)*((y-A)*P)/O}):(i=l=>{const d=Math.exp(-l*t),p=(l-r)*t+1;return-Bv+d*p},s=l=>{const d=Math.exp(-l*t),p=(r-l)*(t*t);return d*p});const a=5/t,u=qV(i,s,a);if(t=Qs(t),isNaN(u))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(u,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:t}}}const UV=12;function qV(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function WV(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!Z8(t,HV)&&Z8(t,zV)){const r=jV(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function Q8({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:u,mass:l,duration:d,velocity:p,isResolvedFromDuration:y}=WV({...n,velocity:-Do(n.velocity||0)}),A=p||0,P=u/(2*Math.sqrt(a*l)),O=s-i,D=Do(Math.sqrt(a/l)),k=Math.abs(O)<5;r||(r=k?.01:2),e||(e=k?.005:.5);let B;if(P<1){const q=$v(D,P);B=j=>{const H=Math.exp(-P*D*j);return s-H*((A+P*D*O)/q*Math.sin(q*j)+O*Math.cos(q*j))}}else if(P===1)B=q=>s-Math.exp(-D*q)*(O+(A+D*O)*q);else{const q=D*Math.sqrt(P*P-1);B=j=>{const H=Math.exp(-P*D*j),J=Math.min(q*j,300);return s-H*((A+P*D*O)*Math.sinh(J)+q*O*Math.cosh(J))/q}}return{calculatedDuration:y&&d||null,next:q=>{const j=B(q);if(y)o.done=q>=d;else{let H=0;P<1&&(H=q===0?Qs(A):J8(B,q,j));const J=Math.abs(H)<=r,T=Math.abs(s-j)<=e;o.done=J&&T}return o.value=o.done?s:j,o}}}function eE({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:d}){const p=t[0],y={done:!1,value:p},A=z=>a!==void 0&&zu,P=z=>a===void 0?u:u===void 0||Math.abs(a-z)-O*Math.exp(-z/n),q=z=>k+B(z),j=z=>{const ue=B(z),_e=q(z);y.done=Math.abs(ue)<=l,y.value=y.done?k:_e};let H,J;const T=z=>{A(y.value)&&(H=z,J=Q8({keyframes:[y.value,P(y.value)],velocity:J8(q,z,y.value),damping:i,stiffness:s,restDelta:l,restSpeed:d}))};return T(0),{calculatedDuration:null,next:z=>{let ue=!1;return!J&&H===void 0&&(ue=!0,j(z),T(z)),H!==void 0&&z>=H?J.next(z-H):(!ue&&j(z),y)}}}const KV=Yl(.42,0,1,1),VV=Yl(0,0,.58,1),tE=Yl(.42,0,.58,1),GV=t=>Array.isArray(t)&&typeof t[0]!="number",Fv=t=>Array.isArray(t)&&typeof t[0]=="number",rE={linear:Wn,easeIn:KV,easeInOut:tE,easeOut:VV,circIn:Sv,circInOut:E8,circOut:_8,backIn:Ev,backInOut:w8,backOut:y8,anticipate:x8},nE=t=>{if(Fv(t)){Oo(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,r,n,i]=t;return Yl(e,r,n,i)}else if(typeof t=="string")return Oo(rE[t]!==void 0,`Invalid easing type '${t}'`),rE[t];return t},YV=(t,e)=>r=>e(t(r)),No=(...t)=>t.reduce(YV),ju=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},Zr=(t,e,r)=>t+(e-t)*r;function jv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function JV({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,u=2*r-a;i=jv(u,a,t+1/3),s=jv(u,a,t),o=jv(u,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function D0(t,e){return r=>r>0?e:t}const Uv=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},XV=[Dv,wc,Fu],ZV=t=>XV.find(e=>e.test(t));function iE(t){const e=ZV(t);if(ku(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let r=e.parse(t);return e===Fu&&(r=JV(r)),r}const sE=(t,e)=>{const r=iE(t),n=iE(e);if(!r||!n)return D0(t,e);const i={...r};return s=>(i.red=Uv(r.red,n.red,s),i.green=Uv(r.green,n.green,s),i.blue=Uv(r.blue,n.blue,s),i.alpha=Zr(r.alpha,n.alpha,s),wc.transform(i))},qv=new Set(["none","hidden"]);function QV(t,e){return qv.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function eG(t,e){return r=>Zr(t,e,r)}function zv(t){return typeof t=="number"?eG:typeof t=="string"?Av(t)?D0:Zn.test(t)?sE:nG:Array.isArray(t)?oE:typeof t=="object"?Zn.test(t)?sE:tG:D0}function oE(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>zv(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function rG(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=xa.createTransformer(e),n=Ql(t),i=Ql(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?qv.has(t)&&!i.values.length||qv.has(e)&&!n.values.length?QV(t,e):No(oE(rG(n,i),i.values),r):(ku(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),D0(t,e))};function aE(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Zr(t,e,r):zv(t)(t,e)}function iG(t,e,r){const n=[],i=r||aE,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=iG(e,n,i),a=o.length,u=l=>{let d=0;if(a>1)for(;du(ya(t[0],t[s-1],l)):u}function oG(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=ju(0,e,n);t.push(Zr(r,1,i))}}function aG(t){const e=[0];return oG(e,t.length-1),e}function cG(t,e){return t.map(r=>r*e)}function uG(t,e){return t.map(()=>e||tE).splice(0,t.length-1)}function O0({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=GV(n)?n.map(nE):nE(n),s={done:!1,value:e[0]},o=cG(r&&r.length===e.length?r:aG(e),t),a=sG(o,e,{ease:Array.isArray(i)?i:uG(e,i)});return{calculatedDuration:t,next:u=>(s.value=a(u),s.done=u>=t,s)}}const cE=2e4;function fG(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=cE?1/0:e}const lG=t=>{const e=({timestamp:r})=>t(r);return{start:()=>Nr.update(e,!0),stop:()=>ba(e),now:()=>Kn.isProcessing?Kn.timestamp:to.now()}},hG={decay:eE,inertia:eE,tween:O0,keyframes:O0,spring:Q8},dG=t=>t/100;class Hv extends G8{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:u}=this.options;u&&u()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Iv,a=(u,l)=>this.onKeyframesResolved(u,l);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=kv(r)?r:hG[r]||O0;let u,l;a!==O0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&Oo(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),u=No(dG,aE(e[0],e[1])),e=[0,100]);const d=a({...this.options,keyframes:e});s==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=fG(d));const{calculatedDuration:p}=d,y=p+i,A=y*(n+1)-i;return{generator:d,mirroredGenerator:l,mapPercentToKeyframes:u,calculatedDuration:p,resolvedDuration:y,totalDuration:A}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:z}=this.options;return{done:!0,value:z[z.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:u,calculatedDuration:l,totalDuration:d,resolvedDuration:p}=n;if(this.startTime===null)return s.next(0);const{delay:y,repeat:A,repeatType:P,repeatDelay:O,onUpdate:D}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const k=this.currentTime-y*(this.speed>=0?1:-1),B=this.speed>=0?k<0:k>d;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let q=this.currentTime,j=s;if(A){const z=Math.min(this.currentTime,d)/p;let ue=Math.floor(z),_e=z%1;!_e&&z>=1&&(_e=1),_e===1&&ue--,ue=Math.min(ue,A+1),!!(ue%2)&&(P==="reverse"?(_e=1-_e,O&&(_e-=O/p)):P==="mirror"&&(j=o)),q=ya(0,1,_e)*p}const H=B?{done:!1,value:u[0]}:j.next(q);a&&(H.value=a(H.value));let{done:J}=H;!B&&l!==null&&(J=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&J);return T&&i!==void 0&&(H.value=I0(u,this.options,i)),D&&D(H.value),T&&this.finish(),H}get duration(){const{resolved:e}=this;return e?Do(e.calculatedDuration):0}get time(){return Do(this.currentTime)}set time(e){e=Qs(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=Do(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=lG,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const pG=new Set(["opacity","clipPath","filter","transform"]),gG=10,mG=(t,e)=>{let r="";const n=Math.max(Math.round(e/gG),2);for(let i=0;i(e===void 0&&(e=t()),e)}const vG={linearEasing:void 0};function bG(t,e){const r=Wv(t);return()=>{var n;return(n=vG[e])!==null&&n!==void 0?n:r()}}const N0=bG(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function uE(t){return!!(typeof t=="function"&&N0()||!t||typeof t=="string"&&(t in Kv||N0())||Fv(t)||Array.isArray(t)&&t.every(uE))}const eh=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,Kv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:eh([0,.65,.55,1]),circOut:eh([.55,0,1,.45]),backIn:eh([.31,.01,.66,-.59]),backOut:eh([.33,1.53,.69,.99])};function fE(t,e){if(t)return typeof t=="function"&&N0()?mG(t,e):Fv(t)?eh(t):Array.isArray(t)?t.map(r=>fE(r,e)||Kv.easeOut):Kv[t]}function yG(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:u}={}){const l={[e]:r};u&&(l.offset=u);const d=fE(a,i);return Array.isArray(d)&&(l.easing=d),t.animate(l,{delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function lE(t,e){t.timeline=e,t.onfinish=null}const wG=Wv(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),L0=10,xG=2e4;function _G(t){return kv(t.type)||t.type==="spring"||!uE(t.ease)}function EG(t,e){const r=new Hv({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&sthis.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:u,name:l,startTime:d}=this.options;if(!(!((n=u.owner)===null||n===void 0)&&n.current))return!1;if(typeof o=="string"&&N0()&&SG(o)&&(o=hE[o]),_G(this.options)){const{onComplete:y,onUpdate:A,motionValue:P,element:O,...D}=this.options,k=EG(e,D);e=k.keyframes,e.length===1&&(e[1]=e[0]),i=k.duration,s=k.times,o=k.ease,a="keyframes"}const p=yG(u.owner.current,l,e,{...this.options,duration:i,times:s,ease:o});return p.startTime=d??this.calcStartTime(),this.pendingTimeline?(lE(p,this.pendingTimeline),this.pendingTimeline=void 0):p.onfinish=()=>{const{onComplete:y}=this.options;u.set(I0(e,this.options,r)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:p,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return Do(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return Do(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=Qs(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return Wn;const{animation:n}=r;lE(n,e)}return Wn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:d,onComplete:p,element:y,...A}=this.options,P=new Hv({...A,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),O=Qs(this.time);l.setWithVelocity(P.sample(O-L0).value,P.sample(O).value,L0)}const{onStop:u}=this.options;u&&u(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return wG()&&n&&pG.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}const AG=Wv(()=>window.ScrollTimeline!==void 0);class PG{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;nAG()&&i.attachTimeline?i.attachTimeline(e):r(i));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function MG({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:u,elapsed:l,...d}){return!!Object.keys(d).length}const Vv=(t,e,r,n={},i,s)=>o=>{const a=xv(n,t)||{},u=a.delay||n.delay||0;let{elapsed:l=0}=n;l=l-Qs(u);let d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:y=>{e.set(y),a.onUpdate&&a.onUpdate(y)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:i};MG(a)||(d={...d,...KK(t,d)}),d.duration&&(d.duration=Qs(d.duration)),d.repeatDelay&&(d.repeatDelay=Qs(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let p=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(p=!0)),p&&!s&&e.get()!==void 0){const y=I0(d.keyframes,a);if(y!==void 0)return Nr.update(()=>{d.onUpdate(y),d.onComplete()}),new PG([])}return!s&&dE.supports(d)?new dE(d):new Hv(d)},IG=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),CG=t=>vv(t)?t[t.length-1]||0:t;function Gv(t,e){t.indexOf(e)===-1&&t.push(e)}function Yv(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class Jv{constructor(){this.subscriptions=[]}add(e){return Gv(this.subscriptions,e),()=>Yv(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class RG{constructor(e,r={}){this.version="11.11.17",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=to.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=to.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=TG(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&A0(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new Jv);const n=this.events[e].add(r);return e==="change"?()=>{n(),Nr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=to.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>pE)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,pE);return Y8(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function th(t,e){return new RG(t,e)}function DG(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,th(r))}function OG(t,e){const r=M0(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=CG(s[o]);DG(t,o,a)}}const Xv=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),gE="data-"+Xv("framerAppearId");function mE(t){return t.props[gE]}const Qn=t=>!!(t&&t.getVelocity);function NG(t){return!!(Qn(t)&&t.add)}function Zv(t,e){const r=t.getValue("willChange");if(NG(r))return r.add(e)}function LG({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function vE(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...u}=e;n&&(o=n);const l=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const p in u){const y=t.getValue(p,(s=t.latestValues[p])!==null&&s!==void 0?s:null),A=u[p];if(A===void 0||d&&LG(d,p))continue;const P={delay:r,...xv(o||{},p)};let O=!1;if(window.MotionHandoffAnimation){const k=mE(t);if(k){const B=window.MotionHandoffAnimation(k,p,Nr);B!==null&&(P.startTime=B,O=!0)}}Zv(t,p),y.start(Vv(p,y,A,t.shouldReduceMotion&&bc.has(p)?{type:!1}:P,t,O));const D=y.animation;D&&l.push(D)}return a&&Promise.all(l).then(()=>{Nr.update(()=>{a&&OG(t,a)})}),l}function Qv(t,e,r={}){var n;const i=M0(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(vE(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:y}=s;return kG(t,e,d+l,p,y,r)}:()=>Promise.resolve(),{when:u}=s;if(u){const[l,d]=u==="beforeChildren"?[o,a]:[a,o];return l().then(()=>d())}else return Promise.all([o(),a(r.delay)])}function kG(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,u=i===1?(l=0)=>l*n:(l=0)=>a-l*n;return Array.from(t.variantChildren).sort(BG).forEach((l,d)=>{l.notify("AnimationStart",e),o.push(Qv(l,e,{...s,delay:r+u(d)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function BG(t,e){return t.sortNodePosition(e)}function $G(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>Qv(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=Qv(t,e,r);else{const i=typeof e=="function"?M0(t,e,r.custom):e;n=Promise.all(vE(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const FG=wv.length;function bE(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?bE(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;rPromise.all(e.map(({animation:r,options:n})=>$G(t,r,n)))}function zG(t){let e=qG(t),r=yE(),n=!0;const i=u=>(l,d)=>{var p;const y=M0(t,d,u==="exit"?(p=t.presenceContext)===null||p===void 0?void 0:p.custom:void 0);if(y){const{transition:A,transitionEnd:P,...O}=y;l={...l,...O,...P}}return l};function s(u){e=u(t)}function o(u){const{props:l}=t,d=bE(t.parent)||{},p=[],y=new Set;let A={},P=1/0;for(let D=0;DP&&j,ue=!1;const _e=Array.isArray(q)?q:[q];let G=_e.reduce(i(k),{});H===!1&&(G={});const{prevResolvedValues:E={}}=B,m={...E,...G},f=x=>{z=!0,y.has(x)&&(ue=!0,y.delete(x)),B.needsAnimating[x]=!0;const _=t.getValue(x);_&&(_.liveStyle=!1)};for(const x in m){const _=G[x],S=E[x];if(A.hasOwnProperty(x))continue;let b=!1;vv(_)&&vv(S)?b=!d8(_,S):b=_!==S,b?_!=null?f(x):y.add(x):_!==void 0&&y.has(x)?f(x):B.protectedKeys[x]=!0}B.prevProp=q,B.prevResolvedValues=G,B.isActive&&(A={...A,...G}),n&&t.blockInitialAnimation&&(z=!1),z&&(!(J&&T)||ue)&&p.push(..._e.map(x=>({animation:x,options:{type:k}})))}if(y.size){const D={};y.forEach(k=>{const B=t.getBaseTarget(k),q=t.getValue(k);q&&(q.liveStyle=!0),D[k]=B??null}),p.push({animation:D})}let O=!!p.length;return n&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(O=!1),n=!1,O?e(p):Promise.resolve()}function a(u,l){var d;if(r[u].isActive===l)return Promise.resolve();(d=t.variantChildren)===null||d===void 0||d.forEach(y=>{var A;return(A=y.animationState)===null||A===void 0?void 0:A.setActive(u,l)}),r[u].isActive=l;const p=o(u);for(const y in r)r[y].protectedKeys={};return p}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=yE(),n=!0}}}function HG(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!d8(e,t):!1}function xc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function yE(){return{animate:xc(!0),whileInView:xc(),whileHover:xc(),whileTap:xc(),whileDrag:xc(),whileFocus:xc(),exit:xc()}}class _a{constructor(e){this.isMounted=!1,this.node=e}update(){}}class WG extends _a{constructor(e){super(e),e.animationState||(e.animationState=zG(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();P0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let KG=0;class VG extends _a{constructor(){super(...arguments),this.id=KG++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const GG={animation:{Feature:WG},exit:{Feature:VG}},wE=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function k0(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const YG=t=>e=>wE(e)&&t(e,k0(e));function Lo(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function ko(t,e,r,n){return Lo(t,e,YG(r),n)}const xE=(t,e)=>Math.abs(t-e);function JG(t,e){const r=xE(t.x,e.x),n=xE(t.y,e.y);return Math.sqrt(r**2+n**2)}class _E{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=tb(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,A=JG(p.offset,{x:0,y:0})>=3;if(!y&&!A)return;const{point:P}=p,{timestamp:O}=Kn;this.history.push({...P,timestamp:O});const{onStart:D,onMove:k}=this.handlers;y||(D&&D(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,p)},this.handlePointerMove=(p,y)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=eb(y,this.transformPagePoint),Nr.update(this.updatePoint,!0)},this.handlePointerUp=(p,y)=>{this.end();const{onEnd:A,onSessionEnd:P,resumeAnimation:O}=this.handlers;if(this.dragSnapToOrigin&&O&&O(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=tb(p.type==="pointercancel"?this.lastMoveEventInfo:eb(y,this.transformPagePoint),this.history);this.startEvent&&A&&A(p,D),P&&P(p,D)},!wE(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=k0(e),a=eb(o,this.transformPagePoint),{point:u}=a,{timestamp:l}=Kn;this.history=[{...u,timestamp:l}];const{onSessionStart:d}=r;d&&d(e,tb(a,this.history)),this.removeListeners=No(ko(this.contextWindow,"pointermove",this.handlePointerMove),ko(this.contextWindow,"pointerup",this.handlePointerUp),ko(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),ba(this.updatePoint)}}function eb(t,e){return e?{point:e(t.point)}:t}function EE(t,e){return{x:t.x-e.x,y:t.y-e.y}}function tb({point:t},e){return{point:t,delta:EE(t,SE(e)),offset:EE(t,XG(e)),velocity:ZG(e,.1)}}function XG(t){return t[0]}function SE(t){return t[t.length-1]}function ZG(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=SE(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>Qs(e)));)r--;if(!n)return{x:0,y:0};const s=Do(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function AE(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const PE=AE("dragHorizontal"),ME=AE("dragVertical");function IE(t){let e=!1;if(t==="y")e=ME();else if(t==="x")e=PE();else{const r=PE(),n=ME();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function CE(){const t=IE(!0);return t?(t(),!1):!0}function Uu(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const TE=1e-4,QG=1-TE,eY=1+TE,RE=.01,tY=0-RE,rY=0+RE;function Ni(t){return t.max-t.min}function nY(t,e,r){return Math.abs(t-e)<=r}function DE(t,e,r,n=.5){t.origin=n,t.originPoint=Zr(e.min,e.max,t.origin),t.scale=Ni(r)/Ni(e),t.translate=Zr(r.min,r.max,t.origin)-t.originPoint,(t.scale>=QG&&t.scale<=eY||isNaN(t.scale))&&(t.scale=1),(t.translate>=tY&&t.translate<=rY||isNaN(t.translate))&&(t.translate=0)}function rh(t,e,r,n){DE(t.x,e.x,r.x,n?n.originX:void 0),DE(t.y,e.y,r.y,n?n.originY:void 0)}function OE(t,e,r){t.min=r.min+e.min,t.max=t.min+Ni(e)}function iY(t,e,r){OE(t.x,e.x,r.x),OE(t.y,e.y,r.y)}function NE(t,e,r){t.min=e.min-r.min,t.max=t.min+Ni(e)}function nh(t,e,r){NE(t.x,e.x,r.x),NE(t.y,e.y,r.y)}function sY(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?Zr(r,t,n.max):Math.min(t,r)),t}function LE(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function oY(t,{top:e,left:r,bottom:n,right:i}){return{x:LE(t.x,r,i),y:LE(t.y,e,n)}}function kE(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=ju(e.min,e.max-n,t.min):n>i&&(r=ju(t.min,t.max-i,e.min)),ya(0,1,r)}function uY(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const rb=.35;function fY(t=rb){return t===!1?t=0:t===!0&&(t=rb),{x:BE(t,"left","right"),y:BE(t,"top","bottom")}}function BE(t,e,r){return{min:$E(t,e),max:$E(t,r)}}function $E(t,e){return typeof t=="number"?t:t[e]||0}const FE=()=>({translate:0,scale:1,origin:0,originPoint:0}),qu=()=>({x:FE(),y:FE()}),jE=()=>({min:0,max:0}),ln=()=>({x:jE(),y:jE()});function rs(t){return[t("x"),t("y")]}function UE({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function lY({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function hY(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function nb(t){return t===void 0||t===1}function ib({scale:t,scaleX:e,scaleY:r}){return!nb(t)||!nb(e)||!nb(r)}function _c(t){return ib(t)||qE(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function qE(t){return zE(t.x)||zE(t.y)}function zE(t){return t&&t!=="0%"}function B0(t,e,r){const n=t-r,i=e*n;return r+i}function HE(t,e,r,n,i){return i!==void 0&&(t=B0(t,i,n)),B0(t,r,n)+e}function sb(t,e=0,r=1,n,i){t.min=HE(t.min,e,r,n,i),t.max=HE(t.max,e,r,n,i)}function WE(t,{x:e,y:r}){sb(t.x,e.translate,e.scale,e.originPoint),sb(t.y,r.translate,r.scale,r.originPoint)}const KE=.999999999999,VE=1.0000000000001;function dY(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;aKE&&(e.x=1),e.yKE&&(e.y=1)}function zu(t,e){t.min=t.min+e,t.max=t.max+e}function GE(t,e,r,n,i=.5){const s=Zr(t.min,t.max,i);sb(t,e,r,s,n)}function Hu(t,e){GE(t.x,e.x,e.scaleX,e.scale,e.originX),GE(t.y,e.y,e.scaleY,e.scale,e.originY)}function YE(t,e){return UE(hY(t.getBoundingClientRect(),e))}function pY(t,e,r){const n=YE(t,r),{scroll:i}=e;return i&&(zu(n.x,i.offset.x),zu(n.y,i.offset.y)),n}const JE=({current:t})=>t?t.ownerDocument.defaultView:null,gY=new WeakMap;class mY{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ln(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:p}=this.getProps();p?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(k0(d,"page").point)},s=(d,p)=>{const{drag:y,dragPropagation:A,onDragStart:P}=this.getProps();if(y&&!A&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=IE(y),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),rs(D=>{let k=this.getAxisMotionValue(D).get()||0;if(eo.test(k)){const{projection:B}=this.visualElement;if(B&&B.layout){const q=B.layout.layoutBox[D];q&&(k=Ni(q)*(parseFloat(k)/100))}}this.originPoint[D]=k}),P&&Nr.postRender(()=>P(d,p)),Zv(this.visualElement,"transform");const{animationState:O}=this.visualElement;O&&O.setActive("whileDrag",!0)},o=(d,p)=>{const{dragPropagation:y,dragDirectionLock:A,onDirectionLock:P,onDrag:O}=this.getProps();if(!y&&!this.openGlobalLock)return;const{offset:D}=p;if(A&&this.currentDirection===null){this.currentDirection=vY(D),this.currentDirection!==null&&P&&P(this.currentDirection);return}this.updateAxis("x",p.point,D),this.updateAxis("y",p.point,D),this.visualElement.render(),O&&O(d,p)},a=(d,p)=>this.stop(d,p),u=()=>rs(d=>{var p;return this.getAnimationState(d)==="paused"&&((p=this.getAxisMotionValue(d).animation)===null||p===void 0?void 0:p.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new _E(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:JE(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Nr.postRender(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!$0(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=sY(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&Uu(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=oY(i.layoutBox,r):this.constraints=!1,this.elastic=fY(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&rs(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=uY(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!Uu(e))return!1;const n=e.current;Oo(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=pY(n,i.root,this.visualElement.getTransformPagePoint());let o=aY(i.layout.layoutBox,s);if(r){const a=r(lY(o));this.hasMutatedConstraints=!!a,a&&(o=UE(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),u=this.constraints||{},l=rs(d=>{if(!$0(d,r,this.currentDirection))return;let p=u&&u[d]||{};o&&(p={min:0,max:0});const y=i?200:1e6,A=i?40:1e7,P={type:"inertia",velocity:n?e[d]:0,bounceStiffness:y,bounceDamping:A,timeConstant:750,restDelta:1,restSpeed:10,...s,...p};return this.startAxisValueAnimation(d,P)});return Promise.all(l).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return Zv(this.visualElement,e),n.start(Vv(e,n,0,r,this.visualElement,!1))}stopAnimation(){rs(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){rs(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){rs(r=>{const{drag:n}=this.getProps();if(!$0(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-Zr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!Uu(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};rs(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const u=a.get();i[o]=cY({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),rs(o=>{if(!$0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:u,max:l}=this.constraints[o];a.set(Zr(u,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;gY.set(this.visualElement,this);const e=this.visualElement.current,r=ko(e,"pointerdown",u=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();Uu(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Nr.read(n);const o=Lo(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(rs(d=>{const p=this.getAxisMotionValue(d);p&&(this.originPoint[d]+=u[d].translate,p.set(p.get()+u[d].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=rb,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function $0(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function vY(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class bY extends _a{constructor(e){super(e),this.removeGroupControls=Wn,this.removeListeners=Wn,this.controls=new mY(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Wn}unmount(){this.removeGroupControls(),this.removeListeners()}}const XE=t=>(e,r)=>{t&&Nr.postRender(()=>t(e,r))};class yY extends _a{constructor(){super(...arguments),this.removePointerDownListener=Wn}onPointerDown(e){this.session=new _E(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:JE(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:XE(e),onStart:XE(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&Nr.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=ko(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const F0=Se.createContext(null);function wY(){const t=Se.useContext(F0);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=Se.useId();Se.useEffect(()=>n(i),[]);const s=Se.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const ob=Se.createContext({}),ZE=Se.createContext({}),j0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function QE(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ih={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(zt.test(t))t=parseFloat(t);else return t;const r=QE(t,e.target.x),n=QE(t,e.target.y);return`${r}% ${n}%`}},xY={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=xa.parse(t);if(i.length>5)return n;const s=xa.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,u=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=u;const l=Zr(a,u,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),s(i)}},U0={};function _Y(t){Object.assign(U0,t)}const{schedule:ab}=g8(queueMicrotask,!1);class EY extends Se.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;_Y(SY),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),j0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Nr.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ab.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function eS(t){const[e,r]=wY(),n=Se.useContext(ob);return de.jsx(EY,{...t,layoutGroup:n,switchLayoutGroup:Se.useContext(ZE),isPresent:e,safeToRemove:r})}const SY={borderRadius:{...ih,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ih,borderTopRightRadius:ih,borderBottomLeftRadius:ih,borderBottomRightRadius:ih,boxShadow:xY},tS=["TopLeft","TopRight","BottomLeft","BottomRight"],AY=tS.length,rS=t=>typeof t=="string"?parseFloat(t):t,nS=t=>typeof t=="number"||zt.test(t);function PY(t,e,r,n,i,s){i?(t.opacity=Zr(0,r.opacity!==void 0?r.opacity:1,MY(n)),t.opacityExit=Zr(e.opacity!==void 0?e.opacity:1,0,IY(n))):s&&(t.opacity=Zr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(ju(t,e,n))}function oS(t,e){t.min=e.min,t.max=e.max}function ns(t,e){oS(t.x,e.x),oS(t.y,e.y)}function aS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function cS(t,e,r,n,i){return t-=e,t=B0(t,1/r,n),i!==void 0&&(t=B0(t,1/i,n)),t}function CY(t,e=0,r=1,n=.5,i,s=t,o=t){if(eo.test(e)&&(e=parseFloat(e),e=Zr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Zr(s.min,s.max,n);t===s&&(a-=e),t.min=cS(t.min,e,r,a,i),t.max=cS(t.max,e,r,a,i)}function uS(t,e,[r,n,i],s,o){CY(t,e[r],e[n],e[i],e.scale,s,o)}const TY=["x","scaleX","originX"],RY=["y","scaleY","originY"];function fS(t,e,r,n){uS(t.x,e,TY,r?r.x:void 0,n?n.x:void 0),uS(t.y,e,RY,r?r.y:void 0,n?n.y:void 0)}function lS(t){return t.translate===0&&t.scale===1}function hS(t){return lS(t.x)&&lS(t.y)}function dS(t,e){return t.min===e.min&&t.max===e.max}function DY(t,e){return dS(t.x,e.x)&&dS(t.y,e.y)}function pS(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function gS(t,e){return pS(t.x,e.x)&&pS(t.y,e.y)}function mS(t){return Ni(t.x)/Ni(t.y)}function vS(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class OY{constructor(){this.members=[]}add(e){Gv(this.members,e),e.scheduleRender()}remove(e){if(Yv(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function NY(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:l,rotate:d,rotateX:p,rotateY:y,skewX:A,skewY:P}=r;l&&(n=`perspective(${l}px) ${n}`),d&&(n+=`rotate(${d}deg) `),p&&(n+=`rotateX(${p}deg) `),y&&(n+=`rotateY(${y}deg) `),A&&(n+=`skewX(${A}deg) `),P&&(n+=`skewY(${P}deg) `)}const a=t.x.scale*e.x,u=t.y.scale*e.y;return(a!==1||u!==1)&&(n+=`scale(${a}, ${u})`),n||"none"}const LY=(t,e)=>t.depth-e.depth;class kY{constructor(){this.children=[],this.isDirty=!1}add(e){Gv(this.children,e),this.isDirty=!0}remove(e){Yv(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(LY),this.isDirty=!1,this.children.forEach(e)}}function q0(t){const e=Qn(t)?t.get():t;return IG(e)?e.toValue():e}function BY(t,e){const r=to.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(ba(n),t(s-e))};return Nr.read(n,!0),()=>ba(n)}function $Y(t){return t instanceof SVGElement&&t.tagName!=="svg"}function FY(t,e,r){const n=Qn(t)?t:th(t);return n.start(Vv("",n,e,r)),n.animation}const Ec={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},sh=typeof window<"u"&&window.MotionDebug!==void 0,cb=["","X","Y","Z"],jY={visibility:"hidden"},bS=1e3;let UY=0;function ub(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function yS(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=mE(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Nr,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&yS(n)}function wS({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=UY++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,sh&&(Ec.totalNodes=Ec.resolvedTargetDeltas=Ec.recalculatedProjection=0),this.nodes.forEach(HY),this.nodes.forEach(YY),this.nodes.forEach(JY),this.nodes.forEach(WY),sh&&window.MotionDebug.record(Ec)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let u=0;uthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,p&&p(),p=BY(y,250),j0.hasAnimatedSinceResize&&(j0.hasAnimatedSinceResize=!1,this.nodes.forEach(_S))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&d&&(u||l)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:y,hasRelativeTargetChanged:A,layout:P})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const O=this.options.transition||d.getDefaultTransition()||tJ,{onLayoutAnimationStart:D,onLayoutAnimationComplete:k}=d.getProps(),B=!this.targetLayout||!gS(this.targetLayout,P)||A,q=!y&&A;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||q||y&&(B||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(p,q);const j={...xv(O,"layout"),onPlay:D,onComplete:k};(d.shouldReduceMotion||this.options.layoutRoot)&&(j.delay=0,j.type=!1),this.startAnimation(j)}else y||_S(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=P})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,ba(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(XY),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&yS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u{const H=j/1e3;ES(p.x,o.x,H),ES(p.y,o.y,H),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(nh(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),QY(this.relativeTarget,this.relativeTargetOrigin,y,H),q&&DY(this.relativeTarget,q)&&(this.isProjectionDirty=!1),q||(q=ln()),ns(q,this.relativeTarget)),O&&(this.animationValues=d,PY(d,l,this.latestValues,H,B,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=H},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(ba(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nr.update(()=>{j0.hasAnimatedSinceResize=!0,this.currentAnimation=FY(0,bS,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(bS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:u,layout:l,latestValues:d}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&IS(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||ln();const p=Ni(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+p;const y=Ni(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+y}ns(a,u),Hu(a,d),rh(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new OY),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(a=!0),!a)return;const l={};u.z&&ub("z",o,l,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(xS),this.root.sharedNodes.clear()}}}function qY(t){t.updateLayout()}function zY(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?rs(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],A=Ni(y);y.min=n[p].min,y.max=y.min+A}):IS(s,r.layoutBox,n)&&rs(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],A=Ni(n[p]);y.max=y.min+A,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[p].max=t.relativeTarget[p].min+A)});const a=qu();rh(a,n,r.layoutBox);const u=qu();o?rh(u,t.applyTransform(i,!0),r.measuredBox):rh(u,n,r.layoutBox);const l=!hS(a);let d=!1;if(!t.resumeFrom){const p=t.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:y,layout:A}=p;if(y&&A){const P=ln();nh(P,r.layoutBox,y.layoutBox);const O=ln();nh(O,n,A.layoutBox),gS(P,O)||(d=!0),p.options.layoutRoot&&(t.relativeTarget=O,t.relativeTargetOrigin=P,t.relativeParent=p)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:u,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function HY(t){sh&&Ec.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function WY(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function KY(t){t.clearSnapshot()}function xS(t){t.clearMeasurements()}function VY(t){t.isLayoutDirty=!1}function GY(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function _S(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function YY(t){t.resolveTargetDelta()}function JY(t){t.calcProjection()}function XY(t){t.resetSkewAndRotation()}function ZY(t){t.removeLeadSnapshot()}function ES(t,e,r){t.translate=Zr(e.translate,0,r),t.scale=Zr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function SS(t,e,r,n){t.min=Zr(e.min,r.min,n),t.max=Zr(e.max,r.max,n)}function QY(t,e,r,n){SS(t.x,e.x,r.x,n),SS(t.y,e.y,r.y,n)}function eJ(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const tJ={duration:.45,ease:[.4,0,.1,1]},AS=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),PS=AS("applewebkit/")&&!AS("chrome/")?Math.round:Wn;function MS(t){t.min=PS(t.min),t.max=PS(t.max)}function rJ(t){MS(t.x),MS(t.y)}function IS(t,e,r){return t==="position"||t==="preserve-aspect"&&!nY(mS(e),mS(r),.2)}function nJ(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const iJ=wS({attachResizeListener:(t,e)=>Lo(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),fb={current:void 0},CS=wS({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!fb.current){const t=new iJ({});t.mount(window),t.setOptions({layoutScroll:!0}),fb.current=t}return fb.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),sJ={pan:{Feature:yY},drag:{Feature:bY,ProjectionNode:CS,MeasureLayout:eS}};function TS(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||CE())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const u=a[n];u&&Nr.postRender(()=>u(s,o))};return ko(t.current,r,i,{passive:!t.getProps()[n]})}class oJ extends _a{mount(){this.unmount=No(TS(this.node,!0),TS(this.node,!1))}unmount(){}}class aJ extends _a{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=No(Lo(this.node.current,"focus",()=>this.onFocus()),Lo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const RS=(t,e)=>e?t===e?!0:RS(t,e.parentElement):!1;function lb(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,k0(r))}class cJ extends _a{constructor(){super(...arguments),this.removeStartListeners=Wn,this.removeEndListeners=Wn,this.removeAccessibleListeners=Wn,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=ko(window,"pointerup",(a,u)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:d,globalTapTarget:p}=this.node.getProps(),y=!p&&!RS(this.node.current,a.target)?d:l;y&&Nr.update(()=>y(a,u))},{passive:!(n.onTap||n.onPointerUp)}),o=ko(window,"pointercancel",(a,u)=>this.cancelPress(a,u),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=No(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||lb("up",(u,l)=>{const{onTap:d}=this.node.getProps();d&&Nr.postRender(()=>d(u,l))})};this.removeEndListeners(),this.removeEndListeners=Lo(this.node.current,"keyup",o),lb("down",(a,u)=>{this.startPress(a,u)})},r=Lo(this.node.current,"keydown",e),n=()=>{this.isPressing&&lb("cancel",(s,o)=>this.cancelPress(s,o))},i=Lo(this.node.current,"blur",n);this.removeAccessibleListeners=No(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Nr.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!CE()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Nr.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=ko(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=Lo(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=No(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const hb=new WeakMap,db=new WeakMap,uJ=t=>{const e=hb.get(t.target);e&&e(t)},fJ=t=>{t.forEach(uJ)};function lJ({root:t,...e}){const r=t||document;db.has(r)||db.set(r,{});const n=db.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(fJ,{root:t,...e})),n[i]}function hJ(t,e,r){const n=lJ(e);return hb.set(t,r),n.observe(t),()=>{hb.delete(t),n.unobserve(t)}}const dJ={some:0,all:1};class pJ extends _a{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:dJ[i]},a=u=>{const{isIntersecting:l}=u;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:p}=this.node.getProps(),y=l?d:p;y&&y(u)};return hJ(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(gJ(e,r))&&this.startObserver()}unmount(){}}function gJ({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const mJ={inView:{Feature:pJ},tap:{Feature:cJ},focus:{Feature:aJ},hover:{Feature:oJ}},vJ={layout:{ProjectionNode:CS,MeasureLayout:eS}},pb=Se.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),z0=Se.createContext({}),gb=typeof window<"u",DS=gb?Se.useLayoutEffect:Se.useEffect,OS=Se.createContext({strict:!1});function bJ(t,e,r,n,i){var s,o;const{visualElement:a}=Se.useContext(z0),u=Se.useContext(OS),l=Se.useContext(F0),d=Se.useContext(pb).reducedMotion,p=Se.useRef();n=n||u.renderer,!p.current&&n&&(p.current=n(t,{visualState:e,parent:a,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d}));const y=p.current,A=Se.useContext(ZE);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&yJ(p.current,r,i,A);const P=Se.useRef(!1);Se.useInsertionEffect(()=>{y&&P.current&&y.update(r,l)});const O=r[gE],D=Se.useRef(!!O&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,O))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,O)));return DS(()=>{y&&(P.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),ab.render(y.render),D.current&&y.animationState&&y.animationState.animateChanges())}),Se.useEffect(()=>{y&&(!D.current&&y.animationState&&y.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{var k;(k=window.MotionHandoffMarkAsComplete)===null||k===void 0||k.call(window,O)}),D.current=!1))}),y}function yJ(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:u,layoutRoot:l}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:NS(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&Uu(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:u,layoutRoot:l})}function NS(t){if(t)return t.options.allowProjection!==!1?t.projection:NS(t.parent)}function wJ(t,e,r){return Se.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):Uu(r)&&(r.current=n))},[e])}function H0(t){return P0(t.animate)||wv.some(e=>Vl(t[e]))}function LS(t){return!!(H0(t)||t.variants)}function xJ(t,e){if(H0(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Vl(r)?r:void 0,animate:Vl(n)?n:void 0}}return t.inherit!==!1?e:{}}function _J(t){const{initial:e,animate:r}=xJ(t,Se.useContext(z0));return Se.useMemo(()=>({initial:e,animate:r}),[kS(e),kS(r)])}function kS(t){return Array.isArray(t)?t.join(" "):t}const BS={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Wu={};for(const t in BS)Wu[t]={isEnabled:e=>BS[t].some(r=>!!e[r])};function EJ(t){for(const e in t)Wu[e]={...Wu[e],...t[e]}}const SJ=Symbol.for("motionComponentSymbol");function AJ({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&EJ(t);function s(a,u){let l;const d={...Se.useContext(pb),...a,layoutId:PJ(a)},{isStatic:p}=d,y=_J(a),A=n(a,p);if(!p&&gb){MJ(d,t);const P=IJ(d);l=P.MeasureLayout,y.visualElement=bJ(i,A,d,e,P.ProjectionNode)}return de.jsxs(z0.Provider,{value:y,children:[l&&y.visualElement?de.jsx(l,{visualElement:y.visualElement,...d}):null,r(i,a,wJ(A,y.visualElement,u),A,p,y.visualElement)]})}const o=Se.forwardRef(s);return o[SJ]=i,o}function PJ({layoutId:t}){const e=Se.useContext(ob).id;return e&&t!==void 0?e+"-"+t:t}function MJ(t,e){const r=Se.useContext(OS).strict;if(process.env.NODE_ENV!=="production"&&e&&r){const n="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?ku(!1,n):Oo(!1,n)}}function IJ(t){const{drag:e,layout:r}=Wu;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const CJ=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function mb(t){return typeof t!="string"||t.includes("-")?!1:!!(CJ.indexOf(t)>-1||/[A-Z]/u.test(t))}function $S(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const FS=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function jS(t,e,r,n){$S(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(FS.has(i)?i:Xv(i),e.attrs[i])}function US(t,{layout:e,layoutId:r}){return bc.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!U0[t]||t==="opacity")}function vb(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(Qn(i[o])||e.style&&Qn(e.style[o])||US(o,t)||((n=r==null?void 0:r.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function qS(t,e,r){const n=vb(t,e,r);for(const i in t)if(Qn(t[i])||Qn(e[i])){const s=Gl.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function bb(t){const e=Se.useRef(null);return e.current===null&&(e.current=t()),e.current}function TJ({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:RJ(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const zS=t=>(e,r)=>{const n=Se.useContext(z0),i=Se.useContext(F0),s=()=>TJ(t,e,n,i);return r?s():bb(s)};function RJ(t,e,r,n){const i={},s=n(t,{});for(const y in s)i[y]=q0(s[y]);let{initial:o,animate:a}=t;const u=H0(t),l=LS(t);e&&l&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const p=d?a:o;if(p&&typeof p!="boolean"&&!P0(p)){const y=Array.isArray(p)?p:[p];for(let A=0;A({style:{},transform:{},transformOrigin:{},vars:{}}),HS=()=>({...yb(),attrs:{}}),WS=(t,e)=>e&&typeof t=="number"?e.transform(t):t,DJ={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},OJ=Gl.length;function NJ(t,e,r){let n="",i=!0;for(let s=0;stypeof t=="string"&&t.toLowerCase()==="svg",FJ={useVisualState:zS({scrapeMotionValuesFromProps:qS,createRenderState:HS,onMount:(t,e,{renderState:r,latestValues:n})=>{Nr.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),Nr.render(()=>{xb(r,n,_b(e.tagName),t.transformTemplate),jS(e,r)})}})},jJ={useVisualState:zS({scrapeMotionValuesFromProps:vb,createRenderState:yb})};function VS(t,e,r){for(const n in e)!Qn(e[n])&&!US(n,r)&&(t[n]=e[n])}function UJ({transformTemplate:t},e){return Se.useMemo(()=>{const r=yb();return wb(r,e,t),Object.assign({},r.vars,r.style)},[e])}function qJ(t,e){const r=t.style||{},n={};return VS(n,r,t),Object.assign(n,UJ(t,e)),n}function zJ(t,e){const r={},n=qJ(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const HJ=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function W0(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||HJ.has(t)}let GS=t=>!W0(t);function WJ(t){t&&(GS=e=>e.startsWith("on")?!W0(e):t(e))}try{WJ(require("@emotion/is-prop-valid").default)}catch{}function KJ(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(GS(i)||r===!0&&W0(i)||!e&&!W0(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function VJ(t,e,r,n){const i=Se.useMemo(()=>{const s=HS();return xb(s,e,_b(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};VS(s,t.style,t),i.style={...s,...i.style}}return i}function GJ(t=!1){return(r,n,i,{latestValues:s},o)=>{const u=(mb(r)?VJ:zJ)(n,s,o,r),l=KJ(n,typeof r=="string",t),d=r!==Se.Fragment?{...l,...u,ref:i}:{},{children:p}=n,y=Se.useMemo(()=>Qn(p)?p.get():p,[p]);return Se.createElement(r,{...d,children:y})}}function YJ(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...mb(n)?FJ:jJ,preloadedFeatures:t,useRender:GJ(i),createVisualElement:e,Component:n};return AJ(o)}}const Eb={current:null},YS={current:!1};function JJ(){if(YS.current=!0,!!gb)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Eb.current=t.matches;t.addListener(e),e()}else Eb.current=!1}function XJ(t,e,r){for(const n in e){const i=e[n],s=r[n];if(Qn(i))t.addValue(n,i),process.env.NODE_ENV==="development"&&A0(i.version==="11.11.17",`Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`);else if(Qn(s))t.addValue(n,th(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,th(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const JS=new WeakMap,ZJ=[...N8,Zn,xa],QJ=t=>ZJ.find(O8(t)),XS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class eX{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Iv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=to.now();this.renderScheduledAtthis.bindToMotionValue(n,r)),YS.current||JJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Eb.current,process.env.NODE_ENV!=="production"&&A0(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){JS.delete(this.current),this.projection&&this.projection.unmount(),ba(this.notifyUpdate),ba(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=bc.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Nr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Wu){const r=Wu[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ln()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=th(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(A8(i)||S8(i))?i=parseFloat(i):!QJ(i)&&xa.test(r)&&(i=W8(e,r)),this.setBaseTarget(e,Qn(i)?i.get():i)),Qn(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=bv(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Qn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new Jv),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class ZS extends eX{constructor(){super(...arguments),this.KeyframeResolver=K8}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function tX(t){return window.getComputedStyle(t)}class rX extends ZS{constructor(){super(...arguments),this.type="html",this.renderInstance=$S}readValueFromInstance(e,r){if(bc.has(r)){const n=Lv(r);return n&&n.default||0}else{const n=tX(e),i=(M8(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return YE(e,r)}build(e,r,n){wb(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return vb(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Qn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class nX extends ZS{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ln}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(bc.has(r)){const n=Lv(r);return n&&n.default||0}return r=FS.has(r)?r:Xv(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return qS(e,r,n)}build(e,r,n){xb(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){jS(e,r,n,i)}mount(e){this.isSVGTag=_b(e.tagName),super.mount(e)}}const iX=(t,e)=>mb(t)?new nX(e):new rX(e,{allowProjection:t!==Se.Fragment}),sX=YJ({...GG,...mJ,...sJ,...vJ},iX),oX=UK(sX);class aX extends Yt.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function cX({children:t,isPresent:e}){const r=Se.useId(),n=Se.useRef(null),i=Se.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=Se.useContext(pb);return Se.useInsertionEffect(()=>{const{width:o,height:a,top:u,left:l}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` [data-motion-pop-id="${r}"] { position: absolute !important; width: ${o}px !important; @@ -199,7 +199,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene top: ${u}px !important; left: ${l}px !important; } - `),()=>{document.head.removeChild(d)}},[e]),ge.jsx(aX,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const uX=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=bb(fX),u=Ee.useId(),l=Ee.useCallback(p=>{a.set(p,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Ee.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:p=>(a.set(p,!1),()=>a.delete(p))}),s?[Math.random(),l]:[r,l]);return Ee.useMemo(()=>{a.forEach((p,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=ge.jsx(cX,{isPresent:r,children:t})),ge.jsx(F0.Provider,{value:d,children:t})};function fX(){return new Map}const K0=t=>t.key||"";function e7(t){const e=[];return Ee.Children.forEach(t,r=>{Ee.isValidElement(r)&&e.push(r)}),e}const lX=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Oo(!e,"Replace exitBeforeEnter with mode='wait'");const a=Ee.useMemo(()=>e7(t),[t]),u=a.map(K0),l=Ee.useRef(!0),d=Ee.useRef(a),p=bb(()=>new Map),[y,A]=Ee.useState(a),[P,N]=Ee.useState(a);OS(()=>{l.current=!1,d.current=a;for(let B=0;B1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=Ee.useContext(ob);return ge.jsx(ge.Fragment,{children:P.map(B=>{const q=K0(B),j=a===P||u.includes(q),H=()=>{if(p.has(q))p.set(q,!0);else return;let J=!0;p.forEach(T=>{T||(J=!1)}),J&&(k==null||k(),N(d.current),i&&i())};return ge.jsx(uX,{isPresent:j,initial:!l.current||n?void 0:!1,custom:j?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:j?void 0:H,children:B},q)})})},Ss=t=>ge.jsx(lX,{children:ge.jsx(oX.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Sb(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return ge.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,ge.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[ge.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),ge.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:ge.jsx(NK,{})})]})]})}function hX(t){return t.lastUsed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[ge.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function Ab(t){var o,a;const{wallet:e,onClick:r}=t,n=ge.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Ee.useMemo(()=>hX(e),[e]);return ge.jsx(Sb,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function t7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=vX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Pb);return a[0]===""&&a.length!==1&&a.shift(),r7(a,e)||mX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},r7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?r7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Pb);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},n7=/^\[(.+)\]$/,mX=t=>{if(n7.test(t)){const e=n7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},vX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return yX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Mb(o,n,s,e)}),n},Mb=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:i7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(bX(i)){Mb(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Mb(o,i7(e,s),r,n)})})},i7=(t,e)=>{let r=t;return e.split(Pb).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},bX=t=>t.isThemeGetter,yX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,wX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},s7="!",xX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,p;for(let D=0;Dd?p-d:void 0;return{modifiers:u,hasImportantModifier:A,baseClassName:P,maybePostfixModifierPosition:N}};return r?a=>r({className:a,parseClassName:o}):o},_X=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},EX=t=>({cache:wX(t.cacheSize),parseClassName:xX(t),...gX(t)}),SX=/\s+/,AX=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(SX);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:A}=r(l);let P=!!A,N=n(P?y.substring(0,A):y);if(!N){if(!P){a=l+(a.length>0?" "+a:a);continue}if(N=n(y),!N){a=l+(a.length>0?" "+a:a);continue}P=!1}const D=_X(d).join(":"),k=p?D+s7:D,B=k+N;if(s.includes(B))continue;s.push(B);const q=i(N,P);for(let j=0;j0?" "+a:a)}return a};function PX(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;np(d),t());return r=EX(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=AX(u,r);return i(u,d),d}return function(){return s(PX.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},a7=/^\[(?:([a-z-]+):)?(.+)\]$/i,IX=/^\d+\/\d+$/,CX=new Set(["px","full","screen"]),TX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RX=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,DX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,OX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bo=t=>Ku(t)||CX.has(t)||IX.test(t),Ea=t=>Vu(t,"length",qX),Ku=t=>!!t&&!Number.isNaN(Number(t)),Ib=t=>Vu(t,"number",Ku),oh=t=>!!t&&Number.isInteger(Number(t)),LX=t=>t.endsWith("%")&&Ku(t.slice(0,-1)),cr=t=>a7.test(t),Sa=t=>TX.test(t),kX=new Set(["length","size","percentage"]),BX=t=>Vu(t,kX,c7),$X=t=>Vu(t,"position",c7),FX=new Set(["image","url"]),jX=t=>Vu(t,FX,HX),UX=t=>Vu(t,"",zX),ah=()=>!0,Vu=(t,e,r)=>{const n=a7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},qX=t=>RX.test(t)&&!DX.test(t),c7=()=>!1,zX=t=>OX.test(t),HX=t=>NX.test(t),WX=MX(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),p=Gr("invert"),y=Gr("gap"),A=Gr("gradientColorStops"),P=Gr("gradientColorStopPositions"),N=Gr("inset"),D=Gr("margin"),k=Gr("opacity"),B=Gr("padding"),q=Gr("saturate"),j=Gr("scale"),H=Gr("sepia"),J=Gr("skew"),T=Gr("space"),z=Gr("translate"),ue=()=>["auto","contain","none"],_e=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",Bo,Ea],f=()=>["auto",Ku,cr],g=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],S=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Ku,cr];return{cacheSize:500,separator:":",theme:{colors:[ah],spacing:[Bo,Ea],blur:["none","",Sa,cr],brightness:M(),borderColor:[t],borderRadius:["none","","full",Sa,cr],borderSpacing:E(),borderWidth:m(),contrast:M(),grayscale:S(),hueRotate:M(),invert:S(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[LX,Ea],inset:G(),margin:G(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:S(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Sa]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...g(),cr]}],overflow:[{overflow:_e()}],"overflow-x":[{"overflow-x":_e()}],"overflow-y":[{"overflow-y":_e()}],overscroll:[{overscroll:ue()}],"overscroll-x":[{"overscroll-x":ue()}],"overscroll-y":[{"overscroll-y":ue()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",oh,cr]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",oh,cr]}],"grid-cols":[{"grid-cols":[ah]}],"col-start-end":[{col:["auto",{span:["full",oh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[ah]}],"row-start-end":[{row:["auto",{span:[oh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[B]}],px:[{px:[B]}],py:[{py:[B]}],ps:[{ps:[B]}],pe:[{pe:[B]}],pt:[{pt:[B]}],pr:[{pr:[B]}],pb:[{pb:[B]}],pl:[{pl:[B]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Sa]},Sa]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Sa,Ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ib]}],"font-family":[{font:[ah]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Ku,Ib]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Bo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Bo,Ea]}],"underline-offset":[{"underline-offset":["auto",Bo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...g(),$X]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",BX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},jX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[A]}],"gradient-via":[{via:[A]}],"gradient-to":[{to:[A]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[Bo,cr]}],"outline-w":[{outline:[Bo,Ea]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Bo,Ea]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Sa,UX]}],"shadow-color":[{shadow:[ah]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Sa,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[p]}],saturate:[{saturate:[q]}],sepia:[{sepia:[H]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[q]}],"backdrop-sepia":[{"backdrop-sepia":[H]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[oh,cr]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[J]}],"skew-y":[{"skew-y":[J]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Bo,Ea,Ib]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function $o(...t){return WX(pX(t))}function u7(t){const{className:e}=t;return ge.jsxs("div",{className:$o("xc-flex xc-items-center xc-gap-2"),children:[ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)}),ge.jsx("div",{className:"xc-shrink-0",children:t.children}),ge.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)})]})}const KX="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function VX(t){const{onClick:e}=t;function r(){e&&e()}return ge.jsx(u7,{className:"xc-opacity-20",children:ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[ge.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),ge.jsx(f8,{size:16})]})})}function f7(t){const[e,r]=Ee.useState(""),{featuredWallets:n,initialized:i}=Kl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Ee.useMemo(()=>n==null?void 0:n.find(D=>{var k;return((k=D.config)==null?void 0:k.rdns)==="binance"}),[n]),p=Ee.useMemo(()=>{const D=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,k=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!D.test(e)&&k.test(e)},[e]);function y(D){o(D)}function A(D){r(D.target.value)}async function P(){s(e)}function N(D){D.key==="Enter"&&p&&P()}return ge.jsx(Ss,{children:i&&ge.jsxs(ge.Fragment,{children:[t.header||ge.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),d&&ge.jsx("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:ge.jsx(Ab,{wallet:d,onClick:y},`feature-${d.key}`)}),!d&&ge.jsxs(ge.Fragment,{children:[ge.jsxs("div",{children:[ge.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(D=>ge.jsx(Ab,{wallet:D,onClick:y},`feature-${D.key}`)),l.showTonConnect&&ge.jsx(Sb,{icon:ge.jsx("img",{className:"xc-h-5 xc-w-5",src:KX}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&ge.jsx(VX,{onClick:a})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&ge.jsx("div",{className:"xc-mb-4 xc-mt-4",children:ge.jsxs(u7,{className:"xc-opacity-20",children:[" ",ge.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),l.showEmailSignIn&&ge.jsxs("div",{className:"xc-mb-4",children:[ge.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:A,onKeyDown:N}),ge.jsx("button",{disabled:!p,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:P,children:"Continue"})]})]})]})})}function Sc(t){const{title:e}=t;return ge.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[ge.jsx(OK,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),ge.jsx("span",{children:e})]})}const l7=Ee.createContext({channel:"",device:"WEB",app:"",inviterCode:"",role:"C"});function Cb(){return Ee.useContext(l7)}function GX(t){const{config:e}=t,[r,n]=Ee.useState(e.channel),[i,s]=Ee.useState(e.device),[o,a]=Ee.useState(e.app),[u,l]=Ee.useState(e.role||"C"),[d,p]=Ee.useState(e.inviterCode);return Ee.useEffect(()=>{n(e.channel),s(e.device),a(e.app),p(e.inviterCode),l(e.role||"C")},[e]),ge.jsx(l7.Provider,{value:{channel:r,device:i,app:o,inviterCode:d,role:u},children:t.children})}var YX=Object.defineProperty,JX=Object.defineProperties,XX=Object.getOwnPropertyDescriptors,V0=Object.getOwnPropertySymbols,h7=Object.prototype.hasOwnProperty,d7=Object.prototype.propertyIsEnumerable,p7=(t,e,r)=>e in t?YX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ZX=(t,e)=>{for(var r in e||(e={}))h7.call(e,r)&&p7(t,r,e[r]);if(V0)for(var r of V0(e))d7.call(e,r)&&p7(t,r,e[r]);return t},QX=(t,e)=>JX(t,XX(e)),eZ=(t,e)=>{var r={};for(var n in t)h7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&V0)for(var n of V0(t))e.indexOf(n)<0&&d7.call(t,n)&&(r[n]=t[n]);return r};function tZ(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function rZ(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var nZ=18,g7=40,iZ=`${g7}px`,sZ=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function oZ({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),p=Yt.useCallback(()=>{let y=t.current,A=e.current;if(!y||!A||u||r==="none")return;let P=y,N=P.getBoundingClientRect().left+P.offsetWidth,D=P.getBoundingClientRect().top+P.offsetHeight/2,k=N-nZ,B=D;document.querySelectorAll(sZ).length===0&&document.elementFromPoint(k,B)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function A(){let N=window.innerWidth-y.getBoundingClientRect().right;a(N>=g7)}A();let P=setInterval(A,1e3);return()=>{clearInterval(P)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let A=setTimeout(p,0),P=setTimeout(p,2e3),N=setTimeout(p,5e3),D=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(A),clearTimeout(P),clearTimeout(N),clearTimeout(D)}},[e,n,r,p]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:iZ}}var m7=Yt.createContext({}),v7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:p="increase-width",pasteTransformer:y,containerClassName:A,noScriptCSSFallback:P=aZ,render:N,children:D}=r,k=eZ(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),B,q,j,H,J;let[T,z]=Yt.useState(typeof k.defaultValue=="string"?k.defaultValue:""),ue=n??T,_e=rZ(ue),G=Yt.useCallback(ie=>{i==null||i(ie),z(ie)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),g=Yt.useRef({value:ue,onChange:G,isIOS:typeof window<"u"&&((q=(B=window==null?void 0:window.CSS)==null?void 0:B.supports)==null?void 0:q.call(B,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(j=m.current)==null?void 0:j.selectionStart,(H=m.current)==null?void 0:H.selectionEnd,(J=m.current)==null?void 0:J.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let ie=m.current,fe=f.current;if(!ie||!fe)return;g.current.value!==ie.value&&g.current.onChange(ie.value),v.current.prev=[ie.selectionStart,ie.selectionEnd,ie.selectionDirection];function ve(){if(document.activeElement!==ie){I(null),ae(null);return}let Te=ie.selectionStart,$e=ie.selectionEnd,Ie=ie.selectionDirection,Le=ie.maxLength,Ve=ie.value,ke=v.current.prev,ze=-1,He=-1,Se;if(Ve.length!==0&&Te!==null&&$e!==null){let et=Te===$e,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let pt=0;if(ke[0]!==null&&ke[1]!==null){Se=Je{fe&&fe.style.setProperty("--root-height",`${ie.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(ie),()=>{document.removeEventListener("selectionchange",ve,{capture:!0}),Ne.disconnect()}},[]);let[x,_]=Yt.useState(!1),[S,b]=Yt.useState(!1),[M,I]=Yt.useState(null),[F,ae]=Yt.useState(null);Yt.useEffect(()=>{tZ(()=>{var ie,fe,ve,Me;(ie=m.current)==null||ie.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(ve=m.current)==null?void 0:ve.selectionEnd,$e=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ae(Te),v.current.prev=[Ne,Te,$e])})},[ue,S]),Yt.useEffect(()=>{_e!==void 0&&ue!==_e&&_e.length{let fe=ie.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){ie.preventDefault();return}typeof _e=="string"&&fe.length<_e.length&&document.dispatchEvent(new Event("selectionchange")),G(fe)},[s,G,_e,E]),ee=Yt.useCallback(()=>{var ie;if(m.current){let fe=Math.min(m.current.value.length,s-1),ve=m.current.value.length;(ie=m.current)==null||ie.setSelectionRange(fe,ve),I(fe),ae(ve)}b(!0)},[s]),X=Yt.useCallback(ie=>{var fe,ve;let Me=m.current;if(!y&&(!g.current.isIOS||!ie.clipboardData||!Me))return;let Ne=ie.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),ie.preventDefault();let $e=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(ve=m.current)==null?void 0:ve.selectionEnd,Le=($e!==Ie?ue.slice(0,$e)+Te+ue.slice(Ie):ue.slice(0,$e)+Te+ue.slice($e)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,G(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ae(ke)},[s,G,E,ue]),Q=Yt.useMemo(()=>({position:"relative",cursor:k.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[k.disabled]),R=Yt.useMemo(()=>({position:"absolute",inset:0,width:O.willPushPWMBadge?`calc(100% + ${O.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:O.willPushPWMBadge?`inset(0 ${O.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[O.PWM_BADGE_SPACE_WIDTH,O.willPushPWMBadge,o]),Z=Yt.useMemo(()=>Yt.createElement("input",QX(ZX({autoComplete:k.autoComplete||"one-time-code"},k),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ue.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:R,maxLength:s,value:ue,ref:m,onPaste:ie=>{var fe;X(ie),(fe=k.onPaste)==null||fe.call(k,ie)},onChange:se,onMouseOver:ie=>{var fe;_(!0),(fe=k.onMouseOver)==null||fe.call(k,ie)},onMouseLeave:ie=>{var fe;_(!1),(fe=k.onMouseLeave)==null||fe.call(k,ie)},onFocus:ie=>{var fe;ee(),(fe=k.onFocus)==null||fe.call(k,ie)},onBlur:ie=>{var fe;b(!1),(fe=k.onBlur)==null||fe.call(k,ie)}})),[se,ee,X,l,R,s,F,M,k,E==null?void 0:E.source,ue]),te=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ie,fe)=>{var ve;let Me=S&&M!==null&&F!==null&&(M===F&&fe===M||fe>=M&&feN?N(te):Yt.createElement(m7.Provider,{value:te},D),[D,te,N]);return Yt.createElement(Yt.Fragment,null,P!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,P)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:A},le,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Z)))});v7.displayName="Input";function ch(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var aZ=` + `),()=>{document.head.removeChild(d)}},[e]),de.jsx(aX,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const uX=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=bb(fX),u=Se.useId(),l=Se.useCallback(p=>{a.set(p,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Se.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:p=>(a.set(p,!1),()=>a.delete(p))}),s?[Math.random(),l]:[r,l]);return Se.useMemo(()=>{a.forEach((p,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=de.jsx(cX,{isPresent:r,children:t})),de.jsx(F0.Provider,{value:d,children:t})};function fX(){return new Map}const K0=t=>t.key||"";function QS(t){const e=[];return Se.Children.forEach(t,r=>{Se.isValidElement(r)&&e.push(r)}),e}const lX=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Oo(!e,"Replace exitBeforeEnter with mode='wait'");const a=Se.useMemo(()=>QS(t),[t]),u=a.map(K0),l=Se.useRef(!0),d=Se.useRef(a),p=bb(()=>new Map),[y,A]=Se.useState(a),[P,O]=Se.useState(a);DS(()=>{l.current=!1,d.current=a;for(let B=0;B1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=Se.useContext(ob);return de.jsx(de.Fragment,{children:P.map(B=>{const q=K0(B),j=a===P||u.includes(q),H=()=>{if(p.has(q))p.set(q,!0);else return;let J=!0;p.forEach(T=>{T||(J=!1)}),J&&(k==null||k(),O(d.current),i&&i())};return de.jsx(uX,{isPresent:j,initial:!l.current||n?void 0:!1,custom:j?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:j?void 0:H,children:B},q)})})},Ss=t=>de.jsx(lX,{children:de.jsx(oX.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Sb(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return de.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,de.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[de.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),de.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:de.jsx(NK,{})})]})]})}function hX(t){return t.lastUsed?de.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[de.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?de.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[de.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function e7(t){var o,a;const{wallet:e,onClick:r}=t,n=de.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Se.useMemo(()=>hX(e),[e]);return de.jsx(Sb,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function t7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=vX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Ab);return a[0]===""&&a.length!==1&&a.shift(),r7(a,e)||mX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},r7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?r7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Ab);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},n7=/^\[(.+)\]$/,mX=t=>{if(n7.test(t)){const e=n7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},vX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return yX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Pb(o,n,s,e)}),n},Pb=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:i7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(bX(i)){Pb(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Pb(o,i7(e,s),r,n)})})},i7=(t,e)=>{let r=t;return e.split(Ab).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},bX=t=>t.isThemeGetter,yX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,wX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},s7="!",xX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,p;for(let D=0;Dd?p-d:void 0;return{modifiers:u,hasImportantModifier:A,baseClassName:P,maybePostfixModifierPosition:O}};return r?a=>r({className:a,parseClassName:o}):o},_X=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},EX=t=>({cache:wX(t.cacheSize),parseClassName:xX(t),...gX(t)}),SX=/\s+/,AX=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(SX);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:A}=r(l);let P=!!A,O=n(P?y.substring(0,A):y);if(!O){if(!P){a=l+(a.length>0?" "+a:a);continue}if(O=n(y),!O){a=l+(a.length>0?" "+a:a);continue}P=!1}const D=_X(d).join(":"),k=p?D+s7:D,B=k+O;if(s.includes(B))continue;s.push(B);const q=i(O,P);for(let j=0;j0?" "+a:a)}return a};function PX(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;np(d),t());return r=EX(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=AX(u,r);return i(u,d),d}return function(){return s(PX.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},a7=/^\[(?:([a-z-]+):)?(.+)\]$/i,IX=/^\d+\/\d+$/,CX=new Set(["px","full","screen"]),TX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RX=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,DX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,OX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bo=t=>Ku(t)||CX.has(t)||IX.test(t),Ea=t=>Vu(t,"length",qX),Ku=t=>!!t&&!Number.isNaN(Number(t)),Mb=t=>Vu(t,"number",Ku),oh=t=>!!t&&Number.isInteger(Number(t)),LX=t=>t.endsWith("%")&&Ku(t.slice(0,-1)),cr=t=>a7.test(t),Sa=t=>TX.test(t),kX=new Set(["length","size","percentage"]),BX=t=>Vu(t,kX,c7),$X=t=>Vu(t,"position",c7),FX=new Set(["image","url"]),jX=t=>Vu(t,FX,HX),UX=t=>Vu(t,"",zX),ah=()=>!0,Vu=(t,e,r)=>{const n=a7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},qX=t=>RX.test(t)&&!DX.test(t),c7=()=>!1,zX=t=>OX.test(t),HX=t=>NX.test(t),WX=MX(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),p=Gr("invert"),y=Gr("gap"),A=Gr("gradientColorStops"),P=Gr("gradientColorStopPositions"),O=Gr("inset"),D=Gr("margin"),k=Gr("opacity"),B=Gr("padding"),q=Gr("saturate"),j=Gr("scale"),H=Gr("sepia"),J=Gr("skew"),T=Gr("space"),z=Gr("translate"),ue=()=>["auto","contain","none"],_e=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",Bo,Ea],f=()=>["auto",Ku,cr],g=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],S=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Ku,cr];return{cacheSize:500,separator:":",theme:{colors:[ah],spacing:[Bo,Ea],blur:["none","",Sa,cr],brightness:M(),borderColor:[t],borderRadius:["none","","full",Sa,cr],borderSpacing:E(),borderWidth:m(),contrast:M(),grayscale:S(),hueRotate:M(),invert:S(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[LX,Ea],inset:G(),margin:G(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:S(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Sa]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...g(),cr]}],overflow:[{overflow:_e()}],"overflow-x":[{"overflow-x":_e()}],"overflow-y":[{"overflow-y":_e()}],overscroll:[{overscroll:ue()}],"overscroll-x":[{"overscroll-x":ue()}],"overscroll-y":[{"overscroll-y":ue()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[O]}],"inset-x":[{"inset-x":[O]}],"inset-y":[{"inset-y":[O]}],start:[{start:[O]}],end:[{end:[O]}],top:[{top:[O]}],right:[{right:[O]}],bottom:[{bottom:[O]}],left:[{left:[O]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",oh,cr]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",oh,cr]}],"grid-cols":[{"grid-cols":[ah]}],"col-start-end":[{col:["auto",{span:["full",oh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[ah]}],"row-start-end":[{row:["auto",{span:[oh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[B]}],px:[{px:[B]}],py:[{py:[B]}],ps:[{ps:[B]}],pe:[{pe:[B]}],pt:[{pt:[B]}],pr:[{pr:[B]}],pb:[{pb:[B]}],pl:[{pl:[B]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Sa]},Sa]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Sa,Ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Mb]}],"font-family":[{font:[ah]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Ku,Mb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Bo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Bo,Ea]}],"underline-offset":[{"underline-offset":["auto",Bo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...g(),$X]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",BX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},jX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[A]}],"gradient-via":[{via:[A]}],"gradient-to":[{to:[A]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[Bo,cr]}],"outline-w":[{outline:[Bo,Ea]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Bo,Ea]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Sa,UX]}],"shadow-color":[{shadow:[ah]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Sa,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[p]}],saturate:[{saturate:[q]}],sepia:[{sepia:[H]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[q]}],"backdrop-sepia":[{"backdrop-sepia":[H]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[oh,cr]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[J]}],"skew-y":[{"skew-y":[J]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Bo,Ea,Mb]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function $o(...t){return WX(pX(t))}function u7(t){const{className:e}=t;return de.jsxs("div",{className:$o("xc-flex xc-items-center xc-gap-2"),children:[de.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)}),de.jsx("div",{className:"xc-shrink-0",children:t.children}),de.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)})]})}function KX(t){var n;const{wallet:e,onClick:r}=t;return de.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[de.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(n=e.config)==null?void 0:n.image,alt:""}),de.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[de.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:"Connect to Binance Wallet"}),de.jsx("div",{className:"xc-flex xc-gap-2",children:de.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:()=>r(e),children:"Connect"})})]})]})}const VX="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function GX(t){const{onClick:e}=t;function r(){e&&e()}return de.jsx(u7,{className:"xc-opacity-20",children:de.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[de.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),de.jsx(u8,{size:16})]})})}function f7(t){const[e,r]=Se.useState(""),{featuredWallets:n,initialized:i}=Kl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Se.useMemo(()=>{const O=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!O.test(e)&&D.test(e)},[e]);function p(O){o(O)}function y(O){r(O.target.value)}async function A(){s(e)}function P(O){O.key==="Enter"&&d&&A()}return de.jsx(Ss,{children:i&&de.jsxs(de.Fragment,{children:[t.header||de.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),n.length===1&&de.jsx("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:n.map(O=>de.jsx(KX,{wallet:O,onClick:p},`feature-${O.key}`))}),n.length>1&&de.jsxs(de.Fragment,{children:[de.jsxs("div",{children:[de.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(O=>de.jsx(e7,{wallet:O,onClick:p},`feature-${O.key}`)),l.showTonConnect&&de.jsx(Sb,{icon:de.jsx("img",{className:"xc-h-5 xc-w-5",src:VX}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&de.jsx(GX,{onClick:a})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&de.jsx("div",{className:"xc-mb-4 xc-mt-4",children:de.jsxs(u7,{className:"xc-opacity-20",children:[" ",de.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),l.showEmailSignIn&&de.jsxs("div",{className:"xc-mb-4",children:[de.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:y,onKeyDown:P}),de.jsx("button",{disabled:!d,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:A,children:"Continue"})]})]})]})})}function Sc(t){const{title:e}=t;return de.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[de.jsx(OK,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),de.jsx("span",{children:e})]})}const l7=Se.createContext({channel:"",device:"WEB",app:"",inviterCode:"",role:"C"});function Ib(){return Se.useContext(l7)}function YX(t){const{config:e}=t,[r,n]=Se.useState(e.channel),[i,s]=Se.useState(e.device),[o,a]=Se.useState(e.app),[u,l]=Se.useState(e.role||"C"),[d,p]=Se.useState(e.inviterCode);return Se.useEffect(()=>{n(e.channel),s(e.device),a(e.app),p(e.inviterCode),l(e.role||"C")},[e]),de.jsx(l7.Provider,{value:{channel:r,device:i,app:o,inviterCode:d,role:u},children:t.children})}var JX=Object.defineProperty,XX=Object.defineProperties,ZX=Object.getOwnPropertyDescriptors,V0=Object.getOwnPropertySymbols,h7=Object.prototype.hasOwnProperty,d7=Object.prototype.propertyIsEnumerable,p7=(t,e,r)=>e in t?JX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,QX=(t,e)=>{for(var r in e||(e={}))h7.call(e,r)&&p7(t,r,e[r]);if(V0)for(var r of V0(e))d7.call(e,r)&&p7(t,r,e[r]);return t},eZ=(t,e)=>XX(t,ZX(e)),tZ=(t,e)=>{var r={};for(var n in t)h7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&V0)for(var n of V0(t))e.indexOf(n)<0&&d7.call(t,n)&&(r[n]=t[n]);return r};function rZ(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function nZ(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var iZ=18,g7=40,sZ=`${g7}px`,oZ=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function aZ({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),p=Yt.useCallback(()=>{let y=t.current,A=e.current;if(!y||!A||u||r==="none")return;let P=y,O=P.getBoundingClientRect().left+P.offsetWidth,D=P.getBoundingClientRect().top+P.offsetHeight/2,k=O-iZ,B=D;document.querySelectorAll(oZ).length===0&&document.elementFromPoint(k,B)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function A(){let O=window.innerWidth-y.getBoundingClientRect().right;a(O>=g7)}A();let P=setInterval(A,1e3);return()=>{clearInterval(P)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let A=setTimeout(p,0),P=setTimeout(p,2e3),O=setTimeout(p,5e3),D=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(A),clearTimeout(P),clearTimeout(O),clearTimeout(D)}},[e,n,r,p]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:sZ}}var m7=Yt.createContext({}),v7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:p="increase-width",pasteTransformer:y,containerClassName:A,noScriptCSSFallback:P=cZ,render:O,children:D}=r,k=tZ(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),B,q,j,H,J;let[T,z]=Yt.useState(typeof k.defaultValue=="string"?k.defaultValue:""),ue=n??T,_e=nZ(ue),G=Yt.useCallback(ie=>{i==null||i(ie),z(ie)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),g=Yt.useRef({value:ue,onChange:G,isIOS:typeof window<"u"&&((q=(B=window==null?void 0:window.CSS)==null?void 0:B.supports)==null?void 0:q.call(B,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(j=m.current)==null?void 0:j.selectionStart,(H=m.current)==null?void 0:H.selectionEnd,(J=m.current)==null?void 0:J.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let ie=m.current,fe=f.current;if(!ie||!fe)return;g.current.value!==ie.value&&g.current.onChange(ie.value),v.current.prev=[ie.selectionStart,ie.selectionEnd,ie.selectionDirection];function ve(){if(document.activeElement!==ie){I(null),ce(null);return}let Te=ie.selectionStart,$e=ie.selectionEnd,Ie=ie.selectionDirection,Le=ie.maxLength,Ve=ie.value,ke=v.current.prev,ze=-1,He=-1,Ee;if(Ve.length!==0&&Te!==null&&$e!==null){let et=Te===$e,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let pt=0;if(ke[0]!==null&&ke[1]!==null){Ee=Je{fe&&fe.style.setProperty("--root-height",`${ie.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(ie),()=>{document.removeEventListener("selectionchange",ve,{capture:!0}),Ne.disconnect()}},[]);let[x,_]=Yt.useState(!1),[S,b]=Yt.useState(!1),[M,I]=Yt.useState(null),[F,ce]=Yt.useState(null);Yt.useEffect(()=>{rZ(()=>{var ie,fe,ve,Me;(ie=m.current)==null||ie.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(ve=m.current)==null?void 0:ve.selectionEnd,$e=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ce(Te),v.current.prev=[Ne,Te,$e])})},[ue,S]),Yt.useEffect(()=>{_e!==void 0&&ue!==_e&&_e.length{let fe=ie.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){ie.preventDefault();return}typeof _e=="string"&&fe.length<_e.length&&document.dispatchEvent(new Event("selectionchange")),G(fe)},[s,G,_e,E]),ee=Yt.useCallback(()=>{var ie;if(m.current){let fe=Math.min(m.current.value.length,s-1),ve=m.current.value.length;(ie=m.current)==null||ie.setSelectionRange(fe,ve),I(fe),ce(ve)}b(!0)},[s]),X=Yt.useCallback(ie=>{var fe,ve;let Me=m.current;if(!y&&(!g.current.isIOS||!ie.clipboardData||!Me))return;let Ne=ie.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),ie.preventDefault();let $e=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(ve=m.current)==null?void 0:ve.selectionEnd,Le=($e!==Ie?ue.slice(0,$e)+Te+ue.slice(Ie):ue.slice(0,$e)+Te+ue.slice($e)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,G(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ce(ke)},[s,G,E,ue]),Q=Yt.useMemo(()=>({position:"relative",cursor:k.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[k.disabled]),R=Yt.useMemo(()=>({position:"absolute",inset:0,width:N.willPushPWMBadge?`calc(100% + ${N.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:N.willPushPWMBadge?`inset(0 ${N.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[N.PWM_BADGE_SPACE_WIDTH,N.willPushPWMBadge,o]),Z=Yt.useMemo(()=>Yt.createElement("input",eZ(QX({autoComplete:k.autoComplete||"one-time-code"},k),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ue.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:R,maxLength:s,value:ue,ref:m,onPaste:ie=>{var fe;X(ie),(fe=k.onPaste)==null||fe.call(k,ie)},onChange:se,onMouseOver:ie=>{var fe;_(!0),(fe=k.onMouseOver)==null||fe.call(k,ie)},onMouseLeave:ie=>{var fe;_(!1),(fe=k.onMouseLeave)==null||fe.call(k,ie)},onFocus:ie=>{var fe;ee(),(fe=k.onFocus)==null||fe.call(k,ie)},onBlur:ie=>{var fe;b(!1),(fe=k.onBlur)==null||fe.call(k,ie)}})),[se,ee,X,l,R,s,F,M,k,E==null?void 0:E.source,ue]),te=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ie,fe)=>{var ve;let Me=S&&M!==null&&F!==null&&(M===F&&fe===M||fe>=M&&feO?O(te):Yt.createElement(m7.Provider,{value:te},D),[D,te,O]);return Yt.createElement(Yt.Fragment,null,P!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,P)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:A},le,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Z)))});v7.displayName="Input";function ch(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var cZ=` [data-input-otp] { --nojs-bg: white !important; --nojs-fg: black !important; @@ -218,13 +218,13 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene --nojs-bg: black !important; --nojs-fg: white !important; } -}`;const b7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>ge.jsx(v7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));b7.displayName="InputOTP";const y7=Yt.forwardRef(({className:t,...e},r)=>ge.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));y7.displayName="InputOTPGroup";const Ac=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(m7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return ge.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&ge.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:ge.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Ac.displayName="InputOTPSlot";function cZ(t){const{spinning:e,children:r,className:n}=t;return ge.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&ge.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:ge.jsx(vc,{className:"xc-animate-spin"})})]})}function w7(t){const{email:e}=t,[r,n]=Ee.useState(0),[i,s]=Ee.useState(!1),[o,a]=Ee.useState("");async function u(){n(60);const d=setInterval(()=>{n(p=>p===0?(clearInterval(d),0):p-1)},1e3)}async function l(d){if(a(""),!(d.length<6)){s(!0);try{await t.onInputCode(e,d)}catch(p){a(p.message)}s(!1)}}return Ee.useEffect(()=>{u()},[]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(FK,{className:"xc-mb-4",size:60}),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:[ge.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),ge.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]}),ge.jsx("div",{className:"xc-mb-2 xc-h-12",children:ge.jsx(cZ,{spinning:i,className:"xc-rounded-xl",children:ge.jsx(b7,{maxLength:6,onChange:l,disabled:i,className:"disabled:xc-opacity-20",children:ge.jsx(y7,{children:ge.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[ge.jsx(Ac,{index:0}),ge.jsx(Ac,{index:1}),ge.jsx(Ac,{index:2}),ge.jsx(Ac,{index:3}),ge.jsx(Ac,{index:4}),ge.jsx(Ac,{index:5})]})})})})}),o&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:o})})]}),ge.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Resend in ${r}s`:ge.jsx("button",{id:"sendCodeButton",onClick:t.onResendCode,children:"Send again"})]}),ge.jsx("div",{id:"captcha-element"})]})}function x7(t){const{email:e}=t,[r,n]=Ee.useState(!1),[i,s]=Ee.useState(""),o=Ee.useMemo(()=>`xn-btn-${new Date().getTime()}`,[e]);async function a(y,A){n(!0),s(""),await va.getEmailCode({account_type:"email",email:y},A),n(!1)}async function u(y){try{return await a(e,JSON.stringify(y)),{captchaResult:!0,bizResult:!0}}catch(A){return s(A.message),{captchaResult:!1,bizResult:!1}}}async function l(y){y&&t.onCodeSend()}const d=Ee.useRef();function p(y){d.current=y}return Ee.useEffect(()=>{if(e)return window.initAliyunCaptcha({SceneId:"tqyu8129d",prefix:"1mfsn5f",mode:"popup",element:"#captcha-element",button:`#${o}`,captchaVerifyCallback:u,onBizResultCallback:l,getInstance:p,slideStyle:{width:360,height:40},language:"en",region:"cn"}),()=>{var y,A;(y=document.getElementById("aliyunCaptcha-mask"))==null||y.remove(),(A=document.getElementById("aliyunCaptcha-window-popup"))==null||A.remove()}},[e]),ge.jsxs(Ss,{children:[ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[ge.jsx(jK,{className:"xc-mb-4",size:60}),ge.jsx("button",{className:"xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2",id:o,children:r?ge.jsx(vc,{className:"xc-animate-spin"}):"I'm not a robot"})]}),i&&ge.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:ge.jsx("p",{children:i})})]})}function uZ(t){const{email:e}=t,r=Cb(),[n,i]=Ee.useState("captcha");async function s(o,a){const u=await va.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:a,email:o,inviter_code:r.inviterCode,source:{device:r.device,channel:r.channel,app:r.app}});t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),n==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>i("verify-email")}),n==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:s,onResendCode:()=>i("captcha")})]})}var _7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var p=function(f,g){var v=f,x=k[g],_=null,S=0,b=null,M=[],I={},F=function(te,le){_=function(ie){for(var fe=new Array(ie),ve=0;ve=7&&ee(te),b==null&&(b=R(v,x,M)),Q(b,le)},ae=function(te,le){for(var ie=-1;ie<=7;ie+=1)if(!(te+ie<=-1||S<=te+ie))for(var fe=-1;fe<=7;fe+=1)le+fe<=-1||S<=le+fe||(_[te+ie][le+fe]=0<=ie&&ie<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(ie==0||ie==6)||2<=ie&&ie<=4&&2<=fe&&fe<=4)},O=function(){for(var te=8;te>ie&1)==1;_[Math.floor(ie/3)][ie%3+S-8-3]=fe}for(ie=0;ie<18;ie+=1)fe=!te&&(le>>ie&1)==1,_[ie%3+S-8-3][Math.floor(ie/3)]=fe},X=function(te,le){for(var ie=x<<3|le,fe=B.getBCHTypeInfo(ie),ve=0;ve<15;ve+=1){var Me=!te&&(fe>>ve&1)==1;ve<6?_[ve][8]=Me:ve<8?_[ve+1][8]=Me:_[S-15+ve][8]=Me}for(ve=0;ve<15;ve+=1)Me=!te&&(fe>>ve&1)==1,ve<8?_[8][S-ve-1]=Me:ve<9?_[8][15-ve-1+1]=Me:_[8][15-ve-1]=Me;_[S-8][8]=!te},Q=function(te,le){for(var ie=-1,fe=S-1,ve=7,Me=0,Ne=B.getMaskFunction(le),Te=S-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var $e=0;$e<2;$e+=1)if(_[fe][Te-$e]==null){var Ie=!1;Me>>ve&1)==1),Ne(fe,Te-$e)&&(Ie=!Ie),_[fe][Te-$e]=Ie,(ve-=1)==-1&&(Me+=1,ve=7)}if((fe+=ie)<0||S<=fe){fe-=ie,ie=-ie;break}}},R=function(te,le,ie){for(var fe=H.getRSBlocks(te,le),ve=J(),Me=0;Me8*Te)throw"code length overflow. ("+ve.getLengthInBits()+">"+8*Te+")";for(ve.getLengthInBits()+4<=8*Te&&ve.put(0,4);ve.getLengthInBits()%8!=0;)ve.putBit(!1);for(;!(ve.getLengthInBits()>=8*Te||(ve.put(236,8),ve.getLengthInBits()>=8*Te));)ve.put(17,8);return function($e,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Se=0;Se=0?rt.getAt(Je):0}}var pt=0;for(Be=0;BeIe)&&(Ne=Ie,Te=$e)}return Te}())},I.createTableTag=function(te,le){te=te||2;var ie="";ie+='";for(var ve=0;ve';ie+=""}return(ie+="")+"
"},I.createSvgTag=function(te,le,ie,fe){var ve={};typeof arguments[0]=="object"&&(te=(ve=arguments[0]).cellSize,le=ve.margin,ie=ve.alt,fe=ve.title),te=te||2,le=le===void 0?4*te:le,(ie=typeof ie=="string"?{text:ie}:ie||{}).text=ie.text||null,ie.id=ie.text?ie.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*te+2*le,Le="";for($e="l"+te+",0 0,"+te+" -"+te+",0 0,-"+te+"z ",Le+=''+Z(fe.text)+"":"",Le+=ie.text?''+Z(ie.text)+"":"",Le+='',Le+='"},I.createDataURL=function(te,le){te=te||2,le=le===void 0?4*te:le;var ie=I.getModuleCount()*te+2*le,fe=le,ve=ie-le;return m(ie,ie,function(Me,Ne){if(fe<=Me&&Me"};var Z=function(te){for(var le="",ie=0;ie":le+=">";break;case"&":le+="&";break;case'"':le+=""";break;default:le+=fe}}return le};return I.createASCII=function(te,le){if((te=te||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Se,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:pt[Be];ft+=` +}`;const b7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>de.jsx(v7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));b7.displayName="InputOTP";const y7=Yt.forwardRef(({className:t,...e},r)=>de.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));y7.displayName="InputOTPGroup";const Ac=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(m7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return de.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&de.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:de.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Ac.displayName="InputOTPSlot";function uZ(t){const{spinning:e,children:r,className:n}=t;return de.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&de.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:de.jsx(vc,{className:"xc-animate-spin"})})]})}function w7(t){const{email:e}=t,[r,n]=Se.useState(0),[i,s]=Se.useState(!1),[o,a]=Se.useState("");async function u(){n(60);const d=setInterval(()=>{n(p=>p===0?(clearInterval(d),0):p-1)},1e3)}async function l(d){if(a(""),!(d.length<6)){s(!0);try{await t.onInputCode(e,d)}catch(p){a(p.message)}s(!1)}}return Se.useEffect(()=>{u()},[]),de.jsxs(Ss,{children:[de.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[de.jsx(FK,{className:"xc-mb-4",size:60}),de.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:[de.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),de.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]}),de.jsx("div",{className:"xc-mb-2 xc-h-12",children:de.jsx(uZ,{spinning:i,className:"xc-rounded-xl",children:de.jsx(b7,{maxLength:6,onChange:l,disabled:i,className:"disabled:xc-opacity-20",children:de.jsx(y7,{children:de.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[de.jsx(Ac,{index:0}),de.jsx(Ac,{index:1}),de.jsx(Ac,{index:2}),de.jsx(Ac,{index:3}),de.jsx(Ac,{index:4}),de.jsx(Ac,{index:5})]})})})})}),o&&de.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:de.jsx("p",{children:o})})]}),de.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Resend in ${r}s`:de.jsx("button",{id:"sendCodeButton",onClick:t.onResendCode,children:"Send again"})]}),de.jsx("div",{id:"captcha-element"})]})}function x7(t){const{email:e}=t,[r,n]=Se.useState(!1),[i,s]=Se.useState(""),o=Se.useMemo(()=>`xn-btn-${new Date().getTime()}`,[e]);async function a(y,A){n(!0),s(""),await va.getEmailCode({account_type:"email",email:y},A),n(!1)}async function u(y){try{return await a(e,JSON.stringify(y)),{captchaResult:!0,bizResult:!0}}catch(A){return s(A.message),{captchaResult:!1,bizResult:!1}}}async function l(y){y&&t.onCodeSend()}const d=Se.useRef();function p(y){d.current=y}return Se.useEffect(()=>{if(e)return window.initAliyunCaptcha({SceneId:"tqyu8129d",prefix:"1mfsn5f",mode:"popup",element:"#captcha-element",button:`#${o}`,captchaVerifyCallback:u,onBizResultCallback:l,getInstance:p,slideStyle:{width:360,height:40},language:"en",region:"cn"}),()=>{var y,A;(y=document.getElementById("aliyunCaptcha-mask"))==null||y.remove(),(A=document.getElementById("aliyunCaptcha-window-popup"))==null||A.remove()}},[e]),de.jsxs(Ss,{children:[de.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[de.jsx(jK,{className:"xc-mb-4",size:60}),de.jsx("button",{className:"xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2",id:o,children:r?de.jsx(vc,{className:"xc-animate-spin"}):"I'm not a robot"})]}),i&&de.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:de.jsx("p",{children:i})})]})}function fZ(t){const{email:e}=t,r=Ib(),[n,i]=Se.useState("captcha");async function s(o,a){const u=await va.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:a,email:o,inviter_code:r.inviterCode,source:{device:r.device,channel:r.channel,app:r.app}});t.onLogin(u.data)}return de.jsxs(Ss,{children:[de.jsx("div",{className:"xc-mb-12",children:de.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),n==="captcha"&&de.jsx(x7,{email:e,onCodeSend:()=>i("verify-email")}),n==="verify-email"&&de.jsx(w7,{email:e,onInputCode:s,onResendCode:()=>i("captcha")})]})}var _7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var p=function(f,g){var v=f,x=k[g],_=null,S=0,b=null,M=[],I={},F=function(te,le){_=function(ie){for(var fe=new Array(ie),ve=0;ve=7&&ee(te),b==null&&(b=R(v,x,M)),Q(b,le)},ce=function(te,le){for(var ie=-1;ie<=7;ie+=1)if(!(te+ie<=-1||S<=te+ie))for(var fe=-1;fe<=7;fe+=1)le+fe<=-1||S<=le+fe||(_[te+ie][le+fe]=0<=ie&&ie<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(ie==0||ie==6)||2<=ie&&ie<=4&&2<=fe&&fe<=4)},N=function(){for(var te=8;te>ie&1)==1;_[Math.floor(ie/3)][ie%3+S-8-3]=fe}for(ie=0;ie<18;ie+=1)fe=!te&&(le>>ie&1)==1,_[ie%3+S-8-3][Math.floor(ie/3)]=fe},X=function(te,le){for(var ie=x<<3|le,fe=B.getBCHTypeInfo(ie),ve=0;ve<15;ve+=1){var Me=!te&&(fe>>ve&1)==1;ve<6?_[ve][8]=Me:ve<8?_[ve+1][8]=Me:_[S-15+ve][8]=Me}for(ve=0;ve<15;ve+=1)Me=!te&&(fe>>ve&1)==1,ve<8?_[8][S-ve-1]=Me:ve<9?_[8][15-ve-1+1]=Me:_[8][15-ve-1]=Me;_[S-8][8]=!te},Q=function(te,le){for(var ie=-1,fe=S-1,ve=7,Me=0,Ne=B.getMaskFunction(le),Te=S-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var $e=0;$e<2;$e+=1)if(_[fe][Te-$e]==null){var Ie=!1;Me>>ve&1)==1),Ne(fe,Te-$e)&&(Ie=!Ie),_[fe][Te-$e]=Ie,(ve-=1)==-1&&(Me+=1,ve=7)}if((fe+=ie)<0||S<=fe){fe-=ie,ie=-ie;break}}},R=function(te,le,ie){for(var fe=H.getRSBlocks(te,le),ve=J(),Me=0;Me8*Te)throw"code length overflow. ("+ve.getLengthInBits()+">"+8*Te+")";for(ve.getLengthInBits()+4<=8*Te&&ve.put(0,4);ve.getLengthInBits()%8!=0;)ve.putBit(!1);for(;!(ve.getLengthInBits()>=8*Te||(ve.put(236,8),ve.getLengthInBits()>=8*Te));)ve.put(17,8);return function($e,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Ee=0;Ee=0?rt.getAt(Je):0}}var pt=0;for(Be=0;BeIe)&&(Ne=Ie,Te=$e)}return Te}())},I.createTableTag=function(te,le){te=te||2;var ie="";ie+='";for(var ve=0;ve';ie+=""}return(ie+="")+"
"},I.createSvgTag=function(te,le,ie,fe){var ve={};typeof arguments[0]=="object"&&(te=(ve=arguments[0]).cellSize,le=ve.margin,ie=ve.alt,fe=ve.title),te=te||2,le=le===void 0?4*te:le,(ie=typeof ie=="string"?{text:ie}:ie||{}).text=ie.text||null,ie.id=ie.text?ie.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*te+2*le,Le="";for($e="l"+te+",0 0,"+te+" -"+te+",0 0,-"+te+"z ",Le+=''+Z(fe.text)+"":"",Le+=ie.text?''+Z(ie.text)+"":"",Le+='',Le+='"},I.createDataURL=function(te,le){te=te||2,le=le===void 0?4*te:le;var ie=I.getModuleCount()*te+2*le,fe=le,ve=ie-le;return m(ie,ie,function(Me,Ne){if(fe<=Me&&Me"};var Z=function(te){for(var le="",ie=0;ie":le+=">";break;case"&":le+="&";break;case'"':le+=""";break;default:le+=fe}}return le};return I.createASCII=function(te,le){if((te=te||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Ee,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:pt[Be];ft+=` `}return et%2&&ze>0?ft.substring(0,ft.length-et-1)+Array(et+1).join("▀"):ft.substring(0,ft.length-1)}(le);te-=1,le=le===void 0?2*te:le;var ie,fe,ve,Me,Ne=I.getModuleCount()*te+2*le,Te=le,$e=Ne-le,Ie=Array(te+1).join("██"),Le=Array(te+1).join(" "),Ve="",ke="";for(ie=0;ie>>8),S.push(255&I)):S.push(x)}}return S}};var y,A,P,N,D,k={L:1,M:0,Q:3,H:2},B=(y=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],A=1335,P=7973,D=function(f){for(var g=0;f!=0;)g+=1,f>>>=1;return g},(N={}).getBCHTypeInfo=function(f){for(var g=f<<10;D(g)-D(A)>=0;)g^=A<=0;)g^=P<5&&(v+=3+S-5)}for(x=0;x=256;)x-=255;return f[x]}}}();function j(f,g){if(f.length===void 0)throw f.length+"/"+g;var v=function(){for(var _=0;_>>7-x%8&1)==1},put:function(x,_){for(var S=0;S<_;S+=1)v.putBit((x>>>_-S-1&1)==1)},getLengthInBits:function(){return g},putBit:function(x){var _=Math.floor(g/8);f.length<=_&&f.push(0),x&&(f[_]|=128>>>g%8),g+=1}};return v},T=function(f){var g=f,v={getMode:function(){return 1},getLength:function(S){return g.length},write:function(S){for(var b=g,M=0;M+2>>8&255)+(255&M),_.put(M,13),b+=2}if(b>>8)},writeBytes:function(v,x,_){x=x||0,_=_||v.length;for(var S=0;S<_;S+=1)g.writeByte(v[S+x])},writeString:function(v){for(var x=0;x0&&(v+=","),v+=f[x];return v+"]"}};return g},E=function(f){var g=f,v=0,x=0,_=0,S={read:function(){for(;_<8;){if(v>=g.length){if(_==0)return-1;throw"unexpected end of file./"+_}var M=g.charAt(v);if(v+=1,M=="=")return _=0,-1;M.match(/^\s$/)||(x=x<<6|b(M.charCodeAt(0)),_+=6)}var I=x>>>_-8&255;return _-=8,I}},b=function(M){if(65<=M&&M<=90)return M-65;if(97<=M&&M<=122)return M-97+26;if(48<=M&&M<=57)return M-48+52;if(M==43)return 62;if(M==47)return 63;throw"c:"+M};return S},m=function(f,g,v){for(var x=function(ae,O){var se=ae,ee=O,X=new Array(ae*O),Q={setPixel:function(te,le,ie){X[le*se+te]=ie},write:function(te){te.writeString("GIF87a"),te.writeShort(se),te.writeShort(ee),te.writeByte(128),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(255),te.writeByte(255),te.writeByte(255),te.writeString(","),te.writeShort(0),te.writeShort(0),te.writeShort(se),te.writeShort(ee),te.writeByte(0);var le=R(2);te.writeByte(2);for(var ie=0;le.length-ie>255;)te.writeByte(255),te.writeBytes(le,ie,255),ie+=255;te.writeByte(le.length-ie),te.writeBytes(le,ie,le.length-ie),te.writeByte(0),te.writeString(";")}},R=function(te){for(var le=1<>>Se)throw"length over";for(;Te+Se>=8;)Ne.writeByte(255&(He<>>=8-Te,$e=0,Te=0;$e|=He<0&&Ne.writeByte($e)}});Le.write(le,fe);var Ve=0,ke=String.fromCharCode(X[Ve]);for(Ve+=1;Ve=6;)Q(ae>>>O-6),O-=6},X.flush=function(){if(O>0&&(Q(ae<<6-O),ae=0,O=0),se%3!=0)for(var Z=3-se%3,te=0;te>6,128|63&N):N<55296||N>=57344?A.push(224|N>>12,128|N>>6&63,128|63&N):(P++,N=65536+((1023&N)<<10|1023&y.charCodeAt(P)),A.push(240|N>>18,128|N>>12&63,128|N>>6&63,128|63&N))}return A}(p)},(l=typeof(u=function(){return d})=="function"?u.apply(a,[]):u)===void 0||(o.exports=l)}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var u=n[o]={exports:{}};return r[o](u,u.exports,i),u.exports}i.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return i.d(a,{a}),a},i.d=(o,a)=>{for(var u in a)i.o(a,u)&&!i.o(o,u)&&Object.defineProperty(o,u,{enumerable:!0,get:a[u]})},i.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a);var s={};return(()=>{i.d(s,{default:()=>G});const o=E=>!!E&&typeof E=="object"&&!Array.isArray(E);function a(E,...m){if(!m.length)return E;const f=m.shift();return f!==void 0&&o(E)&&o(f)?(E=Object.assign({},E),Object.keys(f).forEach(g=>{const v=E[g],x=f[g];Array.isArray(v)&&Array.isArray(x)?E[g]=x:o(v)&&o(x)?E[g]=a(Object.assign({},v),x):E[g]=x}),a(E,...m)):E}function u(E,m){const f=document.createElement("a");f.download=m,f.href=E,document.body.appendChild(f),f.click(),document.body.removeChild(f)}const l={L:.07,M:.15,Q:.25,H:.3};class d{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"dots":x=this._drawDot;break;case"classy":x=this._drawClassy;break;case"classy-rounded":x=this._drawClassyRounded;break;case"rounded":x=this._drawRounded;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawSquare}x.call(this,{x:m,y:f,size:g,getNeighbor:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_basicSideRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, 0 ${-f}`)}}))}_basicCornerRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_basicCornerExtraRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`)}}))}_basicCornersRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${f/2} ${f/2}h `+f/2+"v "+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_drawDot({x:m,y:f,size:g}){this._basicDot({x:m,y:f,size:g,rotation:0})}_drawSquare({x:m,y:f,size:g}){this._basicSquare({x:m,y:f,size:g,rotation:0})}_drawRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerRounded({x:m,y:f,size:g,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawExtraRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawClassy({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}_drawClassyRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}}class p{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"square":x=this._drawSquare;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawDot}x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g+f/2} ${v}a ${f/2} ${f/2} 0 1 0 0.1 0zm 0 ${x}a ${f/2-x} ${f/2-x} 0 1 1 -0.1 0Z`)}}))}_basicSquare(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f+`zM ${g+x} ${v+x}h `+(f-2*x)+"v "+(f-2*x)+"h "+(2*x-f)+"z")}}))}_basicExtraRounded(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v+2.5*x}v `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*x}h `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*-x}v `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*-x}h `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*x}M ${g+2.5*x} ${v+x}h `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*x}v `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*x}h `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*-x}v `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*-x}`)}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}_drawExtraRounded({x:m,y:f,size:g,rotation:v}){this._basicExtraRounded({x:m,y:f,size:g,rotation:v})}}class y{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;x=this._type==="square"?this._drawSquare:this._drawDot,x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}}const A="circle",P=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],N=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class D{constructor(m,f){this._roundSize=g=>this._options.dotsOptions.roundSize?Math.floor(g):g,this._window=f,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(m.width)),this._element.setAttribute("height",String(m.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),m.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=m.image,this._instanceId=D.instanceCount++,this._options=m}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(m){const f=m.getModuleCount(),g=Math.min(this._options.width,this._options.height)-2*this._options.margin,v=this._options.shape===A?g/Math.sqrt(2):g,x=this._roundSize(v/f);let _={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=m,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:S,qrOptions:b}=this._options,M=S.imageSize*l[b.errorCorrectionLevel],I=Math.floor(M*f*f);_=function({originalHeight:F,originalWidth:ae,maxHiddenDots:O,maxHiddenAxisDots:se,dotSize:ee}){const X={x:0,y:0},Q={x:0,y:0};if(F<=0||ae<=0||O<=0||ee<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const R=F/ae;return X.x=Math.floor(Math.sqrt(O/R)),X.x<=0&&(X.x=1),se&&seO||se&&se{var M,I,F,ae,O,se;return!(this._options.imageOptions.hideBackgroundDots&&S>=(f-_.hideYDots)/2&&S<(f+_.hideYDots)/2&&b>=(f-_.hideXDots)/2&&b<(f+_.hideXDots)/2||!((M=P[S])===null||M===void 0)&&M[b]||!((I=P[S-f+7])===null||I===void 0)&&I[b]||!((F=P[S])===null||F===void 0)&&F[b-f+7]||!((ae=N[S])===null||ae===void 0)&&ae[b]||!((O=N[S-f+7])===null||O===void 0)&&O[b]||!((se=N[S])===null||se===void 0)&&se[b-f+7])}),this.drawCorners(),this._options.image&&await this.drawImage({width:_.width,height:_.height,count:f,dotSize:x})}drawBackground(){var m,f,g;const v=this._element,x=this._options;if(v){const _=(m=x.backgroundOptions)===null||m===void 0?void 0:m.gradient,S=(f=x.backgroundOptions)===null||f===void 0?void 0:f.color;let b=x.height,M=x.width;if(_||S){const I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((g=x.backgroundOptions)===null||g===void 0)&&g.round&&(b=M=Math.min(x.width,x.height),I.setAttribute("rx",String(b/2*x.backgroundOptions.round))),I.setAttribute("x",String(this._roundSize((x.width-M)/2))),I.setAttribute("y",String(this._roundSize((x.height-b)/2))),I.setAttribute("width",String(M)),I.setAttribute("height",String(b)),this._backgroundClipPath.appendChild(I),this._createColor({options:_,color:S,additionalRotation:0,x:0,y:0,height:x.height,width:x.width,name:`background-color-${this._instanceId}`})}}}drawDots(m){var f,g;if(!this._qr)throw"QR code is not defined";const v=this._options,x=this._qr.getModuleCount();if(x>v.width||x>v.height)throw"The canvas is too small.";const _=Math.min(v.width,v.height)-2*v.margin,S=v.shape===A?_/Math.sqrt(2):_,b=this._roundSize(S/x),M=this._roundSize((v.width-x*b)/2),I=this._roundSize((v.height-x*b)/2),F=new d({svg:this._element,type:v.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(f=v.dotsOptions)===null||f===void 0?void 0:f.gradient,color:v.dotsOptions.color,additionalRotation:0,x:0,y:0,height:v.height,width:v.width,name:`dot-color-${this._instanceId}`});for(let ae=0;ae!(O+se<0||ae+ee<0||O+se>=x||ae+ee>=x)&&!(m&&!m(ae+ee,O+se))&&!!this._qr&&this._qr.isDark(ae+ee,O+se)),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element));if(v.shape===A){const ae=this._roundSize((_/b-x)/2),O=x+2*ae,se=M-ae*b,ee=I-ae*b,X=[],Q=this._roundSize(O/2);for(let R=0;R=ae-1&&R<=O-ae&&Z>=ae-1&&Z<=O-ae||Math.sqrt((R-Q)*(R-Q)+(Z-Q)*(Z-Q))>Q?X[R][Z]=0:X[R][Z]=this._qr.isDark(Z-2*ae<0?Z:Z>=x?Z-2*ae:Z-ae,R-2*ae<0?R:R>=x?R-2*ae:R-ae)?1:0}for(let R=0;R{var ie;return!!(!((ie=X[R+le])===null||ie===void 0)&&ie[Z+te])}),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const m=this._element,f=this._options;if(!m)throw"Element code is not defined";const g=this._qr.getModuleCount(),v=Math.min(f.width,f.height)-2*f.margin,x=f.shape===A?v/Math.sqrt(2):v,_=this._roundSize(x/g),S=7*_,b=3*_,M=this._roundSize((f.width-g*_)/2),I=this._roundSize((f.height-g*_)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([F,ae,O])=>{var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me;const Ne=M+F*_*(g-7),Te=I+ae*_*(g-7);let $e=this._dotsClipPath,Ie=this._dotsClipPath;if((!((se=f.cornersSquareOptions)===null||se===void 0)&&se.gradient||!((ee=f.cornersSquareOptions)===null||ee===void 0)&&ee.color)&&($e=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),$e.setAttribute("id",`clip-path-corners-square-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild($e),this._cornersSquareClipPath=this._cornersDotClipPath=Ie=$e,this._createColor({options:(X=f.cornersSquareOptions)===null||X===void 0?void 0:X.gradient,color:(Q=f.cornersSquareOptions)===null||Q===void 0?void 0:Q.color,additionalRotation:O,x:Ne,y:Te,height:S,width:S,name:`corners-square-color-${F}-${ae}-${this._instanceId}`})),(R=f.cornersSquareOptions)===null||R===void 0?void 0:R.type){const Le=new p({svg:this._element,type:f.cornersSquareOptions.type,window:this._window});Le.draw(Ne,Te,S,O),Le._element&&$e&&$e.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Se;return!!(!((Se=P[Ve+He])===null||Se===void 0)&&Se[ke+ze])}),Le._element&&$e&&$e.appendChild(Le._element))}if((!((te=f.cornersDotOptions)===null||te===void 0)&&te.gradient||!((le=f.cornersDotOptions)===null||le===void 0)&&le.color)&&(Ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Ie.setAttribute("id",`clip-path-corners-dot-color-${F}-${ae}-${this._instanceId}`),this._defs.appendChild(Ie),this._cornersDotClipPath=Ie,this._createColor({options:(ie=f.cornersDotOptions)===null||ie===void 0?void 0:ie.gradient,color:(fe=f.cornersDotOptions)===null||fe===void 0?void 0:fe.color,additionalRotation:O,x:Ne+2*_,y:Te+2*_,height:b,width:b,name:`corners-dot-color-${F}-${ae}-${this._instanceId}`})),(ve=f.cornersDotOptions)===null||ve===void 0?void 0:ve.type){const Le=new y({svg:this._element,type:f.cornersDotOptions.type,window:this._window});Le.draw(Ne+2*_,Te+2*_,b,O),Le._element&&Ie&&Ie.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Se;return!!(!((Se=N[Ve+He])===null||Se===void 0)&&Se[ke+ze])}),Le._element&&Ie&&Ie.appendChild(Le._element))}})}loadImage(){return new Promise((m,f)=>{var g;const v=this._options;if(!v.image)return f("Image is not defined");if(!((g=v.nodeCanvas)===null||g===void 0)&&g.loadImage)v.nodeCanvas.loadImage(v.image).then(x=>{var _,S;if(this._image=x,this._options.imageOptions.saveAsBlob){const b=(_=v.nodeCanvas)===null||_===void 0?void 0:_.createCanvas(this._image.width,this._image.height);(S=b==null?void 0:b.getContext("2d"))===null||S===void 0||S.drawImage(x,0,0),this._imageUri=b==null?void 0:b.toDataURL()}m()}).catch(f);else{const x=new this._window.Image;typeof v.imageOptions.crossOrigin=="string"&&(x.crossOrigin=v.imageOptions.crossOrigin),this._image=x,x.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await async function(_,S){return new Promise(b=>{const M=new S.XMLHttpRequest;M.onload=function(){const I=new S.FileReader;I.onloadend=function(){b(I.result)},I.readAsDataURL(M.response)},M.open("GET",_),M.responseType="blob",M.send()})}(v.image||"",this._window)),m()},x.src=v.image}})}async drawImage({width:m,height:f,count:g,dotSize:v}){const x=this._options,_=this._roundSize((x.width-g*v)/2),S=this._roundSize((x.height-g*v)/2),b=_+this._roundSize(x.imageOptions.margin+(g*v-m)/2),M=S+this._roundSize(x.imageOptions.margin+(g*v-f)/2),I=m-2*x.imageOptions.margin,F=f-2*x.imageOptions.margin,ae=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");ae.setAttribute("href",this._imageUri||""),ae.setAttribute("x",String(b)),ae.setAttribute("y",String(M)),ae.setAttribute("width",`${I}px`),ae.setAttribute("height",`${F}px`),this._element.appendChild(ae)}_createColor({options:m,color:f,additionalRotation:g,x:v,y:x,height:_,width:S,name:b}){const M=S>_?S:_,I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(I.setAttribute("x",String(v)),I.setAttribute("y",String(x)),I.setAttribute("height",String(_)),I.setAttribute("width",String(S)),I.setAttribute("clip-path",`url('#clip-path-${b}')`),m){let F;if(m.type==="radial")F=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("fx",String(v+S/2)),F.setAttribute("fy",String(x+_/2)),F.setAttribute("cx",String(v+S/2)),F.setAttribute("cy",String(x+_/2)),F.setAttribute("r",String(M/2));else{const ae=((m.rotation||0)+g)%(2*Math.PI),O=(ae+2*Math.PI)%(2*Math.PI);let se=v+S/2,ee=x+_/2,X=v+S/2,Q=x+_/2;O>=0&&O<=.25*Math.PI||O>1.75*Math.PI&&O<=2*Math.PI?(se-=S/2,ee-=_/2*Math.tan(ae),X+=S/2,Q+=_/2*Math.tan(ae)):O>.25*Math.PI&&O<=.75*Math.PI?(ee-=_/2,se-=S/2/Math.tan(ae),Q+=_/2,X+=S/2/Math.tan(ae)):O>.75*Math.PI&&O<=1.25*Math.PI?(se+=S/2,ee+=_/2*Math.tan(ae),X-=S/2,Q-=_/2*Math.tan(ae)):O>1.25*Math.PI&&O<=1.75*Math.PI&&(ee+=_/2,se+=S/2/Math.tan(ae),Q-=_/2,X-=S/2/Math.tan(ae)),F=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("x1",String(Math.round(se))),F.setAttribute("y1",String(Math.round(ee))),F.setAttribute("x2",String(Math.round(X))),F.setAttribute("y2",String(Math.round(Q)))}m.colorStops.forEach(({offset:ae,color:O})=>{const se=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");se.setAttribute("offset",100*ae+"%"),se.setAttribute("stop-color",O),F.appendChild(se)}),I.setAttribute("fill",`url('#${b}')`),this._defs.appendChild(F)}else f&&I.setAttribute("fill",f);this._element.appendChild(I)}}D.instanceCount=0;const k=D,B="canvas",q={};for(let E=0;E<=40;E++)q[E]=E;const j={type:B,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:q[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function H(E){const m=Object.assign({},E);if(!m.colorStops||!m.colorStops.length)throw"Field 'colorStops' is required in gradient";return m.rotation?m.rotation=Number(m.rotation):m.rotation=0,m.colorStops=m.colorStops.map(f=>Object.assign(Object.assign({},f),{offset:Number(f.offset)})),m}function J(E){const m=Object.assign({},E);return m.width=Number(m.width),m.height=Number(m.height),m.margin=Number(m.margin),m.imageOptions=Object.assign(Object.assign({},m.imageOptions),{hideBackgroundDots:!!m.imageOptions.hideBackgroundDots,imageSize:Number(m.imageOptions.imageSize),margin:Number(m.imageOptions.margin)}),m.margin>Math.min(m.width,m.height)&&(m.margin=Math.min(m.width,m.height)),m.dotsOptions=Object.assign({},m.dotsOptions),m.dotsOptions.gradient&&(m.dotsOptions.gradient=H(m.dotsOptions.gradient)),m.cornersSquareOptions&&(m.cornersSquareOptions=Object.assign({},m.cornersSquareOptions),m.cornersSquareOptions.gradient&&(m.cornersSquareOptions.gradient=H(m.cornersSquareOptions.gradient))),m.cornersDotOptions&&(m.cornersDotOptions=Object.assign({},m.cornersDotOptions),m.cornersDotOptions.gradient&&(m.cornersDotOptions.gradient=H(m.cornersDotOptions.gradient))),m.backgroundOptions&&(m.backgroundOptions=Object.assign({},m.backgroundOptions),m.backgroundOptions.gradient&&(m.backgroundOptions.gradient=H(m.backgroundOptions.gradient))),m}var T=i(873),z=i.n(T);function ue(E){if(!E)throw new Error("Extension must be defined");E[0]==="."&&(E=E.substring(1));const m={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[E.toLowerCase()];if(!m)throw new Error(`Extension "${E}" is not supported`);return m}class _e{constructor(m){m!=null&&m.jsdom?this._window=new m.jsdom("",{resources:"usable"}).window:this._window=window,this._options=m?J(a(j,m)):j,this.update()}static _clearContainer(m){m&&(m.innerHTML="")}_setupSvg(){if(!this._qr)return;const m=new k(this._options,this._window);this._svg=m.getElement(),this._svgDrawingPromise=m.drawQR(this._qr).then(()=>{var f;this._svg&&((f=this._extension)===null||f===void 0||f.call(this,m.getElement(),this._options))})}_setupCanvas(){var m,f;this._qr&&(!((m=this._options.nodeCanvas)===null||m===void 0)&&m.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(f=this._svgDrawingPromise)===null||f===void 0?void 0:f.then(()=>{var g;if(!this._svg)return;const v=this._svg,x=new this._window.XMLSerializer().serializeToString(v),_=btoa(x),S=`data:${ue("svg")};base64,${_}`;if(!((g=this._options.nodeCanvas)===null||g===void 0)&&g.loadImage)return this._options.nodeCanvas.loadImage(S).then(b=>{var M,I;b.width=this._options.width,b.height=this._options.height,(I=(M=this._nodeCanvas)===null||M===void 0?void 0:M.getContext("2d"))===null||I===void 0||I.drawImage(b,0,0)});{const b=new this._window.Image;return new Promise(M=>{b.onload=()=>{var I,F;(F=(I=this._domCanvas)===null||I===void 0?void 0:I.getContext("2d"))===null||F===void 0||F.drawImage(b,0,0),M()},b.src=S})}}))}async _getElement(m="png"){if(!this._qr)throw"QR code is empty";return m.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(m){_e._clearContainer(this._container),this._options=m?J(a(this._options,m)):this._options,this._options.data&&(this._qr=z()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(f){switch(!0){case/^[0-9]*$/.test(f):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(f):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===B?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(m){if(m){if(typeof m.appendChild!="function")throw"Container should be a single DOM node";this._options.type===B?this._domCanvas&&m.appendChild(this._domCanvas):this._svg&&m.appendChild(this._svg),this._container=m}}applyExtension(m){if(!m)throw"Extension function should be defined.";this._extension=m,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(m="png"){if(!this._qr)throw"QR code is empty";const f=await this._getElement(m),g=ue(m);if(!f)return null;if(m.toLowerCase()==="svg"){const v=`\r +`}return Ve.substring(0,Ve.length-1)},I.renderTo2dContext=function(te,le){le=le||2;for(var ie=I.getModuleCount(),fe=0;fe>>8),S.push(255&I)):S.push(x)}}return S}};var y,A,P,O,D,k={L:1,M:0,Q:3,H:2},B=(y=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],A=1335,P=7973,D=function(f){for(var g=0;f!=0;)g+=1,f>>>=1;return g},(O={}).getBCHTypeInfo=function(f){for(var g=f<<10;D(g)-D(A)>=0;)g^=A<=0;)g^=P<5&&(v+=3+S-5)}for(x=0;x=256;)x-=255;return f[x]}}}();function j(f,g){if(f.length===void 0)throw f.length+"/"+g;var v=function(){for(var _=0;_>>7-x%8&1)==1},put:function(x,_){for(var S=0;S<_;S+=1)v.putBit((x>>>_-S-1&1)==1)},getLengthInBits:function(){return g},putBit:function(x){var _=Math.floor(g/8);f.length<=_&&f.push(0),x&&(f[_]|=128>>>g%8),g+=1}};return v},T=function(f){var g=f,v={getMode:function(){return 1},getLength:function(S){return g.length},write:function(S){for(var b=g,M=0;M+2>>8&255)+(255&M),_.put(M,13),b+=2}if(b>>8)},writeBytes:function(v,x,_){x=x||0,_=_||v.length;for(var S=0;S<_;S+=1)g.writeByte(v[S+x])},writeString:function(v){for(var x=0;x0&&(v+=","),v+=f[x];return v+"]"}};return g},E=function(f){var g=f,v=0,x=0,_=0,S={read:function(){for(;_<8;){if(v>=g.length){if(_==0)return-1;throw"unexpected end of file./"+_}var M=g.charAt(v);if(v+=1,M=="=")return _=0,-1;M.match(/^\s$/)||(x=x<<6|b(M.charCodeAt(0)),_+=6)}var I=x>>>_-8&255;return _-=8,I}},b=function(M){if(65<=M&&M<=90)return M-65;if(97<=M&&M<=122)return M-97+26;if(48<=M&&M<=57)return M-48+52;if(M==43)return 62;if(M==47)return 63;throw"c:"+M};return S},m=function(f,g,v){for(var x=function(ce,N){var se=ce,ee=N,X=new Array(ce*N),Q={setPixel:function(te,le,ie){X[le*se+te]=ie},write:function(te){te.writeString("GIF87a"),te.writeShort(se),te.writeShort(ee),te.writeByte(128),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(255),te.writeByte(255),te.writeByte(255),te.writeString(","),te.writeShort(0),te.writeShort(0),te.writeShort(se),te.writeShort(ee),te.writeByte(0);var le=R(2);te.writeByte(2);for(var ie=0;le.length-ie>255;)te.writeByte(255),te.writeBytes(le,ie,255),ie+=255;te.writeByte(le.length-ie),te.writeBytes(le,ie,le.length-ie),te.writeByte(0),te.writeString(";")}},R=function(te){for(var le=1<>>Ee)throw"length over";for(;Te+Ee>=8;)Ne.writeByte(255&(He<>>=8-Te,$e=0,Te=0;$e|=He<0&&Ne.writeByte($e)}});Le.write(le,fe);var Ve=0,ke=String.fromCharCode(X[Ve]);for(Ve+=1;Ve=6;)Q(ce>>>N-6),N-=6},X.flush=function(){if(N>0&&(Q(ce<<6-N),ce=0,N=0),se%3!=0)for(var Z=3-se%3,te=0;te>6,128|63&O):O<55296||O>=57344?A.push(224|O>>12,128|O>>6&63,128|63&O):(P++,O=65536+((1023&O)<<10|1023&y.charCodeAt(P)),A.push(240|O>>18,128|O>>12&63,128|O>>6&63,128|63&O))}return A}(p)},(l=typeof(u=function(){return d})=="function"?u.apply(a,[]):u)===void 0||(o.exports=l)}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var u=n[o]={exports:{}};return r[o](u,u.exports,i),u.exports}i.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return i.d(a,{a}),a},i.d=(o,a)=>{for(var u in a)i.o(a,u)&&!i.o(o,u)&&Object.defineProperty(o,u,{enumerable:!0,get:a[u]})},i.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a);var s={};return(()=>{i.d(s,{default:()=>G});const o=E=>!!E&&typeof E=="object"&&!Array.isArray(E);function a(E,...m){if(!m.length)return E;const f=m.shift();return f!==void 0&&o(E)&&o(f)?(E=Object.assign({},E),Object.keys(f).forEach(g=>{const v=E[g],x=f[g];Array.isArray(v)&&Array.isArray(x)?E[g]=x:o(v)&&o(x)?E[g]=a(Object.assign({},v),x):E[g]=x}),a(E,...m)):E}function u(E,m){const f=document.createElement("a");f.download=m,f.href=E,document.body.appendChild(f),f.click(),document.body.removeChild(f)}const l={L:.07,M:.15,Q:.25,H:.3};class d{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"dots":x=this._drawDot;break;case"classy":x=this._drawClassy;break;case"classy-rounded":x=this._drawClassyRounded;break;case"rounded":x=this._drawRounded;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawSquare}x.call(this,{x:m,y:f,size:g,getNeighbor:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_basicSideRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, 0 ${-f}`)}}))}_basicCornerRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_basicCornerExtraRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`)}}))}_basicCornersRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${f/2} ${f/2}h `+f/2+"v "+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_drawDot({x:m,y:f,size:g}){this._basicDot({x:m,y:f,size:g,rotation:0})}_drawSquare({x:m,y:f,size:g}){this._basicSquare({x:m,y:f,size:g,rotation:0})}_drawRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerRounded({x:m,y:f,size:g,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawExtraRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawClassy({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}_drawClassyRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}}class p{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"square":x=this._drawSquare;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawDot}x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g+f/2} ${v}a ${f/2} ${f/2} 0 1 0 0.1 0zm 0 ${x}a ${f/2-x} ${f/2-x} 0 1 1 -0.1 0Z`)}}))}_basicSquare(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f+`zM ${g+x} ${v+x}h `+(f-2*x)+"v "+(f-2*x)+"h "+(2*x-f)+"z")}}))}_basicExtraRounded(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v+2.5*x}v `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*x}h `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*-x}v `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*-x}h `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*x}M ${g+2.5*x} ${v+x}h `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*x}v `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*x}h `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*-x}v `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*-x}`)}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}_drawExtraRounded({x:m,y:f,size:g,rotation:v}){this._basicExtraRounded({x:m,y:f,size:g,rotation:v})}}class y{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;x=this._type==="square"?this._drawSquare:this._drawDot,x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}}const A="circle",P=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],O=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class D{constructor(m,f){this._roundSize=g=>this._options.dotsOptions.roundSize?Math.floor(g):g,this._window=f,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(m.width)),this._element.setAttribute("height",String(m.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),m.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=m.image,this._instanceId=D.instanceCount++,this._options=m}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(m){const f=m.getModuleCount(),g=Math.min(this._options.width,this._options.height)-2*this._options.margin,v=this._options.shape===A?g/Math.sqrt(2):g,x=this._roundSize(v/f);let _={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=m,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:S,qrOptions:b}=this._options,M=S.imageSize*l[b.errorCorrectionLevel],I=Math.floor(M*f*f);_=function({originalHeight:F,originalWidth:ce,maxHiddenDots:N,maxHiddenAxisDots:se,dotSize:ee}){const X={x:0,y:0},Q={x:0,y:0};if(F<=0||ce<=0||N<=0||ee<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const R=F/ce;return X.x=Math.floor(Math.sqrt(N/R)),X.x<=0&&(X.x=1),se&&seN||se&&se{var M,I,F,ce,N,se;return!(this._options.imageOptions.hideBackgroundDots&&S>=(f-_.hideYDots)/2&&S<(f+_.hideYDots)/2&&b>=(f-_.hideXDots)/2&&b<(f+_.hideXDots)/2||!((M=P[S])===null||M===void 0)&&M[b]||!((I=P[S-f+7])===null||I===void 0)&&I[b]||!((F=P[S])===null||F===void 0)&&F[b-f+7]||!((ce=O[S])===null||ce===void 0)&&ce[b]||!((N=O[S-f+7])===null||N===void 0)&&N[b]||!((se=O[S])===null||se===void 0)&&se[b-f+7])}),this.drawCorners(),this._options.image&&await this.drawImage({width:_.width,height:_.height,count:f,dotSize:x})}drawBackground(){var m,f,g;const v=this._element,x=this._options;if(v){const _=(m=x.backgroundOptions)===null||m===void 0?void 0:m.gradient,S=(f=x.backgroundOptions)===null||f===void 0?void 0:f.color;let b=x.height,M=x.width;if(_||S){const I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((g=x.backgroundOptions)===null||g===void 0)&&g.round&&(b=M=Math.min(x.width,x.height),I.setAttribute("rx",String(b/2*x.backgroundOptions.round))),I.setAttribute("x",String(this._roundSize((x.width-M)/2))),I.setAttribute("y",String(this._roundSize((x.height-b)/2))),I.setAttribute("width",String(M)),I.setAttribute("height",String(b)),this._backgroundClipPath.appendChild(I),this._createColor({options:_,color:S,additionalRotation:0,x:0,y:0,height:x.height,width:x.width,name:`background-color-${this._instanceId}`})}}}drawDots(m){var f,g;if(!this._qr)throw"QR code is not defined";const v=this._options,x=this._qr.getModuleCount();if(x>v.width||x>v.height)throw"The canvas is too small.";const _=Math.min(v.width,v.height)-2*v.margin,S=v.shape===A?_/Math.sqrt(2):_,b=this._roundSize(S/x),M=this._roundSize((v.width-x*b)/2),I=this._roundSize((v.height-x*b)/2),F=new d({svg:this._element,type:v.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(f=v.dotsOptions)===null||f===void 0?void 0:f.gradient,color:v.dotsOptions.color,additionalRotation:0,x:0,y:0,height:v.height,width:v.width,name:`dot-color-${this._instanceId}`});for(let ce=0;ce!(N+se<0||ce+ee<0||N+se>=x||ce+ee>=x)&&!(m&&!m(ce+ee,N+se))&&!!this._qr&&this._qr.isDark(ce+ee,N+se)),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element));if(v.shape===A){const ce=this._roundSize((_/b-x)/2),N=x+2*ce,se=M-ce*b,ee=I-ce*b,X=[],Q=this._roundSize(N/2);for(let R=0;R=ce-1&&R<=N-ce&&Z>=ce-1&&Z<=N-ce||Math.sqrt((R-Q)*(R-Q)+(Z-Q)*(Z-Q))>Q?X[R][Z]=0:X[R][Z]=this._qr.isDark(Z-2*ce<0?Z:Z>=x?Z-2*ce:Z-ce,R-2*ce<0?R:R>=x?R-2*ce:R-ce)?1:0}for(let R=0;R{var ie;return!!(!((ie=X[R+le])===null||ie===void 0)&&ie[Z+te])}),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const m=this._element,f=this._options;if(!m)throw"Element code is not defined";const g=this._qr.getModuleCount(),v=Math.min(f.width,f.height)-2*f.margin,x=f.shape===A?v/Math.sqrt(2):v,_=this._roundSize(x/g),S=7*_,b=3*_,M=this._roundSize((f.width-g*_)/2),I=this._roundSize((f.height-g*_)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([F,ce,N])=>{var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me;const Ne=M+F*_*(g-7),Te=I+ce*_*(g-7);let $e=this._dotsClipPath,Ie=this._dotsClipPath;if((!((se=f.cornersSquareOptions)===null||se===void 0)&&se.gradient||!((ee=f.cornersSquareOptions)===null||ee===void 0)&&ee.color)&&($e=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),$e.setAttribute("id",`clip-path-corners-square-color-${F}-${ce}-${this._instanceId}`),this._defs.appendChild($e),this._cornersSquareClipPath=this._cornersDotClipPath=Ie=$e,this._createColor({options:(X=f.cornersSquareOptions)===null||X===void 0?void 0:X.gradient,color:(Q=f.cornersSquareOptions)===null||Q===void 0?void 0:Q.color,additionalRotation:N,x:Ne,y:Te,height:S,width:S,name:`corners-square-color-${F}-${ce}-${this._instanceId}`})),(R=f.cornersSquareOptions)===null||R===void 0?void 0:R.type){const Le=new p({svg:this._element,type:f.cornersSquareOptions.type,window:this._window});Le.draw(Ne,Te,S,N),Le._element&&$e&&$e.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=P[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&$e&&$e.appendChild(Le._element))}if((!((te=f.cornersDotOptions)===null||te===void 0)&&te.gradient||!((le=f.cornersDotOptions)===null||le===void 0)&&le.color)&&(Ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Ie.setAttribute("id",`clip-path-corners-dot-color-${F}-${ce}-${this._instanceId}`),this._defs.appendChild(Ie),this._cornersDotClipPath=Ie,this._createColor({options:(ie=f.cornersDotOptions)===null||ie===void 0?void 0:ie.gradient,color:(fe=f.cornersDotOptions)===null||fe===void 0?void 0:fe.color,additionalRotation:N,x:Ne+2*_,y:Te+2*_,height:b,width:b,name:`corners-dot-color-${F}-${ce}-${this._instanceId}`})),(ve=f.cornersDotOptions)===null||ve===void 0?void 0:ve.type){const Le=new y({svg:this._element,type:f.cornersDotOptions.type,window:this._window});Le.draw(Ne+2*_,Te+2*_,b,N),Le._element&&Ie&&Ie.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=O[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&Ie&&Ie.appendChild(Le._element))}})}loadImage(){return new Promise((m,f)=>{var g;const v=this._options;if(!v.image)return f("Image is not defined");if(!((g=v.nodeCanvas)===null||g===void 0)&&g.loadImage)v.nodeCanvas.loadImage(v.image).then(x=>{var _,S;if(this._image=x,this._options.imageOptions.saveAsBlob){const b=(_=v.nodeCanvas)===null||_===void 0?void 0:_.createCanvas(this._image.width,this._image.height);(S=b==null?void 0:b.getContext("2d"))===null||S===void 0||S.drawImage(x,0,0),this._imageUri=b==null?void 0:b.toDataURL()}m()}).catch(f);else{const x=new this._window.Image;typeof v.imageOptions.crossOrigin=="string"&&(x.crossOrigin=v.imageOptions.crossOrigin),this._image=x,x.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await async function(_,S){return new Promise(b=>{const M=new S.XMLHttpRequest;M.onload=function(){const I=new S.FileReader;I.onloadend=function(){b(I.result)},I.readAsDataURL(M.response)},M.open("GET",_),M.responseType="blob",M.send()})}(v.image||"",this._window)),m()},x.src=v.image}})}async drawImage({width:m,height:f,count:g,dotSize:v}){const x=this._options,_=this._roundSize((x.width-g*v)/2),S=this._roundSize((x.height-g*v)/2),b=_+this._roundSize(x.imageOptions.margin+(g*v-m)/2),M=S+this._roundSize(x.imageOptions.margin+(g*v-f)/2),I=m-2*x.imageOptions.margin,F=f-2*x.imageOptions.margin,ce=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");ce.setAttribute("href",this._imageUri||""),ce.setAttribute("x",String(b)),ce.setAttribute("y",String(M)),ce.setAttribute("width",`${I}px`),ce.setAttribute("height",`${F}px`),this._element.appendChild(ce)}_createColor({options:m,color:f,additionalRotation:g,x:v,y:x,height:_,width:S,name:b}){const M=S>_?S:_,I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(I.setAttribute("x",String(v)),I.setAttribute("y",String(x)),I.setAttribute("height",String(_)),I.setAttribute("width",String(S)),I.setAttribute("clip-path",`url('#clip-path-${b}')`),m){let F;if(m.type==="radial")F=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("fx",String(v+S/2)),F.setAttribute("fy",String(x+_/2)),F.setAttribute("cx",String(v+S/2)),F.setAttribute("cy",String(x+_/2)),F.setAttribute("r",String(M/2));else{const ce=((m.rotation||0)+g)%(2*Math.PI),N=(ce+2*Math.PI)%(2*Math.PI);let se=v+S/2,ee=x+_/2,X=v+S/2,Q=x+_/2;N>=0&&N<=.25*Math.PI||N>1.75*Math.PI&&N<=2*Math.PI?(se-=S/2,ee-=_/2*Math.tan(ce),X+=S/2,Q+=_/2*Math.tan(ce)):N>.25*Math.PI&&N<=.75*Math.PI?(ee-=_/2,se-=S/2/Math.tan(ce),Q+=_/2,X+=S/2/Math.tan(ce)):N>.75*Math.PI&&N<=1.25*Math.PI?(se+=S/2,ee+=_/2*Math.tan(ce),X-=S/2,Q-=_/2*Math.tan(ce)):N>1.25*Math.PI&&N<=1.75*Math.PI&&(ee+=_/2,se+=S/2/Math.tan(ce),Q-=_/2,X-=S/2/Math.tan(ce)),F=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("x1",String(Math.round(se))),F.setAttribute("y1",String(Math.round(ee))),F.setAttribute("x2",String(Math.round(X))),F.setAttribute("y2",String(Math.round(Q)))}m.colorStops.forEach(({offset:ce,color:N})=>{const se=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");se.setAttribute("offset",100*ce+"%"),se.setAttribute("stop-color",N),F.appendChild(se)}),I.setAttribute("fill",`url('#${b}')`),this._defs.appendChild(F)}else f&&I.setAttribute("fill",f);this._element.appendChild(I)}}D.instanceCount=0;const k=D,B="canvas",q={};for(let E=0;E<=40;E++)q[E]=E;const j={type:B,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:q[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function H(E){const m=Object.assign({},E);if(!m.colorStops||!m.colorStops.length)throw"Field 'colorStops' is required in gradient";return m.rotation?m.rotation=Number(m.rotation):m.rotation=0,m.colorStops=m.colorStops.map(f=>Object.assign(Object.assign({},f),{offset:Number(f.offset)})),m}function J(E){const m=Object.assign({},E);return m.width=Number(m.width),m.height=Number(m.height),m.margin=Number(m.margin),m.imageOptions=Object.assign(Object.assign({},m.imageOptions),{hideBackgroundDots:!!m.imageOptions.hideBackgroundDots,imageSize:Number(m.imageOptions.imageSize),margin:Number(m.imageOptions.margin)}),m.margin>Math.min(m.width,m.height)&&(m.margin=Math.min(m.width,m.height)),m.dotsOptions=Object.assign({},m.dotsOptions),m.dotsOptions.gradient&&(m.dotsOptions.gradient=H(m.dotsOptions.gradient)),m.cornersSquareOptions&&(m.cornersSquareOptions=Object.assign({},m.cornersSquareOptions),m.cornersSquareOptions.gradient&&(m.cornersSquareOptions.gradient=H(m.cornersSquareOptions.gradient))),m.cornersDotOptions&&(m.cornersDotOptions=Object.assign({},m.cornersDotOptions),m.cornersDotOptions.gradient&&(m.cornersDotOptions.gradient=H(m.cornersDotOptions.gradient))),m.backgroundOptions&&(m.backgroundOptions=Object.assign({},m.backgroundOptions),m.backgroundOptions.gradient&&(m.backgroundOptions.gradient=H(m.backgroundOptions.gradient))),m}var T=i(873),z=i.n(T);function ue(E){if(!E)throw new Error("Extension must be defined");E[0]==="."&&(E=E.substring(1));const m={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[E.toLowerCase()];if(!m)throw new Error(`Extension "${E}" is not supported`);return m}class _e{constructor(m){m!=null&&m.jsdom?this._window=new m.jsdom("",{resources:"usable"}).window:this._window=window,this._options=m?J(a(j,m)):j,this.update()}static _clearContainer(m){m&&(m.innerHTML="")}_setupSvg(){if(!this._qr)return;const m=new k(this._options,this._window);this._svg=m.getElement(),this._svgDrawingPromise=m.drawQR(this._qr).then(()=>{var f;this._svg&&((f=this._extension)===null||f===void 0||f.call(this,m.getElement(),this._options))})}_setupCanvas(){var m,f;this._qr&&(!((m=this._options.nodeCanvas)===null||m===void 0)&&m.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(f=this._svgDrawingPromise)===null||f===void 0?void 0:f.then(()=>{var g;if(!this._svg)return;const v=this._svg,x=new this._window.XMLSerializer().serializeToString(v),_=btoa(x),S=`data:${ue("svg")};base64,${_}`;if(!((g=this._options.nodeCanvas)===null||g===void 0)&&g.loadImage)return this._options.nodeCanvas.loadImage(S).then(b=>{var M,I;b.width=this._options.width,b.height=this._options.height,(I=(M=this._nodeCanvas)===null||M===void 0?void 0:M.getContext("2d"))===null||I===void 0||I.drawImage(b,0,0)});{const b=new this._window.Image;return new Promise(M=>{b.onload=()=>{var I,F;(F=(I=this._domCanvas)===null||I===void 0?void 0:I.getContext("2d"))===null||F===void 0||F.drawImage(b,0,0),M()},b.src=S})}}))}async _getElement(m="png"){if(!this._qr)throw"QR code is empty";return m.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(m){_e._clearContainer(this._container),this._options=m?J(a(this._options,m)):this._options,this._options.data&&(this._qr=z()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(f){switch(!0){case/^[0-9]*$/.test(f):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(f):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===B?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(m){if(m){if(typeof m.appendChild!="function")throw"Container should be a single DOM node";this._options.type===B?this._domCanvas&&m.appendChild(this._domCanvas):this._svg&&m.appendChild(this._svg),this._container=m}}applyExtension(m){if(!m)throw"Extension function should be defined.";this._extension=m,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(m="png"){if(!this._qr)throw"QR code is empty";const f=await this._getElement(m),g=ue(m);if(!f)return null;if(m.toLowerCase()==="svg"){const v=`\r ${new this._window.XMLSerializer().serializeToString(f)}`;return typeof Blob>"u"||this._options.jsdom?Buffer.from(v):new Blob([v],{type:g})}return new Promise(v=>{const x=f;if("toBuffer"in x)if(g==="image/png")v(x.toBuffer(g));else if(g==="image/jpeg")v(x.toBuffer(g));else{if(g!=="application/pdf")throw Error("Unsupported extension");v(x.toBuffer(g))}else"toBlob"in x&&x.toBlob(v,g,1)})}async download(m){if(!this._qr)throw"QR code is empty";if(typeof Blob>"u")throw"Cannot download in Node.js, call getRawData instead.";let f="png",g="qr";typeof m=="string"?(f=m,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):typeof m=="object"&&m!==null&&(m.name&&(g=m.name),m.extension&&(f=m.extension));const v=await this._getElement(f);if(v)if(f.toLowerCase()==="svg"){let x=new XMLSerializer().serializeToString(v);x=`\r -`+x,u(`data:${ue(f)};charset=utf-8,${encodeURIComponent(x)}`,`${g}.svg`)}else u(v.toDataURL(ue(f)),`${g}.${f}`)}}const G=_e})(),s.default})())})(_7);var fZ=_7.exports;const E7=ji(fZ);class Aa extends yt{constructor(e){const{docsPath:r,field:n,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${n}".`,{docsPath:r,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}function S7(t){if(/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t)||/%[^0-9a-f]/i.test(t)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(t))return!1;const e=lZ(t),r=e[1],n=e[2],i=e[3],s=e[4],o=e[5];if(!(r!=null&&r.length&&i.length>=0))return!1;if(n!=null&&n.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9\+\-\.]*$/.test(r.toLowerCase()))return!1;let a="";return a+=`${r}:`,n!=null&&n.length&&(a+=`//${n}`),a+=i,s!=null&&s.length&&(a+=`?${s}`),o!=null&&o.length&&(a+=`#${o}`),a}function lZ(t){return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}function A7(t){const{chainId:e,domain:r,expirationTime:n,issuedAt:i=new Date,nonce:s,notBefore:o,requestId:a,resources:u,scheme:l,uri:d,version:p}=t;{if(e!==Math.floor(e))throw new Aa({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${e}`]});if(!(hZ.test(r)||dZ.test(r)||pZ.test(r)))throw new Aa({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${r}`]});if(!gZ.test(s))throw new Aa({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${s}`]});if(!S7(d))throw new Aa({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${d}`]});if(p!=="1")throw new Aa({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${p}`]});if(l&&!mZ.test(l))throw new Aa({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${l}`]});const k=t.statement;if(k!=null&&k.includes(` +`+x,u(`data:${ue(f)};charset=utf-8,${encodeURIComponent(x)}`,`${g}.svg`)}else u(v.toDataURL(ue(f)),`${g}.${f}`)}}const G=_e})(),s.default})())})(_7);var lZ=_7.exports;const E7=ji(lZ);class Aa extends yt{constructor(e){const{docsPath:r,field:n,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${n}".`,{docsPath:r,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}function S7(t){if(/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t)||/%[^0-9a-f]/i.test(t)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(t))return!1;const e=hZ(t),r=e[1],n=e[2],i=e[3],s=e[4],o=e[5];if(!(r!=null&&r.length&&i.length>=0))return!1;if(n!=null&&n.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9\+\-\.]*$/.test(r.toLowerCase()))return!1;let a="";return a+=`${r}:`,n!=null&&n.length&&(a+=`//${n}`),a+=i,s!=null&&s.length&&(a+=`?${s}`),o!=null&&o.length&&(a+=`#${o}`),a}function hZ(t){return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}function A7(t){const{chainId:e,domain:r,expirationTime:n,issuedAt:i=new Date,nonce:s,notBefore:o,requestId:a,resources:u,scheme:l,uri:d,version:p}=t;{if(e!==Math.floor(e))throw new Aa({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${e}`]});if(!(dZ.test(r)||pZ.test(r)||gZ.test(r)))throw new Aa({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${r}`]});if(!mZ.test(s))throw new Aa({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${s}`]});if(!S7(d))throw new Aa({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${d}`]});if(p!=="1")throw new Aa({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${p}`]});if(l&&!vZ.test(l))throw new Aa({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${l}`]});const k=t.statement;if(k!=null&&k.includes(` `))throw new Aa({field:"statement",metaMessages:["- Statement must not include '\\n'.","",`Provided value: ${k}`]})}const y=og(t.address),A=l?`${l}://${r}`:r,P=t.statement?`${t.statement} -`:"",N=`${A} wants you to sign in with your Ethereum account: +`:"",O=`${A} wants you to sign in with your Ethereum account: ${y} ${P}`;let D=`URI: ${d} @@ -236,12 +236,12 @@ Expiration Time: ${n.toISOString()}`),o&&(D+=` Not Before: ${o.toISOString()}`),a&&(D+=` Request ID: ${a}`),u){let k=` Resources:`;for(const B of u){if(!S7(B))throw new Aa({field:"resources",metaMessages:["- Every resource must be a RFC 3986 URI.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${B}`]});k+=` -- ${B}`}D+=k}return`${N} -${D}`}const hZ=/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/,dZ=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/,pZ=/^localhost(:[0-9]{1,5})?$/,gZ=/^[a-zA-Z0-9]{8,}$/,mZ=/^([a-zA-Z][a-zA-Z0-9+-.]*)$/,P7="7a4434fefbcc9af474fb5c995e47d286",vZ={projectId:P7,metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},bZ={namespaces:{eip155:{methods:["eth_sendTransaction","eth_signTransaction","eth_sign","personal_sign","eth_signTypedData"],chains:["eip155:1"],events:["chainChanged","accountsChanged","disconnect"],rpcMap:{1:`https://rpc.walletconnect.com?chainId=eip155:1&projectId=${P7}`}}},skipPairing:!1};function yZ(t,e){const r=window.location.host,n=window.location.href;return A7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function M7(t){var ue,_e,G;const e=Ee.useRef(null),{wallet:r,onGetExtension:n,onSignFinish:i}=t,[s,o]=Ee.useState(""),[a,u]=Ee.useState(!1),[l,d]=Ee.useState(""),[p,y]=Ee.useState("scan"),A=Ee.useRef(),[P,N]=Ee.useState((ue=r.config)==null?void 0:ue.image),[D,k]=Ee.useState(!1),{saveLastUsedWallet:B}=Kl();async function q(E){var f,g,v,x;u(!0);const m=await pz.init(vZ);m.session&&await m.disconnect();try{if(y("scan"),m.on("display_uri",ae=>{console.log("display_uri",ae),o(ae),u(!1),y("scan")}),m.on("error",ae=>{console.log(ae)}),m.on("session_update",ae=>{console.log("session_update",ae)}),!await m.connect(bZ))throw new Error("Walletconnect init failed");const S=new ru(m);N(((f=S.config)==null?void 0:f.image)||((g=E.config)==null?void 0:g.image));const b=await S.getAddress(),M=await va.getNonce({account_type:"block_chain"});console.log("get nonce",M);const I=yZ(b,M);y("sign");const F=await S.signMessage(I,b);y("waiting"),await i(S,{message:I,nonce:M,signature:F,address:b,wallet_name:((v=S.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),B(S)}catch(_){console.log("err",_),d(_.details||_.message)}}function j(){A.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),A.current.append(e.current)}function H(E){var m;console.log(A.current),(m=A.current)==null||m.update({data:E})}Ee.useEffect(()=>{s&&H(s)},[s]),Ee.useEffect(()=>{q(r)},[r]),Ee.useEffect(()=>{j()},[]);function J(){d(""),H(""),q(r)}function T(){k(!0),navigator.clipboard.writeText(s),setTimeout(()=>{k(!1)},2500)}function z(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return ge.jsxs("div",{children:[ge.jsx("div",{className:"xc-text-center",children:ge.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[ge.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),ge.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?ge.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):ge.jsx("img",{className:"xc-h-10 xc-w-10",src:P})})]})}),ge.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[ge.jsx("button",{disabled:!s,onClick:T,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:D?ge.jsxs(ge.Fragment,{children:[" ",ge.jsx(LK,{})," Copied!"]}):ge.jsxs(ge.Fragment,{children:[ge.jsx($K,{}),"Copy QR URL"]})}),((_e=r.config)==null?void 0:_e.getWallet)&&ge.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[ge.jsx(kK,{}),"Get Extension"]}),((G=r.config)==null?void 0:G.desktop_link)&&ge.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:z,children:[ge.jsx(l8,{}),"Desktop"]})]}),ge.jsx("div",{className:"xc-text-center",children:l?ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),ge.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:J,children:"Retry"})]}):ge.jsxs(ge.Fragment,{children:[p==="scan"&&ge.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),p==="connect"&&ge.jsx("p",{children:"Click connect in your wallet app"}),p==="sign"&&ge.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),p==="waiting"&&ge.jsx("div",{className:"xc-text-center",children:ge.jsx(vc,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const wZ="Accept connection request in the wallet",xZ="Accept sign-in request in your wallet";function _Z(t,e){const r=window.location.host,n=window.location.href;return A7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function I7(t){var p;const[e,r]=Ee.useState(),{wallet:n,onSignFinish:i}=t,s=Ee.useRef(),[o,a]=Ee.useState("connect"),{saveLastUsedWallet:u}=Kl();async function l(y){var A;try{a("connect");const P=await n.connect();if(!P||P.length===0)throw new Error("Wallet connect error");const N=og(P[0]),D=_Z(N,y);a("sign");const k=await n.signMessage(D,N);if(!k||k.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:N,signature:k,message:D,nonce:y,wallet_name:((A=n.config)==null?void 0:A.name)||""}),u(n)}catch(P){console.log(P.details),r(P.details||P.message)}}async function d(){try{r("");const y=await va.getNonce({account_type:"block_chain"});s.current=y,l(s.current)}catch(y){console.log(y.details),r(y.message)}}return Ee.useEffect(()=>{d()},[]),ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[ge.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(p=n.config)==null?void 0:p.image,alt:""}),e&&ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),ge.jsx("div",{className:"xc-flex xc-gap-2",children:ge.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:d,children:"Retry"})})]}),!e&&ge.jsxs(ge.Fragment,{children:[o==="connect"&&ge.jsx("span",{className:"xc-text-center",children:wZ}),o==="sign"&&ge.jsx("span",{className:"xc-text-center",children:xZ}),o==="waiting"&&ge.jsx("span",{className:"xc-text-center",children:ge.jsx(vc,{className:"xc-animate-spin"})})]})]})}const Gu="https://static.codatta.io/codatta-connect/wallet-icons.svg",EZ="https://itunes.apple.com/app/",SZ="https://play.google.com/store/apps/details?id=",AZ="https://chromewebstore.google.com/detail/",PZ="https://chromewebstore.google.com/detail/",MZ="https://addons.mozilla.org/en-US/firefox/addon/",IZ="https://microsoftedge.microsoft.com/addons/detail/";function Yu(t){const{icon:e,title:r,link:n}=t;return ge.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[ge.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,ge.jsx(f8,{className:"xc-ml-auto xc-text-gray-400"})]})}function CZ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${EZ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${SZ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${AZ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${PZ}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${MZ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${IZ}${t.edge_addon_id}`),e}function C7(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=CZ(r);return ge.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[ge.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),ge.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),ge.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),ge.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&ge.jsx(Yu,{link:n.chromeStoreLink,icon:`${Gu}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&ge.jsx(Yu,{link:n.appStoreLink,icon:`${Gu}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&ge.jsx(Yu,{link:n.playStoreLink,icon:`${Gu}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&ge.jsx(Yu,{link:n.edgeStoreLink,icon:`${Gu}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&ge.jsx(Yu,{link:n.braveStoreLink,icon:`${Gu}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&ge.jsx(Yu,{link:n.firefoxStoreLink,icon:`${Gu}#firefox`,title:"Mozilla Firefox"})]})]})}function TZ(t){const{wallet:e}=t,[r,n]=Ee.useState(e.installed?"connect":"qr"),i=Cb();async function s(o,a){var l;const u=await va.walletLogin({account_type:"block_chain",account_enum:i.role,connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&ge.jsx(M7,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&ge.jsx(I7,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&ge.jsx(C7,{wallet:e})]})}function RZ(t){const{wallet:e,onClick:r}=t,n=ge.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return ge.jsx(Sb,{icon:n,title:i,onClick:()=>r(e)})}function T7(t){const{connector:e}=t,[r,n]=Ee.useState(),[i,s]=Ee.useState([]),o=Ee.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d),console.log(d)}Ee.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[ge.jsx(h8,{className:"xc-shrink-0 xc-opacity-50"}),ge.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),ge.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>ge.jsx(RZ,{wallet:d,onClick:l},d.name))})]})}var R7={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,$[W+1]=V>>16&255,$[W+2]=V>>8&255,$[W+3]=V&255,$[W+4]=C>>24&255,$[W+5]=C>>16&255,$[W+6]=C>>8&255,$[W+7]=C&255}function N($,W,V,C,Y){var U,oe=0;for(U=0;U>>8)-1}function D($,W,V,C){return N($,W,V,C,16)}function k($,W,V,C){return N($,W,V,C,32)}function B($,W,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,U=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=W[0]&255|(W[1]&255)<<8|(W[2]&255)<<16|(W[3]&255)<<24,it=W[4]&255|(W[5]&255)<<8|(W[6]&255)<<16|(W[7]&255)<<24,Ue=W[8]&255|(W[9]&255)<<8|(W[10]&255)<<16|(W[11]&255)<<24,gt=W[12]&255|(W[13]&255)<<8|(W[14]&255)<<16|(W[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=U,ot=oe,wt=pe,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;dt=dt+Y|0,_t=_t+U|0,ot=ot+oe|0,wt=wt+pe|0,lt=lt+xe|0,at=at+Re|0,Ae=Ae+De|0,Pe=Pe+it|0,Ge=Ge+Ue|0,je=je+gt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=_t>>>0&255,$[5]=_t>>>8&255,$[6]=_t>>>16&255,$[7]=_t>>>24&255,$[8]=ot>>>0&255,$[9]=ot>>>8&255,$[10]=ot>>>16&255,$[11]=ot>>>24&255,$[12]=wt>>>0&255,$[13]=wt>>>8&255,$[14]=wt>>>16&255,$[15]=wt>>>24&255,$[16]=lt>>>0&255,$[17]=lt>>>8&255,$[18]=lt>>>16&255,$[19]=lt>>>24&255,$[20]=at>>>0&255,$[21]=at>>>8&255,$[22]=at>>>16&255,$[23]=at>>>24&255,$[24]=Ae>>>0&255,$[25]=Ae>>>8&255,$[26]=Ae>>>16&255,$[27]=Ae>>>24&255,$[28]=Pe>>>0&255,$[29]=Pe>>>8&255,$[30]=Pe>>>16&255,$[31]=Pe>>>24&255,$[32]=Ge>>>0&255,$[33]=Ge>>>8&255,$[34]=Ge>>>16&255,$[35]=Ge>>>24&255,$[36]=je>>>0&255,$[37]=je>>>8&255,$[38]=je>>>16&255,$[39]=je>>>24&255,$[40]=qe>>>0&255,$[41]=qe>>>8&255,$[42]=qe>>>16&255,$[43]=qe>>>24&255,$[44]=Xe>>>0&255,$[45]=Xe>>>8&255,$[46]=Xe>>>16&255,$[47]=Xe>>>24&255,$[48]=kt>>>0&255,$[49]=kt>>>8&255,$[50]=kt>>>16&255,$[51]=kt>>>24&255,$[52]=Wt>>>0&255,$[53]=Wt>>>8&255,$[54]=Wt>>>16&255,$[55]=Wt>>>24&255,$[56]=Zt>>>0&255,$[57]=Zt>>>8&255,$[58]=Zt>>>16&255,$[59]=Zt>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255}function q($,W,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,U=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,pe=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=W[0]&255|(W[1]&255)<<8|(W[2]&255)<<16|(W[3]&255)<<24,it=W[4]&255|(W[5]&255)<<8|(W[6]&255)<<16|(W[7]&255)<<24,Ue=W[8]&255|(W[9]&255)<<8|(W[10]&255)<<16|(W[11]&255)<<24,gt=W[12]&255|(W[13]&255)<<8|(W[14]&255)<<16|(W[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=U,ot=oe,wt=pe,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=at>>>0&255,$[5]=at>>>8&255,$[6]=at>>>16&255,$[7]=at>>>24&255,$[8]=qe>>>0&255,$[9]=qe>>>8&255,$[10]=qe>>>16&255,$[11]=qe>>>24&255,$[12]=Kt>>>0&255,$[13]=Kt>>>8&255,$[14]=Kt>>>16&255,$[15]=Kt>>>24&255,$[16]=Ae>>>0&255,$[17]=Ae>>>8&255,$[18]=Ae>>>16&255,$[19]=Ae>>>24&255,$[20]=Pe>>>0&255,$[21]=Pe>>>8&255,$[22]=Pe>>>16&255,$[23]=Pe>>>24&255,$[24]=Ge>>>0&255,$[25]=Ge>>>8&255,$[26]=Ge>>>16&255,$[27]=Ge>>>24&255,$[28]=je>>>0&255,$[29]=je>>>8&255,$[30]=je>>>16&255,$[31]=je>>>24&255}function j($,W,V,C){B($,W,V,C)}function H($,W,V,C){q($,W,V,C)}var J=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T($,W,V,C,Y,U,oe){var pe=new Uint8Array(16),xe=new Uint8Array(64),Re,De;for(De=0;De<16;De++)pe[De]=0;for(De=0;De<8;De++)pe[De]=U[De];for(;Y>=64;){for(j(xe,pe,oe,J),De=0;De<64;De++)$[W+De]=V[C+De]^xe[De];for(Re=1,De=8;De<16;De++)Re=Re+(pe[De]&255)|0,pe[De]=Re&255,Re>>>=8;Y-=64,W+=64,C+=64}if(Y>0)for(j(xe,pe,oe,J),De=0;De=64;){for(j(oe,U,Y,J),xe=0;xe<64;xe++)$[W+xe]=oe[xe];for(pe=1,xe=8;xe<16;xe++)pe=pe+(U[xe]&255)|0,U[xe]=pe&255,pe>>>=8;V-=64,W+=64}if(V>0)for(j(oe,U,Y,J),xe=0;xe>>13|V<<3)&8191,C=$[4]&255|($[5]&255)<<8,this.r[2]=(V>>>10|C<<6)&7939,Y=$[6]&255|($[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,U=$[8]&255|($[9]&255)<<8,this.r[4]=(Y>>>4|U<<12)&255,this.r[5]=U>>>1&8190,oe=$[10]&255|($[11]&255)<<8,this.r[6]=(U>>>14|oe<<2)&8191,pe=$[12]&255|($[13]&255)<<8,this.r[7]=(oe>>>11|pe<<5)&8065,xe=$[14]&255|($[15]&255)<<8,this.r[8]=(pe>>>8|xe<<8)&8191,this.r[9]=xe>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};G.prototype.blocks=function($,W,V){for(var C=this.fin?0:2048,Y,U,oe,pe,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Ae=this.h[3],Pe=this.h[4],Ge=this.h[5],je=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],de=this.r[3],nr=this.r[4],dr=this.r[5],pr=this.r[6],Qt=this.r[7],gr=this.r[8],lr=this.r[9];V>=16;)Y=$[W+0]&255|($[W+1]&255)<<8,wt+=Y&8191,U=$[W+2]&255|($[W+3]&255)<<8,lt+=(Y>>>13|U<<3)&8191,oe=$[W+4]&255|($[W+5]&255)<<8,at+=(U>>>10|oe<<6)&8191,pe=$[W+6]&255|($[W+7]&255)<<8,Ae+=(oe>>>7|pe<<9)&8191,xe=$[W+8]&255|($[W+9]&255)<<8,Pe+=(pe>>>4|xe<<12)&8191,Ge+=xe>>>1&8191,Re=$[W+10]&255|($[W+11]&255)<<8,je+=(xe>>>14|Re<<2)&8191,De=$[W+12]&255|($[W+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=$[W+14]&255|($[W+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,Ue=0,gt=Ue,gt+=wt*Wt,gt+=lt*(5*lr),gt+=at*(5*gr),gt+=Ae*(5*Qt),gt+=Pe*(5*pr),Ue=gt>>>13,gt&=8191,gt+=Ge*(5*dr),gt+=je*(5*nr),gt+=qe*(5*de),gt+=Xe*(5*Kt),gt+=kt*(5*Zt),Ue+=gt>>>13,gt&=8191,st=Ue,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Ae*(5*gr),st+=Pe*(5*Qt),Ue=st>>>13,st&=8191,st+=Ge*(5*pr),st+=je*(5*dr),st+=qe*(5*nr),st+=Xe*(5*de),st+=kt*(5*Kt),Ue+=st>>>13,st&=8191,tt=Ue,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Ae*(5*lr),tt+=Pe*(5*gr),Ue=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=je*(5*pr),tt+=qe*(5*dr),tt+=Xe*(5*nr),tt+=kt*(5*de),Ue+=tt>>>13,tt&=8191,At=Ue,At+=wt*de,At+=lt*Kt,At+=at*Zt,At+=Ae*Wt,At+=Pe*(5*lr),Ue=At>>>13,At&=8191,At+=Ge*(5*gr),At+=je*(5*Qt),At+=qe*(5*pr),At+=Xe*(5*dr),At+=kt*(5*nr),Ue+=At>>>13,At&=8191,Rt=Ue,Rt+=wt*nr,Rt+=lt*de,Rt+=at*Kt,Rt+=Ae*Zt,Rt+=Pe*Wt,Ue=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=je*(5*gr),Rt+=qe*(5*Qt),Rt+=Xe*(5*pr),Rt+=kt*(5*dr),Ue+=Rt>>>13,Rt&=8191,Mt=Ue,Mt+=wt*dr,Mt+=lt*nr,Mt+=at*de,Mt+=Ae*Kt,Mt+=Pe*Zt,Ue=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=je*(5*lr),Mt+=qe*(5*gr),Mt+=Xe*(5*Qt),Mt+=kt*(5*pr),Ue+=Mt>>>13,Mt&=8191,Et=Ue,Et+=wt*pr,Et+=lt*dr,Et+=at*nr,Et+=Ae*de,Et+=Pe*Kt,Ue=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=je*Wt,Et+=qe*(5*lr),Et+=Xe*(5*gr),Et+=kt*(5*Qt),Ue+=Et>>>13,Et&=8191,dt=Ue,dt+=wt*Qt,dt+=lt*pr,dt+=at*dr,dt+=Ae*nr,dt+=Pe*de,Ue=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=je*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*gr),Ue+=dt>>>13,dt&=8191,_t=Ue,_t+=wt*gr,_t+=lt*Qt,_t+=at*pr,_t+=Ae*dr,_t+=Pe*nr,Ue=_t>>>13,_t&=8191,_t+=Ge*de,_t+=je*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),Ue+=_t>>>13,_t&=8191,ot=Ue,ot+=wt*lr,ot+=lt*gr,ot+=at*Qt,ot+=Ae*pr,ot+=Pe*dr,Ue=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=je*de,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,Ue+=ot>>>13,ot&=8191,Ue=(Ue<<2)+Ue|0,Ue=Ue+gt|0,gt=Ue&8191,Ue=Ue>>>13,st+=Ue,wt=gt,lt=st,at=tt,Ae=At,Pe=Rt,Ge=Mt,je=Et,qe=dt,Xe=_t,kt=ot,W+=16,V-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Ae,this.h[4]=Pe,this.h[5]=Ge,this.h[6]=je,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},G.prototype.finish=function($,W){var V=new Uint16Array(10),C,Y,U,oe;if(this.leftover){for(oe=this.leftover,this.buffer[oe++]=1;oe<16;oe++)this.buffer[oe]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,oe=2;oe<10;oe++)this.h[oe]+=C,C=this.h[oe]>>>13,this.h[oe]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,V[0]=this.h[0]+5,C=V[0]>>>13,V[0]&=8191,oe=1;oe<10;oe++)V[oe]=this.h[oe]+C,C=V[oe]>>>13,V[oe]&=8191;for(V[9]-=8192,Y=(C^1)-1,oe=0;oe<10;oe++)V[oe]&=Y;for(Y=~Y,oe=0;oe<10;oe++)this.h[oe]=this.h[oe]&Y|V[oe];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,U=this.h[0]+this.pad[0],this.h[0]=U&65535,oe=1;oe<8;oe++)U=(this.h[oe]+this.pad[oe]|0)+(U>>>16)|0,this.h[oe]=U&65535;$[W+0]=this.h[0]>>>0&255,$[W+1]=this.h[0]>>>8&255,$[W+2]=this.h[1]>>>0&255,$[W+3]=this.h[1]>>>8&255,$[W+4]=this.h[2]>>>0&255,$[W+5]=this.h[2]>>>8&255,$[W+6]=this.h[3]>>>0&255,$[W+7]=this.h[3]>>>8&255,$[W+8]=this.h[4]>>>0&255,$[W+9]=this.h[4]>>>8&255,$[W+10]=this.h[5]>>>0&255,$[W+11]=this.h[5]>>>8&255,$[W+12]=this.h[6]>>>0&255,$[W+13]=this.h[6]>>>8&255,$[W+14]=this.h[7]>>>0&255,$[W+15]=this.h[7]>>>8&255},G.prototype.update=function($,W,V){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>V&&(Y=V),C=0;C=16&&(Y=V-V%16,this.blocks($,W,Y),W+=Y,V-=Y),V){for(C=0;C>16&1),U[V-1]&=65535;U[15]=oe[15]-32767-(U[14]>>16&1),Y=U[15]>>16&1,U[14]&=65535,_(oe,U,1-Y)}for(V=0;V<16;V++)$[2*V]=oe[V]&255,$[2*V+1]=oe[V]>>8}function b($,W){var V=new Uint8Array(32),C=new Uint8Array(32);return S(V,$),S(C,W),k(V,0,C,0)}function M($){var W=new Uint8Array(32);return S(W,$),W[0]&1}function I($,W){var V;for(V=0;V<16;V++)$[V]=W[2*V]+(W[2*V+1]<<8);$[15]&=32767}function F($,W,V){for(var C=0;C<16;C++)$[C]=W[C]+V[C]}function ae($,W,V){for(var C=0;C<16;C++)$[C]=W[C]-V[C]}function O($,W,V){var C,Y,U=0,oe=0,pe=0,xe=0,Re=0,De=0,it=0,Ue=0,gt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Ae=0,Pe=0,Ge=0,je=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,de=V[0],nr=V[1],dr=V[2],pr=V[3],Qt=V[4],gr=V[5],lr=V[6],Lr=V[7],mr=V[8],wr=V[9],Br=V[10],$r=V[11],Ir=V[12],hn=V[13],dn=V[14],pn=V[15];C=W[0],U+=C*de,oe+=C*nr,pe+=C*dr,xe+=C*pr,Re+=C*Qt,De+=C*gr,it+=C*lr,Ue+=C*Lr,gt+=C*mr,st+=C*wr,tt+=C*Br,At+=C*$r,Rt+=C*Ir,Mt+=C*hn,Et+=C*dn,dt+=C*pn,C=W[1],oe+=C*de,pe+=C*nr,xe+=C*dr,Re+=C*pr,De+=C*Qt,it+=C*gr,Ue+=C*lr,gt+=C*Lr,st+=C*mr,tt+=C*wr,At+=C*Br,Rt+=C*$r,Mt+=C*Ir,Et+=C*hn,dt+=C*dn,_t+=C*pn,C=W[2],pe+=C*de,xe+=C*nr,Re+=C*dr,De+=C*pr,it+=C*Qt,Ue+=C*gr,gt+=C*lr,st+=C*Lr,tt+=C*mr,At+=C*wr,Rt+=C*Br,Mt+=C*$r,Et+=C*Ir,dt+=C*hn,_t+=C*dn,ot+=C*pn,C=W[3],xe+=C*de,Re+=C*nr,De+=C*dr,it+=C*pr,Ue+=C*Qt,gt+=C*gr,st+=C*lr,tt+=C*Lr,At+=C*mr,Rt+=C*wr,Mt+=C*Br,Et+=C*$r,dt+=C*Ir,_t+=C*hn,ot+=C*dn,wt+=C*pn,C=W[4],Re+=C*de,De+=C*nr,it+=C*dr,Ue+=C*pr,gt+=C*Qt,st+=C*gr,tt+=C*lr,At+=C*Lr,Rt+=C*mr,Mt+=C*wr,Et+=C*Br,dt+=C*$r,_t+=C*Ir,ot+=C*hn,wt+=C*dn,lt+=C*pn,C=W[5],De+=C*de,it+=C*nr,Ue+=C*dr,gt+=C*pr,st+=C*Qt,tt+=C*gr,At+=C*lr,Rt+=C*Lr,Mt+=C*mr,Et+=C*wr,dt+=C*Br,_t+=C*$r,ot+=C*Ir,wt+=C*hn,lt+=C*dn,at+=C*pn,C=W[6],it+=C*de,Ue+=C*nr,gt+=C*dr,st+=C*pr,tt+=C*Qt,At+=C*gr,Rt+=C*lr,Mt+=C*Lr,Et+=C*mr,dt+=C*wr,_t+=C*Br,ot+=C*$r,wt+=C*Ir,lt+=C*hn,at+=C*dn,Ae+=C*pn,C=W[7],Ue+=C*de,gt+=C*nr,st+=C*dr,tt+=C*pr,At+=C*Qt,Rt+=C*gr,Mt+=C*lr,Et+=C*Lr,dt+=C*mr,_t+=C*wr,ot+=C*Br,wt+=C*$r,lt+=C*Ir,at+=C*hn,Ae+=C*dn,Pe+=C*pn,C=W[8],gt+=C*de,st+=C*nr,tt+=C*dr,At+=C*pr,Rt+=C*Qt,Mt+=C*gr,Et+=C*lr,dt+=C*Lr,_t+=C*mr,ot+=C*wr,wt+=C*Br,lt+=C*$r,at+=C*Ir,Ae+=C*hn,Pe+=C*dn,Ge+=C*pn,C=W[9],st+=C*de,tt+=C*nr,At+=C*dr,Rt+=C*pr,Mt+=C*Qt,Et+=C*gr,dt+=C*lr,_t+=C*Lr,ot+=C*mr,wt+=C*wr,lt+=C*Br,at+=C*$r,Ae+=C*Ir,Pe+=C*hn,Ge+=C*dn,je+=C*pn,C=W[10],tt+=C*de,At+=C*nr,Rt+=C*dr,Mt+=C*pr,Et+=C*Qt,dt+=C*gr,_t+=C*lr,ot+=C*Lr,wt+=C*mr,lt+=C*wr,at+=C*Br,Ae+=C*$r,Pe+=C*Ir,Ge+=C*hn,je+=C*dn,qe+=C*pn,C=W[11],At+=C*de,Rt+=C*nr,Mt+=C*dr,Et+=C*pr,dt+=C*Qt,_t+=C*gr,ot+=C*lr,wt+=C*Lr,lt+=C*mr,at+=C*wr,Ae+=C*Br,Pe+=C*$r,Ge+=C*Ir,je+=C*hn,qe+=C*dn,Xe+=C*pn,C=W[12],Rt+=C*de,Mt+=C*nr,Et+=C*dr,dt+=C*pr,_t+=C*Qt,ot+=C*gr,wt+=C*lr,lt+=C*Lr,at+=C*mr,Ae+=C*wr,Pe+=C*Br,Ge+=C*$r,je+=C*Ir,qe+=C*hn,Xe+=C*dn,kt+=C*pn,C=W[13],Mt+=C*de,Et+=C*nr,dt+=C*dr,_t+=C*pr,ot+=C*Qt,wt+=C*gr,lt+=C*lr,at+=C*Lr,Ae+=C*mr,Pe+=C*wr,Ge+=C*Br,je+=C*$r,qe+=C*Ir,Xe+=C*hn,kt+=C*dn,Wt+=C*pn,C=W[14],Et+=C*de,dt+=C*nr,_t+=C*dr,ot+=C*pr,wt+=C*Qt,lt+=C*gr,at+=C*lr,Ae+=C*Lr,Pe+=C*mr,Ge+=C*wr,je+=C*Br,qe+=C*$r,Xe+=C*Ir,kt+=C*hn,Wt+=C*dn,Zt+=C*pn,C=W[15],dt+=C*de,_t+=C*nr,ot+=C*dr,wt+=C*pr,lt+=C*Qt,at+=C*gr,Ae+=C*lr,Pe+=C*Lr,Ge+=C*mr,je+=C*wr,qe+=C*Br,Xe+=C*$r,kt+=C*Ir,Wt+=C*hn,Zt+=C*dn,Kt+=C*pn,U+=38*_t,oe+=38*ot,pe+=38*wt,xe+=38*lt,Re+=38*at,De+=38*Ae,it+=38*Pe,Ue+=38*Ge,gt+=38*je,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=U+Y+65535,Y=Math.floor(C/65536),U=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,U+=Y-1+37*(Y-1),Y=1,C=U+Y+65535,Y=Math.floor(C/65536),U=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,U+=Y-1+37*(Y-1),$[0]=U,$[1]=oe,$[2]=pe,$[3]=xe,$[4]=Re,$[5]=De,$[6]=it,$[7]=Ue,$[8]=gt,$[9]=st,$[10]=tt,$[11]=At,$[12]=Rt,$[13]=Mt,$[14]=Et,$[15]=dt}function se($,W){O($,W,W)}function ee($,W){var V=r(),C;for(C=0;C<16;C++)V[C]=W[C];for(C=253;C>=0;C--)se(V,V),C!==2&&C!==4&&O(V,V,W);for(C=0;C<16;C++)$[C]=V[C]}function X($,W){var V=r(),C;for(C=0;C<16;C++)V[C]=W[C];for(C=250;C>=0;C--)se(V,V),C!==1&&O(V,V,W);for(C=0;C<16;C++)$[C]=V[C]}function Q($,W,V){var C=new Uint8Array(32),Y=new Float64Array(80),U,oe,pe=r(),xe=r(),Re=r(),De=r(),it=r(),Ue=r();for(oe=0;oe<31;oe++)C[oe]=W[oe];for(C[31]=W[31]&127|64,C[0]&=248,I(Y,V),oe=0;oe<16;oe++)xe[oe]=Y[oe],De[oe]=pe[oe]=Re[oe]=0;for(pe[0]=De[0]=1,oe=254;oe>=0;--oe)U=C[oe>>>3]>>>(oe&7)&1,_(pe,xe,U),_(Re,De,U),F(it,pe,Re),ae(pe,pe,Re),F(Re,xe,De),ae(xe,xe,De),se(De,it),se(Ue,pe),O(pe,Re,pe),O(Re,xe,it),F(it,pe,Re),ae(pe,pe,Re),se(xe,pe),ae(Re,De,Ue),O(pe,Re,u),F(pe,pe,De),O(Re,Re,pe),O(pe,De,Ue),O(De,xe,Y),se(xe,it),_(pe,xe,U),_(Re,De,U);for(oe=0;oe<16;oe++)Y[oe+16]=pe[oe],Y[oe+32]=Re[oe],Y[oe+48]=xe[oe],Y[oe+64]=De[oe];var gt=Y.subarray(32),st=Y.subarray(16);return ee(gt,gt),O(st,st,gt),S($,st),0}function R($,W){return Q($,W,s)}function Z($,W){return n(W,32),R($,W)}function te($,W,V){var C=new Uint8Array(32);return Q(C,V,W),H($,i,C,J)}var le=f,ie=g;function fe($,W,V,C,Y,U){var oe=new Uint8Array(32);return te(oe,Y,U),le($,W,V,C,oe)}function ve($,W,V,C,Y,U){var oe=new Uint8Array(32);return te(oe,Y,U),ie($,W,V,C,oe)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne($,W,V,C){for(var Y=new Int32Array(16),U=new Int32Array(16),oe,pe,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Ae,Pe,Ge,je,qe,Xe,kt=$[0],Wt=$[1],Zt=$[2],Kt=$[3],de=$[4],nr=$[5],dr=$[6],pr=$[7],Qt=W[0],gr=W[1],lr=W[2],Lr=W[3],mr=W[4],wr=W[5],Br=W[6],$r=W[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=V[at+0]<<24|V[at+1]<<16|V[at+2]<<8|V[at+3],U[lt]=V[at+4]<<24|V[at+5]<<16|V[at+6]<<8|V[at+7];for(lt=0;lt<80;lt++)if(oe=kt,pe=Wt,xe=Zt,Re=Kt,De=de,it=nr,Ue=dr,gt=pr,st=Qt,tt=gr,At=lr,Rt=Lr,Mt=mr,Et=wr,dt=Br,_t=$r,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(de>>>14|mr<<18)^(de>>>18|mr<<14)^(mr>>>9|de<<23),Pe=(mr>>>14|de<<18)^(mr>>>18|de<<14)^(de>>>9|mr<<23),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=de&nr^~de&dr,Pe=mr&wr^~mr&Br,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Me[lt*2],Pe=Me[lt*2+1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Y[lt%16],Pe=U[lt%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|je<<16,Ae=ot,Pe=wt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Pe=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=kt&Wt^kt&Zt^Wt&Zt,Pe=Qt&gr^Qt&lr^gr&lr,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,gt=qe&65535|Xe<<16,_t=Ge&65535|je<<16,Ae=Re,Pe=Rt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=ot,Pe=wt,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|je<<16,Wt=oe,Zt=pe,Kt=xe,de=Re,nr=De,dr=it,pr=Ue,kt=gt,gr=st,lr=tt,Lr=At,mr=Rt,wr=Mt,Br=Et,$r=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Ae=Y[at],Pe=U[at],Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=Y[(at+9)%16],Pe=U[(at+9)%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+1)%16],wt=U[(at+1)%16],Ae=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Pe=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+14)%16],wt=U[(at+14)%16],Ae=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Pe=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,U[at]=Ge&65535|je<<16;Ae=kt,Pe=Qt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[0],Pe=W[0],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[0]=kt=qe&65535|Xe<<16,W[0]=Qt=Ge&65535|je<<16,Ae=Wt,Pe=gr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[1],Pe=W[1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[1]=Wt=qe&65535|Xe<<16,W[1]=gr=Ge&65535|je<<16,Ae=Zt,Pe=lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[2],Pe=W[2],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[2]=Zt=qe&65535|Xe<<16,W[2]=lr=Ge&65535|je<<16,Ae=Kt,Pe=Lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[3],Pe=W[3],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[3]=Kt=qe&65535|Xe<<16,W[3]=Lr=Ge&65535|je<<16,Ae=de,Pe=mr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[4],Pe=W[4],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[4]=de=qe&65535|Xe<<16,W[4]=mr=Ge&65535|je<<16,Ae=nr,Pe=wr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[5],Pe=W[5],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[5]=nr=qe&65535|Xe<<16,W[5]=wr=Ge&65535|je<<16,Ae=dr,Pe=Br,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[6],Pe=W[6],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[6]=dr=qe&65535|Xe<<16,W[6]=Br=Ge&65535|je<<16,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[7],Pe=W[7],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[7]=pr=qe&65535|Xe<<16,W[7]=$r=Ge&65535|je<<16,Ir+=128,C-=128}return C}function Te($,W,V){var C=new Int32Array(8),Y=new Int32Array(8),U=new Uint8Array(256),oe,pe=V;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,W,V),V%=128,oe=0;oe=0;--Y)C=V[Y/8|0]>>(Y&7)&1,Ie($,W,C),$e(W,$),$e($,$),Ie($,W,C)}function ke($,W){var V=[r(),r(),r(),r()];v(V[0],p),v(V[1],y),v(V[2],a),O(V[3],p,y),Ve($,V,W)}function ze($,W,V){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],U;for(V||n(W,32),Te(C,W,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le($,Y),U=0;U<32;U++)W[U+32]=$[U];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Se($,W){var V,C,Y,U;for(C=63;C>=32;--C){for(V=0,Y=C-32,U=C-12;Y>4)*He[Y],V=W[Y]>>8,W[Y]&=255;for(Y=0;Y<32;Y++)W[Y]-=V*He[Y];for(C=0;C<32;C++)W[C+1]+=W[C]>>8,$[C]=W[C]&255}function Qe($){var W=new Float64Array(64),V;for(V=0;V<64;V++)W[V]=$[V];for(V=0;V<64;V++)$[V]=0;Se($,W)}function ct($,W,V,C){var Y=new Uint8Array(64),U=new Uint8Array(64),oe=new Uint8Array(64),pe,xe,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=V+64;for(pe=0;pe>7&&ae($[0],o,$[0]),O($[3],$[0],$[1]),0)}function et($,W,V,C){var Y,U=new Uint8Array(32),oe=new Uint8Array(64),pe=[r(),r(),r(),r()],xe=[r(),r(),r(),r()];if(V<64||Be(xe,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var $=new Uint8Array(vt),W=new Uint8Array(Dt);return ze($,W),{publicKey:$,secretKey:W}},e.sign.keyPair.fromSecretKey=function($){if(nt($),$.length!==Dt)throw new Error("bad secret key size");for(var W=new Uint8Array(vt),V=0;V=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function Tb(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function Y0(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{o(ce),u(!1),y("scan")}),m.on("error",ce=>{console.log(ce)}),m.on("session_update",ce=>{console.log("session_update",ce)}),!await m.connect(yZ))throw new Error("Walletconnect init failed");const S=new ru(m);O(((f=S.config)==null?void 0:f.image)||((g=E.config)==null?void 0:g.image));const b=await S.getAddress(),M=await va.getNonce({account_type:"block_chain"});console.log("get nonce",M);const I=wZ(b,M);y("sign");const F=await S.signMessage(I,b);y("waiting"),await i(S,{message:I,nonce:M,signature:F,address:b,wallet_name:((v=S.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),B(S)}catch(_){console.log("err",_),d(_.details||_.message)}}function j(){A.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),A.current.append(e.current)}function H(E){var m;console.log(A.current),(m=A.current)==null||m.update({data:E})}Se.useEffect(()=>{s&&H(s)},[s]),Se.useEffect(()=>{q(r)},[r]),Se.useEffect(()=>{j()},[]);function J(){d(""),H(""),q(r)}function T(){k(!0),navigator.clipboard.writeText(s),setTimeout(()=>{k(!1)},2500)}function z(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return de.jsxs("div",{children:[de.jsx("div",{className:"xc-text-center",children:de.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[de.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),de.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?de.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):de.jsx("img",{className:"xc-h-10 xc-w-10",src:P})})]})}),de.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[de.jsx("button",{disabled:!s,onClick:T,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:D?de.jsxs(de.Fragment,{children:[" ",de.jsx(LK,{})," Copied!"]}):de.jsxs(de.Fragment,{children:[de.jsx($K,{}),"Copy QR URL"]})}),((_e=r.config)==null?void 0:_e.getWallet)&&de.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[de.jsx(kK,{}),"Get Extension"]}),((G=r.config)==null?void 0:G.desktop_link)&&de.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:z,children:[de.jsx(f8,{}),"Desktop"]})]}),de.jsx("div",{className:"xc-text-center",children:l?de.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[de.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),de.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:J,children:"Retry"})]}):de.jsxs(de.Fragment,{children:[p==="scan"&&de.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),p==="connect"&&de.jsx("p",{children:"Click connect in your wallet app"}),p==="sign"&&de.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),p==="waiting"&&de.jsx("div",{className:"xc-text-center",children:de.jsx(vc,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const xZ="Accept connection request in the wallet",_Z="Accept sign-in request in your wallet";function EZ(t,e){const r=window.location.host,n=window.location.href;return A7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function I7(t){var p;const[e,r]=Se.useState(),{wallet:n,onSignFinish:i}=t,s=Se.useRef(),[o,a]=Se.useState("connect"),{saveLastUsedWallet:u}=Kl();async function l(y){var A;try{a("connect");const P=await n.connect();if(!P||P.length===0)throw new Error("Wallet connect error");const O=og(P[0]),D=EZ(O,y);a("sign");const k=await n.signMessage(D,O);if(!k||k.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:O,signature:k,message:D,nonce:y,wallet_name:((A=n.config)==null?void 0:A.name)||""}),u(n)}catch(P){console.log(P.details),r(P.details||P.message)}}async function d(){try{r("");const y=await va.getNonce({account_type:"block_chain"});s.current=y,l(s.current)}catch(y){console.log(y.details),r(y.message)}}return Se.useEffect(()=>{d()},[]),de.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[de.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(p=n.config)==null?void 0:p.image,alt:""}),e&&de.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[de.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),de.jsx("div",{className:"xc-flex xc-gap-2",children:de.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:d,children:"Retry"})})]}),!e&&de.jsxs(de.Fragment,{children:[o==="connect"&&de.jsx("span",{className:"xc-text-center",children:xZ}),o==="sign"&&de.jsx("span",{className:"xc-text-center",children:_Z}),o==="waiting"&&de.jsx("span",{className:"xc-text-center",children:de.jsx(vc,{className:"xc-animate-spin"})})]})]})}const Gu="https://static.codatta.io/codatta-connect/wallet-icons.svg",SZ="https://itunes.apple.com/app/",AZ="https://play.google.com/store/apps/details?id=",PZ="https://chromewebstore.google.com/detail/",MZ="https://chromewebstore.google.com/detail/",IZ="https://addons.mozilla.org/en-US/firefox/addon/",CZ="https://microsoftedge.microsoft.com/addons/detail/";function Yu(t){const{icon:e,title:r,link:n}=t;return de.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[de.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,de.jsx(u8,{className:"xc-ml-auto xc-text-gray-400"})]})}function TZ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${SZ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${AZ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${PZ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${MZ}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${IZ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${CZ}${t.edge_addon_id}`),e}function C7(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=TZ(r);return de.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[de.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),de.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),de.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),de.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&de.jsx(Yu,{link:n.chromeStoreLink,icon:`${Gu}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&de.jsx(Yu,{link:n.appStoreLink,icon:`${Gu}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&de.jsx(Yu,{link:n.playStoreLink,icon:`${Gu}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&de.jsx(Yu,{link:n.edgeStoreLink,icon:`${Gu}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&de.jsx(Yu,{link:n.braveStoreLink,icon:`${Gu}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&de.jsx(Yu,{link:n.firefoxStoreLink,icon:`${Gu}#firefox`,title:"Mozilla Firefox"})]})]})}function RZ(t){const{wallet:e}=t,[r,n]=Se.useState(e.installed?"connect":"qr"),i=Ib();async function s(o,a){var l;const u=await va.walletLogin({account_type:"block_chain",account_enum:i.role,connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return de.jsxs(Ss,{children:[de.jsx("div",{className:"xc-mb-6",children:de.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&de.jsx(M7,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&de.jsx(I7,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&de.jsx(C7,{wallet:e})]})}function DZ(t){const{wallet:e,onClick:r}=t,n=de.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return de.jsx(Sb,{icon:n,title:i,onClick:()=>r(e)})}function T7(t){const{connector:e}=t,[r,n]=Se.useState(),[i,s]=Se.useState([]),o=Se.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d)}Se.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return de.jsxs(Ss,{children:[de.jsx("div",{className:"xc-mb-6",children:de.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),de.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[de.jsx(l8,{className:"xc-shrink-0 xc-opacity-50"}),de.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),de.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>de.jsx(DZ,{wallet:d,onClick:l},d.name))})]})}var R7={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,$[W+1]=V>>16&255,$[W+2]=V>>8&255,$[W+3]=V&255,$[W+4]=C>>24&255,$[W+5]=C>>16&255,$[W+6]=C>>8&255,$[W+7]=C&255}function O($,W,V,C,Y){var U,oe=0;for(U=0;U>>8)-1}function D($,W,V,C){return O($,W,V,C,16)}function k($,W,V,C){return O($,W,V,C,32)}function B($,W,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,U=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,ge=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=W[0]&255|(W[1]&255)<<8|(W[2]&255)<<16|(W[3]&255)<<24,it=W[4]&255|(W[5]&255)<<8|(W[6]&255)<<16|(W[7]&255)<<24,Ue=W[8]&255|(W[9]&255)<<8|(W[10]&255)<<16|(W[11]&255)<<24,gt=W[12]&255|(W[13]&255)<<8|(W[14]&255)<<16|(W[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=U,ot=oe,wt=ge,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,pe,nr=0;nr<20;nr+=2)pe=dt+kt|0,lt^=pe<<7|pe>>>25,pe=lt+dt|0,Ge^=pe<<9|pe>>>23,pe=Ge+lt|0,kt^=pe<<13|pe>>>19,pe=kt+Ge|0,dt^=pe<<18|pe>>>14,pe=at+_t|0,je^=pe<<7|pe>>>25,pe=je+at|0,Wt^=pe<<9|pe>>>23,pe=Wt+je|0,_t^=pe<<13|pe>>>19,pe=_t+Wt|0,at^=pe<<18|pe>>>14,pe=qe+Ae|0,Zt^=pe<<7|pe>>>25,pe=Zt+qe|0,ot^=pe<<9|pe>>>23,pe=ot+Zt|0,Ae^=pe<<13|pe>>>19,pe=Ae+ot|0,qe^=pe<<18|pe>>>14,pe=Kt+Xe|0,wt^=pe<<7|pe>>>25,pe=wt+Kt|0,Pe^=pe<<9|pe>>>23,pe=Pe+wt|0,Xe^=pe<<13|pe>>>19,pe=Xe+Pe|0,Kt^=pe<<18|pe>>>14,pe=dt+wt|0,_t^=pe<<7|pe>>>25,pe=_t+dt|0,ot^=pe<<9|pe>>>23,pe=ot+_t|0,wt^=pe<<13|pe>>>19,pe=wt+ot|0,dt^=pe<<18|pe>>>14,pe=at+lt|0,Ae^=pe<<7|pe>>>25,pe=Ae+at|0,Pe^=pe<<9|pe>>>23,pe=Pe+Ae|0,lt^=pe<<13|pe>>>19,pe=lt+Pe|0,at^=pe<<18|pe>>>14,pe=qe+je|0,Xe^=pe<<7|pe>>>25,pe=Xe+qe|0,Ge^=pe<<9|pe>>>23,pe=Ge+Xe|0,je^=pe<<13|pe>>>19,pe=je+Ge|0,qe^=pe<<18|pe>>>14,pe=Kt+Zt|0,kt^=pe<<7|pe>>>25,pe=kt+Kt|0,Wt^=pe<<9|pe>>>23,pe=Wt+kt|0,Zt^=pe<<13|pe>>>19,pe=Zt+Wt|0,Kt^=pe<<18|pe>>>14;dt=dt+Y|0,_t=_t+U|0,ot=ot+oe|0,wt=wt+ge|0,lt=lt+xe|0,at=at+Re|0,Ae=Ae+De|0,Pe=Pe+it|0,Ge=Ge+Ue|0,je=je+gt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=_t>>>0&255,$[5]=_t>>>8&255,$[6]=_t>>>16&255,$[7]=_t>>>24&255,$[8]=ot>>>0&255,$[9]=ot>>>8&255,$[10]=ot>>>16&255,$[11]=ot>>>24&255,$[12]=wt>>>0&255,$[13]=wt>>>8&255,$[14]=wt>>>16&255,$[15]=wt>>>24&255,$[16]=lt>>>0&255,$[17]=lt>>>8&255,$[18]=lt>>>16&255,$[19]=lt>>>24&255,$[20]=at>>>0&255,$[21]=at>>>8&255,$[22]=at>>>16&255,$[23]=at>>>24&255,$[24]=Ae>>>0&255,$[25]=Ae>>>8&255,$[26]=Ae>>>16&255,$[27]=Ae>>>24&255,$[28]=Pe>>>0&255,$[29]=Pe>>>8&255,$[30]=Pe>>>16&255,$[31]=Pe>>>24&255,$[32]=Ge>>>0&255,$[33]=Ge>>>8&255,$[34]=Ge>>>16&255,$[35]=Ge>>>24&255,$[36]=je>>>0&255,$[37]=je>>>8&255,$[38]=je>>>16&255,$[39]=je>>>24&255,$[40]=qe>>>0&255,$[41]=qe>>>8&255,$[42]=qe>>>16&255,$[43]=qe>>>24&255,$[44]=Xe>>>0&255,$[45]=Xe>>>8&255,$[46]=Xe>>>16&255,$[47]=Xe>>>24&255,$[48]=kt>>>0&255,$[49]=kt>>>8&255,$[50]=kt>>>16&255,$[51]=kt>>>24&255,$[52]=Wt>>>0&255,$[53]=Wt>>>8&255,$[54]=Wt>>>16&255,$[55]=Wt>>>24&255,$[56]=Zt>>>0&255,$[57]=Zt>>>8&255,$[58]=Zt>>>16&255,$[59]=Zt>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255}function q($,W,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,U=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,ge=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=W[0]&255|(W[1]&255)<<8|(W[2]&255)<<16|(W[3]&255)<<24,it=W[4]&255|(W[5]&255)<<8|(W[6]&255)<<16|(W[7]&255)<<24,Ue=W[8]&255|(W[9]&255)<<8|(W[10]&255)<<16|(W[11]&255)<<24,gt=W[12]&255|(W[13]&255)<<8|(W[14]&255)<<16|(W[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=U,ot=oe,wt=ge,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,pe,nr=0;nr<20;nr+=2)pe=dt+kt|0,lt^=pe<<7|pe>>>25,pe=lt+dt|0,Ge^=pe<<9|pe>>>23,pe=Ge+lt|0,kt^=pe<<13|pe>>>19,pe=kt+Ge|0,dt^=pe<<18|pe>>>14,pe=at+_t|0,je^=pe<<7|pe>>>25,pe=je+at|0,Wt^=pe<<9|pe>>>23,pe=Wt+je|0,_t^=pe<<13|pe>>>19,pe=_t+Wt|0,at^=pe<<18|pe>>>14,pe=qe+Ae|0,Zt^=pe<<7|pe>>>25,pe=Zt+qe|0,ot^=pe<<9|pe>>>23,pe=ot+Zt|0,Ae^=pe<<13|pe>>>19,pe=Ae+ot|0,qe^=pe<<18|pe>>>14,pe=Kt+Xe|0,wt^=pe<<7|pe>>>25,pe=wt+Kt|0,Pe^=pe<<9|pe>>>23,pe=Pe+wt|0,Xe^=pe<<13|pe>>>19,pe=Xe+Pe|0,Kt^=pe<<18|pe>>>14,pe=dt+wt|0,_t^=pe<<7|pe>>>25,pe=_t+dt|0,ot^=pe<<9|pe>>>23,pe=ot+_t|0,wt^=pe<<13|pe>>>19,pe=wt+ot|0,dt^=pe<<18|pe>>>14,pe=at+lt|0,Ae^=pe<<7|pe>>>25,pe=Ae+at|0,Pe^=pe<<9|pe>>>23,pe=Pe+Ae|0,lt^=pe<<13|pe>>>19,pe=lt+Pe|0,at^=pe<<18|pe>>>14,pe=qe+je|0,Xe^=pe<<7|pe>>>25,pe=Xe+qe|0,Ge^=pe<<9|pe>>>23,pe=Ge+Xe|0,je^=pe<<13|pe>>>19,pe=je+Ge|0,qe^=pe<<18|pe>>>14,pe=Kt+Zt|0,kt^=pe<<7|pe>>>25,pe=kt+Kt|0,Wt^=pe<<9|pe>>>23,pe=Wt+kt|0,Zt^=pe<<13|pe>>>19,pe=Zt+Wt|0,Kt^=pe<<18|pe>>>14;$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=at>>>0&255,$[5]=at>>>8&255,$[6]=at>>>16&255,$[7]=at>>>24&255,$[8]=qe>>>0&255,$[9]=qe>>>8&255,$[10]=qe>>>16&255,$[11]=qe>>>24&255,$[12]=Kt>>>0&255,$[13]=Kt>>>8&255,$[14]=Kt>>>16&255,$[15]=Kt>>>24&255,$[16]=Ae>>>0&255,$[17]=Ae>>>8&255,$[18]=Ae>>>16&255,$[19]=Ae>>>24&255,$[20]=Pe>>>0&255,$[21]=Pe>>>8&255,$[22]=Pe>>>16&255,$[23]=Pe>>>24&255,$[24]=Ge>>>0&255,$[25]=Ge>>>8&255,$[26]=Ge>>>16&255,$[27]=Ge>>>24&255,$[28]=je>>>0&255,$[29]=je>>>8&255,$[30]=je>>>16&255,$[31]=je>>>24&255}function j($,W,V,C){B($,W,V,C)}function H($,W,V,C){q($,W,V,C)}var J=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T($,W,V,C,Y,U,oe){var ge=new Uint8Array(16),xe=new Uint8Array(64),Re,De;for(De=0;De<16;De++)ge[De]=0;for(De=0;De<8;De++)ge[De]=U[De];for(;Y>=64;){for(j(xe,ge,oe,J),De=0;De<64;De++)$[W+De]=V[C+De]^xe[De];for(Re=1,De=8;De<16;De++)Re=Re+(ge[De]&255)|0,ge[De]=Re&255,Re>>>=8;Y-=64,W+=64,C+=64}if(Y>0)for(j(xe,ge,oe,J),De=0;De=64;){for(j(oe,U,Y,J),xe=0;xe<64;xe++)$[W+xe]=oe[xe];for(ge=1,xe=8;xe<16;xe++)ge=ge+(U[xe]&255)|0,U[xe]=ge&255,ge>>>=8;V-=64,W+=64}if(V>0)for(j(oe,U,Y,J),xe=0;xe>>13|V<<3)&8191,C=$[4]&255|($[5]&255)<<8,this.r[2]=(V>>>10|C<<6)&7939,Y=$[6]&255|($[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,U=$[8]&255|($[9]&255)<<8,this.r[4]=(Y>>>4|U<<12)&255,this.r[5]=U>>>1&8190,oe=$[10]&255|($[11]&255)<<8,this.r[6]=(U>>>14|oe<<2)&8191,ge=$[12]&255|($[13]&255)<<8,this.r[7]=(oe>>>11|ge<<5)&8065,xe=$[14]&255|($[15]&255)<<8,this.r[8]=(ge>>>8|xe<<8)&8191,this.r[9]=xe>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};G.prototype.blocks=function($,W,V){for(var C=this.fin?0:2048,Y,U,oe,ge,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Ae=this.h[3],Pe=this.h[4],Ge=this.h[5],je=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],pe=this.r[3],nr=this.r[4],dr=this.r[5],pr=this.r[6],Qt=this.r[7],gr=this.r[8],lr=this.r[9];V>=16;)Y=$[W+0]&255|($[W+1]&255)<<8,wt+=Y&8191,U=$[W+2]&255|($[W+3]&255)<<8,lt+=(Y>>>13|U<<3)&8191,oe=$[W+4]&255|($[W+5]&255)<<8,at+=(U>>>10|oe<<6)&8191,ge=$[W+6]&255|($[W+7]&255)<<8,Ae+=(oe>>>7|ge<<9)&8191,xe=$[W+8]&255|($[W+9]&255)<<8,Pe+=(ge>>>4|xe<<12)&8191,Ge+=xe>>>1&8191,Re=$[W+10]&255|($[W+11]&255)<<8,je+=(xe>>>14|Re<<2)&8191,De=$[W+12]&255|($[W+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=$[W+14]&255|($[W+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,Ue=0,gt=Ue,gt+=wt*Wt,gt+=lt*(5*lr),gt+=at*(5*gr),gt+=Ae*(5*Qt),gt+=Pe*(5*pr),Ue=gt>>>13,gt&=8191,gt+=Ge*(5*dr),gt+=je*(5*nr),gt+=qe*(5*pe),gt+=Xe*(5*Kt),gt+=kt*(5*Zt),Ue+=gt>>>13,gt&=8191,st=Ue,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Ae*(5*gr),st+=Pe*(5*Qt),Ue=st>>>13,st&=8191,st+=Ge*(5*pr),st+=je*(5*dr),st+=qe*(5*nr),st+=Xe*(5*pe),st+=kt*(5*Kt),Ue+=st>>>13,st&=8191,tt=Ue,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Ae*(5*lr),tt+=Pe*(5*gr),Ue=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=je*(5*pr),tt+=qe*(5*dr),tt+=Xe*(5*nr),tt+=kt*(5*pe),Ue+=tt>>>13,tt&=8191,At=Ue,At+=wt*pe,At+=lt*Kt,At+=at*Zt,At+=Ae*Wt,At+=Pe*(5*lr),Ue=At>>>13,At&=8191,At+=Ge*(5*gr),At+=je*(5*Qt),At+=qe*(5*pr),At+=Xe*(5*dr),At+=kt*(5*nr),Ue+=At>>>13,At&=8191,Rt=Ue,Rt+=wt*nr,Rt+=lt*pe,Rt+=at*Kt,Rt+=Ae*Zt,Rt+=Pe*Wt,Ue=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=je*(5*gr),Rt+=qe*(5*Qt),Rt+=Xe*(5*pr),Rt+=kt*(5*dr),Ue+=Rt>>>13,Rt&=8191,Mt=Ue,Mt+=wt*dr,Mt+=lt*nr,Mt+=at*pe,Mt+=Ae*Kt,Mt+=Pe*Zt,Ue=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=je*(5*lr),Mt+=qe*(5*gr),Mt+=Xe*(5*Qt),Mt+=kt*(5*pr),Ue+=Mt>>>13,Mt&=8191,Et=Ue,Et+=wt*pr,Et+=lt*dr,Et+=at*nr,Et+=Ae*pe,Et+=Pe*Kt,Ue=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=je*Wt,Et+=qe*(5*lr),Et+=Xe*(5*gr),Et+=kt*(5*Qt),Ue+=Et>>>13,Et&=8191,dt=Ue,dt+=wt*Qt,dt+=lt*pr,dt+=at*dr,dt+=Ae*nr,dt+=Pe*pe,Ue=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=je*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*gr),Ue+=dt>>>13,dt&=8191,_t=Ue,_t+=wt*gr,_t+=lt*Qt,_t+=at*pr,_t+=Ae*dr,_t+=Pe*nr,Ue=_t>>>13,_t&=8191,_t+=Ge*pe,_t+=je*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),Ue+=_t>>>13,_t&=8191,ot=Ue,ot+=wt*lr,ot+=lt*gr,ot+=at*Qt,ot+=Ae*pr,ot+=Pe*dr,Ue=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=je*pe,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,Ue+=ot>>>13,ot&=8191,Ue=(Ue<<2)+Ue|0,Ue=Ue+gt|0,gt=Ue&8191,Ue=Ue>>>13,st+=Ue,wt=gt,lt=st,at=tt,Ae=At,Pe=Rt,Ge=Mt,je=Et,qe=dt,Xe=_t,kt=ot,W+=16,V-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Ae,this.h[4]=Pe,this.h[5]=Ge,this.h[6]=je,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},G.prototype.finish=function($,W){var V=new Uint16Array(10),C,Y,U,oe;if(this.leftover){for(oe=this.leftover,this.buffer[oe++]=1;oe<16;oe++)this.buffer[oe]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,oe=2;oe<10;oe++)this.h[oe]+=C,C=this.h[oe]>>>13,this.h[oe]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,V[0]=this.h[0]+5,C=V[0]>>>13,V[0]&=8191,oe=1;oe<10;oe++)V[oe]=this.h[oe]+C,C=V[oe]>>>13,V[oe]&=8191;for(V[9]-=8192,Y=(C^1)-1,oe=0;oe<10;oe++)V[oe]&=Y;for(Y=~Y,oe=0;oe<10;oe++)this.h[oe]=this.h[oe]&Y|V[oe];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,U=this.h[0]+this.pad[0],this.h[0]=U&65535,oe=1;oe<8;oe++)U=(this.h[oe]+this.pad[oe]|0)+(U>>>16)|0,this.h[oe]=U&65535;$[W+0]=this.h[0]>>>0&255,$[W+1]=this.h[0]>>>8&255,$[W+2]=this.h[1]>>>0&255,$[W+3]=this.h[1]>>>8&255,$[W+4]=this.h[2]>>>0&255,$[W+5]=this.h[2]>>>8&255,$[W+6]=this.h[3]>>>0&255,$[W+7]=this.h[3]>>>8&255,$[W+8]=this.h[4]>>>0&255,$[W+9]=this.h[4]>>>8&255,$[W+10]=this.h[5]>>>0&255,$[W+11]=this.h[5]>>>8&255,$[W+12]=this.h[6]>>>0&255,$[W+13]=this.h[6]>>>8&255,$[W+14]=this.h[7]>>>0&255,$[W+15]=this.h[7]>>>8&255},G.prototype.update=function($,W,V){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>V&&(Y=V),C=0;C=16&&(Y=V-V%16,this.blocks($,W,Y),W+=Y,V-=Y),V){for(C=0;C>16&1),U[V-1]&=65535;U[15]=oe[15]-32767-(U[14]>>16&1),Y=U[15]>>16&1,U[14]&=65535,_(oe,U,1-Y)}for(V=0;V<16;V++)$[2*V]=oe[V]&255,$[2*V+1]=oe[V]>>8}function b($,W){var V=new Uint8Array(32),C=new Uint8Array(32);return S(V,$),S(C,W),k(V,0,C,0)}function M($){var W=new Uint8Array(32);return S(W,$),W[0]&1}function I($,W){var V;for(V=0;V<16;V++)$[V]=W[2*V]+(W[2*V+1]<<8);$[15]&=32767}function F($,W,V){for(var C=0;C<16;C++)$[C]=W[C]+V[C]}function ce($,W,V){for(var C=0;C<16;C++)$[C]=W[C]-V[C]}function N($,W,V){var C,Y,U=0,oe=0,ge=0,xe=0,Re=0,De=0,it=0,Ue=0,gt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Ae=0,Pe=0,Ge=0,je=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,pe=V[0],nr=V[1],dr=V[2],pr=V[3],Qt=V[4],gr=V[5],lr=V[6],Lr=V[7],mr=V[8],wr=V[9],Br=V[10],$r=V[11],Ir=V[12],hn=V[13],dn=V[14],pn=V[15];C=W[0],U+=C*pe,oe+=C*nr,ge+=C*dr,xe+=C*pr,Re+=C*Qt,De+=C*gr,it+=C*lr,Ue+=C*Lr,gt+=C*mr,st+=C*wr,tt+=C*Br,At+=C*$r,Rt+=C*Ir,Mt+=C*hn,Et+=C*dn,dt+=C*pn,C=W[1],oe+=C*pe,ge+=C*nr,xe+=C*dr,Re+=C*pr,De+=C*Qt,it+=C*gr,Ue+=C*lr,gt+=C*Lr,st+=C*mr,tt+=C*wr,At+=C*Br,Rt+=C*$r,Mt+=C*Ir,Et+=C*hn,dt+=C*dn,_t+=C*pn,C=W[2],ge+=C*pe,xe+=C*nr,Re+=C*dr,De+=C*pr,it+=C*Qt,Ue+=C*gr,gt+=C*lr,st+=C*Lr,tt+=C*mr,At+=C*wr,Rt+=C*Br,Mt+=C*$r,Et+=C*Ir,dt+=C*hn,_t+=C*dn,ot+=C*pn,C=W[3],xe+=C*pe,Re+=C*nr,De+=C*dr,it+=C*pr,Ue+=C*Qt,gt+=C*gr,st+=C*lr,tt+=C*Lr,At+=C*mr,Rt+=C*wr,Mt+=C*Br,Et+=C*$r,dt+=C*Ir,_t+=C*hn,ot+=C*dn,wt+=C*pn,C=W[4],Re+=C*pe,De+=C*nr,it+=C*dr,Ue+=C*pr,gt+=C*Qt,st+=C*gr,tt+=C*lr,At+=C*Lr,Rt+=C*mr,Mt+=C*wr,Et+=C*Br,dt+=C*$r,_t+=C*Ir,ot+=C*hn,wt+=C*dn,lt+=C*pn,C=W[5],De+=C*pe,it+=C*nr,Ue+=C*dr,gt+=C*pr,st+=C*Qt,tt+=C*gr,At+=C*lr,Rt+=C*Lr,Mt+=C*mr,Et+=C*wr,dt+=C*Br,_t+=C*$r,ot+=C*Ir,wt+=C*hn,lt+=C*dn,at+=C*pn,C=W[6],it+=C*pe,Ue+=C*nr,gt+=C*dr,st+=C*pr,tt+=C*Qt,At+=C*gr,Rt+=C*lr,Mt+=C*Lr,Et+=C*mr,dt+=C*wr,_t+=C*Br,ot+=C*$r,wt+=C*Ir,lt+=C*hn,at+=C*dn,Ae+=C*pn,C=W[7],Ue+=C*pe,gt+=C*nr,st+=C*dr,tt+=C*pr,At+=C*Qt,Rt+=C*gr,Mt+=C*lr,Et+=C*Lr,dt+=C*mr,_t+=C*wr,ot+=C*Br,wt+=C*$r,lt+=C*Ir,at+=C*hn,Ae+=C*dn,Pe+=C*pn,C=W[8],gt+=C*pe,st+=C*nr,tt+=C*dr,At+=C*pr,Rt+=C*Qt,Mt+=C*gr,Et+=C*lr,dt+=C*Lr,_t+=C*mr,ot+=C*wr,wt+=C*Br,lt+=C*$r,at+=C*Ir,Ae+=C*hn,Pe+=C*dn,Ge+=C*pn,C=W[9],st+=C*pe,tt+=C*nr,At+=C*dr,Rt+=C*pr,Mt+=C*Qt,Et+=C*gr,dt+=C*lr,_t+=C*Lr,ot+=C*mr,wt+=C*wr,lt+=C*Br,at+=C*$r,Ae+=C*Ir,Pe+=C*hn,Ge+=C*dn,je+=C*pn,C=W[10],tt+=C*pe,At+=C*nr,Rt+=C*dr,Mt+=C*pr,Et+=C*Qt,dt+=C*gr,_t+=C*lr,ot+=C*Lr,wt+=C*mr,lt+=C*wr,at+=C*Br,Ae+=C*$r,Pe+=C*Ir,Ge+=C*hn,je+=C*dn,qe+=C*pn,C=W[11],At+=C*pe,Rt+=C*nr,Mt+=C*dr,Et+=C*pr,dt+=C*Qt,_t+=C*gr,ot+=C*lr,wt+=C*Lr,lt+=C*mr,at+=C*wr,Ae+=C*Br,Pe+=C*$r,Ge+=C*Ir,je+=C*hn,qe+=C*dn,Xe+=C*pn,C=W[12],Rt+=C*pe,Mt+=C*nr,Et+=C*dr,dt+=C*pr,_t+=C*Qt,ot+=C*gr,wt+=C*lr,lt+=C*Lr,at+=C*mr,Ae+=C*wr,Pe+=C*Br,Ge+=C*$r,je+=C*Ir,qe+=C*hn,Xe+=C*dn,kt+=C*pn,C=W[13],Mt+=C*pe,Et+=C*nr,dt+=C*dr,_t+=C*pr,ot+=C*Qt,wt+=C*gr,lt+=C*lr,at+=C*Lr,Ae+=C*mr,Pe+=C*wr,Ge+=C*Br,je+=C*$r,qe+=C*Ir,Xe+=C*hn,kt+=C*dn,Wt+=C*pn,C=W[14],Et+=C*pe,dt+=C*nr,_t+=C*dr,ot+=C*pr,wt+=C*Qt,lt+=C*gr,at+=C*lr,Ae+=C*Lr,Pe+=C*mr,Ge+=C*wr,je+=C*Br,qe+=C*$r,Xe+=C*Ir,kt+=C*hn,Wt+=C*dn,Zt+=C*pn,C=W[15],dt+=C*pe,_t+=C*nr,ot+=C*dr,wt+=C*pr,lt+=C*Qt,at+=C*gr,Ae+=C*lr,Pe+=C*Lr,Ge+=C*mr,je+=C*wr,qe+=C*Br,Xe+=C*$r,kt+=C*Ir,Wt+=C*hn,Zt+=C*dn,Kt+=C*pn,U+=38*_t,oe+=38*ot,ge+=38*wt,xe+=38*lt,Re+=38*at,De+=38*Ae,it+=38*Pe,Ue+=38*Ge,gt+=38*je,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=U+Y+65535,Y=Math.floor(C/65536),U=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=ge+Y+65535,Y=Math.floor(C/65536),ge=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,U+=Y-1+37*(Y-1),Y=1,C=U+Y+65535,Y=Math.floor(C/65536),U=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=ge+Y+65535,Y=Math.floor(C/65536),ge=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,U+=Y-1+37*(Y-1),$[0]=U,$[1]=oe,$[2]=ge,$[3]=xe,$[4]=Re,$[5]=De,$[6]=it,$[7]=Ue,$[8]=gt,$[9]=st,$[10]=tt,$[11]=At,$[12]=Rt,$[13]=Mt,$[14]=Et,$[15]=dt}function se($,W){N($,W,W)}function ee($,W){var V=r(),C;for(C=0;C<16;C++)V[C]=W[C];for(C=253;C>=0;C--)se(V,V),C!==2&&C!==4&&N(V,V,W);for(C=0;C<16;C++)$[C]=V[C]}function X($,W){var V=r(),C;for(C=0;C<16;C++)V[C]=W[C];for(C=250;C>=0;C--)se(V,V),C!==1&&N(V,V,W);for(C=0;C<16;C++)$[C]=V[C]}function Q($,W,V){var C=new Uint8Array(32),Y=new Float64Array(80),U,oe,ge=r(),xe=r(),Re=r(),De=r(),it=r(),Ue=r();for(oe=0;oe<31;oe++)C[oe]=W[oe];for(C[31]=W[31]&127|64,C[0]&=248,I(Y,V),oe=0;oe<16;oe++)xe[oe]=Y[oe],De[oe]=ge[oe]=Re[oe]=0;for(ge[0]=De[0]=1,oe=254;oe>=0;--oe)U=C[oe>>>3]>>>(oe&7)&1,_(ge,xe,U),_(Re,De,U),F(it,ge,Re),ce(ge,ge,Re),F(Re,xe,De),ce(xe,xe,De),se(De,it),se(Ue,ge),N(ge,Re,ge),N(Re,xe,it),F(it,ge,Re),ce(ge,ge,Re),se(xe,ge),ce(Re,De,Ue),N(ge,Re,u),F(ge,ge,De),N(Re,Re,ge),N(ge,De,Ue),N(De,xe,Y),se(xe,it),_(ge,xe,U),_(Re,De,U);for(oe=0;oe<16;oe++)Y[oe+16]=ge[oe],Y[oe+32]=Re[oe],Y[oe+48]=xe[oe],Y[oe+64]=De[oe];var gt=Y.subarray(32),st=Y.subarray(16);return ee(gt,gt),N(st,st,gt),S($,st),0}function R($,W){return Q($,W,s)}function Z($,W){return n(W,32),R($,W)}function te($,W,V){var C=new Uint8Array(32);return Q(C,V,W),H($,i,C,J)}var le=f,ie=g;function fe($,W,V,C,Y,U){var oe=new Uint8Array(32);return te(oe,Y,U),le($,W,V,C,oe)}function ve($,W,V,C,Y,U){var oe=new Uint8Array(32);return te(oe,Y,U),ie($,W,V,C,oe)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne($,W,V,C){for(var Y=new Int32Array(16),U=new Int32Array(16),oe,ge,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Ae,Pe,Ge,je,qe,Xe,kt=$[0],Wt=$[1],Zt=$[2],Kt=$[3],pe=$[4],nr=$[5],dr=$[6],pr=$[7],Qt=W[0],gr=W[1],lr=W[2],Lr=W[3],mr=W[4],wr=W[5],Br=W[6],$r=W[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=V[at+0]<<24|V[at+1]<<16|V[at+2]<<8|V[at+3],U[lt]=V[at+4]<<24|V[at+5]<<16|V[at+6]<<8|V[at+7];for(lt=0;lt<80;lt++)if(oe=kt,ge=Wt,xe=Zt,Re=Kt,De=pe,it=nr,Ue=dr,gt=pr,st=Qt,tt=gr,At=lr,Rt=Lr,Mt=mr,Et=wr,dt=Br,_t=$r,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(pe>>>14|mr<<18)^(pe>>>18|mr<<14)^(mr>>>9|pe<<23),Pe=(mr>>>14|pe<<18)^(mr>>>18|pe<<14)^(pe>>>9|mr<<23),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=pe&nr^~pe&dr,Pe=mr&wr^~mr&Br,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Me[lt*2],Pe=Me[lt*2+1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Y[lt%16],Pe=U[lt%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|je<<16,Ae=ot,Pe=wt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Pe=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=kt&Wt^kt&Zt^Wt&Zt,Pe=Qt&gr^Qt&lr^gr&lr,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,gt=qe&65535|Xe<<16,_t=Ge&65535|je<<16,Ae=Re,Pe=Rt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=ot,Pe=wt,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|je<<16,Wt=oe,Zt=ge,Kt=xe,pe=Re,nr=De,dr=it,pr=Ue,kt=gt,gr=st,lr=tt,Lr=At,mr=Rt,wr=Mt,Br=Et,$r=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Ae=Y[at],Pe=U[at],Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=Y[(at+9)%16],Pe=U[(at+9)%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+1)%16],wt=U[(at+1)%16],Ae=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Pe=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+14)%16],wt=U[(at+14)%16],Ae=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Pe=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,U[at]=Ge&65535|je<<16;Ae=kt,Pe=Qt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[0],Pe=W[0],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[0]=kt=qe&65535|Xe<<16,W[0]=Qt=Ge&65535|je<<16,Ae=Wt,Pe=gr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[1],Pe=W[1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[1]=Wt=qe&65535|Xe<<16,W[1]=gr=Ge&65535|je<<16,Ae=Zt,Pe=lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[2],Pe=W[2],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[2]=Zt=qe&65535|Xe<<16,W[2]=lr=Ge&65535|je<<16,Ae=Kt,Pe=Lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[3],Pe=W[3],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[3]=Kt=qe&65535|Xe<<16,W[3]=Lr=Ge&65535|je<<16,Ae=pe,Pe=mr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[4],Pe=W[4],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[4]=pe=qe&65535|Xe<<16,W[4]=mr=Ge&65535|je<<16,Ae=nr,Pe=wr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[5],Pe=W[5],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[5]=nr=qe&65535|Xe<<16,W[5]=wr=Ge&65535|je<<16,Ae=dr,Pe=Br,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[6],Pe=W[6],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[6]=dr=qe&65535|Xe<<16,W[6]=Br=Ge&65535|je<<16,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[7],Pe=W[7],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[7]=pr=qe&65535|Xe<<16,W[7]=$r=Ge&65535|je<<16,Ir+=128,C-=128}return C}function Te($,W,V){var C=new Int32Array(8),Y=new Int32Array(8),U=new Uint8Array(256),oe,ge=V;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,W,V),V%=128,oe=0;oe=0;--Y)C=V[Y/8|0]>>(Y&7)&1,Ie($,W,C),$e(W,$),$e($,$),Ie($,W,C)}function ke($,W){var V=[r(),r(),r(),r()];v(V[0],p),v(V[1],y),v(V[2],a),N(V[3],p,y),Ve($,V,W)}function ze($,W,V){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],U;for(V||n(W,32),Te(C,W,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le($,Y),U=0;U<32;U++)W[U+32]=$[U];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Ee($,W){var V,C,Y,U;for(C=63;C>=32;--C){for(V=0,Y=C-32,U=C-12;Y>4)*He[Y],V=W[Y]>>8,W[Y]&=255;for(Y=0;Y<32;Y++)W[Y]-=V*He[Y];for(C=0;C<32;C++)W[C+1]+=W[C]>>8,$[C]=W[C]&255}function Qe($){var W=new Float64Array(64),V;for(V=0;V<64;V++)W[V]=$[V];for(V=0;V<64;V++)$[V]=0;Ee($,W)}function ct($,W,V,C){var Y=new Uint8Array(64),U=new Uint8Array(64),oe=new Uint8Array(64),ge,xe,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=V+64;for(ge=0;ge>7&&ce($[0],o,$[0]),N($[3],$[0],$[1]),0)}function et($,W,V,C){var Y,U=new Uint8Array(32),oe=new Uint8Array(64),ge=[r(),r(),r(),r()],xe=[r(),r(),r(),r()];if(V<64||Be(xe,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var $=new Uint8Array(vt),W=new Uint8Array(Dt);return ze($,W),{publicKey:$,secretKey:W}},e.sign.keyPair.fromSecretKey=function($){if(nt($),$.length!==Dt)throw new Error("bad secret key size");for(var W=new Uint8Array(vt),V=0;V=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function Cb(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function Y0(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new Ut("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new Ut("Delay aborted"))})})})}function As(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function fh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=As(e==null?void 0:e.signal);if(typeof t!="function")throw new Ut(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=p??null,o==null||o.abort(),o=As(p),o.signal.aborted)throw new Ut("Resource creation was aborted");n=y??null;const A=t(o.signal,...y);i=A;const P=yield A;if(i!==A&&P!==r)throw yield e(P),new Ut("Resource creation was aborted by a new resource creation");return r=P,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const p=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([p?e(p):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:p=>Pt(this,void 0,void 0,function*(){const y=r,A=i,P=n,N=s;if(yield U7(p),y===r&&A===i&&P===n&&N===s)return yield a(s,...P??[]);throw new Ut("Resource recreation was aborted by a new resource creation")})}}function ZZ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=As(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new Ut("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new Ut(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new Ut("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class kb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=XZ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield QZ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new KZ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(j7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=B7.encode(e);yield fh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new Ut(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Fo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Fo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new Ut(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new Ut("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),Sn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Ut("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new Ut(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function QZ(t){return Pt(this,void 0,void 0,function*(){return yield ZZ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=As(n.signal).signal;if(o.aborted){r(new Ut("Bridge connection aborted"));return}const a=new URL(j7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new Ut("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}try{const p=yield t.errorHandler(l,d);p!==l&&l.close(),p&&p!==l&&e(p)}catch(p){l.close(),r(p)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new Ut("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function lh(t){return!("connectEvent"in t)}class hh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!lh(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Rb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Rb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");if(!lh(e))throw new Ut("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new Ut("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!lh(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const q7=2;class dh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new hh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getHttpConnection();return lh(n)?new dh(e,n.connectionSource):new dh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=As(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Rb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield fh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(lh(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new Ut("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new kb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield fh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Ut("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),Y0(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=As(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){Sn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(B7.decode(e.message).toUint8Array(),Y0(e.from)));if(Sn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){Sn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Fo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(Sn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new Ut(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return GZ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",q7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+YZ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new kb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>fh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new kb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function z7(t,e){return H7(t,[e])}function H7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function eQ(t){try{return!z7(t,"tonconnect")||!z7(t.tonconnect,"walletInfo")?!1:H7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Xu{constructor(){this.storage={}}static getInstance(){return Xu.instance||(Xu.instance=new Xu),Xu.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function np(){if(!(typeof window>"u"))return window}function tQ(){const t=np();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function rQ(){if(!(typeof document>"u"))return document}function nQ(){var t;const e=(t=np())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function iQ(){if(sQ())return localStorage;if(oQ())throw new Ut("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Xu.getInstance()}function sQ(){try{return typeof localStorage<"u"}catch{return!1}}function oQ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class xi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=xi.window;if(!xi.isWindowContainsWallet(n,r))throw new Nb;this.connectionStorage=new hh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getInjectedConnection();return new xi(e,n.jsBridgeKey)})}static isWalletInjected(e){return xi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return xi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?tQ().filter(([n,i])=>eQ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(q7,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{Sn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();Sn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){Sn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>Sn("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{Sn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);Sn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){Sn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{Sn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}xi.window=np();class aQ{constructor(){this.localStorage=iQ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function W7(t){return uQ(t)&&t.injected}function cQ(t){return W7(t)&&t.embedded}function uQ(t){return"jsBridgeKey"in t}const fQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class Bb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(cQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new Lb("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Fo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Fo(n),e=fQ}let r=[];try{r=xi.getCurrentlyInjectedWallets()}catch(n){Fo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=xi.isWalletInjected(o),i.embedded=xi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class ip extends Ut{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,ip.prototype)}}function lQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new ip("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function wQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Qu(t,e)),$b(e,r))}function xQ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Qu(t,e)),$b(e,r))}function _Q(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Qu(t,e)),$b(e,r))}function EQ(t,e,r){return Object.assign({type:"disconnection",scope:r},Qu(t,e))}class SQ{constructor(){this.window=np()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class AQ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new SQ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Zu({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",dQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",hQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=pQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=gQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=mQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=vQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=bQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=yQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=EQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=wQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=xQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=_Q(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const PQ="3.0.5";class ph{constructor(e){if(this.walletsList=new Bb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||nQ(),storage:(e==null?void 0:e.storage)||new aQ},this.walletsList=new Bb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new AQ({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:PQ}),!this.dappSettings.manifestUrl)throw new Db("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new hh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Ob;const o=As(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new Ut("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield dh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield xi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Fo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=fh(p=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:p.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(p=>setTimeout(()=>p(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=As(n==null?void 0:n.signal);if(i.signal.aborted)throw new Ut("Transaction sending was aborted");this.checkConnection(),lQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=jZ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(rp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(rp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),rp.parseAndThrowError(l);const d=rp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new Z0;const n=As(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Ut("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=rQ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Fo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&UZ(e)?r=new xi(this.dappSettings.storage,e.jsBridgeKey):r=new dh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new Ut("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=zZ.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),Sn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof X0||r instanceof J0)throw Fo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new Z0}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}ph.walletsList=new Bb,ph.isWalletInjected=t=>xi.isWalletInjected(t),ph.isInsideWalletBrowser=t=>xi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function Fb(t){const{children:e,onClick:r}=t;return ge.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function K7(t){const{wallet:e,connector:r,loading:n}=t,i=Ee.useRef(null),s=Ee.useRef(),[o,a]=Ee.useState(),[u,l]=Ee.useState(),[d,p]=Ee.useState("connect"),[y,A]=Ee.useState(!1),[P,N]=Ee.useState();function D(z){var ue;(ue=s.current)==null||ue.update({data:z})}async function k(){A(!0);try{a("");const z=await va.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ue=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:z}});if(!ue)return;N(ue),D(ue),l(z)}}catch(z){a(z.message)}A(!1)}function B(){s.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function q(){r.connect(e,{request:{tonProof:u}})}function j(){if("deepLink"in e){if(!e.deepLink||!P)return;const z=new URL(P),ue=`${e.deepLink}${z.search}`;window.open(ue)}}function H(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(P)}const J=Ee.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),T=Ee.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Ee.useEffect(()=>{B(),k()},[]),ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-text-center xc-mb-6",children:[ge.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[ge.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),ge.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?ge.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):ge.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),ge.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),ge.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&ge.jsx(vc,{className:"xc-animate-spin"}),!y&&!n&&ge.jsxs(ge.Fragment,{children:[W7(e)&&ge.jsxs(Fb,{onClick:q,children:[ge.jsx(BK,{className:"xc-opacity-80"}),"Extension"]}),J&&ge.jsxs(Fb,{onClick:j,children:[ge.jsx(l8,{className:"xc-opacity-80"}),"Desktop"]}),T&&ge.jsx(Fb,{onClick:H,children:"Telegram Mini App"})]})]})]})}function MQ(t){const[e,r]=Ee.useState(""),[n,i]=Ee.useState(),[s,o]=Ee.useState(),a=Cb(),[u,l]=Ee.useState(!1);async function d(y){var P,N;if(!y||!((P=y.connectItems)!=null&&P.tonProof))return;l(!0);const A=await va.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(N=y.connectItems)==null?void 0:N.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(A.data),l(!1)}Ee.useEffect(()=>{const y=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),A=y.onStatusChange(d);return o(y),r("select"),A},[]);function p(y){r("connect"),i(y)}return ge.jsxs(Ss,{children:[e==="select"&&ge.jsx(T7,{connector:s,onSelect:p,onBack:t.onBack}),e==="connect"&&ge.jsx(K7,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function V7(t){const{children:e,className:r}=t,n=Ee.useRef(null),[i,s]=Ee.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Ee.useEffect(()=>{console.log("maxHeight",i)},[i]),ge.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function IQ(){return ge.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ge.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),ge.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),ge.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function G7(t){const{wallets:e}=Kl(),[r,n]=Ee.useState(),i=Ee.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),ge.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[ge.jsx(h8,{className:"xc-shrink-0 xc-opacity-50"}),ge.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),ge.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>ge.jsx(Ab,{wallet:a,onClick:s},`feature-${a.key}`)):ge.jsx(IQ,{})})]})}function CQ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Ee.useState(""),[l,d]=Ee.useState(null),[p,y]=Ee.useState("");function A(k){d(k),u("evm-wallet")}function P(k){u("email"),y(k)}async function N(k){await e(k)}function D(){u("ton-wallet")}return Ee.useEffect(()=>{u("index")},[]),ge.jsx(GX,{config:t.config,children:ge.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&ge.jsx(TZ,{onBack:()=>u("index"),onLogin:N,wallet:l}),a==="ton-wallet"&&ge.jsx(MQ,{onBack:()=>u("index"),onLogin:N}),a==="email"&&ge.jsx(uZ,{email:p,onBack:()=>u("index"),onLogin:N}),a==="index"&&ge.jsx(f7,{header:r,onEmailConfirm:P,onSelectWallet:A,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&ge.jsx(G7,{onBack:()=>u("index"),onSelectWallet:A})]})})}function TQ(t){const{wallet:e,onConnect:r}=t,[n,i]=Ee.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-6",children:ge.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&ge.jsx(M7,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&ge.jsx(I7,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&ge.jsx(C7,{wallet:e})]})}function RQ(t){const{email:e}=t,[r,n]=Ee.useState("captcha");return ge.jsxs(Ss,{children:[ge.jsx("div",{className:"xc-mb-12",children:ge.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),r==="captcha"&&ge.jsx(x7,{email:e,onCodeSend:()=>n("verify-email")}),r==="verify-email"&&ge.jsx(w7,{email:e,onInputCode:t.onInputCode,onResendCode:()=>n("captcha")})]})}function DQ(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Ee.useState(""),[a,u]=Ee.useState(),[l,d]=Ee.useState(),p=Ee.useRef(),[y,A]=Ee.useState("");function P(j){u(j),o("evm-wallet-connect")}function N(j){A(j),o("email-connect")}async function D(j,H){await(e==null?void 0:e({chain_type:"eip155",client:j.client,connect_info:H,wallet:j})),o("index")}async function k(j,H){await(n==null?void 0:n(j,H))}function B(j){d(j),o("ton-wallet-connect")}async function q(j){j&&await(r==null?void 0:r({chain_type:"ton",client:p.current,connect_info:j,wallet:j}))}return Ee.useEffect(()=>{p.current=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const j=p.current.onStatusChange(q);return o("index"),j},[]),ge.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&ge.jsx(G7,{onBack:()=>o("index"),onSelectWallet:P}),s==="evm-wallet-connect"&&ge.jsx(TQ,{onBack:()=>o("index"),onConnect:D,wallet:a}),s==="ton-wallet-select"&&ge.jsx(T7,{connector:p.current,onSelect:B,onBack:()=>o("index")}),s==="ton-wallet-connect"&&ge.jsx(K7,{connector:p.current,wallet:l,onBack:()=>o("index")}),s==="email-connect"&&ge.jsx(RQ,{email:y,onBack:()=>o("index"),onInputCode:k}),s==="index"&&ge.jsx(f7,{onEmailConfirm:N,onSelectWallet:P,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Mn.CodattaConnect=DQ,Mn.CodattaConnectContextProvider=CK,Mn.CodattaSignin=CQ,Mn.WalletItem=ru,Mn.coinbaseWallet=a8,Mn.useCodattaConnectContext=Kl,Object.defineProperty(Mn,Symbol.toStringTag,{value:"Module"})}); + ***************************************************************************** */function UZ(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new Ut("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new Ut("Delay aborted"))})})})}function As(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function fh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=As(e==null?void 0:e.signal);if(typeof t!="function")throw new Ut(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=p??null,o==null||o.abort(),o=As(p),o.signal.aborted)throw new Ut("Resource creation was aborted");n=y??null;const A=t(o.signal,...y);i=A;const P=yield A;if(i!==A&&P!==r)throw yield e(P),new Ut("Resource creation was aborted by a new resource creation");return r=P,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const p=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([p?e(p):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:p=>Pt(this,void 0,void 0,function*(){const y=r,A=i,P=n,O=s;if(yield U7(p),y===r&&A===i&&P===n&&O===s)return yield a(s,...P??[]);throw new Ut("Resource recreation was aborted by a new resource creation")})}}function QZ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=As(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new Ut("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new Ut(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new Ut("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class Lb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=ZZ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield eQ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new VZ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(j7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=B7.encode(e);yield fh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new Ut(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Fo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Fo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new Ut(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new Ut("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),Sn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Ut("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new Ut(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function eQ(t){return Pt(this,void 0,void 0,function*(){return yield QZ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=As(n.signal).signal;if(o.aborted){r(new Ut("Bridge connection aborted"));return}const a=new URL(j7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new Ut("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}try{const p=yield t.errorHandler(l,d);p!==l&&l.close(),p&&p!==l&&e(p)}catch(p){l.close(),r(p)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new Ut("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function lh(t){return!("connectEvent"in t)}class hh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!lh(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Tb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Tb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");if(!lh(e))throw new Ut("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new Ut("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!lh(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const q7=2;class dh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new hh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getHttpConnection();return lh(n)?new dh(e,n.connectionSource):new dh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=As(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Tb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield fh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(lh(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new Ut("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Lb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield fh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Ut("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),Y0(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=As(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){Sn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(B7.decode(e.message).toUint8Array(),Y0(e.from)));if(Sn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){Sn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Fo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(Sn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new Ut(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return YZ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",q7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+JZ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new Lb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>fh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Lb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function z7(t,e){return H7(t,[e])}function H7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function tQ(t){try{return!z7(t,"tonconnect")||!z7(t.tonconnect,"walletInfo")?!1:H7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Xu{constructor(){this.storage={}}static getInstance(){return Xu.instance||(Xu.instance=new Xu),Xu.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function np(){if(!(typeof window>"u"))return window}function rQ(){const t=np();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function nQ(){if(!(typeof document>"u"))return document}function iQ(){var t;const e=(t=np())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function sQ(){if(oQ())return localStorage;if(aQ())throw new Ut("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Xu.getInstance()}function oQ(){try{return typeof localStorage<"u"}catch{return!1}}function aQ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class xi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=xi.window;if(!xi.isWindowContainsWallet(n,r))throw new Ob;this.connectionStorage=new hh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getInjectedConnection();return new xi(e,n.jsBridgeKey)})}static isWalletInjected(e){return xi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return xi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?rQ().filter(([n,i])=>tQ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(q7,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{Sn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();Sn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){Sn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>Sn("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{Sn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);Sn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){Sn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{Sn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}xi.window=np();class cQ{constructor(){this.localStorage=sQ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function W7(t){return fQ(t)&&t.injected}function uQ(t){return W7(t)&&t.embedded}function fQ(t){return"jsBridgeKey"in t}const lQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class kb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(uQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new Nb("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Fo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Fo(n),e=lQ}let r=[];try{r=xi.getCurrentlyInjectedWallets()}catch(n){Fo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=xi.isWalletInjected(o),i.embedded=xi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class ip extends Ut{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,ip.prototype)}}function hQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new ip("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function xQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Qu(t,e)),Bb(e,r))}function _Q(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Qu(t,e)),Bb(e,r))}function EQ(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Qu(t,e)),Bb(e,r))}function SQ(t,e,r){return Object.assign({type:"disconnection",scope:r},Qu(t,e))}class AQ{constructor(){this.window=np()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class PQ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new AQ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Zu({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",pQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",dQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=gQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=mQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=vQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=bQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=yQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=wQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=SQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=xQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=_Q(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=EQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const MQ="3.0.5";class ph{constructor(e){if(this.walletsList=new kb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||iQ(),storage:(e==null?void 0:e.storage)||new cQ},this.walletsList=new kb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new PQ({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:MQ}),!this.dappSettings.manifestUrl)throw new Rb("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new hh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Db;const o=As(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new Ut("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield dh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield xi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Fo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=fh(p=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:p.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(p=>setTimeout(()=>p(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=As(n==null?void 0:n.signal);if(i.signal.aborted)throw new Ut("Transaction sending was aborted");this.checkConnection(),hQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=UZ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(rp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(rp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),rp.parseAndThrowError(l);const d=rp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new Z0;const n=As(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Ut("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=nQ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Fo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&qZ(e)?r=new xi(this.dappSettings.storage,e.jsBridgeKey):r=new dh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new Ut("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=HZ.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),Sn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof X0||r instanceof J0)throw Fo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new Z0}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}ph.walletsList=new kb,ph.isWalletInjected=t=>xi.isWalletInjected(t),ph.isInsideWalletBrowser=t=>xi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function $b(t){const{children:e,onClick:r}=t;return de.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function K7(t){const{wallet:e,connector:r,loading:n}=t,i=Se.useRef(null),s=Se.useRef(),[o,a]=Se.useState(),[u,l]=Se.useState(),[d,p]=Se.useState("connect"),[y,A]=Se.useState(!1),[P,O]=Se.useState();function D(z){var ue;(ue=s.current)==null||ue.update({data:z})}async function k(){A(!0);try{a("");const z=await va.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ue=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:z}});if(!ue)return;O(ue),D(ue),l(z)}}catch(z){a(z.message)}A(!1)}function B(){s.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function q(){r.connect(e,{request:{tonProof:u}})}function j(){if("deepLink"in e){if(!e.deepLink||!P)return;const z=new URL(P),ue=`${e.deepLink}${z.search}`;window.open(ue)}}function H(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(P)}const J=Se.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),T=Se.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Se.useEffect(()=>{B(),k()},[]),de.jsxs(Ss,{children:[de.jsx("div",{className:"xc-mb-6",children:de.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),de.jsxs("div",{className:"xc-text-center xc-mb-6",children:[de.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[de.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),de.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?de.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):de.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),de.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),de.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&de.jsx(vc,{className:"xc-animate-spin"}),!y&&!n&&de.jsxs(de.Fragment,{children:[W7(e)&&de.jsxs($b,{onClick:q,children:[de.jsx(BK,{className:"xc-opacity-80"}),"Extension"]}),J&&de.jsxs($b,{onClick:j,children:[de.jsx(f8,{className:"xc-opacity-80"}),"Desktop"]}),T&&de.jsx($b,{onClick:H,children:"Telegram Mini App"})]})]})]})}function IQ(t){const[e,r]=Se.useState(""),[n,i]=Se.useState(),[s,o]=Se.useState(),a=Ib(),[u,l]=Se.useState(!1);async function d(y){var P,O;if(!y||!((P=y.connectItems)!=null&&P.tonProof))return;l(!0);const A=await va.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(O=y.connectItems)==null?void 0:O.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(A.data),l(!1)}Se.useEffect(()=>{const y=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),A=y.onStatusChange(d);return o(y),r("select"),A},[]);function p(y){r("connect"),i(y)}return de.jsxs(Ss,{children:[e==="select"&&de.jsx(T7,{connector:s,onSelect:p,onBack:t.onBack}),e==="connect"&&de.jsx(K7,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function V7(t){const{children:e,className:r}=t,n=Se.useRef(null),[i,s]=Se.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Se.useEffect(()=>{console.log("maxHeight",i)},[i]),de.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function CQ(){return de.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[de.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),de.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),de.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),de.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),de.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),de.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function G7(t){const{wallets:e}=Kl(),[r,n]=Se.useState(),i=Se.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return de.jsxs(Ss,{children:[de.jsx("div",{className:"xc-mb-6",children:de.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),de.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[de.jsx(l8,{className:"xc-shrink-0 xc-opacity-50"}),de.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),de.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>de.jsx(e7,{wallet:a,onClick:s},`feature-${a.key}`)):de.jsx(CQ,{})})]})}function TQ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Se.useState(""),[l,d]=Se.useState(null),[p,y]=Se.useState("");function A(k){d(k),u("evm-wallet")}function P(k){u("email"),y(k)}async function O(k){await e(k)}function D(){u("ton-wallet")}return Se.useEffect(()=>{u("index")},[]),de.jsx(YX,{config:t.config,children:de.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&de.jsx(RZ,{onBack:()=>u("index"),onLogin:O,wallet:l}),a==="ton-wallet"&&de.jsx(IQ,{onBack:()=>u("index"),onLogin:O}),a==="email"&&de.jsx(fZ,{email:p,onBack:()=>u("index"),onLogin:O}),a==="index"&&de.jsx(f7,{header:r,onEmailConfirm:P,onSelectWallet:A,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&de.jsx(G7,{onBack:()=>u("index"),onSelectWallet:A})]})})}function RQ(t){const{wallet:e,onConnect:r}=t,[n,i]=Se.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return de.jsxs(Ss,{children:[de.jsx("div",{className:"xc-mb-6",children:de.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&de.jsx(M7,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&de.jsx(I7,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&de.jsx(C7,{wallet:e})]})}function DQ(t){const{email:e}=t,[r,n]=Se.useState("captcha");return de.jsxs(Ss,{children:[de.jsx("div",{className:"xc-mb-12",children:de.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),r==="captcha"&&de.jsx(x7,{email:e,onCodeSend:()=>n("verify-email")}),r==="verify-email"&&de.jsx(w7,{email:e,onInputCode:t.onInputCode,onResendCode:()=>n("captcha")})]})}function OQ(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Se.useState(""),[a,u]=Se.useState(),[l,d]=Se.useState(),p=Se.useRef(),[y,A]=Se.useState("");function P(j){u(j),o("evm-wallet-connect")}function O(j){A(j),o("email-connect")}async function D(j,H){await(e==null?void 0:e({chain_type:"eip155",client:j.client,connect_info:H,wallet:j})),o("index")}async function k(j,H){await(n==null?void 0:n(j,H))}function B(j){d(j),o("ton-wallet-connect")}async function q(j){j&&await(r==null?void 0:r({chain_type:"ton",client:p.current,connect_info:j,wallet:j}))}return Se.useEffect(()=>{p.current=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const j=p.current.onStatusChange(q);return o("index"),j},[]),de.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&de.jsx(G7,{onBack:()=>o("index"),onSelectWallet:P}),s==="evm-wallet-connect"&&de.jsx(RQ,{onBack:()=>o("index"),onConnect:D,wallet:a}),s==="ton-wallet-select"&&de.jsx(T7,{connector:p.current,onSelect:B,onBack:()=>o("index")}),s==="ton-wallet-connect"&&de.jsx(K7,{connector:p.current,wallet:l,onBack:()=>o("index")}),s==="email-connect"&&de.jsx(DQ,{email:y,onBack:()=>o("index"),onInputCode:k}),s==="index"&&de.jsx(f7,{onEmailConfirm:O,onSelectWallet:P,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Mn.CodattaConnect=OQ,Mn.CodattaConnectContextProvider=CK,Mn.CodattaSignin=TQ,Mn.WalletItem=ru,Mn.coinbaseWallet=o8,Mn.useCodattaConnectContext=Kl,Object.defineProperty(Mn,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/main-BN1nTxTF.js b/dist/main-BX-27dZd.js similarity index 90% rename from dist/main-BN1nTxTF.js rename to dist/main-BX-27dZd.js index a307580..411dfe2 100644 --- a/dist/main-BN1nTxTF.js +++ b/dist/main-BX-27dZd.js @@ -2,13 +2,13 @@ var NR = Object.defineProperty; var LR = (t, e, r) => e in t ? NR(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; var Ds = (t, e, r) => LR(t, typeof e != "symbol" ? e + "" : e, r); import * as Gt from "react"; -import mv, { createContext as Sa, useContext as Tn, useState as Yt, useEffect as Dn, forwardRef as vv, createElement as qd, useId as bv, useCallback as yv, Component as kR, useLayoutEffect as $R, useRef as Zn, useInsertionEffect as w5, useMemo as ci, Fragment as x5, Children as BR, isValidElement as FR } from "react"; +import gv, { createContext as Sa, useContext as Tn, useState as Yt, useEffect as Dn, forwardRef as mv, createElement as qd, useId as vv, useCallback as bv, Component as kR, useLayoutEffect as $R, useRef as Zn, useInsertionEffect as y5, useMemo as wi, Fragment as w5, Children as BR, isValidElement as FR } from "react"; import "https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"; var gn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function ts(t) { return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; } -function wv(t) { +function yv(t) { if (t.__esModule) return t; var e = t.default; if (typeof e == "function") { @@ -37,11 +37,11 @@ var Ym = { exports: {} }, gf = {}; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -var g2; +var p2; function jR() { - if (g2) return gf; - g2 = 1; - var t = mv, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 }; + if (p2) return gf; + p2 = 1; + var t = gv, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 }; function o(a, u, l) { var d, p = {}, w = null, A = null; l !== void 0 && (w = "" + l), u.key !== void 0 && (w = "" + u.key), u.ref !== void 0 && (A = u.ref); @@ -61,29 +61,29 @@ var mf = {}; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -var m2; +var g2; function UR() { - return m2 || (m2 = 1, process.env.NODE_ENV !== "production" && function() { - var t = mv, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), a = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), M = Symbol.iterator, N = "@@iterator"; + return g2 || (g2 = 1, process.env.NODE_ENV !== "production" && function() { + var t = gv, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), a = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), M = Symbol.iterator, N = "@@iterator"; function L(j) { if (j === null || typeof j != "object") return null; var se = M && j[M] || j[N]; return typeof se == "function" ? se : null; } - var $ = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - function B(j) { + var B = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + function $(j) { { - for (var se = arguments.length, he = new Array(se > 1 ? se - 1 : 0), xe = 1; xe < se; xe++) - he[xe - 1] = arguments[xe]; - H("error", j, he); + for (var se = arguments.length, de = new Array(se > 1 ? se - 1 : 0), xe = 1; xe < se; xe++) + de[xe - 1] = arguments[xe]; + H("error", j, de); } } - function H(j, se, he) { + function H(j, se, de) { { - var xe = $.ReactDebugCurrentFrame, Te = xe.getStackAddendum(); - Te !== "" && (se += "%s", he = he.concat([Te])); - var Re = he.map(function(nt) { + var xe = B.ReactDebugCurrentFrame, Te = xe.getStackAddendum(); + Te !== "" && (se += "%s", de = de.concat([Te])); + var Re = de.map(function(nt) { return String(nt); }); Re.unshift("Warning: " + se), Function.prototype.apply.call(console[j], console, Re); @@ -98,12 +98,12 @@ function UR() { // with. j.$$typeof === ge || j.getModuleId !== void 0)); } - function Y(j, se, he) { + function Y(j, se, de) { var xe = j.displayName; if (xe) return xe; var Te = se.displayName || se.name || ""; - return Te !== "" ? he + "(" + Te + ")" : he; + return Te !== "" ? de + "(" + Te + ")" : de; } function S(j) { return j.displayName || "Context"; @@ -111,7 +111,7 @@ function UR() { function m(j) { if (j == null) return null; - if (typeof j.tag == "number" && B("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof j == "function") + if (typeof j.tag == "number" && $("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof j == "function") return j.displayName || j.name || null; if (typeof j == "string") return j; @@ -135,8 +135,8 @@ function UR() { var se = j; return S(se) + ".Consumer"; case o: - var he = j; - return S(he._context) + ".Provider"; + var de = j; + return S(de._context) + ".Provider"; case u: return Y(j, j.render, "ForwardRef"); case p: @@ -212,11 +212,11 @@ function UR() { }) }); } - g < 0 && B("disabledDepth fell below zero. This is a bug in React. Please file an issue."); + g < 0 && $("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } - var oe = $.ReactCurrentDispatcher, Z; - function J(j, se, he) { + var oe = B.ReactCurrentDispatcher, Z; + function J(j, se, de) { { if (Z === void 0) try { @@ -238,9 +238,9 @@ function UR() { if (!j || Q) return ""; { - var he = T.get(j); - if (he !== void 0) - return he; + var de = T.get(j); + if (de !== void 0) + return de; } var xe; Q = !0; @@ -305,14 +305,14 @@ function UR() { var Tt = j ? j.displayName || j.name : "", At = Tt ? J(Tt) : ""; return typeof j == "function" && T.set(j, At), At; } - function de(j, se, he) { + function pe(j, se, de) { return re(j, !1); } function ie(j) { var se = j.prototype; return !!(se && se.isReactComponent); } - function ue(j, se, he) { + function ue(j, se, de) { if (j == null) return ""; if (typeof j == "function") @@ -328,28 +328,28 @@ function UR() { if (typeof j == "object") switch (j.$$typeof) { case u: - return de(j.render); + return pe(j.render); case p: - return ue(j.type, se, he); + return ue(j.type, se, de); case w: { var xe = j, Te = xe._payload, Re = xe._init; try { - return ue(Re(Te), se, he); + return ue(Re(Te), se, de); } catch { } } } return ""; } - var ve = Object.prototype.hasOwnProperty, Pe = {}, De = $.ReactDebugCurrentFrame; + var ve = Object.prototype.hasOwnProperty, Pe = {}, De = B.ReactDebugCurrentFrame; function Ce(j) { if (j) { - var se = j._owner, he = ue(j.type, j._source, se ? se.type : null); - De.setExtraStackFrame(he); + var se = j._owner, de = ue(j.type, j._source, se ? se.type : null); + De.setExtraStackFrame(de); } else De.setExtraStackFrame(null); } - function $e(j, se, he, xe, Te) { + function $e(j, se, de, xe, Te) { { var Re = Function.call.bind(ve); for (var nt in j) @@ -357,14 +357,14 @@ function UR() { var je = void 0; try { if (typeof j[nt] != "function") { - var pt = Error((xe || "React class") + ": " + he + " type `" + nt + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof j[nt] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); + var pt = Error((xe || "React class") + ": " + de + " type `" + nt + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof j[nt] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw pt.name = "Invariant Violation", pt; } - je = j[nt](se, nt, xe, he, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); + je = j[nt](se, nt, xe, de, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (it) { je = it; } - je && !(je instanceof Error) && (Ce(Te), B("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", xe || "React class", he, nt, typeof je), Ce(null)), je instanceof Error && !(je.message in Pe) && (Pe[je.message] = !0, Ce(Te), B("Failed %s type: %s", he, je.message), Ce(null)); + je && !(je instanceof Error) && (Ce(Te), $("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", xe || "React class", de, nt, typeof je), Ce(null)), je instanceof Error && !(je.message in Pe) && (Pe[je.message] = !0, Ce(Te), $("Failed %s type: %s", de, je.message), Ce(null)); } } } @@ -374,8 +374,8 @@ function UR() { } function Ke(j) { { - var se = typeof Symbol == "function" && Symbol.toStringTag, he = se && j[Symbol.toStringTag] || j.constructor.name || "Object"; - return he; + var se = typeof Symbol == "function" && Symbol.toStringTag, de = se && j[Symbol.toStringTag] || j.constructor.name || "Object"; + return de; } } function Le(j) { @@ -390,9 +390,9 @@ function UR() { } function ze(j) { if (Le(j)) - return B("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(j)), qe(j); + return $("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(j)), qe(j); } - var _e = $.ReactCurrentOwner, Ze = { + var _e = B.ReactCurrentOwner, Ze = { key: !0, ref: !0, __self: !0, @@ -417,40 +417,40 @@ function UR() { } function dt(j, se) { if (typeof j.ref == "string" && _e.current && se && _e.current.stateNode !== se) { - var he = m(_e.current.type); - Qe[he] || (B('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', m(_e.current.type), j.ref), Qe[he] = !0); + var de = m(_e.current.type); + Qe[de] || ($('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', m(_e.current.type), j.ref), Qe[de] = !0); } } function lt(j, se) { { - var he = function() { - at || (at = !0, B("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); + var de = function() { + at || (at = !0, $("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); }; - he.isReactWarning = !0, Object.defineProperty(j, "key", { - get: he, + de.isReactWarning = !0, Object.defineProperty(j, "key", { + get: de, configurable: !0 }); } } function ct(j, se) { { - var he = function() { - ke || (ke = !0, B("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); + var de = function() { + ke || (ke = !0, $("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); }; - he.isReactWarning = !0, Object.defineProperty(j, "ref", { - get: he, + de.isReactWarning = !0, Object.defineProperty(j, "ref", { + get: de, configurable: !0 }); } } - var qt = function(j, se, he, xe, Te, Re, nt) { + var qt = function(j, se, de, xe, Te, Re, nt) { var je = { // This tag allows us to uniquely identify this as a React Element $$typeof: e, // Built-in properties that belong on the element type: j, key: se, - ref: he, + ref: de, props: nt, // Record the component responsible for creating this element. _owner: Re @@ -472,10 +472,10 @@ function UR() { value: Te }), Object.freeze && (Object.freeze(je.props), Object.freeze(je)), je; }; - function Jt(j, se, he, xe, Te) { + function Jt(j, se, de, xe, Te) { { var Re, nt = {}, je = null, pt = null; - he !== void 0 && (ze(he), je = "" + he), Ye(se) && (ze(se.key), je = "" + se.key), tt(se) && (pt = se.ref, dt(se, Te)); + de !== void 0 && (ze(de), je = "" + de), Ye(se) && (ze(se.key), je = "" + se.key), tt(se) && (pt = se.ref, dt(se, Te)); for (Re in se) ve.call(se, Re) && !Ze.hasOwnProperty(Re) && (nt[Re] = se[Re]); if (j && j.defaultProps) { @@ -490,11 +490,11 @@ function UR() { return qt(j, je, pt, Te, xe, _e.current, nt); } } - var Et = $.ReactCurrentOwner, er = $.ReactDebugCurrentFrame; + var Et = B.ReactCurrentOwner, er = B.ReactDebugCurrentFrame; function Xt(j) { if (j) { - var se = j._owner, he = ue(j.type, j._source, se ? se.type : null); - er.setExtraStackFrame(he); + var se = j._owner, de = ue(j.type, j._source, se ? se.type : null); + er.setExtraStackFrame(de); } else er.setExtraStackFrame(null); } @@ -523,10 +523,10 @@ Check the render method of \`` + j + "`."; { var se = Ct(); if (!se) { - var he = typeof j == "string" ? j : j.displayName || j.name; - he && (se = ` + var de = typeof j == "string" ? j : j.displayName || j.name; + de && (se = ` -Check the top-level render call using <` + he + ">."); +Check the top-level render call using <` + de + ">."); } return se; } @@ -536,12 +536,12 @@ Check the top-level render call using <` + he + ">."); if (!j._store || j._store.validated || j.key != null) return; j._store.validated = !0; - var he = Nt(se); - if (Rt[he]) + var de = Nt(se); + if (Rt[de]) return; - Rt[he] = !0; + Rt[de] = !0; var xe = ""; - j && j._owner && j._owner !== Et.current && (xe = " It was passed a child from " + m(j._owner.type) + "."), Xt(j), B('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', he, xe), Xt(null); + j && j._owner && j._owner !== Et.current && (xe = " It was passed a child from " + m(j._owner.type) + "."), Xt(j), $('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', de, xe), Xt(null); } } function $t(j, se) { @@ -549,8 +549,8 @@ Check the top-level render call using <` + he + ">."); if (typeof j != "object") return; if (Ne(j)) - for (var he = 0; he < j.length; he++) { - var xe = j[he]; + for (var de = 0; de < j.length; de++) { + var xe = j[de]; kt(xe) && vt(xe, se); } else if (kt(j)) @@ -568,40 +568,40 @@ Check the top-level render call using <` + he + ">."); var se = j.type; if (se == null || typeof se == "string") return; - var he; + var de; if (typeof se == "function") - he = se.propTypes; + de = se.propTypes; else if (typeof se == "object" && (se.$$typeof === u || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. se.$$typeof === p)) - he = se.propTypes; + de = se.propTypes; else return; - if (he) { + if (de) { var xe = m(se); - $e(he, j.props, "prop", xe, j); + $e(de, j.props, "prop", xe, j); } else if (se.PropTypes !== void 0 && !Dt) { Dt = !0; var Te = m(se); - B("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Te || "Unknown"); + $("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Te || "Unknown"); } - typeof se.getDefaultProps == "function" && !se.getDefaultProps.isReactClassApproved && B("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); + typeof se.getDefaultProps == "function" && !se.getDefaultProps.isReactClassApproved && $("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function rt(j) { { - for (var se = Object.keys(j.props), he = 0; he < se.length; he++) { - var xe = se[he]; + for (var se = Object.keys(j.props), de = 0; de < se.length; de++) { + var xe = se[de]; if (xe !== "children" && xe !== "key") { - Xt(j), B("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", xe), Xt(null); + Xt(j), $("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", xe), Xt(null); break; } } - j.ref !== null && (Xt(j), B("Invalid attribute `ref` supplied to `React.Fragment`."), Xt(null)); + j.ref !== null && (Xt(j), $("Invalid attribute `ref` supplied to `React.Fragment`."), Xt(null)); } } var Bt = {}; - function k(j, se, he, xe, Te, Re) { + function k(j, se, de, xe, Te, Re) { { var nt = Ee(j); if (!nt) { @@ -610,9 +610,9 @@ Check the top-level render call using <` + he + ">."); var pt = gt(); pt ? je += pt : je += Ct(); var it; - j === null ? it = "null" : Ne(j) ? it = "array" : j !== void 0 && j.$$typeof === e ? (it = "<" + (m(j.type) || "Unknown") + " />", je = " Did you accidentally export a JSX literal instead of a component?") : it = typeof j, B("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", it, je); + j === null ? it = "null" : Ne(j) ? it = "array" : j !== void 0 && j.$$typeof === e ? (it = "<" + (m(j.type) || "Unknown") + " />", je = " Did you accidentally export a JSX literal instead of a component?") : it = typeof j, $("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", it, je); } - var et = Jt(j, se, he, Te, Re); + var et = Jt(j, se, de, Te, Re); if (et == null) return et; if (nt) { @@ -624,7 +624,7 @@ Check the top-level render call using <` + he + ">."); $t(St[Tt], j); Object.freeze && Object.freeze(St); } else - B("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); + $("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else $t(St, j); } @@ -634,7 +634,7 @@ Check the top-level render call using <` + he + ">."); }), ht = _t.length > 0 ? "{key: someKey, " + _t.join(": ..., ") + ": ...}" : "{key: someKey}"; if (!Bt[At + ht]) { var xt = _t.length > 0 ? "{" + _t.join(": ..., ") + ": ...}" : "{}"; - B(`A props object containing a "key" prop is being spread into JSX: + $(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: @@ -645,18 +645,18 @@ React keys must be passed directly to JSX without using spread: return j === n ? rt(et) : Ft(et), et; } } - function q(j, se, he) { - return k(j, se, he, !0); + function q(j, se, de) { + return k(j, se, de, !0); } - function W(j, se, he) { - return k(j, se, he, !1); + function W(j, se, de) { + return k(j, se, de, !1); } var C = W, G = q; mf.Fragment = n, mf.jsx = C, mf.jsxs = G; }()), mf; } process.env.NODE_ENV === "production" ? Ym.exports = jR() : Ym.exports = UR(); -var pe = Ym.exports; +var le = Ym.exports; const Os = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", qR = [ { featured: !0, @@ -773,17 +773,17 @@ function zR(t, e) { const r = t.exec(e); return r == null ? void 0 : r.groups; } -const v2 = /^tuple(?(\[(\d*)\])*)$/; +const m2 = /^tuple(?(\[(\d*)\])*)$/; function Jm(t) { let e = t.type; - if (v2.test(t.type) && "components" in t) { + if (m2.test(t.type) && "components" in t) { e = "("; const r = t.components.length; for (let i = 0; i < r; i++) { const s = t.components[i]; e += Jm(s), i < r - 1 && (e += ", "); } - const n = zR(v2, t.type); + const n = zR(m2, t.type); return e += `)${(n == null ? void 0 : n.array) ?? ""}`, Jm({ ...t, type: e @@ -803,7 +803,7 @@ function vf(t) { function WR(t) { return t.type === "function" ? `function ${t.name}(${vf(t.inputs)})${t.stateMutability && t.stateMutability !== "nonpayable" ? ` ${t.stateMutability}` : ""}${t.outputs.length ? ` returns (${vf(t.outputs)})` : ""}` : t.type === "event" ? `event ${t.name}(${vf(t.inputs)})` : t.type === "error" ? `error ${t.name}(${vf(t.inputs)})` : t.type === "constructor" ? `constructor(${vf(t.inputs)})${t.stateMutability === "payable" ? " payable" : ""}` : t.type === "fallback" ? "fallback()" : "receive() external payable"; } -function yi(t, e, r) { +function bi(t, e, r) { const n = t[e.name]; if (typeof n == "function") return n; @@ -813,13 +813,13 @@ function yi(t, e, r) { function vu(t, { includeName: e = !1 } = {}) { if (t.type !== "function" && t.type !== "event" && t.type !== "error") throw new rD(t.type); - return `${t.name}(${xv(t.inputs, { includeName: e })})`; + return `${t.name}(${wv(t.inputs, { includeName: e })})`; } -function xv(t, { includeName: e = !1 } = {}) { +function wv(t, { includeName: e = !1 } = {}) { return t ? t.map((r) => HR(r, { includeName: e })).join(e ? ", " : ",") : ""; } function HR(t, { includeName: e }) { - return t.type.startsWith("tuple") ? `(${xv(t.components, { includeName: e })})${t.type.slice(5)}` : t.type + (e && t.name ? ` ${t.name}` : ""); + return t.type.startsWith("tuple") ? `(${wv(t.components, { includeName: e })})${t.type.slice(5)}` : t.type + (e && t.name ? ` ${t.name}` : ""); } function va(t, { strict: e = !0 } = {}) { return !t || typeof t != "string" ? !1 : e ? /^0x[0-9a-fA-F]*$/.test(t) : t.startsWith("0x"); @@ -827,10 +827,10 @@ function va(t, { strict: e = !0 } = {}) { function An(t) { return va(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length; } -const _5 = "2.21.45"; +const x5 = "2.21.45"; let bf = { getDocsUrl: ({ docsBaseUrl: t, docsPath: e = "", docsSlug: r }) => e ? `${t ?? "https://viem.sh"}${e}${r ? `#${r}` : ""}` : void 0, - version: `viem@${_5}` + version: `viem@${x5}` }; class yt extends Error { constructor(e, r = {}) { @@ -877,14 +877,14 @@ class yt extends Error { configurable: !0, writable: !0, value: "BaseError" - }), this.details = n, this.docsPath = i, this.metaMessages = r.metaMessages, this.name = r.name ?? this.name, this.shortMessage = e, this.version = _5; + }), this.details = n, this.docsPath = i, this.metaMessages = r.metaMessages, this.name = r.name ?? this.name, this.shortMessage = e, this.version = x5; } walk(e) { - return E5(this, e); + return _5(this, e); } } -function E5(t, e) { - return e != null && e(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ? E5(t.cause, e) : e ? null : t; +function _5(t, e) { + return e != null && e(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ? _5(t.cause, e) : e ? null : t; } class KR extends yt { constructor({ docsPath: e }) { @@ -898,7 +898,7 @@ class KR extends yt { }); } } -class b2 extends yt { +class v2 extends yt { constructor({ docsPath: e }) { super([ "Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.", @@ -915,7 +915,7 @@ class VR extends yt { super([`Data size of ${n} bytes is too small for given parameters.`].join(` `), { metaMessages: [ - `Params: (${xv(r, { includeName: !0 })})`, + `Params: (${wv(r, { includeName: !0 })})`, `Data: ${e} (${n} bytes)` ], name: "AbiDecodingDataSizeTooSmallError" @@ -937,7 +937,7 @@ class VR extends yt { }), this.data = e, this.params = r, this.size = n; } } -class _v extends yt { +class xv extends yt { constructor() { super('Cannot decode zero data ("0x") with ABI parameters.', { name: "AbiDecodingZeroDataError" @@ -969,7 +969,7 @@ class JR extends yt { `), { name: "AbiEncodingLengthMismatchError" }); } } -class S5 extends yt { +class E5 extends yt { constructor(e, { docsPath: r }) { super([ `Encoded error signature "${e}" not found on ABI.`, @@ -987,7 +987,7 @@ class S5 extends yt { }), this.signature = e; } } -class y2 extends yt { +class b2 extends yt { constructor(e, { docsPath: r } = {}) { super([ `Function ${e ? `"${e}" ` : ""}not found on ABI.`, @@ -1055,17 +1055,17 @@ class rD extends yt { `), { name: "InvalidDefinitionTypeError" }); } } -class A5 extends yt { +class S5 extends yt { constructor({ offset: e, position: r, size: n }) { super(`Slice ${r === "start" ? "starting" : "ending"} at offset "${e}" is out-of-bounds (size: ${n}).`, { name: "SliceOffsetOutOfBoundsError" }); } } -class P5 extends yt { +class A5 extends yt { constructor({ size: e, targetSize: r, type: n }) { super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`, { name: "SizeExceedsPaddingSizeError" }); } } -class w2 extends yt { +class y2 extends yt { constructor({ size: e, targetSize: r, type: n }) { super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`, { name: "InvalidBytesLengthError" }); } @@ -1078,7 +1078,7 @@ function ma(t, { dir: e, size: r = 32 } = {}) { return t; const n = t.replace("0x", ""); if (n.length > r * 2) - throw new P5({ + throw new A5({ size: Math.ceil(n.length / 2), targetSize: r, type: "hex" @@ -1089,7 +1089,7 @@ function nD(t, { dir: e, size: r = 32 } = {}) { if (r === null) return t; if (t.length > r) - throw new P5({ + throw new A5({ size: t.length, targetSize: r, type: "bytes" @@ -1118,7 +1118,7 @@ class oD extends yt { super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" }); } } -function Ev(t, { dir: e = "left" } = {}) { +function _v(t, { dir: e = "left" } = {}) { let r = typeof t == "string" ? t.replace("0x", "") : t, n = 0; for (let i = 0; i < r.length - 1 && r[e === "left" ? i : r.length - i - 1].toString() === "0"; i++) n++; @@ -1145,9 +1145,9 @@ function bu(t, e = {}) { } const aD = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); function zd(t, e = {}) { - return typeof t == "number" || typeof t == "bigint" ? Mr(t, e) : typeof t == "string" ? I0(t, e) : typeof t == "boolean" ? M5(t, e) : xi(t, e); + return typeof t == "number" || typeof t == "bigint" ? Mr(t, e) : typeof t == "string" ? I0(t, e) : typeof t == "boolean" ? P5(t, e) : xi(t, e); } -function M5(t, e = {}) { +function P5(t, e = {}) { const r = `0x${Number(t)}`; return typeof e.size == "number" ? (to(r, { size: e.size }), Tu(r, { size: e.size })) : r; } @@ -1182,8 +1182,8 @@ function I0(t, e = {}) { return xi(r, e); } const uD = /* @__PURE__ */ new TextEncoder(); -function Sv(t, e = {}) { - return typeof t == "number" || typeof t == "bigint" ? lD(t, e) : typeof t == "boolean" ? fD(t, e) : va(t) ? Lo(t, e) : I5(t, e); +function Ev(t, e = {}) { + return typeof t == "number" || typeof t == "bigint" ? lD(t, e) : typeof t == "boolean" ? fD(t, e) : va(t) ? Lo(t, e) : M5(t, e); } function fD(t, e = {}) { const r = new Uint8Array(1); @@ -1197,7 +1197,7 @@ const go = { a: 97, f: 102 }; -function x2(t) { +function w2(t) { if (t >= go.zero && t <= go.nine) return t - go.zero; if (t >= go.A && t <= go.F) @@ -1212,7 +1212,7 @@ function Lo(t, e = {}) { n.length % 2 && (n = `0${n}`); const i = n.length / 2, s = new Uint8Array(i); for (let o = 0, a = 0; o < i; o++) { - const u = x2(n.charCodeAt(a++)), l = x2(n.charCodeAt(a++)); + const u = w2(n.charCodeAt(a++)), l = w2(n.charCodeAt(a++)); if (u === void 0 || l === void 0) throw new yt(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`); s[o] = u * 16 + l; @@ -1223,7 +1223,7 @@ function lD(t, e) { const r = Mr(t, e); return Lo(r); } -function I5(t, e = {}) { +function M5(t, e = {}) { const r = uD.encode(t); return typeof e.size == "number" ? (to(r, { size: e.size }), Tu(r, { dir: "right", size: e.size })) : r; } @@ -1240,7 +1240,7 @@ function Ll(t, ...e) { if (e.length > 0 && !e.includes(t.length)) throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`); } -function gse(t) { +function mse(t) { if (typeof t != "function" || typeof t.create != "function") throw new Error("Hash should be wrapped by utils.wrapConstructor"); Wd(t.outputLen), Wd(t.blockLen); @@ -1251,15 +1251,15 @@ function Hd(t, e = !0) { if (e && t.finished) throw new Error("Hash#digest() has already been called"); } -function C5(t, e) { +function I5(t, e) { Ll(t); const r = e.outputLen; if (t.length < r) throw new Error(`digestInto() expects output buffer of length at least ${r}`); } -const rd = /* @__PURE__ */ BigInt(2 ** 32 - 1), _2 = /* @__PURE__ */ BigInt(32); +const rd = /* @__PURE__ */ BigInt(2 ** 32 - 1), x2 = /* @__PURE__ */ BigInt(32); function dD(t, e = !1) { - return e ? { h: Number(t & rd), l: Number(t >> _2 & rd) } : { h: Number(t >> _2 & rd) | 0, l: Number(t & rd) | 0 }; + return e ? { h: Number(t & rd), l: Number(t >> x2 & rd) } : { h: Number(t >> x2 & rd) | 0, l: Number(t & rd) | 0 }; } function pD(t, e = !1) { let r = new Uint32Array(t.length), n = new Uint32Array(t.length); @@ -1271,8 +1271,8 @@ function pD(t, e = !1) { } const gD = (t, e, r) => t << r | e >>> 32 - r, mD = (t, e, r) => e << r | t >>> 32 - r, vD = (t, e, r) => e << r - 32 | t >>> 64 - r, bD = (t, e, r) => t << r - 32 | e >>> 64 - r, qc = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0; /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -const yD = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), Bg = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), Ns = (t, e) => t << 32 - e | t >>> e, E2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, wD = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255; -function S2(t) { +const yD = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), Bg = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), Ns = (t, e) => t << 32 - e | t >>> e, _2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, wD = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255; +function E2(t) { for (let e = 0; e < t.length; e++) t[e] = wD(t[e]); } @@ -1292,7 +1292,7 @@ function ED(t) { function C0(t) { return typeof t == "string" && (t = ED(t)), Ll(t), t; } -function mse(...t) { +function vse(...t) { let e = 0; for (let n = 0; n < t.length; n++) { const i = t[n]; @@ -1305,13 +1305,13 @@ function mse(...t) { } return r; } -class T5 { +class C5 { // Safe version that clones internal state clone() { return this._cloneInto(); } } -function R5(t) { +function T5(t) { const e = (n) => t().update(C0(n)).digest(), r = t(); return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = () => t(), e; } @@ -1319,35 +1319,35 @@ function SD(t) { const e = (n, i) => t(i).update(C0(n)).digest(), r = t({}); return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = (n) => t(n), e; } -function vse(t = 32) { +function bse(t = 32) { if (qc && typeof qc.getRandomValues == "function") return qc.getRandomValues(new Uint8Array(t)); if (qc && typeof qc.randomBytes == "function") return qc.randomBytes(t); throw new Error("crypto.getRandomValues must be defined"); } -const D5 = [], O5 = [], N5 = [], AD = /* @__PURE__ */ BigInt(0), yf = /* @__PURE__ */ BigInt(1), PD = /* @__PURE__ */ BigInt(2), MD = /* @__PURE__ */ BigInt(7), ID = /* @__PURE__ */ BigInt(256), CD = /* @__PURE__ */ BigInt(113); +const R5 = [], D5 = [], O5 = [], AD = /* @__PURE__ */ BigInt(0), yf = /* @__PURE__ */ BigInt(1), PD = /* @__PURE__ */ BigInt(2), MD = /* @__PURE__ */ BigInt(7), ID = /* @__PURE__ */ BigInt(256), CD = /* @__PURE__ */ BigInt(113); for (let t = 0, e = yf, r = 1, n = 0; t < 24; t++) { - [r, n] = [n, (2 * r + 3 * n) % 5], D5.push(2 * (5 * n + r)), O5.push((t + 1) * (t + 2) / 2 % 64); + [r, n] = [n, (2 * r + 3 * n) % 5], R5.push(2 * (5 * n + r)), D5.push((t + 1) * (t + 2) / 2 % 64); let i = AD; for (let s = 0; s < 7; s++) e = (e << yf ^ (e >> MD) * CD) % ID, e & PD && (i ^= yf << (yf << /* @__PURE__ */ BigInt(s)) - yf); - N5.push(i); + O5.push(i); } -const [TD, RD] = /* @__PURE__ */ pD(N5, !0), A2 = (t, e, r) => r > 32 ? vD(t, e, r) : gD(t, e, r), P2 = (t, e, r) => r > 32 ? bD(t, e, r) : mD(t, e, r); -function L5(t, e = 24) { +const [TD, RD] = /* @__PURE__ */ pD(O5, !0), S2 = (t, e, r) => r > 32 ? vD(t, e, r) : gD(t, e, r), A2 = (t, e, r) => r > 32 ? bD(t, e, r) : mD(t, e, r); +function N5(t, e = 24) { const r = new Uint32Array(10); for (let n = 24 - e; n < 24; n++) { for (let o = 0; o < 10; o++) r[o] = t[o] ^ t[o + 10] ^ t[o + 20] ^ t[o + 30] ^ t[o + 40]; for (let o = 0; o < 10; o += 2) { - const a = (o + 8) % 10, u = (o + 2) % 10, l = r[u], d = r[u + 1], p = A2(l, d, 1) ^ r[a], w = P2(l, d, 1) ^ r[a + 1]; + const a = (o + 8) % 10, u = (o + 2) % 10, l = r[u], d = r[u + 1], p = S2(l, d, 1) ^ r[a], w = A2(l, d, 1) ^ r[a + 1]; for (let A = 0; A < 50; A += 10) t[o + A] ^= p, t[o + A + 1] ^= w; } let i = t[2], s = t[3]; for (let o = 0; o < 24; o++) { - const a = O5[o], u = A2(i, s, a), l = P2(i, s, a), d = D5[o]; + const a = D5[o], u = S2(i, s, a), l = A2(i, s, a), d = R5[o]; i = t[d], s = t[d + 1], t[d] = u, t[d + 1] = l; } for (let o = 0; o < 50; o += 10) { @@ -1360,7 +1360,7 @@ function L5(t, e = 24) { } r.fill(0); } -class kl extends T5 { +class kl extends C5 { // NOTE: we accept arguments in bytes instead of bits here. constructor(e, r, n, i = !1, s = 24) { if (super(), this.blockLen = e, this.suffix = r, this.outputLen = n, this.enableXOF = i, this.rounds = s, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, Wd(n), 0 >= this.blockLen || this.blockLen >= 200) @@ -1368,7 +1368,7 @@ class kl extends T5 { this.state = new Uint8Array(200), this.state32 = yD(this.state); } keccak() { - E2 || S2(this.state32), L5(this.state32, this.rounds), E2 || S2(this.state32), this.posOut = 0, this.pos = 0; + _2 || E2(this.state32), N5(this.state32, this.rounds), _2 || E2(this.state32), this.posOut = 0, this.pos = 0; } update(e) { Hd(this); @@ -1409,7 +1409,7 @@ class kl extends T5 { return Wd(e), this.xofInto(new Uint8Array(e)); } digestInto(e) { - if (C5(e, this), this.finished) + if (I5(e, this), this.finished) throw new Error("digest() was already called"); return this.writeInto(e), this.destroy(), e; } @@ -1424,12 +1424,12 @@ class kl extends T5 { return e || (e = new kl(r, n, i, o, s)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = s, e.suffix = n, e.outputLen = i, e.enableXOF = o, e.destroyed = this.destroyed, e; } } -const Aa = (t, e, r) => R5(() => new kl(e, t, r)), DD = /* @__PURE__ */ Aa(6, 144, 224 / 8), OD = /* @__PURE__ */ Aa(6, 136, 256 / 8), ND = /* @__PURE__ */ Aa(6, 104, 384 / 8), LD = /* @__PURE__ */ Aa(6, 72, 512 / 8), kD = /* @__PURE__ */ Aa(1, 144, 224 / 8), k5 = /* @__PURE__ */ Aa(1, 136, 256 / 8), $D = /* @__PURE__ */ Aa(1, 104, 384 / 8), BD = /* @__PURE__ */ Aa(1, 72, 512 / 8), $5 = (t, e, r) => SD((n = {}) => new kl(e, t, n.dkLen === void 0 ? r : n.dkLen, !0)), FD = /* @__PURE__ */ $5(31, 168, 128 / 8), jD = /* @__PURE__ */ $5(31, 136, 256 / 8), UD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +const Aa = (t, e, r) => T5(() => new kl(e, t, r)), DD = /* @__PURE__ */ Aa(6, 144, 224 / 8), OD = /* @__PURE__ */ Aa(6, 136, 256 / 8), ND = /* @__PURE__ */ Aa(6, 104, 384 / 8), LD = /* @__PURE__ */ Aa(6, 72, 512 / 8), kD = /* @__PURE__ */ Aa(1, 144, 224 / 8), L5 = /* @__PURE__ */ Aa(1, 136, 256 / 8), $D = /* @__PURE__ */ Aa(1, 104, 384 / 8), BD = /* @__PURE__ */ Aa(1, 72, 512 / 8), k5 = (t, e, r) => SD((n = {}) => new kl(e, t, n.dkLen === void 0 ? r : n.dkLen, !0)), FD = /* @__PURE__ */ k5(31, 168, 128 / 8), jD = /* @__PURE__ */ k5(31, 136, 256 / 8), UD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, Keccak: kl, - keccakP: L5, + keccakP: N5, keccak_224: kD, - keccak_256: k5, + keccak_256: L5, keccak_384: $D, keccak_512: BD, sha3_224: DD, @@ -1440,10 +1440,10 @@ const Aa = (t, e, r) => R5(() => new kl(e, t, r)), DD = /* @__PURE__ */ Aa(6, 14 shake256: jD }, Symbol.toStringTag, { value: "Module" })); function $l(t, e) { - const r = e || "hex", n = k5(va(t, { strict: !1 }) ? Sv(t) : t); + const r = e || "hex", n = L5(va(t, { strict: !1 }) ? Ev(t) : t); return r === "bytes" ? n : zd(n); } -const qD = (t) => $l(Sv(t)); +const qD = (t) => $l(Ev(t)); function zD(t) { return qD(t); } @@ -1476,10 +1476,10 @@ const HD = (t) => { const e = typeof t == "string" ? t : WR(t); return WD(e); }; -function B5(t) { +function $5(t) { return zD(HD(t)); } -const KD = B5; +const KD = $5; class yu extends yt { constructor({ address: e }) { super(`Address "${e}" is invalid.`, { @@ -1516,13 +1516,13 @@ const Fg = /* @__PURE__ */ new T0(8192); function Bl(t, e) { if (Fg.has(`${t}.${e}`)) return Fg.get(`${t}.${e}`); - const r = t.substring(2).toLowerCase(), n = $l(I5(r), "bytes"), i = r.split(""); + const r = t.substring(2).toLowerCase(), n = $l(M5(r), "bytes"), i = r.split(""); for (let o = 0; o < 40; o += 2) n[o >> 1] >> 4 >= 8 && i[o] && (i[o] = i[o].toUpperCase()), (n[o >> 1] & 15) >= 8 && i[o + 1] && (i[o + 1] = i[o + 1].toUpperCase()); const s = `0x${i.join("")}`; return Fg.set(`${t}.${e}`, s), s; } -function Av(t, e) { +function Sv(t, e) { if (!ko(t, { strict: !1 })) throw new yu({ address: t }); return Bl(t, e); @@ -1554,37 +1554,37 @@ function R0(t) { function Kd(t, e, r, { strict: n } = {}) { return va(t, { strict: !1 }) ? YD(t, e, r, { strict: n - }) : U5(t, e, r, { + }) : j5(t, e, r, { strict: n }); } -function F5(t, e) { +function B5(t, e) { if (typeof e == "number" && e > 0 && e > An(t) - 1) - throw new A5({ + throw new S5({ offset: e, position: "start", size: An(t) }); } -function j5(t, e, r) { +function F5(t, e, r) { if (typeof e == "number" && typeof r == "number" && An(t) !== r - e) - throw new A5({ + throw new S5({ offset: r, position: "end", size: An(t) }); } -function U5(t, e, r, { strict: n } = {}) { - F5(t, e); +function j5(t, e, r, { strict: n } = {}) { + B5(t, e); const i = t.slice(e, r); - return n && j5(i, e, r), i; + return n && F5(i, e, r), i; } function YD(t, e, r, { strict: n } = {}) { - F5(t, e); + B5(t, e); const i = `0x${t.replace("0x", "").slice((e ?? 0) * 2, (r ?? t.length) * 2)}`; - return n && j5(i, e, r), i; + return n && F5(i, e, r), i; } -function q5(t, e) { +function U5(t, e) { if (t.length !== e.length) throw new JR({ expectedLength: t.length, @@ -1593,17 +1593,17 @@ function q5(t, e) { const r = JD({ params: t, values: e - }), n = Mv(r); + }), n = Pv(r); return n.length === 0 ? "0x" : n; } function JD({ params: t, values: e }) { const r = []; for (let n = 0; n < t.length; n++) - r.push(Pv({ param: t[n], value: e[n] })); + r.push(Av({ param: t[n], value: e[n] })); return r; } -function Pv({ param: t, value: e }) { - const r = Iv(t.type); +function Av({ param: t, value: e }) { + const r = Mv(t.type); if (r) { const [n, i] = r; return ZD(e, { length: n, param: { ...t, type: i } }); @@ -1628,7 +1628,7 @@ function Pv({ param: t, value: e }) { docsPath: "/docs/contract/encodeAbiParameters" }); } -function Mv(t) { +function Pv(t) { let e = 0; for (let s = 0; s < t.length; s++) { const { dynamic: o, encoded: a } = t[s]; @@ -1660,11 +1660,11 @@ function ZD(t, { length: e, param: r }) { let i = !1; const s = []; for (let o = 0; o < t.length; o++) { - const a = Pv({ param: r, value: t[o] }); + const a = Av({ param: r, value: t[o] }); a.dynamic && (i = !0), s.push(a); } if (n || i) { - const o = Mv(s); + const o = Pv(s); if (n) { const a = Mr(s.length, { size: 32 }); return { @@ -1702,7 +1702,7 @@ function QD(t, { param: e }) { function eO(t) { if (typeof t != "boolean") throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`); - return { dynamic: !1, encoded: ma(M5(t)) }; + return { dynamic: !1, encoded: ma(P5(t)) }; } function tO(t, { signed: e }) { return { @@ -1731,7 +1731,7 @@ function nO(t, { param: e }) { let r = !1; const n = []; for (let i = 0; i < e.components.length; i++) { - const s = e.components[i], o = Array.isArray(t) ? i : s.name, a = Pv({ + const s = e.components[i], o = Array.isArray(t) ? i : s.name, a = Av({ param: s, value: t[o] }); @@ -1739,19 +1739,19 @@ function nO(t, { param: e }) { } return { dynamic: r, - encoded: r ? Mv(n) : wu(n.map(({ encoded: i }) => i)) + encoded: r ? Pv(n) : wu(n.map(({ encoded: i }) => i)) }; } -function Iv(t) { +function Mv(t) { const e = t.match(/^(.*)\[(\d+)?\]$/); return e ? ( // Return `null` if the array is dynamic. [e[2] ? Number(e[2]) : null, e[1]] ) : void 0; } -const Cv = (t) => Kd(B5(t), 0, 4); -function z5(t) { - const { abi: e, args: r = [], name: n } = t, i = va(n, { strict: !1 }), s = e.filter((a) => i ? a.type === "function" ? Cv(a) === n : a.type === "event" ? KD(a) === n : !1 : "name" in a && a.name === n); +const Iv = (t) => Kd($5(t), 0, 4); +function q5(t) { + const { abi: e, args: r = [], name: n } = t, i = va(n, { strict: !1 }), s = e.filter((a) => i ? a.type === "function" ? Iv(a) === n : a.type === "event" ? KD(a) === n : !1 : "name" in a && a.name === n); if (s.length === 0) return; if (s.length === 1) @@ -1772,7 +1772,7 @@ function z5(t) { return p ? Xm(l, p) : !1; })) { if (o && "inputs" in o && o.inputs) { - const l = W5(a.inputs, o.inputs, r); + const l = z5(a.inputs, o.inputs, r); if (l) throw new XR({ abiItem: a, @@ -1806,11 +1806,11 @@ function Xm(t, e) { })) : !1; } } -function W5(t, e, r) { +function z5(t, e, r) { for (const n in t) { const i = t[n], s = e[n]; if (i.type === "tuple" && s.type === "tuple" && "components" in i && "components" in s) - return W5(i.components, s.components, r[n]); + return z5(i.components, s.components, r[n]); const o = [i.type, s.type]; if (o.includes("address") && o.includes("bytes20") ? !0 : o.includes("address") && o.includes("string") ? ko(r[n], { strict: !1 }) : o.includes("address") && o.includes("bytes") ? ko(r[n], { strict: !1 }) : !1) return o; @@ -1819,32 +1819,32 @@ function W5(t, e, r) { function qo(t) { return typeof t == "string" ? { address: t, type: "json-rpc" } : t; } -const M2 = "/docs/contract/encodeFunctionData"; +const P2 = "/docs/contract/encodeFunctionData"; function iO(t) { const { abi: e, args: r, functionName: n } = t; let i = e[0]; if (n) { - const s = z5({ + const s = q5({ abi: e, args: r, name: n }); if (!s) - throw new y2(n, { docsPath: M2 }); + throw new b2(n, { docsPath: P2 }); i = s; } if (i.type !== "function") - throw new y2(void 0, { docsPath: M2 }); + throw new b2(void 0, { docsPath: P2 }); return { abi: [i], - functionName: Cv(vu(i)) + functionName: Iv(vu(i)) }; } function sO(t) { const { args: e } = t, { abi: r, functionName: n } = (() => { var a; return t.abi.length === 1 && ((a = t.functionName) != null && a.startsWith("0x")) ? t : iO(t); - })(), i = r[0], s = n, o = "inputs" in i && i.inputs ? q5(i.inputs, e ?? []) : void 0; + })(), i = r[0], s = n, o = "inputs" in i && i.inputs ? U5(i.inputs, e ?? []) : void 0; return R0([s, o ?? "0x"]); } const oO = { @@ -1876,7 +1876,7 @@ const oO = { name: "Panic", type: "error" }; -class I2 extends yt { +class M2 extends yt { constructor({ offset: e }) { super(`Offset \`${e}\` cannot be negative.`, { name: "NegativeOffsetError" @@ -1916,7 +1916,7 @@ const lO = { }, decrementPosition(t) { if (t < 0) - throw new I2({ offset: t }); + throw new M2({ offset: t }); const e = this.position - t; this.assertPosition(e), this.position = e; }, @@ -1925,7 +1925,7 @@ const lO = { }, incrementPosition(t) { if (t < 0) - throw new I2({ offset: t }); + throw new M2({ offset: t }); const e = this.position + t; this.assertPosition(e), this.position = e; }, @@ -2015,7 +2015,7 @@ const lO = { this.positionReadCount.set(this.position, t + 1), t > 0 && this.recursiveReadCount++; } }; -function Tv(t, { recursiveReadLimit: e = 8192 } = {}) { +function Cv(t, { recursiveReadLimit: e = 8192 } = {}) { const r = Object.create(lO); return r.bytes = t, r.dataView = new DataView(t.buffer, t.byteOffset, t.byteLength), r.positionReadCount = /* @__PURE__ */ new Map(), r.recursiveReadLimit = e, r; } @@ -2026,7 +2026,7 @@ function hO(t, e = {}) { } function dO(t, e = {}) { let r = t; - if (typeof e.size < "u" && (to(r, { size: e.size }), r = Ev(r)), r.length > 1 || r[0] > 1) + if (typeof e.size < "u" && (to(r, { size: e.size }), r = _v(r)), r.length > 1 || r[0] > 1) throw new sD(r); return !!r[0]; } @@ -2037,12 +2037,12 @@ function Io(t, e = {}) { } function pO(t, e = {}) { let r = t; - return typeof e.size < "u" && (to(r, { size: e.size }), r = Ev(r, { dir: "right" })), new TextDecoder().decode(r); + return typeof e.size < "u" && (to(r, { size: e.size }), r = _v(r, { dir: "right" })), new TextDecoder().decode(r); } function gO(t, e) { - const r = typeof e == "string" ? Lo(e) : e, n = Tv(r); + const r = typeof e == "string" ? Lo(e) : e, n = Cv(r); if (An(r) === 0 && t.length > 0) - throw new _v(); + throw new xv(); if (An(e) && An(e) < 32) throw new VR({ data: typeof e == "string" ? e : xi(e), @@ -2062,7 +2062,7 @@ function gO(t, e) { return s; } function au(t, e, { staticPosition: r }) { - const n = Iv(e.type); + const n = Mv(e.type); if (n) { const [i, s] = n; return vO(t, { ...e, type: s }, { length: i, staticPosition: r }); @@ -2083,16 +2083,16 @@ function au(t, e, { staticPosition: r }) { docsPath: "/docs/contract/decodeAbiParameters" }); } -const C2 = 32, Zm = 32; +const I2 = 32, Zm = 32; function mO(t) { const e = t.readBytes(32); - return [Bl(xi(U5(e, -20))), 32]; + return [Bl(xi(j5(e, -20))), 32]; } function vO(t, e, { length: r, staticPosition: n }) { if (!r) { - const o = Io(t.readBytes(Zm)), a = n + o, u = a + C2; + const o = Io(t.readBytes(Zm)), a = n + o, u = a + I2; t.setPosition(a); - const l = Io(t.readBytes(C2)), d = tl(e); + const l = Io(t.readBytes(I2)), d = tl(e); let p = 0; const w = []; for (let A = 0; A < l; ++A) { @@ -2177,7 +2177,7 @@ function _O(t, { staticPosition: e }) { const i = Io(t.readBytes(32)); if (i === 0) return t.setPosition(e + 32), ["", 32]; - const s = t.readBytes(i, 32), o = pO(Ev(s)); + const s = t.readBytes(i, 32), o = pO(_v(s)); return t.setPosition(e + 32), [o, 32]; } function tl(t) { @@ -2187,16 +2187,16 @@ function tl(t) { return !0; if (e === "tuple") return (n = t.components) == null ? void 0 : n.some(tl); - const r = Iv(t.type); + const r = Mv(t.type); return !!(r && tl({ ...t, type: r[1] })); } function EO(t) { const { abi: e, data: r } = t, n = Kd(r, 0, 4); if (n === "0x") - throw new _v(); - const s = [...e || [], aO, cO].find((o) => o.type === "error" && n === Cv(vu(o))); + throw new xv(); + const s = [...e || [], aO, cO].find((o) => o.type === "error" && n === Iv(vu(o))); if (!s) - throw new S5(n, { + throw new E5(n, { docsPath: "/docs/contract/decodeErrorResult" }); return { @@ -2206,7 +2206,7 @@ function EO(t) { }; } const Ru = (t, e, r) => JSON.stringify(t, (n, i) => typeof i == "bigint" ? i.toString() : i, r); -function H5({ abiItem: t, args: e, includeFunctionName: r = !0, includeName: n = !1 }) { +function W5({ abiItem: t, args: e, includeFunctionName: r = !0, includeName: n = !1 }) { if ("name" in t && "inputs" in t && t.inputs) return `${r ? t.name : ""}(${t.inputs.map((i, s) => `${n && i.name ? `${i.name}: ` : ""}${typeof e[s] == "object" ? Ru(e[s]) : e[s]}`).join(", ")})`; } @@ -2217,7 +2217,7 @@ const SO = { ether: -9, wei: 9 }; -function K5(t, e) { +function H5(t, e) { let r = t.toString(); const n = r.startsWith("-"); n && (r = r.slice(1)), r = r.padStart(e, "0"); @@ -2227,11 +2227,11 @@ function K5(t, e) { ]; return s = s.replace(/(0+)$/, ""), `${n ? "-" : ""}${i || "0"}${s ? `.${s}` : ""}`; } -function V5(t, e = "wei") { - return K5(t, SO[e]); +function K5(t, e = "wei") { + return H5(t, SO[e]); } function Es(t, e = "wei") { - return K5(t, AO[e]); + return H5(t, AO[e]); } class PO extends yt { constructor({ address: e }) { @@ -2289,7 +2289,7 @@ class TO extends yt { chain: i && `${i == null ? void 0 : i.name} (id: ${i == null ? void 0 : i.id})`, from: r == null ? void 0 : r.address, to: p, - value: typeof w < "u" && `${V5(w)} ${((M = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : M.symbol) || "ETH"}`, + value: typeof w < "u" && `${K5(w)} ${((M = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : M.symbol) || "ETH"}`, data: s, gas: o, gasPrice: typeof a < "u" && `${Es(a)} gwei`, @@ -2314,10 +2314,10 @@ class TO extends yt { }), this.cause = e; } } -const RO = (t) => t, G5 = (t) => t; +const RO = (t) => t, V5 = (t) => t; class DO extends yt { constructor(e, { abi: r, args: n, contractAddress: i, docsPath: s, functionName: o, sender: a }) { - const u = z5({ abi: r, args: n, name: o }), l = u ? H5({ + const u = q5({ abi: r, args: n, name: o }), l = u ? W5({ abiItem: u, args: n, includeFunctionName: !1, @@ -2388,7 +2388,7 @@ class OO extends yt { const [A] = w; u = oO[A]; } else { - const A = d ? vu(d, { includeName: !0 }) : void 0, M = d && w ? H5({ + const A = d ? vu(d, { includeName: !0 }) : void 0, M = d && w ? W5({ abiItem: d, args: w, includeFunctionName: !1, @@ -2404,7 +2404,7 @@ class OO extends yt { } else i && (u = i); let l; - s instanceof S5 && (l = s.signature, a = [ + s instanceof E5 && (l = s.signature, a = [ `Unable to decode signature "${l}" as it was not found on the provided ABI.`, "Make sure you are using the correct ABI and that the error exists on it.", `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.` @@ -2462,14 +2462,14 @@ class LO extends yt { }), this.data = e; } } -class Y5 extends yt { +class G5 extends yt { constructor({ body: e, cause: r, details: n, headers: i, status: s, url: o }) { super("HTTP request failed.", { cause: r, details: n, metaMessages: [ s && `Status: ${s}`, - `URL: ${G5(o)}`, + `URL: ${V5(o)}`, e && `Request body: ${Ru(e)}` ].filter(Boolean), name: "HttpRequestError" @@ -2501,7 +2501,7 @@ class kO extends yt { super("RPC Request failed.", { cause: r, details: r.message, - metaMessages: [`URL: ${G5(n)}`, `Request body: ${Ru(e)}`], + metaMessages: [`URL: ${V5(n)}`, `Request body: ${Ru(e)}`], name: "RpcRequestError" }), Object.defineProperty(this, "code", { enumerable: !0, @@ -2830,7 +2830,7 @@ class BO extends Si { } const FO = 3; function jO(t, { abi: e, address: r, args: n, docsPath: i, functionName: s, sender: o }) { - const { code: a, data: u, message: l, shortMessage: d } = t instanceof LO ? t : t instanceof yt ? t.walk((w) => "data" in w) || t.walk() : {}, p = t instanceof _v ? new NO({ functionName: s }) : [FO, uc.code].includes(a) && (u || l || d) ? new OO({ + const { code: a, data: u, message: l, shortMessage: d } = t instanceof LO ? t : t instanceof yt ? t.walk((w) => "data" in w) || t.walk() : {}, p = t instanceof xv ? new NO({ functionName: s }) : [FO, uc.code].includes(a) && (u || l || d) ? new OO({ abi: e, data: typeof u == "object" ? u.data : u, functionName: s, @@ -2850,17 +2850,17 @@ function UO(t) { return Bl(`0x${e}`); } async function qO({ hash: t, signature: e }) { - const r = va(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-DuMBhiq0.js"); + const r = va(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-CjFIzVvG.js"); return `0x${(() => { if (typeof e == "object" && "r" in e && "s" in e) { - const { r: l, s: d, v: p, yParity: w } = e, A = Number(w ?? p), M = T2(A); + const { r: l, s: d, v: p, yParity: w } = e, A = Number(w ?? p), M = C2(A); return new n.Signature(el(l), el(d)).addRecoveryBit(M); } - const o = va(e) ? e : zd(e), a = bu(`0x${o.slice(130)}`), u = T2(a); + const o = va(e) ? e : zd(e), a = bu(`0x${o.slice(130)}`), u = C2(a); return n.Signature.fromCompact(o.substring(2, 130)).addRecoveryBit(u); })().recoverPublicKey(r.substring(2)).toHex(!1)}`; } -function T2(t) { +function C2(t) { if (t === 0 || t === 1) return t; if (t === 27) @@ -2873,14 +2873,14 @@ async function zO({ hash: t, signature: e }) { return UO(await qO({ hash: t, signature: e })); } function WO(t, e = "hex") { - const r = J5(t), n = Tv(new Uint8Array(r.length)); + const r = Y5(t), n = Cv(new Uint8Array(r.length)); return r.encode(n), e === "hex" ? xi(n.bytes) : n.bytes; } -function J5(t) { - return Array.isArray(t) ? HO(t.map((e) => J5(e))) : KO(t); +function Y5(t) { + return Array.isArray(t) ? HO(t.map((e) => Y5(e))) : KO(t); } function HO(t) { - const e = t.reduce((i, s) => i + s.length, 0), r = X5(e); + const e = t.reduce((i, s) => i + s.length, 0), r = J5(e); return { length: e <= 55 ? 1 + e : 1 + r + e, encode(i) { @@ -2891,7 +2891,7 @@ function HO(t) { }; } function KO(t) { - const e = typeof t == "string" ? Lo(t) : t, r = X5(e.length); + const e = typeof t == "string" ? Lo(t) : t, r = J5(e.length); return { length: e.length === 1 && e[0] < 128 ? 1 : e.length <= 55 ? 1 + e.length : 1 + r + e.length, encode(i) { @@ -2899,7 +2899,7 @@ function KO(t) { } }; } -function X5(t) { +function J5(t) { if (t < 2 ** 8) return 1; if (t < 2 ** 16) @@ -2921,7 +2921,7 @@ function VO(t) { ])); return i === "bytes" ? Lo(s) : s; } -async function Z5(t) { +async function X5(t) { const { authorization: e, signature: r } = t; return zO({ hash: VO(e), @@ -2934,7 +2934,7 @@ class GO extends yt { const A = D0({ from: r == null ? void 0 : r.address, to: p, - value: typeof w < "u" && `${V5(w)} ${((M = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : M.symbol) || "ETH"}`, + value: typeof w < "u" && `${K5(w)} ${((M = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : M.symbol) || "ETH"}`, data: s, gas: o, gasPrice: typeof a < "u" && `${Es(a)} gwei`, @@ -3132,7 +3132,7 @@ Object.defineProperty(Gd, "nodeMessage", { writable: !0, value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/ }); -class Rv extends yt { +class Tv extends yt { constructor({ cause: e }) { super(`An error occurred while executing: ${e == null ? void 0 : e.shortMessage}`, { cause: e, @@ -3140,7 +3140,7 @@ class Rv extends yt { }); } } -function Q5(t, e) { +function Z5(t, e) { const r = (t.details || "").toLowerCase(), n = t instanceof yt ? t.walk((i) => (i == null ? void 0 : i.code) === Zc.code) : t; return n instanceof yt ? new Zc({ cause: t, @@ -3158,21 +3158,21 @@ function Q5(t, e) { cause: t, maxFeePerGas: e == null ? void 0 : e.maxFeePerGas, maxPriorityFeePerGas: e == null ? void 0 : e.maxPriorityFeePerGas - }) : new Rv({ + }) : new Tv({ cause: t }); } function YO(t, { docsPath: e, ...r }) { const n = (() => { - const i = Q5(t, r); - return i instanceof Rv ? t : i; + const i = Z5(t, r); + return i instanceof Tv ? t : i; })(); return new GO(n, { docsPath: e, ...r }); } -function e4(t, { format: e }) { +function Q5(t, { format: e }) { if (!e) return {}; const r = {}; @@ -3191,7 +3191,7 @@ const JO = { eip4844: "0x3", eip7702: "0x4" }; -function Dv(t) { +function Rv(t) { const e = {}; return typeof t.authorizationList < "u" && (e.authorizationList = XO(t.authorizationList)), typeof t.accessList < "u" && (e.accessList = t.accessList), typeof t.blobVersionedHashes < "u" && (e.blobVersionedHashes = t.blobVersionedHashes), typeof t.blobs < "u" && (typeof t.blobs[0] != "string" ? e.blobs = t.blobs.map((r) => xi(r)) : e.blobs = t.blobs), typeof t.data < "u" && (e.data = t.data), typeof t.from < "u" && (e.from = t.from), typeof t.gas < "u" && (e.gas = Mr(t.gas)), typeof t.gasPrice < "u" && (e.gasPrice = Mr(t.gasPrice)), typeof t.maxFeePerBlobGas < "u" && (e.maxFeePerBlobGas = Mr(t.maxFeePerBlobGas)), typeof t.maxFeePerGas < "u" && (e.maxFeePerGas = Mr(t.maxFeePerGas)), typeof t.maxPriorityFeePerGas < "u" && (e.maxPriorityFeePerGas = Mr(t.maxPriorityFeePerGas)), typeof t.nonce < "u" && (e.nonce = Mr(t.nonce)), typeof t.to < "u" && (e.to = t.to), typeof t.type < "u" && (e.type = JO[t.type]), typeof t.value < "u" && (e.value = Mr(t.value)), e; } @@ -3206,17 +3206,17 @@ function XO(t) { ...typeof e.v < "u" && typeof e.yParity > "u" ? { v: Mr(e.v) } : {} })); } -function R2(t) { +function T2(t) { if (!(!t || t.length === 0)) return t.reduce((e, { slot: r, value: n }) => { if (r.length !== 66) - throw new w2({ + throw new y2({ size: r.length, targetSize: 66, type: "hex" }); if (n.length !== 66) - throw new w2({ + throw new y2({ size: n.length, targetSize: 66, type: "hex" @@ -3226,10 +3226,10 @@ function R2(t) { } function ZO(t) { const { balance: e, nonce: r, state: n, stateDiff: i, code: s } = t, o = {}; - if (s !== void 0 && (o.code = s), e !== void 0 && (o.balance = Mr(e)), r !== void 0 && (o.nonce = Mr(r)), n !== void 0 && (o.state = R2(n)), i !== void 0) { + if (s !== void 0 && (o.code = s), e !== void 0 && (o.balance = Mr(e)), r !== void 0 && (o.nonce = Mr(r)), n !== void 0 && (o.state = T2(n)), i !== void 0) { if (o.state) throw new MO(); - o.stateDiff = R2(i); + o.stateDiff = T2(i); } return o; } @@ -3267,7 +3267,7 @@ class tN extends yt { }); } } -class Ov extends yt { +class Dv extends yt { constructor() { super("Chain does not support EIP-1559 fees.", { name: "Eip1559FeesNotSupportedError" @@ -3368,7 +3368,7 @@ async function Yd(t, { blockHash: e, blockNumber: r, blockTag: n, includeTransac throw new nN({ blockHash: e, blockNumber: r }); return (((w = (p = (d = t.chain) == null ? void 0 : d.formatters) == null ? void 0 : p.block) == null ? void 0 : w.format) || aN)(u); } -async function t4(t) { +async function e4(t) { const e = await t.request({ method: "eth_gasPrice" }); @@ -3380,7 +3380,7 @@ async function cN(t, e) { try { const a = ((s = n == null ? void 0 : n.fees) == null ? void 0 : s.maxPriorityFeePerGas) ?? ((o = n == null ? void 0 : n.fees) == null ? void 0 : o.defaultPriorityFee); if (typeof a == "function") { - const l = r || await yi(t, Yd, "getBlock")({}), d = await a({ + const l = r || await bi(t, Yd, "getBlock")({}), d = await a({ block: l, client: t, request: i @@ -3397,16 +3397,16 @@ async function cN(t, e) { return el(u); } catch { const [a, u] = await Promise.all([ - r ? Promise.resolve(r) : yi(t, Yd, "getBlock")({}), - yi(t, t4, "getGasPrice")({}) + r ? Promise.resolve(r) : bi(t, Yd, "getBlock")({}), + bi(t, e4, "getGasPrice")({}) ]); if (typeof a.baseFeePerGas != "bigint") - throw new Ov(); + throw new Dv(); const l = u - a.baseFeePerGas; return l < 0n ? 0n : l; } } -async function D2(t, e) { +async function R2(t, e) { var w, A; const { block: r, chain: n = t.chain, request: i, type: s = "eip1559" } = e || {}, o = await (async () => { var M, N; @@ -3418,7 +3418,7 @@ async function D2(t, e) { })(); if (o < 1) throw new tN(); - const u = 10 ** (((w = o.toString().split(".")[1]) == null ? void 0 : w.length) ?? 0), l = (M) => M * BigInt(Math.ceil(o * u)) / BigInt(u), d = r || await yi(t, Yd, "getBlock")({}); + const u = 10 ** (((w = o.toString().split(".")[1]) == null ? void 0 : w.length) ?? 0), l = (M) => M * BigInt(Math.ceil(o * u)) / BigInt(u), d = r || await bi(t, Yd, "getBlock")({}); if (typeof ((A = n == null ? void 0 : n.fees) == null ? void 0 : A.estimateFeesPerGas) == "function") { const M = await n.fees.estimateFeesPerGas({ block: r, @@ -3432,7 +3432,7 @@ async function D2(t, e) { } if (s === "eip1559") { if (typeof d.baseFeePerGas != "bigint") - throw new Ov(); + throw new Dv(); const M = typeof (i == null ? void 0 : i.maxPriorityFeePerGas) == "bigint" ? i.maxPriorityFeePerGas : await cN(t, { block: d, chain: n, @@ -3444,7 +3444,7 @@ async function D2(t, e) { }; } return { - gasPrice: (i == null ? void 0 : i.gasPrice) ?? l(await yi(t, t4, "getGasPrice")({})) + gasPrice: (i == null ? void 0 : i.gasPrice) ?? l(await bi(t, e4, "getGasPrice")({})) }; } async function uN(t, { address: e, blockTag: r = "latest", blockNumber: n }) { @@ -3454,13 +3454,13 @@ async function uN(t, { address: e, blockTag: r = "latest", blockNumber: n }) { }, { dedupe: !!n }); return bu(i); } -function r4(t) { +function t4(t) { const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((s) => Lo(s)) : t.blobs, i = []; for (const s of n) i.push(Uint8Array.from(e.blobToKzgCommitment(s))); return r === "bytes" ? i : i.map((s) => xi(s)); } -function n4(t) { +function r4(t) { const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((o) => Lo(o)) : t.blobs, i = typeof t.commitments[0] == "string" ? t.commitments.map((o) => Lo(o)) : t.commitments, s = []; for (let o = 0; o < n.length; o++) { const a = n[o], u = i[o]; @@ -3475,7 +3475,7 @@ function fN(t, e, r, n) { t.setUint32(e + u, o, n), t.setUint32(e + l, a, n); } const lN = (t, e, r) => t & e ^ ~t & r, hN = (t, e, r) => t & e ^ t & r ^ e & r; -class dN extends T5 { +class dN extends C5 { constructor(e, r, n, i) { super(), this.blockLen = e, this.outputLen = r, this.padOffset = n, this.isLE = i, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(e), this.view = Bg(this.buffer); } @@ -3497,7 +3497,7 @@ class dN extends T5 { return this.length += e.length, this.roundClean(), this; } digestInto(e) { - Hd(this), C5(e, this), this.finished = !0; + Hd(this), I5(e, this), this.finished = !0; const { buffer: r, view: n, blockLen: i, isLE: s } = this; let { pos: o } = this; r[o++] = 128, this.buffer.subarray(o).fill(0), this.padOffset > i - o && (this.process(n, 0), o = 0); @@ -3633,9 +3633,9 @@ let gN = class extends dN { this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0); } }; -const i4 = /* @__PURE__ */ R5(() => new gN()); +const n4 = /* @__PURE__ */ T5(() => new gN()); function mN(t, e) { - return i4(va(t, { strict: !1 }) ? Sv(t) : t); + return n4(va(t, { strict: !1 }) ? Ev(t) : t); } function vN(t) { const { commitment: e, version: r = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), i = mN(e); @@ -3651,9 +3651,9 @@ function bN(t) { })); return i; } -const O2 = 6, s4 = 32, Nv = 4096, o4 = s4 * Nv, N2 = o4 * O2 - // terminator byte (0x80). +const D2 = 6, i4 = 32, Ov = 4096, s4 = i4 * Ov, O2 = s4 * D2 - // terminator byte (0x80). 1 - // zero byte (0x00) appended to each field element. -1 * Nv * O2; +1 * Ov * D2; class yN extends yt { constructor({ maxSize: e, size: r }) { super("Blob size is too large.", { @@ -3671,18 +3671,18 @@ function xN(t) { const e = t.to ?? (typeof t.data == "string" ? "hex" : "bytes"), r = typeof t.data == "string" ? Lo(t.data) : t.data, n = An(r); if (!n) throw new wN(); - if (n > N2) + if (n > O2) throw new yN({ - maxSize: N2, + maxSize: O2, size: n }); const i = []; let s = !0, o = 0; for (; s; ) { - const a = Tv(new Uint8Array(o4)); + const a = Cv(new Uint8Array(s4)); let u = 0; - for (; u < Nv; ) { - const l = r.slice(o, o + (s4 - 1)); + for (; u < Ov; ) { + const l = r.slice(o, o + (i4 - 1)); if (a.pushByte(0), a.pushBytes(l), l.length < 31) { a.pushByte(128), s = !1; break; @@ -3694,7 +3694,7 @@ function xN(t) { return e === "bytes" ? i.map((a) => a.bytes) : i.map((a) => xi(a.bytes)); } function _N(t) { - const { data: e, kzg: r, to: n } = t, i = t.blobs ?? xN({ data: e, to: n }), s = t.commitments ?? r4({ blobs: i, kzg: r, to: n }), o = t.proofs ?? n4({ blobs: i, commitments: s, kzg: r, to: n }), a = []; + const { data: e, kzg: r, to: n } = t, i = t.blobs ?? xN({ data: e, to: n }), s = t.commitments ?? t4({ blobs: i, kzg: r, to: n }), o = t.proofs ?? r4({ blobs: i, commitments: s, kzg: r, to: n }), a = []; for (let u = 0; u < i.length; u++) a.push({ blob: i[u], @@ -3722,7 +3722,7 @@ async function N0(t) { }, { dedupe: !0 }); return bu(e); } -const a4 = [ +const o4 = [ "blobVersionedHashes", "chainId", "fees", @@ -3730,30 +3730,30 @@ const a4 = [ "nonce", "type" ]; -async function Lv(t, e) { - const { account: r = t.account, blobs: n, chain: i, gas: s, kzg: o, nonce: a, nonceManager: u, parameters: l = a4, type: d } = e, p = r && qo(r), w = { ...e, ...p ? { from: p == null ? void 0 : p.address } : {} }; +async function Nv(t, e) { + const { account: r = t.account, blobs: n, chain: i, gas: s, kzg: o, nonce: a, nonceManager: u, parameters: l = o4, type: d } = e, p = r && qo(r), w = { ...e, ...p ? { from: p == null ? void 0 : p.address } : {} }; let A; async function M() { - return A || (A = await yi(t, Yd, "getBlock")({ blockTag: "latest" }), A); + return A || (A = await bi(t, Yd, "getBlock")({ blockTag: "latest" }), A); } let N; async function L() { - return N || (i ? i.id : typeof e.chainId < "u" ? e.chainId : (N = await yi(t, N0, "getChainId")({}), N)); + return N || (i ? i.id : typeof e.chainId < "u" ? e.chainId : (N = await bi(t, N0, "getChainId")({}), N)); } if ((l.includes("blobVersionedHashes") || l.includes("sidecars")) && n && o) { - const $ = r4({ blobs: n, kzg: o }); + const B = t4({ blobs: n, kzg: o }); if (l.includes("blobVersionedHashes")) { - const B = bN({ - commitments: $, + const $ = bN({ + commitments: B, to: "hex" }); - w.blobVersionedHashes = B; + w.blobVersionedHashes = $; } if (l.includes("sidecars")) { - const B = n4({ blobs: n, commitments: $, kzg: o }), H = _N({ + const $ = r4({ blobs: n, commitments: B, kzg: o }), H = _N({ blobs: n, - commitments: $, - proofs: B, + commitments: B, + proofs: $, to: "hex" }); w.sidecars = H; @@ -3761,14 +3761,14 @@ async function Lv(t, e) { } if (l.includes("chainId") && (w.chainId = await L()), l.includes("nonce") && typeof a > "u" && p) if (u) { - const $ = await L(); + const B = await L(); w.nonce = await u.consume({ address: p.address, - chainId: $, + chainId: B, client: t }); } else - w.nonce = await yi(t, uN, "getTransactionCount")({ + w.nonce = await bi(t, uN, "getTransactionCount")({ address: p.address, blockTag: "pending" }); @@ -3776,14 +3776,14 @@ async function Lv(t, e) { try { w.type = EN(w); } catch { - const $ = await M(); - w.type = typeof ($ == null ? void 0 : $.baseFeePerGas) == "bigint" ? "eip1559" : "legacy"; + const B = await M(); + w.type = typeof (B == null ? void 0 : B.baseFeePerGas) == "bigint" ? "eip1559" : "legacy"; } if (l.includes("fees")) if (w.type !== "legacy" && w.type !== "eip2930") { if (typeof w.maxFeePerGas > "u" || typeof w.maxPriorityFeePerGas > "u") { - const $ = await M(), { maxFeePerGas: B, maxPriorityFeePerGas: H } = await D2(t, { - block: $, + const B = await M(), { maxFeePerGas: $, maxPriorityFeePerGas: H } = await R2(t, { + block: B, chain: i, request: w }); @@ -3791,20 +3791,20 @@ async function Lv(t, e) { throw new rN({ maxPriorityFeePerGas: H }); - w.maxPriorityFeePerGas = H, w.maxFeePerGas = B; + w.maxPriorityFeePerGas = H, w.maxFeePerGas = $; } } else { if (typeof e.maxFeePerGas < "u" || typeof e.maxPriorityFeePerGas < "u") - throw new Ov(); - const $ = await M(), { gasPrice: B } = await D2(t, { - block: $, + throw new Dv(); + const B = await M(), { gasPrice: $ } = await R2(t, { + block: B, chain: i, request: w, type: "legacy" }); - w.gasPrice = B; + w.gasPrice = $; } - return l.includes("gas") && typeof s > "u" && (w.gas = await yi(t, AN, "estimateGas")({ + return l.includes("gas") && typeof s > "u" && (w.gas = await bi(t, AN, "estimateGas")({ ...w, account: p && { address: p.address, type: "json-rpc" } })), O0(w), delete w.parameters, w; @@ -3827,7 +3827,7 @@ async function AN(t, e) { params: E ? [_, x ?? "latest", E] : x ? [_, x] : [_] }); }; - const { accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, blockNumber: p, blockTag: w, data: A, gas: M, gasPrice: N, maxFeePerBlobGas: L, maxFeePerGas: $, maxPriorityFeePerGas: B, nonce: H, value: U, stateOverride: V, ...te } = await Lv(t, { + const { accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, blockNumber: p, blockTag: w, data: A, gas: M, gasPrice: N, maxFeePerBlobGas: L, maxFeePerGas: B, maxPriorityFeePerGas: $, nonce: H, value: U, stateOverride: V, ...te } = await Nv(t, { ...e, parameters: ( // Some RPC Providers do not compute versioned hashes from blobs. We will need @@ -3838,16 +3838,16 @@ async function AN(t, e) { if (te.to) return te.to; if (u && u.length > 0) - return await Z5({ + return await X5({ authorization: u[0] }).catch(() => { throw new yt("`to` is required. Could not infer from `authorizationList`"); }); })(); O0(e); - const Y = (o = (s = (i = t.chain) == null ? void 0 : i.formatters) == null ? void 0 : s.transactionRequest) == null ? void 0 : o.format, m = (Y || Dv)({ + const Y = (o = (s = (i = t.chain) == null ? void 0 : i.formatters) == null ? void 0 : s.transactionRequest) == null ? void 0 : o.format, m = (Y || Rv)({ // Pick out extra data that might exist on the chain's transaction request type. - ...e4(te, { format: Y }), + ...Q5(te, { format: Y }), from: n == null ? void 0 : n.address, accessList: a, authorizationList: u, @@ -3857,8 +3857,8 @@ async function AN(t, e) { gas: M, gasPrice: N, maxFeePerBlobGas: L, - maxFeePerGas: $, - maxPriorityFeePerGas: B, + maxFeePerGas: B, + maxPriorityFeePerGas: $, nonce: H, to: Ee, value: U @@ -3921,10 +3921,10 @@ function IN(t) { if (!i) throw new KR({ docsPath: Ug }); if (!("inputs" in i)) - throw new b2({ docsPath: Ug }); + throw new v2({ docsPath: Ug }); if (!i.inputs || i.inputs.length === 0) - throw new b2({ docsPath: Ug }); - const s = q5(i.inputs, r); + throw new v2({ docsPath: Ug }); + const s = U5(i.inputs, r); return R0([n, s]); } async function CN(t) { @@ -3952,7 +3952,7 @@ class qg extends yt { }); } } -function c4({ chain: t, currentChainId: e }) { +function a4({ chain: t, currentChainId: e }) { if (!t) throw new MN(); if (e !== t.id) @@ -3960,23 +3960,23 @@ function c4({ chain: t, currentChainId: e }) { } function TN(t, { docsPath: e, ...r }) { const n = (() => { - const i = Q5(t, r); - return i instanceof Rv ? t : i; + const i = Z5(t, r); + return i instanceof Tv ? t : i; })(); return new TO(n, { docsPath: e, ...r }); } -async function u4(t, { serializedTransaction: e }) { +async function c4(t, { serializedTransaction: e }) { return t.request({ method: "eth_sendRawTransaction", params: [e] }, { retryCount: 0 }); } const zg = new T0(128); -async function kv(t, e) { - var $, B, H, U; +async function Lv(t, e) { + var B, $, H, U; const { account: r = t.account, chain: n = t.chain, accessList: i, authorizationList: s, blobs: o, data: a, gas: u, gasPrice: l, maxFeePerBlobGas: d, maxFeePerGas: p, maxPriorityFeePerGas: w, nonce: A, value: M, ...N } = e; if (typeof r > "u") throw new Fl({ @@ -3989,7 +3989,7 @@ async function kv(t, e) { if (e.to) return e.to; if (s && s.length > 0) - return await Z5({ + return await X5({ authorization: s[0] }).catch(() => { throw new yt("`to` is required. Could not infer from `authorizationList`."); @@ -3997,13 +3997,13 @@ async function kv(t, e) { })(); if ((L == null ? void 0 : L.type) === "json-rpc" || L === null) { let te; - n !== null && (te = await yi(t, N0, "getChainId")({}), c4({ + n !== null && (te = await bi(t, N0, "getChainId")({}), a4({ currentChainId: te, chain: n })); - const R = (H = (B = ($ = t.chain) == null ? void 0 : $.formatters) == null ? void 0 : B.transactionRequest) == null ? void 0 : H.format, ge = (R || Dv)({ + const R = (H = ($ = (B = t.chain) == null ? void 0 : B.formatters) == null ? void 0 : $.transactionRequest) == null ? void 0 : H.format, ge = (R || Rv)({ // Pick out extra data that might exist on the chain's transaction request type. - ...e4(N, { format: R }), + ...Q5(N, { format: R }), accessList: i, authorizationList: s, blobs: o, @@ -4040,7 +4040,7 @@ async function kv(t, e) { } } if ((L == null ? void 0 : L.type) === "local") { - const te = await yi(t, Lv, "prepareTransactionRequest")({ + const te = await bi(t, Nv, "prepareTransactionRequest")({ account: L, accessList: i, authorizationList: s, @@ -4054,14 +4054,14 @@ async function kv(t, e) { maxPriorityFeePerGas: w, nonce: A, nonceManager: L.nonceManager, - parameters: [...a4, "sidecars"], + parameters: [...o4, "sidecars"], value: M, ...N, to: V }), R = (U = n == null ? void 0 : n.serializers) == null ? void 0 : U.transaction, K = await L.signTransaction(te, { serializer: R }); - return await yi(t, u4, "sendRawTransaction")({ + return await bi(t, c4, "sendRawTransaction")({ serializedTransaction: K }); } @@ -4095,7 +4095,7 @@ async function RN(t, e) { functionName: a }); try { - return await yi(t, kv, "sendTransaction")({ + return await bi(t, Lv, "sendTransaction")({ data: `${d}${o ? o.replace("0x", "") : ""}`, to: i, account: l, @@ -4129,7 +4129,7 @@ async function DN(t, { chain: e }) { } const a1 = 256; let nd = a1, id; -function f4(t = 11) { +function u4(t = 11) { if (!id || nd + t > a1 * 2) { id = "", nd = 0; for (let e = 0; e < a1; e++) @@ -4153,14 +4153,14 @@ function ON(t) { request: p, transport: A, type: a, - uid: f4() + uid: u4() }; function N(L) { - return ($) => { - const B = $(L); + return (B) => { + const $ = B(L); for (const U in M) - delete B[U]; - const H = { ...L, ...B }; + delete $[U]; + const H = { ...L, ...$ }; return Object.assign(H, { extend: N(H) }); }; } @@ -4253,7 +4253,7 @@ function kN(t, e = {}) { }, { delay: ({ count: l, error: d }) => { var p; - if (d && d instanceof Y5) { + if (d && d instanceof G5) { const w = (p = d == null ? void 0 : d.headers) == null ? void 0 : p.get("Retry-After"); if (w != null && w.match(/\d/)) return Number.parseInt(w) * 1e3; @@ -4266,10 +4266,10 @@ function kN(t, e = {}) { }; } function $N(t) { - return "code" in t && typeof t.code == "number" ? t.code === -1 || t.code === xu.code || t.code === uc.code : t instanceof Y5 && t.status ? t.status === 403 || t.status === 408 || t.status === 413 || t.status === 429 || t.status === 500 || t.status === 502 || t.status === 503 || t.status === 504 : !0; + return "code" in t && typeof t.code == "number" ? t.code === -1 || t.code === xu.code || t.code === uc.code : t instanceof G5 && t.status ? t.status === 403 || t.status === 408 || t.status === 413 || t.status === 429 || t.status === 500 || t.status === 502 || t.status === 503 || t.status === 504 : !0; } function BN({ key: t, name: e, request: r, retryCount: n = 3, retryDelay: i = 150, timeout: s, type: o }, a) { - const u = f4(); + const u = u4(); return { config: { key: t, @@ -4338,10 +4338,10 @@ function KN(t) { for (const u of o) { const { name: l, type: d } = u, p = a[l], w = d.match(UN); if (w && (typeof p == "number" || typeof p == "bigint")) { - const [N, L, $] = w; + const [N, L, B] = w; Mr(p, { signed: L === "int", - size: Number.parseInt($) / 8 + size: Number.parseInt(B) / 8 }); } if (d === "address" && typeof p == "string" && !ko(p)) @@ -4391,7 +4391,7 @@ function GN(t) { } function YN(t, e) { const { abi: r, args: n, bytecode: i, ...s } = e, o = IN({ abi: r, args: n, bytecode: i }); - return kv(t, { + return Lv(t, { ...s, data: o }); @@ -4404,7 +4404,7 @@ async function XN(t) { return await t.request({ method: "wallet_getPermissions" }, { dedupe: !0 }); } async function ZN(t) { - return (await t.request({ method: "eth_requestAccounts" }, { dedupe: !0, retryCount: 0 })).map((r) => Av(r)); + return (await t.request({ method: "eth_requestAccounts" }, { dedupe: !0, retryCount: 0 })).map((r) => Sv(r)); } async function QN(t, e) { return t.request({ @@ -4438,12 +4438,12 @@ async function tL(t, e) { account: s, ...e }); - const o = await yi(t, N0, "getChainId")({}); - n !== null && c4({ + const o = await bi(t, N0, "getChainId")({}); + n !== null && a4({ currentChainId: o, chain: n }); - const a = (n == null ? void 0 : n.formatters) || ((l = t.chain) == null ? void 0 : l.formatters), u = ((d = a == null ? void 0 : a.transactionRequest) == null ? void 0 : d.format) || Dv; + const a = (n == null ? void 0 : n.formatters) || ((l = t.chain) == null ? void 0 : l.formatters), u = ((d = a == null ? void 0 : a.transactionRequest) == null ? void 0 : d.format) || Rv; return s.signTransaction ? s.signTransaction({ ...i, chainId: o @@ -4499,11 +4499,11 @@ function sL(t) { getAddresses: () => JN(t), getChainId: () => N0(t), getPermissions: () => XN(t), - prepareTransactionRequest: (e) => Lv(t, e), + prepareTransactionRequest: (e) => Nv(t, e), requestAddresses: () => ZN(t), requestPermissions: (e) => QN(t, e), - sendRawTransaction: (e) => u4(t, e), - sendTransaction: (e) => kv(t, e), + sendRawTransaction: (e) => c4(t, e), + sendTransaction: (e) => Lv(t, e), signMessage: (e) => eL(t, e), signTransaction: (e) => tL(t, e), signTypedData: (e) => rL(t, e), @@ -4543,7 +4543,7 @@ class vl { featured: !1 }; } else if ("info" in e) - console.log(e.info, "installed"), this._key = e.info.name, this._provider = e.provider, this._installed = !0, this._config = { + this._key = e.info.name, this._provider = e.provider, this._installed = !0, this._config = { name: e.info.name, image: e.info.icon, featured: !1 @@ -4617,7 +4617,7 @@ class vl { this._provider && "session" in this._provider && await this._provider.disconnect(), this._connected = !1, this._address = null; } } -var $v = { exports: {} }, uu = typeof Reflect == "object" ? Reflect : null, L2 = uu && typeof uu.apply == "function" ? uu.apply : function(e, r, n) { +var kv = { exports: {} }, uu = typeof Reflect == "object" ? Reflect : null, N2 = uu && typeof uu.apply == "function" ? uu.apply : function(e, r, n) { return Function.prototype.apply.call(e, r, n); }, xd; uu && typeof uu.ownKeys == "function" ? xd = uu.ownKeys : Object.getOwnPropertySymbols ? xd = function(e) { @@ -4628,19 +4628,19 @@ uu && typeof uu.ownKeys == "function" ? xd = uu.ownKeys : Object.getOwnPropertyS function aL(t) { console && console.warn && console.warn(t); } -var l4 = Number.isNaN || function(e) { +var f4 = Number.isNaN || function(e) { return e !== e; }; function kr() { kr.init.call(this); } -$v.exports = kr; -$v.exports.once = lL; +kv.exports = kr; +kv.exports.once = lL; kr.EventEmitter = kr; kr.prototype._events = void 0; kr.prototype._eventsCount = 0; kr.prototype._maxListeners = void 0; -var k2 = 10; +var L2 = 10; function L0(t) { if (typeof t != "function") throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof t); @@ -4648,27 +4648,27 @@ function L0(t) { Object.defineProperty(kr, "defaultMaxListeners", { enumerable: !0, get: function() { - return k2; + return L2; }, set: function(t) { - if (typeof t != "number" || t < 0 || l4(t)) + if (typeof t != "number" || t < 0 || f4(t)) throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + t + "."); - k2 = t; + L2 = t; } }); kr.init = function() { (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0; }; kr.prototype.setMaxListeners = function(e) { - if (typeof e != "number" || e < 0 || l4(e)) + if (typeof e != "number" || e < 0 || f4(e)) throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + "."); return this._maxListeners = e, this; }; -function h4(t) { +function l4(t) { return t._maxListeners === void 0 ? kr.defaultMaxListeners : t._maxListeners; } kr.prototype.getMaxListeners = function() { - return h4(this); + return l4(this); }; kr.prototype.emit = function(e) { for (var r = [], n = 1; n < arguments.length; n++) r.push(arguments[n]); @@ -4688,13 +4688,13 @@ kr.prototype.emit = function(e) { if (u === void 0) return !1; if (typeof u == "function") - L2(u, this, r); + N2(u, this, r); else - for (var l = u.length, d = v4(u, l), n = 0; n < l; ++n) - L2(d[n], this, r); + for (var l = u.length, d = m4(u, l), n = 0; n < l; ++n) + N2(d[n], this, r); return !0; }; -function d4(t, e, r, n) { +function h4(t, e, r, n) { var i, s, o; if (L0(r), s = t._events, s === void 0 ? (s = t._events = /* @__PURE__ */ Object.create(null), t._eventsCount = 0) : (s.newListener !== void 0 && (t.emit( "newListener", @@ -4702,7 +4702,7 @@ function d4(t, e, r, n) { r.listener ? r.listener : r ), s = t._events), o = s[e]), o === void 0) o = s[e] = r, ++t._eventsCount; - else if (typeof o == "function" ? o = s[e] = n ? [r, o] : [o, r] : n ? o.unshift(r) : o.push(r), i = h4(t), i > 0 && o.length > i && !o.warned) { + else if (typeof o == "function" ? o = s[e] = n ? [r, o] : [o, r] : n ? o.unshift(r) : o.push(r), i = l4(t), i > 0 && o.length > i && !o.warned) { o.warned = !0; var a = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit"); a.name = "MaxListenersExceededWarning", a.emitter = t, a.type = e, a.count = o.length, aL(a); @@ -4710,25 +4710,25 @@ function d4(t, e, r, n) { return t; } kr.prototype.addListener = function(e, r) { - return d4(this, e, r, !1); + return h4(this, e, r, !1); }; kr.prototype.on = kr.prototype.addListener; kr.prototype.prependListener = function(e, r) { - return d4(this, e, r, !0); + return h4(this, e, r, !0); }; function cL() { if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments); } -function p4(t, e, r) { +function d4(t, e, r) { var n = { fired: !1, wrapFn: void 0, target: t, type: e, listener: r }, i = cL.bind(n); return i.listener = r, n.wrapFn = i, i; } kr.prototype.once = function(e, r) { - return L0(r), this.on(e, p4(this, e, r)), this; + return L0(r), this.on(e, d4(this, e, r)), this; }; kr.prototype.prependOnceListener = function(e, r) { - return L0(r), this.prependListener(e, p4(this, e, r)), this; + return L0(r), this.prependListener(e, d4(this, e, r)), this; }; kr.prototype.removeListener = function(e, r) { var n, i, s, o, a; @@ -4770,24 +4770,24 @@ kr.prototype.removeAllListeners = function(e) { this.removeListener(e, r[i]); return this; }; -function g4(t, e, r) { +function p4(t, e, r) { var n = t._events; if (n === void 0) return []; var i = n[e]; - return i === void 0 ? [] : typeof i == "function" ? r ? [i.listener || i] : [i] : r ? fL(i) : v4(i, i.length); + return i === void 0 ? [] : typeof i == "function" ? r ? [i.listener || i] : [i] : r ? fL(i) : m4(i, i.length); } kr.prototype.listeners = function(e) { - return g4(this, e, !0); + return p4(this, e, !0); }; kr.prototype.rawListeners = function(e) { - return g4(this, e, !1); + return p4(this, e, !1); }; kr.listenerCount = function(t, e) { - return typeof t.listenerCount == "function" ? t.listenerCount(e) : m4.call(t, e); + return typeof t.listenerCount == "function" ? t.listenerCount(e) : g4.call(t, e); }; -kr.prototype.listenerCount = m4; -function m4(t) { +kr.prototype.listenerCount = g4; +function g4(t) { var e = this._events; if (e !== void 0) { var r = e[t]; @@ -4801,7 +4801,7 @@ function m4(t) { kr.prototype.eventNames = function() { return this._eventsCount > 0 ? xd(this._events) : []; }; -function v4(t, e) { +function m4(t, e) { for (var r = new Array(e), n = 0; n < e; ++n) r[n] = t[n]; return r; @@ -4824,13 +4824,13 @@ function lL(t, e) { function s() { typeof t.removeListener == "function" && t.removeListener("error", i), r([].slice.call(arguments)); } - b4(t, e, s, { once: !0 }), e !== "error" && hL(t, i, { once: !0 }); + v4(t, e, s, { once: !0 }), e !== "error" && hL(t, i, { once: !0 }); }); } function hL(t, e, r) { - typeof t.on == "function" && b4(t, "error", e, r); + typeof t.on == "function" && v4(t, "error", e, r); } -function b4(t, e, r, n) { +function v4(t, e, r, n) { if (typeof t.on == "function") n.once ? t.once(e, r) : t.on(e, r); else if (typeof t.addEventListener == "function") @@ -4840,8 +4840,8 @@ function b4(t, e, r, n) { else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof t); } -var rs = $v.exports; -const Bv = /* @__PURE__ */ ts(rs); +var rs = kv.exports; +const $v = /* @__PURE__ */ ts(rs); var mt = {}; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. @@ -5005,7 +5005,7 @@ function f1(t) { }; throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined."); } -function y4(t, e) { +function b4(t, e) { var r = typeof Symbol == "function" && t[Symbol.iterator]; if (!r) return t; var n = r.call(t), i, s = [], o; @@ -5024,7 +5024,7 @@ function y4(t, e) { } function _L() { for (var t = [], e = 0; e < arguments.length; e++) - t = t.concat(y4(arguments[e])); + t = t.concat(b4(arguments[e])); return t; } function EL() { @@ -5146,16 +5146,16 @@ const DL = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __makeTemplateObject: ML, __metadata: vL, __param: mL, - __read: y4, + __read: b4, __rest: pL, __spread: _L, __spreadArrays: EL, __values: f1 -}, Symbol.toStringTag, { value: "Module" })), jl = /* @__PURE__ */ wv(DL); -var Wg = {}, wf = {}, $2; +}, Symbol.toStringTag, { value: "Module" })), jl = /* @__PURE__ */ yv(DL); +var Wg = {}, wf = {}, k2; function OL() { - if ($2) return wf; - $2 = 1, Object.defineProperty(wf, "__esModule", { value: !0 }), wf.delay = void 0; + if (k2) return wf; + k2 = 1, Object.defineProperty(wf, "__esModule", { value: !0 }), wf.delay = void 0; function t(e) { return new Promise((r) => { setTimeout(() => { @@ -5165,29 +5165,29 @@ function OL() { } return wf.delay = t, wf; } -var qa = {}, Hg = {}, za = {}, B2; +var qa = {}, Hg = {}, za = {}, $2; function NL() { - return B2 || (B2 = 1, Object.defineProperty(za, "__esModule", { value: !0 }), za.ONE_THOUSAND = za.ONE_HUNDRED = void 0, za.ONE_HUNDRED = 100, za.ONE_THOUSAND = 1e3), za; + return $2 || ($2 = 1, Object.defineProperty(za, "__esModule", { value: !0 }), za.ONE_THOUSAND = za.ONE_HUNDRED = void 0, za.ONE_HUNDRED = 100, za.ONE_THOUSAND = 1e3), za; } -var Kg = {}, F2; +var Kg = {}, B2; function LL() { - return F2 || (F2 = 1, function(t) { + return B2 || (B2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.ONE_YEAR = t.FOUR_WEEKS = t.THREE_WEEKS = t.TWO_WEEKS = t.ONE_WEEK = t.THIRTY_DAYS = t.SEVEN_DAYS = t.FIVE_DAYS = t.THREE_DAYS = t.ONE_DAY = t.TWENTY_FOUR_HOURS = t.TWELVE_HOURS = t.SIX_HOURS = t.THREE_HOURS = t.ONE_HOUR = t.SIXTY_MINUTES = t.THIRTY_MINUTES = t.TEN_MINUTES = t.FIVE_MINUTES = t.ONE_MINUTE = t.SIXTY_SECONDS = t.THIRTY_SECONDS = t.TEN_SECONDS = t.FIVE_SECONDS = t.ONE_SECOND = void 0, t.ONE_SECOND = 1, t.FIVE_SECONDS = 5, t.TEN_SECONDS = 10, t.THIRTY_SECONDS = 30, t.SIXTY_SECONDS = 60, t.ONE_MINUTE = t.SIXTY_SECONDS, t.FIVE_MINUTES = t.ONE_MINUTE * 5, t.TEN_MINUTES = t.ONE_MINUTE * 10, t.THIRTY_MINUTES = t.ONE_MINUTE * 30, t.SIXTY_MINUTES = t.ONE_MINUTE * 60, t.ONE_HOUR = t.SIXTY_MINUTES, t.THREE_HOURS = t.ONE_HOUR * 3, t.SIX_HOURS = t.ONE_HOUR * 6, t.TWELVE_HOURS = t.ONE_HOUR * 12, t.TWENTY_FOUR_HOURS = t.ONE_HOUR * 24, t.ONE_DAY = t.TWENTY_FOUR_HOURS, t.THREE_DAYS = t.ONE_DAY * 3, t.FIVE_DAYS = t.ONE_DAY * 5, t.SEVEN_DAYS = t.ONE_DAY * 7, t.THIRTY_DAYS = t.ONE_DAY * 30, t.ONE_WEEK = t.SEVEN_DAYS, t.TWO_WEEKS = t.ONE_WEEK * 2, t.THREE_WEEKS = t.ONE_WEEK * 3, t.FOUR_WEEKS = t.ONE_WEEK * 4, t.ONE_YEAR = t.ONE_DAY * 365; }(Kg)), Kg; } -var j2; -function w4() { - return j2 || (j2 = 1, function(t) { +var F2; +function y4() { + return F2 || (F2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); const e = jl; e.__exportStar(NL(), t), e.__exportStar(LL(), t); }(Hg)), Hg; } -var U2; +var j2; function kL() { - if (U2) return qa; - U2 = 1, Object.defineProperty(qa, "__esModule", { value: !0 }), qa.fromMiliseconds = qa.toMiliseconds = void 0; - const t = w4(); + if (j2) return qa; + j2 = 1, Object.defineProperty(qa, "__esModule", { value: !0 }), qa.fromMiliseconds = qa.toMiliseconds = void 0; + const t = y4(); function e(n) { return n * t.ONE_THOUSAND; } @@ -5197,18 +5197,18 @@ function kL() { } return qa.fromMiliseconds = r, qa; } -var q2; +var U2; function $L() { - return q2 || (q2 = 1, function(t) { + return U2 || (U2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); const e = jl; e.__exportStar(OL(), t), e.__exportStar(kL(), t); }(Wg)), Wg; } -var zc = {}, z2; +var zc = {}, q2; function BL() { - if (z2) return zc; - z2 = 1, Object.defineProperty(zc, "__esModule", { value: !0 }), zc.Watch = void 0; + if (q2) return zc; + q2 = 1, Object.defineProperty(zc, "__esModule", { value: !0 }), zc.Watch = void 0; class t { constructor() { this.timestamps = /* @__PURE__ */ new Map(); @@ -5238,24 +5238,24 @@ function BL() { } return zc.Watch = t, zc.default = t, zc; } -var Vg = {}, xf = {}, W2; +var Vg = {}, xf = {}, z2; function FL() { - if (W2) return xf; - W2 = 1, Object.defineProperty(xf, "__esModule", { value: !0 }), xf.IWatch = void 0; + if (z2) return xf; + z2 = 1, Object.defineProperty(xf, "__esModule", { value: !0 }), xf.IWatch = void 0; class t { } return xf.IWatch = t, xf; } -var H2; +var W2; function jL() { - return H2 || (H2 = 1, function(t) { + return W2 || (W2 = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), jl.__exportStar(FL(), t); }(Vg)), Vg; } (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); const e = jl; - e.__exportStar($L(), t), e.__exportStar(BL(), t), e.__exportStar(jL(), t), e.__exportStar(w4(), t); + e.__exportStar($L(), t), e.__exportStar(BL(), t), e.__exportStar(jL(), t), e.__exportStar(y4(), t); })(mt); class vc { } @@ -5264,13 +5264,13 @@ let UL = class extends vc { super(); } }; -const K2 = mt.FIVE_SECONDS, Ou = { pulse: "heartbeat_pulse" }; -let qL = class x4 extends UL { +const H2 = mt.FIVE_SECONDS, Ou = { pulse: "heartbeat_pulse" }; +let qL = class w4 extends UL { constructor(e) { - super(e), this.events = new rs.EventEmitter(), this.interval = K2, this.interval = (e == null ? void 0 : e.interval) || K2; + super(e), this.events = new rs.EventEmitter(), this.interval = H2, this.interval = (e == null ? void 0 : e.interval) || H2; } static async init(e) { - const r = new x4(e); + const r = new w4(e); return await r.init(), r; } async init() { @@ -5380,7 +5380,7 @@ function _d(t) { return _d(t.toJSON()); throw new Error("[unstorage] Cannot stringify value!"); } -function _4() { +function x4() { if (typeof Buffer > "u") throw new TypeError("[unstorage] Buffer is not supported!"); } @@ -5388,21 +5388,21 @@ const l1 = "base64:"; function XL(t) { if (typeof t == "string") return t; - _4(); + x4(); const e = Buffer.from(t).toString("base64"); return l1 + e; } function ZL(t) { - return typeof t != "string" || !t.startsWith(l1) ? t : (_4(), Buffer.from(t.slice(l1.length), "base64")); + return typeof t != "string" || !t.startsWith(l1) ? t : (x4(), Buffer.from(t.slice(l1.length), "base64")); } -function gi(t) { +function pi(t) { return t ? t.split("?")[0].replace(/[/\\]/g, ":").replace(/:+/g, ":").replace(/^:|:$/g, "") : ""; } function QL(...t) { - return gi(t.join(":")); + return pi(t.join(":")); } function ad(t) { - return t = gi(t), t ? t + ":" : ""; + return t = pi(t), t ? t + ":" : ""; } const ek = "memory", tk = () => { const t = /* @__PURE__ */ new Map(); @@ -5466,7 +5466,7 @@ function rk(t = {}) { driver: e.mounts[p] })), i = (l, d) => { if (e.watching) { - d = gi(d); + d = pi(d); for (const p of e.watchListeners) p(l, d); } @@ -5474,7 +5474,7 @@ function rk(t = {}) { if (!e.watching) { e.watching = !0; for (const l in e.mounts) - e.unwatch[l] = await V2( + e.unwatch[l] = await K2( e.mounts[l], i, l @@ -5496,12 +5496,12 @@ function rk(t = {}) { }, w.set(M.base, N)), N; }; for (const M of l) { - const N = typeof M == "string", L = gi(N ? M : M.key), $ = N ? void 0 : M.value, B = N || !M.options ? d : { ...d, ...M.options }, H = r(L); + const N = typeof M == "string", L = pi(N ? M : M.key), B = N ? void 0 : M.value, $ = N || !M.options ? d : { ...d, ...M.options }, H = r(L); A(H).items.push({ key: L, - value: $, + value: B, relativeKey: H.relativeKey, - options: B + options: $ }); } return Promise.all([...w.values()].map((M) => p(M))).then( @@ -5510,12 +5510,12 @@ function rk(t = {}) { }, u = { // Item hasItem(l, d = {}) { - l = gi(l); + l = pi(l); const { relativeKey: p, driver: w } = r(l); return Cn(w.hasItem, p, d); }, getItem(l, d = {}) { - l = gi(l); + l = pi(l); const { relativeKey: p, driver: w } = r(l); return Cn(w.getItem, p, d).then( (A) => od(A) @@ -5546,7 +5546,7 @@ function rk(t = {}) { )); }, getItemRaw(l, d = {}) { - l = gi(l); + l = pi(l); const { relativeKey: p, driver: w } = r(l); return w.getItemRaw ? Cn(w.getItemRaw, p, d) : Cn(w.getItem, p, d).then( (A) => ZL(A) @@ -5555,7 +5555,7 @@ function rk(t = {}) { async setItem(l, d, p = {}) { if (d === void 0) return u.removeItem(l); - l = gi(l); + l = pi(l); const { relativeKey: w, driver: A } = r(l); A.setItem && (await Cn(A.setItem, w, _d(d), p), A.watch || i("update", l)); }, @@ -5584,7 +5584,7 @@ function rk(t = {}) { async setItemRaw(l, d, p = {}) { if (d === void 0) return u.removeItem(l, p); - l = gi(l); + l = pi(l); const { relativeKey: w, driver: A } = r(l); if (A.setItemRaw) await Cn(A.setItemRaw, w, d, p); @@ -5595,13 +5595,13 @@ function rk(t = {}) { A.watch || i("update", l); }, async removeItem(l, d = {}) { - typeof d == "boolean" && (d = { removeMeta: d }), l = gi(l); + typeof d == "boolean" && (d = { removeMeta: d }), l = pi(l); const { relativeKey: p, driver: w } = r(l); w.removeItem && (await Cn(w.removeItem, p, d), (d.removeMeta || d.removeMata) && await Cn(w.removeItem, p + "$", d), w.watch || i("remove", l)); }, // Meta async getMeta(l, d = {}) { - typeof d == "boolean" && (d = { nativeOnly: d }), l = gi(l); + typeof d == "boolean" && (d = { nativeOnly: d }), l = pi(l); const { relativeKey: p, driver: w } = r(l), A = /* @__PURE__ */ Object.create(null); if (w.getMeta && Object.assign(A, await Cn(w.getMeta, p, d)), !d.nativeOnly) { const M = await Cn( @@ -5632,8 +5632,8 @@ function rk(t = {}) { d ); for (const L of N) { - const $ = M.mountpoint + gi(L); - w.some((B) => $.startsWith(B)) || A.push($); + const B = M.mountpoint + pi(L); + w.some(($) => B.startsWith($)) || A.push(B); } w = [ M.mountpoint, @@ -5661,7 +5661,7 @@ function rk(t = {}) { }, async dispose() { await Promise.all( - Object.values(e.mounts).map((l) => G2(l)) + Object.values(e.mounts).map((l) => V2(l)) ); }, async watch(l) { @@ -5678,15 +5678,15 @@ function rk(t = {}) { mount(l, d) { if (l = ad(l), l && e.mounts[l]) throw new Error(`already mounted at ${l}`); - return l && (e.mountpoints.push(l), e.mountpoints.sort((p, w) => w.length - p.length)), e.mounts[l] = d, e.watching && Promise.resolve(V2(d, i, l)).then((p) => { + return l && (e.mountpoints.push(l), e.mountpoints.sort((p, w) => w.length - p.length)), e.mounts[l] = d, e.watching && Promise.resolve(K2(d, i, l)).then((p) => { e.unwatch[l] = p; }).catch(console.error), u; }, async unmount(l, d = !0) { - l = ad(l), !(!l || !e.mounts[l]) && (e.watching && l in e.unwatch && (e.unwatch[l](), delete e.unwatch[l]), d && await G2(e.mounts[l]), e.mountpoints = e.mountpoints.filter((p) => p !== l), delete e.mounts[l]); + l = ad(l), !(!l || !e.mounts[l]) && (e.watching && l in e.unwatch && (e.unwatch[l](), delete e.unwatch[l]), d && await V2(e.mounts[l]), e.mountpoints = e.mountpoints.filter((p) => p !== l), delete e.mounts[l]); }, getMount(l = "") { - l = gi(l) + ":"; + l = pi(l) + ":"; const d = r(l); return { driver: d.driver, @@ -5694,7 +5694,7 @@ function rk(t = {}) { }; }, getMounts(l = "", d = {}) { - return l = gi(l), n(l, d.parents).map((w) => ({ + return l = pi(l), n(l, d.parents).map((w) => ({ driver: w.driver, base: w.mountpoint })); @@ -5709,11 +5709,11 @@ function rk(t = {}) { }; return u; } -function V2(t, e, r) { +function K2(t, e, r) { return t.watch ? t.watch((n, i) => e(n, r + i)) : () => { }; } -async function G2(t) { +async function V2(t) { typeof t.dispose == "function" && await Cn(t.dispose); } function bc(t) { @@ -5721,7 +5721,7 @@ function bc(t) { t.oncomplete = t.onsuccess = () => e(t.result), t.onabort = t.onerror = () => r(t.error); }); } -function E4(t, e) { +function _4(t, e) { const r = indexedDB.open(t); r.onupgradeneeded = () => r.result.createObjectStore(e); const n = bc(r); @@ -5729,9 +5729,9 @@ function E4(t, e) { } let Gg; function Ul() { - return Gg || (Gg = E4("keyval-store", "keyval")), Gg; + return Gg || (Gg = _4("keyval-store", "keyval")), Gg; } -function Y2(t, e = Ul()) { +function G2(t, e = Ul()) { return e("readonly", (r) => bc(r.get(t))); } function nk(t, e, r = Ul()) { @@ -5776,10 +5776,10 @@ const fk = "idb-keyval"; var lk = (t = {}) => { const e = t.base && t.base.length > 0 ? `${t.base}:` : "", r = (i) => e + i; let n; - return t.dbName && t.storeName && (n = E4(t.dbName, t.storeName)), { name: fk, options: t, async hasItem(i) { - return !(typeof await Y2(r(i), n) > "u"); + return t.dbName && t.storeName && (n = _4(t.dbName, t.storeName)), { name: fk, options: t, async hasItem(i) { + return !(typeof await G2(r(i), n) > "u"); }, async getItem(i) { - return await Y2(r(i), n) ?? null; + return await G2(r(i), n) ?? null; }, setItem(i, s) { return nk(r(i), s, n); }, removeItem(i) { @@ -5859,9 +5859,9 @@ let mk = class { this.localStorage.removeItem(e); } }; -const vk = "wc_storage_version", J2 = 1, bk = async (t, e, r) => { +const vk = "wc_storage_version", Y2 = 1, bk = async (t, e, r) => { const n = vk, i = await e.getItem(n); - if (i && i >= J2) { + if (i && i >= Y2) { r(e); return; } @@ -5880,7 +5880,7 @@ const vk = "wc_storage_version", J2 = 1, bk = async (t, e, r) => { await e.setItem(a, l), o.push(a); } } - await e.setItem(n, J2), r(e), yk(t, o); + await e.setItem(n, Y2), r(e), yk(t, o); }, yk = async (t, e) => { e.length && e.forEach(async (r) => { await t.removeItem(r); @@ -5989,7 +5989,7 @@ function Ek(t, e, r) { } return p === -1 ? t : (p < w && (l += t.slice(p)), l); } -const X2 = _k; +const J2 = _k; var Jc = Bo; const yl = Ok().console || {}, Sk = { mapHttpRequest: cd, @@ -6050,11 +6050,11 @@ function Bo(t) { N = N || {}, i && M.serializers && (N.serializers = M.serializers); const L = N.serializers; if (i && L) { - var $ = Object.assign({}, n, L), B = t.browser.serialize === !0 ? Object.keys($) : i; - delete M.serializers, k0([M], B, $, this._stdErrSerialize); + var B = Object.assign({}, n, L), $ = t.browser.serialize === !0 ? Object.keys(B) : i; + delete M.serializers, k0([M], $, B, this._stdErrSerialize); } function H(U) { - this._childLevel = (U._childLevel | 0) + 1, this.error = Hc(U, M, "error"), this.fatal = Hc(U, M, "fatal"), this.warn = Hc(U, M, "warn"), this.info = Hc(U, M, "info"), this.debug = Hc(U, M, "debug"), this.trace = Hc(U, M, "trace"), $ && (this.serializers = $, this._serialize = B), e && (this._logEvent = h1( + this._childLevel = (U._childLevel | 0) + 1, this.error = Hc(U, M, "error"), this.fatal = Hc(U, M, "fatal"), this.warn = Hc(U, M, "warn"), this.info = Hc(U, M, "info"), this.debug = Hc(U, M, "debug"), this.trace = Hc(U, M, "trace"), B && (this.serializers = B, this._serialize = $), e && (this._logEvent = h1( [].concat(U._logEvent.bindings, M) )); } @@ -6081,7 +6081,7 @@ Bo.levels = { } }; Bo.stdSerializers = Sk; -Bo.stdTimeFunctions = Object.assign({}, { nullTime: S4, epochTime: A4, unixTime: Rk, isoTime: Dk }); +Bo.stdTimeFunctions = Object.assign({}, { nullTime: E4, epochTime: S4, unixTime: Rk, isoTime: Dk }); function Wc(t, e, r, n) { const i = Object.getPrototypeOf(e); e[r] = e.levelVal > e.levels.values[r] ? wl : i[r] ? i[r] : yl[r] || yl[n] || wl, Pk(t, e, r); @@ -6115,8 +6115,8 @@ function Mk(t, e, r, n) { if (a < 1 && (a = 1), s !== null && typeof s == "object") { for (; a-- && typeof i[0] == "object"; ) Object.assign(o, i.shift()); - s = i.length ? X2(i.shift(), i) : void 0; - } else typeof s == "string" && (s = X2(i.shift(), i)); + s = i.length ? J2(i.shift(), i) : void 0; + } else typeof s == "string" && (s = J2(i.shift(), i)); return s !== void 0 && (o.msg = s), o; } function k0(t, e, r, n) { @@ -6166,7 +6166,7 @@ function Ck(t) { return e; } function Tk(t) { - return typeof t.timestamp == "function" ? t.timestamp : t.timestamp === !1 ? S4 : A4; + return typeof t.timestamp == "function" ? t.timestamp : t.timestamp === !1 ? E4 : S4; } function cd() { return {}; @@ -6176,10 +6176,10 @@ function Jg(t) { } function wl() { } -function S4() { +function E4() { return !1; } -function A4() { +function S4() { return Date.now(); } function Rk() { @@ -6203,7 +6203,7 @@ function Ok() { return t(self) || t(window) || t(this) || {}; } } -const ql = /* @__PURE__ */ ts(Jc), Nk = { level: "info" }, zl = "custom_context", Fv = 1e3 * 1024; +const ql = /* @__PURE__ */ ts(Jc), Nk = { level: "info" }, zl = "custom_context", Bv = 1e3 * 1024; let Lk = class { constructor(e) { this.nodeValue = e, this.sizeInBytes = new TextEncoder().encode(this.nodeValue).length, this.next = null; @@ -6214,7 +6214,7 @@ let Lk = class { get size() { return this.sizeInBytes; } -}, Z2 = class { +}, X2 = class { constructor(e) { this.head = null, this.tail = null, this.lengthInNodes = 0, this.maxSizeInBytes = e, this.sizeInBytes = 0; } @@ -6252,9 +6252,9 @@ let Lk = class { return e = e.next, { done: !1, value: r }; } }; } -}, P4 = class { - constructor(e, r = Fv) { - this.level = e ?? "error", this.levelValue = Jc.levels.values[this.level], this.MAX_LOG_SIZE_IN_BYTES = r, this.logs = new Z2(this.MAX_LOG_SIZE_IN_BYTES); +}, A4 = class { + constructor(e, r = Bv) { + this.level = e ?? "error", this.levelValue = Jc.levels.values[this.level], this.MAX_LOG_SIZE_IN_BYTES = r, this.logs = new X2(this.MAX_LOG_SIZE_IN_BYTES); } forwardToConsole(e, r) { r === Jc.levels.values.error ? console.error(e) : r === Jc.levels.values.warn ? console.warn(e) : r === Jc.levels.values.debug ? console.debug(e) : r === Jc.levels.values.trace ? console.trace(e) : console.log(e); @@ -6268,7 +6268,7 @@ let Lk = class { return this.logs; } clearLogs() { - this.logs = new Z2(this.MAX_LOG_SIZE_IN_BYTES); + this.logs = new X2(this.MAX_LOG_SIZE_IN_BYTES); } getLogArray() { return Array.from(this.logs); @@ -6278,8 +6278,8 @@ let Lk = class { return r.push($o({ extraMetadata: e })), new Blob(r, { type: "application/json" }); } }, kk = class { - constructor(e, r = Fv) { - this.baseChunkLogger = new P4(e, r); + constructor(e, r = Bv) { + this.baseChunkLogger = new A4(e, r); } write(e) { this.baseChunkLogger.appendToLogs(e); @@ -6301,8 +6301,8 @@ let Lk = class { n.href = r, n.download = `walletconnect-logs-${(/* @__PURE__ */ new Date()).toISOString()}.txt`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(r); } }, $k = class { - constructor(e, r = Fv) { - this.baseChunkLogger = new P4(e, r); + constructor(e, r = Bv) { + this.baseChunkLogger = new A4(e, r); } write(e) { this.baseChunkLogger.appendToLogs(e); @@ -6320,9 +6320,9 @@ let Lk = class { return this.baseChunkLogger.logsToBlob(e); } }; -var Bk = Object.defineProperty, Fk = Object.defineProperties, jk = Object.getOwnPropertyDescriptors, Q2 = Object.getOwnPropertySymbols, Uk = Object.prototype.hasOwnProperty, qk = Object.prototype.propertyIsEnumerable, ex = (t, e, r) => e in t ? Bk(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Jd = (t, e) => { - for (var r in e || (e = {})) Uk.call(e, r) && ex(t, r, e[r]); - if (Q2) for (var r of Q2(e)) qk.call(e, r) && ex(t, r, e[r]); +var Bk = Object.defineProperty, Fk = Object.defineProperties, jk = Object.getOwnPropertyDescriptors, Z2 = Object.getOwnPropertySymbols, Uk = Object.prototype.hasOwnProperty, qk = Object.prototype.propertyIsEnumerable, Q2 = (t, e, r) => e in t ? Bk(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Jd = (t, e) => { + for (var r in e || (e = {})) Uk.call(e, r) && Q2(t, r, e[r]); + if (Z2) for (var r of Z2(e)) qk.call(e, r) && Q2(t, r, e[r]); return t; }, Xd = (t, e) => Fk(t, jk(e)); function $0(t) { @@ -6342,7 +6342,7 @@ function Hk(t, e, r = zl) { const n = Ai(t, r); return n.trim() ? `${n}/${e}` : e; } -function ui(t, e, r = zl) { +function ci(t, e, r = zl) { const n = Hk(t, e, r), i = t.child({ context: n }); return Wk(i, n, r); } @@ -6412,10 +6412,10 @@ let Yk = class extends vc { this.client = e; } }; -var jv = {}, Pa = {}, B0 = {}, F0 = {}; +var Fv = {}, Pa = {}, B0 = {}, F0 = {}; Object.defineProperty(F0, "__esModule", { value: !0 }); F0.BrowserRandomSource = void 0; -const tx = 65536; +const ex = 65536; class c$ { constructor() { this.isAvailable = !1, this.isInstantiated = !1; @@ -6426,13 +6426,13 @@ class c$ { if (!this.isAvailable || !this._crypto) throw new Error("Browser random byte generator is not available."); const r = new Uint8Array(e); - for (let n = 0; n < r.length; n += tx) - this._crypto.getRandomValues(r.subarray(n, n + Math.min(r.length - n, tx))); + for (let n = 0; n < r.length; n += ex) + this._crypto.getRandomValues(r.subarray(n, n + Math.min(r.length - n, ex))); return r; } } F0.BrowserRandomSource = c$; -function M4(t) { +function P4(t) { throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } var j0 = {}, ki = {}; @@ -6446,13 +6446,13 @@ ki.wipe = u$; const f$ = {}, l$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: f$ -}, Symbol.toStringTag, { value: "Module" })), Wl = /* @__PURE__ */ wv(l$); +}, Symbol.toStringTag, { value: "Module" })), Wl = /* @__PURE__ */ yv(l$); Object.defineProperty(j0, "__esModule", { value: !0 }); j0.NodeRandomSource = void 0; const h$ = ki; class d$ { constructor() { - if (this.isAvailable = !1, this.isInstantiated = !1, typeof M4 < "u") { + if (this.isAvailable = !1, this.isInstantiated = !1, typeof P4 < "u") { const e = Wl; e && e.randomBytes && (this._crypto = e, this.isAvailable = !0, this.isInstantiated = !0); } @@ -6491,7 +6491,7 @@ class m$ { } } B0.SystemRandomSource = m$; -var ar = {}, I4 = {}; +var ar = {}, M4 = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); function e(a, u) { @@ -6521,9 +6521,9 @@ var ar = {}, I4 = {}; t.isInteger = Number.isInteger || o, t.MAX_SAFE_INTEGER = 9007199254740991, t.isSafeInteger = function(a) { return t.isInteger(a) && a >= -t.MAX_SAFE_INTEGER && a <= t.MAX_SAFE_INTEGER; }; -})(I4); +})(M4); Object.defineProperty(ar, "__esModule", { value: !0 }); -var C4 = I4; +var I4 = M4; function v$(t, e) { return e === void 0 && (e = 0), (t[e + 0] << 8 | t[e + 1]) << 16 >> 16; } @@ -6540,16 +6540,16 @@ function w$(t, e) { return e === void 0 && (e = 0), (t[e + 1] << 8 | t[e]) >>> 0; } ar.readUint16LE = w$; -function T4(t, e, r) { +function C4(t, e, r) { return e === void 0 && (e = new Uint8Array(2)), r === void 0 && (r = 0), e[r + 0] = t >>> 8, e[r + 1] = t >>> 0, e; } -ar.writeUint16BE = T4; -ar.writeInt16BE = T4; -function R4(t, e, r) { +ar.writeUint16BE = C4; +ar.writeInt16BE = C4; +function T4(t, e, r) { return e === void 0 && (e = new Uint8Array(2)), r === void 0 && (r = 0), e[r + 0] = t >>> 0, e[r + 1] = t >>> 8, e; } -ar.writeUint16LE = R4; -ar.writeInt16LE = R4; +ar.writeUint16LE = T4; +ar.writeInt16LE = T4; function d1(t, e) { return e === void 0 && (e = 0), t[e] << 24 | t[e + 1] << 16 | t[e + 2] << 8 | t[e + 3]; } @@ -6600,16 +6600,16 @@ function S$(t, e) { return n * 4294967296 + r; } ar.readUint64LE = S$; -function D4(t, e, r) { +function R4(t, e, r) { return e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0), Zd(t / 4294967296 >>> 0, e, r), Zd(t >>> 0, e, r + 4), e; } -ar.writeUint64BE = D4; -ar.writeInt64BE = D4; -function O4(t, e, r) { +ar.writeUint64BE = R4; +ar.writeInt64BE = R4; +function D4(t, e, r) { return e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0), Qd(t >>> 0, e, r), Qd(t / 4294967296 >>> 0, e, r + 4), e; } -ar.writeUint64LE = O4; -ar.writeInt64LE = O4; +ar.writeUint64LE = D4; +ar.writeInt64LE = D4; function A$(t, e, r) { if (r === void 0 && (r = 0), t % 8 !== 0) throw new Error("readUintBE supports only bitLengths divisible by 8"); @@ -6633,7 +6633,7 @@ ar.readUintLE = P$; function M$(t, e, r, n) { if (r === void 0 && (r = new Uint8Array(t / 8)), n === void 0 && (n = 0), t % 8 !== 0) throw new Error("writeUintBE supports only bitLengths divisible by 8"); - if (!C4.isSafeInteger(e)) + if (!I4.isSafeInteger(e)) throw new Error("writeUintBE value must be an integer"); for (var i = 1, s = t / 8 + n - 1; s >= n; s--) r[s] = e / i & 255, i *= 256; @@ -6643,7 +6643,7 @@ ar.writeUintBE = M$; function I$(t, e, r, n) { if (r === void 0 && (r = new Uint8Array(t / 8)), n === void 0 && (n = 0), t % 8 !== 0) throw new Error("writeUintLE supports only bitLengths divisible by 8"); - if (!C4.isSafeInteger(e)) + if (!I4.isSafeInteger(e)) throw new Error("writeUintLE value must be an integer"); for (var i = 1, s = n; s < n + t / 8; s++) r[s] = e / i & 255, i *= 256; @@ -6722,8 +6722,8 @@ ar.writeFloat64LE = k$; for (; l > 0; ) { const N = i(Math.ceil(l * 256 / M), p); for (let L = 0; L < N.length && l > 0; L++) { - const $ = N[L]; - $ < M && (w += d.charAt($ % A), l--); + const B = N[L]; + B < M && (w += d.charAt(B % A), l--); } (0, n.wipe)(N); } @@ -6736,7 +6736,7 @@ ar.writeFloat64LE = k$; } t.randomStringForEntropy = u; })(Pa); -var N4 = {}; +var O4 = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); var e = ar, r = ki; @@ -6960,18 +6960,18 @@ var N4 = {}; 1246189591 ]); function s(a, u, l, d, p, w, A) { - for (var M = l[0], N = l[1], L = l[2], $ = l[3], B = l[4], H = l[5], U = l[6], V = l[7], te = d[0], R = d[1], K = d[2], ge = d[3], Ee = d[4], Y = d[5], S = d[6], m = d[7], f, g, b, x, _, E, v, P; A >= 128; ) { + for (var M = l[0], N = l[1], L = l[2], B = l[3], $ = l[4], H = l[5], U = l[6], V = l[7], te = d[0], R = d[1], K = d[2], ge = d[3], Ee = d[4], Y = d[5], S = d[6], m = d[7], f, g, b, x, _, E, v, P; A >= 128; ) { for (var I = 0; I < 16; I++) { var F = 8 * I + w; a[I] = e.readUint32BE(p, F), u[I] = e.readUint32BE(p, F + 4); } for (var I = 0; I < 80; I++) { - var ce = M, D = N, oe = L, Z = $, J = B, Q = H, T = U, X = V, re = te, de = R, ie = K, ue = ge, ve = Ee, Pe = Y, De = S, Ce = m; - if (f = V, g = m, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = (B >>> 14 | Ee << 18) ^ (B >>> 18 | Ee << 14) ^ (Ee >>> 9 | B << 23), g = (Ee >>> 14 | B << 18) ^ (Ee >>> 18 | B << 14) ^ (B >>> 9 | Ee << 23), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = B & H ^ ~B & U, g = Ee & Y ^ ~Ee & S, _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = i[I * 2], g = i[I * 2 + 1], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = a[I % 16], g = u[I % 16], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, b = v & 65535 | P << 16, x = _ & 65535 | E << 16, f = b, g = x, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = (M >>> 28 | te << 4) ^ (te >>> 2 | M << 30) ^ (te >>> 7 | M << 25), g = (te >>> 28 | M << 4) ^ (M >>> 2 | te << 30) ^ (M >>> 7 | te << 25), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = M & N ^ M & L ^ N & L, g = te & R ^ te & K ^ R & K, _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, X = v & 65535 | P << 16, Ce = _ & 65535 | E << 16, f = Z, g = ue, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = b, g = x, _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, Z = v & 65535 | P << 16, ue = _ & 65535 | E << 16, N = ce, L = D, $ = oe, B = Z, H = J, U = Q, V = T, M = X, R = re, K = de, ge = ie, Ee = ue, Y = ve, S = Pe, m = De, te = Ce, I % 16 === 15) + var ce = M, D = N, oe = L, Z = B, J = $, Q = H, T = U, X = V, re = te, pe = R, ie = K, ue = ge, ve = Ee, Pe = Y, De = S, Ce = m; + if (f = V, g = m, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = ($ >>> 14 | Ee << 18) ^ ($ >>> 18 | Ee << 14) ^ (Ee >>> 9 | $ << 23), g = (Ee >>> 14 | $ << 18) ^ (Ee >>> 18 | $ << 14) ^ ($ >>> 9 | Ee << 23), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = $ & H ^ ~$ & U, g = Ee & Y ^ ~Ee & S, _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = i[I * 2], g = i[I * 2 + 1], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = a[I % 16], g = u[I % 16], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, b = v & 65535 | P << 16, x = _ & 65535 | E << 16, f = b, g = x, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = (M >>> 28 | te << 4) ^ (te >>> 2 | M << 30) ^ (te >>> 7 | M << 25), g = (te >>> 28 | M << 4) ^ (M >>> 2 | te << 30) ^ (M >>> 7 | te << 25), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = M & N ^ M & L ^ N & L, g = te & R ^ te & K ^ R & K, _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, X = v & 65535 | P << 16, Ce = _ & 65535 | E << 16, f = Z, g = ue, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = b, g = x, _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, Z = v & 65535 | P << 16, ue = _ & 65535 | E << 16, N = ce, L = D, B = oe, $ = Z, H = J, U = Q, V = T, M = X, R = re, K = pe, ge = ie, Ee = ue, Y = ve, S = Pe, m = De, te = Ce, I % 16 === 15) for (var F = 0; F < 16; F++) f = a[F], g = u[F], _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = a[(F + 9) % 16], g = u[(F + 9) % 16], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, b = a[(F + 1) % 16], x = u[(F + 1) % 16], f = (b >>> 1 | x << 31) ^ (b >>> 8 | x << 24) ^ b >>> 7, g = (x >>> 1 | b << 31) ^ (x >>> 8 | b << 24) ^ (x >>> 7 | b << 25), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, b = a[(F + 14) % 16], x = u[(F + 14) % 16], f = (b >>> 19 | x << 13) ^ (x >>> 29 | b << 3) ^ b >>> 6, g = (x >>> 19 | b << 13) ^ (b >>> 29 | x << 3) ^ (x >>> 6 | b << 26), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, a[F] = v & 65535 | P << 16, u[F] = _ & 65535 | E << 16; } - f = M, g = te, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[0], g = d[0], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[0] = M = v & 65535 | P << 16, d[0] = te = _ & 65535 | E << 16, f = N, g = R, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[1], g = d[1], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[1] = N = v & 65535 | P << 16, d[1] = R = _ & 65535 | E << 16, f = L, g = K, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[2], g = d[2], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[2] = L = v & 65535 | P << 16, d[2] = K = _ & 65535 | E << 16, f = $, g = ge, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[3], g = d[3], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[3] = $ = v & 65535 | P << 16, d[3] = ge = _ & 65535 | E << 16, f = B, g = Ee, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[4], g = d[4], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[4] = B = v & 65535 | P << 16, d[4] = Ee = _ & 65535 | E << 16, f = H, g = Y, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[5], g = d[5], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[5] = H = v & 65535 | P << 16, d[5] = Y = _ & 65535 | E << 16, f = U, g = S, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[6], g = d[6], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[6] = U = v & 65535 | P << 16, d[6] = S = _ & 65535 | E << 16, f = V, g = m, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[7], g = d[7], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[7] = V = v & 65535 | P << 16, d[7] = m = _ & 65535 | E << 16, w += 128, A -= 128; + f = M, g = te, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[0], g = d[0], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[0] = M = v & 65535 | P << 16, d[0] = te = _ & 65535 | E << 16, f = N, g = R, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[1], g = d[1], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[1] = N = v & 65535 | P << 16, d[1] = R = _ & 65535 | E << 16, f = L, g = K, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[2], g = d[2], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[2] = L = v & 65535 | P << 16, d[2] = K = _ & 65535 | E << 16, f = B, g = ge, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[3], g = d[3], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[3] = B = v & 65535 | P << 16, d[3] = ge = _ & 65535 | E << 16, f = $, g = Ee, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[4], g = d[4], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[4] = $ = v & 65535 | P << 16, d[4] = Ee = _ & 65535 | E << 16, f = H, g = Y, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[5], g = d[5], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[5] = H = v & 65535 | P << 16, d[5] = Y = _ & 65535 | E << 16, f = U, g = S, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[6], g = d[6], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[6] = U = v & 65535 | P << 16, d[6] = S = _ & 65535 | E << 16, f = V, g = m, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[7], g = d[7], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[7] = V = v & 65535 | P << 16, d[7] = m = _ & 65535 | E << 16, w += 128, A -= 128; } return w; } @@ -6982,10 +6982,10 @@ var N4 = {}; return u.clean(), l; } t.hash = o; -})(N4); +})(O4); (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.convertSecretKeyToX25519 = t.convertPublicKeyToX25519 = t.verify = t.sign = t.extractPublicKeyFromSecretKey = t.generateKeyPair = t.generateKeyPairFromSeed = t.SEED_LENGTH = t.SECRET_KEY_LENGTH = t.PUBLIC_KEY_LENGTH = t.SIGNATURE_LENGTH = void 0; - const e = Pa, r = N4, n = ki; + const e = Pa, r = O4, n = ki; t.SIGNATURE_LENGTH = 64, t.PUBLIC_KEY_LENGTH = 32, t.SECRET_KEY_LENGTH = 64, t.SEED_LENGTH = 32; function i(Z) { const J = new Float64Array(16); @@ -7108,8 +7108,8 @@ var N4 = {}; M(T), M(T), M(T); for (let X = 0; X < 2; X++) { Q[0] = T[0] - 65517; - for (let de = 1; de < 15; de++) - Q[de] = T[de] - 65535 - (Q[de - 1] >> 16 & 1), Q[de - 1] &= 65535; + for (let pe = 1; pe < 15; pe++) + Q[pe] = T[pe] - 65535 - (Q[pe - 1] >> 16 & 1), Q[pe - 1] &= 65535; Q[15] = T[15] - 32767 - (Q[14] >> 16 & 1); const re = Q[15] >> 16 & 1; Q[14] &= 65535, N(T, Q, 1 - re); @@ -7117,15 +7117,15 @@ var N4 = {}; for (let X = 0; X < 16; X++) Z[2 * X] = T[X] & 255, Z[2 * X + 1] = T[X] >> 8; } - function $(Z, J) { + function B(Z, J) { let Q = 0; for (let T = 0; T < 32; T++) Q |= Z[T] ^ J[T]; return (1 & Q - 1 >>> 8) - 1; } - function B(Z, J) { + function $(Z, J) { const Q = new Uint8Array(32), T = new Uint8Array(32); - return L(Q, Z), L(T, J), $(Q, T); + return L(Q, Z), L(T, J), B(Q, T); } function H(Z) { const J = new Uint8Array(32); @@ -7145,8 +7145,8 @@ var N4 = {}; Z[T] = J[T] - Q[T]; } function R(Z, J, Q) { - let T, X, re = 0, de = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = 0, Me = 0, Ne = 0, Ke = 0, Le = 0, qe = 0, ze = 0, _e = 0, Ze = 0, at = 0, ke = 0, Qe = 0, tt = 0, Ye = 0, dt = 0, lt = 0, ct = 0, qt = 0, Jt = 0, Et = 0, er = 0, Xt = 0, Dt = 0, kt = Q[0], Ct = Q[1], gt = Q[2], Rt = Q[3], Nt = Q[4], vt = Q[5], $t = Q[6], Ft = Q[7], rt = Q[8], Bt = Q[9], k = Q[10], q = Q[11], W = Q[12], C = Q[13], G = Q[14], j = Q[15]; - T = J[0], re += T * kt, de += T * Ct, ie += T * gt, ue += T * Rt, ve += T * Nt, Pe += T * vt, De += T * $t, Ce += T * Ft, $e += T * rt, Me += T * Bt, Ne += T * k, Ke += T * q, Le += T * W, qe += T * C, ze += T * G, _e += T * j, T = J[1], de += T * kt, ie += T * Ct, ue += T * gt, ve += T * Rt, Pe += T * Nt, De += T * vt, Ce += T * $t, $e += T * Ft, Me += T * rt, Ne += T * Bt, Ke += T * k, Le += T * q, qe += T * W, ze += T * C, _e += T * G, Ze += T * j, T = J[2], ie += T * kt, ue += T * Ct, ve += T * gt, Pe += T * Rt, De += T * Nt, Ce += T * vt, $e += T * $t, Me += T * Ft, Ne += T * rt, Ke += T * Bt, Le += T * k, qe += T * q, ze += T * W, _e += T * C, Ze += T * G, at += T * j, T = J[3], ue += T * kt, ve += T * Ct, Pe += T * gt, De += T * Rt, Ce += T * Nt, $e += T * vt, Me += T * $t, Ne += T * Ft, Ke += T * rt, Le += T * Bt, qe += T * k, ze += T * q, _e += T * W, Ze += T * C, at += T * G, ke += T * j, T = J[4], ve += T * kt, Pe += T * Ct, De += T * gt, Ce += T * Rt, $e += T * Nt, Me += T * vt, Ne += T * $t, Ke += T * Ft, Le += T * rt, qe += T * Bt, ze += T * k, _e += T * q, Ze += T * W, at += T * C, ke += T * G, Qe += T * j, T = J[5], Pe += T * kt, De += T * Ct, Ce += T * gt, $e += T * Rt, Me += T * Nt, Ne += T * vt, Ke += T * $t, Le += T * Ft, qe += T * rt, ze += T * Bt, _e += T * k, Ze += T * q, at += T * W, ke += T * C, Qe += T * G, tt += T * j, T = J[6], De += T * kt, Ce += T * Ct, $e += T * gt, Me += T * Rt, Ne += T * Nt, Ke += T * vt, Le += T * $t, qe += T * Ft, ze += T * rt, _e += T * Bt, Ze += T * k, at += T * q, ke += T * W, Qe += T * C, tt += T * G, Ye += T * j, T = J[7], Ce += T * kt, $e += T * Ct, Me += T * gt, Ne += T * Rt, Ke += T * Nt, Le += T * vt, qe += T * $t, ze += T * Ft, _e += T * rt, Ze += T * Bt, at += T * k, ke += T * q, Qe += T * W, tt += T * C, Ye += T * G, dt += T * j, T = J[8], $e += T * kt, Me += T * Ct, Ne += T * gt, Ke += T * Rt, Le += T * Nt, qe += T * vt, ze += T * $t, _e += T * Ft, Ze += T * rt, at += T * Bt, ke += T * k, Qe += T * q, tt += T * W, Ye += T * C, dt += T * G, lt += T * j, T = J[9], Me += T * kt, Ne += T * Ct, Ke += T * gt, Le += T * Rt, qe += T * Nt, ze += T * vt, _e += T * $t, Ze += T * Ft, at += T * rt, ke += T * Bt, Qe += T * k, tt += T * q, Ye += T * W, dt += T * C, lt += T * G, ct += T * j, T = J[10], Ne += T * kt, Ke += T * Ct, Le += T * gt, qe += T * Rt, ze += T * Nt, _e += T * vt, Ze += T * $t, at += T * Ft, ke += T * rt, Qe += T * Bt, tt += T * k, Ye += T * q, dt += T * W, lt += T * C, ct += T * G, qt += T * j, T = J[11], Ke += T * kt, Le += T * Ct, qe += T * gt, ze += T * Rt, _e += T * Nt, Ze += T * vt, at += T * $t, ke += T * Ft, Qe += T * rt, tt += T * Bt, Ye += T * k, dt += T * q, lt += T * W, ct += T * C, qt += T * G, Jt += T * j, T = J[12], Le += T * kt, qe += T * Ct, ze += T * gt, _e += T * Rt, Ze += T * Nt, at += T * vt, ke += T * $t, Qe += T * Ft, tt += T * rt, Ye += T * Bt, dt += T * k, lt += T * q, ct += T * W, qt += T * C, Jt += T * G, Et += T * j, T = J[13], qe += T * kt, ze += T * Ct, _e += T * gt, Ze += T * Rt, at += T * Nt, ke += T * vt, Qe += T * $t, tt += T * Ft, Ye += T * rt, dt += T * Bt, lt += T * k, ct += T * q, qt += T * W, Jt += T * C, Et += T * G, er += T * j, T = J[14], ze += T * kt, _e += T * Ct, Ze += T * gt, at += T * Rt, ke += T * Nt, Qe += T * vt, tt += T * $t, Ye += T * Ft, dt += T * rt, lt += T * Bt, ct += T * k, qt += T * q, Jt += T * W, Et += T * C, er += T * G, Xt += T * j, T = J[15], _e += T * kt, Ze += T * Ct, at += T * gt, ke += T * Rt, Qe += T * Nt, tt += T * vt, Ye += T * $t, dt += T * Ft, lt += T * rt, ct += T * Bt, qt += T * k, Jt += T * q, Et += T * W, er += T * C, Xt += T * G, Dt += T * j, re += 38 * Ze, de += 38 * at, ie += 38 * ke, ue += 38 * Qe, ve += 38 * tt, Pe += 38 * Ye, De += 38 * dt, Ce += 38 * lt, $e += 38 * ct, Me += 38 * qt, Ne += 38 * Jt, Ke += 38 * Et, Le += 38 * er, qe += 38 * Xt, ze += 38 * Dt, X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = de + X + 65535, X = Math.floor(T / 65536), de = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = de + X + 65535, X = Math.floor(T / 65536), de = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), Z[0] = re, Z[1] = de, Z[2] = ie, Z[3] = ue, Z[4] = ve, Z[5] = Pe, Z[6] = De, Z[7] = Ce, Z[8] = $e, Z[9] = Me, Z[10] = Ne, Z[11] = Ke, Z[12] = Le, Z[13] = qe, Z[14] = ze, Z[15] = _e; + let T, X, re = 0, pe = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = 0, Me = 0, Ne = 0, Ke = 0, Le = 0, qe = 0, ze = 0, _e = 0, Ze = 0, at = 0, ke = 0, Qe = 0, tt = 0, Ye = 0, dt = 0, lt = 0, ct = 0, qt = 0, Jt = 0, Et = 0, er = 0, Xt = 0, Dt = 0, kt = Q[0], Ct = Q[1], gt = Q[2], Rt = Q[3], Nt = Q[4], vt = Q[5], $t = Q[6], Ft = Q[7], rt = Q[8], Bt = Q[9], k = Q[10], q = Q[11], W = Q[12], C = Q[13], G = Q[14], j = Q[15]; + T = J[0], re += T * kt, pe += T * Ct, ie += T * gt, ue += T * Rt, ve += T * Nt, Pe += T * vt, De += T * $t, Ce += T * Ft, $e += T * rt, Me += T * Bt, Ne += T * k, Ke += T * q, Le += T * W, qe += T * C, ze += T * G, _e += T * j, T = J[1], pe += T * kt, ie += T * Ct, ue += T * gt, ve += T * Rt, Pe += T * Nt, De += T * vt, Ce += T * $t, $e += T * Ft, Me += T * rt, Ne += T * Bt, Ke += T * k, Le += T * q, qe += T * W, ze += T * C, _e += T * G, Ze += T * j, T = J[2], ie += T * kt, ue += T * Ct, ve += T * gt, Pe += T * Rt, De += T * Nt, Ce += T * vt, $e += T * $t, Me += T * Ft, Ne += T * rt, Ke += T * Bt, Le += T * k, qe += T * q, ze += T * W, _e += T * C, Ze += T * G, at += T * j, T = J[3], ue += T * kt, ve += T * Ct, Pe += T * gt, De += T * Rt, Ce += T * Nt, $e += T * vt, Me += T * $t, Ne += T * Ft, Ke += T * rt, Le += T * Bt, qe += T * k, ze += T * q, _e += T * W, Ze += T * C, at += T * G, ke += T * j, T = J[4], ve += T * kt, Pe += T * Ct, De += T * gt, Ce += T * Rt, $e += T * Nt, Me += T * vt, Ne += T * $t, Ke += T * Ft, Le += T * rt, qe += T * Bt, ze += T * k, _e += T * q, Ze += T * W, at += T * C, ke += T * G, Qe += T * j, T = J[5], Pe += T * kt, De += T * Ct, Ce += T * gt, $e += T * Rt, Me += T * Nt, Ne += T * vt, Ke += T * $t, Le += T * Ft, qe += T * rt, ze += T * Bt, _e += T * k, Ze += T * q, at += T * W, ke += T * C, Qe += T * G, tt += T * j, T = J[6], De += T * kt, Ce += T * Ct, $e += T * gt, Me += T * Rt, Ne += T * Nt, Ke += T * vt, Le += T * $t, qe += T * Ft, ze += T * rt, _e += T * Bt, Ze += T * k, at += T * q, ke += T * W, Qe += T * C, tt += T * G, Ye += T * j, T = J[7], Ce += T * kt, $e += T * Ct, Me += T * gt, Ne += T * Rt, Ke += T * Nt, Le += T * vt, qe += T * $t, ze += T * Ft, _e += T * rt, Ze += T * Bt, at += T * k, ke += T * q, Qe += T * W, tt += T * C, Ye += T * G, dt += T * j, T = J[8], $e += T * kt, Me += T * Ct, Ne += T * gt, Ke += T * Rt, Le += T * Nt, qe += T * vt, ze += T * $t, _e += T * Ft, Ze += T * rt, at += T * Bt, ke += T * k, Qe += T * q, tt += T * W, Ye += T * C, dt += T * G, lt += T * j, T = J[9], Me += T * kt, Ne += T * Ct, Ke += T * gt, Le += T * Rt, qe += T * Nt, ze += T * vt, _e += T * $t, Ze += T * Ft, at += T * rt, ke += T * Bt, Qe += T * k, tt += T * q, Ye += T * W, dt += T * C, lt += T * G, ct += T * j, T = J[10], Ne += T * kt, Ke += T * Ct, Le += T * gt, qe += T * Rt, ze += T * Nt, _e += T * vt, Ze += T * $t, at += T * Ft, ke += T * rt, Qe += T * Bt, tt += T * k, Ye += T * q, dt += T * W, lt += T * C, ct += T * G, qt += T * j, T = J[11], Ke += T * kt, Le += T * Ct, qe += T * gt, ze += T * Rt, _e += T * Nt, Ze += T * vt, at += T * $t, ke += T * Ft, Qe += T * rt, tt += T * Bt, Ye += T * k, dt += T * q, lt += T * W, ct += T * C, qt += T * G, Jt += T * j, T = J[12], Le += T * kt, qe += T * Ct, ze += T * gt, _e += T * Rt, Ze += T * Nt, at += T * vt, ke += T * $t, Qe += T * Ft, tt += T * rt, Ye += T * Bt, dt += T * k, lt += T * q, ct += T * W, qt += T * C, Jt += T * G, Et += T * j, T = J[13], qe += T * kt, ze += T * Ct, _e += T * gt, Ze += T * Rt, at += T * Nt, ke += T * vt, Qe += T * $t, tt += T * Ft, Ye += T * rt, dt += T * Bt, lt += T * k, ct += T * q, qt += T * W, Jt += T * C, Et += T * G, er += T * j, T = J[14], ze += T * kt, _e += T * Ct, Ze += T * gt, at += T * Rt, ke += T * Nt, Qe += T * vt, tt += T * $t, Ye += T * Ft, dt += T * rt, lt += T * Bt, ct += T * k, qt += T * q, Jt += T * W, Et += T * C, er += T * G, Xt += T * j, T = J[15], _e += T * kt, Ze += T * Ct, at += T * gt, ke += T * Rt, Qe += T * Nt, tt += T * vt, Ye += T * $t, dt += T * Ft, lt += T * rt, ct += T * Bt, qt += T * k, Jt += T * q, Et += T * W, er += T * C, Xt += T * G, Dt += T * j, re += 38 * Ze, pe += 38 * at, ie += 38 * ke, ue += 38 * Qe, ve += 38 * tt, Pe += 38 * Ye, De += 38 * dt, Ce += 38 * lt, $e += 38 * ct, Me += 38 * qt, Ne += 38 * Jt, Ke += 38 * Et, Le += 38 * er, qe += 38 * Xt, ze += 38 * Dt, X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = pe + X + 65535, X = Math.floor(T / 65536), pe = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = pe + X + 65535, X = Math.floor(T / 65536), pe = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), Z[0] = re, Z[1] = pe, Z[2] = ie, Z[3] = ue, Z[4] = ve, Z[5] = Pe, Z[6] = De, Z[7] = Ce, Z[8] = $e, Z[9] = Me, Z[10] = Ne, Z[11] = Ke, Z[12] = Le, Z[13] = qe, Z[14] = ze, Z[15] = _e; } function K(Z, J) { R(Z, J, J); @@ -7172,8 +7172,8 @@ var N4 = {}; Z[T] = Q[T]; } function Y(Z, J) { - const Q = i(), T = i(), X = i(), re = i(), de = i(), ie = i(), ue = i(), ve = i(), Pe = i(); - te(Q, Z[1], Z[0]), te(Pe, J[1], J[0]), R(Q, Q, Pe), V(T, Z[0], Z[1]), V(Pe, J[0], J[1]), R(T, T, Pe), R(X, Z[3], J[3]), R(X, X, l), R(re, Z[2], J[2]), V(re, re, re), te(de, T, Q), te(ie, re, X), V(ue, re, X), V(ve, T, Q), R(Z[0], de, ie), R(Z[1], ve, ue), R(Z[2], ue, ie), R(Z[3], de, ve); + const Q = i(), T = i(), X = i(), re = i(), pe = i(), ie = i(), ue = i(), ve = i(), Pe = i(); + te(Q, Z[1], Z[0]), te(Pe, J[1], J[0]), R(Q, Q, Pe), V(T, Z[0], Z[1]), V(Pe, J[0], J[1]), R(T, T, Pe), R(X, Z[3], J[3]), R(X, X, l), R(re, Z[2], J[2]), V(re, re, re), te(pe, T, Q), te(ie, re, X), V(ue, re, X), V(ve, T, Q), R(Z[0], pe, ie), R(Z[1], ve, ue), R(Z[2], ue, ie), R(Z[3], pe, ve); } function S(Z, J, Q) { for (let T = 0; T < 4; T++) @@ -7280,11 +7280,11 @@ var N4 = {}; X[0] &= 248, X[31] &= 127, X[31] |= 64; const re = new Uint8Array(64); re.set(X.subarray(32), 32); - const de = new r.SHA512(); - de.update(re.subarray(32)), de.update(J); - const ie = de.digest(); - de.clean(), P(ie), g(T, ie), m(re, T), de.reset(), de.update(re.subarray(0, 32)), de.update(Z.subarray(32)), de.update(J); - const ue = de.digest(); + const pe = new r.SHA512(); + pe.update(re.subarray(32)), pe.update(J); + const ie = pe.digest(); + pe.clean(), P(ie), g(T, ie), m(re, T), pe.reset(), pe.update(re.subarray(0, 32)), pe.update(Z.subarray(32)), pe.update(J); + const ue = pe.digest(); P(ue); for (let ve = 0; ve < 32; ve++) Q[ve] = ie[ve]; @@ -7295,8 +7295,8 @@ var N4 = {}; } t.sign = I; function F(Z, J) { - const Q = i(), T = i(), X = i(), re = i(), de = i(), ie = i(), ue = i(); - return A(Z[2], a), U(Z[1], J), K(X, Z[1]), R(re, X, u), te(X, X, Z[2]), V(re, Z[2], re), K(de, re), K(ie, de), R(ue, ie, de), R(Q, ue, X), R(Q, Q, re), Ee(Q, Q), R(Q, Q, X), R(Q, Q, re), R(Q, Q, re), R(Z[0], Q, re), K(T, Z[0]), R(T, T, re), B(T, X) && R(Z[0], Z[0], w), K(T, Z[0]), R(T, T, re), B(T, X) ? -1 : (H(Z[0]) === J[31] >> 7 && te(Z[0], o, Z[0]), R(Z[3], Z[0], Z[1]), 0); + const Q = i(), T = i(), X = i(), re = i(), pe = i(), ie = i(), ue = i(); + return A(Z[2], a), U(Z[1], J), K(X, Z[1]), R(re, X, u), te(X, X, Z[2]), V(re, Z[2], re), K(pe, re), K(ie, pe), R(ue, ie, pe), R(Q, ue, X), R(Q, Q, re), Ee(Q, Q), R(Q, Q, X), R(Q, Q, re), R(Q, Q, re), R(Z[0], Q, re), K(T, Z[0]), R(T, T, re), $(T, X) && R(Z[0], Z[0], w), K(T, Z[0]), R(T, T, re), $(T, X) ? -1 : (H(Z[0]) === J[31] >> 7 && te(Z[0], o, Z[0]), R(Z[3], Z[0], Z[1]), 0); } function ce(Z, J, Q) { const T = new Uint8Array(32), X = [i(), i(), i(), i()], re = [i(), i(), i(), i()]; @@ -7304,10 +7304,10 @@ var N4 = {}; throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`); if (F(re, Z)) return !1; - const de = new r.SHA512(); - de.update(Q.subarray(0, 32)), de.update(Z), de.update(J); - const ie = de.digest(); - return P(ie), f(X, re, ie), g(re, Q.subarray(32)), Y(X, re), m(T, X), !$(Q, T); + const pe = new r.SHA512(); + pe.update(Q.subarray(0, 32)), pe.update(Z), pe.update(J); + const ie = pe.digest(); + return P(ie), f(X, re, ie), g(re, Q.subarray(32)), Y(X, re), m(T, X), !B(Q, T); } t.verify = ce; function D(Z) { @@ -7327,14 +7327,14 @@ var N4 = {}; return (0, n.wipe)(J), Q; } t.convertSecretKeyToX25519 = oe; -})(jv); -const $$ = "EdDSA", B$ = "JWT", e0 = ".", U0 = "base64url", L4 = "utf8", k4 = "utf8", F$ = ":", j$ = "did", U$ = "key", rx = "base58btc", q$ = "z", z$ = "K36", W$ = 32; -function $4(t = 0) { +})(Fv); +const $$ = "EdDSA", B$ = "JWT", e0 = ".", U0 = "base64url", N4 = "utf8", L4 = "utf8", F$ = ":", j$ = "did", U$ = "key", tx = "base58btc", q$ = "z", z$ = "K36", W$ = 32; +function k4(t = 0) { return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); } function Sd(t, e) { e || (e = t.reduce((i, s) => i + s.length, 0)); - const r = $4(e); + const r = k4(e); let n = 0; for (const i of t) r.set(i, n), n += i.length; @@ -7357,14 +7357,14 @@ function H$(t, e) { throw new TypeError("Expected Uint8Array"); if (M.length === 0) return ""; - for (var N = 0, L = 0, $ = 0, B = M.length; $ !== B && M[$] === 0; ) - $++, N++; - for (var H = (B - $) * d + 1 >>> 0, U = new Uint8Array(H); $ !== B; ) { - for (var V = M[$], te = 0, R = H - 1; (V !== 0 || te < L) && R !== -1; R--, te++) + for (var N = 0, L = 0, B = 0, $ = M.length; B !== $ && M[B] === 0; ) + B++, N++; + for (var H = ($ - B) * d + 1 >>> 0, U = new Uint8Array(H); B !== $; ) { + for (var V = M[B], te = 0, R = H - 1; (V !== 0 || te < L) && R !== -1; R--, te++) V += 256 * U[R] >>> 0, U[R] = V % a >>> 0, V = V / a >>> 0; if (V !== 0) throw new Error("Non-zero carry"); - L = te, $++; + L = te, B++; } for (var K = H - L; K !== H && U[K] === 0; ) K++; @@ -7379,22 +7379,22 @@ function H$(t, e) { return new Uint8Array(); var N = 0; if (M[N] !== " ") { - for (var L = 0, $ = 0; M[N] === u; ) + for (var L = 0, B = 0; M[N] === u; ) L++, N++; - for (var B = (M.length - N) * l + 1 >>> 0, H = new Uint8Array(B); M[N]; ) { + for (var $ = (M.length - N) * l + 1 >>> 0, H = new Uint8Array($); M[N]; ) { var U = r[M.charCodeAt(N)]; if (U === 255) return; - for (var V = 0, te = B - 1; (U !== 0 || V < $) && te !== -1; te--, V++) + for (var V = 0, te = $ - 1; (U !== 0 || V < B) && te !== -1; te--, V++) U += a * H[te] >>> 0, H[te] = U % 256 >>> 0, U = U / 256 >>> 0; if (U !== 0) throw new Error("Non-zero carry"); - $ = V, N++; + B = V, N++; } if (M[N] !== " ") { - for (var R = B - $; R !== B && H[R] === 0; ) + for (var R = $ - B; R !== $ && H[R] === 0; ) R++; - for (var K = new Uint8Array(L + (B - R)), ge = L; R !== B; ) + for (var K = new Uint8Array(L + ($ - R)), ge = L; R !== $; ) K[ge++] = H[R++]; return K; } @@ -7447,7 +7447,7 @@ class Z$ { throw Error("Can only multibase decode strings"); } or(e) { - return B4(this, e); + return $4(this, e); } } class Q$ { @@ -7455,7 +7455,7 @@ class Q$ { this.decoders = e; } or(e) { - return B4(this, e); + return $4(this, e); } decode(e) { const r = e[0], n = this.decoders[r]; @@ -7464,7 +7464,7 @@ class Q$ { throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`); } } -const B4 = (t, e) => new Q$({ +const $4 = (t, e) => new Q$({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); @@ -7675,7 +7675,7 @@ const q0 = ({ name: t, prefix: e, encode: r, decode: n }) => new eB(t, e, r, n), base64pad: RB, base64url: DB, base64urlpad: OB -}, Symbol.toStringTag, { value: "Module" })), F4 = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), LB = F4.reduce((t, e, r) => (t[r] = e, t), []), kB = F4.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); +}, Symbol.toStringTag, { value: "Module" })), B4 = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), LB = B4.reduce((t, e, r) => (t[r] = e, t), []), kB = B4.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); function $B(t) { return t.reduce((e, r) => (e += LB[r], e), ""); } @@ -7700,7 +7700,7 @@ const FB = q0({ }, Symbol.toStringTag, { value: "Module" })); new TextEncoder(); new TextDecoder(); -const nx = { +const rx = { ...iB, ...oB, ...cB, @@ -7712,7 +7712,7 @@ const nx = { ...NB, ...jB }; -function j4(t, e, r, n) { +function F4(t, e, r, n) { return { name: t, prefix: e, @@ -7724,46 +7724,46 @@ function j4(t, e, r, n) { decoder: { decode: n } }; } -const ix = j4("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), Xg = j4("ascii", "a", (t) => { +const nx = F4("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), Xg = F4("ascii", "a", (t) => { let e = "a"; for (let r = 0; r < t.length; r++) e += String.fromCharCode(t[r]); return e; }, (t) => { t = t.substring(1); - const e = $4(t.length); + const e = k4(t.length); for (let r = 0; r < t.length; r++) e[r] = t.charCodeAt(r); return e; -}), U4 = { - utf8: ix, - "utf-8": ix, - hex: nx.base16, +}), j4 = { + utf8: nx, + "utf-8": nx, + hex: rx.base16, latin1: Xg, ascii: Xg, binary: Xg, - ...nx + ...rx }; function On(t, e = "utf8") { - const r = U4[e]; + const r = j4[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t.buffer, t.byteOffset, t.byteLength).toString("utf8") : r.encoder.encode(t).substring(1); } function Rn(t, e = "utf8") { - const r = U4[e]; + const r = j4[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t, "utf8") : r.decoder.decode(`${r.prefix}${t}`); } -function sx(t) { - return fc(On(Rn(t, U0), L4)); +function ix(t) { + return fc(On(Rn(t, U0), N4)); } function t0(t) { - return On(Rn($o(t), L4), U0); + return On(Rn($o(t), N4), U0); } -function q4(t) { - const e = Rn(z$, rx), r = q$ + On(Sd([e, t]), rx); +function U4(t) { + const e = Rn(z$, tx), r = q$ + On(Sd([e, t]), tx); return [j$, U$, r].join(F$); } function UB(t) { @@ -7773,7 +7773,7 @@ function qB(t) { return Rn(t, U0); } function zB(t) { - return Rn([t0(t.header), t0(t.payload)].join(e0), k4); + return Rn([t0(t.header), t0(t.payload)].join(e0), L4); } function WB(t) { return [ @@ -7783,17 +7783,17 @@ function WB(t) { ].join(e0); } function v1(t) { - const e = t.split(e0), r = sx(e[0]), n = sx(e[1]), i = qB(e[2]), s = Rn(e.slice(0, 2).join(e0), k4); + const e = t.split(e0), r = ix(e[0]), n = ix(e[1]), i = qB(e[2]), s = Rn(e.slice(0, 2).join(e0), L4); return { header: r, payload: n, signature: i, data: s }; } -function ox(t = Pa.randomBytes(W$)) { - return jv.generateKeyPairFromSeed(t); +function sx(t = Pa.randomBytes(W$)) { + return Fv.generateKeyPairFromSeed(t); } async function HB(t, e, r, n, i = mt.fromMiliseconds(Date.now())) { - const s = { alg: $$, typ: B$ }, o = q4(n.publicKey), a = i + r, u = { iss: o, sub: t, aud: e, iat: i, exp: a }, l = zB({ header: s, payload: u }), d = jv.sign(n.secretKey, l); + const s = { alg: $$, typ: B$ }, o = U4(n.publicKey), a = i + r, u = { iss: o, sub: t, aud: e, iat: i, exp: a }, l = zB({ header: s, payload: u }), d = Fv.sign(n.secretKey, l); return WB({ header: s, payload: u, signature: d }); } -var ax = function(t, e, r) { +var ox = function(t, e, r) { if (r || arguments.length === 2) for (var n = 0, i = e.length, s; n < i; n++) (s || !(n in e)) && (s || (s = Array.prototype.slice.call(e, 0, n)), s[n] = e[n]); return t.concat(s || Array.prototype.slice.call(e)); @@ -7837,7 +7837,7 @@ var ax = function(t, e, r) { } return t; }() -), XB = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/, ZB = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, cx = 3, QB = [ +), XB = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/, ZB = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, ax = 3, QB = [ ["aol", /AOLShield\/([0-9\._]+)/], ["edge", /Edge\/([0-9\._]+)/], ["edge-ios", /EdgiOS\/([0-9\._]+)/], @@ -7876,7 +7876,7 @@ var ax = function(t, e, r) { ["ios-webview", /AppleWebKit\/([0-9\.]+).*Gecko\)$/], ["curl", /^curl\/([0-9\.]+)$/], ["searchbot", XB] -], ux = [ +], cx = [ ["iOS", /iP(hone|od|ad)/], ["Android OS", /Android/], ["BlackBerry OS", /BlackBerry|BB10/], @@ -7924,13 +7924,13 @@ function rF(t) { if (r === "searchbot") return new YB(); var i = n[1] && n[1].split(".").join("_").split("_").slice(0, 3); - i ? i.length < cx && (i = ax(ax([], i, !0), sF(cx - i.length), !0)) : i = []; + i ? i.length < ax && (i = ox(ox([], i, !0), sF(ax - i.length), !0)) : i = []; var s = i.join("."), o = nF(t), a = ZB.exec(t); return a && a[1] ? new GB(r, s, o, a[1]) : new KB(r, s, o); } function nF(t) { - for (var e = 0, r = ux.length; e < r; e++) { - var n = ux[e], i = n[0], s = n[1], o = s.exec(t); + for (var e = 0, r = cx.length; e < r; e++) { + var n = cx[e], i = n[0], s = n[1], o = s.exec(t); if (o) return i; } @@ -7947,7 +7947,7 @@ function sF(t) { } var Wr = {}; Object.defineProperty(Wr, "__esModule", { value: !0 }); -Wr.getLocalStorage = Wr.getLocalStorageOrThrow = Wr.getCrypto = Wr.getCryptoOrThrow = z4 = Wr.getLocation = Wr.getLocationOrThrow = Uv = Wr.getNavigator = Wr.getNavigatorOrThrow = Kl = Wr.getDocument = Wr.getDocumentOrThrow = Wr.getFromWindowOrThrow = Wr.getFromWindow = void 0; +Wr.getLocalStorage = Wr.getLocalStorageOrThrow = Wr.getCrypto = Wr.getCryptoOrThrow = q4 = Wr.getLocation = Wr.getLocationOrThrow = jv = Wr.getNavigator = Wr.getNavigatorOrThrow = Kl = Wr.getDocument = Wr.getDocumentOrThrow = Wr.getFromWindowOrThrow = Wr.getFromWindow = void 0; function yc(t) { let e; return typeof window < "u" && typeof window[t] < "u" && (e = window[t]), e; @@ -7975,7 +7975,7 @@ Wr.getNavigatorOrThrow = cF; function uF() { return yc("navigator"); } -var Uv = Wr.getNavigator = uF; +var jv = Wr.getNavigator = uF; function fF() { return Nu("location"); } @@ -7983,7 +7983,7 @@ Wr.getLocationOrThrow = fF; function lF() { return yc("location"); } -var z4 = Wr.getLocation = lF; +var q4 = Wr.getLocation = lF; function hF() { return Nu("crypto"); } @@ -8000,14 +8000,14 @@ function gF() { return yc("localStorage"); } Wr.getLocalStorage = gF; -var qv = {}; -Object.defineProperty(qv, "__esModule", { value: !0 }); -var W4 = qv.getWindowMetadata = void 0; -const fx = Wr; +var Uv = {}; +Object.defineProperty(Uv, "__esModule", { value: !0 }); +var z4 = Uv.getWindowMetadata = void 0; +const ux = Wr; function mF() { let t, e; try { - t = fx.getDocumentOrThrow(), e = fx.getLocationOrThrow(); + t = ux.getDocumentOrThrow(), e = ux.getLocationOrThrow(); } catch { return null; } @@ -8019,19 +8019,19 @@ function mF() { const L = M.getAttribute("href"); if (L) if (L.toLowerCase().indexOf("https:") === -1 && L.toLowerCase().indexOf("http:") === -1 && L.indexOf("//") !== 0) { - let $ = e.protocol + "//" + e.host; + let B = e.protocol + "//" + e.host; if (L.indexOf("/") === 0) - $ += L; + B += L; else { - const B = e.pathname.split("/"); - B.pop(); - const H = B.join("/"); - $ += H + "/" + L; + const $ = e.pathname.split("/"); + $.pop(); + const H = $.join("/"); + B += H + "/" + L; } - w.push($); + w.push(B); } else if (L.indexOf("//") === 0) { - const $ = e.protocol + L; - w.push($); + const B = e.protocol + L; + w.push(B); } else w.push(L); } @@ -8065,8 +8065,8 @@ function mF() { name: o }; } -W4 = qv.getWindowMetadata = mF; -var xl = {}, vF = (t) => encodeURIComponent(t).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), H4 = "%[a-f0-9]{2}", lx = new RegExp("(" + H4 + ")|([^%]+?)", "gi"), hx = new RegExp("(" + H4 + ")+", "gi"); +z4 = Uv.getWindowMetadata = mF; +var xl = {}, vF = (t) => encodeURIComponent(t).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), W4 = "%[a-f0-9]{2}", fx = new RegExp("(" + W4 + ")|([^%]+?)", "gi"), lx = new RegExp("(" + W4 + ")+", "gi"); function b1(t, e) { try { return [decodeURIComponent(t.join(""))]; @@ -8082,8 +8082,8 @@ function bF(t) { try { return decodeURIComponent(t); } catch { - for (var e = t.match(lx) || [], r = 1; r < e.length; r++) - t = b1(e, r).join(""), e = t.match(lx) || []; + for (var e = t.match(fx) || [], r = 1; r < e.length; r++) + t = b1(e, r).join(""), e = t.match(fx) || []; return t; } } @@ -8091,14 +8091,14 @@ function yF(t) { for (var e = { "%FE%FF": "��", "%FF%FE": "��" - }, r = hx.exec(t); r; ) { + }, r = lx.exec(t); r; ) { try { e[r[0]] = decodeURIComponent(r[0]); } catch { var n = bF(r[0]); n !== r[0] && (e[r[0]] = n); } - r = hx.exec(t); + r = lx.exec(t); } e["%C2"] = "�"; for (var i = Object.keys(e), s = 0; s < i.length; s++) { @@ -8133,34 +8133,34 @@ var wF = function(t) { return r; }; (function(t) { - const e = vF, r = wF, n = xF, i = _F, s = (B) => B == null, o = Symbol("encodeFragmentIdentifier"); - function a(B) { - switch (B.arrayFormat) { + const e = vF, r = wF, n = xF, i = _F, s = ($) => $ == null, o = Symbol("encodeFragmentIdentifier"); + function a($) { + switch ($.arrayFormat) { case "index": return (H) => (U, V) => { const te = U.length; - return V === void 0 || B.skipNull && V === null || B.skipEmptyString && V === "" ? U : V === null ? [...U, [d(H, B), "[", te, "]"].join("")] : [ + return V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? U : V === null ? [...U, [d(H, $), "[", te, "]"].join("")] : [ ...U, - [d(H, B), "[", d(te, B), "]=", d(V, B)].join("") + [d(H, $), "[", d(te, $), "]=", d(V, $)].join("") ]; }; case "bracket": - return (H) => (U, V) => V === void 0 || B.skipNull && V === null || B.skipEmptyString && V === "" ? U : V === null ? [...U, [d(H, B), "[]"].join("")] : [...U, [d(H, B), "[]=", d(V, B)].join("")]; + return (H) => (U, V) => V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? U : V === null ? [...U, [d(H, $), "[]"].join("")] : [...U, [d(H, $), "[]=", d(V, $)].join("")]; case "colon-list-separator": - return (H) => (U, V) => V === void 0 || B.skipNull && V === null || B.skipEmptyString && V === "" ? U : V === null ? [...U, [d(H, B), ":list="].join("")] : [...U, [d(H, B), ":list=", d(V, B)].join("")]; + return (H) => (U, V) => V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? U : V === null ? [...U, [d(H, $), ":list="].join("")] : [...U, [d(H, $), ":list=", d(V, $)].join("")]; case "comma": case "separator": case "bracket-separator": { - const H = B.arrayFormat === "bracket-separator" ? "[]=" : "="; - return (U) => (V, te) => te === void 0 || B.skipNull && te === null || B.skipEmptyString && te === "" ? V : (te = te === null ? "" : te, V.length === 0 ? [[d(U, B), H, d(te, B)].join("")] : [[V, d(te, B)].join(B.arrayFormatSeparator)]); + const H = $.arrayFormat === "bracket-separator" ? "[]=" : "="; + return (U) => (V, te) => te === void 0 || $.skipNull && te === null || $.skipEmptyString && te === "" ? V : (te = te === null ? "" : te, V.length === 0 ? [[d(U, $), H, d(te, $)].join("")] : [[V, d(te, $)].join($.arrayFormatSeparator)]); } default: - return (H) => (U, V) => V === void 0 || B.skipNull && V === null || B.skipEmptyString && V === "" ? U : V === null ? [...U, d(H, B)] : [...U, [d(H, B), "=", d(V, B)].join("")]; + return (H) => (U, V) => V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? U : V === null ? [...U, d(H, $)] : [...U, [d(H, $), "=", d(V, $)].join("")]; } } - function u(B) { + function u($) { let H; - switch (B.arrayFormat) { + switch ($.arrayFormat) { case "index": return (U, V, te) => { if (H = /\[(\d*)\]$/.exec(U), U = U.replace(/\[\d*\]$/, ""), !H) { @@ -8196,19 +8196,19 @@ var wF = function(t) { case "comma": case "separator": return (U, V, te) => { - const R = typeof V == "string" && V.includes(B.arrayFormatSeparator), K = typeof V == "string" && !R && p(V, B).includes(B.arrayFormatSeparator); - V = K ? p(V, B) : V; - const ge = R || K ? V.split(B.arrayFormatSeparator).map((Ee) => p(Ee, B)) : V === null ? V : p(V, B); + const R = typeof V == "string" && V.includes($.arrayFormatSeparator), K = typeof V == "string" && !R && p(V, $).includes($.arrayFormatSeparator); + V = K ? p(V, $) : V; + const ge = R || K ? V.split($.arrayFormatSeparator).map((Ee) => p(Ee, $)) : V === null ? V : p(V, $); te[U] = ge; }; case "bracket-separator": return (U, V, te) => { const R = /(\[\])$/.test(U); if (U = U.replace(/\[\]$/, ""), !R) { - te[U] = V && p(V, B); + te[U] = V && p(V, $); return; } - const K = V === null ? [] : V.split(B.arrayFormatSeparator).map((ge) => p(ge, B)); + const K = V === null ? [] : V.split($.arrayFormatSeparator).map((ge) => p(ge, $)); if (te[U] === void 0) { te[U] = K; return; @@ -8225,37 +8225,37 @@ var wF = function(t) { }; } } - function l(B) { - if (typeof B != "string" || B.length !== 1) + function l($) { + if (typeof $ != "string" || $.length !== 1) throw new TypeError("arrayFormatSeparator must be single character string"); } - function d(B, H) { - return H.encode ? H.strict ? e(B) : encodeURIComponent(B) : B; + function d($, H) { + return H.encode ? H.strict ? e($) : encodeURIComponent($) : $; } - function p(B, H) { - return H.decode ? r(B) : B; + function p($, H) { + return H.decode ? r($) : $; } - function w(B) { - return Array.isArray(B) ? B.sort() : typeof B == "object" ? w(Object.keys(B)).sort((H, U) => Number(H) - Number(U)).map((H) => B[H]) : B; + function w($) { + return Array.isArray($) ? $.sort() : typeof $ == "object" ? w(Object.keys($)).sort((H, U) => Number(H) - Number(U)).map((H) => $[H]) : $; } - function A(B) { - const H = B.indexOf("#"); - return H !== -1 && (B = B.slice(0, H)), B; + function A($) { + const H = $.indexOf("#"); + return H !== -1 && ($ = $.slice(0, H)), $; } - function M(B) { + function M($) { let H = ""; - const U = B.indexOf("#"); - return U !== -1 && (H = B.slice(U)), H; + const U = $.indexOf("#"); + return U !== -1 && (H = $.slice(U)), H; } - function N(B) { - B = A(B); - const H = B.indexOf("?"); - return H === -1 ? "" : B.slice(H + 1); + function N($) { + $ = A($); + const H = $.indexOf("?"); + return H === -1 ? "" : $.slice(H + 1); } - function L(B, H) { - return H.parseNumbers && !Number.isNaN(Number(B)) && typeof B == "string" && B.trim() !== "" ? B = Number(B) : H.parseBooleans && B !== null && (B.toLowerCase() === "true" || B.toLowerCase() === "false") && (B = B.toLowerCase() === "true"), B; + function L($, H) { + return H.parseNumbers && !Number.isNaN(Number($)) && typeof $ == "string" && $.trim() !== "" ? $ = Number($) : H.parseBooleans && $ !== null && ($.toLowerCase() === "true" || $.toLowerCase() === "false") && ($ = $.toLowerCase() === "true"), $; } - function $(B, H) { + function B($, H) { H = Object.assign({ decode: !0, sort: !0, @@ -8265,9 +8265,9 @@ var wF = function(t) { parseBooleans: !1 }, H), l(H.arrayFormatSeparator); const U = u(H), V = /* @__PURE__ */ Object.create(null); - if (typeof B != "string" || (B = B.trim().replace(/^[?#&]/, ""), !B)) + if (typeof $ != "string" || ($ = $.trim().replace(/^[?#&]/, ""), !$)) return V; - for (const te of B.split("&")) { + for (const te of $.split("&")) { if (te === "") continue; let [R, K] = n(H.decode ? te.replace(/\+/g, " ") : te, "="); @@ -8286,8 +8286,8 @@ var wF = function(t) { return K && typeof K == "object" && !Array.isArray(K) ? te[R] = w(K) : te[R] = K, te; }, /* @__PURE__ */ Object.create(null)); } - t.extract = N, t.parse = $, t.stringify = (B, H) => { - if (!B) + t.extract = N, t.parse = B, t.stringify = ($, H) => { + if (!$) return ""; H = Object.assign({ encode: !0, @@ -8295,54 +8295,54 @@ var wF = function(t) { arrayFormat: "none", arrayFormatSeparator: "," }, H), l(H.arrayFormatSeparator); - const U = (K) => H.skipNull && s(B[K]) || H.skipEmptyString && B[K] === "", V = a(H), te = {}; - for (const K of Object.keys(B)) - U(K) || (te[K] = B[K]); + const U = (K) => H.skipNull && s($[K]) || H.skipEmptyString && $[K] === "", V = a(H), te = {}; + for (const K of Object.keys($)) + U(K) || (te[K] = $[K]); const R = Object.keys(te); return H.sort !== !1 && R.sort(H.sort), R.map((K) => { - const ge = B[K]; + const ge = $[K]; return ge === void 0 ? "" : ge === null ? d(K, H) : Array.isArray(ge) ? ge.length === 0 && H.arrayFormat === "bracket-separator" ? d(K, H) + "[]" : ge.reduce(V(K), []).join("&") : d(K, H) + "=" + d(ge, H); }).filter((K) => K.length > 0).join("&"); - }, t.parseUrl = (B, H) => { + }, t.parseUrl = ($, H) => { H = Object.assign({ decode: !0 }, H); - const [U, V] = n(B, "#"); + const [U, V] = n($, "#"); return Object.assign( { url: U.split("?")[0] || "", - query: $(N(B), H) + query: B(N($), H) }, H && H.parseFragmentIdentifier && V ? { fragmentIdentifier: p(V, H) } : {} ); - }, t.stringifyUrl = (B, H) => { + }, t.stringifyUrl = ($, H) => { H = Object.assign({ encode: !0, strict: !0, [o]: !0 }, H); - const U = A(B.url).split("?")[0] || "", V = t.extract(B.url), te = t.parse(V, { sort: !1 }), R = Object.assign(te, B.query); + const U = A($.url).split("?")[0] || "", V = t.extract($.url), te = t.parse(V, { sort: !1 }), R = Object.assign(te, $.query); let K = t.stringify(R, H); K && (K = `?${K}`); - let ge = M(B.url); - return B.fragmentIdentifier && (ge = `#${H[o] ? d(B.fragmentIdentifier, H) : B.fragmentIdentifier}`), `${U}${K}${ge}`; - }, t.pick = (B, H, U) => { + let ge = M($.url); + return $.fragmentIdentifier && (ge = `#${H[o] ? d($.fragmentIdentifier, H) : $.fragmentIdentifier}`), `${U}${K}${ge}`; + }, t.pick = ($, H, U) => { U = Object.assign({ parseFragmentIdentifier: !0, [o]: !1 }, U); - const { url: V, query: te, fragmentIdentifier: R } = t.parseUrl(B, U); + const { url: V, query: te, fragmentIdentifier: R } = t.parseUrl($, U); return t.stringifyUrl({ url: V, query: i(te, H), fragmentIdentifier: R }, U); - }, t.exclude = (B, H, U) => { + }, t.exclude = ($, H, U) => { const V = Array.isArray(H) ? (te) => !H.includes(te) : (te, R) => !H(te, R); - return t.pick(B, V, U); + return t.pick($, V, U); }; })(xl); -var K4 = { exports: {} }; +var H4 = { exports: {} }; /** * [js-sha3]{@link https://github.com/emn178/js-sha3} * @@ -8406,7 +8406,7 @@ var K4 = { exports: {} }; 0, 2147516424, 2147483648 - ], L = [224, 256, 384, 512], $ = [128, 256], B = ["hex", "buffer", "arrayBuffer", "array", "digest"], H = { + ], L = [224, 256, 384, 512], B = [128, 256], $ = ["hex", "buffer", "arrayBuffer", "array", "digest"], H = { 128: 168, 256: 136 }; @@ -8432,8 +8432,8 @@ var K4 = { exports: {} }; return f["kmac" + D].update(J, Q, T, X)[Z](); }; }, K = function(D, oe, Z, J) { - for (var Q = 0; Q < B.length; ++Q) { - var T = B[Q]; + for (var Q = 0; Q < $.length; ++Q) { + var T = $[Q]; D[T] = oe(Z, J, T); } return D; @@ -8468,9 +8468,9 @@ var K4 = { exports: {} }; }, m = [ { name: "keccak", padding: w, bits: L, createMethod: ge }, { name: "sha3", padding: A, bits: L, createMethod: ge }, - { name: "shake", padding: d, bits: $, createMethod: Ee }, - { name: "cshake", padding: p, bits: $, createMethod: Y }, - { name: "kmac", padding: p, bits: $, createMethod: S } + { name: "shake", padding: d, bits: B, createMethod: Ee }, + { name: "cshake", padding: p, bits: B, createMethod: Y }, + { name: "kmac", padding: p, bits: B, createMethod: S } ], f = {}, g = [], b = 0; b < m.length; ++b) for (var x = m[b], _ = x.bits, E = 0; E < _.length; ++E) { var v = x.name + "_" + _[E]; @@ -8500,7 +8500,7 @@ var K4 = { exports: {} }; throw new Error(e); oe = !0; } - for (var J = this.blocks, Q = this.byteCount, T = D.length, X = this.blockCount, re = 0, de = this.s, ie, ue; re < T; ) { + for (var J = this.blocks, Q = this.byteCount, T = D.length, X = this.blockCount, re = 0, pe = this.s, ie, ue; re < T; ) { if (this.reset) for (this.reset = !1, J[0] = this.block, ie = 1; ie < X + 1; ++ie) J[ie] = 0; @@ -8512,8 +8512,8 @@ var K4 = { exports: {} }; ue = D.charCodeAt(re), ue < 128 ? J[ie >> 2] |= ue << M[ie++ & 3] : ue < 2048 ? (J[ie >> 2] |= (192 | ue >> 6) << M[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << M[ie++ & 3]) : ue < 55296 || ue >= 57344 ? (J[ie >> 2] |= (224 | ue >> 12) << M[ie++ & 3], J[ie >> 2] |= (128 | ue >> 6 & 63) << M[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << M[ie++ & 3]) : (ue = 65536 + ((ue & 1023) << 10 | D.charCodeAt(++re) & 1023), J[ie >> 2] |= (240 | ue >> 18) << M[ie++ & 3], J[ie >> 2] |= (128 | ue >> 12 & 63) << M[ie++ & 3], J[ie >> 2] |= (128 | ue >> 6 & 63) << M[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << M[ie++ & 3]); if (this.lastByteIndex = ie, ie >= Q) { for (this.start = ie - Q, this.block = J[X], ie = 0; ie < X; ++ie) - de[ie] ^= J[ie]; - ce(de), this.reset = !0; + pe[ie] ^= J[ie]; + ce(pe), this.reset = !0; } else this.start = ie; } @@ -8574,20 +8574,20 @@ var K4 = { exports: {} }; this.finalize(); var D = this.blockCount, oe = this.s, Z = this.outputBlocks, J = this.extraBytes, Q = 0, T = 0, X = this.outputBits >> 3, re; J ? re = new ArrayBuffer(Z + 1 << 2) : re = new ArrayBuffer(X); - for (var de = new Uint32Array(re); T < Z; ) { + for (var pe = new Uint32Array(re); T < Z; ) { for (Q = 0; Q < D && T < Z; ++Q, ++T) - de[T] = oe[Q]; + pe[T] = oe[Q]; T % D === 0 && ce(oe); } - return J && (de[Q] = oe[Q], re = re.slice(0, X)), re; + return J && (pe[Q] = oe[Q], re = re.slice(0, X)), re; }, I.prototype.buffer = I.prototype.arrayBuffer, I.prototype.digest = I.prototype.array = function() { this.finalize(); - for (var D = this.blockCount, oe = this.s, Z = this.outputBlocks, J = this.extraBytes, Q = 0, T = 0, X = [], re, de; T < Z; ) { + for (var D = this.blockCount, oe = this.s, Z = this.outputBlocks, J = this.extraBytes, Q = 0, T = 0, X = [], re, pe; T < Z; ) { for (Q = 0; Q < D && T < Z; ++Q, ++T) - re = T << 2, de = oe[Q], X[re] = de & 255, X[re + 1] = de >> 8 & 255, X[re + 2] = de >> 16 & 255, X[re + 3] = de >> 24 & 255; + re = T << 2, pe = oe[Q], X[re] = pe & 255, X[re + 1] = pe >> 8 & 255, X[re + 2] = pe >> 16 & 255, X[re + 3] = pe >> 24 & 255; T % D === 0 && ce(oe); } - return J && (re = T << 2, de = oe[Q], X[re] = de & 255, J > 1 && (X[re + 1] = de >> 8 & 255), J > 2 && (X[re + 2] = de >> 16 & 255)), X; + return J && (re = T << 2, pe = oe[Q], X[re] = pe & 255, J > 1 && (X[re + 1] = pe >> 8 & 255), J > 2 && (X[re + 2] = pe >> 16 & 255)), X; }; function F(D, oe, Z) { I.call(this, D, oe, Z); @@ -8596,9 +8596,9 @@ var K4 = { exports: {} }; return this.encode(this.outputBits, !0), I.prototype.finalize.call(this); }; var ce = function(D) { - var oe, Z, J, Q, T, X, re, de, ie, ue, ve, Pe, De, Ce, $e, Me, Ne, Ke, Le, qe, ze, _e, Ze, at, ke, Qe, tt, Ye, dt, lt, ct, qt, Jt, Et, er, Xt, Dt, kt, Ct, gt, Rt, Nt, vt, $t, Ft, rt, Bt, k, q, W, C, G, j, se, he, xe, Te, Re, nt, je, pt, it, et; + var oe, Z, J, Q, T, X, re, pe, ie, ue, ve, Pe, De, Ce, $e, Me, Ne, Ke, Le, qe, ze, _e, Ze, at, ke, Qe, tt, Ye, dt, lt, ct, qt, Jt, Et, er, Xt, Dt, kt, Ct, gt, Rt, Nt, vt, $t, Ft, rt, Bt, k, q, W, C, G, j, se, de, xe, Te, Re, nt, je, pt, it, et; for (J = 0; J < 48; J += 2) - Q = D[0] ^ D[10] ^ D[20] ^ D[30] ^ D[40], T = D[1] ^ D[11] ^ D[21] ^ D[31] ^ D[41], X = D[2] ^ D[12] ^ D[22] ^ D[32] ^ D[42], re = D[3] ^ D[13] ^ D[23] ^ D[33] ^ D[43], de = D[4] ^ D[14] ^ D[24] ^ D[34] ^ D[44], ie = D[5] ^ D[15] ^ D[25] ^ D[35] ^ D[45], ue = D[6] ^ D[16] ^ D[26] ^ D[36] ^ D[46], ve = D[7] ^ D[17] ^ D[27] ^ D[37] ^ D[47], Pe = D[8] ^ D[18] ^ D[28] ^ D[38] ^ D[48], De = D[9] ^ D[19] ^ D[29] ^ D[39] ^ D[49], oe = Pe ^ (X << 1 | re >>> 31), Z = De ^ (re << 1 | X >>> 31), D[0] ^= oe, D[1] ^= Z, D[10] ^= oe, D[11] ^= Z, D[20] ^= oe, D[21] ^= Z, D[30] ^= oe, D[31] ^= Z, D[40] ^= oe, D[41] ^= Z, oe = Q ^ (de << 1 | ie >>> 31), Z = T ^ (ie << 1 | de >>> 31), D[2] ^= oe, D[3] ^= Z, D[12] ^= oe, D[13] ^= Z, D[22] ^= oe, D[23] ^= Z, D[32] ^= oe, D[33] ^= Z, D[42] ^= oe, D[43] ^= Z, oe = X ^ (ue << 1 | ve >>> 31), Z = re ^ (ve << 1 | ue >>> 31), D[4] ^= oe, D[5] ^= Z, D[14] ^= oe, D[15] ^= Z, D[24] ^= oe, D[25] ^= Z, D[34] ^= oe, D[35] ^= Z, D[44] ^= oe, D[45] ^= Z, oe = de ^ (Pe << 1 | De >>> 31), Z = ie ^ (De << 1 | Pe >>> 31), D[6] ^= oe, D[7] ^= Z, D[16] ^= oe, D[17] ^= Z, D[26] ^= oe, D[27] ^= Z, D[36] ^= oe, D[37] ^= Z, D[46] ^= oe, D[47] ^= Z, oe = ue ^ (Q << 1 | T >>> 31), Z = ve ^ (T << 1 | Q >>> 31), D[8] ^= oe, D[9] ^= Z, D[18] ^= oe, D[19] ^= Z, D[28] ^= oe, D[29] ^= Z, D[38] ^= oe, D[39] ^= Z, D[48] ^= oe, D[49] ^= Z, Ce = D[0], $e = D[1], rt = D[11] << 4 | D[10] >>> 28, Bt = D[10] << 4 | D[11] >>> 28, Ye = D[20] << 3 | D[21] >>> 29, dt = D[21] << 3 | D[20] >>> 29, je = D[31] << 9 | D[30] >>> 23, pt = D[30] << 9 | D[31] >>> 23, Nt = D[40] << 18 | D[41] >>> 14, vt = D[41] << 18 | D[40] >>> 14, Et = D[2] << 1 | D[3] >>> 31, er = D[3] << 1 | D[2] >>> 31, Me = D[13] << 12 | D[12] >>> 20, Ne = D[12] << 12 | D[13] >>> 20, k = D[22] << 10 | D[23] >>> 22, q = D[23] << 10 | D[22] >>> 22, lt = D[33] << 13 | D[32] >>> 19, ct = D[32] << 13 | D[33] >>> 19, it = D[42] << 2 | D[43] >>> 30, et = D[43] << 2 | D[42] >>> 30, se = D[5] << 30 | D[4] >>> 2, he = D[4] << 30 | D[5] >>> 2, Xt = D[14] << 6 | D[15] >>> 26, Dt = D[15] << 6 | D[14] >>> 26, Ke = D[25] << 11 | D[24] >>> 21, Le = D[24] << 11 | D[25] >>> 21, W = D[34] << 15 | D[35] >>> 17, C = D[35] << 15 | D[34] >>> 17, qt = D[45] << 29 | D[44] >>> 3, Jt = D[44] << 29 | D[45] >>> 3, at = D[6] << 28 | D[7] >>> 4, ke = D[7] << 28 | D[6] >>> 4, xe = D[17] << 23 | D[16] >>> 9, Te = D[16] << 23 | D[17] >>> 9, kt = D[26] << 25 | D[27] >>> 7, Ct = D[27] << 25 | D[26] >>> 7, qe = D[36] << 21 | D[37] >>> 11, ze = D[37] << 21 | D[36] >>> 11, G = D[47] << 24 | D[46] >>> 8, j = D[46] << 24 | D[47] >>> 8, $t = D[8] << 27 | D[9] >>> 5, Ft = D[9] << 27 | D[8] >>> 5, Qe = D[18] << 20 | D[19] >>> 12, tt = D[19] << 20 | D[18] >>> 12, Re = D[29] << 7 | D[28] >>> 25, nt = D[28] << 7 | D[29] >>> 25, gt = D[38] << 8 | D[39] >>> 24, Rt = D[39] << 8 | D[38] >>> 24, _e = D[48] << 14 | D[49] >>> 18, Ze = D[49] << 14 | D[48] >>> 18, D[0] = Ce ^ ~Me & Ke, D[1] = $e ^ ~Ne & Le, D[10] = at ^ ~Qe & Ye, D[11] = ke ^ ~tt & dt, D[20] = Et ^ ~Xt & kt, D[21] = er ^ ~Dt & Ct, D[30] = $t ^ ~rt & k, D[31] = Ft ^ ~Bt & q, D[40] = se ^ ~xe & Re, D[41] = he ^ ~Te & nt, D[2] = Me ^ ~Ke & qe, D[3] = Ne ^ ~Le & ze, D[12] = Qe ^ ~Ye & lt, D[13] = tt ^ ~dt & ct, D[22] = Xt ^ ~kt & gt, D[23] = Dt ^ ~Ct & Rt, D[32] = rt ^ ~k & W, D[33] = Bt ^ ~q & C, D[42] = xe ^ ~Re & je, D[43] = Te ^ ~nt & pt, D[4] = Ke ^ ~qe & _e, D[5] = Le ^ ~ze & Ze, D[14] = Ye ^ ~lt & qt, D[15] = dt ^ ~ct & Jt, D[24] = kt ^ ~gt & Nt, D[25] = Ct ^ ~Rt & vt, D[34] = k ^ ~W & G, D[35] = q ^ ~C & j, D[44] = Re ^ ~je & it, D[45] = nt ^ ~pt & et, D[6] = qe ^ ~_e & Ce, D[7] = ze ^ ~Ze & $e, D[16] = lt ^ ~qt & at, D[17] = ct ^ ~Jt & ke, D[26] = gt ^ ~Nt & Et, D[27] = Rt ^ ~vt & er, D[36] = W ^ ~G & $t, D[37] = C ^ ~j & Ft, D[46] = je ^ ~it & se, D[47] = pt ^ ~et & he, D[8] = _e ^ ~Ce & Me, D[9] = Ze ^ ~$e & Ne, D[18] = qt ^ ~at & Qe, D[19] = Jt ^ ~ke & tt, D[28] = Nt ^ ~Et & Xt, D[29] = vt ^ ~er & Dt, D[38] = G ^ ~$t & rt, D[39] = j ^ ~Ft & Bt, D[48] = it ^ ~se & xe, D[49] = et ^ ~he & Te, D[0] ^= N[J], D[1] ^= N[J + 1]; + Q = D[0] ^ D[10] ^ D[20] ^ D[30] ^ D[40], T = D[1] ^ D[11] ^ D[21] ^ D[31] ^ D[41], X = D[2] ^ D[12] ^ D[22] ^ D[32] ^ D[42], re = D[3] ^ D[13] ^ D[23] ^ D[33] ^ D[43], pe = D[4] ^ D[14] ^ D[24] ^ D[34] ^ D[44], ie = D[5] ^ D[15] ^ D[25] ^ D[35] ^ D[45], ue = D[6] ^ D[16] ^ D[26] ^ D[36] ^ D[46], ve = D[7] ^ D[17] ^ D[27] ^ D[37] ^ D[47], Pe = D[8] ^ D[18] ^ D[28] ^ D[38] ^ D[48], De = D[9] ^ D[19] ^ D[29] ^ D[39] ^ D[49], oe = Pe ^ (X << 1 | re >>> 31), Z = De ^ (re << 1 | X >>> 31), D[0] ^= oe, D[1] ^= Z, D[10] ^= oe, D[11] ^= Z, D[20] ^= oe, D[21] ^= Z, D[30] ^= oe, D[31] ^= Z, D[40] ^= oe, D[41] ^= Z, oe = Q ^ (pe << 1 | ie >>> 31), Z = T ^ (ie << 1 | pe >>> 31), D[2] ^= oe, D[3] ^= Z, D[12] ^= oe, D[13] ^= Z, D[22] ^= oe, D[23] ^= Z, D[32] ^= oe, D[33] ^= Z, D[42] ^= oe, D[43] ^= Z, oe = X ^ (ue << 1 | ve >>> 31), Z = re ^ (ve << 1 | ue >>> 31), D[4] ^= oe, D[5] ^= Z, D[14] ^= oe, D[15] ^= Z, D[24] ^= oe, D[25] ^= Z, D[34] ^= oe, D[35] ^= Z, D[44] ^= oe, D[45] ^= Z, oe = pe ^ (Pe << 1 | De >>> 31), Z = ie ^ (De << 1 | Pe >>> 31), D[6] ^= oe, D[7] ^= Z, D[16] ^= oe, D[17] ^= Z, D[26] ^= oe, D[27] ^= Z, D[36] ^= oe, D[37] ^= Z, D[46] ^= oe, D[47] ^= Z, oe = ue ^ (Q << 1 | T >>> 31), Z = ve ^ (T << 1 | Q >>> 31), D[8] ^= oe, D[9] ^= Z, D[18] ^= oe, D[19] ^= Z, D[28] ^= oe, D[29] ^= Z, D[38] ^= oe, D[39] ^= Z, D[48] ^= oe, D[49] ^= Z, Ce = D[0], $e = D[1], rt = D[11] << 4 | D[10] >>> 28, Bt = D[10] << 4 | D[11] >>> 28, Ye = D[20] << 3 | D[21] >>> 29, dt = D[21] << 3 | D[20] >>> 29, je = D[31] << 9 | D[30] >>> 23, pt = D[30] << 9 | D[31] >>> 23, Nt = D[40] << 18 | D[41] >>> 14, vt = D[41] << 18 | D[40] >>> 14, Et = D[2] << 1 | D[3] >>> 31, er = D[3] << 1 | D[2] >>> 31, Me = D[13] << 12 | D[12] >>> 20, Ne = D[12] << 12 | D[13] >>> 20, k = D[22] << 10 | D[23] >>> 22, q = D[23] << 10 | D[22] >>> 22, lt = D[33] << 13 | D[32] >>> 19, ct = D[32] << 13 | D[33] >>> 19, it = D[42] << 2 | D[43] >>> 30, et = D[43] << 2 | D[42] >>> 30, se = D[5] << 30 | D[4] >>> 2, de = D[4] << 30 | D[5] >>> 2, Xt = D[14] << 6 | D[15] >>> 26, Dt = D[15] << 6 | D[14] >>> 26, Ke = D[25] << 11 | D[24] >>> 21, Le = D[24] << 11 | D[25] >>> 21, W = D[34] << 15 | D[35] >>> 17, C = D[35] << 15 | D[34] >>> 17, qt = D[45] << 29 | D[44] >>> 3, Jt = D[44] << 29 | D[45] >>> 3, at = D[6] << 28 | D[7] >>> 4, ke = D[7] << 28 | D[6] >>> 4, xe = D[17] << 23 | D[16] >>> 9, Te = D[16] << 23 | D[17] >>> 9, kt = D[26] << 25 | D[27] >>> 7, Ct = D[27] << 25 | D[26] >>> 7, qe = D[36] << 21 | D[37] >>> 11, ze = D[37] << 21 | D[36] >>> 11, G = D[47] << 24 | D[46] >>> 8, j = D[46] << 24 | D[47] >>> 8, $t = D[8] << 27 | D[9] >>> 5, Ft = D[9] << 27 | D[8] >>> 5, Qe = D[18] << 20 | D[19] >>> 12, tt = D[19] << 20 | D[18] >>> 12, Re = D[29] << 7 | D[28] >>> 25, nt = D[28] << 7 | D[29] >>> 25, gt = D[38] << 8 | D[39] >>> 24, Rt = D[39] << 8 | D[38] >>> 24, _e = D[48] << 14 | D[49] >>> 18, Ze = D[49] << 14 | D[48] >>> 18, D[0] = Ce ^ ~Me & Ke, D[1] = $e ^ ~Ne & Le, D[10] = at ^ ~Qe & Ye, D[11] = ke ^ ~tt & dt, D[20] = Et ^ ~Xt & kt, D[21] = er ^ ~Dt & Ct, D[30] = $t ^ ~rt & k, D[31] = Ft ^ ~Bt & q, D[40] = se ^ ~xe & Re, D[41] = de ^ ~Te & nt, D[2] = Me ^ ~Ke & qe, D[3] = Ne ^ ~Le & ze, D[12] = Qe ^ ~Ye & lt, D[13] = tt ^ ~dt & ct, D[22] = Xt ^ ~kt & gt, D[23] = Dt ^ ~Ct & Rt, D[32] = rt ^ ~k & W, D[33] = Bt ^ ~q & C, D[42] = xe ^ ~Re & je, D[43] = Te ^ ~nt & pt, D[4] = Ke ^ ~qe & _e, D[5] = Le ^ ~ze & Ze, D[14] = Ye ^ ~lt & qt, D[15] = dt ^ ~ct & Jt, D[24] = kt ^ ~gt & Nt, D[25] = Ct ^ ~Rt & vt, D[34] = k ^ ~W & G, D[35] = q ^ ~C & j, D[44] = Re ^ ~je & it, D[45] = nt ^ ~pt & et, D[6] = qe ^ ~_e & Ce, D[7] = ze ^ ~Ze & $e, D[16] = lt ^ ~qt & at, D[17] = ct ^ ~Jt & ke, D[26] = gt ^ ~Nt & Et, D[27] = Rt ^ ~vt & er, D[36] = W ^ ~G & $t, D[37] = C ^ ~j & Ft, D[46] = je ^ ~it & se, D[47] = pt ^ ~et & de, D[8] = _e ^ ~Ce & Me, D[9] = Ze ^ ~$e & Ne, D[18] = qt ^ ~at & Qe, D[19] = Jt ^ ~ke & tt, D[28] = Nt ^ ~Et & Xt, D[29] = vt ^ ~er & Dt, D[38] = G ^ ~$t & rt, D[39] = j ^ ~Ft & Bt, D[48] = it ^ ~se & xe, D[49] = et ^ ~de & Te, D[0] ^= N[J], D[1] ^= N[J + 1]; }; if (a) t.exports = f; @@ -8606,12 +8606,12 @@ var K4 = { exports: {} }; for (b = 0; b < g.length; ++b) i[g[b]] = f[g[b]]; })(); -})(K4); -var EF = K4.exports; +})(H4); +var EF = H4.exports; const SF = /* @__PURE__ */ ts(EF), AF = "logger/5.7.0"; -let dx = !1, px = !1; +let hx = !1, dx = !1; const Ad = { debug: 1, default: 2, info: 2, warning: 3, error: 4, off: 5 }; -let gx = Ad.default, Zg = null; +let px = Ad.default, Zg = null; function PF() { try { const t = []; @@ -8631,7 +8631,7 @@ function PF() { } return null; } -const mx = PF(); +const gx = PF(); var y1; (function(t) { t.DEBUG = "DEBUG", t.INFO = "INFO", t.WARNING = "WARNING", t.ERROR = "ERROR", t.OFF = "OFF"; @@ -8640,7 +8640,7 @@ var ws; (function(t) { t.UNKNOWN_ERROR = "UNKNOWN_ERROR", t.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", t.UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION", t.NETWORK_ERROR = "NETWORK_ERROR", t.SERVER_ERROR = "SERVER_ERROR", t.TIMEOUT = "TIMEOUT", t.BUFFER_OVERRUN = "BUFFER_OVERRUN", t.NUMERIC_FAULT = "NUMERIC_FAULT", t.MISSING_NEW = "MISSING_NEW", t.INVALID_ARGUMENT = "INVALID_ARGUMENT", t.MISSING_ARGUMENT = "MISSING_ARGUMENT", t.UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT", t.CALL_EXCEPTION = "CALL_EXCEPTION", t.INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS", t.NONCE_EXPIRED = "NONCE_EXPIRED", t.REPLACEMENT_UNDERPRICED = "REPLACEMENT_UNDERPRICED", t.UNPREDICTABLE_GAS_LIMIT = "UNPREDICTABLE_GAS_LIMIT", t.TRANSACTION_REPLACED = "TRANSACTION_REPLACED", t.ACTION_REJECTED = "ACTION_REJECTED"; })(ws || (ws = {})); -const vx = "0123456789abcdef"; +const mx = "0123456789abcdef"; class Yr { constructor(e) { Object.defineProperty(this, "version", { @@ -8651,7 +8651,7 @@ class Yr { } _log(e, r) { const n = e.toLowerCase(); - Ad[n] == null && this.throwArgumentError("invalid log level name", "logLevel", e), !(gx > Ad[n]) && console.log.apply(console, r); + Ad[n] == null && this.throwArgumentError("invalid log level name", "logLevel", e), !(px > Ad[n]) && console.log.apply(console, r); } debug(...e) { this._log(Yr.levels.DEBUG, e); @@ -8663,7 +8663,7 @@ class Yr { this._log(Yr.levels.WARNING, e); } makeError(e, r, n) { - if (px) + if (dx) return this.makeError("censored error", r, {}); r || (r = Yr.errors.UNKNOWN_ERROR), n || (n = {}); const i = []; @@ -8673,7 +8673,7 @@ class Yr { if (l instanceof Uint8Array) { let d = ""; for (let p = 0; p < l.length; p++) - d += vx[l[p] >> 4], d += vx[l[p] & 15]; + d += mx[l[p] >> 4], d += mx[l[p] & 15]; i.push(u + "=Uint8Array(0x" + d + ")"); } else i.push(u + "=" + JSON.stringify(l)); @@ -8735,9 +8735,9 @@ class Yr { e || this.throwArgumentError(r, n, i); } checkNormalize(e) { - mx && this.throwError("platform missing String.prototype.normalize", Yr.errors.UNSUPPORTED_OPERATION, { + gx && this.throwError("platform missing String.prototype.normalize", Yr.errors.UNSUPPORTED_OPERATION, { operation: "String.prototype.normalize", - form: mx + form: gx }); } checkSafeUint53(e, r) { @@ -8772,14 +8772,14 @@ class Yr { static setCensorship(e, r) { if (!e && r && this.globalLogger().throwError("cannot permanently disable censorship", Yr.errors.UNSUPPORTED_OPERATION, { operation: "setCensorship" - }), dx) { + }), hx) { if (!e) return; this.globalLogger().throwError("error censorship permanent", Yr.errors.UNSUPPORTED_OPERATION, { operation: "setCensorship" }); } - px = !!e, dx = !!r; + dx = !!e, hx = !!r; } static setLogLevel(e) { const r = Ad[e.toLowerCase()]; @@ -8787,7 +8787,7 @@ class Yr { Yr.globalLogger().warn("invalid log level - " + e); return; } - gx = r; + px = r; } static from(e) { return new Yr(e); @@ -8796,7 +8796,7 @@ class Yr { Yr.errors = ws; Yr.levels = y1; const MF = "bytes/5.7.0", hn = new Yr(MF); -function V4(t) { +function K4(t) { return !!t.toHexString; } function fu(t) { @@ -8806,21 +8806,21 @@ function fu(t) { }), t; } function IF(t) { - return zs(t) && !(t.length % 2) || zv(t); + return zs(t) && !(t.length % 2) || qv(t); } -function bx(t) { +function vx(t) { return typeof t == "number" && t == t && t % 1 === 0; } -function zv(t) { +function qv(t) { if (t == null) return !1; if (t.constructor === Uint8Array) return !0; - if (typeof t == "string" || !bx(t.length) || t.length < 0) + if (typeof t == "string" || !vx(t.length) || t.length < 0) return !1; for (let e = 0; e < t.length; e++) { const r = t[e]; - if (!bx(r) || r < 0 || r >= 256) + if (!vx(r) || r < 0 || r >= 256) return !1; } return !0; @@ -8833,7 +8833,7 @@ function wn(t, e) { r.unshift(t & 255), t = parseInt(String(t / 256)); return r.length === 0 && r.push(0), fu(new Uint8Array(r)); } - if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), V4(t) && (t = t.toHexString()), zs(t)) { + if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), K4(t) && (t = t.toHexString()), zs(t)) { let r = t.substring(2); r.length % 2 && (e.hexPad === "left" ? r = "0" + r : e.hexPad === "right" ? r += "0" : hn.throwArgumentError("hex data is odd-length", "value", t)); const n = []; @@ -8841,7 +8841,7 @@ function wn(t, e) { n.push(parseInt(r.substring(i, i + 2), 16)); return fu(new Uint8Array(n)); } - return zv(t) ? fu(new Uint8Array(t)) : hn.throwArgumentError("invalid arrayify value", "value", t); + return qv(t) ? fu(new Uint8Array(t)) : hn.throwArgumentError("invalid arrayify value", "value", t); } function CF(t) { const e = t.map((i) => wn(i)), r = e.reduce((i, s) => i + s.length, 0), n = new Uint8Array(r); @@ -8866,11 +8866,11 @@ function Ri(t, e) { } if (typeof t == "bigint") return t = t.toString(16), t.length % 2 ? "0x0" + t : "0x" + t; - if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), V4(t)) + if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), K4(t)) return t.toHexString(); if (zs(t)) return t.length % 2 && (e.hexPad === "left" ? t = "0x0" + t.substring(2) : e.hexPad === "right" ? t += "0" : hn.throwArgumentError("hex data is odd-length", "value", t)), t.toLowerCase(); - if (zv(t)) { + if (qv(t)) { let r = "0x"; for (let n = 0; n < t.length; n++) { let i = t[n]; @@ -8887,7 +8887,7 @@ function RF(t) { return null; return (t.length - 2) / 2; } -function yx(t, e, r) { +function bx(t, e, r) { return typeof t != "string" ? t = Ri(t) : (!zs(t) || t.length % 2) && hn.throwArgumentError("invalid hexData", "value", t), e = 2 + 2 * e, "0x" + t.substring(e); } function lu(t, e) { @@ -8895,7 +8895,7 @@ function lu(t, e) { t = "0x0" + t.substring(2); return t; } -function G4(t) { +function V4(t) { const e = { r: "0x", s: "0x", @@ -8933,11 +8933,11 @@ function G4(t) { } return e.yParityAndS = e._vs, e.compact = e.r + e.yParityAndS.substring(2), e; } -function Wv(t) { +function zv(t) { return "0x" + SF.keccak_256(wn(t)); } -var Hv = { exports: {} }; -Hv.exports; +var Wv = { exports: {} }; +Wv.exports; (function(t) { (function(e, r) { function n(m, f) { @@ -9383,7 +9383,7 @@ Hv.exports; }, s.prototype.sub = function(f) { return this.clone().isub(f); }; - function $(m, f, g) { + function B(m, f, g) { g.negative = f.negative ^ m.negative; var b = m.length + f.length | 0; g.length = b, b = b - 1 | 0; @@ -9398,8 +9398,8 @@ Hv.exports; } return P !== 0 ? g.words[I] = P | 0 : g.length--, g._strip(); } - var B = function(f, g, b) { - var x = f.words, _ = g.words, E = b.words, v = 0, P, I, F, ce = x[0] | 0, D = ce & 8191, oe = ce >>> 13, Z = x[1] | 0, J = Z & 8191, Q = Z >>> 13, T = x[2] | 0, X = T & 8191, re = T >>> 13, de = x[3] | 0, ie = de & 8191, ue = de >>> 13, ve = x[4] | 0, Pe = ve & 8191, De = ve >>> 13, Ce = x[5] | 0, $e = Ce & 8191, Me = Ce >>> 13, Ne = x[6] | 0, Ke = Ne & 8191, Le = Ne >>> 13, qe = x[7] | 0, ze = qe & 8191, _e = qe >>> 13, Ze = x[8] | 0, at = Ze & 8191, ke = Ze >>> 13, Qe = x[9] | 0, tt = Qe & 8191, Ye = Qe >>> 13, dt = _[0] | 0, lt = dt & 8191, ct = dt >>> 13, qt = _[1] | 0, Jt = qt & 8191, Et = qt >>> 13, er = _[2] | 0, Xt = er & 8191, Dt = er >>> 13, kt = _[3] | 0, Ct = kt & 8191, gt = kt >>> 13, Rt = _[4] | 0, Nt = Rt & 8191, vt = Rt >>> 13, $t = _[5] | 0, Ft = $t & 8191, rt = $t >>> 13, Bt = _[6] | 0, k = Bt & 8191, q = Bt >>> 13, W = _[7] | 0, C = W & 8191, G = W >>> 13, j = _[8] | 0, se = j & 8191, he = j >>> 13, xe = _[9] | 0, Te = xe & 8191, Re = xe >>> 13; + var $ = function(f, g, b) { + var x = f.words, _ = g.words, E = b.words, v = 0, P, I, F, ce = x[0] | 0, D = ce & 8191, oe = ce >>> 13, Z = x[1] | 0, J = Z & 8191, Q = Z >>> 13, T = x[2] | 0, X = T & 8191, re = T >>> 13, pe = x[3] | 0, ie = pe & 8191, ue = pe >>> 13, ve = x[4] | 0, Pe = ve & 8191, De = ve >>> 13, Ce = x[5] | 0, $e = Ce & 8191, Me = Ce >>> 13, Ne = x[6] | 0, Ke = Ne & 8191, Le = Ne >>> 13, qe = x[7] | 0, ze = qe & 8191, _e = qe >>> 13, Ze = x[8] | 0, at = Ze & 8191, ke = Ze >>> 13, Qe = x[9] | 0, tt = Qe & 8191, Ye = Qe >>> 13, dt = _[0] | 0, lt = dt & 8191, ct = dt >>> 13, qt = _[1] | 0, Jt = qt & 8191, Et = qt >>> 13, er = _[2] | 0, Xt = er & 8191, Dt = er >>> 13, kt = _[3] | 0, Ct = kt & 8191, gt = kt >>> 13, Rt = _[4] | 0, Nt = Rt & 8191, vt = Rt >>> 13, $t = _[5] | 0, Ft = $t & 8191, rt = $t >>> 13, Bt = _[6] | 0, k = Bt & 8191, q = Bt >>> 13, W = _[7] | 0, C = W & 8191, G = W >>> 13, j = _[8] | 0, se = j & 8191, de = j >>> 13, xe = _[9] | 0, Te = xe & 8191, Re = xe >>> 13; b.negative = f.negative ^ g.negative, b.length = 19, P = Math.imul(D, lt), I = Math.imul(D, ct), I = I + Math.imul(oe, lt) | 0, F = Math.imul(oe, ct); var nt = (v + P | 0) + ((I & 8191) << 13) | 0; v = (F + (I >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, P = Math.imul(J, lt), I = Math.imul(J, ct), I = I + Math.imul(Q, lt) | 0, F = Math.imul(Q, ct), P = P + Math.imul(D, Jt) | 0, I = I + Math.imul(D, Et) | 0, I = I + Math.imul(oe, Jt) | 0, F = F + Math.imul(oe, Et) | 0; @@ -9416,31 +9416,31 @@ Hv.exports; var Tt = (v + P | 0) + ((I & 8191) << 13) | 0; v = (F + (I >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, P = Math.imul(ze, lt), I = Math.imul(ze, ct), I = I + Math.imul(_e, lt) | 0, F = Math.imul(_e, ct), P = P + Math.imul(Ke, Jt) | 0, I = I + Math.imul(Ke, Et) | 0, I = I + Math.imul(Le, Jt) | 0, F = F + Math.imul(Le, Et) | 0, P = P + Math.imul($e, Xt) | 0, I = I + Math.imul($e, Dt) | 0, I = I + Math.imul(Me, Xt) | 0, F = F + Math.imul(Me, Dt) | 0, P = P + Math.imul(Pe, Ct) | 0, I = I + Math.imul(Pe, gt) | 0, I = I + Math.imul(De, Ct) | 0, F = F + Math.imul(De, gt) | 0, P = P + Math.imul(ie, Nt) | 0, I = I + Math.imul(ie, vt) | 0, I = I + Math.imul(ue, Nt) | 0, F = F + Math.imul(ue, vt) | 0, P = P + Math.imul(X, Ft) | 0, I = I + Math.imul(X, rt) | 0, I = I + Math.imul(re, Ft) | 0, F = F + Math.imul(re, rt) | 0, P = P + Math.imul(J, k) | 0, I = I + Math.imul(J, q) | 0, I = I + Math.imul(Q, k) | 0, F = F + Math.imul(Q, q) | 0, P = P + Math.imul(D, C) | 0, I = I + Math.imul(D, G) | 0, I = I + Math.imul(oe, C) | 0, F = F + Math.imul(oe, G) | 0; var At = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, P = Math.imul(at, lt), I = Math.imul(at, ct), I = I + Math.imul(ke, lt) | 0, F = Math.imul(ke, ct), P = P + Math.imul(ze, Jt) | 0, I = I + Math.imul(ze, Et) | 0, I = I + Math.imul(_e, Jt) | 0, F = F + Math.imul(_e, Et) | 0, P = P + Math.imul(Ke, Xt) | 0, I = I + Math.imul(Ke, Dt) | 0, I = I + Math.imul(Le, Xt) | 0, F = F + Math.imul(Le, Dt) | 0, P = P + Math.imul($e, Ct) | 0, I = I + Math.imul($e, gt) | 0, I = I + Math.imul(Me, Ct) | 0, F = F + Math.imul(Me, gt) | 0, P = P + Math.imul(Pe, Nt) | 0, I = I + Math.imul(Pe, vt) | 0, I = I + Math.imul(De, Nt) | 0, F = F + Math.imul(De, vt) | 0, P = P + Math.imul(ie, Ft) | 0, I = I + Math.imul(ie, rt) | 0, I = I + Math.imul(ue, Ft) | 0, F = F + Math.imul(ue, rt) | 0, P = P + Math.imul(X, k) | 0, I = I + Math.imul(X, q) | 0, I = I + Math.imul(re, k) | 0, F = F + Math.imul(re, q) | 0, P = P + Math.imul(J, C) | 0, I = I + Math.imul(J, G) | 0, I = I + Math.imul(Q, C) | 0, F = F + Math.imul(Q, G) | 0, P = P + Math.imul(D, se) | 0, I = I + Math.imul(D, he) | 0, I = I + Math.imul(oe, se) | 0, F = F + Math.imul(oe, he) | 0; + v = (F + (I >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, P = Math.imul(at, lt), I = Math.imul(at, ct), I = I + Math.imul(ke, lt) | 0, F = Math.imul(ke, ct), P = P + Math.imul(ze, Jt) | 0, I = I + Math.imul(ze, Et) | 0, I = I + Math.imul(_e, Jt) | 0, F = F + Math.imul(_e, Et) | 0, P = P + Math.imul(Ke, Xt) | 0, I = I + Math.imul(Ke, Dt) | 0, I = I + Math.imul(Le, Xt) | 0, F = F + Math.imul(Le, Dt) | 0, P = P + Math.imul($e, Ct) | 0, I = I + Math.imul($e, gt) | 0, I = I + Math.imul(Me, Ct) | 0, F = F + Math.imul(Me, gt) | 0, P = P + Math.imul(Pe, Nt) | 0, I = I + Math.imul(Pe, vt) | 0, I = I + Math.imul(De, Nt) | 0, F = F + Math.imul(De, vt) | 0, P = P + Math.imul(ie, Ft) | 0, I = I + Math.imul(ie, rt) | 0, I = I + Math.imul(ue, Ft) | 0, F = F + Math.imul(ue, rt) | 0, P = P + Math.imul(X, k) | 0, I = I + Math.imul(X, q) | 0, I = I + Math.imul(re, k) | 0, F = F + Math.imul(re, q) | 0, P = P + Math.imul(J, C) | 0, I = I + Math.imul(J, G) | 0, I = I + Math.imul(Q, C) | 0, F = F + Math.imul(Q, G) | 0, P = P + Math.imul(D, se) | 0, I = I + Math.imul(D, de) | 0, I = I + Math.imul(oe, se) | 0, F = F + Math.imul(oe, de) | 0; var _t = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, P = Math.imul(tt, lt), I = Math.imul(tt, ct), I = I + Math.imul(Ye, lt) | 0, F = Math.imul(Ye, ct), P = P + Math.imul(at, Jt) | 0, I = I + Math.imul(at, Et) | 0, I = I + Math.imul(ke, Jt) | 0, F = F + Math.imul(ke, Et) | 0, P = P + Math.imul(ze, Xt) | 0, I = I + Math.imul(ze, Dt) | 0, I = I + Math.imul(_e, Xt) | 0, F = F + Math.imul(_e, Dt) | 0, P = P + Math.imul(Ke, Ct) | 0, I = I + Math.imul(Ke, gt) | 0, I = I + Math.imul(Le, Ct) | 0, F = F + Math.imul(Le, gt) | 0, P = P + Math.imul($e, Nt) | 0, I = I + Math.imul($e, vt) | 0, I = I + Math.imul(Me, Nt) | 0, F = F + Math.imul(Me, vt) | 0, P = P + Math.imul(Pe, Ft) | 0, I = I + Math.imul(Pe, rt) | 0, I = I + Math.imul(De, Ft) | 0, F = F + Math.imul(De, rt) | 0, P = P + Math.imul(ie, k) | 0, I = I + Math.imul(ie, q) | 0, I = I + Math.imul(ue, k) | 0, F = F + Math.imul(ue, q) | 0, P = P + Math.imul(X, C) | 0, I = I + Math.imul(X, G) | 0, I = I + Math.imul(re, C) | 0, F = F + Math.imul(re, G) | 0, P = P + Math.imul(J, se) | 0, I = I + Math.imul(J, he) | 0, I = I + Math.imul(Q, se) | 0, F = F + Math.imul(Q, he) | 0, P = P + Math.imul(D, Te) | 0, I = I + Math.imul(D, Re) | 0, I = I + Math.imul(oe, Te) | 0, F = F + Math.imul(oe, Re) | 0; + v = (F + (I >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, P = Math.imul(tt, lt), I = Math.imul(tt, ct), I = I + Math.imul(Ye, lt) | 0, F = Math.imul(Ye, ct), P = P + Math.imul(at, Jt) | 0, I = I + Math.imul(at, Et) | 0, I = I + Math.imul(ke, Jt) | 0, F = F + Math.imul(ke, Et) | 0, P = P + Math.imul(ze, Xt) | 0, I = I + Math.imul(ze, Dt) | 0, I = I + Math.imul(_e, Xt) | 0, F = F + Math.imul(_e, Dt) | 0, P = P + Math.imul(Ke, Ct) | 0, I = I + Math.imul(Ke, gt) | 0, I = I + Math.imul(Le, Ct) | 0, F = F + Math.imul(Le, gt) | 0, P = P + Math.imul($e, Nt) | 0, I = I + Math.imul($e, vt) | 0, I = I + Math.imul(Me, Nt) | 0, F = F + Math.imul(Me, vt) | 0, P = P + Math.imul(Pe, Ft) | 0, I = I + Math.imul(Pe, rt) | 0, I = I + Math.imul(De, Ft) | 0, F = F + Math.imul(De, rt) | 0, P = P + Math.imul(ie, k) | 0, I = I + Math.imul(ie, q) | 0, I = I + Math.imul(ue, k) | 0, F = F + Math.imul(ue, q) | 0, P = P + Math.imul(X, C) | 0, I = I + Math.imul(X, G) | 0, I = I + Math.imul(re, C) | 0, F = F + Math.imul(re, G) | 0, P = P + Math.imul(J, se) | 0, I = I + Math.imul(J, de) | 0, I = I + Math.imul(Q, se) | 0, F = F + Math.imul(Q, de) | 0, P = P + Math.imul(D, Te) | 0, I = I + Math.imul(D, Re) | 0, I = I + Math.imul(oe, Te) | 0, F = F + Math.imul(oe, Re) | 0; var ht = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, P = Math.imul(tt, Jt), I = Math.imul(tt, Et), I = I + Math.imul(Ye, Jt) | 0, F = Math.imul(Ye, Et), P = P + Math.imul(at, Xt) | 0, I = I + Math.imul(at, Dt) | 0, I = I + Math.imul(ke, Xt) | 0, F = F + Math.imul(ke, Dt) | 0, P = P + Math.imul(ze, Ct) | 0, I = I + Math.imul(ze, gt) | 0, I = I + Math.imul(_e, Ct) | 0, F = F + Math.imul(_e, gt) | 0, P = P + Math.imul(Ke, Nt) | 0, I = I + Math.imul(Ke, vt) | 0, I = I + Math.imul(Le, Nt) | 0, F = F + Math.imul(Le, vt) | 0, P = P + Math.imul($e, Ft) | 0, I = I + Math.imul($e, rt) | 0, I = I + Math.imul(Me, Ft) | 0, F = F + Math.imul(Me, rt) | 0, P = P + Math.imul(Pe, k) | 0, I = I + Math.imul(Pe, q) | 0, I = I + Math.imul(De, k) | 0, F = F + Math.imul(De, q) | 0, P = P + Math.imul(ie, C) | 0, I = I + Math.imul(ie, G) | 0, I = I + Math.imul(ue, C) | 0, F = F + Math.imul(ue, G) | 0, P = P + Math.imul(X, se) | 0, I = I + Math.imul(X, he) | 0, I = I + Math.imul(re, se) | 0, F = F + Math.imul(re, he) | 0, P = P + Math.imul(J, Te) | 0, I = I + Math.imul(J, Re) | 0, I = I + Math.imul(Q, Te) | 0, F = F + Math.imul(Q, Re) | 0; + v = (F + (I >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, P = Math.imul(tt, Jt), I = Math.imul(tt, Et), I = I + Math.imul(Ye, Jt) | 0, F = Math.imul(Ye, Et), P = P + Math.imul(at, Xt) | 0, I = I + Math.imul(at, Dt) | 0, I = I + Math.imul(ke, Xt) | 0, F = F + Math.imul(ke, Dt) | 0, P = P + Math.imul(ze, Ct) | 0, I = I + Math.imul(ze, gt) | 0, I = I + Math.imul(_e, Ct) | 0, F = F + Math.imul(_e, gt) | 0, P = P + Math.imul(Ke, Nt) | 0, I = I + Math.imul(Ke, vt) | 0, I = I + Math.imul(Le, Nt) | 0, F = F + Math.imul(Le, vt) | 0, P = P + Math.imul($e, Ft) | 0, I = I + Math.imul($e, rt) | 0, I = I + Math.imul(Me, Ft) | 0, F = F + Math.imul(Me, rt) | 0, P = P + Math.imul(Pe, k) | 0, I = I + Math.imul(Pe, q) | 0, I = I + Math.imul(De, k) | 0, F = F + Math.imul(De, q) | 0, P = P + Math.imul(ie, C) | 0, I = I + Math.imul(ie, G) | 0, I = I + Math.imul(ue, C) | 0, F = F + Math.imul(ue, G) | 0, P = P + Math.imul(X, se) | 0, I = I + Math.imul(X, de) | 0, I = I + Math.imul(re, se) | 0, F = F + Math.imul(re, de) | 0, P = P + Math.imul(J, Te) | 0, I = I + Math.imul(J, Re) | 0, I = I + Math.imul(Q, Te) | 0, F = F + Math.imul(Q, Re) | 0; var xt = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, P = Math.imul(tt, Xt), I = Math.imul(tt, Dt), I = I + Math.imul(Ye, Xt) | 0, F = Math.imul(Ye, Dt), P = P + Math.imul(at, Ct) | 0, I = I + Math.imul(at, gt) | 0, I = I + Math.imul(ke, Ct) | 0, F = F + Math.imul(ke, gt) | 0, P = P + Math.imul(ze, Nt) | 0, I = I + Math.imul(ze, vt) | 0, I = I + Math.imul(_e, Nt) | 0, F = F + Math.imul(_e, vt) | 0, P = P + Math.imul(Ke, Ft) | 0, I = I + Math.imul(Ke, rt) | 0, I = I + Math.imul(Le, Ft) | 0, F = F + Math.imul(Le, rt) | 0, P = P + Math.imul($e, k) | 0, I = I + Math.imul($e, q) | 0, I = I + Math.imul(Me, k) | 0, F = F + Math.imul(Me, q) | 0, P = P + Math.imul(Pe, C) | 0, I = I + Math.imul(Pe, G) | 0, I = I + Math.imul(De, C) | 0, F = F + Math.imul(De, G) | 0, P = P + Math.imul(ie, se) | 0, I = I + Math.imul(ie, he) | 0, I = I + Math.imul(ue, se) | 0, F = F + Math.imul(ue, he) | 0, P = P + Math.imul(X, Te) | 0, I = I + Math.imul(X, Re) | 0, I = I + Math.imul(re, Te) | 0, F = F + Math.imul(re, Re) | 0; + v = (F + (I >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, P = Math.imul(tt, Xt), I = Math.imul(tt, Dt), I = I + Math.imul(Ye, Xt) | 0, F = Math.imul(Ye, Dt), P = P + Math.imul(at, Ct) | 0, I = I + Math.imul(at, gt) | 0, I = I + Math.imul(ke, Ct) | 0, F = F + Math.imul(ke, gt) | 0, P = P + Math.imul(ze, Nt) | 0, I = I + Math.imul(ze, vt) | 0, I = I + Math.imul(_e, Nt) | 0, F = F + Math.imul(_e, vt) | 0, P = P + Math.imul(Ke, Ft) | 0, I = I + Math.imul(Ke, rt) | 0, I = I + Math.imul(Le, Ft) | 0, F = F + Math.imul(Le, rt) | 0, P = P + Math.imul($e, k) | 0, I = I + Math.imul($e, q) | 0, I = I + Math.imul(Me, k) | 0, F = F + Math.imul(Me, q) | 0, P = P + Math.imul(Pe, C) | 0, I = I + Math.imul(Pe, G) | 0, I = I + Math.imul(De, C) | 0, F = F + Math.imul(De, G) | 0, P = P + Math.imul(ie, se) | 0, I = I + Math.imul(ie, de) | 0, I = I + Math.imul(ue, se) | 0, F = F + Math.imul(ue, de) | 0, P = P + Math.imul(X, Te) | 0, I = I + Math.imul(X, Re) | 0, I = I + Math.imul(re, Te) | 0, F = F + Math.imul(re, Re) | 0; var st = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, P = Math.imul(tt, Ct), I = Math.imul(tt, gt), I = I + Math.imul(Ye, Ct) | 0, F = Math.imul(Ye, gt), P = P + Math.imul(at, Nt) | 0, I = I + Math.imul(at, vt) | 0, I = I + Math.imul(ke, Nt) | 0, F = F + Math.imul(ke, vt) | 0, P = P + Math.imul(ze, Ft) | 0, I = I + Math.imul(ze, rt) | 0, I = I + Math.imul(_e, Ft) | 0, F = F + Math.imul(_e, rt) | 0, P = P + Math.imul(Ke, k) | 0, I = I + Math.imul(Ke, q) | 0, I = I + Math.imul(Le, k) | 0, F = F + Math.imul(Le, q) | 0, P = P + Math.imul($e, C) | 0, I = I + Math.imul($e, G) | 0, I = I + Math.imul(Me, C) | 0, F = F + Math.imul(Me, G) | 0, P = P + Math.imul(Pe, se) | 0, I = I + Math.imul(Pe, he) | 0, I = I + Math.imul(De, se) | 0, F = F + Math.imul(De, he) | 0, P = P + Math.imul(ie, Te) | 0, I = I + Math.imul(ie, Re) | 0, I = I + Math.imul(ue, Te) | 0, F = F + Math.imul(ue, Re) | 0; + v = (F + (I >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, P = Math.imul(tt, Ct), I = Math.imul(tt, gt), I = I + Math.imul(Ye, Ct) | 0, F = Math.imul(Ye, gt), P = P + Math.imul(at, Nt) | 0, I = I + Math.imul(at, vt) | 0, I = I + Math.imul(ke, Nt) | 0, F = F + Math.imul(ke, vt) | 0, P = P + Math.imul(ze, Ft) | 0, I = I + Math.imul(ze, rt) | 0, I = I + Math.imul(_e, Ft) | 0, F = F + Math.imul(_e, rt) | 0, P = P + Math.imul(Ke, k) | 0, I = I + Math.imul(Ke, q) | 0, I = I + Math.imul(Le, k) | 0, F = F + Math.imul(Le, q) | 0, P = P + Math.imul($e, C) | 0, I = I + Math.imul($e, G) | 0, I = I + Math.imul(Me, C) | 0, F = F + Math.imul(Me, G) | 0, P = P + Math.imul(Pe, se) | 0, I = I + Math.imul(Pe, de) | 0, I = I + Math.imul(De, se) | 0, F = F + Math.imul(De, de) | 0, P = P + Math.imul(ie, Te) | 0, I = I + Math.imul(ie, Re) | 0, I = I + Math.imul(ue, Te) | 0, F = F + Math.imul(ue, Re) | 0; var bt = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, P = Math.imul(tt, Nt), I = Math.imul(tt, vt), I = I + Math.imul(Ye, Nt) | 0, F = Math.imul(Ye, vt), P = P + Math.imul(at, Ft) | 0, I = I + Math.imul(at, rt) | 0, I = I + Math.imul(ke, Ft) | 0, F = F + Math.imul(ke, rt) | 0, P = P + Math.imul(ze, k) | 0, I = I + Math.imul(ze, q) | 0, I = I + Math.imul(_e, k) | 0, F = F + Math.imul(_e, q) | 0, P = P + Math.imul(Ke, C) | 0, I = I + Math.imul(Ke, G) | 0, I = I + Math.imul(Le, C) | 0, F = F + Math.imul(Le, G) | 0, P = P + Math.imul($e, se) | 0, I = I + Math.imul($e, he) | 0, I = I + Math.imul(Me, se) | 0, F = F + Math.imul(Me, he) | 0, P = P + Math.imul(Pe, Te) | 0, I = I + Math.imul(Pe, Re) | 0, I = I + Math.imul(De, Te) | 0, F = F + Math.imul(De, Re) | 0; + v = (F + (I >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, P = Math.imul(tt, Nt), I = Math.imul(tt, vt), I = I + Math.imul(Ye, Nt) | 0, F = Math.imul(Ye, vt), P = P + Math.imul(at, Ft) | 0, I = I + Math.imul(at, rt) | 0, I = I + Math.imul(ke, Ft) | 0, F = F + Math.imul(ke, rt) | 0, P = P + Math.imul(ze, k) | 0, I = I + Math.imul(ze, q) | 0, I = I + Math.imul(_e, k) | 0, F = F + Math.imul(_e, q) | 0, P = P + Math.imul(Ke, C) | 0, I = I + Math.imul(Ke, G) | 0, I = I + Math.imul(Le, C) | 0, F = F + Math.imul(Le, G) | 0, P = P + Math.imul($e, se) | 0, I = I + Math.imul($e, de) | 0, I = I + Math.imul(Me, se) | 0, F = F + Math.imul(Me, de) | 0, P = P + Math.imul(Pe, Te) | 0, I = I + Math.imul(Pe, Re) | 0, I = I + Math.imul(De, Te) | 0, F = F + Math.imul(De, Re) | 0; var ut = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, P = Math.imul(tt, Ft), I = Math.imul(tt, rt), I = I + Math.imul(Ye, Ft) | 0, F = Math.imul(Ye, rt), P = P + Math.imul(at, k) | 0, I = I + Math.imul(at, q) | 0, I = I + Math.imul(ke, k) | 0, F = F + Math.imul(ke, q) | 0, P = P + Math.imul(ze, C) | 0, I = I + Math.imul(ze, G) | 0, I = I + Math.imul(_e, C) | 0, F = F + Math.imul(_e, G) | 0, P = P + Math.imul(Ke, se) | 0, I = I + Math.imul(Ke, he) | 0, I = I + Math.imul(Le, se) | 0, F = F + Math.imul(Le, he) | 0, P = P + Math.imul($e, Te) | 0, I = I + Math.imul($e, Re) | 0, I = I + Math.imul(Me, Te) | 0, F = F + Math.imul(Me, Re) | 0; + v = (F + (I >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, P = Math.imul(tt, Ft), I = Math.imul(tt, rt), I = I + Math.imul(Ye, Ft) | 0, F = Math.imul(Ye, rt), P = P + Math.imul(at, k) | 0, I = I + Math.imul(at, q) | 0, I = I + Math.imul(ke, k) | 0, F = F + Math.imul(ke, q) | 0, P = P + Math.imul(ze, C) | 0, I = I + Math.imul(ze, G) | 0, I = I + Math.imul(_e, C) | 0, F = F + Math.imul(_e, G) | 0, P = P + Math.imul(Ke, se) | 0, I = I + Math.imul(Ke, de) | 0, I = I + Math.imul(Le, se) | 0, F = F + Math.imul(Le, de) | 0, P = P + Math.imul($e, Te) | 0, I = I + Math.imul($e, Re) | 0, I = I + Math.imul(Me, Te) | 0, F = F + Math.imul(Me, Re) | 0; var ot = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, P = Math.imul(tt, k), I = Math.imul(tt, q), I = I + Math.imul(Ye, k) | 0, F = Math.imul(Ye, q), P = P + Math.imul(at, C) | 0, I = I + Math.imul(at, G) | 0, I = I + Math.imul(ke, C) | 0, F = F + Math.imul(ke, G) | 0, P = P + Math.imul(ze, se) | 0, I = I + Math.imul(ze, he) | 0, I = I + Math.imul(_e, se) | 0, F = F + Math.imul(_e, he) | 0, P = P + Math.imul(Ke, Te) | 0, I = I + Math.imul(Ke, Re) | 0, I = I + Math.imul(Le, Te) | 0, F = F + Math.imul(Le, Re) | 0; + v = (F + (I >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, P = Math.imul(tt, k), I = Math.imul(tt, q), I = I + Math.imul(Ye, k) | 0, F = Math.imul(Ye, q), P = P + Math.imul(at, C) | 0, I = I + Math.imul(at, G) | 0, I = I + Math.imul(ke, C) | 0, F = F + Math.imul(ke, G) | 0, P = P + Math.imul(ze, se) | 0, I = I + Math.imul(ze, de) | 0, I = I + Math.imul(_e, se) | 0, F = F + Math.imul(_e, de) | 0, P = P + Math.imul(Ke, Te) | 0, I = I + Math.imul(Ke, Re) | 0, I = I + Math.imul(Le, Te) | 0, F = F + Math.imul(Le, Re) | 0; var Se = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, P = Math.imul(tt, C), I = Math.imul(tt, G), I = I + Math.imul(Ye, C) | 0, F = Math.imul(Ye, G), P = P + Math.imul(at, se) | 0, I = I + Math.imul(at, he) | 0, I = I + Math.imul(ke, se) | 0, F = F + Math.imul(ke, he) | 0, P = P + Math.imul(ze, Te) | 0, I = I + Math.imul(ze, Re) | 0, I = I + Math.imul(_e, Te) | 0, F = F + Math.imul(_e, Re) | 0; + v = (F + (I >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, P = Math.imul(tt, C), I = Math.imul(tt, G), I = I + Math.imul(Ye, C) | 0, F = Math.imul(Ye, G), P = P + Math.imul(at, se) | 0, I = I + Math.imul(at, de) | 0, I = I + Math.imul(ke, se) | 0, F = F + Math.imul(ke, de) | 0, P = P + Math.imul(ze, Te) | 0, I = I + Math.imul(ze, Re) | 0, I = I + Math.imul(_e, Te) | 0, F = F + Math.imul(_e, Re) | 0; var Ae = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, P = Math.imul(tt, se), I = Math.imul(tt, he), I = I + Math.imul(Ye, se) | 0, F = Math.imul(Ye, he), P = P + Math.imul(at, Te) | 0, I = I + Math.imul(at, Re) | 0, I = I + Math.imul(ke, Te) | 0, F = F + Math.imul(ke, Re) | 0; + v = (F + (I >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, P = Math.imul(tt, se), I = Math.imul(tt, de), I = I + Math.imul(Ye, se) | 0, F = Math.imul(Ye, de), P = P + Math.imul(at, Te) | 0, I = I + Math.imul(at, Re) | 0, I = I + Math.imul(ke, Te) | 0, F = F + Math.imul(ke, Re) | 0; var Ve = (v + P | 0) + ((I & 8191) << 13) | 0; v = (F + (I >>> 13) | 0) + (Ve >>> 26) | 0, Ve &= 67108863, P = Math.imul(tt, Te), I = Math.imul(tt, Re), I = I + Math.imul(Ye, Te) | 0, F = Math.imul(Ye, Re); var Fe = (v + P | 0) + ((I & 8191) << 13) | 0; return v = (F + (I >>> 13) | 0) + (Fe >>> 26) | 0, Fe &= 67108863, E[0] = nt, E[1] = je, E[2] = pt, E[3] = it, E[4] = et, E[5] = St, E[6] = Tt, E[7] = At, E[8] = _t, E[9] = ht, E[10] = xt, E[11] = st, E[12] = bt, E[13] = ut, E[14] = ot, E[15] = Se, E[16] = Ae, E[17] = Ve, E[18] = Fe, v !== 0 && (E[19] = v, b.length++), b; }; - Math.imul || (B = $); + Math.imul || ($ = B); function H(m, f, g) { g.negative = f.negative ^ m.negative, g.length = m.length + f.length; for (var b = 0, x = 0, _ = 0; _ < g.length - 1; _++) { @@ -9459,7 +9459,7 @@ Hv.exports; } s.prototype.mulTo = function(f, g) { var b, x = this.length + f.length; - return this.length === 10 && f.length === 10 ? b = B(this, f, g) : x < 63 ? b = $(this, f, g) : x < 1024 ? b = H(this, f, g) : b = U(this, f, g), b; + return this.length === 10 && f.length === 10 ? b = $(this, f, g) : x < 63 ? b = B(this, f, g) : x < 1024 ? b = H(this, f, g) : b = U(this, f, g), b; }, s.prototype.mul = function(f) { var g = new s(null); return g.words = new Array(this.length + f.length), this.mulTo(f, g); @@ -10062,8 +10062,8 @@ Hv.exports; return g._forceRed(this); }; })(t, gn); -})(Hv); -var DF = Hv.exports; +})(Wv); +var DF = Wv.exports; const sr = /* @__PURE__ */ ts(DF); var OF = sr.BN; function NF(t) { @@ -10074,10 +10074,10 @@ var r0; (function(t) { t.current = "", t.NFC = "NFC", t.NFD = "NFD", t.NFKC = "NFKC", t.NFKD = "NFKD"; })(r0 || (r0 = {})); -var wx; +var yx; (function(t) { t.UNEXPECTED_CONTINUE = "unexpected continuation byte", t.BAD_PREFIX = "bad codepoint prefix", t.OVERRUN = "string overrun", t.MISSING_CONTINUE = "missing continuation byte", t.OUT_OF_RANGE = "out of UTF-8 range", t.UTF16_SURROGATE = "UTF-16 surrogate", t.OVERLONG = "overlong representation"; -})(wx || (wx = {})); +})(yx || (yx = {})); function em(t, e = r0.current) { e != r0.current && (kF.checkNormalize(), t = t.normalize(e)); let r = []; @@ -10101,20 +10101,20 @@ function em(t, e = r0.current) { } const $F = `Ethereum Signed Message: `; -function Y4(t) { - return typeof t == "string" && (t = em(t)), Wv(CF([ +function G4(t) { + return typeof t == "string" && (t = em(t)), zv(CF([ em($F), em(String(t.length)), t ])); } const BF = "address/5.7.0", $f = new Yr(BF); -function xx(t) { +function wx(t) { zs(t, 20) || $f.throwArgumentError("invalid address", "address", t), t = t.toLowerCase(); const e = t.substring(2).split(""), r = new Uint8Array(40); for (let i = 0; i < 40; i++) r[i] = e[i].charCodeAt(0); - const n = wn(Wv(r)); + const n = wn(zv(r)); for (let i = 0; i < 40; i += 2) n[i >> 1] >> 4 >= 8 && (e[i] = e[i].toUpperCase()), (n[i >> 1] & 15) >= 8 && (e[i + 1] = e[i + 1].toUpperCase()); return "0x" + e.join(""); @@ -10123,17 +10123,17 @@ const FF = 9007199254740991; function jF(t) { return Math.log10 ? Math.log10(t) : Math.log(t) / Math.LN10; } -const Kv = {}; +const Hv = {}; for (let t = 0; t < 10; t++) - Kv[String(t)] = String(t); + Hv[String(t)] = String(t); for (let t = 0; t < 26; t++) - Kv[String.fromCharCode(65 + t)] = String(10 + t); -const _x = Math.floor(jF(FF)); + Hv[String.fromCharCode(65 + t)] = String(10 + t); +const xx = Math.floor(jF(FF)); function UF(t) { t = t.toUpperCase(), t = t.substring(4) + t.substring(0, 2) + "00"; - let e = t.split("").map((n) => Kv[n]).join(""); - for (; e.length >= _x; ) { - let n = e.substring(0, _x); + let e = t.split("").map((n) => Hv[n]).join(""); + for (; e.length >= xx; ) { + let n = e.substring(0, xx); e = parseInt(n, 10) % 97 + e.substring(n.length); } let r = String(98 - parseInt(e, 10) % 97); @@ -10144,11 +10144,11 @@ function UF(t) { function qF(t) { let e = null; if (typeof t != "string" && $f.throwArgumentError("invalid address", "address", t), t.match(/^(0x)?[0-9a-fA-F]{40}$/)) - t.substring(0, 2) !== "0x" && (t = "0x" + t), e = xx(t), t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && e !== t && $f.throwArgumentError("bad address checksum", "address", t); + t.substring(0, 2) !== "0x" && (t = "0x" + t), e = wx(t), t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && e !== t && $f.throwArgumentError("bad address checksum", "address", t); else if (t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { for (t.substring(2, 4) !== UF(t) && $f.throwArgumentError("bad icap checksum", "address", t), e = NF(t.substring(4)); e.length < 40; ) e = "0" + e; - e = xx("0x" + e); + e = wx("0x" + e); } else $f.throwArgumentError("invalid address", "address", t); return e; @@ -10160,12 +10160,12 @@ function _f(t, e, r) { writable: !1 }); } -var Vl = {}, xr = {}, wc = J4; -function J4(t, e) { +var Vl = {}, xr = {}, wc = Y4; +function Y4(t, e) { if (!t) throw new Error(e || "Assertion failed"); } -J4.equal = function(e, r, n) { +Y4.equal = function(e, r, n) { if (e != r) throw new Error(n || "Assertion failed: " + e + " != " + r); }; @@ -10215,31 +10215,31 @@ function KF(t, e) { xr.toArray = KF; function VF(t) { for (var e = "", r = 0; r < t.length; r++) - e += Z4(t[r].toString(16)); + e += X4(t[r].toString(16)); return e; } xr.toHex = VF; -function X4(t) { +function J4(t) { var e = t >>> 24 | t >>> 8 & 65280 | t << 8 & 16711680 | (t & 255) << 24; return e >>> 0; } -xr.htonl = X4; +xr.htonl = J4; function GF(t, e) { for (var r = "", n = 0; n < t.length; n++) { var i = t[n]; - e === "little" && (i = X4(i)), r += Q4(i.toString(16)); + e === "little" && (i = J4(i)), r += Z4(i.toString(16)); } return r; } xr.toHex32 = GF; -function Z4(t) { +function X4(t) { return t.length === 1 ? "0" + t : t; } -xr.zero2 = Z4; -function Q4(t) { +xr.zero2 = X4; +function Z4(t) { return t.length === 7 ? "0" + t : t.length === 6 ? "00" + t : t.length === 5 ? "000" + t : t.length === 4 ? "0000" + t : t.length === 3 ? "00000" + t : t.length === 2 ? "000000" + t : t.length === 1 ? "0000000" + t : t; } -xr.zero8 = Q4; +xr.zero8 = Z4; function YF(t, e, r, n) { var i = r - e; zF(i % 4 === 0); @@ -10340,16 +10340,16 @@ function dj(t, e, r) { return n >>> 0; } xr.shr64_lo = dj; -var Lu = {}, Ex = xr, pj = wc; +var Lu = {}, _x = xr, pj = wc; function W0() { this.pending = null, this.pendingTotal = 0, this.blockSize = this.constructor.blockSize, this.outSize = this.constructor.outSize, this.hmacStrength = this.constructor.hmacStrength, this.padLength = this.constructor.padLength / 8, this.endian = "big", this._delta8 = this.blockSize / 8, this._delta32 = this.blockSize / 32; } Lu.BlockHash = W0; W0.prototype.update = function(e, r) { - if (e = Ex.toArray(e, r), this.pending ? this.pending = this.pending.concat(e) : this.pending = e, this.pendingTotal += e.length, this.pending.length >= this._delta8) { + if (e = _x.toArray(e, r), this.pending ? this.pending = this.pending.concat(e) : this.pending = e, this.pendingTotal += e.length, this.pending.length >= this._delta8) { e = this.pending; var n = e.length % this._delta8; - this.pending = e.slice(e.length - n, e.length), this.pending.length === 0 && (this.pending = null), e = Ex.join32(e, 0, e.length - n, this.endian); + this.pending = e.slice(e.length - n, e.length), this.pending.length === 0 && (this.pending = null), e = _x.join32(e, 0, e.length - n, this.endian); for (var i = 0; i < e.length; i += this._delta32) this._update(e, i, i + this._delta32); } @@ -10375,25 +10375,25 @@ W0.prototype._pad = function() { var ku = {}, ro = {}, gj = xr, Ws = gj.rotr32; function mj(t, e, r, n) { if (t === 0) - return e8(e, r, n); + return Q4(e, r, n); if (t === 1 || t === 3) - return r8(e, r, n); - if (t === 2) return t8(e, r, n); + if (t === 2) + return e8(e, r, n); } ro.ft_1 = mj; -function e8(t, e, r) { +function Q4(t, e, r) { return t & e ^ ~t & r; } -ro.ch32 = e8; -function t8(t, e, r) { +ro.ch32 = Q4; +function e8(t, e, r) { return t & e ^ t & r ^ e & r; } -ro.maj32 = t8; -function r8(t, e, r) { +ro.maj32 = e8; +function t8(t, e, r) { return t ^ e ^ r; } -ro.p32 = r8; +ro.p32 = t8; function vj(t) { return Ws(t, 2) ^ Ws(t, 13) ^ Ws(t, 22); } @@ -10410,7 +10410,7 @@ function wj(t) { return Ws(t, 17) ^ Ws(t, 19) ^ t >>> 10; } ro.g1_256 = wj; -var _u = xr, xj = Lu, _j = ro, tm = _u.rotl32, Ef = _u.sum32, Ej = _u.sum32_5, Sj = _j.ft_1, n8 = xj.BlockHash, Aj = [ +var _u = xr, xj = Lu, _j = ro, tm = _u.rotl32, Ef = _u.sum32, Ej = _u.sum32_5, Sj = _j.ft_1, r8 = xj.BlockHash, Aj = [ 1518500249, 1859775393, 2400959708, @@ -10419,7 +10419,7 @@ var _u = xr, xj = Lu, _j = ro, tm = _u.rotl32, Ef = _u.sum32, Ej = _u.sum32_5, S function Js() { if (!(this instanceof Js)) return new Js(); - n8.call(this), this.h = [ + r8.call(this), this.h = [ 1732584193, 4023233417, 2562383102, @@ -10427,7 +10427,7 @@ function Js() { 3285377520 ], this.W = new Array(80); } -_u.inherits(Js, n8); +_u.inherits(Js, r8); var Pj = Js; Js.blockSize = 512; Js.outSize = 160; @@ -10448,7 +10448,7 @@ Js.prototype._update = function(e, r) { Js.prototype._digest = function(e) { return e === "hex" ? _u.toHex32(this.h, "big") : _u.split32(this.h, "big"); }; -var Eu = xr, Mj = Lu, $u = ro, Ij = wc, gs = Eu.sum32, Cj = Eu.sum32_4, Tj = Eu.sum32_5, Rj = $u.ch32, Dj = $u.maj32, Oj = $u.s0_256, Nj = $u.s1_256, Lj = $u.g0_256, kj = $u.g1_256, i8 = Mj.BlockHash, $j = [ +var Eu = xr, Mj = Lu, $u = ro, Ij = wc, gs = Eu.sum32, Cj = Eu.sum32_4, Tj = Eu.sum32_5, Rj = $u.ch32, Dj = $u.maj32, Oj = $u.s0_256, Nj = $u.s1_256, Lj = $u.g0_256, kj = $u.g1_256, n8 = Mj.BlockHash, $j = [ 1116352408, 1899447441, 3049323471, @@ -10517,7 +10517,7 @@ var Eu = xr, Mj = Lu, $u = ro, Ij = wc, gs = Eu.sum32, Cj = Eu.sum32_4, Tj = Eu. function Xs() { if (!(this instanceof Xs)) return new Xs(); - i8.call(this), this.h = [ + n8.call(this), this.h = [ 1779033703, 3144134277, 1013904242, @@ -10528,8 +10528,8 @@ function Xs() { 1541459225 ], this.k = $j, this.W = new Array(64); } -Eu.inherits(Xs, i8); -var s8 = Xs; +Eu.inherits(Xs, n8); +var i8 = Xs; Xs.blockSize = 512; Xs.outSize = 256; Xs.hmacStrength = 192; @@ -10549,11 +10549,11 @@ Xs.prototype._update = function(e, r) { Xs.prototype._digest = function(e) { return e === "hex" ? Eu.toHex32(this.h, "big") : Eu.split32(this.h, "big"); }; -var x1 = xr, o8 = s8; +var x1 = xr, s8 = i8; function Fo() { if (!(this instanceof Fo)) return new Fo(); - o8.call(this), this.h = [ + s8.call(this), this.h = [ 3238371032, 914150663, 812702999, @@ -10564,7 +10564,7 @@ function Fo() { 3204075428 ]; } -x1.inherits(Fo, o8); +x1.inherits(Fo, s8); var Bj = Fo; Fo.blockSize = 512; Fo.outSize = 224; @@ -10573,7 +10573,7 @@ Fo.padLength = 64; Fo.prototype._digest = function(e) { return e === "hex" ? x1.toHex32(this.h.slice(0, 7), "big") : x1.split32(this.h.slice(0, 7), "big"); }; -var _i = xr, Fj = Lu, jj = wc, Hs = _i.rotr64_hi, Ks = _i.rotr64_lo, a8 = _i.shr64_hi, c8 = _i.shr64_lo, ta = _i.sum64, rm = _i.sum64_hi, nm = _i.sum64_lo, Uj = _i.sum64_4_hi, qj = _i.sum64_4_lo, zj = _i.sum64_5_hi, Wj = _i.sum64_5_lo, u8 = Fj.BlockHash, Hj = [ +var _i = xr, Fj = Lu, jj = wc, Hs = _i.rotr64_hi, Ks = _i.rotr64_lo, o8 = _i.shr64_hi, a8 = _i.shr64_lo, ta = _i.sum64, rm = _i.sum64_hi, nm = _i.sum64_lo, Uj = _i.sum64_4_hi, qj = _i.sum64_4_lo, zj = _i.sum64_5_hi, Wj = _i.sum64_5_lo, c8 = Fj.BlockHash, Hj = [ 1116352408, 3609767458, 1899447441, @@ -10738,7 +10738,7 @@ var _i = xr, Fj = Lu, jj = wc, Hs = _i.rotr64_hi, Ks = _i.rotr64_lo, a8 = _i.shr function Ss() { if (!(this instanceof Ss)) return new Ss(); - u8.call(this), this.h = [ + c8.call(this), this.h = [ 1779033703, 4089235720, 3144134277, @@ -10757,8 +10757,8 @@ function Ss() { 327033209 ], this.k = Hj, this.W = new Array(160); } -_i.inherits(Ss, u8); -var f8 = Ss; +_i.inherits(Ss, c8); +var u8 = Ss; Ss.blockSize = 1024; Ss.outSize = 512; Ss.hmacStrength = 192; @@ -10791,10 +10791,10 @@ Ss.prototype._prepareBlock = function(e, r) { }; Ss.prototype._update = function(e, r) { this._prepareBlock(e, r); - var n = this.W, i = this.h[0], s = this.h[1], o = this.h[2], a = this.h[3], u = this.h[4], l = this.h[5], d = this.h[6], p = this.h[7], w = this.h[8], A = this.h[9], M = this.h[10], N = this.h[11], L = this.h[12], $ = this.h[13], B = this.h[14], H = this.h[15]; + var n = this.W, i = this.h[0], s = this.h[1], o = this.h[2], a = this.h[3], u = this.h[4], l = this.h[5], d = this.h[6], p = this.h[7], w = this.h[8], A = this.h[9], M = this.h[10], N = this.h[11], L = this.h[12], B = this.h[13], $ = this.h[14], H = this.h[15]; jj(this.k.length === n.length); for (var U = 0; U < n.length; U += 2) { - var V = B, te = H, R = Zj(w, A), K = Qj(w, A), ge = Kj(w, A, M, N, L), Ee = Vj(w, A, M, N, L, $), Y = this.k[U], S = this.k[U + 1], m = n[U], f = n[U + 1], g = zj( + var V = $, te = H, R = Zj(w, A), K = Qj(w, A), ge = Kj(w, A, M, N, L), Ee = Vj(w, A, M, N, L, B), Y = this.k[U], S = this.k[U + 1], m = n[U], f = n[U + 1], g = zj( V, te, R, @@ -10819,9 +10819,9 @@ Ss.prototype._update = function(e, r) { ); V = Jj(i, s), te = Xj(i, s), R = Gj(i, s, o, a, u), K = Yj(i, s, o, a, u, l); var x = rm(V, te, R, K), _ = nm(V, te, R, K); - B = L, H = $, L = M, $ = N, M = w, N = A, w = rm(d, p, g, b), A = nm(p, p, g, b), d = u, p = l, u = o, l = a, o = i, a = s, i = rm(g, b, x, _), s = nm(g, b, x, _); + $ = L, H = B, L = M, B = N, M = w, N = A, w = rm(d, p, g, b), A = nm(p, p, g, b), d = u, p = l, u = o, l = a, o = i, a = s, i = rm(g, b, x, _), s = nm(g, b, x, _); } - ta(this.h, 0, i, s), ta(this.h, 2, o, a), ta(this.h, 4, u, l), ta(this.h, 6, d, p), ta(this.h, 8, w, A), ta(this.h, 10, M, N), ta(this.h, 12, L, $), ta(this.h, 14, B, H); + ta(this.h, 0, i, s), ta(this.h, 2, o, a), ta(this.h, 4, u, l), ta(this.h, 6, d, p), ta(this.h, 8, w, A), ta(this.h, 10, M, N), ta(this.h, 12, L, B), ta(this.h, 14, $, H); }; Ss.prototype._digest = function(e) { return e === "hex" ? _i.toHex32(this.h, "big") : _i.split32(this.h, "big"); @@ -10859,26 +10859,26 @@ function Qj(t, e) { return s < 0 && (s += 4294967296), s; } function eU(t, e) { - var r = Hs(t, e, 1), n = Hs(t, e, 8), i = a8(t, e, 7), s = r ^ n ^ i; + var r = Hs(t, e, 1), n = Hs(t, e, 8), i = o8(t, e, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } function tU(t, e) { - var r = Ks(t, e, 1), n = Ks(t, e, 8), i = c8(t, e, 7), s = r ^ n ^ i; + var r = Ks(t, e, 1), n = Ks(t, e, 8), i = a8(t, e, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } function rU(t, e) { - var r = Hs(t, e, 19), n = Hs(e, t, 29), i = a8(t, e, 6), s = r ^ n ^ i; + var r = Hs(t, e, 19), n = Hs(e, t, 29), i = o8(t, e, 6), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } function nU(t, e) { - var r = Ks(t, e, 19), n = Ks(e, t, 29), i = c8(t, e, 6), s = r ^ n ^ i; + var r = Ks(t, e, 19), n = Ks(e, t, 29), i = a8(t, e, 6), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -var _1 = xr, l8 = f8; +var _1 = xr, f8 = u8; function jo() { if (!(this instanceof jo)) return new jo(); - l8.call(this), this.h = [ + f8.call(this), this.h = [ 3418070365, 3238371032, 1654270250, @@ -10897,7 +10897,7 @@ function jo() { 3204075428 ]; } -_1.inherits(jo, l8); +_1.inherits(jo, f8); var iU = jo; jo.blockSize = 1024; jo.outSize = 384; @@ -10908,33 +10908,33 @@ jo.prototype._digest = function(e) { }; ku.sha1 = Pj; ku.sha224 = Bj; -ku.sha256 = s8; +ku.sha256 = i8; ku.sha384 = iU; -ku.sha512 = f8; -var h8 = {}, lc = xr, sU = Lu, ud = lc.rotl32, Sx = lc.sum32, Sf = lc.sum32_3, Ax = lc.sum32_4, d8 = sU.BlockHash; +ku.sha512 = u8; +var l8 = {}, lc = xr, sU = Lu, ud = lc.rotl32, Ex = lc.sum32, Sf = lc.sum32_3, Sx = lc.sum32_4, h8 = sU.BlockHash; function Zs() { if (!(this instanceof Zs)) return new Zs(); - d8.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = "little"; + h8.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = "little"; } -lc.inherits(Zs, d8); -h8.ripemd160 = Zs; +lc.inherits(Zs, h8); +l8.ripemd160 = Zs; Zs.blockSize = 512; Zs.outSize = 160; Zs.hmacStrength = 192; Zs.padLength = 64; Zs.prototype._update = function(e, r) { for (var n = this.h[0], i = this.h[1], s = this.h[2], o = this.h[3], a = this.h[4], u = n, l = i, d = s, p = o, w = a, A = 0; A < 80; A++) { - var M = Sx( + var M = Ex( ud( - Ax(n, Px(A, i, s, o), e[cU[A] + r], oU(A)), + Sx(n, Ax(A, i, s, o), e[cU[A] + r], oU(A)), fU[A] ), a ); - n = a, a = o, o = ud(s, 10), s = i, i = M, M = Sx( + n = a, a = o, o = ud(s, 10), s = i, i = M, M = Ex( ud( - Ax(u, Px(79 - A, l, d, p), e[uU[A] + r], aU(A)), + Sx(u, Ax(79 - A, l, d, p), e[uU[A] + r], aU(A)), lU[A] ), w @@ -10945,7 +10945,7 @@ Zs.prototype._update = function(e, r) { Zs.prototype._digest = function(e) { return e === "hex" ? lc.toHex32(this.h, "little") : lc.split32(this.h, "little"); }; -function Px(t, e, r, n) { +function Ax(t, e, r, n) { return t <= 15 ? e ^ r ^ n : t <= 31 ? e & r | ~e & n : t <= 47 ? (e | ~r) ^ n : t <= 63 ? e & n | r & ~n : e ^ (r | ~n); } function oU(t) { @@ -11303,7 +11303,7 @@ Su.prototype.digest = function(e) { }; (function(t) { var e = t; - e.utils = xr, e.common = Lu, e.sha = ku, e.ripemd = h8, e.hmac = pU, e.sha1 = e.sha.sha1, e.sha256 = e.sha.sha256, e.sha224 = e.sha.sha224, e.sha384 = e.sha.sha384, e.sha512 = e.sha.sha512, e.ripemd160 = e.ripemd.ripemd160; + e.utils = xr, e.common = Lu, e.sha = ku, e.ripemd = l8, e.hmac = pU, e.sha1 = e.sha.sha1, e.sha256 = e.sha.sha256, e.sha224 = e.sha.sha224, e.sha384 = e.sha.sha384, e.sha512 = e.sha.sha512, e.ripemd160 = e.ripemd.ripemd160; })(Vl); const yo = /* @__PURE__ */ ts(Vl); function Bu(t, e, r) { @@ -11318,12 +11318,12 @@ function Bu(t, e, r) { function gU() { throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs"); } -var Vv = p8; -function p8(t, e) { +var Kv = d8; +function d8(t, e) { if (!t) throw new Error(e || "Assertion failed"); } -p8.equal = function(e, r, n) { +d8.equal = function(e, r, n) { if (e != r) throw new Error(n || "Assertion failed: " + e + " != " + r); }; @@ -11366,7 +11366,7 @@ var xs = Bu(function(t, e) { }; }), $i = Bu(function(t, e) { var r = e; - r.assert = Vv, r.toArray = xs.toArray, r.zero2 = xs.zero2, r.toHex = xs.toHex, r.encode = xs.encode; + r.assert = Kv, r.toArray = xs.toArray, r.zero2 = xs.zero2, r.toHex = xs.toHex, r.encode = xs.encode; function n(u, l, d) { var p = new Array(Math.max(u.bitLength(), d) + 1); p.fill(0); @@ -11388,8 +11388,8 @@ var xs = Bu(function(t, e) { M === 3 && (M = -1), N === 3 && (N = -1); var L; M & 1 ? (A = u.andln(7) + p & 7, (A === 3 || A === 5) && N === 2 ? L = -M : L = M) : L = 0, d[0].push(L); - var $; - N & 1 ? (A = l.andln(7) + w & 7, (A === 3 || A === 5) && M === 2 ? $ = -N : $ = N) : $ = 0, d[1].push($), 2 * p === L + 1 && (p = 1 - p), 2 * w === $ + 1 && (w = 1 - w), u.iushrn(1), l.iushrn(1); + var B; + N & 1 ? (A = l.andln(7) + w & 7, (A === 3 || A === 5) && M === 2 ? B = -N : B = N) : B = 0, d[1].push(B), 2 * p === L + 1 && (p = 1 - p), 2 * w === B + 1 && (w = 1 - w), u.iushrn(1), l.iushrn(1); } return d; } @@ -11477,7 +11477,7 @@ Ma.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 7 */ ]; r[M].y.cmp(r[N].y) === 0 ? (L[1] = r[M].add(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())) : r[M].y.cmp(r[N].y.redNeg()) === 0 ? (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].add(r[N].neg())) : (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())); - var $ = [ + var B = [ -3, /* -1 -1 */ -1, @@ -11496,10 +11496,10 @@ Ma.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 1 0 */ 3 /* 1 1 */ - ], B = mU(n[M], n[N]); - for (l = Math.max(B[0].length, l), u[M] = new Array(l), u[N] = new Array(l), p = 0; p < l; p++) { - var H = B[0][p] | 0, U = B[1][p] | 0; - u[M][p] = $[(H + 1) * 3 + (U + 1)], u[N][p] = 0, a[M] = L; + ], $ = mU(n[M], n[N]); + for (l = Math.max($[0].length, l), u[M] = new Array(l), u[N] = new Array(l), p = 0; p < l; p++) { + var H = $[0][p] | 0, U = $[1][p] | 0; + u[M][p] = B[(H + 1) * 3 + (U + 1)], u[N][p] = 0, a[M] = L; } } var V = this.jpoint(null, null, null), te = this._wnafT4; @@ -11604,7 +11604,7 @@ ns.prototype.dblp = function(e) { r = r.dbl(); return r; }; -var Gv = Bu(function(t) { +var Vv = Bu(function(t) { typeof Object.create == "function" ? t.exports = function(r, n) { n && (r.super_ = n, r.prototype = Object.create(n.prototype, { constructor: { @@ -11626,7 +11626,7 @@ var Gv = Bu(function(t) { function is(t) { xc.call(this, "short", t), this.a = new sr(t.a, 16).toRed(this.red), this.b = new sr(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); } -Gv(is, xc); +Vv(is, xc); var bU = is; is.prototype._getEndomorphism = function(e) { if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { @@ -11661,17 +11661,17 @@ is.prototype._getEndoRoots = function(e) { return [o, a]; }; is.prototype._getEndoBasis = function(e) { - for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new sr(1), o = new sr(0), a = new sr(0), u = new sr(1), l, d, p, w, A, M, N, L = 0, $, B; n.cmpn(0) !== 0; ) { + for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new sr(1), o = new sr(0), a = new sr(0), u = new sr(1), l, d, p, w, A, M, N, L = 0, B, $; n.cmpn(0) !== 0; ) { var H = i.div(n); - $ = i.sub(H.mul(n)), B = a.sub(H.mul(s)); + B = i.sub(H.mul(n)), $ = a.sub(H.mul(s)); var U = u.sub(H.mul(o)); - if (!p && $.cmp(r) < 0) - l = N.neg(), d = s, p = $.neg(), w = B; + if (!p && B.cmp(r) < 0) + l = N.neg(), d = s, p = B.neg(), w = $; else if (p && ++L === 2) break; - N = $, i = n, n = $, a = s, s = B, u = o, o = U; + N = B, i = n, n = B, a = s, s = $, u = o, o = U; } - A = $.neg(), M = B; + A = B.neg(), M = $; var V = p.sqr().add(w.sqr()), te = A.sqr().add(M.sqr()); return te.cmp(V) >= 0 && (A = l, M = d), p.negative && (p = p.neg(), w = w.neg()), A.negative && (A = A.neg(), M = M.neg()), [ { a: p, b: w }, @@ -11708,7 +11708,7 @@ is.prototype._endoWnafMulAdd = function(e, r, n) { function kn(t, e, r, n) { xc.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new sr(e, 16), this.y = new sr(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); } -Gv(kn, xc.BasePoint); +Vv(kn, xc.BasePoint); is.prototype.point = function(e, r, n) { return new kn(this, e, r, n); }; @@ -11854,7 +11854,7 @@ kn.prototype.toJ = function() { function zn(t, e, r, n) { xc.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new sr(0)) : (this.x = new sr(e, 16), this.y = new sr(r, 16), this.z = new sr(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; } -Gv(zn, xc.BasePoint); +Vv(zn, xc.BasePoint); is.prototype.jpoint = function(e, r, n) { return new zn(this, e, r, n); }; @@ -11905,10 +11905,10 @@ zn.prototype.dblp = function(e) { } var i = this.curve.a, s = this.curve.tinv, o = this.x, a = this.y, u = this.z, l = u.redSqr().redSqr(), d = a.redAdd(a); for (r = 0; r < e; r++) { - var p = o.redSqr(), w = d.redSqr(), A = w.redSqr(), M = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), N = o.redMul(w), L = M.redSqr().redISub(N.redAdd(N)), $ = N.redISub(L), B = M.redMul($); - B = B.redIAdd(B).redISub(A); + var p = o.redSqr(), w = d.redSqr(), A = w.redSqr(), M = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), N = o.redMul(w), L = M.redSqr().redISub(N.redAdd(N)), B = N.redISub(L), $ = M.redMul(B); + $ = $.redIAdd($).redISub(A); var H = d.redMul(u); - r + 1 < e && (l = l.redMul(A)), o = L, u = H, d = B; + r + 1 < e && (l = l.redMul(A)), o = L, u = H, d = $; } return this.curve.jpoint(o, d.redMul(s), u); }; @@ -11925,8 +11925,8 @@ zn.prototype._zeroDbl = function() { } else { var p = this.x.redSqr(), w = this.y.redSqr(), A = w.redSqr(), M = this.x.redAdd(w).redSqr().redISub(p).redISub(A); M = M.redIAdd(M); - var N = p.redAdd(p).redIAdd(p), L = N.redSqr(), $ = A.redIAdd(A); - $ = $.redIAdd($), $ = $.redIAdd($), e = L.redISub(M).redISub(M), r = N.redMul(M.redISub(e)).redISub($), n = this.y.redMul(this.z), n = n.redIAdd(n); + var N = p.redAdd(p).redIAdd(p), L = N.redSqr(), B = A.redIAdd(A); + B = B.redIAdd(B), B = B.redIAdd(B), e = L.redISub(M).redISub(M), r = N.redMul(M.redISub(e)).redISub(B), n = this.y.redMul(this.z), n = n.redIAdd(n); } return this.curve.jpoint(e, r, n); }; @@ -11946,8 +11946,8 @@ zn.prototype._threeDbl = function() { N = N.redIAdd(N); var L = N.redAdd(N); e = M.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(p); - var $ = w.redSqr(); - $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($), r = M.redMul(N.redISub(e)).redISub($); + var B = w.redSqr(); + B = B.redIAdd(B), B = B.redIAdd(B), B = B.redIAdd(B), r = M.redMul(N.redISub(e)).redISub(B); } return this.curve.jpoint(e, r, n); }; @@ -12167,12 +12167,12 @@ function ba(t) { return new ba(t); this.hash = t.hash, this.predResist = !!t.predResist, this.outLen = this.hash.outSize, this.minEntropy = t.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null; var e = xs.toArray(t.entropy, t.entropyEnc || "hex"), r = xs.toArray(t.nonce, t.nonceEnc || "hex"), n = xs.toArray(t.pers, t.persEnc || "hex"); - Vv( + Kv( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._init(e, r, n); } -var g8 = ba; +var p8 = ba; ba.prototype._init = function(e, r, n) { var i = e.concat(r).concat(n); this.K = new Array(this.outLen / 8), this.V = new Array(this.outLen / 8); @@ -12188,7 +12188,7 @@ ba.prototype._update = function(e) { e && (r = r.update(e)), this.K = r.digest(), this.V = this._hmac().update(this.V).digest(), e && (this.K = this._hmac().update(this.V).update([1]).update(e).digest(), this.V = this._hmac().update(this.V).digest()); }; ba.prototype.reseed = function(e, r, n, i) { - typeof r != "string" && (i = n, n = r, r = null), e = xs.toArray(e, r), n = xs.toArray(n, i), Vv( + typeof r != "string" && (i = n, n = r, r = null), e = xs.toArray(e, r), n = xs.toArray(n, i), Kv( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._update(e.concat(n || [])), this._reseed = 1; @@ -12206,7 +12206,7 @@ var E1 = $i.assert; function Qn(t, e) { this.ec = t, this.priv = null, this.pub = null, e.priv && this._importPrivate(e.priv, e.privEnc), e.pub && this._importPublic(e.pub, e.pubEnc); } -var Yv = Qn; +var Gv = Qn; Qn.fromPublic = function(e, r, n) { return r instanceof Qn ? r : new Qn(e, { pub: r, @@ -12272,7 +12272,7 @@ function im(t, e) { i <<= 8, i |= t[o], i >>>= 0; return i <= 127 ? !1 : (e.place = o, i); } -function Mx(t) { +function Px(t) { for (var e = 0, r = t.length - 1; !t[e] && !(t[e + 1] & 128) && e < r; ) e++; return e === 0 ? t : t.slice(e); @@ -12319,7 +12319,7 @@ function sm(t, e) { } H0.prototype.toDER = function(e) { var r = this.r.toArray(), n = this.s.toArray(); - for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Mx(r), n = Mx(n); !n[0] && !(n[1] & 128); ) + for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Px(r), n = Px(n); !n[0] && !(n[1] & 128); ) n = n.slice(1); var i = [2]; sm(i, r.length), i = i.concat(r), i.push(2), sm(i, n.length); @@ -12331,28 +12331,28 @@ var xU = ( function() { throw new Error("unsupported"); } -), m8 = $i.assert; +), g8 = $i.assert; function Qi(t) { if (!(this instanceof Qi)) return new Qi(t); - typeof t == "string" && (m8( + typeof t == "string" && (g8( Object.prototype.hasOwnProperty.call(Md, t), "Unknown curve " + t ), t = Md[t]), t instanceof Md.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; } var _U = Qi; Qi.prototype.keyPair = function(e) { - return new Yv(this, e); + return new Gv(this, e); }; Qi.prototype.keyFromPrivate = function(e, r) { - return Yv.fromPrivate(this, e, r); + return Gv.fromPrivate(this, e, r); }; Qi.prototype.keyFromPublic = function(e, r) { - return Yv.fromPublic(this, e, r); + return Gv.fromPublic(this, e, r); }; Qi.prototype.genKeyPair = function(e) { e || (e = {}); - for (var r = new g8({ + for (var r = new p8({ hash: this.hash, pers: e.pers, persEnc: e.persEnc || "utf8", @@ -12371,7 +12371,7 @@ Qi.prototype._truncateToN = function(e, r) { }; Qi.prototype.sign = function(e, r, n, i) { typeof n == "object" && (i = n, n = null), i || (i = {}), r = this.keyFromPrivate(r, n), e = this._truncateToN(new sr(e, 16)); - for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new g8({ + for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new p8({ hash: this.hash, entropy: o, nonce: a, @@ -12403,7 +12403,7 @@ Qi.prototype.verify = function(e, r, n, i) { return this.curve._maxwellTrick ? (d = this.g.jmulAdd(u, n.getPublic(), l), d.isInfinity() ? !1 : d.eqXToP(s)) : (d = this.g.mulAdd(u, n.getPublic(), l), d.isInfinity() ? !1 : d.getX().umod(this.n).cmp(s) === 0); }; Qi.prototype.recoverPubKey = function(t, e, r, n) { - m8((3 & r) === r, "The recovery param is more than two bits"), e = new K0(e, n); + g8((3 & r) === r, "The recovery param is more than two bits"), e = new K0(e, n); var i = this.n, s = new sr(t), o = e.r, a = e.s, u = r & 1, l = r >> 1; if (o.cmp(this.curve.p.umod(this.curve.n)) >= 0 && l) throw new Error("Unable to find sencond key candinate"); @@ -12453,14 +12453,14 @@ class PU { const r = aa().keyFromPrivate(wn(this.privateKey)), n = wn(e); n.length !== 32 && S1.throwArgumentError("bad digest length", "digest", e); const i = r.sign(n, { canonical: !0 }); - return G4({ + return V4({ recoveryParam: i.recoveryParam, r: lu("0x" + i.r.toString(16), 32), s: lu("0x" + i.s.toString(16), 32) }); } computeSharedSecret(e) { - const r = aa().keyFromPrivate(wn(this.privateKey)), n = aa().keyFromPublic(wn(v8(e))); + const r = aa().keyFromPrivate(wn(this.privateKey)), n = aa().keyFromPublic(wn(m8(e))); return lu("0x" + r.derive(n.getPublic()).toString(16), 32); } static isSigningKey(e) { @@ -12468,33 +12468,33 @@ class PU { } } function MU(t, e) { - const r = G4(e), n = { r: wn(r.r), s: wn(r.s) }; + const r = V4(e), n = { r: wn(r.r), s: wn(r.s) }; return "0x" + aa().recoverPubKey(wn(t), n, r.recoveryParam).encode("hex", !1); } -function v8(t, e) { +function m8(t, e) { const r = wn(t); return r.length === 32 ? new PU(r).publicKey : r.length === 33 ? "0x" + aa().keyFromPublic(r).getPublic(!1, "hex") : r.length === 65 ? Ri(r) : S1.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); } -var Ix; +var Mx; (function(t) { t[t.legacy = 0] = "legacy", t[t.eip2930 = 1] = "eip2930", t[t.eip1559 = 2] = "eip1559"; -})(Ix || (Ix = {})); +})(Mx || (Mx = {})); function IU(t) { - const e = v8(t); - return qF(yx(Wv(yx(e, 1)), 12)); + const e = m8(t); + return qF(bx(zv(bx(e, 1)), 12)); } function CU(t, e) { return IU(MU(wn(t), e)); } -var Jv = {}, V0 = {}; +var Yv = {}, V0 = {}; Object.defineProperty(V0, "__esModule", { value: !0 }); var Gn = ar, A1 = ki, TU = 20; function RU(t, e, r) { - for (var n = 1634760805, i = 857760878, s = 2036477234, o = 1797285236, a = r[3] << 24 | r[2] << 16 | r[1] << 8 | r[0], u = r[7] << 24 | r[6] << 16 | r[5] << 8 | r[4], l = r[11] << 24 | r[10] << 16 | r[9] << 8 | r[8], d = r[15] << 24 | r[14] << 16 | r[13] << 8 | r[12], p = r[19] << 24 | r[18] << 16 | r[17] << 8 | r[16], w = r[23] << 24 | r[22] << 16 | r[21] << 8 | r[20], A = r[27] << 24 | r[26] << 16 | r[25] << 8 | r[24], M = r[31] << 24 | r[30] << 16 | r[29] << 8 | r[28], N = e[3] << 24 | e[2] << 16 | e[1] << 8 | e[0], L = e[7] << 24 | e[6] << 16 | e[5] << 8 | e[4], $ = e[11] << 24 | e[10] << 16 | e[9] << 8 | e[8], B = e[15] << 24 | e[14] << 16 | e[13] << 8 | e[12], H = n, U = i, V = s, te = o, R = a, K = u, ge = l, Ee = d, Y = p, S = w, m = A, f = M, g = N, b = L, x = $, _ = B, E = 0; E < TU; E += 2) + for (var n = 1634760805, i = 857760878, s = 2036477234, o = 1797285236, a = r[3] << 24 | r[2] << 16 | r[1] << 8 | r[0], u = r[7] << 24 | r[6] << 16 | r[5] << 8 | r[4], l = r[11] << 24 | r[10] << 16 | r[9] << 8 | r[8], d = r[15] << 24 | r[14] << 16 | r[13] << 8 | r[12], p = r[19] << 24 | r[18] << 16 | r[17] << 8 | r[16], w = r[23] << 24 | r[22] << 16 | r[21] << 8 | r[20], A = r[27] << 24 | r[26] << 16 | r[25] << 8 | r[24], M = r[31] << 24 | r[30] << 16 | r[29] << 8 | r[28], N = e[3] << 24 | e[2] << 16 | e[1] << 8 | e[0], L = e[7] << 24 | e[6] << 16 | e[5] << 8 | e[4], B = e[11] << 24 | e[10] << 16 | e[9] << 8 | e[8], $ = e[15] << 24 | e[14] << 16 | e[13] << 8 | e[12], H = n, U = i, V = s, te = o, R = a, K = u, ge = l, Ee = d, Y = p, S = w, m = A, f = M, g = N, b = L, x = B, _ = $, E = 0; E < TU; E += 2) H = H + R | 0, g ^= H, g = g >>> 16 | g << 16, Y = Y + g | 0, R ^= Y, R = R >>> 20 | R << 12, U = U + K | 0, b ^= U, b = b >>> 16 | b << 16, S = S + b | 0, K ^= S, K = K >>> 20 | K << 12, V = V + ge | 0, x ^= V, x = x >>> 16 | x << 16, m = m + x | 0, ge ^= m, ge = ge >>> 20 | ge << 12, te = te + Ee | 0, _ ^= te, _ = _ >>> 16 | _ << 16, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 20 | Ee << 12, V = V + ge | 0, x ^= V, x = x >>> 24 | x << 8, m = m + x | 0, ge ^= m, ge = ge >>> 25 | ge << 7, te = te + Ee | 0, _ ^= te, _ = _ >>> 24 | _ << 8, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 25 | Ee << 7, U = U + K | 0, b ^= U, b = b >>> 24 | b << 8, S = S + b | 0, K ^= S, K = K >>> 25 | K << 7, H = H + R | 0, g ^= H, g = g >>> 24 | g << 8, Y = Y + g | 0, R ^= Y, R = R >>> 25 | R << 7, H = H + K | 0, _ ^= H, _ = _ >>> 16 | _ << 16, m = m + _ | 0, K ^= m, K = K >>> 20 | K << 12, U = U + ge | 0, g ^= U, g = g >>> 16 | g << 16, f = f + g | 0, ge ^= f, ge = ge >>> 20 | ge << 12, V = V + Ee | 0, b ^= V, b = b >>> 16 | b << 16, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 20 | Ee << 12, te = te + R | 0, x ^= te, x = x >>> 16 | x << 16, S = S + x | 0, R ^= S, R = R >>> 20 | R << 12, V = V + Ee | 0, b ^= V, b = b >>> 24 | b << 8, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 25 | Ee << 7, te = te + R | 0, x ^= te, x = x >>> 24 | x << 8, S = S + x | 0, R ^= S, R = R >>> 25 | R << 7, U = U + ge | 0, g ^= U, g = g >>> 24 | g << 8, f = f + g | 0, ge ^= f, ge = ge >>> 25 | ge << 7, H = H + K | 0, _ ^= H, _ = _ >>> 24 | _ << 8, m = m + _ | 0, K ^= m, K = K >>> 25 | K << 7; - Gn.writeUint32LE(H + n | 0, t, 0), Gn.writeUint32LE(U + i | 0, t, 4), Gn.writeUint32LE(V + s | 0, t, 8), Gn.writeUint32LE(te + o | 0, t, 12), Gn.writeUint32LE(R + a | 0, t, 16), Gn.writeUint32LE(K + u | 0, t, 20), Gn.writeUint32LE(ge + l | 0, t, 24), Gn.writeUint32LE(Ee + d | 0, t, 28), Gn.writeUint32LE(Y + p | 0, t, 32), Gn.writeUint32LE(S + w | 0, t, 36), Gn.writeUint32LE(m + A | 0, t, 40), Gn.writeUint32LE(f + M | 0, t, 44), Gn.writeUint32LE(g + N | 0, t, 48), Gn.writeUint32LE(b + L | 0, t, 52), Gn.writeUint32LE(x + $ | 0, t, 56), Gn.writeUint32LE(_ + B | 0, t, 60); + Gn.writeUint32LE(H + n | 0, t, 0), Gn.writeUint32LE(U + i | 0, t, 4), Gn.writeUint32LE(V + s | 0, t, 8), Gn.writeUint32LE(te + o | 0, t, 12), Gn.writeUint32LE(R + a | 0, t, 16), Gn.writeUint32LE(K + u | 0, t, 20), Gn.writeUint32LE(ge + l | 0, t, 24), Gn.writeUint32LE(Ee + d | 0, t, 28), Gn.writeUint32LE(Y + p | 0, t, 32), Gn.writeUint32LE(S + w | 0, t, 36), Gn.writeUint32LE(m + A | 0, t, 40), Gn.writeUint32LE(f + M | 0, t, 44), Gn.writeUint32LE(g + N | 0, t, 48), Gn.writeUint32LE(b + L | 0, t, 52), Gn.writeUint32LE(x + B | 0, t, 56), Gn.writeUint32LE(_ + $ | 0, t, 60); } -function b8(t, e, r, n, i) { +function v8(t, e, r, n, i) { if (i === void 0 && (i = 0), t.length !== 32) throw new Error("ChaCha: key size must be 32 bytes"); if (n.length < r.length) @@ -12517,9 +12517,9 @@ function b8(t, e, r, n, i) { } return A1.wipe(a), i === 0 && A1.wipe(s), n; } -V0.streamXOR = b8; +V0.streamXOR = v8; function DU(t, e, r, n) { - return n === void 0 && (n = 0), A1.wipe(r), b8(t, e, r, r, n); + return n === void 0 && (n = 0), A1.wipe(r), v8(t, e, r, r, n); } V0.stream = DU; function OU(t, e, r) { @@ -12528,7 +12528,7 @@ function OU(t, e, r) { if (n > 0) throw new Error("ChaCha: counter overflow"); } -var y8 = {}, Ia = {}; +var b8 = {}, Ia = {}; Object.defineProperty(Ia, "__esModule", { value: !0 }); function NU(t, e, r) { return ~(t - 1) & e | t - 1 & r; @@ -12538,16 +12538,16 @@ function LU(t, e) { return (t | 0) - (e | 0) - 1 >>> 31 & 1; } Ia.lessOrEqual = LU; -function w8(t, e) { +function y8(t, e) { if (t.length !== e.length) return 0; for (var r = 0, n = 0; n < t.length; n++) r |= t[n] ^ e[n]; return 1 & r - 1 >>> 8; } -Ia.compare = w8; +Ia.compare = y8; function kU(t, e) { - return t.length === 0 || e.length === 0 ? !1 : w8(t, e) !== 0; + return t.length === 0 || e.length === 0 ? !1 : y8(t, e) !== 0; } Ia.equal = kU; (function(t) { @@ -12577,7 +12577,7 @@ Ia.equal = kU; this._r[8] = (M >>> 8 | N << 8) & 8191, this._r[9] = N >>> 5 & 127, this._pad[0] = a[16] | a[17] << 8, this._pad[1] = a[18] | a[19] << 8, this._pad[2] = a[20] | a[21] << 8, this._pad[3] = a[22] | a[23] << 8, this._pad[4] = a[24] | a[25] << 8, this._pad[5] = a[26] | a[27] << 8, this._pad[6] = a[28] | a[29] << 8, this._pad[7] = a[30] | a[31] << 8; } return o.prototype._blocks = function(a, u, l) { - for (var d = this._fin ? 0 : 2048, p = this._h[0], w = this._h[1], A = this._h[2], M = this._h[3], N = this._h[4], L = this._h[5], $ = this._h[6], B = this._h[7], H = this._h[8], U = this._h[9], V = this._r[0], te = this._r[1], R = this._r[2], K = this._r[3], ge = this._r[4], Ee = this._r[5], Y = this._r[6], S = this._r[7], m = this._r[8], f = this._r[9]; l >= 16; ) { + for (var d = this._fin ? 0 : 2048, p = this._h[0], w = this._h[1], A = this._h[2], M = this._h[3], N = this._h[4], L = this._h[5], B = this._h[6], $ = this._h[7], H = this._h[8], U = this._h[9], V = this._r[0], te = this._r[1], R = this._r[2], K = this._r[3], ge = this._r[4], Ee = this._r[5], Y = this._r[6], S = this._r[7], m = this._r[8], f = this._r[9]; l >= 16; ) { var g = a[u + 0] | a[u + 1] << 8; p += g & 8191; var b = a[u + 2] | a[u + 3] << 8; @@ -12589,33 +12589,33 @@ Ia.equal = kU; var E = a[u + 8] | a[u + 9] << 8; N += (_ >>> 4 | E << 12) & 8191, L += E >>> 1 & 8191; var v = a[u + 10] | a[u + 11] << 8; - $ += (E >>> 14 | v << 2) & 8191; + B += (E >>> 14 | v << 2) & 8191; var P = a[u + 12] | a[u + 13] << 8; - B += (v >>> 11 | P << 5) & 8191; + $ += (v >>> 11 | P << 5) & 8191; var I = a[u + 14] | a[u + 15] << 8; H += (P >>> 8 | I << 8) & 8191, U += I >>> 5 | d; var F = 0, ce = F; - ce += p * V, ce += w * (5 * f), ce += A * (5 * m), ce += M * (5 * S), ce += N * (5 * Y), F = ce >>> 13, ce &= 8191, ce += L * (5 * Ee), ce += $ * (5 * ge), ce += B * (5 * K), ce += H * (5 * R), ce += U * (5 * te), F += ce >>> 13, ce &= 8191; + ce += p * V, ce += w * (5 * f), ce += A * (5 * m), ce += M * (5 * S), ce += N * (5 * Y), F = ce >>> 13, ce &= 8191, ce += L * (5 * Ee), ce += B * (5 * ge), ce += $ * (5 * K), ce += H * (5 * R), ce += U * (5 * te), F += ce >>> 13, ce &= 8191; var D = F; - D += p * te, D += w * V, D += A * (5 * f), D += M * (5 * m), D += N * (5 * S), F = D >>> 13, D &= 8191, D += L * (5 * Y), D += $ * (5 * Ee), D += B * (5 * ge), D += H * (5 * K), D += U * (5 * R), F += D >>> 13, D &= 8191; + D += p * te, D += w * V, D += A * (5 * f), D += M * (5 * m), D += N * (5 * S), F = D >>> 13, D &= 8191, D += L * (5 * Y), D += B * (5 * Ee), D += $ * (5 * ge), D += H * (5 * K), D += U * (5 * R), F += D >>> 13, D &= 8191; var oe = F; - oe += p * R, oe += w * te, oe += A * V, oe += M * (5 * f), oe += N * (5 * m), F = oe >>> 13, oe &= 8191, oe += L * (5 * S), oe += $ * (5 * Y), oe += B * (5 * Ee), oe += H * (5 * ge), oe += U * (5 * K), F += oe >>> 13, oe &= 8191; + oe += p * R, oe += w * te, oe += A * V, oe += M * (5 * f), oe += N * (5 * m), F = oe >>> 13, oe &= 8191, oe += L * (5 * S), oe += B * (5 * Y), oe += $ * (5 * Ee), oe += H * (5 * ge), oe += U * (5 * K), F += oe >>> 13, oe &= 8191; var Z = F; - Z += p * K, Z += w * R, Z += A * te, Z += M * V, Z += N * (5 * f), F = Z >>> 13, Z &= 8191, Z += L * (5 * m), Z += $ * (5 * S), Z += B * (5 * Y), Z += H * (5 * Ee), Z += U * (5 * ge), F += Z >>> 13, Z &= 8191; + Z += p * K, Z += w * R, Z += A * te, Z += M * V, Z += N * (5 * f), F = Z >>> 13, Z &= 8191, Z += L * (5 * m), Z += B * (5 * S), Z += $ * (5 * Y), Z += H * (5 * Ee), Z += U * (5 * ge), F += Z >>> 13, Z &= 8191; var J = F; - J += p * ge, J += w * K, J += A * R, J += M * te, J += N * V, F = J >>> 13, J &= 8191, J += L * (5 * f), J += $ * (5 * m), J += B * (5 * S), J += H * (5 * Y), J += U * (5 * Ee), F += J >>> 13, J &= 8191; + J += p * ge, J += w * K, J += A * R, J += M * te, J += N * V, F = J >>> 13, J &= 8191, J += L * (5 * f), J += B * (5 * m), J += $ * (5 * S), J += H * (5 * Y), J += U * (5 * Ee), F += J >>> 13, J &= 8191; var Q = F; - Q += p * Ee, Q += w * ge, Q += A * K, Q += M * R, Q += N * te, F = Q >>> 13, Q &= 8191, Q += L * V, Q += $ * (5 * f), Q += B * (5 * m), Q += H * (5 * S), Q += U * (5 * Y), F += Q >>> 13, Q &= 8191; + Q += p * Ee, Q += w * ge, Q += A * K, Q += M * R, Q += N * te, F = Q >>> 13, Q &= 8191, Q += L * V, Q += B * (5 * f), Q += $ * (5 * m), Q += H * (5 * S), Q += U * (5 * Y), F += Q >>> 13, Q &= 8191; var T = F; - T += p * Y, T += w * Ee, T += A * ge, T += M * K, T += N * R, F = T >>> 13, T &= 8191, T += L * te, T += $ * V, T += B * (5 * f), T += H * (5 * m), T += U * (5 * S), F += T >>> 13, T &= 8191; + T += p * Y, T += w * Ee, T += A * ge, T += M * K, T += N * R, F = T >>> 13, T &= 8191, T += L * te, T += B * V, T += $ * (5 * f), T += H * (5 * m), T += U * (5 * S), F += T >>> 13, T &= 8191; var X = F; - X += p * S, X += w * Y, X += A * Ee, X += M * ge, X += N * K, F = X >>> 13, X &= 8191, X += L * R, X += $ * te, X += B * V, X += H * (5 * f), X += U * (5 * m), F += X >>> 13, X &= 8191; + X += p * S, X += w * Y, X += A * Ee, X += M * ge, X += N * K, F = X >>> 13, X &= 8191, X += L * R, X += B * te, X += $ * V, X += H * (5 * f), X += U * (5 * m), F += X >>> 13, X &= 8191; var re = F; - re += p * m, re += w * S, re += A * Y, re += M * Ee, re += N * ge, F = re >>> 13, re &= 8191, re += L * K, re += $ * R, re += B * te, re += H * V, re += U * (5 * f), F += re >>> 13, re &= 8191; - var de = F; - de += p * f, de += w * m, de += A * S, de += M * Y, de += N * Ee, F = de >>> 13, de &= 8191, de += L * ge, de += $ * K, de += B * R, de += H * te, de += U * V, F += de >>> 13, de &= 8191, F = (F << 2) + F | 0, F = F + ce | 0, ce = F & 8191, F = F >>> 13, D += F, p = ce, w = D, A = oe, M = Z, N = J, L = Q, $ = T, B = X, H = re, U = de, u += 16, l -= 16; + re += p * m, re += w * S, re += A * Y, re += M * Ee, re += N * ge, F = re >>> 13, re &= 8191, re += L * K, re += B * R, re += $ * te, re += H * V, re += U * (5 * f), F += re >>> 13, re &= 8191; + var pe = F; + pe += p * f, pe += w * m, pe += A * S, pe += M * Y, pe += N * Ee, F = pe >>> 13, pe &= 8191, pe += L * ge, pe += B * K, pe += $ * R, pe += H * te, pe += U * V, F += pe >>> 13, pe &= 8191, F = (F << 2) + F | 0, F = F + ce | 0, ce = F & 8191, F = F >>> 13, D += F, p = ce, w = D, A = oe, M = Z, N = J, L = Q, B = T, $ = X, H = re, U = pe, u += 16, l -= 16; } - this._h[0] = p, this._h[1] = w, this._h[2] = A, this._h[3] = M, this._h[4] = N, this._h[5] = L, this._h[6] = $, this._h[7] = B, this._h[8] = H, this._h[9] = U; + this._h[0] = p, this._h[1] = w, this._h[2] = A, this._h[3] = M, this._h[4] = N, this._h[5] = L, this._h[6] = B, this._h[7] = $, this._h[8] = H, this._h[9] = U; }, o.prototype.finish = function(a, u) { u === void 0 && (u = 0); var l = new Uint16Array(10), d, p, w, A; @@ -12673,10 +12673,10 @@ Ia.equal = kU; return o.length !== t.DIGEST_LENGTH || a.length !== t.DIGEST_LENGTH ? !1 : e.equal(o, a); } t.equal = s; -})(y8); +})(b8); (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - var e = V0, r = y8, n = ki, i = ar, s = Ia; + var e = V0, r = b8, n = ki, i = ar, s = Ia; t.KEY_LENGTH = 32, t.NONCE_LENGTH = 12, t.TAG_LENGTH = 16; var o = new Uint8Array(16), a = ( /** @class */ @@ -12713,14 +12713,14 @@ Ia.equal = kU; var N = new Uint8Array(this.tagLength); if (this._authenticate(N, M, d.subarray(0, d.length - this.tagLength), p), !s.equal(N, d.subarray(d.length - this.tagLength, d.length))) return null; - var L = d.length - this.tagLength, $; + var L = d.length - this.tagLength, B; if (w) { if (w.length !== L) throw new Error("ChaCha20Poly1305: incorrect destination length"); - $ = w; + B = w; } else - $ = new Uint8Array(L); - return e.streamXOR(this._key, A, d.subarray(0, d.length - this.tagLength), $, 4), n.wipe(A), $; + B = new Uint8Array(L); + return e.streamXOR(this._key, A, d.subarray(0, d.length - this.tagLength), B, 4), n.wipe(A), B; }, u.prototype.clean = function() { return n.wipe(this._key), this; }, u.prototype._authenticate = function(l, d, p, w) { @@ -12735,15 +12735,15 @@ Ia.equal = kU; }() ); t.ChaCha20Poly1305 = a; -})(Jv); -var x8 = {}, Gl = {}, Xv = {}; -Object.defineProperty(Xv, "__esModule", { value: !0 }); +})(Yv); +var w8 = {}, Gl = {}, Jv = {}; +Object.defineProperty(Jv, "__esModule", { value: !0 }); function $U(t) { return typeof t.saveState < "u" && typeof t.restoreState < "u" && typeof t.cleanSavedState < "u"; } -Xv.isSerializableHash = $U; +Jv.isSerializableHash = $U; Object.defineProperty(Gl, "__esModule", { value: !0 }); -var Ls = Xv, BU = Ia, FU = ki, _8 = ( +var Ls = Jv, BU = Ia, FU = ki, x8 = ( /** @class */ function() { function t(e, r) { @@ -12785,23 +12785,23 @@ var Ls = Xv, BU = Ia, FU = ki, _8 = ( }, t; }() ); -Gl.HMAC = _8; +Gl.HMAC = x8; function jU(t, e, r) { - var n = new _8(t, e); + var n = new x8(t, e); n.update(r); var i = n.digest(); return n.clean(), i; } Gl.hmac = jU; Gl.equal = BU.equal; -Object.defineProperty(x8, "__esModule", { value: !0 }); -var Cx = Gl, Tx = ki, UU = ( +Object.defineProperty(w8, "__esModule", { value: !0 }); +var Ix = Gl, Cx = ki, UU = ( /** @class */ function() { function t(e, r, n, i) { n === void 0 && (n = new Uint8Array(0)), this._counter = new Uint8Array(1), this._hash = e, this._info = i; - var s = Cx.hmac(this._hash, n, r); - this._hmac = new Cx.HMAC(e, s), this._buffer = new Uint8Array(this._hmac.digestLength), this._bufpos = this._buffer.length; + var s = Ix.hmac(this._hash, n, r); + this._hmac = new Ix.HMAC(e, s), this._buffer = new Uint8Array(this._hmac.digestLength), this._bufpos = this._buffer.length; } return t.prototype._fillBuffer = function() { this._counter[0]++; @@ -12814,10 +12814,10 @@ var Cx = Gl, Tx = ki, UU = ( this._bufpos === this._buffer.length && this._fillBuffer(), r[n] = this._buffer[this._bufpos++]; return r; }, t.prototype.clean = function() { - this._hmac.clean(), Tx.wipe(this._buffer), Tx.wipe(this._counter), this._bufpos = 0; + this._hmac.clean(), Cx.wipe(this._buffer), Cx.wipe(this._counter), this._bufpos = 0; }, t; }() -), qU = x8.HKDF = UU, Yl = {}; +), qU = w8.HKDF = UU, Yl = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); var e = ar, r = ki; @@ -12945,7 +12945,7 @@ var Cx = Gl, Tx = ki, UU = ( ]); function s(a, u, l, d, p) { for (; p >= 64; ) { - for (var w = u[0], A = u[1], M = u[2], N = u[3], L = u[4], $ = u[5], B = u[6], H = u[7], U = 0; U < 16; U++) { + for (var w = u[0], A = u[1], M = u[2], N = u[3], L = u[4], B = u[5], $ = u[6], H = u[7], U = 0; U < 16; U++) { var V = d + U * 4; a[U] = e.readUint32BE(l, V); } @@ -12956,10 +12956,10 @@ var Cx = Gl, Tx = ki, UU = ( a[U] = (R + a[U - 7] | 0) + (K + a[U - 16] | 0); } for (var U = 0; U < 64; U++) { - var R = (((L >>> 6 | L << 26) ^ (L >>> 11 | L << 21) ^ (L >>> 25 | L << 7)) + (L & $ ^ ~L & B) | 0) + (H + (i[U] + a[U] | 0) | 0) | 0, K = ((w >>> 2 | w << 30) ^ (w >>> 13 | w << 19) ^ (w >>> 22 | w << 10)) + (w & A ^ w & M ^ A & M) | 0; - H = B, B = $, $ = L, L = N + R | 0, N = M, M = A, A = w, w = R + K | 0; + var R = (((L >>> 6 | L << 26) ^ (L >>> 11 | L << 21) ^ (L >>> 25 | L << 7)) + (L & B ^ ~L & $) | 0) + (H + (i[U] + a[U] | 0) | 0) | 0, K = ((w >>> 2 | w << 30) ^ (w >>> 13 | w << 19) ^ (w >>> 22 | w << 10)) + (w & A ^ w & M ^ A & M) | 0; + H = $, $ = B, B = L, L = N + R | 0, N = M, M = A, A = w, w = R + K | 0; } - u[0] += w, u[1] += A, u[2] += M, u[3] += N, u[4] += L, u[5] += $, u[6] += B, u[7] += H, d += 64, p -= 64; + u[0] += w, u[1] += A, u[2] += M, u[3] += N, u[4] += L, u[5] += B, u[6] += $, u[7] += H, d += 64, p -= 64; } return d; } @@ -12971,7 +12971,7 @@ var Cx = Gl, Tx = ki, UU = ( } t.hash = o; })(Yl); -var Zv = {}; +var Xv = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.sharedKey = t.generateKeyPair = t.generateKeyPairFromSeed = t.scalarMultBase = t.scalarMult = t.SHARED_KEY_LENGTH = t.SECRET_KEY_LENGTH = t.PUBLIC_KEY_LENGTH = void 0; const e = Pa, r = ki; @@ -13031,8 +13031,8 @@ var Zv = {}; U[R] = V[R] - te[R]; } function w(U, V, te) { - let R, K, ge = 0, Ee = 0, Y = 0, S = 0, m = 0, f = 0, g = 0, b = 0, x = 0, _ = 0, E = 0, v = 0, P = 0, I = 0, F = 0, ce = 0, D = 0, oe = 0, Z = 0, J = 0, Q = 0, T = 0, X = 0, re = 0, de = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = te[0], Me = te[1], Ne = te[2], Ke = te[3], Le = te[4], qe = te[5], ze = te[6], _e = te[7], Ze = te[8], at = te[9], ke = te[10], Qe = te[11], tt = te[12], Ye = te[13], dt = te[14], lt = te[15]; - R = V[0], ge += R * $e, Ee += R * Me, Y += R * Ne, S += R * Ke, m += R * Le, f += R * qe, g += R * ze, b += R * _e, x += R * Ze, _ += R * at, E += R * ke, v += R * Qe, P += R * tt, I += R * Ye, F += R * dt, ce += R * lt, R = V[1], Ee += R * $e, Y += R * Me, S += R * Ne, m += R * Ke, f += R * Le, g += R * qe, b += R * ze, x += R * _e, _ += R * Ze, E += R * at, v += R * ke, P += R * Qe, I += R * tt, F += R * Ye, ce += R * dt, D += R * lt, R = V[2], Y += R * $e, S += R * Me, m += R * Ne, f += R * Ke, g += R * Le, b += R * qe, x += R * ze, _ += R * _e, E += R * Ze, v += R * at, P += R * ke, I += R * Qe, F += R * tt, ce += R * Ye, D += R * dt, oe += R * lt, R = V[3], S += R * $e, m += R * Me, f += R * Ne, g += R * Ke, b += R * Le, x += R * qe, _ += R * ze, E += R * _e, v += R * Ze, P += R * at, I += R * ke, F += R * Qe, ce += R * tt, D += R * Ye, oe += R * dt, Z += R * lt, R = V[4], m += R * $e, f += R * Me, g += R * Ne, b += R * Ke, x += R * Le, _ += R * qe, E += R * ze, v += R * _e, P += R * Ze, I += R * at, F += R * ke, ce += R * Qe, D += R * tt, oe += R * Ye, Z += R * dt, J += R * lt, R = V[5], f += R * $e, g += R * Me, b += R * Ne, x += R * Ke, _ += R * Le, E += R * qe, v += R * ze, P += R * _e, I += R * Ze, F += R * at, ce += R * ke, D += R * Qe, oe += R * tt, Z += R * Ye, J += R * dt, Q += R * lt, R = V[6], g += R * $e, b += R * Me, x += R * Ne, _ += R * Ke, E += R * Le, v += R * qe, P += R * ze, I += R * _e, F += R * Ze, ce += R * at, D += R * ke, oe += R * Qe, Z += R * tt, J += R * Ye, Q += R * dt, T += R * lt, R = V[7], b += R * $e, x += R * Me, _ += R * Ne, E += R * Ke, v += R * Le, P += R * qe, I += R * ze, F += R * _e, ce += R * Ze, D += R * at, oe += R * ke, Z += R * Qe, J += R * tt, Q += R * Ye, T += R * dt, X += R * lt, R = V[8], x += R * $e, _ += R * Me, E += R * Ne, v += R * Ke, P += R * Le, I += R * qe, F += R * ze, ce += R * _e, D += R * Ze, oe += R * at, Z += R * ke, J += R * Qe, Q += R * tt, T += R * Ye, X += R * dt, re += R * lt, R = V[9], _ += R * $e, E += R * Me, v += R * Ne, P += R * Ke, I += R * Le, F += R * qe, ce += R * ze, D += R * _e, oe += R * Ze, Z += R * at, J += R * ke, Q += R * Qe, T += R * tt, X += R * Ye, re += R * dt, de += R * lt, R = V[10], E += R * $e, v += R * Me, P += R * Ne, I += R * Ke, F += R * Le, ce += R * qe, D += R * ze, oe += R * _e, Z += R * Ze, J += R * at, Q += R * ke, T += R * Qe, X += R * tt, re += R * Ye, de += R * dt, ie += R * lt, R = V[11], v += R * $e, P += R * Me, I += R * Ne, F += R * Ke, ce += R * Le, D += R * qe, oe += R * ze, Z += R * _e, J += R * Ze, Q += R * at, T += R * ke, X += R * Qe, re += R * tt, de += R * Ye, ie += R * dt, ue += R * lt, R = V[12], P += R * $e, I += R * Me, F += R * Ne, ce += R * Ke, D += R * Le, oe += R * qe, Z += R * ze, J += R * _e, Q += R * Ze, T += R * at, X += R * ke, re += R * Qe, de += R * tt, ie += R * Ye, ue += R * dt, ve += R * lt, R = V[13], I += R * $e, F += R * Me, ce += R * Ne, D += R * Ke, oe += R * Le, Z += R * qe, J += R * ze, Q += R * _e, T += R * Ze, X += R * at, re += R * ke, de += R * Qe, ie += R * tt, ue += R * Ye, ve += R * dt, Pe += R * lt, R = V[14], F += R * $e, ce += R * Me, D += R * Ne, oe += R * Ke, Z += R * Le, J += R * qe, Q += R * ze, T += R * _e, X += R * Ze, re += R * at, de += R * ke, ie += R * Qe, ue += R * tt, ve += R * Ye, Pe += R * dt, De += R * lt, R = V[15], ce += R * $e, D += R * Me, oe += R * Ne, Z += R * Ke, J += R * Le, Q += R * qe, T += R * ze, X += R * _e, re += R * Ze, de += R * at, ie += R * ke, ue += R * Qe, ve += R * tt, Pe += R * Ye, De += R * dt, Ce += R * lt, ge += 38 * D, Ee += 38 * oe, Y += 38 * Z, S += 38 * J, m += 38 * Q, f += 38 * T, g += 38 * X, b += 38 * re, x += 38 * de, _ += 38 * ie, E += 38 * ue, v += 38 * ve, P += 38 * Pe, I += 38 * De, F += 38 * Ce, K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = _ + K + 65535, K = Math.floor(R / 65536), _ = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = P + K + 65535, K = Math.floor(R / 65536), P = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = _ + K + 65535, K = Math.floor(R / 65536), _ = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = P + K + 65535, K = Math.floor(R / 65536), P = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), U[0] = ge, U[1] = Ee, U[2] = Y, U[3] = S, U[4] = m, U[5] = f, U[6] = g, U[7] = b, U[8] = x, U[9] = _, U[10] = E, U[11] = v, U[12] = P, U[13] = I, U[14] = F, U[15] = ce; + let R, K, ge = 0, Ee = 0, Y = 0, S = 0, m = 0, f = 0, g = 0, b = 0, x = 0, _ = 0, E = 0, v = 0, P = 0, I = 0, F = 0, ce = 0, D = 0, oe = 0, Z = 0, J = 0, Q = 0, T = 0, X = 0, re = 0, pe = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = te[0], Me = te[1], Ne = te[2], Ke = te[3], Le = te[4], qe = te[5], ze = te[6], _e = te[7], Ze = te[8], at = te[9], ke = te[10], Qe = te[11], tt = te[12], Ye = te[13], dt = te[14], lt = te[15]; + R = V[0], ge += R * $e, Ee += R * Me, Y += R * Ne, S += R * Ke, m += R * Le, f += R * qe, g += R * ze, b += R * _e, x += R * Ze, _ += R * at, E += R * ke, v += R * Qe, P += R * tt, I += R * Ye, F += R * dt, ce += R * lt, R = V[1], Ee += R * $e, Y += R * Me, S += R * Ne, m += R * Ke, f += R * Le, g += R * qe, b += R * ze, x += R * _e, _ += R * Ze, E += R * at, v += R * ke, P += R * Qe, I += R * tt, F += R * Ye, ce += R * dt, D += R * lt, R = V[2], Y += R * $e, S += R * Me, m += R * Ne, f += R * Ke, g += R * Le, b += R * qe, x += R * ze, _ += R * _e, E += R * Ze, v += R * at, P += R * ke, I += R * Qe, F += R * tt, ce += R * Ye, D += R * dt, oe += R * lt, R = V[3], S += R * $e, m += R * Me, f += R * Ne, g += R * Ke, b += R * Le, x += R * qe, _ += R * ze, E += R * _e, v += R * Ze, P += R * at, I += R * ke, F += R * Qe, ce += R * tt, D += R * Ye, oe += R * dt, Z += R * lt, R = V[4], m += R * $e, f += R * Me, g += R * Ne, b += R * Ke, x += R * Le, _ += R * qe, E += R * ze, v += R * _e, P += R * Ze, I += R * at, F += R * ke, ce += R * Qe, D += R * tt, oe += R * Ye, Z += R * dt, J += R * lt, R = V[5], f += R * $e, g += R * Me, b += R * Ne, x += R * Ke, _ += R * Le, E += R * qe, v += R * ze, P += R * _e, I += R * Ze, F += R * at, ce += R * ke, D += R * Qe, oe += R * tt, Z += R * Ye, J += R * dt, Q += R * lt, R = V[6], g += R * $e, b += R * Me, x += R * Ne, _ += R * Ke, E += R * Le, v += R * qe, P += R * ze, I += R * _e, F += R * Ze, ce += R * at, D += R * ke, oe += R * Qe, Z += R * tt, J += R * Ye, Q += R * dt, T += R * lt, R = V[7], b += R * $e, x += R * Me, _ += R * Ne, E += R * Ke, v += R * Le, P += R * qe, I += R * ze, F += R * _e, ce += R * Ze, D += R * at, oe += R * ke, Z += R * Qe, J += R * tt, Q += R * Ye, T += R * dt, X += R * lt, R = V[8], x += R * $e, _ += R * Me, E += R * Ne, v += R * Ke, P += R * Le, I += R * qe, F += R * ze, ce += R * _e, D += R * Ze, oe += R * at, Z += R * ke, J += R * Qe, Q += R * tt, T += R * Ye, X += R * dt, re += R * lt, R = V[9], _ += R * $e, E += R * Me, v += R * Ne, P += R * Ke, I += R * Le, F += R * qe, ce += R * ze, D += R * _e, oe += R * Ze, Z += R * at, J += R * ke, Q += R * Qe, T += R * tt, X += R * Ye, re += R * dt, pe += R * lt, R = V[10], E += R * $e, v += R * Me, P += R * Ne, I += R * Ke, F += R * Le, ce += R * qe, D += R * ze, oe += R * _e, Z += R * Ze, J += R * at, Q += R * ke, T += R * Qe, X += R * tt, re += R * Ye, pe += R * dt, ie += R * lt, R = V[11], v += R * $e, P += R * Me, I += R * Ne, F += R * Ke, ce += R * Le, D += R * qe, oe += R * ze, Z += R * _e, J += R * Ze, Q += R * at, T += R * ke, X += R * Qe, re += R * tt, pe += R * Ye, ie += R * dt, ue += R * lt, R = V[12], P += R * $e, I += R * Me, F += R * Ne, ce += R * Ke, D += R * Le, oe += R * qe, Z += R * ze, J += R * _e, Q += R * Ze, T += R * at, X += R * ke, re += R * Qe, pe += R * tt, ie += R * Ye, ue += R * dt, ve += R * lt, R = V[13], I += R * $e, F += R * Me, ce += R * Ne, D += R * Ke, oe += R * Le, Z += R * qe, J += R * ze, Q += R * _e, T += R * Ze, X += R * at, re += R * ke, pe += R * Qe, ie += R * tt, ue += R * Ye, ve += R * dt, Pe += R * lt, R = V[14], F += R * $e, ce += R * Me, D += R * Ne, oe += R * Ke, Z += R * Le, J += R * qe, Q += R * ze, T += R * _e, X += R * Ze, re += R * at, pe += R * ke, ie += R * Qe, ue += R * tt, ve += R * Ye, Pe += R * dt, De += R * lt, R = V[15], ce += R * $e, D += R * Me, oe += R * Ne, Z += R * Ke, J += R * Le, Q += R * qe, T += R * ze, X += R * _e, re += R * Ze, pe += R * at, ie += R * ke, ue += R * Qe, ve += R * tt, Pe += R * Ye, De += R * dt, Ce += R * lt, ge += 38 * D, Ee += 38 * oe, Y += 38 * Z, S += 38 * J, m += 38 * Q, f += 38 * T, g += 38 * X, b += 38 * re, x += 38 * pe, _ += 38 * ie, E += 38 * ue, v += 38 * ve, P += 38 * Pe, I += 38 * De, F += 38 * Ce, K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = _ + K + 65535, K = Math.floor(R / 65536), _ = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = P + K + 65535, K = Math.floor(R / 65536), P = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = _ + K + 65535, K = Math.floor(R / 65536), _ = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = P + K + 65535, K = Math.floor(R / 65536), P = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), U[0] = ge, U[1] = Ee, U[2] = Y, U[3] = S, U[4] = m, U[5] = f, U[6] = g, U[7] = b, U[8] = x, U[9] = _, U[10] = E, U[11] = v, U[12] = P, U[13] = I, U[14] = F, U[15] = ce; } function A(U, V) { w(U, V, V); @@ -13070,7 +13070,7 @@ var Zv = {}; return N(U, i); } t.scalarMultBase = L; - function $(U) { + function B(U) { if (U.length !== t.SECRET_KEY_LENGTH) throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`); const V = new Uint8Array(U); @@ -13079,12 +13079,12 @@ var Zv = {}; secretKey: V }; } - t.generateKeyPairFromSeed = $; - function B(U) { - const V = (0, e.randomBytes)(32, U), te = $(V); + t.generateKeyPairFromSeed = B; + function $(U) { + const V = (0, e.randomBytes)(32, U), te = B(V); return (0, r.wipe)(V), te; } - t.generateKeyPair = B; + t.generateKeyPair = $; function H(U, V, te = !1) { if (U.length !== t.PUBLIC_KEY_LENGTH) throw new Error("X25519: incorrect secret key length"); @@ -13101,8 +13101,8 @@ var Zv = {}; return R; } t.sharedKey = H; -})(Zv); -var E8 = {}; +})(Xv); +var _8 = {}; const zU = "elliptic", WU = "6.6.0", HU = "EC cryptography", KU = "lib/elliptic.js", VU = [ "lib" ], GU = { @@ -13159,8 +13159,8 @@ const zU = "elliptic", WU = "6.6.0", HU = "EC cryptography", KU = "lib/elliptic. devDependencies: tq, dependencies: rq }; -var Bi = {}, Qv = { exports: {} }; -Qv.exports; +var Bi = {}, Zv = { exports: {} }; +Zv.exports; (function(t) { (function(e, r) { function n(Y, S) { @@ -13592,44 +13592,44 @@ Qv.exports; return E !== 0 ? m.words[v] = E | 0 : m.length--, m.strip(); } var N = function(S, m, f) { - var g = S.words, b = m.words, x = f.words, _ = 0, E, v, P, I = g[0] | 0, F = I & 8191, ce = I >>> 13, D = g[1] | 0, oe = D & 8191, Z = D >>> 13, J = g[2] | 0, Q = J & 8191, T = J >>> 13, X = g[3] | 0, re = X & 8191, de = X >>> 13, ie = g[4] | 0, ue = ie & 8191, ve = ie >>> 13, Pe = g[5] | 0, De = Pe & 8191, Ce = Pe >>> 13, $e = g[6] | 0, Me = $e & 8191, Ne = $e >>> 13, Ke = g[7] | 0, Le = Ke & 8191, qe = Ke >>> 13, ze = g[8] | 0, _e = ze & 8191, Ze = ze >>> 13, at = g[9] | 0, ke = at & 8191, Qe = at >>> 13, tt = b[0] | 0, Ye = tt & 8191, dt = tt >>> 13, lt = b[1] | 0, ct = lt & 8191, qt = lt >>> 13, Jt = b[2] | 0, Et = Jt & 8191, er = Jt >>> 13, Xt = b[3] | 0, Dt = Xt & 8191, kt = Xt >>> 13, Ct = b[4] | 0, gt = Ct & 8191, Rt = Ct >>> 13, Nt = b[5] | 0, vt = Nt & 8191, $t = Nt >>> 13, Ft = b[6] | 0, rt = Ft & 8191, Bt = Ft >>> 13, k = b[7] | 0, q = k & 8191, W = k >>> 13, C = b[8] | 0, G = C & 8191, j = C >>> 13, se = b[9] | 0, he = se & 8191, xe = se >>> 13; + var g = S.words, b = m.words, x = f.words, _ = 0, E, v, P, I = g[0] | 0, F = I & 8191, ce = I >>> 13, D = g[1] | 0, oe = D & 8191, Z = D >>> 13, J = g[2] | 0, Q = J & 8191, T = J >>> 13, X = g[3] | 0, re = X & 8191, pe = X >>> 13, ie = g[4] | 0, ue = ie & 8191, ve = ie >>> 13, Pe = g[5] | 0, De = Pe & 8191, Ce = Pe >>> 13, $e = g[6] | 0, Me = $e & 8191, Ne = $e >>> 13, Ke = g[7] | 0, Le = Ke & 8191, qe = Ke >>> 13, ze = g[8] | 0, _e = ze & 8191, Ze = ze >>> 13, at = g[9] | 0, ke = at & 8191, Qe = at >>> 13, tt = b[0] | 0, Ye = tt & 8191, dt = tt >>> 13, lt = b[1] | 0, ct = lt & 8191, qt = lt >>> 13, Jt = b[2] | 0, Et = Jt & 8191, er = Jt >>> 13, Xt = b[3] | 0, Dt = Xt & 8191, kt = Xt >>> 13, Ct = b[4] | 0, gt = Ct & 8191, Rt = Ct >>> 13, Nt = b[5] | 0, vt = Nt & 8191, $t = Nt >>> 13, Ft = b[6] | 0, rt = Ft & 8191, Bt = Ft >>> 13, k = b[7] | 0, q = k & 8191, W = k >>> 13, C = b[8] | 0, G = C & 8191, j = C >>> 13, se = b[9] | 0, de = se & 8191, xe = se >>> 13; f.negative = S.negative ^ m.negative, f.length = 19, E = Math.imul(F, Ye), v = Math.imul(F, dt), v = v + Math.imul(ce, Ye) | 0, P = Math.imul(ce, dt); var Te = (_ + E | 0) + ((v & 8191) << 13) | 0; _ = (P + (v >>> 13) | 0) + (Te >>> 26) | 0, Te &= 67108863, E = Math.imul(oe, Ye), v = Math.imul(oe, dt), v = v + Math.imul(Z, Ye) | 0, P = Math.imul(Z, dt), E = E + Math.imul(F, ct) | 0, v = v + Math.imul(F, qt) | 0, v = v + Math.imul(ce, ct) | 0, P = P + Math.imul(ce, qt) | 0; var Re = (_ + E | 0) + ((v & 8191) << 13) | 0; _ = (P + (v >>> 13) | 0) + (Re >>> 26) | 0, Re &= 67108863, E = Math.imul(Q, Ye), v = Math.imul(Q, dt), v = v + Math.imul(T, Ye) | 0, P = Math.imul(T, dt), E = E + Math.imul(oe, ct) | 0, v = v + Math.imul(oe, qt) | 0, v = v + Math.imul(Z, ct) | 0, P = P + Math.imul(Z, qt) | 0, E = E + Math.imul(F, Et) | 0, v = v + Math.imul(F, er) | 0, v = v + Math.imul(ce, Et) | 0, P = P + Math.imul(ce, er) | 0; var nt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, E = Math.imul(re, Ye), v = Math.imul(re, dt), v = v + Math.imul(de, Ye) | 0, P = Math.imul(de, dt), E = E + Math.imul(Q, ct) | 0, v = v + Math.imul(Q, qt) | 0, v = v + Math.imul(T, ct) | 0, P = P + Math.imul(T, qt) | 0, E = E + Math.imul(oe, Et) | 0, v = v + Math.imul(oe, er) | 0, v = v + Math.imul(Z, Et) | 0, P = P + Math.imul(Z, er) | 0, E = E + Math.imul(F, Dt) | 0, v = v + Math.imul(F, kt) | 0, v = v + Math.imul(ce, Dt) | 0, P = P + Math.imul(ce, kt) | 0; + _ = (P + (v >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, E = Math.imul(re, Ye), v = Math.imul(re, dt), v = v + Math.imul(pe, Ye) | 0, P = Math.imul(pe, dt), E = E + Math.imul(Q, ct) | 0, v = v + Math.imul(Q, qt) | 0, v = v + Math.imul(T, ct) | 0, P = P + Math.imul(T, qt) | 0, E = E + Math.imul(oe, Et) | 0, v = v + Math.imul(oe, er) | 0, v = v + Math.imul(Z, Et) | 0, P = P + Math.imul(Z, er) | 0, E = E + Math.imul(F, Dt) | 0, v = v + Math.imul(F, kt) | 0, v = v + Math.imul(ce, Dt) | 0, P = P + Math.imul(ce, kt) | 0; var je = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (je >>> 26) | 0, je &= 67108863, E = Math.imul(ue, Ye), v = Math.imul(ue, dt), v = v + Math.imul(ve, Ye) | 0, P = Math.imul(ve, dt), E = E + Math.imul(re, ct) | 0, v = v + Math.imul(re, qt) | 0, v = v + Math.imul(de, ct) | 0, P = P + Math.imul(de, qt) | 0, E = E + Math.imul(Q, Et) | 0, v = v + Math.imul(Q, er) | 0, v = v + Math.imul(T, Et) | 0, P = P + Math.imul(T, er) | 0, E = E + Math.imul(oe, Dt) | 0, v = v + Math.imul(oe, kt) | 0, v = v + Math.imul(Z, Dt) | 0, P = P + Math.imul(Z, kt) | 0, E = E + Math.imul(F, gt) | 0, v = v + Math.imul(F, Rt) | 0, v = v + Math.imul(ce, gt) | 0, P = P + Math.imul(ce, Rt) | 0; + _ = (P + (v >>> 13) | 0) + (je >>> 26) | 0, je &= 67108863, E = Math.imul(ue, Ye), v = Math.imul(ue, dt), v = v + Math.imul(ve, Ye) | 0, P = Math.imul(ve, dt), E = E + Math.imul(re, ct) | 0, v = v + Math.imul(re, qt) | 0, v = v + Math.imul(pe, ct) | 0, P = P + Math.imul(pe, qt) | 0, E = E + Math.imul(Q, Et) | 0, v = v + Math.imul(Q, er) | 0, v = v + Math.imul(T, Et) | 0, P = P + Math.imul(T, er) | 0, E = E + Math.imul(oe, Dt) | 0, v = v + Math.imul(oe, kt) | 0, v = v + Math.imul(Z, Dt) | 0, P = P + Math.imul(Z, kt) | 0, E = E + Math.imul(F, gt) | 0, v = v + Math.imul(F, Rt) | 0, v = v + Math.imul(ce, gt) | 0, P = P + Math.imul(ce, Rt) | 0; var pt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (pt >>> 26) | 0, pt &= 67108863, E = Math.imul(De, Ye), v = Math.imul(De, dt), v = v + Math.imul(Ce, Ye) | 0, P = Math.imul(Ce, dt), E = E + Math.imul(ue, ct) | 0, v = v + Math.imul(ue, qt) | 0, v = v + Math.imul(ve, ct) | 0, P = P + Math.imul(ve, qt) | 0, E = E + Math.imul(re, Et) | 0, v = v + Math.imul(re, er) | 0, v = v + Math.imul(de, Et) | 0, P = P + Math.imul(de, er) | 0, E = E + Math.imul(Q, Dt) | 0, v = v + Math.imul(Q, kt) | 0, v = v + Math.imul(T, Dt) | 0, P = P + Math.imul(T, kt) | 0, E = E + Math.imul(oe, gt) | 0, v = v + Math.imul(oe, Rt) | 0, v = v + Math.imul(Z, gt) | 0, P = P + Math.imul(Z, Rt) | 0, E = E + Math.imul(F, vt) | 0, v = v + Math.imul(F, $t) | 0, v = v + Math.imul(ce, vt) | 0, P = P + Math.imul(ce, $t) | 0; + _ = (P + (v >>> 13) | 0) + (pt >>> 26) | 0, pt &= 67108863, E = Math.imul(De, Ye), v = Math.imul(De, dt), v = v + Math.imul(Ce, Ye) | 0, P = Math.imul(Ce, dt), E = E + Math.imul(ue, ct) | 0, v = v + Math.imul(ue, qt) | 0, v = v + Math.imul(ve, ct) | 0, P = P + Math.imul(ve, qt) | 0, E = E + Math.imul(re, Et) | 0, v = v + Math.imul(re, er) | 0, v = v + Math.imul(pe, Et) | 0, P = P + Math.imul(pe, er) | 0, E = E + Math.imul(Q, Dt) | 0, v = v + Math.imul(Q, kt) | 0, v = v + Math.imul(T, Dt) | 0, P = P + Math.imul(T, kt) | 0, E = E + Math.imul(oe, gt) | 0, v = v + Math.imul(oe, Rt) | 0, v = v + Math.imul(Z, gt) | 0, P = P + Math.imul(Z, Rt) | 0, E = E + Math.imul(F, vt) | 0, v = v + Math.imul(F, $t) | 0, v = v + Math.imul(ce, vt) | 0, P = P + Math.imul(ce, $t) | 0; var it = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, E = Math.imul(Me, Ye), v = Math.imul(Me, dt), v = v + Math.imul(Ne, Ye) | 0, P = Math.imul(Ne, dt), E = E + Math.imul(De, ct) | 0, v = v + Math.imul(De, qt) | 0, v = v + Math.imul(Ce, ct) | 0, P = P + Math.imul(Ce, qt) | 0, E = E + Math.imul(ue, Et) | 0, v = v + Math.imul(ue, er) | 0, v = v + Math.imul(ve, Et) | 0, P = P + Math.imul(ve, er) | 0, E = E + Math.imul(re, Dt) | 0, v = v + Math.imul(re, kt) | 0, v = v + Math.imul(de, Dt) | 0, P = P + Math.imul(de, kt) | 0, E = E + Math.imul(Q, gt) | 0, v = v + Math.imul(Q, Rt) | 0, v = v + Math.imul(T, gt) | 0, P = P + Math.imul(T, Rt) | 0, E = E + Math.imul(oe, vt) | 0, v = v + Math.imul(oe, $t) | 0, v = v + Math.imul(Z, vt) | 0, P = P + Math.imul(Z, $t) | 0, E = E + Math.imul(F, rt) | 0, v = v + Math.imul(F, Bt) | 0, v = v + Math.imul(ce, rt) | 0, P = P + Math.imul(ce, Bt) | 0; + _ = (P + (v >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, E = Math.imul(Me, Ye), v = Math.imul(Me, dt), v = v + Math.imul(Ne, Ye) | 0, P = Math.imul(Ne, dt), E = E + Math.imul(De, ct) | 0, v = v + Math.imul(De, qt) | 0, v = v + Math.imul(Ce, ct) | 0, P = P + Math.imul(Ce, qt) | 0, E = E + Math.imul(ue, Et) | 0, v = v + Math.imul(ue, er) | 0, v = v + Math.imul(ve, Et) | 0, P = P + Math.imul(ve, er) | 0, E = E + Math.imul(re, Dt) | 0, v = v + Math.imul(re, kt) | 0, v = v + Math.imul(pe, Dt) | 0, P = P + Math.imul(pe, kt) | 0, E = E + Math.imul(Q, gt) | 0, v = v + Math.imul(Q, Rt) | 0, v = v + Math.imul(T, gt) | 0, P = P + Math.imul(T, Rt) | 0, E = E + Math.imul(oe, vt) | 0, v = v + Math.imul(oe, $t) | 0, v = v + Math.imul(Z, vt) | 0, P = P + Math.imul(Z, $t) | 0, E = E + Math.imul(F, rt) | 0, v = v + Math.imul(F, Bt) | 0, v = v + Math.imul(ce, rt) | 0, P = P + Math.imul(ce, Bt) | 0; var et = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, E = Math.imul(Le, Ye), v = Math.imul(Le, dt), v = v + Math.imul(qe, Ye) | 0, P = Math.imul(qe, dt), E = E + Math.imul(Me, ct) | 0, v = v + Math.imul(Me, qt) | 0, v = v + Math.imul(Ne, ct) | 0, P = P + Math.imul(Ne, qt) | 0, E = E + Math.imul(De, Et) | 0, v = v + Math.imul(De, er) | 0, v = v + Math.imul(Ce, Et) | 0, P = P + Math.imul(Ce, er) | 0, E = E + Math.imul(ue, Dt) | 0, v = v + Math.imul(ue, kt) | 0, v = v + Math.imul(ve, Dt) | 0, P = P + Math.imul(ve, kt) | 0, E = E + Math.imul(re, gt) | 0, v = v + Math.imul(re, Rt) | 0, v = v + Math.imul(de, gt) | 0, P = P + Math.imul(de, Rt) | 0, E = E + Math.imul(Q, vt) | 0, v = v + Math.imul(Q, $t) | 0, v = v + Math.imul(T, vt) | 0, P = P + Math.imul(T, $t) | 0, E = E + Math.imul(oe, rt) | 0, v = v + Math.imul(oe, Bt) | 0, v = v + Math.imul(Z, rt) | 0, P = P + Math.imul(Z, Bt) | 0, E = E + Math.imul(F, q) | 0, v = v + Math.imul(F, W) | 0, v = v + Math.imul(ce, q) | 0, P = P + Math.imul(ce, W) | 0; + _ = (P + (v >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, E = Math.imul(Le, Ye), v = Math.imul(Le, dt), v = v + Math.imul(qe, Ye) | 0, P = Math.imul(qe, dt), E = E + Math.imul(Me, ct) | 0, v = v + Math.imul(Me, qt) | 0, v = v + Math.imul(Ne, ct) | 0, P = P + Math.imul(Ne, qt) | 0, E = E + Math.imul(De, Et) | 0, v = v + Math.imul(De, er) | 0, v = v + Math.imul(Ce, Et) | 0, P = P + Math.imul(Ce, er) | 0, E = E + Math.imul(ue, Dt) | 0, v = v + Math.imul(ue, kt) | 0, v = v + Math.imul(ve, Dt) | 0, P = P + Math.imul(ve, kt) | 0, E = E + Math.imul(re, gt) | 0, v = v + Math.imul(re, Rt) | 0, v = v + Math.imul(pe, gt) | 0, P = P + Math.imul(pe, Rt) | 0, E = E + Math.imul(Q, vt) | 0, v = v + Math.imul(Q, $t) | 0, v = v + Math.imul(T, vt) | 0, P = P + Math.imul(T, $t) | 0, E = E + Math.imul(oe, rt) | 0, v = v + Math.imul(oe, Bt) | 0, v = v + Math.imul(Z, rt) | 0, P = P + Math.imul(Z, Bt) | 0, E = E + Math.imul(F, q) | 0, v = v + Math.imul(F, W) | 0, v = v + Math.imul(ce, q) | 0, P = P + Math.imul(ce, W) | 0; var St = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, E = Math.imul(_e, Ye), v = Math.imul(_e, dt), v = v + Math.imul(Ze, Ye) | 0, P = Math.imul(Ze, dt), E = E + Math.imul(Le, ct) | 0, v = v + Math.imul(Le, qt) | 0, v = v + Math.imul(qe, ct) | 0, P = P + Math.imul(qe, qt) | 0, E = E + Math.imul(Me, Et) | 0, v = v + Math.imul(Me, er) | 0, v = v + Math.imul(Ne, Et) | 0, P = P + Math.imul(Ne, er) | 0, E = E + Math.imul(De, Dt) | 0, v = v + Math.imul(De, kt) | 0, v = v + Math.imul(Ce, Dt) | 0, P = P + Math.imul(Ce, kt) | 0, E = E + Math.imul(ue, gt) | 0, v = v + Math.imul(ue, Rt) | 0, v = v + Math.imul(ve, gt) | 0, P = P + Math.imul(ve, Rt) | 0, E = E + Math.imul(re, vt) | 0, v = v + Math.imul(re, $t) | 0, v = v + Math.imul(de, vt) | 0, P = P + Math.imul(de, $t) | 0, E = E + Math.imul(Q, rt) | 0, v = v + Math.imul(Q, Bt) | 0, v = v + Math.imul(T, rt) | 0, P = P + Math.imul(T, Bt) | 0, E = E + Math.imul(oe, q) | 0, v = v + Math.imul(oe, W) | 0, v = v + Math.imul(Z, q) | 0, P = P + Math.imul(Z, W) | 0, E = E + Math.imul(F, G) | 0, v = v + Math.imul(F, j) | 0, v = v + Math.imul(ce, G) | 0, P = P + Math.imul(ce, j) | 0; + _ = (P + (v >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, E = Math.imul(_e, Ye), v = Math.imul(_e, dt), v = v + Math.imul(Ze, Ye) | 0, P = Math.imul(Ze, dt), E = E + Math.imul(Le, ct) | 0, v = v + Math.imul(Le, qt) | 0, v = v + Math.imul(qe, ct) | 0, P = P + Math.imul(qe, qt) | 0, E = E + Math.imul(Me, Et) | 0, v = v + Math.imul(Me, er) | 0, v = v + Math.imul(Ne, Et) | 0, P = P + Math.imul(Ne, er) | 0, E = E + Math.imul(De, Dt) | 0, v = v + Math.imul(De, kt) | 0, v = v + Math.imul(Ce, Dt) | 0, P = P + Math.imul(Ce, kt) | 0, E = E + Math.imul(ue, gt) | 0, v = v + Math.imul(ue, Rt) | 0, v = v + Math.imul(ve, gt) | 0, P = P + Math.imul(ve, Rt) | 0, E = E + Math.imul(re, vt) | 0, v = v + Math.imul(re, $t) | 0, v = v + Math.imul(pe, vt) | 0, P = P + Math.imul(pe, $t) | 0, E = E + Math.imul(Q, rt) | 0, v = v + Math.imul(Q, Bt) | 0, v = v + Math.imul(T, rt) | 0, P = P + Math.imul(T, Bt) | 0, E = E + Math.imul(oe, q) | 0, v = v + Math.imul(oe, W) | 0, v = v + Math.imul(Z, q) | 0, P = P + Math.imul(Z, W) | 0, E = E + Math.imul(F, G) | 0, v = v + Math.imul(F, j) | 0, v = v + Math.imul(ce, G) | 0, P = P + Math.imul(ce, j) | 0; var Tt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, E = Math.imul(ke, Ye), v = Math.imul(ke, dt), v = v + Math.imul(Qe, Ye) | 0, P = Math.imul(Qe, dt), E = E + Math.imul(_e, ct) | 0, v = v + Math.imul(_e, qt) | 0, v = v + Math.imul(Ze, ct) | 0, P = P + Math.imul(Ze, qt) | 0, E = E + Math.imul(Le, Et) | 0, v = v + Math.imul(Le, er) | 0, v = v + Math.imul(qe, Et) | 0, P = P + Math.imul(qe, er) | 0, E = E + Math.imul(Me, Dt) | 0, v = v + Math.imul(Me, kt) | 0, v = v + Math.imul(Ne, Dt) | 0, P = P + Math.imul(Ne, kt) | 0, E = E + Math.imul(De, gt) | 0, v = v + Math.imul(De, Rt) | 0, v = v + Math.imul(Ce, gt) | 0, P = P + Math.imul(Ce, Rt) | 0, E = E + Math.imul(ue, vt) | 0, v = v + Math.imul(ue, $t) | 0, v = v + Math.imul(ve, vt) | 0, P = P + Math.imul(ve, $t) | 0, E = E + Math.imul(re, rt) | 0, v = v + Math.imul(re, Bt) | 0, v = v + Math.imul(de, rt) | 0, P = P + Math.imul(de, Bt) | 0, E = E + Math.imul(Q, q) | 0, v = v + Math.imul(Q, W) | 0, v = v + Math.imul(T, q) | 0, P = P + Math.imul(T, W) | 0, E = E + Math.imul(oe, G) | 0, v = v + Math.imul(oe, j) | 0, v = v + Math.imul(Z, G) | 0, P = P + Math.imul(Z, j) | 0, E = E + Math.imul(F, he) | 0, v = v + Math.imul(F, xe) | 0, v = v + Math.imul(ce, he) | 0, P = P + Math.imul(ce, xe) | 0; + _ = (P + (v >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, E = Math.imul(ke, Ye), v = Math.imul(ke, dt), v = v + Math.imul(Qe, Ye) | 0, P = Math.imul(Qe, dt), E = E + Math.imul(_e, ct) | 0, v = v + Math.imul(_e, qt) | 0, v = v + Math.imul(Ze, ct) | 0, P = P + Math.imul(Ze, qt) | 0, E = E + Math.imul(Le, Et) | 0, v = v + Math.imul(Le, er) | 0, v = v + Math.imul(qe, Et) | 0, P = P + Math.imul(qe, er) | 0, E = E + Math.imul(Me, Dt) | 0, v = v + Math.imul(Me, kt) | 0, v = v + Math.imul(Ne, Dt) | 0, P = P + Math.imul(Ne, kt) | 0, E = E + Math.imul(De, gt) | 0, v = v + Math.imul(De, Rt) | 0, v = v + Math.imul(Ce, gt) | 0, P = P + Math.imul(Ce, Rt) | 0, E = E + Math.imul(ue, vt) | 0, v = v + Math.imul(ue, $t) | 0, v = v + Math.imul(ve, vt) | 0, P = P + Math.imul(ve, $t) | 0, E = E + Math.imul(re, rt) | 0, v = v + Math.imul(re, Bt) | 0, v = v + Math.imul(pe, rt) | 0, P = P + Math.imul(pe, Bt) | 0, E = E + Math.imul(Q, q) | 0, v = v + Math.imul(Q, W) | 0, v = v + Math.imul(T, q) | 0, P = P + Math.imul(T, W) | 0, E = E + Math.imul(oe, G) | 0, v = v + Math.imul(oe, j) | 0, v = v + Math.imul(Z, G) | 0, P = P + Math.imul(Z, j) | 0, E = E + Math.imul(F, de) | 0, v = v + Math.imul(F, xe) | 0, v = v + Math.imul(ce, de) | 0, P = P + Math.imul(ce, xe) | 0; var At = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, E = Math.imul(ke, ct), v = Math.imul(ke, qt), v = v + Math.imul(Qe, ct) | 0, P = Math.imul(Qe, qt), E = E + Math.imul(_e, Et) | 0, v = v + Math.imul(_e, er) | 0, v = v + Math.imul(Ze, Et) | 0, P = P + Math.imul(Ze, er) | 0, E = E + Math.imul(Le, Dt) | 0, v = v + Math.imul(Le, kt) | 0, v = v + Math.imul(qe, Dt) | 0, P = P + Math.imul(qe, kt) | 0, E = E + Math.imul(Me, gt) | 0, v = v + Math.imul(Me, Rt) | 0, v = v + Math.imul(Ne, gt) | 0, P = P + Math.imul(Ne, Rt) | 0, E = E + Math.imul(De, vt) | 0, v = v + Math.imul(De, $t) | 0, v = v + Math.imul(Ce, vt) | 0, P = P + Math.imul(Ce, $t) | 0, E = E + Math.imul(ue, rt) | 0, v = v + Math.imul(ue, Bt) | 0, v = v + Math.imul(ve, rt) | 0, P = P + Math.imul(ve, Bt) | 0, E = E + Math.imul(re, q) | 0, v = v + Math.imul(re, W) | 0, v = v + Math.imul(de, q) | 0, P = P + Math.imul(de, W) | 0, E = E + Math.imul(Q, G) | 0, v = v + Math.imul(Q, j) | 0, v = v + Math.imul(T, G) | 0, P = P + Math.imul(T, j) | 0, E = E + Math.imul(oe, he) | 0, v = v + Math.imul(oe, xe) | 0, v = v + Math.imul(Z, he) | 0, P = P + Math.imul(Z, xe) | 0; + _ = (P + (v >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, E = Math.imul(ke, ct), v = Math.imul(ke, qt), v = v + Math.imul(Qe, ct) | 0, P = Math.imul(Qe, qt), E = E + Math.imul(_e, Et) | 0, v = v + Math.imul(_e, er) | 0, v = v + Math.imul(Ze, Et) | 0, P = P + Math.imul(Ze, er) | 0, E = E + Math.imul(Le, Dt) | 0, v = v + Math.imul(Le, kt) | 0, v = v + Math.imul(qe, Dt) | 0, P = P + Math.imul(qe, kt) | 0, E = E + Math.imul(Me, gt) | 0, v = v + Math.imul(Me, Rt) | 0, v = v + Math.imul(Ne, gt) | 0, P = P + Math.imul(Ne, Rt) | 0, E = E + Math.imul(De, vt) | 0, v = v + Math.imul(De, $t) | 0, v = v + Math.imul(Ce, vt) | 0, P = P + Math.imul(Ce, $t) | 0, E = E + Math.imul(ue, rt) | 0, v = v + Math.imul(ue, Bt) | 0, v = v + Math.imul(ve, rt) | 0, P = P + Math.imul(ve, Bt) | 0, E = E + Math.imul(re, q) | 0, v = v + Math.imul(re, W) | 0, v = v + Math.imul(pe, q) | 0, P = P + Math.imul(pe, W) | 0, E = E + Math.imul(Q, G) | 0, v = v + Math.imul(Q, j) | 0, v = v + Math.imul(T, G) | 0, P = P + Math.imul(T, j) | 0, E = E + Math.imul(oe, de) | 0, v = v + Math.imul(oe, xe) | 0, v = v + Math.imul(Z, de) | 0, P = P + Math.imul(Z, xe) | 0; var _t = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, E = Math.imul(ke, Et), v = Math.imul(ke, er), v = v + Math.imul(Qe, Et) | 0, P = Math.imul(Qe, er), E = E + Math.imul(_e, Dt) | 0, v = v + Math.imul(_e, kt) | 0, v = v + Math.imul(Ze, Dt) | 0, P = P + Math.imul(Ze, kt) | 0, E = E + Math.imul(Le, gt) | 0, v = v + Math.imul(Le, Rt) | 0, v = v + Math.imul(qe, gt) | 0, P = P + Math.imul(qe, Rt) | 0, E = E + Math.imul(Me, vt) | 0, v = v + Math.imul(Me, $t) | 0, v = v + Math.imul(Ne, vt) | 0, P = P + Math.imul(Ne, $t) | 0, E = E + Math.imul(De, rt) | 0, v = v + Math.imul(De, Bt) | 0, v = v + Math.imul(Ce, rt) | 0, P = P + Math.imul(Ce, Bt) | 0, E = E + Math.imul(ue, q) | 0, v = v + Math.imul(ue, W) | 0, v = v + Math.imul(ve, q) | 0, P = P + Math.imul(ve, W) | 0, E = E + Math.imul(re, G) | 0, v = v + Math.imul(re, j) | 0, v = v + Math.imul(de, G) | 0, P = P + Math.imul(de, j) | 0, E = E + Math.imul(Q, he) | 0, v = v + Math.imul(Q, xe) | 0, v = v + Math.imul(T, he) | 0, P = P + Math.imul(T, xe) | 0; + _ = (P + (v >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, E = Math.imul(ke, Et), v = Math.imul(ke, er), v = v + Math.imul(Qe, Et) | 0, P = Math.imul(Qe, er), E = E + Math.imul(_e, Dt) | 0, v = v + Math.imul(_e, kt) | 0, v = v + Math.imul(Ze, Dt) | 0, P = P + Math.imul(Ze, kt) | 0, E = E + Math.imul(Le, gt) | 0, v = v + Math.imul(Le, Rt) | 0, v = v + Math.imul(qe, gt) | 0, P = P + Math.imul(qe, Rt) | 0, E = E + Math.imul(Me, vt) | 0, v = v + Math.imul(Me, $t) | 0, v = v + Math.imul(Ne, vt) | 0, P = P + Math.imul(Ne, $t) | 0, E = E + Math.imul(De, rt) | 0, v = v + Math.imul(De, Bt) | 0, v = v + Math.imul(Ce, rt) | 0, P = P + Math.imul(Ce, Bt) | 0, E = E + Math.imul(ue, q) | 0, v = v + Math.imul(ue, W) | 0, v = v + Math.imul(ve, q) | 0, P = P + Math.imul(ve, W) | 0, E = E + Math.imul(re, G) | 0, v = v + Math.imul(re, j) | 0, v = v + Math.imul(pe, G) | 0, P = P + Math.imul(pe, j) | 0, E = E + Math.imul(Q, de) | 0, v = v + Math.imul(Q, xe) | 0, v = v + Math.imul(T, de) | 0, P = P + Math.imul(T, xe) | 0; var ht = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, E = Math.imul(ke, Dt), v = Math.imul(ke, kt), v = v + Math.imul(Qe, Dt) | 0, P = Math.imul(Qe, kt), E = E + Math.imul(_e, gt) | 0, v = v + Math.imul(_e, Rt) | 0, v = v + Math.imul(Ze, gt) | 0, P = P + Math.imul(Ze, Rt) | 0, E = E + Math.imul(Le, vt) | 0, v = v + Math.imul(Le, $t) | 0, v = v + Math.imul(qe, vt) | 0, P = P + Math.imul(qe, $t) | 0, E = E + Math.imul(Me, rt) | 0, v = v + Math.imul(Me, Bt) | 0, v = v + Math.imul(Ne, rt) | 0, P = P + Math.imul(Ne, Bt) | 0, E = E + Math.imul(De, q) | 0, v = v + Math.imul(De, W) | 0, v = v + Math.imul(Ce, q) | 0, P = P + Math.imul(Ce, W) | 0, E = E + Math.imul(ue, G) | 0, v = v + Math.imul(ue, j) | 0, v = v + Math.imul(ve, G) | 0, P = P + Math.imul(ve, j) | 0, E = E + Math.imul(re, he) | 0, v = v + Math.imul(re, xe) | 0, v = v + Math.imul(de, he) | 0, P = P + Math.imul(de, xe) | 0; + _ = (P + (v >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, E = Math.imul(ke, Dt), v = Math.imul(ke, kt), v = v + Math.imul(Qe, Dt) | 0, P = Math.imul(Qe, kt), E = E + Math.imul(_e, gt) | 0, v = v + Math.imul(_e, Rt) | 0, v = v + Math.imul(Ze, gt) | 0, P = P + Math.imul(Ze, Rt) | 0, E = E + Math.imul(Le, vt) | 0, v = v + Math.imul(Le, $t) | 0, v = v + Math.imul(qe, vt) | 0, P = P + Math.imul(qe, $t) | 0, E = E + Math.imul(Me, rt) | 0, v = v + Math.imul(Me, Bt) | 0, v = v + Math.imul(Ne, rt) | 0, P = P + Math.imul(Ne, Bt) | 0, E = E + Math.imul(De, q) | 0, v = v + Math.imul(De, W) | 0, v = v + Math.imul(Ce, q) | 0, P = P + Math.imul(Ce, W) | 0, E = E + Math.imul(ue, G) | 0, v = v + Math.imul(ue, j) | 0, v = v + Math.imul(ve, G) | 0, P = P + Math.imul(ve, j) | 0, E = E + Math.imul(re, de) | 0, v = v + Math.imul(re, xe) | 0, v = v + Math.imul(pe, de) | 0, P = P + Math.imul(pe, xe) | 0; var xt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, E = Math.imul(ke, gt), v = Math.imul(ke, Rt), v = v + Math.imul(Qe, gt) | 0, P = Math.imul(Qe, Rt), E = E + Math.imul(_e, vt) | 0, v = v + Math.imul(_e, $t) | 0, v = v + Math.imul(Ze, vt) | 0, P = P + Math.imul(Ze, $t) | 0, E = E + Math.imul(Le, rt) | 0, v = v + Math.imul(Le, Bt) | 0, v = v + Math.imul(qe, rt) | 0, P = P + Math.imul(qe, Bt) | 0, E = E + Math.imul(Me, q) | 0, v = v + Math.imul(Me, W) | 0, v = v + Math.imul(Ne, q) | 0, P = P + Math.imul(Ne, W) | 0, E = E + Math.imul(De, G) | 0, v = v + Math.imul(De, j) | 0, v = v + Math.imul(Ce, G) | 0, P = P + Math.imul(Ce, j) | 0, E = E + Math.imul(ue, he) | 0, v = v + Math.imul(ue, xe) | 0, v = v + Math.imul(ve, he) | 0, P = P + Math.imul(ve, xe) | 0; + _ = (P + (v >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, E = Math.imul(ke, gt), v = Math.imul(ke, Rt), v = v + Math.imul(Qe, gt) | 0, P = Math.imul(Qe, Rt), E = E + Math.imul(_e, vt) | 0, v = v + Math.imul(_e, $t) | 0, v = v + Math.imul(Ze, vt) | 0, P = P + Math.imul(Ze, $t) | 0, E = E + Math.imul(Le, rt) | 0, v = v + Math.imul(Le, Bt) | 0, v = v + Math.imul(qe, rt) | 0, P = P + Math.imul(qe, Bt) | 0, E = E + Math.imul(Me, q) | 0, v = v + Math.imul(Me, W) | 0, v = v + Math.imul(Ne, q) | 0, P = P + Math.imul(Ne, W) | 0, E = E + Math.imul(De, G) | 0, v = v + Math.imul(De, j) | 0, v = v + Math.imul(Ce, G) | 0, P = P + Math.imul(Ce, j) | 0, E = E + Math.imul(ue, de) | 0, v = v + Math.imul(ue, xe) | 0, v = v + Math.imul(ve, de) | 0, P = P + Math.imul(ve, xe) | 0; var st = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, E = Math.imul(ke, vt), v = Math.imul(ke, $t), v = v + Math.imul(Qe, vt) | 0, P = Math.imul(Qe, $t), E = E + Math.imul(_e, rt) | 0, v = v + Math.imul(_e, Bt) | 0, v = v + Math.imul(Ze, rt) | 0, P = P + Math.imul(Ze, Bt) | 0, E = E + Math.imul(Le, q) | 0, v = v + Math.imul(Le, W) | 0, v = v + Math.imul(qe, q) | 0, P = P + Math.imul(qe, W) | 0, E = E + Math.imul(Me, G) | 0, v = v + Math.imul(Me, j) | 0, v = v + Math.imul(Ne, G) | 0, P = P + Math.imul(Ne, j) | 0, E = E + Math.imul(De, he) | 0, v = v + Math.imul(De, xe) | 0, v = v + Math.imul(Ce, he) | 0, P = P + Math.imul(Ce, xe) | 0; + _ = (P + (v >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, E = Math.imul(ke, vt), v = Math.imul(ke, $t), v = v + Math.imul(Qe, vt) | 0, P = Math.imul(Qe, $t), E = E + Math.imul(_e, rt) | 0, v = v + Math.imul(_e, Bt) | 0, v = v + Math.imul(Ze, rt) | 0, P = P + Math.imul(Ze, Bt) | 0, E = E + Math.imul(Le, q) | 0, v = v + Math.imul(Le, W) | 0, v = v + Math.imul(qe, q) | 0, P = P + Math.imul(qe, W) | 0, E = E + Math.imul(Me, G) | 0, v = v + Math.imul(Me, j) | 0, v = v + Math.imul(Ne, G) | 0, P = P + Math.imul(Ne, j) | 0, E = E + Math.imul(De, de) | 0, v = v + Math.imul(De, xe) | 0, v = v + Math.imul(Ce, de) | 0, P = P + Math.imul(Ce, xe) | 0; var bt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, E = Math.imul(ke, rt), v = Math.imul(ke, Bt), v = v + Math.imul(Qe, rt) | 0, P = Math.imul(Qe, Bt), E = E + Math.imul(_e, q) | 0, v = v + Math.imul(_e, W) | 0, v = v + Math.imul(Ze, q) | 0, P = P + Math.imul(Ze, W) | 0, E = E + Math.imul(Le, G) | 0, v = v + Math.imul(Le, j) | 0, v = v + Math.imul(qe, G) | 0, P = P + Math.imul(qe, j) | 0, E = E + Math.imul(Me, he) | 0, v = v + Math.imul(Me, xe) | 0, v = v + Math.imul(Ne, he) | 0, P = P + Math.imul(Ne, xe) | 0; + _ = (P + (v >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, E = Math.imul(ke, rt), v = Math.imul(ke, Bt), v = v + Math.imul(Qe, rt) | 0, P = Math.imul(Qe, Bt), E = E + Math.imul(_e, q) | 0, v = v + Math.imul(_e, W) | 0, v = v + Math.imul(Ze, q) | 0, P = P + Math.imul(Ze, W) | 0, E = E + Math.imul(Le, G) | 0, v = v + Math.imul(Le, j) | 0, v = v + Math.imul(qe, G) | 0, P = P + Math.imul(qe, j) | 0, E = E + Math.imul(Me, de) | 0, v = v + Math.imul(Me, xe) | 0, v = v + Math.imul(Ne, de) | 0, P = P + Math.imul(Ne, xe) | 0; var ut = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, E = Math.imul(ke, q), v = Math.imul(ke, W), v = v + Math.imul(Qe, q) | 0, P = Math.imul(Qe, W), E = E + Math.imul(_e, G) | 0, v = v + Math.imul(_e, j) | 0, v = v + Math.imul(Ze, G) | 0, P = P + Math.imul(Ze, j) | 0, E = E + Math.imul(Le, he) | 0, v = v + Math.imul(Le, xe) | 0, v = v + Math.imul(qe, he) | 0, P = P + Math.imul(qe, xe) | 0; + _ = (P + (v >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, E = Math.imul(ke, q), v = Math.imul(ke, W), v = v + Math.imul(Qe, q) | 0, P = Math.imul(Qe, W), E = E + Math.imul(_e, G) | 0, v = v + Math.imul(_e, j) | 0, v = v + Math.imul(Ze, G) | 0, P = P + Math.imul(Ze, j) | 0, E = E + Math.imul(Le, de) | 0, v = v + Math.imul(Le, xe) | 0, v = v + Math.imul(qe, de) | 0, P = P + Math.imul(qe, xe) | 0; var ot = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, E = Math.imul(ke, G), v = Math.imul(ke, j), v = v + Math.imul(Qe, G) | 0, P = Math.imul(Qe, j), E = E + Math.imul(_e, he) | 0, v = v + Math.imul(_e, xe) | 0, v = v + Math.imul(Ze, he) | 0, P = P + Math.imul(Ze, xe) | 0; + _ = (P + (v >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, E = Math.imul(ke, G), v = Math.imul(ke, j), v = v + Math.imul(Qe, G) | 0, P = Math.imul(Qe, j), E = E + Math.imul(_e, de) | 0, v = v + Math.imul(_e, xe) | 0, v = v + Math.imul(Ze, de) | 0, P = P + Math.imul(Ze, xe) | 0; var Se = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, E = Math.imul(ke, he), v = Math.imul(ke, xe), v = v + Math.imul(Qe, he) | 0, P = Math.imul(Qe, xe); + _ = (P + (v >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, E = Math.imul(ke, de), v = Math.imul(ke, xe), v = v + Math.imul(Qe, de) | 0, P = Math.imul(Qe, xe); var Ae = (_ + E | 0) + ((v & 8191) << 13) | 0; return _ = (P + (v >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, x[0] = Te, x[1] = Re, x[2] = nt, x[3] = je, x[4] = pt, x[5] = it, x[6] = et, x[7] = St, x[8] = Tt, x[9] = At, x[10] = _t, x[11] = ht, x[12] = xt, x[13] = st, x[14] = bt, x[15] = ut, x[16] = ot, x[17] = Se, x[18] = Ae, _ !== 0 && (x[19] = _, f.length++), f; }; @@ -13647,30 +13647,30 @@ Qv.exports; } return f !== 0 ? m.words[b] = f : m.length--, m.strip(); } - function $(Y, S, m) { - var f = new B(); + function B(Y, S, m) { + var f = new $(); return f.mulp(Y, S, m); } s.prototype.mulTo = function(S, m) { var f, g = this.length + S.length; - return this.length === 10 && S.length === 10 ? f = N(this, S, m) : g < 63 ? f = M(this, S, m) : g < 1024 ? f = L(this, S, m) : f = $(this, S, m), f; + return this.length === 10 && S.length === 10 ? f = N(this, S, m) : g < 63 ? f = M(this, S, m) : g < 1024 ? f = L(this, S, m) : f = B(this, S, m), f; }; - function B(Y, S) { + function $(Y, S) { this.x = Y, this.y = S; } - B.prototype.makeRBT = function(S) { + $.prototype.makeRBT = function(S) { for (var m = new Array(S), f = s.prototype._countBits(S) - 1, g = 0; g < S; g++) m[g] = this.revBin(g, f, S); return m; - }, B.prototype.revBin = function(S, m, f) { + }, $.prototype.revBin = function(S, m, f) { if (S === 0 || S === f - 1) return S; for (var g = 0, b = 0; b < m; b++) g |= (S & 1) << m - b - 1, S >>= 1; return g; - }, B.prototype.permute = function(S, m, f, g, b, x) { + }, $.prototype.permute = function(S, m, f, g, b, x) { for (var _ = 0; _ < x; _++) g[_] = m[S[_]], b[_] = f[S[_]]; - }, B.prototype.transform = function(S, m, f, g, b, x) { + }, $.prototype.transform = function(S, m, f, g, b, x) { this.permute(x, S, m, f, g, b); for (var _ = 1; _ < b; _ <<= 1) for (var E = _ << 1, v = Math.cos(2 * Math.PI / E), P = Math.sin(2 * Math.PI / E), I = 0; I < b; I += E) @@ -13678,34 +13678,34 @@ Qv.exports; var oe = f[I + D], Z = g[I + D], J = f[I + D + _], Q = g[I + D + _], T = F * J - ce * Q; Q = F * Q + ce * J, J = T, f[I + D] = oe + J, g[I + D] = Z + Q, f[I + D + _] = oe - J, g[I + D + _] = Z - Q, D !== E && (T = v * F - P * ce, ce = v * ce + P * F, F = T); } - }, B.prototype.guessLen13b = function(S, m) { + }, $.prototype.guessLen13b = function(S, m) { var f = Math.max(m, S) | 1, g = f & 1, b = 0; for (f = f / 2 | 0; f; f = f >>> 1) b++; return 1 << b + 1 + g; - }, B.prototype.conjugate = function(S, m, f) { + }, $.prototype.conjugate = function(S, m, f) { if (!(f <= 1)) for (var g = 0; g < f / 2; g++) { var b = S[g]; S[g] = S[f - g - 1], S[f - g - 1] = b, b = m[g], m[g] = -m[f - g - 1], m[f - g - 1] = -b; } - }, B.prototype.normalize13b = function(S, m) { + }, $.prototype.normalize13b = function(S, m) { for (var f = 0, g = 0; g < m / 2; g++) { var b = Math.round(S[2 * g + 1] / m) * 8192 + Math.round(S[2 * g] / m) + f; S[g] = b & 67108863, b < 67108864 ? f = 0 : f = b / 67108864 | 0; } return S; - }, B.prototype.convert13b = function(S, m, f, g) { + }, $.prototype.convert13b = function(S, m, f, g) { for (var b = 0, x = 0; x < m; x++) b = b + (S[x] | 0), f[2 * x] = b & 8191, b = b >>> 13, f[2 * x + 1] = b & 8191, b = b >>> 13; for (x = 2 * m; x < g; ++x) f[x] = 0; n(b === 0), n((b & -8192) === 0); - }, B.prototype.stub = function(S) { + }, $.prototype.stub = function(S) { for (var m = new Array(S), f = 0; f < S; f++) m[f] = 0; return m; - }, B.prototype.mulp = function(S, m, f) { + }, $.prototype.mulp = function(S, m, f) { var g = 2 * this.guessLen13b(S.length, m.length), b = this.makeRBT(g), x = this.stub(g), _ = new Array(g), E = new Array(g), v = new Array(g), P = new Array(g), I = new Array(g), F = new Array(g), ce = f.words; ce.length = g, this.convert13b(S.words, S.length, _, g), this.convert13b(m.words, m.length, P, g), this.transform(_, x, E, v, g, b), this.transform(P, x, I, F, g, b); for (var D = 0; D < g; D++) { @@ -13718,7 +13718,7 @@ Qv.exports; return m.words = new Array(this.length + S.length), this.mulTo(S, m); }, s.prototype.mulf = function(S) { var m = new s(null); - return m.words = new Array(this.length + S.length), $(this, S, m); + return m.words = new Array(this.length + S.length), B(this, S, m); }, s.prototype.imul = function(S) { return this.clone().mulTo(S, this); }, s.prototype.imuln = function(S) { @@ -14310,8 +14310,8 @@ Qv.exports; return m._forceRed(this); }; })(t, gn); -})(Qv); -var zo = Qv.exports, eb = {}; +})(Zv); +var zo = Zv.exports, Qv = {}; (function(t) { var e = t; function r(s, o) { @@ -14349,9 +14349,9 @@ var zo = Qv.exports, eb = {}; e.toHex = i, e.encode = function(o, a) { return a === "hex" ? i(o) : o; }; -})(eb); +})(Qv); (function(t) { - var e = t, r = zo, n = wc, i = eb; + var e = t, r = zo, n = wc, i = Qv; e.assert = n, e.toArray = i.toArray, e.zero2 = i.zero2, e.toHex = i.toHex, e.encode = i.encode; function s(d, p, w) { var A = new Array(Math.max(d.bitLength(), w) + 1), M; @@ -14359,8 +14359,8 @@ var zo = Qv.exports, eb = {}; A[M] = 0; var N = 1 << p + 1, L = d.clone(); for (M = 0; M < A.length; M++) { - var $, B = L.andln(N - 1); - L.isOdd() ? (B > (N >> 1) - 1 ? $ = (N >> 1) - B : $ = B, L.isubn($)) : $ = 0, A[M] = $, L.iushrn(1); + var B, $ = L.andln(N - 1); + L.isOdd() ? ($ > (N >> 1) - 1 ? B = (N >> 1) - $ : B = $, L.isubn(B)) : B = 0, A[M] = B, L.iushrn(1); } return A; } @@ -14372,12 +14372,12 @@ var zo = Qv.exports, eb = {}; ]; d = d.clone(), p = p.clone(); for (var A = 0, M = 0, N; d.cmpn(-A) > 0 || p.cmpn(-M) > 0; ) { - var L = d.andln(3) + A & 3, $ = p.andln(3) + M & 3; - L === 3 && (L = -1), $ === 3 && ($ = -1); - var B; - L & 1 ? (N = d.andln(7) + A & 7, (N === 3 || N === 5) && $ === 2 ? B = -L : B = L) : B = 0, w[0].push(B); + var L = d.andln(3) + A & 3, B = p.andln(3) + M & 3; + L === 3 && (L = -1), B === 3 && (B = -1); + var $; + L & 1 ? (N = d.andln(7) + A & 7, (N === 3 || N === 5) && B === 2 ? $ = -L : $ = L) : $ = 0, w[0].push($); var H; - $ & 1 ? (N = p.andln(7) + M & 7, (N === 3 || N === 5) && L === 2 ? H = -$ : H = $) : H = 0, w[1].push(H), 2 * A === B + 1 && (A = 1 - A), 2 * M === H + 1 && (M = 1 - M), d.iushrn(1), p.iushrn(1); + B & 1 ? (N = p.andln(7) + M & 7, (N === 3 || N === 5) && L === 2 ? H = -B : H = B) : H = 0, w[1].push(H), 2 * A === $ + 1 && (A = 1 - A), 2 * M === H + 1 && (M = 1 - M), d.iushrn(1), p.iushrn(1); } return w; } @@ -14398,14 +14398,14 @@ var zo = Qv.exports, eb = {}; } e.intFromLE = l; })(Bi); -var tb = { exports: {} }, am; -tb.exports = function(e) { +var eb = { exports: {} }, am; +eb.exports = function(e) { return am || (am = new la(null)), am.generate(e); }; function la(t) { this.rand = t; } -tb.exports.Rand = la; +eb.exports.Rand = la; la.prototype.generate = function(e) { return this._rand(e); }; @@ -14428,15 +14428,15 @@ if (typeof self == "object") }); else try { - var Rx = Wl; - if (typeof Rx.randomBytes != "function") + var Tx = Wl; + if (typeof Tx.randomBytes != "function") throw new Error("Not supported"); la.prototype._rand = function(e) { - return Rx.randomBytes(e); + return Tx.randomBytes(e); }; } catch { } -var S8 = tb.exports, rb = {}, Wa = zo, Jl = Bi, s0 = Jl.getNAF, iq = Jl.getJSF, o0 = Jl.assert; +var E8 = eb.exports, tb = {}, Wa = zo, Jl = Bi, s0 = Jl.getNAF, iq = Jl.getJSF, o0 = Jl.assert; function Ca(t, e) { this.type = t, this.p = new Wa(e.p, 16), this.red = e.prime ? Wa.red(e.prime) : Wa.mont(this.p), this.zero = new Wa(0).toRed(this.red), this.one = new Wa(1).toRed(this.red), this.two = new Wa(2).toRed(this.red), this.n = e.n && new Wa(e.n, 16), this.g = e.g && this.pointFromJSON(e.g, e.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; var r = this.n && this.p.div(this.n); @@ -14504,7 +14504,7 @@ Ca.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 7 */ ]; r[M].y.cmp(r[N].y) === 0 ? (L[1] = r[M].add(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())) : r[M].y.cmp(r[N].y.redNeg()) === 0 ? (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].add(r[N].neg())) : (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())); - var $ = [ + var B = [ -3, /* -1 -1 */ -1, @@ -14523,10 +14523,10 @@ Ca.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 1 0 */ 3 /* 1 1 */ - ], B = iq(n[M], n[N]); - for (l = Math.max(B[0].length, l), u[M] = new Array(l), u[N] = new Array(l), p = 0; p < l; p++) { - var H = B[0][p] | 0, U = B[1][p] | 0; - u[M][p] = $[(H + 1) * 3 + (U + 1)], u[N][p] = 0, a[M] = L; + ], $ = iq(n[M], n[N]); + for (l = Math.max($[0].length, l), u[M] = new Array(l), u[N] = new Array(l), p = 0; p < l; p++) { + var H = $[0][p] | 0, U = $[1][p] | 0; + u[M][p] = B[(H + 1) * 3 + (U + 1)], u[N][p] = 0, a[M] = L; } } var V = this.jpoint(null, null, null), te = this._wnafT4; @@ -14631,11 +14631,11 @@ ss.prototype.dblp = function(e) { r = r.dbl(); return r; }; -var sq = Bi, rn = zo, nb = z0, Fu = G0, oq = sq.assert; +var sq = Bi, rn = zo, rb = z0, Fu = G0, oq = sq.assert; function os(t) { Fu.call(this, "short", t), this.a = new rn(t.a, 16).toRed(this.red), this.b = new rn(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); } -nb(os, Fu); +rb(os, Fu); var aq = os; os.prototype._getEndomorphism = function(e) { if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { @@ -14670,17 +14670,17 @@ os.prototype._getEndoRoots = function(e) { return [o, a]; }; os.prototype._getEndoBasis = function(e) { - for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new rn(1), o = new rn(0), a = new rn(0), u = new rn(1), l, d, p, w, A, M, N, L = 0, $, B; n.cmpn(0) !== 0; ) { + for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new rn(1), o = new rn(0), a = new rn(0), u = new rn(1), l, d, p, w, A, M, N, L = 0, B, $; n.cmpn(0) !== 0; ) { var H = i.div(n); - $ = i.sub(H.mul(n)), B = a.sub(H.mul(s)); + B = i.sub(H.mul(n)), $ = a.sub(H.mul(s)); var U = u.sub(H.mul(o)); - if (!p && $.cmp(r) < 0) - l = N.neg(), d = s, p = $.neg(), w = B; + if (!p && B.cmp(r) < 0) + l = N.neg(), d = s, p = B.neg(), w = $; else if (p && ++L === 2) break; - N = $, i = n, n = $, a = s, s = B, u = o, o = U; + N = B, i = n, n = B, a = s, s = $, u = o, o = U; } - A = $.neg(), M = B; + A = B.neg(), M = $; var V = p.sqr().add(w.sqr()), te = A.sqr().add(M.sqr()); return te.cmp(V) >= 0 && (A = l, M = d), p.negative && (p = p.neg(), w = w.neg()), A.negative && (A = A.neg(), M = M.neg()), [ { a: p, b: w }, @@ -14717,7 +14717,7 @@ os.prototype._endoWnafMulAdd = function(e, r, n) { function $n(t, e, r, n) { Fu.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new rn(e, 16), this.y = new rn(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); } -nb($n, Fu.BasePoint); +rb($n, Fu.BasePoint); os.prototype.point = function(e, r, n) { return new $n(this, e, r, n); }; @@ -14863,7 +14863,7 @@ $n.prototype.toJ = function() { function Wn(t, e, r, n) { Fu.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new rn(0)) : (this.x = new rn(e, 16), this.y = new rn(r, 16), this.z = new rn(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; } -nb(Wn, Fu.BasePoint); +rb(Wn, Fu.BasePoint); os.prototype.jpoint = function(e, r, n) { return new Wn(this, e, r, n); }; @@ -14914,10 +14914,10 @@ Wn.prototype.dblp = function(e) { } var i = this.curve.a, s = this.curve.tinv, o = this.x, a = this.y, u = this.z, l = u.redSqr().redSqr(), d = a.redAdd(a); for (r = 0; r < e; r++) { - var p = o.redSqr(), w = d.redSqr(), A = w.redSqr(), M = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), N = o.redMul(w), L = M.redSqr().redISub(N.redAdd(N)), $ = N.redISub(L), B = M.redMul($); - B = B.redIAdd(B).redISub(A); + var p = o.redSqr(), w = d.redSqr(), A = w.redSqr(), M = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), N = o.redMul(w), L = M.redSqr().redISub(N.redAdd(N)), B = N.redISub(L), $ = M.redMul(B); + $ = $.redIAdd($).redISub(A); var H = d.redMul(u); - r + 1 < e && (l = l.redMul(A)), o = L, u = H, d = B; + r + 1 < e && (l = l.redMul(A)), o = L, u = H, d = $; } return this.curve.jpoint(o, d.redMul(s), u); }; @@ -14934,8 +14934,8 @@ Wn.prototype._zeroDbl = function() { } else { var p = this.x.redSqr(), w = this.y.redSqr(), A = w.redSqr(), M = this.x.redAdd(w).redSqr().redISub(p).redISub(A); M = M.redIAdd(M); - var N = p.redAdd(p).redIAdd(p), L = N.redSqr(), $ = A.redIAdd(A); - $ = $.redIAdd($), $ = $.redIAdd($), e = L.redISub(M).redISub(M), r = N.redMul(M.redISub(e)).redISub($), n = this.y.redMul(this.z), n = n.redIAdd(n); + var N = p.redAdd(p).redIAdd(p), L = N.redSqr(), B = A.redIAdd(A); + B = B.redIAdd(B), B = B.redIAdd(B), e = L.redISub(M).redISub(M), r = N.redMul(M.redISub(e)).redISub(B), n = this.y.redMul(this.z), n = n.redIAdd(n); } return this.curve.jpoint(e, r, n); }; @@ -14955,8 +14955,8 @@ Wn.prototype._threeDbl = function() { N = N.redIAdd(N); var L = N.redAdd(N); e = M.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(p); - var $ = w.redSqr(); - $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($), r = M.redMul(N.redISub(e)).redISub($); + var B = w.redSqr(); + B = B.redIAdd(B), B = B.redIAdd(B), B = B.redIAdd(B), r = M.redMul(N.redISub(e)).redISub(B); } return this.curve.jpoint(e, r, n); }; @@ -15015,11 +15015,11 @@ Wn.prototype.inspect = function() { Wn.prototype.isInfinity = function() { return this.z.cmpn(0) === 0; }; -var Qc = zo, A8 = z0, Y0 = G0, cq = Bi; +var Qc = zo, S8 = z0, Y0 = G0, cq = Bi; function ju(t) { Y0.call(this, "mont", t), this.a = new Qc(t.a, 16).toRed(this.red), this.b = new Qc(t.b, 16).toRed(this.red), this.i4 = new Qc(4).toRed(this.red).redInvm(), this.two = new Qc(2).toRed(this.red), this.a24 = this.i4.redMul(this.a.redAdd(this.two)); } -A8(ju, Y0); +S8(ju, Y0); var uq = ju; ju.prototype.validate = function(e) { var r = e.normalize().x, n = r.redSqr(), i = n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r), s = i.redSqrt(); @@ -15028,7 +15028,7 @@ ju.prototype.validate = function(e) { function Ln(t, e, r) { Y0.BasePoint.call(this, t, "projective"), e === null && r === null ? (this.x = this.curve.one, this.z = this.curve.zero) : (this.x = new Qc(e, 16), this.z = new Qc(r, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red))); } -A8(Ln, Y0.BasePoint); +S8(Ln, Y0.BasePoint); ju.prototype.decodePoint = function(e, r) { return this.point(cq.toArray(e, r), 1); }; @@ -15085,11 +15085,11 @@ Ln.prototype.normalize = function() { Ln.prototype.getX = function() { return this.normalize(), this.x.fromRed(); }; -var fq = Bi, So = zo, P8 = z0, J0 = G0, lq = fq.assert; +var fq = Bi, So = zo, A8 = z0, J0 = G0, lq = fq.assert; function no(t) { this.twisted = (t.a | 0) !== 1, this.mOneA = this.twisted && (t.a | 0) === -1, this.extended = this.mOneA, J0.call(this, "edwards", t), this.a = new So(t.a, 16).umod(this.red.m), this.a = this.a.toRed(this.red), this.c = new So(t.c, 16).toRed(this.red), this.c2 = this.c.redSqr(), this.d = new So(t.d, 16).toRed(this.red), this.dd = this.d.redAdd(this.d), lq(!this.twisted || this.c.fromRed().cmpn(1) === 0), this.oneC = (t.c | 0) === 1; } -P8(no, J0); +A8(no, J0); var hq = no; no.prototype._mulA = function(e) { return this.mOneA ? e.redNeg() : this.a.redMul(e); @@ -15131,7 +15131,7 @@ no.prototype.validate = function(e) { function Hr(t, e, r, n, i) { J0.BasePoint.call(this, t, "projective"), e === null && r === null && n === null ? (this.x = this.curve.zero, this.y = this.curve.one, this.z = this.curve.one, this.t = this.curve.zero, this.zOne = !0) : (this.x = new So(e, 16), this.y = new So(r, 16), this.z = n ? new So(n, 16) : this.curve.one, this.t = i && new So(i, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.t && !this.t.red && (this.t = this.t.toRed(this.curve.red)), this.zOne = this.z === this.curve.one, this.curve.extended && !this.t && (this.t = this.x.redMul(this.y), this.zOne || (this.t = this.t.redMul(this.z.redInvm())))); } -P8(Hr, J0.BasePoint); +A8(Hr, J0.BasePoint); no.prototype.pointFromJSON = function(e) { return Hr.fromJSON(this, e); }; @@ -15225,10 +15225,10 @@ Hr.prototype.mixedAdd = Hr.prototype.add; (function(t) { var e = t; e.base = G0, e.short = aq, e.mont = uq, e.edwards = hq; -})(rb); -var X0 = {}, cm, Dx; +})(tb); +var X0 = {}, cm, Rx; function dq() { - return Dx || (Dx = 1, cm = { + return Rx || (Rx = 1, cm = { doubles: { step: 4, points: [ @@ -16010,7 +16010,7 @@ function dq() { }), cm; } (function(t) { - var e = t, r = Vl, n = rb, i = Bi, s = i.assert; + var e = t, r = Vl, n = tb, i = Bi, s = i.assert; function o(l) { l.type === "short" ? this.curve = new n.short(l) : l.type === "edwards" ? this.curve = new n.edwards(l) : this.curve = new n.mont(l), this.g = this.curve.g, this.n = this.curve.n, this.hash = l.hash, s(this.g.validate(), "Invalid curve"), s(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); } @@ -16159,13 +16159,13 @@ function dq() { ] }); })(X0); -var pq = Vl, oc = eb, M8 = wc; +var pq = Vl, oc = Qv, P8 = wc; function ya(t) { if (!(this instanceof ya)) return new ya(t); this.hash = t.hash, this.predResist = !!t.predResist, this.outLen = this.hash.outSize, this.minEntropy = t.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null; var e = oc.toArray(t.entropy, t.entropyEnc || "hex"), r = oc.toArray(t.nonce, t.nonceEnc || "hex"), n = oc.toArray(t.pers, t.persEnc || "hex"); - M8( + P8( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._init(e, r, n); @@ -16186,7 +16186,7 @@ ya.prototype._update = function(e) { e && (r = r.update(e)), this.K = r.digest(), this.V = this._hmac().update(this.V).digest(), e && (this.K = this._hmac().update(this.V).update([1]).update(e).digest(), this.V = this._hmac().update(this.V).digest()); }; ya.prototype.reseed = function(e, r, n, i) { - typeof r != "string" && (i = n, n = r, r = null), e = oc.toArray(e, r), n = oc.toArray(n, i), M8( + typeof r != "string" && (i = n, n = r, r = null), e = oc.toArray(e, r), n = oc.toArray(n, i), P8( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._update(e.concat(n || [])), this._reseed = 1; @@ -16249,7 +16249,7 @@ ei.prototype.verify = function(e, r, n) { ei.prototype.inspect = function() { return ""; }; -var a0 = zo, ib = Bi, yq = ib.assert; +var a0 = zo, nb = Bi, yq = nb.assert; function Z0(t, e) { if (t instanceof Z0) return t; @@ -16270,13 +16270,13 @@ function um(t, e) { i <<= 8, i |= t[o], i >>>= 0; return i <= 127 ? !1 : (e.place = o, i); } -function Ox(t) { +function Dx(t) { for (var e = 0, r = t.length - 1; !t[e] && !(t[e + 1] & 128) && e < r; ) e++; return e === 0 ? t : t.slice(e); } Z0.prototype._importDER = function(e, r) { - e = ib.toArray(e, r); + e = nb.toArray(e, r); var n = new xq(); if (e[n.place++] !== 48) return !1; @@ -16317,35 +16317,35 @@ function fm(t, e) { } Z0.prototype.toDER = function(e) { var r = this.r.toArray(), n = this.s.toArray(); - for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Ox(r), n = Ox(n); !n[0] && !(n[1] & 128); ) + for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Dx(r), n = Dx(n); !n[0] && !(n[1] & 128); ) n = n.slice(1); var i = [2]; fm(i, r.length), i = i.concat(r), i.push(2), fm(i, n.length); var s = i.concat(n), o = [48]; - return fm(o, s.length), o = o.concat(s), ib.encode(o, e); + return fm(o, s.length), o = o.concat(s), nb.encode(o, e); }; -var Ao = zo, I8 = gq, _q = Bi, lm = X0, Eq = S8, C8 = _q.assert, sb = bq, Q0 = wq; +var Ao = zo, M8 = gq, _q = Bi, lm = X0, Eq = E8, I8 = _q.assert, ib = bq, Q0 = wq; function es(t) { if (!(this instanceof es)) return new es(t); - typeof t == "string" && (C8( + typeof t == "string" && (I8( Object.prototype.hasOwnProperty.call(lm, t), "Unknown curve " + t ), t = lm[t]), t instanceof lm.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; } var Sq = es; es.prototype.keyPair = function(e) { - return new sb(this, e); + return new ib(this, e); }; es.prototype.keyFromPrivate = function(e, r) { - return sb.fromPrivate(this, e, r); + return ib.fromPrivate(this, e, r); }; es.prototype.keyFromPublic = function(e, r) { - return sb.fromPublic(this, e, r); + return ib.fromPublic(this, e, r); }; es.prototype.genKeyPair = function(e) { e || (e = {}); - for (var r = new I8({ + for (var r = new M8({ hash: this.hash, pers: e.pers, persEnc: e.persEnc || "utf8", @@ -16374,7 +16374,7 @@ es.prototype._truncateToN = function(e, r, n) { }; es.prototype.sign = function(e, r, n, i) { typeof n == "object" && (i = n, n = null), i || (i = {}), r = this.keyFromPrivate(r, n), e = this._truncateToN(e, !1, i.msgBitLength); - for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new I8({ + for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new M8({ hash: this.hash, entropy: o, nonce: a, @@ -16406,7 +16406,7 @@ es.prototype.verify = function(e, r, n, i, s) { return this.curve._maxwellTrick ? (p = this.g.jmulAdd(l, n.getPublic(), d), p.isInfinity() ? !1 : p.eqXToP(o)) : (p = this.g.mulAdd(l, n.getPublic(), d), p.isInfinity() ? !1 : p.getX().umod(this.n).cmp(o) === 0); }; es.prototype.recoverPubKey = function(t, e, r, n) { - C8((3 & r) === r, "The recovery param is more than two bits"), e = new Q0(e, n); + I8((3 & r) === r, "The recovery param is more than two bits"), e = new Q0(e, n); var i = this.n, s = new Ao(t), o = e.r, a = e.s, u = r & 1, l = r >> 1; if (o.cmp(this.curve.p.umod(this.curve.n)) >= 0 && l) throw new Error("Unable to find sencond key candinate"); @@ -16429,9 +16429,9 @@ es.prototype.getKeyRecoveryParam = function(t, e, r, n) { } throw new Error("Unable to find valid recovery factor"); }; -var Xl = Bi, T8 = Xl.assert, Nx = Xl.parseBytes, Uu = Xl.cachedProperty; +var Xl = Bi, C8 = Xl.assert, Ox = Xl.parseBytes, Uu = Xl.cachedProperty; function Nn(t, e) { - this.eddsa = t, this._secret = Nx(e.secret), t.isPoint(e.pub) ? this._pub = e.pub : this._pubBytes = Nx(e.pub); + this.eddsa = t, this._secret = Ox(e.secret), t.isPoint(e.pub) ? this._pub = e.pub : this._pubBytes = Ox(e.pub); } Nn.fromPublic = function(e, r) { return r instanceof Nn ? r : new Nn(e, { pub: r }); @@ -16462,23 +16462,23 @@ Uu(Nn, "messagePrefix", function() { return this.hash().slice(this.eddsa.encodingLength); }); Nn.prototype.sign = function(e) { - return T8(this._secret, "KeyPair can only verify"), this.eddsa.sign(e, this); + return C8(this._secret, "KeyPair can only verify"), this.eddsa.sign(e, this); }; Nn.prototype.verify = function(e, r) { return this.eddsa.verify(e, r, this); }; Nn.prototype.getSecret = function(e) { - return T8(this._secret, "KeyPair is public only"), Xl.encode(this.secret(), e); + return C8(this._secret, "KeyPair is public only"), Xl.encode(this.secret(), e); }; Nn.prototype.getPublic = function(e) { return Xl.encode(this.pubBytes(), e); }; -var Aq = Nn, Pq = zo, ep = Bi, Lx = ep.assert, tp = ep.cachedProperty, Mq = ep.parseBytes; +var Aq = Nn, Pq = zo, ep = Bi, Nx = ep.assert, tp = ep.cachedProperty, Mq = ep.parseBytes; function _c(t, e) { - this.eddsa = t, typeof e != "object" && (e = Mq(e)), Array.isArray(e) && (Lx(e.length === t.encodingLength * 2, "Signature has invalid size"), e = { + this.eddsa = t, typeof e != "object" && (e = Mq(e)), Array.isArray(e) && (Nx(e.length === t.encodingLength * 2, "Signature has invalid size"), e = { R: e.slice(0, t.encodingLength), S: e.slice(t.encodingLength) - }), Lx(e.R && e.S, "Signature without R or S"), t.isPoint(e.R) && (this._R = e.R), e.S instanceof Pq && (this._S = e.S), this._Rencoded = Array.isArray(e.R) ? e.R : e.Rencoded, this._Sencoded = Array.isArray(e.S) ? e.S : e.Sencoded; + }), Nx(e.R && e.S, "Signature without R or S"), t.isPoint(e.R) && (this._R = e.R), e.S instanceof Pq && (this._S = e.S), this._Rencoded = Array.isArray(e.R) ? e.R : e.Rencoded, this._Sencoded = Array.isArray(e.S) ? e.S : e.Sencoded; } tp(_c, "S", function() { return this.eddsa.decodeInt(this.Sencoded()); @@ -16498,7 +16498,7 @@ _c.prototype.toBytes = function() { _c.prototype.toHex = function() { return ep.encode(this.toBytes(), "hex").toUpperCase(); }; -var Iq = _c, Cq = Vl, Tq = X0, Au = Bi, Rq = Au.assert, R8 = Au.parseBytes, D8 = Aq, kx = Iq; +var Iq = _c, Cq = Vl, Tq = X0, Au = Bi, Rq = Au.assert, T8 = Au.parseBytes, R8 = Aq, Lx = Iq; function Ei(t) { if (Rq(t === "ed25519", "only tested with ed25519 so far"), !(this instanceof Ei)) return new Ei(t); @@ -16506,12 +16506,12 @@ function Ei(t) { } var Dq = Ei; Ei.prototype.sign = function(e, r) { - e = R8(e); + e = T8(e); var n = this.keyFromSecret(r), i = this.hashInt(n.messagePrefix(), e), s = this.g.mul(i), o = this.encodePoint(s), a = this.hashInt(o, n.pubBytes(), e).mul(n.priv()), u = i.add(a).umod(this.curve.n); return this.makeSignature({ R: s, S: u, Rencoded: o }); }; Ei.prototype.verify = function(e, r, n) { - if (e = R8(e), r = this.makeSignature(r), r.S().gte(r.eddsa.curve.n) || r.S().isNeg()) + if (e = T8(e), r = this.makeSignature(r), r.S().gte(r.eddsa.curve.n) || r.S().isNeg()) return !1; var i = this.keyFromPublic(n), s = this.hashInt(r.Rencoded(), i.pubBytes(), e), o = this.g.mul(r.S()), a = r.R().add(i.pub().mul(s)); return a.eq(o); @@ -16522,13 +16522,13 @@ Ei.prototype.hashInt = function() { return Au.intFromLE(e.digest()).umod(this.curve.n); }; Ei.prototype.keyFromPublic = function(e) { - return D8.fromPublic(this, e); + return R8.fromPublic(this, e); }; Ei.prototype.keyFromSecret = function(e) { - return D8.fromSecret(this, e); + return R8.fromSecret(this, e); }; Ei.prototype.makeSignature = function(e) { - return e instanceof kx ? e : new kx(this, e); + return e instanceof Lx ? e : new Lx(this, e); }; Ei.prototype.encodePoint = function(e) { var r = e.getY().toArray("le", this.encodingLength); @@ -16550,19 +16550,19 @@ Ei.prototype.isPoint = function(e) { }; (function(t) { var e = t; - e.version = nq.version, e.utils = Bi, e.rand = S8, e.curve = rb, e.curves = X0, e.ec = Sq, e.eddsa = Dq; -})(E8); + e.version = nq.version, e.utils = Bi, e.rand = E8, e.curve = tb, e.curves = X0, e.ec = Sq, e.eddsa = Dq; +})(_8); const Oq = { waku: { publish: "waku_publish", batchPublish: "waku_batchPublish", subscribe: "waku_subscribe", batchSubscribe: "waku_batchSubscribe", subscription: "waku_subscription", unsubscribe: "waku_unsubscribe", batchUnsubscribe: "waku_batchUnsubscribe", batchFetchMessages: "waku_batchFetchMessages" }, irn: { publish: "irn_publish", batchPublish: "irn_batchPublish", subscribe: "irn_subscribe", batchSubscribe: "irn_batchSubscribe", subscription: "irn_subscription", unsubscribe: "irn_unsubscribe", batchUnsubscribe: "irn_batchUnsubscribe", batchFetchMessages: "irn_batchFetchMessages" }, iridium: { publish: "iridium_publish", batchPublish: "iridium_batchPublish", subscribe: "iridium_subscribe", batchSubscribe: "iridium_batchSubscribe", subscription: "iridium_subscription", unsubscribe: "iridium_unsubscribe", batchUnsubscribe: "iridium_batchUnsubscribe", batchFetchMessages: "iridium_batchFetchMessages" } }, Nq = ":"; function hu(t) { const [e, r] = t.split(Nq); return { namespace: e, reference: r }; } -function O8(t, e) { +function D8(t, e) { return t.includes(":") ? [t] : e.chains || []; } -var Lq = Object.defineProperty, $x = Object.getOwnPropertySymbols, kq = Object.prototype.hasOwnProperty, $q = Object.prototype.propertyIsEnumerable, Bx = (t, e, r) => e in t ? Lq(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Fx = (t, e) => { - for (var r in e || (e = {})) kq.call(e, r) && Bx(t, r, e[r]); - if ($x) for (var r of $x(e)) $q.call(e, r) && Bx(t, r, e[r]); +var Lq = Object.defineProperty, kx = Object.getOwnPropertySymbols, kq = Object.prototype.hasOwnProperty, $q = Object.prototype.propertyIsEnumerable, $x = (t, e, r) => e in t ? Lq(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Bx = (t, e) => { + for (var r in e || (e = {})) kq.call(e, r) && $x(t, r, e[r]); + if (kx) for (var r of kx(e)) $q.call(e, r) && $x(t, r, e[r]); return t; }; const Bq = "ReactNative", Di = { reactNative: "react-native", node: "node", browser: "browser", unknown: "unknown" }, Fq = "js"; @@ -16570,10 +16570,10 @@ function c0() { return typeof process < "u" && typeof process.versions < "u" && typeof process.versions.node < "u"; } function qu() { - return !Kl() && !!Uv() && navigator.product === Bq; + return !Kl() && !!jv() && navigator.product === Bq; } function Zl() { - return !c0() && !!Uv() && !!Kl(); + return !c0() && !!jv() && !!Kl(); } function Ql() { return qu() ? Di.reactNative : c0() ? Di.node : Zl() ? Di.browser : Di.unknown; @@ -16588,10 +16588,10 @@ function jq() { } function Uq(t, e) { let r = xl.parse(t); - return r = Fx(Fx({}, r), e), t = xl.stringify(r), t; + return r = Bx(Bx({}, r), e), t = xl.stringify(r), t; } -function N8() { - return W4() || { name: "", description: "", url: "", icons: [""] }; +function O8() { + return z4() || { name: "", description: "", url: "", icons: [""] }; } function qq() { if (Ql() === Di.reactNative && typeof global < "u" && typeof (global == null ? void 0 : global.Platform) < "u") { @@ -16606,23 +16606,23 @@ function qq() { function zq() { var t; const e = Ql(); - return e === Di.browser ? [e, ((t = z4()) == null ? void 0 : t.host) || "unknown"].join(":") : e; + return e === Di.browser ? [e, ((t = q4()) == null ? void 0 : t.host) || "unknown"].join(":") : e; } -function L8(t, e, r) { +function N8(t, e, r) { const n = qq(), i = zq(); return [[t, e].join("-"), [Fq, r].join("-"), n, i].join("/"); } function Wq({ protocol: t, version: e, relayUrl: r, sdkVersion: n, auth: i, projectId: s, useOnCloseEvent: o, bundleId: a }) { - const u = r.split("?"), l = L8(t, e, n), d = { auth: i, ua: l, projectId: s, useOnCloseEvent: o, origin: a || void 0 }, p = Uq(u[1] || "", d); + const u = r.split("?"), l = N8(t, e, n), d = { auth: i, ua: l, projectId: s, useOnCloseEvent: o, origin: a || void 0 }, p = Uq(u[1] || "", d); return u[0] + "?" + p; } function rc(t, e) { return t.filter((r) => e.includes(r)).length === t.length; } -function k8(t) { +function L8(t) { return Object.fromEntries(t.entries()); } -function $8(t) { +function k8(t) { return new Map(Object.entries(t)); } function Ga(t = mt.FIVE_MINUTES, e) { @@ -16650,7 +16650,7 @@ function du(t, e, r) { clearTimeout(s); }); } -function B8(t, e) { +function $8(t, e) { if (typeof e == "string" && e.startsWith(`${t}:`)) return e; if (t.toLowerCase() === "topic") { if (typeof e != "string") throw new Error('Value must be "string" for expirer target type: topic'); @@ -16662,12 +16662,12 @@ function B8(t, e) { throw new Error(`Unknown expirer target type: ${t}`); } function Hq(t) { - return B8("topic", t); + return $8("topic", t); } function Kq(t) { - return B8("id", t); + return $8("id", t); } -function F8(t) { +function B8(t) { const [e, r] = t.split(":"), n = { id: void 0, topic: void 0 }; if (e === "topic" && typeof r == "string") n.topic = r; else if (e === "id" && Number.isInteger(Number(r))) n.id = Number(r); @@ -16724,18 +16724,18 @@ async function Yq(t, e) { } return r; } -function jx(t, e) { +function Fx(t, e) { if (!t.includes(e)) return null; const r = t.split(/([&,?,=])/), n = r.indexOf(e); return r[n + 2]; } -function Ux() { +function jx() { return typeof crypto < "u" && crypto != null && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu, (t) => { const e = Math.random() * 16 | 0; return (t === "x" ? e : e & 3 | 8).toString(16); }); } -function ob() { +function sb() { return typeof process < "u" && process.env.IS_VITEST === "true"; } function Jq() { @@ -16745,7 +16745,7 @@ function Xq(t, e = !1) { const r = Buffer.from(t).toString("base64"); return e ? r.replace(/[=]/g, "") : r; } -function j8(t) { +function F8(t) { return Buffer.from(t, "base64").toString("utf-8"); } const Zq = "https://rpc.walletconnect.org/v1"; @@ -16760,13 +16760,13 @@ async function Qq(t, e, r, n, i, s) { } } function ez(t, e, r) { - return CU(Y4(e), r).toLowerCase() === t.toLowerCase(); + return CU(G4(e), r).toLowerCase() === t.toLowerCase(); } async function tz(t, e, r, n, i, s) { const o = hu(n); if (!o.namespace || !o.reference) throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`); try { - const a = "0x1626ba7e", u = "0000000000000000000000000000000000000000000000000000000000000040", l = "0000000000000000000000000000000000000000000000000000000000000041", d = r.substring(2), p = Y4(e).substring(2), w = a + p + u + l + d, A = await fetch(`${s || Zq}/?chainId=${n}&projectId=${i}`, { method: "POST", body: JSON.stringify({ id: rz(), jsonrpc: "2.0", method: "eth_call", params: [{ to: t, data: w }, "latest"] }) }), { result: M } = await A.json(); + const a = "0x1626ba7e", u = "0000000000000000000000000000000000000000000000000000000000000040", l = "0000000000000000000000000000000000000000000000000000000000000041", d = r.substring(2), p = G4(e).substring(2), w = a + p + u + l + d, A = await fetch(`${s || Zq}/?chainId=${n}&projectId=${i}`, { method: "POST", body: JSON.stringify({ id: rz(), jsonrpc: "2.0", method: "eth_call", params: [{ to: t, data: w }, "latest"] }) }), { result: M } = await A.json(); return M ? M.slice(0, a.length).toLowerCase() === a.toLowerCase() : !1; } catch (a) { return console.error("isValidEip1271Signature: ", a), !1; @@ -16775,26 +16775,26 @@ async function tz(t, e, r, n, i, s) { function rz() { return Date.now() + Math.floor(Math.random() * 1e3); } -var nz = Object.defineProperty, iz = Object.defineProperties, sz = Object.getOwnPropertyDescriptors, qx = Object.getOwnPropertySymbols, oz = Object.prototype.hasOwnProperty, az = Object.prototype.propertyIsEnumerable, zx = (t, e, r) => e in t ? nz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, cz = (t, e) => { - for (var r in e || (e = {})) oz.call(e, r) && zx(t, r, e[r]); - if (qx) for (var r of qx(e)) az.call(e, r) && zx(t, r, e[r]); +var nz = Object.defineProperty, iz = Object.defineProperties, sz = Object.getOwnPropertyDescriptors, Ux = Object.getOwnPropertySymbols, oz = Object.prototype.hasOwnProperty, az = Object.prototype.propertyIsEnumerable, qx = (t, e, r) => e in t ? nz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, cz = (t, e) => { + for (var r in e || (e = {})) oz.call(e, r) && qx(t, r, e[r]); + if (Ux) for (var r of Ux(e)) az.call(e, r) && qx(t, r, e[r]); return t; }, uz = (t, e) => iz(t, sz(e)); -const fz = "did:pkh:", ab = (t) => t == null ? void 0 : t.split(":"), lz = (t) => { - const e = t && ab(t); +const fz = "did:pkh:", ob = (t) => t == null ? void 0 : t.split(":"), lz = (t) => { + const e = t && ob(t); if (e) return t.includes(fz) ? e[3] : e[1]; }, M1 = (t) => { - const e = t && ab(t); + const e = t && ob(t); if (e) return e[2] + ":" + e[3]; }, u0 = (t) => { - const e = t && ab(t); + const e = t && ob(t); if (e) return e.pop(); }; -async function Wx(t) { - const { cacao: e, projectId: r } = t, { s: n, p: i } = e, s = U8(i, i.iss), o = u0(i.iss); +async function zx(t) { + const { cacao: e, projectId: r } = t, { s: n, p: i } = e, s = j8(i, i.iss), o = u0(i.iss); return await Qq(o, s, n, M1(i.iss), r); } -const U8 = (t, e) => { +const j8 = (t, e) => { const r = `${t.domain} wants you to sign in with your Ethereum account:`, n = u0(e); if (!t.aud && !t.uri) throw new Error("Either `aud` or `uri` is required to construct the message"); let i = t.statement || void 0; @@ -16841,7 +16841,7 @@ function gz(t, e, r = {}) { const n = e.map((i) => ({ [`${t}/${i}`]: [r] })); return Object.assign({}, ...n); } -function q8(t) { +function U8(t) { return hc(t), `urn:recap:${hz(t).replace(/=/g, "")}`; } function _l(t) { @@ -16850,14 +16850,14 @@ function _l(t) { } function mz(t, e, r) { const n = pz(t, e, r); - return q8(n); + return U8(n); } function vz(t) { return t && t.includes("urn:recap:"); } function bz(t, e) { const r = _l(t), n = _l(e), i = yz(r, n); - return q8(i); + return U8(i); } function yz(t, e) { hc(t), hc(e); @@ -16889,14 +16889,14 @@ function wz(t = "", e) { const s = n.join(" "), o = `${r}${s}`; return `${t ? t + " " : ""}${o}`; } -function Hx(t) { +function Wx(t) { var e; const r = _l(t); hc(r); const n = (e = r.att) == null ? void 0 : e.eip155; return n ? Object.keys(n).map((i) => i.split("/")[1]) : []; } -function Kx(t) { +function Hx(t) { const e = _l(t); hc(e); const r = []; @@ -16912,17 +16912,17 @@ function Cd(t) { const e = t == null ? void 0 : t[t.length - 1]; return vz(e) ? e : void 0; } -const z8 = "base10", ai = "base16", ha = "base64pad", Af = "base64url", eh = "utf8", W8 = 0, Co = 1, th = 2, xz = 0, Vx = 1, qf = 12, cb = 32; +const q8 = "base10", ai = "base16", ha = "base64pad", Af = "base64url", eh = "utf8", z8 = 0, Co = 1, th = 2, xz = 0, Kx = 1, qf = 12, ab = 32; function _z() { - const t = Zv.generateKeyPair(); + const t = Xv.generateKeyPair(); return { privateKey: On(t.secretKey, ai), publicKey: On(t.publicKey, ai) }; } function I1() { - const t = Pa.randomBytes(cb); + const t = Pa.randomBytes(ab); return On(t, ai); } function Ez(t, e) { - const r = Zv.sharedKey(Rn(t, ai), Rn(e, ai), !0), n = new qU(Yl.SHA256, r).expand(cb); + const r = Xv.sharedKey(Rn(t, ai), Rn(e, ai), !0), n = new qU(Yl.SHA256, r).expand(ab); return On(n, ai); } function Td(t) { @@ -16933,24 +16933,24 @@ function xo(t) { const e = Yl.hash(Rn(t, eh)); return On(e, ai); } -function H8(t) { - return Rn(`${t}`, z8); +function W8(t) { + return Rn(`${t}`, q8); } function dc(t) { - return Number(On(t, z8)); + return Number(On(t, q8)); } function Sz(t) { - const e = H8(typeof t.type < "u" ? t.type : W8); + const e = W8(typeof t.type < "u" ? t.type : z8); if (dc(e) === Co && typeof t.senderPublicKey > "u") throw new Error("Missing sender public key for type 1 envelope"); - const r = typeof t.senderPublicKey < "u" ? Rn(t.senderPublicKey, ai) : void 0, n = typeof t.iv < "u" ? Rn(t.iv, ai) : Pa.randomBytes(qf), i = new Jv.ChaCha20Poly1305(Rn(t.symKey, ai)).seal(n, Rn(t.message, eh)); - return K8({ type: e, sealed: i, iv: n, senderPublicKey: r, encoding: t.encoding }); + const r = typeof t.senderPublicKey < "u" ? Rn(t.senderPublicKey, ai) : void 0, n = typeof t.iv < "u" ? Rn(t.iv, ai) : Pa.randomBytes(qf), i = new Yv.ChaCha20Poly1305(Rn(t.symKey, ai)).seal(n, Rn(t.message, eh)); + return H8({ type: e, sealed: i, iv: n, senderPublicKey: r, encoding: t.encoding }); } function Az(t, e) { - const r = H8(th), n = Pa.randomBytes(qf), i = Rn(t, eh); - return K8({ type: r, sealed: i, iv: n, encoding: e }); + const r = W8(th), n = Pa.randomBytes(qf), i = Rn(t, eh); + return H8({ type: r, sealed: i, iv: n, encoding: e }); } function Pz(t) { - const e = new Jv.ChaCha20Poly1305(Rn(t.symKey, ai)), { sealed: r, iv: n } = El({ encoded: t.encoded, encoding: t == null ? void 0 : t.encoding }), i = e.open(n, r); + const e = new Yv.ChaCha20Poly1305(Rn(t.symKey, ai)), { sealed: r, iv: n } = El({ encoded: t.encoded, encoding: t == null ? void 0 : t.encoding }), i = e.open(n, r); if (i === null) throw new Error("Failed to decrypt"); return On(i, eh); } @@ -16958,7 +16958,7 @@ function Mz(t, e) { const { sealed: r } = El({ encoded: t, encoding: e }); return On(r, eh); } -function K8(t) { +function H8(t) { const { encoding: e = ha } = t; if (dc(t.type) === th) return On(Sd([t.type, t.sealed]), e); if (dc(t.type) === Co) { @@ -16968,9 +16968,9 @@ function K8(t) { return On(Sd([t.type, t.iv, t.sealed]), e); } function El(t) { - const { encoded: e, encoding: r = ha } = t, n = Rn(e, r), i = n.slice(xz, Vx), s = Vx; + const { encoded: e, encoding: r = ha } = t, n = Rn(e, r), i = n.slice(xz, Kx), s = Kx; if (dc(i) === Co) { - const l = s + cb, d = l + qf, p = n.slice(s, l), w = n.slice(l, d), A = n.slice(d); + const l = s + ab, d = l + qf, p = n.slice(s, l), w = n.slice(l, d), A = n.slice(d); return { type: i, sealed: A, iv: w, senderPublicKey: p }; } if (dc(i) === th) { @@ -16982,24 +16982,24 @@ function El(t) { } function Iz(t, e) { const r = El({ encoded: t, encoding: e == null ? void 0 : e.encoding }); - return V8({ type: dc(r.type), senderPublicKey: typeof r.senderPublicKey < "u" ? On(r.senderPublicKey, ai) : void 0, receiverPublicKey: e == null ? void 0 : e.receiverPublicKey }); + return K8({ type: dc(r.type), senderPublicKey: typeof r.senderPublicKey < "u" ? On(r.senderPublicKey, ai) : void 0, receiverPublicKey: e == null ? void 0 : e.receiverPublicKey }); } -function V8(t) { - const e = (t == null ? void 0 : t.type) || W8; +function K8(t) { + const e = (t == null ? void 0 : t.type) || z8; if (e === Co) { if (typeof (t == null ? void 0 : t.senderPublicKey) > "u") throw new Error("missing sender public key"); if (typeof (t == null ? void 0 : t.receiverPublicKey) > "u") throw new Error("missing receiver public key"); } return { type: e, senderPublicKey: t == null ? void 0 : t.senderPublicKey, receiverPublicKey: t == null ? void 0 : t.receiverPublicKey }; } -function Gx(t) { +function Vx(t) { return t.type === Co && typeof t.senderPublicKey == "string" && typeof t.receiverPublicKey == "string"; } -function Yx(t) { +function Gx(t) { return t.type === th; } function Cz(t) { - return new E8.ec("p256").keyFromPublic({ x: Buffer.from(t.x, "base64").toString("hex"), y: Buffer.from(t.y, "base64").toString("hex") }, "hex"); + return new _8.ec("p256").keyFromPublic({ x: Buffer.from(t.x, "base64").toString("hex"), y: Buffer.from(t.y, "base64").toString("hex") }, "hex"); } function Tz(t) { let e = t.replace(/-/g, "+").replace(/_/g, "/"); @@ -17025,9 +17025,9 @@ function Bf(t) { if (typeof e > "u") throw new Error(`Relay Protocol not supported: ${t}`); return e; } -var Nz = Object.defineProperty, Lz = Object.defineProperties, kz = Object.getOwnPropertyDescriptors, Jx = Object.getOwnPropertySymbols, $z = Object.prototype.hasOwnProperty, Bz = Object.prototype.propertyIsEnumerable, Xx = (t, e, r) => e in t ? Nz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Zx = (t, e) => { - for (var r in e || (e = {})) $z.call(e, r) && Xx(t, r, e[r]); - if (Jx) for (var r of Jx(e)) Bz.call(e, r) && Xx(t, r, e[r]); +var Nz = Object.defineProperty, Lz = Object.defineProperties, kz = Object.getOwnPropertyDescriptors, Yx = Object.getOwnPropertySymbols, $z = Object.prototype.hasOwnProperty, Bz = Object.prototype.propertyIsEnumerable, Jx = (t, e, r) => e in t ? Nz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Xx = (t, e) => { + for (var r in e || (e = {})) $z.call(e, r) && Jx(t, r, e[r]); + if (Yx) for (var r of Yx(e)) Bz.call(e, r) && Jx(t, r, e[r]); return t; }, Fz = (t, e) => Lz(t, kz(e)); function jz(t, e = "-") { @@ -17039,9 +17039,9 @@ function jz(t, e = "-") { } }), r; } -function Qx(t) { +function Zx(t) { if (!t.includes("wc:")) { - const u = j8(t); + const u = F8(t); u != null && u.includes("wc:") && (t = u); } t = t.includes("wc://") ? t.replace("wc://", "") : t, t = t.includes("wc:") ? t.replace("wc:", "") : t; @@ -17058,8 +17058,8 @@ function qz(t, e = "-") { t[i] && (n[s] = t[i]); }), n; } -function e3(t) { - return `${t.protocol}:${t.topic}@${t.version}?` + xl.stringify(Zx(Fz(Zx({ symKey: t.symKey }, qz(t.relay)), { expiryTimestamp: t.expiryTimestamp }), t.methods ? { methods: t.methods.join(",") } : {})); +function Qx(t) { + return `${t.protocol}:${t.topic}@${t.version}?` + xl.stringify(Xx(Fz(Xx({ symKey: t.symKey }, qz(t.relay)), { expiryTimestamp: t.expiryTimestamp }), t.methods ? { methods: t.methods.join(",") } : {})); } function fd(t, e, r) { return `${t}?wc_ev=${r}&topic=${e}`; @@ -17089,11 +17089,11 @@ function Hz(t, e) { zu(n.accounts).includes(e) && r.push(...n.events); }), r; } -function ub(t) { +function cb(t) { return t.includes(":"); } function Ff(t) { - return ub(t) ? t.split(":")[0] : t; + return cb(t) ? t.split(":")[0] : t; } function Kz(t) { const e = {}; @@ -17102,7 +17102,7 @@ function Kz(t) { e[n] || (e[n] = { accounts: [], chains: [], events: [] }), e[n].accounts.push(r), e[n].chains.push(`${n}:${i}`); }), e; } -function t3(t, e) { +function e3(t, e) { e = e.map((n) => n.replace("did:pkh:", "")); const r = Kz(e); for (const [n, i] of Object.entries(r)) i.methods ? i.methods = Id(i.methods, t) : i.methods = t, i.events = ["chainChanged", "accountsChanged"]; @@ -17123,13 +17123,13 @@ function pc(t, e) { function Sl(t) { return Object.getPrototypeOf(t) === Object.prototype && Object.keys(t).length; } -function vi(t) { +function mi(t) { return typeof t > "u"; } function dn(t, e) { - return e && vi(t) ? !0 : typeof t == "string" && !!t.trim().length; + return e && mi(t) ? !0 : typeof t == "string" && !!t.trim().length; } -function fb(t, e) { +function ub(t, e) { return typeof t == "number" && !isNaN(t); } function Yz(t, e) { @@ -17137,7 +17137,7 @@ function Yz(t, e) { let s = !0; return rc(i, n) ? (n.forEach((o) => { const { accounts: a, methods: u, events: l } = t.namespaces[o], d = zu(a), p = r[o]; - (!rc(O8(o, p), d) || !rc(p.methods, u) || !rc(p.events, l)) && (s = !1); + (!rc(D8(o, p), d) || !rc(p.methods, u) || !rc(p.events, l)) && (s = !1); }), s) : !1; } function f0(t) { @@ -17164,7 +17164,7 @@ function Xz(t) { try { if (dn(t, !1)) { if (e(t)) return !0; - const r = j8(t); + const r = F8(t); return e(r); } } catch { @@ -17182,7 +17182,7 @@ function eW(t, e) { let r = null; return dn(t == null ? void 0 : t.publicKey, !1) || (r = ft("MISSING_OR_INVALID", `${e} controller public key should be a string`)), r; } -function r3(t) { +function t3(t) { let e = !0; return pc(t) ? t.length && (e = t.every((r) => dn(r, !1))) : e = !1, e; } @@ -17196,7 +17196,7 @@ function rW(t, e, r) { let n = null; return Object.entries(t).forEach(([i, s]) => { if (n) return; - const o = tW(i, O8(i, s), `${e} ${r}`); + const o = tW(i, D8(i, s), `${e} ${r}`); o && (n = o); }), n; } @@ -17216,9 +17216,9 @@ function iW(t, e) { } function sW(t, e) { let r = null; - return r3(t == null ? void 0 : t.methods) ? r3(t == null ? void 0 : t.events) || (r = Or("UNSUPPORTED_EVENTS", `${e}, events should be an array of strings or empty array for no events`)) : r = Or("UNSUPPORTED_METHODS", `${e}, methods should be an array of strings or empty array for no methods`), r; + return t3(t == null ? void 0 : t.methods) ? t3(t == null ? void 0 : t.events) || (r = Or("UNSUPPORTED_EVENTS", `${e}, events should be an array of strings or empty array for no events`)) : r = Or("UNSUPPORTED_METHODS", `${e}, methods should be an array of strings or empty array for no methods`), r; } -function G8(t, e) { +function V8(t, e) { let r = null; return Object.values(t).forEach((n) => { if (r) return; @@ -17229,7 +17229,7 @@ function G8(t, e) { function oW(t, e, r) { let n = null; if (t && Sl(t)) { - const i = G8(t, e); + const i = V8(t, e); i && (n = i); const s = rW(t, e, r); s && (n = s); @@ -17239,41 +17239,41 @@ function oW(t, e, r) { function hm(t, e) { let r = null; if (t && Sl(t)) { - const n = G8(t, e); + const n = V8(t, e); n && (r = n); const i = iW(t, e); i && (r = i); } else r = ft("MISSING_OR_INVALID", `${e}, namespaces should be an object with data`); return r; } -function Y8(t) { +function G8(t) { return dn(t.protocol, !0); } function aW(t, e) { let r = !1; return t ? t && pc(t) && t.length && t.forEach((n) => { - r = Y8(n); + r = G8(n); }) : r = !0, r; } function cW(t) { return typeof t == "number"; } -function mi(t) { +function gi(t) { return typeof t < "u" && typeof t !== null; } function uW(t) { - return !(!t || typeof t != "object" || !t.code || !fb(t.code) || !t.message || !dn(t.message, !1)); + return !(!t || typeof t != "object" || !t.code || !ub(t.code) || !t.message || !dn(t.message, !1)); } function fW(t) { - return !(vi(t) || !dn(t.method, !1)); + return !(mi(t) || !dn(t.method, !1)); } function lW(t) { - return !(vi(t) || vi(t.result) && vi(t.error) || !fb(t.id) || !dn(t.jsonrpc, !1)); + return !(mi(t) || mi(t.result) && mi(t.error) || !ub(t.id) || !dn(t.jsonrpc, !1)); } function hW(t) { - return !(vi(t) || !dn(t.name, !1)); + return !(mi(t) || !dn(t.name, !1)); } -function n3(t, e) { +function r3(t, e) { return !(!f0(e) || !zz(t).includes(e)); } function dW(t, e, r) { @@ -17282,9 +17282,9 @@ function dW(t, e, r) { function pW(t, e, r) { return dn(r, !1) ? Hz(t, e).includes(r) : !1; } -function i3(t, e, r) { +function n3(t, e, r) { let n = null; - const i = gW(t), s = mW(e), o = Object.keys(i), a = Object.keys(s), u = s3(Object.keys(t)), l = s3(Object.keys(e)), d = u.filter((p) => !l.includes(p)); + const i = gW(t), s = mW(e), o = Object.keys(i), a = Object.keys(s), u = i3(Object.keys(t)), l = i3(Object.keys(e)), d = u.filter((p) => !l.includes(p)); return d.length && (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces keys don't satisfy requiredNamespaces. Required: ${d.toString()} Received: ${Object.keys(e).toString()}`)), rc(o, a) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces chains don't satisfy required namespaces. @@ -17308,7 +17308,7 @@ function gW(t) { }); }), e; } -function s3(t) { +function i3(t) { return [...new Set(t.map((e) => e.includes(":") ? e.split(":")[0] : e))]; } function mW(t) { @@ -17324,9 +17324,9 @@ function mW(t) { }), e; } function vW(t, e) { - return fb(t) && t <= e.max && t >= e.min; + return ub(t) && t <= e.max && t >= e.min; } -function o3() { +function s3() { const t = Ql(); return new Promise((e) => { switch (t) { @@ -17385,31 +17385,31 @@ class Pf { delete dm[e]; } } -const SW = "PARSE_ERROR", AW = "INVALID_REQUEST", PW = "METHOD_NOT_FOUND", MW = "INVALID_PARAMS", J8 = "INTERNAL_ERROR", lb = "SERVER_ERROR", IW = [-32700, -32600, -32601, -32602, -32603], zf = { +const SW = "PARSE_ERROR", AW = "INVALID_REQUEST", PW = "METHOD_NOT_FOUND", MW = "INVALID_PARAMS", Y8 = "INTERNAL_ERROR", fb = "SERVER_ERROR", IW = [-32700, -32600, -32601, -32602, -32603], zf = { [SW]: { code: -32700, message: "Parse error" }, [AW]: { code: -32600, message: "Invalid Request" }, [PW]: { code: -32601, message: "Method not found" }, [MW]: { code: -32602, message: "Invalid params" }, - [J8]: { code: -32603, message: "Internal error" }, - [lb]: { code: -32e3, message: "Server error" } -}, X8 = lb; + [Y8]: { code: -32603, message: "Internal error" }, + [fb]: { code: -32e3, message: "Server error" } +}, J8 = fb; function CW(t) { return IW.includes(t); } -function a3(t) { - return Object.keys(zf).includes(t) ? zf[t] : zf[X8]; +function o3(t) { + return Object.keys(zf).includes(t) ? zf[t] : zf[J8]; } function TW(t) { const e = Object.values(zf).find((r) => r.code === t); - return e || zf[X8]; + return e || zf[J8]; } -function Z8(t, e, r) { +function X8(t, e, r) { return t.message.includes("getaddrinfo ENOTFOUND") || t.message.includes("connect ECONNREFUSED") ? new Error(`Unavailable ${r} RPC url at ${e}`) : t; } -var Q8 = {}, mo = {}, c3; +var Z8 = {}, mo = {}, a3; function RW() { - if (c3) return mo; - c3 = 1, Object.defineProperty(mo, "__esModule", { value: !0 }), mo.isBrowserCryptoAvailable = mo.getSubtleCrypto = mo.getBrowerCrypto = void 0; + if (a3) return mo; + a3 = 1, Object.defineProperty(mo, "__esModule", { value: !0 }), mo.isBrowserCryptoAvailable = mo.getSubtleCrypto = mo.getBrowerCrypto = void 0; function t() { return (gn == null ? void 0 : gn.crypto) || (gn == null ? void 0 : gn.msCrypto) || {}; } @@ -17424,10 +17424,10 @@ function RW() { } return mo.isBrowserCryptoAvailable = r, mo; } -var vo = {}, u3; +var vo = {}, c3; function DW() { - if (u3) return vo; - u3 = 1, Object.defineProperty(vo, "__esModule", { value: !0 }), vo.isBrowser = vo.isNode = vo.isReactNative = void 0; + if (c3) return vo; + c3 = 1, Object.defineProperty(vo, "__esModule", { value: !0 }), vo.isBrowser = vo.isNode = vo.isReactNative = void 0; function t() { return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative"; } @@ -17445,7 +17445,7 @@ function DW() { Object.defineProperty(t, "__esModule", { value: !0 }); const e = jl; e.__exportStar(RW(), t), e.__exportStar(DW(), t); -})(Q8); +})(Z8); function ua(t = 3) { const e = Date.now() * Math.pow(10, t), r = Math.floor(Math.random() * Math.pow(10, t)); return e + r; @@ -17476,7 +17476,7 @@ function np(t, e, r) { }; } function OW(t, e) { - return typeof t > "u" ? a3(J8) : (typeof t == "string" && (t = Object.assign(Object.assign({}, a3(lb)), { message: t })), CW(t.code) && (t = TW(t.code)), t); + return typeof t > "u" ? o3(Y8) : (typeof t == "string" && (t = Object.assign(Object.assign({}, o3(fb)), { message: t })), CW(t.code) && (t = TW(t.code)), t); } let NW = class { }, LW = class extends NW { @@ -17494,27 +17494,27 @@ function FW(t) { if (!(!e || !e.length)) return e[0]; } -function eE(t, e) { +function Q8(t, e) { const r = FW(t); return typeof r > "u" ? !1 : new RegExp(e).test(r); } -function f3(t) { - return eE(t, $W); +function u3(t) { + return Q8(t, $W); } -function l3(t) { - return eE(t, BW); +function f3(t) { + return Q8(t, BW); } function jW(t) { return new RegExp("wss?://localhost(:d{2,5})?").test(t); } -function tE(t) { +function eE(t) { return typeof t == "object" && "id" in t && "jsonrpc" in t && t.jsonrpc === "2.0"; } -function hb(t) { - return tE(t) && "method" in t; +function lb(t) { + return eE(t) && "method" in t; } function ip(t) { - return tE(t) && (js(t) || Zi(t)); + return eE(t) && (js(t) || Zi(t)); } function js(t) { return "result" in t; @@ -17583,10 +17583,10 @@ let as = class extends kW { this.hasRegisteredEventListeners || (this.connection.on("payload", (e) => this.onPayload(e)), this.connection.on("close", (e) => this.onClose(e)), this.connection.on("error", (e) => this.events.emit("error", e)), this.connection.on("register_error", (e) => this.onClose()), this.hasRegisteredEventListeners = !0); } }; -const UW = () => typeof WebSocket < "u" ? WebSocket : typeof global < "u" && typeof global.WebSocket < "u" ? global.WebSocket : typeof window < "u" && typeof window.WebSocket < "u" ? window.WebSocket : typeof self < "u" && typeof self.WebSocket < "u" ? self.WebSocket : require("ws"), qW = () => typeof WebSocket < "u" || typeof global < "u" && typeof global.WebSocket < "u" || typeof window < "u" && typeof window.WebSocket < "u" || typeof self < "u" && typeof self.WebSocket < "u", h3 = (t) => t.split("?")[0], d3 = 10, zW = UW(); +const UW = () => typeof WebSocket < "u" ? WebSocket : typeof global < "u" && typeof global.WebSocket < "u" ? global.WebSocket : typeof window < "u" && typeof window.WebSocket < "u" ? window.WebSocket : typeof self < "u" && typeof self.WebSocket < "u" ? self.WebSocket : require("ws"), qW = () => typeof WebSocket < "u" || typeof global < "u" && typeof global.WebSocket < "u" || typeof window < "u" && typeof window.WebSocket < "u" || typeof self < "u" && typeof self.WebSocket < "u", l3 = (t) => t.split("?")[0], h3 = 10, zW = UW(); let WW = class { constructor(e) { - if (this.url = e, this.events = new rs.EventEmitter(), this.registering = !1, !l3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); + if (this.url = e, this.events = new rs.EventEmitter(), this.registering = !1, !f3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); this.url = e; } get connected() { @@ -17630,7 +17630,7 @@ let WW = class { } } register(e = this.url) { - if (!l3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); + if (!f3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); if (this.registering) { const r = this.events.getMaxListeners(); return (this.events.listenerCount("register_error") >= r || this.events.listenerCount("open") >= r) && this.events.setMaxListeners(r + 1), new Promise((n, i) => { @@ -17643,7 +17643,7 @@ let WW = class { }); } return this.url = e, this.registering = !0, new Promise((r, n) => { - const i = new URLSearchParams(e).get("origin"), s = Q8.isReactNative() ? { headers: { origin: i } } : { rejectUnauthorized: !jW(e) }, o = new zW(e, [], s); + const i = new URLSearchParams(e).get("origin"), s = Z8.isReactNative() ? { headers: { origin: i } } : { rejectUnauthorized: !jW(e) }, o = new zW(e, [], s); qW() ? o.onerror = (a) => { const u = a; n(this.emitError(u.error)); @@ -17670,27 +17670,27 @@ let WW = class { this.events.emit("payload", s); } parseError(e, r = this.url) { - return Z8(e, h3(r), "WS"); + return X8(e, l3(r), "WS"); } resetMaxListeners() { - this.events.getMaxListeners() > d3 && this.events.setMaxListeners(d3); + this.events.getMaxListeners() > h3 && this.events.setMaxListeners(h3); } emitError(e) { - const r = this.parseError(new Error((e == null ? void 0 : e.message) || `WebSocket connection failed for host: ${h3(this.url)}`)); + const r = this.parseError(new Error((e == null ? void 0 : e.message) || `WebSocket connection failed for host: ${l3(this.url)}`)); return this.events.emit("register_error", r), r; } }; var l0 = { exports: {} }; l0.exports; (function(t, e) { - var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", u = "[object Array]", l = "[object AsyncFunction]", d = "[object Boolean]", p = "[object Date]", w = "[object Error]", A = "[object Function]", M = "[object GeneratorFunction]", N = "[object Map]", L = "[object Number]", $ = "[object Null]", B = "[object Object]", H = "[object Promise]", U = "[object Proxy]", V = "[object RegExp]", te = "[object Set]", R = "[object String]", K = "[object Symbol]", ge = "[object Undefined]", Ee = "[object WeakMap]", Y = "[object ArrayBuffer]", S = "[object DataView]", m = "[object Float32Array]", f = "[object Float64Array]", g = "[object Int8Array]", b = "[object Int16Array]", x = "[object Int32Array]", _ = "[object Uint8Array]", E = "[object Uint8ClampedArray]", v = "[object Uint16Array]", P = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, F = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, D = {}; - D[m] = D[f] = D[g] = D[b] = D[x] = D[_] = D[E] = D[v] = D[P] = !0, D[a] = D[u] = D[Y] = D[d] = D[S] = D[p] = D[w] = D[A] = D[N] = D[L] = D[B] = D[V] = D[te] = D[R] = D[Ee] = !1; - var oe = typeof gn == "object" && gn && gn.Object === Object && gn, Z = typeof self == "object" && self && self.Object === Object && self, J = oe || Z || Function("return this")(), Q = e && !e.nodeType && e, T = Q && !0 && t && !t.nodeType && t, X = T && T.exports === Q, re = X && oe.process, de = function() { + var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", u = "[object Array]", l = "[object AsyncFunction]", d = "[object Boolean]", p = "[object Date]", w = "[object Error]", A = "[object Function]", M = "[object GeneratorFunction]", N = "[object Map]", L = "[object Number]", B = "[object Null]", $ = "[object Object]", H = "[object Promise]", U = "[object Proxy]", V = "[object RegExp]", te = "[object Set]", R = "[object String]", K = "[object Symbol]", ge = "[object Undefined]", Ee = "[object WeakMap]", Y = "[object ArrayBuffer]", S = "[object DataView]", m = "[object Float32Array]", f = "[object Float64Array]", g = "[object Int8Array]", b = "[object Int16Array]", x = "[object Int32Array]", _ = "[object Uint8Array]", E = "[object Uint8ClampedArray]", v = "[object Uint16Array]", P = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, F = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, D = {}; + D[m] = D[f] = D[g] = D[b] = D[x] = D[_] = D[E] = D[v] = D[P] = !0, D[a] = D[u] = D[Y] = D[d] = D[S] = D[p] = D[w] = D[A] = D[N] = D[L] = D[$] = D[V] = D[te] = D[R] = D[Ee] = !1; + var oe = typeof gn == "object" && gn && gn.Object === Object && gn, Z = typeof self == "object" && self && self.Object === Object && self, J = oe || Z || Function("return this")(), Q = e && !e.nodeType && e, T = Q && !0 && t && !t.nodeType && t, X = T && T.exports === Q, re = X && oe.process, pe = function() { try { return re && re.binding && re.binding("util"); } catch { } - }(), ie = de && de.isTypedArray; + }(), ie = pe && pe.isTypedArray; function ue(ae, ye) { for (var Ge = -1, Pt = ae == null ? 0 : ae.length, jr = 0, nr = []; ++Ge < Pt; ) { var Kr = ae[Ge]; @@ -17770,7 +17770,7 @@ l0.exports; } return ke.call(ye, ae) ? ye[ae] : void 0; } - function he(ae) { + function de(ae) { var ye = this.__data__; return vt ? ye[ae] !== void 0 : ke.call(ye, ae); } @@ -17778,7 +17778,7 @@ l0.exports; var Ge = this.__data__; return this.size += this.has(ae) ? 0 : 1, Ge[ae] = vt && ye === void 0 ? n : ye, this; } - C.prototype.clear = G, C.prototype.delete = j, C.prototype.get = se, C.prototype.has = he, C.prototype.set = xe; + C.prototype.clear = G, C.prototype.delete = j, C.prototype.get = se, C.prototype.has = de, C.prototype.set = xe; function Te(ae) { var ye = -1, Ge = ae == null ? 0 : ae.length; for (this.clear(); ++ye < Ge; ) { @@ -17898,18 +17898,18 @@ l0.exports; return Mc(ae) ? Pt : ve(Pt, Ge(ae)); } function zt(ae) { - return ae == null ? ae === void 0 ? ge : $ : Et && Et in Object(ae) ? $r(ae) : Rp(ae); + return ae == null ? ae === void 0 ? ge : B : Et && Et in Object(ae) ? $r(ae) : Rp(ae); } function Zt(ae) { return Da(ae) && zt(ae) == a; } function Wt(ae, ye, Ge, Pt, jr) { - return ae === ye ? !0 : ae == null || ye == null || !Da(ae) && !Da(ye) ? ae !== ae && ye !== ye : le(ae, ye, Ge, Pt, Wt, jr); + return ae === ye ? !0 : ae == null || ye == null || !Da(ae) && !Da(ye) ? ae !== ae && ye !== ye : he(ae, ye, Ge, Pt, Wt, jr); } - function le(ae, ye, Ge, Pt, jr, nr) { + function he(ae, ye, Ge, Pt, jr, nr) { var Kr = Mc(ae), vn = Mc(ye), _r = Kr ? u : Ir(ae), Ur = vn ? u : Ir(ye); - _r = _r == a ? B : _r, Ur = Ur == a ? B : Ur; - var an = _r == B, fi = Ur == B, bn = _r == Ur; + _r = _r == a ? $ : _r, Ur = Ur == a ? $ : Ur; + var an = _r == $, ui = Ur == $, bn = _r == Ur; if (bn && Xu(ae)) { if (!Xu(ye)) return !1; @@ -17918,7 +17918,7 @@ l0.exports; if (bn && !an) return nr || (nr = new ut()), Kr || mh(ae) ? Qt(ae, ye, Ge, Pt, jr, nr) : gr(ae, ye, _r, Ge, Pt, jr, nr); if (!(Ge & i)) { - var Vr = an && ke.call(ae, "__wrapped__"), ti = fi && ke.call(ye, "__wrapped__"); + var Vr = an && ke.call(ae, "__wrapped__"), ti = ui && ke.call(ye, "__wrapped__"); if (Vr || ti) { var fs = Vr ? ae.value() : ae, Fi = ti ? ye.value() : ye; return nr || (nr = new ut()), jr(fs, Fi, Ge, Pt, nr); @@ -17950,7 +17950,7 @@ l0.exports; var Ur = nr.get(ae); if (Ur && nr.get(ye)) return Ur == ye; - var an = -1, fi = !0, bn = Ge & s ? new xt() : void 0; + var an = -1, ui = !0, bn = Ge & s ? new xt() : void 0; for (nr.set(ae, ye), nr.set(ye, ae); ++an < vn; ) { var Vr = ae[an], ti = ye[an]; if (Pt) @@ -17958,7 +17958,7 @@ l0.exports; if (fs !== void 0) { if (fs) continue; - fi = !1; + ui = !1; break; } if (bn) { @@ -17966,15 +17966,15 @@ l0.exports; if (!$e(bn, Is) && (Vr === Fi || jr(Vr, Fi, Ge, Pt, nr))) return bn.push(Is); })) { - fi = !1; + ui = !1; break; } } else if (!(Vr === ti || jr(Vr, ti, Ge, Pt, nr))) { - fi = !1; + ui = !1; break; } } - return nr.delete(ae), nr.delete(ye), fi; + return nr.delete(ae), nr.delete(ye), ui; } function gr(ae, ye, Ge, Pt, jr, nr, Kr) { switch (Ge) { @@ -18015,8 +18015,8 @@ l0.exports; var Kr = Ge & i, vn = Rr(ae), _r = vn.length, Ur = Rr(ye), an = Ur.length; if (_r != an && !Kr) return !1; - for (var fi = _r; fi--; ) { - var bn = vn[fi]; + for (var ui = _r; ui--; ) { + var bn = vn[ui]; if (!(Kr ? bn in ye : ke.call(ye, bn))) return !1; } @@ -18025,8 +18025,8 @@ l0.exports; return Vr == ye; var ti = !0; nr.set(ae, ye), nr.set(ye, ae); - for (var fs = Kr; ++fi < _r; ) { - bn = vn[fi]; + for (var fs = Kr; ++ui < _r; ) { + bn = vn[ui]; var Fi = ae[bn], Is = ye[bn]; if (Pt) var Zu = Kr ? Pt(Is, Fi, bn, ye, ae, nr) : Pt(Fi, Is, bn, ae, ye, nr); @@ -18069,7 +18069,7 @@ l0.exports; })); } : Fr, Ir = zt; (kt && Ir(new kt(new ArrayBuffer(1))) != S || Ct && Ir(new Ct()) != N || gt && Ir(gt.resolve()) != H || Rt && Ir(new Rt()) != te || Nt && Ir(new Nt()) != Ee) && (Ir = function(ae) { - var ye = zt(ae), Ge = ye == B ? ae.constructor : void 0, Pt = Ge ? io(Ge) : ""; + var ye = zt(ae), Ge = ye == $ ? ae.constructor : void 0, Pt = Ge ? io(Ge) : ""; if (Pt) switch (Pt) { case $t: @@ -18159,7 +18159,7 @@ l0.exports; t.exports = Op; })(l0, l0.exports); var HW = l0.exports; -const KW = /* @__PURE__ */ ts(HW), rE = "wc", nE = 2, iE = "core", Qs = `${rE}@2:${iE}:`, VW = { logger: "error" }, GW = { database: ":memory:" }, YW = "crypto", p3 = "client_ed25519_seed", JW = mt.ONE_DAY, XW = "keychain", ZW = "0.3", QW = "messages", eH = "0.3", tH = mt.SIX_HOURS, rH = "publisher", sE = "irn", nH = "error", oE = "wss://relay.walletconnect.org", iH = "relayer", oi = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", publish: "relayer_publish" }, sH = "_subscription", Vi = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, oH = 0.1, T1 = "2.17.2", zr = { link_mode: "link_mode", relay: "relay" }, aH = "0.3", cH = "WALLETCONNECT_CLIENT_ID", g3 = "WALLETCONNECT_LINK_MODE_APPS", Us = { created: "subscription_created", deleted: "subscription_deleted", sync: "subscription_sync", resubscribed: "subscription_resubscribed" }, uH = "subscription", fH = "0.3", lH = mt.FIVE_SECONDS * 1e3, hH = "pairing", dH = "0.3", Mf = { wc_pairingDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1e3 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1001 } }, wc_pairingPing: { req: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1002 }, res: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1003 } }, unregistered_method: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 } } }, Za = { create: "pairing_create", expire: "pairing_expire", delete: "pairing_delete", ping: "pairing_ping" }, ms = { created: "history_created", updated: "history_updated", deleted: "history_deleted", sync: "history_sync" }, pH = "history", gH = "0.3", mH = "expirer", Ji = { created: "expirer_created", deleted: "expirer_deleted", expired: "expirer_expired", sync: "expirer_sync" }, vH = "0.3", bH = "verify-api", yH = "https://verify.walletconnect.com", aE = "https://verify.walletconnect.org", Wf = aE, wH = `${Wf}/v3`, xH = [yH, aE], _H = "echo", EH = "https://echo.walletconnect.com", Fs = { pairing_started: "pairing_started", pairing_uri_validation_success: "pairing_uri_validation_success", pairing_uri_not_expired: "pairing_uri_not_expired", store_new_pairing: "store_new_pairing", subscribing_pairing_topic: "subscribing_pairing_topic", subscribe_pairing_topic_success: "subscribe_pairing_topic_success", existing_pairing: "existing_pairing", pairing_not_expired: "pairing_not_expired", emit_inactive_pairing: "emit_inactive_pairing", emit_session_proposal: "emit_session_proposal" }, wo = { no_internet_connection: "no_internet_connection", malformed_pairing_uri: "malformed_pairing_uri", active_pairing_already_exists: "active_pairing_already_exists", subscribe_pairing_topic_failure: "subscribe_pairing_topic_failure", pairing_expired: "pairing_expired", proposal_listener_not_found: "proposal_listener_not_found" }, vs = { session_approve_started: "session_approve_started", session_namespaces_validation_success: "session_namespaces_validation_success", subscribing_session_topic: "subscribing_session_topic", subscribe_session_topic_success: "subscribe_session_topic_success", publishing_session_approve: "publishing_session_approve", session_approve_publish_success: "session_approve_publish_success", store_session: "store_session", publishing_session_settle: "publishing_session_settle", session_settle_publish_success: "session_settle_publish_success" }, Ha = { no_internet_connection: "no_internet_connection", proposal_expired: "proposal_expired", subscribe_session_topic_failure: "subscribe_session_topic_failure", session_approve_publish_failure: "session_approve_publish_failure", session_settle_publish_failure: "session_settle_publish_failure", session_approve_namespace_validation_failure: "session_approve_namespace_validation_failure", proposal_not_found: "proposal_not_found" }, Ka = { authenticated_session_approve_started: "authenticated_session_approve_started", create_authenticated_session_topic: "create_authenticated_session_topic", cacaos_verified: "cacaos_verified", store_authenticated_session: "store_authenticated_session", subscribing_authenticated_session_topic: "subscribing_authenticated_session_topic", subscribe_authenticated_session_topic_success: "subscribe_authenticated_session_topic_success", publishing_authenticated_session_approve: "publishing_authenticated_session_approve" }, If = { no_internet_connection: "no_internet_connection", invalid_cacao: "invalid_cacao", subscribe_authenticated_session_topic_failure: "subscribe_authenticated_session_topic_failure", authenticated_session_approve_publish_failure: "authenticated_session_approve_publish_failure", authenticated_session_pending_request_not_found: "authenticated_session_pending_request_not_found" }, SH = 0.1, AH = "event-client", PH = 86400, MH = "https://pulse.walletconnect.org/batch"; +const KW = /* @__PURE__ */ ts(HW), tE = "wc", rE = 2, nE = "core", Qs = `${tE}@2:${nE}:`, VW = { logger: "error" }, GW = { database: ":memory:" }, YW = "crypto", d3 = "client_ed25519_seed", JW = mt.ONE_DAY, XW = "keychain", ZW = "0.3", QW = "messages", eH = "0.3", tH = mt.SIX_HOURS, rH = "publisher", iE = "irn", nH = "error", sE = "wss://relay.walletconnect.org", iH = "relayer", oi = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", publish: "relayer_publish" }, sH = "_subscription", Vi = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, oH = 0.1, T1 = "2.17.2", zr = { link_mode: "link_mode", relay: "relay" }, aH = "0.3", cH = "WALLETCONNECT_CLIENT_ID", p3 = "WALLETCONNECT_LINK_MODE_APPS", Us = { created: "subscription_created", deleted: "subscription_deleted", sync: "subscription_sync", resubscribed: "subscription_resubscribed" }, uH = "subscription", fH = "0.3", lH = mt.FIVE_SECONDS * 1e3, hH = "pairing", dH = "0.3", Mf = { wc_pairingDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1e3 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1001 } }, wc_pairingPing: { req: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1002 }, res: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1003 } }, unregistered_method: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 } } }, Za = { create: "pairing_create", expire: "pairing_expire", delete: "pairing_delete", ping: "pairing_ping" }, ms = { created: "history_created", updated: "history_updated", deleted: "history_deleted", sync: "history_sync" }, pH = "history", gH = "0.3", mH = "expirer", Ji = { created: "expirer_created", deleted: "expirer_deleted", expired: "expirer_expired", sync: "expirer_sync" }, vH = "0.3", bH = "verify-api", yH = "https://verify.walletconnect.com", oE = "https://verify.walletconnect.org", Wf = oE, wH = `${Wf}/v3`, xH = [yH, oE], _H = "echo", EH = "https://echo.walletconnect.com", Fs = { pairing_started: "pairing_started", pairing_uri_validation_success: "pairing_uri_validation_success", pairing_uri_not_expired: "pairing_uri_not_expired", store_new_pairing: "store_new_pairing", subscribing_pairing_topic: "subscribing_pairing_topic", subscribe_pairing_topic_success: "subscribe_pairing_topic_success", existing_pairing: "existing_pairing", pairing_not_expired: "pairing_not_expired", emit_inactive_pairing: "emit_inactive_pairing", emit_session_proposal: "emit_session_proposal" }, wo = { no_internet_connection: "no_internet_connection", malformed_pairing_uri: "malformed_pairing_uri", active_pairing_already_exists: "active_pairing_already_exists", subscribe_pairing_topic_failure: "subscribe_pairing_topic_failure", pairing_expired: "pairing_expired", proposal_listener_not_found: "proposal_listener_not_found" }, vs = { session_approve_started: "session_approve_started", session_namespaces_validation_success: "session_namespaces_validation_success", subscribing_session_topic: "subscribing_session_topic", subscribe_session_topic_success: "subscribe_session_topic_success", publishing_session_approve: "publishing_session_approve", session_approve_publish_success: "session_approve_publish_success", store_session: "store_session", publishing_session_settle: "publishing_session_settle", session_settle_publish_success: "session_settle_publish_success" }, Ha = { no_internet_connection: "no_internet_connection", proposal_expired: "proposal_expired", subscribe_session_topic_failure: "subscribe_session_topic_failure", session_approve_publish_failure: "session_approve_publish_failure", session_settle_publish_failure: "session_settle_publish_failure", session_approve_namespace_validation_failure: "session_approve_namespace_validation_failure", proposal_not_found: "proposal_not_found" }, Ka = { authenticated_session_approve_started: "authenticated_session_approve_started", create_authenticated_session_topic: "create_authenticated_session_topic", cacaos_verified: "cacaos_verified", store_authenticated_session: "store_authenticated_session", subscribing_authenticated_session_topic: "subscribing_authenticated_session_topic", subscribe_authenticated_session_topic_success: "subscribe_authenticated_session_topic_success", publishing_authenticated_session_approve: "publishing_authenticated_session_approve" }, If = { no_internet_connection: "no_internet_connection", invalid_cacao: "invalid_cacao", subscribe_authenticated_session_topic_failure: "subscribe_authenticated_session_topic_failure", authenticated_session_approve_publish_failure: "authenticated_session_approve_publish_failure", authenticated_session_pending_request_not_found: "authenticated_session_pending_request_not_found" }, SH = 0.1, AH = "event-client", PH = 86400, MH = "https://pulse.walletconnect.org/batch"; function IH(t, e) { if (t.length >= 255) throw new TypeError("Alphabet too long"); for (var r = new Uint8Array(256), n = 0; n < r.length; n++) r[n] = 255; @@ -18172,11 +18172,11 @@ function IH(t, e) { function p(M) { if (M instanceof Uint8Array || (ArrayBuffer.isView(M) ? M = new Uint8Array(M.buffer, M.byteOffset, M.byteLength) : Array.isArray(M) && (M = Uint8Array.from(M))), !(M instanceof Uint8Array)) throw new TypeError("Expected Uint8Array"); if (M.length === 0) return ""; - for (var N = 0, L = 0, $ = 0, B = M.length; $ !== B && M[$] === 0; ) $++, N++; - for (var H = (B - $) * d + 1 >>> 0, U = new Uint8Array(H); $ !== B; ) { - for (var V = M[$], te = 0, R = H - 1; (V !== 0 || te < L) && R !== -1; R--, te++) V += 256 * U[R] >>> 0, U[R] = V % a >>> 0, V = V / a >>> 0; + for (var N = 0, L = 0, B = 0, $ = M.length; B !== $ && M[B] === 0; ) B++, N++; + for (var H = ($ - B) * d + 1 >>> 0, U = new Uint8Array(H); B !== $; ) { + for (var V = M[B], te = 0, R = H - 1; (V !== 0 || te < L) && R !== -1; R--, te++) V += 256 * U[R] >>> 0, U[R] = V % a >>> 0, V = V / a >>> 0; if (V !== 0) throw new Error("Non-zero carry"); - L = te, $++; + L = te, B++; } for (var K = H - L; K !== H && U[K] === 0; ) K++; for (var ge = u.repeat(N); K < H; ++K) ge += t.charAt(U[K]); @@ -18187,17 +18187,17 @@ function IH(t, e) { if (M.length === 0) return new Uint8Array(); var N = 0; if (M[N] !== " ") { - for (var L = 0, $ = 0; M[N] === u; ) L++, N++; - for (var B = (M.length - N) * l + 1 >>> 0, H = new Uint8Array(B); M[N]; ) { + for (var L = 0, B = 0; M[N] === u; ) L++, N++; + for (var $ = (M.length - N) * l + 1 >>> 0, H = new Uint8Array($); M[N]; ) { var U = r[M.charCodeAt(N)]; if (U === 255) return; - for (var V = 0, te = B - 1; (U !== 0 || V < $) && te !== -1; te--, V++) U += a * H[te] >>> 0, H[te] = U % 256 >>> 0, U = U / 256 >>> 0; + for (var V = 0, te = $ - 1; (U !== 0 || V < B) && te !== -1; te--, V++) U += a * H[te] >>> 0, H[te] = U % 256 >>> 0, U = U / 256 >>> 0; if (U !== 0) throw new Error("Non-zero carry"); - $ = V, N++; + B = V, N++; } if (M[N] !== " ") { - for (var R = B - $; R !== B && H[R] === 0; ) R++; - for (var K = new Uint8Array(L + (B - R)), ge = L; R !== B; ) K[ge++] = H[R++]; + for (var R = $ - B; R !== $ && H[R] === 0; ) R++; + for (var K = new Uint8Array(L + ($ - R)), ge = L; R !== $; ) K[ge++] = H[R++]; return K; } } @@ -18210,7 +18210,7 @@ function IH(t, e) { return { encode: p, decodeUnsafe: w, decode: A }; } var CH = IH, TH = CH; -const cE = (t) => { +const aE = (t) => { if (t instanceof Uint8Array && t.constructor.name === "Uint8Array") return t; if (t instanceof ArrayBuffer) return new Uint8Array(t); if (ArrayBuffer.isView(t)) return new Uint8Array(t.buffer, t.byteOffset, t.byteLength); @@ -18237,7 +18237,7 @@ class NH { } else throw Error("Can only multibase decode strings"); } or(e) { - return uE(this, e); + return cE(this, e); } } class LH { @@ -18245,7 +18245,7 @@ class LH { this.decoders = e; } or(e) { - return uE(this, e); + return cE(this, e); } decode(e) { const r = e[0], n = this.decoders[r]; @@ -18253,7 +18253,7 @@ class LH { throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`); } } -const uE = (t, e) => new LH({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); +const cE = (t, e) => new LH({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); class kH { constructor(e, r, n, i) { this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new OH(e, r, n), this.decoder = new NH(e, r, i); @@ -18267,7 +18267,7 @@ class kH { } const sp = ({ name: t, prefix: e, encode: r, decode: n }) => new kH(t, e, r, n), rh = ({ prefix: t, name: e, alphabet: r }) => { const { encode: n, decode: i } = TH(r, e); - return sp({ prefix: t, name: e, encode: n, decode: (s) => cE(i(s)) }); + return sp({ prefix: t, name: e, encode: n, decode: (s) => aE(i(s)) }); }, $H = (t, e, r, n) => { const i = {}; for (let d = 0; d < e.length; ++d) i[e[d]] = d; @@ -18310,7 +18310,7 @@ const uK = rh({ name: "base58btc", prefix: "z", alphabet: "123456789ABCDEFGHJKLM var lK = Object.freeze({ __proto__: null, base58btc: uK, base58flickr: fK }); const hK = Hn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 }), dK = Hn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 }), pK = Hn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 }), gK = Hn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", bitsPerChar: 6 }); var mK = Object.freeze({ __proto__: null, base64: hK, base64pad: dK, base64url: pK, base64urlpad: gK }); -const fE = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), vK = fE.reduce((t, e, r) => (t[r] = e, t), []), bK = fE.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); +const uE = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), vK = uE.reduce((t, e, r) => (t[r] = e, t), []), bK = uE.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); function yK(t) { return t.reduce((e, r) => (e += vK[r], e), ""); } @@ -18324,35 +18324,35 @@ function wK(t) { return new Uint8Array(e); } const xK = sp({ prefix: "🚀", name: "base256emoji", encode: yK, decode: wK }); -var _K = Object.freeze({ __proto__: null, base256emoji: xK }), EK = lE, m3 = 128, SK = 127, AK = ~SK, PK = Math.pow(2, 31); -function lE(t, e, r) { +var _K = Object.freeze({ __proto__: null, base256emoji: xK }), EK = fE, g3 = 128, SK = 127, AK = ~SK, PK = Math.pow(2, 31); +function fE(t, e, r) { e = e || [], r = r || 0; - for (var n = r; t >= PK; ) e[r++] = t & 255 | m3, t /= 128; - for (; t & AK; ) e[r++] = t & 255 | m3, t >>>= 7; - return e[r] = t | 0, lE.bytes = r - n + 1, e; + for (var n = r; t >= PK; ) e[r++] = t & 255 | g3, t /= 128; + for (; t & AK; ) e[r++] = t & 255 | g3, t >>>= 7; + return e[r] = t | 0, fE.bytes = r - n + 1, e; } -var MK = R1, IK = 128, v3 = 127; +var MK = R1, IK = 128, m3 = 127; function R1(t, n) { var r = 0, n = n || 0, i = 0, s = n, o, a = t.length; do { if (s >= a) throw R1.bytes = 0, new RangeError("Could not decode varint"); - o = t[s++], r += i < 28 ? (o & v3) << i : (o & v3) * Math.pow(2, i), i += 7; + o = t[s++], r += i < 28 ? (o & m3) << i : (o & m3) * Math.pow(2, i), i += 7; } while (o >= IK); return R1.bytes = s - n, r; } var CK = Math.pow(2, 7), TK = Math.pow(2, 14), RK = Math.pow(2, 21), DK = Math.pow(2, 28), OK = Math.pow(2, 35), NK = Math.pow(2, 42), LK = Math.pow(2, 49), kK = Math.pow(2, 56), $K = Math.pow(2, 63), BK = function(t) { return t < CK ? 1 : t < TK ? 2 : t < RK ? 3 : t < DK ? 4 : t < OK ? 5 : t < NK ? 6 : t < LK ? 7 : t < kK ? 8 : t < $K ? 9 : 10; -}, FK = { encode: EK, decode: MK, encodingLength: BK }, hE = FK; -const b3 = (t, e, r = 0) => (hE.encode(t, e, r), e), y3 = (t) => hE.encodingLength(t), D1 = (t, e) => { - const r = e.byteLength, n = y3(t), i = n + y3(r), s = new Uint8Array(i + r); - return b3(t, s, 0), b3(r, s, n), s.set(e, i), new jK(t, r, e, s); +}, FK = { encode: EK, decode: MK, encodingLength: BK }, lE = FK; +const v3 = (t, e, r = 0) => (lE.encode(t, e, r), e), b3 = (t) => lE.encodingLength(t), D1 = (t, e) => { + const r = e.byteLength, n = b3(t), i = n + b3(r), s = new Uint8Array(i + r); + return v3(t, s, 0), v3(r, s, n), s.set(e, i), new jK(t, r, e, s); }; class jK { constructor(e, r, n, i) { this.code = e, this.size = r, this.digest = n, this.bytes = i; } } -const dE = ({ name: t, code: e, encode: r }) => new UK(t, e, r); +const hE = ({ name: t, code: e, encode: r }) => new UK(t, e, r); class UK { constructor(e, r, n) { this.name = e, this.code = r, this.encode = n; @@ -18364,20 +18364,20 @@ class UK { } else throw Error("Unknown type, must be binary type"); } } -const pE = (t) => async (e) => new Uint8Array(await crypto.subtle.digest(t, e)), qK = dE({ name: "sha2-256", code: 18, encode: pE("SHA-256") }), zK = dE({ name: "sha2-512", code: 19, encode: pE("SHA-512") }); +const dE = (t) => async (e) => new Uint8Array(await crypto.subtle.digest(t, e)), qK = hE({ name: "sha2-256", code: 18, encode: dE("SHA-256") }), zK = hE({ name: "sha2-512", code: 19, encode: dE("SHA-512") }); var WK = Object.freeze({ __proto__: null, sha256: qK, sha512: zK }); -const gE = 0, HK = "identity", mE = cE, KK = (t) => D1(gE, mE(t)), VK = { code: gE, name: HK, encode: mE, digest: KK }; +const pE = 0, HK = "identity", gE = aE, KK = (t) => D1(pE, gE(t)), VK = { code: pE, name: HK, encode: gE, digest: KK }; var GK = Object.freeze({ __proto__: null, identity: VK }); new TextEncoder(), new TextDecoder(); -const w3 = { ...jH, ...qH, ...WH, ...KH, ...YH, ...sK, ...cK, ...lK, ...mK, ..._K }; +const y3 = { ...jH, ...qH, ...WH, ...KH, ...YH, ...sK, ...cK, ...lK, ...mK, ..._K }; ({ ...WK, ...GK }); function YK(t = 0) { return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); } -function vE(t, e, r, n) { +function mE(t, e, r, n) { return { name: t, prefix: e, encoder: { name: t, prefix: e, encode: r }, decoder: { decode: n } }; } -const x3 = vE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), pm = vE("ascii", "a", (t) => { +const w3 = mE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), pm = mE("ascii", "a", (t) => { let e = "a"; for (let r = 0; r < t.length; r++) e += String.fromCharCode(t[r]); return e; @@ -18386,7 +18386,7 @@ const x3 = vE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) = const e = YK(t.length); for (let r = 0; r < t.length; r++) e[r] = t.charCodeAt(r); return e; -}), JK = { utf8: x3, "utf-8": x3, hex: w3.base16, latin1: pm, ascii: pm, binary: pm, ...w3 }; +}), JK = { utf8: w3, "utf-8": w3, hex: y3.base16, latin1: pm, ascii: pm, binary: pm, ...y3 }; function XK(t, e = "utf8") { const r = JK[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); @@ -18411,7 +18411,7 @@ let ZK = class { return i; }, this.del = async (n) => { this.isInitialized(), this.keychain.delete(n), await this.persist(); - }, this.core = e, this.logger = ui(r, this.name); + }, this.core = e, this.logger = ci(r, this.name); } get context() { return Ai(this.logger); @@ -18420,11 +18420,11 @@ let ZK = class { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; } async setKeyChain(e) { - await this.core.storage.setItem(this.storageKey, k8(e)); + await this.core.storage.setItem(this.storageKey, L8(e)); } async getKeyChain() { const e = await this.core.storage.getItem(this.storageKey); - return typeof e < "u" ? $8(e) : void 0; + return typeof e < "u" ? k8(e) : void 0; } async persist() { await this.setKeyChain(this.keychain); @@ -18441,15 +18441,15 @@ let ZK = class { this.initialized || (await this.keychain.init(), this.initialized = !0); }, this.hasKeys = (i) => (this.isInitialized(), this.keychain.has(i)), this.getClientId = async () => { this.isInitialized(); - const i = await this.getClientSeed(), s = ox(i); - return q4(s.publicKey); + const i = await this.getClientSeed(), s = sx(i); + return U4(s.publicKey); }, this.generateKeyPair = () => { this.isInitialized(); const i = _z(); return this.setPrivateKey(i.publicKey, i.privateKey); }, this.signJWT = async (i) => { this.isInitialized(); - const s = await this.getClientSeed(), o = ox(s), a = this.randomSessionIdentifier; + const s = await this.getClientSeed(), o = sx(s), a = this.randomSessionIdentifier; return await HB(a, i, JW, o); }, this.generateSharedKey = (i, s, o) => { this.isInitialized(); @@ -18465,9 +18465,9 @@ let ZK = class { this.isInitialized(), await this.keychain.del(i); }, this.encode = async (i, s, o) => { this.isInitialized(); - const a = V8(o), u = $o(s); - if (Yx(a)) return Az(u, o == null ? void 0 : o.encoding); - if (Gx(a)) { + const a = K8(o), u = $o(s); + if (Gx(a)) return Az(u, o == null ? void 0 : o.encoding); + if (Vx(a)) { const w = a.senderPublicKey, A = a.receiverPublicKey; i = await this.generateSharedKey(w, A); } @@ -18476,11 +18476,11 @@ let ZK = class { }, this.decode = async (i, s, o) => { this.isInitialized(); const a = Iz(s, o); - if (Yx(a)) { + if (Gx(a)) { const u = Mz(s, o == null ? void 0 : o.encoding); return fc(u); } - if (Gx(a)) { + if (Vx(a)) { const u = a.receiverPublicKey, l = a.senderPublicKey; i = await this.generateSharedKey(u, l); } @@ -18496,7 +18496,7 @@ let ZK = class { }, this.getPayloadSenderPublicKey = (i, s = ha) => { const o = El({ encoded: i, encoding: s }); return o.senderPublicKey ? On(o.senderPublicKey, ai) : void 0; - }, this.core = e, this.logger = ui(r, this.name), this.keychain = n || new ZK(this.core, this.logger); + }, this.core = e, this.logger = ci(r, this.name), this.keychain = n || new ZK(this.core, this.logger); } get context() { return Ai(this.logger); @@ -18510,9 +18510,9 @@ let ZK = class { async getClientSeed() { let e = ""; try { - e = this.keychain.get(p3); + e = this.keychain.get(d3); } catch { - e = I1(), await this.keychain.set(p3, e); + e = I1(), await this.keychain.set(d3, e); } return XK(e, "base16"); } @@ -18555,7 +18555,7 @@ class eV extends Xk { return typeof s[o] < "u"; }, this.del = async (n) => { this.isInitialized(), this.messages.delete(n), await this.persist(); - }, this.logger = ui(e, this.name), this.core = r; + }, this.logger = ci(e, this.name), this.core = r; } get context() { return Ai(this.logger); @@ -18564,11 +18564,11 @@ class eV extends Xk { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; } async setRelayerMessages(e) { - await this.core.storage.setItem(this.storageKey, k8(e)); + await this.core.storage.setItem(this.storageKey, L8(e)); } async getRelayerMessages() { const e = await this.core.storage.getItem(this.storageKey); - return typeof e < "u" ? $8(e) : void 0; + return typeof e < "u" ? k8(e) : void 0; } async persist() { await this.setRelayerMessages(this.messages); @@ -18590,11 +18590,11 @@ class tV extends Zk { try { for (; N === void 0; ) { if (Date.now() - M > this.publishTimeout) throw new Error(A); - this.logger.trace({ id: p, attempts: L }, `publisher.publish - attempt ${L}`), N = await await du(this.rpcPublish(n, i, a, u, l, d, p, s == null ? void 0 : s.attestation).catch(($) => this.logger.warn($)), this.publishTimeout, A), L++, N || await new Promise(($) => setTimeout($, this.failedPublishTimeout)); + this.logger.trace({ id: p, attempts: L }, `publisher.publish - attempt ${L}`), N = await await du(this.rpcPublish(n, i, a, u, l, d, p, s == null ? void 0 : s.attestation).catch((B) => this.logger.warn(B)), this.publishTimeout, A), L++, N || await new Promise((B) => setTimeout(B, this.failedPublishTimeout)); } this.relayer.events.emit(oi.publish, w), this.logger.debug("Successfully Published Payload"), this.logger.trace({ type: "method", method: "publish", params: { id: p, topic: n, message: i, opts: s } }); - } catch ($) { - if (this.logger.debug("Failed to Publish Payload"), this.logger.error($), (o = s == null ? void 0 : s.internal) != null && o.throwOnFailedPublish) throw $; + } catch (B) { + if (this.logger.debug("Failed to Publish Payload"), this.logger.error(B), (o = s == null ? void 0 : s.internal) != null && o.throwOnFailedPublish) throw B; this.queue.set(p, w); } }, this.on = (n, i) => { @@ -18605,7 +18605,7 @@ class tV extends Zk { this.events.off(n, i); }, this.removeListener = (n, i) => { this.events.removeListener(n, i); - }, this.relayer = e, this.logger = ui(r, this.name), this.registerEventListeners(); + }, this.relayer = e, this.logger = ci(r, this.name), this.registerEventListeners(); } get context() { return Ai(this.logger); @@ -18613,7 +18613,7 @@ class tV extends Zk { rpcPublish(e, r, n, i, s, o, a, u) { var l, d, p, w; const A = { method: Bf(i.protocol).publish, params: { topic: e, message: r, ttl: n, prompt: s, tag: o, attestation: u }, id: a }; - return vi((l = A.params) == null ? void 0 : l.prompt) && ((d = A.params) == null || delete d.prompt), vi((p = A.params) == null ? void 0 : p.tag) && ((w = A.params) == null || delete w.tag), this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "message", direction: "outgoing", request: A }), this.relayer.request(A); + return mi((l = A.params) == null ? void 0 : l.prompt) && ((d = A.params) == null || delete d.prompt), mi((p = A.params) == null ? void 0 : p.tag) && ((w = A.params) == null || delete w.tag), this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "message", direction: "outgoing", request: A }), this.relayer.request(A); } removeRequestFromQueue(e) { this.queue.delete(e); @@ -18663,9 +18663,9 @@ class rV { return Array.from(this.map.keys()); } } -var nV = Object.defineProperty, iV = Object.defineProperties, sV = Object.getOwnPropertyDescriptors, _3 = Object.getOwnPropertySymbols, oV = Object.prototype.hasOwnProperty, aV = Object.prototype.propertyIsEnumerable, E3 = (t, e, r) => e in t ? nV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Cf = (t, e) => { - for (var r in e || (e = {})) oV.call(e, r) && E3(t, r, e[r]); - if (_3) for (var r of _3(e)) aV.call(e, r) && E3(t, r, e[r]); +var nV = Object.defineProperty, iV = Object.defineProperties, sV = Object.getOwnPropertyDescriptors, x3 = Object.getOwnPropertySymbols, oV = Object.prototype.hasOwnProperty, aV = Object.prototype.propertyIsEnumerable, _3 = (t, e, r) => e in t ? nV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Cf = (t, e) => { + for (var r in e || (e = {})) oV.call(e, r) && _3(t, r, e[r]); + if (x3) for (var r of x3(e)) aV.call(e, r) && _3(t, r, e[r]); return t; }, gm = (t, e) => iV(t, sV(e)); class cV extends t$ { @@ -18708,7 +18708,7 @@ class cV extends t$ { await this.onDisconnect(); }, this.restart = async () => { this.restartInProgress = !0, await this.restore(), await this.reset(), this.restartInProgress = !1; - }, this.relayer = e, this.logger = ui(r, this.name), this.clientId = ""; + }, this.relayer = e, this.logger = ci(r, this.name), this.clientId = ""; } get context() { return Ai(this.logger); @@ -18914,9 +18914,9 @@ class cV extends t$ { }); } } -var uV = Object.defineProperty, S3 = Object.getOwnPropertySymbols, fV = Object.prototype.hasOwnProperty, lV = Object.prototype.propertyIsEnumerable, A3 = (t, e, r) => e in t ? uV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, P3 = (t, e) => { - for (var r in e || (e = {})) fV.call(e, r) && A3(t, r, e[r]); - if (S3) for (var r of S3(e)) lV.call(e, r) && A3(t, r, e[r]); +var uV = Object.defineProperty, E3 = Object.getOwnPropertySymbols, fV = Object.prototype.hasOwnProperty, lV = Object.prototype.propertyIsEnumerable, S3 = (t, e, r) => e in t ? uV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, A3 = (t, e) => { + for (var r in e || (e = {})) fV.call(e, r) && S3(t, r, e[r]); + if (E3) for (var r of E3(e)) lV.call(e, r) && S3(t, r, e[r]); return t; }; class hV extends Qk { @@ -18962,7 +18962,7 @@ class hV extends Qk { this.logger.error(r), this.events.emit(oi.error, r), this.logger.info("Fatal socket error received, closing transport"), this.transportClose(); }, this.registerProviderListeners = () => { this.provider.on(Vi.payload, this.onPayloadHandler), this.provider.on(Vi.connect, this.onConnectHandler), this.provider.on(Vi.disconnect, this.onDisconnectHandler), this.provider.on(Vi.error, this.onProviderErrorHandler); - }, this.core = e.core, this.logger = typeof e.logger < "u" && typeof e.logger != "string" ? ui(e.logger, this.name) : ql($0({ level: e.logger || nH })), this.messages = new eV(this.logger, e.core), this.subscriber = new cV(this, this.logger), this.publisher = new tV(this, this.logger), this.relayUrl = (e == null ? void 0 : e.relayUrl) || oE, this.projectId = e.projectId, this.bundleId = jq(), this.provider = {}; + }, this.core = e.core, this.logger = typeof e.logger < "u" && typeof e.logger != "string" ? ci(e.logger, this.name) : ql($0({ level: e.logger || nH })), this.messages = new eV(this.logger, e.core), this.subscriber = new cV(this, this.logger), this.publisher = new tV(this, this.logger), this.relayUrl = (e == null ? void 0 : e.relayUrl) || sE, this.projectId = e.projectId, this.bundleId = jq(), this.provider = {}; } async init() { if (this.logger.trace("Initialized"), this.registerEventListeners(), await Promise.all([this.messages.init(), this.subscriber.init()]), this.initialized = !0, this.subscriber.cached.length > 0) try { @@ -18996,7 +18996,7 @@ class hV extends Qk { return await Promise.all([new Promise((d) => { u = d, this.subscriber.on(Us.created, l); }), new Promise(async (d, p) => { - a = await this.subscriber.subscribe(e, P3({ internal: { throwOnFailedPublish: o } }, r)).catch((w) => { + a = await this.subscriber.subscribe(e, A3({ internal: { throwOnFailedPublish: o } }, r)).catch((w) => { o && p(w); }) || a, d(); })]), a; @@ -19054,7 +19054,7 @@ class hV extends Qk { this.connectionAttemptInProgress || (this.relayUrl = e || this.relayUrl, await this.confirmOnlineStateOrThrow(), await this.transportClose(), await this.transportOpen()); } async confirmOnlineStateOrThrow() { - if (!await o3()) throw new Error("No internet connection detected. Please restart your network and try again."); + if (!await s3()) throw new Error("No internet connection detected. Please restart your network and try again."); } async handleBatchMessageEvents(e) { if ((e == null ? void 0 : e.length) === 0) { @@ -19108,10 +19108,10 @@ class hV extends Qk { return i && this.logger.debug(`Ignoring duplicate message: ${n}`), i; } async onProviderPayload(e) { - if (this.logger.debug("Incoming Relay Payload"), this.logger.trace({ type: "payload", direction: "incoming", payload: e }), hb(e)) { + if (this.logger.debug("Incoming Relay Payload"), this.logger.trace({ type: "payload", direction: "incoming", payload: e }), lb(e)) { if (!e.method.endsWith(sH)) return; const r = e.params, { topic: n, message: i, publishedAt: s, attestation: o } = r.data, a = { topic: n, message: i, publishedAt: s, transportType: zr.relay, attestation: o }; - this.logger.debug("Emitting Relayer Payload"), this.logger.trace(P3({ type: "event", event: r.id }, a)), this.events.emit(r.id, a), await this.acknowledgePayload(e), await this.onMessageEvent(a); + this.logger.debug("Emitting Relayer Payload"), this.logger.trace(A3({ type: "event", event: r.id }, a)), this.events.emit(r.id, a), await this.acknowledgePayload(e), await this.onMessageEvent(a); } else ip(e) && this.events.emit(oi.message_ack, e); } async onMessageEvent(e) { @@ -19125,7 +19125,7 @@ class hV extends Qk { this.provider.off(Vi.payload, this.onPayloadHandler), this.provider.off(Vi.connect, this.onConnectHandler), this.provider.off(Vi.disconnect, this.onDisconnectHandler), this.provider.off(Vi.error, this.onProviderErrorHandler), clearTimeout(this.pingTimeout); } async registerEventListeners() { - let e = await o3(); + let e = await s3(); xW(async (r) => { e !== r && (e = r, r ? await this.restartTransport().catch((n) => this.logger.error(n)) : (this.hasExperiencedNetworkDisruption = !0, await this.transportDisconnect(), this.transportExplicitlyClosed = !1)); }); @@ -19149,26 +19149,26 @@ class hV extends Qk { }), await this.transportOpen()); } } -var dV = Object.defineProperty, M3 = Object.getOwnPropertySymbols, pV = Object.prototype.hasOwnProperty, gV = Object.prototype.propertyIsEnumerable, I3 = (t, e, r) => e in t ? dV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, C3 = (t, e) => { - for (var r in e || (e = {})) pV.call(e, r) && I3(t, r, e[r]); - if (M3) for (var r of M3(e)) gV.call(e, r) && I3(t, r, e[r]); +var dV = Object.defineProperty, P3 = Object.getOwnPropertySymbols, pV = Object.prototype.hasOwnProperty, gV = Object.prototype.propertyIsEnumerable, M3 = (t, e, r) => e in t ? dV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, I3 = (t, e) => { + for (var r in e || (e = {})) pV.call(e, r) && M3(t, r, e[r]); + if (P3) for (var r of P3(e)) gV.call(e, r) && M3(t, r, e[r]); return t; }; class Ec extends e$ { constructor(e, r, n, i = Qs, s = void 0) { super(e, r, n, i), this.core = e, this.logger = r, this.name = n, this.map = /* @__PURE__ */ new Map(), this.version = aH, this.cached = [], this.initialized = !1, this.storagePrefix = Qs, this.recentlyDeleted = [], this.recentlyDeletedLimit = 200, this.init = async () => { this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((o) => { - this.getKey && o !== null && !vi(o) ? this.map.set(this.getKey(o), o) : Zz(o) ? this.map.set(o.id, o) : Qz(o) && this.map.set(o.topic, o); + this.getKey && o !== null && !mi(o) ? this.map.set(this.getKey(o), o) : Zz(o) ? this.map.set(o.id, o) : Qz(o) && this.map.set(o.topic, o); }), this.cached = [], this.initialized = !0); }, this.set = async (o, a) => { this.isInitialized(), this.map.has(o) ? await this.update(o, a) : (this.logger.debug("Setting value"), this.logger.trace({ type: "method", method: "set", key: o, value: a }), this.map.set(o, a), await this.persist()); }, this.get = (o) => (this.isInitialized(), this.logger.debug("Getting value"), this.logger.trace({ type: "method", method: "get", key: o }), this.getData(o)), this.getAll = (o) => (this.isInitialized(), o ? this.values.filter((a) => Object.keys(o).every((u) => KW(a[u], o[u]))) : this.values), this.update = async (o, a) => { this.isInitialized(), this.logger.debug("Updating value"), this.logger.trace({ type: "method", method: "update", key: o, update: a }); - const u = C3(C3({}, this.getData(o)), a); + const u = I3(I3({}, this.getData(o)), a); this.map.set(o, u), await this.persist(); }, this.delete = async (o, a) => { this.isInitialized(), this.map.has(o) && (this.logger.debug("Deleting value"), this.logger.trace({ type: "method", method: "delete", key: o, reason: a }), this.map.delete(o), this.addToRecentlyDeleted(o), await this.persist()); - }, this.logger = ui(r, this.name), this.storagePrefix = i, this.getKey = s; + }, this.logger = ci(r, this.name), this.storagePrefix = i, this.getKey = s; } get context() { return Ai(this.logger); @@ -19231,19 +19231,19 @@ class Ec extends e$ { } class mV { constructor(e, r) { - this.core = e, this.logger = r, this.name = hH, this.version = dH, this.events = new Bv(), this.initialized = !1, this.storagePrefix = Qs, this.ignoredPayloadTypes = [Co], this.registeredMethods = [], this.init = async () => { + this.core = e, this.logger = r, this.name = hH, this.version = dH, this.events = new $v(), this.initialized = !1, this.storagePrefix = Qs, this.ignoredPayloadTypes = [Co], this.registeredMethods = [], this.init = async () => { this.initialized || (await this.pairings.init(), await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.initialized = !0, this.logger.trace("Initialized")); }, this.register = ({ methods: n }) => { this.isInitialized(), this.registeredMethods = [.../* @__PURE__ */ new Set([...this.registeredMethods, ...n])]; }, this.create = async (n) => { this.isInitialized(); - const i = I1(), s = await this.core.crypto.setSymKey(i), o = En(mt.FIVE_MINUTES), a = { protocol: sE }, u = { topic: s, expiry: o, relay: a, active: !1, methods: n == null ? void 0 : n.methods }, l = e3({ protocol: this.core.protocol, version: this.core.version, topic: s, symKey: i, relay: a, expiryTimestamp: o, methods: n == null ? void 0 : n.methods }); + const i = I1(), s = await this.core.crypto.setSymKey(i), o = En(mt.FIVE_MINUTES), a = { protocol: iE }, u = { topic: s, expiry: o, relay: a, active: !1, methods: n == null ? void 0 : n.methods }, l = Qx({ protocol: this.core.protocol, version: this.core.version, topic: s, symKey: i, relay: a, expiryTimestamp: o, methods: n == null ? void 0 : n.methods }); return this.events.emit(Za.create, u), this.core.expirer.set(s, o), await this.pairings.set(s, u), await this.core.relayer.subscribe(s, { transportType: n == null ? void 0 : n.transportType }), { topic: s, uri: l }; }, this.pair = async (n) => { this.isInitialized(); const i = this.core.eventClient.createEvent({ properties: { topic: n == null ? void 0 : n.uri, trace: [Fs.pairing_started] } }); this.isValidPair(n, i); - const { topic: s, symKey: o, relay: a, expiryTimestamp: u, methods: l } = Qx(n.uri); + const { topic: s, symKey: o, relay: a, expiryTimestamp: u, methods: l } = Zx(n.uri); i.props.properties.topic = s, i.addTrace(Fs.pairing_uri_validation_success), i.addTrace(Fs.pairing_uri_not_expired); let d; if (this.pairings.keys.includes(s)) { @@ -19287,7 +19287,7 @@ class mV { }, this.formatUriFromPairing = (n) => { this.isInitialized(); const { topic: i, relay: s, expiry: o, methods: a } = n, u = this.core.crypto.keychain.get(i); - return e3({ protocol: this.core.protocol, version: this.core.version, topic: i, symKey: u, relay: s, expiryTimestamp: o, methods: a }); + return Qx({ protocol: this.core.protocol, version: this.core.version, topic: i, symKey: u, relay: s, expiryTimestamp: o, methods: a }); }, this.sendRequest = async (n, i, s) => { const o = da(i, s), a = await this.core.crypto.encode(n, o), u = Mf[i].req; return this.core.history.set(n, o), this.core.relayer.publish(n, a, u), o.id; @@ -19352,7 +19352,7 @@ class mV { this.registeredMethods.includes(n) || this.logger.error(Or("WC_METHOD_UNSUPPORTED", n)); }, this.isValidPair = (n, i) => { var s; - if (!mi(n)) { + if (!gi(n)) { const { message: a } = ft("MISSING_OR_INVALID", `pair() params: ${n}`); throw i.setError(wo.malformed_pairing_uri), new Error(a); } @@ -19360,7 +19360,7 @@ class mV { const { message: a } = ft("MISSING_OR_INVALID", `pair() uri: ${n.uri}`); throw i.setError(wo.malformed_pairing_uri), new Error(a); } - const o = Qx(n == null ? void 0 : n.uri); + const o = Zx(n == null ? void 0 : n.uri); if (!((s = o == null ? void 0 : o.relay) != null && s.protocol)) { const { message: a } = ft("MISSING_OR_INVALID", "pair() uri#relay-protocol"); throw i.setError(wo.malformed_pairing_uri), new Error(a); @@ -19375,14 +19375,14 @@ class mV { throw new Error(a); } }, this.isValidPing = async (n) => { - if (!mi(n)) { + if (!gi(n)) { const { message: s } = ft("MISSING_OR_INVALID", `ping() params: ${n}`); throw new Error(s); } const { topic: i } = n; await this.isValidPairingTopic(i); }, this.isValidDisconnect = async (n) => { - if (!mi(n)) { + if (!gi(n)) { const { message: s } = ft("MISSING_OR_INVALID", `disconnect() params: ${n}`); throw new Error(s); } @@ -19402,7 +19402,7 @@ class mV { const { message: i } = ft("EXPIRED", `pairing topic: ${n}`); throw new Error(i); } - }, this.core = e, this.logger = ui(r, this.name), this.pairings = new Ec(this.core, this.logger, this.name, this.storagePrefix); + }, this.core = e, this.logger = ci(r, this.name), this.pairings = new Ec(this.core, this.logger, this.name, this.storagePrefix); } get context() { return Ai(this.logger); @@ -19419,7 +19419,7 @@ class mV { if (!this.pairings.keys.includes(r) || i === zr.link_mode || this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n))) return; const s = await this.core.crypto.decode(r, n); try { - hb(s) ? (this.core.history.set(r, s), this.onRelayEventRequest({ topic: r, payload: s })) : ip(s) && (await this.core.history.resolve(s), await this.onRelayEventResponse({ topic: r, payload: s }), this.core.history.delete(r, s.id)); + lb(s) ? (this.core.history.set(r, s), this.onRelayEventRequest({ topic: r, payload: s })) : ip(s) && (await this.core.history.resolve(s), await this.onRelayEventResponse({ topic: r, payload: s }), this.core.history.delete(r, s.id)); } catch (o) { this.logger.error(o); } @@ -19427,7 +19427,7 @@ class mV { } registerExpirerEvents() { this.core.expirer.on(Ji.expired, async (e) => { - const { topic: r } = F8(e.target); + const { topic: r } = B8(e.target); r && this.pairings.keys.includes(r) && (await this.deletePairing(r, !0), this.events.emit(Za.expire, { topic: r })); }); } @@ -19459,7 +19459,7 @@ class vV extends Jk { this.events.off(n, i); }, this.removeListener = (n, i) => { this.events.removeListener(n, i); - }, this.logger = ui(r, this.name); + }, this.logger = ci(r, this.name); } get context() { return Ai(this.logger); @@ -19579,7 +19579,7 @@ class bV extends r$ { this.events.off(n, i); }, this.removeListener = (n, i) => { this.events.removeListener(n, i); - }, this.logger = ui(r, this.name); + }, this.logger = ci(r, this.name); } get context() { return Ai(this.logger); @@ -19663,7 +19663,7 @@ class bV extends r$ { } class yV extends n$ { constructor(e, r, n) { - super(e, r, n), this.core = e, this.logger = r, this.store = n, this.name = bH, this.verifyUrlV3 = wH, this.storagePrefix = Qs, this.version = nE, this.init = async () => { + super(e, r, n), this.core = e, this.logger = r, this.store = n, this.name = bH, this.verifyUrlV3 = wH, this.storagePrefix = Qs, this.version = rE, this.init = async () => { var i; this.isDevEnv || (this.publicKey = await this.store.getItem(this.storeKey), this.publicKey && mt.toMiliseconds((i = this.publicKey) == null ? void 0 : i.expiresAt) < Date.now() && (this.logger.debug("verify v2 public key expired"), await this.removePublicKey())); }, this.register = async (i) => { @@ -19677,15 +19677,15 @@ class yV extends n$ { this.abortController.signal.addEventListener("abort", M); const N = l.createElement("iframe"); N.src = u, N.style.display = "none", N.addEventListener("error", M, { signal: this.abortController.signal }); - const L = ($) => { - if ($.data && typeof $.data == "string") try { - const B = JSON.parse($.data); - if (B.type === "verify_attestation") { - if (v1(B.attestation).payload.id !== o) return; - clearInterval(d), l.body.removeChild(N), this.abortController.signal.removeEventListener("abort", M), window.removeEventListener("message", L), w(B.attestation === null ? "" : B.attestation); + const L = (B) => { + if (B.data && typeof B.data == "string") try { + const $ = JSON.parse(B.data); + if ($.type === "verify_attestation") { + if (v1($.attestation).payload.id !== o) return; + clearInterval(d), l.body.removeChild(N), this.abortController.signal.removeEventListener("abort", M), window.removeEventListener("message", L), w($.attestation === null ? "" : $.attestation); } - } catch (B) { - this.logger.warn(B); + } catch ($) { + this.logger.warn($); } }; l.body.appendChild(N), window.addEventListener("message", L, { signal: this.abortController.signal }); @@ -19760,7 +19760,7 @@ class yV extends n$ { const o = Dz(i, s.publicKey), a = { hasExpired: mt.toMiliseconds(o.exp) < Date.now(), payload: o }; if (a.hasExpired) throw this.logger.warn("resolve: jwt attestation expired"), new Error("JWT attestation expired"); return { origin: a.payload.origin, isScam: a.payload.isScam, isVerified: a.payload.isVerified }; - }, this.logger = ui(r, this.name), this.abortController = new AbortController(), this.isDevEnv = ob(), this.init(); + }, this.logger = ci(r, this.name), this.abortController = new AbortController(), this.isDevEnv = sb(), this.init(); } get storeKey() { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//verify:public:key"; @@ -19777,25 +19777,25 @@ class wV extends i$ { super(e, r), this.projectId = e, this.logger = r, this.context = _H, this.registerDeviceToken = async (n) => { const { clientId: i, token: s, notificationType: o, enableEncrypted: a = !1 } = n, u = `${EH}/${this.projectId}/clients`; await fetch(u, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ client_id: i, type: o, token: s, always_raw: a }) }); - }, this.logger = ui(r, this.context); + }, this.logger = ci(r, this.context); } } -var xV = Object.defineProperty, T3 = Object.getOwnPropertySymbols, _V = Object.prototype.hasOwnProperty, EV = Object.prototype.propertyIsEnumerable, R3 = (t, e, r) => e in t ? xV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Tf = (t, e) => { - for (var r in e || (e = {})) _V.call(e, r) && R3(t, r, e[r]); - if (T3) for (var r of T3(e)) EV.call(e, r) && R3(t, r, e[r]); +var xV = Object.defineProperty, C3 = Object.getOwnPropertySymbols, _V = Object.prototype.hasOwnProperty, EV = Object.prototype.propertyIsEnumerable, T3 = (t, e, r) => e in t ? xV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Tf = (t, e) => { + for (var r in e || (e = {})) _V.call(e, r) && T3(t, r, e[r]); + if (C3) for (var r of C3(e)) EV.call(e, r) && T3(t, r, e[r]); return t; }; class SV extends s$ { constructor(e, r, n = !0) { super(e, r, n), this.core = e, this.logger = r, this.context = AH, this.storagePrefix = Qs, this.storageVersion = SH, this.events = /* @__PURE__ */ new Map(), this.shouldPersist = !1, this.init = async () => { - if (!ob()) try { - const i = { eventId: Ux(), timestamp: Date.now(), domain: this.getAppDomain(), props: { event: "INIT", type: "", properties: { client_id: await this.core.crypto.getClientId(), user_agent: L8(this.core.relayer.protocol, this.core.relayer.version, T1) } } }; + if (!sb()) try { + const i = { eventId: jx(), timestamp: Date.now(), domain: this.getAppDomain(), props: { event: "INIT", type: "", properties: { client_id: await this.core.crypto.getClientId(), user_agent: N8(this.core.relayer.protocol, this.core.relayer.version, T1) } } }; await this.sendEvent([i]); } catch (i) { this.logger.warn(i); } }, this.createEvent = (i) => { - const { event: s = "ERROR", type: o = "", properties: { topic: a, trace: u } } = i, l = Ux(), d = this.core.projectId || "", p = Date.now(), w = Tf({ eventId: l, timestamp: p, props: { event: s, type: o, properties: { topic: a, trace: u } }, bundleId: d, domain: this.getAppDomain() }, this.setMethods(l)); + const { event: s = "ERROR", type: o = "", properties: { topic: a, trace: u } } = i, l = jx(), d = this.core.projectId || "", p = Date.now(), w = Tf({ eventId: l, timestamp: p, props: { event: s, type: o, properties: { topic: a, trace: u } }, bundleId: d, domain: this.getAppDomain() }, this.setMethods(l)); return this.telemetryEnabled && (this.events.set(l, w), this.shouldPersist = !0), w; }, this.getEvent = (i) => { const { eventId: s, topic: o } = i; @@ -19841,7 +19841,7 @@ class SV extends s$ { }, this.sendEvent = async (i) => { const s = this.getAppDomain() ? "" : "&sp=desktop"; return await fetch(`${MH}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${T1}${s}`, { method: "POST", body: JSON.stringify(i) }); - }, this.getAppDomain = () => N8().url, this.logger = ui(r, this.context), this.telemetryEnabled = n, n ? this.restore().then(async () => { + }, this.getAppDomain = () => O8().url, this.logger = ci(r, this.context), this.telemetryEnabled = n, n ? this.restore().then(async () => { await this.submit(), this.setEventListeners(); }) : this.persist(); } @@ -19849,27 +19849,27 @@ class SV extends s$ { return this.storagePrefix + this.storageVersion + this.core.customStoragePrefix + "//" + this.context; } } -var AV = Object.defineProperty, D3 = Object.getOwnPropertySymbols, PV = Object.prototype.hasOwnProperty, MV = Object.prototype.propertyIsEnumerable, O3 = (t, e, r) => e in t ? AV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, N3 = (t, e) => { - for (var r in e || (e = {})) PV.call(e, r) && O3(t, r, e[r]); - if (D3) for (var r of D3(e)) MV.call(e, r) && O3(t, r, e[r]); +var AV = Object.defineProperty, R3 = Object.getOwnPropertySymbols, PV = Object.prototype.hasOwnProperty, MV = Object.prototype.propertyIsEnumerable, D3 = (t, e, r) => e in t ? AV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, O3 = (t, e) => { + for (var r in e || (e = {})) PV.call(e, r) && D3(t, r, e[r]); + if (R3) for (var r of R3(e)) MV.call(e, r) && D3(t, r, e[r]); return t; }; -class db extends Yk { +class hb extends Yk { constructor(e) { var r; - super(e), this.protocol = rE, this.version = nE, this.name = iE, this.events = new rs.EventEmitter(), this.initialized = !1, this.on = (o, a) => this.events.on(o, a), this.once = (o, a) => this.events.once(o, a), this.off = (o, a) => this.events.off(o, a), this.removeListener = (o, a) => this.events.removeListener(o, a), this.dispatchEnvelope = ({ topic: o, message: a, sessionExists: u }) => { + super(e), this.protocol = tE, this.version = rE, this.name = nE, this.events = new rs.EventEmitter(), this.initialized = !1, this.on = (o, a) => this.events.on(o, a), this.once = (o, a) => this.events.once(o, a), this.off = (o, a) => this.events.off(o, a), this.removeListener = (o, a) => this.events.removeListener(o, a), this.dispatchEnvelope = ({ topic: o, message: a, sessionExists: u }) => { if (!o || !a) return; const l = { topic: o, message: a, publishedAt: Date.now(), transportType: zr.link_mode }; this.relayer.onLinkMessageEvent(l, { sessionExists: u }); - }, this.projectId = e == null ? void 0 : e.projectId, this.relayUrl = (e == null ? void 0 : e.relayUrl) || oE, this.customStoragePrefix = e != null && e.customStoragePrefix ? `:${e.customStoragePrefix}` : ""; + }, this.projectId = e == null ? void 0 : e.projectId, this.relayUrl = (e == null ? void 0 : e.relayUrl) || sE, this.customStoragePrefix = e != null && e.customStoragePrefix ? `:${e.customStoragePrefix}` : ""; const n = $0({ level: typeof (e == null ? void 0 : e.logger) == "string" && e.logger ? e.logger : VW.logger }), { logger: i, chunkLoggerController: s } = Gk({ opts: n, maxSizeInBytes: e == null ? void 0 : e.maxLogBlobSizeInBytes, loggerOverride: e == null ? void 0 : e.logger }); this.logChunkController = s, (r = this.logChunkController) != null && r.downloadLogsBlobInBrowser && (window.downloadLogsBlobInBrowser = async () => { var o, a; (o = this.logChunkController) != null && o.downloadLogsBlobInBrowser && ((a = this.logChunkController) == null || a.downloadLogsBlobInBrowser({ clientId: await this.crypto.getClientId() })); - }), this.logger = ui(i, this.name), this.heartbeat = new qL(), this.crypto = new QK(this, this.logger, e == null ? void 0 : e.keychain), this.history = new vV(this, this.logger), this.expirer = new bV(this, this.logger), this.storage = e != null && e.storage ? e.storage : new wk(N3(N3({}, GW), e == null ? void 0 : e.storageOptions)), this.relayer = new hV({ core: this, logger: this.logger, relayUrl: this.relayUrl, projectId: this.projectId }), this.pairing = new mV(this, this.logger), this.verify = new yV(this, this.logger, this.storage), this.echoClient = new wV(this.projectId || "", this.logger), this.linkModeSupportedApps = [], this.eventClient = new SV(this, this.logger, e == null ? void 0 : e.telemetryEnabled); + }), this.logger = ci(i, this.name), this.heartbeat = new qL(), this.crypto = new QK(this, this.logger, e == null ? void 0 : e.keychain), this.history = new vV(this, this.logger), this.expirer = new bV(this, this.logger), this.storage = e != null && e.storage ? e.storage : new wk(O3(O3({}, GW), e == null ? void 0 : e.storageOptions)), this.relayer = new hV({ core: this, logger: this.logger, relayUrl: this.relayUrl, projectId: this.projectId }), this.pairing = new mV(this, this.logger), this.verify = new yV(this, this.logger, this.storage), this.echoClient = new wV(this.projectId || "", this.logger), this.linkModeSupportedApps = [], this.eventClient = new SV(this, this.logger, e == null ? void 0 : e.telemetryEnabled); } static async init(e) { - const r = new db(e); + const r = new hb(e); await r.initialize(); const n = await r.crypto.getClientId(); return await r.storage.setItem(cH, n), r; @@ -19885,26 +19885,26 @@ class db extends Yk { return (e = this.logChunkController) == null ? void 0 : e.logsToBlob({ clientId: await this.crypto.getClientId() }); } async addLinkModeSupportedApp(e) { - this.linkModeSupportedApps.includes(e) || (this.linkModeSupportedApps.push(e), await this.storage.setItem(g3, this.linkModeSupportedApps)); + this.linkModeSupportedApps.includes(e) || (this.linkModeSupportedApps.push(e), await this.storage.setItem(p3, this.linkModeSupportedApps)); } async initialize() { this.logger.trace("Initialized"); try { - await this.crypto.init(), await this.history.init(), await this.expirer.init(), await this.relayer.init(), await this.heartbeat.init(), await this.pairing.init(), this.eventClient.init(), this.linkModeSupportedApps = await this.storage.getItem(g3) || [], this.initialized = !0, this.logger.info("Core Initialization Success"); + await this.crypto.init(), await this.history.init(), await this.expirer.init(), await this.relayer.init(), await this.heartbeat.init(), await this.pairing.init(), this.eventClient.init(), this.linkModeSupportedApps = await this.storage.getItem(p3) || [], this.initialized = !0, this.logger.info("Core Initialization Success"); } catch (e) { throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`, e), this.logger.error(e.message), e; } } } -const IV = db, bE = "wc", yE = 2, wE = "client", pb = `${bE}@${yE}:${wE}:`, mm = { name: wE, logger: "error" }, L3 = "WALLETCONNECT_DEEPLINK_CHOICE", CV = "proposal", xE = "Proposal expired", TV = "session", Kc = mt.SEVEN_DAYS, RV = "engine", In = { wc_sessionPropose: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1100 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1101 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1120 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1121 } }, wc_sessionSettle: { req: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1102 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1103 } }, wc_sessionUpdate: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1104 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1105 } }, wc_sessionExtend: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1106 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1107 } }, wc_sessionRequest: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1108 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1109 } }, wc_sessionEvent: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1110 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1111 } }, wc_sessionDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1112 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1113 } }, wc_sessionPing: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1114 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1115 } }, wc_sessionAuthenticate: { req: { ttl: mt.ONE_HOUR, prompt: !0, tag: 1116 }, res: { ttl: mt.ONE_HOUR, prompt: !1, tag: 1117 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1118 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1119 } } }, vm = { min: mt.FIVE_MINUTES, max: mt.SEVEN_DAYS }, ks = { idle: "IDLE", active: "ACTIVE" }, DV = "request", OV = ["wc_sessionPropose", "wc_sessionRequest", "wc_authRequest", "wc_sessionAuthenticate"], NV = "wc", LV = "auth", kV = "authKeys", $V = "pairingTopics", BV = "requests", op = `${NV}@${1.5}:${LV}:`, Rd = `${op}:PUB_KEY`; -var FV = Object.defineProperty, jV = Object.defineProperties, UV = Object.getOwnPropertyDescriptors, k3 = Object.getOwnPropertySymbols, qV = Object.prototype.hasOwnProperty, zV = Object.prototype.propertyIsEnumerable, $3 = (t, e, r) => e in t ? FV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, tn = (t, e) => { - for (var r in e || (e = {})) qV.call(e, r) && $3(t, r, e[r]); - if (k3) for (var r of k3(e)) zV.call(e, r) && $3(t, r, e[r]); +const IV = hb, vE = "wc", bE = 2, yE = "client", db = `${vE}@${bE}:${yE}:`, mm = { name: yE, logger: "error" }, N3 = "WALLETCONNECT_DEEPLINK_CHOICE", CV = "proposal", wE = "Proposal expired", TV = "session", Kc = mt.SEVEN_DAYS, RV = "engine", In = { wc_sessionPropose: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1100 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1101 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1120 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1121 } }, wc_sessionSettle: { req: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1102 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1103 } }, wc_sessionUpdate: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1104 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1105 } }, wc_sessionExtend: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1106 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1107 } }, wc_sessionRequest: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1108 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1109 } }, wc_sessionEvent: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1110 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1111 } }, wc_sessionDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1112 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1113 } }, wc_sessionPing: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1114 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1115 } }, wc_sessionAuthenticate: { req: { ttl: mt.ONE_HOUR, prompt: !0, tag: 1116 }, res: { ttl: mt.ONE_HOUR, prompt: !1, tag: 1117 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1118 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1119 } } }, vm = { min: mt.FIVE_MINUTES, max: mt.SEVEN_DAYS }, ks = { idle: "IDLE", active: "ACTIVE" }, DV = "request", OV = ["wc_sessionPropose", "wc_sessionRequest", "wc_authRequest", "wc_sessionAuthenticate"], NV = "wc", LV = "auth", kV = "authKeys", $V = "pairingTopics", BV = "requests", op = `${NV}@${1.5}:${LV}:`, Rd = `${op}:PUB_KEY`; +var FV = Object.defineProperty, jV = Object.defineProperties, UV = Object.getOwnPropertyDescriptors, L3 = Object.getOwnPropertySymbols, qV = Object.prototype.hasOwnProperty, zV = Object.prototype.propertyIsEnumerable, k3 = (t, e, r) => e in t ? FV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, tn = (t, e) => { + for (var r in e || (e = {})) qV.call(e, r) && k3(t, r, e[r]); + if (L3) for (var r of L3(e)) zV.call(e, r) && k3(t, r, e[r]); return t; }, bs = (t, e) => jV(t, UV(e)); class WV extends a$ { constructor(e) { - super(e), this.name = RV, this.events = new Bv(), this.initialized = !1, this.requestQueue = { state: ks.idle, queue: [] }, this.sessionRequestQueue = { state: ks.idle, queue: [] }, this.requestQueueDelay = mt.ONE_SECOND, this.expectedPairingMethodMap = /* @__PURE__ */ new Map(), this.recentlyDeletedMap = /* @__PURE__ */ new Map(), this.recentlyDeletedLimit = 200, this.relayMessageCache = [], this.init = async () => { + super(e), this.name = RV, this.events = new $v(), this.initialized = !1, this.requestQueue = { state: ks.idle, queue: [] }, this.sessionRequestQueue = { state: ks.idle, queue: [] }, this.requestQueueDelay = mt.ONE_SECOND, this.expectedPairingMethodMap = /* @__PURE__ */ new Map(), this.recentlyDeletedMap = /* @__PURE__ */ new Map(), this.recentlyDeletedLimit = 200, this.relayMessageCache = [], this.init = async () => { this.initialized || (await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.registerPairingEvents(), await this.registerLinkModeListeners(), this.client.core.pairing.register({ methods: Object.keys(In) }), this.initialized = !0, setTimeout(() => { this.sessionRequestQueue.queue = this.getPendingSessionRequests(), this.processSessionRequestQueue(); }, mt.toMiliseconds(this.requestQueueDelay))); @@ -19927,17 +19927,17 @@ class WV extends a$ { const { message: U } = ft("NO_MATCHING_KEY", `connect() pairing topic: ${l}`); throw new Error(U); } - const w = await this.client.core.crypto.generateKeyPair(), A = In.wc_sessionPropose.req.ttl || mt.FIVE_MINUTES, M = En(A), N = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: u ?? [{ protocol: sE }], proposer: { publicKey: w, metadata: this.client.metadata }, expiryTimestamp: M, pairingTopic: l }, a && { sessionProperties: a }), { reject: L, resolve: $, done: B } = Ga(A, xE); + const w = await this.client.core.crypto.generateKeyPair(), A = In.wc_sessionPropose.req.ttl || mt.FIVE_MINUTES, M = En(A), N = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: u ?? [{ protocol: iE }], proposer: { publicKey: w, metadata: this.client.metadata }, expiryTimestamp: M, pairingTopic: l }, a && { sessionProperties: a }), { reject: L, resolve: B, done: $ } = Ga(A, wE); this.events.once(br("session_connect"), async ({ error: U, session: V }) => { if (U) L(U); else if (V) { V.self.publicKey = w; const te = bs(tn({}, V), { pairingTopic: N.pairingTopic, requiredNamespaces: N.requiredNamespaces, optionalNamespaces: N.optionalNamespaces, transportType: zr.relay }); - await this.client.session.set(V.topic, te), await this.setExpiry(V.topic, V.expiry), l && await this.client.core.pairing.updateMetadata({ topic: l, metadata: V.peer.metadata }), this.cleanupDuplicatePairings(te), $(te); + await this.client.session.set(V.topic, te), await this.setExpiry(V.topic, V.expiry), l && await this.client.core.pairing.updateMetadata({ topic: l, metadata: V.peer.metadata }), this.cleanupDuplicatePairings(te), B(te); } }); const H = await this.sendRequest({ topic: l, method: "wc_sessionPropose", params: N, throwOnFailedPublish: !0 }); - return await this.setProposal(H, tn({ id: H }, N)), { uri: d, approval: B }; + return await this.setProposal(H, tn({ id: H }, N)), { uri: d, approval: $ }; }, this.pair = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); try { @@ -19966,28 +19966,28 @@ class WV extends a$ { const { id: a, relayProtocol: u, namespaces: l, sessionProperties: d, sessionConfig: p } = r, w = this.client.proposal.get(a); this.client.core.eventClient.deleteEvent({ eventId: o.eventId }); const { pairingTopic: A, proposer: M, requiredNamespaces: N, optionalNamespaces: L } = w; - let $ = (i = this.client.core.eventClient) == null ? void 0 : i.getEvent({ topic: A }); - $ || ($ = (s = this.client.core.eventClient) == null ? void 0 : s.createEvent({ type: vs.session_approve_started, properties: { topic: A, trace: [vs.session_approve_started, vs.session_namespaces_validation_success] } })); - const B = await this.client.core.crypto.generateKeyPair(), H = M.publicKey, U = await this.client.core.crypto.generateSharedKey(B, H), V = tn(tn({ relay: { protocol: u ?? "irn" }, namespaces: l, controller: { publicKey: B, metadata: this.client.metadata }, expiry: En(Kc) }, d && { sessionProperties: d }), p && { sessionConfig: p }), te = zr.relay; - $.addTrace(vs.subscribing_session_topic); + let B = (i = this.client.core.eventClient) == null ? void 0 : i.getEvent({ topic: A }); + B || (B = (s = this.client.core.eventClient) == null ? void 0 : s.createEvent({ type: vs.session_approve_started, properties: { topic: A, trace: [vs.session_approve_started, vs.session_namespaces_validation_success] } })); + const $ = await this.client.core.crypto.generateKeyPair(), H = M.publicKey, U = await this.client.core.crypto.generateSharedKey($, H), V = tn(tn({ relay: { protocol: u ?? "irn" }, namespaces: l, controller: { publicKey: $, metadata: this.client.metadata }, expiry: En(Kc) }, d && { sessionProperties: d }), p && { sessionConfig: p }), te = zr.relay; + B.addTrace(vs.subscribing_session_topic); try { await this.client.core.relayer.subscribe(U, { transportType: te }); } catch (K) { - throw $.setError(Ha.subscribe_session_topic_failure), K; + throw B.setError(Ha.subscribe_session_topic_failure), K; } - $.addTrace(vs.subscribe_session_topic_success); - const R = bs(tn({}, V), { topic: U, requiredNamespaces: N, optionalNamespaces: L, pairingTopic: A, acknowledged: !1, self: V.controller, peer: { publicKey: M.publicKey, metadata: M.metadata }, controller: B, transportType: zr.relay }); - await this.client.session.set(U, R), $.addTrace(vs.store_session); + B.addTrace(vs.subscribe_session_topic_success); + const R = bs(tn({}, V), { topic: U, requiredNamespaces: N, optionalNamespaces: L, pairingTopic: A, acknowledged: !1, self: V.controller, peer: { publicKey: M.publicKey, metadata: M.metadata }, controller: $, transportType: zr.relay }); + await this.client.session.set(U, R), B.addTrace(vs.store_session); try { - $.addTrace(vs.publishing_session_settle), await this.sendRequest({ topic: U, method: "wc_sessionSettle", params: V, throwOnFailedPublish: !0 }).catch((K) => { - throw $ == null || $.setError(Ha.session_settle_publish_failure), K; - }), $.addTrace(vs.session_settle_publish_success), $.addTrace(vs.publishing_session_approve), await this.sendResult({ id: a, topic: A, result: { relay: { protocol: u ?? "irn" }, responderPublicKey: B }, throwOnFailedPublish: !0 }).catch((K) => { - throw $ == null || $.setError(Ha.session_approve_publish_failure), K; - }), $.addTrace(vs.session_approve_publish_success); + B.addTrace(vs.publishing_session_settle), await this.sendRequest({ topic: U, method: "wc_sessionSettle", params: V, throwOnFailedPublish: !0 }).catch((K) => { + throw B == null || B.setError(Ha.session_settle_publish_failure), K; + }), B.addTrace(vs.session_settle_publish_success), B.addTrace(vs.publishing_session_approve), await this.sendResult({ id: a, topic: A, result: { relay: { protocol: u ?? "irn" }, responderPublicKey: $ }, throwOnFailedPublish: !0 }).catch((K) => { + throw B == null || B.setError(Ha.session_approve_publish_failure), K; + }), B.addTrace(vs.session_approve_publish_success); } catch (K) { throw this.client.logger.error(K), this.client.session.delete(U, Or("USER_DISCONNECTED")), await this.client.core.relayer.unsubscribe(U), K; } - return this.client.core.eventClient.deleteEvent({ eventId: $.eventId }), await this.client.core.pairing.updateMetadata({ topic: A, metadata: M.metadata }), await this.client.proposal.delete(a, Or("USER_DISCONNECTED")), await this.client.core.pairing.activate({ topic: A }), await this.setExpiry(U, En(Kc)), { topic: U, acknowledged: () => Promise.resolve(this.client.session.get(U)) }; + return this.client.core.eventClient.deleteEvent({ eventId: B.eventId }), await this.client.core.pairing.updateMetadata({ topic: A, metadata: M.metadata }), await this.client.proposal.delete(a, Or("USER_DISCONNECTED")), await this.client.core.pairing.activate({ topic: A }), await this.setExpiry(U, En(Kc)), { topic: U, acknowledged: () => Promise.resolve(this.client.session.get(U)) }; }, this.reject = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); try { @@ -20048,7 +20048,7 @@ class WV extends a$ { }), new Promise(async (M) => { var N; if (!((N = a.sessionConfig) != null && N.disableDeepLink)) { - const L = await Yq(this.client.core.storage, L3); + const L = await Yq(this.client.core.storage, N3); await Vq({ id: u, topic: s, wcDeepLink: L }); } M(); @@ -20091,18 +20091,18 @@ class WV extends a$ { this.isInitialized(), this.isValidAuthenticate(r); const s = n && this.client.core.linkModeSupportedApps.includes(n) && ((i = this.client.metadata.redirect) == null ? void 0 : i.linkMode), o = s ? zr.link_mode : zr.relay; o === zr.relay && await this.confirmOnlineStateOrThrow(); - const { chains: a, statement: u = "", uri: l, domain: d, nonce: p, type: w, exp: A, nbf: M, methods: N = [], expiry: L } = r, $ = [...r.resources || []], { topic: B, uri: H } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); - this.client.logger.info({ message: "Generated new pairing", pairing: { topic: B, uri: H } }); + const { chains: a, statement: u = "", uri: l, domain: d, nonce: p, type: w, exp: A, nbf: M, methods: N = [], expiry: L } = r, B = [...r.resources || []], { topic: $, uri: H } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); + this.client.logger.info({ message: "Generated new pairing", pairing: { topic: $, uri: H } }); const U = await this.client.core.crypto.generateKeyPair(), V = Td(U); - if (await Promise.all([this.client.auth.authKeys.set(Rd, { responseTopic: V, publicKey: U }), this.client.auth.pairingTopics.set(V, { topic: V, pairingTopic: B })]), await this.client.core.relayer.subscribe(V, { transportType: o }), this.client.logger.info(`sending request to new pairing topic: ${B}`), N.length > 0) { + if (await Promise.all([this.client.auth.authKeys.set(Rd, { responseTopic: V, publicKey: U }), this.client.auth.pairingTopics.set(V, { topic: V, pairingTopic: $ })]), await this.client.core.relayer.subscribe(V, { transportType: o }), this.client.logger.info(`sending request to new pairing topic: ${$}`), N.length > 0) { const { namespace: _ } = hu(a[0]); let E = mz(_, "request", N); - Cd($) && (E = bz(E, $.pop())), $.push(E); + Cd(B) && (E = bz(E, B.pop())), B.push(E); } - const te = L && L > In.wc_sessionAuthenticate.req.ttl ? L : In.wc_sessionAuthenticate.req.ttl, R = { authPayload: { type: w ?? "caip122", chains: a, statement: u, aud: l, domain: d, version: "1", nonce: p, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: A, nbf: M, resources: $ }, requester: { publicKey: U, metadata: this.client.metadata }, expiryTimestamp: En(te) }, K = { eip155: { chains: a, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...N])], events: ["chainChanged", "accountsChanged"] } }, ge = { requiredNamespaces: {}, optionalNamespaces: K, relays: [{ protocol: "irn" }], pairingTopic: B, proposer: { publicKey: U, metadata: this.client.metadata }, expiryTimestamp: En(In.wc_sessionPropose.req.ttl) }, { done: Ee, resolve: Y, reject: S } = Ga(te, "Request expired"), m = async ({ error: _, session: E }) => { + const te = L && L > In.wc_sessionAuthenticate.req.ttl ? L : In.wc_sessionAuthenticate.req.ttl, R = { authPayload: { type: w ?? "caip122", chains: a, statement: u, aud: l, domain: d, version: "1", nonce: p, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: A, nbf: M, resources: B }, requester: { publicKey: U, metadata: this.client.metadata }, expiryTimestamp: En(te) }, K = { eip155: { chains: a, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...N])], events: ["chainChanged", "accountsChanged"] } }, ge = { requiredNamespaces: {}, optionalNamespaces: K, relays: [{ protocol: "irn" }], pairingTopic: $, proposer: { publicKey: U, metadata: this.client.metadata }, expiryTimestamp: En(In.wc_sessionPropose.req.ttl) }, { done: Ee, resolve: Y, reject: S } = Ga(te, "Request expired"), m = async ({ error: _, session: E }) => { if (this.events.off(br("session_request", g), f), _) S(_); else if (E) { - E.self.publicKey = U, await this.client.session.set(E.topic, E), await this.setExpiry(E.topic, E.expiry), B && await this.client.core.pairing.updateMetadata({ topic: B, metadata: E.peer.metadata }); + E.self.publicKey = U, await this.client.session.set(E.topic, E), await this.setExpiry(E.topic, E.expiry), $ && await this.client.core.pairing.updateMetadata({ topic: $, metadata: E.peer.metadata }); const v = this.client.session.get(E.topic); await this.deleteProposal(b), Y({ session: v }); } @@ -20115,31 +20115,31 @@ class WV extends a$ { await this.deleteProposal(b), this.events.off(br("session_connect"), m); const { cacaos: I, responder: F } = _.result, ce = [], D = []; for (const J of I) { - await Wx({ cacao: J, projectId: this.client.core.projectId }) || (this.client.logger.error(J, "Signature verification failed"), S(Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"))); + await zx({ cacao: J, projectId: this.client.core.projectId }) || (this.client.logger.error(J, "Signature verification failed"), S(Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"))); const { p: Q } = J, T = Cd(Q.resources), X = [M1(Q.iss)], re = u0(Q.iss); if (T) { - const de = Hx(T), ie = Kx(T); - ce.push(...de), X.push(...ie); + const pe = Wx(T), ie = Hx(T); + ce.push(...pe), X.push(...ie); } - for (const de of X) D.push(`${de}:${re}`); + for (const pe of X) D.push(`${pe}:${re}`); } const oe = await this.client.core.crypto.generateSharedKey(U, F.publicKey); let Z; - ce.length > 0 && (Z = { topic: oe, acknowledged: !0, self: { publicKey: U, metadata: this.client.metadata }, peer: F, controller: F.publicKey, expiry: En(Kc), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: B, namespaces: t3([...new Set(ce)], [...new Set(D)]), transportType: o }, await this.client.core.relayer.subscribe(oe, { transportType: o }), await this.client.session.set(oe, Z), B && await this.client.core.pairing.updateMetadata({ topic: B, metadata: F.metadata }), Z = this.client.session.get(oe)), (E = this.client.metadata.redirect) != null && E.linkMode && (v = F.metadata.redirect) != null && v.linkMode && (P = F.metadata.redirect) != null && P.universal && n && (this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal), this.client.session.update(oe, { transportType: zr.link_mode })), Y({ auths: I, session: Z }); + ce.length > 0 && (Z = { topic: oe, acknowledged: !0, self: { publicKey: U, metadata: this.client.metadata }, peer: F, controller: F.publicKey, expiry: En(Kc), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: $, namespaces: e3([...new Set(ce)], [...new Set(D)]), transportType: o }, await this.client.core.relayer.subscribe(oe, { transportType: o }), await this.client.session.set(oe, Z), $ && await this.client.core.pairing.updateMetadata({ topic: $, metadata: F.metadata }), Z = this.client.session.get(oe)), (E = this.client.metadata.redirect) != null && E.linkMode && (v = F.metadata.redirect) != null && v.linkMode && (P = F.metadata.redirect) != null && P.universal && n && (this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal), this.client.session.update(oe, { transportType: zr.link_mode })), Y({ auths: I, session: Z }); }, g = ua(), b = ua(); this.events.once(br("session_connect"), m), this.events.once(br("session_request", g), f); let x; try { if (s) { const _ = da("wc_sessionAuthenticate", R, g); - this.client.core.history.set(B, _); + this.client.core.history.set($, _); const E = await this.client.core.crypto.encode("", _, { type: th, encoding: Af }); - x = fd(n, B, E); - } else await Promise.all([this.sendRequest({ topic: B, method: "wc_sessionAuthenticate", params: R, expiry: r.expiry, throwOnFailedPublish: !0, clientRpcId: g }), this.sendRequest({ topic: B, method: "wc_sessionPropose", params: ge, expiry: In.wc_sessionPropose.req.ttl, throwOnFailedPublish: !0, clientRpcId: b })]); + x = fd(n, $, E); + } else await Promise.all([this.sendRequest({ topic: $, method: "wc_sessionAuthenticate", params: R, expiry: r.expiry, throwOnFailedPublish: !0, clientRpcId: g }), this.sendRequest({ topic: $, method: "wc_sessionPropose", params: ge, expiry: In.wc_sessionPropose.req.ttl, throwOnFailedPublish: !0, clientRpcId: b })]); } catch (_) { throw this.events.off(br("session_connect"), m), this.events.off(br("session_request", g), f), _; } - return await this.setProposal(b, tn({ id: b }, ge)), await this.setAuthRequest(g, { request: bs(tn({}, R), { verifyContext: {} }), pairingTopic: B, transportType: o }), { uri: x ?? H, response: Ee }; + return await this.setProposal(b, tn({ id: b }, ge)), await this.setAuthRequest(g, { request: bs(tn({}, R), { verifyContext: {} }), pairingTopic: $, transportType: o }), { uri: x ?? H, response: Ee }; }, this.approveSessionAuthenticate = async (r) => { const { id: n, auths: i } = r, s = this.client.core.eventClient.createEvent({ properties: { topic: n.toString(), trace: [Ka.authenticated_session_approve_started] } }); try { @@ -20153,15 +20153,15 @@ class WV extends a$ { a === zr.relay && await this.confirmOnlineStateOrThrow(); const u = o.requester.publicKey, l = await this.client.core.crypto.generateKeyPair(), d = Td(u), p = { type: Co, receiverPublicKey: u, senderPublicKey: l }, w = [], A = []; for (const L of i) { - if (!await Wx({ cacao: L, projectId: this.client.core.projectId })) { + if (!await zx({ cacao: L, projectId: this.client.core.projectId })) { s.setError(If.invalid_cacao); const V = Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"); throw await this.sendError({ id: n, topic: d, error: V, encodeOpts: p }), new Error(V.message); } s.addTrace(Ka.cacaos_verified); - const { p: $ } = L, B = Cd($.resources), H = [M1($.iss)], U = u0($.iss); - if (B) { - const V = Hx(B), te = Kx(B); + const { p: B } = L, $ = Cd(B.resources), H = [M1(B.iss)], U = u0(B.iss); + if ($) { + const V = Wx($), te = Hx($); w.push(...V), H.push(...te); } for (const V of H) A.push(`${V}:${U}`); @@ -20170,7 +20170,7 @@ class WV extends a$ { s.addTrace(Ka.create_authenticated_session_topic); let N; if ((w == null ? void 0 : w.length) > 0) { - N = { topic: M, acknowledged: !0, self: { publicKey: l, metadata: this.client.metadata }, peer: { publicKey: u, metadata: o.requester.metadata }, controller: u, expiry: En(Kc), authentication: i, requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: o.pairingTopic, namespaces: t3([...new Set(w)], [...new Set(A)]), transportType: a }, s.addTrace(Ka.subscribing_authenticated_session_topic); + N = { topic: M, acknowledged: !0, self: { publicKey: l, metadata: this.client.metadata }, peer: { publicKey: u, metadata: o.requester.metadata }, controller: u, expiry: En(Kc), authentication: i, requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: o.pairingTopic, namespaces: e3([...new Set(w)], [...new Set(A)]), transportType: a }, s.addTrace(Ka.subscribing_authenticated_session_topic); try { await this.client.core.relayer.subscribe(M, { transportType: a }); } catch (L) { @@ -20195,7 +20195,7 @@ class WV extends a$ { }, this.formatAuthMessage = (r) => { this.isInitialized(); const { request: n, iss: i } = r; - return U8(n, i); + return j8(n, i); }, this.processRelayMessageCache = () => { setTimeout(async () => { if (this.relayMessageCache.length !== 0) for (; this.relayMessageCache.length > 0; ) try { @@ -20219,7 +20219,7 @@ class WV extends a$ { }, this.deleteSession = async (r) => { var n; const { topic: i, expirerHasDeleted: s = !1, emitEvent: o = !0, id: a = 0 } = r, { self: u } = this.client.session.get(i); - await this.client.core.relayer.unsubscribe(i), await this.client.session.delete(i, Or("USER_DISCONNECTED")), this.addToRecentlyDeleted(i, "session"), this.client.core.crypto.keychain.has(u.publicKey) && await this.client.core.crypto.deleteKeyPair(u.publicKey), this.client.core.crypto.keychain.has(i) && await this.client.core.crypto.deleteSymKey(i), s || this.client.core.expirer.del(i), this.client.core.storage.removeItem(L3).catch((l) => this.client.logger.warn(l)), this.getPendingSessionRequests().forEach((l) => { + await this.client.core.relayer.unsubscribe(i), await this.client.session.delete(i, Or("USER_DISCONNECTED")), this.addToRecentlyDeleted(i, "session"), this.client.core.crypto.keychain.has(u.publicKey) && await this.client.core.crypto.deleteKeyPair(u.publicKey), this.client.core.crypto.keychain.has(i) && await this.client.core.crypto.deleteSymKey(i), s || this.client.core.expirer.del(i), this.client.core.storage.removeItem(N3).catch((l) => this.client.logger.warn(l)), this.getPendingSessionRequests().forEach((l) => { l.topic === i && this.deletePendingSessionRequest(l.id, Or("USER_DISCONNECTED")); }), i === ((n = this.sessionRequestQueue.queue[0]) == null ? void 0 : n.topic) && (this.sessionRequestQueue.state = ks.idle), o && this.client.events.emit("session_delete", { id: a, topic: i }); }, this.deleteProposal = async (r, n) => { @@ -20255,8 +20255,8 @@ class WV extends a$ { } let M; if (OV.includes(i)) { - const L = xo(JSON.stringify(p)), $ = xo(w); - M = await this.client.core.verify.register({ id: $, decryptedId: L }); + const L = xo(JSON.stringify(p)), B = xo(w); + M = await this.client.core.verify.register({ id: B, decryptedId: L }); } const N = In[i].req; if (N.attestation = M, o && (N.ttl = o), a && (N.id = a), this.client.core.history.set(n, p), A) { @@ -20264,7 +20264,7 @@ class WV extends a$ { await global.Linking.openURL(L, this.client.name); } else { const L = In[i].req; - o && (L.ttl = o), a && (L.id = a), l ? (L.internal = bs(tn({}, L.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(n, w, L)) : this.client.core.relayer.publish(n, w, L).catch(($) => this.client.logger.error($)); + o && (L.ttl = o), a && (L.id = a), l ? (L.internal = bs(tn({}, L.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(n, w, L)) : this.client.core.relayer.publish(n, w, L).catch((B) => this.client.logger.error(B)); } return p.id; }, this.sendResult = async (r) => { @@ -20568,34 +20568,34 @@ class WV extends a$ { const n = this.client.proposal.getAll().find((i) => i.pairingTopic === r.topic); n && this.onSessionProposeRequest({ topic: r.topic, payload: da("wc_sessionPropose", { requiredNamespaces: n.requiredNamespaces, optionalNamespaces: n.optionalNamespaces, relays: n.relays, proposer: n.proposer, sessionProperties: n.sessionProperties }, n.id) }); }, this.isValidConnect = async (r) => { - if (!mi(r)) { + if (!gi(r)) { const { message: u } = ft("MISSING_OR_INVALID", `connect() params: ${JSON.stringify(r)}`); throw new Error(u); } const { pairingTopic: n, requiredNamespaces: i, optionalNamespaces: s, sessionProperties: o, relays: a } = r; - if (vi(n) || await this.isValidPairingTopic(n), !aW(a)) { + if (mi(n) || await this.isValidPairingTopic(n), !aW(a)) { const { message: u } = ft("MISSING_OR_INVALID", `connect() relays: ${a}`); throw new Error(u); } - !vi(i) && Sl(i) !== 0 && this.validateNamespaces(i, "requiredNamespaces"), !vi(s) && Sl(s) !== 0 && this.validateNamespaces(s, "optionalNamespaces"), vi(o) || this.validateSessionProps(o, "sessionProperties"); + !mi(i) && Sl(i) !== 0 && this.validateNamespaces(i, "requiredNamespaces"), !mi(s) && Sl(s) !== 0 && this.validateNamespaces(s, "optionalNamespaces"), mi(o) || this.validateSessionProps(o, "sessionProperties"); }, this.validateNamespaces = (r, n) => { const i = oW(r, "connect()", n); if (i) throw new Error(i.message); }, this.isValidApprove = async (r) => { - if (!mi(r)) throw new Error(ft("MISSING_OR_INVALID", `approve() params: ${r}`).message); + if (!gi(r)) throw new Error(ft("MISSING_OR_INVALID", `approve() params: ${r}`).message); const { id: n, namespaces: i, relayProtocol: s, sessionProperties: o } = r; this.checkRecentlyDeleted(n), await this.isValidProposalId(n); const a = this.client.proposal.get(n), u = hm(i, "approve()"); if (u) throw new Error(u.message); - const l = i3(a.requiredNamespaces, i, "approve()"); + const l = n3(a.requiredNamespaces, i, "approve()"); if (l) throw new Error(l.message); if (!dn(s, !0)) { const { message: d } = ft("MISSING_OR_INVALID", `approve() relayProtocol: ${s}`); throw new Error(d); } - vi(o) || this.validateSessionProps(o, "sessionProperties"); + mi(o) || this.validateSessionProps(o, "sessionProperties"); }, this.isValidReject = async (r) => { - if (!mi(r)) { + if (!gi(r)) { const { message: s } = ft("MISSING_OR_INVALID", `reject() params: ${r}`); throw new Error(s); } @@ -20605,12 +20605,12 @@ class WV extends a$ { throw new Error(s); } }, this.isValidSessionSettleRequest = (r) => { - if (!mi(r)) { + if (!gi(r)) { const { message: l } = ft("MISSING_OR_INVALID", `onSessionSettleRequest() params: ${r}`); throw new Error(l); } const { relay: n, controller: i, namespaces: s, expiry: o } = r; - if (!Y8(n)) { + if (!G8(n)) { const { message: l } = ft("MISSING_OR_INVALID", "onSessionSettleRequest() relay protocol should be a string"); throw new Error(l); } @@ -20623,7 +20623,7 @@ class WV extends a$ { throw new Error(l); } }, this.isValidUpdate = async (r) => { - if (!mi(r)) { + if (!gi(r)) { const { message: u } = ft("MISSING_OR_INVALID", `update() params: ${r}`); throw new Error(u); } @@ -20631,24 +20631,24 @@ class WV extends a$ { this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); const s = this.client.session.get(n), o = hm(i, "update()"); if (o) throw new Error(o.message); - const a = i3(s.requiredNamespaces, i, "update()"); + const a = n3(s.requiredNamespaces, i, "update()"); if (a) throw new Error(a.message); }, this.isValidExtend = async (r) => { - if (!mi(r)) { + if (!gi(r)) { const { message: i } = ft("MISSING_OR_INVALID", `extend() params: ${r}`); throw new Error(i); } const { topic: n } = r; this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); }, this.isValidRequest = async (r) => { - if (!mi(r)) { + if (!gi(r)) { const { message: u } = ft("MISSING_OR_INVALID", `request() params: ${r}`); throw new Error(u); } const { topic: n, request: i, chainId: s, expiry: o } = r; this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); const { namespaces: a } = this.client.session.get(n); - if (!n3(a, s)) { + if (!r3(a, s)) { const { message: u } = ft("MISSING_OR_INVALID", `request() chainId: ${s}`); throw new Error(u); } @@ -20666,7 +20666,7 @@ class WV extends a$ { } }, this.isValidRespond = async (r) => { var n; - if (!mi(r)) { + if (!gi(r)) { const { message: o } = ft("MISSING_OR_INVALID", `respond() params: ${r}`); throw new Error(o); } @@ -20681,21 +20681,21 @@ class WV extends a$ { throw new Error(o); } }, this.isValidPing = async (r) => { - if (!mi(r)) { + if (!gi(r)) { const { message: i } = ft("MISSING_OR_INVALID", `ping() params: ${r}`); throw new Error(i); } const { topic: n } = r; await this.isValidSessionOrPairingTopic(n); }, this.isValidEmit = async (r) => { - if (!mi(r)) { + if (!gi(r)) { const { message: a } = ft("MISSING_OR_INVALID", `emit() params: ${r}`); throw new Error(a); } const { topic: n, event: i, chainId: s } = r; await this.isValidSessionTopic(n); const { namespaces: o } = this.client.session.get(n); - if (!n3(o, s)) { + if (!r3(o, s)) { const { message: a } = ft("MISSING_OR_INVALID", `emit() chainId: ${s}`); throw new Error(a); } @@ -20708,7 +20708,7 @@ class WV extends a$ { throw new Error(a); } }, this.isValidDisconnect = async (r) => { - if (!mi(r)) { + if (!gi(r)) { const { message: i } = ft("MISSING_OR_INVALID", `disconnect() params: ${r}`); throw new Error(i); } @@ -20769,11 +20769,11 @@ class WV extends a$ { return this.isLinkModeEnabled(r, n) ? (i = r == null ? void 0 : r.redirect) == null ? void 0 : i.universal : void 0; }, this.handleLinkModeMessage = ({ url: r }) => { if (!r || !r.includes("wc_ev") || !r.includes("topic")) return; - const n = jx(r, "topic") || "", i = decodeURIComponent(jx(r, "wc_ev") || ""), s = this.client.session.keys.includes(n); + const n = Fx(r, "topic") || "", i = decodeURIComponent(Fx(r, "wc_ev") || ""), s = this.client.session.keys.includes(n); s && this.client.session.update(n, { transportType: zr.link_mode }), this.client.core.dispatchEnvelope({ topic: n, message: i, sessionExists: s }); }, this.registerLinkModeListeners = async () => { var r; - if (ob() || qu() && (r = this.client.metadata.redirect) != null && r.linkMode) { + if (sb() || qu() && (r = this.client.metadata.redirect) != null && r.linkMode) { const n = global == null ? void 0 : global.Linking; if (typeof n < "u") { n.addEventListener("url", this.handleLinkModeMessage, this.client.name); @@ -20802,14 +20802,14 @@ class WV extends a$ { async onRelayMessage(e) { const { topic: r, message: n, attestation: i, transportType: s } = e, { publicKey: o } = this.client.auth.authKeys.keys.includes(Rd) ? this.client.auth.authKeys.get(Rd) : { publicKey: void 0 }, a = await this.client.core.crypto.decode(r, n, { receiverPublicKey: o, encoding: s === zr.link_mode ? Af : ha }); try { - hb(a) ? (this.client.core.history.set(r, a), this.onRelayEventRequest({ topic: r, payload: a, attestation: i, transportType: s, encryptedId: xo(n) })) : ip(a) ? (await this.client.core.history.resolve(a), await this.onRelayEventResponse({ topic: r, payload: a, transportType: s }), this.client.core.history.delete(r, a.id)) : this.onRelayEventUnknownPayload({ topic: r, payload: a, transportType: s }); + lb(a) ? (this.client.core.history.set(r, a), this.onRelayEventRequest({ topic: r, payload: a, attestation: i, transportType: s, encryptedId: xo(n) })) : ip(a) ? (await this.client.core.history.resolve(a), await this.onRelayEventResponse({ topic: r, payload: a, transportType: s }), this.client.core.history.delete(r, a.id)) : this.onRelayEventUnknownPayload({ topic: r, payload: a, transportType: s }); } catch (u) { this.client.logger.error(u); } } registerExpirerEvents() { this.client.core.expirer.on(Ji.expired, async (e) => { - const { topic: r, id: n } = F8(e.target); + const { topic: r, id: n } = B8(e.target); if (n && this.client.pendingRequest.keys.includes(n)) return await this.deletePendingSessionRequest(n, ft("EXPIRED"), !0); if (n && this.client.auth.requests.keys.includes(n)) return await this.deletePendingAuthRequest(n, ft("EXPIRED"), !0); r ? this.client.session.keys.includes(r) && (await this.deleteSession({ topic: r, expirerHasDeleted: !0 }), this.client.events.emit("session_expire", { topic: r })) : n && (await this.deleteProposal(n, !0), this.client.events.emit("proposal_expire", { id: n })); @@ -20882,17 +20882,17 @@ class WV extends a$ { } class HV extends Ec { constructor(e, r) { - super(e, r, CV, pb), this.core = e, this.logger = r; + super(e, r, CV, db), this.core = e, this.logger = r; } } let KV = class extends Ec { constructor(e, r) { - super(e, r, TV, pb), this.core = e, this.logger = r; + super(e, r, TV, db), this.core = e, this.logger = r; } }; class VV extends Ec { constructor(e, r) { - super(e, r, DV, pb, (n) => n.id), this.core = e, this.logger = r; + super(e, r, DV, db, (n) => n.id), this.core = e, this.logger = r; } } class GV extends Ec { @@ -20918,9 +20918,9 @@ class XV { await this.authKeys.init(), await this.pairingTopics.init(), await this.requests.init(); } } -class gb extends o$ { +class pb extends o$ { constructor(e) { - super(e), this.protocol = bE, this.version = yE, this.name = mm.name, this.events = new rs.EventEmitter(), this.on = (n, i) => this.events.on(n, i), this.once = (n, i) => this.events.once(n, i), this.off = (n, i) => this.events.off(n, i), this.removeListener = (n, i) => this.events.removeListener(n, i), this.removeAllListeners = (n) => this.events.removeAllListeners(n), this.connect = async (n) => { + super(e), this.protocol = vE, this.version = bE, this.name = mm.name, this.events = new rs.EventEmitter(), this.on = (n, i) => this.events.on(n, i), this.once = (n, i) => this.events.once(n, i), this.off = (n, i) => this.events.off(n, i), this.removeListener = (n, i) => this.events.removeListener(n, i), this.removeAllListeners = (n) => this.events.removeAllListeners(n), this.connect = async (n) => { try { return await this.engine.connect(n); } catch (i) { @@ -21022,12 +21022,12 @@ class gb extends o$ { } catch (i) { throw this.logger.error(i.message), i; } - }, this.name = (e == null ? void 0 : e.name) || mm.name, this.metadata = (e == null ? void 0 : e.metadata) || N8(), this.signConfig = e == null ? void 0 : e.signConfig; + }, this.name = (e == null ? void 0 : e.name) || mm.name, this.metadata = (e == null ? void 0 : e.metadata) || O8(), this.signConfig = e == null ? void 0 : e.signConfig; const r = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : ql($0({ level: (e == null ? void 0 : e.logger) || mm.logger })); - this.core = (e == null ? void 0 : e.core) || new IV(e), this.logger = ui(r, this.name), this.session = new KV(this.core, this.logger), this.proposal = new HV(this.core, this.logger), this.pendingRequest = new VV(this.core, this.logger), this.engine = new WV(this), this.auth = new XV(this.core, this.logger); + this.core = (e == null ? void 0 : e.core) || new IV(e), this.logger = ci(r, this.name), this.session = new KV(this.core, this.logger), this.proposal = new HV(this.core, this.logger), this.pendingRequest = new VV(this.core, this.logger), this.engine = new WV(this), this.auth = new XV(this.core, this.logger); } static async init(e) { - const r = new gb(e); + const r = new pb(e); return await r.initialize(), r; } get context() { @@ -21057,24 +21057,24 @@ var h0 = { exports: {} }; h0.exports; (function(t, e) { (function() { - var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", u = "__lodash_hash_undefined__", l = 500, d = "__lodash_placeholder__", p = 1, w = 2, A = 4, M = 1, N = 2, L = 1, $ = 2, B = 4, H = 8, U = 16, V = 32, te = 64, R = 128, K = 256, ge = 512, Ee = 30, Y = "...", S = 800, m = 16, f = 1, g = 2, b = 3, x = 1 / 0, _ = 9007199254740991, E = 17976931348623157e292, v = NaN, P = 4294967295, I = P - 1, F = P >>> 1, ce = [ + var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", u = "__lodash_hash_undefined__", l = 500, d = "__lodash_placeholder__", p = 1, w = 2, A = 4, M = 1, N = 2, L = 1, B = 2, $ = 4, H = 8, U = 16, V = 32, te = 64, R = 128, K = 256, ge = 512, Ee = 30, Y = "...", S = 800, m = 16, f = 1, g = 2, b = 3, x = 1 / 0, _ = 9007199254740991, E = 17976931348623157e292, v = NaN, P = 4294967295, I = P - 1, F = P >>> 1, ce = [ ["ary", R], ["bind", L], - ["bindKey", $], + ["bindKey", B], ["curry", H], ["curryRight", U], ["flip", ge], ["partial", V], ["partialRight", te], ["rearg", K] - ], D = "[object Arguments]", oe = "[object Array]", Z = "[object AsyncFunction]", J = "[object Boolean]", Q = "[object Date]", T = "[object DOMException]", X = "[object Error]", re = "[object Function]", de = "[object GeneratorFunction]", ie = "[object Map]", ue = "[object Number]", ve = "[object Null]", Pe = "[object Object]", De = "[object Promise]", Ce = "[object Proxy]", $e = "[object RegExp]", Me = "[object Set]", Ne = "[object String]", Ke = "[object Symbol]", Le = "[object Undefined]", qe = "[object WeakMap]", ze = "[object WeakSet]", _e = "[object ArrayBuffer]", Ze = "[object DataView]", at = "[object Float32Array]", ke = "[object Float64Array]", Qe = "[object Int8Array]", tt = "[object Int16Array]", Ye = "[object Int32Array]", dt = "[object Uint8Array]", lt = "[object Uint8ClampedArray]", ct = "[object Uint16Array]", qt = "[object Uint32Array]", Jt = /\b__p \+= '';/g, Et = /\b(__p \+=) '' \+/g, er = /(__e\(.*?\)|\b__t\)) \+\n'';/g, Xt = /&(?:amp|lt|gt|quot|#39);/g, Dt = /[&<>"']/g, kt = RegExp(Xt.source), Ct = RegExp(Dt.source), gt = /<%-([\s\S]+?)%>/g, Rt = /<%([\s\S]+?)%>/g, Nt = /<%=([\s\S]+?)%>/g, vt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $t = /^\w*$/, Ft = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, rt = /[\\^$.*+?()[\]{}|]/g, Bt = RegExp(rt.source), k = /^\s+/, q = /\s/, W = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, C = /\{\n\/\* \[wrapped with (.+)\] \*/, G = /,? & /, j = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, se = /[()=,{}\[\]\/\s]/, he = /\\(\\)?/g, xe = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Te = /\w*$/, Re = /^[-+]0x[0-9a-f]+$/i, nt = /^0b[01]+$/i, je = /^\[object .+?Constructor\]$/, pt = /^0o[0-7]+$/i, it = /^(?:0|[1-9]\d*)$/, et = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, St = /($^)/, Tt = /['\n\r\u2028\u2029\\]/g, At = "\\ud800-\\udfff", _t = "\\u0300-\\u036f", ht = "\\ufe20-\\ufe2f", xt = "\\u20d0-\\u20ff", st = _t + ht + xt, bt = "\\u2700-\\u27bf", ut = "a-z\\xdf-\\xf6\\xf8-\\xff", ot = "\\xac\\xb1\\xd7\\xf7", Se = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Ae = "\\u2000-\\u206f", Ve = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Fe = "A-Z\\xc0-\\xd6\\xd8-\\xde", Ue = "\\ufe0e\\ufe0f", Je = ot + Se + Ae + Ve, Lt = "['’]", zt = "[" + At + "]", Zt = "[" + Je + "]", Wt = "[" + st + "]", le = "\\d+", rr = "[" + bt + "]", dr = "[" + ut + "]", pr = "[^" + At + Je + le + bt + ut + Fe + "]", Qt = "\\ud83c[\\udffb-\\udfff]", gr = "(?:" + Wt + "|" + Qt + ")", lr = "[^" + At + "]", Rr = "(?:\\ud83c[\\udde6-\\uddff]){2}", mr = "[\\ud800-\\udbff][\\udc00-\\udfff]", yr = "[" + Fe + "]", $r = "\\u200d", Br = "(?:" + dr + "|" + pr + ")", Ir = "(?:" + yr + "|" + pr + ")", nn = "(?:" + Lt + "(?:d|ll|m|re|s|t|ve))?", sn = "(?:" + Lt + "(?:D|LL|M|RE|S|T|VE))?", on = gr + "?", lh = "[" + Ue + "]?", Rp = "(?:" + $r + "(?:" + [lr, Rr, mr].join("|") + ")" + lh + on + ")*", io = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", hh = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", dh = lh + on + Rp, Mc = "(?:" + [rr, Rr, mr].join("|") + ")" + dh, Dp = "(?:" + [lr + Wt + "?", Wt, Rr, mr, zt].join("|") + ")", Xu = RegExp(Lt, "g"), Op = RegExp(Wt, "g"), Ic = RegExp(Qt + "(?=" + Qt + ")|" + Dp + dh, "g"), ph = RegExp([ + ], D = "[object Arguments]", oe = "[object Array]", Z = "[object AsyncFunction]", J = "[object Boolean]", Q = "[object Date]", T = "[object DOMException]", X = "[object Error]", re = "[object Function]", pe = "[object GeneratorFunction]", ie = "[object Map]", ue = "[object Number]", ve = "[object Null]", Pe = "[object Object]", De = "[object Promise]", Ce = "[object Proxy]", $e = "[object RegExp]", Me = "[object Set]", Ne = "[object String]", Ke = "[object Symbol]", Le = "[object Undefined]", qe = "[object WeakMap]", ze = "[object WeakSet]", _e = "[object ArrayBuffer]", Ze = "[object DataView]", at = "[object Float32Array]", ke = "[object Float64Array]", Qe = "[object Int8Array]", tt = "[object Int16Array]", Ye = "[object Int32Array]", dt = "[object Uint8Array]", lt = "[object Uint8ClampedArray]", ct = "[object Uint16Array]", qt = "[object Uint32Array]", Jt = /\b__p \+= '';/g, Et = /\b(__p \+=) '' \+/g, er = /(__e\(.*?\)|\b__t\)) \+\n'';/g, Xt = /&(?:amp|lt|gt|quot|#39);/g, Dt = /[&<>"']/g, kt = RegExp(Xt.source), Ct = RegExp(Dt.source), gt = /<%-([\s\S]+?)%>/g, Rt = /<%([\s\S]+?)%>/g, Nt = /<%=([\s\S]+?)%>/g, vt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $t = /^\w*$/, Ft = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, rt = /[\\^$.*+?()[\]{}|]/g, Bt = RegExp(rt.source), k = /^\s+/, q = /\s/, W = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, C = /\{\n\/\* \[wrapped with (.+)\] \*/, G = /,? & /, j = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, se = /[()=,{}\[\]\/\s]/, de = /\\(\\)?/g, xe = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Te = /\w*$/, Re = /^[-+]0x[0-9a-f]+$/i, nt = /^0b[01]+$/i, je = /^\[object .+?Constructor\]$/, pt = /^0o[0-7]+$/i, it = /^(?:0|[1-9]\d*)$/, et = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, St = /($^)/, Tt = /['\n\r\u2028\u2029\\]/g, At = "\\ud800-\\udfff", _t = "\\u0300-\\u036f", ht = "\\ufe20-\\ufe2f", xt = "\\u20d0-\\u20ff", st = _t + ht + xt, bt = "\\u2700-\\u27bf", ut = "a-z\\xdf-\\xf6\\xf8-\\xff", ot = "\\xac\\xb1\\xd7\\xf7", Se = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Ae = "\\u2000-\\u206f", Ve = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Fe = "A-Z\\xc0-\\xd6\\xd8-\\xde", Ue = "\\ufe0e\\ufe0f", Je = ot + Se + Ae + Ve, Lt = "['’]", zt = "[" + At + "]", Zt = "[" + Je + "]", Wt = "[" + st + "]", he = "\\d+", rr = "[" + bt + "]", dr = "[" + ut + "]", pr = "[^" + At + Je + he + bt + ut + Fe + "]", Qt = "\\ud83c[\\udffb-\\udfff]", gr = "(?:" + Wt + "|" + Qt + ")", lr = "[^" + At + "]", Rr = "(?:\\ud83c[\\udde6-\\uddff]){2}", mr = "[\\ud800-\\udbff][\\udc00-\\udfff]", yr = "[" + Fe + "]", $r = "\\u200d", Br = "(?:" + dr + "|" + pr + ")", Ir = "(?:" + yr + "|" + pr + ")", nn = "(?:" + Lt + "(?:d|ll|m|re|s|t|ve))?", sn = "(?:" + Lt + "(?:D|LL|M|RE|S|T|VE))?", on = gr + "?", lh = "[" + Ue + "]?", Rp = "(?:" + $r + "(?:" + [lr, Rr, mr].join("|") + ")" + lh + on + ")*", io = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", hh = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", dh = lh + on + Rp, Mc = "(?:" + [rr, Rr, mr].join("|") + ")" + dh, Dp = "(?:" + [lr + Wt + "?", Wt, Rr, mr, zt].join("|") + ")", Xu = RegExp(Lt, "g"), Op = RegExp(Wt, "g"), Ic = RegExp(Qt + "(?=" + Qt + ")|" + Dp + dh, "g"), ph = RegExp([ yr + "?" + dr + "+" + nn + "(?=" + [Zt, yr, "$"].join("|") + ")", Ir + "+" + sn + "(?=" + [Zt, yr + Br, "$"].join("|") + ")", yr + "?" + Br + "+" + nn, yr + "+" + sn, hh, io, - le, + he, Mc ].join("|"), "g"), gh = RegExp("[" + $r + At + st + Ue + "]"), Da = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, mh = [ "Array", @@ -21323,7 +21323,7 @@ h0.exports; "\r": "r", "\u2028": "u2028", "\u2029": "u2029" - }, jr = parseFloat, nr = parseInt, Kr = typeof gn == "object" && gn && gn.Object === Object && gn, vn = typeof self == "object" && self && self.Object === Object && self, _r = Kr || vn || Function("return this")(), Ur = e && !e.nodeType && e, an = Ur && !0 && t && !t.nodeType && t, fi = an && an.exports === Ur, bn = fi && Kr.process, Vr = function() { + }, jr = parseFloat, nr = parseInt, Kr = typeof gn == "object" && gn && gn.Object === Object && gn, vn = typeof self == "object" && self && self.Object === Object && self, _r = Kr || vn || Function("return this")(), Ur = e && !e.nodeType && e, an = Ur && !0 && t && !t.nodeType && t, ui = an && an.exports === Ur, bn = ui && Kr.process, Vr = function() { try { var be = an && an.require && an.require("util").types; return be || bn && bn.binding && bn.binding("util"); @@ -21360,7 +21360,7 @@ h0.exports; ; return be; } - function my(be, Be) { + function gy(be, Be) { for (var Ie = -1, It = be == null ? 0 : be.length; ++Ie < It; ) if (!Be(be[Ie], Ie, be)) return !1; @@ -21418,7 +21418,7 @@ h0.exports; function cA(be) { return be.match(j) || []; } - function vy(be, Be, Ie) { + function my(be, Be, Ie) { var It; return Ie(be, function(tr, Pr, xn) { if (Be(tr, Pr, xn)) @@ -21432,7 +21432,7 @@ h0.exports; return -1; } function Cc(be, Be, Ie) { - return Be === Be ? wA(be, Be, Ie) : bh(be, by, Ie); + return Be === Be ? wA(be, Be, Ie) : bh(be, vy, Ie); } function uA(be, Be, Ie, It) { for (var tr = Ie - 1, Pr = be.length; ++tr < Pr; ) @@ -21440,10 +21440,10 @@ h0.exports; return tr; return -1; } - function by(be) { + function vy(be) { return be !== be; } - function yy(be, Be) { + function by(be, Be) { var Ie = be == null ? 0 : be.length; return Ie ? jp(be, Be) / Ie : v; } @@ -21457,7 +21457,7 @@ h0.exports; return be == null ? r : be[Be]; }; } - function wy(be, Be, Ie, It, tr) { + function yy(be, Be, Ie, It, tr) { return tr(be, function(Pr, xn, qr) { Ie = It ? (It = !1, Pr) : Be(Ie, Pr, xn, qr); }), Ie; @@ -21485,8 +21485,8 @@ h0.exports; return [Ie, be[Ie]]; }); } - function xy(be) { - return be && be.slice(0, Ay(be) + 1).replace(k, ""); + function wy(be) { + return be && be.slice(0, Sy(be) + 1).replace(k, ""); } function Pi(be) { return function(Be) { @@ -21501,12 +21501,12 @@ h0.exports; function Qu(be, Be) { return be.has(Be); } - function _y(be, Be) { + function xy(be, Be) { for (var Ie = -1, It = be.length; ++Ie < It && Cc(Be, be[Ie], 0) > -1; ) ; return Ie; } - function Ey(be, Be) { + function _y(be, Be) { for (var Ie = be.length; Ie-- && Cc(Be, be[Ie], 0) > -1; ) ; return Ie; @@ -21540,7 +21540,7 @@ h0.exports; Ie[++Be] = [tr, It]; }), Ie; } - function Sy(be, Be) { + function Ey(be, Be) { return function(Ie) { return be(Be(Ie)); }; @@ -21582,7 +21582,7 @@ h0.exports; function ls(be) { return Tc(be) ? SA(be) : aA(be); } - function Ay(be) { + function Sy(be) { for (var Be = be.length; Be-- && q.test(be.charAt(Be)); ) ; return Be; @@ -21601,24 +21601,24 @@ h0.exports; } var PA = function be(Be) { Be = Be == null ? _r : Dc.defaults(_r.Object(), Be, Dc.pick(_r, mh)); - var Ie = Be.Array, It = Be.Date, tr = Be.Error, Pr = Be.Function, xn = Be.Math, qr = Be.Object, Wp = Be.RegExp, MA = Be.String, Ui = Be.TypeError, wh = Ie.prototype, IA = Pr.prototype, Oc = qr.prototype, xh = Be["__core-js_shared__"], _h = IA.toString, Tr = Oc.hasOwnProperty, CA = 0, Py = function() { + var Ie = Be.Array, It = Be.Date, tr = Be.Error, Pr = Be.Function, xn = Be.Math, qr = Be.Object, Wp = Be.RegExp, MA = Be.String, Ui = Be.TypeError, wh = Ie.prototype, IA = Pr.prototype, Oc = qr.prototype, xh = Be["__core-js_shared__"], _h = IA.toString, Tr = Oc.hasOwnProperty, CA = 0, Ay = function() { var c = /[^.]+$/.exec(xh && xh.keys && xh.keys.IE_PROTO || ""); return c ? "Symbol(src)_1." + c : ""; }(), Eh = Oc.toString, TA = _h.call(qr), RA = _r._, DA = Wp( "^" + _h.call(Tr).replace(rt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" - ), Sh = fi ? Be.Buffer : r, Vo = Be.Symbol, Ah = Be.Uint8Array, My = Sh ? Sh.allocUnsafe : r, Ph = Sy(qr.getPrototypeOf, qr), Iy = qr.create, Cy = Oc.propertyIsEnumerable, Mh = wh.splice, Ty = Vo ? Vo.isConcatSpreadable : r, ef = Vo ? Vo.iterator : r, Na = Vo ? Vo.toStringTag : r, Ih = function() { + ), Sh = ui ? Be.Buffer : r, Vo = Be.Symbol, Ah = Be.Uint8Array, Py = Sh ? Sh.allocUnsafe : r, Ph = Ey(qr.getPrototypeOf, qr), My = qr.create, Iy = Oc.propertyIsEnumerable, Mh = wh.splice, Cy = Vo ? Vo.isConcatSpreadable : r, ef = Vo ? Vo.iterator : r, Na = Vo ? Vo.toStringTag : r, Ih = function() { try { var c = Fa(qr, "defineProperty"); return c({}, "", {}), c; } catch { } - }(), OA = Be.clearTimeout !== _r.clearTimeout && Be.clearTimeout, NA = It && It.now !== _r.Date.now && It.now, LA = Be.setTimeout !== _r.setTimeout && Be.setTimeout, Ch = xn.ceil, Th = xn.floor, Hp = qr.getOwnPropertySymbols, kA = Sh ? Sh.isBuffer : r, Ry = Be.isFinite, $A = wh.join, BA = Sy(qr.keys, qr), _n = xn.max, Kn = xn.min, FA = It.now, jA = Be.parseInt, Dy = xn.random, UA = wh.reverse, Kp = Fa(Be, "DataView"), tf = Fa(Be, "Map"), Vp = Fa(Be, "Promise"), Nc = Fa(Be, "Set"), rf = Fa(Be, "WeakMap"), nf = Fa(qr, "create"), Rh = rf && new rf(), Lc = {}, qA = ja(Kp), zA = ja(tf), WA = ja(Vp), HA = ja(Nc), KA = ja(rf), Dh = Vo ? Vo.prototype : r, sf = Dh ? Dh.valueOf : r, Oy = Dh ? Dh.toString : r; + }(), OA = Be.clearTimeout !== _r.clearTimeout && Be.clearTimeout, NA = It && It.now !== _r.Date.now && It.now, LA = Be.setTimeout !== _r.setTimeout && Be.setTimeout, Ch = xn.ceil, Th = xn.floor, Hp = qr.getOwnPropertySymbols, kA = Sh ? Sh.isBuffer : r, Ty = Be.isFinite, $A = wh.join, BA = Ey(qr.keys, qr), _n = xn.max, Kn = xn.min, FA = It.now, jA = Be.parseInt, Ry = xn.random, UA = wh.reverse, Kp = Fa(Be, "DataView"), tf = Fa(Be, "Map"), Vp = Fa(Be, "Promise"), Nc = Fa(Be, "Set"), rf = Fa(Be, "WeakMap"), nf = Fa(qr, "create"), Rh = rf && new rf(), Lc = {}, qA = ja(Kp), zA = ja(tf), WA = ja(Vp), HA = ja(Nc), KA = ja(rf), Dh = Vo ? Vo.prototype : r, sf = Dh ? Dh.valueOf : r, Dy = Dh ? Dh.toString : r; function ee(c) { if (en(c) && !ir(c) && !(c instanceof wr)) { if (c instanceof qi) return c; if (Tr.call(c, "__wrapped__")) - return Nw(c); + return Ow(c); } return new qi(c); } @@ -21628,8 +21628,8 @@ h0.exports; return function(h) { if (!Zr(h)) return {}; - if (Iy) - return Iy(h); + if (My) + return My(h); c.prototype = h; var y = new c(); return c.prototype = r, y; @@ -21690,7 +21690,7 @@ h0.exports; } function VA() { var c = new wr(this.__wrapped__); - return c.__actions__ = li(this.__actions__), c.__dir__ = this.__dir__, c.__filtered__ = this.__filtered__, c.__iteratees__ = li(this.__iteratees__), c.__takeCount__ = this.__takeCount__, c.__views__ = li(this.__views__), c; + return c.__actions__ = fi(this.__actions__), c.__dir__ = this.__dir__, c.__filtered__ = this.__filtered__, c.__iteratees__ = fi(this.__iteratees__), c.__takeCount__ = this.__takeCount__, c.__views__ = fi(this.__views__), c; } function GA() { if (this.__filtered__) { @@ -21703,7 +21703,7 @@ h0.exports; function YA() { var c = this.__wrapped__.value(), h = this.__dir__, y = ir(c), O = h < 0, z = y ? c.length : 0, ne = aM(0, z, this.__views__), fe = ne.start, me = ne.end, we = me - fe, We = O ? me : fe - 1, He = this.__iteratees__, Xe = He.length, wt = 0, Ot = Kn(we, this.__takeCount__); if (!y || !O && z == we && Ot == we) - return nw(c, this.__actions__); + return rw(c, this.__actions__); var Ht = []; e: for (; we-- && wt < Ot; ) { @@ -21852,7 +21852,7 @@ h0.exports; return y.set(c, h), this.size = y.size, this; } hs.prototype.clear = dP, hs.prototype.delete = pP, hs.prototype.get = gP, hs.prototype.has = mP, hs.prototype.set = vP; - function Ny(c, h) { + function Oy(c, h) { var y = ir(c), O = !y && Ua(c), z = !y && !O && Zo(c), ne = !y && !O && !z && jc(c), fe = y || O || z || ne, me = fe ? Up(c.length, MA) : [], we = me.length; for (var We in c) (h || Tr.call(c, We)) && !(fe && // Safari 9 has enumerable `arguments.length` in strict mode. @@ -21862,15 +21862,15 @@ h0.exports; fo(We, we))) && me.push(We); return me; } - function Ly(c) { + function Ny(c) { var h = c.length; return h ? c[ig(0, h - 1)] : r; } function bP(c, h) { - return Vh(li(c), $a(h, 0, c.length)); + return Vh(fi(c), $a(h, 0, c.length)); } function yP(c) { - return Vh(li(c)); + return Vh(fi(c)); } function Gp(c, h, y) { (y !== r && !ds(c[h], y) || y === r && !(h in c)) && ao(c, h, y); @@ -21890,11 +21890,11 @@ h0.exports; h(O, z, y(z), fe); }), O; } - function ky(c, h) { + function Ly(c, h) { return c && Ts(h, Mn(h), c); } function xP(c, h) { - return c && Ts(h, di(h), c); + return c && Ts(h, hi(h), c); } function ao(c, h, y) { h == "__proto__" && Ih ? Ih(c, h, { @@ -21921,14 +21921,14 @@ h0.exports; var He = ir(c); if (He) { if (fe = uM(c), !me) - return li(c, fe); + return fi(c, fe); } else { - var Xe = Vn(c), wt = Xe == re || Xe == de; + var Xe = Vn(c), wt = Xe == re || Xe == pe; if (Zo(c)) - return ow(c, me); + return sw(c, me); if (Xe == Pe || Xe == D || wt && !z) { - if (fe = we || wt ? {} : Aw(c), !me) - return we ? ZP(c, xP(fe, c)) : XP(c, ky(fe, c)); + if (fe = we || wt ? {} : Sw(c), !me) + return we ? ZP(c, xP(fe, c)) : XP(c, Ly(fe, c)); } else { if (!Dr[Xe]) return z ? c : {}; @@ -21939,12 +21939,12 @@ h0.exports; var Ot = ne.get(c); if (Ot) return Ot; - ne.set(c, fe), e2(c) ? c.forEach(function(Kt) { + ne.set(c, fe), Qw(c) ? c.forEach(function(Kt) { fe.add(zi(Kt, h, y, Kt, c, ne)); - }) : Zw(c) && c.forEach(function(Kt, vr) { + }) : Xw(c) && c.forEach(function(Kt, vr) { fe.set(vr, zi(Kt, h, y, vr, c, ne)); }); - var Ht = We ? we ? gg : pg : we ? di : Mn, fr = He ? r : Ht(c); + var Ht = We ? we ? gg : pg : we ? hi : Mn, fr = He ? r : Ht(c); return ji(fr || c, function(Kt, vr) { fr && (vr = Kt, Kt = c[vr]), of(fe, vr, zi(Kt, h, y, vr, c, ne)); }), fe; @@ -21952,10 +21952,10 @@ h0.exports; function _P(c) { var h = Mn(c); return function(y) { - return $y(y, c, h); + return ky(y, c, h); }; } - function $y(c, h, y) { + function ky(c, h, y) { var O = y.length; if (c == null) return !O; @@ -21966,7 +21966,7 @@ h0.exports; } return !0; } - function By(c, h, y) { + function $y(c, h, y) { if (typeof c != "function") throw new Ui(o); return df(function() { @@ -21990,7 +21990,7 @@ h0.exports; } return we; } - var Go = lw(Cs), Fy = lw(Xp, !0); + var Go = fw(Cs), By = fw(Xp, !0); function EP(c, h) { var y = !0; return Go(c, function(O, z, ne) { @@ -22007,11 +22007,11 @@ h0.exports; } function SP(c, h, y, O) { var z = c.length; - for (y = cr(y), y < 0 && (y = -y > z ? 0 : z + y), O = O === r || O > z ? z : cr(O), O < 0 && (O += z), O = y > O ? 0 : r2(O); y < O; ) + for (y = cr(y), y < 0 && (y = -y > z ? 0 : z + y), O = O === r || O > z ? z : cr(O), O < 0 && (O += z), O = y > O ? 0 : t2(O); y < O; ) c[y++] = h; return c; } - function jy(c, h) { + function Fy(c, h) { var y = []; return Go(c, function(O, z, ne) { h(O, z, ne) && y.push(O); @@ -22025,12 +22025,12 @@ h0.exports; } return z; } - var Jp = hw(), Uy = hw(!0); + var Jp = lw(), jy = lw(!0); function Cs(c, h) { return c && Jp(c, h, Mn); } function Xp(c, h) { - return c && Uy(c, h, Mn); + return c && jy(c, h, Mn); } function kh(c, h) { return Wo(h, function(y) { @@ -22043,7 +22043,7 @@ h0.exports; c = c[Rs(h[y++])]; return y && y == O ? c : r; } - function qy(c, h, y) { + function Uy(c, h, y) { var O = h(c); return ir(c) ? O : Ho(O, y(c)); } @@ -22089,11 +22089,11 @@ h0.exports; }), O; } function cf(c, h, y) { - h = Jo(h, c), c = Cw(c, h); + h = Jo(h, c), c = Iw(c, h); var O = c == null ? c : c[Rs(Hi(h))]; return O == null ? r : Pn(O, c, y); } - function zy(c) { + function qy(c) { return en(c) && ri(c) == D; } function CP(c) { @@ -22115,7 +22115,7 @@ h0.exports; fe = !0, He = !1; } if (wt && !He) - return ne || (ne = new hs()), fe || jc(c) ? _w(c, h, y, O, z, ne) : iM(c, h, we, y, O, z, ne); + return ne || (ne = new hs()), fe || jc(c) ? xw(c, h, y, O, z, ne) : iM(c, h, we, y, O, z, ne); if (!(y & M)) { var Ot = He && Tr.call(c, "__wrapped__"), Ht = Xe && Tr.call(h, "__wrapped__"); if (Ot || Ht) { @@ -22153,7 +22153,7 @@ h0.exports; } return !0; } - function Wy(c) { + function zy(c) { if (!Zr(c) || pM(c)) return !1; var h = lo(c) ? DA : je; @@ -22168,8 +22168,8 @@ h0.exports; function LP(c) { return en(c) && Qh(c.length) && !!Fr[ri(c)]; } - function Hy(c) { - return typeof c == "function" ? c : c == null ? pi : typeof c == "object" ? ir(c) ? Gy(c[0], c[1]) : Vy(c) : d2(c); + function Wy(c) { + return typeof c == "function" ? c : c == null ? di : typeof c == "object" ? ir(c) ? Vy(c[0], c[1]) : Ky(c) : h2(c); } function tg(c) { if (!hf(c)) @@ -22190,20 +22190,20 @@ h0.exports; function rg(c, h) { return c < h; } - function Ky(c, h) { - var y = -1, O = hi(c) ? Ie(c.length) : []; + function Hy(c, h) { + var y = -1, O = li(c) ? Ie(c.length) : []; return Go(c, function(z, ne, fe) { O[++y] = h(z, ne, fe); }), O; } - function Vy(c) { + function Ky(c) { var h = vg(c); - return h.length == 1 && h[0][2] ? Mw(h[0][0], h[0][1]) : function(y) { + return h.length == 1 && h[0][2] ? Pw(h[0][0], h[0][1]) : function(y) { return y === c || eg(y, c, h); }; } - function Gy(c, h) { - return yg(c) && Pw(h) ? Mw(Rs(c), h) : function(y) { + function Vy(c, h) { + return yg(c) && Aw(h) ? Pw(Rs(c), h) : function(y) { var O = Cg(y, c); return O === r && O === h ? Tg(y, c) : uf(h, O, M | N); }; @@ -22216,7 +22216,7 @@ h0.exports; var me = O ? O(xg(c, fe), ne, fe + "", c, h, z) : r; me === r && (me = ne), Gp(c, fe, me); } - }, di); + }, hi); } function $P(c, h, y, O, z, ne, fe) { var me = xg(c, y), we = xg(h, y), We = fe.get(we); @@ -22227,24 +22227,24 @@ h0.exports; var He = ne ? ne(me, we, y + "", c, h, fe) : r, Xe = He === r; if (Xe) { var wt = ir(we), Ot = !wt && Zo(we), Ht = !wt && !Ot && jc(we); - He = we, wt || Ot || Ht ? ir(me) ? He = me : cn(me) ? He = li(me) : Ot ? (Xe = !1, He = ow(we, !0)) : Ht ? (Xe = !1, He = aw(we, !0)) : He = [] : pf(we) || Ua(we) ? (He = me, Ua(me) ? He = n2(me) : (!Zr(me) || lo(me)) && (He = Aw(we))) : Xe = !1; + He = we, wt || Ot || Ht ? ir(me) ? He = me : cn(me) ? He = fi(me) : Ot ? (Xe = !1, He = sw(we, !0)) : Ht ? (Xe = !1, He = ow(we, !0)) : He = [] : pf(we) || Ua(we) ? (He = me, Ua(me) ? He = r2(me) : (!Zr(me) || lo(me)) && (He = Sw(we))) : Xe = !1; } Xe && (fe.set(we, He), z(He, we, O, ne, fe), fe.delete(we)), Gp(c, y, He); } - function Yy(c, h) { + function Gy(c, h) { var y = c.length; if (y) return h += h < 0 ? y : 0, fo(h, y) ? c[h] : r; } - function Jy(c, h, y) { + function Yy(c, h, y) { h.length ? h = Xr(h, function(ne) { return ir(ne) ? function(fe) { return Ba(fe, ne.length === 1 ? ne[0] : ne); } : ne; - }) : h = [pi]; + }) : h = [di]; var O = -1; h = Xr(h, Pi(Ut())); - var z = Ky(c, function(ne, fe, me) { + var z = Hy(c, function(ne, fe, me) { var we = Xr(h, function(We) { return We(ne); }); @@ -22255,11 +22255,11 @@ h0.exports; }); } function BP(c, h) { - return Xy(c, h, function(y, O) { + return Jy(c, h, function(y, O) { return Tg(c, O); }); } - function Xy(c, h, y) { + function Jy(c, h, y) { for (var O = -1, z = h.length, ne = {}; ++O < z; ) { var fe = h[O], me = Ba(c, fe); y(me, fe) && ff(ne, Jo(fe, c), me); @@ -22273,12 +22273,12 @@ h0.exports; } function ng(c, h, y, O) { var z = O ? uA : Cc, ne = -1, fe = h.length, me = c; - for (c === h && (h = li(h)), y && (me = Xr(c, Pi(y))); ++ne < fe; ) + for (c === h && (h = fi(h)), y && (me = Xr(c, Pi(y))); ++ne < fe; ) for (var we = 0, We = h[ne], He = y ? y(We) : We; (we = z(me, He, we, O)) > -1; ) me !== c && Mh.call(me, we, 1), Mh.call(c, we, 1); return c; } - function Zy(c, h) { + function Xy(c, h) { for (var y = c ? h.length : 0, O = y - 1; y--; ) { var z = h[y]; if (y == O || z !== ne) { @@ -22289,7 +22289,7 @@ h0.exports; return c; } function ig(c, h) { - return c + Th(Dy() * (h - c + 1)); + return c + Th(Ry() * (h - c + 1)); } function jP(c, h, y, O) { for (var z = -1, ne = _n(Ch((h - c) / (y || 1)), 0), fe = Ie(ne); ne--; ) @@ -22306,10 +22306,10 @@ h0.exports; return y; } function hr(c, h) { - return _g(Iw(c, h, pi), c + ""); + return _g(Mw(c, h, di), c + ""); } function UP(c) { - return Ly(Uc(c)); + return Ny(Uc(c)); } function qP(c, h) { var y = Uc(c); @@ -22331,16 +22331,16 @@ h0.exports; } return c; } - var Qy = Rh ? function(c, h) { + var Zy = Rh ? function(c, h) { return Rh.set(c, h), c; - } : pi, zP = Ih ? function(c, h) { + } : di, zP = Ih ? function(c, h) { return Ih(c, "toString", { configurable: !0, enumerable: !1, value: Dg(h), writable: !0 }); - } : pi; + } : di; function WP(c) { return Vh(Uc(c)); } @@ -22366,7 +22366,7 @@ h0.exports; } return z; } - return og(c, h, pi, y); + return og(c, h, di, y); } function og(c, h, y, O) { var z = 0, ne = c == null ? 0 : c.length; @@ -22382,7 +22382,7 @@ h0.exports; } return Kn(ne, I); } - function ew(c, h) { + function Qy(c, h) { for (var y = -1, O = c.length, z = 0, ne = []; ++y < O; ) { var fe = c[y], me = h ? h(fe) : fe; if (!y || !ds(me, we)) { @@ -22392,7 +22392,7 @@ h0.exports; } return ne; } - function tw(c) { + function ew(c) { return typeof c == "number" ? c : Ii(c) ? v : +c; } function Mi(c) { @@ -22401,7 +22401,7 @@ h0.exports; if (ir(c)) return Xr(c, Mi) + ""; if (Ii(c)) - return Oy ? Oy.call(c) : ""; + return Dy ? Dy.call(c) : ""; var h = c + ""; return h == "0" && 1 / c == -x ? "-0" : h; } @@ -22429,9 +22429,9 @@ h0.exports; return me; } function ag(c, h) { - return h = Jo(h, c), c = Cw(c, h), c == null || delete c[Rs(Hi(h))]; + return h = Jo(h, c), c = Iw(c, h), c == null || delete c[Rs(Hi(h))]; } - function rw(c, h, y, O) { + function tw(c, h, y, O) { return ff(c, h, y(Ba(c, h)), O); } function Fh(c, h, y, O) { @@ -22439,7 +22439,7 @@ h0.exports; ; return y ? Wi(c, O ? 0 : ne, O ? ne + 1 : z) : Wi(c, O ? ne + 1 : 0, O ? z : ne); } - function nw(c, h) { + function rw(c, h) { var y = c; return y instanceof wr && (y = y.value()), kp(h, function(O, z) { return z.func.apply(z.thisArg, Ho([O], z.args)); @@ -22454,7 +22454,7 @@ h0.exports; me != z && (ne[z] = af(ne[z] || fe, c[me], h, y)); return Yo(Bn(ne, 1), h, y); } - function iw(c, h, y) { + function nw(c, h, y) { for (var O = -1, z = c.length, ne = h.length, fe = {}; ++O < z; ) { var me = O < ne ? h[O] : r; y(fe, c[O], me); @@ -22465,23 +22465,23 @@ h0.exports; return cn(c) ? c : []; } function fg(c) { - return typeof c == "function" ? c : pi; + return typeof c == "function" ? c : di; } function Jo(c, h) { - return ir(c) ? c : yg(c, h) ? [c] : Ow(Cr(c)); + return ir(c) ? c : yg(c, h) ? [c] : Dw(Cr(c)); } var KP = hr; function Xo(c, h, y) { var O = c.length; return y = y === r ? O : y, !h && y >= O ? c : Wi(c, h, y); } - var sw = OA || function(c) { + var iw = OA || function(c) { return _r.clearTimeout(c); }; - function ow(c, h) { + function sw(c, h) { if (h) return c.slice(); - var y = c.length, O = My ? My(y) : new c.constructor(y); + var y = c.length, O = Py ? Py(y) : new c.constructor(y); return c.copy(O), O; } function lg(c) { @@ -22499,11 +22499,11 @@ h0.exports; function YP(c) { return sf ? qr(sf.call(c)) : {}; } - function aw(c, h) { + function ow(c, h) { var y = h ? lg(c.buffer) : c.buffer; return new c.constructor(y, c.byteOffset, c.length); } - function cw(c, h) { + function aw(c, h) { if (c !== h) { var y = c !== r, O = c === null, z = c === c, ne = Ii(c), fe = h !== r, me = h === null, we = h === h, We = Ii(h); if (!me && !We && !ne && c > h || ne && fe && we && !me && !We || O && fe && we || !y && we || !z) @@ -22515,7 +22515,7 @@ h0.exports; } function JP(c, h, y) { for (var O = -1, z = c.criteria, ne = h.criteria, fe = z.length, me = y.length; ++O < fe; ) { - var we = cw(z[O], ne[O]); + var we = aw(z[O], ne[O]); if (we) { if (O >= me) return we; @@ -22525,7 +22525,7 @@ h0.exports; } return c.index - h.index; } - function uw(c, h, y, O) { + function cw(c, h, y, O) { for (var z = -1, ne = c.length, fe = y.length, me = -1, we = h.length, We = _n(ne - fe, 0), He = Ie(we + We), Xe = !O; ++me < we; ) He[me] = h[me]; for (; ++z < fe; ) @@ -22534,7 +22534,7 @@ h0.exports; He[me++] = c[z++]; return He; } - function fw(c, h, y, O) { + function uw(c, h, y, O) { for (var z = -1, ne = c.length, fe = -1, me = y.length, we = -1, We = h.length, He = _n(ne - me, 0), Xe = Ie(He + We), wt = !O; ++z < He; ) Xe[z] = c[z]; for (var Ot = z; ++we < We; ) @@ -22543,7 +22543,7 @@ h0.exports; (wt || z < ne) && (Xe[Ot + y[fe]] = c[z++]); return Xe; } - function li(c, h) { + function fi(c, h) { var y = -1, O = c.length; for (h || (h = Ie(O)); ++y < O; ) h[y] = c[y]; @@ -22562,7 +22562,7 @@ h0.exports; return Ts(c, bg(c), h); } function ZP(c, h) { - return Ts(c, Ew(c), h); + return Ts(c, _w(c), h); } function jh(c, h) { return function(y, O) { @@ -22580,18 +22580,18 @@ h0.exports; return h; }); } - function lw(c, h) { + function fw(c, h) { return function(y, O) { if (y == null) return y; - if (!hi(y)) + if (!li(y)) return c(y, O); for (var z = y.length, ne = h ? z : -1, fe = qr(y); (h ? ne-- : ++ne < z) && O(fe[ne], ne, fe) !== !1; ) ; return y; }; } - function hw(c) { + function lw(c) { return function(h, y, O) { for (var z = -1, ne = qr(h), fe = O(h), me = fe.length; me--; ) { var we = fe[c ? me : ++z]; @@ -22609,7 +22609,7 @@ h0.exports; } return ne; } - function dw(c) { + function hw(c) { return function(h) { h = Cr(h); var y = Tc(h) ? ls(h) : r, O = y ? y[0] : h.charAt(0), z = y ? Xo(y, 1).join("") : h.slice(1); @@ -22618,7 +22618,7 @@ h0.exports; } function Bc(c) { return function(h) { - return kp(l2(f2(h).replace(Xu, "")), c, ""); + return kp(f2(u2(h).replace(Xu, "")), c, ""); }; } function lf(c) { @@ -22653,7 +22653,7 @@ h0.exports; fe[me] = arguments[me]; var We = ne < 3 && fe[0] !== we && fe[ne - 1] !== we ? [] : Ko(fe, we); if (ne -= We.length, ne < y) - return bw( + return vw( c, h, Uh, @@ -22670,10 +22670,10 @@ h0.exports; } return z; } - function pw(c) { + function dw(c) { return function(h, y, O) { var z = qr(h); - if (!hi(h)) { + if (!li(h)) { var ne = Ut(y, 3); h = Mn(h), y = function(me) { return ne(z[me], me, z); @@ -22683,7 +22683,7 @@ h0.exports; return fe > -1 ? z[ne ? h[fe] : fe] : r; }; } - function gw(c) { + function pw(c) { return uo(function(h) { var y = h.length, O = y, z = qi.prototype.thru; for (c && h.reverse(); O--; ) { @@ -22709,15 +22709,15 @@ h0.exports; }); } function Uh(c, h, y, O, z, ne, fe, me, we, We) { - var He = h & R, Xe = h & L, wt = h & $, Ot = h & (H | U), Ht = h & ge, fr = wt ? r : lf(c); + var He = h & R, Xe = h & L, wt = h & B, Ot = h & (H | U), Ht = h & ge, fr = wt ? r : lf(c); function Kt() { for (var vr = arguments.length, Er = Ie(vr), Ci = vr; Ci--; ) Er[Ci] = arguments[Ci]; if (Ot) var ii = Fc(Kt), Ti = hA(Er, ii); - if (O && (Er = uw(Er, O, z, Ot)), ne && (Er = fw(Er, ne, fe, Ot)), vr -= Ti, Ot && vr < We) { + if (O && (Er = cw(Er, O, z, Ot)), ne && (Er = uw(Er, ne, fe, Ot)), vr -= Ti, Ot && vr < We) { var un = Ko(Er, ii); - return bw( + return vw( c, h, Uh, @@ -22735,7 +22735,7 @@ h0.exports; } return Kt; } - function mw(c, h) { + function gw(c, h) { return function(y, O) { return IP(y, c, h(O), {}); }; @@ -22748,7 +22748,7 @@ h0.exports; if (y !== r && (z = y), O !== r) { if (z === r) return O; - typeof y == "string" || typeof O == "string" ? (y = Mi(y), O = Mi(O)) : (y = tw(y), O = tw(O)), z = c(y, O); + typeof y == "string" || typeof O == "string" ? (y = Mi(y), O = Mi(O)) : (y = ew(y), O = ew(O)), z = c(y, O); } return z; }; @@ -22782,7 +22782,7 @@ h0.exports; } return fe; } - function vw(c) { + function mw(c) { return function(h, y, O) { return O && typeof O != "number" && ni(h, y, O) && (y = O = r), h = ho(h), y === r ? (y = h, h = 0) : y = ho(y), O = O === r ? h < y ? 1 : -1 : ho(O), jP(h, y, O, c); }; @@ -22792,9 +22792,9 @@ h0.exports; return typeof h == "string" && typeof y == "string" || (h = Ki(h), y = Ki(y)), c(h, y); }; } - function bw(c, h, y, O, z, ne, fe, me, we, We) { + function vw(c, h, y, O, z, ne, fe, me, we, We) { var He = h & H, Xe = He ? fe : r, wt = He ? r : fe, Ot = He ? ne : r, Ht = He ? r : ne; - h |= He ? V : te, h &= ~(He ? te : V), h & B || (h &= ~(L | $)); + h |= He ? V : te, h &= ~(He ? te : V), h & $ || (h &= ~(L | B)); var fr = [ c, h, @@ -22807,12 +22807,12 @@ h0.exports; we, We ], Kt = y.apply(r, fr); - return wg(c) && Tw(Kt, fr), Kt.placeholder = O, Rw(Kt, c, h); + return wg(c) && Cw(Kt, fr), Kt.placeholder = O, Tw(Kt, c, h); } function dg(c) { var h = xn[c]; return function(y, O) { - if (y = Ki(y), O = O == null ? 0 : Kn(cr(O), 292), O && Ry(y)) { + if (y = Ki(y), O = O == null ? 0 : Kn(cr(O), 292), O && Ty(y)) { var z = (Cr(y) + "e").split("e"), ne = h(z[0] + "e" + (+z[1] + O)); return z = (Cr(ne) + "e").split("e"), +(z[0] + "e" + (+z[1] - O)); } @@ -22822,14 +22822,14 @@ h0.exports; var rM = Nc && 1 / yh(new Nc([, -0]))[1] == x ? function(c) { return new Nc(c); } : Lg; - function yw(c) { + function bw(c) { return function(h) { var y = Vn(h); return y == ie ? zp(h) : y == Me ? yA(h) : lA(h, c(h)); }; } function co(c, h, y, O, z, ne, fe, me) { - var we = h & $; + var we = h & B; if (!we && typeof c != "function") throw new Ui(o); var We = O ? O.length : 0; @@ -22852,19 +22852,19 @@ h0.exports; if (wt && vM(Ot, wt), c = Ot[0], h = Ot[1], y = Ot[2], O = Ot[3], z = Ot[4], me = Ot[9] = Ot[9] === r ? we ? 0 : c.length : _n(Ot[9] - We, 0), !me && h & (H | U) && (h &= ~(H | U)), !h || h == L) var Ht = QP(c, h, y); else h == H || h == U ? Ht = eM(c, h, me) : (h == V || h == (L | V)) && !z.length ? Ht = tM(c, h, y, O) : Ht = Uh.apply(r, Ot); - var fr = wt ? Qy : Tw; - return Rw(fr(Ht, Ot), c, h); + var fr = wt ? Zy : Cw; + return Tw(fr(Ht, Ot), c, h); } - function ww(c, h, y, O) { + function yw(c, h, y, O) { return c === r || ds(c, Oc[y]) && !Tr.call(O, y) ? h : c; } - function xw(c, h, y, O, z, ne) { - return Zr(c) && Zr(h) && (ne.set(h, c), $h(c, h, r, xw, ne), ne.delete(h)), c; + function ww(c, h, y, O, z, ne) { + return Zr(c) && Zr(h) && (ne.set(h, c), $h(c, h, r, ww, ne), ne.delete(h)), c; } function nM(c) { return pf(c) ? r : c; } - function _w(c, h, y, O, z, ne) { + function xw(c, h, y, O, z, ne) { var fe = y & M, me = c.length, we = h.length; if (me != we && !(fe && we > me)) return !1; @@ -22924,7 +22924,7 @@ h0.exports; if (We) return We == h; O |= N, fe.set(c, h); - var He = _w(me(c), me(h), O, z, ne, fe); + var He = xw(me(c), me(h), O, z, ne, fe); return fe.delete(c), He; case Ke: if (sf) @@ -22964,13 +22964,13 @@ h0.exports; return ne.delete(c), ne.delete(h), fr; } function uo(c) { - return _g(Iw(c, r, $w), c + ""); + return _g(Mw(c, r, kw), c + ""); } function pg(c) { - return qy(c, Mn, bg); + return Uy(c, Mn, bg); } function gg(c) { - return qy(c, di, Ew); + return Uy(c, hi, _w); } var mg = Rh ? function(c) { return Rh.get(c); @@ -22989,7 +22989,7 @@ h0.exports; } function Ut() { var c = ee.iteratee || Og; - return c = c === Og ? Hy : c, arguments.length ? c(arguments[0], arguments[1]) : c; + return c = c === Og ? Wy : c, arguments.length ? c(arguments[0], arguments[1]) : c; } function Kh(c, h) { var y = c.__data__; @@ -22998,13 +22998,13 @@ h0.exports; function vg(c) { for (var h = Mn(c), y = h.length; y--; ) { var O = h[y], z = c[O]; - h[y] = [O, z, Pw(z)]; + h[y] = [O, z, Aw(z)]; } return h; } function Fa(c, h) { var y = mA(c, h); - return Wy(y) ? y : r; + return zy(y) ? y : r; } function oM(c) { var h = Tr.call(c, Na), y = c[Na]; @@ -23018,9 +23018,9 @@ h0.exports; } var bg = Hp ? function(c) { return c == null ? [] : (c = qr(c), Wo(Hp(c), function(h) { - return Cy.call(c, h); + return Iy.call(c, h); })); - } : kg, Ew = Hp ? function(c) { + } : kg, _w = Hp ? function(c) { for (var h = []; c; ) Ho(h, bg(c)), c = Ph(c); return h; @@ -23066,7 +23066,7 @@ h0.exports; var h = c.match(C); return h ? h[1].split(G) : []; } - function Sw(c, h, y) { + function Ew(c, h, y) { h = Jo(h, c); for (var O = -1, z = h.length, ne = !1; ++O < z; ) { var fe = Rs(h[O]); @@ -23080,7 +23080,7 @@ h0.exports; var h = c.length, y = new c.constructor(h); return h && typeof c[0] == "string" && Tr.call(c, "index") && (y.index = c.index, y.input = c.input), y; } - function Aw(c) { + function Sw(c) { return typeof c.constructor == "function" && !hf(c) ? kc(Ph(c)) : {}; } function fM(c, h, y) { @@ -23102,7 +23102,7 @@ h0.exports; case lt: case ct: case qt: - return aw(c, y); + return ow(c, y); case ie: return new O(); case ue: @@ -23126,7 +23126,7 @@ h0.exports; `); } function hM(c) { - return ir(c) || Ua(c) || !!(Ty && c && c[Ty]); + return ir(c) || Ua(c) || !!(Cy && c && c[Cy]); } function fo(c, h) { var y = typeof c; @@ -23136,7 +23136,7 @@ h0.exports; if (!Zr(y)) return !1; var O = typeof h; - return (O == "number" ? hi(y) && fo(h, y.length) : O == "string" && h in y) ? ds(y[h], c) : !1; + return (O == "number" ? li(y) && fo(h, y.length) : O == "string" && h in y) ? ds(y[h], c) : !1; } function yg(c, h) { if (ir(c)) @@ -23158,17 +23158,17 @@ h0.exports; return !!O && c === O[0]; } function pM(c) { - return !!Py && Py in c; + return !!Ay && Ay in c; } var gM = xh ? lo : $g; function hf(c) { var h = c && c.constructor, y = typeof h == "function" && h.prototype || Oc; return c === y; } - function Pw(c) { + function Aw(c) { return c === c && !Zr(c); } - function Mw(c, h) { + function Pw(c, h) { return function(y) { return y == null ? !1 : y[c] === h && (h !== r || c in qr(y)); }; @@ -23180,16 +23180,16 @@ h0.exports; return h; } function vM(c, h) { - var y = c[1], O = h[1], z = y | O, ne = z < (L | $ | R), fe = O == R && y == H || O == R && y == K && c[7].length <= h[8] || O == (R | K) && h[7].length <= h[8] && y == H; + var y = c[1], O = h[1], z = y | O, ne = z < (L | B | R), fe = O == R && y == H || O == R && y == K && c[7].length <= h[8] || O == (R | K) && h[7].length <= h[8] && y == H; if (!(ne || fe)) return c; - O & L && (c[2] = h[2], z |= y & L ? 0 : B); + O & L && (c[2] = h[2], z |= y & L ? 0 : $); var me = h[3]; if (me) { var we = c[3]; - c[3] = we ? uw(we, me, h[4]) : me, c[4] = we ? Ko(c[3], d) : h[4]; + c[3] = we ? cw(we, me, h[4]) : me, c[4] = we ? Ko(c[3], d) : h[4]; } - return me = h[5], me && (we = c[5], c[5] = we ? fw(we, me, h[6]) : me, c[6] = we ? Ko(c[5], d) : h[6]), me = h[7], me && (c[7] = me), O & R && (c[8] = c[8] == null ? h[8] : Kn(c[8], h[8])), c[9] == null && (c[9] = h[9]), c[0] = h[0], c[1] = z, c; + return me = h[5], me && (we = c[5], c[5] = we ? uw(we, me, h[6]) : me, c[6] = we ? Ko(c[5], d) : h[6]), me = h[7], me && (c[7] = me), O & R && (c[8] = c[8] == null ? h[8] : Kn(c[8], h[8])), c[9] == null && (c[9] = h[9]), c[0] = h[0], c[1] = z, c; } function bM(c) { var h = []; @@ -23201,7 +23201,7 @@ h0.exports; function yM(c) { return Eh.call(c); } - function Iw(c, h, y) { + function Mw(c, h, y) { return h = _n(h === r ? c.length - 1 : h, 0), function() { for (var O = arguments, z = -1, ne = _n(O.length - h, 0), fe = Ie(ne); ++z < ne; ) fe[z] = O[h + z]; @@ -23211,11 +23211,11 @@ h0.exports; return me[h] = y(fe), Pn(c, this, me); }; } - function Cw(c, h) { + function Iw(c, h) { return h.length < 2 ? c : Ba(c, Wi(h, 0, -1)); } function wM(c, h) { - for (var y = c.length, O = Kn(h.length, y), z = li(c); O--; ) { + for (var y = c.length, O = Kn(h.length, y), z = fi(c); O--; ) { var ne = h[O]; c[O] = fo(ne, y) ? z[ne] : r; } @@ -23225,14 +23225,14 @@ h0.exports; if (!(h === "constructor" && typeof c[h] == "function") && h != "__proto__") return c[h]; } - var Tw = Dw(Qy), df = LA || function(c, h) { + var Cw = Rw(Zy), df = LA || function(c, h) { return _r.setTimeout(c, h); - }, _g = Dw(zP); - function Rw(c, h, y) { + }, _g = Rw(zP); + function Tw(c, h, y) { var O = h + ""; return _g(c, lM(O, xM(cM(O), y))); } - function Dw(c) { + function Rw(c) { var h = 0, y = 0; return function() { var O = FA(), z = m - (O - y); @@ -23252,10 +23252,10 @@ h0.exports; } return c.length = h, c; } - var Ow = mM(function(c) { + var Dw = mM(function(c) { var h = []; return c.charCodeAt(0) === 46 && h.push(""), c.replace(Ft, function(y, O, z, ne) { - h.push(z ? ne.replace(he, "$1") : O || y); + h.push(z ? ne.replace(de, "$1") : O || y); }), h; }); function Rs(c) { @@ -23283,11 +23283,11 @@ h0.exports; h & y[1] && !vh(c, O) && c.push(O); }), c.sort(); } - function Nw(c) { + function Ow(c) { if (c instanceof wr) return c.clone(); var h = new qi(c.__wrapped__, c.__chain__); - return h.__actions__ = li(c.__actions__), h.__index__ = c.__index__, h.__values__ = c.__values__, h; + return h.__actions__ = fi(c.__actions__), h.__index__ = c.__index__, h.__values__ = c.__values__, h; } function _M(c, h, y) { (y ? ni(c, h, y) : h === r) ? h = 1 : h = _n(cr(h), 0); @@ -23311,7 +23311,7 @@ h0.exports; return []; for (var h = Ie(c - 1), y = arguments[0], O = c; O--; ) h[O - 1] = arguments[O]; - return Ho(ir(y) ? li(y) : [y], Bn(h, 1)); + return Ho(ir(y) ? fi(y) : [y], Bn(h, 1)); } var AM = hr(function(c, h) { return cn(c) ? af(c, Bn(h, 1, cn, !0)) : []; @@ -23340,21 +23340,21 @@ h0.exports; var z = c == null ? 0 : c.length; return z ? (y && typeof y != "number" && ni(c, h, y) && (y = 0, O = z), SP(c, h, y, O)) : []; } - function Lw(c, h, y) { + function Nw(c, h, y) { var O = c == null ? 0 : c.length; if (!O) return -1; var z = y == null ? 0 : cr(y); return z < 0 && (z = _n(O + z, 0)), bh(c, Ut(h, 3), z); } - function kw(c, h, y) { + function Lw(c, h, y) { var O = c == null ? 0 : c.length; if (!O) return -1; var z = O - 1; return y !== r && (z = cr(y), z = y < 0 ? _n(O + z, 0) : Kn(z, O - 1)), bh(c, Ut(h, 3), z, !0); } - function $w(c) { + function kw(c) { var h = c == null ? 0 : c.length; return h ? Bn(c, 1) : []; } @@ -23373,7 +23373,7 @@ h0.exports; } return O; } - function Bw(c) { + function $w(c) { return c && c.length ? c[0] : r; } function kM(c, h, y) { @@ -23409,13 +23409,13 @@ h0.exports; if (!O) return -1; var z = O; - return y !== r && (z = cr(y), z = z < 0 ? _n(O + z, 0) : Kn(z, O - 1)), h === h ? xA(c, h, z) : bh(c, by, z, !0); + return y !== r && (z = cr(y), z = z < 0 ? _n(O + z, 0) : Kn(z, O - 1)), h === h ? xA(c, h, z) : bh(c, vy, z, !0); } function zM(c, h) { - return c && c.length ? Yy(c, cr(h)) : r; + return c && c.length ? Gy(c, cr(h)) : r; } - var WM = hr(Fw); - function Fw(c, h) { + var WM = hr(Bw); + function Bw(c, h) { return c && c.length && h && h.length ? ng(c, h) : c; } function HM(c, h, y) { @@ -23426,9 +23426,9 @@ h0.exports; } var VM = uo(function(c, h) { var y = c == null ? 0 : c.length, O = Yp(c, h); - return Zy(c, Xr(h, function(z) { + return Xy(c, Xr(h, function(z) { return fo(z, y) ? +z : z; - }).sort(cw)), O; + }).sort(aw)), O; }); function GM(c, h) { var y = []; @@ -23439,7 +23439,7 @@ h0.exports; var fe = c[O]; h(fe, O, c) && (y.push(fe), z.push(O)); } - return Zy(c, z), y; + return Xy(c, z), y; } function Eg(c) { return c == null ? c : UA.call(c); @@ -23479,10 +23479,10 @@ h0.exports; return -1; } function rI(c) { - return c && c.length ? ew(c) : []; + return c && c.length ? Qy(c) : []; } function nI(c, h) { - return c && c.length ? ew(c, Ut(h, 2)) : []; + return c && c.length ? Qy(c, Ut(h, 2)) : []; } function iI(c) { var h = c == null ? 0 : c.length; @@ -23530,7 +23530,7 @@ h0.exports; return Xr(c, Bp(y)); }); } - function jw(c, h) { + function Fw(c, h) { if (!(c && c.length)) return []; var y = Sg(c); @@ -23550,16 +23550,16 @@ h0.exports; return h = typeof h == "function" ? h : r, cg(Wo(c, cn), r, h); }), yI = hr(Sg); function wI(c, h) { - return iw(c || [], h || [], of); + return nw(c || [], h || [], of); } function xI(c, h) { - return iw(c || [], h || [], ff); + return nw(c || [], h || [], ff); } var _I = hr(function(c) { var h = c.length, y = h > 1 ? c[h - 1] : r; - return y = typeof y == "function" ? (c.pop(), y) : r, jw(c, y); + return y = typeof y == "function" ? (c.pop(), y) : r, Fw(c, y); }); - function Uw(c) { + function jw(c) { var h = ee(c); return h.__chain__ = !0, h; } @@ -23582,13 +23582,13 @@ h0.exports; })); }); function AI() { - return Uw(this); + return jw(this); } function PI() { return new qi(this.value(), this.__chain__); } function MI() { - this.__values__ === r && (this.__values__ = t2(this.value())); + this.__values__ === r && (this.__values__ = e2(this.value())); var c = this.__index__ >= this.__values__.length, h = c ? r : this.__values__[this.__index__++]; return { done: c, value: h }; } @@ -23597,7 +23597,7 @@ h0.exports; } function CI(c) { for (var h, y = this; y instanceof Oh; ) { - var O = Nw(y); + var O = Ow(y); O.__index__ = 0, O.__values__ = r, h ? z.__wrapped__ = O : h = O; var z = O; y = y.__wrapped__; @@ -23617,20 +23617,20 @@ h0.exports; return this.thru(Eg); } function RI() { - return nw(this.__wrapped__, this.__actions__); + return rw(this.__wrapped__, this.__actions__); } var DI = jh(function(c, h, y) { Tr.call(c, y) ? ++c[y] : ao(c, y, 1); }); function OI(c, h, y) { - var O = ir(c) ? my : EP; + var O = ir(c) ? gy : EP; return y && ni(c, h, y) && (h = r), O(c, Ut(h, 3)); } function NI(c, h) { - var y = ir(c) ? Wo : jy; + var y = ir(c) ? Wo : Fy; return y(c, Ut(h, 3)); } - var LI = pw(Lw), kI = pw(kw); + var LI = dw(Nw), kI = dw(Lw); function $I(c, h) { return Bn(Yh(c, h), 1); } @@ -23640,24 +23640,24 @@ h0.exports; function FI(c, h, y) { return y = y === r ? 1 : cr(y), Bn(Yh(c, h), y); } - function qw(c, h) { + function Uw(c, h) { var y = ir(c) ? ji : Go; return y(c, Ut(h, 3)); } - function zw(c, h) { - var y = ir(c) ? iA : Fy; + function qw(c, h) { + var y = ir(c) ? iA : By; return y(c, Ut(h, 3)); } var jI = jh(function(c, h, y) { Tr.call(c, y) ? c[y].push(h) : ao(c, y, [h]); }); function UI(c, h, y, O) { - c = hi(c) ? c : Uc(c), y = y && !O ? cr(y) : 0; + c = li(c) ? c : Uc(c), y = y && !O ? cr(y) : 0; var z = c.length; return y < 0 && (y = _n(z + y, 0)), ed(c) ? y <= z && c.indexOf(h, y) > -1 : !!z && Cc(c, h, y) > -1; } var qI = hr(function(c, h, y) { - var O = -1, z = typeof h == "function", ne = hi(c) ? Ie(c.length) : []; + var O = -1, z = typeof h == "function", ne = li(c) ? Ie(c.length) : []; return Go(c, function(fe) { ne[++O] = z ? Pn(h, fe, y) : cf(fe, h, y); }), ne; @@ -23665,11 +23665,11 @@ h0.exports; ao(c, y, h); }); function Yh(c, h) { - var y = ir(c) ? Xr : Ky; + var y = ir(c) ? Xr : Hy; return y(c, Ut(h, 3)); } function WI(c, h, y, O) { - return c == null ? [] : (ir(h) || (h = h == null ? [] : [h]), y = O ? r : y, ir(y) || (y = y == null ? [] : [y]), Jy(c, h, y)); + return c == null ? [] : (ir(h) || (h = h == null ? [] : [h]), y = O ? r : y, ir(y) || (y = y == null ? [] : [y]), Yy(c, h, y)); } var HI = jh(function(c, h, y) { c[y ? 0 : 1].push(h); @@ -23677,19 +23677,19 @@ h0.exports; return [[], []]; }); function KI(c, h, y) { - var O = ir(c) ? kp : wy, z = arguments.length < 3; + var O = ir(c) ? kp : yy, z = arguments.length < 3; return O(c, Ut(h, 4), y, z, Go); } function VI(c, h, y) { - var O = ir(c) ? sA : wy, z = arguments.length < 3; - return O(c, Ut(h, 4), y, z, Fy); + var O = ir(c) ? sA : yy, z = arguments.length < 3; + return O(c, Ut(h, 4), y, z, By); } function GI(c, h) { - var y = ir(c) ? Wo : jy; + var y = ir(c) ? Wo : Fy; return y(c, Zh(Ut(h, 3))); } function YI(c) { - var h = ir(c) ? Ly : UP; + var h = ir(c) ? Ny : UP; return h(c); } function JI(c, h, y) { @@ -23704,7 +23704,7 @@ h0.exports; function ZI(c) { if (c == null) return 0; - if (hi(c)) + if (li(c)) return ed(c) ? Rc(c) : c.length; var h = Vn(c); return h == ie || h == Me ? c.size : tg(c).length; @@ -23717,7 +23717,7 @@ h0.exports; if (c == null) return []; var y = h.length; - return y > 1 && ni(c, h[0], h[1]) ? h = [] : y > 2 && ni(h[0], h[1], h[2]) && (h = [h[0]]), Jy(c, Bn(h, 1), []); + return y > 1 && ni(c, h[0], h[1]) ? h = [] : y > 2 && ni(h[0], h[1], h[2]) && (h = [h[0]]), Yy(c, Bn(h, 1), []); }), Jh = NA || function() { return _r.Date.now(); }; @@ -23729,10 +23729,10 @@ h0.exports; return h.apply(this, arguments); }; } - function Ww(c, h, y) { + function zw(c, h, y) { return h = y ? r : h, h = c && h == null ? c.length : h, co(c, R, r, r, r, r, h); } - function Hw(c, h) { + function Ww(c, h) { var y; if (typeof h != "function") throw new Ui(o); @@ -23747,25 +23747,25 @@ h0.exports; O |= V; } return co(c, O, h, y, z); - }), Kw = hr(function(c, h, y) { - var O = L | $; + }), Hw = hr(function(c, h, y) { + var O = L | B; if (y.length) { - var z = Ko(y, Fc(Kw)); + var z = Ko(y, Fc(Hw)); O |= V; } return co(h, O, c, y, z); }); - function Vw(c, h, y) { + function Kw(c, h, y) { h = y ? r : h; var O = co(c, H, r, r, r, r, r, h); - return O.placeholder = Vw.placeholder, O; + return O.placeholder = Kw.placeholder, O; } - function Gw(c, h, y) { + function Vw(c, h, y) { h = y ? r : h; var O = co(c, U, r, r, r, r, r, h); - return O.placeholder = Gw.placeholder, O; + return O.placeholder = Vw.placeholder, O; } - function Yw(c, h, y) { + function Gw(c, h, y) { var O, z, ne, fe, me, we, We = 0, He = !1, Xe = !1, wt = !0; if (typeof c != "function") throw new Ui(o); @@ -23778,8 +23778,8 @@ h0.exports; return We = un, me = df(vr, h), He ? Ot(un) : fe; } function fr(un) { - var ps = un - we, po = un - We, p2 = h - ps; - return Xe ? Kn(p2, ne - po) : p2; + var ps = un - we, po = un - We, d2 = h - ps; + return Xe ? Kn(d2, ne - po) : d2; } function Kt(un) { var ps = un - we, po = un - We; @@ -23795,7 +23795,7 @@ h0.exports; return me = r, wt && O ? Ot(un) : (O = z = r, fe); } function Ci() { - me !== r && sw(me), We = 0, O = we = z = me = r; + me !== r && iw(me), We = 0, O = we = z = me = r; } function ii() { return me === r ? fe : Er(Jh()); @@ -23806,16 +23806,16 @@ h0.exports; if (me === r) return Ht(we); if (Xe) - return sw(me), me = df(vr, h), Ot(we); + return iw(me), me = df(vr, h), Ot(we); } return me === r && (me = df(vr, h)), fe; } return Ti.cancel = Ci, Ti.flush = ii, Ti; } var rC = hr(function(c, h) { - return By(c, 1, h); + return $y(c, 1, h); }), nC = hr(function(c, h, y) { - return By(c, Ki(h) || 0, y); + return $y(c, Ki(h) || 0, y); }); function iC(c) { return co(c, ge); @@ -23852,7 +23852,7 @@ h0.exports; }; } function sC(c) { - return Hw(2, c); + return Ww(2, c); } var oC = KP(function(c, h) { h = h.length == 1 && ir(h[0]) ? Xr(h[0], Pi(Ut())) : Xr(Bn(h, 1), Pi(Ut())); @@ -23865,8 +23865,8 @@ h0.exports; }), Pg = hr(function(c, h) { var y = Ko(h, Fc(Pg)); return co(c, V, r, h, y); - }), Jw = hr(function(c, h) { - var y = Ko(h, Fc(Jw)); + }), Yw = hr(function(c, h) { + var y = Ko(h, Fc(Yw)); return co(c, te, r, h, y); }), aC = uo(function(c, h) { return co(c, K, r, r, r, h); @@ -23888,14 +23888,14 @@ h0.exports; var O = !0, z = !0; if (typeof c != "function") throw new Ui(o); - return Zr(y) && (O = "leading" in y ? !!y.leading : O, z = "trailing" in y ? !!y.trailing : z), Yw(c, h, { + return Zr(y) && (O = "leading" in y ? !!y.leading : O, z = "trailing" in y ? !!y.trailing : z), Gw(c, h, { leading: O, maxWait: h, trailing: z }); } function lC(c) { - return Ww(c, 1); + return zw(c, 1); } function hC(c, h) { return Pg(fg(h), c); @@ -23919,23 +23919,23 @@ h0.exports; return h = typeof h == "function" ? h : r, zi(c, p | A, h); } function bC(c, h) { - return h == null || $y(c, h, Mn(h)); + return h == null || ky(c, h, Mn(h)); } function ds(c, h) { return c === h || c !== c && h !== h; } var yC = Wh(Zp), wC = Wh(function(c, h) { return c >= h; - }), Ua = zy(/* @__PURE__ */ function() { + }), Ua = qy(/* @__PURE__ */ function() { return arguments; - }()) ? zy : function(c) { - return en(c) && Tr.call(c, "callee") && !Cy.call(c, "callee"); + }()) ? qy : function(c) { + return en(c) && Tr.call(c, "callee") && !Iy.call(c, "callee"); }, ir = Ie.isArray, xC = ti ? Pi(ti) : CP; - function hi(c) { + function li(c) { return c != null && Qh(c.length) && !lo(c); } function cn(c) { - return en(c) && hi(c); + return en(c) && li(c); } function _C(c) { return c === !0 || c === !1 || en(c) && ri(c) == J; @@ -23947,7 +23947,7 @@ h0.exports; function AC(c) { if (c == null) return !0; - if (hi(c) && (ir(c) || typeof c == "string" || typeof c.splice == "function" || Zo(c) || jc(c) || Ua(c))) + if (li(c) && (ir(c) || typeof c == "string" || typeof c.splice == "function" || Zo(c) || jc(c) || Ua(c))) return !c.length; var h = Vn(c); if (h == ie || h == Me) @@ -23974,15 +23974,15 @@ h0.exports; return h == X || h == T || typeof c.message == "string" && typeof c.name == "string" && !pf(c); } function IC(c) { - return typeof c == "number" && Ry(c); + return typeof c == "number" && Ty(c); } function lo(c) { if (!Zr(c)) return !1; var h = ri(c); - return h == re || h == de || h == Z || h == Ce; + return h == re || h == pe || h == Z || h == Ce; } - function Xw(c) { + function Jw(c) { return typeof c == "number" && c == cr(c); } function Qh(c) { @@ -23995,7 +23995,7 @@ h0.exports; function en(c) { return c != null && typeof c == "object"; } - var Zw = Fi ? Pi(Fi) : DP; + var Xw = Fi ? Pi(Fi) : DP; function CC(c, h) { return c === h || eg(c, h, vg(h)); } @@ -24003,12 +24003,12 @@ h0.exports; return y = typeof y == "function" ? y : r, eg(c, h, vg(h), y); } function RC(c) { - return Qw(c) && c != +c; + return Zw(c) && c != +c; } function DC(c) { if (gM(c)) throw new tr(s); - return Wy(c); + return zy(c); } function OC(c) { return c === null; @@ -24016,7 +24016,7 @@ h0.exports; function NC(c) { return c == null; } - function Qw(c) { + function Zw(c) { return typeof c == "number" || en(c) && ri(c) == ue; } function pf(c) { @@ -24030,9 +24030,9 @@ h0.exports; } var Ig = Is ? Pi(Is) : OP; function LC(c) { - return Xw(c) && c >= -_ && c <= _; + return Jw(c) && c >= -_ && c <= _; } - var e2 = Zu ? Pi(Zu) : NP; + var Qw = Zu ? Pi(Zu) : NP; function ed(c) { return typeof c == "string" || !ir(c) && en(c) && ri(c) == Ne; } @@ -24052,11 +24052,11 @@ h0.exports; var FC = Wh(rg), jC = Wh(function(c, h) { return c <= h; }); - function t2(c) { + function e2(c) { if (!c) return []; - if (hi(c)) - return ed(c) ? ls(c) : li(c); + if (li(c)) + return ed(c) ? ls(c) : fi(c); if (ef && c[ef]) return bA(c[ef]()); var h = Vn(c), y = h == ie ? zp : h == Me ? yh : Uc; @@ -24075,7 +24075,7 @@ h0.exports; var h = ho(c), y = h % 1; return h === h ? y ? h - y : h : 0; } - function r2(c) { + function t2(c) { return c ? $a(cr(c), 0, P) : 0; } function Ki(c) { @@ -24089,12 +24089,12 @@ h0.exports; } if (typeof c != "string") return c === 0 ? c : +c; - c = xy(c); + c = wy(c); var y = nt.test(c); return y || pt.test(c) ? nr(c.slice(2), y ? 2 : 8) : Re.test(c) ? v : +c; } - function n2(c) { - return Ts(c, di(c)); + function r2(c) { + return Ts(c, hi(c)); } function UC(c) { return c ? $a(cr(c), -_, _) : c === 0 ? c : 0; @@ -24103,46 +24103,46 @@ h0.exports; return c == null ? "" : Mi(c); } var qC = $c(function(c, h) { - if (hf(h) || hi(h)) { + if (hf(h) || li(h)) { Ts(h, Mn(h), c); return; } for (var y in h) Tr.call(h, y) && of(c, y, h[y]); - }), i2 = $c(function(c, h) { - Ts(h, di(h), c); + }), n2 = $c(function(c, h) { + Ts(h, hi(h), c); }), td = $c(function(c, h, y, O) { - Ts(h, di(h), c, O); + Ts(h, hi(h), c, O); }), zC = $c(function(c, h, y, O) { Ts(h, Mn(h), c, O); }), WC = uo(Yp); function HC(c, h) { var y = kc(c); - return h == null ? y : ky(y, h); + return h == null ? y : Ly(y, h); } var KC = hr(function(c, h) { c = qr(c); var y = -1, O = h.length, z = O > 2 ? h[2] : r; for (z && ni(h[0], h[1], z) && (O = 1); ++y < O; ) - for (var ne = h[y], fe = di(ne), me = -1, we = fe.length; ++me < we; ) { + for (var ne = h[y], fe = hi(ne), me = -1, we = fe.length; ++me < we; ) { var We = fe[me], He = c[We]; (He === r || ds(He, Oc[We]) && !Tr.call(c, We)) && (c[We] = ne[We]); } return c; }), VC = hr(function(c) { - return c.push(r, xw), Pn(s2, r, c); + return c.push(r, ww), Pn(i2, r, c); }); function GC(c, h) { - return vy(c, Ut(h, 3), Cs); + return my(c, Ut(h, 3), Cs); } function YC(c, h) { - return vy(c, Ut(h, 3), Xp); + return my(c, Ut(h, 3), Xp); } function JC(c, h) { - return c == null ? c : Jp(c, Ut(h, 3), di); + return c == null ? c : Jp(c, Ut(h, 3), hi); } function XC(c, h) { - return c == null ? c : Uy(c, Ut(h, 3), di); + return c == null ? c : jy(c, Ut(h, 3), hi); } function ZC(c, h) { return c && Cs(c, Ut(h, 3)); @@ -24154,28 +24154,28 @@ h0.exports; return c == null ? [] : kh(c, Mn(c)); } function tT(c) { - return c == null ? [] : kh(c, di(c)); + return c == null ? [] : kh(c, hi(c)); } function Cg(c, h, y) { var O = c == null ? r : Ba(c, h); return O === r ? y : O; } function rT(c, h) { - return c != null && Sw(c, h, AP); + return c != null && Ew(c, h, AP); } function Tg(c, h) { - return c != null && Sw(c, h, PP); + return c != null && Ew(c, h, PP); } - var nT = mw(function(c, h, y) { + var nT = gw(function(c, h, y) { h != null && typeof h.toString != "function" && (h = Eh.call(h)), c[h] = y; - }, Dg(pi)), iT = mw(function(c, h, y) { + }, Dg(di)), iT = gw(function(c, h, y) { h != null && typeof h.toString != "function" && (h = Eh.call(h)), Tr.call(c, h) ? c[h].push(y) : c[h] = [y]; }, Ut), sT = hr(cf); function Mn(c) { - return hi(c) ? Ny(c) : tg(c); + return li(c) ? Oy(c) : tg(c); } - function di(c) { - return hi(c) ? Ny(c, !0) : kP(c); + function hi(c) { + return li(c) ? Oy(c, !0) : kP(c); } function oT(c, h) { var y = {}; @@ -24191,7 +24191,7 @@ h0.exports; } var cT = $c(function(c, h, y) { $h(c, h, y); - }), s2 = $c(function(c, h, y, O) { + }), i2 = $c(function(c, h, y, O) { $h(c, h, y, O); }), uT = uo(function(c, h) { var y = {}; @@ -24206,18 +24206,18 @@ h0.exports; return y; }); function fT(c, h) { - return o2(c, Zh(Ut(h))); + return s2(c, Zh(Ut(h))); } var lT = uo(function(c, h) { return c == null ? {} : BP(c, h); }); - function o2(c, h) { + function s2(c, h) { if (c == null) return {}; var y = Xr(gg(c), function(O) { return [O]; }); - return h = Ut(h), Xy(c, y, function(O, z) { + return h = Ut(h), Jy(c, y, function(O, z) { return h(O, z[0]); }); } @@ -24236,7 +24236,7 @@ h0.exports; function pT(c, h, y, O) { return O = typeof O == "function" ? O : r, c == null ? c : ff(c, h, y, O); } - var a2 = yw(Mn), c2 = yw(di); + var o2 = bw(Mn), a2 = bw(hi); function gT(c, h, y) { var O = ir(c), z = O || Zo(c) || jc(c); if (h = Ut(h, 4), y == null) { @@ -24251,16 +24251,16 @@ h0.exports; return c == null ? !0 : ag(c, h); } function vT(c, h, y) { - return c == null ? c : rw(c, h, fg(y)); + return c == null ? c : tw(c, h, fg(y)); } function bT(c, h, y, O) { - return O = typeof O == "function" ? O : r, c == null ? c : rw(c, h, fg(y), O); + return O = typeof O == "function" ? O : r, c == null ? c : tw(c, h, fg(y), O); } function Uc(c) { return c == null ? [] : qp(c, Mn(c)); } function yT(c) { - return c == null ? [] : qp(c, di(c)); + return c == null ? [] : qp(c, hi(c)); } function wT(c, h, y) { return y === r && (y = h, h = r), y !== r && (y = Ki(y), y = y === y ? y : 0), h !== r && (h = Ki(h), h = h === h ? h : 0), $a(Ki(c), h, y); @@ -24274,18 +24274,18 @@ h0.exports; c = h, h = O; } if (y || c % 1 || h % 1) { - var z = Dy(); + var z = Ry(); return Kn(c + z * (h - c + jr("1e-" + ((z + "").length - 1))), h); } return ig(c, h); } var ET = Bc(function(c, h, y) { - return h = h.toLowerCase(), c + (y ? u2(h) : h); + return h = h.toLowerCase(), c + (y ? c2(h) : h); }); - function u2(c) { + function c2(c) { return Rg(Cr(c).toLowerCase()); } - function f2(c) { + function u2(c) { return c = Cr(c), c && c.replace(et, dA).replace(Op, ""); } function ST(c, h, y) { @@ -24305,7 +24305,7 @@ h0.exports; return c + (y ? "-" : "") + h.toLowerCase(); }), IT = Bc(function(c, h, y) { return c + (y ? " " : "") + h.toLowerCase(); - }), CT = dw("toLowerCase"); + }), CT = hw("toLowerCase"); function TT(c, h, y) { c = Cr(c), h = cr(h); var O = h ? Rc(c) : 0; @@ -24348,8 +24348,8 @@ h0.exports; } function jT(c, h, y) { var O = ee.templateSettings; - y && ni(c, h, y) && (h = r), c = Cr(c), h = td({}, h, O, ww); - var z = td({}, h.imports, O.imports, ww), ne = Mn(z), fe = qp(z, ne), me, we, We = 0, He = h.interpolate || St, Xe = "__p += '", wt = Wp( + y && ni(c, h, y) && (h = r), c = Cr(c), h = td({}, h, O, yw); + var z = td({}, h.imports, O.imports, yw), ne = Mn(z), fe = qp(z, ne), me, we, We = 0, He = h.interpolate || St, Xe = "__p += '", wt = Wp( (h.escape || St).source + "|" + He.source + "|" + (He === Nt ? xe : St).source + "|" + (h.evaluate || St).source + "|$", "g" ), Ot = "//# sourceURL=" + (Tr.call(h, "sourceURL") ? (h.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++Np + "]") + ` @@ -24379,7 +24379,7 @@ function print() { __p += __j.call(arguments, '') } ` : `; `) + Xe + `return __p }`; - var fr = h2(function() { + var fr = l2(function() { return Pr(ne, Ot + "return " + Xe).apply(r, fe); }); if (fr.source = Xe, Mg(fr)) @@ -24394,18 +24394,18 @@ function print() { __p += __j.call(arguments, '') } } function zT(c, h, y) { if (c = Cr(c), c && (y || h === r)) - return xy(c); + return wy(c); if (!c || !(h = Mi(h))) return c; - var O = ls(c), z = ls(h), ne = _y(O, z), fe = Ey(O, z) + 1; + var O = ls(c), z = ls(h), ne = xy(O, z), fe = _y(O, z) + 1; return Xo(O, ne, fe).join(""); } function WT(c, h, y) { if (c = Cr(c), c && (y || h === r)) - return c.slice(0, Ay(c) + 1); + return c.slice(0, Sy(c) + 1); if (!c || !(h = Mi(h))) return c; - var O = ls(c), z = Ey(O, ls(h)) + 1; + var O = ls(c), z = _y(O, ls(h)) + 1; return Xo(O, 0, z).join(""); } function HT(c, h, y) { @@ -24413,7 +24413,7 @@ function print() { __p += __j.call(arguments, '') } return c.replace(k, ""); if (!c || !(h = Mi(h))) return c; - var O = ls(c), z = _y(O, ls(h)); + var O = ls(c), z = xy(O, ls(h)); return Xo(O, z).join(""); } function KT(c, h) { @@ -24454,11 +24454,11 @@ function print() { __p += __j.call(arguments, '') } } var GT = Bc(function(c, h, y) { return c + (y ? " " : "") + h.toUpperCase(); - }), Rg = dw("toUpperCase"); - function l2(c, h, y) { + }), Rg = hw("toUpperCase"); + function f2(c, h, y) { return c = Cr(c), h = y ? r : h, h === r ? vA(c) ? AA(c) : cA(c) : c.match(h) || []; } - var h2 = hr(function(c, h) { + var l2 = hr(function(c, h) { try { return Pn(c, r, h); } catch (y) { @@ -24494,18 +24494,18 @@ function print() { __p += __j.call(arguments, '') } function ZT(c, h) { return c == null || c !== c ? h : c; } - var QT = gw(), eR = gw(!0); - function pi(c) { + var QT = pw(), eR = pw(!0); + function di(c) { return c; } function Og(c) { - return Hy(typeof c == "function" ? c : zi(c, p)); + return Wy(typeof c == "function" ? c : zi(c, p)); } function tR(c) { - return Vy(zi(c, p)); + return Ky(zi(c, p)); } function rR(c, h) { - return Gy(c, zi(h, p)); + return Vy(c, zi(h, p)); } var nR = hr(function(c, h) { return function(y) { @@ -24525,7 +24525,7 @@ function print() { __p += __j.call(arguments, '') } c[me] = we, fe && (c.prototype[me] = function() { var We = this.__chain__; if (ne || We) { - var He = c(this.__wrapped__), Xe = He.__actions__ = li(this.__actions__); + var He = c(this.__wrapped__), Xe = He.__actions__ = fi(this.__actions__); return Xe.push({ func: we, args: arguments, thisArg: c }), He.__chain__ = We, He; } return we.apply(c, Ho([this.value()], arguments)); @@ -24539,11 +24539,11 @@ function print() { __p += __j.call(arguments, '') } } function oR(c) { return c = cr(c), hr(function(h) { - return Yy(h, c); + return Gy(h, c); }); } - var aR = hg(Xr), cR = hg(my), uR = hg($p); - function d2(c) { + var aR = hg(Xr), cR = hg(gy), uR = hg($p); + function h2(c) { return yg(c) ? Bp(Rs(c)) : FP(c); } function fR(c) { @@ -24551,7 +24551,7 @@ function print() { __p += __j.call(arguments, '') } return c == null ? r : Ba(c, h); }; } - var lR = vw(), hR = vw(!0); + var lR = mw(), hR = mw(!0); function kg() { return []; } @@ -24577,7 +24577,7 @@ function print() { __p += __j.call(arguments, '') } return z; } function vR(c) { - return ir(c) ? Xr(c, Rs) : Ii(c) ? [c] : li(Ow(Cr(c))); + return ir(c) ? Xr(c, Rs) : Ii(c) ? [c] : fi(Dw(Cr(c))); } function bR(c) { var h = ++CA; @@ -24589,19 +24589,19 @@ function print() { __p += __j.call(arguments, '') } return c / h; }, 1), _R = dg("floor"); function ER(c) { - return c && c.length ? Lh(c, pi, Zp) : r; + return c && c.length ? Lh(c, di, Zp) : r; } function SR(c, h) { return c && c.length ? Lh(c, Ut(h, 2), Zp) : r; } function AR(c) { - return yy(c, pi); + return by(c, di); } function PR(c, h) { - return yy(c, Ut(h, 2)); + return by(c, Ut(h, 2)); } function MR(c) { - return c && c.length ? Lh(c, pi, rg) : r; + return c && c.length ? Lh(c, di, rg) : r; } function IR(c, h) { return c && c.length ? Lh(c, Ut(h, 2), rg) : r; @@ -24612,12 +24612,12 @@ function print() { __p += __j.call(arguments, '') } return c - h; }, 0); function DR(c) { - return c && c.length ? jp(c, pi) : 0; + return c && c.length ? jp(c, di) : 0; } function OR(c, h) { return c && c.length ? jp(c, Ut(h, 2)) : 0; } - return ee.after = tC, ee.ary = Ww, ee.assign = qC, ee.assignIn = i2, ee.assignInWith = td, ee.assignWith = zC, ee.at = WC, ee.before = Hw, ee.bind = Ag, ee.bindAll = YT, ee.bindKey = Kw, ee.castArray = dC, ee.chain = Uw, ee.chunk = _M, ee.compact = EM, ee.concat = SM, ee.cond = JT, ee.conforms = XT, ee.constant = Dg, ee.countBy = DI, ee.create = HC, ee.curry = Vw, ee.curryRight = Gw, ee.debounce = Yw, ee.defaults = KC, ee.defaultsDeep = VC, ee.defer = rC, ee.delay = nC, ee.difference = AM, ee.differenceBy = PM, ee.differenceWith = MM, ee.drop = IM, ee.dropRight = CM, ee.dropRightWhile = TM, ee.dropWhile = RM, ee.fill = DM, ee.filter = NI, ee.flatMap = $I, ee.flatMapDeep = BI, ee.flatMapDepth = FI, ee.flatten = $w, ee.flattenDeep = OM, ee.flattenDepth = NM, ee.flip = iC, ee.flow = QT, ee.flowRight = eR, ee.fromPairs = LM, ee.functions = eT, ee.functionsIn = tT, ee.groupBy = jI, ee.initial = $M, ee.intersection = BM, ee.intersectionBy = FM, ee.intersectionWith = jM, ee.invert = nT, ee.invertBy = iT, ee.invokeMap = qI, ee.iteratee = Og, ee.keyBy = zI, ee.keys = Mn, ee.keysIn = di, ee.map = Yh, ee.mapKeys = oT, ee.mapValues = aT, ee.matches = tR, ee.matchesProperty = rR, ee.memoize = Xh, ee.merge = cT, ee.mergeWith = s2, ee.method = nR, ee.methodOf = iR, ee.mixin = Ng, ee.negate = Zh, ee.nthArg = oR, ee.omit = uT, ee.omitBy = fT, ee.once = sC, ee.orderBy = WI, ee.over = aR, ee.overArgs = oC, ee.overEvery = cR, ee.overSome = uR, ee.partial = Pg, ee.partialRight = Jw, ee.partition = HI, ee.pick = lT, ee.pickBy = o2, ee.property = d2, ee.propertyOf = fR, ee.pull = WM, ee.pullAll = Fw, ee.pullAllBy = HM, ee.pullAllWith = KM, ee.pullAt = VM, ee.range = lR, ee.rangeRight = hR, ee.rearg = aC, ee.reject = GI, ee.remove = GM, ee.rest = cC, ee.reverse = Eg, ee.sampleSize = JI, ee.set = dT, ee.setWith = pT, ee.shuffle = XI, ee.slice = YM, ee.sortBy = eC, ee.sortedUniq = rI, ee.sortedUniqBy = nI, ee.split = $T, ee.spread = uC, ee.tail = iI, ee.take = sI, ee.takeRight = oI, ee.takeRightWhile = aI, ee.takeWhile = cI, ee.tap = EI, ee.throttle = fC, ee.thru = Gh, ee.toArray = t2, ee.toPairs = a2, ee.toPairsIn = c2, ee.toPath = vR, ee.toPlainObject = n2, ee.transform = gT, ee.unary = lC, ee.union = uI, ee.unionBy = fI, ee.unionWith = lI, ee.uniq = hI, ee.uniqBy = dI, ee.uniqWith = pI, ee.unset = mT, ee.unzip = Sg, ee.unzipWith = jw, ee.update = vT, ee.updateWith = bT, ee.values = Uc, ee.valuesIn = yT, ee.without = gI, ee.words = l2, ee.wrap = hC, ee.xor = mI, ee.xorBy = vI, ee.xorWith = bI, ee.zip = yI, ee.zipObject = wI, ee.zipObjectDeep = xI, ee.zipWith = _I, ee.entries = a2, ee.entriesIn = c2, ee.extend = i2, ee.extendWith = td, Ng(ee, ee), ee.add = yR, ee.attempt = h2, ee.camelCase = ET, ee.capitalize = u2, ee.ceil = wR, ee.clamp = wT, ee.clone = pC, ee.cloneDeep = mC, ee.cloneDeepWith = vC, ee.cloneWith = gC, ee.conformsTo = bC, ee.deburr = f2, ee.defaultTo = ZT, ee.divide = xR, ee.endsWith = ST, ee.eq = ds, ee.escape = AT, ee.escapeRegExp = PT, ee.every = OI, ee.find = LI, ee.findIndex = Lw, ee.findKey = GC, ee.findLast = kI, ee.findLastIndex = kw, ee.findLastKey = YC, ee.floor = _R, ee.forEach = qw, ee.forEachRight = zw, ee.forIn = JC, ee.forInRight = XC, ee.forOwn = ZC, ee.forOwnRight = QC, ee.get = Cg, ee.gt = yC, ee.gte = wC, ee.has = rT, ee.hasIn = Tg, ee.head = Bw, ee.identity = pi, ee.includes = UI, ee.indexOf = kM, ee.inRange = xT, ee.invoke = sT, ee.isArguments = Ua, ee.isArray = ir, ee.isArrayBuffer = xC, ee.isArrayLike = hi, ee.isArrayLikeObject = cn, ee.isBoolean = _C, ee.isBuffer = Zo, ee.isDate = EC, ee.isElement = SC, ee.isEmpty = AC, ee.isEqual = PC, ee.isEqualWith = MC, ee.isError = Mg, ee.isFinite = IC, ee.isFunction = lo, ee.isInteger = Xw, ee.isLength = Qh, ee.isMap = Zw, ee.isMatch = CC, ee.isMatchWith = TC, ee.isNaN = RC, ee.isNative = DC, ee.isNil = NC, ee.isNull = OC, ee.isNumber = Qw, ee.isObject = Zr, ee.isObjectLike = en, ee.isPlainObject = pf, ee.isRegExp = Ig, ee.isSafeInteger = LC, ee.isSet = e2, ee.isString = ed, ee.isSymbol = Ii, ee.isTypedArray = jc, ee.isUndefined = kC, ee.isWeakMap = $C, ee.isWeakSet = BC, ee.join = UM, ee.kebabCase = MT, ee.last = Hi, ee.lastIndexOf = qM, ee.lowerCase = IT, ee.lowerFirst = CT, ee.lt = FC, ee.lte = jC, ee.max = ER, ee.maxBy = SR, ee.mean = AR, ee.meanBy = PR, ee.min = MR, ee.minBy = IR, ee.stubArray = kg, ee.stubFalse = $g, ee.stubObject = dR, ee.stubString = pR, ee.stubTrue = gR, ee.multiply = CR, ee.nth = zM, ee.noConflict = sR, ee.noop = Lg, ee.now = Jh, ee.pad = TT, ee.padEnd = RT, ee.padStart = DT, ee.parseInt = OT, ee.random = _T, ee.reduce = KI, ee.reduceRight = VI, ee.repeat = NT, ee.replace = LT, ee.result = hT, ee.round = TR, ee.runInContext = be, ee.sample = YI, ee.size = ZI, ee.snakeCase = kT, ee.some = QI, ee.sortedIndex = JM, ee.sortedIndexBy = XM, ee.sortedIndexOf = ZM, ee.sortedLastIndex = QM, ee.sortedLastIndexBy = eI, ee.sortedLastIndexOf = tI, ee.startCase = BT, ee.startsWith = FT, ee.subtract = RR, ee.sum = DR, ee.sumBy = OR, ee.template = jT, ee.times = mR, ee.toFinite = ho, ee.toInteger = cr, ee.toLength = r2, ee.toLower = UT, ee.toNumber = Ki, ee.toSafeInteger = UC, ee.toString = Cr, ee.toUpper = qT, ee.trim = zT, ee.trimEnd = WT, ee.trimStart = HT, ee.truncate = KT, ee.unescape = VT, ee.uniqueId = bR, ee.upperCase = GT, ee.upperFirst = Rg, ee.each = qw, ee.eachRight = zw, ee.first = Bw, Ng(ee, function() { + return ee.after = tC, ee.ary = zw, ee.assign = qC, ee.assignIn = n2, ee.assignInWith = td, ee.assignWith = zC, ee.at = WC, ee.before = Ww, ee.bind = Ag, ee.bindAll = YT, ee.bindKey = Hw, ee.castArray = dC, ee.chain = jw, ee.chunk = _M, ee.compact = EM, ee.concat = SM, ee.cond = JT, ee.conforms = XT, ee.constant = Dg, ee.countBy = DI, ee.create = HC, ee.curry = Kw, ee.curryRight = Vw, ee.debounce = Gw, ee.defaults = KC, ee.defaultsDeep = VC, ee.defer = rC, ee.delay = nC, ee.difference = AM, ee.differenceBy = PM, ee.differenceWith = MM, ee.drop = IM, ee.dropRight = CM, ee.dropRightWhile = TM, ee.dropWhile = RM, ee.fill = DM, ee.filter = NI, ee.flatMap = $I, ee.flatMapDeep = BI, ee.flatMapDepth = FI, ee.flatten = kw, ee.flattenDeep = OM, ee.flattenDepth = NM, ee.flip = iC, ee.flow = QT, ee.flowRight = eR, ee.fromPairs = LM, ee.functions = eT, ee.functionsIn = tT, ee.groupBy = jI, ee.initial = $M, ee.intersection = BM, ee.intersectionBy = FM, ee.intersectionWith = jM, ee.invert = nT, ee.invertBy = iT, ee.invokeMap = qI, ee.iteratee = Og, ee.keyBy = zI, ee.keys = Mn, ee.keysIn = hi, ee.map = Yh, ee.mapKeys = oT, ee.mapValues = aT, ee.matches = tR, ee.matchesProperty = rR, ee.memoize = Xh, ee.merge = cT, ee.mergeWith = i2, ee.method = nR, ee.methodOf = iR, ee.mixin = Ng, ee.negate = Zh, ee.nthArg = oR, ee.omit = uT, ee.omitBy = fT, ee.once = sC, ee.orderBy = WI, ee.over = aR, ee.overArgs = oC, ee.overEvery = cR, ee.overSome = uR, ee.partial = Pg, ee.partialRight = Yw, ee.partition = HI, ee.pick = lT, ee.pickBy = s2, ee.property = h2, ee.propertyOf = fR, ee.pull = WM, ee.pullAll = Bw, ee.pullAllBy = HM, ee.pullAllWith = KM, ee.pullAt = VM, ee.range = lR, ee.rangeRight = hR, ee.rearg = aC, ee.reject = GI, ee.remove = GM, ee.rest = cC, ee.reverse = Eg, ee.sampleSize = JI, ee.set = dT, ee.setWith = pT, ee.shuffle = XI, ee.slice = YM, ee.sortBy = eC, ee.sortedUniq = rI, ee.sortedUniqBy = nI, ee.split = $T, ee.spread = uC, ee.tail = iI, ee.take = sI, ee.takeRight = oI, ee.takeRightWhile = aI, ee.takeWhile = cI, ee.tap = EI, ee.throttle = fC, ee.thru = Gh, ee.toArray = e2, ee.toPairs = o2, ee.toPairsIn = a2, ee.toPath = vR, ee.toPlainObject = r2, ee.transform = gT, ee.unary = lC, ee.union = uI, ee.unionBy = fI, ee.unionWith = lI, ee.uniq = hI, ee.uniqBy = dI, ee.uniqWith = pI, ee.unset = mT, ee.unzip = Sg, ee.unzipWith = Fw, ee.update = vT, ee.updateWith = bT, ee.values = Uc, ee.valuesIn = yT, ee.without = gI, ee.words = f2, ee.wrap = hC, ee.xor = mI, ee.xorBy = vI, ee.xorWith = bI, ee.zip = yI, ee.zipObject = wI, ee.zipObjectDeep = xI, ee.zipWith = _I, ee.entries = o2, ee.entriesIn = a2, ee.extend = n2, ee.extendWith = td, Ng(ee, ee), ee.add = yR, ee.attempt = l2, ee.camelCase = ET, ee.capitalize = c2, ee.ceil = wR, ee.clamp = wT, ee.clone = pC, ee.cloneDeep = mC, ee.cloneDeepWith = vC, ee.cloneWith = gC, ee.conformsTo = bC, ee.deburr = u2, ee.defaultTo = ZT, ee.divide = xR, ee.endsWith = ST, ee.eq = ds, ee.escape = AT, ee.escapeRegExp = PT, ee.every = OI, ee.find = LI, ee.findIndex = Nw, ee.findKey = GC, ee.findLast = kI, ee.findLastIndex = Lw, ee.findLastKey = YC, ee.floor = _R, ee.forEach = Uw, ee.forEachRight = qw, ee.forIn = JC, ee.forInRight = XC, ee.forOwn = ZC, ee.forOwnRight = QC, ee.get = Cg, ee.gt = yC, ee.gte = wC, ee.has = rT, ee.hasIn = Tg, ee.head = $w, ee.identity = di, ee.includes = UI, ee.indexOf = kM, ee.inRange = xT, ee.invoke = sT, ee.isArguments = Ua, ee.isArray = ir, ee.isArrayBuffer = xC, ee.isArrayLike = li, ee.isArrayLikeObject = cn, ee.isBoolean = _C, ee.isBuffer = Zo, ee.isDate = EC, ee.isElement = SC, ee.isEmpty = AC, ee.isEqual = PC, ee.isEqualWith = MC, ee.isError = Mg, ee.isFinite = IC, ee.isFunction = lo, ee.isInteger = Jw, ee.isLength = Qh, ee.isMap = Xw, ee.isMatch = CC, ee.isMatchWith = TC, ee.isNaN = RC, ee.isNative = DC, ee.isNil = NC, ee.isNull = OC, ee.isNumber = Zw, ee.isObject = Zr, ee.isObjectLike = en, ee.isPlainObject = pf, ee.isRegExp = Ig, ee.isSafeInteger = LC, ee.isSet = Qw, ee.isString = ed, ee.isSymbol = Ii, ee.isTypedArray = jc, ee.isUndefined = kC, ee.isWeakMap = $C, ee.isWeakSet = BC, ee.join = UM, ee.kebabCase = MT, ee.last = Hi, ee.lastIndexOf = qM, ee.lowerCase = IT, ee.lowerFirst = CT, ee.lt = FC, ee.lte = jC, ee.max = ER, ee.maxBy = SR, ee.mean = AR, ee.meanBy = PR, ee.min = MR, ee.minBy = IR, ee.stubArray = kg, ee.stubFalse = $g, ee.stubObject = dR, ee.stubString = pR, ee.stubTrue = gR, ee.multiply = CR, ee.nth = zM, ee.noConflict = sR, ee.noop = Lg, ee.now = Jh, ee.pad = TT, ee.padEnd = RT, ee.padStart = DT, ee.parseInt = OT, ee.random = _T, ee.reduce = KI, ee.reduceRight = VI, ee.repeat = NT, ee.replace = LT, ee.result = hT, ee.round = TR, ee.runInContext = be, ee.sample = YI, ee.size = ZI, ee.snakeCase = kT, ee.some = QI, ee.sortedIndex = JM, ee.sortedIndexBy = XM, ee.sortedIndexOf = ZM, ee.sortedLastIndex = QM, ee.sortedLastIndexBy = eI, ee.sortedLastIndexOf = tI, ee.startCase = BT, ee.startsWith = FT, ee.subtract = RR, ee.sum = DR, ee.sumBy = OR, ee.template = jT, ee.times = mR, ee.toFinite = ho, ee.toInteger = cr, ee.toLength = t2, ee.toLower = UT, ee.toNumber = Ki, ee.toSafeInteger = UC, ee.toString = Cr, ee.toUpper = qT, ee.trim = zT, ee.trimEnd = WT, ee.trimStart = HT, ee.truncate = KT, ee.unescape = VT, ee.uniqueId = bR, ee.upperCase = GT, ee.upperFirst = Rg, ee.each = Uw, ee.eachRight = qw, ee.first = $w, Ng(ee, function() { var c = {}; return Cs(ee, function(h, y) { Tr.call(ee.prototype, y) || (c[y] = h); @@ -24655,7 +24655,7 @@ function print() { __p += __j.call(arguments, '') } return this.__filtered__ ? new wr(this) : this[y](1); }; }), wr.prototype.compact = function() { - return this.filter(pi); + return this.filter(di); }, wr.prototype.find = function(c) { return this.filter(c).head(); }, wr.prototype.findLast = function(c) { @@ -24708,7 +24708,7 @@ function print() { __p += __j.call(arguments, '') } var O = y.name + ""; Tr.call(Lc, O) || (Lc[O] = []), Lc[O].push({ name: h, func: y }); } - }), Lc[Uh(r, $).name] = [{ + }), Lc[Uh(r, B).name] = [{ name: "wrapper", func: r }], wr.prototype.clone = VA, wr.prototype.reverse = GA, wr.prototype.value = YA, ee.prototype.at = SI, ee.prototype.chain = AI, ee.prototype.commit = PI, ee.prototype.next = MI, ee.prototype.plant = CI, ee.prototype.reverse = TI, ee.prototype.toJSON = ee.prototype.valueOf = ee.prototype.value = RI, ee.prototype.first = ee.prototype.head, ef && (ee.prototype[ef] = II), ee; @@ -24829,11 +24829,11 @@ var ZV = h0.exports, O1 = { exports: {} }; }; }); } - function $(f) { + function B(f) { var g = new FileReader(), b = L(g); return g.readAsArrayBuffer(f), b; } - function B(f) { + function $(f) { var g = new FileReader(), b = L(g); return g.readAsText(f), b; } @@ -24863,13 +24863,13 @@ var ZV = h0.exports, O1 = { exports: {} }; throw new Error("could not read FormData body as blob"); return Promise.resolve(new Blob([this._bodyText])); }, this.arrayBuffer = function() { - return this._bodyArrayBuffer ? N(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then($); + return this._bodyArrayBuffer ? N(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(B); }), this.text = function() { var f = N(this); if (f) return f; if (this._bodyBlob) - return B(this._bodyBlob); + return $(this._bodyBlob); if (this._bodyArrayBuffer) return Promise.resolve(H(this._bodyArrayBuffer)); if (this._bodyFormData) @@ -24989,16 +24989,16 @@ var ZV = h0.exports, O1 = { exports: {} }; e = i.fetch, e.default = i.fetch, e.fetch = i.fetch, e.Headers = i.Headers, e.Request = i.Request, e.Response = i.Response, t.exports = e; })(O1, O1.exports); var QV = O1.exports; -const B3 = /* @__PURE__ */ ts(QV); -var eG = Object.defineProperty, tG = Object.defineProperties, rG = Object.getOwnPropertyDescriptors, F3 = Object.getOwnPropertySymbols, nG = Object.prototype.hasOwnProperty, iG = Object.prototype.propertyIsEnumerable, j3 = (t, e, r) => e in t ? eG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, U3 = (t, e) => { - for (var r in e || (e = {})) nG.call(e, r) && j3(t, r, e[r]); - if (F3) for (var r of F3(e)) iG.call(e, r) && j3(t, r, e[r]); +const $3 = /* @__PURE__ */ ts(QV); +var eG = Object.defineProperty, tG = Object.defineProperties, rG = Object.getOwnPropertyDescriptors, B3 = Object.getOwnPropertySymbols, nG = Object.prototype.hasOwnProperty, iG = Object.prototype.propertyIsEnumerable, F3 = (t, e, r) => e in t ? eG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, j3 = (t, e) => { + for (var r in e || (e = {})) nG.call(e, r) && F3(t, r, e[r]); + if (B3) for (var r of B3(e)) iG.call(e, r) && F3(t, r, e[r]); return t; -}, q3 = (t, e) => tG(t, rG(e)); -const sG = { Accept: "application/json", "Content-Type": "application/json" }, oG = "POST", z3 = { headers: sG, method: oG }, W3 = 10; +}, U3 = (t, e) => tG(t, rG(e)); +const sG = { Accept: "application/json", "Content-Type": "application/json" }, oG = "POST", q3 = { headers: sG, method: oG }, z3 = 10; let As = class { constructor(e, r = !1) { - if (this.url = e, this.disableProviderPing = r, this.events = new rs.EventEmitter(), this.isAvailable = !1, this.registering = !1, !f3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); + if (this.url = e, this.disableProviderPing = r, this.events = new rs.EventEmitter(), this.isAvailable = !1, this.registering = !1, !u3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); this.url = e, this.disableProviderPing = r; } get connected() { @@ -25029,14 +25029,14 @@ let As = class { async send(e) { this.isAvailable || await this.register(); try { - const r = $o(e), n = await (await B3(this.url, q3(U3({}, z3), { body: r }))).json(); + const r = $o(e), n = await (await $3(this.url, U3(j3({}, q3), { body: r }))).json(); this.onPayload({ data: n }); } catch (r) { this.onError(e.id, r); } } async register(e = this.url) { - if (!f3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); + if (!u3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); if (this.registering) { const r = this.events.getMaxListeners(); return (this.events.listenerCount("register_error") >= r || this.events.listenerCount("open") >= r) && this.events.setMaxListeners(r + 1), new Promise((n, i) => { @@ -25052,7 +25052,7 @@ let As = class { try { if (!this.disableProviderPing) { const r = $o({ id: 1, jsonrpc: "2.0", method: "test", params: [] }); - await B3(e, q3(U3({}, z3), { body: r })); + await $3(e, U3(j3({}, q3), { body: r })); } this.onOpen(); } catch (r) { @@ -25076,27 +25076,27 @@ let As = class { this.events.emit("payload", s); } parseError(e, r = this.url) { - return Z8(e, r, "HTTP"); + return X8(e, r, "HTTP"); } resetMaxListeners() { - this.events.getMaxListeners() > W3 && this.events.setMaxListeners(W3); + this.events.getMaxListeners() > z3 && this.events.setMaxListeners(z3); } }; -const H3 = "error", aG = "wss://relay.walletconnect.org", cG = "wc", uG = "universal_provider", K3 = `${cG}@2:${uG}:`, _E = "https://rpc.walletconnect.org/v1/", Xc = "generic", fG = `${_E}bundler`, cs = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; -var lG = Object.defineProperty, hG = Object.defineProperties, dG = Object.getOwnPropertyDescriptors, V3 = Object.getOwnPropertySymbols, pG = Object.prototype.hasOwnProperty, gG = Object.prototype.propertyIsEnumerable, G3 = (t, e, r) => e in t ? lG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ld = (t, e) => { - for (var r in e || (e = {})) pG.call(e, r) && G3(t, r, e[r]); - if (V3) for (var r of V3(e)) gG.call(e, r) && G3(t, r, e[r]); +const W3 = "error", aG = "wss://relay.walletconnect.org", cG = "wc", uG = "universal_provider", H3 = `${cG}@2:${uG}:`, xE = "https://rpc.walletconnect.org/v1/", Xc = "generic", fG = `${xE}bundler`, cs = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; +var lG = Object.defineProperty, hG = Object.defineProperties, dG = Object.getOwnPropertyDescriptors, K3 = Object.getOwnPropertySymbols, pG = Object.prototype.hasOwnProperty, gG = Object.prototype.propertyIsEnumerable, V3 = (t, e, r) => e in t ? lG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ld = (t, e) => { + for (var r in e || (e = {})) pG.call(e, r) && V3(t, r, e[r]); + if (K3) for (var r of K3(e)) gG.call(e, r) && V3(t, r, e[r]); return t; }, mG = (t, e) => hG(t, dG(e)); function Ni(t, e, r) { var n; const i = hu(t); - return ((n = e.rpcMap) == null ? void 0 : n[i.reference]) || `${_E}?chainId=${i.namespace}:${i.reference}&projectId=${r}`; + return ((n = e.rpcMap) == null ? void 0 : n[i.reference]) || `${xE}?chainId=${i.namespace}:${i.reference}&projectId=${r}`; } function Sc(t) { return t.includes(":") ? t.split(":")[1] : t; } -function EE(t) { +function _E(t) { return t.map((e) => `${e.split(":")[0]}:${e.split(":")[1]}`); } function vG(t, e) { @@ -25109,15 +25109,15 @@ function vG(t, e) { }), n; } function bm(t = {}, e = {}) { - const r = Y3(t), n = Y3(e); + const r = G3(t), n = G3(e); return ZV.merge(r, n); } -function Y3(t) { +function G3(t) { var e, r, n, i; const s = {}; if (!Sl(t)) return s; for (const [o, a] of Object.entries(t)) { - const u = ub(o) ? [o] : a.chains, l = a.methods || [], d = a.events || [], p = a.rpcMap || {}, w = Ff(o); + const u = cb(o) ? [o] : a.chains, l = a.methods || [], d = a.events || [], p = a.rpcMap || {}, w = Ff(o); s[w] = mG(ld(ld({}, s[w]), a), { chains: Id(u, (e = s[w]) == null ? void 0 : e.chains), methods: Id(l, (r = s[w]) == null ? void 0 : r.methods), events: Id(d, (n = s[w]) == null ? void 0 : n.events), rpcMap: ld(ld({}, p), (i = s[w]) == null ? void 0 : i.rpcMap) }); } return s; @@ -25125,10 +25125,10 @@ function Y3(t) { function bG(t) { return t.includes(":") ? t.split(":")[2] : t; } -function J3(t) { +function Y3(t) { const e = {}; for (const [r, n] of Object.entries(t)) { - const i = n.methods || [], s = n.events || [], o = n.accounts || [], a = ub(r) ? [r] : n.chains ? n.chains : EE(n.accounts); + const i = n.methods || [], s = n.events || [], o = n.accounts || [], a = cb(r) ? [r] : n.chains ? n.chains : _E(n.accounts); e[r] = { chains: a, methods: i, events: s, accounts: o }; } return e; @@ -25136,8 +25136,8 @@ function J3(t) { function ym(t) { return typeof t == "number" ? t : t.includes("0x") ? parseInt(t, 16) : (t = t.includes(":") ? t.split(":")[1] : t, isNaN(Number(t)) ? t : Number(t)); } -const SE = {}, Ar = (t) => SE[t], wm = (t, e) => { - SE[t] = e; +const EE = {}, Ar = (t) => EE[t], wm = (t, e) => { + EE[t] = e; }; class yG { constructor(e) { @@ -25189,11 +25189,11 @@ class yG { return new as(new As(n, Ar("disableProviderPing"))); } } -var wG = Object.defineProperty, xG = Object.defineProperties, _G = Object.getOwnPropertyDescriptors, X3 = Object.getOwnPropertySymbols, EG = Object.prototype.hasOwnProperty, SG = Object.prototype.propertyIsEnumerable, Z3 = (t, e, r) => e in t ? wG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Q3 = (t, e) => { - for (var r in e || (e = {})) EG.call(e, r) && Z3(t, r, e[r]); - if (X3) for (var r of X3(e)) SG.call(e, r) && Z3(t, r, e[r]); +var wG = Object.defineProperty, xG = Object.defineProperties, _G = Object.getOwnPropertyDescriptors, J3 = Object.getOwnPropertySymbols, EG = Object.prototype.hasOwnProperty, SG = Object.prototype.propertyIsEnumerable, X3 = (t, e, r) => e in t ? wG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Z3 = (t, e) => { + for (var r in e || (e = {})) EG.call(e, r) && X3(t, r, e[r]); + if (J3) for (var r of J3(e)) SG.call(e, r) && X3(t, r, e[r]); return t; -}, e_ = (t, e) => xG(t, _G(e)); +}, Q3 = (t, e) => xG(t, _G(e)); class AG { constructor(e) { this.name = "eip155", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.httpProviders = this.createHttpProviders(), this.chainId = parseInt(this.getDefaultChain()); @@ -25278,7 +25278,7 @@ class AG { if (a != null && a[s]) return a == null ? void 0 : a[s]; const u = await this.client.request(e); try { - await this.client.session.update(e.topic, { sessionProperties: e_(Q3({}, o.sessionProperties || {}), { capabilities: e_(Q3({}, a || {}), { [s]: u }) }) }); + await this.client.session.update(e.topic, { sessionProperties: Q3(Z3({}, o.sessionProperties || {}), { capabilities: Q3(Z3({}, a || {}), { [s]: u }) }) }); } catch (l) { console.warn("Failed to update session with capabilities", l); } @@ -25772,17 +25772,17 @@ class NG { return new as(new As(n, Ar("disableProviderPing"))); } } -var LG = Object.defineProperty, kG = Object.defineProperties, $G = Object.getOwnPropertyDescriptors, t_ = Object.getOwnPropertySymbols, BG = Object.prototype.hasOwnProperty, FG = Object.prototype.propertyIsEnumerable, r_ = (t, e, r) => e in t ? LG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, hd = (t, e) => { - for (var r in e || (e = {})) BG.call(e, r) && r_(t, r, e[r]); - if (t_) for (var r of t_(e)) FG.call(e, r) && r_(t, r, e[r]); +var LG = Object.defineProperty, kG = Object.defineProperties, $G = Object.getOwnPropertyDescriptors, e6 = Object.getOwnPropertySymbols, BG = Object.prototype.hasOwnProperty, FG = Object.prototype.propertyIsEnumerable, t6 = (t, e, r) => e in t ? LG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, hd = (t, e) => { + for (var r in e || (e = {})) BG.call(e, r) && t6(t, r, e[r]); + if (e6) for (var r of e6(e)) FG.call(e, r) && t6(t, r, e[r]); return t; }, xm = (t, e) => kG(t, $G(e)); -let N1 = class AE { +let N1 = class SE { constructor(e) { - this.events = new Bv(), this.rpcProviders = {}, this.shouldAbortPairingAttempt = !1, this.maxPairingAttempts = 10, this.disableProviderPing = !1, this.providerOpts = e, this.logger = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : ql($0({ level: (e == null ? void 0 : e.logger) || H3 })), this.disableProviderPing = (e == null ? void 0 : e.disableProviderPing) || !1; + this.events = new $v(), this.rpcProviders = {}, this.shouldAbortPairingAttempt = !1, this.maxPairingAttempts = 10, this.disableProviderPing = !1, this.providerOpts = e, this.logger = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : ql($0({ level: (e == null ? void 0 : e.logger) || W3 })), this.disableProviderPing = (e == null ? void 0 : e.disableProviderPing) || !1; } static async init(e) { - const r = new AE(e); + const r = new SE(e); return await r.initialize(), r; } async request(e, r, n) { @@ -25814,7 +25814,7 @@ let N1 = class AE { n && (this.uri = n, this.events.emit("display_uri", n)); const s = await i(); if (this.session = s.session, this.session) { - const o = J3(this.session.namespaces); + const o = Y3(this.session.namespaces); this.namespaces = bm(this.namespaces, o), this.persist("namespaces", this.namespaces), this.onConnect(); } return s; @@ -25843,10 +25843,10 @@ let N1 = class AE { const { uri: n, approval: i } = await this.client.connect({ pairingTopic: e, requiredNamespaces: this.namespaces, optionalNamespaces: this.optionalNamespaces, sessionProperties: this.sessionProperties }); n && (this.uri = n, this.events.emit("display_uri", n)), await i().then((s) => { this.session = s; - const o = J3(s.namespaces); + const o = Y3(s.namespaces); this.namespaces = bm(this.namespaces, o), this.persist("namespaces", this.namespaces); }).catch((s) => { - if (s.message !== xE) throw s; + if (s.message !== wE) throw s; r++; }); } while (!this.session); @@ -25882,7 +25882,7 @@ let N1 = class AE { this.logger.trace("Initialized"), await this.createClient(), await this.checkStorage(), this.registerEventListeners(); } async createClient() { - this.client = this.providerOpts.client || await gb.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || H3, relayUrl: this.providerOpts.relayUrl || aG, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); + this.client = this.providerOpts.client || await pb.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || W3, relayUrl: this.providerOpts.relayUrl || aG, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); } createProviders() { if (!this.client) throw new Error("Sign Client not initialized"); @@ -25890,7 +25890,7 @@ let N1 = class AE { const e = [...new Set(Object.keys(this.session.namespaces).map((r) => Ff(r)))]; wm("client", this.client), wm("events", this.events), wm("disableProviderPing", this.disableProviderPing), e.forEach((r) => { if (!this.session) return; - const n = vG(r, this.session), i = EE(n), s = bm(this.namespaces, this.optionalNamespaces), o = xm(hd({}, s[r]), { accounts: n, chains: i }); + const n = vG(r, this.session), i = _E(n), s = bm(this.namespaces, this.optionalNamespaces), o = xm(hd({}, s[r]), { accounts: n, chains: i }); switch (r) { case "eip155": this.rpcProviders[r] = new AG({ namespace: o }); @@ -25988,10 +25988,10 @@ let N1 = class AE { this.session = void 0, this.namespaces = void 0, this.optionalNamespaces = void 0, this.sessionProperties = void 0, this.persist("namespaces", void 0), this.persist("optionalNamespaces", void 0), this.persist("sessionProperties", void 0), await this.cleanupPendingPairings({ deletePairings: !0 }); } persist(e, r) { - this.client.core.storage.setItem(`${K3}/${e}`, r); + this.client.core.storage.setItem(`${H3}/${e}`, r); } async getFromStore(e) { - return await this.client.core.storage.getItem(`${K3}/${e}`); + return await this.client.core.storage.getItem(`${H3}/${e}`); } }; const jG = N1; @@ -26131,13 +26131,13 @@ const fn = { standard: "EIP-3085", message: "Unrecognized chain ID." } -}, PE = "Unspecified error message.", qG = "Unspecified server error."; -function mb(t, e = PE) { +}, AE = "Unspecified error message.", qG = "Unspecified server error."; +function gb(t, e = AE) { if (t && Number.isInteger(t)) { const r = t.toString(); if (k1(L1, r)) return L1[r].message; - if (ME(t)) + if (PE(t)) return qG; } return e; @@ -26146,27 +26146,27 @@ function zG(t) { if (!Number.isInteger(t)) return !1; const e = t.toString(); - return !!(L1[e] || ME(t)); + return !!(L1[e] || PE(t)); } function WG(t, { shouldIncludeStack: e = !1 } = {}) { const r = {}; if (t && typeof t == "object" && !Array.isArray(t) && k1(t, "code") && zG(t.code)) { const n = t; - r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, k1(n, "data") && (r.data = n.data)) : (r.message = mb(r.code), r.data = { originalError: n_(t) }); + r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, k1(n, "data") && (r.data = n.data)) : (r.message = gb(r.code), r.data = { originalError: r6(t) }); } else - r.code = fn.rpc.internal, r.message = i_(t, "message") ? t.message : PE, r.data = { originalError: n_(t) }; - return e && (r.stack = i_(t, "stack") ? t.stack : void 0), r; + r.code = fn.rpc.internal, r.message = n6(t, "message") ? t.message : AE, r.data = { originalError: r6(t) }; + return e && (r.stack = n6(t, "stack") ? t.stack : void 0), r; } -function ME(t) { +function PE(t) { return t >= -32099 && t <= -32e3; } -function n_(t) { +function r6(t) { return t && typeof t == "object" && !Array.isArray(t) ? Object.assign({}, t) : t; } function k1(t, e) { return Object.prototype.hasOwnProperty.call(t, e); } -function i_(t, e) { +function n6(t, e) { return typeof t == "object" && t !== null && e in t && typeof t[e] == "string"; } const Sr = { @@ -26204,19 +26204,19 @@ const Sr = { const { code: e, message: r, data: n } = t; if (!r || typeof r != "string") throw new Error('"message" must be a nonempty string'); - return new TE(e, r, n); + return new CE(e, r, n); } } }; function Gi(t, e) { - const [r, n] = IE(e); - return new CE(t, r || mb(t), n); + const [r, n] = ME(e); + return new IE(t, r || gb(t), n); } function Vc(t, e) { - const [r, n] = IE(e); - return new TE(t, r || mb(t), n); + const [r, n] = ME(e); + return new CE(t, r || gb(t), n); } -function IE(t) { +function ME(t) { if (t) { if (typeof t == "string") return [t]; @@ -26229,7 +26229,7 @@ function IE(t) { } return []; } -class CE extends Error { +class IE extends Error { constructor(e, r, n) { if (!Number.isInteger(e)) throw new Error('"code" must be an integer.'); @@ -26238,7 +26238,7 @@ class CE extends Error { super(r), this.code = e, n !== void 0 && (this.data = n); } } -class TE extends CE { +class CE extends IE { /** * Create an Ethereum Provider JSON-RPC error. * `code` must be an integer in the 1000 <= 4999 range. @@ -26252,18 +26252,18 @@ class TE extends CE { function HG(t) { return Number.isInteger(t) && t >= 1e3 && t <= 4999; } -function vb() { +function mb() { return (t) => t; } -const Al = vb(), KG = vb(), VG = vb(); +const Al = mb(), KG = mb(), VG = mb(); function _o(t) { return Math.floor(t); } -const RE = /^[0-9]*$/, DE = /^[a-f0-9]*$/; +const TE = /^[0-9]*$/, RE = /^[a-f0-9]*$/; function Qa(t) { - return bb(crypto.getRandomValues(new Uint8Array(t))); + return vb(crypto.getRandomValues(new Uint8Array(t))); } -function bb(t) { +function vb(t) { return [...t].map((e) => e.toString(16).padStart(2, "0")).join(""); } function Dd(t) { @@ -26282,38 +26282,38 @@ function $s(t) { function pa(t) { return Al(`0x${BigInt(t).toString(16)}`); } -function OE(t) { +function DE(t) { return t.startsWith("0x") || t.startsWith("0X"); } -function yb(t) { - return OE(t) ? t.slice(2) : t; +function bb(t) { + return DE(t) ? t.slice(2) : t; } -function NE(t) { - return OE(t) ? `0x${t.slice(2)}` : `0x${t}`; +function OE(t) { + return DE(t) ? `0x${t.slice(2)}` : `0x${t}`; } function ap(t) { if (typeof t != "string") return !1; - const e = yb(t).toLowerCase(); - return DE.test(e); + const e = bb(t).toLowerCase(); + return RE.test(e); } function GG(t, e = !1) { if (typeof t == "string") { - const r = yb(t).toLowerCase(); - if (DE.test(r)) + const r = bb(t).toLowerCase(); + if (RE.test(r)) return Al(e ? `0x${r}` : r); } throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`); } -function wb(t, e = !1) { +function yb(t, e = !1) { let r = GG(t, !1); return r.length % 2 === 1 && (r = Al(`0${r}`)), e ? Al(`0x${r}`) : r; } function ra(t) { if (typeof t == "string") { - const e = yb(t).toLowerCase(); + const e = bb(t).toLowerCase(); if (ap(e) && e.length === 40) - return KG(NE(e)); + return KG(OE(e)); } throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`); } @@ -26322,7 +26322,7 @@ function $1(t) { return t; if (typeof t == "string") { if (ap(t)) { - const e = wb(t, !1); + const e = yb(t, !1); return Buffer.from(e, "hex"); } return Buffer.from(t, "utf8"); @@ -26333,10 +26333,10 @@ function Kf(t) { if (typeof t == "number" && Number.isInteger(t)) return _o(t); if (typeof t == "string") { - if (RE.test(t)) + if (TE.test(t)) return _o(Number(t)); if (ap(t)) - return _o(Number(BigInt(wb(t, !0)))); + return _o(Number(BigInt(yb(t, !0)))); } throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`); } @@ -26346,10 +26346,10 @@ function Rf(t) { if (typeof t == "number") return BigInt(Kf(t)); if (typeof t == "string") { - if (RE.test(t)) + if (TE.test(t)) return BigInt(t); if (ap(t)) - return BigInt(wb(t, !0)); + return BigInt(yb(t, !0)); } throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`); } @@ -26395,7 +26395,7 @@ async function eY(t, { iv: e, cipherText: r }) { }, t, r); return new TextDecoder().decode(n); } -function LE(t) { +function NE(t) { switch (t) { case "public": return "spki"; @@ -26403,12 +26403,12 @@ function LE(t) { return "pkcs8"; } } -async function kE(t, e) { - const r = LE(t), n = await crypto.subtle.exportKey(r, e); - return bb(new Uint8Array(n)); +async function LE(t, e) { + const r = NE(t), n = await crypto.subtle.exportKey(r, e); + return vb(new Uint8Array(n)); } -async function $E(t, e) { - const r = LE(t), n = Dd(e).buffer; +async function kE(t, e) { + const r = NE(t), n = Dd(e).buffer; return await crypto.subtle.importKey(r, new Uint8Array(n), { name: "ECDH", namedCurve: "P-256" @@ -26467,15 +26467,15 @@ class nY { // storage methods async loadKey(e) { const r = this.storage.getItem(e.storageKey); - return r ? $E(e.keyType, r) : null; + return r ? kE(e.keyType, r) : null; } async storeKey(e, r) { - const n = await kE(e.keyType, r); + const n = await LE(e.keyType, r); this.storage.setItem(e.storageKey, n); } } -const nh = "4.2.4", BE = "@coinbase/wallet-sdk"; -async function FE(t, e) { +const nh = "4.2.4", $E = "@coinbase/wallet-sdk"; +async function BE(t, e) { const r = Object.assign(Object.assign({}, t), { jsonrpc: "2.0", id: crypto.randomUUID() }), n = await window.fetch(e, { method: "POST", body: JSON.stringify(r), @@ -26483,7 +26483,7 @@ async function FE(t, e) { headers: { "Content-Type": "application/json", "X-Cbw-Sdk-Version": nh, - "X-Cbw-Sdk-Platform": BE + "X-Cbw-Sdk-Platform": $E } }), { result: i, error: s } = await n.json(); if (s) @@ -26539,11 +26539,11 @@ function aY(t) { throw Sr.provider.unsupportedMethod(); } } -const s_ = "accounts", o_ = "activeChain", a_ = "availableChains", c_ = "walletCapabilities"; +const i6 = "accounts", s6 = "activeChain", o6 = "availableChains", a6 = "walletCapabilities"; class cY { constructor(e) { var r, n, i; - this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new nY(), this.storage = new eo("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(s_)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(o_) || { + this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new nY(), this.storage = new eo("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(i6)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(s6) || { id: (i = (n = e.metadata.appChainIds) === null || n === void 0 ? void 0 : n[0]) !== null && i !== void 0 ? i : 1 }, this.handshake = this.handshake.bind(this), this.request = this.request.bind(this), this.createRequestMessage = this.createRequestMessage.bind(this), this.decryptResponseMessage = this.decryptResponseMessage.bind(this); } @@ -26557,13 +26557,13 @@ class cY { }), s = await this.communicator.postRequestAndWaitForResponse(i); if ("failure" in s.content) throw s.content.failure; - const o = await $E("public", s.sender); + const o = await kE("public", s.sender); await this.keyManager.setPeerPublicKey(o); const u = (await this.decryptResponseMessage(s)).result; if ("error" in u) throw u.error; const l = u.value; - this.accounts = l, this.storage.storeObject(s_, l), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", l); + this.accounts = l, this.storage.storeObject(i6, l), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", l); } async request(e) { var r; @@ -26581,7 +26581,7 @@ class cY { case "eth_chainId": return pa(this.chain.id); case "wallet_getCapabilities": - return this.storage.loadObject(c_); + return this.storage.loadObject(a6); case "wallet_switchEthereumChain": return this.handleSwitchChainRequest(e); case "eth_ecRecover": @@ -26602,7 +26602,7 @@ class cY { default: if (!this.chain.rpcUrl) throw Sr.rpc.internal("No RPC URL set for chain"); - return FE(e, this.chain.rpcUrl); + return BE(e, this.chain.rpcUrl); } } async sendRequestToPopup(e) { @@ -26645,7 +26645,7 @@ class cY { return this.communicator.postRequestAndWaitForResponse(i); } async createRequestMessage(e) { - const r = await kE("public", await this.keyManager.getOwnPublicKey()); + const r = await LE("public", await this.keyManager.getOwnPublicKey()); return { id: crypto.randomUUID(), sender: r, @@ -26667,25 +26667,25 @@ class cY { id: Number(d), rpcUrl: p })); - this.storage.storeObject(a_, l), this.updateChain(this.chain.id, l); + this.storage.storeObject(o6, l), this.updateChain(this.chain.id, l); } const u = (n = o.data) === null || n === void 0 ? void 0 : n.capabilities; - return u && this.storage.storeObject(c_, u), o; + return u && this.storage.storeObject(a6, u), o; } updateChain(e, r) { var n; - const i = r ?? this.storage.loadObject(a_), s = i == null ? void 0 : i.find((o) => o.id === e); - return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(o_, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(s.id))), !0) : !1; + const i = r ?? this.storage.loadObject(o6), s = i == null ? void 0 : i.find((o) => o.id === e); + return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(s6, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(s.id))), !0) : !1; } } -const uY = /* @__PURE__ */ wv(UD), { keccak_256: fY } = uY; -function jE(t) { +const uY = /* @__PURE__ */ yv(UD), { keccak_256: fY } = uY; +function FE(t) { return Buffer.allocUnsafe(t).fill(0); } function lY(t) { return t.toString(2).length; } -function UE(t, e) { +function jE(t, e) { let r = t.toString(16); r.length % 2 !== 0 && (r = "0" + r); const n = r.match(/.{1,2}/g).map((i) => parseInt(i, 16)); @@ -26703,25 +26703,25 @@ function hY(t, e) { n = t; return n &= (1n << BigInt(e)) - 1n, n; } -function qE(t, e, r) { - const n = jE(e); +function UE(t, e, r) { + const n = FE(e); return t = cp(t), r ? t.length < e ? (t.copy(n), n) : t.slice(0, e) : t.length < e ? (t.copy(n, e - t.length), n) : t.slice(-e); } function dY(t, e) { - return qE(t, e, !0); + return UE(t, e, !0); } function cp(t) { if (!Buffer.isBuffer(t)) if (Array.isArray(t)) t = Buffer.from(t); else if (typeof t == "string") - zE(t) ? t = Buffer.from(mY(WE(t)), "hex") : t = Buffer.from(t); + qE(t) ? t = Buffer.from(mY(zE(t)), "hex") : t = Buffer.from(t); else if (typeof t == "number") t = intToBuffer(t); else if (t == null) t = Buffer.allocUnsafe(0); else if (typeof t == "bigint") - t = UE(t); + t = jE(t); else if (t.toArray) t = Buffer.from(t.toArray()); else @@ -26739,37 +26739,37 @@ function gY(t, e) { function mY(t) { return t.length % 2 ? "0" + t : t; } -function zE(t) { +function qE(t) { return typeof t == "string" && t.match(/^0x[0-9A-Fa-f]*$/); } -function WE(t) { +function zE(t) { return typeof t == "string" && t.startsWith("0x") ? t.slice(2) : t; } -var HE = { - zeros: jE, - setLength: qE, +var WE = { + zeros: FE, + setLength: UE, setLengthRight: dY, - isHexString: zE, - stripHexPrefix: WE, + isHexString: qE, + stripHexPrefix: zE, toBuffer: cp, bufferToHex: pY, keccak: gY, bitLengthFromBigInt: lY, - bufferBEFromBigInt: UE, + bufferBEFromBigInt: jE, twosFromBigInt: hY }; -const si = HE; -function KE(t) { +const si = WE; +function HE(t) { return t.startsWith("int[") ? "int256" + t.slice(3) : t === "int" ? "int256" : t.startsWith("uint[") ? "uint256" + t.slice(4) : t === "uint" ? "uint256" : t.startsWith("fixed[") ? "fixed128x128" + t.slice(5) : t === "fixed" ? "fixed128x128" : t.startsWith("ufixed[") ? "ufixed128x128" + t.slice(6) : t === "ufixed" ? "ufixed128x128" : t; } function pu(t) { return Number.parseInt(/^\D+(\d+)$/.exec(t)[1], 10); } -function u_(t) { +function c6(t) { var e = /^\D+(\d+)x(\d+)$/.exec(t); return [Number.parseInt(e[1], 10), Number.parseInt(e[2], 10)]; } -function VE(t) { +function KE(t) { var e = t.match(/(.*)\[(.*?)\]$/); return e ? e[2] === "" ? "dynamic" : Number.parseInt(e[2], 10) : null; } @@ -26792,7 +26792,7 @@ function qs(t, e) { if (bY(t)) { if (typeof e.length > "u") throw new Error("Not an array?"); - if (r = VE(t), r !== "dynamic" && r !== 0 && e.length > r) + if (r = KE(t), r !== "dynamic" && r !== 0 && e.length > r) throw new Error("Elements exceed array size: " + r); i = [], t = t.slice(0, t.lastIndexOf("[")), typeof e == "string" && (e = JSON.parse(e)); for (s in e) @@ -26829,16 +26829,16 @@ function qs(t, e) { const u = si.twosFromBigInt(n, 256); return si.bufferBEFromBigInt(u, 32); } else if (t.startsWith("ufixed")) { - if (r = u_(t), n = ec(e), n < 0) + if (r = c6(t), n = ec(e), n < 0) throw new Error("Supplied ufixed is negative"); return qs("uint256", n * BigInt(2) ** BigInt(r[1])); } else if (t.startsWith("fixed")) - return r = u_(t), qs("int256", ec(e) * BigInt(2) ** BigInt(r[1])); + return r = c6(t), qs("int256", ec(e) * BigInt(2) ** BigInt(r[1])); } throw new Error("Unsupported or invalid type: " + t); } function vY(t) { - return t === "string" || t === "bytes" || VE(t) === "dynamic"; + return t === "string" || t === "bytes" || KE(t) === "dynamic"; } function bY(t) { return t.lastIndexOf("]") === t.length - 1; @@ -26846,16 +26846,16 @@ function bY(t) { function yY(t, e) { var r = [], n = [], i = 32 * t.length; for (var s in t) { - var o = KE(t[s]), a = e[s], u = qs(o, a); + var o = HE(t[s]), a = e[s], u = qs(o, a); vY(o) ? (r.push(qs("uint256", i)), n.push(u), i += u.length) : r.push(u); } return Buffer.concat(r.concat(n)); } -function GE(t, e) { +function VE(t, e) { if (t.length !== e.length) throw new Error("Number of types are not matching the values"); for (var r, n, i = [], s = 0; s < t.length; s++) { - var o = KE(t[s]), a = e[s]; + var o = HE(t[s]), a = e[s]; if (o === "bytes") i.push(a); else if (o === "string") @@ -26891,14 +26891,14 @@ function GE(t, e) { return Buffer.concat(i); } function wY(t, e) { - return si.keccak(GE(t, e)); + return si.keccak(VE(t, e)); } var xY = { rawEncode: yY, - solidityPack: GE, + solidityPack: VE, soliditySHA3: wY }; -const ys = HE, Vf = xY, YE = { +const ys = WE, Vf = xY, GE = { type: "object", properties: { types: { @@ -27035,7 +27035,7 @@ const ys = HE, Vf = xY, YE = { */ sanitizeData(t) { const e = {}; - for (const r in YE.properties) + for (const r in GE.properties) t[r] && (e[r] = t[r]); return e.types && (e.types = Object.assign({ EIP712Domain: [] }, e.types)), e; }, @@ -27051,7 +27051,7 @@ const ys = HE, Vf = xY, YE = { } }; var _Y = { - TYPED_MESSAGE_SCHEMA: YE, + TYPED_MESSAGE_SCHEMA: GE, TypedDataUtils: Pm, hashForSignTypedDataLegacy: function(t) { return EY(t.data); @@ -27106,7 +27106,7 @@ class PY { name: "AES-GCM", iv: n }, i, s.encode(e)), a = 16, u = o.slice(o.byteLength - a), l = o.slice(0, o.byteLength - a), d = new Uint8Array(u), p = new Uint8Array(l), w = new Uint8Array([...n, ...d, ...p]); - return bb(w); + return vb(w); } /** * @@ -27258,7 +27258,7 @@ class IY { e && (this.webSocket = null, e.onclose = null, e.onerror = null, e.onmessage = null, e.onopen = null); } } -const f_ = 1e4, CY = 6e4; +const u6 = 1e4, CY = 6e4; class TY { /** * Constructor @@ -27322,7 +27322,7 @@ class TY { case Po.CONNECTED: o = await this.handleConnected(), this.updateLastHeartbeat(), setInterval(() => { this.heartbeat(); - }, f_), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); + }, u6), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); break; case Po.CONNECTING: break; @@ -27448,7 +27448,7 @@ class TY { this.lastHeartbeatResponse = Date.now(); } heartbeat() { - if (Date.now() - this.lastHeartbeatResponse > f_ * 2) { + if (Date.now() - this.lastHeartbeatResponse > u6 * 2) { this.ws.disconnect(); return; } @@ -27497,21 +27497,21 @@ class RY { } makeRequestId() { this._nextRequestId = (this._nextRequestId + 1) % 2147483647; - const e = this._nextRequestId, r = NE(e.toString(16)); + const e = this._nextRequestId, r = OE(e.toString(16)); return this.callbacks.get(r) && this.callbacks.delete(r), e; } } -const l_ = "session:id", h_ = "session:secret", d_ = "session:linked"; +const f6 = "session:id", l6 = "session:secret", h6 = "session:linked"; class gu { constructor(e, r, n, i = !1) { - this.storage = e, this.id = r, this.secret = n, this.key = _D(i4(`${r}, ${n} WalletLink`)), this._linked = !!i; + this.storage = e, this.id = r, this.secret = n, this.key = _D(n4(`${r}, ${n} WalletLink`)), this._linked = !!i; } static create(e) { const r = Qa(16), n = Qa(32); return new gu(e, r, n).save(); } static load(e) { - const r = e.getItem(l_), n = e.getItem(d_), i = e.getItem(h_); + const r = e.getItem(f6), n = e.getItem(h6), i = e.getItem(l6); return r && i ? new gu(e, r, i, n === "1") : null; } get linked() { @@ -27521,10 +27521,10 @@ class gu { this._linked = e, this.persistLinked(); } save() { - return this.storage.setItem(l_, this.id), this.storage.setItem(h_, this.secret), this.persistLinked(), this; + return this.storage.setItem(f6, this.id), this.storage.setItem(l6, this.secret), this.persistLinked(), this; } persistLinked() { - this.storage.setItem(d_, this._linked ? "1" : "0"); + this.storage.setItem(h6, this._linked ? "1" : "0"); } } function DY() { @@ -27545,32 +27545,32 @@ function NY() { var t; return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t = window == null ? void 0 : window.navigator) === null || t === void 0 ? void 0 : t.userAgent); } -function JE() { +function YE() { var t, e; return (e = (t = window == null ? void 0 : window.matchMedia) === null || t === void 0 ? void 0 : t.call(window, "(prefers-color-scheme: dark)").matches) !== null && e !== void 0 ? e : !1; } const LY = '@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}'; -function XE() { +function JE() { const t = document.createElement("style"); t.type = "text/css", t.appendChild(document.createTextNode(LY)), document.documentElement.appendChild(t); } -function ZE(t) { +function XE(t) { var e, r, n = ""; if (typeof t == "string" || typeof t == "number") n += t; - else if (typeof t == "object") if (Array.isArray(t)) for (e = 0; e < t.length; e++) t[e] && (r = ZE(t[e])) && (n && (n += " "), n += r); + else if (typeof t == "object") if (Array.isArray(t)) for (e = 0; e < t.length; e++) t[e] && (r = XE(t[e])) && (n && (n += " "), n += r); else for (e in t) t[e] && (n && (n += " "), n += e); return n; } function Gf() { - for (var t, e, r = 0, n = ""; r < arguments.length; ) (t = arguments[r++]) && (e = ZE(t)) && (n && (n += " "), n += e); + for (var t, e, r = 0, n = ""; r < arguments.length; ) (t = arguments[r++]) && (e = XE(t)) && (n && (n += " "), n += e); return n; } -var up, Jr, QE, tc, p_, eS, F1, tS, xb, j1, U1, Pl = {}, rS = [], kY = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, _b = Array.isArray; +var up, Jr, ZE, tc, d6, QE, F1, eS, wb, j1, U1, Pl = {}, tS = [], kY = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, xb = Array.isArray; function ga(t, e) { for (var r in e) t[r] = e[r]; return t; } -function Eb(t) { +function _b(t) { t && t.parentNode && t.parentNode.removeChild(t); } function Nr(t, e, r) { @@ -27580,7 +27580,7 @@ function Nr(t, e, r) { return Od(t, o, n, i, null); } function Od(t, e, r, n, i) { - var s = { type: t, props: e, key: r, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++QE, __i: -1, __u: 0 }; + var s = { type: t, props: e, key: r, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++ZE, __i: -1, __u: 0 }; return i == null && Jr.vnode != null && Jr.vnode(s), s; } function ih(t) { @@ -27594,39 +27594,39 @@ function Pu(t, e) { for (var r; e < t.__k.length; e++) if ((r = t.__k[e]) != null && r.__e != null) return r.__e; return typeof t.type == "function" ? Pu(t) : null; } -function nS(t) { +function rS(t) { var e, r; if ((t = t.__) != null && t.__c != null) { for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) if ((r = t.__k[e]) != null && r.__e != null) { t.__e = t.__c.base = r.__e; break; } - return nS(t); + return rS(t); } } -function g_(t) { - (!t.__d && (t.__d = !0) && tc.push(t) && !d0.__r++ || p_ !== Jr.debounceRendering) && ((p_ = Jr.debounceRendering) || eS)(d0); +function p6(t) { + (!t.__d && (t.__d = !0) && tc.push(t) && !d0.__r++ || d6 !== Jr.debounceRendering) && ((d6 = Jr.debounceRendering) || QE)(d0); } function d0() { var t, e, r, n, i, s, o, a; - for (tc.sort(F1); t = tc.shift(); ) t.__d && (e = tc.length, n = void 0, s = (i = (r = t).__v).__e, o = [], a = [], r.__P && ((n = ga({}, i)).__v = i.__v + 1, Jr.vnode && Jr.vnode(n), Sb(r.__P, n, i, r.__n, r.__P.namespaceURI, 32 & i.__u ? [s] : null, o, s ?? Pu(i), !!(32 & i.__u), a), n.__v = i.__v, n.__.__k[n.__i] = n, oS(o, n, a), n.__e != s && nS(n)), tc.length > e && tc.sort(F1)); + for (tc.sort(F1); t = tc.shift(); ) t.__d && (e = tc.length, n = void 0, s = (i = (r = t).__v).__e, o = [], a = [], r.__P && ((n = ga({}, i)).__v = i.__v + 1, Jr.vnode && Jr.vnode(n), Eb(r.__P, n, i, r.__n, r.__P.namespaceURI, 32 & i.__u ? [s] : null, o, s ?? Pu(i), !!(32 & i.__u), a), n.__v = i.__v, n.__.__k[n.__i] = n, sS(o, n, a), n.__e != s && rS(n)), tc.length > e && tc.sort(F1)); d0.__r = 0; } -function iS(t, e, r, n, i, s, o, a, u, l, d) { - var p, w, A, M, N, L, $ = n && n.__k || rS, B = e.length; - for (u = $Y(r, e, $, u), p = 0; p < B; p++) (A = r.__k[p]) != null && (w = A.__i === -1 ? Pl : $[A.__i] || Pl, A.__i = p, L = Sb(t, A, w, i, s, o, a, u, l, d), M = A.__e, A.ref && w.ref != A.ref && (w.ref && Ab(w.ref, null, A), d.push(A.ref, A.__c || M, A)), N == null && M != null && (N = M), 4 & A.__u || w.__k === A.__k ? u = sS(A, u, t) : typeof A.type == "function" && L !== void 0 ? u = L : M && (u = M.nextSibling), A.__u &= -7); +function nS(t, e, r, n, i, s, o, a, u, l, d) { + var p, w, A, M, N, L, B = n && n.__k || tS, $ = e.length; + for (u = $Y(r, e, B, u), p = 0; p < $; p++) (A = r.__k[p]) != null && (w = A.__i === -1 ? Pl : B[A.__i] || Pl, A.__i = p, L = Eb(t, A, w, i, s, o, a, u, l, d), M = A.__e, A.ref && w.ref != A.ref && (w.ref && Sb(w.ref, null, A), d.push(A.ref, A.__c || M, A)), N == null && M != null && (N = M), 4 & A.__u || w.__k === A.__k ? u = iS(A, u, t) : typeof A.type == "function" && L !== void 0 ? u = L : M && (u = M.nextSibling), A.__u &= -7); return r.__e = N, u; } function $Y(t, e, r, n) { var i, s, o, a, u, l = e.length, d = r.length, p = d, w = 0; - for (t.__k = [], i = 0; i < l; i++) (s = e[i]) != null && typeof s != "boolean" && typeof s != "function" ? (a = i + w, (s = t.__k[i] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Od(null, s, null, null, null) : _b(s) ? Od(ih, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? Od(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, o = null, (u = s.__i = BY(s, r, a, p)) !== -1 && (p--, (o = r[u]) && (o.__u |= 2)), o == null || o.__v === null ? (u == -1 && w--, typeof s.type != "function" && (s.__u |= 4)) : u !== a && (u == a - 1 ? w-- : u == a + 1 ? w++ : (u > a ? w-- : w++, s.__u |= 4))) : s = t.__k[i] = null; - if (p) for (i = 0; i < d; i++) (o = r[i]) != null && !(2 & o.__u) && (o.__e == n && (n = Pu(o)), aS(o, o)); + for (t.__k = [], i = 0; i < l; i++) (s = e[i]) != null && typeof s != "boolean" && typeof s != "function" ? (a = i + w, (s = t.__k[i] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Od(null, s, null, null, null) : xb(s) ? Od(ih, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? Od(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, o = null, (u = s.__i = BY(s, r, a, p)) !== -1 && (p--, (o = r[u]) && (o.__u |= 2)), o == null || o.__v === null ? (u == -1 && w--, typeof s.type != "function" && (s.__u |= 4)) : u !== a && (u == a - 1 ? w-- : u == a + 1 ? w++ : (u > a ? w-- : w++, s.__u |= 4))) : s = t.__k[i] = null; + if (p) for (i = 0; i < d; i++) (o = r[i]) != null && !(2 & o.__u) && (o.__e == n && (n = Pu(o)), oS(o, o)); return n; } -function sS(t, e, r) { +function iS(t, e, r) { var n, i; if (typeof t.type == "function") { - for (n = t.__k, i = 0; n && i < n.length; i++) n[i] && (n[i].__ = t, e = sS(n[i], e, r)); + for (n = t.__k, i = 0; n && i < n.length; i++) n[i] && (n[i].__ = t, e = iS(n[i], e, r)); return e; } t.__e != e && (e && t.type && !r.contains(e) && (e = Pu(t)), r.insertBefore(t.__e, e || null), e = t.__e); @@ -27650,17 +27650,17 @@ function BY(t, e, r, n) { } return -1; } -function m_(t, e, r) { +function g6(t, e, r) { e[0] === "-" ? t.setProperty(e, r ?? "") : t[e] = r == null ? "" : typeof r != "number" || kY.test(e) ? r : r + "px"; } function pd(t, e, r, n, i) { var s; e: if (e === "style") if (typeof r == "string") t.style.cssText = r; else { - if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || m_(t.style, e, ""); - if (r) for (e in r) n && r[e] === n[e] || m_(t.style, e, r[e]); + if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || g6(t.style, e, ""); + if (r) for (e in r) n && r[e] === n[e] || g6(t.style, e, r[e]); } - else if (e[0] === "o" && e[1] === "n") s = e !== (e = e.replace(tS, "$1")), e = e.toLowerCase() in t || e === "onFocusOut" || e === "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = xb, t.addEventListener(e, s ? U1 : j1, s)) : t.removeEventListener(e, s ? U1 : j1, s); + else if (e[0] === "o" && e[1] === "n") s = e !== (e = e.replace(eS, "$1")), e = e.toLowerCase() in t || e === "onFocusOut" || e === "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = wb, t.addEventListener(e, s ? U1 : j1, s)) : t.removeEventListener(e, s ? U1 : j1, s); else { if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try { @@ -27671,54 +27671,54 @@ function pd(t, e, r, n, i) { typeof r == "function" || (r == null || r === !1 && e[4] !== "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && r == 1 ? "" : r)); } } -function v_(t) { +function m6(t) { return function(e) { if (this.l) { var r = this.l[e.type + t]; - if (e.t == null) e.t = xb++; + if (e.t == null) e.t = wb++; else if (e.t < r.u) return; return r(Jr.event ? Jr.event(e) : e); } }; } -function Sb(t, e, r, n, i, s, o, a, u, l) { - var d, p, w, A, M, N, L, $, B, H, U, V, te, R, K, ge, Ee, Y = e.type; +function Eb(t, e, r, n, i, s, o, a, u, l) { + var d, p, w, A, M, N, L, B, $, H, U, V, te, R, K, ge, Ee, Y = e.type; if (e.constructor !== void 0) return null; 128 & r.__u && (u = !!(32 & r.__u), s = [a = e.__e = r.__e]), (d = Jr.__b) && d(e); e: if (typeof Y == "function") try { - if ($ = e.props, B = "prototype" in Y && Y.prototype.render, H = (d = Y.contextType) && n[d.__c], U = d ? H ? H.props.value : d.__ : n, r.__c ? L = (p = e.__c = r.__c).__ = p.__E : (B ? e.__c = p = new Y($, U) : (e.__c = p = new Nd($, U), p.constructor = Y, p.render = jY), H && H.sub(p), p.props = $, p.state || (p.state = {}), p.context = U, p.__n = n, w = p.__d = !0, p.__h = [], p._sb = []), B && p.__s == null && (p.__s = p.state), B && Y.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = ga({}, p.__s)), ga(p.__s, Y.getDerivedStateFromProps($, p.__s))), A = p.props, M = p.state, p.__v = e, w) B && Y.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), B && p.componentDidMount != null && p.__h.push(p.componentDidMount); + if (B = e.props, $ = "prototype" in Y && Y.prototype.render, H = (d = Y.contextType) && n[d.__c], U = d ? H ? H.props.value : d.__ : n, r.__c ? L = (p = e.__c = r.__c).__ = p.__E : ($ ? e.__c = p = new Y(B, U) : (e.__c = p = new Nd(B, U), p.constructor = Y, p.render = jY), H && H.sub(p), p.props = B, p.state || (p.state = {}), p.context = U, p.__n = n, w = p.__d = !0, p.__h = [], p._sb = []), $ && p.__s == null && (p.__s = p.state), $ && Y.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = ga({}, p.__s)), ga(p.__s, Y.getDerivedStateFromProps(B, p.__s))), A = p.props, M = p.state, p.__v = e, w) $ && Y.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), $ && p.componentDidMount != null && p.__h.push(p.componentDidMount); else { - if (B && Y.getDerivedStateFromProps == null && $ !== A && p.componentWillReceiveProps != null && p.componentWillReceiveProps($, U), !p.__e && (p.shouldComponentUpdate != null && p.shouldComponentUpdate($, p.__s, U) === !1 || e.__v === r.__v)) { - for (e.__v !== r.__v && (p.props = $, p.state = p.__s, p.__d = !1), e.__e = r.__e, e.__k = r.__k, e.__k.some(function(S) { + if ($ && Y.getDerivedStateFromProps == null && B !== A && p.componentWillReceiveProps != null && p.componentWillReceiveProps(B, U), !p.__e && (p.shouldComponentUpdate != null && p.shouldComponentUpdate(B, p.__s, U) === !1 || e.__v === r.__v)) { + for (e.__v !== r.__v && (p.props = B, p.state = p.__s, p.__d = !1), e.__e = r.__e, e.__k = r.__k, e.__k.some(function(S) { S && (S.__ = e); }), V = 0; V < p._sb.length; V++) p.__h.push(p._sb[V]); p._sb = [], p.__h.length && o.push(p); break e; } - p.componentWillUpdate != null && p.componentWillUpdate($, p.__s, U), B && p.componentDidUpdate != null && p.__h.push(function() { + p.componentWillUpdate != null && p.componentWillUpdate(B, p.__s, U), $ && p.componentDidUpdate != null && p.__h.push(function() { p.componentDidUpdate(A, M, N); }); } - if (p.context = U, p.props = $, p.__P = t, p.__e = !1, te = Jr.__r, R = 0, B) { + if (p.context = U, p.props = B, p.__P = t, p.__e = !1, te = Jr.__r, R = 0, $) { for (p.state = p.__s, p.__d = !1, te && te(e), d = p.render(p.props, p.state, p.context), K = 0; K < p._sb.length; K++) p.__h.push(p._sb[K]); p._sb = []; } else do p.__d = !1, te && te(e), d = p.render(p.props, p.state, p.context), p.state = p.__s; while (p.__d && ++R < 25); - p.state = p.__s, p.getChildContext != null && (n = ga(ga({}, n), p.getChildContext())), B && !w && p.getSnapshotBeforeUpdate != null && (N = p.getSnapshotBeforeUpdate(A, M)), a = iS(t, _b(ge = d != null && d.type === ih && d.key == null ? d.props.children : d) ? ge : [ge], e, r, n, i, s, o, a, u, l), p.base = e.__e, e.__u &= -161, p.__h.length && o.push(p), L && (p.__E = p.__ = null); + p.state = p.__s, p.getChildContext != null && (n = ga(ga({}, n), p.getChildContext())), $ && !w && p.getSnapshotBeforeUpdate != null && (N = p.getSnapshotBeforeUpdate(A, M)), a = nS(t, xb(ge = d != null && d.type === ih && d.key == null ? d.props.children : d) ? ge : [ge], e, r, n, i, s, o, a, u, l), p.base = e.__e, e.__u &= -161, p.__h.length && o.push(p), L && (p.__E = p.__ = null); } catch (S) { if (e.__v = null, u || s != null) if (S.then) { for (e.__u |= u ? 160 : 128; a && a.nodeType === 8 && a.nextSibling; ) a = a.nextSibling; s[s.indexOf(a)] = null, e.__e = a; - } else for (Ee = s.length; Ee--; ) Eb(s[Ee]); + } else for (Ee = s.length; Ee--; ) _b(s[Ee]); else e.__e = r.__e, e.__k = r.__k; Jr.__e(S, e, r); } else s == null && e.__v === r.__v ? (e.__k = r.__k, e.__e = r.__e) : a = e.__e = FY(r.__e, e, r, n, i, s, o, u, l); return (d = Jr.diffed) && d(e), 128 & e.__u ? void 0 : a; } -function oS(t, e, r) { - for (var n = 0; n < r.length; n++) Ab(r[n], r[++n], r[++n]); +function sS(t, e, r) { + for (var n = 0; n < r.length; n++) Sb(r[n], r[++n], r[++n]); Jr.__c && Jr.__c(e, t), t.some(function(i) { try { t = i.__h, i.__h = [], t.some(function(s) { @@ -27730,35 +27730,35 @@ function oS(t, e, r) { }); } function FY(t, e, r, n, i, s, o, a, u) { - var l, d, p, w, A, M, N, L = r.props, $ = e.props, B = e.type; - if (B === "svg" ? i = "http://www.w3.org/2000/svg" : B === "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) { - for (l = 0; l < s.length; l++) if ((A = s[l]) && "setAttribute" in A == !!B && (B ? A.localName === B : A.nodeType === 3)) { + var l, d, p, w, A, M, N, L = r.props, B = e.props, $ = e.type; + if ($ === "svg" ? i = "http://www.w3.org/2000/svg" : $ === "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) { + for (l = 0; l < s.length; l++) if ((A = s[l]) && "setAttribute" in A == !!$ && ($ ? A.localName === $ : A.nodeType === 3)) { t = A, s[l] = null; break; } } if (t == null) { - if (B === null) return document.createTextNode($); - t = document.createElementNS(i, B, $.is && $), a && (Jr.__m && Jr.__m(e, s), a = !1), s = null; + if ($ === null) return document.createTextNode(B); + t = document.createElementNS(i, $, B.is && B), a && (Jr.__m && Jr.__m(e, s), a = !1), s = null; } - if (B === null) L === $ || a && t.data === $ || (t.data = $); + if ($ === null) L === B || a && t.data === B || (t.data = B); else { if (s = s && up.call(t.childNodes), L = r.props || Pl, !a && s != null) for (L = {}, l = 0; l < t.attributes.length; l++) L[(A = t.attributes[l]).name] = A.value; for (l in L) if (A = L[l], l != "children") { if (l == "dangerouslySetInnerHTML") p = A; - else if (!(l in $)) { - if (l == "value" && "defaultValue" in $ || l == "checked" && "defaultChecked" in $) continue; + else if (!(l in B)) { + if (l == "value" && "defaultValue" in B || l == "checked" && "defaultChecked" in B) continue; pd(t, l, null, A, i); } } - for (l in $) A = $[l], l == "children" ? w = A : l == "dangerouslySetInnerHTML" ? d = A : l == "value" ? M = A : l == "checked" ? N = A : a && typeof A != "function" || L[l] === A || pd(t, l, A, L[l], i); + for (l in B) A = B[l], l == "children" ? w = A : l == "dangerouslySetInnerHTML" ? d = A : l == "value" ? M = A : l == "checked" ? N = A : a && typeof A != "function" || L[l] === A || pd(t, l, A, L[l], i); if (d) a || p && (d.__html === p.__html || d.__html === t.innerHTML) || (t.innerHTML = d.__html), e.__k = []; - else if (p && (t.innerHTML = ""), iS(t, _b(w) ? w : [w], e, r, n, B === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && Pu(r, 0), a, u), s != null) for (l = s.length; l--; ) Eb(s[l]); - a || (l = "value", B === "progress" && M == null ? t.removeAttribute("value") : M !== void 0 && (M !== t[l] || B === "progress" && !M || B === "option" && M !== L[l]) && pd(t, l, M, L[l], i), l = "checked", N !== void 0 && N !== t[l] && pd(t, l, N, L[l], i)); + else if (p && (t.innerHTML = ""), nS(t, xb(w) ? w : [w], e, r, n, $ === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && Pu(r, 0), a, u), s != null) for (l = s.length; l--; ) _b(s[l]); + a || (l = "value", $ === "progress" && M == null ? t.removeAttribute("value") : M !== void 0 && (M !== t[l] || $ === "progress" && !M || $ === "option" && M !== L[l]) && pd(t, l, M, L[l], i), l = "checked", N !== void 0 && N !== t[l] && pd(t, l, N, L[l], i)); } return t; } -function Ab(t, e, r) { +function Sb(t, e, r) { try { if (typeof t == "function") { var n = typeof t.__u == "function"; @@ -27768,9 +27768,9 @@ function Ab(t, e, r) { Jr.__e(i, r); } } -function aS(t, e, r) { +function oS(t, e, r) { var n, i; - if (Jr.unmount && Jr.unmount(t), (n = t.ref) && (n.current && n.current !== t.__e || Ab(n, null, e)), (n = t.__c) != null) { + if (Jr.unmount && Jr.unmount(t), (n = t.ref) && (n.current && n.current !== t.__e || Sb(n, null, e)), (n = t.__c) != null) { if (n.componentWillUnmount) try { n.componentWillUnmount(); } catch (s) { @@ -27778,43 +27778,43 @@ function aS(t, e, r) { } n.base = n.__P = null; } - if (n = t.__k) for (i = 0; i < n.length; i++) n[i] && aS(n[i], e, r || typeof t.type != "function"); - r || Eb(t.__e), t.__c = t.__ = t.__e = void 0; + if (n = t.__k) for (i = 0; i < n.length; i++) n[i] && oS(n[i], e, r || typeof t.type != "function"); + r || _b(t.__e), t.__c = t.__ = t.__e = void 0; } function jY(t, e, r) { return this.constructor(t, r); } function q1(t, e, r) { var n, i, s, o; - e === document && (e = document.documentElement), Jr.__ && Jr.__(t, e), i = (n = typeof r == "function") ? null : e.__k, s = [], o = [], Sb(e, t = (!n && r || e).__k = Nr(ih, null, [t]), i || Pl, Pl, e.namespaceURI, !n && r ? [r] : i ? null : e.firstChild ? up.call(e.childNodes) : null, s, !n && r ? r : i ? i.__e : e.firstChild, n, o), oS(s, t, o); + e === document && (e = document.documentElement), Jr.__ && Jr.__(t, e), i = (n = typeof r == "function") ? null : e.__k, s = [], o = [], Eb(e, t = (!n && r || e).__k = Nr(ih, null, [t]), i || Pl, Pl, e.namespaceURI, !n && r ? [r] : i ? null : e.firstChild ? up.call(e.childNodes) : null, s, !n && r ? r : i ? i.__e : e.firstChild, n, o), sS(s, t, o); } -up = rS.slice, Jr = { __e: function(t, e, r, n) { +up = tS.slice, Jr = { __e: function(t, e, r, n) { for (var i, s, o; e = e.__; ) if ((i = e.__c) && !i.__) try { if ((s = i.constructor) && s.getDerivedStateFromError != null && (i.setState(s.getDerivedStateFromError(t)), o = i.__d), i.componentDidCatch != null && (i.componentDidCatch(t, n || {}), o = i.__d), o) return i.__E = i; } catch (a) { t = a; } throw t; -} }, QE = 0, Nd.prototype.setState = function(t, e) { +} }, ZE = 0, Nd.prototype.setState = function(t, e) { var r; - r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = ga({}, this.state), typeof t == "function" && (t = t(ga({}, r), this.props)), t && ga(r, t), t != null && this.__v && (e && this._sb.push(e), g_(this)); + r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = ga({}, this.state), typeof t == "function" && (t = t(ga({}, r), this.props)), t && ga(r, t), t != null && this.__v && (e && this._sb.push(e), p6(this)); }, Nd.prototype.forceUpdate = function(t) { - this.__v && (this.__e = !0, t && this.__h.push(t), g_(this)); -}, Nd.prototype.render = ih, tc = [], eS = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, F1 = function(t, e) { + this.__v && (this.__e = !0, t && this.__h.push(t), p6(this)); +}, Nd.prototype.render = ih, tc = [], QE = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, F1 = function(t, e) { return t.__v.__b - e.__v.__b; -}, d0.__r = 0, tS = /(PointerCapture)$|Capture$/i, xb = 0, j1 = v_(!1), U1 = v_(!0); -var p0, pn, Mm, b_, z1 = 0, cS = [], yn = Jr, y_ = yn.__b, w_ = yn.__r, x_ = yn.diffed, __ = yn.__c, E_ = yn.unmount, S_ = yn.__; -function uS(t, e) { +}, d0.__r = 0, eS = /(PointerCapture)$|Capture$/i, wb = 0, j1 = m6(!1), U1 = m6(!0); +var p0, pn, Mm, v6, z1 = 0, aS = [], yn = Jr, b6 = yn.__b, y6 = yn.__r, w6 = yn.diffed, x6 = yn.__c, _6 = yn.unmount, E6 = yn.__; +function cS(t, e) { yn.__h && yn.__h(pn, t, z1 || e), z1 = 0; var r = pn.__H || (pn.__H = { __: [], __h: [] }); return t >= r.__.length && r.__.push({}), r.__[t]; } -function A_(t) { - return z1 = 1, UY(fS, t); +function S6(t) { + return z1 = 1, UY(uS, t); } function UY(t, e, r) { - var n = uS(p0++, 2); - if (n.t = t, !n.__c && (n.__ = [fS(void 0, e), function(a) { + var n = cS(p0++, 2); + if (n.t = t, !n.__c && (n.__ = [uS(void 0, e), function(a) { var u = n.__N ? n.__N[0] : n.__[0], l = n.t(u, a); u !== l && (n.__N = [l, n.__[1]], n.__c.setState({})); }], n.__c = pn, !pn.u)) { @@ -27847,30 +27847,30 @@ function UY(t, e, r) { return n.__N || n.__; } function qY(t, e) { - var r = uS(p0++, 3); + var r = cS(p0++, 3); !yn.__s && HY(r.__H, e) && (r.__ = t, r.i = e, pn.__H.__h.push(r)); } function zY() { - for (var t; t = cS.shift(); ) if (t.__P && t.__H) try { + for (var t; t = aS.shift(); ) if (t.__P && t.__H) try { t.__H.__h.forEach(Ld), t.__H.__h.forEach(W1), t.__H.__h = []; } catch (e) { t.__H.__h = [], yn.__e(e, t.__v); } } yn.__b = function(t) { - pn = null, y_ && y_(t); + pn = null, b6 && b6(t); }, yn.__ = function(t, e) { - t && e.__k && e.__k.__m && (t.__m = e.__k.__m), S_ && S_(t, e); + t && e.__k && e.__k.__m && (t.__m = e.__k.__m), E6 && E6(t, e); }, yn.__r = function(t) { - w_ && w_(t), p0 = 0; + y6 && y6(t), p0 = 0; var e = (pn = t.__c).__H; e && (Mm === pn ? (e.__h = [], pn.__h = [], e.__.forEach(function(r) { r.__N && (r.__ = r.__N), r.i = r.__N = void 0; })) : (e.__h.forEach(Ld), e.__h.forEach(W1), e.__h = [], p0 = 0)), Mm = pn; }, yn.diffed = function(t) { - x_ && x_(t); + w6 && w6(t); var e = t.__c; - e && e.__H && (e.__H.__h.length && (cS.push(e) !== 1 && b_ === yn.requestAnimationFrame || ((b_ = yn.requestAnimationFrame) || WY)(zY)), e.__H.__.forEach(function(r) { + e && e.__H && (e.__H.__h.length && (aS.push(e) !== 1 && v6 === yn.requestAnimationFrame || ((v6 = yn.requestAnimationFrame) || WY)(zY)), e.__H.__.forEach(function(r) { r.i && (r.__H = r.i), r.i = void 0; })), Mm = pn = null; }, yn.__c = function(t, e) { @@ -27884,9 +27884,9 @@ yn.__b = function(t) { i.__h && (i.__h = []); }), e = [], yn.__e(n, r.__v); } - }), __ && __(t, e); + }), x6 && x6(t, e); }, yn.unmount = function(t) { - E_ && E_(t); + _6 && _6(t); var e, r = t.__c; r && r.__H && (r.__H.__.forEach(function(n) { try { @@ -27896,12 +27896,12 @@ yn.__b = function(t) { } }), r.__H = void 0, e && yn.__e(e, r.__v)); }; -var P_ = typeof requestAnimationFrame == "function"; +var A6 = typeof requestAnimationFrame == "function"; function WY(t) { var e, r = function() { - clearTimeout(n), P_ && cancelAnimationFrame(e), setTimeout(t); + clearTimeout(n), A6 && cancelAnimationFrame(e), setTimeout(t); }, n = setTimeout(r, 100); - P_ && (e = requestAnimationFrame(r)); + A6 && (e = requestAnimationFrame(r)); } function Ld(t) { var e = pn, r = t.__c; @@ -27916,13 +27916,13 @@ function HY(t, e) { return r !== t[n]; }); } -function fS(t, e) { +function uS(t, e) { return typeof e == "function" ? e(t) : e; } const KY = ".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}", VY = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+", GY = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4="; class YY { constructor() { - this.items = /* @__PURE__ */ new Map(), this.nextItemKey = 0, this.root = null, this.darkMode = JE(); + this.items = /* @__PURE__ */ new Map(), this.nextItemKey = 0, this.root = null, this.darkMode = YE(); } attach(e) { this.root = document.createElement("div"), this.root.className = "-cbwsdk-snackbar-root", e.appendChild(this.root), this.render(); @@ -27940,17 +27940,17 @@ class YY { this.root && q1(Nr( "div", null, - Nr(lS, { darkMode: this.darkMode }, Array.from(this.items.entries()).map(([e, r]) => Nr(JY, Object.assign({}, r, { key: e })))) + Nr(fS, { darkMode: this.darkMode }, Array.from(this.items.entries()).map(([e, r]) => Nr(JY, Object.assign({}, r, { key: e })))) ), this.root); } } -const lS = (t) => Nr( +const fS = (t) => Nr( "div", { class: Gf("-cbwsdk-snackbar-container") }, Nr("style", null, KY), Nr("div", { class: "-cbwsdk-snackbar" }, t.children) ), JY = ({ autoExpand: t, message: e, menuItems: r }) => { - const [n, i] = A_(!0), [s, o] = A_(t ?? !1); + const [n, i] = S6(!0), [s, o] = S6(t ?? !1); qY(() => { const u = [ window.setTimeout(() => { @@ -28007,7 +28007,7 @@ class XY { if (this.attached) throw new Error("Coinbase Wallet SDK UI is already attached"); const e = document.documentElement, r = document.createElement("div"); - r.className = "-cbwsdk-css-reset", e.appendChild(r), this.snackbar.attach(r), this.attached = !0, XE(); + r.className = "-cbwsdk-css-reset", e.appendChild(r), this.snackbar.attach(r), this.attached = !0, JE(); } showConnecting(e) { let r; @@ -28056,11 +28056,11 @@ class XY { const ZY = ".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}"; class QY { constructor() { - this.root = null, this.darkMode = JE(); + this.root = null, this.darkMode = YE(); } attach() { const e = document.documentElement; - this.root = document.createElement("div"), this.root.className = "-cbwsdk-css-reset", e.appendChild(this.root), XE(); + this.root = document.createElement("div"), this.root.className = "-cbwsdk-css-reset", e.appendChild(this.root), JE(); } present(e) { this.render(e); @@ -28077,7 +28077,7 @@ class QY { const eJ = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: i }) => { const s = r ? "dark" : "light"; return Nr( - lS, + fS, { darkMode: r }, Nr( "div", @@ -28092,8 +28092,8 @@ const eJ = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: ) ) ); -}, tJ = "https://keys.coinbase.com/connect", M_ = "https://www.walletlink.org", rJ = "https://go.cb-w.com/walletlink"; -class I_ { +}, tJ = "https://keys.coinbase.com/connect", P6 = "https://www.walletlink.org", rJ = "https://go.cb-w.com/walletlink"; +class M6 { constructor() { this.attached = !1, this.redirectDialog = new QY(); } @@ -28157,7 +28157,7 @@ class Eo { session: e, linkAPIUrl: r, listener: this - }), i = this.isMobileWeb ? new I_() : new XY(); + }), i = this.isMobileWeb ? new M6() : new XY(); return n.connect(), { session: e, ui: i, connection: n }; } resetAndReload() { @@ -28245,7 +28245,7 @@ class Eo { } // copied from MobileRelay openCoinbaseWalletDeeplink(e) { - if (this.ui instanceof I_) + if (this.ui instanceof M6) switch (e) { case "requestEthereumAccounts": case "switchEthereumChain": @@ -28393,10 +28393,10 @@ class Eo { } } Eo.accountRequestCallbackIds = /* @__PURE__ */ new Set(); -const C_ = "DefaultChainId", T_ = "DefaultJsonRpcUrl"; -class hS { +const I6 = "DefaultChainId", C6 = "DefaultJsonRpcUrl"; +class lS { constructor(e) { - this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new eo("walletlink", M_), this.callback = e.callback || null; + this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new eo("walletlink", P6), this.callback = e.callback || null; const r = this._storage.getItem(B1); if (r) { const n = r.split(" "); @@ -28416,16 +28416,16 @@ class hS { } get jsonRpcUrl() { var e; - return (e = this._storage.getItem(T_)) !== null && e !== void 0 ? e : void 0; + return (e = this._storage.getItem(C6)) !== null && e !== void 0 ? e : void 0; } set jsonRpcUrl(e) { - this._storage.setItem(T_, e); + this._storage.setItem(C6, e); } updateProviderInfo(e, r) { var n; this.jsonRpcUrl = e; const i = this.getChainId(); - this._storage.setItem(C_, r.toString(10)), Kf(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(r))); + this._storage.setItem(I6, r.toString(10)), Kf(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(r))); } async watchAsset(e) { const r = Array.isArray(e) ? e[0] : e; @@ -28514,7 +28514,7 @@ class hS { default: if (!this.jsonRpcUrl) throw Sr.rpc.internal("No RPC URL set for chain"); - return FE(e, this.jsonRpcUrl); + return BE(e, this.jsonRpcUrl); } } _ensureKnownAddress(e) { @@ -28559,7 +28559,7 @@ class hS { } getChainId() { var e; - return Number.parseInt((e = this._storage.getItem(C_)) !== null && e !== void 0 ? e : "1", 10); + return Number.parseInt((e = this._storage.getItem(I6)) !== null && e !== void 0 ? e : "1", 10); } async _eth_requestAccounts() { var e, r; @@ -28639,7 +28639,7 @@ class hS { } initializeRelay() { return this._relay || (this._relay = new Eo({ - linkAPIUrl: M_, + linkAPIUrl: P6, storage: this._storage, metadata: this.metadata, accountsCallback: this._setAddresses.bind(this), @@ -28647,12 +28647,12 @@ class hS { })), this._relay; } } -const dS = "SignerType", pS = new eo("CBWSDK", "SignerConfigurator"); +const hS = "SignerType", dS = new eo("CBWSDK", "SignerConfigurator"); function nJ() { - return pS.getItem(dS); + return dS.getItem(hS); } function iJ(t) { - pS.setItem(dS, t); + dS.setItem(hS, t); } async function sJ(t) { const { communicator: e, metadata: r, handshakeRequest: n, callback: i } = t; @@ -28675,7 +28675,7 @@ function oJ(t) { communicator: n }); case "walletlink": - return new hS({ + return new lS({ metadata: r, callback: i }); @@ -28683,7 +28683,7 @@ function oJ(t) { } async function aJ(t, e, r) { await t.onMessage(({ event: i }) => i === "WalletLinkSessionRequest"); - const n = new hS({ + const n = new lS({ metadata: e, callback: r }); @@ -28719,11 +28719,11 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene } } }; -}, { checkCrossOriginOpenerPolicy: fJ, getCrossOriginOpenerPolicy: lJ } = uJ(), R_ = 420, D_ = 540; +}, { checkCrossOriginOpenerPolicy: fJ, getCrossOriginOpenerPolicy: lJ } = uJ(), T6 = 420, R6 = 540; function hJ(t) { - const e = (window.innerWidth - R_) / 2 + window.screenX, r = (window.innerHeight - D_) / 2 + window.screenY; + const e = (window.innerWidth - T6) / 2 + window.screenX, r = (window.innerHeight - R6) / 2 + window.screenY; pJ(t); - const n = window.open(t, "Smart Wallet", `width=${R_}, height=${D_}, left=${e}, top=${r}`); + const n = window.open(t, "Smart Wallet", `width=${T6}, height=${R6}, left=${e}, top=${r}`); if (n == null || n.focus(), !n) throw Sr.rpc.internal("Pop up window failed to open"); return n; @@ -28733,7 +28733,7 @@ function dJ(t) { } function pJ(t) { const e = { - sdkName: BE, + sdkName: $E, sdkVersion: nh, origin: window.location.origin, coop: lJ() @@ -28801,7 +28801,7 @@ function vJ(t) { } return t; } -var gS = { exports: {} }; +var pS = { exports: {} }; (function(t) { var e = Object.prototype.hasOwnProperty, r = "~"; function n() { @@ -28841,9 +28841,9 @@ var gS = { exports: {} }; }, a.prototype.emit = function(l, d, p, w, A, M) { var N = r ? r + l : l; if (!this._events[N]) return !1; - var L = this._events[N], $ = arguments.length, B, H; + var L = this._events[N], B = arguments.length, $, H; if (L.fn) { - switch (L.once && this.removeListener(l, L.fn, void 0, !0), $) { + switch (L.once && this.removeListener(l, L.fn, void 0, !0), B) { case 1: return L.fn.call(L.context), !0; case 2: @@ -28857,13 +28857,13 @@ var gS = { exports: {} }; case 6: return L.fn.call(L.context, d, p, w, A, M), !0; } - for (H = 1, B = new Array($ - 1); H < $; H++) - B[H - 1] = arguments[H]; - L.fn.apply(L.context, B); + for (H = 1, $ = new Array(B - 1); H < B; H++) + $[H - 1] = arguments[H]; + L.fn.apply(L.context, $); } else { var U = L.length, V; for (H = 0; H < U; H++) - switch (L[H].once && this.removeListener(l, L[H].fn, void 0, !0), $) { + switch (L[H].once && this.removeListener(l, L[H].fn, void 0, !0), B) { case 1: L[H].fn.call(L[H].context); break; @@ -28877,9 +28877,9 @@ var gS = { exports: {} }; L[H].fn.call(L[H].context, d, p, w); break; default: - if (!B) for (V = 1, B = new Array($ - 1); V < $; V++) - B[V - 1] = arguments[V]; - L[H].fn.apply(L[H].context, B); + if (!$) for (V = 1, $ = new Array(B - 1); V < B; V++) + $[V - 1] = arguments[V]; + L[H].fn.apply(L[H].context, $); } } return !0; @@ -28896,7 +28896,7 @@ var gS = { exports: {} }; if (M.fn) M.fn === d && (!w || M.once) && (!p || M.context === p) && o(this, A); else { - for (var N = 0, L = [], $ = M.length; N < $; N++) + for (var N = 0, L = [], B = M.length; N < B; N++) (M[N].fn !== d || w && !M[N].once || p && M[N].context !== p) && L.push(M[N]); L.length ? this._events[A] = L.length === 1 ? L[0] : L : o(this, A); } @@ -28905,8 +28905,8 @@ var gS = { exports: {} }; var d; return l ? (d = r ? r + l : l, this._events[d] && o(this, d)) : (this._events = new n(), this._eventsCount = 0), this; }, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = r, a.EventEmitter = a, t.exports = a; -})(gS); -var bJ = gS.exports; +})(pS); +var bJ = pS.exports; const yJ = /* @__PURE__ */ ts(bJ); class wJ extends yJ { } @@ -29015,27 +29015,27 @@ function PJ(t) { getProvider: () => (i || (i = SJ(n)), i) }; } -function mS(t, e) { +function gS(t, e) { return function() { return t.apply(e, arguments); }; } -const { toString: MJ } = Object.prototype, { getPrototypeOf: Pb } = Object, fp = /* @__PURE__ */ ((t) => (e) => { +const { toString: MJ } = Object.prototype, { getPrototypeOf: Ab } = Object, fp = /* @__PURE__ */ ((t) => (e) => { const r = MJ.call(e); return t[r] || (t[r] = r.slice(8, -1).toLowerCase()); })(/* @__PURE__ */ Object.create(null)), Ps = (t) => (t = t.toLowerCase(), (e) => fp(e) === t), lp = (t) => (e) => typeof e === t, { isArray: Wu } = Array, Ml = lp("undefined"); function IJ(t) { return t !== null && !Ml(t) && t.constructor !== null && !Ml(t.constructor) && Oi(t.constructor.isBuffer) && t.constructor.isBuffer(t); } -const vS = Ps("ArrayBuffer"); +const mS = Ps("ArrayBuffer"); function CJ(t) { let e; - return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && vS(t.buffer), e; + return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && mS(t.buffer), e; } -const TJ = lp("string"), Oi = lp("function"), bS = lp("number"), hp = (t) => t !== null && typeof t == "object", RJ = (t) => t === !0 || t === !1, kd = (t) => { +const TJ = lp("string"), Oi = lp("function"), vS = lp("number"), hp = (t) => t !== null && typeof t == "object", RJ = (t) => t === !0 || t === !1, kd = (t) => { if (fp(t) !== "object") return !1; - const e = Pb(t); + const e = Ab(t); return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in t) && !(Symbol.iterator in t); }, DJ = Ps("Date"), OJ = Ps("File"), NJ = Ps("Blob"), LJ = Ps("FileList"), kJ = (t) => hp(t) && Oi(t.pipe), $J = (t) => { let e; @@ -29056,7 +29056,7 @@ function sh(t, e, { allOwnKeys: r = !1 } = {}) { a = s[n], e.call(null, t[a], a, t); } } -function yS(t, e) { +function bS(t, e) { e = e.toLowerCase(); const r = Object.keys(t); let n = r.length, i; @@ -29065,10 +29065,10 @@ function yS(t, e) { return i; return null; } -const ic = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, wS = (t) => !Ml(t) && t !== ic; +const ic = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, yS = (t) => !Ml(t) && t !== ic; function H1() { - const { caseless: t } = wS(this) && this || {}, e = {}, r = (n, i) => { - const s = t && yS(e, i) || i; + const { caseless: t } = yS(this) && this || {}, e = {}, r = (n, i) => { + const s = t && bS(e, i) || i; kd(e[s]) && kd(n) ? e[s] = H1(e[s], n) : kd(n) ? e[s] = H1({}, n) : Wu(n) ? e[s] = n.slice() : e[s] = n; }; for (let n = 0, i = arguments.length; n < i; n++) @@ -29076,7 +29076,7 @@ function H1() { return e; } const WJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { - r && Oi(i) ? t[s] = mS(i, r) : t[s] = i; + r && Oi(i) ? t[s] = gS(i, r) : t[s] = i; }, { allOwnKeys: n }), t), HJ = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), KJ = (t, e, r, n) => { t.prototype = Object.create(e.prototype, n), t.prototype.constructor = t, Object.defineProperty(t, "super", { value: e.prototype @@ -29088,7 +29088,7 @@ const WJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { do { for (i = Object.getOwnPropertyNames(t), s = i.length; s-- > 0; ) o = i[s], (!n || n(o, t, e)) && !a[o] && (e[o] = t[o], a[o] = !0); - t = r !== !1 && Pb(t); + t = r !== !1 && Ab(t); } while (t && (!r || r(t, e)) && t !== Object.prototype); return e; }, GJ = (t, e, r) => { @@ -29099,12 +29099,12 @@ const WJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { if (!t) return null; if (Wu(t)) return t; let e = t.length; - if (!bS(e)) return null; + if (!vS(e)) return null; const r = new Array(e); for (; e-- > 0; ) r[e] = t[e]; return r; -}, JJ = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Pb(Uint8Array)), XJ = (t, e) => { +}, JJ = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Ab(Uint8Array)), XJ = (t, e) => { const n = (t && t[Symbol.iterator]).call(t); let i; for (; (i = n.next()) && !i.done; ) { @@ -29122,14 +29122,14 @@ const WJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { function(r, n, i) { return n.toUpperCase() + i; } -), O_ = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), tX = Ps("RegExp"), xS = (t, e) => { +), D6 = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), tX = Ps("RegExp"), wS = (t, e) => { const r = Object.getOwnPropertyDescriptors(t), n = {}; sh(r, (i, s) => { let o; (o = e(i, s, t)) !== !1 && (n[s] = o || i); }), Object.defineProperties(t, n); }, rX = (t) => { - xS(t, (e, r) => { + wS(t, (e, r) => { if (Oi(t) && ["arguments", "caller", "callee"].indexOf(r) !== -1) return !1; const n = t[r]; @@ -29151,11 +29151,11 @@ const WJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { }; return Wu(t) ? n(t) : n(String(t).split(e)), r; }, iX = () => { -}, sX = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, Im = "abcdefghijklmnopqrstuvwxyz", N_ = "0123456789", _S = { - DIGIT: N_, +}, sX = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, Im = "abcdefghijklmnopqrstuvwxyz", O6 = "0123456789", xS = { + DIGIT: O6, ALPHA: Im, - ALPHA_DIGIT: Im + Im.toUpperCase() + N_ -}, oX = (t = 16, e = _S.ALPHA_DIGIT) => { + ALPHA_DIGIT: Im + Im.toUpperCase() + O6 +}, oX = (t = 16, e = xS.ALPHA_DIGIT) => { let r = ""; const { length: n } = e; for (; t--; ) @@ -29182,21 +29182,21 @@ const cX = (t) => { return n; }; return r(t, 0); -}, uX = Ps("AsyncFunction"), fX = (t) => t && (hp(t) || Oi(t)) && Oi(t.then) && Oi(t.catch), ES = ((t, e) => t ? setImmediate : e ? ((r, n) => (ic.addEventListener("message", ({ source: i, data: s }) => { +}, uX = Ps("AsyncFunction"), fX = (t) => t && (hp(t) || Oi(t)) && Oi(t.then) && Oi(t.catch), _S = ((t, e) => t ? setImmediate : e ? ((r, n) => (ic.addEventListener("message", ({ source: i, data: s }) => { i === ic && s === r && n.length && n.shift()(); }, !1), (i) => { n.push(i), ic.postMessage(r, "*"); }))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))( typeof setImmediate == "function", Oi(ic.postMessage) -), lX = typeof queueMicrotask < "u" ? queueMicrotask.bind(ic) : typeof process < "u" && process.nextTick || ES, Oe = { +), lX = typeof queueMicrotask < "u" ? queueMicrotask.bind(ic) : typeof process < "u" && process.nextTick || _S, Oe = { isArray: Wu, - isArrayBuffer: vS, + isArrayBuffer: mS, isBuffer: IJ, isFormData: $J, isArrayBufferView: CJ, isString: TJ, - isNumber: bS, + isNumber: vS, isBoolean: RJ, isObject: hp, isPlainObject: kd, @@ -29228,25 +29228,25 @@ const cX = (t) => { forEachEntry: XJ, matchAll: ZJ, isHTMLForm: QJ, - hasOwnProperty: O_, - hasOwnProp: O_, + hasOwnProperty: D6, + hasOwnProp: D6, // an alias to avoid ESLint no-prototype-builtins detection - reduceDescriptors: xS, + reduceDescriptors: wS, freezeMethods: rX, toObjectSet: nX, toCamelCase: eX, noop: iX, toFiniteNumber: sX, - findKey: yS, + findKey: bS, global: ic, - isContextDefined: wS, - ALPHABET: _S, + isContextDefined: yS, + ALPHABET: xS, generateString: oX, isSpecCompliantForm: aX, toJSONObject: cX, isAsyncFn: uX, isThenable: fX, - setImmediate: ES, + setImmediate: _S, asap: lX }; function or(t, e, r, n, i) { @@ -29273,7 +29273,7 @@ Oe.inherits(or, Error, { }; } }); -const SS = or.prototype, AS = {}; +const ES = or.prototype, SS = {}; [ "ERR_BAD_OPTION_VALUE", "ERR_BAD_OPTION", @@ -29289,12 +29289,12 @@ const SS = or.prototype, AS = {}; "ERR_INVALID_URL" // eslint-disable-next-line func-names ].forEach((t) => { - AS[t] = { value: t }; + SS[t] = { value: t }; }); -Object.defineProperties(or, AS); -Object.defineProperty(SS, "isAxiosError", { value: !0 }); +Object.defineProperties(or, SS); +Object.defineProperty(ES, "isAxiosError", { value: !0 }); or.from = (t, e, r, n, i, s) => { - const o = Object.create(SS); + const o = Object.create(ES); return Oe.toFlatObject(t, o, function(u) { return u !== Error.prototype; }, (a) => a !== "isAxiosError"), or.call(o, t.message, e, r, n, i), o.cause = t, o.name = t.name, s && Object.assign(o, s), o; @@ -29303,12 +29303,12 @@ const hX = null; function K1(t) { return Oe.isPlainObject(t) || Oe.isArray(t); } -function PS(t) { +function AS(t) { return Oe.endsWith(t, "[]") ? t.slice(0, -2) : t; } -function L_(t, e, r) { +function N6(t, e, r) { return t ? t.concat(e).map(function(i, s) { - return i = PS(i), !r && s ? "[" + i + "]" : i; + return i = AS(i), !r && s ? "[" + i + "]" : i; }).join(r ? "." : "") : e; } function dX(t) { @@ -29339,20 +29339,20 @@ function dp(t, e, r) { return Oe.isArrayBuffer(M) || Oe.isTypedArray(M) ? u && typeof Blob == "function" ? new Blob([M]) : Buffer.from(M) : M; } function d(M, N, L) { - let $ = M; + let B = M; if (M && !L && typeof M == "object") { if (Oe.endsWith(N, "{}")) N = n ? N : N.slice(0, -2), M = JSON.stringify(M); - else if (Oe.isArray(M) && dX(M) || (Oe.isFileList(M) || Oe.endsWith(N, "[]")) && ($ = Oe.toArray(M))) - return N = PS(N), $.forEach(function(H, U) { + else if (Oe.isArray(M) && dX(M) || (Oe.isFileList(M) || Oe.endsWith(N, "[]")) && (B = Oe.toArray(M))) + return N = AS(N), B.forEach(function(H, U) { !(Oe.isUndefined(H) || H === null) && e.append( // eslint-disable-next-line no-nested-ternary - o === !0 ? L_([N], U, s) : o === null ? N : N + "[]", + o === !0 ? N6([N], U, s) : o === null ? N : N + "[]", l(H) ); }), !1; } - return K1(M) ? !0 : (e.append(L_(L, N, s), l(M)), !1); + return K1(M) ? !0 : (e.append(N6(L, N, s), l(M)), !1); } const p = [], w = Object.assign(pX, { defaultVisitor: d, @@ -29363,14 +29363,14 @@ function dp(t, e, r) { if (!Oe.isUndefined(M)) { if (p.indexOf(M) !== -1) throw Error("Circular reference detected in " + N.join(".")); - p.push(M), Oe.forEach(M, function($, B) { - (!(Oe.isUndefined($) || $ === null) && i.call( + p.push(M), Oe.forEach(M, function(B, $) { + (!(Oe.isUndefined(B) || B === null) && i.call( e, - $, - Oe.isString(B) ? B.trim() : B, + B, + Oe.isString($) ? $.trim() : $, N, w - )) === !0 && A($, N ? N.concat(B) : [B]); + )) === !0 && A(B, N ? N.concat($) : [$]); }), p.pop(); } } @@ -29378,7 +29378,7 @@ function dp(t, e, r) { throw new TypeError("data must be an object"); return A(t), e; } -function k_(t) { +function L6(t) { const e = { "!": "%21", "'": "%27", @@ -29392,17 +29392,17 @@ function k_(t) { return e[n]; }); } -function Mb(t, e) { +function Pb(t, e) { this._pairs = [], t && dp(t, this, e); } -const MS = Mb.prototype; -MS.append = function(e, r) { +const PS = Pb.prototype; +PS.append = function(e, r) { this._pairs.push([e, r]); }; -MS.toString = function(e) { +PS.toString = function(e) { const r = e ? function(n) { - return e.call(this, n, k_); - } : k_; + return e.call(this, n, L6); + } : L6; return this._pairs.map(function(i) { return r(i[0]) + "=" + r(i[1]); }, "").join("&"); @@ -29410,7 +29410,7 @@ MS.toString = function(e) { function gX(t) { return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]"); } -function IS(t, e, r) { +function MS(t, e, r) { if (!e) return t; const n = r && r.encode || gX; @@ -29419,13 +29419,13 @@ function IS(t, e, r) { }); const i = r && r.serialize; let s; - if (i ? s = i(e, r) : s = Oe.isURLSearchParams(e) ? e.toString() : new Mb(e, r).toString(n), s) { + if (i ? s = i(e, r) : s = Oe.isURLSearchParams(e) ? e.toString() : new Pb(e, r).toString(n), s) { const o = t.indexOf("#"); o !== -1 && (t = t.slice(0, o)), t += (t.indexOf("?") === -1 ? "?" : "&") + s; } return t; } -class $_ { +class k6 { constructor() { this.handlers = []; } @@ -29479,11 +29479,11 @@ class $_ { }); } } -const CS = { +const IS = { silentJSONParsing: !0, forcedJSONParsing: !0, clarifyTimeoutError: !1 -}, mX = typeof URLSearchParams < "u" ? URLSearchParams : Mb, vX = typeof FormData < "u" ? FormData : null, bX = typeof Blob < "u" ? Blob : null, yX = { +}, mX = typeof URLSearchParams < "u" ? URLSearchParams : Pb, vX = typeof FormData < "u" ? FormData : null, bX = typeof Blob < "u" ? Blob : null, yX = { isBrowser: !0, classes: { URLSearchParams: mX, @@ -29491,10 +29491,10 @@ const CS = { Blob: bX }, protocols: ["http", "https", "file", "blob", "url", "data"] -}, Ib = typeof window < "u" && typeof document < "u", V1 = typeof navigator == "object" && navigator || void 0, wX = Ib && (!V1 || ["ReactNative", "NativeScript", "NS"].indexOf(V1.product) < 0), xX = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef -self instanceof WorkerGlobalScope && typeof self.importScripts == "function", _X = Ib && window.location.href || "http://localhost", EX = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}, Mb = typeof window < "u" && typeof document < "u", V1 = typeof navigator == "object" && navigator || void 0, wX = Mb && (!V1 || ["ReactNative", "NativeScript", "NS"].indexOf(V1.product) < 0), xX = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef +self instanceof WorkerGlobalScope && typeof self.importScripts == "function", _X = Mb && window.location.href || "http://localhost", EX = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - hasBrowserEnv: Ib, + hasBrowserEnv: Mb, hasStandardBrowserEnv: wX, hasStandardBrowserWebWorkerEnv: xX, navigator: V1, @@ -29522,7 +29522,7 @@ function PX(t) { s = r[n], e[s] = t[s]; return e; } -function TS(t) { +function CS(t) { function e(r, n, i, s) { let o = r[s++]; if (o === "__proto__") return !0; @@ -29548,12 +29548,12 @@ function MX(t, e, r) { return (r || JSON.stringify)(t); } const oh = { - transitional: CS, + transitional: IS, adapter: ["xhr", "http", "fetch"], transformRequest: [function(e, r) { const n = r.getContentType() || "", i = n.indexOf("application/json") > -1, s = Oe.isObject(e); if (s && Oe.isHTMLForm(e) && (e = new FormData(e)), Oe.isFormData(e)) - return i ? JSON.stringify(TS(e)) : e; + return i ? JSON.stringify(CS(e)) : e; if (Oe.isArrayBuffer(e) || Oe.isBuffer(e) || Oe.isStream(e) || Oe.isFile(e) || Oe.isBlob(e) || Oe.isReadableStream(e)) return e; if (Oe.isArrayBufferView(e)) @@ -29641,7 +29641,7 @@ const IX = Oe.toObjectSet([ `).forEach(function(o) { i = o.indexOf(":"), r = o.substring(0, i).trim().toLowerCase(), n = o.substring(i + 1).trim(), !(!r || e[r] && IX[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n); }), e; -}, B_ = Symbol("internals"); +}, $6 = Symbol("internals"); function Df(t) { return t && String(t).trim().toLowerCase(); } @@ -29680,7 +29680,7 @@ function OX(t, e) { }); }); } -let wi = class { +let yi = class { constructor(e) { e && this.set(e); } @@ -29788,7 +29788,7 @@ let wi = class { return r.forEach((i) => n.set(i)), n; } static accessor(e) { - const n = (this[B_] = this[B_] = { + const n = (this[$6] = this[$6] = { accessors: {} }).accessors, i = this.prototype; function s(o) { @@ -29798,8 +29798,8 @@ let wi = class { return Oe.isArray(e) ? e.forEach(s) : s(e), this; } }; -wi.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]); -Oe.reduceDescriptors(wi.prototype, ({ value: t }, e) => { +yi.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]); +Oe.reduceDescriptors(yi.prototype, ({ value: t }, e) => { let r = e[0].toUpperCase() + e.slice(1); return { get: () => t, @@ -29808,15 +29808,15 @@ Oe.reduceDescriptors(wi.prototype, ({ value: t }, e) => { } }; }); -Oe.freezeMethods(wi); +Oe.freezeMethods(yi); function Tm(t, e) { - const r = this || oh, n = e || r, i = wi.from(n.headers); + const r = this || oh, n = e || r, i = yi.from(n.headers); let s = n.data; return Oe.forEach(t, function(a) { s = a.call(r, s, i.normalize(), e ? e.status : void 0); }), i.normalize(), s; } -function RS(t) { +function TS(t) { return !!(t && t.__CANCEL__); } function Hu(t, e, r) { @@ -29825,7 +29825,7 @@ function Hu(t, e, r) { Oe.inherits(Hu, or, { __CANCEL__: !0 }); -function DS(t, e, r) { +function RS(t, e, r) { const n = r.config.validateStatus; !r.status || !n || n(r.status) ? t(r) : e(new or( "Request failed with status code " + r.status, @@ -29886,14 +29886,14 @@ const g0 = (t, e, r = 3) => { }; t(p); }, r); -}, F_ = (t, e) => { +}, B6 = (t, e) => { const r = t != null; return [(n) => e[0]({ lengthComputable: r, total: t, loaded: n }), e[1]]; -}, j_ = (t) => (...e) => Oe.asap(() => t(...e)), $X = Jn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Jn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( +}, F6 = (t) => (...e) => Oe.asap(() => t(...e)), $X = Jn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Jn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( new URL(Jn.origin), Jn.navigator && /(msie|trident)/i.test(Jn.navigator.userAgent) ) : () => !0, BX = Jn.hasStandardBrowserEnv ? ( @@ -29929,10 +29929,10 @@ function FX(t) { function jX(t, e) { return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t; } -function OS(t, e) { +function DS(t, e) { return t && !FX(e) ? jX(t, e) : e; } -const U_ = (t) => t instanceof wi ? { ...t } : t; +const j6 = (t) => t instanceof yi ? { ...t } : t; function gc(t, e) { e = e || {}; const r = {}; @@ -29990,17 +29990,17 @@ function gc(t, e) { socketPath: o, responseEncoding: o, validateStatus: a, - headers: (l, d, p) => i(U_(l), U_(d), p, !0) + headers: (l, d, p) => i(j6(l), j6(d), p, !0) }; return Oe.forEach(Object.keys(Object.assign({}, t, e)), function(d) { const p = u[d] || i, w = p(t[d], e[d], d); Oe.isUndefined(w) && p !== a || (r[d] = w); }), r; } -const NS = (t) => { +const OS = (t) => { const e = gc({}, t); let { data: r, withXSRFToken: n, xsrfHeaderName: i, xsrfCookieName: s, headers: o, auth: a } = e; - e.headers = o = wi.from(o), e.url = IS(OS(e.baseURL, e.url), t.params, t.paramsSerializer), a && o.set( + e.headers = o = yi.from(o), e.url = MS(DS(e.baseURL, e.url), t.params, t.paramsSerializer), a && o.set( "Authorization", "Basic " + btoa((a.username || "") + ":" + (a.password ? unescape(encodeURIComponent(a.password)) : "")) ); @@ -30020,19 +30020,19 @@ const NS = (t) => { return e; }, UX = typeof XMLHttpRequest < "u", qX = UX && function(t) { return new Promise(function(r, n) { - const i = NS(t); + const i = OS(t); let s = i.data; - const o = wi.from(i.headers).normalize(); + const o = yi.from(i.headers).normalize(); let { responseType: a, onUploadProgress: u, onDownloadProgress: l } = i, d, p, w, A, M; function N() { A && A(), M && M(), i.cancelToken && i.cancelToken.unsubscribe(d), i.signal && i.signal.removeEventListener("abort", d); } let L = new XMLHttpRequest(); L.open(i.method.toUpperCase(), i.url, !0), L.timeout = i.timeout; - function $() { + function B() { if (!L) return; - const H = wi.from( + const H = yi.from( "getAllResponseHeaders" in L && L.getAllResponseHeaders() ), V = { data: !a || a === "text" || a === "json" ? L.responseText : L.response, @@ -30042,21 +30042,21 @@ const NS = (t) => { config: t, request: L }; - DS(function(R) { + RS(function(R) { r(R), N(); }, function(R) { n(R), N(); }, V), L = null; } - "onloadend" in L ? L.onloadend = $ : L.onreadystatechange = function() { - !L || L.readyState !== 4 || L.status === 0 && !(L.responseURL && L.responseURL.indexOf("file:") === 0) || setTimeout($); + "onloadend" in L ? L.onloadend = B : L.onreadystatechange = function() { + !L || L.readyState !== 4 || L.status === 0 && !(L.responseURL && L.responseURL.indexOf("file:") === 0) || setTimeout(B); }, L.onabort = function() { L && (n(new or("Request aborted", or.ECONNABORTED, t, L)), L = null); }, L.onerror = function() { n(new or("Network Error", or.ERR_NETWORK, t, L)), L = null; }, L.ontimeout = function() { let U = i.timeout ? "timeout of " + i.timeout + "ms exceeded" : "timeout exceeded"; - const V = i.transitional || CS; + const V = i.transitional || IS; i.timeoutErrorMessage && (U = i.timeoutErrorMessage), n(new or( U, V.clarifyTimeoutError ? or.ETIMEDOUT : or.ECONNABORTED, @@ -30068,9 +30068,9 @@ const NS = (t) => { }), Oe.isUndefined(i.withCredentials) || (L.withCredentials = !!i.withCredentials), a && a !== "json" && (L.responseType = i.responseType), l && ([w, M] = g0(l, !0), L.addEventListener("progress", w)), u && L.upload && ([p, A] = g0(u), L.upload.addEventListener("progress", p), L.upload.addEventListener("loadend", A)), (i.cancelToken || i.signal) && (d = (H) => { L && (n(!H || H.type ? new Hu(null, t, L) : H), L.abort(), L = null); }, i.cancelToken && i.cancelToken.subscribe(d), i.signal && (i.signal.aborted ? d() : i.signal.addEventListener("abort", d))); - const B = NX(i.url); - if (B && Jn.protocols.indexOf(B) === -1) { - n(new or("Unsupported protocol " + B + ":", or.ERR_BAD_REQUEST, t)); + const $ = NX(i.url); + if ($ && Jn.protocols.indexOf($) === -1) { + n(new or("Unsupported protocol " + $ + ":", or.ERR_BAD_REQUEST, t)); return; } L.send(s || null); @@ -30126,7 +30126,7 @@ const NS = (t) => { } finally { await e.cancel(); } -}, q_ = (t, e, r, n) => { +}, U6 = (t, e, r, n) => { const i = HX(t, e); let s = 0, o, a = (u) => { o || (o = !0, n && n(u)); @@ -30155,13 +30155,13 @@ const NS = (t) => { }, { highWaterMark: 2 }); -}, pp = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", LS = pp && typeof ReadableStream == "function", VX = pp && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), kS = (t, ...e) => { +}, pp = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", NS = pp && typeof ReadableStream == "function", VX = pp && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), LS = (t, ...e) => { try { return !!t(...e); } catch { return !1; } -}, GX = LS && kS(() => { +}, GX = NS && LS(() => { let t = !1; const e = new Request(Jn.origin, { body: new ReadableStream(), @@ -30171,7 +30171,7 @@ const NS = (t) => { } }).headers.has("Content-Type"); return t && !e; -}), z_ = 64 * 1024, G1 = LS && kS(() => Oe.isReadableStream(new Response("").body)), m0 = { +}), q6 = 64 * 1024, G1 = NS && LS(() => Oe.isReadableStream(new Response("").body)), m0 = { stream: G1 && ((t) => t.body) }; pp && ((t) => { @@ -30212,7 +30212,7 @@ const YX = async (t) => { headers: d, withCredentials: p = "same-origin", fetchOptions: w - } = NS(t); + } = OS(t); l = l ? (l + "").toLowerCase() : "text"; let A = zX([i, s && s.toAbortSignal()], o), M; const N = A && A.unsubscribe && (() => { @@ -30227,15 +30227,15 @@ const YX = async (t) => { duplex: "half" }), te; if (Oe.isFormData(n) && (te = V.headers.get("content-type")) && d.setContentType(te), V.body) { - const [R, K] = F_( + const [R, K] = B6( L, - g0(j_(u)) + g0(F6(u)) ); - n = q_(V.body, z_, R, K); + n = U6(V.body, q6, R, K); } } Oe.isString(p) || (p = p ? "include" : "omit"); - const $ = "credentials" in Request.prototype; + const B = "credentials" in Request.prototype; M = new Request(e, { ...w, signal: A, @@ -30243,45 +30243,45 @@ const YX = async (t) => { headers: d.normalize().toJSON(), body: n, duplex: "half", - credentials: $ ? p : void 0 + credentials: B ? p : void 0 }); - let B = await fetch(M); + let $ = await fetch(M); const H = G1 && (l === "stream" || l === "response"); if (G1 && (a || H && N)) { const V = {}; ["status", "statusText", "headers"].forEach((ge) => { - V[ge] = B[ge]; + V[ge] = $[ge]; }); - const te = Oe.toFiniteNumber(B.headers.get("content-length")), [R, K] = a && F_( + const te = Oe.toFiniteNumber($.headers.get("content-length")), [R, K] = a && B6( te, - g0(j_(a), !0) + g0(F6(a), !0) ) || []; - B = new Response( - q_(B.body, z_, R, () => { + $ = new Response( + U6($.body, q6, R, () => { K && K(), N && N(); }), V ); } l = l || "text"; - let U = await m0[Oe.findKey(m0, l) || "text"](B, t); + let U = await m0[Oe.findKey(m0, l) || "text"]($, t); return !H && N && N(), await new Promise((V, te) => { - DS(V, te, { + RS(V, te, { data: U, - headers: wi.from(B.headers), - status: B.status, - statusText: B.statusText, + headers: yi.from($.headers), + status: $.status, + statusText: $.statusText, config: t, request: M }); }); - } catch ($) { - throw N && N(), $ && $.name === "TypeError" && /fetch/i.test($.message) ? Object.assign( + } catch (B) { + throw N && N(), B && B.name === "TypeError" && /fetch/i.test(B.message) ? Object.assign( new or("Network Error", or.ERR_NETWORK, t, M), { - cause: $.cause || $ + cause: B.cause || B } - ) : or.from($, $ && $.code, t, M); + ) : or.from(B, B && B.code, t, M); } }), Y1 = { http: hX, @@ -30297,7 +30297,7 @@ Oe.forEach(Y1, (t, e) => { Object.defineProperty(t, "adapterName", { value: e }); } }); -const W_ = (t) => `- ${t}`, ZX = (t) => Oe.isFunction(t) || t === null || t === !1, $S = { +const z6 = (t) => `- ${t}`, ZX = (t) => Oe.isFunction(t) || t === null || t === !1, kS = { getAdapter: (t) => { t = Oe.isArray(t) ? t : [t]; const { length: e } = t; @@ -30317,8 +30317,8 @@ const W_ = (t) => `- ${t}`, ZX = (t) => Oe.isFunction(t) || t === null || t === ([a, u]) => `adapter ${a} ` + (u === !1 ? "is not supported by the environment" : "is not available in the build") ); let o = e ? s.length > 1 ? `since : -` + s.map(W_).join(` -`) : " " + W_(s[0]) : "as no adapter specified"; +` + s.map(z6).join(` +`) : " " + z6(s[0]) : "as no adapter specified"; throw new or( "There is no suitable adapter to dispatch the request " + o, "ERR_NOT_SUPPORT" @@ -30332,34 +30332,34 @@ function Rm(t) { if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted) throw new Hu(null, t); } -function H_(t) { - return Rm(t), t.headers = wi.from(t.headers), t.data = Tm.call( +function W6(t) { + return Rm(t), t.headers = yi.from(t.headers), t.data = Tm.call( t, t.transformRequest - ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), $S.getAdapter(t.adapter || oh.adapter)(t).then(function(n) { + ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), kS.getAdapter(t.adapter || oh.adapter)(t).then(function(n) { return Rm(t), n.data = Tm.call( t, t.transformResponse, n - ), n.headers = wi.from(n.headers), n; + ), n.headers = yi.from(n.headers), n; }, function(n) { - return RS(n) || (Rm(t), n && n.response && (n.response.data = Tm.call( + return TS(n) || (Rm(t), n && n.response && (n.response.data = Tm.call( t, t.transformResponse, n.response - ), n.response.headers = wi.from(n.response.headers))), Promise.reject(n); + ), n.response.headers = yi.from(n.response.headers))), Promise.reject(n); }); } -const BS = "1.7.8", gp = {}; +const $S = "1.7.8", gp = {}; ["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => { gp[t] = function(n) { return typeof n === t || "a" + (e < 1 ? "n " : " ") + t; }; }); -const K_ = {}; +const H6 = {}; gp.transitional = function(e, r, n) { function i(s, o) { - return "[Axios v" + BS + "] Transitional option '" + s + "'" + o + (n ? ". " + n : ""); + return "[Axios v" + $S + "] Transitional option '" + s + "'" + o + (n ? ". " + n : ""); } return (s, o, a) => { if (e === !1) @@ -30367,7 +30367,7 @@ gp.transitional = function(e, r, n) { i(o, " has been removed" + (r ? " in " + r : "")), or.ERR_DEPRECATED ); - return r && !K_[o] && (K_[o] = !0, console.warn( + return r && !H6[o] && (H6[o] = !0, console.warn( i( o, " has been deprecated since v" + r + " and will be removed in the near future" @@ -30402,8 +30402,8 @@ const Bd = { let ac = class { constructor(e) { this.defaults = e, this.interceptors = { - request: new $_(), - response: new $_() + request: new k6(), + response: new k6() }; } /** @@ -30456,7 +30456,7 @@ let ac = class { (M) => { delete s[M]; } - ), r.headers = wi.concat(o, s); + ), r.headers = yi.concat(o, s); const a = []; let u = !0; this.interceptors.request.forEach(function(N) { @@ -30468,7 +30468,7 @@ let ac = class { }); let d, p = 0, w; if (!u) { - const M = [H_.bind(this), void 0]; + const M = [W6.bind(this), void 0]; for (M.unshift.apply(M, a), M.push.apply(M, l), w = M.length, d = Promise.resolve(r); p < w; ) d = d.then(M[p++], M[p++]); return d; @@ -30485,7 +30485,7 @@ let ac = class { } } try { - d = H_.call(this, A); + d = W6.call(this, A); } catch (M) { return Promise.reject(M); } @@ -30495,8 +30495,8 @@ let ac = class { } getUri(e) { e = gc(this.defaults, e); - const r = OS(e.baseURL, e.url); - return IS(r, e.params, e.paramsSerializer); + const r = DS(e.baseURL, e.url); + return MS(r, e.params, e.paramsSerializer); } }; Oe.forEach(["delete", "get", "head", "options"], function(e) { @@ -30523,7 +30523,7 @@ Oe.forEach(["post", "put", "patch"], function(e) { } ac.prototype[e] = r(), ac.prototype[e + "Form"] = r(!0); }); -let eZ = class FS { +let eZ = class BS { constructor(e) { if (typeof e != "function") throw new TypeError("executor must be a function."); @@ -30589,7 +30589,7 @@ let eZ = class FS { static source() { let e; return { - token: new FS(function(i) { + token: new BS(function(i) { e = i; }), cancel: e @@ -30672,18 +30672,18 @@ const J1 = { Object.entries(J1).forEach(([t, e]) => { J1[e] = t; }); -function jS(t) { - const e = new ac(t), r = mS(ac.prototype.request, e); +function FS(t) { + const e = new ac(t), r = gS(ac.prototype.request, e); return Oe.extend(r, ac.prototype, e, { allOwnKeys: !0 }), Oe.extend(r, e, null, { allOwnKeys: !0 }), r.create = function(i) { - return jS(gc(t, i)); + return FS(gc(t, i)); }, r; } -const mn = jS(oh); +const mn = FS(oh); mn.Axios = ac; mn.CanceledError = Hu; mn.CancelToken = eZ; -mn.isCancel = RS; -mn.VERSION = BS; +mn.isCancel = TS; +mn.VERSION = $S; mn.toFormData = dp; mn.AxiosError = or; mn.Cancel = mn.CanceledError; @@ -30693,29 +30693,29 @@ mn.all = function(e) { mn.spread = tZ; mn.isAxiosError = rZ; mn.mergeConfig = gc; -mn.AxiosHeaders = wi; -mn.formToJSON = (t) => TS(Oe.isHTMLForm(t) ? new FormData(t) : t); -mn.getAdapter = $S.getAdapter; +mn.AxiosHeaders = yi; +mn.formToJSON = (t) => CS(Oe.isHTMLForm(t) ? new FormData(t) : t); +mn.getAdapter = kS.getAdapter; mn.HttpStatusCode = J1; mn.default = mn; const { - Axios: noe, - AxiosError: US, - CanceledError: ioe, - isCancel: soe, - CancelToken: ooe, - VERSION: aoe, - all: coe, - Cancel: uoe, - isAxiosError: foe, - spread: loe, - toFormData: hoe, - AxiosHeaders: doe, - HttpStatusCode: poe, - formToJSON: goe, - getAdapter: moe, - mergeConfig: voe -} = mn, qS = mn.create({ + Axios: ioe, + AxiosError: jS, + CanceledError: soe, + isCancel: ooe, + CancelToken: aoe, + VERSION: coe, + all: uoe, + Cancel: foe, + isAxiosError: loe, + spread: hoe, + toFormData: doe, + AxiosHeaders: poe, + HttpStatusCode: goe, + formToJSON: moe, + getAdapter: voe, + mergeConfig: boe +} = mn, US = mn.create({ timeout: 6e4, headers: { "Content-Type": "application/json", @@ -30725,7 +30725,7 @@ const { function nZ(t) { var e, r, n; if (((e = t.data) == null ? void 0 : e.success) !== !0) { - const i = new US( + const i = new jS( (r = t.data) == null ? void 0 : r.errorMessage, (n = t.data) == null ? void 0 : n.errorCode, t.config, @@ -30742,7 +30742,7 @@ function iZ(t) { const e = (r = t.response) == null ? void 0 : r.data; if (e) { console.log(e, "responseData"); - const n = new US( + const n = new jS( e.errorMessage, t.code, t.config, @@ -30753,7 +30753,7 @@ function iZ(t) { } else return Promise.reject(t); } -qS.interceptors.response.use( +US.interceptors.response.use( nZ, iZ ); @@ -30794,7 +30794,7 @@ class sZ { return (await this.request.post("/api/v2/user/account/bind", e)).data; } } -const Ta = new sZ(qS), oZ = { +const Ta = new sZ(US), oZ = { projectId: "7a4434fefbcc9af474fb5c995e47d286", metadata: { name: "codatta", @@ -30805,7 +30805,7 @@ const Ta = new sZ(qS), oZ = { }, aZ = PJ({ appName: "codatta", appLogoUrl: "https://avatars.githubusercontent.com/u/171659315" -}), zS = Sa({ +}), qS = Sa({ saveLastUsedWallet: () => { }, lastUsedWallet: null, @@ -30814,9 +30814,9 @@ const Ta = new sZ(qS), oZ = { featuredWallets: [] }); function mp() { - return Tn(zS); + return Tn(qS); } -function boe(t) { +function yoe(t) { const { apiBaseUrl: e } = t, [r, n] = Yt([]), [i, s] = Yt([]), [o, a] = Yt(null), [u, l] = Yt(!1), d = (A) => { a(A); const N = { @@ -30827,35 +30827,42 @@ function boe(t) { localStorage.setItem("xn-last-used-info", JSON.stringify(N)); }; function p(A) { - const M = A.filter(($) => $.featured || $.installed), N = A.filter(($) => !$.featured && !$.installed), L = [...M, ...N]; - n(L), s(M); + const M = A.find((N) => { + var L; + return ((L = N.config) == null ? void 0 : L.name) === t.singleWalletName; + }); + if (M) + s([M]); + else { + const N = A.filter(($) => $.featured || $.installed), L = A.filter(($) => !$.featured && !$.installed), B = [...N, ...L]; + n(B), s(N); + } } async function w() { const A = [], M = /* @__PURE__ */ new Map(); qR.forEach((L) => { - const $ = new vl(L); - L.name === "Coinbase Wallet" && $.EIP6963Detected({ + const B = new vl(L); + L.name === "Coinbase Wallet" && B.EIP6963Detected({ info: { name: "Coinbase Wallet", uuid: "coinbase", icon: L.image, rdns: "coinbase" }, provider: aZ.getProvider() - }), M.set($.key, $), A.push($); + }), M.set(B.key, B), A.push(B); }), (await UG()).forEach((L) => { - const $ = M.get(L.info.name); - if ($) - $.EIP6963Detected(L); + const B = M.get(L.info.name); + if (B) + B.EIP6963Detected(L); else { - const B = new vl(L); - M.set(B.key, B), A.push(B); + const $ = new vl(L); + M.set($.key, $), A.push($); } - console.log(L); }); try { - const L = JSON.parse(localStorage.getItem("xn-last-used-info") || "{}"), $ = M.get(L.key); - if ($) { - if ($.lastUsed = !0, L.provider === "UniversalProvider") { - const B = await N1.init(oZ); - B.session && ($.setUniversalProvider(B), console.log("Restored UniversalProvider for wallet:", $.key)); - } else L.provider === "EIP1193Provider" && $.installed && console.log("Using detected EIP1193Provider for wallet:", $.key); - a($); + const L = JSON.parse(localStorage.getItem("xn-last-used-info") || "{}"), B = M.get(L.key); + if (B) { + if (B.lastUsed = !0, L.provider === "UniversalProvider") { + const $ = await N1.init(oZ); + $.session && (B.setUniversalProvider($), console.log("Restored UniversalProvider for wallet:", B.key)); + } else L.provider === "EIP1193Provider" && B.installed && console.log("Using detected EIP1193Provider for wallet:", B.key); + a(B); } } catch (L) { console.log(L); @@ -30864,8 +30871,8 @@ function boe(t) { } return Dn(() => { w(), Ta.setApiBase(e); - }, []), /* @__PURE__ */ pe.jsx( - zS.Provider, + }, []), /* @__PURE__ */ le.jsx( + qS.Provider, { value: { saveLastUsedWallet: d, @@ -30884,7 +30891,7 @@ function boe(t) { * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const cZ = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), WS = (...t) => t.filter((e, r, n) => !!e && e.trim() !== "" && n.indexOf(e) === r).join(" ").trim(); +const cZ = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), zS = (...t) => t.filter((e, r, n) => !!e && e.trim() !== "" && n.indexOf(e) === r).join(" ").trim(); /** * @license lucide-react v0.460.0 - ISC * @@ -30908,7 +30915,7 @@ var uZ = { * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const fZ = vv( +const fZ = mv( ({ color: t = "currentColor", size: e = 24, @@ -30927,7 +30934,7 @@ const fZ = vv( height: e, stroke: t, strokeWidth: n ? Number(r) * 24 / Number(e) : r, - className: WS("lucide", i), + className: zS("lucide", i), ...a }, [ @@ -30943,11 +30950,11 @@ const fZ = vv( * See the LICENSE file in the root directory of this source tree. */ const us = (t, e) => { - const r = vv( + const r = mv( ({ className: n, ...i }, s) => qd(fZ, { ref: s, iconNode: e, - className: WS(`lucide-${cZ(t)}`, n), + className: zS(`lucide-${cZ(t)}`, n), ...i }) ); @@ -30969,7 +30976,7 @@ const lZ = us("ArrowLeft", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const HS = us("ArrowRight", [ +const WS = us("ArrowRight", [ ["path", { d: "M5 12h14", key: "1ays0h" }], ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }] ]); @@ -31020,7 +31027,7 @@ const gZ = us("Globe", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const KS = us("Laptop", [ +const HS = us("Laptop", [ [ "path", { @@ -31065,7 +31072,7 @@ const vZ = us("Mail", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const VS = us("Search", [ +const KS = us("Search", [ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }], ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }] ]); @@ -31079,9 +31086,9 @@ const bZ = us("UserRoundCheck", [ ["path", { d: "M2 21a8 8 0 0 1 13.292-6", key: "bjp14o" }], ["circle", { cx: "10", cy: "8", r: "5", key: "o932ke" }], ["path", { d: "m16 19 2 2 4-4", key: "1b14m6" }] -]), V_ = /* @__PURE__ */ new Set(); +]), K6 = /* @__PURE__ */ new Set(); function vp(t, e, r) { - t || V_.has(e) || (console.warn(e), V_.add(e)); + t || K6.has(e) || (console.warn(e), K6.add(e)); } function yZ(t) { if (typeof Proxy > "u") @@ -31100,7 +31107,7 @@ function bp(t) { return t !== null && typeof t == "object" && typeof t.start == "function"; } const X1 = (t) => Array.isArray(t); -function GS(t, e) { +function VS(t, e) { if (!Array.isArray(e)) return !1; const r = e.length; @@ -31114,28 +31121,28 @@ function GS(t, e) { function Il(t) { return typeof t == "string" || Array.isArray(t); } -function G_(t) { +function V6(t) { const e = [{}, {}]; return t == null || t.values.forEach((r, n) => { e[0][n] = r.get(), e[1][n] = r.getVelocity(); }), e; } -function Cb(t, e, r, n) { +function Ib(t, e, r, n) { if (typeof e == "function") { - const [i, s] = G_(n); + const [i, s] = V6(n); e = e(r !== void 0 ? r : t.custom, i, s); } if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") { - const [i, s] = G_(n); + const [i, s] = V6(n); e = e(r !== void 0 ? r : t.custom, i, s); } return e; } function yp(t, e, r) { const n = t.getProps(); - return Cb(n, e, r !== void 0 ? r : n.custom, t); + return Ib(n, e, r !== void 0 ? r : n.custom, t); } -const Tb = [ +const Cb = [ "animate", "whileInView", "whileFocus", @@ -31143,7 +31150,7 @@ const Tb = [ "whileTap", "whileDrag", "exit" -], Rb = ["initial", ...Tb], ah = [ +], Tb = ["initial", ...Cb], ah = [ "transformPerspective", "x", "y", @@ -31179,7 +31186,7 @@ const Tb = [ ease: [0.25, 0.1, 0.35, 1], duration: 0.3 }, SZ = (t, { keyframes: e }) => e.length > 2 ? _Z : Ac.has(t) ? t.startsWith("scale") ? xZ(e[1]) : wZ : EZ; -function Db(t, e) { +function Rb(t, e) { return t ? t[e] || t.default || t : void 0; } const AZ = { @@ -31242,31 +31249,31 @@ const gd = [ "postRender" // Compute ], IZ = 40; -function YS(t, e) { +function GS(t, e) { let r = !1, n = !0; const i = { delta: 0, timestamp: 0, isProcessing: !1 - }, s = () => r = !0, o = gd.reduce(($, B) => ($[B] = MZ(s), $), {}), { read: a, resolveKeyframes: u, update: l, preRender: d, render: p, postRender: w } = o, A = () => { - const $ = performance.now(); - r = !1, i.delta = n ? 1e3 / 60 : Math.max(Math.min($ - i.timestamp, IZ), 1), i.timestamp = $, i.isProcessing = !0, a.process(i), u.process(i), l.process(i), d.process(i), p.process(i), w.process(i), i.isProcessing = !1, r && e && (n = !1, t(A)); + }, s = () => r = !0, o = gd.reduce((B, $) => (B[$] = MZ(s), B), {}), { read: a, resolveKeyframes: u, update: l, preRender: d, render: p, postRender: w } = o, A = () => { + const B = performance.now(); + r = !1, i.delta = n ? 1e3 / 60 : Math.max(Math.min(B - i.timestamp, IZ), 1), i.timestamp = B, i.isProcessing = !0, a.process(i), u.process(i), l.process(i), d.process(i), p.process(i), w.process(i), i.isProcessing = !1, r && e && (n = !1, t(A)); }, M = () => { r = !0, n = !0, i.isProcessing || t(A); }; - return { schedule: gd.reduce(($, B) => { - const H = o[B]; - return $[B] = (U, V = !1, te = !1) => (r || M(), H.schedule(U, V, te)), $; - }, {}), cancel: ($) => { - for (let B = 0; B < gd.length; B++) - o[gd[B]].cancel($); + return { schedule: gd.reduce((B, $) => { + const H = o[$]; + return B[$] = (U, V = !1, te = !1) => (r || M(), H.schedule(U, V, te)), B; + }, {}), cancel: (B) => { + for (let $ = 0; $ < gd.length; $++) + o[gd[$]].cancel(B); }, state: i, steps: o }; } -const { schedule: Lr, cancel: wa, state: Fn, steps: Dm } = YS(typeof requestAnimationFrame < "u" ? requestAnimationFrame : Un, !0), JS = (t, e, r) => (((1 - 3 * r + 3 * e) * t + (3 * r - 6 * e)) * t + 3 * e) * t, CZ = 1e-7, TZ = 12; +const { schedule: Lr, cancel: wa, state: Fn, steps: Dm } = GS(typeof requestAnimationFrame < "u" ? requestAnimationFrame : Un, !0), YS = (t, e, r) => (((1 - 3 * r + 3 * e) * t + (3 * r - 6 * e)) * t + 3 * e) * t, CZ = 1e-7, TZ = 12; function RZ(t, e, r, n, i) { let s, o, a = 0; do - o = e + (r - e) / 2, s = JS(o, n, i) - t, s > 0 ? r = o : e = o; + o = e + (r - e) / 2, s = YS(o, n, i) - t, s > 0 ? r = o : e = o; while (Math.abs(s) > CZ && ++a < TZ); return o; } @@ -31274,11 +31281,11 @@ function ch(t, e, r, n) { if (t === e && r === n) return Un; const i = (s) => RZ(s, 0, 1, t, r); - return (s) => s === 0 || s === 1 ? s : JS(i(s), e, n); + return (s) => s === 0 || s === 1 ? s : YS(i(s), e, n); } -const XS = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, ZS = (t) => (e) => 1 - t(1 - e), QS = /* @__PURE__ */ ch(0.33, 1.53, 0.69, 0.99), Ob = /* @__PURE__ */ ZS(QS), e7 = /* @__PURE__ */ XS(Ob), t7 = (t) => (t *= 2) < 1 ? 0.5 * Ob(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Nb = (t) => 1 - Math.sin(Math.acos(t)), r7 = ZS(Nb), n7 = XS(Nb), i7 = (t) => /^0[^.\s]+$/u.test(t); +const JS = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, XS = (t) => (e) => 1 - t(1 - e), ZS = /* @__PURE__ */ ch(0.33, 1.53, 0.69, 0.99), Db = /* @__PURE__ */ XS(ZS), QS = /* @__PURE__ */ JS(Db), e7 = (t) => (t *= 2) < 1 ? 0.5 * Db(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Ob = (t) => 1 - Math.sin(Math.acos(t)), t7 = XS(Ob), r7 = JS(Ob), n7 = (t) => /^0[^.\s]+$/u.test(t); function DZ(t) { - return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || i7(t) : !0; + return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || n7(t) : !0; } let Ku = Un, Uo = Un; process.env.NODE_ENV !== "production" && (Ku = (t, e) => { @@ -31287,7 +31294,7 @@ process.env.NODE_ENV !== "production" && (Ku = (t, e) => { if (!t) throw new Error(e); }); -const s7 = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), o7 = (t) => (e) => typeof e == "string" && e.startsWith(t), a7 = /* @__PURE__ */ o7("--"), OZ = /* @__PURE__ */ o7("var(--"), Lb = (t) => OZ(t) ? NZ.test(t.split("/*")[0].trim()) : !1, NZ = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, LZ = ( +const i7 = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), s7 = (t) => (e) => typeof e == "string" && e.startsWith(t), o7 = /* @__PURE__ */ s7("--"), OZ = /* @__PURE__ */ s7("var(--"), Nb = (t) => OZ(t) ? NZ.test(t.split("/*")[0].trim()) : !1, NZ = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, LZ = ( // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u ); @@ -31299,7 +31306,7 @@ function kZ(t) { return [`--${r ?? n}`, i]; } const $Z = 4; -function c7(t, e, r = 1) { +function a7(t, e, r = 1) { Uo(r <= $Z, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`); const [n, i] = kZ(t); if (!n) @@ -31307,9 +31314,9 @@ function c7(t, e, r = 1) { const s = window.getComputedStyle(e).getPropertyValue(n); if (s) { const o = s.trim(); - return s7(o) ? parseFloat(o) : o; + return i7(o) ? parseFloat(o) : o; } - return Lb(i) ? c7(i, e, r + 1) : i; + return Nb(i) ? a7(i, e, r + 1) : i; } const xa = (t, e, r) => r > e ? e : r < t ? t : r, Vu = { test: (t) => typeof t == "number", @@ -31325,7 +31332,7 @@ const xa = (t, e, r) => r > e ? e : r < t ? t : r, Vu = { test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1, parse: parseFloat, transform: (e) => `${e}${t}` -}), oa = /* @__PURE__ */ uh("deg"), Gs = /* @__PURE__ */ uh("%"), Vt = /* @__PURE__ */ uh("px"), BZ = /* @__PURE__ */ uh("vh"), FZ = /* @__PURE__ */ uh("vw"), Y_ = { +}), oa = /* @__PURE__ */ uh("deg"), Gs = /* @__PURE__ */ uh("%"), Vt = /* @__PURE__ */ uh("px"), BZ = /* @__PURE__ */ uh("vh"), FZ = /* @__PURE__ */ uh("vw"), G6 = { ...Gs, parse: (t) => Gs.parse(t) / 100, transform: (t) => Gs.transform(t * 100) @@ -31340,15 +31347,15 @@ const xa = (t, e, r) => r > e ? e : r < t ? t : r, Vu = { "y", "translateX", "translateY" -]), J_ = (t) => t === Vu || t === Vt, X_ = (t, e) => parseFloat(t.split(", ")[e]), Z_ = (t, e) => (r, { transform: n }) => { +]), Y6 = (t) => t === Vu || t === Vt, J6 = (t, e) => parseFloat(t.split(", ")[e]), X6 = (t, e) => (r, { transform: n }) => { if (n === "none" || !n) return 0; const i = n.match(/^matrix3d\((.+)\)$/u); if (i) - return X_(i[1], e); + return J6(i[1], e); { const s = n.match(/^matrix\((.+)\)$/u); - return s ? X_(s[1], t) : 0; + return s ? J6(s[1], t) : 0; } }, UZ = /* @__PURE__ */ new Set(["x", "y", "z"]), qZ = ah.filter((t) => !UZ.has(t)); function zZ(t) { @@ -31367,17 +31374,17 @@ const Mu = { bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min), right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min), // Transform - x: Z_(4, 13), - y: Z_(5, 14) + x: X6(4, 13), + y: X6(5, 14) }; Mu.translateX = Mu.x; Mu.translateY = Mu.y; -const u7 = (t) => (e) => e.test(t), WZ = { +const c7 = (t) => (e) => e.test(t), WZ = { test: (t) => t === "auto", parse: (t) => t -}, f7 = [Vu, Vt, Gs, oa, FZ, BZ, WZ], Q_ = (t) => f7.find(u7(t)), cc = /* @__PURE__ */ new Set(); +}, u7 = [Vu, Vt, Gs, oa, FZ, BZ, WZ], Z6 = (t) => u7.find(c7(t)), cc = /* @__PURE__ */ new Set(); let Z1 = !1, Q1 = !1; -function l7() { +function f7() { if (Q1) { const t = Array.from(cc).filter((n) => n.needsMeasurement), e = new Set(t.map((n) => n.element)), r = /* @__PURE__ */ new Map(); e.forEach((n) => { @@ -31396,20 +31403,20 @@ function l7() { } Q1 = !1, Z1 = !1, cc.forEach((t) => t.complete()), cc.clear(); } -function h7() { +function l7() { cc.forEach((t) => { t.readKeyframes(), t.needsMeasurement && (Q1 = !0); }); } function HZ() { - h7(), l7(); + l7(), f7(); } -class kb { +class Lb { constructor(e, r, n, i, s, o = !1) { this.isComplete = !1, this.isAsync = !1, this.needsMeasurement = !1, this.isScheduled = !1, this.unresolvedKeyframes = [...e], this.onComplete = r, this.name = n, this.motionValue = i, this.element = s, this.isAsync = o; } scheduleResolve() { - this.isScheduled = !0, this.isAsync ? (cc.add(this), Z1 || (Z1 = !0, Lr.read(h7), Lr.resolveKeyframes(l7))) : (this.readKeyframes(), this.complete()); + this.isScheduled = !0, this.isAsync ? (cc.add(this), Z1 || (Z1 = !0, Lr.read(l7), Lr.resolveKeyframes(f7))) : (this.readKeyframes(), this.complete()); } readKeyframes() { const { unresolvedKeyframes: e, name: r, element: n, motionValue: i } = this; @@ -31445,14 +31452,14 @@ class kb { this.isComplete || this.scheduleResolve(); } } -const Yf = (t) => Math.round(t * 1e5) / 1e5, $b = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; +const Yf = (t) => Math.round(t * 1e5) / 1e5, kb = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; function KZ(t) { return t == null; } -const VZ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, Bb = (t, e) => (r) => !!(typeof r == "string" && VZ.test(r) && r.startsWith(t) || e && !KZ(r) && Object.prototype.hasOwnProperty.call(r, e)), d7 = (t, e, r) => (n) => { +const VZ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, $b = (t, e) => (r) => !!(typeof r == "string" && VZ.test(r) && r.startsWith(t) || e && !KZ(r) && Object.prototype.hasOwnProperty.call(r, e)), h7 = (t, e, r) => (n) => { if (typeof n != "string") return n; - const [i, s, o, a] = n.match($b); + const [i, s, o, a] = n.match(kb); return { [t]: parseFloat(i), [e]: parseFloat(s), @@ -31463,8 +31470,8 @@ const VZ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s ...Vu, transform: (t) => Math.round(GZ(t)) }, sc = { - test: /* @__PURE__ */ Bb("rgb", "red"), - parse: /* @__PURE__ */ d7("red", "green", "blue"), + test: /* @__PURE__ */ $b("rgb", "red"), + parse: /* @__PURE__ */ h7("red", "green", "blue"), transform: ({ red: t, green: e, blue: r, alpha: n = 1 }) => "rgba(" + Om.transform(t) + ", " + Om.transform(e) + ", " + Om.transform(r) + ", " + Yf(Cl.transform(n)) + ")" }; function YZ(t) { @@ -31477,12 +31484,12 @@ function YZ(t) { }; } const ev = { - test: /* @__PURE__ */ Bb("#"), + test: /* @__PURE__ */ $b("#"), parse: YZ, transform: sc.transform }, eu = { - test: /* @__PURE__ */ Bb("hsl", "hue"), - parse: /* @__PURE__ */ d7("hue", "saturation", "lightness"), + test: /* @__PURE__ */ $b("hsl", "hue"), + parse: /* @__PURE__ */ h7("hue", "saturation", "lightness"), transform: ({ hue: t, saturation: e, lightness: r, alpha: n = 1 }) => "hsla(" + Math.round(t) + ", " + Gs.transform(Yf(e)) + ", " + Gs.transform(Yf(r)) + ", " + Yf(Cl.transform(n)) + ")" }, Yn = { test: (t) => sc.test(t) || ev.test(t) || eu.test(t), @@ -31491,9 +31498,9 @@ const ev = { }, JZ = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu; function XZ(t) { var e, r; - return isNaN(t) && typeof t == "string" && (((e = t.match($b)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match(JZ)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; + return isNaN(t) && typeof t == "string" && (((e = t.match(kb)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match(JZ)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; } -const p7 = "number", g7 = "color", ZZ = "var", QZ = "var(", e6 = "${}", eQ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; +const d7 = "number", p7 = "color", ZZ = "var", QZ = "var(", Q6 = "${}", eQ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; function Tl(t) { const e = t.toString(), r = [], n = { color: [], @@ -31501,40 +31508,40 @@ function Tl(t) { var: [] }, i = []; let s = 0; - const a = e.replace(eQ, (u) => (Yn.test(u) ? (n.color.push(s), i.push(g7), r.push(Yn.parse(u))) : u.startsWith(QZ) ? (n.var.push(s), i.push(ZZ), r.push(u)) : (n.number.push(s), i.push(p7), r.push(parseFloat(u))), ++s, e6)).split(e6); + const a = e.replace(eQ, (u) => (Yn.test(u) ? (n.color.push(s), i.push(p7), r.push(Yn.parse(u))) : u.startsWith(QZ) ? (n.var.push(s), i.push(ZZ), r.push(u)) : (n.number.push(s), i.push(d7), r.push(parseFloat(u))), ++s, Q6)).split(Q6); return { values: r, split: a, indexes: n, types: i }; } -function m7(t) { +function g7(t) { return Tl(t).values; } -function v7(t) { +function m7(t) { const { split: e, types: r } = Tl(t), n = e.length; return (i) => { let s = ""; for (let o = 0; o < n; o++) if (s += e[o], i[o] !== void 0) { const a = r[o]; - a === p7 ? s += Yf(i[o]) : a === g7 ? s += Yn.transform(i[o]) : s += i[o]; + a === d7 ? s += Yf(i[o]) : a === p7 ? s += Yn.transform(i[o]) : s += i[o]; } return s; }; } const tQ = (t) => typeof t == "number" ? 0 : t; function rQ(t) { - const e = m7(t); - return v7(t)(e.map(tQ)); + const e = g7(t); + return m7(t)(e.map(tQ)); } const _a = { test: XZ, - parse: m7, - createTransformer: v7, + parse: g7, + createTransformer: m7, getAnimatableNone: rQ }, nQ = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]); function iQ(t) { const [e, r] = t.slice(0, -1).split("("); if (e === "drop-shadow") return t; - const [n] = r.match($b) || []; + const [n] = r.match(kb) || []; if (!n) return t; const i = r.replace(n, ""); @@ -31605,23 +31612,23 @@ const sQ = /\b([a-z-]*)\(.*?\)/gu, tv = { perspective: Vt, transformPerspective: Vt, opacity: Cl, - originX: Y_, - originY: Y_, + originX: G6, + originY: G6, originZ: Vt -}, t6 = { +}, e_ = { ...Vu, transform: Math.round -}, Fb = { +}, Bb = { ...oQ, ...aQ, - zIndex: t6, + zIndex: e_, size: Vt, // SVG fillOpacity: Cl, strokeOpacity: Cl, - numOctaves: t6 + numOctaves: e_ }, cQ = { - ...Fb, + ...Bb, // Color props color: Yn, backgroundColor: Yn, @@ -31636,9 +31643,9 @@ const sQ = /\b([a-z-]*)\(.*?\)/gu, tv = { borderLeftColor: Yn, filter: tv, WebkitFilter: tv -}, jb = (t) => cQ[t]; -function b7(t, e) { - let r = jb(t); +}, Fb = (t) => cQ[t]; +function v7(t, e) { + let r = Fb(t); return r !== tv && (r = _a), r.getAnimatableNone ? r.getAnimatableNone(e) : void 0; } const uQ = /* @__PURE__ */ new Set(["auto", "none", "0"]); @@ -31650,9 +31657,9 @@ function fQ(t, e, r) { } if (i && r) for (const s of e) - t[s] = b7(r, i); + t[s] = v7(r, i); } -class y7 extends kb { +class b7 extends Lb { constructor(e, r, n, i, s) { super(e, r, n, i, s, !0); } @@ -31663,16 +31670,16 @@ class y7 extends kb { super.readKeyframes(); for (let u = 0; u < e.length; u++) { let l = e[u]; - if (typeof l == "string" && (l = l.trim(), Lb(l))) { - const d = c7(l, r.current); + if (typeof l == "string" && (l = l.trim(), Nb(l))) { + const d = a7(l, r.current); d !== void 0 && (e[u] = d), u === e.length - 1 && (this.finalKeyframe = l); } } if (this.resolveNoneKeyframes(), !jZ.has(n) || e.length !== 2) return; - const [i, s] = e, o = Q_(i), a = Q_(s); + const [i, s] = e, o = Z6(i), a = Z6(s); if (o !== a) - if (J_(o) && J_(a)) + if (Y6(o) && Y6(a)) for (let u = 0; u < e.length; u++) { const l = e[u]; typeof l == "string" && (e[u] = parseFloat(l)); @@ -31707,7 +31714,7 @@ class y7 extends kb { }), this.resolveNoneKeyframes(); } } -function Ub(t) { +function jb(t) { return typeof t == "function"; } let Fd; @@ -31719,7 +31726,7 @@ const Ys = { set: (t) => { Fd = t, queueMicrotask(lQ); } -}, r6 = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string +}, t_ = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string (_a.test(t) || t === "0") && // And it contains numbers and/or colors !t.startsWith("url(")); function hQ(t) { @@ -31736,11 +31743,11 @@ function dQ(t, e, r, n) { return !1; if (e === "display" || e === "visibility") return !0; - const s = t[t.length - 1], o = r6(i, e), a = r6(s, e); - return Ku(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : hQ(t) || (r === "spring" || Ub(r)) && n; + const s = t[t.length - 1], o = t_(i, e), a = t_(s, e); + return Ku(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : hQ(t) || (r === "spring" || jb(r)) && n; } const pQ = 40; -class w7 { +class y7 { constructor({ autoplay: e = !0, delay: r = 0, type: n = "keyframes", repeat: i = 0, repeatDelay: s = 0, repeatType: o = "loop", ...a }) { this.isStopped = !1, this.hasAttemptedResolve = !1, this.createdAt = Ys.now(), this.options = { autoplay: e, @@ -31814,20 +31821,20 @@ class w7 { }); } } -function x7(t, e) { +function w7(t, e) { return e ? t * (1e3 / e) : 0; } const gQ = 5; -function _7(t, e, r) { +function x7(t, e, r) { const n = Math.max(e - gQ, 0); - return x7(r - t(n), e - n); + return w7(r - t(n), e - n); } -const Nm = 1e-3, mQ = 0.01, n6 = 10, vQ = 0.05, bQ = 1; +const Nm = 1e-3, mQ = 0.01, r_ = 10, vQ = 0.05, bQ = 1; function yQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }) { let i, s; - Ku(t <= Vs(n6), "Spring duration must be 10 seconds or less"); + Ku(t <= Vs(r_), "Spring duration must be 10 seconds or less"); let o = 1 - e; - o = xa(vQ, bQ, o), t = xa(mQ, n6, To(t)), o < 1 ? (i = (l) => { + o = xa(vQ, bQ, o), t = xa(mQ, r_, To(t)), o < 1 ? (i = (l) => { const d = l * o, p = d * t, w = d - r, A = rv(l, o), M = Math.exp(-p); return Nm - w / A * M; }, s = (l) => { @@ -31867,7 +31874,7 @@ function rv(t, e) { return t * Math.sqrt(1 - e * e); } const _Q = ["duration", "bounce"], EQ = ["stiffness", "damping", "mass"]; -function i6(t, e) { +function n_(t, e) { return e.some((r) => t[r] !== void 0); } function SQ(t) { @@ -31879,7 +31886,7 @@ function SQ(t) { isResolvedFromDuration: !1, ...t }; - if (!i6(t, EQ) && i6(t, _Q)) { + if (!n_(t, EQ) && n_(t, _Q)) { const r = yQ(t); e = { ...e, @@ -31889,24 +31896,24 @@ function SQ(t) { } return e; } -function E7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { +function _7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { const i = t[0], s = t[t.length - 1], o = { done: !1, value: i }, { stiffness: a, damping: u, mass: l, duration: d, velocity: p, isResolvedFromDuration: w } = SQ({ ...n, velocity: -To(n.velocity || 0) - }), A = p || 0, M = u / (2 * Math.sqrt(a * l)), N = s - i, L = To(Math.sqrt(a / l)), $ = Math.abs(N) < 5; - r || (r = $ ? 0.01 : 2), e || (e = $ ? 5e-3 : 0.5); - let B; + }), A = p || 0, M = u / (2 * Math.sqrt(a * l)), N = s - i, L = To(Math.sqrt(a / l)), B = Math.abs(N) < 5; + r || (r = B ? 0.01 : 2), e || (e = B ? 5e-3 : 0.5); + let $; if (M < 1) { const H = rv(L, M); - B = (U) => { + $ = (U) => { const V = Math.exp(-M * L * U); return s - V * ((A + M * L * N) / H * Math.sin(H * U) + N * Math.cos(H * U)); }; } else if (M === 1) - B = (H) => s - Math.exp(-L * H) * (N + (A + L * N) * H); + $ = (H) => s - Math.exp(-L * H) * (N + (A + L * N) * H); else { const H = L * Math.sqrt(M * M - 1); - B = (U) => { + $ = (U) => { const V = Math.exp(-M * L * U), te = Math.min(H * U, 300); return s - V * ((A + M * L * N) * Math.sinh(te) + H * N * Math.cosh(te)) / H; }; @@ -31914,12 +31921,12 @@ function E7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { return { calculatedDuration: w && d || null, next: (H) => { - const U = B(H); + const U = $(H); if (w) o.done = H >= d; else { let V = 0; - M < 1 && (V = H === 0 ? Vs(A) : _7(B, H, U)); + M < 1 && (V = H === 0 ? Vs(A) : x7($, H, U)); const te = Math.abs(V) <= r, R = Math.abs(s - U) <= e; o.done = te && R; } @@ -31927,23 +31934,23 @@ function E7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { } }; } -function s6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: u, restDelta: l = 0.5, restSpeed: d }) { +function i_({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: u, restDelta: l = 0.5, restSpeed: d }) { const p = t[0], w = { done: !1, value: p }, A = (K) => a !== void 0 && K < a || u !== void 0 && K > u, M = (K) => a === void 0 ? u : u === void 0 || Math.abs(a - K) < Math.abs(u - K) ? a : u; let N = r * e; - const L = p + N, $ = o === void 0 ? L : o(L); - $ !== L && (N = $ - p); - const B = (K) => -N * Math.exp(-K / n), H = (K) => $ + B(K), U = (K) => { - const ge = B(K), Ee = H(K); - w.done = Math.abs(ge) <= l, w.value = w.done ? $ : Ee; + const L = p + N, B = o === void 0 ? L : o(L); + B !== L && (N = B - p); + const $ = (K) => -N * Math.exp(-K / n), H = (K) => B + $(K), U = (K) => { + const ge = $(K), Ee = H(K); + w.done = Math.abs(ge) <= l, w.value = w.done ? B : Ee; }; let V, te; const R = (K) => { - A(w.value) && (V = K, te = E7({ + A(w.value) && (V = K, te = _7({ keyframes: [w.value, M(w.value)], - velocity: _7(H, K, w.value), + velocity: x7(H, K, w.value), // TODO: This should be passing * 1000 damping: i, stiffness: s, @@ -31959,25 +31966,25 @@ function s6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 3 } }; } -const AQ = /* @__PURE__ */ ch(0.42, 0, 1, 1), PQ = /* @__PURE__ */ ch(0, 0, 0.58, 1), S7 = /* @__PURE__ */ ch(0.42, 0, 0.58, 1), MQ = (t) => Array.isArray(t) && typeof t[0] != "number", qb = (t) => Array.isArray(t) && typeof t[0] == "number", o6 = { +const AQ = /* @__PURE__ */ ch(0.42, 0, 1, 1), PQ = /* @__PURE__ */ ch(0, 0, 0.58, 1), E7 = /* @__PURE__ */ ch(0.42, 0, 0.58, 1), MQ = (t) => Array.isArray(t) && typeof t[0] != "number", Ub = (t) => Array.isArray(t) && typeof t[0] == "number", s_ = { linear: Un, easeIn: AQ, - easeInOut: S7, + easeInOut: E7, easeOut: PQ, - circIn: Nb, - circInOut: n7, - circOut: r7, - backIn: Ob, - backInOut: e7, - backOut: QS, - anticipate: t7 -}, a6 = (t) => { - if (qb(t)) { + circIn: Ob, + circInOut: r7, + circOut: t7, + backIn: Db, + backInOut: QS, + backOut: ZS, + anticipate: e7 +}, o_ = (t) => { + if (Ub(t)) { Uo(t.length === 4, "Cubic bezier arrays must contain four numerical values."); const [e, r, n, i] = t; return ch(e, r, n, i); } else if (typeof t == "string") - return Uo(o6[t] !== void 0, `Invalid easing type '${t}'`), o6[t]; + return Uo(s_[t] !== void 0, `Invalid easing type '${t}'`), s_[t]; return t; }, IQ = (t, e) => (r) => e(t(r)), Ro = (...t) => t.reduce(IQ), Iu = (t, e, r) => { const n = e - t; @@ -32009,15 +32016,15 @@ const km = (t, e, r) => { const n = t * t, i = r * (e * e - n) + n; return i < 0 ? 0 : Math.sqrt(i); }, TQ = [ev, sc, eu], RQ = (t) => TQ.find((e) => e.test(t)); -function c6(t) { +function a_(t) { const e = RQ(t); if (Ku(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e) return !1; let r = e.parse(t); return e === eu && (r = CQ(r)), r; } -const u6 = (t, e) => { - const r = c6(t), n = c6(e); +const c_ = (t, e) => { + const r = a_(t), n = a_(e); if (!r || !n) return v0(t, e); const i = { ...r }; @@ -32029,11 +32036,11 @@ function DQ(t, e) { function OQ(t, e) { return (r) => Qr(t, e, r); } -function zb(t) { - return typeof t == "number" ? OQ : typeof t == "string" ? Lb(t) ? v0 : Yn.test(t) ? u6 : kQ : Array.isArray(t) ? A7 : typeof t == "object" ? Yn.test(t) ? u6 : NQ : v0; +function qb(t) { + return typeof t == "number" ? OQ : typeof t == "string" ? Nb(t) ? v0 : Yn.test(t) ? c_ : kQ : Array.isArray(t) ? S7 : typeof t == "object" ? Yn.test(t) ? c_ : NQ : v0; } -function A7(t, e) { - const r = [...t], n = r.length, i = t.map((s, o) => zb(s)(s, e[o])); +function S7(t, e) { + const r = [...t], n = r.length, i = t.map((s, o) => qb(s)(s, e[o])); return (s) => { for (let o = 0; o < n; o++) r[o] = i[o](s); @@ -32043,7 +32050,7 @@ function A7(t, e) { function NQ(t, e) { const r = { ...t, ...e }, n = {}; for (const i in r) - t[i] !== void 0 && e[i] !== void 0 && (n[i] = zb(t[i])(t[i], e[i])); + t[i] !== void 0 && e[i] !== void 0 && (n[i] = qb(t[i])(t[i], e[i])); return (i) => { for (const s in n) r[s] = n[s](i); @@ -32061,13 +32068,13 @@ function LQ(t, e) { } const kQ = (t, e) => { const r = _a.createTransformer(e), n = Tl(t), i = Tl(e); - return n.indexes.var.length === i.indexes.var.length && n.indexes.color.length === i.indexes.color.length && n.indexes.number.length >= i.indexes.number.length ? nv.has(t) && !i.values.length || nv.has(e) && !n.values.length ? DQ(t, e) : Ro(A7(LQ(n, i), i.values), r) : (Ku(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), v0(t, e)); + return n.indexes.var.length === i.indexes.var.length && n.indexes.color.length === i.indexes.color.length && n.indexes.number.length >= i.indexes.number.length ? nv.has(t) && !i.values.length || nv.has(e) && !n.values.length ? DQ(t, e) : Ro(S7(LQ(n, i), i.values), r) : (Ku(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), v0(t, e)); }; -function P7(t, e, r) { - return typeof t == "number" && typeof e == "number" && typeof r == "number" ? Qr(t, e, r) : zb(t)(t, e); +function A7(t, e, r) { + return typeof t == "number" && typeof e == "number" && typeof r == "number" ? Qr(t, e, r) : qb(t)(t, e); } function $Q(t, e, r) { - const n = [], i = r || P7, s = t.length - 1; + const n = [], i = r || A7, s = t.length - 1; for (let o = 0; o < s; o++) { let a = i(t[o], t[o + 1]); if (e) { @@ -32110,10 +32117,10 @@ function UQ(t, e) { return t.map((r) => r * e); } function qQ(t, e) { - return t.map(() => e || S7).splice(0, t.length - 1); + return t.map(() => e || E7).splice(0, t.length - 1); } function b0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" }) { - const i = MQ(n) ? n.map(a6) : a6(n), s = { + const i = MQ(n) ? n.map(o_) : o_(n), s = { done: !1, value: e[0] }, o = UQ( @@ -32129,14 +32136,14 @@ function b0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" } next: (u) => (s.value = a(u), s.done = u >= t, s) }; } -const f6 = 2e4; +const u_ = 2e4; function zQ(t) { let e = 0; const r = 50; let n = t.next(e); - for (; !n.done && e < f6; ) + for (; !n.done && e < u_; ) e += r, n = t.next(e); - return e >= f6 ? 1 / 0 : e; + return e >= u_ ? 1 / 0 : e; } const WQ = (t) => { const e = ({ timestamp: r }) => t(r); @@ -32150,13 +32157,13 @@ const WQ = (t) => { now: () => Fn.isProcessing ? Fn.timestamp : Ys.now() }; }, HQ = { - decay: s6, - inertia: s6, + decay: i_, + inertia: i_, tween: b0, keyframes: b0, - spring: E7 + spring: _7 }, KQ = (t) => t / 100; -class Wb extends w7 { +class zb extends y7 { constructor(e) { super(e), this.holdTime = null, this.cancelTime = null, this.currentTime = 0, this.playbackSpeed = 1, this.pendingPlayState = "running", this.startTime = null, this.state = "idle", this.stop = () => { if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle") @@ -32165,16 +32172,16 @@ class Wb extends w7 { const { onStop: u } = this.options; u && u(); }; - const { name: r, motionValue: n, element: i, keyframes: s } = this.options, o = (i == null ? void 0 : i.KeyframeResolver) || kb, a = (u, l) => this.onKeyframesResolved(u, l); + const { name: r, motionValue: n, element: i, keyframes: s } = this.options, o = (i == null ? void 0 : i.KeyframeResolver) || Lb, a = (u, l) => this.onKeyframesResolved(u, l); this.resolver = new o(s, a, r, n, i), this.resolver.scheduleResolve(); } flatten() { super.flatten(), this._resolved && Object.assign(this._resolved, this.initPlayback(this._resolved.keyframes)); } initPlayback(e) { - const { type: r = "keyframes", repeat: n = 0, repeatDelay: i = 0, repeatType: s, velocity: o = 0 } = this.options, a = Ub(r) ? r : HQ[r] || b0; + const { type: r = "keyframes", repeat: n = 0, repeatDelay: i = 0, repeatType: s, velocity: o = 0 } = this.options, a = jb(r) ? r : HQ[r] || b0; let u, l; - a !== b0 && typeof e[0] != "number" && (process.env.NODE_ENV !== "production" && Uo(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), u = Ro(KQ, P7(e[0], e[1])), e = [0, 100]); + a !== b0 && typeof e[0] != "number" && (process.env.NODE_ENV !== "production" && Uo(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), u = Ro(KQ, A7(e[0], e[1])), e = [0, 100]); const d = a({ ...this.options, keyframes: e }); s === "mirror" && (l = a({ ...this.options, @@ -32206,18 +32213,18 @@ class Wb extends w7 { return s.next(0); const { delay: w, repeat: A, repeatType: M, repeatDelay: N, onUpdate: L } = this.options; this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - d / this.speed, this.startTime)), r ? this.currentTime = e : this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = Math.round(e - this.startTime) * this.speed; - const $ = this.currentTime - w * (this.speed >= 0 ? 1 : -1), B = this.speed >= 0 ? $ < 0 : $ > d; - this.currentTime = Math.max($, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = d); + const B = this.currentTime - w * (this.speed >= 0 ? 1 : -1), $ = this.speed >= 0 ? B < 0 : B > d; + this.currentTime = Math.max(B, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = d); let H = this.currentTime, U = s; if (A) { const K = Math.min(this.currentTime, d) / p; let ge = Math.floor(K), Ee = K % 1; !Ee && K >= 1 && (Ee = 1), Ee === 1 && ge--, ge = Math.min(ge, A + 1), !!(ge % 2) && (M === "reverse" ? (Ee = 1 - Ee, N && (Ee -= N / p)) : M === "mirror" && (U = o)), H = xa(0, 1, Ee) * p; } - const V = B ? { done: !1, value: u[0] } : U.next(H); + const V = $ ? { done: !1, value: u[0] } : U.next(H); a && (V.value = a(V.value)); let { done: te } = V; - !B && l !== null && (te = this.speed >= 0 ? this.currentTime >= d : this.currentTime <= 0); + !$ && l !== null && (te = this.speed >= 0 ? this.currentTime >= d : this.currentTime <= 0); const R = this.holdTime === null && (this.state === "finished" || this.state === "running" && te); return R && i !== void 0 && (V.value = wp(u, this.options, i)), L && L(V.value), R && this.finish(), V; } @@ -32294,7 +32301,7 @@ const VQ = /* @__PURE__ */ new Set([ r += t(Iu(0, n - 1, i)) + ", "; return `linear(${r.substring(0, r.length - 2)})`; }; -function Hb(t) { +function Wb(t) { let e; return () => (e === void 0 && (e = t()), e); } @@ -32302,7 +32309,7 @@ const JQ = { linearEasing: void 0 }; function XQ(t, e) { - const r = Hb(t); + const r = Wb(t); return () => { var n; return (n = JQ[e]) !== null && n !== void 0 ? n : r(); @@ -32316,8 +32323,8 @@ const y0 = /* @__PURE__ */ XQ(() => { } return !0; }, "linearEasing"); -function M7(t) { - return !!(typeof t == "function" && y0() || !t || typeof t == "string" && (t in iv || y0()) || qb(t) || Array.isArray(t) && t.every(M7)); +function P7(t) { + return !!(typeof t == "function" && y0() || !t || typeof t == "string" && (t in iv || y0()) || Ub(t) || Array.isArray(t) && t.every(P7)); } const jf = ([t, e, r, n]) => `cubic-bezier(${t}, ${e}, ${r}, ${n})`, iv = { linear: "linear", @@ -32330,14 +32337,14 @@ const jf = ([t, e, r, n]) => `cubic-bezier(${t}, ${e}, ${r}, ${n})`, iv = { backIn: /* @__PURE__ */ jf([0.31, 0.01, 0.66, -0.59]), backOut: /* @__PURE__ */ jf([0.33, 1.53, 0.69, 0.99]) }; -function I7(t, e) { +function M7(t, e) { if (t) - return typeof t == "function" && y0() ? YQ(t, e) : qb(t) ? jf(t) : Array.isArray(t) ? t.map((r) => I7(r, e) || iv.easeOut) : iv[t]; + return typeof t == "function" && y0() ? YQ(t, e) : Ub(t) ? jf(t) : Array.isArray(t) ? t.map((r) => M7(r, e) || iv.easeOut) : iv[t]; } function ZQ(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatType: o = "loop", ease: a = "easeInOut", times: u } = {}) { const l = { [e]: r }; u && (l.offset = u); - const d = I7(a, i); + const d = M7(a, i); return Array.isArray(d) && (l.easing = d), t.animate(l, { delay: n, duration: i, @@ -32347,15 +32354,15 @@ function ZQ(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatTyp direction: o === "reverse" ? "alternate" : "normal" }); } -function l6(t, e) { +function f_(t, e) { t.timeline = e, t.onfinish = null; } -const QQ = /* @__PURE__ */ Hb(() => Object.hasOwnProperty.call(Element.prototype, "animate")), w0 = 10, eee = 2e4; +const QQ = /* @__PURE__ */ Wb(() => Object.hasOwnProperty.call(Element.prototype, "animate")), w0 = 10, eee = 2e4; function tee(t) { - return Ub(t.type) || t.type === "spring" || !M7(t.ease); + return jb(t.type) || t.type === "spring" || !P7(t.ease); } function ree(t, e) { - const r = new Wb({ + const r = new zb({ ...e, keyframes: t, repeat: 0, @@ -32374,31 +32381,31 @@ function ree(t, e) { ease: "linear" }; } -const C7 = { - anticipate: t7, - backInOut: e7, - circInOut: n7 +const I7 = { + anticipate: e7, + backInOut: QS, + circInOut: r7 }; function nee(t) { - return t in C7; + return t in I7; } -class h6 extends w7 { +class l_ extends y7 { constructor(e) { super(e); const { name: r, motionValue: n, element: i, keyframes: s } = this.options; - this.resolver = new y7(s, (o, a) => this.onKeyframesResolved(o, a), r, n, i), this.resolver.scheduleResolve(); + this.resolver = new b7(s, (o, a) => this.onKeyframesResolved(o, a), r, n, i), this.resolver.scheduleResolve(); } initPlayback(e, r) { var n; let { duration: i = 300, times: s, ease: o, type: a, motionValue: u, name: l, startTime: d } = this.options; if (!(!((n = u.owner) === null || n === void 0) && n.current)) return !1; - if (typeof o == "string" && y0() && nee(o) && (o = C7[o]), tee(this.options)) { - const { onComplete: w, onUpdate: A, motionValue: M, element: N, ...L } = this.options, $ = ree(e, L); - e = $.keyframes, e.length === 1 && (e[1] = e[0]), i = $.duration, s = $.times, o = $.ease, a = "keyframes"; + if (typeof o == "string" && y0() && nee(o) && (o = I7[o]), tee(this.options)) { + const { onComplete: w, onUpdate: A, motionValue: M, element: N, ...L } = this.options, B = ree(e, L); + e = B.keyframes, e.length === 1 && (e[1] = e[0]), i = B.duration, s = B.times, o = B.ease, a = "keyframes"; } const p = ZQ(u.owner.current, l, e, { ...this.options, duration: i, times: s, ease: o }); - return p.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (l6(p, this.pendingTimeline), this.pendingTimeline = void 0) : p.onfinish = () => { + return p.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (f_(p, this.pendingTimeline), this.pendingTimeline = void 0) : p.onfinish = () => { const { onComplete: w } = this.options; u.set(wp(e, this.options, r)), w && w(), this.cancel(), this.resolveFinishedPromise(); }, { @@ -32471,7 +32478,7 @@ class h6 extends w7 { if (!r) return Un; const { animation: n } = r; - l6(n, e); + f_(n, e); } return Un; } @@ -32502,7 +32509,7 @@ class h6 extends w7 { if (r.playState === "idle" || r.playState === "finished") return; if (this.time) { - const { motionValue: l, onUpdate: d, onComplete: p, element: w, ...A } = this.options, M = new Wb({ + const { motionValue: l, onUpdate: d, onComplete: p, element: w, ...A } = this.options, M = new zb({ ...A, keyframes: n, duration: i, @@ -32533,7 +32540,7 @@ class h6 extends w7 { !r.owner.getProps().onUpdate && !i && s !== "mirror" && o !== 0 && a !== "inertia"; } } -const iee = Hb(() => window.ScrollTimeline !== void 0); +const iee = Wb(() => window.ScrollTimeline !== void 0); class see { constructor(e) { this.stop = () => this.runAll("stop"), this.animations = e.filter(Boolean); @@ -32602,8 +32609,8 @@ class see { function oee({ when: t, delay: e, delayChildren: r, staggerChildren: n, staggerDirection: i, repeat: s, repeatType: o, repeatDelay: a, from: u, elapsed: l, ...d }) { return !!Object.keys(d).length; } -const Kb = (t, e, r, n = {}, i, s) => (o) => { - const a = Db(n, t) || {}, u = a.delay || n.delay || 0; +const Hb = (t, e, r, n = {}, i, s) => (o) => { + const a = Rb(n, t) || {}, u = a.delay || n.delay || 0; let { elapsed: l = 0 } = n; l = l - Vs(u); let d = { @@ -32634,21 +32641,21 @@ const Kb = (t, e, r, n = {}, i, s) => (o) => { d.onUpdate(w), d.onComplete(); }), new see([]); } - return !s && h6.supports(d) ? new h6(d) : new Wb(d); + return !s && l_.supports(d) ? new l_(d) : new zb(d); }, aee = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), cee = (t) => X1(t) ? t[t.length - 1] || 0 : t; -function Vb(t, e) { +function Kb(t, e) { t.indexOf(e) === -1 && t.push(e); } -function Gb(t, e) { +function Vb(t, e) { const r = t.indexOf(e); r > -1 && t.splice(r, 1); } -class Yb { +class Gb { constructor() { this.subscriptions = []; } add(e) { - return Vb(this.subscriptions, e), () => Gb(this.subscriptions, e); + return Kb(this.subscriptions, e), () => Vb(this.subscriptions, e); } notify(e, r, n) { const i = this.subscriptions.length; @@ -32668,7 +32675,7 @@ class Yb { this.subscriptions.length = 0; } } -const d6 = 30, uee = (t) => !isNaN(parseFloat(t)); +const h_ = 30, uee = (t) => !isNaN(parseFloat(t)); class fee { /** * @param init - The initiating value @@ -32734,7 +32741,7 @@ class fee { return process.env.NODE_ENV !== "production" && vp(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e); } on(e, r) { - this.events[e] || (this.events[e] = new Yb()); + this.events[e] || (this.events[e] = new Gb()); const n = this.events[e].add(r); return e === "change" ? () => { n(), Lr.read(() => { @@ -32807,10 +32814,10 @@ class fee { */ getVelocity() { const e = Ys.now(); - if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > d6) + if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > h_) return 0; - const r = Math.min(this.updatedAt - this.prevUpdatedAt, d6); - return x7(parseFloat(this.current) - parseFloat(this.prevFrameValue), r); + const r = Math.min(this.updatedAt - this.prevUpdatedAt, h_); + return w7(parseFloat(this.current) - parseFloat(this.prevFrameValue), r); } /** * Registers a new animation to control this `MotionValue`. Only one @@ -32878,9 +32885,9 @@ function hee(t, e) { lee(t, o, a); } } -const Jb = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), dee = "framerAppearId", T7 = "data-" + Jb(dee); -function R7(t) { - return t.props[T7]; +const Yb = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), dee = "framerAppearId", C7 = "data-" + Yb(dee); +function T7(t) { + return t.props[C7]; } const Xn = (t) => !!(t && t.getVelocity); function pee(t) { @@ -32895,7 +32902,7 @@ function gee({ protectedKeys: t, needsAnimating: e }, r) { const n = t.hasOwnProperty(r) && e[r] !== !0; return e[r] = !1, n; } -function D7(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { +function R7(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { var s; let { transition: o = t.getDefaultTransition(), transitionEnd: a, ...u } = e; n && (o = n); @@ -32906,17 +32913,17 @@ function D7(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { continue; const M = { delay: r, - ...Db(o || {}, p) + ...Rb(o || {}, p) }; let N = !1; if (window.MotionHandoffAnimation) { - const $ = R7(t); - if ($) { - const B = window.MotionHandoffAnimation($, p, Lr); - B !== null && (M.startTime = B, N = !0); + const B = T7(t); + if (B) { + const $ = window.MotionHandoffAnimation(B, p, Lr); + $ !== null && (M.startTime = $, N = !0); } } - sv(t, p), w.start(Kb(p, w, A, t.shouldReduceMotion && Ac.has(p) ? { type: !1 } : M, t, N)); + sv(t, p), w.start(Hb(p, w, A, t.shouldReduceMotion && Ac.has(p) ? { type: !1 } : M, t, N)); const L = w.animation; L && l.push(L); } @@ -32931,7 +32938,7 @@ function ov(t, e, r = {}) { const i = yp(t, e, r.type === "exit" ? (n = t.presenceContext) === null || n === void 0 ? void 0 : n.custom : void 0); let { transition: s = t.getDefaultTransition() || {} } = i || {}; r.transitionOverride && (s = r.transitionOverride); - const o = i ? () => Promise.all(D7(t, i, r)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (l = 0) => { + const o = i ? () => Promise.all(R7(t, i, r)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (l = 0) => { const { delayChildren: d = 0, staggerChildren: p, staggerDirection: w } = s; return mee(t, e, d + l, p, w, r); } : () => Promise.resolve(), { when: u } = s; @@ -32963,33 +32970,33 @@ function bee(t, e, r = {}) { n = ov(t, e, r); else { const i = typeof e == "function" ? yp(t, e, r.custom) : e; - n = Promise.all(D7(t, i, r)); + n = Promise.all(R7(t, i, r)); } return n.then(() => { t.notify("AnimationComplete", e); }); } -const yee = Rb.length; -function O7(t) { +const yee = Tb.length; +function D7(t) { if (!t) return; if (!t.isControllingVariants) { - const r = t.parent ? O7(t.parent) || {} : {}; + const r = t.parent ? D7(t.parent) || {} : {}; return t.props.initial !== void 0 && (r.initial = t.props.initial), r; } const e = {}; for (let r = 0; r < yee; r++) { - const n = Rb[r], i = t.props[n]; + const n = Tb[r], i = t.props[n]; (Il(i) || i === !1) && (e[n] = i); } return e; } -const wee = [...Tb].reverse(), xee = Tb.length; +const wee = [...Cb].reverse(), xee = Cb.length; function _ee(t) { return (e) => Promise.all(e.map(({ animation: r, options: n }) => bee(t, r, n))); } function Eee(t) { - let e = _ee(t), r = p6(), n = !0; + let e = _ee(t), r = d_(), n = !0; const i = (u) => (l, d) => { var p; const w = yp(t, d, u === "exit" ? (p = t.presenceContext) === null || p === void 0 ? void 0 : p.custom : void 0); @@ -33003,29 +33010,29 @@ function Eee(t) { e = u(t); } function o(u) { - const { props: l } = t, d = O7(t.parent) || {}, p = [], w = /* @__PURE__ */ new Set(); + const { props: l } = t, d = D7(t.parent) || {}, p = [], w = /* @__PURE__ */ new Set(); let A = {}, M = 1 / 0; for (let L = 0; L < xee; L++) { - const $ = wee[L], B = r[$], H = l[$] !== void 0 ? l[$] : d[$], U = Il(H), V = $ === u ? B.isActive : null; + const B = wee[L], $ = r[B], H = l[B] !== void 0 ? l[B] : d[B], U = Il(H), V = B === u ? $.isActive : null; V === !1 && (M = L); - let te = H === d[$] && H !== l[$] && U; - if (te && n && t.manuallyAnimateOnMount && (te = !1), B.protectedKeys = { ...A }, // If it isn't active and hasn't *just* been set as inactive - !B.isActive && V === null || // If we didn't and don't have any defined prop for this animation type - !H && !B.prevProp || // Or if the prop doesn't define an animation + let te = H === d[B] && H !== l[B] && U; + if (te && n && t.manuallyAnimateOnMount && (te = !1), $.protectedKeys = { ...A }, // If it isn't active and hasn't *just* been set as inactive + !$.isActive && V === null || // If we didn't and don't have any defined prop for this animation type + !H && !$.prevProp || // Or if the prop doesn't define an animation bp(H) || typeof H == "boolean") continue; - const R = See(B.prevProp, H); + const R = See($.prevProp, H); let K = R || // If we're making this variant active, we want to always make it active - $ === u && B.isActive && !te && U || // If we removed a higher-priority variant (i is in reverse order) + B === u && $.isActive && !te && U || // If we removed a higher-priority variant (i is in reverse order) L > M && U, ge = !1; const Ee = Array.isArray(H) ? H : [H]; - let Y = Ee.reduce(i($), {}); + let Y = Ee.reduce(i(B), {}); V === !1 && (Y = {}); - const { prevResolvedValues: S = {} } = B, m = { + const { prevResolvedValues: S = {} } = $, m = { ...S, ...Y }, f = (x) => { - K = !0, w.has(x) && (ge = !0, w.delete(x)), B.needsAnimating[x] = !0; + K = !0, w.has(x) && (ge = !0, w.delete(x)), $.needsAnimating[x] = !0; const _ = t.getValue(x); _ && (_.liveStyle = !1); }; @@ -33034,18 +33041,18 @@ function Eee(t) { if (A.hasOwnProperty(x)) continue; let v = !1; - X1(_) && X1(E) ? v = !GS(_, E) : v = _ !== E, v ? _ != null ? f(x) : w.add(x) : _ !== void 0 && w.has(x) ? f(x) : B.protectedKeys[x] = !0; + X1(_) && X1(E) ? v = !VS(_, E) : v = _ !== E, v ? _ != null ? f(x) : w.add(x) : _ !== void 0 && w.has(x) ? f(x) : $.protectedKeys[x] = !0; } - B.prevProp = H, B.prevResolvedValues = Y, B.isActive && (A = { ...A, ...Y }), n && t.blockInitialAnimation && (K = !1), K && (!(te && R) || ge) && p.push(...Ee.map((x) => ({ + $.prevProp = H, $.prevResolvedValues = Y, $.isActive && (A = { ...A, ...Y }), n && t.blockInitialAnimation && (K = !1), K && (!(te && R) || ge) && p.push(...Ee.map((x) => ({ animation: x, - options: { type: $ } + options: { type: B } }))); } if (w.size) { const L = {}; - w.forEach(($) => { - const B = t.getBaseTarget($), H = t.getValue($); - H && (H.liveStyle = !0), L[$] = B ?? null; + w.forEach((B) => { + const $ = t.getBaseTarget(B), H = t.getValue(B); + H && (H.liveStyle = !0), L[B] = $ ?? null; }), p.push({ animation: L }); } let N = !!p.length; @@ -33070,12 +33077,12 @@ function Eee(t) { setAnimateFunction: s, getState: () => r, reset: () => { - r = p6(), n = !0; + r = d_(), n = !0; } }; } function See(t, e) { - return typeof e == "string" ? e !== t : Array.isArray(e) ? !GS(e, t) : !1; + return typeof e == "string" ? e !== t : Array.isArray(e) ? !VS(e, t) : !1; } function Va(t = !1) { return { @@ -33085,7 +33092,7 @@ function Va(t = !1) { prevResolvedValues: {} }; } -function p6() { +function d_() { return { animate: Va(!0), whileInView: Va(), @@ -33159,7 +33166,7 @@ const Iee = { exit: { Feature: Mee } -}, N7 = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1; +}, O7 = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1; function xp(t, e = "page") { return { point: { @@ -33168,19 +33175,19 @@ function xp(t, e = "page") { } }; } -const Cee = (t) => (e) => N7(e) && t(e, xp(e)); +const Cee = (t) => (e) => O7(e) && t(e, xp(e)); function Mo(t, e, r, n = { passive: !0 }) { return t.addEventListener(e, r, n), () => t.removeEventListener(e, r); } function Do(t, e, r, n) { return Mo(t, e, Cee(r), n); } -const g6 = (t, e) => Math.abs(t - e); +const p_ = (t, e) => Math.abs(t - e); function Tee(t, e) { - const r = g6(t.x, e.x), n = g6(t.y, e.y); + const r = p_(t.x, e.x), n = p_(t.y, e.y); return Math.sqrt(r ** 2 + n ** 2); } -class L7 { +class N7 { constructor(e, r, { transformPagePoint: n, contextWindow: i, dragSnapToOrigin: s = !1 } = {}) { if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.updatePoint = () => { if (!(this.lastMoveEvent && this.lastMoveEventInfo)) @@ -33190,8 +33197,8 @@ class L7 { return; const { point: M } = p, { timestamp: N } = Fn; this.history.push({ ...M, timestamp: N }); - const { onStart: L, onMove: $ } = this.handlers; - w || (L && L(this.lastMoveEvent, p), this.startEvent = this.lastMoveEvent), $ && $(this.lastMoveEvent, p); + const { onStart: L, onMove: B } = this.handlers; + w || (L && L(this.lastMoveEvent, p), this.startEvent = this.lastMoveEvent), B && B(this.lastMoveEvent, p); }, this.handlePointerMove = (p, w) => { this.lastMoveEvent = p, this.lastMoveEventInfo = $m(w, this.transformPagePoint), Lr.update(this.updatePoint, !0); }, this.handlePointerUp = (p, w) => { @@ -33201,7 +33208,7 @@ class L7 { return; const L = Bm(p.type === "pointercancel" ? this.lastMoveEventInfo : $m(w, this.transformPagePoint), this.history); this.startEvent && A && A(p, L), M && M(p, L); - }, !N7(e)) + }, !O7(e)) return; this.dragSnapToOrigin = s, this.handlers = r, this.transformPagePoint = n, this.contextWindow = i || window; const o = xp(e), a = $m(o, this.transformPagePoint), { point: u } = a, { timestamp: l } = Fn; @@ -33219,28 +33226,28 @@ class L7 { function $m(t, e) { return e ? { point: e(t.point) } : t; } -function m6(t, e) { +function g_(t, e) { return { x: t.x - e.x, y: t.y - e.y }; } function Bm({ point: t }, e) { return { point: t, - delta: m6(t, k7(e)), - offset: m6(t, Ree(e)), + delta: g_(t, L7(e)), + offset: g_(t, Ree(e)), velocity: Dee(e, 0.1) }; } function Ree(t) { return t[0]; } -function k7(t) { +function L7(t) { return t[t.length - 1]; } function Dee(t, e) { if (t.length < 2) return { x: 0, y: 0 }; let r = t.length - 1, n = null; - const i = k7(t); + const i = L7(t); for (; r >= 0 && (n = t[r], !(i.timestamp - n.timestamp > Vs(e))); ) r--; if (!n) @@ -33254,7 +33261,7 @@ function Dee(t, e) { }; return o.x === 1 / 0 && (o.x = 0), o.y === 1 / 0 && (o.y = 0), o; } -function $7(t) { +function k7(t) { let e = null; return () => { const r = () => { @@ -33263,57 +33270,57 @@ function $7(t) { return e === null ? (e = t, r) : !1; }; } -const v6 = $7("dragHorizontal"), b6 = $7("dragVertical"); -function B7(t) { +const m_ = k7("dragHorizontal"), v_ = k7("dragVertical"); +function $7(t) { let e = !1; if (t === "y") - e = b6(); + e = v_(); else if (t === "x") - e = v6(); + e = m_(); else { - const r = v6(), n = b6(); + const r = m_(), n = v_(); r && n ? e = () => { r(), n(); } : (r && r(), n && n()); } return e; } -function F7() { - const t = B7(!0); +function B7() { + const t = $7(!0); return t ? (t(), !1) : !0; } function tu(t) { return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current"); } -const j7 = 1e-4, Oee = 1 - j7, Nee = 1 + j7, U7 = 0.01, Lee = 0 - U7, kee = 0 + U7; +const F7 = 1e-4, Oee = 1 - F7, Nee = 1 + F7, j7 = 0.01, Lee = 0 - j7, kee = 0 + j7; function Li(t) { return t.max - t.min; } function $ee(t, e, r) { return Math.abs(t - e) <= r; } -function y6(t, e, r, n = 0.5) { +function b_(t, e, r, n = 0.5) { t.origin = n, t.originPoint = Qr(e.min, e.max, t.origin), t.scale = Li(r) / Li(e), t.translate = Qr(r.min, r.max, t.origin) - t.originPoint, (t.scale >= Oee && t.scale <= Nee || isNaN(t.scale)) && (t.scale = 1), (t.translate >= Lee && t.translate <= kee || isNaN(t.translate)) && (t.translate = 0); } function Jf(t, e, r, n) { - y6(t.x, e.x, r.x, n ? n.originX : void 0), y6(t.y, e.y, r.y, n ? n.originY : void 0); + b_(t.x, e.x, r.x, n ? n.originX : void 0), b_(t.y, e.y, r.y, n ? n.originY : void 0); } -function w6(t, e, r) { +function y_(t, e, r) { t.min = r.min + e.min, t.max = t.min + Li(e); } function Bee(t, e, r) { - w6(t.x, e.x, r.x), w6(t.y, e.y, r.y); + y_(t.x, e.x, r.x), y_(t.y, e.y, r.y); } -function x6(t, e, r) { +function w_(t, e, r) { t.min = e.min - r.min, t.max = t.min + Li(e); } function Xf(t, e, r) { - x6(t.x, e.x, r.x), x6(t.y, e.y, r.y); + w_(t.x, e.x, r.x), w_(t.y, e.y, r.y); } function Fee(t, { min: e, max: r }, n) { return e !== void 0 && t < e ? t = n ? Qr(e, t, n.min) : Math.max(t, e) : r !== void 0 && t > r && (t = n ? Qr(r, t, n.max) : Math.min(t, r)), t; } -function _6(t, e, r) { +function x_(t, e, r) { return { min: e !== void 0 ? t.min + e : void 0, max: r !== void 0 ? t.max + r - (t.max - t.min) : void 0 @@ -33321,18 +33328,18 @@ function _6(t, e, r) { } function jee(t, { top: e, left: r, bottom: n, right: i }) { return { - x: _6(t.x, r, i), - y: _6(t.y, e, n) + x: x_(t.x, r, i), + y: x_(t.y, e, n) }; } -function E6(t, e) { +function __(t, e) { let r = e.min - t.min, n = e.max - t.max; return e.max - e.min < t.max - t.min && ([r, n] = [n, r]), { min: r, max: n }; } function Uee(t, e) { return { - x: E6(t.x, e.x), - y: E6(t.y, e.y) + x: __(t.x, e.x), + y: __(t.y, e.y) }; } function qee(t, e) { @@ -33347,35 +33354,35 @@ function zee(t, e) { const av = 0.35; function Wee(t = av) { return t === !1 ? t = 0 : t === !0 && (t = av), { - x: S6(t, "left", "right"), - y: S6(t, "top", "bottom") + x: E_(t, "left", "right"), + y: E_(t, "top", "bottom") }; } -function S6(t, e, r) { +function E_(t, e, r) { return { - min: A6(t, e), - max: A6(t, r) + min: S_(t, e), + max: S_(t, r) }; } -function A6(t, e) { +function S_(t, e) { return typeof t == "number" ? t : t[e] || 0; } -const P6 = () => ({ +const A_ = () => ({ translate: 0, scale: 1, origin: 0, originPoint: 0 }), ru = () => ({ - x: P6(), - y: P6() -}), M6 = () => ({ min: 0, max: 0 }), ln = () => ({ - x: M6(), - y: M6() + x: A_(), + y: A_() +}), P_ = () => ({ min: 0, max: 0 }), ln = () => ({ + x: P_(), + y: P_() }); function Xi(t) { return [t("x"), t("y")]; } -function q7({ top: t, left: e, right: r, bottom: n }) { +function U7({ top: t, left: e, right: r, bottom: n }) { return { x: { min: e, max: r }, y: { min: t, max: n } @@ -33402,28 +33409,28 @@ function cv({ scale: t, scaleX: e, scaleY: r }) { return !Fm(t) || !Fm(e) || !Fm(r); } function Ya(t) { - return cv(t) || z7(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY; + return cv(t) || q7(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY; } -function z7(t) { - return I6(t.x) || I6(t.y); +function q7(t) { + return M_(t.x) || M_(t.y); } -function I6(t) { +function M_(t) { return t && t !== "0%"; } function x0(t, e, r) { const n = t - r, i = e * n; return r + i; } -function C6(t, e, r, n, i) { +function I_(t, e, r, n, i) { return i !== void 0 && (t = x0(t, i, n)), x0(t, r, n) + e; } function uv(t, e = 0, r = 1, n, i) { - t.min = C6(t.min, e, r, n, i), t.max = C6(t.max, e, r, n, i); + t.min = I_(t.min, e, r, n, i), t.max = I_(t.max, e, r, n, i); } -function W7(t, { x: e, y: r }) { +function z7(t, { x: e, y: r }) { uv(t.x, e.translate, e.scale, e.originPoint), uv(t.y, r.translate, r.scale, r.originPoint); } -const T6 = 0.999999999999, R6 = 1.0000000000001; +const C_ = 0.999999999999, T_ = 1.0000000000001; function Vee(t, e, r, n = !1) { const i = r.length; if (!i) @@ -33436,28 +33443,28 @@ function Vee(t, e, r, n = !1) { u && u.props.style && u.props.style.display === "contents" || (n && s.options.layoutScroll && s.scroll && s !== s.root && iu(t, { x: -s.scroll.offset.x, y: -s.scroll.offset.y - }), o && (e.x *= o.x.scale, e.y *= o.y.scale, W7(t, o)), n && Ya(s.latestValues) && iu(t, s.latestValues)); + }), o && (e.x *= o.x.scale, e.y *= o.y.scale, z7(t, o)), n && Ya(s.latestValues) && iu(t, s.latestValues)); } - e.x < R6 && e.x > T6 && (e.x = 1), e.y < R6 && e.y > T6 && (e.y = 1); + e.x < T_ && e.x > C_ && (e.x = 1), e.y < T_ && e.y > C_ && (e.y = 1); } function nu(t, e) { t.min = t.min + e, t.max = t.max + e; } -function D6(t, e, r, n, i = 0.5) { +function R_(t, e, r, n, i = 0.5) { const s = Qr(t.min, t.max, i); uv(t, e, r, s, n); } function iu(t, e) { - D6(t.x, e.x, e.scaleX, e.scale, e.originX), D6(t.y, e.y, e.scaleY, e.scale, e.originY); + R_(t.x, e.x, e.scaleX, e.scale, e.originX), R_(t.y, e.y, e.scaleY, e.scale, e.originY); } -function H7(t, e) { - return q7(Kee(t.getBoundingClientRect(), e)); +function W7(t, e) { + return U7(Kee(t.getBoundingClientRect(), e)); } function Gee(t, e, r) { - const n = H7(t, r), { scroll: i } = e; + const n = W7(t, r), { scroll: i } = e; return i && (nu(n.x, i.offset.x), nu(n.y, i.offset.y)), n; } -const K7 = ({ current: t }) => t ? t.ownerDocument.defaultView : null, Yee = /* @__PURE__ */ new WeakMap(); +const H7 = ({ current: t }) => t ? t.ownerDocument.defaultView : null, Yee = /* @__PURE__ */ new WeakMap(); class Jee { constructor(e) { this.openGlobalLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = ln(), this.visualElement = e; @@ -33471,18 +33478,18 @@ class Jee { p ? this.pauseAnimation() : this.stopAnimation(), r && this.snapToCursor(xp(d, "page").point); }, s = (d, p) => { const { drag: w, dragPropagation: A, onDragStart: M } = this.getProps(); - if (w && !A && (this.openGlobalLock && this.openGlobalLock(), this.openGlobalLock = B7(w), !this.openGlobalLock)) + if (w && !A && (this.openGlobalLock && this.openGlobalLock(), this.openGlobalLock = $7(w), !this.openGlobalLock)) return; this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), Xi((L) => { - let $ = this.getAxisMotionValue(L).get() || 0; - if (Gs.test($)) { - const { projection: B } = this.visualElement; - if (B && B.layout) { - const H = B.layout.layoutBox[L]; - H && ($ = Li(H) * (parseFloat($) / 100)); + let B = this.getAxisMotionValue(L).get() || 0; + if (Gs.test(B)) { + const { projection: $ } = this.visualElement; + if ($ && $.layout) { + const H = $.layout.layoutBox[L]; + H && (B = Li(H) * (parseFloat(B) / 100)); } } - this.originPoint[L] = $; + this.originPoint[L] = B; }), M && Lr.postRender(() => M(d, p)), sv(this.visualElement, "transform"); const { animationState: N } = this.visualElement; N && N.setActive("whileDrag", !0); @@ -33500,7 +33507,7 @@ class Jee { var p; return this.getAnimationState(d) === "paused" && ((p = this.getAxisMotionValue(d).animation) === null || p === void 0 ? void 0 : p.play()); }), { dragSnapToOrigin: l } = this.getProps(); - this.panSession = new L7(e, { + this.panSession = new N7(e, { onSessionStart: i, onStart: s, onMove: o, @@ -33509,7 +33516,7 @@ class Jee { }, { transformPagePoint: this.visualElement.getTransformPagePoint(), dragSnapToOrigin: l, - contextWindow: K7(this.visualElement) + contextWindow: H7(this.visualElement) }); } stop(e, r) { @@ -33556,7 +33563,7 @@ class Jee { let o = Uee(i.layout.layoutBox, s); if (r) { const a = r(Hee(o)); - this.hasMutatedConstraints = !!a, a && (o = q7(a)); + this.hasMutatedConstraints = !!a, a && (o = U7(a)); } return o; } @@ -33583,7 +33590,7 @@ class Jee { } startAxisValueAnimation(e, r) { const n = this.getAxisMotionValue(e); - return sv(this.visualElement, e), n.start(Kb(e, n, 0, r, this.visualElement, !1)); + return sv(this.visualElement, e), n.start(Hb(e, n, 0, r, this.visualElement, !1)); } stopAnimation() { Xi((e) => this.getAxisMotionValue(e).stop()); @@ -33702,7 +33709,7 @@ class Zee extends Ra { this.removeGroupControls(), this.removeListeners(); } } -const O6 = (t) => (e, r) => { +const D_ = (t) => (e, r) => { t && Lr.postRender(() => t(e, r)); }; class Qee extends Ra { @@ -33710,16 +33717,16 @@ class Qee extends Ra { super(...arguments), this.removePointerDownListener = Un; } onPointerDown(e) { - this.session = new L7(e, this.createPanHandlers(), { + this.session = new N7(e, this.createPanHandlers(), { transformPagePoint: this.node.getTransformPagePoint(), - contextWindow: K7(this.node) + contextWindow: H7(this.node) }); } createPanHandlers() { const { onPanSessionStart: e, onPanStart: r, onPan: n, onPanEnd: i } = this.node.getProps(); return { - onSessionStart: O6(e), - onStart: O6(r), + onSessionStart: D_(e), + onStart: D_(r), onMove: n, onEnd: (s, o) => { delete this.session, i && Lr.postRender(() => i(s, o)); @@ -33741,12 +33748,12 @@ function ete() { const t = Tn(_p); if (t === null) return [!0, null]; - const { isPresent: e, onExitComplete: r, register: n } = t, i = bv(); + const { isPresent: e, onExitComplete: r, register: n } = t, i = vv(); Dn(() => n(i), []); - const s = yv(() => r && r(i), [i, r]); + const s = bv(() => r && r(i), [i, r]); return !e && r ? [!1, s] : [!0]; } -const Xb = Sa({}), V7 = Sa({}), jd = { +const Jb = Sa({}), K7 = Sa({}), jd = { /** * Global flag as to whether the tree has animated since the last time * we resized the window @@ -33758,7 +33765,7 @@ const Xb = Sa({}), V7 = Sa({}), jd = { */ hasEverUpdated: !1 }; -function N6(t, e) { +function O_(t, e) { return e.max === e.min ? 0 : t / (e.max - e.min) * 100; } const Of = { @@ -33770,7 +33777,7 @@ const Of = { t = parseFloat(t); else return t; - const r = N6(t, e.target.x), n = N6(t, e.target.y); + const r = O_(t, e.target.x), n = O_(t, e.target.y); return `${r}% ${n}%`; } }, tte = { @@ -33787,7 +33794,7 @@ const Of = { function rte(t) { Object.assign(_0, t); } -const { schedule: Zb } = YS(queueMicrotask, !1); +const { schedule: Xb } = GS(queueMicrotask, !1); class nte extends kR { /** * This only mounts projection nodes for components that @@ -33812,7 +33819,7 @@ class nte extends kR { } componentDidUpdate() { const { projection: e } = this.props.visualElement; - e && (e.root.didUpdate(), Zb.postRender(() => { + e && (e.root.didUpdate(), Xb.postRender(() => { !e.currentAnimation && e.isLead() && this.safeToRemove(); })); } @@ -33828,9 +33835,9 @@ class nte extends kR { return null; } } -function G7(t) { - const [e, r] = ete(), n = Tn(Xb); - return pe.jsx(nte, { ...t, layoutGroup: n, switchLayoutGroup: Tn(V7), isPresent: e, safeToRemove: r }); +function V7(t) { + const [e, r] = ete(), n = Tn(Jb); + return le.jsx(nte, { ...t, layoutGroup: n, switchLayoutGroup: Tn(K7), isPresent: e, safeToRemove: r }); } const ite = { borderRadius: { @@ -33847,7 +33854,7 @@ const ite = { borderBottomLeftRadius: Of, borderBottomRightRadius: Of, boxShadow: tte -}, Y7 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], ste = Y7.length, L6 = (t) => typeof t == "string" ? parseFloat(t) : t, k6 = (t) => typeof t == "number" || Vt.test(t); +}, G7 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], ste = G7.length, N_ = (t) => typeof t == "string" ? parseFloat(t) : t, L_ = (t) => typeof t == "number" || Vt.test(t); function ote(t, e, r, n, i, s) { i ? (t.opacity = Qr( 0, @@ -33856,68 +33863,68 @@ function ote(t, e, r, n, i, s) { ate(n) ), t.opacityExit = Qr(e.opacity !== void 0 ? e.opacity : 1, 0, cte(n))) : s && (t.opacity = Qr(e.opacity !== void 0 ? e.opacity : 1, r.opacity !== void 0 ? r.opacity : 1, n)); for (let o = 0; o < ste; o++) { - const a = `border${Y7[o]}Radius`; - let u = $6(e, a), l = $6(r, a); + const a = `border${G7[o]}Radius`; + let u = k_(e, a), l = k_(r, a); if (u === void 0 && l === void 0) continue; - u || (u = 0), l || (l = 0), u === 0 || l === 0 || k6(u) === k6(l) ? (t[a] = Math.max(Qr(L6(u), L6(l), n), 0), (Gs.test(l) || Gs.test(u)) && (t[a] += "%")) : t[a] = l; + u || (u = 0), l || (l = 0), u === 0 || l === 0 || L_(u) === L_(l) ? (t[a] = Math.max(Qr(N_(u), N_(l), n), 0), (Gs.test(l) || Gs.test(u)) && (t[a] += "%")) : t[a] = l; } (e.rotate || r.rotate) && (t.rotate = Qr(e.rotate || 0, r.rotate || 0, n)); } -function $6(t, e) { +function k_(t, e) { return t[e] !== void 0 ? t[e] : t.borderRadius; } -const ate = /* @__PURE__ */ J7(0, 0.5, r7), cte = /* @__PURE__ */ J7(0.5, 0.95, Un); -function J7(t, e, r) { +const ate = /* @__PURE__ */ Y7(0, 0.5, t7), cte = /* @__PURE__ */ Y7(0.5, 0.95, Un); +function Y7(t, e, r) { return (n) => n < t ? 0 : n > e ? 1 : r(Iu(t, e, n)); } -function B6(t, e) { +function $_(t, e) { t.min = e.min, t.max = e.max; } function Yi(t, e) { - B6(t.x, e.x), B6(t.y, e.y); + $_(t.x, e.x), $_(t.y, e.y); } -function F6(t, e) { +function B_(t, e) { t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin; } -function j6(t, e, r, n, i) { +function F_(t, e, r, n, i) { return t -= e, t = x0(t, 1 / r, n), i !== void 0 && (t = x0(t, 1 / i, n)), t; } function ute(t, e = 0, r = 1, n = 0.5, i, s = t, o = t) { if (Gs.test(e) && (e = parseFloat(e), e = Qr(o.min, o.max, e / 100) - o.min), typeof e != "number") return; let a = Qr(s.min, s.max, n); - t === s && (a -= e), t.min = j6(t.min, e, r, a, i), t.max = j6(t.max, e, r, a, i); + t === s && (a -= e), t.min = F_(t.min, e, r, a, i), t.max = F_(t.max, e, r, a, i); } -function U6(t, e, [r, n, i], s, o) { +function j_(t, e, [r, n, i], s, o) { ute(t, e[r], e[n], e[i], e.scale, s, o); } const fte = ["x", "scaleX", "originX"], lte = ["y", "scaleY", "originY"]; -function q6(t, e, r, n) { - U6(t.x, e, fte, r ? r.x : void 0, n ? n.x : void 0), U6(t.y, e, lte, r ? r.y : void 0, n ? n.y : void 0); +function U_(t, e, r, n) { + j_(t.x, e, fte, r ? r.x : void 0, n ? n.x : void 0), j_(t.y, e, lte, r ? r.y : void 0, n ? n.y : void 0); } -function z6(t) { +function q_(t) { return t.translate === 0 && t.scale === 1; } -function X7(t) { - return z6(t.x) && z6(t.y); +function J7(t) { + return q_(t.x) && q_(t.y); } -function W6(t, e) { +function z_(t, e) { return t.min === e.min && t.max === e.max; } function hte(t, e) { - return W6(t.x, e.x) && W6(t.y, e.y); + return z_(t.x, e.x) && z_(t.y, e.y); } -function H6(t, e) { +function W_(t, e) { return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max); } -function Z7(t, e) { - return H6(t.x, e.x) && H6(t.y, e.y); +function X7(t, e) { + return W_(t.x, e.x) && W_(t.y, e.y); } -function K6(t) { +function H_(t) { return Li(t.x) / Li(t.y); } -function V6(t, e) { +function K_(t, e) { return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint; } class dte { @@ -33925,10 +33932,10 @@ class dte { this.members = []; } add(e) { - Vb(this.members, e), e.scheduleRender(); + Kb(this.members, e), e.scheduleRender(); } remove(e) { - if (Gb(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) { + if (Vb(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) { const r = this.members[this.members.length - 1]; r && this.promote(r); } @@ -33990,10 +33997,10 @@ class mte { this.children = [], this.isDirty = !1; } add(e) { - Vb(this.children, e), this.isDirty = !0; + Kb(this.children, e), this.isDirty = !0; } remove(e) { - Gb(this.children, e), this.isDirty = !0; + Vb(this.children, e), this.isDirty = !0; } forEach(e) { this.isDirty && this.children.sort(gte), this.isDirty = !1, this.children.forEach(e); @@ -34015,34 +34022,34 @@ function bte(t) { } function yte(t, e, r) { const n = Xn(t) ? t : Rl(t); - return n.start(Kb("", n, e, r)), n.animation; + return n.start(Hb("", n, e, r)), n.animation; } const Ja = { type: "projectionFrame", totalNodes: 0, resolvedTargetDeltas: 0, recalculatedProjection: 0 -}, Uf = typeof window < "u" && window.MotionDebug !== void 0, jm = ["", "X", "Y", "Z"], wte = { visibility: "hidden" }, G6 = 1e3; +}, Uf = typeof window < "u" && window.MotionDebug !== void 0, jm = ["", "X", "Y", "Z"], wte = { visibility: "hidden" }, V_ = 1e3; let xte = 0; function Um(t, e, r, n) { const { latestValues: i } = e; i[t] && (r[t] = i[t], e.setStaticValue(t, 0), n && (n[t] = 0)); } -function Q7(t) { +function Z7(t) { if (t.hasCheckedOptimisedAppear = !0, t.root === t) return; const { visualElement: e } = t.options; if (!e) return; - const r = R7(e); + const r = T7(e); if (window.MotionHasOptimisedAnimation(r, "transform")) { const { layout: i, layoutId: s } = t.options; window.MotionCancelOptimisedAnimation(r, "transform", Lr, !(i || s)); } const { parent: n } = t; - n && !n.hasCheckedOptimisedAppear && Q7(n); + n && !n.hasCheckedOptimisedAppear && Z7(n); } -function e9({ attachResizeListener: t, defaultParent: e, measureScroll: r, checkIsScrollRoot: n, resetTransform: i }) { +function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, checkIsScrollRoot: n, resetTransform: i }) { return class { constructor(o = {}, a = e == null ? void 0 : e()) { this.id = xte++, this.animationId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => { @@ -34055,7 +34062,7 @@ function e9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.root === this && (this.nodes = new mte()); } addEventListener(o, a) { - return this.eventHandlers.has(o) || this.eventHandlers.set(o, new Yb()), this.eventHandlers.get(o).add(a); + return this.eventHandlers.has(o) || this.eventHandlers.set(o, new Gb()), this.eventHandlers.get(o).add(a); } notifyListeners(o, ...a) { const u = this.eventHandlers.get(o); @@ -34076,7 +34083,7 @@ function e9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check let p; const w = () => this.root.updateBlockedByResize = !1; t(o, () => { - this.root.updateBlockedByResize = !0, p && p(), p = vte(w, 250), jd.hasAnimatedSinceResize && (jd.hasAnimatedSinceResize = !1, this.nodes.forEach(J6)); + this.root.updateBlockedByResize = !0, p && p(), p = vte(w, 250), jd.hasAnimatedSinceResize && (jd.hasAnimatedSinceResize = !1, this.nodes.forEach(Y_)); }); } u && this.root.registerSharedNode(u, this), this.options.animate !== !1 && d && (u || l) && this.addEventListener("didUpdate", ({ delta: p, hasLayoutChanged: w, hasRelativeTargetChanged: A, layout: M }) => { @@ -34084,17 +34091,17 @@ function e9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.target = void 0, this.relativeTarget = void 0; return; } - const N = this.options.transition || d.getDefaultTransition() || Lte, { onLayoutAnimationStart: L, onLayoutAnimationComplete: $ } = d.getProps(), B = !this.targetLayout || !Z7(this.targetLayout, M) || A, H = !w && A; - if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || H || w && (B || !this.currentAnimation)) { + const N = this.options.transition || d.getDefaultTransition() || Lte, { onLayoutAnimationStart: L, onLayoutAnimationComplete: B } = d.getProps(), $ = !this.targetLayout || !X7(this.targetLayout, M) || A, H = !w && A; + if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || H || w && ($ || !this.currentAnimation)) { this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0), this.setAnimationOrigin(p, H); const U = { - ...Db(N, "layout"), + ...Rb(N, "layout"), onPlay: L, - onComplete: $ + onComplete: B }; (d.shouldReduceMotion || this.options.layoutRoot) && (U.delay = 0, U.type = !1), this.startAnimation(U); } else - w || J6(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete(); + w || Y_(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete(); this.targetLayout = M; }); } @@ -34129,7 +34136,7 @@ function e9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.options.onExitComplete && this.options.onExitComplete(); return; } - if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && Q7(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty) + if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && Z7(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty) return; this.isLayoutDirty = !0; for (let d = 0; d < this.path.length; d++) { @@ -34144,7 +34151,7 @@ function e9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check } update() { if (this.updateScheduled = !1, this.isUpdateBlocked()) { - this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(Y6); + this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(G_); return; } this.isUpdating || this.nodes.forEach(Mte), this.isUpdating = !1, this.nodes.forEach(Ite), this.nodes.forEach(_te), this.nodes.forEach(Ete), this.clearAllSnapshots(); @@ -34152,7 +34159,7 @@ function e9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check Fn.delta = xa(0, 1e3 / 60, a - Fn.timestamp), Fn.timestamp = a, Fn.isProcessing = !0, Dm.update.process(Fn), Dm.preRender.process(Fn), Dm.render.process(Fn), Fn.isProcessing = !1; } didUpdate() { - this.updateScheduled || (this.updateScheduled = !0, Zb.read(this.scheduleUpdate)); + this.updateScheduled || (this.updateScheduled = !0, Xb.read(this.scheduleUpdate)); } clearAllSnapshots() { this.nodes.forEach(Pte), this.sharedNodes.forEach(Dte); @@ -34198,7 +34205,7 @@ function e9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check resetTransform() { if (!i) return; - const o = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, a = this.projectionDelta && !X7(this.projectionDelta), u = this.getTransformTemplate(), l = u ? u(this.latestValues, "") : void 0, d = l !== this.prevTransformTemplateValue; + const o = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, a = this.projectionDelta && !J7(this.projectionDelta), u = this.getTransformTemplate(), l = u ? u(this.latestValues, "") : void 0, d = l !== this.prevTransformTemplateValue; o && (a || Ya(this.latestValues) || d) && (i(this.instance, l), this.shouldResetTransform = !1, this.scheduleRender()); } measure(o = !0) { @@ -34256,9 +34263,9 @@ function e9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check continue; cv(l.latestValues) && l.updateSnapshot(); const d = ln(), p = l.measurePageBox(); - Yi(d, p), q6(a, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, d); + Yi(d, p), U_(a, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, d); } - return Ya(this.latestValues) && q6(a, this.latestValues), a; + return Ya(this.latestValues) && U_(a, this.latestValues), a; } setTargetDelta(o) { this.targetDelta = o, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0; @@ -34290,7 +34297,7 @@ function e9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check A && A.layout && this.animationProgress !== 1 ? (this.relativeParent = A, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), Xf(this.relativeTargetOrigin, this.layout.layoutBox, A.layout.layoutBox), Yi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; } if (!(!this.relativeTarget && !this.targetDelta)) { - if (this.target || (this.target = ln(), this.targetWithTransforms = ln()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), Bee(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : Yi(this.target, this.layout.layoutBox), W7(this.target, this.targetDelta)) : Yi(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget) { + if (this.target || (this.target = ln(), this.targetWithTransforms = ln()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), Bee(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : Yi(this.target, this.layout.layoutBox), z7(this.target, this.targetDelta)) : Yi(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget) { this.attemptToResolveRelativeTarget = !1; const A = this.getClosestProjectingParent(); A && !!A.resumingFrom == !!this.resumingFrom && !A.options.layoutScroll && A.target && this.animationProgress !== 1 ? (this.relativeParent = A, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), Xf(this.relativeTargetOrigin, this.target, A.target), Yi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; @@ -34300,7 +34307,7 @@ function e9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check } } getClosestProjectingParent() { - if (!(!this.parent || cv(this.parent.latestValues) || z7(this.parent.latestValues))) + if (!(!this.parent || cv(this.parent.latestValues) || q7(this.parent.latestValues))) return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent(); } isProjecting() { @@ -34323,7 +34330,7 @@ function e9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender()); return; } - !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (F6(this.prevProjectionDelta.x, this.projectionDelta.x), F6(this.prevProjectionDelta.y, this.projectionDelta.y)), Jf(this.projectionDelta, this.layoutCorrected, M, this.latestValues), (this.treeScale.x !== w || this.treeScale.y !== A || !V6(this.projectionDelta.x, this.prevProjectionDelta.x) || !V6(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", M)), Uf && Ja.recalculatedProjection++; + !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (B_(this.prevProjectionDelta.x, this.projectionDelta.x), B_(this.prevProjectionDelta.y, this.projectionDelta.y)), Jf(this.projectionDelta, this.layoutCorrected, M, this.latestValues), (this.treeScale.x !== w || this.treeScale.y !== A || !K_(this.projectionDelta.x, this.prevProjectionDelta.x) || !K_(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", M)), Uf && Ja.recalculatedProjection++; } hide() { this.isVisible = !1; @@ -34345,17 +34352,17 @@ function e9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check setAnimationOrigin(o, a = !1) { const u = this.snapshot, l = u ? u.latestValues : {}, d = { ...this.latestValues }, p = ru(); (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !a; - const w = ln(), A = u ? u.source : void 0, M = this.layout ? this.layout.source : void 0, N = A !== M, L = this.getStack(), $ = !L || L.members.length <= 1, B = !!(N && !$ && this.options.crossfade === !0 && !this.path.some(Nte)); + const w = ln(), A = u ? u.source : void 0, M = this.layout ? this.layout.source : void 0, N = A !== M, L = this.getStack(), B = !L || L.members.length <= 1, $ = !!(N && !B && this.options.crossfade === !0 && !this.path.some(Nte)); this.animationProgress = 0; let H; this.mixTargetDelta = (U) => { const V = U / 1e3; - X6(p.x, o.x, V), X6(p.y, o.y, V), this.setTargetDelta(p), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Xf(w, this.layout.layoutBox, this.relativeParent.layout.layoutBox), Ote(this.relativeTarget, this.relativeTargetOrigin, w, V), H && hte(this.relativeTarget, H) && (this.isProjectionDirty = !1), H || (H = ln()), Yi(H, this.relativeTarget)), N && (this.animationValues = d, ote(d, l, this.latestValues, V, B, $)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V; + J_(p.x, o.x, V), J_(p.y, o.y, V), this.setTargetDelta(p), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Xf(w, this.layout.layoutBox, this.relativeParent.layout.layoutBox), Ote(this.relativeTarget, this.relativeTargetOrigin, w, V), H && hte(this.relativeTarget, H) && (this.isProjectionDirty = !1), H || (H = ln()), Yi(H, this.relativeTarget)), N && (this.animationValues = d, ote(d, l, this.latestValues, V, $, B)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V; }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0); } startAnimation(o) { this.notifyListeners("animationStart"), this.currentAnimation && this.currentAnimation.stop(), this.resumingFrom && this.resumingFrom.currentAnimation && this.resumingFrom.currentAnimation.stop(), this.pendingAnimation && (wa(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = Lr.update(() => { - jd.hasAnimatedSinceResize = !0, this.currentAnimation = yte(0, G6, { + jd.hasAnimatedSinceResize = !0, this.currentAnimation = yte(0, V_, { ...o, onUpdate: (a) => { this.mixTargetDelta(a), o.onUpdate && o.onUpdate(a); @@ -34372,13 +34379,13 @@ function e9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check o && o.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete"); } finishAnimation() { - this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(G6), this.currentAnimation.stop()), this.completeAnimation(); + this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(V_), this.currentAnimation.stop()), this.completeAnimation(); } applyTransformsToTarget() { const o = this.getLead(); let { targetWithTransforms: a, target: u, layout: l, latestValues: d } = o; if (!(!a || !u || !l)) { - if (this !== o && this.layout && l && t9(this.options.animationType, this.layout.layoutBox, l.layoutBox)) { + if (this !== o && this.layout && l && e9(this.options.animationType, this.layout.layoutBox, l.layoutBox)) { u = this.target || ln(); const p = Li(this.layout.layoutBox.x); u.x.min = o.target.x.min, u.x.max = u.x.min + p; @@ -34463,13 +34470,13 @@ function e9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check for (const N in _0) { if (w[N] === void 0) continue; - const { correct: L, applyTo: $ } = _0[N], B = l.transform === "none" ? w[N] : L(w[N], p); - if ($) { - const H = $.length; + const { correct: L, applyTo: B } = _0[N], $ = l.transform === "none" ? w[N] : L(w[N], p); + if (B) { + const H = B.length; for (let U = 0; U < H; U++) - l[$[U]] = B; + l[B[U]] = $; } else - l[N] = B; + l[N] = $; } return this.options.layoutId && (l.pointerEvents = p === this ? Ud(o == null ? void 0 : o.pointerEvents) || "" : "none"), l; } @@ -34481,7 +34488,7 @@ function e9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.root.nodes.forEach((o) => { var a; return (a = o.currentAnimation) === null || a === void 0 ? void 0 : a.stop(); - }), this.root.nodes.forEach(Y6), this.root.sharedNodes.clear(); + }), this.root.nodes.forEach(G_), this.root.sharedNodes.clear(); } }; } @@ -34496,7 +34503,7 @@ function Ete(t) { s === "size" ? Xi((p) => { const w = o ? r.measuredBox[p] : r.layoutBox[p], A = Li(w); w.min = n[p].min, w.max = w.min + A; - }) : t9(s, r.layoutBox, n) && Xi((p) => { + }) : e9(s, r.layoutBox, n) && Xi((p) => { const w = o ? r.measuredBox[p] : r.layoutBox[p], A = Li(n[p]); w.max = w.min + A, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[p].max = t.relativeTarget[p].min + A); }); @@ -34504,7 +34511,7 @@ function Ete(t) { Jf(a, n, r.layoutBox); const u = ru(); o ? Jf(u, t.applyTransform(i, !0), r.measuredBox) : Jf(u, n, r.layoutBox); - const l = !X7(a); + const l = !J7(a); let d = !1; if (!t.resumeFrom) { const p = t.getClosestProjectingParent(); @@ -34514,7 +34521,7 @@ function Ete(t) { const M = ln(); Xf(M, r.layoutBox, w.layoutBox); const N = ln(); - Xf(N, n, A.layoutBox), Z7(M, N) || (d = !0), p.options.layoutRoot && (t.relativeTarget = N, t.relativeTargetOrigin = M, t.relativeParent = p); + Xf(N, n, A.layoutBox), X7(M, N) || (d = !0), p.options.layoutRoot && (t.relativeTarget = N, t.relativeTargetOrigin = M, t.relativeParent = p); } } } @@ -34541,7 +34548,7 @@ function Ate(t) { function Pte(t) { t.clearSnapshot(); } -function Y6(t) { +function G_(t) { t.clearMeasurements(); } function Mte(t) { @@ -34551,7 +34558,7 @@ function Ite(t) { const { visualElement: e } = t.options; e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform(); } -function J6(t) { +function Y_(t) { t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0; } function Cte(t) { @@ -34566,14 +34573,14 @@ function Rte(t) { function Dte(t) { t.removeLeadSnapshot(); } -function X6(t, e, r) { +function J_(t, e, r) { t.translate = Qr(e.translate, 0, r), t.scale = Qr(e.scale, 1, r), t.origin = e.origin, t.originPoint = e.originPoint; } -function Z6(t, e, r, n) { +function X_(t, e, r, n) { t.min = Qr(e.min, r.min, n), t.max = Qr(e.max, r.max, n); } function Ote(t, e, r, n) { - Z6(t.x, e.x, r.x, n), Z6(t.y, e.y, r.y, n); + X_(t.x, e.x, r.x, n), X_(t.y, e.y, r.y, n); } function Nte(t) { return t.animationValues && t.animationValues.opacityExit !== void 0; @@ -34581,21 +34588,21 @@ function Nte(t) { const Lte = { duration: 0.45, ease: [0.4, 0, 0.1, 1] -}, Q6 = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), e5 = Q6("applewebkit/") && !Q6("chrome/") ? Math.round : Un; -function t5(t) { - t.min = e5(t.min), t.max = e5(t.max); +}, Z_ = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Q_ = Z_("applewebkit/") && !Z_("chrome/") ? Math.round : Un; +function e5(t) { + t.min = Q_(t.min), t.max = Q_(t.max); } function kte(t) { - t5(t.x), t5(t.y); + e5(t.x), e5(t.y); } -function t9(t, e, r) { - return t === "position" || t === "preserve-aspect" && !$ee(K6(e), K6(r), 0.2); +function e9(t, e, r) { + return t === "position" || t === "preserve-aspect" && !$ee(H_(e), H_(r), 0.2); } function $te(t) { var e; return t !== t.root && ((e = t.scroll) === null || e === void 0 ? void 0 : e.wasRoot); } -const Bte = e9({ +const Bte = Q7({ attachResizeListener: (t, e) => Mo(t, "resize", e), measureScroll: () => ({ x: document.documentElement.scrollLeft || document.body.scrollLeft, @@ -34604,7 +34611,7 @@ const Bte = e9({ checkIsScrollRoot: () => !0 }), qm = { current: void 0 -}, r9 = e9({ +}, t9 = Q7({ measureScroll: (t) => ({ x: t.scrollLeft, y: t.scrollTop @@ -34626,13 +34633,13 @@ const Bte = e9({ }, drag: { Feature: Zee, - ProjectionNode: r9, - MeasureLayout: G7 + ProjectionNode: t9, + MeasureLayout: V7 } }; -function r5(t, e) { +function t5(t, e) { const r = e ? "pointerenter" : "pointerleave", n = e ? "onHoverStart" : "onHoverEnd", i = (s, o) => { - if (s.pointerType === "touch" || F7()) + if (s.pointerType === "touch" || B7()) return; const a = t.getProps(); t.animationState && a.whileHover && t.animationState.setActive("whileHover", e); @@ -34645,7 +34652,7 @@ function r5(t, e) { } class jte extends Ra { mount() { - this.unmount = Ro(r5(this.node, !0), r5(this.node, !1)); + this.unmount = Ro(t5(this.node, !0), t5(this.node, !1)); } unmount() { } @@ -34672,7 +34679,7 @@ class Ute extends Ra { unmount() { } } -const n9 = (t, e) => e ? t === e ? !0 : n9(t, e.parentElement) : !1; +const r9 = (t, e) => e ? t === e ? !0 : r9(t, e.parentElement) : !1; function zm(t, e) { if (!e) return; @@ -34688,7 +34695,7 @@ class qte extends Ra { const n = this.node.getProps(), s = Do(window, "pointerup", (a, u) => { if (!this.checkPressEnd()) return; - const { onTap: l, onTapCancel: d, globalTapTarget: p } = this.node.getProps(), w = !p && !n9(this.node.current, a.target) ? d : l; + const { onTap: l, onTapCancel: d, globalTapTarget: p } = this.node.getProps(), w = !p && !r9(this.node.current, a.target) ? d : l; w && Lr.update(() => w(a, u)); }, { passive: !(n.onTap || n.onPointerUp) @@ -34721,7 +34728,7 @@ class qte extends Ra { i && this.node.animationState && this.node.animationState.setActive("whileTap", !0), n && Lr.postRender(() => n(e, r)); } checkPressEnd() { - return this.removeEndListeners(), this.isPressing = !1, this.node.getProps().whileTap && this.node.animationState && this.node.animationState.setActive("whileTap", !1), !F7(); + return this.removeEndListeners(), this.isPressing = !1, this.node.getProps().whileTap && this.node.animationState && this.node.animationState.setActive("whileTap", !1), !B7(); } cancelPress(e, r) { if (!this.checkPressEnd()) @@ -34811,17 +34818,17 @@ const Jte = { } }, Xte = { layout: { - ProjectionNode: r9, - MeasureLayout: G7 + ProjectionNode: t9, + MeasureLayout: V7 } -}, Qb = Sa({ +}, Zb = Sa({ transformPagePoint: (t) => t, isStatic: !1, reducedMotion: "never" -}), Ep = Sa({}), ey = typeof window < "u", i9 = ey ? $R : Dn, s9 = Sa({ strict: !1 }); +}), Ep = Sa({}), Qb = typeof window < "u", n9 = Qb ? $R : Dn, i9 = Sa({ strict: !1 }); function Zte(t, e, r, n, i) { var s, o; - const { visualElement: a } = Tn(Ep), u = Tn(s9), l = Tn(_p), d = Tn(Qb).reducedMotion, p = Zn(); + const { visualElement: a } = Tn(Ep), u = Tn(i9), l = Tn(_p), d = Tn(Zb).reducedMotion, p = Zn(); n = n || u.renderer, !p.current && n && (p.current = n(t, { visualState: e, parent: a, @@ -34830,25 +34837,25 @@ function Zte(t, e, r, n, i) { blockInitialAnimation: l ? l.initial === !1 : !1, reducedMotionConfig: d })); - const w = p.current, A = Tn(V7); + const w = p.current, A = Tn(K7); w && !w.projection && i && (w.type === "html" || w.type === "svg") && Qte(p.current, r, i, A); const M = Zn(!1); - w5(() => { + y5(() => { w && M.current && w.update(r, l); }); - const N = r[T7], L = Zn(!!N && !(!((s = window.MotionHandoffIsComplete) === null || s === void 0) && s.call(window, N)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, N))); - return i9(() => { - w && (M.current = !0, window.MotionIsMounted = !0, w.updateFeatures(), Zb.render(w.render), L.current && w.animationState && w.animationState.animateChanges()); + const N = r[C7], L = Zn(!!N && !(!((s = window.MotionHandoffIsComplete) === null || s === void 0) && s.call(window, N)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, N))); + return n9(() => { + w && (M.current = !0, window.MotionIsMounted = !0, w.updateFeatures(), Xb.render(w.render), L.current && w.animationState && w.animationState.animateChanges()); }), Dn(() => { w && (!L.current && w.animationState && w.animationState.animateChanges(), L.current && (queueMicrotask(() => { - var $; - ($ = window.MotionHandoffMarkAsComplete) === null || $ === void 0 || $.call(window, N); + var B; + (B = window.MotionHandoffMarkAsComplete) === null || B === void 0 || B.call(window, N); }), L.current = !1)); }), w; } function Qte(t, e, r, n) { const { layoutId: i, layout: s, drag: o, dragConstraints: a, layoutScroll: u, layoutRoot: l } = e; - t.projection = new r(t.latestValues, e["data-framer-portal-id"] ? void 0 : o9(t.parent)), t.projection.setOptions({ + t.projection = new r(t.latestValues, e["data-framer-portal-id"] ? void 0 : s9(t.parent)), t.projection.setOptions({ layoutId: i, layout: s, alwaysMeasureLayout: !!o || a && tu(a), @@ -34866,12 +34873,12 @@ function Qte(t, e, r, n) { layoutRoot: l }); } -function o9(t) { +function s9(t) { if (t) - return t.options.allowProjection !== !1 ? t.projection : o9(t.parent); + return t.options.allowProjection !== !1 ? t.projection : s9(t.parent); } function ere(t, e, r) { - return yv( + return bv( (n) => { n && t.mount && t.mount(n), e && (n ? e.mount(n) : e.unmount()), r && (typeof r == "function" ? r(n) : tu(r) && (r.current = n)); }, @@ -34884,9 +34891,9 @@ function ere(t, e, r) { ); } function Sp(t) { - return bp(t.animate) || Rb.some((e) => Il(t[e])); + return bp(t.animate) || Tb.some((e) => Il(t[e])); } -function a9(t) { +function o9(t) { return !!(Sp(t) || t.variants); } function tre(t, e) { @@ -34901,12 +34908,12 @@ function tre(t, e) { } function rre(t) { const { initial: e, animate: r } = tre(t, Tn(Ep)); - return ci(() => ({ initial: e, animate: r }), [n5(e), n5(r)]); + return wi(() => ({ initial: e, animate: r }), [r5(e), r5(r)]); } -function n5(t) { +function r5(t) { return Array.isArray(t) ? t.join(" ") : t; } -const i5 = { +const n5 = { animation: [ "animate", "variants", @@ -34926,9 +34933,9 @@ const i5 = { inView: ["whileInView", "onViewportEnter", "onViewportLeave"], layout: ["layout", "layoutId"] }, Cu = {}; -for (const t in i5) +for (const t in n5) Cu[t] = { - isEnabled: (e) => i5[t].some((r) => !!e[r]) + isEnabled: (e) => n5[t].some((r) => !!e[r]) }; function nre(t) { for (const e in t) @@ -34943,26 +34950,26 @@ function sre({ preloadedFeatures: t, createVisualElement: e, useRender: r, useVi function s(a, u) { let l; const d = { - ...Tn(Qb), + ...Tn(Zb), ...a, layoutId: ore(a) }, { isStatic: p } = d, w = rre(a), A = n(a, p); - if (!p && ey) { + if (!p && Qb) { are(d, t); const M = cre(d); l = M.MeasureLayout, w.visualElement = Zte(i, A, d, e, M.ProjectionNode); } - return pe.jsxs(Ep.Provider, { value: w, children: [l && w.visualElement ? pe.jsx(l, { visualElement: w.visualElement, ...d }) : null, r(i, a, ere(A, w.visualElement, u), A, p, w.visualElement)] }); + return le.jsxs(Ep.Provider, { value: w, children: [l && w.visualElement ? le.jsx(l, { visualElement: w.visualElement, ...d }) : null, r(i, a, ere(A, w.visualElement, u), A, p, w.visualElement)] }); } - const o = vv(s); + const o = mv(s); return o[ire] = i, o; } function ore({ layoutId: t }) { - const e = Tn(Xb).id; + const e = Tn(Jb).id; return e && t !== void 0 ? e + "-" + t : t; } function are(t, e) { - const r = Tn(s9).strict; + const r = Tn(i9).strict; if (process.env.NODE_ENV !== "production" && e && r) { const n = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead."; t.ignoreStrict ? Ku(!1, n) : Uo(!1, n); @@ -35005,7 +35012,7 @@ const ure = [ "use", "view" ]; -function ty(t) { +function ey(t) { return ( /** * If it's not a string, it's a custom React component. Currently we only support @@ -35025,12 +35032,12 @@ function ty(t) { ) ); } -function c9(t, { style: e, vars: r }, n, i) { +function a9(t, { style: e, vars: r }, n, i) { Object.assign(t.style, e, i && i.getProjectionStyles(n)); for (const s in r) t.style.setProperty(s, r[s]); } -const u9 = /* @__PURE__ */ new Set([ +const c9 = /* @__PURE__ */ new Set([ "baseFrequency", "diffuseConstant", "kernelMatrix", @@ -35055,23 +35062,23 @@ const u9 = /* @__PURE__ */ new Set([ "textLength", "lengthAdjust" ]); -function f9(t, e, r, n) { - c9(t, e, void 0, n); +function u9(t, e, r, n) { + a9(t, e, void 0, n); for (const i in e.attrs) - t.setAttribute(u9.has(i) ? i : Jb(i), e.attrs[i]); + t.setAttribute(c9.has(i) ? i : Yb(i), e.attrs[i]); } -function l9(t, { layout: e, layoutId: r }) { +function f9(t, { layout: e, layoutId: r }) { return Ac.has(t) || t.startsWith("origin") || (e || r !== void 0) && (!!_0[t] || t === "opacity"); } -function ry(t, e, r) { +function ty(t, e, r) { var n; const { style: i } = t, s = {}; for (const o in i) - (Xn(i[o]) || e.style && Xn(e.style[o]) || l9(o, t) || ((n = r == null ? void 0 : r.getValue(o)) === null || n === void 0 ? void 0 : n.liveStyle) !== void 0) && (s[o] = i[o]); + (Xn(i[o]) || e.style && Xn(e.style[o]) || f9(o, t) || ((n = r == null ? void 0 : r.getValue(o)) === null || n === void 0 ? void 0 : n.liveStyle) !== void 0) && (s[o] = i[o]); return s; } -function h9(t, e, r) { - const n = ry(t, e, r); +function l9(t, e, r) { + const n = ty(t, e, r); for (const i in t) if (Xn(t[i]) || Xn(e[i])) { const s = ah.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i; @@ -35079,7 +35086,7 @@ function h9(t, e, r) { } return n; } -function ny(t) { +function ry(t) { const e = Zn(null); return e.current === null && (e.current = t()), e.current; } @@ -35090,16 +35097,16 @@ function fre({ scrapeMotionValuesFromProps: t, createRenderState: e, onMount: r }; return r && (o.mount = (a) => r(n, a, o)), o; } -const d9 = (t) => (e, r) => { +const h9 = (t) => (e, r) => { const n = Tn(Ep), i = Tn(_p), s = () => fre(t, e, n, i); - return r ? s() : ny(s); + return r ? s() : ry(s); }; function lre(t, e, r, n) { const i = {}, s = n(t, {}); for (const w in s) i[w] = Ud(s[w]); let { initial: o, animate: a } = t; - const u = Sp(t), l = a9(t); + const u = Sp(t), l = o9(t); e && l && !u && t.inherit !== !1 && (o === void 0 && (o = e.initial), a === void 0 && (a = e.animate)); let d = r ? r.initial === !1 : !1; d = d || o === !1; @@ -35107,33 +35114,33 @@ function lre(t, e, r, n) { if (p && typeof p != "boolean" && !bp(p)) { const w = Array.isArray(p) ? p : [p]; for (let A = 0; A < w.length; A++) { - const M = Cb(t, w[A]); + const M = Ib(t, w[A]); if (M) { - const { transitionEnd: N, transition: L, ...$ } = M; - for (const B in $) { - let H = $[B]; + const { transitionEnd: N, transition: L, ...B } = M; + for (const $ in B) { + let H = B[$]; if (Array.isArray(H)) { const U = d ? H.length - 1 : 0; H = H[U]; } - H !== null && (i[B] = H); + H !== null && (i[$] = H); } - for (const B in N) - i[B] = N[B]; + for (const $ in N) + i[$] = N[$]; } } } return i; } -const iy = () => ({ +const ny = () => ({ style: {}, transform: {}, transformOrigin: {}, vars: {} -}), p9 = () => ({ - ...iy(), +}), d9 = () => ({ + ...ny(), attrs: {} -}), g9 = (t, e) => e && typeof t == "number" ? e.transform(t) : t, hre = { +}), p9 = (t, e) => e && typeof t == "number" ? e.transform(t) : t, hre = { x: "translateX", y: "translateY", z: "translateZ", @@ -35147,7 +35154,7 @@ function pre(t, e, r) { continue; let u = !0; if (typeof a == "number" ? u = a === (o.startsWith("scale") ? 1 : 0) : u = parseFloat(a) === 0, !u || r) { - const l = g9(a, Fb[o]); + const l = p9(a, Bb[o]); if (!u) { i = !1; const d = hre[o] || o; @@ -35158,7 +35165,7 @@ function pre(t, e, r) { } return n = n.trim(), r ? n = r(e, i ? "" : n) : i && (n = "none"), n; } -function sy(t, e, r) { +function iy(t, e, r) { const { style: n, vars: i, transformOrigin: s } = t; let o = !1, a = !1; for (const u in e) { @@ -35166,11 +35173,11 @@ function sy(t, e, r) { if (Ac.has(u)) { o = !0; continue; - } else if (a7(u)) { + } else if (o7(u)) { i[u] = l; continue; } else { - const d = g9(l, Fb[u]); + const d = p9(l, Bb[u]); u.startsWith("origin") ? (a = !0, s[u] = d) : n[u] = d; } } @@ -35179,11 +35186,11 @@ function sy(t, e, r) { n.transformOrigin = `${u} ${l} ${d}`; } } -function s5(t, e, r) { +function i5(t, e, r) { return typeof t == "string" ? t : Vt.transform(e + r * t); } function gre(t, e, r) { - const n = s5(e, t.x, t.width), i = s5(r, t.y, t.height); + const n = i5(e, t.x, t.width), i = i5(r, t.y, t.height); return `${n} ${i}`; } const mre = { @@ -35200,7 +35207,7 @@ function bre(t, e, r = 1, n = 0, i = !0) { const o = Vt.transform(e), a = Vt.transform(r); t[s.array] = `${o} ${a}`; } -function oy(t, { +function sy(t, { attrX: e, attrY: r, attrScale: n, @@ -35212,7 +35219,7 @@ function oy(t, { // This is object creation, which we try to avoid per-frame. ...l }, d, p) { - if (sy(t, l, p), d) { + if (iy(t, l, p), d) { t.style.viewBox && (t.attrs.viewBox = t.style.viewBox); return; } @@ -35220,10 +35227,10 @@ function oy(t, { const { attrs: w, style: A, dimensions: M } = t; w.transform && (M && (A.transform = w.transform), delete w.transform), M && (i !== void 0 || s !== void 0 || A.transform) && (A.transformOrigin = gre(M, i !== void 0 ? i : 0.5, s !== void 0 ? s : 0.5)), e !== void 0 && (w.x = e), r !== void 0 && (w.y = r), n !== void 0 && (w.scale = n), o !== void 0 && bre(w, o, a, u, !1); } -const ay = (t) => typeof t == "string" && t.toLowerCase() === "svg", yre = { - useVisualState: d9({ - scrapeMotionValuesFromProps: h9, - createRenderState: p9, +const oy = (t) => typeof t == "string" && t.toLowerCase() === "svg", yre = { + useVisualState: h9({ + scrapeMotionValuesFromProps: l9, + createRenderState: d9, onMount: (t, e, { renderState: r, latestValues: n }) => { Lr.read(() => { try { @@ -35237,29 +35244,29 @@ const ay = (t) => typeof t == "string" && t.toLowerCase() === "svg", yre = { }; } }), Lr.render(() => { - oy(r, n, ay(e.tagName), t.transformTemplate), f9(e, r); + sy(r, n, oy(e.tagName), t.transformTemplate), u9(e, r); }); } }) }, wre = { - useVisualState: d9({ - scrapeMotionValuesFromProps: ry, - createRenderState: iy + useVisualState: h9({ + scrapeMotionValuesFromProps: ty, + createRenderState: ny }) }; -function m9(t, e, r) { +function g9(t, e, r) { for (const n in e) - !Xn(e[n]) && !l9(n, r) && (t[n] = e[n]); + !Xn(e[n]) && !f9(n, r) && (t[n] = e[n]); } function xre({ transformTemplate: t }, e) { - return ci(() => { - const r = iy(); - return sy(r, e, t), Object.assign({}, r.vars, r.style); + return wi(() => { + const r = ny(); + return iy(r, e, t), Object.assign({}, r.vars, r.style); }, [e]); } function _re(t, e) { const r = t.style || {}, n = {}; - return m9(n, r, t), Object.assign(n, xre(t, e)), n; + return g9(n, r, t), Object.assign(n, xre(t, e)), n; } function Ere(t, e) { const r = {}, n = _re(t, e); @@ -35300,9 +35307,9 @@ const Sre = /* @__PURE__ */ new Set([ function E0(t) { return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || Sre.has(t); } -let v9 = (t) => !E0(t); +let m9 = (t) => !E0(t); function Are(t) { - t && (v9 = (e) => e.startsWith("on") ? !E0(e) : t(e)); + t && (m9 = (e) => e.startsWith("on") ? !E0(e) : t(e)); } try { Are(require("@emotion/is-prop-valid").default); @@ -35311,27 +35318,27 @@ try { function Pre(t, e, r) { const n = {}; for (const i in t) - i === "values" && typeof t.values == "object" || (v9(i) || r === !0 && E0(i) || !e && !E0(i) || // If trying to use native HTML drag events, forward drag listeners + i === "values" && typeof t.values == "object" || (m9(i) || r === !0 && E0(i) || !e && !E0(i) || // If trying to use native HTML drag events, forward drag listeners t.draggable && i.startsWith("onDrag")) && (n[i] = t[i]); return n; } function Mre(t, e, r, n) { - const i = ci(() => { - const s = p9(); - return oy(s, e, ay(n), t.transformTemplate), { + const i = wi(() => { + const s = d9(); + return sy(s, e, oy(n), t.transformTemplate), { ...s.attrs, style: { ...s.style } }; }, [e]); if (t.style) { const s = {}; - m9(s, t.style, t), i.style = { ...s, ...i.style }; + g9(s, t.style, t), i.style = { ...s, ...i.style }; } return i; } function Ire(t = !1) { return (r, n, i, { latestValues: s }, o) => { - const u = (ty(r) ? Mre : Ere)(n, s, o, r), l = Pre(n, typeof r == "string", t), d = r !== x5 ? { ...l, ...u, ref: i } : {}, { children: p } = n, w = ci(() => Xn(p) ? p.get() : p, [p]); + const u = (ey(r) ? Mre : Ere)(n, s, o, r), l = Pre(n, typeof r == "string", t), d = r !== w5 ? { ...l, ...u, ref: i } : {}, { children: p } = n, w = wi(() => Xn(p) ? p.get() : p, [p]); return qd(r, { ...d, children: w @@ -35341,7 +35348,7 @@ function Ire(t = !1) { function Cre(t, e) { return function(n, { forwardMotionProps: i } = { forwardMotionProps: !1 }) { const o = { - ...ty(n) ? yre : wre, + ...ey(n) ? yre : wre, preloadedFeatures: t, useRender: Ire(i), createVisualElement: e, @@ -35350,9 +35357,9 @@ function Cre(t, e) { return sre(o); }; } -const lv = { current: null }, b9 = { current: !1 }; +const lv = { current: null }, v9 = { current: !1 }; function Tre() { - if (b9.current = !0, !!ey) + if (v9.current = !0, !!Qb) if (window.matchMedia) { const t = window.matchMedia("(prefers-reduced-motion)"), e = () => lv.current = t.matches; t.addListener(e), e(); @@ -35379,7 +35386,7 @@ function Rre(t, e, r) { e[n] === void 0 && t.removeValue(n); return e; } -const o5 = /* @__PURE__ */ new WeakMap(), Dre = [...f7, Yn, _a], Ore = (t) => Dre.find(u7(t)), a5 = [ +const s5 = /* @__PURE__ */ new WeakMap(), Dre = [...u7, Yn, _a], Ore = (t) => Dre.find(c7(t)), o5 = [ "AnimationStart", "AnimationComplete", "Update", @@ -35400,14 +35407,14 @@ class Nre { return {}; } constructor({ parent: e, props: r, presenceContext: n, reducedMotionConfig: i, blockInitialAnimation: s, visualState: o }, a = {}) { - this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = kb, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => { + this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = Lb, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => { this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection)); }, this.renderScheduledAt = 0, this.scheduleRender = () => { const w = Ys.now(); this.renderScheduledAt < w && (this.renderScheduledAt = w, Lr.render(this.render, !1, !0)); }; const { latestValues: u, renderState: l } = o; - this.latestValues = u, this.baseTarget = { ...u }, this.initialValues = r.initial ? { ...u } : {}, this.renderState = l, this.parent = e, this.props = r, this.presenceContext = n, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!s, this.isControllingVariants = Sp(r), this.isVariantNode = a9(r), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current); + this.latestValues = u, this.baseTarget = { ...u }, this.initialValues = r.initial ? { ...u } : {}, this.renderState = l, this.parent = e, this.props = r, this.presenceContext = n, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!s, this.isControllingVariants = Sp(r), this.isVariantNode = o9(r), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current); const { willChange: d, ...p } = this.scrapeMotionValuesFromProps(r, {}, this); for (const w in p) { const A = p[w]; @@ -35415,10 +35422,10 @@ class Nre { } } mount(e) { - this.current = e, o5.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((r, n) => this.bindToMotionValue(n, r)), b9.current || Tre(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : lv.current, process.env.NODE_ENV !== "production" && vp(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext); + this.current = e, s5.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((r, n) => this.bindToMotionValue(n, r)), v9.current || Tre(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : lv.current, process.env.NODE_ENV !== "production" && vp(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext); } unmount() { - o5.delete(this.current), this.projection && this.projection.unmount(), wa(this.notifyUpdate), wa(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this); + s5.delete(this.current), this.projection && this.projection.unmount(), wa(this.notifyUpdate), wa(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this); for (const e in this.events) this.events[e].clear(); for (const e in this.features) { @@ -35476,8 +35483,8 @@ class Nre { */ update(e, r) { (e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = r; - for (let n = 0; n < a5.length; n++) { - const i = a5[n]; + for (let n = 0; n < o5.length; n++) { + const i = o5[n]; this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]); const s = "on" + i, o = e[s]; o && (this.propEventSubscriptions[i] = this.on(i, o)); @@ -35548,7 +35555,7 @@ class Nre { readValue(e, r) { var n; let i = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : (n = this.getBaseTargetFromProps(this.props, e)) !== null && n !== void 0 ? n : this.readValueFromInstance(this.current, e, this.options); - return i != null && (typeof i == "string" && (s7(i) || i7(i)) ? i = parseFloat(i) : !Ore(i) && _a.test(r) && (i = b7(e, r)), this.setBaseTarget(e, Xn(i) ? i.get() : i)), Xn(i) ? i.get() : i; + return i != null && (typeof i == "string" && (i7(i) || n7(i)) ? i = parseFloat(i) : !Ore(i) && _a.test(r) && (i = v7(e, r)), this.setBaseTarget(e, Xn(i) ? i.get() : i)), Xn(i) ? i.get() : i; } /** * Set the base target to later animate back to. This is currently @@ -35566,7 +35573,7 @@ class Nre { const { initial: n } = this.props; let i; if (typeof n == "string" || typeof n == "object") { - const o = Cb(this.props, n, (r = this.presenceContext) === null || r === void 0 ? void 0 : r.custom); + const o = Ib(this.props, n, (r = this.presenceContext) === null || r === void 0 ? void 0 : r.custom); o && (i = o[e]); } if (n && i !== void 0) @@ -35575,15 +35582,15 @@ class Nre { return s !== void 0 && !Xn(s) ? s : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e]; } on(e, r) { - return this.events[e] || (this.events[e] = new Yb()), this.events[e].add(r); + return this.events[e] || (this.events[e] = new Gb()), this.events[e].add(r); } notify(e, ...r) { this.events[e] && this.events[e].notify(...r); } } -class y9 extends Nre { +class b9 extends Nre { constructor() { - super(...arguments), this.KeyframeResolver = y7; + super(...arguments), this.KeyframeResolver = b7; } sortInstanceNodePosition(e, r) { return e.compareDocumentPosition(r) & 2 ? 1 : -1; @@ -35598,27 +35605,27 @@ class y9 extends Nre { function Lre(t) { return window.getComputedStyle(t); } -class kre extends y9 { +class kre extends b9 { constructor() { - super(...arguments), this.type = "html", this.renderInstance = c9; + super(...arguments), this.type = "html", this.renderInstance = a9; } readValueFromInstance(e, r) { if (Ac.has(r)) { - const n = jb(r); + const n = Fb(r); return n && n.default || 0; } else { - const n = Lre(e), i = (a7(r) ? n.getPropertyValue(r) : n[r]) || 0; + const n = Lre(e), i = (o7(r) ? n.getPropertyValue(r) : n[r]) || 0; return typeof i == "string" ? i.trim() : i; } } measureInstanceViewportBox(e, { transformPagePoint: r }) { - return H7(e, r); + return W7(e, r); } build(e, r, n) { - sy(e, r, n.transformTemplate); + iy(e, r, n.transformTemplate); } scrapeMotionValuesFromProps(e, r, n) { - return ry(e, r, n); + return ty(e, r, n); } handleChildMotionValue() { this.childSubscription && (this.childSubscription(), delete this.childSubscription); @@ -35628,7 +35635,7 @@ class kre extends y9 { })); } } -class $re extends y9 { +class $re extends b9 { constructor() { super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = ln; } @@ -35637,26 +35644,26 @@ class $re extends y9 { } readValueFromInstance(e, r) { if (Ac.has(r)) { - const n = jb(r); + const n = Fb(r); return n && n.default || 0; } - return r = u9.has(r) ? r : Jb(r), e.getAttribute(r); + return r = c9.has(r) ? r : Yb(r), e.getAttribute(r); } scrapeMotionValuesFromProps(e, r, n) { - return h9(e, r, n); + return l9(e, r, n); } build(e, r, n) { - oy(e, r, this.isSVGTag, n.transformTemplate); + sy(e, r, this.isSVGTag, n.transformTemplate); } renderInstance(e, r, n, i) { - f9(e, r, n, i); + u9(e, r, n, i); } mount(e) { - this.isSVGTag = ay(e.tagName), super.mount(e); + this.isSVGTag = oy(e.tagName), super.mount(e); } } -const Bre = (t, e) => ty(t) ? new $re(e) : new kre(e, { - allowProjection: t !== x5 +const Bre = (t, e) => ey(t) ? new $re(e) : new kre(e, { + allowProjection: t !== w5 }), Fre = /* @__PURE__ */ Cre({ ...Iee, ...Jte, @@ -35682,13 +35689,13 @@ class Ure extends Gt.Component { } } function qre({ children: t, isPresent: e }) { - const r = bv(), n = Zn(null), i = Zn({ + const r = vv(), n = Zn(null), i = Zn({ width: 0, height: 0, top: 0, left: 0 - }), { nonce: s } = Tn(Qb); - return w5(() => { + }), { nonce: s } = Tn(Zb); + return y5(() => { const { width: o, height: a, top: u, left: l } = i.current; if (e || !n.current || !o || !a) return; @@ -35705,16 +35712,16 @@ function qre({ children: t, isPresent: e }) { `), () => { document.head.removeChild(d); }; - }, [e]), pe.jsx(Ure, { isPresent: e, childRef: n, sizeRef: i, children: Gt.cloneElement(t, { ref: n }) }); + }, [e]), le.jsx(Ure, { isPresent: e, childRef: n, sizeRef: i, children: Gt.cloneElement(t, { ref: n }) }); } const zre = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: i, presenceAffectsLayout: s, mode: o }) => { - const a = ny(Wre), u = bv(), l = yv((p) => { + const a = ry(Wre), u = vv(), l = bv((p) => { a.set(p, !0); for (const w of a.values()) if (!w) return; n && n(); - }, [a, n]), d = ci( + }, [a, n]), d = wi( () => ({ id: u, initial: e, @@ -35730,17 +35737,17 @@ const zre = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: */ s ? [Math.random(), l] : [r, l] ); - return ci(() => { + return wi(() => { a.forEach((p, w) => a.set(w, !1)); }, [r]), Gt.useEffect(() => { !r && !a.size && n && n(); - }, [r]), o === "popLayout" && (t = pe.jsx(qre, { isPresent: r, children: t })), pe.jsx(_p.Provider, { value: d, children: t }); + }, [r]), o === "popLayout" && (t = le.jsx(qre, { isPresent: r, children: t })), le.jsx(_p.Provider, { value: d, children: t }); }; function Wre() { return /* @__PURE__ */ new Map(); } const bd = (t) => t.key || ""; -function c5(t) { +function a5(t) { const e = []; return BR.forEach(t, (r) => { FR(r) && e.push(r); @@ -35748,28 +35755,28 @@ function c5(t) { } const Hre = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExitComplete: i, presenceAffectsLayout: s = !0, mode: o = "sync" }) => { Uo(!e, "Replace exitBeforeEnter with mode='wait'"); - const a = ci(() => c5(t), [t]), u = a.map(bd), l = Zn(!0), d = Zn(a), p = ny(() => /* @__PURE__ */ new Map()), [w, A] = Yt(a), [M, N] = Yt(a); - i9(() => { + const a = wi(() => a5(t), [t]), u = a.map(bd), l = Zn(!0), d = Zn(a), p = ry(() => /* @__PURE__ */ new Map()), [w, A] = Yt(a), [M, N] = Yt(a); + n9(() => { l.current = !1, d.current = a; - for (let B = 0; B < M.length; B++) { - const H = bd(M[B]); + for (let $ = 0; $ < M.length; $++) { + const H = bd(M[$]); u.includes(H) ? p.delete(H) : p.get(H) !== !0 && p.set(H, !1); } }, [M, u.length, u.join("-")]); const L = []; if (a !== w) { - let B = [...a]; + let $ = [...a]; for (let H = 0; H < M.length; H++) { const U = M[H], V = bd(U); - u.includes(V) || (B.splice(H, 0, U), L.push(U)); + u.includes(V) || ($.splice(H, 0, U), L.push(U)); } - o === "wait" && L.length && (B = L), N(c5(B)), A(a); + o === "wait" && L.length && ($ = L), N(a5($)), A(a); return; } process.env.NODE_ENV !== "production" && o === "wait" && M.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`); - const { forceRender: $ } = Tn(Xb); - return pe.jsx(pe.Fragment, { children: M.map((B) => { - const H = bd(B), U = a === M || u.includes(H), V = () => { + const { forceRender: B } = Tn(Jb); + return le.jsx(le.Fragment, { children: M.map(($) => { + const H = bd($), U = a === M || u.includes(H), V = () => { if (p.has(H)) p.set(H, !0); else @@ -35777,11 +35784,11 @@ const Hre = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onEx let te = !0; p.forEach((R) => { R || (te = !1); - }), te && ($ == null || $(), N(d.current), i && i()); + }), te && (B == null || B(), N(d.current), i && i()); }; - return pe.jsx(zre, { isPresent: U, initial: !l.current || n ? void 0 : !1, custom: U ? void 0 : r, presenceAffectsLayout: s, mode: o, onExitComplete: U ? void 0 : V, children: B }, H); + return le.jsx(zre, { isPresent: U, initial: !l.current || n ? void 0 : !1, custom: U ? void 0 : r, presenceAffectsLayout: s, mode: o, onExitComplete: U ? void 0 : V, children: $ }, H); }) }); -}, Ms = (t) => /* @__PURE__ */ pe.jsx(Hre, { children: /* @__PURE__ */ pe.jsx( +}, Ms = (t) => /* @__PURE__ */ le.jsx(Hre, { children: /* @__PURE__ */ le.jsx( jre.div, { initial: { x: 0, opacity: 0 }, @@ -35792,12 +35799,12 @@ const Hre = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onEx children: t.children } ) }); -function cy(t) { +function ay(t) { const { icon: e, title: r, extra: n, onClick: i } = t; function s() { i && i(); } - return /* @__PURE__ */ pe.jsxs( + return /* @__PURE__ */ le.jsxs( "div", { className: "xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg", @@ -35805,27 +35812,27 @@ function cy(t) { children: [ e, r, - /* @__PURE__ */ pe.jsxs("div", { className: "xc-relative xc-ml-auto xc-h-6", children: [ - /* @__PURE__ */ pe.jsx("div", { className: "xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0", children: n }), - /* @__PURE__ */ pe.jsx("div", { className: "xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100", children: /* @__PURE__ */ pe.jsx(hZ, {}) }) + /* @__PURE__ */ le.jsxs("div", { className: "xc-relative xc-ml-auto xc-h-6", children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0", children: n }), + /* @__PURE__ */ le.jsx("div", { className: "xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100", children: /* @__PURE__ */ le.jsx(hZ, {}) }) ] }) ] } ); } function Kre(t) { - return t.lastUsed ? /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500", children: [ - /* @__PURE__ */ pe.jsx("div", { className: "xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]" }), + return t.lastUsed ? /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500", children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]" }), "Last Used" - ] }) : t.installed ? /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500", children: [ - /* @__PURE__ */ pe.jsx("div", { className: "xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]" }), + ] }) : t.installed ? /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500", children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]" }), "Installed" ] }) : null; } -function hv(t) { +function y9(t) { var o, a; - const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: (o = e.config) == null ? void 0 : o.image }), i = ((a = e.config) == null ? void 0 : a.name) || "", s = ci(() => Kre(e), [e]); - return /* @__PURE__ */ pe.jsx(cy, { icon: n, title: i, extra: s, onClick: () => r(e) }); + const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: (o = e.config) == null ? void 0 : o.image }), i = ((a = e.config) == null ? void 0 : a.name) || "", s = wi(() => Kre(e), [e]); + return /* @__PURE__ */ le.jsx(ay, { icon: n, title: i, extra: s, onClick: () => r(e) }); } function w9(t) { var e, r, n = ""; @@ -35840,14 +35847,14 @@ function Vre() { for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++) (t = arguments[r]) && (e = w9(t)) && (n && (n += " "), n += e); return n; } -const Gre = Vre, uy = "-", Yre = (t) => { +const Gre = Vre, cy = "-", Yre = (t) => { const e = Xre(t), { conflictingClassGroups: r, conflictingClassGroupModifiers: n } = t; return { getClassGroupId: (o) => { - const a = o.split(uy); + const a = o.split(cy); return a[0] === "" && a.length !== 1 && a.shift(), x9(a, e) || Jre(o); }, getConflictingClassGroupIds: (o, a) => { @@ -35864,13 +35871,13 @@ const Gre = Vre, uy = "-", Yre = (t) => { return i; if (e.validators.length === 0) return; - const s = t.join(uy); + const s = t.join(cy); return (o = e.validators.find(({ validator: a }) => a(s))) == null ? void 0 : o.classGroupId; -}, u5 = /^\[(.+)\]$/, Jre = (t) => { - if (u5.test(t)) { - const e = u5.exec(t)[1], r = e == null ? void 0 : e.substring(0, e.indexOf(":")); +}, c5 = /^\[(.+)\]$/, Jre = (t) => { + if (c5.test(t)) { + const e = c5.exec(t)[1], r = e == null ? void 0 : e.substring(0, e.indexOf(":")); if (r) return "arbitrary.." + r; } @@ -35883,18 +35890,18 @@ const Gre = Vre, uy = "-", Yre = (t) => { validators: [] }; return Qre(Object.entries(t.classGroups), r).forEach(([s, o]) => { - dv(o, n, s, e); + hv(o, n, s, e); }), n; -}, dv = (t, e, r, n) => { +}, hv = (t, e, r, n) => { t.forEach((i) => { if (typeof i == "string") { - const s = i === "" ? e : f5(e, i); + const s = i === "" ? e : u5(e, i); s.classGroupId = r; return; } if (typeof i == "function") { if (Zre(i)) { - dv(i(n), e, r, n); + hv(i(n), e, r, n); return; } e.validators.push({ @@ -35904,12 +35911,12 @@ const Gre = Vre, uy = "-", Yre = (t) => { return; } Object.entries(i).forEach(([s, o]) => { - dv(o, f5(e, s), r, n); + hv(o, u5(e, s), r, n); }); }); -}, f5 = (t, e) => { +}, u5 = (t, e) => { let r = t; - return e.split(uy).forEach((n) => { + return e.split(cy).forEach((n) => { r.nextPart.has(n) || r.nextPart.set(n, { nextPart: /* @__PURE__ */ new Map(), validators: [] @@ -35950,18 +35957,18 @@ const Gre = Vre, uy = "-", Yre = (t) => { const u = []; let l = 0, d = 0, p; for (let L = 0; L < a.length; L++) { - let $ = a[L]; + let B = a[L]; if (l === 0) { - if ($ === i && (n || a.slice(L, L + s) === e)) { + if (B === i && (n || a.slice(L, L + s) === e)) { u.push(a.slice(d, L)), d = L + s; continue; } - if ($ === "/") { + if (B === "/") { p = L; continue; } } - $ === "[" ? l++ : $ === "]" && l--; + B === "[" ? l++ : B === "]" && l--; } const w = u.length === 0 ? a : a.substring(d), A = w.startsWith(_9), M = A ? w.substring(1) : w, N = p && p > d ? p - d : void 0; return { @@ -36013,14 +36020,14 @@ const Gre = Vre, uy = "-", Yre = (t) => { } M = !1; } - const L = rne(d).join(":"), $ = p ? L + _9 : L, B = $ + N; - if (s.includes(B)) + const L = rne(d).join(":"), B = p ? L + _9 : L, $ = B + N; + if (s.includes($)) continue; - s.push(B); + s.push($); const H = i(N, M); for (let U = 0; U < H.length; ++U) { const V = H[U]; - s.push($ + V); + s.push(B + V); } a = l + (a.length > 0 ? " " + a : a); } @@ -36069,7 +36076,7 @@ const Gr = (t) => { // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough. lne.test(t) && !hne.test(t) ), A9 = () => !1, Ene = (t) => dne.test(t), Sne = (t) => pne.test(t), Ane = () => { - const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), u = Gr("contrast"), l = Gr("grayscale"), d = Gr("hueRotate"), p = Gr("invert"), w = Gr("gap"), A = Gr("gradientColorStops"), M = Gr("gradientColorStopPositions"), N = Gr("inset"), L = Gr("margin"), $ = Gr("opacity"), B = Gr("padding"), H = Gr("saturate"), U = Gr("scale"), V = Gr("sepia"), te = Gr("skew"), R = Gr("space"), K = Gr("translate"), ge = () => ["auto", "contain", "none"], Ee = () => ["auto", "hidden", "clip", "visible", "scroll"], Y = () => ["auto", ur, e], S = () => [ur, e], m = () => ["", bo, na], f = () => ["auto", mu, ur], g = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], b = () => ["solid", "dashed", "dotted", "double", "none"], x = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], _ = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], E = () => ["", "0", ur], v = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], P = () => [mu, ur]; + const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), u = Gr("contrast"), l = Gr("grayscale"), d = Gr("hueRotate"), p = Gr("invert"), w = Gr("gap"), A = Gr("gradientColorStops"), M = Gr("gradientColorStopPositions"), N = Gr("inset"), L = Gr("margin"), B = Gr("opacity"), $ = Gr("padding"), H = Gr("saturate"), U = Gr("scale"), V = Gr("sepia"), te = Gr("skew"), R = Gr("space"), K = Gr("translate"), ge = () => ["auto", "contain", "none"], Ee = () => ["auto", "hidden", "clip", "visible", "scroll"], Y = () => ["auto", ur, e], S = () => [ur, e], m = () => ["", bo, na], f = () => ["auto", mu, ur], g = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], b = () => ["solid", "dashed", "dotted", "double", "none"], x = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], _ = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], E = () => ["", "0", ur], v = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], P = () => [mu, ur]; return { cacheSize: 500, separator: ":", @@ -36537,63 +36544,63 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/padding */ p: [{ - p: [B] + p: [$] }], /** * Padding X * @see https://tailwindcss.com/docs/padding */ px: [{ - px: [B] + px: [$] }], /** * Padding Y * @see https://tailwindcss.com/docs/padding */ py: [{ - py: [B] + py: [$] }], /** * Padding Start * @see https://tailwindcss.com/docs/padding */ ps: [{ - ps: [B] + ps: [$] }], /** * Padding End * @see https://tailwindcss.com/docs/padding */ pe: [{ - pe: [B] + pe: [$] }], /** * Padding Top * @see https://tailwindcss.com/docs/padding */ pt: [{ - pt: [B] + pt: [$] }], /** * Padding Right * @see https://tailwindcss.com/docs/padding */ pr: [{ - pr: [B] + pr: [$] }], /** * Padding Bottom * @see https://tailwindcss.com/docs/padding */ pb: [{ - pb: [B] + pb: [$] }], /** * Padding Left * @see https://tailwindcss.com/docs/padding */ pl: [{ - pl: [B] + pl: [$] }], /** * Margin @@ -36851,7 +36858,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/placeholder-opacity */ "placeholder-opacity": [{ - "placeholder-opacity": [$] + "placeholder-opacity": [B] }], /** * Text Alignment @@ -36872,7 +36879,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/text-opacity */ "text-opacity": [{ - "text-opacity": [$] + "text-opacity": [B] }], /** * Text Decoration @@ -36987,7 +36994,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/background-opacity */ "bg-opacity": [{ - "bg-opacity": [$] + "bg-opacity": [B] }], /** * Background Origin @@ -37251,7 +37258,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/border-opacity */ "border-opacity": [{ - "border-opacity": [$] + "border-opacity": [B] }], /** * Border Style @@ -37289,7 +37296,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/divide-opacity */ "divide-opacity": [{ - "divide-opacity": [$] + "divide-opacity": [B] }], /** * Divide Style @@ -37420,7 +37427,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/ring-opacity */ "ring-opacity": [{ - "ring-opacity": [$] + "ring-opacity": [B] }], /** * Ring Offset Width @@ -37456,7 +37463,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/opacity */ opacity: [{ - opacity: [$] + opacity: [B] }], /** * Mix Blend Mode @@ -37599,7 +37606,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/backdrop-opacity */ "backdrop-opacity": [{ - "backdrop-opacity": [$] + "backdrop-opacity": [B] }], /** * Backdrop Saturate @@ -38103,91 +38110,99 @@ function Oo(...t) { } function P9(t) { const { className: e } = t; - return /* @__PURE__ */ pe.jsxs("div", { className: Oo("xc-flex xc-items-center xc-gap-2"), children: [ - /* @__PURE__ */ pe.jsx("hr", { className: Oo("xc-flex-1 xc-border-gray-200", e) }), - /* @__PURE__ */ pe.jsx("div", { className: "xc-shrink-0", children: t.children }), - /* @__PURE__ */ pe.jsx("hr", { className: Oo("xc-flex-1 xc-border-gray-200", e) }) + return /* @__PURE__ */ le.jsxs("div", { className: Oo("xc-flex xc-items-center xc-gap-2"), children: [ + /* @__PURE__ */ le.jsx("hr", { className: Oo("xc-flex-1 xc-border-gray-200", e) }), + /* @__PURE__ */ le.jsx("div", { className: "xc-shrink-0", children: t.children }), + /* @__PURE__ */ le.jsx("hr", { className: Oo("xc-flex-1 xc-border-gray-200", e) }) + ] }); +} +function Mne(t) { + var n; + const { wallet: e, onClick: r } = t; + return /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4", children: [ + /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-h-16 xc-w-16", src: (n = e.config) == null ? void 0 : n.image, alt: "" }), + /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ + /* @__PURE__ */ le.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: "Connect to Binance Wallet" }), + /* @__PURE__ */ le.jsx("div", { className: "xc-flex xc-gap-2", children: /* @__PURE__ */ le.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: () => r(e), children: "Connect" }) }) + ] }) ] }); } -const Mne = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton"; -function Ine(t) { +const Ine = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton"; +function Cne(t) { const { onClick: e } = t; function r() { e && e(); } - return /* @__PURE__ */ pe.jsx(P9, { className: "xc-opacity-20", children: /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-cursor-pointer", onClick: r, children: [ - /* @__PURE__ */ pe.jsx("span", { className: "xc-text-sm", children: "View more wallets" }), - /* @__PURE__ */ pe.jsx(HS, { size: 16 }) + return /* @__PURE__ */ le.jsx(P9, { className: "xc-opacity-20", children: /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-cursor-pointer", onClick: r, children: [ + /* @__PURE__ */ le.jsx("span", { className: "xc-text-sm", children: "View more wallets" }), + /* @__PURE__ */ le.jsx(WS, { size: 16 }) ] }) }); } function M9(t) { - const [e, r] = Yt(""), { featuredWallets: n, initialized: i } = mp(), { onEmailConfirm: s, onSelectWallet: o, onSelectMoreWallets: a, onSelectTonConnect: u, config: l } = t, d = ci(() => n == null ? void 0 : n.find((L) => { - var $; - return (($ = L.config) == null ? void 0 : $.rdns) === "binance"; - }), [n]), p = ci(() => { - const L = /[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu, $ = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; - return !L.test(e) && $.test(e); + const [e, r] = Yt(""), { featuredWallets: n, initialized: i } = mp(), { onEmailConfirm: s, onSelectWallet: o, onSelectMoreWallets: a, onSelectTonConnect: u, config: l } = t, d = wi(() => { + const N = /[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu, L = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; + return !N.test(e) && L.test(e); }, [e]); - function w(L) { - o(L); + function p(N) { + o(N); } - function A(L) { - r(L.target.value); + function w(N) { + r(N.target.value); } - async function M() { + async function A() { s(e); } - function N(L) { - L.key === "Enter" && p && M(); + function M(N) { + N.key === "Enter" && d && A(); } - return /* @__PURE__ */ pe.jsx(Ms, { children: i && /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ - t.header || /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6 xc-text-xl xc-font-bold", children: "Log in or sign up" }), - d && /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: /* @__PURE__ */ pe.jsx( - hv, + return /* @__PURE__ */ le.jsx(Ms, { children: i && /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ + t.header || /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6 xc-text-xl xc-font-bold", children: "Log in or sign up" }), + n.length === 1 && /* @__PURE__ */ le.jsx("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: n.map((N) => /* @__PURE__ */ le.jsx( + Mne, { - wallet: d, - onClick: w + wallet: N, + onClick: p }, - `feature-${d.key}` - ) }), - !d && /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ - /* @__PURE__ */ pe.jsxs("div", { children: [ - /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: [ - l.showFeaturedWallets && n && n.map((L) => /* @__PURE__ */ pe.jsx( - hv, + `feature-${N.key}` + )) }), + n.length > 1 && /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ + /* @__PURE__ */ le.jsxs("div", { children: [ + /* @__PURE__ */ le.jsxs("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: [ + l.showFeaturedWallets && n && n.map((N) => /* @__PURE__ */ le.jsx( + y9, { - wallet: L, - onClick: w + wallet: N, + onClick: p }, - `feature-${L.key}` + `feature-${N.key}` )), - l.showTonConnect && /* @__PURE__ */ pe.jsx( - cy, + l.showTonConnect && /* @__PURE__ */ le.jsx( + ay, { - icon: /* @__PURE__ */ pe.jsx("img", { className: "xc-h-5 xc-w-5", src: Mne }), + icon: /* @__PURE__ */ le.jsx("img", { className: "xc-h-5 xc-w-5", src: Ine }), title: "TON Connect", onClick: u } ) ] }), - l.showMoreWallets && /* @__PURE__ */ pe.jsx(Ine, { onClick: a }) + l.showMoreWallets && /* @__PURE__ */ le.jsx(Cne, { onClick: a }) ] }), - l.showEmailSignIn && (l.showFeaturedWallets || l.showTonConnect) && /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4 xc-mt-4", children: /* @__PURE__ */ pe.jsxs(P9, { className: "xc-opacity-20", children: [ + l.showEmailSignIn && (l.showFeaturedWallets || l.showTonConnect) && /* @__PURE__ */ le.jsx("div", { className: "xc-mb-4 xc-mt-4", children: /* @__PURE__ */ le.jsxs(P9, { className: "xc-opacity-20", children: [ " ", - /* @__PURE__ */ pe.jsx("span", { className: "xc-text-sm xc-opacity-20", children: "OR" }) + /* @__PURE__ */ le.jsx("span", { className: "xc-text-sm xc-opacity-20", children: "OR" }) ] }) }), - l.showEmailSignIn && /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-4", children: [ - /* @__PURE__ */ pe.jsx("input", { className: "xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3", placeholder: "Enter your email", type: "email", onChange: A, onKeyDown: N }), - /* @__PURE__ */ pe.jsx("button", { disabled: !p, className: "xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all", onClick: M, children: "Continue" }) + l.showEmailSignIn && /* @__PURE__ */ le.jsxs("div", { className: "xc-mb-4", children: [ + /* @__PURE__ */ le.jsx("input", { className: "xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3", placeholder: "Enter your email", type: "email", onChange: w, onKeyDown: M }), + /* @__PURE__ */ le.jsx("button", { disabled: !d, className: "xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all", onClick: A, children: "Continue" }) ] }) ] }) ] }) }); } function Pc(t) { const { title: e } = t; - return /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2", children: [ - /* @__PURE__ */ pe.jsx(lZ, { onClick: t.onBack, size: 20, className: "xc-cursor-pointer" }), - /* @__PURE__ */ pe.jsx("span", { children: e }) + return /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2", children: [ + /* @__PURE__ */ le.jsx(lZ, { onClick: t.onBack, size: 20, className: "xc-cursor-pointer" }), + /* @__PURE__ */ le.jsx("span", { children: e }) ] }); } const I9 = Sa({ @@ -38197,14 +38212,14 @@ const I9 = Sa({ inviterCode: "", role: "C" }); -function fy() { +function uy() { return Tn(I9); } -function Cne(t) { +function Tne(t) { const { config: e } = t, [r, n] = Yt(e.channel), [i, s] = Yt(e.device), [o, a] = Yt(e.app), [u, l] = Yt(e.role || "C"), [d, p] = Yt(e.inviterCode); return Dn(() => { n(e.channel), s(e.device), a(e.app), p(e.inviterCode), l(e.role || "C"); - }, [e]), /* @__PURE__ */ pe.jsx( + }, [e]), /* @__PURE__ */ le.jsx( I9.Provider, { value: { @@ -38218,33 +38233,33 @@ function Cne(t) { } ); } -var Tne = Object.defineProperty, Rne = Object.defineProperties, Dne = Object.getOwnPropertyDescriptors, S0 = Object.getOwnPropertySymbols, C9 = Object.prototype.hasOwnProperty, T9 = Object.prototype.propertyIsEnumerable, l5 = (t, e, r) => e in t ? Tne(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, One = (t, e) => { - for (var r in e || (e = {})) C9.call(e, r) && l5(t, r, e[r]); - if (S0) for (var r of S0(e)) T9.call(e, r) && l5(t, r, e[r]); +var Rne = Object.defineProperty, Dne = Object.defineProperties, One = Object.getOwnPropertyDescriptors, S0 = Object.getOwnPropertySymbols, C9 = Object.prototype.hasOwnProperty, T9 = Object.prototype.propertyIsEnumerable, f5 = (t, e, r) => e in t ? Rne(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Nne = (t, e) => { + for (var r in e || (e = {})) C9.call(e, r) && f5(t, r, e[r]); + if (S0) for (var r of S0(e)) T9.call(e, r) && f5(t, r, e[r]); return t; -}, Nne = (t, e) => Rne(t, Dne(e)), Lne = (t, e) => { +}, Lne = (t, e) => Dne(t, One(e)), kne = (t, e) => { var r = {}; for (var n in t) C9.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); if (t != null && S0) for (var n of S0(t)) e.indexOf(n) < 0 && T9.call(t, n) && (r[n] = t[n]); return r; }; -function kne(t) { +function $ne(t) { let e = setTimeout(t, 0), r = setTimeout(t, 10), n = setTimeout(t, 50); return [e, r, n]; } -function $ne(t) { +function Bne(t) { let e = Gt.useRef(); return Gt.useEffect(() => { e.current = t; }), e.current; } -var Bne = 18, R9 = 40, Fne = `${R9}px`, jne = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(","); -function Une({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isFocused: n }) { +var Fne = 18, R9 = 40, jne = `${R9}px`, Une = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(","); +function qne({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isFocused: n }) { let [i, s] = Gt.useState(!1), [o, a] = Gt.useState(!1), [u, l] = Gt.useState(!1), d = Gt.useMemo(() => r === "none" ? !1 : (r === "increase-width" || r === "experimental-no-flickering") && i && o, [i, o, r]), p = Gt.useCallback(() => { let w = t.current, A = e.current; if (!w || !A || u || r === "none") return; - let M = w, N = M.getBoundingClientRect().left + M.offsetWidth, L = M.getBoundingClientRect().top + M.offsetHeight / 2, $ = N - Bne, B = L; - document.querySelectorAll(jne).length === 0 && document.elementFromPoint($, B) === w || (s(!0), l(!0)); + let M = w, N = M.getBoundingClientRect().left + M.offsetWidth, L = M.getBoundingClientRect().top + M.offsetHeight / 2, B = N - Fne, $ = L; + document.querySelectorAll(Une).length === 0 && document.elementFromPoint(B, $) === w || (s(!0), l(!0)); }, [t, e, u, r]); return Gt.useEffect(() => { let w = t.current; @@ -38267,13 +38282,13 @@ function Une({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isF return () => { clearTimeout(A), clearTimeout(M), clearTimeout(N), clearTimeout(L); }; - }, [e, n, r, p]), { hasPWMBadge: i, willPushPWMBadge: d, PWM_BADGE_SPACE_WIDTH: Fne }; + }, [e, n, r, p]), { hasPWMBadge: i, willPushPWMBadge: d, PWM_BADGE_SPACE_WIDTH: jne }; } var D9 = Gt.createContext({}), O9 = Gt.forwardRef((t, e) => { - var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: u, inputMode: l = "numeric", onComplete: d, pushPasswordManagerStrategy: p = "increase-width", pasteTransformer: w, containerClassName: A, noScriptCSSFallback: M = qne, render: N, children: L } = r, $ = Lne(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), B, H, U, V, te; - let [R, K] = Gt.useState(typeof $.defaultValue == "string" ? $.defaultValue : ""), ge = n ?? R, Ee = $ne(ge), Y = Gt.useCallback((ie) => { + var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: u, inputMode: l = "numeric", onComplete: d, pushPasswordManagerStrategy: p = "increase-width", pasteTransformer: w, containerClassName: A, noScriptCSSFallback: M = zne, render: N, children: L } = r, B = kne(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), $, H, U, V, te; + let [R, K] = Gt.useState(typeof B.defaultValue == "string" ? B.defaultValue : ""), ge = n ?? R, Ee = Bne(ge), Y = Gt.useCallback((ie) => { i == null || i(ie), K(ie); - }, [i]), S = Gt.useMemo(() => a ? typeof a == "string" ? new RegExp(a) : a : null, [a]), m = Gt.useRef(null), f = Gt.useRef(null), g = Gt.useRef({ value: ge, onChange: Y, isIOS: typeof window < "u" && ((H = (B = window == null ? void 0 : window.CSS) == null ? void 0 : B.supports) == null ? void 0 : H.call(B, "-webkit-touch-callout", "none")) }), b = Gt.useRef({ prev: [(U = m.current) == null ? void 0 : U.selectionStart, (V = m.current) == null ? void 0 : V.selectionEnd, (te = m.current) == null ? void 0 : te.selectionDirection] }); + }, [i]), S = Gt.useMemo(() => a ? typeof a == "string" ? new RegExp(a) : a : null, [a]), m = Gt.useRef(null), f = Gt.useRef(null), g = Gt.useRef({ value: ge, onChange: Y, isIOS: typeof window < "u" && ((H = ($ = window == null ? void 0 : window.CSS) == null ? void 0 : $.supports) == null ? void 0 : H.call($, "-webkit-touch-callout", "none")) }), b = Gt.useRef({ prev: [(U = m.current) == null ? void 0 : U.selectionStart, (V = m.current) == null ? void 0 : V.selectionEnd, (te = m.current) == null ? void 0 : te.selectionDirection] }); Gt.useImperativeHandle(e, () => m.current, []), Gt.useEffect(() => { let ie = m.current, ue = f.current; if (!ie || !ue) return; @@ -38323,7 +38338,7 @@ var D9 = Gt.createContext({}), O9 = Gt.forwardRef((t, e) => { }, []); let [x, _] = Gt.useState(!1), [E, v] = Gt.useState(!1), [P, I] = Gt.useState(null), [F, ce] = Gt.useState(null); Gt.useEffect(() => { - kne(() => { + $ne(() => { var ie, ue, ve, Pe; (ie = m.current) == null || ie.dispatchEvent(new Event("input")); let De = (ue = m.current) == null ? void 0 : ue.selectionStart, Ce = (ve = m.current) == null ? void 0 : ve.selectionEnd, $e = (Pe = m.current) == null ? void 0 : Pe.selectionDirection; @@ -38332,7 +38347,7 @@ var D9 = Gt.createContext({}), O9 = Gt.forwardRef((t, e) => { }, [ge, E]), Gt.useEffect(() => { Ee !== void 0 && ge !== Ee && Ee.length < s && ge.length === s && (d == null || d(ge)); }, [s, d, Ee, ge]); - let D = Une({ containerRef: f, inputRef: m, pushPasswordManagerStrategy: p, isFocused: E }), oe = Gt.useCallback((ie) => { + let D = qne({ containerRef: f, inputRef: m, pushPasswordManagerStrategy: p, isFocused: E }), oe = Gt.useCallback((ie) => { let ue = ie.currentTarget.value.slice(0, s); if (ue.length > 0 && S && !S.test(ue)) { ie.preventDefault(); @@ -38357,27 +38372,27 @@ var D9 = Gt.createContext({}), O9 = Gt.forwardRef((t, e) => { Pe.value = Ne, Y(Ne); let Ke = Math.min(Ne.length, s - 1), Le = Ne.length; Pe.setSelectionRange(Ke, Le), I(Ke), ce(Le); - }, [s, Y, S, ge]), Q = Gt.useMemo(() => ({ position: "relative", cursor: $.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [$.disabled]), T = Gt.useMemo(() => ({ position: "absolute", inset: 0, width: D.willPushPWMBadge ? `calc(100% + ${D.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: D.willPushPWMBadge ? `inset(0 ${D.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: o, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [D.PWM_BADGE_SPACE_WIDTH, D.willPushPWMBadge, o]), X = Gt.useMemo(() => Gt.createElement("input", Nne(One({ autoComplete: $.autoComplete || "one-time-code" }, $), { "data-input-otp": !0, "data-input-otp-placeholder-shown": ge.length === 0 || void 0, "data-input-otp-mss": P, "data-input-otp-mse": F, inputMode: l, pattern: S == null ? void 0 : S.source, "aria-placeholder": u, style: T, maxLength: s, value: ge, ref: m, onPaste: (ie) => { + }, [s, Y, S, ge]), Q = Gt.useMemo(() => ({ position: "relative", cursor: B.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [B.disabled]), T = Gt.useMemo(() => ({ position: "absolute", inset: 0, width: D.willPushPWMBadge ? `calc(100% + ${D.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: D.willPushPWMBadge ? `inset(0 ${D.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: o, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [D.PWM_BADGE_SPACE_WIDTH, D.willPushPWMBadge, o]), X = Gt.useMemo(() => Gt.createElement("input", Lne(Nne({ autoComplete: B.autoComplete || "one-time-code" }, B), { "data-input-otp": !0, "data-input-otp-placeholder-shown": ge.length === 0 || void 0, "data-input-otp-mss": P, "data-input-otp-mse": F, inputMode: l, pattern: S == null ? void 0 : S.source, "aria-placeholder": u, style: T, maxLength: s, value: ge, ref: m, onPaste: (ie) => { var ue; - J(ie), (ue = $.onPaste) == null || ue.call($, ie); + J(ie), (ue = B.onPaste) == null || ue.call(B, ie); }, onChange: oe, onMouseOver: (ie) => { var ue; - _(!0), (ue = $.onMouseOver) == null || ue.call($, ie); + _(!0), (ue = B.onMouseOver) == null || ue.call(B, ie); }, onMouseLeave: (ie) => { var ue; - _(!1), (ue = $.onMouseLeave) == null || ue.call($, ie); + _(!1), (ue = B.onMouseLeave) == null || ue.call(B, ie); }, onFocus: (ie) => { var ue; - Z(), (ue = $.onFocus) == null || ue.call($, ie); + Z(), (ue = B.onFocus) == null || ue.call(B, ie); }, onBlur: (ie) => { var ue; - v(!1), (ue = $.onBlur) == null || ue.call($, ie); - } })), [oe, Z, J, l, T, s, F, P, $, S == null ? void 0 : S.source, ge]), re = Gt.useMemo(() => ({ slots: Array.from({ length: s }).map((ie, ue) => { + v(!1), (ue = B.onBlur) == null || ue.call(B, ie); + } })), [oe, Z, J, l, T, s, F, P, B, S == null ? void 0 : S.source, ge]), re = Gt.useMemo(() => ({ slots: Array.from({ length: s }).map((ie, ue) => { var ve; let Pe = E && P !== null && F !== null && (P === F && ue === P || ue >= P && ue < F), De = ge[ue] !== void 0 ? ge[ue] : null, Ce = ge[0] !== void 0 ? null : (ve = u == null ? void 0 : u[ue]) != null ? ve : null; return { char: De, placeholderChar: Ce, isActive: Pe, hasFakeCaret: Pe && De === null }; - }), isFocused: E, isHovering: !$.disabled && x }), [E, x, s, F, P, $.disabled, ge]), de = Gt.useMemo(() => N ? N(re) : Gt.createElement(D9.Provider, { value: re }, L), [L, re, N]); - return Gt.createElement(Gt.Fragment, null, M !== null && Gt.createElement("noscript", null, Gt.createElement("style", null, M)), Gt.createElement("div", { ref: f, "data-input-otp-container": !0, style: Q, className: A }, de, Gt.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, X))); + }), isFocused: E, isHovering: !B.disabled && x }), [E, x, s, F, P, B.disabled, ge]), pe = Gt.useMemo(() => N ? N(re) : Gt.createElement(D9.Provider, { value: re }, L), [L, re, N]); + return Gt.createElement(Gt.Fragment, null, M !== null && Gt.createElement("noscript", null, Gt.createElement("style", null, M)), Gt.createElement("div", { ref: f, "data-input-otp-container": !0, style: Q, className: A }, pe, Gt.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, X))); }); O9.displayName = "Input"; function kf(t, e) { @@ -38387,7 +38402,7 @@ function kf(t, e) { console.error("input-otp could not insert CSS rule:", e); } } -var qne = ` +var zne = ` [data-input-otp] { --nojs-bg: white !important; --nojs-fg: black !important; @@ -38407,7 +38422,7 @@ var qne = ` --nojs-fg: white !important; } }`; -const N9 = Gt.forwardRef(({ className: t, containerClassName: e, ...r }, n) => /* @__PURE__ */ pe.jsx( +const N9 = Gt.forwardRef(({ className: t, containerClassName: e, ...r }, n) => /* @__PURE__ */ le.jsx( O9, { ref: n, @@ -38420,11 +38435,11 @@ const N9 = Gt.forwardRef(({ className: t, containerClassName: e, ...r }, n) => / } )); N9.displayName = "InputOTP"; -const L9 = Gt.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ pe.jsx("div", { ref: r, className: Oo("xc-flex xc-items-center", t), ...e })); +const L9 = Gt.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ le.jsx("div", { ref: r, className: Oo("xc-flex xc-items-center", t), ...e })); L9.displayName = "InputOTPGroup"; const Xa = Gt.forwardRef(({ index: t, className: e, ...r }, n) => { const i = Gt.useContext(D9), { char: s, hasFakeCaret: o, isActive: a } = i.slots[t]; - return /* @__PURE__ */ pe.jsxs( + return /* @__PURE__ */ le.jsxs( "div", { ref: n, @@ -38436,17 +38451,17 @@ const Xa = Gt.forwardRef(({ index: t, className: e, ...r }, n) => { ...r, children: [ s, - o && /* @__PURE__ */ pe.jsx("div", { className: "xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center", children: /* @__PURE__ */ pe.jsx("div", { className: "xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000" }) }) + o && /* @__PURE__ */ le.jsx("div", { className: "xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center", children: /* @__PURE__ */ le.jsx("div", { className: "xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000" }) }) ] } ); }); Xa.displayName = "InputOTPSlot"; -function zne(t) { +function Wne(t) { const { spinning: e, children: r, className: n } = t; - return /* @__PURE__ */ pe.jsxs("div", { className: "xc-inline-block xc-relative", children: [ + return /* @__PURE__ */ le.jsxs("div", { className: "xc-inline-block xc-relative", children: [ r, - e && /* @__PURE__ */ pe.jsx("div", { className: Oo("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center", n), children: /* @__PURE__ */ pe.jsx(mc, { className: "xc-animate-spin" }) }) + e && /* @__PURE__ */ le.jsx("div", { className: Oo("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center", n), children: /* @__PURE__ */ le.jsx(mc, { className: "xc-animate-spin" }) }) ] }); } function k9(t) { @@ -38470,32 +38485,32 @@ function k9(t) { } return Dn(() => { u(); - }, []), /* @__PURE__ */ pe.jsxs(Ms, { children: [ - /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ - /* @__PURE__ */ pe.jsx(vZ, { className: "xc-mb-4", size: 60 }), - /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16", children: [ - /* @__PURE__ */ pe.jsx("p", { className: "xc-text-lg xc-mb-1", children: "We’ve sent a verification code to" }), - /* @__PURE__ */ pe.jsx("p", { className: "xc-font-bold xc-text-center", children: e }) + }, []), /* @__PURE__ */ le.jsxs(Ms, { children: [ + /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ + /* @__PURE__ */ le.jsx(vZ, { className: "xc-mb-4", size: 60 }), + /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16", children: [ + /* @__PURE__ */ le.jsx("p", { className: "xc-text-lg xc-mb-1", children: "We’ve sent a verification code to" }), + /* @__PURE__ */ le.jsx("p", { className: "xc-font-bold xc-text-center", children: e }) ] }), - /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-2 xc-h-12", children: /* @__PURE__ */ pe.jsx(zne, { spinning: i, className: "xc-rounded-xl", children: /* @__PURE__ */ pe.jsx(N9, { maxLength: 6, onChange: l, disabled: i, className: "disabled:xc-opacity-20", children: /* @__PURE__ */ pe.jsx(L9, { children: /* @__PURE__ */ pe.jsxs("div", { className: Oo("xc-flex xc-gap-2", i ? "xc-opacity-20" : ""), children: [ - /* @__PURE__ */ pe.jsx(Xa, { index: 0 }), - /* @__PURE__ */ pe.jsx(Xa, { index: 1 }), - /* @__PURE__ */ pe.jsx(Xa, { index: 2 }), - /* @__PURE__ */ pe.jsx(Xa, { index: 3 }), - /* @__PURE__ */ pe.jsx(Xa, { index: 4 }), - /* @__PURE__ */ pe.jsx(Xa, { index: 5 }) + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-2 xc-h-12", children: /* @__PURE__ */ le.jsx(Wne, { spinning: i, className: "xc-rounded-xl", children: /* @__PURE__ */ le.jsx(N9, { maxLength: 6, onChange: l, disabled: i, className: "disabled:xc-opacity-20", children: /* @__PURE__ */ le.jsx(L9, { children: /* @__PURE__ */ le.jsxs("div", { className: Oo("xc-flex xc-gap-2", i ? "xc-opacity-20" : ""), children: [ + /* @__PURE__ */ le.jsx(Xa, { index: 0 }), + /* @__PURE__ */ le.jsx(Xa, { index: 1 }), + /* @__PURE__ */ le.jsx(Xa, { index: 2 }), + /* @__PURE__ */ le.jsx(Xa, { index: 3 }), + /* @__PURE__ */ le.jsx(Xa, { index: 4 }), + /* @__PURE__ */ le.jsx(Xa, { index: 5 }) ] }) }) }) }) }), - o && /* @__PURE__ */ pe.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ pe.jsx("p", { children: o }) }) + o && /* @__PURE__ */ le.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ le.jsx("p", { children: o }) }) ] }), - /* @__PURE__ */ pe.jsxs("div", { className: "xc-text-center xc-text-sm xc-text-gray-400", children: [ + /* @__PURE__ */ le.jsxs("div", { className: "xc-text-center xc-text-sm xc-text-gray-400", children: [ "Not get it? ", - r ? `Resend in ${r}s` : /* @__PURE__ */ pe.jsx("button", { id: "sendCodeButton", onClick: t.onResendCode, children: "Send again" }) + r ? `Resend in ${r}s` : /* @__PURE__ */ le.jsx("button", { id: "sendCodeButton", onClick: t.onResendCode, children: "Send again" }) ] }), - /* @__PURE__ */ pe.jsx("div", { id: "captcha-element" }) + /* @__PURE__ */ le.jsx("div", { id: "captcha-element" }) ] }); } function $9(t) { - const { email: e } = t, [r, n] = Yt(!1), [i, s] = Yt(""), o = ci(() => `xn-btn-${(/* @__PURE__ */ new Date()).getTime()}`, [e]); + const { email: e } = t, [r, n] = Yt(!1), [i, s] = Yt(""), o = wi(() => `xn-btn-${(/* @__PURE__ */ new Date()).getTime()}`, [e]); async function a(w, A) { n(!0), s(""), await Ta.getEmailCode({ account_type: "email", email: w }, A), n(!1); } @@ -38534,16 +38549,16 @@ function $9(t) { var w, A; (w = document.getElementById("aliyunCaptcha-mask")) == null || w.remove(), (A = document.getElementById("aliyunCaptcha-window-popup")) == null || A.remove(); }; - }, [e]), /* @__PURE__ */ pe.jsxs(Ms, { children: [ - /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ - /* @__PURE__ */ pe.jsx(bZ, { className: "xc-mb-4", size: 60 }), - /* @__PURE__ */ pe.jsx("button", { className: "xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2", id: o, children: r ? /* @__PURE__ */ pe.jsx(mc, { className: "xc-animate-spin" }) : "I'm not a robot" }) + }, [e]), /* @__PURE__ */ le.jsxs(Ms, { children: [ + /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ + /* @__PURE__ */ le.jsx(bZ, { className: "xc-mb-4", size: 60 }), + /* @__PURE__ */ le.jsx("button", { className: "xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2", id: o, children: r ? /* @__PURE__ */ le.jsx(mc, { className: "xc-animate-spin" }) : "I'm not a robot" }) ] }), - i && /* @__PURE__ */ pe.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ pe.jsx("p", { children: i }) }) + i && /* @__PURE__ */ le.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ le.jsx("p", { children: i }) }) ] }); } -function Wne(t) { - const { email: e } = t, r = fy(), [n, i] = Yt("captcha"); +function Hne(t) { + const { email: e } = t, r = uy(), [n, i] = Yt("captcha"); async function s(o, a) { const u = await Ta.emailLogin({ account_type: "email", @@ -38560,10 +38575,10 @@ function Wne(t) { }); t.onLogin(u.data); } - return /* @__PURE__ */ pe.jsxs(Ms, { children: [ - /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ pe.jsx(Pc, { title: "Sign in with email", onBack: t.onBack }) }), - n === "captcha" && /* @__PURE__ */ pe.jsx($9, { email: e, onCodeSend: () => i("verify-email") }), - n === "verify-email" && /* @__PURE__ */ pe.jsx(k9, { email: e, onInputCode: s, onResendCode: () => i("captcha") }) + return /* @__PURE__ */ le.jsxs(Ms, { children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ le.jsx(Pc, { title: "Sign in with email", onBack: t.onBack }) }), + n === "captcha" && /* @__PURE__ */ le.jsx($9, { email: e, onCodeSend: () => i("verify-email") }), + n === "verify-email" && /* @__PURE__ */ le.jsx(k9, { email: e, onInputCode: s, onResendCode: () => i("captcha") }) ] }); } var B9 = { exports: {} }; @@ -38574,39 +38589,39 @@ var B9 = { exports: {} }; var r = { 873: (o, a) => { var u, l, d = function() { var p = function(f, g) { - var b = f, x = $[g], _ = null, E = 0, v = null, P = [], I = {}, F = function(re, de) { + var b = f, x = B[g], _ = null, E = 0, v = null, P = [], I = {}, F = function(re, pe) { _ = function(ie) { for (var ue = new Array(ie), ve = 0; ve < ie; ve += 1) { ue[ve] = new Array(ie); for (var Pe = 0; Pe < ie; Pe += 1) ue[ve][Pe] = null; } return ue; - }(E = 4 * b + 17), ce(0, 0), ce(E - 7, 0), ce(0, E - 7), oe(), D(), J(re, de), b >= 7 && Z(re), v == null && (v = T(b, x, P)), Q(v, de); - }, ce = function(re, de) { - for (var ie = -1; ie <= 7; ie += 1) if (!(re + ie <= -1 || E <= re + ie)) for (var ue = -1; ue <= 7; ue += 1) de + ue <= -1 || E <= de + ue || (_[re + ie][de + ue] = 0 <= ie && ie <= 6 && (ue == 0 || ue == 6) || 0 <= ue && ue <= 6 && (ie == 0 || ie == 6) || 2 <= ie && ie <= 4 && 2 <= ue && ue <= 4); + }(E = 4 * b + 17), ce(0, 0), ce(E - 7, 0), ce(0, E - 7), oe(), D(), J(re, pe), b >= 7 && Z(re), v == null && (v = T(b, x, P)), Q(v, pe); + }, ce = function(re, pe) { + for (var ie = -1; ie <= 7; ie += 1) if (!(re + ie <= -1 || E <= re + ie)) for (var ue = -1; ue <= 7; ue += 1) pe + ue <= -1 || E <= pe + ue || (_[re + ie][pe + ue] = 0 <= ie && ie <= 6 && (ue == 0 || ue == 6) || 0 <= ue && ue <= 6 && (ie == 0 || ie == 6) || 2 <= ie && ie <= 4 && 2 <= ue && ue <= 4); }, D = function() { for (var re = 8; re < E - 8; re += 1) _[re][6] == null && (_[re][6] = re % 2 == 0); - for (var de = 8; de < E - 8; de += 1) _[6][de] == null && (_[6][de] = de % 2 == 0); + for (var pe = 8; pe < E - 8; pe += 1) _[6][pe] == null && (_[6][pe] = pe % 2 == 0); }, oe = function() { - for (var re = B.getPatternPosition(b), de = 0; de < re.length; de += 1) for (var ie = 0; ie < re.length; ie += 1) { - var ue = re[de], ve = re[ie]; + for (var re = $.getPatternPosition(b), pe = 0; pe < re.length; pe += 1) for (var ie = 0; ie < re.length; ie += 1) { + var ue = re[pe], ve = re[ie]; if (_[ue][ve] == null) for (var Pe = -2; Pe <= 2; Pe += 1) for (var De = -2; De <= 2; De += 1) _[ue + Pe][ve + De] = Pe == -2 || Pe == 2 || De == -2 || De == 2 || Pe == 0 && De == 0; } }, Z = function(re) { - for (var de = B.getBCHTypeNumber(b), ie = 0; ie < 18; ie += 1) { - var ue = !re && (de >> ie & 1) == 1; + for (var pe = $.getBCHTypeNumber(b), ie = 0; ie < 18; ie += 1) { + var ue = !re && (pe >> ie & 1) == 1; _[Math.floor(ie / 3)][ie % 3 + E - 8 - 3] = ue; } - for (ie = 0; ie < 18; ie += 1) ue = !re && (de >> ie & 1) == 1, _[ie % 3 + E - 8 - 3][Math.floor(ie / 3)] = ue; - }, J = function(re, de) { - for (var ie = x << 3 | de, ue = B.getBCHTypeInfo(ie), ve = 0; ve < 15; ve += 1) { + for (ie = 0; ie < 18; ie += 1) ue = !re && (pe >> ie & 1) == 1, _[ie % 3 + E - 8 - 3][Math.floor(ie / 3)] = ue; + }, J = function(re, pe) { + for (var ie = x << 3 | pe, ue = $.getBCHTypeInfo(ie), ve = 0; ve < 15; ve += 1) { var Pe = !re && (ue >> ve & 1) == 1; ve < 6 ? _[ve][8] = Pe : ve < 8 ? _[ve + 1][8] = Pe : _[E - 15 + ve][8] = Pe; } for (ve = 0; ve < 15; ve += 1) Pe = !re && (ue >> ve & 1) == 1, ve < 8 ? _[8][E - ve - 1] = Pe : ve < 9 ? _[8][15 - ve - 1 + 1] = Pe : _[8][15 - ve - 1] = Pe; _[E - 8][8] = !re; - }, Q = function(re, de) { - for (var ie = -1, ue = E - 1, ve = 7, Pe = 0, De = B.getMaskFunction(de), Ce = E - 1; Ce > 0; Ce -= 2) for (Ce == 6 && (Ce -= 1); ; ) { + }, Q = function(re, pe) { + for (var ie = -1, ue = E - 1, ve = 7, Pe = 0, De = $.getMaskFunction(pe), Ce = E - 1; Ce > 0; Ce -= 2) for (Ce == 6 && (Ce -= 1); ; ) { for (var $e = 0; $e < 2; $e += 1) if (_[ue][Ce - $e] == null) { var Me = !1; Pe < re.length && (Me = (re[Pe] >>> ve & 1) == 1), De(ue, Ce - $e) && (Me = !Me), _[ue][Ce - $e] = Me, (ve -= 1) == -1 && (Pe += 1, ve = 7); @@ -38616,10 +38631,10 @@ var B9 = { exports: {} }; break; } } - }, T = function(re, de, ie) { - for (var ue = V.getRSBlocks(re, de), ve = te(), Pe = 0; Pe < ie.length; Pe += 1) { + }, T = function(re, pe, ie) { + for (var ue = V.getRSBlocks(re, pe), ve = te(), Pe = 0; Pe < ie.length; Pe += 1) { var De = ie[Pe]; - ve.put(De.getMode(), 4), ve.put(De.getLength(), B.getLengthInBits(De.getMode(), re)), De.write(ve); + ve.put(De.getMode(), 4), ve.put(De.getLength(), $.getLengthInBits(De.getMode(), re)), De.write(ve); } var Ce = 0; for (Pe = 0; Pe < ue.length; Pe += 1) Ce += ue[Pe].dataCount; @@ -38632,7 +38647,7 @@ var B9 = { exports: {} }; Ke = Math.max(Ke, Ze), Le = Math.max(Le, at), qe[_e] = new Array(Ze); for (var ke = 0; ke < qe[_e].length; ke += 1) qe[_e][ke] = 255 & $e.getBuffer()[ke + Ne]; Ne += Ze; - var Qe = B.getErrorCorrectPolynomial(at), tt = U(qe[_e], Qe.getLength() - 1).mod(Qe); + var Qe = $.getErrorCorrectPolynomial(at), tt = U(qe[_e], Qe.getLength() - 1).mod(Qe); for (ze[_e] = new Array(Qe.getLength() - 1), ke = 0; ke < ze[_e].length; ke += 1) { var Ye = ke + tt.getLength() - ze[_e].length; ze[_e][ke] = Ye >= 0 ? tt.getAt(Ye) : 0; @@ -38646,9 +38661,9 @@ var B9 = { exports: {} }; return lt; }(ve, ue); }; - I.addData = function(re, de) { + I.addData = function(re, pe) { var ie = null; - switch (de = de || "Byte") { + switch (pe = pe || "Byte") { case "Numeric": ie = R(re); break; @@ -38662,23 +38677,23 @@ var B9 = { exports: {} }; ie = Ee(re); break; default: - throw "mode:" + de; + throw "mode:" + pe; } P.push(ie), v = null; - }, I.isDark = function(re, de) { - if (re < 0 || E <= re || de < 0 || E <= de) throw re + "," + de; - return _[re][de]; + }, I.isDark = function(re, pe) { + if (re < 0 || E <= re || pe < 0 || E <= pe) throw re + "," + pe; + return _[re][pe]; }, I.getModuleCount = function() { return E; }, I.make = function() { if (b < 1) { for (var re = 1; re < 40; re++) { - for (var de = V.getRSBlocks(re, x), ie = te(), ue = 0; ue < P.length; ue++) { + for (var pe = V.getRSBlocks(re, x), ie = te(), ue = 0; ue < P.length; ue++) { var ve = P[ue]; - ie.put(ve.getMode(), 4), ie.put(ve.getLength(), B.getLengthInBits(ve.getMode(), re)), ve.write(ie); + ie.put(ve.getMode(), 4), ie.put(ve.getLength(), $.getLengthInBits(ve.getMode(), re)), ve.write(ie); } var Pe = 0; - for (ue = 0; ue < de.length; ue++) Pe += de[ue].dataCount; + for (ue = 0; ue < pe.length; ue++) Pe += pe[ue].dataCount; if (ie.getLengthInBits() <= 8 * Pe) break; } b = re; @@ -38686,30 +38701,30 @@ var B9 = { exports: {} }; F(!1, function() { for (var De = 0, Ce = 0, $e = 0; $e < 8; $e += 1) { F(!0, $e); - var Me = B.getLostPoint(I); + var Me = $.getLostPoint(I); ($e == 0 || De > Me) && (De = Me, Ce = $e); } return Ce; }()); - }, I.createTableTag = function(re, de) { + }, I.createTableTag = function(re, pe) { re = re || 2; var ie = ""; - ie += '"; - }, I.createSvgTag = function(re, de, ie, ue) { + }, I.createSvgTag = function(re, pe, ie, ue) { var ve = {}; - typeof arguments[0] == "object" && (re = (ve = arguments[0]).cellSize, de = ve.margin, ie = ve.alt, ue = ve.title), re = re || 2, de = de === void 0 ? 4 * re : de, (ie = typeof ie == "string" ? { text: ie } : ie || {}).text = ie.text || null, ie.id = ie.text ? ie.id || "qrcode-description" : null, (ue = typeof ue == "string" ? { text: ue } : ue || {}).text = ue.text || null, ue.id = ue.text ? ue.id || "qrcode-title" : null; - var Pe, De, Ce, $e, Me = I.getModuleCount() * re + 2 * de, Ne = ""; - for ($e = "l" + re + ",0 0," + re + " -" + re + ",0 0,-" + re + "z ", Ne += '' + X(ue.text) + "" : "", Ne += ie.text ? '' + X(ie.text) + "" : "", Ne += '', Ne += '' + X(ue.text) + "" : "", Ne += ie.text ? '' + X(ie.text) + "" : "", Ne += '', Ne += '"; - }, I.createDataURL = function(re, de) { - re = re || 2, de = de === void 0 ? 4 * re : de; - var ie = I.getModuleCount() * re + 2 * de, ue = de, ve = ie - de; + }, I.createDataURL = function(re, pe) { + re = re || 2, pe = pe === void 0 ? 4 * re : pe; + var ie = I.getModuleCount() * re + 2 * pe, ue = pe, ve = ie - pe; return m(ie, ie, function(Pe, De) { if (ue <= Pe && Pe < ve && ue <= De && De < ve) { var Ce = Math.floor((Pe - ue) / re), $e = Math.floor((De - ue) / re); @@ -38717,34 +38732,34 @@ var B9 = { exports: {} }; } return 1; }); - }, I.createImgTag = function(re, de, ie) { - re = re || 2, de = de === void 0 ? 4 * re : de; - var ue = I.getModuleCount() * re + 2 * de, ve = ""; - return ve += ""; + }, I.createImgTag = function(re, pe, ie) { + re = re || 2, pe = pe === void 0 ? 4 * re : pe; + var ue = I.getModuleCount() * re + 2 * pe, ve = ""; + return ve += ""; }; var X = function(re) { - for (var de = "", ie = 0; ie < re.length; ie += 1) { + for (var pe = "", ie = 0; ie < re.length; ie += 1) { var ue = re.charAt(ie); switch (ue) { case "<": - de += "<"; + pe += "<"; break; case ">": - de += ">"; + pe += ">"; break; case "&": - de += "&"; + pe += "&"; break; case '"': - de += """; + pe += """; break; default: - de += ue; + pe += ue; } } - return de; + return pe; }; - return I.createASCII = function(re, de) { + return I.createASCII = function(re, pe) { if ((re = re || 1) < 2) return function(qe) { qe = qe === void 0 ? 2 : qe; var ze, _e, Ze, at, ke, Qe = 1 * I.getModuleCount() + 2 * qe, tt = qe, Ye = Qe - qe, dt = { "██": "█", "█ ": "▀", " █": "▄", " ": " " }, lt = { "██": "▀", "█ ": "▀", " █": " ", " ": " " }, ct = ""; @@ -38754,18 +38769,18 @@ var B9 = { exports: {} }; `; } return Qe % 2 && qe > 0 ? ct.substring(0, ct.length - Qe - 1) + Array(Qe + 1).join("▀") : ct.substring(0, ct.length - 1); - }(de); - re -= 1, de = de === void 0 ? 2 * re : de; - var ie, ue, ve, Pe, De = I.getModuleCount() * re + 2 * de, Ce = de, $e = De - de, Me = Array(re + 1).join("██"), Ne = Array(re + 1).join(" "), Ke = "", Le = ""; + }(pe); + re -= 1, pe = pe === void 0 ? 2 * re : pe; + var ie, ue, ve, Pe, De = I.getModuleCount() * re + 2 * pe, Ce = pe, $e = De - pe, Me = Array(re + 1).join("██"), Ne = Array(re + 1).join(" "), Ke = "", Le = ""; for (ie = 0; ie < De; ie += 1) { for (ve = Math.floor((ie - Ce) / re), Le = "", ue = 0; ue < De; ue += 1) Pe = 1, Ce <= ue && ue < $e && Ce <= ie && ie < $e && I.isDark(ve, Math.floor((ue - Ce) / re)) && (Pe = 0), Le += Pe ? Me : Ne; for (ve = 0; ve < re; ve += 1) Ke += Le + ` `; } return Ke.substring(0, Ke.length - 1); - }, I.renderTo2dContext = function(re, de) { - de = de || 2; - for (var ie = I.getModuleCount(), ue = 0; ue < ie; ue++) for (var ve = 0; ve < ie; ve++) re.fillStyle = I.isDark(ue, ve) ? "black" : "white", re.fillRect(ue * de, ve * de, de, de); + }, I.renderTo2dContext = function(re, pe) { + pe = pe || 2; + for (var ie = I.getModuleCount(), ue = 0; ue < ie; ue++) for (var ve = 0; ve < ie; ve++) re.fillStyle = I.isDark(ue, ve) ? "black" : "white", re.fillRect(ue * pe, ve * pe, pe, pe); }, I; }; p.stringToBytes = (p.stringToBytesFuncs = { default: function(f) { @@ -38801,7 +38816,7 @@ var B9 = { exports: {} }; return E; }; }; - var w, A, M, N, L, $ = { L: 1, M: 0, Q: 3, H: 2 }, B = (w = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], A = 1335, M = 7973, L = function(f) { + var w, A, M, N, L, B = { L: 1, M: 0, Q: 3, H: 2 }, $ = (w = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], A = 1335, M = 7973, L = function(f) { for (var g = 0; f != 0; ) g += 1, f >>>= 1; return g; }, (N = {}).getBCHTypeInfo = function(f) { @@ -38946,13 +38961,13 @@ var B9 = { exports: {} }; }, b = { getRSBlocks: function(x, _) { var E = function(Z, J) { switch (J) { - case $.L: + case B.L: return f[4 * (Z - 1) + 0]; - case $.M: + case B.M: return f[4 * (Z - 1) + 1]; - case $.Q: + case B.Q: return f[4 * (Z - 1) + 2]; - case $.H: + case B.H: return f[4 * (Z - 1) + 3]; default: return; @@ -39105,17 +39120,17 @@ var B9 = { exports: {} }; return E; }, m = function(f, g, b) { for (var x = function(ce, D) { - var oe = ce, Z = D, J = new Array(ce * D), Q = { setPixel: function(re, de, ie) { - J[de * oe + re] = ie; + var oe = ce, Z = D, J = new Array(ce * D), Q = { setPixel: function(re, pe, ie) { + J[pe * oe + re] = ie; }, write: function(re) { re.writeString("GIF87a"), re.writeShort(oe), re.writeShort(Z), re.writeByte(128), re.writeByte(0), re.writeByte(0), re.writeByte(0), re.writeByte(0), re.writeByte(0), re.writeByte(255), re.writeByte(255), re.writeByte(255), re.writeString(","), re.writeShort(0), re.writeShort(0), re.writeShort(oe), re.writeShort(Z), re.writeByte(0); - var de = T(2); + var pe = T(2); re.writeByte(2); - for (var ie = 0; de.length - ie > 255; ) re.writeByte(255), re.writeBytes(de, ie, 255), ie += 255; - re.writeByte(de.length - ie), re.writeBytes(de, ie, de.length - ie), re.writeByte(0), re.writeString(";"); + for (var ie = 0; pe.length - ie > 255; ) re.writeByte(255), re.writeBytes(pe, ie, 255), ie += 255; + re.writeByte(pe.length - ie), re.writeBytes(pe, ie, pe.length - ie), re.writeByte(0), re.writeString(";"); } }, T = function(re) { - for (var de = 1 << re, ie = 1 + (1 << re), ue = re + 1, ve = X(), Pe = 0; Pe < de; Pe += 1) ve.add(String.fromCharCode(Pe)); - ve.add(String.fromCharCode(de)), ve.add(String.fromCharCode(ie)); + for (var pe = 1 << re, ie = 1 + (1 << re), ue = re + 1, ve = X(), Pe = 0; Pe < pe; Pe += 1) ve.add(String.fromCharCode(Pe)); + ve.add(String.fromCharCode(pe)), ve.add(String.fromCharCode(ie)); var De, Ce, $e, Me = Y(), Ne = (De = Me, Ce = 0, $e = 0, { write: function(ze, _e) { if (ze >>> _e) throw "length over"; for (; Ce + _e >= 8; ) De.writeByte(255 & (ze << Ce | $e)), _e -= 8 - Ce, ze >>>= 8 - Ce, $e = 0, Ce = 0; @@ -39123,7 +39138,7 @@ var B9 = { exports: {} }; }, flush: function() { Ce > 0 && De.writeByte($e); } }); - Ne.write(de, ue); + Ne.write(pe, ue); var Ke = 0, Le = String.fromCharCode(J[Ke]); for (Ke += 1; Ke < J.length; ) { var qe = String.fromCharCode(J[Ke]); @@ -39131,11 +39146,11 @@ var B9 = { exports: {} }; } return Ne.write(ve.indexOf(Le), ue), Ne.write(ie, ue), Ne.flush(), Me.toByteArray(); }, X = function() { - var re = {}, de = 0, ie = { add: function(ue) { + var re = {}, pe = 0, ie = { add: function(ue) { if (ie.contains(ue)) throw "dup key:" + ue; - re[ue] = de, de += 1; + re[ue] = pe, pe += 1; }, size: function() { - return de; + return pe; }, indexOf: function(ue) { return re[ue]; }, contains: function(ue) { @@ -39467,9 +39482,9 @@ var B9 = { exports: {} }; J[T] = []; for (let X = 0; X < D; X++) T >= ce - 1 && T <= D - ce && X >= ce - 1 && X <= D - ce || Math.sqrt((T - Q) * (T - Q) + (X - Q) * (X - Q)) > Q ? J[T][X] = 0 : J[T][X] = this._qr.isDark(X - 2 * ce < 0 ? X : X >= x ? X - 2 * ce : X - ce, T - 2 * ce < 0 ? T : T >= x ? T - 2 * ce : T - ce) ? 1 : 0; } - for (let T = 0; T < D; T++) for (let X = 0; X < D; X++) J[T][X] && (F.draw(oe + X * v, Z + T * v, v, (re, de) => { + for (let T = 0; T < D; T++) for (let X = 0; X < D; X++) J[T][X] && (F.draw(oe + X * v, Z + T * v, v, (re, pe) => { var ie; - return !!(!((ie = J[T + de]) === null || ie === void 0) && ie[X + re]); + return !!(!((ie = J[T + pe]) === null || ie === void 0) && ie[X + re]); }), F._element && this._dotsClipPath && this._dotsClipPath.appendChild(F._element)); } } @@ -39479,7 +39494,7 @@ var B9 = { exports: {} }; if (!m) throw "Element code is not defined"; const g = this._qr.getModuleCount(), b = Math.min(f.width, f.height) - 2 * f.margin, x = f.shape === A ? b / Math.sqrt(2) : b, _ = this._roundSize(x / g), E = 7 * _, v = 3 * _, P = this._roundSize((f.width - g * _) / 2), I = this._roundSize((f.height - g * _) / 2); [[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach(([F, ce, D]) => { - var oe, Z, J, Q, T, X, re, de, ie, ue, ve, Pe; + var oe, Z, J, Q, T, X, re, pe, ie, ue, ve, Pe; const De = P + F * _ * (g - 7), Ce = I + ce * _ * (g - 7); let $e = this._dotsClipPath, Me = this._dotsClipPath; if ((!((oe = f.cornersSquareOptions) === null || oe === void 0) && oe.gradient || !((Z = f.cornersSquareOptions) === null || Z === void 0) && Z.color) && ($e = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), $e.setAttribute("id", `clip-path-corners-square-color-${F}-${ce}-${this._instanceId}`), this._defs.appendChild($e), this._cornersSquareClipPath = this._cornersDotClipPath = Me = $e, this._createColor({ options: (J = f.cornersSquareOptions) === null || J === void 0 ? void 0 : J.gradient, color: (Q = f.cornersSquareOptions) === null || Q === void 0 ? void 0 : Q.color, additionalRotation: D, x: De, y: Ce, height: E, width: E, name: `corners-square-color-${F}-${ce}-${this._instanceId}` })), (T = f.cornersSquareOptions) === null || T === void 0 ? void 0 : T.type) { @@ -39492,7 +39507,7 @@ var B9 = { exports: {} }; return !!(!((_e = M[Ke + ze]) === null || _e === void 0) && _e[Le + qe]); }), Ne._element && $e && $e.appendChild(Ne._element)); } - if ((!((re = f.cornersDotOptions) === null || re === void 0) && re.gradient || !((de = f.cornersDotOptions) === null || de === void 0) && de.color) && (Me = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), Me.setAttribute("id", `clip-path-corners-dot-color-${F}-${ce}-${this._instanceId}`), this._defs.appendChild(Me), this._cornersDotClipPath = Me, this._createColor({ options: (ie = f.cornersDotOptions) === null || ie === void 0 ? void 0 : ie.gradient, color: (ue = f.cornersDotOptions) === null || ue === void 0 ? void 0 : ue.color, additionalRotation: D, x: De + 2 * _, y: Ce + 2 * _, height: v, width: v, name: `corners-dot-color-${F}-${ce}-${this._instanceId}` })), (ve = f.cornersDotOptions) === null || ve === void 0 ? void 0 : ve.type) { + if ((!((re = f.cornersDotOptions) === null || re === void 0) && re.gradient || !((pe = f.cornersDotOptions) === null || pe === void 0) && pe.color) && (Me = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), Me.setAttribute("id", `clip-path-corners-dot-color-${F}-${ce}-${this._instanceId}`), this._defs.appendChild(Me), this._cornersDotClipPath = Me, this._createColor({ options: (ie = f.cornersDotOptions) === null || ie === void 0 ? void 0 : ie.gradient, color: (ue = f.cornersDotOptions) === null || ue === void 0 ? void 0 : ue.color, additionalRotation: D, x: De + 2 * _, y: Ce + 2 * _, height: v, width: v, name: `corners-dot-color-${F}-${ce}-${this._instanceId}` })), (ve = f.cornersDotOptions) === null || ve === void 0 ? void 0 : ve.type) { const Ne = new w({ svg: this._element, type: f.cornersDotOptions.type, window: this._window }); Ne.draw(De + 2 * _, Ce + 2 * _, v, D), Ne._element && Me && Me.appendChild(Ne._element); } else { @@ -39558,9 +39573,9 @@ var B9 = { exports: {} }; } } L.instanceCount = 0; - const $ = L, B = "canvas", H = {}; + const B = L, $ = "canvas", H = {}; for (let S = 0; S <= 40; S++) H[S] = S; - const U = { type: B, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: H[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: !0, hideBackgroundDots: !0, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: !0 }, backgroundOptions: { round: 0, color: "#fff" } }; + const U = { type: $, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: H[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: !0, hideBackgroundDots: !0, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: !0 }, backgroundOptions: { round: 0, color: "#fff" } }; function V(S) { const m = Object.assign({}, S); if (!m.colorStops || !m.colorStops.length) throw "Field 'colorStops' is required in gradient"; @@ -39587,7 +39602,7 @@ var B9 = { exports: {} }; } _setupSvg() { if (!this._qr) return; - const m = new $(this._options, this._window); + const m = new B(this._options, this._window); this._svg = m.getElement(), this._svgDrawingPromise = m.drawQR(this._qr).then(() => { var f; this._svg && ((f = this._extension) === null || f === void 0 || f.call(this, m.getElement(), this._options)); @@ -39628,12 +39643,12 @@ var B9 = { exports: {} }; default: return "Byte"; } - }(this._options.data)), this._qr.make(), this._options.type === B ? this._setupCanvas() : this._setupSvg(), this.append(this._container)); + }(this._options.data)), this._qr.make(), this._options.type === $ ? this._setupCanvas() : this._setupSvg(), this.append(this._container)); } append(m) { if (m) { if (typeof m.appendChild != "function") throw "Container should be a single DOM node"; - this._options.type === B ? this._domCanvas && m.appendChild(this._domCanvas) : this._svg && m.appendChild(this._svg), this._container = m; + this._options.type === $ ? this._domCanvas && m.appendChild(this._domCanvas) : this._svg && m.appendChild(this._svg), this._container = m; } } applyExtension(m) { @@ -39680,8 +39695,8 @@ ${new this._window.XMLSerializer().serializeToString(f)}`; })(), s.default; })()); })(B9); -var Hne = B9.exports; -const F9 = /* @__PURE__ */ ts(Hne); +var Kne = B9.exports; +const F9 = /* @__PURE__ */ ts(Kne); class sa extends yt { constructor(e) { const { docsPath: r, field: n, metaMessages: i } = e; @@ -39692,10 +39707,10 @@ class sa extends yt { }); } } -function h5(t) { +function l5(t) { if (/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t) || /%[^0-9a-f]/i.test(t) || /%[0-9a-f](:?[^0-9a-f]|$)/i.test(t)) return !1; - const e = Kne(t), r = e[1], n = e[2], i = e[3], s = e[4], o = e[5]; + const e = Vne(t), r = e[1], n = e[2], i = e[3], s = e[4], o = e[5]; if (!(r != null && r.length && i.length >= 0)) return !1; if (n != null && n.length) { @@ -39708,7 +39723,7 @@ function h5(t) { let a = ""; return a += `${r}:`, n != null && n.length && (a += `//${n}`), a += i, s != null && s.length && (a += `?${s}`), o != null && o.length && (a += `#${o}`), a; } -function Kne(t) { +function Vne(t) { return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/); } function j9(t) { @@ -39724,7 +39739,7 @@ function j9(t) { `Provided value: ${e}` ] }); - if (!(Vne.test(r) || Gne.test(r) || Yne.test(r))) + if (!(Gne.test(r) || Yne.test(r) || Jne.test(r))) throw new sa({ field: "domain", metaMessages: [ @@ -39734,7 +39749,7 @@ function j9(t) { `Provided value: ${r}` ] }); - if (!Jne.test(s)) + if (!Xne.test(s)) throw new sa({ field: "nonce", metaMessages: [ @@ -39744,7 +39759,7 @@ function j9(t) { `Provided value: ${s}` ] }); - if (!h5(d)) + if (!l5(d)) throw new sa({ field: "uri", metaMessages: [ @@ -39763,7 +39778,7 @@ function j9(t) { `Provided value: ${p}` ] }); - if (l && !Xne.test(l)) + if (l && !Zne.test(l)) throw new sa({ field: "scheme", metaMessages: [ @@ -39773,19 +39788,19 @@ function j9(t) { `Provided value: ${l}` ] }); - const $ = t.statement; - if ($ != null && $.includes(` + const B = t.statement; + if (B != null && B.includes(` `)) throw new sa({ field: "statement", metaMessages: [ "- Statement must not include '\\n'.", "", - `Provided value: ${$}` + `Provided value: ${B}` ] }); } - const w = Av(t.address), A = l ? `${l}://${r}` : r, M = t.statement ? `${t.statement} + const w = Sv(t.address), A = l ? `${l}://${r}` : r, M = t.statement ? `${t.statement} ` : "", N = `${A} wants you to sign in with your Ethereum account: ${w} @@ -39799,28 +39814,28 @@ Issued At: ${i.toISOString()}`; Expiration Time: ${n.toISOString()}`), o && (L += ` Not Before: ${o.toISOString()}`), a && (L += ` Request ID: ${a}`), u) { - let $ = ` + let B = ` Resources:`; - for (const B of u) { - if (!h5(B)) + for (const $ of u) { + if (!l5($)) throw new sa({ field: "resources", metaMessages: [ "- Every resource must be a RFC 3986 URI.", "- See https://www.rfc-editor.org/rfc/rfc3986", "", - `Provided value: ${B}` + `Provided value: ${$}` ] }); - $ += ` -- ${B}`; + B += ` +- ${$}`; } - L += $; + L += B; } return `${N} ${L}`; } -const Vne = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/, Gne = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/, Yne = /^localhost(:[0-9]{1,5})?$/, Jne = /^[a-zA-Z0-9]{8,}$/, Xne = /^([a-zA-Z][a-zA-Z0-9+-.]*)$/, U9 = "7a4434fefbcc9af474fb5c995e47d286", Zne = { +const Gne = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/, Yne = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/, Jne = /^localhost(:[0-9]{1,5})?$/, Xne = /^[a-zA-Z0-9]{8,}$/, Zne = /^([a-zA-Z][a-zA-Z0-9+-.]*)$/, U9 = "7a4434fefbcc9af474fb5c995e47d286", Qne = { projectId: U9, metadata: { name: "codatta", @@ -39828,7 +39843,7 @@ const Vne = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0- url: "https://codatta.io/", icons: ["https://avatars.githubusercontent.com/u/171659315"] } -}, Qne = { +}, eie = { namespaces: { eip155: { methods: [ @@ -39847,7 +39862,7 @@ const Vne = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0- }, skipPairing: !1 }; -function eie(t, e) { +function tie(t, e) { const r = window.location.host, n = window.location.href; return j9({ address: t, @@ -39860,25 +39875,25 @@ function eie(t, e) { } function q9(t) { var ge, Ee, Y; - const e = Zn(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Yt(""), [a, u] = Yt(!1), [l, d] = Yt(""), [p, w] = Yt("scan"), A = Zn(), [M, N] = Yt((ge = r.config) == null ? void 0 : ge.image), [L, $] = Yt(!1), { saveLastUsedWallet: B } = mp(); + const e = Zn(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Yt(""), [a, u] = Yt(!1), [l, d] = Yt(""), [p, w] = Yt("scan"), A = Zn(), [M, N] = Yt((ge = r.config) == null ? void 0 : ge.image), [L, B] = Yt(!1), { saveLastUsedWallet: $ } = mp(); async function H(S) { var f, g, b, x; u(!0); - const m = await jG.init(Zne); + const m = await jG.init(Qne); m.session && await m.disconnect(); try { if (w("scan"), m.on("display_uri", (ce) => { - console.log("display_uri", ce), o(ce), u(!1), w("scan"); + o(ce), u(!1), w("scan"); }), m.on("error", (ce) => { console.log(ce); }), m.on("session_update", (ce) => { console.log("session_update", ce); - }), !await m.connect(Qne)) throw new Error("Walletconnect init failed"); + }), !await m.connect(eie)) throw new Error("Walletconnect init failed"); const E = new vl(m); N(((f = E.config) == null ? void 0 : f.image) || ((g = S.config) == null ? void 0 : g.image)); const v = await E.getAddress(), P = await Ta.getNonce({ account_type: "block_chain" }); console.log("get nonce", P); - const I = eie(v, P); + const I = tie(v, P); w("sign"); const F = await E.signMessage(I, v); w("waiting"), await i(E, { @@ -39887,7 +39902,7 @@ function q9(t) { signature: F, address: v, wallet_name: ((b = E.config) == null ? void 0 : b.name) || ((x = S.config) == null ? void 0 : x.name) || "" - }), B(E); + }), $(E); } catch (_) { console.log("err", _), d(_.details || _.message); } @@ -39928,8 +39943,8 @@ function q9(t) { d(""), V(""), H(r); } function R() { - $(!0), navigator.clipboard.writeText(s), setTimeout(() => { - $(!1); + B(!0), navigator.clipboard.writeText(s), setTimeout(() => { + B(!1); }, 2500); } function K() { @@ -39939,65 +39954,65 @@ function q9(t) { const m = `${S}?uri=${encodeURIComponent(s)}`; window.open(m, "_blank"); } - return /* @__PURE__ */ pe.jsxs("div", { children: [ - /* @__PURE__ */ pe.jsx("div", { className: "xc-text-center", children: /* @__PURE__ */ pe.jsxs("div", { className: "xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1", children: [ - /* @__PURE__ */ pe.jsx("div", { className: "xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center", ref: e }), - /* @__PURE__ */ pe.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: a ? /* @__PURE__ */ pe.jsx(mc, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ pe.jsx("img", { className: "xc-h-10 xc-w-10", src: M }) }) + return /* @__PURE__ */ le.jsxs("div", { children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-text-center", children: /* @__PURE__ */ le.jsxs("div", { className: "xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1", children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center", ref: e }), + /* @__PURE__ */ le.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: a ? /* @__PURE__ */ le.jsx(mc, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ le.jsx("img", { className: "xc-h-10 xc-w-10", src: M }) }) ] }) }), - /* @__PURE__ */ pe.jsxs("div", { className: "xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3", children: [ - /* @__PURE__ */ pe.jsx( + /* @__PURE__ */ le.jsxs("div", { className: "xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3", children: [ + /* @__PURE__ */ le.jsx( "button", { disabled: !s, onClick: R, className: "xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent", - children: L ? /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ + children: L ? /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ " ", - /* @__PURE__ */ pe.jsx(dZ, {}), + /* @__PURE__ */ le.jsx(dZ, {}), " Copied!" - ] }) : /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ - /* @__PURE__ */ pe.jsx(mZ, {}), + ] }) : /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ + /* @__PURE__ */ le.jsx(mZ, {}), "Copy QR URL" ] }) } ), - ((Ee = r.config) == null ? void 0 : Ee.getWallet) && /* @__PURE__ */ pe.jsxs( + ((Ee = r.config) == null ? void 0 : Ee.getWallet) && /* @__PURE__ */ le.jsxs( "button", { className: "xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black", onClick: n, children: [ - /* @__PURE__ */ pe.jsx(pZ, {}), + /* @__PURE__ */ le.jsx(pZ, {}), "Get Extension" ] } ), - ((Y = r.config) == null ? void 0 : Y.desktop_link) && /* @__PURE__ */ pe.jsxs( + ((Y = r.config) == null ? void 0 : Y.desktop_link) && /* @__PURE__ */ le.jsxs( "button", { disabled: !s, className: "xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black", onClick: K, children: [ - /* @__PURE__ */ pe.jsx(KS, {}), + /* @__PURE__ */ le.jsx(HS, {}), "Desktop" ] } ) ] }), - /* @__PURE__ */ pe.jsx("div", { className: "xc-text-center", children: l ? /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ - /* @__PURE__ */ pe.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: l }), - /* @__PURE__ */ pe.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: te, children: "Retry" }) - ] }) : /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ - p === "scan" && /* @__PURE__ */ pe.jsx("p", { children: "Scan this QR code from your mobile wallet or phone's camera to connect." }), - p === "connect" && /* @__PURE__ */ pe.jsx("p", { children: "Click connect in your wallet app" }), - p === "sign" && /* @__PURE__ */ pe.jsx("p", { children: "Click sign-in in your wallet to confirm you own this wallet." }), - p === "waiting" && /* @__PURE__ */ pe.jsx("div", { className: "xc-text-center", children: /* @__PURE__ */ pe.jsx(mc, { className: "xc-inline-block xc-animate-spin" }) }) + /* @__PURE__ */ le.jsx("div", { className: "xc-text-center", children: l ? /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ + /* @__PURE__ */ le.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: l }), + /* @__PURE__ */ le.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: te, children: "Retry" }) + ] }) : /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ + p === "scan" && /* @__PURE__ */ le.jsx("p", { children: "Scan this QR code from your mobile wallet or phone's camera to connect." }), + p === "connect" && /* @__PURE__ */ le.jsx("p", { children: "Click connect in your wallet app" }), + p === "sign" && /* @__PURE__ */ le.jsx("p", { children: "Click sign-in in your wallet to confirm you own this wallet." }), + p === "waiting" && /* @__PURE__ */ le.jsx("div", { className: "xc-text-center", children: /* @__PURE__ */ le.jsx(mc, { className: "xc-inline-block xc-animate-spin" }) }) ] }) }) ] }); } -const tie = "Accept connection request in the wallet", rie = "Accept sign-in request in your wallet"; -function nie(t, e) { +const rie = "Accept connection request in the wallet", nie = "Accept sign-in request in your wallet"; +function iie(t, e) { const r = window.location.host, n = window.location.href; return j9({ address: t, @@ -40018,12 +40033,12 @@ function z9(t) { const M = await n.connect(); if (!M || M.length === 0) throw new Error("Wallet connect error"); - const N = Av(M[0]), L = nie(N, w); + const N = Sv(M[0]), L = iie(N, w); a("sign"); - const $ = await n.signMessage(L, N); - if (!$ || $.length === 0) + const B = await n.signMessage(L, N); + if (!B || B.length === 0) throw new Error("user sign error"); - a("waiting"), await i(n, { address: N, signature: $, message: L, nonce: w, wallet_name: ((A = n.config) == null ? void 0 : A.name) || "" }), u(n); + a("waiting"), await i(n, { address: N, signature: B, message: L, nonce: w, wallet_name: ((A = n.config) == null ? void 0 : A.name) || "" }), u(n); } catch (M) { console.log(M.details), r(M.details || M.message); } @@ -40039,37 +40054,37 @@ function z9(t) { } return Dn(() => { d(); - }, []), /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4", children: [ - /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-md xc-h-16 xc-w-16", src: (p = n.config) == null ? void 0 : p.image, alt: "" }), - e && /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ - /* @__PURE__ */ pe.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: e }), - /* @__PURE__ */ pe.jsx("div", { className: "xc-flex xc-gap-2", children: /* @__PURE__ */ pe.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: d, children: "Retry" }) }) + }, []), /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4", children: [ + /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-h-16 xc-w-16", src: (p = n.config) == null ? void 0 : p.image, alt: "" }), + e && /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ + /* @__PURE__ */ le.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: e }), + /* @__PURE__ */ le.jsx("div", { className: "xc-flex xc-gap-2", children: /* @__PURE__ */ le.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: d, children: "Retry" }) }) ] }), - !e && /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ - o === "connect" && /* @__PURE__ */ pe.jsx("span", { className: "xc-text-center", children: tie }), - o === "sign" && /* @__PURE__ */ pe.jsx("span", { className: "xc-text-center", children: rie }), - o === "waiting" && /* @__PURE__ */ pe.jsx("span", { className: "xc-text-center", children: /* @__PURE__ */ pe.jsx(mc, { className: "xc-animate-spin" }) }) + !e && /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ + o === "connect" && /* @__PURE__ */ le.jsx("span", { className: "xc-text-center", children: rie }), + o === "sign" && /* @__PURE__ */ le.jsx("span", { className: "xc-text-center", children: nie }), + o === "waiting" && /* @__PURE__ */ le.jsx("span", { className: "xc-text-center", children: /* @__PURE__ */ le.jsx(mc, { className: "xc-animate-spin" }) }) ] }) ] }); } -const Gc = "https://static.codatta.io/codatta-connect/wallet-icons.svg", iie = "https://itunes.apple.com/app/", sie = "https://play.google.com/store/apps/details?id=", oie = "https://chromewebstore.google.com/detail/", aie = "https://chromewebstore.google.com/detail/", cie = "https://addons.mozilla.org/en-US/firefox/addon/", uie = "https://microsoftedge.microsoft.com/addons/detail/"; +const Gc = "https://static.codatta.io/codatta-connect/wallet-icons.svg", sie = "https://itunes.apple.com/app/", oie = "https://play.google.com/store/apps/details?id=", aie = "https://chromewebstore.google.com/detail/", cie = "https://chromewebstore.google.com/detail/", uie = "https://addons.mozilla.org/en-US/firefox/addon/", fie = "https://microsoftedge.microsoft.com/addons/detail/"; function Yc(t) { const { icon: e, title: r, link: n } = t; - return /* @__PURE__ */ pe.jsxs( + return /* @__PURE__ */ le.jsxs( "a", { href: n, target: "_blank", className: "xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5", children: [ - /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-1 xc-h-6 xc-w-6", src: e, alt: "" }), + /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-1 xc-h-6 xc-w-6", src: e, alt: "" }), r, - /* @__PURE__ */ pe.jsx(HS, { className: "xc-ml-auto xc-text-gray-400" }) + /* @__PURE__ */ le.jsx(WS, { className: "xc-ml-auto xc-text-gray-400" }) ] } ); } -function fie(t) { +function lie(t) { const e = { appStoreLink: "", playStoreLink: "", @@ -40078,21 +40093,21 @@ function fie(t) { firefoxStoreLink: "", edgeStoreLink: "" }; - return t != null && t.app_store_id && (e.appStoreLink = `${iie}${t.app_store_id}`), t != null && t.play_store_id && (e.playStoreLink = `${sie}${t.play_store_id}`), t != null && t.chrome_store_id && (e.chromeStoreLink = `${oie}${t.chrome_store_id}`), t != null && t.brave_store_id && (e.braveStoreLink = `${aie}${t.brave_store_id}`), t != null && t.firefox_addon_id && (e.firefoxStoreLink = `${cie}${t.firefox_addon_id}`), t != null && t.edge_addon_id && (e.edgeStoreLink = `${uie}${t.edge_addon_id}`), e; + return t != null && t.app_store_id && (e.appStoreLink = `${sie}${t.app_store_id}`), t != null && t.play_store_id && (e.playStoreLink = `${oie}${t.play_store_id}`), t != null && t.chrome_store_id && (e.chromeStoreLink = `${aie}${t.chrome_store_id}`), t != null && t.brave_store_id && (e.braveStoreLink = `${cie}${t.brave_store_id}`), t != null && t.firefox_addon_id && (e.firefoxStoreLink = `${uie}${t.firefox_addon_id}`), t != null && t.edge_addon_id && (e.edgeStoreLink = `${fie}${t.edge_addon_id}`), e; } function W9(t) { var i, s, o; - const { wallet: e } = t, r = (i = e.config) == null ? void 0 : i.getWallet, n = fie(r); - return /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ - /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-md xc-mb-2 xc-h-12 xc-w-12", src: (s = e.config) == null ? void 0 : s.image, alt: "" }), - /* @__PURE__ */ pe.jsxs("p", { className: "xc-text-lg xc-font-bold", children: [ + const { wallet: e } = t, r = (i = e.config) == null ? void 0 : i.getWallet, n = lie(r); + return /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ + /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-mb-2 xc-h-12 xc-w-12", src: (s = e.config) == null ? void 0 : s.image, alt: "" }), + /* @__PURE__ */ le.jsxs("p", { className: "xc-text-lg xc-font-bold", children: [ "Install ", (o = e.config) == null ? void 0 : o.name, " to connect" ] }), - /* @__PURE__ */ pe.jsx("p", { className: "xc-mb-6 xc-text-sm xc-text-gray-500", children: "Select from your preferred options below:" }), - /* @__PURE__ */ pe.jsxs("div", { className: "xc-grid xc-w-full xc-grid-cols-1 xc-gap-3", children: [ - (r == null ? void 0 : r.chrome_store_id) && /* @__PURE__ */ pe.jsx( + /* @__PURE__ */ le.jsx("p", { className: "xc-mb-6 xc-text-sm xc-text-gray-500", children: "Select from your preferred options below:" }), + /* @__PURE__ */ le.jsxs("div", { className: "xc-grid xc-w-full xc-grid-cols-1 xc-gap-3", children: [ + (r == null ? void 0 : r.chrome_store_id) && /* @__PURE__ */ le.jsx( Yc, { link: n.chromeStoreLink, @@ -40100,7 +40115,7 @@ function W9(t) { title: "Google Play Store" } ), - (r == null ? void 0 : r.app_store_id) && /* @__PURE__ */ pe.jsx( + (r == null ? void 0 : r.app_store_id) && /* @__PURE__ */ le.jsx( Yc, { link: n.appStoreLink, @@ -40108,7 +40123,7 @@ function W9(t) { title: "Apple App Store" } ), - (r == null ? void 0 : r.play_store_id) && /* @__PURE__ */ pe.jsx( + (r == null ? void 0 : r.play_store_id) && /* @__PURE__ */ le.jsx( Yc, { link: n.playStoreLink, @@ -40116,7 +40131,7 @@ function W9(t) { title: "Google Play Store" } ), - (r == null ? void 0 : r.edge_addon_id) && /* @__PURE__ */ pe.jsx( + (r == null ? void 0 : r.edge_addon_id) && /* @__PURE__ */ le.jsx( Yc, { link: n.edgeStoreLink, @@ -40124,7 +40139,7 @@ function W9(t) { title: "Microsoft Edge" } ), - (r == null ? void 0 : r.brave_store_id) && /* @__PURE__ */ pe.jsx( + (r == null ? void 0 : r.brave_store_id) && /* @__PURE__ */ le.jsx( Yc, { link: n.braveStoreLink, @@ -40132,7 +40147,7 @@ function W9(t) { title: "Brave extension" } ), - (r == null ? void 0 : r.firefox_addon_id) && /* @__PURE__ */ pe.jsx( + (r == null ? void 0 : r.firefox_addon_id) && /* @__PURE__ */ le.jsx( Yc, { link: n.firefoxStoreLink, @@ -40143,8 +40158,8 @@ function W9(t) { ] }) ] }); } -function lie(t) { - const { wallet: e } = t, [r, n] = Yt(e.installed ? "connect" : "qr"), i = fy(); +function hie(t) { + const { wallet: e } = t, [r, n] = Yt(e.installed ? "connect" : "qr"), i = uy(); async function s(o, a) { var l; const u = await Ta.walletLogin({ @@ -40166,9 +40181,9 @@ function lie(t) { }); await t.onLogin(u.data); } - return /* @__PURE__ */ pe.jsxs(Ms, { children: [ - /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ pe.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), - r === "qr" && /* @__PURE__ */ pe.jsx( + return /* @__PURE__ */ le.jsxs(Ms, { children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), + r === "qr" && /* @__PURE__ */ le.jsx( q9, { wallet: e, @@ -40176,7 +40191,7 @@ function lie(t) { onSignFinish: s } ), - r === "connect" && /* @__PURE__ */ pe.jsx( + r === "connect" && /* @__PURE__ */ le.jsx( z9, { onShowQrCode: () => n("qr"), @@ -40184,21 +40199,21 @@ function lie(t) { onSignFinish: s } ), - r === "get-extension" && /* @__PURE__ */ pe.jsx(W9, { wallet: e }) + r === "get-extension" && /* @__PURE__ */ le.jsx(W9, { wallet: e }) ] }); } -function hie(t) { - const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: e.imageUrl }), i = e.name || ""; - return /* @__PURE__ */ pe.jsx(cy, { icon: n, title: i, onClick: () => r(e) }); +function die(t) { + const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: e.imageUrl }), i = e.name || ""; + return /* @__PURE__ */ le.jsx(ay, { icon: n, title: i, onClick: () => r(e) }); } function H9(t) { - const { connector: e } = t, [r, n] = Yt(), [i, s] = Yt([]), o = ci(() => r ? i.filter((d) => d.name.toLowerCase().includes(r.toLowerCase())) : i, [r, i]); + const { connector: e } = t, [r, n] = Yt(), [i, s] = Yt([]), o = wi(() => r ? i.filter((d) => d.name.toLowerCase().includes(r.toLowerCase())) : i, [r, i]); function a(d) { n(d.target.value); } async function u() { const d = await e.getWallets(); - s(d), console.log(d); + s(d); } Dn(() => { u(); @@ -40206,13 +40221,13 @@ function H9(t) { function l(d) { t.onSelect(d); } - return /* @__PURE__ */ pe.jsxs(Ms, { children: [ - /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ pe.jsx(Pc, { title: "Select wallet", onBack: t.onBack }) }), - /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ - /* @__PURE__ */ pe.jsx(VS, { className: "xc-shrink-0 xc-opacity-50" }), - /* @__PURE__ */ pe.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: a }) + return /* @__PURE__ */ le.jsxs(Ms, { children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(Pc, { title: "Select wallet", onBack: t.onBack }) }), + /* @__PURE__ */ le.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ + /* @__PURE__ */ le.jsx(KS, { className: "xc-shrink-0 xc-opacity-50" }), + /* @__PURE__ */ le.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: a }) ] }), - /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: o == null ? void 0 : o.map((d) => /* @__PURE__ */ pe.jsx(hie, { wallet: d, onClick: l }, d.name)) }) + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: o == null ? void 0 : o.map((d) => /* @__PURE__ */ le.jsx(die, { wallet: d, onClick: l }, d.name)) }) ] }); } var K9 = { exports: {} }; @@ -40254,8 +40269,8 @@ var K9 = { exports: {} }; }), e; }); })(K9); -var die = K9.exports; -const Dl = /* @__PURE__ */ ts(die); +var pie = K9.exports; +const Dl = /* @__PURE__ */ ts(pie); var V9 = { exports: {} }; (function(t) { (function(e) { @@ -40279,48 +40294,48 @@ var V9 = { exports: {} }; function L(k, q, W, C) { return N(k, q, W, C, 16); } - function $(k, q, W, C) { + function B(k, q, W, C) { return N(k, q, W, C, 32); } - function B(k, q, W, C) { - for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = W[0] & 255 | (W[1] & 255) << 8 | (W[2] & 255) << 16 | (W[3] & 255) << 24, se = W[4] & 255 | (W[5] & 255) << 8 | (W[6] & 255) << 16 | (W[7] & 255) << 24, he = W[8] & 255 | (W[9] & 255) << 8 | (W[10] & 255) << 16 | (W[11] & 255) << 24, xe = W[12] & 255 | (W[13] & 255) << 8 | (W[14] & 255) << 16 | (W[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = q[0] & 255 | (q[1] & 255) << 8 | (q[2] & 255) << 16 | (q[3] & 255) << 24, nt = q[4] & 255 | (q[5] & 255) << 8 | (q[6] & 255) << 16 | (q[7] & 255) << 24, je = q[8] & 255 | (q[9] & 255) << 8 | (q[10] & 255) << 16 | (q[11] & 255) << 24, pt = q[12] & 255 | (q[13] & 255) << 8 | (q[14] & 255) << 16 | (q[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = W[16] & 255 | (W[17] & 255) << 8 | (W[18] & 255) << 16 | (W[19] & 255) << 24, St = W[20] & 255 | (W[21] & 255) << 8 | (W[22] & 255) << 16 | (W[23] & 255) << 24, Tt = W[24] & 255 | (W[25] & 255) << 8 | (W[26] & 255) << 16 | (W[27] & 255) << 24, At = W[28] & 255 | (W[29] & 255) << 8 | (W[30] & 255) << 16 | (W[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = he, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, le, rr = 0; rr < 20; rr += 2) - le = ht + Lt | 0, ut ^= le << 7 | le >>> 25, le = ut + ht | 0, Ve ^= le << 9 | le >>> 23, le = Ve + ut | 0, Lt ^= le << 13 | le >>> 19, le = Lt + Ve | 0, ht ^= le << 18 | le >>> 14, le = ot + xt | 0, Fe ^= le << 7 | le >>> 25, le = Fe + ot | 0, zt ^= le << 9 | le >>> 23, le = zt + Fe | 0, xt ^= le << 13 | le >>> 19, le = xt + zt | 0, ot ^= le << 18 | le >>> 14, le = Ue + Se | 0, Zt ^= le << 7 | le >>> 25, le = Zt + Ue | 0, st ^= le << 9 | le >>> 23, le = st + Zt | 0, Se ^= le << 13 | le >>> 19, le = Se + st | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Je | 0, bt ^= le << 7 | le >>> 25, le = bt + Wt | 0, Ae ^= le << 9 | le >>> 23, le = Ae + bt | 0, Je ^= le << 13 | le >>> 19, le = Je + Ae | 0, Wt ^= le << 18 | le >>> 14, le = ht + bt | 0, xt ^= le << 7 | le >>> 25, le = xt + ht | 0, st ^= le << 9 | le >>> 23, le = st + xt | 0, bt ^= le << 13 | le >>> 19, le = bt + st | 0, ht ^= le << 18 | le >>> 14, le = ot + ut | 0, Se ^= le << 7 | le >>> 25, le = Se + ot | 0, Ae ^= le << 9 | le >>> 23, le = Ae + Se | 0, ut ^= le << 13 | le >>> 19, le = ut + Ae | 0, ot ^= le << 18 | le >>> 14, le = Ue + Fe | 0, Je ^= le << 7 | le >>> 25, le = Je + Ue | 0, Ve ^= le << 9 | le >>> 23, le = Ve + Je | 0, Fe ^= le << 13 | le >>> 19, le = Fe + Ve | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Zt | 0, Lt ^= le << 7 | le >>> 25, le = Lt + Wt | 0, zt ^= le << 9 | le >>> 23, le = zt + Lt | 0, Zt ^= le << 13 | le >>> 19, le = Zt + zt | 0, Wt ^= le << 18 | le >>> 14; - ht = ht + G | 0, xt = xt + j | 0, st = st + se | 0, bt = bt + he | 0, ut = ut + xe | 0, ot = ot + Te | 0, Se = Se + Re | 0, Ae = Ae + nt | 0, Ve = Ve + je | 0, Fe = Fe + pt | 0, Ue = Ue + it | 0, Je = Je + et | 0, Lt = Lt + St | 0, zt = zt + Tt | 0, Zt = Zt + At | 0, Wt = Wt + _t | 0, k[0] = ht >>> 0 & 255, k[1] = ht >>> 8 & 255, k[2] = ht >>> 16 & 255, k[3] = ht >>> 24 & 255, k[4] = xt >>> 0 & 255, k[5] = xt >>> 8 & 255, k[6] = xt >>> 16 & 255, k[7] = xt >>> 24 & 255, k[8] = st >>> 0 & 255, k[9] = st >>> 8 & 255, k[10] = st >>> 16 & 255, k[11] = st >>> 24 & 255, k[12] = bt >>> 0 & 255, k[13] = bt >>> 8 & 255, k[14] = bt >>> 16 & 255, k[15] = bt >>> 24 & 255, k[16] = ut >>> 0 & 255, k[17] = ut >>> 8 & 255, k[18] = ut >>> 16 & 255, k[19] = ut >>> 24 & 255, k[20] = ot >>> 0 & 255, k[21] = ot >>> 8 & 255, k[22] = ot >>> 16 & 255, k[23] = ot >>> 24 & 255, k[24] = Se >>> 0 & 255, k[25] = Se >>> 8 & 255, k[26] = Se >>> 16 & 255, k[27] = Se >>> 24 & 255, k[28] = Ae >>> 0 & 255, k[29] = Ae >>> 8 & 255, k[30] = Ae >>> 16 & 255, k[31] = Ae >>> 24 & 255, k[32] = Ve >>> 0 & 255, k[33] = Ve >>> 8 & 255, k[34] = Ve >>> 16 & 255, k[35] = Ve >>> 24 & 255, k[36] = Fe >>> 0 & 255, k[37] = Fe >>> 8 & 255, k[38] = Fe >>> 16 & 255, k[39] = Fe >>> 24 & 255, k[40] = Ue >>> 0 & 255, k[41] = Ue >>> 8 & 255, k[42] = Ue >>> 16 & 255, k[43] = Ue >>> 24 & 255, k[44] = Je >>> 0 & 255, k[45] = Je >>> 8 & 255, k[46] = Je >>> 16 & 255, k[47] = Je >>> 24 & 255, k[48] = Lt >>> 0 & 255, k[49] = Lt >>> 8 & 255, k[50] = Lt >>> 16 & 255, k[51] = Lt >>> 24 & 255, k[52] = zt >>> 0 & 255, k[53] = zt >>> 8 & 255, k[54] = zt >>> 16 & 255, k[55] = zt >>> 24 & 255, k[56] = Zt >>> 0 & 255, k[57] = Zt >>> 8 & 255, k[58] = Zt >>> 16 & 255, k[59] = Zt >>> 24 & 255, k[60] = Wt >>> 0 & 255, k[61] = Wt >>> 8 & 255, k[62] = Wt >>> 16 & 255, k[63] = Wt >>> 24 & 255; + function $(k, q, W, C) { + for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = W[0] & 255 | (W[1] & 255) << 8 | (W[2] & 255) << 16 | (W[3] & 255) << 24, se = W[4] & 255 | (W[5] & 255) << 8 | (W[6] & 255) << 16 | (W[7] & 255) << 24, de = W[8] & 255 | (W[9] & 255) << 8 | (W[10] & 255) << 16 | (W[11] & 255) << 24, xe = W[12] & 255 | (W[13] & 255) << 8 | (W[14] & 255) << 16 | (W[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = q[0] & 255 | (q[1] & 255) << 8 | (q[2] & 255) << 16 | (q[3] & 255) << 24, nt = q[4] & 255 | (q[5] & 255) << 8 | (q[6] & 255) << 16 | (q[7] & 255) << 24, je = q[8] & 255 | (q[9] & 255) << 8 | (q[10] & 255) << 16 | (q[11] & 255) << 24, pt = q[12] & 255 | (q[13] & 255) << 8 | (q[14] & 255) << 16 | (q[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = W[16] & 255 | (W[17] & 255) << 8 | (W[18] & 255) << 16 | (W[19] & 255) << 24, St = W[20] & 255 | (W[21] & 255) << 8 | (W[22] & 255) << 16 | (W[23] & 255) << 24, Tt = W[24] & 255 | (W[25] & 255) << 8 | (W[26] & 255) << 16 | (W[27] & 255) << 24, At = W[28] & 255 | (W[29] & 255) << 8 | (W[30] & 255) << 16 | (W[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = de, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, he, rr = 0; rr < 20; rr += 2) + he = ht + Lt | 0, ut ^= he << 7 | he >>> 25, he = ut + ht | 0, Ve ^= he << 9 | he >>> 23, he = Ve + ut | 0, Lt ^= he << 13 | he >>> 19, he = Lt + Ve | 0, ht ^= he << 18 | he >>> 14, he = ot + xt | 0, Fe ^= he << 7 | he >>> 25, he = Fe + ot | 0, zt ^= he << 9 | he >>> 23, he = zt + Fe | 0, xt ^= he << 13 | he >>> 19, he = xt + zt | 0, ot ^= he << 18 | he >>> 14, he = Ue + Se | 0, Zt ^= he << 7 | he >>> 25, he = Zt + Ue | 0, st ^= he << 9 | he >>> 23, he = st + Zt | 0, Se ^= he << 13 | he >>> 19, he = Se + st | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Je | 0, bt ^= he << 7 | he >>> 25, he = bt + Wt | 0, Ae ^= he << 9 | he >>> 23, he = Ae + bt | 0, Je ^= he << 13 | he >>> 19, he = Je + Ae | 0, Wt ^= he << 18 | he >>> 14, he = ht + bt | 0, xt ^= he << 7 | he >>> 25, he = xt + ht | 0, st ^= he << 9 | he >>> 23, he = st + xt | 0, bt ^= he << 13 | he >>> 19, he = bt + st | 0, ht ^= he << 18 | he >>> 14, he = ot + ut | 0, Se ^= he << 7 | he >>> 25, he = Se + ot | 0, Ae ^= he << 9 | he >>> 23, he = Ae + Se | 0, ut ^= he << 13 | he >>> 19, he = ut + Ae | 0, ot ^= he << 18 | he >>> 14, he = Ue + Fe | 0, Je ^= he << 7 | he >>> 25, he = Je + Ue | 0, Ve ^= he << 9 | he >>> 23, he = Ve + Je | 0, Fe ^= he << 13 | he >>> 19, he = Fe + Ve | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Zt | 0, Lt ^= he << 7 | he >>> 25, he = Lt + Wt | 0, zt ^= he << 9 | he >>> 23, he = zt + Lt | 0, Zt ^= he << 13 | he >>> 19, he = Zt + zt | 0, Wt ^= he << 18 | he >>> 14; + ht = ht + G | 0, xt = xt + j | 0, st = st + se | 0, bt = bt + de | 0, ut = ut + xe | 0, ot = ot + Te | 0, Se = Se + Re | 0, Ae = Ae + nt | 0, Ve = Ve + je | 0, Fe = Fe + pt | 0, Ue = Ue + it | 0, Je = Je + et | 0, Lt = Lt + St | 0, zt = zt + Tt | 0, Zt = Zt + At | 0, Wt = Wt + _t | 0, k[0] = ht >>> 0 & 255, k[1] = ht >>> 8 & 255, k[2] = ht >>> 16 & 255, k[3] = ht >>> 24 & 255, k[4] = xt >>> 0 & 255, k[5] = xt >>> 8 & 255, k[6] = xt >>> 16 & 255, k[7] = xt >>> 24 & 255, k[8] = st >>> 0 & 255, k[9] = st >>> 8 & 255, k[10] = st >>> 16 & 255, k[11] = st >>> 24 & 255, k[12] = bt >>> 0 & 255, k[13] = bt >>> 8 & 255, k[14] = bt >>> 16 & 255, k[15] = bt >>> 24 & 255, k[16] = ut >>> 0 & 255, k[17] = ut >>> 8 & 255, k[18] = ut >>> 16 & 255, k[19] = ut >>> 24 & 255, k[20] = ot >>> 0 & 255, k[21] = ot >>> 8 & 255, k[22] = ot >>> 16 & 255, k[23] = ot >>> 24 & 255, k[24] = Se >>> 0 & 255, k[25] = Se >>> 8 & 255, k[26] = Se >>> 16 & 255, k[27] = Se >>> 24 & 255, k[28] = Ae >>> 0 & 255, k[29] = Ae >>> 8 & 255, k[30] = Ae >>> 16 & 255, k[31] = Ae >>> 24 & 255, k[32] = Ve >>> 0 & 255, k[33] = Ve >>> 8 & 255, k[34] = Ve >>> 16 & 255, k[35] = Ve >>> 24 & 255, k[36] = Fe >>> 0 & 255, k[37] = Fe >>> 8 & 255, k[38] = Fe >>> 16 & 255, k[39] = Fe >>> 24 & 255, k[40] = Ue >>> 0 & 255, k[41] = Ue >>> 8 & 255, k[42] = Ue >>> 16 & 255, k[43] = Ue >>> 24 & 255, k[44] = Je >>> 0 & 255, k[45] = Je >>> 8 & 255, k[46] = Je >>> 16 & 255, k[47] = Je >>> 24 & 255, k[48] = Lt >>> 0 & 255, k[49] = Lt >>> 8 & 255, k[50] = Lt >>> 16 & 255, k[51] = Lt >>> 24 & 255, k[52] = zt >>> 0 & 255, k[53] = zt >>> 8 & 255, k[54] = zt >>> 16 & 255, k[55] = zt >>> 24 & 255, k[56] = Zt >>> 0 & 255, k[57] = Zt >>> 8 & 255, k[58] = Zt >>> 16 & 255, k[59] = Zt >>> 24 & 255, k[60] = Wt >>> 0 & 255, k[61] = Wt >>> 8 & 255, k[62] = Wt >>> 16 & 255, k[63] = Wt >>> 24 & 255; } function H(k, q, W, C) { - for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = W[0] & 255 | (W[1] & 255) << 8 | (W[2] & 255) << 16 | (W[3] & 255) << 24, se = W[4] & 255 | (W[5] & 255) << 8 | (W[6] & 255) << 16 | (W[7] & 255) << 24, he = W[8] & 255 | (W[9] & 255) << 8 | (W[10] & 255) << 16 | (W[11] & 255) << 24, xe = W[12] & 255 | (W[13] & 255) << 8 | (W[14] & 255) << 16 | (W[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = q[0] & 255 | (q[1] & 255) << 8 | (q[2] & 255) << 16 | (q[3] & 255) << 24, nt = q[4] & 255 | (q[5] & 255) << 8 | (q[6] & 255) << 16 | (q[7] & 255) << 24, je = q[8] & 255 | (q[9] & 255) << 8 | (q[10] & 255) << 16 | (q[11] & 255) << 24, pt = q[12] & 255 | (q[13] & 255) << 8 | (q[14] & 255) << 16 | (q[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = W[16] & 255 | (W[17] & 255) << 8 | (W[18] & 255) << 16 | (W[19] & 255) << 24, St = W[20] & 255 | (W[21] & 255) << 8 | (W[22] & 255) << 16 | (W[23] & 255) << 24, Tt = W[24] & 255 | (W[25] & 255) << 8 | (W[26] & 255) << 16 | (W[27] & 255) << 24, At = W[28] & 255 | (W[29] & 255) << 8 | (W[30] & 255) << 16 | (W[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = he, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, le, rr = 0; rr < 20; rr += 2) - le = ht + Lt | 0, ut ^= le << 7 | le >>> 25, le = ut + ht | 0, Ve ^= le << 9 | le >>> 23, le = Ve + ut | 0, Lt ^= le << 13 | le >>> 19, le = Lt + Ve | 0, ht ^= le << 18 | le >>> 14, le = ot + xt | 0, Fe ^= le << 7 | le >>> 25, le = Fe + ot | 0, zt ^= le << 9 | le >>> 23, le = zt + Fe | 0, xt ^= le << 13 | le >>> 19, le = xt + zt | 0, ot ^= le << 18 | le >>> 14, le = Ue + Se | 0, Zt ^= le << 7 | le >>> 25, le = Zt + Ue | 0, st ^= le << 9 | le >>> 23, le = st + Zt | 0, Se ^= le << 13 | le >>> 19, le = Se + st | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Je | 0, bt ^= le << 7 | le >>> 25, le = bt + Wt | 0, Ae ^= le << 9 | le >>> 23, le = Ae + bt | 0, Je ^= le << 13 | le >>> 19, le = Je + Ae | 0, Wt ^= le << 18 | le >>> 14, le = ht + bt | 0, xt ^= le << 7 | le >>> 25, le = xt + ht | 0, st ^= le << 9 | le >>> 23, le = st + xt | 0, bt ^= le << 13 | le >>> 19, le = bt + st | 0, ht ^= le << 18 | le >>> 14, le = ot + ut | 0, Se ^= le << 7 | le >>> 25, le = Se + ot | 0, Ae ^= le << 9 | le >>> 23, le = Ae + Se | 0, ut ^= le << 13 | le >>> 19, le = ut + Ae | 0, ot ^= le << 18 | le >>> 14, le = Ue + Fe | 0, Je ^= le << 7 | le >>> 25, le = Je + Ue | 0, Ve ^= le << 9 | le >>> 23, le = Ve + Je | 0, Fe ^= le << 13 | le >>> 19, le = Fe + Ve | 0, Ue ^= le << 18 | le >>> 14, le = Wt + Zt | 0, Lt ^= le << 7 | le >>> 25, le = Lt + Wt | 0, zt ^= le << 9 | le >>> 23, le = zt + Lt | 0, Zt ^= le << 13 | le >>> 19, le = Zt + zt | 0, Wt ^= le << 18 | le >>> 14; + for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = W[0] & 255 | (W[1] & 255) << 8 | (W[2] & 255) << 16 | (W[3] & 255) << 24, se = W[4] & 255 | (W[5] & 255) << 8 | (W[6] & 255) << 16 | (W[7] & 255) << 24, de = W[8] & 255 | (W[9] & 255) << 8 | (W[10] & 255) << 16 | (W[11] & 255) << 24, xe = W[12] & 255 | (W[13] & 255) << 8 | (W[14] & 255) << 16 | (W[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = q[0] & 255 | (q[1] & 255) << 8 | (q[2] & 255) << 16 | (q[3] & 255) << 24, nt = q[4] & 255 | (q[5] & 255) << 8 | (q[6] & 255) << 16 | (q[7] & 255) << 24, je = q[8] & 255 | (q[9] & 255) << 8 | (q[10] & 255) << 16 | (q[11] & 255) << 24, pt = q[12] & 255 | (q[13] & 255) << 8 | (q[14] & 255) << 16 | (q[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = W[16] & 255 | (W[17] & 255) << 8 | (W[18] & 255) << 16 | (W[19] & 255) << 24, St = W[20] & 255 | (W[21] & 255) << 8 | (W[22] & 255) << 16 | (W[23] & 255) << 24, Tt = W[24] & 255 | (W[25] & 255) << 8 | (W[26] & 255) << 16 | (W[27] & 255) << 24, At = W[28] & 255 | (W[29] & 255) << 8 | (W[30] & 255) << 16 | (W[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = de, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, he, rr = 0; rr < 20; rr += 2) + he = ht + Lt | 0, ut ^= he << 7 | he >>> 25, he = ut + ht | 0, Ve ^= he << 9 | he >>> 23, he = Ve + ut | 0, Lt ^= he << 13 | he >>> 19, he = Lt + Ve | 0, ht ^= he << 18 | he >>> 14, he = ot + xt | 0, Fe ^= he << 7 | he >>> 25, he = Fe + ot | 0, zt ^= he << 9 | he >>> 23, he = zt + Fe | 0, xt ^= he << 13 | he >>> 19, he = xt + zt | 0, ot ^= he << 18 | he >>> 14, he = Ue + Se | 0, Zt ^= he << 7 | he >>> 25, he = Zt + Ue | 0, st ^= he << 9 | he >>> 23, he = st + Zt | 0, Se ^= he << 13 | he >>> 19, he = Se + st | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Je | 0, bt ^= he << 7 | he >>> 25, he = bt + Wt | 0, Ae ^= he << 9 | he >>> 23, he = Ae + bt | 0, Je ^= he << 13 | he >>> 19, he = Je + Ae | 0, Wt ^= he << 18 | he >>> 14, he = ht + bt | 0, xt ^= he << 7 | he >>> 25, he = xt + ht | 0, st ^= he << 9 | he >>> 23, he = st + xt | 0, bt ^= he << 13 | he >>> 19, he = bt + st | 0, ht ^= he << 18 | he >>> 14, he = ot + ut | 0, Se ^= he << 7 | he >>> 25, he = Se + ot | 0, Ae ^= he << 9 | he >>> 23, he = Ae + Se | 0, ut ^= he << 13 | he >>> 19, he = ut + Ae | 0, ot ^= he << 18 | he >>> 14, he = Ue + Fe | 0, Je ^= he << 7 | he >>> 25, he = Je + Ue | 0, Ve ^= he << 9 | he >>> 23, he = Ve + Je | 0, Fe ^= he << 13 | he >>> 19, he = Fe + Ve | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Zt | 0, Lt ^= he << 7 | he >>> 25, he = Lt + Wt | 0, zt ^= he << 9 | he >>> 23, he = zt + Lt | 0, Zt ^= he << 13 | he >>> 19, he = Zt + zt | 0, Wt ^= he << 18 | he >>> 14; k[0] = ht >>> 0 & 255, k[1] = ht >>> 8 & 255, k[2] = ht >>> 16 & 255, k[3] = ht >>> 24 & 255, k[4] = ot >>> 0 & 255, k[5] = ot >>> 8 & 255, k[6] = ot >>> 16 & 255, k[7] = ot >>> 24 & 255, k[8] = Ue >>> 0 & 255, k[9] = Ue >>> 8 & 255, k[10] = Ue >>> 16 & 255, k[11] = Ue >>> 24 & 255, k[12] = Wt >>> 0 & 255, k[13] = Wt >>> 8 & 255, k[14] = Wt >>> 16 & 255, k[15] = Wt >>> 24 & 255, k[16] = Se >>> 0 & 255, k[17] = Se >>> 8 & 255, k[18] = Se >>> 16 & 255, k[19] = Se >>> 24 & 255, k[20] = Ae >>> 0 & 255, k[21] = Ae >>> 8 & 255, k[22] = Ae >>> 16 & 255, k[23] = Ae >>> 24 & 255, k[24] = Ve >>> 0 & 255, k[25] = Ve >>> 8 & 255, k[26] = Ve >>> 16 & 255, k[27] = Ve >>> 24 & 255, k[28] = Fe >>> 0 & 255, k[29] = Fe >>> 8 & 255, k[30] = Fe >>> 16 & 255, k[31] = Fe >>> 24 & 255; } function U(k, q, W, C) { - B(k, q, W, C); + $(k, q, W, C); } function V(k, q, W, C) { H(k, q, W, C); } var te = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); function R(k, q, W, C, G, j, se) { - var he = new Uint8Array(16), xe = new Uint8Array(64), Te, Re; - for (Re = 0; Re < 16; Re++) he[Re] = 0; - for (Re = 0; Re < 8; Re++) he[Re] = j[Re]; + var de = new Uint8Array(16), xe = new Uint8Array(64), Te, Re; + for (Re = 0; Re < 16; Re++) de[Re] = 0; + for (Re = 0; Re < 8; Re++) de[Re] = j[Re]; for (; G >= 64; ) { - for (U(xe, he, se, te), Re = 0; Re < 64; Re++) k[q + Re] = W[C + Re] ^ xe[Re]; + for (U(xe, de, se, te), Re = 0; Re < 64; Re++) k[q + Re] = W[C + Re] ^ xe[Re]; for (Te = 1, Re = 8; Re < 16; Re++) - Te = Te + (he[Re] & 255) | 0, he[Re] = Te & 255, Te >>>= 8; + Te = Te + (de[Re] & 255) | 0, de[Re] = Te & 255, Te >>>= 8; G -= 64, q += 64, C += 64; } if (G > 0) - for (U(xe, he, se, te), Re = 0; Re < G; Re++) k[q + Re] = W[C + Re] ^ xe[Re]; + for (U(xe, de, se, te), Re = 0; Re < G; Re++) k[q + Re] = W[C + Re] ^ xe[Re]; return 0; } function K(k, q, W, C, G) { - var j = new Uint8Array(16), se = new Uint8Array(64), he, xe; + var j = new Uint8Array(16), se = new Uint8Array(64), de, xe; for (xe = 0; xe < 16; xe++) j[xe] = 0; for (xe = 0; xe < 8; xe++) j[xe] = C[xe]; for (; W >= 64; ) { for (U(se, j, G, te), xe = 0; xe < 64; xe++) k[q + xe] = se[xe]; - for (he = 1, xe = 8; xe < 16; xe++) - he = he + (j[xe] & 255) | 0, j[xe] = he & 255, he >>>= 8; + for (de = 1, xe = 8; xe < 16; xe++) + de = de + (j[xe] & 255) | 0, j[xe] = de & 255, de >>>= 8; W -= 64, q += 64; } if (W > 0) @@ -40330,23 +40345,23 @@ var V9 = { exports: {} }; function ge(k, q, W, C, G) { var j = new Uint8Array(32); V(j, C, G, te); - for (var se = new Uint8Array(8), he = 0; he < 8; he++) se[he] = C[he + 16]; + for (var se = new Uint8Array(8), de = 0; de < 8; de++) se[de] = C[de + 16]; return K(k, q, W, se, j); } function Ee(k, q, W, C, G, j, se) { - var he = new Uint8Array(32); - V(he, j, se, te); + var de = new Uint8Array(32); + V(de, j, se, te); for (var xe = new Uint8Array(8), Te = 0; Te < 8; Te++) xe[Te] = j[Te + 16]; - return R(k, q, W, C, G, xe, he); + return R(k, q, W, C, G, xe, de); } var Y = function(k) { this.buffer = new Uint8Array(16), this.r = new Uint16Array(10), this.h = new Uint16Array(10), this.pad = new Uint16Array(8), this.leftover = 0, this.fin = 0; - var q, W, C, G, j, se, he, xe; - q = k[0] & 255 | (k[1] & 255) << 8, this.r[0] = q & 8191, W = k[2] & 255 | (k[3] & 255) << 8, this.r[1] = (q >>> 13 | W << 3) & 8191, C = k[4] & 255 | (k[5] & 255) << 8, this.r[2] = (W >>> 10 | C << 6) & 7939, G = k[6] & 255 | (k[7] & 255) << 8, this.r[3] = (C >>> 7 | G << 9) & 8191, j = k[8] & 255 | (k[9] & 255) << 8, this.r[4] = (G >>> 4 | j << 12) & 255, this.r[5] = j >>> 1 & 8190, se = k[10] & 255 | (k[11] & 255) << 8, this.r[6] = (j >>> 14 | se << 2) & 8191, he = k[12] & 255 | (k[13] & 255) << 8, this.r[7] = (se >>> 11 | he << 5) & 8065, xe = k[14] & 255 | (k[15] & 255) << 8, this.r[8] = (he >>> 8 | xe << 8) & 8191, this.r[9] = xe >>> 5 & 127, this.pad[0] = k[16] & 255 | (k[17] & 255) << 8, this.pad[1] = k[18] & 255 | (k[19] & 255) << 8, this.pad[2] = k[20] & 255 | (k[21] & 255) << 8, this.pad[3] = k[22] & 255 | (k[23] & 255) << 8, this.pad[4] = k[24] & 255 | (k[25] & 255) << 8, this.pad[5] = k[26] & 255 | (k[27] & 255) << 8, this.pad[6] = k[28] & 255 | (k[29] & 255) << 8, this.pad[7] = k[30] & 255 | (k[31] & 255) << 8; + var q, W, C, G, j, se, de, xe; + q = k[0] & 255 | (k[1] & 255) << 8, this.r[0] = q & 8191, W = k[2] & 255 | (k[3] & 255) << 8, this.r[1] = (q >>> 13 | W << 3) & 8191, C = k[4] & 255 | (k[5] & 255) << 8, this.r[2] = (W >>> 10 | C << 6) & 7939, G = k[6] & 255 | (k[7] & 255) << 8, this.r[3] = (C >>> 7 | G << 9) & 8191, j = k[8] & 255 | (k[9] & 255) << 8, this.r[4] = (G >>> 4 | j << 12) & 255, this.r[5] = j >>> 1 & 8190, se = k[10] & 255 | (k[11] & 255) << 8, this.r[6] = (j >>> 14 | se << 2) & 8191, de = k[12] & 255 | (k[13] & 255) << 8, this.r[7] = (se >>> 11 | de << 5) & 8065, xe = k[14] & 255 | (k[15] & 255) << 8, this.r[8] = (de >>> 8 | xe << 8) & 8191, this.r[9] = xe >>> 5 & 127, this.pad[0] = k[16] & 255 | (k[17] & 255) << 8, this.pad[1] = k[18] & 255 | (k[19] & 255) << 8, this.pad[2] = k[20] & 255 | (k[21] & 255) << 8, this.pad[3] = k[22] & 255 | (k[23] & 255) << 8, this.pad[4] = k[24] & 255 | (k[25] & 255) << 8, this.pad[5] = k[26] & 255 | (k[27] & 255) << 8, this.pad[6] = k[28] & 255 | (k[29] & 255) << 8, this.pad[7] = k[30] & 255 | (k[31] & 255) << 8; }; Y.prototype.blocks = function(k, q, W) { - for (var C = this.fin ? 0 : 2048, G, j, se, he, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt = this.h[0], ut = this.h[1], ot = this.h[2], Se = this.h[3], Ae = this.h[4], Ve = this.h[5], Fe = this.h[6], Ue = this.h[7], Je = this.h[8], Lt = this.h[9], zt = this.r[0], Zt = this.r[1], Wt = this.r[2], le = this.r[3], rr = this.r[4], dr = this.r[5], pr = this.r[6], Qt = this.r[7], gr = this.r[8], lr = this.r[9]; W >= 16; ) - G = k[q + 0] & 255 | (k[q + 1] & 255) << 8, bt += G & 8191, j = k[q + 2] & 255 | (k[q + 3] & 255) << 8, ut += (G >>> 13 | j << 3) & 8191, se = k[q + 4] & 255 | (k[q + 5] & 255) << 8, ot += (j >>> 10 | se << 6) & 8191, he = k[q + 6] & 255 | (k[q + 7] & 255) << 8, Se += (se >>> 7 | he << 9) & 8191, xe = k[q + 8] & 255 | (k[q + 9] & 255) << 8, Ae += (he >>> 4 | xe << 12) & 8191, Ve += xe >>> 1 & 8191, Te = k[q + 10] & 255 | (k[q + 11] & 255) << 8, Fe += (xe >>> 14 | Te << 2) & 8191, Re = k[q + 12] & 255 | (k[q + 13] & 255) << 8, Ue += (Te >>> 11 | Re << 5) & 8191, nt = k[q + 14] & 255 | (k[q + 15] & 255) << 8, Je += (Re >>> 8 | nt << 8) & 8191, Lt += nt >>> 5 | C, je = 0, pt = je, pt += bt * zt, pt += ut * (5 * lr), pt += ot * (5 * gr), pt += Se * (5 * Qt), pt += Ae * (5 * pr), je = pt >>> 13, pt &= 8191, pt += Ve * (5 * dr), pt += Fe * (5 * rr), pt += Ue * (5 * le), pt += Je * (5 * Wt), pt += Lt * (5 * Zt), je += pt >>> 13, pt &= 8191, it = je, it += bt * Zt, it += ut * zt, it += ot * (5 * lr), it += Se * (5 * gr), it += Ae * (5 * Qt), je = it >>> 13, it &= 8191, it += Ve * (5 * pr), it += Fe * (5 * dr), it += Ue * (5 * rr), it += Je * (5 * le), it += Lt * (5 * Wt), je += it >>> 13, it &= 8191, et = je, et += bt * Wt, et += ut * Zt, et += ot * zt, et += Se * (5 * lr), et += Ae * (5 * gr), je = et >>> 13, et &= 8191, et += Ve * (5 * Qt), et += Fe * (5 * pr), et += Ue * (5 * dr), et += Je * (5 * rr), et += Lt * (5 * le), je += et >>> 13, et &= 8191, St = je, St += bt * le, St += ut * Wt, St += ot * Zt, St += Se * zt, St += Ae * (5 * lr), je = St >>> 13, St &= 8191, St += Ve * (5 * gr), St += Fe * (5 * Qt), St += Ue * (5 * pr), St += Je * (5 * dr), St += Lt * (5 * rr), je += St >>> 13, St &= 8191, Tt = je, Tt += bt * rr, Tt += ut * le, Tt += ot * Wt, Tt += Se * Zt, Tt += Ae * zt, je = Tt >>> 13, Tt &= 8191, Tt += Ve * (5 * lr), Tt += Fe * (5 * gr), Tt += Ue * (5 * Qt), Tt += Je * (5 * pr), Tt += Lt * (5 * dr), je += Tt >>> 13, Tt &= 8191, At = je, At += bt * dr, At += ut * rr, At += ot * le, At += Se * Wt, At += Ae * Zt, je = At >>> 13, At &= 8191, At += Ve * zt, At += Fe * (5 * lr), At += Ue * (5 * gr), At += Je * (5 * Qt), At += Lt * (5 * pr), je += At >>> 13, At &= 8191, _t = je, _t += bt * pr, _t += ut * dr, _t += ot * rr, _t += Se * le, _t += Ae * Wt, je = _t >>> 13, _t &= 8191, _t += Ve * Zt, _t += Fe * zt, _t += Ue * (5 * lr), _t += Je * (5 * gr), _t += Lt * (5 * Qt), je += _t >>> 13, _t &= 8191, ht = je, ht += bt * Qt, ht += ut * pr, ht += ot * dr, ht += Se * rr, ht += Ae * le, je = ht >>> 13, ht &= 8191, ht += Ve * Wt, ht += Fe * Zt, ht += Ue * zt, ht += Je * (5 * lr), ht += Lt * (5 * gr), je += ht >>> 13, ht &= 8191, xt = je, xt += bt * gr, xt += ut * Qt, xt += ot * pr, xt += Se * dr, xt += Ae * rr, je = xt >>> 13, xt &= 8191, xt += Ve * le, xt += Fe * Wt, xt += Ue * Zt, xt += Je * zt, xt += Lt * (5 * lr), je += xt >>> 13, xt &= 8191, st = je, st += bt * lr, st += ut * gr, st += ot * Qt, st += Se * pr, st += Ae * dr, je = st >>> 13, st &= 8191, st += Ve * rr, st += Fe * le, st += Ue * Wt, st += Je * Zt, st += Lt * zt, je += st >>> 13, st &= 8191, je = (je << 2) + je | 0, je = je + pt | 0, pt = je & 8191, je = je >>> 13, it += je, bt = pt, ut = it, ot = et, Se = St, Ae = Tt, Ve = At, Fe = _t, Ue = ht, Je = xt, Lt = st, q += 16, W -= 16; + for (var C = this.fin ? 0 : 2048, G, j, se, de, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt = this.h[0], ut = this.h[1], ot = this.h[2], Se = this.h[3], Ae = this.h[4], Ve = this.h[5], Fe = this.h[6], Ue = this.h[7], Je = this.h[8], Lt = this.h[9], zt = this.r[0], Zt = this.r[1], Wt = this.r[2], he = this.r[3], rr = this.r[4], dr = this.r[5], pr = this.r[6], Qt = this.r[7], gr = this.r[8], lr = this.r[9]; W >= 16; ) + G = k[q + 0] & 255 | (k[q + 1] & 255) << 8, bt += G & 8191, j = k[q + 2] & 255 | (k[q + 3] & 255) << 8, ut += (G >>> 13 | j << 3) & 8191, se = k[q + 4] & 255 | (k[q + 5] & 255) << 8, ot += (j >>> 10 | se << 6) & 8191, de = k[q + 6] & 255 | (k[q + 7] & 255) << 8, Se += (se >>> 7 | de << 9) & 8191, xe = k[q + 8] & 255 | (k[q + 9] & 255) << 8, Ae += (de >>> 4 | xe << 12) & 8191, Ve += xe >>> 1 & 8191, Te = k[q + 10] & 255 | (k[q + 11] & 255) << 8, Fe += (xe >>> 14 | Te << 2) & 8191, Re = k[q + 12] & 255 | (k[q + 13] & 255) << 8, Ue += (Te >>> 11 | Re << 5) & 8191, nt = k[q + 14] & 255 | (k[q + 15] & 255) << 8, Je += (Re >>> 8 | nt << 8) & 8191, Lt += nt >>> 5 | C, je = 0, pt = je, pt += bt * zt, pt += ut * (5 * lr), pt += ot * (5 * gr), pt += Se * (5 * Qt), pt += Ae * (5 * pr), je = pt >>> 13, pt &= 8191, pt += Ve * (5 * dr), pt += Fe * (5 * rr), pt += Ue * (5 * he), pt += Je * (5 * Wt), pt += Lt * (5 * Zt), je += pt >>> 13, pt &= 8191, it = je, it += bt * Zt, it += ut * zt, it += ot * (5 * lr), it += Se * (5 * gr), it += Ae * (5 * Qt), je = it >>> 13, it &= 8191, it += Ve * (5 * pr), it += Fe * (5 * dr), it += Ue * (5 * rr), it += Je * (5 * he), it += Lt * (5 * Wt), je += it >>> 13, it &= 8191, et = je, et += bt * Wt, et += ut * Zt, et += ot * zt, et += Se * (5 * lr), et += Ae * (5 * gr), je = et >>> 13, et &= 8191, et += Ve * (5 * Qt), et += Fe * (5 * pr), et += Ue * (5 * dr), et += Je * (5 * rr), et += Lt * (5 * he), je += et >>> 13, et &= 8191, St = je, St += bt * he, St += ut * Wt, St += ot * Zt, St += Se * zt, St += Ae * (5 * lr), je = St >>> 13, St &= 8191, St += Ve * (5 * gr), St += Fe * (5 * Qt), St += Ue * (5 * pr), St += Je * (5 * dr), St += Lt * (5 * rr), je += St >>> 13, St &= 8191, Tt = je, Tt += bt * rr, Tt += ut * he, Tt += ot * Wt, Tt += Se * Zt, Tt += Ae * zt, je = Tt >>> 13, Tt &= 8191, Tt += Ve * (5 * lr), Tt += Fe * (5 * gr), Tt += Ue * (5 * Qt), Tt += Je * (5 * pr), Tt += Lt * (5 * dr), je += Tt >>> 13, Tt &= 8191, At = je, At += bt * dr, At += ut * rr, At += ot * he, At += Se * Wt, At += Ae * Zt, je = At >>> 13, At &= 8191, At += Ve * zt, At += Fe * (5 * lr), At += Ue * (5 * gr), At += Je * (5 * Qt), At += Lt * (5 * pr), je += At >>> 13, At &= 8191, _t = je, _t += bt * pr, _t += ut * dr, _t += ot * rr, _t += Se * he, _t += Ae * Wt, je = _t >>> 13, _t &= 8191, _t += Ve * Zt, _t += Fe * zt, _t += Ue * (5 * lr), _t += Je * (5 * gr), _t += Lt * (5 * Qt), je += _t >>> 13, _t &= 8191, ht = je, ht += bt * Qt, ht += ut * pr, ht += ot * dr, ht += Se * rr, ht += Ae * he, je = ht >>> 13, ht &= 8191, ht += Ve * Wt, ht += Fe * Zt, ht += Ue * zt, ht += Je * (5 * lr), ht += Lt * (5 * gr), je += ht >>> 13, ht &= 8191, xt = je, xt += bt * gr, xt += ut * Qt, xt += ot * pr, xt += Se * dr, xt += Ae * rr, je = xt >>> 13, xt &= 8191, xt += Ve * he, xt += Fe * Wt, xt += Ue * Zt, xt += Je * zt, xt += Lt * (5 * lr), je += xt >>> 13, xt &= 8191, st = je, st += bt * lr, st += ut * gr, st += ot * Qt, st += Se * pr, st += Ae * dr, je = st >>> 13, st &= 8191, st += Ve * rr, st += Fe * he, st += Ue * Wt, st += Je * Zt, st += Lt * zt, je += st >>> 13, st &= 8191, je = (je << 2) + je | 0, je = je + pt | 0, pt = je & 8191, je = je >>> 13, it += je, bt = pt, ut = it, ot = et, Se = St, Ae = Tt, Ve = At, Fe = _t, Ue = ht, Je = xt, Lt = st, q += 16, W -= 16; this.h[0] = bt, this.h[1] = ut, this.h[2] = ot, this.h[3] = Se, this.h[4] = Ae, this.h[5] = Ve, this.h[6] = Fe, this.h[7] = Ue, this.h[8] = Je, this.h[9] = Lt; }, Y.prototype.finish = function(k, q) { var W = new Uint16Array(10), C, G, j, se; @@ -40425,7 +40440,7 @@ var V9 = { exports: {} }; } function v(k, q) { var W = new Uint8Array(32), C = new Uint8Array(32); - return E(W, k), E(C, q), $(W, 0, C, 0); + return E(W, k), E(C, q), B(W, 0, C, 0); } function P(k) { var q = new Uint8Array(32); @@ -40443,8 +40458,8 @@ var V9 = { exports: {} }; for (var C = 0; C < 16; C++) k[C] = q[C] - W[C]; } function D(k, q, W) { - var C, G, j = 0, se = 0, he = 0, xe = 0, Te = 0, Re = 0, nt = 0, je = 0, pt = 0, it = 0, et = 0, St = 0, Tt = 0, At = 0, _t = 0, ht = 0, xt = 0, st = 0, bt = 0, ut = 0, ot = 0, Se = 0, Ae = 0, Ve = 0, Fe = 0, Ue = 0, Je = 0, Lt = 0, zt = 0, Zt = 0, Wt = 0, le = W[0], rr = W[1], dr = W[2], pr = W[3], Qt = W[4], gr = W[5], lr = W[6], Rr = W[7], mr = W[8], yr = W[9], $r = W[10], Br = W[11], Ir = W[12], nn = W[13], sn = W[14], on = W[15]; - C = q[0], j += C * le, se += C * rr, he += C * dr, xe += C * pr, Te += C * Qt, Re += C * gr, nt += C * lr, je += C * Rr, pt += C * mr, it += C * yr, et += C * $r, St += C * Br, Tt += C * Ir, At += C * nn, _t += C * sn, ht += C * on, C = q[1], se += C * le, he += C * rr, xe += C * dr, Te += C * pr, Re += C * Qt, nt += C * gr, je += C * lr, pt += C * Rr, it += C * mr, et += C * yr, St += C * $r, Tt += C * Br, At += C * Ir, _t += C * nn, ht += C * sn, xt += C * on, C = q[2], he += C * le, xe += C * rr, Te += C * dr, Re += C * pr, nt += C * Qt, je += C * gr, pt += C * lr, it += C * Rr, et += C * mr, St += C * yr, Tt += C * $r, At += C * Br, _t += C * Ir, ht += C * nn, xt += C * sn, st += C * on, C = q[3], xe += C * le, Te += C * rr, Re += C * dr, nt += C * pr, je += C * Qt, pt += C * gr, it += C * lr, et += C * Rr, St += C * mr, Tt += C * yr, At += C * $r, _t += C * Br, ht += C * Ir, xt += C * nn, st += C * sn, bt += C * on, C = q[4], Te += C * le, Re += C * rr, nt += C * dr, je += C * pr, pt += C * Qt, it += C * gr, et += C * lr, St += C * Rr, Tt += C * mr, At += C * yr, _t += C * $r, ht += C * Br, xt += C * Ir, st += C * nn, bt += C * sn, ut += C * on, C = q[5], Re += C * le, nt += C * rr, je += C * dr, pt += C * pr, it += C * Qt, et += C * gr, St += C * lr, Tt += C * Rr, At += C * mr, _t += C * yr, ht += C * $r, xt += C * Br, st += C * Ir, bt += C * nn, ut += C * sn, ot += C * on, C = q[6], nt += C * le, je += C * rr, pt += C * dr, it += C * pr, et += C * Qt, St += C * gr, Tt += C * lr, At += C * Rr, _t += C * mr, ht += C * yr, xt += C * $r, st += C * Br, bt += C * Ir, ut += C * nn, ot += C * sn, Se += C * on, C = q[7], je += C * le, pt += C * rr, it += C * dr, et += C * pr, St += C * Qt, Tt += C * gr, At += C * lr, _t += C * Rr, ht += C * mr, xt += C * yr, st += C * $r, bt += C * Br, ut += C * Ir, ot += C * nn, Se += C * sn, Ae += C * on, C = q[8], pt += C * le, it += C * rr, et += C * dr, St += C * pr, Tt += C * Qt, At += C * gr, _t += C * lr, ht += C * Rr, xt += C * mr, st += C * yr, bt += C * $r, ut += C * Br, ot += C * Ir, Se += C * nn, Ae += C * sn, Ve += C * on, C = q[9], it += C * le, et += C * rr, St += C * dr, Tt += C * pr, At += C * Qt, _t += C * gr, ht += C * lr, xt += C * Rr, st += C * mr, bt += C * yr, ut += C * $r, ot += C * Br, Se += C * Ir, Ae += C * nn, Ve += C * sn, Fe += C * on, C = q[10], et += C * le, St += C * rr, Tt += C * dr, At += C * pr, _t += C * Qt, ht += C * gr, xt += C * lr, st += C * Rr, bt += C * mr, ut += C * yr, ot += C * $r, Se += C * Br, Ae += C * Ir, Ve += C * nn, Fe += C * sn, Ue += C * on, C = q[11], St += C * le, Tt += C * rr, At += C * dr, _t += C * pr, ht += C * Qt, xt += C * gr, st += C * lr, bt += C * Rr, ut += C * mr, ot += C * yr, Se += C * $r, Ae += C * Br, Ve += C * Ir, Fe += C * nn, Ue += C * sn, Je += C * on, C = q[12], Tt += C * le, At += C * rr, _t += C * dr, ht += C * pr, xt += C * Qt, st += C * gr, bt += C * lr, ut += C * Rr, ot += C * mr, Se += C * yr, Ae += C * $r, Ve += C * Br, Fe += C * Ir, Ue += C * nn, Je += C * sn, Lt += C * on, C = q[13], At += C * le, _t += C * rr, ht += C * dr, xt += C * pr, st += C * Qt, bt += C * gr, ut += C * lr, ot += C * Rr, Se += C * mr, Ae += C * yr, Ve += C * $r, Fe += C * Br, Ue += C * Ir, Je += C * nn, Lt += C * sn, zt += C * on, C = q[14], _t += C * le, ht += C * rr, xt += C * dr, st += C * pr, bt += C * Qt, ut += C * gr, ot += C * lr, Se += C * Rr, Ae += C * mr, Ve += C * yr, Fe += C * $r, Ue += C * Br, Je += C * Ir, Lt += C * nn, zt += C * sn, Zt += C * on, C = q[15], ht += C * le, xt += C * rr, st += C * dr, bt += C * pr, ut += C * Qt, ot += C * gr, Se += C * lr, Ae += C * Rr, Ve += C * mr, Fe += C * yr, Ue += C * $r, Je += C * Br, Lt += C * Ir, zt += C * nn, Zt += C * sn, Wt += C * on, j += 38 * xt, se += 38 * st, he += 38 * bt, xe += 38 * ut, Te += 38 * ot, Re += 38 * Se, nt += 38 * Ae, je += 38 * Ve, pt += 38 * Fe, it += 38 * Ue, et += 38 * Je, St += 38 * Lt, Tt += 38 * zt, At += 38 * Zt, _t += 38 * Wt, G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = he + G + 65535, G = Math.floor(C / 65536), he = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = he + G + 65535, G = Math.floor(C / 65536), he = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), k[0] = j, k[1] = se, k[2] = he, k[3] = xe, k[4] = Te, k[5] = Re, k[6] = nt, k[7] = je, k[8] = pt, k[9] = it, k[10] = et, k[11] = St, k[12] = Tt, k[13] = At, k[14] = _t, k[15] = ht; + var C, G, j = 0, se = 0, de = 0, xe = 0, Te = 0, Re = 0, nt = 0, je = 0, pt = 0, it = 0, et = 0, St = 0, Tt = 0, At = 0, _t = 0, ht = 0, xt = 0, st = 0, bt = 0, ut = 0, ot = 0, Se = 0, Ae = 0, Ve = 0, Fe = 0, Ue = 0, Je = 0, Lt = 0, zt = 0, Zt = 0, Wt = 0, he = W[0], rr = W[1], dr = W[2], pr = W[3], Qt = W[4], gr = W[5], lr = W[6], Rr = W[7], mr = W[8], yr = W[9], $r = W[10], Br = W[11], Ir = W[12], nn = W[13], sn = W[14], on = W[15]; + C = q[0], j += C * he, se += C * rr, de += C * dr, xe += C * pr, Te += C * Qt, Re += C * gr, nt += C * lr, je += C * Rr, pt += C * mr, it += C * yr, et += C * $r, St += C * Br, Tt += C * Ir, At += C * nn, _t += C * sn, ht += C * on, C = q[1], se += C * he, de += C * rr, xe += C * dr, Te += C * pr, Re += C * Qt, nt += C * gr, je += C * lr, pt += C * Rr, it += C * mr, et += C * yr, St += C * $r, Tt += C * Br, At += C * Ir, _t += C * nn, ht += C * sn, xt += C * on, C = q[2], de += C * he, xe += C * rr, Te += C * dr, Re += C * pr, nt += C * Qt, je += C * gr, pt += C * lr, it += C * Rr, et += C * mr, St += C * yr, Tt += C * $r, At += C * Br, _t += C * Ir, ht += C * nn, xt += C * sn, st += C * on, C = q[3], xe += C * he, Te += C * rr, Re += C * dr, nt += C * pr, je += C * Qt, pt += C * gr, it += C * lr, et += C * Rr, St += C * mr, Tt += C * yr, At += C * $r, _t += C * Br, ht += C * Ir, xt += C * nn, st += C * sn, bt += C * on, C = q[4], Te += C * he, Re += C * rr, nt += C * dr, je += C * pr, pt += C * Qt, it += C * gr, et += C * lr, St += C * Rr, Tt += C * mr, At += C * yr, _t += C * $r, ht += C * Br, xt += C * Ir, st += C * nn, bt += C * sn, ut += C * on, C = q[5], Re += C * he, nt += C * rr, je += C * dr, pt += C * pr, it += C * Qt, et += C * gr, St += C * lr, Tt += C * Rr, At += C * mr, _t += C * yr, ht += C * $r, xt += C * Br, st += C * Ir, bt += C * nn, ut += C * sn, ot += C * on, C = q[6], nt += C * he, je += C * rr, pt += C * dr, it += C * pr, et += C * Qt, St += C * gr, Tt += C * lr, At += C * Rr, _t += C * mr, ht += C * yr, xt += C * $r, st += C * Br, bt += C * Ir, ut += C * nn, ot += C * sn, Se += C * on, C = q[7], je += C * he, pt += C * rr, it += C * dr, et += C * pr, St += C * Qt, Tt += C * gr, At += C * lr, _t += C * Rr, ht += C * mr, xt += C * yr, st += C * $r, bt += C * Br, ut += C * Ir, ot += C * nn, Se += C * sn, Ae += C * on, C = q[8], pt += C * he, it += C * rr, et += C * dr, St += C * pr, Tt += C * Qt, At += C * gr, _t += C * lr, ht += C * Rr, xt += C * mr, st += C * yr, bt += C * $r, ut += C * Br, ot += C * Ir, Se += C * nn, Ae += C * sn, Ve += C * on, C = q[9], it += C * he, et += C * rr, St += C * dr, Tt += C * pr, At += C * Qt, _t += C * gr, ht += C * lr, xt += C * Rr, st += C * mr, bt += C * yr, ut += C * $r, ot += C * Br, Se += C * Ir, Ae += C * nn, Ve += C * sn, Fe += C * on, C = q[10], et += C * he, St += C * rr, Tt += C * dr, At += C * pr, _t += C * Qt, ht += C * gr, xt += C * lr, st += C * Rr, bt += C * mr, ut += C * yr, ot += C * $r, Se += C * Br, Ae += C * Ir, Ve += C * nn, Fe += C * sn, Ue += C * on, C = q[11], St += C * he, Tt += C * rr, At += C * dr, _t += C * pr, ht += C * Qt, xt += C * gr, st += C * lr, bt += C * Rr, ut += C * mr, ot += C * yr, Se += C * $r, Ae += C * Br, Ve += C * Ir, Fe += C * nn, Ue += C * sn, Je += C * on, C = q[12], Tt += C * he, At += C * rr, _t += C * dr, ht += C * pr, xt += C * Qt, st += C * gr, bt += C * lr, ut += C * Rr, ot += C * mr, Se += C * yr, Ae += C * $r, Ve += C * Br, Fe += C * Ir, Ue += C * nn, Je += C * sn, Lt += C * on, C = q[13], At += C * he, _t += C * rr, ht += C * dr, xt += C * pr, st += C * Qt, bt += C * gr, ut += C * lr, ot += C * Rr, Se += C * mr, Ae += C * yr, Ve += C * $r, Fe += C * Br, Ue += C * Ir, Je += C * nn, Lt += C * sn, zt += C * on, C = q[14], _t += C * he, ht += C * rr, xt += C * dr, st += C * pr, bt += C * Qt, ut += C * gr, ot += C * lr, Se += C * Rr, Ae += C * mr, Ve += C * yr, Fe += C * $r, Ue += C * Br, Je += C * Ir, Lt += C * nn, zt += C * sn, Zt += C * on, C = q[15], ht += C * he, xt += C * rr, st += C * dr, bt += C * pr, ut += C * Qt, ot += C * gr, Se += C * lr, Ae += C * Rr, Ve += C * mr, Fe += C * yr, Ue += C * $r, Je += C * Br, Lt += C * Ir, zt += C * nn, Zt += C * sn, Wt += C * on, j += 38 * xt, se += 38 * st, de += 38 * bt, xe += 38 * ut, Te += 38 * ot, Re += 38 * Se, nt += 38 * Ae, je += 38 * Ve, pt += 38 * Fe, it += 38 * Ue, et += 38 * Je, St += 38 * Lt, Tt += 38 * zt, At += 38 * Zt, _t += 38 * Wt, G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = de + G + 65535, G = Math.floor(C / 65536), de = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = de + G + 65535, G = Math.floor(C / 65536), de = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), k[0] = j, k[1] = se, k[2] = de, k[3] = xe, k[4] = Te, k[5] = Re, k[6] = nt, k[7] = je, k[8] = pt, k[9] = it, k[10] = et, k[11] = St, k[12] = Tt, k[13] = At, k[14] = _t, k[15] = ht; } function oe(k, q) { D(k, q, q); @@ -40464,14 +40479,14 @@ var V9 = { exports: {} }; for (C = 0; C < 16; C++) k[C] = W[C]; } function Q(k, q, W) { - var C = new Uint8Array(32), G = new Float64Array(80), j, se, he = r(), xe = r(), Te = r(), Re = r(), nt = r(), je = r(); + var C = new Uint8Array(32), G = new Float64Array(80), j, se, de = r(), xe = r(), Te = r(), Re = r(), nt = r(), je = r(); for (se = 0; se < 31; se++) C[se] = q[se]; for (C[31] = q[31] & 127 | 64, C[0] &= 248, I(G, W), se = 0; se < 16; se++) - xe[se] = G[se], Re[se] = he[se] = Te[se] = 0; - for (he[0] = Re[0] = 1, se = 254; se >= 0; --se) - j = C[se >>> 3] >>> (se & 7) & 1, _(he, xe, j), _(Te, Re, j), F(nt, he, Te), ce(he, he, Te), F(Te, xe, Re), ce(xe, xe, Re), oe(Re, nt), oe(je, he), D(he, Te, he), D(Te, xe, nt), F(nt, he, Te), ce(he, he, Te), oe(xe, he), ce(Te, Re, je), D(he, Te, u), F(he, he, Re), D(Te, Te, he), D(he, Re, je), D(Re, xe, G), oe(xe, nt), _(he, xe, j), _(Te, Re, j); + xe[se] = G[se], Re[se] = de[se] = Te[se] = 0; + for (de[0] = Re[0] = 1, se = 254; se >= 0; --se) + j = C[se >>> 3] >>> (se & 7) & 1, _(de, xe, j), _(Te, Re, j), F(nt, de, Te), ce(de, de, Te), F(Te, xe, Re), ce(xe, xe, Re), oe(Re, nt), oe(je, de), D(de, Te, de), D(Te, xe, nt), F(nt, de, Te), ce(de, de, Te), oe(xe, de), ce(Te, Re, je), D(de, Te, u), F(de, de, Re), D(Te, Te, de), D(de, Re, je), D(Re, xe, G), oe(xe, nt), _(de, xe, j), _(Te, Re, j); for (se = 0; se < 16; se++) - G[se + 16] = he[se], G[se + 32] = Te[se], G[se + 48] = xe[se], G[se + 64] = Re[se]; + G[se + 16] = de[se], G[se + 32] = Te[se], G[se + 48] = xe[se], G[se + 64] = Re[se]; var pt = G.subarray(32), it = G.subarray(16); return Z(pt, pt), D(it, it, pt), E(k, it), 0; } @@ -40485,10 +40500,10 @@ var V9 = { exports: {} }; var C = new Uint8Array(32); return Q(C, W, q), V(k, i, C, te); } - var de = f, ie = g; + var pe = f, ie = g; function ue(k, q, W, C, G, j) { var se = new Uint8Array(32); - return re(se, G, j), de(k, q, W, C, se); + return re(se, G, j), pe(k, q, W, C, se); } function ve(k, q, W, C, G, j) { var se = new Uint8Array(32); @@ -40657,26 +40672,26 @@ var V9 = { exports: {} }; 1246189591 ]; function De(k, q, W, C) { - for (var G = new Int32Array(16), j = new Int32Array(16), se, he, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt, ut, ot, Se, Ae, Ve, Fe, Ue, Je, Lt = k[0], zt = k[1], Zt = k[2], Wt = k[3], le = k[4], rr = k[5], dr = k[6], pr = k[7], Qt = q[0], gr = q[1], lr = q[2], Rr = q[3], mr = q[4], yr = q[5], $r = q[6], Br = q[7], Ir = 0; C >= 128; ) { + for (var G = new Int32Array(16), j = new Int32Array(16), se, de, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt, ut, ot, Se, Ae, Ve, Fe, Ue, Je, Lt = k[0], zt = k[1], Zt = k[2], Wt = k[3], he = k[4], rr = k[5], dr = k[6], pr = k[7], Qt = q[0], gr = q[1], lr = q[2], Rr = q[3], mr = q[4], yr = q[5], $r = q[6], Br = q[7], Ir = 0; C >= 128; ) { for (ut = 0; ut < 16; ut++) ot = 8 * ut + Ir, G[ut] = W[ot + 0] << 24 | W[ot + 1] << 16 | W[ot + 2] << 8 | W[ot + 3], j[ut] = W[ot + 4] << 24 | W[ot + 5] << 16 | W[ot + 6] << 8 | W[ot + 7]; for (ut = 0; ut < 80; ut++) - if (se = Lt, he = zt, xe = Zt, Te = Wt, Re = le, nt = rr, je = dr, pt = pr, it = Qt, et = gr, St = lr, Tt = Rr, At = mr, _t = yr, ht = $r, xt = Br, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (le >>> 14 | mr << 18) ^ (le >>> 18 | mr << 14) ^ (mr >>> 9 | le << 23), Ae = (mr >>> 14 | le << 18) ^ (mr >>> 18 | le << 14) ^ (le >>> 9 | mr << 23), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = le & rr ^ ~le & dr, Ae = mr & yr ^ ~mr & $r, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Pe[ut * 2], Ae = Pe[ut * 2 + 1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = G[ut % 16], Ae = j[ut % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, st = Ue & 65535 | Je << 16, bt = Ve & 65535 | Fe << 16, Se = st, Ae = bt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (Lt >>> 28 | Qt << 4) ^ (Qt >>> 2 | Lt << 30) ^ (Qt >>> 7 | Lt << 25), Ae = (Qt >>> 28 | Lt << 4) ^ (Lt >>> 2 | Qt << 30) ^ (Lt >>> 7 | Qt << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Lt & zt ^ Lt & Zt ^ zt & Zt, Ae = Qt & gr ^ Qt & lr ^ gr & lr, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, pt = Ue & 65535 | Je << 16, xt = Ve & 65535 | Fe << 16, Se = Te, Ae = Tt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = st, Ae = bt, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, Te = Ue & 65535 | Je << 16, Tt = Ve & 65535 | Fe << 16, zt = se, Zt = he, Wt = xe, le = Te, rr = Re, dr = nt, pr = je, Lt = pt, gr = it, lr = et, Rr = St, mr = Tt, yr = At, $r = _t, Br = ht, Qt = xt, ut % 16 === 15) + if (se = Lt, de = zt, xe = Zt, Te = Wt, Re = he, nt = rr, je = dr, pt = pr, it = Qt, et = gr, St = lr, Tt = Rr, At = mr, _t = yr, ht = $r, xt = Br, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (he >>> 14 | mr << 18) ^ (he >>> 18 | mr << 14) ^ (mr >>> 9 | he << 23), Ae = (mr >>> 14 | he << 18) ^ (mr >>> 18 | he << 14) ^ (he >>> 9 | mr << 23), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = he & rr ^ ~he & dr, Ae = mr & yr ^ ~mr & $r, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Pe[ut * 2], Ae = Pe[ut * 2 + 1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = G[ut % 16], Ae = j[ut % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, st = Ue & 65535 | Je << 16, bt = Ve & 65535 | Fe << 16, Se = st, Ae = bt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (Lt >>> 28 | Qt << 4) ^ (Qt >>> 2 | Lt << 30) ^ (Qt >>> 7 | Lt << 25), Ae = (Qt >>> 28 | Lt << 4) ^ (Lt >>> 2 | Qt << 30) ^ (Lt >>> 7 | Qt << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Lt & zt ^ Lt & Zt ^ zt & Zt, Ae = Qt & gr ^ Qt & lr ^ gr & lr, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, pt = Ue & 65535 | Je << 16, xt = Ve & 65535 | Fe << 16, Se = Te, Ae = Tt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = st, Ae = bt, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, Te = Ue & 65535 | Je << 16, Tt = Ve & 65535 | Fe << 16, zt = se, Zt = de, Wt = xe, he = Te, rr = Re, dr = nt, pr = je, Lt = pt, gr = it, lr = et, Rr = St, mr = Tt, yr = At, $r = _t, Br = ht, Qt = xt, ut % 16 === 15) for (ot = 0; ot < 16; ot++) Se = G[ot], Ae = j[ot], Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = G[(ot + 9) % 16], Ae = j[(ot + 9) % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, st = G[(ot + 1) % 16], bt = j[(ot + 1) % 16], Se = (st >>> 1 | bt << 31) ^ (st >>> 8 | bt << 24) ^ st >>> 7, Ae = (bt >>> 1 | st << 31) ^ (bt >>> 8 | st << 24) ^ (bt >>> 7 | st << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, st = G[(ot + 14) % 16], bt = j[(ot + 14) % 16], Se = (st >>> 19 | bt << 13) ^ (bt >>> 29 | st << 3) ^ st >>> 6, Ae = (bt >>> 19 | st << 13) ^ (st >>> 29 | bt << 3) ^ (bt >>> 6 | st << 26), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, G[ot] = Ue & 65535 | Je << 16, j[ot] = Ve & 65535 | Fe << 16; - Se = Lt, Ae = Qt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[0], Ae = q[0], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[0] = Lt = Ue & 65535 | Je << 16, q[0] = Qt = Ve & 65535 | Fe << 16, Se = zt, Ae = gr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[1], Ae = q[1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[1] = zt = Ue & 65535 | Je << 16, q[1] = gr = Ve & 65535 | Fe << 16, Se = Zt, Ae = lr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[2], Ae = q[2], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[2] = Zt = Ue & 65535 | Je << 16, q[2] = lr = Ve & 65535 | Fe << 16, Se = Wt, Ae = Rr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[3], Ae = q[3], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[3] = Wt = Ue & 65535 | Je << 16, q[3] = Rr = Ve & 65535 | Fe << 16, Se = le, Ae = mr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[4], Ae = q[4], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[4] = le = Ue & 65535 | Je << 16, q[4] = mr = Ve & 65535 | Fe << 16, Se = rr, Ae = yr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[5], Ae = q[5], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[5] = rr = Ue & 65535 | Je << 16, q[5] = yr = Ve & 65535 | Fe << 16, Se = dr, Ae = $r, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[6], Ae = q[6], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[6] = dr = Ue & 65535 | Je << 16, q[6] = $r = Ve & 65535 | Fe << 16, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[7], Ae = q[7], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[7] = pr = Ue & 65535 | Je << 16, q[7] = Br = Ve & 65535 | Fe << 16, Ir += 128, C -= 128; + Se = Lt, Ae = Qt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[0], Ae = q[0], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[0] = Lt = Ue & 65535 | Je << 16, q[0] = Qt = Ve & 65535 | Fe << 16, Se = zt, Ae = gr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[1], Ae = q[1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[1] = zt = Ue & 65535 | Je << 16, q[1] = gr = Ve & 65535 | Fe << 16, Se = Zt, Ae = lr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[2], Ae = q[2], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[2] = Zt = Ue & 65535 | Je << 16, q[2] = lr = Ve & 65535 | Fe << 16, Se = Wt, Ae = Rr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[3], Ae = q[3], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[3] = Wt = Ue & 65535 | Je << 16, q[3] = Rr = Ve & 65535 | Fe << 16, Se = he, Ae = mr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[4], Ae = q[4], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[4] = he = Ue & 65535 | Je << 16, q[4] = mr = Ve & 65535 | Fe << 16, Se = rr, Ae = yr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[5], Ae = q[5], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[5] = rr = Ue & 65535 | Je << 16, q[5] = yr = Ve & 65535 | Fe << 16, Se = dr, Ae = $r, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[6], Ae = q[6], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[6] = dr = Ue & 65535 | Je << 16, q[6] = $r = Ve & 65535 | Fe << 16, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[7], Ae = q[7], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[7] = pr = Ue & 65535 | Je << 16, q[7] = Br = Ve & 65535 | Fe << 16, Ir += 128, C -= 128; } return C; } function Ce(k, q, W) { - var C = new Int32Array(8), G = new Int32Array(8), j = new Uint8Array(256), se, he = W; - for (C[0] = 1779033703, C[1] = 3144134277, C[2] = 1013904242, C[3] = 2773480762, C[4] = 1359893119, C[5] = 2600822924, C[6] = 528734635, C[7] = 1541459225, G[0] = 4089235720, G[1] = 2227873595, G[2] = 4271175723, G[3] = 1595750129, G[4] = 2917565137, G[5] = 725511199, G[6] = 4215389547, G[7] = 327033209, De(C, G, q, W), W %= 128, se = 0; se < W; se++) j[se] = q[he - W + se]; - for (j[W] = 128, W = 256 - 128 * (W < 112 ? 1 : 0), j[W - 9] = 0, M(j, W - 8, he / 536870912 | 0, he << 3), De(C, G, j, W), se = 0; se < 8; se++) M(k, 8 * se, C[se], G[se]); + var C = new Int32Array(8), G = new Int32Array(8), j = new Uint8Array(256), se, de = W; + for (C[0] = 1779033703, C[1] = 3144134277, C[2] = 1013904242, C[3] = 2773480762, C[4] = 1359893119, C[5] = 2600822924, C[6] = 528734635, C[7] = 1541459225, G[0] = 4089235720, G[1] = 2227873595, G[2] = 4271175723, G[3] = 1595750129, G[4] = 2917565137, G[5] = 725511199, G[6] = 4215389547, G[7] = 327033209, De(C, G, q, W), W %= 128, se = 0; se < W; se++) j[se] = q[de - W + se]; + for (j[W] = 128, W = 256 - 128 * (W < 112 ? 1 : 0), j[W - 9] = 0, M(j, W - 8, de / 536870912 | 0, de << 3), De(C, G, j, W), se = 0; se < 8; se++) M(k, 8 * se, C[se], G[se]); return 0; } function $e(k, q) { - var W = r(), C = r(), G = r(), j = r(), se = r(), he = r(), xe = r(), Te = r(), Re = r(); - ce(W, k[1], k[0]), ce(Re, q[1], q[0]), D(W, W, Re), F(C, k[0], k[1]), F(Re, q[0], q[1]), D(C, C, Re), D(G, k[3], q[3]), D(G, G, d), D(j, k[2], q[2]), F(j, j, j), ce(se, C, W), ce(he, j, G), F(xe, j, G), F(Te, C, W), D(k[0], se, he), D(k[1], Te, xe), D(k[2], xe, he), D(k[3], se, Te); + var W = r(), C = r(), G = r(), j = r(), se = r(), de = r(), xe = r(), Te = r(), Re = r(); + ce(W, k[1], k[0]), ce(Re, q[1], q[0]), D(W, W, Re), F(C, k[0], k[1]), F(Re, q[0], q[1]), D(C, C, Re), D(G, k[3], q[3]), D(G, G, d), D(j, k[2], q[2]), F(j, j, j), ce(se, C, W), ce(de, j, G), F(xe, j, G), F(Te, C, W), D(k[0], se, de), D(k[1], Te, xe), D(k[2], xe, de), D(k[3], se, Te); } function Me(k, q, W) { var C; @@ -40722,29 +40737,29 @@ var V9 = { exports: {} }; _e(k, q); } function at(k, q, W, C) { - var G = new Uint8Array(64), j = new Uint8Array(64), se = new Uint8Array(64), he, xe, Te = new Float64Array(64), Re = [r(), r(), r(), r()]; + var G = new Uint8Array(64), j = new Uint8Array(64), se = new Uint8Array(64), de, xe, Te = new Float64Array(64), Re = [r(), r(), r(), r()]; Ce(G, C, 32), G[0] &= 248, G[31] &= 127, G[31] |= 64; var nt = W + 64; - for (he = 0; he < W; he++) k[64 + he] = q[he]; - for (he = 0; he < 32; he++) k[32 + he] = G[32 + he]; - for (Ce(se, k.subarray(32), W + 32), Ze(se), Le(Re, se), Ne(k, Re), he = 32; he < 64; he++) k[he] = C[he]; - for (Ce(j, k, W + 64), Ze(j), he = 0; he < 64; he++) Te[he] = 0; - for (he = 0; he < 32; he++) Te[he] = se[he]; - for (he = 0; he < 32; he++) + for (de = 0; de < W; de++) k[64 + de] = q[de]; + for (de = 0; de < 32; de++) k[32 + de] = G[32 + de]; + for (Ce(se, k.subarray(32), W + 32), Ze(se), Le(Re, se), Ne(k, Re), de = 32; de < 64; de++) k[de] = C[de]; + for (Ce(j, k, W + 64), Ze(j), de = 0; de < 64; de++) Te[de] = 0; + for (de = 0; de < 32; de++) Te[de] = se[de]; + for (de = 0; de < 32; de++) for (xe = 0; xe < 32; xe++) - Te[he + xe] += j[he] * G[xe]; + Te[de + xe] += j[de] * G[xe]; return _e(k.subarray(32), Te), nt; } function ke(k, q) { - var W = r(), C = r(), G = r(), j = r(), se = r(), he = r(), xe = r(); - return b(k[2], a), I(k[1], q), oe(G, k[1]), D(j, G, l), ce(G, G, k[2]), F(j, k[2], j), oe(se, j), oe(he, se), D(xe, he, se), D(W, xe, G), D(W, W, j), J(W, W), D(W, W, G), D(W, W, j), D(W, W, j), D(k[0], W, j), oe(C, k[0]), D(C, C, j), v(C, G) && D(k[0], k[0], A), oe(C, k[0]), D(C, C, j), v(C, G) ? -1 : (P(k[0]) === q[31] >> 7 && ce(k[0], o, k[0]), D(k[3], k[0], k[1]), 0); + var W = r(), C = r(), G = r(), j = r(), se = r(), de = r(), xe = r(); + return b(k[2], a), I(k[1], q), oe(G, k[1]), D(j, G, l), ce(G, G, k[2]), F(j, k[2], j), oe(se, j), oe(de, se), D(xe, de, se), D(W, xe, G), D(W, W, j), J(W, W), D(W, W, G), D(W, W, j), D(W, W, j), D(k[0], W, j), oe(C, k[0]), D(C, C, j), v(C, G) && D(k[0], k[0], A), oe(C, k[0]), D(C, C, j), v(C, G) ? -1 : (P(k[0]) === q[31] >> 7 && ce(k[0], o, k[0]), D(k[3], k[0], k[1]), 0); } function Qe(k, q, W, C) { - var G, j = new Uint8Array(32), se = new Uint8Array(64), he = [r(), r(), r(), r()], xe = [r(), r(), r(), r()]; + var G, j = new Uint8Array(32), se = new Uint8Array(64), de = [r(), r(), r(), r()], xe = [r(), r(), r(), r()]; if (W < 64 || ke(xe, C)) return -1; for (G = 0; G < W; G++) k[G] = q[G]; for (G = 0; G < 32; G++) k[G + 32] = C[G]; - if (Ce(se, k, W), Ze(se), Ke(he, xe, se), Le(xe, q.subarray(32)), $e(he, xe), Ne(j, he), W -= 64, $(q, 0, j, 0)) { + if (Ce(se, k, W), Ze(se), Ke(de, xe, se), Le(xe, q.subarray(32)), $e(de, xe), Ne(j, de), W -= 64, B(q, 0, j, 0)) { for (G = 0; G < W; G++) k[G] = 0; return -1; } @@ -40761,13 +40776,13 @@ var V9 = { exports: {} }; crypto_onetimeauth: S, crypto_onetimeauth_verify: m, crypto_verify_16: L, - crypto_verify_32: $, + crypto_verify_32: B, crypto_secretbox: f, crypto_secretbox_open: g, crypto_scalarmult: Q, crypto_scalarmult_base: T, crypto_box_beforenm: re, - crypto_box_afternm: de, + crypto_box_afternm: pe, crypto_box: ue, crypto_box_open: ve, crypto_box_keypair: X, @@ -40918,7 +40933,7 @@ var V9 = { exports: {} }; for (G = 0; G < C; G++) W[G] = j[G]; Bt(j); }); - } else typeof M4 < "u" && (k = Wl, k && k.randomBytes && e.setPRNG(function(W, C) { + } else typeof P4 < "u" && (k = Wl, k && k.randomBytes && e.setPRNG(function(W, C) { var G, j = k.randomBytes(C); for (G = 0; G < C; G++) W[G] = j[G]; Bt(j); @@ -40926,45 +40941,45 @@ var V9 = { exports: {} }; }(); })(t.exports ? t.exports : self.nacl = self.nacl || {}); })(V9); -var pie = V9.exports; -const yd = /* @__PURE__ */ ts(pie); +var gie = V9.exports; +const yd = /* @__PURE__ */ ts(gie); var fa; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.MANIFEST_NOT_FOUND_ERROR = 2] = "MANIFEST_NOT_FOUND_ERROR", t[t.MANIFEST_CONTENT_ERROR = 3] = "MANIFEST_CONTENT_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; })(fa || (fa = {})); -var d5; +var h5; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(d5 || (d5 = {})); +})(h5 || (h5 = {})); var su; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; })(su || (su = {})); -var p5; +var d5; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(p5 || (p5 = {})); -var g5; +})(d5 || (d5 = {})); +var p5; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(g5 || (g5 = {})); -var m5; +})(p5 || (p5 = {})); +var g5; (function(t) { t.MAINNET = "-239", t.TESTNET = "-3"; -})(m5 || (m5 = {})); -function gie(t, e) { +})(g5 || (g5 = {})); +function mie(t, e) { const r = Dl.encodeBase64(t); return e ? encodeURIComponent(r) : r; } -function mie(t, e) { +function vie(t, e) { return e && (t = decodeURIComponent(t)), Dl.decodeBase64(t); } -function vie(t, e = !1) { +function bie(t, e = !1) { let r; - return t instanceof Uint8Array ? r = t : (typeof t != "string" && (t = JSON.stringify(t)), r = Dl.decodeUTF8(t)), gie(r, e); + return t instanceof Uint8Array ? r = t : (typeof t != "string" && (t = JSON.stringify(t)), r = Dl.decodeUTF8(t)), mie(r, e); } -function bie(t, e = !1) { - const r = mie(t, e); +function yie(t, e = !1) { + const r = vie(t, e); return { toString() { return Dl.encodeUTF8(r); @@ -40982,14 +40997,14 @@ function bie(t, e = !1) { }; } const G9 = { - encode: vie, - decode: bie + encode: bie, + decode: yie }; -function yie(t, e) { +function wie(t, e) { const r = new Uint8Array(t.length + e.length); return r.set(t), r.set(e, t.length), r; } -function wie(t, e) { +function xie(t, e) { if (e >= t.length) throw new Error("Index is out of buffer"); const r = t.slice(0, e), n = t.slice(e); @@ -41009,7 +41024,7 @@ function A0(t) { e[r / 2] = parseInt(t.slice(r, r + 2), 16); return e; } -class pv { +class dv { constructor(e) { this.nonceLength = 24, this.keyPair = e ? this.createKeypairFromString(e) : this.createKeypair(), this.sessionId = Km(this.keyPair.publicKey); } @@ -41027,10 +41042,10 @@ class pv { } encrypt(e, r) { const n = new TextEncoder().encode(e), i = this.createNonce(), s = yd.box(n, i, r, this.keyPair.secretKey); - return yie(i, s); + return wie(i, s); } decrypt(e, r) { - const [n, i] = wie(e, this.nonceLength), s = yd.box.open(i, n, r, this.keyPair.secretKey); + const [n, i] = xie(e, this.nonceLength), s = yd.box.open(i, n, r, this.keyPair.secretKey); if (!s) throw new Error(`Decryption error: message: ${e.toString()} @@ -41060,7 +41075,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ -function xie(t, e) { +function _ie(t, e) { var r = {}; for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); if (t != null && typeof Object.getOwnPropertySymbols == "function") @@ -41105,12 +41120,12 @@ class jt extends Error { } } jt.prefix = "[TON_CONNECT_SDK_ERROR]"; -class ly extends jt { +class fy extends jt { get info() { return "Passed DappMetadata is in incorrect format."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, ly.prototype); + super(...e), Object.setPrototypeOf(this, fy.prototype); } } class Ap extends jt { @@ -41129,12 +41144,12 @@ class Pp extends jt { super(...e), Object.setPrototypeOf(this, Pp.prototype); } } -class hy extends jt { +class ly extends jt { get info() { return "Wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, hy.prototype); + super(...e), Object.setPrototypeOf(this, ly.prototype); } } class P0 extends jt { @@ -41145,7 +41160,7 @@ class P0 extends jt { super(...e), Object.setPrototypeOf(this, P0.prototype); } } -function _ie(t) { +function Eie(t) { return "jsBridgeKey" in t; } class Mp extends jt { @@ -41172,20 +41187,20 @@ class Cp extends jt { super(...e), Object.setPrototypeOf(this, Cp.prototype); } } -class dy extends jt { +class hy extends jt { get info() { return "There is an attempt to connect to the injected wallet while it is not exists in the webpage."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, dy.prototype); + super(...e), Object.setPrototypeOf(this, hy.prototype); } } -class py extends jt { +class dy extends jt { get info() { return "An error occurred while fetching the wallets list."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, py.prototype); + super(...e), Object.setPrototypeOf(this, dy.prototype); } } class Ea extends jt { @@ -41193,7 +41208,7 @@ class Ea extends jt { super(...e), Object.setPrototypeOf(this, Ea.prototype); } } -const v5 = { +const m5 = { [fa.UNKNOWN_ERROR]: Ea, [fa.USER_REJECTS_ERROR]: Mp, [fa.BAD_REQUEST_ERROR]: Ip, @@ -41201,25 +41216,25 @@ const v5 = { [fa.MANIFEST_NOT_FOUND_ERROR]: Pp, [fa.MANIFEST_CONTENT_ERROR]: Ap }; -class Eie { +class Sie { parseError(e) { let r = Ea; - return e.code in v5 && (r = v5[e.code] || Ea), new r(e.message); + return e.code in m5 && (r = m5[e.code] || Ea), new r(e.message); } } -const Sie = new Eie(); -class Aie { +const Aie = new Sie(); +class Pie { isError(e) { return "error" in e; } } -const b5 = { +const v5 = { [su.UNKNOWN_ERROR]: Ea, [su.USER_REJECTS_ERROR]: Mp, [su.BAD_REQUEST_ERROR]: Ip, [su.UNKNOWN_APP_ERROR]: Cp }; -class Pie extends Aie { +class Mie extends Pie { convertToRpcRequest(e) { return { method: "sendTransaction", @@ -41228,7 +41243,7 @@ class Pie extends Aie { } parseAndThrowError(e) { let r = Ea; - throw e.error.code in b5 && (r = b5[e.error.code] || Ea), new r(e.error.message); + throw e.error.code in v5 && (r = v5[e.error.code] || Ea), new r(e.error.message); } convertFromRpcResponse(e) { return { @@ -41236,8 +41251,8 @@ class Pie extends Aie { }; } } -const wd = new Pie(); -class Mie { +const wd = new Mie(); +class Iie { constructor(e, r) { this.storage = e, this.storeKey = "ton-connect-storage_http-bridge-gateway::" + r; } @@ -41258,19 +41273,19 @@ class Mie { }); } } -function Iie(t) { +function Cie(t) { return t.slice(-1) === "/" ? t.slice(0, -1) : t; } function Y9(t, e) { - return Iie(t) + "/" + e; + return Cie(t) + "/" + e; } -function Cie(t) { +function Tie(t) { if (!t) return !1; const e = new URL(t); return e.protocol === "tg:" || e.hostname === "t.me"; } -function Tie(t) { +function Rie(t) { return t.replaceAll(".", "%2E").replaceAll("-", "%2D").replaceAll("_", "%5F").replaceAll("&", "-").replaceAll("=", "__").replaceAll("%", "--"); } function J9(t, e) { @@ -41323,13 +41338,13 @@ function No(...t) { } catch { } } -function Rie(...t) { +function Die(...t) { try { console.warn("[TON_CONNECT_SDK]", ...t); } catch { } } -function Die(t, e) { +function Oie(t, e) { let r = null, n = null, i = null, s = null, o = null; const a = (p, ...w) => Mt(this, void 0, void 0, function* () { if (s = p ?? null, o == null || o.abort(), o = _s(p), o.signal.aborted) @@ -41370,7 +41385,7 @@ function Die(t, e) { }) }; } -function Oie(t, e) { +function Nie(t, e) { const r = e == null ? void 0 : e.timeout, n = e == null ? void 0 : e.signal, i = _s(n); return new Promise((s, o) => Mt(this, void 0, void 0, function* () { if (i.signal.aborted) { @@ -41393,7 +41408,7 @@ function Oie(t, e) { } class Vm { constructor(e, r, n, i, s) { - this.bridgeUrl = r, this.sessionId = n, this.listener = i, this.errorsListener = s, this.ssePath = "events", this.postPath = "message", this.heartbeatMessage = "heartbeat", this.defaultTtl = 300, this.defaultReconnectDelay = 2e3, this.defaultResendDelay = 5e3, this.eventSource = Die((o, a) => Mt(this, void 0, void 0, function* () { + this.bridgeUrl = r, this.sessionId = n, this.listener = i, this.errorsListener = s, this.ssePath = "events", this.postPath = "message", this.heartbeatMessage = "heartbeat", this.defaultTtl = 300, this.defaultReconnectDelay = 2e3, this.defaultResendDelay = 5e3, this.eventSource = Oie((o, a) => Mt(this, void 0, void 0, function* () { const u = { bridgeUrl: this.bridgeUrl, ssePath: this.ssePath, @@ -41404,10 +41419,10 @@ class Vm { signal: o, openingDeadlineMS: a }; - return yield Nie(u); + return yield Lie(u); }), (o) => Mt(this, void 0, void 0, function* () { o.close(); - })), this.bridgeGatewayStorage = new Mie(e, r); + })), this.bridgeGatewayStorage = new Iie(e, r); } get isReady() { const e = this.eventSource.current(); @@ -41506,9 +41521,9 @@ class Vm { }); } } -function Nie(t) { +function Lie(t) { return Mt(this, void 0, void 0, function* () { - return yield Oie((e, r, n) => Mt(this, void 0, void 0, function* () { + return yield Nie((e, r, n) => Mt(this, void 0, void 0, function* () { var i; const o = _s(n.signal).signal; if (o.aborted) { @@ -41599,7 +41614,7 @@ class Ol { if (r.type === "injected") return r; if ("connectEvent" in r) { - const n = new pv(r.session.sessionKeyPair); + const n = new dv(r.session.sessionKeyPair); return { type: "http", connectEvent: r.connectEvent, @@ -41614,7 +41629,7 @@ class Ol { } return { type: "http", - sessionCrypto: new pv(r.sessionCrypto), + sessionCrypto: new dv(r.sessionCrypto), connectionSource: r.connectionSource }; }); @@ -41702,7 +41717,7 @@ class Nl { var n; const i = _s(r == null ? void 0 : r.signal); (n = this.abortController) === null || n === void 0 || n.abort(), this.abortController = i, this.closeGateways(); - const s = new pv(); + const s = new dv(); this.session = { sessionCrypto: s, bridgeUrl: "bridgeUrl" in this.walletConnectionSource ? this.walletConnectionSource.bridgeUrl : "" @@ -41879,14 +41894,14 @@ class Nl { }); } generateUniversalLink(e, r) { - return Cie(e) ? this.generateTGUniversalLink(e, r) : this.generateRegularUniversalLink(e, r); + return Tie(e) ? this.generateTGUniversalLink(e, r) : this.generateRegularUniversalLink(e, r); } generateRegularUniversalLink(e, r) { const n = new URL(e); return n.searchParams.append("v", X9.toString()), n.searchParams.append("id", this.session.sessionCrypto.sessionId), n.searchParams.append("r", JSON.stringify(r)), n.toString(); } generateTGUniversalLink(e, r) { - const i = this.generateRegularUniversalLink("about:blank", r).split("?")[1], s = "tonconnect-" + Tie(i), o = this.convertToDirectLink(e), a = new URL(o); + const i = this.generateRegularUniversalLink("about:blank", r).split("?")[1], s = "tonconnect-" + Rie(i), o = this.convertToDirectLink(e), a = new URL(o); return a.searchParams.append("startapp", s), a.toString(); } // TODO: Remove this method after all dApps and the wallets-list.json have been updated @@ -41926,15 +41941,15 @@ class Nl { (r = this.gateway) === null || r === void 0 || r.close(), this.pendingGateways.filter((n) => n !== (e == null ? void 0 : e.except)).forEach((n) => n.close()), this.pendingGateways = []; } } -function y5(t, e) { +function b5(t, e) { return Z9(t, [e]); } function Z9(t, e) { return !t || typeof t != "object" ? !1 : e.every((r) => r in t); } -function Lie(t) { +function kie(t) { try { - return !y5(t, "tonconnect") || !y5(t.tonconnect, "walletInfo") ? !1 : Z9(t.tonconnect.walletInfo, [ + return !b5(t, "tonconnect") || !b5(t.tonconnect, "walletInfo") ? !1 : Z9(t.tonconnect.walletInfo, [ "name", "app_name", "image", @@ -41978,7 +41993,7 @@ function Tp() { if (!(typeof window > "u")) return window; } -function kie() { +function $ie() { const t = Tp(); if (!t) return []; @@ -41988,54 +42003,54 @@ function kie() { return []; } } -function $ie() { +function Bie() { if (!(typeof document > "u")) return document; } -function Bie() { +function Fie() { var t; const e = (t = Tp()) === null || t === void 0 ? void 0 : t.location.origin; return e ? e + "/tonconnect-manifest.json" : ""; } -function Fie() { - if (jie()) - return localStorage; +function jie() { if (Uie()) + return localStorage; + if (qie()) throw new jt("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector"); return ou.getInstance(); } -function jie() { +function Uie() { try { return typeof localStorage < "u"; } catch { return !1; } } -function Uie() { +function qie() { return typeof process < "u" && process.versions != null && process.versions.node != null; } -class bi { +class vi { constructor(e, r) { this.injectedWalletKey = r, this.type = "injected", this.unsubscribeCallback = null, this.listenSubscriptions = !1, this.listeners = []; - const n = bi.window; - if (!bi.isWindowContainsWallet(n, r)) - throw new dy(); + const n = vi.window; + if (!vi.isWindowContainsWallet(n, r)) + throw new hy(); this.connectionStorage = new Ol(e), this.injectedWallet = n[r].tonconnect; } static fromStorage(e) { return Mt(this, void 0, void 0, function* () { const n = yield new Ol(e).getInjectedConnection(); - return new bi(e, n.jsBridgeKey); + return new vi(e, n.jsBridgeKey); }); } static isWalletInjected(e) { - return bi.isWindowContainsWallet(this.window, e); + return vi.isWindowContainsWallet(this.window, e); } static isInsideWalletBrowser(e) { - return bi.isWindowContainsWallet(this.window, e) ? this.window[e].tonconnect.isWalletBrowser : !1; + return vi.isWindowContainsWallet(this.window, e) ? this.window[e].tonconnect.isWalletBrowser : !1; } static getCurrentlyInjectedWallets() { - return this.window ? kie().filter(([n, i]) => Lie(i)).map(([n, i]) => ({ + return this.window ? $ie().filter(([n, i]) => kie(i)).map(([n, i]) => ({ name: i.tonconnect.walletInfo.name, appName: i.tonconnect.walletInfo.app_name, aboutUrl: i.tonconnect.walletInfo.about_url, @@ -42134,10 +42149,10 @@ class bi { }); } } -bi.window = Tp(); -class qie { +vi.window = Tp(); +class zie { constructor() { - this.localStorage = Fie(); + this.localStorage = jie(); } getItem(e) { return Mt(this, void 0, void 0, function* () { @@ -42156,15 +42171,15 @@ class qie { } } function Q9(t) { - return Wie(t) && t.injected; + return Hie(t) && t.injected; } -function zie(t) { +function Wie(t) { return Q9(t) && t.embedded; } -function Wie(t) { +function Hie(t) { return "jsBridgeKey" in t; } -const Hie = [ +const Kie = [ { app_name: "telegram-wallet", name: "Wallet", @@ -42364,7 +42379,7 @@ const Hie = [ platforms: ["chrome", "safari", "firefox", "ios", "android"] } ]; -class gv { +class pv { constructor(e) { this.walletsListCache = null, this.walletsListCacheCreationTimestamp = null, this.walletsListSource = "https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json", e != null && e.walletsListSource && (this.walletsListSource = e.walletsListSource), e != null && e.cacheTTLMs && (this.cacheTTLMs = e.cacheTTLMs); } @@ -42379,7 +42394,7 @@ class gv { } getEmbeddedWallet() { return Mt(this, void 0, void 0, function* () { - const r = (yield this.getWallets()).filter(zie); + const r = (yield this.getWallets()).filter(Wie); return r.length !== 1 ? null : r[0]; }); } @@ -42388,15 +42403,15 @@ class gv { let e = []; try { if (e = yield (yield fetch(this.walletsListSource)).json(), !Array.isArray(e)) - throw new py("Wrong wallets list format, wallets list must be an array."); + throw new dy("Wrong wallets list format, wallets list must be an array."); const i = e.filter((s) => !this.isCorrectWalletConfigDTO(s)); i.length && (No(`Wallet(s) ${i.map((s) => s.name).join(", ")} config format is wrong. They were removed from the wallets list.`), e = e.filter((s) => this.isCorrectWalletConfigDTO(s))); } catch (n) { - No(n), e = Hie; + No(n), e = Kie; } let r = []; try { - r = bi.getCurrentlyInjectedWallets(); + r = vi.getCurrentlyInjectedWallets(); } catch (n) { No(n); } @@ -42416,7 +42431,7 @@ class gv { return r.bridge.forEach((s) => { if (s.type === "sse" && (i.bridgeUrl = s.url, i.universalLink = r.universal_url, i.deepLink = r.deepLink), s.type === "js") { const o = s.key; - i.jsBridgeKey = o, i.injected = bi.isWalletInjected(o), i.embedded = bi.isInsideWalletBrowser(o); + i.jsBridgeKey = o, i.injected = vi.isWalletInjected(o), i.embedded = vi.isInsideWalletBrowser(o); } }), i; }); @@ -42452,7 +42467,7 @@ class M0 extends jt { super(...e), Object.setPrototypeOf(this, M0.prototype); } } -function Kie(t, e) { +function Vie(t, e) { const r = t.includes("SendTransaction"), n = t.find((i) => i && typeof i == "object" && i.name === "SendTransaction"); if (!r && !n) throw new M0("Wallet doesn't support SendTransaction feature."); @@ -42461,14 +42476,14 @@ function Kie(t, e) { throw new M0(`Wallet is not able to handle such SendTransaction request. Max support messages number is ${n.maxMessages}, but ${e.requiredMessagesNumber} is required.`); return; } - Rie("Connected wallet didn't provide information about max allowed messages in the SendTransaction request. Request may be rejected by the wallet."); + Die("Connected wallet didn't provide information about max allowed messages in the SendTransaction request. Request may be rejected by the wallet."); } -function Vie() { +function Gie() { return { type: "request-version" }; } -function Gie(t) { +function Yie(t) { return { type: "response-version", version: t @@ -42491,16 +42506,16 @@ function Ju(t, e) { custom_data: Object.assign({ chain_id: (u = (a = e == null ? void 0 : e.account) === null || a === void 0 ? void 0 : a.chain) !== null && u !== void 0 ? u : null, provider: (l = e == null ? void 0 : e.provider) !== null && l !== void 0 ? l : null }, Yu(t)) }; } -function Yie(t) { +function Jie(t) { return { type: "connection-started", custom_data: Yu(t) }; } -function Jie(t, e) { +function Xie(t, e) { return Object.assign({ type: "connection-completed", is_success: !0 }, Ju(t, e)); } -function Xie(t, e, r) { +function Zie(t, e, r) { return { type: "connection-error", is_success: !1, @@ -42509,16 +42524,16 @@ function Xie(t, e, r) { custom_data: Yu(t) }; } -function Zie(t) { +function Qie(t) { return { type: "connection-restoring-started", custom_data: Yu(t) }; } -function Qie(t, e) { +function ese(t, e) { return Object.assign({ type: "connection-restoring-completed", is_success: !0 }, Ju(t, e)); } -function ese(t, e) { +function tse(t, e) { return { type: "connection-restoring-error", is_success: !1, @@ -42526,7 +42541,7 @@ function ese(t, e) { custom_data: Yu(t) }; } -function gy(t, e) { +function py(t, e) { var r, n, i, s; return { valid_until: (r = String(e.validUntil)) !== null && r !== void 0 ? r : null, @@ -42540,19 +42555,19 @@ function gy(t, e) { }) }; } -function tse(t, e, r) { - return Object.assign(Object.assign({ type: "transaction-sent-for-signature" }, Ju(t, e)), gy(e, r)); +function rse(t, e, r) { + return Object.assign(Object.assign({ type: "transaction-sent-for-signature" }, Ju(t, e)), py(e, r)); } -function rse(t, e, r, n) { - return Object.assign(Object.assign({ type: "transaction-signed", is_success: !0, signed_transaction: n.boc }, Ju(t, e)), gy(e, r)); +function nse(t, e, r, n) { + return Object.assign(Object.assign({ type: "transaction-signed", is_success: !0, signed_transaction: n.boc }, Ju(t, e)), py(e, r)); } -function nse(t, e, r, n, i) { - return Object.assign(Object.assign({ type: "transaction-signing-failed", is_success: !1, error_message: n, error_code: i ?? null }, Ju(t, e)), gy(e, r)); +function ise(t, e, r, n, i) { + return Object.assign(Object.assign({ type: "transaction-signing-failed", is_success: !1, error_message: n, error_code: i ?? null }, Ju(t, e)), py(e, r)); } -function ise(t, e, r) { +function sse(t, e, r) { return Object.assign({ type: "disconnection", scope: r }, Ju(t, e)); } -class sse { +class ose { constructor() { this.window = Tp(); } @@ -42586,10 +42601,10 @@ class sse { }); } } -class ose { +class ase { constructor(e) { var r; - this.eventPrefix = "ton-connect-", this.tonConnectUiVersion = null, this.eventDispatcher = (r = e == null ? void 0 : e.eventDispatcher) !== null && r !== void 0 ? r : new sse(), this.tonConnectSdkVersion = e.tonConnectSdkVersion, this.init().catch(); + this.eventPrefix = "ton-connect-", this.tonConnectUiVersion = null, this.eventDispatcher = (r = e == null ? void 0 : e.eventDispatcher) !== null && r !== void 0 ? r : new ose(), this.tonConnectSdkVersion = e.tonConnectSdkVersion, this.init().catch(); } /** * Version of the library. @@ -42618,7 +42633,7 @@ class ose { setRequestVersionHandler() { return Mt(this, void 0, void 0, function* () { yield this.eventDispatcher.addEventListener("ton-connect-request-version", () => Mt(this, void 0, void 0, function* () { - yield this.eventDispatcher.dispatchEvent("ton-connect-response-version", Gie(this.tonConnectSdkVersion)); + yield this.eventDispatcher.dispatchEvent("ton-connect-response-version", Yie(this.tonConnectSdkVersion)); })); }); } @@ -42632,7 +42647,7 @@ class ose { try { yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version", (n) => { e(n.detail.version); - }, { once: !0 }), yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version", Vie()); + }, { once: !0 }), yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version", Gie()); } catch (n) { r(n); } @@ -42656,7 +42671,7 @@ class ose { */ trackConnectionStarted(...e) { try { - const r = Yie(this.version, ...e); + const r = Jie(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42667,7 +42682,7 @@ class ose { */ trackConnectionCompleted(...e) { try { - const r = Jie(this.version, ...e); + const r = Xie(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42678,7 +42693,7 @@ class ose { */ trackConnectionError(...e) { try { - const r = Xie(this.version, ...e); + const r = Zie(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42689,7 +42704,7 @@ class ose { */ trackConnectionRestoringStarted(...e) { try { - const r = Zie(this.version, ...e); + const r = Qie(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42700,7 +42715,7 @@ class ose { */ trackConnectionRestoringCompleted(...e) { try { - const r = Qie(this.version, ...e); + const r = ese(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42711,7 +42726,7 @@ class ose { */ trackConnectionRestoringError(...e) { try { - const r = ese(this.version, ...e); + const r = tse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42722,7 +42737,7 @@ class ose { */ trackDisconnection(...e) { try { - const r = ise(this.version, ...e); + const r = sse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42733,7 +42748,7 @@ class ose { */ trackTransactionSentForSignature(...e) { try { - const r = tse(this.version, ...e); + const r = rse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42744,7 +42759,7 @@ class ose { */ trackTransactionSigned(...e) { try { - const r = rse(this.version, ...e); + const r = nse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42755,26 +42770,26 @@ class ose { */ trackTransactionSigningFailed(...e) { try { - const r = nse(this.version, ...e); + const r = ise(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } } } -const ase = "3.0.5"; +const cse = "3.0.5"; class fh { constructor(e) { - if (this.walletsList = new gv(), this._wallet = null, this.provider = null, this.statusChangeSubscriptions = [], this.statusChangeErrorSubscriptions = [], this.dappSettings = { - manifestUrl: (e == null ? void 0 : e.manifestUrl) || Bie(), - storage: (e == null ? void 0 : e.storage) || new qie() - }, this.walletsList = new gv({ + if (this.walletsList = new pv(), this._wallet = null, this.provider = null, this.statusChangeSubscriptions = [], this.statusChangeErrorSubscriptions = [], this.dappSettings = { + manifestUrl: (e == null ? void 0 : e.manifestUrl) || Fie(), + storage: (e == null ? void 0 : e.storage) || new zie() + }, this.walletsList = new pv({ walletsListSource: e == null ? void 0 : e.walletsListSource, cacheTTLMs: e == null ? void 0 : e.walletsListCacheTTLMs - }), this.tracker = new ose({ + }), this.tracker = new ase({ eventDispatcher: e == null ? void 0 : e.eventDispatcher, - tonConnectSdkVersion: ase + tonConnectSdkVersion: cse }), !this.dappSettings.manifestUrl) - throw new ly("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"); + throw new fy("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"); this.bridgeConnectionStorage = new Ol(this.dappSettings.storage), e != null && e.disableAutoPauseConnection || this.addWindowFocusAndBlurSubscriptions(); } /** @@ -42826,7 +42841,7 @@ class fh { var n, i; const s = {}; if (typeof r == "object" && "tonProof" in r && (s.request = r), typeof r == "object" && ("openingDeadlineMS" in r || "signal" in r || "request" in r) && (s.request = r == null ? void 0 : r.request, s.openingDeadlineMS = r == null ? void 0 : r.openingDeadlineMS, s.signal = r == null ? void 0 : r.signal), this.connected) - throw new hy(); + throw new ly(); const o = _s(s == null ? void 0 : s.signal); if ((n = this.abortController) === null || n === void 0 || n.abort(), this.abortController = o, o.signal.aborted) throw new jt("Connection was aborted"); @@ -42865,7 +42880,7 @@ class fh { a = yield Nl.fromStorage(this.dappSettings.storage); break; case "injected": - a = yield bi.fromStorage(this.dappSettings.storage); + a = yield vi.fromStorage(this.dappSettings.storage); break; default: if (o) @@ -42913,10 +42928,10 @@ class fh { const i = _s(n == null ? void 0 : n.signal); if (i.signal.aborted) throw new jt("Transaction sending was aborted"); - this.checkConnection(), Kie(this.wallet.device.features, { + this.checkConnection(), Vie(this.wallet.device.features, { requiredMessagesNumber: e.messages.length }), this.tracker.trackTransactionSentForSignature(this.wallet, e); - const { validUntil: s } = e, o = xie(e, ["validUntil"]), a = e.from || this.account.address, u = e.network || this.account.chain, l = yield this.provider.sendRequest(wd.convertToRpcRequest(Object.assign(Object.assign({}, o), { + const { validUntil: s } = e, o = _ie(e, ["validUntil"]), a = e.from || this.account.address, u = e.network || this.account.chain, l = yield this.provider.sendRequest(wd.convertToRpcRequest(Object.assign(Object.assign({}, o), { valid_until: s, from: a, network: u @@ -42959,7 +42974,7 @@ class fh { return ((e = this.provider) === null || e === void 0 ? void 0 : e.type) !== "http" ? Promise.resolve() : this.provider.unPause(); } addWindowFocusAndBlurSubscriptions() { - const e = $ie(); + const e = Bie(); if (e) try { e.addEventListener("visibilitychange", () => { @@ -42971,7 +42986,7 @@ class fh { } createProvider(e) { let r; - return !Array.isArray(e) && _ie(e) ? r = new bi(this.dappSettings.storage, e.jsBridgeKey) : r = new Nl(this.dappSettings.storage, e), r.listen(this.walletEventsListener.bind(this)), r; + return !Array.isArray(e) && Eie(e) ? r = new vi(this.dappSettings.storage, e.jsBridgeKey) : r = new Nl(this.dappSettings.storage, e), r.listen(this.walletEventsListener.bind(this)), r; } walletEventsListener(e) { switch (e.event) { @@ -43004,7 +43019,7 @@ class fh { }), this.wallet = i, this.tracker.trackConnectionCompleted(i); } onWalletConnectError(e) { - const r = Sie.parseError(e); + const r = Aie.parseError(e); if (this.statusChangeErrorSubscriptions.forEach((n) => n(r)), Sn(r), this.tracker.trackConnectionError(e.message, e.code), r instanceof Pp || r instanceof Ap) throw No(r), r; } @@ -43030,16 +43045,16 @@ class fh { }; } } -fh.walletsList = new gv(); -fh.isWalletInjected = (t) => bi.isWalletInjected(t); -fh.isInsideWalletBrowser = (t) => bi.isInsideWalletBrowser(t); +fh.walletsList = new pv(); +fh.isWalletInjected = (t) => vi.isWalletInjected(t); +fh.isInsideWalletBrowser = (t) => vi.isInsideWalletBrowser(t); for (let t = 0; t <= 255; t++) { let e = t.toString(16); e.length < 2 && (e = "0" + e); } function Gm(t) { const { children: e, onClick: r } = t; - return /* @__PURE__ */ pe.jsx("button", { onClick: r, className: "xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center", children: e }); + return /* @__PURE__ */ le.jsx("button", { onClick: r, className: "xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center", children: e }); } function eA(t) { const { wallet: e, connector: r, loading: n } = t, i = Zn(null), s = Zn(), [o, a] = Yt(), [u, l] = Yt(), [d, p] = Yt("connect"), [w, A] = Yt(!1), [M, N] = Yt(); @@ -43049,7 +43064,7 @@ function eA(t) { data: K }); } - async function $() { + async function B() { A(!0); try { a(""); @@ -43069,7 +43084,7 @@ function eA(t) { } A(!1); } - function B() { + function $() { s.current = new F9({ width: 264, height: 264, @@ -43102,36 +43117,36 @@ function eA(t) { function V() { "universalLink" in e && e.universalLink && /t.me/.test(e.universalLink) && window.open(M); } - const te = ci(() => !!("deepLink" in e && e.deepLink), [e]), R = ci(() => !!("universalLink" in e && e.universalLink && /t.me/.test(e.universalLink)), [e]); + const te = wi(() => !!("deepLink" in e && e.deepLink), [e]), R = wi(() => !!("universalLink" in e && e.universalLink && /t.me/.test(e.universalLink)), [e]); return Dn(() => { - B(), $(); - }, []), /* @__PURE__ */ pe.jsxs(Ms, { children: [ - /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ pe.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), - /* @__PURE__ */ pe.jsxs("div", { className: "xc-text-center xc-mb-6", children: [ - /* @__PURE__ */ pe.jsxs("div", { className: "xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1", children: [ - /* @__PURE__ */ pe.jsx("div", { className: "xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center", ref: i }), - /* @__PURE__ */ pe.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: w ? /* @__PURE__ */ pe.jsx(mc, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ pe.jsx("img", { className: "xc-h-10 xc-w-10 xc-rounded-md", src: e.imageUrl }) }) + $(), B(); + }, []), /* @__PURE__ */ le.jsxs(Ms, { children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), + /* @__PURE__ */ le.jsxs("div", { className: "xc-text-center xc-mb-6", children: [ + /* @__PURE__ */ le.jsxs("div", { className: "xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1", children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center", ref: i }), + /* @__PURE__ */ le.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: w ? /* @__PURE__ */ le.jsx(mc, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ le.jsx("img", { className: "xc-h-10 xc-w-10 xc-rounded-md", src: e.imageUrl }) }) ] }), - /* @__PURE__ */ pe.jsx("p", { className: "xc-text-center", children: "Scan the QR code below with your phone's camera. " }) + /* @__PURE__ */ le.jsx("p", { className: "xc-text-center", children: "Scan the QR code below with your phone's camera. " }) ] }), - /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-justify-center xc-gap-2", children: [ - n && /* @__PURE__ */ pe.jsx(mc, { className: "xc-animate-spin" }), - !w && !n && /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ - Q9(e) && /* @__PURE__ */ pe.jsxs(Gm, { onClick: H, children: [ - /* @__PURE__ */ pe.jsx(gZ, { className: "xc-opacity-80" }), + /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-justify-center xc-gap-2", children: [ + n && /* @__PURE__ */ le.jsx(mc, { className: "xc-animate-spin" }), + !w && !n && /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ + Q9(e) && /* @__PURE__ */ le.jsxs(Gm, { onClick: H, children: [ + /* @__PURE__ */ le.jsx(gZ, { className: "xc-opacity-80" }), "Extension" ] }), - te && /* @__PURE__ */ pe.jsxs(Gm, { onClick: U, children: [ - /* @__PURE__ */ pe.jsx(KS, { className: "xc-opacity-80" }), + te && /* @__PURE__ */ le.jsxs(Gm, { onClick: U, children: [ + /* @__PURE__ */ le.jsx(HS, { className: "xc-opacity-80" }), "Desktop" ] }), - R && /* @__PURE__ */ pe.jsx(Gm, { onClick: V, children: "Telegram Mini App" }) + R && /* @__PURE__ */ le.jsx(Gm, { onClick: V, children: "Telegram Mini App" }) ] }) ] }) ] }); } -function cse(t) { - const [e, r] = Yt(""), [n, i] = Yt(), [s, o] = Yt(), a = fy(), [u, l] = Yt(!1); +function use(t) { + const [e, r] = Yt(""), [n, i] = Yt(), [s, o] = Yt(), a = uy(), [u, l] = Yt(!1); async function d(w) { var M, N; if (!w || !((M = w.connectItems) != null && M.tonProof)) return; @@ -43165,8 +43180,8 @@ function cse(t) { function p(w) { r("connect"), i(w); } - return /* @__PURE__ */ pe.jsxs(Ms, { children: [ - e === "select" && /* @__PURE__ */ pe.jsx( + return /* @__PURE__ */ le.jsxs(Ms, { children: [ + e === "select" && /* @__PURE__ */ le.jsx( H9, { connector: s, @@ -43174,7 +43189,7 @@ function cse(t) { onBack: t.onBack } ), - e === "connect" && /* @__PURE__ */ pe.jsx( + e === "connect" && /* @__PURE__ */ le.jsx( eA, { connector: s, @@ -43186,7 +43201,7 @@ function cse(t) { ] }); } function tA(t) { - const { children: e, className: r } = t, n = Zn(null), [i, s] = mv.useState(0); + const { children: e, className: r } = t, n = Zn(null), [i, s] = gv.useState(0); function o() { var a; try { @@ -43204,7 +43219,7 @@ function tA(t) { return a.observe(n.current, { childList: !0, subtree: !0 }), () => a.disconnect(); }, []), Dn(() => { console.log("maxHeight", i); - }, [i]), /* @__PURE__ */ pe.jsx( + }, [i]), /* @__PURE__ */ le.jsx( "div", { ref: n, @@ -43218,74 +43233,74 @@ function tA(t) { } ); } -function use() { - return /* @__PURE__ */ pe.jsxs("svg", { width: "121", height: "120", viewBox: "0 0 121 120", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [ - /* @__PURE__ */ pe.jsx("rect", { x: "0.5", width: "120", height: "120", rx: "60", fill: "#404049" }), - /* @__PURE__ */ pe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z", fill: "#252532" }), - /* @__PURE__ */ pe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z", fill: "#252532" }), - /* @__PURE__ */ pe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z", fill: "#404049" }), - /* @__PURE__ */ pe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z", stroke: "#77777D", "stroke-width": "2" }), - /* @__PURE__ */ pe.jsx("path", { d: "M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829", stroke: "#77777D", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) +function fse() { + return /* @__PURE__ */ le.jsxs("svg", { width: "121", height: "120", viewBox: "0 0 121 120", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [ + /* @__PURE__ */ le.jsx("rect", { x: "0.5", width: "120", height: "120", rx: "60", fill: "#404049" }), + /* @__PURE__ */ le.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z", fill: "#252532" }), + /* @__PURE__ */ le.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z", fill: "#252532" }), + /* @__PURE__ */ le.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z", fill: "#404049" }), + /* @__PURE__ */ le.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z", stroke: "#77777D", "stroke-width": "2" }), + /* @__PURE__ */ le.jsx("path", { d: "M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829", stroke: "#77777D", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) ] }); } function rA(t) { - const { wallets: e } = mp(), [r, n] = Yt(), i = ci(() => r ? e.filter((a) => a.key.toLowerCase().includes(r.toLowerCase())) : e, [r]); + const { wallets: e } = mp(), [r, n] = Yt(), i = wi(() => r ? e.filter((a) => a.key.toLowerCase().includes(r.toLowerCase())) : e, [r]); function s(a) { t.onSelectWallet(a); } function o(a) { n(a.target.value); } - return /* @__PURE__ */ pe.jsxs(Ms, { children: [ - /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ pe.jsx(Pc, { title: "Select wallet", onBack: t.onBack }) }), - /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ - /* @__PURE__ */ pe.jsx(VS, { className: "xc-shrink-0 xc-opacity-50" }), - /* @__PURE__ */ pe.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: o }) + return /* @__PURE__ */ le.jsxs(Ms, { children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(Pc, { title: "Select wallet", onBack: t.onBack }) }), + /* @__PURE__ */ le.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ + /* @__PURE__ */ le.jsx(KS, { className: "xc-shrink-0 xc-opacity-50" }), + /* @__PURE__ */ le.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: o }) ] }), - /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: i.length ? i.map((a) => /* @__PURE__ */ pe.jsx( - hv, + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: i.length ? i.map((a) => /* @__PURE__ */ le.jsx( + y9, { wallet: a, onClick: s }, `feature-${a.key}` - )) : /* @__PURE__ */ pe.jsx(use, {}) }) + )) : /* @__PURE__ */ le.jsx(fse, {}) }) ] }); } -function woe(t) { +function xoe(t) { const { onLogin: e, header: r, showEmailSignIn: n = !0, showMoreWallets: i = !0, showTonConnect: s = !0, showFeaturedWallets: o = !0 } = t, [a, u] = Yt(""), [l, d] = Yt(null), [p, w] = Yt(""); - function A($) { - d($), u("evm-wallet"); + function A(B) { + d(B), u("evm-wallet"); } - function M($) { - u("email"), w($); + function M(B) { + u("email"), w(B); } - async function N($) { - await e($); + async function N(B) { + await e(B); } function L() { u("ton-wallet"); } return Dn(() => { u("index"); - }, []), /* @__PURE__ */ pe.jsx(Cne, { config: t.config, children: /* @__PURE__ */ pe.jsxs(tA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ - a === "evm-wallet" && /* @__PURE__ */ pe.jsx( - lie, + }, []), /* @__PURE__ */ le.jsx(Tne, { config: t.config, children: /* @__PURE__ */ le.jsxs(tA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ + a === "evm-wallet" && /* @__PURE__ */ le.jsx( + hie, { onBack: () => u("index"), onLogin: N, wallet: l } ), - a === "ton-wallet" && /* @__PURE__ */ pe.jsx( - cse, + a === "ton-wallet" && /* @__PURE__ */ le.jsx( + use, { onBack: () => u("index"), onLogin: N } ), - a === "email" && /* @__PURE__ */ pe.jsx(Wne, { email: p, onBack: () => u("index"), onLogin: N }), - a === "index" && /* @__PURE__ */ pe.jsx( + a === "email" && /* @__PURE__ */ le.jsx(Hne, { email: p, onBack: () => u("index"), onLogin: N }), + a === "index" && /* @__PURE__ */ le.jsx( M9, { header: r, @@ -43303,7 +43318,7 @@ function woe(t) { } } ), - a === "all-wallet" && /* @__PURE__ */ pe.jsx( + a === "all-wallet" && /* @__PURE__ */ le.jsx( rA, { onBack: () => u("index"), @@ -43312,14 +43327,14 @@ function woe(t) { ) ] }) }); } -function fse(t) { +function lse(t) { const { wallet: e, onConnect: r } = t, [n, i] = Yt(e.installed ? "connect" : "qr"); async function s(o, a) { await r(o, a); } - return /* @__PURE__ */ pe.jsxs(Ms, { children: [ - /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ pe.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), - n === "qr" && /* @__PURE__ */ pe.jsx( + return /* @__PURE__ */ le.jsxs(Ms, { children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), + n === "qr" && /* @__PURE__ */ le.jsx( q9, { wallet: e, @@ -43327,7 +43342,7 @@ function fse(t) { onSignFinish: s } ), - n === "connect" && /* @__PURE__ */ pe.jsx( + n === "connect" && /* @__PURE__ */ le.jsx( z9, { onShowQrCode: () => i("qr"), @@ -43335,18 +43350,18 @@ function fse(t) { onSignFinish: s } ), - n === "get-extension" && /* @__PURE__ */ pe.jsx(W9, { wallet: e }) + n === "get-extension" && /* @__PURE__ */ le.jsx(W9, { wallet: e }) ] }); } -function lse(t) { +function hse(t) { const { email: e } = t, [r, n] = Yt("captcha"); - return /* @__PURE__ */ pe.jsxs(Ms, { children: [ - /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ pe.jsx(Pc, { title: "Sign in with email", onBack: t.onBack }) }), - r === "captcha" && /* @__PURE__ */ pe.jsx($9, { email: e, onCodeSend: () => n("verify-email") }), - r === "verify-email" && /* @__PURE__ */ pe.jsx(k9, { email: e, onInputCode: t.onInputCode, onResendCode: () => n("captcha") }) + return /* @__PURE__ */ le.jsxs(Ms, { children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ le.jsx(Pc, { title: "Sign in with email", onBack: t.onBack }) }), + r === "captcha" && /* @__PURE__ */ le.jsx($9, { email: e, onCodeSend: () => n("verify-email") }), + r === "verify-email" && /* @__PURE__ */ le.jsx(k9, { email: e, onInputCode: t.onInputCode, onResendCode: () => n("captcha") }) ] }); } -function xoe(t) { +function _oe(t) { const { onEvmWalletConnect: e, onTonWalletConnect: r, onEmailConnect: n, config: i = { showEmailSignIn: !1, showFeaturedWallets: !0, @@ -43367,10 +43382,10 @@ function xoe(t) { wallet: U })), o("index"); } - async function $(U, V) { + async function B(U, V) { await (n == null ? void 0 : n(U, V)); } - function B(U) { + function $(U) { d(U), o("ton-wallet-connect"); } async function H(U) { @@ -43387,31 +43402,31 @@ function xoe(t) { }); const U = p.current.onStatusChange(H); return o("index"), U; - }, []), /* @__PURE__ */ pe.jsxs(tA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ - s === "evm-wallet-select" && /* @__PURE__ */ pe.jsx( + }, []), /* @__PURE__ */ le.jsxs(tA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ + s === "evm-wallet-select" && /* @__PURE__ */ le.jsx( rA, { onBack: () => o("index"), onSelectWallet: M } ), - s === "evm-wallet-connect" && /* @__PURE__ */ pe.jsx( - fse, + s === "evm-wallet-connect" && /* @__PURE__ */ le.jsx( + lse, { onBack: () => o("index"), onConnect: L, wallet: a } ), - s === "ton-wallet-select" && /* @__PURE__ */ pe.jsx( + s === "ton-wallet-select" && /* @__PURE__ */ le.jsx( H9, { connector: p.current, - onSelect: B, + onSelect: $, onBack: () => o("index") } ), - s === "ton-wallet-connect" && /* @__PURE__ */ pe.jsx( + s === "ton-wallet-connect" && /* @__PURE__ */ le.jsx( eA, { connector: p.current, @@ -43419,8 +43434,8 @@ function xoe(t) { onBack: () => o("index") } ), - s === "email-connect" && /* @__PURE__ */ pe.jsx(lse, { email: w, onBack: () => o("index"), onInputCode: $ }), - s === "index" && /* @__PURE__ */ pe.jsx( + s === "email-connect" && /* @__PURE__ */ le.jsx(hse, { email: w, onBack: () => o("index"), onInputCode: B }), + s === "index" && /* @__PURE__ */ le.jsx( M9, { onEmailConfirm: N, @@ -43433,18 +43448,18 @@ function xoe(t) { ] }); } export { - boe as C, - T5 as H, + yoe as C, + C5 as H, vl as W, aZ as a, Ll as b, - mse as c, - woe as d, + vse as c, + xoe as d, Hd as e, - xoe as f, - gse as h, - vse as r, - i4 as s, + _oe as f, + mse as h, + bse as r, + n4 as s, C0 as t, mp as u }; diff --git a/dist/secp256k1-DuMBhiq0.js b/dist/secp256k1-CjFIzVvG.js similarity index 99% rename from dist/secp256k1-DuMBhiq0.js rename to dist/secp256k1-CjFIzVvG.js index 2be3b1b..f00448b 100644 --- a/dist/secp256k1-DuMBhiq0.js +++ b/dist/secp256k1-CjFIzVvG.js @@ -1,4 +1,4 @@ -import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-BN1nTxTF.js"; +import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-BX-27dZd.js"; class Kt extends ee { constructor(n, t) { super(), this.finished = !1, this.destroyed = !1, ne(n); diff --git a/lib/codatta-connect-context-provider.tsx b/lib/codatta-connect-context-provider.tsx index 58a09d8..af06bd0 100644 --- a/lib/codatta-connect-context-provider.tsx +++ b/lib/codatta-connect-context-provider.tsx @@ -53,9 +53,9 @@ export function useCodattaConnectContext() { interface CodattaConnectContextProviderProps { children: React.ReactNode apiBaseUrl?: string + singleWalletName?: string } - interface LastUsedWalletInfo { provider: 'UniversalProvider' | 'EIP1193Provider', key: string, @@ -82,11 +82,17 @@ export function CodattaConnectContextProvider(props: CodattaConnectContextProvid } function sortWallet(wallets: WalletItem[]) { - const featuredWallets = wallets.filter((item) => item.featured || item.installed) - const restWallets = wallets.filter((item) => !item.featured && !item.installed) - const sortedWallets = [...featuredWallets, ...restWallets] - setWallets(sortedWallets) - setFeaturedWallets(featuredWallets) + + const singleWallet = wallets.find((item) => item.config?.name === props.singleWalletName) + if (singleWallet) { + setFeaturedWallets([singleWallet]) + } else { + const featuredWallets = wallets.filter((item) => item.featured || item.installed) + const restWallets = wallets.filter((item) => !item.featured && !item.installed) + const sortedWallets = [...featuredWallets, ...restWallets] + setWallets(sortedWallets) + setFeaturedWallets(featuredWallets) + } } async function init() { @@ -116,7 +122,6 @@ export function CodattaConnectContextProvider(props: CodattaConnectContextProvid walletMap.set(walletItem.key, walletItem) wallets.push(walletItem) } - console.log(detail) }) // handle last used wallet info and restore walletconnect UniveralProvider diff --git a/lib/components/signin-index.tsx b/lib/components/signin-index.tsx index d2b136c..f7089bd 100644 --- a/lib/components/signin-index.tsx +++ b/lib/components/signin-index.tsx @@ -5,6 +5,7 @@ import { WalletItem } from '../types/wallet-item.class' import TransitionEffect from './transition-effect' import { SignInOptionItem, WalletOption } from './wallet-option' import Spliter from './ui/spliter' +import SingleWalletOption from './single-wallet-option' const ImageTonIcon = 'https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton' @@ -42,10 +43,6 @@ export default function SingInIndex(props: { const { featuredWallets, initialized } = useCodattaConnectContext() const { onEmailConfirm, onSelectWallet, onSelectMoreWallets, onSelectTonConnect, config } = props - const binanceWallet = useMemo(() => { - return featuredWallets?.find((item) => item.config?.rdns === 'binance') - }, [featuredWallets]) - const isEmail = useMemo(() => { const hasChinese = /[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu @@ -77,20 +74,18 @@ export default function SingInIndex(props: { {props.header ||
Log in or sign up
} - {/* if in binance wallet, show binance wallet */} - {binanceWallet && ( + {featuredWallets.length === 1 && (
- + >)}
) } - {/* if not in binance wallet, show other wallets */} - {!binanceWallet && <> + {featuredWallets.length > 1 && <>
{config.showFeaturedWallets && featuredWallets && diff --git a/lib/components/single-wallet-option.tsx b/lib/components/single-wallet-option.tsx new file mode 100644 index 0000000..7b7c2d0 --- /dev/null +++ b/lib/components/single-wallet-option.tsx @@ -0,0 +1,19 @@ +import { WalletItem } from "../types/wallet-item.class" + +export default function SingleWalletOption(props: { wallet: WalletItem; onClick: (wallet: WalletItem) => void }) { + + const { wallet, onClick } = props + + return
+ + +
+

Connect to Binance Wallet

+
+ +
+
+
+} \ No newline at end of file diff --git a/lib/components/ton-wallet-select.tsx b/lib/components/ton-wallet-select.tsx index 6f91483..38d0f04 100644 --- a/lib/components/ton-wallet-select.tsx +++ b/lib/components/ton-wallet-select.tsx @@ -37,7 +37,6 @@ export default function TonWalletSelect(props: { async function init() { const wallets = await connector.getWallets() setWallets(wallets) - console.log(wallets) } useEffect(() => { diff --git a/lib/components/wallet-qr.tsx b/lib/components/wallet-qr.tsx index d3742a0..a8c73df 100644 --- a/lib/components/wallet-qr.tsx +++ b/lib/components/wallet-qr.tsx @@ -82,7 +82,6 @@ export default function WalletQr(props: { try { setGuideType('scan') provider.on('display_uri', (uri:string) => { - console.log('display_uri', uri) setWcUri(uri) setUriLoading(false) setGuideType('scan') diff --git a/lib/types/wallet-item.class.ts b/lib/types/wallet-item.class.ts index b9f209e..2de9d9c 100644 --- a/lib/types/wallet-item.class.ts +++ b/lib/types/wallet-item.class.ts @@ -73,7 +73,6 @@ export class WalletItem { } } else if ('info' in params) { // eip6963 - console.log(params.info, 'installed') this._key = params.info.name this._provider = params.provider this._installed = true diff --git a/package.json b/package.json index 6eb23cf..3548b49 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codatta-connect", - "version": "2.4.6", + "version": "2.4.8", "type": "module", "main": "./dist/index.umd.js", "module": "./dist/index.es.js", diff --git a/src/layout/app-layout.tsx b/src/layout/app-layout.tsx index 4117c30..cbcadb6 100644 --- a/src/layout/app-layout.tsx +++ b/src/layout/app-layout.tsx @@ -2,7 +2,7 @@ import React from 'react' import { CodattaConnectContextProvider } from '../../lib/main' export default function AppLayout(props: { children: React.ReactNode }) { - return + return
{props.children}
diff --git a/src/views/login-view.tsx b/src/views/login-view.tsx index d23faad..6015796 100644 --- a/src/views/login-view.tsx +++ b/src/views/login-view.tsx @@ -80,7 +80,7 @@ export default function LoginView() { device:'WEB', app:'test', inviterCode:'', - role: 'B' + role: 'B', }}> ); From f6a4be4c10c4c29e0b129151dc8b2432d6af1ef8 Mon Sep 17 00:00:00 2001 From: Meow Lord Date: Wed, 18 Jun 2025 15:38:30 +0800 Subject: [PATCH 16/25] fix wallet name display --- dist/index.es.js | 2 +- dist/index.umd.js | 2 +- dist/{main-BX-27dZd.js => main-CeikbqJc.js} | 9 ++++++--- dist/{secp256k1-CjFIzVvG.js => secp256k1-ChAPgt46.js} | 2 +- lib/components/single-wallet-option.tsx | 2 +- package.json | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-) rename dist/{main-BX-27dZd.js => main-CeikbqJc.js} (99%) rename dist/{secp256k1-CjFIzVvG.js => secp256k1-ChAPgt46.js} (99%) diff --git a/dist/index.es.js b/dist/index.es.js index 6f57226..beff7e5 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -1,4 +1,4 @@ -import { f as o, C as e, d as n, W as C, a as s, u as d } from "./main-BX-27dZd.js"; +import { f as o, C as e, d as n, W as C, a as s, u as d } from "./main-CeikbqJc.js"; export { o as CodattaConnect, e as CodattaConnectContextProvider, diff --git a/dist/index.umd.js b/dist/index.umd.js index a231d4e..a63379e 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -199,7 +199,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene top: ${u}px !important; left: ${l}px !important; } - `),()=>{document.head.removeChild(d)}},[e]),de.jsx(aX,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const uX=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=bb(fX),u=Se.useId(),l=Se.useCallback(p=>{a.set(p,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Se.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:p=>(a.set(p,!1),()=>a.delete(p))}),s?[Math.random(),l]:[r,l]);return Se.useMemo(()=>{a.forEach((p,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=de.jsx(cX,{isPresent:r,children:t})),de.jsx(F0.Provider,{value:d,children:t})};function fX(){return new Map}const K0=t=>t.key||"";function QS(t){const e=[];return Se.Children.forEach(t,r=>{Se.isValidElement(r)&&e.push(r)}),e}const lX=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Oo(!e,"Replace exitBeforeEnter with mode='wait'");const a=Se.useMemo(()=>QS(t),[t]),u=a.map(K0),l=Se.useRef(!0),d=Se.useRef(a),p=bb(()=>new Map),[y,A]=Se.useState(a),[P,O]=Se.useState(a);DS(()=>{l.current=!1,d.current=a;for(let B=0;B1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=Se.useContext(ob);return de.jsx(de.Fragment,{children:P.map(B=>{const q=K0(B),j=a===P||u.includes(q),H=()=>{if(p.has(q))p.set(q,!0);else return;let J=!0;p.forEach(T=>{T||(J=!1)}),J&&(k==null||k(),O(d.current),i&&i())};return de.jsx(uX,{isPresent:j,initial:!l.current||n?void 0:!1,custom:j?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:j?void 0:H,children:B},q)})})},Ss=t=>de.jsx(lX,{children:de.jsx(oX.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Sb(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return de.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,de.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[de.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),de.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:de.jsx(NK,{})})]})]})}function hX(t){return t.lastUsed?de.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[de.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?de.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[de.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function e7(t){var o,a;const{wallet:e,onClick:r}=t,n=de.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Se.useMemo(()=>hX(e),[e]);return de.jsx(Sb,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function t7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=vX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Ab);return a[0]===""&&a.length!==1&&a.shift(),r7(a,e)||mX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},r7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?r7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Ab);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},n7=/^\[(.+)\]$/,mX=t=>{if(n7.test(t)){const e=n7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},vX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return yX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Pb(o,n,s,e)}),n},Pb=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:i7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(bX(i)){Pb(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Pb(o,i7(e,s),r,n)})})},i7=(t,e)=>{let r=t;return e.split(Ab).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},bX=t=>t.isThemeGetter,yX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,wX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},s7="!",xX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,p;for(let D=0;Dd?p-d:void 0;return{modifiers:u,hasImportantModifier:A,baseClassName:P,maybePostfixModifierPosition:O}};return r?a=>r({className:a,parseClassName:o}):o},_X=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},EX=t=>({cache:wX(t.cacheSize),parseClassName:xX(t),...gX(t)}),SX=/\s+/,AX=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(SX);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:A}=r(l);let P=!!A,O=n(P?y.substring(0,A):y);if(!O){if(!P){a=l+(a.length>0?" "+a:a);continue}if(O=n(y),!O){a=l+(a.length>0?" "+a:a);continue}P=!1}const D=_X(d).join(":"),k=p?D+s7:D,B=k+O;if(s.includes(B))continue;s.push(B);const q=i(O,P);for(let j=0;j0?" "+a:a)}return a};function PX(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;np(d),t());return r=EX(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=AX(u,r);return i(u,d),d}return function(){return s(PX.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},a7=/^\[(?:([a-z-]+):)?(.+)\]$/i,IX=/^\d+\/\d+$/,CX=new Set(["px","full","screen"]),TX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RX=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,DX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,OX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bo=t=>Ku(t)||CX.has(t)||IX.test(t),Ea=t=>Vu(t,"length",qX),Ku=t=>!!t&&!Number.isNaN(Number(t)),Mb=t=>Vu(t,"number",Ku),oh=t=>!!t&&Number.isInteger(Number(t)),LX=t=>t.endsWith("%")&&Ku(t.slice(0,-1)),cr=t=>a7.test(t),Sa=t=>TX.test(t),kX=new Set(["length","size","percentage"]),BX=t=>Vu(t,kX,c7),$X=t=>Vu(t,"position",c7),FX=new Set(["image","url"]),jX=t=>Vu(t,FX,HX),UX=t=>Vu(t,"",zX),ah=()=>!0,Vu=(t,e,r)=>{const n=a7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},qX=t=>RX.test(t)&&!DX.test(t),c7=()=>!1,zX=t=>OX.test(t),HX=t=>NX.test(t),WX=MX(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),p=Gr("invert"),y=Gr("gap"),A=Gr("gradientColorStops"),P=Gr("gradientColorStopPositions"),O=Gr("inset"),D=Gr("margin"),k=Gr("opacity"),B=Gr("padding"),q=Gr("saturate"),j=Gr("scale"),H=Gr("sepia"),J=Gr("skew"),T=Gr("space"),z=Gr("translate"),ue=()=>["auto","contain","none"],_e=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",Bo,Ea],f=()=>["auto",Ku,cr],g=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],S=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Ku,cr];return{cacheSize:500,separator:":",theme:{colors:[ah],spacing:[Bo,Ea],blur:["none","",Sa,cr],brightness:M(),borderColor:[t],borderRadius:["none","","full",Sa,cr],borderSpacing:E(),borderWidth:m(),contrast:M(),grayscale:S(),hueRotate:M(),invert:S(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[LX,Ea],inset:G(),margin:G(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:S(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Sa]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...g(),cr]}],overflow:[{overflow:_e()}],"overflow-x":[{"overflow-x":_e()}],"overflow-y":[{"overflow-y":_e()}],overscroll:[{overscroll:ue()}],"overscroll-x":[{"overscroll-x":ue()}],"overscroll-y":[{"overscroll-y":ue()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[O]}],"inset-x":[{"inset-x":[O]}],"inset-y":[{"inset-y":[O]}],start:[{start:[O]}],end:[{end:[O]}],top:[{top:[O]}],right:[{right:[O]}],bottom:[{bottom:[O]}],left:[{left:[O]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",oh,cr]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",oh,cr]}],"grid-cols":[{"grid-cols":[ah]}],"col-start-end":[{col:["auto",{span:["full",oh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[ah]}],"row-start-end":[{row:["auto",{span:[oh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[B]}],px:[{px:[B]}],py:[{py:[B]}],ps:[{ps:[B]}],pe:[{pe:[B]}],pt:[{pt:[B]}],pr:[{pr:[B]}],pb:[{pb:[B]}],pl:[{pl:[B]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Sa]},Sa]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Sa,Ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Mb]}],"font-family":[{font:[ah]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Ku,Mb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Bo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Bo,Ea]}],"underline-offset":[{"underline-offset":["auto",Bo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...g(),$X]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",BX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},jX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[A]}],"gradient-via":[{via:[A]}],"gradient-to":[{to:[A]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[Bo,cr]}],"outline-w":[{outline:[Bo,Ea]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Bo,Ea]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Sa,UX]}],"shadow-color":[{shadow:[ah]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Sa,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[p]}],saturate:[{saturate:[q]}],sepia:[{sepia:[H]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[q]}],"backdrop-sepia":[{"backdrop-sepia":[H]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[oh,cr]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[J]}],"skew-y":[{"skew-y":[J]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Bo,Ea,Mb]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function $o(...t){return WX(pX(t))}function u7(t){const{className:e}=t;return de.jsxs("div",{className:$o("xc-flex xc-items-center xc-gap-2"),children:[de.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)}),de.jsx("div",{className:"xc-shrink-0",children:t.children}),de.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)})]})}function KX(t){var n;const{wallet:e,onClick:r}=t;return de.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[de.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(n=e.config)==null?void 0:n.image,alt:""}),de.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[de.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:"Connect to Binance Wallet"}),de.jsx("div",{className:"xc-flex xc-gap-2",children:de.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:()=>r(e),children:"Connect"})})]})]})}const VX="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function GX(t){const{onClick:e}=t;function r(){e&&e()}return de.jsx(u7,{className:"xc-opacity-20",children:de.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[de.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),de.jsx(u8,{size:16})]})})}function f7(t){const[e,r]=Se.useState(""),{featuredWallets:n,initialized:i}=Kl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Se.useMemo(()=>{const O=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!O.test(e)&&D.test(e)},[e]);function p(O){o(O)}function y(O){r(O.target.value)}async function A(){s(e)}function P(O){O.key==="Enter"&&d&&A()}return de.jsx(Ss,{children:i&&de.jsxs(de.Fragment,{children:[t.header||de.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),n.length===1&&de.jsx("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:n.map(O=>de.jsx(KX,{wallet:O,onClick:p},`feature-${O.key}`))}),n.length>1&&de.jsxs(de.Fragment,{children:[de.jsxs("div",{children:[de.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(O=>de.jsx(e7,{wallet:O,onClick:p},`feature-${O.key}`)),l.showTonConnect&&de.jsx(Sb,{icon:de.jsx("img",{className:"xc-h-5 xc-w-5",src:VX}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&de.jsx(GX,{onClick:a})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&de.jsx("div",{className:"xc-mb-4 xc-mt-4",children:de.jsxs(u7,{className:"xc-opacity-20",children:[" ",de.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),l.showEmailSignIn&&de.jsxs("div",{className:"xc-mb-4",children:[de.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:y,onKeyDown:P}),de.jsx("button",{disabled:!d,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:A,children:"Continue"})]})]})]})})}function Sc(t){const{title:e}=t;return de.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[de.jsx(OK,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),de.jsx("span",{children:e})]})}const l7=Se.createContext({channel:"",device:"WEB",app:"",inviterCode:"",role:"C"});function Ib(){return Se.useContext(l7)}function YX(t){const{config:e}=t,[r,n]=Se.useState(e.channel),[i,s]=Se.useState(e.device),[o,a]=Se.useState(e.app),[u,l]=Se.useState(e.role||"C"),[d,p]=Se.useState(e.inviterCode);return Se.useEffect(()=>{n(e.channel),s(e.device),a(e.app),p(e.inviterCode),l(e.role||"C")},[e]),de.jsx(l7.Provider,{value:{channel:r,device:i,app:o,inviterCode:d,role:u},children:t.children})}var JX=Object.defineProperty,XX=Object.defineProperties,ZX=Object.getOwnPropertyDescriptors,V0=Object.getOwnPropertySymbols,h7=Object.prototype.hasOwnProperty,d7=Object.prototype.propertyIsEnumerable,p7=(t,e,r)=>e in t?JX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,QX=(t,e)=>{for(var r in e||(e={}))h7.call(e,r)&&p7(t,r,e[r]);if(V0)for(var r of V0(e))d7.call(e,r)&&p7(t,r,e[r]);return t},eZ=(t,e)=>XX(t,ZX(e)),tZ=(t,e)=>{var r={};for(var n in t)h7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&V0)for(var n of V0(t))e.indexOf(n)<0&&d7.call(t,n)&&(r[n]=t[n]);return r};function rZ(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function nZ(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var iZ=18,g7=40,sZ=`${g7}px`,oZ=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function aZ({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),p=Yt.useCallback(()=>{let y=t.current,A=e.current;if(!y||!A||u||r==="none")return;let P=y,O=P.getBoundingClientRect().left+P.offsetWidth,D=P.getBoundingClientRect().top+P.offsetHeight/2,k=O-iZ,B=D;document.querySelectorAll(oZ).length===0&&document.elementFromPoint(k,B)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function A(){let O=window.innerWidth-y.getBoundingClientRect().right;a(O>=g7)}A();let P=setInterval(A,1e3);return()=>{clearInterval(P)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let A=setTimeout(p,0),P=setTimeout(p,2e3),O=setTimeout(p,5e3),D=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(A),clearTimeout(P),clearTimeout(O),clearTimeout(D)}},[e,n,r,p]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:sZ}}var m7=Yt.createContext({}),v7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:p="increase-width",pasteTransformer:y,containerClassName:A,noScriptCSSFallback:P=cZ,render:O,children:D}=r,k=tZ(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),B,q,j,H,J;let[T,z]=Yt.useState(typeof k.defaultValue=="string"?k.defaultValue:""),ue=n??T,_e=nZ(ue),G=Yt.useCallback(ie=>{i==null||i(ie),z(ie)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),g=Yt.useRef({value:ue,onChange:G,isIOS:typeof window<"u"&&((q=(B=window==null?void 0:window.CSS)==null?void 0:B.supports)==null?void 0:q.call(B,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(j=m.current)==null?void 0:j.selectionStart,(H=m.current)==null?void 0:H.selectionEnd,(J=m.current)==null?void 0:J.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let ie=m.current,fe=f.current;if(!ie||!fe)return;g.current.value!==ie.value&&g.current.onChange(ie.value),v.current.prev=[ie.selectionStart,ie.selectionEnd,ie.selectionDirection];function ve(){if(document.activeElement!==ie){I(null),ce(null);return}let Te=ie.selectionStart,$e=ie.selectionEnd,Ie=ie.selectionDirection,Le=ie.maxLength,Ve=ie.value,ke=v.current.prev,ze=-1,He=-1,Ee;if(Ve.length!==0&&Te!==null&&$e!==null){let et=Te===$e,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let pt=0;if(ke[0]!==null&&ke[1]!==null){Ee=Je{fe&&fe.style.setProperty("--root-height",`${ie.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(ie),()=>{document.removeEventListener("selectionchange",ve,{capture:!0}),Ne.disconnect()}},[]);let[x,_]=Yt.useState(!1),[S,b]=Yt.useState(!1),[M,I]=Yt.useState(null),[F,ce]=Yt.useState(null);Yt.useEffect(()=>{rZ(()=>{var ie,fe,ve,Me;(ie=m.current)==null||ie.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(ve=m.current)==null?void 0:ve.selectionEnd,$e=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ce(Te),v.current.prev=[Ne,Te,$e])})},[ue,S]),Yt.useEffect(()=>{_e!==void 0&&ue!==_e&&_e.length{let fe=ie.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){ie.preventDefault();return}typeof _e=="string"&&fe.length<_e.length&&document.dispatchEvent(new Event("selectionchange")),G(fe)},[s,G,_e,E]),ee=Yt.useCallback(()=>{var ie;if(m.current){let fe=Math.min(m.current.value.length,s-1),ve=m.current.value.length;(ie=m.current)==null||ie.setSelectionRange(fe,ve),I(fe),ce(ve)}b(!0)},[s]),X=Yt.useCallback(ie=>{var fe,ve;let Me=m.current;if(!y&&(!g.current.isIOS||!ie.clipboardData||!Me))return;let Ne=ie.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),ie.preventDefault();let $e=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(ve=m.current)==null?void 0:ve.selectionEnd,Le=($e!==Ie?ue.slice(0,$e)+Te+ue.slice(Ie):ue.slice(0,$e)+Te+ue.slice($e)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,G(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ce(ke)},[s,G,E,ue]),Q=Yt.useMemo(()=>({position:"relative",cursor:k.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[k.disabled]),R=Yt.useMemo(()=>({position:"absolute",inset:0,width:N.willPushPWMBadge?`calc(100% + ${N.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:N.willPushPWMBadge?`inset(0 ${N.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[N.PWM_BADGE_SPACE_WIDTH,N.willPushPWMBadge,o]),Z=Yt.useMemo(()=>Yt.createElement("input",eZ(QX({autoComplete:k.autoComplete||"one-time-code"},k),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ue.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:R,maxLength:s,value:ue,ref:m,onPaste:ie=>{var fe;X(ie),(fe=k.onPaste)==null||fe.call(k,ie)},onChange:se,onMouseOver:ie=>{var fe;_(!0),(fe=k.onMouseOver)==null||fe.call(k,ie)},onMouseLeave:ie=>{var fe;_(!1),(fe=k.onMouseLeave)==null||fe.call(k,ie)},onFocus:ie=>{var fe;ee(),(fe=k.onFocus)==null||fe.call(k,ie)},onBlur:ie=>{var fe;b(!1),(fe=k.onBlur)==null||fe.call(k,ie)}})),[se,ee,X,l,R,s,F,M,k,E==null?void 0:E.source,ue]),te=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ie,fe)=>{var ve;let Me=S&&M!==null&&F!==null&&(M===F&&fe===M||fe>=M&&feO?O(te):Yt.createElement(m7.Provider,{value:te},D),[D,te,O]);return Yt.createElement(Yt.Fragment,null,P!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,P)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:A},le,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Z)))});v7.displayName="Input";function ch(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var cZ=` + `),()=>{document.head.removeChild(d)}},[e]),de.jsx(aX,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const uX=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=bb(fX),u=Se.useId(),l=Se.useCallback(p=>{a.set(p,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Se.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:p=>(a.set(p,!1),()=>a.delete(p))}),s?[Math.random(),l]:[r,l]);return Se.useMemo(()=>{a.forEach((p,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=de.jsx(cX,{isPresent:r,children:t})),de.jsx(F0.Provider,{value:d,children:t})};function fX(){return new Map}const K0=t=>t.key||"";function QS(t){const e=[];return Se.Children.forEach(t,r=>{Se.isValidElement(r)&&e.push(r)}),e}const lX=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Oo(!e,"Replace exitBeforeEnter with mode='wait'");const a=Se.useMemo(()=>QS(t),[t]),u=a.map(K0),l=Se.useRef(!0),d=Se.useRef(a),p=bb(()=>new Map),[y,A]=Se.useState(a),[P,O]=Se.useState(a);DS(()=>{l.current=!1,d.current=a;for(let B=0;B1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=Se.useContext(ob);return de.jsx(de.Fragment,{children:P.map(B=>{const q=K0(B),j=a===P||u.includes(q),H=()=>{if(p.has(q))p.set(q,!0);else return;let J=!0;p.forEach(T=>{T||(J=!1)}),J&&(k==null||k(),O(d.current),i&&i())};return de.jsx(uX,{isPresent:j,initial:!l.current||n?void 0:!1,custom:j?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:j?void 0:H,children:B},q)})})},Ss=t=>de.jsx(lX,{children:de.jsx(oX.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Sb(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return de.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,de.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[de.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),de.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:de.jsx(NK,{})})]})]})}function hX(t){return t.lastUsed?de.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[de.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?de.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[de.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function e7(t){var o,a;const{wallet:e,onClick:r}=t,n=de.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Se.useMemo(()=>hX(e),[e]);return de.jsx(Sb,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function t7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=vX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Ab);return a[0]===""&&a.length!==1&&a.shift(),r7(a,e)||mX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},r7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?r7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Ab);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},n7=/^\[(.+)\]$/,mX=t=>{if(n7.test(t)){const e=n7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},vX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return yX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Pb(o,n,s,e)}),n},Pb=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:i7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(bX(i)){Pb(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Pb(o,i7(e,s),r,n)})})},i7=(t,e)=>{let r=t;return e.split(Ab).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},bX=t=>t.isThemeGetter,yX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,wX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},s7="!",xX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,p;for(let D=0;Dd?p-d:void 0;return{modifiers:u,hasImportantModifier:A,baseClassName:P,maybePostfixModifierPosition:O}};return r?a=>r({className:a,parseClassName:o}):o},_X=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},EX=t=>({cache:wX(t.cacheSize),parseClassName:xX(t),...gX(t)}),SX=/\s+/,AX=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(SX);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:A}=r(l);let P=!!A,O=n(P?y.substring(0,A):y);if(!O){if(!P){a=l+(a.length>0?" "+a:a);continue}if(O=n(y),!O){a=l+(a.length>0?" "+a:a);continue}P=!1}const D=_X(d).join(":"),k=p?D+s7:D,B=k+O;if(s.includes(B))continue;s.push(B);const q=i(O,P);for(let j=0;j0?" "+a:a)}return a};function PX(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;np(d),t());return r=EX(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=AX(u,r);return i(u,d),d}return function(){return s(PX.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},a7=/^\[(?:([a-z-]+):)?(.+)\]$/i,IX=/^\d+\/\d+$/,CX=new Set(["px","full","screen"]),TX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RX=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,DX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,OX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bo=t=>Ku(t)||CX.has(t)||IX.test(t),Ea=t=>Vu(t,"length",qX),Ku=t=>!!t&&!Number.isNaN(Number(t)),Mb=t=>Vu(t,"number",Ku),oh=t=>!!t&&Number.isInteger(Number(t)),LX=t=>t.endsWith("%")&&Ku(t.slice(0,-1)),cr=t=>a7.test(t),Sa=t=>TX.test(t),kX=new Set(["length","size","percentage"]),BX=t=>Vu(t,kX,c7),$X=t=>Vu(t,"position",c7),FX=new Set(["image","url"]),jX=t=>Vu(t,FX,HX),UX=t=>Vu(t,"",zX),ah=()=>!0,Vu=(t,e,r)=>{const n=a7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},qX=t=>RX.test(t)&&!DX.test(t),c7=()=>!1,zX=t=>OX.test(t),HX=t=>NX.test(t),WX=MX(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),p=Gr("invert"),y=Gr("gap"),A=Gr("gradientColorStops"),P=Gr("gradientColorStopPositions"),O=Gr("inset"),D=Gr("margin"),k=Gr("opacity"),B=Gr("padding"),q=Gr("saturate"),j=Gr("scale"),H=Gr("sepia"),J=Gr("skew"),T=Gr("space"),z=Gr("translate"),ue=()=>["auto","contain","none"],_e=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",Bo,Ea],f=()=>["auto",Ku,cr],g=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],S=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Ku,cr];return{cacheSize:500,separator:":",theme:{colors:[ah],spacing:[Bo,Ea],blur:["none","",Sa,cr],brightness:M(),borderColor:[t],borderRadius:["none","","full",Sa,cr],borderSpacing:E(),borderWidth:m(),contrast:M(),grayscale:S(),hueRotate:M(),invert:S(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[LX,Ea],inset:G(),margin:G(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:S(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Sa]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...g(),cr]}],overflow:[{overflow:_e()}],"overflow-x":[{"overflow-x":_e()}],"overflow-y":[{"overflow-y":_e()}],overscroll:[{overscroll:ue()}],"overscroll-x":[{"overscroll-x":ue()}],"overscroll-y":[{"overscroll-y":ue()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[O]}],"inset-x":[{"inset-x":[O]}],"inset-y":[{"inset-y":[O]}],start:[{start:[O]}],end:[{end:[O]}],top:[{top:[O]}],right:[{right:[O]}],bottom:[{bottom:[O]}],left:[{left:[O]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",oh,cr]}],basis:[{basis:G()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",oh,cr]}],"grid-cols":[{"grid-cols":[ah]}],"col-start-end":[{col:["auto",{span:["full",oh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[ah]}],"row-start-end":[{row:["auto",{span:[oh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[B]}],px:[{px:[B]}],py:[{py:[B]}],ps:[{ps:[B]}],pe:[{pe:[B]}],pt:[{pt:[B]}],pr:[{pr:[B]}],pb:[{pb:[B]}],pl:[{pl:[B]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Sa]},Sa]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Sa,Ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Mb]}],"font-family":[{font:[ah]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Ku,Mb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Bo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Bo,Ea]}],"underline-offset":[{"underline-offset":["auto",Bo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...g(),$X]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",BX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},jX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[A]}],"gradient-via":[{via:[A]}],"gradient-to":[{to:[A]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[Bo,cr]}],"outline-w":[{outline:[Bo,Ea]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Bo,Ea]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Sa,UX]}],"shadow-color":[{shadow:[ah]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Sa,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[p]}],saturate:[{saturate:[q]}],sepia:[{sepia:[H]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[q]}],"backdrop-sepia":[{"backdrop-sepia":[H]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[oh,cr]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[J]}],"skew-y":[{"skew-y":[J]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Bo,Ea,Mb]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function $o(...t){return WX(pX(t))}function u7(t){const{className:e}=t;return de.jsxs("div",{className:$o("xc-flex xc-items-center xc-gap-2"),children:[de.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)}),de.jsx("div",{className:"xc-shrink-0",children:t.children}),de.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)})]})}function KX(t){var n,i;const{wallet:e,onClick:r}=t;return de.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[de.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(n=e.config)==null?void 0:n.image,alt:""}),de.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[de.jsxs("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:["Connect to ",(i=e.config)==null?void 0:i.name]}),de.jsx("div",{className:"xc-flex xc-gap-2",children:de.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:()=>r(e),children:"Connect"})})]})]})}const VX="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function GX(t){const{onClick:e}=t;function r(){e&&e()}return de.jsx(u7,{className:"xc-opacity-20",children:de.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[de.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),de.jsx(u8,{size:16})]})})}function f7(t){const[e,r]=Se.useState(""),{featuredWallets:n,initialized:i}=Kl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Se.useMemo(()=>{const O=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!O.test(e)&&D.test(e)},[e]);function p(O){o(O)}function y(O){r(O.target.value)}async function A(){s(e)}function P(O){O.key==="Enter"&&d&&A()}return de.jsx(Ss,{children:i&&de.jsxs(de.Fragment,{children:[t.header||de.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),n.length===1&&de.jsx("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:n.map(O=>de.jsx(KX,{wallet:O,onClick:p},`feature-${O.key}`))}),n.length>1&&de.jsxs(de.Fragment,{children:[de.jsxs("div",{children:[de.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(O=>de.jsx(e7,{wallet:O,onClick:p},`feature-${O.key}`)),l.showTonConnect&&de.jsx(Sb,{icon:de.jsx("img",{className:"xc-h-5 xc-w-5",src:VX}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&de.jsx(GX,{onClick:a})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&de.jsx("div",{className:"xc-mb-4 xc-mt-4",children:de.jsxs(u7,{className:"xc-opacity-20",children:[" ",de.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),l.showEmailSignIn&&de.jsxs("div",{className:"xc-mb-4",children:[de.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:y,onKeyDown:P}),de.jsx("button",{disabled:!d,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:A,children:"Continue"})]})]})]})})}function Sc(t){const{title:e}=t;return de.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[de.jsx(OK,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),de.jsx("span",{children:e})]})}const l7=Se.createContext({channel:"",device:"WEB",app:"",inviterCode:"",role:"C"});function Ib(){return Se.useContext(l7)}function YX(t){const{config:e}=t,[r,n]=Se.useState(e.channel),[i,s]=Se.useState(e.device),[o,a]=Se.useState(e.app),[u,l]=Se.useState(e.role||"C"),[d,p]=Se.useState(e.inviterCode);return Se.useEffect(()=>{n(e.channel),s(e.device),a(e.app),p(e.inviterCode),l(e.role||"C")},[e]),de.jsx(l7.Provider,{value:{channel:r,device:i,app:o,inviterCode:d,role:u},children:t.children})}var JX=Object.defineProperty,XX=Object.defineProperties,ZX=Object.getOwnPropertyDescriptors,V0=Object.getOwnPropertySymbols,h7=Object.prototype.hasOwnProperty,d7=Object.prototype.propertyIsEnumerable,p7=(t,e,r)=>e in t?JX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,QX=(t,e)=>{for(var r in e||(e={}))h7.call(e,r)&&p7(t,r,e[r]);if(V0)for(var r of V0(e))d7.call(e,r)&&p7(t,r,e[r]);return t},eZ=(t,e)=>XX(t,ZX(e)),tZ=(t,e)=>{var r={};for(var n in t)h7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&V0)for(var n of V0(t))e.indexOf(n)<0&&d7.call(t,n)&&(r[n]=t[n]);return r};function rZ(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function nZ(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var iZ=18,g7=40,sZ=`${g7}px`,oZ=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function aZ({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),p=Yt.useCallback(()=>{let y=t.current,A=e.current;if(!y||!A||u||r==="none")return;let P=y,O=P.getBoundingClientRect().left+P.offsetWidth,D=P.getBoundingClientRect().top+P.offsetHeight/2,k=O-iZ,B=D;document.querySelectorAll(oZ).length===0&&document.elementFromPoint(k,B)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function A(){let O=window.innerWidth-y.getBoundingClientRect().right;a(O>=g7)}A();let P=setInterval(A,1e3);return()=>{clearInterval(P)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let A=setTimeout(p,0),P=setTimeout(p,2e3),O=setTimeout(p,5e3),D=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(A),clearTimeout(P),clearTimeout(O),clearTimeout(D)}},[e,n,r,p]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:sZ}}var m7=Yt.createContext({}),v7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:p="increase-width",pasteTransformer:y,containerClassName:A,noScriptCSSFallback:P=cZ,render:O,children:D}=r,k=tZ(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),B,q,j,H,J;let[T,z]=Yt.useState(typeof k.defaultValue=="string"?k.defaultValue:""),ue=n??T,_e=nZ(ue),G=Yt.useCallback(ie=>{i==null||i(ie),z(ie)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),g=Yt.useRef({value:ue,onChange:G,isIOS:typeof window<"u"&&((q=(B=window==null?void 0:window.CSS)==null?void 0:B.supports)==null?void 0:q.call(B,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(j=m.current)==null?void 0:j.selectionStart,(H=m.current)==null?void 0:H.selectionEnd,(J=m.current)==null?void 0:J.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let ie=m.current,fe=f.current;if(!ie||!fe)return;g.current.value!==ie.value&&g.current.onChange(ie.value),v.current.prev=[ie.selectionStart,ie.selectionEnd,ie.selectionDirection];function ve(){if(document.activeElement!==ie){I(null),ce(null);return}let Te=ie.selectionStart,$e=ie.selectionEnd,Ie=ie.selectionDirection,Le=ie.maxLength,Ve=ie.value,ke=v.current.prev,ze=-1,He=-1,Ee;if(Ve.length!==0&&Te!==null&&$e!==null){let et=Te===$e,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let pt=0;if(ke[0]!==null&&ke[1]!==null){Ee=Je{fe&&fe.style.setProperty("--root-height",`${ie.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(ie),()=>{document.removeEventListener("selectionchange",ve,{capture:!0}),Ne.disconnect()}},[]);let[x,_]=Yt.useState(!1),[S,b]=Yt.useState(!1),[M,I]=Yt.useState(null),[F,ce]=Yt.useState(null);Yt.useEffect(()=>{rZ(()=>{var ie,fe,ve,Me;(ie=m.current)==null||ie.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(ve=m.current)==null?void 0:ve.selectionEnd,$e=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ce(Te),v.current.prev=[Ne,Te,$e])})},[ue,S]),Yt.useEffect(()=>{_e!==void 0&&ue!==_e&&_e.length{let fe=ie.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){ie.preventDefault();return}typeof _e=="string"&&fe.length<_e.length&&document.dispatchEvent(new Event("selectionchange")),G(fe)},[s,G,_e,E]),ee=Yt.useCallback(()=>{var ie;if(m.current){let fe=Math.min(m.current.value.length,s-1),ve=m.current.value.length;(ie=m.current)==null||ie.setSelectionRange(fe,ve),I(fe),ce(ve)}b(!0)},[s]),X=Yt.useCallback(ie=>{var fe,ve;let Me=m.current;if(!y&&(!g.current.isIOS||!ie.clipboardData||!Me))return;let Ne=ie.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),ie.preventDefault();let $e=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(ve=m.current)==null?void 0:ve.selectionEnd,Le=($e!==Ie?ue.slice(0,$e)+Te+ue.slice(Ie):ue.slice(0,$e)+Te+ue.slice($e)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,G(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ce(ke)},[s,G,E,ue]),Q=Yt.useMemo(()=>({position:"relative",cursor:k.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[k.disabled]),R=Yt.useMemo(()=>({position:"absolute",inset:0,width:N.willPushPWMBadge?`calc(100% + ${N.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:N.willPushPWMBadge?`inset(0 ${N.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[N.PWM_BADGE_SPACE_WIDTH,N.willPushPWMBadge,o]),Z=Yt.useMemo(()=>Yt.createElement("input",eZ(QX({autoComplete:k.autoComplete||"one-time-code"},k),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ue.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:R,maxLength:s,value:ue,ref:m,onPaste:ie=>{var fe;X(ie),(fe=k.onPaste)==null||fe.call(k,ie)},onChange:se,onMouseOver:ie=>{var fe;_(!0),(fe=k.onMouseOver)==null||fe.call(k,ie)},onMouseLeave:ie=>{var fe;_(!1),(fe=k.onMouseLeave)==null||fe.call(k,ie)},onFocus:ie=>{var fe;ee(),(fe=k.onFocus)==null||fe.call(k,ie)},onBlur:ie=>{var fe;b(!1),(fe=k.onBlur)==null||fe.call(k,ie)}})),[se,ee,X,l,R,s,F,M,k,E==null?void 0:E.source,ue]),te=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ie,fe)=>{var ve;let Me=S&&M!==null&&F!==null&&(M===F&&fe===M||fe>=M&&feO?O(te):Yt.createElement(m7.Provider,{value:te},D),[D,te,O]);return Yt.createElement(Yt.Fragment,null,P!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,P)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:A},le,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Z)))});v7.displayName="Input";function ch(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var cZ=` [data-input-otp] { --nojs-bg: white !important; --nojs-fg: black !important; diff --git a/dist/main-BX-27dZd.js b/dist/main-CeikbqJc.js similarity index 99% rename from dist/main-BX-27dZd.js rename to dist/main-CeikbqJc.js index 411dfe2..efa42f0 100644 --- a/dist/main-BX-27dZd.js +++ b/dist/main-CeikbqJc.js @@ -2850,7 +2850,7 @@ function UO(t) { return Bl(`0x${e}`); } async function qO({ hash: t, signature: e }) { - const r = va(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-CjFIzVvG.js"); + const r = va(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-ChAPgt46.js"); return `0x${(() => { if (typeof e == "object" && "r" in e && "s" in e) { const { r: l, s: d, v: p, yParity: w } = e, A = Number(w ?? p), M = C2(A); @@ -38117,12 +38117,15 @@ function P9(t) { ] }); } function Mne(t) { - var n; + var n, i; const { wallet: e, onClick: r } = t; return /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4", children: [ /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-h-16 xc-w-16", src: (n = e.config) == null ? void 0 : n.image, alt: "" }), /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ - /* @__PURE__ */ le.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: "Connect to Binance Wallet" }), + /* @__PURE__ */ le.jsxs("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: [ + "Connect to ", + (i = e.config) == null ? void 0 : i.name + ] }), /* @__PURE__ */ le.jsx("div", { className: "xc-flex xc-gap-2", children: /* @__PURE__ */ le.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: () => r(e), children: "Connect" }) }) ] }) ] }); diff --git a/dist/secp256k1-CjFIzVvG.js b/dist/secp256k1-ChAPgt46.js similarity index 99% rename from dist/secp256k1-CjFIzVvG.js rename to dist/secp256k1-ChAPgt46.js index f00448b..3fa8f39 100644 --- a/dist/secp256k1-CjFIzVvG.js +++ b/dist/secp256k1-ChAPgt46.js @@ -1,4 +1,4 @@ -import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-BX-27dZd.js"; +import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-CeikbqJc.js"; class Kt extends ee { constructor(n, t) { super(), this.finished = !1, this.destroyed = !1, ne(n); diff --git a/lib/components/single-wallet-option.tsx b/lib/components/single-wallet-option.tsx index 7b7c2d0..3252d82 100644 --- a/lib/components/single-wallet-option.tsx +++ b/lib/components/single-wallet-option.tsx @@ -8,7 +8,7 @@ export default function SingleWalletOption(props: { wallet: WalletItem; onClick:
-

Connect to Binance Wallet

+

Connect to {wallet.config?.name}

";for(var ve=0;ve';ie+=""}return(ie+="")+"
"},I.createSvgTag=function(te,le,ie,fe){var ve={};typeof arguments[0]=="object"&&(te=(ve=arguments[0]).cellSize,le=ve.margin,ie=ve.alt,fe=ve.title),te=te||2,le=le===void 0?4*te:le,(ie=typeof ie=="string"?{text:ie}:ie||{}).text=ie.text||null,ie.id=ie.text?ie.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*te+2*le,Le="";for($e="l"+te+",0 0,"+te+" -"+te+",0 0,-"+te+"z ",Le+=''+Z(fe.text)+"":"",Le+=ie.text?''+Z(ie.text)+"":"",Le+='',Le+='"},I.createDataURL=function(te,le){te=te||2,le=le===void 0?4*te:le;var ie=I.getModuleCount()*te+2*le,fe=le,ve=ie-le;return m(ie,ie,function(Me,Ne){if(fe<=Me&&Me"};var Z=function(te){for(var le="",ie=0;ie":le+=">";break;case"&":le+="&";break;case'"':le+=""";break;default:le+=fe}}return le};return I.createASCII=function(te,le){if((te=te||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Ee,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:pt[Be];ft+=` -`}return et%2&&ze>0?ft.substring(0,ft.length-et-1)+Array(et+1).join("▀"):ft.substring(0,ft.length-1)}(le);te-=1,le=le===void 0?2*te:le;var ie,fe,ve,Me,Ne=I.getModuleCount()*te+2*le,Te=le,$e=Ne-le,Ie=Array(te+1).join("██"),Le=Array(te+1).join(" "),Ve="",ke="";for(ie=0;ie>>8),S.push(255&I)):S.push(x)}}return S}};var y,A,P,O,D,k={L:1,M:0,Q:3,H:2},B=(y=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],A=1335,P=7973,D=function(f){for(var g=0;f!=0;)g+=1,f>>>=1;return g},(O={}).getBCHTypeInfo=function(f){for(var g=f<<10;D(g)-D(A)>=0;)g^=A<=0;)g^=P<5&&(v+=3+S-5)}for(x=0;x=256;)x-=255;return f[x]}}}();function j(f,g){if(f.length===void 0)throw f.length+"/"+g;var v=function(){for(var _=0;_>>7-x%8&1)==1},put:function(x,_){for(var S=0;S<_;S+=1)v.putBit((x>>>_-S-1&1)==1)},getLengthInBits:function(){return g},putBit:function(x){var _=Math.floor(g/8);f.length<=_&&f.push(0),x&&(f[_]|=128>>>g%8),g+=1}};return v},T=function(f){var g=f,v={getMode:function(){return 1},getLength:function(S){return g.length},write:function(S){for(var b=g,M=0;M+2>>8&255)+(255&M),_.put(M,13),b+=2}if(b>>8)},writeBytes:function(v,x,_){x=x||0,_=_||v.length;for(var S=0;S<_;S+=1)g.writeByte(v[S+x])},writeString:function(v){for(var x=0;x0&&(v+=","),v+=f[x];return v+"]"}};return g},E=function(f){var g=f,v=0,x=0,_=0,S={read:function(){for(;_<8;){if(v>=g.length){if(_==0)return-1;throw"unexpected end of file./"+_}var M=g.charAt(v);if(v+=1,M=="=")return _=0,-1;M.match(/^\s$/)||(x=x<<6|b(M.charCodeAt(0)),_+=6)}var I=x>>>_-8&255;return _-=8,I}},b=function(M){if(65<=M&&M<=90)return M-65;if(97<=M&&M<=122)return M-97+26;if(48<=M&&M<=57)return M-48+52;if(M==43)return 62;if(M==47)return 63;throw"c:"+M};return S},m=function(f,g,v){for(var x=function(ce,N){var se=ce,ee=N,X=new Array(ce*N),Q={setPixel:function(te,le,ie){X[le*se+te]=ie},write:function(te){te.writeString("GIF87a"),te.writeShort(se),te.writeShort(ee),te.writeByte(128),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(0),te.writeByte(255),te.writeByte(255),te.writeByte(255),te.writeString(","),te.writeShort(0),te.writeShort(0),te.writeShort(se),te.writeShort(ee),te.writeByte(0);var le=R(2);te.writeByte(2);for(var ie=0;le.length-ie>255;)te.writeByte(255),te.writeBytes(le,ie,255),ie+=255;te.writeByte(le.length-ie),te.writeBytes(le,ie,le.length-ie),te.writeByte(0),te.writeString(";")}},R=function(te){for(var le=1<>>Ee)throw"length over";for(;Te+Ee>=8;)Ne.writeByte(255&(He<>>=8-Te,$e=0,Te=0;$e|=He<0&&Ne.writeByte($e)}});Le.write(le,fe);var Ve=0,ke=String.fromCharCode(X[Ve]);for(Ve+=1;Ve=6;)Q(ce>>>N-6),N-=6},X.flush=function(){if(N>0&&(Q(ce<<6-N),ce=0,N=0),se%3!=0)for(var Z=3-se%3,te=0;te>6,128|63&O):O<55296||O>=57344?A.push(224|O>>12,128|O>>6&63,128|63&O):(P++,O=65536+((1023&O)<<10|1023&y.charCodeAt(P)),A.push(240|O>>18,128|O>>12&63,128|O>>6&63,128|63&O))}return A}(p)},(l=typeof(u=function(){return d})=="function"?u.apply(a,[]):u)===void 0||(o.exports=l)}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var u=n[o]={exports:{}};return r[o](u,u.exports,i),u.exports}i.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return i.d(a,{a}),a},i.d=(o,a)=>{for(var u in a)i.o(a,u)&&!i.o(o,u)&&Object.defineProperty(o,u,{enumerable:!0,get:a[u]})},i.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a);var s={};return(()=>{i.d(s,{default:()=>G});const o=E=>!!E&&typeof E=="object"&&!Array.isArray(E);function a(E,...m){if(!m.length)return E;const f=m.shift();return f!==void 0&&o(E)&&o(f)?(E=Object.assign({},E),Object.keys(f).forEach(g=>{const v=E[g],x=f[g];Array.isArray(v)&&Array.isArray(x)?E[g]=x:o(v)&&o(x)?E[g]=a(Object.assign({},v),x):E[g]=x}),a(E,...m)):E}function u(E,m){const f=document.createElement("a");f.download=m,f.href=E,document.body.appendChild(f),f.click(),document.body.removeChild(f)}const l={L:.07,M:.15,Q:.25,H:.3};class d{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"dots":x=this._drawDot;break;case"classy":x=this._drawClassy;break;case"classy-rounded":x=this._drawClassyRounded;break;case"rounded":x=this._drawRounded;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawSquare}x.call(this,{x:m,y:f,size:g,getNeighbor:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_basicSideRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, 0 ${-f}`)}}))}_basicCornerRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_basicCornerExtraRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`)}}))}_basicCornersRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${f/2} ${f/2}h `+f/2+"v "+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_drawDot({x:m,y:f,size:g}){this._basicDot({x:m,y:f,size:g,rotation:0})}_drawSquare({x:m,y:f,size:g}){this._basicSquare({x:m,y:f,size:g,rotation:0})}_drawRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerRounded({x:m,y:f,size:g,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawExtraRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0,M=x+_+S+b;if(M!==0)if(M>2||x&&_||S&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(M===2){let I=0;return x&&S?I=Math.PI/2:S&&_?I=Math.PI:_&&b&&(I=-Math.PI/2),void this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:I})}if(M===1){let I=0;return S?I=Math.PI/2:_?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawClassy({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}_drawClassyRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,_=v?+v(1,0):0,S=v?+v(0,-1):0,b=v?+v(0,1):0;x+_+S+b!==0?x||S?_||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}}class p{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"square":x=this._drawSquare;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawDot}x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g+f/2} ${v}a ${f/2} ${f/2} 0 1 0 0.1 0zm 0 ${x}a ${f/2-x} ${f/2-x} 0 1 1 -0.1 0Z`)}}))}_basicSquare(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f+`zM ${g+x} ${v+x}h `+(f-2*x)+"v "+(f-2*x)+"h "+(2*x-f)+"z")}}))}_basicExtraRounded(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v+2.5*x}v `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*x}h `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*-x}v `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*-x}h `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*x}M ${g+2.5*x} ${v+x}h `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*x}v `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*x}h `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*-x}v `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*-x}`)}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}_drawExtraRounded({x:m,y:f,size:g,rotation:v}){this._basicExtraRounded({x:m,y:f,size:g,rotation:v})}}class y{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;x=this._type==="square"?this._drawSquare:this._drawDot,x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var _;const S=m+g/2,b=f+g/2;x(),(_=this._element)===null||_===void 0||_.setAttribute("transform",`rotate(${180*v/Math.PI},${S},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}}const A="circle",P=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],O=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class D{constructor(m,f){this._roundSize=g=>this._options.dotsOptions.roundSize?Math.floor(g):g,this._window=f,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(m.width)),this._element.setAttribute("height",String(m.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),m.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=m.image,this._instanceId=D.instanceCount++,this._options=m}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(m){const f=m.getModuleCount(),g=Math.min(this._options.width,this._options.height)-2*this._options.margin,v=this._options.shape===A?g/Math.sqrt(2):g,x=this._roundSize(v/f);let _={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=m,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:S,qrOptions:b}=this._options,M=S.imageSize*l[b.errorCorrectionLevel],I=Math.floor(M*f*f);_=function({originalHeight:F,originalWidth:ce,maxHiddenDots:N,maxHiddenAxisDots:se,dotSize:ee}){const X={x:0,y:0},Q={x:0,y:0};if(F<=0||ce<=0||N<=0||ee<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const R=F/ce;return X.x=Math.floor(Math.sqrt(N/R)),X.x<=0&&(X.x=1),se&&seN||se&&se{var M,I,F,ce,N,se;return!(this._options.imageOptions.hideBackgroundDots&&S>=(f-_.hideYDots)/2&&S<(f+_.hideYDots)/2&&b>=(f-_.hideXDots)/2&&b<(f+_.hideXDots)/2||!((M=P[S])===null||M===void 0)&&M[b]||!((I=P[S-f+7])===null||I===void 0)&&I[b]||!((F=P[S])===null||F===void 0)&&F[b-f+7]||!((ce=O[S])===null||ce===void 0)&&ce[b]||!((N=O[S-f+7])===null||N===void 0)&&N[b]||!((se=O[S])===null||se===void 0)&&se[b-f+7])}),this.drawCorners(),this._options.image&&await this.drawImage({width:_.width,height:_.height,count:f,dotSize:x})}drawBackground(){var m,f,g;const v=this._element,x=this._options;if(v){const _=(m=x.backgroundOptions)===null||m===void 0?void 0:m.gradient,S=(f=x.backgroundOptions)===null||f===void 0?void 0:f.color;let b=x.height,M=x.width;if(_||S){const I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((g=x.backgroundOptions)===null||g===void 0)&&g.round&&(b=M=Math.min(x.width,x.height),I.setAttribute("rx",String(b/2*x.backgroundOptions.round))),I.setAttribute("x",String(this._roundSize((x.width-M)/2))),I.setAttribute("y",String(this._roundSize((x.height-b)/2))),I.setAttribute("width",String(M)),I.setAttribute("height",String(b)),this._backgroundClipPath.appendChild(I),this._createColor({options:_,color:S,additionalRotation:0,x:0,y:0,height:x.height,width:x.width,name:`background-color-${this._instanceId}`})}}}drawDots(m){var f,g;if(!this._qr)throw"QR code is not defined";const v=this._options,x=this._qr.getModuleCount();if(x>v.width||x>v.height)throw"The canvas is too small.";const _=Math.min(v.width,v.height)-2*v.margin,S=v.shape===A?_/Math.sqrt(2):_,b=this._roundSize(S/x),M=this._roundSize((v.width-x*b)/2),I=this._roundSize((v.height-x*b)/2),F=new d({svg:this._element,type:v.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(f=v.dotsOptions)===null||f===void 0?void 0:f.gradient,color:v.dotsOptions.color,additionalRotation:0,x:0,y:0,height:v.height,width:v.width,name:`dot-color-${this._instanceId}`});for(let ce=0;ce!(N+se<0||ce+ee<0||N+se>=x||ce+ee>=x)&&!(m&&!m(ce+ee,N+se))&&!!this._qr&&this._qr.isDark(ce+ee,N+se)),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element));if(v.shape===A){const ce=this._roundSize((_/b-x)/2),N=x+2*ce,se=M-ce*b,ee=I-ce*b,X=[],Q=this._roundSize(N/2);for(let R=0;R=ce-1&&R<=N-ce&&Z>=ce-1&&Z<=N-ce||Math.sqrt((R-Q)*(R-Q)+(Z-Q)*(Z-Q))>Q?X[R][Z]=0:X[R][Z]=this._qr.isDark(Z-2*ce<0?Z:Z>=x?Z-2*ce:Z-ce,R-2*ce<0?R:R>=x?R-2*ce:R-ce)?1:0}for(let R=0;R{var ie;return!!(!((ie=X[R+le])===null||ie===void 0)&&ie[Z+te])}),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const m=this._element,f=this._options;if(!m)throw"Element code is not defined";const g=this._qr.getModuleCount(),v=Math.min(f.width,f.height)-2*f.margin,x=f.shape===A?v/Math.sqrt(2):v,_=this._roundSize(x/g),S=7*_,b=3*_,M=this._roundSize((f.width-g*_)/2),I=this._roundSize((f.height-g*_)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([F,ce,N])=>{var se,ee,X,Q,R,Z,te,le,ie,fe,ve,Me;const Ne=M+F*_*(g-7),Te=I+ce*_*(g-7);let $e=this._dotsClipPath,Ie=this._dotsClipPath;if((!((se=f.cornersSquareOptions)===null||se===void 0)&&se.gradient||!((ee=f.cornersSquareOptions)===null||ee===void 0)&&ee.color)&&($e=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),$e.setAttribute("id",`clip-path-corners-square-color-${F}-${ce}-${this._instanceId}`),this._defs.appendChild($e),this._cornersSquareClipPath=this._cornersDotClipPath=Ie=$e,this._createColor({options:(X=f.cornersSquareOptions)===null||X===void 0?void 0:X.gradient,color:(Q=f.cornersSquareOptions)===null||Q===void 0?void 0:Q.color,additionalRotation:N,x:Ne,y:Te,height:S,width:S,name:`corners-square-color-${F}-${ce}-${this._instanceId}`})),(R=f.cornersSquareOptions)===null||R===void 0?void 0:R.type){const Le=new p({svg:this._element,type:f.cornersSquareOptions.type,window:this._window});Le.draw(Ne,Te,S,N),Le._element&&$e&&$e.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=P[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&$e&&$e.appendChild(Le._element))}if((!((te=f.cornersDotOptions)===null||te===void 0)&&te.gradient||!((le=f.cornersDotOptions)===null||le===void 0)&&le.color)&&(Ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Ie.setAttribute("id",`clip-path-corners-dot-color-${F}-${ce}-${this._instanceId}`),this._defs.appendChild(Ie),this._cornersDotClipPath=Ie,this._createColor({options:(ie=f.cornersDotOptions)===null||ie===void 0?void 0:ie.gradient,color:(fe=f.cornersDotOptions)===null||fe===void 0?void 0:fe.color,additionalRotation:N,x:Ne+2*_,y:Te+2*_,height:b,width:b,name:`corners-dot-color-${F}-${ce}-${this._instanceId}`})),(ve=f.cornersDotOptions)===null||ve===void 0?void 0:ve.type){const Le=new y({svg:this._element,type:f.cornersDotOptions.type,window:this._window});Le.draw(Ne+2*_,Te+2*_,b,N),Le._element&&Ie&&Ie.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Ee;return!!(!((Ee=O[Ve+He])===null||Ee===void 0)&&Ee[ke+ze])}),Le._element&&Ie&&Ie.appendChild(Le._element))}})}loadImage(){return new Promise((m,f)=>{var g;const v=this._options;if(!v.image)return f("Image is not defined");if(!((g=v.nodeCanvas)===null||g===void 0)&&g.loadImage)v.nodeCanvas.loadImage(v.image).then(x=>{var _,S;if(this._image=x,this._options.imageOptions.saveAsBlob){const b=(_=v.nodeCanvas)===null||_===void 0?void 0:_.createCanvas(this._image.width,this._image.height);(S=b==null?void 0:b.getContext("2d"))===null||S===void 0||S.drawImage(x,0,0),this._imageUri=b==null?void 0:b.toDataURL()}m()}).catch(f);else{const x=new this._window.Image;typeof v.imageOptions.crossOrigin=="string"&&(x.crossOrigin=v.imageOptions.crossOrigin),this._image=x,x.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await async function(_,S){return new Promise(b=>{const M=new S.XMLHttpRequest;M.onload=function(){const I=new S.FileReader;I.onloadend=function(){b(I.result)},I.readAsDataURL(M.response)},M.open("GET",_),M.responseType="blob",M.send()})}(v.image||"",this._window)),m()},x.src=v.image}})}async drawImage({width:m,height:f,count:g,dotSize:v}){const x=this._options,_=this._roundSize((x.width-g*v)/2),S=this._roundSize((x.height-g*v)/2),b=_+this._roundSize(x.imageOptions.margin+(g*v-m)/2),M=S+this._roundSize(x.imageOptions.margin+(g*v-f)/2),I=m-2*x.imageOptions.margin,F=f-2*x.imageOptions.margin,ce=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");ce.setAttribute("href",this._imageUri||""),ce.setAttribute("x",String(b)),ce.setAttribute("y",String(M)),ce.setAttribute("width",`${I}px`),ce.setAttribute("height",`${F}px`),this._element.appendChild(ce)}_createColor({options:m,color:f,additionalRotation:g,x:v,y:x,height:_,width:S,name:b}){const M=S>_?S:_,I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(I.setAttribute("x",String(v)),I.setAttribute("y",String(x)),I.setAttribute("height",String(_)),I.setAttribute("width",String(S)),I.setAttribute("clip-path",`url('#clip-path-${b}')`),m){let F;if(m.type==="radial")F=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("fx",String(v+S/2)),F.setAttribute("fy",String(x+_/2)),F.setAttribute("cx",String(v+S/2)),F.setAttribute("cy",String(x+_/2)),F.setAttribute("r",String(M/2));else{const ce=((m.rotation||0)+g)%(2*Math.PI),N=(ce+2*Math.PI)%(2*Math.PI);let se=v+S/2,ee=x+_/2,X=v+S/2,Q=x+_/2;N>=0&&N<=.25*Math.PI||N>1.75*Math.PI&&N<=2*Math.PI?(se-=S/2,ee-=_/2*Math.tan(ce),X+=S/2,Q+=_/2*Math.tan(ce)):N>.25*Math.PI&&N<=.75*Math.PI?(ee-=_/2,se-=S/2/Math.tan(ce),Q+=_/2,X+=S/2/Math.tan(ce)):N>.75*Math.PI&&N<=1.25*Math.PI?(se+=S/2,ee+=_/2*Math.tan(ce),X-=S/2,Q-=_/2*Math.tan(ce)):N>1.25*Math.PI&&N<=1.75*Math.PI&&(ee+=_/2,se+=S/2/Math.tan(ce),Q-=_/2,X-=S/2/Math.tan(ce)),F=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("x1",String(Math.round(se))),F.setAttribute("y1",String(Math.round(ee))),F.setAttribute("x2",String(Math.round(X))),F.setAttribute("y2",String(Math.round(Q)))}m.colorStops.forEach(({offset:ce,color:N})=>{const se=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");se.setAttribute("offset",100*ce+"%"),se.setAttribute("stop-color",N),F.appendChild(se)}),I.setAttribute("fill",`url('#${b}')`),this._defs.appendChild(F)}else f&&I.setAttribute("fill",f);this._element.appendChild(I)}}D.instanceCount=0;const k=D,B="canvas",q={};for(let E=0;E<=40;E++)q[E]=E;const j={type:B,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:q[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function H(E){const m=Object.assign({},E);if(!m.colorStops||!m.colorStops.length)throw"Field 'colorStops' is required in gradient";return m.rotation?m.rotation=Number(m.rotation):m.rotation=0,m.colorStops=m.colorStops.map(f=>Object.assign(Object.assign({},f),{offset:Number(f.offset)})),m}function J(E){const m=Object.assign({},E);return m.width=Number(m.width),m.height=Number(m.height),m.margin=Number(m.margin),m.imageOptions=Object.assign(Object.assign({},m.imageOptions),{hideBackgroundDots:!!m.imageOptions.hideBackgroundDots,imageSize:Number(m.imageOptions.imageSize),margin:Number(m.imageOptions.margin)}),m.margin>Math.min(m.width,m.height)&&(m.margin=Math.min(m.width,m.height)),m.dotsOptions=Object.assign({},m.dotsOptions),m.dotsOptions.gradient&&(m.dotsOptions.gradient=H(m.dotsOptions.gradient)),m.cornersSquareOptions&&(m.cornersSquareOptions=Object.assign({},m.cornersSquareOptions),m.cornersSquareOptions.gradient&&(m.cornersSquareOptions.gradient=H(m.cornersSquareOptions.gradient))),m.cornersDotOptions&&(m.cornersDotOptions=Object.assign({},m.cornersDotOptions),m.cornersDotOptions.gradient&&(m.cornersDotOptions.gradient=H(m.cornersDotOptions.gradient))),m.backgroundOptions&&(m.backgroundOptions=Object.assign({},m.backgroundOptions),m.backgroundOptions.gradient&&(m.backgroundOptions.gradient=H(m.backgroundOptions.gradient))),m}var T=i(873),z=i.n(T);function ue(E){if(!E)throw new Error("Extension must be defined");E[0]==="."&&(E=E.substring(1));const m={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[E.toLowerCase()];if(!m)throw new Error(`Extension "${E}" is not supported`);return m}class _e{constructor(m){m!=null&&m.jsdom?this._window=new m.jsdom("",{resources:"usable"}).window:this._window=window,this._options=m?J(a(j,m)):j,this.update()}static _clearContainer(m){m&&(m.innerHTML="")}_setupSvg(){if(!this._qr)return;const m=new k(this._options,this._window);this._svg=m.getElement(),this._svgDrawingPromise=m.drawQR(this._qr).then(()=>{var f;this._svg&&((f=this._extension)===null||f===void 0||f.call(this,m.getElement(),this._options))})}_setupCanvas(){var m,f;this._qr&&(!((m=this._options.nodeCanvas)===null||m===void 0)&&m.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(f=this._svgDrawingPromise)===null||f===void 0?void 0:f.then(()=>{var g;if(!this._svg)return;const v=this._svg,x=new this._window.XMLSerializer().serializeToString(v),_=btoa(x),S=`data:${ue("svg")};base64,${_}`;if(!((g=this._options.nodeCanvas)===null||g===void 0)&&g.loadImage)return this._options.nodeCanvas.loadImage(S).then(b=>{var M,I;b.width=this._options.width,b.height=this._options.height,(I=(M=this._nodeCanvas)===null||M===void 0?void 0:M.getContext("2d"))===null||I===void 0||I.drawImage(b,0,0)});{const b=new this._window.Image;return new Promise(M=>{b.onload=()=>{var I,F;(F=(I=this._domCanvas)===null||I===void 0?void 0:I.getContext("2d"))===null||F===void 0||F.drawImage(b,0,0),M()},b.src=S})}}))}async _getElement(m="png"){if(!this._qr)throw"QR code is empty";return m.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(m){_e._clearContainer(this._container),this._options=m?J(a(this._options,m)):this._options,this._options.data&&(this._qr=z()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(f){switch(!0){case/^[0-9]*$/.test(f):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(f):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===B?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(m){if(m){if(typeof m.appendChild!="function")throw"Container should be a single DOM node";this._options.type===B?this._domCanvas&&m.appendChild(this._domCanvas):this._svg&&m.appendChild(this._svg),this._container=m}}applyExtension(m){if(!m)throw"Extension function should be defined.";this._extension=m,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(m="png"){if(!this._qr)throw"QR code is empty";const f=await this._getElement(m),g=ue(m);if(!f)return null;if(m.toLowerCase()==="svg"){const v=`\r +}`;const V7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>le.jsx(K7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));V7.displayName="InputOTP";const G7=Yt.forwardRef(({className:t,...e},r)=>le.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));G7.displayName="InputOTPGroup";const Rc=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(W7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return le.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&le.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:le.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Rc.displayName="InputOTPSlot";function FZ(t){const{spinning:e,children:r,className:n}=t;return le.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&le.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:le.jsx(Ec,{className:"xc-animate-spin"})})]})}function Y7(t){const{email:e}=t,[r,n]=Ee.useState(0),[i,s]=Ee.useState(!1),[o,a]=Ee.useState("");async function u(){n(60);const d=setInterval(()=>{n(p=>p===0?(clearInterval(d),0):p-1)},1e3)}async function l(d){if(a(""),!(d.length<6)){s(!0);try{await t.onInputCode(e,d)}catch(p){a(p.message)}s(!1)}}return Ee.useEffect(()=>{u()},[]),le.jsxs(Ms,{children:[le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[le.jsx(gV,{className:"xc-mb-4",size:60}),le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:[le.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),le.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]}),le.jsx("div",{className:"xc-mb-2 xc-h-12",children:le.jsx(FZ,{spinning:i,className:"xc-rounded-xl",children:le.jsx(V7,{maxLength:6,onChange:l,disabled:i,className:"disabled:xc-opacity-20",children:le.jsx(G7,{children:le.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[le.jsx(Rc,{index:0}),le.jsx(Rc,{index:1}),le.jsx(Rc,{index:2}),le.jsx(Rc,{index:3}),le.jsx(Rc,{index:4}),le.jsx(Rc,{index:5})]})})})})}),o&&le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{children:o})})]}),le.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Resend in ${r}s`:le.jsx("button",{id:"sendCodeButton",onClick:t.onResendCode,children:"Send again"})]}),le.jsx("div",{id:"captcha-element"})]})}function J7(t){const{email:e}=t,[r,n]=Ee.useState(!1),[i,s]=Ee.useState(""),o=Ee.useMemo(()=>`xn-btn-${new Date().getTime()}`,[e]);async function a(y,_){n(!0),s(""),await xa.getEmailCode({account_type:"email",email:y},_),n(!1)}async function u(y){try{return await a(e,JSON.stringify(y)),{captchaResult:!0,bizResult:!0}}catch(_){return s(_.message),{captchaResult:!1,bizResult:!1}}}async function l(y){y&&t.onCodeSend()}const d=Ee.useRef();function p(y){d.current=y}return Ee.useEffect(()=>{if(e)return window.initAliyunCaptcha({SceneId:"tqyu8129d",prefix:"1mfsn5f",mode:"popup",element:"#captcha-element",button:`#${o}`,captchaVerifyCallback:u,onBizResultCallback:l,getInstance:p,slideStyle:{width:360,height:40},language:"en",region:"cn"}),()=>{var y,_;(y=document.getElementById("aliyunCaptcha-mask"))==null||y.remove(),(_=document.getElementById("aliyunCaptcha-window-popup"))==null||_.remove()}},[e]),le.jsxs(Ms,{children:[le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[le.jsx(mV,{className:"xc-mb-4",size:60}),le.jsx("button",{className:"xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2",id:o,children:r?le.jsx(Ec,{className:"xc-animate-spin"}):"I'm not a robot"})]}),i&&le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{children:i})})]})}function jZ(t){const{email:e}=t,r=Bb(),[n,i]=Ee.useState("captcha");async function s(o,a){const u=await xa.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:a,email:o,inviter_code:r.inviterCode,source:{device:r.device,channel:r.channel,app:r.app}});t.onLogin(u.data)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-12",children:le.jsx(Tc,{title:"Sign in with email",onBack:t.onBack})}),n==="captcha"&&le.jsx(J7,{email:e,onCodeSend:()=>i("verify-email")}),n==="verify-email"&&le.jsx(Y7,{email:e,onInputCode:s,onResendCode:()=>i("captcha")})]})}var X7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var p=function(f,g){var v=f,x=B[g],S=null,A=0,b=null,P=[],I={},F=function(re,ge){S=function(oe){for(var fe=new Array(oe),be=0;be=7&&ee(re),b==null&&(b=T(v,x,P)),Q(b,ge)},ce=function(re,ge){for(var oe=-1;oe<=7;oe+=1)if(!(re+oe<=-1||A<=re+oe))for(var fe=-1;fe<=7;fe+=1)ge+fe<=-1||A<=ge+fe||(S[re+oe][ge+fe]=0<=oe&&oe<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(oe==0||oe==6)||2<=oe&&oe<=4&&2<=fe&&fe<=4)},D=function(){for(var re=8;re>oe&1)==1;S[Math.floor(oe/3)][oe%3+A-8-3]=fe}for(oe=0;oe<18;oe+=1)fe=!re&&(ge>>oe&1)==1,S[oe%3+A-8-3][Math.floor(oe/3)]=fe},J=function(re,ge){for(var oe=x<<3|ge,fe=k.getBCHTypeInfo(oe),be=0;be<15;be+=1){var Me=!re&&(fe>>be&1)==1;be<6?S[be][8]=Me:be<8?S[be+1][8]=Me:S[A-15+be][8]=Me}for(be=0;be<15;be+=1)Me=!re&&(fe>>be&1)==1,be<8?S[8][A-be-1]=Me:be<9?S[8][15-be-1+1]=Me:S[8][15-be-1]=Me;S[A-8][8]=!re},Q=function(re,ge){for(var oe=-1,fe=A-1,be=7,Me=0,Ne=k.getMaskFunction(ge),Te=A-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var $e=0;$e<2;$e+=1)if(S[fe][Te-$e]==null){var Ie=!1;Me>>be&1)==1),Ne(fe,Te-$e)&&(Ie=!Ie),S[fe][Te-$e]=Ie,(be-=1)==-1&&(Me+=1,be=7)}if((fe+=oe)<0||A<=fe){fe-=oe,oe=-oe;break}}},T=function(re,ge,oe){for(var fe=z.getRSBlocks(re,ge),be=Z(),Me=0;Me8*Te)throw"code length overflow. ("+be.getLengthInBits()+">"+8*Te+")";for(be.getLengthInBits()+4<=8*Te&&be.put(0,4);be.getLengthInBits()%8!=0;)be.putBit(!1);for(;!(be.getLengthInBits()>=8*Te||(be.put(236,8),be.getLengthInBits()>=8*Te));)be.put(17,8);return function($e,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Se=0;Se=0?rt.getAt(Je):0}}var gt=0;for(Be=0;BeIe)&&(Ne=Ie,Te=$e)}return Te}())},I.createTableTag=function(re,ge){re=re||2;var oe="";oe+='";for(var be=0;be';oe+=""}return(oe+="")+"
"},I.createSvgTag=function(re,ge,oe,fe){var be={};typeof arguments[0]=="object"&&(re=(be=arguments[0]).cellSize,ge=be.margin,oe=be.alt,fe=be.title),re=re||2,ge=ge===void 0?4*re:ge,(oe=typeof oe=="string"?{text:oe}:oe||{}).text=oe.text||null,oe.id=oe.text?oe.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*re+2*ge,Le="";for($e="l"+re+",0 0,"+re+" -"+re+",0 0,-"+re+"z ",Le+=''+X(fe.text)+"":"",Le+=oe.text?''+X(oe.text)+"":"",Le+='',Le+='"},I.createDataURL=function(re,ge){re=re||2,ge=ge===void 0?4*re:ge;var oe=I.getModuleCount()*re+2*ge,fe=ge,be=oe-ge;return m(oe,oe,function(Me,Ne){if(fe<=Me&&Me"};var X=function(re){for(var ge="",oe=0;oe":ge+=">";break;case"&":ge+="&";break;case'"':ge+=""";break;default:ge+=fe}}return ge};return I.createASCII=function(re,ge){if((re=re||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Se,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,gt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:gt[Be];ft+=` +`}return et%2&&ze>0?ft.substring(0,ft.length-et-1)+Array(et+1).join("▀"):ft.substring(0,ft.length-1)}(ge);re-=1,ge=ge===void 0?2*re:ge;var oe,fe,be,Me,Ne=I.getModuleCount()*re+2*ge,Te=ge,$e=Ne-ge,Ie=Array(re+1).join("██"),Le=Array(re+1).join(" "),Ve="",ke="";for(oe=0;oe>>8),A.push(255&I)):A.push(x)}}return A}};var y,_,M,O,L,B={L:1,M:0,Q:3,H:2},k=(y=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],_=1335,M=7973,L=function(f){for(var g=0;f!=0;)g+=1,f>>>=1;return g},(O={}).getBCHTypeInfo=function(f){for(var g=f<<10;L(g)-L(_)>=0;)g^=_<=0;)g^=M<5&&(v+=3+A-5)}for(x=0;x=256;)x-=255;return f[x]}}}();function U(f,g){if(f.length===void 0)throw f.length+"/"+g;var v=function(){for(var S=0;S>>7-x%8&1)==1},put:function(x,S){for(var A=0;A>>S-A-1&1)==1)},getLengthInBits:function(){return g},putBit:function(x){var S=Math.floor(g/8);f.length<=S&&f.push(0),x&&(f[S]|=128>>>g%8),g+=1}};return v},R=function(f){var g=f,v={getMode:function(){return 1},getLength:function(A){return g.length},write:function(A){for(var b=g,P=0;P+2>>8&255)+(255&P),S.put(P,13),b+=2}if(b>>8)},writeBytes:function(v,x,S){x=x||0,S=S||v.length;for(var A=0;A0&&(v+=","),v+=f[x];return v+"]"}};return g},E=function(f){var g=f,v=0,x=0,S=0,A={read:function(){for(;S<8;){if(v>=g.length){if(S==0)return-1;throw"unexpected end of file./"+S}var P=g.charAt(v);if(v+=1,P=="=")return S=0,-1;P.match(/^\s$/)||(x=x<<6|b(P.charCodeAt(0)),S+=6)}var I=x>>>S-8&255;return S-=8,I}},b=function(P){if(65<=P&&P<=90)return P-65;if(97<=P&&P<=122)return P-97+26;if(48<=P&&P<=57)return P-48+52;if(P==43)return 62;if(P==47)return 63;throw"c:"+P};return A},m=function(f,g,v){for(var x=function(ce,D){var se=ce,ee=D,J=new Array(ce*D),Q={setPixel:function(re,ge,oe){J[ge*se+re]=oe},write:function(re){re.writeString("GIF87a"),re.writeShort(se),re.writeShort(ee),re.writeByte(128),re.writeByte(0),re.writeByte(0),re.writeByte(0),re.writeByte(0),re.writeByte(0),re.writeByte(255),re.writeByte(255),re.writeByte(255),re.writeString(","),re.writeShort(0),re.writeShort(0),re.writeShort(se),re.writeShort(ee),re.writeByte(0);var ge=T(2);re.writeByte(2);for(var oe=0;ge.length-oe>255;)re.writeByte(255),re.writeBytes(ge,oe,255),oe+=255;re.writeByte(ge.length-oe),re.writeBytes(ge,oe,ge.length-oe),re.writeByte(0),re.writeString(";")}},T=function(re){for(var ge=1<>>Se)throw"length over";for(;Te+Se>=8;)Ne.writeByte(255&(He<>>=8-Te,$e=0,Te=0;$e|=He<0&&Ne.writeByte($e)}});Le.write(ge,fe);var Ve=0,ke=String.fromCharCode(J[Ve]);for(Ve+=1;Ve=6;)Q(ce>>>D-6),D-=6},J.flush=function(){if(D>0&&(Q(ce<<6-D),ce=0,D=0),se%3!=0)for(var X=3-se%3,re=0;re>6,128|63&O):O<55296||O>=57344?_.push(224|O>>12,128|O>>6&63,128|63&O):(M++,O=65536+((1023&O)<<10|1023&y.charCodeAt(M)),_.push(240|O>>18,128|O>>12&63,128|O>>6&63,128|63&O))}return _}(p)},(l=typeof(u=function(){return d})=="function"?u.apply(a,[]):u)===void 0||(o.exports=l)}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var u=n[o]={exports:{}};return r[o](u,u.exports,i),u.exports}i.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return i.d(a,{a}),a},i.d=(o,a)=>{for(var u in a)i.o(a,u)&&!i.o(o,u)&&Object.defineProperty(o,u,{enumerable:!0,get:a[u]})},i.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a);var s={};return(()=>{i.d(s,{default:()=>j});const o=E=>!!E&&typeof E=="object"&&!Array.isArray(E);function a(E,...m){if(!m.length)return E;const f=m.shift();return f!==void 0&&o(E)&&o(f)?(E=Object.assign({},E),Object.keys(f).forEach(g=>{const v=E[g],x=f[g];Array.isArray(v)&&Array.isArray(x)?E[g]=x:o(v)&&o(x)?E[g]=a(Object.assign({},v),x):E[g]=x}),a(E,...m)):E}function u(E,m){const f=document.createElement("a");f.download=m,f.href=E,document.body.appendChild(f),f.click(),document.body.removeChild(f)}const l={L:.07,M:.15,Q:.25,H:.3};class d{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"dots":x=this._drawDot;break;case"classy":x=this._drawClassy;break;case"classy-rounded":x=this._drawClassyRounded;break;case"rounded":x=this._drawRounded;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawSquare}x.call(this,{x:m,y:f,size:g,getNeighbor:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var S;const A=m+g/2,b=f+g/2;x(),(S=this._element)===null||S===void 0||S.setAttribute("transform",`rotate(${180*v/Math.PI},${A},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_basicSideRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, 0 ${-f}`)}}))}_basicCornerRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_basicCornerExtraRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`)}}))}_basicCornersRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${f/2} ${f/2}h `+f/2+"v "+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_drawDot({x:m,y:f,size:g}){this._basicDot({x:m,y:f,size:g,rotation:0})}_drawSquare({x:m,y:f,size:g}){this._basicSquare({x:m,y:f,size:g,rotation:0})}_drawRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,S=v?+v(1,0):0,A=v?+v(0,-1):0,b=v?+v(0,1):0,P=x+S+A+b;if(P!==0)if(P>2||x&&S||A&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(P===2){let I=0;return x&&A?I=Math.PI/2:A&&S?I=Math.PI:S&&b&&(I=-Math.PI/2),void this._basicCornerRounded({x:m,y:f,size:g,rotation:I})}if(P===1){let I=0;return A?I=Math.PI/2:S?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawExtraRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,S=v?+v(1,0):0,A=v?+v(0,-1):0,b=v?+v(0,1):0,P=x+S+A+b;if(P!==0)if(P>2||x&&S||A&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(P===2){let I=0;return x&&A?I=Math.PI/2:A&&S?I=Math.PI:S&&b&&(I=-Math.PI/2),void this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:I})}if(P===1){let I=0;return A?I=Math.PI/2:S?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawClassy({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,S=v?+v(1,0):0,A=v?+v(0,-1):0,b=v?+v(0,1):0;x+S+A+b!==0?x||A?S||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}_drawClassyRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,S=v?+v(1,0):0,A=v?+v(0,-1):0,b=v?+v(0,1):0;x+S+A+b!==0?x||A?S||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}}class p{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"square":x=this._drawSquare;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawDot}x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var S;const A=m+g/2,b=f+g/2;x(),(S=this._element)===null||S===void 0||S.setAttribute("transform",`rotate(${180*v/Math.PI},${A},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g+f/2} ${v}a ${f/2} ${f/2} 0 1 0 0.1 0zm 0 ${x}a ${f/2-x} ${f/2-x} 0 1 1 -0.1 0Z`)}}))}_basicSquare(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f+`zM ${g+x} ${v+x}h `+(f-2*x)+"v "+(f-2*x)+"h "+(2*x-f)+"z")}}))}_basicExtraRounded(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v+2.5*x}v `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*x}h `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*-x}v `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*-x}h `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*x}M ${g+2.5*x} ${v+x}h `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*x}v `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*x}h `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*-x}v `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*-x}`)}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}_drawExtraRounded({x:m,y:f,size:g,rotation:v}){this._basicExtraRounded({x:m,y:f,size:g,rotation:v})}}class y{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;x=this._type==="square"?this._drawSquare:this._drawDot,x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var S;const A=m+g/2,b=f+g/2;x(),(S=this._element)===null||S===void 0||S.setAttribute("transform",`rotate(${180*v/Math.PI},${A},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}}const _="circle",M=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],O=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class L{constructor(m,f){this._roundSize=g=>this._options.dotsOptions.roundSize?Math.floor(g):g,this._window=f,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(m.width)),this._element.setAttribute("height",String(m.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),m.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=m.image,this._instanceId=L.instanceCount++,this._options=m}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(m){const f=m.getModuleCount(),g=Math.min(this._options.width,this._options.height)-2*this._options.margin,v=this._options.shape===_?g/Math.sqrt(2):g,x=this._roundSize(v/f);let S={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=m,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:A,qrOptions:b}=this._options,P=A.imageSize*l[b.errorCorrectionLevel],I=Math.floor(P*f*f);S=function({originalHeight:F,originalWidth:ce,maxHiddenDots:D,maxHiddenAxisDots:se,dotSize:ee}){const J={x:0,y:0},Q={x:0,y:0};if(F<=0||ce<=0||D<=0||ee<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const T=F/ce;return J.x=Math.floor(Math.sqrt(D/T)),J.x<=0&&(J.x=1),se&&seD||se&&se{var P,I,F,ce,D,se;return!(this._options.imageOptions.hideBackgroundDots&&A>=(f-S.hideYDots)/2&&A<(f+S.hideYDots)/2&&b>=(f-S.hideXDots)/2&&b<(f+S.hideXDots)/2||!((P=M[A])===null||P===void 0)&&P[b]||!((I=M[A-f+7])===null||I===void 0)&&I[b]||!((F=M[A])===null||F===void 0)&&F[b-f+7]||!((ce=O[A])===null||ce===void 0)&&ce[b]||!((D=O[A-f+7])===null||D===void 0)&&D[b]||!((se=O[A])===null||se===void 0)&&se[b-f+7])}),this.drawCorners(),this._options.image&&await this.drawImage({width:S.width,height:S.height,count:f,dotSize:x})}drawBackground(){var m,f,g;const v=this._element,x=this._options;if(v){const S=(m=x.backgroundOptions)===null||m===void 0?void 0:m.gradient,A=(f=x.backgroundOptions)===null||f===void 0?void 0:f.color;let b=x.height,P=x.width;if(S||A){const I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((g=x.backgroundOptions)===null||g===void 0)&&g.round&&(b=P=Math.min(x.width,x.height),I.setAttribute("rx",String(b/2*x.backgroundOptions.round))),I.setAttribute("x",String(this._roundSize((x.width-P)/2))),I.setAttribute("y",String(this._roundSize((x.height-b)/2))),I.setAttribute("width",String(P)),I.setAttribute("height",String(b)),this._backgroundClipPath.appendChild(I),this._createColor({options:S,color:A,additionalRotation:0,x:0,y:0,height:x.height,width:x.width,name:`background-color-${this._instanceId}`})}}}drawDots(m){var f,g;if(!this._qr)throw"QR code is not defined";const v=this._options,x=this._qr.getModuleCount();if(x>v.width||x>v.height)throw"The canvas is too small.";const S=Math.min(v.width,v.height)-2*v.margin,A=v.shape===_?S/Math.sqrt(2):S,b=this._roundSize(A/x),P=this._roundSize((v.width-x*b)/2),I=this._roundSize((v.height-x*b)/2),F=new d({svg:this._element,type:v.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(f=v.dotsOptions)===null||f===void 0?void 0:f.gradient,color:v.dotsOptions.color,additionalRotation:0,x:0,y:0,height:v.height,width:v.width,name:`dot-color-${this._instanceId}`});for(let ce=0;ce!(D+se<0||ce+ee<0||D+se>=x||ce+ee>=x)&&!(m&&!m(ce+ee,D+se))&&!!this._qr&&this._qr.isDark(ce+ee,D+se)),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element));if(v.shape===_){const ce=this._roundSize((S/b-x)/2),D=x+2*ce,se=P-ce*b,ee=I-ce*b,J=[],Q=this._roundSize(D/2);for(let T=0;T=ce-1&&T<=D-ce&&X>=ce-1&&X<=D-ce||Math.sqrt((T-Q)*(T-Q)+(X-Q)*(X-Q))>Q?J[T][X]=0:J[T][X]=this._qr.isDark(X-2*ce<0?X:X>=x?X-2*ce:X-ce,T-2*ce<0?T:T>=x?T-2*ce:T-ce)?1:0}for(let T=0;T{var oe;return!!(!((oe=J[T+ge])===null||oe===void 0)&&oe[X+re])}),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const m=this._element,f=this._options;if(!m)throw"Element code is not defined";const g=this._qr.getModuleCount(),v=Math.min(f.width,f.height)-2*f.margin,x=f.shape===_?v/Math.sqrt(2):v,S=this._roundSize(x/g),A=7*S,b=3*S,P=this._roundSize((f.width-g*S)/2),I=this._roundSize((f.height-g*S)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([F,ce,D])=>{var se,ee,J,Q,T,X,re,ge,oe,fe,be,Me;const Ne=P+F*S*(g-7),Te=I+ce*S*(g-7);let $e=this._dotsClipPath,Ie=this._dotsClipPath;if((!((se=f.cornersSquareOptions)===null||se===void 0)&&se.gradient||!((ee=f.cornersSquareOptions)===null||ee===void 0)&&ee.color)&&($e=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),$e.setAttribute("id",`clip-path-corners-square-color-${F}-${ce}-${this._instanceId}`),this._defs.appendChild($e),this._cornersSquareClipPath=this._cornersDotClipPath=Ie=$e,this._createColor({options:(J=f.cornersSquareOptions)===null||J===void 0?void 0:J.gradient,color:(Q=f.cornersSquareOptions)===null||Q===void 0?void 0:Q.color,additionalRotation:D,x:Ne,y:Te,height:A,width:A,name:`corners-square-color-${F}-${ce}-${this._instanceId}`})),(T=f.cornersSquareOptions)===null||T===void 0?void 0:T.type){const Le=new p({svg:this._element,type:f.cornersSquareOptions.type,window:this._window});Le.draw(Ne,Te,A,D),Le._element&&$e&&$e.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Se;return!!(!((Se=M[Ve+He])===null||Se===void 0)&&Se[ke+ze])}),Le._element&&$e&&$e.appendChild(Le._element))}if((!((re=f.cornersDotOptions)===null||re===void 0)&&re.gradient||!((ge=f.cornersDotOptions)===null||ge===void 0)&&ge.color)&&(Ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Ie.setAttribute("id",`clip-path-corners-dot-color-${F}-${ce}-${this._instanceId}`),this._defs.appendChild(Ie),this._cornersDotClipPath=Ie,this._createColor({options:(oe=f.cornersDotOptions)===null||oe===void 0?void 0:oe.gradient,color:(fe=f.cornersDotOptions)===null||fe===void 0?void 0:fe.color,additionalRotation:D,x:Ne+2*S,y:Te+2*S,height:b,width:b,name:`corners-dot-color-${F}-${ce}-${this._instanceId}`})),(be=f.cornersDotOptions)===null||be===void 0?void 0:be.type){const Le=new y({svg:this._element,type:f.cornersDotOptions.type,window:this._window});Le.draw(Ne+2*S,Te+2*S,b,D),Le._element&&Ie&&Ie.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Se;return!!(!((Se=O[Ve+He])===null||Se===void 0)&&Se[ke+ze])}),Le._element&&Ie&&Ie.appendChild(Le._element))}})}loadImage(){return new Promise((m,f)=>{var g;const v=this._options;if(!v.image)return f("Image is not defined");if(!((g=v.nodeCanvas)===null||g===void 0)&&g.loadImage)v.nodeCanvas.loadImage(v.image).then(x=>{var S,A;if(this._image=x,this._options.imageOptions.saveAsBlob){const b=(S=v.nodeCanvas)===null||S===void 0?void 0:S.createCanvas(this._image.width,this._image.height);(A=b==null?void 0:b.getContext("2d"))===null||A===void 0||A.drawImage(x,0,0),this._imageUri=b==null?void 0:b.toDataURL()}m()}).catch(f);else{const x=new this._window.Image;typeof v.imageOptions.crossOrigin=="string"&&(x.crossOrigin=v.imageOptions.crossOrigin),this._image=x,x.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await async function(S,A){return new Promise(b=>{const P=new A.XMLHttpRequest;P.onload=function(){const I=new A.FileReader;I.onloadend=function(){b(I.result)},I.readAsDataURL(P.response)},P.open("GET",S),P.responseType="blob",P.send()})}(v.image||"",this._window)),m()},x.src=v.image}})}async drawImage({width:m,height:f,count:g,dotSize:v}){const x=this._options,S=this._roundSize((x.width-g*v)/2),A=this._roundSize((x.height-g*v)/2),b=S+this._roundSize(x.imageOptions.margin+(g*v-m)/2),P=A+this._roundSize(x.imageOptions.margin+(g*v-f)/2),I=m-2*x.imageOptions.margin,F=f-2*x.imageOptions.margin,ce=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");ce.setAttribute("href",this._imageUri||""),ce.setAttribute("x",String(b)),ce.setAttribute("y",String(P)),ce.setAttribute("width",`${I}px`),ce.setAttribute("height",`${F}px`),this._element.appendChild(ce)}_createColor({options:m,color:f,additionalRotation:g,x:v,y:x,height:S,width:A,name:b}){const P=A>S?A:S,I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(I.setAttribute("x",String(v)),I.setAttribute("y",String(x)),I.setAttribute("height",String(S)),I.setAttribute("width",String(A)),I.setAttribute("clip-path",`url('#clip-path-${b}')`),m){let F;if(m.type==="radial")F=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("fx",String(v+A/2)),F.setAttribute("fy",String(x+S/2)),F.setAttribute("cx",String(v+A/2)),F.setAttribute("cy",String(x+S/2)),F.setAttribute("r",String(P/2));else{const ce=((m.rotation||0)+g)%(2*Math.PI),D=(ce+2*Math.PI)%(2*Math.PI);let se=v+A/2,ee=x+S/2,J=v+A/2,Q=x+S/2;D>=0&&D<=.25*Math.PI||D>1.75*Math.PI&&D<=2*Math.PI?(se-=A/2,ee-=S/2*Math.tan(ce),J+=A/2,Q+=S/2*Math.tan(ce)):D>.25*Math.PI&&D<=.75*Math.PI?(ee-=S/2,se-=A/2/Math.tan(ce),Q+=S/2,J+=A/2/Math.tan(ce)):D>.75*Math.PI&&D<=1.25*Math.PI?(se+=A/2,ee+=S/2*Math.tan(ce),J-=A/2,Q-=S/2*Math.tan(ce)):D>1.25*Math.PI&&D<=1.75*Math.PI&&(ee+=S/2,se+=A/2/Math.tan(ce),Q-=S/2,J-=A/2/Math.tan(ce)),F=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("x1",String(Math.round(se))),F.setAttribute("y1",String(Math.round(ee))),F.setAttribute("x2",String(Math.round(J))),F.setAttribute("y2",String(Math.round(Q)))}m.colorStops.forEach(({offset:ce,color:D})=>{const se=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");se.setAttribute("offset",100*ce+"%"),se.setAttribute("stop-color",D),F.appendChild(se)}),I.setAttribute("fill",`url('#${b}')`),this._defs.appendChild(F)}else f&&I.setAttribute("fill",f);this._element.appendChild(I)}}L.instanceCount=0;const B=L,k="canvas",H={};for(let E=0;E<=40;E++)H[E]=E;const U={type:k,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:H[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function z(E){const m=Object.assign({},E);if(!m.colorStops||!m.colorStops.length)throw"Field 'colorStops' is required in gradient";return m.rotation?m.rotation=Number(m.rotation):m.rotation=0,m.colorStops=m.colorStops.map(f=>Object.assign(Object.assign({},f),{offset:Number(f.offset)})),m}function Z(E){const m=Object.assign({},E);return m.width=Number(m.width),m.height=Number(m.height),m.margin=Number(m.margin),m.imageOptions=Object.assign(Object.assign({},m.imageOptions),{hideBackgroundDots:!!m.imageOptions.hideBackgroundDots,imageSize:Number(m.imageOptions.imageSize),margin:Number(m.imageOptions.margin)}),m.margin>Math.min(m.width,m.height)&&(m.margin=Math.min(m.width,m.height)),m.dotsOptions=Object.assign({},m.dotsOptions),m.dotsOptions.gradient&&(m.dotsOptions.gradient=z(m.dotsOptions.gradient)),m.cornersSquareOptions&&(m.cornersSquareOptions=Object.assign({},m.cornersSquareOptions),m.cornersSquareOptions.gradient&&(m.cornersSquareOptions.gradient=z(m.cornersSquareOptions.gradient))),m.cornersDotOptions&&(m.cornersDotOptions=Object.assign({},m.cornersDotOptions),m.cornersDotOptions.gradient&&(m.cornersDotOptions.gradient=z(m.cornersDotOptions.gradient))),m.backgroundOptions&&(m.backgroundOptions=Object.assign({},m.backgroundOptions),m.backgroundOptions.gradient&&(m.backgroundOptions.gradient=z(m.backgroundOptions.gradient))),m}var R=i(873),W=i.n(R);function ie(E){if(!E)throw new Error("Extension must be defined");E[0]==="."&&(E=E.substring(1));const m={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[E.toLowerCase()];if(!m)throw new Error(`Extension "${E}" is not supported`);return m}class me{constructor(m){m!=null&&m.jsdom?this._window=new m.jsdom("",{resources:"usable"}).window:this._window=window,this._options=m?Z(a(U,m)):U,this.update()}static _clearContainer(m){m&&(m.innerHTML="")}_setupSvg(){if(!this._qr)return;const m=new B(this._options,this._window);this._svg=m.getElement(),this._svgDrawingPromise=m.drawQR(this._qr).then(()=>{var f;this._svg&&((f=this._extension)===null||f===void 0||f.call(this,m.getElement(),this._options))})}_setupCanvas(){var m,f;this._qr&&(!((m=this._options.nodeCanvas)===null||m===void 0)&&m.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(f=this._svgDrawingPromise)===null||f===void 0?void 0:f.then(()=>{var g;if(!this._svg)return;const v=this._svg,x=new this._window.XMLSerializer().serializeToString(v),S=btoa(x),A=`data:${ie("svg")};base64,${S}`;if(!((g=this._options.nodeCanvas)===null||g===void 0)&&g.loadImage)return this._options.nodeCanvas.loadImage(A).then(b=>{var P,I;b.width=this._options.width,b.height=this._options.height,(I=(P=this._nodeCanvas)===null||P===void 0?void 0:P.getContext("2d"))===null||I===void 0||I.drawImage(b,0,0)});{const b=new this._window.Image;return new Promise(P=>{b.onload=()=>{var I,F;(F=(I=this._domCanvas)===null||I===void 0?void 0:I.getContext("2d"))===null||F===void 0||F.drawImage(b,0,0),P()},b.src=A})}}))}async _getElement(m="png"){if(!this._qr)throw"QR code is empty";return m.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(m){me._clearContainer(this._container),this._options=m?Z(a(this._options,m)):this._options,this._options.data&&(this._qr=W()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(f){switch(!0){case/^[0-9]*$/.test(f):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(f):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===k?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(m){if(m){if(typeof m.appendChild!="function")throw"Container should be a single DOM node";this._options.type===k?this._domCanvas&&m.appendChild(this._domCanvas):this._svg&&m.appendChild(this._svg),this._container=m}}applyExtension(m){if(!m)throw"Extension function should be defined.";this._extension=m,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(m="png"){if(!this._qr)throw"QR code is empty";const f=await this._getElement(m),g=ie(m);if(!f)return null;if(m.toLowerCase()==="svg"){const v=`\r ${new this._window.XMLSerializer().serializeToString(f)}`;return typeof Blob>"u"||this._options.jsdom?Buffer.from(v):new Blob([v],{type:g})}return new Promise(v=>{const x=f;if("toBuffer"in x)if(g==="image/png")v(x.toBuffer(g));else if(g==="image/jpeg")v(x.toBuffer(g));else{if(g!=="application/pdf")throw Error("Unsupported extension");v(x.toBuffer(g))}else"toBlob"in x&&x.toBlob(v,g,1)})}async download(m){if(!this._qr)throw"QR code is empty";if(typeof Blob>"u")throw"Cannot download in Node.js, call getRawData instead.";let f="png",g="qr";typeof m=="string"?(f=m,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):typeof m=="object"&&m!==null&&(m.name&&(g=m.name),m.extension&&(f=m.extension));const v=await this._getElement(f);if(v)if(f.toLowerCase()==="svg"){let x=new XMLSerializer().serializeToString(v);x=`\r -`+x,u(`data:${ue(f)};charset=utf-8,${encodeURIComponent(x)}`,`${g}.svg`)}else u(v.toDataURL(ue(f)),`${g}.${f}`)}}const G=_e})(),s.default})())})(_7);var lZ=_7.exports;const E7=ji(lZ);class Aa extends yt{constructor(e){const{docsPath:r,field:n,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${n}".`,{docsPath:r,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}function S7(t){if(/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t)||/%[^0-9a-f]/i.test(t)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(t))return!1;const e=hZ(t),r=e[1],n=e[2],i=e[3],s=e[4],o=e[5];if(!(r!=null&&r.length&&i.length>=0))return!1;if(n!=null&&n.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9\+\-\.]*$/.test(r.toLowerCase()))return!1;let a="";return a+=`${r}:`,n!=null&&n.length&&(a+=`//${n}`),a+=i,s!=null&&s.length&&(a+=`?${s}`),o!=null&&o.length&&(a+=`#${o}`),a}function hZ(t){return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}function A7(t){const{chainId:e,domain:r,expirationTime:n,issuedAt:i=new Date,nonce:s,notBefore:o,requestId:a,resources:u,scheme:l,uri:d,version:p}=t;{if(e!==Math.floor(e))throw new Aa({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${e}`]});if(!(dZ.test(r)||pZ.test(r)||gZ.test(r)))throw new Aa({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${r}`]});if(!mZ.test(s))throw new Aa({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${s}`]});if(!S7(d))throw new Aa({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${d}`]});if(p!=="1")throw new Aa({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${p}`]});if(l&&!vZ.test(l))throw new Aa({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${l}`]});const k=t.statement;if(k!=null&&k.includes(` -`))throw new Aa({field:"statement",metaMessages:["- Statement must not include '\\n'.","",`Provided value: ${k}`]})}const y=og(t.address),A=l?`${l}://${r}`:r,P=t.statement?`${t.statement} -`:"",O=`${A} wants you to sign in with your Ethereum account: +`+x,u(`data:${ie(f)};charset=utf-8,${encodeURIComponent(x)}`,`${g}.svg`)}else u(v.toDataURL(ie(f)),`${g}.${f}`)}}const j=me})(),s.default})())})(X7);var UZ=X7.exports;const Z7=ji(UZ);class Ca extends pt{constructor(e){const{docsPath:r,field:n,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${n}".`,{docsPath:r,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}function Q7(t){if(/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t)||/%[^0-9a-f]/i.test(t)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(t))return!1;const e=qZ(t),r=e[1],n=e[2],i=e[3],s=e[4],o=e[5];if(!(r!=null&&r.length&&i.length>=0))return!1;if(n!=null&&n.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9\+\-\.]*$/.test(r.toLowerCase()))return!1;let a="";return a+=`${r}:`,n!=null&&n.length&&(a+=`//${n}`),a+=i,s!=null&&s.length&&(a+=`?${s}`),o!=null&&o.length&&(a+=`#${o}`),a}function qZ(t){return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}function e9(t){const{chainId:e,domain:r,expirationTime:n,issuedAt:i=new Date,nonce:s,notBefore:o,requestId:a,resources:u,scheme:l,uri:d,version:p}=t;{if(e!==Math.floor(e))throw new Ca({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${e}`]});if(!(zZ.test(r)||HZ.test(r)||WZ.test(r)))throw new Ca({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${r}`]});if(!KZ.test(s))throw new Ca({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${s}`]});if(!Q7(d))throw new Ca({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${d}`]});if(p!=="1")throw new Ca({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${p}`]});if(l&&!VZ.test(l))throw new Ca({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${l}`]});const B=t.statement;if(B!=null&&B.includes(` +`))throw new Ca({field:"statement",metaMessages:["- Statement must not include '\\n'.","",`Provided value: ${B}`]})}const y=yg(t.address),_=l?`${l}://${r}`:r,M=t.statement?`${t.statement} +`:"",O=`${_} wants you to sign in with your Ethereum account: ${y} -${P}`;let D=`URI: ${d} +${M}`;let L=`URI: ${d} Version: ${p} Chain ID: ${e} Nonce: ${s} -Issued At: ${i.toISOString()}`;if(n&&(D+=` -Expiration Time: ${n.toISOString()}`),o&&(D+=` -Not Before: ${o.toISOString()}`),a&&(D+=` -Request ID: ${a}`),u){let k=` -Resources:`;for(const B of u){if(!S7(B))throw new Aa({field:"resources",metaMessages:["- Every resource must be a RFC 3986 URI.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${B}`]});k+=` -- ${B}`}D+=k}return`${O} -${D}`}const dZ=/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/,pZ=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/,gZ=/^localhost(:[0-9]{1,5})?$/,mZ=/^[a-zA-Z0-9]{8,}$/,vZ=/^([a-zA-Z][a-zA-Z0-9+-.]*)$/,P7="7a4434fefbcc9af474fb5c995e47d286",bZ={projectId:P7,metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},yZ={namespaces:{eip155:{methods:["eth_sendTransaction","eth_signTransaction","eth_sign","personal_sign","eth_signTypedData"],chains:["eip155:1"],events:["chainChanged","accountsChanged","disconnect"],rpcMap:{1:`https://rpc.walletconnect.com?chainId=eip155:1&projectId=${P7}`}}},skipPairing:!1};function wZ(t,e){const r=window.location.host,n=window.location.href;return A7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function M7(t){var ue,_e,G;const e=Se.useRef(null),{wallet:r,onGetExtension:n,onSignFinish:i}=t,[s,o]=Se.useState(""),[a,u]=Se.useState(!1),[l,d]=Se.useState(""),[p,y]=Se.useState("scan"),A=Se.useRef(),[P,O]=Se.useState((ue=r.config)==null?void 0:ue.image),[D,k]=Se.useState(!1),{saveLastUsedWallet:B}=Kl();async function q(E){var f,g,v,x;u(!0);const m=await pz.init(bZ);m.session&&await m.disconnect();try{if(y("scan"),m.on("display_uri",ce=>{o(ce),u(!1),y("scan")}),m.on("error",ce=>{console.log(ce)}),m.on("session_update",ce=>{console.log("session_update",ce)}),!await m.connect(yZ))throw new Error("Walletconnect init failed");const S=new ru(m);O(((f=S.config)==null?void 0:f.image)||((g=E.config)==null?void 0:g.image));const b=await S.getAddress(),M=await va.getNonce({account_type:"block_chain"});console.log("get nonce",M);const I=wZ(b,M);y("sign");const F=await S.signMessage(I,b);y("waiting"),await i(S,{message:I,nonce:M,signature:F,address:b,wallet_name:((v=S.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),B(S)}catch(_){console.log("err",_),d(_.details||_.message)}}function j(){A.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),A.current.append(e.current)}function H(E){var m;console.log(A.current),(m=A.current)==null||m.update({data:E})}Se.useEffect(()=>{s&&H(s)},[s]),Se.useEffect(()=>{q(r)},[r]),Se.useEffect(()=>{j()},[]);function J(){d(""),H(""),q(r)}function T(){k(!0),navigator.clipboard.writeText(s),setTimeout(()=>{k(!1)},2500)}function z(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return de.jsxs("div",{children:[de.jsx("div",{className:"xc-text-center",children:de.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[de.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),de.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?de.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):de.jsx("img",{className:"xc-h-10 xc-w-10",src:P})})]})}),de.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[de.jsx("button",{disabled:!s,onClick:T,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:D?de.jsxs(de.Fragment,{children:[" ",de.jsx(LK,{})," Copied!"]}):de.jsxs(de.Fragment,{children:[de.jsx($K,{}),"Copy QR URL"]})}),((_e=r.config)==null?void 0:_e.getWallet)&&de.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[de.jsx(kK,{}),"Get Extension"]}),((G=r.config)==null?void 0:G.desktop_link)&&de.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:z,children:[de.jsx(f8,{}),"Desktop"]})]}),de.jsx("div",{className:"xc-text-center",children:l?de.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[de.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),de.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:J,children:"Retry"})]}):de.jsxs(de.Fragment,{children:[p==="scan"&&de.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),p==="connect"&&de.jsx("p",{children:"Click connect in your wallet app"}),p==="sign"&&de.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),p==="waiting"&&de.jsx("div",{className:"xc-text-center",children:de.jsx(vc,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const xZ="Accept connection request in the wallet",_Z="Accept sign-in request in your wallet";function EZ(t,e){const r=window.location.host,n=window.location.href;return A7({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function I7(t){var p;const[e,r]=Se.useState(),{wallet:n,onSignFinish:i}=t,s=Se.useRef(),[o,a]=Se.useState("connect"),{saveLastUsedWallet:u}=Kl();async function l(y){var A;try{a("connect");const P=await n.connect();if(!P||P.length===0)throw new Error("Wallet connect error");const O=og(P[0]),D=EZ(O,y);a("sign");const k=await n.signMessage(D,O);if(!k||k.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:O,signature:k,message:D,nonce:y,wallet_name:((A=n.config)==null?void 0:A.name)||""}),u(n)}catch(P){console.log(P.details),r(P.details||P.message)}}async function d(){try{r("");const y=await va.getNonce({account_type:"block_chain"});s.current=y,l(s.current)}catch(y){console.log(y.details),r(y.message)}}return Se.useEffect(()=>{d()},[]),de.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[de.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(p=n.config)==null?void 0:p.image,alt:""}),e&&de.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[de.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),de.jsx("div",{className:"xc-flex xc-gap-2",children:de.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:d,children:"Retry"})})]}),!e&&de.jsxs(de.Fragment,{children:[o==="connect"&&de.jsx("span",{className:"xc-text-center",children:xZ}),o==="sign"&&de.jsx("span",{className:"xc-text-center",children:_Z}),o==="waiting"&&de.jsx("span",{className:"xc-text-center",children:de.jsx(vc,{className:"xc-animate-spin"})})]})]})}const Gu="https://static.codatta.io/codatta-connect/wallet-icons.svg",SZ="https://itunes.apple.com/app/",AZ="https://play.google.com/store/apps/details?id=",PZ="https://chromewebstore.google.com/detail/",MZ="https://chromewebstore.google.com/detail/",IZ="https://addons.mozilla.org/en-US/firefox/addon/",CZ="https://microsoftedge.microsoft.com/addons/detail/";function Yu(t){const{icon:e,title:r,link:n}=t;return de.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[de.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,de.jsx(u8,{className:"xc-ml-auto xc-text-gray-400"})]})}function TZ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${SZ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${AZ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${PZ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${MZ}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${IZ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${CZ}${t.edge_addon_id}`),e}function C7(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=TZ(r);return de.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[de.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),de.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),de.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),de.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&de.jsx(Yu,{link:n.chromeStoreLink,icon:`${Gu}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&de.jsx(Yu,{link:n.appStoreLink,icon:`${Gu}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&de.jsx(Yu,{link:n.playStoreLink,icon:`${Gu}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&de.jsx(Yu,{link:n.edgeStoreLink,icon:`${Gu}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&de.jsx(Yu,{link:n.braveStoreLink,icon:`${Gu}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&de.jsx(Yu,{link:n.firefoxStoreLink,icon:`${Gu}#firefox`,title:"Mozilla Firefox"})]})]})}function RZ(t){const{wallet:e}=t,[r,n]=Se.useState(e.installed?"connect":"qr"),i=Ib();async function s(o,a){var l;const u=await va.walletLogin({account_type:"block_chain",account_enum:i.role,connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return de.jsxs(Ss,{children:[de.jsx("div",{className:"xc-mb-6",children:de.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&de.jsx(M7,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&de.jsx(I7,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&de.jsx(C7,{wallet:e})]})}function DZ(t){const{wallet:e,onClick:r}=t,n=de.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return de.jsx(Sb,{icon:n,title:i,onClick:()=>r(e)})}function T7(t){const{connector:e}=t,[r,n]=Se.useState(),[i,s]=Se.useState([]),o=Se.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d)}Se.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return de.jsxs(Ss,{children:[de.jsx("div",{className:"xc-mb-6",children:de.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),de.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[de.jsx(l8,{className:"xc-shrink-0 xc-opacity-50"}),de.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),de.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>de.jsx(DZ,{wallet:d,onClick:l},d.name))})]})}var R7={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,$[W+1]=V>>16&255,$[W+2]=V>>8&255,$[W+3]=V&255,$[W+4]=C>>24&255,$[W+5]=C>>16&255,$[W+6]=C>>8&255,$[W+7]=C&255}function O($,W,V,C,Y){var U,oe=0;for(U=0;U>>8)-1}function D($,W,V,C){return O($,W,V,C,16)}function k($,W,V,C){return O($,W,V,C,32)}function B($,W,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,U=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,ge=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=W[0]&255|(W[1]&255)<<8|(W[2]&255)<<16|(W[3]&255)<<24,it=W[4]&255|(W[5]&255)<<8|(W[6]&255)<<16|(W[7]&255)<<24,Ue=W[8]&255|(W[9]&255)<<8|(W[10]&255)<<16|(W[11]&255)<<24,gt=W[12]&255|(W[13]&255)<<8|(W[14]&255)<<16|(W[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=U,ot=oe,wt=ge,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,pe,nr=0;nr<20;nr+=2)pe=dt+kt|0,lt^=pe<<7|pe>>>25,pe=lt+dt|0,Ge^=pe<<9|pe>>>23,pe=Ge+lt|0,kt^=pe<<13|pe>>>19,pe=kt+Ge|0,dt^=pe<<18|pe>>>14,pe=at+_t|0,je^=pe<<7|pe>>>25,pe=je+at|0,Wt^=pe<<9|pe>>>23,pe=Wt+je|0,_t^=pe<<13|pe>>>19,pe=_t+Wt|0,at^=pe<<18|pe>>>14,pe=qe+Ae|0,Zt^=pe<<7|pe>>>25,pe=Zt+qe|0,ot^=pe<<9|pe>>>23,pe=ot+Zt|0,Ae^=pe<<13|pe>>>19,pe=Ae+ot|0,qe^=pe<<18|pe>>>14,pe=Kt+Xe|0,wt^=pe<<7|pe>>>25,pe=wt+Kt|0,Pe^=pe<<9|pe>>>23,pe=Pe+wt|0,Xe^=pe<<13|pe>>>19,pe=Xe+Pe|0,Kt^=pe<<18|pe>>>14,pe=dt+wt|0,_t^=pe<<7|pe>>>25,pe=_t+dt|0,ot^=pe<<9|pe>>>23,pe=ot+_t|0,wt^=pe<<13|pe>>>19,pe=wt+ot|0,dt^=pe<<18|pe>>>14,pe=at+lt|0,Ae^=pe<<7|pe>>>25,pe=Ae+at|0,Pe^=pe<<9|pe>>>23,pe=Pe+Ae|0,lt^=pe<<13|pe>>>19,pe=lt+Pe|0,at^=pe<<18|pe>>>14,pe=qe+je|0,Xe^=pe<<7|pe>>>25,pe=Xe+qe|0,Ge^=pe<<9|pe>>>23,pe=Ge+Xe|0,je^=pe<<13|pe>>>19,pe=je+Ge|0,qe^=pe<<18|pe>>>14,pe=Kt+Zt|0,kt^=pe<<7|pe>>>25,pe=kt+Kt|0,Wt^=pe<<9|pe>>>23,pe=Wt+kt|0,Zt^=pe<<13|pe>>>19,pe=Zt+Wt|0,Kt^=pe<<18|pe>>>14;dt=dt+Y|0,_t=_t+U|0,ot=ot+oe|0,wt=wt+ge|0,lt=lt+xe|0,at=at+Re|0,Ae=Ae+De|0,Pe=Pe+it|0,Ge=Ge+Ue|0,je=je+gt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=_t>>>0&255,$[5]=_t>>>8&255,$[6]=_t>>>16&255,$[7]=_t>>>24&255,$[8]=ot>>>0&255,$[9]=ot>>>8&255,$[10]=ot>>>16&255,$[11]=ot>>>24&255,$[12]=wt>>>0&255,$[13]=wt>>>8&255,$[14]=wt>>>16&255,$[15]=wt>>>24&255,$[16]=lt>>>0&255,$[17]=lt>>>8&255,$[18]=lt>>>16&255,$[19]=lt>>>24&255,$[20]=at>>>0&255,$[21]=at>>>8&255,$[22]=at>>>16&255,$[23]=at>>>24&255,$[24]=Ae>>>0&255,$[25]=Ae>>>8&255,$[26]=Ae>>>16&255,$[27]=Ae>>>24&255,$[28]=Pe>>>0&255,$[29]=Pe>>>8&255,$[30]=Pe>>>16&255,$[31]=Pe>>>24&255,$[32]=Ge>>>0&255,$[33]=Ge>>>8&255,$[34]=Ge>>>16&255,$[35]=Ge>>>24&255,$[36]=je>>>0&255,$[37]=je>>>8&255,$[38]=je>>>16&255,$[39]=je>>>24&255,$[40]=qe>>>0&255,$[41]=qe>>>8&255,$[42]=qe>>>16&255,$[43]=qe>>>24&255,$[44]=Xe>>>0&255,$[45]=Xe>>>8&255,$[46]=Xe>>>16&255,$[47]=Xe>>>24&255,$[48]=kt>>>0&255,$[49]=kt>>>8&255,$[50]=kt>>>16&255,$[51]=kt>>>24&255,$[52]=Wt>>>0&255,$[53]=Wt>>>8&255,$[54]=Wt>>>16&255,$[55]=Wt>>>24&255,$[56]=Zt>>>0&255,$[57]=Zt>>>8&255,$[58]=Zt>>>16&255,$[59]=Zt>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255}function q($,W,V,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,U=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,oe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,ge=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,xe=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=W[0]&255|(W[1]&255)<<8|(W[2]&255)<<16|(W[3]&255)<<24,it=W[4]&255|(W[5]&255)<<8|(W[6]&255)<<16|(W[7]&255)<<24,Ue=W[8]&255|(W[9]&255)<<8|(W[10]&255)<<16|(W[11]&255)<<24,gt=W[12]&255|(W[13]&255)<<8|(W[14]&255)<<16|(W[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,At=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Rt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,Mt=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=U,ot=oe,wt=ge,lt=xe,at=Re,Ae=De,Pe=it,Ge=Ue,je=gt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,pe,nr=0;nr<20;nr+=2)pe=dt+kt|0,lt^=pe<<7|pe>>>25,pe=lt+dt|0,Ge^=pe<<9|pe>>>23,pe=Ge+lt|0,kt^=pe<<13|pe>>>19,pe=kt+Ge|0,dt^=pe<<18|pe>>>14,pe=at+_t|0,je^=pe<<7|pe>>>25,pe=je+at|0,Wt^=pe<<9|pe>>>23,pe=Wt+je|0,_t^=pe<<13|pe>>>19,pe=_t+Wt|0,at^=pe<<18|pe>>>14,pe=qe+Ae|0,Zt^=pe<<7|pe>>>25,pe=Zt+qe|0,ot^=pe<<9|pe>>>23,pe=ot+Zt|0,Ae^=pe<<13|pe>>>19,pe=Ae+ot|0,qe^=pe<<18|pe>>>14,pe=Kt+Xe|0,wt^=pe<<7|pe>>>25,pe=wt+Kt|0,Pe^=pe<<9|pe>>>23,pe=Pe+wt|0,Xe^=pe<<13|pe>>>19,pe=Xe+Pe|0,Kt^=pe<<18|pe>>>14,pe=dt+wt|0,_t^=pe<<7|pe>>>25,pe=_t+dt|0,ot^=pe<<9|pe>>>23,pe=ot+_t|0,wt^=pe<<13|pe>>>19,pe=wt+ot|0,dt^=pe<<18|pe>>>14,pe=at+lt|0,Ae^=pe<<7|pe>>>25,pe=Ae+at|0,Pe^=pe<<9|pe>>>23,pe=Pe+Ae|0,lt^=pe<<13|pe>>>19,pe=lt+Pe|0,at^=pe<<18|pe>>>14,pe=qe+je|0,Xe^=pe<<7|pe>>>25,pe=Xe+qe|0,Ge^=pe<<9|pe>>>23,pe=Ge+Xe|0,je^=pe<<13|pe>>>19,pe=je+Ge|0,qe^=pe<<18|pe>>>14,pe=Kt+Zt|0,kt^=pe<<7|pe>>>25,pe=kt+Kt|0,Wt^=pe<<9|pe>>>23,pe=Wt+kt|0,Zt^=pe<<13|pe>>>19,pe=Zt+Wt|0,Kt^=pe<<18|pe>>>14;$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=at>>>0&255,$[5]=at>>>8&255,$[6]=at>>>16&255,$[7]=at>>>24&255,$[8]=qe>>>0&255,$[9]=qe>>>8&255,$[10]=qe>>>16&255,$[11]=qe>>>24&255,$[12]=Kt>>>0&255,$[13]=Kt>>>8&255,$[14]=Kt>>>16&255,$[15]=Kt>>>24&255,$[16]=Ae>>>0&255,$[17]=Ae>>>8&255,$[18]=Ae>>>16&255,$[19]=Ae>>>24&255,$[20]=Pe>>>0&255,$[21]=Pe>>>8&255,$[22]=Pe>>>16&255,$[23]=Pe>>>24&255,$[24]=Ge>>>0&255,$[25]=Ge>>>8&255,$[26]=Ge>>>16&255,$[27]=Ge>>>24&255,$[28]=je>>>0&255,$[29]=je>>>8&255,$[30]=je>>>16&255,$[31]=je>>>24&255}function j($,W,V,C){B($,W,V,C)}function H($,W,V,C){q($,W,V,C)}var J=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T($,W,V,C,Y,U,oe){var ge=new Uint8Array(16),xe=new Uint8Array(64),Re,De;for(De=0;De<16;De++)ge[De]=0;for(De=0;De<8;De++)ge[De]=U[De];for(;Y>=64;){for(j(xe,ge,oe,J),De=0;De<64;De++)$[W+De]=V[C+De]^xe[De];for(Re=1,De=8;De<16;De++)Re=Re+(ge[De]&255)|0,ge[De]=Re&255,Re>>>=8;Y-=64,W+=64,C+=64}if(Y>0)for(j(xe,ge,oe,J),De=0;De=64;){for(j(oe,U,Y,J),xe=0;xe<64;xe++)$[W+xe]=oe[xe];for(ge=1,xe=8;xe<16;xe++)ge=ge+(U[xe]&255)|0,U[xe]=ge&255,ge>>>=8;V-=64,W+=64}if(V>0)for(j(oe,U,Y,J),xe=0;xe>>13|V<<3)&8191,C=$[4]&255|($[5]&255)<<8,this.r[2]=(V>>>10|C<<6)&7939,Y=$[6]&255|($[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,U=$[8]&255|($[9]&255)<<8,this.r[4]=(Y>>>4|U<<12)&255,this.r[5]=U>>>1&8190,oe=$[10]&255|($[11]&255)<<8,this.r[6]=(U>>>14|oe<<2)&8191,ge=$[12]&255|($[13]&255)<<8,this.r[7]=(oe>>>11|ge<<5)&8065,xe=$[14]&255|($[15]&255)<<8,this.r[8]=(ge>>>8|xe<<8)&8191,this.r[9]=xe>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};G.prototype.blocks=function($,W,V){for(var C=this.fin?0:2048,Y,U,oe,ge,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Ae=this.h[3],Pe=this.h[4],Ge=this.h[5],je=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],pe=this.r[3],nr=this.r[4],dr=this.r[5],pr=this.r[6],Qt=this.r[7],gr=this.r[8],lr=this.r[9];V>=16;)Y=$[W+0]&255|($[W+1]&255)<<8,wt+=Y&8191,U=$[W+2]&255|($[W+3]&255)<<8,lt+=(Y>>>13|U<<3)&8191,oe=$[W+4]&255|($[W+5]&255)<<8,at+=(U>>>10|oe<<6)&8191,ge=$[W+6]&255|($[W+7]&255)<<8,Ae+=(oe>>>7|ge<<9)&8191,xe=$[W+8]&255|($[W+9]&255)<<8,Pe+=(ge>>>4|xe<<12)&8191,Ge+=xe>>>1&8191,Re=$[W+10]&255|($[W+11]&255)<<8,je+=(xe>>>14|Re<<2)&8191,De=$[W+12]&255|($[W+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=$[W+14]&255|($[W+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,Ue=0,gt=Ue,gt+=wt*Wt,gt+=lt*(5*lr),gt+=at*(5*gr),gt+=Ae*(5*Qt),gt+=Pe*(5*pr),Ue=gt>>>13,gt&=8191,gt+=Ge*(5*dr),gt+=je*(5*nr),gt+=qe*(5*pe),gt+=Xe*(5*Kt),gt+=kt*(5*Zt),Ue+=gt>>>13,gt&=8191,st=Ue,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Ae*(5*gr),st+=Pe*(5*Qt),Ue=st>>>13,st&=8191,st+=Ge*(5*pr),st+=je*(5*dr),st+=qe*(5*nr),st+=Xe*(5*pe),st+=kt*(5*Kt),Ue+=st>>>13,st&=8191,tt=Ue,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Ae*(5*lr),tt+=Pe*(5*gr),Ue=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=je*(5*pr),tt+=qe*(5*dr),tt+=Xe*(5*nr),tt+=kt*(5*pe),Ue+=tt>>>13,tt&=8191,At=Ue,At+=wt*pe,At+=lt*Kt,At+=at*Zt,At+=Ae*Wt,At+=Pe*(5*lr),Ue=At>>>13,At&=8191,At+=Ge*(5*gr),At+=je*(5*Qt),At+=qe*(5*pr),At+=Xe*(5*dr),At+=kt*(5*nr),Ue+=At>>>13,At&=8191,Rt=Ue,Rt+=wt*nr,Rt+=lt*pe,Rt+=at*Kt,Rt+=Ae*Zt,Rt+=Pe*Wt,Ue=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=je*(5*gr),Rt+=qe*(5*Qt),Rt+=Xe*(5*pr),Rt+=kt*(5*dr),Ue+=Rt>>>13,Rt&=8191,Mt=Ue,Mt+=wt*dr,Mt+=lt*nr,Mt+=at*pe,Mt+=Ae*Kt,Mt+=Pe*Zt,Ue=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=je*(5*lr),Mt+=qe*(5*gr),Mt+=Xe*(5*Qt),Mt+=kt*(5*pr),Ue+=Mt>>>13,Mt&=8191,Et=Ue,Et+=wt*pr,Et+=lt*dr,Et+=at*nr,Et+=Ae*pe,Et+=Pe*Kt,Ue=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=je*Wt,Et+=qe*(5*lr),Et+=Xe*(5*gr),Et+=kt*(5*Qt),Ue+=Et>>>13,Et&=8191,dt=Ue,dt+=wt*Qt,dt+=lt*pr,dt+=at*dr,dt+=Ae*nr,dt+=Pe*pe,Ue=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=je*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*gr),Ue+=dt>>>13,dt&=8191,_t=Ue,_t+=wt*gr,_t+=lt*Qt,_t+=at*pr,_t+=Ae*dr,_t+=Pe*nr,Ue=_t>>>13,_t&=8191,_t+=Ge*pe,_t+=je*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),Ue+=_t>>>13,_t&=8191,ot=Ue,ot+=wt*lr,ot+=lt*gr,ot+=at*Qt,ot+=Ae*pr,ot+=Pe*dr,Ue=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=je*pe,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,Ue+=ot>>>13,ot&=8191,Ue=(Ue<<2)+Ue|0,Ue=Ue+gt|0,gt=Ue&8191,Ue=Ue>>>13,st+=Ue,wt=gt,lt=st,at=tt,Ae=At,Pe=Rt,Ge=Mt,je=Et,qe=dt,Xe=_t,kt=ot,W+=16,V-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Ae,this.h[4]=Pe,this.h[5]=Ge,this.h[6]=je,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},G.prototype.finish=function($,W){var V=new Uint16Array(10),C,Y,U,oe;if(this.leftover){for(oe=this.leftover,this.buffer[oe++]=1;oe<16;oe++)this.buffer[oe]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,oe=2;oe<10;oe++)this.h[oe]+=C,C=this.h[oe]>>>13,this.h[oe]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,V[0]=this.h[0]+5,C=V[0]>>>13,V[0]&=8191,oe=1;oe<10;oe++)V[oe]=this.h[oe]+C,C=V[oe]>>>13,V[oe]&=8191;for(V[9]-=8192,Y=(C^1)-1,oe=0;oe<10;oe++)V[oe]&=Y;for(Y=~Y,oe=0;oe<10;oe++)this.h[oe]=this.h[oe]&Y|V[oe];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,U=this.h[0]+this.pad[0],this.h[0]=U&65535,oe=1;oe<8;oe++)U=(this.h[oe]+this.pad[oe]|0)+(U>>>16)|0,this.h[oe]=U&65535;$[W+0]=this.h[0]>>>0&255,$[W+1]=this.h[0]>>>8&255,$[W+2]=this.h[1]>>>0&255,$[W+3]=this.h[1]>>>8&255,$[W+4]=this.h[2]>>>0&255,$[W+5]=this.h[2]>>>8&255,$[W+6]=this.h[3]>>>0&255,$[W+7]=this.h[3]>>>8&255,$[W+8]=this.h[4]>>>0&255,$[W+9]=this.h[4]>>>8&255,$[W+10]=this.h[5]>>>0&255,$[W+11]=this.h[5]>>>8&255,$[W+12]=this.h[6]>>>0&255,$[W+13]=this.h[6]>>>8&255,$[W+14]=this.h[7]>>>0&255,$[W+15]=this.h[7]>>>8&255},G.prototype.update=function($,W,V){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>V&&(Y=V),C=0;C=16&&(Y=V-V%16,this.blocks($,W,Y),W+=Y,V-=Y),V){for(C=0;C>16&1),U[V-1]&=65535;U[15]=oe[15]-32767-(U[14]>>16&1),Y=U[15]>>16&1,U[14]&=65535,_(oe,U,1-Y)}for(V=0;V<16;V++)$[2*V]=oe[V]&255,$[2*V+1]=oe[V]>>8}function b($,W){var V=new Uint8Array(32),C=new Uint8Array(32);return S(V,$),S(C,W),k(V,0,C,0)}function M($){var W=new Uint8Array(32);return S(W,$),W[0]&1}function I($,W){var V;for(V=0;V<16;V++)$[V]=W[2*V]+(W[2*V+1]<<8);$[15]&=32767}function F($,W,V){for(var C=0;C<16;C++)$[C]=W[C]+V[C]}function ce($,W,V){for(var C=0;C<16;C++)$[C]=W[C]-V[C]}function N($,W,V){var C,Y,U=0,oe=0,ge=0,xe=0,Re=0,De=0,it=0,Ue=0,gt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Ae=0,Pe=0,Ge=0,je=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,pe=V[0],nr=V[1],dr=V[2],pr=V[3],Qt=V[4],gr=V[5],lr=V[6],Lr=V[7],mr=V[8],wr=V[9],Br=V[10],$r=V[11],Ir=V[12],hn=V[13],dn=V[14],pn=V[15];C=W[0],U+=C*pe,oe+=C*nr,ge+=C*dr,xe+=C*pr,Re+=C*Qt,De+=C*gr,it+=C*lr,Ue+=C*Lr,gt+=C*mr,st+=C*wr,tt+=C*Br,At+=C*$r,Rt+=C*Ir,Mt+=C*hn,Et+=C*dn,dt+=C*pn,C=W[1],oe+=C*pe,ge+=C*nr,xe+=C*dr,Re+=C*pr,De+=C*Qt,it+=C*gr,Ue+=C*lr,gt+=C*Lr,st+=C*mr,tt+=C*wr,At+=C*Br,Rt+=C*$r,Mt+=C*Ir,Et+=C*hn,dt+=C*dn,_t+=C*pn,C=W[2],ge+=C*pe,xe+=C*nr,Re+=C*dr,De+=C*pr,it+=C*Qt,Ue+=C*gr,gt+=C*lr,st+=C*Lr,tt+=C*mr,At+=C*wr,Rt+=C*Br,Mt+=C*$r,Et+=C*Ir,dt+=C*hn,_t+=C*dn,ot+=C*pn,C=W[3],xe+=C*pe,Re+=C*nr,De+=C*dr,it+=C*pr,Ue+=C*Qt,gt+=C*gr,st+=C*lr,tt+=C*Lr,At+=C*mr,Rt+=C*wr,Mt+=C*Br,Et+=C*$r,dt+=C*Ir,_t+=C*hn,ot+=C*dn,wt+=C*pn,C=W[4],Re+=C*pe,De+=C*nr,it+=C*dr,Ue+=C*pr,gt+=C*Qt,st+=C*gr,tt+=C*lr,At+=C*Lr,Rt+=C*mr,Mt+=C*wr,Et+=C*Br,dt+=C*$r,_t+=C*Ir,ot+=C*hn,wt+=C*dn,lt+=C*pn,C=W[5],De+=C*pe,it+=C*nr,Ue+=C*dr,gt+=C*pr,st+=C*Qt,tt+=C*gr,At+=C*lr,Rt+=C*Lr,Mt+=C*mr,Et+=C*wr,dt+=C*Br,_t+=C*$r,ot+=C*Ir,wt+=C*hn,lt+=C*dn,at+=C*pn,C=W[6],it+=C*pe,Ue+=C*nr,gt+=C*dr,st+=C*pr,tt+=C*Qt,At+=C*gr,Rt+=C*lr,Mt+=C*Lr,Et+=C*mr,dt+=C*wr,_t+=C*Br,ot+=C*$r,wt+=C*Ir,lt+=C*hn,at+=C*dn,Ae+=C*pn,C=W[7],Ue+=C*pe,gt+=C*nr,st+=C*dr,tt+=C*pr,At+=C*Qt,Rt+=C*gr,Mt+=C*lr,Et+=C*Lr,dt+=C*mr,_t+=C*wr,ot+=C*Br,wt+=C*$r,lt+=C*Ir,at+=C*hn,Ae+=C*dn,Pe+=C*pn,C=W[8],gt+=C*pe,st+=C*nr,tt+=C*dr,At+=C*pr,Rt+=C*Qt,Mt+=C*gr,Et+=C*lr,dt+=C*Lr,_t+=C*mr,ot+=C*wr,wt+=C*Br,lt+=C*$r,at+=C*Ir,Ae+=C*hn,Pe+=C*dn,Ge+=C*pn,C=W[9],st+=C*pe,tt+=C*nr,At+=C*dr,Rt+=C*pr,Mt+=C*Qt,Et+=C*gr,dt+=C*lr,_t+=C*Lr,ot+=C*mr,wt+=C*wr,lt+=C*Br,at+=C*$r,Ae+=C*Ir,Pe+=C*hn,Ge+=C*dn,je+=C*pn,C=W[10],tt+=C*pe,At+=C*nr,Rt+=C*dr,Mt+=C*pr,Et+=C*Qt,dt+=C*gr,_t+=C*lr,ot+=C*Lr,wt+=C*mr,lt+=C*wr,at+=C*Br,Ae+=C*$r,Pe+=C*Ir,Ge+=C*hn,je+=C*dn,qe+=C*pn,C=W[11],At+=C*pe,Rt+=C*nr,Mt+=C*dr,Et+=C*pr,dt+=C*Qt,_t+=C*gr,ot+=C*lr,wt+=C*Lr,lt+=C*mr,at+=C*wr,Ae+=C*Br,Pe+=C*$r,Ge+=C*Ir,je+=C*hn,qe+=C*dn,Xe+=C*pn,C=W[12],Rt+=C*pe,Mt+=C*nr,Et+=C*dr,dt+=C*pr,_t+=C*Qt,ot+=C*gr,wt+=C*lr,lt+=C*Lr,at+=C*mr,Ae+=C*wr,Pe+=C*Br,Ge+=C*$r,je+=C*Ir,qe+=C*hn,Xe+=C*dn,kt+=C*pn,C=W[13],Mt+=C*pe,Et+=C*nr,dt+=C*dr,_t+=C*pr,ot+=C*Qt,wt+=C*gr,lt+=C*lr,at+=C*Lr,Ae+=C*mr,Pe+=C*wr,Ge+=C*Br,je+=C*$r,qe+=C*Ir,Xe+=C*hn,kt+=C*dn,Wt+=C*pn,C=W[14],Et+=C*pe,dt+=C*nr,_t+=C*dr,ot+=C*pr,wt+=C*Qt,lt+=C*gr,at+=C*lr,Ae+=C*Lr,Pe+=C*mr,Ge+=C*wr,je+=C*Br,qe+=C*$r,Xe+=C*Ir,kt+=C*hn,Wt+=C*dn,Zt+=C*pn,C=W[15],dt+=C*pe,_t+=C*nr,ot+=C*dr,wt+=C*pr,lt+=C*Qt,at+=C*gr,Ae+=C*lr,Pe+=C*Lr,Ge+=C*mr,je+=C*wr,qe+=C*Br,Xe+=C*$r,kt+=C*Ir,Wt+=C*hn,Zt+=C*dn,Kt+=C*pn,U+=38*_t,oe+=38*ot,ge+=38*wt,xe+=38*lt,Re+=38*at,De+=38*Ae,it+=38*Pe,Ue+=38*Ge,gt+=38*je,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=U+Y+65535,Y=Math.floor(C/65536),U=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=ge+Y+65535,Y=Math.floor(C/65536),ge=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,U+=Y-1+37*(Y-1),Y=1,C=U+Y+65535,Y=Math.floor(C/65536),U=C-Y*65536,C=oe+Y+65535,Y=Math.floor(C/65536),oe=C-Y*65536,C=ge+Y+65535,Y=Math.floor(C/65536),ge=C-Y*65536,C=xe+Y+65535,Y=Math.floor(C/65536),xe=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=gt+Y+65535,Y=Math.floor(C/65536),gt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,U+=Y-1+37*(Y-1),$[0]=U,$[1]=oe,$[2]=ge,$[3]=xe,$[4]=Re,$[5]=De,$[6]=it,$[7]=Ue,$[8]=gt,$[9]=st,$[10]=tt,$[11]=At,$[12]=Rt,$[13]=Mt,$[14]=Et,$[15]=dt}function se($,W){N($,W,W)}function ee($,W){var V=r(),C;for(C=0;C<16;C++)V[C]=W[C];for(C=253;C>=0;C--)se(V,V),C!==2&&C!==4&&N(V,V,W);for(C=0;C<16;C++)$[C]=V[C]}function X($,W){var V=r(),C;for(C=0;C<16;C++)V[C]=W[C];for(C=250;C>=0;C--)se(V,V),C!==1&&N(V,V,W);for(C=0;C<16;C++)$[C]=V[C]}function Q($,W,V){var C=new Uint8Array(32),Y=new Float64Array(80),U,oe,ge=r(),xe=r(),Re=r(),De=r(),it=r(),Ue=r();for(oe=0;oe<31;oe++)C[oe]=W[oe];for(C[31]=W[31]&127|64,C[0]&=248,I(Y,V),oe=0;oe<16;oe++)xe[oe]=Y[oe],De[oe]=ge[oe]=Re[oe]=0;for(ge[0]=De[0]=1,oe=254;oe>=0;--oe)U=C[oe>>>3]>>>(oe&7)&1,_(ge,xe,U),_(Re,De,U),F(it,ge,Re),ce(ge,ge,Re),F(Re,xe,De),ce(xe,xe,De),se(De,it),se(Ue,ge),N(ge,Re,ge),N(Re,xe,it),F(it,ge,Re),ce(ge,ge,Re),se(xe,ge),ce(Re,De,Ue),N(ge,Re,u),F(ge,ge,De),N(Re,Re,ge),N(ge,De,Ue),N(De,xe,Y),se(xe,it),_(ge,xe,U),_(Re,De,U);for(oe=0;oe<16;oe++)Y[oe+16]=ge[oe],Y[oe+32]=Re[oe],Y[oe+48]=xe[oe],Y[oe+64]=De[oe];var gt=Y.subarray(32),st=Y.subarray(16);return ee(gt,gt),N(st,st,gt),S($,st),0}function R($,W){return Q($,W,s)}function Z($,W){return n(W,32),R($,W)}function te($,W,V){var C=new Uint8Array(32);return Q(C,V,W),H($,i,C,J)}var le=f,ie=g;function fe($,W,V,C,Y,U){var oe=new Uint8Array(32);return te(oe,Y,U),le($,W,V,C,oe)}function ve($,W,V,C,Y,U){var oe=new Uint8Array(32);return te(oe,Y,U),ie($,W,V,C,oe)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne($,W,V,C){for(var Y=new Int32Array(16),U=new Int32Array(16),oe,ge,xe,Re,De,it,Ue,gt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Ae,Pe,Ge,je,qe,Xe,kt=$[0],Wt=$[1],Zt=$[2],Kt=$[3],pe=$[4],nr=$[5],dr=$[6],pr=$[7],Qt=W[0],gr=W[1],lr=W[2],Lr=W[3],mr=W[4],wr=W[5],Br=W[6],$r=W[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=V[at+0]<<24|V[at+1]<<16|V[at+2]<<8|V[at+3],U[lt]=V[at+4]<<24|V[at+5]<<16|V[at+6]<<8|V[at+7];for(lt=0;lt<80;lt++)if(oe=kt,ge=Wt,xe=Zt,Re=Kt,De=pe,it=nr,Ue=dr,gt=pr,st=Qt,tt=gr,At=lr,Rt=Lr,Mt=mr,Et=wr,dt=Br,_t=$r,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(pe>>>14|mr<<18)^(pe>>>18|mr<<14)^(mr>>>9|pe<<23),Pe=(mr>>>14|pe<<18)^(mr>>>18|pe<<14)^(pe>>>9|mr<<23),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=pe&nr^~pe&dr,Pe=mr&wr^~mr&Br,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Me[lt*2],Pe=Me[lt*2+1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Y[lt%16],Pe=U[lt%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|je<<16,Ae=ot,Pe=wt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Pe=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=kt&Wt^kt&Zt^Wt&Zt,Pe=Qt&gr^Qt&lr^gr&lr,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,gt=qe&65535|Xe<<16,_t=Ge&65535|je<<16,Ae=Re,Pe=Rt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=ot,Pe=wt,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|je<<16,Wt=oe,Zt=ge,Kt=xe,pe=Re,nr=De,dr=it,pr=Ue,kt=gt,gr=st,lr=tt,Lr=At,mr=Rt,wr=Mt,Br=Et,$r=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Ae=Y[at],Pe=U[at],Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=Y[(at+9)%16],Pe=U[(at+9)%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+1)%16],wt=U[(at+1)%16],Ae=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Pe=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+14)%16],wt=U[(at+14)%16],Ae=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Pe=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,U[at]=Ge&65535|je<<16;Ae=kt,Pe=Qt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[0],Pe=W[0],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[0]=kt=qe&65535|Xe<<16,W[0]=Qt=Ge&65535|je<<16,Ae=Wt,Pe=gr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[1],Pe=W[1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[1]=Wt=qe&65535|Xe<<16,W[1]=gr=Ge&65535|je<<16,Ae=Zt,Pe=lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[2],Pe=W[2],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[2]=Zt=qe&65535|Xe<<16,W[2]=lr=Ge&65535|je<<16,Ae=Kt,Pe=Lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[3],Pe=W[3],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[3]=Kt=qe&65535|Xe<<16,W[3]=Lr=Ge&65535|je<<16,Ae=pe,Pe=mr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[4],Pe=W[4],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[4]=pe=qe&65535|Xe<<16,W[4]=mr=Ge&65535|je<<16,Ae=nr,Pe=wr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[5],Pe=W[5],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[5]=nr=qe&65535|Xe<<16,W[5]=wr=Ge&65535|je<<16,Ae=dr,Pe=Br,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[6],Pe=W[6],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[6]=dr=qe&65535|Xe<<16,W[6]=Br=Ge&65535|je<<16,Ae=pr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[7],Pe=W[7],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[7]=pr=qe&65535|Xe<<16,W[7]=$r=Ge&65535|je<<16,Ir+=128,C-=128}return C}function Te($,W,V){var C=new Int32Array(8),Y=new Int32Array(8),U=new Uint8Array(256),oe,ge=V;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,W,V),V%=128,oe=0;oe=0;--Y)C=V[Y/8|0]>>(Y&7)&1,Ie($,W,C),$e(W,$),$e($,$),Ie($,W,C)}function ke($,W){var V=[r(),r(),r(),r()];v(V[0],p),v(V[1],y),v(V[2],a),N(V[3],p,y),Ve($,V,W)}function ze($,W,V){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],U;for(V||n(W,32),Te(C,W,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le($,Y),U=0;U<32;U++)W[U+32]=$[U];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Ee($,W){var V,C,Y,U;for(C=63;C>=32;--C){for(V=0,Y=C-32,U=C-12;Y>4)*He[Y],V=W[Y]>>8,W[Y]&=255;for(Y=0;Y<32;Y++)W[Y]-=V*He[Y];for(C=0;C<32;C++)W[C+1]+=W[C]>>8,$[C]=W[C]&255}function Qe($){var W=new Float64Array(64),V;for(V=0;V<64;V++)W[V]=$[V];for(V=0;V<64;V++)$[V]=0;Ee($,W)}function ct($,W,V,C){var Y=new Uint8Array(64),U=new Uint8Array(64),oe=new Uint8Array(64),ge,xe,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=V+64;for(ge=0;ge>7&&ce($[0],o,$[0]),N($[3],$[0],$[1]),0)}function et($,W,V,C){var Y,U=new Uint8Array(32),oe=new Uint8Array(64),ge=[r(),r(),r(),r()],xe=[r(),r(),r(),r()];if(V<64||Be(xe,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var $=new Uint8Array(vt),W=new Uint8Array(Dt);return ze($,W),{publicKey:$,secretKey:W}},e.sign.keyPair.fromSecretKey=function($){if(nt($),$.length!==Dt)throw new Error("bad secret key size");for(var W=new Uint8Array(vt),V=0;V=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function Cb(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function Y0(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{o(ce),u(!1),y("scan")}),m.on("error",ce=>{console.log(ce)}),m.on("session_update",ce=>{console.log("session_update",ce)}),!await m.connect(YZ))throw new Error("Walletconnect init failed");const A=new ru(m);O(((f=A.config)==null?void 0:f.image)||((g=E.config)==null?void 0:g.image));const b=await A.getAddress(),P=await xa.getNonce({account_type:"block_chain"});console.log("get nonce",P);const I=JZ(b,P);y("sign");const F=await A.signMessage(I,b);y("waiting"),await i(A,{message:I,nonce:P,signature:F,address:b,wallet_name:((v=A.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),k(A)}catch(S){console.log("err",S),d(S.details||S.message)}}function U(){_.current=new Z7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),_.current.append(e.current)}function z(E){var m;console.log(_.current),(m=_.current)==null||m.update({data:E})}Ee.useEffect(()=>{s&&z(s)},[s]),Ee.useEffect(()=>{H(r)},[r]),Ee.useEffect(()=>{U()},[]);function Z(){d(""),z(""),H(r)}function R(){B(!0),navigator.clipboard.writeText(s),setTimeout(()=>{B(!1)},2500)}function W(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return le.jsxs("div",{children:[le.jsx("div",{className:"xc-text-center",children:le.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[le.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),le.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?le.jsx(Ec,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):le.jsx("img",{className:"xc-h-10 xc-w-10",src:M})})]})}),le.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[le.jsx("button",{disabled:!s,onClick:R,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:L?le.jsxs(le.Fragment,{children:[" ",le.jsx(lV,{})," Copied!"]}):le.jsxs(le.Fragment,{children:[le.jsx(pV,{}),"Copy QR URL"]})}),((me=r.config)==null?void 0:me.getWallet)&&le.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[le.jsx(hV,{}),"Get Extension"]}),((j=r.config)==null?void 0:j.desktop_link)&&le.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:W,children:[le.jsx(F8,{}),"Desktop"]})]}),le.jsx("div",{className:"xc-text-center",children:l?le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),le.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:Z,children:"Retry"})]}):le.jsxs(le.Fragment,{children:[p==="scan"&&le.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),p==="connect"&&le.jsx("p",{children:"Click connect in your wallet app"}),p==="sign"&&le.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),p==="waiting"&&le.jsx("div",{className:"xc-text-center",children:le.jsx(Ec,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const XZ="Accept connection request in the wallet",ZZ="Accept sign-in request in your wallet";function QZ(t,e,r){const n=window.location.host,i=window.location.href;return e9({address:t,chainId:r,domain:n,nonce:e,uri:i,version:"1"})}function n9(t){var y;const[e,r]=Ee.useState(),{wallet:n,onSignFinish:i}=t,s=Ee.useRef(),[o,a]=Ee.useState("connect"),{saveLastUsedWallet:u,chains:l}=Yl();async function d(_){var M;try{a("connect");const O=await n.connect();if(!O||O.length===0)throw new Error("Wallet connect error");const L=await n.getChain(),B=l.find(Z=>Z.id===L),k=l[0];B||(console.log("switch chain",l[0]),a("switch-chain"),await n.switchChain(l[0]));const H=yg(O[0]),U=QZ(H,_,k.id);a("sign");const z=await n.signMessage(U,H);if(!z||z.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:H,signature:z,message:U,nonce:_,wallet_name:((M=n.config)==null?void 0:M.name)||""}),u(n)}catch(O){console.log("walletSignin error",O.stack),console.log(O.details||O.message),r(O.details||O.message)}}async function p(){try{r("");const _=await xa.getNonce({account_type:"block_chain"});s.current=_,d(s.current)}catch(_){console.log(_.details),r(_.message)}}return Ee.useEffect(()=>{p()},[]),le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[le.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(y=n.config)==null?void 0:y.image,alt:""}),e&&le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),le.jsx("div",{className:"xc-flex xc-gap-2",children:le.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:p,children:"Retry"})})]}),!e&&le.jsxs(le.Fragment,{children:[o==="connect"&&le.jsx("span",{className:"xc-text-center",children:XZ}),o==="sign"&&le.jsx("span",{className:"xc-text-center",children:ZZ}),o==="waiting"&&le.jsx("span",{className:"xc-text-center",children:le.jsx(Ec,{className:"xc-animate-spin"})}),o==="switch-chain"&&le.jsxs("span",{className:"xc-text-center",children:["Switch to ",l[0].name]})]})]})}const Gu="https://static.codatta.io/codatta-connect/wallet-icons.svg",eQ="https://itunes.apple.com/app/",tQ="https://play.google.com/store/apps/details?id=",rQ="https://chromewebstore.google.com/detail/",nQ="https://chromewebstore.google.com/detail/",iQ="https://addons.mozilla.org/en-US/firefox/addon/",sQ="https://microsoftedge.microsoft.com/addons/detail/";function Yu(t){const{icon:e,title:r,link:n}=t;return le.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[le.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,le.jsx($8,{className:"xc-ml-auto xc-text-gray-400"})]})}function oQ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${eQ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${tQ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${rQ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${nQ}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${iQ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${sQ}${t.edge_addon_id}`),e}function i9(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=oQ(r);return le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),le.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),le.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),le.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&le.jsx(Yu,{link:n.chromeStoreLink,icon:`${Gu}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&le.jsx(Yu,{link:n.appStoreLink,icon:`${Gu}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&le.jsx(Yu,{link:n.playStoreLink,icon:`${Gu}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&le.jsx(Yu,{link:n.edgeStoreLink,icon:`${Gu}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&le.jsx(Yu,{link:n.braveStoreLink,icon:`${Gu}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&le.jsx(Yu,{link:n.firefoxStoreLink,icon:`${Gu}#firefox`,title:"Mozilla Firefox"})]})]})}function aQ(t){const{wallet:e}=t,[r,n]=Ee.useState(e.installed?"connect":"qr"),i=Bb();async function s(o,a){var l;const u=await xa.walletLogin({account_type:"block_chain",account_enum:i.role,connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Tc,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&le.jsx(r9,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&le.jsx(n9,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&le.jsx(i9,{wallet:e})]})}function cQ(t){const{wallet:e,onClick:r}=t,n=le.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return le.jsx(Ob,{icon:n,title:i,onClick:()=>r(e)})}function s9(t){const{connector:e}=t,[r,n]=Ee.useState(),[i,s]=Ee.useState([]),o=Ee.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d)}Ee.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Tc,{title:"Select wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[le.jsx(j8,{className:"xc-shrink-0 xc-opacity-50"}),le.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),le.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>le.jsx(cQ,{wallet:d,onClick:l},d.name))})]})}var o9={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,$[K+1]=G>>16&255,$[K+2]=G>>8&255,$[K+3]=G&255,$[K+4]=C>>24&255,$[K+5]=C>>16&255,$[K+6]=C>>8&255,$[K+7]=C&255}function O($,K,G,C,Y){var q,ae=0;for(q=0;q>>8)-1}function L($,K,G,C){return O($,K,G,C,16)}function B($,K,G,C){return O($,K,G,C,32)}function k($,K,G,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=G[0]&255|(G[1]&255)<<8|(G[2]&255)<<16|(G[3]&255)<<24,ae=G[4]&255|(G[5]&255)<<8|(G[6]&255)<<16|(G[7]&255)<<24,pe=G[8]&255|(G[9]&255)<<8|(G[10]&255)<<16|(G[11]&255)<<24,_e=G[12]&255|(G[13]&255)<<8|(G[14]&255)<<16|(G[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=K[0]&255|(K[1]&255)<<8|(K[2]&255)<<16|(K[3]&255)<<24,it=K[4]&255|(K[5]&255)<<8|(K[6]&255)<<16|(K[7]&255)<<24,Ue=K[8]&255|(K[9]&255)<<8|(K[10]&255)<<16|(K[11]&255)<<24,mt=K[12]&255|(K[13]&255)<<8|(K[14]&255)<<16|(K[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=G[16]&255|(G[17]&255)<<8|(G[18]&255)<<16|(G[19]&255)<<24,At=G[20]&255|(G[21]&255)<<8|(G[22]&255)<<16|(G[23]&255)<<24,Rt=G[24]&255|(G[25]&255)<<8|(G[26]&255)<<16|(G[27]&255)<<24,Mt=G[28]&255|(G[29]&255)<<8|(G[30]&255)<<16|(G[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=ae,wt=pe,lt=_e,at=Re,Ae=De,Pe=it,Ge=Ue,je=mt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;dt=dt+Y|0,_t=_t+q|0,ot=ot+ae|0,wt=wt+pe|0,lt=lt+_e|0,at=at+Re|0,Ae=Ae+De|0,Pe=Pe+it|0,Ge=Ge+Ue|0,je=je+mt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=_t>>>0&255,$[5]=_t>>>8&255,$[6]=_t>>>16&255,$[7]=_t>>>24&255,$[8]=ot>>>0&255,$[9]=ot>>>8&255,$[10]=ot>>>16&255,$[11]=ot>>>24&255,$[12]=wt>>>0&255,$[13]=wt>>>8&255,$[14]=wt>>>16&255,$[15]=wt>>>24&255,$[16]=lt>>>0&255,$[17]=lt>>>8&255,$[18]=lt>>>16&255,$[19]=lt>>>24&255,$[20]=at>>>0&255,$[21]=at>>>8&255,$[22]=at>>>16&255,$[23]=at>>>24&255,$[24]=Ae>>>0&255,$[25]=Ae>>>8&255,$[26]=Ae>>>16&255,$[27]=Ae>>>24&255,$[28]=Pe>>>0&255,$[29]=Pe>>>8&255,$[30]=Pe>>>16&255,$[31]=Pe>>>24&255,$[32]=Ge>>>0&255,$[33]=Ge>>>8&255,$[34]=Ge>>>16&255,$[35]=Ge>>>24&255,$[36]=je>>>0&255,$[37]=je>>>8&255,$[38]=je>>>16&255,$[39]=je>>>24&255,$[40]=qe>>>0&255,$[41]=qe>>>8&255,$[42]=qe>>>16&255,$[43]=qe>>>24&255,$[44]=Xe>>>0&255,$[45]=Xe>>>8&255,$[46]=Xe>>>16&255,$[47]=Xe>>>24&255,$[48]=kt>>>0&255,$[49]=kt>>>8&255,$[50]=kt>>>16&255,$[51]=kt>>>24&255,$[52]=Wt>>>0&255,$[53]=Wt>>>8&255,$[54]=Wt>>>16&255,$[55]=Wt>>>24&255,$[56]=Zt>>>0&255,$[57]=Zt>>>8&255,$[58]=Zt>>>16&255,$[59]=Zt>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255}function H($,K,G,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=G[0]&255|(G[1]&255)<<8|(G[2]&255)<<16|(G[3]&255)<<24,ae=G[4]&255|(G[5]&255)<<8|(G[6]&255)<<16|(G[7]&255)<<24,pe=G[8]&255|(G[9]&255)<<8|(G[10]&255)<<16|(G[11]&255)<<24,_e=G[12]&255|(G[13]&255)<<8|(G[14]&255)<<16|(G[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=K[0]&255|(K[1]&255)<<8|(K[2]&255)<<16|(K[3]&255)<<24,it=K[4]&255|(K[5]&255)<<8|(K[6]&255)<<16|(K[7]&255)<<24,Ue=K[8]&255|(K[9]&255)<<8|(K[10]&255)<<16|(K[11]&255)<<24,mt=K[12]&255|(K[13]&255)<<8|(K[14]&255)<<16|(K[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=G[16]&255|(G[17]&255)<<8|(G[18]&255)<<16|(G[19]&255)<<24,At=G[20]&255|(G[21]&255)<<8|(G[22]&255)<<16|(G[23]&255)<<24,Rt=G[24]&255|(G[25]&255)<<8|(G[26]&255)<<16|(G[27]&255)<<24,Mt=G[28]&255|(G[29]&255)<<8|(G[30]&255)<<16|(G[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=ae,wt=pe,lt=_e,at=Re,Ae=De,Pe=it,Ge=Ue,je=mt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=at>>>0&255,$[5]=at>>>8&255,$[6]=at>>>16&255,$[7]=at>>>24&255,$[8]=qe>>>0&255,$[9]=qe>>>8&255,$[10]=qe>>>16&255,$[11]=qe>>>24&255,$[12]=Kt>>>0&255,$[13]=Kt>>>8&255,$[14]=Kt>>>16&255,$[15]=Kt>>>24&255,$[16]=Ae>>>0&255,$[17]=Ae>>>8&255,$[18]=Ae>>>16&255,$[19]=Ae>>>24&255,$[20]=Pe>>>0&255,$[21]=Pe>>>8&255,$[22]=Pe>>>16&255,$[23]=Pe>>>24&255,$[24]=Ge>>>0&255,$[25]=Ge>>>8&255,$[26]=Ge>>>16&255,$[27]=Ge>>>24&255,$[28]=je>>>0&255,$[29]=je>>>8&255,$[30]=je>>>16&255,$[31]=je>>>24&255}function U($,K,G,C){k($,K,G,C)}function z($,K,G,C){H($,K,G,C)}var Z=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function R($,K,G,C,Y,q,ae){var pe=new Uint8Array(16),_e=new Uint8Array(64),Re,De;for(De=0;De<16;De++)pe[De]=0;for(De=0;De<8;De++)pe[De]=q[De];for(;Y>=64;){for(U(_e,pe,ae,Z),De=0;De<64;De++)$[K+De]=G[C+De]^_e[De];for(Re=1,De=8;De<16;De++)Re=Re+(pe[De]&255)|0,pe[De]=Re&255,Re>>>=8;Y-=64,K+=64,C+=64}if(Y>0)for(U(_e,pe,ae,Z),De=0;De=64;){for(U(ae,q,Y,Z),_e=0;_e<64;_e++)$[K+_e]=ae[_e];for(pe=1,_e=8;_e<16;_e++)pe=pe+(q[_e]&255)|0,q[_e]=pe&255,pe>>>=8;G-=64,K+=64}if(G>0)for(U(ae,q,Y,Z),_e=0;_e>>13|G<<3)&8191,C=$[4]&255|($[5]&255)<<8,this.r[2]=(G>>>10|C<<6)&7939,Y=$[6]&255|($[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,q=$[8]&255|($[9]&255)<<8,this.r[4]=(Y>>>4|q<<12)&255,this.r[5]=q>>>1&8190,ae=$[10]&255|($[11]&255)<<8,this.r[6]=(q>>>14|ae<<2)&8191,pe=$[12]&255|($[13]&255)<<8,this.r[7]=(ae>>>11|pe<<5)&8065,_e=$[14]&255|($[15]&255)<<8,this.r[8]=(pe>>>8|_e<<8)&8191,this.r[9]=_e>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};j.prototype.blocks=function($,K,G){for(var C=this.fin?0:2048,Y,q,ae,pe,_e,Re,De,it,Ue,mt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Ae=this.h[3],Pe=this.h[4],Ge=this.h[5],je=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],de=this.r[3],nr=this.r[4],pr=this.r[5],gr=this.r[6],Qt=this.r[7],mr=this.r[8],lr=this.r[9];G>=16;)Y=$[K+0]&255|($[K+1]&255)<<8,wt+=Y&8191,q=$[K+2]&255|($[K+3]&255)<<8,lt+=(Y>>>13|q<<3)&8191,ae=$[K+4]&255|($[K+5]&255)<<8,at+=(q>>>10|ae<<6)&8191,pe=$[K+6]&255|($[K+7]&255)<<8,Ae+=(ae>>>7|pe<<9)&8191,_e=$[K+8]&255|($[K+9]&255)<<8,Pe+=(pe>>>4|_e<<12)&8191,Ge+=_e>>>1&8191,Re=$[K+10]&255|($[K+11]&255)<<8,je+=(_e>>>14|Re<<2)&8191,De=$[K+12]&255|($[K+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=$[K+14]&255|($[K+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,Ue=0,mt=Ue,mt+=wt*Wt,mt+=lt*(5*lr),mt+=at*(5*mr),mt+=Ae*(5*Qt),mt+=Pe*(5*gr),Ue=mt>>>13,mt&=8191,mt+=Ge*(5*pr),mt+=je*(5*nr),mt+=qe*(5*de),mt+=Xe*(5*Kt),mt+=kt*(5*Zt),Ue+=mt>>>13,mt&=8191,st=Ue,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Ae*(5*mr),st+=Pe*(5*Qt),Ue=st>>>13,st&=8191,st+=Ge*(5*gr),st+=je*(5*pr),st+=qe*(5*nr),st+=Xe*(5*de),st+=kt*(5*Kt),Ue+=st>>>13,st&=8191,tt=Ue,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Ae*(5*lr),tt+=Pe*(5*mr),Ue=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=je*(5*gr),tt+=qe*(5*pr),tt+=Xe*(5*nr),tt+=kt*(5*de),Ue+=tt>>>13,tt&=8191,At=Ue,At+=wt*de,At+=lt*Kt,At+=at*Zt,At+=Ae*Wt,At+=Pe*(5*lr),Ue=At>>>13,At&=8191,At+=Ge*(5*mr),At+=je*(5*Qt),At+=qe*(5*gr),At+=Xe*(5*pr),At+=kt*(5*nr),Ue+=At>>>13,At&=8191,Rt=Ue,Rt+=wt*nr,Rt+=lt*de,Rt+=at*Kt,Rt+=Ae*Zt,Rt+=Pe*Wt,Ue=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=je*(5*mr),Rt+=qe*(5*Qt),Rt+=Xe*(5*gr),Rt+=kt*(5*pr),Ue+=Rt>>>13,Rt&=8191,Mt=Ue,Mt+=wt*pr,Mt+=lt*nr,Mt+=at*de,Mt+=Ae*Kt,Mt+=Pe*Zt,Ue=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=je*(5*lr),Mt+=qe*(5*mr),Mt+=Xe*(5*Qt),Mt+=kt*(5*gr),Ue+=Mt>>>13,Mt&=8191,Et=Ue,Et+=wt*gr,Et+=lt*pr,Et+=at*nr,Et+=Ae*de,Et+=Pe*Kt,Ue=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=je*Wt,Et+=qe*(5*lr),Et+=Xe*(5*mr),Et+=kt*(5*Qt),Ue+=Et>>>13,Et&=8191,dt=Ue,dt+=wt*Qt,dt+=lt*gr,dt+=at*pr,dt+=Ae*nr,dt+=Pe*de,Ue=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=je*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*mr),Ue+=dt>>>13,dt&=8191,_t=Ue,_t+=wt*mr,_t+=lt*Qt,_t+=at*gr,_t+=Ae*pr,_t+=Pe*nr,Ue=_t>>>13,_t&=8191,_t+=Ge*de,_t+=je*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),Ue+=_t>>>13,_t&=8191,ot=Ue,ot+=wt*lr,ot+=lt*mr,ot+=at*Qt,ot+=Ae*gr,ot+=Pe*pr,Ue=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=je*de,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,Ue+=ot>>>13,ot&=8191,Ue=(Ue<<2)+Ue|0,Ue=Ue+mt|0,mt=Ue&8191,Ue=Ue>>>13,st+=Ue,wt=mt,lt=st,at=tt,Ae=At,Pe=Rt,Ge=Mt,je=Et,qe=dt,Xe=_t,kt=ot,K+=16,G-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Ae,this.h[4]=Pe,this.h[5]=Ge,this.h[6]=je,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},j.prototype.finish=function($,K){var G=new Uint16Array(10),C,Y,q,ae;if(this.leftover){for(ae=this.leftover,this.buffer[ae++]=1;ae<16;ae++)this.buffer[ae]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,ae=2;ae<10;ae++)this.h[ae]+=C,C=this.h[ae]>>>13,this.h[ae]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,G[0]=this.h[0]+5,C=G[0]>>>13,G[0]&=8191,ae=1;ae<10;ae++)G[ae]=this.h[ae]+C,C=G[ae]>>>13,G[ae]&=8191;for(G[9]-=8192,Y=(C^1)-1,ae=0;ae<10;ae++)G[ae]&=Y;for(Y=~Y,ae=0;ae<10;ae++)this.h[ae]=this.h[ae]&Y|G[ae];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,q=this.h[0]+this.pad[0],this.h[0]=q&65535,ae=1;ae<8;ae++)q=(this.h[ae]+this.pad[ae]|0)+(q>>>16)|0,this.h[ae]=q&65535;$[K+0]=this.h[0]>>>0&255,$[K+1]=this.h[0]>>>8&255,$[K+2]=this.h[1]>>>0&255,$[K+3]=this.h[1]>>>8&255,$[K+4]=this.h[2]>>>0&255,$[K+5]=this.h[2]>>>8&255,$[K+6]=this.h[3]>>>0&255,$[K+7]=this.h[3]>>>8&255,$[K+8]=this.h[4]>>>0&255,$[K+9]=this.h[4]>>>8&255,$[K+10]=this.h[5]>>>0&255,$[K+11]=this.h[5]>>>8&255,$[K+12]=this.h[6]>>>0&255,$[K+13]=this.h[6]>>>8&255,$[K+14]=this.h[7]>>>0&255,$[K+15]=this.h[7]>>>8&255},j.prototype.update=function($,K,G){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>G&&(Y=G),C=0;C=16&&(Y=G-G%16,this.blocks($,K,Y),K+=Y,G-=Y),G){for(C=0;C>16&1),q[G-1]&=65535;q[15]=ae[15]-32767-(q[14]>>16&1),Y=q[15]>>16&1,q[14]&=65535,S(ae,q,1-Y)}for(G=0;G<16;G++)$[2*G]=ae[G]&255,$[2*G+1]=ae[G]>>8}function b($,K){var G=new Uint8Array(32),C=new Uint8Array(32);return A(G,$),A(C,K),B(G,0,C,0)}function P($){var K=new Uint8Array(32);return A(K,$),K[0]&1}function I($,K){var G;for(G=0;G<16;G++)$[G]=K[2*G]+(K[2*G+1]<<8);$[15]&=32767}function F($,K,G){for(var C=0;C<16;C++)$[C]=K[C]+G[C]}function ce($,K,G){for(var C=0;C<16;C++)$[C]=K[C]-G[C]}function D($,K,G){var C,Y,q=0,ae=0,pe=0,_e=0,Re=0,De=0,it=0,Ue=0,mt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Ae=0,Pe=0,Ge=0,je=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,de=G[0],nr=G[1],pr=G[2],gr=G[3],Qt=G[4],mr=G[5],lr=G[6],Lr=G[7],vr=G[8],xr=G[9],Br=G[10],$r=G[11],Ir=G[12],ln=G[13],hn=G[14],dn=G[15];C=K[0],q+=C*de,ae+=C*nr,pe+=C*pr,_e+=C*gr,Re+=C*Qt,De+=C*mr,it+=C*lr,Ue+=C*Lr,mt+=C*vr,st+=C*xr,tt+=C*Br,At+=C*$r,Rt+=C*Ir,Mt+=C*ln,Et+=C*hn,dt+=C*dn,C=K[1],ae+=C*de,pe+=C*nr,_e+=C*pr,Re+=C*gr,De+=C*Qt,it+=C*mr,Ue+=C*lr,mt+=C*Lr,st+=C*vr,tt+=C*xr,At+=C*Br,Rt+=C*$r,Mt+=C*Ir,Et+=C*ln,dt+=C*hn,_t+=C*dn,C=K[2],pe+=C*de,_e+=C*nr,Re+=C*pr,De+=C*gr,it+=C*Qt,Ue+=C*mr,mt+=C*lr,st+=C*Lr,tt+=C*vr,At+=C*xr,Rt+=C*Br,Mt+=C*$r,Et+=C*Ir,dt+=C*ln,_t+=C*hn,ot+=C*dn,C=K[3],_e+=C*de,Re+=C*nr,De+=C*pr,it+=C*gr,Ue+=C*Qt,mt+=C*mr,st+=C*lr,tt+=C*Lr,At+=C*vr,Rt+=C*xr,Mt+=C*Br,Et+=C*$r,dt+=C*Ir,_t+=C*ln,ot+=C*hn,wt+=C*dn,C=K[4],Re+=C*de,De+=C*nr,it+=C*pr,Ue+=C*gr,mt+=C*Qt,st+=C*mr,tt+=C*lr,At+=C*Lr,Rt+=C*vr,Mt+=C*xr,Et+=C*Br,dt+=C*$r,_t+=C*Ir,ot+=C*ln,wt+=C*hn,lt+=C*dn,C=K[5],De+=C*de,it+=C*nr,Ue+=C*pr,mt+=C*gr,st+=C*Qt,tt+=C*mr,At+=C*lr,Rt+=C*Lr,Mt+=C*vr,Et+=C*xr,dt+=C*Br,_t+=C*$r,ot+=C*Ir,wt+=C*ln,lt+=C*hn,at+=C*dn,C=K[6],it+=C*de,Ue+=C*nr,mt+=C*pr,st+=C*gr,tt+=C*Qt,At+=C*mr,Rt+=C*lr,Mt+=C*Lr,Et+=C*vr,dt+=C*xr,_t+=C*Br,ot+=C*$r,wt+=C*Ir,lt+=C*ln,at+=C*hn,Ae+=C*dn,C=K[7],Ue+=C*de,mt+=C*nr,st+=C*pr,tt+=C*gr,At+=C*Qt,Rt+=C*mr,Mt+=C*lr,Et+=C*Lr,dt+=C*vr,_t+=C*xr,ot+=C*Br,wt+=C*$r,lt+=C*Ir,at+=C*ln,Ae+=C*hn,Pe+=C*dn,C=K[8],mt+=C*de,st+=C*nr,tt+=C*pr,At+=C*gr,Rt+=C*Qt,Mt+=C*mr,Et+=C*lr,dt+=C*Lr,_t+=C*vr,ot+=C*xr,wt+=C*Br,lt+=C*$r,at+=C*Ir,Ae+=C*ln,Pe+=C*hn,Ge+=C*dn,C=K[9],st+=C*de,tt+=C*nr,At+=C*pr,Rt+=C*gr,Mt+=C*Qt,Et+=C*mr,dt+=C*lr,_t+=C*Lr,ot+=C*vr,wt+=C*xr,lt+=C*Br,at+=C*$r,Ae+=C*Ir,Pe+=C*ln,Ge+=C*hn,je+=C*dn,C=K[10],tt+=C*de,At+=C*nr,Rt+=C*pr,Mt+=C*gr,Et+=C*Qt,dt+=C*mr,_t+=C*lr,ot+=C*Lr,wt+=C*vr,lt+=C*xr,at+=C*Br,Ae+=C*$r,Pe+=C*Ir,Ge+=C*ln,je+=C*hn,qe+=C*dn,C=K[11],At+=C*de,Rt+=C*nr,Mt+=C*pr,Et+=C*gr,dt+=C*Qt,_t+=C*mr,ot+=C*lr,wt+=C*Lr,lt+=C*vr,at+=C*xr,Ae+=C*Br,Pe+=C*$r,Ge+=C*Ir,je+=C*ln,qe+=C*hn,Xe+=C*dn,C=K[12],Rt+=C*de,Mt+=C*nr,Et+=C*pr,dt+=C*gr,_t+=C*Qt,ot+=C*mr,wt+=C*lr,lt+=C*Lr,at+=C*vr,Ae+=C*xr,Pe+=C*Br,Ge+=C*$r,je+=C*Ir,qe+=C*ln,Xe+=C*hn,kt+=C*dn,C=K[13],Mt+=C*de,Et+=C*nr,dt+=C*pr,_t+=C*gr,ot+=C*Qt,wt+=C*mr,lt+=C*lr,at+=C*Lr,Ae+=C*vr,Pe+=C*xr,Ge+=C*Br,je+=C*$r,qe+=C*Ir,Xe+=C*ln,kt+=C*hn,Wt+=C*dn,C=K[14],Et+=C*de,dt+=C*nr,_t+=C*pr,ot+=C*gr,wt+=C*Qt,lt+=C*mr,at+=C*lr,Ae+=C*Lr,Pe+=C*vr,Ge+=C*xr,je+=C*Br,qe+=C*$r,Xe+=C*Ir,kt+=C*ln,Wt+=C*hn,Zt+=C*dn,C=K[15],dt+=C*de,_t+=C*nr,ot+=C*pr,wt+=C*gr,lt+=C*Qt,at+=C*mr,Ae+=C*lr,Pe+=C*Lr,Ge+=C*vr,je+=C*xr,qe+=C*Br,Xe+=C*$r,kt+=C*Ir,Wt+=C*ln,Zt+=C*hn,Kt+=C*dn,q+=38*_t,ae+=38*ot,pe+=38*wt,_e+=38*lt,Re+=38*at,De+=38*Ae,it+=38*Pe,Ue+=38*Ge,mt+=38*je,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=ae+Y+65535,Y=Math.floor(C/65536),ae=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=_e+Y+65535,Y=Math.floor(C/65536),_e=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=mt+Y+65535,Y=Math.floor(C/65536),mt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=ae+Y+65535,Y=Math.floor(C/65536),ae=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=_e+Y+65535,Y=Math.floor(C/65536),_e=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=mt+Y+65535,Y=Math.floor(C/65536),mt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),$[0]=q,$[1]=ae,$[2]=pe,$[3]=_e,$[4]=Re,$[5]=De,$[6]=it,$[7]=Ue,$[8]=mt,$[9]=st,$[10]=tt,$[11]=At,$[12]=Rt,$[13]=Mt,$[14]=Et,$[15]=dt}function se($,K){D($,K,K)}function ee($,K){var G=r(),C;for(C=0;C<16;C++)G[C]=K[C];for(C=253;C>=0;C--)se(G,G),C!==2&&C!==4&&D(G,G,K);for(C=0;C<16;C++)$[C]=G[C]}function J($,K){var G=r(),C;for(C=0;C<16;C++)G[C]=K[C];for(C=250;C>=0;C--)se(G,G),C!==1&&D(G,G,K);for(C=0;C<16;C++)$[C]=G[C]}function Q($,K,G){var C=new Uint8Array(32),Y=new Float64Array(80),q,ae,pe=r(),_e=r(),Re=r(),De=r(),it=r(),Ue=r();for(ae=0;ae<31;ae++)C[ae]=K[ae];for(C[31]=K[31]&127|64,C[0]&=248,I(Y,G),ae=0;ae<16;ae++)_e[ae]=Y[ae],De[ae]=pe[ae]=Re[ae]=0;for(pe[0]=De[0]=1,ae=254;ae>=0;--ae)q=C[ae>>>3]>>>(ae&7)&1,S(pe,_e,q),S(Re,De,q),F(it,pe,Re),ce(pe,pe,Re),F(Re,_e,De),ce(_e,_e,De),se(De,it),se(Ue,pe),D(pe,Re,pe),D(Re,_e,it),F(it,pe,Re),ce(pe,pe,Re),se(_e,pe),ce(Re,De,Ue),D(pe,Re,u),F(pe,pe,De),D(Re,Re,pe),D(pe,De,Ue),D(De,_e,Y),se(_e,it),S(pe,_e,q),S(Re,De,q);for(ae=0;ae<16;ae++)Y[ae+16]=pe[ae],Y[ae+32]=Re[ae],Y[ae+48]=_e[ae],Y[ae+64]=De[ae];var mt=Y.subarray(32),st=Y.subarray(16);return ee(mt,mt),D(st,st,mt),A($,st),0}function T($,K){return Q($,K,s)}function X($,K){return n(K,32),T($,K)}function re($,K,G){var C=new Uint8Array(32);return Q(C,G,K),z($,i,C,Z)}var ge=f,oe=g;function fe($,K,G,C,Y,q){var ae=new Uint8Array(32);return re(ae,Y,q),ge($,K,G,C,ae)}function be($,K,G,C,Y,q){var ae=new Uint8Array(32);return re(ae,Y,q),oe($,K,G,C,ae)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne($,K,G,C){for(var Y=new Int32Array(16),q=new Int32Array(16),ae,pe,_e,Re,De,it,Ue,mt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Ae,Pe,Ge,je,qe,Xe,kt=$[0],Wt=$[1],Zt=$[2],Kt=$[3],de=$[4],nr=$[5],pr=$[6],gr=$[7],Qt=K[0],mr=K[1],lr=K[2],Lr=K[3],vr=K[4],xr=K[5],Br=K[6],$r=K[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=G[at+0]<<24|G[at+1]<<16|G[at+2]<<8|G[at+3],q[lt]=G[at+4]<<24|G[at+5]<<16|G[at+6]<<8|G[at+7];for(lt=0;lt<80;lt++)if(ae=kt,pe=Wt,_e=Zt,Re=Kt,De=de,it=nr,Ue=pr,mt=gr,st=Qt,tt=mr,At=lr,Rt=Lr,Mt=vr,Et=xr,dt=Br,_t=$r,Ae=gr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(de>>>14|vr<<18)^(de>>>18|vr<<14)^(vr>>>9|de<<23),Pe=(vr>>>14|de<<18)^(vr>>>18|de<<14)^(de>>>9|vr<<23),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=de&nr^~de&pr,Pe=vr&xr^~vr&Br,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Me[lt*2],Pe=Me[lt*2+1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Y[lt%16],Pe=q[lt%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|je<<16,Ae=ot,Pe=wt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Pe=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=kt&Wt^kt&Zt^Wt&Zt,Pe=Qt&mr^Qt&lr^mr&lr,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,mt=qe&65535|Xe<<16,_t=Ge&65535|je<<16,Ae=Re,Pe=Rt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=ot,Pe=wt,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|je<<16,Wt=ae,Zt=pe,Kt=_e,de=Re,nr=De,pr=it,gr=Ue,kt=mt,mr=st,lr=tt,Lr=At,vr=Rt,xr=Mt,Br=Et,$r=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Ae=Y[at],Pe=q[at],Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=Y[(at+9)%16],Pe=q[(at+9)%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+1)%16],wt=q[(at+1)%16],Ae=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Pe=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+14)%16],wt=q[(at+14)%16],Ae=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Pe=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,q[at]=Ge&65535|je<<16;Ae=kt,Pe=Qt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[0],Pe=K[0],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[0]=kt=qe&65535|Xe<<16,K[0]=Qt=Ge&65535|je<<16,Ae=Wt,Pe=mr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[1],Pe=K[1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[1]=Wt=qe&65535|Xe<<16,K[1]=mr=Ge&65535|je<<16,Ae=Zt,Pe=lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[2],Pe=K[2],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[2]=Zt=qe&65535|Xe<<16,K[2]=lr=Ge&65535|je<<16,Ae=Kt,Pe=Lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[3],Pe=K[3],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[3]=Kt=qe&65535|Xe<<16,K[3]=Lr=Ge&65535|je<<16,Ae=de,Pe=vr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[4],Pe=K[4],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[4]=de=qe&65535|Xe<<16,K[4]=vr=Ge&65535|je<<16,Ae=nr,Pe=xr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[5],Pe=K[5],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[5]=nr=qe&65535|Xe<<16,K[5]=xr=Ge&65535|je<<16,Ae=pr,Pe=Br,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[6],Pe=K[6],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[6]=pr=qe&65535|Xe<<16,K[6]=Br=Ge&65535|je<<16,Ae=gr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[7],Pe=K[7],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[7]=gr=qe&65535|Xe<<16,K[7]=$r=Ge&65535|je<<16,Ir+=128,C-=128}return C}function Te($,K,G){var C=new Int32Array(8),Y=new Int32Array(8),q=new Uint8Array(256),ae,pe=G;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,K,G),G%=128,ae=0;ae=0;--Y)C=G[Y/8|0]>>(Y&7)&1,Ie($,K,C),$e(K,$),$e($,$),Ie($,K,C)}function ke($,K){var G=[r(),r(),r(),r()];v(G[0],p),v(G[1],y),v(G[2],a),D(G[3],p,y),Ve($,G,K)}function ze($,K,G){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],q;for(G||n(K,32),Te(C,K,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le($,Y),q=0;q<32;q++)K[q+32]=$[q];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Se($,K){var G,C,Y,q;for(C=63;C>=32;--C){for(G=0,Y=C-32,q=C-12;Y>4)*He[Y],G=K[Y]>>8,K[Y]&=255;for(Y=0;Y<32;Y++)K[Y]-=G*He[Y];for(C=0;C<32;C++)K[C+1]+=K[C]>>8,$[C]=K[C]&255}function Qe($){var K=new Float64Array(64),G;for(G=0;G<64;G++)K[G]=$[G];for(G=0;G<64;G++)$[G]=0;Se($,K)}function ct($,K,G,C){var Y=new Uint8Array(64),q=new Uint8Array(64),ae=new Uint8Array(64),pe,_e,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=G+64;for(pe=0;pe>7&&ce($[0],o,$[0]),D($[3],$[0],$[1]),0)}function et($,K,G,C){var Y,q=new Uint8Array(32),ae=new Uint8Array(64),pe=[r(),r(),r(),r()],_e=[r(),r(),r(),r()];if(G<64||Be(_e,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var $=new Uint8Array(bt),K=new Uint8Array(Dt);return ze($,K),{publicKey:$,secretKey:K}},e.sign.keyPair.fromSecretKey=function($){if(nt($),$.length!==Dt)throw new Error("bad secret key size");for(var K=new Uint8Array(bt),G=0;G=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function $b(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function ap(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new Ut("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new Ut("Delay aborted"))})})})}function As(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function fh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=As(e==null?void 0:e.signal);if(typeof t!="function")throw new Ut(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=p??null,o==null||o.abort(),o=As(p),o.signal.aborted)throw new Ut("Resource creation was aborted");n=y??null;const A=t(o.signal,...y);i=A;const P=yield A;if(i!==A&&P!==r)throw yield e(P),new Ut("Resource creation was aborted by a new resource creation");return r=P,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const p=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([p?e(p):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:p=>Pt(this,void 0,void 0,function*(){const y=r,A=i,P=n,O=s;if(yield U7(p),y===r&&A===i&&P===n&&O===s)return yield a(s,...P??[]);throw new Ut("Resource recreation was aborted by a new resource creation")})}}function QZ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=As(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new Ut("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new Ut(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new Ut("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class Lb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=ZZ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield eQ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new VZ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(j7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=B7.encode(e);yield fh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new Ut(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Fo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Fo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new Ut(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new Ut("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),Sn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Ut("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new Ut(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function eQ(t){return Pt(this,void 0,void 0,function*(){return yield QZ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=As(n.signal).signal;if(o.aborted){r(new Ut("Bridge connection aborted"));return}const a=new URL(j7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new Ut("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}try{const p=yield t.errorHandler(l,d);p!==l&&l.close(),p&&p!==l&&e(p)}catch(p){l.close(),r(p)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new Ut("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function lh(t){return!("connectEvent"in t)}class hh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!lh(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Tb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Tb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");if(!lh(e))throw new Ut("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new Ut("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!lh(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const q7=2;class dh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new hh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getHttpConnection();return lh(n)?new dh(e,n.connectionSource):new dh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=As(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Tb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield fh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(lh(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new Ut("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Lb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield fh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Ut("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),Y0(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=As(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){Sn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(B7.decode(e.message).toUint8Array(),Y0(e.from)));if(Sn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){Sn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Fo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(Sn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new Ut(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return YZ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",q7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+JZ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new Lb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>fh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(Sn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Lb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function z7(t,e){return H7(t,[e])}function H7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function tQ(t){try{return!z7(t,"tonconnect")||!z7(t.tonconnect,"walletInfo")?!1:H7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Xu{constructor(){this.storage={}}static getInstance(){return Xu.instance||(Xu.instance=new Xu),Xu.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function np(){if(!(typeof window>"u"))return window}function rQ(){const t=np();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function nQ(){if(!(typeof document>"u"))return document}function iQ(){var t;const e=(t=np())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function sQ(){if(oQ())return localStorage;if(aQ())throw new Ut("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Xu.getInstance()}function oQ(){try{return typeof localStorage<"u"}catch{return!1}}function aQ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class xi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=xi.window;if(!xi.isWindowContainsWallet(n,r))throw new Ob;this.connectionStorage=new hh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new hh(e).getInjectedConnection();return new xi(e,n.jsBridgeKey)})}static isWalletInjected(e){return xi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return xi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?rQ().filter(([n,i])=>tQ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(q7,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{Sn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();Sn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){Sn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),Sn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>Sn("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{Sn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);Sn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){Sn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{Sn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}xi.window=np();class cQ{constructor(){this.localStorage=sQ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function W7(t){return fQ(t)&&t.injected}function uQ(t){return W7(t)&&t.embedded}function fQ(t){return"jsBridgeKey"in t}const lQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class kb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(uQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new Nb("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Fo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Fo(n),e=lQ}let r=[];try{r=xi.getCurrentlyInjectedWallets()}catch(n){Fo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=xi.isWalletInjected(o),i.embedded=xi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class ip extends Ut{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,ip.prototype)}}function hQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new ip("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function xQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Qu(t,e)),Bb(e,r))}function _Q(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Qu(t,e)),Bb(e,r))}function EQ(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Qu(t,e)),Bb(e,r))}function SQ(t,e,r){return Object.assign({type:"disconnection",scope:r},Qu(t,e))}class AQ{constructor(){this.window=np()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class PQ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new AQ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Zu({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",pQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",dQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=gQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=mQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=vQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=bQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=yQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=wQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=SQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=xQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=_Q(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=EQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const MQ="3.0.5";class ph{constructor(e){if(this.walletsList=new kb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||iQ(),storage:(e==null?void 0:e.storage)||new cQ},this.walletsList=new kb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new PQ({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:MQ}),!this.dappSettings.manifestUrl)throw new Rb("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new hh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Db;const o=As(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new Ut("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=As(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield dh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield xi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Fo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=fh(p=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:p.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(p=>setTimeout(()=>p(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=As(n==null?void 0:n.signal);if(i.signal.aborted)throw new Ut("Transaction sending was aborted");this.checkConnection(),hQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=UZ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(rp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(rp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),rp.parseAndThrowError(l);const d=rp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new Z0;const n=As(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Ut("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=nQ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Fo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&qZ(e)?r=new xi(this.dappSettings.storage,e.jsBridgeKey):r=new dh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new Ut("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=HZ.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),Sn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof X0||r instanceof J0)throw Fo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new Z0}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}ph.walletsList=new kb,ph.isWalletInjected=t=>xi.isWalletInjected(t),ph.isInsideWalletBrowser=t=>xi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function $b(t){const{children:e,onClick:r}=t;return de.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function K7(t){const{wallet:e,connector:r,loading:n}=t,i=Se.useRef(null),s=Se.useRef(),[o,a]=Se.useState(),[u,l]=Se.useState(),[d,p]=Se.useState("connect"),[y,A]=Se.useState(!1),[P,O]=Se.useState();function D(z){var ue;(ue=s.current)==null||ue.update({data:z})}async function k(){A(!0);try{a("");const z=await va.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ue=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:z}});if(!ue)return;O(ue),D(ue),l(z)}}catch(z){a(z.message)}A(!1)}function B(){s.current=new E7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function q(){r.connect(e,{request:{tonProof:u}})}function j(){if("deepLink"in e){if(!e.deepLink||!P)return;const z=new URL(P),ue=`${e.deepLink}${z.search}`;window.open(ue)}}function H(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(P)}const J=Se.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),T=Se.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Se.useEffect(()=>{B(),k()},[]),de.jsxs(Ss,{children:[de.jsx("div",{className:"xc-mb-6",children:de.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),de.jsxs("div",{className:"xc-text-center xc-mb-6",children:[de.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[de.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),de.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?de.jsx(vc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):de.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),de.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),de.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&de.jsx(vc,{className:"xc-animate-spin"}),!y&&!n&&de.jsxs(de.Fragment,{children:[W7(e)&&de.jsxs($b,{onClick:q,children:[de.jsx(BK,{className:"xc-opacity-80"}),"Extension"]}),J&&de.jsxs($b,{onClick:j,children:[de.jsx(f8,{className:"xc-opacity-80"}),"Desktop"]}),T&&de.jsx($b,{onClick:H,children:"Telegram Mini App"})]})]})]})}function IQ(t){const[e,r]=Se.useState(""),[n,i]=Se.useState(),[s,o]=Se.useState(),a=Ib(),[u,l]=Se.useState(!1);async function d(y){var P,O;if(!y||!((P=y.connectItems)!=null&&P.tonProof))return;l(!0);const A=await va.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(O=y.connectItems)==null?void 0:O.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(A.data),l(!1)}Se.useEffect(()=>{const y=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),A=y.onStatusChange(d);return o(y),r("select"),A},[]);function p(y){r("connect"),i(y)}return de.jsxs(Ss,{children:[e==="select"&&de.jsx(T7,{connector:s,onSelect:p,onBack:t.onBack}),e==="connect"&&de.jsx(K7,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function V7(t){const{children:e,className:r}=t,n=Se.useRef(null),[i,s]=Se.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Se.useEffect(()=>{console.log("maxHeight",i)},[i]),de.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function CQ(){return de.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[de.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),de.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),de.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),de.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),de.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),de.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function G7(t){const{wallets:e}=Kl(),[r,n]=Se.useState(),i=Se.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return de.jsxs(Ss,{children:[de.jsx("div",{className:"xc-mb-6",children:de.jsx(Sc,{title:"Select wallet",onBack:t.onBack})}),de.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[de.jsx(l8,{className:"xc-shrink-0 xc-opacity-50"}),de.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),de.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>de.jsx(e7,{wallet:a,onClick:s},`feature-${a.key}`)):de.jsx(CQ,{})})]})}function TQ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Se.useState(""),[l,d]=Se.useState(null),[p,y]=Se.useState("");function A(k){d(k),u("evm-wallet")}function P(k){u("email"),y(k)}async function O(k){await e(k)}function D(){u("ton-wallet")}return Se.useEffect(()=>{u("index")},[]),de.jsx(YX,{config:t.config,children:de.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&de.jsx(RZ,{onBack:()=>u("index"),onLogin:O,wallet:l}),a==="ton-wallet"&&de.jsx(IQ,{onBack:()=>u("index"),onLogin:O}),a==="email"&&de.jsx(fZ,{email:p,onBack:()=>u("index"),onLogin:O}),a==="index"&&de.jsx(f7,{header:r,onEmailConfirm:P,onSelectWallet:A,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&de.jsx(G7,{onBack:()=>u("index"),onSelectWallet:A})]})})}function RQ(t){const{wallet:e,onConnect:r}=t,[n,i]=Se.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return de.jsxs(Ss,{children:[de.jsx("div",{className:"xc-mb-6",children:de.jsx(Sc,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&de.jsx(M7,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&de.jsx(I7,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&de.jsx(C7,{wallet:e})]})}function DQ(t){const{email:e}=t,[r,n]=Se.useState("captcha");return de.jsxs(Ss,{children:[de.jsx("div",{className:"xc-mb-12",children:de.jsx(Sc,{title:"Sign in with email",onBack:t.onBack})}),r==="captcha"&&de.jsx(x7,{email:e,onCodeSend:()=>n("verify-email")}),r==="verify-email"&&de.jsx(w7,{email:e,onInputCode:t.onInputCode,onResendCode:()=>n("captcha")})]})}function OQ(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Se.useState(""),[a,u]=Se.useState(),[l,d]=Se.useState(),p=Se.useRef(),[y,A]=Se.useState("");function P(j){u(j),o("evm-wallet-connect")}function O(j){A(j),o("email-connect")}async function D(j,H){await(e==null?void 0:e({chain_type:"eip155",client:j.client,connect_info:H,wallet:j})),o("index")}async function k(j,H){await(n==null?void 0:n(j,H))}function B(j){d(j),o("ton-wallet-connect")}async function q(j){j&&await(r==null?void 0:r({chain_type:"ton",client:p.current,connect_info:j,wallet:j}))}return Se.useEffect(()=>{p.current=new ph({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const j=p.current.onStatusChange(q);return o("index"),j},[]),de.jsxs(V7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&de.jsx(G7,{onBack:()=>o("index"),onSelectWallet:P}),s==="evm-wallet-connect"&&de.jsx(RQ,{onBack:()=>o("index"),onConnect:D,wallet:a}),s==="ton-wallet-select"&&de.jsx(T7,{connector:p.current,onSelect:B,onBack:()=>o("index")}),s==="ton-wallet-connect"&&de.jsx(K7,{connector:p.current,wallet:l,onBack:()=>o("index")}),s==="email-connect"&&de.jsx(DQ,{email:y,onBack:()=>o("index"),onInputCode:k}),s==="index"&&de.jsx(f7,{onEmailConfirm:O,onSelectWallet:P,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Mn.CodattaConnect=OQ,Mn.CodattaConnectContextProvider=CK,Mn.CodattaSignin=TQ,Mn.WalletItem=ru,Mn.coinbaseWallet=o8,Mn.useCodattaConnectContext=Kl,Object.defineProperty(Mn,Symbol.toStringTag,{value:"Module"})}); + ***************************************************************************** */function vQ(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new Ut("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new Ut("Delay aborted"))})})})}function Is(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function dh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=Is(e==null?void 0:e.signal);if(typeof t!="function")throw new Ut(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=p??null,o==null||o.abort(),o=Is(p),o.signal.aborted)throw new Ut("Resource creation was aborted");n=y??null;const _=t(o.signal,...y);i=_;const M=yield _;if(i!==_&&M!==r)throw yield e(M),new Ut("Resource creation was aborted by a new resource creation");return r=M,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const p=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([p?e(p):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:p=>Pt(this,void 0,void 0,function*(){const y=r,_=i,M=n,O=s;if(yield m9(p),y===r&&_===i&&M===n&&O===s)return yield a(s,...M??[]);throw new Ut("Resource recreation was aborted by a new resource creation")})}}function CQ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=Is(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new Ut("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new Ut(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new Ut("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class Hb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=IQ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield TQ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new EQ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(g9(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=h9.encode(e);yield dh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new Ut(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Fo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Fo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new Ut(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new Ut("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),En(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Ut("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new Ut(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function TQ(t){return Pt(this,void 0,void 0,function*(){return yield CQ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=Is(n.signal).signal;if(o.aborted){r(new Ut("Bridge connection aborted"));return}const a=new URL(g9(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new Ut("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}try{const p=yield t.errorHandler(l,d);p!==l&&l.close(),p&&p!==l&&e(p)}catch(p){l.close(),r(p)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new Ut("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function ph(t){return!("connectEvent"in t)}class gh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!ph(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Fb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Fb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");if(!ph(e))throw new Ut("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new Ut("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!ph(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const v9=2;class mh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new gh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new gh(e).getHttpConnection();return ph(n)?new mh(e,n.connectionSource):new mh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=Is(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Fb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield dh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=Is(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(ph(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new Ut("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(En("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Hb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield dh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Ut("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),En("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),ap(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=Is(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){En("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(En("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(h9.decode(e.message).toUint8Array(),ap(e.from)));if(En("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){En(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Fo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(En("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new Ut(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return AQ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",v9.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+PQ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new Hb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>dh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(En("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Hb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function b9(t,e){return y9(t,[e])}function y9(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function RQ(t){try{return!b9(t,"tonconnect")||!b9(t.tonconnect,"walletInfo")?!1:y9(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Xu{constructor(){this.storage={}}static getInstance(){return Xu.instance||(Xu.instance=new Xu),Xu.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function gp(){if(!(typeof window>"u"))return window}function DQ(){const t=gp();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function OQ(){if(!(typeof document>"u"))return document}function NQ(){var t;const e=(t=gp())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function LQ(){if(kQ())return localStorage;if(BQ())throw new Ut("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Xu.getInstance()}function kQ(){try{return typeof localStorage<"u"}catch{return!1}}function BQ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class wi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=wi.window;if(!wi.isWindowContainsWallet(n,r))throw new qb;this.connectionStorage=new gh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new gh(e).getInjectedConnection();return new wi(e,n.jsBridgeKey)})}static isWalletInjected(e){return wi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return wi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?DQ().filter(([n,i])=>RQ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(v9,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{En("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();En("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){En(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),En("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>En("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{En(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);En("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){En("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{En("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}wi.window=gp();class $Q{constructor(){this.localStorage=LQ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function w9(t){return jQ(t)&&t.injected}function FQ(t){return w9(t)&&t.embedded}function jQ(t){return"jsBridgeKey"in t}const UQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class Wb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(FQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new zb("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Fo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Fo(n),e=UQ}let r=[];try{r=wi.getCurrentlyInjectedWallets()}catch(n){Fo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=wi.isWalletInjected(o),i.embedded=wi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class mp extends Ut{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,mp.prototype)}}function qQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new mp("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function XQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Qu(t,e)),Kb(e,r))}function ZQ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Qu(t,e)),Kb(e,r))}function QQ(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Qu(t,e)),Kb(e,r))}function eee(t,e,r){return Object.assign({type:"disconnection",scope:r},Qu(t,e))}class tee{constructor(){this.window=gp()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class ree{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new tee,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Zu({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",HQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",zQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=WQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=KQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=VQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=GQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=YQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=JQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=eee(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=XQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=ZQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=QQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const nee="3.0.5";class vh{constructor(e){if(this.walletsList=new Wb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||NQ(),storage:(e==null?void 0:e.storage)||new $Q},this.walletsList=new Wb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new ree({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:nee}),!this.dappSettings.manifestUrl)throw new jb("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new gh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Ub;const o=Is(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new Ut("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=Is(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield mh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield wi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Fo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=dh(p=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:p.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(p=>setTimeout(()=>p(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=Is(n==null?void 0:n.signal);if(i.signal.aborted)throw new Ut("Transaction sending was aborted");this.checkConnection(),qQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=vQ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(pp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(pp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),pp.parseAndThrowError(l);const d=pp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new fp;const n=Is(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Ut("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=OQ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Fo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&bQ(e)?r=new wi(this.dappSettings.storage,e.jsBridgeKey):r=new mh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new Ut("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=wQ.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),En(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof up||r instanceof cp)throw Fo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new fp}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}vh.walletsList=new Wb,vh.isWalletInjected=t=>wi.isWalletInjected(t),vh.isInsideWalletBrowser=t=>wi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function Vb(t){const{children:e,onClick:r}=t;return le.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function x9(t){const{wallet:e,connector:r,loading:n}=t,i=Ee.useRef(null),s=Ee.useRef(),[o,a]=Ee.useState(),[u,l]=Ee.useState(),[d,p]=Ee.useState("connect"),[y,_]=Ee.useState(!1),[M,O]=Ee.useState();function L(W){var ie;(ie=s.current)==null||ie.update({data:W})}async function B(){_(!0);try{a("");const W=await xa.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ie=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:W}});if(!ie)return;O(ie),L(ie),l(W)}}catch(W){a(W.message)}_(!1)}function k(){s.current=new Z7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function H(){r.connect(e,{request:{tonProof:u}})}function U(){if("deepLink"in e){if(!e.deepLink||!M)return;const W=new URL(M),ie=`${e.deepLink}${W.search}`;window.open(ie)}}function z(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(M)}const Z=Ee.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),R=Ee.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Ee.useEffect(()=>{k(),B()},[]),le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Tc,{title:"Connect wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-text-center xc-mb-6",children:[le.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[le.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),le.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?le.jsx(Ec,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):le.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),le.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),le.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&le.jsx(Ec,{className:"xc-animate-spin"}),!y&&!n&&le.jsxs(le.Fragment,{children:[w9(e)&&le.jsxs(Vb,{onClick:H,children:[le.jsx(dV,{className:"xc-opacity-80"}),"Extension"]}),Z&&le.jsxs(Vb,{onClick:U,children:[le.jsx(F8,{className:"xc-opacity-80"}),"Desktop"]}),R&&le.jsx(Vb,{onClick:z,children:"Telegram Mini App"})]})]})]})}function iee(t){const[e,r]=Ee.useState(""),[n,i]=Ee.useState(),[s,o]=Ee.useState(),a=Bb(),[u,l]=Ee.useState(!1);async function d(y){var M,O;if(!y||!((M=y.connectItems)!=null&&M.tonProof))return;l(!0);const _=await xa.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(O=y.connectItems)==null?void 0:O.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(_.data),l(!1)}Ee.useEffect(()=>{const y=new vh({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),_=y.onStatusChange(d);return o(y),r("select"),_},[]);function p(y){r("connect"),i(y)}return le.jsxs(Ms,{children:[e==="select"&&le.jsx(s9,{connector:s,onSelect:p,onBack:t.onBack}),e==="connect"&&le.jsx(x9,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function _9(t){const{children:e,className:r}=t,n=Ee.useRef(null),[i,s]=Ee.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Ee.useEffect(()=>{console.log("maxHeight",i)},[i]),le.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function see(){return le.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[le.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),le.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function E9(t){const{wallets:e}=Yl(),[r,n]=Ee.useState(),i=Ee.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Tc,{title:"Select wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[le.jsx(j8,{className:"xc-shrink-0 xc-opacity-50"}),le.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),le.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>le.jsx(C7,{wallet:a,onClick:s},`feature-${a.key}`)):le.jsx(see,{})})]})}function oee(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Ee.useState(""),[l,d]=Ee.useState(null),[p,y]=Ee.useState("");function _(B){d(B),u("evm-wallet")}function M(B){u("email"),y(B)}async function O(B){await e(B)}function L(){u("ton-wallet")}return Ee.useEffect(()=>{u("index")},[]),le.jsx(AZ,{config:t.config,children:le.jsxs(_9,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&le.jsx(aQ,{onBack:()=>u("index"),onLogin:O,wallet:l}),a==="ton-wallet"&&le.jsx(iee,{onBack:()=>u("index"),onLogin:O}),a==="email"&&le.jsx(jZ,{email:p,onBack:()=>u("index"),onLogin:O}),a==="index"&&le.jsx(F7,{header:r,onEmailConfirm:M,onSelectWallet:_,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:L,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&le.jsx(E9,{onBack:()=>u("index"),onSelectWallet:_})]})})}function aee(t){const{wallet:e,onConnect:r}=t,[n,i]=Ee.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Tc,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&le.jsx(r9,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&le.jsx(n9,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&le.jsx(i9,{wallet:e})]})}function cee(t){const{email:e}=t,[r,n]=Ee.useState("captcha");return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-12",children:le.jsx(Tc,{title:"Sign in with email",onBack:t.onBack})}),r==="captcha"&&le.jsx(J7,{email:e,onCodeSend:()=>n("verify-email")}),r==="verify-email"&&le.jsx(Y7,{email:e,onInputCode:t.onInputCode,onResendCode:()=>n("captcha")})]})}function uee(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Ee.useState(""),[a,u]=Ee.useState(),[l,d]=Ee.useState(),p=Ee.useRef(),[y,_]=Ee.useState("");function M(U){u(U),o("evm-wallet-connect")}function O(U){_(U),o("email-connect")}async function L(U,z){await(e==null?void 0:e({chain_type:"eip155",client:U.client,connect_info:z,wallet:U})),o("index")}async function B(U,z){await(n==null?void 0:n(U,z))}function k(U){d(U),o("ton-wallet-connect")}async function H(U){U&&await(r==null?void 0:r({chain_type:"ton",client:p.current,connect_info:U,wallet:U}))}return Ee.useEffect(()=>{p.current=new vh({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const U=p.current.onStatusChange(H);return o("index"),U},[]),le.jsxs(_9,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&le.jsx(E9,{onBack:()=>o("index"),onSelectWallet:M}),s==="evm-wallet-connect"&&le.jsx(aee,{onBack:()=>o("index"),onConnect:L,wallet:a}),s==="ton-wallet-select"&&le.jsx(s9,{connector:p.current,onSelect:k,onBack:()=>o("index")}),s==="ton-wallet-connect"&&le.jsx(x9,{connector:p.current,wallet:l,onBack:()=>o("index")}),s==="email-connect"&&le.jsx(cee,{email:y,onBack:()=>o("index"),onInputCode:B}),s==="index"&&le.jsx(F7,{onEmailConfirm:O,onSelectWallet:M,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Pn.CodattaConnect=uee,Pn.CodattaConnectContextProvider=sV,Pn.CodattaSignin=oee,Pn.WalletItem=ru,Pn.coinbaseWallet=L8,Pn.useCodattaConnectContext=Yl,Object.defineProperty(Pn,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/main-CeikbqJc.js b/dist/main-D7TyRk7o.js similarity index 68% rename from dist/main-CeikbqJc.js rename to dist/main-D7TyRk7o.js index efa42f0..7b3e9c4 100644 --- a/dist/main-CeikbqJc.js +++ b/dist/main-D7TyRk7o.js @@ -1,14 +1,14 @@ -var NR = Object.defineProperty; -var LR = (t, e, r) => e in t ? NR(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; -var Ds = (t, e, r) => LR(t, typeof e != "symbol" ? e + "" : e, r); +var cD = Object.defineProperty; +var uD = (t, e, r) => e in t ? cD(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; +var vs = (t, e, r) => uD(t, typeof e != "symbol" ? e + "" : e, r); import * as Gt from "react"; -import gv, { createContext as Sa, useContext as Tn, useState as Yt, useEffect as Dn, forwardRef as mv, createElement as qd, useId as vv, useCallback as bv, Component as kR, useLayoutEffect as $R, useRef as Zn, useInsertionEffect as y5, useMemo as wi, Fragment as w5, Children as BR, isValidElement as FR } from "react"; +import Rv, { createContext as Ta, useContext as Tn, useState as Yt, useEffect as Dn, forwardRef as Dv, createElement as e0, useId as Ov, useCallback as Nv, Component as fD, useLayoutEffect as lD, useRef as Qn, useInsertionEffect as L5, useMemo as wi, Fragment as k5, Children as hD, isValidElement as dD } from "react"; import "https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"; var gn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; -function ts(t) { +function ns(t) { return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; } -function yv(t) { +function Lv(t) { if (t.__esModule) return t; var e = t.default; if (typeof e == "function") { @@ -27,7 +27,7 @@ function yv(t) { }); }), r; } -var Ym = { exports: {} }, gf = {}; +var u1 = { exports: {} }, _f = {}; /** * @license React * react-jsx-runtime.production.min.js @@ -37,21 +37,21 @@ var Ym = { exports: {} }, gf = {}; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -var p2; -function jR() { - if (p2) return gf; - p2 = 1; - var t = gv, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 }; +var I2; +function pD() { + if (I2) return _f; + I2 = 1; + var t = Rv, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 }; function o(a, u, l) { - var d, p = {}, w = null, A = null; - l !== void 0 && (w = "" + l), u.key !== void 0 && (w = "" + u.key), u.ref !== void 0 && (A = u.ref); + var d, p = {}, w = null, _ = null; + l !== void 0 && (w = "" + l), u.key !== void 0 && (w = "" + u.key), u.ref !== void 0 && (_ = u.ref); for (d in u) n.call(u, d) && !s.hasOwnProperty(d) && (p[d] = u[d]); if (a && a.defaultProps) for (d in u = a.defaultProps, u) p[d] === void 0 && (p[d] = u[d]); - return { $$typeof: e, type: a, key: w, ref: A, props: p, _owner: i.current }; + return { $$typeof: e, type: a, key: w, ref: _, props: p, _owner: i.current }; } - return gf.Fragment = r, gf.jsx = o, gf.jsxs = o, gf; + return _f.Fragment = r, _f.jsx = o, _f.jsxs = o, _f; } -var mf = {}; +var Ef = {}; /** * @license React * react-jsx-runtime.development.js @@ -61,25 +61,25 @@ var mf = {}; * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -var g2; -function UR() { - return g2 || (g2 = 1, process.env.NODE_ENV !== "production" && function() { - var t = gv, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), a = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), M = Symbol.iterator, N = "@@iterator"; +var C2; +function gD() { + return C2 || (C2 = 1, process.env.NODE_ENV !== "production" && function() { + var t = Rv, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), a = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), _ = Symbol.for("react.offscreen"), P = Symbol.iterator, O = "@@iterator"; function L(j) { if (j === null || typeof j != "object") return null; - var se = M && j[M] || j[N]; + var se = P && j[P] || j[O]; return typeof se == "function" ? se : null; } var B = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - function $(j) { + function k(j) { { for (var se = arguments.length, de = new Array(se > 1 ? se - 1 : 0), xe = 1; xe < se; xe++) de[xe - 1] = arguments[xe]; - H("error", j, de); + q("error", j, de); } } - function H(j, se, de) { + function q(j, se, de) { { var xe = B.ReactDebugCurrentFrame, Te = xe.getStackAddendum(); Te !== "" && (se += "%s", de = de.concat([Te])); @@ -89,10 +89,10 @@ function UR() { Re.unshift("Warning: " + se), Function.prototype.apply.call(console[j], console, Re); } } - var U = !1, V = !1, te = !1, R = !1, K = !1, ge; + var U = !1, V = !1, Q = !1, R = !1, K = !1, ge; ge = Symbol.for("react.module.reference"); function Ee(j) { - return !!(typeof j == "string" || typeof j == "function" || j === n || j === s || K || j === i || j === l || j === d || R || j === A || U || V || te || typeof j == "object" && j !== null && (j.$$typeof === w || j.$$typeof === p || j.$$typeof === o || j.$$typeof === a || j.$$typeof === u || // This needs to include all possible module reference object + return !!(typeof j == "string" || typeof j == "function" || j === n || j === s || K || j === i || j === l || j === d || R || j === _ || U || V || Q || typeof j == "object" && j !== null && (j.$$typeof === w || j.$$typeof === p || j.$$typeof === o || j.$$typeof === a || j.$$typeof === u || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. @@ -105,13 +105,13 @@ function UR() { var Te = se.displayName || se.name || ""; return Te !== "" ? de + "(" + Te + ")" : de; } - function S(j) { + function A(j) { return j.displayName || "Context"; } function m(j) { if (j == null) return null; - if (typeof j.tag == "number" && $("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof j == "function") + if (typeof j.tag == "number" && k("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof j == "function") return j.displayName || j.name || null; if (typeof j == "string") return j; @@ -133,10 +133,10 @@ function UR() { switch (j.$$typeof) { case a: var se = j; - return S(se) + ".Consumer"; + return A(se) + ".Consumer"; case o: var de = j; - return S(de._context) + ".Provider"; + return A(de._context) + ".Provider"; case u: return Y(j, j.render, "ForwardRef"); case p: @@ -153,14 +153,14 @@ function UR() { } return null; } - var f = Object.assign, g = 0, b, x, _, E, v, P, I; + var f = Object.assign, g = 0, b, x, E, S, v, M, I; function F() { } F.__reactDisabledLog = !0; function ce() { { if (g === 0) { - b = console.log, x = console.info, _ = console.warn, E = console.error, v = console.group, P = console.groupCollapsed, I = console.groupEnd; + b = console.log, x = console.info, E = console.warn, S = console.error, v = console.group, M = console.groupCollapsed, I = console.groupEnd; var j = { configurable: !0, enumerable: !0, @@ -196,23 +196,23 @@ function UR() { value: x }), warn: f({}, j, { - value: _ + value: E }), error: f({}, j, { - value: E + value: S }), group: f({}, j, { value: v }), groupCollapsed: f({}, j, { - value: P + value: M }), groupEnd: f({}, j, { value: I }) }); } - g < 0 && $("disabledDepth fell below zero. This is a bug in React. Please file an issue."); + g < 0 && k("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var oe = B.ReactCurrentDispatcher, Z; @@ -229,13 +229,13 @@ function UR() { ` + Z + j; } } - var Q = !1, T; + var ee = !1, T; { var X = typeof WeakMap == "function" ? WeakMap : Map; T = new X(); } function re(j, se) { - if (!j || Q) + if (!j || ee) return ""; { var de = T.get(j); @@ -243,7 +243,7 @@ function UR() { return de; } var xe; - Q = !0; + ee = !0; var Te = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var Re; @@ -300,7 +300,7 @@ function UR() { } } } finally { - Q = !1, oe.current = Re, D(), Error.prepareStackTrace = Te; + ee = !1, oe.current = Re, D(), Error.prepareStackTrace = Te; } var Tt = j ? j.displayName || j.name : "", At = Tt ? J(Tt) : ""; return typeof j == "function" && T.set(j, At), At; @@ -364,7 +364,7 @@ function UR() { } catch (it) { je = it; } - je && !(je instanceof Error) && (Ce(Te), $("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", xe || "React class", de, nt, typeof je), Ce(null)), je instanceof Error && !(je.message in Pe) && (Pe[je.message] = !0, Ce(Te), $("Failed %s type: %s", de, je.message), Ce(null)); + je && !(je instanceof Error) && (Ce(Te), k("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", xe || "React class", de, nt, typeof je), Ce(null)), je instanceof Error && !(je.message in Pe) && (Pe[je.message] = !0, Ce(Te), k("Failed %s type: %s", de, je.message), Ce(null)); } } } @@ -390,7 +390,7 @@ function UR() { } function ze(j) { if (Le(j)) - return $("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(j)), qe(j); + return k("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(j)), qe(j); } var _e = B.ReactCurrentOwner, Ze = { key: !0, @@ -418,13 +418,13 @@ function UR() { function dt(j, se) { if (typeof j.ref == "string" && _e.current && se && _e.current.stateNode !== se) { var de = m(_e.current.type); - Qe[de] || ($('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', m(_e.current.type), j.ref), Qe[de] = !0); + Qe[de] || (k('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', m(_e.current.type), j.ref), Qe[de] = !0); } } function lt(j, se) { { var de = function() { - at || (at = !0, $("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); + at || (at = !0, k("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); }; de.isReactWarning = !0, Object.defineProperty(j, "key", { get: de, @@ -435,7 +435,7 @@ function UR() { function ct(j, se) { { var de = function() { - ke || (ke = !0, $("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); + ke || (ke = !0, k("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); }; de.isReactWarning = !0, Object.defineProperty(j, "ref", { get: de, @@ -515,7 +515,7 @@ Check the render method of \`` + j + "`."; return ""; } } - function gt(j) { + function mt(j) { return ""; } var Rt = {}; @@ -531,7 +531,7 @@ Check the top-level render call using <` + de + ">."); return se; } } - function vt(j, se) { + function bt(j, se) { { if (!j._store || j._store.validated || j.key != null) return; @@ -541,7 +541,7 @@ Check the top-level render call using <` + de + ">."); return; Rt[de] = !0; var xe = ""; - j && j._owner && j._owner !== Et.current && (xe = " It was passed a child from " + m(j._owner.type) + "."), Xt(j), $('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', de, xe), Xt(null); + j && j._owner && j._owner !== Et.current && (xe = " It was passed a child from " + m(j._owner.type) + "."), Xt(j), k('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', de, xe), Xt(null); } } function $t(j, se) { @@ -551,7 +551,7 @@ Check the top-level render call using <` + de + ">."); if (Ne(j)) for (var de = 0; de < j.length; de++) { var xe = j[de]; - kt(xe) && vt(xe, se); + kt(xe) && bt(xe, se); } else if (kt(j)) j._store && (j._store.validated = !0); @@ -559,7 +559,7 @@ Check the top-level render call using <` + de + ">."); var Te = L(j); if (typeof Te == "function" && Te !== j.entries) for (var Re = Te.call(j), nt; !(nt = Re.next()).done; ) - kt(nt.value) && vt(nt.value, se); + kt(nt.value) && bt(nt.value, se); } } } @@ -583,9 +583,9 @@ Check the top-level render call using <` + de + ">."); } else if (se.PropTypes !== void 0 && !Dt) { Dt = !0; var Te = m(se); - $("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Te || "Unknown"); + k("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Te || "Unknown"); } - typeof se.getDefaultProps == "function" && !se.getDefaultProps.isReactClassApproved && $("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); + typeof se.getDefaultProps == "function" && !se.getDefaultProps.isReactClassApproved && k("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function rt(j) { @@ -593,24 +593,24 @@ Check the top-level render call using <` + de + ">."); for (var se = Object.keys(j.props), de = 0; de < se.length; de++) { var xe = se[de]; if (xe !== "children" && xe !== "key") { - Xt(j), $("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", xe), Xt(null); + Xt(j), k("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", xe), Xt(null); break; } } - j.ref !== null && (Xt(j), $("Invalid attribute `ref` supplied to `React.Fragment`."), Xt(null)); + j.ref !== null && (Xt(j), k("Invalid attribute `ref` supplied to `React.Fragment`."), Xt(null)); } } var Bt = {}; - function k(j, se, de, xe, Te, Re) { + function $(j, se, de, xe, Te, Re) { { var nt = Ee(j); if (!nt) { var je = ""; (j === void 0 || typeof j == "object" && j !== null && Object.keys(j).length === 0) && (je += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); - var pt = gt(); + var pt = mt(); pt ? je += pt : je += Ct(); var it; - j === null ? it = "null" : Ne(j) ? it = "array" : j !== void 0 && j.$$typeof === e ? (it = "<" + (m(j.type) || "Unknown") + " />", je = " Did you accidentally export a JSX literal instead of a component?") : it = typeof j, $("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", it, je); + j === null ? it = "null" : Ne(j) ? it = "array" : j !== void 0 && j.$$typeof === e ? (it = "<" + (m(j.type) || "Unknown") + " />", je = " Did you accidentally export a JSX literal instead of a component?") : it = typeof j, k("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", it, je); } var et = Jt(j, se, de, Te, Re); if (et == null) @@ -624,7 +624,7 @@ Check the top-level render call using <` + de + ">."); $t(St[Tt], j); Object.freeze && Object.freeze(St); } else - $("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); + k("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else $t(St, j); } @@ -634,7 +634,7 @@ Check the top-level render call using <` + de + ">."); }), ht = _t.length > 0 ? "{key: someKey, " + _t.join(": ..., ") + ": ...}" : "{key: someKey}"; if (!Bt[At + ht]) { var xt = _t.length > 0 ? "{" + _t.join(": ..., ") + ": ...}" : "{}"; - $(`A props object containing a "key" prop is being spread into JSX: + k(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: @@ -645,24 +645,24 @@ React keys must be passed directly to JSX without using spread: return j === n ? rt(et) : Ft(et), et; } } - function q(j, se, de) { - return k(j, se, de, !0); + function z(j, se, de) { + return $(j, se, de, !0); } - function W(j, se, de) { - return k(j, se, de, !1); + function H(j, se, de) { + return $(j, se, de, !1); } - var C = W, G = q; - mf.Fragment = n, mf.jsx = C, mf.jsxs = G; - }()), mf; + var C = H, G = z; + Ef.Fragment = n, Ef.jsx = C, Ef.jsxs = G; + }()), Ef; } -process.env.NODE_ENV === "production" ? Ym.exports = jR() : Ym.exports = UR(); -var le = Ym.exports; -const Os = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", qR = [ +process.env.NODE_ENV === "production" ? u1.exports = pD() : u1.exports = gD(); +var le = u1.exports; +const ks = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", mD = [ { featured: !0, name: "MetaMask", rdns: "io.metamask", - image: `${Os}#metamask`, + image: `${ks}#metamask`, getWallet: { chrome_store_id: "nkbihfbeogaeaoehlefnkodbefgpgknn", brave_store_id: "nkbihfbeogaeaoehlefnkodbefgpgknn", @@ -678,7 +678,7 @@ const Os = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", qR featured: !0, name: "OKX Wallet", rdns: "com.okex.wallet", - image: `${Os}#okx`, + image: `${ks}#okx`, getWallet: { chrome_store_id: "mcohilncbfahbmgdjkbpemcciiolgcge", brave_store_id: "mcohilncbfahbmgdjkbpemcciiolgcge", @@ -692,18 +692,18 @@ const Os = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", qR { featured: !0, name: "WalletConnect", - image: `${Os}#walletconnect` + image: `${ks}#walletconnect` }, { featured: !1, name: "Coinbase Wallet", - image: `${Os}#coinbase` + image: `${ks}#coinbase` }, { featured: !1, name: "GateWallet", rdns: "io.gate.wallet", - image: `${Os}#6e528abf-7a7d-47bd-d84d-481f169b1200`, + image: `${ks}#6e528abf-7a7d-47bd-d84d-481f169b1200`, getWallet: { chrome_store_id: "cpmkedoipcpimgecpmgpldfpohjplkpp", brave_store_id: "cpmkedoipcpimgecpmgpldfpohjplkpp", @@ -718,7 +718,7 @@ const Os = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", qR featured: !1, name: "Onekey", rdns: "so.onekey.app.wallet", - image: `${Os}#onekey`, + image: `${ks}#onekey`, getWallet: { chrome_store_id: "jnmbobjmhlngoefaiojfljckilhhlhcj", brave_store_id: "jnmbobjmhlngoefaiojfljckilhhlhcj", @@ -731,14 +731,14 @@ const Os = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", qR { featured: !1, name: "Infinity Wallet", - image: `${Os}#9f259366-0bcd-4817-0af9-f78773e41900`, + image: `${ks}#9f259366-0bcd-4817-0af9-f78773e41900`, desktop_link: "infinity://wc" }, { name: "Rabby Wallet", rdns: "io.rabby", featured: !1, - image: `${Os}#rabby`, + image: `${ks}#rabby`, getWallet: { chrome_store_id: "acmacodkjbdgmoleebolmdjonilkdbch", brave_store_id: "acmacodkjbdgmoleebolmdjonilkdbch", @@ -749,7 +749,7 @@ const Os = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", qR { name: "Binance Web3 Wallet", featured: !1, - image: `${Os}#ebac7b39-688c-41e3-7912-a4fefba74600`, + image: `${ks}#ebac7b39-688c-41e3-7912-a4fefba74600`, getWallet: { play_store_id: "com.binance.dev", app_store_id: "id1436799971" @@ -759,7 +759,7 @@ const Os = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", qR name: "Rainbow Wallet", rdns: "me.rainbow", featured: !1, - image: `${Os}#rainbow`, + image: `${ks}#rainbow`, getWallet: { chrome_store_id: "opfgelmcmbiajamepnmloijbpoleiama", edge_addon_id: "cpojfbodiccabbabgimdeohkkpjfpbnf", @@ -769,82 +769,83 @@ const Os = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", qR } } ]; -function zR(t, e) { +function vD(t, e) { const r = t.exec(e); return r == null ? void 0 : r.groups; } -const m2 = /^tuple(?(\[(\d*)\])*)$/; -function Jm(t) { +const T2 = /^tuple(?(\[(\d*)\])*)$/; +function f1(t) { let e = t.type; - if (m2.test(t.type) && "components" in t) { + if (T2.test(t.type) && "components" in t) { e = "("; const r = t.components.length; for (let i = 0; i < r; i++) { const s = t.components[i]; - e += Jm(s), i < r - 1 && (e += ", "); + e += f1(s), i < r - 1 && (e += ", "); } - const n = zR(m2, t.type); - return e += `)${(n == null ? void 0 : n.array) ?? ""}`, Jm({ + const n = vD(T2, t.type); + return e += `)${(n == null ? void 0 : n.array) ?? ""}`, f1({ ...t, type: e }); } return "indexed" in t && t.indexed && (e = `${e} indexed`), t.name ? `${e} ${t.name}` : e; } -function vf(t) { +function Sf(t) { let e = ""; const r = t.length; for (let n = 0; n < r; n++) { const i = t[n]; - e += Jm(i), n !== r - 1 && (e += ", "); + e += f1(i), n !== r - 1 && (e += ", "); } return e; } -function WR(t) { - return t.type === "function" ? `function ${t.name}(${vf(t.inputs)})${t.stateMutability && t.stateMutability !== "nonpayable" ? ` ${t.stateMutability}` : ""}${t.outputs.length ? ` returns (${vf(t.outputs)})` : ""}` : t.type === "event" ? `event ${t.name}(${vf(t.inputs)})` : t.type === "error" ? `error ${t.name}(${vf(t.inputs)})` : t.type === "constructor" ? `constructor(${vf(t.inputs)})${t.stateMutability === "payable" ? " payable" : ""}` : t.type === "fallback" ? "fallback()" : "receive() external payable"; +function bD(t) { + var e; + return t.type === "function" ? `function ${t.name}(${Sf(t.inputs)})${t.stateMutability && t.stateMutability !== "nonpayable" ? ` ${t.stateMutability}` : ""}${(e = t.outputs) != null && e.length ? ` returns (${Sf(t.outputs)})` : ""}` : t.type === "event" ? `event ${t.name}(${Sf(t.inputs)})` : t.type === "error" ? `error ${t.name}(${Sf(t.inputs)})` : t.type === "constructor" ? `constructor(${Sf(t.inputs)})${t.stateMutability === "payable" ? " payable" : ""}` : t.type === "fallback" ? `fallback() external${t.stateMutability === "payable" ? " payable" : ""}` : "receive() external payable"; } -function bi(t, e, r) { +function Xn(t, e, r) { const n = t[e.name]; if (typeof n == "function") return n; const i = t[r]; return typeof i == "function" ? i : (s) => e(t, s); } -function vu(t, { includeName: e = !1 } = {}) { +function Mu(t, { includeName: e = !1 } = {}) { if (t.type !== "function" && t.type !== "event" && t.type !== "error") - throw new rD(t.type); - return `${t.name}(${wv(t.inputs, { includeName: e })})`; + throw new TD(t.type); + return `${t.name}(${kv(t.inputs, { includeName: e })})`; } -function wv(t, { includeName: e = !1 } = {}) { - return t ? t.map((r) => HR(r, { includeName: e })).join(e ? ", " : ",") : ""; +function kv(t, { includeName: e = !1 } = {}) { + return t ? t.map((r) => yD(r, { includeName: e })).join(e ? ", " : ",") : ""; } -function HR(t, { includeName: e }) { - return t.type.startsWith("tuple") ? `(${wv(t.components, { includeName: e })})${t.type.slice(5)}` : t.type + (e && t.name ? ` ${t.name}` : ""); +function yD(t, { includeName: e }) { + return t.type.startsWith("tuple") ? `(${kv(t.components, { includeName: e })})${t.type.slice(5)}` : t.type + (e && t.name ? ` ${t.name}` : ""); } -function va(t, { strict: e = !0 } = {}) { +function ya(t, { strict: e = !0 } = {}) { return !t || typeof t != "string" ? !1 : e ? /^0x[0-9a-fA-F]*$/.test(t) : t.startsWith("0x"); } -function An(t) { - return va(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length; +function xn(t) { + return ya(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length; } -const x5 = "2.21.45"; -let bf = { +const $5 = "2.31.3"; +let Af = { getDocsUrl: ({ docsBaseUrl: t, docsPath: e = "", docsSlug: r }) => e ? `${t ?? "https://viem.sh"}${e}${r ? `#${r}` : ""}` : void 0, - version: `viem@${x5}` + version: `viem@${$5}` }; -class yt extends Error { +class gt extends Error { constructor(e, r = {}) { var a; const n = (() => { var u; - return r.cause instanceof yt ? r.cause.details : (u = r.cause) != null && u.message ? r.cause.message : r.details; - })(), i = r.cause instanceof yt && r.cause.docsPath || r.docsPath, s = (a = bf.getDocsUrl) == null ? void 0 : a.call(bf, { ...r, docsPath: i }), o = [ + return r.cause instanceof gt ? r.cause.details : (u = r.cause) != null && u.message ? r.cause.message : r.details; + })(), i = r.cause instanceof gt && r.cause.docsPath || r.docsPath, s = (a = Af.getDocsUrl) == null ? void 0 : a.call(Af, { ...r, docsPath: i }), o = [ e || "An error occurred.", "", ...r.metaMessages ? [...r.metaMessages, ""] : [], ...s ? [`Docs: ${s}`] : [], ...n ? [`Details: ${n}`] : [], - ...bf.version ? [`Version: ${bf.version}`] : [] + ...Af.version ? [`Version: ${Af.version}`] : [] ].join(` `); super(o, r.cause ? { cause: r.cause } : void 0), Object.defineProperty(this, "details", { @@ -877,16 +878,16 @@ class yt extends Error { configurable: !0, writable: !0, value: "BaseError" - }), this.details = n, this.docsPath = i, this.metaMessages = r.metaMessages, this.name = r.name ?? this.name, this.shortMessage = e, this.version = x5; + }), this.details = n, this.docsPath = i, this.metaMessages = r.metaMessages, this.name = r.name ?? this.name, this.shortMessage = e, this.version = $5; } walk(e) { - return _5(this, e); + return B5(this, e); } } -function _5(t, e) { - return e != null && e(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ? _5(t.cause, e) : e ? null : t; +function B5(t, e) { + return e != null && e(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ? B5(t.cause, e) : e ? null : t; } -class KR extends yt { +class wD extends gt { constructor({ docsPath: e }) { super([ "A constructor was not found on the ABI.", @@ -898,7 +899,7 @@ class KR extends yt { }); } } -class v2 extends yt { +class R2 extends gt { constructor({ docsPath: e }) { super([ "Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.", @@ -910,12 +911,12 @@ class v2 extends yt { }); } } -class VR extends yt { +class xD extends gt { constructor({ data: e, params: r, size: n }) { super([`Data size of ${n} bytes is too small for given parameters.`].join(` `), { metaMessages: [ - `Params: (${wv(r, { includeName: !0 })})`, + `Params: (${kv(r, { includeName: !0 })})`, `Data: ${e} (${n} bytes)` ], name: "AbiDecodingDataSizeTooSmallError" @@ -937,14 +938,14 @@ class VR extends yt { }), this.data = e, this.params = r, this.size = n; } } -class xv extends yt { +class $v extends gt { constructor() { super('Cannot decode zero data ("0x") with ABI parameters.', { name: "AbiDecodingZeroDataError" }); } } -class GR extends yt { +class _D extends gt { constructor({ expectedLength: e, givenLength: r, type: n }) { super([ `ABI encoding array length mismatch for type ${n}.`, @@ -954,12 +955,12 @@ class GR extends yt { `), { name: "AbiEncodingArrayLengthMismatchError" }); } } -class YR extends yt { +class ED extends gt { constructor({ expectedSize: e, value: r }) { - super(`Size of bytes "${r}" (bytes${An(r)}) does not match expected size (bytes${e}).`, { name: "AbiEncodingBytesSizeMismatchError" }); + super(`Size of bytes "${r}" (bytes${xn(r)}) does not match expected size (bytes${e}).`, { name: "AbiEncodingBytesSizeMismatchError" }); } } -class JR extends yt { +class SD extends gt { constructor({ expectedLength: e, givenLength: r }) { super([ "ABI encoding params/values length mismatch.", @@ -969,7 +970,7 @@ class JR extends yt { `), { name: "AbiEncodingLengthMismatchError" }); } } -class E5 extends yt { +class F5 extends gt { constructor(e, { docsPath: r }) { super([ `Encoded error signature "${e}" not found on ABI.`, @@ -987,7 +988,7 @@ class E5 extends yt { }), this.signature = e; } } -class b2 extends yt { +class D2 extends gt { constructor(e, { docsPath: r } = {}) { super([ `Function ${e ? `"${e}" ` : ""}not found on ABI.`, @@ -999,12 +1000,12 @@ class b2 extends yt { }); } } -class XR extends yt { +class AD extends gt { constructor(e, r) { super("Found ambiguous types in overloaded ABI items.", { metaMessages: [ - `\`${e.type}\` in \`${vu(e.abiItem)}\`, and`, - `\`${r.type}\` in \`${vu(r.abiItem)}\``, + `\`${e.type}\` in \`${Mu(e.abiItem)}\`, and`, + `\`${r.type}\` in \`${Mu(r.abiItem)}\``, "", "These types encode differently and cannot be distinguished at runtime.", "Remove one of the ambiguous items in the ABI." @@ -1013,14 +1014,14 @@ class XR extends yt { }); } } -class ZR extends yt { +class PD extends gt { constructor({ expectedSize: e, givenSize: r }) { super(`Expected bytes${e}, got bytes${r}.`, { name: "BytesSizeMismatchError" }); } } -class QR extends yt { +class MD extends gt { constructor(e, { docsPath: r }) { super([ `Type "${e}" is not a valid encoding type.`, @@ -1029,7 +1030,7 @@ class QR extends yt { `), { docsPath: r, name: "InvalidAbiEncodingType" }); } } -class eD extends yt { +class ID extends gt { constructor(e, { docsPath: r }) { super([ `Type "${e}" is not a valid decoding type.`, @@ -1038,7 +1039,7 @@ class eD extends yt { `), { docsPath: r, name: "InvalidAbiDecodingType" }); } } -class tD extends yt { +class CD extends gt { constructor(e) { super([`Value "${e}" is not a valid array.`].join(` `), { @@ -1046,7 +1047,7 @@ class tD extends yt { }); } } -class rD extends yt { +class TD extends gt { constructor(e) { super([ `"${e}" is not a valid definition type.`, @@ -1055,41 +1056,41 @@ class rD extends yt { `), { name: "InvalidDefinitionTypeError" }); } } -class S5 extends yt { +class j5 extends gt { constructor({ offset: e, position: r, size: n }) { super(`Slice ${r === "start" ? "starting" : "ending"} at offset "${e}" is out-of-bounds (size: ${n}).`, { name: "SliceOffsetOutOfBoundsError" }); } } -class A5 extends yt { +class U5 extends gt { constructor({ size: e, targetSize: r, type: n }) { super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`, { name: "SizeExceedsPaddingSizeError" }); } } -class y2 extends yt { +class O2 extends gt { constructor({ size: e, targetSize: r, type: n }) { super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`, { name: "InvalidBytesLengthError" }); } } -function Tu(t, { dir: e, size: r = 32 } = {}) { - return typeof t == "string" ? ma(t, { dir: e, size: r }) : nD(t, { dir: e, size: r }); +function Fu(t, { dir: e, size: r = 32 } = {}) { + return typeof t == "string" ? ba(t, { dir: e, size: r }) : RD(t, { dir: e, size: r }); } -function ma(t, { dir: e, size: r = 32 } = {}) { +function ba(t, { dir: e, size: r = 32 } = {}) { if (r === null) return t; const n = t.replace("0x", ""); if (n.length > r * 2) - throw new A5({ + throw new U5({ size: Math.ceil(n.length / 2), targetSize: r, type: "hex" }); return `0x${n[e === "right" ? "padEnd" : "padStart"](r * 2, "0")}`; } -function nD(t, { dir: e, size: r = 32 } = {}) { +function RD(t, { dir: e, size: r = 32 } = {}) { if (r === null) return t; if (t.length > r) - throw new A5({ + throw new U5({ size: t.length, targetSize: r, type: "bytes" @@ -1101,71 +1102,71 @@ function nD(t, { dir: e, size: r = 32 } = {}) { } return n; } -class iD extends yt { +class q5 extends gt { constructor({ max: e, min: r, signed: n, size: i, value: s }) { super(`Number "${s}" is not in safe ${i ? `${i * 8}-bit ${n ? "signed" : "unsigned"} ` : ""}integer range ${e ? `(${r} to ${e})` : `(above ${r})`}`, { name: "IntegerOutOfRangeError" }); } } -class sD extends yt { +class DD extends gt { constructor(e) { super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, { name: "InvalidBytesBooleanError" }); } } -class oD extends yt { +class OD extends gt { constructor({ givenSize: e, maxSize: r }) { super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" }); } } -function _v(t, { dir: e = "left" } = {}) { +function j0(t, { dir: e = "left" } = {}) { let r = typeof t == "string" ? t.replace("0x", "") : t, n = 0; for (let i = 0; i < r.length - 1 && r[e === "left" ? i : r.length - i - 1].toString() === "0"; i++) n++; return r = e === "left" ? r.slice(n) : r.slice(0, r.length - n), typeof t == "string" ? (r.length === 1 && e === "right" && (r = `${r}0`), `0x${r.length % 2 === 1 ? `0${r}` : r}`) : r; } -function to(t, { size: e }) { - if (An(t) > e) - throw new oD({ - givenSize: An(t), +function io(t, { size: e }) { + if (xn(t) > e) + throw new OD({ + givenSize: xn(t), maxSize: e }); } -function el(t, e = {}) { +function wa(t, e = {}) { const { signed: r } = e; - e.size && to(t, { size: e.size }); + e.size && io(t, { size: e.size }); const n = BigInt(t); if (!r) return n; const i = (t.length - 2) / 2, s = (1n << BigInt(i) * 8n - 1n) - 1n; return n <= s ? n : n - BigInt(`0x${"f".padStart(i * 2, "f")}`) - 1n; } -function bu(t, e = {}) { - return Number(el(t, e)); +function xa(t, e = {}) { + return Number(wa(t, e)); } -const aD = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); -function zd(t, e = {}) { - return typeof t == "number" || typeof t == "bigint" ? Mr(t, e) : typeof t == "string" ? I0(t, e) : typeof t == "boolean" ? P5(t, e) : xi(t, e); +const ND = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); +function t0(t, e = {}) { + return typeof t == "number" || typeof t == "bigint" ? vr(t, e) : typeof t == "string" ? U0(t, e) : typeof t == "boolean" ? z5(t, e) : xi(t, e); } -function P5(t, e = {}) { +function z5(t, e = {}) { const r = `0x${Number(t)}`; - return typeof e.size == "number" ? (to(r, { size: e.size }), Tu(r, { size: e.size })) : r; + return typeof e.size == "number" ? (io(r, { size: e.size }), Fu(r, { size: e.size })) : r; } function xi(t, e = {}) { let r = ""; for (let i = 0; i < t.length; i++) - r += aD[t[i]]; + r += ND[t[i]]; const n = `0x${r}`; - return typeof e.size == "number" ? (to(n, { size: e.size }), Tu(n, { dir: "right", size: e.size })) : n; + return typeof e.size == "number" ? (io(n, { size: e.size }), Fu(n, { dir: "right", size: e.size })) : n; } -function Mr(t, e = {}) { +function vr(t, e = {}) { const { signed: r, size: n } = e, i = BigInt(t); let s; n ? r ? s = (1n << BigInt(n) * 8n - 1n) - 1n : s = 2n ** (BigInt(n) * 8n) - 1n : typeof t == "number" && (s = BigInt(Number.MAX_SAFE_INTEGER)); const o = typeof s == "bigint" && r ? -s - 1n : 0; if (s && i > s || i < o) { const u = typeof t == "bigint" ? "n" : ""; - throw new iD({ + throw new q5({ max: s ? `${s}${u}` : void 0, min: `${o}${u}`, signed: r, @@ -1174,22 +1175,22 @@ function Mr(t, e = {}) { }); } const a = `0x${(r && i < 0 ? (1n << BigInt(n * 8)) + BigInt(i) : i).toString(16)}`; - return n ? Tu(a, { size: n }) : a; + return n ? Fu(a, { size: n }) : a; } -const cD = /* @__PURE__ */ new TextEncoder(); -function I0(t, e = {}) { - const r = cD.encode(t); +const LD = /* @__PURE__ */ new TextEncoder(); +function U0(t, e = {}) { + const r = LD.encode(t); return xi(r, e); } -const uD = /* @__PURE__ */ new TextEncoder(); -function Ev(t, e = {}) { - return typeof t == "number" || typeof t == "bigint" ? lD(t, e) : typeof t == "boolean" ? fD(t, e) : va(t) ? Lo(t, e) : M5(t, e); +const kD = /* @__PURE__ */ new TextEncoder(); +function Bv(t, e = {}) { + return typeof t == "number" || typeof t == "bigint" ? BD(t, e) : typeof t == "boolean" ? $D(t, e) : ya(t) ? Fo(t, e) : W5(t, e); } -function fD(t, e = {}) { +function $D(t, e = {}) { const r = new Uint8Array(1); - return r[0] = Number(t), typeof e.size == "number" ? (to(r, { size: e.size }), Tu(r, { size: e.size })) : r; + return r[0] = Number(t), typeof e.size == "number" ? (io(r, { size: e.size }), Fu(r, { size: e.size })) : r; } -const go = { +const bo = { zero: 48, nine: 57, A: 65, @@ -1197,106 +1198,152 @@ const go = { a: 97, f: 102 }; -function w2(t) { - if (t >= go.zero && t <= go.nine) - return t - go.zero; - if (t >= go.A && t <= go.F) - return t - (go.A - 10); - if (t >= go.a && t <= go.f) - return t - (go.a - 10); +function N2(t) { + if (t >= bo.zero && t <= bo.nine) + return t - bo.zero; + if (t >= bo.A && t <= bo.F) + return t - (bo.A - 10); + if (t >= bo.a && t <= bo.f) + return t - (bo.a - 10); } -function Lo(t, e = {}) { +function Fo(t, e = {}) { let r = t; - e.size && (to(r, { size: e.size }), r = Tu(r, { dir: "right", size: e.size })); + e.size && (io(r, { size: e.size }), r = Fu(r, { dir: "right", size: e.size })); let n = r.slice(2); n.length % 2 && (n = `0${n}`); const i = n.length / 2, s = new Uint8Array(i); for (let o = 0, a = 0; o < i; o++) { - const u = w2(n.charCodeAt(a++)), l = w2(n.charCodeAt(a++)); + const u = N2(n.charCodeAt(a++)), l = N2(n.charCodeAt(a++)); if (u === void 0 || l === void 0) - throw new yt(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`); + throw new gt(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`); s[o] = u * 16 + l; } return s; } -function lD(t, e) { - const r = Mr(t, e); - return Lo(r); +function BD(t, e) { + const r = vr(t, e); + return Fo(r); } -function M5(t, e = {}) { - const r = uD.encode(t); - return typeof e.size == "number" ? (to(r, { size: e.size }), Tu(r, { dir: "right", size: e.size })) : r; +function W5(t, e = {}) { + const r = kD.encode(t); + return typeof e.size == "number" ? (io(r, { size: e.size }), Fu(r, { dir: "right", size: e.size })) : r; } -function Wd(t) { - if (!Number.isSafeInteger(t) || t < 0) - throw new Error(`positive integer expected, not ${t}`); +const ld = /* @__PURE__ */ BigInt(2 ** 32 - 1), L2 = /* @__PURE__ */ BigInt(32); +function FD(t, e = !1) { + return e ? { h: Number(t & ld), l: Number(t >> L2 & ld) } : { h: Number(t >> L2 & ld) | 0, l: Number(t & ld) | 0 }; +} +function jD(t, e = !1) { + const r = t.length; + let n = new Uint32Array(r), i = new Uint32Array(r); + for (let s = 0; s < r; s++) { + const { h: o, l: a } = FD(t[s], e); + [n[s], i[s]] = [o, a]; + } + return [n, i]; } -function hD(t) { - return t instanceof Uint8Array || t != null && typeof t == "object" && t.constructor.name === "Uint8Array"; +const UD = (t, e, r) => t << r | e >>> 32 - r, qD = (t, e, r) => e << r | t >>> 32 - r, zD = (t, e, r) => e << r - 32 | t >>> 64 - r, WD = (t, e, r) => t << r - 32 | e >>> 64 - r, Zc = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0; +/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +function HD(t) { + return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array"; +} +function r0(t) { + if (!Number.isSafeInteger(t) || t < 0) + throw new Error("positive integer expected, got " + t); } -function Ll(t, ...e) { - if (!hD(t)) +function mc(t, ...e) { + if (!HD(t)) throw new Error("Uint8Array expected"); - if (e.length > 0 && !e.includes(t.length)) - throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`); + e.length > 0; } -function mse(t) { +function Yse(t) { if (typeof t != "function" || typeof t.create != "function") - throw new Error("Hash should be wrapped by utils.wrapConstructor"); - Wd(t.outputLen), Wd(t.blockLen); + throw new Error("Hash should be wrapped by utils.createHasher"); + r0(t.outputLen), r0(t.blockLen); } -function Hd(t, e = !0) { +function n0(t, e = !0) { if (t.destroyed) throw new Error("Hash instance has been destroyed"); if (e && t.finished) throw new Error("Hash#digest() has already been called"); } -function I5(t, e) { - Ll(t); +function H5(t, e) { + mc(t); const r = e.outputLen; if (t.length < r) - throw new Error(`digestInto() expects output buffer of length at least ${r}`); + throw new Error("digestInto() expects output buffer of length at least " + r); } -const rd = /* @__PURE__ */ BigInt(2 ** 32 - 1), x2 = /* @__PURE__ */ BigInt(32); -function dD(t, e = !1) { - return e ? { h: Number(t & rd), l: Number(t >> x2 & rd) } : { h: Number(t >> x2 & rd) | 0, l: Number(t & rd) | 0 }; +function KD(t) { + return new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)); } -function pD(t, e = !1) { - let r = new Uint32Array(t.length), n = new Uint32Array(t.length); - for (let i = 0; i < t.length; i++) { - const { h: s, l: o } = dD(t[i], e); - [r[i], n[i]] = [s, o]; - } - return [r, n]; +function al(...t) { + for (let e = 0; e < t.length; e++) + t[e].fill(0); } -const gD = (t, e, r) => t << r | e >>> 32 - r, mD = (t, e, r) => e << r | t >>> 32 - r, vD = (t, e, r) => e << r - 32 | t >>> 64 - r, bD = (t, e, r) => t << r - 32 | e >>> 64 - r, qc = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0; -/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -const yD = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), Bg = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), Ns = (t, e) => t << 32 - e | t >>> e, _2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, wD = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255; -function E2(t) { +function Zg(t) { + return new DataView(t.buffer, t.byteOffset, t.byteLength); +} +function $s(t, e) { + return t << 32 - e | t >>> e; +} +const VD = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68; +function GD(t) { + return t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255; +} +function YD(t) { for (let e = 0; e < t.length; e++) - t[e] = wD(t[e]); + t[e] = GD(t[e]); + return t; } -const xD = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); -function _D(t) { - Ll(t); +const k2 = VD ? (t) => t : YD, K5 = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", JD = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); +function XD(t) { + if (mc(t), K5) + return t.toHex(); let e = ""; for (let r = 0; r < t.length; r++) - e += xD[t[r]]; + e += JD[t[r]]; return e; } -function ED(t) { +const yo = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 }; +function $2(t) { + if (t >= yo._0 && t <= yo._9) + return t - yo._0; + if (t >= yo.A && t <= yo.F) + return t - (yo.A - 10); + if (t >= yo.a && t <= yo.f) + return t - (yo.a - 10); +} +function Jse(t) { if (typeof t != "string") - throw new Error(`utf8ToBytes expected string, got ${typeof t}`); + throw new Error("hex string expected, got " + typeof t); + if (K5) + return Uint8Array.fromHex(t); + const e = t.length, r = e / 2; + if (e % 2) + throw new Error("hex string expected, got unpadded hex of length " + e); + const n = new Uint8Array(r); + for (let i = 0, s = 0; i < r; i++, s += 2) { + const o = $2(t.charCodeAt(s)), a = $2(t.charCodeAt(s + 1)); + if (o === void 0 || a === void 0) { + const u = t[s] + t[s + 1]; + throw new Error('hex string expected, got non-hex character "' + u + '" at index ' + s); + } + n[i] = o * 16 + a; + } + return n; +} +function ZD(t) { + if (typeof t != "string") + throw new Error("string expected"); return new Uint8Array(new TextEncoder().encode(t)); } -function C0(t) { - return typeof t == "string" && (t = ED(t)), Ll(t), t; +function q0(t) { + return typeof t == "string" && (t = ZD(t)), mc(t), t; } -function vse(...t) { +function Xse(...t) { let e = 0; for (let n = 0; n < t.length; n++) { const i = t[n]; - Ll(i), e += i.length; + mc(i), e += i.length; } const r = new Uint8Array(e); for (let n = 0, i = 0; n < t.length; n++) { @@ -1305,49 +1352,45 @@ function vse(...t) { } return r; } -class C5 { - // Safe version that clones internal state - clone() { - return this._cloneInto(); - } +class V5 { } -function T5(t) { - const e = (n) => t().update(C0(n)).digest(), r = t(); +function G5(t) { + const e = (n) => t().update(q0(n)).digest(), r = t(); return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = () => t(), e; } -function SD(t) { - const e = (n, i) => t(i).update(C0(n)).digest(), r = t({}); +function QD(t) { + const e = (n, i) => t(i).update(q0(n)).digest(), r = t({}); return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = (n) => t(n), e; } -function bse(t = 32) { - if (qc && typeof qc.getRandomValues == "function") - return qc.getRandomValues(new Uint8Array(t)); - if (qc && typeof qc.randomBytes == "function") - return qc.randomBytes(t); +function Zse(t = 32) { + if (Zc && typeof Zc.getRandomValues == "function") + return Zc.getRandomValues(new Uint8Array(t)); + if (Zc && typeof Zc.randomBytes == "function") + return Uint8Array.from(Zc.randomBytes(t)); throw new Error("crypto.getRandomValues must be defined"); } -const R5 = [], D5 = [], O5 = [], AD = /* @__PURE__ */ BigInt(0), yf = /* @__PURE__ */ BigInt(1), PD = /* @__PURE__ */ BigInt(2), MD = /* @__PURE__ */ BigInt(7), ID = /* @__PURE__ */ BigInt(256), CD = /* @__PURE__ */ BigInt(113); -for (let t = 0, e = yf, r = 1, n = 0; t < 24; t++) { - [r, n] = [n, (2 * r + 3 * n) % 5], R5.push(2 * (5 * n + r)), D5.push((t + 1) * (t + 2) / 2 % 64); - let i = AD; +const eO = BigInt(0), Pf = BigInt(1), tO = BigInt(2), rO = BigInt(7), nO = BigInt(256), iO = BigInt(113), Y5 = [], J5 = [], X5 = []; +for (let t = 0, e = Pf, r = 1, n = 0; t < 24; t++) { + [r, n] = [n, (2 * r + 3 * n) % 5], Y5.push(2 * (5 * n + r)), J5.push((t + 1) * (t + 2) / 2 % 64); + let i = eO; for (let s = 0; s < 7; s++) - e = (e << yf ^ (e >> MD) * CD) % ID, e & PD && (i ^= yf << (yf << /* @__PURE__ */ BigInt(s)) - yf); - O5.push(i); + e = (e << Pf ^ (e >> rO) * iO) % nO, e & tO && (i ^= Pf << (Pf << /* @__PURE__ */ BigInt(s)) - Pf); + X5.push(i); } -const [TD, RD] = /* @__PURE__ */ pD(O5, !0), S2 = (t, e, r) => r > 32 ? vD(t, e, r) : gD(t, e, r), A2 = (t, e, r) => r > 32 ? bD(t, e, r) : mD(t, e, r); -function N5(t, e = 24) { +const Z5 = jD(X5, !0), sO = Z5[0], oO = Z5[1], B2 = (t, e, r) => r > 32 ? zD(t, e, r) : UD(t, e, r), F2 = (t, e, r) => r > 32 ? WD(t, e, r) : qD(t, e, r); +function Q5(t, e = 24) { const r = new Uint32Array(10); for (let n = 24 - e; n < 24; n++) { for (let o = 0; o < 10; o++) r[o] = t[o] ^ t[o + 10] ^ t[o + 20] ^ t[o + 30] ^ t[o + 40]; for (let o = 0; o < 10; o += 2) { - const a = (o + 8) % 10, u = (o + 2) % 10, l = r[u], d = r[u + 1], p = S2(l, d, 1) ^ r[a], w = A2(l, d, 1) ^ r[a + 1]; - for (let A = 0; A < 50; A += 10) - t[o + A] ^= p, t[o + A + 1] ^= w; + const a = (o + 8) % 10, u = (o + 2) % 10, l = r[u], d = r[u + 1], p = B2(l, d, 1) ^ r[a], w = F2(l, d, 1) ^ r[a + 1]; + for (let _ = 0; _ < 50; _ += 10) + t[o + _] ^= p, t[o + _ + 1] ^= w; } let i = t[2], s = t[3]; for (let o = 0; o < 24; o++) { - const a = D5[o], u = S2(i, s, a), l = A2(i, s, a), d = R5[o]; + const a = J5[o], u = B2(i, s, a), l = F2(i, s, a), d = Y5[o]; i = t[d], s = t[d + 1], t[d] = u, t[d + 1] = l; } for (let o = 0; o < 50; o += 10) { @@ -1356,25 +1399,26 @@ function N5(t, e = 24) { for (let a = 0; a < 10; a++) t[o + a] ^= ~r[(a + 2) % 10] & r[(a + 4) % 10]; } - t[0] ^= TD[n], t[1] ^= RD[n]; + t[0] ^= sO[n], t[1] ^= oO[n]; } - r.fill(0); + al(r); } -class kl extends C5 { +class Kl extends V5 { // NOTE: we accept arguments in bytes instead of bits here. constructor(e, r, n, i = !1, s = 24) { - if (super(), this.blockLen = e, this.suffix = r, this.outputLen = n, this.enableXOF = i, this.rounds = s, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, Wd(n), 0 >= this.blockLen || this.blockLen >= 200) - throw new Error("Sha3 supports only keccak-f1600 function"); - this.state = new Uint8Array(200), this.state32 = yD(this.state); + if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = r, this.outputLen = n, this.enableXOF = i, this.rounds = s, r0(n), !(0 < e && e < 200)) + throw new Error("only keccak-f1600 function is supported"); + this.state = new Uint8Array(200), this.state32 = KD(this.state); + } + clone() { + return this._cloneInto(); } keccak() { - _2 || E2(this.state32), N5(this.state32, this.rounds), _2 || E2(this.state32), this.posOut = 0, this.pos = 0; + k2(this.state32), Q5(this.state32, this.rounds), k2(this.state32), this.posOut = 0, this.pos = 0; } update(e) { - Hd(this); - const { blockLen: r, state: n } = this; - e = C0(e); - const i = e.length; + n0(this), e = q0(e), mc(e); + const { blockLen: r, state: n } = this, i = e.length; for (let s = 0; s < i; ) { const o = Math.min(r - this.pos, i - s); for (let a = 0; a < o; a++) @@ -1391,7 +1435,7 @@ class kl extends C5 { e[n] ^= r, r & 128 && n === i - 1 && this.keccak(), e[i - 1] ^= 128, this.keccak(); } writeInto(e) { - Hd(this, !1), Ll(e), this.finish(); + n0(this, !1), mc(e), this.finish(); const r = this.state, { blockLen: n } = this; for (let i = 0, s = e.length; i < s; ) { this.posOut >= n && this.keccak(); @@ -1406,10 +1450,10 @@ class kl extends C5 { return this.writeInto(e); } xof(e) { - return Wd(e), this.xofInto(new Uint8Array(e)); + return r0(e), this.xofInto(new Uint8Array(e)); } digestInto(e) { - if (I5(e, this), this.finished) + if (H5(e, this), this.finished) throw new Error("digest() was already called"); return this.writeInto(e), this.destroy(), e; } @@ -1417,37 +1461,37 @@ class kl extends C5 { return this.digestInto(new Uint8Array(this.outputLen)); } destroy() { - this.destroyed = !0, this.state.fill(0); + this.destroyed = !0, al(this.state); } _cloneInto(e) { const { blockLen: r, suffix: n, outputLen: i, rounds: s, enableXOF: o } = this; - return e || (e = new kl(r, n, i, o, s)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = s, e.suffix = n, e.outputLen = i, e.enableXOF = o, e.destroyed = this.destroyed, e; + return e || (e = new Kl(r, n, i, o, s)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = s, e.suffix = n, e.outputLen = i, e.enableXOF = o, e.destroyed = this.destroyed, e; } } -const Aa = (t, e, r) => T5(() => new kl(e, t, r)), DD = /* @__PURE__ */ Aa(6, 144, 224 / 8), OD = /* @__PURE__ */ Aa(6, 136, 256 / 8), ND = /* @__PURE__ */ Aa(6, 104, 384 / 8), LD = /* @__PURE__ */ Aa(6, 72, 512 / 8), kD = /* @__PURE__ */ Aa(1, 144, 224 / 8), L5 = /* @__PURE__ */ Aa(1, 136, 256 / 8), $D = /* @__PURE__ */ Aa(1, 104, 384 / 8), BD = /* @__PURE__ */ Aa(1, 72, 512 / 8), k5 = (t, e, r) => SD((n = {}) => new kl(e, t, n.dkLen === void 0 ? r : n.dkLen, !0)), FD = /* @__PURE__ */ k5(31, 168, 128 / 8), jD = /* @__PURE__ */ k5(31, 136, 256 / 8), UD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +const Ra = (t, e, r) => G5(() => new Kl(e, t, r)), aO = Ra(6, 144, 224 / 8), cO = Ra(6, 136, 256 / 8), uO = Ra(6, 104, 384 / 8), fO = Ra(6, 72, 512 / 8), lO = Ra(1, 144, 224 / 8), e4 = Ra(1, 136, 256 / 8), hO = Ra(1, 104, 384 / 8), dO = Ra(1, 72, 512 / 8), t4 = (t, e, r) => QD((n = {}) => new Kl(e, t, n.dkLen === void 0 ? r : n.dkLen, !0)), pO = t4(31, 168, 128 / 8), gO = t4(31, 136, 256 / 8), mO = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - Keccak: kl, - keccakP: N5, - keccak_224: kD, - keccak_256: L5, - keccak_384: $D, - keccak_512: BD, - sha3_224: DD, - sha3_256: OD, - sha3_384: ND, - sha3_512: LD, - shake128: FD, - shake256: jD + Keccak: Kl, + keccakP: Q5, + keccak_224: lO, + keccak_256: e4, + keccak_384: hO, + keccak_512: dO, + sha3_224: aO, + sha3_256: cO, + sha3_384: uO, + sha3_512: fO, + shake128: pO, + shake256: gO }, Symbol.toStringTag, { value: "Module" })); -function $l(t, e) { - const r = e || "hex", n = L5(va(t, { strict: !1 }) ? Ev(t) : t); - return r === "bytes" ? n : zd(n); +function z0(t, e) { + const r = e || "hex", n = e4(ya(t, { strict: !1 }) ? Bv(t) : t); + return r === "bytes" ? n : t0(n); } -const qD = (t) => $l(Ev(t)); -function zD(t) { - return qD(t); +const vO = (t) => z0(Bv(t)); +function bO(t) { + return vO(t); } -function WD(t) { +function yO(t) { let e = !0, r = "", n = 0, i = "", s = !1; for (let o = 0; o < t.length; o++) { const a = t[o]; @@ -1469,18 +1513,18 @@ function WD(t) { } } if (!s) - throw new yt("Unable to normalize signature."); + throw new gt("Unable to normalize signature."); return i; } -const HD = (t) => { - const e = typeof t == "string" ? t : WR(t); - return WD(e); +const wO = (t) => { + const e = typeof t == "string" ? t : bD(t); + return yO(e); }; -function $5(t) { - return zD(HD(t)); +function r4(t) { + return bO(wO(t)); } -const KD = $5; -class yu extends yt { +const xO = r4; +class _a extends gt { constructor({ address: e }) { super(`Address "${e}" is invalid.`, { metaMessages: [ @@ -1491,7 +1535,7 @@ class yu extends yt { }); } } -class T0 extends Map { +class W0 extends Map { constructor(e) { super(), Object.defineProperty(this, "maxSize", { enumerable: !0, @@ -1512,33 +1556,33 @@ class T0 extends Map { return this; } } -const Fg = /* @__PURE__ */ new T0(8192); -function Bl(t, e) { - if (Fg.has(`${t}.${e}`)) - return Fg.get(`${t}.${e}`); - const r = t.substring(2).toLowerCase(), n = $l(M5(r), "bytes"), i = r.split(""); +const Qg = /* @__PURE__ */ new W0(8192); +function Vl(t, e) { + if (Qg.has(`${t}.${e}`)) + return Qg.get(`${t}.${e}`); + const r = t.substring(2).toLowerCase(), n = z0(W5(r), "bytes"), i = r.split(""); for (let o = 0; o < 40; o += 2) n[o >> 1] >> 4 >= 8 && i[o] && (i[o] = i[o].toUpperCase()), (n[o >> 1] & 15) >= 8 && i[o + 1] && (i[o + 1] = i[o + 1].toUpperCase()); const s = `0x${i.join("")}`; - return Fg.set(`${t}.${e}`, s), s; + return Qg.set(`${t}.${e}`, s), s; } -function Sv(t, e) { - if (!ko(t, { strict: !1 })) - throw new yu({ address: t }); - return Bl(t, e); +function Fv(t, e) { + if (!Ms(t, { strict: !1 })) + throw new _a({ address: t }); + return Vl(t, e); } -const VD = /^0x[a-fA-F0-9]{40}$/, jg = /* @__PURE__ */ new T0(8192); -function ko(t, e) { +const _O = /^0x[a-fA-F0-9]{40}$/, em = /* @__PURE__ */ new W0(8192); +function Ms(t, e) { const { strict: r = !0 } = e ?? {}, n = `${t}.${r}`; - if (jg.has(n)) - return jg.get(n); - const i = VD.test(t) ? t.toLowerCase() === t ? !0 : r ? Bl(t) === t : !0 : !1; - return jg.set(n, i), i; + if (em.has(n)) + return em.get(n); + const i = _O.test(t) ? t.toLowerCase() === t ? !0 : r ? Vl(t) === t : !0 : !1; + return em.set(n, i), i; } -function wu(t) { - return typeof t[0] == "string" ? R0(t) : GD(t); +function Ea(t) { + return typeof t[0] == "string" ? H0(t) : EO(t); } -function GD(t) { +function EO(t) { let e = 0; for (const i of t) e += i.length; @@ -1548,111 +1592,115 @@ function GD(t) { r.set(i, n), n += i.length; return r; } -function R0(t) { +function H0(t) { return `0x${t.reduce((e, r) => e + r.replace("0x", ""), "")}`; } -function Kd(t, e, r, { strict: n } = {}) { - return va(t, { strict: !1 }) ? YD(t, e, r, { +function i0(t, e, r, { strict: n } = {}) { + return ya(t, { strict: !1 }) ? l1(t, e, r, { strict: n - }) : j5(t, e, r, { + }) : s4(t, e, r, { strict: n }); } -function B5(t, e) { - if (typeof e == "number" && e > 0 && e > An(t) - 1) - throw new S5({ +function n4(t, e) { + if (typeof e == "number" && e > 0 && e > xn(t) - 1) + throw new j5({ offset: e, position: "start", - size: An(t) + size: xn(t) }); } -function F5(t, e, r) { - if (typeof e == "number" && typeof r == "number" && An(t) !== r - e) - throw new S5({ +function i4(t, e, r) { + if (typeof e == "number" && typeof r == "number" && xn(t) !== r - e) + throw new j5({ offset: r, position: "end", - size: An(t) + size: xn(t) }); } -function j5(t, e, r, { strict: n } = {}) { - B5(t, e); +function s4(t, e, r, { strict: n } = {}) { + n4(t, e); const i = t.slice(e, r); - return n && F5(i, e, r), i; + return n && i4(i, e, r), i; } -function YD(t, e, r, { strict: n } = {}) { - B5(t, e); +function l1(t, e, r, { strict: n } = {}) { + n4(t, e); const i = `0x${t.replace("0x", "").slice((e ?? 0) * 2, (r ?? t.length) * 2)}`; - return n && F5(i, e, r), i; + return n && i4(i, e, r), i; } -function U5(t, e) { +const SO = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, o4 = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/; +function a4(t, e) { if (t.length !== e.length) - throw new JR({ + throw new SD({ expectedLength: t.length, givenLength: e.length }); - const r = JD({ + const r = AO({ params: t, values: e - }), n = Pv(r); + }), n = Uv(r); return n.length === 0 ? "0x" : n; } -function JD({ params: t, values: e }) { +function AO({ params: t, values: e }) { const r = []; for (let n = 0; n < t.length; n++) - r.push(Av({ param: t[n], value: e[n] })); + r.push(jv({ param: t[n], value: e[n] })); return r; } -function Av({ param: t, value: e }) { - const r = Mv(t.type); +function jv({ param: t, value: e }) { + const r = qv(t.type); if (r) { const [n, i] = r; - return ZD(e, { length: n, param: { ...t, type: i } }); + return MO(e, { length: n, param: { ...t, type: i } }); } if (t.type === "tuple") - return nO(e, { + return DO(e, { param: t }); if (t.type === "address") - return XD(e); + return PO(e); if (t.type === "bool") - return eO(e); + return CO(e); if (t.type.startsWith("uint") || t.type.startsWith("int")) { - const n = t.type.startsWith("int"); - return tO(e, { signed: n }); + const n = t.type.startsWith("int"), [, , i = "256"] = o4.exec(t.type) ?? []; + return TO(e, { + signed: n, + size: Number(i) + }); } if (t.type.startsWith("bytes")) - return QD(e, { param: t }); + return IO(e, { param: t }); if (t.type === "string") - return rO(e); - throw new QR(t.type, { + return RO(e); + throw new MD(t.type, { docsPath: "/docs/contract/encodeAbiParameters" }); } -function Pv(t) { +function Uv(t) { let e = 0; for (let s = 0; s < t.length; s++) { const { dynamic: o, encoded: a } = t[s]; - o ? e += 32 : e += An(a); + o ? e += 32 : e += xn(a); } const r = [], n = []; let i = 0; for (let s = 0; s < t.length; s++) { const { dynamic: o, encoded: a } = t[s]; - o ? (r.push(Mr(e + i, { size: 32 })), n.push(a), i += An(a)) : r.push(a); + o ? (r.push(vr(e + i, { size: 32 })), n.push(a), i += xn(a)) : r.push(a); } - return wu([...r, ...n]); + return Ea([...r, ...n]); } -function XD(t) { - if (!ko(t)) - throw new yu({ address: t }); - return { dynamic: !1, encoded: ma(t.toLowerCase()) }; +function PO(t) { + if (!Ms(t)) + throw new _a({ address: t }); + return { dynamic: !1, encoded: ba(t.toLowerCase()) }; } -function ZD(t, { length: e, param: r }) { +function MO(t, { length: e, param: r }) { const n = e === null; if (!Array.isArray(t)) - throw new tD(t); + throw new CD(t); if (!n && t.length !== e) - throw new GR({ + throw new _D({ expectedLength: e, givenLength: t.length, type: `${r.type}[${e}]` @@ -1660,16 +1708,16 @@ function ZD(t, { length: e, param: r }) { let i = !1; const s = []; for (let o = 0; o < t.length; o++) { - const a = Av({ param: r, value: t[o] }); + const a = jv({ param: r, value: t[o] }); a.dynamic && (i = !0), s.push(a); } if (n || i) { - const o = Pv(s); + const o = Uv(s); if (n) { - const a = Mr(s.length, { size: 32 }); + const a = vr(s.length, { size: 32 }); return { dynamic: !0, - encoded: s.length > 0 ? wu([a, o]) : a + encoded: s.length > 0 ? Ea([a, o]) : a }; } if (i) @@ -1677,61 +1725,72 @@ function ZD(t, { length: e, param: r }) { } return { dynamic: !1, - encoded: wu(s.map(({ encoded: o }) => o)) + encoded: Ea(s.map(({ encoded: o }) => o)) }; } -function QD(t, { param: e }) { - const [, r] = e.type.split("bytes"), n = An(t); +function IO(t, { param: e }) { + const [, r] = e.type.split("bytes"), n = xn(t); if (!r) { let i = t; - return n % 32 !== 0 && (i = ma(i, { + return n % 32 !== 0 && (i = ba(i, { dir: "right", size: Math.ceil((t.length - 2) / 2 / 32) * 32 })), { dynamic: !0, - encoded: wu([ma(Mr(n, { size: 32 })), i]) + encoded: Ea([ba(vr(n, { size: 32 })), i]) }; } if (n !== Number.parseInt(r)) - throw new YR({ + throw new ED({ expectedSize: Number.parseInt(r), value: t }); - return { dynamic: !1, encoded: ma(t, { dir: "right" }) }; + return { dynamic: !1, encoded: ba(t, { dir: "right" }) }; } -function eO(t) { +function CO(t) { if (typeof t != "boolean") - throw new yt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`); - return { dynamic: !1, encoded: ma(P5(t)) }; -} -function tO(t, { signed: e }) { + throw new gt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`); + return { dynamic: !1, encoded: ba(z5(t)) }; +} +function TO(t, { signed: e, size: r = 256 }) { + if (typeof r == "number") { + const n = 2n ** (BigInt(r) - (e ? 1n : 0n)) - 1n, i = e ? -n - 1n : 0n; + if (t > n || t < i) + throw new q5({ + max: n.toString(), + min: i.toString(), + signed: e, + size: r / 8, + value: t.toString() + }); + } return { dynamic: !1, - encoded: Mr(t, { + encoded: vr(t, { size: 32, signed: e }) }; } -function rO(t) { - const e = I0(t), r = Math.ceil(An(e) / 32), n = []; +function RO(t) { + const e = U0(t), r = Math.ceil(xn(e) / 32), n = []; for (let i = 0; i < r; i++) - n.push(ma(Kd(e, i * 32, (i + 1) * 32), { + n.push(ba(i0(e, i * 32, (i + 1) * 32), { dir: "right" })); return { dynamic: !0, - encoded: wu([ - ma(Mr(An(e), { size: 32 })), + encoded: Ea([ + ba(vr(xn(e), { size: 32 })), ...n ]) }; } -function nO(t, { param: e }) { +function DO(t, { param: e }) { let r = !1; const n = []; for (let i = 0; i < e.components.length; i++) { - const s = e.components[i], o = Array.isArray(t) ? i : s.name, a = Av({ + const s = e.components[i], o = Array.isArray(t) ? i : s.name, a = jv({ param: s, value: t[o] }); @@ -1739,19 +1798,19 @@ function nO(t, { param: e }) { } return { dynamic: r, - encoded: r ? Pv(n) : wu(n.map(({ encoded: i }) => i)) + encoded: r ? Uv(n) : Ea(n.map(({ encoded: i }) => i)) }; } -function Mv(t) { +function qv(t) { const e = t.match(/^(.*)\[(\d+)?\]$/); return e ? ( // Return `null` if the array is dynamic. [e[2] ? Number(e[2]) : null, e[1]] ) : void 0; } -const Iv = (t) => Kd($5(t), 0, 4); -function q5(t) { - const { abi: e, args: r = [], name: n } = t, i = va(n, { strict: !1 }), s = e.filter((a) => i ? a.type === "function" ? Iv(a) === n : a.type === "event" ? KD(a) === n : !1 : "name" in a && a.name === n); +const zv = (t) => i0(r4(t), 0, 4); +function c4(t) { + const { abi: e, args: r = [], name: n } = t, i = ya(n, { strict: !1 }), s = e.filter((a) => i ? a.type === "function" ? zv(a) === n : a.type === "event" ? xO(a) === n : !1 : "name" in a && a.name === n); if (s.length === 0) return; if (s.length === 1) @@ -1769,12 +1828,12 @@ function q5(t) { continue; if (r.every((l, d) => { const p = "inputs" in a && a.inputs[d]; - return p ? Xm(l, p) : !1; + return p ? h1(l, p) : !1; })) { if (o && "inputs" in o && o.inputs) { - const l = z5(a.inputs, o.inputs, r); + const l = u4(a.inputs, o.inputs, r); if (l) - throw new XR({ + throw new AD({ abiItem: a, type: l[0] }, { @@ -1787,11 +1846,11 @@ function q5(t) { } return o || s[0]; } -function Xm(t, e) { +function h1(t, e) { const r = typeof t, n = e.type; switch (n) { case "address": - return ko(t, { strict: !1 }); + return Ms(t, { strict: !1 }); case "bool": return r === "boolean"; case "function": @@ -1799,55 +1858,55 @@ function Xm(t, e) { case "string": return r === "string"; default: - return n === "tuple" && "components" in e ? Object.values(e.components).every((i, s) => Xm(Object.values(t)[s], i)) : /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n) ? r === "number" || r === "bigint" : /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n) ? r === "string" || t instanceof Uint8Array : /[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n) ? Array.isArray(t) && t.every((i) => Xm(i, { + return n === "tuple" && "components" in e ? Object.values(e.components).every((i, s) => h1(Object.values(t)[s], i)) : /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n) ? r === "number" || r === "bigint" : /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n) ? r === "string" || t instanceof Uint8Array : /[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n) ? Array.isArray(t) && t.every((i) => h1(i, { ...e, // Pop off `[]` or `[M]` from end of type type: n.replace(/(\[[0-9]{0,}\])$/, "") })) : !1; } } -function z5(t, e, r) { +function u4(t, e, r) { for (const n in t) { const i = t[n], s = e[n]; if (i.type === "tuple" && s.type === "tuple" && "components" in i && "components" in s) - return z5(i.components, s.components, r[n]); + return u4(i.components, s.components, r[n]); const o = [i.type, s.type]; - if (o.includes("address") && o.includes("bytes20") ? !0 : o.includes("address") && o.includes("string") ? ko(r[n], { strict: !1 }) : o.includes("address") && o.includes("bytes") ? ko(r[n], { strict: !1 }) : !1) + if (o.includes("address") && o.includes("bytes20") ? !0 : o.includes("address") && o.includes("string") ? Ms(r[n], { strict: !1 }) : o.includes("address") && o.includes("bytes") ? Ms(r[n], { strict: !1 }) : !1) return o; } } -function qo(t) { +function _i(t) { return typeof t == "string" ? { address: t, type: "json-rpc" } : t; } -const P2 = "/docs/contract/encodeFunctionData"; -function iO(t) { +const j2 = "/docs/contract/encodeFunctionData"; +function OO(t) { const { abi: e, args: r, functionName: n } = t; let i = e[0]; if (n) { - const s = q5({ + const s = c4({ abi: e, args: r, name: n }); if (!s) - throw new b2(n, { docsPath: P2 }); + throw new D2(n, { docsPath: j2 }); i = s; } if (i.type !== "function") - throw new b2(void 0, { docsPath: P2 }); + throw new D2(void 0, { docsPath: j2 }); return { abi: [i], - functionName: Iv(vu(i)) + functionName: zv(Mu(i)) }; } -function sO(t) { +function f4(t) { const { args: e } = t, { abi: r, functionName: n } = (() => { var a; - return t.abi.length === 1 && ((a = t.functionName) != null && a.startsWith("0x")) ? t : iO(t); - })(), i = r[0], s = n, o = "inputs" in i && i.inputs ? U5(i.inputs, e ?? []) : void 0; - return R0([s, o ?? "0x"]); + return t.abi.length === 1 && ((a = t.functionName) != null && a.startsWith("0x")) ? t : OO(t); + })(), i = r[0], s = n, o = "inputs" in i && i.inputs ? a4(i.inputs, e ?? []) : void 0; + return H0([s, o ?? "0x"]); } -const oO = { +const NO = { 1: "An `assert` condition failed.", 17: "Arithmetic operation resulted in underflow or overflow.", 18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).", @@ -1857,7 +1916,7 @@ const oO = { 50: "Array index is out of bounds.", 65: "Allocated too much memory or created an array which is too large.", 81: "Attempted to call a zero-initialized variable of internal function type." -}, aO = { +}, LO = { inputs: [ { name: "message", @@ -1866,7 +1925,7 @@ const oO = { ], name: "Error", type: "error" -}, cO = { +}, kO = { inputs: [ { name: "reason", @@ -1876,24 +1935,24 @@ const oO = { name: "Panic", type: "error" }; -class M2 extends yt { +class U2 extends gt { constructor({ offset: e }) { super(`Offset \`${e}\` cannot be negative.`, { name: "NegativeOffsetError" }); } } -class uO extends yt { +class $O extends gt { constructor({ length: e, position: r }) { super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`, { name: "PositionOutOfBoundsError" }); } } -class fO extends yt { +class BO extends gt { constructor({ count: e, limit: r }) { super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`, { name: "RecursiveReadLimitExceededError" }); } } -const lO = { +const FO = { bytes: new Uint8Array(), dataView: new DataView(new ArrayBuffer(0)), position: 0, @@ -1902,21 +1961,21 @@ const lO = { recursiveReadLimit: Number.POSITIVE_INFINITY, assertReadLimit() { if (this.recursiveReadCount >= this.recursiveReadLimit) - throw new fO({ + throw new BO({ count: this.recursiveReadCount + 1, limit: this.recursiveReadLimit }); }, assertPosition(t) { if (t < 0 || t > this.bytes.length - 1) - throw new uO({ + throw new $O({ length: this.bytes.length, position: t }); }, decrementPosition(t) { if (t < 0) - throw new M2({ offset: t }); + throw new U2({ offset: t }); const e = this.position - t; this.assertPosition(e), this.position = e; }, @@ -1925,7 +1984,7 @@ const lO = { }, incrementPosition(t) { if (t < 0) - throw new M2({ offset: t }); + throw new U2({ offset: t }); const e = this.position + t; this.assertPosition(e), this.position = e; }, @@ -2015,100 +2074,100 @@ const lO = { this.positionReadCount.set(this.position, t + 1), t > 0 && this.recursiveReadCount++; } }; -function Cv(t, { recursiveReadLimit: e = 8192 } = {}) { - const r = Object.create(lO); +function Wv(t, { recursiveReadLimit: e = 8192 } = {}) { + const r = Object.create(FO); return r.bytes = t, r.dataView = new DataView(t.buffer, t.byteOffset, t.byteLength), r.positionReadCount = /* @__PURE__ */ new Map(), r.recursiveReadLimit = e, r; } -function hO(t, e = {}) { - typeof e.size < "u" && to(t, { size: e.size }); +function jO(t, e = {}) { + typeof e.size < "u" && io(t, { size: e.size }); const r = xi(t, e); - return el(r, e); + return wa(r, e); } -function dO(t, e = {}) { +function UO(t, e = {}) { let r = t; - if (typeof e.size < "u" && (to(r, { size: e.size }), r = _v(r)), r.length > 1 || r[0] > 1) - throw new sD(r); + if (typeof e.size < "u" && (io(r, { size: e.size }), r = j0(r)), r.length > 1 || r[0] > 1) + throw new DD(r); return !!r[0]; } -function Io(t, e = {}) { - typeof e.size < "u" && to(t, { size: e.size }); +function Do(t, e = {}) { + typeof e.size < "u" && io(t, { size: e.size }); const r = xi(t, e); - return bu(r, e); + return xa(r, e); } -function pO(t, e = {}) { +function qO(t, e = {}) { let r = t; - return typeof e.size < "u" && (to(r, { size: e.size }), r = _v(r, { dir: "right" })), new TextDecoder().decode(r); -} -function gO(t, e) { - const r = typeof e == "string" ? Lo(e) : e, n = Cv(r); - if (An(r) === 0 && t.length > 0) - throw new xv(); - if (An(e) && An(e) < 32) - throw new VR({ + return typeof e.size < "u" && (io(r, { size: e.size }), r = j0(r, { dir: "right" })), new TextDecoder().decode(r); +} +function zO(t, e) { + const r = typeof e == "string" ? Fo(e) : e, n = Wv(r); + if (xn(r) === 0 && t.length > 0) + throw new $v(); + if (xn(e) && xn(e) < 32) + throw new xD({ data: typeof e == "string" ? e : xi(e), params: t, - size: An(e) + size: xn(e) }); let i = 0; const s = []; for (let o = 0; o < t.length; ++o) { const a = t[o]; n.setPosition(i); - const [u, l] = au(n, a, { + const [u, l] = vu(n, a, { staticPosition: 0 }); i += l, s.push(u); } return s; } -function au(t, e, { staticPosition: r }) { - const n = Mv(e.type); +function vu(t, e, { staticPosition: r }) { + const n = qv(e.type); if (n) { const [i, s] = n; - return vO(t, { ...e, type: s }, { length: i, staticPosition: r }); + return HO(t, { ...e, type: s }, { length: i, staticPosition: r }); } if (e.type === "tuple") - return xO(t, e, { staticPosition: r }); + return YO(t, e, { staticPosition: r }); if (e.type === "address") - return mO(t); + return WO(t); if (e.type === "bool") - return bO(t); + return KO(t); if (e.type.startsWith("bytes")) - return yO(t, e, { staticPosition: r }); + return VO(t, e, { staticPosition: r }); if (e.type.startsWith("uint") || e.type.startsWith("int")) - return wO(t, e); + return GO(t, e); if (e.type === "string") - return _O(t, { staticPosition: r }); - throw new eD(e.type, { + return JO(t, { staticPosition: r }); + throw new ID(e.type, { docsPath: "/docs/contract/decodeAbiParameters" }); } -const I2 = 32, Zm = 32; -function mO(t) { +const q2 = 32, d1 = 32; +function WO(t) { const e = t.readBytes(32); - return [Bl(xi(j5(e, -20))), 32]; + return [Vl(xi(s4(e, -20))), 32]; } -function vO(t, e, { length: r, staticPosition: n }) { +function HO(t, e, { length: r, staticPosition: n }) { if (!r) { - const o = Io(t.readBytes(Zm)), a = n + o, u = a + I2; + const o = Do(t.readBytes(d1)), a = n + o, u = a + q2; t.setPosition(a); - const l = Io(t.readBytes(I2)), d = tl(e); + const l = Do(t.readBytes(q2)), d = cl(e); let p = 0; const w = []; - for (let A = 0; A < l; ++A) { - t.setPosition(u + (d ? A * 32 : p)); - const [M, N] = au(t, e, { + for (let _ = 0; _ < l; ++_) { + t.setPosition(u + (d ? _ * 32 : p)); + const [P, O] = vu(t, e, { staticPosition: u }); - p += N, w.push(M); + p += O, w.push(P); } return t.setPosition(n + 32), [w, 32]; } - if (tl(e)) { - const o = Io(t.readBytes(Zm)), a = n + o, u = []; + if (cl(e)) { + const o = Do(t.readBytes(d1)), a = n + o, u = []; for (let l = 0; l < r; ++l) { t.setPosition(a + l * 32); - const [d] = au(t, e, { + const [d] = vu(t, e, { staticPosition: a }); u.push(d); @@ -2118,22 +2177,22 @@ function vO(t, e, { length: r, staticPosition: n }) { let i = 0; const s = []; for (let o = 0; o < r; ++o) { - const [a, u] = au(t, e, { + const [a, u] = vu(t, e, { staticPosition: n + i }); i += u, s.push(a); } return [s, i]; } -function bO(t) { - return [dO(t.readBytes(32), { size: 32 }), 32]; +function KO(t) { + return [UO(t.readBytes(32), { size: 32 }), 32]; } -function yO(t, e, { staticPosition: r }) { +function VO(t, e, { staticPosition: r }) { const [n, i] = e.type.split("bytes"); if (!i) { - const o = Io(t.readBytes(32)); + const o = Do(t.readBytes(32)); t.setPosition(r + o); - const a = Io(t.readBytes(32)); + const a = Do(t.readBytes(32)); if (a === 0) return t.setPosition(r + 32), ["0x", 32]; const u = t.readBytes(a); @@ -2141,22 +2200,22 @@ function yO(t, e, { staticPosition: r }) { } return [xi(t.readBytes(Number.parseInt(i), 32)), 32]; } -function wO(t, e) { +function GO(t, e) { const r = e.type.startsWith("int"), n = Number.parseInt(e.type.split("int")[1] || "256"), i = t.readBytes(32); return [ - n > 48 ? hO(i, { signed: r }) : Io(i, { signed: r }), + n > 48 ? jO(i, { signed: r }) : Do(i, { signed: r }), 32 ]; } -function xO(t, e, { staticPosition: r }) { +function YO(t, e, { staticPosition: r }) { const n = e.components.length === 0 || e.components.some(({ name: o }) => !o), i = n ? [] : {}; let s = 0; - if (tl(e)) { - const o = Io(t.readBytes(Zm)), a = r + o; + if (cl(e)) { + const o = Do(t.readBytes(d1)), a = r + o; for (let u = 0; u < e.components.length; ++u) { const l = e.components[u]; t.setPosition(a + s); - const [d, p] = au(t, l, { + const [d, p] = vu(t, l, { staticPosition: a }); s += p, i[n ? u : l == null ? void 0 : l.name] = d; @@ -2164,60 +2223,60 @@ function xO(t, e, { staticPosition: r }) { return t.setPosition(r + 32), [i, 32]; } for (let o = 0; o < e.components.length; ++o) { - const a = e.components[o], [u, l] = au(t, a, { + const a = e.components[o], [u, l] = vu(t, a, { staticPosition: r }); i[n ? o : a == null ? void 0 : a.name] = u, s += l; } return [i, s]; } -function _O(t, { staticPosition: e }) { - const r = Io(t.readBytes(32)), n = e + r; +function JO(t, { staticPosition: e }) { + const r = Do(t.readBytes(32)), n = e + r; t.setPosition(n); - const i = Io(t.readBytes(32)); + const i = Do(t.readBytes(32)); if (i === 0) return t.setPosition(e + 32), ["", 32]; - const s = t.readBytes(i, 32), o = pO(_v(s)); + const s = t.readBytes(i, 32), o = qO(j0(s)); return t.setPosition(e + 32), [o, 32]; } -function tl(t) { +function cl(t) { var n; const { type: e } = t; if (e === "string" || e === "bytes" || e.endsWith("[]")) return !0; if (e === "tuple") - return (n = t.components) == null ? void 0 : n.some(tl); - const r = Mv(t.type); - return !!(r && tl({ ...t, type: r[1] })); + return (n = t.components) == null ? void 0 : n.some(cl); + const r = qv(t.type); + return !!(r && cl({ ...t, type: r[1] })); } -function EO(t) { - const { abi: e, data: r } = t, n = Kd(r, 0, 4); +function XO(t) { + const { abi: e, data: r } = t, n = i0(r, 0, 4); if (n === "0x") - throw new xv(); - const s = [...e || [], aO, cO].find((o) => o.type === "error" && n === Iv(vu(o))); + throw new $v(); + const s = [...e || [], LO, kO].find((o) => o.type === "error" && n === zv(Mu(o))); if (!s) - throw new E5(n, { + throw new F5(n, { docsPath: "/docs/contract/decodeErrorResult" }); return { abiItem: s, - args: "inputs" in s && s.inputs && s.inputs.length > 0 ? gO(s.inputs, Kd(r, 4)) : void 0, + args: "inputs" in s && s.inputs && s.inputs.length > 0 ? zO(s.inputs, i0(r, 4)) : void 0, errorName: s.name }; } -const Ru = (t, e, r) => JSON.stringify(t, (n, i) => typeof i == "bigint" ? i.toString() : i, r); -function W5({ abiItem: t, args: e, includeFunctionName: r = !0, includeName: n = !1 }) { +const Ac = (t, e, r) => JSON.stringify(t, (n, i) => typeof i == "bigint" ? i.toString() : i, r); +function l4({ abiItem: t, args: e, includeFunctionName: r = !0, includeName: n = !1 }) { if ("name" in t && "inputs" in t && t.inputs) - return `${r ? t.name : ""}(${t.inputs.map((i, s) => `${n && i.name ? `${i.name}: ` : ""}${typeof e[s] == "object" ? Ru(e[s]) : e[s]}`).join(", ")})`; + return `${r ? t.name : ""}(${t.inputs.map((i, s) => `${n && i.name ? `${i.name}: ` : ""}${typeof e[s] == "object" ? Ac(e[s]) : e[s]}`).join(", ")})`; } -const SO = { +const ZO = { gwei: 9, wei: 18 -}, AO = { +}, QO = { ether: -9, wei: 9 }; -function H5(t, e) { +function h4(t, e) { let r = t.toString(); const n = r.startsWith("-"); n && (r = r.slice(1)), r = r.padStart(e, "0"); @@ -2227,32 +2286,32 @@ function H5(t, e) { ]; return s = s.replace(/(0+)$/, ""), `${n ? "-" : ""}${i || "0"}${s ? `.${s}` : ""}`; } -function K5(t, e = "wei") { - return H5(t, SO[e]); +function d4(t, e = "wei") { + return h4(t, ZO[e]); } -function Es(t, e = "wei") { - return H5(t, AO[e]); +function Ps(t, e = "wei") { + return h4(t, QO[e]); } -class PO extends yt { +class eN extends gt { constructor({ address: e }) { super(`State for account "${e}" is set multiple times.`, { name: "AccountStateConflictError" }); } } -class MO extends yt { +class tN extends gt { constructor() { super("state and stateDiff are set on the same account.", { name: "StateAssignmentConflictError" }); } } -function D0(t) { +function K0(t) { const e = Object.entries(t).map(([n, i]) => i === void 0 || i === !1 ? null : [n, i]).filter(Boolean), r = e.reduce((n, [i]) => Math.max(n, i.length), 0); return e.map(([n, i]) => ` ${`${n}:`.padEnd(r + 1)} ${i}`).join(` `); } -class IO extends yt { +class rN extends gt { constructor() { super([ "Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.", @@ -2261,13 +2320,13 @@ class IO extends yt { `), { name: "FeeConflictError" }); } } -class CO extends yt { +class nN extends gt { constructor({ transaction: e }) { super("Cannot infer a transaction type from provided transaction.", { metaMessages: [ "Provided Transaction:", "{", - D0(e), + K0(e), "}", "", "To infer the type, either provide:", @@ -2282,19 +2341,19 @@ class CO extends yt { }); } } -class TO extends yt { +class iN extends gt { constructor(e, { account: r, docsPath: n, chain: i, data: s, gas: o, gasPrice: a, maxFeePerGas: u, maxPriorityFeePerGas: l, nonce: d, to: p, value: w }) { - var M; - const A = D0({ + var P; + const _ = K0({ chain: i && `${i == null ? void 0 : i.name} (id: ${i == null ? void 0 : i.id})`, from: r == null ? void 0 : r.address, to: p, - value: typeof w < "u" && `${K5(w)} ${((M = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : M.symbol) || "ETH"}`, + value: typeof w < "u" && `${d4(w)} ${((P = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : P.symbol) || "ETH"}`, data: s, gas: o, - gasPrice: typeof a < "u" && `${Es(a)} gwei`, - maxFeePerGas: typeof u < "u" && `${Es(u)} gwei`, - maxPriorityFeePerGas: typeof l < "u" && `${Es(l)} gwei`, + gasPrice: typeof a < "u" && `${Ps(a)} gwei`, + maxFeePerGas: typeof u < "u" && `${Ps(u)} gwei`, + maxPriorityFeePerGas: typeof l < "u" && `${Ps(l)} gwei`, nonce: d }); super(e.shortMessage, { @@ -2303,7 +2362,7 @@ class TO extends yt { metaMessages: [ ...e.metaMessages ? [...e.metaMessages, " "] : [], "Request Arguments:", - A + _ ].filter(Boolean), name: "TransactionExecutionError" }), Object.defineProperty(this, "cause", { @@ -2314,16 +2373,16 @@ class TO extends yt { }), this.cause = e; } } -const RO = (t) => t, V5 = (t) => t; -class DO extends yt { +const sN = (t) => t, p4 = (t) => t; +class oN extends gt { constructor(e, { abi: r, args: n, contractAddress: i, docsPath: s, functionName: o, sender: a }) { - const u = q5({ abi: r, args: n, name: o }), l = u ? W5({ + const u = c4({ abi: r, args: n, name: o }), l = u ? l4({ abiItem: u, args: n, includeFunctionName: !1, includeName: !1 - }) : void 0, d = u ? vu(u, { includeName: !0 }) : void 0, p = D0({ - address: i && RO(i), + }) : void 0, d = u ? Mu(u, { includeName: !0 }) : void 0, p = K0({ + address: i && sN(i), function: d, args: l && l !== "()" && `${[...Array((o == null ? void 0 : o.length) ?? 0).keys()].map(() => " ").join("")}${l}`, sender: a @@ -2375,28 +2434,28 @@ class DO extends yt { }), this.abi = r, this.args = n, this.cause = e, this.contractAddress = i, this.functionName = o, this.sender = a; } } -class OO extends yt { +class aN extends gt { constructor({ abi: e, data: r, functionName: n, message: i }) { let s, o, a, u; if (r && r !== "0x") try { - o = EO({ abi: e, data: r }); + o = XO({ abi: e, data: r }); const { abiItem: d, errorName: p, args: w } = o; if (p === "Error") u = w[0]; else if (p === "Panic") { - const [A] = w; - u = oO[A]; + const [_] = w; + u = NO[_]; } else { - const A = d ? vu(d, { includeName: !0 }) : void 0, M = d && w ? W5({ + const _ = d ? Mu(d, { includeName: !0 }) : void 0, P = d && w ? l4({ abiItem: d, args: w, includeFunctionName: !1, includeName: !1 }) : void 0; a = [ - A ? `Error: ${A}` : "", - M && M !== "()" ? ` ${[...Array((p == null ? void 0 : p.length) ?? 0).keys()].map(() => " ").join("")}${M}` : "" + _ ? `Error: ${_}` : "", + P && P !== "()" ? ` ${[...Array((p == null ? void 0 : p.length) ?? 0).keys()].map(() => " ").join("")}${P}` : "" ]; } } catch (d) { @@ -2404,7 +2463,7 @@ class OO extends yt { } else i && (u = i); let l; - s instanceof E5 && (l = s.signature, a = [ + s instanceof F5 && (l = s.signature, a = [ `Unable to decode signature "${l}" as it was not found on the provided ABI.`, "Make sure you are using the correct ABI and that the error exists on it.", `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.` @@ -2421,6 +2480,11 @@ class OO extends yt { configurable: !0, writable: !0, value: void 0 + }), Object.defineProperty(this, "raw", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 }), Object.defineProperty(this, "reason", { enumerable: !0, configurable: !0, @@ -2431,10 +2495,10 @@ class OO extends yt { configurable: !0, writable: !0, value: void 0 - }), this.data = o, this.reason = u, this.signature = l; + }), this.data = o, this.raw = r, this.reason = u, this.signature = l; } } -class NO extends yt { +class cN extends gt { constructor({ functionName: e }) { super(`The contract function "${e}" returned no data ("0x").`, { metaMessages: [ @@ -2447,7 +2511,7 @@ class NO extends yt { }); } } -class LO extends yt { +class uN extends gt { constructor({ data: e, message: r }) { super(r || "", { name: "RawContractError" }), Object.defineProperty(this, "code", { enumerable: !0, @@ -2462,15 +2526,15 @@ class LO extends yt { }), this.data = e; } } -class G5 extends yt { +class g4 extends gt { constructor({ body: e, cause: r, details: n, headers: i, status: s, url: o }) { super("HTTP request failed.", { cause: r, details: n, metaMessages: [ s && `Status: ${s}`, - `URL: ${V5(o)}`, - e && `Request body: ${Ru(e)}` + `URL: ${p4(o)}`, + e && `Request body: ${Ac(e)}` ].filter(Boolean), name: "HttpRequestError" }), Object.defineProperty(this, "body", { @@ -2496,23 +2560,28 @@ class G5 extends yt { }), this.body = e, this.headers = i, this.status = s, this.url = o; } } -class kO extends yt { +class m4 extends gt { constructor({ body: e, error: r, url: n }) { super("RPC Request failed.", { cause: r, details: r.message, - metaMessages: [`URL: ${V5(n)}`, `Request body: ${Ru(e)}`], + metaMessages: [`URL: ${p4(n)}`, `Request body: ${Ac(e)}`], name: "RpcRequestError" }), Object.defineProperty(this, "code", { enumerable: !0, configurable: !0, writable: !0, value: void 0 - }), this.code = r.code; + }), Object.defineProperty(this, "data", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), this.code = r.code, this.data = r.data; } } -const $O = -1; -class Si extends yt { +const fN = -1; +class Ai extends gt { constructor(e, { code: r, docsPath: n, metaMessages: i, name: s, shortMessage: o }) { super(o, { cause: e, @@ -2524,10 +2593,10 @@ class Si extends yt { configurable: !0, writable: !0, value: void 0 - }), this.name = s || e.name, this.code = e instanceof kO ? e.code : r ?? $O; + }), this.name = s || e.name, this.code = e instanceof m4 ? e.code : r ?? fN; } } -class Du extends Si { +class $i extends Ai { constructor(e, r) { super(e, r), Object.defineProperty(this, "data", { enumerable: !0, @@ -2537,55 +2606,55 @@ class Du extends Si { }), this.data = r.data; } } -class rl extends Si { +class ul extends Ai { constructor(e) { super(e, { - code: rl.code, + code: ul.code, name: "ParseRpcError", shortMessage: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text." }); } } -Object.defineProperty(rl, "code", { +Object.defineProperty(ul, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32700 }); -class nl extends Si { +class fl extends Ai { constructor(e) { super(e, { - code: nl.code, + code: fl.code, name: "InvalidRequestRpcError", shortMessage: "JSON is not a valid request object." }); } } -Object.defineProperty(nl, "code", { +Object.defineProperty(fl, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32600 }); -class il extends Si { +class ll extends Ai { constructor(e, { method: r } = {}) { super(e, { - code: il.code, + code: ll.code, name: "MethodNotFoundRpcError", shortMessage: `The method${r ? ` "${r}"` : ""} does not exist / is not available.` }); } } -Object.defineProperty(il, "code", { +Object.defineProperty(ll, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32601 }); -class sl extends Si { +class hl extends Ai { constructor(e) { super(e, { - code: sl.code, + code: hl.code, name: "InvalidParamsRpcError", shortMessage: [ "Invalid parameters were provided to the RPC method.", @@ -2595,31 +2664,31 @@ class sl extends Si { }); } } -Object.defineProperty(sl, "code", { +Object.defineProperty(hl, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32602 }); -class uc extends Si { +class vc extends Ai { constructor(e) { super(e, { - code: uc.code, + code: vc.code, name: "InternalRpcError", shortMessage: "An internal error was received." }); } } -Object.defineProperty(uc, "code", { +Object.defineProperty(vc, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32603 }); -class ol extends Si { +class dl extends Ai { constructor(e) { super(e, { - code: ol.code, + code: dl.code, name: "InvalidInputRpcError", shortMessage: [ "Missing or invalid parameters.", @@ -2629,16 +2698,16 @@ class ol extends Si { }); } } -Object.defineProperty(ol, "code", { +Object.defineProperty(dl, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32e3 }); -class al extends Si { +class pl extends Ai { constructor(e) { super(e, { - code: al.code, + code: pl.code, name: "ResourceNotFoundRpcError", shortMessage: "Requested resource not found." }), Object.defineProperty(this, "name", { @@ -2649,178 +2718,283 @@ class al extends Si { }); } } -Object.defineProperty(al, "code", { +Object.defineProperty(pl, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32001 }); -class cl extends Si { +class gl extends Ai { constructor(e) { super(e, { - code: cl.code, + code: gl.code, name: "ResourceUnavailableRpcError", shortMessage: "Requested resource not available." }); } } -Object.defineProperty(cl, "code", { +Object.defineProperty(gl, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32002 }); -class ul extends Si { +class ml extends Ai { constructor(e) { super(e, { - code: ul.code, + code: ml.code, name: "TransactionRejectedRpcError", shortMessage: "Transaction creation failed." }); } } -Object.defineProperty(ul, "code", { +Object.defineProperty(ml, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32003 }); -class fl extends Si { +class cc extends Ai { constructor(e, { method: r } = {}) { super(e, { - code: fl.code, + code: cc.code, name: "MethodNotSupportedRpcError", - shortMessage: `Method${r ? ` "${r}"` : ""} is not implemented.` + shortMessage: `Method${r ? ` "${r}"` : ""} is not supported.` }); } } -Object.defineProperty(fl, "code", { +Object.defineProperty(cc, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32004 }); -class xu extends Si { +class Iu extends Ai { constructor(e) { super(e, { - code: xu.code, + code: Iu.code, name: "LimitExceededRpcError", shortMessage: "Request exceeds defined limit." }); } } -Object.defineProperty(xu, "code", { +Object.defineProperty(Iu, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32005 }); -class ll extends Si { +class vl extends Ai { constructor(e) { super(e, { - code: ll.code, + code: vl.code, name: "JsonRpcVersionUnsupportedError", shortMessage: "Version of JSON-RPC protocol is not supported." }); } } -Object.defineProperty(ll, "code", { +Object.defineProperty(vl, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32006 }); -class cu extends Du { +class bu extends $i { constructor(e) { super(e, { - code: cu.code, + code: bu.code, name: "UserRejectedRequestError", shortMessage: "User rejected the request." }); } } -Object.defineProperty(cu, "code", { +Object.defineProperty(bu, "code", { enumerable: !0, configurable: !0, writable: !0, value: 4001 }); -class hl extends Du { +class bl extends $i { constructor(e) { super(e, { - code: hl.code, + code: bl.code, name: "UnauthorizedProviderError", shortMessage: "The requested method and/or account has not been authorized by the user." }); } } -Object.defineProperty(hl, "code", { +Object.defineProperty(bl, "code", { enumerable: !0, configurable: !0, writable: !0, value: 4100 }); -class dl extends Du { +class yl extends $i { constructor(e, { method: r } = {}) { super(e, { - code: dl.code, + code: yl.code, name: "UnsupportedProviderMethodError", shortMessage: `The Provider does not support the requested method${r ? ` " ${r}"` : ""}.` }); } } -Object.defineProperty(dl, "code", { +Object.defineProperty(yl, "code", { enumerable: !0, configurable: !0, writable: !0, value: 4200 }); -class pl extends Du { +class wl extends $i { constructor(e) { super(e, { - code: pl.code, + code: wl.code, name: "ProviderDisconnectedError", shortMessage: "The Provider is disconnected from all chains." }); } } -Object.defineProperty(pl, "code", { +Object.defineProperty(wl, "code", { enumerable: !0, configurable: !0, writable: !0, value: 4900 }); -class gl extends Du { +class xl extends $i { constructor(e) { super(e, { - code: gl.code, + code: xl.code, name: "ChainDisconnectedError", shortMessage: "The Provider is not connected to the requested chain." }); } } -Object.defineProperty(gl, "code", { +Object.defineProperty(xl, "code", { enumerable: !0, configurable: !0, writable: !0, value: 4901 }); -class ml extends Du { +class _l extends $i { constructor(e) { super(e, { - code: ml.code, + code: _l.code, name: "SwitchChainError", shortMessage: "An error occurred when attempting to switch chain." }); } } -Object.defineProperty(ml, "code", { +Object.defineProperty(_l, "code", { enumerable: !0, configurable: !0, writable: !0, value: 4902 }); -class BO extends Si { +class Cu extends $i { + constructor(e) { + super(e, { + code: Cu.code, + name: "UnsupportedNonOptionalCapabilityError", + shortMessage: "This Wallet does not support a capability that was not marked as optional." + }); + } +} +Object.defineProperty(Cu, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 5700 +}); +class El extends $i { + constructor(e) { + super(e, { + code: El.code, + name: "UnsupportedChainIdError", + shortMessage: "This Wallet does not support the requested chain ID." + }); + } +} +Object.defineProperty(El, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 5710 +}); +class Sl extends $i { + constructor(e) { + super(e, { + code: Sl.code, + name: "DuplicateIdError", + shortMessage: "There is already a bundle submitted with this ID." + }); + } +} +Object.defineProperty(Sl, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 5720 +}); +class Al extends $i { + constructor(e) { + super(e, { + code: Al.code, + name: "UnknownBundleIdError", + shortMessage: "This bundle id is unknown / has not been submitted" + }); + } +} +Object.defineProperty(Al, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 5730 +}); +class Pl extends $i { + constructor(e) { + super(e, { + code: Pl.code, + name: "BundleTooLargeError", + shortMessage: "The call bundle is too large for the Wallet to process." + }); + } +} +Object.defineProperty(Pl, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 5740 +}); +class Ml extends $i { + constructor(e) { + super(e, { + code: Ml.code, + name: "AtomicReadyWalletRejectedUpgradeError", + shortMessage: "The Wallet can support atomicity after an upgrade, but the user rejected the upgrade." + }); + } +} +Object.defineProperty(Ml, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 5750 +}); +class Tu extends $i { + constructor(e) { + super(e, { + code: Tu.code, + name: "AtomicityNotSupportedError", + shortMessage: "The wallet does not support atomic execution but the request requires it." + }); + } +} +Object.defineProperty(Tu, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 5760 +}); +class lN extends Ai { constructor(e) { super(e, { name: "UnknownRpcError", @@ -2828,15 +3002,15 @@ class BO extends Si { }); } } -const FO = 3; -function jO(t, { abi: e, address: r, args: n, docsPath: i, functionName: s, sender: o }) { - const { code: a, data: u, message: l, shortMessage: d } = t instanceof LO ? t : t instanceof yt ? t.walk((w) => "data" in w) || t.walk() : {}, p = t instanceof xv ? new NO({ functionName: s }) : [FO, uc.code].includes(a) && (u || l || d) ? new OO({ +const hN = 3; +function dN(t, { abi: e, address: r, args: n, docsPath: i, functionName: s, sender: o }) { + const a = t instanceof uN ? t : t instanceof gt ? t.walk((P) => "data" in P) || t.walk() : {}, { code: u, data: l, details: d, message: p, shortMessage: w } = a, _ = t instanceof $v ? new cN({ functionName: s }) : [hN, vc.code].includes(u) && (l || d || p || w) ? new aN({ abi: e, - data: typeof u == "object" ? u.data : u, + data: typeof l == "object" ? l.data : l, functionName: s, - message: d ?? l + message: a instanceof m4 ? d : w ?? p }) : t; - return new DO(p, { + return new oN(_, { abi: e, args: n, contractAddress: r, @@ -2845,22 +3019,25 @@ function jO(t, { abi: e, address: r, args: n, docsPath: i, functionName: s, send sender: o }); } -function UO(t) { - const e = $l(`0x${t.substring(4)}`).substring(26); - return Bl(`0x${e}`); +function pN(t) { + const e = z0(`0x${t.substring(4)}`).substring(26); + return Vl(`0x${e}`); } -async function qO({ hash: t, signature: e }) { - const r = va(t) ? t : zd(t), { secp256k1: n } = await import("./secp256k1-ChAPgt46.js"); +async function gN({ hash: t, signature: e }) { + const r = ya(t) ? t : t0(t), { secp256k1: n } = await import("./secp256k1-D5_JzNmG.js"); return `0x${(() => { if (typeof e == "object" && "r" in e && "s" in e) { - const { r: l, s: d, v: p, yParity: w } = e, A = Number(w ?? p), M = C2(A); - return new n.Signature(el(l), el(d)).addRecoveryBit(M); + const { r: l, s: d, v: p, yParity: w } = e, _ = Number(w ?? p), P = z2(_); + return new n.Signature(wa(l), wa(d)).addRecoveryBit(P); } - const o = va(e) ? e : zd(e), a = bu(`0x${o.slice(130)}`), u = C2(a); + const o = ya(e) ? e : t0(e); + if (xn(o) !== 65) + throw new Error("invalid signature length"); + const a = xa(`0x${o.slice(130)}`), u = z2(a); return n.Signature.fromCompact(o.substring(2, 130)).addRecoveryBit(u); })().recoverPublicKey(r.substring(2)).toHex(!1)}`; } -function C2(t) { +function z2(t) { if (t === 0 || t === 1) return t; if (t === 27) @@ -2869,18 +3046,18 @@ function C2(t) { return 1; throw new Error("Invalid yParityOrV value"); } -async function zO({ hash: t, signature: e }) { - return UO(await qO({ hash: t, signature: e })); +async function mN({ hash: t, signature: e }) { + return pN(await gN({ hash: t, signature: e })); } -function WO(t, e = "hex") { - const r = Y5(t), n = Cv(new Uint8Array(r.length)); +function vN(t, e = "hex") { + const r = v4(t), n = Wv(new Uint8Array(r.length)); return r.encode(n), e === "hex" ? xi(n.bytes) : n.bytes; } -function Y5(t) { - return Array.isArray(t) ? HO(t.map((e) => Y5(e))) : KO(t); +function v4(t) { + return Array.isArray(t) ? bN(t.map((e) => v4(e))) : yN(t); } -function HO(t) { - const e = t.reduce((i, s) => i + s.length, 0), r = J5(e); +function bN(t) { + const e = t.reduce((i, s) => i + s.length, 0), r = b4(e); return { length: e <= 55 ? 1 + e : 1 + r + e, encode(i) { @@ -2890,8 +3067,8 @@ function HO(t) { } }; } -function KO(t) { - const e = typeof t == "string" ? Lo(t) : t, r = J5(e.length); +function yN(t) { + const e = typeof t == "string" ? Fo(t) : t, r = b4(e.length); return { length: e.length === 1 && e[0] < 128 ? 1 : e.length <= 55 ? 1 + e.length : 1 + r + e.length, encode(i) { @@ -2899,7 +3076,7 @@ function KO(t) { } }; } -function J5(t) { +function b4(t) { if (t < 2 ** 8) return 1; if (t < 2 ** 16) @@ -2908,38 +3085,38 @@ function J5(t) { return 3; if (t < 2 ** 32) return 4; - throw new yt("Length is too large."); + throw new gt("Length is too large."); } -function VO(t) { - const { chainId: e, contractAddress: r, nonce: n, to: i } = t, s = $l(R0([ +function wN(t) { + const { chainId: e, nonce: r, to: n } = t, i = t.contractAddress ?? t.address, s = z0(H0([ "0x05", - WO([ - e ? Mr(e) : "0x", - r, - n ? Mr(n) : "0x" + vN([ + e ? vr(e) : "0x", + i, + r ? vr(r) : "0x" ]) ])); - return i === "bytes" ? Lo(s) : s; + return n === "bytes" ? Fo(s) : s; } -async function X5(t) { +async function y4(t) { const { authorization: e, signature: r } = t; - return zO({ - hash: VO(e), + return mN({ + hash: wN(e), signature: r ?? e }); } -class GO extends yt { +class xN extends gt { constructor(e, { account: r, docsPath: n, chain: i, data: s, gas: o, gasPrice: a, maxFeePerGas: u, maxPriorityFeePerGas: l, nonce: d, to: p, value: w }) { - var M; - const A = D0({ + var P; + const _ = K0({ from: r == null ? void 0 : r.address, to: p, - value: typeof w < "u" && `${K5(w)} ${((M = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : M.symbol) || "ETH"}`, + value: typeof w < "u" && `${d4(w)} ${((P = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : P.symbol) || "ETH"}`, data: s, gas: o, - gasPrice: typeof a < "u" && `${Es(a)} gwei`, - maxFeePerGas: typeof u < "u" && `${Es(u)} gwei`, - maxPriorityFeePerGas: typeof l < "u" && `${Es(l)} gwei`, + gasPrice: typeof a < "u" && `${Ps(a)} gwei`, + maxFeePerGas: typeof u < "u" && `${Ps(u)} gwei`, + maxPriorityFeePerGas: typeof l < "u" && `${Ps(l)} gwei`, nonce: d }); super(e.shortMessage, { @@ -2948,7 +3125,7 @@ class GO extends yt { metaMessages: [ ...e.metaMessages ? [...e.metaMessages, " "] : [], "Estimate Gas Arguments:", - A + _ ].filter(Boolean), name: "EstimateGasExecutionError" }), Object.defineProperty(this, "cause", { @@ -2959,7 +3136,7 @@ class GO extends yt { }), this.cause = e; } } -class Zc extends yt { +class cu extends gt { constructor({ cause: e, message: r } = {}) { var i; const n = (i = r == null ? void 0 : r.replace("execution reverted: ", "")) == null ? void 0 : i.replace("execution reverted", ""); @@ -2969,58 +3146,58 @@ class Zc extends yt { }); } } -Object.defineProperty(Zc, "code", { +Object.defineProperty(cu, "code", { enumerable: !0, configurable: !0, writable: !0, value: 3 }); -Object.defineProperty(Zc, "nodeMessage", { +Object.defineProperty(cu, "nodeMessage", { enumerable: !0, configurable: !0, writable: !0, value: /execution reverted/ }); -class Vd extends yt { +class s0 extends gt { constructor({ cause: e, maxFeePerGas: r } = {}) { - super(`The fee cap (\`maxFeePerGas\`${r ? ` = ${Es(r)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, { + super(`The fee cap (\`maxFeePerGas\`${r ? ` = ${Ps(r)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, { cause: e, name: "FeeCapTooHighError" }); } } -Object.defineProperty(Vd, "nodeMessage", { +Object.defineProperty(s0, "nodeMessage", { enumerable: !0, configurable: !0, writable: !0, value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/ }); -class Qm extends yt { +class p1 extends gt { constructor({ cause: e, maxFeePerGas: r } = {}) { - super(`The fee cap (\`maxFeePerGas\`${r ? ` = ${Es(r)}` : ""} gwei) cannot be lower than the block base fee.`, { + super(`The fee cap (\`maxFeePerGas\`${r ? ` = ${Ps(r)}` : ""} gwei) cannot be lower than the block base fee.`, { cause: e, name: "FeeCapTooLowError" }); } } -Object.defineProperty(Qm, "nodeMessage", { +Object.defineProperty(p1, "nodeMessage", { enumerable: !0, configurable: !0, writable: !0, value: /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/ }); -class e1 extends yt { +class g1 extends gt { constructor({ cause: e, nonce: r } = {}) { super(`Nonce provided for the transaction ${r ? `(${r}) ` : ""}is higher than the next one expected.`, { cause: e, name: "NonceTooHighError" }); } } -Object.defineProperty(e1, "nodeMessage", { +Object.defineProperty(g1, "nodeMessage", { enumerable: !0, configurable: !0, writable: !0, value: /nonce too high/ }); -class t1 extends yt { +class m1 extends gt { constructor({ cause: e, nonce: r } = {}) { super([ `Nonce provided for the transaction ${r ? `(${r}) ` : ""}is lower than the current nonce of the account.`, @@ -3029,24 +3206,24 @@ class t1 extends yt { `), { cause: e, name: "NonceTooLowError" }); } } -Object.defineProperty(t1, "nodeMessage", { +Object.defineProperty(m1, "nodeMessage", { enumerable: !0, configurable: !0, writable: !0, value: /nonce too low|transaction already imported|already known/ }); -class r1 extends yt { +class v1 extends gt { constructor({ cause: e, nonce: r } = {}) { super(`Nonce provided for the transaction ${r ? `(${r}) ` : ""}exceeds the maximum allowed nonce.`, { cause: e, name: "NonceMaxValueError" }); } } -Object.defineProperty(r1, "nodeMessage", { +Object.defineProperty(v1, "nodeMessage", { enumerable: !0, configurable: !0, writable: !0, value: /nonce has max value/ }); -class n1 extends yt { +class b1 extends gt { constructor({ cause: e } = {}) { super([ "The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account." @@ -3067,13 +3244,13 @@ class n1 extends yt { }); } } -Object.defineProperty(n1, "nodeMessage", { +Object.defineProperty(b1, "nodeMessage", { enumerable: !0, configurable: !0, writable: !0, value: /insufficient funds|exceeds transaction sender account balance/ }); -class i1 extends yt { +class y1 extends gt { constructor({ cause: e, gas: r } = {}) { super(`The amount of gas ${r ? `(${r}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`, { cause: e, @@ -3081,13 +3258,13 @@ class i1 extends yt { }); } } -Object.defineProperty(i1, "nodeMessage", { +Object.defineProperty(y1, "nodeMessage", { enumerable: !0, configurable: !0, writable: !0, value: /intrinsic gas too high|gas limit reached/ }); -class s1 extends yt { +class w1 extends gt { constructor({ cause: e, gas: r } = {}) { super(`The amount of gas ${r ? `(${r}) ` : ""}provided for the transaction is too low.`, { cause: e, @@ -3095,13 +3272,13 @@ class s1 extends yt { }); } } -Object.defineProperty(s1, "nodeMessage", { +Object.defineProperty(w1, "nodeMessage", { enumerable: !0, configurable: !0, writable: !0, value: /intrinsic gas too low/ }); -class o1 extends yt { +class x1 extends gt { constructor({ cause: e }) { super("The transaction type is not supported for this chain.", { cause: e, @@ -3109,16 +3286,16 @@ class o1 extends yt { }); } } -Object.defineProperty(o1, "nodeMessage", { +Object.defineProperty(x1, "nodeMessage", { enumerable: !0, configurable: !0, writable: !0, value: /transaction type not valid/ }); -class Gd extends yt { +class o0 extends gt { constructor({ cause: e, maxPriorityFeePerGas: r, maxFeePerGas: n } = {}) { super([ - `The provided tip (\`maxPriorityFeePerGas\`${r ? ` = ${Es(r)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n ? ` = ${Es(n)} gwei` : ""}).` + `The provided tip (\`maxPriorityFeePerGas\`${r ? ` = ${Ps(r)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n ? ` = ${Ps(n)} gwei` : ""}).` ].join(` `), { cause: e, @@ -3126,13 +3303,13 @@ class Gd extends yt { }); } } -Object.defineProperty(Gd, "nodeMessage", { +Object.defineProperty(o0, "nodeMessage", { enumerable: !0, configurable: !0, writable: !0, value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/ }); -class Tv extends yt { +class Hv extends gt { constructor({ cause: e }) { super(`An error occurred while executing: ${e == null ? void 0 : e.shortMessage}`, { cause: e, @@ -3140,39 +3317,39 @@ class Tv extends yt { }); } } -function Z5(t, e) { - const r = (t.details || "").toLowerCase(), n = t instanceof yt ? t.walk((i) => (i == null ? void 0 : i.code) === Zc.code) : t; - return n instanceof yt ? new Zc({ +function w4(t, e) { + const r = (t.details || "").toLowerCase(), n = t instanceof gt ? t.walk((i) => (i == null ? void 0 : i.code) === cu.code) : t; + return n instanceof gt ? new cu({ cause: t, message: n.details - }) : Zc.nodeMessage.test(r) ? new Zc({ + }) : cu.nodeMessage.test(r) ? new cu({ cause: t, message: t.details - }) : Vd.nodeMessage.test(r) ? new Vd({ + }) : s0.nodeMessage.test(r) ? new s0({ cause: t, maxFeePerGas: e == null ? void 0 : e.maxFeePerGas - }) : Qm.nodeMessage.test(r) ? new Qm({ + }) : p1.nodeMessage.test(r) ? new p1({ cause: t, maxFeePerGas: e == null ? void 0 : e.maxFeePerGas - }) : e1.nodeMessage.test(r) ? new e1({ cause: t, nonce: e == null ? void 0 : e.nonce }) : t1.nodeMessage.test(r) ? new t1({ cause: t, nonce: e == null ? void 0 : e.nonce }) : r1.nodeMessage.test(r) ? new r1({ cause: t, nonce: e == null ? void 0 : e.nonce }) : n1.nodeMessage.test(r) ? new n1({ cause: t }) : i1.nodeMessage.test(r) ? new i1({ cause: t, gas: e == null ? void 0 : e.gas }) : s1.nodeMessage.test(r) ? new s1({ cause: t, gas: e == null ? void 0 : e.gas }) : o1.nodeMessage.test(r) ? new o1({ cause: t }) : Gd.nodeMessage.test(r) ? new Gd({ + }) : g1.nodeMessage.test(r) ? new g1({ cause: t, nonce: e == null ? void 0 : e.nonce }) : m1.nodeMessage.test(r) ? new m1({ cause: t, nonce: e == null ? void 0 : e.nonce }) : v1.nodeMessage.test(r) ? new v1({ cause: t, nonce: e == null ? void 0 : e.nonce }) : b1.nodeMessage.test(r) ? new b1({ cause: t }) : y1.nodeMessage.test(r) ? new y1({ cause: t, gas: e == null ? void 0 : e.gas }) : w1.nodeMessage.test(r) ? new w1({ cause: t, gas: e == null ? void 0 : e.gas }) : x1.nodeMessage.test(r) ? new x1({ cause: t }) : o0.nodeMessage.test(r) ? new o0({ cause: t, maxFeePerGas: e == null ? void 0 : e.maxFeePerGas, maxPriorityFeePerGas: e == null ? void 0 : e.maxPriorityFeePerGas - }) : new Tv({ + }) : new Hv({ cause: t }); } -function YO(t, { docsPath: e, ...r }) { +function _N(t, { docsPath: e, ...r }) { const n = (() => { - const i = Z5(t, r); - return i instanceof Tv ? t : i; + const i = w4(t, r); + return i instanceof Hv ? t : i; })(); - return new GO(n, { + return new xN(n, { docsPath: e, ...r }); } -function Q5(t, { format: e }) { +function x4(t, { format: e }) { if (!e) return {}; const r = {}; @@ -3184,39 +3361,39 @@ function Q5(t, { format: e }) { const i = e(t || {}); return n(i), r; } -const JO = { +const EN = { legacy: "0x0", eip2930: "0x1", eip1559: "0x2", eip4844: "0x3", eip7702: "0x4" }; -function Rv(t) { +function Kv(t) { const e = {}; - return typeof t.authorizationList < "u" && (e.authorizationList = XO(t.authorizationList)), typeof t.accessList < "u" && (e.accessList = t.accessList), typeof t.blobVersionedHashes < "u" && (e.blobVersionedHashes = t.blobVersionedHashes), typeof t.blobs < "u" && (typeof t.blobs[0] != "string" ? e.blobs = t.blobs.map((r) => xi(r)) : e.blobs = t.blobs), typeof t.data < "u" && (e.data = t.data), typeof t.from < "u" && (e.from = t.from), typeof t.gas < "u" && (e.gas = Mr(t.gas)), typeof t.gasPrice < "u" && (e.gasPrice = Mr(t.gasPrice)), typeof t.maxFeePerBlobGas < "u" && (e.maxFeePerBlobGas = Mr(t.maxFeePerBlobGas)), typeof t.maxFeePerGas < "u" && (e.maxFeePerGas = Mr(t.maxFeePerGas)), typeof t.maxPriorityFeePerGas < "u" && (e.maxPriorityFeePerGas = Mr(t.maxPriorityFeePerGas)), typeof t.nonce < "u" && (e.nonce = Mr(t.nonce)), typeof t.to < "u" && (e.to = t.to), typeof t.type < "u" && (e.type = JO[t.type]), typeof t.value < "u" && (e.value = Mr(t.value)), e; + return typeof t.authorizationList < "u" && (e.authorizationList = SN(t.authorizationList)), typeof t.accessList < "u" && (e.accessList = t.accessList), typeof t.blobVersionedHashes < "u" && (e.blobVersionedHashes = t.blobVersionedHashes), typeof t.blobs < "u" && (typeof t.blobs[0] != "string" ? e.blobs = t.blobs.map((r) => xi(r)) : e.blobs = t.blobs), typeof t.data < "u" && (e.data = t.data), typeof t.from < "u" && (e.from = t.from), typeof t.gas < "u" && (e.gas = vr(t.gas)), typeof t.gasPrice < "u" && (e.gasPrice = vr(t.gasPrice)), typeof t.maxFeePerBlobGas < "u" && (e.maxFeePerBlobGas = vr(t.maxFeePerBlobGas)), typeof t.maxFeePerGas < "u" && (e.maxFeePerGas = vr(t.maxFeePerGas)), typeof t.maxPriorityFeePerGas < "u" && (e.maxPriorityFeePerGas = vr(t.maxPriorityFeePerGas)), typeof t.nonce < "u" && (e.nonce = vr(t.nonce)), typeof t.to < "u" && (e.to = t.to), typeof t.type < "u" && (e.type = EN[t.type]), typeof t.value < "u" && (e.value = vr(t.value)), e; } -function XO(t) { +function SN(t) { return t.map((e) => ({ - address: e.contractAddress, - r: e.r, - s: e.s, - chainId: Mr(e.chainId), - nonce: Mr(e.nonce), - ...typeof e.yParity < "u" ? { yParity: Mr(e.yParity) } : {}, - ...typeof e.v < "u" && typeof e.yParity > "u" ? { v: Mr(e.v) } : {} + address: e.address, + r: e.r ? vr(BigInt(e.r)) : e.r, + s: e.s ? vr(BigInt(e.s)) : e.s, + chainId: vr(e.chainId), + nonce: vr(e.nonce), + ...typeof e.yParity < "u" ? { yParity: vr(e.yParity) } : {}, + ...typeof e.v < "u" && typeof e.yParity > "u" ? { v: vr(e.v) } : {} })); } -function T2(t) { +function W2(t) { if (!(!t || t.length === 0)) return t.reduce((e, { slot: r, value: n }) => { if (r.length !== 66) - throw new y2({ + throw new O2({ size: r.length, targetSize: 66, type: "hex" }); if (n.length !== 66) - throw new y2({ + throw new O2({ size: n.length, targetSize: 66, type: "hex" @@ -3224,94 +3401,94 @@ function T2(t) { return e[r] = n, e; }, {}); } -function ZO(t) { +function AN(t) { const { balance: e, nonce: r, state: n, stateDiff: i, code: s } = t, o = {}; - if (s !== void 0 && (o.code = s), e !== void 0 && (o.balance = Mr(e)), r !== void 0 && (o.nonce = Mr(r)), n !== void 0 && (o.state = T2(n)), i !== void 0) { + if (s !== void 0 && (o.code = s), e !== void 0 && (o.balance = vr(e)), r !== void 0 && (o.nonce = vr(r)), n !== void 0 && (o.state = W2(n)), i !== void 0) { if (o.state) - throw new MO(); - o.stateDiff = T2(i); + throw new tN(); + o.stateDiff = W2(i); } return o; } -function QO(t) { +function PN(t) { if (!t) return; const e = {}; for (const { address: r, ...n } of t) { - if (!ko(r, { strict: !1 })) - throw new yu({ address: r }); + if (!Ms(r, { strict: !1 })) + throw new _a({ address: r }); if (e[r]) - throw new PO({ address: r }); - e[r] = ZO(n); + throw new eN({ address: r }); + e[r] = AN(n); } return e; } -const eN = 2n ** 256n - 1n; -function O0(t) { - const { account: e, gasPrice: r, maxFeePerGas: n, maxPriorityFeePerGas: i, to: s } = t, o = e ? qo(e) : void 0; - if (o && !ko(o.address)) - throw new yu({ address: o.address }); - if (s && !ko(s)) - throw new yu({ address: s }); +const MN = 2n ** 256n - 1n; +function V0(t) { + const { account: e, gasPrice: r, maxFeePerGas: n, maxPriorityFeePerGas: i, to: s } = t, o = e ? _i(e) : void 0; + if (o && !Ms(o.address)) + throw new _a({ address: o.address }); + if (s && !Ms(s)) + throw new _a({ address: s }); if (typeof r < "u" && (typeof n < "u" || typeof i < "u")) - throw new IO(); - if (n && n > eN) - throw new Vd({ maxFeePerGas: n }); + throw new rN(); + if (n && n > MN) + throw new s0({ maxFeePerGas: n }); if (i && n && i > n) - throw new Gd({ maxFeePerGas: n, maxPriorityFeePerGas: i }); + throw new o0({ maxFeePerGas: n, maxPriorityFeePerGas: i }); } -class tN extends yt { +class IN extends gt { constructor() { super("`baseFeeMultiplier` must be greater than 1.", { name: "BaseFeeScalarError" }); } } -class Dv extends yt { +class Vv extends gt { constructor() { super("Chain does not support EIP-1559 fees.", { name: "Eip1559FeesNotSupportedError" }); } } -class rN extends yt { +class CN extends gt { constructor({ maxPriorityFeePerGas: e }) { - super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Es(e)} gwei).`, { name: "MaxFeePerGasTooLowError" }); + super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Ps(e)} gwei).`, { name: "MaxFeePerGasTooLowError" }); } } -class nN extends yt { +class TN extends gt { constructor({ blockHash: e, blockNumber: r }) { let n = "Block"; e && (n = `Block at hash "${e}"`), r && (n = `Block at number "${r}"`), super(`${n} could not be found.`, { name: "BlockNotFoundError" }); } } -const iN = { +const RN = { "0x0": "legacy", "0x1": "eip2930", "0x2": "eip1559", "0x3": "eip4844", "0x4": "eip7702" }; -function sN(t) { +function DN(t) { const e = { ...t, blockHash: t.blockHash ? t.blockHash : null, blockNumber: t.blockNumber ? BigInt(t.blockNumber) : null, - chainId: t.chainId ? bu(t.chainId) : void 0, + chainId: t.chainId ? xa(t.chainId) : void 0, gas: t.gas ? BigInt(t.gas) : void 0, gasPrice: t.gasPrice ? BigInt(t.gasPrice) : void 0, maxFeePerBlobGas: t.maxFeePerBlobGas ? BigInt(t.maxFeePerBlobGas) : void 0, maxFeePerGas: t.maxFeePerGas ? BigInt(t.maxFeePerGas) : void 0, maxPriorityFeePerGas: t.maxPriorityFeePerGas ? BigInt(t.maxPriorityFeePerGas) : void 0, - nonce: t.nonce ? bu(t.nonce) : void 0, + nonce: t.nonce ? xa(t.nonce) : void 0, to: t.to ? t.to : null, transactionIndex: t.transactionIndex ? Number(t.transactionIndex) : null, - type: t.type ? iN[t.type] : void 0, + type: t.type ? RN[t.type] : void 0, typeHex: t.type ? t.type : void 0, value: t.value ? BigInt(t.value) : void 0, v: t.v ? BigInt(t.v) : void 0 }; - return t.authorizationList && (e.authorizationList = oN(t.authorizationList)), e.yParity = (() => { + return t.authorizationList && (e.authorizationList = ON(t.authorizationList)), e.yParity = (() => { if (t.yParity) return Number(t.yParity); if (typeof e.v == "bigint") { @@ -3324,9 +3501,9 @@ function sN(t) { } })(), e.type === "legacy" && (delete e.accessList, delete e.maxFeePerBlobGas, delete e.maxFeePerGas, delete e.maxPriorityFeePerGas, delete e.yParity), e.type === "eip2930" && (delete e.maxFeePerBlobGas, delete e.maxFeePerGas, delete e.maxPriorityFeePerGas), e.type === "eip1559" && delete e.maxFeePerBlobGas, e; } -function oN(t) { +function ON(t) { return t.map((e) => ({ - contractAddress: e.address, + address: e.address, chainId: Number(e.chainId), nonce: Number(e.nonce), r: e.r, @@ -3334,8 +3511,8 @@ function oN(t) { yParity: Number(e.yParity) })); } -function aN(t) { - const e = (t.transactions ?? []).map((r) => typeof r == "string" ? r : sN(r)); +function NN(t) { + const e = (t.transactions ?? []).map((r) => typeof r == "string" ? r : DN(r)); return { ...t, baseFeePerGas: t.baseFeePerGas ? BigInt(t.baseFeePerGas) : null, @@ -3354,9 +3531,9 @@ function aN(t) { totalDifficulty: t.totalDifficulty ? BigInt(t.totalDifficulty) : null }; } -async function Yd(t, { blockHash: e, blockNumber: r, blockTag: n, includeTransactions: i } = {}) { +async function a0(t, { blockHash: e, blockNumber: r, blockTag: n, includeTransactions: i } = {}) { var d, p, w; - const s = n ?? "latest", o = i ?? !1, a = r !== void 0 ? Mr(r) : void 0; + const s = n ?? "latest", o = i ?? !1, a = r !== void 0 ? vr(r) : void 0; let u = null; if (e ? u = await t.request({ method: "eth_getBlockByHash", @@ -3365,22 +3542,22 @@ async function Yd(t, { blockHash: e, blockNumber: r, blockTag: n, includeTransac method: "eth_getBlockByNumber", params: [a || s, o] }, { dedupe: !!a }), !u) - throw new nN({ blockHash: e, blockNumber: r }); - return (((w = (p = (d = t.chain) == null ? void 0 : d.formatters) == null ? void 0 : p.block) == null ? void 0 : w.format) || aN)(u); + throw new TN({ blockHash: e, blockNumber: r }); + return (((w = (p = (d = t.chain) == null ? void 0 : d.formatters) == null ? void 0 : p.block) == null ? void 0 : w.format) || NN)(u); } -async function e4(t) { +async function _4(t) { const e = await t.request({ method: "eth_gasPrice" }); return BigInt(e); } -async function cN(t, e) { +async function LN(t, e) { var s, o; const { block: r, chain: n = t.chain, request: i } = e || {}; try { const a = ((s = n == null ? void 0 : n.fees) == null ? void 0 : s.maxPriorityFeePerGas) ?? ((o = n == null ? void 0 : n.fees) == null ? void 0 : o.defaultPriorityFee); if (typeof a == "function") { - const l = r || await bi(t, Yd, "getBlock")({}), d = await a({ + const l = r || await Xn(t, a0, "getBlock")({}), d = await a({ block: l, client: t, request: i @@ -3394,100 +3571,108 @@ async function cN(t, e) { const u = await t.request({ method: "eth_maxPriorityFeePerGas" }); - return el(u); + return wa(u); } catch { const [a, u] = await Promise.all([ - r ? Promise.resolve(r) : bi(t, Yd, "getBlock")({}), - bi(t, e4, "getGasPrice")({}) + r ? Promise.resolve(r) : Xn(t, a0, "getBlock")({}), + Xn(t, _4, "getGasPrice")({}) ]); if (typeof a.baseFeePerGas != "bigint") - throw new Dv(); + throw new Vv(); const l = u - a.baseFeePerGas; return l < 0n ? 0n : l; } } -async function R2(t, e) { - var w, A; +async function H2(t, e) { + var w, _; const { block: r, chain: n = t.chain, request: i, type: s = "eip1559" } = e || {}, o = await (async () => { - var M, N; - return typeof ((M = n == null ? void 0 : n.fees) == null ? void 0 : M.baseFeeMultiplier) == "function" ? n.fees.baseFeeMultiplier({ + var P, O; + return typeof ((P = n == null ? void 0 : n.fees) == null ? void 0 : P.baseFeeMultiplier) == "function" ? n.fees.baseFeeMultiplier({ block: r, client: t, request: i - }) : ((N = n == null ? void 0 : n.fees) == null ? void 0 : N.baseFeeMultiplier) ?? 1.2; + }) : ((O = n == null ? void 0 : n.fees) == null ? void 0 : O.baseFeeMultiplier) ?? 1.2; })(); if (o < 1) - throw new tN(); - const u = 10 ** (((w = o.toString().split(".")[1]) == null ? void 0 : w.length) ?? 0), l = (M) => M * BigInt(Math.ceil(o * u)) / BigInt(u), d = r || await bi(t, Yd, "getBlock")({}); - if (typeof ((A = n == null ? void 0 : n.fees) == null ? void 0 : A.estimateFeesPerGas) == "function") { - const M = await n.fees.estimateFeesPerGas({ + throw new IN(); + const u = 10 ** (((w = o.toString().split(".")[1]) == null ? void 0 : w.length) ?? 0), l = (P) => P * BigInt(Math.ceil(o * u)) / BigInt(u), d = r || await Xn(t, a0, "getBlock")({}); + if (typeof ((_ = n == null ? void 0 : n.fees) == null ? void 0 : _.estimateFeesPerGas) == "function") { + const P = await n.fees.estimateFeesPerGas({ block: r, client: t, multiply: l, request: i, type: s }); - if (M !== null) - return M; + if (P !== null) + return P; } if (s === "eip1559") { if (typeof d.baseFeePerGas != "bigint") - throw new Dv(); - const M = typeof (i == null ? void 0 : i.maxPriorityFeePerGas) == "bigint" ? i.maxPriorityFeePerGas : await cN(t, { + throw new Vv(); + const P = typeof (i == null ? void 0 : i.maxPriorityFeePerGas) == "bigint" ? i.maxPriorityFeePerGas : await LN(t, { block: d, chain: n, request: i - }), N = l(d.baseFeePerGas); + }), O = l(d.baseFeePerGas); return { - maxFeePerGas: (i == null ? void 0 : i.maxFeePerGas) ?? N + M, - maxPriorityFeePerGas: M + maxFeePerGas: (i == null ? void 0 : i.maxFeePerGas) ?? O + P, + maxPriorityFeePerGas: P }; } return { - gasPrice: (i == null ? void 0 : i.gasPrice) ?? l(await bi(t, e4, "getGasPrice")({})) + gasPrice: (i == null ? void 0 : i.gasPrice) ?? l(await Xn(t, _4, "getGasPrice")({})) }; } -async function uN(t, { address: e, blockTag: r = "latest", blockNumber: n }) { +async function E4(t, { address: e, blockTag: r = "latest", blockNumber: n }) { const i = await t.request({ method: "eth_getTransactionCount", - params: [e, n ? Mr(n) : r] - }, { dedupe: !!n }); - return bu(i); + params: [ + e, + typeof n == "bigint" ? vr(n) : r + ] + }, { + dedupe: !!n + }); + return xa(i); } -function t4(t) { - const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((s) => Lo(s)) : t.blobs, i = []; +function S4(t) { + const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((s) => Fo(s)) : t.blobs, i = []; for (const s of n) i.push(Uint8Array.from(e.blobToKzgCommitment(s))); return r === "bytes" ? i : i.map((s) => xi(s)); } -function r4(t) { - const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((o) => Lo(o)) : t.blobs, i = typeof t.commitments[0] == "string" ? t.commitments.map((o) => Lo(o)) : t.commitments, s = []; +function A4(t) { + const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((o) => Fo(o)) : t.blobs, i = typeof t.commitments[0] == "string" ? t.commitments.map((o) => Fo(o)) : t.commitments, s = []; for (let o = 0; o < n.length; o++) { const a = n[o], u = i[o]; s.push(Uint8Array.from(e.computeBlobKzgProof(a, u))); } return r === "bytes" ? s : s.map((o) => xi(o)); } -function fN(t, e, r, n) { +function kN(t, e, r, n) { if (typeof t.setBigUint64 == "function") return t.setBigUint64(e, r, n); const i = BigInt(32), s = BigInt(4294967295), o = Number(r >> i & s), a = Number(r & s), u = n ? 4 : 0, l = n ? 0 : 4; t.setUint32(e + u, o, n), t.setUint32(e + l, a, n); } -const lN = (t, e, r) => t & e ^ ~t & r, hN = (t, e, r) => t & e ^ t & r ^ e & r; -class dN extends C5 { +function $N(t, e, r) { + return t & e ^ ~t & r; +} +function BN(t, e, r) { + return t & e ^ t & r ^ e & r; +} +class FN extends V5 { constructor(e, r, n, i) { - super(), this.blockLen = e, this.outputLen = r, this.padOffset = n, this.isLE = i, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(e), this.view = Bg(this.buffer); + super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = e, this.outputLen = r, this.padOffset = n, this.isLE = i, this.buffer = new Uint8Array(e), this.view = Zg(this.buffer); } update(e) { - Hd(this); - const { view: r, buffer: n, blockLen: i } = this; - e = C0(e); - const s = e.length; + n0(this), e = q0(e), mc(e); + const { view: r, buffer: n, blockLen: i } = this, s = e.length; for (let o = 0; o < s; ) { const a = Math.min(i - this.pos, s - o); if (a === i) { - const u = Bg(e); + const u = Zg(e); for (; i <= s - o; o += i) this.process(u, o); continue; @@ -3497,14 +3682,14 @@ class dN extends C5 { return this.length += e.length, this.roundClean(), this; } digestInto(e) { - Hd(this), I5(e, this), this.finished = !0; + n0(this), H5(e, this), this.finished = !0; const { buffer: r, view: n, blockLen: i, isLE: s } = this; let { pos: o } = this; - r[o++] = 128, this.buffer.subarray(o).fill(0), this.padOffset > i - o && (this.process(n, 0), o = 0); + r[o++] = 128, al(this.buffer.subarray(o)), this.padOffset > i - o && (this.process(n, 0), o = 0); for (let p = o; p < i; p++) r[p] = 0; - fN(n, i - 8, BigInt(this.length * 8), s), this.process(n, 0); - const a = Bg(e), u = this.outputLen; + kN(n, i - 8, BigInt(this.length * 8), s), this.process(n, 0); + const a = Zg(e), u = this.outputLen; if (u % 4) throw new Error("_sha2: outputLen should be aligned to 32bit"); const l = u / 4, d = this.get(); @@ -3522,10 +3707,22 @@ class dN extends C5 { _cloneInto(e) { e || (e = new this.constructor()), e.set(...this.get()); const { blockLen: r, buffer: n, length: i, finished: s, destroyed: o, pos: a } = this; - return e.length = i, e.pos = a, e.finished = s, e.destroyed = o, i % r && e.buffer.set(n), e; + return e.destroyed = o, e.finished = s, e.length = i, e.pos = a, i % r && e.buffer.set(n), e; + } + clone() { + return this._cloneInto(); } } -const pN = /* @__PURE__ */ new Uint32Array([ +const ta = /* @__PURE__ */ Uint32Array.from([ + 1779033703, + 3144134277, + 1013904242, + 2773480762, + 1359893119, + 2600822924, + 528734635, + 1541459225 +]), jN = /* @__PURE__ */ Uint32Array.from([ 1116352408, 1899447441, 3049323471, @@ -3590,19 +3787,10 @@ const pN = /* @__PURE__ */ new Uint32Array([ 2756734187, 3204031479, 3329325298 -]), Qo = /* @__PURE__ */ new Uint32Array([ - 1779033703, - 3144134277, - 1013904242, - 2773480762, - 1359893119, - 2600822924, - 528734635, - 1541459225 -]), ea = /* @__PURE__ */ new Uint32Array(64); -let gN = class extends dN { - constructor() { - super(64, 32, 8, !1), this.A = Qo[0] | 0, this.B = Qo[1] | 0, this.C = Qo[2] | 0, this.D = Qo[3] | 0, this.E = Qo[4] | 0, this.F = Qo[5] | 0, this.G = Qo[6] | 0, this.H = Qo[7] | 0; +]), ra = /* @__PURE__ */ new Uint32Array(64); +let UN = class extends FN { + constructor(e = 32) { + super(64, e, 8, !1), this.A = ta[0] | 0, this.B = ta[1] | 0, this.C = ta[2] | 0, this.D = ta[3] | 0, this.E = ta[4] | 0, this.F = ta[5] | 0, this.G = ta[6] | 0, this.H = ta[7] | 0; } get() { const { A: e, B: r, C: n, D: i, E: s, F: o, G: a, H: u } = this; @@ -3614,47 +3802,47 @@ let gN = class extends dN { } process(e, r) { for (let p = 0; p < 16; p++, r += 4) - ea[p] = e.getUint32(r, !1); + ra[p] = e.getUint32(r, !1); for (let p = 16; p < 64; p++) { - const w = ea[p - 15], A = ea[p - 2], M = Ns(w, 7) ^ Ns(w, 18) ^ w >>> 3, N = Ns(A, 17) ^ Ns(A, 19) ^ A >>> 10; - ea[p] = N + ea[p - 7] + M + ea[p - 16] | 0; + const w = ra[p - 15], _ = ra[p - 2], P = $s(w, 7) ^ $s(w, 18) ^ w >>> 3, O = $s(_, 17) ^ $s(_, 19) ^ _ >>> 10; + ra[p] = O + ra[p - 7] + P + ra[p - 16] | 0; } let { A: n, B: i, C: s, D: o, E: a, F: u, G: l, H: d } = this; for (let p = 0; p < 64; p++) { - const w = Ns(a, 6) ^ Ns(a, 11) ^ Ns(a, 25), A = d + w + lN(a, u, l) + pN[p] + ea[p] | 0, N = (Ns(n, 2) ^ Ns(n, 13) ^ Ns(n, 22)) + hN(n, i, s) | 0; - d = l, l = u, u = a, a = o + A | 0, o = s, s = i, i = n, n = A + N | 0; + const w = $s(a, 6) ^ $s(a, 11) ^ $s(a, 25), _ = d + w + $N(a, u, l) + jN[p] + ra[p] | 0, O = ($s(n, 2) ^ $s(n, 13) ^ $s(n, 22)) + BN(n, i, s) | 0; + d = l, l = u, u = a, a = o + _ | 0, o = s, s = i, i = n, n = _ + O | 0; } n = n + this.A | 0, i = i + this.B | 0, s = s + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, u = u + this.F | 0, l = l + this.G | 0, d = d + this.H | 0, this.set(n, i, s, o, a, u, l, d); } roundClean() { - ea.fill(0); + al(ra); } destroy() { - this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0); + this.set(0, 0, 0, 0, 0, 0, 0, 0), al(this.buffer); } }; -const n4 = /* @__PURE__ */ T5(() => new gN()); -function mN(t, e) { - return n4(va(t, { strict: !1 }) ? Ev(t) : t); +const qN = /* @__PURE__ */ G5(() => new UN()), P4 = qN; +function zN(t, e) { + return P4(ya(t, { strict: !1 }) ? Bv(t) : t); } -function vN(t) { - const { commitment: e, version: r = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), i = mN(e); +function WN(t) { + const { commitment: e, version: r = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), i = zN(e); return i.set([r], 0), n === "bytes" ? i : xi(i); } -function bN(t) { +function HN(t) { const { commitments: e, version: r } = t, n = t.to ?? (typeof e[0] == "string" ? "hex" : "bytes"), i = []; for (const s of e) - i.push(vN({ + i.push(WN({ commitment: s, to: n, version: r })); return i; } -const D2 = 6, i4 = 32, Ov = 4096, s4 = i4 * Ov, O2 = s4 * D2 - // terminator byte (0x80). +const K2 = 6, M4 = 32, Gv = 4096, I4 = M4 * Gv, V2 = I4 * K2 - // terminator byte (0x80). 1 - // zero byte (0x00) appended to each field element. -1 * Ov * D2; -class yN extends yt { +1 * Gv * K2; +class KN extends gt { constructor({ maxSize: e, size: r }) { super("Blob size is too large.", { metaMessages: [`Max: ${e} bytes`, `Given: ${r} bytes`], @@ -3662,27 +3850,27 @@ class yN extends yt { }); } } -class wN extends yt { +class VN extends gt { constructor() { super("Blob data must not be empty.", { name: "EmptyBlobError" }); } } -function xN(t) { - const e = t.to ?? (typeof t.data == "string" ? "hex" : "bytes"), r = typeof t.data == "string" ? Lo(t.data) : t.data, n = An(r); +function GN(t) { + const e = t.to ?? (typeof t.data == "string" ? "hex" : "bytes"), r = typeof t.data == "string" ? Fo(t.data) : t.data, n = xn(r); if (!n) - throw new wN(); - if (n > O2) - throw new yN({ - maxSize: O2, + throw new VN(); + if (n > V2) + throw new KN({ + maxSize: V2, size: n }); const i = []; let s = !0, o = 0; for (; s; ) { - const a = Cv(new Uint8Array(s4)); + const a = Wv(new Uint8Array(I4)); let u = 0; - for (; u < Ov; ) { - const l = r.slice(o, o + (i4 - 1)); + for (; u < Gv; ) { + const l = r.slice(o, o + (M4 - 1)); if (a.pushByte(0), a.pushBytes(l), l.length < 31) { a.pushByte(128), s = !1; break; @@ -3693,8 +3881,8 @@ function xN(t) { } return e === "bytes" ? i.map((a) => a.bytes) : i.map((a) => xi(a.bytes)); } -function _N(t) { - const { data: e, kzg: r, to: n } = t, i = t.blobs ?? xN({ data: e, to: n }), s = t.commitments ?? t4({ blobs: i, kzg: r, to: n }), o = t.proofs ?? r4({ blobs: i, commitments: s, kzg: r, to: n }), a = []; +function YN(t) { + const { data: e, kzg: r, to: n } = t, i = t.blobs ?? GN({ data: e, to: n }), s = t.commitments ?? S4({ blobs: i, kzg: r, to: n }), o = t.proofs ?? A4({ blobs: i, commitments: s, kzg: r, to: n }), a = []; for (let u = 0; u < i.length; u++) a.push({ blob: i[u], @@ -3703,7 +3891,7 @@ function _N(t) { }); return a; } -function EN(t) { +function JN(t) { if (t.type) return t.type; if (typeof t.authorizationList < "u") @@ -3714,183 +3902,196 @@ function EN(t) { return "eip1559"; if (typeof t.gasPrice < "u") return typeof t.accessList < "u" ? "eip2930" : "legacy"; - throw new CO({ transaction: t }); + throw new nN({ transaction: t }); } -async function N0(t) { +async function Gl(t) { const e = await t.request({ method: "eth_chainId" }, { dedupe: !0 }); - return bu(e); + return xa(e); } -const o4 = [ +const C4 = [ "blobVersionedHashes", "chainId", "fees", "gas", "nonce", "type" -]; -async function Nv(t, e) { - const { account: r = t.account, blobs: n, chain: i, gas: s, kzg: o, nonce: a, nonceManager: u, parameters: l = o4, type: d } = e, p = r && qo(r), w = { ...e, ...p ? { from: p == null ? void 0 : p.address } : {} }; - let A; - async function M() { - return A || (A = await bi(t, Yd, "getBlock")({ blockTag: "latest" }), A); - } - let N; +], G2 = /* @__PURE__ */ new Map(); +async function Yv(t, e) { + const { account: r = t.account, blobs: n, chain: i, gas: s, kzg: o, nonce: a, nonceManager: u, parameters: l = C4, type: d } = e, p = r && _i(r), w = { ...e, ...p ? { from: p == null ? void 0 : p.address } : {} }; + let _; + async function P() { + return _ || (_ = await Xn(t, a0, "getBlock")({ blockTag: "latest" }), _); + } + let O; async function L() { - return N || (i ? i.id : typeof e.chainId < "u" ? e.chainId : (N = await bi(t, N0, "getChainId")({}), N)); + return O || (i ? i.id : typeof e.chainId < "u" ? e.chainId : (O = await Xn(t, Gl, "getChainId")({}), O)); } + if (l.includes("nonce") && typeof a > "u" && p) + if (u) { + const B = await L(); + w.nonce = await u.consume({ + address: p.address, + chainId: B, + client: t + }); + } else + w.nonce = await Xn(t, E4, "getTransactionCount")({ + address: p.address, + blockTag: "pending" + }); if ((l.includes("blobVersionedHashes") || l.includes("sidecars")) && n && o) { - const B = t4({ blobs: n, kzg: o }); + const B = S4({ blobs: n, kzg: o }); if (l.includes("blobVersionedHashes")) { - const $ = bN({ + const k = HN({ commitments: B, to: "hex" }); - w.blobVersionedHashes = $; + w.blobVersionedHashes = k; } if (l.includes("sidecars")) { - const $ = r4({ blobs: n, commitments: B, kzg: o }), H = _N({ + const k = A4({ blobs: n, commitments: B, kzg: o }), q = YN({ blobs: n, commitments: B, - proofs: $, + proofs: k, to: "hex" }); - w.sidecars = H; + w.sidecars = q; } } - if (l.includes("chainId") && (w.chainId = await L()), l.includes("nonce") && typeof a > "u" && p) - if (u) { - const B = await L(); - w.nonce = await u.consume({ - address: p.address, - chainId: B, - client: t - }); - } else - w.nonce = await bi(t, uN, "getTransactionCount")({ - address: p.address, - blockTag: "pending" - }); - if ((l.includes("fees") || l.includes("type")) && typeof d > "u") + if (l.includes("chainId") && (w.chainId = await L()), (l.includes("fees") || l.includes("type")) && typeof d > "u") try { - w.type = EN(w); + w.type = JN(w); } catch { - const B = await M(); - w.type = typeof (B == null ? void 0 : B.baseFeePerGas) == "bigint" ? "eip1559" : "legacy"; + let B = G2.get(t.uid); + if (typeof B > "u") { + const k = await P(); + B = typeof (k == null ? void 0 : k.baseFeePerGas) == "bigint", G2.set(t.uid, B); + } + w.type = B ? "eip1559" : "legacy"; } if (l.includes("fees")) if (w.type !== "legacy" && w.type !== "eip2930") { if (typeof w.maxFeePerGas > "u" || typeof w.maxPriorityFeePerGas > "u") { - const B = await M(), { maxFeePerGas: $, maxPriorityFeePerGas: H } = await R2(t, { + const B = await P(), { maxFeePerGas: k, maxPriorityFeePerGas: q } = await H2(t, { block: B, chain: i, request: w }); - if (typeof e.maxPriorityFeePerGas > "u" && e.maxFeePerGas && e.maxFeePerGas < H) - throw new rN({ - maxPriorityFeePerGas: H + if (typeof e.maxPriorityFeePerGas > "u" && e.maxFeePerGas && e.maxFeePerGas < q) + throw new CN({ + maxPriorityFeePerGas: q }); - w.maxPriorityFeePerGas = H, w.maxFeePerGas = $; + w.maxPriorityFeePerGas = q, w.maxFeePerGas = k; } } else { if (typeof e.maxFeePerGas < "u" || typeof e.maxPriorityFeePerGas < "u") - throw new Dv(); - const B = await M(), { gasPrice: $ } = await R2(t, { - block: B, - chain: i, - request: w, - type: "legacy" - }); - w.gasPrice = $; + throw new Vv(); + if (typeof e.gasPrice > "u") { + const B = await P(), { gasPrice: k } = await H2(t, { + block: B, + chain: i, + request: w, + type: "legacy" + }); + w.gasPrice = k; + } } - return l.includes("gas") && typeof s > "u" && (w.gas = await bi(t, AN, "estimateGas")({ + return l.includes("gas") && typeof s > "u" && (w.gas = await Xn(t, ZN, "estimateGas")({ ...w, account: p && { address: p.address, type: "json-rpc" } - })), O0(w), delete w.parameters, w; + })), V0(w), delete w.parameters, w; } -async function SN(t, { address: e, blockNumber: r, blockTag: n = "latest" }) { - const i = r ? Mr(r) : void 0, s = await t.request({ +async function XN(t, { address: e, blockNumber: r, blockTag: n = "latest" }) { + const i = typeof r == "bigint" ? vr(r) : void 0, s = await t.request({ method: "eth_getBalance", params: [e, i || n] }); return BigInt(s); } -async function AN(t, e) { +async function ZN(t, e) { var i, s, o; - const { account: r = t.account } = e, n = r ? qo(r) : void 0; + const { account: r = t.account } = e, n = r ? _i(r) : void 0; try { let f = function(b) { - const { block: x, request: _, rpcStateOverride: E } = b; + const { block: x, request: E, rpcStateOverride: S } = b; return t.request({ method: "eth_estimateGas", - params: E ? [_, x ?? "latest", E] : x ? [_, x] : [_] + params: S ? [E, x ?? "latest", S] : x ? [E, x] : [E] }); }; - const { accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, blockNumber: p, blockTag: w, data: A, gas: M, gasPrice: N, maxFeePerBlobGas: L, maxFeePerGas: B, maxPriorityFeePerGas: $, nonce: H, value: U, stateOverride: V, ...te } = await Nv(t, { + const { accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, blockNumber: p, blockTag: w, data: _, gas: P, gasPrice: O, maxFeePerBlobGas: L, maxFeePerGas: B, maxPriorityFeePerGas: k, nonce: q, value: U, stateOverride: V, ...Q } = await Yv(t, { ...e, parameters: ( // Some RPC Providers do not compute versioned hashes from blobs. We will need // to compute them. (n == null ? void 0 : n.type) === "local" ? void 0 : ["blobVersionedHashes"] ) - }), K = (p ? Mr(p) : void 0) || w, ge = QO(V), Ee = await (async () => { - if (te.to) - return te.to; + }), K = (typeof p == "bigint" ? vr(p) : void 0) || w, ge = PN(V), Ee = await (async () => { + if (Q.to) + return Q.to; if (u && u.length > 0) - return await X5({ + return await y4({ authorization: u[0] }).catch(() => { - throw new yt("`to` is required. Could not infer from `authorizationList`"); + throw new gt("`to` is required. Could not infer from `authorizationList`"); }); })(); - O0(e); - const Y = (o = (s = (i = t.chain) == null ? void 0 : i.formatters) == null ? void 0 : s.transactionRequest) == null ? void 0 : o.format, m = (Y || Rv)({ + V0(e); + const Y = (o = (s = (i = t.chain) == null ? void 0 : i.formatters) == null ? void 0 : s.transactionRequest) == null ? void 0 : o.format, m = (Y || Kv)({ // Pick out extra data that might exist on the chain's transaction request type. - ...Q5(te, { format: Y }), + ...x4(Q, { format: Y }), from: n == null ? void 0 : n.address, accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, - data: A, - gas: M, - gasPrice: N, + data: _, + gas: P, + gasPrice: O, maxFeePerBlobGas: L, maxFeePerGas: B, - maxPriorityFeePerGas: $, - nonce: H, + maxPriorityFeePerGas: k, + nonce: q, to: Ee, value: U }); let g = BigInt(await f({ block: K, request: m, rpcStateOverride: ge })); if (u) { - const b = await SN(t, { address: m.from }), x = await Promise.all(u.map(async (_) => { - const { contractAddress: E } = _, v = await f({ + const b = await XN(t, { address: m.from }), x = await Promise.all(u.map(async (E) => { + const { address: S } = E, v = await f({ block: K, request: { authorizationList: void 0, - data: A, + data: _, from: n == null ? void 0 : n.address, - to: E, - value: Mr(b) + to: S, + value: vr(b) }, rpcStateOverride: ge }).catch(() => 100000n); return 2n * BigInt(v); })); - g += x.reduce((_, E) => _ + E, 0n); + g += x.reduce((E, S) => E + S, 0n); } return g; } catch (a) { - throw YO(a, { + throw _N(a, { ...e, account: n, chain: t.chain }); } } -class PN extends yt { +function QN(t, e) { + if (!Ms(t, { strict: !1 })) + throw new _a({ address: t }); + if (!Ms(e, { strict: !1 })) + throw new _a({ address: e }); + return t.toLowerCase() === e.toLowerCase(); +} +class eL extends gt { constructor({ chain: e, currentChainId: r }) { super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`, { metaMessages: [ @@ -3901,7 +4102,7 @@ class PN extends yt { }); } } -class MN extends yt { +class tL extends gt { constructor() { super([ "No chain was provided to the request.", @@ -3912,25 +4113,82 @@ class MN extends yt { }); } } -const Ug = "/docs/contract/encodeDeployData"; -function IN(t) { +const tm = "/docs/contract/encodeDeployData"; +function rL(t) { const { abi: e, args: r, bytecode: n } = t; if (!r || r.length === 0) return n; const i = e.find((o) => "type" in o && o.type === "constructor"); if (!i) - throw new KR({ docsPath: Ug }); + throw new wD({ docsPath: tm }); if (!("inputs" in i)) - throw new v2({ docsPath: Ug }); + throw new R2({ docsPath: tm }); if (!i.inputs || i.inputs.length === 0) - throw new v2({ docsPath: Ug }); - const s = U5(i.inputs, r); - return R0([n, s]); + throw new R2({ docsPath: tm }); + const s = a4(i.inputs, r); + return H0([n, s]); } -async function CN(t) { +function nL() { + let t = () => { + }, e = () => { + }; + return { promise: new Promise((n, i) => { + t = n, e = i; + }), resolve: t, reject: e }; +} +const rm = /* @__PURE__ */ new Map(), Y2 = /* @__PURE__ */ new Map(); +let iL = 0; +function sL(t, e, r) { + const n = ++iL, i = () => rm.get(t) || [], s = () => { + const d = i(); + rm.set(t, d.filter((p) => p.id !== n)); + }, o = () => { + const d = i(); + if (!d.some((w) => w.id === n)) + return; + const p = Y2.get(t); + if (d.length === 1 && p) { + const w = p(); + w instanceof Promise && w.catch(() => { + }); + } + s(); + }, a = i(); + if (rm.set(t, [ + ...a, + { id: n, fns: e } + ]), a && a.length > 0) + return o; + const u = {}; + for (const d in e) + u[d] = (...p) => { + var _, P; + const w = i(); + if (w.length !== 0) + for (const O of w) + (P = (_ = O.fns)[d]) == null || P.call(_, ...p); + }; + const l = r(u); + return typeof l == "function" && Y2.set(t, l), o; +} +async function _1(t) { return new Promise((e) => setTimeout(e, t)); } -class Fl extends yt { +function oL(t, { emitOnBegin: e, initialWaitTime: r, interval: n }) { + let i = !0; + const s = () => i = !1; + return (async () => { + let a; + a = await t({ unpoll: s }); + const u = await (r == null ? void 0 : r(a)) ?? n; + await _1(u); + const l = async () => { + i && (await t({ unpoll: s }), await _1(n), l()); + }; + l(); + })(), s; +} +class Pc extends gt { constructor({ docsPath: e } = {}) { super([ "Could not find an Account to execute with this Action.", @@ -3943,7 +4201,7 @@ class Fl extends yt { }); } } -class qg extends yt { +class Dd extends gt { constructor({ docsPath: e, metaMessages: r, type: n }) { super(`Account type "${n}" is not supported.`, { docsPath: e, @@ -3952,96 +4210,97 @@ class qg extends yt { }); } } -function a4({ chain: t, currentChainId: e }) { +function T4({ chain: t, currentChainId: e }) { if (!t) - throw new MN(); + throw new tL(); if (e !== t.id) - throw new PN({ chain: t, currentChainId: e }); + throw new eL({ chain: t, currentChainId: e }); } -function TN(t, { docsPath: e, ...r }) { +function R4(t, { docsPath: e, ...r }) { const n = (() => { - const i = Z5(t, r); - return i instanceof Tv ? t : i; + const i = w4(t, r); + return i instanceof Hv ? t : i; })(); - return new TO(n, { + return new iN(n, { docsPath: e, ...r }); } -async function c4(t, { serializedTransaction: e }) { +async function D4(t, { serializedTransaction: e }) { return t.request({ method: "eth_sendRawTransaction", params: [e] }, { retryCount: 0 }); } -const zg = new T0(128); -async function Lv(t, e) { - var B, $, H, U; - const { account: r = t.account, chain: n = t.chain, accessList: i, authorizationList: s, blobs: o, data: a, gas: u, gasPrice: l, maxFeePerBlobGas: d, maxFeePerGas: p, maxPriorityFeePerGas: w, nonce: A, value: M, ...N } = e; +const nm = new W0(128); +async function G0(t, e) { + var k, q, U, V; + const { account: r = t.account, chain: n = t.chain, accessList: i, authorizationList: s, blobs: o, data: a, gas: u, gasPrice: l, maxFeePerBlobGas: d, maxFeePerGas: p, maxPriorityFeePerGas: w, nonce: _, type: P, value: O, ...L } = e; if (typeof r > "u") - throw new Fl({ + throw new Pc({ docsPath: "/docs/actions/wallet/sendTransaction" }); - const L = r ? qo(r) : null; + const B = r ? _i(r) : null; try { - O0(e); - const V = await (async () => { + V0(e); + const Q = await (async () => { if (e.to) return e.to; - if (s && s.length > 0) - return await X5({ + if (e.to !== null && s && s.length > 0) + return await y4({ authorization: s[0] }).catch(() => { - throw new yt("`to` is required. Could not infer from `authorizationList`."); + throw new gt("`to` is required. Could not infer from `authorizationList`."); }); })(); - if ((L == null ? void 0 : L.type) === "json-rpc" || L === null) { - let te; - n !== null && (te = await bi(t, N0, "getChainId")({}), a4({ - currentChainId: te, + if ((B == null ? void 0 : B.type) === "json-rpc" || B === null) { + let R; + n !== null && (R = await Xn(t, Gl, "getChainId")({}), T4({ + currentChainId: R, chain: n })); - const R = (H = ($ = (B = t.chain) == null ? void 0 : B.formatters) == null ? void 0 : $.transactionRequest) == null ? void 0 : H.format, ge = (R || Rv)({ + const K = (U = (q = (k = t.chain) == null ? void 0 : k.formatters) == null ? void 0 : q.transactionRequest) == null ? void 0 : U.format, Ee = (K || Kv)({ // Pick out extra data that might exist on the chain's transaction request type. - ...Q5(N, { format: R }), + ...x4(L, { format: K }), accessList: i, authorizationList: s, blobs: o, - chainId: te, + chainId: R, data: a, - from: L == null ? void 0 : L.address, + from: B == null ? void 0 : B.address, gas: u, gasPrice: l, maxFeePerBlobGas: d, maxFeePerGas: p, maxPriorityFeePerGas: w, - nonce: A, - to: V, - value: M - }), Ee = zg.get(t.uid), Y = Ee ? "wallet_sendTransaction" : "eth_sendTransaction"; + nonce: _, + to: Q, + type: P, + value: O + }), Y = nm.get(t.uid), A = Y ? "wallet_sendTransaction" : "eth_sendTransaction"; try { return await t.request({ - method: Y, - params: [ge] + method: A, + params: [Ee] }, { retryCount: 0 }); - } catch (S) { - if (Ee === !1) - throw S; - const m = S; - if (m.name === "InvalidInputRpcError" || m.name === "InvalidParamsRpcError" || m.name === "MethodNotFoundRpcError" || m.name === "MethodNotSupportedRpcError") + } catch (m) { + if (Y === !1) + throw m; + const f = m; + if (f.name === "InvalidInputRpcError" || f.name === "InvalidParamsRpcError" || f.name === "MethodNotFoundRpcError" || f.name === "MethodNotSupportedRpcError") return await t.request({ method: "wallet_sendTransaction", - params: [ge] - }, { retryCount: 0 }).then((f) => (zg.set(t.uid, !0), f)).catch((f) => { - const g = f; - throw g.name === "MethodNotFoundRpcError" || g.name === "MethodNotSupportedRpcError" ? (zg.set(t.uid, !1), m) : g; + params: [Ee] + }, { retryCount: 0 }).then((g) => (nm.set(t.uid, !0), g)).catch((g) => { + const b = g; + throw b.name === "MethodNotFoundRpcError" || b.name === "MethodNotSupportedRpcError" ? (nm.set(t.uid, !1), f) : b; }); - throw m; + throw f; } } - if ((L == null ? void 0 : L.type) === "local") { - const te = await bi(t, Nv, "prepareTransactionRequest")({ - account: L, + if ((B == null ? void 0 : B.type) === "local") { + const R = await Xn(t, Yv, "prepareTransactionRequest")({ + account: B, accessList: i, authorizationList: s, blobs: o, @@ -4052,57 +4311,58 @@ async function Lv(t, e) { maxFeePerBlobGas: d, maxFeePerGas: p, maxPriorityFeePerGas: w, - nonce: A, - nonceManager: L.nonceManager, - parameters: [...o4, "sidecars"], - value: M, - ...N, - to: V - }), R = (U = n == null ? void 0 : n.serializers) == null ? void 0 : U.transaction, K = await L.signTransaction(te, { - serializer: R + nonce: _, + nonceManager: B.nonceManager, + parameters: [...C4, "sidecars"], + type: P, + value: O, + ...L, + to: Q + }), K = (V = n == null ? void 0 : n.serializers) == null ? void 0 : V.transaction, ge = await B.signTransaction(R, { + serializer: K }); - return await bi(t, c4, "sendRawTransaction")({ - serializedTransaction: K + return await Xn(t, D4, "sendRawTransaction")({ + serializedTransaction: ge }); } - throw (L == null ? void 0 : L.type) === "smart" ? new qg({ + throw (B == null ? void 0 : B.type) === "smart" ? new Dd({ metaMessages: [ "Consider using the `sendUserOperation` Action instead." ], docsPath: "/docs/actions/bundler/sendUserOperation", type: "smart" - }) : new qg({ + }) : new Dd({ docsPath: "/docs/actions/wallet/sendTransaction", - type: L == null ? void 0 : L.type + type: B == null ? void 0 : B.type }); - } catch (V) { - throw V instanceof qg ? V : TN(V, { + } catch (Q) { + throw Q instanceof Dd ? Q : R4(Q, { ...e, - account: L, + account: B, chain: e.chain || void 0 }); } } -async function RN(t, e) { +async function aL(t, e) { const { abi: r, account: n = t.account, address: i, args: s, dataSuffix: o, functionName: a, ...u } = e; if (typeof n > "u") - throw new Fl({ + throw new Pc({ docsPath: "/docs/contract/writeContract" }); - const l = n ? qo(n) : null, d = sO({ + const l = n ? _i(n) : null, d = f4({ abi: r, args: s, functionName: a }); try { - return await bi(t, Lv, "sendTransaction")({ + return await Xn(t, G0, "sendTransaction")({ data: `${d}${o ? o.replace("0x", "") : ""}`, to: i, account: l, ...u }); } catch (p) { - throw jO(p, { + throw dN(p, { abi: r, address: i, args: s, @@ -4112,75 +4372,211 @@ async function RN(t, e) { }); } } -async function DN(t, { chain: e }) { - const { id: r, name: n, nativeCurrency: i, rpcUrls: s, blockExplorers: o } = e; - await t.request({ - method: "wallet_addEthereumChain", - params: [ - { - chainId: Mr(r), - chainName: n, - nativeCurrency: i, - rpcUrls: s.default.http, - blockExplorerUrls: o ? Object.values(o).map(({ url: a }) => a) : void 0 +const cL = { + "0x0": "reverted", + "0x1": "success" +}, O4 = "0x5792579257925792579257925792579257925792579257925792579257925792", N4 = vr(0, { + size: 32 +}); +async function uL(t, e) { + const { account: r = t.account, capabilities: n, chain: i = t.chain, experimental_fallback: s, experimental_fallbackDelay: o = 32, forceAtomic: a = !1, id: u, version: l = "2.0.0" } = e, d = r ? _i(r) : null, p = e.calls.map((w) => { + const _ = w, P = _.abi ? f4({ + abi: _.abi, + functionName: _.functionName, + args: _.args + }) : _.data; + return { + data: _.dataSuffix && P ? Ea([P, _.dataSuffix]) : P, + to: _.to, + value: _.value ? vr(_.value) : void 0 + }; + }); + try { + const w = await t.request({ + method: "wallet_sendCalls", + params: [ + { + atomicRequired: a, + calls: p, + capabilities: n, + chainId: vr(i.id), + from: d == null ? void 0 : d.address, + id: u, + version: l + } + ] + }, { retryCount: 0 }); + return typeof w == "string" ? { id: w } : w; + } catch (w) { + const _ = w; + if (s && (_.name === "MethodNotFoundRpcError" || _.name === "MethodNotSupportedRpcError" || _.name === "UnknownRpcError" || _.details.toLowerCase().includes("does not exist / is not available") || _.details.toLowerCase().includes("missing or invalid. request()") || _.details.toLowerCase().includes("did not match any variant of untagged enum") || _.details.toLowerCase().includes("account upgraded to unsupported contract") || _.details.toLowerCase().includes("eip-7702 not supported") || _.details.toLowerCase().includes("unsupported wc_ method"))) { + if (n && Object.values(n).some((k) => !k.optional)) { + const k = "non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`."; + throw new Cu(new gt(k, { + details: k + })); } - ] - }, { dedupe: !0, retryCount: 0 }); + if (a && p.length > 1) { + const B = "`forceAtomic` is not supported on fallback to `eth_sendTransaction`."; + throw new Tu(new gt(B, { + details: B + })); + } + const P = []; + for (const B of p) { + const k = G0(t, { + account: d, + chain: i, + data: B.data, + to: B.to, + value: B.value ? wa(B.value) : void 0 + }); + P.push(k), o > 0 && await new Promise((q) => setTimeout(q, o)); + } + const O = await Promise.allSettled(P); + if (O.every((B) => B.status === "rejected")) + throw O[0].reason; + const L = O.map((B) => B.status === "fulfilled" ? B.value : N4); + return { + id: Ea([ + ...L, + vr(i.id, { size: 32 }), + O4 + ]) + }; + } + throw R4(w, { + ...e, + account: d, + chain: e.chain + }); + } } -const a1 = 256; -let nd = a1, id; -function u4(t = 11) { - if (!id || nd + t > a1 * 2) { - id = "", nd = 0; - for (let e = 0; e < a1; e++) - id += (256 + Math.random() * 256 | 0).toString(16).substring(1); +async function L4(t, e) { + async function r(d) { + if (d.endsWith(O4.slice(2))) { + const w = j0(l1(d, -64, -32)), _ = l1(d, 0, -64).slice(2).match(/.{1,64}/g), P = await Promise.all(_.map((L) => N4.slice(2) !== L ? t.request({ + method: "eth_getTransactionReceipt", + params: [`0x${L}`] + }, { dedupe: !0 }) : void 0)), O = P.some((L) => L === null) ? 100 : P.every((L) => (L == null ? void 0 : L.status) === "0x1") ? 200 : P.every((L) => (L == null ? void 0 : L.status) === "0x0") ? 500 : 600; + return { + atomic: !1, + chainId: xa(w), + receipts: P.filter(Boolean), + status: O, + version: "2.0.0" + }; + } + return t.request({ + method: "wallet_getCallsStatus", + params: [d] + }); } - return id.substring(nd, nd++ + t); + const { atomic: n = !1, chainId: i, receipts: s, version: o = "2.0.0", ...a } = await r(e.id), [u, l] = (() => { + const d = a.status; + return d >= 100 && d < 200 ? ["pending", d] : d >= 200 && d < 300 ? ["success", d] : d >= 300 && d < 700 ? ["failure", d] : d === "CONFIRMED" ? ["success", 200] : d === "PENDING" ? ["pending", 100] : [void 0, d]; + })(); + return { + ...a, + atomic: n, + // @ts-expect-error: for backwards compatibility + chainId: i ? xa(i) : void 0, + receipts: (s == null ? void 0 : s.map((d) => ({ + ...d, + blockNumber: wa(d.blockNumber), + gasUsed: wa(d.gasUsed), + status: cL[d.status] + }))) ?? [], + statusCode: l, + status: u, + version: o + }; } -function ON(t) { - const { batch: e, cacheTime: r = t.pollingInterval ?? 4e3, ccipRead: n, key: i = "base", name: s = "Base Client", pollingInterval: o = 4e3, type: a = "base" } = t, u = t.chain, l = t.account ? qo(t.account) : void 0, { config: d, request: p, value: w } = t.transport({ - chain: u, - pollingInterval: o - }), A = { ...d, ...w }, M = { - account: l, +async function fL(t, e) { + const { id: r, pollingInterval: n = t.pollingInterval, status: i = ({ statusCode: w }) => w >= 200, timeout: s = 6e4 } = e, o = Ac(["waitForCallsStatus", t.uid, r]), { promise: a, resolve: u, reject: l } = nL(); + let d; + const p = sL(o, { resolve: u, reject: l }, (w) => { + const _ = oL(async () => { + const P = (O) => { + clearTimeout(d), _(), O(), p(); + }; + try { + const O = await L4(t, { id: r }); + if (!i(O)) + return; + P(() => w.resolve(O)); + } catch (O) { + P(() => w.reject(O)); + } + }, { + interval: n, + emitOnBegin: !0 + }); + return _; + }); + return d = s ? setTimeout(() => { + p(), clearTimeout(d), l(new lL({ id: r })); + }, s) : void 0, await a; +} +class lL extends gt { + constructor({ id: e }) { + super(`Timed out while waiting for call bundle with id "${e}" to be confirmed.`, { name: "WaitForCallsStatusTimeoutError" }); + } +} +const E1 = 256; +let hd = E1, dd; +function k4(t = 11) { + if (!dd || hd + t > E1 * 2) { + dd = "", hd = 0; + for (let e = 0; e < E1; e++) + dd += (256 + Math.random() * 256 | 0).toString(16).substring(1); + } + return dd.substring(hd, hd++ + t); +} +function hL(t) { + const { batch: e, chain: r, ccipRead: n, key: i = "base", name: s = "Base Client", type: o = "base" } = t, a = (r == null ? void 0 : r.blockTime) ?? 12e3, u = Math.min(Math.max(Math.floor(a / 2), 500), 4e3), l = t.pollingInterval ?? u, d = t.cacheTime ?? l, p = t.account ? _i(t.account) : void 0, { config: w, request: _, value: P } = t.transport({ + chain: r, + pollingInterval: l + }), O = { ...w, ...P }, L = { + account: p, batch: e, - cacheTime: r, + cacheTime: d, ccipRead: n, - chain: u, + chain: r, key: i, name: s, - pollingInterval: o, - request: p, - transport: A, - type: a, - uid: u4() + pollingInterval: l, + request: _, + transport: O, + type: o, + uid: k4() }; - function N(L) { - return (B) => { - const $ = B(L); - for (const U in M) - delete $[U]; - const H = { ...L, ...$ }; - return Object.assign(H, { extend: N(H) }); + function B(k) { + return (q) => { + const U = q(k); + for (const Q in L) + delete U[Q]; + const V = { ...k, ...U }; + return Object.assign(V, { extend: B(V) }); }; } - return Object.assign(M, { extend: N(M) }); + return Object.assign(L, { extend: B(L) }); } -const sd = /* @__PURE__ */ new T0(8192); -function NN(t, { enabled: e = !0, id: r }) { +const pd = /* @__PURE__ */ new W0(8192); +function dL(t, { enabled: e = !0, id: r }) { if (!e || !r) return t(); - if (sd.get(r)) - return sd.get(r); - const n = t().finally(() => sd.delete(r)); - return sd.set(r, n), n; + if (pd.get(r)) + return pd.get(r); + const n = t().finally(() => pd.delete(r)); + return pd.set(r, n), n; } -function LN(t, { delay: e = 100, retryCount: r = 2, shouldRetry: n = () => !0 } = {}) { +function pL(t, { delay: e = 100, retryCount: r = 2, shouldRetry: n = () => !0 } = {}) { return new Promise((i, s) => { const o = async ({ count: a = 0 } = {}) => { const u = async ({ error: l }) => { const d = typeof e == "function" ? e({ count: a, error: l }) : e; - d && await CN(d), o({ count: a + 1 }); + d && await _1(d), o({ count: a + 1 }); }; try { const l = await t(); @@ -4194,116 +4590,141 @@ function LN(t, { delay: e = 100, retryCount: r = 2, shouldRetry: n = () => !0 } o(); }); } -function kN(t, e = {}) { +function gL(t, e = {}) { return async (r, n = {}) => { - const { dedupe: i = !1, retryDelay: s = 150, retryCount: o = 3, uid: a } = { + var p; + const { dedupe: i = !1, methods: s, retryDelay: o = 150, retryCount: a = 3, uid: u } = { ...e, ...n - }, u = i ? $l(I0(`${a}.${Ru(r)}`)) : void 0; - return NN(() => LN(async () => { + }, { method: l } = r; + if ((p = s == null ? void 0 : s.exclude) != null && p.includes(l)) + throw new cc(new Error("method not supported"), { + method: l + }); + if (s != null && s.include && !s.include.includes(l)) + throw new cc(new Error("method not supported"), { + method: l + }); + const d = i ? U0(`${u}.${Ac(r)}`) : void 0; + return dL(() => pL(async () => { try { return await t(r); - } catch (l) { - const d = l; - switch (d.code) { - case rl.code: - throw new rl(d); - case nl.code: - throw new nl(d); - case il.code: - throw new il(d, { method: r.method }); - case sl.code: - throw new sl(d); - case uc.code: - throw new uc(d); - case ol.code: - throw new ol(d); - case al.code: - throw new al(d); - case cl.code: - throw new cl(d); + } catch (w) { + const _ = w; + switch (_.code) { case ul.code: - throw new ul(d); + throw new ul(_); case fl.code: - throw new fl(d, { - method: r.method - }); - case xu.code: - throw new xu(d); + throw new fl(_); case ll.code: - throw new ll(d); - case cu.code: - throw new cu(d); + throw new ll(_, { method: r.method }); case hl.code: - throw new hl(d); + throw new hl(_); + case vc.code: + throw new vc(_); case dl.code: - throw new dl(d); + throw new dl(_); case pl.code: - throw new pl(d); + throw new pl(_); case gl.code: - throw new gl(d); + throw new gl(_); case ml.code: - throw new ml(d); + throw new ml(_); + case cc.code: + throw new cc(_, { + method: r.method + }); + case Iu.code: + throw new Iu(_); + case vl.code: + throw new vl(_); + case bu.code: + throw new bu(_); + case bl.code: + throw new bl(_); + case yl.code: + throw new yl(_); + case wl.code: + throw new wl(_); + case xl.code: + throw new xl(_); + case _l.code: + throw new _l(_); + case Cu.code: + throw new Cu(_); + case El.code: + throw new El(_); + case Sl.code: + throw new Sl(_); + case Al.code: + throw new Al(_); + case Pl.code: + throw new Pl(_); + case Ml.code: + throw new Ml(_); + case Tu.code: + throw new Tu(_); case 5e3: - throw new cu(d); + throw new bu(_); default: - throw l instanceof yt ? l : new BO(d); + throw w instanceof gt ? w : new lN(_); } } }, { - delay: ({ count: l, error: d }) => { - var p; - if (d && d instanceof G5) { - const w = (p = d == null ? void 0 : d.headers) == null ? void 0 : p.get("Retry-After"); - if (w != null && w.match(/\d/)) - return Number.parseInt(w) * 1e3; - } - return ~~(1 << l) * s; + delay: ({ count: w, error: _ }) => { + var P; + if (_ && _ instanceof g4) { + const O = (P = _ == null ? void 0 : _.headers) == null ? void 0 : P.get("Retry-After"); + if (O != null && O.match(/\d/)) + return Number.parseInt(O) * 1e3; + } + return ~~(1 << w) * o; }, - retryCount: o, - shouldRetry: ({ error: l }) => $N(l) - }), { enabled: i, id: u }); + retryCount: a, + shouldRetry: ({ error: w }) => mL(w) + }), { enabled: i, id: d }); }; } -function $N(t) { - return "code" in t && typeof t.code == "number" ? t.code === -1 || t.code === xu.code || t.code === uc.code : t instanceof G5 && t.status ? t.status === 403 || t.status === 408 || t.status === 413 || t.status === 429 || t.status === 500 || t.status === 502 || t.status === 503 || t.status === 504 : !0; +function mL(t) { + return "code" in t && typeof t.code == "number" ? t.code === -1 || t.code === Iu.code || t.code === vc.code : t instanceof g4 && t.status ? t.status === 403 || t.status === 408 || t.status === 413 || t.status === 429 || t.status === 500 || t.status === 502 || t.status === 503 || t.status === 504 : !0; } -function BN({ key: t, name: e, request: r, retryCount: n = 3, retryDelay: i = 150, timeout: s, type: o }, a) { - const u = u4(); +function vL({ key: t, methods: e, name: r, request: n, retryCount: i = 3, retryDelay: s = 150, timeout: o, type: a }, u) { + const l = k4(); return { config: { key: t, - name: e, - request: r, - retryCount: n, - retryDelay: i, - timeout: s, - type: o + methods: e, + name: r, + request: n, + retryCount: i, + retryDelay: s, + timeout: o, + type: a }, - request: kN(r, { retryCount: n, retryDelay: i, uid: u }), - value: a + request: gL(n, { methods: e, retryCount: i, retryDelay: s, uid: l }), + value: u }; } -function FN(t, e = {}) { - const { key: r = "custom", name: n = "Custom Provider", retryDelay: i } = e; - return ({ retryCount: s }) => BN({ +function gd(t, e = {}) { + const { key: r = "custom", methods: n, name: i = "Custom Provider", retryDelay: s } = e; + return ({ retryCount: o }) => vL({ key: r, - name: n, + methods: n, + name: i, request: t.request.bind(t), - retryCount: e.retryCount ?? s, - retryDelay: i, + retryCount: e.retryCount ?? o, + retryDelay: s, type: "custom" }); } -const jN = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, UN = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/; -class qN extends yt { +class bL extends gt { constructor({ domain: e }) { - super(`Invalid domain "${Ru(e)}".`, { + super(`Invalid domain "${Ac(e)}".`, { metaMessages: ["Must be a valid EIP-712 domain."] }); } } -class zN extends yt { +class yL extends gt { constructor({ primaryType: e, types: r }) { super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`, { docsPath: "/api/glossary/Errors#typeddatainvalidprimarytypeerror", @@ -4311,7 +4732,7 @@ class zN extends yt { }); } } -class WN extends yt { +class wL extends gt { constructor({ type: e }) { super(`Struct type "${e}" is invalid.`, { metaMessages: ["Struct type must not be a Solidity type."], @@ -4319,62 +4740,62 @@ class WN extends yt { }); } } -function HN(t) { +function xL(t) { const { domain: e, message: r, primaryType: n, types: i } = t, s = (u, l) => { const d = { ...l }; for (const p of u) { - const { name: w, type: A } = p; - A === "address" && (d[w] = d[w].toLowerCase()); + const { name: w, type: _ } = p; + _ === "address" && (d[w] = d[w].toLowerCase()); } return d; }, o = i.EIP712Domain ? e ? s(i.EIP712Domain, e) : {} : {}, a = (() => { if (n !== "EIP712Domain") return s(i[n], r); })(); - return Ru({ domain: o, message: a, primaryType: n, types: i }); + return Ac({ domain: o, message: a, primaryType: n, types: i }); } -function KN(t) { +function _L(t) { const { domain: e, message: r, primaryType: n, types: i } = t, s = (o, a) => { for (const u of o) { - const { name: l, type: d } = u, p = a[l], w = d.match(UN); + const { name: l, type: d } = u, p = a[l], w = d.match(o4); if (w && (typeof p == "number" || typeof p == "bigint")) { - const [N, L, B] = w; - Mr(p, { + const [O, L, B] = w; + vr(p, { signed: L === "int", size: Number.parseInt(B) / 8 }); } - if (d === "address" && typeof p == "string" && !ko(p)) - throw new yu({ address: p }); - const A = d.match(jN); - if (A) { - const [N, L] = A; - if (L && An(p) !== Number.parseInt(L)) - throw new ZR({ + if (d === "address" && typeof p == "string" && !Ms(p)) + throw new _a({ address: p }); + const _ = d.match(SO); + if (_) { + const [O, L] = _; + if (L && xn(p) !== Number.parseInt(L)) + throw new PD({ expectedSize: Number.parseInt(L), - givenSize: An(p) + givenSize: xn(p) }); } - const M = i[d]; - M && (GN(d), s(M, p)); + const P = i[d]; + P && (SL(d), s(P, p)); } }; if (i.EIP712Domain && e) { if (typeof e != "object") - throw new qN({ domain: e }); + throw new bL({ domain: e }); s(i.EIP712Domain, e); } if (n !== "EIP712Domain") if (i[n]) s(i[n], r); else - throw new zN({ primaryType: n, types: i }); + throw new yL({ primaryType: n, types: i }); } -function VN({ domain: t }) { +function EL({ domain: t }) { return [ typeof (t == null ? void 0 : t.name) == "string" && { name: "name", type: "string" }, (t == null ? void 0 : t.version) && { name: "version", type: "string" }, - typeof (t == null ? void 0 : t.chainId) == "number" && { + (typeof (t == null ? void 0 : t.chainId) == "number" || typeof (t == null ? void 0 : t.chainId) == "bigint") && { name: "chainId", type: "uint256" }, @@ -4385,65 +4806,138 @@ function VN({ domain: t }) { (t == null ? void 0 : t.salt) && { name: "salt", type: "bytes32" } ].filter(Boolean); } -function GN(t) { +function SL(t) { if (t === "address" || t === "bool" || t === "string" || t.startsWith("bytes") || t.startsWith("uint") || t.startsWith("int")) - throw new WN({ type: t }); + throw new wL({ type: t }); +} +async function AL(t, { chain: e }) { + const { id: r, name: n, nativeCurrency: i, rpcUrls: s, blockExplorers: o } = e; + await t.request({ + method: "wallet_addEthereumChain", + params: [ + { + chainId: vr(r), + chainName: n, + nativeCurrency: i, + rpcUrls: s.default.http, + blockExplorerUrls: o ? Object.values(o).map(({ url: a }) => a) : void 0 + } + ] + }, { dedupe: !0, retryCount: 0 }); } -function YN(t, e) { - const { abi: r, args: n, bytecode: i, ...s } = e, o = IN({ abi: r, args: n, bytecode: i }); - return Lv(t, { +function PL(t, e) { + const { abi: r, args: n, bytecode: i, ...s } = e, o = rL({ abi: r, args: n, bytecode: i }); + return G0(t, { ...s, + ...s.authorizationList ? { to: null } : {}, data: o }); } -async function JN(t) { +async function ML(t) { var r; - return ((r = t.account) == null ? void 0 : r.type) === "local" ? [t.account.address] : (await t.request({ method: "eth_accounts" }, { dedupe: !0 })).map((n) => Bl(n)); + return ((r = t.account) == null ? void 0 : r.type) === "local" ? [t.account.address] : (await t.request({ method: "eth_accounts" }, { dedupe: !0 })).map((n) => Vl(n)); +} +async function IL(t, e = {}) { + const { account: r = t.account, chainId: n } = e, i = r ? _i(r) : void 0, s = n ? [i == null ? void 0 : i.address, [vr(n)]] : [i == null ? void 0 : i.address], o = await t.request({ + method: "wallet_getCapabilities", + params: s + }), a = {}; + for (const [u, l] of Object.entries(o)) { + a[Number(u)] = {}; + for (let [d, p] of Object.entries(l)) + d === "addSubAccount" && (d = "unstable_addSubAccount"), a[Number(u)][d] = p; + } + return typeof n == "number" ? a[n] : a; } -async function XN(t) { +async function CL(t) { return await t.request({ method: "wallet_getPermissions" }, { dedupe: !0 }); } -async function ZN(t) { - return (await t.request({ method: "eth_requestAccounts" }, { dedupe: !0, retryCount: 0 })).map((r) => Sv(r)); +async function $4(t, e) { + var u; + const { account: r = t.account, chainId: n, nonce: i } = e; + if (!r) + throw new Pc({ + docsPath: "/docs/eip7702/prepareAuthorization" + }); + const s = _i(r), o = (() => { + if (e.executor) + return e.executor === "self" ? e.executor : _i(e.executor); + })(), a = { + address: e.contractAddress ?? e.address, + chainId: n, + nonce: i + }; + return typeof a.chainId > "u" && (a.chainId = ((u = t.chain) == null ? void 0 : u.id) ?? await Xn(t, Gl, "getChainId")({})), typeof a.nonce > "u" && (a.nonce = await Xn(t, E4, "getTransactionCount")({ + address: s.address, + blockTag: "pending" + }), (o === "self" || o != null && o.address && QN(o.address, s.address)) && (a.nonce += 1)), a; +} +async function TL(t) { + return (await t.request({ method: "eth_requestAccounts" }, { dedupe: !0, retryCount: 0 })).map((r) => Fv(r)); } -async function QN(t, e) { +async function RL(t, e) { return t.request({ method: "wallet_requestPermissions", params: [e] }, { retryCount: 0 }); } -async function eL(t, { account: e = t.account, message: r }) { +async function DL(t, e) { + const { id: r } = e; + await t.request({ + method: "wallet_showCallsStatus", + params: [r] + }); +} +async function OL(t, e) { + const { account: r = t.account } = e; + if (!r) + throw new Pc({ + docsPath: "/docs/eip7702/signAuthorization" + }); + const n = _i(r); + if (!n.signAuthorization) + throw new Dd({ + docsPath: "/docs/eip7702/signAuthorization", + metaMessages: [ + "The `signAuthorization` Action does not support JSON-RPC Accounts." + ], + type: n.type + }); + const i = await $4(t, e); + return n.signAuthorization(i); +} +async function NL(t, { account: e = t.account, message: r }) { if (!e) - throw new Fl({ + throw new Pc({ docsPath: "/docs/actions/wallet/signMessage" }); - const n = qo(e); + const n = _i(e); if (n.signMessage) return n.signMessage({ message: r }); - const i = typeof r == "string" ? I0(r) : r.raw instanceof Uint8Array ? zd(r.raw) : r.raw; + const i = typeof r == "string" ? U0(r) : r.raw instanceof Uint8Array ? t0(r.raw) : r.raw; return t.request({ method: "personal_sign", params: [i, n.address] }, { retryCount: 0 }); } -async function tL(t, e) { +async function LL(t, e) { var l, d, p, w; const { account: r = t.account, chain: n = t.chain, ...i } = e; if (!r) - throw new Fl({ + throw new Pc({ docsPath: "/docs/actions/wallet/signTransaction" }); - const s = qo(r); - O0({ + const s = _i(r); + V0({ account: s, ...e }); - const o = await bi(t, N0, "getChainId")({}); - n !== null && a4({ + const o = await Xn(t, Gl, "getChainId")({}); + n !== null && T4({ currentChainId: o, chain: n }); - const a = (n == null ? void 0 : n.formatters) || ((l = t.chain) == null ? void 0 : l.formatters), u = ((d = a == null ? void 0 : a.transactionRequest) == null ? void 0 : d.format) || Rv; + const a = (n == null ? void 0 : n.formatters) || ((l = t.chain) == null ? void 0 : l.formatters), u = ((d = a == null ? void 0 : a.transactionRequest) == null ? void 0 : d.format) || Kv; return s.signTransaction ? s.signTransaction({ ...i, chainId: o @@ -4452,98 +4946,106 @@ async function tL(t, e) { params: [ { ...u(i), - chainId: Mr(o), + chainId: vr(o), from: s.address } ] }, { retryCount: 0 }); } -async function rL(t, e) { +async function kL(t, e) { const { account: r = t.account, domain: n, message: i, primaryType: s } = e; if (!r) - throw new Fl({ + throw new Pc({ docsPath: "/docs/actions/wallet/signTypedData" }); - const o = qo(r), a = { - EIP712Domain: VN({ domain: n }), + const o = _i(r), a = { + EIP712Domain: EL({ domain: n }), ...e.types }; - if (KN({ domain: n, message: i, primaryType: s, types: a }), o.signTypedData) + if (_L({ domain: n, message: i, primaryType: s, types: a }), o.signTypedData) return o.signTypedData({ domain: n, message: i, primaryType: s, types: a }); - const u = HN({ domain: n, message: i, primaryType: s, types: a }); + const u = xL({ domain: n, message: i, primaryType: s, types: a }); return t.request({ method: "eth_signTypedData_v4", params: [o.address, u] }, { retryCount: 0 }); } -async function nL(t, { id: e }) { +async function $L(t, { id: e }) { await t.request({ method: "wallet_switchEthereumChain", params: [ { - chainId: Mr(e) + chainId: vr(e) } ] }, { retryCount: 0 }); } -async function iL(t, e) { +async function BL(t, e) { return await t.request({ method: "wallet_watchAsset", params: e }, { retryCount: 0 }); } -function sL(t) { +function FL(t) { return { - addChain: (e) => DN(t, e), - deployContract: (e) => YN(t, e), - getAddresses: () => JN(t), - getChainId: () => N0(t), - getPermissions: () => XN(t), - prepareTransactionRequest: (e) => Nv(t, e), - requestAddresses: () => ZN(t), - requestPermissions: (e) => QN(t, e), - sendRawTransaction: (e) => c4(t, e), - sendTransaction: (e) => Lv(t, e), - signMessage: (e) => eL(t, e), - signTransaction: (e) => tL(t, e), - signTypedData: (e) => rL(t, e), - switchChain: (e) => nL(t, e), - watchAsset: (e) => iL(t, e), - writeContract: (e) => RN(t, e) + addChain: (e) => AL(t, e), + deployContract: (e) => PL(t, e), + getAddresses: () => ML(t), + getCallsStatus: (e) => L4(t, e), + getCapabilities: (e) => IL(t, e), + getChainId: () => Gl(t), + getPermissions: () => CL(t), + prepareAuthorization: (e) => $4(t, e), + prepareTransactionRequest: (e) => Yv(t, e), + requestAddresses: () => TL(t), + requestPermissions: (e) => RL(t, e), + sendCalls: (e) => uL(t, e), + sendRawTransaction: (e) => D4(t, e), + sendTransaction: (e) => G0(t, e), + showCallsStatus: (e) => DL(t, e), + signAuthorization: (e) => OL(t, e), + signMessage: (e) => NL(t, e), + signTransaction: (e) => LL(t, e), + signTypedData: (e) => kL(t, e), + switchChain: (e) => $L(t, e), + waitForCallsStatus: (e) => fL(t, e), + watchAsset: (e) => BL(t, e), + writeContract: (e) => aL(t, e) }; } -function oL(t) { +function md(t) { const { key: e = "wallet", name: r = "Wallet Client", transport: n } = t; - return ON({ + return hL({ ...t, key: e, name: r, transport: n, type: "walletClient" - }).extend(sL); + }).extend(FL); } -class vl { +class Il { constructor(e) { - Ds(this, "_key"); - Ds(this, "_config", null); - Ds(this, "_provider", null); - Ds(this, "_connected", !1); - Ds(this, "_address", null); - Ds(this, "_fatured", !1); - Ds(this, "_installed", !1); - Ds(this, "lastUsed", !1); + vs(this, "_key"); + vs(this, "_config", null); + vs(this, "_provider", null); + vs(this, "_connected", !1); + vs(this, "_address", null); + vs(this, "_fatured", !1); + vs(this, "_installed", !1); + vs(this, "lastUsed", !1); + vs(this, "_client", null); var r; if ("name" in e && "image" in e) this._key = e.name, this._config = e, this._fatured = e.featured; else if ("session" in e) { if (!e.session) throw new Error("session is null"); - this._key = (r = e.session) == null ? void 0 : r.peer.metadata.name, this._provider = e, this._config = { + this._key = (r = e.session) == null ? void 0 : r.peer.metadata.name, this._provider = e, this._client = md({ transport: gd(this._provider) }), this._config = { name: e.session.peer.metadata.name, image: e.session.peer.metadata.icons[0], featured: !1 }; } else if ("info" in e) - this._key = e.info.name, this._provider = e.provider, this._installed = !0, this._config = { + this._key = e.info.name, this._provider = e.provider, this._installed = !0, this._client = md({ transport: gd(this._provider) }), this._config = { name: e.info.name, image: e.info.icon, featured: !1 @@ -4570,21 +5072,31 @@ class vl { return this._provider; } get client() { - return this._provider ? oL({ transport: FN(this._provider) }) : null; + return this._client ? this._client : null; } get config() { return this._config; } static fromWalletConfig(e) { - return new vl(e); + return new Il(e); } EIP6963Detected(e) { - this._provider = e.provider, this._installed = !0, this._provider.on("disconnect", this.disconnect), this._provider.on("accountsChanged", (r) => { + this._provider = e.provider, this._client = md({ transport: gd(this._provider) }), this._installed = !0, this._provider.on("disconnect", this.disconnect), this._provider.on("accountsChanged", (r) => { this._address = r[0], this._connected = !0; }), this.testConnect(); } setUniversalProvider(e) { - this._provider = e, this.testConnect(); + this._provider = e, this._client = md({ transport: gd(this._provider) }), this.testConnect(); + } + async switchChain(e) { + var r, n, i, s; + try { + return await ((r = this.client) == null ? void 0 : r.getChainId()) === e.id || await ((n = this.client) == null ? void 0 : n.switchChain(e)), !0; + } catch (o) { + if (o.code === 4902) + return await ((i = this.client) == null ? void 0 : i.addChain({ chain: e })), await ((s = this.client) == null ? void 0 : s.switchChain(e)), !0; + throw o; + } } async testConnect() { var r; @@ -4593,7 +5105,7 @@ class vl { } async connect() { var r; - const e = await ((r = this.client) == null ? void 0 : r.request({ method: "eth_requestAccounts", params: void 0 })); + const e = await ((r = this.client) == null ? void 0 : r.requestAddresses()); if (!e) throw new Error("connect failed"); return e; } @@ -4617,58 +5129,58 @@ class vl { this._provider && "session" in this._provider && await this._provider.disconnect(), this._connected = !1, this._address = null; } } -var kv = { exports: {} }, uu = typeof Reflect == "object" ? Reflect : null, N2 = uu && typeof uu.apply == "function" ? uu.apply : function(e, r, n) { +var Jv = { exports: {} }, yu = typeof Reflect == "object" ? Reflect : null, J2 = yu && typeof yu.apply == "function" ? yu.apply : function(e, r, n) { return Function.prototype.apply.call(e, r, n); -}, xd; -uu && typeof uu.ownKeys == "function" ? xd = uu.ownKeys : Object.getOwnPropertySymbols ? xd = function(e) { +}, Od; +yu && typeof yu.ownKeys == "function" ? Od = yu.ownKeys : Object.getOwnPropertySymbols ? Od = function(e) { return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e)); -} : xd = function(e) { +} : Od = function(e) { return Object.getOwnPropertyNames(e); }; -function aL(t) { +function jL(t) { console && console.warn && console.warn(t); } -var f4 = Number.isNaN || function(e) { +var B4 = Number.isNaN || function(e) { return e !== e; }; function kr() { kr.init.call(this); } -kv.exports = kr; -kv.exports.once = lL; +Jv.exports = kr; +Jv.exports.once = WL; kr.EventEmitter = kr; kr.prototype._events = void 0; kr.prototype._eventsCount = 0; kr.prototype._maxListeners = void 0; -var L2 = 10; -function L0(t) { +var X2 = 10; +function Y0(t) { if (typeof t != "function") throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof t); } Object.defineProperty(kr, "defaultMaxListeners", { enumerable: !0, get: function() { - return L2; + return X2; }, set: function(t) { - if (typeof t != "number" || t < 0 || f4(t)) + if (typeof t != "number" || t < 0 || B4(t)) throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + t + "."); - L2 = t; + X2 = t; } }); kr.init = function() { (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0; }; kr.prototype.setMaxListeners = function(e) { - if (typeof e != "number" || e < 0 || f4(e)) + if (typeof e != "number" || e < 0 || B4(e)) throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + "."); return this._maxListeners = e, this; }; -function l4(t) { +function F4(t) { return t._maxListeners === void 0 ? kr.defaultMaxListeners : t._maxListeners; } kr.prototype.getMaxListeners = function() { - return l4(this); + return F4(this); }; kr.prototype.emit = function(e) { for (var r = [], n = 1; n < arguments.length; n++) r.push(arguments[n]); @@ -4688,51 +5200,51 @@ kr.prototype.emit = function(e) { if (u === void 0) return !1; if (typeof u == "function") - N2(u, this, r); + J2(u, this, r); else - for (var l = u.length, d = m4(u, l), n = 0; n < l; ++n) - N2(d[n], this, r); + for (var l = u.length, d = W4(u, l), n = 0; n < l; ++n) + J2(d[n], this, r); return !0; }; -function h4(t, e, r, n) { +function j4(t, e, r, n) { var i, s, o; - if (L0(r), s = t._events, s === void 0 ? (s = t._events = /* @__PURE__ */ Object.create(null), t._eventsCount = 0) : (s.newListener !== void 0 && (t.emit( + if (Y0(r), s = t._events, s === void 0 ? (s = t._events = /* @__PURE__ */ Object.create(null), t._eventsCount = 0) : (s.newListener !== void 0 && (t.emit( "newListener", e, r.listener ? r.listener : r ), s = t._events), o = s[e]), o === void 0) o = s[e] = r, ++t._eventsCount; - else if (typeof o == "function" ? o = s[e] = n ? [r, o] : [o, r] : n ? o.unshift(r) : o.push(r), i = l4(t), i > 0 && o.length > i && !o.warned) { + else if (typeof o == "function" ? o = s[e] = n ? [r, o] : [o, r] : n ? o.unshift(r) : o.push(r), i = F4(t), i > 0 && o.length > i && !o.warned) { o.warned = !0; var a = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit"); - a.name = "MaxListenersExceededWarning", a.emitter = t, a.type = e, a.count = o.length, aL(a); + a.name = "MaxListenersExceededWarning", a.emitter = t, a.type = e, a.count = o.length, jL(a); } return t; } kr.prototype.addListener = function(e, r) { - return h4(this, e, r, !1); + return j4(this, e, r, !1); }; kr.prototype.on = kr.prototype.addListener; kr.prototype.prependListener = function(e, r) { - return h4(this, e, r, !0); + return j4(this, e, r, !0); }; -function cL() { +function UL() { if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments); } -function d4(t, e, r) { - var n = { fired: !1, wrapFn: void 0, target: t, type: e, listener: r }, i = cL.bind(n); +function U4(t, e, r) { + var n = { fired: !1, wrapFn: void 0, target: t, type: e, listener: r }, i = UL.bind(n); return i.listener = r, n.wrapFn = i, i; } kr.prototype.once = function(e, r) { - return L0(r), this.on(e, d4(this, e, r)), this; + return Y0(r), this.on(e, U4(this, e, r)), this; }; kr.prototype.prependOnceListener = function(e, r) { - return L0(r), this.prependListener(e, d4(this, e, r)), this; + return Y0(r), this.prependListener(e, U4(this, e, r)), this; }; kr.prototype.removeListener = function(e, r) { var n, i, s, o, a; - if (L0(r), i = this._events, i === void 0) + if (Y0(r), i = this._events, i === void 0) return this; if (n = i[e], n === void 0) return this; @@ -4746,7 +5258,7 @@ kr.prototype.removeListener = function(e, r) { } if (s < 0) return this; - s === 0 ? n.shift() : uL(n, s), n.length === 1 && (i[e] = n[0]), i.removeListener !== void 0 && this.emit("removeListener", e, a || r); + s === 0 ? n.shift() : qL(n, s), n.length === 1 && (i[e] = n[0]), i.removeListener !== void 0 && this.emit("removeListener", e, a || r); } return this; }; @@ -4770,24 +5282,24 @@ kr.prototype.removeAllListeners = function(e) { this.removeListener(e, r[i]); return this; }; -function p4(t, e, r) { +function q4(t, e, r) { var n = t._events; if (n === void 0) return []; var i = n[e]; - return i === void 0 ? [] : typeof i == "function" ? r ? [i.listener || i] : [i] : r ? fL(i) : m4(i, i.length); + return i === void 0 ? [] : typeof i == "function" ? r ? [i.listener || i] : [i] : r ? zL(i) : W4(i, i.length); } kr.prototype.listeners = function(e) { - return p4(this, e, !0); + return q4(this, e, !0); }; kr.prototype.rawListeners = function(e) { - return p4(this, e, !1); + return q4(this, e, !1); }; kr.listenerCount = function(t, e) { - return typeof t.listenerCount == "function" ? t.listenerCount(e) : g4.call(t, e); + return typeof t.listenerCount == "function" ? t.listenerCount(e) : z4.call(t, e); }; -kr.prototype.listenerCount = g4; -function g4(t) { +kr.prototype.listenerCount = z4; +function z4(t) { var e = this._events; if (e !== void 0) { var r = e[t]; @@ -4799,24 +5311,24 @@ function g4(t) { return 0; } kr.prototype.eventNames = function() { - return this._eventsCount > 0 ? xd(this._events) : []; + return this._eventsCount > 0 ? Od(this._events) : []; }; -function m4(t, e) { +function W4(t, e) { for (var r = new Array(e), n = 0; n < e; ++n) r[n] = t[n]; return r; } -function uL(t, e) { +function qL(t, e) { for (; e + 1 < t.length; e++) t[e] = t[e + 1]; t.pop(); } -function fL(t) { +function zL(t) { for (var e = new Array(t.length), r = 0; r < e.length; ++r) e[r] = t[r].listener || t[r]; return e; } -function lL(t, e) { +function WL(t, e) { return new Promise(function(r, n) { function i(o) { t.removeListener(e, s), n(o); @@ -4824,13 +5336,13 @@ function lL(t, e) { function s() { typeof t.removeListener == "function" && t.removeListener("error", i), r([].slice.call(arguments)); } - v4(t, e, s, { once: !0 }), e !== "error" && hL(t, i, { once: !0 }); + H4(t, e, s, { once: !0 }), e !== "error" && HL(t, i, { once: !0 }); }); } -function hL(t, e, r) { - typeof t.on == "function" && v4(t, "error", e, r); +function HL(t, e, r) { + typeof t.on == "function" && H4(t, "error", e, r); } -function v4(t, e, r, n) { +function H4(t, e, r, n) { if (typeof t.on == "function") n.once ? t.once(e, r) : t.on(e, r); else if (typeof t.addEventListener == "function") @@ -4840,9 +5352,9 @@ function v4(t, e, r, n) { else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof t); } -var rs = kv.exports; -const $v = /* @__PURE__ */ ts(rs); -var mt = {}; +var is = Jv.exports; +const Xv = /* @__PURE__ */ ns(is); +var vt = {}; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. @@ -4857,30 +5369,30 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ -var c1 = function(t, e) { - return c1 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) { +var S1 = function(t, e) { + return S1 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) { r.__proto__ = n; } || function(r, n) { for (var i in n) n.hasOwnProperty(i) && (r[i] = n[i]); - }, c1(t, e); + }, S1(t, e); }; -function dL(t, e) { - c1(t, e); +function KL(t, e) { + S1(t, e); function r() { this.constructor = t; } t.prototype = e === null ? Object.create(e) : (r.prototype = e.prototype, new r()); } -var u1 = function() { - return u1 = Object.assign || function(e) { +var A1 = function() { + return A1 = Object.assign || function(e) { for (var r, n = 1, i = arguments.length; n < i; n++) { r = arguments[n]; for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]); } return e; - }, u1.apply(this, arguments); + }, A1.apply(this, arguments); }; -function pL(t, e) { +function VL(t, e) { var r = {}; for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); if (t != null && typeof Object.getOwnPropertySymbols == "function") @@ -4888,21 +5400,21 @@ function pL(t, e) { e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]); return r; } -function gL(t, e, r, n) { +function GL(t, e, r, n) { var i = arguments.length, s = i < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, r) : n, o; if (typeof Reflect == "object" && typeof Reflect.decorate == "function") s = Reflect.decorate(t, e, r, n); else for (var a = t.length - 1; a >= 0; a--) (o = t[a]) && (s = (i < 3 ? o(s) : i > 3 ? o(e, r, s) : o(e, r)) || s); return i > 3 && s && Object.defineProperty(e, r, s), s; } -function mL(t, e) { +function YL(t, e) { return function(r, n) { e(r, n, t); }; } -function vL(t, e) { +function JL(t, e) { if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(t, e); } -function bL(t, e, r, n) { +function XL(t, e, r, n) { function i(s) { return s instanceof r ? s : new r(function(o) { o(s); @@ -4929,7 +5441,7 @@ function bL(t, e, r, n) { l((n = n.apply(t, e || [])).next()); }); } -function yL(t, e) { +function ZL(t, e) { var r = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; @@ -4989,13 +5501,13 @@ function yL(t, e) { return { value: l[0] ? l[1] : void 0, done: !0 }; } } -function wL(t, e, r, n) { +function QL(t, e, r, n) { n === void 0 && (n = r), t[n] = e[r]; } -function xL(t, e) { +function ek(t, e) { for (var r in t) r !== "default" && !e.hasOwnProperty(r) && (e[r] = t[r]); } -function f1(t) { +function P1(t) { var e = typeof Symbol == "function" && Symbol.iterator, r = e && t[e], n = 0; if (r) return r.call(t); if (t && typeof t.length == "number") return { @@ -5005,7 +5517,7 @@ function f1(t) { }; throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined."); } -function b4(t, e) { +function K4(t, e) { var r = typeof Symbol == "function" && t[Symbol.iterator]; if (!r) return t; var n = r.call(t), i, s = [], o; @@ -5022,43 +5534,43 @@ function b4(t, e) { } return s; } -function _L() { +function tk() { for (var t = [], e = 0; e < arguments.length; e++) - t = t.concat(b4(arguments[e])); + t = t.concat(K4(arguments[e])); return t; } -function EL() { +function rk() { for (var t = 0, e = 0, r = arguments.length; e < r; e++) t += arguments[e].length; for (var n = Array(t), i = 0, e = 0; e < r; e++) for (var s = arguments[e], o = 0, a = s.length; o < a; o++, i++) n[i] = s[o]; return n; } -function bl(t) { - return this instanceof bl ? (this.v = t, this) : new bl(t); +function Cl(t) { + return this instanceof Cl ? (this.v = t, this) : new Cl(t); } -function SL(t, e, r) { +function nk(t, e, r) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var n = r.apply(t, e || []), i, s = []; return i = {}, o("next"), o("throw"), o("return"), i[Symbol.asyncIterator] = function() { return this; }, i; function o(w) { - n[w] && (i[w] = function(A) { - return new Promise(function(M, N) { - s.push([w, A, M, N]) > 1 || a(w, A); + n[w] && (i[w] = function(_) { + return new Promise(function(P, O) { + s.push([w, _, P, O]) > 1 || a(w, _); }); }); } - function a(w, A) { + function a(w, _) { try { - u(n[w](A)); - } catch (M) { - p(s[0][3], M); + u(n[w](_)); + } catch (P) { + p(s[0][3], P); } } function u(w) { - w.value instanceof bl ? Promise.resolve(w.value.v).then(l, d) : p(s[0][2], w); + w.value instanceof Cl ? Promise.resolve(w.value.v).then(l, d) : p(s[0][2], w); } function l(w) { a("next", w); @@ -5066,11 +5578,11 @@ function SL(t, e, r) { function d(w) { a("throw", w); } - function p(w, A) { - w(A), s.shift(), s.length && a(s[0][0], s[0][1]); + function p(w, _) { + w(_), s.shift(), s.length && a(s[0][0], s[0][1]); } } -function AL(t) { +function ik(t) { var e, r; return e = {}, n("next"), n("throw", function(i) { throw i; @@ -5079,14 +5591,14 @@ function AL(t) { }, e; function n(i, s) { e[i] = t[i] ? function(o) { - return (r = !r) ? { value: bl(t[i](o)), done: i === "return" } : s ? s(o) : o; + return (r = !r) ? { value: Cl(t[i](o)), done: i === "return" } : s ? s(o) : o; } : s; } } -function PL(t) { +function sk(t) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var e = t[Symbol.asyncIterator], r; - return e ? e.call(t) : (t = typeof f1 == "function" ? f1(t) : t[Symbol.iterator](), r = {}, n("next"), n("throw"), n("return"), r[Symbol.asyncIterator] = function() { + return e ? e.call(t) : (t = typeof P1 == "function" ? P1(t) : t[Symbol.iterator](), r = {}, n("next"), n("throw"), n("return"), r[Symbol.asyncIterator] = function() { return this; }, r); function n(s) { @@ -5102,60 +5614,60 @@ function PL(t) { }, o); } } -function ML(t, e) { +function ok(t, e) { return Object.defineProperty ? Object.defineProperty(t, "raw", { value: e }) : t.raw = e, t; } -function IL(t) { +function ak(t) { if (t && t.__esModule) return t; var e = {}; if (t != null) for (var r in t) Object.hasOwnProperty.call(t, r) && (e[r] = t[r]); return e.default = t, e; } -function CL(t) { +function ck(t) { return t && t.__esModule ? t : { default: t }; } -function TL(t, e) { +function uk(t, e) { if (!e.has(t)) throw new TypeError("attempted to get private field on non-instance"); return e.get(t); } -function RL(t, e, r) { +function fk(t, e, r) { if (!e.has(t)) throw new TypeError("attempted to set private field on non-instance"); return e.set(t, r), r; } -const DL = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +const lk = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, get __assign() { - return u1; + return A1; }, - __asyncDelegator: AL, - __asyncGenerator: SL, - __asyncValues: PL, - __await: bl, - __awaiter: bL, - __classPrivateFieldGet: TL, - __classPrivateFieldSet: RL, - __createBinding: wL, - __decorate: gL, - __exportStar: xL, - __extends: dL, - __generator: yL, - __importDefault: CL, - __importStar: IL, - __makeTemplateObject: ML, - __metadata: vL, - __param: mL, - __read: b4, - __rest: pL, - __spread: _L, - __spreadArrays: EL, - __values: f1 -}, Symbol.toStringTag, { value: "Module" })), jl = /* @__PURE__ */ yv(DL); -var Wg = {}, wf = {}, k2; -function OL() { - if (k2) return wf; - k2 = 1, Object.defineProperty(wf, "__esModule", { value: !0 }), wf.delay = void 0; + __asyncDelegator: ik, + __asyncGenerator: nk, + __asyncValues: sk, + __await: Cl, + __awaiter: XL, + __classPrivateFieldGet: uk, + __classPrivateFieldSet: fk, + __createBinding: QL, + __decorate: GL, + __exportStar: ek, + __extends: KL, + __generator: ZL, + __importDefault: ck, + __importStar: ak, + __makeTemplateObject: ok, + __metadata: JL, + __param: YL, + __read: K4, + __rest: VL, + __spread: tk, + __spreadArrays: rk, + __values: P1 +}, Symbol.toStringTag, { value: "Module" })), Yl = /* @__PURE__ */ Lv(lk); +var im = {}, Mf = {}, Z2; +function hk() { + if (Z2) return Mf; + Z2 = 1, Object.defineProperty(Mf, "__esModule", { value: !0 }), Mf.delay = void 0; function t(e) { return new Promise((r) => { setTimeout(() => { @@ -5163,52 +5675,52 @@ function OL() { }, e); }); } - return wf.delay = t, wf; + return Mf.delay = t, Mf; } -var qa = {}, Hg = {}, za = {}, $2; -function NL() { - return $2 || ($2 = 1, Object.defineProperty(za, "__esModule", { value: !0 }), za.ONE_THOUSAND = za.ONE_HUNDRED = void 0, za.ONE_HUNDRED = 100, za.ONE_THOUSAND = 1e3), za; +var Ga = {}, sm = {}, Ya = {}, Q2; +function dk() { + return Q2 || (Q2 = 1, Object.defineProperty(Ya, "__esModule", { value: !0 }), Ya.ONE_THOUSAND = Ya.ONE_HUNDRED = void 0, Ya.ONE_HUNDRED = 100, Ya.ONE_THOUSAND = 1e3), Ya; } -var Kg = {}, B2; -function LL() { - return B2 || (B2 = 1, function(t) { +var om = {}, ex; +function pk() { + return ex || (ex = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.ONE_YEAR = t.FOUR_WEEKS = t.THREE_WEEKS = t.TWO_WEEKS = t.ONE_WEEK = t.THIRTY_DAYS = t.SEVEN_DAYS = t.FIVE_DAYS = t.THREE_DAYS = t.ONE_DAY = t.TWENTY_FOUR_HOURS = t.TWELVE_HOURS = t.SIX_HOURS = t.THREE_HOURS = t.ONE_HOUR = t.SIXTY_MINUTES = t.THIRTY_MINUTES = t.TEN_MINUTES = t.FIVE_MINUTES = t.ONE_MINUTE = t.SIXTY_SECONDS = t.THIRTY_SECONDS = t.TEN_SECONDS = t.FIVE_SECONDS = t.ONE_SECOND = void 0, t.ONE_SECOND = 1, t.FIVE_SECONDS = 5, t.TEN_SECONDS = 10, t.THIRTY_SECONDS = 30, t.SIXTY_SECONDS = 60, t.ONE_MINUTE = t.SIXTY_SECONDS, t.FIVE_MINUTES = t.ONE_MINUTE * 5, t.TEN_MINUTES = t.ONE_MINUTE * 10, t.THIRTY_MINUTES = t.ONE_MINUTE * 30, t.SIXTY_MINUTES = t.ONE_MINUTE * 60, t.ONE_HOUR = t.SIXTY_MINUTES, t.THREE_HOURS = t.ONE_HOUR * 3, t.SIX_HOURS = t.ONE_HOUR * 6, t.TWELVE_HOURS = t.ONE_HOUR * 12, t.TWENTY_FOUR_HOURS = t.ONE_HOUR * 24, t.ONE_DAY = t.TWENTY_FOUR_HOURS, t.THREE_DAYS = t.ONE_DAY * 3, t.FIVE_DAYS = t.ONE_DAY * 5, t.SEVEN_DAYS = t.ONE_DAY * 7, t.THIRTY_DAYS = t.ONE_DAY * 30, t.ONE_WEEK = t.SEVEN_DAYS, t.TWO_WEEKS = t.ONE_WEEK * 2, t.THREE_WEEKS = t.ONE_WEEK * 3, t.FOUR_WEEKS = t.ONE_WEEK * 4, t.ONE_YEAR = t.ONE_DAY * 365; - }(Kg)), Kg; + }(om)), om; } -var F2; -function y4() { - return F2 || (F2 = 1, function(t) { +var tx; +function V4() { + return tx || (tx = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - const e = jl; - e.__exportStar(NL(), t), e.__exportStar(LL(), t); - }(Hg)), Hg; -} -var j2; -function kL() { - if (j2) return qa; - j2 = 1, Object.defineProperty(qa, "__esModule", { value: !0 }), qa.fromMiliseconds = qa.toMiliseconds = void 0; - const t = y4(); + const e = Yl; + e.__exportStar(dk(), t), e.__exportStar(pk(), t); + }(sm)), sm; +} +var rx; +function gk() { + if (rx) return Ga; + rx = 1, Object.defineProperty(Ga, "__esModule", { value: !0 }), Ga.fromMiliseconds = Ga.toMiliseconds = void 0; + const t = V4(); function e(n) { return n * t.ONE_THOUSAND; } - qa.toMiliseconds = e; + Ga.toMiliseconds = e; function r(n) { return Math.floor(n / t.ONE_THOUSAND); } - return qa.fromMiliseconds = r, qa; + return Ga.fromMiliseconds = r, Ga; } -var U2; -function $L() { - return U2 || (U2 = 1, function(t) { +var nx; +function mk() { + return nx || (nx = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - const e = jl; - e.__exportStar(OL(), t), e.__exportStar(kL(), t); - }(Wg)), Wg; -} -var zc = {}, q2; -function BL() { - if (q2) return zc; - q2 = 1, Object.defineProperty(zc, "__esModule", { value: !0 }), zc.Watch = void 0; + const e = Yl; + e.__exportStar(hk(), t), e.__exportStar(gk(), t); + }(im)), im; +} +var Qc = {}, ix; +function vk() { + if (ix) return Qc; + ix = 1, Object.defineProperty(Qc, "__esModule", { value: !0 }), Qc.Watch = void 0; class t { constructor() { this.timestamps = /* @__PURE__ */ new Map(); @@ -5236,41 +5748,41 @@ function BL() { return n.elapsed || Date.now() - n.started; } } - return zc.Watch = t, zc.default = t, zc; + return Qc.Watch = t, Qc.default = t, Qc; } -var Vg = {}, xf = {}, z2; -function FL() { - if (z2) return xf; - z2 = 1, Object.defineProperty(xf, "__esModule", { value: !0 }), xf.IWatch = void 0; +var am = {}, If = {}, sx; +function bk() { + if (sx) return If; + sx = 1, Object.defineProperty(If, "__esModule", { value: !0 }), If.IWatch = void 0; class t { } - return xf.IWatch = t, xf; + return If.IWatch = t, If; } -var W2; -function jL() { - return W2 || (W2 = 1, function(t) { - Object.defineProperty(t, "__esModule", { value: !0 }), jl.__exportStar(FL(), t); - }(Vg)), Vg; +var ox; +function yk() { + return ox || (ox = 1, function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }), Yl.__exportStar(bk(), t); + }(am)), am; } (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - const e = jl; - e.__exportStar($L(), t), e.__exportStar(BL(), t), e.__exportStar(jL(), t), e.__exportStar(y4(), t); -})(mt); -class vc { + const e = Yl; + e.__exportStar(mk(), t), e.__exportStar(vk(), t), e.__exportStar(yk(), t), e.__exportStar(V4(), t); +})(vt); +class Mc { } -let UL = class extends vc { +let wk = class extends Mc { constructor(e) { super(); } }; -const H2 = mt.FIVE_SECONDS, Ou = { pulse: "heartbeat_pulse" }; -let qL = class w4 extends UL { +const ax = vt.FIVE_SECONDS, ju = { pulse: "heartbeat_pulse" }; +let xk = class G4 extends wk { constructor(e) { - super(e), this.events = new rs.EventEmitter(), this.interval = H2, this.interval = (e == null ? void 0 : e.interval) || H2; + super(e), this.events = new is.EventEmitter(), this.interval = ax, this.interval = (e == null ? void 0 : e.interval) || ax; } static async init(e) { - const r = new w4(e); + const r = new G4(e); return await r.init(), r; } async init() { @@ -5292,24 +5804,24 @@ let qL = class w4 extends UL { this.events.removeListener(e, r); } async initialize() { - this.intervalRef = setInterval(() => this.pulse(), mt.toMiliseconds(this.interval)); + this.intervalRef = setInterval(() => this.pulse(), vt.toMiliseconds(this.interval)); } pulse() { - this.events.emit(Ou.pulse); + this.events.emit(ju.pulse); } }; -const zL = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/, WL = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/, HL = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/; -function KL(t, e) { +const _k = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/, Ek = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/, Sk = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/; +function Ak(t, e) { if (t === "__proto__" || t === "constructor" && e && typeof e == "object" && "prototype" in e) { - VL(t); + Pk(t); return; } return e; } -function VL(t) { +function Pk(t) { console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`); } -function od(t, e = {}) { +function vd(t, e = {}) { if (typeof t != "string") return t; const r = t.trim(); @@ -5335,16 +5847,16 @@ function od(t, e = {}) { if (n === "-infinity") return Number.NEGATIVE_INFINITY; } - if (!HL.test(t)) { + if (!Sk.test(t)) { if (e.strict) throw new SyntaxError("[destr] Invalid JSON"); return t; } try { - if (zL.test(t) || WL.test(t)) { + if (_k.test(t) || Ek.test(t)) { if (e.strict) throw new Error("[destr] Possible prototype pollution"); - return JSON.parse(t, KL); + return JSON.parse(t, Ak); } return JSON.parse(t); } catch (n) { @@ -5353,61 +5865,61 @@ function od(t, e = {}) { return t; } } -function GL(t) { +function Mk(t) { return !t || typeof t.then != "function" ? Promise.resolve(t) : t; } function Cn(t, ...e) { try { - return GL(t(...e)); + return Mk(t(...e)); } catch (r) { return Promise.reject(r); } } -function YL(t) { +function Ik(t) { const e = typeof t; return t === null || e !== "object" && e !== "function"; } -function JL(t) { +function Ck(t) { const e = Object.getPrototypeOf(t); return !e || e.isPrototypeOf(Object); } -function _d(t) { - if (YL(t)) +function Nd(t) { + if (Ik(t)) return String(t); - if (JL(t) || Array.isArray(t)) + if (Ck(t) || Array.isArray(t)) return JSON.stringify(t); if (typeof t.toJSON == "function") - return _d(t.toJSON()); + return Nd(t.toJSON()); throw new Error("[unstorage] Cannot stringify value!"); } -function x4() { +function Y4() { if (typeof Buffer > "u") throw new TypeError("[unstorage] Buffer is not supported!"); } -const l1 = "base64:"; -function XL(t) { +const M1 = "base64:"; +function Tk(t) { if (typeof t == "string") return t; - x4(); + Y4(); const e = Buffer.from(t).toString("base64"); - return l1 + e; + return M1 + e; } -function ZL(t) { - return typeof t != "string" || !t.startsWith(l1) ? t : (x4(), Buffer.from(t.slice(l1.length), "base64")); +function Rk(t) { + return typeof t != "string" || !t.startsWith(M1) ? t : (Y4(), Buffer.from(t.slice(M1.length), "base64")); } -function pi(t) { +function gi(t) { return t ? t.split("?")[0].replace(/[/\\]/g, ":").replace(/:+/g, ":").replace(/^:|:$/g, "") : ""; } -function QL(...t) { - return pi(t.join(":")); +function Dk(...t) { + return gi(t.join(":")); } -function ad(t) { - return t = pi(t), t ? t + ":" : ""; +function bd(t) { + return t = gi(t), t ? t + ":" : ""; } -const ek = "memory", tk = () => { +const Ok = "memory", Nk = () => { const t = /* @__PURE__ */ new Map(); return { - name: ek, + name: Ok, getInstance: () => t, hasItem(e) { return t.has(e); @@ -5438,9 +5950,9 @@ const ek = "memory", tk = () => { } }; }; -function rk(t = {}) { +function Lk(t = {}) { const e = { - mounts: { "": t.driver || tk() }, + mounts: { "": t.driver || Nk() }, mountpoints: [""], watching: !1, watchListeners: [], @@ -5466,7 +5978,7 @@ function rk(t = {}) { driver: e.mounts[p] })), i = (l, d) => { if (e.watching) { - d = pi(d); + d = gi(d); for (const p of e.watchListeners) p(l, d); } @@ -5474,7 +5986,7 @@ function rk(t = {}) { if (!e.watching) { e.watching = !0; for (const l in e.mounts) - e.unwatch[l] = await K2( + e.unwatch[l] = await cx( e.mounts[l], i, l @@ -5487,38 +5999,38 @@ function rk(t = {}) { e.unwatch = {}, e.watching = !1; } }, a = (l, d, p) => { - const w = /* @__PURE__ */ new Map(), A = (M) => { - let N = w.get(M.base); - return N || (N = { - driver: M.driver, - base: M.base, + const w = /* @__PURE__ */ new Map(), _ = (P) => { + let O = w.get(P.base); + return O || (O = { + driver: P.driver, + base: P.base, items: [] - }, w.set(M.base, N)), N; + }, w.set(P.base, O)), O; }; - for (const M of l) { - const N = typeof M == "string", L = pi(N ? M : M.key), B = N ? void 0 : M.value, $ = N || !M.options ? d : { ...d, ...M.options }, H = r(L); - A(H).items.push({ + for (const P of l) { + const O = typeof P == "string", L = gi(O ? P : P.key), B = O ? void 0 : P.value, k = O || !P.options ? d : { ...d, ...P.options }, q = r(L); + _(q).items.push({ key: L, value: B, - relativeKey: H.relativeKey, - options: $ + relativeKey: q.relativeKey, + options: k }); } - return Promise.all([...w.values()].map((M) => p(M))).then( - (M) => M.flat() + return Promise.all([...w.values()].map((P) => p(P))).then( + (P) => P.flat() ); }, u = { // Item hasItem(l, d = {}) { - l = pi(l); + l = gi(l); const { relativeKey: p, driver: w } = r(l); return Cn(w.hasItem, p, d); }, getItem(l, d = {}) { - l = pi(l); + l = gi(l); const { relativeKey: p, driver: w } = r(l); return Cn(w.getItem, p, d).then( - (A) => od(A) + (_) => vd(_) ); }, getItems(l, d) { @@ -5530,34 +6042,34 @@ function rk(t = {}) { })), d ).then( - (w) => w.map((A) => ({ - key: QL(p.base, A.key), - value: od(A.value) + (w) => w.map((_) => ({ + key: Dk(p.base, _.key), + value: vd(_.value) })) ) : Promise.all( p.items.map((w) => Cn( p.driver.getItem, w.relativeKey, w.options - ).then((A) => ({ + ).then((_) => ({ key: w.key, - value: od(A) + value: vd(_) }))) )); }, getItemRaw(l, d = {}) { - l = pi(l); + l = gi(l); const { relativeKey: p, driver: w } = r(l); return w.getItemRaw ? Cn(w.getItemRaw, p, d) : Cn(w.getItem, p, d).then( - (A) => ZL(A) + (_) => Rk(_) ); }, async setItem(l, d, p = {}) { if (d === void 0) return u.removeItem(l); - l = pi(l); - const { relativeKey: w, driver: A } = r(l); - A.setItem && (await Cn(A.setItem, w, _d(d), p), A.watch || i("update", l)); + l = gi(l); + const { relativeKey: w, driver: _ } = r(l); + _.setItem && (await Cn(_.setItem, w, Nd(d), p), _.watch || i("update", l)); }, async setItems(l, d) { await a(l, d, async (p) => { @@ -5566,7 +6078,7 @@ function rk(t = {}) { p.driver.setItems, p.items.map((w) => ({ key: w.relativeKey, - value: _d(w.value), + value: Nd(w.value), options: w.options })), d @@ -5575,7 +6087,7 @@ function rk(t = {}) { p.items.map((w) => Cn( p.driver.setItem, w.relativeKey, - _d(w.value), + Nd(w.value), w.options )) ); @@ -5584,34 +6096,34 @@ function rk(t = {}) { async setItemRaw(l, d, p = {}) { if (d === void 0) return u.removeItem(l, p); - l = pi(l); - const { relativeKey: w, driver: A } = r(l); - if (A.setItemRaw) - await Cn(A.setItemRaw, w, d, p); - else if (A.setItem) - await Cn(A.setItem, w, XL(d), p); + l = gi(l); + const { relativeKey: w, driver: _ } = r(l); + if (_.setItemRaw) + await Cn(_.setItemRaw, w, d, p); + else if (_.setItem) + await Cn(_.setItem, w, Tk(d), p); else return; - A.watch || i("update", l); + _.watch || i("update", l); }, async removeItem(l, d = {}) { - typeof d == "boolean" && (d = { removeMeta: d }), l = pi(l); + typeof d == "boolean" && (d = { removeMeta: d }), l = gi(l); const { relativeKey: p, driver: w } = r(l); w.removeItem && (await Cn(w.removeItem, p, d), (d.removeMeta || d.removeMata) && await Cn(w.removeItem, p + "$", d), w.watch || i("remove", l)); }, // Meta async getMeta(l, d = {}) { - typeof d == "boolean" && (d = { nativeOnly: d }), l = pi(l); - const { relativeKey: p, driver: w } = r(l), A = /* @__PURE__ */ Object.create(null); - if (w.getMeta && Object.assign(A, await Cn(w.getMeta, p, d)), !d.nativeOnly) { - const M = await Cn( + typeof d == "boolean" && (d = { nativeOnly: d }), l = gi(l); + const { relativeKey: p, driver: w } = r(l), _ = /* @__PURE__ */ Object.create(null); + if (w.getMeta && Object.assign(_, await Cn(w.getMeta, p, d)), !d.nativeOnly) { + const P = await Cn( w.getItem, p + "$", d - ).then((N) => od(N)); - M && typeof M == "object" && (typeof M.atime == "string" && (M.atime = new Date(M.atime)), typeof M.mtime == "string" && (M.mtime = new Date(M.mtime)), Object.assign(A, M)); + ).then((O) => vd(O)); + P && typeof P == "object" && (typeof P.atime == "string" && (P.atime = new Date(P.atime)), typeof P.mtime == "string" && (P.mtime = new Date(P.mtime)), Object.assign(_, P)); } - return A; + return _; }, setMeta(l, d, p = {}) { return this.setItem(l + "$", d, p); @@ -5621,39 +6133,39 @@ function rk(t = {}) { }, // Keys async getKeys(l, d = {}) { - l = ad(l); + l = bd(l); const p = n(l, !0); let w = []; - const A = []; - for (const M of p) { - const N = await Cn( - M.driver.getKeys, - M.relativeBase, + const _ = []; + for (const P of p) { + const O = await Cn( + P.driver.getKeys, + P.relativeBase, d ); - for (const L of N) { - const B = M.mountpoint + pi(L); - w.some(($) => B.startsWith($)) || A.push(B); + for (const L of O) { + const B = P.mountpoint + gi(L); + w.some((k) => B.startsWith(k)) || _.push(B); } w = [ - M.mountpoint, - ...w.filter((L) => !L.startsWith(M.mountpoint)) + P.mountpoint, + ...w.filter((L) => !L.startsWith(P.mountpoint)) ]; } - return l ? A.filter( - (M) => M.startsWith(l) && M[M.length - 1] !== "$" - ) : A.filter((M) => M[M.length - 1] !== "$"); + return l ? _.filter( + (P) => P.startsWith(l) && P[P.length - 1] !== "$" + ) : _.filter((P) => P[P.length - 1] !== "$"); }, // Utils async clear(l, d = {}) { - l = ad(l), await Promise.all( + l = bd(l), await Promise.all( n(l, !1).map(async (p) => { if (p.driver.clear) return Cn(p.driver.clear, p.relativeBase, d); if (p.driver.removeItem) { const w = await p.driver.getKeys(p.relativeBase || "", d); return Promise.all( - w.map((A) => p.driver.removeItem(A, d)) + w.map((_) => p.driver.removeItem(_, d)) ); } }) @@ -5661,7 +6173,7 @@ function rk(t = {}) { }, async dispose() { await Promise.all( - Object.values(e.mounts).map((l) => V2(l)) + Object.values(e.mounts).map((l) => ux(l)) ); }, async watch(l) { @@ -5676,17 +6188,17 @@ function rk(t = {}) { }, // Mount mount(l, d) { - if (l = ad(l), l && e.mounts[l]) + if (l = bd(l), l && e.mounts[l]) throw new Error(`already mounted at ${l}`); - return l && (e.mountpoints.push(l), e.mountpoints.sort((p, w) => w.length - p.length)), e.mounts[l] = d, e.watching && Promise.resolve(K2(d, i, l)).then((p) => { + return l && (e.mountpoints.push(l), e.mountpoints.sort((p, w) => w.length - p.length)), e.mounts[l] = d, e.watching && Promise.resolve(cx(d, i, l)).then((p) => { e.unwatch[l] = p; }).catch(console.error), u; }, async unmount(l, d = !0) { - l = ad(l), !(!l || !e.mounts[l]) && (e.watching && l in e.unwatch && (e.unwatch[l](), delete e.unwatch[l]), d && await V2(e.mounts[l]), e.mountpoints = e.mountpoints.filter((p) => p !== l), delete e.mounts[l]); + l = bd(l), !(!l || !e.mounts[l]) && (e.watching && l in e.unwatch && (e.unwatch[l](), delete e.unwatch[l]), d && await ux(e.mounts[l]), e.mountpoints = e.mountpoints.filter((p) => p !== l), delete e.mounts[l]); }, getMount(l = "") { - l = pi(l) + ":"; + l = gi(l) + ":"; const d = r(l); return { driver: d.driver, @@ -5694,7 +6206,7 @@ function rk(t = {}) { }; }, getMounts(l = "", d = {}) { - return l = pi(l), n(l, d.parents).map((w) => ({ + return l = gi(l), n(l, d.parents).map((w) => ({ driver: w.driver, base: w.mountpoint })); @@ -5709,91 +6221,91 @@ function rk(t = {}) { }; return u; } -function K2(t, e, r) { +function cx(t, e, r) { return t.watch ? t.watch((n, i) => e(n, r + i)) : () => { }; } -async function V2(t) { +async function ux(t) { typeof t.dispose == "function" && await Cn(t.dispose); } -function bc(t) { +function Ic(t) { return new Promise((e, r) => { t.oncomplete = t.onsuccess = () => e(t.result), t.onabort = t.onerror = () => r(t.error); }); } -function _4(t, e) { +function J4(t, e) { const r = indexedDB.open(t); r.onupgradeneeded = () => r.result.createObjectStore(e); - const n = bc(r); + const n = Ic(r); return (i, s) => n.then((o) => s(o.transaction(e, i).objectStore(e))); } -let Gg; -function Ul() { - return Gg || (Gg = _4("keyval-store", "keyval")), Gg; +let cm; +function Jl() { + return cm || (cm = J4("keyval-store", "keyval")), cm; } -function G2(t, e = Ul()) { - return e("readonly", (r) => bc(r.get(t))); +function fx(t, e = Jl()) { + return e("readonly", (r) => Ic(r.get(t))); } -function nk(t, e, r = Ul()) { - return r("readwrite", (n) => (n.put(e, t), bc(n.transaction))); +function kk(t, e, r = Jl()) { + return r("readwrite", (n) => (n.put(e, t), Ic(n.transaction))); } -function ik(t, e = Ul()) { - return e("readwrite", (r) => (r.delete(t), bc(r.transaction))); +function $k(t, e = Jl()) { + return e("readwrite", (r) => (r.delete(t), Ic(r.transaction))); } -function sk(t = Ul()) { - return t("readwrite", (e) => (e.clear(), bc(e.transaction))); +function Bk(t = Jl()) { + return t("readwrite", (e) => (e.clear(), Ic(e.transaction))); } -function ok(t, e) { +function Fk(t, e) { return t.openCursor().onsuccess = function() { this.result && (e(this.result), this.result.continue()); - }, bc(t.transaction); + }, Ic(t.transaction); } -function ak(t = Ul()) { +function jk(t = Jl()) { return t("readonly", (e) => { if (e.getAllKeys) - return bc(e.getAllKeys()); + return Ic(e.getAllKeys()); const r = []; - return ok(e, (n) => r.push(n.key)).then(() => r); + return Fk(e, (n) => r.push(n.key)).then(() => r); }); } -const ck = (t) => JSON.stringify(t, (e, r) => typeof r == "bigint" ? r.toString() + "n" : r), uk = (t) => { +const Uk = (t) => JSON.stringify(t, (e, r) => typeof r == "bigint" ? r.toString() + "n" : r), qk = (t) => { const e = /([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g, r = t.replace(e, '$1"$2n"$3'); return JSON.parse(r, (n, i) => typeof i == "string" && i.match(/^\d+n$/) ? BigInt(i.substring(0, i.length - 1)) : i); }; -function fc(t) { +function bc(t) { if (typeof t != "string") throw new Error(`Cannot safe json parse value of type ${typeof t}`); try { - return uk(t); + return qk(t); } catch { return t; } } -function $o(t) { - return typeof t == "string" ? t : ck(t) || ""; +function jo(t) { + return typeof t == "string" ? t : Uk(t) || ""; } -const fk = "idb-keyval"; -var lk = (t = {}) => { +const zk = "idb-keyval"; +var Wk = (t = {}) => { const e = t.base && t.base.length > 0 ? `${t.base}:` : "", r = (i) => e + i; let n; - return t.dbName && t.storeName && (n = _4(t.dbName, t.storeName)), { name: fk, options: t, async hasItem(i) { - return !(typeof await G2(r(i), n) > "u"); + return t.dbName && t.storeName && (n = J4(t.dbName, t.storeName)), { name: zk, options: t, async hasItem(i) { + return !(typeof await fx(r(i), n) > "u"); }, async getItem(i) { - return await G2(r(i), n) ?? null; + return await fx(r(i), n) ?? null; }, setItem(i, s) { - return nk(r(i), s, n); + return kk(r(i), s, n); }, removeItem(i) { - return ik(r(i), n); + return $k(r(i), n); }, getKeys() { - return ak(n); + return jk(n); }, clear() { - return sk(n); + return Bk(n); } }; }; -const hk = "WALLET_CONNECT_V2_INDEXED_DB", dk = "keyvaluestorage"; -let pk = class { +const Hk = "WALLET_CONNECT_V2_INDEXED_DB", Kk = "keyvaluestorage"; +let Vk = class { constructor() { - this.indexedDb = rk({ driver: lk({ dbName: hk, storeName: dk }) }); + this.indexedDb = Lk({ driver: Wk({ dbName: Hk, storeName: Kk }) }); } async getKeys() { return this.indexedDb.getKeys(); @@ -5806,13 +6318,13 @@ let pk = class { if (r !== null) return r; } async setItem(e, r) { - await this.indexedDb.setItem(e, $o(r)); + await this.indexedDb.setItem(e, jo(r)); } async removeItem(e) { await this.indexedDb.removeItem(e); } }; -var Yg = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Ed = { exports: {} }; +var um = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Ld = { exports: {} }; (function() { let t; function e() { @@ -5832,36 +6344,36 @@ var Yg = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t return r = r || 0, Object.keys(this)[r]; }, t.prototype.__defineGetter__("length", function() { return Object.keys(this).length; - }), typeof Yg < "u" && Yg.localStorage ? Ed.exports = Yg.localStorage : typeof window < "u" && window.localStorage ? Ed.exports = window.localStorage : Ed.exports = new e(); + }), typeof um < "u" && um.localStorage ? Ld.exports = um.localStorage : typeof window < "u" && window.localStorage ? Ld.exports = window.localStorage : Ld.exports = new e(); })(); -function gk(t) { +function Gk(t) { var e; - return [t[0], fc((e = t[1]) != null ? e : "")]; + return [t[0], bc((e = t[1]) != null ? e : "")]; } -let mk = class { +let Yk = class { constructor() { - this.localStorage = Ed.exports; + this.localStorage = Ld.exports; } async getKeys() { return Object.keys(this.localStorage); } async getEntries() { - return Object.entries(this.localStorage).map(gk); + return Object.entries(this.localStorage).map(Gk); } async getItem(e) { const r = this.localStorage.getItem(e); - if (r !== null) return fc(r); + if (r !== null) return bc(r); } async setItem(e, r) { - this.localStorage.setItem(e, $o(r)); + this.localStorage.setItem(e, jo(r)); } async removeItem(e) { this.localStorage.removeItem(e); } }; -const vk = "wc_storage_version", Y2 = 1, bk = async (t, e, r) => { - const n = vk, i = await e.getItem(n); - if (i && i >= Y2) { +const Jk = "wc_storage_version", lx = 1, Xk = async (t, e, r) => { + const n = Jk, i = await e.getItem(n); + if (i && i >= lx) { r(e); return; } @@ -5880,22 +6392,22 @@ const vk = "wc_storage_version", Y2 = 1, bk = async (t, e, r) => { await e.setItem(a, l), o.push(a); } } - await e.setItem(n, Y2), r(e), yk(t, o); -}, yk = async (t, e) => { + await e.setItem(n, lx), r(e), Zk(t, o); +}, Zk = async (t, e) => { e.length && e.forEach(async (r) => { await t.removeItem(r); }); }; -let wk = class { +let Qk = class { constructor() { this.initialized = !1, this.setInitialized = (r) => { this.storage = r, this.initialized = !0; }; - const e = new mk(); + const e = new Yk(); this.storage = e; try { - const r = new pk(); - bk(e, r, this.setInitialized); + const r = new Vk(); + Xk(e, r, this.setInitialized); } catch { this.initialized = !0; } @@ -5923,16 +6435,16 @@ let wk = class { }); } }; -function xk(t) { +function e$(t) { try { return JSON.stringify(t); } catch { return '"[Circular]"'; } } -var _k = Ek; -function Ek(t, e, r) { - var n = r && r.stringify || xk, i = 1; +var t$ = r$; +function r$(t, e, r) { + var n = r && r.stringify || e$, i = 1; if (typeof t == "object" && t !== null) { var s = e.length + i; if (s === 1) return t; @@ -5946,80 +6458,80 @@ function Ek(t, e, r) { return t; var u = e.length; if (u === 0) return t; - for (var l = "", d = 1 - i, p = -1, w = t && t.length || 0, A = 0; A < w; ) { - if (t.charCodeAt(A) === 37 && A + 1 < w) { - switch (p = p > -1 ? p : 0, t.charCodeAt(A + 1)) { + for (var l = "", d = 1 - i, p = -1, w = t && t.length || 0, _ = 0; _ < w; ) { + if (t.charCodeAt(_) === 37 && _ + 1 < w) { + switch (p = p > -1 ? p : 0, t.charCodeAt(_ + 1)) { case 100: case 102: if (d >= u || e[d] == null) break; - p < A && (l += t.slice(p, A)), l += Number(e[d]), p = A + 2, A++; + p < _ && (l += t.slice(p, _)), l += Number(e[d]), p = _ + 2, _++; break; case 105: if (d >= u || e[d] == null) break; - p < A && (l += t.slice(p, A)), l += Math.floor(Number(e[d])), p = A + 2, A++; + p < _ && (l += t.slice(p, _)), l += Math.floor(Number(e[d])), p = _ + 2, _++; break; case 79: case 111: case 106: if (d >= u || e[d] === void 0) break; - p < A && (l += t.slice(p, A)); - var M = typeof e[d]; - if (M === "string") { - l += "'" + e[d] + "'", p = A + 2, A++; + p < _ && (l += t.slice(p, _)); + var P = typeof e[d]; + if (P === "string") { + l += "'" + e[d] + "'", p = _ + 2, _++; break; } - if (M === "function") { - l += e[d].name || "", p = A + 2, A++; + if (P === "function") { + l += e[d].name || "", p = _ + 2, _++; break; } - l += n(e[d]), p = A + 2, A++; + l += n(e[d]), p = _ + 2, _++; break; case 115: if (d >= u) break; - p < A && (l += t.slice(p, A)), l += String(e[d]), p = A + 2, A++; + p < _ && (l += t.slice(p, _)), l += String(e[d]), p = _ + 2, _++; break; case 37: - p < A && (l += t.slice(p, A)), l += "%", p = A + 2, A++, d--; + p < _ && (l += t.slice(p, _)), l += "%", p = _ + 2, _++, d--; break; } ++d; } - ++A; + ++_; } return p === -1 ? t : (p < w && (l += t.slice(p)), l); } -const J2 = _k; -var Jc = Bo; -const yl = Ok().console || {}, Sk = { - mapHttpRequest: cd, - mapHttpResponse: cd, - wrapRequestSerializer: Jg, - wrapResponseSerializer: Jg, - wrapErrorSerializer: Jg, - req: cd, - res: cd, - err: Ck -}; -function Ak(t, e) { +const hx = t$; +var ou = Uo; +const Tl = h$().console || {}, n$ = { + mapHttpRequest: yd, + mapHttpResponse: yd, + wrapRequestSerializer: fm, + wrapResponseSerializer: fm, + wrapErrorSerializer: fm, + req: yd, + res: yd, + err: c$ +}; +function i$(t, e) { return Array.isArray(t) ? t.filter(function(n) { return n !== "!stdSerializers.err"; }) : t === !0 ? Object.keys(e) : !1; } -function Bo(t) { +function Uo(t) { t = t || {}, t.browser = t.browser || {}; const e = t.browser.transmit; if (e && typeof e.send != "function") throw Error("pino: transmit option must have a send function"); - const r = t.browser.write || yl; + const r = t.browser.write || Tl; t.browser.write && (t.browser.asObject = !0); - const n = t.serializers || {}, i = Ak(t.browser.serialize, n); + const n = t.serializers || {}, i = i$(t.browser.serialize, n); let s = t.browser.serialize; Array.isArray(t.browser.serialize) && t.browser.serialize.indexOf("!stdSerializers.err") > -1 && (s = !1); const o = ["error", "fatal", "warn", "info", "debug", "trace"]; typeof r == "function" && (r.error = r.fatal = r.warn = r.info = r.debug = r.trace = r), t.enabled === !1 && (t.level = "silent"); const a = t.level || "info", u = Object.create(r); - u.log || (u.log = wl), Object.defineProperty(u, "levelVal", { + u.log || (u.log = Rl), Object.defineProperty(u, "levelVal", { get: d }), Object.defineProperty(u, "level", { get: p, @@ -6030,39 +6542,39 @@ function Bo(t) { serialize: i, asObject: t.browser.asObject, levels: o, - timestamp: Tk(t) + timestamp: u$(t) }; - u.levels = Bo.levels, u.level = a, u.setMaxListeners = u.getMaxListeners = u.emit = u.addListener = u.on = u.prependListener = u.once = u.prependOnceListener = u.removeListener = u.removeAllListeners = u.listeners = u.listenerCount = u.eventNames = u.write = u.flush = wl, u.serializers = n, u._serialize = i, u._stdErrSerialize = s, u.child = A, e && (u._logEvent = h1()); + u.levels = Uo.levels, u.level = a, u.setMaxListeners = u.getMaxListeners = u.emit = u.addListener = u.on = u.prependListener = u.once = u.prependOnceListener = u.removeListener = u.removeAllListeners = u.listeners = u.listenerCount = u.eventNames = u.write = u.flush = Rl, u.serializers = n, u._serialize = i, u._stdErrSerialize = s, u.child = _, e && (u._logEvent = I1()); function d() { return this.level === "silent" ? 1 / 0 : this.levels.values[this.level]; } function p() { return this._level; } - function w(M) { - if (M !== "silent" && !this.levels.values[M]) - throw Error("unknown level " + M); - this._level = M, Wc(l, u, "error", "log"), Wc(l, u, "fatal", "error"), Wc(l, u, "warn", "error"), Wc(l, u, "info", "log"), Wc(l, u, "debug", "log"), Wc(l, u, "trace", "log"); + function w(P) { + if (P !== "silent" && !this.levels.values[P]) + throw Error("unknown level " + P); + this._level = P, eu(l, u, "error", "log"), eu(l, u, "fatal", "error"), eu(l, u, "warn", "error"), eu(l, u, "info", "log"), eu(l, u, "debug", "log"), eu(l, u, "trace", "log"); } - function A(M, N) { - if (!M) + function _(P, O) { + if (!P) throw new Error("missing bindings for child Pino"); - N = N || {}, i && M.serializers && (N.serializers = M.serializers); - const L = N.serializers; + O = O || {}, i && P.serializers && (O.serializers = P.serializers); + const L = O.serializers; if (i && L) { - var B = Object.assign({}, n, L), $ = t.browser.serialize === !0 ? Object.keys(B) : i; - delete M.serializers, k0([M], $, B, this._stdErrSerialize); + var B = Object.assign({}, n, L), k = t.browser.serialize === !0 ? Object.keys(B) : i; + delete P.serializers, J0([P], k, B, this._stdErrSerialize); } - function H(U) { - this._childLevel = (U._childLevel | 0) + 1, this.error = Hc(U, M, "error"), this.fatal = Hc(U, M, "fatal"), this.warn = Hc(U, M, "warn"), this.info = Hc(U, M, "info"), this.debug = Hc(U, M, "debug"), this.trace = Hc(U, M, "trace"), B && (this.serializers = B, this._serialize = $), e && (this._logEvent = h1( - [].concat(U._logEvent.bindings, M) + function q(U) { + this._childLevel = (U._childLevel | 0) + 1, this.error = tu(U, P, "error"), this.fatal = tu(U, P, "fatal"), this.warn = tu(U, P, "warn"), this.info = tu(U, P, "info"), this.debug = tu(U, P, "debug"), this.trace = tu(U, P, "trace"), B && (this.serializers = B, this._serialize = k), e && (this._logEvent = I1( + [].concat(U._logEvent.bindings, P) )); } - return H.prototype = this, new H(this); + return q.prototype = this, new q(this); } return u; } -Bo.levels = { +Uo.levels = { values: { fatal: 60, error: 50, @@ -6080,21 +6592,21 @@ Bo.levels = { 60: "fatal" } }; -Bo.stdSerializers = Sk; -Bo.stdTimeFunctions = Object.assign({}, { nullTime: E4, epochTime: S4, unixTime: Rk, isoTime: Dk }); -function Wc(t, e, r, n) { +Uo.stdSerializers = n$; +Uo.stdTimeFunctions = Object.assign({}, { nullTime: X4, epochTime: Z4, unixTime: f$, isoTime: l$ }); +function eu(t, e, r, n) { const i = Object.getPrototypeOf(e); - e[r] = e.levelVal > e.levels.values[r] ? wl : i[r] ? i[r] : yl[r] || yl[n] || wl, Pk(t, e, r); + e[r] = e.levelVal > e.levels.values[r] ? Rl : i[r] ? i[r] : Tl[r] || Tl[n] || Rl, s$(t, e, r); } -function Pk(t, e, r) { - !t.transmit && e[r] === wl || (e[r] = /* @__PURE__ */ function(n) { +function s$(t, e, r) { + !t.transmit && e[r] === Rl || (e[r] = /* @__PURE__ */ function(n) { return function() { - const s = t.timestamp(), o = new Array(arguments.length), a = Object.getPrototypeOf && Object.getPrototypeOf(this) === yl ? yl : this; + const s = t.timestamp(), o = new Array(arguments.length), a = Object.getPrototypeOf && Object.getPrototypeOf(this) === Tl ? Tl : this; for (var u = 0; u < o.length; u++) o[u] = arguments[u]; - if (t.serialize && !t.asObject && k0(o, this._serialize, this.serializers, this._stdErrSerialize), t.asObject ? n.call(a, Mk(this, r, o, s)) : n.apply(a, o), t.transmit) { - const l = t.transmit.level || e.level, d = Bo.levels.values[l], p = Bo.levels.values[r]; + if (t.serialize && !t.asObject && J0(o, this._serialize, this.serializers, this._stdErrSerialize), t.asObject ? n.call(a, o$(this, r, o, s)) : n.apply(a, o), t.transmit) { + const l = t.transmit.level || e.level, d = Uo.levels.values[l], p = Uo.levels.values[r]; if (p < d) return; - Ik(this, { + a$(this, { ts: s, methodLevel: r, methodValue: p, @@ -6105,29 +6617,29 @@ function Pk(t, e, r) { }; }(e[r])); } -function Mk(t, e, r, n) { - t._serialize && k0(r, t._serialize, t.serializers, t._stdErrSerialize); +function o$(t, e, r, n) { + t._serialize && J0(r, t._serialize, t.serializers, t._stdErrSerialize); const i = r.slice(); let s = i[0]; const o = {}; - n && (o.time = n), o.level = Bo.levels.values[e]; + n && (o.time = n), o.level = Uo.levels.values[e]; let a = (t._childLevel | 0) + 1; if (a < 1 && (a = 1), s !== null && typeof s == "object") { for (; a-- && typeof i[0] == "object"; ) Object.assign(o, i.shift()); - s = i.length ? J2(i.shift(), i) : void 0; - } else typeof s == "string" && (s = J2(i.shift(), i)); + s = i.length ? hx(i.shift(), i) : void 0; + } else typeof s == "string" && (s = hx(i.shift(), i)); return s !== void 0 && (o.msg = s), o; } -function k0(t, e, r, n) { +function J0(t, e, r, n) { for (const i in t) if (n && t[i] instanceof Error) - t[i] = Bo.stdSerializers.err(t[i]); + t[i] = Uo.stdSerializers.err(t[i]); else if (typeof t[i] == "object" && !Array.isArray(t[i])) for (const s in t[i]) e && e.indexOf(s) > -1 && s in r && (t[i][s] = r[s](t[i][s])); } -function Hc(t, e, r) { +function tu(t, e, r) { return function() { const n = new Array(1 + arguments.length); n[0] = e; @@ -6136,18 +6648,18 @@ function Hc(t, e, r) { return t[r].apply(this, n); }; } -function Ik(t, e, r) { +function a$(t, e, r) { const n = e.send, i = e.ts, s = e.methodLevel, o = e.methodValue, a = e.val, u = t._logEvent.bindings; - k0( + J0( r, t._serialize || Object.keys(t.serializers), t.serializers, t._stdErrSerialize === void 0 ? !0 : t._stdErrSerialize ), t._logEvent.ts = i, t._logEvent.messages = r.filter(function(l) { return u.indexOf(l) === -1; - }), t._logEvent.level.label = s, t._logEvent.level.value = o, n(s, t._logEvent, a), t._logEvent = h1(u); + }), t._logEvent.level.label = s, t._logEvent.level.value = o, n(s, t._logEvent, a), t._logEvent = I1(u); } -function h1(t) { +function I1(t) { return { ts: 0, messages: [], @@ -6155,7 +6667,7 @@ function h1(t) { level: { label: "", value: 0 } }; } -function Ck(t) { +function c$(t) { const e = { type: t.constructor.name, msg: t.message, @@ -6165,30 +6677,30 @@ function Ck(t) { e[r] === void 0 && (e[r] = t[r]); return e; } -function Tk(t) { - return typeof t.timestamp == "function" ? t.timestamp : t.timestamp === !1 ? E4 : S4; +function u$(t) { + return typeof t.timestamp == "function" ? t.timestamp : t.timestamp === !1 ? X4 : Z4; } -function cd() { +function yd() { return {}; } -function Jg(t) { +function fm(t) { return t; } -function wl() { +function Rl() { } -function E4() { +function X4() { return !1; } -function S4() { +function Z4() { return Date.now(); } -function Rk() { +function f$() { return Math.round(Date.now() / 1e3); } -function Dk() { +function l$() { return new Date(Date.now()).toISOString(); } -function Ok() { +function h$() { function t(e) { return typeof e < "u" && e; } @@ -6203,8 +6715,8 @@ function Ok() { return t(self) || t(window) || t(this) || {}; } } -const ql = /* @__PURE__ */ ts(Jc), Nk = { level: "info" }, zl = "custom_context", Bv = 1e3 * 1024; -let Lk = class { +const Xl = /* @__PURE__ */ ns(ou), d$ = { level: "info" }, Zl = "custom_context", Zv = 1e3 * 1024; +let p$ = class { constructor(e) { this.nodeValue = e, this.sizeInBytes = new TextEncoder().encode(this.nodeValue).length, this.next = null; } @@ -6214,12 +6726,12 @@ let Lk = class { get size() { return this.sizeInBytes; } -}, X2 = class { +}, dx = class { constructor(e) { this.head = null, this.tail = null, this.lengthInNodes = 0, this.maxSizeInBytes = e, this.sizeInBytes = 0; } append(e) { - const r = new Lk(e); + const r = new p$(e); if (r.size > this.maxSizeInBytes) throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`); for (; this.size + r.size > this.maxSizeInBytes; ) this.shift(); this.head ? (this.tail && (this.tail.next = r), this.tail = r) : (this.head = r, this.tail = r), this.lengthInNodes++, this.sizeInBytes += r.size; @@ -6252,15 +6764,15 @@ let Lk = class { return e = e.next, { done: !1, value: r }; } }; } -}, A4 = class { - constructor(e, r = Bv) { - this.level = e ?? "error", this.levelValue = Jc.levels.values[this.level], this.MAX_LOG_SIZE_IN_BYTES = r, this.logs = new X2(this.MAX_LOG_SIZE_IN_BYTES); +}, Q4 = class { + constructor(e, r = Zv) { + this.level = e ?? "error", this.levelValue = ou.levels.values[this.level], this.MAX_LOG_SIZE_IN_BYTES = r, this.logs = new dx(this.MAX_LOG_SIZE_IN_BYTES); } forwardToConsole(e, r) { - r === Jc.levels.values.error ? console.error(e) : r === Jc.levels.values.warn ? console.warn(e) : r === Jc.levels.values.debug ? console.debug(e) : r === Jc.levels.values.trace ? console.trace(e) : console.log(e); + r === ou.levels.values.error ? console.error(e) : r === ou.levels.values.warn ? console.warn(e) : r === ou.levels.values.debug ? console.debug(e) : r === ou.levels.values.trace ? console.trace(e) : console.log(e); } appendToLogs(e) { - this.logs.append($o({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), log: e })); + this.logs.append(jo({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), log: e })); const r = typeof e == "string" ? JSON.parse(e).level : e.level; r >= this.levelValue && this.forwardToConsole(e, r); } @@ -6268,18 +6780,18 @@ let Lk = class { return this.logs; } clearLogs() { - this.logs = new X2(this.MAX_LOG_SIZE_IN_BYTES); + this.logs = new dx(this.MAX_LOG_SIZE_IN_BYTES); } getLogArray() { return Array.from(this.logs); } logsToBlob(e) { const r = this.getLogArray(); - return r.push($o({ extraMetadata: e })), new Blob(r, { type: "application/json" }); + return r.push(jo({ extraMetadata: e })), new Blob(r, { type: "application/json" }); } -}, kk = class { - constructor(e, r = Bv) { - this.baseChunkLogger = new A4(e, r); +}, g$ = class { + constructor(e, r = Zv) { + this.baseChunkLogger = new Q4(e, r); } write(e) { this.baseChunkLogger.appendToLogs(e); @@ -6300,9 +6812,9 @@ let Lk = class { const r = URL.createObjectURL(this.logsToBlob(e)), n = document.createElement("a"); n.href = r, n.download = `walletconnect-logs-${(/* @__PURE__ */ new Date()).toISOString()}.txt`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(r); } -}, $k = class { - constructor(e, r = Bv) { - this.baseChunkLogger = new A4(e, r); +}, m$ = class { + constructor(e, r = Zv) { + this.baseChunkLogger = new Q4(e, r); } write(e) { this.baseChunkLogger.appendToLogs(e); @@ -6320,103 +6832,103 @@ let Lk = class { return this.baseChunkLogger.logsToBlob(e); } }; -var Bk = Object.defineProperty, Fk = Object.defineProperties, jk = Object.getOwnPropertyDescriptors, Z2 = Object.getOwnPropertySymbols, Uk = Object.prototype.hasOwnProperty, qk = Object.prototype.propertyIsEnumerable, Q2 = (t, e, r) => e in t ? Bk(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Jd = (t, e) => { - for (var r in e || (e = {})) Uk.call(e, r) && Q2(t, r, e[r]); - if (Z2) for (var r of Z2(e)) qk.call(e, r) && Q2(t, r, e[r]); +var v$ = Object.defineProperty, b$ = Object.defineProperties, y$ = Object.getOwnPropertyDescriptors, px = Object.getOwnPropertySymbols, w$ = Object.prototype.hasOwnProperty, x$ = Object.prototype.propertyIsEnumerable, gx = (t, e, r) => e in t ? v$(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, c0 = (t, e) => { + for (var r in e || (e = {})) w$.call(e, r) && gx(t, r, e[r]); + if (px) for (var r of px(e)) x$.call(e, r) && gx(t, r, e[r]); return t; -}, Xd = (t, e) => Fk(t, jk(e)); -function $0(t) { - return Xd(Jd({}, t), { level: (t == null ? void 0 : t.level) || Nk.level }); +}, u0 = (t, e) => b$(t, y$(e)); +function X0(t) { + return u0(c0({}, t), { level: (t == null ? void 0 : t.level) || d$.level }); } -function zk(t, e = zl) { +function _$(t, e = Zl) { return t[e] || ""; } -function Wk(t, e, r = zl) { +function E$(t, e, r = Zl) { return t[r] = e, t; } -function Ai(t, e = zl) { +function Pi(t, e = Zl) { let r = ""; - return typeof t.bindings > "u" ? r = zk(t, e) : r = t.bindings().context || "", r; + return typeof t.bindings > "u" ? r = _$(t, e) : r = t.bindings().context || "", r; } -function Hk(t, e, r = zl) { - const n = Ai(t, r); +function S$(t, e, r = Zl) { + const n = Pi(t, r); return n.trim() ? `${n}/${e}` : e; } -function ci(t, e, r = zl) { - const n = Hk(t, e, r), i = t.child({ context: n }); - return Wk(i, n, r); +function ui(t, e, r = Zl) { + const n = S$(t, e, r), i = t.child({ context: n }); + return E$(i, n, r); } -function Kk(t) { +function A$(t) { var e, r; - const n = new kk((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); - return { logger: ql(Xd(Jd({}, t.opts), { level: "trace", browser: Xd(Jd({}, (r = t.opts) == null ? void 0 : r.browser), { write: (i) => n.write(i) }) })), chunkLoggerController: n }; + const n = new g$((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); + return { logger: Xl(u0(c0({}, t.opts), { level: "trace", browser: u0(c0({}, (r = t.opts) == null ? void 0 : r.browser), { write: (i) => n.write(i) }) })), chunkLoggerController: n }; } -function Vk(t) { +function P$(t) { var e; - const r = new $k((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); - return { logger: ql(Xd(Jd({}, t.opts), { level: "trace" }), r), chunkLoggerController: r }; + const r = new m$((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); + return { logger: Xl(u0(c0({}, t.opts), { level: "trace" }), r), chunkLoggerController: r }; } -function Gk(t) { - return typeof t.loggerOverride < "u" && typeof t.loggerOverride != "string" ? { logger: t.loggerOverride, chunkLoggerController: null } : typeof window < "u" ? Kk(t) : Vk(t); +function M$(t) { + return typeof t.loggerOverride < "u" && typeof t.loggerOverride != "string" ? { logger: t.loggerOverride, chunkLoggerController: null } : typeof window < "u" ? A$(t) : P$(t); } -let Yk = class extends vc { +let I$ = class extends Mc { constructor(e) { super(), this.opts = e, this.protocol = "wc", this.version = 2; } -}, Jk = class extends vc { +}, C$ = class extends Mc { constructor(e, r) { super(), this.core = e, this.logger = r, this.records = /* @__PURE__ */ new Map(); } -}, Xk = class { +}, T$ = class { constructor(e, r) { this.logger = e, this.core = r; } -}, Zk = class extends vc { +}, R$ = class extends Mc { constructor(e, r) { super(), this.relayer = e, this.logger = r; } -}, Qk = class extends vc { +}, D$ = class extends Mc { constructor(e) { super(); } -}, e$ = class { +}, O$ = class { constructor(e, r, n, i) { this.core = e, this.logger = r, this.name = n; } -}, t$ = class extends vc { +}, N$ = class extends Mc { constructor(e, r) { super(), this.relayer = e, this.logger = r; } -}, r$ = class extends vc { +}, L$ = class extends Mc { constructor(e, r) { super(), this.core = e, this.logger = r; } -}, n$ = class { +}, k$ = class { constructor(e, r, n) { this.core = e, this.logger = r, this.store = n; } -}, i$ = class { +}, $$ = class { constructor(e, r) { this.projectId = e, this.logger = r; } -}, s$ = class { +}, B$ = class { constructor(e, r, n) { this.core = e, this.logger = r, this.telemetryEnabled = n; } -}, o$ = class { +}, F$ = class { constructor(e) { this.opts = e, this.protocol = "wc", this.version = 2; } -}, a$ = class { +}, j$ = class { constructor(e) { this.client = e; } }; -var Fv = {}, Pa = {}, B0 = {}, F0 = {}; -Object.defineProperty(F0, "__esModule", { value: !0 }); -F0.BrowserRandomSource = void 0; -const ex = 65536; -class c$ { +var Qv = {}, Da = {}, Z0 = {}, Q0 = {}; +Object.defineProperty(Q0, "__esModule", { value: !0 }); +Q0.BrowserRandomSource = void 0; +const mx = 65536; +class U$ { constructor() { this.isAvailable = !1, this.isInstantiated = !1; const e = typeof self < "u" ? self.crypto || self.msCrypto : null; @@ -6426,34 +6938,34 @@ class c$ { if (!this.isAvailable || !this._crypto) throw new Error("Browser random byte generator is not available."); const r = new Uint8Array(e); - for (let n = 0; n < r.length; n += ex) - this._crypto.getRandomValues(r.subarray(n, n + Math.min(r.length - n, ex))); + for (let n = 0; n < r.length; n += mx) + this._crypto.getRandomValues(r.subarray(n, n + Math.min(r.length - n, mx))); return r; } } -F0.BrowserRandomSource = c$; -function P4(t) { +Q0.BrowserRandomSource = U$; +function e8(t) { throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } -var j0 = {}, ki = {}; -Object.defineProperty(ki, "__esModule", { value: !0 }); -function u$(t) { +var ep = {}, Bi = {}; +Object.defineProperty(Bi, "__esModule", { value: !0 }); +function q$(t) { for (var e = 0; e < t.length; e++) t[e] = 0; return t; } -ki.wipe = u$; -const f$ = {}, l$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +Bi.wipe = q$; +const z$ = {}, W$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - default: f$ -}, Symbol.toStringTag, { value: "Module" })), Wl = /* @__PURE__ */ yv(l$); -Object.defineProperty(j0, "__esModule", { value: !0 }); -j0.NodeRandomSource = void 0; -const h$ = ki; -class d$ { + default: z$ +}, Symbol.toStringTag, { value: "Module" })), Ql = /* @__PURE__ */ Lv(W$); +Object.defineProperty(ep, "__esModule", { value: !0 }); +ep.NodeRandomSource = void 0; +const H$ = Bi; +class K$ { constructor() { - if (this.isAvailable = !1, this.isInstantiated = !1, typeof P4 < "u") { - const e = Wl; + if (this.isAvailable = !1, this.isInstantiated = !1, typeof e8 < "u") { + const e = Ql; e && e.randomBytes && (this._crypto = e, this.isAvailable = !0, this.isInstantiated = !0); } } @@ -6466,20 +6978,20 @@ class d$ { const n = new Uint8Array(e); for (let i = 0; i < n.length; i++) n[i] = r[i]; - return (0, h$.wipe)(r), n; + return (0, H$.wipe)(r), n; } } -j0.NodeRandomSource = d$; -Object.defineProperty(B0, "__esModule", { value: !0 }); -B0.SystemRandomSource = void 0; -const p$ = F0, g$ = j0; -class m$ { +ep.NodeRandomSource = K$; +Object.defineProperty(Z0, "__esModule", { value: !0 }); +Z0.SystemRandomSource = void 0; +const V$ = Q0, G$ = ep; +class Y$ { constructor() { - if (this.isAvailable = !1, this.name = "", this._source = new p$.BrowserRandomSource(), this._source.isAvailable) { + if (this.isAvailable = !1, this.name = "", this._source = new V$.BrowserRandomSource(), this._source.isAvailable) { this.isAvailable = !0, this.name = "Browser"; return; } - if (this._source = new g$.NodeRandomSource(), this._source.isAvailable) { + if (this._source = new G$.NodeRandomSource(), this._source.isAvailable) { this.isAvailable = !0, this.name = "Node"; return; } @@ -6490,8 +7002,8 @@ class m$ { return this._source.randomBytes(e); } } -B0.SystemRandomSource = m$; -var ar = {}, M4 = {}; +Z0.SystemRandomSource = Y$; +var ar = {}, t8 = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); function e(a, u) { @@ -6521,96 +7033,96 @@ var ar = {}, M4 = {}; t.isInteger = Number.isInteger || o, t.MAX_SAFE_INTEGER = 9007199254740991, t.isSafeInteger = function(a) { return t.isInteger(a) && a >= -t.MAX_SAFE_INTEGER && a <= t.MAX_SAFE_INTEGER; }; -})(M4); +})(t8); Object.defineProperty(ar, "__esModule", { value: !0 }); -var I4 = M4; -function v$(t, e) { +var r8 = t8; +function J$(t, e) { return e === void 0 && (e = 0), (t[e + 0] << 8 | t[e + 1]) << 16 >> 16; } -ar.readInt16BE = v$; -function b$(t, e) { +ar.readInt16BE = J$; +function X$(t, e) { return e === void 0 && (e = 0), (t[e + 0] << 8 | t[e + 1]) >>> 0; } -ar.readUint16BE = b$; -function y$(t, e) { +ar.readUint16BE = X$; +function Z$(t, e) { return e === void 0 && (e = 0), (t[e + 1] << 8 | t[e]) << 16 >> 16; } -ar.readInt16LE = y$; -function w$(t, e) { +ar.readInt16LE = Z$; +function Q$(t, e) { return e === void 0 && (e = 0), (t[e + 1] << 8 | t[e]) >>> 0; } -ar.readUint16LE = w$; -function C4(t, e, r) { +ar.readUint16LE = Q$; +function n8(t, e, r) { return e === void 0 && (e = new Uint8Array(2)), r === void 0 && (r = 0), e[r + 0] = t >>> 8, e[r + 1] = t >>> 0, e; } -ar.writeUint16BE = C4; -ar.writeInt16BE = C4; -function T4(t, e, r) { +ar.writeUint16BE = n8; +ar.writeInt16BE = n8; +function i8(t, e, r) { return e === void 0 && (e = new Uint8Array(2)), r === void 0 && (r = 0), e[r + 0] = t >>> 0, e[r + 1] = t >>> 8, e; } -ar.writeUint16LE = T4; -ar.writeInt16LE = T4; -function d1(t, e) { +ar.writeUint16LE = i8; +ar.writeInt16LE = i8; +function C1(t, e) { return e === void 0 && (e = 0), t[e] << 24 | t[e + 1] << 16 | t[e + 2] << 8 | t[e + 3]; } -ar.readInt32BE = d1; -function p1(t, e) { +ar.readInt32BE = C1; +function T1(t, e) { return e === void 0 && (e = 0), (t[e] << 24 | t[e + 1] << 16 | t[e + 2] << 8 | t[e + 3]) >>> 0; } -ar.readUint32BE = p1; -function g1(t, e) { +ar.readUint32BE = T1; +function R1(t, e) { return e === void 0 && (e = 0), t[e + 3] << 24 | t[e + 2] << 16 | t[e + 1] << 8 | t[e]; } -ar.readInt32LE = g1; -function m1(t, e) { +ar.readInt32LE = R1; +function D1(t, e) { return e === void 0 && (e = 0), (t[e + 3] << 24 | t[e + 2] << 16 | t[e + 1] << 8 | t[e]) >>> 0; } -ar.readUint32LE = m1; -function Zd(t, e, r) { +ar.readUint32LE = D1; +function f0(t, e, r) { return e === void 0 && (e = new Uint8Array(4)), r === void 0 && (r = 0), e[r + 0] = t >>> 24, e[r + 1] = t >>> 16, e[r + 2] = t >>> 8, e[r + 3] = t >>> 0, e; } -ar.writeUint32BE = Zd; -ar.writeInt32BE = Zd; -function Qd(t, e, r) { +ar.writeUint32BE = f0; +ar.writeInt32BE = f0; +function l0(t, e, r) { return e === void 0 && (e = new Uint8Array(4)), r === void 0 && (r = 0), e[r + 0] = t >>> 0, e[r + 1] = t >>> 8, e[r + 2] = t >>> 16, e[r + 3] = t >>> 24, e; } -ar.writeUint32LE = Qd; -ar.writeInt32LE = Qd; -function x$(t, e) { +ar.writeUint32LE = l0; +ar.writeInt32LE = l0; +function eB(t, e) { e === void 0 && (e = 0); - var r = d1(t, e), n = d1(t, e + 4); + var r = C1(t, e), n = C1(t, e + 4); return r * 4294967296 + n - (n >> 31) * 4294967296; } -ar.readInt64BE = x$; -function _$(t, e) { +ar.readInt64BE = eB; +function tB(t, e) { e === void 0 && (e = 0); - var r = p1(t, e), n = p1(t, e + 4); + var r = T1(t, e), n = T1(t, e + 4); return r * 4294967296 + n; } -ar.readUint64BE = _$; -function E$(t, e) { +ar.readUint64BE = tB; +function rB(t, e) { e === void 0 && (e = 0); - var r = g1(t, e), n = g1(t, e + 4); + var r = R1(t, e), n = R1(t, e + 4); return n * 4294967296 + r - (r >> 31) * 4294967296; } -ar.readInt64LE = E$; -function S$(t, e) { +ar.readInt64LE = rB; +function nB(t, e) { e === void 0 && (e = 0); - var r = m1(t, e), n = m1(t, e + 4); + var r = D1(t, e), n = D1(t, e + 4); return n * 4294967296 + r; } -ar.readUint64LE = S$; -function R4(t, e, r) { - return e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0), Zd(t / 4294967296 >>> 0, e, r), Zd(t >>> 0, e, r + 4), e; +ar.readUint64LE = nB; +function s8(t, e, r) { + return e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0), f0(t / 4294967296 >>> 0, e, r), f0(t >>> 0, e, r + 4), e; } -ar.writeUint64BE = R4; -ar.writeInt64BE = R4; -function D4(t, e, r) { - return e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0), Qd(t >>> 0, e, r), Qd(t / 4294967296 >>> 0, e, r + 4), e; +ar.writeUint64BE = s8; +ar.writeInt64BE = s8; +function o8(t, e, r) { + return e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0), l0(t >>> 0, e, r), l0(t / 4294967296 >>> 0, e, r + 4), e; } -ar.writeUint64LE = D4; -ar.writeInt64LE = D4; -function A$(t, e, r) { +ar.writeUint64LE = o8; +ar.writeInt64LE = o8; +function iB(t, e, r) { if (r === void 0 && (r = 0), t % 8 !== 0) throw new Error("readUintBE supports only bitLengths divisible by 8"); if (t / 8 > e.length - r) @@ -6619,8 +7131,8 @@ function A$(t, e, r) { n += e[s] * i, i *= 256; return n; } -ar.readUintBE = A$; -function P$(t, e, r) { +ar.readUintBE = iB; +function sB(t, e, r) { if (r === void 0 && (r = 0), t % 8 !== 0) throw new Error("readUintLE supports only bitLengths divisible by 8"); if (t / 8 > e.length - r) @@ -6629,78 +7141,78 @@ function P$(t, e, r) { n += e[s] * i, i *= 256; return n; } -ar.readUintLE = P$; -function M$(t, e, r, n) { +ar.readUintLE = sB; +function oB(t, e, r, n) { if (r === void 0 && (r = new Uint8Array(t / 8)), n === void 0 && (n = 0), t % 8 !== 0) throw new Error("writeUintBE supports only bitLengths divisible by 8"); - if (!I4.isSafeInteger(e)) + if (!r8.isSafeInteger(e)) throw new Error("writeUintBE value must be an integer"); for (var i = 1, s = t / 8 + n - 1; s >= n; s--) r[s] = e / i & 255, i *= 256; return r; } -ar.writeUintBE = M$; -function I$(t, e, r, n) { +ar.writeUintBE = oB; +function aB(t, e, r, n) { if (r === void 0 && (r = new Uint8Array(t / 8)), n === void 0 && (n = 0), t % 8 !== 0) throw new Error("writeUintLE supports only bitLengths divisible by 8"); - if (!I4.isSafeInteger(e)) + if (!r8.isSafeInteger(e)) throw new Error("writeUintLE value must be an integer"); for (var i = 1, s = n; s < n + t / 8; s++) r[s] = e / i & 255, i *= 256; return r; } -ar.writeUintLE = I$; -function C$(t, e) { +ar.writeUintLE = aB; +function cB(t, e) { e === void 0 && (e = 0); var r = new DataView(t.buffer, t.byteOffset, t.byteLength); return r.getFloat32(e); } -ar.readFloat32BE = C$; -function T$(t, e) { +ar.readFloat32BE = cB; +function uB(t, e) { e === void 0 && (e = 0); var r = new DataView(t.buffer, t.byteOffset, t.byteLength); return r.getFloat32(e, !0); } -ar.readFloat32LE = T$; -function R$(t, e) { +ar.readFloat32LE = uB; +function fB(t, e) { e === void 0 && (e = 0); var r = new DataView(t.buffer, t.byteOffset, t.byteLength); return r.getFloat64(e); } -ar.readFloat64BE = R$; -function D$(t, e) { +ar.readFloat64BE = fB; +function lB(t, e) { e === void 0 && (e = 0); var r = new DataView(t.buffer, t.byteOffset, t.byteLength); return r.getFloat64(e, !0); } -ar.readFloat64LE = D$; -function O$(t, e, r) { +ar.readFloat64LE = lB; +function hB(t, e, r) { e === void 0 && (e = new Uint8Array(4)), r === void 0 && (r = 0); var n = new DataView(e.buffer, e.byteOffset, e.byteLength); return n.setFloat32(r, t), e; } -ar.writeFloat32BE = O$; -function N$(t, e, r) { +ar.writeFloat32BE = hB; +function dB(t, e, r) { e === void 0 && (e = new Uint8Array(4)), r === void 0 && (r = 0); var n = new DataView(e.buffer, e.byteOffset, e.byteLength); return n.setFloat32(r, t, !0), e; } -ar.writeFloat32LE = N$; -function L$(t, e, r) { +ar.writeFloat32LE = dB; +function pB(t, e, r) { e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0); var n = new DataView(e.buffer, e.byteOffset, e.byteLength); return n.setFloat64(r, t), e; } -ar.writeFloat64BE = L$; -function k$(t, e, r) { +ar.writeFloat64BE = pB; +function gB(t, e, r) { e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0); var n = new DataView(e.buffer, e.byteOffset, e.byteLength); return n.setFloat64(r, t, !0), e; } -ar.writeFloat64LE = k$; +ar.writeFloat64LE = gB; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.randomStringForEntropy = t.randomString = t.randomUint32 = t.randomBytes = t.defaultRandomSource = void 0; - const e = B0, r = ar, n = ki; + const e = Z0, r = ar, n = Bi; t.defaultRandomSource = new e.SystemRandomSource(); function i(l, d = t.defaultRandomSource) { return d.randomBytes(l); @@ -6718,14 +7230,14 @@ ar.writeFloat64LE = k$; if (d.length > 256) throw new Error("randomString charset is too long"); let w = ""; - const A = d.length, M = 256 - 256 % A; + const _ = d.length, P = 256 - 256 % _; for (; l > 0; ) { - const N = i(Math.ceil(l * 256 / M), p); - for (let L = 0; L < N.length && l > 0; L++) { - const B = N[L]; - B < M && (w += d.charAt(B % A), l--); + const O = i(Math.ceil(l * 256 / P), p); + for (let L = 0; L < O.length && l > 0; L++) { + const B = O[L]; + B < P && (w += d.charAt(B % _), l--); } - (0, n.wipe)(N); + (0, n.wipe)(O); } return w; } @@ -6735,11 +7247,11 @@ ar.writeFloat64LE = k$; return a(w, d, p); } t.randomStringForEntropy = u; -})(Pa); -var O4 = {}; +})(Da); +var a8 = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - var e = ar, r = ki; + var e = ar, r = Bi; t.DIGEST_LENGTH = 64, t.BLOCK_SIZE = 128; var n = ( /** @class */ @@ -6767,14 +7279,14 @@ var O4 = {}; return this; }, a.prototype.finish = function(u) { if (!this._finished) { - var l = this._bytesHashed, d = this._bufferLength, p = l / 536870912 | 0, w = l << 3, A = l % 128 < 112 ? 128 : 256; + var l = this._bytesHashed, d = this._bufferLength, p = l / 536870912 | 0, w = l << 3, _ = l % 128 < 112 ? 128 : 256; this._buffer[d] = 128; - for (var M = d + 1; M < A - 8; M++) - this._buffer[M] = 0; - e.writeUint32BE(p, this._buffer, A - 8), e.writeUint32BE(w, this._buffer, A - 4), s(this._tempHi, this._tempLo, this._stateHi, this._stateLo, this._buffer, 0, A), this._finished = !0; + for (var P = d + 1; P < _ - 8; P++) + this._buffer[P] = 0; + e.writeUint32BE(p, this._buffer, _ - 8), e.writeUint32BE(w, this._buffer, _ - 4), s(this._tempHi, this._tempLo, this._stateHi, this._stateLo, this._buffer, 0, _), this._finished = !0; } - for (var M = 0; M < this.digestLength / 8; M++) - e.writeUint32BE(this._stateHi[M], u, M * 8), e.writeUint32BE(this._stateLo[M], u, M * 8 + 4); + for (var P = 0; P < this.digestLength / 8; P++) + e.writeUint32BE(this._stateHi[P], u, P * 8), e.writeUint32BE(this._stateLo[P], u, P * 8 + 4); return this; }, a.prototype.digest = function() { var u = new Uint8Array(this.digestLength); @@ -6959,19 +7471,19 @@ var O4 = {}; 1816402316, 1246189591 ]); - function s(a, u, l, d, p, w, A) { - for (var M = l[0], N = l[1], L = l[2], B = l[3], $ = l[4], H = l[5], U = l[6], V = l[7], te = d[0], R = d[1], K = d[2], ge = d[3], Ee = d[4], Y = d[5], S = d[6], m = d[7], f, g, b, x, _, E, v, P; A >= 128; ) { + function s(a, u, l, d, p, w, _) { + for (var P = l[0], O = l[1], L = l[2], B = l[3], k = l[4], q = l[5], U = l[6], V = l[7], Q = d[0], R = d[1], K = d[2], ge = d[3], Ee = d[4], Y = d[5], A = d[6], m = d[7], f, g, b, x, E, S, v, M; _ >= 128; ) { for (var I = 0; I < 16; I++) { var F = 8 * I + w; a[I] = e.readUint32BE(p, F), u[I] = e.readUint32BE(p, F + 4); } for (var I = 0; I < 80; I++) { - var ce = M, D = N, oe = L, Z = B, J = $, Q = H, T = U, X = V, re = te, pe = R, ie = K, ue = ge, ve = Ee, Pe = Y, De = S, Ce = m; - if (f = V, g = m, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = ($ >>> 14 | Ee << 18) ^ ($ >>> 18 | Ee << 14) ^ (Ee >>> 9 | $ << 23), g = (Ee >>> 14 | $ << 18) ^ (Ee >>> 18 | $ << 14) ^ ($ >>> 9 | Ee << 23), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = $ & H ^ ~$ & U, g = Ee & Y ^ ~Ee & S, _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = i[I * 2], g = i[I * 2 + 1], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = a[I % 16], g = u[I % 16], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, b = v & 65535 | P << 16, x = _ & 65535 | E << 16, f = b, g = x, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = (M >>> 28 | te << 4) ^ (te >>> 2 | M << 30) ^ (te >>> 7 | M << 25), g = (te >>> 28 | M << 4) ^ (M >>> 2 | te << 30) ^ (M >>> 7 | te << 25), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, f = M & N ^ M & L ^ N & L, g = te & R ^ te & K ^ R & K, _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, X = v & 65535 | P << 16, Ce = _ & 65535 | E << 16, f = Z, g = ue, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = b, g = x, _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, Z = v & 65535 | P << 16, ue = _ & 65535 | E << 16, N = ce, L = D, B = oe, $ = Z, H = J, U = Q, V = T, M = X, R = re, K = pe, ge = ie, Ee = ue, Y = ve, S = Pe, m = De, te = Ce, I % 16 === 15) + var ce = P, D = O, oe = L, Z = B, J = k, ee = q, T = U, X = V, re = Q, pe = R, ie = K, ue = ge, ve = Ee, Pe = Y, De = A, Ce = m; + if (f = V, g = m, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = (k >>> 14 | Ee << 18) ^ (k >>> 18 | Ee << 14) ^ (Ee >>> 9 | k << 23), g = (Ee >>> 14 | k << 18) ^ (Ee >>> 18 | k << 14) ^ (k >>> 9 | Ee << 23), E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, f = k & q ^ ~k & U, g = Ee & Y ^ ~Ee & A, E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, f = i[I * 2], g = i[I * 2 + 1], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, f = a[I % 16], g = u[I % 16], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, b = v & 65535 | M << 16, x = E & 65535 | S << 16, f = b, g = x, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = (P >>> 28 | Q << 4) ^ (Q >>> 2 | P << 30) ^ (Q >>> 7 | P << 25), g = (Q >>> 28 | P << 4) ^ (P >>> 2 | Q << 30) ^ (P >>> 7 | Q << 25), E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, f = P & O ^ P & L ^ O & L, g = Q & R ^ Q & K ^ R & K, E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, X = v & 65535 | M << 16, Ce = E & 65535 | S << 16, f = Z, g = ue, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = b, g = x, E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, Z = v & 65535 | M << 16, ue = E & 65535 | S << 16, O = ce, L = D, B = oe, k = Z, q = J, U = ee, V = T, P = X, R = re, K = pe, ge = ie, Ee = ue, Y = ve, A = Pe, m = De, Q = Ce, I % 16 === 15) for (var F = 0; F < 16; F++) - f = a[F], g = u[F], _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = a[(F + 9) % 16], g = u[(F + 9) % 16], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, b = a[(F + 1) % 16], x = u[(F + 1) % 16], f = (b >>> 1 | x << 31) ^ (b >>> 8 | x << 24) ^ b >>> 7, g = (x >>> 1 | b << 31) ^ (x >>> 8 | b << 24) ^ (x >>> 7 | b << 25), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, b = a[(F + 14) % 16], x = u[(F + 14) % 16], f = (b >>> 19 | x << 13) ^ (x >>> 29 | b << 3) ^ b >>> 6, g = (x >>> 19 | b << 13) ^ (b >>> 29 | x << 3) ^ (x >>> 6 | b << 26), _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, a[F] = v & 65535 | P << 16, u[F] = _ & 65535 | E << 16; + f = a[F], g = u[F], E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = a[(F + 9) % 16], g = u[(F + 9) % 16], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, b = a[(F + 1) % 16], x = u[(F + 1) % 16], f = (b >>> 1 | x << 31) ^ (b >>> 8 | x << 24) ^ b >>> 7, g = (x >>> 1 | b << 31) ^ (x >>> 8 | b << 24) ^ (x >>> 7 | b << 25), E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, b = a[(F + 14) % 16], x = u[(F + 14) % 16], f = (b >>> 19 | x << 13) ^ (x >>> 29 | b << 3) ^ b >>> 6, g = (x >>> 19 | b << 13) ^ (b >>> 29 | x << 3) ^ (x >>> 6 | b << 26), E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, a[F] = v & 65535 | M << 16, u[F] = E & 65535 | S << 16; } - f = M, g = te, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[0], g = d[0], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[0] = M = v & 65535 | P << 16, d[0] = te = _ & 65535 | E << 16, f = N, g = R, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[1], g = d[1], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[1] = N = v & 65535 | P << 16, d[1] = R = _ & 65535 | E << 16, f = L, g = K, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[2], g = d[2], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[2] = L = v & 65535 | P << 16, d[2] = K = _ & 65535 | E << 16, f = B, g = ge, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[3], g = d[3], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[3] = B = v & 65535 | P << 16, d[3] = ge = _ & 65535 | E << 16, f = $, g = Ee, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[4], g = d[4], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[4] = $ = v & 65535 | P << 16, d[4] = Ee = _ & 65535 | E << 16, f = H, g = Y, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[5], g = d[5], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[5] = H = v & 65535 | P << 16, d[5] = Y = _ & 65535 | E << 16, f = U, g = S, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[6], g = d[6], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[6] = U = v & 65535 | P << 16, d[6] = S = _ & 65535 | E << 16, f = V, g = m, _ = g & 65535, E = g >>> 16, v = f & 65535, P = f >>> 16, f = l[7], g = d[7], _ += g & 65535, E += g >>> 16, v += f & 65535, P += f >>> 16, E += _ >>> 16, v += E >>> 16, P += v >>> 16, l[7] = V = v & 65535 | P << 16, d[7] = m = _ & 65535 | E << 16, w += 128, A -= 128; + f = P, g = Q, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[0], g = d[0], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[0] = P = v & 65535 | M << 16, d[0] = Q = E & 65535 | S << 16, f = O, g = R, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[1], g = d[1], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[1] = O = v & 65535 | M << 16, d[1] = R = E & 65535 | S << 16, f = L, g = K, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[2], g = d[2], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[2] = L = v & 65535 | M << 16, d[2] = K = E & 65535 | S << 16, f = B, g = ge, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[3], g = d[3], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[3] = B = v & 65535 | M << 16, d[3] = ge = E & 65535 | S << 16, f = k, g = Ee, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[4], g = d[4], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[4] = k = v & 65535 | M << 16, d[4] = Ee = E & 65535 | S << 16, f = q, g = Y, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[5], g = d[5], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[5] = q = v & 65535 | M << 16, d[5] = Y = E & 65535 | S << 16, f = U, g = A, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[6], g = d[6], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[6] = U = v & 65535 | M << 16, d[6] = A = E & 65535 | S << 16, f = V, g = m, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[7], g = d[7], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[7] = V = v & 65535 | M << 16, d[7] = m = E & 65535 | S << 16, w += 128, _ -= 128; } return w; } @@ -6982,16 +7494,16 @@ var O4 = {}; return u.clean(), l; } t.hash = o; -})(O4); +})(a8); (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.convertSecretKeyToX25519 = t.convertPublicKeyToX25519 = t.verify = t.sign = t.extractPublicKeyFromSecretKey = t.generateKeyPair = t.generateKeyPairFromSeed = t.SEED_LENGTH = t.SECRET_KEY_LENGTH = t.PUBLIC_KEY_LENGTH = t.SIGNATURE_LENGTH = void 0; - const e = Pa, r = O4, n = ki; + const e = Da, r = a8, n = Bi; t.SIGNATURE_LENGTH = 64, t.PUBLIC_KEY_LENGTH = 32, t.SECRET_KEY_LENGTH = 64, t.SEED_LENGTH = 32; function i(Z) { const J = new Float64Array(16); if (Z) - for (let Q = 0; Q < Z.length; Q++) - J[Q] = Z[Q]; + for (let ee = 0; ee < Z.length; ee++) + J[ee] = Z[ee]; return J; } const s = new Uint8Array(32); @@ -7082,144 +7594,144 @@ var O4 = {}; 9344, 11139 ]); - function A(Z, J) { - for (let Q = 0; Q < 16; Q++) - Z[Q] = J[Q] | 0; + function _(Z, J) { + for (let ee = 0; ee < 16; ee++) + Z[ee] = J[ee] | 0; } - function M(Z) { + function P(Z) { let J = 1; - for (let Q = 0; Q < 16; Q++) { - let T = Z[Q] + J + 65535; - J = Math.floor(T / 65536), Z[Q] = T - J * 65536; + for (let ee = 0; ee < 16; ee++) { + let T = Z[ee] + J + 65535; + J = Math.floor(T / 65536), Z[ee] = T - J * 65536; } Z[0] += J - 1 + 37 * (J - 1); } - function N(Z, J, Q) { - const T = ~(Q - 1); + function O(Z, J, ee) { + const T = ~(ee - 1); for (let X = 0; X < 16; X++) { const re = T & (Z[X] ^ J[X]); Z[X] ^= re, J[X] ^= re; } } function L(Z, J) { - const Q = i(), T = i(); + const ee = i(), T = i(); for (let X = 0; X < 16; X++) T[X] = J[X]; - M(T), M(T), M(T); + P(T), P(T), P(T); for (let X = 0; X < 2; X++) { - Q[0] = T[0] - 65517; + ee[0] = T[0] - 65517; for (let pe = 1; pe < 15; pe++) - Q[pe] = T[pe] - 65535 - (Q[pe - 1] >> 16 & 1), Q[pe - 1] &= 65535; - Q[15] = T[15] - 32767 - (Q[14] >> 16 & 1); - const re = Q[15] >> 16 & 1; - Q[14] &= 65535, N(T, Q, 1 - re); + ee[pe] = T[pe] - 65535 - (ee[pe - 1] >> 16 & 1), ee[pe - 1] &= 65535; + ee[15] = T[15] - 32767 - (ee[14] >> 16 & 1); + const re = ee[15] >> 16 & 1; + ee[14] &= 65535, O(T, ee, 1 - re); } for (let X = 0; X < 16; X++) Z[2 * X] = T[X] & 255, Z[2 * X + 1] = T[X] >> 8; } function B(Z, J) { - let Q = 0; + let ee = 0; for (let T = 0; T < 32; T++) - Q |= Z[T] ^ J[T]; - return (1 & Q - 1 >>> 8) - 1; + ee |= Z[T] ^ J[T]; + return (1 & ee - 1 >>> 8) - 1; } - function $(Z, J) { - const Q = new Uint8Array(32), T = new Uint8Array(32); - return L(Q, Z), L(T, J), B(Q, T); + function k(Z, J) { + const ee = new Uint8Array(32), T = new Uint8Array(32); + return L(ee, Z), L(T, J), B(ee, T); } - function H(Z) { + function q(Z) { const J = new Uint8Array(32); return L(J, Z), J[0] & 1; } function U(Z, J) { - for (let Q = 0; Q < 16; Q++) - Z[Q] = J[2 * Q] + (J[2 * Q + 1] << 8); + for (let ee = 0; ee < 16; ee++) + Z[ee] = J[2 * ee] + (J[2 * ee + 1] << 8); Z[15] &= 32767; } - function V(Z, J, Q) { + function V(Z, J, ee) { for (let T = 0; T < 16; T++) - Z[T] = J[T] + Q[T]; + Z[T] = J[T] + ee[T]; } - function te(Z, J, Q) { + function Q(Z, J, ee) { for (let T = 0; T < 16; T++) - Z[T] = J[T] - Q[T]; + Z[T] = J[T] - ee[T]; } - function R(Z, J, Q) { - let T, X, re = 0, pe = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = 0, Me = 0, Ne = 0, Ke = 0, Le = 0, qe = 0, ze = 0, _e = 0, Ze = 0, at = 0, ke = 0, Qe = 0, tt = 0, Ye = 0, dt = 0, lt = 0, ct = 0, qt = 0, Jt = 0, Et = 0, er = 0, Xt = 0, Dt = 0, kt = Q[0], Ct = Q[1], gt = Q[2], Rt = Q[3], Nt = Q[4], vt = Q[5], $t = Q[6], Ft = Q[7], rt = Q[8], Bt = Q[9], k = Q[10], q = Q[11], W = Q[12], C = Q[13], G = Q[14], j = Q[15]; - T = J[0], re += T * kt, pe += T * Ct, ie += T * gt, ue += T * Rt, ve += T * Nt, Pe += T * vt, De += T * $t, Ce += T * Ft, $e += T * rt, Me += T * Bt, Ne += T * k, Ke += T * q, Le += T * W, qe += T * C, ze += T * G, _e += T * j, T = J[1], pe += T * kt, ie += T * Ct, ue += T * gt, ve += T * Rt, Pe += T * Nt, De += T * vt, Ce += T * $t, $e += T * Ft, Me += T * rt, Ne += T * Bt, Ke += T * k, Le += T * q, qe += T * W, ze += T * C, _e += T * G, Ze += T * j, T = J[2], ie += T * kt, ue += T * Ct, ve += T * gt, Pe += T * Rt, De += T * Nt, Ce += T * vt, $e += T * $t, Me += T * Ft, Ne += T * rt, Ke += T * Bt, Le += T * k, qe += T * q, ze += T * W, _e += T * C, Ze += T * G, at += T * j, T = J[3], ue += T * kt, ve += T * Ct, Pe += T * gt, De += T * Rt, Ce += T * Nt, $e += T * vt, Me += T * $t, Ne += T * Ft, Ke += T * rt, Le += T * Bt, qe += T * k, ze += T * q, _e += T * W, Ze += T * C, at += T * G, ke += T * j, T = J[4], ve += T * kt, Pe += T * Ct, De += T * gt, Ce += T * Rt, $e += T * Nt, Me += T * vt, Ne += T * $t, Ke += T * Ft, Le += T * rt, qe += T * Bt, ze += T * k, _e += T * q, Ze += T * W, at += T * C, ke += T * G, Qe += T * j, T = J[5], Pe += T * kt, De += T * Ct, Ce += T * gt, $e += T * Rt, Me += T * Nt, Ne += T * vt, Ke += T * $t, Le += T * Ft, qe += T * rt, ze += T * Bt, _e += T * k, Ze += T * q, at += T * W, ke += T * C, Qe += T * G, tt += T * j, T = J[6], De += T * kt, Ce += T * Ct, $e += T * gt, Me += T * Rt, Ne += T * Nt, Ke += T * vt, Le += T * $t, qe += T * Ft, ze += T * rt, _e += T * Bt, Ze += T * k, at += T * q, ke += T * W, Qe += T * C, tt += T * G, Ye += T * j, T = J[7], Ce += T * kt, $e += T * Ct, Me += T * gt, Ne += T * Rt, Ke += T * Nt, Le += T * vt, qe += T * $t, ze += T * Ft, _e += T * rt, Ze += T * Bt, at += T * k, ke += T * q, Qe += T * W, tt += T * C, Ye += T * G, dt += T * j, T = J[8], $e += T * kt, Me += T * Ct, Ne += T * gt, Ke += T * Rt, Le += T * Nt, qe += T * vt, ze += T * $t, _e += T * Ft, Ze += T * rt, at += T * Bt, ke += T * k, Qe += T * q, tt += T * W, Ye += T * C, dt += T * G, lt += T * j, T = J[9], Me += T * kt, Ne += T * Ct, Ke += T * gt, Le += T * Rt, qe += T * Nt, ze += T * vt, _e += T * $t, Ze += T * Ft, at += T * rt, ke += T * Bt, Qe += T * k, tt += T * q, Ye += T * W, dt += T * C, lt += T * G, ct += T * j, T = J[10], Ne += T * kt, Ke += T * Ct, Le += T * gt, qe += T * Rt, ze += T * Nt, _e += T * vt, Ze += T * $t, at += T * Ft, ke += T * rt, Qe += T * Bt, tt += T * k, Ye += T * q, dt += T * W, lt += T * C, ct += T * G, qt += T * j, T = J[11], Ke += T * kt, Le += T * Ct, qe += T * gt, ze += T * Rt, _e += T * Nt, Ze += T * vt, at += T * $t, ke += T * Ft, Qe += T * rt, tt += T * Bt, Ye += T * k, dt += T * q, lt += T * W, ct += T * C, qt += T * G, Jt += T * j, T = J[12], Le += T * kt, qe += T * Ct, ze += T * gt, _e += T * Rt, Ze += T * Nt, at += T * vt, ke += T * $t, Qe += T * Ft, tt += T * rt, Ye += T * Bt, dt += T * k, lt += T * q, ct += T * W, qt += T * C, Jt += T * G, Et += T * j, T = J[13], qe += T * kt, ze += T * Ct, _e += T * gt, Ze += T * Rt, at += T * Nt, ke += T * vt, Qe += T * $t, tt += T * Ft, Ye += T * rt, dt += T * Bt, lt += T * k, ct += T * q, qt += T * W, Jt += T * C, Et += T * G, er += T * j, T = J[14], ze += T * kt, _e += T * Ct, Ze += T * gt, at += T * Rt, ke += T * Nt, Qe += T * vt, tt += T * $t, Ye += T * Ft, dt += T * rt, lt += T * Bt, ct += T * k, qt += T * q, Jt += T * W, Et += T * C, er += T * G, Xt += T * j, T = J[15], _e += T * kt, Ze += T * Ct, at += T * gt, ke += T * Rt, Qe += T * Nt, tt += T * vt, Ye += T * $t, dt += T * Ft, lt += T * rt, ct += T * Bt, qt += T * k, Jt += T * q, Et += T * W, er += T * C, Xt += T * G, Dt += T * j, re += 38 * Ze, pe += 38 * at, ie += 38 * ke, ue += 38 * Qe, ve += 38 * tt, Pe += 38 * Ye, De += 38 * dt, Ce += 38 * lt, $e += 38 * ct, Me += 38 * qt, Ne += 38 * Jt, Ke += 38 * Et, Le += 38 * er, qe += 38 * Xt, ze += 38 * Dt, X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = pe + X + 65535, X = Math.floor(T / 65536), pe = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = pe + X + 65535, X = Math.floor(T / 65536), pe = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), Z[0] = re, Z[1] = pe, Z[2] = ie, Z[3] = ue, Z[4] = ve, Z[5] = Pe, Z[6] = De, Z[7] = Ce, Z[8] = $e, Z[9] = Me, Z[10] = Ne, Z[11] = Ke, Z[12] = Le, Z[13] = qe, Z[14] = ze, Z[15] = _e; + function R(Z, J, ee) { + let T, X, re = 0, pe = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = 0, Me = 0, Ne = 0, Ke = 0, Le = 0, qe = 0, ze = 0, _e = 0, Ze = 0, at = 0, ke = 0, Qe = 0, tt = 0, Ye = 0, dt = 0, lt = 0, ct = 0, qt = 0, Jt = 0, Et = 0, er = 0, Xt = 0, Dt = 0, kt = ee[0], Ct = ee[1], mt = ee[2], Rt = ee[3], Nt = ee[4], bt = ee[5], $t = ee[6], Ft = ee[7], rt = ee[8], Bt = ee[9], $ = ee[10], z = ee[11], H = ee[12], C = ee[13], G = ee[14], j = ee[15]; + T = J[0], re += T * kt, pe += T * Ct, ie += T * mt, ue += T * Rt, ve += T * Nt, Pe += T * bt, De += T * $t, Ce += T * Ft, $e += T * rt, Me += T * Bt, Ne += T * $, Ke += T * z, Le += T * H, qe += T * C, ze += T * G, _e += T * j, T = J[1], pe += T * kt, ie += T * Ct, ue += T * mt, ve += T * Rt, Pe += T * Nt, De += T * bt, Ce += T * $t, $e += T * Ft, Me += T * rt, Ne += T * Bt, Ke += T * $, Le += T * z, qe += T * H, ze += T * C, _e += T * G, Ze += T * j, T = J[2], ie += T * kt, ue += T * Ct, ve += T * mt, Pe += T * Rt, De += T * Nt, Ce += T * bt, $e += T * $t, Me += T * Ft, Ne += T * rt, Ke += T * Bt, Le += T * $, qe += T * z, ze += T * H, _e += T * C, Ze += T * G, at += T * j, T = J[3], ue += T * kt, ve += T * Ct, Pe += T * mt, De += T * Rt, Ce += T * Nt, $e += T * bt, Me += T * $t, Ne += T * Ft, Ke += T * rt, Le += T * Bt, qe += T * $, ze += T * z, _e += T * H, Ze += T * C, at += T * G, ke += T * j, T = J[4], ve += T * kt, Pe += T * Ct, De += T * mt, Ce += T * Rt, $e += T * Nt, Me += T * bt, Ne += T * $t, Ke += T * Ft, Le += T * rt, qe += T * Bt, ze += T * $, _e += T * z, Ze += T * H, at += T * C, ke += T * G, Qe += T * j, T = J[5], Pe += T * kt, De += T * Ct, Ce += T * mt, $e += T * Rt, Me += T * Nt, Ne += T * bt, Ke += T * $t, Le += T * Ft, qe += T * rt, ze += T * Bt, _e += T * $, Ze += T * z, at += T * H, ke += T * C, Qe += T * G, tt += T * j, T = J[6], De += T * kt, Ce += T * Ct, $e += T * mt, Me += T * Rt, Ne += T * Nt, Ke += T * bt, Le += T * $t, qe += T * Ft, ze += T * rt, _e += T * Bt, Ze += T * $, at += T * z, ke += T * H, Qe += T * C, tt += T * G, Ye += T * j, T = J[7], Ce += T * kt, $e += T * Ct, Me += T * mt, Ne += T * Rt, Ke += T * Nt, Le += T * bt, qe += T * $t, ze += T * Ft, _e += T * rt, Ze += T * Bt, at += T * $, ke += T * z, Qe += T * H, tt += T * C, Ye += T * G, dt += T * j, T = J[8], $e += T * kt, Me += T * Ct, Ne += T * mt, Ke += T * Rt, Le += T * Nt, qe += T * bt, ze += T * $t, _e += T * Ft, Ze += T * rt, at += T * Bt, ke += T * $, Qe += T * z, tt += T * H, Ye += T * C, dt += T * G, lt += T * j, T = J[9], Me += T * kt, Ne += T * Ct, Ke += T * mt, Le += T * Rt, qe += T * Nt, ze += T * bt, _e += T * $t, Ze += T * Ft, at += T * rt, ke += T * Bt, Qe += T * $, tt += T * z, Ye += T * H, dt += T * C, lt += T * G, ct += T * j, T = J[10], Ne += T * kt, Ke += T * Ct, Le += T * mt, qe += T * Rt, ze += T * Nt, _e += T * bt, Ze += T * $t, at += T * Ft, ke += T * rt, Qe += T * Bt, tt += T * $, Ye += T * z, dt += T * H, lt += T * C, ct += T * G, qt += T * j, T = J[11], Ke += T * kt, Le += T * Ct, qe += T * mt, ze += T * Rt, _e += T * Nt, Ze += T * bt, at += T * $t, ke += T * Ft, Qe += T * rt, tt += T * Bt, Ye += T * $, dt += T * z, lt += T * H, ct += T * C, qt += T * G, Jt += T * j, T = J[12], Le += T * kt, qe += T * Ct, ze += T * mt, _e += T * Rt, Ze += T * Nt, at += T * bt, ke += T * $t, Qe += T * Ft, tt += T * rt, Ye += T * Bt, dt += T * $, lt += T * z, ct += T * H, qt += T * C, Jt += T * G, Et += T * j, T = J[13], qe += T * kt, ze += T * Ct, _e += T * mt, Ze += T * Rt, at += T * Nt, ke += T * bt, Qe += T * $t, tt += T * Ft, Ye += T * rt, dt += T * Bt, lt += T * $, ct += T * z, qt += T * H, Jt += T * C, Et += T * G, er += T * j, T = J[14], ze += T * kt, _e += T * Ct, Ze += T * mt, at += T * Rt, ke += T * Nt, Qe += T * bt, tt += T * $t, Ye += T * Ft, dt += T * rt, lt += T * Bt, ct += T * $, qt += T * z, Jt += T * H, Et += T * C, er += T * G, Xt += T * j, T = J[15], _e += T * kt, Ze += T * Ct, at += T * mt, ke += T * Rt, Qe += T * Nt, tt += T * bt, Ye += T * $t, dt += T * Ft, lt += T * rt, ct += T * Bt, qt += T * $, Jt += T * z, Et += T * H, er += T * C, Xt += T * G, Dt += T * j, re += 38 * Ze, pe += 38 * at, ie += 38 * ke, ue += 38 * Qe, ve += 38 * tt, Pe += 38 * Ye, De += 38 * dt, Ce += 38 * lt, $e += 38 * ct, Me += 38 * qt, Ne += 38 * Jt, Ke += 38 * Et, Le += 38 * er, qe += 38 * Xt, ze += 38 * Dt, X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = pe + X + 65535, X = Math.floor(T / 65536), pe = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = pe + X + 65535, X = Math.floor(T / 65536), pe = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), Z[0] = re, Z[1] = pe, Z[2] = ie, Z[3] = ue, Z[4] = ve, Z[5] = Pe, Z[6] = De, Z[7] = Ce, Z[8] = $e, Z[9] = Me, Z[10] = Ne, Z[11] = Ke, Z[12] = Le, Z[13] = qe, Z[14] = ze, Z[15] = _e; } function K(Z, J) { R(Z, J, J); } function ge(Z, J) { - const Q = i(); + const ee = i(); let T; for (T = 0; T < 16; T++) - Q[T] = J[T]; + ee[T] = J[T]; for (T = 253; T >= 0; T--) - K(Q, Q), T !== 2 && T !== 4 && R(Q, Q, J); + K(ee, ee), T !== 2 && T !== 4 && R(ee, ee, J); for (T = 0; T < 16; T++) - Z[T] = Q[T]; + Z[T] = ee[T]; } function Ee(Z, J) { - const Q = i(); + const ee = i(); let T; for (T = 0; T < 16; T++) - Q[T] = J[T]; + ee[T] = J[T]; for (T = 250; T >= 0; T--) - K(Q, Q), T !== 1 && R(Q, Q, J); + K(ee, ee), T !== 1 && R(ee, ee, J); for (T = 0; T < 16; T++) - Z[T] = Q[T]; + Z[T] = ee[T]; } function Y(Z, J) { - const Q = i(), T = i(), X = i(), re = i(), pe = i(), ie = i(), ue = i(), ve = i(), Pe = i(); - te(Q, Z[1], Z[0]), te(Pe, J[1], J[0]), R(Q, Q, Pe), V(T, Z[0], Z[1]), V(Pe, J[0], J[1]), R(T, T, Pe), R(X, Z[3], J[3]), R(X, X, l), R(re, Z[2], J[2]), V(re, re, re), te(pe, T, Q), te(ie, re, X), V(ue, re, X), V(ve, T, Q), R(Z[0], pe, ie), R(Z[1], ve, ue), R(Z[2], ue, ie), R(Z[3], pe, ve); + const ee = i(), T = i(), X = i(), re = i(), pe = i(), ie = i(), ue = i(), ve = i(), Pe = i(); + Q(ee, Z[1], Z[0]), Q(Pe, J[1], J[0]), R(ee, ee, Pe), V(T, Z[0], Z[1]), V(Pe, J[0], J[1]), R(T, T, Pe), R(X, Z[3], J[3]), R(X, X, l), R(re, Z[2], J[2]), V(re, re, re), Q(pe, T, ee), Q(ie, re, X), V(ue, re, X), V(ve, T, ee), R(Z[0], pe, ie), R(Z[1], ve, ue), R(Z[2], ue, ie), R(Z[3], pe, ve); } - function S(Z, J, Q) { + function A(Z, J, ee) { for (let T = 0; T < 4; T++) - N(Z[T], J[T], Q); + O(Z[T], J[T], ee); } function m(Z, J) { - const Q = i(), T = i(), X = i(); - ge(X, J[2]), R(Q, J[0], X), R(T, J[1], X), L(Z, T), Z[31] ^= H(Q) << 7; + const ee = i(), T = i(), X = i(); + ge(X, J[2]), R(ee, J[0], X), R(T, J[1], X), L(Z, T), Z[31] ^= q(ee) << 7; } - function f(Z, J, Q) { - A(Z[0], o), A(Z[1], a), A(Z[2], a), A(Z[3], o); + function f(Z, J, ee) { + _(Z[0], o), _(Z[1], a), _(Z[2], a), _(Z[3], o); for (let T = 255; T >= 0; --T) { - const X = Q[T / 8 | 0] >> (T & 7) & 1; - S(Z, J, X), Y(J, Z), Y(Z, Z), S(Z, J, X); + const X = ee[T / 8 | 0] >> (T & 7) & 1; + A(Z, J, X), Y(J, Z), Y(Z, Z), A(Z, J, X); } } function g(Z, J) { - const Q = [i(), i(), i(), i()]; - A(Q[0], d), A(Q[1], p), A(Q[2], a), R(Q[3], d, p), f(Z, Q, J); + const ee = [i(), i(), i(), i()]; + _(ee[0], d), _(ee[1], p), _(ee[2], a), R(ee[3], d, p), f(Z, ee, J); } function b(Z) { if (Z.length !== t.SEED_LENGTH) throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`); const J = (0, r.hash)(Z); J[0] &= 248, J[31] &= 127, J[31] |= 64; - const Q = new Uint8Array(32), T = [i(), i(), i(), i()]; - g(T, J), m(Q, T); + const ee = new Uint8Array(32), T = [i(), i(), i(), i()]; + g(T, J), m(ee, T); const X = new Uint8Array(64); - return X.set(Z), X.set(Q, 32), { - publicKey: Q, + return X.set(Z), X.set(ee, 32), { + publicKey: ee, secretKey: X }; } t.generateKeyPairFromSeed = b; function x(Z) { - const J = (0, e.randomBytes)(32, Z), Q = b(J); - return (0, n.wipe)(J), Q; + const J = (0, e.randomBytes)(32, Z), ee = b(J); + return (0, n.wipe)(J), ee; } t.generateKeyPair = x; - function _(Z) { + function E(Z) { if (Z.length !== t.SECRET_KEY_LENGTH) throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`); return new Uint8Array(Z.subarray(32)); } - t.extractPublicKeyFromSecretKey = _; - const E = new Float64Array([ + t.extractPublicKeyFromSecretKey = E; + const S = new Float64Array([ 237, 211, 245, @@ -7254,93 +7766,93 @@ var O4 = {}; 16 ]); function v(Z, J) { - let Q, T, X, re; + let ee, T, X, re; for (T = 63; T >= 32; --T) { - for (Q = 0, X = T - 32, re = T - 12; X < re; ++X) - J[X] += Q - 16 * J[T] * E[X - (T - 32)], Q = Math.floor((J[X] + 128) / 256), J[X] -= Q * 256; - J[X] += Q, J[T] = 0; + for (ee = 0, X = T - 32, re = T - 12; X < re; ++X) + J[X] += ee - 16 * J[T] * S[X - (T - 32)], ee = Math.floor((J[X] + 128) / 256), J[X] -= ee * 256; + J[X] += ee, J[T] = 0; } - for (Q = 0, X = 0; X < 32; X++) - J[X] += Q - (J[31] >> 4) * E[X], Q = J[X] >> 8, J[X] &= 255; + for (ee = 0, X = 0; X < 32; X++) + J[X] += ee - (J[31] >> 4) * S[X], ee = J[X] >> 8, J[X] &= 255; for (X = 0; X < 32; X++) - J[X] -= Q * E[X]; + J[X] -= ee * S[X]; for (T = 0; T < 32; T++) J[T + 1] += J[T] >> 8, Z[T] = J[T] & 255; } - function P(Z) { + function M(Z) { const J = new Float64Array(64); - for (let Q = 0; Q < 64; Q++) - J[Q] = Z[Q]; - for (let Q = 0; Q < 64; Q++) - Z[Q] = 0; + for (let ee = 0; ee < 64; ee++) + J[ee] = Z[ee]; + for (let ee = 0; ee < 64; ee++) + Z[ee] = 0; v(Z, J); } function I(Z, J) { - const Q = new Float64Array(64), T = [i(), i(), i(), i()], X = (0, r.hash)(Z.subarray(0, 32)); + const ee = new Float64Array(64), T = [i(), i(), i(), i()], X = (0, r.hash)(Z.subarray(0, 32)); X[0] &= 248, X[31] &= 127, X[31] |= 64; const re = new Uint8Array(64); re.set(X.subarray(32), 32); const pe = new r.SHA512(); pe.update(re.subarray(32)), pe.update(J); const ie = pe.digest(); - pe.clean(), P(ie), g(T, ie), m(re, T), pe.reset(), pe.update(re.subarray(0, 32)), pe.update(Z.subarray(32)), pe.update(J); + pe.clean(), M(ie), g(T, ie), m(re, T), pe.reset(), pe.update(re.subarray(0, 32)), pe.update(Z.subarray(32)), pe.update(J); const ue = pe.digest(); - P(ue); + M(ue); for (let ve = 0; ve < 32; ve++) - Q[ve] = ie[ve]; + ee[ve] = ie[ve]; for (let ve = 0; ve < 32; ve++) for (let Pe = 0; Pe < 32; Pe++) - Q[ve + Pe] += ue[ve] * X[Pe]; - return v(re.subarray(32), Q), re; + ee[ve + Pe] += ue[ve] * X[Pe]; + return v(re.subarray(32), ee), re; } t.sign = I; function F(Z, J) { - const Q = i(), T = i(), X = i(), re = i(), pe = i(), ie = i(), ue = i(); - return A(Z[2], a), U(Z[1], J), K(X, Z[1]), R(re, X, u), te(X, X, Z[2]), V(re, Z[2], re), K(pe, re), K(ie, pe), R(ue, ie, pe), R(Q, ue, X), R(Q, Q, re), Ee(Q, Q), R(Q, Q, X), R(Q, Q, re), R(Q, Q, re), R(Z[0], Q, re), K(T, Z[0]), R(T, T, re), $(T, X) && R(Z[0], Z[0], w), K(T, Z[0]), R(T, T, re), $(T, X) ? -1 : (H(Z[0]) === J[31] >> 7 && te(Z[0], o, Z[0]), R(Z[3], Z[0], Z[1]), 0); + const ee = i(), T = i(), X = i(), re = i(), pe = i(), ie = i(), ue = i(); + return _(Z[2], a), U(Z[1], J), K(X, Z[1]), R(re, X, u), Q(X, X, Z[2]), V(re, Z[2], re), K(pe, re), K(ie, pe), R(ue, ie, pe), R(ee, ue, X), R(ee, ee, re), Ee(ee, ee), R(ee, ee, X), R(ee, ee, re), R(ee, ee, re), R(Z[0], ee, re), K(T, Z[0]), R(T, T, re), k(T, X) && R(Z[0], Z[0], w), K(T, Z[0]), R(T, T, re), k(T, X) ? -1 : (q(Z[0]) === J[31] >> 7 && Q(Z[0], o, Z[0]), R(Z[3], Z[0], Z[1]), 0); } - function ce(Z, J, Q) { + function ce(Z, J, ee) { const T = new Uint8Array(32), X = [i(), i(), i(), i()], re = [i(), i(), i(), i()]; - if (Q.length !== t.SIGNATURE_LENGTH) + if (ee.length !== t.SIGNATURE_LENGTH) throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`); if (F(re, Z)) return !1; const pe = new r.SHA512(); - pe.update(Q.subarray(0, 32)), pe.update(Z), pe.update(J); + pe.update(ee.subarray(0, 32)), pe.update(Z), pe.update(J); const ie = pe.digest(); - return P(ie), f(X, re, ie), g(re, Q.subarray(32)), Y(X, re), m(T, X), !B(Q, T); + return M(ie), f(X, re, ie), g(re, ee.subarray(32)), Y(X, re), m(T, X), !B(ee, T); } t.verify = ce; function D(Z) { let J = [i(), i(), i(), i()]; if (F(J, Z)) throw new Error("Ed25519: invalid public key"); - let Q = i(), T = i(), X = J[1]; - V(Q, a, X), te(T, a, X), ge(T, T), R(Q, Q, T); + let ee = i(), T = i(), X = J[1]; + V(ee, a, X), Q(T, a, X), ge(T, T), R(ee, ee, T); let re = new Uint8Array(32); - return L(re, Q), re; + return L(re, ee), re; } t.convertPublicKeyToX25519 = D; function oe(Z) { const J = (0, r.hash)(Z.subarray(0, 32)); J[0] &= 248, J[31] &= 127, J[31] |= 64; - const Q = new Uint8Array(J.subarray(0, 32)); - return (0, n.wipe)(J), Q; + const ee = new Uint8Array(J.subarray(0, 32)); + return (0, n.wipe)(J), ee; } t.convertSecretKeyToX25519 = oe; -})(Fv); -const $$ = "EdDSA", B$ = "JWT", e0 = ".", U0 = "base64url", N4 = "utf8", L4 = "utf8", F$ = ":", j$ = "did", U$ = "key", tx = "base58btc", q$ = "z", z$ = "K36", W$ = 32; -function k4(t = 0) { +})(Qv); +const mB = "EdDSA", vB = "JWT", h0 = ".", tp = "base64url", c8 = "utf8", u8 = "utf8", bB = ":", yB = "did", wB = "key", vx = "base58btc", xB = "z", _B = "K36", EB = 32; +function f8(t = 0) { return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); } -function Sd(t, e) { +function kd(t, e) { e || (e = t.reduce((i, s) => i + s.length, 0)); - const r = k4(e); + const r = f8(e); let n = 0; for (const i of t) r.set(i, n), n += i.length; return r; } -function H$(t, e) { +function SB(t, e) { if (t.length >= 255) throw new TypeError("Alphabet too long"); for (var r = new Uint8Array(256), n = 0; n < r.length; n++) @@ -7352,68 +7864,68 @@ function H$(t, e) { r[o] = i; } var a = t.length, u = t.charAt(0), l = Math.log(a) / Math.log(256), d = Math.log(256) / Math.log(a); - function p(M) { - if (M instanceof Uint8Array || (ArrayBuffer.isView(M) ? M = new Uint8Array(M.buffer, M.byteOffset, M.byteLength) : Array.isArray(M) && (M = Uint8Array.from(M))), !(M instanceof Uint8Array)) + function p(P) { + if (P instanceof Uint8Array || (ArrayBuffer.isView(P) ? P = new Uint8Array(P.buffer, P.byteOffset, P.byteLength) : Array.isArray(P) && (P = Uint8Array.from(P))), !(P instanceof Uint8Array)) throw new TypeError("Expected Uint8Array"); - if (M.length === 0) + if (P.length === 0) return ""; - for (var N = 0, L = 0, B = 0, $ = M.length; B !== $ && M[B] === 0; ) - B++, N++; - for (var H = ($ - B) * d + 1 >>> 0, U = new Uint8Array(H); B !== $; ) { - for (var V = M[B], te = 0, R = H - 1; (V !== 0 || te < L) && R !== -1; R--, te++) + for (var O = 0, L = 0, B = 0, k = P.length; B !== k && P[B] === 0; ) + B++, O++; + for (var q = (k - B) * d + 1 >>> 0, U = new Uint8Array(q); B !== k; ) { + for (var V = P[B], Q = 0, R = q - 1; (V !== 0 || Q < L) && R !== -1; R--, Q++) V += 256 * U[R] >>> 0, U[R] = V % a >>> 0, V = V / a >>> 0; if (V !== 0) throw new Error("Non-zero carry"); - L = te, B++; + L = Q, B++; } - for (var K = H - L; K !== H && U[K] === 0; ) + for (var K = q - L; K !== q && U[K] === 0; ) K++; - for (var ge = u.repeat(N); K < H; ++K) + for (var ge = u.repeat(O); K < q; ++K) ge += t.charAt(U[K]); return ge; } - function w(M) { - if (typeof M != "string") + function w(P) { + if (typeof P != "string") throw new TypeError("Expected String"); - if (M.length === 0) + if (P.length === 0) return new Uint8Array(); - var N = 0; - if (M[N] !== " ") { - for (var L = 0, B = 0; M[N] === u; ) - L++, N++; - for (var $ = (M.length - N) * l + 1 >>> 0, H = new Uint8Array($); M[N]; ) { - var U = r[M.charCodeAt(N)]; + var O = 0; + if (P[O] !== " ") { + for (var L = 0, B = 0; P[O] === u; ) + L++, O++; + for (var k = (P.length - O) * l + 1 >>> 0, q = new Uint8Array(k); P[O]; ) { + var U = r[P.charCodeAt(O)]; if (U === 255) return; - for (var V = 0, te = $ - 1; (U !== 0 || V < B) && te !== -1; te--, V++) - U += a * H[te] >>> 0, H[te] = U % 256 >>> 0, U = U / 256 >>> 0; + for (var V = 0, Q = k - 1; (U !== 0 || V < B) && Q !== -1; Q--, V++) + U += a * q[Q] >>> 0, q[Q] = U % 256 >>> 0, U = U / 256 >>> 0; if (U !== 0) throw new Error("Non-zero carry"); - B = V, N++; + B = V, O++; } - if (M[N] !== " ") { - for (var R = $ - B; R !== $ && H[R] === 0; ) + if (P[O] !== " ") { + for (var R = k - B; R !== k && q[R] === 0; ) R++; - for (var K = new Uint8Array(L + ($ - R)), ge = L; R !== $; ) - K[ge++] = H[R++]; + for (var K = new Uint8Array(L + (k - R)), ge = L; R !== k; ) + K[ge++] = q[R++]; return K; } } } - function A(M) { - var N = w(M); - if (N) - return N; + function _(P) { + var O = w(P); + if (O) + return O; throw new Error(`Non-${e} character`); } return { encode: p, decodeUnsafe: w, - decode: A + decode: _ }; } -var K$ = H$, V$ = K$; -const G$ = (t) => { +var AB = SB, PB = AB; +const MB = (t) => { if (t instanceof Uint8Array && t.constructor.name === "Uint8Array") return t; if (t instanceof ArrayBuffer) @@ -7421,8 +7933,8 @@ const G$ = (t) => { if (ArrayBuffer.isView(t)) return new Uint8Array(t.buffer, t.byteOffset, t.byteLength); throw new Error("Unknown type, must be binary type"); -}, Y$ = (t) => new TextEncoder().encode(t), J$ = (t) => new TextDecoder().decode(t); -class X$ { +}, IB = (t) => new TextEncoder().encode(t), CB = (t) => new TextDecoder().decode(t); +class TB { constructor(e, r, n) { this.name = e, this.prefix = r, this.baseEncode = n; } @@ -7432,7 +7944,7 @@ class X$ { throw Error("Unknown type, must be binary type"); } } -class Z$ { +class RB { constructor(e, r, n) { if (this.name = e, this.prefix = r, r.codePointAt(0) === void 0) throw new Error("Invalid prefix character"); @@ -7447,15 +7959,15 @@ class Z$ { throw Error("Can only multibase decode strings"); } or(e) { - return $4(this, e); + return l8(this, e); } } -class Q$ { +class DB { constructor(e) { this.decoders = e; } or(e) { - return $4(this, e); + return l8(this, e); } decode(e) { const r = e[0], n = this.decoders[r]; @@ -7464,13 +7976,13 @@ class Q$ { throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`); } } -const $4 = (t, e) => new Q$({ +const l8 = (t, e) => new DB({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); -class eB { +class OB { constructor(e, r, n, i) { - this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new X$(e, r, n), this.decoder = new Z$(e, r, i); + this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new TB(e, r, n), this.decoder = new RB(e, r, i); } encode(e) { return this.encoder.encode(e); @@ -7479,15 +7991,15 @@ class eB { return this.decoder.decode(e); } } -const q0 = ({ name: t, prefix: e, encode: r, decode: n }) => new eB(t, e, r, n), Hl = ({ prefix: t, name: e, alphabet: r }) => { - const { encode: n, decode: i } = V$(r, e); - return q0({ +const rp = ({ name: t, prefix: e, encode: r, decode: n }) => new OB(t, e, r, n), eh = ({ prefix: t, name: e, alphabet: r }) => { + const { encode: n, decode: i } = PB(r, e); + return rp({ prefix: t, name: e, encode: n, - decode: (s) => G$(i(s)) + decode: (s) => MB(i(s)) }); -}, tB = (t, e, r, n) => { +}, NB = (t, e, r, n) => { const i = {}; for (let d = 0; d < e.length; ++d) i[e[d]] = d; @@ -7505,7 +8017,7 @@ const q0 = ({ name: t, prefix: e, encode: r, decode: n }) => new eB(t, e, r, n), if (a >= r || 255 & u << 8 - a) throw new SyntaxError("Unexpected end of data"); return o; -}, rB = (t, e, r) => { +}, LB = (t, e, r) => { const n = e[e.length - 1] === "=", i = (1 << r) - 1; let s = "", o = 0, a = 0; for (let u = 0; u < t.length; ++u) @@ -7515,204 +8027,204 @@ const q0 = ({ name: t, prefix: e, encode: r, decode: n }) => new eB(t, e, r, n), for (; s.length * r & 7; ) s += "="; return s; -}, qn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => q0({ +}, qn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => rp({ prefix: e, name: t, encode(i) { - return rB(i, n, r); + return LB(i, n, r); }, decode(i) { - return tB(i, n, r, t); + return NB(i, n, r, t); } -}), nB = q0({ +}), kB = rp({ prefix: "\0", name: "identity", - encode: (t) => J$(t), - decode: (t) => Y$(t) -}), iB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + encode: (t) => CB(t), + decode: (t) => IB(t) +}), $B = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - identity: nB -}, Symbol.toStringTag, { value: "Module" })), sB = qn({ + identity: kB +}, Symbol.toStringTag, { value: "Module" })), BB = qn({ prefix: "0", name: "base2", alphabet: "01", bitsPerChar: 1 -}), oB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), FB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base2: sB -}, Symbol.toStringTag, { value: "Module" })), aB = qn({ + base2: BB +}, Symbol.toStringTag, { value: "Module" })), jB = qn({ prefix: "7", name: "base8", alphabet: "01234567", bitsPerChar: 3 -}), cB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), UB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base8: aB -}, Symbol.toStringTag, { value: "Module" })), uB = Hl({ + base8: jB +}, Symbol.toStringTag, { value: "Module" })), qB = eh({ prefix: "9", name: "base10", alphabet: "0123456789" -}), fB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), zB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base10: uB -}, Symbol.toStringTag, { value: "Module" })), lB = qn({ + base10: qB +}, Symbol.toStringTag, { value: "Module" })), WB = qn({ prefix: "f", name: "base16", alphabet: "0123456789abcdef", bitsPerChar: 4 -}), hB = qn({ +}), HB = qn({ prefix: "F", name: "base16upper", alphabet: "0123456789ABCDEF", bitsPerChar: 4 -}), dB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), KB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base16: lB, - base16upper: hB -}, Symbol.toStringTag, { value: "Module" })), pB = qn({ + base16: WB, + base16upper: HB +}, Symbol.toStringTag, { value: "Module" })), VB = qn({ prefix: "b", name: "base32", alphabet: "abcdefghijklmnopqrstuvwxyz234567", bitsPerChar: 5 -}), gB = qn({ +}), GB = qn({ prefix: "B", name: "base32upper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", bitsPerChar: 5 -}), mB = qn({ +}), YB = qn({ prefix: "c", name: "base32pad", alphabet: "abcdefghijklmnopqrstuvwxyz234567=", bitsPerChar: 5 -}), vB = qn({ +}), JB = qn({ prefix: "C", name: "base32padupper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", bitsPerChar: 5 -}), bB = qn({ +}), XB = qn({ prefix: "v", name: "base32hex", alphabet: "0123456789abcdefghijklmnopqrstuv", bitsPerChar: 5 -}), yB = qn({ +}), ZB = qn({ prefix: "V", name: "base32hexupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", bitsPerChar: 5 -}), wB = qn({ +}), QB = qn({ prefix: "t", name: "base32hexpad", alphabet: "0123456789abcdefghijklmnopqrstuv=", bitsPerChar: 5 -}), xB = qn({ +}), eF = qn({ prefix: "T", name: "base32hexpadupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=", bitsPerChar: 5 -}), _B = qn({ +}), tF = qn({ prefix: "h", name: "base32z", alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769", bitsPerChar: 5 -}), EB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), rF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base32: pB, - base32hex: bB, - base32hexpad: wB, - base32hexpadupper: xB, - base32hexupper: yB, - base32pad: mB, - base32padupper: vB, - base32upper: gB, - base32z: _B -}, Symbol.toStringTag, { value: "Module" })), SB = Hl({ + base32: VB, + base32hex: XB, + base32hexpad: QB, + base32hexpadupper: eF, + base32hexupper: ZB, + base32pad: YB, + base32padupper: JB, + base32upper: GB, + base32z: tF +}, Symbol.toStringTag, { value: "Module" })), nF = eh({ prefix: "k", name: "base36", alphabet: "0123456789abcdefghijklmnopqrstuvwxyz" -}), AB = Hl({ +}), iF = eh({ prefix: "K", name: "base36upper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" -}), PB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), sF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base36: SB, - base36upper: AB -}, Symbol.toStringTag, { value: "Module" })), MB = Hl({ + base36: nF, + base36upper: iF +}, Symbol.toStringTag, { value: "Module" })), oF = eh({ name: "base58btc", prefix: "z", alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" -}), IB = Hl({ +}), aF = eh({ name: "base58flickr", prefix: "Z", alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" -}), CB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), cF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base58btc: MB, - base58flickr: IB -}, Symbol.toStringTag, { value: "Module" })), TB = qn({ + base58btc: oF, + base58flickr: aF +}, Symbol.toStringTag, { value: "Module" })), uF = qn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 -}), RB = qn({ +}), fF = qn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 -}), DB = qn({ +}), lF = qn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 -}), OB = qn({ +}), hF = qn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", bitsPerChar: 6 -}), NB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), dF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base64: TB, - base64pad: RB, - base64url: DB, - base64urlpad: OB -}, Symbol.toStringTag, { value: "Module" })), B4 = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), LB = B4.reduce((t, e, r) => (t[r] = e, t), []), kB = B4.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); -function $B(t) { - return t.reduce((e, r) => (e += LB[r], e), ""); -} -function BB(t) { + base64: uF, + base64pad: fF, + base64url: lF, + base64urlpad: hF +}, Symbol.toStringTag, { value: "Module" })), h8 = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), pF = h8.reduce((t, e, r) => (t[r] = e, t), []), gF = h8.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); +function mF(t) { + return t.reduce((e, r) => (e += pF[r], e), ""); +} +function vF(t) { const e = []; for (const r of t) { - const n = kB[r.codePointAt(0)]; + const n = gF[r.codePointAt(0)]; if (n === void 0) throw new Error(`Non-base256emoji character: ${r}`); e.push(n); } return new Uint8Array(e); } -const FB = q0({ +const bF = rp({ prefix: "🚀", name: "base256emoji", - encode: $B, - decode: BB -}), jB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + encode: mF, + decode: vF +}), yF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base256emoji: FB + base256emoji: bF }, Symbol.toStringTag, { value: "Module" })); new TextEncoder(); new TextDecoder(); -const rx = { - ...iB, - ...oB, - ...cB, - ...fB, - ...dB, - ...EB, - ...PB, - ...CB, - ...NB, - ...jB -}; -function F4(t, e, r, n) { +const bx = { + ...$B, + ...FB, + ...UB, + ...zB, + ...KB, + ...rF, + ...sF, + ...cF, + ...dF, + ...yF +}; +function d8(t, e, r, n) { return { name: t, prefix: e, @@ -7724,80 +8236,80 @@ function F4(t, e, r, n) { decoder: { decode: n } }; } -const nx = F4("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), Xg = F4("ascii", "a", (t) => { +const yx = d8("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), lm = d8("ascii", "a", (t) => { let e = "a"; for (let r = 0; r < t.length; r++) e += String.fromCharCode(t[r]); return e; }, (t) => { t = t.substring(1); - const e = k4(t.length); + const e = f8(t.length); for (let r = 0; r < t.length; r++) e[r] = t.charCodeAt(r); return e; -}), j4 = { - utf8: nx, - "utf-8": nx, - hex: rx.base16, - latin1: Xg, - ascii: Xg, - binary: Xg, - ...rx +}), p8 = { + utf8: yx, + "utf-8": yx, + hex: bx.base16, + latin1: lm, + ascii: lm, + binary: lm, + ...bx }; function On(t, e = "utf8") { - const r = j4[e]; + const r = p8[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t.buffer, t.byteOffset, t.byteLength).toString("utf8") : r.encoder.encode(t).substring(1); } function Rn(t, e = "utf8") { - const r = j4[e]; + const r = p8[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t, "utf8") : r.decoder.decode(`${r.prefix}${t}`); } -function ix(t) { - return fc(On(Rn(t, U0), N4)); +function wx(t) { + return bc(On(Rn(t, tp), c8)); } -function t0(t) { - return On(Rn($o(t), N4), U0); +function d0(t) { + return On(Rn(jo(t), c8), tp); } -function U4(t) { - const e = Rn(z$, tx), r = q$ + On(Sd([e, t]), tx); - return [j$, U$, r].join(F$); +function g8(t) { + const e = Rn(_B, vx), r = xB + On(kd([e, t]), vx); + return [yB, wB, r].join(bB); } -function UB(t) { - return On(t, U0); +function wF(t) { + return On(t, tp); } -function qB(t) { - return Rn(t, U0); +function xF(t) { + return Rn(t, tp); } -function zB(t) { - return Rn([t0(t.header), t0(t.payload)].join(e0), L4); +function _F(t) { + return Rn([d0(t.header), d0(t.payload)].join(h0), u8); } -function WB(t) { +function EF(t) { return [ - t0(t.header), - t0(t.payload), - UB(t.signature) - ].join(e0); + d0(t.header), + d0(t.payload), + wF(t.signature) + ].join(h0); } -function v1(t) { - const e = t.split(e0), r = ix(e[0]), n = ix(e[1]), i = qB(e[2]), s = Rn(e.slice(0, 2).join(e0), L4); +function O1(t) { + const e = t.split(h0), r = wx(e[0]), n = wx(e[1]), i = xF(e[2]), s = Rn(e.slice(0, 2).join(h0), u8); return { header: r, payload: n, signature: i, data: s }; } -function sx(t = Pa.randomBytes(W$)) { - return Fv.generateKeyPairFromSeed(t); +function xx(t = Da.randomBytes(EB)) { + return Qv.generateKeyPairFromSeed(t); } -async function HB(t, e, r, n, i = mt.fromMiliseconds(Date.now())) { - const s = { alg: $$, typ: B$ }, o = U4(n.publicKey), a = i + r, u = { iss: o, sub: t, aud: e, iat: i, exp: a }, l = zB({ header: s, payload: u }), d = Fv.sign(n.secretKey, l); - return WB({ header: s, payload: u, signature: d }); +async function SF(t, e, r, n, i = vt.fromMiliseconds(Date.now())) { + const s = { alg: mB, typ: vB }, o = g8(n.publicKey), a = i + r, u = { iss: o, sub: t, aud: e, iat: i, exp: a }, l = _F({ header: s, payload: u }), d = Qv.sign(n.secretKey, l); + return EF({ header: s, payload: u, signature: d }); } -var ox = function(t, e, r) { +var _x = function(t, e, r) { if (r || arguments.length === 2) for (var n = 0, i = e.length, s; n < i; n++) (s || !(n in e)) && (s || (s = Array.prototype.slice.call(e, 0, n)), s[n] = e[n]); return t.concat(s || Array.prototype.slice.call(e)); -}, KB = ( +}, AF = ( /** @class */ /* @__PURE__ */ function() { function t(e, r, n) { @@ -7805,7 +8317,7 @@ var ox = function(t, e, r) { } return t; }() -), VB = ( +), PF = ( /** @class */ /* @__PURE__ */ function() { function t(e) { @@ -7813,7 +8325,7 @@ var ox = function(t, e, r) { } return t; }() -), GB = ( +), MF = ( /** @class */ /* @__PURE__ */ function() { function t(e, r, n, i) { @@ -7821,7 +8333,7 @@ var ox = function(t, e, r) { } return t; }() -), YB = ( +), IF = ( /** @class */ /* @__PURE__ */ function() { function t() { @@ -7829,7 +8341,7 @@ var ox = function(t, e, r) { } return t; }() -), JB = ( +), CF = ( /** @class */ /* @__PURE__ */ function() { function t() { @@ -7837,7 +8349,7 @@ var ox = function(t, e, r) { } return t; }() -), XB = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/, ZB = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, ax = 3, QB = [ +), TF = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/, RF = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, Ex = 3, DF = [ ["aol", /AOLShield\/([0-9\._]+)/], ["edge", /Edge\/([0-9\._]+)/], ["edge-ios", /EdgiOS\/([0-9\._]+)/], @@ -7875,8 +8387,8 @@ var ox = function(t, e, r) { ["ios-webview", /AppleWebKit\/([0-9\.]+).*Mobile/], ["ios-webview", /AppleWebKit\/([0-9\.]+).*Gecko\)$/], ["curl", /^curl\/([0-9\.]+)$/], - ["searchbot", XB] -], cx = [ + ["searchbot", TF] +], Sx = [ ["iOS", /iP(hone|od|ad)/], ["Android OS", /Android/], ["BlackBerry OS", /BlackBerry|BB10/], @@ -7904,11 +8416,11 @@ var ox = function(t, e, r) { ["BeOS", /BeOS/], ["OS/2", /OS\/2/] ]; -function eF(t) { - return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative" ? new JB() : typeof navigator < "u" ? rF(navigator.userAgent) : iF(); +function OF(t) { + return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative" ? new CF() : typeof navigator < "u" ? LF(navigator.userAgent) : $F(); } -function tF(t) { - return t !== "" && QB.reduce(function(e, r) { +function NF(t) { + return t !== "" && DF.reduce(function(e, r) { var n = r[0], i = r[1]; if (e) return e; @@ -7916,117 +8428,117 @@ function tF(t) { return !!s && [n, s]; }, !1); } -function rF(t) { - var e = tF(t); +function LF(t) { + var e = NF(t); if (!e) return null; var r = e[0], n = e[1]; if (r === "searchbot") - return new YB(); + return new IF(); var i = n[1] && n[1].split(".").join("_").split("_").slice(0, 3); - i ? i.length < ax && (i = ox(ox([], i, !0), sF(ax - i.length), !0)) : i = []; - var s = i.join("."), o = nF(t), a = ZB.exec(t); - return a && a[1] ? new GB(r, s, o, a[1]) : new KB(r, s, o); + i ? i.length < Ex && (i = _x(_x([], i, !0), BF(Ex - i.length), !0)) : i = []; + var s = i.join("."), o = kF(t), a = RF.exec(t); + return a && a[1] ? new MF(r, s, o, a[1]) : new AF(r, s, o); } -function nF(t) { - for (var e = 0, r = cx.length; e < r; e++) { - var n = cx[e], i = n[0], s = n[1], o = s.exec(t); +function kF(t) { + for (var e = 0, r = Sx.length; e < r; e++) { + var n = Sx[e], i = n[0], s = n[1], o = s.exec(t); if (o) return i; } return null; } -function iF() { +function $F() { var t = typeof process < "u" && process.version; - return t ? new VB(process.version.slice(1)) : null; + return t ? new PF(process.version.slice(1)) : null; } -function sF(t) { +function BF(t) { for (var e = [], r = 0; r < t; r++) e.push("0"); return e; } var Wr = {}; Object.defineProperty(Wr, "__esModule", { value: !0 }); -Wr.getLocalStorage = Wr.getLocalStorageOrThrow = Wr.getCrypto = Wr.getCryptoOrThrow = q4 = Wr.getLocation = Wr.getLocationOrThrow = jv = Wr.getNavigator = Wr.getNavigatorOrThrow = Kl = Wr.getDocument = Wr.getDocumentOrThrow = Wr.getFromWindowOrThrow = Wr.getFromWindow = void 0; -function yc(t) { +Wr.getLocalStorage = Wr.getLocalStorageOrThrow = Wr.getCrypto = Wr.getCryptoOrThrow = m8 = Wr.getLocation = Wr.getLocationOrThrow = eb = Wr.getNavigator = Wr.getNavigatorOrThrow = th = Wr.getDocument = Wr.getDocumentOrThrow = Wr.getFromWindowOrThrow = Wr.getFromWindow = void 0; +function Cc(t) { let e; return typeof window < "u" && typeof window[t] < "u" && (e = window[t]), e; } -Wr.getFromWindow = yc; -function Nu(t) { - const e = yc(t); +Wr.getFromWindow = Cc; +function Uu(t) { + const e = Cc(t); if (!e) throw new Error(`${t} is not defined in Window`); return e; } -Wr.getFromWindowOrThrow = Nu; -function oF() { - return Nu("document"); +Wr.getFromWindowOrThrow = Uu; +function FF() { + return Uu("document"); } -Wr.getDocumentOrThrow = oF; -function aF() { - return yc("document"); +Wr.getDocumentOrThrow = FF; +function jF() { + return Cc("document"); } -var Kl = Wr.getDocument = aF; -function cF() { - return Nu("navigator"); +var th = Wr.getDocument = jF; +function UF() { + return Uu("navigator"); } -Wr.getNavigatorOrThrow = cF; -function uF() { - return yc("navigator"); +Wr.getNavigatorOrThrow = UF; +function qF() { + return Cc("navigator"); } -var jv = Wr.getNavigator = uF; -function fF() { - return Nu("location"); +var eb = Wr.getNavigator = qF; +function zF() { + return Uu("location"); } -Wr.getLocationOrThrow = fF; -function lF() { - return yc("location"); +Wr.getLocationOrThrow = zF; +function WF() { + return Cc("location"); } -var q4 = Wr.getLocation = lF; -function hF() { - return Nu("crypto"); +var m8 = Wr.getLocation = WF; +function HF() { + return Uu("crypto"); } -Wr.getCryptoOrThrow = hF; -function dF() { - return yc("crypto"); +Wr.getCryptoOrThrow = HF; +function KF() { + return Cc("crypto"); } -Wr.getCrypto = dF; -function pF() { - return Nu("localStorage"); +Wr.getCrypto = KF; +function VF() { + return Uu("localStorage"); } -Wr.getLocalStorageOrThrow = pF; -function gF() { - return yc("localStorage"); +Wr.getLocalStorageOrThrow = VF; +function GF() { + return Cc("localStorage"); } -Wr.getLocalStorage = gF; -var Uv = {}; -Object.defineProperty(Uv, "__esModule", { value: !0 }); -var z4 = Uv.getWindowMetadata = void 0; -const ux = Wr; -function mF() { +Wr.getLocalStorage = GF; +var tb = {}; +Object.defineProperty(tb, "__esModule", { value: !0 }); +var v8 = tb.getWindowMetadata = void 0; +const Ax = Wr; +function YF() { let t, e; try { - t = ux.getDocumentOrThrow(), e = ux.getLocationOrThrow(); + t = Ax.getDocumentOrThrow(), e = Ax.getLocationOrThrow(); } catch { return null; } function r() { const p = t.getElementsByTagName("link"), w = []; - for (let A = 0; A < p.length; A++) { - const M = p[A], N = M.getAttribute("rel"); - if (N && N.toLowerCase().indexOf("icon") > -1) { - const L = M.getAttribute("href"); + for (let _ = 0; _ < p.length; _++) { + const P = p[_], O = P.getAttribute("rel"); + if (O && O.toLowerCase().indexOf("icon") > -1) { + const L = P.getAttribute("href"); if (L) if (L.toLowerCase().indexOf("https:") === -1 && L.toLowerCase().indexOf("http:") === -1 && L.indexOf("//") !== 0) { let B = e.protocol + "//" + e.host; if (L.indexOf("/") === 0) B += L; else { - const $ = e.pathname.split("/"); - $.pop(); - const H = $.join("/"); - B += H + "/" + L; + const k = e.pathname.split("/"); + k.pop(); + const q = k.join("/"); + B += q + "/" + L; } w.push(B); } else if (L.indexOf("//") === 0) { @@ -8040,10 +8552,10 @@ function mF() { } function n(...p) { const w = t.getElementsByTagName("meta"); - for (let A = 0; A < w.length; A++) { - const M = w[A], N = ["itemprop", "property", "name"].map((L) => M.getAttribute(L)).filter((L) => L ? p.includes(L) : !1); - if (N.length && N) { - const L = M.getAttribute("content"); + for (let _ = 0; _ < w.length; _++) { + const P = w[_], O = ["itemprop", "property", "name"].map((L) => P.getAttribute(L)).filter((L) => L ? p.includes(L) : !1); + if (O.length && O) { + const L = P.getAttribute("content"); if (L) return L; } @@ -8065,9 +8577,9 @@ function mF() { name: o }; } -z4 = Uv.getWindowMetadata = mF; -var xl = {}, vF = (t) => encodeURIComponent(t).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), W4 = "%[a-f0-9]{2}", fx = new RegExp("(" + W4 + ")|([^%]+?)", "gi"), lx = new RegExp("(" + W4 + ")+", "gi"); -function b1(t, e) { +v8 = tb.getWindowMetadata = YF; +var Dl = {}, JF = (t) => encodeURIComponent(t).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), b8 = "%[a-f0-9]{2}", Px = new RegExp("(" + b8 + ")|([^%]+?)", "gi"), Mx = new RegExp("(" + b8 + ")+", "gi"); +function N1(t, e) { try { return [decodeURIComponent(t.join(""))]; } catch { @@ -8076,29 +8588,29 @@ function b1(t, e) { return t; e = e || 1; var r = t.slice(0, e), n = t.slice(e); - return Array.prototype.concat.call([], b1(r), b1(n)); + return Array.prototype.concat.call([], N1(r), N1(n)); } -function bF(t) { +function XF(t) { try { return decodeURIComponent(t); } catch { - for (var e = t.match(fx) || [], r = 1; r < e.length; r++) - t = b1(e, r).join(""), e = t.match(fx) || []; + for (var e = t.match(Px) || [], r = 1; r < e.length; r++) + t = N1(e, r).join(""), e = t.match(Px) || []; return t; } } -function yF(t) { +function ZF(t) { for (var e = { "%FE%FF": "��", "%FF%FE": "��" - }, r = lx.exec(t); r; ) { + }, r = Mx.exec(t); r; ) { try { e[r[0]] = decodeURIComponent(r[0]); } catch { - var n = bF(r[0]); + var n = XF(r[0]); n !== r[0] && (e[r[0]] = n); } - r = lx.exec(t); + r = Mx.exec(t); } e["%C2"] = "�"; for (var i = Object.keys(e), s = 0; s < i.length; s++) { @@ -8107,15 +8619,15 @@ function yF(t) { } return t; } -var wF = function(t) { +var QF = function(t) { if (typeof t != "string") throw new TypeError("Expected `encodedURI` to be of type `string`, got `" + typeof t + "`"); try { return t = t.replace(/\+/g, " "), decodeURIComponent(t); } catch { - return yF(t); + return ZF(t); } -}, xF = (t, e) => { +}, ej = (t, e) => { if (!(typeof t == "string" && typeof e == "string")) throw new TypeError("Expected the arguments to be of type `string`"); if (e === "") @@ -8125,7 +8637,7 @@ var wF = function(t) { t.slice(0, r), t.slice(r + e.length) ]; -}, _F = function(t, e) { +}, tj = function(t, e) { for (var r = {}, n = Object.keys(t), i = Array.isArray(e), s = 0; s < n.length; s++) { var o = n[s], a = t[o]; (i ? e.indexOf(o) !== -1 : e(o, a, t)) && (r[o] = a); @@ -8133,216 +8645,216 @@ var wF = function(t) { return r; }; (function(t) { - const e = vF, r = wF, n = xF, i = _F, s = ($) => $ == null, o = Symbol("encodeFragmentIdentifier"); - function a($) { - switch ($.arrayFormat) { + const e = JF, r = QF, n = ej, i = tj, s = (k) => k == null, o = Symbol("encodeFragmentIdentifier"); + function a(k) { + switch (k.arrayFormat) { case "index": - return (H) => (U, V) => { - const te = U.length; - return V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? U : V === null ? [...U, [d(H, $), "[", te, "]"].join("")] : [ + return (q) => (U, V) => { + const Q = U.length; + return V === void 0 || k.skipNull && V === null || k.skipEmptyString && V === "" ? U : V === null ? [...U, [d(q, k), "[", Q, "]"].join("")] : [ ...U, - [d(H, $), "[", d(te, $), "]=", d(V, $)].join("") + [d(q, k), "[", d(Q, k), "]=", d(V, k)].join("") ]; }; case "bracket": - return (H) => (U, V) => V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? U : V === null ? [...U, [d(H, $), "[]"].join("")] : [...U, [d(H, $), "[]=", d(V, $)].join("")]; + return (q) => (U, V) => V === void 0 || k.skipNull && V === null || k.skipEmptyString && V === "" ? U : V === null ? [...U, [d(q, k), "[]"].join("")] : [...U, [d(q, k), "[]=", d(V, k)].join("")]; case "colon-list-separator": - return (H) => (U, V) => V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? U : V === null ? [...U, [d(H, $), ":list="].join("")] : [...U, [d(H, $), ":list=", d(V, $)].join("")]; + return (q) => (U, V) => V === void 0 || k.skipNull && V === null || k.skipEmptyString && V === "" ? U : V === null ? [...U, [d(q, k), ":list="].join("")] : [...U, [d(q, k), ":list=", d(V, k)].join("")]; case "comma": case "separator": case "bracket-separator": { - const H = $.arrayFormat === "bracket-separator" ? "[]=" : "="; - return (U) => (V, te) => te === void 0 || $.skipNull && te === null || $.skipEmptyString && te === "" ? V : (te = te === null ? "" : te, V.length === 0 ? [[d(U, $), H, d(te, $)].join("")] : [[V, d(te, $)].join($.arrayFormatSeparator)]); + const q = k.arrayFormat === "bracket-separator" ? "[]=" : "="; + return (U) => (V, Q) => Q === void 0 || k.skipNull && Q === null || k.skipEmptyString && Q === "" ? V : (Q = Q === null ? "" : Q, V.length === 0 ? [[d(U, k), q, d(Q, k)].join("")] : [[V, d(Q, k)].join(k.arrayFormatSeparator)]); } default: - return (H) => (U, V) => V === void 0 || $.skipNull && V === null || $.skipEmptyString && V === "" ? U : V === null ? [...U, d(H, $)] : [...U, [d(H, $), "=", d(V, $)].join("")]; + return (q) => (U, V) => V === void 0 || k.skipNull && V === null || k.skipEmptyString && V === "" ? U : V === null ? [...U, d(q, k)] : [...U, [d(q, k), "=", d(V, k)].join("")]; } } - function u($) { - let H; - switch ($.arrayFormat) { + function u(k) { + let q; + switch (k.arrayFormat) { case "index": - return (U, V, te) => { - if (H = /\[(\d*)\]$/.exec(U), U = U.replace(/\[\d*\]$/, ""), !H) { - te[U] = V; + return (U, V, Q) => { + if (q = /\[(\d*)\]$/.exec(U), U = U.replace(/\[\d*\]$/, ""), !q) { + Q[U] = V; return; } - te[U] === void 0 && (te[U] = {}), te[U][H[1]] = V; + Q[U] === void 0 && (Q[U] = {}), Q[U][q[1]] = V; }; case "bracket": - return (U, V, te) => { - if (H = /(\[\])$/.exec(U), U = U.replace(/\[\]$/, ""), !H) { - te[U] = V; + return (U, V, Q) => { + if (q = /(\[\])$/.exec(U), U = U.replace(/\[\]$/, ""), !q) { + Q[U] = V; return; } - if (te[U] === void 0) { - te[U] = [V]; + if (Q[U] === void 0) { + Q[U] = [V]; return; } - te[U] = [].concat(te[U], V); + Q[U] = [].concat(Q[U], V); }; case "colon-list-separator": - return (U, V, te) => { - if (H = /(:list)$/.exec(U), U = U.replace(/:list$/, ""), !H) { - te[U] = V; + return (U, V, Q) => { + if (q = /(:list)$/.exec(U), U = U.replace(/:list$/, ""), !q) { + Q[U] = V; return; } - if (te[U] === void 0) { - te[U] = [V]; + if (Q[U] === void 0) { + Q[U] = [V]; return; } - te[U] = [].concat(te[U], V); + Q[U] = [].concat(Q[U], V); }; case "comma": case "separator": - return (U, V, te) => { - const R = typeof V == "string" && V.includes($.arrayFormatSeparator), K = typeof V == "string" && !R && p(V, $).includes($.arrayFormatSeparator); - V = K ? p(V, $) : V; - const ge = R || K ? V.split($.arrayFormatSeparator).map((Ee) => p(Ee, $)) : V === null ? V : p(V, $); - te[U] = ge; + return (U, V, Q) => { + const R = typeof V == "string" && V.includes(k.arrayFormatSeparator), K = typeof V == "string" && !R && p(V, k).includes(k.arrayFormatSeparator); + V = K ? p(V, k) : V; + const ge = R || K ? V.split(k.arrayFormatSeparator).map((Ee) => p(Ee, k)) : V === null ? V : p(V, k); + Q[U] = ge; }; case "bracket-separator": - return (U, V, te) => { + return (U, V, Q) => { const R = /(\[\])$/.test(U); if (U = U.replace(/\[\]$/, ""), !R) { - te[U] = V && p(V, $); + Q[U] = V && p(V, k); return; } - const K = V === null ? [] : V.split($.arrayFormatSeparator).map((ge) => p(ge, $)); - if (te[U] === void 0) { - te[U] = K; + const K = V === null ? [] : V.split(k.arrayFormatSeparator).map((ge) => p(ge, k)); + if (Q[U] === void 0) { + Q[U] = K; return; } - te[U] = [].concat(te[U], K); + Q[U] = [].concat(Q[U], K); }; default: - return (U, V, te) => { - if (te[U] === void 0) { - te[U] = V; + return (U, V, Q) => { + if (Q[U] === void 0) { + Q[U] = V; return; } - te[U] = [].concat(te[U], V); + Q[U] = [].concat(Q[U], V); }; } } - function l($) { - if (typeof $ != "string" || $.length !== 1) + function l(k) { + if (typeof k != "string" || k.length !== 1) throw new TypeError("arrayFormatSeparator must be single character string"); } - function d($, H) { - return H.encode ? H.strict ? e($) : encodeURIComponent($) : $; + function d(k, q) { + return q.encode ? q.strict ? e(k) : encodeURIComponent(k) : k; } - function p($, H) { - return H.decode ? r($) : $; + function p(k, q) { + return q.decode ? r(k) : k; } - function w($) { - return Array.isArray($) ? $.sort() : typeof $ == "object" ? w(Object.keys($)).sort((H, U) => Number(H) - Number(U)).map((H) => $[H]) : $; + function w(k) { + return Array.isArray(k) ? k.sort() : typeof k == "object" ? w(Object.keys(k)).sort((q, U) => Number(q) - Number(U)).map((q) => k[q]) : k; } - function A($) { - const H = $.indexOf("#"); - return H !== -1 && ($ = $.slice(0, H)), $; + function _(k) { + const q = k.indexOf("#"); + return q !== -1 && (k = k.slice(0, q)), k; } - function M($) { - let H = ""; - const U = $.indexOf("#"); - return U !== -1 && (H = $.slice(U)), H; + function P(k) { + let q = ""; + const U = k.indexOf("#"); + return U !== -1 && (q = k.slice(U)), q; } - function N($) { - $ = A($); - const H = $.indexOf("?"); - return H === -1 ? "" : $.slice(H + 1); + function O(k) { + k = _(k); + const q = k.indexOf("?"); + return q === -1 ? "" : k.slice(q + 1); } - function L($, H) { - return H.parseNumbers && !Number.isNaN(Number($)) && typeof $ == "string" && $.trim() !== "" ? $ = Number($) : H.parseBooleans && $ !== null && ($.toLowerCase() === "true" || $.toLowerCase() === "false") && ($ = $.toLowerCase() === "true"), $; + function L(k, q) { + return q.parseNumbers && !Number.isNaN(Number(k)) && typeof k == "string" && k.trim() !== "" ? k = Number(k) : q.parseBooleans && k !== null && (k.toLowerCase() === "true" || k.toLowerCase() === "false") && (k = k.toLowerCase() === "true"), k; } - function B($, H) { - H = Object.assign({ + function B(k, q) { + q = Object.assign({ decode: !0, sort: !0, arrayFormat: "none", arrayFormatSeparator: ",", parseNumbers: !1, parseBooleans: !1 - }, H), l(H.arrayFormatSeparator); - const U = u(H), V = /* @__PURE__ */ Object.create(null); - if (typeof $ != "string" || ($ = $.trim().replace(/^[?#&]/, ""), !$)) + }, q), l(q.arrayFormatSeparator); + const U = u(q), V = /* @__PURE__ */ Object.create(null); + if (typeof k != "string" || (k = k.trim().replace(/^[?#&]/, ""), !k)) return V; - for (const te of $.split("&")) { - if (te === "") + for (const Q of k.split("&")) { + if (Q === "") continue; - let [R, K] = n(H.decode ? te.replace(/\+/g, " ") : te, "="); - K = K === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(H.arrayFormat) ? K : p(K, H), U(p(R, H), K, V); + let [R, K] = n(q.decode ? Q.replace(/\+/g, " ") : Q, "="); + K = K === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(q.arrayFormat) ? K : p(K, q), U(p(R, q), K, V); } - for (const te of Object.keys(V)) { - const R = V[te]; + for (const Q of Object.keys(V)) { + const R = V[Q]; if (typeof R == "object" && R !== null) for (const K of Object.keys(R)) - R[K] = L(R[K], H); + R[K] = L(R[K], q); else - V[te] = L(R, H); + V[Q] = L(R, q); } - return H.sort === !1 ? V : (H.sort === !0 ? Object.keys(V).sort() : Object.keys(V).sort(H.sort)).reduce((te, R) => { + return q.sort === !1 ? V : (q.sort === !0 ? Object.keys(V).sort() : Object.keys(V).sort(q.sort)).reduce((Q, R) => { const K = V[R]; - return K && typeof K == "object" && !Array.isArray(K) ? te[R] = w(K) : te[R] = K, te; + return K && typeof K == "object" && !Array.isArray(K) ? Q[R] = w(K) : Q[R] = K, Q; }, /* @__PURE__ */ Object.create(null)); } - t.extract = N, t.parse = B, t.stringify = ($, H) => { - if (!$) + t.extract = O, t.parse = B, t.stringify = (k, q) => { + if (!k) return ""; - H = Object.assign({ + q = Object.assign({ encode: !0, strict: !0, arrayFormat: "none", arrayFormatSeparator: "," - }, H), l(H.arrayFormatSeparator); - const U = (K) => H.skipNull && s($[K]) || H.skipEmptyString && $[K] === "", V = a(H), te = {}; - for (const K of Object.keys($)) - U(K) || (te[K] = $[K]); - const R = Object.keys(te); - return H.sort !== !1 && R.sort(H.sort), R.map((K) => { - const ge = $[K]; - return ge === void 0 ? "" : ge === null ? d(K, H) : Array.isArray(ge) ? ge.length === 0 && H.arrayFormat === "bracket-separator" ? d(K, H) + "[]" : ge.reduce(V(K), []).join("&") : d(K, H) + "=" + d(ge, H); + }, q), l(q.arrayFormatSeparator); + const U = (K) => q.skipNull && s(k[K]) || q.skipEmptyString && k[K] === "", V = a(q), Q = {}; + for (const K of Object.keys(k)) + U(K) || (Q[K] = k[K]); + const R = Object.keys(Q); + return q.sort !== !1 && R.sort(q.sort), R.map((K) => { + const ge = k[K]; + return ge === void 0 ? "" : ge === null ? d(K, q) : Array.isArray(ge) ? ge.length === 0 && q.arrayFormat === "bracket-separator" ? d(K, q) + "[]" : ge.reduce(V(K), []).join("&") : d(K, q) + "=" + d(ge, q); }).filter((K) => K.length > 0).join("&"); - }, t.parseUrl = ($, H) => { - H = Object.assign({ + }, t.parseUrl = (k, q) => { + q = Object.assign({ decode: !0 - }, H); - const [U, V] = n($, "#"); + }, q); + const [U, V] = n(k, "#"); return Object.assign( { url: U.split("?")[0] || "", - query: B(N($), H) + query: B(O(k), q) }, - H && H.parseFragmentIdentifier && V ? { fragmentIdentifier: p(V, H) } : {} + q && q.parseFragmentIdentifier && V ? { fragmentIdentifier: p(V, q) } : {} ); - }, t.stringifyUrl = ($, H) => { - H = Object.assign({ + }, t.stringifyUrl = (k, q) => { + q = Object.assign({ encode: !0, strict: !0, [o]: !0 - }, H); - const U = A($.url).split("?")[0] || "", V = t.extract($.url), te = t.parse(V, { sort: !1 }), R = Object.assign(te, $.query); - let K = t.stringify(R, H); + }, q); + const U = _(k.url).split("?")[0] || "", V = t.extract(k.url), Q = t.parse(V, { sort: !1 }), R = Object.assign(Q, k.query); + let K = t.stringify(R, q); K && (K = `?${K}`); - let ge = M($.url); - return $.fragmentIdentifier && (ge = `#${H[o] ? d($.fragmentIdentifier, H) : $.fragmentIdentifier}`), `${U}${K}${ge}`; - }, t.pick = ($, H, U) => { + let ge = P(k.url); + return k.fragmentIdentifier && (ge = `#${q[o] ? d(k.fragmentIdentifier, q) : k.fragmentIdentifier}`), `${U}${K}${ge}`; + }, t.pick = (k, q, U) => { U = Object.assign({ parseFragmentIdentifier: !0, [o]: !1 }, U); - const { url: V, query: te, fragmentIdentifier: R } = t.parseUrl($, U); + const { url: V, query: Q, fragmentIdentifier: R } = t.parseUrl(k, U); return t.stringifyUrl({ url: V, - query: i(te, H), + query: i(Q, q), fragmentIdentifier: R }, U); - }, t.exclude = ($, H, U) => { - const V = Array.isArray(H) ? (te) => !H.includes(te) : (te, R) => !H(te, R); - return t.pick($, V, U); + }, t.exclude = (k, q, U) => { + const V = Array.isArray(q) ? (Q) => !q.includes(Q) : (Q, R) => !q(Q, R); + return t.pick(k, V, U); }; -})(xl); -var H4 = { exports: {} }; +})(Dl); +var y8 = { exports: {} }; /** * [js-sha3]{@link https://github.com/emn178/js-sha3} * @@ -8357,7 +8869,7 @@ var H4 = { exports: {} }; i.JS_SHA3_NO_WINDOW && (n = !1); var s = !n && typeof self == "object", o = !i.JS_SHA3_NO_NODE_JS && typeof process == "object" && process.versions && process.versions.node; o ? i = gn : s && (i = self); - var a = !i.JS_SHA3_NO_COMMON_JS && !0 && t.exports, u = !i.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", l = "0123456789abcdef".split(""), d = [31, 7936, 2031616, 520093696], p = [4, 1024, 262144, 67108864], w = [1, 256, 65536, 16777216], A = [6, 1536, 393216, 100663296], M = [0, 8, 16, 24], N = [ + var a = !i.JS_SHA3_NO_COMMON_JS && !0 && t.exports, u = !i.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", l = "0123456789abcdef".split(""), d = [31, 7936, 2031616, 520093696], p = [4, 1024, 262144, 67108864], w = [1, 256, 65536, 16777216], _ = [6, 1536, 393216, 100663296], P = [0, 8, 16, 24], O = [ 1, 0, 32898, @@ -8406,7 +8918,7 @@ var H4 = { exports: {} }; 0, 2147516424, 2147483648 - ], L = [224, 256, 384, 512], B = [128, 256], $ = ["hex", "buffer", "arrayBuffer", "array", "digest"], H = { + ], L = [224, 256, 384, 512], B = [128, 256], k = ["hex", "buffer", "arrayBuffer", "array", "digest"], q = { 128: 168, 256: 136 }; @@ -8420,20 +8932,20 @@ var H4 = { exports: {} }; return new I(D, oe, D).update(J)[Z](); }; }, V = function(D, oe, Z) { - return function(J, Q) { - return new I(D, oe, Q).update(J)[Z](); + return function(J, ee) { + return new I(D, oe, ee).update(J)[Z](); }; - }, te = function(D, oe, Z) { - return function(J, Q, T, X) { - return f["cshake" + D].update(J, Q, T, X)[Z](); + }, Q = function(D, oe, Z) { + return function(J, ee, T, X) { + return f["cshake" + D].update(J, ee, T, X)[Z](); }; }, R = function(D, oe, Z) { - return function(J, Q, T, X) { - return f["kmac" + D].update(J, Q, T, X)[Z](); + return function(J, ee, T, X) { + return f["kmac" + D].update(J, ee, T, X)[Z](); }; }, K = function(D, oe, Z, J) { - for (var Q = 0; Q < $.length; ++Q) { - var T = $[Q]; + for (var ee = 0; ee < k.length; ++ee) { + var T = k[ee]; D[T] = oe(Z, J, T); } return D; @@ -8448,35 +8960,35 @@ var H4 = { exports: {} }; var Z = V(D, oe, "hex"); return Z.create = function(J) { return new I(D, oe, J); - }, Z.update = function(J, Q) { - return Z.create(Q).update(J); + }, Z.update = function(J, ee) { + return Z.create(ee).update(J); }, K(Z, V, D, oe); }, Y = function(D, oe) { - var Z = H[D], J = te(D, oe, "hex"); - return J.create = function(Q, T, X) { - return !T && !X ? f["shake" + D].create(Q) : new I(D, oe, Q).bytepad([T, X], Z); - }, J.update = function(Q, T, X, re) { - return J.create(T, X, re).update(Q); - }, K(J, te, D, oe); - }, S = function(D, oe) { - var Z = H[D], J = R(D, oe, "hex"); - return J.create = function(Q, T, X) { - return new F(D, oe, T).bytepad(["KMAC", X], Z).bytepad([Q], Z); - }, J.update = function(Q, T, X, re) { - return J.create(Q, X, re).update(T); + var Z = q[D], J = Q(D, oe, "hex"); + return J.create = function(ee, T, X) { + return !T && !X ? f["shake" + D].create(ee) : new I(D, oe, ee).bytepad([T, X], Z); + }, J.update = function(ee, T, X, re) { + return J.create(T, X, re).update(ee); + }, K(J, Q, D, oe); + }, A = function(D, oe) { + var Z = q[D], J = R(D, oe, "hex"); + return J.create = function(ee, T, X) { + return new F(D, oe, T).bytepad(["KMAC", X], Z).bytepad([ee], Z); + }, J.update = function(ee, T, X, re) { + return J.create(ee, X, re).update(T); }, K(J, R, D, oe); }, m = [ { name: "keccak", padding: w, bits: L, createMethod: ge }, - { name: "sha3", padding: A, bits: L, createMethod: ge }, + { name: "sha3", padding: _, bits: L, createMethod: ge }, { name: "shake", padding: d, bits: B, createMethod: Ee }, { name: "cshake", padding: p, bits: B, createMethod: Y }, - { name: "kmac", padding: p, bits: B, createMethod: S } + { name: "kmac", padding: p, bits: B, createMethod: A } ], f = {}, g = [], b = 0; b < m.length; ++b) - for (var x = m[b], _ = x.bits, E = 0; E < _.length; ++E) { - var v = x.name + "_" + _[E]; - if (g.push(v), f[v] = x.createMethod(_[E], x.padding), x.name !== "sha3") { - var P = x.name + _[E]; - g.push(P), f[P] = f[v]; + for (var x = m[b], E = x.bits, S = 0; S < E.length; ++S) { + var v = x.name + "_" + E[S]; + if (g.push(v), f[v] = x.createMethod(E[S], x.padding), x.name !== "sha3") { + var M = x.name + E[S]; + g.push(M), f[M] = f[v]; } } function I(D, oe, Z) { @@ -8500,18 +9012,18 @@ var H4 = { exports: {} }; throw new Error(e); oe = !0; } - for (var J = this.blocks, Q = this.byteCount, T = D.length, X = this.blockCount, re = 0, pe = this.s, ie, ue; re < T; ) { + for (var J = this.blocks, ee = this.byteCount, T = D.length, X = this.blockCount, re = 0, pe = this.s, ie, ue; re < T; ) { if (this.reset) for (this.reset = !1, J[0] = this.block, ie = 1; ie < X + 1; ++ie) J[ie] = 0; if (oe) - for (ie = this.start; re < T && ie < Q; ++re) - J[ie >> 2] |= D[re] << M[ie++ & 3]; + for (ie = this.start; re < T && ie < ee; ++re) + J[ie >> 2] |= D[re] << P[ie++ & 3]; else - for (ie = this.start; re < T && ie < Q; ++re) - ue = D.charCodeAt(re), ue < 128 ? J[ie >> 2] |= ue << M[ie++ & 3] : ue < 2048 ? (J[ie >> 2] |= (192 | ue >> 6) << M[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << M[ie++ & 3]) : ue < 55296 || ue >= 57344 ? (J[ie >> 2] |= (224 | ue >> 12) << M[ie++ & 3], J[ie >> 2] |= (128 | ue >> 6 & 63) << M[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << M[ie++ & 3]) : (ue = 65536 + ((ue & 1023) << 10 | D.charCodeAt(++re) & 1023), J[ie >> 2] |= (240 | ue >> 18) << M[ie++ & 3], J[ie >> 2] |= (128 | ue >> 12 & 63) << M[ie++ & 3], J[ie >> 2] |= (128 | ue >> 6 & 63) << M[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << M[ie++ & 3]); - if (this.lastByteIndex = ie, ie >= Q) { - for (this.start = ie - Q, this.block = J[X], ie = 0; ie < X; ++ie) + for (ie = this.start; re < T && ie < ee; ++re) + ue = D.charCodeAt(re), ue < 128 ? J[ie >> 2] |= ue << P[ie++ & 3] : ue < 2048 ? (J[ie >> 2] |= (192 | ue >> 6) << P[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << P[ie++ & 3]) : ue < 55296 || ue >= 57344 ? (J[ie >> 2] |= (224 | ue >> 12) << P[ie++ & 3], J[ie >> 2] |= (128 | ue >> 6 & 63) << P[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << P[ie++ & 3]) : (ue = 65536 + ((ue & 1023) << 10 | D.charCodeAt(++re) & 1023), J[ie >> 2] |= (240 | ue >> 18) << P[ie++ & 3], J[ie >> 2] |= (128 | ue >> 12 & 63) << P[ie++ & 3], J[ie >> 2] |= (128 | ue >> 6 & 63) << P[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << P[ie++ & 3]); + if (this.lastByteIndex = ie, ie >= ee) { + for (this.start = ie - ee, this.block = J[X], ie = 0; ie < X; ++ie) pe[ie] ^= J[ie]; ce(pe), this.reset = !0; } else @@ -8519,10 +9031,10 @@ var H4 = { exports: {} }; } return this; }, I.prototype.encode = function(D, oe) { - var Z = D & 255, J = 1, Q = [Z]; + var Z = D & 255, J = 1, ee = [Z]; for (D = D >> 8, Z = D & 255; Z > 0; ) - Q.unshift(Z), D = D >> 8, Z = D & 255, ++J; - return oe ? Q.push(J) : Q.unshift(J), this.update(Q), Q.length; + ee.unshift(Z), D = D >> 8, Z = D & 255, ++J; + return oe ? ee.push(J) : ee.unshift(J), this.update(ee), ee.length; }, I.prototype.encodeString = function(D) { var oe, Z = typeof D; if (Z !== "string") { @@ -8537,9 +9049,9 @@ var H4 = { exports: {} }; throw new Error(e); oe = !0; } - var J = 0, Q = D.length; + var J = 0, ee = D.length; if (oe) - J = Q; + J = ee; else for (var T = 0; T < D.length; ++T) { var X = D.charCodeAt(T); @@ -8549,8 +9061,8 @@ var H4 = { exports: {} }; }, I.prototype.bytepad = function(D, oe) { for (var Z = this.encode(oe), J = 0; J < D.length; ++J) Z += this.encodeString(D[J]); - var Q = oe - Z % oe, T = []; - return T.length = Q, this.update(T), this; + var ee = oe - Z % oe, T = []; + return T.length = ee, this.update(T), this; }, I.prototype.finalize = function() { if (!this.finalized) { this.finalized = !0; @@ -8564,30 +9076,30 @@ var H4 = { exports: {} }; } }, I.prototype.toString = I.prototype.hex = function() { this.finalize(); - for (var D = this.blockCount, oe = this.s, Z = this.outputBlocks, J = this.extraBytes, Q = 0, T = 0, X = "", re; T < Z; ) { - for (Q = 0; Q < D && T < Z; ++Q, ++T) - re = oe[Q], X += l[re >> 4 & 15] + l[re & 15] + l[re >> 12 & 15] + l[re >> 8 & 15] + l[re >> 20 & 15] + l[re >> 16 & 15] + l[re >> 28 & 15] + l[re >> 24 & 15]; - T % D === 0 && (ce(oe), Q = 0); + for (var D = this.blockCount, oe = this.s, Z = this.outputBlocks, J = this.extraBytes, ee = 0, T = 0, X = "", re; T < Z; ) { + for (ee = 0; ee < D && T < Z; ++ee, ++T) + re = oe[ee], X += l[re >> 4 & 15] + l[re & 15] + l[re >> 12 & 15] + l[re >> 8 & 15] + l[re >> 20 & 15] + l[re >> 16 & 15] + l[re >> 28 & 15] + l[re >> 24 & 15]; + T % D === 0 && (ce(oe), ee = 0); } - return J && (re = oe[Q], X += l[re >> 4 & 15] + l[re & 15], J > 1 && (X += l[re >> 12 & 15] + l[re >> 8 & 15]), J > 2 && (X += l[re >> 20 & 15] + l[re >> 16 & 15])), X; + return J && (re = oe[ee], X += l[re >> 4 & 15] + l[re & 15], J > 1 && (X += l[re >> 12 & 15] + l[re >> 8 & 15]), J > 2 && (X += l[re >> 20 & 15] + l[re >> 16 & 15])), X; }, I.prototype.arrayBuffer = function() { this.finalize(); - var D = this.blockCount, oe = this.s, Z = this.outputBlocks, J = this.extraBytes, Q = 0, T = 0, X = this.outputBits >> 3, re; + var D = this.blockCount, oe = this.s, Z = this.outputBlocks, J = this.extraBytes, ee = 0, T = 0, X = this.outputBits >> 3, re; J ? re = new ArrayBuffer(Z + 1 << 2) : re = new ArrayBuffer(X); for (var pe = new Uint32Array(re); T < Z; ) { - for (Q = 0; Q < D && T < Z; ++Q, ++T) - pe[T] = oe[Q]; + for (ee = 0; ee < D && T < Z; ++ee, ++T) + pe[T] = oe[ee]; T % D === 0 && ce(oe); } - return J && (pe[Q] = oe[Q], re = re.slice(0, X)), re; + return J && (pe[ee] = oe[ee], re = re.slice(0, X)), re; }, I.prototype.buffer = I.prototype.arrayBuffer, I.prototype.digest = I.prototype.array = function() { this.finalize(); - for (var D = this.blockCount, oe = this.s, Z = this.outputBlocks, J = this.extraBytes, Q = 0, T = 0, X = [], re, pe; T < Z; ) { - for (Q = 0; Q < D && T < Z; ++Q, ++T) - re = T << 2, pe = oe[Q], X[re] = pe & 255, X[re + 1] = pe >> 8 & 255, X[re + 2] = pe >> 16 & 255, X[re + 3] = pe >> 24 & 255; + for (var D = this.blockCount, oe = this.s, Z = this.outputBlocks, J = this.extraBytes, ee = 0, T = 0, X = [], re, pe; T < Z; ) { + for (ee = 0; ee < D && T < Z; ++ee, ++T) + re = T << 2, pe = oe[ee], X[re] = pe & 255, X[re + 1] = pe >> 8 & 255, X[re + 2] = pe >> 16 & 255, X[re + 3] = pe >> 24 & 255; T % D === 0 && ce(oe); } - return J && (re = T << 2, pe = oe[Q], X[re] = pe & 255, J > 1 && (X[re + 1] = pe >> 8 & 255), J > 2 && (X[re + 2] = pe >> 16 & 255)), X; + return J && (re = T << 2, pe = oe[ee], X[re] = pe & 255, J > 1 && (X[re + 1] = pe >> 8 & 255), J > 2 && (X[re + 2] = pe >> 16 & 255)), X; }; function F(D, oe, Z) { I.call(this, D, oe, Z); @@ -8596,9 +9108,9 @@ var H4 = { exports: {} }; return this.encode(this.outputBits, !0), I.prototype.finalize.call(this); }; var ce = function(D) { - var oe, Z, J, Q, T, X, re, pe, ie, ue, ve, Pe, De, Ce, $e, Me, Ne, Ke, Le, qe, ze, _e, Ze, at, ke, Qe, tt, Ye, dt, lt, ct, qt, Jt, Et, er, Xt, Dt, kt, Ct, gt, Rt, Nt, vt, $t, Ft, rt, Bt, k, q, W, C, G, j, se, de, xe, Te, Re, nt, je, pt, it, et; + var oe, Z, J, ee, T, X, re, pe, ie, ue, ve, Pe, De, Ce, $e, Me, Ne, Ke, Le, qe, ze, _e, Ze, at, ke, Qe, tt, Ye, dt, lt, ct, qt, Jt, Et, er, Xt, Dt, kt, Ct, mt, Rt, Nt, bt, $t, Ft, rt, Bt, $, z, H, C, G, j, se, de, xe, Te, Re, nt, je, pt, it, et; for (J = 0; J < 48; J += 2) - Q = D[0] ^ D[10] ^ D[20] ^ D[30] ^ D[40], T = D[1] ^ D[11] ^ D[21] ^ D[31] ^ D[41], X = D[2] ^ D[12] ^ D[22] ^ D[32] ^ D[42], re = D[3] ^ D[13] ^ D[23] ^ D[33] ^ D[43], pe = D[4] ^ D[14] ^ D[24] ^ D[34] ^ D[44], ie = D[5] ^ D[15] ^ D[25] ^ D[35] ^ D[45], ue = D[6] ^ D[16] ^ D[26] ^ D[36] ^ D[46], ve = D[7] ^ D[17] ^ D[27] ^ D[37] ^ D[47], Pe = D[8] ^ D[18] ^ D[28] ^ D[38] ^ D[48], De = D[9] ^ D[19] ^ D[29] ^ D[39] ^ D[49], oe = Pe ^ (X << 1 | re >>> 31), Z = De ^ (re << 1 | X >>> 31), D[0] ^= oe, D[1] ^= Z, D[10] ^= oe, D[11] ^= Z, D[20] ^= oe, D[21] ^= Z, D[30] ^= oe, D[31] ^= Z, D[40] ^= oe, D[41] ^= Z, oe = Q ^ (pe << 1 | ie >>> 31), Z = T ^ (ie << 1 | pe >>> 31), D[2] ^= oe, D[3] ^= Z, D[12] ^= oe, D[13] ^= Z, D[22] ^= oe, D[23] ^= Z, D[32] ^= oe, D[33] ^= Z, D[42] ^= oe, D[43] ^= Z, oe = X ^ (ue << 1 | ve >>> 31), Z = re ^ (ve << 1 | ue >>> 31), D[4] ^= oe, D[5] ^= Z, D[14] ^= oe, D[15] ^= Z, D[24] ^= oe, D[25] ^= Z, D[34] ^= oe, D[35] ^= Z, D[44] ^= oe, D[45] ^= Z, oe = pe ^ (Pe << 1 | De >>> 31), Z = ie ^ (De << 1 | Pe >>> 31), D[6] ^= oe, D[7] ^= Z, D[16] ^= oe, D[17] ^= Z, D[26] ^= oe, D[27] ^= Z, D[36] ^= oe, D[37] ^= Z, D[46] ^= oe, D[47] ^= Z, oe = ue ^ (Q << 1 | T >>> 31), Z = ve ^ (T << 1 | Q >>> 31), D[8] ^= oe, D[9] ^= Z, D[18] ^= oe, D[19] ^= Z, D[28] ^= oe, D[29] ^= Z, D[38] ^= oe, D[39] ^= Z, D[48] ^= oe, D[49] ^= Z, Ce = D[0], $e = D[1], rt = D[11] << 4 | D[10] >>> 28, Bt = D[10] << 4 | D[11] >>> 28, Ye = D[20] << 3 | D[21] >>> 29, dt = D[21] << 3 | D[20] >>> 29, je = D[31] << 9 | D[30] >>> 23, pt = D[30] << 9 | D[31] >>> 23, Nt = D[40] << 18 | D[41] >>> 14, vt = D[41] << 18 | D[40] >>> 14, Et = D[2] << 1 | D[3] >>> 31, er = D[3] << 1 | D[2] >>> 31, Me = D[13] << 12 | D[12] >>> 20, Ne = D[12] << 12 | D[13] >>> 20, k = D[22] << 10 | D[23] >>> 22, q = D[23] << 10 | D[22] >>> 22, lt = D[33] << 13 | D[32] >>> 19, ct = D[32] << 13 | D[33] >>> 19, it = D[42] << 2 | D[43] >>> 30, et = D[43] << 2 | D[42] >>> 30, se = D[5] << 30 | D[4] >>> 2, de = D[4] << 30 | D[5] >>> 2, Xt = D[14] << 6 | D[15] >>> 26, Dt = D[15] << 6 | D[14] >>> 26, Ke = D[25] << 11 | D[24] >>> 21, Le = D[24] << 11 | D[25] >>> 21, W = D[34] << 15 | D[35] >>> 17, C = D[35] << 15 | D[34] >>> 17, qt = D[45] << 29 | D[44] >>> 3, Jt = D[44] << 29 | D[45] >>> 3, at = D[6] << 28 | D[7] >>> 4, ke = D[7] << 28 | D[6] >>> 4, xe = D[17] << 23 | D[16] >>> 9, Te = D[16] << 23 | D[17] >>> 9, kt = D[26] << 25 | D[27] >>> 7, Ct = D[27] << 25 | D[26] >>> 7, qe = D[36] << 21 | D[37] >>> 11, ze = D[37] << 21 | D[36] >>> 11, G = D[47] << 24 | D[46] >>> 8, j = D[46] << 24 | D[47] >>> 8, $t = D[8] << 27 | D[9] >>> 5, Ft = D[9] << 27 | D[8] >>> 5, Qe = D[18] << 20 | D[19] >>> 12, tt = D[19] << 20 | D[18] >>> 12, Re = D[29] << 7 | D[28] >>> 25, nt = D[28] << 7 | D[29] >>> 25, gt = D[38] << 8 | D[39] >>> 24, Rt = D[39] << 8 | D[38] >>> 24, _e = D[48] << 14 | D[49] >>> 18, Ze = D[49] << 14 | D[48] >>> 18, D[0] = Ce ^ ~Me & Ke, D[1] = $e ^ ~Ne & Le, D[10] = at ^ ~Qe & Ye, D[11] = ke ^ ~tt & dt, D[20] = Et ^ ~Xt & kt, D[21] = er ^ ~Dt & Ct, D[30] = $t ^ ~rt & k, D[31] = Ft ^ ~Bt & q, D[40] = se ^ ~xe & Re, D[41] = de ^ ~Te & nt, D[2] = Me ^ ~Ke & qe, D[3] = Ne ^ ~Le & ze, D[12] = Qe ^ ~Ye & lt, D[13] = tt ^ ~dt & ct, D[22] = Xt ^ ~kt & gt, D[23] = Dt ^ ~Ct & Rt, D[32] = rt ^ ~k & W, D[33] = Bt ^ ~q & C, D[42] = xe ^ ~Re & je, D[43] = Te ^ ~nt & pt, D[4] = Ke ^ ~qe & _e, D[5] = Le ^ ~ze & Ze, D[14] = Ye ^ ~lt & qt, D[15] = dt ^ ~ct & Jt, D[24] = kt ^ ~gt & Nt, D[25] = Ct ^ ~Rt & vt, D[34] = k ^ ~W & G, D[35] = q ^ ~C & j, D[44] = Re ^ ~je & it, D[45] = nt ^ ~pt & et, D[6] = qe ^ ~_e & Ce, D[7] = ze ^ ~Ze & $e, D[16] = lt ^ ~qt & at, D[17] = ct ^ ~Jt & ke, D[26] = gt ^ ~Nt & Et, D[27] = Rt ^ ~vt & er, D[36] = W ^ ~G & $t, D[37] = C ^ ~j & Ft, D[46] = je ^ ~it & se, D[47] = pt ^ ~et & de, D[8] = _e ^ ~Ce & Me, D[9] = Ze ^ ~$e & Ne, D[18] = qt ^ ~at & Qe, D[19] = Jt ^ ~ke & tt, D[28] = Nt ^ ~Et & Xt, D[29] = vt ^ ~er & Dt, D[38] = G ^ ~$t & rt, D[39] = j ^ ~Ft & Bt, D[48] = it ^ ~se & xe, D[49] = et ^ ~de & Te, D[0] ^= N[J], D[1] ^= N[J + 1]; + ee = D[0] ^ D[10] ^ D[20] ^ D[30] ^ D[40], T = D[1] ^ D[11] ^ D[21] ^ D[31] ^ D[41], X = D[2] ^ D[12] ^ D[22] ^ D[32] ^ D[42], re = D[3] ^ D[13] ^ D[23] ^ D[33] ^ D[43], pe = D[4] ^ D[14] ^ D[24] ^ D[34] ^ D[44], ie = D[5] ^ D[15] ^ D[25] ^ D[35] ^ D[45], ue = D[6] ^ D[16] ^ D[26] ^ D[36] ^ D[46], ve = D[7] ^ D[17] ^ D[27] ^ D[37] ^ D[47], Pe = D[8] ^ D[18] ^ D[28] ^ D[38] ^ D[48], De = D[9] ^ D[19] ^ D[29] ^ D[39] ^ D[49], oe = Pe ^ (X << 1 | re >>> 31), Z = De ^ (re << 1 | X >>> 31), D[0] ^= oe, D[1] ^= Z, D[10] ^= oe, D[11] ^= Z, D[20] ^= oe, D[21] ^= Z, D[30] ^= oe, D[31] ^= Z, D[40] ^= oe, D[41] ^= Z, oe = ee ^ (pe << 1 | ie >>> 31), Z = T ^ (ie << 1 | pe >>> 31), D[2] ^= oe, D[3] ^= Z, D[12] ^= oe, D[13] ^= Z, D[22] ^= oe, D[23] ^= Z, D[32] ^= oe, D[33] ^= Z, D[42] ^= oe, D[43] ^= Z, oe = X ^ (ue << 1 | ve >>> 31), Z = re ^ (ve << 1 | ue >>> 31), D[4] ^= oe, D[5] ^= Z, D[14] ^= oe, D[15] ^= Z, D[24] ^= oe, D[25] ^= Z, D[34] ^= oe, D[35] ^= Z, D[44] ^= oe, D[45] ^= Z, oe = pe ^ (Pe << 1 | De >>> 31), Z = ie ^ (De << 1 | Pe >>> 31), D[6] ^= oe, D[7] ^= Z, D[16] ^= oe, D[17] ^= Z, D[26] ^= oe, D[27] ^= Z, D[36] ^= oe, D[37] ^= Z, D[46] ^= oe, D[47] ^= Z, oe = ue ^ (ee << 1 | T >>> 31), Z = ve ^ (T << 1 | ee >>> 31), D[8] ^= oe, D[9] ^= Z, D[18] ^= oe, D[19] ^= Z, D[28] ^= oe, D[29] ^= Z, D[38] ^= oe, D[39] ^= Z, D[48] ^= oe, D[49] ^= Z, Ce = D[0], $e = D[1], rt = D[11] << 4 | D[10] >>> 28, Bt = D[10] << 4 | D[11] >>> 28, Ye = D[20] << 3 | D[21] >>> 29, dt = D[21] << 3 | D[20] >>> 29, je = D[31] << 9 | D[30] >>> 23, pt = D[30] << 9 | D[31] >>> 23, Nt = D[40] << 18 | D[41] >>> 14, bt = D[41] << 18 | D[40] >>> 14, Et = D[2] << 1 | D[3] >>> 31, er = D[3] << 1 | D[2] >>> 31, Me = D[13] << 12 | D[12] >>> 20, Ne = D[12] << 12 | D[13] >>> 20, $ = D[22] << 10 | D[23] >>> 22, z = D[23] << 10 | D[22] >>> 22, lt = D[33] << 13 | D[32] >>> 19, ct = D[32] << 13 | D[33] >>> 19, it = D[42] << 2 | D[43] >>> 30, et = D[43] << 2 | D[42] >>> 30, se = D[5] << 30 | D[4] >>> 2, de = D[4] << 30 | D[5] >>> 2, Xt = D[14] << 6 | D[15] >>> 26, Dt = D[15] << 6 | D[14] >>> 26, Ke = D[25] << 11 | D[24] >>> 21, Le = D[24] << 11 | D[25] >>> 21, H = D[34] << 15 | D[35] >>> 17, C = D[35] << 15 | D[34] >>> 17, qt = D[45] << 29 | D[44] >>> 3, Jt = D[44] << 29 | D[45] >>> 3, at = D[6] << 28 | D[7] >>> 4, ke = D[7] << 28 | D[6] >>> 4, xe = D[17] << 23 | D[16] >>> 9, Te = D[16] << 23 | D[17] >>> 9, kt = D[26] << 25 | D[27] >>> 7, Ct = D[27] << 25 | D[26] >>> 7, qe = D[36] << 21 | D[37] >>> 11, ze = D[37] << 21 | D[36] >>> 11, G = D[47] << 24 | D[46] >>> 8, j = D[46] << 24 | D[47] >>> 8, $t = D[8] << 27 | D[9] >>> 5, Ft = D[9] << 27 | D[8] >>> 5, Qe = D[18] << 20 | D[19] >>> 12, tt = D[19] << 20 | D[18] >>> 12, Re = D[29] << 7 | D[28] >>> 25, nt = D[28] << 7 | D[29] >>> 25, mt = D[38] << 8 | D[39] >>> 24, Rt = D[39] << 8 | D[38] >>> 24, _e = D[48] << 14 | D[49] >>> 18, Ze = D[49] << 14 | D[48] >>> 18, D[0] = Ce ^ ~Me & Ke, D[1] = $e ^ ~Ne & Le, D[10] = at ^ ~Qe & Ye, D[11] = ke ^ ~tt & dt, D[20] = Et ^ ~Xt & kt, D[21] = er ^ ~Dt & Ct, D[30] = $t ^ ~rt & $, D[31] = Ft ^ ~Bt & z, D[40] = se ^ ~xe & Re, D[41] = de ^ ~Te & nt, D[2] = Me ^ ~Ke & qe, D[3] = Ne ^ ~Le & ze, D[12] = Qe ^ ~Ye & lt, D[13] = tt ^ ~dt & ct, D[22] = Xt ^ ~kt & mt, D[23] = Dt ^ ~Ct & Rt, D[32] = rt ^ ~$ & H, D[33] = Bt ^ ~z & C, D[42] = xe ^ ~Re & je, D[43] = Te ^ ~nt & pt, D[4] = Ke ^ ~qe & _e, D[5] = Le ^ ~ze & Ze, D[14] = Ye ^ ~lt & qt, D[15] = dt ^ ~ct & Jt, D[24] = kt ^ ~mt & Nt, D[25] = Ct ^ ~Rt & bt, D[34] = $ ^ ~H & G, D[35] = z ^ ~C & j, D[44] = Re ^ ~je & it, D[45] = nt ^ ~pt & et, D[6] = qe ^ ~_e & Ce, D[7] = ze ^ ~Ze & $e, D[16] = lt ^ ~qt & at, D[17] = ct ^ ~Jt & ke, D[26] = mt ^ ~Nt & Et, D[27] = Rt ^ ~bt & er, D[36] = H ^ ~G & $t, D[37] = C ^ ~j & Ft, D[46] = je ^ ~it & se, D[47] = pt ^ ~et & de, D[8] = _e ^ ~Ce & Me, D[9] = Ze ^ ~$e & Ne, D[18] = qt ^ ~at & Qe, D[19] = Jt ^ ~ke & tt, D[28] = Nt ^ ~Et & Xt, D[29] = bt ^ ~er & Dt, D[38] = G ^ ~$t & rt, D[39] = j ^ ~Ft & Bt, D[48] = it ^ ~se & xe, D[49] = et ^ ~de & Te, D[0] ^= O[J], D[1] ^= O[J + 1]; }; if (a) t.exports = f; @@ -8606,13 +9118,13 @@ var H4 = { exports: {} }; for (b = 0; b < g.length; ++b) i[g[b]] = f[g[b]]; })(); -})(H4); -var EF = H4.exports; -const SF = /* @__PURE__ */ ts(EF), AF = "logger/5.7.0"; -let hx = !1, dx = !1; -const Ad = { debug: 1, default: 2, info: 2, warning: 3, error: 4, off: 5 }; -let px = Ad.default, Zg = null; -function PF() { +})(y8); +var rj = y8.exports; +const nj = /* @__PURE__ */ ns(rj), ij = "logger/5.7.0"; +let Ix = !1, Cx = !1; +const $d = { debug: 1, default: 2, info: 2, warning: 3, error: 4, off: 5 }; +let Tx = $d.default, hm = null; +function sj() { try { const t = []; if (["NFD", "NFC", "NFKD", "NFKC"].forEach((e) => { @@ -8631,16 +9143,16 @@ function PF() { } return null; } -const gx = PF(); -var y1; +const Rx = sj(); +var L1; (function(t) { t.DEBUG = "DEBUG", t.INFO = "INFO", t.WARNING = "WARNING", t.ERROR = "ERROR", t.OFF = "OFF"; -})(y1 || (y1 = {})); -var ws; +})(L1 || (L1 = {})); +var Es; (function(t) { t.UNKNOWN_ERROR = "UNKNOWN_ERROR", t.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", t.UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION", t.NETWORK_ERROR = "NETWORK_ERROR", t.SERVER_ERROR = "SERVER_ERROR", t.TIMEOUT = "TIMEOUT", t.BUFFER_OVERRUN = "BUFFER_OVERRUN", t.NUMERIC_FAULT = "NUMERIC_FAULT", t.MISSING_NEW = "MISSING_NEW", t.INVALID_ARGUMENT = "INVALID_ARGUMENT", t.MISSING_ARGUMENT = "MISSING_ARGUMENT", t.UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT", t.CALL_EXCEPTION = "CALL_EXCEPTION", t.INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS", t.NONCE_EXPIRED = "NONCE_EXPIRED", t.REPLACEMENT_UNDERPRICED = "REPLACEMENT_UNDERPRICED", t.UNPREDICTABLE_GAS_LIMIT = "UNPREDICTABLE_GAS_LIMIT", t.TRANSACTION_REPLACED = "TRANSACTION_REPLACED", t.ACTION_REJECTED = "ACTION_REJECTED"; -})(ws || (ws = {})); -const mx = "0123456789abcdef"; +})(Es || (Es = {})); +const Dx = "0123456789abcdef"; class Yr { constructor(e) { Object.defineProperty(this, "version", { @@ -8651,7 +9163,7 @@ class Yr { } _log(e, r) { const n = e.toLowerCase(); - Ad[n] == null && this.throwArgumentError("invalid log level name", "logLevel", e), !(px > Ad[n]) && console.log.apply(console, r); + $d[n] == null && this.throwArgumentError("invalid log level name", "logLevel", e), !(Tx > $d[n]) && console.log.apply(console, r); } debug(...e) { this._log(Yr.levels.DEBUG, e); @@ -8663,7 +9175,7 @@ class Yr { this._log(Yr.levels.WARNING, e); } makeError(e, r, n) { - if (dx) + if (Cx) return this.makeError("censored error", r, {}); r || (r = Yr.errors.UNKNOWN_ERROR), n || (n = {}); const i = []; @@ -8673,7 +9185,7 @@ class Yr { if (l instanceof Uint8Array) { let d = ""; for (let p = 0; p < l.length; p++) - d += mx[l[p] >> 4], d += mx[l[p] & 15]; + d += Dx[l[p] >> 4], d += Dx[l[p] & 15]; i.push(u + "=Uint8Array(0x" + d + ")"); } else i.push(u + "=" + JSON.stringify(l)); @@ -8684,7 +9196,7 @@ class Yr { const s = e; let o = ""; switch (r) { - case ws.NUMERIC_FAULT: { + case Es.NUMERIC_FAULT: { o = "NUMERIC_FAULT"; const u = e; switch (u) { @@ -8703,13 +9215,13 @@ class Yr { } break; } - case ws.CALL_EXCEPTION: - case ws.INSUFFICIENT_FUNDS: - case ws.MISSING_NEW: - case ws.NONCE_EXPIRED: - case ws.REPLACEMENT_UNDERPRICED: - case ws.TRANSACTION_REPLACED: - case ws.UNPREDICTABLE_GAS_LIMIT: + case Es.CALL_EXCEPTION: + case Es.INSUFFICIENT_FUNDS: + case Es.MISSING_NEW: + case Es.NONCE_EXPIRED: + case Es.REPLACEMENT_UNDERPRICED: + case Es.TRANSACTION_REPLACED: + case Es.UNPREDICTABLE_GAS_LIMIT: o = r; break; } @@ -8735,9 +9247,9 @@ class Yr { e || this.throwArgumentError(r, n, i); } checkNormalize(e) { - gx && this.throwError("platform missing String.prototype.normalize", Yr.errors.UNSUPPORTED_OPERATION, { + Rx && this.throwError("platform missing String.prototype.normalize", Yr.errors.UNSUPPORTED_OPERATION, { operation: "String.prototype.normalize", - form: gx + form: Rx }); } checkSafeUint53(e, r) { @@ -8767,60 +9279,60 @@ class Yr { e === r ? this.throwError("cannot instantiate abstract class " + JSON.stringify(r.name) + " directly; use a sub-class", Yr.errors.UNSUPPORTED_OPERATION, { name: e.name, operation: "new" }) : (e === Object || e == null) && this.throwError("missing new", Yr.errors.MISSING_NEW, { name: r.name }); } static globalLogger() { - return Zg || (Zg = new Yr(AF)), Zg; + return hm || (hm = new Yr(ij)), hm; } static setCensorship(e, r) { if (!e && r && this.globalLogger().throwError("cannot permanently disable censorship", Yr.errors.UNSUPPORTED_OPERATION, { operation: "setCensorship" - }), hx) { + }), Ix) { if (!e) return; this.globalLogger().throwError("error censorship permanent", Yr.errors.UNSUPPORTED_OPERATION, { operation: "setCensorship" }); } - dx = !!e, hx = !!r; + Cx = !!e, Ix = !!r; } static setLogLevel(e) { - const r = Ad[e.toLowerCase()]; + const r = $d[e.toLowerCase()]; if (r == null) { Yr.globalLogger().warn("invalid log level - " + e); return; } - px = r; + Tx = r; } static from(e) { return new Yr(e); } } -Yr.errors = ws; -Yr.levels = y1; -const MF = "bytes/5.7.0", hn = new Yr(MF); -function K4(t) { +Yr.errors = Es; +Yr.levels = L1; +const oj = "bytes/5.7.0", hn = new Yr(oj); +function w8(t) { return !!t.toHexString; } -function fu(t) { +function wu(t) { return t.slice || (t.slice = function() { const e = Array.prototype.slice.call(arguments); - return fu(new Uint8Array(Array.prototype.slice.apply(t, e))); + return wu(new Uint8Array(Array.prototype.slice.apply(t, e))); }), t; } -function IF(t) { - return zs(t) && !(t.length % 2) || qv(t); +function aj(t) { + return Ks(t) && !(t.length % 2) || rb(t); } -function vx(t) { +function Ox(t) { return typeof t == "number" && t == t && t % 1 === 0; } -function qv(t) { +function rb(t) { if (t == null) return !1; if (t.constructor === Uint8Array) return !0; - if (typeof t == "string" || !vx(t.length) || t.length < 0) + if (typeof t == "string" || !Ox(t.length) || t.length < 0) return !1; for (let e = 0; e < t.length; e++) { const r = t[e]; - if (!vx(r) || r < 0 || r >= 256) + if (!Ox(r) || r < 0 || r >= 256) return !1; } return !0; @@ -8831,71 +9343,71 @@ function wn(t, e) { const r = []; for (; t; ) r.unshift(t & 255), t = parseInt(String(t / 256)); - return r.length === 0 && r.push(0), fu(new Uint8Array(r)); + return r.length === 0 && r.push(0), wu(new Uint8Array(r)); } - if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), K4(t) && (t = t.toHexString()), zs(t)) { + if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), w8(t) && (t = t.toHexString()), Ks(t)) { let r = t.substring(2); r.length % 2 && (e.hexPad === "left" ? r = "0" + r : e.hexPad === "right" ? r += "0" : hn.throwArgumentError("hex data is odd-length", "value", t)); const n = []; for (let i = 0; i < r.length; i += 2) n.push(parseInt(r.substring(i, i + 2), 16)); - return fu(new Uint8Array(n)); + return wu(new Uint8Array(n)); } - return qv(t) ? fu(new Uint8Array(t)) : hn.throwArgumentError("invalid arrayify value", "value", t); + return rb(t) ? wu(new Uint8Array(t)) : hn.throwArgumentError("invalid arrayify value", "value", t); } -function CF(t) { +function cj(t) { const e = t.map((i) => wn(i)), r = e.reduce((i, s) => i + s.length, 0), n = new Uint8Array(r); - return e.reduce((i, s) => (n.set(s, i), i + s.length), 0), fu(n); + return e.reduce((i, s) => (n.set(s, i), i + s.length), 0), wu(n); } -function TF(t, e) { +function uj(t, e) { t = wn(t), t.length > e && hn.throwArgumentError("value out of range", "value", arguments[0]); const r = new Uint8Array(e); - return r.set(t, e - t.length), fu(r); + return r.set(t, e - t.length), wu(r); } -function zs(t, e) { +function Ks(t, e) { return !(typeof t != "string" || !t.match(/^0x[0-9A-Fa-f]*$/) || e && t.length !== 2 + 2 * e); } -const Qg = "0123456789abcdef"; -function Ri(t, e) { +const dm = "0123456789abcdef"; +function Di(t, e) { if (e || (e = {}), typeof t == "number") { hn.checkSafeUint53(t, "invalid hexlify value"); let r = ""; for (; t; ) - r = Qg[t & 15] + r, t = Math.floor(t / 16); + r = dm[t & 15] + r, t = Math.floor(t / 16); return r.length ? (r.length % 2 && (r = "0" + r), "0x" + r) : "0x00"; } if (typeof t == "bigint") return t = t.toString(16), t.length % 2 ? "0x0" + t : "0x" + t; - if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), K4(t)) + if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), w8(t)) return t.toHexString(); - if (zs(t)) + if (Ks(t)) return t.length % 2 && (e.hexPad === "left" ? t = "0x0" + t.substring(2) : e.hexPad === "right" ? t += "0" : hn.throwArgumentError("hex data is odd-length", "value", t)), t.toLowerCase(); - if (qv(t)) { + if (rb(t)) { let r = "0x"; for (let n = 0; n < t.length; n++) { let i = t[n]; - r += Qg[(i & 240) >> 4] + Qg[i & 15]; + r += dm[(i & 240) >> 4] + dm[i & 15]; } return r; } return hn.throwArgumentError("invalid hexlify value", "value", t); } -function RF(t) { +function fj(t) { if (typeof t != "string") - t = Ri(t); - else if (!zs(t) || t.length % 2) + t = Di(t); + else if (!Ks(t) || t.length % 2) return null; return (t.length - 2) / 2; } -function bx(t, e, r) { - return typeof t != "string" ? t = Ri(t) : (!zs(t) || t.length % 2) && hn.throwArgumentError("invalid hexData", "value", t), e = 2 + 2 * e, "0x" + t.substring(e); +function Nx(t, e, r) { + return typeof t != "string" ? t = Di(t) : (!Ks(t) || t.length % 2) && hn.throwArgumentError("invalid hexData", "value", t), e = 2 + 2 * e, "0x" + t.substring(e); } -function lu(t, e) { - for (typeof t != "string" ? t = Ri(t) : zs(t) || hn.throwArgumentError("invalid hex string", "value", t), t.length > 2 * e + 2 && hn.throwArgumentError("value out of range", "value", arguments[1]); t.length < 2 * e + 2; ) +function xu(t, e) { + for (typeof t != "string" ? t = Di(t) : Ks(t) || hn.throwArgumentError("invalid hex string", "value", t), t.length > 2 * e + 2 && hn.throwArgumentError("value out of range", "value", arguments[1]); t.length < 2 * e + 2; ) t = "0x0" + t.substring(2); return t; } -function V4(t) { +function x8(t) { const e = { r: "0x", s: "0x", @@ -8905,16 +9417,16 @@ function V4(t) { yParityAndS: "0x", compact: "0x" }; - if (IF(t)) { + if (aj(t)) { let r = wn(t); - r.length === 64 ? (e.v = 27 + (r[32] >> 7), r[32] &= 127, e.r = Ri(r.slice(0, 32)), e.s = Ri(r.slice(32, 64))) : r.length === 65 ? (e.r = Ri(r.slice(0, 32)), e.s = Ri(r.slice(32, 64)), e.v = r[64]) : hn.throwArgumentError("invalid signature string", "signature", t), e.v < 27 && (e.v === 0 || e.v === 1 ? e.v += 27 : hn.throwArgumentError("signature invalid v byte", "signature", t)), e.recoveryParam = 1 - e.v % 2, e.recoveryParam && (r[32] |= 128), e._vs = Ri(r.slice(32, 64)); + r.length === 64 ? (e.v = 27 + (r[32] >> 7), r[32] &= 127, e.r = Di(r.slice(0, 32)), e.s = Di(r.slice(32, 64))) : r.length === 65 ? (e.r = Di(r.slice(0, 32)), e.s = Di(r.slice(32, 64)), e.v = r[64]) : hn.throwArgumentError("invalid signature string", "signature", t), e.v < 27 && (e.v === 0 || e.v === 1 ? e.v += 27 : hn.throwArgumentError("signature invalid v byte", "signature", t)), e.recoveryParam = 1 - e.v % 2, e.recoveryParam && (r[32] |= 128), e._vs = Di(r.slice(32, 64)); } else { if (e.r = t.r, e.s = t.s, e.v = t.v, e.recoveryParam = t.recoveryParam, e._vs = t._vs, e._vs != null) { - const i = TF(wn(e._vs), 32); - e._vs = Ri(i); + const i = uj(wn(e._vs), 32); + e._vs = Di(i); const s = i[0] >= 128 ? 1 : 0; e.recoveryParam == null ? e.recoveryParam = s : e.recoveryParam !== s && hn.throwArgumentError("signature recoveryParam mismatch _vs", "signature", t), i[0] &= 127; - const o = Ri(i); + const o = Di(i); e.s == null ? e.s = o : e.s !== o && hn.throwArgumentError("signature v mismatch _vs", "signature", t); } if (e.recoveryParam == null) @@ -8925,19 +9437,19 @@ function V4(t) { const i = e.v === 0 || e.v === 1 ? e.v : 1 - e.v % 2; e.recoveryParam !== i && hn.throwArgumentError("signature recoveryParam mismatch v", "signature", t); } - e.r == null || !zs(e.r) ? hn.throwArgumentError("signature missing or invalid r", "signature", t) : e.r = lu(e.r, 32), e.s == null || !zs(e.s) ? hn.throwArgumentError("signature missing or invalid s", "signature", t) : e.s = lu(e.s, 32); + e.r == null || !Ks(e.r) ? hn.throwArgumentError("signature missing or invalid r", "signature", t) : e.r = xu(e.r, 32), e.s == null || !Ks(e.s) ? hn.throwArgumentError("signature missing or invalid s", "signature", t) : e.s = xu(e.s, 32); const r = wn(e.s); r[0] >= 128 && hn.throwArgumentError("signature s out of range", "signature", t), e.recoveryParam && (r[0] |= 128); - const n = Ri(r); - e._vs && (zs(e._vs) || hn.throwArgumentError("signature invalid _vs", "signature", t), e._vs = lu(e._vs, 32)), e._vs == null ? e._vs = n : e._vs !== n && hn.throwArgumentError("signature _vs mismatch v and s", "signature", t); + const n = Di(r); + e._vs && (Ks(e._vs) || hn.throwArgumentError("signature invalid _vs", "signature", t), e._vs = xu(e._vs, 32)), e._vs == null ? e._vs = n : e._vs !== n && hn.throwArgumentError("signature _vs mismatch v and s", "signature", t); } return e.yParityAndS = e._vs, e.compact = e.r + e.yParityAndS.substring(2), e; } -function zv(t) { - return "0x" + SF.keccak_256(wn(t)); +function nb(t) { + return "0x" + nj.keccak_256(wn(t)); } -var Wv = { exports: {} }; -Wv.exports; +var ib = { exports: {} }; +ib.exports; (function(t) { (function(e, r) { function n(m, f) { @@ -8957,7 +9469,7 @@ Wv.exports; typeof e == "object" ? e.exports = s : r.BN = s, s.BN = s, s.wordSize = 26; var o; try { - typeof window < "u" && typeof window.Buffer < "u" ? o = window.Buffer : o = Wl.Buffer; + typeof window < "u" && typeof window.Buffer < "u" ? o = window.Buffer : o = Ql.Buffer; } catch { } s.isBN = function(f) { @@ -8989,13 +9501,13 @@ Wv.exports; this.length = Math.ceil(f.length / 3), this.words = new Array(this.length); for (var x = 0; x < this.length; x++) this.words[x] = 0; - var _, E, v = 0; + var E, S, v = 0; if (b === "be") - for (x = f.length - 1, _ = 0; x >= 0; x -= 3) - E = f[x] | f[x - 1] << 8 | f[x - 2] << 16, this.words[_] |= E << v & 67108863, this.words[_ + 1] = E >>> 26 - v & 67108863, v += 24, v >= 26 && (v -= 26, _++); + for (x = f.length - 1, E = 0; x >= 0; x -= 3) + S = f[x] | f[x - 1] << 8 | f[x - 2] << 16, this.words[E] |= S << v & 67108863, this.words[E + 1] = S >>> 26 - v & 67108863, v += 24, v >= 26 && (v -= 26, E++); else if (b === "le") - for (x = 0, _ = 0; x < f.length; x += 3) - E = f[x] | f[x + 1] << 8 | f[x + 2] << 16, this.words[_] |= E << v & 67108863, this.words[_ + 1] = E >>> 26 - v & 67108863, v += 24, v >= 26 && (v -= 26, _++); + for (x = 0, E = 0; x < f.length; x += 3) + S = f[x] | f[x + 1] << 8 | f[x + 2] << 16, this.words[E] |= S << v & 67108863, this.words[E + 1] = S >>> 26 - v & 67108863, v += 24, v >= 26 && (v -= 26, E++); return this._strip(); }; function a(m, f) { @@ -9016,31 +9528,31 @@ Wv.exports; this.length = Math.ceil((f.length - g) / 6), this.words = new Array(this.length); for (var x = 0; x < this.length; x++) this.words[x] = 0; - var _ = 0, E = 0, v; + var E = 0, S = 0, v; if (b === "be") for (x = f.length - 1; x >= g; x -= 2) - v = u(f, g, x) << _, this.words[E] |= v & 67108863, _ >= 18 ? (_ -= 18, E += 1, this.words[E] |= v >>> 26) : _ += 8; + v = u(f, g, x) << E, this.words[S] |= v & 67108863, E >= 18 ? (E -= 18, S += 1, this.words[S] |= v >>> 26) : E += 8; else { - var P = f.length - g; - for (x = P % 2 === 0 ? g + 1 : g; x < f.length; x += 2) - v = u(f, g, x) << _, this.words[E] |= v & 67108863, _ >= 18 ? (_ -= 18, E += 1, this.words[E] |= v >>> 26) : _ += 8; + var M = f.length - g; + for (x = M % 2 === 0 ? g + 1 : g; x < f.length; x += 2) + v = u(f, g, x) << E, this.words[S] |= v & 67108863, E >= 18 ? (E -= 18, S += 1, this.words[S] |= v >>> 26) : E += 8; } this._strip(); }; function l(m, f, g, b) { - for (var x = 0, _ = 0, E = Math.min(m.length, g), v = f; v < E; v++) { - var P = m.charCodeAt(v) - 48; - x *= b, P >= 49 ? _ = P - 49 + 10 : P >= 17 ? _ = P - 17 + 10 : _ = P, n(P >= 0 && _ < b, "Invalid character"), x += _; + for (var x = 0, E = 0, S = Math.min(m.length, g), v = f; v < S; v++) { + var M = m.charCodeAt(v) - 48; + x *= b, M >= 49 ? E = M - 49 + 10 : M >= 17 ? E = M - 17 + 10 : E = M, n(M >= 0 && E < b, "Invalid character"), x += E; } return x; } s.prototype._parseBase = function(f, g, b) { this.words = [0], this.length = 1; - for (var x = 0, _ = 1; _ <= 67108863; _ *= g) + for (var x = 0, E = 1; E <= 67108863; E *= g) x++; - x--, _ = _ / g | 0; - for (var E = f.length - b, v = E % x, P = Math.min(E, E - v) + b, I = 0, F = b; F < P; F += x) - I = l(f, F, F + x, g), this.imuln(_), this.words[0] + I < 67108864 ? this.words[0] += I : this._iaddn(I); + x--, E = E / g | 0; + for (var S = f.length - b, v = S % x, M = Math.min(S, S - v) + b, I = 0, F = b; F < M; F += x) + I = l(f, F, F + x, g), this.imuln(E), this.words[0] + I < 67108864 ? this.words[0] += I : this._iaddn(I); if (v !== 0) { var ce = 1; for (I = l(f, F, f.length, g), F = 0; F < v; F++) @@ -9110,7 +9622,7 @@ Wv.exports; "00000000000000000000000", "000000000000000000000000", "0000000000000000000000000" - ], A = [ + ], _ = [ 0, 0, 25, @@ -9148,7 +9660,7 @@ Wv.exports; 5, 5, 5 - ], M = [ + ], P = [ 0, 0, 33554432, @@ -9192,16 +9704,16 @@ Wv.exports; var b; if (f === 16 || f === "hex") { b = ""; - for (var x = 0, _ = 0, E = 0; E < this.length; E++) { - var v = this.words[E], P = ((v << x | _) & 16777215).toString(16); - _ = v >>> 24 - x & 16777215, x += 2, x >= 26 && (x -= 26, E--), _ !== 0 || E !== this.length - 1 ? b = w[6 - P.length] + P + b : b = P + b; + for (var x = 0, E = 0, S = 0; S < this.length; S++) { + var v = this.words[S], M = ((v << x | E) & 16777215).toString(16); + E = v >>> 24 - x & 16777215, x += 2, x >= 26 && (x -= 26, S--), E !== 0 || S !== this.length - 1 ? b = w[6 - M.length] + M + b : b = M + b; } - for (_ !== 0 && (b = _.toString(16) + b); b.length % g !== 0; ) + for (E !== 0 && (b = E.toString(16) + b); b.length % g !== 0; ) b = "0" + b; return this.negative !== 0 && (b = "-" + b), b; } if (f === (f | 0) && f >= 2 && f <= 36) { - var I = A[f], F = M[f]; + var I = _[f], F = P[f]; b = ""; var ce = this.clone(); for (ce.negative = 0; !ce.isZero(); ) { @@ -9223,27 +9735,27 @@ Wv.exports; }), s.prototype.toArray = function(f, g) { return this.toArrayLike(Array, f, g); }; - var N = function(f, g) { + var O = function(f, g) { return f.allocUnsafe ? f.allocUnsafe(g) : new f(g); }; s.prototype.toArrayLike = function(f, g, b) { this._strip(); - var x = this.byteLength(), _ = b || Math.max(1, x); - n(x <= _, "byte array longer than desired length"), n(_ > 0, "Requested array length <= 0"); - var E = N(f, _), v = g === "le" ? "LE" : "BE"; - return this["_toArrayLike" + v](E, x), E; + var x = this.byteLength(), E = b || Math.max(1, x); + n(x <= E, "byte array longer than desired length"), n(E > 0, "Requested array length <= 0"); + var S = O(f, E), v = g === "le" ? "LE" : "BE"; + return this["_toArrayLike" + v](S, x), S; }, s.prototype._toArrayLikeLE = function(f, g) { - for (var b = 0, x = 0, _ = 0, E = 0; _ < this.length; _++) { - var v = this.words[_] << E | x; - f[b++] = v & 255, b < f.length && (f[b++] = v >> 8 & 255), b < f.length && (f[b++] = v >> 16 & 255), E === 6 ? (b < f.length && (f[b++] = v >> 24 & 255), x = 0, E = 0) : (x = v >>> 24, E += 2); + for (var b = 0, x = 0, E = 0, S = 0; E < this.length; E++) { + var v = this.words[E] << S | x; + f[b++] = v & 255, b < f.length && (f[b++] = v >> 8 & 255), b < f.length && (f[b++] = v >> 16 & 255), S === 6 ? (b < f.length && (f[b++] = v >> 24 & 255), x = 0, S = 0) : (x = v >>> 24, S += 2); } if (b < f.length) for (f[b++] = x; b < f.length; ) f[b++] = 0; }, s.prototype._toArrayLikeBE = function(f, g) { - for (var b = f.length - 1, x = 0, _ = 0, E = 0; _ < this.length; _++) { - var v = this.words[_] << E | x; - f[b--] = v & 255, b >= 0 && (f[b--] = v >> 8 & 255), b >= 0 && (f[b--] = v >> 16 & 255), E === 6 ? (b >= 0 && (f[b--] = v >> 24 & 255), x = 0, E = 0) : (x = v >>> 24, E += 2); + for (var b = f.length - 1, x = 0, E = 0, S = 0; E < this.length; E++) { + var v = this.words[E] << S | x; + f[b--] = v & 255, b >= 0 && (f[b--] = v >> 8 & 255), b >= 0 && (f[b--] = v >> 16 & 255), S === 6 ? (b >= 0 && (f[b--] = v >> 24 & 255), x = 0, S = 0) : (x = v >>> 24, S += 2); } if (b >= 0) for (f[b--] = x; b >= 0; ) @@ -9347,15 +9859,15 @@ Wv.exports; return f.negative = 0, g = this.isub(f), f.negative = 1, g._normSign(); var b, x; this.length > f.length ? (b = this, x = f) : (b = f, x = this); - for (var _ = 0, E = 0; E < x.length; E++) - g = (b.words[E] | 0) + (x.words[E] | 0) + _, this.words[E] = g & 67108863, _ = g >>> 26; - for (; _ !== 0 && E < b.length; E++) - g = (b.words[E] | 0) + _, this.words[E] = g & 67108863, _ = g >>> 26; - if (this.length = b.length, _ !== 0) - this.words[this.length] = _, this.length++; + for (var E = 0, S = 0; S < x.length; S++) + g = (b.words[S] | 0) + (x.words[S] | 0) + E, this.words[S] = g & 67108863, E = g >>> 26; + for (; E !== 0 && S < b.length; S++) + g = (b.words[S] | 0) + E, this.words[S] = g & 67108863, E = g >>> 26; + if (this.length = b.length, E !== 0) + this.words[this.length] = E, this.length++; else if (b !== this) - for (; E < b.length; E++) - this.words[E] = b.words[E]; + for (; S < b.length; S++) + this.words[S] = b.words[S]; return this; }, s.prototype.add = function(f) { var g; @@ -9370,13 +9882,13 @@ Wv.exports; var b = this.cmp(f); if (b === 0) return this.negative = 0, this.length = 1, this.words[0] = 0, this; - var x, _; - b > 0 ? (x = this, _ = f) : (x = f, _ = this); - for (var E = 0, v = 0; v < _.length; v++) - g = (x.words[v] | 0) - (_.words[v] | 0) + E, E = g >> 26, this.words[v] = g & 67108863; - for (; E !== 0 && v < x.length; v++) - g = (x.words[v] | 0) + E, E = g >> 26, this.words[v] = g & 67108863; - if (E === 0 && v < x.length && x !== this) + var x, E; + b > 0 ? (x = this, E = f) : (x = f, E = this); + for (var S = 0, v = 0; v < E.length; v++) + g = (x.words[v] | 0) - (E.words[v] | 0) + S, S = g >> 26, this.words[v] = g & 67108863; + for (; S !== 0 && v < x.length; v++) + g = (x.words[v] | 0) + S, S = g >> 26, this.words[v] = g & 67108863; + if (S === 0 && v < x.length && x !== this) for (; v < x.length; v++) this.words[v] = x.words[v]; return this.length = Math.max(this.length, v), x !== this && (this.negative = 1), this._strip(); @@ -9387,79 +9899,79 @@ Wv.exports; g.negative = f.negative ^ m.negative; var b = m.length + f.length | 0; g.length = b, b = b - 1 | 0; - var x = m.words[0] | 0, _ = f.words[0] | 0, E = x * _, v = E & 67108863, P = E / 67108864 | 0; + var x = m.words[0] | 0, E = f.words[0] | 0, S = x * E, v = S & 67108863, M = S / 67108864 | 0; g.words[0] = v; for (var I = 1; I < b; I++) { - for (var F = P >>> 26, ce = P & 67108863, D = Math.min(I, f.length - 1), oe = Math.max(0, I - m.length + 1); oe <= D; oe++) { + for (var F = M >>> 26, ce = M & 67108863, D = Math.min(I, f.length - 1), oe = Math.max(0, I - m.length + 1); oe <= D; oe++) { var Z = I - oe | 0; - x = m.words[Z] | 0, _ = f.words[oe] | 0, E = x * _ + ce, F += E / 67108864 | 0, ce = E & 67108863; - } - g.words[I] = ce | 0, P = F | 0; - } - return P !== 0 ? g.words[I] = P | 0 : g.length--, g._strip(); - } - var $ = function(f, g, b) { - var x = f.words, _ = g.words, E = b.words, v = 0, P, I, F, ce = x[0] | 0, D = ce & 8191, oe = ce >>> 13, Z = x[1] | 0, J = Z & 8191, Q = Z >>> 13, T = x[2] | 0, X = T & 8191, re = T >>> 13, pe = x[3] | 0, ie = pe & 8191, ue = pe >>> 13, ve = x[4] | 0, Pe = ve & 8191, De = ve >>> 13, Ce = x[5] | 0, $e = Ce & 8191, Me = Ce >>> 13, Ne = x[6] | 0, Ke = Ne & 8191, Le = Ne >>> 13, qe = x[7] | 0, ze = qe & 8191, _e = qe >>> 13, Ze = x[8] | 0, at = Ze & 8191, ke = Ze >>> 13, Qe = x[9] | 0, tt = Qe & 8191, Ye = Qe >>> 13, dt = _[0] | 0, lt = dt & 8191, ct = dt >>> 13, qt = _[1] | 0, Jt = qt & 8191, Et = qt >>> 13, er = _[2] | 0, Xt = er & 8191, Dt = er >>> 13, kt = _[3] | 0, Ct = kt & 8191, gt = kt >>> 13, Rt = _[4] | 0, Nt = Rt & 8191, vt = Rt >>> 13, $t = _[5] | 0, Ft = $t & 8191, rt = $t >>> 13, Bt = _[6] | 0, k = Bt & 8191, q = Bt >>> 13, W = _[7] | 0, C = W & 8191, G = W >>> 13, j = _[8] | 0, se = j & 8191, de = j >>> 13, xe = _[9] | 0, Te = xe & 8191, Re = xe >>> 13; - b.negative = f.negative ^ g.negative, b.length = 19, P = Math.imul(D, lt), I = Math.imul(D, ct), I = I + Math.imul(oe, lt) | 0, F = Math.imul(oe, ct); - var nt = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, P = Math.imul(J, lt), I = Math.imul(J, ct), I = I + Math.imul(Q, lt) | 0, F = Math.imul(Q, ct), P = P + Math.imul(D, Jt) | 0, I = I + Math.imul(D, Et) | 0, I = I + Math.imul(oe, Jt) | 0, F = F + Math.imul(oe, Et) | 0; - var je = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (je >>> 26) | 0, je &= 67108863, P = Math.imul(X, lt), I = Math.imul(X, ct), I = I + Math.imul(re, lt) | 0, F = Math.imul(re, ct), P = P + Math.imul(J, Jt) | 0, I = I + Math.imul(J, Et) | 0, I = I + Math.imul(Q, Jt) | 0, F = F + Math.imul(Q, Et) | 0, P = P + Math.imul(D, Xt) | 0, I = I + Math.imul(D, Dt) | 0, I = I + Math.imul(oe, Xt) | 0, F = F + Math.imul(oe, Dt) | 0; - var pt = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (pt >>> 26) | 0, pt &= 67108863, P = Math.imul(ie, lt), I = Math.imul(ie, ct), I = I + Math.imul(ue, lt) | 0, F = Math.imul(ue, ct), P = P + Math.imul(X, Jt) | 0, I = I + Math.imul(X, Et) | 0, I = I + Math.imul(re, Jt) | 0, F = F + Math.imul(re, Et) | 0, P = P + Math.imul(J, Xt) | 0, I = I + Math.imul(J, Dt) | 0, I = I + Math.imul(Q, Xt) | 0, F = F + Math.imul(Q, Dt) | 0, P = P + Math.imul(D, Ct) | 0, I = I + Math.imul(D, gt) | 0, I = I + Math.imul(oe, Ct) | 0, F = F + Math.imul(oe, gt) | 0; - var it = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, P = Math.imul(Pe, lt), I = Math.imul(Pe, ct), I = I + Math.imul(De, lt) | 0, F = Math.imul(De, ct), P = P + Math.imul(ie, Jt) | 0, I = I + Math.imul(ie, Et) | 0, I = I + Math.imul(ue, Jt) | 0, F = F + Math.imul(ue, Et) | 0, P = P + Math.imul(X, Xt) | 0, I = I + Math.imul(X, Dt) | 0, I = I + Math.imul(re, Xt) | 0, F = F + Math.imul(re, Dt) | 0, P = P + Math.imul(J, Ct) | 0, I = I + Math.imul(J, gt) | 0, I = I + Math.imul(Q, Ct) | 0, F = F + Math.imul(Q, gt) | 0, P = P + Math.imul(D, Nt) | 0, I = I + Math.imul(D, vt) | 0, I = I + Math.imul(oe, Nt) | 0, F = F + Math.imul(oe, vt) | 0; - var et = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, P = Math.imul($e, lt), I = Math.imul($e, ct), I = I + Math.imul(Me, lt) | 0, F = Math.imul(Me, ct), P = P + Math.imul(Pe, Jt) | 0, I = I + Math.imul(Pe, Et) | 0, I = I + Math.imul(De, Jt) | 0, F = F + Math.imul(De, Et) | 0, P = P + Math.imul(ie, Xt) | 0, I = I + Math.imul(ie, Dt) | 0, I = I + Math.imul(ue, Xt) | 0, F = F + Math.imul(ue, Dt) | 0, P = P + Math.imul(X, Ct) | 0, I = I + Math.imul(X, gt) | 0, I = I + Math.imul(re, Ct) | 0, F = F + Math.imul(re, gt) | 0, P = P + Math.imul(J, Nt) | 0, I = I + Math.imul(J, vt) | 0, I = I + Math.imul(Q, Nt) | 0, F = F + Math.imul(Q, vt) | 0, P = P + Math.imul(D, Ft) | 0, I = I + Math.imul(D, rt) | 0, I = I + Math.imul(oe, Ft) | 0, F = F + Math.imul(oe, rt) | 0; - var St = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, P = Math.imul(Ke, lt), I = Math.imul(Ke, ct), I = I + Math.imul(Le, lt) | 0, F = Math.imul(Le, ct), P = P + Math.imul($e, Jt) | 0, I = I + Math.imul($e, Et) | 0, I = I + Math.imul(Me, Jt) | 0, F = F + Math.imul(Me, Et) | 0, P = P + Math.imul(Pe, Xt) | 0, I = I + Math.imul(Pe, Dt) | 0, I = I + Math.imul(De, Xt) | 0, F = F + Math.imul(De, Dt) | 0, P = P + Math.imul(ie, Ct) | 0, I = I + Math.imul(ie, gt) | 0, I = I + Math.imul(ue, Ct) | 0, F = F + Math.imul(ue, gt) | 0, P = P + Math.imul(X, Nt) | 0, I = I + Math.imul(X, vt) | 0, I = I + Math.imul(re, Nt) | 0, F = F + Math.imul(re, vt) | 0, P = P + Math.imul(J, Ft) | 0, I = I + Math.imul(J, rt) | 0, I = I + Math.imul(Q, Ft) | 0, F = F + Math.imul(Q, rt) | 0, P = P + Math.imul(D, k) | 0, I = I + Math.imul(D, q) | 0, I = I + Math.imul(oe, k) | 0, F = F + Math.imul(oe, q) | 0; - var Tt = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, P = Math.imul(ze, lt), I = Math.imul(ze, ct), I = I + Math.imul(_e, lt) | 0, F = Math.imul(_e, ct), P = P + Math.imul(Ke, Jt) | 0, I = I + Math.imul(Ke, Et) | 0, I = I + Math.imul(Le, Jt) | 0, F = F + Math.imul(Le, Et) | 0, P = P + Math.imul($e, Xt) | 0, I = I + Math.imul($e, Dt) | 0, I = I + Math.imul(Me, Xt) | 0, F = F + Math.imul(Me, Dt) | 0, P = P + Math.imul(Pe, Ct) | 0, I = I + Math.imul(Pe, gt) | 0, I = I + Math.imul(De, Ct) | 0, F = F + Math.imul(De, gt) | 0, P = P + Math.imul(ie, Nt) | 0, I = I + Math.imul(ie, vt) | 0, I = I + Math.imul(ue, Nt) | 0, F = F + Math.imul(ue, vt) | 0, P = P + Math.imul(X, Ft) | 0, I = I + Math.imul(X, rt) | 0, I = I + Math.imul(re, Ft) | 0, F = F + Math.imul(re, rt) | 0, P = P + Math.imul(J, k) | 0, I = I + Math.imul(J, q) | 0, I = I + Math.imul(Q, k) | 0, F = F + Math.imul(Q, q) | 0, P = P + Math.imul(D, C) | 0, I = I + Math.imul(D, G) | 0, I = I + Math.imul(oe, C) | 0, F = F + Math.imul(oe, G) | 0; - var At = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, P = Math.imul(at, lt), I = Math.imul(at, ct), I = I + Math.imul(ke, lt) | 0, F = Math.imul(ke, ct), P = P + Math.imul(ze, Jt) | 0, I = I + Math.imul(ze, Et) | 0, I = I + Math.imul(_e, Jt) | 0, F = F + Math.imul(_e, Et) | 0, P = P + Math.imul(Ke, Xt) | 0, I = I + Math.imul(Ke, Dt) | 0, I = I + Math.imul(Le, Xt) | 0, F = F + Math.imul(Le, Dt) | 0, P = P + Math.imul($e, Ct) | 0, I = I + Math.imul($e, gt) | 0, I = I + Math.imul(Me, Ct) | 0, F = F + Math.imul(Me, gt) | 0, P = P + Math.imul(Pe, Nt) | 0, I = I + Math.imul(Pe, vt) | 0, I = I + Math.imul(De, Nt) | 0, F = F + Math.imul(De, vt) | 0, P = P + Math.imul(ie, Ft) | 0, I = I + Math.imul(ie, rt) | 0, I = I + Math.imul(ue, Ft) | 0, F = F + Math.imul(ue, rt) | 0, P = P + Math.imul(X, k) | 0, I = I + Math.imul(X, q) | 0, I = I + Math.imul(re, k) | 0, F = F + Math.imul(re, q) | 0, P = P + Math.imul(J, C) | 0, I = I + Math.imul(J, G) | 0, I = I + Math.imul(Q, C) | 0, F = F + Math.imul(Q, G) | 0, P = P + Math.imul(D, se) | 0, I = I + Math.imul(D, de) | 0, I = I + Math.imul(oe, se) | 0, F = F + Math.imul(oe, de) | 0; - var _t = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, P = Math.imul(tt, lt), I = Math.imul(tt, ct), I = I + Math.imul(Ye, lt) | 0, F = Math.imul(Ye, ct), P = P + Math.imul(at, Jt) | 0, I = I + Math.imul(at, Et) | 0, I = I + Math.imul(ke, Jt) | 0, F = F + Math.imul(ke, Et) | 0, P = P + Math.imul(ze, Xt) | 0, I = I + Math.imul(ze, Dt) | 0, I = I + Math.imul(_e, Xt) | 0, F = F + Math.imul(_e, Dt) | 0, P = P + Math.imul(Ke, Ct) | 0, I = I + Math.imul(Ke, gt) | 0, I = I + Math.imul(Le, Ct) | 0, F = F + Math.imul(Le, gt) | 0, P = P + Math.imul($e, Nt) | 0, I = I + Math.imul($e, vt) | 0, I = I + Math.imul(Me, Nt) | 0, F = F + Math.imul(Me, vt) | 0, P = P + Math.imul(Pe, Ft) | 0, I = I + Math.imul(Pe, rt) | 0, I = I + Math.imul(De, Ft) | 0, F = F + Math.imul(De, rt) | 0, P = P + Math.imul(ie, k) | 0, I = I + Math.imul(ie, q) | 0, I = I + Math.imul(ue, k) | 0, F = F + Math.imul(ue, q) | 0, P = P + Math.imul(X, C) | 0, I = I + Math.imul(X, G) | 0, I = I + Math.imul(re, C) | 0, F = F + Math.imul(re, G) | 0, P = P + Math.imul(J, se) | 0, I = I + Math.imul(J, de) | 0, I = I + Math.imul(Q, se) | 0, F = F + Math.imul(Q, de) | 0, P = P + Math.imul(D, Te) | 0, I = I + Math.imul(D, Re) | 0, I = I + Math.imul(oe, Te) | 0, F = F + Math.imul(oe, Re) | 0; - var ht = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, P = Math.imul(tt, Jt), I = Math.imul(tt, Et), I = I + Math.imul(Ye, Jt) | 0, F = Math.imul(Ye, Et), P = P + Math.imul(at, Xt) | 0, I = I + Math.imul(at, Dt) | 0, I = I + Math.imul(ke, Xt) | 0, F = F + Math.imul(ke, Dt) | 0, P = P + Math.imul(ze, Ct) | 0, I = I + Math.imul(ze, gt) | 0, I = I + Math.imul(_e, Ct) | 0, F = F + Math.imul(_e, gt) | 0, P = P + Math.imul(Ke, Nt) | 0, I = I + Math.imul(Ke, vt) | 0, I = I + Math.imul(Le, Nt) | 0, F = F + Math.imul(Le, vt) | 0, P = P + Math.imul($e, Ft) | 0, I = I + Math.imul($e, rt) | 0, I = I + Math.imul(Me, Ft) | 0, F = F + Math.imul(Me, rt) | 0, P = P + Math.imul(Pe, k) | 0, I = I + Math.imul(Pe, q) | 0, I = I + Math.imul(De, k) | 0, F = F + Math.imul(De, q) | 0, P = P + Math.imul(ie, C) | 0, I = I + Math.imul(ie, G) | 0, I = I + Math.imul(ue, C) | 0, F = F + Math.imul(ue, G) | 0, P = P + Math.imul(X, se) | 0, I = I + Math.imul(X, de) | 0, I = I + Math.imul(re, se) | 0, F = F + Math.imul(re, de) | 0, P = P + Math.imul(J, Te) | 0, I = I + Math.imul(J, Re) | 0, I = I + Math.imul(Q, Te) | 0, F = F + Math.imul(Q, Re) | 0; - var xt = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, P = Math.imul(tt, Xt), I = Math.imul(tt, Dt), I = I + Math.imul(Ye, Xt) | 0, F = Math.imul(Ye, Dt), P = P + Math.imul(at, Ct) | 0, I = I + Math.imul(at, gt) | 0, I = I + Math.imul(ke, Ct) | 0, F = F + Math.imul(ke, gt) | 0, P = P + Math.imul(ze, Nt) | 0, I = I + Math.imul(ze, vt) | 0, I = I + Math.imul(_e, Nt) | 0, F = F + Math.imul(_e, vt) | 0, P = P + Math.imul(Ke, Ft) | 0, I = I + Math.imul(Ke, rt) | 0, I = I + Math.imul(Le, Ft) | 0, F = F + Math.imul(Le, rt) | 0, P = P + Math.imul($e, k) | 0, I = I + Math.imul($e, q) | 0, I = I + Math.imul(Me, k) | 0, F = F + Math.imul(Me, q) | 0, P = P + Math.imul(Pe, C) | 0, I = I + Math.imul(Pe, G) | 0, I = I + Math.imul(De, C) | 0, F = F + Math.imul(De, G) | 0, P = P + Math.imul(ie, se) | 0, I = I + Math.imul(ie, de) | 0, I = I + Math.imul(ue, se) | 0, F = F + Math.imul(ue, de) | 0, P = P + Math.imul(X, Te) | 0, I = I + Math.imul(X, Re) | 0, I = I + Math.imul(re, Te) | 0, F = F + Math.imul(re, Re) | 0; - var st = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, P = Math.imul(tt, Ct), I = Math.imul(tt, gt), I = I + Math.imul(Ye, Ct) | 0, F = Math.imul(Ye, gt), P = P + Math.imul(at, Nt) | 0, I = I + Math.imul(at, vt) | 0, I = I + Math.imul(ke, Nt) | 0, F = F + Math.imul(ke, vt) | 0, P = P + Math.imul(ze, Ft) | 0, I = I + Math.imul(ze, rt) | 0, I = I + Math.imul(_e, Ft) | 0, F = F + Math.imul(_e, rt) | 0, P = P + Math.imul(Ke, k) | 0, I = I + Math.imul(Ke, q) | 0, I = I + Math.imul(Le, k) | 0, F = F + Math.imul(Le, q) | 0, P = P + Math.imul($e, C) | 0, I = I + Math.imul($e, G) | 0, I = I + Math.imul(Me, C) | 0, F = F + Math.imul(Me, G) | 0, P = P + Math.imul(Pe, se) | 0, I = I + Math.imul(Pe, de) | 0, I = I + Math.imul(De, se) | 0, F = F + Math.imul(De, de) | 0, P = P + Math.imul(ie, Te) | 0, I = I + Math.imul(ie, Re) | 0, I = I + Math.imul(ue, Te) | 0, F = F + Math.imul(ue, Re) | 0; - var bt = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, P = Math.imul(tt, Nt), I = Math.imul(tt, vt), I = I + Math.imul(Ye, Nt) | 0, F = Math.imul(Ye, vt), P = P + Math.imul(at, Ft) | 0, I = I + Math.imul(at, rt) | 0, I = I + Math.imul(ke, Ft) | 0, F = F + Math.imul(ke, rt) | 0, P = P + Math.imul(ze, k) | 0, I = I + Math.imul(ze, q) | 0, I = I + Math.imul(_e, k) | 0, F = F + Math.imul(_e, q) | 0, P = P + Math.imul(Ke, C) | 0, I = I + Math.imul(Ke, G) | 0, I = I + Math.imul(Le, C) | 0, F = F + Math.imul(Le, G) | 0, P = P + Math.imul($e, se) | 0, I = I + Math.imul($e, de) | 0, I = I + Math.imul(Me, se) | 0, F = F + Math.imul(Me, de) | 0, P = P + Math.imul(Pe, Te) | 0, I = I + Math.imul(Pe, Re) | 0, I = I + Math.imul(De, Te) | 0, F = F + Math.imul(De, Re) | 0; - var ut = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, P = Math.imul(tt, Ft), I = Math.imul(tt, rt), I = I + Math.imul(Ye, Ft) | 0, F = Math.imul(Ye, rt), P = P + Math.imul(at, k) | 0, I = I + Math.imul(at, q) | 0, I = I + Math.imul(ke, k) | 0, F = F + Math.imul(ke, q) | 0, P = P + Math.imul(ze, C) | 0, I = I + Math.imul(ze, G) | 0, I = I + Math.imul(_e, C) | 0, F = F + Math.imul(_e, G) | 0, P = P + Math.imul(Ke, se) | 0, I = I + Math.imul(Ke, de) | 0, I = I + Math.imul(Le, se) | 0, F = F + Math.imul(Le, de) | 0, P = P + Math.imul($e, Te) | 0, I = I + Math.imul($e, Re) | 0, I = I + Math.imul(Me, Te) | 0, F = F + Math.imul(Me, Re) | 0; - var ot = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, P = Math.imul(tt, k), I = Math.imul(tt, q), I = I + Math.imul(Ye, k) | 0, F = Math.imul(Ye, q), P = P + Math.imul(at, C) | 0, I = I + Math.imul(at, G) | 0, I = I + Math.imul(ke, C) | 0, F = F + Math.imul(ke, G) | 0, P = P + Math.imul(ze, se) | 0, I = I + Math.imul(ze, de) | 0, I = I + Math.imul(_e, se) | 0, F = F + Math.imul(_e, de) | 0, P = P + Math.imul(Ke, Te) | 0, I = I + Math.imul(Ke, Re) | 0, I = I + Math.imul(Le, Te) | 0, F = F + Math.imul(Le, Re) | 0; - var Se = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, P = Math.imul(tt, C), I = Math.imul(tt, G), I = I + Math.imul(Ye, C) | 0, F = Math.imul(Ye, G), P = P + Math.imul(at, se) | 0, I = I + Math.imul(at, de) | 0, I = I + Math.imul(ke, se) | 0, F = F + Math.imul(ke, de) | 0, P = P + Math.imul(ze, Te) | 0, I = I + Math.imul(ze, Re) | 0, I = I + Math.imul(_e, Te) | 0, F = F + Math.imul(_e, Re) | 0; - var Ae = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, P = Math.imul(tt, se), I = Math.imul(tt, de), I = I + Math.imul(Ye, se) | 0, F = Math.imul(Ye, de), P = P + Math.imul(at, Te) | 0, I = I + Math.imul(at, Re) | 0, I = I + Math.imul(ke, Te) | 0, F = F + Math.imul(ke, Re) | 0; - var Ve = (v + P | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (Ve >>> 26) | 0, Ve &= 67108863, P = Math.imul(tt, Te), I = Math.imul(tt, Re), I = I + Math.imul(Ye, Te) | 0, F = Math.imul(Ye, Re); - var Fe = (v + P | 0) + ((I & 8191) << 13) | 0; - return v = (F + (I >>> 13) | 0) + (Fe >>> 26) | 0, Fe &= 67108863, E[0] = nt, E[1] = je, E[2] = pt, E[3] = it, E[4] = et, E[5] = St, E[6] = Tt, E[7] = At, E[8] = _t, E[9] = ht, E[10] = xt, E[11] = st, E[12] = bt, E[13] = ut, E[14] = ot, E[15] = Se, E[16] = Ae, E[17] = Ve, E[18] = Fe, v !== 0 && (E[19] = v, b.length++), b; + x = m.words[Z] | 0, E = f.words[oe] | 0, S = x * E + ce, F += S / 67108864 | 0, ce = S & 67108863; + } + g.words[I] = ce | 0, M = F | 0; + } + return M !== 0 ? g.words[I] = M | 0 : g.length--, g._strip(); + } + var k = function(f, g, b) { + var x = f.words, E = g.words, S = b.words, v = 0, M, I, F, ce = x[0] | 0, D = ce & 8191, oe = ce >>> 13, Z = x[1] | 0, J = Z & 8191, ee = Z >>> 13, T = x[2] | 0, X = T & 8191, re = T >>> 13, pe = x[3] | 0, ie = pe & 8191, ue = pe >>> 13, ve = x[4] | 0, Pe = ve & 8191, De = ve >>> 13, Ce = x[5] | 0, $e = Ce & 8191, Me = Ce >>> 13, Ne = x[6] | 0, Ke = Ne & 8191, Le = Ne >>> 13, qe = x[7] | 0, ze = qe & 8191, _e = qe >>> 13, Ze = x[8] | 0, at = Ze & 8191, ke = Ze >>> 13, Qe = x[9] | 0, tt = Qe & 8191, Ye = Qe >>> 13, dt = E[0] | 0, lt = dt & 8191, ct = dt >>> 13, qt = E[1] | 0, Jt = qt & 8191, Et = qt >>> 13, er = E[2] | 0, Xt = er & 8191, Dt = er >>> 13, kt = E[3] | 0, Ct = kt & 8191, mt = kt >>> 13, Rt = E[4] | 0, Nt = Rt & 8191, bt = Rt >>> 13, $t = E[5] | 0, Ft = $t & 8191, rt = $t >>> 13, Bt = E[6] | 0, $ = Bt & 8191, z = Bt >>> 13, H = E[7] | 0, C = H & 8191, G = H >>> 13, j = E[8] | 0, se = j & 8191, de = j >>> 13, xe = E[9] | 0, Te = xe & 8191, Re = xe >>> 13; + b.negative = f.negative ^ g.negative, b.length = 19, M = Math.imul(D, lt), I = Math.imul(D, ct), I = I + Math.imul(oe, lt) | 0, F = Math.imul(oe, ct); + var nt = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, M = Math.imul(J, lt), I = Math.imul(J, ct), I = I + Math.imul(ee, lt) | 0, F = Math.imul(ee, ct), M = M + Math.imul(D, Jt) | 0, I = I + Math.imul(D, Et) | 0, I = I + Math.imul(oe, Jt) | 0, F = F + Math.imul(oe, Et) | 0; + var je = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (je >>> 26) | 0, je &= 67108863, M = Math.imul(X, lt), I = Math.imul(X, ct), I = I + Math.imul(re, lt) | 0, F = Math.imul(re, ct), M = M + Math.imul(J, Jt) | 0, I = I + Math.imul(J, Et) | 0, I = I + Math.imul(ee, Jt) | 0, F = F + Math.imul(ee, Et) | 0, M = M + Math.imul(D, Xt) | 0, I = I + Math.imul(D, Dt) | 0, I = I + Math.imul(oe, Xt) | 0, F = F + Math.imul(oe, Dt) | 0; + var pt = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (pt >>> 26) | 0, pt &= 67108863, M = Math.imul(ie, lt), I = Math.imul(ie, ct), I = I + Math.imul(ue, lt) | 0, F = Math.imul(ue, ct), M = M + Math.imul(X, Jt) | 0, I = I + Math.imul(X, Et) | 0, I = I + Math.imul(re, Jt) | 0, F = F + Math.imul(re, Et) | 0, M = M + Math.imul(J, Xt) | 0, I = I + Math.imul(J, Dt) | 0, I = I + Math.imul(ee, Xt) | 0, F = F + Math.imul(ee, Dt) | 0, M = M + Math.imul(D, Ct) | 0, I = I + Math.imul(D, mt) | 0, I = I + Math.imul(oe, Ct) | 0, F = F + Math.imul(oe, mt) | 0; + var it = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, M = Math.imul(Pe, lt), I = Math.imul(Pe, ct), I = I + Math.imul(De, lt) | 0, F = Math.imul(De, ct), M = M + Math.imul(ie, Jt) | 0, I = I + Math.imul(ie, Et) | 0, I = I + Math.imul(ue, Jt) | 0, F = F + Math.imul(ue, Et) | 0, M = M + Math.imul(X, Xt) | 0, I = I + Math.imul(X, Dt) | 0, I = I + Math.imul(re, Xt) | 0, F = F + Math.imul(re, Dt) | 0, M = M + Math.imul(J, Ct) | 0, I = I + Math.imul(J, mt) | 0, I = I + Math.imul(ee, Ct) | 0, F = F + Math.imul(ee, mt) | 0, M = M + Math.imul(D, Nt) | 0, I = I + Math.imul(D, bt) | 0, I = I + Math.imul(oe, Nt) | 0, F = F + Math.imul(oe, bt) | 0; + var et = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, M = Math.imul($e, lt), I = Math.imul($e, ct), I = I + Math.imul(Me, lt) | 0, F = Math.imul(Me, ct), M = M + Math.imul(Pe, Jt) | 0, I = I + Math.imul(Pe, Et) | 0, I = I + Math.imul(De, Jt) | 0, F = F + Math.imul(De, Et) | 0, M = M + Math.imul(ie, Xt) | 0, I = I + Math.imul(ie, Dt) | 0, I = I + Math.imul(ue, Xt) | 0, F = F + Math.imul(ue, Dt) | 0, M = M + Math.imul(X, Ct) | 0, I = I + Math.imul(X, mt) | 0, I = I + Math.imul(re, Ct) | 0, F = F + Math.imul(re, mt) | 0, M = M + Math.imul(J, Nt) | 0, I = I + Math.imul(J, bt) | 0, I = I + Math.imul(ee, Nt) | 0, F = F + Math.imul(ee, bt) | 0, M = M + Math.imul(D, Ft) | 0, I = I + Math.imul(D, rt) | 0, I = I + Math.imul(oe, Ft) | 0, F = F + Math.imul(oe, rt) | 0; + var St = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, M = Math.imul(Ke, lt), I = Math.imul(Ke, ct), I = I + Math.imul(Le, lt) | 0, F = Math.imul(Le, ct), M = M + Math.imul($e, Jt) | 0, I = I + Math.imul($e, Et) | 0, I = I + Math.imul(Me, Jt) | 0, F = F + Math.imul(Me, Et) | 0, M = M + Math.imul(Pe, Xt) | 0, I = I + Math.imul(Pe, Dt) | 0, I = I + Math.imul(De, Xt) | 0, F = F + Math.imul(De, Dt) | 0, M = M + Math.imul(ie, Ct) | 0, I = I + Math.imul(ie, mt) | 0, I = I + Math.imul(ue, Ct) | 0, F = F + Math.imul(ue, mt) | 0, M = M + Math.imul(X, Nt) | 0, I = I + Math.imul(X, bt) | 0, I = I + Math.imul(re, Nt) | 0, F = F + Math.imul(re, bt) | 0, M = M + Math.imul(J, Ft) | 0, I = I + Math.imul(J, rt) | 0, I = I + Math.imul(ee, Ft) | 0, F = F + Math.imul(ee, rt) | 0, M = M + Math.imul(D, $) | 0, I = I + Math.imul(D, z) | 0, I = I + Math.imul(oe, $) | 0, F = F + Math.imul(oe, z) | 0; + var Tt = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, M = Math.imul(ze, lt), I = Math.imul(ze, ct), I = I + Math.imul(_e, lt) | 0, F = Math.imul(_e, ct), M = M + Math.imul(Ke, Jt) | 0, I = I + Math.imul(Ke, Et) | 0, I = I + Math.imul(Le, Jt) | 0, F = F + Math.imul(Le, Et) | 0, M = M + Math.imul($e, Xt) | 0, I = I + Math.imul($e, Dt) | 0, I = I + Math.imul(Me, Xt) | 0, F = F + Math.imul(Me, Dt) | 0, M = M + Math.imul(Pe, Ct) | 0, I = I + Math.imul(Pe, mt) | 0, I = I + Math.imul(De, Ct) | 0, F = F + Math.imul(De, mt) | 0, M = M + Math.imul(ie, Nt) | 0, I = I + Math.imul(ie, bt) | 0, I = I + Math.imul(ue, Nt) | 0, F = F + Math.imul(ue, bt) | 0, M = M + Math.imul(X, Ft) | 0, I = I + Math.imul(X, rt) | 0, I = I + Math.imul(re, Ft) | 0, F = F + Math.imul(re, rt) | 0, M = M + Math.imul(J, $) | 0, I = I + Math.imul(J, z) | 0, I = I + Math.imul(ee, $) | 0, F = F + Math.imul(ee, z) | 0, M = M + Math.imul(D, C) | 0, I = I + Math.imul(D, G) | 0, I = I + Math.imul(oe, C) | 0, F = F + Math.imul(oe, G) | 0; + var At = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, M = Math.imul(at, lt), I = Math.imul(at, ct), I = I + Math.imul(ke, lt) | 0, F = Math.imul(ke, ct), M = M + Math.imul(ze, Jt) | 0, I = I + Math.imul(ze, Et) | 0, I = I + Math.imul(_e, Jt) | 0, F = F + Math.imul(_e, Et) | 0, M = M + Math.imul(Ke, Xt) | 0, I = I + Math.imul(Ke, Dt) | 0, I = I + Math.imul(Le, Xt) | 0, F = F + Math.imul(Le, Dt) | 0, M = M + Math.imul($e, Ct) | 0, I = I + Math.imul($e, mt) | 0, I = I + Math.imul(Me, Ct) | 0, F = F + Math.imul(Me, mt) | 0, M = M + Math.imul(Pe, Nt) | 0, I = I + Math.imul(Pe, bt) | 0, I = I + Math.imul(De, Nt) | 0, F = F + Math.imul(De, bt) | 0, M = M + Math.imul(ie, Ft) | 0, I = I + Math.imul(ie, rt) | 0, I = I + Math.imul(ue, Ft) | 0, F = F + Math.imul(ue, rt) | 0, M = M + Math.imul(X, $) | 0, I = I + Math.imul(X, z) | 0, I = I + Math.imul(re, $) | 0, F = F + Math.imul(re, z) | 0, M = M + Math.imul(J, C) | 0, I = I + Math.imul(J, G) | 0, I = I + Math.imul(ee, C) | 0, F = F + Math.imul(ee, G) | 0, M = M + Math.imul(D, se) | 0, I = I + Math.imul(D, de) | 0, I = I + Math.imul(oe, se) | 0, F = F + Math.imul(oe, de) | 0; + var _t = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, M = Math.imul(tt, lt), I = Math.imul(tt, ct), I = I + Math.imul(Ye, lt) | 0, F = Math.imul(Ye, ct), M = M + Math.imul(at, Jt) | 0, I = I + Math.imul(at, Et) | 0, I = I + Math.imul(ke, Jt) | 0, F = F + Math.imul(ke, Et) | 0, M = M + Math.imul(ze, Xt) | 0, I = I + Math.imul(ze, Dt) | 0, I = I + Math.imul(_e, Xt) | 0, F = F + Math.imul(_e, Dt) | 0, M = M + Math.imul(Ke, Ct) | 0, I = I + Math.imul(Ke, mt) | 0, I = I + Math.imul(Le, Ct) | 0, F = F + Math.imul(Le, mt) | 0, M = M + Math.imul($e, Nt) | 0, I = I + Math.imul($e, bt) | 0, I = I + Math.imul(Me, Nt) | 0, F = F + Math.imul(Me, bt) | 0, M = M + Math.imul(Pe, Ft) | 0, I = I + Math.imul(Pe, rt) | 0, I = I + Math.imul(De, Ft) | 0, F = F + Math.imul(De, rt) | 0, M = M + Math.imul(ie, $) | 0, I = I + Math.imul(ie, z) | 0, I = I + Math.imul(ue, $) | 0, F = F + Math.imul(ue, z) | 0, M = M + Math.imul(X, C) | 0, I = I + Math.imul(X, G) | 0, I = I + Math.imul(re, C) | 0, F = F + Math.imul(re, G) | 0, M = M + Math.imul(J, se) | 0, I = I + Math.imul(J, de) | 0, I = I + Math.imul(ee, se) | 0, F = F + Math.imul(ee, de) | 0, M = M + Math.imul(D, Te) | 0, I = I + Math.imul(D, Re) | 0, I = I + Math.imul(oe, Te) | 0, F = F + Math.imul(oe, Re) | 0; + var ht = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, M = Math.imul(tt, Jt), I = Math.imul(tt, Et), I = I + Math.imul(Ye, Jt) | 0, F = Math.imul(Ye, Et), M = M + Math.imul(at, Xt) | 0, I = I + Math.imul(at, Dt) | 0, I = I + Math.imul(ke, Xt) | 0, F = F + Math.imul(ke, Dt) | 0, M = M + Math.imul(ze, Ct) | 0, I = I + Math.imul(ze, mt) | 0, I = I + Math.imul(_e, Ct) | 0, F = F + Math.imul(_e, mt) | 0, M = M + Math.imul(Ke, Nt) | 0, I = I + Math.imul(Ke, bt) | 0, I = I + Math.imul(Le, Nt) | 0, F = F + Math.imul(Le, bt) | 0, M = M + Math.imul($e, Ft) | 0, I = I + Math.imul($e, rt) | 0, I = I + Math.imul(Me, Ft) | 0, F = F + Math.imul(Me, rt) | 0, M = M + Math.imul(Pe, $) | 0, I = I + Math.imul(Pe, z) | 0, I = I + Math.imul(De, $) | 0, F = F + Math.imul(De, z) | 0, M = M + Math.imul(ie, C) | 0, I = I + Math.imul(ie, G) | 0, I = I + Math.imul(ue, C) | 0, F = F + Math.imul(ue, G) | 0, M = M + Math.imul(X, se) | 0, I = I + Math.imul(X, de) | 0, I = I + Math.imul(re, se) | 0, F = F + Math.imul(re, de) | 0, M = M + Math.imul(J, Te) | 0, I = I + Math.imul(J, Re) | 0, I = I + Math.imul(ee, Te) | 0, F = F + Math.imul(ee, Re) | 0; + var xt = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, M = Math.imul(tt, Xt), I = Math.imul(tt, Dt), I = I + Math.imul(Ye, Xt) | 0, F = Math.imul(Ye, Dt), M = M + Math.imul(at, Ct) | 0, I = I + Math.imul(at, mt) | 0, I = I + Math.imul(ke, Ct) | 0, F = F + Math.imul(ke, mt) | 0, M = M + Math.imul(ze, Nt) | 0, I = I + Math.imul(ze, bt) | 0, I = I + Math.imul(_e, Nt) | 0, F = F + Math.imul(_e, bt) | 0, M = M + Math.imul(Ke, Ft) | 0, I = I + Math.imul(Ke, rt) | 0, I = I + Math.imul(Le, Ft) | 0, F = F + Math.imul(Le, rt) | 0, M = M + Math.imul($e, $) | 0, I = I + Math.imul($e, z) | 0, I = I + Math.imul(Me, $) | 0, F = F + Math.imul(Me, z) | 0, M = M + Math.imul(Pe, C) | 0, I = I + Math.imul(Pe, G) | 0, I = I + Math.imul(De, C) | 0, F = F + Math.imul(De, G) | 0, M = M + Math.imul(ie, se) | 0, I = I + Math.imul(ie, de) | 0, I = I + Math.imul(ue, se) | 0, F = F + Math.imul(ue, de) | 0, M = M + Math.imul(X, Te) | 0, I = I + Math.imul(X, Re) | 0, I = I + Math.imul(re, Te) | 0, F = F + Math.imul(re, Re) | 0; + var st = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, M = Math.imul(tt, Ct), I = Math.imul(tt, mt), I = I + Math.imul(Ye, Ct) | 0, F = Math.imul(Ye, mt), M = M + Math.imul(at, Nt) | 0, I = I + Math.imul(at, bt) | 0, I = I + Math.imul(ke, Nt) | 0, F = F + Math.imul(ke, bt) | 0, M = M + Math.imul(ze, Ft) | 0, I = I + Math.imul(ze, rt) | 0, I = I + Math.imul(_e, Ft) | 0, F = F + Math.imul(_e, rt) | 0, M = M + Math.imul(Ke, $) | 0, I = I + Math.imul(Ke, z) | 0, I = I + Math.imul(Le, $) | 0, F = F + Math.imul(Le, z) | 0, M = M + Math.imul($e, C) | 0, I = I + Math.imul($e, G) | 0, I = I + Math.imul(Me, C) | 0, F = F + Math.imul(Me, G) | 0, M = M + Math.imul(Pe, se) | 0, I = I + Math.imul(Pe, de) | 0, I = I + Math.imul(De, se) | 0, F = F + Math.imul(De, de) | 0, M = M + Math.imul(ie, Te) | 0, I = I + Math.imul(ie, Re) | 0, I = I + Math.imul(ue, Te) | 0, F = F + Math.imul(ue, Re) | 0; + var yt = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (yt >>> 26) | 0, yt &= 67108863, M = Math.imul(tt, Nt), I = Math.imul(tt, bt), I = I + Math.imul(Ye, Nt) | 0, F = Math.imul(Ye, bt), M = M + Math.imul(at, Ft) | 0, I = I + Math.imul(at, rt) | 0, I = I + Math.imul(ke, Ft) | 0, F = F + Math.imul(ke, rt) | 0, M = M + Math.imul(ze, $) | 0, I = I + Math.imul(ze, z) | 0, I = I + Math.imul(_e, $) | 0, F = F + Math.imul(_e, z) | 0, M = M + Math.imul(Ke, C) | 0, I = I + Math.imul(Ke, G) | 0, I = I + Math.imul(Le, C) | 0, F = F + Math.imul(Le, G) | 0, M = M + Math.imul($e, se) | 0, I = I + Math.imul($e, de) | 0, I = I + Math.imul(Me, se) | 0, F = F + Math.imul(Me, de) | 0, M = M + Math.imul(Pe, Te) | 0, I = I + Math.imul(Pe, Re) | 0, I = I + Math.imul(De, Te) | 0, F = F + Math.imul(De, Re) | 0; + var ut = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, M = Math.imul(tt, Ft), I = Math.imul(tt, rt), I = I + Math.imul(Ye, Ft) | 0, F = Math.imul(Ye, rt), M = M + Math.imul(at, $) | 0, I = I + Math.imul(at, z) | 0, I = I + Math.imul(ke, $) | 0, F = F + Math.imul(ke, z) | 0, M = M + Math.imul(ze, C) | 0, I = I + Math.imul(ze, G) | 0, I = I + Math.imul(_e, C) | 0, F = F + Math.imul(_e, G) | 0, M = M + Math.imul(Ke, se) | 0, I = I + Math.imul(Ke, de) | 0, I = I + Math.imul(Le, se) | 0, F = F + Math.imul(Le, de) | 0, M = M + Math.imul($e, Te) | 0, I = I + Math.imul($e, Re) | 0, I = I + Math.imul(Me, Te) | 0, F = F + Math.imul(Me, Re) | 0; + var ot = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, M = Math.imul(tt, $), I = Math.imul(tt, z), I = I + Math.imul(Ye, $) | 0, F = Math.imul(Ye, z), M = M + Math.imul(at, C) | 0, I = I + Math.imul(at, G) | 0, I = I + Math.imul(ke, C) | 0, F = F + Math.imul(ke, G) | 0, M = M + Math.imul(ze, se) | 0, I = I + Math.imul(ze, de) | 0, I = I + Math.imul(_e, se) | 0, F = F + Math.imul(_e, de) | 0, M = M + Math.imul(Ke, Te) | 0, I = I + Math.imul(Ke, Re) | 0, I = I + Math.imul(Le, Te) | 0, F = F + Math.imul(Le, Re) | 0; + var Se = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, M = Math.imul(tt, C), I = Math.imul(tt, G), I = I + Math.imul(Ye, C) | 0, F = Math.imul(Ye, G), M = M + Math.imul(at, se) | 0, I = I + Math.imul(at, de) | 0, I = I + Math.imul(ke, se) | 0, F = F + Math.imul(ke, de) | 0, M = M + Math.imul(ze, Te) | 0, I = I + Math.imul(ze, Re) | 0, I = I + Math.imul(_e, Te) | 0, F = F + Math.imul(_e, Re) | 0; + var Ae = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, M = Math.imul(tt, se), I = Math.imul(tt, de), I = I + Math.imul(Ye, se) | 0, F = Math.imul(Ye, de), M = M + Math.imul(at, Te) | 0, I = I + Math.imul(at, Re) | 0, I = I + Math.imul(ke, Te) | 0, F = F + Math.imul(ke, Re) | 0; + var Ve = (v + M | 0) + ((I & 8191) << 13) | 0; + v = (F + (I >>> 13) | 0) + (Ve >>> 26) | 0, Ve &= 67108863, M = Math.imul(tt, Te), I = Math.imul(tt, Re), I = I + Math.imul(Ye, Te) | 0, F = Math.imul(Ye, Re); + var Fe = (v + M | 0) + ((I & 8191) << 13) | 0; + return v = (F + (I >>> 13) | 0) + (Fe >>> 26) | 0, Fe &= 67108863, S[0] = nt, S[1] = je, S[2] = pt, S[3] = it, S[4] = et, S[5] = St, S[6] = Tt, S[7] = At, S[8] = _t, S[9] = ht, S[10] = xt, S[11] = st, S[12] = yt, S[13] = ut, S[14] = ot, S[15] = Se, S[16] = Ae, S[17] = Ve, S[18] = Fe, v !== 0 && (S[19] = v, b.length++), b; }; - Math.imul || ($ = B); - function H(m, f, g) { + Math.imul || (k = B); + function q(m, f, g) { g.negative = f.negative ^ m.negative, g.length = m.length + f.length; - for (var b = 0, x = 0, _ = 0; _ < g.length - 1; _++) { - var E = x; + for (var b = 0, x = 0, E = 0; E < g.length - 1; E++) { + var S = x; x = 0; - for (var v = b & 67108863, P = Math.min(_, f.length - 1), I = Math.max(0, _ - m.length + 1); I <= P; I++) { - var F = _ - I, ce = m.words[F] | 0, D = f.words[I] | 0, oe = ce * D, Z = oe & 67108863; - E = E + (oe / 67108864 | 0) | 0, Z = Z + v | 0, v = Z & 67108863, E = E + (Z >>> 26) | 0, x += E >>> 26, E &= 67108863; + for (var v = b & 67108863, M = Math.min(E, f.length - 1), I = Math.max(0, E - m.length + 1); I <= M; I++) { + var F = E - I, ce = m.words[F] | 0, D = f.words[I] | 0, oe = ce * D, Z = oe & 67108863; + S = S + (oe / 67108864 | 0) | 0, Z = Z + v | 0, v = Z & 67108863, S = S + (Z >>> 26) | 0, x += S >>> 26, S &= 67108863; } - g.words[_] = v, b = E, E = x; + g.words[E] = v, b = S, S = x; } - return b !== 0 ? g.words[_] = b : g.length--, g._strip(); + return b !== 0 ? g.words[E] = b : g.length--, g._strip(); } function U(m, f, g) { - return H(m, f, g); + return q(m, f, g); } s.prototype.mulTo = function(f, g) { var b, x = this.length + f.length; - return this.length === 10 && f.length === 10 ? b = $(this, f, g) : x < 63 ? b = B(this, f, g) : x < 1024 ? b = H(this, f, g) : b = U(this, f, g), b; + return this.length === 10 && f.length === 10 ? b = k(this, f, g) : x < 63 ? b = B(this, f, g) : x < 1024 ? b = q(this, f, g) : b = U(this, f, g), b; }, s.prototype.mul = function(f) { var g = new s(null); return g.words = new Array(this.length + f.length), this.mulTo(f, g); @@ -9472,8 +9984,8 @@ Wv.exports; var g = f < 0; g && (f = -f), n(typeof f == "number"), n(f < 67108864); for (var b = 0, x = 0; x < this.length; x++) { - var _ = (this.words[x] | 0) * f, E = (_ & 67108863) + (b & 67108863); - b >>= 26, b += _ / 67108864 | 0, b += E >>> 26, this.words[x] = E & 67108863; + var E = (this.words[x] | 0) * f, S = (E & 67108863) + (b & 67108863); + b >>= 26, b += E / 67108864 | 0, b += S >>> 26, this.words[x] = S & 67108863; } return b !== 0 && (this.words[x] = b, this.length++), g ? this.ineg() : this; }, s.prototype.muln = function(f) { @@ -9488,25 +10000,25 @@ Wv.exports; for (var b = this, x = 0; x < g.length && g[x] === 0; x++, b = b.sqr()) ; if (++x < g.length) - for (var _ = b.sqr(); x < g.length; x++, _ = _.sqr()) - g[x] !== 0 && (b = b.mul(_)); + for (var E = b.sqr(); x < g.length; x++, E = E.sqr()) + g[x] !== 0 && (b = b.mul(E)); return b; }, s.prototype.iushln = function(f) { n(typeof f == "number" && f >= 0); - var g = f % 26, b = (f - g) / 26, x = 67108863 >>> 26 - g << 26 - g, _; + var g = f % 26, b = (f - g) / 26, x = 67108863 >>> 26 - g << 26 - g, E; if (g !== 0) { - var E = 0; - for (_ = 0; _ < this.length; _++) { - var v = this.words[_] & x, P = (this.words[_] | 0) - v << g; - this.words[_] = P | E, E = v >>> 26 - g; + var S = 0; + for (E = 0; E < this.length; E++) { + var v = this.words[E] & x, M = (this.words[E] | 0) - v << g; + this.words[E] = M | S, S = v >>> 26 - g; } - E && (this.words[_] = E, this.length++); + S && (this.words[E] = S, this.length++); } if (b !== 0) { - for (_ = this.length - 1; _ >= 0; _--) - this.words[_ + b] = this.words[_]; - for (_ = 0; _ < b; _++) - this.words[_] = 0; + for (E = this.length - 1; E >= 0; E--) + this.words[E + b] = this.words[E]; + for (E = 0; E < b; E++) + this.words[E] = 0; this.length += b; } return this._strip(); @@ -9516,23 +10028,23 @@ Wv.exports; n(typeof f == "number" && f >= 0); var x; g ? x = (g - g % 26) / 26 : x = 0; - var _ = f % 26, E = Math.min((f - _) / 26, this.length), v = 67108863 ^ 67108863 >>> _ << _, P = b; - if (x -= E, x = Math.max(0, x), P) { - for (var I = 0; I < E; I++) - P.words[I] = this.words[I]; - P.length = E; - } - if (E !== 0) if (this.length > E) - for (this.length -= E, I = 0; I < this.length; I++) - this.words[I] = this.words[I + E]; + var E = f % 26, S = Math.min((f - E) / 26, this.length), v = 67108863 ^ 67108863 >>> E << E, M = b; + if (x -= S, x = Math.max(0, x), M) { + for (var I = 0; I < S; I++) + M.words[I] = this.words[I]; + M.length = S; + } + if (S !== 0) if (this.length > S) + for (this.length -= S, I = 0; I < this.length; I++) + this.words[I] = this.words[I + S]; else this.words[0] = 0, this.length = 1; var F = 0; for (I = this.length - 1; I >= 0 && (F !== 0 || I >= x); I--) { var ce = this.words[I] | 0; - this.words[I] = F << 26 - _ | ce >>> _, F = ce & v; + this.words[I] = F << 26 - E | ce >>> E, F = ce & v; } - return P && F !== 0 && (P.words[P.length++] = F), this.length === 0 && (this.words[0] = 0, this.length = 1), this._strip(); + return M && F !== 0 && (M.words[M.length++] = F), this.length === 0 && (this.words[0] = 0, this.length = 1), this._strip(); }, s.prototype.ishrn = function(f, g, b) { return n(this.negative === 0), this.iushrn(f, g, b); }, s.prototype.shln = function(f) { @@ -9547,8 +10059,8 @@ Wv.exports; n(typeof f == "number" && f >= 0); var g = f % 26, b = (f - g) / 26, x = 1 << g; if (this.length <= b) return !1; - var _ = this.words[b]; - return !!(_ & x); + var E = this.words[b]; + return !!(E & x); }, s.prototype.imaskn = function(f) { n(typeof f == "number" && f >= 0); var g = f % 26, b = (f - g) / 26; @@ -9587,35 +10099,35 @@ Wv.exports; }, s.prototype.abs = function() { return this.clone().iabs(); }, s.prototype._ishlnsubmul = function(f, g, b) { - var x = f.length + b, _; + var x = f.length + b, E; this._expand(x); - var E, v = 0; - for (_ = 0; _ < f.length; _++) { - E = (this.words[_ + b] | 0) + v; - var P = (f.words[_] | 0) * g; - E -= P & 67108863, v = (E >> 26) - (P / 67108864 | 0), this.words[_ + b] = E & 67108863; - } - for (; _ < this.length - b; _++) - E = (this.words[_ + b] | 0) + v, v = E >> 26, this.words[_ + b] = E & 67108863; + var S, v = 0; + for (E = 0; E < f.length; E++) { + S = (this.words[E + b] | 0) + v; + var M = (f.words[E] | 0) * g; + S -= M & 67108863, v = (S >> 26) - (M / 67108864 | 0), this.words[E + b] = S & 67108863; + } + for (; E < this.length - b; E++) + S = (this.words[E + b] | 0) + v, v = S >> 26, this.words[E + b] = S & 67108863; if (v === 0) return this._strip(); - for (n(v === -1), v = 0, _ = 0; _ < this.length; _++) - E = -(this.words[_] | 0) + v, v = E >> 26, this.words[_] = E & 67108863; + for (n(v === -1), v = 0, E = 0; E < this.length; E++) + S = -(this.words[E] | 0) + v, v = S >> 26, this.words[E] = S & 67108863; return this.negative = 1, this._strip(); }, s.prototype._wordDiv = function(f, g) { - var b = this.length - f.length, x = this.clone(), _ = f, E = _.words[_.length - 1] | 0, v = this._countBits(E); - b = 26 - v, b !== 0 && (_ = _.ushln(b), x.iushln(b), E = _.words[_.length - 1] | 0); - var P = x.length - _.length, I; + var b = this.length - f.length, x = this.clone(), E = f, S = E.words[E.length - 1] | 0, v = this._countBits(S); + b = 26 - v, b !== 0 && (E = E.ushln(b), x.iushln(b), S = E.words[E.length - 1] | 0); + var M = x.length - E.length, I; if (g !== "mod") { - I = new s(null), I.length = P + 1, I.words = new Array(I.length); + I = new s(null), I.length = M + 1, I.words = new Array(I.length); for (var F = 0; F < I.length; F++) I.words[F] = 0; } - var ce = x.clone()._ishlnsubmul(_, 1, P); - ce.negative === 0 && (x = ce, I && (I.words[P] = 1)); - for (var D = P - 1; D >= 0; D--) { - var oe = (x.words[_.length + D] | 0) * 67108864 + (x.words[_.length + D - 1] | 0); - for (oe = Math.min(oe / E | 0, 67108863), x._ishlnsubmul(_, oe, D); x.negative !== 0; ) - oe--, x.negative = 0, x._ishlnsubmul(_, 1, D), x.isZero() || (x.negative ^= 1); + var ce = x.clone()._ishlnsubmul(E, 1, M); + ce.negative === 0 && (x = ce, I && (I.words[M] = 1)); + for (var D = M - 1; D >= 0; D--) { + var oe = (x.words[E.length + D] | 0) * 67108864 + (x.words[E.length + D - 1] | 0); + for (oe = Math.min(oe / S | 0, 67108863), x._ishlnsubmul(E, oe, D); x.negative !== 0; ) + oe--, x.negative = 0, x._ishlnsubmul(E, 1, D), x.isZero() || (x.negative ^= 1); I && (I.words[D] = oe); } return I && I._strip(), x._strip(), g !== "div" && b !== 0 && x.iushrn(b), { @@ -9628,16 +10140,16 @@ Wv.exports; div: new s(0), mod: new s(0) }; - var x, _, E; - return this.negative !== 0 && f.negative === 0 ? (E = this.neg().divmod(f, g), g !== "mod" && (x = E.div.neg()), g !== "div" && (_ = E.mod.neg(), b && _.negative !== 0 && _.iadd(f)), { + var x, E, S; + return this.negative !== 0 && f.negative === 0 ? (S = this.neg().divmod(f, g), g !== "mod" && (x = S.div.neg()), g !== "div" && (E = S.mod.neg(), b && E.negative !== 0 && E.iadd(f)), { div: x, - mod: _ - }) : this.negative === 0 && f.negative !== 0 ? (E = this.divmod(f.neg(), g), g !== "mod" && (x = E.div.neg()), { + mod: E + }) : this.negative === 0 && f.negative !== 0 ? (S = this.divmod(f.neg(), g), g !== "mod" && (x = S.div.neg()), { div: x, - mod: E.mod - }) : this.negative & f.negative ? (E = this.neg().divmod(f.neg(), g), g !== "div" && (_ = E.mod.neg(), b && _.negative !== 0 && _.isub(f)), { - div: E.div, - mod: _ + mod: S.mod + }) : this.negative & f.negative ? (S = this.neg().divmod(f.neg(), g), g !== "div" && (E = S.mod.neg(), b && E.negative !== 0 && E.isub(f)), { + div: S.div, + mod: E }) : f.length > this.length || this.cmp(f) < 0 ? { div: new s(0), mod: this @@ -9660,13 +10172,13 @@ Wv.exports; }, s.prototype.divRound = function(f) { var g = this.divmod(f); if (g.mod.isZero()) return g.div; - var b = g.div.negative !== 0 ? g.mod.isub(f) : g.mod, x = f.ushrn(1), _ = f.andln(1), E = b.cmp(x); - return E < 0 || _ === 1 && E === 0 ? g.div : g.div.negative !== 0 ? g.div.isubn(1) : g.div.iaddn(1); + var b = g.div.negative !== 0 ? g.mod.isub(f) : g.mod, x = f.ushrn(1), E = f.andln(1), S = b.cmp(x); + return S < 0 || E === 1 && S === 0 ? g.div : g.div.negative !== 0 ? g.div.isubn(1) : g.div.iaddn(1); }, s.prototype.modrn = function(f) { var g = f < 0; g && (f = -f), n(f <= 67108863); - for (var b = (1 << 26) % f, x = 0, _ = this.length - 1; _ >= 0; _--) - x = (b * x + (this.words[_] | 0)) % f; + for (var b = (1 << 26) % f, x = 0, E = this.length - 1; E >= 0; E--) + x = (b * x + (this.words[E] | 0)) % f; return g ? -x : x; }, s.prototype.modn = function(f) { return this.modrn(f); @@ -9674,8 +10186,8 @@ Wv.exports; var g = f < 0; g && (f = -f), n(f <= 67108863); for (var b = 0, x = this.length - 1; x >= 0; x--) { - var _ = (this.words[x] | 0) + b * 67108864; - this.words[x] = _ / f | 0, b = _ % f; + var E = (this.words[x] | 0) + b * 67108864; + this.words[x] = E / f | 0, b = E % f; } return this._strip(), g ? this.ineg() : this; }, s.prototype.divn = function(f) { @@ -9684,41 +10196,41 @@ Wv.exports; n(f.negative === 0), n(!f.isZero()); var g = this, b = f.clone(); g.negative !== 0 ? g = g.umod(f) : g = g.clone(); - for (var x = new s(1), _ = new s(0), E = new s(0), v = new s(1), P = 0; g.isEven() && b.isEven(); ) - g.iushrn(1), b.iushrn(1), ++P; + for (var x = new s(1), E = new s(0), S = new s(0), v = new s(1), M = 0; g.isEven() && b.isEven(); ) + g.iushrn(1), b.iushrn(1), ++M; for (var I = b.clone(), F = g.clone(); !g.isZero(); ) { for (var ce = 0, D = 1; !(g.words[0] & D) && ce < 26; ++ce, D <<= 1) ; if (ce > 0) for (g.iushrn(ce); ce-- > 0; ) - (x.isOdd() || _.isOdd()) && (x.iadd(I), _.isub(F)), x.iushrn(1), _.iushrn(1); + (x.isOdd() || E.isOdd()) && (x.iadd(I), E.isub(F)), x.iushrn(1), E.iushrn(1); for (var oe = 0, Z = 1; !(b.words[0] & Z) && oe < 26; ++oe, Z <<= 1) ; if (oe > 0) for (b.iushrn(oe); oe-- > 0; ) - (E.isOdd() || v.isOdd()) && (E.iadd(I), v.isub(F)), E.iushrn(1), v.iushrn(1); - g.cmp(b) >= 0 ? (g.isub(b), x.isub(E), _.isub(v)) : (b.isub(g), E.isub(x), v.isub(_)); + (S.isOdd() || v.isOdd()) && (S.iadd(I), v.isub(F)), S.iushrn(1), v.iushrn(1); + g.cmp(b) >= 0 ? (g.isub(b), x.isub(S), E.isub(v)) : (b.isub(g), S.isub(x), v.isub(E)); } return { - a: E, + a: S, b: v, - gcd: b.iushln(P) + gcd: b.iushln(M) }; }, s.prototype._invmp = function(f) { n(f.negative === 0), n(!f.isZero()); var g = this, b = f.clone(); g.negative !== 0 ? g = g.umod(f) : g = g.clone(); - for (var x = new s(1), _ = new s(0), E = b.clone(); g.cmpn(1) > 0 && b.cmpn(1) > 0; ) { - for (var v = 0, P = 1; !(g.words[0] & P) && v < 26; ++v, P <<= 1) ; + for (var x = new s(1), E = new s(0), S = b.clone(); g.cmpn(1) > 0 && b.cmpn(1) > 0; ) { + for (var v = 0, M = 1; !(g.words[0] & M) && v < 26; ++v, M <<= 1) ; if (v > 0) for (g.iushrn(v); v-- > 0; ) - x.isOdd() && x.iadd(E), x.iushrn(1); + x.isOdd() && x.iadd(S), x.iushrn(1); for (var I = 0, F = 1; !(b.words[0] & F) && I < 26; ++I, F <<= 1) ; if (I > 0) for (b.iushrn(I); I-- > 0; ) - _.isOdd() && _.iadd(E), _.iushrn(1); - g.cmp(b) >= 0 ? (g.isub(b), x.isub(_)) : (b.isub(g), _.isub(x)); + E.isOdd() && E.iadd(S), E.iushrn(1); + g.cmp(b) >= 0 ? (g.isub(b), x.isub(E)) : (b.isub(g), E.isub(x)); } var ce; - return g.cmpn(1) === 0 ? ce = x : ce = _, ce.cmpn(0) < 0 && ce.iadd(f), ce; + return g.cmpn(1) === 0 ? ce = x : ce = E, ce.cmpn(0) < 0 && ce.iadd(f), ce; }, s.prototype.gcd = function(f) { if (this.isZero()) return f.abs(); if (f.isZero()) return this.abs(); @@ -9731,11 +10243,11 @@ Wv.exports; g.iushrn(1); for (; b.isEven(); ) b.iushrn(1); - var _ = g.cmp(b); - if (_ < 0) { - var E = g; - g = b, b = E; - } else if (_ === 0 || b.cmpn(1) === 0) + var E = g.cmp(b); + if (E < 0) { + var S = g; + g = b, b = S; + } else if (E === 0 || b.cmpn(1) === 0) break; g.isub(b); } while (!0); @@ -9753,11 +10265,11 @@ Wv.exports; var g = f % 26, b = (f - g) / 26, x = 1 << g; if (this.length <= b) return this._expand(b + 1), this.words[b] |= x, this; - for (var _ = x, E = b; _ !== 0 && E < this.length; E++) { - var v = this.words[E] | 0; - v += _, _ = v >>> 26, v &= 67108863, this.words[E] = v; + for (var E = x, S = b; E !== 0 && S < this.length; S++) { + var v = this.words[S] | 0; + v += E, E = v >>> 26, v &= 67108863, this.words[S] = v; } - return _ !== 0 && (this.words[E] = _, this.length++), this; + return E !== 0 && (this.words[S] = E, this.length++), this; }, s.prototype.isZero = function() { return this.length === 1 && this.words[0] === 0; }, s.prototype.cmpn = function(f) { @@ -9783,9 +10295,9 @@ Wv.exports; if (this.length > f.length) return 1; if (this.length < f.length) return -1; for (var g = 0, b = this.length - 1; b >= 0; b--) { - var x = this.words[b] | 0, _ = f.words[b] | 0; - if (x !== _) { - x < _ ? g = -1 : x > _ && (g = 1); + var x = this.words[b] | 0, E = f.words[b] | 0; + if (x !== E) { + x < E ? g = -1 : x > E && (g = 1); break; } } @@ -9853,44 +10365,44 @@ Wv.exports; p192: null, p25519: null }; - function te(m, f) { + function Q(m, f) { this.name = m, this.p = new s(f, 16), this.n = this.p.bitLength(), this.k = new s(1).iushln(this.n).isub(this.p), this.tmp = this._tmp(); } - te.prototype._tmp = function() { + Q.prototype._tmp = function() { var f = new s(null); return f.words = new Array(Math.ceil(this.n / 13)), f; - }, te.prototype.ireduce = function(f) { + }, Q.prototype.ireduce = function(f) { var g = f, b; do this.split(g, this.tmp), g = this.imulK(g), g = g.iadd(this.tmp), b = g.bitLength(); while (b > this.n); var x = b < this.n ? -1 : g.ucmp(this.p); return x === 0 ? (g.words[0] = 0, g.length = 1) : x > 0 ? g.isub(this.p) : g.strip !== void 0 ? g.strip() : g._strip(), g; - }, te.prototype.split = function(f, g) { + }, Q.prototype.split = function(f, g) { f.iushrn(this.n, 0, g); - }, te.prototype.imulK = function(f) { + }, Q.prototype.imulK = function(f) { return f.imul(this.k); }; function R() { - te.call( + Q.call( this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f" ); } - i(R, te), R.prototype.split = function(f, g) { - for (var b = 4194303, x = Math.min(f.length, 9), _ = 0; _ < x; _++) - g.words[_] = f.words[_]; + i(R, Q), R.prototype.split = function(f, g) { + for (var b = 4194303, x = Math.min(f.length, 9), E = 0; E < x; E++) + g.words[E] = f.words[E]; if (g.length = x, f.length <= 9) { f.words[0] = 0, f.length = 1; return; } - var E = f.words[9]; - for (g.words[g.length++] = E & b, _ = 10; _ < f.length; _++) { - var v = f.words[_] | 0; - f.words[_ - 10] = (v & b) << 4 | E >>> 22, E = v; + var S = f.words[9]; + for (g.words[g.length++] = S & b, E = 10; E < f.length; E++) { + var v = f.words[E] | 0; + f.words[E - 10] = (v & b) << 4 | S >>> 22, S = v; } - E >>>= 22, f.words[_ - 10] = E, E === 0 && f.length > 10 ? f.length -= 10 : f.length -= 9; + S >>>= 22, f.words[E - 10] = S, S === 0 && f.length > 10 ? f.length -= 10 : f.length -= 9; }, R.prototype.imulK = function(f) { f.words[f.length] = 0, f.words[f.length + 1] = 0, f.length += 2; for (var g = 0, b = 0; b < f.length; b++) { @@ -9900,32 +10412,32 @@ Wv.exports; return f.words[f.length - 1] === 0 && (f.length--, f.words[f.length - 1] === 0 && f.length--), f; }; function K() { - te.call( + Q.call( this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001" ); } - i(K, te); + i(K, Q); function ge() { - te.call( + Q.call( this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff" ); } - i(ge, te); + i(ge, Q); function Ee() { - te.call( + Q.call( this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed" ); } - i(Ee, te), Ee.prototype.imulK = function(f) { + i(Ee, Q), Ee.prototype.imulK = function(f) { for (var g = 0, b = 0; b < f.length; b++) { - var x = (f.words[b] | 0) * 19 + g, _ = x & 67108863; - x >>>= 26, f.words[b] = _, g = x; + var x = (f.words[b] | 0) * 19 + g, E = x & 67108863; + x >>>= 26, f.words[b] = E, g = x; } return g !== 0 && (f.words[f.length++] = g), f; }, s._prime = function(f) { @@ -9994,18 +10506,18 @@ Wv.exports; var b = this.m.add(new s(1)).iushrn(2); return this.pow(f, b); } - for (var x = this.m.subn(1), _ = 0; !x.isZero() && x.andln(1) === 0; ) - _++, x.iushrn(1); + for (var x = this.m.subn(1), E = 0; !x.isZero() && x.andln(1) === 0; ) + E++, x.iushrn(1); n(!x.isZero()); - var E = new s(1).toRed(this), v = E.redNeg(), P = this.m.subn(1).iushrn(1), I = this.m.bitLength(); - for (I = new s(2 * I * I).toRed(this); this.pow(I, P).cmp(v) !== 0; ) + var S = new s(1).toRed(this), v = S.redNeg(), M = this.m.subn(1).iushrn(1), I = this.m.bitLength(); + for (I = new s(2 * I * I).toRed(this); this.pow(I, M).cmp(v) !== 0; ) I.redIAdd(v); - for (var F = this.pow(I, x), ce = this.pow(f, x.addn(1).iushrn(1)), D = this.pow(f, x), oe = _; D.cmp(E) !== 0; ) { - for (var Z = D, J = 0; Z.cmp(E) !== 0; J++) + for (var F = this.pow(I, x), ce = this.pow(f, x.addn(1).iushrn(1)), D = this.pow(f, x), oe = E; D.cmp(S) !== 0; ) { + for (var Z = D, J = 0; Z.cmp(S) !== 0; J++) Z = Z.redSqr(); n(J < oe); - var Q = this.pow(F, new s(1).iushln(oe - J - 1)); - ce = ce.redMul(Q), F = Q.redSqr(), D = D.redMul(F), oe = J; + var ee = this.pow(F, new s(1).iushln(oe - J - 1)); + ce = ce.redMul(ee), F = ee.redSqr(), D = D.redMul(F), oe = J; } return ce; }, Y.prototype.invm = function(f) { @@ -10016,21 +10528,21 @@ Wv.exports; if (g.cmpn(1) === 0) return f.clone(); var b = 4, x = new Array(1 << b); x[0] = new s(1).toRed(this), x[1] = f; - for (var _ = 2; _ < x.length; _++) - x[_] = this.mul(x[_ - 1], f); - var E = x[0], v = 0, P = 0, I = g.bitLength() % 26; - for (I === 0 && (I = 26), _ = g.length - 1; _ >= 0; _--) { - for (var F = g.words[_], ce = I - 1; ce >= 0; ce--) { + for (var E = 2; E < x.length; E++) + x[E] = this.mul(x[E - 1], f); + var S = x[0], v = 0, M = 0, I = g.bitLength() % 26; + for (I === 0 && (I = 26), E = g.length - 1; E >= 0; E--) { + for (var F = g.words[E], ce = I - 1; ce >= 0; ce--) { var D = F >> ce & 1; - if (E !== x[0] && (E = this.sqr(E)), D === 0 && v === 0) { - P = 0; + if (S !== x[0] && (S = this.sqr(S)), D === 0 && v === 0) { + M = 0; continue; } - v <<= 1, v |= D, P++, !(P !== b && (_ !== 0 || ce !== 0)) && (E = this.mul(E, x[v]), P = 0, v = 0); + v <<= 1, v |= D, M++, !(M !== b && (E !== 0 || ce !== 0)) && (S = this.mul(S, x[v]), M = 0, v = 0); } I = 26; } - return E; + return S; }, Y.prototype.convertTo = function(f) { var g = f.umod(this.m); return g === f ? g.clone() : g; @@ -10038,48 +10550,48 @@ Wv.exports; var g = f.clone(); return g.red = null, g; }, s.mont = function(f) { - return new S(f); + return new A(f); }; - function S(m) { + function A(m) { Y.call(this, m), this.shift = this.m.bitLength(), this.shift % 26 !== 0 && (this.shift += 26 - this.shift % 26), this.r = new s(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this.rinv = this.r._invmp(this.m), this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv = this.minv.umod(this.r), this.minv = this.r.sub(this.minv); } - i(S, Y), S.prototype.convertTo = function(f) { + i(A, Y), A.prototype.convertTo = function(f) { return this.imod(f.ushln(this.shift)); - }, S.prototype.convertFrom = function(f) { + }, A.prototype.convertFrom = function(f) { var g = this.imod(f.mul(this.rinv)); return g.red = null, g; - }, S.prototype.imul = function(f, g) { + }, A.prototype.imul = function(f, g) { if (f.isZero() || g.isZero()) return f.words[0] = 0, f.length = 1, f; - var b = f.imul(g), x = b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), _ = b.isub(x).iushrn(this.shift), E = _; - return _.cmp(this.m) >= 0 ? E = _.isub(this.m) : _.cmpn(0) < 0 && (E = _.iadd(this.m)), E._forceRed(this); - }, S.prototype.mul = function(f, g) { + var b = f.imul(g), x = b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), E = b.isub(x).iushrn(this.shift), S = E; + return E.cmp(this.m) >= 0 ? S = E.isub(this.m) : E.cmpn(0) < 0 && (S = E.iadd(this.m)), S._forceRed(this); + }, A.prototype.mul = function(f, g) { if (f.isZero() || g.isZero()) return new s(0)._forceRed(this); - var b = f.mul(g), x = b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), _ = b.isub(x).iushrn(this.shift), E = _; - return _.cmp(this.m) >= 0 ? E = _.isub(this.m) : _.cmpn(0) < 0 && (E = _.iadd(this.m)), E._forceRed(this); - }, S.prototype.invm = function(f) { + var b = f.mul(g), x = b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), E = b.isub(x).iushrn(this.shift), S = E; + return E.cmp(this.m) >= 0 ? S = E.isub(this.m) : E.cmpn(0) < 0 && (S = E.iadd(this.m)), S._forceRed(this); + }, A.prototype.invm = function(f) { var g = this.imod(f._invmp(this.m).mul(this.r2)); return g._forceRed(this); }; })(t, gn); -})(Wv); -var DF = Wv.exports; -const sr = /* @__PURE__ */ ts(DF); -var OF = sr.BN; -function NF(t) { - return new OF(t, 36).toString(16); -} -const LF = "strings/5.7.0", kF = new Yr(LF); -var r0; +})(ib); +var lj = ib.exports; +const sr = /* @__PURE__ */ ns(lj); +var hj = sr.BN; +function dj(t) { + return new hj(t, 36).toString(16); +} +const pj = "strings/5.7.0", gj = new Yr(pj); +var p0; (function(t) { t.current = "", t.NFC = "NFC", t.NFD = "NFD", t.NFKC = "NFKC", t.NFKD = "NFKD"; -})(r0 || (r0 = {})); -var yx; +})(p0 || (p0 = {})); +var Lx; (function(t) { t.UNEXPECTED_CONTINUE = "unexpected continuation byte", t.BAD_PREFIX = "bad codepoint prefix", t.OVERRUN = "string overrun", t.MISSING_CONTINUE = "missing continuation byte", t.OUT_OF_RANGE = "out of UTF-8 range", t.UTF16_SURROGATE = "UTF-16 surrogate", t.OVERLONG = "overlong representation"; -})(yx || (yx = {})); -function em(t, e = r0.current) { - e != r0.current && (kF.checkNormalize(), t = t.normalize(e)); +})(Lx || (Lx = {})); +function pm(t, e = p0.current) { + e != p0.current && (gj.checkNormalize(), t = t.normalize(e)); let r = []; for (let n = 0; n < t.length; n++) { const i = t.charCodeAt(n); @@ -10099,41 +10611,41 @@ function em(t, e = r0.current) { } return wn(r); } -const $F = `Ethereum Signed Message: +const mj = `Ethereum Signed Message: `; -function G4(t) { - return typeof t == "string" && (t = em(t)), zv(CF([ - em($F), - em(String(t.length)), +function _8(t) { + return typeof t == "string" && (t = pm(t)), nb(cj([ + pm(mj), + pm(String(t.length)), t ])); } -const BF = "address/5.7.0", $f = new Yr(BF); -function wx(t) { - zs(t, 20) || $f.throwArgumentError("invalid address", "address", t), t = t.toLowerCase(); +const vj = "address/5.7.0", Wf = new Yr(vj); +function kx(t) { + Ks(t, 20) || Wf.throwArgumentError("invalid address", "address", t), t = t.toLowerCase(); const e = t.substring(2).split(""), r = new Uint8Array(40); for (let i = 0; i < 40; i++) r[i] = e[i].charCodeAt(0); - const n = wn(zv(r)); + const n = wn(nb(r)); for (let i = 0; i < 40; i += 2) n[i >> 1] >> 4 >= 8 && (e[i] = e[i].toUpperCase()), (n[i >> 1] & 15) >= 8 && (e[i + 1] = e[i + 1].toUpperCase()); return "0x" + e.join(""); } -const FF = 9007199254740991; -function jF(t) { +const bj = 9007199254740991; +function yj(t) { return Math.log10 ? Math.log10(t) : Math.log(t) / Math.LN10; } -const Hv = {}; +const sb = {}; for (let t = 0; t < 10; t++) - Hv[String(t)] = String(t); + sb[String(t)] = String(t); for (let t = 0; t < 26; t++) - Hv[String.fromCharCode(65 + t)] = String(10 + t); -const xx = Math.floor(jF(FF)); -function UF(t) { + sb[String.fromCharCode(65 + t)] = String(10 + t); +const $x = Math.floor(yj(bj)); +function wj(t) { t = t.toUpperCase(), t = t.substring(4) + t.substring(0, 2) + "00"; - let e = t.split("").map((n) => Hv[n]).join(""); - for (; e.length >= xx; ) { - let n = e.substring(0, xx); + let e = t.split("").map((n) => sb[n]).join(""); + for (; e.length >= $x; ) { + let n = e.substring(0, $x); e = parseInt(n, 10) % 97 + e.substring(n.length); } let r = String(98 - parseInt(e, 10) % 97); @@ -10141,36 +10653,36 @@ function UF(t) { r = "0" + r; return r; } -function qF(t) { +function xj(t) { let e = null; - if (typeof t != "string" && $f.throwArgumentError("invalid address", "address", t), t.match(/^(0x)?[0-9a-fA-F]{40}$/)) - t.substring(0, 2) !== "0x" && (t = "0x" + t), e = wx(t), t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && e !== t && $f.throwArgumentError("bad address checksum", "address", t); + if (typeof t != "string" && Wf.throwArgumentError("invalid address", "address", t), t.match(/^(0x)?[0-9a-fA-F]{40}$/)) + t.substring(0, 2) !== "0x" && (t = "0x" + t), e = kx(t), t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && e !== t && Wf.throwArgumentError("bad address checksum", "address", t); else if (t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { - for (t.substring(2, 4) !== UF(t) && $f.throwArgumentError("bad icap checksum", "address", t), e = NF(t.substring(4)); e.length < 40; ) + for (t.substring(2, 4) !== wj(t) && Wf.throwArgumentError("bad icap checksum", "address", t), e = dj(t.substring(4)); e.length < 40; ) e = "0" + e; - e = wx("0x" + e); + e = kx("0x" + e); } else - $f.throwArgumentError("invalid address", "address", t); + Wf.throwArgumentError("invalid address", "address", t); return e; } -function _f(t, e, r) { +function Cf(t, e, r) { Object.defineProperty(t, e, { enumerable: !0, value: r, writable: !1 }); } -var Vl = {}, xr = {}, wc = Y4; -function Y4(t, e) { +var rh = {}, _r = {}, Tc = E8; +function E8(t, e) { if (!t) throw new Error(e || "Assertion failed"); } -Y4.equal = function(e, r, n) { +E8.equal = function(e, r, n) { if (e != r) throw new Error(n || "Assertion failed: " + e + " != " + r); }; -var w1 = { exports: {} }; -typeof Object.create == "function" ? w1.exports = function(e, r) { +var k1 = { exports: {} }; +typeof Object.create == "function" ? k1.exports = function(e, r) { r && (e.super_ = r, e.prototype = Object.create(r.prototype, { constructor: { value: e, @@ -10179,7 +10691,7 @@ typeof Object.create == "function" ? w1.exports = function(e, r) { configurable: !0 } })); -} : w1.exports = function(e, r) { +} : k1.exports = function(e, r) { if (r) { e.super_ = r; var n = function() { @@ -10187,12 +10699,12 @@ typeof Object.create == "function" ? w1.exports = function(e, r) { n.prototype = r.prototype, e.prototype = new n(), e.prototype.constructor = e; } }; -var z0 = w1.exports, zF = wc, WF = z0; -xr.inherits = WF; -function HF(t, e) { +var np = k1.exports, _j = Tc, Ej = np; +_r.inherits = Ej; +function Sj(t, e) { return (t.charCodeAt(e) & 64512) !== 55296 || e < 0 || e + 1 >= t.length ? !1 : (t.charCodeAt(e + 1) & 64512) === 56320; } -function KF(t, e) { +function Aj(t, e) { if (Array.isArray(t)) return t.slice(); if (!t) @@ -10205,160 +10717,160 @@ function KF(t, e) { r.push(parseInt(t[i] + t[i + 1], 16)); } else for (var n = 0, i = 0; i < t.length; i++) { var s = t.charCodeAt(i); - s < 128 ? r[n++] = s : s < 2048 ? (r[n++] = s >> 6 | 192, r[n++] = s & 63 | 128) : HF(t, i) ? (s = 65536 + ((s & 1023) << 10) + (t.charCodeAt(++i) & 1023), r[n++] = s >> 18 | 240, r[n++] = s >> 12 & 63 | 128, r[n++] = s >> 6 & 63 | 128, r[n++] = s & 63 | 128) : (r[n++] = s >> 12 | 224, r[n++] = s >> 6 & 63 | 128, r[n++] = s & 63 | 128); + s < 128 ? r[n++] = s : s < 2048 ? (r[n++] = s >> 6 | 192, r[n++] = s & 63 | 128) : Sj(t, i) ? (s = 65536 + ((s & 1023) << 10) + (t.charCodeAt(++i) & 1023), r[n++] = s >> 18 | 240, r[n++] = s >> 12 & 63 | 128, r[n++] = s >> 6 & 63 | 128, r[n++] = s & 63 | 128) : (r[n++] = s >> 12 | 224, r[n++] = s >> 6 & 63 | 128, r[n++] = s & 63 | 128); } else for (i = 0; i < t.length; i++) r[i] = t[i] | 0; return r; } -xr.toArray = KF; -function VF(t) { +_r.toArray = Aj; +function Pj(t) { for (var e = "", r = 0; r < t.length; r++) - e += X4(t[r].toString(16)); + e += A8(t[r].toString(16)); return e; } -xr.toHex = VF; -function J4(t) { +_r.toHex = Pj; +function S8(t) { var e = t >>> 24 | t >>> 8 & 65280 | t << 8 & 16711680 | (t & 255) << 24; return e >>> 0; } -xr.htonl = J4; -function GF(t, e) { +_r.htonl = S8; +function Mj(t, e) { for (var r = "", n = 0; n < t.length; n++) { var i = t[n]; - e === "little" && (i = J4(i)), r += Z4(i.toString(16)); + e === "little" && (i = S8(i)), r += P8(i.toString(16)); } return r; } -xr.toHex32 = GF; -function X4(t) { +_r.toHex32 = Mj; +function A8(t) { return t.length === 1 ? "0" + t : t; } -xr.zero2 = X4; -function Z4(t) { +_r.zero2 = A8; +function P8(t) { return t.length === 7 ? "0" + t : t.length === 6 ? "00" + t : t.length === 5 ? "000" + t : t.length === 4 ? "0000" + t : t.length === 3 ? "00000" + t : t.length === 2 ? "000000" + t : t.length === 1 ? "0000000" + t : t; } -xr.zero8 = Z4; -function YF(t, e, r, n) { +_r.zero8 = P8; +function Ij(t, e, r, n) { var i = r - e; - zF(i % 4 === 0); + _j(i % 4 === 0); for (var s = new Array(i / 4), o = 0, a = e; o < s.length; o++, a += 4) { var u; n === "big" ? u = t[a] << 24 | t[a + 1] << 16 | t[a + 2] << 8 | t[a + 3] : u = t[a + 3] << 24 | t[a + 2] << 16 | t[a + 1] << 8 | t[a], s[o] = u >>> 0; } return s; } -xr.join32 = YF; -function JF(t, e) { +_r.join32 = Ij; +function Cj(t, e) { for (var r = new Array(t.length * 4), n = 0, i = 0; n < t.length; n++, i += 4) { var s = t[n]; e === "big" ? (r[i] = s >>> 24, r[i + 1] = s >>> 16 & 255, r[i + 2] = s >>> 8 & 255, r[i + 3] = s & 255) : (r[i + 3] = s >>> 24, r[i + 2] = s >>> 16 & 255, r[i + 1] = s >>> 8 & 255, r[i] = s & 255); } return r; } -xr.split32 = JF; -function XF(t, e) { +_r.split32 = Cj; +function Tj(t, e) { return t >>> e | t << 32 - e; } -xr.rotr32 = XF; -function ZF(t, e) { +_r.rotr32 = Tj; +function Rj(t, e) { return t << e | t >>> 32 - e; } -xr.rotl32 = ZF; -function QF(t, e) { +_r.rotl32 = Rj; +function Dj(t, e) { return t + e >>> 0; } -xr.sum32 = QF; -function ej(t, e, r) { +_r.sum32 = Dj; +function Oj(t, e, r) { return t + e + r >>> 0; } -xr.sum32_3 = ej; -function tj(t, e, r, n) { +_r.sum32_3 = Oj; +function Nj(t, e, r, n) { return t + e + r + n >>> 0; } -xr.sum32_4 = tj; -function rj(t, e, r, n, i) { +_r.sum32_4 = Nj; +function Lj(t, e, r, n, i) { return t + e + r + n + i >>> 0; } -xr.sum32_5 = rj; -function nj(t, e, r, n) { +_r.sum32_5 = Lj; +function kj(t, e, r, n) { var i = t[e], s = t[e + 1], o = n + s >>> 0, a = (o < n ? 1 : 0) + r + i; t[e] = a >>> 0, t[e + 1] = o; } -xr.sum64 = nj; -function ij(t, e, r, n) { +_r.sum64 = kj; +function $j(t, e, r, n) { var i = e + n >>> 0, s = (i < e ? 1 : 0) + t + r; return s >>> 0; } -xr.sum64_hi = ij; -function sj(t, e, r, n) { +_r.sum64_hi = $j; +function Bj(t, e, r, n) { var i = e + n; return i >>> 0; } -xr.sum64_lo = sj; -function oj(t, e, r, n, i, s, o, a) { +_r.sum64_lo = Bj; +function Fj(t, e, r, n, i, s, o, a) { var u = 0, l = e; l = l + n >>> 0, u += l < e ? 1 : 0, l = l + s >>> 0, u += l < s ? 1 : 0, l = l + a >>> 0, u += l < a ? 1 : 0; var d = t + r + i + o + u; return d >>> 0; } -xr.sum64_4_hi = oj; -function aj(t, e, r, n, i, s, o, a) { +_r.sum64_4_hi = Fj; +function jj(t, e, r, n, i, s, o, a) { var u = e + n + s + a; return u >>> 0; } -xr.sum64_4_lo = aj; -function cj(t, e, r, n, i, s, o, a, u, l) { +_r.sum64_4_lo = jj; +function Uj(t, e, r, n, i, s, o, a, u, l) { var d = 0, p = e; p = p + n >>> 0, d += p < e ? 1 : 0, p = p + s >>> 0, d += p < s ? 1 : 0, p = p + a >>> 0, d += p < a ? 1 : 0, p = p + l >>> 0, d += p < l ? 1 : 0; var w = t + r + i + o + u + d; return w >>> 0; } -xr.sum64_5_hi = cj; -function uj(t, e, r, n, i, s, o, a, u, l) { +_r.sum64_5_hi = Uj; +function qj(t, e, r, n, i, s, o, a, u, l) { var d = e + n + s + a + l; return d >>> 0; } -xr.sum64_5_lo = uj; -function fj(t, e, r) { +_r.sum64_5_lo = qj; +function zj(t, e, r) { var n = e << 32 - r | t >>> r; return n >>> 0; } -xr.rotr64_hi = fj; -function lj(t, e, r) { +_r.rotr64_hi = zj; +function Wj(t, e, r) { var n = t << 32 - r | e >>> r; return n >>> 0; } -xr.rotr64_lo = lj; -function hj(t, e, r) { +_r.rotr64_lo = Wj; +function Hj(t, e, r) { return t >>> r; } -xr.shr64_hi = hj; -function dj(t, e, r) { +_r.shr64_hi = Hj; +function Kj(t, e, r) { var n = t << 32 - r | e >>> r; return n >>> 0; } -xr.shr64_lo = dj; -var Lu = {}, _x = xr, pj = wc; -function W0() { +_r.shr64_lo = Kj; +var qu = {}, Bx = _r, Vj = Tc; +function ip() { this.pending = null, this.pendingTotal = 0, this.blockSize = this.constructor.blockSize, this.outSize = this.constructor.outSize, this.hmacStrength = this.constructor.hmacStrength, this.padLength = this.constructor.padLength / 8, this.endian = "big", this._delta8 = this.blockSize / 8, this._delta32 = this.blockSize / 32; } -Lu.BlockHash = W0; -W0.prototype.update = function(e, r) { - if (e = _x.toArray(e, r), this.pending ? this.pending = this.pending.concat(e) : this.pending = e, this.pendingTotal += e.length, this.pending.length >= this._delta8) { +qu.BlockHash = ip; +ip.prototype.update = function(e, r) { + if (e = Bx.toArray(e, r), this.pending ? this.pending = this.pending.concat(e) : this.pending = e, this.pendingTotal += e.length, this.pending.length >= this._delta8) { e = this.pending; var n = e.length % this._delta8; - this.pending = e.slice(e.length - n, e.length), this.pending.length === 0 && (this.pending = null), e = _x.join32(e, 0, e.length - n, this.endian); + this.pending = e.slice(e.length - n, e.length), this.pending.length === 0 && (this.pending = null), e = Bx.join32(e, 0, e.length - n, this.endian); for (var i = 0; i < e.length; i += this._delta32) this._update(e, i, i + this._delta32); } return this; }; -W0.prototype.digest = function(e) { - return this.update(this._pad()), pj(this.pending === null), this._digest(e); +ip.prototype.digest = function(e) { + return this.update(this._pad()), Vj(this.pending === null), this._digest(e); }; -W0.prototype._pad = function() { +ip.prototype._pad = function() { var e = this.pendingTotal, r = this._delta8, n = r - (e + this.padLength) % r, i = new Array(n + this.padLength); i[0] = 128; for (var s = 1; s < n; s++) @@ -10372,54 +10884,54 @@ W0.prototype._pad = function() { i[s++] = 0; return i; }; -var ku = {}, ro = {}, gj = xr, Ws = gj.rotr32; -function mj(t, e, r, n) { +var zu = {}, so = {}, Gj = _r, Vs = Gj.rotr32; +function Yj(t, e, r, n) { if (t === 0) - return Q4(e, r, n); + return M8(e, r, n); if (t === 1 || t === 3) - return t8(e, r, n); + return C8(e, r, n); if (t === 2) - return e8(e, r, n); + return I8(e, r, n); } -ro.ft_1 = mj; -function Q4(t, e, r) { +so.ft_1 = Yj; +function M8(t, e, r) { return t & e ^ ~t & r; } -ro.ch32 = Q4; -function e8(t, e, r) { +so.ch32 = M8; +function I8(t, e, r) { return t & e ^ t & r ^ e & r; } -ro.maj32 = e8; -function t8(t, e, r) { +so.maj32 = I8; +function C8(t, e, r) { return t ^ e ^ r; } -ro.p32 = t8; -function vj(t) { - return Ws(t, 2) ^ Ws(t, 13) ^ Ws(t, 22); +so.p32 = C8; +function Jj(t) { + return Vs(t, 2) ^ Vs(t, 13) ^ Vs(t, 22); } -ro.s0_256 = vj; -function bj(t) { - return Ws(t, 6) ^ Ws(t, 11) ^ Ws(t, 25); +so.s0_256 = Jj; +function Xj(t) { + return Vs(t, 6) ^ Vs(t, 11) ^ Vs(t, 25); } -ro.s1_256 = bj; -function yj(t) { - return Ws(t, 7) ^ Ws(t, 18) ^ t >>> 3; +so.s1_256 = Xj; +function Zj(t) { + return Vs(t, 7) ^ Vs(t, 18) ^ t >>> 3; } -ro.g0_256 = yj; -function wj(t) { - return Ws(t, 17) ^ Ws(t, 19) ^ t >>> 10; +so.g0_256 = Zj; +function Qj(t) { + return Vs(t, 17) ^ Vs(t, 19) ^ t >>> 10; } -ro.g1_256 = wj; -var _u = xr, xj = Lu, _j = ro, tm = _u.rotl32, Ef = _u.sum32, Ej = _u.sum32_5, Sj = _j.ft_1, r8 = xj.BlockHash, Aj = [ +so.g1_256 = Qj; +var Ru = _r, eU = qu, tU = so, gm = Ru.rotl32, Tf = Ru.sum32, rU = Ru.sum32_5, nU = tU.ft_1, T8 = eU.BlockHash, iU = [ 1518500249, 1859775393, 2400959708, 3395469782 ]; -function Js() { - if (!(this instanceof Js)) - return new Js(); - r8.call(this), this.h = [ +function Qs() { + if (!(this instanceof Qs)) + return new Qs(); + T8.call(this), this.h = [ 1732584193, 4023233417, 2562383102, @@ -10427,28 +10939,28 @@ function Js() { 3285377520 ], this.W = new Array(80); } -_u.inherits(Js, r8); -var Pj = Js; -Js.blockSize = 512; -Js.outSize = 160; -Js.hmacStrength = 80; -Js.padLength = 64; -Js.prototype._update = function(e, r) { +Ru.inherits(Qs, T8); +var sU = Qs; +Qs.blockSize = 512; +Qs.outSize = 160; +Qs.hmacStrength = 80; +Qs.padLength = 64; +Qs.prototype._update = function(e, r) { for (var n = this.W, i = 0; i < 16; i++) n[i] = e[r + i]; for (; i < n.length; i++) - n[i] = tm(n[i - 3] ^ n[i - 8] ^ n[i - 14] ^ n[i - 16], 1); + n[i] = gm(n[i - 3] ^ n[i - 8] ^ n[i - 14] ^ n[i - 16], 1); var s = this.h[0], o = this.h[1], a = this.h[2], u = this.h[3], l = this.h[4]; for (i = 0; i < n.length; i++) { - var d = ~~(i / 20), p = Ej(tm(s, 5), Sj(d, o, a, u), l, n[i], Aj[d]); - l = u, u = a, a = tm(o, 30), o = s, s = p; + var d = ~~(i / 20), p = rU(gm(s, 5), nU(d, o, a, u), l, n[i], iU[d]); + l = u, u = a, a = gm(o, 30), o = s, s = p; } - this.h[0] = Ef(this.h[0], s), this.h[1] = Ef(this.h[1], o), this.h[2] = Ef(this.h[2], a), this.h[3] = Ef(this.h[3], u), this.h[4] = Ef(this.h[4], l); + this.h[0] = Tf(this.h[0], s), this.h[1] = Tf(this.h[1], o), this.h[2] = Tf(this.h[2], a), this.h[3] = Tf(this.h[3], u), this.h[4] = Tf(this.h[4], l); }; -Js.prototype._digest = function(e) { - return e === "hex" ? _u.toHex32(this.h, "big") : _u.split32(this.h, "big"); +Qs.prototype._digest = function(e) { + return e === "hex" ? Ru.toHex32(this.h, "big") : Ru.split32(this.h, "big"); }; -var Eu = xr, Mj = Lu, $u = ro, Ij = wc, gs = Eu.sum32, Cj = Eu.sum32_4, Tj = Eu.sum32_5, Rj = $u.ch32, Dj = $u.maj32, Oj = $u.s0_256, Nj = $u.s1_256, Lj = $u.g0_256, kj = $u.g1_256, n8 = Mj.BlockHash, $j = [ +var Du = _r, oU = qu, Wu = so, aU = Tc, bs = Du.sum32, cU = Du.sum32_4, uU = Du.sum32_5, fU = Wu.ch32, lU = Wu.maj32, hU = Wu.s0_256, dU = Wu.s1_256, pU = Wu.g0_256, gU = Wu.g1_256, R8 = oU.BlockHash, mU = [ 1116352408, 1899447441, 3049323471, @@ -10514,10 +11026,10 @@ var Eu = xr, Mj = Lu, $u = ro, Ij = wc, gs = Eu.sum32, Cj = Eu.sum32_4, Tj = Eu. 3204031479, 3329325298 ]; -function Xs() { - if (!(this instanceof Xs)) - return new Xs(); - n8.call(this), this.h = [ +function eo() { + if (!(this instanceof eo)) + return new eo(); + R8.call(this), this.h = [ 1779033703, 3144134277, 1013904242, @@ -10526,34 +11038,34 @@ function Xs() { 2600822924, 528734635, 1541459225 - ], this.k = $j, this.W = new Array(64); -} -Eu.inherits(Xs, n8); -var i8 = Xs; -Xs.blockSize = 512; -Xs.outSize = 256; -Xs.hmacStrength = 192; -Xs.padLength = 64; -Xs.prototype._update = function(e, r) { + ], this.k = mU, this.W = new Array(64); +} +Du.inherits(eo, R8); +var D8 = eo; +eo.blockSize = 512; +eo.outSize = 256; +eo.hmacStrength = 192; +eo.padLength = 64; +eo.prototype._update = function(e, r) { for (var n = this.W, i = 0; i < 16; i++) n[i] = e[r + i]; for (; i < n.length; i++) - n[i] = Cj(kj(n[i - 2]), n[i - 7], Lj(n[i - 15]), n[i - 16]); + n[i] = cU(gU(n[i - 2]), n[i - 7], pU(n[i - 15]), n[i - 16]); var s = this.h[0], o = this.h[1], a = this.h[2], u = this.h[3], l = this.h[4], d = this.h[5], p = this.h[6], w = this.h[7]; - for (Ij(this.k.length === n.length), i = 0; i < n.length; i++) { - var A = Tj(w, Nj(l), Rj(l, d, p), this.k[i], n[i]), M = gs(Oj(s), Dj(s, o, a)); - w = p, p = d, d = l, l = gs(u, A), u = a, a = o, o = s, s = gs(A, M); + for (aU(this.k.length === n.length), i = 0; i < n.length; i++) { + var _ = uU(w, dU(l), fU(l, d, p), this.k[i], n[i]), P = bs(hU(s), lU(s, o, a)); + w = p, p = d, d = l, l = bs(u, _), u = a, a = o, o = s, s = bs(_, P); } - this.h[0] = gs(this.h[0], s), this.h[1] = gs(this.h[1], o), this.h[2] = gs(this.h[2], a), this.h[3] = gs(this.h[3], u), this.h[4] = gs(this.h[4], l), this.h[5] = gs(this.h[5], d), this.h[6] = gs(this.h[6], p), this.h[7] = gs(this.h[7], w); + this.h[0] = bs(this.h[0], s), this.h[1] = bs(this.h[1], o), this.h[2] = bs(this.h[2], a), this.h[3] = bs(this.h[3], u), this.h[4] = bs(this.h[4], l), this.h[5] = bs(this.h[5], d), this.h[6] = bs(this.h[6], p), this.h[7] = bs(this.h[7], w); }; -Xs.prototype._digest = function(e) { - return e === "hex" ? Eu.toHex32(this.h, "big") : Eu.split32(this.h, "big"); +eo.prototype._digest = function(e) { + return e === "hex" ? Du.toHex32(this.h, "big") : Du.split32(this.h, "big"); }; -var x1 = xr, s8 = i8; -function Fo() { - if (!(this instanceof Fo)) - return new Fo(); - s8.call(this), this.h = [ +var $1 = _r, O8 = D8; +function qo() { + if (!(this instanceof qo)) + return new qo(); + O8.call(this), this.h = [ 3238371032, 914150663, 812702999, @@ -10564,16 +11076,16 @@ function Fo() { 3204075428 ]; } -x1.inherits(Fo, s8); -var Bj = Fo; -Fo.blockSize = 512; -Fo.outSize = 224; -Fo.hmacStrength = 192; -Fo.padLength = 64; -Fo.prototype._digest = function(e) { - return e === "hex" ? x1.toHex32(this.h.slice(0, 7), "big") : x1.split32(this.h.slice(0, 7), "big"); +$1.inherits(qo, O8); +var vU = qo; +qo.blockSize = 512; +qo.outSize = 224; +qo.hmacStrength = 192; +qo.padLength = 64; +qo.prototype._digest = function(e) { + return e === "hex" ? $1.toHex32(this.h.slice(0, 7), "big") : $1.split32(this.h.slice(0, 7), "big"); }; -var _i = xr, Fj = Lu, jj = wc, Hs = _i.rotr64_hi, Ks = _i.rotr64_lo, o8 = _i.shr64_hi, a8 = _i.shr64_lo, ta = _i.sum64, rm = _i.sum64_hi, nm = _i.sum64_lo, Uj = _i.sum64_4_hi, qj = _i.sum64_4_lo, zj = _i.sum64_5_hi, Wj = _i.sum64_5_lo, c8 = Fj.BlockHash, Hj = [ +var Ei = _r, bU = qu, yU = Tc, Gs = Ei.rotr64_hi, Ys = Ei.rotr64_lo, N8 = Ei.shr64_hi, L8 = Ei.shr64_lo, na = Ei.sum64, mm = Ei.sum64_hi, vm = Ei.sum64_lo, wU = Ei.sum64_4_hi, xU = Ei.sum64_4_lo, _U = Ei.sum64_5_hi, EU = Ei.sum64_5_lo, k8 = bU.BlockHash, SU = [ 1116352408, 3609767458, 1899447441, @@ -10735,10 +11247,10 @@ var _i = xr, Fj = Lu, jj = wc, Hs = _i.rotr64_hi, Ks = _i.rotr64_lo, o8 = _i.shr 1816402316, 1246189591 ]; -function Ss() { - if (!(this instanceof Ss)) - return new Ss(); - c8.call(this), this.h = [ +function Is() { + if (!(this instanceof Is)) + return new Is(); + k8.call(this), this.h = [ 1779033703, 4089235720, 3144134277, @@ -10755,20 +11267,20 @@ function Ss() { 4215389547, 1541459225, 327033209 - ], this.k = Hj, this.W = new Array(160); -} -_i.inherits(Ss, c8); -var u8 = Ss; -Ss.blockSize = 1024; -Ss.outSize = 512; -Ss.hmacStrength = 192; -Ss.padLength = 128; -Ss.prototype._prepareBlock = function(e, r) { + ], this.k = SU, this.W = new Array(160); +} +Ei.inherits(Is, k8); +var $8 = Is; +Is.blockSize = 1024; +Is.outSize = 512; +Is.hmacStrength = 192; +Is.padLength = 128; +Is.prototype._prepareBlock = function(e, r) { for (var n = this.W, i = 0; i < 32; i++) n[i] = e[r + i]; for (; i < n.length; i += 2) { - var s = rU(n[i - 4], n[i - 3]), o = nU(n[i - 4], n[i - 3]), a = n[i - 14], u = n[i - 13], l = eU(n[i - 30], n[i - 29]), d = tU(n[i - 30], n[i - 29]), p = n[i - 32], w = n[i - 31]; - n[i] = Uj( + var s = LU(n[i - 4], n[i - 3]), o = kU(n[i - 4], n[i - 3]), a = n[i - 14], u = n[i - 13], l = OU(n[i - 30], n[i - 29]), d = NU(n[i - 30], n[i - 29]), p = n[i - 32], w = n[i - 31]; + n[i] = wU( s, o, a, @@ -10777,7 +11289,7 @@ Ss.prototype._prepareBlock = function(e, r) { d, p, w - ), n[i + 1] = qj( + ), n[i + 1] = xU( s, o, a, @@ -10789,96 +11301,96 @@ Ss.prototype._prepareBlock = function(e, r) { ); } }; -Ss.prototype._update = function(e, r) { +Is.prototype._update = function(e, r) { this._prepareBlock(e, r); - var n = this.W, i = this.h[0], s = this.h[1], o = this.h[2], a = this.h[3], u = this.h[4], l = this.h[5], d = this.h[6], p = this.h[7], w = this.h[8], A = this.h[9], M = this.h[10], N = this.h[11], L = this.h[12], B = this.h[13], $ = this.h[14], H = this.h[15]; - jj(this.k.length === n.length); + var n = this.W, i = this.h[0], s = this.h[1], o = this.h[2], a = this.h[3], u = this.h[4], l = this.h[5], d = this.h[6], p = this.h[7], w = this.h[8], _ = this.h[9], P = this.h[10], O = this.h[11], L = this.h[12], B = this.h[13], k = this.h[14], q = this.h[15]; + yU(this.k.length === n.length); for (var U = 0; U < n.length; U += 2) { - var V = $, te = H, R = Zj(w, A), K = Qj(w, A), ge = Kj(w, A, M, N, L), Ee = Vj(w, A, M, N, L, B), Y = this.k[U], S = this.k[U + 1], m = n[U], f = n[U + 1], g = zj( + var V = k, Q = q, R = RU(w, _), K = DU(w, _), ge = AU(w, _, P, O, L), Ee = PU(w, _, P, O, L, B), Y = this.k[U], A = this.k[U + 1], m = n[U], f = n[U + 1], g = _U( V, - te, + Q, R, K, ge, Ee, Y, - S, + A, m, f - ), b = Wj( + ), b = EU( V, - te, + Q, R, K, ge, Ee, Y, - S, + A, m, f ); - V = Jj(i, s), te = Xj(i, s), R = Gj(i, s, o, a, u), K = Yj(i, s, o, a, u, l); - var x = rm(V, te, R, K), _ = nm(V, te, R, K); - $ = L, H = B, L = M, B = N, M = w, N = A, w = rm(d, p, g, b), A = nm(p, p, g, b), d = u, p = l, u = o, l = a, o = i, a = s, i = rm(g, b, x, _), s = nm(g, b, x, _); + V = CU(i, s), Q = TU(i, s), R = MU(i, s, o, a, u), K = IU(i, s, o, a, u, l); + var x = mm(V, Q, R, K), E = vm(V, Q, R, K); + k = L, q = B, L = P, B = O, P = w, O = _, w = mm(d, p, g, b), _ = vm(p, p, g, b), d = u, p = l, u = o, l = a, o = i, a = s, i = mm(g, b, x, E), s = vm(g, b, x, E); } - ta(this.h, 0, i, s), ta(this.h, 2, o, a), ta(this.h, 4, u, l), ta(this.h, 6, d, p), ta(this.h, 8, w, A), ta(this.h, 10, M, N), ta(this.h, 12, L, B), ta(this.h, 14, $, H); + na(this.h, 0, i, s), na(this.h, 2, o, a), na(this.h, 4, u, l), na(this.h, 6, d, p), na(this.h, 8, w, _), na(this.h, 10, P, O), na(this.h, 12, L, B), na(this.h, 14, k, q); }; -Ss.prototype._digest = function(e) { - return e === "hex" ? _i.toHex32(this.h, "big") : _i.split32(this.h, "big"); +Is.prototype._digest = function(e) { + return e === "hex" ? Ei.toHex32(this.h, "big") : Ei.split32(this.h, "big"); }; -function Kj(t, e, r, n, i) { +function AU(t, e, r, n, i) { var s = t & r ^ ~t & i; return s < 0 && (s += 4294967296), s; } -function Vj(t, e, r, n, i, s) { +function PU(t, e, r, n, i, s) { var o = e & n ^ ~e & s; return o < 0 && (o += 4294967296), o; } -function Gj(t, e, r, n, i) { +function MU(t, e, r, n, i) { var s = t & r ^ t & i ^ r & i; return s < 0 && (s += 4294967296), s; } -function Yj(t, e, r, n, i, s) { +function IU(t, e, r, n, i, s) { var o = e & n ^ e & s ^ n & s; return o < 0 && (o += 4294967296), o; } -function Jj(t, e) { - var r = Hs(t, e, 28), n = Hs(e, t, 2), i = Hs(e, t, 7), s = r ^ n ^ i; +function CU(t, e) { + var r = Gs(t, e, 28), n = Gs(e, t, 2), i = Gs(e, t, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function Xj(t, e) { - var r = Ks(t, e, 28), n = Ks(e, t, 2), i = Ks(e, t, 7), s = r ^ n ^ i; +function TU(t, e) { + var r = Ys(t, e, 28), n = Ys(e, t, 2), i = Ys(e, t, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function Zj(t, e) { - var r = Hs(t, e, 14), n = Hs(t, e, 18), i = Hs(e, t, 9), s = r ^ n ^ i; +function RU(t, e) { + var r = Gs(t, e, 14), n = Gs(t, e, 18), i = Gs(e, t, 9), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function Qj(t, e) { - var r = Ks(t, e, 14), n = Ks(t, e, 18), i = Ks(e, t, 9), s = r ^ n ^ i; +function DU(t, e) { + var r = Ys(t, e, 14), n = Ys(t, e, 18), i = Ys(e, t, 9), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function eU(t, e) { - var r = Hs(t, e, 1), n = Hs(t, e, 8), i = o8(t, e, 7), s = r ^ n ^ i; +function OU(t, e) { + var r = Gs(t, e, 1), n = Gs(t, e, 8), i = N8(t, e, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function tU(t, e) { - var r = Ks(t, e, 1), n = Ks(t, e, 8), i = a8(t, e, 7), s = r ^ n ^ i; +function NU(t, e) { + var r = Ys(t, e, 1), n = Ys(t, e, 8), i = L8(t, e, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function rU(t, e) { - var r = Hs(t, e, 19), n = Hs(e, t, 29), i = o8(t, e, 6), s = r ^ n ^ i; +function LU(t, e) { + var r = Gs(t, e, 19), n = Gs(e, t, 29), i = N8(t, e, 6), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function nU(t, e) { - var r = Ks(t, e, 19), n = Ks(e, t, 29), i = a8(t, e, 6), s = r ^ n ^ i; +function kU(t, e) { + var r = Ys(t, e, 19), n = Ys(e, t, 29), i = L8(t, e, 6), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -var _1 = xr, f8 = u8; -function jo() { - if (!(this instanceof jo)) - return new jo(); - f8.call(this), this.h = [ +var B1 = _r, B8 = $8; +function zo() { + if (!(this instanceof zo)) + return new zo(); + B8.call(this), this.h = [ 3418070365, 3238371032, 1654270250, @@ -10897,64 +11409,64 @@ function jo() { 3204075428 ]; } -_1.inherits(jo, f8); -var iU = jo; -jo.blockSize = 1024; -jo.outSize = 384; -jo.hmacStrength = 192; -jo.padLength = 128; -jo.prototype._digest = function(e) { - return e === "hex" ? _1.toHex32(this.h.slice(0, 12), "big") : _1.split32(this.h.slice(0, 12), "big"); -}; -ku.sha1 = Pj; -ku.sha224 = Bj; -ku.sha256 = i8; -ku.sha384 = iU; -ku.sha512 = u8; -var l8 = {}, lc = xr, sU = Lu, ud = lc.rotl32, Ex = lc.sum32, Sf = lc.sum32_3, Sx = lc.sum32_4, h8 = sU.BlockHash; -function Zs() { - if (!(this instanceof Zs)) - return new Zs(); - h8.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = "little"; -} -lc.inherits(Zs, h8); -l8.ripemd160 = Zs; -Zs.blockSize = 512; -Zs.outSize = 160; -Zs.hmacStrength = 192; -Zs.padLength = 64; -Zs.prototype._update = function(e, r) { - for (var n = this.h[0], i = this.h[1], s = this.h[2], o = this.h[3], a = this.h[4], u = n, l = i, d = s, p = o, w = a, A = 0; A < 80; A++) { - var M = Ex( - ud( - Sx(n, Ax(A, i, s, o), e[cU[A] + r], oU(A)), - fU[A] +B1.inherits(zo, B8); +var $U = zo; +zo.blockSize = 1024; +zo.outSize = 384; +zo.hmacStrength = 192; +zo.padLength = 128; +zo.prototype._digest = function(e) { + return e === "hex" ? B1.toHex32(this.h.slice(0, 12), "big") : B1.split32(this.h.slice(0, 12), "big"); +}; +zu.sha1 = sU; +zu.sha224 = vU; +zu.sha256 = D8; +zu.sha384 = $U; +zu.sha512 = $8; +var F8 = {}, yc = _r, BU = qu, wd = yc.rotl32, Fx = yc.sum32, Rf = yc.sum32_3, jx = yc.sum32_4, j8 = BU.BlockHash; +function to() { + if (!(this instanceof to)) + return new to(); + j8.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = "little"; +} +yc.inherits(to, j8); +F8.ripemd160 = to; +to.blockSize = 512; +to.outSize = 160; +to.hmacStrength = 192; +to.padLength = 64; +to.prototype._update = function(e, r) { + for (var n = this.h[0], i = this.h[1], s = this.h[2], o = this.h[3], a = this.h[4], u = n, l = i, d = s, p = o, w = a, _ = 0; _ < 80; _++) { + var P = Fx( + wd( + jx(n, Ux(_, i, s, o), e[UU[_] + r], FU(_)), + zU[_] ), a ); - n = a, a = o, o = ud(s, 10), s = i, i = M, M = Ex( - ud( - Sx(u, Ax(79 - A, l, d, p), e[uU[A] + r], aU(A)), - lU[A] + n = a, a = o, o = wd(s, 10), s = i, i = P, P = Fx( + wd( + jx(u, Ux(79 - _, l, d, p), e[qU[_] + r], jU(_)), + WU[_] ), w - ), u = w, w = p, p = ud(d, 10), d = l, l = M; + ), u = w, w = p, p = wd(d, 10), d = l, l = P; } - M = Sf(this.h[1], s, p), this.h[1] = Sf(this.h[2], o, w), this.h[2] = Sf(this.h[3], a, u), this.h[3] = Sf(this.h[4], n, l), this.h[4] = Sf(this.h[0], i, d), this.h[0] = M; + P = Rf(this.h[1], s, p), this.h[1] = Rf(this.h[2], o, w), this.h[2] = Rf(this.h[3], a, u), this.h[3] = Rf(this.h[4], n, l), this.h[4] = Rf(this.h[0], i, d), this.h[0] = P; }; -Zs.prototype._digest = function(e) { - return e === "hex" ? lc.toHex32(this.h, "little") : lc.split32(this.h, "little"); +to.prototype._digest = function(e) { + return e === "hex" ? yc.toHex32(this.h, "little") : yc.split32(this.h, "little"); }; -function Ax(t, e, r, n) { +function Ux(t, e, r, n) { return t <= 15 ? e ^ r ^ n : t <= 31 ? e & r | ~e & n : t <= 47 ? (e | ~r) ^ n : t <= 63 ? e & n | r & ~n : e ^ (r | ~n); } -function oU(t) { +function FU(t) { return t <= 15 ? 0 : t <= 31 ? 1518500249 : t <= 47 ? 1859775393 : t <= 63 ? 2400959708 : 2840853838; } -function aU(t) { +function jU(t) { return t <= 15 ? 1352829926 : t <= 31 ? 1548603684 : t <= 47 ? 1836072691 : t <= 63 ? 2053994217 : 0; } -var cU = [ +var UU = [ 0, 1, 2, @@ -11035,7 +11547,7 @@ var cU = [ 6, 15, 13 -], uU = [ +], qU = [ 5, 14, 7, @@ -11116,7 +11628,7 @@ var cU = [ 3, 9, 11 -], fU = [ +], zU = [ 11, 14, 15, @@ -11197,7 +11709,7 @@ var cU = [ 8, 5, 6 -], lU = [ +], WU = [ 8, 9, 9, @@ -11278,15 +11790,15 @@ var cU = [ 13, 11, 11 -], hU = xr, dU = wc; -function Su(t, e, r) { - if (!(this instanceof Su)) - return new Su(t, e, r); - this.Hash = t, this.blockSize = t.blockSize / 8, this.outSize = t.outSize / 8, this.inner = null, this.outer = null, this._init(hU.toArray(e, r)); -} -var pU = Su; -Su.prototype._init = function(e) { - e.length > this.blockSize && (e = new this.Hash().update(e).digest()), dU(e.length <= this.blockSize); +], HU = _r, KU = Tc; +function Ou(t, e, r) { + if (!(this instanceof Ou)) + return new Ou(t, e, r); + this.Hash = t, this.blockSize = t.blockSize / 8, this.outSize = t.outSize / 8, this.inner = null, this.outer = null, this._init(HU.toArray(e, r)); +} +var VU = Ou; +Ou.prototype._init = function(e) { + e.length > this.blockSize && (e = new this.Hash().update(e).digest()), KU(e.length <= this.blockSize); for (var r = e.length; r < this.blockSize; r++) e.push(0); for (r = 0; r < e.length; r++) @@ -11295,39 +11807,39 @@ Su.prototype._init = function(e) { e[r] ^= 106; this.outer = new this.Hash().update(e); }; -Su.prototype.update = function(e, r) { +Ou.prototype.update = function(e, r) { return this.inner.update(e, r), this; }; -Su.prototype.digest = function(e) { +Ou.prototype.digest = function(e) { return this.outer.update(this.inner.digest()), this.outer.digest(e); }; (function(t) { var e = t; - e.utils = xr, e.common = Lu, e.sha = ku, e.ripemd = l8, e.hmac = pU, e.sha1 = e.sha.sha1, e.sha256 = e.sha.sha256, e.sha224 = e.sha.sha224, e.sha384 = e.sha.sha384, e.sha512 = e.sha.sha512, e.ripemd160 = e.ripemd.ripemd160; -})(Vl); -const yo = /* @__PURE__ */ ts(Vl); -function Bu(t, e, r) { + e.utils = _r, e.common = qu, e.sha = zu, e.ripemd = F8, e.hmac = VU, e.sha1 = e.sha.sha1, e.sha256 = e.sha.sha256, e.sha224 = e.sha.sha224, e.sha384 = e.sha.sha384, e.sha512 = e.sha.sha512, e.ripemd160 = e.ripemd.ripemd160; +})(rh); +const Eo = /* @__PURE__ */ ns(rh); +function Hu(t, e, r) { return r = { path: e, exports: {}, require: function(n, i) { - return gU(n, i ?? r.path); + return GU(n, i ?? r.path); } }, t(r, r.exports), r.exports; } -function gU() { +function GU() { throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs"); } -var Kv = d8; -function d8(t, e) { +var ob = U8; +function U8(t, e) { if (!t) throw new Error(e || "Assertion failed"); } -d8.equal = function(e, r, n) { +U8.equal = function(e, r, n) { if (e != r) throw new Error(n || "Assertion failed: " + e + " != " + r); }; -var xs = Bu(function(t, e) { +var Ss = Hu(function(t, e) { var r = e; function n(o, a) { if (Array.isArray(o)) @@ -11364,15 +11876,15 @@ var xs = Bu(function(t, e) { r.toHex = s, r.encode = function(a, u) { return u === "hex" ? s(a) : a; }; -}), $i = Bu(function(t, e) { +}), Fi = Hu(function(t, e) { var r = e; - r.assert = Kv, r.toArray = xs.toArray, r.zero2 = xs.zero2, r.toHex = xs.toHex, r.encode = xs.encode; + r.assert = ob, r.toArray = Ss.toArray, r.zero2 = Ss.zero2, r.toHex = Ss.toHex, r.encode = Ss.encode; function n(u, l, d) { var p = new Array(Math.max(u.bitLength(), d) + 1); p.fill(0); - for (var w = 1 << l + 1, A = u.clone(), M = 0; M < p.length; M++) { - var N, L = A.andln(w - 1); - A.isOdd() ? (L > (w >> 1) - 1 ? N = (w >> 1) - L : N = L, A.isubn(N)) : N = 0, p[M] = N, A.iushrn(1); + for (var w = 1 << l + 1, _ = u.clone(), P = 0; P < p.length; P++) { + var O, L = _.andln(w - 1); + _.isOdd() ? (L > (w >> 1) - 1 ? O = (w >> 1) - L : O = L, _.isubn(O)) : O = 0, p[P] = O, _.iushrn(1); } return p; } @@ -11383,13 +11895,13 @@ var xs = Bu(function(t, e) { [] ]; u = u.clone(), l = l.clone(); - for (var p = 0, w = 0, A; u.cmpn(-p) > 0 || l.cmpn(-w) > 0; ) { - var M = u.andln(3) + p & 3, N = l.andln(3) + w & 3; - M === 3 && (M = -1), N === 3 && (N = -1); + for (var p = 0, w = 0, _; u.cmpn(-p) > 0 || l.cmpn(-w) > 0; ) { + var P = u.andln(3) + p & 3, O = l.andln(3) + w & 3; + P === 3 && (P = -1), O === 3 && (O = -1); var L; - M & 1 ? (A = u.andln(7) + p & 7, (A === 3 || A === 5) && N === 2 ? L = -M : L = M) : L = 0, d[0].push(L); + P & 1 ? (_ = u.andln(7) + p & 7, (_ === 3 || _ === 5) && O === 2 ? L = -P : L = P) : L = 0, d[0].push(L); var B; - N & 1 ? (A = l.andln(7) + w & 7, (A === 3 || A === 5) && M === 2 ? B = -N : B = N) : B = 0, d[1].push(B), 2 * p === L + 1 && (p = 1 - p), 2 * w === B + 1 && (w = 1 - w), u.iushrn(1), l.iushrn(1); + O & 1 ? (_ = l.andln(7) + w & 7, (_ === 3 || _ === 5) && P === 2 ? B = -O : B = O) : B = 0, d[1].push(B), 2 * p === L + 1 && (p = 1 - p), 2 * w === B + 1 && (w = 1 - w), u.iushrn(1), l.iushrn(1); } return d; } @@ -11409,22 +11921,22 @@ var xs = Bu(function(t, e) { return new sr(u, "hex", "le"); } r.intFromLE = a; -}), n0 = $i.getNAF, mU = $i.getJSF, i0 = $i.assert; -function Ma(t, e) { +}), g0 = Fi.getNAF, YU = Fi.getJSF, m0 = Fi.assert; +function Oa(t, e) { this.type = t, this.p = new sr(e.p, 16), this.red = e.prime ? sr.red(e.prime) : sr.mont(this.p), this.zero = new sr(0).toRed(this.red), this.one = new sr(1).toRed(this.red), this.two = new sr(2).toRed(this.red), this.n = e.n && new sr(e.n, 16), this.g = e.g && this.pointFromJSON(e.g, e.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; var r = this.n && this.p.div(this.n); !r || r.cmpn(100) > 0 ? this.redN = null : (this._maxwellTrick = !0, this.redN = this.n.toRed(this.red)); } -var xc = Ma; -Ma.prototype.point = function() { +var Rc = Oa; +Oa.prototype.point = function() { throw new Error("Not implemented"); }; -Ma.prototype.validate = function() { +Oa.prototype.validate = function() { throw new Error("Not implemented"); }; -Ma.prototype._fixedNafMul = function(e, r) { - i0(e.precomputed); - var n = e._getDoubles(), i = n0(r, 1, this._bitLength), s = (1 << n.step + 1) - (n.step % 2 === 0 ? 2 : 1); +Oa.prototype._fixedNafMul = function(e, r) { + m0(e.precomputed); + var n = e._getDoubles(), i = g0(r, 1, this._bitLength), s = (1 << n.step + 1) - (n.step % 2 === 0 ? 2 : 1); s /= 3; var o = [], a, u; for (a = 0; a < i.length; a += n.step) { @@ -11440,43 +11952,43 @@ Ma.prototype._fixedNafMul = function(e, r) { } return d.toP(); }; -Ma.prototype._wnafMul = function(e, r) { +Oa.prototype._wnafMul = function(e, r) { var n = 4, i = e._getNAFPoints(n); n = i.wnd; - for (var s = i.points, o = n0(r, n, this._bitLength), a = this.jpoint(null, null, null), u = o.length - 1; u >= 0; u--) { + for (var s = i.points, o = g0(r, n, this._bitLength), a = this.jpoint(null, null, null), u = o.length - 1; u >= 0; u--) { for (var l = 0; u >= 0 && o[u] === 0; u--) l++; if (u >= 0 && l++, a = a.dblp(l), u < 0) break; var d = o[u]; - i0(d !== 0), e.type === "affine" ? d > 0 ? a = a.mixedAdd(s[d - 1 >> 1]) : a = a.mixedAdd(s[-d - 1 >> 1].neg()) : d > 0 ? a = a.add(s[d - 1 >> 1]) : a = a.add(s[-d - 1 >> 1].neg()); + m0(d !== 0), e.type === "affine" ? d > 0 ? a = a.mixedAdd(s[d - 1 >> 1]) : a = a.mixedAdd(s[-d - 1 >> 1].neg()) : d > 0 ? a = a.add(s[d - 1 >> 1]) : a = a.add(s[-d - 1 >> 1].neg()); } return e.type === "affine" ? a.toP() : a; }; -Ma.prototype._wnafMulAdd = function(e, r, n, i, s) { +Oa.prototype._wnafMulAdd = function(e, r, n, i, s) { var o = this._wnafT1, a = this._wnafT2, u = this._wnafT3, l = 0, d, p, w; for (d = 0; d < i; d++) { w = r[d]; - var A = w._getNAFPoints(e); - o[d] = A.wnd, a[d] = A.points; + var _ = w._getNAFPoints(e); + o[d] = _.wnd, a[d] = _.points; } for (d = i - 1; d >= 1; d -= 2) { - var M = d - 1, N = d; - if (o[M] !== 1 || o[N] !== 1) { - u[M] = n0(n[M], o[M], this._bitLength), u[N] = n0(n[N], o[N], this._bitLength), l = Math.max(u[M].length, l), l = Math.max(u[N].length, l); + var P = d - 1, O = d; + if (o[P] !== 1 || o[O] !== 1) { + u[P] = g0(n[P], o[P], this._bitLength), u[O] = g0(n[O], o[O], this._bitLength), l = Math.max(u[P].length, l), l = Math.max(u[O].length, l); continue; } var L = [ - r[M], + r[P], /* 1 */ null, /* 3 */ null, /* 5 */ - r[N] + r[O] /* 7 */ ]; - r[M].y.cmp(r[N].y) === 0 ? (L[1] = r[M].add(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())) : r[M].y.cmp(r[N].y.redNeg()) === 0 ? (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].add(r[N].neg())) : (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())); + r[P].y.cmp(r[O].y) === 0 ? (L[1] = r[P].add(r[O]), L[2] = r[P].toJ().mixedAdd(r[O].neg())) : r[P].y.cmp(r[O].y.redNeg()) === 0 ? (L[1] = r[P].toJ().mixedAdd(r[O]), L[2] = r[P].add(r[O].neg())) : (L[1] = r[P].toJ().mixedAdd(r[O]), L[2] = r[P].toJ().mixedAdd(r[O].neg())); var B = [ -3, /* -1 -1 */ @@ -11496,18 +12008,18 @@ Ma.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 1 0 */ 3 /* 1 1 */ - ], $ = mU(n[M], n[N]); - for (l = Math.max($[0].length, l), u[M] = new Array(l), u[N] = new Array(l), p = 0; p < l; p++) { - var H = $[0][p] | 0, U = $[1][p] | 0; - u[M][p] = B[(H + 1) * 3 + (U + 1)], u[N][p] = 0, a[M] = L; + ], k = YU(n[P], n[O]); + for (l = Math.max(k[0].length, l), u[P] = new Array(l), u[O] = new Array(l), p = 0; p < l; p++) { + var q = k[0][p] | 0, U = k[1][p] | 0; + u[P][p] = B[(q + 1) * 3 + (U + 1)], u[O][p] = 0, a[P] = L; } } - var V = this.jpoint(null, null, null), te = this._wnafT4; + var V = this.jpoint(null, null, null), Q = this._wnafT4; for (d = l; d >= 0; d--) { for (var R = 0; d >= 0; ) { var K = !0; for (p = 0; p < i; p++) - te[p] = u[p][d] | 0, te[p] !== 0 && (K = !1); + Q[p] = u[p][d] | 0, Q[p] !== 0 && (K = !1); if (!K) break; R++, d--; @@ -11515,7 +12027,7 @@ Ma.prototype._wnafMulAdd = function(e, r, n, i, s) { if (d >= 0 && R++, V = V.dblp(R), d < 0) break; for (p = 0; p < i; p++) { - var ge = te[p]; + var ge = Q[p]; ge !== 0 && (ge > 0 ? w = a[p][ge - 1 >> 1] : ge < 0 && (w = a[p][-ge - 1 >> 1].neg()), w.type === "affine" ? V = V.mixedAdd(w) : V = V.add(w)); } } @@ -11523,21 +12035,21 @@ Ma.prototype._wnafMulAdd = function(e, r, n, i, s) { a[d] = null; return s ? V : V.toP(); }; -function ns(t, e) { +function ss(t, e) { this.curve = t, this.type = e, this.precomputed = null; } -Ma.BasePoint = ns; -ns.prototype.eq = function() { +Oa.BasePoint = ss; +ss.prototype.eq = function() { throw new Error("Not implemented"); }; -ns.prototype.validate = function() { +ss.prototype.validate = function() { return this.curve.validate(this); }; -Ma.prototype.decodePoint = function(e, r) { - e = $i.toArray(e, r); +Oa.prototype.decodePoint = function(e, r) { + e = Fi.toArray(e, r); var n = this.p.byteLength(); if ((e[0] === 4 || e[0] === 6 || e[0] === 7) && e.length - 1 === 2 * n) { - e[0] === 6 ? i0(e[e.length - 1] % 2 === 0) : e[0] === 7 && i0(e[e.length - 1] % 2 === 1); + e[0] === 6 ? m0(e[e.length - 1] % 2 === 0) : e[0] === 7 && m0(e[e.length - 1] % 2 === 1); var i = this.point( e.slice(1, 1 + n), e.slice(1 + n, 1 + 2 * n) @@ -11547,17 +12059,17 @@ Ma.prototype.decodePoint = function(e, r) { return this.pointFromX(e.slice(1, 1 + n), e[0] === 3); throw new Error("Unknown point format"); }; -ns.prototype.encodeCompressed = function(e) { +ss.prototype.encodeCompressed = function(e) { return this.encode(e, !0); }; -ns.prototype._encode = function(e) { +ss.prototype._encode = function(e) { var r = this.curve.p.byteLength(), n = this.getX().toArray("be", r); return e ? [this.getY().isEven() ? 2 : 3].concat(n) : [4].concat(n, this.getY().toArray("be", r)); }; -ns.prototype.encode = function(e, r) { - return $i.encode(this._encode(r), e); +ss.prototype.encode = function(e, r) { + return Fi.encode(this._encode(r), e); }; -ns.prototype.precompute = function(e) { +ss.prototype.precompute = function(e) { if (this.precomputed) return this; var r = { @@ -11567,13 +12079,13 @@ ns.prototype.precompute = function(e) { }; return r.naf = this._getNAFPoints(8), r.doubles = this._getDoubles(4, e), r.beta = this._getBeta(), this.precomputed = r, this; }; -ns.prototype._hasDoubles = function(e) { +ss.prototype._hasDoubles = function(e) { if (!this.precomputed) return !1; var r = this.precomputed.doubles; return r ? r.points.length >= Math.ceil((e.bitLength() + 1) / r.step) : !1; }; -ns.prototype._getDoubles = function(e, r) { +ss.prototype._getDoubles = function(e, r) { if (this.precomputed && this.precomputed.doubles) return this.precomputed.doubles; for (var n = [this], i = this, s = 0; s < r; s += e) { @@ -11586,7 +12098,7 @@ ns.prototype._getDoubles = function(e, r) { points: n }; }; -ns.prototype._getNAFPoints = function(e) { +ss.prototype._getNAFPoints = function(e) { if (this.precomputed && this.precomputed.naf) return this.precomputed.naf; for (var r = [this], n = (1 << e) - 1, i = n === 1 ? null : this.dbl(), s = 1; s < n; s++) @@ -11596,15 +12108,15 @@ ns.prototype._getNAFPoints = function(e) { points: r }; }; -ns.prototype._getBeta = function() { +ss.prototype._getBeta = function() { return null; }; -ns.prototype.dblp = function(e) { +ss.prototype.dblp = function(e) { for (var r = this, n = 0; n < e; n++) r = r.dbl(); return r; }; -var Vv = Bu(function(t) { +var ab = Hu(function(t) { typeof Object.create == "function" ? t.exports = function(r, n) { n && (r.super_ = n, r.prototype = Object.create(n.prototype, { constructor: { @@ -11622,13 +12134,13 @@ var Vv = Bu(function(t) { i.prototype = n.prototype, r.prototype = new i(), r.prototype.constructor = r; } }; -}), vU = $i.assert; -function is(t) { - xc.call(this, "short", t), this.a = new sr(t.a, 16).toRed(this.red), this.b = new sr(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); +}), JU = Fi.assert; +function os(t) { + Rc.call(this, "short", t), this.a = new sr(t.a, 16).toRed(this.red), this.b = new sr(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); } -Vv(is, xc); -var bU = is; -is.prototype._getEndomorphism = function(e) { +ab(os, Rc); +var XU = os; +os.prototype._getEndomorphism = function(e) { if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { var r, n; if (e.beta) @@ -11641,7 +12153,7 @@ is.prototype._getEndomorphism = function(e) { n = new sr(e.lambda, 16); else { var s = this._getEndoRoots(this.n); - this.g.mul(s[0]).x.cmp(this.g.x.redMul(r)) === 0 ? n = s[0] : (n = s[1], vU(this.g.mul(n).x.cmp(this.g.x.redMul(r)) === 0)); + this.g.mul(s[0]).x.cmp(this.g.x.redMul(r)) === 0 ? n = s[0] : (n = s[1], JU(this.g.mul(n).x.cmp(this.g.x.redMul(r)) === 0)); } var o; return e.basis ? o = e.basis.map(function(a) { @@ -11656,33 +12168,33 @@ is.prototype._getEndomorphism = function(e) { }; } }; -is.prototype._getEndoRoots = function(e) { +os.prototype._getEndoRoots = function(e) { var r = e === this.p ? this.red : sr.mont(e), n = new sr(2).toRed(r).redInvm(), i = n.redNeg(), s = new sr(3).toRed(r).redNeg().redSqrt().redMul(n), o = i.redAdd(s).fromRed(), a = i.redSub(s).fromRed(); return [o, a]; }; -is.prototype._getEndoBasis = function(e) { - for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new sr(1), o = new sr(0), a = new sr(0), u = new sr(1), l, d, p, w, A, M, N, L = 0, B, $; n.cmpn(0) !== 0; ) { - var H = i.div(n); - B = i.sub(H.mul(n)), $ = a.sub(H.mul(s)); - var U = u.sub(H.mul(o)); +os.prototype._getEndoBasis = function(e) { + for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new sr(1), o = new sr(0), a = new sr(0), u = new sr(1), l, d, p, w, _, P, O, L = 0, B, k; n.cmpn(0) !== 0; ) { + var q = i.div(n); + B = i.sub(q.mul(n)), k = a.sub(q.mul(s)); + var U = u.sub(q.mul(o)); if (!p && B.cmp(r) < 0) - l = N.neg(), d = s, p = B.neg(), w = $; + l = O.neg(), d = s, p = B.neg(), w = k; else if (p && ++L === 2) break; - N = B, i = n, n = B, a = s, s = $, u = o, o = U; + O = B, i = n, n = B, a = s, s = k, u = o, o = U; } - A = B.neg(), M = $; - var V = p.sqr().add(w.sqr()), te = A.sqr().add(M.sqr()); - return te.cmp(V) >= 0 && (A = l, M = d), p.negative && (p = p.neg(), w = w.neg()), A.negative && (A = A.neg(), M = M.neg()), [ + _ = B.neg(), P = k; + var V = p.sqr().add(w.sqr()), Q = _.sqr().add(P.sqr()); + return Q.cmp(V) >= 0 && (_ = l, P = d), p.negative && (p = p.neg(), w = w.neg()), _.negative && (_ = _.neg(), P = P.neg()), [ { a: p, b: w }, - { a: A, b: M } + { a: _, b: P } ]; }; -is.prototype._endoSplit = function(e) { +os.prototype._endoSplit = function(e) { var r = this.endo.basis, n = r[0], i = r[1], s = i.b.mul(e).divRound(this.n), o = n.b.neg().mul(e).divRound(this.n), a = s.mul(n.a), u = o.mul(i.a), l = s.mul(n.b), d = o.mul(i.b), p = e.sub(a).sub(u), w = l.add(d).neg(); return { k1: p, k2: w }; }; -is.prototype.pointFromX = function(e, r) { +os.prototype.pointFromX = function(e, r) { e = new sr(e, 16), e.red || (e = e.toRed(this.red)); var n = e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b), i = n.redSqrt(); if (i.redSqr().redSub(n).cmp(this.zero) !== 0) @@ -11690,13 +12202,13 @@ is.prototype.pointFromX = function(e, r) { var s = i.fromRed().isOdd(); return (r && !s || !r && s) && (i = i.redNeg()), this.point(e, i); }; -is.prototype.validate = function(e) { +os.prototype.validate = function(e) { if (e.inf) return !0; var r = e.x, n = e.y, i = this.a.redMul(r), s = r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b); return n.redSqr().redISub(s).cmpn(0) === 0; }; -is.prototype._endoWnafMulAdd = function(e, r, n) { +os.prototype._endoWnafMulAdd = function(e, r, n) { for (var i = this._endoWnafT1, s = this._endoWnafT2, o = 0; o < e.length; o++) { var a = this._endoSplit(r[o]), u = e[o], l = u._getBeta(); a.k1.negative && (a.k1.ineg(), u = u.neg(!0)), a.k2.negative && (a.k2.ineg(), l = l.neg(!0)), i[o * 2] = u, i[o * 2 + 1] = l, s[o * 2] = a.k1, s[o * 2 + 1] = a.k2; @@ -11706,13 +12218,13 @@ is.prototype._endoWnafMulAdd = function(e, r, n) { return d; }; function kn(t, e, r, n) { - xc.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new sr(e, 16), this.y = new sr(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); + Rc.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new sr(e, 16), this.y = new sr(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); } -Vv(kn, xc.BasePoint); -is.prototype.point = function(e, r, n) { +ab(kn, Rc.BasePoint); +os.prototype.point = function(e, r, n) { return new kn(this, e, r, n); }; -is.prototype.pointFromJSON = function(e, r) { +os.prototype.pointFromJSON = function(e, r) { return kn.fromJSON(this, e, r); }; kn.prototype._getBeta = function() { @@ -11852,10 +12364,10 @@ kn.prototype.toJ = function() { return e; }; function zn(t, e, r, n) { - xc.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new sr(0)) : (this.x = new sr(e, 16), this.y = new sr(r, 16), this.z = new sr(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; + Rc.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new sr(0)) : (this.x = new sr(e, 16), this.y = new sr(r, 16), this.z = new sr(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; } -Vv(zn, xc.BasePoint); -is.prototype.jpoint = function(e, r, n) { +ab(zn, Rc.BasePoint); +os.prototype.jpoint = function(e, r, n) { return new zn(this, e, r, n); }; zn.prototype.toP = function() { @@ -11875,8 +12387,8 @@ zn.prototype.add = function(e) { var r = e.z.redSqr(), n = this.z.redSqr(), i = this.x.redMul(r), s = e.x.redMul(n), o = this.y.redMul(r.redMul(e.z)), a = e.y.redMul(n.redMul(this.z)), u = i.redSub(s), l = o.redSub(a); if (u.cmpn(0) === 0) return l.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var d = u.redSqr(), p = d.redMul(u), w = i.redMul(d), A = l.redSqr().redIAdd(p).redISub(w).redISub(w), M = l.redMul(w.redISub(A)).redISub(o.redMul(p)), N = this.z.redMul(e.z).redMul(u); - return this.curve.jpoint(A, M, N); + var d = u.redSqr(), p = d.redMul(u), w = i.redMul(d), _ = l.redSqr().redIAdd(p).redISub(w).redISub(w), P = l.redMul(w.redISub(_)).redISub(o.redMul(p)), O = this.z.redMul(e.z).redMul(u); + return this.curve.jpoint(_, P, O); }; zn.prototype.mixedAdd = function(e) { if (this.isInfinity()) @@ -11886,8 +12398,8 @@ zn.prototype.mixedAdd = function(e) { var r = this.z.redSqr(), n = this.x, i = e.x.redMul(r), s = this.y, o = e.y.redMul(r).redMul(this.z), a = n.redSub(i), u = s.redSub(o); if (a.cmpn(0) === 0) return u.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var l = a.redSqr(), d = l.redMul(a), p = n.redMul(l), w = u.redSqr().redIAdd(d).redISub(p).redISub(p), A = u.redMul(p.redISub(w)).redISub(s.redMul(d)), M = this.z.redMul(a); - return this.curve.jpoint(w, A, M); + var l = a.redSqr(), d = l.redMul(a), p = n.redMul(l), w = u.redSqr().redIAdd(d).redISub(p).redISub(p), _ = u.redMul(p.redISub(w)).redISub(s.redMul(d)), P = this.z.redMul(a); + return this.curve.jpoint(w, _, P); }; zn.prototype.dblp = function(e) { if (e === 0) @@ -11905,10 +12417,10 @@ zn.prototype.dblp = function(e) { } var i = this.curve.a, s = this.curve.tinv, o = this.x, a = this.y, u = this.z, l = u.redSqr().redSqr(), d = a.redAdd(a); for (r = 0; r < e; r++) { - var p = o.redSqr(), w = d.redSqr(), A = w.redSqr(), M = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), N = o.redMul(w), L = M.redSqr().redISub(N.redAdd(N)), B = N.redISub(L), $ = M.redMul(B); - $ = $.redIAdd($).redISub(A); - var H = d.redMul(u); - r + 1 < e && (l = l.redMul(A)), o = L, u = H, d = $; + var p = o.redSqr(), w = d.redSqr(), _ = w.redSqr(), P = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), O = o.redMul(w), L = P.redSqr().redISub(O.redAdd(O)), B = O.redISub(L), k = P.redMul(B); + k = k.redIAdd(k).redISub(_); + var q = d.redMul(u); + r + 1 < e && (l = l.redMul(_)), o = L, u = q, d = k; } return this.curve.jpoint(o, d.redMul(s), u); }; @@ -11923,10 +12435,10 @@ zn.prototype._zeroDbl = function() { var u = i.redAdd(i).redIAdd(i), l = u.redSqr().redISub(a).redISub(a), d = o.redIAdd(o); d = d.redIAdd(d), d = d.redIAdd(d), e = l, r = u.redMul(a.redISub(l)).redISub(d), n = this.y.redAdd(this.y); } else { - var p = this.x.redSqr(), w = this.y.redSqr(), A = w.redSqr(), M = this.x.redAdd(w).redSqr().redISub(p).redISub(A); - M = M.redIAdd(M); - var N = p.redAdd(p).redIAdd(p), L = N.redSqr(), B = A.redIAdd(A); - B = B.redIAdd(B), B = B.redIAdd(B), e = L.redISub(M).redISub(M), r = N.redMul(M.redISub(e)).redISub(B), n = this.y.redMul(this.z), n = n.redIAdd(n); + var p = this.x.redSqr(), w = this.y.redSqr(), _ = w.redSqr(), P = this.x.redAdd(w).redSqr().redISub(p).redISub(_); + P = P.redIAdd(P); + var O = p.redAdd(p).redIAdd(p), L = O.redSqr(), B = _.redIAdd(_); + B = B.redIAdd(B), B = B.redIAdd(B), e = L.redISub(P).redISub(P), r = O.redMul(P.redISub(e)).redISub(B), n = this.y.redMul(this.z), n = n.redIAdd(n); } return this.curve.jpoint(e, r, n); }; @@ -11940,24 +12452,24 @@ zn.prototype._threeDbl = function() { var d = o.redIAdd(o); d = d.redIAdd(d), d = d.redIAdd(d), r = u.redMul(a.redISub(l)).redISub(d), n = this.y.redAdd(this.y); } else { - var p = this.z.redSqr(), w = this.y.redSqr(), A = this.x.redMul(w), M = this.x.redSub(p).redMul(this.x.redAdd(p)); - M = M.redAdd(M).redIAdd(M); - var N = A.redIAdd(A); - N = N.redIAdd(N); - var L = N.redAdd(N); - e = M.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(p); + var p = this.z.redSqr(), w = this.y.redSqr(), _ = this.x.redMul(w), P = this.x.redSub(p).redMul(this.x.redAdd(p)); + P = P.redAdd(P).redIAdd(P); + var O = _.redIAdd(_); + O = O.redIAdd(O); + var L = O.redAdd(O); + e = P.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(p); var B = w.redSqr(); - B = B.redIAdd(B), B = B.redIAdd(B), B = B.redIAdd(B), r = M.redMul(N.redISub(e)).redISub(B); + B = B.redIAdd(B), B = B.redIAdd(B), B = B.redIAdd(B), r = P.redMul(O.redISub(e)).redISub(B); } return this.curve.jpoint(e, r, n); }; zn.prototype._dbl = function() { var e = this.curve.a, r = this.x, n = this.y, i = this.z, s = i.redSqr().redSqr(), o = r.redSqr(), a = n.redSqr(), u = o.redAdd(o).redIAdd(o).redIAdd(e.redMul(s)), l = r.redAdd(r); l = l.redIAdd(l); - var d = l.redMul(a), p = u.redSqr().redISub(d.redAdd(d)), w = d.redISub(p), A = a.redSqr(); - A = A.redIAdd(A), A = A.redIAdd(A), A = A.redIAdd(A); - var M = u.redMul(w).redISub(A), N = n.redAdd(n).redMul(i); - return this.curve.jpoint(p, M, N); + var d = l.redMul(a), p = u.redSqr().redISub(d.redAdd(d)), w = d.redISub(p), _ = a.redSqr(); + _ = _.redIAdd(_), _ = _.redIAdd(_), _ = _.redIAdd(_); + var P = u.redMul(w).redISub(_), O = n.redAdd(n).redMul(i); + return this.curve.jpoint(p, P, O); }; zn.prototype.trpl = function() { if (!this.curve.zeroA) @@ -11970,10 +12482,10 @@ zn.prototype.trpl = function() { p = p.redIAdd(p), p = p.redIAdd(p); var w = this.x.redMul(u).redISub(p); w = w.redIAdd(w), w = w.redIAdd(w); - var A = this.y.redMul(d.redMul(l.redISub(d)).redISub(a.redMul(u))); - A = A.redIAdd(A), A = A.redIAdd(A), A = A.redIAdd(A); - var M = this.z.redAdd(a).redSqr().redISub(n).redISub(u); - return this.curve.jpoint(w, A, M); + var _ = this.y.redMul(d.redMul(l.redISub(d)).redISub(a.redMul(u))); + _ = _.redIAdd(_), _ = _.redIAdd(_), _ = _.redIAdd(_); + var P = this.z.redAdd(a).redSqr().redISub(n).redISub(u); + return this.curve.jpoint(w, _, P); }; zn.prototype.mul = function(e, r) { return e = new sr(e, r), this.curve._wnafMul(this, e); @@ -12006,15 +12518,15 @@ zn.prototype.inspect = function() { zn.prototype.isInfinity = function() { return this.z.cmpn(0) === 0; }; -var Pd = Bu(function(t, e) { +var Bd = Hu(function(t, e) { var r = e; - r.base = xc, r.short = bU, r.mont = /*RicMoo:ethers:require(./mont)*/ + r.base = Rc, r.short = XU, r.mont = /*RicMoo:ethers:require(./mont)*/ null, r.edwards = /*RicMoo:ethers:require(./edwards)*/ null; -}), Md = Bu(function(t, e) { - var r = e, n = $i.assert; +}), Fd = Hu(function(t, e) { + var r = e, n = Fi.assert; function i(a) { - a.type === "short" ? this.curve = new Pd.short(a) : a.type === "edwards" ? this.curve = new Pd.edwards(a) : this.curve = new Pd.mont(a), this.g = this.curve.g, this.n = this.curve.n, this.hash = a.hash, n(this.g.validate(), "Invalid curve"), n(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); + a.type === "short" ? this.curve = new Bd.short(a) : a.type === "edwards" ? this.curve = new Bd.edwards(a) : this.curve = new Bd.mont(a), this.g = this.curve.g, this.n = this.curve.n, this.hash = a.hash, n(this.g.validate(), "Invalid curve"), n(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); } r.PresetCurve = i; function s(a, u) { @@ -12038,7 +12550,7 @@ var Pd = Bu(function(t, e) { a: "ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc", b: "64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1", n: "ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831", - hash: yo.sha256, + hash: Eo.sha256, gRed: !1, g: [ "188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012", @@ -12051,7 +12563,7 @@ var Pd = Bu(function(t, e) { a: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe", b: "b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4", n: "ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d", - hash: yo.sha256, + hash: Eo.sha256, gRed: !1, g: [ "b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21", @@ -12064,7 +12576,7 @@ var Pd = Bu(function(t, e) { a: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc", b: "5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b", n: "ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551", - hash: yo.sha256, + hash: Eo.sha256, gRed: !1, g: [ "6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296", @@ -12077,7 +12589,7 @@ var Pd = Bu(function(t, e) { a: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc", b: "b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef", n: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973", - hash: yo.sha384, + hash: Eo.sha384, gRed: !1, g: [ "aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7", @@ -12090,7 +12602,7 @@ var Pd = Bu(function(t, e) { a: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc", b: "00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00", n: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409", - hash: yo.sha512, + hash: Eo.sha512, gRed: !1, g: [ "000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66", @@ -12103,7 +12615,7 @@ var Pd = Bu(function(t, e) { a: "76d06", b: "1", n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", - hash: yo.sha256, + hash: Eo.sha256, gRed: !1, g: [ "9" @@ -12117,7 +12629,7 @@ var Pd = Bu(function(t, e) { // -121665 * (121666^(-1)) (mod P) d: "52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3", n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", - hash: yo.sha256, + hash: Eo.sha256, gRed: !1, g: [ "216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a", @@ -12140,7 +12652,7 @@ var Pd = Bu(function(t, e) { b: "7", n: "ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141", h: "1", - hash: yo.sha256, + hash: Eo.sha256, // Precomputed endomorphism beta: "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee", lambda: "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72", @@ -12162,106 +12674,106 @@ var Pd = Bu(function(t, e) { ] }); }); -function ba(t) { - if (!(this instanceof ba)) - return new ba(t); +function Sa(t) { + if (!(this instanceof Sa)) + return new Sa(t); this.hash = t.hash, this.predResist = !!t.predResist, this.outLen = this.hash.outSize, this.minEntropy = t.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null; - var e = xs.toArray(t.entropy, t.entropyEnc || "hex"), r = xs.toArray(t.nonce, t.nonceEnc || "hex"), n = xs.toArray(t.pers, t.persEnc || "hex"); - Kv( + var e = Ss.toArray(t.entropy, t.entropyEnc || "hex"), r = Ss.toArray(t.nonce, t.nonceEnc || "hex"), n = Ss.toArray(t.pers, t.persEnc || "hex"); + ob( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._init(e, r, n); } -var p8 = ba; -ba.prototype._init = function(e, r, n) { +var q8 = Sa; +Sa.prototype._init = function(e, r, n) { var i = e.concat(r).concat(n); this.K = new Array(this.outLen / 8), this.V = new Array(this.outLen / 8); for (var s = 0; s < this.V.length; s++) this.K[s] = 0, this.V[s] = 1; this._update(i), this._reseed = 1, this.reseedInterval = 281474976710656; }; -ba.prototype._hmac = function() { - return new yo.hmac(this.hash, this.K); +Sa.prototype._hmac = function() { + return new Eo.hmac(this.hash, this.K); }; -ba.prototype._update = function(e) { +Sa.prototype._update = function(e) { var r = this._hmac().update(this.V).update([0]); e && (r = r.update(e)), this.K = r.digest(), this.V = this._hmac().update(this.V).digest(), e && (this.K = this._hmac().update(this.V).update([1]).update(e).digest(), this.V = this._hmac().update(this.V).digest()); }; -ba.prototype.reseed = function(e, r, n, i) { - typeof r != "string" && (i = n, n = r, r = null), e = xs.toArray(e, r), n = xs.toArray(n, i), Kv( +Sa.prototype.reseed = function(e, r, n, i) { + typeof r != "string" && (i = n, n = r, r = null), e = Ss.toArray(e, r), n = Ss.toArray(n, i), ob( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._update(e.concat(n || [])), this._reseed = 1; }; -ba.prototype.generate = function(e, r, n, i) { +Sa.prototype.generate = function(e, r, n, i) { if (this._reseed > this.reseedInterval) throw new Error("Reseed is required"); - typeof r != "string" && (i = n, n = r, r = null), n && (n = xs.toArray(n, i || "hex"), this._update(n)); + typeof r != "string" && (i = n, n = r, r = null), n && (n = Ss.toArray(n, i || "hex"), this._update(n)); for (var s = []; s.length < e; ) this.V = this._hmac().update(this.V).digest(), s = s.concat(this.V); var o = s.slice(0, e); - return this._update(n), this._reseed++, xs.encode(o, r); + return this._update(n), this._reseed++, Ss.encode(o, r); }; -var E1 = $i.assert; -function Qn(t, e) { +var F1 = Fi.assert; +function ei(t, e) { this.ec = t, this.priv = null, this.pub = null, e.priv && this._importPrivate(e.priv, e.privEnc), e.pub && this._importPublic(e.pub, e.pubEnc); } -var Gv = Qn; -Qn.fromPublic = function(e, r, n) { - return r instanceof Qn ? r : new Qn(e, { +var cb = ei; +ei.fromPublic = function(e, r, n) { + return r instanceof ei ? r : new ei(e, { pub: r, pubEnc: n }); }; -Qn.fromPrivate = function(e, r, n) { - return r instanceof Qn ? r : new Qn(e, { +ei.fromPrivate = function(e, r, n) { + return r instanceof ei ? r : new ei(e, { priv: r, privEnc: n }); }; -Qn.prototype.validate = function() { +ei.prototype.validate = function() { var e = this.getPublic(); return e.isInfinity() ? { result: !1, reason: "Invalid public key" } : e.validate() ? e.mul(this.ec.curve.n).isInfinity() ? { result: !0, reason: null } : { result: !1, reason: "Public key * N != O" } : { result: !1, reason: "Public key is not a point" }; }; -Qn.prototype.getPublic = function(e, r) { +ei.prototype.getPublic = function(e, r) { return typeof e == "string" && (r = e, e = null), this.pub || (this.pub = this.ec.g.mul(this.priv)), r ? this.pub.encode(r, e) : this.pub; }; -Qn.prototype.getPrivate = function(e) { +ei.prototype.getPrivate = function(e) { return e === "hex" ? this.priv.toString(16, 2) : this.priv; }; -Qn.prototype._importPrivate = function(e, r) { +ei.prototype._importPrivate = function(e, r) { this.priv = new sr(e, r || 16), this.priv = this.priv.umod(this.ec.curve.n); }; -Qn.prototype._importPublic = function(e, r) { +ei.prototype._importPublic = function(e, r) { if (e.x || e.y) { - this.ec.curve.type === "mont" ? E1(e.x, "Need x coordinate") : (this.ec.curve.type === "short" || this.ec.curve.type === "edwards") && E1(e.x && e.y, "Need both x and y coordinate"), this.pub = this.ec.curve.point(e.x, e.y); + this.ec.curve.type === "mont" ? F1(e.x, "Need x coordinate") : (this.ec.curve.type === "short" || this.ec.curve.type === "edwards") && F1(e.x && e.y, "Need both x and y coordinate"), this.pub = this.ec.curve.point(e.x, e.y); return; } this.pub = this.ec.curve.decodePoint(e, r); }; -Qn.prototype.derive = function(e) { - return e.validate() || E1(e.validate(), "public point not validated"), e.mul(this.priv).getX(); +ei.prototype.derive = function(e) { + return e.validate() || F1(e.validate(), "public point not validated"), e.mul(this.priv).getX(); }; -Qn.prototype.sign = function(e, r, n) { +ei.prototype.sign = function(e, r, n) { return this.ec.sign(e, this, r, n); }; -Qn.prototype.verify = function(e, r) { +ei.prototype.verify = function(e, r) { return this.ec.verify(e, r, this); }; -Qn.prototype.inspect = function() { +ei.prototype.inspect = function() { return ""; }; -var yU = $i.assert; -function H0(t, e) { - if (t instanceof H0) +var ZU = Fi.assert; +function sp(t, e) { + if (t instanceof sp) return t; - this._importDER(t, e) || (yU(t.r && t.s, "Signature without r or s"), this.r = new sr(t.r, 16), this.s = new sr(t.s, 16), t.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = t.recoveryParam); + this._importDER(t, e) || (ZU(t.r && t.s, "Signature without r or s"), this.r = new sr(t.r, 16), this.s = new sr(t.s, 16), t.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = t.recoveryParam); } -var K0 = H0; -function wU() { +var op = sp; +function QU() { this.place = 0; } -function im(t, e) { +function bm(t, e) { var r = t[e.place++]; if (!(r & 128)) return r; @@ -12272,26 +12784,26 @@ function im(t, e) { i <<= 8, i |= t[o], i >>>= 0; return i <= 127 ? !1 : (e.place = o, i); } -function Px(t) { +function qx(t) { for (var e = 0, r = t.length - 1; !t[e] && !(t[e + 1] & 128) && e < r; ) e++; return e === 0 ? t : t.slice(e); } -H0.prototype._importDER = function(e, r) { - e = $i.toArray(e, r); - var n = new wU(); +sp.prototype._importDER = function(e, r) { + e = Fi.toArray(e, r); + var n = new QU(); if (e[n.place++] !== 48) return !1; - var i = im(e, n); + var i = bm(e, n); if (i === !1 || i + n.place !== e.length || e[n.place++] !== 2) return !1; - var s = im(e, n); + var s = bm(e, n); if (s === !1) return !1; var o = e.slice(n.place, s + n.place); if (n.place += s, e[n.place++] !== 2) return !1; - var a = im(e, n); + var a = bm(e, n); if (a === !1 || e.length !== a + n.place) return !1; var u = e.slice(n.place, a + n.place); @@ -12307,7 +12819,7 @@ H0.prototype._importDER = function(e, r) { return !1; return this.r = new sr(o), this.s = new sr(u), this.recoveryParam = null, !0; }; -function sm(t, e) { +function ym(t, e) { if (e < 128) { t.push(e); return; @@ -12317,46 +12829,46 @@ function sm(t, e) { t.push(e >>> (r << 3) & 255); t.push(e); } -H0.prototype.toDER = function(e) { +sp.prototype.toDER = function(e) { var r = this.r.toArray(), n = this.s.toArray(); - for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Px(r), n = Px(n); !n[0] && !(n[1] & 128); ) + for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = qx(r), n = qx(n); !n[0] && !(n[1] & 128); ) n = n.slice(1); var i = [2]; - sm(i, r.length), i = i.concat(r), i.push(2), sm(i, n.length); + ym(i, r.length), i = i.concat(r), i.push(2), ym(i, n.length); var s = i.concat(n), o = [48]; - return sm(o, s.length), o = o.concat(s), $i.encode(o, e); + return ym(o, s.length), o = o.concat(s), Fi.encode(o, e); }; -var xU = ( +var eq = ( /*RicMoo:ethers:require(brorand)*/ function() { throw new Error("unsupported"); } -), g8 = $i.assert; -function Qi(t) { - if (!(this instanceof Qi)) - return new Qi(t); - typeof t == "string" && (g8( - Object.prototype.hasOwnProperty.call(Md, t), +), z8 = Fi.assert; +function ts(t) { + if (!(this instanceof ts)) + return new ts(t); + typeof t == "string" && (z8( + Object.prototype.hasOwnProperty.call(Fd, t), "Unknown curve " + t - ), t = Md[t]), t instanceof Md.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; + ), t = Fd[t]), t instanceof Fd.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; } -var _U = Qi; -Qi.prototype.keyPair = function(e) { - return new Gv(this, e); +var tq = ts; +ts.prototype.keyPair = function(e) { + return new cb(this, e); }; -Qi.prototype.keyFromPrivate = function(e, r) { - return Gv.fromPrivate(this, e, r); +ts.prototype.keyFromPrivate = function(e, r) { + return cb.fromPrivate(this, e, r); }; -Qi.prototype.keyFromPublic = function(e, r) { - return Gv.fromPublic(this, e, r); +ts.prototype.keyFromPublic = function(e, r) { + return cb.fromPublic(this, e, r); }; -Qi.prototype.genKeyPair = function(e) { +ts.prototype.genKeyPair = function(e) { e || (e = {}); - for (var r = new p8({ + for (var r = new q8({ hash: this.hash, pers: e.pers, persEnc: e.persEnc || "utf8", - entropy: e.entropy || xU(this.hash.hmacStrength), + entropy: e.entropy || eq(this.hash.hmacStrength), entropyEnc: e.entropy && e.entropyEnc || "utf8", nonce: this.n.toArray() }), n = this.n.byteLength(), i = this.n.sub(new sr(2)); ; ) { @@ -12365,13 +12877,13 @@ Qi.prototype.genKeyPair = function(e) { return s.iaddn(1), this.keyFromPrivate(s); } }; -Qi.prototype._truncateToN = function(e, r) { +ts.prototype._truncateToN = function(e, r) { var n = e.byteLength() * 8 - this.n.bitLength(); return n > 0 && (e = e.ushrn(n)), !r && e.cmp(this.n) >= 0 ? e.sub(this.n) : e; }; -Qi.prototype.sign = function(e, r, n, i) { +ts.prototype.sign = function(e, r, n, i) { typeof n == "object" && (i = n, n = null), i || (i = {}), r = this.keyFromPrivate(r, n), e = this._truncateToN(new sr(e, 16)); - for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new p8({ + for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new q8({ hash: this.hash, entropy: o, nonce: a, @@ -12382,28 +12894,28 @@ Qi.prototype.sign = function(e, r, n, i) { if (p = this._truncateToN(p, !0), !(p.cmpn(1) <= 0 || p.cmp(l) >= 0)) { var w = this.g.mul(p); if (!w.isInfinity()) { - var A = w.getX(), M = A.umod(this.n); - if (M.cmpn(0) !== 0) { - var N = p.invm(this.n).mul(M.mul(r.getPrivate()).iadd(e)); - if (N = N.umod(this.n), N.cmpn(0) !== 0) { - var L = (w.getY().isOdd() ? 1 : 0) | (A.cmp(M) !== 0 ? 2 : 0); - return i.canonical && N.cmp(this.nh) > 0 && (N = this.n.sub(N), L ^= 1), new K0({ r: M, s: N, recoveryParam: L }); + var _ = w.getX(), P = _.umod(this.n); + if (P.cmpn(0) !== 0) { + var O = p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e)); + if (O = O.umod(this.n), O.cmpn(0) !== 0) { + var L = (w.getY().isOdd() ? 1 : 0) | (_.cmp(P) !== 0 ? 2 : 0); + return i.canonical && O.cmp(this.nh) > 0 && (O = this.n.sub(O), L ^= 1), new op({ r: P, s: O, recoveryParam: L }); } } } } } }; -Qi.prototype.verify = function(e, r, n, i) { - e = this._truncateToN(new sr(e, 16)), n = this.keyFromPublic(n, i), r = new K0(r, "hex"); +ts.prototype.verify = function(e, r, n, i) { + e = this._truncateToN(new sr(e, 16)), n = this.keyFromPublic(n, i), r = new op(r, "hex"); var s = r.r, o = r.s; if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0 || o.cmpn(1) < 0 || o.cmp(this.n) >= 0) return !1; var a = o.invm(this.n), u = a.mul(e).umod(this.n), l = a.mul(s).umod(this.n), d; return this.curve._maxwellTrick ? (d = this.g.jmulAdd(u, n.getPublic(), l), d.isInfinity() ? !1 : d.eqXToP(s)) : (d = this.g.mulAdd(u, n.getPublic(), l), d.isInfinity() ? !1 : d.getX().umod(this.n).cmp(s) === 0); }; -Qi.prototype.recoverPubKey = function(t, e, r, n) { - g8((3 & r) === r, "The recovery param is more than two bits"), e = new K0(e, n); +ts.prototype.recoverPubKey = function(t, e, r, n) { + z8((3 & r) === r, "The recovery param is more than two bits"), e = new op(e, n); var i = this.n, s = new sr(t), o = e.r, a = e.s, u = r & 1, l = r >> 1; if (o.cmp(this.curve.p.umod(this.curve.n)) >= 0 && l) throw new Error("Unable to find sencond key candinate"); @@ -12411,8 +12923,8 @@ Qi.prototype.recoverPubKey = function(t, e, r, n) { var d = e.r.invm(i), p = i.sub(s).mul(d).umod(i), w = a.mul(d).umod(i); return this.g.mulAdd(p, o, w); }; -Qi.prototype.getKeyRecoveryParam = function(t, e, r, n) { - if (e = new K0(e, n), e.recoveryParam !== null) +ts.prototype.getKeyRecoveryParam = function(t, e, r, n) { + if (e = new op(e, n), e.recoveryParam !== null) return e.recoveryParam; for (var i = 0; i < 4; i++) { var s; @@ -12426,75 +12938,75 @@ Qi.prototype.getKeyRecoveryParam = function(t, e, r, n) { } throw new Error("Unable to find valid recovery factor"); }; -var EU = Bu(function(t, e) { +var rq = Hu(function(t, e) { var r = e; - r.version = "6.5.4", r.utils = $i, r.rand = /*RicMoo:ethers:require(brorand)*/ + r.version = "6.5.4", r.utils = Fi, r.rand = /*RicMoo:ethers:require(brorand)*/ function() { throw new Error("unsupported"); - }, r.curve = Pd, r.curves = Md, r.ec = _U, r.eddsa = /*RicMoo:ethers:require(./elliptic/eddsa)*/ + }, r.curve = Bd, r.curves = Fd, r.ec = tq, r.eddsa = /*RicMoo:ethers:require(./elliptic/eddsa)*/ null; -}), SU = EU.ec; -const AU = "signing-key/5.7.0", S1 = new Yr(AU); -let om = null; -function aa() { - return om || (om = new SU("secp256k1")), om; +}), nq = rq.ec; +const iq = "signing-key/5.7.0", j1 = new Yr(iq); +let wm = null; +function ua() { + return wm || (wm = new nq("secp256k1")), wm; } -class PU { +class sq { constructor(e) { - _f(this, "curve", "secp256k1"), _f(this, "privateKey", Ri(e)), RF(this.privateKey) !== 32 && S1.throwArgumentError("invalid private key", "privateKey", "[[ REDACTED ]]"); - const r = aa().keyFromPrivate(wn(this.privateKey)); - _f(this, "publicKey", "0x" + r.getPublic(!1, "hex")), _f(this, "compressedPublicKey", "0x" + r.getPublic(!0, "hex")), _f(this, "_isSigningKey", !0); + Cf(this, "curve", "secp256k1"), Cf(this, "privateKey", Di(e)), fj(this.privateKey) !== 32 && j1.throwArgumentError("invalid private key", "privateKey", "[[ REDACTED ]]"); + const r = ua().keyFromPrivate(wn(this.privateKey)); + Cf(this, "publicKey", "0x" + r.getPublic(!1, "hex")), Cf(this, "compressedPublicKey", "0x" + r.getPublic(!0, "hex")), Cf(this, "_isSigningKey", !0); } _addPoint(e) { - const r = aa().keyFromPublic(wn(this.publicKey)), n = aa().keyFromPublic(wn(e)); + const r = ua().keyFromPublic(wn(this.publicKey)), n = ua().keyFromPublic(wn(e)); return "0x" + r.pub.add(n.pub).encodeCompressed("hex"); } signDigest(e) { - const r = aa().keyFromPrivate(wn(this.privateKey)), n = wn(e); - n.length !== 32 && S1.throwArgumentError("bad digest length", "digest", e); + const r = ua().keyFromPrivate(wn(this.privateKey)), n = wn(e); + n.length !== 32 && j1.throwArgumentError("bad digest length", "digest", e); const i = r.sign(n, { canonical: !0 }); - return V4({ + return x8({ recoveryParam: i.recoveryParam, - r: lu("0x" + i.r.toString(16), 32), - s: lu("0x" + i.s.toString(16), 32) + r: xu("0x" + i.r.toString(16), 32), + s: xu("0x" + i.s.toString(16), 32) }); } computeSharedSecret(e) { - const r = aa().keyFromPrivate(wn(this.privateKey)), n = aa().keyFromPublic(wn(m8(e))); - return lu("0x" + r.derive(n.getPublic()).toString(16), 32); + const r = ua().keyFromPrivate(wn(this.privateKey)), n = ua().keyFromPublic(wn(W8(e))); + return xu("0x" + r.derive(n.getPublic()).toString(16), 32); } static isSigningKey(e) { return !!(e && e._isSigningKey); } } -function MU(t, e) { - const r = V4(e), n = { r: wn(r.r), s: wn(r.s) }; - return "0x" + aa().recoverPubKey(wn(t), n, r.recoveryParam).encode("hex", !1); +function oq(t, e) { + const r = x8(e), n = { r: wn(r.r), s: wn(r.s) }; + return "0x" + ua().recoverPubKey(wn(t), n, r.recoveryParam).encode("hex", !1); } -function m8(t, e) { +function W8(t, e) { const r = wn(t); - return r.length === 32 ? new PU(r).publicKey : r.length === 33 ? "0x" + aa().keyFromPublic(r).getPublic(!1, "hex") : r.length === 65 ? Ri(r) : S1.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); + return r.length === 32 ? new sq(r).publicKey : r.length === 33 ? "0x" + ua().keyFromPublic(r).getPublic(!1, "hex") : r.length === 65 ? Di(r) : j1.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); } -var Mx; +var zx; (function(t) { t[t.legacy = 0] = "legacy", t[t.eip2930 = 1] = "eip2930", t[t.eip1559 = 2] = "eip1559"; -})(Mx || (Mx = {})); -function IU(t) { - const e = m8(t); - return qF(bx(zv(bx(e, 1)), 12)); -} -function CU(t, e) { - return IU(MU(wn(t), e)); -} -var Yv = {}, V0 = {}; -Object.defineProperty(V0, "__esModule", { value: !0 }); -var Gn = ar, A1 = ki, TU = 20; -function RU(t, e, r) { - for (var n = 1634760805, i = 857760878, s = 2036477234, o = 1797285236, a = r[3] << 24 | r[2] << 16 | r[1] << 8 | r[0], u = r[7] << 24 | r[6] << 16 | r[5] << 8 | r[4], l = r[11] << 24 | r[10] << 16 | r[9] << 8 | r[8], d = r[15] << 24 | r[14] << 16 | r[13] << 8 | r[12], p = r[19] << 24 | r[18] << 16 | r[17] << 8 | r[16], w = r[23] << 24 | r[22] << 16 | r[21] << 8 | r[20], A = r[27] << 24 | r[26] << 16 | r[25] << 8 | r[24], M = r[31] << 24 | r[30] << 16 | r[29] << 8 | r[28], N = e[3] << 24 | e[2] << 16 | e[1] << 8 | e[0], L = e[7] << 24 | e[6] << 16 | e[5] << 8 | e[4], B = e[11] << 24 | e[10] << 16 | e[9] << 8 | e[8], $ = e[15] << 24 | e[14] << 16 | e[13] << 8 | e[12], H = n, U = i, V = s, te = o, R = a, K = u, ge = l, Ee = d, Y = p, S = w, m = A, f = M, g = N, b = L, x = B, _ = $, E = 0; E < TU; E += 2) - H = H + R | 0, g ^= H, g = g >>> 16 | g << 16, Y = Y + g | 0, R ^= Y, R = R >>> 20 | R << 12, U = U + K | 0, b ^= U, b = b >>> 16 | b << 16, S = S + b | 0, K ^= S, K = K >>> 20 | K << 12, V = V + ge | 0, x ^= V, x = x >>> 16 | x << 16, m = m + x | 0, ge ^= m, ge = ge >>> 20 | ge << 12, te = te + Ee | 0, _ ^= te, _ = _ >>> 16 | _ << 16, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 20 | Ee << 12, V = V + ge | 0, x ^= V, x = x >>> 24 | x << 8, m = m + x | 0, ge ^= m, ge = ge >>> 25 | ge << 7, te = te + Ee | 0, _ ^= te, _ = _ >>> 24 | _ << 8, f = f + _ | 0, Ee ^= f, Ee = Ee >>> 25 | Ee << 7, U = U + K | 0, b ^= U, b = b >>> 24 | b << 8, S = S + b | 0, K ^= S, K = K >>> 25 | K << 7, H = H + R | 0, g ^= H, g = g >>> 24 | g << 8, Y = Y + g | 0, R ^= Y, R = R >>> 25 | R << 7, H = H + K | 0, _ ^= H, _ = _ >>> 16 | _ << 16, m = m + _ | 0, K ^= m, K = K >>> 20 | K << 12, U = U + ge | 0, g ^= U, g = g >>> 16 | g << 16, f = f + g | 0, ge ^= f, ge = ge >>> 20 | ge << 12, V = V + Ee | 0, b ^= V, b = b >>> 16 | b << 16, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 20 | Ee << 12, te = te + R | 0, x ^= te, x = x >>> 16 | x << 16, S = S + x | 0, R ^= S, R = R >>> 20 | R << 12, V = V + Ee | 0, b ^= V, b = b >>> 24 | b << 8, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 25 | Ee << 7, te = te + R | 0, x ^= te, x = x >>> 24 | x << 8, S = S + x | 0, R ^= S, R = R >>> 25 | R << 7, U = U + ge | 0, g ^= U, g = g >>> 24 | g << 8, f = f + g | 0, ge ^= f, ge = ge >>> 25 | ge << 7, H = H + K | 0, _ ^= H, _ = _ >>> 24 | _ << 8, m = m + _ | 0, K ^= m, K = K >>> 25 | K << 7; - Gn.writeUint32LE(H + n | 0, t, 0), Gn.writeUint32LE(U + i | 0, t, 4), Gn.writeUint32LE(V + s | 0, t, 8), Gn.writeUint32LE(te + o | 0, t, 12), Gn.writeUint32LE(R + a | 0, t, 16), Gn.writeUint32LE(K + u | 0, t, 20), Gn.writeUint32LE(ge + l | 0, t, 24), Gn.writeUint32LE(Ee + d | 0, t, 28), Gn.writeUint32LE(Y + p | 0, t, 32), Gn.writeUint32LE(S + w | 0, t, 36), Gn.writeUint32LE(m + A | 0, t, 40), Gn.writeUint32LE(f + M | 0, t, 44), Gn.writeUint32LE(g + N | 0, t, 48), Gn.writeUint32LE(b + L | 0, t, 52), Gn.writeUint32LE(x + B | 0, t, 56), Gn.writeUint32LE(_ + $ | 0, t, 60); -} -function v8(t, e, r, n, i) { +})(zx || (zx = {})); +function aq(t) { + const e = W8(t); + return xj(Nx(nb(Nx(e, 1)), 12)); +} +function cq(t, e) { + return aq(oq(wn(t), e)); +} +var ub = {}, ap = {}; +Object.defineProperty(ap, "__esModule", { value: !0 }); +var Gn = ar, U1 = Bi, uq = 20; +function fq(t, e, r) { + for (var n = 1634760805, i = 857760878, s = 2036477234, o = 1797285236, a = r[3] << 24 | r[2] << 16 | r[1] << 8 | r[0], u = r[7] << 24 | r[6] << 16 | r[5] << 8 | r[4], l = r[11] << 24 | r[10] << 16 | r[9] << 8 | r[8], d = r[15] << 24 | r[14] << 16 | r[13] << 8 | r[12], p = r[19] << 24 | r[18] << 16 | r[17] << 8 | r[16], w = r[23] << 24 | r[22] << 16 | r[21] << 8 | r[20], _ = r[27] << 24 | r[26] << 16 | r[25] << 8 | r[24], P = r[31] << 24 | r[30] << 16 | r[29] << 8 | r[28], O = e[3] << 24 | e[2] << 16 | e[1] << 8 | e[0], L = e[7] << 24 | e[6] << 16 | e[5] << 8 | e[4], B = e[11] << 24 | e[10] << 16 | e[9] << 8 | e[8], k = e[15] << 24 | e[14] << 16 | e[13] << 8 | e[12], q = n, U = i, V = s, Q = o, R = a, K = u, ge = l, Ee = d, Y = p, A = w, m = _, f = P, g = O, b = L, x = B, E = k, S = 0; S < uq; S += 2) + q = q + R | 0, g ^= q, g = g >>> 16 | g << 16, Y = Y + g | 0, R ^= Y, R = R >>> 20 | R << 12, U = U + K | 0, b ^= U, b = b >>> 16 | b << 16, A = A + b | 0, K ^= A, K = K >>> 20 | K << 12, V = V + ge | 0, x ^= V, x = x >>> 16 | x << 16, m = m + x | 0, ge ^= m, ge = ge >>> 20 | ge << 12, Q = Q + Ee | 0, E ^= Q, E = E >>> 16 | E << 16, f = f + E | 0, Ee ^= f, Ee = Ee >>> 20 | Ee << 12, V = V + ge | 0, x ^= V, x = x >>> 24 | x << 8, m = m + x | 0, ge ^= m, ge = ge >>> 25 | ge << 7, Q = Q + Ee | 0, E ^= Q, E = E >>> 24 | E << 8, f = f + E | 0, Ee ^= f, Ee = Ee >>> 25 | Ee << 7, U = U + K | 0, b ^= U, b = b >>> 24 | b << 8, A = A + b | 0, K ^= A, K = K >>> 25 | K << 7, q = q + R | 0, g ^= q, g = g >>> 24 | g << 8, Y = Y + g | 0, R ^= Y, R = R >>> 25 | R << 7, q = q + K | 0, E ^= q, E = E >>> 16 | E << 16, m = m + E | 0, K ^= m, K = K >>> 20 | K << 12, U = U + ge | 0, g ^= U, g = g >>> 16 | g << 16, f = f + g | 0, ge ^= f, ge = ge >>> 20 | ge << 12, V = V + Ee | 0, b ^= V, b = b >>> 16 | b << 16, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 20 | Ee << 12, Q = Q + R | 0, x ^= Q, x = x >>> 16 | x << 16, A = A + x | 0, R ^= A, R = R >>> 20 | R << 12, V = V + Ee | 0, b ^= V, b = b >>> 24 | b << 8, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 25 | Ee << 7, Q = Q + R | 0, x ^= Q, x = x >>> 24 | x << 8, A = A + x | 0, R ^= A, R = R >>> 25 | R << 7, U = U + ge | 0, g ^= U, g = g >>> 24 | g << 8, f = f + g | 0, ge ^= f, ge = ge >>> 25 | ge << 7, q = q + K | 0, E ^= q, E = E >>> 24 | E << 8, m = m + E | 0, K ^= m, K = K >>> 25 | K << 7; + Gn.writeUint32LE(q + n | 0, t, 0), Gn.writeUint32LE(U + i | 0, t, 4), Gn.writeUint32LE(V + s | 0, t, 8), Gn.writeUint32LE(Q + o | 0, t, 12), Gn.writeUint32LE(R + a | 0, t, 16), Gn.writeUint32LE(K + u | 0, t, 20), Gn.writeUint32LE(ge + l | 0, t, 24), Gn.writeUint32LE(Ee + d | 0, t, 28), Gn.writeUint32LE(Y + p | 0, t, 32), Gn.writeUint32LE(A + w | 0, t, 36), Gn.writeUint32LE(m + _ | 0, t, 40), Gn.writeUint32LE(f + P | 0, t, 44), Gn.writeUint32LE(g + O | 0, t, 48), Gn.writeUint32LE(b + L | 0, t, 52), Gn.writeUint32LE(x + B | 0, t, 56), Gn.writeUint32LE(E + k | 0, t, 60); +} +function H8(t, e, r, n, i) { if (i === void 0 && (i = 0), t.length !== 32) throw new Error("ChaCha: key size must be 32 bytes"); if (n.length < r.length) @@ -12510,49 +13022,49 @@ function v8(t, e, r, n, i) { s = e, o = i; } for (var a = new Uint8Array(64), u = 0; u < r.length; u += 64) { - RU(a, s, t); + fq(a, s, t); for (var l = u; l < u + 64 && l < r.length; l++) n[l] = r[l] ^ a[l - u]; - OU(s, 0, o); + hq(s, 0, o); } - return A1.wipe(a), i === 0 && A1.wipe(s), n; + return U1.wipe(a), i === 0 && U1.wipe(s), n; } -V0.streamXOR = v8; -function DU(t, e, r, n) { - return n === void 0 && (n = 0), A1.wipe(r), v8(t, e, r, r, n); +ap.streamXOR = H8; +function lq(t, e, r, n) { + return n === void 0 && (n = 0), U1.wipe(r), H8(t, e, r, r, n); } -V0.stream = DU; -function OU(t, e, r) { +ap.stream = lq; +function hq(t, e, r) { for (var n = 1; r--; ) n = n + (t[e] & 255) | 0, t[e] = n & 255, n >>>= 8, e++; if (n > 0) throw new Error("ChaCha: counter overflow"); } -var b8 = {}, Ia = {}; -Object.defineProperty(Ia, "__esModule", { value: !0 }); -function NU(t, e, r) { +var K8 = {}, Na = {}; +Object.defineProperty(Na, "__esModule", { value: !0 }); +function dq(t, e, r) { return ~(t - 1) & e | t - 1 & r; } -Ia.select = NU; -function LU(t, e) { +Na.select = dq; +function pq(t, e) { return (t | 0) - (e | 0) - 1 >>> 31 & 1; } -Ia.lessOrEqual = LU; -function y8(t, e) { +Na.lessOrEqual = pq; +function V8(t, e) { if (t.length !== e.length) return 0; for (var r = 0, n = 0; n < t.length; n++) r |= t[n] ^ e[n]; return 1 & r - 1 >>> 8; } -Ia.compare = y8; -function kU(t, e) { - return t.length === 0 || e.length === 0 ? !1 : y8(t, e) !== 0; +Na.compare = V8; +function gq(t, e) { + return t.length === 0 || e.length === 0 ? !1 : V8(t, e) !== 0; } -Ia.equal = kU; +Na.equal = gq; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - var e = Ia, r = ki; + var e = Na, r = Bi; t.DIGEST_LENGTH = 16; var n = ( /** @class */ @@ -12569,71 +13081,71 @@ Ia.equal = kU; this._r[3] = (d >>> 7 | p << 9) & 8191; var w = a[8] | a[9] << 8; this._r[4] = (p >>> 4 | w << 12) & 255, this._r[5] = w >>> 1 & 8190; - var A = a[10] | a[11] << 8; - this._r[6] = (w >>> 14 | A << 2) & 8191; - var M = a[12] | a[13] << 8; - this._r[7] = (A >>> 11 | M << 5) & 8065; - var N = a[14] | a[15] << 8; - this._r[8] = (M >>> 8 | N << 8) & 8191, this._r[9] = N >>> 5 & 127, this._pad[0] = a[16] | a[17] << 8, this._pad[1] = a[18] | a[19] << 8, this._pad[2] = a[20] | a[21] << 8, this._pad[3] = a[22] | a[23] << 8, this._pad[4] = a[24] | a[25] << 8, this._pad[5] = a[26] | a[27] << 8, this._pad[6] = a[28] | a[29] << 8, this._pad[7] = a[30] | a[31] << 8; + var _ = a[10] | a[11] << 8; + this._r[6] = (w >>> 14 | _ << 2) & 8191; + var P = a[12] | a[13] << 8; + this._r[7] = (_ >>> 11 | P << 5) & 8065; + var O = a[14] | a[15] << 8; + this._r[8] = (P >>> 8 | O << 8) & 8191, this._r[9] = O >>> 5 & 127, this._pad[0] = a[16] | a[17] << 8, this._pad[1] = a[18] | a[19] << 8, this._pad[2] = a[20] | a[21] << 8, this._pad[3] = a[22] | a[23] << 8, this._pad[4] = a[24] | a[25] << 8, this._pad[5] = a[26] | a[27] << 8, this._pad[6] = a[28] | a[29] << 8, this._pad[7] = a[30] | a[31] << 8; } return o.prototype._blocks = function(a, u, l) { - for (var d = this._fin ? 0 : 2048, p = this._h[0], w = this._h[1], A = this._h[2], M = this._h[3], N = this._h[4], L = this._h[5], B = this._h[6], $ = this._h[7], H = this._h[8], U = this._h[9], V = this._r[0], te = this._r[1], R = this._r[2], K = this._r[3], ge = this._r[4], Ee = this._r[5], Y = this._r[6], S = this._r[7], m = this._r[8], f = this._r[9]; l >= 16; ) { + for (var d = this._fin ? 0 : 2048, p = this._h[0], w = this._h[1], _ = this._h[2], P = this._h[3], O = this._h[4], L = this._h[5], B = this._h[6], k = this._h[7], q = this._h[8], U = this._h[9], V = this._r[0], Q = this._r[1], R = this._r[2], K = this._r[3], ge = this._r[4], Ee = this._r[5], Y = this._r[6], A = this._r[7], m = this._r[8], f = this._r[9]; l >= 16; ) { var g = a[u + 0] | a[u + 1] << 8; p += g & 8191; var b = a[u + 2] | a[u + 3] << 8; w += (g >>> 13 | b << 3) & 8191; var x = a[u + 4] | a[u + 5] << 8; - A += (b >>> 10 | x << 6) & 8191; - var _ = a[u + 6] | a[u + 7] << 8; - M += (x >>> 7 | _ << 9) & 8191; - var E = a[u + 8] | a[u + 9] << 8; - N += (_ >>> 4 | E << 12) & 8191, L += E >>> 1 & 8191; + _ += (b >>> 10 | x << 6) & 8191; + var E = a[u + 6] | a[u + 7] << 8; + P += (x >>> 7 | E << 9) & 8191; + var S = a[u + 8] | a[u + 9] << 8; + O += (E >>> 4 | S << 12) & 8191, L += S >>> 1 & 8191; var v = a[u + 10] | a[u + 11] << 8; - B += (E >>> 14 | v << 2) & 8191; - var P = a[u + 12] | a[u + 13] << 8; - $ += (v >>> 11 | P << 5) & 8191; + B += (S >>> 14 | v << 2) & 8191; + var M = a[u + 12] | a[u + 13] << 8; + k += (v >>> 11 | M << 5) & 8191; var I = a[u + 14] | a[u + 15] << 8; - H += (P >>> 8 | I << 8) & 8191, U += I >>> 5 | d; + q += (M >>> 8 | I << 8) & 8191, U += I >>> 5 | d; var F = 0, ce = F; - ce += p * V, ce += w * (5 * f), ce += A * (5 * m), ce += M * (5 * S), ce += N * (5 * Y), F = ce >>> 13, ce &= 8191, ce += L * (5 * Ee), ce += B * (5 * ge), ce += $ * (5 * K), ce += H * (5 * R), ce += U * (5 * te), F += ce >>> 13, ce &= 8191; + ce += p * V, ce += w * (5 * f), ce += _ * (5 * m), ce += P * (5 * A), ce += O * (5 * Y), F = ce >>> 13, ce &= 8191, ce += L * (5 * Ee), ce += B * (5 * ge), ce += k * (5 * K), ce += q * (5 * R), ce += U * (5 * Q), F += ce >>> 13, ce &= 8191; var D = F; - D += p * te, D += w * V, D += A * (5 * f), D += M * (5 * m), D += N * (5 * S), F = D >>> 13, D &= 8191, D += L * (5 * Y), D += B * (5 * Ee), D += $ * (5 * ge), D += H * (5 * K), D += U * (5 * R), F += D >>> 13, D &= 8191; + D += p * Q, D += w * V, D += _ * (5 * f), D += P * (5 * m), D += O * (5 * A), F = D >>> 13, D &= 8191, D += L * (5 * Y), D += B * (5 * Ee), D += k * (5 * ge), D += q * (5 * K), D += U * (5 * R), F += D >>> 13, D &= 8191; var oe = F; - oe += p * R, oe += w * te, oe += A * V, oe += M * (5 * f), oe += N * (5 * m), F = oe >>> 13, oe &= 8191, oe += L * (5 * S), oe += B * (5 * Y), oe += $ * (5 * Ee), oe += H * (5 * ge), oe += U * (5 * K), F += oe >>> 13, oe &= 8191; + oe += p * R, oe += w * Q, oe += _ * V, oe += P * (5 * f), oe += O * (5 * m), F = oe >>> 13, oe &= 8191, oe += L * (5 * A), oe += B * (5 * Y), oe += k * (5 * Ee), oe += q * (5 * ge), oe += U * (5 * K), F += oe >>> 13, oe &= 8191; var Z = F; - Z += p * K, Z += w * R, Z += A * te, Z += M * V, Z += N * (5 * f), F = Z >>> 13, Z &= 8191, Z += L * (5 * m), Z += B * (5 * S), Z += $ * (5 * Y), Z += H * (5 * Ee), Z += U * (5 * ge), F += Z >>> 13, Z &= 8191; + Z += p * K, Z += w * R, Z += _ * Q, Z += P * V, Z += O * (5 * f), F = Z >>> 13, Z &= 8191, Z += L * (5 * m), Z += B * (5 * A), Z += k * (5 * Y), Z += q * (5 * Ee), Z += U * (5 * ge), F += Z >>> 13, Z &= 8191; var J = F; - J += p * ge, J += w * K, J += A * R, J += M * te, J += N * V, F = J >>> 13, J &= 8191, J += L * (5 * f), J += B * (5 * m), J += $ * (5 * S), J += H * (5 * Y), J += U * (5 * Ee), F += J >>> 13, J &= 8191; - var Q = F; - Q += p * Ee, Q += w * ge, Q += A * K, Q += M * R, Q += N * te, F = Q >>> 13, Q &= 8191, Q += L * V, Q += B * (5 * f), Q += $ * (5 * m), Q += H * (5 * S), Q += U * (5 * Y), F += Q >>> 13, Q &= 8191; + J += p * ge, J += w * K, J += _ * R, J += P * Q, J += O * V, F = J >>> 13, J &= 8191, J += L * (5 * f), J += B * (5 * m), J += k * (5 * A), J += q * (5 * Y), J += U * (5 * Ee), F += J >>> 13, J &= 8191; + var ee = F; + ee += p * Ee, ee += w * ge, ee += _ * K, ee += P * R, ee += O * Q, F = ee >>> 13, ee &= 8191, ee += L * V, ee += B * (5 * f), ee += k * (5 * m), ee += q * (5 * A), ee += U * (5 * Y), F += ee >>> 13, ee &= 8191; var T = F; - T += p * Y, T += w * Ee, T += A * ge, T += M * K, T += N * R, F = T >>> 13, T &= 8191, T += L * te, T += B * V, T += $ * (5 * f), T += H * (5 * m), T += U * (5 * S), F += T >>> 13, T &= 8191; + T += p * Y, T += w * Ee, T += _ * ge, T += P * K, T += O * R, F = T >>> 13, T &= 8191, T += L * Q, T += B * V, T += k * (5 * f), T += q * (5 * m), T += U * (5 * A), F += T >>> 13, T &= 8191; var X = F; - X += p * S, X += w * Y, X += A * Ee, X += M * ge, X += N * K, F = X >>> 13, X &= 8191, X += L * R, X += B * te, X += $ * V, X += H * (5 * f), X += U * (5 * m), F += X >>> 13, X &= 8191; + X += p * A, X += w * Y, X += _ * Ee, X += P * ge, X += O * K, F = X >>> 13, X &= 8191, X += L * R, X += B * Q, X += k * V, X += q * (5 * f), X += U * (5 * m), F += X >>> 13, X &= 8191; var re = F; - re += p * m, re += w * S, re += A * Y, re += M * Ee, re += N * ge, F = re >>> 13, re &= 8191, re += L * K, re += B * R, re += $ * te, re += H * V, re += U * (5 * f), F += re >>> 13, re &= 8191; + re += p * m, re += w * A, re += _ * Y, re += P * Ee, re += O * ge, F = re >>> 13, re &= 8191, re += L * K, re += B * R, re += k * Q, re += q * V, re += U * (5 * f), F += re >>> 13, re &= 8191; var pe = F; - pe += p * f, pe += w * m, pe += A * S, pe += M * Y, pe += N * Ee, F = pe >>> 13, pe &= 8191, pe += L * ge, pe += B * K, pe += $ * R, pe += H * te, pe += U * V, F += pe >>> 13, pe &= 8191, F = (F << 2) + F | 0, F = F + ce | 0, ce = F & 8191, F = F >>> 13, D += F, p = ce, w = D, A = oe, M = Z, N = J, L = Q, B = T, $ = X, H = re, U = pe, u += 16, l -= 16; + pe += p * f, pe += w * m, pe += _ * A, pe += P * Y, pe += O * Ee, F = pe >>> 13, pe &= 8191, pe += L * ge, pe += B * K, pe += k * R, pe += q * Q, pe += U * V, F += pe >>> 13, pe &= 8191, F = (F << 2) + F | 0, F = F + ce | 0, ce = F & 8191, F = F >>> 13, D += F, p = ce, w = D, _ = oe, P = Z, O = J, L = ee, B = T, k = X, q = re, U = pe, u += 16, l -= 16; } - this._h[0] = p, this._h[1] = w, this._h[2] = A, this._h[3] = M, this._h[4] = N, this._h[5] = L, this._h[6] = B, this._h[7] = $, this._h[8] = H, this._h[9] = U; + this._h[0] = p, this._h[1] = w, this._h[2] = _, this._h[3] = P, this._h[4] = O, this._h[5] = L, this._h[6] = B, this._h[7] = k, this._h[8] = q, this._h[9] = U; }, o.prototype.finish = function(a, u) { u === void 0 && (u = 0); - var l = new Uint16Array(10), d, p, w, A; + var l = new Uint16Array(10), d, p, w, _; if (this._leftover) { - for (A = this._leftover, this._buffer[A++] = 1; A < 16; A++) - this._buffer[A] = 0; + for (_ = this._leftover, this._buffer[_++] = 1; _ < 16; _++) + this._buffer[_] = 0; this._fin = 1, this._blocks(this._buffer, 0, 16); } - for (d = this._h[1] >>> 13, this._h[1] &= 8191, A = 2; A < 10; A++) - this._h[A] += d, d = this._h[A] >>> 13, this._h[A] &= 8191; - for (this._h[0] += d * 5, d = this._h[0] >>> 13, this._h[0] &= 8191, this._h[1] += d, d = this._h[1] >>> 13, this._h[1] &= 8191, this._h[2] += d, l[0] = this._h[0] + 5, d = l[0] >>> 13, l[0] &= 8191, A = 1; A < 10; A++) - l[A] = this._h[A] + d, d = l[A] >>> 13, l[A] &= 8191; - for (l[9] -= 8192, p = (d ^ 1) - 1, A = 0; A < 10; A++) - l[A] &= p; - for (p = ~p, A = 0; A < 10; A++) - this._h[A] = this._h[A] & p | l[A]; - for (this._h[0] = (this._h[0] | this._h[1] << 13) & 65535, this._h[1] = (this._h[1] >>> 3 | this._h[2] << 10) & 65535, this._h[2] = (this._h[2] >>> 6 | this._h[3] << 7) & 65535, this._h[3] = (this._h[3] >>> 9 | this._h[4] << 4) & 65535, this._h[4] = (this._h[4] >>> 12 | this._h[5] << 1 | this._h[6] << 14) & 65535, this._h[5] = (this._h[6] >>> 2 | this._h[7] << 11) & 65535, this._h[6] = (this._h[7] >>> 5 | this._h[8] << 8) & 65535, this._h[7] = (this._h[8] >>> 8 | this._h[9] << 5) & 65535, w = this._h[0] + this._pad[0], this._h[0] = w & 65535, A = 1; A < 8; A++) - w = (this._h[A] + this._pad[A] | 0) + (w >>> 16) | 0, this._h[A] = w & 65535; + for (d = this._h[1] >>> 13, this._h[1] &= 8191, _ = 2; _ < 10; _++) + this._h[_] += d, d = this._h[_] >>> 13, this._h[_] &= 8191; + for (this._h[0] += d * 5, d = this._h[0] >>> 13, this._h[0] &= 8191, this._h[1] += d, d = this._h[1] >>> 13, this._h[1] &= 8191, this._h[2] += d, l[0] = this._h[0] + 5, d = l[0] >>> 13, l[0] &= 8191, _ = 1; _ < 10; _++) + l[_] = this._h[_] + d, d = l[_] >>> 13, l[_] &= 8191; + for (l[9] -= 8192, p = (d ^ 1) - 1, _ = 0; _ < 10; _++) + l[_] &= p; + for (p = ~p, _ = 0; _ < 10; _++) + this._h[_] = this._h[_] & p | l[_]; + for (this._h[0] = (this._h[0] | this._h[1] << 13) & 65535, this._h[1] = (this._h[1] >>> 3 | this._h[2] << 10) & 65535, this._h[2] = (this._h[2] >>> 6 | this._h[3] << 7) & 65535, this._h[3] = (this._h[3] >>> 9 | this._h[4] << 4) & 65535, this._h[4] = (this._h[4] >>> 12 | this._h[5] << 1 | this._h[6] << 14) & 65535, this._h[5] = (this._h[6] >>> 2 | this._h[7] << 11) & 65535, this._h[6] = (this._h[7] >>> 5 | this._h[8] << 8) & 65535, this._h[7] = (this._h[8] >>> 8 | this._h[9] << 5) & 65535, w = this._h[0] + this._pad[0], this._h[0] = w & 65535, _ = 1; _ < 8; _++) + w = (this._h[_] + this._pad[_] | 0) + (w >>> 16) | 0, this._h[_] = w & 65535; return a[u + 0] = this._h[0] >>> 0, a[u + 1] = this._h[0] >>> 8, a[u + 2] = this._h[1] >>> 0, a[u + 3] = this._h[1] >>> 8, a[u + 4] = this._h[2] >>> 0, a[u + 5] = this._h[2] >>> 8, a[u + 6] = this._h[3] >>> 0, a[u + 7] = this._h[3] >>> 8, a[u + 8] = this._h[4] >>> 0, a[u + 9] = this._h[4] >>> 8, a[u + 10] = this._h[5] >>> 0, a[u + 11] = this._h[5] >>> 8, a[u + 12] = this._h[6] >>> 0, a[u + 13] = this._h[6] >>> 8, a[u + 14] = this._h[7] >>> 0, a[u + 15] = this._h[7] >>> 8, this._finished = !0, this; }, o.prototype.update = function(a) { var u = 0, l = a.length, d; @@ -12673,10 +13185,10 @@ Ia.equal = kU; return o.length !== t.DIGEST_LENGTH || a.length !== t.DIGEST_LENGTH ? !1 : e.equal(o, a); } t.equal = s; -})(b8); +})(K8); (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - var e = V0, r = b8, n = ki, i = ar, s = Ia; + var e = ap, r = K8, n = Bi, i = ar, s = Na; t.KEY_LENGTH = 32, t.NONCE_LENGTH = 12, t.TAG_LENGTH = 16; var o = new Uint8Array(16), a = ( /** @class */ @@ -12689,29 +13201,29 @@ Ia.equal = kU; return u.prototype.seal = function(l, d, p, w) { if (l.length > 16) throw new Error("ChaCha20Poly1305: incorrect nonce length"); - var A = new Uint8Array(16); - A.set(l, A.length - l.length); - var M = new Uint8Array(32); - e.stream(this._key, A, M, 4); - var N = d.length + this.tagLength, L; + var _ = new Uint8Array(16); + _.set(l, _.length - l.length); + var P = new Uint8Array(32); + e.stream(this._key, _, P, 4); + var O = d.length + this.tagLength, L; if (w) { - if (w.length !== N) + if (w.length !== O) throw new Error("ChaCha20Poly1305: incorrect destination length"); L = w; } else - L = new Uint8Array(N); - return e.streamXOR(this._key, A, d, L, 4), this._authenticate(L.subarray(L.length - this.tagLength, L.length), M, L.subarray(0, L.length - this.tagLength), p), n.wipe(A), L; + L = new Uint8Array(O); + return e.streamXOR(this._key, _, d, L, 4), this._authenticate(L.subarray(L.length - this.tagLength, L.length), P, L.subarray(0, L.length - this.tagLength), p), n.wipe(_), L; }, u.prototype.open = function(l, d, p, w) { if (l.length > 16) throw new Error("ChaCha20Poly1305: incorrect nonce length"); if (d.length < this.tagLength) return null; - var A = new Uint8Array(16); - A.set(l, A.length - l.length); - var M = new Uint8Array(32); - e.stream(this._key, A, M, 4); - var N = new Uint8Array(this.tagLength); - if (this._authenticate(N, M, d.subarray(0, d.length - this.tagLength), p), !s.equal(N, d.subarray(d.length - this.tagLength, d.length))) + var _ = new Uint8Array(16); + _.set(l, _.length - l.length); + var P = new Uint8Array(32); + e.stream(this._key, _, P, 4); + var O = new Uint8Array(this.tagLength); + if (this._authenticate(O, P, d.subarray(0, d.length - this.tagLength), p), !s.equal(O, d.subarray(d.length - this.tagLength, d.length))) return null; var L = d.length - this.tagLength, B; if (w) { @@ -12720,30 +13232,30 @@ Ia.equal = kU; B = w; } else B = new Uint8Array(L); - return e.streamXOR(this._key, A, d.subarray(0, d.length - this.tagLength), B, 4), n.wipe(A), B; + return e.streamXOR(this._key, _, d.subarray(0, d.length - this.tagLength), B, 4), n.wipe(_), B; }, u.prototype.clean = function() { return n.wipe(this._key), this; }, u.prototype._authenticate = function(l, d, p, w) { - var A = new r.Poly1305(d); - w && (A.update(w), w.length % 16 > 0 && A.update(o.subarray(w.length % 16))), A.update(p), p.length % 16 > 0 && A.update(o.subarray(p.length % 16)); - var M = new Uint8Array(8); - w && i.writeUint64LE(w.length, M), A.update(M), i.writeUint64LE(p.length, M), A.update(M); - for (var N = A.digest(), L = 0; L < N.length; L++) - l[L] = N[L]; - A.clean(), n.wipe(N), n.wipe(M); + var _ = new r.Poly1305(d); + w && (_.update(w), w.length % 16 > 0 && _.update(o.subarray(w.length % 16))), _.update(p), p.length % 16 > 0 && _.update(o.subarray(p.length % 16)); + var P = new Uint8Array(8); + w && i.writeUint64LE(w.length, P), _.update(P), i.writeUint64LE(p.length, P), _.update(P); + for (var O = _.digest(), L = 0; L < O.length; L++) + l[L] = O[L]; + _.clean(), n.wipe(O), n.wipe(P); }, u; }() ); t.ChaCha20Poly1305 = a; -})(Yv); -var w8 = {}, Gl = {}, Jv = {}; -Object.defineProperty(Jv, "__esModule", { value: !0 }); -function $U(t) { +})(ub); +var G8 = {}, nh = {}, fb = {}; +Object.defineProperty(fb, "__esModule", { value: !0 }); +function mq(t) { return typeof t.saveState < "u" && typeof t.restoreState < "u" && typeof t.cleanSavedState < "u"; } -Jv.isSerializableHash = $U; -Object.defineProperty(Gl, "__esModule", { value: !0 }); -var Ls = Jv, BU = Ia, FU = ki, x8 = ( +fb.isSerializableHash = mq; +Object.defineProperty(nh, "__esModule", { value: !0 }); +var Bs = fb, vq = Na, bq = Bi, Y8 = ( /** @class */ function() { function t(e, r) { @@ -12755,14 +13267,14 @@ var Ls = Jv, BU = Ia, FU = ki, x8 = ( this._inner.update(n); for (var i = 0; i < n.length; i++) n[i] ^= 106; - this._outer.update(n), Ls.isSerializableHash(this._inner) && Ls.isSerializableHash(this._outer) && (this._innerKeyedState = this._inner.saveState(), this._outerKeyedState = this._outer.saveState()), FU.wipe(n); + this._outer.update(n), Bs.isSerializableHash(this._inner) && Bs.isSerializableHash(this._outer) && (this._innerKeyedState = this._inner.saveState(), this._outerKeyedState = this._outer.saveState()), bq.wipe(n); } return t.prototype.reset = function() { - if (!Ls.isSerializableHash(this._inner) || !Ls.isSerializableHash(this._outer)) + if (!Bs.isSerializableHash(this._inner) || !Bs.isSerializableHash(this._outer)) throw new Error("hmac: can't reset() because hash doesn't implement restoreState()"); return this._inner.restoreState(this._innerKeyedState), this._outer.restoreState(this._outerKeyedState), this._finished = !1, this; }, t.prototype.clean = function() { - Ls.isSerializableHash(this._inner) && this._inner.cleanSavedState(this._innerKeyedState), Ls.isSerializableHash(this._outer) && this._outer.cleanSavedState(this._outerKeyedState), this._inner.clean(), this._outer.clean(); + Bs.isSerializableHash(this._inner) && this._inner.cleanSavedState(this._innerKeyedState), Bs.isSerializableHash(this._outer) && this._outer.cleanSavedState(this._outerKeyedState), this._inner.clean(), this._outer.clean(); }, t.prototype.update = function(e) { return this._inner.update(e), this; }, t.prototype.finish = function(e) { @@ -12771,37 +13283,37 @@ var Ls = Jv, BU = Ia, FU = ki, x8 = ( var e = new Uint8Array(this.digestLength); return this.finish(e), e; }, t.prototype.saveState = function() { - if (!Ls.isSerializableHash(this._inner)) + if (!Bs.isSerializableHash(this._inner)) throw new Error("hmac: can't saveState() because hash doesn't implement it"); return this._inner.saveState(); }, t.prototype.restoreState = function(e) { - if (!Ls.isSerializableHash(this._inner) || !Ls.isSerializableHash(this._outer)) + if (!Bs.isSerializableHash(this._inner) || !Bs.isSerializableHash(this._outer)) throw new Error("hmac: can't restoreState() because hash doesn't implement it"); return this._inner.restoreState(e), this._outer.restoreState(this._outerKeyedState), this._finished = !1, this; }, t.prototype.cleanSavedState = function(e) { - if (!Ls.isSerializableHash(this._inner)) + if (!Bs.isSerializableHash(this._inner)) throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it"); this._inner.cleanSavedState(e); }, t; }() ); -Gl.HMAC = x8; -function jU(t, e, r) { - var n = new x8(t, e); +nh.HMAC = Y8; +function yq(t, e, r) { + var n = new Y8(t, e); n.update(r); var i = n.digest(); return n.clean(), i; } -Gl.hmac = jU; -Gl.equal = BU.equal; -Object.defineProperty(w8, "__esModule", { value: !0 }); -var Ix = Gl, Cx = ki, UU = ( +nh.hmac = yq; +nh.equal = vq.equal; +Object.defineProperty(G8, "__esModule", { value: !0 }); +var Wx = nh, Hx = Bi, wq = ( /** @class */ function() { function t(e, r, n, i) { n === void 0 && (n = new Uint8Array(0)), this._counter = new Uint8Array(1), this._hash = e, this._info = i; - var s = Ix.hmac(this._hash, n, r); - this._hmac = new Ix.HMAC(e, s), this._buffer = new Uint8Array(this._hmac.digestLength), this._bufpos = this._buffer.length; + var s = Wx.hmac(this._hash, n, r); + this._hmac = new Wx.HMAC(e, s), this._buffer = new Uint8Array(this._hmac.digestLength), this._bufpos = this._buffer.length; } return t.prototype._fillBuffer = function() { this._counter[0]++; @@ -12814,13 +13326,13 @@ var Ix = Gl, Cx = ki, UU = ( this._bufpos === this._buffer.length && this._fillBuffer(), r[n] = this._buffer[this._bufpos++]; return r; }, t.prototype.clean = function() { - this._hmac.clean(), Cx.wipe(this._buffer), Cx.wipe(this._counter), this._bufpos = 0; + this._hmac.clean(), Hx.wipe(this._buffer), Hx.wipe(this._counter), this._bufpos = 0; }, t; }() -), qU = w8.HKDF = UU, Yl = {}; +), xq = G8.HKDF = wq, ih = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - var e = ar, r = ki; + var e = ar, r = Bi; t.DIGEST_LENGTH = 32, t.BLOCK_SIZE = 64; var n = ( /** @class */ @@ -12848,14 +13360,14 @@ var Ix = Gl, Cx = ki, UU = ( return this; }, a.prototype.finish = function(u) { if (!this._finished) { - var l = this._bytesHashed, d = this._bufferLength, p = l / 536870912 | 0, w = l << 3, A = l % 64 < 56 ? 64 : 128; + var l = this._bytesHashed, d = this._bufferLength, p = l / 536870912 | 0, w = l << 3, _ = l % 64 < 56 ? 64 : 128; this._buffer[d] = 128; - for (var M = d + 1; M < A - 8; M++) - this._buffer[M] = 0; - e.writeUint32BE(p, this._buffer, A - 8), e.writeUint32BE(w, this._buffer, A - 4), s(this._temp, this._state, this._buffer, 0, A), this._finished = !0; + for (var P = d + 1; P < _ - 8; P++) + this._buffer[P] = 0; + e.writeUint32BE(p, this._buffer, _ - 8), e.writeUint32BE(w, this._buffer, _ - 4), s(this._temp, this._state, this._buffer, 0, _), this._finished = !0; } - for (var M = 0; M < this.digestLength / 4; M++) - e.writeUint32BE(this._state[M], u, M * 4); + for (var P = 0; P < this.digestLength / 4; P++) + e.writeUint32BE(this._state[P], u, P * 4); return this; }, a.prototype.digest = function() { var u = new Uint8Array(this.digestLength); @@ -12945,21 +13457,21 @@ var Ix = Gl, Cx = ki, UU = ( ]); function s(a, u, l, d, p) { for (; p >= 64; ) { - for (var w = u[0], A = u[1], M = u[2], N = u[3], L = u[4], B = u[5], $ = u[6], H = u[7], U = 0; U < 16; U++) { + for (var w = u[0], _ = u[1], P = u[2], O = u[3], L = u[4], B = u[5], k = u[6], q = u[7], U = 0; U < 16; U++) { var V = d + U * 4; a[U] = e.readUint32BE(l, V); } for (var U = 16; U < 64; U++) { - var te = a[U - 2], R = (te >>> 17 | te << 15) ^ (te >>> 19 | te << 13) ^ te >>> 10; - te = a[U - 15]; - var K = (te >>> 7 | te << 25) ^ (te >>> 18 | te << 14) ^ te >>> 3; + var Q = a[U - 2], R = (Q >>> 17 | Q << 15) ^ (Q >>> 19 | Q << 13) ^ Q >>> 10; + Q = a[U - 15]; + var K = (Q >>> 7 | Q << 25) ^ (Q >>> 18 | Q << 14) ^ Q >>> 3; a[U] = (R + a[U - 7] | 0) + (K + a[U - 16] | 0); } for (var U = 0; U < 64; U++) { - var R = (((L >>> 6 | L << 26) ^ (L >>> 11 | L << 21) ^ (L >>> 25 | L << 7)) + (L & B ^ ~L & $) | 0) + (H + (i[U] + a[U] | 0) | 0) | 0, K = ((w >>> 2 | w << 30) ^ (w >>> 13 | w << 19) ^ (w >>> 22 | w << 10)) + (w & A ^ w & M ^ A & M) | 0; - H = $, $ = B, B = L, L = N + R | 0, N = M, M = A, A = w, w = R + K | 0; + var R = (((L >>> 6 | L << 26) ^ (L >>> 11 | L << 21) ^ (L >>> 25 | L << 7)) + (L & B ^ ~L & k) | 0) + (q + (i[U] + a[U] | 0) | 0) | 0, K = ((w >>> 2 | w << 30) ^ (w >>> 13 | w << 19) ^ (w >>> 22 | w << 10)) + (w & _ ^ w & P ^ _ & P) | 0; + q = k, k = B, B = L, L = O + R | 0, O = P, P = _, _ = w, w = R + K | 0; } - u[0] += w, u[1] += A, u[2] += M, u[3] += N, u[4] += L, u[5] += B, u[6] += $, u[7] += H, d += 64, p -= 64; + u[0] += w, u[1] += _, u[2] += P, u[3] += O, u[4] += L, u[5] += B, u[6] += k, u[7] += q, d += 64, p -= 64; } return d; } @@ -12970,17 +13482,17 @@ var Ix = Gl, Cx = ki, UU = ( return u.clean(), l; } t.hash = o; -})(Yl); -var Xv = {}; +})(ih); +var lb = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.sharedKey = t.generateKeyPair = t.generateKeyPairFromSeed = t.scalarMultBase = t.scalarMult = t.SHARED_KEY_LENGTH = t.SECRET_KEY_LENGTH = t.PUBLIC_KEY_LENGTH = void 0; - const e = Pa, r = ki; + const e = Da, r = Bi; t.PUBLIC_KEY_LENGTH = 32, t.SECRET_KEY_LENGTH = 32, t.SHARED_KEY_LENGTH = 32; function n(U) { const V = new Float64Array(16); if (U) - for (let te = 0; te < U.length; te++) - V[te] = U[te]; + for (let Q = 0; Q < U.length; Q++) + V[Q] = U[Q]; return V; } const i = new Uint8Array(32); @@ -12988,86 +13500,86 @@ var Xv = {}; const s = n([56129, 1]); function o(U) { let V = 1; - for (let te = 0; te < 16; te++) { - let R = U[te] + V + 65535; - V = Math.floor(R / 65536), U[te] = R - V * 65536; + for (let Q = 0; Q < 16; Q++) { + let R = U[Q] + V + 65535; + V = Math.floor(R / 65536), U[Q] = R - V * 65536; } U[0] += V - 1 + 37 * (V - 1); } - function a(U, V, te) { - const R = ~(te - 1); + function a(U, V, Q) { + const R = ~(Q - 1); for (let K = 0; K < 16; K++) { const ge = R & (U[K] ^ V[K]); U[K] ^= ge, V[K] ^= ge; } } function u(U, V) { - const te = n(), R = n(); + const Q = n(), R = n(); for (let K = 0; K < 16; K++) R[K] = V[K]; o(R), o(R), o(R); for (let K = 0; K < 2; K++) { - te[0] = R[0] - 65517; + Q[0] = R[0] - 65517; for (let Ee = 1; Ee < 15; Ee++) - te[Ee] = R[Ee] - 65535 - (te[Ee - 1] >> 16 & 1), te[Ee - 1] &= 65535; - te[15] = R[15] - 32767 - (te[14] >> 16 & 1); - const ge = te[15] >> 16 & 1; - te[14] &= 65535, a(R, te, 1 - ge); + Q[Ee] = R[Ee] - 65535 - (Q[Ee - 1] >> 16 & 1), Q[Ee - 1] &= 65535; + Q[15] = R[15] - 32767 - (Q[14] >> 16 & 1); + const ge = Q[15] >> 16 & 1; + Q[14] &= 65535, a(R, Q, 1 - ge); } for (let K = 0; K < 16; K++) U[2 * K] = R[K] & 255, U[2 * K + 1] = R[K] >> 8; } function l(U, V) { - for (let te = 0; te < 16; te++) - U[te] = V[2 * te] + (V[2 * te + 1] << 8); + for (let Q = 0; Q < 16; Q++) + U[Q] = V[2 * Q] + (V[2 * Q + 1] << 8); U[15] &= 32767; } - function d(U, V, te) { + function d(U, V, Q) { for (let R = 0; R < 16; R++) - U[R] = V[R] + te[R]; + U[R] = V[R] + Q[R]; } - function p(U, V, te) { + function p(U, V, Q) { for (let R = 0; R < 16; R++) - U[R] = V[R] - te[R]; + U[R] = V[R] - Q[R]; } - function w(U, V, te) { - let R, K, ge = 0, Ee = 0, Y = 0, S = 0, m = 0, f = 0, g = 0, b = 0, x = 0, _ = 0, E = 0, v = 0, P = 0, I = 0, F = 0, ce = 0, D = 0, oe = 0, Z = 0, J = 0, Q = 0, T = 0, X = 0, re = 0, pe = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = te[0], Me = te[1], Ne = te[2], Ke = te[3], Le = te[4], qe = te[5], ze = te[6], _e = te[7], Ze = te[8], at = te[9], ke = te[10], Qe = te[11], tt = te[12], Ye = te[13], dt = te[14], lt = te[15]; - R = V[0], ge += R * $e, Ee += R * Me, Y += R * Ne, S += R * Ke, m += R * Le, f += R * qe, g += R * ze, b += R * _e, x += R * Ze, _ += R * at, E += R * ke, v += R * Qe, P += R * tt, I += R * Ye, F += R * dt, ce += R * lt, R = V[1], Ee += R * $e, Y += R * Me, S += R * Ne, m += R * Ke, f += R * Le, g += R * qe, b += R * ze, x += R * _e, _ += R * Ze, E += R * at, v += R * ke, P += R * Qe, I += R * tt, F += R * Ye, ce += R * dt, D += R * lt, R = V[2], Y += R * $e, S += R * Me, m += R * Ne, f += R * Ke, g += R * Le, b += R * qe, x += R * ze, _ += R * _e, E += R * Ze, v += R * at, P += R * ke, I += R * Qe, F += R * tt, ce += R * Ye, D += R * dt, oe += R * lt, R = V[3], S += R * $e, m += R * Me, f += R * Ne, g += R * Ke, b += R * Le, x += R * qe, _ += R * ze, E += R * _e, v += R * Ze, P += R * at, I += R * ke, F += R * Qe, ce += R * tt, D += R * Ye, oe += R * dt, Z += R * lt, R = V[4], m += R * $e, f += R * Me, g += R * Ne, b += R * Ke, x += R * Le, _ += R * qe, E += R * ze, v += R * _e, P += R * Ze, I += R * at, F += R * ke, ce += R * Qe, D += R * tt, oe += R * Ye, Z += R * dt, J += R * lt, R = V[5], f += R * $e, g += R * Me, b += R * Ne, x += R * Ke, _ += R * Le, E += R * qe, v += R * ze, P += R * _e, I += R * Ze, F += R * at, ce += R * ke, D += R * Qe, oe += R * tt, Z += R * Ye, J += R * dt, Q += R * lt, R = V[6], g += R * $e, b += R * Me, x += R * Ne, _ += R * Ke, E += R * Le, v += R * qe, P += R * ze, I += R * _e, F += R * Ze, ce += R * at, D += R * ke, oe += R * Qe, Z += R * tt, J += R * Ye, Q += R * dt, T += R * lt, R = V[7], b += R * $e, x += R * Me, _ += R * Ne, E += R * Ke, v += R * Le, P += R * qe, I += R * ze, F += R * _e, ce += R * Ze, D += R * at, oe += R * ke, Z += R * Qe, J += R * tt, Q += R * Ye, T += R * dt, X += R * lt, R = V[8], x += R * $e, _ += R * Me, E += R * Ne, v += R * Ke, P += R * Le, I += R * qe, F += R * ze, ce += R * _e, D += R * Ze, oe += R * at, Z += R * ke, J += R * Qe, Q += R * tt, T += R * Ye, X += R * dt, re += R * lt, R = V[9], _ += R * $e, E += R * Me, v += R * Ne, P += R * Ke, I += R * Le, F += R * qe, ce += R * ze, D += R * _e, oe += R * Ze, Z += R * at, J += R * ke, Q += R * Qe, T += R * tt, X += R * Ye, re += R * dt, pe += R * lt, R = V[10], E += R * $e, v += R * Me, P += R * Ne, I += R * Ke, F += R * Le, ce += R * qe, D += R * ze, oe += R * _e, Z += R * Ze, J += R * at, Q += R * ke, T += R * Qe, X += R * tt, re += R * Ye, pe += R * dt, ie += R * lt, R = V[11], v += R * $e, P += R * Me, I += R * Ne, F += R * Ke, ce += R * Le, D += R * qe, oe += R * ze, Z += R * _e, J += R * Ze, Q += R * at, T += R * ke, X += R * Qe, re += R * tt, pe += R * Ye, ie += R * dt, ue += R * lt, R = V[12], P += R * $e, I += R * Me, F += R * Ne, ce += R * Ke, D += R * Le, oe += R * qe, Z += R * ze, J += R * _e, Q += R * Ze, T += R * at, X += R * ke, re += R * Qe, pe += R * tt, ie += R * Ye, ue += R * dt, ve += R * lt, R = V[13], I += R * $e, F += R * Me, ce += R * Ne, D += R * Ke, oe += R * Le, Z += R * qe, J += R * ze, Q += R * _e, T += R * Ze, X += R * at, re += R * ke, pe += R * Qe, ie += R * tt, ue += R * Ye, ve += R * dt, Pe += R * lt, R = V[14], F += R * $e, ce += R * Me, D += R * Ne, oe += R * Ke, Z += R * Le, J += R * qe, Q += R * ze, T += R * _e, X += R * Ze, re += R * at, pe += R * ke, ie += R * Qe, ue += R * tt, ve += R * Ye, Pe += R * dt, De += R * lt, R = V[15], ce += R * $e, D += R * Me, oe += R * Ne, Z += R * Ke, J += R * Le, Q += R * qe, T += R * ze, X += R * _e, re += R * Ze, pe += R * at, ie += R * ke, ue += R * Qe, ve += R * tt, Pe += R * Ye, De += R * dt, Ce += R * lt, ge += 38 * D, Ee += 38 * oe, Y += 38 * Z, S += 38 * J, m += 38 * Q, f += 38 * T, g += 38 * X, b += 38 * re, x += 38 * pe, _ += 38 * ie, E += 38 * ue, v += 38 * ve, P += 38 * Pe, I += 38 * De, F += 38 * Ce, K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = _ + K + 65535, K = Math.floor(R / 65536), _ = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = P + K + 65535, K = Math.floor(R / 65536), P = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = _ + K + 65535, K = Math.floor(R / 65536), _ = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = P + K + 65535, K = Math.floor(R / 65536), P = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), U[0] = ge, U[1] = Ee, U[2] = Y, U[3] = S, U[4] = m, U[5] = f, U[6] = g, U[7] = b, U[8] = x, U[9] = _, U[10] = E, U[11] = v, U[12] = P, U[13] = I, U[14] = F, U[15] = ce; + function w(U, V, Q) { + let R, K, ge = 0, Ee = 0, Y = 0, A = 0, m = 0, f = 0, g = 0, b = 0, x = 0, E = 0, S = 0, v = 0, M = 0, I = 0, F = 0, ce = 0, D = 0, oe = 0, Z = 0, J = 0, ee = 0, T = 0, X = 0, re = 0, pe = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = Q[0], Me = Q[1], Ne = Q[2], Ke = Q[3], Le = Q[4], qe = Q[5], ze = Q[6], _e = Q[7], Ze = Q[8], at = Q[9], ke = Q[10], Qe = Q[11], tt = Q[12], Ye = Q[13], dt = Q[14], lt = Q[15]; + R = V[0], ge += R * $e, Ee += R * Me, Y += R * Ne, A += R * Ke, m += R * Le, f += R * qe, g += R * ze, b += R * _e, x += R * Ze, E += R * at, S += R * ke, v += R * Qe, M += R * tt, I += R * Ye, F += R * dt, ce += R * lt, R = V[1], Ee += R * $e, Y += R * Me, A += R * Ne, m += R * Ke, f += R * Le, g += R * qe, b += R * ze, x += R * _e, E += R * Ze, S += R * at, v += R * ke, M += R * Qe, I += R * tt, F += R * Ye, ce += R * dt, D += R * lt, R = V[2], Y += R * $e, A += R * Me, m += R * Ne, f += R * Ke, g += R * Le, b += R * qe, x += R * ze, E += R * _e, S += R * Ze, v += R * at, M += R * ke, I += R * Qe, F += R * tt, ce += R * Ye, D += R * dt, oe += R * lt, R = V[3], A += R * $e, m += R * Me, f += R * Ne, g += R * Ke, b += R * Le, x += R * qe, E += R * ze, S += R * _e, v += R * Ze, M += R * at, I += R * ke, F += R * Qe, ce += R * tt, D += R * Ye, oe += R * dt, Z += R * lt, R = V[4], m += R * $e, f += R * Me, g += R * Ne, b += R * Ke, x += R * Le, E += R * qe, S += R * ze, v += R * _e, M += R * Ze, I += R * at, F += R * ke, ce += R * Qe, D += R * tt, oe += R * Ye, Z += R * dt, J += R * lt, R = V[5], f += R * $e, g += R * Me, b += R * Ne, x += R * Ke, E += R * Le, S += R * qe, v += R * ze, M += R * _e, I += R * Ze, F += R * at, ce += R * ke, D += R * Qe, oe += R * tt, Z += R * Ye, J += R * dt, ee += R * lt, R = V[6], g += R * $e, b += R * Me, x += R * Ne, E += R * Ke, S += R * Le, v += R * qe, M += R * ze, I += R * _e, F += R * Ze, ce += R * at, D += R * ke, oe += R * Qe, Z += R * tt, J += R * Ye, ee += R * dt, T += R * lt, R = V[7], b += R * $e, x += R * Me, E += R * Ne, S += R * Ke, v += R * Le, M += R * qe, I += R * ze, F += R * _e, ce += R * Ze, D += R * at, oe += R * ke, Z += R * Qe, J += R * tt, ee += R * Ye, T += R * dt, X += R * lt, R = V[8], x += R * $e, E += R * Me, S += R * Ne, v += R * Ke, M += R * Le, I += R * qe, F += R * ze, ce += R * _e, D += R * Ze, oe += R * at, Z += R * ke, J += R * Qe, ee += R * tt, T += R * Ye, X += R * dt, re += R * lt, R = V[9], E += R * $e, S += R * Me, v += R * Ne, M += R * Ke, I += R * Le, F += R * qe, ce += R * ze, D += R * _e, oe += R * Ze, Z += R * at, J += R * ke, ee += R * Qe, T += R * tt, X += R * Ye, re += R * dt, pe += R * lt, R = V[10], S += R * $e, v += R * Me, M += R * Ne, I += R * Ke, F += R * Le, ce += R * qe, D += R * ze, oe += R * _e, Z += R * Ze, J += R * at, ee += R * ke, T += R * Qe, X += R * tt, re += R * Ye, pe += R * dt, ie += R * lt, R = V[11], v += R * $e, M += R * Me, I += R * Ne, F += R * Ke, ce += R * Le, D += R * qe, oe += R * ze, Z += R * _e, J += R * Ze, ee += R * at, T += R * ke, X += R * Qe, re += R * tt, pe += R * Ye, ie += R * dt, ue += R * lt, R = V[12], M += R * $e, I += R * Me, F += R * Ne, ce += R * Ke, D += R * Le, oe += R * qe, Z += R * ze, J += R * _e, ee += R * Ze, T += R * at, X += R * ke, re += R * Qe, pe += R * tt, ie += R * Ye, ue += R * dt, ve += R * lt, R = V[13], I += R * $e, F += R * Me, ce += R * Ne, D += R * Ke, oe += R * Le, Z += R * qe, J += R * ze, ee += R * _e, T += R * Ze, X += R * at, re += R * ke, pe += R * Qe, ie += R * tt, ue += R * Ye, ve += R * dt, Pe += R * lt, R = V[14], F += R * $e, ce += R * Me, D += R * Ne, oe += R * Ke, Z += R * Le, J += R * qe, ee += R * ze, T += R * _e, X += R * Ze, re += R * at, pe += R * ke, ie += R * Qe, ue += R * tt, ve += R * Ye, Pe += R * dt, De += R * lt, R = V[15], ce += R * $e, D += R * Me, oe += R * Ne, Z += R * Ke, J += R * Le, ee += R * qe, T += R * ze, X += R * _e, re += R * Ze, pe += R * at, ie += R * ke, ue += R * Qe, ve += R * tt, Pe += R * Ye, De += R * dt, Ce += R * lt, ge += 38 * D, Ee += 38 * oe, Y += 38 * Z, A += 38 * J, m += 38 * ee, f += 38 * T, g += 38 * X, b += 38 * re, x += 38 * pe, E += 38 * ie, S += 38 * ue, v += 38 * ve, M += 38 * Pe, I += 38 * De, F += 38 * Ce, K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = A + K + 65535, K = Math.floor(R / 65536), A = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = M + K + 65535, K = Math.floor(R / 65536), M = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = A + K + 65535, K = Math.floor(R / 65536), A = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = M + K + 65535, K = Math.floor(R / 65536), M = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), U[0] = ge, U[1] = Ee, U[2] = Y, U[3] = A, U[4] = m, U[5] = f, U[6] = g, U[7] = b, U[8] = x, U[9] = E, U[10] = S, U[11] = v, U[12] = M, U[13] = I, U[14] = F, U[15] = ce; } - function A(U, V) { + function _(U, V) { w(U, V, V); } - function M(U, V) { - const te = n(); + function P(U, V) { + const Q = n(); for (let R = 0; R < 16; R++) - te[R] = V[R]; + Q[R] = V[R]; for (let R = 253; R >= 0; R--) - A(te, te), R !== 2 && R !== 4 && w(te, te, V); + _(Q, Q), R !== 2 && R !== 4 && w(Q, Q, V); for (let R = 0; R < 16; R++) - U[R] = te[R]; + U[R] = Q[R]; } - function N(U, V) { - const te = new Uint8Array(32), R = new Float64Array(80), K = n(), ge = n(), Ee = n(), Y = n(), S = n(), m = n(); + function O(U, V) { + const Q = new Uint8Array(32), R = new Float64Array(80), K = n(), ge = n(), Ee = n(), Y = n(), A = n(), m = n(); for (let x = 0; x < 31; x++) - te[x] = U[x]; - te[31] = U[31] & 127 | 64, te[0] &= 248, l(R, V); + Q[x] = U[x]; + Q[31] = U[31] & 127 | 64, Q[0] &= 248, l(R, V); for (let x = 0; x < 16; x++) ge[x] = R[x]; K[0] = Y[0] = 1; for (let x = 254; x >= 0; --x) { - const _ = te[x >>> 3] >>> (x & 7) & 1; - a(K, ge, _), a(Ee, Y, _), d(S, K, Ee), p(K, K, Ee), d(Ee, ge, Y), p(ge, ge, Y), A(Y, S), A(m, K), w(K, Ee, K), w(Ee, ge, S), d(S, K, Ee), p(K, K, Ee), A(ge, K), p(Ee, Y, m), w(K, Ee, s), d(K, K, Y), w(Ee, Ee, K), w(K, Y, m), w(Y, ge, R), A(ge, S), a(K, ge, _), a(Ee, Y, _); + const E = Q[x >>> 3] >>> (x & 7) & 1; + a(K, ge, E), a(Ee, Y, E), d(A, K, Ee), p(K, K, Ee), d(Ee, ge, Y), p(ge, ge, Y), _(Y, A), _(m, K), w(K, Ee, K), w(Ee, ge, A), d(A, K, Ee), p(K, K, Ee), _(ge, K), p(Ee, Y, m), w(K, Ee, s), d(K, K, Y), w(Ee, Ee, K), w(K, Y, m), w(Y, ge, R), _(ge, A), a(K, ge, E), a(Ee, Y, E); } for (let x = 0; x < 16; x++) R[x + 16] = K[x], R[x + 32] = Ee[x], R[x + 48] = ge[x], R[x + 64] = Y[x]; const f = R.subarray(32), g = R.subarray(16); - M(f, f), w(g, g, f); + P(f, f), w(g, g, f); const b = new Uint8Array(32); return u(b, g), b; } - t.scalarMult = N; + t.scalarMult = O; function L(U) { - return N(U, i); + return O(U, i); } t.scalarMultBase = L; function B(U) { @@ -13080,18 +13592,18 @@ var Xv = {}; }; } t.generateKeyPairFromSeed = B; - function $(U) { - const V = (0, e.randomBytes)(32, U), te = B(V); - return (0, r.wipe)(V), te; + function k(U) { + const V = (0, e.randomBytes)(32, U), Q = B(V); + return (0, r.wipe)(V), Q; } - t.generateKeyPair = $; - function H(U, V, te = !1) { + t.generateKeyPair = k; + function q(U, V, Q = !1) { if (U.length !== t.PUBLIC_KEY_LENGTH) throw new Error("X25519: incorrect secret key length"); if (V.length !== t.PUBLIC_KEY_LENGTH) throw new Error("X25519: incorrect public key length"); - const R = N(U, V); - if (te) { + const R = O(U, V); + if (Q) { let K = 0; for (let ge = 0; ge < R.length; ge++) K |= R[ge]; @@ -13100,28 +13612,28 @@ var Xv = {}; } return R; } - t.sharedKey = H; -})(Xv); -var _8 = {}; -const zU = "elliptic", WU = "6.6.0", HU = "EC cryptography", KU = "lib/elliptic.js", VU = [ + t.sharedKey = q; +})(lb); +var J8 = {}; +const _q = "elliptic", Eq = "6.6.0", Sq = "EC cryptography", Aq = "lib/elliptic.js", Pq = [ "lib" -], GU = { +], Mq = { lint: "eslint lib test", "lint:fix": "npm run lint -- --fix", unit: "istanbul test _mocha --reporter=spec test/index.js", test: "npm run lint && npm run unit", version: "grunt dist && git add dist/" -}, YU = { +}, Iq = { type: "git", url: "git@github.com:indutny/elliptic" -}, JU = [ +}, Cq = [ "EC", "Elliptic", "curve", "Cryptography" -], XU = "Fedor Indutny ", ZU = "MIT", QU = { +], Tq = "Fedor Indutny ", Rq = "MIT", Dq = { url: "https://github.com/indutny/elliptic/issues" -}, eq = "https://github.com/indutny/elliptic", tq = { +}, Oq = "https://github.com/indutny/elliptic", Nq = { brfs: "^2.0.2", coveralls: "^3.1.0", eslint: "^7.6.0", @@ -13135,7 +13647,7 @@ const zU = "elliptic", WU = "6.6.0", HU = "EC cryptography", KU = "lib/elliptic. "grunt-saucelabs": "^9.0.1", istanbul: "^0.4.5", mocha: "^8.0.1" -}, rq = { +}, Lq = { "bn.js": "^4.11.9", brorand: "^1.1.0", "hash.js": "^1.0.0", @@ -13143,138 +13655,138 @@ const zU = "elliptic", WU = "6.6.0", HU = "EC cryptography", KU = "lib/elliptic. inherits: "^2.0.4", "minimalistic-assert": "^1.0.1", "minimalistic-crypto-utils": "^1.0.1" -}, nq = { - name: zU, - version: WU, - description: HU, - main: KU, - files: VU, - scripts: GU, - repository: YU, - keywords: JU, - author: XU, - license: ZU, - bugs: QU, - homepage: eq, - devDependencies: tq, - dependencies: rq -}; -var Bi = {}, Zv = { exports: {} }; -Zv.exports; +}, kq = { + name: _q, + version: Eq, + description: Sq, + main: Aq, + files: Pq, + scripts: Mq, + repository: Iq, + keywords: Cq, + author: Tq, + license: Rq, + bugs: Dq, + homepage: Oq, + devDependencies: Nq, + dependencies: Lq +}; +var ji = {}, hb = { exports: {} }; +hb.exports; (function(t) { (function(e, r) { - function n(Y, S) { - if (!Y) throw new Error(S || "Assertion failed"); + function n(Y, A) { + if (!Y) throw new Error(A || "Assertion failed"); } - function i(Y, S) { - Y.super_ = S; + function i(Y, A) { + Y.super_ = A; var m = function() { }; - m.prototype = S.prototype, Y.prototype = new m(), Y.prototype.constructor = Y; + m.prototype = A.prototype, Y.prototype = new m(), Y.prototype.constructor = Y; } - function s(Y, S, m) { + function s(Y, A, m) { if (s.isBN(Y)) return Y; - this.negative = 0, this.words = null, this.length = 0, this.red = null, Y !== null && ((S === "le" || S === "be") && (m = S, S = 10), this._init(Y || 0, S || 10, m || "be")); + this.negative = 0, this.words = null, this.length = 0, this.red = null, Y !== null && ((A === "le" || A === "be") && (m = A, A = 10), this._init(Y || 0, A || 10, m || "be")); } typeof e == "object" ? e.exports = s : r.BN = s, s.BN = s, s.wordSize = 26; var o; try { - typeof window < "u" && typeof window.Buffer < "u" ? o = window.Buffer : o = Wl.Buffer; + typeof window < "u" && typeof window.Buffer < "u" ? o = window.Buffer : o = Ql.Buffer; } catch { } - s.isBN = function(S) { - return S instanceof s ? !0 : S !== null && typeof S == "object" && S.constructor.wordSize === s.wordSize && Array.isArray(S.words); - }, s.max = function(S, m) { - return S.cmp(m) > 0 ? S : m; - }, s.min = function(S, m) { - return S.cmp(m) < 0 ? S : m; - }, s.prototype._init = function(S, m, f) { - if (typeof S == "number") - return this._initNumber(S, m, f); - if (typeof S == "object") - return this._initArray(S, m, f); - m === "hex" && (m = 16), n(m === (m | 0) && m >= 2 && m <= 36), S = S.toString().replace(/\s+/g, ""); + s.isBN = function(A) { + return A instanceof s ? !0 : A !== null && typeof A == "object" && A.constructor.wordSize === s.wordSize && Array.isArray(A.words); + }, s.max = function(A, m) { + return A.cmp(m) > 0 ? A : m; + }, s.min = function(A, m) { + return A.cmp(m) < 0 ? A : m; + }, s.prototype._init = function(A, m, f) { + if (typeof A == "number") + return this._initNumber(A, m, f); + if (typeof A == "object") + return this._initArray(A, m, f); + m === "hex" && (m = 16), n(m === (m | 0) && m >= 2 && m <= 36), A = A.toString().replace(/\s+/g, ""); var g = 0; - S[0] === "-" && (g++, this.negative = 1), g < S.length && (m === 16 ? this._parseHex(S, g, f) : (this._parseBase(S, m, g), f === "le" && this._initArray(this.toArray(), m, f))); - }, s.prototype._initNumber = function(S, m, f) { - S < 0 && (this.negative = 1, S = -S), S < 67108864 ? (this.words = [S & 67108863], this.length = 1) : S < 4503599627370496 ? (this.words = [ - S & 67108863, - S / 67108864 & 67108863 - ], this.length = 2) : (n(S < 9007199254740992), this.words = [ - S & 67108863, - S / 67108864 & 67108863, + A[0] === "-" && (g++, this.negative = 1), g < A.length && (m === 16 ? this._parseHex(A, g, f) : (this._parseBase(A, m, g), f === "le" && this._initArray(this.toArray(), m, f))); + }, s.prototype._initNumber = function(A, m, f) { + A < 0 && (this.negative = 1, A = -A), A < 67108864 ? (this.words = [A & 67108863], this.length = 1) : A < 4503599627370496 ? (this.words = [ + A & 67108863, + A / 67108864 & 67108863 + ], this.length = 2) : (n(A < 9007199254740992), this.words = [ + A & 67108863, + A / 67108864 & 67108863, 1 ], this.length = 3), f === "le" && this._initArray(this.toArray(), m, f); - }, s.prototype._initArray = function(S, m, f) { - if (n(typeof S.length == "number"), S.length <= 0) + }, s.prototype._initArray = function(A, m, f) { + if (n(typeof A.length == "number"), A.length <= 0) return this.words = [0], this.length = 1, this; - this.length = Math.ceil(S.length / 3), this.words = new Array(this.length); + this.length = Math.ceil(A.length / 3), this.words = new Array(this.length); for (var g = 0; g < this.length; g++) this.words[g] = 0; - var b, x, _ = 0; + var b, x, E = 0; if (f === "be") - for (g = S.length - 1, b = 0; g >= 0; g -= 3) - x = S[g] | S[g - 1] << 8 | S[g - 2] << 16, this.words[b] |= x << _ & 67108863, this.words[b + 1] = x >>> 26 - _ & 67108863, _ += 24, _ >= 26 && (_ -= 26, b++); + for (g = A.length - 1, b = 0; g >= 0; g -= 3) + x = A[g] | A[g - 1] << 8 | A[g - 2] << 16, this.words[b] |= x << E & 67108863, this.words[b + 1] = x >>> 26 - E & 67108863, E += 24, E >= 26 && (E -= 26, b++); else if (f === "le") - for (g = 0, b = 0; g < S.length; g += 3) - x = S[g] | S[g + 1] << 8 | S[g + 2] << 16, this.words[b] |= x << _ & 67108863, this.words[b + 1] = x >>> 26 - _ & 67108863, _ += 24, _ >= 26 && (_ -= 26, b++); + for (g = 0, b = 0; g < A.length; g += 3) + x = A[g] | A[g + 1] << 8 | A[g + 2] << 16, this.words[b] |= x << E & 67108863, this.words[b + 1] = x >>> 26 - E & 67108863, E += 24, E >= 26 && (E -= 26, b++); return this.strip(); }; - function a(Y, S) { - var m = Y.charCodeAt(S); + function a(Y, A) { + var m = Y.charCodeAt(A); return m >= 65 && m <= 70 ? m - 55 : m >= 97 && m <= 102 ? m - 87 : m - 48 & 15; } - function u(Y, S, m) { + function u(Y, A, m) { var f = a(Y, m); - return m - 1 >= S && (f |= a(Y, m - 1) << 4), f; + return m - 1 >= A && (f |= a(Y, m - 1) << 4), f; } - s.prototype._parseHex = function(S, m, f) { - this.length = Math.ceil((S.length - m) / 6), this.words = new Array(this.length); + s.prototype._parseHex = function(A, m, f) { + this.length = Math.ceil((A.length - m) / 6), this.words = new Array(this.length); for (var g = 0; g < this.length; g++) this.words[g] = 0; - var b = 0, x = 0, _; + var b = 0, x = 0, E; if (f === "be") - for (g = S.length - 1; g >= m; g -= 2) - _ = u(S, m, g) << b, this.words[x] |= _ & 67108863, b >= 18 ? (b -= 18, x += 1, this.words[x] |= _ >>> 26) : b += 8; + for (g = A.length - 1; g >= m; g -= 2) + E = u(A, m, g) << b, this.words[x] |= E & 67108863, b >= 18 ? (b -= 18, x += 1, this.words[x] |= E >>> 26) : b += 8; else { - var E = S.length - m; - for (g = E % 2 === 0 ? m + 1 : m; g < S.length; g += 2) - _ = u(S, m, g) << b, this.words[x] |= _ & 67108863, b >= 18 ? (b -= 18, x += 1, this.words[x] |= _ >>> 26) : b += 8; + var S = A.length - m; + for (g = S % 2 === 0 ? m + 1 : m; g < A.length; g += 2) + E = u(A, m, g) << b, this.words[x] |= E & 67108863, b >= 18 ? (b -= 18, x += 1, this.words[x] |= E >>> 26) : b += 8; } this.strip(); }; - function l(Y, S, m, f) { - for (var g = 0, b = Math.min(Y.length, m), x = S; x < b; x++) { - var _ = Y.charCodeAt(x) - 48; - g *= f, _ >= 49 ? g += _ - 49 + 10 : _ >= 17 ? g += _ - 17 + 10 : g += _; + function l(Y, A, m, f) { + for (var g = 0, b = Math.min(Y.length, m), x = A; x < b; x++) { + var E = Y.charCodeAt(x) - 48; + g *= f, E >= 49 ? g += E - 49 + 10 : E >= 17 ? g += E - 17 + 10 : g += E; } return g; } - s.prototype._parseBase = function(S, m, f) { + s.prototype._parseBase = function(A, m, f) { this.words = [0], this.length = 1; for (var g = 0, b = 1; b <= 67108863; b *= m) g++; g--, b = b / m | 0; - for (var x = S.length - f, _ = x % g, E = Math.min(x, x - _) + f, v = 0, P = f; P < E; P += g) - v = l(S, P, P + g, m), this.imuln(b), this.words[0] + v < 67108864 ? this.words[0] += v : this._iaddn(v); - if (_ !== 0) { + for (var x = A.length - f, E = x % g, S = Math.min(x, x - E) + f, v = 0, M = f; M < S; M += g) + v = l(A, M, M + g, m), this.imuln(b), this.words[0] + v < 67108864 ? this.words[0] += v : this._iaddn(v); + if (E !== 0) { var I = 1; - for (v = l(S, P, S.length, m), P = 0; P < _; P++) + for (v = l(A, M, A.length, m), M = 0; M < E; M++) I *= m; this.imuln(I), this.words[0] + v < 67108864 ? this.words[0] += v : this._iaddn(v); } this.strip(); - }, s.prototype.copy = function(S) { - S.words = new Array(this.length); + }, s.prototype.copy = function(A) { + A.words = new Array(this.length); for (var m = 0; m < this.length; m++) - S.words[m] = this.words[m]; - S.length = this.length, S.negative = this.negative, S.red = this.red; + A.words[m] = this.words[m]; + A.length = this.length, A.negative = this.negative, A.red = this.red; }, s.prototype.clone = function() { - var S = new s(null); - return this.copy(S), S; - }, s.prototype._expand = function(S) { - for (; this.length < S; ) + var A = new s(null); + return this.copy(A), A; + }, s.prototype._expand = function(A) { + for (; this.length < A; ) this.words[this.length++] = 0; return this; }, s.prototype.strip = function() { @@ -13390,26 +13902,26 @@ Zv.exports; 52521875, 60466176 ]; - s.prototype.toString = function(S, m) { - S = S || 10, m = m | 0 || 1; + s.prototype.toString = function(A, m) { + A = A || 10, m = m | 0 || 1; var f; - if (S === 16 || S === "hex") { + if (A === 16 || A === "hex") { f = ""; for (var g = 0, b = 0, x = 0; x < this.length; x++) { - var _ = this.words[x], E = ((_ << g | b) & 16777215).toString(16); - b = _ >>> 24 - g & 16777215, g += 2, g >= 26 && (g -= 26, x--), b !== 0 || x !== this.length - 1 ? f = d[6 - E.length] + E + f : f = E + f; + var E = this.words[x], S = ((E << g | b) & 16777215).toString(16); + b = E >>> 24 - g & 16777215, g += 2, g >= 26 && (g -= 26, x--), b !== 0 || x !== this.length - 1 ? f = d[6 - S.length] + S + f : f = S + f; } for (b !== 0 && (f = b.toString(16) + f); f.length % m !== 0; ) f = "0" + f; return this.negative !== 0 && (f = "-" + f), f; } - if (S === (S | 0) && S >= 2 && S <= 36) { - var v = p[S], P = w[S]; + if (A === (A | 0) && A >= 2 && A <= 36) { + var v = p[A], M = w[A]; f = ""; var I = this.clone(); for (I.negative = 0; !I.isZero(); ) { - var F = I.modn(P).toString(S); - I = I.idivn(P), I.isZero() ? f = F + f : f = d[v - F.length] + F + f; + var F = I.modn(M).toString(A); + I = I.idivn(M), I.isZero() ? f = F + f : f = d[v - F.length] + F + f; } for (this.isZero() && (f = "0" + f); f.length % m !== 0; ) f = "0" + f; @@ -13417,129 +13929,129 @@ Zv.exports; } n(!1, "Base should be between 2 and 36"); }, s.prototype.toNumber = function() { - var S = this.words[0]; - return this.length === 2 ? S += this.words[1] * 67108864 : this.length === 3 && this.words[2] === 1 ? S += 4503599627370496 + this.words[1] * 67108864 : this.length > 2 && n(!1, "Number can only safely store up to 53 bits"), this.negative !== 0 ? -S : S; + var A = this.words[0]; + return this.length === 2 ? A += this.words[1] * 67108864 : this.length === 3 && this.words[2] === 1 ? A += 4503599627370496 + this.words[1] * 67108864 : this.length > 2 && n(!1, "Number can only safely store up to 53 bits"), this.negative !== 0 ? -A : A; }, s.prototype.toJSON = function() { return this.toString(16); - }, s.prototype.toBuffer = function(S, m) { - return n(typeof o < "u"), this.toArrayLike(o, S, m); - }, s.prototype.toArray = function(S, m) { - return this.toArrayLike(Array, S, m); - }, s.prototype.toArrayLike = function(S, m, f) { + }, s.prototype.toBuffer = function(A, m) { + return n(typeof o < "u"), this.toArrayLike(o, A, m); + }, s.prototype.toArray = function(A, m) { + return this.toArrayLike(Array, A, m); + }, s.prototype.toArrayLike = function(A, m, f) { var g = this.byteLength(), b = f || Math.max(1, g); n(g <= b, "byte array longer than desired length"), n(b > 0, "Requested array length <= 0"), this.strip(); - var x = m === "le", _ = new S(b), E, v, P = this.clone(); + var x = m === "le", E = new A(b), S, v, M = this.clone(); if (x) { - for (v = 0; !P.isZero(); v++) - E = P.andln(255), P.iushrn(8), _[v] = E; + for (v = 0; !M.isZero(); v++) + S = M.andln(255), M.iushrn(8), E[v] = S; for (; v < b; v++) - _[v] = 0; + E[v] = 0; } else { for (v = 0; v < b - g; v++) - _[v] = 0; - for (v = 0; !P.isZero(); v++) - E = P.andln(255), P.iushrn(8), _[b - v - 1] = E; + E[v] = 0; + for (v = 0; !M.isZero(); v++) + S = M.andln(255), M.iushrn(8), E[b - v - 1] = S; } - return _; - }, Math.clz32 ? s.prototype._countBits = function(S) { - return 32 - Math.clz32(S); - } : s.prototype._countBits = function(S) { - var m = S, f = 0; + return E; + }, Math.clz32 ? s.prototype._countBits = function(A) { + return 32 - Math.clz32(A); + } : s.prototype._countBits = function(A) { + var m = A, f = 0; return m >= 4096 && (f += 13, m >>>= 13), m >= 64 && (f += 7, m >>>= 7), m >= 8 && (f += 4, m >>>= 4), m >= 2 && (f += 2, m >>>= 2), f + m; - }, s.prototype._zeroBits = function(S) { - if (S === 0) return 26; - var m = S, f = 0; + }, s.prototype._zeroBits = function(A) { + if (A === 0) return 26; + var m = A, f = 0; return m & 8191 || (f += 13, m >>>= 13), m & 127 || (f += 7, m >>>= 7), m & 15 || (f += 4, m >>>= 4), m & 3 || (f += 2, m >>>= 2), m & 1 || f++, f; }, s.prototype.bitLength = function() { - var S = this.words[this.length - 1], m = this._countBits(S); + var A = this.words[this.length - 1], m = this._countBits(A); return (this.length - 1) * 26 + m; }; - function A(Y) { - for (var S = new Array(Y.bitLength()), m = 0; m < S.length; m++) { + function _(Y) { + for (var A = new Array(Y.bitLength()), m = 0; m < A.length; m++) { var f = m / 26 | 0, g = m % 26; - S[m] = (Y.words[f] & 1 << g) >>> g; + A[m] = (Y.words[f] & 1 << g) >>> g; } - return S; + return A; } s.prototype.zeroBits = function() { if (this.isZero()) return 0; - for (var S = 0, m = 0; m < this.length; m++) { + for (var A = 0, m = 0; m < this.length; m++) { var f = this._zeroBits(this.words[m]); - if (S += f, f !== 26) break; + if (A += f, f !== 26) break; } - return S; + return A; }, s.prototype.byteLength = function() { return Math.ceil(this.bitLength() / 8); - }, s.prototype.toTwos = function(S) { - return this.negative !== 0 ? this.abs().inotn(S).iaddn(1) : this.clone(); - }, s.prototype.fromTwos = function(S) { - return this.testn(S - 1) ? this.notn(S).iaddn(1).ineg() : this.clone(); + }, s.prototype.toTwos = function(A) { + return this.negative !== 0 ? this.abs().inotn(A).iaddn(1) : this.clone(); + }, s.prototype.fromTwos = function(A) { + return this.testn(A - 1) ? this.notn(A).iaddn(1).ineg() : this.clone(); }, s.prototype.isNeg = function() { return this.negative !== 0; }, s.prototype.neg = function() { return this.clone().ineg(); }, s.prototype.ineg = function() { return this.isZero() || (this.negative ^= 1), this; - }, s.prototype.iuor = function(S) { - for (; this.length < S.length; ) + }, s.prototype.iuor = function(A) { + for (; this.length < A.length; ) this.words[this.length++] = 0; - for (var m = 0; m < S.length; m++) - this.words[m] = this.words[m] | S.words[m]; + for (var m = 0; m < A.length; m++) + this.words[m] = this.words[m] | A.words[m]; return this.strip(); - }, s.prototype.ior = function(S) { - return n((this.negative | S.negative) === 0), this.iuor(S); - }, s.prototype.or = function(S) { - return this.length > S.length ? this.clone().ior(S) : S.clone().ior(this); - }, s.prototype.uor = function(S) { - return this.length > S.length ? this.clone().iuor(S) : S.clone().iuor(this); - }, s.prototype.iuand = function(S) { + }, s.prototype.ior = function(A) { + return n((this.negative | A.negative) === 0), this.iuor(A); + }, s.prototype.or = function(A) { + return this.length > A.length ? this.clone().ior(A) : A.clone().ior(this); + }, s.prototype.uor = function(A) { + return this.length > A.length ? this.clone().iuor(A) : A.clone().iuor(this); + }, s.prototype.iuand = function(A) { var m; - this.length > S.length ? m = S : m = this; + this.length > A.length ? m = A : m = this; for (var f = 0; f < m.length; f++) - this.words[f] = this.words[f] & S.words[f]; + this.words[f] = this.words[f] & A.words[f]; return this.length = m.length, this.strip(); - }, s.prototype.iand = function(S) { - return n((this.negative | S.negative) === 0), this.iuand(S); - }, s.prototype.and = function(S) { - return this.length > S.length ? this.clone().iand(S) : S.clone().iand(this); - }, s.prototype.uand = function(S) { - return this.length > S.length ? this.clone().iuand(S) : S.clone().iuand(this); - }, s.prototype.iuxor = function(S) { + }, s.prototype.iand = function(A) { + return n((this.negative | A.negative) === 0), this.iuand(A); + }, s.prototype.and = function(A) { + return this.length > A.length ? this.clone().iand(A) : A.clone().iand(this); + }, s.prototype.uand = function(A) { + return this.length > A.length ? this.clone().iuand(A) : A.clone().iuand(this); + }, s.prototype.iuxor = function(A) { var m, f; - this.length > S.length ? (m = this, f = S) : (m = S, f = this); + this.length > A.length ? (m = this, f = A) : (m = A, f = this); for (var g = 0; g < f.length; g++) this.words[g] = m.words[g] ^ f.words[g]; if (this !== m) for (; g < m.length; g++) this.words[g] = m.words[g]; return this.length = m.length, this.strip(); - }, s.prototype.ixor = function(S) { - return n((this.negative | S.negative) === 0), this.iuxor(S); - }, s.prototype.xor = function(S) { - return this.length > S.length ? this.clone().ixor(S) : S.clone().ixor(this); - }, s.prototype.uxor = function(S) { - return this.length > S.length ? this.clone().iuxor(S) : S.clone().iuxor(this); - }, s.prototype.inotn = function(S) { - n(typeof S == "number" && S >= 0); - var m = Math.ceil(S / 26) | 0, f = S % 26; + }, s.prototype.ixor = function(A) { + return n((this.negative | A.negative) === 0), this.iuxor(A); + }, s.prototype.xor = function(A) { + return this.length > A.length ? this.clone().ixor(A) : A.clone().ixor(this); + }, s.prototype.uxor = function(A) { + return this.length > A.length ? this.clone().iuxor(A) : A.clone().iuxor(this); + }, s.prototype.inotn = function(A) { + n(typeof A == "number" && A >= 0); + var m = Math.ceil(A / 26) | 0, f = A % 26; this._expand(m), f > 0 && m--; for (var g = 0; g < m; g++) this.words[g] = ~this.words[g] & 67108863; return f > 0 && (this.words[g] = ~this.words[g] & 67108863 >> 26 - f), this.strip(); - }, s.prototype.notn = function(S) { - return this.clone().inotn(S); - }, s.prototype.setn = function(S, m) { - n(typeof S == "number" && S >= 0); - var f = S / 26 | 0, g = S % 26; + }, s.prototype.notn = function(A) { + return this.clone().inotn(A); + }, s.prototype.setn = function(A, m) { + n(typeof A == "number" && A >= 0); + var f = A / 26 | 0, g = A % 26; return this._expand(f + 1), m ? this.words[f] = this.words[f] | 1 << g : this.words[f] = this.words[f] & ~(1 << g), this.strip(); - }, s.prototype.iadd = function(S) { + }, s.prototype.iadd = function(A) { var m; - if (this.negative !== 0 && S.negative === 0) - return this.negative = 0, m = this.isub(S), this.negative ^= 1, this._normSign(); - if (this.negative === 0 && S.negative !== 0) - return S.negative = 0, m = this.isub(S), S.negative = 1, m._normSign(); + if (this.negative !== 0 && A.negative === 0) + return this.negative = 0, m = this.isub(A), this.negative ^= 1, this._normSign(); + if (this.negative === 0 && A.negative !== 0) + return A.negative = 0, m = this.isub(A), A.negative = 1, m._normSign(); var f, g; - this.length > S.length ? (f = this, g = S) : (f = S, g = this); + this.length > A.length ? (f = this, g = A) : (f = A, g = this); for (var b = 0, x = 0; x < g.length; x++) m = (f.words[x] | 0) + (g.words[x] | 0) + b, this.words[x] = m & 67108863, b = m >>> 26; for (; b !== 0 && x < f.length; x++) @@ -13550,192 +14062,192 @@ Zv.exports; for (; x < f.length; x++) this.words[x] = f.words[x]; return this; - }, s.prototype.add = function(S) { + }, s.prototype.add = function(A) { var m; - return S.negative !== 0 && this.negative === 0 ? (S.negative = 0, m = this.sub(S), S.negative ^= 1, m) : S.negative === 0 && this.negative !== 0 ? (this.negative = 0, m = S.sub(this), this.negative = 1, m) : this.length > S.length ? this.clone().iadd(S) : S.clone().iadd(this); - }, s.prototype.isub = function(S) { - if (S.negative !== 0) { - S.negative = 0; - var m = this.iadd(S); - return S.negative = 1, m._normSign(); + return A.negative !== 0 && this.negative === 0 ? (A.negative = 0, m = this.sub(A), A.negative ^= 1, m) : A.negative === 0 && this.negative !== 0 ? (this.negative = 0, m = A.sub(this), this.negative = 1, m) : this.length > A.length ? this.clone().iadd(A) : A.clone().iadd(this); + }, s.prototype.isub = function(A) { + if (A.negative !== 0) { + A.negative = 0; + var m = this.iadd(A); + return A.negative = 1, m._normSign(); } else if (this.negative !== 0) - return this.negative = 0, this.iadd(S), this.negative = 1, this._normSign(); - var f = this.cmp(S); + return this.negative = 0, this.iadd(A), this.negative = 1, this._normSign(); + var f = this.cmp(A); if (f === 0) return this.negative = 0, this.length = 1, this.words[0] = 0, this; var g, b; - f > 0 ? (g = this, b = S) : (g = S, b = this); - for (var x = 0, _ = 0; _ < b.length; _++) - m = (g.words[_] | 0) - (b.words[_] | 0) + x, x = m >> 26, this.words[_] = m & 67108863; - for (; x !== 0 && _ < g.length; _++) - m = (g.words[_] | 0) + x, x = m >> 26, this.words[_] = m & 67108863; - if (x === 0 && _ < g.length && g !== this) - for (; _ < g.length; _++) - this.words[_] = g.words[_]; - return this.length = Math.max(this.length, _), g !== this && (this.negative = 1), this.strip(); - }, s.prototype.sub = function(S) { - return this.clone().isub(S); + f > 0 ? (g = this, b = A) : (g = A, b = this); + for (var x = 0, E = 0; E < b.length; E++) + m = (g.words[E] | 0) - (b.words[E] | 0) + x, x = m >> 26, this.words[E] = m & 67108863; + for (; x !== 0 && E < g.length; E++) + m = (g.words[E] | 0) + x, x = m >> 26, this.words[E] = m & 67108863; + if (x === 0 && E < g.length && g !== this) + for (; E < g.length; E++) + this.words[E] = g.words[E]; + return this.length = Math.max(this.length, E), g !== this && (this.negative = 1), this.strip(); + }, s.prototype.sub = function(A) { + return this.clone().isub(A); }; - function M(Y, S, m) { - m.negative = S.negative ^ Y.negative; - var f = Y.length + S.length | 0; + function P(Y, A, m) { + m.negative = A.negative ^ Y.negative; + var f = Y.length + A.length | 0; m.length = f, f = f - 1 | 0; - var g = Y.words[0] | 0, b = S.words[0] | 0, x = g * b, _ = x & 67108863, E = x / 67108864 | 0; - m.words[0] = _; + var g = Y.words[0] | 0, b = A.words[0] | 0, x = g * b, E = x & 67108863, S = x / 67108864 | 0; + m.words[0] = E; for (var v = 1; v < f; v++) { - for (var P = E >>> 26, I = E & 67108863, F = Math.min(v, S.length - 1), ce = Math.max(0, v - Y.length + 1); ce <= F; ce++) { + for (var M = S >>> 26, I = S & 67108863, F = Math.min(v, A.length - 1), ce = Math.max(0, v - Y.length + 1); ce <= F; ce++) { var D = v - ce | 0; - g = Y.words[D] | 0, b = S.words[ce] | 0, x = g * b + I, P += x / 67108864 | 0, I = x & 67108863; - } - m.words[v] = I | 0, E = P | 0; - } - return E !== 0 ? m.words[v] = E | 0 : m.length--, m.strip(); - } - var N = function(S, m, f) { - var g = S.words, b = m.words, x = f.words, _ = 0, E, v, P, I = g[0] | 0, F = I & 8191, ce = I >>> 13, D = g[1] | 0, oe = D & 8191, Z = D >>> 13, J = g[2] | 0, Q = J & 8191, T = J >>> 13, X = g[3] | 0, re = X & 8191, pe = X >>> 13, ie = g[4] | 0, ue = ie & 8191, ve = ie >>> 13, Pe = g[5] | 0, De = Pe & 8191, Ce = Pe >>> 13, $e = g[6] | 0, Me = $e & 8191, Ne = $e >>> 13, Ke = g[7] | 0, Le = Ke & 8191, qe = Ke >>> 13, ze = g[8] | 0, _e = ze & 8191, Ze = ze >>> 13, at = g[9] | 0, ke = at & 8191, Qe = at >>> 13, tt = b[0] | 0, Ye = tt & 8191, dt = tt >>> 13, lt = b[1] | 0, ct = lt & 8191, qt = lt >>> 13, Jt = b[2] | 0, Et = Jt & 8191, er = Jt >>> 13, Xt = b[3] | 0, Dt = Xt & 8191, kt = Xt >>> 13, Ct = b[4] | 0, gt = Ct & 8191, Rt = Ct >>> 13, Nt = b[5] | 0, vt = Nt & 8191, $t = Nt >>> 13, Ft = b[6] | 0, rt = Ft & 8191, Bt = Ft >>> 13, k = b[7] | 0, q = k & 8191, W = k >>> 13, C = b[8] | 0, G = C & 8191, j = C >>> 13, se = b[9] | 0, de = se & 8191, xe = se >>> 13; - f.negative = S.negative ^ m.negative, f.length = 19, E = Math.imul(F, Ye), v = Math.imul(F, dt), v = v + Math.imul(ce, Ye) | 0, P = Math.imul(ce, dt); - var Te = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (Te >>> 26) | 0, Te &= 67108863, E = Math.imul(oe, Ye), v = Math.imul(oe, dt), v = v + Math.imul(Z, Ye) | 0, P = Math.imul(Z, dt), E = E + Math.imul(F, ct) | 0, v = v + Math.imul(F, qt) | 0, v = v + Math.imul(ce, ct) | 0, P = P + Math.imul(ce, qt) | 0; - var Re = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (Re >>> 26) | 0, Re &= 67108863, E = Math.imul(Q, Ye), v = Math.imul(Q, dt), v = v + Math.imul(T, Ye) | 0, P = Math.imul(T, dt), E = E + Math.imul(oe, ct) | 0, v = v + Math.imul(oe, qt) | 0, v = v + Math.imul(Z, ct) | 0, P = P + Math.imul(Z, qt) | 0, E = E + Math.imul(F, Et) | 0, v = v + Math.imul(F, er) | 0, v = v + Math.imul(ce, Et) | 0, P = P + Math.imul(ce, er) | 0; - var nt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, E = Math.imul(re, Ye), v = Math.imul(re, dt), v = v + Math.imul(pe, Ye) | 0, P = Math.imul(pe, dt), E = E + Math.imul(Q, ct) | 0, v = v + Math.imul(Q, qt) | 0, v = v + Math.imul(T, ct) | 0, P = P + Math.imul(T, qt) | 0, E = E + Math.imul(oe, Et) | 0, v = v + Math.imul(oe, er) | 0, v = v + Math.imul(Z, Et) | 0, P = P + Math.imul(Z, er) | 0, E = E + Math.imul(F, Dt) | 0, v = v + Math.imul(F, kt) | 0, v = v + Math.imul(ce, Dt) | 0, P = P + Math.imul(ce, kt) | 0; - var je = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (je >>> 26) | 0, je &= 67108863, E = Math.imul(ue, Ye), v = Math.imul(ue, dt), v = v + Math.imul(ve, Ye) | 0, P = Math.imul(ve, dt), E = E + Math.imul(re, ct) | 0, v = v + Math.imul(re, qt) | 0, v = v + Math.imul(pe, ct) | 0, P = P + Math.imul(pe, qt) | 0, E = E + Math.imul(Q, Et) | 0, v = v + Math.imul(Q, er) | 0, v = v + Math.imul(T, Et) | 0, P = P + Math.imul(T, er) | 0, E = E + Math.imul(oe, Dt) | 0, v = v + Math.imul(oe, kt) | 0, v = v + Math.imul(Z, Dt) | 0, P = P + Math.imul(Z, kt) | 0, E = E + Math.imul(F, gt) | 0, v = v + Math.imul(F, Rt) | 0, v = v + Math.imul(ce, gt) | 0, P = P + Math.imul(ce, Rt) | 0; - var pt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (pt >>> 26) | 0, pt &= 67108863, E = Math.imul(De, Ye), v = Math.imul(De, dt), v = v + Math.imul(Ce, Ye) | 0, P = Math.imul(Ce, dt), E = E + Math.imul(ue, ct) | 0, v = v + Math.imul(ue, qt) | 0, v = v + Math.imul(ve, ct) | 0, P = P + Math.imul(ve, qt) | 0, E = E + Math.imul(re, Et) | 0, v = v + Math.imul(re, er) | 0, v = v + Math.imul(pe, Et) | 0, P = P + Math.imul(pe, er) | 0, E = E + Math.imul(Q, Dt) | 0, v = v + Math.imul(Q, kt) | 0, v = v + Math.imul(T, Dt) | 0, P = P + Math.imul(T, kt) | 0, E = E + Math.imul(oe, gt) | 0, v = v + Math.imul(oe, Rt) | 0, v = v + Math.imul(Z, gt) | 0, P = P + Math.imul(Z, Rt) | 0, E = E + Math.imul(F, vt) | 0, v = v + Math.imul(F, $t) | 0, v = v + Math.imul(ce, vt) | 0, P = P + Math.imul(ce, $t) | 0; - var it = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, E = Math.imul(Me, Ye), v = Math.imul(Me, dt), v = v + Math.imul(Ne, Ye) | 0, P = Math.imul(Ne, dt), E = E + Math.imul(De, ct) | 0, v = v + Math.imul(De, qt) | 0, v = v + Math.imul(Ce, ct) | 0, P = P + Math.imul(Ce, qt) | 0, E = E + Math.imul(ue, Et) | 0, v = v + Math.imul(ue, er) | 0, v = v + Math.imul(ve, Et) | 0, P = P + Math.imul(ve, er) | 0, E = E + Math.imul(re, Dt) | 0, v = v + Math.imul(re, kt) | 0, v = v + Math.imul(pe, Dt) | 0, P = P + Math.imul(pe, kt) | 0, E = E + Math.imul(Q, gt) | 0, v = v + Math.imul(Q, Rt) | 0, v = v + Math.imul(T, gt) | 0, P = P + Math.imul(T, Rt) | 0, E = E + Math.imul(oe, vt) | 0, v = v + Math.imul(oe, $t) | 0, v = v + Math.imul(Z, vt) | 0, P = P + Math.imul(Z, $t) | 0, E = E + Math.imul(F, rt) | 0, v = v + Math.imul(F, Bt) | 0, v = v + Math.imul(ce, rt) | 0, P = P + Math.imul(ce, Bt) | 0; - var et = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, E = Math.imul(Le, Ye), v = Math.imul(Le, dt), v = v + Math.imul(qe, Ye) | 0, P = Math.imul(qe, dt), E = E + Math.imul(Me, ct) | 0, v = v + Math.imul(Me, qt) | 0, v = v + Math.imul(Ne, ct) | 0, P = P + Math.imul(Ne, qt) | 0, E = E + Math.imul(De, Et) | 0, v = v + Math.imul(De, er) | 0, v = v + Math.imul(Ce, Et) | 0, P = P + Math.imul(Ce, er) | 0, E = E + Math.imul(ue, Dt) | 0, v = v + Math.imul(ue, kt) | 0, v = v + Math.imul(ve, Dt) | 0, P = P + Math.imul(ve, kt) | 0, E = E + Math.imul(re, gt) | 0, v = v + Math.imul(re, Rt) | 0, v = v + Math.imul(pe, gt) | 0, P = P + Math.imul(pe, Rt) | 0, E = E + Math.imul(Q, vt) | 0, v = v + Math.imul(Q, $t) | 0, v = v + Math.imul(T, vt) | 0, P = P + Math.imul(T, $t) | 0, E = E + Math.imul(oe, rt) | 0, v = v + Math.imul(oe, Bt) | 0, v = v + Math.imul(Z, rt) | 0, P = P + Math.imul(Z, Bt) | 0, E = E + Math.imul(F, q) | 0, v = v + Math.imul(F, W) | 0, v = v + Math.imul(ce, q) | 0, P = P + Math.imul(ce, W) | 0; - var St = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, E = Math.imul(_e, Ye), v = Math.imul(_e, dt), v = v + Math.imul(Ze, Ye) | 0, P = Math.imul(Ze, dt), E = E + Math.imul(Le, ct) | 0, v = v + Math.imul(Le, qt) | 0, v = v + Math.imul(qe, ct) | 0, P = P + Math.imul(qe, qt) | 0, E = E + Math.imul(Me, Et) | 0, v = v + Math.imul(Me, er) | 0, v = v + Math.imul(Ne, Et) | 0, P = P + Math.imul(Ne, er) | 0, E = E + Math.imul(De, Dt) | 0, v = v + Math.imul(De, kt) | 0, v = v + Math.imul(Ce, Dt) | 0, P = P + Math.imul(Ce, kt) | 0, E = E + Math.imul(ue, gt) | 0, v = v + Math.imul(ue, Rt) | 0, v = v + Math.imul(ve, gt) | 0, P = P + Math.imul(ve, Rt) | 0, E = E + Math.imul(re, vt) | 0, v = v + Math.imul(re, $t) | 0, v = v + Math.imul(pe, vt) | 0, P = P + Math.imul(pe, $t) | 0, E = E + Math.imul(Q, rt) | 0, v = v + Math.imul(Q, Bt) | 0, v = v + Math.imul(T, rt) | 0, P = P + Math.imul(T, Bt) | 0, E = E + Math.imul(oe, q) | 0, v = v + Math.imul(oe, W) | 0, v = v + Math.imul(Z, q) | 0, P = P + Math.imul(Z, W) | 0, E = E + Math.imul(F, G) | 0, v = v + Math.imul(F, j) | 0, v = v + Math.imul(ce, G) | 0, P = P + Math.imul(ce, j) | 0; - var Tt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, E = Math.imul(ke, Ye), v = Math.imul(ke, dt), v = v + Math.imul(Qe, Ye) | 0, P = Math.imul(Qe, dt), E = E + Math.imul(_e, ct) | 0, v = v + Math.imul(_e, qt) | 0, v = v + Math.imul(Ze, ct) | 0, P = P + Math.imul(Ze, qt) | 0, E = E + Math.imul(Le, Et) | 0, v = v + Math.imul(Le, er) | 0, v = v + Math.imul(qe, Et) | 0, P = P + Math.imul(qe, er) | 0, E = E + Math.imul(Me, Dt) | 0, v = v + Math.imul(Me, kt) | 0, v = v + Math.imul(Ne, Dt) | 0, P = P + Math.imul(Ne, kt) | 0, E = E + Math.imul(De, gt) | 0, v = v + Math.imul(De, Rt) | 0, v = v + Math.imul(Ce, gt) | 0, P = P + Math.imul(Ce, Rt) | 0, E = E + Math.imul(ue, vt) | 0, v = v + Math.imul(ue, $t) | 0, v = v + Math.imul(ve, vt) | 0, P = P + Math.imul(ve, $t) | 0, E = E + Math.imul(re, rt) | 0, v = v + Math.imul(re, Bt) | 0, v = v + Math.imul(pe, rt) | 0, P = P + Math.imul(pe, Bt) | 0, E = E + Math.imul(Q, q) | 0, v = v + Math.imul(Q, W) | 0, v = v + Math.imul(T, q) | 0, P = P + Math.imul(T, W) | 0, E = E + Math.imul(oe, G) | 0, v = v + Math.imul(oe, j) | 0, v = v + Math.imul(Z, G) | 0, P = P + Math.imul(Z, j) | 0, E = E + Math.imul(F, de) | 0, v = v + Math.imul(F, xe) | 0, v = v + Math.imul(ce, de) | 0, P = P + Math.imul(ce, xe) | 0; - var At = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, E = Math.imul(ke, ct), v = Math.imul(ke, qt), v = v + Math.imul(Qe, ct) | 0, P = Math.imul(Qe, qt), E = E + Math.imul(_e, Et) | 0, v = v + Math.imul(_e, er) | 0, v = v + Math.imul(Ze, Et) | 0, P = P + Math.imul(Ze, er) | 0, E = E + Math.imul(Le, Dt) | 0, v = v + Math.imul(Le, kt) | 0, v = v + Math.imul(qe, Dt) | 0, P = P + Math.imul(qe, kt) | 0, E = E + Math.imul(Me, gt) | 0, v = v + Math.imul(Me, Rt) | 0, v = v + Math.imul(Ne, gt) | 0, P = P + Math.imul(Ne, Rt) | 0, E = E + Math.imul(De, vt) | 0, v = v + Math.imul(De, $t) | 0, v = v + Math.imul(Ce, vt) | 0, P = P + Math.imul(Ce, $t) | 0, E = E + Math.imul(ue, rt) | 0, v = v + Math.imul(ue, Bt) | 0, v = v + Math.imul(ve, rt) | 0, P = P + Math.imul(ve, Bt) | 0, E = E + Math.imul(re, q) | 0, v = v + Math.imul(re, W) | 0, v = v + Math.imul(pe, q) | 0, P = P + Math.imul(pe, W) | 0, E = E + Math.imul(Q, G) | 0, v = v + Math.imul(Q, j) | 0, v = v + Math.imul(T, G) | 0, P = P + Math.imul(T, j) | 0, E = E + Math.imul(oe, de) | 0, v = v + Math.imul(oe, xe) | 0, v = v + Math.imul(Z, de) | 0, P = P + Math.imul(Z, xe) | 0; - var _t = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, E = Math.imul(ke, Et), v = Math.imul(ke, er), v = v + Math.imul(Qe, Et) | 0, P = Math.imul(Qe, er), E = E + Math.imul(_e, Dt) | 0, v = v + Math.imul(_e, kt) | 0, v = v + Math.imul(Ze, Dt) | 0, P = P + Math.imul(Ze, kt) | 0, E = E + Math.imul(Le, gt) | 0, v = v + Math.imul(Le, Rt) | 0, v = v + Math.imul(qe, gt) | 0, P = P + Math.imul(qe, Rt) | 0, E = E + Math.imul(Me, vt) | 0, v = v + Math.imul(Me, $t) | 0, v = v + Math.imul(Ne, vt) | 0, P = P + Math.imul(Ne, $t) | 0, E = E + Math.imul(De, rt) | 0, v = v + Math.imul(De, Bt) | 0, v = v + Math.imul(Ce, rt) | 0, P = P + Math.imul(Ce, Bt) | 0, E = E + Math.imul(ue, q) | 0, v = v + Math.imul(ue, W) | 0, v = v + Math.imul(ve, q) | 0, P = P + Math.imul(ve, W) | 0, E = E + Math.imul(re, G) | 0, v = v + Math.imul(re, j) | 0, v = v + Math.imul(pe, G) | 0, P = P + Math.imul(pe, j) | 0, E = E + Math.imul(Q, de) | 0, v = v + Math.imul(Q, xe) | 0, v = v + Math.imul(T, de) | 0, P = P + Math.imul(T, xe) | 0; - var ht = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, E = Math.imul(ke, Dt), v = Math.imul(ke, kt), v = v + Math.imul(Qe, Dt) | 0, P = Math.imul(Qe, kt), E = E + Math.imul(_e, gt) | 0, v = v + Math.imul(_e, Rt) | 0, v = v + Math.imul(Ze, gt) | 0, P = P + Math.imul(Ze, Rt) | 0, E = E + Math.imul(Le, vt) | 0, v = v + Math.imul(Le, $t) | 0, v = v + Math.imul(qe, vt) | 0, P = P + Math.imul(qe, $t) | 0, E = E + Math.imul(Me, rt) | 0, v = v + Math.imul(Me, Bt) | 0, v = v + Math.imul(Ne, rt) | 0, P = P + Math.imul(Ne, Bt) | 0, E = E + Math.imul(De, q) | 0, v = v + Math.imul(De, W) | 0, v = v + Math.imul(Ce, q) | 0, P = P + Math.imul(Ce, W) | 0, E = E + Math.imul(ue, G) | 0, v = v + Math.imul(ue, j) | 0, v = v + Math.imul(ve, G) | 0, P = P + Math.imul(ve, j) | 0, E = E + Math.imul(re, de) | 0, v = v + Math.imul(re, xe) | 0, v = v + Math.imul(pe, de) | 0, P = P + Math.imul(pe, xe) | 0; - var xt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, E = Math.imul(ke, gt), v = Math.imul(ke, Rt), v = v + Math.imul(Qe, gt) | 0, P = Math.imul(Qe, Rt), E = E + Math.imul(_e, vt) | 0, v = v + Math.imul(_e, $t) | 0, v = v + Math.imul(Ze, vt) | 0, P = P + Math.imul(Ze, $t) | 0, E = E + Math.imul(Le, rt) | 0, v = v + Math.imul(Le, Bt) | 0, v = v + Math.imul(qe, rt) | 0, P = P + Math.imul(qe, Bt) | 0, E = E + Math.imul(Me, q) | 0, v = v + Math.imul(Me, W) | 0, v = v + Math.imul(Ne, q) | 0, P = P + Math.imul(Ne, W) | 0, E = E + Math.imul(De, G) | 0, v = v + Math.imul(De, j) | 0, v = v + Math.imul(Ce, G) | 0, P = P + Math.imul(Ce, j) | 0, E = E + Math.imul(ue, de) | 0, v = v + Math.imul(ue, xe) | 0, v = v + Math.imul(ve, de) | 0, P = P + Math.imul(ve, xe) | 0; - var st = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, E = Math.imul(ke, vt), v = Math.imul(ke, $t), v = v + Math.imul(Qe, vt) | 0, P = Math.imul(Qe, $t), E = E + Math.imul(_e, rt) | 0, v = v + Math.imul(_e, Bt) | 0, v = v + Math.imul(Ze, rt) | 0, P = P + Math.imul(Ze, Bt) | 0, E = E + Math.imul(Le, q) | 0, v = v + Math.imul(Le, W) | 0, v = v + Math.imul(qe, q) | 0, P = P + Math.imul(qe, W) | 0, E = E + Math.imul(Me, G) | 0, v = v + Math.imul(Me, j) | 0, v = v + Math.imul(Ne, G) | 0, P = P + Math.imul(Ne, j) | 0, E = E + Math.imul(De, de) | 0, v = v + Math.imul(De, xe) | 0, v = v + Math.imul(Ce, de) | 0, P = P + Math.imul(Ce, xe) | 0; - var bt = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, E = Math.imul(ke, rt), v = Math.imul(ke, Bt), v = v + Math.imul(Qe, rt) | 0, P = Math.imul(Qe, Bt), E = E + Math.imul(_e, q) | 0, v = v + Math.imul(_e, W) | 0, v = v + Math.imul(Ze, q) | 0, P = P + Math.imul(Ze, W) | 0, E = E + Math.imul(Le, G) | 0, v = v + Math.imul(Le, j) | 0, v = v + Math.imul(qe, G) | 0, P = P + Math.imul(qe, j) | 0, E = E + Math.imul(Me, de) | 0, v = v + Math.imul(Me, xe) | 0, v = v + Math.imul(Ne, de) | 0, P = P + Math.imul(Ne, xe) | 0; - var ut = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, E = Math.imul(ke, q), v = Math.imul(ke, W), v = v + Math.imul(Qe, q) | 0, P = Math.imul(Qe, W), E = E + Math.imul(_e, G) | 0, v = v + Math.imul(_e, j) | 0, v = v + Math.imul(Ze, G) | 0, P = P + Math.imul(Ze, j) | 0, E = E + Math.imul(Le, de) | 0, v = v + Math.imul(Le, xe) | 0, v = v + Math.imul(qe, de) | 0, P = P + Math.imul(qe, xe) | 0; - var ot = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, E = Math.imul(ke, G), v = Math.imul(ke, j), v = v + Math.imul(Qe, G) | 0, P = Math.imul(Qe, j), E = E + Math.imul(_e, de) | 0, v = v + Math.imul(_e, xe) | 0, v = v + Math.imul(Ze, de) | 0, P = P + Math.imul(Ze, xe) | 0; - var Se = (_ + E | 0) + ((v & 8191) << 13) | 0; - _ = (P + (v >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, E = Math.imul(ke, de), v = Math.imul(ke, xe), v = v + Math.imul(Qe, de) | 0, P = Math.imul(Qe, xe); - var Ae = (_ + E | 0) + ((v & 8191) << 13) | 0; - return _ = (P + (v >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, x[0] = Te, x[1] = Re, x[2] = nt, x[3] = je, x[4] = pt, x[5] = it, x[6] = et, x[7] = St, x[8] = Tt, x[9] = At, x[10] = _t, x[11] = ht, x[12] = xt, x[13] = st, x[14] = bt, x[15] = ut, x[16] = ot, x[17] = Se, x[18] = Ae, _ !== 0 && (x[19] = _, f.length++), f; + g = Y.words[D] | 0, b = A.words[ce] | 0, x = g * b + I, M += x / 67108864 | 0, I = x & 67108863; + } + m.words[v] = I | 0, S = M | 0; + } + return S !== 0 ? m.words[v] = S | 0 : m.length--, m.strip(); + } + var O = function(A, m, f) { + var g = A.words, b = m.words, x = f.words, E = 0, S, v, M, I = g[0] | 0, F = I & 8191, ce = I >>> 13, D = g[1] | 0, oe = D & 8191, Z = D >>> 13, J = g[2] | 0, ee = J & 8191, T = J >>> 13, X = g[3] | 0, re = X & 8191, pe = X >>> 13, ie = g[4] | 0, ue = ie & 8191, ve = ie >>> 13, Pe = g[5] | 0, De = Pe & 8191, Ce = Pe >>> 13, $e = g[6] | 0, Me = $e & 8191, Ne = $e >>> 13, Ke = g[7] | 0, Le = Ke & 8191, qe = Ke >>> 13, ze = g[8] | 0, _e = ze & 8191, Ze = ze >>> 13, at = g[9] | 0, ke = at & 8191, Qe = at >>> 13, tt = b[0] | 0, Ye = tt & 8191, dt = tt >>> 13, lt = b[1] | 0, ct = lt & 8191, qt = lt >>> 13, Jt = b[2] | 0, Et = Jt & 8191, er = Jt >>> 13, Xt = b[3] | 0, Dt = Xt & 8191, kt = Xt >>> 13, Ct = b[4] | 0, mt = Ct & 8191, Rt = Ct >>> 13, Nt = b[5] | 0, bt = Nt & 8191, $t = Nt >>> 13, Ft = b[6] | 0, rt = Ft & 8191, Bt = Ft >>> 13, $ = b[7] | 0, z = $ & 8191, H = $ >>> 13, C = b[8] | 0, G = C & 8191, j = C >>> 13, se = b[9] | 0, de = se & 8191, xe = se >>> 13; + f.negative = A.negative ^ m.negative, f.length = 19, S = Math.imul(F, Ye), v = Math.imul(F, dt), v = v + Math.imul(ce, Ye) | 0, M = Math.imul(ce, dt); + var Te = (E + S | 0) + ((v & 8191) << 13) | 0; + E = (M + (v >>> 13) | 0) + (Te >>> 26) | 0, Te &= 67108863, S = Math.imul(oe, Ye), v = Math.imul(oe, dt), v = v + Math.imul(Z, Ye) | 0, M = Math.imul(Z, dt), S = S + Math.imul(F, ct) | 0, v = v + Math.imul(F, qt) | 0, v = v + Math.imul(ce, ct) | 0, M = M + Math.imul(ce, qt) | 0; + var Re = (E + S | 0) + ((v & 8191) << 13) | 0; + E = (M + (v >>> 13) | 0) + (Re >>> 26) | 0, Re &= 67108863, S = Math.imul(ee, Ye), v = Math.imul(ee, dt), v = v + Math.imul(T, Ye) | 0, M = Math.imul(T, dt), S = S + Math.imul(oe, ct) | 0, v = v + Math.imul(oe, qt) | 0, v = v + Math.imul(Z, ct) | 0, M = M + Math.imul(Z, qt) | 0, S = S + Math.imul(F, Et) | 0, v = v + Math.imul(F, er) | 0, v = v + Math.imul(ce, Et) | 0, M = M + Math.imul(ce, er) | 0; + var nt = (E + S | 0) + ((v & 8191) << 13) | 0; + E = (M + (v >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, S = Math.imul(re, Ye), v = Math.imul(re, dt), v = v + Math.imul(pe, Ye) | 0, M = Math.imul(pe, dt), S = S + Math.imul(ee, ct) | 0, v = v + Math.imul(ee, qt) | 0, v = v + Math.imul(T, ct) | 0, M = M + Math.imul(T, qt) | 0, S = S + Math.imul(oe, Et) | 0, v = v + Math.imul(oe, er) | 0, v = v + Math.imul(Z, Et) | 0, M = M + Math.imul(Z, er) | 0, S = S + Math.imul(F, Dt) | 0, v = v + Math.imul(F, kt) | 0, v = v + Math.imul(ce, Dt) | 0, M = M + Math.imul(ce, kt) | 0; + var je = (E + S | 0) + ((v & 8191) << 13) | 0; + E = (M + (v >>> 13) | 0) + (je >>> 26) | 0, je &= 67108863, S = Math.imul(ue, Ye), v = Math.imul(ue, dt), v = v + Math.imul(ve, Ye) | 0, M = Math.imul(ve, dt), S = S + Math.imul(re, ct) | 0, v = v + Math.imul(re, qt) | 0, v = v + Math.imul(pe, ct) | 0, M = M + Math.imul(pe, qt) | 0, S = S + Math.imul(ee, Et) | 0, v = v + Math.imul(ee, er) | 0, v = v + Math.imul(T, Et) | 0, M = M + Math.imul(T, er) | 0, S = S + Math.imul(oe, Dt) | 0, v = v + Math.imul(oe, kt) | 0, v = v + Math.imul(Z, Dt) | 0, M = M + Math.imul(Z, kt) | 0, S = S + Math.imul(F, mt) | 0, v = v + Math.imul(F, Rt) | 0, v = v + Math.imul(ce, mt) | 0, M = M + Math.imul(ce, Rt) | 0; + var pt = (E + S | 0) + ((v & 8191) << 13) | 0; + E = (M + (v >>> 13) | 0) + (pt >>> 26) | 0, pt &= 67108863, S = Math.imul(De, Ye), v = Math.imul(De, dt), v = v + Math.imul(Ce, Ye) | 0, M = Math.imul(Ce, dt), S = S + Math.imul(ue, ct) | 0, v = v + Math.imul(ue, qt) | 0, v = v + Math.imul(ve, ct) | 0, M = M + Math.imul(ve, qt) | 0, S = S + Math.imul(re, Et) | 0, v = v + Math.imul(re, er) | 0, v = v + Math.imul(pe, Et) | 0, M = M + Math.imul(pe, er) | 0, S = S + Math.imul(ee, Dt) | 0, v = v + Math.imul(ee, kt) | 0, v = v + Math.imul(T, Dt) | 0, M = M + Math.imul(T, kt) | 0, S = S + Math.imul(oe, mt) | 0, v = v + Math.imul(oe, Rt) | 0, v = v + Math.imul(Z, mt) | 0, M = M + Math.imul(Z, Rt) | 0, S = S + Math.imul(F, bt) | 0, v = v + Math.imul(F, $t) | 0, v = v + Math.imul(ce, bt) | 0, M = M + Math.imul(ce, $t) | 0; + var it = (E + S | 0) + ((v & 8191) << 13) | 0; + E = (M + (v >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, S = Math.imul(Me, Ye), v = Math.imul(Me, dt), v = v + Math.imul(Ne, Ye) | 0, M = Math.imul(Ne, dt), S = S + Math.imul(De, ct) | 0, v = v + Math.imul(De, qt) | 0, v = v + Math.imul(Ce, ct) | 0, M = M + Math.imul(Ce, qt) | 0, S = S + Math.imul(ue, Et) | 0, v = v + Math.imul(ue, er) | 0, v = v + Math.imul(ve, Et) | 0, M = M + Math.imul(ve, er) | 0, S = S + Math.imul(re, Dt) | 0, v = v + Math.imul(re, kt) | 0, v = v + Math.imul(pe, Dt) | 0, M = M + Math.imul(pe, kt) | 0, S = S + Math.imul(ee, mt) | 0, v = v + Math.imul(ee, Rt) | 0, v = v + Math.imul(T, mt) | 0, M = M + Math.imul(T, Rt) | 0, S = S + Math.imul(oe, bt) | 0, v = v + Math.imul(oe, $t) | 0, v = v + Math.imul(Z, bt) | 0, M = M + Math.imul(Z, $t) | 0, S = S + Math.imul(F, rt) | 0, v = v + Math.imul(F, Bt) | 0, v = v + Math.imul(ce, rt) | 0, M = M + Math.imul(ce, Bt) | 0; + var et = (E + S | 0) + ((v & 8191) << 13) | 0; + E = (M + (v >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, S = Math.imul(Le, Ye), v = Math.imul(Le, dt), v = v + Math.imul(qe, Ye) | 0, M = Math.imul(qe, dt), S = S + Math.imul(Me, ct) | 0, v = v + Math.imul(Me, qt) | 0, v = v + Math.imul(Ne, ct) | 0, M = M + Math.imul(Ne, qt) | 0, S = S + Math.imul(De, Et) | 0, v = v + Math.imul(De, er) | 0, v = v + Math.imul(Ce, Et) | 0, M = M + Math.imul(Ce, er) | 0, S = S + Math.imul(ue, Dt) | 0, v = v + Math.imul(ue, kt) | 0, v = v + Math.imul(ve, Dt) | 0, M = M + Math.imul(ve, kt) | 0, S = S + Math.imul(re, mt) | 0, v = v + Math.imul(re, Rt) | 0, v = v + Math.imul(pe, mt) | 0, M = M + Math.imul(pe, Rt) | 0, S = S + Math.imul(ee, bt) | 0, v = v + Math.imul(ee, $t) | 0, v = v + Math.imul(T, bt) | 0, M = M + Math.imul(T, $t) | 0, S = S + Math.imul(oe, rt) | 0, v = v + Math.imul(oe, Bt) | 0, v = v + Math.imul(Z, rt) | 0, M = M + Math.imul(Z, Bt) | 0, S = S + Math.imul(F, z) | 0, v = v + Math.imul(F, H) | 0, v = v + Math.imul(ce, z) | 0, M = M + Math.imul(ce, H) | 0; + var St = (E + S | 0) + ((v & 8191) << 13) | 0; + E = (M + (v >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, S = Math.imul(_e, Ye), v = Math.imul(_e, dt), v = v + Math.imul(Ze, Ye) | 0, M = Math.imul(Ze, dt), S = S + Math.imul(Le, ct) | 0, v = v + Math.imul(Le, qt) | 0, v = v + Math.imul(qe, ct) | 0, M = M + Math.imul(qe, qt) | 0, S = S + Math.imul(Me, Et) | 0, v = v + Math.imul(Me, er) | 0, v = v + Math.imul(Ne, Et) | 0, M = M + Math.imul(Ne, er) | 0, S = S + Math.imul(De, Dt) | 0, v = v + Math.imul(De, kt) | 0, v = v + Math.imul(Ce, Dt) | 0, M = M + Math.imul(Ce, kt) | 0, S = S + Math.imul(ue, mt) | 0, v = v + Math.imul(ue, Rt) | 0, v = v + Math.imul(ve, mt) | 0, M = M + Math.imul(ve, Rt) | 0, S = S + Math.imul(re, bt) | 0, v = v + Math.imul(re, $t) | 0, v = v + Math.imul(pe, bt) | 0, M = M + Math.imul(pe, $t) | 0, S = S + Math.imul(ee, rt) | 0, v = v + Math.imul(ee, Bt) | 0, v = v + Math.imul(T, rt) | 0, M = M + Math.imul(T, Bt) | 0, S = S + Math.imul(oe, z) | 0, v = v + Math.imul(oe, H) | 0, v = v + Math.imul(Z, z) | 0, M = M + Math.imul(Z, H) | 0, S = S + Math.imul(F, G) | 0, v = v + Math.imul(F, j) | 0, v = v + Math.imul(ce, G) | 0, M = M + Math.imul(ce, j) | 0; + var Tt = (E + S | 0) + ((v & 8191) << 13) | 0; + E = (M + (v >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, S = Math.imul(ke, Ye), v = Math.imul(ke, dt), v = v + Math.imul(Qe, Ye) | 0, M = Math.imul(Qe, dt), S = S + Math.imul(_e, ct) | 0, v = v + Math.imul(_e, qt) | 0, v = v + Math.imul(Ze, ct) | 0, M = M + Math.imul(Ze, qt) | 0, S = S + Math.imul(Le, Et) | 0, v = v + Math.imul(Le, er) | 0, v = v + Math.imul(qe, Et) | 0, M = M + Math.imul(qe, er) | 0, S = S + Math.imul(Me, Dt) | 0, v = v + Math.imul(Me, kt) | 0, v = v + Math.imul(Ne, Dt) | 0, M = M + Math.imul(Ne, kt) | 0, S = S + Math.imul(De, mt) | 0, v = v + Math.imul(De, Rt) | 0, v = v + Math.imul(Ce, mt) | 0, M = M + Math.imul(Ce, Rt) | 0, S = S + Math.imul(ue, bt) | 0, v = v + Math.imul(ue, $t) | 0, v = v + Math.imul(ve, bt) | 0, M = M + Math.imul(ve, $t) | 0, S = S + Math.imul(re, rt) | 0, v = v + Math.imul(re, Bt) | 0, v = v + Math.imul(pe, rt) | 0, M = M + Math.imul(pe, Bt) | 0, S = S + Math.imul(ee, z) | 0, v = v + Math.imul(ee, H) | 0, v = v + Math.imul(T, z) | 0, M = M + Math.imul(T, H) | 0, S = S + Math.imul(oe, G) | 0, v = v + Math.imul(oe, j) | 0, v = v + Math.imul(Z, G) | 0, M = M + Math.imul(Z, j) | 0, S = S + Math.imul(F, de) | 0, v = v + Math.imul(F, xe) | 0, v = v + Math.imul(ce, de) | 0, M = M + Math.imul(ce, xe) | 0; + var At = (E + S | 0) + ((v & 8191) << 13) | 0; + E = (M + (v >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, S = Math.imul(ke, ct), v = Math.imul(ke, qt), v = v + Math.imul(Qe, ct) | 0, M = Math.imul(Qe, qt), S = S + Math.imul(_e, Et) | 0, v = v + Math.imul(_e, er) | 0, v = v + Math.imul(Ze, Et) | 0, M = M + Math.imul(Ze, er) | 0, S = S + Math.imul(Le, Dt) | 0, v = v + Math.imul(Le, kt) | 0, v = v + Math.imul(qe, Dt) | 0, M = M + Math.imul(qe, kt) | 0, S = S + Math.imul(Me, mt) | 0, v = v + Math.imul(Me, Rt) | 0, v = v + Math.imul(Ne, mt) | 0, M = M + Math.imul(Ne, Rt) | 0, S = S + Math.imul(De, bt) | 0, v = v + Math.imul(De, $t) | 0, v = v + Math.imul(Ce, bt) | 0, M = M + Math.imul(Ce, $t) | 0, S = S + Math.imul(ue, rt) | 0, v = v + Math.imul(ue, Bt) | 0, v = v + Math.imul(ve, rt) | 0, M = M + Math.imul(ve, Bt) | 0, S = S + Math.imul(re, z) | 0, v = v + Math.imul(re, H) | 0, v = v + Math.imul(pe, z) | 0, M = M + Math.imul(pe, H) | 0, S = S + Math.imul(ee, G) | 0, v = v + Math.imul(ee, j) | 0, v = v + Math.imul(T, G) | 0, M = M + Math.imul(T, j) | 0, S = S + Math.imul(oe, de) | 0, v = v + Math.imul(oe, xe) | 0, v = v + Math.imul(Z, de) | 0, M = M + Math.imul(Z, xe) | 0; + var _t = (E + S | 0) + ((v & 8191) << 13) | 0; + E = (M + (v >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, S = Math.imul(ke, Et), v = Math.imul(ke, er), v = v + Math.imul(Qe, Et) | 0, M = Math.imul(Qe, er), S = S + Math.imul(_e, Dt) | 0, v = v + Math.imul(_e, kt) | 0, v = v + Math.imul(Ze, Dt) | 0, M = M + Math.imul(Ze, kt) | 0, S = S + Math.imul(Le, mt) | 0, v = v + Math.imul(Le, Rt) | 0, v = v + Math.imul(qe, mt) | 0, M = M + Math.imul(qe, Rt) | 0, S = S + Math.imul(Me, bt) | 0, v = v + Math.imul(Me, $t) | 0, v = v + Math.imul(Ne, bt) | 0, M = M + Math.imul(Ne, $t) | 0, S = S + Math.imul(De, rt) | 0, v = v + Math.imul(De, Bt) | 0, v = v + Math.imul(Ce, rt) | 0, M = M + Math.imul(Ce, Bt) | 0, S = S + Math.imul(ue, z) | 0, v = v + Math.imul(ue, H) | 0, v = v + Math.imul(ve, z) | 0, M = M + Math.imul(ve, H) | 0, S = S + Math.imul(re, G) | 0, v = v + Math.imul(re, j) | 0, v = v + Math.imul(pe, G) | 0, M = M + Math.imul(pe, j) | 0, S = S + Math.imul(ee, de) | 0, v = v + Math.imul(ee, xe) | 0, v = v + Math.imul(T, de) | 0, M = M + Math.imul(T, xe) | 0; + var ht = (E + S | 0) + ((v & 8191) << 13) | 0; + E = (M + (v >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, S = Math.imul(ke, Dt), v = Math.imul(ke, kt), v = v + Math.imul(Qe, Dt) | 0, M = Math.imul(Qe, kt), S = S + Math.imul(_e, mt) | 0, v = v + Math.imul(_e, Rt) | 0, v = v + Math.imul(Ze, mt) | 0, M = M + Math.imul(Ze, Rt) | 0, S = S + Math.imul(Le, bt) | 0, v = v + Math.imul(Le, $t) | 0, v = v + Math.imul(qe, bt) | 0, M = M + Math.imul(qe, $t) | 0, S = S + Math.imul(Me, rt) | 0, v = v + Math.imul(Me, Bt) | 0, v = v + Math.imul(Ne, rt) | 0, M = M + Math.imul(Ne, Bt) | 0, S = S + Math.imul(De, z) | 0, v = v + Math.imul(De, H) | 0, v = v + Math.imul(Ce, z) | 0, M = M + Math.imul(Ce, H) | 0, S = S + Math.imul(ue, G) | 0, v = v + Math.imul(ue, j) | 0, v = v + Math.imul(ve, G) | 0, M = M + Math.imul(ve, j) | 0, S = S + Math.imul(re, de) | 0, v = v + Math.imul(re, xe) | 0, v = v + Math.imul(pe, de) | 0, M = M + Math.imul(pe, xe) | 0; + var xt = (E + S | 0) + ((v & 8191) << 13) | 0; + E = (M + (v >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, S = Math.imul(ke, mt), v = Math.imul(ke, Rt), v = v + Math.imul(Qe, mt) | 0, M = Math.imul(Qe, Rt), S = S + Math.imul(_e, bt) | 0, v = v + Math.imul(_e, $t) | 0, v = v + Math.imul(Ze, bt) | 0, M = M + Math.imul(Ze, $t) | 0, S = S + Math.imul(Le, rt) | 0, v = v + Math.imul(Le, Bt) | 0, v = v + Math.imul(qe, rt) | 0, M = M + Math.imul(qe, Bt) | 0, S = S + Math.imul(Me, z) | 0, v = v + Math.imul(Me, H) | 0, v = v + Math.imul(Ne, z) | 0, M = M + Math.imul(Ne, H) | 0, S = S + Math.imul(De, G) | 0, v = v + Math.imul(De, j) | 0, v = v + Math.imul(Ce, G) | 0, M = M + Math.imul(Ce, j) | 0, S = S + Math.imul(ue, de) | 0, v = v + Math.imul(ue, xe) | 0, v = v + Math.imul(ve, de) | 0, M = M + Math.imul(ve, xe) | 0; + var st = (E + S | 0) + ((v & 8191) << 13) | 0; + E = (M + (v >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, S = Math.imul(ke, bt), v = Math.imul(ke, $t), v = v + Math.imul(Qe, bt) | 0, M = Math.imul(Qe, $t), S = S + Math.imul(_e, rt) | 0, v = v + Math.imul(_e, Bt) | 0, v = v + Math.imul(Ze, rt) | 0, M = M + Math.imul(Ze, Bt) | 0, S = S + Math.imul(Le, z) | 0, v = v + Math.imul(Le, H) | 0, v = v + Math.imul(qe, z) | 0, M = M + Math.imul(qe, H) | 0, S = S + Math.imul(Me, G) | 0, v = v + Math.imul(Me, j) | 0, v = v + Math.imul(Ne, G) | 0, M = M + Math.imul(Ne, j) | 0, S = S + Math.imul(De, de) | 0, v = v + Math.imul(De, xe) | 0, v = v + Math.imul(Ce, de) | 0, M = M + Math.imul(Ce, xe) | 0; + var yt = (E + S | 0) + ((v & 8191) << 13) | 0; + E = (M + (v >>> 13) | 0) + (yt >>> 26) | 0, yt &= 67108863, S = Math.imul(ke, rt), v = Math.imul(ke, Bt), v = v + Math.imul(Qe, rt) | 0, M = Math.imul(Qe, Bt), S = S + Math.imul(_e, z) | 0, v = v + Math.imul(_e, H) | 0, v = v + Math.imul(Ze, z) | 0, M = M + Math.imul(Ze, H) | 0, S = S + Math.imul(Le, G) | 0, v = v + Math.imul(Le, j) | 0, v = v + Math.imul(qe, G) | 0, M = M + Math.imul(qe, j) | 0, S = S + Math.imul(Me, de) | 0, v = v + Math.imul(Me, xe) | 0, v = v + Math.imul(Ne, de) | 0, M = M + Math.imul(Ne, xe) | 0; + var ut = (E + S | 0) + ((v & 8191) << 13) | 0; + E = (M + (v >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, S = Math.imul(ke, z), v = Math.imul(ke, H), v = v + Math.imul(Qe, z) | 0, M = Math.imul(Qe, H), S = S + Math.imul(_e, G) | 0, v = v + Math.imul(_e, j) | 0, v = v + Math.imul(Ze, G) | 0, M = M + Math.imul(Ze, j) | 0, S = S + Math.imul(Le, de) | 0, v = v + Math.imul(Le, xe) | 0, v = v + Math.imul(qe, de) | 0, M = M + Math.imul(qe, xe) | 0; + var ot = (E + S | 0) + ((v & 8191) << 13) | 0; + E = (M + (v >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, S = Math.imul(ke, G), v = Math.imul(ke, j), v = v + Math.imul(Qe, G) | 0, M = Math.imul(Qe, j), S = S + Math.imul(_e, de) | 0, v = v + Math.imul(_e, xe) | 0, v = v + Math.imul(Ze, de) | 0, M = M + Math.imul(Ze, xe) | 0; + var Se = (E + S | 0) + ((v & 8191) << 13) | 0; + E = (M + (v >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, S = Math.imul(ke, de), v = Math.imul(ke, xe), v = v + Math.imul(Qe, de) | 0, M = Math.imul(Qe, xe); + var Ae = (E + S | 0) + ((v & 8191) << 13) | 0; + return E = (M + (v >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, x[0] = Te, x[1] = Re, x[2] = nt, x[3] = je, x[4] = pt, x[5] = it, x[6] = et, x[7] = St, x[8] = Tt, x[9] = At, x[10] = _t, x[11] = ht, x[12] = xt, x[13] = st, x[14] = yt, x[15] = ut, x[16] = ot, x[17] = Se, x[18] = Ae, E !== 0 && (x[19] = E, f.length++), f; }; - Math.imul || (N = M); - function L(Y, S, m) { - m.negative = S.negative ^ Y.negative, m.length = Y.length + S.length; + Math.imul || (O = P); + function L(Y, A, m) { + m.negative = A.negative ^ Y.negative, m.length = Y.length + A.length; for (var f = 0, g = 0, b = 0; b < m.length - 1; b++) { var x = g; g = 0; - for (var _ = f & 67108863, E = Math.min(b, S.length - 1), v = Math.max(0, b - Y.length + 1); v <= E; v++) { - var P = b - v, I = Y.words[P] | 0, F = S.words[v] | 0, ce = I * F, D = ce & 67108863; - x = x + (ce / 67108864 | 0) | 0, D = D + _ | 0, _ = D & 67108863, x = x + (D >>> 26) | 0, g += x >>> 26, x &= 67108863; + for (var E = f & 67108863, S = Math.min(b, A.length - 1), v = Math.max(0, b - Y.length + 1); v <= S; v++) { + var M = b - v, I = Y.words[M] | 0, F = A.words[v] | 0, ce = I * F, D = ce & 67108863; + x = x + (ce / 67108864 | 0) | 0, D = D + E | 0, E = D & 67108863, x = x + (D >>> 26) | 0, g += x >>> 26, x &= 67108863; } - m.words[b] = _, f = x, x = g; + m.words[b] = E, f = x, x = g; } return f !== 0 ? m.words[b] = f : m.length--, m.strip(); } - function B(Y, S, m) { - var f = new $(); - return f.mulp(Y, S, m); + function B(Y, A, m) { + var f = new k(); + return f.mulp(Y, A, m); } - s.prototype.mulTo = function(S, m) { - var f, g = this.length + S.length; - return this.length === 10 && S.length === 10 ? f = N(this, S, m) : g < 63 ? f = M(this, S, m) : g < 1024 ? f = L(this, S, m) : f = B(this, S, m), f; + s.prototype.mulTo = function(A, m) { + var f, g = this.length + A.length; + return this.length === 10 && A.length === 10 ? f = O(this, A, m) : g < 63 ? f = P(this, A, m) : g < 1024 ? f = L(this, A, m) : f = B(this, A, m), f; }; - function $(Y, S) { - this.x = Y, this.y = S; + function k(Y, A) { + this.x = Y, this.y = A; } - $.prototype.makeRBT = function(S) { - for (var m = new Array(S), f = s.prototype._countBits(S) - 1, g = 0; g < S; g++) - m[g] = this.revBin(g, f, S); + k.prototype.makeRBT = function(A) { + for (var m = new Array(A), f = s.prototype._countBits(A) - 1, g = 0; g < A; g++) + m[g] = this.revBin(g, f, A); return m; - }, $.prototype.revBin = function(S, m, f) { - if (S === 0 || S === f - 1) return S; + }, k.prototype.revBin = function(A, m, f) { + if (A === 0 || A === f - 1) return A; for (var g = 0, b = 0; b < m; b++) - g |= (S & 1) << m - b - 1, S >>= 1; + g |= (A & 1) << m - b - 1, A >>= 1; return g; - }, $.prototype.permute = function(S, m, f, g, b, x) { - for (var _ = 0; _ < x; _++) - g[_] = m[S[_]], b[_] = f[S[_]]; - }, $.prototype.transform = function(S, m, f, g, b, x) { - this.permute(x, S, m, f, g, b); - for (var _ = 1; _ < b; _ <<= 1) - for (var E = _ << 1, v = Math.cos(2 * Math.PI / E), P = Math.sin(2 * Math.PI / E), I = 0; I < b; I += E) - for (var F = v, ce = P, D = 0; D < _; D++) { - var oe = f[I + D], Z = g[I + D], J = f[I + D + _], Q = g[I + D + _], T = F * J - ce * Q; - Q = F * Q + ce * J, J = T, f[I + D] = oe + J, g[I + D] = Z + Q, f[I + D + _] = oe - J, g[I + D + _] = Z - Q, D !== E && (T = v * F - P * ce, ce = v * ce + P * F, F = T); + }, k.prototype.permute = function(A, m, f, g, b, x) { + for (var E = 0; E < x; E++) + g[E] = m[A[E]], b[E] = f[A[E]]; + }, k.prototype.transform = function(A, m, f, g, b, x) { + this.permute(x, A, m, f, g, b); + for (var E = 1; E < b; E <<= 1) + for (var S = E << 1, v = Math.cos(2 * Math.PI / S), M = Math.sin(2 * Math.PI / S), I = 0; I < b; I += S) + for (var F = v, ce = M, D = 0; D < E; D++) { + var oe = f[I + D], Z = g[I + D], J = f[I + D + E], ee = g[I + D + E], T = F * J - ce * ee; + ee = F * ee + ce * J, J = T, f[I + D] = oe + J, g[I + D] = Z + ee, f[I + D + E] = oe - J, g[I + D + E] = Z - ee, D !== S && (T = v * F - M * ce, ce = v * ce + M * F, F = T); } - }, $.prototype.guessLen13b = function(S, m) { - var f = Math.max(m, S) | 1, g = f & 1, b = 0; + }, k.prototype.guessLen13b = function(A, m) { + var f = Math.max(m, A) | 1, g = f & 1, b = 0; for (f = f / 2 | 0; f; f = f >>> 1) b++; return 1 << b + 1 + g; - }, $.prototype.conjugate = function(S, m, f) { + }, k.prototype.conjugate = function(A, m, f) { if (!(f <= 1)) for (var g = 0; g < f / 2; g++) { - var b = S[g]; - S[g] = S[f - g - 1], S[f - g - 1] = b, b = m[g], m[g] = -m[f - g - 1], m[f - g - 1] = -b; + var b = A[g]; + A[g] = A[f - g - 1], A[f - g - 1] = b, b = m[g], m[g] = -m[f - g - 1], m[f - g - 1] = -b; } - }, $.prototype.normalize13b = function(S, m) { + }, k.prototype.normalize13b = function(A, m) { for (var f = 0, g = 0; g < m / 2; g++) { - var b = Math.round(S[2 * g + 1] / m) * 8192 + Math.round(S[2 * g] / m) + f; - S[g] = b & 67108863, b < 67108864 ? f = 0 : f = b / 67108864 | 0; + var b = Math.round(A[2 * g + 1] / m) * 8192 + Math.round(A[2 * g] / m) + f; + A[g] = b & 67108863, b < 67108864 ? f = 0 : f = b / 67108864 | 0; } - return S; - }, $.prototype.convert13b = function(S, m, f, g) { + return A; + }, k.prototype.convert13b = function(A, m, f, g) { for (var b = 0, x = 0; x < m; x++) - b = b + (S[x] | 0), f[2 * x] = b & 8191, b = b >>> 13, f[2 * x + 1] = b & 8191, b = b >>> 13; + b = b + (A[x] | 0), f[2 * x] = b & 8191, b = b >>> 13, f[2 * x + 1] = b & 8191, b = b >>> 13; for (x = 2 * m; x < g; ++x) f[x] = 0; n(b === 0), n((b & -8192) === 0); - }, $.prototype.stub = function(S) { - for (var m = new Array(S), f = 0; f < S; f++) + }, k.prototype.stub = function(A) { + for (var m = new Array(A), f = 0; f < A; f++) m[f] = 0; return m; - }, $.prototype.mulp = function(S, m, f) { - var g = 2 * this.guessLen13b(S.length, m.length), b = this.makeRBT(g), x = this.stub(g), _ = new Array(g), E = new Array(g), v = new Array(g), P = new Array(g), I = new Array(g), F = new Array(g), ce = f.words; - ce.length = g, this.convert13b(S.words, S.length, _, g), this.convert13b(m.words, m.length, P, g), this.transform(_, x, E, v, g, b), this.transform(P, x, I, F, g, b); + }, k.prototype.mulp = function(A, m, f) { + var g = 2 * this.guessLen13b(A.length, m.length), b = this.makeRBT(g), x = this.stub(g), E = new Array(g), S = new Array(g), v = new Array(g), M = new Array(g), I = new Array(g), F = new Array(g), ce = f.words; + ce.length = g, this.convert13b(A.words, A.length, E, g), this.convert13b(m.words, m.length, M, g), this.transform(E, x, S, v, g, b), this.transform(M, x, I, F, g, b); for (var D = 0; D < g; D++) { - var oe = E[D] * I[D] - v[D] * F[D]; - v[D] = E[D] * F[D] + v[D] * I[D], E[D] = oe; + var oe = S[D] * I[D] - v[D] * F[D]; + v[D] = S[D] * F[D] + v[D] * I[D], S[D] = oe; } - return this.conjugate(E, v, g), this.transform(E, v, ce, x, g, b), this.conjugate(ce, x, g), this.normalize13b(ce, g), f.negative = S.negative ^ m.negative, f.length = S.length + m.length, f.strip(); - }, s.prototype.mul = function(S) { + return this.conjugate(S, v, g), this.transform(S, v, ce, x, g, b), this.conjugate(ce, x, g), this.normalize13b(ce, g), f.negative = A.negative ^ m.negative, f.length = A.length + m.length, f.strip(); + }, s.prototype.mul = function(A) { var m = new s(null); - return m.words = new Array(this.length + S.length), this.mulTo(S, m); - }, s.prototype.mulf = function(S) { + return m.words = new Array(this.length + A.length), this.mulTo(A, m); + }, s.prototype.mulf = function(A) { var m = new s(null); - return m.words = new Array(this.length + S.length), B(this, S, m); - }, s.prototype.imul = function(S) { - return this.clone().mulTo(S, this); - }, s.prototype.imuln = function(S) { - n(typeof S == "number"), n(S < 67108864); + return m.words = new Array(this.length + A.length), B(this, A, m); + }, s.prototype.imul = function(A) { + return this.clone().mulTo(A, this); + }, s.prototype.imuln = function(A) { + n(typeof A == "number"), n(A < 67108864); for (var m = 0, f = 0; f < this.length; f++) { - var g = (this.words[f] | 0) * S, b = (g & 67108863) + (m & 67108863); + var g = (this.words[f] | 0) * A, b = (g & 67108863) + (m & 67108863); m >>= 26, m += g / 67108864 | 0, m += b >>> 26, this.words[f] = b & 67108863; } return m !== 0 && (this.words[f] = m, this.length++), this; - }, s.prototype.muln = function(S) { - return this.clone().imuln(S); + }, s.prototype.muln = function(A) { + return this.clone().imuln(A); }, s.prototype.sqr = function() { return this.mul(this); }, s.prototype.isqr = function() { return this.imul(this.clone()); - }, s.prototype.pow = function(S) { - var m = A(S); + }, s.prototype.pow = function(A) { + var m = _(A); if (m.length === 0) return new s(1); for (var f = this, g = 0; g < m.length && m[g] === 0; g++, f = f.sqr()) ; @@ -13743,14 +14255,14 @@ Zv.exports; for (var b = f.sqr(); g < m.length; g++, b = b.sqr()) m[g] !== 0 && (f = f.mul(b)); return f; - }, s.prototype.iushln = function(S) { - n(typeof S == "number" && S >= 0); - var m = S % 26, f = (S - m) / 26, g = 67108863 >>> 26 - m << 26 - m, b; + }, s.prototype.iushln = function(A) { + n(typeof A == "number" && A >= 0); + var m = A % 26, f = (A - m) / 26, g = 67108863 >>> 26 - m << 26 - m, b; if (m !== 0) { var x = 0; for (b = 0; b < this.length; b++) { - var _ = this.words[b] & g, E = (this.words[b] | 0) - _ << m; - this.words[b] = E | x, x = _ >>> 26 - m; + var E = this.words[b] & g, S = (this.words[b] | 0) - E << m; + this.words[b] = S | x, x = E >>> 26 - m; } x && (this.words[b] = x, this.length++); } @@ -13762,48 +14274,48 @@ Zv.exports; this.length += f; } return this.strip(); - }, s.prototype.ishln = function(S) { - return n(this.negative === 0), this.iushln(S); - }, s.prototype.iushrn = function(S, m, f) { - n(typeof S == "number" && S >= 0); + }, s.prototype.ishln = function(A) { + return n(this.negative === 0), this.iushln(A); + }, s.prototype.iushrn = function(A, m, f) { + n(typeof A == "number" && A >= 0); var g; m ? g = (m - m % 26) / 26 : g = 0; - var b = S % 26, x = Math.min((S - b) / 26, this.length), _ = 67108863 ^ 67108863 >>> b << b, E = f; - if (g -= x, g = Math.max(0, g), E) { + var b = A % 26, x = Math.min((A - b) / 26, this.length), E = 67108863 ^ 67108863 >>> b << b, S = f; + if (g -= x, g = Math.max(0, g), S) { for (var v = 0; v < x; v++) - E.words[v] = this.words[v]; - E.length = x; + S.words[v] = this.words[v]; + S.length = x; } if (x !== 0) if (this.length > x) for (this.length -= x, v = 0; v < this.length; v++) this.words[v] = this.words[v + x]; else this.words[0] = 0, this.length = 1; - var P = 0; - for (v = this.length - 1; v >= 0 && (P !== 0 || v >= g); v--) { + var M = 0; + for (v = this.length - 1; v >= 0 && (M !== 0 || v >= g); v--) { var I = this.words[v] | 0; - this.words[v] = P << 26 - b | I >>> b, P = I & _; - } - return E && P !== 0 && (E.words[E.length++] = P), this.length === 0 && (this.words[0] = 0, this.length = 1), this.strip(); - }, s.prototype.ishrn = function(S, m, f) { - return n(this.negative === 0), this.iushrn(S, m, f); - }, s.prototype.shln = function(S) { - return this.clone().ishln(S); - }, s.prototype.ushln = function(S) { - return this.clone().iushln(S); - }, s.prototype.shrn = function(S) { - return this.clone().ishrn(S); - }, s.prototype.ushrn = function(S) { - return this.clone().iushrn(S); - }, s.prototype.testn = function(S) { - n(typeof S == "number" && S >= 0); - var m = S % 26, f = (S - m) / 26, g = 1 << m; + this.words[v] = M << 26 - b | I >>> b, M = I & E; + } + return S && M !== 0 && (S.words[S.length++] = M), this.length === 0 && (this.words[0] = 0, this.length = 1), this.strip(); + }, s.prototype.ishrn = function(A, m, f) { + return n(this.negative === 0), this.iushrn(A, m, f); + }, s.prototype.shln = function(A) { + return this.clone().ishln(A); + }, s.prototype.ushln = function(A) { + return this.clone().iushln(A); + }, s.prototype.shrn = function(A) { + return this.clone().ishrn(A); + }, s.prototype.ushrn = function(A) { + return this.clone().iushrn(A); + }, s.prototype.testn = function(A) { + n(typeof A == "number" && A >= 0); + var m = A % 26, f = (A - m) / 26, g = 1 << m; if (this.length <= f) return !1; var b = this.words[f]; return !!(b & g); - }, s.prototype.imaskn = function(S) { - n(typeof S == "number" && S >= 0); - var m = S % 26, f = (S - m) / 26; + }, s.prototype.imaskn = function(A) { + n(typeof A == "number" && A >= 0); + var m = A % 26, f = (A - m) / 26; if (n(this.negative === 0, "imaskn works only with positive numbers"), this.length <= f) return this; if (m !== 0 && f++, this.length = Math.min(f, this.length), m !== 0) { @@ -13811,60 +14323,60 @@ Zv.exports; this.words[this.length - 1] &= g; } return this.strip(); - }, s.prototype.maskn = function(S) { - return this.clone().imaskn(S); - }, s.prototype.iaddn = function(S) { - return n(typeof S == "number"), n(S < 67108864), S < 0 ? this.isubn(-S) : this.negative !== 0 ? this.length === 1 && (this.words[0] | 0) < S ? (this.words[0] = S - (this.words[0] | 0), this.negative = 0, this) : (this.negative = 0, this.isubn(S), this.negative = 1, this) : this._iaddn(S); - }, s.prototype._iaddn = function(S) { - this.words[0] += S; + }, s.prototype.maskn = function(A) { + return this.clone().imaskn(A); + }, s.prototype.iaddn = function(A) { + return n(typeof A == "number"), n(A < 67108864), A < 0 ? this.isubn(-A) : this.negative !== 0 ? this.length === 1 && (this.words[0] | 0) < A ? (this.words[0] = A - (this.words[0] | 0), this.negative = 0, this) : (this.negative = 0, this.isubn(A), this.negative = 1, this) : this._iaddn(A); + }, s.prototype._iaddn = function(A) { + this.words[0] += A; for (var m = 0; m < this.length && this.words[m] >= 67108864; m++) this.words[m] -= 67108864, m === this.length - 1 ? this.words[m + 1] = 1 : this.words[m + 1]++; return this.length = Math.max(this.length, m + 1), this; - }, s.prototype.isubn = function(S) { - if (n(typeof S == "number"), n(S < 67108864), S < 0) return this.iaddn(-S); + }, s.prototype.isubn = function(A) { + if (n(typeof A == "number"), n(A < 67108864), A < 0) return this.iaddn(-A); if (this.negative !== 0) - return this.negative = 0, this.iaddn(S), this.negative = 1, this; - if (this.words[0] -= S, this.length === 1 && this.words[0] < 0) + return this.negative = 0, this.iaddn(A), this.negative = 1, this; + if (this.words[0] -= A, this.length === 1 && this.words[0] < 0) this.words[0] = -this.words[0], this.negative = 1; else for (var m = 0; m < this.length && this.words[m] < 0; m++) this.words[m] += 67108864, this.words[m + 1] -= 1; return this.strip(); - }, s.prototype.addn = function(S) { - return this.clone().iaddn(S); - }, s.prototype.subn = function(S) { - return this.clone().isubn(S); + }, s.prototype.addn = function(A) { + return this.clone().iaddn(A); + }, s.prototype.subn = function(A) { + return this.clone().isubn(A); }, s.prototype.iabs = function() { return this.negative = 0, this; }, s.prototype.abs = function() { return this.clone().iabs(); - }, s.prototype._ishlnsubmul = function(S, m, f) { - var g = S.length + f, b; + }, s.prototype._ishlnsubmul = function(A, m, f) { + var g = A.length + f, b; this._expand(g); - var x, _ = 0; - for (b = 0; b < S.length; b++) { - x = (this.words[b + f] | 0) + _; - var E = (S.words[b] | 0) * m; - x -= E & 67108863, _ = (x >> 26) - (E / 67108864 | 0), this.words[b + f] = x & 67108863; + var x, E = 0; + for (b = 0; b < A.length; b++) { + x = (this.words[b + f] | 0) + E; + var S = (A.words[b] | 0) * m; + x -= S & 67108863, E = (x >> 26) - (S / 67108864 | 0), this.words[b + f] = x & 67108863; } for (; b < this.length - f; b++) - x = (this.words[b + f] | 0) + _, _ = x >> 26, this.words[b + f] = x & 67108863; - if (_ === 0) return this.strip(); - for (n(_ === -1), _ = 0, b = 0; b < this.length; b++) - x = -(this.words[b] | 0) + _, _ = x >> 26, this.words[b] = x & 67108863; + x = (this.words[b + f] | 0) + E, E = x >> 26, this.words[b + f] = x & 67108863; + if (E === 0) return this.strip(); + for (n(E === -1), E = 0, b = 0; b < this.length; b++) + x = -(this.words[b] | 0) + E, E = x >> 26, this.words[b] = x & 67108863; return this.negative = 1, this.strip(); - }, s.prototype._wordDiv = function(S, m) { - var f = this.length - S.length, g = this.clone(), b = S, x = b.words[b.length - 1] | 0, _ = this._countBits(x); - f = 26 - _, f !== 0 && (b = b.ushln(f), g.iushln(f), x = b.words[b.length - 1] | 0); - var E = g.length - b.length, v; + }, s.prototype._wordDiv = function(A, m) { + var f = this.length - A.length, g = this.clone(), b = A, x = b.words[b.length - 1] | 0, E = this._countBits(x); + f = 26 - E, f !== 0 && (b = b.ushln(f), g.iushln(f), x = b.words[b.length - 1] | 0); + var S = g.length - b.length, v; if (m !== "mod") { - v = new s(null), v.length = E + 1, v.words = new Array(v.length); - for (var P = 0; P < v.length; P++) - v.words[P] = 0; + v = new s(null), v.length = S + 1, v.words = new Array(v.length); + for (var M = 0; M < v.length; M++) + v.words[M] = 0; } - var I = g.clone()._ishlnsubmul(b, 1, E); - I.negative === 0 && (g = I, v && (v.words[E] = 1)); - for (var F = E - 1; F >= 0; F--) { + var I = g.clone()._ishlnsubmul(b, 1, S); + I.negative === 0 && (g = I, v && (v.words[S] = 1)); + for (var F = S - 1; F >= 0; F--) { var ce = (g.words[b.length + F] | 0) * 67108864 + (g.words[b.length + F - 1] | 0); for (ce = Math.min(ce / x | 0, 67108863), g._ishlnsubmul(b, ce, F); g.negative !== 0; ) ce--, g.negative = 0, g._ishlnsubmul(b, 1, F), g.isZero() || (g.negative ^= 1); @@ -13874,103 +14386,103 @@ Zv.exports; div: v || null, mod: g }; - }, s.prototype.divmod = function(S, m, f) { - if (n(!S.isZero()), this.isZero()) + }, s.prototype.divmod = function(A, m, f) { + if (n(!A.isZero()), this.isZero()) return { div: new s(0), mod: new s(0) }; var g, b, x; - return this.negative !== 0 && S.negative === 0 ? (x = this.neg().divmod(S, m), m !== "mod" && (g = x.div.neg()), m !== "div" && (b = x.mod.neg(), f && b.negative !== 0 && b.iadd(S)), { + return this.negative !== 0 && A.negative === 0 ? (x = this.neg().divmod(A, m), m !== "mod" && (g = x.div.neg()), m !== "div" && (b = x.mod.neg(), f && b.negative !== 0 && b.iadd(A)), { div: g, mod: b - }) : this.negative === 0 && S.negative !== 0 ? (x = this.divmod(S.neg(), m), m !== "mod" && (g = x.div.neg()), { + }) : this.negative === 0 && A.negative !== 0 ? (x = this.divmod(A.neg(), m), m !== "mod" && (g = x.div.neg()), { div: g, mod: x.mod - }) : this.negative & S.negative ? (x = this.neg().divmod(S.neg(), m), m !== "div" && (b = x.mod.neg(), f && b.negative !== 0 && b.isub(S)), { + }) : this.negative & A.negative ? (x = this.neg().divmod(A.neg(), m), m !== "div" && (b = x.mod.neg(), f && b.negative !== 0 && b.isub(A)), { div: x.div, mod: b - }) : S.length > this.length || this.cmp(S) < 0 ? { + }) : A.length > this.length || this.cmp(A) < 0 ? { div: new s(0), mod: this - } : S.length === 1 ? m === "div" ? { - div: this.divn(S.words[0]), + } : A.length === 1 ? m === "div" ? { + div: this.divn(A.words[0]), mod: null } : m === "mod" ? { div: null, - mod: new s(this.modn(S.words[0])) + mod: new s(this.modn(A.words[0])) } : { - div: this.divn(S.words[0]), - mod: new s(this.modn(S.words[0])) - } : this._wordDiv(S, m); - }, s.prototype.div = function(S) { - return this.divmod(S, "div", !1).div; - }, s.prototype.mod = function(S) { - return this.divmod(S, "mod", !1).mod; - }, s.prototype.umod = function(S) { - return this.divmod(S, "mod", !0).mod; - }, s.prototype.divRound = function(S) { - var m = this.divmod(S); + div: this.divn(A.words[0]), + mod: new s(this.modn(A.words[0])) + } : this._wordDiv(A, m); + }, s.prototype.div = function(A) { + return this.divmod(A, "div", !1).div; + }, s.prototype.mod = function(A) { + return this.divmod(A, "mod", !1).mod; + }, s.prototype.umod = function(A) { + return this.divmod(A, "mod", !0).mod; + }, s.prototype.divRound = function(A) { + var m = this.divmod(A); if (m.mod.isZero()) return m.div; - var f = m.div.negative !== 0 ? m.mod.isub(S) : m.mod, g = S.ushrn(1), b = S.andln(1), x = f.cmp(g); + var f = m.div.negative !== 0 ? m.mod.isub(A) : m.mod, g = A.ushrn(1), b = A.andln(1), x = f.cmp(g); return x < 0 || b === 1 && x === 0 ? m.div : m.div.negative !== 0 ? m.div.isubn(1) : m.div.iaddn(1); - }, s.prototype.modn = function(S) { - n(S <= 67108863); - for (var m = (1 << 26) % S, f = 0, g = this.length - 1; g >= 0; g--) - f = (m * f + (this.words[g] | 0)) % S; + }, s.prototype.modn = function(A) { + n(A <= 67108863); + for (var m = (1 << 26) % A, f = 0, g = this.length - 1; g >= 0; g--) + f = (m * f + (this.words[g] | 0)) % A; return f; - }, s.prototype.idivn = function(S) { - n(S <= 67108863); + }, s.prototype.idivn = function(A) { + n(A <= 67108863); for (var m = 0, f = this.length - 1; f >= 0; f--) { var g = (this.words[f] | 0) + m * 67108864; - this.words[f] = g / S | 0, m = g % S; + this.words[f] = g / A | 0, m = g % A; } return this.strip(); - }, s.prototype.divn = function(S) { - return this.clone().idivn(S); - }, s.prototype.egcd = function(S) { - n(S.negative === 0), n(!S.isZero()); - var m = this, f = S.clone(); - m.negative !== 0 ? m = m.umod(S) : m = m.clone(); - for (var g = new s(1), b = new s(0), x = new s(0), _ = new s(1), E = 0; m.isEven() && f.isEven(); ) - m.iushrn(1), f.iushrn(1), ++E; - for (var v = f.clone(), P = m.clone(); !m.isZero(); ) { + }, s.prototype.divn = function(A) { + return this.clone().idivn(A); + }, s.prototype.egcd = function(A) { + n(A.negative === 0), n(!A.isZero()); + var m = this, f = A.clone(); + m.negative !== 0 ? m = m.umod(A) : m = m.clone(); + for (var g = new s(1), b = new s(0), x = new s(0), E = new s(1), S = 0; m.isEven() && f.isEven(); ) + m.iushrn(1), f.iushrn(1), ++S; + for (var v = f.clone(), M = m.clone(); !m.isZero(); ) { for (var I = 0, F = 1; !(m.words[0] & F) && I < 26; ++I, F <<= 1) ; if (I > 0) for (m.iushrn(I); I-- > 0; ) - (g.isOdd() || b.isOdd()) && (g.iadd(v), b.isub(P)), g.iushrn(1), b.iushrn(1); + (g.isOdd() || b.isOdd()) && (g.iadd(v), b.isub(M)), g.iushrn(1), b.iushrn(1); for (var ce = 0, D = 1; !(f.words[0] & D) && ce < 26; ++ce, D <<= 1) ; if (ce > 0) for (f.iushrn(ce); ce-- > 0; ) - (x.isOdd() || _.isOdd()) && (x.iadd(v), _.isub(P)), x.iushrn(1), _.iushrn(1); - m.cmp(f) >= 0 ? (m.isub(f), g.isub(x), b.isub(_)) : (f.isub(m), x.isub(g), _.isub(b)); + (x.isOdd() || E.isOdd()) && (x.iadd(v), E.isub(M)), x.iushrn(1), E.iushrn(1); + m.cmp(f) >= 0 ? (m.isub(f), g.isub(x), b.isub(E)) : (f.isub(m), x.isub(g), E.isub(b)); } return { a: x, - b: _, - gcd: f.iushln(E) + b: E, + gcd: f.iushln(S) }; - }, s.prototype._invmp = function(S) { - n(S.negative === 0), n(!S.isZero()); - var m = this, f = S.clone(); - m.negative !== 0 ? m = m.umod(S) : m = m.clone(); + }, s.prototype._invmp = function(A) { + n(A.negative === 0), n(!A.isZero()); + var m = this, f = A.clone(); + m.negative !== 0 ? m = m.umod(A) : m = m.clone(); for (var g = new s(1), b = new s(0), x = f.clone(); m.cmpn(1) > 0 && f.cmpn(1) > 0; ) { - for (var _ = 0, E = 1; !(m.words[0] & E) && _ < 26; ++_, E <<= 1) ; - if (_ > 0) - for (m.iushrn(_); _-- > 0; ) + for (var E = 0, S = 1; !(m.words[0] & S) && E < 26; ++E, S <<= 1) ; + if (E > 0) + for (m.iushrn(E); E-- > 0; ) g.isOdd() && g.iadd(x), g.iushrn(1); - for (var v = 0, P = 1; !(f.words[0] & P) && v < 26; ++v, P <<= 1) ; + for (var v = 0, M = 1; !(f.words[0] & M) && v < 26; ++v, M <<= 1) ; if (v > 0) for (f.iushrn(v); v-- > 0; ) b.isOdd() && b.iadd(x), b.iushrn(1); m.cmp(f) >= 0 ? (m.isub(f), g.isub(b)) : (f.isub(m), b.isub(g)); } var I; - return m.cmpn(1) === 0 ? I = g : I = b, I.cmpn(0) < 0 && I.iadd(S), I; - }, s.prototype.gcd = function(S) { - if (this.isZero()) return S.abs(); - if (S.isZero()) return this.abs(); - var m = this.clone(), f = S.clone(); + return m.cmpn(1) === 0 ? I = g : I = b, I.cmpn(0) < 0 && I.iadd(A), I; + }, s.prototype.gcd = function(A) { + if (this.isZero()) return A.abs(); + if (A.isZero()) return this.abs(); + var m = this.clone(), f = A.clone(); m.negative = 0, f.negative = 0; for (var g = 0; m.isEven() && f.isEven(); g++) m.iushrn(1), f.iushrn(1); @@ -13988,28 +14500,28 @@ Zv.exports; m.isub(f); } while (!0); return f.iushln(g); - }, s.prototype.invm = function(S) { - return this.egcd(S).a.umod(S); + }, s.prototype.invm = function(A) { + return this.egcd(A).a.umod(A); }, s.prototype.isEven = function() { return (this.words[0] & 1) === 0; }, s.prototype.isOdd = function() { return (this.words[0] & 1) === 1; - }, s.prototype.andln = function(S) { - return this.words[0] & S; - }, s.prototype.bincn = function(S) { - n(typeof S == "number"); - var m = S % 26, f = (S - m) / 26, g = 1 << m; + }, s.prototype.andln = function(A) { + return this.words[0] & A; + }, s.prototype.bincn = function(A) { + n(typeof A == "number"); + var m = A % 26, f = (A - m) / 26, g = 1 << m; if (this.length <= f) return this._expand(f + 1), this.words[f] |= g, this; for (var b = g, x = f; b !== 0 && x < this.length; x++) { - var _ = this.words[x] | 0; - _ += b, b = _ >>> 26, _ &= 67108863, this.words[x] = _; + var E = this.words[x] | 0; + E += b, b = E >>> 26, E &= 67108863, this.words[x] = E; } return b !== 0 && (this.words[x] = b, this.length++), this; }, s.prototype.isZero = function() { return this.length === 1 && this.words[0] === 0; - }, s.prototype.cmpn = function(S) { - var m = S < 0; + }, s.prototype.cmpn = function(A) { + var m = A < 0; if (this.negative !== 0 && !m) return -1; if (this.negative === 0 && m) return 1; this.strip(); @@ -14017,71 +14529,71 @@ Zv.exports; if (this.length > 1) f = 1; else { - m && (S = -S), n(S <= 67108863, "Number is too big"); + m && (A = -A), n(A <= 67108863, "Number is too big"); var g = this.words[0] | 0; - f = g === S ? 0 : g < S ? -1 : 1; + f = g === A ? 0 : g < A ? -1 : 1; } return this.negative !== 0 ? -f | 0 : f; - }, s.prototype.cmp = function(S) { - if (this.negative !== 0 && S.negative === 0) return -1; - if (this.negative === 0 && S.negative !== 0) return 1; - var m = this.ucmp(S); + }, s.prototype.cmp = function(A) { + if (this.negative !== 0 && A.negative === 0) return -1; + if (this.negative === 0 && A.negative !== 0) return 1; + var m = this.ucmp(A); return this.negative !== 0 ? -m | 0 : m; - }, s.prototype.ucmp = function(S) { - if (this.length > S.length) return 1; - if (this.length < S.length) return -1; + }, s.prototype.ucmp = function(A) { + if (this.length > A.length) return 1; + if (this.length < A.length) return -1; for (var m = 0, f = this.length - 1; f >= 0; f--) { - var g = this.words[f] | 0, b = S.words[f] | 0; + var g = this.words[f] | 0, b = A.words[f] | 0; if (g !== b) { g < b ? m = -1 : g > b && (m = 1); break; } } return m; - }, s.prototype.gtn = function(S) { - return this.cmpn(S) === 1; - }, s.prototype.gt = function(S) { - return this.cmp(S) === 1; - }, s.prototype.gten = function(S) { - return this.cmpn(S) >= 0; - }, s.prototype.gte = function(S) { - return this.cmp(S) >= 0; - }, s.prototype.ltn = function(S) { - return this.cmpn(S) === -1; - }, s.prototype.lt = function(S) { - return this.cmp(S) === -1; - }, s.prototype.lten = function(S) { - return this.cmpn(S) <= 0; - }, s.prototype.lte = function(S) { - return this.cmp(S) <= 0; - }, s.prototype.eqn = function(S) { - return this.cmpn(S) === 0; - }, s.prototype.eq = function(S) { - return this.cmp(S) === 0; - }, s.red = function(S) { - return new ge(S); - }, s.prototype.toRed = function(S) { - return n(!this.red, "Already a number in reduction context"), n(this.negative === 0, "red works only with positives"), S.convertTo(this)._forceRed(S); + }, s.prototype.gtn = function(A) { + return this.cmpn(A) === 1; + }, s.prototype.gt = function(A) { + return this.cmp(A) === 1; + }, s.prototype.gten = function(A) { + return this.cmpn(A) >= 0; + }, s.prototype.gte = function(A) { + return this.cmp(A) >= 0; + }, s.prototype.ltn = function(A) { + return this.cmpn(A) === -1; + }, s.prototype.lt = function(A) { + return this.cmp(A) === -1; + }, s.prototype.lten = function(A) { + return this.cmpn(A) <= 0; + }, s.prototype.lte = function(A) { + return this.cmp(A) <= 0; + }, s.prototype.eqn = function(A) { + return this.cmpn(A) === 0; + }, s.prototype.eq = function(A) { + return this.cmp(A) === 0; + }, s.red = function(A) { + return new ge(A); + }, s.prototype.toRed = function(A) { + return n(!this.red, "Already a number in reduction context"), n(this.negative === 0, "red works only with positives"), A.convertTo(this)._forceRed(A); }, s.prototype.fromRed = function() { return n(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom(this); - }, s.prototype._forceRed = function(S) { - return this.red = S, this; - }, s.prototype.forceRed = function(S) { - return n(!this.red, "Already a number in reduction context"), this._forceRed(S); - }, s.prototype.redAdd = function(S) { - return n(this.red, "redAdd works only with red numbers"), this.red.add(this, S); - }, s.prototype.redIAdd = function(S) { - return n(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, S); - }, s.prototype.redSub = function(S) { - return n(this.red, "redSub works only with red numbers"), this.red.sub(this, S); - }, s.prototype.redISub = function(S) { - return n(this.red, "redISub works only with red numbers"), this.red.isub(this, S); - }, s.prototype.redShl = function(S) { - return n(this.red, "redShl works only with red numbers"), this.red.shl(this, S); - }, s.prototype.redMul = function(S) { - return n(this.red, "redMul works only with red numbers"), this.red._verify2(this, S), this.red.mul(this, S); - }, s.prototype.redIMul = function(S) { - return n(this.red, "redMul works only with red numbers"), this.red._verify2(this, S), this.red.imul(this, S); + }, s.prototype._forceRed = function(A) { + return this.red = A, this; + }, s.prototype.forceRed = function(A) { + return n(!this.red, "Already a number in reduction context"), this._forceRed(A); + }, s.prototype.redAdd = function(A) { + return n(this.red, "redAdd works only with red numbers"), this.red.add(this, A); + }, s.prototype.redIAdd = function(A) { + return n(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, A); + }, s.prototype.redSub = function(A) { + return n(this.red, "redSub works only with red numbers"), this.red.sub(this, A); + }, s.prototype.redISub = function(A) { + return n(this.red, "redISub works only with red numbers"), this.red.isub(this, A); + }, s.prototype.redShl = function(A) { + return n(this.red, "redShl works only with red numbers"), this.red.shl(this, A); + }, s.prototype.redMul = function(A) { + return n(this.red, "redMul works only with red numbers"), this.red._verify2(this, A), this.red.mul(this, A); + }, s.prototype.redIMul = function(A) { + return n(this.red, "redMul works only with red numbers"), this.red._verify2(this, A), this.red.imul(this, A); }, s.prototype.redSqr = function() { return n(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr(this); }, s.prototype.redISqr = function() { @@ -14092,32 +14604,32 @@ Zv.exports; return n(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm(this); }, s.prototype.redNeg = function() { return n(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg(this); - }, s.prototype.redPow = function(S) { - return n(this.red && !S.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, S); + }, s.prototype.redPow = function(A) { + return n(this.red && !A.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, A); }; - var H = { + var q = { k256: null, p224: null, p192: null, p25519: null }; - function U(Y, S) { - this.name = Y, this.p = new s(S, 16), this.n = this.p.bitLength(), this.k = new s(1).iushln(this.n).isub(this.p), this.tmp = this._tmp(); + function U(Y, A) { + this.name = Y, this.p = new s(A, 16), this.n = this.p.bitLength(), this.k = new s(1).iushln(this.n).isub(this.p), this.tmp = this._tmp(); } U.prototype._tmp = function() { - var S = new s(null); - return S.words = new Array(Math.ceil(this.n / 13)), S; - }, U.prototype.ireduce = function(S) { - var m = S, f; + var A = new s(null); + return A.words = new Array(Math.ceil(this.n / 13)), A; + }, U.prototype.ireduce = function(A) { + var m = A, f; do this.split(m, this.tmp), m = this.imulK(m), m = m.iadd(this.tmp), f = m.bitLength(); while (f > this.n); var g = f < this.n ? -1 : m.ucmp(this.p); return g === 0 ? (m.words[0] = 0, m.length = 1) : g > 0 ? m.isub(this.p) : m.strip !== void 0 ? m.strip() : m._strip(), m; - }, U.prototype.split = function(S, m) { - S.iushrn(this.n, 0, m); - }, U.prototype.imulK = function(S) { - return S.imul(this.k); + }, U.prototype.split = function(A, m) { + A.iushrn(this.n, 0, m); + }, U.prototype.imulK = function(A) { + return A.imul(this.k); }; function V() { U.call( @@ -14126,35 +14638,35 @@ Zv.exports; "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f" ); } - i(V, U), V.prototype.split = function(S, m) { - for (var f = 4194303, g = Math.min(S.length, 9), b = 0; b < g; b++) - m.words[b] = S.words[b]; - if (m.length = g, S.length <= 9) { - S.words[0] = 0, S.length = 1; + i(V, U), V.prototype.split = function(A, m) { + for (var f = 4194303, g = Math.min(A.length, 9), b = 0; b < g; b++) + m.words[b] = A.words[b]; + if (m.length = g, A.length <= 9) { + A.words[0] = 0, A.length = 1; return; } - var x = S.words[9]; - for (m.words[m.length++] = x & f, b = 10; b < S.length; b++) { - var _ = S.words[b] | 0; - S.words[b - 10] = (_ & f) << 4 | x >>> 22, x = _; + var x = A.words[9]; + for (m.words[m.length++] = x & f, b = 10; b < A.length; b++) { + var E = A.words[b] | 0; + A.words[b - 10] = (E & f) << 4 | x >>> 22, x = E; } - x >>>= 22, S.words[b - 10] = x, x === 0 && S.length > 10 ? S.length -= 10 : S.length -= 9; - }, V.prototype.imulK = function(S) { - S.words[S.length] = 0, S.words[S.length + 1] = 0, S.length += 2; - for (var m = 0, f = 0; f < S.length; f++) { - var g = S.words[f] | 0; - m += g * 977, S.words[f] = m & 67108863, m = g * 64 + (m / 67108864 | 0); + x >>>= 22, A.words[b - 10] = x, x === 0 && A.length > 10 ? A.length -= 10 : A.length -= 9; + }, V.prototype.imulK = function(A) { + A.words[A.length] = 0, A.words[A.length + 1] = 0, A.length += 2; + for (var m = 0, f = 0; f < A.length; f++) { + var g = A.words[f] | 0; + m += g * 977, A.words[f] = m & 67108863, m = g * 64 + (m / 67108864 | 0); } - return S.words[S.length - 1] === 0 && (S.length--, S.words[S.length - 1] === 0 && S.length--), S; + return A.words[A.length - 1] === 0 && (A.length--, A.words[A.length - 1] === 0 && A.length--), A; }; - function te() { + function Q() { U.call( this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001" ); } - i(te, U); + i(Q, U); function R() { U.call( this, @@ -14170,148 +14682,148 @@ Zv.exports; "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed" ); } - i(K, U), K.prototype.imulK = function(S) { - for (var m = 0, f = 0; f < S.length; f++) { - var g = (S.words[f] | 0) * 19 + m, b = g & 67108863; - g >>>= 26, S.words[f] = b, m = g; + i(K, U), K.prototype.imulK = function(A) { + for (var m = 0, f = 0; f < A.length; f++) { + var g = (A.words[f] | 0) * 19 + m, b = g & 67108863; + g >>>= 26, A.words[f] = b, m = g; } - return m !== 0 && (S.words[S.length++] = m), S; - }, s._prime = function(S) { - if (H[S]) return H[S]; + return m !== 0 && (A.words[A.length++] = m), A; + }, s._prime = function(A) { + if (q[A]) return q[A]; var m; - if (S === "k256") + if (A === "k256") m = new V(); - else if (S === "p224") - m = new te(); - else if (S === "p192") + else if (A === "p224") + m = new Q(); + else if (A === "p192") m = new R(); - else if (S === "p25519") + else if (A === "p25519") m = new K(); else - throw new Error("Unknown prime " + S); - return H[S] = m, m; + throw new Error("Unknown prime " + A); + return q[A] = m, m; }; function ge(Y) { if (typeof Y == "string") { - var S = s._prime(Y); - this.m = S.p, this.prime = S; + var A = s._prime(Y); + this.m = A.p, this.prime = A; } else n(Y.gtn(1), "modulus must be greater than 1"), this.m = Y, this.prime = null; } - ge.prototype._verify1 = function(S) { - n(S.negative === 0, "red works only with positives"), n(S.red, "red works only with red numbers"); - }, ge.prototype._verify2 = function(S, m) { - n((S.negative | m.negative) === 0, "red works only with positives"), n( - S.red && S.red === m.red, + ge.prototype._verify1 = function(A) { + n(A.negative === 0, "red works only with positives"), n(A.red, "red works only with red numbers"); + }, ge.prototype._verify2 = function(A, m) { + n((A.negative | m.negative) === 0, "red works only with positives"), n( + A.red && A.red === m.red, "red works only with red numbers" ); - }, ge.prototype.imod = function(S) { - return this.prime ? this.prime.ireduce(S)._forceRed(this) : S.umod(this.m)._forceRed(this); - }, ge.prototype.neg = function(S) { - return S.isZero() ? S.clone() : this.m.sub(S)._forceRed(this); - }, ge.prototype.add = function(S, m) { - this._verify2(S, m); - var f = S.add(m); + }, ge.prototype.imod = function(A) { + return this.prime ? this.prime.ireduce(A)._forceRed(this) : A.umod(this.m)._forceRed(this); + }, ge.prototype.neg = function(A) { + return A.isZero() ? A.clone() : this.m.sub(A)._forceRed(this); + }, ge.prototype.add = function(A, m) { + this._verify2(A, m); + var f = A.add(m); return f.cmp(this.m) >= 0 && f.isub(this.m), f._forceRed(this); - }, ge.prototype.iadd = function(S, m) { - this._verify2(S, m); - var f = S.iadd(m); + }, ge.prototype.iadd = function(A, m) { + this._verify2(A, m); + var f = A.iadd(m); return f.cmp(this.m) >= 0 && f.isub(this.m), f; - }, ge.prototype.sub = function(S, m) { - this._verify2(S, m); - var f = S.sub(m); + }, ge.prototype.sub = function(A, m) { + this._verify2(A, m); + var f = A.sub(m); return f.cmpn(0) < 0 && f.iadd(this.m), f._forceRed(this); - }, ge.prototype.isub = function(S, m) { - this._verify2(S, m); - var f = S.isub(m); + }, ge.prototype.isub = function(A, m) { + this._verify2(A, m); + var f = A.isub(m); return f.cmpn(0) < 0 && f.iadd(this.m), f; - }, ge.prototype.shl = function(S, m) { - return this._verify1(S), this.imod(S.ushln(m)); - }, ge.prototype.imul = function(S, m) { - return this._verify2(S, m), this.imod(S.imul(m)); - }, ge.prototype.mul = function(S, m) { - return this._verify2(S, m), this.imod(S.mul(m)); - }, ge.prototype.isqr = function(S) { - return this.imul(S, S.clone()); - }, ge.prototype.sqr = function(S) { - return this.mul(S, S); - }, ge.prototype.sqrt = function(S) { - if (S.isZero()) return S.clone(); + }, ge.prototype.shl = function(A, m) { + return this._verify1(A), this.imod(A.ushln(m)); + }, ge.prototype.imul = function(A, m) { + return this._verify2(A, m), this.imod(A.imul(m)); + }, ge.prototype.mul = function(A, m) { + return this._verify2(A, m), this.imod(A.mul(m)); + }, ge.prototype.isqr = function(A) { + return this.imul(A, A.clone()); + }, ge.prototype.sqr = function(A) { + return this.mul(A, A); + }, ge.prototype.sqrt = function(A) { + if (A.isZero()) return A.clone(); var m = this.m.andln(3); if (n(m % 2 === 1), m === 3) { var f = this.m.add(new s(1)).iushrn(2); - return this.pow(S, f); + return this.pow(A, f); } for (var g = this.m.subn(1), b = 0; !g.isZero() && g.andln(1) === 0; ) b++, g.iushrn(1); n(!g.isZero()); - var x = new s(1).toRed(this), _ = x.redNeg(), E = this.m.subn(1).iushrn(1), v = this.m.bitLength(); - for (v = new s(2 * v * v).toRed(this); this.pow(v, E).cmp(_) !== 0; ) - v.redIAdd(_); - for (var P = this.pow(v, g), I = this.pow(S, g.addn(1).iushrn(1)), F = this.pow(S, g), ce = b; F.cmp(x) !== 0; ) { + var x = new s(1).toRed(this), E = x.redNeg(), S = this.m.subn(1).iushrn(1), v = this.m.bitLength(); + for (v = new s(2 * v * v).toRed(this); this.pow(v, S).cmp(E) !== 0; ) + v.redIAdd(E); + for (var M = this.pow(v, g), I = this.pow(A, g.addn(1).iushrn(1)), F = this.pow(A, g), ce = b; F.cmp(x) !== 0; ) { for (var D = F, oe = 0; D.cmp(x) !== 0; oe++) D = D.redSqr(); n(oe < ce); - var Z = this.pow(P, new s(1).iushln(ce - oe - 1)); - I = I.redMul(Z), P = Z.redSqr(), F = F.redMul(P), ce = oe; + var Z = this.pow(M, new s(1).iushln(ce - oe - 1)); + I = I.redMul(Z), M = Z.redSqr(), F = F.redMul(M), ce = oe; } return I; - }, ge.prototype.invm = function(S) { - var m = S._invmp(this.m); + }, ge.prototype.invm = function(A) { + var m = A._invmp(this.m); return m.negative !== 0 ? (m.negative = 0, this.imod(m).redNeg()) : this.imod(m); - }, ge.prototype.pow = function(S, m) { + }, ge.prototype.pow = function(A, m) { if (m.isZero()) return new s(1).toRed(this); - if (m.cmpn(1) === 0) return S.clone(); + if (m.cmpn(1) === 0) return A.clone(); var f = 4, g = new Array(1 << f); - g[0] = new s(1).toRed(this), g[1] = S; + g[0] = new s(1).toRed(this), g[1] = A; for (var b = 2; b < g.length; b++) - g[b] = this.mul(g[b - 1], S); - var x = g[0], _ = 0, E = 0, v = m.bitLength() % 26; + g[b] = this.mul(g[b - 1], A); + var x = g[0], E = 0, S = 0, v = m.bitLength() % 26; for (v === 0 && (v = 26), b = m.length - 1; b >= 0; b--) { - for (var P = m.words[b], I = v - 1; I >= 0; I--) { - var F = P >> I & 1; - if (x !== g[0] && (x = this.sqr(x)), F === 0 && _ === 0) { - E = 0; + for (var M = m.words[b], I = v - 1; I >= 0; I--) { + var F = M >> I & 1; + if (x !== g[0] && (x = this.sqr(x)), F === 0 && E === 0) { + S = 0; continue; } - _ <<= 1, _ |= F, E++, !(E !== f && (b !== 0 || I !== 0)) && (x = this.mul(x, g[_]), E = 0, _ = 0); + E <<= 1, E |= F, S++, !(S !== f && (b !== 0 || I !== 0)) && (x = this.mul(x, g[E]), S = 0, E = 0); } v = 26; } return x; - }, ge.prototype.convertTo = function(S) { - var m = S.umod(this.m); - return m === S ? m.clone() : m; - }, ge.prototype.convertFrom = function(S) { - var m = S.clone(); + }, ge.prototype.convertTo = function(A) { + var m = A.umod(this.m); + return m === A ? m.clone() : m; + }, ge.prototype.convertFrom = function(A) { + var m = A.clone(); return m.red = null, m; - }, s.mont = function(S) { - return new Ee(S); + }, s.mont = function(A) { + return new Ee(A); }; function Ee(Y) { ge.call(this, Y), this.shift = this.m.bitLength(), this.shift % 26 !== 0 && (this.shift += 26 - this.shift % 26), this.r = new s(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this.rinv = this.r._invmp(this.m), this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv = this.minv.umod(this.r), this.minv = this.r.sub(this.minv); } - i(Ee, ge), Ee.prototype.convertTo = function(S) { - return this.imod(S.ushln(this.shift)); - }, Ee.prototype.convertFrom = function(S) { - var m = this.imod(S.mul(this.rinv)); + i(Ee, ge), Ee.prototype.convertTo = function(A) { + return this.imod(A.ushln(this.shift)); + }, Ee.prototype.convertFrom = function(A) { + var m = this.imod(A.mul(this.rinv)); return m.red = null, m; - }, Ee.prototype.imul = function(S, m) { - if (S.isZero() || m.isZero()) - return S.words[0] = 0, S.length = 1, S; - var f = S.imul(m), g = f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), b = f.isub(g).iushrn(this.shift), x = b; + }, Ee.prototype.imul = function(A, m) { + if (A.isZero() || m.isZero()) + return A.words[0] = 0, A.length = 1, A; + var f = A.imul(m), g = f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), b = f.isub(g).iushrn(this.shift), x = b; return b.cmp(this.m) >= 0 ? x = b.isub(this.m) : b.cmpn(0) < 0 && (x = b.iadd(this.m)), x._forceRed(this); - }, Ee.prototype.mul = function(S, m) { - if (S.isZero() || m.isZero()) return new s(0)._forceRed(this); - var f = S.mul(m), g = f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), b = f.isub(g).iushrn(this.shift), x = b; + }, Ee.prototype.mul = function(A, m) { + if (A.isZero() || m.isZero()) return new s(0)._forceRed(this); + var f = A.mul(m), g = f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), b = f.isub(g).iushrn(this.shift), x = b; return b.cmp(this.m) >= 0 ? x = b.isub(this.m) : b.cmpn(0) < 0 && (x = b.iadd(this.m)), x._forceRed(this); - }, Ee.prototype.invm = function(S) { - var m = this.imod(S._invmp(this.m).mul(this.r2)); + }, Ee.prototype.invm = function(A) { + var m = this.imod(A._invmp(this.m).mul(this.r2)); return m._forceRed(this); }; })(t, gn); -})(Zv); -var zo = Zv.exports, Qv = {}; +})(hb); +var Ho = hb.exports, db = {}; (function(t) { var e = t; function r(s, o) { @@ -14349,20 +14861,20 @@ var zo = Zv.exports, Qv = {}; e.toHex = i, e.encode = function(o, a) { return a === "hex" ? i(o) : o; }; -})(Qv); +})(db); (function(t) { - var e = t, r = zo, n = wc, i = Qv; + var e = t, r = Ho, n = Tc, i = db; e.assert = n, e.toArray = i.toArray, e.zero2 = i.zero2, e.toHex = i.toHex, e.encode = i.encode; function s(d, p, w) { - var A = new Array(Math.max(d.bitLength(), w) + 1), M; - for (M = 0; M < A.length; M += 1) - A[M] = 0; - var N = 1 << p + 1, L = d.clone(); - for (M = 0; M < A.length; M++) { - var B, $ = L.andln(N - 1); - L.isOdd() ? ($ > (N >> 1) - 1 ? B = (N >> 1) - $ : B = $, L.isubn(B)) : B = 0, A[M] = B, L.iushrn(1); + var _ = new Array(Math.max(d.bitLength(), w) + 1), P; + for (P = 0; P < _.length; P += 1) + _[P] = 0; + var O = 1 << p + 1, L = d.clone(); + for (P = 0; P < _.length; P++) { + var B, k = L.andln(O - 1); + L.isOdd() ? (k > (O >> 1) - 1 ? B = (O >> 1) - k : B = k, L.isubn(B)) : B = 0, _[P] = B, L.iushrn(1); } - return A; + return _; } e.getNAF = s; function o(d, p) { @@ -14371,21 +14883,21 @@ var zo = Zv.exports, Qv = {}; [] ]; d = d.clone(), p = p.clone(); - for (var A = 0, M = 0, N; d.cmpn(-A) > 0 || p.cmpn(-M) > 0; ) { - var L = d.andln(3) + A & 3, B = p.andln(3) + M & 3; + for (var _ = 0, P = 0, O; d.cmpn(-_) > 0 || p.cmpn(-P) > 0; ) { + var L = d.andln(3) + _ & 3, B = p.andln(3) + P & 3; L === 3 && (L = -1), B === 3 && (B = -1); - var $; - L & 1 ? (N = d.andln(7) + A & 7, (N === 3 || N === 5) && B === 2 ? $ = -L : $ = L) : $ = 0, w[0].push($); - var H; - B & 1 ? (N = p.andln(7) + M & 7, (N === 3 || N === 5) && L === 2 ? H = -B : H = B) : H = 0, w[1].push(H), 2 * A === $ + 1 && (A = 1 - A), 2 * M === H + 1 && (M = 1 - M), d.iushrn(1), p.iushrn(1); + var k; + L & 1 ? (O = d.andln(7) + _ & 7, (O === 3 || O === 5) && B === 2 ? k = -L : k = L) : k = 0, w[0].push(k); + var q; + B & 1 ? (O = p.andln(7) + P & 7, (O === 3 || O === 5) && L === 2 ? q = -B : q = B) : q = 0, w[1].push(q), 2 * _ === k + 1 && (_ = 1 - _), 2 * P === q + 1 && (P = 1 - P), d.iushrn(1), p.iushrn(1); } return w; } e.getJSF = o; function a(d, p, w) { - var A = "_" + p; + var _ = "_" + p; d.prototype[p] = function() { - return this[A] !== void 0 ? this[A] : this[A] = w.call(this); + return this[_] !== void 0 ? this[_] : this[_] = w.call(this); }; } e.cachedProperty = a; @@ -14397,19 +14909,19 @@ var zo = Zv.exports, Qv = {}; return new r(d, "hex", "le"); } e.intFromLE = l; -})(Bi); -var eb = { exports: {} }, am; -eb.exports = function(e) { - return am || (am = new la(null)), am.generate(e); +})(ji); +var pb = { exports: {} }, xm; +pb.exports = function(e) { + return xm || (xm = new da(null)), xm.generate(e); }; -function la(t) { +function da(t) { this.rand = t; } -eb.exports.Rand = la; -la.prototype.generate = function(e) { +pb.exports.Rand = da; +da.prototype.generate = function(e) { return this._rand(e); }; -la.prototype._rand = function(e) { +da.prototype._rand = function(e) { if (this.rand.getBytes) return this.rand.getBytes(e); for (var r = new Uint8Array(e), n = 0; n < r.length; n++) @@ -14417,41 +14929,41 @@ la.prototype._rand = function(e) { return r; }; if (typeof self == "object") - self.crypto && self.crypto.getRandomValues ? la.prototype._rand = function(e) { + self.crypto && self.crypto.getRandomValues ? da.prototype._rand = function(e) { var r = new Uint8Array(e); return self.crypto.getRandomValues(r), r; - } : self.msCrypto && self.msCrypto.getRandomValues ? la.prototype._rand = function(e) { + } : self.msCrypto && self.msCrypto.getRandomValues ? da.prototype._rand = function(e) { var r = new Uint8Array(e); return self.msCrypto.getRandomValues(r), r; - } : typeof window == "object" && (la.prototype._rand = function() { + } : typeof window == "object" && (da.prototype._rand = function() { throw new Error("Not implemented yet"); }); else try { - var Tx = Wl; - if (typeof Tx.randomBytes != "function") + var Kx = Ql; + if (typeof Kx.randomBytes != "function") throw new Error("Not supported"); - la.prototype._rand = function(e) { - return Tx.randomBytes(e); + da.prototype._rand = function(e) { + return Kx.randomBytes(e); }; } catch { } -var E8 = eb.exports, tb = {}, Wa = zo, Jl = Bi, s0 = Jl.getNAF, iq = Jl.getJSF, o0 = Jl.assert; -function Ca(t, e) { - this.type = t, this.p = new Wa(e.p, 16), this.red = e.prime ? Wa.red(e.prime) : Wa.mont(this.p), this.zero = new Wa(0).toRed(this.red), this.one = new Wa(1).toRed(this.red), this.two = new Wa(2).toRed(this.red), this.n = e.n && new Wa(e.n, 16), this.g = e.g && this.pointFromJSON(e.g, e.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; +var X8 = pb.exports, gb = {}, Ja = Ho, sh = ji, v0 = sh.getNAF, $q = sh.getJSF, b0 = sh.assert; +function La(t, e) { + this.type = t, this.p = new Ja(e.p, 16), this.red = e.prime ? Ja.red(e.prime) : Ja.mont(this.p), this.zero = new Ja(0).toRed(this.red), this.one = new Ja(1).toRed(this.red), this.two = new Ja(2).toRed(this.red), this.n = e.n && new Ja(e.n, 16), this.g = e.g && this.pointFromJSON(e.g, e.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; var r = this.n && this.p.div(this.n); !r || r.cmpn(100) > 0 ? this.redN = null : (this._maxwellTrick = !0, this.redN = this.n.toRed(this.red)); } -var G0 = Ca; -Ca.prototype.point = function() { +var cp = La; +La.prototype.point = function() { throw new Error("Not implemented"); }; -Ca.prototype.validate = function() { +La.prototype.validate = function() { throw new Error("Not implemented"); }; -Ca.prototype._fixedNafMul = function(e, r) { - o0(e.precomputed); - var n = e._getDoubles(), i = s0(r, 1, this._bitLength), s = (1 << n.step + 1) - (n.step % 2 === 0 ? 2 : 1); +La.prototype._fixedNafMul = function(e, r) { + b0(e.precomputed); + var n = e._getDoubles(), i = v0(r, 1, this._bitLength), s = (1 << n.step + 1) - (n.step % 2 === 0 ? 2 : 1); s /= 3; var o = [], a, u; for (a = 0; a < i.length; a += n.step) { @@ -14467,43 +14979,43 @@ Ca.prototype._fixedNafMul = function(e, r) { } return d.toP(); }; -Ca.prototype._wnafMul = function(e, r) { +La.prototype._wnafMul = function(e, r) { var n = 4, i = e._getNAFPoints(n); n = i.wnd; - for (var s = i.points, o = s0(r, n, this._bitLength), a = this.jpoint(null, null, null), u = o.length - 1; u >= 0; u--) { + for (var s = i.points, o = v0(r, n, this._bitLength), a = this.jpoint(null, null, null), u = o.length - 1; u >= 0; u--) { for (var l = 0; u >= 0 && o[u] === 0; u--) l++; if (u >= 0 && l++, a = a.dblp(l), u < 0) break; var d = o[u]; - o0(d !== 0), e.type === "affine" ? d > 0 ? a = a.mixedAdd(s[d - 1 >> 1]) : a = a.mixedAdd(s[-d - 1 >> 1].neg()) : d > 0 ? a = a.add(s[d - 1 >> 1]) : a = a.add(s[-d - 1 >> 1].neg()); + b0(d !== 0), e.type === "affine" ? d > 0 ? a = a.mixedAdd(s[d - 1 >> 1]) : a = a.mixedAdd(s[-d - 1 >> 1].neg()) : d > 0 ? a = a.add(s[d - 1 >> 1]) : a = a.add(s[-d - 1 >> 1].neg()); } return e.type === "affine" ? a.toP() : a; }; -Ca.prototype._wnafMulAdd = function(e, r, n, i, s) { +La.prototype._wnafMulAdd = function(e, r, n, i, s) { var o = this._wnafT1, a = this._wnafT2, u = this._wnafT3, l = 0, d, p, w; for (d = 0; d < i; d++) { w = r[d]; - var A = w._getNAFPoints(e); - o[d] = A.wnd, a[d] = A.points; + var _ = w._getNAFPoints(e); + o[d] = _.wnd, a[d] = _.points; } for (d = i - 1; d >= 1; d -= 2) { - var M = d - 1, N = d; - if (o[M] !== 1 || o[N] !== 1) { - u[M] = s0(n[M], o[M], this._bitLength), u[N] = s0(n[N], o[N], this._bitLength), l = Math.max(u[M].length, l), l = Math.max(u[N].length, l); + var P = d - 1, O = d; + if (o[P] !== 1 || o[O] !== 1) { + u[P] = v0(n[P], o[P], this._bitLength), u[O] = v0(n[O], o[O], this._bitLength), l = Math.max(u[P].length, l), l = Math.max(u[O].length, l); continue; } var L = [ - r[M], + r[P], /* 1 */ null, /* 3 */ null, /* 5 */ - r[N] + r[O] /* 7 */ ]; - r[M].y.cmp(r[N].y) === 0 ? (L[1] = r[M].add(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())) : r[M].y.cmp(r[N].y.redNeg()) === 0 ? (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].add(r[N].neg())) : (L[1] = r[M].toJ().mixedAdd(r[N]), L[2] = r[M].toJ().mixedAdd(r[N].neg())); + r[P].y.cmp(r[O].y) === 0 ? (L[1] = r[P].add(r[O]), L[2] = r[P].toJ().mixedAdd(r[O].neg())) : r[P].y.cmp(r[O].y.redNeg()) === 0 ? (L[1] = r[P].toJ().mixedAdd(r[O]), L[2] = r[P].add(r[O].neg())) : (L[1] = r[P].toJ().mixedAdd(r[O]), L[2] = r[P].toJ().mixedAdd(r[O].neg())); var B = [ -3, /* -1 -1 */ @@ -14523,18 +15035,18 @@ Ca.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 1 0 */ 3 /* 1 1 */ - ], $ = iq(n[M], n[N]); - for (l = Math.max($[0].length, l), u[M] = new Array(l), u[N] = new Array(l), p = 0; p < l; p++) { - var H = $[0][p] | 0, U = $[1][p] | 0; - u[M][p] = B[(H + 1) * 3 + (U + 1)], u[N][p] = 0, a[M] = L; + ], k = $q(n[P], n[O]); + for (l = Math.max(k[0].length, l), u[P] = new Array(l), u[O] = new Array(l), p = 0; p < l; p++) { + var q = k[0][p] | 0, U = k[1][p] | 0; + u[P][p] = B[(q + 1) * 3 + (U + 1)], u[O][p] = 0, a[P] = L; } } - var V = this.jpoint(null, null, null), te = this._wnafT4; + var V = this.jpoint(null, null, null), Q = this._wnafT4; for (d = l; d >= 0; d--) { for (var R = 0; d >= 0; ) { var K = !0; for (p = 0; p < i; p++) - te[p] = u[p][d] | 0, te[p] !== 0 && (K = !1); + Q[p] = u[p][d] | 0, Q[p] !== 0 && (K = !1); if (!K) break; R++, d--; @@ -14542,7 +15054,7 @@ Ca.prototype._wnafMulAdd = function(e, r, n, i, s) { if (d >= 0 && R++, V = V.dblp(R), d < 0) break; for (p = 0; p < i; p++) { - var ge = te[p]; + var ge = Q[p]; ge !== 0 && (ge > 0 ? w = a[p][ge - 1 >> 1] : ge < 0 && (w = a[p][-ge - 1 >> 1].neg()), w.type === "affine" ? V = V.mixedAdd(w) : V = V.add(w)); } } @@ -14550,21 +15062,21 @@ Ca.prototype._wnafMulAdd = function(e, r, n, i, s) { a[d] = null; return s ? V : V.toP(); }; -function ss(t, e) { +function as(t, e) { this.curve = t, this.type = e, this.precomputed = null; } -Ca.BasePoint = ss; -ss.prototype.eq = function() { +La.BasePoint = as; +as.prototype.eq = function() { throw new Error("Not implemented"); }; -ss.prototype.validate = function() { +as.prototype.validate = function() { return this.curve.validate(this); }; -Ca.prototype.decodePoint = function(e, r) { - e = Jl.toArray(e, r); +La.prototype.decodePoint = function(e, r) { + e = sh.toArray(e, r); var n = this.p.byteLength(); if ((e[0] === 4 || e[0] === 6 || e[0] === 7) && e.length - 1 === 2 * n) { - e[0] === 6 ? o0(e[e.length - 1] % 2 === 0) : e[0] === 7 && o0(e[e.length - 1] % 2 === 1); + e[0] === 6 ? b0(e[e.length - 1] % 2 === 0) : e[0] === 7 && b0(e[e.length - 1] % 2 === 1); var i = this.point( e.slice(1, 1 + n), e.slice(1 + n, 1 + 2 * n) @@ -14574,17 +15086,17 @@ Ca.prototype.decodePoint = function(e, r) { return this.pointFromX(e.slice(1, 1 + n), e[0] === 3); throw new Error("Unknown point format"); }; -ss.prototype.encodeCompressed = function(e) { +as.prototype.encodeCompressed = function(e) { return this.encode(e, !0); }; -ss.prototype._encode = function(e) { +as.prototype._encode = function(e) { var r = this.curve.p.byteLength(), n = this.getX().toArray("be", r); return e ? [this.getY().isEven() ? 2 : 3].concat(n) : [4].concat(n, this.getY().toArray("be", r)); }; -ss.prototype.encode = function(e, r) { - return Jl.encode(this._encode(r), e); +as.prototype.encode = function(e, r) { + return sh.encode(this._encode(r), e); }; -ss.prototype.precompute = function(e) { +as.prototype.precompute = function(e) { if (this.precomputed) return this; var r = { @@ -14594,13 +15106,13 @@ ss.prototype.precompute = function(e) { }; return r.naf = this._getNAFPoints(8), r.doubles = this._getDoubles(4, e), r.beta = this._getBeta(), this.precomputed = r, this; }; -ss.prototype._hasDoubles = function(e) { +as.prototype._hasDoubles = function(e) { if (!this.precomputed) return !1; var r = this.precomputed.doubles; return r ? r.points.length >= Math.ceil((e.bitLength() + 1) / r.step) : !1; }; -ss.prototype._getDoubles = function(e, r) { +as.prototype._getDoubles = function(e, r) { if (this.precomputed && this.precomputed.doubles) return this.precomputed.doubles; for (var n = [this], i = this, s = 0; s < r; s += e) { @@ -14613,7 +15125,7 @@ ss.prototype._getDoubles = function(e, r) { points: n }; }; -ss.prototype._getNAFPoints = function(e) { +as.prototype._getNAFPoints = function(e) { if (this.precomputed && this.precomputed.naf) return this.precomputed.naf; for (var r = [this], n = (1 << e) - 1, i = n === 1 ? null : this.dbl(), s = 1; s < n; s++) @@ -14623,21 +15135,21 @@ ss.prototype._getNAFPoints = function(e) { points: r }; }; -ss.prototype._getBeta = function() { +as.prototype._getBeta = function() { return null; }; -ss.prototype.dblp = function(e) { +as.prototype.dblp = function(e) { for (var r = this, n = 0; n < e; n++) r = r.dbl(); return r; }; -var sq = Bi, rn = zo, rb = z0, Fu = G0, oq = sq.assert; -function os(t) { - Fu.call(this, "short", t), this.a = new rn(t.a, 16).toRed(this.red), this.b = new rn(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); +var Bq = ji, rn = Ho, mb = np, Ku = cp, Fq = Bq.assert; +function cs(t) { + Ku.call(this, "short", t), this.a = new rn(t.a, 16).toRed(this.red), this.b = new rn(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); } -rb(os, Fu); -var aq = os; -os.prototype._getEndomorphism = function(e) { +mb(cs, Ku); +var jq = cs; +cs.prototype._getEndomorphism = function(e) { if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { var r, n; if (e.beta) @@ -14650,7 +15162,7 @@ os.prototype._getEndomorphism = function(e) { n = new rn(e.lambda, 16); else { var s = this._getEndoRoots(this.n); - this.g.mul(s[0]).x.cmp(this.g.x.redMul(r)) === 0 ? n = s[0] : (n = s[1], oq(this.g.mul(n).x.cmp(this.g.x.redMul(r)) === 0)); + this.g.mul(s[0]).x.cmp(this.g.x.redMul(r)) === 0 ? n = s[0] : (n = s[1], Fq(this.g.mul(n).x.cmp(this.g.x.redMul(r)) === 0)); } var o; return e.basis ? o = e.basis.map(function(a) { @@ -14665,33 +15177,33 @@ os.prototype._getEndomorphism = function(e) { }; } }; -os.prototype._getEndoRoots = function(e) { +cs.prototype._getEndoRoots = function(e) { var r = e === this.p ? this.red : rn.mont(e), n = new rn(2).toRed(r).redInvm(), i = n.redNeg(), s = new rn(3).toRed(r).redNeg().redSqrt().redMul(n), o = i.redAdd(s).fromRed(), a = i.redSub(s).fromRed(); return [o, a]; }; -os.prototype._getEndoBasis = function(e) { - for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new rn(1), o = new rn(0), a = new rn(0), u = new rn(1), l, d, p, w, A, M, N, L = 0, B, $; n.cmpn(0) !== 0; ) { - var H = i.div(n); - B = i.sub(H.mul(n)), $ = a.sub(H.mul(s)); - var U = u.sub(H.mul(o)); +cs.prototype._getEndoBasis = function(e) { + for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new rn(1), o = new rn(0), a = new rn(0), u = new rn(1), l, d, p, w, _, P, O, L = 0, B, k; n.cmpn(0) !== 0; ) { + var q = i.div(n); + B = i.sub(q.mul(n)), k = a.sub(q.mul(s)); + var U = u.sub(q.mul(o)); if (!p && B.cmp(r) < 0) - l = N.neg(), d = s, p = B.neg(), w = $; + l = O.neg(), d = s, p = B.neg(), w = k; else if (p && ++L === 2) break; - N = B, i = n, n = B, a = s, s = $, u = o, o = U; + O = B, i = n, n = B, a = s, s = k, u = o, o = U; } - A = B.neg(), M = $; - var V = p.sqr().add(w.sqr()), te = A.sqr().add(M.sqr()); - return te.cmp(V) >= 0 && (A = l, M = d), p.negative && (p = p.neg(), w = w.neg()), A.negative && (A = A.neg(), M = M.neg()), [ + _ = B.neg(), P = k; + var V = p.sqr().add(w.sqr()), Q = _.sqr().add(P.sqr()); + return Q.cmp(V) >= 0 && (_ = l, P = d), p.negative && (p = p.neg(), w = w.neg()), _.negative && (_ = _.neg(), P = P.neg()), [ { a: p, b: w }, - { a: A, b: M } + { a: _, b: P } ]; }; -os.prototype._endoSplit = function(e) { +cs.prototype._endoSplit = function(e) { var r = this.endo.basis, n = r[0], i = r[1], s = i.b.mul(e).divRound(this.n), o = n.b.neg().mul(e).divRound(this.n), a = s.mul(n.a), u = o.mul(i.a), l = s.mul(n.b), d = o.mul(i.b), p = e.sub(a).sub(u), w = l.add(d).neg(); return { k1: p, k2: w }; }; -os.prototype.pointFromX = function(e, r) { +cs.prototype.pointFromX = function(e, r) { e = new rn(e, 16), e.red || (e = e.toRed(this.red)); var n = e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b), i = n.redSqrt(); if (i.redSqr().redSub(n).cmp(this.zero) !== 0) @@ -14699,13 +15211,13 @@ os.prototype.pointFromX = function(e, r) { var s = i.fromRed().isOdd(); return (r && !s || !r && s) && (i = i.redNeg()), this.point(e, i); }; -os.prototype.validate = function(e) { +cs.prototype.validate = function(e) { if (e.inf) return !0; var r = e.x, n = e.y, i = this.a.redMul(r), s = r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b); return n.redSqr().redISub(s).cmpn(0) === 0; }; -os.prototype._endoWnafMulAdd = function(e, r, n) { +cs.prototype._endoWnafMulAdd = function(e, r, n) { for (var i = this._endoWnafT1, s = this._endoWnafT2, o = 0; o < e.length; o++) { var a = this._endoSplit(r[o]), u = e[o], l = u._getBeta(); a.k1.negative && (a.k1.ineg(), u = u.neg(!0)), a.k2.negative && (a.k2.ineg(), l = l.neg(!0)), i[o * 2] = u, i[o * 2 + 1] = l, s[o * 2] = a.k1, s[o * 2 + 1] = a.k2; @@ -14715,13 +15227,13 @@ os.prototype._endoWnafMulAdd = function(e, r, n) { return d; }; function $n(t, e, r, n) { - Fu.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new rn(e, 16), this.y = new rn(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); + Ku.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new rn(e, 16), this.y = new rn(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); } -rb($n, Fu.BasePoint); -os.prototype.point = function(e, r, n) { +mb($n, Ku.BasePoint); +cs.prototype.point = function(e, r, n) { return new $n(this, e, r, n); }; -os.prototype.pointFromJSON = function(e, r) { +cs.prototype.pointFromJSON = function(e, r) { return $n.fromJSON(this, e, r); }; $n.prototype._getBeta = function() { @@ -14861,10 +15373,10 @@ $n.prototype.toJ = function() { return e; }; function Wn(t, e, r, n) { - Fu.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new rn(0)) : (this.x = new rn(e, 16), this.y = new rn(r, 16), this.z = new rn(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; + Ku.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new rn(0)) : (this.x = new rn(e, 16), this.y = new rn(r, 16), this.z = new rn(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; } -rb(Wn, Fu.BasePoint); -os.prototype.jpoint = function(e, r, n) { +mb(Wn, Ku.BasePoint); +cs.prototype.jpoint = function(e, r, n) { return new Wn(this, e, r, n); }; Wn.prototype.toP = function() { @@ -14884,8 +15396,8 @@ Wn.prototype.add = function(e) { var r = e.z.redSqr(), n = this.z.redSqr(), i = this.x.redMul(r), s = e.x.redMul(n), o = this.y.redMul(r.redMul(e.z)), a = e.y.redMul(n.redMul(this.z)), u = i.redSub(s), l = o.redSub(a); if (u.cmpn(0) === 0) return l.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var d = u.redSqr(), p = d.redMul(u), w = i.redMul(d), A = l.redSqr().redIAdd(p).redISub(w).redISub(w), M = l.redMul(w.redISub(A)).redISub(o.redMul(p)), N = this.z.redMul(e.z).redMul(u); - return this.curve.jpoint(A, M, N); + var d = u.redSqr(), p = d.redMul(u), w = i.redMul(d), _ = l.redSqr().redIAdd(p).redISub(w).redISub(w), P = l.redMul(w.redISub(_)).redISub(o.redMul(p)), O = this.z.redMul(e.z).redMul(u); + return this.curve.jpoint(_, P, O); }; Wn.prototype.mixedAdd = function(e) { if (this.isInfinity()) @@ -14895,8 +15407,8 @@ Wn.prototype.mixedAdd = function(e) { var r = this.z.redSqr(), n = this.x, i = e.x.redMul(r), s = this.y, o = e.y.redMul(r).redMul(this.z), a = n.redSub(i), u = s.redSub(o); if (a.cmpn(0) === 0) return u.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var l = a.redSqr(), d = l.redMul(a), p = n.redMul(l), w = u.redSqr().redIAdd(d).redISub(p).redISub(p), A = u.redMul(p.redISub(w)).redISub(s.redMul(d)), M = this.z.redMul(a); - return this.curve.jpoint(w, A, M); + var l = a.redSqr(), d = l.redMul(a), p = n.redMul(l), w = u.redSqr().redIAdd(d).redISub(p).redISub(p), _ = u.redMul(p.redISub(w)).redISub(s.redMul(d)), P = this.z.redMul(a); + return this.curve.jpoint(w, _, P); }; Wn.prototype.dblp = function(e) { if (e === 0) @@ -14914,10 +15426,10 @@ Wn.prototype.dblp = function(e) { } var i = this.curve.a, s = this.curve.tinv, o = this.x, a = this.y, u = this.z, l = u.redSqr().redSqr(), d = a.redAdd(a); for (r = 0; r < e; r++) { - var p = o.redSqr(), w = d.redSqr(), A = w.redSqr(), M = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), N = o.redMul(w), L = M.redSqr().redISub(N.redAdd(N)), B = N.redISub(L), $ = M.redMul(B); - $ = $.redIAdd($).redISub(A); - var H = d.redMul(u); - r + 1 < e && (l = l.redMul(A)), o = L, u = H, d = $; + var p = o.redSqr(), w = d.redSqr(), _ = w.redSqr(), P = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), O = o.redMul(w), L = P.redSqr().redISub(O.redAdd(O)), B = O.redISub(L), k = P.redMul(B); + k = k.redIAdd(k).redISub(_); + var q = d.redMul(u); + r + 1 < e && (l = l.redMul(_)), o = L, u = q, d = k; } return this.curve.jpoint(o, d.redMul(s), u); }; @@ -14932,10 +15444,10 @@ Wn.prototype._zeroDbl = function() { var u = i.redAdd(i).redIAdd(i), l = u.redSqr().redISub(a).redISub(a), d = o.redIAdd(o); d = d.redIAdd(d), d = d.redIAdd(d), e = l, r = u.redMul(a.redISub(l)).redISub(d), n = this.y.redAdd(this.y); } else { - var p = this.x.redSqr(), w = this.y.redSqr(), A = w.redSqr(), M = this.x.redAdd(w).redSqr().redISub(p).redISub(A); - M = M.redIAdd(M); - var N = p.redAdd(p).redIAdd(p), L = N.redSqr(), B = A.redIAdd(A); - B = B.redIAdd(B), B = B.redIAdd(B), e = L.redISub(M).redISub(M), r = N.redMul(M.redISub(e)).redISub(B), n = this.y.redMul(this.z), n = n.redIAdd(n); + var p = this.x.redSqr(), w = this.y.redSqr(), _ = w.redSqr(), P = this.x.redAdd(w).redSqr().redISub(p).redISub(_); + P = P.redIAdd(P); + var O = p.redAdd(p).redIAdd(p), L = O.redSqr(), B = _.redIAdd(_); + B = B.redIAdd(B), B = B.redIAdd(B), e = L.redISub(P).redISub(P), r = O.redMul(P.redISub(e)).redISub(B), n = this.y.redMul(this.z), n = n.redIAdd(n); } return this.curve.jpoint(e, r, n); }; @@ -14949,24 +15461,24 @@ Wn.prototype._threeDbl = function() { var d = o.redIAdd(o); d = d.redIAdd(d), d = d.redIAdd(d), r = u.redMul(a.redISub(l)).redISub(d), n = this.y.redAdd(this.y); } else { - var p = this.z.redSqr(), w = this.y.redSqr(), A = this.x.redMul(w), M = this.x.redSub(p).redMul(this.x.redAdd(p)); - M = M.redAdd(M).redIAdd(M); - var N = A.redIAdd(A); - N = N.redIAdd(N); - var L = N.redAdd(N); - e = M.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(p); + var p = this.z.redSqr(), w = this.y.redSqr(), _ = this.x.redMul(w), P = this.x.redSub(p).redMul(this.x.redAdd(p)); + P = P.redAdd(P).redIAdd(P); + var O = _.redIAdd(_); + O = O.redIAdd(O); + var L = O.redAdd(O); + e = P.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(p); var B = w.redSqr(); - B = B.redIAdd(B), B = B.redIAdd(B), B = B.redIAdd(B), r = M.redMul(N.redISub(e)).redISub(B); + B = B.redIAdd(B), B = B.redIAdd(B), B = B.redIAdd(B), r = P.redMul(O.redISub(e)).redISub(B); } return this.curve.jpoint(e, r, n); }; Wn.prototype._dbl = function() { var e = this.curve.a, r = this.x, n = this.y, i = this.z, s = i.redSqr().redSqr(), o = r.redSqr(), a = n.redSqr(), u = o.redAdd(o).redIAdd(o).redIAdd(e.redMul(s)), l = r.redAdd(r); l = l.redIAdd(l); - var d = l.redMul(a), p = u.redSqr().redISub(d.redAdd(d)), w = d.redISub(p), A = a.redSqr(); - A = A.redIAdd(A), A = A.redIAdd(A), A = A.redIAdd(A); - var M = u.redMul(w).redISub(A), N = n.redAdd(n).redMul(i); - return this.curve.jpoint(p, M, N); + var d = l.redMul(a), p = u.redSqr().redISub(d.redAdd(d)), w = d.redISub(p), _ = a.redSqr(); + _ = _.redIAdd(_), _ = _.redIAdd(_), _ = _.redIAdd(_); + var P = u.redMul(w).redISub(_), O = n.redAdd(n).redMul(i); + return this.curve.jpoint(p, P, O); }; Wn.prototype.trpl = function() { if (!this.curve.zeroA) @@ -14979,10 +15491,10 @@ Wn.prototype.trpl = function() { p = p.redIAdd(p), p = p.redIAdd(p); var w = this.x.redMul(u).redISub(p); w = w.redIAdd(w), w = w.redIAdd(w); - var A = this.y.redMul(d.redMul(l.redISub(d)).redISub(a.redMul(u))); - A = A.redIAdd(A), A = A.redIAdd(A), A = A.redIAdd(A); - var M = this.z.redAdd(a).redSqr().redISub(n).redISub(u); - return this.curve.jpoint(w, A, M); + var _ = this.y.redMul(d.redMul(l.redISub(d)).redISub(a.redMul(u))); + _ = _.redIAdd(_), _ = _.redIAdd(_), _ = _.redIAdd(_); + var P = this.z.redAdd(a).redSqr().redISub(n).redISub(u); + return this.curve.jpoint(w, _, P); }; Wn.prototype.mul = function(e, r) { return e = new rn(e, r), this.curve._wnafMul(this, e); @@ -15015,27 +15527,27 @@ Wn.prototype.inspect = function() { Wn.prototype.isInfinity = function() { return this.z.cmpn(0) === 0; }; -var Qc = zo, S8 = z0, Y0 = G0, cq = Bi; -function ju(t) { - Y0.call(this, "mont", t), this.a = new Qc(t.a, 16).toRed(this.red), this.b = new Qc(t.b, 16).toRed(this.red), this.i4 = new Qc(4).toRed(this.red).redInvm(), this.two = new Qc(2).toRed(this.red), this.a24 = this.i4.redMul(this.a.redAdd(this.two)); +var uu = Ho, Z8 = np, up = cp, Uq = ji; +function Vu(t) { + up.call(this, "mont", t), this.a = new uu(t.a, 16).toRed(this.red), this.b = new uu(t.b, 16).toRed(this.red), this.i4 = new uu(4).toRed(this.red).redInvm(), this.two = new uu(2).toRed(this.red), this.a24 = this.i4.redMul(this.a.redAdd(this.two)); } -S8(ju, Y0); -var uq = ju; -ju.prototype.validate = function(e) { +Z8(Vu, up); +var qq = Vu; +Vu.prototype.validate = function(e) { var r = e.normalize().x, n = r.redSqr(), i = n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r), s = i.redSqrt(); return s.redSqr().cmp(i) === 0; }; function Ln(t, e, r) { - Y0.BasePoint.call(this, t, "projective"), e === null && r === null ? (this.x = this.curve.one, this.z = this.curve.zero) : (this.x = new Qc(e, 16), this.z = new Qc(r, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red))); + up.BasePoint.call(this, t, "projective"), e === null && r === null ? (this.x = this.curve.one, this.z = this.curve.zero) : (this.x = new uu(e, 16), this.z = new uu(r, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red))); } -S8(Ln, Y0.BasePoint); -ju.prototype.decodePoint = function(e, r) { - return this.point(cq.toArray(e, r), 1); +Z8(Ln, up.BasePoint); +Vu.prototype.decodePoint = function(e, r) { + return this.point(Uq.toArray(e, r), 1); }; -ju.prototype.point = function(e, r) { +Vu.prototype.point = function(e, r) { return new Ln(this, e, r); }; -ju.prototype.pointFromJSON = function(e) { +Vu.prototype.pointFromJSON = function(e) { return Ln.fromJSON(this, e); }; Ln.prototype.precompute = function() { @@ -15085,31 +15597,31 @@ Ln.prototype.normalize = function() { Ln.prototype.getX = function() { return this.normalize(), this.x.fromRed(); }; -var fq = Bi, So = zo, A8 = z0, J0 = G0, lq = fq.assert; -function no(t) { - this.twisted = (t.a | 0) !== 1, this.mOneA = this.twisted && (t.a | 0) === -1, this.extended = this.mOneA, J0.call(this, "edwards", t), this.a = new So(t.a, 16).umod(this.red.m), this.a = this.a.toRed(this.red), this.c = new So(t.c, 16).toRed(this.red), this.c2 = this.c.redSqr(), this.d = new So(t.d, 16).toRed(this.red), this.dd = this.d.redAdd(this.d), lq(!this.twisted || this.c.fromRed().cmpn(1) === 0), this.oneC = (t.c | 0) === 1; +var zq = ji, Io = Ho, Q8 = np, fp = cp, Wq = zq.assert; +function oo(t) { + this.twisted = (t.a | 0) !== 1, this.mOneA = this.twisted && (t.a | 0) === -1, this.extended = this.mOneA, fp.call(this, "edwards", t), this.a = new Io(t.a, 16).umod(this.red.m), this.a = this.a.toRed(this.red), this.c = new Io(t.c, 16).toRed(this.red), this.c2 = this.c.redSqr(), this.d = new Io(t.d, 16).toRed(this.red), this.dd = this.d.redAdd(this.d), Wq(!this.twisted || this.c.fromRed().cmpn(1) === 0), this.oneC = (t.c | 0) === 1; } -A8(no, J0); -var hq = no; -no.prototype._mulA = function(e) { +Q8(oo, fp); +var Hq = oo; +oo.prototype._mulA = function(e) { return this.mOneA ? e.redNeg() : this.a.redMul(e); }; -no.prototype._mulC = function(e) { +oo.prototype._mulC = function(e) { return this.oneC ? e : this.c.redMul(e); }; -no.prototype.jpoint = function(e, r, n, i) { +oo.prototype.jpoint = function(e, r, n, i) { return this.point(e, r, n, i); }; -no.prototype.pointFromX = function(e, r) { - e = new So(e, 16), e.red || (e = e.toRed(this.red)); +oo.prototype.pointFromX = function(e, r) { + e = new Io(e, 16), e.red || (e = e.toRed(this.red)); var n = e.redSqr(), i = this.c2.redSub(this.a.redMul(n)), s = this.one.redSub(this.c2.redMul(this.d).redMul(n)), o = i.redMul(s.redInvm()), a = o.redSqrt(); if (a.redSqr().redSub(o).cmp(this.zero) !== 0) throw new Error("invalid point"); var u = a.fromRed().isOdd(); return (r && !u || !r && u) && (a = a.redNeg()), this.point(e, a); }; -no.prototype.pointFromY = function(e, r) { - e = new So(e, 16), e.red || (e = e.toRed(this.red)); +oo.prototype.pointFromY = function(e, r) { + e = new Io(e, 16), e.red || (e = e.toRed(this.red)); var n = e.redSqr(), i = n.redSub(this.c2), s = n.redMul(this.d).redMul(this.c2).redSub(this.a), o = i.redMul(s.redInvm()); if (o.cmp(this.zero) === 0) { if (r) @@ -15121,7 +15633,7 @@ no.prototype.pointFromY = function(e, r) { throw new Error("invalid point"); return a.fromRed().isOdd() !== r && (a = a.redNeg()), this.point(a, e); }; -no.prototype.validate = function(e) { +oo.prototype.validate = function(e) { if (e.isInfinity()) return !0; e.normalize(); @@ -15129,13 +15641,13 @@ no.prototype.validate = function(e) { return i.cmp(s) === 0; }; function Hr(t, e, r, n, i) { - J0.BasePoint.call(this, t, "projective"), e === null && r === null && n === null ? (this.x = this.curve.zero, this.y = this.curve.one, this.z = this.curve.one, this.t = this.curve.zero, this.zOne = !0) : (this.x = new So(e, 16), this.y = new So(r, 16), this.z = n ? new So(n, 16) : this.curve.one, this.t = i && new So(i, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.t && !this.t.red && (this.t = this.t.toRed(this.curve.red)), this.zOne = this.z === this.curve.one, this.curve.extended && !this.t && (this.t = this.x.redMul(this.y), this.zOne || (this.t = this.t.redMul(this.z.redInvm())))); + fp.BasePoint.call(this, t, "projective"), e === null && r === null && n === null ? (this.x = this.curve.zero, this.y = this.curve.one, this.z = this.curve.one, this.t = this.curve.zero, this.zOne = !0) : (this.x = new Io(e, 16), this.y = new Io(r, 16), this.z = n ? new Io(n, 16) : this.curve.one, this.t = i && new Io(i, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.t && !this.t.red && (this.t = this.t.toRed(this.curve.red)), this.zOne = this.z === this.curve.one, this.curve.extended && !this.t && (this.t = this.x.redMul(this.y), this.zOne || (this.t = this.t.redMul(this.z.redInvm())))); } -A8(Hr, J0.BasePoint); -no.prototype.pointFromJSON = function(e) { +Q8(Hr, fp.BasePoint); +oo.prototype.pointFromJSON = function(e) { return Hr.fromJSON(this, e); }; -no.prototype.point = function(e, r, n, i) { +oo.prototype.point = function(e, r, n, i) { return new Hr(this, e, r, n, i); }; Hr.fromJSON = function(e, r) { @@ -15167,8 +15679,8 @@ Hr.prototype.dbl = function() { return this.isInfinity() ? this : this.curve.extended ? this._extDbl() : this._projDbl(); }; Hr.prototype._extAdd = function(e) { - var r = this.y.redSub(this.x).redMul(e.y.redSub(e.x)), n = this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)), i = this.t.redMul(this.curve.dd).redMul(e.t), s = this.z.redMul(e.z.redAdd(e.z)), o = n.redSub(r), a = s.redSub(i), u = s.redAdd(i), l = n.redAdd(r), d = o.redMul(a), p = u.redMul(l), w = o.redMul(l), A = a.redMul(u); - return this.curve.point(d, p, A, w); + var r = this.y.redSub(this.x).redMul(e.y.redSub(e.x)), n = this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)), i = this.t.redMul(this.curve.dd).redMul(e.t), s = this.z.redMul(e.z.redAdd(e.z)), o = n.redSub(r), a = s.redSub(i), u = s.redAdd(i), l = n.redAdd(r), d = o.redMul(a), p = u.redMul(l), w = o.redMul(l), _ = a.redMul(u); + return this.curve.point(d, p, _, w); }; Hr.prototype._projAdd = function(e) { var r = this.z.redMul(e.z), n = r.redSqr(), i = this.x.redMul(e.x), s = this.y.redMul(e.y), o = this.curve.d.redMul(i).redMul(s), a = n.redSub(o), u = n.redAdd(o), l = this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s), d = r.redMul(a).redMul(l), p, w; @@ -15224,11 +15736,11 @@ Hr.prototype.toP = Hr.prototype.normalize; Hr.prototype.mixedAdd = Hr.prototype.add; (function(t) { var e = t; - e.base = G0, e.short = aq, e.mont = uq, e.edwards = hq; -})(tb); -var X0 = {}, cm, Rx; -function dq() { - return Rx || (Rx = 1, cm = { + e.base = cp, e.short = jq, e.mont = qq, e.edwards = Hq; +})(gb); +var lp = {}, _m, Vx; +function Kq() { + return Vx || (Vx = 1, _m = { doubles: { step: 4, points: [ @@ -16007,10 +16519,10 @@ function dq() { ] ] } - }), cm; + }), _m; } (function(t) { - var e = t, r = Vl, n = tb, i = Bi, s = i.assert; + var e = t, r = rh, n = gb, i = ji, s = i.assert; function o(l) { l.type === "short" ? this.curve = new n.short(l) : l.type === "edwards" ? this.curve = new n.edwards(l) : this.curve = new n.mont(l), this.g = this.curve.g, this.n = this.curve.n, this.hash = l.hash, s(this.g.validate(), "Invalid curve"), s(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); } @@ -16125,7 +16637,7 @@ function dq() { }); var u; try { - u = dq(); + u = Kq(); } catch { u = void 0; } @@ -16158,108 +16670,108 @@ function dq() { u ] }); -})(X0); -var pq = Vl, oc = Qv, P8 = wc; -function ya(t) { - if (!(this instanceof ya)) - return new ya(t); +})(lp); +var Vq = rh, dc = db, eE = Tc; +function Aa(t) { + if (!(this instanceof Aa)) + return new Aa(t); this.hash = t.hash, this.predResist = !!t.predResist, this.outLen = this.hash.outSize, this.minEntropy = t.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null; - var e = oc.toArray(t.entropy, t.entropyEnc || "hex"), r = oc.toArray(t.nonce, t.nonceEnc || "hex"), n = oc.toArray(t.pers, t.persEnc || "hex"); - P8( + var e = dc.toArray(t.entropy, t.entropyEnc || "hex"), r = dc.toArray(t.nonce, t.nonceEnc || "hex"), n = dc.toArray(t.pers, t.persEnc || "hex"); + eE( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._init(e, r, n); } -var gq = ya; -ya.prototype._init = function(e, r, n) { +var Gq = Aa; +Aa.prototype._init = function(e, r, n) { var i = e.concat(r).concat(n); this.K = new Array(this.outLen / 8), this.V = new Array(this.outLen / 8); for (var s = 0; s < this.V.length; s++) this.K[s] = 0, this.V[s] = 1; this._update(i), this._reseed = 1, this.reseedInterval = 281474976710656; }; -ya.prototype._hmac = function() { - return new pq.hmac(this.hash, this.K); +Aa.prototype._hmac = function() { + return new Vq.hmac(this.hash, this.K); }; -ya.prototype._update = function(e) { +Aa.prototype._update = function(e) { var r = this._hmac().update(this.V).update([0]); e && (r = r.update(e)), this.K = r.digest(), this.V = this._hmac().update(this.V).digest(), e && (this.K = this._hmac().update(this.V).update([1]).update(e).digest(), this.V = this._hmac().update(this.V).digest()); }; -ya.prototype.reseed = function(e, r, n, i) { - typeof r != "string" && (i = n, n = r, r = null), e = oc.toArray(e, r), n = oc.toArray(n, i), P8( +Aa.prototype.reseed = function(e, r, n, i) { + typeof r != "string" && (i = n, n = r, r = null), e = dc.toArray(e, r), n = dc.toArray(n, i), eE( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._update(e.concat(n || [])), this._reseed = 1; }; -ya.prototype.generate = function(e, r, n, i) { +Aa.prototype.generate = function(e, r, n, i) { if (this._reseed > this.reseedInterval) throw new Error("Reseed is required"); - typeof r != "string" && (i = n, n = r, r = null), n && (n = oc.toArray(n, i || "hex"), this._update(n)); + typeof r != "string" && (i = n, n = r, r = null), n && (n = dc.toArray(n, i || "hex"), this._update(n)); for (var s = []; s.length < e; ) this.V = this._hmac().update(this.V).digest(), s = s.concat(this.V); var o = s.slice(0, e); - return this._update(n), this._reseed++, oc.encode(o, r); + return this._update(n), this._reseed++, dc.encode(o, r); }; -var mq = zo, vq = Bi, P1 = vq.assert; -function ei(t, e) { +var Yq = Ho, Jq = ji, q1 = Jq.assert; +function ti(t, e) { this.ec = t, this.priv = null, this.pub = null, e.priv && this._importPrivate(e.priv, e.privEnc), e.pub && this._importPublic(e.pub, e.pubEnc); } -var bq = ei; -ei.fromPublic = function(e, r, n) { - return r instanceof ei ? r : new ei(e, { +var Xq = ti; +ti.fromPublic = function(e, r, n) { + return r instanceof ti ? r : new ti(e, { pub: r, pubEnc: n }); }; -ei.fromPrivate = function(e, r, n) { - return r instanceof ei ? r : new ei(e, { +ti.fromPrivate = function(e, r, n) { + return r instanceof ti ? r : new ti(e, { priv: r, privEnc: n }); }; -ei.prototype.validate = function() { +ti.prototype.validate = function() { var e = this.getPublic(); return e.isInfinity() ? { result: !1, reason: "Invalid public key" } : e.validate() ? e.mul(this.ec.curve.n).isInfinity() ? { result: !0, reason: null } : { result: !1, reason: "Public key * N != O" } : { result: !1, reason: "Public key is not a point" }; }; -ei.prototype.getPublic = function(e, r) { +ti.prototype.getPublic = function(e, r) { return typeof e == "string" && (r = e, e = null), this.pub || (this.pub = this.ec.g.mul(this.priv)), r ? this.pub.encode(r, e) : this.pub; }; -ei.prototype.getPrivate = function(e) { +ti.prototype.getPrivate = function(e) { return e === "hex" ? this.priv.toString(16, 2) : this.priv; }; -ei.prototype._importPrivate = function(e, r) { - this.priv = new mq(e, r || 16), this.priv = this.priv.umod(this.ec.curve.n); +ti.prototype._importPrivate = function(e, r) { + this.priv = new Yq(e, r || 16), this.priv = this.priv.umod(this.ec.curve.n); }; -ei.prototype._importPublic = function(e, r) { +ti.prototype._importPublic = function(e, r) { if (e.x || e.y) { - this.ec.curve.type === "mont" ? P1(e.x, "Need x coordinate") : (this.ec.curve.type === "short" || this.ec.curve.type === "edwards") && P1(e.x && e.y, "Need both x and y coordinate"), this.pub = this.ec.curve.point(e.x, e.y); + this.ec.curve.type === "mont" ? q1(e.x, "Need x coordinate") : (this.ec.curve.type === "short" || this.ec.curve.type === "edwards") && q1(e.x && e.y, "Need both x and y coordinate"), this.pub = this.ec.curve.point(e.x, e.y); return; } this.pub = this.ec.curve.decodePoint(e, r); }; -ei.prototype.derive = function(e) { - return e.validate() || P1(e.validate(), "public point not validated"), e.mul(this.priv).getX(); +ti.prototype.derive = function(e) { + return e.validate() || q1(e.validate(), "public point not validated"), e.mul(this.priv).getX(); }; -ei.prototype.sign = function(e, r, n) { +ti.prototype.sign = function(e, r, n) { return this.ec.sign(e, this, r, n); }; -ei.prototype.verify = function(e, r, n) { +ti.prototype.verify = function(e, r, n) { return this.ec.verify(e, r, this, void 0, n); }; -ei.prototype.inspect = function() { +ti.prototype.inspect = function() { return ""; }; -var a0 = zo, nb = Bi, yq = nb.assert; -function Z0(t, e) { - if (t instanceof Z0) +var y0 = Ho, vb = ji, Zq = vb.assert; +function hp(t, e) { + if (t instanceof hp) return t; - this._importDER(t, e) || (yq(t.r && t.s, "Signature without r or s"), this.r = new a0(t.r, 16), this.s = new a0(t.s, 16), t.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = t.recoveryParam); + this._importDER(t, e) || (Zq(t.r && t.s, "Signature without r or s"), this.r = new y0(t.r, 16), this.s = new y0(t.s, 16), t.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = t.recoveryParam); } -var wq = Z0; -function xq() { +var Qq = hp; +function ez() { this.place = 0; } -function um(t, e) { +function Em(t, e) { var r = t[e.place++]; if (!(r & 128)) return r; @@ -16270,26 +16782,26 @@ function um(t, e) { i <<= 8, i |= t[o], i >>>= 0; return i <= 127 ? !1 : (e.place = o, i); } -function Dx(t) { +function Gx(t) { for (var e = 0, r = t.length - 1; !t[e] && !(t[e + 1] & 128) && e < r; ) e++; return e === 0 ? t : t.slice(e); } -Z0.prototype._importDER = function(e, r) { - e = nb.toArray(e, r); - var n = new xq(); +hp.prototype._importDER = function(e, r) { + e = vb.toArray(e, r); + var n = new ez(); if (e[n.place++] !== 48) return !1; - var i = um(e, n); + var i = Em(e, n); if (i === !1 || i + n.place !== e.length || e[n.place++] !== 2) return !1; - var s = um(e, n); + var s = Em(e, n); if (s === !1 || e[n.place] & 128) return !1; var o = e.slice(n.place, s + n.place); if (n.place += s, e[n.place++] !== 2) return !1; - var a = um(e, n); + var a = Em(e, n); if (a === !1 || e.length !== a + n.place || e[n.place] & 128) return !1; var u = e.slice(n.place, a + n.place); @@ -16303,9 +16815,9 @@ Z0.prototype._importDER = function(e, r) { u = u.slice(1); else return !1; - return this.r = new a0(o), this.s = new a0(u), this.recoveryParam = null, !0; + return this.r = new y0(o), this.s = new y0(u), this.recoveryParam = null, !0; }; -function fm(t, e) { +function Sm(t, e) { if (e < 128) { t.push(e); return; @@ -16315,107 +16827,107 @@ function fm(t, e) { t.push(e >>> (r << 3) & 255); t.push(e); } -Z0.prototype.toDER = function(e) { +hp.prototype.toDER = function(e) { var r = this.r.toArray(), n = this.s.toArray(); - for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Dx(r), n = Dx(n); !n[0] && !(n[1] & 128); ) + for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Gx(r), n = Gx(n); !n[0] && !(n[1] & 128); ) n = n.slice(1); var i = [2]; - fm(i, r.length), i = i.concat(r), i.push(2), fm(i, n.length); + Sm(i, r.length), i = i.concat(r), i.push(2), Sm(i, n.length); var s = i.concat(n), o = [48]; - return fm(o, s.length), o = o.concat(s), nb.encode(o, e); -}; -var Ao = zo, M8 = gq, _q = Bi, lm = X0, Eq = E8, I8 = _q.assert, ib = bq, Q0 = wq; -function es(t) { - if (!(this instanceof es)) - return new es(t); - typeof t == "string" && (I8( - Object.prototype.hasOwnProperty.call(lm, t), + return Sm(o, s.length), o = o.concat(s), vb.encode(o, e); +}; +var Co = Ho, tE = Gq, tz = ji, Am = lp, rz = X8, rE = tz.assert, bb = Xq, dp = Qq; +function rs(t) { + if (!(this instanceof rs)) + return new rs(t); + typeof t == "string" && (rE( + Object.prototype.hasOwnProperty.call(Am, t), "Unknown curve " + t - ), t = lm[t]), t instanceof lm.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; + ), t = Am[t]), t instanceof Am.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; } -var Sq = es; -es.prototype.keyPair = function(e) { - return new ib(this, e); +var nz = rs; +rs.prototype.keyPair = function(e) { + return new bb(this, e); }; -es.prototype.keyFromPrivate = function(e, r) { - return ib.fromPrivate(this, e, r); +rs.prototype.keyFromPrivate = function(e, r) { + return bb.fromPrivate(this, e, r); }; -es.prototype.keyFromPublic = function(e, r) { - return ib.fromPublic(this, e, r); +rs.prototype.keyFromPublic = function(e, r) { + return bb.fromPublic(this, e, r); }; -es.prototype.genKeyPair = function(e) { +rs.prototype.genKeyPair = function(e) { e || (e = {}); - for (var r = new M8({ + for (var r = new tE({ hash: this.hash, pers: e.pers, persEnc: e.persEnc || "utf8", - entropy: e.entropy || Eq(this.hash.hmacStrength), + entropy: e.entropy || rz(this.hash.hmacStrength), entropyEnc: e.entropy && e.entropyEnc || "utf8", nonce: this.n.toArray() - }), n = this.n.byteLength(), i = this.n.sub(new Ao(2)); ; ) { - var s = new Ao(r.generate(n)); + }), n = this.n.byteLength(), i = this.n.sub(new Co(2)); ; ) { + var s = new Co(r.generate(n)); if (!(s.cmp(i) > 0)) return s.iaddn(1), this.keyFromPrivate(s); } }; -es.prototype._truncateToN = function(e, r, n) { +rs.prototype._truncateToN = function(e, r, n) { var i; - if (Ao.isBN(e) || typeof e == "number") - e = new Ao(e, 16), i = e.byteLength(); + if (Co.isBN(e) || typeof e == "number") + e = new Co(e, 16), i = e.byteLength(); else if (typeof e == "object") - i = e.length, e = new Ao(e, 16); + i = e.length, e = new Co(e, 16); else { var s = e.toString(); - i = s.length + 1 >>> 1, e = new Ao(s, 16); + i = s.length + 1 >>> 1, e = new Co(s, 16); } typeof n != "number" && (n = i * 8); var o = n - this.n.bitLength(); return o > 0 && (e = e.ushrn(o)), !r && e.cmp(this.n) >= 0 ? e.sub(this.n) : e; }; -es.prototype.sign = function(e, r, n, i) { +rs.prototype.sign = function(e, r, n, i) { typeof n == "object" && (i = n, n = null), i || (i = {}), r = this.keyFromPrivate(r, n), e = this._truncateToN(e, !1, i.msgBitLength); - for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new M8({ + for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new tE({ hash: this.hash, entropy: o, nonce: a, pers: i.pers, persEnc: i.persEnc || "utf8" - }), l = this.n.sub(new Ao(1)), d = 0; ; d++) { - var p = i.k ? i.k(d) : new Ao(u.generate(this.n.byteLength())); + }), l = this.n.sub(new Co(1)), d = 0; ; d++) { + var p = i.k ? i.k(d) : new Co(u.generate(this.n.byteLength())); if (p = this._truncateToN(p, !0), !(p.cmpn(1) <= 0 || p.cmp(l) >= 0)) { var w = this.g.mul(p); if (!w.isInfinity()) { - var A = w.getX(), M = A.umod(this.n); - if (M.cmpn(0) !== 0) { - var N = p.invm(this.n).mul(M.mul(r.getPrivate()).iadd(e)); - if (N = N.umod(this.n), N.cmpn(0) !== 0) { - var L = (w.getY().isOdd() ? 1 : 0) | (A.cmp(M) !== 0 ? 2 : 0); - return i.canonical && N.cmp(this.nh) > 0 && (N = this.n.sub(N), L ^= 1), new Q0({ r: M, s: N, recoveryParam: L }); + var _ = w.getX(), P = _.umod(this.n); + if (P.cmpn(0) !== 0) { + var O = p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e)); + if (O = O.umod(this.n), O.cmpn(0) !== 0) { + var L = (w.getY().isOdd() ? 1 : 0) | (_.cmp(P) !== 0 ? 2 : 0); + return i.canonical && O.cmp(this.nh) > 0 && (O = this.n.sub(O), L ^= 1), new dp({ r: P, s: O, recoveryParam: L }); } } } } } }; -es.prototype.verify = function(e, r, n, i, s) { - s || (s = {}), e = this._truncateToN(e, !1, s.msgBitLength), n = this.keyFromPublic(n, i), r = new Q0(r, "hex"); +rs.prototype.verify = function(e, r, n, i, s) { + s || (s = {}), e = this._truncateToN(e, !1, s.msgBitLength), n = this.keyFromPublic(n, i), r = new dp(r, "hex"); var o = r.r, a = r.s; if (o.cmpn(1) < 0 || o.cmp(this.n) >= 0 || a.cmpn(1) < 0 || a.cmp(this.n) >= 0) return !1; var u = a.invm(this.n), l = u.mul(e).umod(this.n), d = u.mul(o).umod(this.n), p; return this.curve._maxwellTrick ? (p = this.g.jmulAdd(l, n.getPublic(), d), p.isInfinity() ? !1 : p.eqXToP(o)) : (p = this.g.mulAdd(l, n.getPublic(), d), p.isInfinity() ? !1 : p.getX().umod(this.n).cmp(o) === 0); }; -es.prototype.recoverPubKey = function(t, e, r, n) { - I8((3 & r) === r, "The recovery param is more than two bits"), e = new Q0(e, n); - var i = this.n, s = new Ao(t), o = e.r, a = e.s, u = r & 1, l = r >> 1; +rs.prototype.recoverPubKey = function(t, e, r, n) { + rE((3 & r) === r, "The recovery param is more than two bits"), e = new dp(e, n); + var i = this.n, s = new Co(t), o = e.r, a = e.s, u = r & 1, l = r >> 1; if (o.cmp(this.curve.p.umod(this.curve.n)) >= 0 && l) throw new Error("Unable to find sencond key candinate"); l ? o = this.curve.pointFromX(o.add(this.curve.n), u) : o = this.curve.pointFromX(o, u); var d = e.r.invm(i), p = i.sub(s).mul(d).umod(i), w = a.mul(d).umod(i); return this.g.mulAdd(p, o, w); }; -es.prototype.getKeyRecoveryParam = function(t, e, r, n) { - if (e = new Q0(e, n), e.recoveryParam !== null) +rs.prototype.getKeyRecoveryParam = function(t, e, r, n) { + if (e = new dp(e, n), e.recoveryParam !== null) return e.recoveryParam; for (var i = 0; i < 4; i++) { var s; @@ -16429,9 +16941,9 @@ es.prototype.getKeyRecoveryParam = function(t, e, r, n) { } throw new Error("Unable to find valid recovery factor"); }; -var Xl = Bi, C8 = Xl.assert, Ox = Xl.parseBytes, Uu = Xl.cachedProperty; +var oh = ji, nE = oh.assert, Yx = oh.parseBytes, Gu = oh.cachedProperty; function Nn(t, e) { - this.eddsa = t, this._secret = Ox(e.secret), t.isPoint(e.pub) ? this._pub = e.pub : this._pubBytes = Ox(e.pub); + this.eddsa = t, this._secret = Yx(e.secret), t.isPoint(e.pub) ? this._pub = e.pub : this._pubBytes = Yx(e.pub); } Nn.fromPublic = function(e, r) { return r instanceof Nn ? r : new Nn(e, { pub: r }); @@ -16442,191 +16954,191 @@ Nn.fromSecret = function(e, r) { Nn.prototype.secret = function() { return this._secret; }; -Uu(Nn, "pubBytes", function() { +Gu(Nn, "pubBytes", function() { return this.eddsa.encodePoint(this.pub()); }); -Uu(Nn, "pub", function() { +Gu(Nn, "pub", function() { return this._pubBytes ? this.eddsa.decodePoint(this._pubBytes) : this.eddsa.g.mul(this.priv()); }); -Uu(Nn, "privBytes", function() { +Gu(Nn, "privBytes", function() { var e = this.eddsa, r = this.hash(), n = e.encodingLength - 1, i = r.slice(0, e.encodingLength); return i[0] &= 248, i[n] &= 127, i[n] |= 64, i; }); -Uu(Nn, "priv", function() { +Gu(Nn, "priv", function() { return this.eddsa.decodeInt(this.privBytes()); }); -Uu(Nn, "hash", function() { +Gu(Nn, "hash", function() { return this.eddsa.hash().update(this.secret()).digest(); }); -Uu(Nn, "messagePrefix", function() { +Gu(Nn, "messagePrefix", function() { return this.hash().slice(this.eddsa.encodingLength); }); Nn.prototype.sign = function(e) { - return C8(this._secret, "KeyPair can only verify"), this.eddsa.sign(e, this); + return nE(this._secret, "KeyPair can only verify"), this.eddsa.sign(e, this); }; Nn.prototype.verify = function(e, r) { return this.eddsa.verify(e, r, this); }; Nn.prototype.getSecret = function(e) { - return C8(this._secret, "KeyPair is public only"), Xl.encode(this.secret(), e); + return nE(this._secret, "KeyPair is public only"), oh.encode(this.secret(), e); }; Nn.prototype.getPublic = function(e) { - return Xl.encode(this.pubBytes(), e); + return oh.encode(this.pubBytes(), e); }; -var Aq = Nn, Pq = zo, ep = Bi, Nx = ep.assert, tp = ep.cachedProperty, Mq = ep.parseBytes; -function _c(t, e) { - this.eddsa = t, typeof e != "object" && (e = Mq(e)), Array.isArray(e) && (Nx(e.length === t.encodingLength * 2, "Signature has invalid size"), e = { +var iz = Nn, sz = Ho, pp = ji, Jx = pp.assert, gp = pp.cachedProperty, oz = pp.parseBytes; +function Dc(t, e) { + this.eddsa = t, typeof e != "object" && (e = oz(e)), Array.isArray(e) && (Jx(e.length === t.encodingLength * 2, "Signature has invalid size"), e = { R: e.slice(0, t.encodingLength), S: e.slice(t.encodingLength) - }), Nx(e.R && e.S, "Signature without R or S"), t.isPoint(e.R) && (this._R = e.R), e.S instanceof Pq && (this._S = e.S), this._Rencoded = Array.isArray(e.R) ? e.R : e.Rencoded, this._Sencoded = Array.isArray(e.S) ? e.S : e.Sencoded; + }), Jx(e.R && e.S, "Signature without R or S"), t.isPoint(e.R) && (this._R = e.R), e.S instanceof sz && (this._S = e.S), this._Rencoded = Array.isArray(e.R) ? e.R : e.Rencoded, this._Sencoded = Array.isArray(e.S) ? e.S : e.Sencoded; } -tp(_c, "S", function() { +gp(Dc, "S", function() { return this.eddsa.decodeInt(this.Sencoded()); }); -tp(_c, "R", function() { +gp(Dc, "R", function() { return this.eddsa.decodePoint(this.Rencoded()); }); -tp(_c, "Rencoded", function() { +gp(Dc, "Rencoded", function() { return this.eddsa.encodePoint(this.R()); }); -tp(_c, "Sencoded", function() { +gp(Dc, "Sencoded", function() { return this.eddsa.encodeInt(this.S()); }); -_c.prototype.toBytes = function() { +Dc.prototype.toBytes = function() { return this.Rencoded().concat(this.Sencoded()); }; -_c.prototype.toHex = function() { - return ep.encode(this.toBytes(), "hex").toUpperCase(); +Dc.prototype.toHex = function() { + return pp.encode(this.toBytes(), "hex").toUpperCase(); }; -var Iq = _c, Cq = Vl, Tq = X0, Au = Bi, Rq = Au.assert, T8 = Au.parseBytes, R8 = Aq, Lx = Iq; -function Ei(t) { - if (Rq(t === "ed25519", "only tested with ed25519 so far"), !(this instanceof Ei)) - return new Ei(t); - t = Tq[t].curve, this.curve = t, this.g = t.g, this.g.precompute(t.n.bitLength() + 1), this.pointClass = t.point().constructor, this.encodingLength = Math.ceil(t.n.bitLength() / 8), this.hash = Cq.sha512; +var az = Dc, cz = rh, uz = lp, Nu = ji, fz = Nu.assert, iE = Nu.parseBytes, sE = iz, Xx = az; +function Si(t) { + if (fz(t === "ed25519", "only tested with ed25519 so far"), !(this instanceof Si)) + return new Si(t); + t = uz[t].curve, this.curve = t, this.g = t.g, this.g.precompute(t.n.bitLength() + 1), this.pointClass = t.point().constructor, this.encodingLength = Math.ceil(t.n.bitLength() / 8), this.hash = cz.sha512; } -var Dq = Ei; -Ei.prototype.sign = function(e, r) { - e = T8(e); +var lz = Si; +Si.prototype.sign = function(e, r) { + e = iE(e); var n = this.keyFromSecret(r), i = this.hashInt(n.messagePrefix(), e), s = this.g.mul(i), o = this.encodePoint(s), a = this.hashInt(o, n.pubBytes(), e).mul(n.priv()), u = i.add(a).umod(this.curve.n); return this.makeSignature({ R: s, S: u, Rencoded: o }); }; -Ei.prototype.verify = function(e, r, n) { - if (e = T8(e), r = this.makeSignature(r), r.S().gte(r.eddsa.curve.n) || r.S().isNeg()) +Si.prototype.verify = function(e, r, n) { + if (e = iE(e), r = this.makeSignature(r), r.S().gte(r.eddsa.curve.n) || r.S().isNeg()) return !1; var i = this.keyFromPublic(n), s = this.hashInt(r.Rencoded(), i.pubBytes(), e), o = this.g.mul(r.S()), a = r.R().add(i.pub().mul(s)); return a.eq(o); }; -Ei.prototype.hashInt = function() { +Si.prototype.hashInt = function() { for (var e = this.hash(), r = 0; r < arguments.length; r++) e.update(arguments[r]); - return Au.intFromLE(e.digest()).umod(this.curve.n); + return Nu.intFromLE(e.digest()).umod(this.curve.n); }; -Ei.prototype.keyFromPublic = function(e) { - return R8.fromPublic(this, e); +Si.prototype.keyFromPublic = function(e) { + return sE.fromPublic(this, e); }; -Ei.prototype.keyFromSecret = function(e) { - return R8.fromSecret(this, e); +Si.prototype.keyFromSecret = function(e) { + return sE.fromSecret(this, e); }; -Ei.prototype.makeSignature = function(e) { - return e instanceof Lx ? e : new Lx(this, e); +Si.prototype.makeSignature = function(e) { + return e instanceof Xx ? e : new Xx(this, e); }; -Ei.prototype.encodePoint = function(e) { +Si.prototype.encodePoint = function(e) { var r = e.getY().toArray("le", this.encodingLength); return r[this.encodingLength - 1] |= e.getX().isOdd() ? 128 : 0, r; }; -Ei.prototype.decodePoint = function(e) { - e = Au.parseBytes(e); - var r = e.length - 1, n = e.slice(0, r).concat(e[r] & -129), i = (e[r] & 128) !== 0, s = Au.intFromLE(n); +Si.prototype.decodePoint = function(e) { + e = Nu.parseBytes(e); + var r = e.length - 1, n = e.slice(0, r).concat(e[r] & -129), i = (e[r] & 128) !== 0, s = Nu.intFromLE(n); return this.curve.pointFromY(s, i); }; -Ei.prototype.encodeInt = function(e) { +Si.prototype.encodeInt = function(e) { return e.toArray("le", this.encodingLength); }; -Ei.prototype.decodeInt = function(e) { - return Au.intFromLE(e); +Si.prototype.decodeInt = function(e) { + return Nu.intFromLE(e); }; -Ei.prototype.isPoint = function(e) { +Si.prototype.isPoint = function(e) { return e instanceof this.pointClass; }; (function(t) { var e = t; - e.version = nq.version, e.utils = Bi, e.rand = E8, e.curve = tb, e.curves = X0, e.ec = Sq, e.eddsa = Dq; -})(_8); -const Oq = { waku: { publish: "waku_publish", batchPublish: "waku_batchPublish", subscribe: "waku_subscribe", batchSubscribe: "waku_batchSubscribe", subscription: "waku_subscription", unsubscribe: "waku_unsubscribe", batchUnsubscribe: "waku_batchUnsubscribe", batchFetchMessages: "waku_batchFetchMessages" }, irn: { publish: "irn_publish", batchPublish: "irn_batchPublish", subscribe: "irn_subscribe", batchSubscribe: "irn_batchSubscribe", subscription: "irn_subscription", unsubscribe: "irn_unsubscribe", batchUnsubscribe: "irn_batchUnsubscribe", batchFetchMessages: "irn_batchFetchMessages" }, iridium: { publish: "iridium_publish", batchPublish: "iridium_batchPublish", subscribe: "iridium_subscribe", batchSubscribe: "iridium_batchSubscribe", subscription: "iridium_subscription", unsubscribe: "iridium_unsubscribe", batchUnsubscribe: "iridium_batchUnsubscribe", batchFetchMessages: "iridium_batchFetchMessages" } }, Nq = ":"; -function hu(t) { - const [e, r] = t.split(Nq); + e.version = kq.version, e.utils = ji, e.rand = X8, e.curve = gb, e.curves = lp, e.ec = nz, e.eddsa = lz; +})(J8); +const hz = { waku: { publish: "waku_publish", batchPublish: "waku_batchPublish", subscribe: "waku_subscribe", batchSubscribe: "waku_batchSubscribe", subscription: "waku_subscription", unsubscribe: "waku_unsubscribe", batchUnsubscribe: "waku_batchUnsubscribe", batchFetchMessages: "waku_batchFetchMessages" }, irn: { publish: "irn_publish", batchPublish: "irn_batchPublish", subscribe: "irn_subscribe", batchSubscribe: "irn_batchSubscribe", subscription: "irn_subscription", unsubscribe: "irn_unsubscribe", batchUnsubscribe: "irn_batchUnsubscribe", batchFetchMessages: "irn_batchFetchMessages" }, iridium: { publish: "iridium_publish", batchPublish: "iridium_batchPublish", subscribe: "iridium_subscribe", batchSubscribe: "iridium_batchSubscribe", subscription: "iridium_subscription", unsubscribe: "iridium_unsubscribe", batchUnsubscribe: "iridium_batchUnsubscribe", batchFetchMessages: "iridium_batchFetchMessages" } }, dz = ":"; +function _u(t) { + const [e, r] = t.split(dz); return { namespace: e, reference: r }; } -function D8(t, e) { +function oE(t, e) { return t.includes(":") ? [t] : e.chains || []; } -var Lq = Object.defineProperty, kx = Object.getOwnPropertySymbols, kq = Object.prototype.hasOwnProperty, $q = Object.prototype.propertyIsEnumerable, $x = (t, e, r) => e in t ? Lq(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Bx = (t, e) => { - for (var r in e || (e = {})) kq.call(e, r) && $x(t, r, e[r]); - if (kx) for (var r of kx(e)) $q.call(e, r) && $x(t, r, e[r]); +var pz = Object.defineProperty, Zx = Object.getOwnPropertySymbols, gz = Object.prototype.hasOwnProperty, mz = Object.prototype.propertyIsEnumerable, Qx = (t, e, r) => e in t ? pz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, e3 = (t, e) => { + for (var r in e || (e = {})) gz.call(e, r) && Qx(t, r, e[r]); + if (Zx) for (var r of Zx(e)) mz.call(e, r) && Qx(t, r, e[r]); return t; }; -const Bq = "ReactNative", Di = { reactNative: "react-native", node: "node", browser: "browser", unknown: "unknown" }, Fq = "js"; -function c0() { +const vz = "ReactNative", Oi = { reactNative: "react-native", node: "node", browser: "browser", unknown: "unknown" }, bz = "js"; +function w0() { return typeof process < "u" && typeof process.versions < "u" && typeof process.versions.node < "u"; } -function qu() { - return !Kl() && !!jv() && navigator.product === Bq; +function Yu() { + return !th() && !!eb() && navigator.product === vz; } -function Zl() { - return !c0() && !!jv() && !!Kl(); +function ah() { + return !w0() && !!eb() && !!th(); } -function Ql() { - return qu() ? Di.reactNative : c0() ? Di.node : Zl() ? Di.browser : Di.unknown; +function ch() { + return Yu() ? Oi.reactNative : w0() ? Oi.node : ah() ? Oi.browser : Oi.unknown; } -function jq() { +function yz() { var t; try { - return qu() && typeof global < "u" && typeof (global == null ? void 0 : global.Application) < "u" ? (t = global.Application) == null ? void 0 : t.applicationId : void 0; + return Yu() && typeof global < "u" && typeof (global == null ? void 0 : global.Application) < "u" ? (t = global.Application) == null ? void 0 : t.applicationId : void 0; } catch { return; } } -function Uq(t, e) { - let r = xl.parse(t); - return r = Bx(Bx({}, r), e), t = xl.stringify(r), t; +function wz(t, e) { + let r = Dl.parse(t); + return r = e3(e3({}, r), e), t = Dl.stringify(r), t; } -function O8() { - return z4() || { name: "", description: "", url: "", icons: [""] }; +function aE() { + return v8() || { name: "", description: "", url: "", icons: [""] }; } -function qq() { - if (Ql() === Di.reactNative && typeof global < "u" && typeof (global == null ? void 0 : global.Platform) < "u") { +function xz() { + if (ch() === Oi.reactNative && typeof global < "u" && typeof (global == null ? void 0 : global.Platform) < "u") { const { OS: r, Version: n } = global.Platform; return [r, n].join("-"); } - const t = eF(); + const t = OF(); if (t === null) return "unknown"; const e = t.os ? t.os.replace(" ", "").toLowerCase() : "unknown"; return t.type === "browser" ? [e, t.name, t.version].join("-") : [e, t.version].join("-"); } -function zq() { +function _z() { var t; - const e = Ql(); - return e === Di.browser ? [e, ((t = q4()) == null ? void 0 : t.host) || "unknown"].join(":") : e; + const e = ch(); + return e === Oi.browser ? [e, ((t = m8()) == null ? void 0 : t.host) || "unknown"].join(":") : e; } -function N8(t, e, r) { - const n = qq(), i = zq(); - return [[t, e].join("-"), [Fq, r].join("-"), n, i].join("/"); +function cE(t, e, r) { + const n = xz(), i = _z(); + return [[t, e].join("-"), [bz, r].join("-"), n, i].join("/"); } -function Wq({ protocol: t, version: e, relayUrl: r, sdkVersion: n, auth: i, projectId: s, useOnCloseEvent: o, bundleId: a }) { - const u = r.split("?"), l = N8(t, e, n), d = { auth: i, ua: l, projectId: s, useOnCloseEvent: o, origin: a || void 0 }, p = Uq(u[1] || "", d); +function Ez({ protocol: t, version: e, relayUrl: r, sdkVersion: n, auth: i, projectId: s, useOnCloseEvent: o, bundleId: a }) { + const u = r.split("?"), l = cE(t, e, n), d = { auth: i, ua: l, projectId: s, useOnCloseEvent: o, origin: a || void 0 }, p = wz(u[1] || "", d); return u[0] + "?" + p; } -function rc(t, e) { +function uc(t, e) { return t.filter((r) => e.includes(r)).length === t.length; } -function L8(t) { +function uE(t) { return Object.fromEntries(t.entries()); } -function k8(t) { +function fE(t) { return new Map(Object.entries(t)); } -function Ga(t = mt.FIVE_MINUTES, e) { - const r = mt.toMiliseconds(t || mt.FIVE_MINUTES); +function ec(t = vt.FIVE_MINUTES, e) { + const r = vt.toMiliseconds(t || vt.FIVE_MINUTES); let n, i, s; return { resolve: (o) => { s && n && (clearTimeout(s), n(o)); @@ -16638,7 +17150,7 @@ function Ga(t = mt.FIVE_MINUTES, e) { }, r), n = o, i = a; }) }; } -function du(t, e, r) { +function Eu(t, e, r) { return new Promise(async (n, i) => { const s = setTimeout(() => i(new Error(r)), e); try { @@ -16650,7 +17162,7 @@ function du(t, e, r) { clearTimeout(s); }); } -function $8(t, e) { +function lE(t, e) { if (typeof e == "string" && e.startsWith(`${t}:`)) return e; if (t.toLowerCase() === "topic") { if (typeof e != "string") throw new Error('Value must be "string" for expirer target type: topic'); @@ -16661,159 +17173,159 @@ function $8(t, e) { } throw new Error(`Unknown expirer target type: ${t}`); } -function Hq(t) { - return $8("topic", t); +function Sz(t) { + return lE("topic", t); } -function Kq(t) { - return $8("id", t); +function Az(t) { + return lE("id", t); } -function B8(t) { +function hE(t) { const [e, r] = t.split(":"), n = { id: void 0, topic: void 0 }; if (e === "topic" && typeof r == "string") n.topic = r; else if (e === "id" && Number.isInteger(Number(r))) n.id = Number(r); else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`); return n; } -function En(t, e) { - return mt.fromMiliseconds(Date.now() + mt.toMiliseconds(t)); +function Sn(t, e) { + return vt.fromMiliseconds(Date.now() + vt.toMiliseconds(t)); } -function ca(t) { - return Date.now() >= mt.toMiliseconds(t); +function fa(t) { + return Date.now() >= vt.toMiliseconds(t); } -function br(t, e) { +function yr(t, e) { return `${t}${e ? `:${e}` : ""}`; } -function Id(t = [], e = []) { +function jd(t = [], e = []) { return [.../* @__PURE__ */ new Set([...t, ...e])]; } -async function Vq({ id: t, topic: e, wcDeepLink: r }) { +async function Pz({ id: t, topic: e, wcDeepLink: r }) { var n; try { if (!r) return; const i = typeof r == "string" ? JSON.parse(r) : r, s = i == null ? void 0 : i.href; if (typeof s != "string") return; - const o = Gq(s, t, e), a = Ql(); - if (a === Di.browser) { - if (!((n = Kl()) != null && n.hasFocus())) { + const o = Mz(s, t, e), a = ch(); + if (a === Oi.browser) { + if (!((n = th()) != null && n.hasFocus())) { console.warn("Document does not have focus, skipping deeplink."); return; } - o.startsWith("https://") || o.startsWith("http://") ? window.open(o, "_blank", "noreferrer noopener") : window.open(o, Jq() ? "_blank" : "_self", "noreferrer noopener"); - } else a === Di.reactNative && typeof (global == null ? void 0 : global.Linking) < "u" && await global.Linking.openURL(o); + o.startsWith("https://") || o.startsWith("http://") ? window.open(o, "_blank", "noreferrer noopener") : window.open(o, Cz() ? "_blank" : "_self", "noreferrer noopener"); + } else a === Oi.reactNative && typeof (global == null ? void 0 : global.Linking) < "u" && await global.Linking.openURL(o); } catch (i) { console.error(i); } } -function Gq(t, e, r) { +function Mz(t, e, r) { const n = `requestId=${e}&sessionTopic=${r}`; t.endsWith("/") && (t = t.slice(0, -1)); let i = `${t}`; if (t.startsWith("https://t.me")) { const s = t.includes("?") ? "&startapp=" : "?startapp="; - i = `${i}${s}${Xq(n, !0)}`; + i = `${i}${s}${Tz(n, !0)}`; } else i = `${i}/wc?${n}`; return i; } -async function Yq(t, e) { +async function Iz(t, e) { let r = ""; try { - if (Zl() && (r = localStorage.getItem(e), r)) return r; + if (ah() && (r = localStorage.getItem(e), r)) return r; r = await t.getItem(e); } catch (n) { console.error(n); } return r; } -function Fx(t, e) { +function t3(t, e) { if (!t.includes(e)) return null; const r = t.split(/([&,?,=])/), n = r.indexOf(e); return r[n + 2]; } -function jx() { +function r3() { return typeof crypto < "u" && crypto != null && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu, (t) => { const e = Math.random() * 16 | 0; return (t === "x" ? e : e & 3 | 8).toString(16); }); } -function sb() { +function yb() { return typeof process < "u" && process.env.IS_VITEST === "true"; } -function Jq() { +function Cz() { return typeof window < "u" && (!!window.TelegramWebviewProxy || !!window.Telegram || !!window.TelegramWebviewProxyProto); } -function Xq(t, e = !1) { +function Tz(t, e = !1) { const r = Buffer.from(t).toString("base64"); return e ? r.replace(/[=]/g, "") : r; } -function F8(t) { +function dE(t) { return Buffer.from(t, "base64").toString("utf-8"); } -const Zq = "https://rpc.walletconnect.org/v1"; -async function Qq(t, e, r, n, i, s) { +const Rz = "https://rpc.walletconnect.org/v1"; +async function Dz(t, e, r, n, i, s) { switch (r.t) { case "eip191": - return ez(t, e, r.s); + return Oz(t, e, r.s); case "eip1271": - return await tz(t, e, r.s, n, i, s); + return await Nz(t, e, r.s, n, i, s); default: throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`); } } -function ez(t, e, r) { - return CU(G4(e), r).toLowerCase() === t.toLowerCase(); +function Oz(t, e, r) { + return cq(_8(e), r).toLowerCase() === t.toLowerCase(); } -async function tz(t, e, r, n, i, s) { - const o = hu(n); +async function Nz(t, e, r, n, i, s) { + const o = _u(n); if (!o.namespace || !o.reference) throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`); try { - const a = "0x1626ba7e", u = "0000000000000000000000000000000000000000000000000000000000000040", l = "0000000000000000000000000000000000000000000000000000000000000041", d = r.substring(2), p = G4(e).substring(2), w = a + p + u + l + d, A = await fetch(`${s || Zq}/?chainId=${n}&projectId=${i}`, { method: "POST", body: JSON.stringify({ id: rz(), jsonrpc: "2.0", method: "eth_call", params: [{ to: t, data: w }, "latest"] }) }), { result: M } = await A.json(); - return M ? M.slice(0, a.length).toLowerCase() === a.toLowerCase() : !1; + const a = "0x1626ba7e", u = "0000000000000000000000000000000000000000000000000000000000000040", l = "0000000000000000000000000000000000000000000000000000000000000041", d = r.substring(2), p = _8(e).substring(2), w = a + p + u + l + d, _ = await fetch(`${s || Rz}/?chainId=${n}&projectId=${i}`, { method: "POST", body: JSON.stringify({ id: Lz(), jsonrpc: "2.0", method: "eth_call", params: [{ to: t, data: w }, "latest"] }) }), { result: P } = await _.json(); + return P ? P.slice(0, a.length).toLowerCase() === a.toLowerCase() : !1; } catch (a) { return console.error("isValidEip1271Signature: ", a), !1; } } -function rz() { +function Lz() { return Date.now() + Math.floor(Math.random() * 1e3); } -var nz = Object.defineProperty, iz = Object.defineProperties, sz = Object.getOwnPropertyDescriptors, Ux = Object.getOwnPropertySymbols, oz = Object.prototype.hasOwnProperty, az = Object.prototype.propertyIsEnumerable, qx = (t, e, r) => e in t ? nz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, cz = (t, e) => { - for (var r in e || (e = {})) oz.call(e, r) && qx(t, r, e[r]); - if (Ux) for (var r of Ux(e)) az.call(e, r) && qx(t, r, e[r]); +var kz = Object.defineProperty, $z = Object.defineProperties, Bz = Object.getOwnPropertyDescriptors, n3 = Object.getOwnPropertySymbols, Fz = Object.prototype.hasOwnProperty, jz = Object.prototype.propertyIsEnumerable, i3 = (t, e, r) => e in t ? kz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Uz = (t, e) => { + for (var r in e || (e = {})) Fz.call(e, r) && i3(t, r, e[r]); + if (n3) for (var r of n3(e)) jz.call(e, r) && i3(t, r, e[r]); return t; -}, uz = (t, e) => iz(t, sz(e)); -const fz = "did:pkh:", ob = (t) => t == null ? void 0 : t.split(":"), lz = (t) => { - const e = t && ob(t); - if (e) return t.includes(fz) ? e[3] : e[1]; -}, M1 = (t) => { - const e = t && ob(t); +}, qz = (t, e) => $z(t, Bz(e)); +const zz = "did:pkh:", wb = (t) => t == null ? void 0 : t.split(":"), Wz = (t) => { + const e = t && wb(t); + if (e) return t.includes(zz) ? e[3] : e[1]; +}, z1 = (t) => { + const e = t && wb(t); if (e) return e[2] + ":" + e[3]; -}, u0 = (t) => { - const e = t && ob(t); +}, x0 = (t) => { + const e = t && wb(t); if (e) return e.pop(); }; -async function zx(t) { - const { cacao: e, projectId: r } = t, { s: n, p: i } = e, s = j8(i, i.iss), o = u0(i.iss); - return await Qq(o, s, n, M1(i.iss), r); +async function s3(t) { + const { cacao: e, projectId: r } = t, { s: n, p: i } = e, s = pE(i, i.iss), o = x0(i.iss); + return await Dz(o, s, n, z1(i.iss), r); } -const j8 = (t, e) => { - const r = `${t.domain} wants you to sign in with your Ethereum account:`, n = u0(e); +const pE = (t, e) => { + const r = `${t.domain} wants you to sign in with your Ethereum account:`, n = x0(e); if (!t.aud && !t.uri) throw new Error("Either `aud` or `uri` is required to construct the message"); let i = t.statement || void 0; - const s = `URI: ${t.aud || t.uri}`, o = `Version: ${t.version}`, a = `Chain ID: ${lz(e)}`, u = `Nonce: ${t.nonce}`, l = `Issued At: ${t.iat}`, d = t.exp ? `Expiration Time: ${t.exp}` : void 0, p = t.nbf ? `Not Before: ${t.nbf}` : void 0, w = t.requestId ? `Request ID: ${t.requestId}` : void 0, A = t.resources ? `Resources:${t.resources.map((N) => ` -- ${N}`).join("")}` : void 0, M = Cd(t.resources); - if (M) { - const N = _l(M); - i = wz(i, N); + const s = `URI: ${t.aud || t.uri}`, o = `Version: ${t.version}`, a = `Chain ID: ${Wz(e)}`, u = `Nonce: ${t.nonce}`, l = `Issued At: ${t.iat}`, d = t.exp ? `Expiration Time: ${t.exp}` : void 0, p = t.nbf ? `Not Before: ${t.nbf}` : void 0, w = t.requestId ? `Request ID: ${t.requestId}` : void 0, _ = t.resources ? `Resources:${t.resources.map((O) => ` +- ${O}`).join("")}` : void 0, P = Ud(t.resources); + if (P) { + const O = Ol(P); + i = Qz(i, O); } - return [r, n, "", i, "", s, o, a, u, l, d, p, w, A].filter((N) => N != null).join(` + return [r, n, "", i, "", s, o, a, u, l, d, p, w, _].filter((O) => O != null).join(` `); }; -function hz(t) { +function Hz(t) { return Buffer.from(JSON.stringify(t)).toString("base64"); } -function dz(t) { +function Kz(t) { return JSON.parse(Buffer.from(t, "base64").toString("utf-8")); } -function hc(t) { +function wc(t) { if (!t) throw new Error("No recap provided, value is undefined"); if (!t.att) throw new Error("No `att` property found"); const e = Object.keys(t.att); @@ -16833,45 +17345,45 @@ function hc(t) { }); }); } -function pz(t, e, r, n = {}) { - return r == null || r.sort((i, s) => i.localeCompare(s)), { att: { [t]: gz(e, r, n) } }; +function Vz(t, e, r, n = {}) { + return r == null || r.sort((i, s) => i.localeCompare(s)), { att: { [t]: Gz(e, r, n) } }; } -function gz(t, e, r = {}) { +function Gz(t, e, r = {}) { e = e == null ? void 0 : e.sort((i, s) => i.localeCompare(s)); const n = e.map((i) => ({ [`${t}/${i}`]: [r] })); return Object.assign({}, ...n); } -function U8(t) { - return hc(t), `urn:recap:${hz(t).replace(/=/g, "")}`; +function gE(t) { + return wc(t), `urn:recap:${Hz(t).replace(/=/g, "")}`; } -function _l(t) { - const e = dz(t.replace("urn:recap:", "")); - return hc(e), e; +function Ol(t) { + const e = Kz(t.replace("urn:recap:", "")); + return wc(e), e; } -function mz(t, e, r) { - const n = pz(t, e, r); - return U8(n); +function Yz(t, e, r) { + const n = Vz(t, e, r); + return gE(n); } -function vz(t) { +function Jz(t) { return t && t.includes("urn:recap:"); } -function bz(t, e) { - const r = _l(t), n = _l(e), i = yz(r, n); - return U8(i); +function Xz(t, e) { + const r = Ol(t), n = Ol(e), i = Zz(r, n); + return gE(i); } -function yz(t, e) { - hc(t), hc(e); +function Zz(t, e) { + wc(t), wc(e); const r = Object.keys(t.att).concat(Object.keys(e.att)).sort((i, s) => i.localeCompare(s)), n = { att: {} }; return r.forEach((i) => { var s, o; Object.keys(((s = t.att) == null ? void 0 : s[i]) || {}).concat(Object.keys(((o = e.att) == null ? void 0 : o[i]) || {})).sort((a, u) => a.localeCompare(u)).forEach((a) => { var u, l; - n.att[i] = uz(cz({}, n.att[i]), { [a]: ((u = t.att[i]) == null ? void 0 : u[a]) || ((l = e.att[i]) == null ? void 0 : l[a]) }); + n.att[i] = qz(Uz({}, n.att[i]), { [a]: ((u = t.att[i]) == null ? void 0 : u[a]) || ((l = e.att[i]) == null ? void 0 : l[a]) }); }); }), n; } -function wz(t = "", e) { - hc(e); +function Qz(t = "", e) { + wc(e); const r = "I further authorize the stated URI to perform the following actions on my behalf: "; if (t.includes(r)) return t; const n = []; @@ -16889,16 +17401,16 @@ function wz(t = "", e) { const s = n.join(" "), o = `${r}${s}`; return `${t ? t + " " : ""}${o}`; } -function Wx(t) { +function o3(t) { var e; - const r = _l(t); - hc(r); + const r = Ol(t); + wc(r); const n = (e = r.att) == null ? void 0 : e.eip155; return n ? Object.keys(n).map((i) => i.split("/")[1]) : []; } -function Hx(t) { - const e = _l(t); - hc(e); +function a3(t) { + const e = Ol(t); + wc(e); const r = []; return Object.values(e.att).forEach((n) => { Object.values(n).forEach((i) => { @@ -16907,130 +17419,130 @@ function Hx(t) { }); }), [...new Set(r.flat())]; } -function Cd(t) { +function Ud(t) { if (!t) return; const e = t == null ? void 0 : t[t.length - 1]; - return vz(e) ? e : void 0; + return Jz(e) ? e : void 0; } -const q8 = "base10", ai = "base16", ha = "base64pad", Af = "base64url", eh = "utf8", z8 = 0, Co = 1, th = 2, xz = 0, Kx = 1, qf = 12, ab = 32; -function _z() { - const t = Xv.generateKeyPair(); - return { privateKey: On(t.secretKey, ai), publicKey: On(t.publicKey, ai) }; +const mE = "base10", ci = "base16", pa = "base64pad", Df = "base64url", uh = "utf8", vE = 0, Oo = 1, fh = 2, eW = 0, c3 = 1, Yf = 12, xb = 32; +function tW() { + const t = lb.generateKeyPair(); + return { privateKey: On(t.secretKey, ci), publicKey: On(t.publicKey, ci) }; } -function I1() { - const t = Pa.randomBytes(ab); - return On(t, ai); +function W1() { + const t = Da.randomBytes(xb); + return On(t, ci); } -function Ez(t, e) { - const r = Xv.sharedKey(Rn(t, ai), Rn(e, ai), !0), n = new qU(Yl.SHA256, r).expand(ab); - return On(n, ai); +function rW(t, e) { + const r = lb.sharedKey(Rn(t, ci), Rn(e, ci), !0), n = new xq(ih.SHA256, r).expand(xb); + return On(n, ci); } -function Td(t) { - const e = Yl.hash(Rn(t, ai)); - return On(e, ai); +function qd(t) { + const e = ih.hash(Rn(t, ci)); + return On(e, ci); } -function xo(t) { - const e = Yl.hash(Rn(t, eh)); - return On(e, ai); +function Ao(t) { + const e = ih.hash(Rn(t, uh)); + return On(e, ci); } -function W8(t) { - return Rn(`${t}`, q8); +function bE(t) { + return Rn(`${t}`, mE); } -function dc(t) { - return Number(On(t, q8)); +function xc(t) { + return Number(On(t, mE)); } -function Sz(t) { - const e = W8(typeof t.type < "u" ? t.type : z8); - if (dc(e) === Co && typeof t.senderPublicKey > "u") throw new Error("Missing sender public key for type 1 envelope"); - const r = typeof t.senderPublicKey < "u" ? Rn(t.senderPublicKey, ai) : void 0, n = typeof t.iv < "u" ? Rn(t.iv, ai) : Pa.randomBytes(qf), i = new Yv.ChaCha20Poly1305(Rn(t.symKey, ai)).seal(n, Rn(t.message, eh)); - return H8({ type: e, sealed: i, iv: n, senderPublicKey: r, encoding: t.encoding }); +function nW(t) { + const e = bE(typeof t.type < "u" ? t.type : vE); + if (xc(e) === Oo && typeof t.senderPublicKey > "u") throw new Error("Missing sender public key for type 1 envelope"); + const r = typeof t.senderPublicKey < "u" ? Rn(t.senderPublicKey, ci) : void 0, n = typeof t.iv < "u" ? Rn(t.iv, ci) : Da.randomBytes(Yf), i = new ub.ChaCha20Poly1305(Rn(t.symKey, ci)).seal(n, Rn(t.message, uh)); + return yE({ type: e, sealed: i, iv: n, senderPublicKey: r, encoding: t.encoding }); } -function Az(t, e) { - const r = W8(th), n = Pa.randomBytes(qf), i = Rn(t, eh); - return H8({ type: r, sealed: i, iv: n, encoding: e }); +function iW(t, e) { + const r = bE(fh), n = Da.randomBytes(Yf), i = Rn(t, uh); + return yE({ type: r, sealed: i, iv: n, encoding: e }); } -function Pz(t) { - const e = new Yv.ChaCha20Poly1305(Rn(t.symKey, ai)), { sealed: r, iv: n } = El({ encoded: t.encoded, encoding: t == null ? void 0 : t.encoding }), i = e.open(n, r); +function sW(t) { + const e = new ub.ChaCha20Poly1305(Rn(t.symKey, ci)), { sealed: r, iv: n } = Nl({ encoded: t.encoded, encoding: t == null ? void 0 : t.encoding }), i = e.open(n, r); if (i === null) throw new Error("Failed to decrypt"); - return On(i, eh); + return On(i, uh); } -function Mz(t, e) { - const { sealed: r } = El({ encoded: t, encoding: e }); - return On(r, eh); +function oW(t, e) { + const { sealed: r } = Nl({ encoded: t, encoding: e }); + return On(r, uh); } -function H8(t) { - const { encoding: e = ha } = t; - if (dc(t.type) === th) return On(Sd([t.type, t.sealed]), e); - if (dc(t.type) === Co) { +function yE(t) { + const { encoding: e = pa } = t; + if (xc(t.type) === fh) return On(kd([t.type, t.sealed]), e); + if (xc(t.type) === Oo) { if (typeof t.senderPublicKey > "u") throw new Error("Missing sender public key for type 1 envelope"); - return On(Sd([t.type, t.senderPublicKey, t.iv, t.sealed]), e); + return On(kd([t.type, t.senderPublicKey, t.iv, t.sealed]), e); } - return On(Sd([t.type, t.iv, t.sealed]), e); + return On(kd([t.type, t.iv, t.sealed]), e); } -function El(t) { - const { encoded: e, encoding: r = ha } = t, n = Rn(e, r), i = n.slice(xz, Kx), s = Kx; - if (dc(i) === Co) { - const l = s + ab, d = l + qf, p = n.slice(s, l), w = n.slice(l, d), A = n.slice(d); - return { type: i, sealed: A, iv: w, senderPublicKey: p }; +function Nl(t) { + const { encoded: e, encoding: r = pa } = t, n = Rn(e, r), i = n.slice(eW, c3), s = c3; + if (xc(i) === Oo) { + const l = s + xb, d = l + Yf, p = n.slice(s, l), w = n.slice(l, d), _ = n.slice(d); + return { type: i, sealed: _, iv: w, senderPublicKey: p }; } - if (dc(i) === th) { - const l = n.slice(s), d = Pa.randomBytes(qf); + if (xc(i) === fh) { + const l = n.slice(s), d = Da.randomBytes(Yf); return { type: i, sealed: l, iv: d }; } - const o = s + qf, a = n.slice(s, o), u = n.slice(o); + const o = s + Yf, a = n.slice(s, o), u = n.slice(o); return { type: i, sealed: u, iv: a }; } -function Iz(t, e) { - const r = El({ encoded: t, encoding: e == null ? void 0 : e.encoding }); - return K8({ type: dc(r.type), senderPublicKey: typeof r.senderPublicKey < "u" ? On(r.senderPublicKey, ai) : void 0, receiverPublicKey: e == null ? void 0 : e.receiverPublicKey }); +function aW(t, e) { + const r = Nl({ encoded: t, encoding: e == null ? void 0 : e.encoding }); + return wE({ type: xc(r.type), senderPublicKey: typeof r.senderPublicKey < "u" ? On(r.senderPublicKey, ci) : void 0, receiverPublicKey: e == null ? void 0 : e.receiverPublicKey }); } -function K8(t) { - const e = (t == null ? void 0 : t.type) || z8; - if (e === Co) { +function wE(t) { + const e = (t == null ? void 0 : t.type) || vE; + if (e === Oo) { if (typeof (t == null ? void 0 : t.senderPublicKey) > "u") throw new Error("missing sender public key"); if (typeof (t == null ? void 0 : t.receiverPublicKey) > "u") throw new Error("missing receiver public key"); } return { type: e, senderPublicKey: t == null ? void 0 : t.senderPublicKey, receiverPublicKey: t == null ? void 0 : t.receiverPublicKey }; } -function Vx(t) { - return t.type === Co && typeof t.senderPublicKey == "string" && typeof t.receiverPublicKey == "string"; +function u3(t) { + return t.type === Oo && typeof t.senderPublicKey == "string" && typeof t.receiverPublicKey == "string"; } -function Gx(t) { - return t.type === th; +function f3(t) { + return t.type === fh; } -function Cz(t) { - return new _8.ec("p256").keyFromPublic({ x: Buffer.from(t.x, "base64").toString("hex"), y: Buffer.from(t.y, "base64").toString("hex") }, "hex"); +function cW(t) { + return new J8.ec("p256").keyFromPublic({ x: Buffer.from(t.x, "base64").toString("hex"), y: Buffer.from(t.y, "base64").toString("hex") }, "hex"); } -function Tz(t) { +function uW(t) { let e = t.replace(/-/g, "+").replace(/_/g, "/"); const r = e.length % 4; return r > 0 && (e += "=".repeat(4 - r)), e; } -function Rz(t) { - return Buffer.from(Tz(t), "base64"); +function fW(t) { + return Buffer.from(uW(t), "base64"); } -function Dz(t, e) { - const [r, n, i] = t.split("."), s = Rz(i); +function lW(t, e) { + const [r, n, i] = t.split("."), s = fW(i); if (s.length !== 64) throw new Error("Invalid signature length"); - const o = s.slice(0, 32).toString("hex"), a = s.slice(32, 64).toString("hex"), u = `${r}.${n}`, l = new Yl.SHA256().update(Buffer.from(u)).digest(), d = Cz(e), p = Buffer.from(l).toString("hex"); + const o = s.slice(0, 32).toString("hex"), a = s.slice(32, 64).toString("hex"), u = `${r}.${n}`, l = new ih.SHA256().update(Buffer.from(u)).digest(), d = cW(e), p = Buffer.from(l).toString("hex"); if (!d.verify(p, { r: o, s: a })) throw new Error("Invalid signature"); - return v1(t).payload; + return O1(t).payload; } -const Oz = "irn"; -function C1(t) { - return (t == null ? void 0 : t.relay) || { protocol: Oz }; +const hW = "irn"; +function H1(t) { + return (t == null ? void 0 : t.relay) || { protocol: hW }; } -function Bf(t) { - const e = Oq[t]; +function Hf(t) { + const e = hz[t]; if (typeof e > "u") throw new Error(`Relay Protocol not supported: ${t}`); return e; } -var Nz = Object.defineProperty, Lz = Object.defineProperties, kz = Object.getOwnPropertyDescriptors, Yx = Object.getOwnPropertySymbols, $z = Object.prototype.hasOwnProperty, Bz = Object.prototype.propertyIsEnumerable, Jx = (t, e, r) => e in t ? Nz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Xx = (t, e) => { - for (var r in e || (e = {})) $z.call(e, r) && Jx(t, r, e[r]); - if (Yx) for (var r of Yx(e)) Bz.call(e, r) && Jx(t, r, e[r]); +var dW = Object.defineProperty, pW = Object.defineProperties, gW = Object.getOwnPropertyDescriptors, l3 = Object.getOwnPropertySymbols, mW = Object.prototype.hasOwnProperty, vW = Object.prototype.propertyIsEnumerable, h3 = (t, e, r) => e in t ? dW(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, d3 = (t, e) => { + for (var r in e || (e = {})) mW.call(e, r) && h3(t, r, e[r]); + if (l3) for (var r of l3(e)) vW.call(e, r) && h3(t, r, e[r]); return t; -}, Fz = (t, e) => Lz(t, kz(e)); -function jz(t, e = "-") { +}, bW = (t, e) => pW(t, gW(e)); +function yW(t, e = "-") { const r = {}, n = "relay" + e; return Object.keys(t).forEach((i) => { if (i.startsWith(n)) { @@ -17039,121 +17551,121 @@ function jz(t, e = "-") { } }), r; } -function Zx(t) { +function p3(t) { if (!t.includes("wc:")) { - const u = F8(t); + const u = dE(t); u != null && u.includes("wc:") && (t = u); } t = t.includes("wc://") ? t.replace("wc://", "") : t, t = t.includes("wc:") ? t.replace("wc:", "") : t; - const e = t.indexOf(":"), r = t.indexOf("?") !== -1 ? t.indexOf("?") : void 0, n = t.substring(0, e), i = t.substring(e + 1, r).split("@"), s = typeof r < "u" ? t.substring(r) : "", o = xl.parse(s), a = typeof o.methods == "string" ? o.methods.split(",") : void 0; - return { protocol: n, topic: Uz(i[0]), version: parseInt(i[1], 10), symKey: o.symKey, relay: jz(o), methods: a, expiryTimestamp: o.expiryTimestamp ? parseInt(o.expiryTimestamp, 10) : void 0 }; + const e = t.indexOf(":"), r = t.indexOf("?") !== -1 ? t.indexOf("?") : void 0, n = t.substring(0, e), i = t.substring(e + 1, r).split("@"), s = typeof r < "u" ? t.substring(r) : "", o = Dl.parse(s), a = typeof o.methods == "string" ? o.methods.split(",") : void 0; + return { protocol: n, topic: wW(i[0]), version: parseInt(i[1], 10), symKey: o.symKey, relay: yW(o), methods: a, expiryTimestamp: o.expiryTimestamp ? parseInt(o.expiryTimestamp, 10) : void 0 }; } -function Uz(t) { +function wW(t) { return t.startsWith("//") ? t.substring(2) : t; } -function qz(t, e = "-") { +function xW(t, e = "-") { const r = "relay", n = {}; return Object.keys(t).forEach((i) => { const s = r + e + i; t[i] && (n[s] = t[i]); }), n; } -function Qx(t) { - return `${t.protocol}:${t.topic}@${t.version}?` + xl.stringify(Xx(Fz(Xx({ symKey: t.symKey }, qz(t.relay)), { expiryTimestamp: t.expiryTimestamp }), t.methods ? { methods: t.methods.join(",") } : {})); +function g3(t) { + return `${t.protocol}:${t.topic}@${t.version}?` + Dl.stringify(d3(bW(d3({ symKey: t.symKey }, xW(t.relay)), { expiryTimestamp: t.expiryTimestamp }), t.methods ? { methods: t.methods.join(",") } : {})); } -function fd(t, e, r) { +function xd(t, e, r) { return `${t}?wc_ev=${r}&topic=${e}`; } -function zu(t) { +function Ju(t) { const e = []; return t.forEach((r) => { const [n, i] = r.split(":"); e.push(`${n}:${i}`); }), e; } -function zz(t) { +function _W(t) { const e = []; return Object.values(t).forEach((r) => { - e.push(...zu(r.accounts)); + e.push(...Ju(r.accounts)); }), e; } -function Wz(t, e) { +function EW(t, e) { const r = []; return Object.values(t).forEach((n) => { - zu(n.accounts).includes(e) && r.push(...n.methods); + Ju(n.accounts).includes(e) && r.push(...n.methods); }), r; } -function Hz(t, e) { +function SW(t, e) { const r = []; return Object.values(t).forEach((n) => { - zu(n.accounts).includes(e) && r.push(...n.events); + Ju(n.accounts).includes(e) && r.push(...n.events); }), r; } -function cb(t) { +function _b(t) { return t.includes(":"); } -function Ff(t) { - return cb(t) ? t.split(":")[0] : t; +function Kf(t) { + return _b(t) ? t.split(":")[0] : t; } -function Kz(t) { +function AW(t) { const e = {}; return t == null || t.forEach((r) => { const [n, i] = r.split(":"); e[n] || (e[n] = { accounts: [], chains: [], events: [] }), e[n].accounts.push(r), e[n].chains.push(`${n}:${i}`); }), e; } -function e3(t, e) { +function m3(t, e) { e = e.map((n) => n.replace("did:pkh:", "")); - const r = Kz(e); - for (const [n, i] of Object.entries(r)) i.methods ? i.methods = Id(i.methods, t) : i.methods = t, i.events = ["chainChanged", "accountsChanged"]; + const r = AW(e); + for (const [n, i] of Object.entries(r)) i.methods ? i.methods = jd(i.methods, t) : i.methods = t, i.events = ["chainChanged", "accountsChanged"]; return r; } -const Vz = { INVALID_METHOD: { message: "Invalid method.", code: 1001 }, INVALID_EVENT: { message: "Invalid event.", code: 1002 }, INVALID_UPDATE_REQUEST: { message: "Invalid update request.", code: 1003 }, INVALID_EXTEND_REQUEST: { message: "Invalid extend request.", code: 1004 }, INVALID_SESSION_SETTLE_REQUEST: { message: "Invalid session settle request.", code: 1005 }, UNAUTHORIZED_METHOD: { message: "Unauthorized method.", code: 3001 }, UNAUTHORIZED_EVENT: { message: "Unauthorized event.", code: 3002 }, UNAUTHORIZED_UPDATE_REQUEST: { message: "Unauthorized update request.", code: 3003 }, UNAUTHORIZED_EXTEND_REQUEST: { message: "Unauthorized extend request.", code: 3004 }, USER_REJECTED: { message: "User rejected.", code: 5e3 }, USER_REJECTED_CHAINS: { message: "User rejected chains.", code: 5001 }, USER_REJECTED_METHODS: { message: "User rejected methods.", code: 5002 }, USER_REJECTED_EVENTS: { message: "User rejected events.", code: 5003 }, UNSUPPORTED_CHAINS: { message: "Unsupported chains.", code: 5100 }, UNSUPPORTED_METHODS: { message: "Unsupported methods.", code: 5101 }, UNSUPPORTED_EVENTS: { message: "Unsupported events.", code: 5102 }, UNSUPPORTED_ACCOUNTS: { message: "Unsupported accounts.", code: 5103 }, UNSUPPORTED_NAMESPACE_KEY: { message: "Unsupported namespace key.", code: 5104 }, USER_DISCONNECTED: { message: "User disconnected.", code: 6e3 }, SESSION_SETTLEMENT_FAILED: { message: "Session settlement failed.", code: 7e3 }, WC_METHOD_UNSUPPORTED: { message: "Unsupported wc_ method.", code: 10001 } }, Gz = { NOT_INITIALIZED: { message: "Not initialized.", code: 1 }, NO_MATCHING_KEY: { message: "No matching key.", code: 2 }, RESTORE_WILL_OVERRIDE: { message: "Restore will override.", code: 3 }, RESUBSCRIBED: { message: "Resubscribed.", code: 4 }, MISSING_OR_INVALID: { message: "Missing or invalid.", code: 5 }, EXPIRED: { message: "Expired.", code: 6 }, UNKNOWN_TYPE: { message: "Unknown type.", code: 7 }, MISMATCHED_TOPIC: { message: "Mismatched topic.", code: 8 }, NON_CONFORMING_NAMESPACES: { message: "Non conforming namespaces.", code: 9 } }; +const PW = { INVALID_METHOD: { message: "Invalid method.", code: 1001 }, INVALID_EVENT: { message: "Invalid event.", code: 1002 }, INVALID_UPDATE_REQUEST: { message: "Invalid update request.", code: 1003 }, INVALID_EXTEND_REQUEST: { message: "Invalid extend request.", code: 1004 }, INVALID_SESSION_SETTLE_REQUEST: { message: "Invalid session settle request.", code: 1005 }, UNAUTHORIZED_METHOD: { message: "Unauthorized method.", code: 3001 }, UNAUTHORIZED_EVENT: { message: "Unauthorized event.", code: 3002 }, UNAUTHORIZED_UPDATE_REQUEST: { message: "Unauthorized update request.", code: 3003 }, UNAUTHORIZED_EXTEND_REQUEST: { message: "Unauthorized extend request.", code: 3004 }, USER_REJECTED: { message: "User rejected.", code: 5e3 }, USER_REJECTED_CHAINS: { message: "User rejected chains.", code: 5001 }, USER_REJECTED_METHODS: { message: "User rejected methods.", code: 5002 }, USER_REJECTED_EVENTS: { message: "User rejected events.", code: 5003 }, UNSUPPORTED_CHAINS: { message: "Unsupported chains.", code: 5100 }, UNSUPPORTED_METHODS: { message: "Unsupported methods.", code: 5101 }, UNSUPPORTED_EVENTS: { message: "Unsupported events.", code: 5102 }, UNSUPPORTED_ACCOUNTS: { message: "Unsupported accounts.", code: 5103 }, UNSUPPORTED_NAMESPACE_KEY: { message: "Unsupported namespace key.", code: 5104 }, USER_DISCONNECTED: { message: "User disconnected.", code: 6e3 }, SESSION_SETTLEMENT_FAILED: { message: "Session settlement failed.", code: 7e3 }, WC_METHOD_UNSUPPORTED: { message: "Unsupported wc_ method.", code: 10001 } }, MW = { NOT_INITIALIZED: { message: "Not initialized.", code: 1 }, NO_MATCHING_KEY: { message: "No matching key.", code: 2 }, RESTORE_WILL_OVERRIDE: { message: "Restore will override.", code: 3 }, RESUBSCRIBED: { message: "Resubscribed.", code: 4 }, MISSING_OR_INVALID: { message: "Missing or invalid.", code: 5 }, EXPIRED: { message: "Expired.", code: 6 }, UNKNOWN_TYPE: { message: "Unknown type.", code: 7 }, MISMATCHED_TOPIC: { message: "Mismatched topic.", code: 8 }, NON_CONFORMING_NAMESPACES: { message: "Non conforming namespaces.", code: 9 } }; function ft(t, e) { - const { message: r, code: n } = Gz[t]; + const { message: r, code: n } = MW[t]; return { message: e ? `${r} ${e}` : r, code: n }; } function Or(t, e) { - const { message: r, code: n } = Vz[t]; + const { message: r, code: n } = PW[t]; return { message: e ? `${r} ${e}` : r, code: n }; } -function pc(t, e) { +function _c(t, e) { return !!Array.isArray(t); } -function Sl(t) { +function Ll(t) { return Object.getPrototypeOf(t) === Object.prototype && Object.keys(t).length; } -function mi(t) { +function vi(t) { return typeof t > "u"; } function dn(t, e) { - return e && mi(t) ? !0 : typeof t == "string" && !!t.trim().length; + return e && vi(t) ? !0 : typeof t == "string" && !!t.trim().length; } -function ub(t, e) { +function Eb(t, e) { return typeof t == "number" && !isNaN(t); } -function Yz(t, e) { +function IW(t, e) { const { requiredNamespaces: r } = e, n = Object.keys(t.namespaces), i = Object.keys(r); let s = !0; - return rc(i, n) ? (n.forEach((o) => { - const { accounts: a, methods: u, events: l } = t.namespaces[o], d = zu(a), p = r[o]; - (!rc(D8(o, p), d) || !rc(p.methods, u) || !rc(p.events, l)) && (s = !1); + return uc(i, n) ? (n.forEach((o) => { + const { accounts: a, methods: u, events: l } = t.namespaces[o], d = Ju(a), p = r[o]; + (!uc(oE(o, p), d) || !uc(p.methods, u) || !uc(p.events, l)) && (s = !1); }), s) : !1; } -function f0(t) { +function _0(t) { return dn(t, !1) && t.includes(":") ? t.split(":").length === 2 : !1; } -function Jz(t) { +function CW(t) { if (dn(t, !1) && t.includes(":")) { const e = t.split(":"); if (e.length === 3) { const r = e[0] + ":" + e[1]; - return !!e[2] && f0(r); + return !!e[2] && _0(r); } } return !1; } -function Xz(t) { +function TW(t) { function e(r) { try { return typeof new URL(r) < "u"; @@ -17164,142 +17676,142 @@ function Xz(t) { try { if (dn(t, !1)) { if (e(t)) return !0; - const r = F8(t); + const r = dE(t); return e(r); } } catch { } return !1; } -function Zz(t) { +function RW(t) { var e; return (e = t == null ? void 0 : t.proposer) == null ? void 0 : e.publicKey; } -function Qz(t) { +function DW(t) { return t == null ? void 0 : t.topic; } -function eW(t, e) { +function OW(t, e) { let r = null; return dn(t == null ? void 0 : t.publicKey, !1) || (r = ft("MISSING_OR_INVALID", `${e} controller public key should be a string`)), r; } -function t3(t) { +function v3(t) { let e = !0; - return pc(t) ? t.length && (e = t.every((r) => dn(r, !1))) : e = !1, e; + return _c(t) ? t.length && (e = t.every((r) => dn(r, !1))) : e = !1, e; } -function tW(t, e, r) { +function NW(t, e, r) { let n = null; - return pc(e) && e.length ? e.forEach((i) => { - n || f0(i) || (n = Or("UNSUPPORTED_CHAINS", `${r}, chain ${i} should be a string and conform to "namespace:chainId" format`)); - }) : f0(t) || (n = Or("UNSUPPORTED_CHAINS", `${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)), n; + return _c(e) && e.length ? e.forEach((i) => { + n || _0(i) || (n = Or("UNSUPPORTED_CHAINS", `${r}, chain ${i} should be a string and conform to "namespace:chainId" format`)); + }) : _0(t) || (n = Or("UNSUPPORTED_CHAINS", `${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)), n; } -function rW(t, e, r) { +function LW(t, e, r) { let n = null; return Object.entries(t).forEach(([i, s]) => { if (n) return; - const o = tW(i, D8(i, s), `${e} ${r}`); + const o = NW(i, oE(i, s), `${e} ${r}`); o && (n = o); }), n; } -function nW(t, e) { +function kW(t, e) { let r = null; - return pc(t) ? t.forEach((n) => { - r || Jz(n) || (r = Or("UNSUPPORTED_ACCOUNTS", `${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`)); + return _c(t) ? t.forEach((n) => { + r || CW(n) || (r = Or("UNSUPPORTED_ACCOUNTS", `${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`)); }) : r = Or("UNSUPPORTED_ACCOUNTS", `${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`), r; } -function iW(t, e) { +function $W(t, e) { let r = null; return Object.values(t).forEach((n) => { if (r) return; - const i = nW(n == null ? void 0 : n.accounts, `${e} namespace`); + const i = kW(n == null ? void 0 : n.accounts, `${e} namespace`); i && (r = i); }), r; } -function sW(t, e) { +function BW(t, e) { let r = null; - return t3(t == null ? void 0 : t.methods) ? t3(t == null ? void 0 : t.events) || (r = Or("UNSUPPORTED_EVENTS", `${e}, events should be an array of strings or empty array for no events`)) : r = Or("UNSUPPORTED_METHODS", `${e}, methods should be an array of strings or empty array for no methods`), r; + return v3(t == null ? void 0 : t.methods) ? v3(t == null ? void 0 : t.events) || (r = Or("UNSUPPORTED_EVENTS", `${e}, events should be an array of strings or empty array for no events`)) : r = Or("UNSUPPORTED_METHODS", `${e}, methods should be an array of strings or empty array for no methods`), r; } -function V8(t, e) { +function xE(t, e) { let r = null; return Object.values(t).forEach((n) => { if (r) return; - const i = sW(n, `${e}, namespace`); + const i = BW(n, `${e}, namespace`); i && (r = i); }), r; } -function oW(t, e, r) { +function FW(t, e, r) { let n = null; - if (t && Sl(t)) { - const i = V8(t, e); + if (t && Ll(t)) { + const i = xE(t, e); i && (n = i); - const s = rW(t, e, r); + const s = LW(t, e, r); s && (n = s); } else n = ft("MISSING_OR_INVALID", `${e}, ${r} should be an object with data`); return n; } -function hm(t, e) { +function Pm(t, e) { let r = null; - if (t && Sl(t)) { - const n = V8(t, e); + if (t && Ll(t)) { + const n = xE(t, e); n && (r = n); - const i = iW(t, e); + const i = $W(t, e); i && (r = i); } else r = ft("MISSING_OR_INVALID", `${e}, namespaces should be an object with data`); return r; } -function G8(t) { +function _E(t) { return dn(t.protocol, !0); } -function aW(t, e) { +function jW(t, e) { let r = !1; - return t ? t && pc(t) && t.length && t.forEach((n) => { - r = G8(n); + return t ? t && _c(t) && t.length && t.forEach((n) => { + r = _E(n); }) : r = !0, r; } -function cW(t) { +function UW(t) { return typeof t == "number"; } -function gi(t) { +function mi(t) { return typeof t < "u" && typeof t !== null; } -function uW(t) { - return !(!t || typeof t != "object" || !t.code || !ub(t.code) || !t.message || !dn(t.message, !1)); +function qW(t) { + return !(!t || typeof t != "object" || !t.code || !Eb(t.code) || !t.message || !dn(t.message, !1)); } -function fW(t) { - return !(mi(t) || !dn(t.method, !1)); +function zW(t) { + return !(vi(t) || !dn(t.method, !1)); } -function lW(t) { - return !(mi(t) || mi(t.result) && mi(t.error) || !ub(t.id) || !dn(t.jsonrpc, !1)); +function WW(t) { + return !(vi(t) || vi(t.result) && vi(t.error) || !Eb(t.id) || !dn(t.jsonrpc, !1)); } -function hW(t) { - return !(mi(t) || !dn(t.name, !1)); +function HW(t) { + return !(vi(t) || !dn(t.name, !1)); } -function r3(t, e) { - return !(!f0(e) || !zz(t).includes(e)); +function b3(t, e) { + return !(!_0(e) || !_W(t).includes(e)); } -function dW(t, e, r) { - return dn(r, !1) ? Wz(t, e).includes(r) : !1; +function KW(t, e, r) { + return dn(r, !1) ? EW(t, e).includes(r) : !1; } -function pW(t, e, r) { - return dn(r, !1) ? Hz(t, e).includes(r) : !1; +function VW(t, e, r) { + return dn(r, !1) ? SW(t, e).includes(r) : !1; } -function n3(t, e, r) { +function y3(t, e, r) { let n = null; - const i = gW(t), s = mW(e), o = Object.keys(i), a = Object.keys(s), u = i3(Object.keys(t)), l = i3(Object.keys(e)), d = u.filter((p) => !l.includes(p)); + const i = GW(t), s = YW(e), o = Object.keys(i), a = Object.keys(s), u = w3(Object.keys(t)), l = w3(Object.keys(e)), d = u.filter((p) => !l.includes(p)); return d.length && (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces keys don't satisfy requiredNamespaces. Required: ${d.toString()} - Received: ${Object.keys(e).toString()}`)), rc(o, a) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces chains don't satisfy required namespaces. + Received: ${Object.keys(e).toString()}`)), uc(o, a) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} Approved: ${a.toString()}`)), Object.keys(e).forEach((p) => { if (!p.includes(":") || n) return; - const w = zu(e[p].accounts); + const w = Ju(e[p].accounts); w.includes(p) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces accounts don't satisfy namespace accounts for ${p} Required: ${p} Approved: ${w.toString()}`)); }), o.forEach((p) => { - n || (rc(i[p].methods, s[p].methods) ? rc(i[p].events, s[p].events) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces events don't satisfy namespace events for ${p}`)) : n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces methods don't satisfy namespace methods for ${p}`)); + n || (uc(i[p].methods, s[p].methods) ? uc(i[p].events, s[p].events) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces events don't satisfy namespace events for ${p}`)) : n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces methods don't satisfy namespace methods for ${p}`)); }), n; } -function gW(t) { +function GW(t) { const e = {}; return Object.keys(t).forEach((r) => { var n; @@ -17308,223 +17820,223 @@ function gW(t) { }); }), e; } -function i3(t) { +function w3(t) { return [...new Set(t.map((e) => e.includes(":") ? e.split(":")[0] : e))]; } -function mW(t) { +function YW(t) { const e = {}; return Object.keys(t).forEach((r) => { if (r.includes(":")) e[r] = t[r]; else { - const n = zu(t[r].accounts); + const n = Ju(t[r].accounts); n == null || n.forEach((i) => { e[i] = { accounts: t[r].accounts.filter((s) => s.includes(`${i}:`)), methods: t[r].methods, events: t[r].events }; }); } }), e; } -function vW(t, e) { - return ub(t) && t <= e.max && t >= e.min; +function JW(t, e) { + return Eb(t) && t <= e.max && t >= e.min; } -function s3() { - const t = Ql(); +function x3() { + const t = ch(); return new Promise((e) => { switch (t) { - case Di.browser: - e(bW()); + case Oi.browser: + e(XW()); break; - case Di.reactNative: - e(yW()); + case Oi.reactNative: + e(ZW()); break; - case Di.node: - e(wW()); + case Oi.node: + e(QW()); break; default: e(!0); } }); } -function bW() { - return Zl() && (navigator == null ? void 0 : navigator.onLine); +function XW() { + return ah() && (navigator == null ? void 0 : navigator.onLine); } -async function yW() { - if (qu() && typeof global < "u" && global != null && global.NetInfo) { +async function ZW() { + if (Yu() && typeof global < "u" && global != null && global.NetInfo) { const t = await (global == null ? void 0 : global.NetInfo.fetch()); return t == null ? void 0 : t.isConnected; } return !0; } -function wW() { +function QW() { return !0; } -function xW(t) { - switch (Ql()) { - case Di.browser: - _W(t); +function eH(t) { + switch (ch()) { + case Oi.browser: + tH(t); break; - case Di.reactNative: - EW(t); + case Oi.reactNative: + rH(t); break; } } -function _W(t) { - !qu() && Zl() && (window.addEventListener("online", () => t(!0)), window.addEventListener("offline", () => t(!1))); +function tH(t) { + !Yu() && ah() && (window.addEventListener("online", () => t(!0)), window.addEventListener("offline", () => t(!1))); } -function EW(t) { - qu() && typeof global < "u" && global != null && global.NetInfo && (global == null || global.NetInfo.addEventListener((e) => t(e == null ? void 0 : e.isConnected))); +function rH(t) { + Yu() && typeof global < "u" && global != null && global.NetInfo && (global == null || global.NetInfo.addEventListener((e) => t(e == null ? void 0 : e.isConnected))); } -const dm = {}; -class Pf { +const Mm = {}; +class Of { static get(e) { - return dm[e]; + return Mm[e]; } static set(e, r) { - dm[e] = r; + Mm[e] = r; } static delete(e) { - delete dm[e]; + delete Mm[e]; } } -const SW = "PARSE_ERROR", AW = "INVALID_REQUEST", PW = "METHOD_NOT_FOUND", MW = "INVALID_PARAMS", Y8 = "INTERNAL_ERROR", fb = "SERVER_ERROR", IW = [-32700, -32600, -32601, -32602, -32603], zf = { - [SW]: { code: -32700, message: "Parse error" }, - [AW]: { code: -32600, message: "Invalid Request" }, - [PW]: { code: -32601, message: "Method not found" }, - [MW]: { code: -32602, message: "Invalid params" }, - [Y8]: { code: -32603, message: "Internal error" }, - [fb]: { code: -32e3, message: "Server error" } -}, J8 = fb; -function CW(t) { - return IW.includes(t); +const nH = "PARSE_ERROR", iH = "INVALID_REQUEST", sH = "METHOD_NOT_FOUND", oH = "INVALID_PARAMS", EE = "INTERNAL_ERROR", Sb = "SERVER_ERROR", aH = [-32700, -32600, -32601, -32602, -32603], Jf = { + [nH]: { code: -32700, message: "Parse error" }, + [iH]: { code: -32600, message: "Invalid Request" }, + [sH]: { code: -32601, message: "Method not found" }, + [oH]: { code: -32602, message: "Invalid params" }, + [EE]: { code: -32603, message: "Internal error" }, + [Sb]: { code: -32e3, message: "Server error" } +}, SE = Sb; +function cH(t) { + return aH.includes(t); } -function o3(t) { - return Object.keys(zf).includes(t) ? zf[t] : zf[J8]; +function _3(t) { + return Object.keys(Jf).includes(t) ? Jf[t] : Jf[SE]; } -function TW(t) { - const e = Object.values(zf).find((r) => r.code === t); - return e || zf[J8]; +function uH(t) { + const e = Object.values(Jf).find((r) => r.code === t); + return e || Jf[SE]; } -function X8(t, e, r) { +function AE(t, e, r) { return t.message.includes("getaddrinfo ENOTFOUND") || t.message.includes("connect ECONNREFUSED") ? new Error(`Unavailable ${r} RPC url at ${e}`) : t; } -var Z8 = {}, mo = {}, a3; -function RW() { - if (a3) return mo; - a3 = 1, Object.defineProperty(mo, "__esModule", { value: !0 }), mo.isBrowserCryptoAvailable = mo.getSubtleCrypto = mo.getBrowerCrypto = void 0; +var PE = {}, wo = {}, E3; +function fH() { + if (E3) return wo; + E3 = 1, Object.defineProperty(wo, "__esModule", { value: !0 }), wo.isBrowserCryptoAvailable = wo.getSubtleCrypto = wo.getBrowerCrypto = void 0; function t() { return (gn == null ? void 0 : gn.crypto) || (gn == null ? void 0 : gn.msCrypto) || {}; } - mo.getBrowerCrypto = t; + wo.getBrowerCrypto = t; function e() { const n = t(); return n.subtle || n.webkitSubtle; } - mo.getSubtleCrypto = e; + wo.getSubtleCrypto = e; function r() { return !!t() && !!e(); } - return mo.isBrowserCryptoAvailable = r, mo; + return wo.isBrowserCryptoAvailable = r, wo; } -var vo = {}, c3; -function DW() { - if (c3) return vo; - c3 = 1, Object.defineProperty(vo, "__esModule", { value: !0 }), vo.isBrowser = vo.isNode = vo.isReactNative = void 0; +var xo = {}, S3; +function lH() { + if (S3) return xo; + S3 = 1, Object.defineProperty(xo, "__esModule", { value: !0 }), xo.isBrowser = xo.isNode = xo.isReactNative = void 0; function t() { return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative"; } - vo.isReactNative = t; + xo.isReactNative = t; function e() { return typeof process < "u" && typeof process.versions < "u" && typeof process.versions.node < "u"; } - vo.isNode = e; + xo.isNode = e; function r() { return !t() && !e(); } - return vo.isBrowser = r, vo; + return xo.isBrowser = r, xo; } (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); - const e = jl; - e.__exportStar(RW(), t), e.__exportStar(DW(), t); -})(Z8); -function ua(t = 3) { + const e = Yl; + e.__exportStar(fH(), t), e.__exportStar(lH(), t); +})(PE); +function la(t = 3) { const e = Date.now() * Math.pow(10, t), r = Math.floor(Math.random() * Math.pow(10, t)); return e + r; } -function nc(t = 6) { - return BigInt(ua(t)); +function fc(t = 6) { + return BigInt(la(t)); } -function da(t, e, r) { +function ga(t, e, r) { return { - id: r || ua(), + id: r || la(), jsonrpc: "2.0", method: t, params: e }; } -function rp(t, e) { +function mp(t, e) { return { id: t, jsonrpc: "2.0", result: e }; } -function np(t, e, r) { +function vp(t, e, r) { return { id: t, jsonrpc: "2.0", - error: OW(e) + error: hH(e) }; } -function OW(t, e) { - return typeof t > "u" ? o3(Y8) : (typeof t == "string" && (t = Object.assign(Object.assign({}, o3(fb)), { message: t })), CW(t.code) && (t = TW(t.code)), t); +function hH(t, e) { + return typeof t > "u" ? _3(EE) : (typeof t == "string" && (t = Object.assign(Object.assign({}, _3(Sb)), { message: t })), cH(t.code) && (t = uH(t.code)), t); } -let NW = class { -}, LW = class extends NW { +let dH = class { +}, pH = class extends dH { constructor() { super(); } -}, kW = class extends LW { +}, gH = class extends pH { constructor(e) { super(); } }; -const $W = "^https?:", BW = "^wss?:"; -function FW(t) { +const mH = "^https?:", vH = "^wss?:"; +function bH(t) { const e = t.match(new RegExp(/^\w+:/, "gi")); if (!(!e || !e.length)) return e[0]; } -function Q8(t, e) { - const r = FW(t); +function ME(t, e) { + const r = bH(t); return typeof r > "u" ? !1 : new RegExp(e).test(r); } -function u3(t) { - return Q8(t, $W); +function A3(t) { + return ME(t, mH); } -function f3(t) { - return Q8(t, BW); +function P3(t) { + return ME(t, vH); } -function jW(t) { +function yH(t) { return new RegExp("wss?://localhost(:d{2,5})?").test(t); } -function eE(t) { +function IE(t) { return typeof t == "object" && "id" in t && "jsonrpc" in t && t.jsonrpc === "2.0"; } -function lb(t) { - return eE(t) && "method" in t; +function Ab(t) { + return IE(t) && "method" in t; } -function ip(t) { - return eE(t) && (js(t) || Zi(t)); +function bp(t) { + return IE(t) && (zs(t) || es(t)); } -function js(t) { +function zs(t) { return "result" in t; } -function Zi(t) { +function es(t) { return "error" in t; } -let as = class extends kW { +let us = class extends gH { constructor(e) { - super(e), this.events = new rs.EventEmitter(), this.hasRegisteredEventListeners = !1, this.connection = this.setConnection(e), this.connection.connected && this.registerEventListeners(); + super(e), this.events = new is.EventEmitter(), this.hasRegisteredEventListeners = !1, this.connection = this.setConnection(e), this.connection.connected && this.registerEventListeners(); } async connect(e = this.connection) { await this.open(e); @@ -17545,7 +18057,7 @@ let as = class extends kW { this.events.removeListener(e, r); } async request(e, r) { - return this.requestStrict(da(e.method, e.params || [], e.id || nc().toString()), r); + return this.requestStrict(ga(e.method, e.params || [], e.id || fc().toString()), r); } async requestStrict(e, r) { return new Promise(async (n, i) => { @@ -17555,7 +18067,7 @@ let as = class extends kW { i(s); } this.events.on(`${e.id}`, (s) => { - Zi(s) ? i(s.error) : n(s.result); + es(s) ? i(s.error) : n(s.result); }); try { await this.connection.send(e, r); @@ -17568,7 +18080,7 @@ let as = class extends kW { return e; } onPayload(e) { - this.events.emit("payload", e), ip(e) ? this.events.emit(`${e.id}`, e) : this.events.emit("message", { type: e.method, data: e.params }); + this.events.emit("payload", e), bp(e) ? this.events.emit(`${e.id}`, e) : this.events.emit("message", { type: e.method, data: e.params }); } onClose(e) { e && e.code === 3e3 && this.events.emit("error", new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason ? `(${e.reason})` : ""}`)), this.events.emit("disconnect"); @@ -17583,10 +18095,10 @@ let as = class extends kW { this.hasRegisteredEventListeners || (this.connection.on("payload", (e) => this.onPayload(e)), this.connection.on("close", (e) => this.onClose(e)), this.connection.on("error", (e) => this.events.emit("error", e)), this.connection.on("register_error", (e) => this.onClose()), this.hasRegisteredEventListeners = !0); } }; -const UW = () => typeof WebSocket < "u" ? WebSocket : typeof global < "u" && typeof global.WebSocket < "u" ? global.WebSocket : typeof window < "u" && typeof window.WebSocket < "u" ? window.WebSocket : typeof self < "u" && typeof self.WebSocket < "u" ? self.WebSocket : require("ws"), qW = () => typeof WebSocket < "u" || typeof global < "u" && typeof global.WebSocket < "u" || typeof window < "u" && typeof window.WebSocket < "u" || typeof self < "u" && typeof self.WebSocket < "u", l3 = (t) => t.split("?")[0], h3 = 10, zW = UW(); -let WW = class { +const wH = () => typeof WebSocket < "u" ? WebSocket : typeof global < "u" && typeof global.WebSocket < "u" ? global.WebSocket : typeof window < "u" && typeof window.WebSocket < "u" ? window.WebSocket : typeof self < "u" && typeof self.WebSocket < "u" ? self.WebSocket : require("ws"), xH = () => typeof WebSocket < "u" || typeof global < "u" && typeof global.WebSocket < "u" || typeof window < "u" && typeof window.WebSocket < "u" || typeof self < "u" && typeof self.WebSocket < "u", M3 = (t) => t.split("?")[0], I3 = 10, _H = wH(); +let EH = class { constructor(e) { - if (this.url = e, this.events = new rs.EventEmitter(), this.registering = !1, !f3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); + if (this.url = e, this.events = new is.EventEmitter(), this.registering = !1, !P3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); this.url = e; } get connected() { @@ -17624,13 +18136,13 @@ let WW = class { async send(e) { typeof this.socket > "u" && (this.socket = await this.register()); try { - this.socket.send($o(e)); + this.socket.send(jo(e)); } catch (r) { this.onError(e.id, r); } } register(e = this.url) { - if (!f3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); + if (!P3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); if (this.registering) { const r = this.events.getMaxListeners(); return (this.events.listenerCount("register_error") >= r || this.events.listenerCount("open") >= r) && this.events.setMaxListeners(r + 1), new Promise((n, i) => { @@ -17643,8 +18155,8 @@ let WW = class { }); } return this.url = e, this.registering = !0, new Promise((r, n) => { - const i = new URLSearchParams(e).get("origin"), s = Z8.isReactNative() ? { headers: { origin: i } } : { rejectUnauthorized: !jW(e) }, o = new zW(e, [], s); - qW() ? o.onerror = (a) => { + const i = new URLSearchParams(e).get("origin"), s = PE.isReactNative() ? { headers: { origin: i } } : { rejectUnauthorized: !yH(e) }, o = new _H(e, [], s); + xH() ? o.onerror = (a) => { const u = a; n(this.emitError(u.error)); } : o.on("error", (a) => { @@ -17662,30 +18174,30 @@ let WW = class { } onPayload(e) { if (typeof e.data > "u") return; - const r = typeof e.data == "string" ? fc(e.data) : e.data; + const r = typeof e.data == "string" ? bc(e.data) : e.data; this.events.emit("payload", r); } onError(e, r) { - const n = this.parseError(r), i = n.message || n.toString(), s = np(e, i); + const n = this.parseError(r), i = n.message || n.toString(), s = vp(e, i); this.events.emit("payload", s); } parseError(e, r = this.url) { - return X8(e, l3(r), "WS"); + return AE(e, M3(r), "WS"); } resetMaxListeners() { - this.events.getMaxListeners() > h3 && this.events.setMaxListeners(h3); + this.events.getMaxListeners() > I3 && this.events.setMaxListeners(I3); } emitError(e) { - const r = this.parseError(new Error((e == null ? void 0 : e.message) || `WebSocket connection failed for host: ${l3(this.url)}`)); + const r = this.parseError(new Error((e == null ? void 0 : e.message) || `WebSocket connection failed for host: ${M3(this.url)}`)); return this.events.emit("register_error", r), r; } }; -var l0 = { exports: {} }; -l0.exports; +var E0 = { exports: {} }; +E0.exports; (function(t, e) { - var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", u = "[object Array]", l = "[object AsyncFunction]", d = "[object Boolean]", p = "[object Date]", w = "[object Error]", A = "[object Function]", M = "[object GeneratorFunction]", N = "[object Map]", L = "[object Number]", B = "[object Null]", $ = "[object Object]", H = "[object Promise]", U = "[object Proxy]", V = "[object RegExp]", te = "[object Set]", R = "[object String]", K = "[object Symbol]", ge = "[object Undefined]", Ee = "[object WeakMap]", Y = "[object ArrayBuffer]", S = "[object DataView]", m = "[object Float32Array]", f = "[object Float64Array]", g = "[object Int8Array]", b = "[object Int16Array]", x = "[object Int32Array]", _ = "[object Uint8Array]", E = "[object Uint8ClampedArray]", v = "[object Uint16Array]", P = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, F = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, D = {}; - D[m] = D[f] = D[g] = D[b] = D[x] = D[_] = D[E] = D[v] = D[P] = !0, D[a] = D[u] = D[Y] = D[d] = D[S] = D[p] = D[w] = D[A] = D[N] = D[L] = D[$] = D[V] = D[te] = D[R] = D[Ee] = !1; - var oe = typeof gn == "object" && gn && gn.Object === Object && gn, Z = typeof self == "object" && self && self.Object === Object && self, J = oe || Z || Function("return this")(), Q = e && !e.nodeType && e, T = Q && !0 && t && !t.nodeType && t, X = T && T.exports === Q, re = X && oe.process, pe = function() { + var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", u = "[object Array]", l = "[object AsyncFunction]", d = "[object Boolean]", p = "[object Date]", w = "[object Error]", _ = "[object Function]", P = "[object GeneratorFunction]", O = "[object Map]", L = "[object Number]", B = "[object Null]", k = "[object Object]", q = "[object Promise]", U = "[object Proxy]", V = "[object RegExp]", Q = "[object Set]", R = "[object String]", K = "[object Symbol]", ge = "[object Undefined]", Ee = "[object WeakMap]", Y = "[object ArrayBuffer]", A = "[object DataView]", m = "[object Float32Array]", f = "[object Float64Array]", g = "[object Int8Array]", b = "[object Int16Array]", x = "[object Int32Array]", E = "[object Uint8Array]", S = "[object Uint8ClampedArray]", v = "[object Uint16Array]", M = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, F = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, D = {}; + D[m] = D[f] = D[g] = D[b] = D[x] = D[E] = D[S] = D[v] = D[M] = !0, D[a] = D[u] = D[Y] = D[d] = D[A] = D[p] = D[w] = D[_] = D[O] = D[L] = D[k] = D[V] = D[Q] = D[R] = D[Ee] = !1; + var oe = typeof gn == "object" && gn && gn.Object === Object && gn, Z = typeof self == "object" && self && self.Object === Object && self, J = oe || Z || Function("return this")(), ee = e && !e.nodeType && e, T = ee && !0 && t && !t.nodeType && t, X = T && T.exports === ee, re = X && oe.process, pe = function() { try { return re && re.binding && re.binding("util"); } catch { @@ -17747,7 +18259,7 @@ l0.exports; return ae ? "Symbol(src)_1." + ae : ""; }(), tt = _e.toString, Ye = RegExp( "^" + at.call(ke).replace(I, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" - ), dt = X ? J.Buffer : void 0, lt = J.Symbol, ct = J.Uint8Array, qt = _e.propertyIsEnumerable, Jt = qe.splice, Et = lt ? lt.toStringTag : void 0, er = Object.getOwnPropertySymbols, Xt = dt ? dt.isBuffer : void 0, Dt = Ke(Object.keys, Object), kt = yr(J, "DataView"), Ct = yr(J, "Map"), gt = yr(J, "Promise"), Rt = yr(J, "Set"), Nt = yr(J, "WeakMap"), vt = yr(Object, "create"), $t = io(kt), Ft = io(Ct), rt = io(gt), Bt = io(Rt), k = io(Nt), q = lt ? lt.prototype : void 0, W = q ? q.valueOf : void 0; + ), dt = X ? J.Buffer : void 0, lt = J.Symbol, ct = J.Uint8Array, qt = _e.propertyIsEnumerable, Jt = qe.splice, Et = lt ? lt.toStringTag : void 0, er = Object.getOwnPropertySymbols, Xt = dt ? dt.isBuffer : void 0, Dt = Ke(Object.keys, Object), kt = wr(J, "DataView"), Ct = wr(J, "Map"), mt = wr(J, "Promise"), Rt = wr(J, "Set"), Nt = wr(J, "WeakMap"), bt = wr(Object, "create"), $t = ao(kt), Ft = ao(Ct), rt = ao(mt), Bt = ao(Rt), $ = ao(Nt), z = lt ? lt.prototype : void 0, H = z ? z.valueOf : void 0; function C(ae) { var ye = -1, Ge = ae == null ? 0 : ae.length; for (this.clear(); ++ye < Ge; ) { @@ -17756,7 +18268,7 @@ l0.exports; } } function G() { - this.__data__ = vt ? vt(null) : {}, this.size = 0; + this.__data__ = bt ? bt(null) : {}, this.size = 0; } function j(ae) { var ye = this.has(ae) && delete this.__data__[ae]; @@ -17764,7 +18276,7 @@ l0.exports; } function se(ae) { var ye = this.__data__; - if (vt) { + if (bt) { var Ge = ye[ae]; return Ge === n ? void 0 : Ge; } @@ -17772,11 +18284,11 @@ l0.exports; } function de(ae) { var ye = this.__data__; - return vt ? ye[ae] !== void 0 : ke.call(ye, ae); + return bt ? ye[ae] !== void 0 : ke.call(ye, ae); } function xe(ae, ye) { var Ge = this.__data__; - return this.size += this.has(ae) ? 0 : 1, Ge[ae] = vt && ye === void 0 ? n : ye, this; + return this.size += this.has(ae) ? 0 : 1, Ge[ae] = bt && ye === void 0 ? n : ye, this; } C.prototype.clear = G, C.prototype.delete = j, C.prototype.get = se, C.prototype.has = de, C.prototype.set = xe; function Te(ae) { @@ -17845,10 +18357,10 @@ l0.exports; function st(ae) { return this.__data__.set(ae, n), this; } - function bt(ae) { + function yt(ae) { return this.__data__.has(ae); } - xt.prototype.add = xt.prototype.push = st, xt.prototype.has = bt; + xt.prototype.add = xt.prototype.push = st, xt.prototype.has = yt; function ut(ae) { var ye = this.__data__ = new Te(ae); this.size = ye.size; @@ -17878,65 +18390,65 @@ l0.exports; } ut.prototype.clear = ot, ut.prototype.delete = Se, ut.prototype.get = Ae, ut.prototype.has = Ve, ut.prototype.set = Fe; function Ue(ae, ye) { - var Ge = Mc(ae), Pt = !Ge && dh(ae), jr = !Ge && !Pt && Xu(ae), nr = !Ge && !Pt && !jr && mh(ae), Kr = Ge || Pt || jr || nr, vn = Kr ? De(ae.length, String) : [], _r = vn.length; + var Ge = $c(ae), Pt = !Ge && _h(ae), jr = !Ge && !Pt && sf(ae), nr = !Ge && !Pt && !jr && Ah(ae), Kr = Ge || Pt || jr || nr, vn = Kr ? De(ae.length, String) : [], Er = vn.length; for (var Ur in ae) ke.call(ae, Ur) && !(Kr && // Safari 9 has enumerable `arguments.length` in strict mode. (Ur == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. jr && (Ur == "offset" || Ur == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. nr && (Ur == "buffer" || Ur == "byteLength" || Ur == "byteOffset") || // Skip index properties. - nn(Ur, _r))) && vn.push(Ur); + nn(Ur, Er))) && vn.push(Ur); return vn; } function Je(ae, ye) { for (var Ge = ae.length; Ge--; ) - if (hh(ae[Ge][0], ye)) + if (xh(ae[Ge][0], ye)) return Ge; return -1; } function Lt(ae, ye, Ge) { var Pt = ye(ae); - return Mc(ae) ? Pt : ve(Pt, Ge(ae)); + return $c(ae) ? Pt : ve(Pt, Ge(ae)); } function zt(ae) { - return ae == null ? ae === void 0 ? ge : B : Et && Et in Object(ae) ? $r(ae) : Rp(ae); + return ae == null ? ae === void 0 ? ge : B : Et && Et in Object(ae) ? $r(ae) : Hp(ae); } function Zt(ae) { - return Da(ae) && zt(ae) == a; + return Ba(ae) && zt(ae) == a; } function Wt(ae, ye, Ge, Pt, jr) { - return ae === ye ? !0 : ae == null || ye == null || !Da(ae) && !Da(ye) ? ae !== ae && ye !== ye : he(ae, ye, Ge, Pt, Wt, jr); + return ae === ye ? !0 : ae == null || ye == null || !Ba(ae) && !Ba(ye) ? ae !== ae && ye !== ye : he(ae, ye, Ge, Pt, Wt, jr); } function he(ae, ye, Ge, Pt, jr, nr) { - var Kr = Mc(ae), vn = Mc(ye), _r = Kr ? u : Ir(ae), Ur = vn ? u : Ir(ye); - _r = _r == a ? $ : _r, Ur = Ur == a ? $ : Ur; - var an = _r == $, ui = Ur == $, bn = _r == Ur; - if (bn && Xu(ae)) { - if (!Xu(ye)) + var Kr = $c(ae), vn = $c(ye), Er = Kr ? u : Ir(ae), Ur = vn ? u : Ir(ye); + Er = Er == a ? k : Er, Ur = Ur == a ? k : Ur; + var an = Er == k, fi = Ur == k, bn = Er == Ur; + if (bn && sf(ae)) { + if (!sf(ye)) return !1; Kr = !0, an = !1; } if (bn && !an) - return nr || (nr = new ut()), Kr || mh(ae) ? Qt(ae, ye, Ge, Pt, jr, nr) : gr(ae, ye, _r, Ge, Pt, jr, nr); + return nr || (nr = new ut()), Kr || Ah(ae) ? Qt(ae, ye, Ge, Pt, jr, nr) : gr(ae, ye, Er, Ge, Pt, jr, nr); if (!(Ge & i)) { - var Vr = an && ke.call(ae, "__wrapped__"), ti = ui && ke.call(ye, "__wrapped__"); - if (Vr || ti) { - var fs = Vr ? ae.value() : ae, Fi = ti ? ye.value() : ye; - return nr || (nr = new ut()), jr(fs, Fi, Ge, Pt, nr); + var Vr = an && ke.call(ae, "__wrapped__"), ri = fi && ke.call(ye, "__wrapped__"); + if (Vr || ri) { + var hs = Vr ? ae.value() : ae, Ui = ri ? ye.value() : ye; + return nr || (nr = new ut()), jr(hs, Ui, Ge, Pt, nr); } } return bn ? (nr || (nr = new ut()), lr(ae, ye, Ge, Pt, jr, nr)) : !1; } function rr(ae) { - if (!gh(ae) || on(ae)) + if (!Sh(ae) || on(ae)) return !1; - var ye = Ic(ae) ? Ye : F; - return ye.test(io(ae)); + var ye = Bc(ae) ? Ye : F; + return ye.test(ao(ae)); } function dr(ae) { - return Da(ae) && ph(ae.length) && !!D[zt(ae)]; + return Ba(ae) && Eh(ae.length) && !!D[zt(ae)]; } function pr(ae) { - if (!lh(ae)) + if (!wh(ae)) return Dt(ae); var ye = []; for (var Ge in Object(ae)) @@ -17944,41 +18456,41 @@ l0.exports; return ye; } function Qt(ae, ye, Ge, Pt, jr, nr) { - var Kr = Ge & i, vn = ae.length, _r = ye.length; - if (vn != _r && !(Kr && _r > vn)) + var Kr = Ge & i, vn = ae.length, Er = ye.length; + if (vn != Er && !(Kr && Er > vn)) return !1; var Ur = nr.get(ae); if (Ur && nr.get(ye)) return Ur == ye; - var an = -1, ui = !0, bn = Ge & s ? new xt() : void 0; + var an = -1, fi = !0, bn = Ge & s ? new xt() : void 0; for (nr.set(ae, ye), nr.set(ye, ae); ++an < vn; ) { - var Vr = ae[an], ti = ye[an]; + var Vr = ae[an], ri = ye[an]; if (Pt) - var fs = Kr ? Pt(ti, Vr, an, ye, ae, nr) : Pt(Vr, ti, an, ae, ye, nr); - if (fs !== void 0) { - if (fs) + var hs = Kr ? Pt(ri, Vr, an, ye, ae, nr) : Pt(Vr, ri, an, ae, ye, nr); + if (hs !== void 0) { + if (hs) continue; - ui = !1; + fi = !1; break; } if (bn) { - if (!Pe(ye, function(Fi, Is) { - if (!$e(bn, Is) && (Vr === Fi || jr(Vr, Fi, Ge, Pt, nr))) - return bn.push(Is); + if (!Pe(ye, function(Ui, Ds) { + if (!$e(bn, Ds) && (Vr === Ui || jr(Vr, Ui, Ge, Pt, nr))) + return bn.push(Ds); })) { - ui = !1; + fi = !1; break; } - } else if (!(Vr === ti || jr(Vr, ti, Ge, Pt, nr))) { - ui = !1; + } else if (!(Vr === ri || jr(Vr, ri, Ge, Pt, nr))) { + fi = !1; break; } } - return nr.delete(ae), nr.delete(ye), ui; + return nr.delete(ae), nr.delete(ye), fi; } function gr(ae, ye, Ge, Pt, jr, nr, Kr) { switch (Ge) { - case S: + case A: if (ae.byteLength != ye.byteLength || ae.byteOffset != ye.byteOffset) return !1; ae = ae.buffer, ye = ye.buffer; @@ -17987,17 +18499,17 @@ l0.exports; case d: case p: case L: - return hh(+ae, +ye); + return xh(+ae, +ye); case w: return ae.name == ye.name && ae.message == ye.message; case V: case R: return ae == ye + ""; - case N: + case O: var vn = Ne; - case te: - var _r = Pt & i; - if (vn || (vn = Le), ae.size != ye.size && !_r) + case Q: + var Er = Pt & i; + if (vn || (vn = Le), ae.size != ye.size && !Er) return !1; var Ur = Kr.get(ae); if (Ur) @@ -18006,50 +18518,50 @@ l0.exports; var an = Qt(vn(ae), vn(ye), Pt, jr, nr, Kr); return Kr.delete(ae), an; case K: - if (W) - return W.call(ae) == W.call(ye); + if (H) + return H.call(ae) == H.call(ye); } return !1; } function lr(ae, ye, Ge, Pt, jr, nr) { - var Kr = Ge & i, vn = Rr(ae), _r = vn.length, Ur = Rr(ye), an = Ur.length; - if (_r != an && !Kr) + var Kr = Ge & i, vn = Rr(ae), Er = vn.length, Ur = Rr(ye), an = Ur.length; + if (Er != an && !Kr) return !1; - for (var ui = _r; ui--; ) { - var bn = vn[ui]; + for (var fi = Er; fi--; ) { + var bn = vn[fi]; if (!(Kr ? bn in ye : ke.call(ye, bn))) return !1; } var Vr = nr.get(ae); if (Vr && nr.get(ye)) return Vr == ye; - var ti = !0; + var ri = !0; nr.set(ae, ye), nr.set(ye, ae); - for (var fs = Kr; ++ui < _r; ) { - bn = vn[ui]; - var Fi = ae[bn], Is = ye[bn]; + for (var hs = Kr; ++fi < Er; ) { + bn = vn[fi]; + var Ui = ae[bn], Ds = ye[bn]; if (Pt) - var Zu = Kr ? Pt(Is, Fi, bn, ye, ae, nr) : Pt(Fi, Is, bn, ae, ye, nr); - if (!(Zu === void 0 ? Fi === Is || jr(Fi, Is, Ge, Pt, nr) : Zu)) { - ti = !1; + var of = Kr ? Pt(Ds, Ui, bn, ye, ae, nr) : Pt(Ui, Ds, bn, ae, ye, nr); + if (!(of === void 0 ? Ui === Ds || jr(Ui, Ds, Ge, Pt, nr) : of)) { + ri = !1; break; } - fs || (fs = bn == "constructor"); + hs || (hs = bn == "constructor"); } - if (ti && !fs) { - var Oa = ae.constructor, Pn = ye.constructor; - Oa != Pn && "constructor" in ae && "constructor" in ye && !(typeof Oa == "function" && Oa instanceof Oa && typeof Pn == "function" && Pn instanceof Pn) && (ti = !1); + if (ri && !hs) { + var Fa = ae.constructor, Pn = ye.constructor; + Fa != Pn && "constructor" in ae && "constructor" in ye && !(typeof Fa == "function" && Fa instanceof Fa && typeof Pn == "function" && Pn instanceof Pn) && (ri = !1); } - return nr.delete(ae), nr.delete(ye), ti; + return nr.delete(ae), nr.delete(ye), ri; } function Rr(ae) { - return Lt(ae, Np, Br); + return Lt(ae, Gp, Br); } function mr(ae, ye) { var Ge = ae.__data__; return sn(ye) ? Ge[typeof ye == "string" ? "string" : "hash"] : Ge.map; } - function yr(ae, ye) { + function wr(ae, ye) { var Ge = Me(ae, ye); return rr(Ge) ? Ge : void 0; } @@ -18068,19 +18580,19 @@ l0.exports; return qt.call(ae, ye); })); } : Fr, Ir = zt; - (kt && Ir(new kt(new ArrayBuffer(1))) != S || Ct && Ir(new Ct()) != N || gt && Ir(gt.resolve()) != H || Rt && Ir(new Rt()) != te || Nt && Ir(new Nt()) != Ee) && (Ir = function(ae) { - var ye = zt(ae), Ge = ye == $ ? ae.constructor : void 0, Pt = Ge ? io(Ge) : ""; + (kt && Ir(new kt(new ArrayBuffer(1))) != A || Ct && Ir(new Ct()) != O || mt && Ir(mt.resolve()) != q || Rt && Ir(new Rt()) != Q || Nt && Ir(new Nt()) != Ee) && (Ir = function(ae) { + var ye = zt(ae), Ge = ye == k ? ae.constructor : void 0, Pt = Ge ? ao(Ge) : ""; if (Pt) switch (Pt) { case $t: - return S; + return A; case Ft: - return N; + return O; case rt: - return H; + return q; case Bt: - return te; - case k: + return Q; + case $: return Ee; } return ye; @@ -18095,14 +18607,14 @@ l0.exports; function on(ae) { return !!Qe && Qe in ae; } - function lh(ae) { + function wh(ae) { var ye = ae && ae.constructor, Ge = typeof ye == "function" && ye.prototype || _e; return ae === Ge; } - function Rp(ae) { + function Hp(ae) { return tt.call(ae); } - function io(ae) { + function ao(ae) { if (ae != null) { try { return at.call(ae); @@ -18115,40 +18627,40 @@ l0.exports; } return ""; } - function hh(ae, ye) { + function xh(ae, ye) { return ae === ye || ae !== ae && ye !== ye; } - var dh = Zt(/* @__PURE__ */ function() { + var _h = Zt(/* @__PURE__ */ function() { return arguments; }()) ? Zt : function(ae) { - return Da(ae) && ke.call(ae, "callee") && !qt.call(ae, "callee"); - }, Mc = Array.isArray; - function Dp(ae) { - return ae != null && ph(ae.length) && !Ic(ae); + return Ba(ae) && ke.call(ae, "callee") && !qt.call(ae, "callee"); + }, $c = Array.isArray; + function Kp(ae) { + return ae != null && Eh(ae.length) && !Bc(ae); } - var Xu = Xt || Dr; - function Op(ae, ye) { + var sf = Xt || Dr; + function Vp(ae, ye) { return Wt(ae, ye); } - function Ic(ae) { - if (!gh(ae)) + function Bc(ae) { + if (!Sh(ae)) return !1; var ye = zt(ae); - return ye == A || ye == M || ye == l || ye == U; + return ye == _ || ye == P || ye == l || ye == U; } - function ph(ae) { + function Eh(ae) { return typeof ae == "number" && ae > -1 && ae % 1 == 0 && ae <= o; } - function gh(ae) { + function Sh(ae) { var ye = typeof ae; return ae != null && (ye == "object" || ye == "function"); } - function Da(ae) { + function Ba(ae) { return ae != null && typeof ae == "object"; } - var mh = ie ? Ce(ie) : dr; - function Np(ae) { - return Dp(ae) ? Ue(ae) : pr(ae); + var Ah = ie ? Ce(ie) : dr; + function Gp(ae) { + return Kp(ae) ? Ue(ae) : pr(ae); } function Fr() { return []; @@ -18156,11 +18668,11 @@ l0.exports; function Dr() { return !1; } - t.exports = Op; -})(l0, l0.exports); -var HW = l0.exports; -const KW = /* @__PURE__ */ ts(HW), tE = "wc", rE = 2, nE = "core", Qs = `${tE}@2:${nE}:`, VW = { logger: "error" }, GW = { database: ":memory:" }, YW = "crypto", d3 = "client_ed25519_seed", JW = mt.ONE_DAY, XW = "keychain", ZW = "0.3", QW = "messages", eH = "0.3", tH = mt.SIX_HOURS, rH = "publisher", iE = "irn", nH = "error", sE = "wss://relay.walletconnect.org", iH = "relayer", oi = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", publish: "relayer_publish" }, sH = "_subscription", Vi = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, oH = 0.1, T1 = "2.17.2", zr = { link_mode: "link_mode", relay: "relay" }, aH = "0.3", cH = "WALLETCONNECT_CLIENT_ID", p3 = "WALLETCONNECT_LINK_MODE_APPS", Us = { created: "subscription_created", deleted: "subscription_deleted", sync: "subscription_sync", resubscribed: "subscription_resubscribed" }, uH = "subscription", fH = "0.3", lH = mt.FIVE_SECONDS * 1e3, hH = "pairing", dH = "0.3", Mf = { wc_pairingDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1e3 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1001 } }, wc_pairingPing: { req: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1002 }, res: { ttl: mt.THIRTY_SECONDS, prompt: !1, tag: 1003 } }, unregistered_method: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 0 } } }, Za = { create: "pairing_create", expire: "pairing_expire", delete: "pairing_delete", ping: "pairing_ping" }, ms = { created: "history_created", updated: "history_updated", deleted: "history_deleted", sync: "history_sync" }, pH = "history", gH = "0.3", mH = "expirer", Ji = { created: "expirer_created", deleted: "expirer_deleted", expired: "expirer_expired", sync: "expirer_sync" }, vH = "0.3", bH = "verify-api", yH = "https://verify.walletconnect.com", oE = "https://verify.walletconnect.org", Wf = oE, wH = `${Wf}/v3`, xH = [yH, oE], _H = "echo", EH = "https://echo.walletconnect.com", Fs = { pairing_started: "pairing_started", pairing_uri_validation_success: "pairing_uri_validation_success", pairing_uri_not_expired: "pairing_uri_not_expired", store_new_pairing: "store_new_pairing", subscribing_pairing_topic: "subscribing_pairing_topic", subscribe_pairing_topic_success: "subscribe_pairing_topic_success", existing_pairing: "existing_pairing", pairing_not_expired: "pairing_not_expired", emit_inactive_pairing: "emit_inactive_pairing", emit_session_proposal: "emit_session_proposal" }, wo = { no_internet_connection: "no_internet_connection", malformed_pairing_uri: "malformed_pairing_uri", active_pairing_already_exists: "active_pairing_already_exists", subscribe_pairing_topic_failure: "subscribe_pairing_topic_failure", pairing_expired: "pairing_expired", proposal_listener_not_found: "proposal_listener_not_found" }, vs = { session_approve_started: "session_approve_started", session_namespaces_validation_success: "session_namespaces_validation_success", subscribing_session_topic: "subscribing_session_topic", subscribe_session_topic_success: "subscribe_session_topic_success", publishing_session_approve: "publishing_session_approve", session_approve_publish_success: "session_approve_publish_success", store_session: "store_session", publishing_session_settle: "publishing_session_settle", session_settle_publish_success: "session_settle_publish_success" }, Ha = { no_internet_connection: "no_internet_connection", proposal_expired: "proposal_expired", subscribe_session_topic_failure: "subscribe_session_topic_failure", session_approve_publish_failure: "session_approve_publish_failure", session_settle_publish_failure: "session_settle_publish_failure", session_approve_namespace_validation_failure: "session_approve_namespace_validation_failure", proposal_not_found: "proposal_not_found" }, Ka = { authenticated_session_approve_started: "authenticated_session_approve_started", create_authenticated_session_topic: "create_authenticated_session_topic", cacaos_verified: "cacaos_verified", store_authenticated_session: "store_authenticated_session", subscribing_authenticated_session_topic: "subscribing_authenticated_session_topic", subscribe_authenticated_session_topic_success: "subscribe_authenticated_session_topic_success", publishing_authenticated_session_approve: "publishing_authenticated_session_approve" }, If = { no_internet_connection: "no_internet_connection", invalid_cacao: "invalid_cacao", subscribe_authenticated_session_topic_failure: "subscribe_authenticated_session_topic_failure", authenticated_session_approve_publish_failure: "authenticated_session_approve_publish_failure", authenticated_session_pending_request_not_found: "authenticated_session_pending_request_not_found" }, SH = 0.1, AH = "event-client", PH = 86400, MH = "https://pulse.walletconnect.org/batch"; -function IH(t, e) { + t.exports = Vp; +})(E0, E0.exports); +var SH = E0.exports; +const AH = /* @__PURE__ */ ns(SH), CE = "wc", TE = 2, RE = "core", ro = `${CE}@2:${RE}:`, PH = { logger: "error" }, MH = { database: ":memory:" }, IH = "crypto", C3 = "client_ed25519_seed", CH = vt.ONE_DAY, TH = "keychain", RH = "0.3", DH = "messages", OH = "0.3", NH = vt.SIX_HOURS, LH = "publisher", DE = "irn", kH = "error", OE = "wss://relay.walletconnect.org", $H = "relayer", ai = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", publish: "relayer_publish" }, BH = "_subscription", Yi = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, FH = 0.1, K1 = "2.17.2", zr = { link_mode: "link_mode", relay: "relay" }, jH = "0.3", UH = "WALLETCONNECT_CLIENT_ID", T3 = "WALLETCONNECT_LINK_MODE_APPS", Ws = { created: "subscription_created", deleted: "subscription_deleted", sync: "subscription_sync", resubscribed: "subscription_resubscribed" }, qH = "subscription", zH = "0.3", WH = vt.FIVE_SECONDS * 1e3, HH = "pairing", KH = "0.3", Nf = { wc_pairingDelete: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1e3 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1001 } }, wc_pairingPing: { req: { ttl: vt.THIRTY_SECONDS, prompt: !1, tag: 1002 }, res: { ttl: vt.THIRTY_SECONDS, prompt: !1, tag: 1003 } }, unregistered_method: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 0 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 0 } } }, ic = { create: "pairing_create", expire: "pairing_expire", delete: "pairing_delete", ping: "pairing_ping" }, ys = { created: "history_created", updated: "history_updated", deleted: "history_deleted", sync: "history_sync" }, VH = "history", GH = "0.3", YH = "expirer", Zi = { created: "expirer_created", deleted: "expirer_deleted", expired: "expirer_expired", sync: "expirer_sync" }, JH = "0.3", XH = "verify-api", ZH = "https://verify.walletconnect.com", NE = "https://verify.walletconnect.org", Xf = NE, QH = `${Xf}/v3`, eK = [ZH, NE], tK = "echo", rK = "https://echo.walletconnect.com", qs = { pairing_started: "pairing_started", pairing_uri_validation_success: "pairing_uri_validation_success", pairing_uri_not_expired: "pairing_uri_not_expired", store_new_pairing: "store_new_pairing", subscribing_pairing_topic: "subscribing_pairing_topic", subscribe_pairing_topic_success: "subscribe_pairing_topic_success", existing_pairing: "existing_pairing", pairing_not_expired: "pairing_not_expired", emit_inactive_pairing: "emit_inactive_pairing", emit_session_proposal: "emit_session_proposal" }, So = { no_internet_connection: "no_internet_connection", malformed_pairing_uri: "malformed_pairing_uri", active_pairing_already_exists: "active_pairing_already_exists", subscribe_pairing_topic_failure: "subscribe_pairing_topic_failure", pairing_expired: "pairing_expired", proposal_listener_not_found: "proposal_listener_not_found" }, ws = { session_approve_started: "session_approve_started", session_namespaces_validation_success: "session_namespaces_validation_success", subscribing_session_topic: "subscribing_session_topic", subscribe_session_topic_success: "subscribe_session_topic_success", publishing_session_approve: "publishing_session_approve", session_approve_publish_success: "session_approve_publish_success", store_session: "store_session", publishing_session_settle: "publishing_session_settle", session_settle_publish_success: "session_settle_publish_success" }, Xa = { no_internet_connection: "no_internet_connection", proposal_expired: "proposal_expired", subscribe_session_topic_failure: "subscribe_session_topic_failure", session_approve_publish_failure: "session_approve_publish_failure", session_settle_publish_failure: "session_settle_publish_failure", session_approve_namespace_validation_failure: "session_approve_namespace_validation_failure", proposal_not_found: "proposal_not_found" }, Za = { authenticated_session_approve_started: "authenticated_session_approve_started", create_authenticated_session_topic: "create_authenticated_session_topic", cacaos_verified: "cacaos_verified", store_authenticated_session: "store_authenticated_session", subscribing_authenticated_session_topic: "subscribing_authenticated_session_topic", subscribe_authenticated_session_topic_success: "subscribe_authenticated_session_topic_success", publishing_authenticated_session_approve: "publishing_authenticated_session_approve" }, Lf = { no_internet_connection: "no_internet_connection", invalid_cacao: "invalid_cacao", subscribe_authenticated_session_topic_failure: "subscribe_authenticated_session_topic_failure", authenticated_session_approve_publish_failure: "authenticated_session_approve_publish_failure", authenticated_session_pending_request_not_found: "authenticated_session_pending_request_not_found" }, nK = 0.1, iK = "event-client", sK = 86400, oK = "https://pulse.walletconnect.org/batch"; +function aK(t, e) { if (t.length >= 255) throw new TypeError("Alphabet too long"); for (var r = new Uint8Array(256), n = 0; n < r.length; n++) r[n] = 255; for (var i = 0; i < t.length; i++) { @@ -18169,54 +18681,54 @@ function IH(t, e) { r[o] = i; } var a = t.length, u = t.charAt(0), l = Math.log(a) / Math.log(256), d = Math.log(256) / Math.log(a); - function p(M) { - if (M instanceof Uint8Array || (ArrayBuffer.isView(M) ? M = new Uint8Array(M.buffer, M.byteOffset, M.byteLength) : Array.isArray(M) && (M = Uint8Array.from(M))), !(M instanceof Uint8Array)) throw new TypeError("Expected Uint8Array"); - if (M.length === 0) return ""; - for (var N = 0, L = 0, B = 0, $ = M.length; B !== $ && M[B] === 0; ) B++, N++; - for (var H = ($ - B) * d + 1 >>> 0, U = new Uint8Array(H); B !== $; ) { - for (var V = M[B], te = 0, R = H - 1; (V !== 0 || te < L) && R !== -1; R--, te++) V += 256 * U[R] >>> 0, U[R] = V % a >>> 0, V = V / a >>> 0; + function p(P) { + if (P instanceof Uint8Array || (ArrayBuffer.isView(P) ? P = new Uint8Array(P.buffer, P.byteOffset, P.byteLength) : Array.isArray(P) && (P = Uint8Array.from(P))), !(P instanceof Uint8Array)) throw new TypeError("Expected Uint8Array"); + if (P.length === 0) return ""; + for (var O = 0, L = 0, B = 0, k = P.length; B !== k && P[B] === 0; ) B++, O++; + for (var q = (k - B) * d + 1 >>> 0, U = new Uint8Array(q); B !== k; ) { + for (var V = P[B], Q = 0, R = q - 1; (V !== 0 || Q < L) && R !== -1; R--, Q++) V += 256 * U[R] >>> 0, U[R] = V % a >>> 0, V = V / a >>> 0; if (V !== 0) throw new Error("Non-zero carry"); - L = te, B++; + L = Q, B++; } - for (var K = H - L; K !== H && U[K] === 0; ) K++; - for (var ge = u.repeat(N); K < H; ++K) ge += t.charAt(U[K]); + for (var K = q - L; K !== q && U[K] === 0; ) K++; + for (var ge = u.repeat(O); K < q; ++K) ge += t.charAt(U[K]); return ge; } - function w(M) { - if (typeof M != "string") throw new TypeError("Expected String"); - if (M.length === 0) return new Uint8Array(); - var N = 0; - if (M[N] !== " ") { - for (var L = 0, B = 0; M[N] === u; ) L++, N++; - for (var $ = (M.length - N) * l + 1 >>> 0, H = new Uint8Array($); M[N]; ) { - var U = r[M.charCodeAt(N)]; + function w(P) { + if (typeof P != "string") throw new TypeError("Expected String"); + if (P.length === 0) return new Uint8Array(); + var O = 0; + if (P[O] !== " ") { + for (var L = 0, B = 0; P[O] === u; ) L++, O++; + for (var k = (P.length - O) * l + 1 >>> 0, q = new Uint8Array(k); P[O]; ) { + var U = r[P.charCodeAt(O)]; if (U === 255) return; - for (var V = 0, te = $ - 1; (U !== 0 || V < B) && te !== -1; te--, V++) U += a * H[te] >>> 0, H[te] = U % 256 >>> 0, U = U / 256 >>> 0; + for (var V = 0, Q = k - 1; (U !== 0 || V < B) && Q !== -1; Q--, V++) U += a * q[Q] >>> 0, q[Q] = U % 256 >>> 0, U = U / 256 >>> 0; if (U !== 0) throw new Error("Non-zero carry"); - B = V, N++; + B = V, O++; } - if (M[N] !== " ") { - for (var R = $ - B; R !== $ && H[R] === 0; ) R++; - for (var K = new Uint8Array(L + ($ - R)), ge = L; R !== $; ) K[ge++] = H[R++]; + if (P[O] !== " ") { + for (var R = k - B; R !== k && q[R] === 0; ) R++; + for (var K = new Uint8Array(L + (k - R)), ge = L; R !== k; ) K[ge++] = q[R++]; return K; } } } - function A(M) { - var N = w(M); - if (N) return N; + function _(P) { + var O = w(P); + if (O) return O; throw new Error(`Non-${e} character`); } - return { encode: p, decodeUnsafe: w, decode: A }; + return { encode: p, decodeUnsafe: w, decode: _ }; } -var CH = IH, TH = CH; -const aE = (t) => { +var cK = aK, uK = cK; +const LE = (t) => { if (t instanceof Uint8Array && t.constructor.name === "Uint8Array") return t; if (t instanceof ArrayBuffer) return new Uint8Array(t); if (ArrayBuffer.isView(t)) return new Uint8Array(t.buffer, t.byteOffset, t.byteLength); throw new Error("Unknown type, must be binary type"); -}, RH = (t) => new TextEncoder().encode(t), DH = (t) => new TextDecoder().decode(t); -class OH { +}, fK = (t) => new TextEncoder().encode(t), lK = (t) => new TextDecoder().decode(t); +class hK { constructor(e, r, n) { this.name = e, this.prefix = r, this.baseEncode = n; } @@ -18225,7 +18737,7 @@ class OH { throw Error("Unknown type, must be binary type"); } } -class NH { +class dK { constructor(e, r, n) { if (this.name = e, this.prefix = r, r.codePointAt(0) === void 0) throw new Error("Invalid prefix character"); this.prefixCodePoint = r.codePointAt(0), this.baseDecode = n; @@ -18237,15 +18749,15 @@ class NH { } else throw Error("Can only multibase decode strings"); } or(e) { - return cE(this, e); + return kE(this, e); } } -class LH { +class pK { constructor(e) { this.decoders = e; } or(e) { - return cE(this, e); + return kE(this, e); } decode(e) { const r = e[0], n = this.decoders[r]; @@ -18253,10 +18765,10 @@ class LH { throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`); } } -const cE = (t, e) => new LH({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); -class kH { +const kE = (t, e) => new pK({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); +class gK { constructor(e, r, n, i) { - this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new OH(e, r, n), this.decoder = new NH(e, r, i); + this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new hK(e, r, n), this.decoder = new dK(e, r, i); } encode(e) { return this.encoder.encode(e); @@ -18265,10 +18777,10 @@ class kH { return this.decoder.decode(e); } } -const sp = ({ name: t, prefix: e, encode: r, decode: n }) => new kH(t, e, r, n), rh = ({ prefix: t, name: e, alphabet: r }) => { - const { encode: n, decode: i } = TH(r, e); - return sp({ prefix: t, name: e, encode: n, decode: (s) => aE(i(s)) }); -}, $H = (t, e, r, n) => { +const yp = ({ name: t, prefix: e, encode: r, decode: n }) => new gK(t, e, r, n), lh = ({ prefix: t, name: e, alphabet: r }) => { + const { encode: n, decode: i } = uK(r, e); + return yp({ prefix: t, name: e, encode: n, decode: (s) => LE(i(s)) }); +}, mK = (t, e, r, n) => { const i = {}; for (let d = 0; d < e.length; ++d) i[e[d]] = d; let s = t.length; @@ -18282,119 +18794,119 @@ const sp = ({ name: t, prefix: e, encode: r, decode: n }) => new kH(t, e, r, n), } if (a >= r || 255 & u << 8 - a) throw new SyntaxError("Unexpected end of data"); return o; -}, BH = (t, e, r) => { +}, vK = (t, e, r) => { const n = e[e.length - 1] === "=", i = (1 << r) - 1; let s = "", o = 0, a = 0; for (let u = 0; u < t.length; ++u) for (a = a << 8 | t[u], o += 8; o > r; ) o -= r, s += e[i & a >> o]; if (o && (s += e[i & a << r - o]), n) for (; s.length * r & 7; ) s += "="; return s; -}, Hn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => sp({ prefix: e, name: t, encode(i) { - return BH(i, n, r); +}, Hn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => yp({ prefix: e, name: t, encode(i) { + return vK(i, n, r); }, decode(i) { - return $H(i, n, r, t); -} }), FH = sp({ prefix: "\0", name: "identity", encode: (t) => DH(t), decode: (t) => RH(t) }); -var jH = Object.freeze({ __proto__: null, identity: FH }); -const UH = Hn({ prefix: "0", name: "base2", alphabet: "01", bitsPerChar: 1 }); -var qH = Object.freeze({ __proto__: null, base2: UH }); -const zH = Hn({ prefix: "7", name: "base8", alphabet: "01234567", bitsPerChar: 3 }); -var WH = Object.freeze({ __proto__: null, base8: zH }); -const HH = rh({ prefix: "9", name: "base10", alphabet: "0123456789" }); -var KH = Object.freeze({ __proto__: null, base10: HH }); -const VH = Hn({ prefix: "f", name: "base16", alphabet: "0123456789abcdef", bitsPerChar: 4 }), GH = Hn({ prefix: "F", name: "base16upper", alphabet: "0123456789ABCDEF", bitsPerChar: 4 }); -var YH = Object.freeze({ __proto__: null, base16: VH, base16upper: GH }); -const JH = Hn({ prefix: "b", name: "base32", alphabet: "abcdefghijklmnopqrstuvwxyz234567", bitsPerChar: 5 }), XH = Hn({ prefix: "B", name: "base32upper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", bitsPerChar: 5 }), ZH = Hn({ prefix: "c", name: "base32pad", alphabet: "abcdefghijklmnopqrstuvwxyz234567=", bitsPerChar: 5 }), QH = Hn({ prefix: "C", name: "base32padupper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", bitsPerChar: 5 }), eK = Hn({ prefix: "v", name: "base32hex", alphabet: "0123456789abcdefghijklmnopqrstuv", bitsPerChar: 5 }), tK = Hn({ prefix: "V", name: "base32hexupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", bitsPerChar: 5 }), rK = Hn({ prefix: "t", name: "base32hexpad", alphabet: "0123456789abcdefghijklmnopqrstuv=", bitsPerChar: 5 }), nK = Hn({ prefix: "T", name: "base32hexpadupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=", bitsPerChar: 5 }), iK = Hn({ prefix: "h", name: "base32z", alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769", bitsPerChar: 5 }); -var sK = Object.freeze({ __proto__: null, base32: JH, base32upper: XH, base32pad: ZH, base32padupper: QH, base32hex: eK, base32hexupper: tK, base32hexpad: rK, base32hexpadupper: nK, base32z: iK }); -const oK = rh({ prefix: "k", name: "base36", alphabet: "0123456789abcdefghijklmnopqrstuvwxyz" }), aK = rh({ prefix: "K", name: "base36upper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" }); -var cK = Object.freeze({ __proto__: null, base36: oK, base36upper: aK }); -const uK = rh({ name: "base58btc", prefix: "z", alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" }), fK = rh({ name: "base58flickr", prefix: "Z", alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" }); -var lK = Object.freeze({ __proto__: null, base58btc: uK, base58flickr: fK }); -const hK = Hn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 }), dK = Hn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 }), pK = Hn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 }), gK = Hn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", bitsPerChar: 6 }); -var mK = Object.freeze({ __proto__: null, base64: hK, base64pad: dK, base64url: pK, base64urlpad: gK }); -const uE = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), vK = uE.reduce((t, e, r) => (t[r] = e, t), []), bK = uE.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); -function yK(t) { - return t.reduce((e, r) => (e += vK[r], e), ""); -} -function wK(t) { + return mK(i, n, r, t); +} }), bK = yp({ prefix: "\0", name: "identity", encode: (t) => lK(t), decode: (t) => fK(t) }); +var yK = Object.freeze({ __proto__: null, identity: bK }); +const wK = Hn({ prefix: "0", name: "base2", alphabet: "01", bitsPerChar: 1 }); +var xK = Object.freeze({ __proto__: null, base2: wK }); +const _K = Hn({ prefix: "7", name: "base8", alphabet: "01234567", bitsPerChar: 3 }); +var EK = Object.freeze({ __proto__: null, base8: _K }); +const SK = lh({ prefix: "9", name: "base10", alphabet: "0123456789" }); +var AK = Object.freeze({ __proto__: null, base10: SK }); +const PK = Hn({ prefix: "f", name: "base16", alphabet: "0123456789abcdef", bitsPerChar: 4 }), MK = Hn({ prefix: "F", name: "base16upper", alphabet: "0123456789ABCDEF", bitsPerChar: 4 }); +var IK = Object.freeze({ __proto__: null, base16: PK, base16upper: MK }); +const CK = Hn({ prefix: "b", name: "base32", alphabet: "abcdefghijklmnopqrstuvwxyz234567", bitsPerChar: 5 }), TK = Hn({ prefix: "B", name: "base32upper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", bitsPerChar: 5 }), RK = Hn({ prefix: "c", name: "base32pad", alphabet: "abcdefghijklmnopqrstuvwxyz234567=", bitsPerChar: 5 }), DK = Hn({ prefix: "C", name: "base32padupper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", bitsPerChar: 5 }), OK = Hn({ prefix: "v", name: "base32hex", alphabet: "0123456789abcdefghijklmnopqrstuv", bitsPerChar: 5 }), NK = Hn({ prefix: "V", name: "base32hexupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", bitsPerChar: 5 }), LK = Hn({ prefix: "t", name: "base32hexpad", alphabet: "0123456789abcdefghijklmnopqrstuv=", bitsPerChar: 5 }), kK = Hn({ prefix: "T", name: "base32hexpadupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=", bitsPerChar: 5 }), $K = Hn({ prefix: "h", name: "base32z", alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769", bitsPerChar: 5 }); +var BK = Object.freeze({ __proto__: null, base32: CK, base32upper: TK, base32pad: RK, base32padupper: DK, base32hex: OK, base32hexupper: NK, base32hexpad: LK, base32hexpadupper: kK, base32z: $K }); +const FK = lh({ prefix: "k", name: "base36", alphabet: "0123456789abcdefghijklmnopqrstuvwxyz" }), jK = lh({ prefix: "K", name: "base36upper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" }); +var UK = Object.freeze({ __proto__: null, base36: FK, base36upper: jK }); +const qK = lh({ name: "base58btc", prefix: "z", alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" }), zK = lh({ name: "base58flickr", prefix: "Z", alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" }); +var WK = Object.freeze({ __proto__: null, base58btc: qK, base58flickr: zK }); +const HK = Hn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 }), KK = Hn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 }), VK = Hn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 }), GK = Hn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", bitsPerChar: 6 }); +var YK = Object.freeze({ __proto__: null, base64: HK, base64pad: KK, base64url: VK, base64urlpad: GK }); +const $E = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), JK = $E.reduce((t, e, r) => (t[r] = e, t), []), XK = $E.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); +function ZK(t) { + return t.reduce((e, r) => (e += JK[r], e), ""); +} +function QK(t) { const e = []; for (const r of t) { - const n = bK[r.codePointAt(0)]; + const n = XK[r.codePointAt(0)]; if (n === void 0) throw new Error(`Non-base256emoji character: ${r}`); e.push(n); } return new Uint8Array(e); } -const xK = sp({ prefix: "🚀", name: "base256emoji", encode: yK, decode: wK }); -var _K = Object.freeze({ __proto__: null, base256emoji: xK }), EK = fE, g3 = 128, SK = 127, AK = ~SK, PK = Math.pow(2, 31); -function fE(t, e, r) { +const eV = yp({ prefix: "🚀", name: "base256emoji", encode: ZK, decode: QK }); +var tV = Object.freeze({ __proto__: null, base256emoji: eV }), rV = BE, R3 = 128, nV = 127, iV = ~nV, sV = Math.pow(2, 31); +function BE(t, e, r) { e = e || [], r = r || 0; - for (var n = r; t >= PK; ) e[r++] = t & 255 | g3, t /= 128; - for (; t & AK; ) e[r++] = t & 255 | g3, t >>>= 7; - return e[r] = t | 0, fE.bytes = r - n + 1, e; + for (var n = r; t >= sV; ) e[r++] = t & 255 | R3, t /= 128; + for (; t & iV; ) e[r++] = t & 255 | R3, t >>>= 7; + return e[r] = t | 0, BE.bytes = r - n + 1, e; } -var MK = R1, IK = 128, m3 = 127; -function R1(t, n) { +var oV = V1, aV = 128, D3 = 127; +function V1(t, n) { var r = 0, n = n || 0, i = 0, s = n, o, a = t.length; do { - if (s >= a) throw R1.bytes = 0, new RangeError("Could not decode varint"); - o = t[s++], r += i < 28 ? (o & m3) << i : (o & m3) * Math.pow(2, i), i += 7; - } while (o >= IK); - return R1.bytes = s - n, r; -} -var CK = Math.pow(2, 7), TK = Math.pow(2, 14), RK = Math.pow(2, 21), DK = Math.pow(2, 28), OK = Math.pow(2, 35), NK = Math.pow(2, 42), LK = Math.pow(2, 49), kK = Math.pow(2, 56), $K = Math.pow(2, 63), BK = function(t) { - return t < CK ? 1 : t < TK ? 2 : t < RK ? 3 : t < DK ? 4 : t < OK ? 5 : t < NK ? 6 : t < LK ? 7 : t < kK ? 8 : t < $K ? 9 : 10; -}, FK = { encode: EK, decode: MK, encodingLength: BK }, lE = FK; -const v3 = (t, e, r = 0) => (lE.encode(t, e, r), e), b3 = (t) => lE.encodingLength(t), D1 = (t, e) => { - const r = e.byteLength, n = b3(t), i = n + b3(r), s = new Uint8Array(i + r); - return v3(t, s, 0), v3(r, s, n), s.set(e, i), new jK(t, r, e, s); -}; -class jK { + if (s >= a) throw V1.bytes = 0, new RangeError("Could not decode varint"); + o = t[s++], r += i < 28 ? (o & D3) << i : (o & D3) * Math.pow(2, i), i += 7; + } while (o >= aV); + return V1.bytes = s - n, r; +} +var cV = Math.pow(2, 7), uV = Math.pow(2, 14), fV = Math.pow(2, 21), lV = Math.pow(2, 28), hV = Math.pow(2, 35), dV = Math.pow(2, 42), pV = Math.pow(2, 49), gV = Math.pow(2, 56), mV = Math.pow(2, 63), vV = function(t) { + return t < cV ? 1 : t < uV ? 2 : t < fV ? 3 : t < lV ? 4 : t < hV ? 5 : t < dV ? 6 : t < pV ? 7 : t < gV ? 8 : t < mV ? 9 : 10; +}, bV = { encode: rV, decode: oV, encodingLength: vV }, FE = bV; +const O3 = (t, e, r = 0) => (FE.encode(t, e, r), e), N3 = (t) => FE.encodingLength(t), G1 = (t, e) => { + const r = e.byteLength, n = N3(t), i = n + N3(r), s = new Uint8Array(i + r); + return O3(t, s, 0), O3(r, s, n), s.set(e, i), new yV(t, r, e, s); +}; +class yV { constructor(e, r, n, i) { this.code = e, this.size = r, this.digest = n, this.bytes = i; } } -const hE = ({ name: t, code: e, encode: r }) => new UK(t, e, r); -class UK { +const jE = ({ name: t, code: e, encode: r }) => new wV(t, e, r); +class wV { constructor(e, r, n) { this.name = e, this.code = r, this.encode = n; } digest(e) { if (e instanceof Uint8Array) { const r = this.encode(e); - return r instanceof Uint8Array ? D1(this.code, r) : r.then((n) => D1(this.code, n)); + return r instanceof Uint8Array ? G1(this.code, r) : r.then((n) => G1(this.code, n)); } else throw Error("Unknown type, must be binary type"); } } -const dE = (t) => async (e) => new Uint8Array(await crypto.subtle.digest(t, e)), qK = hE({ name: "sha2-256", code: 18, encode: dE("SHA-256") }), zK = hE({ name: "sha2-512", code: 19, encode: dE("SHA-512") }); -var WK = Object.freeze({ __proto__: null, sha256: qK, sha512: zK }); -const pE = 0, HK = "identity", gE = aE, KK = (t) => D1(pE, gE(t)), VK = { code: pE, name: HK, encode: gE, digest: KK }; -var GK = Object.freeze({ __proto__: null, identity: VK }); +const UE = (t) => async (e) => new Uint8Array(await crypto.subtle.digest(t, e)), xV = jE({ name: "sha2-256", code: 18, encode: UE("SHA-256") }), _V = jE({ name: "sha2-512", code: 19, encode: UE("SHA-512") }); +var EV = Object.freeze({ __proto__: null, sha256: xV, sha512: _V }); +const qE = 0, SV = "identity", zE = LE, AV = (t) => G1(qE, zE(t)), PV = { code: qE, name: SV, encode: zE, digest: AV }; +var MV = Object.freeze({ __proto__: null, identity: PV }); new TextEncoder(), new TextDecoder(); -const y3 = { ...jH, ...qH, ...WH, ...KH, ...YH, ...sK, ...cK, ...lK, ...mK, ..._K }; -({ ...WK, ...GK }); -function YK(t = 0) { +const L3 = { ...yK, ...xK, ...EK, ...AK, ...IK, ...BK, ...UK, ...WK, ...YK, ...tV }; +({ ...EV, ...MV }); +function IV(t = 0) { return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); } -function mE(t, e, r, n) { +function WE(t, e, r, n) { return { name: t, prefix: e, encoder: { name: t, prefix: e, encode: r }, decoder: { decode: n } }; } -const w3 = mE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), pm = mE("ascii", "a", (t) => { +const k3 = WE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), Im = WE("ascii", "a", (t) => { let e = "a"; for (let r = 0; r < t.length; r++) e += String.fromCharCode(t[r]); return e; }, (t) => { t = t.substring(1); - const e = YK(t.length); + const e = IV(t.length); for (let r = 0; r < t.length; r++) e[r] = t.charCodeAt(r); return e; -}), JK = { utf8: w3, "utf-8": w3, hex: y3.base16, latin1: pm, ascii: pm, binary: pm, ...y3 }; -function XK(t, e = "utf8") { - const r = JK[e]; +}), CV = { utf8: k3, "utf-8": k3, hex: L3.base16, latin1: Im, ascii: Im, binary: Im, ...L3 }; +function TV(t, e = "utf8") { + const r = CV[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t, "utf8") : r.decoder.decode(`${r.prefix}${t}`); } -let ZK = class { +let RV = class { constructor(e, r) { - this.core = e, this.logger = r, this.keychain = /* @__PURE__ */ new Map(), this.name = XW, this.version = ZW, this.initialized = !1, this.storagePrefix = Qs, this.init = async () => { + this.core = e, this.logger = r, this.keychain = /* @__PURE__ */ new Map(), this.name = TH, this.version = RH, this.initialized = !1, this.storagePrefix = ro, this.init = async () => { if (!this.initialized) { const n = await this.getKeyChain(); typeof n < "u" && (this.keychain = n), this.initialized = !0; @@ -18411,20 +18923,20 @@ let ZK = class { return i; }, this.del = async (n) => { this.isInitialized(), this.keychain.delete(n), await this.persist(); - }, this.core = e, this.logger = ci(r, this.name); + }, this.core = e, this.logger = ui(r, this.name); } get context() { - return Ai(this.logger); + return Pi(this.logger); } get storageKey() { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; } async setKeyChain(e) { - await this.core.storage.setItem(this.storageKey, L8(e)); + await this.core.storage.setItem(this.storageKey, uE(e)); } async getKeyChain() { const e = await this.core.storage.getItem(this.storageKey); - return typeof e < "u" ? k8(e) : void 0; + return typeof e < "u" ? fE(e) : void 0; } async persist() { await this.setKeyChain(this.keychain); @@ -18435,29 +18947,29 @@ let ZK = class { throw new Error(e); } } -}, QK = class { +}, DV = class { constructor(e, r, n) { - this.core = e, this.logger = r, this.name = YW, this.randomSessionIdentifier = I1(), this.initialized = !1, this.init = async () => { + this.core = e, this.logger = r, this.name = IH, this.randomSessionIdentifier = W1(), this.initialized = !1, this.init = async () => { this.initialized || (await this.keychain.init(), this.initialized = !0); }, this.hasKeys = (i) => (this.isInitialized(), this.keychain.has(i)), this.getClientId = async () => { this.isInitialized(); - const i = await this.getClientSeed(), s = sx(i); - return U4(s.publicKey); + const i = await this.getClientSeed(), s = xx(i); + return g8(s.publicKey); }, this.generateKeyPair = () => { this.isInitialized(); - const i = _z(); + const i = tW(); return this.setPrivateKey(i.publicKey, i.privateKey); }, this.signJWT = async (i) => { this.isInitialized(); - const s = await this.getClientSeed(), o = sx(s), a = this.randomSessionIdentifier; - return await HB(a, i, JW, o); + const s = await this.getClientSeed(), o = xx(s), a = this.randomSessionIdentifier; + return await SF(a, i, CH, o); }, this.generateSharedKey = (i, s, o) => { this.isInitialized(); - const a = this.getPrivateKey(i), u = Ez(a, s); + const a = this.getPrivateKey(i), u = rW(a, s); return this.setSymKey(u, o); }, this.setSymKey = async (i, s) => { this.isInitialized(); - const o = s || Td(i); + const o = s || qd(i); return await this.keychain.set(o, i), o; }, this.deleteKeyPair = async (i) => { this.isInitialized(), await this.keychain.del(i); @@ -18465,41 +18977,41 @@ let ZK = class { this.isInitialized(), await this.keychain.del(i); }, this.encode = async (i, s, o) => { this.isInitialized(); - const a = K8(o), u = $o(s); - if (Gx(a)) return Az(u, o == null ? void 0 : o.encoding); - if (Vx(a)) { - const w = a.senderPublicKey, A = a.receiverPublicKey; - i = await this.generateSharedKey(w, A); + const a = wE(o), u = jo(s); + if (f3(a)) return iW(u, o == null ? void 0 : o.encoding); + if (u3(a)) { + const w = a.senderPublicKey, _ = a.receiverPublicKey; + i = await this.generateSharedKey(w, _); } const l = this.getSymKey(i), { type: d, senderPublicKey: p } = a; - return Sz({ type: d, symKey: l, message: u, senderPublicKey: p, encoding: o == null ? void 0 : o.encoding }); + return nW({ type: d, symKey: l, message: u, senderPublicKey: p, encoding: o == null ? void 0 : o.encoding }); }, this.decode = async (i, s, o) => { this.isInitialized(); - const a = Iz(s, o); - if (Gx(a)) { - const u = Mz(s, o == null ? void 0 : o.encoding); - return fc(u); + const a = aW(s, o); + if (f3(a)) { + const u = oW(s, o == null ? void 0 : o.encoding); + return bc(u); } - if (Vx(a)) { + if (u3(a)) { const u = a.receiverPublicKey, l = a.senderPublicKey; i = await this.generateSharedKey(u, l); } try { - const u = this.getSymKey(i), l = Pz({ symKey: u, encoded: s, encoding: o == null ? void 0 : o.encoding }); - return fc(l); + const u = this.getSymKey(i), l = sW({ symKey: u, encoded: s, encoding: o == null ? void 0 : o.encoding }); + return bc(l); } catch (u) { this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`), this.logger.error(u); } - }, this.getPayloadType = (i, s = ha) => { - const o = El({ encoded: i, encoding: s }); - return dc(o.type); - }, this.getPayloadSenderPublicKey = (i, s = ha) => { - const o = El({ encoded: i, encoding: s }); - return o.senderPublicKey ? On(o.senderPublicKey, ai) : void 0; - }, this.core = e, this.logger = ci(r, this.name), this.keychain = n || new ZK(this.core, this.logger); + }, this.getPayloadType = (i, s = pa) => { + const o = Nl({ encoded: i, encoding: s }); + return xc(o.type); + }, this.getPayloadSenderPublicKey = (i, s = pa) => { + const o = Nl({ encoded: i, encoding: s }); + return o.senderPublicKey ? On(o.senderPublicKey, ci) : void 0; + }, this.core = e, this.logger = ui(r, this.name), this.keychain = n || new RV(this.core, this.logger); } get context() { - return Ai(this.logger); + return Pi(this.logger); } async setPrivateKey(e, r) { return await this.keychain.set(e, r), e; @@ -18510,11 +19022,11 @@ let ZK = class { async getClientSeed() { let e = ""; try { - e = this.keychain.get(d3); + e = this.keychain.get(C3); } catch { - e = I1(), await this.keychain.set(d3, e); + e = W1(), await this.keychain.set(C3, e); } - return XK(e, "base16"); + return TV(e, "base16"); } getSymKey(e) { return this.keychain.get(e); @@ -18526,9 +19038,9 @@ let ZK = class { } } }; -class eV extends Xk { +class OV extends T$ { constructor(e, r) { - super(e, r), this.logger = e, this.core = r, this.messages = /* @__PURE__ */ new Map(), this.name = QW, this.version = eH, this.initialized = !1, this.storagePrefix = Qs, this.init = async () => { + super(e, r), this.logger = e, this.core = r, this.messages = /* @__PURE__ */ new Map(), this.name = DH, this.version = OH, this.initialized = !1, this.storagePrefix = ro, this.init = async () => { if (!this.initialized) { this.logger.trace("Initialized"); try { @@ -18542,7 +19054,7 @@ class eV extends Xk { } }, this.set = async (n, i) => { this.isInitialized(); - const s = xo(i); + const s = Ao(i); let o = this.messages.get(n); return typeof o > "u" && (o = {}), typeof o[s] < "u" || (o[s] = i, this.messages.set(n, o), await this.persist()), s; }, this.get = (n) => { @@ -18551,24 +19063,24 @@ class eV extends Xk { return typeof i > "u" && (i = {}), i; }, this.has = (n, i) => { this.isInitialized(); - const s = this.get(n), o = xo(i); + const s = this.get(n), o = Ao(i); return typeof s[o] < "u"; }, this.del = async (n) => { this.isInitialized(), this.messages.delete(n), await this.persist(); - }, this.logger = ci(e, this.name), this.core = r; + }, this.logger = ui(e, this.name), this.core = r; } get context() { - return Ai(this.logger); + return Pi(this.logger); } get storageKey() { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; } async setRelayerMessages(e) { - await this.core.storage.setItem(this.storageKey, L8(e)); + await this.core.storage.setItem(this.storageKey, uE(e)); } async getRelayerMessages() { const e = await this.core.storage.getItem(this.storageKey); - return typeof e < "u" ? k8(e) : void 0; + return typeof e < "u" ? fE(e) : void 0; } async persist() { await this.setRelayerMessages(this.messages); @@ -18580,19 +19092,19 @@ class eV extends Xk { } } } -class tV extends Zk { +class NV extends R$ { constructor(e, r) { - super(e, r), this.relayer = e, this.logger = r, this.events = new rs.EventEmitter(), this.name = rH, this.queue = /* @__PURE__ */ new Map(), this.publishTimeout = mt.toMiliseconds(mt.ONE_MINUTE), this.failedPublishTimeout = mt.toMiliseconds(mt.ONE_SECOND), this.needsTransportRestart = !1, this.publish = async (n, i, s) => { + super(e, r), this.relayer = e, this.logger = r, this.events = new is.EventEmitter(), this.name = LH, this.queue = /* @__PURE__ */ new Map(), this.publishTimeout = vt.toMiliseconds(vt.ONE_MINUTE), this.failedPublishTimeout = vt.toMiliseconds(vt.ONE_SECOND), this.needsTransportRestart = !1, this.publish = async (n, i, s) => { var o; this.logger.debug("Publishing Payload"), this.logger.trace({ type: "method", method: "publish", params: { topic: n, message: i, opts: s } }); - const a = (s == null ? void 0 : s.ttl) || tH, u = C1(s), l = (s == null ? void 0 : s.prompt) || !1, d = (s == null ? void 0 : s.tag) || 0, p = (s == null ? void 0 : s.id) || nc().toString(), w = { topic: n, message: i, opts: { ttl: a, relay: u, prompt: l, tag: d, id: p, attestation: s == null ? void 0 : s.attestation } }, A = `Failed to publish payload, please try again. id:${p} tag:${d}`, M = Date.now(); - let N, L = 1; + const a = (s == null ? void 0 : s.ttl) || NH, u = H1(s), l = (s == null ? void 0 : s.prompt) || !1, d = (s == null ? void 0 : s.tag) || 0, p = (s == null ? void 0 : s.id) || fc().toString(), w = { topic: n, message: i, opts: { ttl: a, relay: u, prompt: l, tag: d, id: p, attestation: s == null ? void 0 : s.attestation } }, _ = `Failed to publish payload, please try again. id:${p} tag:${d}`, P = Date.now(); + let O, L = 1; try { - for (; N === void 0; ) { - if (Date.now() - M > this.publishTimeout) throw new Error(A); - this.logger.trace({ id: p, attempts: L }, `publisher.publish - attempt ${L}`), N = await await du(this.rpcPublish(n, i, a, u, l, d, p, s == null ? void 0 : s.attestation).catch((B) => this.logger.warn(B)), this.publishTimeout, A), L++, N || await new Promise((B) => setTimeout(B, this.failedPublishTimeout)); + for (; O === void 0; ) { + if (Date.now() - P > this.publishTimeout) throw new Error(_); + this.logger.trace({ id: p, attempts: L }, `publisher.publish - attempt ${L}`), O = await await Eu(this.rpcPublish(n, i, a, u, l, d, p, s == null ? void 0 : s.attestation).catch((B) => this.logger.warn(B)), this.publishTimeout, _), L++, O || await new Promise((B) => setTimeout(B, this.failedPublishTimeout)); } - this.relayer.events.emit(oi.publish, w), this.logger.debug("Successfully Published Payload"), this.logger.trace({ type: "method", method: "publish", params: { id: p, topic: n, message: i, opts: s } }); + this.relayer.events.emit(ai.publish, w), this.logger.debug("Successfully Published Payload"), this.logger.trace({ type: "method", method: "publish", params: { id: p, topic: n, message: i, opts: s } }); } catch (B) { if (this.logger.debug("Failed to Publish Payload"), this.logger.error(B), (o = s == null ? void 0 : s.internal) != null && o.throwOnFailedPublish) throw B; this.queue.set(p, w); @@ -18605,15 +19117,15 @@ class tV extends Zk { this.events.off(n, i); }, this.removeListener = (n, i) => { this.events.removeListener(n, i); - }, this.relayer = e, this.logger = ci(r, this.name), this.registerEventListeners(); + }, this.relayer = e, this.logger = ui(r, this.name), this.registerEventListeners(); } get context() { - return Ai(this.logger); + return Pi(this.logger); } rpcPublish(e, r, n, i, s, o, a, u) { var l, d, p, w; - const A = { method: Bf(i.protocol).publish, params: { topic: e, message: r, ttl: n, prompt: s, tag: o, attestation: u }, id: a }; - return mi((l = A.params) == null ? void 0 : l.prompt) && ((d = A.params) == null || delete d.prompt), mi((p = A.params) == null ? void 0 : p.tag) && ((w = A.params) == null || delete w.tag), this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "message", direction: "outgoing", request: A }), this.relayer.request(A); + const _ = { method: Hf(i.protocol).publish, params: { topic: e, message: r, ttl: n, prompt: s, tag: o, attestation: u }, id: a }; + return vi((l = _.params) == null ? void 0 : l.prompt) && ((d = _.params) == null || delete d.prompt), vi((p = _.params) == null ? void 0 : p.tag) && ((w = _.params) == null || delete w.tag), this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "message", direction: "outgoing", request: _ }), this.relayer.request(_); } removeRequestFromQueue(e) { this.queue.delete(e); @@ -18625,18 +19137,18 @@ class tV extends Zk { }); } registerEventListeners() { - this.relayer.core.heartbeat.on(Ou.pulse, () => { + this.relayer.core.heartbeat.on(ju.pulse, () => { if (this.needsTransportRestart) { - this.needsTransportRestart = !1, this.relayer.events.emit(oi.connection_stalled); + this.needsTransportRestart = !1, this.relayer.events.emit(ai.connection_stalled); return; } this.checkQueue(); - }), this.relayer.on(oi.message_ack, (e) => { + }), this.relayer.on(ai.message_ack, (e) => { this.removeRequestFromQueue(e.id.toString()); }); } } -class rV { +class LV { constructor() { this.map = /* @__PURE__ */ new Map(), this.set = (e, r) => { const n = this.get(e); @@ -18663,19 +19175,19 @@ class rV { return Array.from(this.map.keys()); } } -var nV = Object.defineProperty, iV = Object.defineProperties, sV = Object.getOwnPropertyDescriptors, x3 = Object.getOwnPropertySymbols, oV = Object.prototype.hasOwnProperty, aV = Object.prototype.propertyIsEnumerable, _3 = (t, e, r) => e in t ? nV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Cf = (t, e) => { - for (var r in e || (e = {})) oV.call(e, r) && _3(t, r, e[r]); - if (x3) for (var r of x3(e)) aV.call(e, r) && _3(t, r, e[r]); +var kV = Object.defineProperty, $V = Object.defineProperties, BV = Object.getOwnPropertyDescriptors, $3 = Object.getOwnPropertySymbols, FV = Object.prototype.hasOwnProperty, jV = Object.prototype.propertyIsEnumerable, B3 = (t, e, r) => e in t ? kV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, kf = (t, e) => { + for (var r in e || (e = {})) FV.call(e, r) && B3(t, r, e[r]); + if ($3) for (var r of $3(e)) jV.call(e, r) && B3(t, r, e[r]); return t; -}, gm = (t, e) => iV(t, sV(e)); -class cV extends t$ { +}, Cm = (t, e) => $V(t, BV(e)); +class UV extends N$ { constructor(e, r) { - super(e, r), this.relayer = e, this.logger = r, this.subscriptions = /* @__PURE__ */ new Map(), this.topicMap = new rV(), this.events = new rs.EventEmitter(), this.name = uH, this.version = fH, this.pending = /* @__PURE__ */ new Map(), this.cached = [], this.initialized = !1, this.pendingSubscriptionWatchLabel = "pending_sub_watch_label", this.pollingInterval = 20, this.storagePrefix = Qs, this.subscribeTimeout = mt.toMiliseconds(mt.ONE_MINUTE), this.restartInProgress = !1, this.batchSubscribeTopicsLimit = 500, this.pendingBatchMessages = [], this.init = async () => { + super(e, r), this.relayer = e, this.logger = r, this.subscriptions = /* @__PURE__ */ new Map(), this.topicMap = new LV(), this.events = new is.EventEmitter(), this.name = qH, this.version = zH, this.pending = /* @__PURE__ */ new Map(), this.cached = [], this.initialized = !1, this.pendingSubscriptionWatchLabel = "pending_sub_watch_label", this.pollingInterval = 20, this.storagePrefix = ro, this.subscribeTimeout = vt.toMiliseconds(vt.ONE_MINUTE), this.restartInProgress = !1, this.batchSubscribeTopicsLimit = 500, this.pendingBatchMessages = [], this.init = async () => { this.initialized || (this.logger.trace("Initialized"), this.registerEventListeners(), this.clientId = await this.relayer.core.crypto.getClientId(), await this.restore()), this.initialized = !0; }, this.subscribe = async (n, i) => { this.isInitialized(), this.logger.debug("Subscribing Topic"), this.logger.trace({ type: "method", method: "subscribe", params: { topic: n, opts: i } }); try { - const s = C1(i), o = { topic: n, relay: s, transportType: i == null ? void 0 : i.transportType }; + const s = H1(i), o = { topic: n, relay: s, transportType: i == null ? void 0 : i.transportType }; this.pending.set(n, o); const a = await this.rpcSubscribe(n, s, i); return typeof a == "string" && (this.onSubscribe(a, o), this.logger.debug("Successfully Subscribed Topic"), this.logger.trace({ type: "method", method: "subscribe", params: { topic: n, opts: i } })), a; @@ -18688,10 +19200,10 @@ class cV extends t$ { if (this.topics.includes(n)) return !0; const i = `${this.pendingSubscriptionWatchLabel}_${n}`; return await new Promise((s, o) => { - const a = new mt.Watch(); + const a = new vt.Watch(); a.start(i); const u = setInterval(() => { - !this.pending.has(n) && this.topics.includes(n) && (clearInterval(u), a.stop(i), s(!0)), a.elapsed(i) >= lH && (clearInterval(u), a.stop(i), o(new Error("Subscription resolution timeout"))); + !this.pending.has(n) && this.topics.includes(n) && (clearInterval(u), a.stop(i), s(!0)), a.elapsed(i) >= WH && (clearInterval(u), a.stop(i), o(new Error("Subscription resolution timeout"))); }, this.pollingInterval); }).catch(() => !1); }, this.on = (n, i) => { @@ -18708,10 +19220,10 @@ class cV extends t$ { await this.onDisconnect(); }, this.restart = async () => { this.restartInProgress = !0, await this.restore(), await this.reset(), this.restartInProgress = !1; - }, this.relayer = e, this.logger = ci(r, this.name), this.clientId = ""; + }, this.relayer = e, this.logger = ui(r, this.name), this.clientId = ""; } get context() { - return Ai(this.logger); + return Pi(this.logger); } get storageKey() { return this.storagePrefix + this.version + this.relayer.core.customStoragePrefix + "//" + this.name; @@ -18749,7 +19261,7 @@ class cV extends t$ { async unsubscribeById(e, r, n) { this.logger.debug("Unsubscribing Topic"), this.logger.trace({ type: "method", method: "unsubscribe", params: { topic: e, id: r, opts: n } }); try { - const i = C1(n); + const i = H1(n); await this.rpcUnsubscribe(e, r, i); const s = Or("USER_DISCONNECTED", `${this.name}, ${e}`); await this.onUnsubscribe(e, r, s), this.logger.debug("Successfully Unsubscribed Topic"), this.logger.trace({ type: "method", method: "unsubscribe", params: { topic: e, id: r, opts: n } }); @@ -18760,54 +19272,54 @@ class cV extends t$ { async rpcSubscribe(e, r, n) { var i; (n == null ? void 0 : n.transportType) === zr.relay && await this.restartToComplete(); - const s = { method: Bf(r.protocol).subscribe, params: { topic: e } }; + const s = { method: Hf(r.protocol).subscribe, params: { topic: e } }; this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: s }); const o = (i = n == null ? void 0 : n.internal) == null ? void 0 : i.throwOnFailedPublish; try { - const a = xo(e + this.clientId); + const a = Ao(e + this.clientId); if ((n == null ? void 0 : n.transportType) === zr.link_mode) return setTimeout(() => { (this.relayer.connected || this.relayer.connecting) && this.relayer.request(s).catch((l) => this.logger.warn(l)); - }, mt.toMiliseconds(mt.ONE_SECOND)), a; - const u = await du(this.relayer.request(s).catch((l) => this.logger.warn(l)), this.subscribeTimeout, `Subscribing to ${e} failed, please try again`); + }, vt.toMiliseconds(vt.ONE_SECOND)), a; + const u = await Eu(this.relayer.request(s).catch((l) => this.logger.warn(l)), this.subscribeTimeout, `Subscribing to ${e} failed, please try again`); if (!u && o) throw new Error(`Subscribing to ${e} failed, please try again`); return u ? a : null; } catch (a) { - if (this.logger.debug("Outgoing Relay Subscribe Payload stalled"), this.relayer.events.emit(oi.connection_stalled), o) throw a; + if (this.logger.debug("Outgoing Relay Subscribe Payload stalled"), this.relayer.events.emit(ai.connection_stalled), o) throw a; } return null; } async rpcBatchSubscribe(e) { if (!e.length) return; - const r = e[0].relay, n = { method: Bf(r.protocol).batchSubscribe, params: { topics: e.map((i) => i.topic) } }; + const r = e[0].relay, n = { method: Hf(r.protocol).batchSubscribe, params: { topics: e.map((i) => i.topic) } }; this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: n }); try { - return await await du(this.relayer.request(n).catch((i) => this.logger.warn(i)), this.subscribeTimeout); + return await await Eu(this.relayer.request(n).catch((i) => this.logger.warn(i)), this.subscribeTimeout); } catch { - this.relayer.events.emit(oi.connection_stalled); + this.relayer.events.emit(ai.connection_stalled); } } async rpcBatchFetchMessages(e) { if (!e.length) return; - const r = e[0].relay, n = { method: Bf(r.protocol).batchFetchMessages, params: { topics: e.map((s) => s.topic) } }; + const r = e[0].relay, n = { method: Hf(r.protocol).batchFetchMessages, params: { topics: e.map((s) => s.topic) } }; this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: n }); let i; try { - i = await await du(this.relayer.request(n).catch((s) => this.logger.warn(s)), this.subscribeTimeout); + i = await await Eu(this.relayer.request(n).catch((s) => this.logger.warn(s)), this.subscribeTimeout); } catch { - this.relayer.events.emit(oi.connection_stalled); + this.relayer.events.emit(ai.connection_stalled); } return i; } rpcUnsubscribe(e, r, n) { - const i = { method: Bf(n.protocol).unsubscribe, params: { topic: e, id: r } }; + const i = { method: Hf(n.protocol).unsubscribe, params: { topic: e, id: r } }; return this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: i }), this.relayer.request(i); } onSubscribe(e, r) { - this.setSubscription(e, gm(Cf({}, r), { id: e })), this.pending.delete(r.topic); + this.setSubscription(e, Cm(kf({}, r), { id: e })), this.pending.delete(r.topic); } onBatchSubscribe(e) { e.length && e.forEach((r) => { - this.setSubscription(r.id, Cf({}, r)), this.pending.delete(r.topic); + this.setSubscription(r.id, kf({}, r)), this.pending.delete(r.topic); }); } async onUnsubscribe(e, r, n) { @@ -18823,7 +19335,7 @@ class cV extends t$ { this.logger.debug("Setting subscription"), this.logger.trace({ type: "method", method: "setSubscription", id: e, subscription: r }), this.addSubscription(e, r); } addSubscription(e, r) { - this.subscriptions.set(e, Cf({}, r)), this.topicMap.set(r.topic, e), this.events.emit(Us.created, r); + this.subscriptions.set(e, kf({}, r)), this.topicMap.set(r.topic, e), this.events.emit(Ws.created, r); } getSubscription(e) { this.logger.debug("Getting subscription"), this.logger.trace({ type: "method", method: "getSubscription", id: e }); @@ -18837,10 +19349,10 @@ class cV extends t$ { deleteSubscription(e, r) { this.logger.debug("Deleting subscription"), this.logger.trace({ type: "method", method: "deleteSubscription", id: e, reason: r }); const n = this.getSubscription(e); - this.subscriptions.delete(e), this.topicMap.delete(n.topic, e), this.events.emit(Us.deleted, gm(Cf({}, n), { reason: r })); + this.subscriptions.delete(e), this.topicMap.delete(n.topic, e), this.events.emit(Ws.deleted, Cm(kf({}, n), { reason: r })); } async persist() { - await this.setRelayerSubscriptions(this.values), this.events.emit(Us.sync); + await this.setRelayerSubscriptions(this.values), this.events.emit(Ws.sync); } async reset() { if (this.cached.length) { @@ -18850,7 +19362,7 @@ class cV extends t$ { await this.batchFetchMessages(n), await this.batchSubscribe(n); } } - this.events.emit(Us.resubscribed); + this.events.emit(Ws.resubscribed); } async restore() { try { @@ -18868,7 +19380,7 @@ class cV extends t$ { async batchSubscribe(e) { if (!e.length) return; const r = await this.rpcBatchSubscribe(e); - pc(r) && this.onBatchSubscribe(r.map((n, i) => gm(Cf({}, e[i]), { id: n }))); + _c(r) && this.onBatchSubscribe(r.map((n, i) => Cm(kf({}, e[i]), { id: n }))); } async batchFetchMessages(e) { if (!e.length) return; @@ -18890,13 +19402,13 @@ class cV extends t$ { }), await this.batchSubscribe(e), this.pendingBatchMessages.length && (await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages), this.pendingBatchMessages = []); } registerEventListeners() { - this.relayer.core.heartbeat.on(Ou.pulse, async () => { + this.relayer.core.heartbeat.on(ju.pulse, async () => { await this.checkPending(); - }), this.events.on(Us.created, async (e) => { - const r = Us.created; + }), this.events.on(Ws.created, async (e) => { + const r = Ws.created; this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), await this.persist(); - }), this.events.on(Us.deleted, async (e) => { - const r = Us.deleted; + }), this.events.on(Ws.deleted, async (e) => { + const r = Ws.deleted; this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), await this.persist(); }); } @@ -18914,17 +19426,17 @@ class cV extends t$ { }); } } -var uV = Object.defineProperty, E3 = Object.getOwnPropertySymbols, fV = Object.prototype.hasOwnProperty, lV = Object.prototype.propertyIsEnumerable, S3 = (t, e, r) => e in t ? uV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, A3 = (t, e) => { - for (var r in e || (e = {})) fV.call(e, r) && S3(t, r, e[r]); - if (E3) for (var r of E3(e)) lV.call(e, r) && S3(t, r, e[r]); +var qV = Object.defineProperty, F3 = Object.getOwnPropertySymbols, zV = Object.prototype.hasOwnProperty, WV = Object.prototype.propertyIsEnumerable, j3 = (t, e, r) => e in t ? qV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, U3 = (t, e) => { + for (var r in e || (e = {})) zV.call(e, r) && j3(t, r, e[r]); + if (F3) for (var r of F3(e)) WV.call(e, r) && j3(t, r, e[r]); return t; }; -class hV extends Qk { +class HV extends D$ { constructor(e) { - super(e), this.protocol = "wc", this.version = 2, this.events = new rs.EventEmitter(), this.name = iH, this.transportExplicitlyClosed = !1, this.initialized = !1, this.connectionAttemptInProgress = !1, this.connectionStatusPollingInterval = 20, this.staleConnectionErrors = ["socket hang up", "stalled", "interrupted"], this.hasExperiencedNetworkDisruption = !1, this.requestsInFlight = /* @__PURE__ */ new Map(), this.heartBeatTimeout = mt.toMiliseconds(mt.THIRTY_SECONDS + mt.ONE_SECOND), this.request = async (r) => { + super(e), this.protocol = "wc", this.version = 2, this.events = new is.EventEmitter(), this.name = $H, this.transportExplicitlyClosed = !1, this.initialized = !1, this.connectionAttemptInProgress = !1, this.connectionStatusPollingInterval = 20, this.staleConnectionErrors = ["socket hang up", "stalled", "interrupted"], this.hasExperiencedNetworkDisruption = !1, this.requestsInFlight = /* @__PURE__ */ new Map(), this.heartBeatTimeout = vt.toMiliseconds(vt.THIRTY_SECONDS + vt.ONE_SECOND), this.request = async (r) => { var n, i; this.logger.debug("Publishing Request Payload"); - const s = r.id || nc().toString(); + const s = r.id || fc().toString(); await this.toEstablishConnection(); try { const o = this.provider.request(r); @@ -18933,9 +19445,9 @@ class hV extends Qk { const d = () => { l(new Error(`relayer.request - publish interrupted, id: ${s}`)); }; - this.provider.on(Vi.disconnect, d); + this.provider.on(Yi.disconnect, d); const p = await o; - this.provider.off(Vi.disconnect, d), u(p); + this.provider.off(Yi.disconnect, d), u(p); }); return this.logger.trace({ id: s, method: r.method, topic: (i = r.params) == null ? void 0 : i.topic }, "relayer.request - published"), a; } catch (o) { @@ -18944,7 +19456,7 @@ class hV extends Qk { this.requestsInFlight.delete(s); } }, this.resetPingTimeout = () => { - if (c0()) try { + if (w0()) try { clearTimeout(this.pingTimeout), this.pingTimeout = setTimeout(() => { var r, n, i; (i = (n = (r = this.provider) == null ? void 0 : r.connection) == null ? void 0 : n.socket) == null || i.terminate(); @@ -18955,14 +19467,14 @@ class hV extends Qk { }, this.onPayloadHandler = (r) => { this.onProviderPayload(r), this.resetPingTimeout(); }, this.onConnectHandler = () => { - this.logger.trace("relayer connected"), this.startPingTimeout(), this.events.emit(oi.connect); + this.logger.trace("relayer connected"), this.startPingTimeout(), this.events.emit(ai.connect); }, this.onDisconnectHandler = () => { this.logger.trace("relayer disconnected"), this.onProviderDisconnect(); }, this.onProviderErrorHandler = (r) => { - this.logger.error(r), this.events.emit(oi.error, r), this.logger.info("Fatal socket error received, closing transport"), this.transportClose(); + this.logger.error(r), this.events.emit(ai.error, r), this.logger.info("Fatal socket error received, closing transport"), this.transportClose(); }, this.registerProviderListeners = () => { - this.provider.on(Vi.payload, this.onPayloadHandler), this.provider.on(Vi.connect, this.onConnectHandler), this.provider.on(Vi.disconnect, this.onDisconnectHandler), this.provider.on(Vi.error, this.onProviderErrorHandler); - }, this.core = e.core, this.logger = typeof e.logger < "u" && typeof e.logger != "string" ? ci(e.logger, this.name) : ql($0({ level: e.logger || nH })), this.messages = new eV(this.logger, e.core), this.subscriber = new cV(this, this.logger), this.publisher = new tV(this, this.logger), this.relayUrl = (e == null ? void 0 : e.relayUrl) || sE, this.projectId = e.projectId, this.bundleId = jq(), this.provider = {}; + this.provider.on(Yi.payload, this.onPayloadHandler), this.provider.on(Yi.connect, this.onConnectHandler), this.provider.on(Yi.disconnect, this.onDisconnectHandler), this.provider.on(Yi.error, this.onProviderErrorHandler); + }, this.core = e.core, this.logger = typeof e.logger < "u" && typeof e.logger != "string" ? ui(e.logger, this.name) : Xl(X0({ level: e.logger || kH })), this.messages = new OV(this.logger, e.core), this.subscriber = new UV(this, this.logger), this.publisher = new NV(this, this.logger), this.relayUrl = (e == null ? void 0 : e.relayUrl) || OE, this.projectId = e.projectId, this.bundleId = yz(), this.provider = {}; } async init() { if (this.logger.trace("Initialized"), this.registerEventListeners(), await Promise.all([this.messages.init(), this.subscriber.init()]), this.initialized = !0, this.subscriber.cached.length > 0) try { @@ -18972,7 +19484,7 @@ class hV extends Qk { } } get context() { - return Ai(this.logger); + return Pi(this.logger); } get connected() { var e, r, n; @@ -18991,12 +19503,12 @@ class hV extends Qk { const o = typeof ((n = r == null ? void 0 : r.internal) == null ? void 0 : n.throwOnFailedPublish) > "u" ? !0 : (i = r == null ? void 0 : r.internal) == null ? void 0 : i.throwOnFailedPublish; let a = ((s = this.subscriber.topicMap.get(e)) == null ? void 0 : s[0]) || "", u; const l = (d) => { - d.topic === e && (this.subscriber.off(Us.created, l), u()); + d.topic === e && (this.subscriber.off(Ws.created, l), u()); }; return await Promise.all([new Promise((d) => { - u = d, this.subscriber.on(Us.created, l); + u = d, this.subscriber.on(Ws.created, l); }), new Promise(async (d, p) => { - a = await this.subscriber.subscribe(e, A3({ internal: { throwOnFailedPublish: o } }, r)).catch((w) => { + a = await this.subscriber.subscribe(e, U3({ internal: { throwOnFailedPublish: o } }, r)).catch((w) => { o && p(w); }) || a, d(); })]), a; @@ -19022,7 +19534,7 @@ class hV extends Qk { } catch (e) { this.logger.warn(e); } - this.provider.disconnect && (this.hasExperiencedNetworkDisruption || this.connected) ? await du(this.provider.disconnect(), 2e3, "provider.disconnect()").catch(() => this.onProviderDisconnect()) : this.onProviderDisconnect(); + this.provider.disconnect && (this.hasExperiencedNetworkDisruption || this.connected) ? await Eu(this.provider.disconnect(), 2e3, "provider.disconnect()").catch(() => this.onProviderDisconnect()) : this.onProviderDisconnect(); } async transportClose() { this.transportExplicitlyClosed = !0, await this.transportDisconnect(); @@ -19032,9 +19544,9 @@ class hV extends Qk { try { await new Promise(async (r, n) => { const i = () => { - this.provider.off(Vi.disconnect, i), n(new Error("Connection interrupted while trying to subscribe")); + this.provider.off(Yi.disconnect, i), n(new Error("Connection interrupted while trying to subscribe")); }; - this.provider.on(Vi.disconnect, i), await du(this.provider.connect(), mt.toMiliseconds(mt.ONE_MINUTE), `Socket stalled when trying to connect to ${this.relayUrl}`).catch((s) => { + this.provider.on(Yi.disconnect, i), await Eu(this.provider.connect(), vt.toMiliseconds(vt.ONE_MINUTE), `Socket stalled when trying to connect to ${this.relayUrl}`).catch((s) => { n(s); }).finally(() => { clearTimeout(this.reconnectTimeout), this.reconnectTimeout = void 0; @@ -19054,7 +19566,7 @@ class hV extends Qk { this.connectionAttemptInProgress || (this.relayUrl = e || this.relayUrl, await this.confirmOnlineStateOrThrow(), await this.transportClose(), await this.transportOpen()); } async confirmOnlineStateOrThrow() { - if (!await s3()) throw new Error("No internet connection detected. Please restart your network and try again."); + if (!await x3()) throw new Error("No internet connection detected. Please restart your network and try again."); } async handleBatchMessageEvents(e) { if ((e == null ? void 0 : e.length) === 0) { @@ -19073,14 +19585,14 @@ class hV extends Qk { async onLinkMessageEvent(e, r) { const { topic: n } = e; if (!r.sessionExists) { - const i = En(mt.FIVE_MINUTES), s = { topic: n, expiry: i, relay: { protocol: "irn" }, active: !1 }; + const i = Sn(vt.FIVE_MINUTES), s = { topic: n, expiry: i, relay: { protocol: "irn" }, active: !1 }; await this.core.pairing.pairings.set(n, s); } - this.events.emit(oi.message, e), await this.recordMessageEvent(e); + this.events.emit(ai.message, e), await this.recordMessageEvent(e); } startPingTimeout() { var e, r, n, i, s; - if (c0()) try { + if (w0()) try { (r = (e = this.provider) == null ? void 0 : e.connection) != null && r.socket && ((s = (i = (n = this.provider) == null ? void 0 : n.connection) == null ? void 0 : i.socket) == null || s.once("ping", () => { this.resetPingTimeout(); })), this.resetPingTimeout(); @@ -19094,7 +19606,7 @@ class hV extends Qk { async createProvider() { this.provider.connection && this.unregisterProviderListeners(); const e = await this.core.crypto.signJWT(this.relayUrl); - this.provider = new as(new WW(Wq({ sdkVersion: T1, protocol: this.protocol, version: this.version, relayUrl: this.relayUrl, projectId: this.projectId, auth: e, useOnCloseEvent: !0, bundleId: this.bundleId }))), this.registerProviderListeners(); + this.provider = new us(new EH(Ez({ sdkVersion: K1, protocol: this.protocol, version: this.version, relayUrl: this.relayUrl, projectId: this.projectId, auth: e, useOnCloseEvent: !0, bundleId: this.bundleId }))), this.registerProviderListeners(); } async recordMessageEvent(e) { const { topic: r, message: n } = e; @@ -19108,32 +19620,32 @@ class hV extends Qk { return i && this.logger.debug(`Ignoring duplicate message: ${n}`), i; } async onProviderPayload(e) { - if (this.logger.debug("Incoming Relay Payload"), this.logger.trace({ type: "payload", direction: "incoming", payload: e }), lb(e)) { - if (!e.method.endsWith(sH)) return; + if (this.logger.debug("Incoming Relay Payload"), this.logger.trace({ type: "payload", direction: "incoming", payload: e }), Ab(e)) { + if (!e.method.endsWith(BH)) return; const r = e.params, { topic: n, message: i, publishedAt: s, attestation: o } = r.data, a = { topic: n, message: i, publishedAt: s, transportType: zr.relay, attestation: o }; - this.logger.debug("Emitting Relayer Payload"), this.logger.trace(A3({ type: "event", event: r.id }, a)), this.events.emit(r.id, a), await this.acknowledgePayload(e), await this.onMessageEvent(a); - } else ip(e) && this.events.emit(oi.message_ack, e); + this.logger.debug("Emitting Relayer Payload"), this.logger.trace(U3({ type: "event", event: r.id }, a)), this.events.emit(r.id, a), await this.acknowledgePayload(e), await this.onMessageEvent(a); + } else bp(e) && this.events.emit(ai.message_ack, e); } async onMessageEvent(e) { - await this.shouldIgnoreMessageEvent(e) || (this.events.emit(oi.message, e), await this.recordMessageEvent(e)); + await this.shouldIgnoreMessageEvent(e) || (this.events.emit(ai.message, e), await this.recordMessageEvent(e)); } async acknowledgePayload(e) { - const r = rp(e.id, !0); + const r = mp(e.id, !0); await this.provider.connection.send(r); } unregisterProviderListeners() { - this.provider.off(Vi.payload, this.onPayloadHandler), this.provider.off(Vi.connect, this.onConnectHandler), this.provider.off(Vi.disconnect, this.onDisconnectHandler), this.provider.off(Vi.error, this.onProviderErrorHandler), clearTimeout(this.pingTimeout); + this.provider.off(Yi.payload, this.onPayloadHandler), this.provider.off(Yi.connect, this.onConnectHandler), this.provider.off(Yi.disconnect, this.onDisconnectHandler), this.provider.off(Yi.error, this.onProviderErrorHandler), clearTimeout(this.pingTimeout); } async registerEventListeners() { - let e = await s3(); - xW(async (r) => { + let e = await x3(); + eH(async (r) => { e !== r && (e = r, r ? await this.restartTransport().catch((n) => this.logger.error(n)) : (this.hasExperiencedNetworkDisruption = !0, await this.transportDisconnect(), this.transportExplicitlyClosed = !1)); }); } async onProviderDisconnect() { - await this.subscriber.stop(), this.requestsInFlight.clear(), clearTimeout(this.pingTimeout), this.events.emit(oi.disconnect), this.connectionAttemptInProgress = !1, !this.transportExplicitlyClosed && (this.reconnectTimeout || (this.reconnectTimeout = setTimeout(async () => { + await this.subscriber.stop(), this.requestsInFlight.clear(), clearTimeout(this.pingTimeout), this.events.emit(ai.disconnect), this.connectionAttemptInProgress = !1, !this.transportExplicitlyClosed && (this.reconnectTimeout || (this.reconnectTimeout = setTimeout(async () => { await this.transportOpen().catch((e) => this.logger.error(e)); - }, mt.toMiliseconds(oH)))); + }, vt.toMiliseconds(FH)))); } isInitialized() { if (!this.initialized) { @@ -19149,29 +19661,29 @@ class hV extends Qk { }), await this.transportOpen()); } } -var dV = Object.defineProperty, P3 = Object.getOwnPropertySymbols, pV = Object.prototype.hasOwnProperty, gV = Object.prototype.propertyIsEnumerable, M3 = (t, e, r) => e in t ? dV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, I3 = (t, e) => { - for (var r in e || (e = {})) pV.call(e, r) && M3(t, r, e[r]); - if (P3) for (var r of P3(e)) gV.call(e, r) && M3(t, r, e[r]); +var KV = Object.defineProperty, q3 = Object.getOwnPropertySymbols, VV = Object.prototype.hasOwnProperty, GV = Object.prototype.propertyIsEnumerable, z3 = (t, e, r) => e in t ? KV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, W3 = (t, e) => { + for (var r in e || (e = {})) VV.call(e, r) && z3(t, r, e[r]); + if (q3) for (var r of q3(e)) GV.call(e, r) && z3(t, r, e[r]); return t; }; -class Ec extends e$ { - constructor(e, r, n, i = Qs, s = void 0) { - super(e, r, n, i), this.core = e, this.logger = r, this.name = n, this.map = /* @__PURE__ */ new Map(), this.version = aH, this.cached = [], this.initialized = !1, this.storagePrefix = Qs, this.recentlyDeleted = [], this.recentlyDeletedLimit = 200, this.init = async () => { +class Oc extends O$ { + constructor(e, r, n, i = ro, s = void 0) { + super(e, r, n, i), this.core = e, this.logger = r, this.name = n, this.map = /* @__PURE__ */ new Map(), this.version = jH, this.cached = [], this.initialized = !1, this.storagePrefix = ro, this.recentlyDeleted = [], this.recentlyDeletedLimit = 200, this.init = async () => { this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((o) => { - this.getKey && o !== null && !mi(o) ? this.map.set(this.getKey(o), o) : Zz(o) ? this.map.set(o.id, o) : Qz(o) && this.map.set(o.topic, o); + this.getKey && o !== null && !vi(o) ? this.map.set(this.getKey(o), o) : RW(o) ? this.map.set(o.id, o) : DW(o) && this.map.set(o.topic, o); }), this.cached = [], this.initialized = !0); }, this.set = async (o, a) => { this.isInitialized(), this.map.has(o) ? await this.update(o, a) : (this.logger.debug("Setting value"), this.logger.trace({ type: "method", method: "set", key: o, value: a }), this.map.set(o, a), await this.persist()); - }, this.get = (o) => (this.isInitialized(), this.logger.debug("Getting value"), this.logger.trace({ type: "method", method: "get", key: o }), this.getData(o)), this.getAll = (o) => (this.isInitialized(), o ? this.values.filter((a) => Object.keys(o).every((u) => KW(a[u], o[u]))) : this.values), this.update = async (o, a) => { + }, this.get = (o) => (this.isInitialized(), this.logger.debug("Getting value"), this.logger.trace({ type: "method", method: "get", key: o }), this.getData(o)), this.getAll = (o) => (this.isInitialized(), o ? this.values.filter((a) => Object.keys(o).every((u) => AH(a[u], o[u]))) : this.values), this.update = async (o, a) => { this.isInitialized(), this.logger.debug("Updating value"), this.logger.trace({ type: "method", method: "update", key: o, update: a }); - const u = I3(I3({}, this.getData(o)), a); + const u = W3(W3({}, this.getData(o)), a); this.map.set(o, u), await this.persist(); }, this.delete = async (o, a) => { this.isInitialized(), this.map.has(o) && (this.logger.debug("Deleting value"), this.logger.trace({ type: "method", method: "delete", key: o, reason: a }), this.map.delete(o), this.addToRecentlyDeleted(o), await this.persist()); - }, this.logger = ci(r, this.name), this.storagePrefix = i, this.getKey = s; + }, this.logger = ui(r, this.name), this.storagePrefix = i, this.getKey = s; } get context() { - return Ai(this.logger); + return Pi(this.logger); } get storageKey() { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; @@ -19229,50 +19741,50 @@ class Ec extends e$ { } } } -class mV { +class YV { constructor(e, r) { - this.core = e, this.logger = r, this.name = hH, this.version = dH, this.events = new $v(), this.initialized = !1, this.storagePrefix = Qs, this.ignoredPayloadTypes = [Co], this.registeredMethods = [], this.init = async () => { + this.core = e, this.logger = r, this.name = HH, this.version = KH, this.events = new Xv(), this.initialized = !1, this.storagePrefix = ro, this.ignoredPayloadTypes = [Oo], this.registeredMethods = [], this.init = async () => { this.initialized || (await this.pairings.init(), await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.initialized = !0, this.logger.trace("Initialized")); }, this.register = ({ methods: n }) => { this.isInitialized(), this.registeredMethods = [.../* @__PURE__ */ new Set([...this.registeredMethods, ...n])]; }, this.create = async (n) => { this.isInitialized(); - const i = I1(), s = await this.core.crypto.setSymKey(i), o = En(mt.FIVE_MINUTES), a = { protocol: iE }, u = { topic: s, expiry: o, relay: a, active: !1, methods: n == null ? void 0 : n.methods }, l = Qx({ protocol: this.core.protocol, version: this.core.version, topic: s, symKey: i, relay: a, expiryTimestamp: o, methods: n == null ? void 0 : n.methods }); - return this.events.emit(Za.create, u), this.core.expirer.set(s, o), await this.pairings.set(s, u), await this.core.relayer.subscribe(s, { transportType: n == null ? void 0 : n.transportType }), { topic: s, uri: l }; + const i = W1(), s = await this.core.crypto.setSymKey(i), o = Sn(vt.FIVE_MINUTES), a = { protocol: DE }, u = { topic: s, expiry: o, relay: a, active: !1, methods: n == null ? void 0 : n.methods }, l = g3({ protocol: this.core.protocol, version: this.core.version, topic: s, symKey: i, relay: a, expiryTimestamp: o, methods: n == null ? void 0 : n.methods }); + return this.events.emit(ic.create, u), this.core.expirer.set(s, o), await this.pairings.set(s, u), await this.core.relayer.subscribe(s, { transportType: n == null ? void 0 : n.transportType }), { topic: s, uri: l }; }, this.pair = async (n) => { this.isInitialized(); - const i = this.core.eventClient.createEvent({ properties: { topic: n == null ? void 0 : n.uri, trace: [Fs.pairing_started] } }); + const i = this.core.eventClient.createEvent({ properties: { topic: n == null ? void 0 : n.uri, trace: [qs.pairing_started] } }); this.isValidPair(n, i); - const { topic: s, symKey: o, relay: a, expiryTimestamp: u, methods: l } = Zx(n.uri); - i.props.properties.topic = s, i.addTrace(Fs.pairing_uri_validation_success), i.addTrace(Fs.pairing_uri_not_expired); + const { topic: s, symKey: o, relay: a, expiryTimestamp: u, methods: l } = p3(n.uri); + i.props.properties.topic = s, i.addTrace(qs.pairing_uri_validation_success), i.addTrace(qs.pairing_uri_not_expired); let d; if (this.pairings.keys.includes(s)) { - if (d = this.pairings.get(s), i.addTrace(Fs.existing_pairing), d.active) throw i.setError(wo.active_pairing_already_exists), new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`); - i.addTrace(Fs.pairing_not_expired); + if (d = this.pairings.get(s), i.addTrace(qs.existing_pairing), d.active) throw i.setError(So.active_pairing_already_exists), new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`); + i.addTrace(qs.pairing_not_expired); } - const p = u || En(mt.FIVE_MINUTES), w = { topic: s, relay: a, expiry: p, active: !1, methods: l }; - this.core.expirer.set(s, p), await this.pairings.set(s, w), i.addTrace(Fs.store_new_pairing), n.activatePairing && await this.activate({ topic: s }), this.events.emit(Za.create, w), i.addTrace(Fs.emit_inactive_pairing), this.core.crypto.keychain.has(s) || await this.core.crypto.setSymKey(o, s), i.addTrace(Fs.subscribing_pairing_topic); + const p = u || Sn(vt.FIVE_MINUTES), w = { topic: s, relay: a, expiry: p, active: !1, methods: l }; + this.core.expirer.set(s, p), await this.pairings.set(s, w), i.addTrace(qs.store_new_pairing), n.activatePairing && await this.activate({ topic: s }), this.events.emit(ic.create, w), i.addTrace(qs.emit_inactive_pairing), this.core.crypto.keychain.has(s) || await this.core.crypto.setSymKey(o, s), i.addTrace(qs.subscribing_pairing_topic); try { await this.core.relayer.confirmOnlineStateOrThrow(); } catch { - i.setError(wo.no_internet_connection); + i.setError(So.no_internet_connection); } try { await this.core.relayer.subscribe(s, { relay: a }); - } catch (A) { - throw i.setError(wo.subscribe_pairing_topic_failure), A; + } catch (_) { + throw i.setError(So.subscribe_pairing_topic_failure), _; } - return i.addTrace(Fs.subscribe_pairing_topic_success), w; + return i.addTrace(qs.subscribe_pairing_topic_success), w; }, this.activate = async ({ topic: n }) => { this.isInitialized(); - const i = En(mt.THIRTY_DAYS); + const i = Sn(vt.THIRTY_DAYS); this.core.expirer.set(n, i), await this.pairings.update(n, { active: !0, expiry: i }); }, this.ping = async (n) => { this.isInitialized(), await this.isValidPing(n); const { topic: i } = n; if (this.pairings.keys.includes(i)) { - const s = await this.sendRequest(i, "wc_pairingPing", {}), { done: o, resolve: a, reject: u } = Ga(); - this.events.once(br("pairing_ping", s), ({ error: l }) => { + const s = await this.sendRequest(i, "wc_pairingPing", {}), { done: o, resolve: a, reject: u } = ec(); + this.events.once(yr("pairing_ping", s), ({ error: l }) => { l ? u(l) : a(); }), await o(); } @@ -19287,20 +19799,20 @@ class mV { }, this.formatUriFromPairing = (n) => { this.isInitialized(); const { topic: i, relay: s, expiry: o, methods: a } = n, u = this.core.crypto.keychain.get(i); - return Qx({ protocol: this.core.protocol, version: this.core.version, topic: i, symKey: u, relay: s, expiryTimestamp: o, methods: a }); + return g3({ protocol: this.core.protocol, version: this.core.version, topic: i, symKey: u, relay: s, expiryTimestamp: o, methods: a }); }, this.sendRequest = async (n, i, s) => { - const o = da(i, s), a = await this.core.crypto.encode(n, o), u = Mf[i].req; + const o = ga(i, s), a = await this.core.crypto.encode(n, o), u = Nf[i].req; return this.core.history.set(n, o), this.core.relayer.publish(n, a, u), o.id; }, this.sendResult = async (n, i, s) => { - const o = rp(n, s), a = await this.core.crypto.encode(i, o), u = await this.core.history.get(i, n), l = Mf[u.request.method].res; + const o = mp(n, s), a = await this.core.crypto.encode(i, o), u = await this.core.history.get(i, n), l = Nf[u.request.method].res; await this.core.relayer.publish(i, a, l), await this.core.history.resolve(o); }, this.sendError = async (n, i, s) => { - const o = np(n, s), a = await this.core.crypto.encode(i, o), u = await this.core.history.get(i, n), l = Mf[u.request.method] ? Mf[u.request.method].res : Mf.unregistered_method.res; + const o = vp(n, s), a = await this.core.crypto.encode(i, o), u = await this.core.history.get(i, n), l = Nf[u.request.method] ? Nf[u.request.method].res : Nf.unregistered_method.res; await this.core.relayer.publish(i, a, l), await this.core.history.resolve(o); }, this.deletePairing = async (n, i) => { await this.core.relayer.unsubscribe(n), await Promise.all([this.pairings.delete(n, Or("USER_DISCONNECTED")), this.core.crypto.deleteSymKey(n), i ? Promise.resolve() : this.core.expirer.del(n)]); }, this.cleanup = async () => { - const n = this.pairings.getAll().filter((i) => ca(i.expiry)); + const n = this.pairings.getAll().filter((i) => fa(i.expiry)); await Promise.all(n.map((i) => this.deletePairing(i.topic))); }, this.onRelayEventRequest = (n) => { const { topic: i, payload: s } = n; @@ -19323,19 +19835,19 @@ class mV { }, this.onPairingPingRequest = async (n, i) => { const { id: s } = i; try { - this.isValidPing({ topic: n }), await this.sendResult(s, n, !0), this.events.emit(Za.ping, { id: s, topic: n }); + this.isValidPing({ topic: n }), await this.sendResult(s, n, !0), this.events.emit(ic.ping, { id: s, topic: n }); } catch (o) { await this.sendError(s, n, o), this.logger.error(o); } }, this.onPairingPingResponse = (n, i) => { const { id: s } = i; setTimeout(() => { - js(i) ? this.events.emit(br("pairing_ping", s), {}) : Zi(i) && this.events.emit(br("pairing_ping", s), { error: i.error }); + zs(i) ? this.events.emit(yr("pairing_ping", s), {}) : es(i) && this.events.emit(yr("pairing_ping", s), { error: i.error }); }, 500); }, this.onPairingDeleteRequest = async (n, i) => { const { id: s } = i; try { - this.isValidDisconnect({ topic: n }), await this.deletePairing(n), this.events.emit(Za.delete, { id: s, topic: n }); + this.isValidDisconnect({ topic: n }), await this.deletePairing(n), this.events.emit(ic.delete, { id: s, topic: n }); } catch (o) { await this.sendError(s, n, o), this.logger.error(o); } @@ -19352,37 +19864,37 @@ class mV { this.registeredMethods.includes(n) || this.logger.error(Or("WC_METHOD_UNSUPPORTED", n)); }, this.isValidPair = (n, i) => { var s; - if (!gi(n)) { + if (!mi(n)) { const { message: a } = ft("MISSING_OR_INVALID", `pair() params: ${n}`); - throw i.setError(wo.malformed_pairing_uri), new Error(a); + throw i.setError(So.malformed_pairing_uri), new Error(a); } - if (!Xz(n.uri)) { + if (!TW(n.uri)) { const { message: a } = ft("MISSING_OR_INVALID", `pair() uri: ${n.uri}`); - throw i.setError(wo.malformed_pairing_uri), new Error(a); + throw i.setError(So.malformed_pairing_uri), new Error(a); } - const o = Zx(n == null ? void 0 : n.uri); + const o = p3(n == null ? void 0 : n.uri); if (!((s = o == null ? void 0 : o.relay) != null && s.protocol)) { const { message: a } = ft("MISSING_OR_INVALID", "pair() uri#relay-protocol"); - throw i.setError(wo.malformed_pairing_uri), new Error(a); + throw i.setError(So.malformed_pairing_uri), new Error(a); } if (!(o != null && o.symKey)) { const { message: a } = ft("MISSING_OR_INVALID", "pair() uri#symKey"); - throw i.setError(wo.malformed_pairing_uri), new Error(a); + throw i.setError(So.malformed_pairing_uri), new Error(a); } - if (o != null && o.expiryTimestamp && mt.toMiliseconds(o == null ? void 0 : o.expiryTimestamp) < Date.now()) { - i.setError(wo.pairing_expired); + if (o != null && o.expiryTimestamp && vt.toMiliseconds(o == null ? void 0 : o.expiryTimestamp) < Date.now()) { + i.setError(So.pairing_expired); const { message: a } = ft("EXPIRED", "pair() URI has expired. Please try again with a new connection URI."); throw new Error(a); } }, this.isValidPing = async (n) => { - if (!gi(n)) { + if (!mi(n)) { const { message: s } = ft("MISSING_OR_INVALID", `ping() params: ${n}`); throw new Error(s); } const { topic: i } = n; await this.isValidPairingTopic(i); }, this.isValidDisconnect = async (n) => { - if (!gi(n)) { + if (!mi(n)) { const { message: s } = ft("MISSING_OR_INVALID", `disconnect() params: ${n}`); throw new Error(s); } @@ -19397,15 +19909,15 @@ class mV { const { message: i } = ft("NO_MATCHING_KEY", `pairing topic doesn't exist: ${n}`); throw new Error(i); } - if (ca(this.pairings.get(n).expiry)) { + if (fa(this.pairings.get(n).expiry)) { await this.deletePairing(n); const { message: i } = ft("EXPIRED", `pairing topic: ${n}`); throw new Error(i); } - }, this.core = e, this.logger = ci(r, this.name), this.pairings = new Ec(this.core, this.logger, this.name, this.storagePrefix); + }, this.core = e, this.logger = ui(r, this.name), this.pairings = new Oc(this.core, this.logger, this.name, this.storagePrefix); } get context() { - return Ai(this.logger); + return Pi(this.logger); } isInitialized() { if (!this.initialized) { @@ -19414,41 +19926,41 @@ class mV { } } registerRelayerEvents() { - this.core.relayer.on(oi.message, async (e) => { + this.core.relayer.on(ai.message, async (e) => { const { topic: r, message: n, transportType: i } = e; if (!this.pairings.keys.includes(r) || i === zr.link_mode || this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n))) return; const s = await this.core.crypto.decode(r, n); try { - lb(s) ? (this.core.history.set(r, s), this.onRelayEventRequest({ topic: r, payload: s })) : ip(s) && (await this.core.history.resolve(s), await this.onRelayEventResponse({ topic: r, payload: s }), this.core.history.delete(r, s.id)); + Ab(s) ? (this.core.history.set(r, s), this.onRelayEventRequest({ topic: r, payload: s })) : bp(s) && (await this.core.history.resolve(s), await this.onRelayEventResponse({ topic: r, payload: s }), this.core.history.delete(r, s.id)); } catch (o) { this.logger.error(o); } }); } registerExpirerEvents() { - this.core.expirer.on(Ji.expired, async (e) => { - const { topic: r } = B8(e.target); - r && this.pairings.keys.includes(r) && (await this.deletePairing(r, !0), this.events.emit(Za.expire, { topic: r })); + this.core.expirer.on(Zi.expired, async (e) => { + const { topic: r } = hE(e.target); + r && this.pairings.keys.includes(r) && (await this.deletePairing(r, !0), this.events.emit(ic.expire, { topic: r })); }); } } -class vV extends Jk { +class JV extends C$ { constructor(e, r) { - super(e, r), this.core = e, this.logger = r, this.records = /* @__PURE__ */ new Map(), this.events = new rs.EventEmitter(), this.name = pH, this.version = gH, this.cached = [], this.initialized = !1, this.storagePrefix = Qs, this.init = async () => { + super(e, r), this.core = e, this.logger = r, this.records = /* @__PURE__ */ new Map(), this.events = new is.EventEmitter(), this.name = VH, this.version = GH, this.cached = [], this.initialized = !1, this.storagePrefix = ro, this.init = async () => { this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((n) => this.records.set(n.id, n)), this.cached = [], this.registerEventListeners(), this.initialized = !0); }, this.set = (n, i, s) => { if (this.isInitialized(), this.logger.debug("Setting JSON-RPC request history record"), this.logger.trace({ type: "method", method: "set", topic: n, request: i, chainId: s }), this.records.has(i.id)) return; - const o = { id: i.id, topic: n, request: { method: i.method, params: i.params || null }, chainId: s, expiry: En(mt.THIRTY_DAYS) }; - this.records.set(o.id, o), this.persist(), this.events.emit(ms.created, o); + const o = { id: i.id, topic: n, request: { method: i.method, params: i.params || null }, chainId: s, expiry: Sn(vt.THIRTY_DAYS) }; + this.records.set(o.id, o), this.persist(), this.events.emit(ys.created, o); }, this.resolve = async (n) => { if (this.isInitialized(), this.logger.debug("Updating JSON-RPC response history record"), this.logger.trace({ type: "method", method: "update", response: n }), !this.records.has(n.id)) return; const i = await this.getRecord(n.id); - typeof i.response > "u" && (i.response = Zi(n) ? { error: n.error } : { result: n.result }, this.records.set(i.id, i), this.persist(), this.events.emit(ms.updated, i)); + typeof i.response > "u" && (i.response = es(n) ? { error: n.error } : { result: n.result }, this.records.set(i.id, i), this.persist(), this.events.emit(ys.updated, i)); }, this.get = async (n, i) => (this.isInitialized(), this.logger.debug("Getting record"), this.logger.trace({ type: "method", method: "get", topic: n, id: i }), await this.getRecord(i)), this.delete = (n, i) => { this.isInitialized(), this.logger.debug("Deleting record"), this.logger.trace({ type: "method", method: "delete", id: i }), this.values.forEach((s) => { if (s.topic === n) { if (typeof i < "u" && s.id !== i) return; - this.records.delete(s.id), this.events.emit(ms.deleted, s); + this.records.delete(s.id), this.events.emit(ys.deleted, s); } }), this.persist(); }, this.exists = async (n, i) => (this.isInitialized(), this.records.has(i) ? (await this.getRecord(i)).topic === n : !1), this.on = (n, i) => { @@ -19459,10 +19971,10 @@ class vV extends Jk { this.events.off(n, i); }, this.removeListener = (n, i) => { this.events.removeListener(n, i); - }, this.logger = ci(r, this.name); + }, this.logger = ui(r, this.name); } get context() { - return Ai(this.logger); + return Pi(this.logger); } get storageKey() { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; @@ -19480,7 +19992,7 @@ class vV extends Jk { const e = []; return this.values.forEach((r) => { if (typeof r.response < "u") return; - const n = { topic: r.topic, request: da(r.request.method, r.request.params, r.id), chainId: r.chainId }; + const n = { topic: r.topic, request: ga(r.request.method, r.request.params, r.id), chainId: r.chainId }; return e.push(n); }), e; } @@ -19500,7 +20012,7 @@ class vV extends Jk { return r; } async persist() { - await this.setJsonRpcRecords(this.values), this.events.emit(ms.sync); + await this.setJsonRpcRecords(this.values), this.events.emit(ys.sync); } async restore() { try { @@ -19516,16 +20028,16 @@ class vV extends Jk { } } registerEventListeners() { - this.events.on(ms.created, (e) => { - const r = ms.created; + this.events.on(ys.created, (e) => { + const r = ys.created; this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, record: e }); - }), this.events.on(ms.updated, (e) => { - const r = ms.updated; + }), this.events.on(ys.updated, (e) => { + const r = ys.updated; this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, record: e }); - }), this.events.on(ms.deleted, (e) => { - const r = ms.deleted; + }), this.events.on(ys.deleted, (e) => { + const r = ys.deleted; this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, record: e }); - }), this.core.heartbeat.on(Ou.pulse, () => { + }), this.core.heartbeat.on(ju.pulse, () => { this.cleanup(); }); } @@ -19534,7 +20046,7 @@ class vV extends Jk { this.isInitialized(); let e = !1; this.records.forEach((r) => { - mt.toMiliseconds(r.expiry || 0) - Date.now() <= 0 && (this.logger.info(`Deleting expired history log: ${r.id}`), this.records.delete(r.id), this.events.emit(ms.deleted, r, !1), e = !0); + vt.toMiliseconds(r.expiry || 0) - Date.now() <= 0 && (this.logger.info(`Deleting expired history log: ${r.id}`), this.records.delete(r.id), this.events.emit(ys.deleted, r, !1), e = !0); }), e && this.persist(); } catch (e) { this.logger.warn(e); @@ -19547,9 +20059,9 @@ class vV extends Jk { } } } -class bV extends r$ { +class XV extends L$ { constructor(e, r) { - super(e, r), this.core = e, this.logger = r, this.expirations = /* @__PURE__ */ new Map(), this.events = new rs.EventEmitter(), this.name = mH, this.version = vH, this.cached = [], this.initialized = !1, this.storagePrefix = Qs, this.init = async () => { + super(e, r), this.core = e, this.logger = r, this.expirations = /* @__PURE__ */ new Map(), this.events = new is.EventEmitter(), this.name = YH, this.version = JH, this.cached = [], this.initialized = !1, this.storagePrefix = ro, this.init = async () => { this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((n) => this.expirations.set(n.target, n)), this.cached = [], this.registerEventListeners(), this.initialized = !0); }, this.has = (n) => { try { @@ -19561,7 +20073,7 @@ class bV extends r$ { }, this.set = (n, i) => { this.isInitialized(); const s = this.formatTarget(n), o = { target: s, expiry: i }; - this.expirations.set(s, o), this.checkExpiry(s, o), this.events.emit(Ji.created, { target: s, expiration: o }); + this.expirations.set(s, o), this.checkExpiry(s, o), this.events.emit(Zi.created, { target: s, expiration: o }); }, this.get = (n) => { this.isInitialized(); const i = this.formatTarget(n); @@ -19569,7 +20081,7 @@ class bV extends r$ { }, this.del = (n) => { if (this.isInitialized(), this.has(n)) { const i = this.formatTarget(n), s = this.getExpiration(i); - this.expirations.delete(i), this.events.emit(Ji.deleted, { target: i, expiration: s }); + this.expirations.delete(i), this.events.emit(Zi.deleted, { target: i, expiration: s }); } }, this.on = (n, i) => { this.events.on(n, i); @@ -19579,10 +20091,10 @@ class bV extends r$ { this.events.off(n, i); }, this.removeListener = (n, i) => { this.events.removeListener(n, i); - }, this.logger = ci(r, this.name); + }, this.logger = ui(r, this.name); } get context() { - return Ai(this.logger); + return Pi(this.logger); } get storageKey() { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; @@ -19597,8 +20109,8 @@ class bV extends r$ { return Array.from(this.expirations.values()); } formatTarget(e) { - if (typeof e == "string") return Hq(e); - if (typeof e == "number") return Kq(e); + if (typeof e == "string") return Sz(e); + if (typeof e == "number") return Az(e); const { message: r } = ft("UNKNOWN_TYPE", `Target type: ${typeof e}`); throw new Error(r); } @@ -19609,7 +20121,7 @@ class bV extends r$ { return await this.core.storage.getItem(this.storageKey); } async persist() { - await this.setExpirations(this.values), this.events.emit(Ji.sync); + await this.setExpirations(this.values), this.events.emit(Zi.sync); } async restore() { try { @@ -19634,23 +20146,23 @@ class bV extends r$ { } checkExpiry(e, r) { const { expiry: n } = r; - mt.toMiliseconds(n) - Date.now() <= 0 && this.expire(e, r); + vt.toMiliseconds(n) - Date.now() <= 0 && this.expire(e, r); } expire(e, r) { - this.expirations.delete(e), this.events.emit(Ji.expired, { target: e, expiration: r }); + this.expirations.delete(e), this.events.emit(Zi.expired, { target: e, expiration: r }); } checkExpirations() { this.core.relayer.connected && this.expirations.forEach((e, r) => this.checkExpiry(r, e)); } registerEventListeners() { - this.core.heartbeat.on(Ou.pulse, () => this.checkExpirations()), this.events.on(Ji.created, (e) => { - const r = Ji.created; + this.core.heartbeat.on(ju.pulse, () => this.checkExpirations()), this.events.on(Zi.created, (e) => { + const r = Zi.created; this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), this.persist(); - }), this.events.on(Ji.expired, (e) => { - const r = Ji.expired; + }), this.events.on(Zi.expired, (e) => { + const r = Zi.expired; this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), this.persist(); - }), this.events.on(Ji.deleted, (e) => { - const r = Ji.deleted; + }), this.events.on(Zi.deleted, (e) => { + const r = Zi.deleted; this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), this.persist(); }); } @@ -19661,34 +20173,34 @@ class bV extends r$ { } } } -class yV extends n$ { +class ZV extends k$ { constructor(e, r, n) { - super(e, r, n), this.core = e, this.logger = r, this.store = n, this.name = bH, this.verifyUrlV3 = wH, this.storagePrefix = Qs, this.version = rE, this.init = async () => { + super(e, r, n), this.core = e, this.logger = r, this.store = n, this.name = XH, this.verifyUrlV3 = QH, this.storagePrefix = ro, this.version = TE, this.init = async () => { var i; - this.isDevEnv || (this.publicKey = await this.store.getItem(this.storeKey), this.publicKey && mt.toMiliseconds((i = this.publicKey) == null ? void 0 : i.expiresAt) < Date.now() && (this.logger.debug("verify v2 public key expired"), await this.removePublicKey())); + this.isDevEnv || (this.publicKey = await this.store.getItem(this.storeKey), this.publicKey && vt.toMiliseconds((i = this.publicKey) == null ? void 0 : i.expiresAt) < Date.now() && (this.logger.debug("verify v2 public key expired"), await this.removePublicKey())); }, this.register = async (i) => { - if (!Zl() || this.isDevEnv) return; + if (!ah() || this.isDevEnv) return; const s = window.location.origin, { id: o, decryptedId: a } = i, u = `${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`; try { - const l = Kl(), d = this.startAbortTimer(mt.ONE_SECOND * 5), p = await new Promise((w, A) => { - const M = () => { - window.removeEventListener("message", L), l.body.removeChild(N), A("attestation aborted"); + const l = th(), d = this.startAbortTimer(vt.ONE_SECOND * 5), p = await new Promise((w, _) => { + const P = () => { + window.removeEventListener("message", L), l.body.removeChild(O), _("attestation aborted"); }; - this.abortController.signal.addEventListener("abort", M); - const N = l.createElement("iframe"); - N.src = u, N.style.display = "none", N.addEventListener("error", M, { signal: this.abortController.signal }); + this.abortController.signal.addEventListener("abort", P); + const O = l.createElement("iframe"); + O.src = u, O.style.display = "none", O.addEventListener("error", P, { signal: this.abortController.signal }); const L = (B) => { if (B.data && typeof B.data == "string") try { - const $ = JSON.parse(B.data); - if ($.type === "verify_attestation") { - if (v1($.attestation).payload.id !== o) return; - clearInterval(d), l.body.removeChild(N), this.abortController.signal.removeEventListener("abort", M), window.removeEventListener("message", L), w($.attestation === null ? "" : $.attestation); + const k = JSON.parse(B.data); + if (k.type === "verify_attestation") { + if (O1(k.attestation).payload.id !== o) return; + clearInterval(d), l.body.removeChild(O), this.abortController.signal.removeEventListener("abort", P), window.removeEventListener("message", L), w(k.attestation === null ? "" : k.attestation); } - } catch ($) { - this.logger.warn($); + } catch (k) { + this.logger.warn(k); } }; - l.body.appendChild(N), window.addEventListener("message", L, { signal: this.abortController.signal }); + l.body.appendChild(O), window.addEventListener("message", L, { signal: this.abortController.signal }); }); return this.logger.debug("jwt attestation", p), p; } catch (l) { @@ -19703,7 +20215,7 @@ class yV extends n$ { return; } if (s) { - if (v1(s).payload.id !== a) return; + if (O1(s).payload.id !== a) return; const l = await this.isValidJwtAttestation(s); if (l) { if (!l.isVerified) { @@ -19718,15 +20230,15 @@ class yV extends n$ { return this.fetchAttestation(o, u); }, this.fetchAttestation = async (i, s) => { this.logger.debug(`resolving attestation: ${i} from url: ${s}`); - const o = this.startAbortTimer(mt.ONE_SECOND * 5), a = await fetch(`${s}/attestation/${i}?v2Supported=true`, { signal: this.abortController.signal }); + const o = this.startAbortTimer(vt.ONE_SECOND * 5), a = await fetch(`${s}/attestation/${i}?v2Supported=true`, { signal: this.abortController.signal }); return clearTimeout(o), a.status === 200 ? await a.json() : void 0; }, this.getVerifyUrl = (i) => { - let s = i || Wf; - return xH.includes(s) || (this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Wf}`), s = Wf), s; + let s = i || Xf; + return eK.includes(s) || (this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Xf}`), s = Xf), s; }, this.fetchPublicKey = async () => { try { this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`); - const i = this.startAbortTimer(mt.FIVE_SECONDS), s = await fetch(`${this.verifyUrlV3}/public-key`, { signal: this.abortController.signal }); + const i = this.startAbortTimer(vt.FIVE_SECONDS), s = await fetch(`${this.verifyUrlV3}/public-key`, { signal: this.abortController.signal }); return clearTimeout(i), await s.json(); } catch (i) { this.logger.warn(i); @@ -19757,58 +20269,58 @@ class yV extends n$ { const i = await this.fetchPromise; return this.fetchPromise = void 0, i; }, this.validateAttestation = (i, s) => { - const o = Dz(i, s.publicKey), a = { hasExpired: mt.toMiliseconds(o.exp) < Date.now(), payload: o }; + const o = lW(i, s.publicKey), a = { hasExpired: vt.toMiliseconds(o.exp) < Date.now(), payload: o }; if (a.hasExpired) throw this.logger.warn("resolve: jwt attestation expired"), new Error("JWT attestation expired"); return { origin: a.payload.origin, isScam: a.payload.isScam, isVerified: a.payload.isVerified }; - }, this.logger = ci(r, this.name), this.abortController = new AbortController(), this.isDevEnv = sb(), this.init(); + }, this.logger = ui(r, this.name), this.abortController = new AbortController(), this.isDevEnv = yb(), this.init(); } get storeKey() { return this.storagePrefix + this.version + this.core.customStoragePrefix + "//verify:public:key"; } get context() { - return Ai(this.logger); + return Pi(this.logger); } startAbortTimer(e) { - return this.abortController = new AbortController(), setTimeout(() => this.abortController.abort(), mt.toMiliseconds(e)); + return this.abortController = new AbortController(), setTimeout(() => this.abortController.abort(), vt.toMiliseconds(e)); } } -class wV extends i$ { +class QV extends $$ { constructor(e, r) { - super(e, r), this.projectId = e, this.logger = r, this.context = _H, this.registerDeviceToken = async (n) => { - const { clientId: i, token: s, notificationType: o, enableEncrypted: a = !1 } = n, u = `${EH}/${this.projectId}/clients`; + super(e, r), this.projectId = e, this.logger = r, this.context = tK, this.registerDeviceToken = async (n) => { + const { clientId: i, token: s, notificationType: o, enableEncrypted: a = !1 } = n, u = `${rK}/${this.projectId}/clients`; await fetch(u, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ client_id: i, type: o, token: s, always_raw: a }) }); - }, this.logger = ci(r, this.context); + }, this.logger = ui(r, this.context); } } -var xV = Object.defineProperty, C3 = Object.getOwnPropertySymbols, _V = Object.prototype.hasOwnProperty, EV = Object.prototype.propertyIsEnumerable, T3 = (t, e, r) => e in t ? xV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Tf = (t, e) => { - for (var r in e || (e = {})) _V.call(e, r) && T3(t, r, e[r]); - if (C3) for (var r of C3(e)) EV.call(e, r) && T3(t, r, e[r]); +var eG = Object.defineProperty, H3 = Object.getOwnPropertySymbols, tG = Object.prototype.hasOwnProperty, rG = Object.prototype.propertyIsEnumerable, K3 = (t, e, r) => e in t ? eG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, $f = (t, e) => { + for (var r in e || (e = {})) tG.call(e, r) && K3(t, r, e[r]); + if (H3) for (var r of H3(e)) rG.call(e, r) && K3(t, r, e[r]); return t; }; -class SV extends s$ { +class nG extends B$ { constructor(e, r, n = !0) { - super(e, r, n), this.core = e, this.logger = r, this.context = AH, this.storagePrefix = Qs, this.storageVersion = SH, this.events = /* @__PURE__ */ new Map(), this.shouldPersist = !1, this.init = async () => { - if (!sb()) try { - const i = { eventId: jx(), timestamp: Date.now(), domain: this.getAppDomain(), props: { event: "INIT", type: "", properties: { client_id: await this.core.crypto.getClientId(), user_agent: N8(this.core.relayer.protocol, this.core.relayer.version, T1) } } }; + super(e, r, n), this.core = e, this.logger = r, this.context = iK, this.storagePrefix = ro, this.storageVersion = nK, this.events = /* @__PURE__ */ new Map(), this.shouldPersist = !1, this.init = async () => { + if (!yb()) try { + const i = { eventId: r3(), timestamp: Date.now(), domain: this.getAppDomain(), props: { event: "INIT", type: "", properties: { client_id: await this.core.crypto.getClientId(), user_agent: cE(this.core.relayer.protocol, this.core.relayer.version, K1) } } }; await this.sendEvent([i]); } catch (i) { this.logger.warn(i); } }, this.createEvent = (i) => { - const { event: s = "ERROR", type: o = "", properties: { topic: a, trace: u } } = i, l = jx(), d = this.core.projectId || "", p = Date.now(), w = Tf({ eventId: l, timestamp: p, props: { event: s, type: o, properties: { topic: a, trace: u } }, bundleId: d, domain: this.getAppDomain() }, this.setMethods(l)); + const { event: s = "ERROR", type: o = "", properties: { topic: a, trace: u } } = i, l = r3(), d = this.core.projectId || "", p = Date.now(), w = $f({ eventId: l, timestamp: p, props: { event: s, type: o, properties: { topic: a, trace: u } }, bundleId: d, domain: this.getAppDomain() }, this.setMethods(l)); return this.telemetryEnabled && (this.events.set(l, w), this.shouldPersist = !0), w; }, this.getEvent = (i) => { const { eventId: s, topic: o } = i; if (s) return this.events.get(s); const a = Array.from(this.events.values()).find((u) => u.props.properties.topic === o); - if (a) return Tf(Tf({}, a), this.setMethods(a.eventId)); + if (a) return $f($f({}, a), this.setMethods(a.eventId)); }, this.deleteEvent = (i) => { const { eventId: s } = i; this.events.delete(s), this.shouldPersist = !0; }, this.setEventListeners = () => { - this.core.heartbeat.on(Ou.pulse, async () => { + this.core.heartbeat.on(ju.pulse, async () => { this.shouldPersist && await this.persist(), this.events.forEach((i) => { - mt.fromMiliseconds(Date.now()) - mt.fromMiliseconds(i.timestamp) > PH && (this.events.delete(i.eventId), this.shouldPersist = !0); + vt.fromMiliseconds(Date.now()) - vt.fromMiliseconds(i.timestamp) > sK && (this.events.delete(i.eventId), this.shouldPersist = !0); }); }); }, this.setMethods = (i) => ({ addTrace: (s) => this.addTrace(i, s), setError: (s) => this.setError(i, s) }), this.addTrace = (i, s) => { @@ -19824,7 +20336,7 @@ class SV extends s$ { const i = await this.core.storage.getItem(this.storageKey) || []; if (!i.length) return; i.forEach((s) => { - this.events.set(s.eventId, Tf(Tf({}, s), this.setMethods(s.eventId))); + this.events.set(s.eventId, $f($f({}, s), this.setMethods(s.eventId))); }); } catch (i) { this.logger.warn(i); @@ -19840,8 +20352,8 @@ class SV extends s$ { } }, this.sendEvent = async (i) => { const s = this.getAppDomain() ? "" : "&sp=desktop"; - return await fetch(`${MH}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${T1}${s}`, { method: "POST", body: JSON.stringify(i) }); - }, this.getAppDomain = () => O8().url, this.logger = ci(r, this.context), this.telemetryEnabled = n, n ? this.restore().then(async () => { + return await fetch(`${oK}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${K1}${s}`, { method: "POST", body: JSON.stringify(i) }); + }, this.getAppDomain = () => aE().url, this.logger = ui(r, this.context), this.telemetryEnabled = n, n ? this.restore().then(async () => { await this.submit(), this.setEventListeners(); }) : this.persist(); } @@ -19849,33 +20361,33 @@ class SV extends s$ { return this.storagePrefix + this.storageVersion + this.core.customStoragePrefix + "//" + this.context; } } -var AV = Object.defineProperty, R3 = Object.getOwnPropertySymbols, PV = Object.prototype.hasOwnProperty, MV = Object.prototype.propertyIsEnumerable, D3 = (t, e, r) => e in t ? AV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, O3 = (t, e) => { - for (var r in e || (e = {})) PV.call(e, r) && D3(t, r, e[r]); - if (R3) for (var r of R3(e)) MV.call(e, r) && D3(t, r, e[r]); +var iG = Object.defineProperty, V3 = Object.getOwnPropertySymbols, sG = Object.prototype.hasOwnProperty, oG = Object.prototype.propertyIsEnumerable, G3 = (t, e, r) => e in t ? iG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Y3 = (t, e) => { + for (var r in e || (e = {})) sG.call(e, r) && G3(t, r, e[r]); + if (V3) for (var r of V3(e)) oG.call(e, r) && G3(t, r, e[r]); return t; }; -class hb extends Yk { +class Pb extends I$ { constructor(e) { var r; - super(e), this.protocol = tE, this.version = rE, this.name = nE, this.events = new rs.EventEmitter(), this.initialized = !1, this.on = (o, a) => this.events.on(o, a), this.once = (o, a) => this.events.once(o, a), this.off = (o, a) => this.events.off(o, a), this.removeListener = (o, a) => this.events.removeListener(o, a), this.dispatchEnvelope = ({ topic: o, message: a, sessionExists: u }) => { + super(e), this.protocol = CE, this.version = TE, this.name = RE, this.events = new is.EventEmitter(), this.initialized = !1, this.on = (o, a) => this.events.on(o, a), this.once = (o, a) => this.events.once(o, a), this.off = (o, a) => this.events.off(o, a), this.removeListener = (o, a) => this.events.removeListener(o, a), this.dispatchEnvelope = ({ topic: o, message: a, sessionExists: u }) => { if (!o || !a) return; const l = { topic: o, message: a, publishedAt: Date.now(), transportType: zr.link_mode }; this.relayer.onLinkMessageEvent(l, { sessionExists: u }); - }, this.projectId = e == null ? void 0 : e.projectId, this.relayUrl = (e == null ? void 0 : e.relayUrl) || sE, this.customStoragePrefix = e != null && e.customStoragePrefix ? `:${e.customStoragePrefix}` : ""; - const n = $0({ level: typeof (e == null ? void 0 : e.logger) == "string" && e.logger ? e.logger : VW.logger }), { logger: i, chunkLoggerController: s } = Gk({ opts: n, maxSizeInBytes: e == null ? void 0 : e.maxLogBlobSizeInBytes, loggerOverride: e == null ? void 0 : e.logger }); + }, this.projectId = e == null ? void 0 : e.projectId, this.relayUrl = (e == null ? void 0 : e.relayUrl) || OE, this.customStoragePrefix = e != null && e.customStoragePrefix ? `:${e.customStoragePrefix}` : ""; + const n = X0({ level: typeof (e == null ? void 0 : e.logger) == "string" && e.logger ? e.logger : PH.logger }), { logger: i, chunkLoggerController: s } = M$({ opts: n, maxSizeInBytes: e == null ? void 0 : e.maxLogBlobSizeInBytes, loggerOverride: e == null ? void 0 : e.logger }); this.logChunkController = s, (r = this.logChunkController) != null && r.downloadLogsBlobInBrowser && (window.downloadLogsBlobInBrowser = async () => { var o, a; (o = this.logChunkController) != null && o.downloadLogsBlobInBrowser && ((a = this.logChunkController) == null || a.downloadLogsBlobInBrowser({ clientId: await this.crypto.getClientId() })); - }), this.logger = ci(i, this.name), this.heartbeat = new qL(), this.crypto = new QK(this, this.logger, e == null ? void 0 : e.keychain), this.history = new vV(this, this.logger), this.expirer = new bV(this, this.logger), this.storage = e != null && e.storage ? e.storage : new wk(O3(O3({}, GW), e == null ? void 0 : e.storageOptions)), this.relayer = new hV({ core: this, logger: this.logger, relayUrl: this.relayUrl, projectId: this.projectId }), this.pairing = new mV(this, this.logger), this.verify = new yV(this, this.logger, this.storage), this.echoClient = new wV(this.projectId || "", this.logger), this.linkModeSupportedApps = [], this.eventClient = new SV(this, this.logger, e == null ? void 0 : e.telemetryEnabled); + }), this.logger = ui(i, this.name), this.heartbeat = new xk(), this.crypto = new DV(this, this.logger, e == null ? void 0 : e.keychain), this.history = new JV(this, this.logger), this.expirer = new XV(this, this.logger), this.storage = e != null && e.storage ? e.storage : new Qk(Y3(Y3({}, MH), e == null ? void 0 : e.storageOptions)), this.relayer = new HV({ core: this, logger: this.logger, relayUrl: this.relayUrl, projectId: this.projectId }), this.pairing = new YV(this, this.logger), this.verify = new ZV(this, this.logger, this.storage), this.echoClient = new QV(this.projectId || "", this.logger), this.linkModeSupportedApps = [], this.eventClient = new nG(this, this.logger, e == null ? void 0 : e.telemetryEnabled); } static async init(e) { - const r = new hb(e); + const r = new Pb(e); await r.initialize(); const n = await r.crypto.getClientId(); - return await r.storage.setItem(cH, n), r; + return await r.storage.setItem(UH, n), r; } get context() { - return Ai(this.logger); + return Pi(this.logger); } async start() { this.initialized || await this.initialize(); @@ -19885,32 +20397,32 @@ class hb extends Yk { return (e = this.logChunkController) == null ? void 0 : e.logsToBlob({ clientId: await this.crypto.getClientId() }); } async addLinkModeSupportedApp(e) { - this.linkModeSupportedApps.includes(e) || (this.linkModeSupportedApps.push(e), await this.storage.setItem(p3, this.linkModeSupportedApps)); + this.linkModeSupportedApps.includes(e) || (this.linkModeSupportedApps.push(e), await this.storage.setItem(T3, this.linkModeSupportedApps)); } async initialize() { this.logger.trace("Initialized"); try { - await this.crypto.init(), await this.history.init(), await this.expirer.init(), await this.relayer.init(), await this.heartbeat.init(), await this.pairing.init(), this.eventClient.init(), this.linkModeSupportedApps = await this.storage.getItem(p3) || [], this.initialized = !0, this.logger.info("Core Initialization Success"); + await this.crypto.init(), await this.history.init(), await this.expirer.init(), await this.relayer.init(), await this.heartbeat.init(), await this.pairing.init(), this.eventClient.init(), this.linkModeSupportedApps = await this.storage.getItem(T3) || [], this.initialized = !0, this.logger.info("Core Initialization Success"); } catch (e) { throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`, e), this.logger.error(e.message), e; } } } -const IV = hb, vE = "wc", bE = 2, yE = "client", db = `${vE}@${bE}:${yE}:`, mm = { name: yE, logger: "error" }, N3 = "WALLETCONNECT_DEEPLINK_CHOICE", CV = "proposal", wE = "Proposal expired", TV = "session", Kc = mt.SEVEN_DAYS, RV = "engine", In = { wc_sessionPropose: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1100 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1101 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1120 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1121 } }, wc_sessionSettle: { req: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1102 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1103 } }, wc_sessionUpdate: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1104 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1105 } }, wc_sessionExtend: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1106 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1107 } }, wc_sessionRequest: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1108 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1109 } }, wc_sessionEvent: { req: { ttl: mt.FIVE_MINUTES, prompt: !0, tag: 1110 }, res: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1111 } }, wc_sessionDelete: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1112 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1113 } }, wc_sessionPing: { req: { ttl: mt.ONE_DAY, prompt: !1, tag: 1114 }, res: { ttl: mt.ONE_DAY, prompt: !1, tag: 1115 } }, wc_sessionAuthenticate: { req: { ttl: mt.ONE_HOUR, prompt: !0, tag: 1116 }, res: { ttl: mt.ONE_HOUR, prompt: !1, tag: 1117 }, reject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1118 }, autoReject: { ttl: mt.FIVE_MINUTES, prompt: !1, tag: 1119 } } }, vm = { min: mt.FIVE_MINUTES, max: mt.SEVEN_DAYS }, ks = { idle: "IDLE", active: "ACTIVE" }, DV = "request", OV = ["wc_sessionPropose", "wc_sessionRequest", "wc_authRequest", "wc_sessionAuthenticate"], NV = "wc", LV = "auth", kV = "authKeys", $V = "pairingTopics", BV = "requests", op = `${NV}@${1.5}:${LV}:`, Rd = `${op}:PUB_KEY`; -var FV = Object.defineProperty, jV = Object.defineProperties, UV = Object.getOwnPropertyDescriptors, L3 = Object.getOwnPropertySymbols, qV = Object.prototype.hasOwnProperty, zV = Object.prototype.propertyIsEnumerable, k3 = (t, e, r) => e in t ? FV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, tn = (t, e) => { - for (var r in e || (e = {})) qV.call(e, r) && k3(t, r, e[r]); - if (L3) for (var r of L3(e)) zV.call(e, r) && k3(t, r, e[r]); +const aG = Pb, HE = "wc", KE = 2, VE = "client", Mb = `${HE}@${KE}:${VE}:`, Tm = { name: VE, logger: "error" }, J3 = "WALLETCONNECT_DEEPLINK_CHOICE", cG = "proposal", GE = "Proposal expired", uG = "session", ru = vt.SEVEN_DAYS, fG = "engine", In = { wc_sessionPropose: { req: { ttl: vt.FIVE_MINUTES, prompt: !0, tag: 1100 }, res: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1101 }, reject: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1120 }, autoReject: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1121 } }, wc_sessionSettle: { req: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1102 }, res: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1103 } }, wc_sessionUpdate: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1104 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1105 } }, wc_sessionExtend: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1106 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1107 } }, wc_sessionRequest: { req: { ttl: vt.FIVE_MINUTES, prompt: !0, tag: 1108 }, res: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1109 } }, wc_sessionEvent: { req: { ttl: vt.FIVE_MINUTES, prompt: !0, tag: 1110 }, res: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1111 } }, wc_sessionDelete: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1112 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1113 } }, wc_sessionPing: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1114 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1115 } }, wc_sessionAuthenticate: { req: { ttl: vt.ONE_HOUR, prompt: !0, tag: 1116 }, res: { ttl: vt.ONE_HOUR, prompt: !1, tag: 1117 }, reject: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1118 }, autoReject: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1119 } } }, Rm = { min: vt.FIVE_MINUTES, max: vt.SEVEN_DAYS }, Fs = { idle: "IDLE", active: "ACTIVE" }, lG = "request", hG = ["wc_sessionPropose", "wc_sessionRequest", "wc_authRequest", "wc_sessionAuthenticate"], dG = "wc", pG = "auth", gG = "authKeys", mG = "pairingTopics", vG = "requests", wp = `${dG}@${1.5}:${pG}:`, zd = `${wp}:PUB_KEY`; +var bG = Object.defineProperty, yG = Object.defineProperties, wG = Object.getOwnPropertyDescriptors, X3 = Object.getOwnPropertySymbols, xG = Object.prototype.hasOwnProperty, _G = Object.prototype.propertyIsEnumerable, Z3 = (t, e, r) => e in t ? bG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, tn = (t, e) => { + for (var r in e || (e = {})) xG.call(e, r) && Z3(t, r, e[r]); + if (X3) for (var r of X3(e)) _G.call(e, r) && Z3(t, r, e[r]); return t; -}, bs = (t, e) => jV(t, UV(e)); -class WV extends a$ { +}, xs = (t, e) => yG(t, wG(e)); +class EG extends j$ { constructor(e) { - super(e), this.name = RV, this.events = new $v(), this.initialized = !1, this.requestQueue = { state: ks.idle, queue: [] }, this.sessionRequestQueue = { state: ks.idle, queue: [] }, this.requestQueueDelay = mt.ONE_SECOND, this.expectedPairingMethodMap = /* @__PURE__ */ new Map(), this.recentlyDeletedMap = /* @__PURE__ */ new Map(), this.recentlyDeletedLimit = 200, this.relayMessageCache = [], this.init = async () => { + super(e), this.name = fG, this.events = new Xv(), this.initialized = !1, this.requestQueue = { state: Fs.idle, queue: [] }, this.sessionRequestQueue = { state: Fs.idle, queue: [] }, this.requestQueueDelay = vt.ONE_SECOND, this.expectedPairingMethodMap = /* @__PURE__ */ new Map(), this.recentlyDeletedMap = /* @__PURE__ */ new Map(), this.recentlyDeletedLimit = 200, this.relayMessageCache = [], this.init = async () => { this.initialized || (await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.registerPairingEvents(), await this.registerLinkModeListeners(), this.client.core.pairing.register({ methods: Object.keys(In) }), this.initialized = !0, setTimeout(() => { this.sessionRequestQueue.queue = this.getPendingSessionRequests(), this.processSessionRequestQueue(); - }, mt.toMiliseconds(this.requestQueueDelay))); + }, vt.toMiliseconds(this.requestQueueDelay))); }, this.connect = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); - const n = bs(tn({}, r), { requiredNamespaces: r.requiredNamespaces || {}, optionalNamespaces: r.optionalNamespaces || {} }); + const n = xs(tn({}, r), { requiredNamespaces: r.requiredNamespaces || {}, optionalNamespaces: r.optionalNamespaces || {} }); await this.isValidConnect(n); const { pairingTopic: i, requiredNamespaces: s, optionalNamespaces: o, sessionProperties: a, relays: u } = n; let l = i, d, p = !1; @@ -19927,17 +20439,17 @@ class WV extends a$ { const { message: U } = ft("NO_MATCHING_KEY", `connect() pairing topic: ${l}`); throw new Error(U); } - const w = await this.client.core.crypto.generateKeyPair(), A = In.wc_sessionPropose.req.ttl || mt.FIVE_MINUTES, M = En(A), N = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: u ?? [{ protocol: iE }], proposer: { publicKey: w, metadata: this.client.metadata }, expiryTimestamp: M, pairingTopic: l }, a && { sessionProperties: a }), { reject: L, resolve: B, done: $ } = Ga(A, wE); - this.events.once(br("session_connect"), async ({ error: U, session: V }) => { + const w = await this.client.core.crypto.generateKeyPair(), _ = In.wc_sessionPropose.req.ttl || vt.FIVE_MINUTES, P = Sn(_), O = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: u ?? [{ protocol: DE }], proposer: { publicKey: w, metadata: this.client.metadata }, expiryTimestamp: P, pairingTopic: l }, a && { sessionProperties: a }), { reject: L, resolve: B, done: k } = ec(_, GE); + this.events.once(yr("session_connect"), async ({ error: U, session: V }) => { if (U) L(U); else if (V) { V.self.publicKey = w; - const te = bs(tn({}, V), { pairingTopic: N.pairingTopic, requiredNamespaces: N.requiredNamespaces, optionalNamespaces: N.optionalNamespaces, transportType: zr.relay }); - await this.client.session.set(V.topic, te), await this.setExpiry(V.topic, V.expiry), l && await this.client.core.pairing.updateMetadata({ topic: l, metadata: V.peer.metadata }), this.cleanupDuplicatePairings(te), B(te); + const Q = xs(tn({}, V), { pairingTopic: O.pairingTopic, requiredNamespaces: O.requiredNamespaces, optionalNamespaces: O.optionalNamespaces, transportType: zr.relay }); + await this.client.session.set(V.topic, Q), await this.setExpiry(V.topic, V.expiry), l && await this.client.core.pairing.updateMetadata({ topic: l, metadata: V.peer.metadata }), this.cleanupDuplicatePairings(Q), B(Q); } }); - const H = await this.sendRequest({ topic: l, method: "wc_sessionPropose", params: N, throwOnFailedPublish: !0 }); - return await this.setProposal(H, tn({ id: H }, N)), { uri: d, approval: $ }; + const q = await this.sendRequest({ topic: l, method: "wc_sessionPropose", params: O, throwOnFailedPublish: !0 }); + return await this.setProposal(q, tn({ id: q }, O)), { uri: d, approval: k }; }, this.pair = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); try { @@ -19947,47 +20459,47 @@ class WV extends a$ { } }, this.approve = async (r) => { var n, i, s; - const o = this.client.core.eventClient.createEvent({ properties: { topic: (n = r == null ? void 0 : r.id) == null ? void 0 : n.toString(), trace: [vs.session_approve_started] } }); + const o = this.client.core.eventClient.createEvent({ properties: { topic: (n = r == null ? void 0 : r.id) == null ? void 0 : n.toString(), trace: [ws.session_approve_started] } }); try { this.isInitialized(), await this.confirmOnlineStateOrThrow(); } catch (K) { - throw o.setError(Ha.no_internet_connection), K; + throw o.setError(Xa.no_internet_connection), K; } try { await this.isValidProposalId(r == null ? void 0 : r.id); } catch (K) { - throw this.client.logger.error(`approve() -> proposal.get(${r == null ? void 0 : r.id}) failed`), o.setError(Ha.proposal_not_found), K; + throw this.client.logger.error(`approve() -> proposal.get(${r == null ? void 0 : r.id}) failed`), o.setError(Xa.proposal_not_found), K; } try { await this.isValidApprove(r); } catch (K) { - throw this.client.logger.error("approve() -> isValidApprove() failed"), o.setError(Ha.session_approve_namespace_validation_failure), K; + throw this.client.logger.error("approve() -> isValidApprove() failed"), o.setError(Xa.session_approve_namespace_validation_failure), K; } const { id: a, relayProtocol: u, namespaces: l, sessionProperties: d, sessionConfig: p } = r, w = this.client.proposal.get(a); this.client.core.eventClient.deleteEvent({ eventId: o.eventId }); - const { pairingTopic: A, proposer: M, requiredNamespaces: N, optionalNamespaces: L } = w; - let B = (i = this.client.core.eventClient) == null ? void 0 : i.getEvent({ topic: A }); - B || (B = (s = this.client.core.eventClient) == null ? void 0 : s.createEvent({ type: vs.session_approve_started, properties: { topic: A, trace: [vs.session_approve_started, vs.session_namespaces_validation_success] } })); - const $ = await this.client.core.crypto.generateKeyPair(), H = M.publicKey, U = await this.client.core.crypto.generateSharedKey($, H), V = tn(tn({ relay: { protocol: u ?? "irn" }, namespaces: l, controller: { publicKey: $, metadata: this.client.metadata }, expiry: En(Kc) }, d && { sessionProperties: d }), p && { sessionConfig: p }), te = zr.relay; - B.addTrace(vs.subscribing_session_topic); + const { pairingTopic: _, proposer: P, requiredNamespaces: O, optionalNamespaces: L } = w; + let B = (i = this.client.core.eventClient) == null ? void 0 : i.getEvent({ topic: _ }); + B || (B = (s = this.client.core.eventClient) == null ? void 0 : s.createEvent({ type: ws.session_approve_started, properties: { topic: _, trace: [ws.session_approve_started, ws.session_namespaces_validation_success] } })); + const k = await this.client.core.crypto.generateKeyPair(), q = P.publicKey, U = await this.client.core.crypto.generateSharedKey(k, q), V = tn(tn({ relay: { protocol: u ?? "irn" }, namespaces: l, controller: { publicKey: k, metadata: this.client.metadata }, expiry: Sn(ru) }, d && { sessionProperties: d }), p && { sessionConfig: p }), Q = zr.relay; + B.addTrace(ws.subscribing_session_topic); try { - await this.client.core.relayer.subscribe(U, { transportType: te }); + await this.client.core.relayer.subscribe(U, { transportType: Q }); } catch (K) { - throw B.setError(Ha.subscribe_session_topic_failure), K; + throw B.setError(Xa.subscribe_session_topic_failure), K; } - B.addTrace(vs.subscribe_session_topic_success); - const R = bs(tn({}, V), { topic: U, requiredNamespaces: N, optionalNamespaces: L, pairingTopic: A, acknowledged: !1, self: V.controller, peer: { publicKey: M.publicKey, metadata: M.metadata }, controller: $, transportType: zr.relay }); - await this.client.session.set(U, R), B.addTrace(vs.store_session); + B.addTrace(ws.subscribe_session_topic_success); + const R = xs(tn({}, V), { topic: U, requiredNamespaces: O, optionalNamespaces: L, pairingTopic: _, acknowledged: !1, self: V.controller, peer: { publicKey: P.publicKey, metadata: P.metadata }, controller: k, transportType: zr.relay }); + await this.client.session.set(U, R), B.addTrace(ws.store_session); try { - B.addTrace(vs.publishing_session_settle), await this.sendRequest({ topic: U, method: "wc_sessionSettle", params: V, throwOnFailedPublish: !0 }).catch((K) => { - throw B == null || B.setError(Ha.session_settle_publish_failure), K; - }), B.addTrace(vs.session_settle_publish_success), B.addTrace(vs.publishing_session_approve), await this.sendResult({ id: a, topic: A, result: { relay: { protocol: u ?? "irn" }, responderPublicKey: $ }, throwOnFailedPublish: !0 }).catch((K) => { - throw B == null || B.setError(Ha.session_approve_publish_failure), K; - }), B.addTrace(vs.session_approve_publish_success); + B.addTrace(ws.publishing_session_settle), await this.sendRequest({ topic: U, method: "wc_sessionSettle", params: V, throwOnFailedPublish: !0 }).catch((K) => { + throw B == null || B.setError(Xa.session_settle_publish_failure), K; + }), B.addTrace(ws.session_settle_publish_success), B.addTrace(ws.publishing_session_approve), await this.sendResult({ id: a, topic: _, result: { relay: { protocol: u ?? "irn" }, responderPublicKey: k }, throwOnFailedPublish: !0 }).catch((K) => { + throw B == null || B.setError(Xa.session_approve_publish_failure), K; + }), B.addTrace(ws.session_approve_publish_success); } catch (K) { throw this.client.logger.error(K), this.client.session.delete(U, Or("USER_DISCONNECTED")), await this.client.core.relayer.unsubscribe(U), K; } - return this.client.core.eventClient.deleteEvent({ eventId: B.eventId }), await this.client.core.pairing.updateMetadata({ topic: A, metadata: M.metadata }), await this.client.proposal.delete(a, Or("USER_DISCONNECTED")), await this.client.core.pairing.activate({ topic: A }), await this.setExpiry(U, En(Kc)), { topic: U, acknowledged: () => Promise.resolve(this.client.session.get(U)) }; + return this.client.core.eventClient.deleteEvent({ eventId: B.eventId }), await this.client.core.pairing.updateMetadata({ topic: _, metadata: P.metadata }), await this.client.proposal.delete(a, Or("USER_DISCONNECTED")), await this.client.core.pairing.activate({ topic: _ }), await this.setExpiry(U, Sn(ru)), { topic: U, acknowledged: () => Promise.resolve(this.client.session.get(U)) }; }, this.reject = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); try { @@ -20010,8 +20522,8 @@ class WV extends a$ { } catch (p) { throw this.client.logger.error("update() -> isValidUpdate() failed"), p; } - const { topic: n, namespaces: i } = r, { done: s, resolve: o, reject: a } = Ga(), u = ua(), l = nc().toString(), d = this.client.session.get(n).namespaces; - return this.events.once(br("session_update", u), ({ error: p }) => { + const { topic: n, namespaces: i } = r, { done: s, resolve: o, reject: a } = ec(), u = la(), l = fc().toString(), d = this.client.session.get(n).namespaces; + return this.events.once(yr("session_update", u), ({ error: p }) => { p ? a(p) : o(); }), await this.client.session.update(n, { namespaces: i }), await this.sendRequest({ topic: n, method: "wc_sessionUpdate", params: { namespaces: i }, throwOnFailedPublish: !0, clientRpcId: u, relayRpcId: l }).catch((p) => { this.client.logger.error(p), this.client.session.update(n, { namespaces: d }), a(p); @@ -20023,42 +20535,42 @@ class WV extends a$ { } catch (u) { throw this.client.logger.error("extend() -> isValidExtend() failed"), u; } - const { topic: n } = r, i = ua(), { done: s, resolve: o, reject: a } = Ga(); - return this.events.once(br("session_extend", i), ({ error: u }) => { + const { topic: n } = r, i = la(), { done: s, resolve: o, reject: a } = ec(); + return this.events.once(yr("session_extend", i), ({ error: u }) => { u ? a(u) : o(); - }), await this.setExpiry(n, En(Kc)), this.sendRequest({ topic: n, method: "wc_sessionExtend", params: {}, clientRpcId: i, throwOnFailedPublish: !0 }).catch((u) => { + }), await this.setExpiry(n, Sn(ru)), this.sendRequest({ topic: n, method: "wc_sessionExtend", params: {}, clientRpcId: i, throwOnFailedPublish: !0 }).catch((u) => { a(u); }), { acknowledged: s }; }, this.request = async (r) => { this.isInitialized(); try { await this.isValidRequest(r); - } catch (M) { - throw this.client.logger.error("request() -> isValidRequest() failed"), M; + } catch (P) { + throw this.client.logger.error("request() -> isValidRequest() failed"), P; } const { chainId: n, request: i, topic: s, expiry: o = In.wc_sessionRequest.req.ttl } = r, a = this.client.session.get(s); (a == null ? void 0 : a.transportType) === zr.relay && await this.confirmOnlineStateOrThrow(); - const u = ua(), l = nc().toString(), { done: d, resolve: p, reject: w } = Ga(o, "Request expired. Please try again."); - this.events.once(br("session_request", u), ({ error: M, result: N }) => { - M ? w(M) : p(N); + const u = la(), l = fc().toString(), { done: d, resolve: p, reject: w } = ec(o, "Request expired. Please try again."); + this.events.once(yr("session_request", u), ({ error: P, result: O }) => { + P ? w(P) : p(O); }); - const A = this.getAppLinkIfEnabled(a.peer.metadata, a.transportType); - return A ? (await this.sendRequest({ clientRpcId: u, relayRpcId: l, topic: s, method: "wc_sessionRequest", params: { request: bs(tn({}, i), { expiryTimestamp: En(o) }), chainId: n }, expiry: o, throwOnFailedPublish: !0, appLink: A }).catch((M) => w(M)), this.client.events.emit("session_request_sent", { topic: s, request: i, chainId: n, id: u }), await d()) : await Promise.all([new Promise(async (M) => { - await this.sendRequest({ clientRpcId: u, relayRpcId: l, topic: s, method: "wc_sessionRequest", params: { request: bs(tn({}, i), { expiryTimestamp: En(o) }), chainId: n }, expiry: o, throwOnFailedPublish: !0 }).catch((N) => w(N)), this.client.events.emit("session_request_sent", { topic: s, request: i, chainId: n, id: u }), M(); - }), new Promise(async (M) => { - var N; - if (!((N = a.sessionConfig) != null && N.disableDeepLink)) { - const L = await Yq(this.client.core.storage, N3); - await Vq({ id: u, topic: s, wcDeepLink: L }); - } - M(); - }), d()]).then((M) => M[2]); + const _ = this.getAppLinkIfEnabled(a.peer.metadata, a.transportType); + return _ ? (await this.sendRequest({ clientRpcId: u, relayRpcId: l, topic: s, method: "wc_sessionRequest", params: { request: xs(tn({}, i), { expiryTimestamp: Sn(o) }), chainId: n }, expiry: o, throwOnFailedPublish: !0, appLink: _ }).catch((P) => w(P)), this.client.events.emit("session_request_sent", { topic: s, request: i, chainId: n, id: u }), await d()) : await Promise.all([new Promise(async (P) => { + await this.sendRequest({ clientRpcId: u, relayRpcId: l, topic: s, method: "wc_sessionRequest", params: { request: xs(tn({}, i), { expiryTimestamp: Sn(o) }), chainId: n }, expiry: o, throwOnFailedPublish: !0 }).catch((O) => w(O)), this.client.events.emit("session_request_sent", { topic: s, request: i, chainId: n, id: u }), P(); + }), new Promise(async (P) => { + var O; + if (!((O = a.sessionConfig) != null && O.disableDeepLink)) { + const L = await Iz(this.client.core.storage, J3); + await Pz({ id: u, topic: s, wcDeepLink: L }); + } + P(); + }), d()]).then((P) => P[2]); }, this.respond = async (r) => { this.isInitialized(), await this.isValidRespond(r); const { topic: n, response: i } = r, { id: s } = i, o = this.client.session.get(n); o.transportType === zr.relay && await this.confirmOnlineStateOrThrow(); const a = this.getAppLinkIfEnabled(o.peer.metadata, o.transportType); - js(i) ? await this.sendResult({ id: s, topic: n, result: i.result, throwOnFailedPublish: !0, appLink: a }) : Zi(i) && await this.sendError({ id: s, topic: n, error: i.error, appLink: a }), this.cleanupAfterResponse(r); + zs(i) ? await this.sendResult({ id: s, topic: n, result: i.result, throwOnFailedPublish: !0, appLink: a }) : es(i) && await this.sendError({ id: s, topic: n, error: i.error, appLink: a }), this.cleanupAfterResponse(r); }, this.ping = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); try { @@ -20068,14 +20580,14 @@ class WV extends a$ { } const { topic: n } = r; if (this.client.session.keys.includes(n)) { - const i = ua(), s = nc().toString(), { done: o, resolve: a, reject: u } = Ga(); - this.events.once(br("session_ping", i), ({ error: l }) => { + const i = la(), s = fc().toString(), { done: o, resolve: a, reject: u } = ec(); + this.events.once(yr("session_ping", i), ({ error: l }) => { l ? u(l) : a(); }), await Promise.all([this.sendRequest({ topic: n, method: "wc_sessionPing", params: {}, throwOnFailedPublish: !0, clientRpcId: i, relayRpcId: s }), o()]); } else this.client.core.pairing.pairings.keys.includes(n) && await this.client.core.pairing.ping({ topic: n }); }, this.emit = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(), await this.isValidEmit(r); - const { topic: n, event: i, chainId: s } = r, o = nc().toString(); + const { topic: n, event: i, chainId: s } = r, o = fc().toString(); await this.sendRequest({ topic: n, method: "wc_sessionEvent", params: { event: i, chainId: s }, throwOnFailedPublish: !0, relayRpcId: o }); }, this.disconnect = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(), await this.isValidDisconnect(r); @@ -20086,116 +20598,116 @@ class WV extends a$ { const { message: i } = ft("MISMATCHED_TOPIC", `Session or pairing topic not found: ${n}`); throw new Error(i); } - }, this.find = (r) => (this.isInitialized(), this.client.session.getAll().filter((n) => Yz(n, r))), this.getPendingSessionRequests = () => this.client.pendingRequest.getAll(), this.authenticate = async (r, n) => { + }, this.find = (r) => (this.isInitialized(), this.client.session.getAll().filter((n) => IW(n, r))), this.getPendingSessionRequests = () => this.client.pendingRequest.getAll(), this.authenticate = async (r, n) => { var i; this.isInitialized(), this.isValidAuthenticate(r); const s = n && this.client.core.linkModeSupportedApps.includes(n) && ((i = this.client.metadata.redirect) == null ? void 0 : i.linkMode), o = s ? zr.link_mode : zr.relay; o === zr.relay && await this.confirmOnlineStateOrThrow(); - const { chains: a, statement: u = "", uri: l, domain: d, nonce: p, type: w, exp: A, nbf: M, methods: N = [], expiry: L } = r, B = [...r.resources || []], { topic: $, uri: H } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); - this.client.logger.info({ message: "Generated new pairing", pairing: { topic: $, uri: H } }); - const U = await this.client.core.crypto.generateKeyPair(), V = Td(U); - if (await Promise.all([this.client.auth.authKeys.set(Rd, { responseTopic: V, publicKey: U }), this.client.auth.pairingTopics.set(V, { topic: V, pairingTopic: $ })]), await this.client.core.relayer.subscribe(V, { transportType: o }), this.client.logger.info(`sending request to new pairing topic: ${$}`), N.length > 0) { - const { namespace: _ } = hu(a[0]); - let E = mz(_, "request", N); - Cd(B) && (E = bz(E, B.pop())), B.push(E); - } - const te = L && L > In.wc_sessionAuthenticate.req.ttl ? L : In.wc_sessionAuthenticate.req.ttl, R = { authPayload: { type: w ?? "caip122", chains: a, statement: u, aud: l, domain: d, version: "1", nonce: p, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: A, nbf: M, resources: B }, requester: { publicKey: U, metadata: this.client.metadata }, expiryTimestamp: En(te) }, K = { eip155: { chains: a, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...N])], events: ["chainChanged", "accountsChanged"] } }, ge = { requiredNamespaces: {}, optionalNamespaces: K, relays: [{ protocol: "irn" }], pairingTopic: $, proposer: { publicKey: U, metadata: this.client.metadata }, expiryTimestamp: En(In.wc_sessionPropose.req.ttl) }, { done: Ee, resolve: Y, reject: S } = Ga(te, "Request expired"), m = async ({ error: _, session: E }) => { - if (this.events.off(br("session_request", g), f), _) S(_); - else if (E) { - E.self.publicKey = U, await this.client.session.set(E.topic, E), await this.setExpiry(E.topic, E.expiry), $ && await this.client.core.pairing.updateMetadata({ topic: $, metadata: E.peer.metadata }); - const v = this.client.session.get(E.topic); + const { chains: a, statement: u = "", uri: l, domain: d, nonce: p, type: w, exp: _, nbf: P, methods: O = [], expiry: L } = r, B = [...r.resources || []], { topic: k, uri: q } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); + this.client.logger.info({ message: "Generated new pairing", pairing: { topic: k, uri: q } }); + const U = await this.client.core.crypto.generateKeyPair(), V = qd(U); + if (await Promise.all([this.client.auth.authKeys.set(zd, { responseTopic: V, publicKey: U }), this.client.auth.pairingTopics.set(V, { topic: V, pairingTopic: k })]), await this.client.core.relayer.subscribe(V, { transportType: o }), this.client.logger.info(`sending request to new pairing topic: ${k}`), O.length > 0) { + const { namespace: E } = _u(a[0]); + let S = Yz(E, "request", O); + Ud(B) && (S = Xz(S, B.pop())), B.push(S); + } + const Q = L && L > In.wc_sessionAuthenticate.req.ttl ? L : In.wc_sessionAuthenticate.req.ttl, R = { authPayload: { type: w ?? "caip122", chains: a, statement: u, aud: l, domain: d, version: "1", nonce: p, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: _, nbf: P, resources: B }, requester: { publicKey: U, metadata: this.client.metadata }, expiryTimestamp: Sn(Q) }, K = { eip155: { chains: a, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...O])], events: ["chainChanged", "accountsChanged"] } }, ge = { requiredNamespaces: {}, optionalNamespaces: K, relays: [{ protocol: "irn" }], pairingTopic: k, proposer: { publicKey: U, metadata: this.client.metadata }, expiryTimestamp: Sn(In.wc_sessionPropose.req.ttl) }, { done: Ee, resolve: Y, reject: A } = ec(Q, "Request expired"), m = async ({ error: E, session: S }) => { + if (this.events.off(yr("session_request", g), f), E) A(E); + else if (S) { + S.self.publicKey = U, await this.client.session.set(S.topic, S), await this.setExpiry(S.topic, S.expiry), k && await this.client.core.pairing.updateMetadata({ topic: k, metadata: S.peer.metadata }); + const v = this.client.session.get(S.topic); await this.deleteProposal(b), Y({ session: v }); } - }, f = async (_) => { - var E, v, P; - if (await this.deletePendingAuthRequest(g, { message: "fulfilled", code: 0 }), _.error) { + }, f = async (E) => { + var S, v, M; + if (await this.deletePendingAuthRequest(g, { message: "fulfilled", code: 0 }), E.error) { const J = Or("WC_METHOD_UNSUPPORTED", "wc_sessionAuthenticate"); - return _.error.code === J.code ? void 0 : (this.events.off(br("session_connect"), m), S(_.error.message)); + return E.error.code === J.code ? void 0 : (this.events.off(yr("session_connect"), m), A(E.error.message)); } - await this.deleteProposal(b), this.events.off(br("session_connect"), m); - const { cacaos: I, responder: F } = _.result, ce = [], D = []; + await this.deleteProposal(b), this.events.off(yr("session_connect"), m); + const { cacaos: I, responder: F } = E.result, ce = [], D = []; for (const J of I) { - await zx({ cacao: J, projectId: this.client.core.projectId }) || (this.client.logger.error(J, "Signature verification failed"), S(Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"))); - const { p: Q } = J, T = Cd(Q.resources), X = [M1(Q.iss)], re = u0(Q.iss); + await s3({ cacao: J, projectId: this.client.core.projectId }) || (this.client.logger.error(J, "Signature verification failed"), A(Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"))); + const { p: ee } = J, T = Ud(ee.resources), X = [z1(ee.iss)], re = x0(ee.iss); if (T) { - const pe = Wx(T), ie = Hx(T); + const pe = o3(T), ie = a3(T); ce.push(...pe), X.push(...ie); } for (const pe of X) D.push(`${pe}:${re}`); } const oe = await this.client.core.crypto.generateSharedKey(U, F.publicKey); let Z; - ce.length > 0 && (Z = { topic: oe, acknowledged: !0, self: { publicKey: U, metadata: this.client.metadata }, peer: F, controller: F.publicKey, expiry: En(Kc), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: $, namespaces: e3([...new Set(ce)], [...new Set(D)]), transportType: o }, await this.client.core.relayer.subscribe(oe, { transportType: o }), await this.client.session.set(oe, Z), $ && await this.client.core.pairing.updateMetadata({ topic: $, metadata: F.metadata }), Z = this.client.session.get(oe)), (E = this.client.metadata.redirect) != null && E.linkMode && (v = F.metadata.redirect) != null && v.linkMode && (P = F.metadata.redirect) != null && P.universal && n && (this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal), this.client.session.update(oe, { transportType: zr.link_mode })), Y({ auths: I, session: Z }); - }, g = ua(), b = ua(); - this.events.once(br("session_connect"), m), this.events.once(br("session_request", g), f); + ce.length > 0 && (Z = { topic: oe, acknowledged: !0, self: { publicKey: U, metadata: this.client.metadata }, peer: F, controller: F.publicKey, expiry: Sn(ru), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: k, namespaces: m3([...new Set(ce)], [...new Set(D)]), transportType: o }, await this.client.core.relayer.subscribe(oe, { transportType: o }), await this.client.session.set(oe, Z), k && await this.client.core.pairing.updateMetadata({ topic: k, metadata: F.metadata }), Z = this.client.session.get(oe)), (S = this.client.metadata.redirect) != null && S.linkMode && (v = F.metadata.redirect) != null && v.linkMode && (M = F.metadata.redirect) != null && M.universal && n && (this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal), this.client.session.update(oe, { transportType: zr.link_mode })), Y({ auths: I, session: Z }); + }, g = la(), b = la(); + this.events.once(yr("session_connect"), m), this.events.once(yr("session_request", g), f); let x; try { if (s) { - const _ = da("wc_sessionAuthenticate", R, g); - this.client.core.history.set($, _); - const E = await this.client.core.crypto.encode("", _, { type: th, encoding: Af }); - x = fd(n, $, E); - } else await Promise.all([this.sendRequest({ topic: $, method: "wc_sessionAuthenticate", params: R, expiry: r.expiry, throwOnFailedPublish: !0, clientRpcId: g }), this.sendRequest({ topic: $, method: "wc_sessionPropose", params: ge, expiry: In.wc_sessionPropose.req.ttl, throwOnFailedPublish: !0, clientRpcId: b })]); - } catch (_) { - throw this.events.off(br("session_connect"), m), this.events.off(br("session_request", g), f), _; - } - return await this.setProposal(b, tn({ id: b }, ge)), await this.setAuthRequest(g, { request: bs(tn({}, R), { verifyContext: {} }), pairingTopic: $, transportType: o }), { uri: x ?? H, response: Ee }; + const E = ga("wc_sessionAuthenticate", R, g); + this.client.core.history.set(k, E); + const S = await this.client.core.crypto.encode("", E, { type: fh, encoding: Df }); + x = xd(n, k, S); + } else await Promise.all([this.sendRequest({ topic: k, method: "wc_sessionAuthenticate", params: R, expiry: r.expiry, throwOnFailedPublish: !0, clientRpcId: g }), this.sendRequest({ topic: k, method: "wc_sessionPropose", params: ge, expiry: In.wc_sessionPropose.req.ttl, throwOnFailedPublish: !0, clientRpcId: b })]); + } catch (E) { + throw this.events.off(yr("session_connect"), m), this.events.off(yr("session_request", g), f), E; + } + return await this.setProposal(b, tn({ id: b }, ge)), await this.setAuthRequest(g, { request: xs(tn({}, R), { verifyContext: {} }), pairingTopic: k, transportType: o }), { uri: x ?? q, response: Ee }; }, this.approveSessionAuthenticate = async (r) => { - const { id: n, auths: i } = r, s = this.client.core.eventClient.createEvent({ properties: { topic: n.toString(), trace: [Ka.authenticated_session_approve_started] } }); + const { id: n, auths: i } = r, s = this.client.core.eventClient.createEvent({ properties: { topic: n.toString(), trace: [Za.authenticated_session_approve_started] } }); try { this.isInitialized(); } catch (L) { - throw s.setError(If.no_internet_connection), L; + throw s.setError(Lf.no_internet_connection), L; } const o = this.getPendingAuthRequest(n); - if (!o) throw s.setError(If.authenticated_session_pending_request_not_found), new Error(`Could not find pending auth request with id ${n}`); + if (!o) throw s.setError(Lf.authenticated_session_pending_request_not_found), new Error(`Could not find pending auth request with id ${n}`); const a = o.transportType || zr.relay; a === zr.relay && await this.confirmOnlineStateOrThrow(); - const u = o.requester.publicKey, l = await this.client.core.crypto.generateKeyPair(), d = Td(u), p = { type: Co, receiverPublicKey: u, senderPublicKey: l }, w = [], A = []; + const u = o.requester.publicKey, l = await this.client.core.crypto.generateKeyPair(), d = qd(u), p = { type: Oo, receiverPublicKey: u, senderPublicKey: l }, w = [], _ = []; for (const L of i) { - if (!await zx({ cacao: L, projectId: this.client.core.projectId })) { - s.setError(If.invalid_cacao); + if (!await s3({ cacao: L, projectId: this.client.core.projectId })) { + s.setError(Lf.invalid_cacao); const V = Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"); throw await this.sendError({ id: n, topic: d, error: V, encodeOpts: p }), new Error(V.message); } - s.addTrace(Ka.cacaos_verified); - const { p: B } = L, $ = Cd(B.resources), H = [M1(B.iss)], U = u0(B.iss); - if ($) { - const V = Wx($), te = Hx($); - w.push(...V), H.push(...te); + s.addTrace(Za.cacaos_verified); + const { p: B } = L, k = Ud(B.resources), q = [z1(B.iss)], U = x0(B.iss); + if (k) { + const V = o3(k), Q = a3(k); + w.push(...V), q.push(...Q); } - for (const V of H) A.push(`${V}:${U}`); + for (const V of q) _.push(`${V}:${U}`); } - const M = await this.client.core.crypto.generateSharedKey(l, u); - s.addTrace(Ka.create_authenticated_session_topic); - let N; + const P = await this.client.core.crypto.generateSharedKey(l, u); + s.addTrace(Za.create_authenticated_session_topic); + let O; if ((w == null ? void 0 : w.length) > 0) { - N = { topic: M, acknowledged: !0, self: { publicKey: l, metadata: this.client.metadata }, peer: { publicKey: u, metadata: o.requester.metadata }, controller: u, expiry: En(Kc), authentication: i, requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: o.pairingTopic, namespaces: e3([...new Set(w)], [...new Set(A)]), transportType: a }, s.addTrace(Ka.subscribing_authenticated_session_topic); + O = { topic: P, acknowledged: !0, self: { publicKey: l, metadata: this.client.metadata }, peer: { publicKey: u, metadata: o.requester.metadata }, controller: u, expiry: Sn(ru), authentication: i, requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: o.pairingTopic, namespaces: m3([...new Set(w)], [...new Set(_)]), transportType: a }, s.addTrace(Za.subscribing_authenticated_session_topic); try { - await this.client.core.relayer.subscribe(M, { transportType: a }); + await this.client.core.relayer.subscribe(P, { transportType: a }); } catch (L) { - throw s.setError(If.subscribe_authenticated_session_topic_failure), L; + throw s.setError(Lf.subscribe_authenticated_session_topic_failure), L; } - s.addTrace(Ka.subscribe_authenticated_session_topic_success), await this.client.session.set(M, N), s.addTrace(Ka.store_authenticated_session), await this.client.core.pairing.updateMetadata({ topic: o.pairingTopic, metadata: o.requester.metadata }); + s.addTrace(Za.subscribe_authenticated_session_topic_success), await this.client.session.set(P, O), s.addTrace(Za.store_authenticated_session), await this.client.core.pairing.updateMetadata({ topic: o.pairingTopic, metadata: o.requester.metadata }); } - s.addTrace(Ka.publishing_authenticated_session_approve); + s.addTrace(Za.publishing_authenticated_session_approve); try { await this.sendResult({ topic: d, id: n, result: { cacaos: i, responder: { publicKey: l, metadata: this.client.metadata } }, encodeOpts: p, throwOnFailedPublish: !0, appLink: this.getAppLinkIfEnabled(o.requester.metadata, a) }); } catch (L) { - throw s.setError(If.authenticated_session_approve_publish_failure), L; + throw s.setError(Lf.authenticated_session_approve_publish_failure), L; } - return await this.client.auth.requests.delete(n, { message: "fulfilled", code: 0 }), await this.client.core.pairing.activate({ topic: o.pairingTopic }), this.client.core.eventClient.deleteEvent({ eventId: s.eventId }), { session: N }; + return await this.client.auth.requests.delete(n, { message: "fulfilled", code: 0 }), await this.client.core.pairing.activate({ topic: o.pairingTopic }), this.client.core.eventClient.deleteEvent({ eventId: s.eventId }), { session: O }; }, this.rejectSessionAuthenticate = async (r) => { this.isInitialized(); const { id: n, reason: i } = r, s = this.getPendingAuthRequest(n); if (!s) throw new Error(`Could not find pending auth request with id ${n}`); s.transportType === zr.relay && await this.confirmOnlineStateOrThrow(); - const o = s.requester.publicKey, a = await this.client.core.crypto.generateKeyPair(), u = Td(o), l = { type: Co, receiverPublicKey: o, senderPublicKey: a }; + const o = s.requester.publicKey, a = await this.client.core.crypto.generateKeyPair(), u = qd(o), l = { type: Oo, receiverPublicKey: o, senderPublicKey: a }; await this.sendError({ id: n, topic: u, error: i, encodeOpts: l, rpcOpts: In.wc_sessionAuthenticate.reject, appLink: this.getAppLinkIfEnabled(s.requester.metadata, s.transportType) }), await this.client.auth.requests.delete(n, { message: "rejected", code: 0 }), await this.client.proposal.delete(n, Or("USER_DISCONNECTED")); }, this.formatAuthMessage = (r) => { this.isInitialized(); const { request: n, iss: i } = r; - return j8(n, i); + return pE(n, i); }, this.processRelayMessageCache = () => { setTimeout(async () => { if (this.relayMessageCache.length !== 0) for (; this.relayMessageCache.length > 0; ) try { @@ -20219,119 +20731,119 @@ class WV extends a$ { }, this.deleteSession = async (r) => { var n; const { topic: i, expirerHasDeleted: s = !1, emitEvent: o = !0, id: a = 0 } = r, { self: u } = this.client.session.get(i); - await this.client.core.relayer.unsubscribe(i), await this.client.session.delete(i, Or("USER_DISCONNECTED")), this.addToRecentlyDeleted(i, "session"), this.client.core.crypto.keychain.has(u.publicKey) && await this.client.core.crypto.deleteKeyPair(u.publicKey), this.client.core.crypto.keychain.has(i) && await this.client.core.crypto.deleteSymKey(i), s || this.client.core.expirer.del(i), this.client.core.storage.removeItem(N3).catch((l) => this.client.logger.warn(l)), this.getPendingSessionRequests().forEach((l) => { + await this.client.core.relayer.unsubscribe(i), await this.client.session.delete(i, Or("USER_DISCONNECTED")), this.addToRecentlyDeleted(i, "session"), this.client.core.crypto.keychain.has(u.publicKey) && await this.client.core.crypto.deleteKeyPair(u.publicKey), this.client.core.crypto.keychain.has(i) && await this.client.core.crypto.deleteSymKey(i), s || this.client.core.expirer.del(i), this.client.core.storage.removeItem(J3).catch((l) => this.client.logger.warn(l)), this.getPendingSessionRequests().forEach((l) => { l.topic === i && this.deletePendingSessionRequest(l.id, Or("USER_DISCONNECTED")); - }), i === ((n = this.sessionRequestQueue.queue[0]) == null ? void 0 : n.topic) && (this.sessionRequestQueue.state = ks.idle), o && this.client.events.emit("session_delete", { id: a, topic: i }); + }), i === ((n = this.sessionRequestQueue.queue[0]) == null ? void 0 : n.topic) && (this.sessionRequestQueue.state = Fs.idle), o && this.client.events.emit("session_delete", { id: a, topic: i }); }, this.deleteProposal = async (r, n) => { if (n) try { const i = this.client.proposal.get(r), s = this.client.core.eventClient.getEvent({ topic: i.pairingTopic }); - s == null || s.setError(Ha.proposal_expired); + s == null || s.setError(Xa.proposal_expired); } catch { } await Promise.all([this.client.proposal.delete(r, Or("USER_DISCONNECTED")), n ? Promise.resolve() : this.client.core.expirer.del(r)]), this.addToRecentlyDeleted(r, "proposal"); }, this.deletePendingSessionRequest = async (r, n, i = !1) => { - await Promise.all([this.client.pendingRequest.delete(r, n), i ? Promise.resolve() : this.client.core.expirer.del(r)]), this.addToRecentlyDeleted(r, "request"), this.sessionRequestQueue.queue = this.sessionRequestQueue.queue.filter((s) => s.id !== r), i && (this.sessionRequestQueue.state = ks.idle, this.client.events.emit("session_request_expire", { id: r })); + await Promise.all([this.client.pendingRequest.delete(r, n), i ? Promise.resolve() : this.client.core.expirer.del(r)]), this.addToRecentlyDeleted(r, "request"), this.sessionRequestQueue.queue = this.sessionRequestQueue.queue.filter((s) => s.id !== r), i && (this.sessionRequestQueue.state = Fs.idle, this.client.events.emit("session_request_expire", { id: r })); }, this.deletePendingAuthRequest = async (r, n, i = !1) => { await Promise.all([this.client.auth.requests.delete(r, n), i ? Promise.resolve() : this.client.core.expirer.del(r)]); }, this.setExpiry = async (r, n) => { this.client.session.keys.includes(r) && (this.client.core.expirer.set(r, n), await this.client.session.update(r, { expiry: n })); }, this.setProposal = async (r, n) => { - this.client.core.expirer.set(r, En(In.wc_sessionPropose.req.ttl)), await this.client.proposal.set(r, n); + this.client.core.expirer.set(r, Sn(In.wc_sessionPropose.req.ttl)), await this.client.proposal.set(r, n); }, this.setAuthRequest = async (r, n) => { const { request: i, pairingTopic: s, transportType: o = zr.relay } = n; this.client.core.expirer.set(r, i.expiryTimestamp), await this.client.auth.requests.set(r, { authPayload: i.authPayload, requester: i.requester, expiryTimestamp: i.expiryTimestamp, id: r, pairingTopic: s, verifyContext: i.verifyContext, transportType: o }); }, this.setPendingSessionRequest = async (r) => { - const { id: n, topic: i, params: s, verifyContext: o } = r, a = s.request.expiryTimestamp || En(In.wc_sessionRequest.req.ttl); + const { id: n, topic: i, params: s, verifyContext: o } = r, a = s.request.expiryTimestamp || Sn(In.wc_sessionRequest.req.ttl); this.client.core.expirer.set(n, a), await this.client.pendingRequest.set(n, { id: n, topic: i, params: s, verifyContext: o }); }, this.sendRequest = async (r) => { - const { topic: n, method: i, params: s, expiry: o, relayRpcId: a, clientRpcId: u, throwOnFailedPublish: l, appLink: d } = r, p = da(i, s, u); + const { topic: n, method: i, params: s, expiry: o, relayRpcId: a, clientRpcId: u, throwOnFailedPublish: l, appLink: d } = r, p = ga(i, s, u); let w; - const A = !!d; + const _ = !!d; try { - const L = A ? Af : ha; + const L = _ ? Df : pa; w = await this.client.core.crypto.encode(n, p, { encoding: L }); } catch (L) { throw await this.cleanup(), this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`), L; } - let M; - if (OV.includes(i)) { - const L = xo(JSON.stringify(p)), B = xo(w); - M = await this.client.core.verify.register({ id: B, decryptedId: L }); + let P; + if (hG.includes(i)) { + const L = Ao(JSON.stringify(p)), B = Ao(w); + P = await this.client.core.verify.register({ id: B, decryptedId: L }); } - const N = In[i].req; - if (N.attestation = M, o && (N.ttl = o), a && (N.id = a), this.client.core.history.set(n, p), A) { - const L = fd(d, n, w); + const O = In[i].req; + if (O.attestation = P, o && (O.ttl = o), a && (O.id = a), this.client.core.history.set(n, p), _) { + const L = xd(d, n, w); await global.Linking.openURL(L, this.client.name); } else { const L = In[i].req; - o && (L.ttl = o), a && (L.id = a), l ? (L.internal = bs(tn({}, L.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(n, w, L)) : this.client.core.relayer.publish(n, w, L).catch((B) => this.client.logger.error(B)); + o && (L.ttl = o), a && (L.id = a), l ? (L.internal = xs(tn({}, L.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(n, w, L)) : this.client.core.relayer.publish(n, w, L).catch((B) => this.client.logger.error(B)); } return p.id; }, this.sendResult = async (r) => { - const { id: n, topic: i, result: s, throwOnFailedPublish: o, encodeOpts: a, appLink: u } = r, l = rp(n, s); + const { id: n, topic: i, result: s, throwOnFailedPublish: o, encodeOpts: a, appLink: u } = r, l = mp(n, s); let d; const p = u && typeof (global == null ? void 0 : global.Linking) < "u"; try { - const A = p ? Af : ha; - d = await this.client.core.crypto.encode(i, l, bs(tn({}, a || {}), { encoding: A })); - } catch (A) { - throw await this.cleanup(), this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`), A; + const _ = p ? Df : pa; + d = await this.client.core.crypto.encode(i, l, xs(tn({}, a || {}), { encoding: _ })); + } catch (_) { + throw await this.cleanup(), this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`), _; } let w; try { w = await this.client.core.history.get(i, n); - } catch (A) { - throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`), A; + } catch (_) { + throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`), _; } if (p) { - const A = fd(u, i, d); - await global.Linking.openURL(A, this.client.name); + const _ = xd(u, i, d); + await global.Linking.openURL(_, this.client.name); } else { - const A = In[w.request.method].res; - o ? (A.internal = bs(tn({}, A.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(i, d, A)) : this.client.core.relayer.publish(i, d, A).catch((M) => this.client.logger.error(M)); + const _ = In[w.request.method].res; + o ? (_.internal = xs(tn({}, _.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(i, d, _)) : this.client.core.relayer.publish(i, d, _).catch((P) => this.client.logger.error(P)); } await this.client.core.history.resolve(l); }, this.sendError = async (r) => { - const { id: n, topic: i, error: s, encodeOpts: o, rpcOpts: a, appLink: u } = r, l = np(n, s); + const { id: n, topic: i, error: s, encodeOpts: o, rpcOpts: a, appLink: u } = r, l = vp(n, s); let d; const p = u && typeof (global == null ? void 0 : global.Linking) < "u"; try { - const A = p ? Af : ha; - d = await this.client.core.crypto.encode(i, l, bs(tn({}, o || {}), { encoding: A })); - } catch (A) { - throw await this.cleanup(), this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`), A; + const _ = p ? Df : pa; + d = await this.client.core.crypto.encode(i, l, xs(tn({}, o || {}), { encoding: _ })); + } catch (_) { + throw await this.cleanup(), this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`), _; } let w; try { w = await this.client.core.history.get(i, n); - } catch (A) { - throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`), A; + } catch (_) { + throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`), _; } if (p) { - const A = fd(u, i, d); - await global.Linking.openURL(A, this.client.name); + const _ = xd(u, i, d); + await global.Linking.openURL(_, this.client.name); } else { - const A = a || In[w.request.method].res; - this.client.core.relayer.publish(i, d, A); + const _ = a || In[w.request.method].res; + this.client.core.relayer.publish(i, d, _); } await this.client.core.history.resolve(l); }, this.cleanup = async () => { const r = [], n = []; this.client.session.getAll().forEach((i) => { let s = !1; - ca(i.expiry) && (s = !0), this.client.core.crypto.keychain.has(i.topic) || (s = !0), s && r.push(i.topic); + fa(i.expiry) && (s = !0), this.client.core.crypto.keychain.has(i.topic) || (s = !0), s && r.push(i.topic); }), this.client.proposal.getAll().forEach((i) => { - ca(i.expiryTimestamp) && n.push(i.id); + fa(i.expiryTimestamp) && n.push(i.id); }), await Promise.all([...r.map((i) => this.deleteSession({ topic: i })), ...n.map((i) => this.deleteProposal(i))]); }, this.onRelayEventRequest = async (r) => { this.requestQueue.queue.push(r), await this.processRequestsQueue(); }, this.processRequestsQueue = async () => { - if (this.requestQueue.state === ks.active) { + if (this.requestQueue.state === Fs.active) { this.client.logger.info("Request queue already active, skipping..."); return; } for (this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`); this.requestQueue.queue.length > 0; ) { - this.requestQueue.state = ks.active; + this.requestQueue.state = Fs.active; const r = this.requestQueue.queue.shift(); if (r) try { await this.processRequest(r); @@ -20339,7 +20851,7 @@ class WV extends a$ { this.client.logger.warn(n); } } - this.requestQueue.state = ks.idle; + this.requestQueue.state = Fs.idle; }, this.processRequest = async (r) => { const { topic: n, payload: i, attestation: s, transportType: o, encryptedId: a } = r, u = i.method; if (!this.shouldIgnorePairingRequest({ topic: n, requestMethod: u })) switch (u) { @@ -20395,16 +20907,16 @@ class WV extends a$ { try { const l = this.client.core.eventClient.getEvent({ topic: n }); this.isValidConnect(tn({}, i.params)); - const d = a.expiryTimestamp || En(In.wc_sessionPropose.req.ttl), p = tn({ id: u, pairingTopic: n, expiryTimestamp: d }, a); + const d = a.expiryTimestamp || Sn(In.wc_sessionPropose.req.ttl), p = tn({ id: u, pairingTopic: n, expiryTimestamp: d }, a); await this.setProposal(u, p); - const w = await this.getVerifyContext({ attestationId: s, hash: xo(JSON.stringify(i)), encryptedId: o, metadata: p.proposer.metadata }); - this.client.events.listenerCount("session_proposal") === 0 && (console.warn("No listener for session_proposal event"), l == null || l.setError(wo.proposal_listener_not_found)), l == null || l.addTrace(Fs.emit_session_proposal), this.client.events.emit("session_proposal", { id: u, params: p, verifyContext: w }); + const w = await this.getVerifyContext({ attestationId: s, hash: Ao(JSON.stringify(i)), encryptedId: o, metadata: p.proposer.metadata }); + this.client.events.listenerCount("session_proposal") === 0 && (console.warn("No listener for session_proposal event"), l == null || l.setError(So.proposal_listener_not_found)), l == null || l.addTrace(qs.emit_session_proposal), this.client.events.emit("session_proposal", { id: u, params: p, verifyContext: w }); } catch (l) { await this.sendError({ id: u, topic: n, error: l, rpcOpts: In.wc_sessionPropose.autoReject }), this.client.logger.error(l); } }, this.onSessionProposeResponse = async (r, n, i) => { const { id: s } = n; - if (js(n)) { + if (zs(n)) { const { result: o } = n; this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", result: o }); const a = this.client.proposal.get(s); @@ -20417,58 +20929,58 @@ class WV extends a$ { this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", sessionTopic: d }); const p = await this.client.core.relayer.subscribe(d, { transportType: i }); this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", subscriptionId: p }), await this.client.core.pairing.activate({ topic: r }); - } else if (Zi(n)) { + } else if (es(n)) { await this.client.proposal.delete(s, Or("USER_DISCONNECTED")); - const o = br("session_connect"); + const o = yr("session_connect"); if (this.events.listenerCount(o) === 0) throw new Error(`emitting ${o} without any listeners, 954`); - this.events.emit(br("session_connect"), { error: n.error }); + this.events.emit(yr("session_connect"), { error: n.error }); } }, this.onSessionSettleRequest = async (r, n) => { const { id: i, params: s } = n; try { this.isValidSessionSettleRequest(s); - const { relay: o, controller: a, expiry: u, namespaces: l, sessionProperties: d, sessionConfig: p } = n.params, w = bs(tn(tn({ topic: r, relay: o, expiry: u, namespaces: l, acknowledged: !0, pairingTopic: "", requiredNamespaces: {}, optionalNamespaces: {}, controller: a.publicKey, self: { publicKey: "", metadata: this.client.metadata }, peer: { publicKey: a.publicKey, metadata: a.metadata } }, d && { sessionProperties: d }), p && { sessionConfig: p }), { transportType: zr.relay }), A = br("session_connect"); - if (this.events.listenerCount(A) === 0) throw new Error(`emitting ${A} without any listeners 997`); - this.events.emit(br("session_connect"), { session: w }), await this.sendResult({ id: n.id, topic: r, result: !0, throwOnFailedPublish: !0 }); + const { relay: o, controller: a, expiry: u, namespaces: l, sessionProperties: d, sessionConfig: p } = n.params, w = xs(tn(tn({ topic: r, relay: o, expiry: u, namespaces: l, acknowledged: !0, pairingTopic: "", requiredNamespaces: {}, optionalNamespaces: {}, controller: a.publicKey, self: { publicKey: "", metadata: this.client.metadata }, peer: { publicKey: a.publicKey, metadata: a.metadata } }, d && { sessionProperties: d }), p && { sessionConfig: p }), { transportType: zr.relay }), _ = yr("session_connect"); + if (this.events.listenerCount(_) === 0) throw new Error(`emitting ${_} without any listeners 997`); + this.events.emit(yr("session_connect"), { session: w }), await this.sendResult({ id: n.id, topic: r, result: !0, throwOnFailedPublish: !0 }); } catch (o) { await this.sendError({ id: i, topic: r, error: o }), this.client.logger.error(o); } }, this.onSessionSettleResponse = async (r, n) => { const { id: i } = n; - js(n) ? (await this.client.session.update(r, { acknowledged: !0 }), this.events.emit(br("session_approve", i), {})) : Zi(n) && (await this.client.session.delete(r, Or("USER_DISCONNECTED")), this.events.emit(br("session_approve", i), { error: n.error })); + zs(n) ? (await this.client.session.update(r, { acknowledged: !0 }), this.events.emit(yr("session_approve", i), {})) : es(n) && (await this.client.session.delete(r, Or("USER_DISCONNECTED")), this.events.emit(yr("session_approve", i), { error: n.error })); }, this.onSessionUpdateRequest = async (r, n) => { const { params: i, id: s } = n; try { - const o = `${r}_session_update`, a = Pf.get(o); + const o = `${r}_session_update`, a = Of.get(o); if (a && this.isRequestOutOfSync(a, s)) { this.client.logger.info(`Discarding out of sync request - ${s}`), this.sendError({ id: s, topic: r, error: Or("INVALID_UPDATE_REQUEST") }); return; } this.isValidUpdate(tn({ topic: r }, i)); try { - Pf.set(o, s), await this.client.session.update(r, { namespaces: i.namespaces }), await this.sendResult({ id: s, topic: r, result: !0, throwOnFailedPublish: !0 }); + Of.set(o, s), await this.client.session.update(r, { namespaces: i.namespaces }), await this.sendResult({ id: s, topic: r, result: !0, throwOnFailedPublish: !0 }); } catch (u) { - throw Pf.delete(o), u; + throw Of.delete(o), u; } this.client.events.emit("session_update", { id: s, topic: r, params: i }); } catch (o) { await this.sendError({ id: s, topic: r, error: o }), this.client.logger.error(o); } }, this.isRequestOutOfSync = (r, n) => parseInt(n.toString().slice(0, -3)) <= parseInt(r.toString().slice(0, -3)), this.onSessionUpdateResponse = (r, n) => { - const { id: i } = n, s = br("session_update", i); + const { id: i } = n, s = yr("session_update", i); if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); - js(n) ? this.events.emit(br("session_update", i), {}) : Zi(n) && this.events.emit(br("session_update", i), { error: n.error }); + zs(n) ? this.events.emit(yr("session_update", i), {}) : es(n) && this.events.emit(yr("session_update", i), { error: n.error }); }, this.onSessionExtendRequest = async (r, n) => { const { id: i } = n; try { - this.isValidExtend({ topic: r }), await this.setExpiry(r, En(Kc)), await this.sendResult({ id: i, topic: r, result: !0, throwOnFailedPublish: !0 }), this.client.events.emit("session_extend", { id: i, topic: r }); + this.isValidExtend({ topic: r }), await this.setExpiry(r, Sn(ru)), await this.sendResult({ id: i, topic: r, result: !0, throwOnFailedPublish: !0 }), this.client.events.emit("session_extend", { id: i, topic: r }); } catch (s) { await this.sendError({ id: i, topic: r, error: s }), this.client.logger.error(s); } }, this.onSessionExtendResponse = (r, n) => { - const { id: i } = n, s = br("session_extend", i); + const { id: i } = n, s = yr("session_extend", i); if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); - js(n) ? this.events.emit(br("session_extend", i), {}) : Zi(n) && this.events.emit(br("session_extend", i), { error: n.error }); + zs(n) ? this.events.emit(yr("session_extend", i), {}) : es(n) && this.events.emit(yr("session_extend", i), { error: n.error }); }, this.onSessionPingRequest = async (r, n) => { const { id: i } = n; try { @@ -20477,16 +20989,16 @@ class WV extends a$ { await this.sendError({ id: i, topic: r, error: s }), this.client.logger.error(s); } }, this.onSessionPingResponse = (r, n) => { - const { id: i } = n, s = br("session_ping", i); + const { id: i } = n, s = yr("session_ping", i); if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); setTimeout(() => { - js(n) ? this.events.emit(br("session_ping", i), {}) : Zi(n) && this.events.emit(br("session_ping", i), { error: n.error }); + zs(n) ? this.events.emit(yr("session_ping", i), {}) : es(n) && this.events.emit(yr("session_ping", i), { error: n.error }); }, 500); }, this.onSessionDeleteRequest = async (r, n) => { const { id: i } = n; try { this.isValidDisconnect({ topic: r, reason: n.params }), Promise.all([new Promise((s) => { - this.client.core.relayer.once(oi.publish, async () => { + this.client.core.relayer.once(ai.publish, async () => { s(await this.deleteSession({ topic: r, id: i })); }); }), this.sendResult({ id: i, topic: r, result: !0, throwOnFailedPublish: !0 }), this.cleanupPendingSentRequestsForTopic({ topic: r, error: Or("USER_DISCONNECTED") })]).catch((s) => this.client.logger.error(s)); @@ -20498,56 +21010,56 @@ class WV extends a$ { const { topic: o, payload: a, attestation: u, encryptedId: l, transportType: d } = r, { id: p, params: w } = a; try { await this.isValidRequest(tn({ topic: o }, w)); - const A = this.client.session.get(o), M = await this.getVerifyContext({ attestationId: u, hash: xo(JSON.stringify(da("wc_sessionRequest", w, p))), encryptedId: l, metadata: A.peer.metadata, transportType: d }), N = { id: p, topic: o, params: w, verifyContext: M }; - await this.setPendingSessionRequest(N), d === zr.link_mode && (n = A.peer.metadata.redirect) != null && n.universal && this.client.core.addLinkModeSupportedApp((i = A.peer.metadata.redirect) == null ? void 0 : i.universal), (s = this.client.signConfig) != null && s.disableRequestQueue ? this.emitSessionRequest(N) : (this.addSessionRequestToSessionRequestQueue(N), this.processSessionRequestQueue()); - } catch (A) { - await this.sendError({ id: p, topic: o, error: A }), this.client.logger.error(A); + const _ = this.client.session.get(o), P = await this.getVerifyContext({ attestationId: u, hash: Ao(JSON.stringify(ga("wc_sessionRequest", w, p))), encryptedId: l, metadata: _.peer.metadata, transportType: d }), O = { id: p, topic: o, params: w, verifyContext: P }; + await this.setPendingSessionRequest(O), d === zr.link_mode && (n = _.peer.metadata.redirect) != null && n.universal && this.client.core.addLinkModeSupportedApp((i = _.peer.metadata.redirect) == null ? void 0 : i.universal), (s = this.client.signConfig) != null && s.disableRequestQueue ? this.emitSessionRequest(O) : (this.addSessionRequestToSessionRequestQueue(O), this.processSessionRequestQueue()); + } catch (_) { + await this.sendError({ id: p, topic: o, error: _ }), this.client.logger.error(_); } }, this.onSessionRequestResponse = (r, n) => { - const { id: i } = n, s = br("session_request", i); + const { id: i } = n, s = yr("session_request", i); if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); - js(n) ? this.events.emit(br("session_request", i), { result: n.result }) : Zi(n) && this.events.emit(br("session_request", i), { error: n.error }); + zs(n) ? this.events.emit(yr("session_request", i), { result: n.result }) : es(n) && this.events.emit(yr("session_request", i), { error: n.error }); }, this.onSessionEventRequest = async (r, n) => { const { id: i, params: s } = n; try { - const o = `${r}_session_event_${s.event.name}`, a = Pf.get(o); + const o = `${r}_session_event_${s.event.name}`, a = Of.get(o); if (a && this.isRequestOutOfSync(a, i)) { this.client.logger.info(`Discarding out of sync request - ${i}`); return; } - this.isValidEmit(tn({ topic: r }, s)), this.client.events.emit("session_event", { id: i, topic: r, params: s }), Pf.set(o, i); + this.isValidEmit(tn({ topic: r }, s)), this.client.events.emit("session_event", { id: i, topic: r, params: s }), Of.set(o, i); } catch (o) { await this.sendError({ id: i, topic: r, error: o }), this.client.logger.error(o); } }, this.onSessionAuthenticateResponse = (r, n) => { const { id: i } = n; - this.client.logger.trace({ type: "method", method: "onSessionAuthenticateResponse", topic: r, payload: n }), js(n) ? this.events.emit(br("session_request", i), { result: n.result }) : Zi(n) && this.events.emit(br("session_request", i), { error: n.error }); + this.client.logger.trace({ type: "method", method: "onSessionAuthenticateResponse", topic: r, payload: n }), zs(n) ? this.events.emit(yr("session_request", i), { result: n.result }) : es(n) && this.events.emit(yr("session_request", i), { error: n.error }); }, this.onSessionAuthenticateRequest = async (r) => { var n; const { topic: i, payload: s, attestation: o, encryptedId: a, transportType: u } = r; try { - const { requester: l, authPayload: d, expiryTimestamp: p } = s.params, w = await this.getVerifyContext({ attestationId: o, hash: xo(JSON.stringify(s)), encryptedId: a, metadata: l.metadata, transportType: u }), A = { requester: l, pairingTopic: i, id: s.id, authPayload: d, verifyContext: w, expiryTimestamp: p }; - await this.setAuthRequest(s.id, { request: A, pairingTopic: i, transportType: u }), u === zr.link_mode && (n = l.metadata.redirect) != null && n.universal && this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal), this.client.events.emit("session_authenticate", { topic: i, params: s.params, id: s.id, verifyContext: w }); + const { requester: l, authPayload: d, expiryTimestamp: p } = s.params, w = await this.getVerifyContext({ attestationId: o, hash: Ao(JSON.stringify(s)), encryptedId: a, metadata: l.metadata, transportType: u }), _ = { requester: l, pairingTopic: i, id: s.id, authPayload: d, verifyContext: w, expiryTimestamp: p }; + await this.setAuthRequest(s.id, { request: _, pairingTopic: i, transportType: u }), u === zr.link_mode && (n = l.metadata.redirect) != null && n.universal && this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal), this.client.events.emit("session_authenticate", { topic: i, params: s.params, id: s.id, verifyContext: w }); } catch (l) { this.client.logger.error(l); - const d = s.params.requester.publicKey, p = await this.client.core.crypto.generateKeyPair(), w = this.getAppLinkIfEnabled(s.params.requester.metadata, u), A = { type: Co, receiverPublicKey: d, senderPublicKey: p }; - await this.sendError({ id: s.id, topic: i, error: l, encodeOpts: A, rpcOpts: In.wc_sessionAuthenticate.autoReject, appLink: w }); + const d = s.params.requester.publicKey, p = await this.client.core.crypto.generateKeyPair(), w = this.getAppLinkIfEnabled(s.params.requester.metadata, u), _ = { type: Oo, receiverPublicKey: d, senderPublicKey: p }; + await this.sendError({ id: s.id, topic: i, error: l, encodeOpts: _, rpcOpts: In.wc_sessionAuthenticate.autoReject, appLink: w }); } }, this.addSessionRequestToSessionRequestQueue = (r) => { this.sessionRequestQueue.queue.push(r); }, this.cleanupAfterResponse = (r) => { this.deletePendingSessionRequest(r.response.id, { message: "fulfilled", code: 0 }), setTimeout(() => { - this.sessionRequestQueue.state = ks.idle, this.processSessionRequestQueue(); - }, mt.toMiliseconds(this.requestQueueDelay)); + this.sessionRequestQueue.state = Fs.idle, this.processSessionRequestQueue(); + }, vt.toMiliseconds(this.requestQueueDelay)); }, this.cleanupPendingSentRequestsForTopic = ({ topic: r, error: n }) => { const i = this.client.core.history.pending; i.length > 0 && i.filter((s) => s.topic === r && s.request.method === "wc_sessionRequest").forEach((s) => { - const o = s.request.id, a = br("session_request", o); + const o = s.request.id, a = yr("session_request", o); if (this.events.listenerCount(a) === 0) throw new Error(`emitting ${a} without any listeners`); - this.events.emit(br("session_request", s.request.id), { error: n }); + this.events.emit(yr("session_request", s.request.id), { error: n }); }); }, this.processSessionRequestQueue = () => { - if (this.sessionRequestQueue.state === ks.active) { + if (this.sessionRequestQueue.state === Fs.active) { this.client.logger.info("session request queue is already active."); return; } @@ -20557,7 +21069,7 @@ class WV extends a$ { return; } try { - this.sessionRequestQueue.state = ks.active, this.emitSessionRequest(r); + this.sessionRequestQueue.state = Fs.active, this.emitSessionRequest(r); } catch (n) { this.client.logger.error(n); } @@ -20566,107 +21078,107 @@ class WV extends a$ { }, this.onPairingCreated = (r) => { if (r.methods && this.expectedPairingMethodMap.set(r.topic, r.methods), r.active) return; const n = this.client.proposal.getAll().find((i) => i.pairingTopic === r.topic); - n && this.onSessionProposeRequest({ topic: r.topic, payload: da("wc_sessionPropose", { requiredNamespaces: n.requiredNamespaces, optionalNamespaces: n.optionalNamespaces, relays: n.relays, proposer: n.proposer, sessionProperties: n.sessionProperties }, n.id) }); + n && this.onSessionProposeRequest({ topic: r.topic, payload: ga("wc_sessionPropose", { requiredNamespaces: n.requiredNamespaces, optionalNamespaces: n.optionalNamespaces, relays: n.relays, proposer: n.proposer, sessionProperties: n.sessionProperties }, n.id) }); }, this.isValidConnect = async (r) => { - if (!gi(r)) { + if (!mi(r)) { const { message: u } = ft("MISSING_OR_INVALID", `connect() params: ${JSON.stringify(r)}`); throw new Error(u); } const { pairingTopic: n, requiredNamespaces: i, optionalNamespaces: s, sessionProperties: o, relays: a } = r; - if (mi(n) || await this.isValidPairingTopic(n), !aW(a)) { + if (vi(n) || await this.isValidPairingTopic(n), !jW(a)) { const { message: u } = ft("MISSING_OR_INVALID", `connect() relays: ${a}`); throw new Error(u); } - !mi(i) && Sl(i) !== 0 && this.validateNamespaces(i, "requiredNamespaces"), !mi(s) && Sl(s) !== 0 && this.validateNamespaces(s, "optionalNamespaces"), mi(o) || this.validateSessionProps(o, "sessionProperties"); + !vi(i) && Ll(i) !== 0 && this.validateNamespaces(i, "requiredNamespaces"), !vi(s) && Ll(s) !== 0 && this.validateNamespaces(s, "optionalNamespaces"), vi(o) || this.validateSessionProps(o, "sessionProperties"); }, this.validateNamespaces = (r, n) => { - const i = oW(r, "connect()", n); + const i = FW(r, "connect()", n); if (i) throw new Error(i.message); }, this.isValidApprove = async (r) => { - if (!gi(r)) throw new Error(ft("MISSING_OR_INVALID", `approve() params: ${r}`).message); + if (!mi(r)) throw new Error(ft("MISSING_OR_INVALID", `approve() params: ${r}`).message); const { id: n, namespaces: i, relayProtocol: s, sessionProperties: o } = r; this.checkRecentlyDeleted(n), await this.isValidProposalId(n); - const a = this.client.proposal.get(n), u = hm(i, "approve()"); + const a = this.client.proposal.get(n), u = Pm(i, "approve()"); if (u) throw new Error(u.message); - const l = n3(a.requiredNamespaces, i, "approve()"); + const l = y3(a.requiredNamespaces, i, "approve()"); if (l) throw new Error(l.message); if (!dn(s, !0)) { const { message: d } = ft("MISSING_OR_INVALID", `approve() relayProtocol: ${s}`); throw new Error(d); } - mi(o) || this.validateSessionProps(o, "sessionProperties"); + vi(o) || this.validateSessionProps(o, "sessionProperties"); }, this.isValidReject = async (r) => { - if (!gi(r)) { + if (!mi(r)) { const { message: s } = ft("MISSING_OR_INVALID", `reject() params: ${r}`); throw new Error(s); } const { id: n, reason: i } = r; - if (this.checkRecentlyDeleted(n), await this.isValidProposalId(n), !uW(i)) { + if (this.checkRecentlyDeleted(n), await this.isValidProposalId(n), !qW(i)) { const { message: s } = ft("MISSING_OR_INVALID", `reject() reason: ${JSON.stringify(i)}`); throw new Error(s); } }, this.isValidSessionSettleRequest = (r) => { - if (!gi(r)) { + if (!mi(r)) { const { message: l } = ft("MISSING_OR_INVALID", `onSessionSettleRequest() params: ${r}`); throw new Error(l); } const { relay: n, controller: i, namespaces: s, expiry: o } = r; - if (!G8(n)) { + if (!_E(n)) { const { message: l } = ft("MISSING_OR_INVALID", "onSessionSettleRequest() relay protocol should be a string"); throw new Error(l); } - const a = eW(i, "onSessionSettleRequest()"); + const a = OW(i, "onSessionSettleRequest()"); if (a) throw new Error(a.message); - const u = hm(s, "onSessionSettleRequest()"); + const u = Pm(s, "onSessionSettleRequest()"); if (u) throw new Error(u.message); - if (ca(o)) { + if (fa(o)) { const { message: l } = ft("EXPIRED", "onSessionSettleRequest()"); throw new Error(l); } }, this.isValidUpdate = async (r) => { - if (!gi(r)) { + if (!mi(r)) { const { message: u } = ft("MISSING_OR_INVALID", `update() params: ${r}`); throw new Error(u); } const { topic: n, namespaces: i } = r; this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); - const s = this.client.session.get(n), o = hm(i, "update()"); + const s = this.client.session.get(n), o = Pm(i, "update()"); if (o) throw new Error(o.message); - const a = n3(s.requiredNamespaces, i, "update()"); + const a = y3(s.requiredNamespaces, i, "update()"); if (a) throw new Error(a.message); }, this.isValidExtend = async (r) => { - if (!gi(r)) { + if (!mi(r)) { const { message: i } = ft("MISSING_OR_INVALID", `extend() params: ${r}`); throw new Error(i); } const { topic: n } = r; this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); }, this.isValidRequest = async (r) => { - if (!gi(r)) { + if (!mi(r)) { const { message: u } = ft("MISSING_OR_INVALID", `request() params: ${r}`); throw new Error(u); } const { topic: n, request: i, chainId: s, expiry: o } = r; this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); const { namespaces: a } = this.client.session.get(n); - if (!r3(a, s)) { + if (!b3(a, s)) { const { message: u } = ft("MISSING_OR_INVALID", `request() chainId: ${s}`); throw new Error(u); } - if (!fW(i)) { + if (!zW(i)) { const { message: u } = ft("MISSING_OR_INVALID", `request() ${JSON.stringify(i)}`); throw new Error(u); } - if (!dW(a, s, i.method)) { + if (!KW(a, s, i.method)) { const { message: u } = ft("MISSING_OR_INVALID", `request() method: ${i.method}`); throw new Error(u); } - if (o && !vW(o, vm)) { - const { message: u } = ft("MISSING_OR_INVALID", `request() expiry: ${o}. Expiry must be a number (in seconds) between ${vm.min} and ${vm.max}`); + if (o && !JW(o, Rm)) { + const { message: u } = ft("MISSING_OR_INVALID", `request() expiry: ${o}. Expiry must be a number (in seconds) between ${Rm.min} and ${Rm.max}`); throw new Error(u); } }, this.isValidRespond = async (r) => { var n; - if (!gi(r)) { + if (!mi(r)) { const { message: o } = ft("MISSING_OR_INVALID", `respond() params: ${r}`); throw new Error(o); } @@ -20676,39 +21188,39 @@ class WV extends a$ { } catch (o) { throw (n = r == null ? void 0 : r.response) != null && n.id && this.cleanupAfterResponse(r), o; } - if (!lW(s)) { + if (!WW(s)) { const { message: o } = ft("MISSING_OR_INVALID", `respond() response: ${JSON.stringify(s)}`); throw new Error(o); } }, this.isValidPing = async (r) => { - if (!gi(r)) { + if (!mi(r)) { const { message: i } = ft("MISSING_OR_INVALID", `ping() params: ${r}`); throw new Error(i); } const { topic: n } = r; await this.isValidSessionOrPairingTopic(n); }, this.isValidEmit = async (r) => { - if (!gi(r)) { + if (!mi(r)) { const { message: a } = ft("MISSING_OR_INVALID", `emit() params: ${r}`); throw new Error(a); } const { topic: n, event: i, chainId: s } = r; await this.isValidSessionTopic(n); const { namespaces: o } = this.client.session.get(n); - if (!r3(o, s)) { + if (!b3(o, s)) { const { message: a } = ft("MISSING_OR_INVALID", `emit() chainId: ${s}`); throw new Error(a); } - if (!hW(i)) { + if (!HW(i)) { const { message: a } = ft("MISSING_OR_INVALID", `emit() event: ${JSON.stringify(i)}`); throw new Error(a); } - if (!pW(o, s, i.name)) { + if (!VW(o, s, i.name)) { const { message: a } = ft("MISSING_OR_INVALID", `emit() event: ${JSON.stringify(i)}`); throw new Error(a); } }, this.isValidDisconnect = async (r) => { - if (!gi(r)) { + if (!mi(r)) { const { message: i } = ft("MISSING_OR_INVALID", `disconnect() params: ${r}`); throw new Error(i); } @@ -20720,11 +21232,11 @@ class WV extends a$ { if (!dn(i, !1)) throw new Error("uri is required parameter"); if (!dn(s, !1)) throw new Error("domain is required parameter"); if (!dn(o, !1)) throw new Error("nonce is required parameter"); - if ([...new Set(n.map((u) => hu(u).namespace))].length > 1) throw new Error("Multi-namespace requests are not supported. Please request single namespace only."); - const { namespace: a } = hu(n[0]); + if ([...new Set(n.map((u) => _u(u).namespace))].length > 1) throw new Error("Multi-namespace requests are not supported. Please request single namespace only."); + const { namespace: a } = _u(n[0]); if (a !== "eip155") throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains."); }, this.getVerifyContext = async (r) => { - const { attestationId: n, hash: i, encryptedId: s, metadata: o, transportType: a } = r, u = { verified: { verifyUrl: o.verifyUrl || Wf, validation: "UNKNOWN", origin: o.url || "" } }; + const { attestationId: n, hash: i, encryptedId: s, metadata: o, transportType: a } = r, u = { verified: { verifyUrl: o.verifyUrl || Xf, validation: "UNKNOWN", origin: o.url || "" } }; try { if (a === zr.link_mode) { const d = this.getAppLinkIfEnabled(o, a); @@ -20769,11 +21281,11 @@ class WV extends a$ { return this.isLinkModeEnabled(r, n) ? (i = r == null ? void 0 : r.redirect) == null ? void 0 : i.universal : void 0; }, this.handleLinkModeMessage = ({ url: r }) => { if (!r || !r.includes("wc_ev") || !r.includes("topic")) return; - const n = Fx(r, "topic") || "", i = decodeURIComponent(Fx(r, "wc_ev") || ""), s = this.client.session.keys.includes(n); + const n = t3(r, "topic") || "", i = decodeURIComponent(t3(r, "wc_ev") || ""), s = this.client.session.keys.includes(n); s && this.client.session.update(n, { transportType: zr.link_mode }), this.client.core.dispatchEnvelope({ topic: n, message: i, sessionExists: s }); }, this.registerLinkModeListeners = async () => { var r; - if (sb() || qu() && (r = this.client.metadata.redirect) != null && r.linkMode) { + if (yb() || Yu() && (r = this.client.metadata.redirect) != null && r.linkMode) { const n = global == null ? void 0 : global.Linking; if (typeof n < "u") { n.addEventListener("url", this.handleLinkModeMessage, this.client.name); @@ -20795,28 +21307,28 @@ class WV extends a$ { await this.client.core.relayer.confirmOnlineStateOrThrow(); } registerRelayerEvents() { - this.client.core.relayer.on(oi.message, (e) => { + this.client.core.relayer.on(ai.message, (e) => { !this.initialized || this.relayMessageCache.length > 0 ? this.relayMessageCache.push(e) : this.onRelayMessage(e); }); } async onRelayMessage(e) { - const { topic: r, message: n, attestation: i, transportType: s } = e, { publicKey: o } = this.client.auth.authKeys.keys.includes(Rd) ? this.client.auth.authKeys.get(Rd) : { publicKey: void 0 }, a = await this.client.core.crypto.decode(r, n, { receiverPublicKey: o, encoding: s === zr.link_mode ? Af : ha }); + const { topic: r, message: n, attestation: i, transportType: s } = e, { publicKey: o } = this.client.auth.authKeys.keys.includes(zd) ? this.client.auth.authKeys.get(zd) : { publicKey: void 0 }, a = await this.client.core.crypto.decode(r, n, { receiverPublicKey: o, encoding: s === zr.link_mode ? Df : pa }); try { - lb(a) ? (this.client.core.history.set(r, a), this.onRelayEventRequest({ topic: r, payload: a, attestation: i, transportType: s, encryptedId: xo(n) })) : ip(a) ? (await this.client.core.history.resolve(a), await this.onRelayEventResponse({ topic: r, payload: a, transportType: s }), this.client.core.history.delete(r, a.id)) : this.onRelayEventUnknownPayload({ topic: r, payload: a, transportType: s }); + Ab(a) ? (this.client.core.history.set(r, a), this.onRelayEventRequest({ topic: r, payload: a, attestation: i, transportType: s, encryptedId: Ao(n) })) : bp(a) ? (await this.client.core.history.resolve(a), await this.onRelayEventResponse({ topic: r, payload: a, transportType: s }), this.client.core.history.delete(r, a.id)) : this.onRelayEventUnknownPayload({ topic: r, payload: a, transportType: s }); } catch (u) { this.client.logger.error(u); } } registerExpirerEvents() { - this.client.core.expirer.on(Ji.expired, async (e) => { - const { topic: r, id: n } = B8(e.target); + this.client.core.expirer.on(Zi.expired, async (e) => { + const { topic: r, id: n } = hE(e.target); if (n && this.client.pendingRequest.keys.includes(n)) return await this.deletePendingSessionRequest(n, ft("EXPIRED"), !0); if (n && this.client.auth.requests.keys.includes(n)) return await this.deletePendingAuthRequest(n, ft("EXPIRED"), !0); r ? this.client.session.keys.includes(r) && (await this.deleteSession({ topic: r, expirerHasDeleted: !0 }), this.client.events.emit("session_expire", { topic: r })) : n && (await this.deleteProposal(n, !0), this.client.events.emit("proposal_expire", { id: n })); }); } registerPairingEvents() { - this.client.core.pairing.events.on(Za.create, (e) => this.onPairingCreated(e)), this.client.core.pairing.events.on(Za.delete, (e) => { + this.client.core.pairing.events.on(ic.create, (e) => this.onPairingCreated(e)), this.client.core.pairing.events.on(ic.delete, (e) => { this.addToRecentlyDeleted(e.topic, "pairing"); }); } @@ -20829,7 +21341,7 @@ class WV extends a$ { const { message: r } = ft("NO_MATCHING_KEY", `pairing topic doesn't exist: ${e}`); throw new Error(r); } - if (ca(this.client.core.pairing.pairings.get(e).expiry)) { + if (fa(this.client.core.pairing.pairings.get(e).expiry)) { const { message: r } = ft("EXPIRED", `pairing topic: ${e}`); throw new Error(r); } @@ -20843,7 +21355,7 @@ class WV extends a$ { const { message: r } = ft("NO_MATCHING_KEY", `session topic doesn't exist: ${e}`); throw new Error(r); } - if (ca(this.client.session.get(e).expiry)) { + if (fa(this.client.session.get(e).expiry)) { await this.deleteSession({ topic: e }); const { message: r } = ft("EXPIRED", `session topic: ${e}`); throw new Error(r); @@ -20865,7 +21377,7 @@ class WV extends a$ { } } async isValidProposalId(e) { - if (!cW(e)) { + if (!UW(e)) { const { message: r } = ft("MISSING_OR_INVALID", `proposal id should be a number: ${e}`); throw new Error(r); } @@ -20873,54 +21385,54 @@ class WV extends a$ { const { message: r } = ft("NO_MATCHING_KEY", `proposal id doesn't exist: ${e}`); throw new Error(r); } - if (ca(this.client.proposal.get(e).expiryTimestamp)) { + if (fa(this.client.proposal.get(e).expiryTimestamp)) { await this.deleteProposal(e); const { message: r } = ft("EXPIRED", `proposal id: ${e}`); throw new Error(r); } } } -class HV extends Ec { +class SG extends Oc { constructor(e, r) { - super(e, r, CV, db), this.core = e, this.logger = r; + super(e, r, cG, Mb), this.core = e, this.logger = r; } } -let KV = class extends Ec { +let AG = class extends Oc { constructor(e, r) { - super(e, r, TV, db), this.core = e, this.logger = r; + super(e, r, uG, Mb), this.core = e, this.logger = r; } }; -class VV extends Ec { +class PG extends Oc { constructor(e, r) { - super(e, r, DV, db, (n) => n.id), this.core = e, this.logger = r; + super(e, r, lG, Mb, (n) => n.id), this.core = e, this.logger = r; } } -class GV extends Ec { +class MG extends Oc { constructor(e, r) { - super(e, r, kV, op, () => Rd), this.core = e, this.logger = r; + super(e, r, gG, wp, () => zd), this.core = e, this.logger = r; } } -class YV extends Ec { +class IG extends Oc { constructor(e, r) { - super(e, r, $V, op), this.core = e, this.logger = r; + super(e, r, mG, wp), this.core = e, this.logger = r; } } -class JV extends Ec { +class CG extends Oc { constructor(e, r) { - super(e, r, BV, op, (n) => n.id), this.core = e, this.logger = r; + super(e, r, vG, wp, (n) => n.id), this.core = e, this.logger = r; } } -class XV { +class TG { constructor(e, r) { - this.core = e, this.logger = r, this.authKeys = new GV(this.core, this.logger), this.pairingTopics = new YV(this.core, this.logger), this.requests = new JV(this.core, this.logger); + this.core = e, this.logger = r, this.authKeys = new MG(this.core, this.logger), this.pairingTopics = new IG(this.core, this.logger), this.requests = new CG(this.core, this.logger); } async init() { await this.authKeys.init(), await this.pairingTopics.init(), await this.requests.init(); } } -class pb extends o$ { +class Ib extends F$ { constructor(e) { - super(e), this.protocol = vE, this.version = bE, this.name = mm.name, this.events = new rs.EventEmitter(), this.on = (n, i) => this.events.on(n, i), this.once = (n, i) => this.events.once(n, i), this.off = (n, i) => this.events.off(n, i), this.removeListener = (n, i) => this.events.removeListener(n, i), this.removeAllListeners = (n) => this.events.removeAllListeners(n), this.connect = async (n) => { + super(e), this.protocol = HE, this.version = KE, this.name = Tm.name, this.events = new is.EventEmitter(), this.on = (n, i) => this.events.on(n, i), this.once = (n, i) => this.events.once(n, i), this.off = (n, i) => this.events.off(n, i), this.removeListener = (n, i) => this.events.removeListener(n, i), this.removeAllListeners = (n) => this.events.removeAllListeners(n), this.connect = async (n) => { try { return await this.engine.connect(n); } catch (i) { @@ -21022,16 +21534,16 @@ class pb extends o$ { } catch (i) { throw this.logger.error(i.message), i; } - }, this.name = (e == null ? void 0 : e.name) || mm.name, this.metadata = (e == null ? void 0 : e.metadata) || O8(), this.signConfig = e == null ? void 0 : e.signConfig; - const r = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : ql($0({ level: (e == null ? void 0 : e.logger) || mm.logger })); - this.core = (e == null ? void 0 : e.core) || new IV(e), this.logger = ci(r, this.name), this.session = new KV(this.core, this.logger), this.proposal = new HV(this.core, this.logger), this.pendingRequest = new VV(this.core, this.logger), this.engine = new WV(this), this.auth = new XV(this.core, this.logger); + }, this.name = (e == null ? void 0 : e.name) || Tm.name, this.metadata = (e == null ? void 0 : e.metadata) || aE(), this.signConfig = e == null ? void 0 : e.signConfig; + const r = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : Xl(X0({ level: (e == null ? void 0 : e.logger) || Tm.logger })); + this.core = (e == null ? void 0 : e.core) || new aG(e), this.logger = ui(r, this.name), this.session = new AG(this.core, this.logger), this.proposal = new SG(this.core, this.logger), this.pendingRequest = new PG(this.core, this.logger), this.engine = new EG(this), this.auth = new TG(this.core, this.logger); } static async init(e) { - const r = new pb(e); + const r = new Ib(e); return await r.initialize(), r; } get context() { - return Ai(this.logger); + return Pi(this.logger); } get pairing() { return this.core.pairing.pairings; @@ -21045,7 +21557,7 @@ class pb extends o$ { } } } -var h0 = { exports: {} }; +var S0 = { exports: {} }; /** * @license * Lodash @@ -21054,29 +21566,29 @@ var h0 = { exports: {} }; * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -h0.exports; +S0.exports; (function(t, e) { (function() { - var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", u = "__lodash_hash_undefined__", l = 500, d = "__lodash_placeholder__", p = 1, w = 2, A = 4, M = 1, N = 2, L = 1, B = 2, $ = 4, H = 8, U = 16, V = 32, te = 64, R = 128, K = 256, ge = 512, Ee = 30, Y = "...", S = 800, m = 16, f = 1, g = 2, b = 3, x = 1 / 0, _ = 9007199254740991, E = 17976931348623157e292, v = NaN, P = 4294967295, I = P - 1, F = P >>> 1, ce = [ + var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", u = "__lodash_hash_undefined__", l = 500, d = "__lodash_placeholder__", p = 1, w = 2, _ = 4, P = 1, O = 2, L = 1, B = 2, k = 4, q = 8, U = 16, V = 32, Q = 64, R = 128, K = 256, ge = 512, Ee = 30, Y = "...", A = 800, m = 16, f = 1, g = 2, b = 3, x = 1 / 0, E = 9007199254740991, S = 17976931348623157e292, v = NaN, M = 4294967295, I = M - 1, F = M >>> 1, ce = [ ["ary", R], ["bind", L], ["bindKey", B], - ["curry", H], + ["curry", q], ["curryRight", U], ["flip", ge], ["partial", V], - ["partialRight", te], + ["partialRight", Q], ["rearg", K] - ], D = "[object Arguments]", oe = "[object Array]", Z = "[object AsyncFunction]", J = "[object Boolean]", Q = "[object Date]", T = "[object DOMException]", X = "[object Error]", re = "[object Function]", pe = "[object GeneratorFunction]", ie = "[object Map]", ue = "[object Number]", ve = "[object Null]", Pe = "[object Object]", De = "[object Promise]", Ce = "[object Proxy]", $e = "[object RegExp]", Me = "[object Set]", Ne = "[object String]", Ke = "[object Symbol]", Le = "[object Undefined]", qe = "[object WeakMap]", ze = "[object WeakSet]", _e = "[object ArrayBuffer]", Ze = "[object DataView]", at = "[object Float32Array]", ke = "[object Float64Array]", Qe = "[object Int8Array]", tt = "[object Int16Array]", Ye = "[object Int32Array]", dt = "[object Uint8Array]", lt = "[object Uint8ClampedArray]", ct = "[object Uint16Array]", qt = "[object Uint32Array]", Jt = /\b__p \+= '';/g, Et = /\b(__p \+=) '' \+/g, er = /(__e\(.*?\)|\b__t\)) \+\n'';/g, Xt = /&(?:amp|lt|gt|quot|#39);/g, Dt = /[&<>"']/g, kt = RegExp(Xt.source), Ct = RegExp(Dt.source), gt = /<%-([\s\S]+?)%>/g, Rt = /<%([\s\S]+?)%>/g, Nt = /<%=([\s\S]+?)%>/g, vt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $t = /^\w*$/, Ft = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, rt = /[\\^$.*+?()[\]{}|]/g, Bt = RegExp(rt.source), k = /^\s+/, q = /\s/, W = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, C = /\{\n\/\* \[wrapped with (.+)\] \*/, G = /,? & /, j = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, se = /[()=,{}\[\]\/\s]/, de = /\\(\\)?/g, xe = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Te = /\w*$/, Re = /^[-+]0x[0-9a-f]+$/i, nt = /^0b[01]+$/i, je = /^\[object .+?Constructor\]$/, pt = /^0o[0-7]+$/i, it = /^(?:0|[1-9]\d*)$/, et = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, St = /($^)/, Tt = /['\n\r\u2028\u2029\\]/g, At = "\\ud800-\\udfff", _t = "\\u0300-\\u036f", ht = "\\ufe20-\\ufe2f", xt = "\\u20d0-\\u20ff", st = _t + ht + xt, bt = "\\u2700-\\u27bf", ut = "a-z\\xdf-\\xf6\\xf8-\\xff", ot = "\\xac\\xb1\\xd7\\xf7", Se = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Ae = "\\u2000-\\u206f", Ve = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Fe = "A-Z\\xc0-\\xd6\\xd8-\\xde", Ue = "\\ufe0e\\ufe0f", Je = ot + Se + Ae + Ve, Lt = "['’]", zt = "[" + At + "]", Zt = "[" + Je + "]", Wt = "[" + st + "]", he = "\\d+", rr = "[" + bt + "]", dr = "[" + ut + "]", pr = "[^" + At + Je + he + bt + ut + Fe + "]", Qt = "\\ud83c[\\udffb-\\udfff]", gr = "(?:" + Wt + "|" + Qt + ")", lr = "[^" + At + "]", Rr = "(?:\\ud83c[\\udde6-\\uddff]){2}", mr = "[\\ud800-\\udbff][\\udc00-\\udfff]", yr = "[" + Fe + "]", $r = "\\u200d", Br = "(?:" + dr + "|" + pr + ")", Ir = "(?:" + yr + "|" + pr + ")", nn = "(?:" + Lt + "(?:d|ll|m|re|s|t|ve))?", sn = "(?:" + Lt + "(?:D|LL|M|RE|S|T|VE))?", on = gr + "?", lh = "[" + Ue + "]?", Rp = "(?:" + $r + "(?:" + [lr, Rr, mr].join("|") + ")" + lh + on + ")*", io = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", hh = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", dh = lh + on + Rp, Mc = "(?:" + [rr, Rr, mr].join("|") + ")" + dh, Dp = "(?:" + [lr + Wt + "?", Wt, Rr, mr, zt].join("|") + ")", Xu = RegExp(Lt, "g"), Op = RegExp(Wt, "g"), Ic = RegExp(Qt + "(?=" + Qt + ")|" + Dp + dh, "g"), ph = RegExp([ - yr + "?" + dr + "+" + nn + "(?=" + [Zt, yr, "$"].join("|") + ")", - Ir + "+" + sn + "(?=" + [Zt, yr + Br, "$"].join("|") + ")", - yr + "?" + Br + "+" + nn, - yr + "+" + sn, - hh, - io, + ], D = "[object Arguments]", oe = "[object Array]", Z = "[object AsyncFunction]", J = "[object Boolean]", ee = "[object Date]", T = "[object DOMException]", X = "[object Error]", re = "[object Function]", pe = "[object GeneratorFunction]", ie = "[object Map]", ue = "[object Number]", ve = "[object Null]", Pe = "[object Object]", De = "[object Promise]", Ce = "[object Proxy]", $e = "[object RegExp]", Me = "[object Set]", Ne = "[object String]", Ke = "[object Symbol]", Le = "[object Undefined]", qe = "[object WeakMap]", ze = "[object WeakSet]", _e = "[object ArrayBuffer]", Ze = "[object DataView]", at = "[object Float32Array]", ke = "[object Float64Array]", Qe = "[object Int8Array]", tt = "[object Int16Array]", Ye = "[object Int32Array]", dt = "[object Uint8Array]", lt = "[object Uint8ClampedArray]", ct = "[object Uint16Array]", qt = "[object Uint32Array]", Jt = /\b__p \+= '';/g, Et = /\b(__p \+=) '' \+/g, er = /(__e\(.*?\)|\b__t\)) \+\n'';/g, Xt = /&(?:amp|lt|gt|quot|#39);/g, Dt = /[&<>"']/g, kt = RegExp(Xt.source), Ct = RegExp(Dt.source), mt = /<%-([\s\S]+?)%>/g, Rt = /<%([\s\S]+?)%>/g, Nt = /<%=([\s\S]+?)%>/g, bt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $t = /^\w*$/, Ft = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, rt = /[\\^$.*+?()[\]{}|]/g, Bt = RegExp(rt.source), $ = /^\s+/, z = /\s/, H = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, C = /\{\n\/\* \[wrapped with (.+)\] \*/, G = /,? & /, j = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, se = /[()=,{}\[\]\/\s]/, de = /\\(\\)?/g, xe = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Te = /\w*$/, Re = /^[-+]0x[0-9a-f]+$/i, nt = /^0b[01]+$/i, je = /^\[object .+?Constructor\]$/, pt = /^0o[0-7]+$/i, it = /^(?:0|[1-9]\d*)$/, et = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, St = /($^)/, Tt = /['\n\r\u2028\u2029\\]/g, At = "\\ud800-\\udfff", _t = "\\u0300-\\u036f", ht = "\\ufe20-\\ufe2f", xt = "\\u20d0-\\u20ff", st = _t + ht + xt, yt = "\\u2700-\\u27bf", ut = "a-z\\xdf-\\xf6\\xf8-\\xff", ot = "\\xac\\xb1\\xd7\\xf7", Se = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Ae = "\\u2000-\\u206f", Ve = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Fe = "A-Z\\xc0-\\xd6\\xd8-\\xde", Ue = "\\ufe0e\\ufe0f", Je = ot + Se + Ae + Ve, Lt = "['’]", zt = "[" + At + "]", Zt = "[" + Je + "]", Wt = "[" + st + "]", he = "\\d+", rr = "[" + yt + "]", dr = "[" + ut + "]", pr = "[^" + At + Je + he + yt + ut + Fe + "]", Qt = "\\ud83c[\\udffb-\\udfff]", gr = "(?:" + Wt + "|" + Qt + ")", lr = "[^" + At + "]", Rr = "(?:\\ud83c[\\udde6-\\uddff]){2}", mr = "[\\ud800-\\udbff][\\udc00-\\udfff]", wr = "[" + Fe + "]", $r = "\\u200d", Br = "(?:" + dr + "|" + pr + ")", Ir = "(?:" + wr + "|" + pr + ")", nn = "(?:" + Lt + "(?:d|ll|m|re|s|t|ve))?", sn = "(?:" + Lt + "(?:D|LL|M|RE|S|T|VE))?", on = gr + "?", wh = "[" + Ue + "]?", Hp = "(?:" + $r + "(?:" + [lr, Rr, mr].join("|") + ")" + wh + on + ")*", ao = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", xh = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", _h = wh + on + Hp, $c = "(?:" + [rr, Rr, mr].join("|") + ")" + _h, Kp = "(?:" + [lr + Wt + "?", Wt, Rr, mr, zt].join("|") + ")", sf = RegExp(Lt, "g"), Vp = RegExp(Wt, "g"), Bc = RegExp(Qt + "(?=" + Qt + ")|" + Kp + _h, "g"), Eh = RegExp([ + wr + "?" + dr + "+" + nn + "(?=" + [Zt, wr, "$"].join("|") + ")", + Ir + "+" + sn + "(?=" + [Zt, wr + Br, "$"].join("|") + ")", + wr + "?" + Br + "+" + nn, + wr + "+" + sn, + xh, + ao, he, - Mc - ].join("|"), "g"), gh = RegExp("[" + $r + At + st + Ue + "]"), Da = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, mh = [ + $c + ].join("|"), "g"), Sh = RegExp("[" + $r + At + st + Ue + "]"), Ba = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, Ah = [ "Array", "Buffer", "DataView", @@ -21107,10 +21619,10 @@ h0.exports; "isFinite", "parseInt", "setTimeout" - ], Np = -1, Fr = {}; - Fr[at] = Fr[ke] = Fr[Qe] = Fr[tt] = Fr[Ye] = Fr[dt] = Fr[lt] = Fr[ct] = Fr[qt] = !0, Fr[D] = Fr[oe] = Fr[_e] = Fr[J] = Fr[Ze] = Fr[Q] = Fr[X] = Fr[re] = Fr[ie] = Fr[ue] = Fr[Pe] = Fr[$e] = Fr[Me] = Fr[Ne] = Fr[qe] = !1; + ], Gp = -1, Fr = {}; + Fr[at] = Fr[ke] = Fr[Qe] = Fr[tt] = Fr[Ye] = Fr[dt] = Fr[lt] = Fr[ct] = Fr[qt] = !0, Fr[D] = Fr[oe] = Fr[_e] = Fr[J] = Fr[Ze] = Fr[ee] = Fr[X] = Fr[re] = Fr[ie] = Fr[ue] = Fr[Pe] = Fr[$e] = Fr[Me] = Fr[Ne] = Fr[qe] = !1; var Dr = {}; - Dr[D] = Dr[oe] = Dr[_e] = Dr[Ze] = Dr[J] = Dr[Q] = Dr[at] = Dr[ke] = Dr[Qe] = Dr[tt] = Dr[Ye] = Dr[ie] = Dr[ue] = Dr[Pe] = Dr[$e] = Dr[Me] = Dr[Ne] = Dr[Ke] = Dr[dt] = Dr[lt] = Dr[ct] = Dr[qt] = !0, Dr[X] = Dr[re] = Dr[qe] = !1; + Dr[D] = Dr[oe] = Dr[_e] = Dr[Ze] = Dr[J] = Dr[ee] = Dr[at] = Dr[ke] = Dr[Qe] = Dr[tt] = Dr[Ye] = Dr[ie] = Dr[ue] = Dr[Pe] = Dr[$e] = Dr[Me] = Dr[Ne] = Dr[Ke] = Dr[dt] = Dr[lt] = Dr[ct] = Dr[qt] = !0, Dr[X] = Dr[re] = Dr[qe] = !1; var ae = { // Latin-1 Supplement block. À: "A", @@ -21323,13 +21835,13 @@ h0.exports; "\r": "r", "\u2028": "u2028", "\u2029": "u2029" - }, jr = parseFloat, nr = parseInt, Kr = typeof gn == "object" && gn && gn.Object === Object && gn, vn = typeof self == "object" && self && self.Object === Object && self, _r = Kr || vn || Function("return this")(), Ur = e && !e.nodeType && e, an = Ur && !0 && t && !t.nodeType && t, ui = an && an.exports === Ur, bn = ui && Kr.process, Vr = function() { + }, jr = parseFloat, nr = parseInt, Kr = typeof gn == "object" && gn && gn.Object === Object && gn, vn = typeof self == "object" && self && self.Object === Object && self, Er = Kr || vn || Function("return this")(), Ur = e && !e.nodeType && e, an = Ur && !0 && t && !t.nodeType && t, fi = an && an.exports === Ur, bn = fi && Kr.process, Vr = function() { try { var be = an && an.require && an.require("util").types; return be || bn && bn.binding && bn.binding("util"); } catch { } - }(), ti = Vr && Vr.isArrayBuffer, fs = Vr && Vr.isDate, Fi = Vr && Vr.isMap, Is = Vr && Vr.isRegExp, Zu = Vr && Vr.isSet, Oa = Vr && Vr.isTypedArray; + }(), ri = Vr && Vr.isArrayBuffer, hs = Vr && Vr.isDate, Ui = Vr && Vr.isMap, Ds = Vr && Vr.isRegExp, of = Vr && Vr.isSet, Fa = Vr && Vr.isTypedArray; function Pn(be, Be, Ie) { switch (Ie.length) { case 0: @@ -21343,41 +21855,41 @@ h0.exports; } return be.apply(Be, Ie); } - function nA(be, Be, Ie, It) { - for (var tr = -1, Pr = be == null ? 0 : be.length; ++tr < Pr; ) { - var xn = be[tr]; - Be(It, xn, Ie(xn), be); + function RA(be, Be, Ie, It) { + for (var tr = -1, Mr = be == null ? 0 : be.length; ++tr < Mr; ) { + var _n = be[tr]; + Be(It, _n, Ie(_n), be); } return It; } - function ji(be, Be) { + function qi(be, Be) { for (var Ie = -1, It = be == null ? 0 : be.length; ++Ie < It && Be(be[Ie], Ie, be) !== !1; ) ; return be; } - function iA(be, Be) { + function DA(be, Be) { for (var Ie = be == null ? 0 : be.length; Ie-- && Be(be[Ie], Ie, be) !== !1; ) ; return be; } - function gy(be, Be) { + function Cy(be, Be) { for (var Ie = -1, It = be == null ? 0 : be.length; ++Ie < It; ) if (!Be(be[Ie], Ie, be)) return !1; return !0; } - function Wo(be, Be) { - for (var Ie = -1, It = be == null ? 0 : be.length, tr = 0, Pr = []; ++Ie < It; ) { - var xn = be[Ie]; - Be(xn, Ie, be) && (Pr[tr++] = xn); + function Ko(be, Be) { + for (var Ie = -1, It = be == null ? 0 : be.length, tr = 0, Mr = []; ++Ie < It; ) { + var _n = be[Ie]; + Be(_n, Ie, be) && (Mr[tr++] = _n); } - return Pr; + return Mr; } - function vh(be, Be) { + function Ph(be, Be) { var Ie = be == null ? 0 : be.length; - return !!Ie && Cc(be, Be, 0) > -1; + return !!Ie && Fc(be, Be, 0) > -1; } - function Lp(be, Be, Ie) { + function Yp(be, Be, Ie) { for (var It = -1, tr = be == null ? 0 : be.length; ++It < tr; ) if (Ie(Be, be[It])) return !0; @@ -21388,266 +21900,266 @@ h0.exports; tr[Ie] = Be(be[Ie], Ie, be); return tr; } - function Ho(be, Be) { + function Vo(be, Be) { for (var Ie = -1, It = Be.length, tr = be.length; ++Ie < It; ) be[tr + Ie] = Be[Ie]; return be; } - function kp(be, Be, Ie, It) { - var tr = -1, Pr = be == null ? 0 : be.length; - for (It && Pr && (Ie = be[++tr]); ++tr < Pr; ) + function Jp(be, Be, Ie, It) { + var tr = -1, Mr = be == null ? 0 : be.length; + for (It && Mr && (Ie = be[++tr]); ++tr < Mr; ) Ie = Be(Ie, be[tr], tr, be); return Ie; } - function sA(be, Be, Ie, It) { + function OA(be, Be, Ie, It) { var tr = be == null ? 0 : be.length; for (It && tr && (Ie = be[--tr]); tr--; ) Ie = Be(Ie, be[tr], tr, be); return Ie; } - function $p(be, Be) { + function Xp(be, Be) { for (var Ie = -1, It = be == null ? 0 : be.length; ++Ie < It; ) if (Be(be[Ie], Ie, be)) return !0; return !1; } - var oA = Bp("length"); - function aA(be) { + var NA = Zp("length"); + function LA(be) { return be.split(""); } - function cA(be) { + function kA(be) { return be.match(j) || []; } - function my(be, Be, Ie) { + function Ty(be, Be, Ie) { var It; - return Ie(be, function(tr, Pr, xn) { - if (Be(tr, Pr, xn)) - return It = Pr, !1; + return Ie(be, function(tr, Mr, _n) { + if (Be(tr, Mr, _n)) + return It = Mr, !1; }), It; } - function bh(be, Be, Ie, It) { - for (var tr = be.length, Pr = Ie + (It ? 1 : -1); It ? Pr-- : ++Pr < tr; ) - if (Be(be[Pr], Pr, be)) - return Pr; + function Mh(be, Be, Ie, It) { + for (var tr = be.length, Mr = Ie + (It ? 1 : -1); It ? Mr-- : ++Mr < tr; ) + if (Be(be[Mr], Mr, be)) + return Mr; return -1; } - function Cc(be, Be, Ie) { - return Be === Be ? wA(be, Be, Ie) : bh(be, vy, Ie); + function Fc(be, Be, Ie) { + return Be === Be ? GA(be, Be, Ie) : Mh(be, Ry, Ie); } - function uA(be, Be, Ie, It) { - for (var tr = Ie - 1, Pr = be.length; ++tr < Pr; ) + function $A(be, Be, Ie, It) { + for (var tr = Ie - 1, Mr = be.length; ++tr < Mr; ) if (It(be[tr], Be)) return tr; return -1; } - function vy(be) { + function Ry(be) { return be !== be; } - function by(be, Be) { + function Dy(be, Be) { var Ie = be == null ? 0 : be.length; - return Ie ? jp(be, Be) / Ie : v; + return Ie ? eg(be, Be) / Ie : v; } - function Bp(be) { + function Zp(be) { return function(Be) { return Be == null ? r : Be[be]; }; } - function Fp(be) { + function Qp(be) { return function(Be) { return be == null ? r : be[Be]; }; } - function yy(be, Be, Ie, It, tr) { - return tr(be, function(Pr, xn, qr) { - Ie = It ? (It = !1, Pr) : Be(Ie, Pr, xn, qr); + function Oy(be, Be, Ie, It, tr) { + return tr(be, function(Mr, _n, qr) { + Ie = It ? (It = !1, Mr) : Be(Ie, Mr, _n, qr); }), Ie; } - function fA(be, Be) { + function BA(be, Be) { var Ie = be.length; for (be.sort(Be); Ie--; ) be[Ie] = be[Ie].value; return be; } - function jp(be, Be) { + function eg(be, Be) { for (var Ie, It = -1, tr = be.length; ++It < tr; ) { - var Pr = Be(be[It]); - Pr !== r && (Ie = Ie === r ? Pr : Ie + Pr); + var Mr = Be(be[It]); + Mr !== r && (Ie = Ie === r ? Mr : Ie + Mr); } return Ie; } - function Up(be, Be) { + function tg(be, Be) { for (var Ie = -1, It = Array(be); ++Ie < be; ) It[Ie] = Be(Ie); return It; } - function lA(be, Be) { + function FA(be, Be) { return Xr(Be, function(Ie) { return [Ie, be[Ie]]; }); } - function wy(be) { - return be && be.slice(0, Sy(be) + 1).replace(k, ""); + function Ny(be) { + return be && be.slice(0, By(be) + 1).replace($, ""); } - function Pi(be) { + function Mi(be) { return function(Be) { return be(Be); }; } - function qp(be, Be) { + function rg(be, Be) { return Xr(Be, function(Ie) { return be[Ie]; }); } - function Qu(be, Be) { + function af(be, Be) { return be.has(Be); } - function xy(be, Be) { - for (var Ie = -1, It = be.length; ++Ie < It && Cc(Be, be[Ie], 0) > -1; ) + function Ly(be, Be) { + for (var Ie = -1, It = be.length; ++Ie < It && Fc(Be, be[Ie], 0) > -1; ) ; return Ie; } - function _y(be, Be) { - for (var Ie = be.length; Ie-- && Cc(Be, be[Ie], 0) > -1; ) + function ky(be, Be) { + for (var Ie = be.length; Ie-- && Fc(Be, be[Ie], 0) > -1; ) ; return Ie; } - function hA(be, Be) { + function jA(be, Be) { for (var Ie = be.length, It = 0; Ie--; ) be[Ie] === Be && ++It; return It; } - var dA = Fp(ae), pA = Fp(ye); - function gA(be) { + var UA = Qp(ae), qA = Qp(ye); + function zA(be) { return "\\" + Pt[be]; } - function mA(be, Be) { + function WA(be, Be) { return be == null ? r : be[Be]; } - function Tc(be) { - return gh.test(be); + function jc(be) { + return Sh.test(be); } - function vA(be) { - return Da.test(be); + function HA(be) { + return Ba.test(be); } - function bA(be) { + function KA(be) { for (var Be, Ie = []; !(Be = be.next()).done; ) Ie.push(Be.value); return Ie; } - function zp(be) { + function ng(be) { var Be = -1, Ie = Array(be.size); return be.forEach(function(It, tr) { Ie[++Be] = [tr, It]; }), Ie; } - function Ey(be, Be) { + function $y(be, Be) { return function(Ie) { return be(Be(Ie)); }; } - function Ko(be, Be) { - for (var Ie = -1, It = be.length, tr = 0, Pr = []; ++Ie < It; ) { - var xn = be[Ie]; - (xn === Be || xn === d) && (be[Ie] = d, Pr[tr++] = Ie); + function Go(be, Be) { + for (var Ie = -1, It = be.length, tr = 0, Mr = []; ++Ie < It; ) { + var _n = be[Ie]; + (_n === Be || _n === d) && (be[Ie] = d, Mr[tr++] = Ie); } - return Pr; + return Mr; } - function yh(be) { + function Ih(be) { var Be = -1, Ie = Array(be.size); return be.forEach(function(It) { Ie[++Be] = It; }), Ie; } - function yA(be) { + function VA(be) { var Be = -1, Ie = Array(be.size); return be.forEach(function(It) { Ie[++Be] = [It, It]; }), Ie; } - function wA(be, Be, Ie) { + function GA(be, Be, Ie) { for (var It = Ie - 1, tr = be.length; ++It < tr; ) if (be[It] === Be) return It; return -1; } - function xA(be, Be, Ie) { + function YA(be, Be, Ie) { for (var It = Ie + 1; It--; ) if (be[It] === Be) return It; return It; } - function Rc(be) { - return Tc(be) ? EA(be) : oA(be); + function Uc(be) { + return jc(be) ? XA(be) : NA(be); } - function ls(be) { - return Tc(be) ? SA(be) : aA(be); + function ds(be) { + return jc(be) ? ZA(be) : LA(be); } - function Sy(be) { - for (var Be = be.length; Be-- && q.test(be.charAt(Be)); ) + function By(be) { + for (var Be = be.length; Be-- && z.test(be.charAt(Be)); ) ; return Be; } - var _A = Fp(Ge); - function EA(be) { - for (var Be = Ic.lastIndex = 0; Ic.test(be); ) + var JA = Qp(Ge); + function XA(be) { + for (var Be = Bc.lastIndex = 0; Bc.test(be); ) ++Be; return Be; } - function SA(be) { - return be.match(Ic) || []; + function ZA(be) { + return be.match(Bc) || []; } - function AA(be) { - return be.match(ph) || []; + function QA(be) { + return be.match(Eh) || []; } - var PA = function be(Be) { - Be = Be == null ? _r : Dc.defaults(_r.Object(), Be, Dc.pick(_r, mh)); - var Ie = Be.Array, It = Be.Date, tr = Be.Error, Pr = Be.Function, xn = Be.Math, qr = Be.Object, Wp = Be.RegExp, MA = Be.String, Ui = Be.TypeError, wh = Ie.prototype, IA = Pr.prototype, Oc = qr.prototype, xh = Be["__core-js_shared__"], _h = IA.toString, Tr = Oc.hasOwnProperty, CA = 0, Ay = function() { - var c = /[^.]+$/.exec(xh && xh.keys && xh.keys.IE_PROTO || ""); + var eP = function be(Be) { + Be = Be == null ? Er : qc.defaults(Er.Object(), Be, qc.pick(Er, Ah)); + var Ie = Be.Array, It = Be.Date, tr = Be.Error, Mr = Be.Function, _n = Be.Math, qr = Be.Object, ig = Be.RegExp, tP = Be.String, zi = Be.TypeError, Ch = Ie.prototype, rP = Mr.prototype, zc = qr.prototype, Th = Be["__core-js_shared__"], Rh = rP.toString, Tr = zc.hasOwnProperty, nP = 0, Fy = function() { + var c = /[^.]+$/.exec(Th && Th.keys && Th.keys.IE_PROTO || ""); return c ? "Symbol(src)_1." + c : ""; - }(), Eh = Oc.toString, TA = _h.call(qr), RA = _r._, DA = Wp( - "^" + _h.call(Tr).replace(rt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" - ), Sh = ui ? Be.Buffer : r, Vo = Be.Symbol, Ah = Be.Uint8Array, Py = Sh ? Sh.allocUnsafe : r, Ph = Ey(qr.getPrototypeOf, qr), My = qr.create, Iy = Oc.propertyIsEnumerable, Mh = wh.splice, Cy = Vo ? Vo.isConcatSpreadable : r, ef = Vo ? Vo.iterator : r, Na = Vo ? Vo.toStringTag : r, Ih = function() { + }(), Dh = zc.toString, iP = Rh.call(qr), sP = Er._, oP = ig( + "^" + Rh.call(Tr).replace(rt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" + ), Oh = fi ? Be.Buffer : r, Yo = Be.Symbol, Nh = Be.Uint8Array, jy = Oh ? Oh.allocUnsafe : r, Lh = $y(qr.getPrototypeOf, qr), Uy = qr.create, qy = zc.propertyIsEnumerable, kh = Ch.splice, zy = Yo ? Yo.isConcatSpreadable : r, cf = Yo ? Yo.iterator : r, ja = Yo ? Yo.toStringTag : r, $h = function() { try { - var c = Fa(qr, "defineProperty"); + var c = Ha(qr, "defineProperty"); return c({}, "", {}), c; } catch { } - }(), OA = Be.clearTimeout !== _r.clearTimeout && Be.clearTimeout, NA = It && It.now !== _r.Date.now && It.now, LA = Be.setTimeout !== _r.setTimeout && Be.setTimeout, Ch = xn.ceil, Th = xn.floor, Hp = qr.getOwnPropertySymbols, kA = Sh ? Sh.isBuffer : r, Ty = Be.isFinite, $A = wh.join, BA = Ey(qr.keys, qr), _n = xn.max, Kn = xn.min, FA = It.now, jA = Be.parseInt, Ry = xn.random, UA = wh.reverse, Kp = Fa(Be, "DataView"), tf = Fa(Be, "Map"), Vp = Fa(Be, "Promise"), Nc = Fa(Be, "Set"), rf = Fa(Be, "WeakMap"), nf = Fa(qr, "create"), Rh = rf && new rf(), Lc = {}, qA = ja(Kp), zA = ja(tf), WA = ja(Vp), HA = ja(Nc), KA = ja(rf), Dh = Vo ? Vo.prototype : r, sf = Dh ? Dh.valueOf : r, Dy = Dh ? Dh.toString : r; - function ee(c) { - if (en(c) && !ir(c) && !(c instanceof wr)) { - if (c instanceof qi) + }(), aP = Be.clearTimeout !== Er.clearTimeout && Be.clearTimeout, cP = It && It.now !== Er.Date.now && It.now, uP = Be.setTimeout !== Er.setTimeout && Be.setTimeout, Bh = _n.ceil, Fh = _n.floor, sg = qr.getOwnPropertySymbols, fP = Oh ? Oh.isBuffer : r, Wy = Be.isFinite, lP = Ch.join, hP = $y(qr.keys, qr), En = _n.max, Kn = _n.min, dP = It.now, pP = Be.parseInt, Hy = _n.random, gP = Ch.reverse, og = Ha(Be, "DataView"), uf = Ha(Be, "Map"), ag = Ha(Be, "Promise"), Wc = Ha(Be, "Set"), ff = Ha(Be, "WeakMap"), lf = Ha(qr, "create"), jh = ff && new ff(), Hc = {}, mP = Ka(og), vP = Ka(uf), bP = Ka(ag), yP = Ka(Wc), wP = Ka(ff), Uh = Yo ? Yo.prototype : r, hf = Uh ? Uh.valueOf : r, Ky = Uh ? Uh.toString : r; + function te(c) { + if (en(c) && !ir(c) && !(c instanceof xr)) { + if (c instanceof Wi) return c; if (Tr.call(c, "__wrapped__")) - return Ow(c); + return Vw(c); } - return new qi(c); + return new Wi(c); } - var kc = /* @__PURE__ */ function() { + var Kc = /* @__PURE__ */ function() { function c() { } return function(h) { if (!Zr(h)) return {}; - if (My) - return My(h); + if (Uy) + return Uy(h); c.prototype = h; var y = new c(); return c.prototype = r, y; }; }(); - function Oh() { + function qh() { } - function qi(c, h) { + function Wi(c, h) { this.__wrapped__ = c, this.__actions__ = [], this.__chain__ = !!h, this.__index__ = 0, this.__values__ = r; } - ee.templateSettings = { + te.templateSettings = { /** * Used to detect `data` property values to be HTML-escaped. * * @memberOf _.templateSettings * @type {RegExp} */ - escape: gt, + escape: mt, /** * Used to detect code to be evaluated. * @@ -21682,38 +22194,38 @@ h0.exports; * @memberOf _.templateSettings.imports * @type {Function} */ - _: ee + _: te } - }, ee.prototype = Oh.prototype, ee.prototype.constructor = ee, qi.prototype = kc(Oh.prototype), qi.prototype.constructor = qi; - function wr(c) { - this.__wrapped__ = c, this.__actions__ = [], this.__dir__ = 1, this.__filtered__ = !1, this.__iteratees__ = [], this.__takeCount__ = P, this.__views__ = []; + }, te.prototype = qh.prototype, te.prototype.constructor = te, Wi.prototype = Kc(qh.prototype), Wi.prototype.constructor = Wi; + function xr(c) { + this.__wrapped__ = c, this.__actions__ = [], this.__dir__ = 1, this.__filtered__ = !1, this.__iteratees__ = [], this.__takeCount__ = M, this.__views__ = []; } - function VA() { - var c = new wr(this.__wrapped__); - return c.__actions__ = fi(this.__actions__), c.__dir__ = this.__dir__, c.__filtered__ = this.__filtered__, c.__iteratees__ = fi(this.__iteratees__), c.__takeCount__ = this.__takeCount__, c.__views__ = fi(this.__views__), c; + function xP() { + var c = new xr(this.__wrapped__); + return c.__actions__ = li(this.__actions__), c.__dir__ = this.__dir__, c.__filtered__ = this.__filtered__, c.__iteratees__ = li(this.__iteratees__), c.__takeCount__ = this.__takeCount__, c.__views__ = li(this.__views__), c; } - function GA() { + function _P() { if (this.__filtered__) { - var c = new wr(this); + var c = new xr(this); c.__dir__ = -1, c.__filtered__ = !0; } else c = this.clone(), c.__dir__ *= -1; return c; } - function YA() { - var c = this.__wrapped__.value(), h = this.__dir__, y = ir(c), O = h < 0, z = y ? c.length : 0, ne = aM(0, z, this.__views__), fe = ne.start, me = ne.end, we = me - fe, We = O ? me : fe - 1, He = this.__iteratees__, Xe = He.length, wt = 0, Ot = Kn(we, this.__takeCount__); - if (!y || !O && z == we && Ot == we) - return rw(c, this.__actions__); + function EP() { + var c = this.__wrapped__.value(), h = this.__dir__, y = ir(c), N = h < 0, W = y ? c.length : 0, ne = LM(0, W, this.__views__), fe = ne.start, me = ne.end, we = me - fe, We = N ? me : fe - 1, He = this.__iteratees__, Xe = He.length, wt = 0, Ot = Kn(we, this.__takeCount__); + if (!y || !N && W == we && Ot == we) + return mw(c, this.__actions__); var Ht = []; e: for (; we-- && wt < Ot; ) { We += h; for (var fr = -1, Kt = c[We]; ++fr < Xe; ) { - var vr = He[fr], Er = vr.iteratee, Ci = vr.type, ii = Er(Kt); - if (Ci == g) - Kt = ii; - else if (!ii) { - if (Ci == f) + var br = He[fr], Sr = br.iteratee, Ti = br.type, si = Sr(Kt); + if (Ti == g) + Kt = si; + else if (!si) { + if (Ti == f) continue e; break e; } @@ -21722,360 +22234,360 @@ h0.exports; } return Ht; } - wr.prototype = kc(Oh.prototype), wr.prototype.constructor = wr; - function La(c) { + xr.prototype = Kc(qh.prototype), xr.prototype.constructor = xr; + function Ua(c) { var h = -1, y = c == null ? 0 : c.length; for (this.clear(); ++h < y; ) { - var O = c[h]; - this.set(O[0], O[1]); + var N = c[h]; + this.set(N[0], N[1]); } } - function JA() { - this.__data__ = nf ? nf(null) : {}, this.size = 0; + function SP() { + this.__data__ = lf ? lf(null) : {}, this.size = 0; } - function XA(c) { + function AP(c) { var h = this.has(c) && delete this.__data__[c]; return this.size -= h ? 1 : 0, h; } - function ZA(c) { + function PP(c) { var h = this.__data__; - if (nf) { + if (lf) { var y = h[c]; return y === u ? r : y; } return Tr.call(h, c) ? h[c] : r; } - function QA(c) { + function MP(c) { var h = this.__data__; - return nf ? h[c] !== r : Tr.call(h, c); + return lf ? h[c] !== r : Tr.call(h, c); } - function eP(c, h) { + function IP(c, h) { var y = this.__data__; - return this.size += this.has(c) ? 0 : 1, y[c] = nf && h === r ? u : h, this; + return this.size += this.has(c) ? 0 : 1, y[c] = lf && h === r ? u : h, this; } - La.prototype.clear = JA, La.prototype.delete = XA, La.prototype.get = ZA, La.prototype.has = QA, La.prototype.set = eP; - function so(c) { + Ua.prototype.clear = SP, Ua.prototype.delete = AP, Ua.prototype.get = PP, Ua.prototype.has = MP, Ua.prototype.set = IP; + function co(c) { var h = -1, y = c == null ? 0 : c.length; for (this.clear(); ++h < y; ) { - var O = c[h]; - this.set(O[0], O[1]); + var N = c[h]; + this.set(N[0], N[1]); } } - function tP() { + function CP() { this.__data__ = [], this.size = 0; } - function rP(c) { - var h = this.__data__, y = Nh(h, c); + function TP(c) { + var h = this.__data__, y = zh(h, c); if (y < 0) return !1; - var O = h.length - 1; - return y == O ? h.pop() : Mh.call(h, y, 1), --this.size, !0; + var N = h.length - 1; + return y == N ? h.pop() : kh.call(h, y, 1), --this.size, !0; } - function nP(c) { - var h = this.__data__, y = Nh(h, c); + function RP(c) { + var h = this.__data__, y = zh(h, c); return y < 0 ? r : h[y][1]; } - function iP(c) { - return Nh(this.__data__, c) > -1; + function DP(c) { + return zh(this.__data__, c) > -1; } - function sP(c, h) { - var y = this.__data__, O = Nh(y, c); - return O < 0 ? (++this.size, y.push([c, h])) : y[O][1] = h, this; + function OP(c, h) { + var y = this.__data__, N = zh(y, c); + return N < 0 ? (++this.size, y.push([c, h])) : y[N][1] = h, this; } - so.prototype.clear = tP, so.prototype.delete = rP, so.prototype.get = nP, so.prototype.has = iP, so.prototype.set = sP; - function oo(c) { + co.prototype.clear = CP, co.prototype.delete = TP, co.prototype.get = RP, co.prototype.has = DP, co.prototype.set = OP; + function uo(c) { var h = -1, y = c == null ? 0 : c.length; for (this.clear(); ++h < y; ) { - var O = c[h]; - this.set(O[0], O[1]); + var N = c[h]; + this.set(N[0], N[1]); } } - function oP() { + function NP() { this.size = 0, this.__data__ = { - hash: new La(), - map: new (tf || so)(), - string: new La() + hash: new Ua(), + map: new (uf || co)(), + string: new Ua() }; } - function aP(c) { - var h = Kh(this, c).delete(c); + function LP(c) { + var h = td(this, c).delete(c); return this.size -= h ? 1 : 0, h; } - function cP(c) { - return Kh(this, c).get(c); + function kP(c) { + return td(this, c).get(c); } - function uP(c) { - return Kh(this, c).has(c); + function $P(c) { + return td(this, c).has(c); } - function fP(c, h) { - var y = Kh(this, c), O = y.size; - return y.set(c, h), this.size += y.size == O ? 0 : 1, this; + function BP(c, h) { + var y = td(this, c), N = y.size; + return y.set(c, h), this.size += y.size == N ? 0 : 1, this; } - oo.prototype.clear = oP, oo.prototype.delete = aP, oo.prototype.get = cP, oo.prototype.has = uP, oo.prototype.set = fP; - function ka(c) { + uo.prototype.clear = NP, uo.prototype.delete = LP, uo.prototype.get = kP, uo.prototype.has = $P, uo.prototype.set = BP; + function qa(c) { var h = -1, y = c == null ? 0 : c.length; - for (this.__data__ = new oo(); ++h < y; ) + for (this.__data__ = new uo(); ++h < y; ) this.add(c[h]); } - function lP(c) { + function FP(c) { return this.__data__.set(c, u), this; } - function hP(c) { + function jP(c) { return this.__data__.has(c); } - ka.prototype.add = ka.prototype.push = lP, ka.prototype.has = hP; - function hs(c) { - var h = this.__data__ = new so(c); + qa.prototype.add = qa.prototype.push = FP, qa.prototype.has = jP; + function ps(c) { + var h = this.__data__ = new co(c); this.size = h.size; } - function dP() { - this.__data__ = new so(), this.size = 0; + function UP() { + this.__data__ = new co(), this.size = 0; } - function pP(c) { + function qP(c) { var h = this.__data__, y = h.delete(c); return this.size = h.size, y; } - function gP(c) { + function zP(c) { return this.__data__.get(c); } - function mP(c) { + function WP(c) { return this.__data__.has(c); } - function vP(c, h) { + function HP(c, h) { var y = this.__data__; - if (y instanceof so) { - var O = y.__data__; - if (!tf || O.length < i - 1) - return O.push([c, h]), this.size = ++y.size, this; - y = this.__data__ = new oo(O); + if (y instanceof co) { + var N = y.__data__; + if (!uf || N.length < i - 1) + return N.push([c, h]), this.size = ++y.size, this; + y = this.__data__ = new uo(N); } return y.set(c, h), this.size = y.size, this; } - hs.prototype.clear = dP, hs.prototype.delete = pP, hs.prototype.get = gP, hs.prototype.has = mP, hs.prototype.set = vP; - function Oy(c, h) { - var y = ir(c), O = !y && Ua(c), z = !y && !O && Zo(c), ne = !y && !O && !z && jc(c), fe = y || O || z || ne, me = fe ? Up(c.length, MA) : [], we = me.length; + ps.prototype.clear = UP, ps.prototype.delete = qP, ps.prototype.get = zP, ps.prototype.has = WP, ps.prototype.set = HP; + function Vy(c, h) { + var y = ir(c), N = !y && Va(c), W = !y && !N && ea(c), ne = !y && !N && !W && Jc(c), fe = y || N || W || ne, me = fe ? tg(c.length, tP) : [], we = me.length; for (var We in c) (h || Tr.call(c, We)) && !(fe && // Safari 9 has enumerable `arguments.length` in strict mode. (We == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. - z && (We == "offset" || We == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. + W && (We == "offset" || We == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. ne && (We == "buffer" || We == "byteLength" || We == "byteOffset") || // Skip index properties. - fo(We, we))) && me.push(We); + po(We, we))) && me.push(We); return me; } - function Ny(c) { + function Gy(c) { var h = c.length; - return h ? c[ig(0, h - 1)] : r; + return h ? c[bg(0, h - 1)] : r; } - function bP(c, h) { - return Vh(fi(c), $a(h, 0, c.length)); + function KP(c, h) { + return rd(li(c), za(h, 0, c.length)); } - function yP(c) { - return Vh(fi(c)); + function VP(c) { + return rd(li(c)); } - function Gp(c, h, y) { - (y !== r && !ds(c[h], y) || y === r && !(h in c)) && ao(c, h, y); + function cg(c, h, y) { + (y !== r && !gs(c[h], y) || y === r && !(h in c)) && fo(c, h, y); } - function of(c, h, y) { - var O = c[h]; - (!(Tr.call(c, h) && ds(O, y)) || y === r && !(h in c)) && ao(c, h, y); + function df(c, h, y) { + var N = c[h]; + (!(Tr.call(c, h) && gs(N, y)) || y === r && !(h in c)) && fo(c, h, y); } - function Nh(c, h) { + function zh(c, h) { for (var y = c.length; y--; ) - if (ds(c[y][0], h)) + if (gs(c[y][0], h)) return y; return -1; } - function wP(c, h, y, O) { - return Go(c, function(z, ne, fe) { - h(O, z, y(z), fe); - }), O; + function GP(c, h, y, N) { + return Jo(c, function(W, ne, fe) { + h(N, W, y(W), fe); + }), N; } - function Ly(c, h) { - return c && Ts(h, Mn(h), c); + function Yy(c, h) { + return c && Ns(h, Mn(h), c); } - function xP(c, h) { - return c && Ts(h, hi(h), c); + function YP(c, h) { + return c && Ns(h, di(h), c); } - function ao(c, h, y) { - h == "__proto__" && Ih ? Ih(c, h, { + function fo(c, h, y) { + h == "__proto__" && $h ? $h(c, h, { configurable: !0, enumerable: !0, value: y, writable: !0 }) : c[h] = y; } - function Yp(c, h) { - for (var y = -1, O = h.length, z = Ie(O), ne = c == null; ++y < O; ) - z[y] = ne ? r : Cg(c, h[y]); - return z; + function ug(c, h) { + for (var y = -1, N = h.length, W = Ie(N), ne = c == null; ++y < N; ) + W[y] = ne ? r : zg(c, h[y]); + return W; } - function $a(c, h, y) { + function za(c, h, y) { return c === c && (y !== r && (c = c <= y ? c : y), h !== r && (c = c >= h ? c : h)), c; } - function zi(c, h, y, O, z, ne) { - var fe, me = h & p, we = h & w, We = h & A; - if (y && (fe = z ? y(c, O, z, ne) : y(c)), fe !== r) + function Hi(c, h, y, N, W, ne) { + var fe, me = h & p, we = h & w, We = h & _; + if (y && (fe = W ? y(c, N, W, ne) : y(c)), fe !== r) return fe; if (!Zr(c)) return c; var He = ir(c); if (He) { - if (fe = uM(c), !me) - return fi(c, fe); + if (fe = $M(c), !me) + return li(c, fe); } else { var Xe = Vn(c), wt = Xe == re || Xe == pe; - if (Zo(c)) - return sw(c, me); - if (Xe == Pe || Xe == D || wt && !z) { - if (fe = we || wt ? {} : Sw(c), !me) - return we ? ZP(c, xP(fe, c)) : XP(c, Ly(fe, c)); + if (ea(c)) + return yw(c, me); + if (Xe == Pe || Xe == D || wt && !W) { + if (fe = we || wt ? {} : Bw(c), !me) + return we ? PM(c, YP(fe, c)) : AM(c, Yy(fe, c)); } else { if (!Dr[Xe]) - return z ? c : {}; - fe = fM(c, Xe, me); + return W ? c : {}; + fe = BM(c, Xe, me); } } - ne || (ne = new hs()); + ne || (ne = new ps()); var Ot = ne.get(c); if (Ot) return Ot; - ne.set(c, fe), Qw(c) ? c.forEach(function(Kt) { - fe.add(zi(Kt, h, y, Kt, c, ne)); - }) : Xw(c) && c.forEach(function(Kt, vr) { - fe.set(vr, zi(Kt, h, y, vr, c, ne)); + ne.set(c, fe), d2(c) ? c.forEach(function(Kt) { + fe.add(Hi(Kt, h, y, Kt, c, ne)); + }) : l2(c) && c.forEach(function(Kt, br) { + fe.set(br, Hi(Kt, h, y, br, c, ne)); }); - var Ht = We ? we ? gg : pg : we ? hi : Mn, fr = He ? r : Ht(c); - return ji(fr || c, function(Kt, vr) { - fr && (vr = Kt, Kt = c[vr]), of(fe, vr, zi(Kt, h, y, vr, c, ne)); + var Ht = We ? we ? Cg : Ig : we ? di : Mn, fr = He ? r : Ht(c); + return qi(fr || c, function(Kt, br) { + fr && (br = Kt, Kt = c[br]), df(fe, br, Hi(Kt, h, y, br, c, ne)); }), fe; } - function _P(c) { + function JP(c) { var h = Mn(c); return function(y) { - return ky(y, c, h); + return Jy(y, c, h); }; } - function ky(c, h, y) { - var O = y.length; + function Jy(c, h, y) { + var N = y.length; if (c == null) - return !O; - for (c = qr(c); O--; ) { - var z = y[O], ne = h[z], fe = c[z]; - if (fe === r && !(z in c) || !ne(fe)) + return !N; + for (c = qr(c); N--; ) { + var W = y[N], ne = h[W], fe = c[W]; + if (fe === r && !(W in c) || !ne(fe)) return !1; } return !0; } - function $y(c, h, y) { + function Xy(c, h, y) { if (typeof c != "function") - throw new Ui(o); - return df(function() { + throw new zi(o); + return wf(function() { c.apply(r, y); }, h); } - function af(c, h, y, O) { - var z = -1, ne = vh, fe = !0, me = c.length, we = [], We = h.length; + function pf(c, h, y, N) { + var W = -1, ne = Ph, fe = !0, me = c.length, we = [], We = h.length; if (!me) return we; - y && (h = Xr(h, Pi(y))), O ? (ne = Lp, fe = !1) : h.length >= i && (ne = Qu, fe = !1, h = new ka(h)); + y && (h = Xr(h, Mi(y))), N ? (ne = Yp, fe = !1) : h.length >= i && (ne = af, fe = !1, h = new qa(h)); e: - for (; ++z < me; ) { - var He = c[z], Xe = y == null ? He : y(He); - if (He = O || He !== 0 ? He : 0, fe && Xe === Xe) { + for (; ++W < me; ) { + var He = c[W], Xe = y == null ? He : y(He); + if (He = N || He !== 0 ? He : 0, fe && Xe === Xe) { for (var wt = We; wt--; ) if (h[wt] === Xe) continue e; we.push(He); - } else ne(h, Xe, O) || we.push(He); + } else ne(h, Xe, N) || we.push(He); } return we; } - var Go = fw(Cs), By = fw(Xp, !0); - function EP(c, h) { + var Jo = Sw(Os), Zy = Sw(lg, !0); + function XP(c, h) { var y = !0; - return Go(c, function(O, z, ne) { - return y = !!h(O, z, ne), y; + return Jo(c, function(N, W, ne) { + return y = !!h(N, W, ne), y; }), y; } - function Lh(c, h, y) { - for (var O = -1, z = c.length; ++O < z; ) { - var ne = c[O], fe = h(ne); - if (fe != null && (me === r ? fe === fe && !Ii(fe) : y(fe, me))) + function Wh(c, h, y) { + for (var N = -1, W = c.length; ++N < W; ) { + var ne = c[N], fe = h(ne); + if (fe != null && (me === r ? fe === fe && !Ci(fe) : y(fe, me))) var me = fe, we = ne; } return we; } - function SP(c, h, y, O) { - var z = c.length; - for (y = cr(y), y < 0 && (y = -y > z ? 0 : z + y), O = O === r || O > z ? z : cr(O), O < 0 && (O += z), O = y > O ? 0 : t2(O); y < O; ) + function ZP(c, h, y, N) { + var W = c.length; + for (y = cr(y), y < 0 && (y = -y > W ? 0 : W + y), N = N === r || N > W ? W : cr(N), N < 0 && (N += W), N = y > N ? 0 : g2(N); y < N; ) c[y++] = h; return c; } - function Fy(c, h) { + function Qy(c, h) { var y = []; - return Go(c, function(O, z, ne) { - h(O, z, ne) && y.push(O); + return Jo(c, function(N, W, ne) { + h(N, W, ne) && y.push(N); }), y; } - function Bn(c, h, y, O, z) { + function Bn(c, h, y, N, W) { var ne = -1, fe = c.length; - for (y || (y = hM), z || (z = []); ++ne < fe; ) { + for (y || (y = jM), W || (W = []); ++ne < fe; ) { var me = c[ne]; - h > 0 && y(me) ? h > 1 ? Bn(me, h - 1, y, O, z) : Ho(z, me) : O || (z[z.length] = me); + h > 0 && y(me) ? h > 1 ? Bn(me, h - 1, y, N, W) : Vo(W, me) : N || (W[W.length] = me); } - return z; + return W; } - var Jp = lw(), jy = lw(!0); - function Cs(c, h) { - return c && Jp(c, h, Mn); + var fg = Aw(), ew = Aw(!0); + function Os(c, h) { + return c && fg(c, h, Mn); } - function Xp(c, h) { - return c && jy(c, h, Mn); + function lg(c, h) { + return c && ew(c, h, Mn); } - function kh(c, h) { - return Wo(h, function(y) { - return lo(c[y]); + function Hh(c, h) { + return Ko(h, function(y) { + return go(c[y]); }); } - function Ba(c, h) { - h = Jo(h, c); - for (var y = 0, O = h.length; c != null && y < O; ) - c = c[Rs(h[y++])]; - return y && y == O ? c : r; + function Wa(c, h) { + h = Zo(h, c); + for (var y = 0, N = h.length; c != null && y < N; ) + c = c[Ls(h[y++])]; + return y && y == N ? c : r; } - function Uy(c, h, y) { - var O = h(c); - return ir(c) ? O : Ho(O, y(c)); + function tw(c, h, y) { + var N = h(c); + return ir(c) ? N : Vo(N, y(c)); } - function ri(c) { - return c == null ? c === r ? Le : ve : Na && Na in qr(c) ? oM(c) : yM(c); + function ni(c) { + return c == null ? c === r ? Le : ve : ja && ja in qr(c) ? NM(c) : VM(c); } - function Zp(c, h) { + function hg(c, h) { return c > h; } - function AP(c, h) { + function QP(c, h) { return c != null && Tr.call(c, h); } - function PP(c, h) { + function eM(c, h) { return c != null && h in qr(c); } - function MP(c, h, y) { - return c >= Kn(h, y) && c < _n(h, y); + function tM(c, h, y) { + return c >= Kn(h, y) && c < En(h, y); } - function Qp(c, h, y) { - for (var O = y ? Lp : vh, z = c[0].length, ne = c.length, fe = ne, me = Ie(ne), we = 1 / 0, We = []; fe--; ) { + function dg(c, h, y) { + for (var N = y ? Yp : Ph, W = c[0].length, ne = c.length, fe = ne, me = Ie(ne), we = 1 / 0, We = []; fe--; ) { var He = c[fe]; - fe && h && (He = Xr(He, Pi(h))), we = Kn(He.length, we), me[fe] = !y && (h || z >= 120 && He.length >= 120) ? new ka(fe && He) : r; + fe && h && (He = Xr(He, Mi(h))), we = Kn(He.length, we), me[fe] = !y && (h || W >= 120 && He.length >= 120) ? new qa(fe && He) : r; } He = c[0]; var Xe = -1, wt = me[0]; e: - for (; ++Xe < z && We.length < we; ) { + for (; ++Xe < W && We.length < we; ) { var Ot = He[Xe], Ht = h ? h(Ot) : Ot; - if (Ot = y || Ot !== 0 ? Ot : 0, !(wt ? Qu(wt, Ht) : O(We, Ht, y))) { + if (Ot = y || Ot !== 0 ? Ot : 0, !(wt ? af(wt, Ht) : N(We, Ht, y))) { for (fe = ne; --fe; ) { var fr = me[fe]; - if (!(fr ? Qu(fr, Ht) : O(c[fe], Ht, y))) + if (!(fr ? af(fr, Ht) : N(c[fe], Ht, y))) continue e; } wt && wt.push(Ht), We.push(Ot); @@ -22083,545 +22595,545 @@ h0.exports; } return We; } - function IP(c, h, y, O) { - return Cs(c, function(z, ne, fe) { - h(O, y(z), ne, fe); - }), O; + function rM(c, h, y, N) { + return Os(c, function(W, ne, fe) { + h(N, y(W), ne, fe); + }), N; } - function cf(c, h, y) { - h = Jo(h, c), c = Iw(c, h); - var O = c == null ? c : c[Rs(Hi(h))]; - return O == null ? r : Pn(O, c, y); + function gf(c, h, y) { + h = Zo(h, c), c = qw(c, h); + var N = c == null ? c : c[Ls(Vi(h))]; + return N == null ? r : Pn(N, c, y); } - function qy(c) { - return en(c) && ri(c) == D; + function rw(c) { + return en(c) && ni(c) == D; } - function CP(c) { - return en(c) && ri(c) == _e; + function nM(c) { + return en(c) && ni(c) == _e; } - function TP(c) { - return en(c) && ri(c) == Q; + function iM(c) { + return en(c) && ni(c) == ee; } - function uf(c, h, y, O, z) { - return c === h ? !0 : c == null || h == null || !en(c) && !en(h) ? c !== c && h !== h : RP(c, h, y, O, uf, z); + function mf(c, h, y, N, W) { + return c === h ? !0 : c == null || h == null || !en(c) && !en(h) ? c !== c && h !== h : sM(c, h, y, N, mf, W); } - function RP(c, h, y, O, z, ne) { + function sM(c, h, y, N, W, ne) { var fe = ir(c), me = ir(h), we = fe ? oe : Vn(c), We = me ? oe : Vn(h); we = we == D ? Pe : we, We = We == D ? Pe : We; var He = we == Pe, Xe = We == Pe, wt = we == We; - if (wt && Zo(c)) { - if (!Zo(h)) + if (wt && ea(c)) { + if (!ea(h)) return !1; fe = !0, He = !1; } if (wt && !He) - return ne || (ne = new hs()), fe || jc(c) ? xw(c, h, y, O, z, ne) : iM(c, h, we, y, O, z, ne); - if (!(y & M)) { + return ne || (ne = new ps()), fe || Jc(c) ? Lw(c, h, y, N, W, ne) : DM(c, h, we, y, N, W, ne); + if (!(y & P)) { var Ot = He && Tr.call(c, "__wrapped__"), Ht = Xe && Tr.call(h, "__wrapped__"); if (Ot || Ht) { var fr = Ot ? c.value() : c, Kt = Ht ? h.value() : h; - return ne || (ne = new hs()), z(fr, Kt, y, O, ne); + return ne || (ne = new ps()), W(fr, Kt, y, N, ne); } } - return wt ? (ne || (ne = new hs()), sM(c, h, y, O, z, ne)) : !1; + return wt ? (ne || (ne = new ps()), OM(c, h, y, N, W, ne)) : !1; } - function DP(c) { + function oM(c) { return en(c) && Vn(c) == ie; } - function eg(c, h, y, O) { - var z = y.length, ne = z, fe = !O; + function pg(c, h, y, N) { + var W = y.length, ne = W, fe = !N; if (c == null) return !ne; - for (c = qr(c); z--; ) { - var me = y[z]; + for (c = qr(c); W--; ) { + var me = y[W]; if (fe && me[2] ? me[1] !== c[me[0]] : !(me[0] in c)) return !1; } - for (; ++z < ne; ) { - me = y[z]; + for (; ++W < ne; ) { + me = y[W]; var we = me[0], We = c[we], He = me[1]; if (fe && me[2]) { if (We === r && !(we in c)) return !1; } else { - var Xe = new hs(); - if (O) - var wt = O(We, He, we, c, h, Xe); - if (!(wt === r ? uf(He, We, M | N, O, Xe) : wt)) + var Xe = new ps(); + if (N) + var wt = N(We, He, we, c, h, Xe); + if (!(wt === r ? mf(He, We, P | O, N, Xe) : wt)) return !1; } } return !0; } - function zy(c) { - if (!Zr(c) || pM(c)) + function nw(c) { + if (!Zr(c) || qM(c)) return !1; - var h = lo(c) ? DA : je; - return h.test(ja(c)); + var h = go(c) ? oP : je; + return h.test(Ka(c)); } - function OP(c) { - return en(c) && ri(c) == $e; + function aM(c) { + return en(c) && ni(c) == $e; } - function NP(c) { + function cM(c) { return en(c) && Vn(c) == Me; } - function LP(c) { - return en(c) && Qh(c.length) && !!Fr[ri(c)]; + function uM(c) { + return en(c) && cd(c.length) && !!Fr[ni(c)]; } - function Wy(c) { - return typeof c == "function" ? c : c == null ? di : typeof c == "object" ? ir(c) ? Vy(c[0], c[1]) : Ky(c) : h2(c); + function iw(c) { + return typeof c == "function" ? c : c == null ? pi : typeof c == "object" ? ir(c) ? aw(c[0], c[1]) : ow(c) : P2(c); } - function tg(c) { - if (!hf(c)) - return BA(c); + function gg(c) { + if (!yf(c)) + return hP(c); var h = []; for (var y in qr(c)) Tr.call(c, y) && y != "constructor" && h.push(y); return h; } - function kP(c) { + function fM(c) { if (!Zr(c)) - return bM(c); - var h = hf(c), y = []; - for (var O in c) - O == "constructor" && (h || !Tr.call(c, O)) || y.push(O); + return KM(c); + var h = yf(c), y = []; + for (var N in c) + N == "constructor" && (h || !Tr.call(c, N)) || y.push(N); return y; } - function rg(c, h) { + function mg(c, h) { return c < h; } - function Hy(c, h) { - var y = -1, O = li(c) ? Ie(c.length) : []; - return Go(c, function(z, ne, fe) { - O[++y] = h(z, ne, fe); - }), O; - } - function Ky(c) { - var h = vg(c); - return h.length == 1 && h[0][2] ? Pw(h[0][0], h[0][1]) : function(y) { - return y === c || eg(y, c, h); + function sw(c, h) { + var y = -1, N = hi(c) ? Ie(c.length) : []; + return Jo(c, function(W, ne, fe) { + N[++y] = h(W, ne, fe); + }), N; + } + function ow(c) { + var h = Rg(c); + return h.length == 1 && h[0][2] ? jw(h[0][0], h[0][1]) : function(y) { + return y === c || pg(y, c, h); }; } - function Vy(c, h) { - return yg(c) && Aw(h) ? Pw(Rs(c), h) : function(y) { - var O = Cg(y, c); - return O === r && O === h ? Tg(y, c) : uf(h, O, M | N); + function aw(c, h) { + return Og(c) && Fw(h) ? jw(Ls(c), h) : function(y) { + var N = zg(y, c); + return N === r && N === h ? Wg(y, c) : mf(h, N, P | O); }; } - function $h(c, h, y, O, z) { - c !== h && Jp(h, function(ne, fe) { - if (z || (z = new hs()), Zr(ne)) - $P(c, h, fe, y, $h, O, z); + function Kh(c, h, y, N, W) { + c !== h && fg(h, function(ne, fe) { + if (W || (W = new ps()), Zr(ne)) + lM(c, h, fe, y, Kh, N, W); else { - var me = O ? O(xg(c, fe), ne, fe + "", c, h, z) : r; - me === r && (me = ne), Gp(c, fe, me); + var me = N ? N(Lg(c, fe), ne, fe + "", c, h, W) : r; + me === r && (me = ne), cg(c, fe, me); } - }, hi); + }, di); } - function $P(c, h, y, O, z, ne, fe) { - var me = xg(c, y), we = xg(h, y), We = fe.get(we); + function lM(c, h, y, N, W, ne, fe) { + var me = Lg(c, y), we = Lg(h, y), We = fe.get(we); if (We) { - Gp(c, y, We); + cg(c, y, We); return; } var He = ne ? ne(me, we, y + "", c, h, fe) : r, Xe = He === r; if (Xe) { - var wt = ir(we), Ot = !wt && Zo(we), Ht = !wt && !Ot && jc(we); - He = we, wt || Ot || Ht ? ir(me) ? He = me : cn(me) ? He = fi(me) : Ot ? (Xe = !1, He = sw(we, !0)) : Ht ? (Xe = !1, He = ow(we, !0)) : He = [] : pf(we) || Ua(we) ? (He = me, Ua(me) ? He = r2(me) : (!Zr(me) || lo(me)) && (He = Sw(we))) : Xe = !1; + var wt = ir(we), Ot = !wt && ea(we), Ht = !wt && !Ot && Jc(we); + He = we, wt || Ot || Ht ? ir(me) ? He = me : cn(me) ? He = li(me) : Ot ? (Xe = !1, He = yw(we, !0)) : Ht ? (Xe = !1, He = ww(we, !0)) : He = [] : xf(we) || Va(we) ? (He = me, Va(me) ? He = m2(me) : (!Zr(me) || go(me)) && (He = Bw(we))) : Xe = !1; } - Xe && (fe.set(we, He), z(He, we, O, ne, fe), fe.delete(we)), Gp(c, y, He); + Xe && (fe.set(we, He), W(He, we, N, ne, fe), fe.delete(we)), cg(c, y, He); } - function Gy(c, h) { + function cw(c, h) { var y = c.length; if (y) - return h += h < 0 ? y : 0, fo(h, y) ? c[h] : r; + return h += h < 0 ? y : 0, po(h, y) ? c[h] : r; } - function Yy(c, h, y) { + function uw(c, h, y) { h.length ? h = Xr(h, function(ne) { return ir(ne) ? function(fe) { - return Ba(fe, ne.length === 1 ? ne[0] : ne); + return Wa(fe, ne.length === 1 ? ne[0] : ne); } : ne; - }) : h = [di]; - var O = -1; - h = Xr(h, Pi(Ut())); - var z = Hy(c, function(ne, fe, me) { + }) : h = [pi]; + var N = -1; + h = Xr(h, Mi(Ut())); + var W = sw(c, function(ne, fe, me) { var we = Xr(h, function(We) { return We(ne); }); - return { criteria: we, index: ++O, value: ne }; + return { criteria: we, index: ++N, value: ne }; }); - return fA(z, function(ne, fe) { - return JP(ne, fe, y); + return BA(W, function(ne, fe) { + return SM(ne, fe, y); }); } - function BP(c, h) { - return Jy(c, h, function(y, O) { - return Tg(c, O); + function hM(c, h) { + return fw(c, h, function(y, N) { + return Wg(c, N); }); } - function Jy(c, h, y) { - for (var O = -1, z = h.length, ne = {}; ++O < z; ) { - var fe = h[O], me = Ba(c, fe); - y(me, fe) && ff(ne, Jo(fe, c), me); + function fw(c, h, y) { + for (var N = -1, W = h.length, ne = {}; ++N < W; ) { + var fe = h[N], me = Wa(c, fe); + y(me, fe) && vf(ne, Zo(fe, c), me); } return ne; } - function FP(c) { + function dM(c) { return function(h) { - return Ba(h, c); + return Wa(h, c); }; } - function ng(c, h, y, O) { - var z = O ? uA : Cc, ne = -1, fe = h.length, me = c; - for (c === h && (h = fi(h)), y && (me = Xr(c, Pi(y))); ++ne < fe; ) - for (var we = 0, We = h[ne], He = y ? y(We) : We; (we = z(me, He, we, O)) > -1; ) - me !== c && Mh.call(me, we, 1), Mh.call(c, we, 1); + function vg(c, h, y, N) { + var W = N ? $A : Fc, ne = -1, fe = h.length, me = c; + for (c === h && (h = li(h)), y && (me = Xr(c, Mi(y))); ++ne < fe; ) + for (var we = 0, We = h[ne], He = y ? y(We) : We; (we = W(me, He, we, N)) > -1; ) + me !== c && kh.call(me, we, 1), kh.call(c, we, 1); return c; } - function Xy(c, h) { - for (var y = c ? h.length : 0, O = y - 1; y--; ) { - var z = h[y]; - if (y == O || z !== ne) { - var ne = z; - fo(z) ? Mh.call(c, z, 1) : ag(c, z); + function lw(c, h) { + for (var y = c ? h.length : 0, N = y - 1; y--; ) { + var W = h[y]; + if (y == N || W !== ne) { + var ne = W; + po(W) ? kh.call(c, W, 1) : xg(c, W); } } return c; } - function ig(c, h) { - return c + Th(Ry() * (h - c + 1)); + function bg(c, h) { + return c + Fh(Hy() * (h - c + 1)); } - function jP(c, h, y, O) { - for (var z = -1, ne = _n(Ch((h - c) / (y || 1)), 0), fe = Ie(ne); ne--; ) - fe[O ? ne : ++z] = c, c += y; + function pM(c, h, y, N) { + for (var W = -1, ne = En(Bh((h - c) / (y || 1)), 0), fe = Ie(ne); ne--; ) + fe[N ? ne : ++W] = c, c += y; return fe; } - function sg(c, h) { + function yg(c, h) { var y = ""; - if (!c || h < 1 || h > _) + if (!c || h < 1 || h > E) return y; do - h % 2 && (y += c), h = Th(h / 2), h && (c += c); + h % 2 && (y += c), h = Fh(h / 2), h && (c += c); while (h); return y; } function hr(c, h) { - return _g(Mw(c, h, di), c + ""); + return kg(Uw(c, h, pi), c + ""); } - function UP(c) { - return Ny(Uc(c)); + function gM(c) { + return Gy(Xc(c)); } - function qP(c, h) { - var y = Uc(c); - return Vh(y, $a(h, 0, y.length)); + function mM(c, h) { + var y = Xc(c); + return rd(y, za(h, 0, y.length)); } - function ff(c, h, y, O) { + function vf(c, h, y, N) { if (!Zr(c)) return c; - h = Jo(h, c); - for (var z = -1, ne = h.length, fe = ne - 1, me = c; me != null && ++z < ne; ) { - var we = Rs(h[z]), We = y; + h = Zo(h, c); + for (var W = -1, ne = h.length, fe = ne - 1, me = c; me != null && ++W < ne; ) { + var we = Ls(h[W]), We = y; if (we === "__proto__" || we === "constructor" || we === "prototype") return c; - if (z != fe) { + if (W != fe) { var He = me[we]; - We = O ? O(He, we, me) : r, We === r && (We = Zr(He) ? He : fo(h[z + 1]) ? [] : {}); + We = N ? N(He, we, me) : r, We === r && (We = Zr(He) ? He : po(h[W + 1]) ? [] : {}); } - of(me, we, We), me = me[we]; + df(me, we, We), me = me[we]; } return c; } - var Zy = Rh ? function(c, h) { - return Rh.set(c, h), c; - } : di, zP = Ih ? function(c, h) { - return Ih(c, "toString", { + var hw = jh ? function(c, h) { + return jh.set(c, h), c; + } : pi, vM = $h ? function(c, h) { + return $h(c, "toString", { configurable: !0, enumerable: !1, - value: Dg(h), + value: Kg(h), writable: !0 }); - } : di; - function WP(c) { - return Vh(Uc(c)); + } : pi; + function bM(c) { + return rd(Xc(c)); } - function Wi(c, h, y) { - var O = -1, z = c.length; - h < 0 && (h = -h > z ? 0 : z + h), y = y > z ? z : y, y < 0 && (y += z), z = h > y ? 0 : y - h >>> 0, h >>>= 0; - for (var ne = Ie(z); ++O < z; ) - ne[O] = c[O + h]; + function Ki(c, h, y) { + var N = -1, W = c.length; + h < 0 && (h = -h > W ? 0 : W + h), y = y > W ? W : y, y < 0 && (y += W), W = h > y ? 0 : y - h >>> 0, h >>>= 0; + for (var ne = Ie(W); ++N < W; ) + ne[N] = c[N + h]; return ne; } - function HP(c, h) { + function yM(c, h) { var y; - return Go(c, function(O, z, ne) { - return y = h(O, z, ne), !y; + return Jo(c, function(N, W, ne) { + return y = h(N, W, ne), !y; }), !!y; } - function Bh(c, h, y) { - var O = 0, z = c == null ? O : c.length; - if (typeof h == "number" && h === h && z <= F) { - for (; O < z; ) { - var ne = O + z >>> 1, fe = c[ne]; - fe !== null && !Ii(fe) && (y ? fe <= h : fe < h) ? O = ne + 1 : z = ne; + function Vh(c, h, y) { + var N = 0, W = c == null ? N : c.length; + if (typeof h == "number" && h === h && W <= F) { + for (; N < W; ) { + var ne = N + W >>> 1, fe = c[ne]; + fe !== null && !Ci(fe) && (y ? fe <= h : fe < h) ? N = ne + 1 : W = ne; } - return z; + return W; } - return og(c, h, di, y); + return wg(c, h, pi, y); } - function og(c, h, y, O) { - var z = 0, ne = c == null ? 0 : c.length; + function wg(c, h, y, N) { + var W = 0, ne = c == null ? 0 : c.length; if (ne === 0) return 0; h = y(h); - for (var fe = h !== h, me = h === null, we = Ii(h), We = h === r; z < ne; ) { - var He = Th((z + ne) / 2), Xe = y(c[He]), wt = Xe !== r, Ot = Xe === null, Ht = Xe === Xe, fr = Ii(Xe); + for (var fe = h !== h, me = h === null, we = Ci(h), We = h === r; W < ne; ) { + var He = Fh((W + ne) / 2), Xe = y(c[He]), wt = Xe !== r, Ot = Xe === null, Ht = Xe === Xe, fr = Ci(Xe); if (fe) - var Kt = O || Ht; - else We ? Kt = Ht && (O || wt) : me ? Kt = Ht && wt && (O || !Ot) : we ? Kt = Ht && wt && !Ot && (O || !fr) : Ot || fr ? Kt = !1 : Kt = O ? Xe <= h : Xe < h; - Kt ? z = He + 1 : ne = He; + var Kt = N || Ht; + else We ? Kt = Ht && (N || wt) : me ? Kt = Ht && wt && (N || !Ot) : we ? Kt = Ht && wt && !Ot && (N || !fr) : Ot || fr ? Kt = !1 : Kt = N ? Xe <= h : Xe < h; + Kt ? W = He + 1 : ne = He; } return Kn(ne, I); } - function Qy(c, h) { - for (var y = -1, O = c.length, z = 0, ne = []; ++y < O; ) { + function dw(c, h) { + for (var y = -1, N = c.length, W = 0, ne = []; ++y < N; ) { var fe = c[y], me = h ? h(fe) : fe; - if (!y || !ds(me, we)) { + if (!y || !gs(me, we)) { var we = me; - ne[z++] = fe === 0 ? 0 : fe; + ne[W++] = fe === 0 ? 0 : fe; } } return ne; } - function ew(c) { - return typeof c == "number" ? c : Ii(c) ? v : +c; + function pw(c) { + return typeof c == "number" ? c : Ci(c) ? v : +c; } - function Mi(c) { + function Ii(c) { if (typeof c == "string") return c; if (ir(c)) - return Xr(c, Mi) + ""; - if (Ii(c)) - return Dy ? Dy.call(c) : ""; + return Xr(c, Ii) + ""; + if (Ci(c)) + return Ky ? Ky.call(c) : ""; var h = c + ""; return h == "0" && 1 / c == -x ? "-0" : h; } - function Yo(c, h, y) { - var O = -1, z = vh, ne = c.length, fe = !0, me = [], we = me; + function Xo(c, h, y) { + var N = -1, W = Ph, ne = c.length, fe = !0, me = [], we = me; if (y) - fe = !1, z = Lp; + fe = !1, W = Yp; else if (ne >= i) { - var We = h ? null : rM(c); + var We = h ? null : TM(c); if (We) - return yh(We); - fe = !1, z = Qu, we = new ka(); + return Ih(We); + fe = !1, W = af, we = new qa(); } else we = h ? [] : me; e: - for (; ++O < ne; ) { - var He = c[O], Xe = h ? h(He) : He; + for (; ++N < ne; ) { + var He = c[N], Xe = h ? h(He) : He; if (He = y || He !== 0 ? He : 0, fe && Xe === Xe) { for (var wt = we.length; wt--; ) if (we[wt] === Xe) continue e; h && we.push(Xe), me.push(He); - } else z(we, Xe, y) || (we !== me && we.push(Xe), me.push(He)); + } else W(we, Xe, y) || (we !== me && we.push(Xe), me.push(He)); } return me; } - function ag(c, h) { - return h = Jo(h, c), c = Iw(c, h), c == null || delete c[Rs(Hi(h))]; + function xg(c, h) { + return h = Zo(h, c), c = qw(c, h), c == null || delete c[Ls(Vi(h))]; } - function tw(c, h, y, O) { - return ff(c, h, y(Ba(c, h)), O); + function gw(c, h, y, N) { + return vf(c, h, y(Wa(c, h)), N); } - function Fh(c, h, y, O) { - for (var z = c.length, ne = O ? z : -1; (O ? ne-- : ++ne < z) && h(c[ne], ne, c); ) + function Gh(c, h, y, N) { + for (var W = c.length, ne = N ? W : -1; (N ? ne-- : ++ne < W) && h(c[ne], ne, c); ) ; - return y ? Wi(c, O ? 0 : ne, O ? ne + 1 : z) : Wi(c, O ? ne + 1 : 0, O ? z : ne); + return y ? Ki(c, N ? 0 : ne, N ? ne + 1 : W) : Ki(c, N ? ne + 1 : 0, N ? W : ne); } - function rw(c, h) { + function mw(c, h) { var y = c; - return y instanceof wr && (y = y.value()), kp(h, function(O, z) { - return z.func.apply(z.thisArg, Ho([O], z.args)); + return y instanceof xr && (y = y.value()), Jp(h, function(N, W) { + return W.func.apply(W.thisArg, Vo([N], W.args)); }, y); } - function cg(c, h, y) { - var O = c.length; - if (O < 2) - return O ? Yo(c[0]) : []; - for (var z = -1, ne = Ie(O); ++z < O; ) - for (var fe = c[z], me = -1; ++me < O; ) - me != z && (ne[z] = af(ne[z] || fe, c[me], h, y)); - return Yo(Bn(ne, 1), h, y); - } - function nw(c, h, y) { - for (var O = -1, z = c.length, ne = h.length, fe = {}; ++O < z; ) { - var me = O < ne ? h[O] : r; - y(fe, c[O], me); + function _g(c, h, y) { + var N = c.length; + if (N < 2) + return N ? Xo(c[0]) : []; + for (var W = -1, ne = Ie(N); ++W < N; ) + for (var fe = c[W], me = -1; ++me < N; ) + me != W && (ne[W] = pf(ne[W] || fe, c[me], h, y)); + return Xo(Bn(ne, 1), h, y); + } + function vw(c, h, y) { + for (var N = -1, W = c.length, ne = h.length, fe = {}; ++N < W; ) { + var me = N < ne ? h[N] : r; + y(fe, c[N], me); } return fe; } - function ug(c) { + function Eg(c) { return cn(c) ? c : []; } - function fg(c) { - return typeof c == "function" ? c : di; + function Sg(c) { + return typeof c == "function" ? c : pi; } - function Jo(c, h) { - return ir(c) ? c : yg(c, h) ? [c] : Dw(Cr(c)); + function Zo(c, h) { + return ir(c) ? c : Og(c, h) ? [c] : Kw(Cr(c)); } - var KP = hr; - function Xo(c, h, y) { - var O = c.length; - return y = y === r ? O : y, !h && y >= O ? c : Wi(c, h, y); + var wM = hr; + function Qo(c, h, y) { + var N = c.length; + return y = y === r ? N : y, !h && y >= N ? c : Ki(c, h, y); } - var iw = OA || function(c) { - return _r.clearTimeout(c); + var bw = aP || function(c) { + return Er.clearTimeout(c); }; - function sw(c, h) { + function yw(c, h) { if (h) return c.slice(); - var y = c.length, O = Py ? Py(y) : new c.constructor(y); - return c.copy(O), O; + var y = c.length, N = jy ? jy(y) : new c.constructor(y); + return c.copy(N), N; } - function lg(c) { + function Ag(c) { var h = new c.constructor(c.byteLength); - return new Ah(h).set(new Ah(c)), h; + return new Nh(h).set(new Nh(c)), h; } - function VP(c, h) { - var y = h ? lg(c.buffer) : c.buffer; + function xM(c, h) { + var y = h ? Ag(c.buffer) : c.buffer; return new c.constructor(y, c.byteOffset, c.byteLength); } - function GP(c) { + function _M(c) { var h = new c.constructor(c.source, Te.exec(c)); return h.lastIndex = c.lastIndex, h; } - function YP(c) { - return sf ? qr(sf.call(c)) : {}; + function EM(c) { + return hf ? qr(hf.call(c)) : {}; } - function ow(c, h) { - var y = h ? lg(c.buffer) : c.buffer; + function ww(c, h) { + var y = h ? Ag(c.buffer) : c.buffer; return new c.constructor(y, c.byteOffset, c.length); } - function aw(c, h) { + function xw(c, h) { if (c !== h) { - var y = c !== r, O = c === null, z = c === c, ne = Ii(c), fe = h !== r, me = h === null, we = h === h, We = Ii(h); - if (!me && !We && !ne && c > h || ne && fe && we && !me && !We || O && fe && we || !y && we || !z) + var y = c !== r, N = c === null, W = c === c, ne = Ci(c), fe = h !== r, me = h === null, we = h === h, We = Ci(h); + if (!me && !We && !ne && c > h || ne && fe && we && !me && !We || N && fe && we || !y && we || !W) return 1; - if (!O && !ne && !We && c < h || We && y && z && !O && !ne || me && y && z || !fe && z || !we) + if (!N && !ne && !We && c < h || We && y && W && !N && !ne || me && y && W || !fe && W || !we) return -1; } return 0; } - function JP(c, h, y) { - for (var O = -1, z = c.criteria, ne = h.criteria, fe = z.length, me = y.length; ++O < fe; ) { - var we = aw(z[O], ne[O]); + function SM(c, h, y) { + for (var N = -1, W = c.criteria, ne = h.criteria, fe = W.length, me = y.length; ++N < fe; ) { + var we = xw(W[N], ne[N]); if (we) { - if (O >= me) + if (N >= me) return we; - var We = y[O]; + var We = y[N]; return we * (We == "desc" ? -1 : 1); } } return c.index - h.index; } - function cw(c, h, y, O) { - for (var z = -1, ne = c.length, fe = y.length, me = -1, we = h.length, We = _n(ne - fe, 0), He = Ie(we + We), Xe = !O; ++me < we; ) + function _w(c, h, y, N) { + for (var W = -1, ne = c.length, fe = y.length, me = -1, we = h.length, We = En(ne - fe, 0), He = Ie(we + We), Xe = !N; ++me < we; ) He[me] = h[me]; - for (; ++z < fe; ) - (Xe || z < ne) && (He[y[z]] = c[z]); + for (; ++W < fe; ) + (Xe || W < ne) && (He[y[W]] = c[W]); for (; We--; ) - He[me++] = c[z++]; + He[me++] = c[W++]; return He; } - function uw(c, h, y, O) { - for (var z = -1, ne = c.length, fe = -1, me = y.length, we = -1, We = h.length, He = _n(ne - me, 0), Xe = Ie(He + We), wt = !O; ++z < He; ) - Xe[z] = c[z]; - for (var Ot = z; ++we < We; ) + function Ew(c, h, y, N) { + for (var W = -1, ne = c.length, fe = -1, me = y.length, we = -1, We = h.length, He = En(ne - me, 0), Xe = Ie(He + We), wt = !N; ++W < He; ) + Xe[W] = c[W]; + for (var Ot = W; ++we < We; ) Xe[Ot + we] = h[we]; for (; ++fe < me; ) - (wt || z < ne) && (Xe[Ot + y[fe]] = c[z++]); + (wt || W < ne) && (Xe[Ot + y[fe]] = c[W++]); return Xe; } - function fi(c, h) { - var y = -1, O = c.length; - for (h || (h = Ie(O)); ++y < O; ) + function li(c, h) { + var y = -1, N = c.length; + for (h || (h = Ie(N)); ++y < N; ) h[y] = c[y]; return h; } - function Ts(c, h, y, O) { - var z = !y; + function Ns(c, h, y, N) { + var W = !y; y || (y = {}); for (var ne = -1, fe = h.length; ++ne < fe; ) { - var me = h[ne], we = O ? O(y[me], c[me], me, y, c) : r; - we === r && (we = c[me]), z ? ao(y, me, we) : of(y, me, we); + var me = h[ne], we = N ? N(y[me], c[me], me, y, c) : r; + we === r && (we = c[me]), W ? fo(y, me, we) : df(y, me, we); } return y; } - function XP(c, h) { - return Ts(c, bg(c), h); + function AM(c, h) { + return Ns(c, Dg(c), h); } - function ZP(c, h) { - return Ts(c, _w(c), h); + function PM(c, h) { + return Ns(c, kw(c), h); } - function jh(c, h) { - return function(y, O) { - var z = ir(y) ? nA : wP, ne = h ? h() : {}; - return z(y, c, Ut(O, 2), ne); + function Yh(c, h) { + return function(y, N) { + var W = ir(y) ? RA : GP, ne = h ? h() : {}; + return W(y, c, Ut(N, 2), ne); }; } - function $c(c) { + function Vc(c) { return hr(function(h, y) { - var O = -1, z = y.length, ne = z > 1 ? y[z - 1] : r, fe = z > 2 ? y[2] : r; - for (ne = c.length > 3 && typeof ne == "function" ? (z--, ne) : r, fe && ni(y[0], y[1], fe) && (ne = z < 3 ? r : ne, z = 1), h = qr(h); ++O < z; ) { - var me = y[O]; - me && c(h, me, O, ne); + var N = -1, W = y.length, ne = W > 1 ? y[W - 1] : r, fe = W > 2 ? y[2] : r; + for (ne = c.length > 3 && typeof ne == "function" ? (W--, ne) : r, fe && ii(y[0], y[1], fe) && (ne = W < 3 ? r : ne, W = 1), h = qr(h); ++N < W; ) { + var me = y[N]; + me && c(h, me, N, ne); } return h; }); } - function fw(c, h) { - return function(y, O) { + function Sw(c, h) { + return function(y, N) { if (y == null) return y; - if (!li(y)) - return c(y, O); - for (var z = y.length, ne = h ? z : -1, fe = qr(y); (h ? ne-- : ++ne < z) && O(fe[ne], ne, fe) !== !1; ) + if (!hi(y)) + return c(y, N); + for (var W = y.length, ne = h ? W : -1, fe = qr(y); (h ? ne-- : ++ne < W) && N(fe[ne], ne, fe) !== !1; ) ; return y; }; } - function lw(c) { - return function(h, y, O) { - for (var z = -1, ne = qr(h), fe = O(h), me = fe.length; me--; ) { - var we = fe[c ? me : ++z]; + function Aw(c) { + return function(h, y, N) { + for (var W = -1, ne = qr(h), fe = N(h), me = fe.length; me--; ) { + var we = fe[c ? me : ++W]; if (y(ne[we], we, ne) === !1) break; } return h; }; } - function QP(c, h, y) { - var O = h & L, z = lf(c); + function MM(c, h, y) { + var N = h & L, W = bf(c); function ne() { - var fe = this && this !== _r && this instanceof ne ? z : c; - return fe.apply(O ? y : this, arguments); + var fe = this && this !== Er && this instanceof ne ? W : c; + return fe.apply(N ? y : this, arguments); } return ne; } - function hw(c) { + function Pw(c) { return function(h) { h = Cr(h); - var y = Tc(h) ? ls(h) : r, O = y ? y[0] : h.charAt(0), z = y ? Xo(y, 1).join("") : h.slice(1); - return O[c]() + z; + var y = jc(h) ? ds(h) : r, N = y ? y[0] : h.charAt(0), W = y ? Qo(y, 1).join("") : h.slice(1); + return N[c]() + W; }; } - function Bc(c) { + function Gc(c) { return function(h) { - return kp(f2(u2(h).replace(Xu, "")), c, ""); + return Jp(S2(E2(h).replace(sf, "")), c, ""); }; } - function lf(c) { + function bf(c) { return function() { var h = arguments; switch (h.length) { @@ -22642,22 +23154,22 @@ h0.exports; case 7: return new c(h[0], h[1], h[2], h[3], h[4], h[5], h[6]); } - var y = kc(c.prototype), O = c.apply(y, h); - return Zr(O) ? O : y; + var y = Kc(c.prototype), N = c.apply(y, h); + return Zr(N) ? N : y; }; } - function eM(c, h, y) { - var O = lf(c); - function z() { - for (var ne = arguments.length, fe = Ie(ne), me = ne, we = Fc(z); me--; ) + function IM(c, h, y) { + var N = bf(c); + function W() { + for (var ne = arguments.length, fe = Ie(ne), me = ne, we = Yc(W); me--; ) fe[me] = arguments[me]; - var We = ne < 3 && fe[0] !== we && fe[ne - 1] !== we ? [] : Ko(fe, we); + var We = ne < 3 && fe[0] !== we && fe[ne - 1] !== we ? [] : Go(fe, we); if (ne -= We.length, ne < y) - return vw( + return Rw( c, h, - Uh, - z.placeholder, + Jh, + W.placeholder, r, fe, We, @@ -22665,38 +23177,38 @@ h0.exports; r, y - ne ); - var He = this && this !== _r && this instanceof z ? O : c; + var He = this && this !== Er && this instanceof W ? N : c; return Pn(He, this, fe); } - return z; + return W; } - function dw(c) { - return function(h, y, O) { - var z = qr(h); - if (!li(h)) { + function Mw(c) { + return function(h, y, N) { + var W = qr(h); + if (!hi(h)) { var ne = Ut(y, 3); h = Mn(h), y = function(me) { - return ne(z[me], me, z); + return ne(W[me], me, W); }; } - var fe = c(h, y, O); - return fe > -1 ? z[ne ? h[fe] : fe] : r; + var fe = c(h, y, N); + return fe > -1 ? W[ne ? h[fe] : fe] : r; }; } - function pw(c) { - return uo(function(h) { - var y = h.length, O = y, z = qi.prototype.thru; - for (c && h.reverse(); O--; ) { - var ne = h[O]; + function Iw(c) { + return ho(function(h) { + var y = h.length, N = y, W = Wi.prototype.thru; + for (c && h.reverse(); N--; ) { + var ne = h[N]; if (typeof ne != "function") - throw new Ui(o); - if (z && !fe && Hh(ne) == "wrapper") - var fe = new qi([], !0); + throw new zi(o); + if (W && !fe && ed(ne) == "wrapper") + var fe = new Wi([], !0); } - for (O = fe ? O : y; ++O < y; ) { - ne = h[O]; - var me = Hh(ne), we = me == "wrapper" ? mg(ne) : r; - we && wg(we[0]) && we[1] == (R | H | V | K) && !we[4].length && we[9] == 1 ? fe = fe[Hh(we[0])].apply(fe, we[3]) : fe = ne.length == 1 && wg(ne) ? fe[me]() : fe.thru(ne); + for (N = fe ? N : y; ++N < y; ) { + ne = h[N]; + var me = ed(ne), we = me == "wrapper" ? Tg(ne) : r; + we && Ng(we[0]) && we[1] == (R | q | V | K) && !we[4].length && we[9] == 1 ? fe = fe[ed(we[0])].apply(fe, we[3]) : fe = ne.length == 1 && Ng(ne) ? fe[me]() : fe.thru(ne); } return function() { var We = arguments, He = We[0]; @@ -22708,97 +23220,97 @@ h0.exports; }; }); } - function Uh(c, h, y, O, z, ne, fe, me, we, We) { - var He = h & R, Xe = h & L, wt = h & B, Ot = h & (H | U), Ht = h & ge, fr = wt ? r : lf(c); + function Jh(c, h, y, N, W, ne, fe, me, we, We) { + var He = h & R, Xe = h & L, wt = h & B, Ot = h & (q | U), Ht = h & ge, fr = wt ? r : bf(c); function Kt() { - for (var vr = arguments.length, Er = Ie(vr), Ci = vr; Ci--; ) - Er[Ci] = arguments[Ci]; + for (var br = arguments.length, Sr = Ie(br), Ti = br; Ti--; ) + Sr[Ti] = arguments[Ti]; if (Ot) - var ii = Fc(Kt), Ti = hA(Er, ii); - if (O && (Er = cw(Er, O, z, Ot)), ne && (Er = uw(Er, ne, fe, Ot)), vr -= Ti, Ot && vr < We) { - var un = Ko(Er, ii); - return vw( + var si = Yc(Kt), Ri = jA(Sr, si); + if (N && (Sr = _w(Sr, N, W, Ot)), ne && (Sr = Ew(Sr, ne, fe, Ot)), br -= Ri, Ot && br < We) { + var un = Go(Sr, si); + return Rw( c, h, - Uh, + Jh, Kt.placeholder, y, - Er, + Sr, un, me, we, - We - vr + We - br ); } - var ps = Xe ? y : this, po = wt ? ps[c] : c; - return vr = Er.length, me ? Er = wM(Er, me) : Ht && vr > 1 && Er.reverse(), He && we < vr && (Er.length = we), this && this !== _r && this instanceof Kt && (po = fr || lf(po)), po.apply(ps, Er); + var ms = Xe ? y : this, vo = wt ? ms[c] : c; + return br = Sr.length, me ? Sr = GM(Sr, me) : Ht && br > 1 && Sr.reverse(), He && we < br && (Sr.length = we), this && this !== Er && this instanceof Kt && (vo = fr || bf(vo)), vo.apply(ms, Sr); } return Kt; } - function gw(c, h) { - return function(y, O) { - return IP(y, c, h(O), {}); + function Cw(c, h) { + return function(y, N) { + return rM(y, c, h(N), {}); }; } - function qh(c, h) { - return function(y, O) { - var z; - if (y === r && O === r) + function Xh(c, h) { + return function(y, N) { + var W; + if (y === r && N === r) return h; - if (y !== r && (z = y), O !== r) { - if (z === r) - return O; - typeof y == "string" || typeof O == "string" ? (y = Mi(y), O = Mi(O)) : (y = ew(y), O = ew(O)), z = c(y, O); + if (y !== r && (W = y), N !== r) { + if (W === r) + return N; + typeof y == "string" || typeof N == "string" ? (y = Ii(y), N = Ii(N)) : (y = pw(y), N = pw(N)), W = c(y, N); } - return z; + return W; }; } - function hg(c) { - return uo(function(h) { - return h = Xr(h, Pi(Ut())), hr(function(y) { - var O = this; - return c(h, function(z) { - return Pn(z, O, y); + function Pg(c) { + return ho(function(h) { + return h = Xr(h, Mi(Ut())), hr(function(y) { + var N = this; + return c(h, function(W) { + return Pn(W, N, y); }); }); }); } - function zh(c, h) { - h = h === r ? " " : Mi(h); + function Zh(c, h) { + h = h === r ? " " : Ii(h); var y = h.length; if (y < 2) - return y ? sg(h, c) : h; - var O = sg(h, Ch(c / Rc(h))); - return Tc(h) ? Xo(ls(O), 0, c).join("") : O.slice(0, c); + return y ? yg(h, c) : h; + var N = yg(h, Bh(c / Uc(h))); + return jc(h) ? Qo(ds(N), 0, c).join("") : N.slice(0, c); } - function tM(c, h, y, O) { - var z = h & L, ne = lf(c); + function CM(c, h, y, N) { + var W = h & L, ne = bf(c); function fe() { - for (var me = -1, we = arguments.length, We = -1, He = O.length, Xe = Ie(He + we), wt = this && this !== _r && this instanceof fe ? ne : c; ++We < He; ) - Xe[We] = O[We]; + for (var me = -1, we = arguments.length, We = -1, He = N.length, Xe = Ie(He + we), wt = this && this !== Er && this instanceof fe ? ne : c; ++We < He; ) + Xe[We] = N[We]; for (; we--; ) Xe[We++] = arguments[++me]; - return Pn(wt, z ? y : this, Xe); + return Pn(wt, W ? y : this, Xe); } return fe; } - function mw(c) { - return function(h, y, O) { - return O && typeof O != "number" && ni(h, y, O) && (y = O = r), h = ho(h), y === r ? (y = h, h = 0) : y = ho(y), O = O === r ? h < y ? 1 : -1 : ho(O), jP(h, y, O, c); + function Tw(c) { + return function(h, y, N) { + return N && typeof N != "number" && ii(h, y, N) && (y = N = r), h = mo(h), y === r ? (y = h, h = 0) : y = mo(y), N = N === r ? h < y ? 1 : -1 : mo(N), pM(h, y, N, c); }; } - function Wh(c) { + function Qh(c) { return function(h, y) { - return typeof h == "string" && typeof y == "string" || (h = Ki(h), y = Ki(y)), c(h, y); + return typeof h == "string" && typeof y == "string" || (h = Gi(h), y = Gi(y)), c(h, y); }; } - function vw(c, h, y, O, z, ne, fe, me, we, We) { - var He = h & H, Xe = He ? fe : r, wt = He ? r : fe, Ot = He ? ne : r, Ht = He ? r : ne; - h |= He ? V : te, h &= ~(He ? te : V), h & $ || (h &= ~(L | B)); + function Rw(c, h, y, N, W, ne, fe, me, we, We) { + var He = h & q, Xe = He ? fe : r, wt = He ? r : fe, Ot = He ? ne : r, Ht = He ? r : ne; + h |= He ? V : Q, h &= ~(He ? Q : V), h & k || (h &= ~(L | B)); var fr = [ c, h, - z, + W, Ot, Xe, Ht, @@ -22807,75 +23319,75 @@ h0.exports; we, We ], Kt = y.apply(r, fr); - return wg(c) && Cw(Kt, fr), Kt.placeholder = O, Tw(Kt, c, h); - } - function dg(c) { - var h = xn[c]; - return function(y, O) { - if (y = Ki(y), O = O == null ? 0 : Kn(cr(O), 292), O && Ty(y)) { - var z = (Cr(y) + "e").split("e"), ne = h(z[0] + "e" + (+z[1] + O)); - return z = (Cr(ne) + "e").split("e"), +(z[0] + "e" + (+z[1] - O)); + return Ng(c) && zw(Kt, fr), Kt.placeholder = N, Ww(Kt, c, h); + } + function Mg(c) { + var h = _n[c]; + return function(y, N) { + if (y = Gi(y), N = N == null ? 0 : Kn(cr(N), 292), N && Wy(y)) { + var W = (Cr(y) + "e").split("e"), ne = h(W[0] + "e" + (+W[1] + N)); + return W = (Cr(ne) + "e").split("e"), +(W[0] + "e" + (+W[1] - N)); } return h(y); }; } - var rM = Nc && 1 / yh(new Nc([, -0]))[1] == x ? function(c) { - return new Nc(c); - } : Lg; - function bw(c) { + var TM = Wc && 1 / Ih(new Wc([, -0]))[1] == x ? function(c) { + return new Wc(c); + } : Yg; + function Dw(c) { return function(h) { var y = Vn(h); - return y == ie ? zp(h) : y == Me ? yA(h) : lA(h, c(h)); + return y == ie ? ng(h) : y == Me ? VA(h) : FA(h, c(h)); }; } - function co(c, h, y, O, z, ne, fe, me) { + function lo(c, h, y, N, W, ne, fe, me) { var we = h & B; if (!we && typeof c != "function") - throw new Ui(o); - var We = O ? O.length : 0; - if (We || (h &= ~(V | te), O = z = r), fe = fe === r ? fe : _n(cr(fe), 0), me = me === r ? me : cr(me), We -= z ? z.length : 0, h & te) { - var He = O, Xe = z; - O = z = r; + throw new zi(o); + var We = N ? N.length : 0; + if (We || (h &= ~(V | Q), N = W = r), fe = fe === r ? fe : En(cr(fe), 0), me = me === r ? me : cr(me), We -= W ? W.length : 0, h & Q) { + var He = N, Xe = W; + N = W = r; } - var wt = we ? r : mg(c), Ot = [ + var wt = we ? r : Tg(c), Ot = [ c, h, y, - O, - z, + N, + W, He, Xe, ne, fe, me ]; - if (wt && vM(Ot, wt), c = Ot[0], h = Ot[1], y = Ot[2], O = Ot[3], z = Ot[4], me = Ot[9] = Ot[9] === r ? we ? 0 : c.length : _n(Ot[9] - We, 0), !me && h & (H | U) && (h &= ~(H | U)), !h || h == L) - var Ht = QP(c, h, y); - else h == H || h == U ? Ht = eM(c, h, me) : (h == V || h == (L | V)) && !z.length ? Ht = tM(c, h, y, O) : Ht = Uh.apply(r, Ot); - var fr = wt ? Zy : Cw; - return Tw(fr(Ht, Ot), c, h); + if (wt && HM(Ot, wt), c = Ot[0], h = Ot[1], y = Ot[2], N = Ot[3], W = Ot[4], me = Ot[9] = Ot[9] === r ? we ? 0 : c.length : En(Ot[9] - We, 0), !me && h & (q | U) && (h &= ~(q | U)), !h || h == L) + var Ht = MM(c, h, y); + else h == q || h == U ? Ht = IM(c, h, me) : (h == V || h == (L | V)) && !W.length ? Ht = CM(c, h, y, N) : Ht = Jh.apply(r, Ot); + var fr = wt ? hw : zw; + return Ww(fr(Ht, Ot), c, h); } - function yw(c, h, y, O) { - return c === r || ds(c, Oc[y]) && !Tr.call(O, y) ? h : c; + function Ow(c, h, y, N) { + return c === r || gs(c, zc[y]) && !Tr.call(N, y) ? h : c; } - function ww(c, h, y, O, z, ne) { - return Zr(c) && Zr(h) && (ne.set(h, c), $h(c, h, r, ww, ne), ne.delete(h)), c; + function Nw(c, h, y, N, W, ne) { + return Zr(c) && Zr(h) && (ne.set(h, c), Kh(c, h, r, Nw, ne), ne.delete(h)), c; } - function nM(c) { - return pf(c) ? r : c; + function RM(c) { + return xf(c) ? r : c; } - function xw(c, h, y, O, z, ne) { - var fe = y & M, me = c.length, we = h.length; + function Lw(c, h, y, N, W, ne) { + var fe = y & P, me = c.length, we = h.length; if (me != we && !(fe && we > me)) return !1; var We = ne.get(c), He = ne.get(h); if (We && He) return We == h && He == c; - var Xe = -1, wt = !0, Ot = y & N ? new ka() : r; + var Xe = -1, wt = !0, Ot = y & O ? new qa() : r; for (ne.set(c, h), ne.set(h, c); ++Xe < me; ) { var Ht = c[Xe], fr = h[Xe]; - if (O) - var Kt = fe ? O(fr, Ht, Xe, h, c, ne) : O(Ht, fr, Xe, c, h, ne); + if (N) + var Kt = fe ? N(fr, Ht, Xe, h, c, ne) : N(Ht, fr, Xe, c, h, ne); if (Kt !== r) { if (Kt) continue; @@ -22883,57 +23395,57 @@ h0.exports; break; } if (Ot) { - if (!$p(h, function(vr, Er) { - if (!Qu(Ot, Er) && (Ht === vr || z(Ht, vr, y, O, ne))) - return Ot.push(Er); + if (!Xp(h, function(br, Sr) { + if (!af(Ot, Sr) && (Ht === br || W(Ht, br, y, N, ne))) + return Ot.push(Sr); })) { wt = !1; break; } - } else if (!(Ht === fr || z(Ht, fr, y, O, ne))) { + } else if (!(Ht === fr || W(Ht, fr, y, N, ne))) { wt = !1; break; } } return ne.delete(c), ne.delete(h), wt; } - function iM(c, h, y, O, z, ne, fe) { + function DM(c, h, y, N, W, ne, fe) { switch (y) { case Ze: if (c.byteLength != h.byteLength || c.byteOffset != h.byteOffset) return !1; c = c.buffer, h = h.buffer; case _e: - return !(c.byteLength != h.byteLength || !ne(new Ah(c), new Ah(h))); + return !(c.byteLength != h.byteLength || !ne(new Nh(c), new Nh(h))); case J: - case Q: + case ee: case ue: - return ds(+c, +h); + return gs(+c, +h); case X: return c.name == h.name && c.message == h.message; case $e: case Ne: return c == h + ""; case ie: - var me = zp; + var me = ng; case Me: - var we = O & M; - if (me || (me = yh), c.size != h.size && !we) + var we = N & P; + if (me || (me = Ih), c.size != h.size && !we) return !1; var We = fe.get(c); if (We) return We == h; - O |= N, fe.set(c, h); - var He = xw(me(c), me(h), O, z, ne, fe); + N |= O, fe.set(c, h); + var He = Lw(me(c), me(h), N, W, ne, fe); return fe.delete(c), He; case Ke: - if (sf) - return sf.call(c) == sf.call(h); + if (hf) + return hf.call(c) == hf.call(h); } return !1; } - function sM(c, h, y, O, z, ne) { - var fe = y & M, me = pg(c), we = me.length, We = pg(h), He = We.length; + function OM(c, h, y, N, W, ne) { + var fe = y & P, me = Ig(c), we = me.length, We = Ig(h), He = We.length; if (we != He && !fe) return !1; for (var Xe = we; Xe--; ) { @@ -22948,103 +23460,103 @@ h0.exports; ne.set(c, h), ne.set(h, c); for (var Kt = fe; ++Xe < we; ) { wt = me[Xe]; - var vr = c[wt], Er = h[wt]; - if (O) - var Ci = fe ? O(Er, vr, wt, h, c, ne) : O(vr, Er, wt, c, h, ne); - if (!(Ci === r ? vr === Er || z(vr, Er, y, O, ne) : Ci)) { + var br = c[wt], Sr = h[wt]; + if (N) + var Ti = fe ? N(Sr, br, wt, h, c, ne) : N(br, Sr, wt, c, h, ne); + if (!(Ti === r ? br === Sr || W(br, Sr, y, N, ne) : Ti)) { fr = !1; break; } Kt || (Kt = wt == "constructor"); } if (fr && !Kt) { - var ii = c.constructor, Ti = h.constructor; - ii != Ti && "constructor" in c && "constructor" in h && !(typeof ii == "function" && ii instanceof ii && typeof Ti == "function" && Ti instanceof Ti) && (fr = !1); + var si = c.constructor, Ri = h.constructor; + si != Ri && "constructor" in c && "constructor" in h && !(typeof si == "function" && si instanceof si && typeof Ri == "function" && Ri instanceof Ri) && (fr = !1); } return ne.delete(c), ne.delete(h), fr; } - function uo(c) { - return _g(Mw(c, r, kw), c + ""); + function ho(c) { + return kg(Uw(c, r, Jw), c + ""); } - function pg(c) { - return Uy(c, Mn, bg); + function Ig(c) { + return tw(c, Mn, Dg); } - function gg(c) { - return Uy(c, hi, _w); - } - var mg = Rh ? function(c) { - return Rh.get(c); - } : Lg; - function Hh(c) { - for (var h = c.name + "", y = Lc[h], O = Tr.call(Lc, h) ? y.length : 0; O--; ) { - var z = y[O], ne = z.func; + function Cg(c) { + return tw(c, di, kw); + } + var Tg = jh ? function(c) { + return jh.get(c); + } : Yg; + function ed(c) { + for (var h = c.name + "", y = Hc[h], N = Tr.call(Hc, h) ? y.length : 0; N--; ) { + var W = y[N], ne = W.func; if (ne == null || ne == c) - return z.name; + return W.name; } return h; } - function Fc(c) { - var h = Tr.call(ee, "placeholder") ? ee : c; + function Yc(c) { + var h = Tr.call(te, "placeholder") ? te : c; return h.placeholder; } function Ut() { - var c = ee.iteratee || Og; - return c = c === Og ? Wy : c, arguments.length ? c(arguments[0], arguments[1]) : c; + var c = te.iteratee || Vg; + return c = c === Vg ? iw : c, arguments.length ? c(arguments[0], arguments[1]) : c; } - function Kh(c, h) { + function td(c, h) { var y = c.__data__; - return dM(h) ? y[typeof h == "string" ? "string" : "hash"] : y.map; + return UM(h) ? y[typeof h == "string" ? "string" : "hash"] : y.map; } - function vg(c) { + function Rg(c) { for (var h = Mn(c), y = h.length; y--; ) { - var O = h[y], z = c[O]; - h[y] = [O, z, Aw(z)]; + var N = h[y], W = c[N]; + h[y] = [N, W, Fw(W)]; } return h; } - function Fa(c, h) { - var y = mA(c, h); - return zy(y) ? y : r; + function Ha(c, h) { + var y = WA(c, h); + return nw(y) ? y : r; } - function oM(c) { - var h = Tr.call(c, Na), y = c[Na]; + function NM(c) { + var h = Tr.call(c, ja), y = c[ja]; try { - c[Na] = r; - var O = !0; + c[ja] = r; + var N = !0; } catch { } - var z = Eh.call(c); - return O && (h ? c[Na] = y : delete c[Na]), z; + var W = Dh.call(c); + return N && (h ? c[ja] = y : delete c[ja]), W; } - var bg = Hp ? function(c) { - return c == null ? [] : (c = qr(c), Wo(Hp(c), function(h) { - return Iy.call(c, h); + var Dg = sg ? function(c) { + return c == null ? [] : (c = qr(c), Ko(sg(c), function(h) { + return qy.call(c, h); })); - } : kg, _w = Hp ? function(c) { + } : Jg, kw = sg ? function(c) { for (var h = []; c; ) - Ho(h, bg(c)), c = Ph(c); + Vo(h, Dg(c)), c = Lh(c); return h; - } : kg, Vn = ri; - (Kp && Vn(new Kp(new ArrayBuffer(1))) != Ze || tf && Vn(new tf()) != ie || Vp && Vn(Vp.resolve()) != De || Nc && Vn(new Nc()) != Me || rf && Vn(new rf()) != qe) && (Vn = function(c) { - var h = ri(c), y = h == Pe ? c.constructor : r, O = y ? ja(y) : ""; - if (O) - switch (O) { - case qA: + } : Jg, Vn = ni; + (og && Vn(new og(new ArrayBuffer(1))) != Ze || uf && Vn(new uf()) != ie || ag && Vn(ag.resolve()) != De || Wc && Vn(new Wc()) != Me || ff && Vn(new ff()) != qe) && (Vn = function(c) { + var h = ni(c), y = h == Pe ? c.constructor : r, N = y ? Ka(y) : ""; + if (N) + switch (N) { + case mP: return Ze; - case zA: + case vP: return ie; - case WA: + case bP: return De; - case HA: + case yP: return Me; - case KA: + case wP: return qe; } return h; }); - function aM(c, h, y) { - for (var O = -1, z = y.length; ++O < z; ) { - var ne = y[O], fe = ne.size; + function LM(c, h, y) { + for (var N = -1, W = y.length; ++N < W; ) { + var ne = y[N], fe = ne.size; switch (ne.type) { case "drop": c += fe; @@ -23056,43 +23568,43 @@ h0.exports; h = Kn(h, c + fe); break; case "takeRight": - c = _n(c, h - fe); + c = En(c, h - fe); break; } } return { start: c, end: h }; } - function cM(c) { + function kM(c) { var h = c.match(C); return h ? h[1].split(G) : []; } - function Ew(c, h, y) { - h = Jo(h, c); - for (var O = -1, z = h.length, ne = !1; ++O < z; ) { - var fe = Rs(h[O]); + function $w(c, h, y) { + h = Zo(h, c); + for (var N = -1, W = h.length, ne = !1; ++N < W; ) { + var fe = Ls(h[N]); if (!(ne = c != null && y(c, fe))) break; c = c[fe]; } - return ne || ++O != z ? ne : (z = c == null ? 0 : c.length, !!z && Qh(z) && fo(fe, z) && (ir(c) || Ua(c))); + return ne || ++N != W ? ne : (W = c == null ? 0 : c.length, !!W && cd(W) && po(fe, W) && (ir(c) || Va(c))); } - function uM(c) { + function $M(c) { var h = c.length, y = new c.constructor(h); return h && typeof c[0] == "string" && Tr.call(c, "index") && (y.index = c.index, y.input = c.input), y; } - function Sw(c) { - return typeof c.constructor == "function" && !hf(c) ? kc(Ph(c)) : {}; + function Bw(c) { + return typeof c.constructor == "function" && !yf(c) ? Kc(Lh(c)) : {}; } - function fM(c, h, y) { - var O = c.constructor; + function BM(c, h, y) { + var N = c.constructor; switch (h) { case _e: - return lg(c); + return Ag(c); case J: - case Q: - return new O(+c); + case ee: + return new N(+c); case Ze: - return VP(c, y); + return xM(c, y); case at: case ke: case Qe: @@ -23102,172 +23614,172 @@ h0.exports; case lt: case ct: case qt: - return ow(c, y); + return ww(c, y); case ie: - return new O(); + return new N(); case ue: case Ne: - return new O(c); + return new N(c); case $e: - return GP(c); + return _M(c); case Me: - return new O(); + return new N(); case Ke: - return YP(c); + return EM(c); } } - function lM(c, h) { + function FM(c, h) { var y = h.length; if (!y) return c; - var O = y - 1; - return h[O] = (y > 1 ? "& " : "") + h[O], h = h.join(y > 2 ? ", " : " "), c.replace(W, `{ + var N = y - 1; + return h[N] = (y > 1 ? "& " : "") + h[N], h = h.join(y > 2 ? ", " : " "), c.replace(H, `{ /* [wrapped with ` + h + `] */ `); } - function hM(c) { - return ir(c) || Ua(c) || !!(Cy && c && c[Cy]); + function jM(c) { + return ir(c) || Va(c) || !!(zy && c && c[zy]); } - function fo(c, h) { + function po(c, h) { var y = typeof c; - return h = h ?? _, !!h && (y == "number" || y != "symbol" && it.test(c)) && c > -1 && c % 1 == 0 && c < h; + return h = h ?? E, !!h && (y == "number" || y != "symbol" && it.test(c)) && c > -1 && c % 1 == 0 && c < h; } - function ni(c, h, y) { + function ii(c, h, y) { if (!Zr(y)) return !1; - var O = typeof h; - return (O == "number" ? li(y) && fo(h, y.length) : O == "string" && h in y) ? ds(y[h], c) : !1; + var N = typeof h; + return (N == "number" ? hi(y) && po(h, y.length) : N == "string" && h in y) ? gs(y[h], c) : !1; } - function yg(c, h) { + function Og(c, h) { if (ir(c)) return !1; var y = typeof c; - return y == "number" || y == "symbol" || y == "boolean" || c == null || Ii(c) ? !0 : $t.test(c) || !vt.test(c) || h != null && c in qr(h); + return y == "number" || y == "symbol" || y == "boolean" || c == null || Ci(c) ? !0 : $t.test(c) || !bt.test(c) || h != null && c in qr(h); } - function dM(c) { + function UM(c) { var h = typeof c; return h == "string" || h == "number" || h == "symbol" || h == "boolean" ? c !== "__proto__" : c === null; } - function wg(c) { - var h = Hh(c), y = ee[h]; - if (typeof y != "function" || !(h in wr.prototype)) + function Ng(c) { + var h = ed(c), y = te[h]; + if (typeof y != "function" || !(h in xr.prototype)) return !1; if (c === y) return !0; - var O = mg(y); - return !!O && c === O[0]; + var N = Tg(y); + return !!N && c === N[0]; } - function pM(c) { - return !!Ay && Ay in c; + function qM(c) { + return !!Fy && Fy in c; } - var gM = xh ? lo : $g; - function hf(c) { - var h = c && c.constructor, y = typeof h == "function" && h.prototype || Oc; + var zM = Th ? go : Xg; + function yf(c) { + var h = c && c.constructor, y = typeof h == "function" && h.prototype || zc; return c === y; } - function Aw(c) { + function Fw(c) { return c === c && !Zr(c); } - function Pw(c, h) { + function jw(c, h) { return function(y) { return y == null ? !1 : y[c] === h && (h !== r || c in qr(y)); }; } - function mM(c) { - var h = Xh(c, function(O) { - return y.size === l && y.clear(), O; + function WM(c) { + var h = od(c, function(N) { + return y.size === l && y.clear(), N; }), y = h.cache; return h; } - function vM(c, h) { - var y = c[1], O = h[1], z = y | O, ne = z < (L | B | R), fe = O == R && y == H || O == R && y == K && c[7].length <= h[8] || O == (R | K) && h[7].length <= h[8] && y == H; + function HM(c, h) { + var y = c[1], N = h[1], W = y | N, ne = W < (L | B | R), fe = N == R && y == q || N == R && y == K && c[7].length <= h[8] || N == (R | K) && h[7].length <= h[8] && y == q; if (!(ne || fe)) return c; - O & L && (c[2] = h[2], z |= y & L ? 0 : $); + N & L && (c[2] = h[2], W |= y & L ? 0 : k); var me = h[3]; if (me) { var we = c[3]; - c[3] = we ? cw(we, me, h[4]) : me, c[4] = we ? Ko(c[3], d) : h[4]; + c[3] = we ? _w(we, me, h[4]) : me, c[4] = we ? Go(c[3], d) : h[4]; } - return me = h[5], me && (we = c[5], c[5] = we ? uw(we, me, h[6]) : me, c[6] = we ? Ko(c[5], d) : h[6]), me = h[7], me && (c[7] = me), O & R && (c[8] = c[8] == null ? h[8] : Kn(c[8], h[8])), c[9] == null && (c[9] = h[9]), c[0] = h[0], c[1] = z, c; + return me = h[5], me && (we = c[5], c[5] = we ? Ew(we, me, h[6]) : me, c[6] = we ? Go(c[5], d) : h[6]), me = h[7], me && (c[7] = me), N & R && (c[8] = c[8] == null ? h[8] : Kn(c[8], h[8])), c[9] == null && (c[9] = h[9]), c[0] = h[0], c[1] = W, c; } - function bM(c) { + function KM(c) { var h = []; if (c != null) for (var y in qr(c)) h.push(y); return h; } - function yM(c) { - return Eh.call(c); + function VM(c) { + return Dh.call(c); } - function Mw(c, h, y) { - return h = _n(h === r ? c.length - 1 : h, 0), function() { - for (var O = arguments, z = -1, ne = _n(O.length - h, 0), fe = Ie(ne); ++z < ne; ) - fe[z] = O[h + z]; - z = -1; - for (var me = Ie(h + 1); ++z < h; ) - me[z] = O[z]; + function Uw(c, h, y) { + return h = En(h === r ? c.length - 1 : h, 0), function() { + for (var N = arguments, W = -1, ne = En(N.length - h, 0), fe = Ie(ne); ++W < ne; ) + fe[W] = N[h + W]; + W = -1; + for (var me = Ie(h + 1); ++W < h; ) + me[W] = N[W]; return me[h] = y(fe), Pn(c, this, me); }; } - function Iw(c, h) { - return h.length < 2 ? c : Ba(c, Wi(h, 0, -1)); + function qw(c, h) { + return h.length < 2 ? c : Wa(c, Ki(h, 0, -1)); } - function wM(c, h) { - for (var y = c.length, O = Kn(h.length, y), z = fi(c); O--; ) { - var ne = h[O]; - c[O] = fo(ne, y) ? z[ne] : r; + function GM(c, h) { + for (var y = c.length, N = Kn(h.length, y), W = li(c); N--; ) { + var ne = h[N]; + c[N] = po(ne, y) ? W[ne] : r; } return c; } - function xg(c, h) { + function Lg(c, h) { if (!(h === "constructor" && typeof c[h] == "function") && h != "__proto__") return c[h]; } - var Cw = Rw(Zy), df = LA || function(c, h) { - return _r.setTimeout(c, h); - }, _g = Rw(zP); - function Tw(c, h, y) { - var O = h + ""; - return _g(c, lM(O, xM(cM(O), y))); + var zw = Hw(hw), wf = uP || function(c, h) { + return Er.setTimeout(c, h); + }, kg = Hw(vM); + function Ww(c, h, y) { + var N = h + ""; + return kg(c, FM(N, YM(kM(N), y))); } - function Rw(c) { + function Hw(c) { var h = 0, y = 0; return function() { - var O = FA(), z = m - (O - y); - if (y = O, z > 0) { - if (++h >= S) + var N = dP(), W = m - (N - y); + if (y = N, W > 0) { + if (++h >= A) return arguments[0]; } else h = 0; return c.apply(r, arguments); }; } - function Vh(c, h) { - var y = -1, O = c.length, z = O - 1; - for (h = h === r ? O : h; ++y < h; ) { - var ne = ig(y, z), fe = c[ne]; + function rd(c, h) { + var y = -1, N = c.length, W = N - 1; + for (h = h === r ? N : h; ++y < h; ) { + var ne = bg(y, W), fe = c[ne]; c[ne] = c[y], c[y] = fe; } return c.length = h, c; } - var Dw = mM(function(c) { + var Kw = WM(function(c) { var h = []; - return c.charCodeAt(0) === 46 && h.push(""), c.replace(Ft, function(y, O, z, ne) { - h.push(z ? ne.replace(de, "$1") : O || y); + return c.charCodeAt(0) === 46 && h.push(""), c.replace(Ft, function(y, N, W, ne) { + h.push(W ? ne.replace(de, "$1") : N || y); }), h; }); - function Rs(c) { - if (typeof c == "string" || Ii(c)) + function Ls(c) { + if (typeof c == "string" || Ci(c)) return c; var h = c + ""; return h == "0" && 1 / c == -x ? "-0" : h; } - function ja(c) { + function Ka(c) { if (c != null) { try { - return _h.call(c); + return Rh.call(c); } catch { } try { @@ -23277,565 +23789,565 @@ h0.exports; } return ""; } - function xM(c, h) { - return ji(ce, function(y) { - var O = "_." + y[0]; - h & y[1] && !vh(c, O) && c.push(O); + function YM(c, h) { + return qi(ce, function(y) { + var N = "_." + y[0]; + h & y[1] && !Ph(c, N) && c.push(N); }), c.sort(); } - function Ow(c) { - if (c instanceof wr) + function Vw(c) { + if (c instanceof xr) return c.clone(); - var h = new qi(c.__wrapped__, c.__chain__); - return h.__actions__ = fi(c.__actions__), h.__index__ = c.__index__, h.__values__ = c.__values__, h; + var h = new Wi(c.__wrapped__, c.__chain__); + return h.__actions__ = li(c.__actions__), h.__index__ = c.__index__, h.__values__ = c.__values__, h; } - function _M(c, h, y) { - (y ? ni(c, h, y) : h === r) ? h = 1 : h = _n(cr(h), 0); - var O = c == null ? 0 : c.length; - if (!O || h < 1) + function JM(c, h, y) { + (y ? ii(c, h, y) : h === r) ? h = 1 : h = En(cr(h), 0); + var N = c == null ? 0 : c.length; + if (!N || h < 1) return []; - for (var z = 0, ne = 0, fe = Ie(Ch(O / h)); z < O; ) - fe[ne++] = Wi(c, z, z += h); + for (var W = 0, ne = 0, fe = Ie(Bh(N / h)); W < N; ) + fe[ne++] = Ki(c, W, W += h); return fe; } - function EM(c) { - for (var h = -1, y = c == null ? 0 : c.length, O = 0, z = []; ++h < y; ) { + function XM(c) { + for (var h = -1, y = c == null ? 0 : c.length, N = 0, W = []; ++h < y; ) { var ne = c[h]; - ne && (z[O++] = ne); + ne && (W[N++] = ne); } - return z; + return W; } - function SM() { + function ZM() { var c = arguments.length; if (!c) return []; - for (var h = Ie(c - 1), y = arguments[0], O = c; O--; ) - h[O - 1] = arguments[O]; - return Ho(ir(y) ? fi(y) : [y], Bn(h, 1)); - } - var AM = hr(function(c, h) { - return cn(c) ? af(c, Bn(h, 1, cn, !0)) : []; - }), PM = hr(function(c, h) { - var y = Hi(h); - return cn(y) && (y = r), cn(c) ? af(c, Bn(h, 1, cn, !0), Ut(y, 2)) : []; - }), MM = hr(function(c, h) { - var y = Hi(h); - return cn(y) && (y = r), cn(c) ? af(c, Bn(h, 1, cn, !0), r, y) : []; + for (var h = Ie(c - 1), y = arguments[0], N = c; N--; ) + h[N - 1] = arguments[N]; + return Vo(ir(y) ? li(y) : [y], Bn(h, 1)); + } + var QM = hr(function(c, h) { + return cn(c) ? pf(c, Bn(h, 1, cn, !0)) : []; + }), eI = hr(function(c, h) { + var y = Vi(h); + return cn(y) && (y = r), cn(c) ? pf(c, Bn(h, 1, cn, !0), Ut(y, 2)) : []; + }), tI = hr(function(c, h) { + var y = Vi(h); + return cn(y) && (y = r), cn(c) ? pf(c, Bn(h, 1, cn, !0), r, y) : []; }); - function IM(c, h, y) { - var O = c == null ? 0 : c.length; - return O ? (h = y || h === r ? 1 : cr(h), Wi(c, h < 0 ? 0 : h, O)) : []; + function rI(c, h, y) { + var N = c == null ? 0 : c.length; + return N ? (h = y || h === r ? 1 : cr(h), Ki(c, h < 0 ? 0 : h, N)) : []; } - function CM(c, h, y) { - var O = c == null ? 0 : c.length; - return O ? (h = y || h === r ? 1 : cr(h), h = O - h, Wi(c, 0, h < 0 ? 0 : h)) : []; + function nI(c, h, y) { + var N = c == null ? 0 : c.length; + return N ? (h = y || h === r ? 1 : cr(h), h = N - h, Ki(c, 0, h < 0 ? 0 : h)) : []; } - function TM(c, h) { - return c && c.length ? Fh(c, Ut(h, 3), !0, !0) : []; + function iI(c, h) { + return c && c.length ? Gh(c, Ut(h, 3), !0, !0) : []; } - function RM(c, h) { - return c && c.length ? Fh(c, Ut(h, 3), !0) : []; + function sI(c, h) { + return c && c.length ? Gh(c, Ut(h, 3), !0) : []; } - function DM(c, h, y, O) { - var z = c == null ? 0 : c.length; - return z ? (y && typeof y != "number" && ni(c, h, y) && (y = 0, O = z), SP(c, h, y, O)) : []; + function oI(c, h, y, N) { + var W = c == null ? 0 : c.length; + return W ? (y && typeof y != "number" && ii(c, h, y) && (y = 0, N = W), ZP(c, h, y, N)) : []; } - function Nw(c, h, y) { - var O = c == null ? 0 : c.length; - if (!O) + function Gw(c, h, y) { + var N = c == null ? 0 : c.length; + if (!N) return -1; - var z = y == null ? 0 : cr(y); - return z < 0 && (z = _n(O + z, 0)), bh(c, Ut(h, 3), z); + var W = y == null ? 0 : cr(y); + return W < 0 && (W = En(N + W, 0)), Mh(c, Ut(h, 3), W); } - function Lw(c, h, y) { - var O = c == null ? 0 : c.length; - if (!O) + function Yw(c, h, y) { + var N = c == null ? 0 : c.length; + if (!N) return -1; - var z = O - 1; - return y !== r && (z = cr(y), z = y < 0 ? _n(O + z, 0) : Kn(z, O - 1)), bh(c, Ut(h, 3), z, !0); + var W = N - 1; + return y !== r && (W = cr(y), W = y < 0 ? En(N + W, 0) : Kn(W, N - 1)), Mh(c, Ut(h, 3), W, !0); } - function kw(c) { + function Jw(c) { var h = c == null ? 0 : c.length; return h ? Bn(c, 1) : []; } - function OM(c) { + function aI(c) { var h = c == null ? 0 : c.length; return h ? Bn(c, x) : []; } - function NM(c, h) { + function cI(c, h) { var y = c == null ? 0 : c.length; return y ? (h = h === r ? 1 : cr(h), Bn(c, h)) : []; } - function LM(c) { - for (var h = -1, y = c == null ? 0 : c.length, O = {}; ++h < y; ) { - var z = c[h]; - O[z[0]] = z[1]; + function uI(c) { + for (var h = -1, y = c == null ? 0 : c.length, N = {}; ++h < y; ) { + var W = c[h]; + N[W[0]] = W[1]; } - return O; + return N; } - function $w(c) { + function Xw(c) { return c && c.length ? c[0] : r; } - function kM(c, h, y) { - var O = c == null ? 0 : c.length; - if (!O) + function fI(c, h, y) { + var N = c == null ? 0 : c.length; + if (!N) return -1; - var z = y == null ? 0 : cr(y); - return z < 0 && (z = _n(O + z, 0)), Cc(c, h, z); + var W = y == null ? 0 : cr(y); + return W < 0 && (W = En(N + W, 0)), Fc(c, h, W); } - function $M(c) { + function lI(c) { var h = c == null ? 0 : c.length; - return h ? Wi(c, 0, -1) : []; - } - var BM = hr(function(c) { - var h = Xr(c, ug); - return h.length && h[0] === c[0] ? Qp(h) : []; - }), FM = hr(function(c) { - var h = Hi(c), y = Xr(c, ug); - return h === Hi(y) ? h = r : y.pop(), y.length && y[0] === c[0] ? Qp(y, Ut(h, 2)) : []; - }), jM = hr(function(c) { - var h = Hi(c), y = Xr(c, ug); - return h = typeof h == "function" ? h : r, h && y.pop(), y.length && y[0] === c[0] ? Qp(y, r, h) : []; + return h ? Ki(c, 0, -1) : []; + } + var hI = hr(function(c) { + var h = Xr(c, Eg); + return h.length && h[0] === c[0] ? dg(h) : []; + }), dI = hr(function(c) { + var h = Vi(c), y = Xr(c, Eg); + return h === Vi(y) ? h = r : y.pop(), y.length && y[0] === c[0] ? dg(y, Ut(h, 2)) : []; + }), pI = hr(function(c) { + var h = Vi(c), y = Xr(c, Eg); + return h = typeof h == "function" ? h : r, h && y.pop(), y.length && y[0] === c[0] ? dg(y, r, h) : []; }); - function UM(c, h) { - return c == null ? "" : $A.call(c, h); + function gI(c, h) { + return c == null ? "" : lP.call(c, h); } - function Hi(c) { + function Vi(c) { var h = c == null ? 0 : c.length; return h ? c[h - 1] : r; } - function qM(c, h, y) { - var O = c == null ? 0 : c.length; - if (!O) + function mI(c, h, y) { + var N = c == null ? 0 : c.length; + if (!N) return -1; - var z = O; - return y !== r && (z = cr(y), z = z < 0 ? _n(O + z, 0) : Kn(z, O - 1)), h === h ? xA(c, h, z) : bh(c, vy, z, !0); + var W = N; + return y !== r && (W = cr(y), W = W < 0 ? En(N + W, 0) : Kn(W, N - 1)), h === h ? YA(c, h, W) : Mh(c, Ry, W, !0); } - function zM(c, h) { - return c && c.length ? Gy(c, cr(h)) : r; + function vI(c, h) { + return c && c.length ? cw(c, cr(h)) : r; } - var WM = hr(Bw); - function Bw(c, h) { - return c && c.length && h && h.length ? ng(c, h) : c; + var bI = hr(Zw); + function Zw(c, h) { + return c && c.length && h && h.length ? vg(c, h) : c; } - function HM(c, h, y) { - return c && c.length && h && h.length ? ng(c, h, Ut(y, 2)) : c; + function yI(c, h, y) { + return c && c.length && h && h.length ? vg(c, h, Ut(y, 2)) : c; } - function KM(c, h, y) { - return c && c.length && h && h.length ? ng(c, h, r, y) : c; + function wI(c, h, y) { + return c && c.length && h && h.length ? vg(c, h, r, y) : c; } - var VM = uo(function(c, h) { - var y = c == null ? 0 : c.length, O = Yp(c, h); - return Xy(c, Xr(h, function(z) { - return fo(z, y) ? +z : z; - }).sort(aw)), O; + var xI = ho(function(c, h) { + var y = c == null ? 0 : c.length, N = ug(c, h); + return lw(c, Xr(h, function(W) { + return po(W, y) ? +W : W; + }).sort(xw)), N; }); - function GM(c, h) { + function _I(c, h) { var y = []; if (!(c && c.length)) return y; - var O = -1, z = [], ne = c.length; - for (h = Ut(h, 3); ++O < ne; ) { - var fe = c[O]; - h(fe, O, c) && (y.push(fe), z.push(O)); + var N = -1, W = [], ne = c.length; + for (h = Ut(h, 3); ++N < ne; ) { + var fe = c[N]; + h(fe, N, c) && (y.push(fe), W.push(N)); } - return Xy(c, z), y; + return lw(c, W), y; } - function Eg(c) { - return c == null ? c : UA.call(c); + function $g(c) { + return c == null ? c : gP.call(c); } - function YM(c, h, y) { - var O = c == null ? 0 : c.length; - return O ? (y && typeof y != "number" && ni(c, h, y) ? (h = 0, y = O) : (h = h == null ? 0 : cr(h), y = y === r ? O : cr(y)), Wi(c, h, y)) : []; + function EI(c, h, y) { + var N = c == null ? 0 : c.length; + return N ? (y && typeof y != "number" && ii(c, h, y) ? (h = 0, y = N) : (h = h == null ? 0 : cr(h), y = y === r ? N : cr(y)), Ki(c, h, y)) : []; } - function JM(c, h) { - return Bh(c, h); + function SI(c, h) { + return Vh(c, h); } - function XM(c, h, y) { - return og(c, h, Ut(y, 2)); + function AI(c, h, y) { + return wg(c, h, Ut(y, 2)); } - function ZM(c, h) { + function PI(c, h) { var y = c == null ? 0 : c.length; if (y) { - var O = Bh(c, h); - if (O < y && ds(c[O], h)) - return O; + var N = Vh(c, h); + if (N < y && gs(c[N], h)) + return N; } return -1; } - function QM(c, h) { - return Bh(c, h, !0); + function MI(c, h) { + return Vh(c, h, !0); } - function eI(c, h, y) { - return og(c, h, Ut(y, 2), !0); + function II(c, h, y) { + return wg(c, h, Ut(y, 2), !0); } - function tI(c, h) { + function CI(c, h) { var y = c == null ? 0 : c.length; if (y) { - var O = Bh(c, h, !0) - 1; - if (ds(c[O], h)) - return O; + var N = Vh(c, h, !0) - 1; + if (gs(c[N], h)) + return N; } return -1; } - function rI(c) { - return c && c.length ? Qy(c) : []; + function TI(c) { + return c && c.length ? dw(c) : []; } - function nI(c, h) { - return c && c.length ? Qy(c, Ut(h, 2)) : []; + function RI(c, h) { + return c && c.length ? dw(c, Ut(h, 2)) : []; } - function iI(c) { + function DI(c) { var h = c == null ? 0 : c.length; - return h ? Wi(c, 1, h) : []; - } - function sI(c, h, y) { - return c && c.length ? (h = y || h === r ? 1 : cr(h), Wi(c, 0, h < 0 ? 0 : h)) : []; + return h ? Ki(c, 1, h) : []; } - function oI(c, h, y) { - var O = c == null ? 0 : c.length; - return O ? (h = y || h === r ? 1 : cr(h), h = O - h, Wi(c, h < 0 ? 0 : h, O)) : []; - } - function aI(c, h) { - return c && c.length ? Fh(c, Ut(h, 3), !1, !0) : []; - } - function cI(c, h) { - return c && c.length ? Fh(c, Ut(h, 3)) : []; - } - var uI = hr(function(c) { - return Yo(Bn(c, 1, cn, !0)); - }), fI = hr(function(c) { - var h = Hi(c); - return cn(h) && (h = r), Yo(Bn(c, 1, cn, !0), Ut(h, 2)); - }), lI = hr(function(c) { - var h = Hi(c); - return h = typeof h == "function" ? h : r, Yo(Bn(c, 1, cn, !0), r, h); + function OI(c, h, y) { + return c && c.length ? (h = y || h === r ? 1 : cr(h), Ki(c, 0, h < 0 ? 0 : h)) : []; + } + function NI(c, h, y) { + var N = c == null ? 0 : c.length; + return N ? (h = y || h === r ? 1 : cr(h), h = N - h, Ki(c, h < 0 ? 0 : h, N)) : []; + } + function LI(c, h) { + return c && c.length ? Gh(c, Ut(h, 3), !1, !0) : []; + } + function kI(c, h) { + return c && c.length ? Gh(c, Ut(h, 3)) : []; + } + var $I = hr(function(c) { + return Xo(Bn(c, 1, cn, !0)); + }), BI = hr(function(c) { + var h = Vi(c); + return cn(h) && (h = r), Xo(Bn(c, 1, cn, !0), Ut(h, 2)); + }), FI = hr(function(c) { + var h = Vi(c); + return h = typeof h == "function" ? h : r, Xo(Bn(c, 1, cn, !0), r, h); }); - function hI(c) { - return c && c.length ? Yo(c) : []; + function jI(c) { + return c && c.length ? Xo(c) : []; } - function dI(c, h) { - return c && c.length ? Yo(c, Ut(h, 2)) : []; + function UI(c, h) { + return c && c.length ? Xo(c, Ut(h, 2)) : []; } - function pI(c, h) { - return h = typeof h == "function" ? h : r, c && c.length ? Yo(c, r, h) : []; + function qI(c, h) { + return h = typeof h == "function" ? h : r, c && c.length ? Xo(c, r, h) : []; } - function Sg(c) { + function Bg(c) { if (!(c && c.length)) return []; var h = 0; - return c = Wo(c, function(y) { + return c = Ko(c, function(y) { if (cn(y)) - return h = _n(y.length, h), !0; - }), Up(h, function(y) { - return Xr(c, Bp(y)); + return h = En(y.length, h), !0; + }), tg(h, function(y) { + return Xr(c, Zp(y)); }); } - function Fw(c, h) { + function Qw(c, h) { if (!(c && c.length)) return []; - var y = Sg(c); - return h == null ? y : Xr(y, function(O) { - return Pn(h, r, O); + var y = Bg(c); + return h == null ? y : Xr(y, function(N) { + return Pn(h, r, N); }); } - var gI = hr(function(c, h) { - return cn(c) ? af(c, h) : []; - }), mI = hr(function(c) { - return cg(Wo(c, cn)); - }), vI = hr(function(c) { - var h = Hi(c); - return cn(h) && (h = r), cg(Wo(c, cn), Ut(h, 2)); - }), bI = hr(function(c) { - var h = Hi(c); - return h = typeof h == "function" ? h : r, cg(Wo(c, cn), r, h); - }), yI = hr(Sg); - function wI(c, h) { - return nw(c || [], h || [], of); - } - function xI(c, h) { - return nw(c || [], h || [], ff); - } - var _I = hr(function(c) { + var zI = hr(function(c, h) { + return cn(c) ? pf(c, h) : []; + }), WI = hr(function(c) { + return _g(Ko(c, cn)); + }), HI = hr(function(c) { + var h = Vi(c); + return cn(h) && (h = r), _g(Ko(c, cn), Ut(h, 2)); + }), KI = hr(function(c) { + var h = Vi(c); + return h = typeof h == "function" ? h : r, _g(Ko(c, cn), r, h); + }), VI = hr(Bg); + function GI(c, h) { + return vw(c || [], h || [], df); + } + function YI(c, h) { + return vw(c || [], h || [], vf); + } + var JI = hr(function(c) { var h = c.length, y = h > 1 ? c[h - 1] : r; - return y = typeof y == "function" ? (c.pop(), y) : r, Fw(c, y); + return y = typeof y == "function" ? (c.pop(), y) : r, Qw(c, y); }); - function jw(c) { - var h = ee(c); + function e2(c) { + var h = te(c); return h.__chain__ = !0, h; } - function EI(c, h) { + function XI(c, h) { return h(c), c; } - function Gh(c, h) { + function nd(c, h) { return h(c); } - var SI = uo(function(c) { - var h = c.length, y = h ? c[0] : 0, O = this.__wrapped__, z = function(ne) { - return Yp(ne, c); + var ZI = ho(function(c) { + var h = c.length, y = h ? c[0] : 0, N = this.__wrapped__, W = function(ne) { + return ug(ne, c); }; - return h > 1 || this.__actions__.length || !(O instanceof wr) || !fo(y) ? this.thru(z) : (O = O.slice(y, +y + (h ? 1 : 0)), O.__actions__.push({ - func: Gh, - args: [z], + return h > 1 || this.__actions__.length || !(N instanceof xr) || !po(y) ? this.thru(W) : (N = N.slice(y, +y + (h ? 1 : 0)), N.__actions__.push({ + func: nd, + args: [W], thisArg: r - }), new qi(O, this.__chain__).thru(function(ne) { + }), new Wi(N, this.__chain__).thru(function(ne) { return h && !ne.length && ne.push(r), ne; })); }); - function AI() { - return jw(this); + function QI() { + return e2(this); } - function PI() { - return new qi(this.value(), this.__chain__); + function eC() { + return new Wi(this.value(), this.__chain__); } - function MI() { - this.__values__ === r && (this.__values__ = e2(this.value())); + function tC() { + this.__values__ === r && (this.__values__ = p2(this.value())); var c = this.__index__ >= this.__values__.length, h = c ? r : this.__values__[this.__index__++]; return { done: c, value: h }; } - function II() { + function rC() { return this; } - function CI(c) { - for (var h, y = this; y instanceof Oh; ) { - var O = Ow(y); - O.__index__ = 0, O.__values__ = r, h ? z.__wrapped__ = O : h = O; - var z = O; + function nC(c) { + for (var h, y = this; y instanceof qh; ) { + var N = Vw(y); + N.__index__ = 0, N.__values__ = r, h ? W.__wrapped__ = N : h = N; + var W = N; y = y.__wrapped__; } - return z.__wrapped__ = c, h; + return W.__wrapped__ = c, h; } - function TI() { + function iC() { var c = this.__wrapped__; - if (c instanceof wr) { + if (c instanceof xr) { var h = c; - return this.__actions__.length && (h = new wr(this)), h = h.reverse(), h.__actions__.push({ - func: Gh, - args: [Eg], + return this.__actions__.length && (h = new xr(this)), h = h.reverse(), h.__actions__.push({ + func: nd, + args: [$g], thisArg: r - }), new qi(h, this.__chain__); + }), new Wi(h, this.__chain__); } - return this.thru(Eg); + return this.thru($g); } - function RI() { - return rw(this.__wrapped__, this.__actions__); + function sC() { + return mw(this.__wrapped__, this.__actions__); } - var DI = jh(function(c, h, y) { - Tr.call(c, y) ? ++c[y] : ao(c, y, 1); + var oC = Yh(function(c, h, y) { + Tr.call(c, y) ? ++c[y] : fo(c, y, 1); }); - function OI(c, h, y) { - var O = ir(c) ? gy : EP; - return y && ni(c, h, y) && (h = r), O(c, Ut(h, 3)); + function aC(c, h, y) { + var N = ir(c) ? Cy : XP; + return y && ii(c, h, y) && (h = r), N(c, Ut(h, 3)); } - function NI(c, h) { - var y = ir(c) ? Wo : Fy; + function cC(c, h) { + var y = ir(c) ? Ko : Qy; return y(c, Ut(h, 3)); } - var LI = dw(Nw), kI = dw(Lw); - function $I(c, h) { - return Bn(Yh(c, h), 1); + var uC = Mw(Gw), fC = Mw(Yw); + function lC(c, h) { + return Bn(id(c, h), 1); } - function BI(c, h) { - return Bn(Yh(c, h), x); + function hC(c, h) { + return Bn(id(c, h), x); } - function FI(c, h, y) { - return y = y === r ? 1 : cr(y), Bn(Yh(c, h), y); + function dC(c, h, y) { + return y = y === r ? 1 : cr(y), Bn(id(c, h), y); } - function Uw(c, h) { - var y = ir(c) ? ji : Go; + function t2(c, h) { + var y = ir(c) ? qi : Jo; return y(c, Ut(h, 3)); } - function qw(c, h) { - var y = ir(c) ? iA : By; + function r2(c, h) { + var y = ir(c) ? DA : Zy; return y(c, Ut(h, 3)); } - var jI = jh(function(c, h, y) { - Tr.call(c, y) ? c[y].push(h) : ao(c, y, [h]); + var pC = Yh(function(c, h, y) { + Tr.call(c, y) ? c[y].push(h) : fo(c, y, [h]); }); - function UI(c, h, y, O) { - c = li(c) ? c : Uc(c), y = y && !O ? cr(y) : 0; - var z = c.length; - return y < 0 && (y = _n(z + y, 0)), ed(c) ? y <= z && c.indexOf(h, y) > -1 : !!z && Cc(c, h, y) > -1; - } - var qI = hr(function(c, h, y) { - var O = -1, z = typeof h == "function", ne = li(c) ? Ie(c.length) : []; - return Go(c, function(fe) { - ne[++O] = z ? Pn(h, fe, y) : cf(fe, h, y); + function gC(c, h, y, N) { + c = hi(c) ? c : Xc(c), y = y && !N ? cr(y) : 0; + var W = c.length; + return y < 0 && (y = En(W + y, 0)), ud(c) ? y <= W && c.indexOf(h, y) > -1 : !!W && Fc(c, h, y) > -1; + } + var mC = hr(function(c, h, y) { + var N = -1, W = typeof h == "function", ne = hi(c) ? Ie(c.length) : []; + return Jo(c, function(fe) { + ne[++N] = W ? Pn(h, fe, y) : gf(fe, h, y); }), ne; - }), zI = jh(function(c, h, y) { - ao(c, y, h); + }), vC = Yh(function(c, h, y) { + fo(c, y, h); }); - function Yh(c, h) { - var y = ir(c) ? Xr : Hy; + function id(c, h) { + var y = ir(c) ? Xr : sw; return y(c, Ut(h, 3)); } - function WI(c, h, y, O) { - return c == null ? [] : (ir(h) || (h = h == null ? [] : [h]), y = O ? r : y, ir(y) || (y = y == null ? [] : [y]), Yy(c, h, y)); + function bC(c, h, y, N) { + return c == null ? [] : (ir(h) || (h = h == null ? [] : [h]), y = N ? r : y, ir(y) || (y = y == null ? [] : [y]), uw(c, h, y)); } - var HI = jh(function(c, h, y) { + var yC = Yh(function(c, h, y) { c[y ? 0 : 1].push(h); }, function() { return [[], []]; }); - function KI(c, h, y) { - var O = ir(c) ? kp : yy, z = arguments.length < 3; - return O(c, Ut(h, 4), y, z, Go); + function wC(c, h, y) { + var N = ir(c) ? Jp : Oy, W = arguments.length < 3; + return N(c, Ut(h, 4), y, W, Jo); } - function VI(c, h, y) { - var O = ir(c) ? sA : yy, z = arguments.length < 3; - return O(c, Ut(h, 4), y, z, By); + function xC(c, h, y) { + var N = ir(c) ? OA : Oy, W = arguments.length < 3; + return N(c, Ut(h, 4), y, W, Zy); } - function GI(c, h) { - var y = ir(c) ? Wo : Fy; - return y(c, Zh(Ut(h, 3))); + function _C(c, h) { + var y = ir(c) ? Ko : Qy; + return y(c, ad(Ut(h, 3))); } - function YI(c) { - var h = ir(c) ? Ny : UP; + function EC(c) { + var h = ir(c) ? Gy : gM; return h(c); } - function JI(c, h, y) { - (y ? ni(c, h, y) : h === r) ? h = 1 : h = cr(h); - var O = ir(c) ? bP : qP; - return O(c, h); + function SC(c, h, y) { + (y ? ii(c, h, y) : h === r) ? h = 1 : h = cr(h); + var N = ir(c) ? KP : mM; + return N(c, h); } - function XI(c) { - var h = ir(c) ? yP : WP; + function AC(c) { + var h = ir(c) ? VP : bM; return h(c); } - function ZI(c) { + function PC(c) { if (c == null) return 0; - if (li(c)) - return ed(c) ? Rc(c) : c.length; + if (hi(c)) + return ud(c) ? Uc(c) : c.length; var h = Vn(c); - return h == ie || h == Me ? c.size : tg(c).length; + return h == ie || h == Me ? c.size : gg(c).length; } - function QI(c, h, y) { - var O = ir(c) ? $p : HP; - return y && ni(c, h, y) && (h = r), O(c, Ut(h, 3)); + function MC(c, h, y) { + var N = ir(c) ? Xp : yM; + return y && ii(c, h, y) && (h = r), N(c, Ut(h, 3)); } - var eC = hr(function(c, h) { + var IC = hr(function(c, h) { if (c == null) return []; var y = h.length; - return y > 1 && ni(c, h[0], h[1]) ? h = [] : y > 2 && ni(h[0], h[1], h[2]) && (h = [h[0]]), Yy(c, Bn(h, 1), []); - }), Jh = NA || function() { - return _r.Date.now(); + return y > 1 && ii(c, h[0], h[1]) ? h = [] : y > 2 && ii(h[0], h[1], h[2]) && (h = [h[0]]), uw(c, Bn(h, 1), []); + }), sd = cP || function() { + return Er.Date.now(); }; - function tC(c, h) { + function CC(c, h) { if (typeof h != "function") - throw new Ui(o); + throw new zi(o); return c = cr(c), function() { if (--c < 1) return h.apply(this, arguments); }; } - function zw(c, h, y) { - return h = y ? r : h, h = c && h == null ? c.length : h, co(c, R, r, r, r, r, h); + function n2(c, h, y) { + return h = y ? r : h, h = c && h == null ? c.length : h, lo(c, R, r, r, r, r, h); } - function Ww(c, h) { + function i2(c, h) { var y; if (typeof h != "function") - throw new Ui(o); + throw new zi(o); return c = cr(c), function() { return --c > 0 && (y = h.apply(this, arguments)), c <= 1 && (h = r), y; }; } - var Ag = hr(function(c, h, y) { - var O = L; + var Fg = hr(function(c, h, y) { + var N = L; if (y.length) { - var z = Ko(y, Fc(Ag)); - O |= V; + var W = Go(y, Yc(Fg)); + N |= V; } - return co(c, O, h, y, z); - }), Hw = hr(function(c, h, y) { - var O = L | B; + return lo(c, N, h, y, W); + }), s2 = hr(function(c, h, y) { + var N = L | B; if (y.length) { - var z = Ko(y, Fc(Hw)); - O |= V; + var W = Go(y, Yc(s2)); + N |= V; } - return co(h, O, c, y, z); + return lo(h, N, c, y, W); }); - function Kw(c, h, y) { + function o2(c, h, y) { h = y ? r : h; - var O = co(c, H, r, r, r, r, r, h); - return O.placeholder = Kw.placeholder, O; + var N = lo(c, q, r, r, r, r, r, h); + return N.placeholder = o2.placeholder, N; } - function Vw(c, h, y) { + function a2(c, h, y) { h = y ? r : h; - var O = co(c, U, r, r, r, r, r, h); - return O.placeholder = Vw.placeholder, O; + var N = lo(c, U, r, r, r, r, r, h); + return N.placeholder = a2.placeholder, N; } - function Gw(c, h, y) { - var O, z, ne, fe, me, we, We = 0, He = !1, Xe = !1, wt = !0; + function c2(c, h, y) { + var N, W, ne, fe, me, we, We = 0, He = !1, Xe = !1, wt = !0; if (typeof c != "function") - throw new Ui(o); - h = Ki(h) || 0, Zr(y) && (He = !!y.leading, Xe = "maxWait" in y, ne = Xe ? _n(Ki(y.maxWait) || 0, h) : ne, wt = "trailing" in y ? !!y.trailing : wt); + throw new zi(o); + h = Gi(h) || 0, Zr(y) && (He = !!y.leading, Xe = "maxWait" in y, ne = Xe ? En(Gi(y.maxWait) || 0, h) : ne, wt = "trailing" in y ? !!y.trailing : wt); function Ot(un) { - var ps = O, po = z; - return O = z = r, We = un, fe = c.apply(po, ps), fe; + var ms = N, vo = W; + return N = W = r, We = un, fe = c.apply(vo, ms), fe; } function Ht(un) { - return We = un, me = df(vr, h), He ? Ot(un) : fe; + return We = un, me = wf(br, h), He ? Ot(un) : fe; } function fr(un) { - var ps = un - we, po = un - We, d2 = h - ps; - return Xe ? Kn(d2, ne - po) : d2; + var ms = un - we, vo = un - We, M2 = h - ms; + return Xe ? Kn(M2, ne - vo) : M2; } function Kt(un) { - var ps = un - we, po = un - We; - return we === r || ps >= h || ps < 0 || Xe && po >= ne; + var ms = un - we, vo = un - We; + return we === r || ms >= h || ms < 0 || Xe && vo >= ne; } - function vr() { - var un = Jh(); + function br() { + var un = sd(); if (Kt(un)) - return Er(un); - me = df(vr, fr(un)); + return Sr(un); + me = wf(br, fr(un)); } - function Er(un) { - return me = r, wt && O ? Ot(un) : (O = z = r, fe); + function Sr(un) { + return me = r, wt && N ? Ot(un) : (N = W = r, fe); } - function Ci() { - me !== r && iw(me), We = 0, O = we = z = me = r; + function Ti() { + me !== r && bw(me), We = 0, N = we = W = me = r; } - function ii() { - return me === r ? fe : Er(Jh()); + function si() { + return me === r ? fe : Sr(sd()); } - function Ti() { - var un = Jh(), ps = Kt(un); - if (O = arguments, z = this, we = un, ps) { + function Ri() { + var un = sd(), ms = Kt(un); + if (N = arguments, W = this, we = un, ms) { if (me === r) return Ht(we); if (Xe) - return iw(me), me = df(vr, h), Ot(we); + return bw(me), me = wf(br, h), Ot(we); } - return me === r && (me = df(vr, h)), fe; + return me === r && (me = wf(br, h)), fe; } - return Ti.cancel = Ci, Ti.flush = ii, Ti; + return Ri.cancel = Ti, Ri.flush = si, Ri; } - var rC = hr(function(c, h) { - return $y(c, 1, h); - }), nC = hr(function(c, h, y) { - return $y(c, Ki(h) || 0, y); + var TC = hr(function(c, h) { + return Xy(c, 1, h); + }), RC = hr(function(c, h, y) { + return Xy(c, Gi(h) || 0, y); }); - function iC(c) { - return co(c, ge); + function DC(c) { + return lo(c, ge); } - function Xh(c, h) { + function od(c, h) { if (typeof c != "function" || h != null && typeof h != "function") - throw new Ui(o); + throw new zi(o); var y = function() { - var O = arguments, z = h ? h.apply(this, O) : O[0], ne = y.cache; - if (ne.has(z)) - return ne.get(z); - var fe = c.apply(this, O); - return y.cache = ne.set(z, fe) || ne, fe; + var N = arguments, W = h ? h.apply(this, N) : N[0], ne = y.cache; + if (ne.has(W)) + return ne.get(W); + var fe = c.apply(this, N); + return y.cache = ne.set(W, fe) || ne, fe; }; - return y.cache = new (Xh.Cache || oo)(), y; + return y.cache = new (od.Cache || uo)(), y; } - Xh.Cache = oo; - function Zh(c) { + od.Cache = uo; + function ad(c) { if (typeof c != "function") - throw new Ui(o); + throw new zi(o); return function() { var h = arguments; switch (h.length) { @@ -23851,142 +24363,142 @@ h0.exports; return !c.apply(this, h); }; } - function sC(c) { - return Ww(2, c); + function OC(c) { + return i2(2, c); } - var oC = KP(function(c, h) { - h = h.length == 1 && ir(h[0]) ? Xr(h[0], Pi(Ut())) : Xr(Bn(h, 1), Pi(Ut())); + var NC = wM(function(c, h) { + h = h.length == 1 && ir(h[0]) ? Xr(h[0], Mi(Ut())) : Xr(Bn(h, 1), Mi(Ut())); var y = h.length; - return hr(function(O) { - for (var z = -1, ne = Kn(O.length, y); ++z < ne; ) - O[z] = h[z].call(this, O[z]); - return Pn(c, this, O); + return hr(function(N) { + for (var W = -1, ne = Kn(N.length, y); ++W < ne; ) + N[W] = h[W].call(this, N[W]); + return Pn(c, this, N); }); - }), Pg = hr(function(c, h) { - var y = Ko(h, Fc(Pg)); - return co(c, V, r, h, y); - }), Yw = hr(function(c, h) { - var y = Ko(h, Fc(Yw)); - return co(c, te, r, h, y); - }), aC = uo(function(c, h) { - return co(c, K, r, r, r, h); + }), jg = hr(function(c, h) { + var y = Go(h, Yc(jg)); + return lo(c, V, r, h, y); + }), u2 = hr(function(c, h) { + var y = Go(h, Yc(u2)); + return lo(c, Q, r, h, y); + }), LC = ho(function(c, h) { + return lo(c, K, r, r, r, h); }); - function cC(c, h) { + function kC(c, h) { if (typeof c != "function") - throw new Ui(o); + throw new zi(o); return h = h === r ? h : cr(h), hr(c, h); } - function uC(c, h) { + function $C(c, h) { if (typeof c != "function") - throw new Ui(o); - return h = h == null ? 0 : _n(cr(h), 0), hr(function(y) { - var O = y[h], z = Xo(y, 0, h); - return O && Ho(z, O), Pn(c, this, z); + throw new zi(o); + return h = h == null ? 0 : En(cr(h), 0), hr(function(y) { + var N = y[h], W = Qo(y, 0, h); + return N && Vo(W, N), Pn(c, this, W); }); } - function fC(c, h, y) { - var O = !0, z = !0; + function BC(c, h, y) { + var N = !0, W = !0; if (typeof c != "function") - throw new Ui(o); - return Zr(y) && (O = "leading" in y ? !!y.leading : O, z = "trailing" in y ? !!y.trailing : z), Gw(c, h, { - leading: O, + throw new zi(o); + return Zr(y) && (N = "leading" in y ? !!y.leading : N, W = "trailing" in y ? !!y.trailing : W), c2(c, h, { + leading: N, maxWait: h, - trailing: z + trailing: W }); } - function lC(c) { - return zw(c, 1); + function FC(c) { + return n2(c, 1); } - function hC(c, h) { - return Pg(fg(h), c); + function jC(c, h) { + return jg(Sg(h), c); } - function dC() { + function UC() { if (!arguments.length) return []; var c = arguments[0]; return ir(c) ? c : [c]; } - function pC(c) { - return zi(c, A); + function qC(c) { + return Hi(c, _); } - function gC(c, h) { - return h = typeof h == "function" ? h : r, zi(c, A, h); + function zC(c, h) { + return h = typeof h == "function" ? h : r, Hi(c, _, h); } - function mC(c) { - return zi(c, p | A); + function WC(c) { + return Hi(c, p | _); } - function vC(c, h) { - return h = typeof h == "function" ? h : r, zi(c, p | A, h); + function HC(c, h) { + return h = typeof h == "function" ? h : r, Hi(c, p | _, h); } - function bC(c, h) { - return h == null || ky(c, h, Mn(h)); + function KC(c, h) { + return h == null || Jy(c, h, Mn(h)); } - function ds(c, h) { + function gs(c, h) { return c === h || c !== c && h !== h; } - var yC = Wh(Zp), wC = Wh(function(c, h) { + var VC = Qh(hg), GC = Qh(function(c, h) { return c >= h; - }), Ua = qy(/* @__PURE__ */ function() { + }), Va = rw(/* @__PURE__ */ function() { return arguments; - }()) ? qy : function(c) { - return en(c) && Tr.call(c, "callee") && !Iy.call(c, "callee"); - }, ir = Ie.isArray, xC = ti ? Pi(ti) : CP; - function li(c) { - return c != null && Qh(c.length) && !lo(c); + }()) ? rw : function(c) { + return en(c) && Tr.call(c, "callee") && !qy.call(c, "callee"); + }, ir = Ie.isArray, YC = ri ? Mi(ri) : nM; + function hi(c) { + return c != null && cd(c.length) && !go(c); } function cn(c) { - return en(c) && li(c); + return en(c) && hi(c); } - function _C(c) { - return c === !0 || c === !1 || en(c) && ri(c) == J; + function JC(c) { + return c === !0 || c === !1 || en(c) && ni(c) == J; } - var Zo = kA || $g, EC = fs ? Pi(fs) : TP; - function SC(c) { - return en(c) && c.nodeType === 1 && !pf(c); + var ea = fP || Xg, XC = hs ? Mi(hs) : iM; + function ZC(c) { + return en(c) && c.nodeType === 1 && !xf(c); } - function AC(c) { + function QC(c) { if (c == null) return !0; - if (li(c) && (ir(c) || typeof c == "string" || typeof c.splice == "function" || Zo(c) || jc(c) || Ua(c))) + if (hi(c) && (ir(c) || typeof c == "string" || typeof c.splice == "function" || ea(c) || Jc(c) || Va(c))) return !c.length; var h = Vn(c); if (h == ie || h == Me) return !c.size; - if (hf(c)) - return !tg(c).length; + if (yf(c)) + return !gg(c).length; for (var y in c) if (Tr.call(c, y)) return !1; return !0; } - function PC(c, h) { - return uf(c, h); + function eT(c, h) { + return mf(c, h); } - function MC(c, h, y) { + function tT(c, h, y) { y = typeof y == "function" ? y : r; - var O = y ? y(c, h) : r; - return O === r ? uf(c, h, r, y) : !!O; + var N = y ? y(c, h) : r; + return N === r ? mf(c, h, r, y) : !!N; } - function Mg(c) { + function Ug(c) { if (!en(c)) return !1; - var h = ri(c); - return h == X || h == T || typeof c.message == "string" && typeof c.name == "string" && !pf(c); + var h = ni(c); + return h == X || h == T || typeof c.message == "string" && typeof c.name == "string" && !xf(c); } - function IC(c) { - return typeof c == "number" && Ty(c); + function rT(c) { + return typeof c == "number" && Wy(c); } - function lo(c) { + function go(c) { if (!Zr(c)) return !1; - var h = ri(c); + var h = ni(c); return h == re || h == pe || h == Z || h == Ce; } - function Jw(c) { + function f2(c) { return typeof c == "number" && c == cr(c); } - function Qh(c) { - return typeof c == "number" && c > -1 && c % 1 == 0 && c <= _; + function cd(c) { + return typeof c == "number" && c > -1 && c % 1 == 0 && c <= E; } function Zr(c) { var h = typeof c; @@ -23995,93 +24507,93 @@ h0.exports; function en(c) { return c != null && typeof c == "object"; } - var Xw = Fi ? Pi(Fi) : DP; - function CC(c, h) { - return c === h || eg(c, h, vg(h)); + var l2 = Ui ? Mi(Ui) : oM; + function nT(c, h) { + return c === h || pg(c, h, Rg(h)); } - function TC(c, h, y) { - return y = typeof y == "function" ? y : r, eg(c, h, vg(h), y); + function iT(c, h, y) { + return y = typeof y == "function" ? y : r, pg(c, h, Rg(h), y); } - function RC(c) { - return Zw(c) && c != +c; + function sT(c) { + return h2(c) && c != +c; } - function DC(c) { - if (gM(c)) + function oT(c) { + if (zM(c)) throw new tr(s); - return zy(c); + return nw(c); } - function OC(c) { + function aT(c) { return c === null; } - function NC(c) { + function cT(c) { return c == null; } - function Zw(c) { - return typeof c == "number" || en(c) && ri(c) == ue; + function h2(c) { + return typeof c == "number" || en(c) && ni(c) == ue; } - function pf(c) { - if (!en(c) || ri(c) != Pe) + function xf(c) { + if (!en(c) || ni(c) != Pe) return !1; - var h = Ph(c); + var h = Lh(c); if (h === null) return !0; var y = Tr.call(h, "constructor") && h.constructor; - return typeof y == "function" && y instanceof y && _h.call(y) == TA; + return typeof y == "function" && y instanceof y && Rh.call(y) == iP; } - var Ig = Is ? Pi(Is) : OP; - function LC(c) { - return Jw(c) && c >= -_ && c <= _; + var qg = Ds ? Mi(Ds) : aM; + function uT(c) { + return f2(c) && c >= -E && c <= E; } - var Qw = Zu ? Pi(Zu) : NP; - function ed(c) { - return typeof c == "string" || !ir(c) && en(c) && ri(c) == Ne; + var d2 = of ? Mi(of) : cM; + function ud(c) { + return typeof c == "string" || !ir(c) && en(c) && ni(c) == Ne; } - function Ii(c) { - return typeof c == "symbol" || en(c) && ri(c) == Ke; + function Ci(c) { + return typeof c == "symbol" || en(c) && ni(c) == Ke; } - var jc = Oa ? Pi(Oa) : LP; - function kC(c) { + var Jc = Fa ? Mi(Fa) : uM; + function fT(c) { return c === r; } - function $C(c) { + function lT(c) { return en(c) && Vn(c) == qe; } - function BC(c) { - return en(c) && ri(c) == ze; + function hT(c) { + return en(c) && ni(c) == ze; } - var FC = Wh(rg), jC = Wh(function(c, h) { + var dT = Qh(mg), pT = Qh(function(c, h) { return c <= h; }); - function e2(c) { + function p2(c) { if (!c) return []; - if (li(c)) - return ed(c) ? ls(c) : fi(c); - if (ef && c[ef]) - return bA(c[ef]()); - var h = Vn(c), y = h == ie ? zp : h == Me ? yh : Uc; + if (hi(c)) + return ud(c) ? ds(c) : li(c); + if (cf && c[cf]) + return KA(c[cf]()); + var h = Vn(c), y = h == ie ? ng : h == Me ? Ih : Xc; return y(c); } - function ho(c) { + function mo(c) { if (!c) return c === 0 ? c : 0; - if (c = Ki(c), c === x || c === -x) { + if (c = Gi(c), c === x || c === -x) { var h = c < 0 ? -1 : 1; - return h * E; + return h * S; } return c === c ? c : 0; } function cr(c) { - var h = ho(c), y = h % 1; + var h = mo(c), y = h % 1; return h === h ? y ? h - y : h : 0; } - function t2(c) { - return c ? $a(cr(c), 0, P) : 0; + function g2(c) { + return c ? za(cr(c), 0, M) : 0; } - function Ki(c) { + function Gi(c) { if (typeof c == "number") return c; - if (Ii(c)) + if (Ci(c)) return v; if (Zr(c)) { var h = typeof c.valueOf == "function" ? c.valueOf() : c; @@ -24089,279 +24601,279 @@ h0.exports; } if (typeof c != "string") return c === 0 ? c : +c; - c = wy(c); + c = Ny(c); var y = nt.test(c); return y || pt.test(c) ? nr(c.slice(2), y ? 2 : 8) : Re.test(c) ? v : +c; } - function r2(c) { - return Ts(c, hi(c)); + function m2(c) { + return Ns(c, di(c)); } - function UC(c) { - return c ? $a(cr(c), -_, _) : c === 0 ? c : 0; + function gT(c) { + return c ? za(cr(c), -E, E) : c === 0 ? c : 0; } function Cr(c) { - return c == null ? "" : Mi(c); + return c == null ? "" : Ii(c); } - var qC = $c(function(c, h) { - if (hf(h) || li(h)) { - Ts(h, Mn(h), c); + var mT = Vc(function(c, h) { + if (yf(h) || hi(h)) { + Ns(h, Mn(h), c); return; } for (var y in h) - Tr.call(h, y) && of(c, y, h[y]); - }), n2 = $c(function(c, h) { - Ts(h, hi(h), c); - }), td = $c(function(c, h, y, O) { - Ts(h, hi(h), c, O); - }), zC = $c(function(c, h, y, O) { - Ts(h, Mn(h), c, O); - }), WC = uo(Yp); - function HC(c, h) { - var y = kc(c); - return h == null ? y : Ly(y, h); - } - var KC = hr(function(c, h) { + Tr.call(h, y) && df(c, y, h[y]); + }), v2 = Vc(function(c, h) { + Ns(h, di(h), c); + }), fd = Vc(function(c, h, y, N) { + Ns(h, di(h), c, N); + }), vT = Vc(function(c, h, y, N) { + Ns(h, Mn(h), c, N); + }), bT = ho(ug); + function yT(c, h) { + var y = Kc(c); + return h == null ? y : Yy(y, h); + } + var wT = hr(function(c, h) { c = qr(c); - var y = -1, O = h.length, z = O > 2 ? h[2] : r; - for (z && ni(h[0], h[1], z) && (O = 1); ++y < O; ) - for (var ne = h[y], fe = hi(ne), me = -1, we = fe.length; ++me < we; ) { + var y = -1, N = h.length, W = N > 2 ? h[2] : r; + for (W && ii(h[0], h[1], W) && (N = 1); ++y < N; ) + for (var ne = h[y], fe = di(ne), me = -1, we = fe.length; ++me < we; ) { var We = fe[me], He = c[We]; - (He === r || ds(He, Oc[We]) && !Tr.call(c, We)) && (c[We] = ne[We]); + (He === r || gs(He, zc[We]) && !Tr.call(c, We)) && (c[We] = ne[We]); } return c; - }), VC = hr(function(c) { - return c.push(r, ww), Pn(i2, r, c); + }), xT = hr(function(c) { + return c.push(r, Nw), Pn(b2, r, c); }); - function GC(c, h) { - return my(c, Ut(h, 3), Cs); + function _T(c, h) { + return Ty(c, Ut(h, 3), Os); } - function YC(c, h) { - return my(c, Ut(h, 3), Xp); + function ET(c, h) { + return Ty(c, Ut(h, 3), lg); } - function JC(c, h) { - return c == null ? c : Jp(c, Ut(h, 3), hi); + function ST(c, h) { + return c == null ? c : fg(c, Ut(h, 3), di); } - function XC(c, h) { - return c == null ? c : jy(c, Ut(h, 3), hi); + function AT(c, h) { + return c == null ? c : ew(c, Ut(h, 3), di); } - function ZC(c, h) { - return c && Cs(c, Ut(h, 3)); + function PT(c, h) { + return c && Os(c, Ut(h, 3)); } - function QC(c, h) { - return c && Xp(c, Ut(h, 3)); + function MT(c, h) { + return c && lg(c, Ut(h, 3)); } - function eT(c) { - return c == null ? [] : kh(c, Mn(c)); + function IT(c) { + return c == null ? [] : Hh(c, Mn(c)); } - function tT(c) { - return c == null ? [] : kh(c, hi(c)); + function CT(c) { + return c == null ? [] : Hh(c, di(c)); } - function Cg(c, h, y) { - var O = c == null ? r : Ba(c, h); - return O === r ? y : O; + function zg(c, h, y) { + var N = c == null ? r : Wa(c, h); + return N === r ? y : N; } - function rT(c, h) { - return c != null && Ew(c, h, AP); + function TT(c, h) { + return c != null && $w(c, h, QP); } - function Tg(c, h) { - return c != null && Ew(c, h, PP); + function Wg(c, h) { + return c != null && $w(c, h, eM); } - var nT = gw(function(c, h, y) { - h != null && typeof h.toString != "function" && (h = Eh.call(h)), c[h] = y; - }, Dg(di)), iT = gw(function(c, h, y) { - h != null && typeof h.toString != "function" && (h = Eh.call(h)), Tr.call(c, h) ? c[h].push(y) : c[h] = [y]; - }, Ut), sT = hr(cf); + var RT = Cw(function(c, h, y) { + h != null && typeof h.toString != "function" && (h = Dh.call(h)), c[h] = y; + }, Kg(pi)), DT = Cw(function(c, h, y) { + h != null && typeof h.toString != "function" && (h = Dh.call(h)), Tr.call(c, h) ? c[h].push(y) : c[h] = [y]; + }, Ut), OT = hr(gf); function Mn(c) { - return li(c) ? Oy(c) : tg(c); + return hi(c) ? Vy(c) : gg(c); } - function hi(c) { - return li(c) ? Oy(c, !0) : kP(c); + function di(c) { + return hi(c) ? Vy(c, !0) : fM(c); } - function oT(c, h) { + function NT(c, h) { var y = {}; - return h = Ut(h, 3), Cs(c, function(O, z, ne) { - ao(y, h(O, z, ne), O); + return h = Ut(h, 3), Os(c, function(N, W, ne) { + fo(y, h(N, W, ne), N); }), y; } - function aT(c, h) { + function LT(c, h) { var y = {}; - return h = Ut(h, 3), Cs(c, function(O, z, ne) { - ao(y, z, h(O, z, ne)); + return h = Ut(h, 3), Os(c, function(N, W, ne) { + fo(y, W, h(N, W, ne)); }), y; } - var cT = $c(function(c, h, y) { - $h(c, h, y); - }), i2 = $c(function(c, h, y, O) { - $h(c, h, y, O); - }), uT = uo(function(c, h) { + var kT = Vc(function(c, h, y) { + Kh(c, h, y); + }), b2 = Vc(function(c, h, y, N) { + Kh(c, h, y, N); + }), $T = ho(function(c, h) { var y = {}; if (c == null) return y; - var O = !1; + var N = !1; h = Xr(h, function(ne) { - return ne = Jo(ne, c), O || (O = ne.length > 1), ne; - }), Ts(c, gg(c), y), O && (y = zi(y, p | w | A, nM)); - for (var z = h.length; z--; ) - ag(y, h[z]); + return ne = Zo(ne, c), N || (N = ne.length > 1), ne; + }), Ns(c, Cg(c), y), N && (y = Hi(y, p | w | _, RM)); + for (var W = h.length; W--; ) + xg(y, h[W]); return y; }); - function fT(c, h) { - return s2(c, Zh(Ut(h))); + function BT(c, h) { + return y2(c, ad(Ut(h))); } - var lT = uo(function(c, h) { - return c == null ? {} : BP(c, h); + var FT = ho(function(c, h) { + return c == null ? {} : hM(c, h); }); - function s2(c, h) { + function y2(c, h) { if (c == null) return {}; - var y = Xr(gg(c), function(O) { - return [O]; + var y = Xr(Cg(c), function(N) { + return [N]; }); - return h = Ut(h), Jy(c, y, function(O, z) { - return h(O, z[0]); + return h = Ut(h), fw(c, y, function(N, W) { + return h(N, W[0]); }); } - function hT(c, h, y) { - h = Jo(h, c); - var O = -1, z = h.length; - for (z || (z = 1, c = r); ++O < z; ) { - var ne = c == null ? r : c[Rs(h[O])]; - ne === r && (O = z, ne = y), c = lo(ne) ? ne.call(c) : ne; + function jT(c, h, y) { + h = Zo(h, c); + var N = -1, W = h.length; + for (W || (W = 1, c = r); ++N < W; ) { + var ne = c == null ? r : c[Ls(h[N])]; + ne === r && (N = W, ne = y), c = go(ne) ? ne.call(c) : ne; } return c; } - function dT(c, h, y) { - return c == null ? c : ff(c, h, y); + function UT(c, h, y) { + return c == null ? c : vf(c, h, y); } - function pT(c, h, y, O) { - return O = typeof O == "function" ? O : r, c == null ? c : ff(c, h, y, O); + function qT(c, h, y, N) { + return N = typeof N == "function" ? N : r, c == null ? c : vf(c, h, y, N); } - var o2 = bw(Mn), a2 = bw(hi); - function gT(c, h, y) { - var O = ir(c), z = O || Zo(c) || jc(c); + var w2 = Dw(Mn), x2 = Dw(di); + function zT(c, h, y) { + var N = ir(c), W = N || ea(c) || Jc(c); if (h = Ut(h, 4), y == null) { var ne = c && c.constructor; - z ? y = O ? new ne() : [] : Zr(c) ? y = lo(ne) ? kc(Ph(c)) : {} : y = {}; + W ? y = N ? new ne() : [] : Zr(c) ? y = go(ne) ? Kc(Lh(c)) : {} : y = {}; } - return (z ? ji : Cs)(c, function(fe, me, we) { + return (W ? qi : Os)(c, function(fe, me, we) { return h(y, fe, me, we); }), y; } - function mT(c, h) { - return c == null ? !0 : ag(c, h); + function WT(c, h) { + return c == null ? !0 : xg(c, h); } - function vT(c, h, y) { - return c == null ? c : tw(c, h, fg(y)); + function HT(c, h, y) { + return c == null ? c : gw(c, h, Sg(y)); } - function bT(c, h, y, O) { - return O = typeof O == "function" ? O : r, c == null ? c : tw(c, h, fg(y), O); + function KT(c, h, y, N) { + return N = typeof N == "function" ? N : r, c == null ? c : gw(c, h, Sg(y), N); } - function Uc(c) { - return c == null ? [] : qp(c, Mn(c)); + function Xc(c) { + return c == null ? [] : rg(c, Mn(c)); } - function yT(c) { - return c == null ? [] : qp(c, hi(c)); + function VT(c) { + return c == null ? [] : rg(c, di(c)); } - function wT(c, h, y) { - return y === r && (y = h, h = r), y !== r && (y = Ki(y), y = y === y ? y : 0), h !== r && (h = Ki(h), h = h === h ? h : 0), $a(Ki(c), h, y); + function GT(c, h, y) { + return y === r && (y = h, h = r), y !== r && (y = Gi(y), y = y === y ? y : 0), h !== r && (h = Gi(h), h = h === h ? h : 0), za(Gi(c), h, y); } - function xT(c, h, y) { - return h = ho(h), y === r ? (y = h, h = 0) : y = ho(y), c = Ki(c), MP(c, h, y); + function YT(c, h, y) { + return h = mo(h), y === r ? (y = h, h = 0) : y = mo(y), c = Gi(c), tM(c, h, y); } - function _T(c, h, y) { - if (y && typeof y != "boolean" && ni(c, h, y) && (h = y = r), y === r && (typeof h == "boolean" ? (y = h, h = r) : typeof c == "boolean" && (y = c, c = r)), c === r && h === r ? (c = 0, h = 1) : (c = ho(c), h === r ? (h = c, c = 0) : h = ho(h)), c > h) { - var O = c; - c = h, h = O; + function JT(c, h, y) { + if (y && typeof y != "boolean" && ii(c, h, y) && (h = y = r), y === r && (typeof h == "boolean" ? (y = h, h = r) : typeof c == "boolean" && (y = c, c = r)), c === r && h === r ? (c = 0, h = 1) : (c = mo(c), h === r ? (h = c, c = 0) : h = mo(h)), c > h) { + var N = c; + c = h, h = N; } if (y || c % 1 || h % 1) { - var z = Ry(); - return Kn(c + z * (h - c + jr("1e-" + ((z + "").length - 1))), h); + var W = Hy(); + return Kn(c + W * (h - c + jr("1e-" + ((W + "").length - 1))), h); } - return ig(c, h); + return bg(c, h); } - var ET = Bc(function(c, h, y) { - return h = h.toLowerCase(), c + (y ? c2(h) : h); + var XT = Gc(function(c, h, y) { + return h = h.toLowerCase(), c + (y ? _2(h) : h); }); - function c2(c) { - return Rg(Cr(c).toLowerCase()); + function _2(c) { + return Hg(Cr(c).toLowerCase()); } - function u2(c) { - return c = Cr(c), c && c.replace(et, dA).replace(Op, ""); + function E2(c) { + return c = Cr(c), c && c.replace(et, UA).replace(Vp, ""); } - function ST(c, h, y) { - c = Cr(c), h = Mi(h); - var O = c.length; - y = y === r ? O : $a(cr(y), 0, O); - var z = y; - return y -= h.length, y >= 0 && c.slice(y, z) == h; + function ZT(c, h, y) { + c = Cr(c), h = Ii(h); + var N = c.length; + y = y === r ? N : za(cr(y), 0, N); + var W = y; + return y -= h.length, y >= 0 && c.slice(y, W) == h; } - function AT(c) { - return c = Cr(c), c && Ct.test(c) ? c.replace(Dt, pA) : c; + function QT(c) { + return c = Cr(c), c && Ct.test(c) ? c.replace(Dt, qA) : c; } - function PT(c) { + function eR(c) { return c = Cr(c), c && Bt.test(c) ? c.replace(rt, "\\$&") : c; } - var MT = Bc(function(c, h, y) { + var tR = Gc(function(c, h, y) { return c + (y ? "-" : "") + h.toLowerCase(); - }), IT = Bc(function(c, h, y) { + }), rR = Gc(function(c, h, y) { return c + (y ? " " : "") + h.toLowerCase(); - }), CT = hw("toLowerCase"); - function TT(c, h, y) { + }), nR = Pw("toLowerCase"); + function iR(c, h, y) { c = Cr(c), h = cr(h); - var O = h ? Rc(c) : 0; - if (!h || O >= h) + var N = h ? Uc(c) : 0; + if (!h || N >= h) return c; - var z = (h - O) / 2; - return zh(Th(z), y) + c + zh(Ch(z), y); + var W = (h - N) / 2; + return Zh(Fh(W), y) + c + Zh(Bh(W), y); } - function RT(c, h, y) { + function sR(c, h, y) { c = Cr(c), h = cr(h); - var O = h ? Rc(c) : 0; - return h && O < h ? c + zh(h - O, y) : c; + var N = h ? Uc(c) : 0; + return h && N < h ? c + Zh(h - N, y) : c; } - function DT(c, h, y) { + function oR(c, h, y) { c = Cr(c), h = cr(h); - var O = h ? Rc(c) : 0; - return h && O < h ? zh(h - O, y) + c : c; + var N = h ? Uc(c) : 0; + return h && N < h ? Zh(h - N, y) + c : c; } - function OT(c, h, y) { - return y || h == null ? h = 0 : h && (h = +h), jA(Cr(c).replace(k, ""), h || 0); + function aR(c, h, y) { + return y || h == null ? h = 0 : h && (h = +h), pP(Cr(c).replace($, ""), h || 0); } - function NT(c, h, y) { - return (y ? ni(c, h, y) : h === r) ? h = 1 : h = cr(h), sg(Cr(c), h); + function cR(c, h, y) { + return (y ? ii(c, h, y) : h === r) ? h = 1 : h = cr(h), yg(Cr(c), h); } - function LT() { + function uR() { var c = arguments, h = Cr(c[0]); return c.length < 3 ? h : h.replace(c[1], c[2]); } - var kT = Bc(function(c, h, y) { + var fR = Gc(function(c, h, y) { return c + (y ? "_" : "") + h.toLowerCase(); }); - function $T(c, h, y) { - return y && typeof y != "number" && ni(c, h, y) && (h = y = r), y = y === r ? P : y >>> 0, y ? (c = Cr(c), c && (typeof h == "string" || h != null && !Ig(h)) && (h = Mi(h), !h && Tc(c)) ? Xo(ls(c), 0, y) : c.split(h, y)) : []; + function lR(c, h, y) { + return y && typeof y != "number" && ii(c, h, y) && (h = y = r), y = y === r ? M : y >>> 0, y ? (c = Cr(c), c && (typeof h == "string" || h != null && !qg(h)) && (h = Ii(h), !h && jc(c)) ? Qo(ds(c), 0, y) : c.split(h, y)) : []; } - var BT = Bc(function(c, h, y) { - return c + (y ? " " : "") + Rg(h); + var hR = Gc(function(c, h, y) { + return c + (y ? " " : "") + Hg(h); }); - function FT(c, h, y) { - return c = Cr(c), y = y == null ? 0 : $a(cr(y), 0, c.length), h = Mi(h), c.slice(y, y + h.length) == h; + function dR(c, h, y) { + return c = Cr(c), y = y == null ? 0 : za(cr(y), 0, c.length), h = Ii(h), c.slice(y, y + h.length) == h; } - function jT(c, h, y) { - var O = ee.templateSettings; - y && ni(c, h, y) && (h = r), c = Cr(c), h = td({}, h, O, yw); - var z = td({}, h.imports, O.imports, yw), ne = Mn(z), fe = qp(z, ne), me, we, We = 0, He = h.interpolate || St, Xe = "__p += '", wt = Wp( + function pR(c, h, y) { + var N = te.templateSettings; + y && ii(c, h, y) && (h = r), c = Cr(c), h = fd({}, h, N, Ow); + var W = fd({}, h.imports, N.imports, Ow), ne = Mn(W), fe = rg(W, ne), me, we, We = 0, He = h.interpolate || St, Xe = "__p += '", wt = ig( (h.escape || St).source + "|" + He.source + "|" + (He === Nt ? xe : St).source + "|" + (h.evaluate || St).source + "|$", "g" - ), Ot = "//# sourceURL=" + (Tr.call(h, "sourceURL") ? (h.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++Np + "]") + ` + ), Ot = "//# sourceURL=" + (Tr.call(h, "sourceURL") ? (h.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++Gp + "]") + ` `; - c.replace(wt, function(Kt, vr, Er, Ci, ii, Ti) { - return Er || (Er = Ci), Xe += c.slice(We, Ti).replace(Tt, gA), vr && (me = !0, Xe += `' + -__e(` + vr + `) + -'`), ii && (we = !0, Xe += `'; -` + ii + `; -__p += '`), Er && (Xe += `' + -((__t = (` + Er + `)) == null ? '' : __t) + -'`), We = Ti + Kt.length, Kt; + c.replace(wt, function(Kt, br, Sr, Ti, si, Ri) { + return Sr || (Sr = Ti), Xe += c.slice(We, Ri).replace(Tt, zA), br && (me = !0, Xe += `' + +__e(` + br + `) + +'`), si && (we = !0, Xe += `'; +` + si + `; +__p += '`), Sr && (Xe += `' + +((__t = (` + Sr + `)) == null ? '' : __t) + +'`), We = Ri + Kt.length, Kt; }), Xe += `'; `; var Ht = Tr.call(h, "variable") && h.variable; @@ -24379,344 +24891,344 @@ function print() { __p += __j.call(arguments, '') } ` : `; `) + Xe + `return __p }`; - var fr = l2(function() { - return Pr(ne, Ot + "return " + Xe).apply(r, fe); + var fr = A2(function() { + return Mr(ne, Ot + "return " + Xe).apply(r, fe); }); - if (fr.source = Xe, Mg(fr)) + if (fr.source = Xe, Ug(fr)) throw fr; return fr; } - function UT(c) { + function gR(c) { return Cr(c).toLowerCase(); } - function qT(c) { + function mR(c) { return Cr(c).toUpperCase(); } - function zT(c, h, y) { + function vR(c, h, y) { if (c = Cr(c), c && (y || h === r)) - return wy(c); - if (!c || !(h = Mi(h))) + return Ny(c); + if (!c || !(h = Ii(h))) return c; - var O = ls(c), z = ls(h), ne = xy(O, z), fe = _y(O, z) + 1; - return Xo(O, ne, fe).join(""); + var N = ds(c), W = ds(h), ne = Ly(N, W), fe = ky(N, W) + 1; + return Qo(N, ne, fe).join(""); } - function WT(c, h, y) { + function bR(c, h, y) { if (c = Cr(c), c && (y || h === r)) - return c.slice(0, Sy(c) + 1); - if (!c || !(h = Mi(h))) + return c.slice(0, By(c) + 1); + if (!c || !(h = Ii(h))) return c; - var O = ls(c), z = _y(O, ls(h)) + 1; - return Xo(O, 0, z).join(""); + var N = ds(c), W = ky(N, ds(h)) + 1; + return Qo(N, 0, W).join(""); } - function HT(c, h, y) { + function yR(c, h, y) { if (c = Cr(c), c && (y || h === r)) - return c.replace(k, ""); - if (!c || !(h = Mi(h))) + return c.replace($, ""); + if (!c || !(h = Ii(h))) return c; - var O = ls(c), z = xy(O, ls(h)); - return Xo(O, z).join(""); + var N = ds(c), W = Ly(N, ds(h)); + return Qo(N, W).join(""); } - function KT(c, h) { - var y = Ee, O = Y; + function wR(c, h) { + var y = Ee, N = Y; if (Zr(h)) { - var z = "separator" in h ? h.separator : z; - y = "length" in h ? cr(h.length) : y, O = "omission" in h ? Mi(h.omission) : O; + var W = "separator" in h ? h.separator : W; + y = "length" in h ? cr(h.length) : y, N = "omission" in h ? Ii(h.omission) : N; } c = Cr(c); var ne = c.length; - if (Tc(c)) { - var fe = ls(c); + if (jc(c)) { + var fe = ds(c); ne = fe.length; } if (y >= ne) return c; - var me = y - Rc(O); + var me = y - Uc(N); if (me < 1) - return O; - var we = fe ? Xo(fe, 0, me).join("") : c.slice(0, me); - if (z === r) - return we + O; - if (fe && (me += we.length - me), Ig(z)) { - if (c.slice(me).search(z)) { + return N; + var we = fe ? Qo(fe, 0, me).join("") : c.slice(0, me); + if (W === r) + return we + N; + if (fe && (me += we.length - me), qg(W)) { + if (c.slice(me).search(W)) { var We, He = we; - for (z.global || (z = Wp(z.source, Cr(Te.exec(z)) + "g")), z.lastIndex = 0; We = z.exec(He); ) + for (W.global || (W = ig(W.source, Cr(Te.exec(W)) + "g")), W.lastIndex = 0; We = W.exec(He); ) var Xe = We.index; we = we.slice(0, Xe === r ? me : Xe); } - } else if (c.indexOf(Mi(z), me) != me) { - var wt = we.lastIndexOf(z); + } else if (c.indexOf(Ii(W), me) != me) { + var wt = we.lastIndexOf(W); wt > -1 && (we = we.slice(0, wt)); } - return we + O; + return we + N; } - function VT(c) { - return c = Cr(c), c && kt.test(c) ? c.replace(Xt, _A) : c; + function xR(c) { + return c = Cr(c), c && kt.test(c) ? c.replace(Xt, JA) : c; } - var GT = Bc(function(c, h, y) { + var _R = Gc(function(c, h, y) { return c + (y ? " " : "") + h.toUpperCase(); - }), Rg = hw("toUpperCase"); - function f2(c, h, y) { - return c = Cr(c), h = y ? r : h, h === r ? vA(c) ? AA(c) : cA(c) : c.match(h) || []; + }), Hg = Pw("toUpperCase"); + function S2(c, h, y) { + return c = Cr(c), h = y ? r : h, h === r ? HA(c) ? QA(c) : kA(c) : c.match(h) || []; } - var l2 = hr(function(c, h) { + var A2 = hr(function(c, h) { try { return Pn(c, r, h); } catch (y) { - return Mg(y) ? y : new tr(y); + return Ug(y) ? y : new tr(y); } - }), YT = uo(function(c, h) { - return ji(h, function(y) { - y = Rs(y), ao(c, y, Ag(c[y], c)); + }), ER = ho(function(c, h) { + return qi(h, function(y) { + y = Ls(y), fo(c, y, Fg(c[y], c)); }), c; }); - function JT(c) { + function SR(c) { var h = c == null ? 0 : c.length, y = Ut(); - return c = h ? Xr(c, function(O) { - if (typeof O[1] != "function") - throw new Ui(o); - return [y(O[0]), O[1]]; - }) : [], hr(function(O) { - for (var z = -1; ++z < h; ) { - var ne = c[z]; - if (Pn(ne[0], this, O)) - return Pn(ne[1], this, O); + return c = h ? Xr(c, function(N) { + if (typeof N[1] != "function") + throw new zi(o); + return [y(N[0]), N[1]]; + }) : [], hr(function(N) { + for (var W = -1; ++W < h; ) { + var ne = c[W]; + if (Pn(ne[0], this, N)) + return Pn(ne[1], this, N); } }); } - function XT(c) { - return _P(zi(c, p)); + function AR(c) { + return JP(Hi(c, p)); } - function Dg(c) { + function Kg(c) { return function() { return c; }; } - function ZT(c, h) { + function PR(c, h) { return c == null || c !== c ? h : c; } - var QT = pw(), eR = pw(!0); - function di(c) { + var MR = Iw(), IR = Iw(!0); + function pi(c) { return c; } - function Og(c) { - return Wy(typeof c == "function" ? c : zi(c, p)); + function Vg(c) { + return iw(typeof c == "function" ? c : Hi(c, p)); } - function tR(c) { - return Ky(zi(c, p)); + function CR(c) { + return ow(Hi(c, p)); } - function rR(c, h) { - return Vy(c, zi(h, p)); + function TR(c, h) { + return aw(c, Hi(h, p)); } - var nR = hr(function(c, h) { + var RR = hr(function(c, h) { return function(y) { - return cf(y, c, h); + return gf(y, c, h); }; - }), iR = hr(function(c, h) { + }), DR = hr(function(c, h) { return function(y) { - return cf(c, y, h); + return gf(c, y, h); }; }); - function Ng(c, h, y) { - var O = Mn(h), z = kh(h, O); - y == null && !(Zr(h) && (z.length || !O.length)) && (y = h, h = c, c = this, z = kh(h, Mn(h))); - var ne = !(Zr(y) && "chain" in y) || !!y.chain, fe = lo(c); - return ji(z, function(me) { + function Gg(c, h, y) { + var N = Mn(h), W = Hh(h, N); + y == null && !(Zr(h) && (W.length || !N.length)) && (y = h, h = c, c = this, W = Hh(h, Mn(h))); + var ne = !(Zr(y) && "chain" in y) || !!y.chain, fe = go(c); + return qi(W, function(me) { var we = h[me]; c[me] = we, fe && (c.prototype[me] = function() { var We = this.__chain__; if (ne || We) { - var He = c(this.__wrapped__), Xe = He.__actions__ = fi(this.__actions__); + var He = c(this.__wrapped__), Xe = He.__actions__ = li(this.__actions__); return Xe.push({ func: we, args: arguments, thisArg: c }), He.__chain__ = We, He; } - return we.apply(c, Ho([this.value()], arguments)); + return we.apply(c, Vo([this.value()], arguments)); }); }), c; } - function sR() { - return _r._ === this && (_r._ = RA), this; + function OR() { + return Er._ === this && (Er._ = sP), this; } - function Lg() { + function Yg() { } - function oR(c) { + function NR(c) { return c = cr(c), hr(function(h) { - return Gy(h, c); + return cw(h, c); }); } - var aR = hg(Xr), cR = hg(gy), uR = hg($p); - function h2(c) { - return yg(c) ? Bp(Rs(c)) : FP(c); + var LR = Pg(Xr), kR = Pg(Cy), $R = Pg(Xp); + function P2(c) { + return Og(c) ? Zp(Ls(c)) : dM(c); } - function fR(c) { + function BR(c) { return function(h) { - return c == null ? r : Ba(c, h); + return c == null ? r : Wa(c, h); }; } - var lR = mw(), hR = mw(!0); - function kg() { + var FR = Tw(), jR = Tw(!0); + function Jg() { return []; } - function $g() { + function Xg() { return !1; } - function dR() { + function UR() { return {}; } - function pR() { + function qR() { return ""; } - function gR() { + function zR() { return !0; } - function mR(c, h) { - if (c = cr(c), c < 1 || c > _) + function WR(c, h) { + if (c = cr(c), c < 1 || c > E) return []; - var y = P, O = Kn(c, P); - h = Ut(h), c -= P; - for (var z = Up(O, h); ++y < c; ) + var y = M, N = Kn(c, M); + h = Ut(h), c -= M; + for (var W = tg(N, h); ++y < c; ) h(y); - return z; + return W; } - function vR(c) { - return ir(c) ? Xr(c, Rs) : Ii(c) ? [c] : fi(Dw(Cr(c))); + function HR(c) { + return ir(c) ? Xr(c, Ls) : Ci(c) ? [c] : li(Kw(Cr(c))); } - function bR(c) { - var h = ++CA; + function KR(c) { + var h = ++nP; return Cr(c) + h; } - var yR = qh(function(c, h) { + var VR = Xh(function(c, h) { return c + h; - }, 0), wR = dg("ceil"), xR = qh(function(c, h) { + }, 0), GR = Mg("ceil"), YR = Xh(function(c, h) { return c / h; - }, 1), _R = dg("floor"); - function ER(c) { - return c && c.length ? Lh(c, di, Zp) : r; + }, 1), JR = Mg("floor"); + function XR(c) { + return c && c.length ? Wh(c, pi, hg) : r; } - function SR(c, h) { - return c && c.length ? Lh(c, Ut(h, 2), Zp) : r; + function ZR(c, h) { + return c && c.length ? Wh(c, Ut(h, 2), hg) : r; } - function AR(c) { - return by(c, di); + function QR(c) { + return Dy(c, pi); } - function PR(c, h) { - return by(c, Ut(h, 2)); + function eD(c, h) { + return Dy(c, Ut(h, 2)); } - function MR(c) { - return c && c.length ? Lh(c, di, rg) : r; + function tD(c) { + return c && c.length ? Wh(c, pi, mg) : r; } - function IR(c, h) { - return c && c.length ? Lh(c, Ut(h, 2), rg) : r; + function rD(c, h) { + return c && c.length ? Wh(c, Ut(h, 2), mg) : r; } - var CR = qh(function(c, h) { + var nD = Xh(function(c, h) { return c * h; - }, 1), TR = dg("round"), RR = qh(function(c, h) { + }, 1), iD = Mg("round"), sD = Xh(function(c, h) { return c - h; }, 0); - function DR(c) { - return c && c.length ? jp(c, di) : 0; + function oD(c) { + return c && c.length ? eg(c, pi) : 0; } - function OR(c, h) { - return c && c.length ? jp(c, Ut(h, 2)) : 0; + function aD(c, h) { + return c && c.length ? eg(c, Ut(h, 2)) : 0; } - return ee.after = tC, ee.ary = zw, ee.assign = qC, ee.assignIn = n2, ee.assignInWith = td, ee.assignWith = zC, ee.at = WC, ee.before = Ww, ee.bind = Ag, ee.bindAll = YT, ee.bindKey = Hw, ee.castArray = dC, ee.chain = jw, ee.chunk = _M, ee.compact = EM, ee.concat = SM, ee.cond = JT, ee.conforms = XT, ee.constant = Dg, ee.countBy = DI, ee.create = HC, ee.curry = Kw, ee.curryRight = Vw, ee.debounce = Gw, ee.defaults = KC, ee.defaultsDeep = VC, ee.defer = rC, ee.delay = nC, ee.difference = AM, ee.differenceBy = PM, ee.differenceWith = MM, ee.drop = IM, ee.dropRight = CM, ee.dropRightWhile = TM, ee.dropWhile = RM, ee.fill = DM, ee.filter = NI, ee.flatMap = $I, ee.flatMapDeep = BI, ee.flatMapDepth = FI, ee.flatten = kw, ee.flattenDeep = OM, ee.flattenDepth = NM, ee.flip = iC, ee.flow = QT, ee.flowRight = eR, ee.fromPairs = LM, ee.functions = eT, ee.functionsIn = tT, ee.groupBy = jI, ee.initial = $M, ee.intersection = BM, ee.intersectionBy = FM, ee.intersectionWith = jM, ee.invert = nT, ee.invertBy = iT, ee.invokeMap = qI, ee.iteratee = Og, ee.keyBy = zI, ee.keys = Mn, ee.keysIn = hi, ee.map = Yh, ee.mapKeys = oT, ee.mapValues = aT, ee.matches = tR, ee.matchesProperty = rR, ee.memoize = Xh, ee.merge = cT, ee.mergeWith = i2, ee.method = nR, ee.methodOf = iR, ee.mixin = Ng, ee.negate = Zh, ee.nthArg = oR, ee.omit = uT, ee.omitBy = fT, ee.once = sC, ee.orderBy = WI, ee.over = aR, ee.overArgs = oC, ee.overEvery = cR, ee.overSome = uR, ee.partial = Pg, ee.partialRight = Yw, ee.partition = HI, ee.pick = lT, ee.pickBy = s2, ee.property = h2, ee.propertyOf = fR, ee.pull = WM, ee.pullAll = Bw, ee.pullAllBy = HM, ee.pullAllWith = KM, ee.pullAt = VM, ee.range = lR, ee.rangeRight = hR, ee.rearg = aC, ee.reject = GI, ee.remove = GM, ee.rest = cC, ee.reverse = Eg, ee.sampleSize = JI, ee.set = dT, ee.setWith = pT, ee.shuffle = XI, ee.slice = YM, ee.sortBy = eC, ee.sortedUniq = rI, ee.sortedUniqBy = nI, ee.split = $T, ee.spread = uC, ee.tail = iI, ee.take = sI, ee.takeRight = oI, ee.takeRightWhile = aI, ee.takeWhile = cI, ee.tap = EI, ee.throttle = fC, ee.thru = Gh, ee.toArray = e2, ee.toPairs = o2, ee.toPairsIn = a2, ee.toPath = vR, ee.toPlainObject = r2, ee.transform = gT, ee.unary = lC, ee.union = uI, ee.unionBy = fI, ee.unionWith = lI, ee.uniq = hI, ee.uniqBy = dI, ee.uniqWith = pI, ee.unset = mT, ee.unzip = Sg, ee.unzipWith = Fw, ee.update = vT, ee.updateWith = bT, ee.values = Uc, ee.valuesIn = yT, ee.without = gI, ee.words = f2, ee.wrap = hC, ee.xor = mI, ee.xorBy = vI, ee.xorWith = bI, ee.zip = yI, ee.zipObject = wI, ee.zipObjectDeep = xI, ee.zipWith = _I, ee.entries = o2, ee.entriesIn = a2, ee.extend = n2, ee.extendWith = td, Ng(ee, ee), ee.add = yR, ee.attempt = l2, ee.camelCase = ET, ee.capitalize = c2, ee.ceil = wR, ee.clamp = wT, ee.clone = pC, ee.cloneDeep = mC, ee.cloneDeepWith = vC, ee.cloneWith = gC, ee.conformsTo = bC, ee.deburr = u2, ee.defaultTo = ZT, ee.divide = xR, ee.endsWith = ST, ee.eq = ds, ee.escape = AT, ee.escapeRegExp = PT, ee.every = OI, ee.find = LI, ee.findIndex = Nw, ee.findKey = GC, ee.findLast = kI, ee.findLastIndex = Lw, ee.findLastKey = YC, ee.floor = _R, ee.forEach = Uw, ee.forEachRight = qw, ee.forIn = JC, ee.forInRight = XC, ee.forOwn = ZC, ee.forOwnRight = QC, ee.get = Cg, ee.gt = yC, ee.gte = wC, ee.has = rT, ee.hasIn = Tg, ee.head = $w, ee.identity = di, ee.includes = UI, ee.indexOf = kM, ee.inRange = xT, ee.invoke = sT, ee.isArguments = Ua, ee.isArray = ir, ee.isArrayBuffer = xC, ee.isArrayLike = li, ee.isArrayLikeObject = cn, ee.isBoolean = _C, ee.isBuffer = Zo, ee.isDate = EC, ee.isElement = SC, ee.isEmpty = AC, ee.isEqual = PC, ee.isEqualWith = MC, ee.isError = Mg, ee.isFinite = IC, ee.isFunction = lo, ee.isInteger = Jw, ee.isLength = Qh, ee.isMap = Xw, ee.isMatch = CC, ee.isMatchWith = TC, ee.isNaN = RC, ee.isNative = DC, ee.isNil = NC, ee.isNull = OC, ee.isNumber = Zw, ee.isObject = Zr, ee.isObjectLike = en, ee.isPlainObject = pf, ee.isRegExp = Ig, ee.isSafeInteger = LC, ee.isSet = Qw, ee.isString = ed, ee.isSymbol = Ii, ee.isTypedArray = jc, ee.isUndefined = kC, ee.isWeakMap = $C, ee.isWeakSet = BC, ee.join = UM, ee.kebabCase = MT, ee.last = Hi, ee.lastIndexOf = qM, ee.lowerCase = IT, ee.lowerFirst = CT, ee.lt = FC, ee.lte = jC, ee.max = ER, ee.maxBy = SR, ee.mean = AR, ee.meanBy = PR, ee.min = MR, ee.minBy = IR, ee.stubArray = kg, ee.stubFalse = $g, ee.stubObject = dR, ee.stubString = pR, ee.stubTrue = gR, ee.multiply = CR, ee.nth = zM, ee.noConflict = sR, ee.noop = Lg, ee.now = Jh, ee.pad = TT, ee.padEnd = RT, ee.padStart = DT, ee.parseInt = OT, ee.random = _T, ee.reduce = KI, ee.reduceRight = VI, ee.repeat = NT, ee.replace = LT, ee.result = hT, ee.round = TR, ee.runInContext = be, ee.sample = YI, ee.size = ZI, ee.snakeCase = kT, ee.some = QI, ee.sortedIndex = JM, ee.sortedIndexBy = XM, ee.sortedIndexOf = ZM, ee.sortedLastIndex = QM, ee.sortedLastIndexBy = eI, ee.sortedLastIndexOf = tI, ee.startCase = BT, ee.startsWith = FT, ee.subtract = RR, ee.sum = DR, ee.sumBy = OR, ee.template = jT, ee.times = mR, ee.toFinite = ho, ee.toInteger = cr, ee.toLength = t2, ee.toLower = UT, ee.toNumber = Ki, ee.toSafeInteger = UC, ee.toString = Cr, ee.toUpper = qT, ee.trim = zT, ee.trimEnd = WT, ee.trimStart = HT, ee.truncate = KT, ee.unescape = VT, ee.uniqueId = bR, ee.upperCase = GT, ee.upperFirst = Rg, ee.each = Uw, ee.eachRight = qw, ee.first = $w, Ng(ee, function() { + return te.after = CC, te.ary = n2, te.assign = mT, te.assignIn = v2, te.assignInWith = fd, te.assignWith = vT, te.at = bT, te.before = i2, te.bind = Fg, te.bindAll = ER, te.bindKey = s2, te.castArray = UC, te.chain = e2, te.chunk = JM, te.compact = XM, te.concat = ZM, te.cond = SR, te.conforms = AR, te.constant = Kg, te.countBy = oC, te.create = yT, te.curry = o2, te.curryRight = a2, te.debounce = c2, te.defaults = wT, te.defaultsDeep = xT, te.defer = TC, te.delay = RC, te.difference = QM, te.differenceBy = eI, te.differenceWith = tI, te.drop = rI, te.dropRight = nI, te.dropRightWhile = iI, te.dropWhile = sI, te.fill = oI, te.filter = cC, te.flatMap = lC, te.flatMapDeep = hC, te.flatMapDepth = dC, te.flatten = Jw, te.flattenDeep = aI, te.flattenDepth = cI, te.flip = DC, te.flow = MR, te.flowRight = IR, te.fromPairs = uI, te.functions = IT, te.functionsIn = CT, te.groupBy = pC, te.initial = lI, te.intersection = hI, te.intersectionBy = dI, te.intersectionWith = pI, te.invert = RT, te.invertBy = DT, te.invokeMap = mC, te.iteratee = Vg, te.keyBy = vC, te.keys = Mn, te.keysIn = di, te.map = id, te.mapKeys = NT, te.mapValues = LT, te.matches = CR, te.matchesProperty = TR, te.memoize = od, te.merge = kT, te.mergeWith = b2, te.method = RR, te.methodOf = DR, te.mixin = Gg, te.negate = ad, te.nthArg = NR, te.omit = $T, te.omitBy = BT, te.once = OC, te.orderBy = bC, te.over = LR, te.overArgs = NC, te.overEvery = kR, te.overSome = $R, te.partial = jg, te.partialRight = u2, te.partition = yC, te.pick = FT, te.pickBy = y2, te.property = P2, te.propertyOf = BR, te.pull = bI, te.pullAll = Zw, te.pullAllBy = yI, te.pullAllWith = wI, te.pullAt = xI, te.range = FR, te.rangeRight = jR, te.rearg = LC, te.reject = _C, te.remove = _I, te.rest = kC, te.reverse = $g, te.sampleSize = SC, te.set = UT, te.setWith = qT, te.shuffle = AC, te.slice = EI, te.sortBy = IC, te.sortedUniq = TI, te.sortedUniqBy = RI, te.split = lR, te.spread = $C, te.tail = DI, te.take = OI, te.takeRight = NI, te.takeRightWhile = LI, te.takeWhile = kI, te.tap = XI, te.throttle = BC, te.thru = nd, te.toArray = p2, te.toPairs = w2, te.toPairsIn = x2, te.toPath = HR, te.toPlainObject = m2, te.transform = zT, te.unary = FC, te.union = $I, te.unionBy = BI, te.unionWith = FI, te.uniq = jI, te.uniqBy = UI, te.uniqWith = qI, te.unset = WT, te.unzip = Bg, te.unzipWith = Qw, te.update = HT, te.updateWith = KT, te.values = Xc, te.valuesIn = VT, te.without = zI, te.words = S2, te.wrap = jC, te.xor = WI, te.xorBy = HI, te.xorWith = KI, te.zip = VI, te.zipObject = GI, te.zipObjectDeep = YI, te.zipWith = JI, te.entries = w2, te.entriesIn = x2, te.extend = v2, te.extendWith = fd, Gg(te, te), te.add = VR, te.attempt = A2, te.camelCase = XT, te.capitalize = _2, te.ceil = GR, te.clamp = GT, te.clone = qC, te.cloneDeep = WC, te.cloneDeepWith = HC, te.cloneWith = zC, te.conformsTo = KC, te.deburr = E2, te.defaultTo = PR, te.divide = YR, te.endsWith = ZT, te.eq = gs, te.escape = QT, te.escapeRegExp = eR, te.every = aC, te.find = uC, te.findIndex = Gw, te.findKey = _T, te.findLast = fC, te.findLastIndex = Yw, te.findLastKey = ET, te.floor = JR, te.forEach = t2, te.forEachRight = r2, te.forIn = ST, te.forInRight = AT, te.forOwn = PT, te.forOwnRight = MT, te.get = zg, te.gt = VC, te.gte = GC, te.has = TT, te.hasIn = Wg, te.head = Xw, te.identity = pi, te.includes = gC, te.indexOf = fI, te.inRange = YT, te.invoke = OT, te.isArguments = Va, te.isArray = ir, te.isArrayBuffer = YC, te.isArrayLike = hi, te.isArrayLikeObject = cn, te.isBoolean = JC, te.isBuffer = ea, te.isDate = XC, te.isElement = ZC, te.isEmpty = QC, te.isEqual = eT, te.isEqualWith = tT, te.isError = Ug, te.isFinite = rT, te.isFunction = go, te.isInteger = f2, te.isLength = cd, te.isMap = l2, te.isMatch = nT, te.isMatchWith = iT, te.isNaN = sT, te.isNative = oT, te.isNil = cT, te.isNull = aT, te.isNumber = h2, te.isObject = Zr, te.isObjectLike = en, te.isPlainObject = xf, te.isRegExp = qg, te.isSafeInteger = uT, te.isSet = d2, te.isString = ud, te.isSymbol = Ci, te.isTypedArray = Jc, te.isUndefined = fT, te.isWeakMap = lT, te.isWeakSet = hT, te.join = gI, te.kebabCase = tR, te.last = Vi, te.lastIndexOf = mI, te.lowerCase = rR, te.lowerFirst = nR, te.lt = dT, te.lte = pT, te.max = XR, te.maxBy = ZR, te.mean = QR, te.meanBy = eD, te.min = tD, te.minBy = rD, te.stubArray = Jg, te.stubFalse = Xg, te.stubObject = UR, te.stubString = qR, te.stubTrue = zR, te.multiply = nD, te.nth = vI, te.noConflict = OR, te.noop = Yg, te.now = sd, te.pad = iR, te.padEnd = sR, te.padStart = oR, te.parseInt = aR, te.random = JT, te.reduce = wC, te.reduceRight = xC, te.repeat = cR, te.replace = uR, te.result = jT, te.round = iD, te.runInContext = be, te.sample = EC, te.size = PC, te.snakeCase = fR, te.some = MC, te.sortedIndex = SI, te.sortedIndexBy = AI, te.sortedIndexOf = PI, te.sortedLastIndex = MI, te.sortedLastIndexBy = II, te.sortedLastIndexOf = CI, te.startCase = hR, te.startsWith = dR, te.subtract = sD, te.sum = oD, te.sumBy = aD, te.template = pR, te.times = WR, te.toFinite = mo, te.toInteger = cr, te.toLength = g2, te.toLower = gR, te.toNumber = Gi, te.toSafeInteger = gT, te.toString = Cr, te.toUpper = mR, te.trim = vR, te.trimEnd = bR, te.trimStart = yR, te.truncate = wR, te.unescape = xR, te.uniqueId = KR, te.upperCase = _R, te.upperFirst = Hg, te.each = t2, te.eachRight = r2, te.first = Xw, Gg(te, function() { var c = {}; - return Cs(ee, function(h, y) { - Tr.call(ee.prototype, y) || (c[y] = h); + return Os(te, function(h, y) { + Tr.call(te.prototype, y) || (c[y] = h); }), c; - }(), { chain: !1 }), ee.VERSION = n, ji(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(c) { - ee[c].placeholder = ee; - }), ji(["drop", "take"], function(c, h) { - wr.prototype[c] = function(y) { - y = y === r ? 1 : _n(cr(y), 0); - var O = this.__filtered__ && !h ? new wr(this) : this.clone(); - return O.__filtered__ ? O.__takeCount__ = Kn(y, O.__takeCount__) : O.__views__.push({ - size: Kn(y, P), - type: c + (O.__dir__ < 0 ? "Right" : "") - }), O; - }, wr.prototype[c + "Right"] = function(y) { + }(), { chain: !1 }), te.VERSION = n, qi(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(c) { + te[c].placeholder = te; + }), qi(["drop", "take"], function(c, h) { + xr.prototype[c] = function(y) { + y = y === r ? 1 : En(cr(y), 0); + var N = this.__filtered__ && !h ? new xr(this) : this.clone(); + return N.__filtered__ ? N.__takeCount__ = Kn(y, N.__takeCount__) : N.__views__.push({ + size: Kn(y, M), + type: c + (N.__dir__ < 0 ? "Right" : "") + }), N; + }, xr.prototype[c + "Right"] = function(y) { return this.reverse()[c](y).reverse(); }; - }), ji(["filter", "map", "takeWhile"], function(c, h) { - var y = h + 1, O = y == f || y == b; - wr.prototype[c] = function(z) { + }), qi(["filter", "map", "takeWhile"], function(c, h) { + var y = h + 1, N = y == f || y == b; + xr.prototype[c] = function(W) { var ne = this.clone(); return ne.__iteratees__.push({ - iteratee: Ut(z, 3), + iteratee: Ut(W, 3), type: y - }), ne.__filtered__ = ne.__filtered__ || O, ne; + }), ne.__filtered__ = ne.__filtered__ || N, ne; }; - }), ji(["head", "last"], function(c, h) { + }), qi(["head", "last"], function(c, h) { var y = "take" + (h ? "Right" : ""); - wr.prototype[c] = function() { + xr.prototype[c] = function() { return this[y](1).value()[0]; }; - }), ji(["initial", "tail"], function(c, h) { + }), qi(["initial", "tail"], function(c, h) { var y = "drop" + (h ? "" : "Right"); - wr.prototype[c] = function() { - return this.__filtered__ ? new wr(this) : this[y](1); + xr.prototype[c] = function() { + return this.__filtered__ ? new xr(this) : this[y](1); }; - }), wr.prototype.compact = function() { - return this.filter(di); - }, wr.prototype.find = function(c) { + }), xr.prototype.compact = function() { + return this.filter(pi); + }, xr.prototype.find = function(c) { return this.filter(c).head(); - }, wr.prototype.findLast = function(c) { + }, xr.prototype.findLast = function(c) { return this.reverse().find(c); - }, wr.prototype.invokeMap = hr(function(c, h) { - return typeof c == "function" ? new wr(this) : this.map(function(y) { - return cf(y, c, h); + }, xr.prototype.invokeMap = hr(function(c, h) { + return typeof c == "function" ? new xr(this) : this.map(function(y) { + return gf(y, c, h); }); - }), wr.prototype.reject = function(c) { - return this.filter(Zh(Ut(c))); - }, wr.prototype.slice = function(c, h) { + }), xr.prototype.reject = function(c) { + return this.filter(ad(Ut(c))); + }, xr.prototype.slice = function(c, h) { c = cr(c); var y = this; - return y.__filtered__ && (c > 0 || h < 0) ? new wr(y) : (c < 0 ? y = y.takeRight(-c) : c && (y = y.drop(c)), h !== r && (h = cr(h), y = h < 0 ? y.dropRight(-h) : y.take(h - c)), y); - }, wr.prototype.takeRightWhile = function(c) { + return y.__filtered__ && (c > 0 || h < 0) ? new xr(y) : (c < 0 ? y = y.takeRight(-c) : c && (y = y.drop(c)), h !== r && (h = cr(h), y = h < 0 ? y.dropRight(-h) : y.take(h - c)), y); + }, xr.prototype.takeRightWhile = function(c) { return this.reverse().takeWhile(c).reverse(); - }, wr.prototype.toArray = function() { - return this.take(P); - }, Cs(wr.prototype, function(c, h) { - var y = /^(?:filter|find|map|reject)|While$/.test(h), O = /^(?:head|last)$/.test(h), z = ee[O ? "take" + (h == "last" ? "Right" : "") : h], ne = O || /^find/.test(h); - z && (ee.prototype[h] = function() { - var fe = this.__wrapped__, me = O ? [1] : arguments, we = fe instanceof wr, We = me[0], He = we || ir(fe), Xe = function(vr) { - var Er = z.apply(ee, Ho([vr], me)); - return O && wt ? Er[0] : Er; + }, xr.prototype.toArray = function() { + return this.take(M); + }, Os(xr.prototype, function(c, h) { + var y = /^(?:filter|find|map|reject)|While$/.test(h), N = /^(?:head|last)$/.test(h), W = te[N ? "take" + (h == "last" ? "Right" : "") : h], ne = N || /^find/.test(h); + W && (te.prototype[h] = function() { + var fe = this.__wrapped__, me = N ? [1] : arguments, we = fe instanceof xr, We = me[0], He = we || ir(fe), Xe = function(br) { + var Sr = W.apply(te, Vo([br], me)); + return N && wt ? Sr[0] : Sr; }; He && y && typeof We == "function" && We.length != 1 && (we = He = !1); var wt = this.__chain__, Ot = !!this.__actions__.length, Ht = ne && !wt, fr = we && !Ot; if (!ne && He) { - fe = fr ? fe : new wr(this); + fe = fr ? fe : new xr(this); var Kt = c.apply(fe, me); - return Kt.__actions__.push({ func: Gh, args: [Xe], thisArg: r }), new qi(Kt, wt); + return Kt.__actions__.push({ func: nd, args: [Xe], thisArg: r }), new Wi(Kt, wt); } - return Ht && fr ? c.apply(this, me) : (Kt = this.thru(Xe), Ht ? O ? Kt.value()[0] : Kt.value() : Kt); + return Ht && fr ? c.apply(this, me) : (Kt = this.thru(Xe), Ht ? N ? Kt.value()[0] : Kt.value() : Kt); }); - }), ji(["pop", "push", "shift", "sort", "splice", "unshift"], function(c) { - var h = wh[c], y = /^(?:push|sort|unshift)$/.test(c) ? "tap" : "thru", O = /^(?:pop|shift)$/.test(c); - ee.prototype[c] = function() { - var z = arguments; - if (O && !this.__chain__) { + }), qi(["pop", "push", "shift", "sort", "splice", "unshift"], function(c) { + var h = Ch[c], y = /^(?:push|sort|unshift)$/.test(c) ? "tap" : "thru", N = /^(?:pop|shift)$/.test(c); + te.prototype[c] = function() { + var W = arguments; + if (N && !this.__chain__) { var ne = this.value(); - return h.apply(ir(ne) ? ne : [], z); + return h.apply(ir(ne) ? ne : [], W); } return this[y](function(fe) { - return h.apply(ir(fe) ? fe : [], z); + return h.apply(ir(fe) ? fe : [], W); }); }; - }), Cs(wr.prototype, function(c, h) { - var y = ee[h]; + }), Os(xr.prototype, function(c, h) { + var y = te[h]; if (y) { - var O = y.name + ""; - Tr.call(Lc, O) || (Lc[O] = []), Lc[O].push({ name: h, func: y }); + var N = y.name + ""; + Tr.call(Hc, N) || (Hc[N] = []), Hc[N].push({ name: h, func: y }); } - }), Lc[Uh(r, B).name] = [{ + }), Hc[Jh(r, B).name] = [{ name: "wrapper", func: r - }], wr.prototype.clone = VA, wr.prototype.reverse = GA, wr.prototype.value = YA, ee.prototype.at = SI, ee.prototype.chain = AI, ee.prototype.commit = PI, ee.prototype.next = MI, ee.prototype.plant = CI, ee.prototype.reverse = TI, ee.prototype.toJSON = ee.prototype.valueOf = ee.prototype.value = RI, ee.prototype.first = ee.prototype.head, ef && (ee.prototype[ef] = II), ee; - }, Dc = PA(); - an ? ((an.exports = Dc)._ = Dc, Ur._ = Dc) : _r._ = Dc; + }], xr.prototype.clone = xP, xr.prototype.reverse = _P, xr.prototype.value = EP, te.prototype.at = ZI, te.prototype.chain = QI, te.prototype.commit = eC, te.prototype.next = tC, te.prototype.plant = nC, te.prototype.reverse = iC, te.prototype.toJSON = te.prototype.valueOf = te.prototype.value = sC, te.prototype.first = te.prototype.head, cf && (te.prototype[cf] = rC), te; + }, qc = eP(); + an ? ((an.exports = qc)._ = qc, Ur._ = qc) : Er._ = qc; }).call(gn); -})(h0, h0.exports); -var ZV = h0.exports, O1 = { exports: {} }; +})(S0, S0.exports); +var RG = S0.exports, Y1 = { exports: {} }; (function(t, e) { var r = typeof self < "u" ? self : gn, n = function() { function s() { @@ -24764,7 +25276,7 @@ var ZV = h0.exports, O1 = { exports: {} }; function w(f) { return typeof f != "string" && (f = String(f)), f; } - function A(f) { + function _(f) { var g = { next: function() { var b = f.shift(); @@ -24775,8 +25287,8 @@ var ZV = h0.exports, O1 = { exports: {} }; return g; }), g; } - function M(f) { - this.map = {}, f instanceof M ? f.forEach(function(g, b) { + function P(f) { + this.map = {}, f instanceof P ? f.forEach(function(g, b) { this.append(b, g); }, this) : Array.isArray(f) ? f.forEach(function(g) { this.append(g[0], g[1]); @@ -24784,38 +25296,38 @@ var ZV = h0.exports, O1 = { exports: {} }; this.append(g, f[g]); }, this); } - M.prototype.append = function(f, g) { + P.prototype.append = function(f, g) { f = p(f), g = w(g); var b = this.map[f]; this.map[f] = b ? b + ", " + g : g; - }, M.prototype.delete = function(f) { + }, P.prototype.delete = function(f) { delete this.map[p(f)]; - }, M.prototype.get = function(f) { + }, P.prototype.get = function(f) { return f = p(f), this.has(f) ? this.map[f] : null; - }, M.prototype.has = function(f) { + }, P.prototype.has = function(f) { return this.map.hasOwnProperty(p(f)); - }, M.prototype.set = function(f, g) { + }, P.prototype.set = function(f, g) { this.map[p(f)] = w(g); - }, M.prototype.forEach = function(f, g) { + }, P.prototype.forEach = function(f, g) { for (var b in this.map) this.map.hasOwnProperty(b) && f.call(g, this.map[b], b, this); - }, M.prototype.keys = function() { + }, P.prototype.keys = function() { var f = []; return this.forEach(function(g, b) { f.push(b); - }), A(f); - }, M.prototype.values = function() { + }), _(f); + }, P.prototype.values = function() { var f = []; return this.forEach(function(g) { f.push(g); - }), A(f); - }, M.prototype.entries = function() { + }), _(f); + }, P.prototype.entries = function() { var f = []; return this.forEach(function(g, b) { f.push([b, g]); - }), A(f); - }, a.iterable && (M.prototype[Symbol.iterator] = M.prototype.entries); - function N(f) { + }), _(f); + }, a.iterable && (P.prototype[Symbol.iterator] = P.prototype.entries); + function O(f) { if (f.bodyUsed) return Promise.reject(new TypeError("Already read")); f.bodyUsed = !0; @@ -24833,11 +25345,11 @@ var ZV = h0.exports, O1 = { exports: {} }; var g = new FileReader(), b = L(g); return g.readAsArrayBuffer(f), b; } - function $(f) { + function k(f) { var g = new FileReader(), b = L(g); return g.readAsText(f), b; } - function H(f) { + function q(f) { for (var g = new Uint8Array(f), b = new Array(g.length), x = 0; x < g.length; x++) b[x] = String.fromCharCode(g[x]); return b.join(""); @@ -24852,7 +25364,7 @@ var ZV = h0.exports, O1 = { exports: {} }; return this.bodyUsed = !1, this._initBody = function(f) { this._bodyInit = f, f ? typeof f == "string" ? this._bodyText = f : a.blob && Blob.prototype.isPrototypeOf(f) ? this._bodyBlob = f : a.formData && FormData.prototype.isPrototypeOf(f) ? this._bodyFormData = f : a.searchParams && URLSearchParams.prototype.isPrototypeOf(f) ? this._bodyText = f.toString() : a.arrayBuffer && a.blob && u(f) ? (this._bodyArrayBuffer = U(f.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(f) || d(f)) ? this._bodyArrayBuffer = U(f) : this._bodyText = f = Object.prototype.toString.call(f) : this._bodyText = "", this.headers.get("content-type") || (typeof f == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : a.searchParams && URLSearchParams.prototype.isPrototypeOf(f) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8")); }, a.blob && (this.blob = function() { - var f = N(this); + var f = O(this); if (f) return f; if (this._bodyBlob) @@ -24863,15 +25375,15 @@ var ZV = h0.exports, O1 = { exports: {} }; throw new Error("could not read FormData body as blob"); return Promise.resolve(new Blob([this._bodyText])); }, this.arrayBuffer = function() { - return this._bodyArrayBuffer ? N(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(B); + return this._bodyArrayBuffer ? O(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(B); }), this.text = function() { - var f = N(this); + var f = O(this); if (f) return f; if (this._bodyBlob) - return $(this._bodyBlob); + return k(this._bodyBlob); if (this._bodyArrayBuffer) - return Promise.resolve(H(this._bodyArrayBuffer)); + return Promise.resolve(q(this._bodyArrayBuffer)); if (this._bodyFormData) throw new Error("could not read FormData body as text"); return Promise.resolve(this._bodyText); @@ -24881,10 +25393,10 @@ var ZV = h0.exports, O1 = { exports: {} }; return this.text().then(JSON.parse); }, this; } - var te = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"]; + var Q = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"]; function R(f) { var g = f.toUpperCase(); - return te.indexOf(g) > -1 ? g : f; + return Q.indexOf(g) > -1 ? g : f; } function K(f, g) { g = g || {}; @@ -24892,10 +25404,10 @@ var ZV = h0.exports, O1 = { exports: {} }; if (f instanceof K) { if (f.bodyUsed) throw new TypeError("Already read"); - this.url = f.url, this.credentials = f.credentials, g.headers || (this.headers = new M(f.headers)), this.method = f.method, this.mode = f.mode, this.signal = f.signal, !b && f._bodyInit != null && (b = f._bodyInit, f.bodyUsed = !0); + this.url = f.url, this.credentials = f.credentials, g.headers || (this.headers = new P(f.headers)), this.method = f.method, this.mode = f.mode, this.signal = f.signal, !b && f._bodyInit != null && (b = f._bodyInit, f.bodyUsed = !0); } else this.url = String(f); - if (this.credentials = g.credentials || this.credentials || "same-origin", (g.headers || !this.headers) && (this.headers = new M(g.headers)), this.method = R(g.method || this.method || "GET"), this.mode = g.mode || this.mode || null, this.signal = g.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && b) + if (this.credentials = g.credentials || this.credentials || "same-origin", (g.headers || !this.headers) && (this.headers = new P(g.headers)), this.method = R(g.method || this.method || "GET"), this.mode = g.mode || this.mode || null, this.signal = g.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && b) throw new TypeError("Body not allowed for GET or HEAD requests"); this._initBody(b); } @@ -24906,39 +25418,39 @@ var ZV = h0.exports, O1 = { exports: {} }; var g = new FormData(); return f.trim().split("&").forEach(function(b) { if (b) { - var x = b.split("="), _ = x.shift().replace(/\+/g, " "), E = x.join("=").replace(/\+/g, " "); - g.append(decodeURIComponent(_), decodeURIComponent(E)); + var x = b.split("="), E = x.shift().replace(/\+/g, " "), S = x.join("=").replace(/\+/g, " "); + g.append(decodeURIComponent(E), decodeURIComponent(S)); } }), g; } function Ee(f) { - var g = new M(), b = f.replace(/\r?\n[\t ]+/g, " "); + var g = new P(), b = f.replace(/\r?\n[\t ]+/g, " "); return b.split(/\r?\n/).forEach(function(x) { - var _ = x.split(":"), E = _.shift().trim(); - if (E) { - var v = _.join(":").trim(); - g.append(E, v); + var E = x.split(":"), S = E.shift().trim(); + if (S) { + var v = E.join(":").trim(); + g.append(S, v); } }), g; } V.call(K.prototype); function Y(f, g) { - g || (g = {}), this.type = "default", this.status = g.status === void 0 ? 200 : g.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in g ? g.statusText : "OK", this.headers = new M(g.headers), this.url = g.url || "", this._initBody(f); + g || (g = {}), this.type = "default", this.status = g.status === void 0 ? 200 : g.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in g ? g.statusText : "OK", this.headers = new P(g.headers), this.url = g.url || "", this._initBody(f); } V.call(Y.prototype), Y.prototype.clone = function() { return new Y(this._bodyInit, { status: this.status, statusText: this.statusText, - headers: new M(this.headers), + headers: new P(this.headers), url: this.url }); }, Y.error = function() { var f = new Y(null, { status: 0, statusText: "" }); return f.type = "error", f; }; - var S = [301, 302, 303, 307, 308]; + var A = [301, 302, 303, 307, 308]; Y.redirect = function(f, g) { - if (S.indexOf(g) === -1) + if (A.indexOf(g) === -1) throw new RangeError("Invalid status code"); return new Y(null, { status: g, headers: { location: f } }); }, o.DOMException = s.DOMException; @@ -24953,52 +25465,52 @@ var ZV = h0.exports, O1 = { exports: {} }; } function m(f, g) { return new Promise(function(b, x) { - var _ = new K(f, g); - if (_.signal && _.signal.aborted) + var E = new K(f, g); + if (E.signal && E.signal.aborted) return x(new o.DOMException("Aborted", "AbortError")); - var E = new XMLHttpRequest(); + var S = new XMLHttpRequest(); function v() { - E.abort(); + S.abort(); } - E.onload = function() { - var P = { - status: E.status, - statusText: E.statusText, - headers: Ee(E.getAllResponseHeaders() || "") + S.onload = function() { + var M = { + status: S.status, + statusText: S.statusText, + headers: Ee(S.getAllResponseHeaders() || "") }; - P.url = "responseURL" in E ? E.responseURL : P.headers.get("X-Request-URL"); - var I = "response" in E ? E.response : E.responseText; - b(new Y(I, P)); - }, E.onerror = function() { + M.url = "responseURL" in S ? S.responseURL : M.headers.get("X-Request-URL"); + var I = "response" in S ? S.response : S.responseText; + b(new Y(I, M)); + }, S.onerror = function() { x(new TypeError("Network request failed")); - }, E.ontimeout = function() { + }, S.ontimeout = function() { x(new TypeError("Network request failed")); - }, E.onabort = function() { + }, S.onabort = function() { x(new o.DOMException("Aborted", "AbortError")); - }, E.open(_.method, _.url, !0), _.credentials === "include" ? E.withCredentials = !0 : _.credentials === "omit" && (E.withCredentials = !1), "responseType" in E && a.blob && (E.responseType = "blob"), _.headers.forEach(function(P, I) { - E.setRequestHeader(I, P); - }), _.signal && (_.signal.addEventListener("abort", v), E.onreadystatechange = function() { - E.readyState === 4 && _.signal.removeEventListener("abort", v); - }), E.send(typeof _._bodyInit > "u" ? null : _._bodyInit); + }, S.open(E.method, E.url, !0), E.credentials === "include" ? S.withCredentials = !0 : E.credentials === "omit" && (S.withCredentials = !1), "responseType" in S && a.blob && (S.responseType = "blob"), E.headers.forEach(function(M, I) { + S.setRequestHeader(I, M); + }), E.signal && (E.signal.addEventListener("abort", v), S.onreadystatechange = function() { + S.readyState === 4 && E.signal.removeEventListener("abort", v); + }), S.send(typeof E._bodyInit > "u" ? null : E._bodyInit); }); } - return m.polyfill = !0, s.fetch || (s.fetch = m, s.Headers = M, s.Request = K, s.Response = Y), o.Headers = M, o.Request = K, o.Response = Y, o.fetch = m, Object.defineProperty(o, "__esModule", { value: !0 }), o; + return m.polyfill = !0, s.fetch || (s.fetch = m, s.Headers = P, s.Request = K, s.Response = Y), o.Headers = P, o.Request = K, o.Response = Y, o.fetch = m, Object.defineProperty(o, "__esModule", { value: !0 }), o; })({}); })(n), n.fetch.ponyfill = !0, delete n.fetch.polyfill; var i = n; e = i.fetch, e.default = i.fetch, e.fetch = i.fetch, e.Headers = i.Headers, e.Request = i.Request, e.Response = i.Response, t.exports = e; -})(O1, O1.exports); -var QV = O1.exports; -const $3 = /* @__PURE__ */ ts(QV); -var eG = Object.defineProperty, tG = Object.defineProperties, rG = Object.getOwnPropertyDescriptors, B3 = Object.getOwnPropertySymbols, nG = Object.prototype.hasOwnProperty, iG = Object.prototype.propertyIsEnumerable, F3 = (t, e, r) => e in t ? eG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, j3 = (t, e) => { - for (var r in e || (e = {})) nG.call(e, r) && F3(t, r, e[r]); - if (B3) for (var r of B3(e)) iG.call(e, r) && F3(t, r, e[r]); +})(Y1, Y1.exports); +var DG = Y1.exports; +const Q3 = /* @__PURE__ */ ns(DG); +var OG = Object.defineProperty, NG = Object.defineProperties, LG = Object.getOwnPropertyDescriptors, e_ = Object.getOwnPropertySymbols, kG = Object.prototype.hasOwnProperty, $G = Object.prototype.propertyIsEnumerable, t_ = (t, e, r) => e in t ? OG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, r_ = (t, e) => { + for (var r in e || (e = {})) kG.call(e, r) && t_(t, r, e[r]); + if (e_) for (var r of e_(e)) $G.call(e, r) && t_(t, r, e[r]); return t; -}, U3 = (t, e) => tG(t, rG(e)); -const sG = { Accept: "application/json", "Content-Type": "application/json" }, oG = "POST", q3 = { headers: sG, method: oG }, z3 = 10; -let As = class { +}, n_ = (t, e) => NG(t, LG(e)); +const BG = { Accept: "application/json", "Content-Type": "application/json" }, FG = "POST", i_ = { headers: BG, method: FG }, s_ = 10; +let Cs = class { constructor(e, r = !1) { - if (this.url = e, this.disableProviderPing = r, this.events = new rs.EventEmitter(), this.isAvailable = !1, this.registering = !1, !u3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); + if (this.url = e, this.disableProviderPing = r, this.events = new is.EventEmitter(), this.isAvailable = !1, this.registering = !1, !A3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); this.url = e, this.disableProviderPing = r; } get connected() { @@ -25029,14 +25541,14 @@ let As = class { async send(e) { this.isAvailable || await this.register(); try { - const r = $o(e), n = await (await $3(this.url, U3(j3({}, q3), { body: r }))).json(); + const r = jo(e), n = await (await Q3(this.url, n_(r_({}, i_), { body: r }))).json(); this.onPayload({ data: n }); } catch (r) { this.onError(e.id, r); } } async register(e = this.url) { - if (!u3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); + if (!A3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); if (this.registering) { const r = this.events.getMaxListeners(); return (this.events.listenerCount("register_error") >= r || this.events.listenerCount("open") >= r) && this.events.setMaxListeners(r + 1), new Promise((n, i) => { @@ -25051,8 +25563,8 @@ let As = class { this.url = e, this.registering = !0; try { if (!this.disableProviderPing) { - const r = $o({ id: 1, jsonrpc: "2.0", method: "test", params: [] }); - await $3(e, U3(j3({}, q3), { body: r })); + const r = jo({ id: 1, jsonrpc: "2.0", method: "test", params: [] }); + await Q3(e, n_(r_({}, i_), { body: r })); } this.onOpen(); } catch (r) { @@ -25068,38 +25580,38 @@ let As = class { } onPayload(e) { if (typeof e.data > "u") return; - const r = typeof e.data == "string" ? fc(e.data) : e.data; + const r = typeof e.data == "string" ? bc(e.data) : e.data; this.events.emit("payload", r); } onError(e, r) { - const n = this.parseError(r), i = n.message || n.toString(), s = np(e, i); + const n = this.parseError(r), i = n.message || n.toString(), s = vp(e, i); this.events.emit("payload", s); } parseError(e, r = this.url) { - return X8(e, r, "HTTP"); + return AE(e, r, "HTTP"); } resetMaxListeners() { - this.events.getMaxListeners() > z3 && this.events.setMaxListeners(z3); + this.events.getMaxListeners() > s_ && this.events.setMaxListeners(s_); } }; -const W3 = "error", aG = "wss://relay.walletconnect.org", cG = "wc", uG = "universal_provider", H3 = `${cG}@2:${uG}:`, xE = "https://rpc.walletconnect.org/v1/", Xc = "generic", fG = `${xE}bundler`, cs = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; -var lG = Object.defineProperty, hG = Object.defineProperties, dG = Object.getOwnPropertyDescriptors, K3 = Object.getOwnPropertySymbols, pG = Object.prototype.hasOwnProperty, gG = Object.prototype.propertyIsEnumerable, V3 = (t, e, r) => e in t ? lG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ld = (t, e) => { - for (var r in e || (e = {})) pG.call(e, r) && V3(t, r, e[r]); - if (K3) for (var r of K3(e)) gG.call(e, r) && V3(t, r, e[r]); +const o_ = "error", jG = "wss://relay.walletconnect.org", UG = "wc", qG = "universal_provider", a_ = `${UG}@2:${qG}:`, YE = "https://rpc.walletconnect.org/v1/", au = "generic", zG = `${YE}bundler`, fs = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; +var WG = Object.defineProperty, HG = Object.defineProperties, KG = Object.getOwnPropertyDescriptors, c_ = Object.getOwnPropertySymbols, VG = Object.prototype.hasOwnProperty, GG = Object.prototype.propertyIsEnumerable, u_ = (t, e, r) => e in t ? WG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, _d = (t, e) => { + for (var r in e || (e = {})) VG.call(e, r) && u_(t, r, e[r]); + if (c_) for (var r of c_(e)) GG.call(e, r) && u_(t, r, e[r]); return t; -}, mG = (t, e) => hG(t, dG(e)); -function Ni(t, e, r) { +}, YG = (t, e) => HG(t, KG(e)); +function Li(t, e, r) { var n; - const i = hu(t); - return ((n = e.rpcMap) == null ? void 0 : n[i.reference]) || `${xE}?chainId=${i.namespace}:${i.reference}&projectId=${r}`; + const i = _u(t); + return ((n = e.rpcMap) == null ? void 0 : n[i.reference]) || `${YE}?chainId=${i.namespace}:${i.reference}&projectId=${r}`; } -function Sc(t) { +function Nc(t) { return t.includes(":") ? t.split(":")[1] : t; } -function _E(t) { +function JE(t) { return t.map((e) => `${e.split(":")[0]}:${e.split(":")[1]}`); } -function vG(t, e) { +function JG(t, e) { const r = Object.keys(e.namespaces).filter((i) => i.includes(t)); if (!r.length) return []; const n = []; @@ -25108,40 +25620,40 @@ function vG(t, e) { n.push(...s); }), n; } -function bm(t = {}, e = {}) { - const r = G3(t), n = G3(e); - return ZV.merge(r, n); +function Dm(t = {}, e = {}) { + const r = f_(t), n = f_(e); + return RG.merge(r, n); } -function G3(t) { +function f_(t) { var e, r, n, i; const s = {}; - if (!Sl(t)) return s; + if (!Ll(t)) return s; for (const [o, a] of Object.entries(t)) { - const u = cb(o) ? [o] : a.chains, l = a.methods || [], d = a.events || [], p = a.rpcMap || {}, w = Ff(o); - s[w] = mG(ld(ld({}, s[w]), a), { chains: Id(u, (e = s[w]) == null ? void 0 : e.chains), methods: Id(l, (r = s[w]) == null ? void 0 : r.methods), events: Id(d, (n = s[w]) == null ? void 0 : n.events), rpcMap: ld(ld({}, p), (i = s[w]) == null ? void 0 : i.rpcMap) }); + const u = _b(o) ? [o] : a.chains, l = a.methods || [], d = a.events || [], p = a.rpcMap || {}, w = Kf(o); + s[w] = YG(_d(_d({}, s[w]), a), { chains: jd(u, (e = s[w]) == null ? void 0 : e.chains), methods: jd(l, (r = s[w]) == null ? void 0 : r.methods), events: jd(d, (n = s[w]) == null ? void 0 : n.events), rpcMap: _d(_d({}, p), (i = s[w]) == null ? void 0 : i.rpcMap) }); } return s; } -function bG(t) { +function XG(t) { return t.includes(":") ? t.split(":")[2] : t; } -function Y3(t) { +function l_(t) { const e = {}; for (const [r, n] of Object.entries(t)) { - const i = n.methods || [], s = n.events || [], o = n.accounts || [], a = cb(r) ? [r] : n.chains ? n.chains : _E(n.accounts); + const i = n.methods || [], s = n.events || [], o = n.accounts || [], a = _b(r) ? [r] : n.chains ? n.chains : JE(n.accounts); e[r] = { chains: a, methods: i, events: s, accounts: o }; } return e; } -function ym(t) { +function Om(t) { return typeof t == "number" ? t : t.includes("0x") ? parseInt(t, 16) : (t = t.includes(":") ? t.split(":")[1] : t, isNaN(Number(t)) ? t : Number(t)); } -const EE = {}, Ar = (t) => EE[t], wm = (t, e) => { - EE[t] = e; +const XE = {}, Pr = (t) => XE[t], Nm = (t, e) => { + XE[t] = e; }; -class yG { +class ZG { constructor(e) { - this.name = "polkadot", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + this.name = "polkadot", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } updateNamespace(e) { this.namespace = Object.assign(this.namespace, e); @@ -25160,7 +25672,7 @@ class yG { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); } getAccounts() { const e = this.namespace.accounts; @@ -25170,7 +25682,7 @@ class yG { const e = {}; return this.namespace.chains.forEach((r) => { var n; - const i = Sc(r); + const i = Nc(r); e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); }), e; } @@ -25184,19 +25696,19 @@ class yG { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Ni(e, this.namespace, this.client.core.projectId); + const n = r || Li(e, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new as(new As(n, Ar("disableProviderPing"))); + return new us(new Cs(n, Pr("disableProviderPing"))); } } -var wG = Object.defineProperty, xG = Object.defineProperties, _G = Object.getOwnPropertyDescriptors, J3 = Object.getOwnPropertySymbols, EG = Object.prototype.hasOwnProperty, SG = Object.prototype.propertyIsEnumerable, X3 = (t, e, r) => e in t ? wG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Z3 = (t, e) => { - for (var r in e || (e = {})) EG.call(e, r) && X3(t, r, e[r]); - if (J3) for (var r of J3(e)) SG.call(e, r) && X3(t, r, e[r]); +var QG = Object.defineProperty, eY = Object.defineProperties, tY = Object.getOwnPropertyDescriptors, h_ = Object.getOwnPropertySymbols, rY = Object.prototype.hasOwnProperty, nY = Object.prototype.propertyIsEnumerable, d_ = (t, e, r) => e in t ? QG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, p_ = (t, e) => { + for (var r in e || (e = {})) rY.call(e, r) && d_(t, r, e[r]); + if (h_) for (var r of h_(e)) nY.call(e, r) && d_(t, r, e[r]); return t; -}, Q3 = (t, e) => xG(t, _G(e)); -class AG { +}, g_ = (t, e) => eY(t, tY(e)); +class iY { constructor(e) { - this.name = "eip155", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.httpProviders = this.createHttpProviders(), this.chainId = parseInt(this.getDefaultChain()); + this.name = "eip155", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.httpProviders = this.createHttpProviders(), this.chainId = parseInt(this.getDefaultChain()); } async request(e) { switch (e.request.method) { @@ -25219,7 +25731,7 @@ class AG { this.namespace = Object.assign(this.namespace, e); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(parseInt(e), r), this.chainId = parseInt(e), this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + this.httpProviders[e] || this.setHttpProvider(parseInt(e), r), this.chainId = parseInt(e), this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); } requestAccounts() { return this.getAccounts(); @@ -25232,9 +25744,9 @@ class AG { return e.split(":")[1]; } createHttpProvider(e, r) { - const n = r || Ni(`${this.name}:${e}`, this.namespace, this.client.core.projectId); + const n = r || Li(`${this.name}:${e}`, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new as(new As(n, Ar("disableProviderPing"))); + return new us(new Cs(n, Pr("disableProviderPing"))); } setHttpProvider(e, r) { const n = this.createHttpProvider(e, r); @@ -25244,7 +25756,7 @@ class AG { const e = {}; return this.namespace.chains.forEach((r) => { var n; - const i = parseInt(Sc(r)); + const i = parseInt(Nc(r)); e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); }), e; } @@ -25278,7 +25790,7 @@ class AG { if (a != null && a[s]) return a == null ? void 0 : a[s]; const u = await this.client.request(e); try { - await this.client.session.update(e.topic, { sessionProperties: Q3(Z3({}, o.sessionProperties || {}), { capabilities: Q3(Z3({}, a || {}), { [s]: u }) }) }); + await this.client.session.update(e.topic, { sessionProperties: g_(p_({}, o.sessionProperties || {}), { capabilities: g_(p_({}, a || {}), { [s]: u }) }) }); } catch (l) { console.warn("Failed to update session with capabilities", l); } @@ -25306,17 +25818,17 @@ class AG { } async getUserOperationReceipt(e, r) { var n; - const i = new URL(e), s = await fetch(i, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(da("eth_getUserOperationReceipt", [(n = r.request.params) == null ? void 0 : n[0]])) }); + const i = new URL(e), s = await fetch(i, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(ga("eth_getUserOperationReceipt", [(n = r.request.params) == null ? void 0 : n[0]])) }); if (!s.ok) throw new Error(`Failed to fetch user operation receipt - ${s.status}`); return await s.json(); } getBundlerUrl(e, r) { - return `${fG}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`; + return `${zG}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`; } } -class PG { +class sY { constructor(e) { - this.name = "solana", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + this.name = "solana", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } updateNamespace(e) { this.namespace = Object.assign(this.namespace, e); @@ -25328,7 +25840,7 @@ class PG { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); } getDefaultChain() { if (this.chainId) return this.chainId; @@ -25345,7 +25857,7 @@ class PG { const e = {}; return this.namespace.chains.forEach((r) => { var n; - const i = Sc(r); + const i = Nc(r); e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); }), e; } @@ -25359,14 +25871,14 @@ class PG { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Ni(e, this.namespace, this.client.core.projectId); + const n = r || Li(e, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new as(new As(n, Ar("disableProviderPing"))); + return new us(new Cs(n, Pr("disableProviderPing"))); } } -let MG = class { +let oY = class { constructor(e) { - this.name = "cosmos", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + this.name = "cosmos", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } updateNamespace(e) { this.namespace = Object.assign(this.namespace, e); @@ -25385,7 +25897,7 @@ let MG = class { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); } getAccounts() { const e = this.namespace.accounts; @@ -25395,7 +25907,7 @@ let MG = class { const e = {}; return this.namespace.chains.forEach((r) => { var n; - const i = Sc(r); + const i = Nc(r); e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); }), e; } @@ -25409,13 +25921,13 @@ let MG = class { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Ni(e, this.namespace, this.client.core.projectId); + const n = r || Li(e, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new as(new As(n, Ar("disableProviderPing"))); + return new us(new Cs(n, Pr("disableProviderPing"))); } -}, IG = class { +}, aY = class { constructor(e) { - this.name = "algorand", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + this.name = "algorand", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } updateNamespace(e) { this.namespace = Object.assign(this.namespace, e); @@ -25428,11 +25940,11 @@ let MG = class { } setDefaultChain(e, r) { if (!this.httpProviders[e]) { - const n = r || Ni(`${this.name}:${e}`, this.namespace, this.client.core.projectId); + const n = r || Li(`${this.name}:${e}`, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); this.setHttpProvider(e, n); } - this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + this.chainId = e, this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); } getDefaultChain() { if (this.chainId) return this.chainId; @@ -25462,12 +25974,12 @@ let MG = class { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Ni(e, this.namespace, this.client.core.projectId); - return typeof n > "u" ? void 0 : new as(new As(n, Ar("disableProviderPing"))); + const n = r || Li(e, this.namespace, this.client.core.projectId); + return typeof n > "u" ? void 0 : new us(new Cs(n, Pr("disableProviderPing"))); } -}, CG = class { +}, cY = class { constructor(e) { - this.name = "cip34", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + this.name = "cip34", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } updateNamespace(e) { this.namespace = Object.assign(this.namespace, e); @@ -25486,7 +25998,7 @@ let MG = class { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); } getAccounts() { const e = this.namespace.accounts; @@ -25495,7 +26007,7 @@ let MG = class { createHttpProviders() { const e = {}; return this.namespace.chains.forEach((r) => { - const n = this.getCardanoRPCUrl(r), i = Sc(r); + const n = this.getCardanoRPCUrl(r), i = Nc(r); e[i] = this.createHttpProvider(i, n); }), e; } @@ -25515,11 +26027,11 @@ let MG = class { createHttpProvider(e, r) { const n = r || this.getCardanoRPCUrl(e); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new as(new As(n, Ar("disableProviderPing"))); + return new us(new Cs(n, Pr("disableProviderPing"))); } -}, TG = class { +}, uY = class { constructor(e) { - this.name = "elrond", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + this.name = "elrond", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } updateNamespace(e) { this.namespace = Object.assign(this.namespace, e); @@ -25531,7 +26043,7 @@ let MG = class { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); } getDefaultChain() { if (this.chainId) return this.chainId; @@ -25548,7 +26060,7 @@ let MG = class { const e = {}; return this.namespace.chains.forEach((r) => { var n; - const i = Sc(r); + const i = Nc(r); e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); }), e; } @@ -25562,14 +26074,14 @@ let MG = class { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Ni(e, this.namespace, this.client.core.projectId); + const n = r || Li(e, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new as(new As(n, Ar("disableProviderPing"))); + return new us(new Cs(n, Pr("disableProviderPing"))); } }; -class RG { +class fY { constructor(e) { - this.name = "multiversx", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + this.name = "multiversx", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } updateNamespace(e) { this.namespace = Object.assign(this.namespace, e); @@ -25581,7 +26093,7 @@ class RG { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); } getDefaultChain() { if (this.chainId) return this.chainId; @@ -25598,7 +26110,7 @@ class RG { const e = {}; return this.namespace.chains.forEach((r) => { var n; - const i = Sc(r); + const i = Nc(r); e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); }), e; } @@ -25612,14 +26124,14 @@ class RG { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Ni(e, this.namespace, this.client.core.projectId); + const n = r || Li(e, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new as(new As(n, Ar("disableProviderPing"))); + return new us(new Cs(n, Pr("disableProviderPing"))); } } -let DG = class { +let lY = class { constructor(e) { - this.name = "near", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + this.name = "near", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } updateNamespace(e) { this.namespace = Object.assign(this.namespace, e); @@ -25639,11 +26151,11 @@ let DG = class { } setDefaultChain(e, r) { if (this.chainId = e, !this.httpProviders[e]) { - const n = r || Ni(`${this.name}:${e}`, this.namespace); + const n = r || Li(`${this.name}:${e}`, this.namespace); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); this.setHttpProvider(e, n); } - this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); } getAccounts() { const e = this.namespace.accounts; @@ -25666,13 +26178,13 @@ let DG = class { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Ni(e, this.namespace); - return typeof n > "u" ? void 0 : new as(new As(n, Ar("disableProviderPing"))); + const n = r || Li(e, this.namespace); + return typeof n > "u" ? void 0 : new us(new Cs(n, Pr("disableProviderPing"))); } }; -class OG { +class hY { constructor(e) { - this.name = "tezos", this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + this.name = "tezos", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } updateNamespace(e) { this.namespace = Object.assign(this.namespace, e); @@ -25692,11 +26204,11 @@ class OG { } setDefaultChain(e, r) { if (this.chainId = e, !this.httpProviders[e]) { - const n = r || Ni(`${this.name}:${e}`, this.namespace); + const n = r || Li(`${this.name}:${e}`, this.namespace); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); this.setHttpProvider(e, n); } - this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); } getAccounts() { const e = this.namespace.accounts; @@ -25718,13 +26230,13 @@ class OG { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Ni(e, this.namespace); - return typeof n > "u" ? void 0 : new as(new As(n)); + const n = r || Li(e, this.namespace); + return typeof n > "u" ? void 0 : new us(new Cs(n)); } } -class NG { +class dY { constructor(e) { - this.name = Xc, this.namespace = e.namespace, this.events = Ar("events"), this.client = Ar("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + this.name = au, this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } updateNamespace(e) { this.namespace.chains = [...new Set((this.namespace.chains || []).concat(e.chains || []))], this.namespace.accounts = [...new Set((this.namespace.accounts || []).concat(e.accounts || []))], this.namespace.methods = [...new Set((this.namespace.methods || []).concat(e.methods || []))], this.namespace.events = [...new Set((this.namespace.events || []).concat(e.events || []))], this.httpProviders = this.createHttpProviders(); @@ -25736,7 +26248,7 @@ class NG { return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider(e.chainId).request(e.request); } setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(cs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); } getDefaultChain() { if (this.chainId) return this.chainId; @@ -25753,7 +26265,7 @@ class NG { var e, r; const n = {}; return (r = (e = this.namespace) == null ? void 0 : e.accounts) == null || r.forEach((i) => { - const s = hu(i); + const s = _u(i); n[`${s.namespace}:${s.reference}`] = this.createHttpProvider(i); }), n; } @@ -25767,32 +26279,32 @@ class NG { n && (this.httpProviders[e] = n); } createHttpProvider(e, r) { - const n = r || Ni(e, this.namespace, this.client.core.projectId); + const n = r || Li(e, this.namespace, this.client.core.projectId); if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new as(new As(n, Ar("disableProviderPing"))); + return new us(new Cs(n, Pr("disableProviderPing"))); } } -var LG = Object.defineProperty, kG = Object.defineProperties, $G = Object.getOwnPropertyDescriptors, e6 = Object.getOwnPropertySymbols, BG = Object.prototype.hasOwnProperty, FG = Object.prototype.propertyIsEnumerable, t6 = (t, e, r) => e in t ? LG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, hd = (t, e) => { - for (var r in e || (e = {})) BG.call(e, r) && t6(t, r, e[r]); - if (e6) for (var r of e6(e)) FG.call(e, r) && t6(t, r, e[r]); +var pY = Object.defineProperty, gY = Object.defineProperties, mY = Object.getOwnPropertyDescriptors, m_ = Object.getOwnPropertySymbols, vY = Object.prototype.hasOwnProperty, bY = Object.prototype.propertyIsEnumerable, v_ = (t, e, r) => e in t ? pY(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Ed = (t, e) => { + for (var r in e || (e = {})) vY.call(e, r) && v_(t, r, e[r]); + if (m_) for (var r of m_(e)) bY.call(e, r) && v_(t, r, e[r]); return t; -}, xm = (t, e) => kG(t, $G(e)); -let N1 = class SE { +}, Lm = (t, e) => gY(t, mY(e)); +let J1 = class ZE { constructor(e) { - this.events = new $v(), this.rpcProviders = {}, this.shouldAbortPairingAttempt = !1, this.maxPairingAttempts = 10, this.disableProviderPing = !1, this.providerOpts = e, this.logger = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : ql($0({ level: (e == null ? void 0 : e.logger) || W3 })), this.disableProviderPing = (e == null ? void 0 : e.disableProviderPing) || !1; + this.events = new Xv(), this.rpcProviders = {}, this.shouldAbortPairingAttempt = !1, this.maxPairingAttempts = 10, this.disableProviderPing = !1, this.providerOpts = e, this.logger = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : Xl(X0({ level: (e == null ? void 0 : e.logger) || o_ })), this.disableProviderPing = (e == null ? void 0 : e.disableProviderPing) || !1; } static async init(e) { - const r = new SE(e); + const r = new ZE(e); return await r.initialize(), r; } async request(e, r, n) { const [i, s] = this.validateChain(r); if (!this.session) throw new Error("Please call connect() before request()"); - return await this.getProvider(i).request({ request: hd({}, e), chainId: `${i}:${s}`, topic: this.session.topic, expiry: n }); + return await this.getProvider(i).request({ request: Ed({}, e), chainId: `${i}:${s}`, topic: this.session.topic, expiry: n }); } sendAsync(e, r, n, i) { const s = (/* @__PURE__ */ new Date()).getTime(); - this.request(e, n, i).then((o) => r(null, rp(s, o))).catch((o) => r(o, void 0)); + this.request(e, n, i).then((o) => r(null, mp(s, o))).catch((o) => r(o, void 0)); } async enable() { if (!this.client) throw new Error("Sign Client not initialized"); @@ -25814,8 +26326,8 @@ let N1 = class SE { n && (this.uri = n, this.events.emit("display_uri", n)); const s = await i(); if (this.session = s.session, this.session) { - const o = Y3(this.session.namespaces); - this.namespaces = bm(this.namespaces, o), this.persist("namespaces", this.namespaces), this.onConnect(); + const o = l_(this.session.namespaces); + this.namespaces = Dm(this.namespaces, o), this.persist("namespaces", this.namespaces), this.onConnect(); } return s; } @@ -25843,10 +26355,10 @@ let N1 = class SE { const { uri: n, approval: i } = await this.client.connect({ pairingTopic: e, requiredNamespaces: this.namespaces, optionalNamespaces: this.optionalNamespaces, sessionProperties: this.sessionProperties }); n && (this.uri = n, this.events.emit("display_uri", n)), await i().then((s) => { this.session = s; - const o = Y3(s.namespaces); - this.namespaces = bm(this.namespaces, o), this.persist("namespaces", this.namespaces); + const o = l_(s.namespaces); + this.namespaces = Dm(this.namespaces, o), this.persist("namespaces", this.namespaces); }).catch((s) => { - if (s.message !== wE) throw s; + if (s.message !== GE) throw s; r++; }); } while (!this.session); @@ -25856,7 +26368,7 @@ let N1 = class SE { try { if (!this.session) return; const [n, i] = this.validateChain(e), s = this.getProvider(n); - s.name === Xc ? s.setDefaultChain(`${n}:${i}`, r) : s.setDefaultChain(i, r); + s.name === au ? s.setDefaultChain(`${n}:${i}`, r) : s.setDefaultChain(i, r); } catch (n) { if (!/Please call connect/.test(n.message)) throw n; } @@ -25864,7 +26376,7 @@ let N1 = class SE { async cleanupPendingPairings(e = {}) { this.logger.info("Cleaning up inactive pairings..."); const r = this.client.pairing.getAll(); - if (pc(r)) { + if (_c(r)) { for (const n of r) e.deletePairings ? this.client.core.expirer.set(n.topic, 0) : await this.client.core.relayer.subscriber.unsubscribe(n.topic); this.logger.info(`Inactive pairings cleared: ${r.length}`); } @@ -25882,48 +26394,48 @@ let N1 = class SE { this.logger.trace("Initialized"), await this.createClient(), await this.checkStorage(), this.registerEventListeners(); } async createClient() { - this.client = this.providerOpts.client || await pb.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || W3, relayUrl: this.providerOpts.relayUrl || aG, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); + this.client = this.providerOpts.client || await Ib.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || o_, relayUrl: this.providerOpts.relayUrl || jG, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); } createProviders() { if (!this.client) throw new Error("Sign Client not initialized"); if (!this.session) throw new Error("Session not initialized. Please call connect() before enable()"); - const e = [...new Set(Object.keys(this.session.namespaces).map((r) => Ff(r)))]; - wm("client", this.client), wm("events", this.events), wm("disableProviderPing", this.disableProviderPing), e.forEach((r) => { + const e = [...new Set(Object.keys(this.session.namespaces).map((r) => Kf(r)))]; + Nm("client", this.client), Nm("events", this.events), Nm("disableProviderPing", this.disableProviderPing), e.forEach((r) => { if (!this.session) return; - const n = vG(r, this.session), i = _E(n), s = bm(this.namespaces, this.optionalNamespaces), o = xm(hd({}, s[r]), { accounts: n, chains: i }); + const n = JG(r, this.session), i = JE(n), s = Dm(this.namespaces, this.optionalNamespaces), o = Lm(Ed({}, s[r]), { accounts: n, chains: i }); switch (r) { case "eip155": - this.rpcProviders[r] = new AG({ namespace: o }); + this.rpcProviders[r] = new iY({ namespace: o }); break; case "algorand": - this.rpcProviders[r] = new IG({ namespace: o }); + this.rpcProviders[r] = new aY({ namespace: o }); break; case "solana": - this.rpcProviders[r] = new PG({ namespace: o }); + this.rpcProviders[r] = new sY({ namespace: o }); break; case "cosmos": - this.rpcProviders[r] = new MG({ namespace: o }); + this.rpcProviders[r] = new oY({ namespace: o }); break; case "polkadot": - this.rpcProviders[r] = new yG({ namespace: o }); + this.rpcProviders[r] = new ZG({ namespace: o }); break; case "cip34": - this.rpcProviders[r] = new CG({ namespace: o }); + this.rpcProviders[r] = new cY({ namespace: o }); break; case "elrond": - this.rpcProviders[r] = new TG({ namespace: o }); + this.rpcProviders[r] = new uY({ namespace: o }); break; case "multiversx": - this.rpcProviders[r] = new RG({ namespace: o }); + this.rpcProviders[r] = new fY({ namespace: o }); break; case "near": - this.rpcProviders[r] = new DG({ namespace: o }); + this.rpcProviders[r] = new lY({ namespace: o }); break; case "tezos": - this.rpcProviders[r] = new OG({ namespace: o }); + this.rpcProviders[r] = new hY({ namespace: o }); break; default: - this.rpcProviders[Xc] ? this.rpcProviders[Xc].updateNamespace(o) : this.rpcProviders[Xc] = new NG({ namespace: o }); + this.rpcProviders[au] ? this.rpcProviders[au].updateNamespace(o) : this.rpcProviders[au] = new dY({ namespace: o }); } }); } @@ -25935,24 +26447,24 @@ let N1 = class SE { const { params: r } = e, { event: n } = r; if (n.name === "accountsChanged") { const i = n.data; - i && pc(i) && this.events.emit("accountsChanged", i.map(bG)); + i && _c(i) && this.events.emit("accountsChanged", i.map(XG)); } else if (n.name === "chainChanged") { - const i = r.chainId, s = r.event.data, o = Ff(i), a = ym(i) !== ym(s) ? `${o}:${ym(s)}` : i; + const i = r.chainId, s = r.event.data, o = Kf(i), a = Om(i) !== Om(s) ? `${o}:${Om(s)}` : i; this.onChainChanged(a); } else this.events.emit(n.name, n.data); this.events.emit("session_event", e); }), this.client.on("session_update", ({ topic: e, params: r }) => { var n; const { namespaces: i } = r, s = (n = this.client) == null ? void 0 : n.session.get(e); - this.session = xm(hd({}, s), { namespaces: i }), this.onSessionUpdate(), this.events.emit("session_update", { topic: e, params: r }); + this.session = Lm(Ed({}, s), { namespaces: i }), this.onSessionUpdate(), this.events.emit("session_update", { topic: e, params: r }); }), this.client.on("session_delete", async (e) => { - await this.cleanup(), this.events.emit("session_delete", e), this.events.emit("disconnect", xm(hd({}, Or("USER_DISCONNECTED")), { data: e.topic })); - }), this.on(cs.DEFAULT_CHAIN_CHANGED, (e) => { + await this.cleanup(), this.events.emit("session_delete", e), this.events.emit("disconnect", Lm(Ed({}, Or("USER_DISCONNECTED")), { data: e.topic })); + }), this.on(fs.DEFAULT_CHAIN_CHANGED, (e) => { this.onChainChanged(e, !0); }); } getProvider(e) { - return this.rpcProviders[e] || this.rpcProviders[Xc]; + return this.rpcProviders[e] || this.rpcProviders[au]; } onSessionUpdate() { Object.keys(this.rpcProviders).forEach((e) => { @@ -25967,9 +26479,9 @@ let N1 = class SE { validateChain(e) { const [r, n] = (e == null ? void 0 : e.split(":")) || ["", ""]; if (!this.namespaces || !Object.keys(this.namespaces).length) return [r, n]; - if (r && !Object.keys(this.namespaces || {}).map((o) => Ff(o)).includes(r)) throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`); + if (r && !Object.keys(this.namespaces || {}).map((o) => Kf(o)).includes(r)) throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`); if (r && n) return [r, n]; - const i = Ff(Object.keys(this.namespaces)[0]), s = this.rpcProviders[i].getDefaultChain(); + const i = Kf(Object.keys(this.namespaces)[0]), s = this.rpcProviders[i].getDefaultChain(); return [i, s]; } async requestAccounts() { @@ -25988,14 +26500,14 @@ let N1 = class SE { this.session = void 0, this.namespaces = void 0, this.optionalNamespaces = void 0, this.sessionProperties = void 0, this.persist("namespaces", void 0), this.persist("optionalNamespaces", void 0), this.persist("sessionProperties", void 0), await this.cleanupPendingPairings({ deletePairings: !0 }); } persist(e, r) { - this.client.core.storage.setItem(`${H3}/${e}`, r); + this.client.core.storage.setItem(`${a_}/${e}`, r); } async getFromStore(e) { - return await this.client.core.storage.getItem(`${H3}/${e}`); + return await this.client.core.storage.getItem(`${a_}/${e}`); } }; -const jG = N1; -function UG() { +const yY = J1; +function wY() { return new Promise((t) => { const e = []; let r; @@ -26005,7 +26517,7 @@ function UG() { }), r = setTimeout(() => t(e), 200), window.dispatchEvent(new Event("eip6963:requestProvider")); }); } -class eo { +class no { constructor(e, r) { this.scope = e, this.module = r; } @@ -26037,7 +26549,7 @@ class eo { return `-${this.scope}${this.module ? `:${this.module}` : ""}:${e}`; } static clearAll() { - new eo("CBWSDK").clear(), new eo("walletlink").clear(); + new no("CBWSDK").clear(), new no("walletlink").clear(); } } const fn = { @@ -26062,7 +26574,7 @@ const fn = { chainDisconnected: 4901, unsupportedChain: 4902 } -}, L1 = { +}, X1 = { "-32700": { standard: "JSON RPC 2.0", message: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text." @@ -26131,92 +26643,92 @@ const fn = { standard: "EIP-3085", message: "Unrecognized chain ID." } -}, AE = "Unspecified error message.", qG = "Unspecified server error."; -function gb(t, e = AE) { +}, QE = "Unspecified error message.", xY = "Unspecified server error."; +function Cb(t, e = QE) { if (t && Number.isInteger(t)) { const r = t.toString(); - if (k1(L1, r)) - return L1[r].message; - if (PE(t)) - return qG; + if (Z1(X1, r)) + return X1[r].message; + if (eS(t)) + return xY; } return e; } -function zG(t) { +function _Y(t) { if (!Number.isInteger(t)) return !1; const e = t.toString(); - return !!(L1[e] || PE(t)); + return !!(X1[e] || eS(t)); } -function WG(t, { shouldIncludeStack: e = !1 } = {}) { +function EY(t, { shouldIncludeStack: e = !1 } = {}) { const r = {}; - if (t && typeof t == "object" && !Array.isArray(t) && k1(t, "code") && zG(t.code)) { + if (t && typeof t == "object" && !Array.isArray(t) && Z1(t, "code") && _Y(t.code)) { const n = t; - r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, k1(n, "data") && (r.data = n.data)) : (r.message = gb(r.code), r.data = { originalError: r6(t) }); + r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, Z1(n, "data") && (r.data = n.data)) : (r.message = Cb(r.code), r.data = { originalError: b_(t) }); } else - r.code = fn.rpc.internal, r.message = n6(t, "message") ? t.message : AE, r.data = { originalError: r6(t) }; - return e && (r.stack = n6(t, "stack") ? t.stack : void 0), r; + r.code = fn.rpc.internal, r.message = y_(t, "message") ? t.message : QE, r.data = { originalError: b_(t) }; + return e && (r.stack = y_(t, "stack") ? t.stack : void 0), r; } -function PE(t) { +function eS(t) { return t >= -32099 && t <= -32e3; } -function r6(t) { +function b_(t) { return t && typeof t == "object" && !Array.isArray(t) ? Object.assign({}, t) : t; } -function k1(t, e) { +function Z1(t, e) { return Object.prototype.hasOwnProperty.call(t, e); } -function n6(t, e) { +function y_(t, e) { return typeof t == "object" && t !== null && e in t && typeof t[e] == "string"; } -const Sr = { +const Ar = { rpc: { - parse: (t) => Gi(fn.rpc.parse, t), - invalidRequest: (t) => Gi(fn.rpc.invalidRequest, t), - invalidParams: (t) => Gi(fn.rpc.invalidParams, t), - methodNotFound: (t) => Gi(fn.rpc.methodNotFound, t), - internal: (t) => Gi(fn.rpc.internal, t), + parse: (t) => Ji(fn.rpc.parse, t), + invalidRequest: (t) => Ji(fn.rpc.invalidRequest, t), + invalidParams: (t) => Ji(fn.rpc.invalidParams, t), + methodNotFound: (t) => Ji(fn.rpc.methodNotFound, t), + internal: (t) => Ji(fn.rpc.internal, t), server: (t) => { if (!t || typeof t != "object" || Array.isArray(t)) throw new Error("Ethereum RPC Server errors must provide single object argument."); const { code: e } = t; if (!Number.isInteger(e) || e > -32005 || e < -32099) throw new Error('"code" must be an integer such that: -32099 <= code <= -32005'); - return Gi(e, t); + return Ji(e, t); }, - invalidInput: (t) => Gi(fn.rpc.invalidInput, t), - resourceNotFound: (t) => Gi(fn.rpc.resourceNotFound, t), - resourceUnavailable: (t) => Gi(fn.rpc.resourceUnavailable, t), - transactionRejected: (t) => Gi(fn.rpc.transactionRejected, t), - methodNotSupported: (t) => Gi(fn.rpc.methodNotSupported, t), - limitExceeded: (t) => Gi(fn.rpc.limitExceeded, t) + invalidInput: (t) => Ji(fn.rpc.invalidInput, t), + resourceNotFound: (t) => Ji(fn.rpc.resourceNotFound, t), + resourceUnavailable: (t) => Ji(fn.rpc.resourceUnavailable, t), + transactionRejected: (t) => Ji(fn.rpc.transactionRejected, t), + methodNotSupported: (t) => Ji(fn.rpc.methodNotSupported, t), + limitExceeded: (t) => Ji(fn.rpc.limitExceeded, t) }, provider: { - userRejectedRequest: (t) => Vc(fn.provider.userRejectedRequest, t), - unauthorized: (t) => Vc(fn.provider.unauthorized, t), - unsupportedMethod: (t) => Vc(fn.provider.unsupportedMethod, t), - disconnected: (t) => Vc(fn.provider.disconnected, t), - chainDisconnected: (t) => Vc(fn.provider.chainDisconnected, t), - unsupportedChain: (t) => Vc(fn.provider.unsupportedChain, t), + userRejectedRequest: (t) => nu(fn.provider.userRejectedRequest, t), + unauthorized: (t) => nu(fn.provider.unauthorized, t), + unsupportedMethod: (t) => nu(fn.provider.unsupportedMethod, t), + disconnected: (t) => nu(fn.provider.disconnected, t), + chainDisconnected: (t) => nu(fn.provider.chainDisconnected, t), + unsupportedChain: (t) => nu(fn.provider.unsupportedChain, t), custom: (t) => { if (!t || typeof t != "object" || Array.isArray(t)) throw new Error("Ethereum Provider custom errors must provide single object argument."); const { code: e, message: r, data: n } = t; if (!r || typeof r != "string") throw new Error('"message" must be a nonempty string'); - return new CE(e, r, n); + return new nS(e, r, n); } } }; -function Gi(t, e) { - const [r, n] = ME(e); - return new IE(t, r || gb(t), n); +function Ji(t, e) { + const [r, n] = tS(e); + return new rS(t, r || Cb(t), n); } -function Vc(t, e) { - const [r, n] = ME(e); - return new CE(t, r || gb(t), n); +function nu(t, e) { + const [r, n] = tS(e); + return new nS(t, r || Cb(t), n); } -function ME(t) { +function tS(t) { if (t) { if (typeof t == "string") return [t]; @@ -26229,7 +26741,7 @@ function ME(t) { } return []; } -class IE extends Error { +class rS extends Error { constructor(e, r, n) { if (!Number.isInteger(e)) throw new Error('"code" must be an integer.'); @@ -26238,141 +26750,141 @@ class IE extends Error { super(r), this.code = e, n !== void 0 && (this.data = n); } } -class CE extends IE { +class nS extends rS { /** * Create an Ethereum Provider JSON-RPC error. * `code` must be an integer in the 1000 <= 4999 range. */ constructor(e, r, n) { - if (!HG(e)) + if (!SY(e)) throw new Error('"code" must be an integer such that: 1000 <= code <= 4999'); super(e, r, n); } } -function HG(t) { +function SY(t) { return Number.isInteger(t) && t >= 1e3 && t <= 4999; } -function mb() { +function Tb() { return (t) => t; } -const Al = mb(), KG = mb(), VG = mb(); -function _o(t) { +const kl = Tb(), AY = Tb(), PY = Tb(); +function Po(t) { return Math.floor(t); } -const TE = /^[0-9]*$/, RE = /^[a-f0-9]*$/; -function Qa(t) { - return vb(crypto.getRandomValues(new Uint8Array(t))); +const iS = /^[0-9]*$/, sS = /^[a-f0-9]*$/; +function sc(t) { + return Rb(crypto.getRandomValues(new Uint8Array(t))); } -function vb(t) { +function Rb(t) { return [...t].map((e) => e.toString(16).padStart(2, "0")).join(""); } -function Dd(t) { +function Wd(t) { return new Uint8Array(t.match(/.{1,2}/g).map((e) => Number.parseInt(e, 16))); } -function Hf(t, e = !1) { +function Zf(t, e = !1) { const r = t.toString("hex"); - return Al(e ? `0x${r}` : r); + return kl(e ? `0x${r}` : r); } -function _m(t) { - return Hf($1(t), !0); +function km(t) { + return Zf(Q1(t), !0); } -function $s(t) { - return VG(t.toString(10)); +function js(t) { + return PY(t.toString(10)); } -function pa(t) { - return Al(`0x${BigInt(t).toString(16)}`); +function ma(t) { + return kl(`0x${BigInt(t).toString(16)}`); } -function DE(t) { +function oS(t) { return t.startsWith("0x") || t.startsWith("0X"); } -function bb(t) { - return DE(t) ? t.slice(2) : t; +function Db(t) { + return oS(t) ? t.slice(2) : t; } -function OE(t) { - return DE(t) ? `0x${t.slice(2)}` : `0x${t}`; +function aS(t) { + return oS(t) ? `0x${t.slice(2)}` : `0x${t}`; } -function ap(t) { +function xp(t) { if (typeof t != "string") return !1; - const e = bb(t).toLowerCase(); - return RE.test(e); + const e = Db(t).toLowerCase(); + return sS.test(e); } -function GG(t, e = !1) { +function MY(t, e = !1) { if (typeof t == "string") { - const r = bb(t).toLowerCase(); - if (RE.test(r)) - return Al(e ? `0x${r}` : r); + const r = Db(t).toLowerCase(); + if (sS.test(r)) + return kl(e ? `0x${r}` : r); } - throw Sr.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`); + throw Ar.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`); } -function yb(t, e = !1) { - let r = GG(t, !1); - return r.length % 2 === 1 && (r = Al(`0${r}`)), e ? Al(`0x${r}`) : r; +function Ob(t, e = !1) { + let r = MY(t, !1); + return r.length % 2 === 1 && (r = kl(`0${r}`)), e ? kl(`0x${r}`) : r; } -function ra(t) { +function ia(t) { if (typeof t == "string") { - const e = bb(t).toLowerCase(); - if (ap(e) && e.length === 40) - return KG(OE(e)); + const e = Db(t).toLowerCase(); + if (xp(e) && e.length === 40) + return AY(aS(e)); } - throw Sr.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`); + throw Ar.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`); } -function $1(t) { +function Q1(t) { if (Buffer.isBuffer(t)) return t; if (typeof t == "string") { - if (ap(t)) { - const e = yb(t, !1); + if (xp(t)) { + const e = Ob(t, !1); return Buffer.from(e, "hex"); } return Buffer.from(t, "utf8"); } - throw Sr.rpc.invalidParams(`Not binary data: ${String(t)}`); + throw Ar.rpc.invalidParams(`Not binary data: ${String(t)}`); } -function Kf(t) { +function Qf(t) { if (typeof t == "number" && Number.isInteger(t)) - return _o(t); + return Po(t); if (typeof t == "string") { - if (TE.test(t)) - return _o(Number(t)); - if (ap(t)) - return _o(Number(BigInt(yb(t, !0)))); + if (iS.test(t)) + return Po(Number(t)); + if (xp(t)) + return Po(Number(BigInt(Ob(t, !0)))); } - throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`); + throw Ar.rpc.invalidParams(`Not an integer: ${String(t)}`); } -function Rf(t) { - if (t !== null && (typeof t == "bigint" || JG(t))) +function Bf(t) { + if (t !== null && (typeof t == "bigint" || CY(t))) return BigInt(t.toString(10)); if (typeof t == "number") - return BigInt(Kf(t)); + return BigInt(Qf(t)); if (typeof t == "string") { - if (TE.test(t)) + if (iS.test(t)) return BigInt(t); - if (ap(t)) - return BigInt(yb(t, !0)); + if (xp(t)) + return BigInt(Ob(t, !0)); } - throw Sr.rpc.invalidParams(`Not an integer: ${String(t)}`); + throw Ar.rpc.invalidParams(`Not an integer: ${String(t)}`); } -function YG(t) { +function IY(t) { if (typeof t == "string") return JSON.parse(t); if (typeof t == "object") return t; - throw Sr.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`); + throw Ar.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`); } -function JG(t) { +function CY(t) { if (t == null || typeof t.constructor != "function") return !1; const { constructor: e } = t; return typeof e.config == "function" && typeof e.EUCLID == "number"; } -async function XG() { +async function TY() { return crypto.subtle.generateKey({ name: "ECDH", namedCurve: "P-256" }, !0, ["deriveKey"]); } -async function ZG(t, e) { +async function RY(t, e) { return crypto.subtle.deriveKey({ name: "ECDH", public: e @@ -26381,21 +26893,21 @@ async function ZG(t, e) { length: 256 }, !1, ["encrypt", "decrypt"]); } -async function QG(t, e) { +async function DY(t, e) { const r = crypto.getRandomValues(new Uint8Array(12)), n = await crypto.subtle.encrypt({ name: "AES-GCM", iv: r }, t, new TextEncoder().encode(e)); return { iv: r, cipherText: n }; } -async function eY(t, { iv: e, cipherText: r }) { +async function OY(t, { iv: e, cipherText: r }) { const n = await crypto.subtle.decrypt({ name: "AES-GCM", iv: e }, t, r); return new TextDecoder().decode(n); } -function NE(t) { +function cS(t) { switch (t) { case "public": return "spki"; @@ -26403,42 +26915,42 @@ function NE(t) { return "pkcs8"; } } -async function LE(t, e) { - const r = NE(t), n = await crypto.subtle.exportKey(r, e); - return vb(new Uint8Array(n)); +async function uS(t, e) { + const r = cS(t), n = await crypto.subtle.exportKey(r, e); + return Rb(new Uint8Array(n)); } -async function kE(t, e) { - const r = NE(t), n = Dd(e).buffer; +async function fS(t, e) { + const r = cS(t), n = Wd(e).buffer; return await crypto.subtle.importKey(r, new Uint8Array(n), { name: "ECDH", namedCurve: "P-256" }, !0, t === "private" ? ["deriveKey"] : []); } -async function tY(t, e) { +async function NY(t, e) { const r = JSON.stringify(t, (n, i) => { if (!(i instanceof Error)) return i; const s = i; return Object.assign(Object.assign({}, s.code ? { code: s.code } : {}), { message: s.message }); }); - return QG(e, r); + return DY(e, r); } -async function rY(t, e) { - return JSON.parse(await eY(e, t)); +async function LY(t, e) { + return JSON.parse(await OY(e, t)); } -const Em = { +const $m = { storageKey: "ownPrivateKey", keyType: "private" -}, Sm = { +}, Bm = { storageKey: "ownPublicKey", keyType: "public" -}, Am = { +}, Fm = { storageKey: "peerPublicKey", keyType: "public" }; -class nY { +class kY { constructor() { - this.storage = new eo("CBWSDK", "SCWKeyManager"), this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null; + this.storage = new no("CBWSDK", "SCWKeyManager"), this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null; } async getOwnPublicKey() { return await this.loadKeysIfNeeded(), this.ownPublicKey; @@ -26448,52 +26960,52 @@ class nY { return await this.loadKeysIfNeeded(), this.sharedSecret; } async setPeerPublicKey(e) { - this.sharedSecret = null, this.peerPublicKey = e, await this.storeKey(Am, e), await this.loadKeysIfNeeded(); + this.sharedSecret = null, this.peerPublicKey = e, await this.storeKey(Fm, e), await this.loadKeysIfNeeded(); } async clear() { - this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null, this.storage.removeItem(Sm.storageKey), this.storage.removeItem(Em.storageKey), this.storage.removeItem(Am.storageKey); + this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null, this.storage.removeItem(Bm.storageKey), this.storage.removeItem($m.storageKey), this.storage.removeItem(Fm.storageKey); } async generateKeyPair() { - const e = await XG(); - this.ownPrivateKey = e.privateKey, this.ownPublicKey = e.publicKey, await this.storeKey(Em, e.privateKey), await this.storeKey(Sm, e.publicKey); + const e = await TY(); + this.ownPrivateKey = e.privateKey, this.ownPublicKey = e.publicKey, await this.storeKey($m, e.privateKey), await this.storeKey(Bm, e.publicKey); } async loadKeysIfNeeded() { - if (this.ownPrivateKey === null && (this.ownPrivateKey = await this.loadKey(Em)), this.ownPublicKey === null && (this.ownPublicKey = await this.loadKey(Sm)), (this.ownPrivateKey === null || this.ownPublicKey === null) && await this.generateKeyPair(), this.peerPublicKey === null && (this.peerPublicKey = await this.loadKey(Am)), this.sharedSecret === null) { + if (this.ownPrivateKey === null && (this.ownPrivateKey = await this.loadKey($m)), this.ownPublicKey === null && (this.ownPublicKey = await this.loadKey(Bm)), (this.ownPrivateKey === null || this.ownPublicKey === null) && await this.generateKeyPair(), this.peerPublicKey === null && (this.peerPublicKey = await this.loadKey(Fm)), this.sharedSecret === null) { if (this.ownPrivateKey === null || this.peerPublicKey === null) return; - this.sharedSecret = await ZG(this.ownPrivateKey, this.peerPublicKey); + this.sharedSecret = await RY(this.ownPrivateKey, this.peerPublicKey); } } // storage methods async loadKey(e) { const r = this.storage.getItem(e.storageKey); - return r ? kE(e.keyType, r) : null; + return r ? fS(e.keyType, r) : null; } async storeKey(e, r) { - const n = await LE(e.keyType, r); + const n = await uS(e.keyType, r); this.storage.setItem(e.storageKey, n); } } -const nh = "4.2.4", $E = "@coinbase/wallet-sdk"; -async function BE(t, e) { +const hh = "4.2.4", lS = "@coinbase/wallet-sdk"; +async function hS(t, e) { const r = Object.assign(Object.assign({}, t), { jsonrpc: "2.0", id: crypto.randomUUID() }), n = await window.fetch(e, { method: "POST", body: JSON.stringify(r), mode: "cors", headers: { "Content-Type": "application/json", - "X-Cbw-Sdk-Version": nh, - "X-Cbw-Sdk-Platform": $E + "X-Cbw-Sdk-Version": hh, + "X-Cbw-Sdk-Platform": lS } }), { result: i, error: s } = await n.json(); if (s) throw s; return i; } -function iY() { +function $Y() { return globalThis.coinbaseWalletExtension; } -function sY() { +function BY() { var t, e; try { const r = globalThis; @@ -26502,32 +27014,32 @@ function sY() { return; } } -function oY({ metadata: t, preference: e }) { +function FY({ metadata: t, preference: e }) { var r, n; const { appName: i, appLogoUrl: s, appChainIds: o } = t; if (e.options !== "smartWalletOnly") { - const u = iY(); + const u = $Y(); if (u) return (r = u.setAppInfo) === null || r === void 0 || r.call(u, i, s, o, e), u; } - const a = sY(); + const a = BY(); if (a != null && a.isCoinbaseBrowser) return (n = a.setAppInfo) === null || n === void 0 || n.call(a, i, s, o, e), a; } -function aY(t) { +function jY(t) { if (!t || typeof t != "object" || Array.isArray(t)) - throw Sr.rpc.invalidParams({ + throw Ar.rpc.invalidParams({ message: "Expected a single, non-array, object argument.", data: t }); const { method: e, params: r } = t; if (typeof e != "string" || e.length === 0) - throw Sr.rpc.invalidParams({ + throw Ar.rpc.invalidParams({ message: "'args.method' must be a non-empty string.", data: t }); if (r !== void 0 && !Array.isArray(r) && (typeof r != "object" || r === null)) - throw Sr.rpc.invalidParams({ + throw Ar.rpc.invalidParams({ message: "'args.params' must be an object or array if provided.", data: t }); @@ -26536,14 +27048,14 @@ function aY(t) { case "eth_signTypedData_v2": case "eth_subscribe": case "eth_unsubscribe": - throw Sr.provider.unsupportedMethod(); + throw Ar.provider.unsupportedMethod(); } } -const i6 = "accounts", s6 = "activeChain", o6 = "availableChains", a6 = "walletCapabilities"; -class cY { +const w_ = "accounts", x_ = "activeChain", __ = "availableChains", E_ = "walletCapabilities"; +class UY { constructor(e) { var r, n, i; - this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new nY(), this.storage = new eo("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(i6)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(s6) || { + this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new kY(), this.storage = new no("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(w_)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(x_) || { id: (i = (n = e.metadata.appChainIds) === null || n === void 0 ? void 0 : n[0]) !== null && i !== void 0 ? i : 1 }, this.handshake = this.handshake.bind(this), this.request = this.request.bind(this), this.createRequestMessage = this.createRequestMessage.bind(this), this.decryptResponseMessage = this.decryptResponseMessage.bind(this); } @@ -26557,21 +27069,21 @@ class cY { }), s = await this.communicator.postRequestAndWaitForResponse(i); if ("failure" in s.content) throw s.content.failure; - const o = await kE("public", s.sender); + const o = await fS("public", s.sender); await this.keyManager.setPeerPublicKey(o); const u = (await this.decryptResponseMessage(s)).result; if ("error" in u) throw u.error; const l = u.value; - this.accounts = l, this.storage.storeObject(i6, l), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", l); + this.accounts = l, this.storage.storeObject(w_, l), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", l); } async request(e) { var r; if (this.accounts.length === 0) - throw Sr.provider.unauthorized(); + throw Ar.provider.unauthorized(); switch (e.method) { case "eth_requestAccounts": - return (r = this.callback) === null || r === void 0 || r.call(this, "connect", { chainId: pa(this.chain.id) }), this.accounts; + return (r = this.callback) === null || r === void 0 || r.call(this, "connect", { chainId: ma(this.chain.id) }), this.accounts; case "eth_accounts": return this.accounts; case "eth_coinbase": @@ -26579,9 +27091,9 @@ class cY { case "net_version": return this.chain.id; case "eth_chainId": - return pa(this.chain.id); + return ma(this.chain.id); case "wallet_getCapabilities": - return this.storage.loadObject(a6); + return this.storage.loadObject(E_); case "wallet_switchEthereumChain": return this.handleSwitchChainRequest(e); case "eth_ecRecover": @@ -26601,8 +27113,8 @@ class cY { return this.sendRequestToPopup(e); default: if (!this.chain.rpcUrl) - throw Sr.rpc.internal("No RPC URL set for chain"); - return BE(e, this.chain.rpcUrl); + throw Ar.rpc.internal("No RPC URL set for chain"); + return hS(e, this.chain.rpcUrl); } } async sendRequestToPopup(e) { @@ -26627,8 +27139,8 @@ class cY { var r; const n = e.params; if (!n || !(!((r = n[0]) === null || r === void 0) && r.chainId)) - throw Sr.rpc.invalidParams(); - const i = Kf(n[0].chainId); + throw Ar.rpc.invalidParams(); + const i = Qf(n[0].chainId); if (this.updateChain(i)) return null; const o = await this.sendRequestToPopup(e); @@ -26637,15 +27149,15 @@ class cY { async sendEncryptedRequest(e) { const r = await this.keyManager.getSharedSecret(); if (!r) - throw Sr.provider.unauthorized("No valid session found, try requestAccounts before other methods"); - const n = await tY({ + throw Ar.provider.unauthorized("No valid session found, try requestAccounts before other methods"); + const n = await NY({ action: e, chainId: this.chain.id }, r), i = await this.createRequestMessage({ encrypted: n }); return this.communicator.postRequestAndWaitForResponse(i); } async createRequestMessage(e) { - const r = await LE("public", await this.keyManager.getOwnPublicKey()); + const r = await uS("public", await this.keyManager.getOwnPublicKey()); return { id: crypto.randomUUID(), sender: r, @@ -26660,32 +27172,32 @@ class cY { throw i.failure; const s = await this.keyManager.getSharedSecret(); if (!s) - throw Sr.provider.unauthorized("Invalid session"); - const o = await rY(i.encrypted, s), a = (r = o.data) === null || r === void 0 ? void 0 : r.chains; + throw Ar.provider.unauthorized("Invalid session"); + const o = await LY(i.encrypted, s), a = (r = o.data) === null || r === void 0 ? void 0 : r.chains; if (a) { const l = Object.entries(a).map(([d, p]) => ({ id: Number(d), rpcUrl: p })); - this.storage.storeObject(o6, l), this.updateChain(this.chain.id, l); + this.storage.storeObject(__, l), this.updateChain(this.chain.id, l); } const u = (n = o.data) === null || n === void 0 ? void 0 : n.capabilities; - return u && this.storage.storeObject(a6, u), o; + return u && this.storage.storeObject(E_, u), o; } updateChain(e, r) { var n; - const i = r ?? this.storage.loadObject(o6), s = i == null ? void 0 : i.find((o) => o.id === e); - return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(s6, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(s.id))), !0) : !1; + const i = r ?? this.storage.loadObject(__), s = i == null ? void 0 : i.find((o) => o.id === e); + return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(x_, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", ma(s.id))), !0) : !1; } } -const uY = /* @__PURE__ */ yv(UD), { keccak_256: fY } = uY; -function FE(t) { +const qY = /* @__PURE__ */ Lv(mO), { keccak_256: zY } = qY; +function dS(t) { return Buffer.allocUnsafe(t).fill(0); } -function lY(t) { +function WY(t) { return t.toString(2).length; } -function jE(t, e) { +function pS(t, e) { let r = t.toString(16); r.length % 2 !== 0 && (r = "0" + r); const n = r.match(/.{1,2}/g).map((i) => parseInt(i, 16)); @@ -26693,7 +27205,7 @@ function jE(t, e) { n.unshift(0); return Buffer.from(n); } -function hY(t, e) { +function HY(t, e) { const r = t < 0n; let n; if (r) { @@ -26703,77 +27215,77 @@ function hY(t, e) { n = t; return n &= (1n << BigInt(e)) - 1n, n; } -function UE(t, e, r) { - const n = FE(e); - return t = cp(t), r ? t.length < e ? (t.copy(n), n) : t.slice(0, e) : t.length < e ? (t.copy(n, e - t.length), n) : t.slice(-e); +function gS(t, e, r) { + const n = dS(e); + return t = _p(t), r ? t.length < e ? (t.copy(n), n) : t.slice(0, e) : t.length < e ? (t.copy(n, e - t.length), n) : t.slice(-e); } -function dY(t, e) { - return UE(t, e, !0); +function KY(t, e) { + return gS(t, e, !0); } -function cp(t) { +function _p(t) { if (!Buffer.isBuffer(t)) if (Array.isArray(t)) t = Buffer.from(t); else if (typeof t == "string") - qE(t) ? t = Buffer.from(mY(zE(t)), "hex") : t = Buffer.from(t); + mS(t) ? t = Buffer.from(YY(vS(t)), "hex") : t = Buffer.from(t); else if (typeof t == "number") t = intToBuffer(t); else if (t == null) t = Buffer.allocUnsafe(0); else if (typeof t == "bigint") - t = jE(t); + t = pS(t); else if (t.toArray) t = Buffer.from(t.toArray()); else throw new Error("invalid type"); return t; } -function pY(t) { - return t = cp(t), "0x" + t.toString("hex"); +function VY(t) { + return t = _p(t), "0x" + t.toString("hex"); } -function gY(t, e) { - if (t = cp(t), e || (e = 256), e !== 256) +function GY(t, e) { + if (t = _p(t), e || (e = 256), e !== 256) throw new Error("unsupported"); - return Buffer.from(fY(new Uint8Array(t))); + return Buffer.from(zY(new Uint8Array(t))); } -function mY(t) { +function YY(t) { return t.length % 2 ? "0" + t : t; } -function qE(t) { +function mS(t) { return typeof t == "string" && t.match(/^0x[0-9A-Fa-f]*$/); } -function zE(t) { +function vS(t) { return typeof t == "string" && t.startsWith("0x") ? t.slice(2) : t; } -var WE = { - zeros: FE, - setLength: UE, - setLengthRight: dY, - isHexString: qE, - stripHexPrefix: zE, - toBuffer: cp, - bufferToHex: pY, - keccak: gY, - bitLengthFromBigInt: lY, - bufferBEFromBigInt: jE, - twosFromBigInt: hY -}; -const si = WE; -function HE(t) { +var bS = { + zeros: dS, + setLength: gS, + setLengthRight: KY, + isHexString: mS, + stripHexPrefix: vS, + toBuffer: _p, + bufferToHex: VY, + keccak: GY, + bitLengthFromBigInt: WY, + bufferBEFromBigInt: pS, + twosFromBigInt: HY +}; +const oi = bS; +function yS(t) { return t.startsWith("int[") ? "int256" + t.slice(3) : t === "int" ? "int256" : t.startsWith("uint[") ? "uint256" + t.slice(4) : t === "uint" ? "uint256" : t.startsWith("fixed[") ? "fixed128x128" + t.slice(5) : t === "fixed" ? "fixed128x128" : t.startsWith("ufixed[") ? "ufixed128x128" + t.slice(6) : t === "ufixed" ? "ufixed128x128" : t; } -function pu(t) { +function Su(t) { return Number.parseInt(/^\D+(\d+)$/.exec(t)[1], 10); } -function c6(t) { +function S_(t) { var e = /^\D+(\d+)x(\d+)$/.exec(t); return [Number.parseInt(e[1], 10), Number.parseInt(e[2], 10)]; } -function KE(t) { +function wS(t) { var e = t.match(/(.*)\[(.*?)\]$/); return e ? e[2] === "" ? "dynamic" : Number.parseInt(e[2], 10) : null; } -function ec(t) { +function oc(t) { var e = typeof t; if (e === "string" || e === "number") return BigInt(t); @@ -26781,81 +27293,81 @@ function ec(t) { return t; throw new Error("Argument is not a number"); } -function qs(t, e) { +function Hs(t, e) { var r, n, i, s; if (t === "address") - return qs("uint160", ec(e)); + return Hs("uint160", oc(e)); if (t === "bool") - return qs("uint8", e ? 1 : 0); + return Hs("uint8", e ? 1 : 0); if (t === "string") - return qs("bytes", new Buffer(e, "utf8")); - if (bY(t)) { + return Hs("bytes", new Buffer(e, "utf8")); + if (XY(t)) { if (typeof e.length > "u") throw new Error("Not an array?"); - if (r = KE(t), r !== "dynamic" && r !== 0 && e.length > r) + if (r = wS(t), r !== "dynamic" && r !== 0 && e.length > r) throw new Error("Elements exceed array size: " + r); i = [], t = t.slice(0, t.lastIndexOf("[")), typeof e == "string" && (e = JSON.parse(e)); for (s in e) - i.push(qs(t, e[s])); + i.push(Hs(t, e[s])); if (r === "dynamic") { - var o = qs("uint256", e.length); + var o = Hs("uint256", e.length); i.unshift(o); } return Buffer.concat(i); } else { if (t === "bytes") - return e = new Buffer(e), i = Buffer.concat([qs("uint256", e.length), e]), e.length % 32 !== 0 && (i = Buffer.concat([i, si.zeros(32 - e.length % 32)])), i; + return e = new Buffer(e), i = Buffer.concat([Hs("uint256", e.length), e]), e.length % 32 !== 0 && (i = Buffer.concat([i, oi.zeros(32 - e.length % 32)])), i; if (t.startsWith("bytes")) { - if (r = pu(t), r < 1 || r > 32) + if (r = Su(t), r < 1 || r > 32) throw new Error("Invalid bytes width: " + r); - return si.setLengthRight(e, 32); + return oi.setLengthRight(e, 32); } else if (t.startsWith("uint")) { - if (r = pu(t), r % 8 || r < 8 || r > 256) + if (r = Su(t), r % 8 || r < 8 || r > 256) throw new Error("Invalid uint width: " + r); - n = ec(e); - const a = si.bitLengthFromBigInt(n); + n = oc(e); + const a = oi.bitLengthFromBigInt(n); if (a > r) throw new Error("Supplied uint exceeds width: " + r + " vs " + a); if (n < 0) throw new Error("Supplied uint is negative"); - return si.bufferBEFromBigInt(n, 32); + return oi.bufferBEFromBigInt(n, 32); } else if (t.startsWith("int")) { - if (r = pu(t), r % 8 || r < 8 || r > 256) + if (r = Su(t), r % 8 || r < 8 || r > 256) throw new Error("Invalid int width: " + r); - n = ec(e); - const a = si.bitLengthFromBigInt(n); + n = oc(e); + const a = oi.bitLengthFromBigInt(n); if (a > r) throw new Error("Supplied int exceeds width: " + r + " vs " + a); - const u = si.twosFromBigInt(n, 256); - return si.bufferBEFromBigInt(u, 32); + const u = oi.twosFromBigInt(n, 256); + return oi.bufferBEFromBigInt(u, 32); } else if (t.startsWith("ufixed")) { - if (r = c6(t), n = ec(e), n < 0) + if (r = S_(t), n = oc(e), n < 0) throw new Error("Supplied ufixed is negative"); - return qs("uint256", n * BigInt(2) ** BigInt(r[1])); + return Hs("uint256", n * BigInt(2) ** BigInt(r[1])); } else if (t.startsWith("fixed")) - return r = c6(t), qs("int256", ec(e) * BigInt(2) ** BigInt(r[1])); + return r = S_(t), Hs("int256", oc(e) * BigInt(2) ** BigInt(r[1])); } throw new Error("Unsupported or invalid type: " + t); } -function vY(t) { - return t === "string" || t === "bytes" || KE(t) === "dynamic"; +function JY(t) { + return t === "string" || t === "bytes" || wS(t) === "dynamic"; } -function bY(t) { +function XY(t) { return t.lastIndexOf("]") === t.length - 1; } -function yY(t, e) { +function ZY(t, e) { var r = [], n = [], i = 32 * t.length; for (var s in t) { - var o = HE(t[s]), a = e[s], u = qs(o, a); - vY(o) ? (r.push(qs("uint256", i)), n.push(u), i += u.length) : r.push(u); + var o = yS(t[s]), a = e[s], u = Hs(o, a); + JY(o) ? (r.push(Hs("uint256", i)), n.push(u), i += u.length) : r.push(u); } return Buffer.concat(r.concat(n)); } -function VE(t, e) { +function xS(t, e) { if (t.length !== e.length) throw new Error("Number of types are not matching the values"); for (var r, n, i = [], s = 0; s < t.length; s++) { - var o = HE(t[s]), a = e[s]; + var o = yS(t[s]), a = e[s]; if (o === "bytes") i.push(a); else if (o === "string") @@ -26863,42 +27375,42 @@ function VE(t, e) { else if (o === "bool") i.push(new Buffer(a ? "01" : "00", "hex")); else if (o === "address") - i.push(si.setLength(a, 20)); + i.push(oi.setLength(a, 20)); else if (o.startsWith("bytes")) { - if (r = pu(o), r < 1 || r > 32) + if (r = Su(o), r < 1 || r > 32) throw new Error("Invalid bytes width: " + r); - i.push(si.setLengthRight(a, r)); + i.push(oi.setLengthRight(a, r)); } else if (o.startsWith("uint")) { - if (r = pu(o), r % 8 || r < 8 || r > 256) + if (r = Su(o), r % 8 || r < 8 || r > 256) throw new Error("Invalid uint width: " + r); - n = ec(a); - const u = si.bitLengthFromBigInt(n); + n = oc(a); + const u = oi.bitLengthFromBigInt(n); if (u > r) throw new Error("Supplied uint exceeds width: " + r + " vs " + u); - i.push(si.bufferBEFromBigInt(n, r / 8)); + i.push(oi.bufferBEFromBigInt(n, r / 8)); } else if (o.startsWith("int")) { - if (r = pu(o), r % 8 || r < 8 || r > 256) + if (r = Su(o), r % 8 || r < 8 || r > 256) throw new Error("Invalid int width: " + r); - n = ec(a); - const u = si.bitLengthFromBigInt(n); + n = oc(a); + const u = oi.bitLengthFromBigInt(n); if (u > r) throw new Error("Supplied int exceeds width: " + r + " vs " + u); - const l = si.twosFromBigInt(n, r); - i.push(si.bufferBEFromBigInt(l, r / 8)); + const l = oi.twosFromBigInt(n, r); + i.push(oi.bufferBEFromBigInt(l, r / 8)); } else throw new Error("Unsupported or invalid type: " + o); } return Buffer.concat(i); } -function wY(t, e) { - return si.keccak(VE(t, e)); +function QY(t, e) { + return oi.keccak(xS(t, e)); } -var xY = { - rawEncode: yY, - solidityPack: VE, - soliditySHA3: wY +var eJ = { + rawEncode: ZY, + solidityPack: xS, + soliditySHA3: QY }; -const ys = WE, Vf = xY, GE = { +const _s = bS, el = eJ, _S = { type: "object", properties: { types: { @@ -26920,7 +27432,7 @@ const ys = WE, Vf = xY, GE = { message: { type: "object" } }, required: ["types", "primaryType", "domain", "message"] -}, Pm = { +}, jm = { /** * Encodes an object by encoding and concatenating each of its members * @@ -26934,16 +27446,16 @@ const ys = WE, Vf = xY, GE = { if (n) { const o = (a, u, l) => { if (r[u] !== void 0) - return ["bytes32", l == null ? "0x0000000000000000000000000000000000000000000000000000000000000000" : ys.keccak(this.encodeData(u, l, r, n))]; + return ["bytes32", l == null ? "0x0000000000000000000000000000000000000000000000000000000000000000" : _s.keccak(this.encodeData(u, l, r, n))]; if (l === void 0) throw new Error(`missing value for field ${a} of type ${u}`); if (u === "bytes") - return ["bytes32", ys.keccak(l)]; + return ["bytes32", _s.keccak(l)]; if (u === "string") - return typeof l == "string" && (l = Buffer.from(l, "utf8")), ["bytes32", ys.keccak(l)]; + return typeof l == "string" && (l = Buffer.from(l, "utf8")), ["bytes32", _s.keccak(l)]; if (u.lastIndexOf("]") === u.length - 1) { const d = u.slice(0, u.lastIndexOf("[")), p = l.map((w) => o(a, d, w)); - return ["bytes32", ys.keccak(Vf.rawEncode( + return ["bytes32", _s.keccak(el.rawEncode( p.map(([w]) => w), p.map(([, w]) => w) ))]; @@ -26959,18 +27471,18 @@ const ys = WE, Vf = xY, GE = { let a = e[o.name]; if (a !== void 0) if (o.type === "bytes") - i.push("bytes32"), a = ys.keccak(a), s.push(a); + i.push("bytes32"), a = _s.keccak(a), s.push(a); else if (o.type === "string") - i.push("bytes32"), typeof a == "string" && (a = Buffer.from(a, "utf8")), a = ys.keccak(a), s.push(a); + i.push("bytes32"), typeof a == "string" && (a = Buffer.from(a, "utf8")), a = _s.keccak(a), s.push(a); else if (r[o.type] !== void 0) - i.push("bytes32"), a = ys.keccak(this.encodeData(o.type, a, r, n)), s.push(a); + i.push("bytes32"), a = _s.keccak(this.encodeData(o.type, a, r, n)), s.push(a); else { if (o.type.lastIndexOf("]") === o.type.length - 1) throw new Error("Arrays currently unimplemented in encodeData"); i.push(o.type), s.push(a); } } - return Vf.rawEncode(i, s); + return el.rawEncode(i, s); }, /** * Encodes the type of an object by encoding a comma delimited list of its members @@ -27015,7 +27527,7 @@ const ys = WE, Vf = xY, GE = { * @returns {Buffer} - Hash of an object */ hashStruct(t, e, r, n = !0) { - return ys.keccak(this.encodeData(t, e, r, n)); + return _s.keccak(this.encodeData(t, e, r, n)); }, /** * Hashes the type of an object @@ -27025,7 +27537,7 @@ const ys = WE, Vf = xY, GE = { * @returns {string} - Hash of an object */ hashType(t, e) { - return ys.keccak(this.encodeType(t, e)); + return _s.keccak(this.encodeType(t, e)); }, /** * Removes properties from a message object that are not defined per EIP-712 @@ -27035,7 +27547,7 @@ const ys = WE, Vf = xY, GE = { */ sanitizeData(t) { const e = {}; - for (const r in GE.properties) + for (const r in _S.properties) t[r] && (e[r] = t[r]); return e.types && (e.types = Object.assign({ EIP712Domain: [] }, e.types)), e; }, @@ -27047,46 +27559,46 @@ const ys = WE, Vf = xY, GE = { */ hash(t, e = !0) { const r = this.sanitizeData(t), n = [Buffer.from("1901", "hex")]; - return n.push(this.hashStruct("EIP712Domain", r.domain, r.types, e)), r.primaryType !== "EIP712Domain" && n.push(this.hashStruct(r.primaryType, r.message, r.types, e)), ys.keccak(Buffer.concat(n)); + return n.push(this.hashStruct("EIP712Domain", r.domain, r.types, e)), r.primaryType !== "EIP712Domain" && n.push(this.hashStruct(r.primaryType, r.message, r.types, e)), _s.keccak(Buffer.concat(n)); } }; -var _Y = { - TYPED_MESSAGE_SCHEMA: GE, - TypedDataUtils: Pm, +var tJ = { + TYPED_MESSAGE_SCHEMA: _S, + TypedDataUtils: jm, hashForSignTypedDataLegacy: function(t) { - return EY(t.data); + return rJ(t.data); }, hashForSignTypedData_v3: function(t) { - return Pm.hash(t.data, !1); + return jm.hash(t.data, !1); }, hashForSignTypedData_v4: function(t) { - return Pm.hash(t.data); + return jm.hash(t.data); } }; -function EY(t) { +function rJ(t) { const e = new Error("Expect argument to be non-empty array"); if (typeof t != "object" || !t.length) throw e; const r = t.map(function(s) { - return s.type === "bytes" ? ys.toBuffer(s.value) : s.value; + return s.type === "bytes" ? _s.toBuffer(s.value) : s.value; }), n = t.map(function(s) { return s.type; }), i = t.map(function(s) { if (!s.name) throw e; return s.type + " " + s.name; }); - return Vf.soliditySHA3( + return el.soliditySHA3( ["bytes32", "bytes32"], [ - Vf.soliditySHA3(new Array(t.length).fill("string"), i), - Vf.soliditySHA3(n, r) + el.soliditySHA3(new Array(t.length).fill("string"), i), + el.soliditySHA3(n, r) ] ); } -const dd = /* @__PURE__ */ ts(_Y), SY = "walletUsername", B1 = "Addresses", AY = "AppVersion"; +const Sd = /* @__PURE__ */ ns(tJ), nJ = "walletUsername", ev = "Addresses", iJ = "AppVersion"; function jn(t) { return t.errorMessage !== void 0; } -class PY { +class sJ { // @param secret hex representation of 32-byte secret constructor(e) { this.secret = e; @@ -27102,11 +27614,11 @@ class PY { const r = this.secret; if (r.length !== 64) throw Error("secret must be 256 bits"); - const n = crypto.getRandomValues(new Uint8Array(12)), i = await crypto.subtle.importKey("raw", Dd(r), { name: "aes-gcm" }, !1, ["encrypt", "decrypt"]), s = new TextEncoder(), o = await window.crypto.subtle.encrypt({ + const n = crypto.getRandomValues(new Uint8Array(12)), i = await crypto.subtle.importKey("raw", Wd(r), { name: "aes-gcm" }, !1, ["encrypt", "decrypt"]), s = new TextEncoder(), o = await window.crypto.subtle.encrypt({ name: "AES-GCM", iv: n }, i, s.encode(e)), a = 16, u = o.slice(o.byteLength - a), l = o.slice(0, o.byteLength - a), d = new Uint8Array(u), p = new Uint8Array(l), w = new Uint8Array([...n, ...d, ...p]); - return vb(w); + return Rb(w); } /** * @@ -27119,13 +27631,13 @@ class PY { throw Error("secret must be 256 bits"); return new Promise((n, i) => { (async function() { - const s = await crypto.subtle.importKey("raw", Dd(r), { name: "aes-gcm" }, !1, ["encrypt", "decrypt"]), o = Dd(e), a = o.slice(0, 12), u = o.slice(12, 28), l = o.slice(28), d = new Uint8Array([...l, ...u]), p = { + const s = await crypto.subtle.importKey("raw", Wd(r), { name: "aes-gcm" }, !1, ["encrypt", "decrypt"]), o = Wd(e), a = o.slice(0, 12), u = o.slice(12, 28), l = o.slice(28), d = new Uint8Array([...l, ...u]), p = { name: "AES-GCM", iv: new Uint8Array(a) }; try { - const w = await window.crypto.subtle.decrypt(p, s, d), A = new TextDecoder(); - n(A.decode(w)); + const w = await window.crypto.subtle.decrypt(p, s, d), _ = new TextDecoder(); + n(_.decode(w)); } catch (w) { i(w); } @@ -27133,7 +27645,7 @@ class PY { }); } } -class MY { +class oJ { constructor(e, r, n) { this.linkAPIUrl = e, this.sessionId = r; const i = `${r}:${n}`; @@ -27171,11 +27683,11 @@ class MY { throw new Error(`Check unseen events failed: ${r.status}`); } } -var Po; +var To; (function(t) { t[t.DISCONNECTED = 0] = "DISCONNECTED", t[t.CONNECTING = 1] = "CONNECTING", t[t.CONNECTED = 2] = "CONNECTED"; -})(Po || (Po = {})); -class IY { +})(To || (To = {})); +class aJ { setConnectionStateListener(e) { this.connectionStateListener = e; } @@ -27206,12 +27718,12 @@ class IY { r(s); return; } - (n = this.connectionStateListener) === null || n === void 0 || n.call(this, Po.CONNECTING), i.onclose = (s) => { + (n = this.connectionStateListener) === null || n === void 0 || n.call(this, To.CONNECTING), i.onclose = (s) => { var o; - this.clearWebSocket(), r(new Error(`websocket error ${s.code}: ${s.reason}`)), (o = this.connectionStateListener) === null || o === void 0 || o.call(this, Po.DISCONNECTED); + this.clearWebSocket(), r(new Error(`websocket error ${s.code}: ${s.reason}`)), (o = this.connectionStateListener) === null || o === void 0 || o.call(this, To.DISCONNECTED); }, i.onopen = (s) => { var o; - e(), (o = this.connectionStateListener) === null || o === void 0 || o.call(this, Po.CONNECTED), this.pendingData.length > 0 && ([...this.pendingData].forEach((u) => this.sendData(u)), this.pendingData = []); + e(), (o = this.connectionStateListener) === null || o === void 0 || o.call(this, To.CONNECTED), this.pendingData.length > 0 && ([...this.pendingData].forEach((u) => this.sendData(u)), this.pendingData = []); }, i.onmessage = (s) => { var o, a; if (s.data === "h") @@ -27234,7 +27746,7 @@ class IY { var e; const { webSocket: r } = this; if (r) { - this.clearWebSocket(), (e = this.connectionStateListener) === null || e === void 0 || e.call(this, Po.DISCONNECTED), this.connectionStateListener = void 0, this.incomingDataListener = void 0; + this.clearWebSocket(), (e = this.connectionStateListener) === null || e === void 0 || e.call(this, To.DISCONNECTED), this.connectionStateListener = void 0, this.incomingDataListener = void 0; try { r.close(); } catch { @@ -27258,8 +27770,8 @@ class IY { e && (this.webSocket = null, e.onclose = null, e.onerror = null, e.onmessage = null, e.onopen = null); } } -const u6 = 1e4, CY = 6e4; -class TY { +const A_ = 1e4, cJ = 6e4; +class uJ { /** * Constructor * @param session Session @@ -27268,7 +27780,7 @@ class TY { * @param [WebSocketClass] Custom WebSocket implementation */ constructor({ session: e, linkAPIUrl: r, listener: n }) { - this.destroyed = !1, this.lastHeartbeatResponse = 0, this.nextReqId = _o(1), this._connected = !1, this._linked = !1, this.shouldFetchUnseenEventsOnConnect = !1, this.requestResolutions = /* @__PURE__ */ new Map(), this.handleSessionMetadataUpdated = (s) => { + this.destroyed = !1, this.lastHeartbeatResponse = 0, this.nextReqId = Po(1), this._connected = !1, this._linked = !1, this.shouldFetchUnseenEventsOnConnect = !1, this.requestResolutions = /* @__PURE__ */ new Map(), this.handleSessionMetadataUpdated = (s) => { if (!s) return; (/* @__PURE__ */ new Map([ @@ -27297,19 +27809,19 @@ class TY { const u = await this.cipher.decrypt(o); (a = this.listener) === null || a === void 0 || a.metadataUpdated(s, u); }, this.handleWalletUsernameUpdated = async (s) => { - this.handleMetadataUpdated(SY, s); + this.handleMetadataUpdated(nJ, s); }, this.handleAppVersionUpdated = async (s) => { - this.handleMetadataUpdated(AY, s); + this.handleMetadataUpdated(iJ, s); }, this.handleChainUpdated = async (s, o) => { var a; const u = await this.cipher.decrypt(s), l = await this.cipher.decrypt(o); (a = this.listener) === null || a === void 0 || a.chainUpdated(u, l); - }, this.session = e, this.cipher = new PY(e.secret), this.listener = n; - const i = new IY(`${r}/rpc`, WebSocket); + }, this.session = e, this.cipher = new sJ(e.secret), this.listener = n; + const i = new aJ(`${r}/rpc`, WebSocket); i.setConnectionStateListener(async (s) => { let o = !1; switch (s) { - case Po.DISCONNECTED: + case To.DISCONNECTED: if (!this.destroyed) { const a = async () => { await new Promise((u) => setTimeout(u, 5e3)), this.destroyed || i.connect().catch(() => { @@ -27319,12 +27831,12 @@ class TY { a(); } break; - case Po.CONNECTED: + case To.CONNECTED: o = await this.handleConnected(), this.updateLastHeartbeat(), setInterval(() => { this.heartbeat(); - }, u6), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); + }, A_), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); break; - case Po.CONNECTING: + case To.CONNECTING: break; } this.connected !== o && (this.connected = o); @@ -27351,7 +27863,7 @@ class TY { } } s.id !== void 0 && ((o = this.requestResolutions.get(s.id)) === null || o === void 0 || o(s)); - }), this.ws = i, this.http = new MY(r, e.id, e.key); + }), this.ws = i, this.http = new oJ(r, e.id, e.key); } /** * Make a connection to the server @@ -27368,7 +27880,7 @@ class TY { async destroy() { this.destroyed || (await this.makeRequest({ type: "SetSessionConfig", - id: _o(this.nextReqId++), + id: Po(this.nextReqId++), sessionId: this.session.id, metadata: { __destroyed: "1" } }, { timeout: 1e3 }), this.destroyed = !0, this.ws.disconnect(), this.listener = void 0); @@ -27428,7 +27940,7 @@ class TY { async publishEvent(e, r, n = !1) { const i = await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({}, r), { origin: location.origin, location: location.href, relaySource: "coinbaseWalletExtension" in window && window.coinbaseWalletExtension ? "injected_sdk" : "sdk" }))), s = { type: "PublishEvent", - id: _o(this.nextReqId++), + id: Po(this.nextReqId++), sessionId: this.session.id, event: e, data: i, @@ -27448,7 +27960,7 @@ class TY { this.lastHeartbeatResponse = Date.now(); } heartbeat() { - if (Date.now() - this.lastHeartbeatResponse > u6 * 2) { + if (Date.now() - this.lastHeartbeatResponse > A_ * 2) { this.ws.disconnect(); return; } @@ -27457,7 +27969,7 @@ class TY { } catch { } } - async makeRequest(e, r = { timeout: CY }) { + async makeRequest(e, r = { timeout: cJ }) { const n = e.id; this.sendData(e); let i; @@ -27477,42 +27989,42 @@ class TY { async handleConnected() { return (await this.makeRequest({ type: "HostSession", - id: _o(this.nextReqId++), + id: Po(this.nextReqId++), sessionId: this.session.id, sessionKey: this.session.key })).type === "Fail" ? !1 : (this.sendData({ type: "IsLinked", - id: _o(this.nextReqId++), + id: Po(this.nextReqId++), sessionId: this.session.id }), this.sendData({ type: "GetSessionConfig", - id: _o(this.nextReqId++), + id: Po(this.nextReqId++), sessionId: this.session.id }), !0); } } -class RY { +class fJ { constructor() { this._nextRequestId = 0, this.callbacks = /* @__PURE__ */ new Map(); } makeRequestId() { this._nextRequestId = (this._nextRequestId + 1) % 2147483647; - const e = this._nextRequestId, r = OE(e.toString(16)); + const e = this._nextRequestId, r = aS(e.toString(16)); return this.callbacks.get(r) && this.callbacks.delete(r), e; } } -const f6 = "session:id", l6 = "session:secret", h6 = "session:linked"; -class gu { +const P_ = "session:id", M_ = "session:secret", I_ = "session:linked"; +class Au { constructor(e, r, n, i = !1) { - this.storage = e, this.id = r, this.secret = n, this.key = _D(n4(`${r}, ${n} WalletLink`)), this._linked = !!i; + this.storage = e, this.id = r, this.secret = n, this.key = XD(P4(`${r}, ${n} WalletLink`)), this._linked = !!i; } static create(e) { - const r = Qa(16), n = Qa(32); - return new gu(e, r, n).save(); + const r = sc(16), n = sc(32); + return new Au(e, r, n).save(); } static load(e) { - const r = e.getItem(f6), n = e.getItem(h6), i = e.getItem(l6); - return r && i ? new gu(e, r, i, n === "1") : null; + const r = e.getItem(P_), n = e.getItem(I_), i = e.getItem(M_); + return r && i ? new Au(e, r, i, n === "1") : null; } get linked() { return this._linked; @@ -27521,124 +28033,124 @@ class gu { this._linked = e, this.persistLinked(); } save() { - return this.storage.setItem(f6, this.id), this.storage.setItem(l6, this.secret), this.persistLinked(), this; + return this.storage.setItem(P_, this.id), this.storage.setItem(M_, this.secret), this.persistLinked(), this; } persistLinked() { - this.storage.setItem(h6, this._linked ? "1" : "0"); + this.storage.setItem(I_, this._linked ? "1" : "0"); } } -function DY() { +function lJ() { try { return window.frameElement !== null; } catch { return !1; } } -function OY() { +function hJ() { try { - return DY() && window.top ? window.top.location : window.location; + return lJ() && window.top ? window.top.location : window.location; } catch { return window.location; } } -function NY() { +function dJ() { var t; return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t = window == null ? void 0 : window.navigator) === null || t === void 0 ? void 0 : t.userAgent); } -function YE() { +function ES() { var t, e; return (e = (t = window == null ? void 0 : window.matchMedia) === null || t === void 0 ? void 0 : t.call(window, "(prefers-color-scheme: dark)").matches) !== null && e !== void 0 ? e : !1; } -const LY = '@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}'; -function JE() { +const pJ = '@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}'; +function SS() { const t = document.createElement("style"); - t.type = "text/css", t.appendChild(document.createTextNode(LY)), document.documentElement.appendChild(t); + t.type = "text/css", t.appendChild(document.createTextNode(pJ)), document.documentElement.appendChild(t); } -function XE(t) { +function AS(t) { var e, r, n = ""; if (typeof t == "string" || typeof t == "number") n += t; - else if (typeof t == "object") if (Array.isArray(t)) for (e = 0; e < t.length; e++) t[e] && (r = XE(t[e])) && (n && (n += " "), n += r); + else if (typeof t == "object") if (Array.isArray(t)) for (e = 0; e < t.length; e++) t[e] && (r = AS(t[e])) && (n && (n += " "), n += r); else for (e in t) t[e] && (n && (n += " "), n += e); return n; } -function Gf() { - for (var t, e, r = 0, n = ""; r < arguments.length; ) (t = arguments[r++]) && (e = XE(t)) && (n && (n += " "), n += e); +function tl() { + for (var t, e, r = 0, n = ""; r < arguments.length; ) (t = arguments[r++]) && (e = AS(t)) && (n && (n += " "), n += e); return n; } -var up, Jr, ZE, tc, d6, QE, F1, eS, wb, j1, U1, Pl = {}, tS = [], kY = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, xb = Array.isArray; -function ga(t, e) { +var Ep, Jr, PS, ac, C_, MS, tv, IS, Nb, rv, nv, $l = {}, CS = [], gJ = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Lb = Array.isArray; +function va(t, e) { for (var r in e) t[r] = e[r]; return t; } -function _b(t) { +function kb(t) { t && t.parentNode && t.parentNode.removeChild(t); } function Nr(t, e, r) { var n, i, s, o = {}; for (s in e) s == "key" ? n = e[s] : s == "ref" ? i = e[s] : o[s] = e[s]; - if (arguments.length > 2 && (o.children = arguments.length > 3 ? up.call(arguments, 2) : r), typeof t == "function" && t.defaultProps != null) for (s in t.defaultProps) o[s] === void 0 && (o[s] = t.defaultProps[s]); - return Od(t, o, n, i, null); + if (arguments.length > 2 && (o.children = arguments.length > 3 ? Ep.call(arguments, 2) : r), typeof t == "function" && t.defaultProps != null) for (s in t.defaultProps) o[s] === void 0 && (o[s] = t.defaultProps[s]); + return Hd(t, o, n, i, null); } -function Od(t, e, r, n, i) { - var s = { type: t, props: e, key: r, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++ZE, __i: -1, __u: 0 }; +function Hd(t, e, r, n, i) { + var s = { type: t, props: e, key: r, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++PS, __i: -1, __u: 0 }; return i == null && Jr.vnode != null && Jr.vnode(s), s; } -function ih(t) { +function dh(t) { return t.children; } -function Nd(t, e) { +function Kd(t, e) { this.props = t, this.context = e; } -function Pu(t, e) { - if (e == null) return t.__ ? Pu(t.__, t.__i + 1) : null; +function Lu(t, e) { + if (e == null) return t.__ ? Lu(t.__, t.__i + 1) : null; for (var r; e < t.__k.length; e++) if ((r = t.__k[e]) != null && r.__e != null) return r.__e; - return typeof t.type == "function" ? Pu(t) : null; + return typeof t.type == "function" ? Lu(t) : null; } -function rS(t) { +function TS(t) { var e, r; if ((t = t.__) != null && t.__c != null) { for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) if ((r = t.__k[e]) != null && r.__e != null) { t.__e = t.__c.base = r.__e; break; } - return rS(t); + return TS(t); } } -function p6(t) { - (!t.__d && (t.__d = !0) && tc.push(t) && !d0.__r++ || d6 !== Jr.debounceRendering) && ((d6 = Jr.debounceRendering) || QE)(d0); +function T_(t) { + (!t.__d && (t.__d = !0) && ac.push(t) && !A0.__r++ || C_ !== Jr.debounceRendering) && ((C_ = Jr.debounceRendering) || MS)(A0); } -function d0() { +function A0() { var t, e, r, n, i, s, o, a; - for (tc.sort(F1); t = tc.shift(); ) t.__d && (e = tc.length, n = void 0, s = (i = (r = t).__v).__e, o = [], a = [], r.__P && ((n = ga({}, i)).__v = i.__v + 1, Jr.vnode && Jr.vnode(n), Eb(r.__P, n, i, r.__n, r.__P.namespaceURI, 32 & i.__u ? [s] : null, o, s ?? Pu(i), !!(32 & i.__u), a), n.__v = i.__v, n.__.__k[n.__i] = n, sS(o, n, a), n.__e != s && rS(n)), tc.length > e && tc.sort(F1)); - d0.__r = 0; + for (ac.sort(tv); t = ac.shift(); ) t.__d && (e = ac.length, n = void 0, s = (i = (r = t).__v).__e, o = [], a = [], r.__P && ((n = va({}, i)).__v = i.__v + 1, Jr.vnode && Jr.vnode(n), $b(r.__P, n, i, r.__n, r.__P.namespaceURI, 32 & i.__u ? [s] : null, o, s ?? Lu(i), !!(32 & i.__u), a), n.__v = i.__v, n.__.__k[n.__i] = n, OS(o, n, a), n.__e != s && TS(n)), ac.length > e && ac.sort(tv)); + A0.__r = 0; } -function nS(t, e, r, n, i, s, o, a, u, l, d) { - var p, w, A, M, N, L, B = n && n.__k || tS, $ = e.length; - for (u = $Y(r, e, B, u), p = 0; p < $; p++) (A = r.__k[p]) != null && (w = A.__i === -1 ? Pl : B[A.__i] || Pl, A.__i = p, L = Eb(t, A, w, i, s, o, a, u, l, d), M = A.__e, A.ref && w.ref != A.ref && (w.ref && Sb(w.ref, null, A), d.push(A.ref, A.__c || M, A)), N == null && M != null && (N = M), 4 & A.__u || w.__k === A.__k ? u = iS(A, u, t) : typeof A.type == "function" && L !== void 0 ? u = L : M && (u = M.nextSibling), A.__u &= -7); - return r.__e = N, u; +function RS(t, e, r, n, i, s, o, a, u, l, d) { + var p, w, _, P, O, L, B = n && n.__k || CS, k = e.length; + for (u = mJ(r, e, B, u), p = 0; p < k; p++) (_ = r.__k[p]) != null && (w = _.__i === -1 ? $l : B[_.__i] || $l, _.__i = p, L = $b(t, _, w, i, s, o, a, u, l, d), P = _.__e, _.ref && w.ref != _.ref && (w.ref && Bb(w.ref, null, _), d.push(_.ref, _.__c || P, _)), O == null && P != null && (O = P), 4 & _.__u || w.__k === _.__k ? u = DS(_, u, t) : typeof _.type == "function" && L !== void 0 ? u = L : P && (u = P.nextSibling), _.__u &= -7); + return r.__e = O, u; } -function $Y(t, e, r, n) { +function mJ(t, e, r, n) { var i, s, o, a, u, l = e.length, d = r.length, p = d, w = 0; - for (t.__k = [], i = 0; i < l; i++) (s = e[i]) != null && typeof s != "boolean" && typeof s != "function" ? (a = i + w, (s = t.__k[i] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Od(null, s, null, null, null) : xb(s) ? Od(ih, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? Od(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, o = null, (u = s.__i = BY(s, r, a, p)) !== -1 && (p--, (o = r[u]) && (o.__u |= 2)), o == null || o.__v === null ? (u == -1 && w--, typeof s.type != "function" && (s.__u |= 4)) : u !== a && (u == a - 1 ? w-- : u == a + 1 ? w++ : (u > a ? w-- : w++, s.__u |= 4))) : s = t.__k[i] = null; - if (p) for (i = 0; i < d; i++) (o = r[i]) != null && !(2 & o.__u) && (o.__e == n && (n = Pu(o)), oS(o, o)); + for (t.__k = [], i = 0; i < l; i++) (s = e[i]) != null && typeof s != "boolean" && typeof s != "function" ? (a = i + w, (s = t.__k[i] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Hd(null, s, null, null, null) : Lb(s) ? Hd(dh, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? Hd(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, o = null, (u = s.__i = vJ(s, r, a, p)) !== -1 && (p--, (o = r[u]) && (o.__u |= 2)), o == null || o.__v === null ? (u == -1 && w--, typeof s.type != "function" && (s.__u |= 4)) : u !== a && (u == a - 1 ? w-- : u == a + 1 ? w++ : (u > a ? w-- : w++, s.__u |= 4))) : s = t.__k[i] = null; + if (p) for (i = 0; i < d; i++) (o = r[i]) != null && !(2 & o.__u) && (o.__e == n && (n = Lu(o)), NS(o, o)); return n; } -function iS(t, e, r) { +function DS(t, e, r) { var n, i; if (typeof t.type == "function") { - for (n = t.__k, i = 0; n && i < n.length; i++) n[i] && (n[i].__ = t, e = iS(n[i], e, r)); + for (n = t.__k, i = 0; n && i < n.length; i++) n[i] && (n[i].__ = t, e = DS(n[i], e, r)); return e; } - t.__e != e && (e && t.type && !r.contains(e) && (e = Pu(t)), r.insertBefore(t.__e, e || null), e = t.__e); + t.__e != e && (e && t.type && !r.contains(e) && (e = Lu(t)), r.insertBefore(t.__e, e || null), e = t.__e); do e = e && e.nextSibling; while (e != null && e.nodeType === 8); return e; } -function BY(t, e, r, n) { +function vJ(t, e, r, n) { var i = t.key, s = t.type, o = r - 1, a = r + 1, u = e[r]; if (u === null || u && i == u.key && s === u.type && !(2 & u.__u)) return r; - if ((typeof s != "function" || s === ih || i) && n > (u != null && !(2 & u.__u) ? 1 : 0)) for (; o >= 0 || a < e.length; ) { + if ((typeof s != "function" || s === dh || i) && n > (u != null && !(2 & u.__u) ? 1 : 0)) for (; o >= 0 || a < e.length; ) { if (o >= 0) { if ((u = e[o]) && !(2 & u.__u) && i == u.key && s === u.type) return o; o--; @@ -27650,17 +28162,17 @@ function BY(t, e, r, n) { } return -1; } -function g6(t, e, r) { - e[0] === "-" ? t.setProperty(e, r ?? "") : t[e] = r == null ? "" : typeof r != "number" || kY.test(e) ? r : r + "px"; +function R_(t, e, r) { + e[0] === "-" ? t.setProperty(e, r ?? "") : t[e] = r == null ? "" : typeof r != "number" || gJ.test(e) ? r : r + "px"; } -function pd(t, e, r, n, i) { +function Ad(t, e, r, n, i) { var s; e: if (e === "style") if (typeof r == "string") t.style.cssText = r; else { - if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || g6(t.style, e, ""); - if (r) for (e in r) n && r[e] === n[e] || g6(t.style, e, r[e]); + if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || R_(t.style, e, ""); + if (r) for (e in r) n && r[e] === n[e] || R_(t.style, e, r[e]); } - else if (e[0] === "o" && e[1] === "n") s = e !== (e = e.replace(eS, "$1")), e = e.toLowerCase() in t || e === "onFocusOut" || e === "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = wb, t.addEventListener(e, s ? U1 : j1, s)) : t.removeEventListener(e, s ? U1 : j1, s); + else if (e[0] === "o" && e[1] === "n") s = e !== (e = e.replace(IS, "$1")), e = e.toLowerCase() in t || e === "onFocusOut" || e === "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = Nb, t.addEventListener(e, s ? nv : rv, s)) : t.removeEventListener(e, s ? nv : rv, s); else { if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try { @@ -27671,54 +28183,54 @@ function pd(t, e, r, n, i) { typeof r == "function" || (r == null || r === !1 && e[4] !== "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && r == 1 ? "" : r)); } } -function m6(t) { +function D_(t) { return function(e) { if (this.l) { var r = this.l[e.type + t]; - if (e.t == null) e.t = wb++; + if (e.t == null) e.t = Nb++; else if (e.t < r.u) return; return r(Jr.event ? Jr.event(e) : e); } }; } -function Eb(t, e, r, n, i, s, o, a, u, l) { - var d, p, w, A, M, N, L, B, $, H, U, V, te, R, K, ge, Ee, Y = e.type; +function $b(t, e, r, n, i, s, o, a, u, l) { + var d, p, w, _, P, O, L, B, k, q, U, V, Q, R, K, ge, Ee, Y = e.type; if (e.constructor !== void 0) return null; 128 & r.__u && (u = !!(32 & r.__u), s = [a = e.__e = r.__e]), (d = Jr.__b) && d(e); e: if (typeof Y == "function") try { - if (B = e.props, $ = "prototype" in Y && Y.prototype.render, H = (d = Y.contextType) && n[d.__c], U = d ? H ? H.props.value : d.__ : n, r.__c ? L = (p = e.__c = r.__c).__ = p.__E : ($ ? e.__c = p = new Y(B, U) : (e.__c = p = new Nd(B, U), p.constructor = Y, p.render = jY), H && H.sub(p), p.props = B, p.state || (p.state = {}), p.context = U, p.__n = n, w = p.__d = !0, p.__h = [], p._sb = []), $ && p.__s == null && (p.__s = p.state), $ && Y.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = ga({}, p.__s)), ga(p.__s, Y.getDerivedStateFromProps(B, p.__s))), A = p.props, M = p.state, p.__v = e, w) $ && Y.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), $ && p.componentDidMount != null && p.__h.push(p.componentDidMount); + if (B = e.props, k = "prototype" in Y && Y.prototype.render, q = (d = Y.contextType) && n[d.__c], U = d ? q ? q.props.value : d.__ : n, r.__c ? L = (p = e.__c = r.__c).__ = p.__E : (k ? e.__c = p = new Y(B, U) : (e.__c = p = new Kd(B, U), p.constructor = Y, p.render = yJ), q && q.sub(p), p.props = B, p.state || (p.state = {}), p.context = U, p.__n = n, w = p.__d = !0, p.__h = [], p._sb = []), k && p.__s == null && (p.__s = p.state), k && Y.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = va({}, p.__s)), va(p.__s, Y.getDerivedStateFromProps(B, p.__s))), _ = p.props, P = p.state, p.__v = e, w) k && Y.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), k && p.componentDidMount != null && p.__h.push(p.componentDidMount); else { - if ($ && Y.getDerivedStateFromProps == null && B !== A && p.componentWillReceiveProps != null && p.componentWillReceiveProps(B, U), !p.__e && (p.shouldComponentUpdate != null && p.shouldComponentUpdate(B, p.__s, U) === !1 || e.__v === r.__v)) { - for (e.__v !== r.__v && (p.props = B, p.state = p.__s, p.__d = !1), e.__e = r.__e, e.__k = r.__k, e.__k.some(function(S) { - S && (S.__ = e); + if (k && Y.getDerivedStateFromProps == null && B !== _ && p.componentWillReceiveProps != null && p.componentWillReceiveProps(B, U), !p.__e && (p.shouldComponentUpdate != null && p.shouldComponentUpdate(B, p.__s, U) === !1 || e.__v === r.__v)) { + for (e.__v !== r.__v && (p.props = B, p.state = p.__s, p.__d = !1), e.__e = r.__e, e.__k = r.__k, e.__k.some(function(A) { + A && (A.__ = e); }), V = 0; V < p._sb.length; V++) p.__h.push(p._sb[V]); p._sb = [], p.__h.length && o.push(p); break e; } - p.componentWillUpdate != null && p.componentWillUpdate(B, p.__s, U), $ && p.componentDidUpdate != null && p.__h.push(function() { - p.componentDidUpdate(A, M, N); + p.componentWillUpdate != null && p.componentWillUpdate(B, p.__s, U), k && p.componentDidUpdate != null && p.__h.push(function() { + p.componentDidUpdate(_, P, O); }); } - if (p.context = U, p.props = B, p.__P = t, p.__e = !1, te = Jr.__r, R = 0, $) { - for (p.state = p.__s, p.__d = !1, te && te(e), d = p.render(p.props, p.state, p.context), K = 0; K < p._sb.length; K++) p.__h.push(p._sb[K]); + if (p.context = U, p.props = B, p.__P = t, p.__e = !1, Q = Jr.__r, R = 0, k) { + for (p.state = p.__s, p.__d = !1, Q && Q(e), d = p.render(p.props, p.state, p.context), K = 0; K < p._sb.length; K++) p.__h.push(p._sb[K]); p._sb = []; } else do - p.__d = !1, te && te(e), d = p.render(p.props, p.state, p.context), p.state = p.__s; + p.__d = !1, Q && Q(e), d = p.render(p.props, p.state, p.context), p.state = p.__s; while (p.__d && ++R < 25); - p.state = p.__s, p.getChildContext != null && (n = ga(ga({}, n), p.getChildContext())), $ && !w && p.getSnapshotBeforeUpdate != null && (N = p.getSnapshotBeforeUpdate(A, M)), a = nS(t, xb(ge = d != null && d.type === ih && d.key == null ? d.props.children : d) ? ge : [ge], e, r, n, i, s, o, a, u, l), p.base = e.__e, e.__u &= -161, p.__h.length && o.push(p), L && (p.__E = p.__ = null); - } catch (S) { - if (e.__v = null, u || s != null) if (S.then) { + p.state = p.__s, p.getChildContext != null && (n = va(va({}, n), p.getChildContext())), k && !w && p.getSnapshotBeforeUpdate != null && (O = p.getSnapshotBeforeUpdate(_, P)), a = RS(t, Lb(ge = d != null && d.type === dh && d.key == null ? d.props.children : d) ? ge : [ge], e, r, n, i, s, o, a, u, l), p.base = e.__e, e.__u &= -161, p.__h.length && o.push(p), L && (p.__E = p.__ = null); + } catch (A) { + if (e.__v = null, u || s != null) if (A.then) { for (e.__u |= u ? 160 : 128; a && a.nodeType === 8 && a.nextSibling; ) a = a.nextSibling; s[s.indexOf(a)] = null, e.__e = a; - } else for (Ee = s.length; Ee--; ) _b(s[Ee]); + } else for (Ee = s.length; Ee--; ) kb(s[Ee]); else e.__e = r.__e, e.__k = r.__k; - Jr.__e(S, e, r); + Jr.__e(A, e, r); } - else s == null && e.__v === r.__v ? (e.__k = r.__k, e.__e = r.__e) : a = e.__e = FY(r.__e, e, r, n, i, s, o, u, l); + else s == null && e.__v === r.__v ? (e.__k = r.__k, e.__e = r.__e) : a = e.__e = bJ(r.__e, e, r, n, i, s, o, u, l); return (d = Jr.diffed) && d(e), 128 & e.__u ? void 0 : a; } -function sS(t, e, r) { - for (var n = 0; n < r.length; n++) Sb(r[n], r[++n], r[++n]); +function OS(t, e, r) { + for (var n = 0; n < r.length; n++) Bb(r[n], r[++n], r[++n]); Jr.__c && Jr.__c(e, t), t.some(function(i) { try { t = i.__h, i.__h = [], t.some(function(s) { @@ -27729,36 +28241,36 @@ function sS(t, e, r) { } }); } -function FY(t, e, r, n, i, s, o, a, u) { - var l, d, p, w, A, M, N, L = r.props, B = e.props, $ = e.type; - if ($ === "svg" ? i = "http://www.w3.org/2000/svg" : $ === "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) { - for (l = 0; l < s.length; l++) if ((A = s[l]) && "setAttribute" in A == !!$ && ($ ? A.localName === $ : A.nodeType === 3)) { - t = A, s[l] = null; +function bJ(t, e, r, n, i, s, o, a, u) { + var l, d, p, w, _, P, O, L = r.props, B = e.props, k = e.type; + if (k === "svg" ? i = "http://www.w3.org/2000/svg" : k === "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) { + for (l = 0; l < s.length; l++) if ((_ = s[l]) && "setAttribute" in _ == !!k && (k ? _.localName === k : _.nodeType === 3)) { + t = _, s[l] = null; break; } } if (t == null) { - if ($ === null) return document.createTextNode(B); - t = document.createElementNS(i, $, B.is && B), a && (Jr.__m && Jr.__m(e, s), a = !1), s = null; + if (k === null) return document.createTextNode(B); + t = document.createElementNS(i, k, B.is && B), a && (Jr.__m && Jr.__m(e, s), a = !1), s = null; } - if ($ === null) L === B || a && t.data === B || (t.data = B); + if (k === null) L === B || a && t.data === B || (t.data = B); else { - if (s = s && up.call(t.childNodes), L = r.props || Pl, !a && s != null) for (L = {}, l = 0; l < t.attributes.length; l++) L[(A = t.attributes[l]).name] = A.value; - for (l in L) if (A = L[l], l != "children") { - if (l == "dangerouslySetInnerHTML") p = A; + if (s = s && Ep.call(t.childNodes), L = r.props || $l, !a && s != null) for (L = {}, l = 0; l < t.attributes.length; l++) L[(_ = t.attributes[l]).name] = _.value; + for (l in L) if (_ = L[l], l != "children") { + if (l == "dangerouslySetInnerHTML") p = _; else if (!(l in B)) { if (l == "value" && "defaultValue" in B || l == "checked" && "defaultChecked" in B) continue; - pd(t, l, null, A, i); + Ad(t, l, null, _, i); } } - for (l in B) A = B[l], l == "children" ? w = A : l == "dangerouslySetInnerHTML" ? d = A : l == "value" ? M = A : l == "checked" ? N = A : a && typeof A != "function" || L[l] === A || pd(t, l, A, L[l], i); + for (l in B) _ = B[l], l == "children" ? w = _ : l == "dangerouslySetInnerHTML" ? d = _ : l == "value" ? P = _ : l == "checked" ? O = _ : a && typeof _ != "function" || L[l] === _ || Ad(t, l, _, L[l], i); if (d) a || p && (d.__html === p.__html || d.__html === t.innerHTML) || (t.innerHTML = d.__html), e.__k = []; - else if (p && (t.innerHTML = ""), nS(t, xb(w) ? w : [w], e, r, n, $ === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && Pu(r, 0), a, u), s != null) for (l = s.length; l--; ) _b(s[l]); - a || (l = "value", $ === "progress" && M == null ? t.removeAttribute("value") : M !== void 0 && (M !== t[l] || $ === "progress" && !M || $ === "option" && M !== L[l]) && pd(t, l, M, L[l], i), l = "checked", N !== void 0 && N !== t[l] && pd(t, l, N, L[l], i)); + else if (p && (t.innerHTML = ""), RS(t, Lb(w) ? w : [w], e, r, n, k === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && Lu(r, 0), a, u), s != null) for (l = s.length; l--; ) kb(s[l]); + a || (l = "value", k === "progress" && P == null ? t.removeAttribute("value") : P !== void 0 && (P !== t[l] || k === "progress" && !P || k === "option" && P !== L[l]) && Ad(t, l, P, L[l], i), l = "checked", O !== void 0 && O !== t[l] && Ad(t, l, O, L[l], i)); } return t; } -function Sb(t, e, r) { +function Bb(t, e, r) { try { if (typeof t == "function") { var n = typeof t.__u == "function"; @@ -27768,9 +28280,9 @@ function Sb(t, e, r) { Jr.__e(i, r); } } -function oS(t, e, r) { +function NS(t, e, r) { var n, i; - if (Jr.unmount && Jr.unmount(t), (n = t.ref) && (n.current && n.current !== t.__e || Sb(n, null, e)), (n = t.__c) != null) { + if (Jr.unmount && Jr.unmount(t), (n = t.ref) && (n.current && n.current !== t.__e || Bb(n, null, e)), (n = t.__c) != null) { if (n.componentWillUnmount) try { n.componentWillUnmount(); } catch (s) { @@ -27778,43 +28290,43 @@ function oS(t, e, r) { } n.base = n.__P = null; } - if (n = t.__k) for (i = 0; i < n.length; i++) n[i] && oS(n[i], e, r || typeof t.type != "function"); - r || _b(t.__e), t.__c = t.__ = t.__e = void 0; + if (n = t.__k) for (i = 0; i < n.length; i++) n[i] && NS(n[i], e, r || typeof t.type != "function"); + r || kb(t.__e), t.__c = t.__ = t.__e = void 0; } -function jY(t, e, r) { +function yJ(t, e, r) { return this.constructor(t, r); } -function q1(t, e, r) { +function iv(t, e, r) { var n, i, s, o; - e === document && (e = document.documentElement), Jr.__ && Jr.__(t, e), i = (n = typeof r == "function") ? null : e.__k, s = [], o = [], Eb(e, t = (!n && r || e).__k = Nr(ih, null, [t]), i || Pl, Pl, e.namespaceURI, !n && r ? [r] : i ? null : e.firstChild ? up.call(e.childNodes) : null, s, !n && r ? r : i ? i.__e : e.firstChild, n, o), sS(s, t, o); + e === document && (e = document.documentElement), Jr.__ && Jr.__(t, e), i = (n = typeof r == "function") ? null : e.__k, s = [], o = [], $b(e, t = (!n && r || e).__k = Nr(dh, null, [t]), i || $l, $l, e.namespaceURI, !n && r ? [r] : i ? null : e.firstChild ? Ep.call(e.childNodes) : null, s, !n && r ? r : i ? i.__e : e.firstChild, n, o), OS(s, t, o); } -up = tS.slice, Jr = { __e: function(t, e, r, n) { +Ep = CS.slice, Jr = { __e: function(t, e, r, n) { for (var i, s, o; e = e.__; ) if ((i = e.__c) && !i.__) try { if ((s = i.constructor) && s.getDerivedStateFromError != null && (i.setState(s.getDerivedStateFromError(t)), o = i.__d), i.componentDidCatch != null && (i.componentDidCatch(t, n || {}), o = i.__d), o) return i.__E = i; } catch (a) { t = a; } throw t; -} }, ZE = 0, Nd.prototype.setState = function(t, e) { +} }, PS = 0, Kd.prototype.setState = function(t, e) { var r; - r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = ga({}, this.state), typeof t == "function" && (t = t(ga({}, r), this.props)), t && ga(r, t), t != null && this.__v && (e && this._sb.push(e), p6(this)); -}, Nd.prototype.forceUpdate = function(t) { - this.__v && (this.__e = !0, t && this.__h.push(t), p6(this)); -}, Nd.prototype.render = ih, tc = [], QE = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, F1 = function(t, e) { + r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = va({}, this.state), typeof t == "function" && (t = t(va({}, r), this.props)), t && va(r, t), t != null && this.__v && (e && this._sb.push(e), T_(this)); +}, Kd.prototype.forceUpdate = function(t) { + this.__v && (this.__e = !0, t && this.__h.push(t), T_(this)); +}, Kd.prototype.render = dh, ac = [], MS = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, tv = function(t, e) { return t.__v.__b - e.__v.__b; -}, d0.__r = 0, eS = /(PointerCapture)$|Capture$/i, wb = 0, j1 = m6(!1), U1 = m6(!0); -var p0, pn, Mm, v6, z1 = 0, aS = [], yn = Jr, b6 = yn.__b, y6 = yn.__r, w6 = yn.diffed, x6 = yn.__c, _6 = yn.unmount, E6 = yn.__; -function cS(t, e) { - yn.__h && yn.__h(pn, t, z1 || e), z1 = 0; +}, A0.__r = 0, IS = /(PointerCapture)$|Capture$/i, Nb = 0, rv = D_(!1), nv = D_(!0); +var P0, pn, Um, O_, sv = 0, LS = [], yn = Jr, N_ = yn.__b, L_ = yn.__r, k_ = yn.diffed, $_ = yn.__c, B_ = yn.unmount, F_ = yn.__; +function kS(t, e) { + yn.__h && yn.__h(pn, t, sv || e), sv = 0; var r = pn.__H || (pn.__H = { __: [], __h: [] }); return t >= r.__.length && r.__.push({}), r.__[t]; } -function S6(t) { - return z1 = 1, UY(uS, t); +function j_(t) { + return sv = 1, wJ($S, t); } -function UY(t, e, r) { - var n = cS(p0++, 2); - if (n.t = t, !n.__c && (n.__ = [uS(void 0, e), function(a) { +function wJ(t, e, r) { + var n = kS(P0++, 2); + if (n.t = t, !n.__c && (n.__ = [$S(void 0, e), function(a) { var u = n.__N ? n.__N[0] : n.__[0], l = n.t(u, a); u !== l && (n.__N = [l, n.__[1]], n.__c.setState({})); }], n.__c = pn, !pn.u)) { @@ -27829,8 +28341,8 @@ function UY(t, e, r) { var p = n.__c.props !== a; return d.forEach(function(w) { if (w.__N) { - var A = w.__[0]; - w.__ = w.__N, w.__N = void 0, A !== w.__[0] && (p = !0); + var _ = w.__[0]; + w.__ = w.__N, w.__N = void 0, _ !== w.__[0] && (p = !0); } }), s && s.call(this, a, u, l) || p; }; @@ -27846,83 +28358,83 @@ function UY(t, e, r) { } return n.__N || n.__; } -function qY(t, e) { - var r = cS(p0++, 3); - !yn.__s && HY(r.__H, e) && (r.__ = t, r.i = e, pn.__H.__h.push(r)); +function xJ(t, e) { + var r = kS(P0++, 3); + !yn.__s && SJ(r.__H, e) && (r.__ = t, r.i = e, pn.__H.__h.push(r)); } -function zY() { - for (var t; t = aS.shift(); ) if (t.__P && t.__H) try { - t.__H.__h.forEach(Ld), t.__H.__h.forEach(W1), t.__H.__h = []; +function _J() { + for (var t; t = LS.shift(); ) if (t.__P && t.__H) try { + t.__H.__h.forEach(Vd), t.__H.__h.forEach(ov), t.__H.__h = []; } catch (e) { t.__H.__h = [], yn.__e(e, t.__v); } } yn.__b = function(t) { - pn = null, b6 && b6(t); + pn = null, N_ && N_(t); }, yn.__ = function(t, e) { - t && e.__k && e.__k.__m && (t.__m = e.__k.__m), E6 && E6(t, e); + t && e.__k && e.__k.__m && (t.__m = e.__k.__m), F_ && F_(t, e); }, yn.__r = function(t) { - y6 && y6(t), p0 = 0; + L_ && L_(t), P0 = 0; var e = (pn = t.__c).__H; - e && (Mm === pn ? (e.__h = [], pn.__h = [], e.__.forEach(function(r) { + e && (Um === pn ? (e.__h = [], pn.__h = [], e.__.forEach(function(r) { r.__N && (r.__ = r.__N), r.i = r.__N = void 0; - })) : (e.__h.forEach(Ld), e.__h.forEach(W1), e.__h = [], p0 = 0)), Mm = pn; + })) : (e.__h.forEach(Vd), e.__h.forEach(ov), e.__h = [], P0 = 0)), Um = pn; }, yn.diffed = function(t) { - w6 && w6(t); + k_ && k_(t); var e = t.__c; - e && e.__H && (e.__H.__h.length && (aS.push(e) !== 1 && v6 === yn.requestAnimationFrame || ((v6 = yn.requestAnimationFrame) || WY)(zY)), e.__H.__.forEach(function(r) { + e && e.__H && (e.__H.__h.length && (LS.push(e) !== 1 && O_ === yn.requestAnimationFrame || ((O_ = yn.requestAnimationFrame) || EJ)(_J)), e.__H.__.forEach(function(r) { r.i && (r.__H = r.i), r.i = void 0; - })), Mm = pn = null; + })), Um = pn = null; }, yn.__c = function(t, e) { e.some(function(r) { try { - r.__h.forEach(Ld), r.__h = r.__h.filter(function(n) { - return !n.__ || W1(n); + r.__h.forEach(Vd), r.__h = r.__h.filter(function(n) { + return !n.__ || ov(n); }); } catch (n) { e.some(function(i) { i.__h && (i.__h = []); }), e = [], yn.__e(n, r.__v); } - }), x6 && x6(t, e); + }), $_ && $_(t, e); }, yn.unmount = function(t) { - _6 && _6(t); + B_ && B_(t); var e, r = t.__c; r && r.__H && (r.__H.__.forEach(function(n) { try { - Ld(n); + Vd(n); } catch (i) { e = i; } }), r.__H = void 0, e && yn.__e(e, r.__v)); }; -var A6 = typeof requestAnimationFrame == "function"; -function WY(t) { +var U_ = typeof requestAnimationFrame == "function"; +function EJ(t) { var e, r = function() { - clearTimeout(n), A6 && cancelAnimationFrame(e), setTimeout(t); + clearTimeout(n), U_ && cancelAnimationFrame(e), setTimeout(t); }, n = setTimeout(r, 100); - A6 && (e = requestAnimationFrame(r)); + U_ && (e = requestAnimationFrame(r)); } -function Ld(t) { +function Vd(t) { var e = pn, r = t.__c; typeof r == "function" && (t.__c = void 0, r()), pn = e; } -function W1(t) { +function ov(t) { var e = pn; t.__c = t.__(), pn = e; } -function HY(t, e) { +function SJ(t, e) { return !t || t.length !== e.length || e.some(function(r, n) { return r !== t[n]; }); } -function uS(t, e) { +function $S(t, e) { return typeof e == "function" ? e(t) : e; } -const KY = ".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}", VY = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+", GY = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4="; -class YY { +const AJ = ".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}", PJ = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+", MJ = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4="; +class IJ { constructor() { - this.items = /* @__PURE__ */ new Map(), this.nextItemKey = 0, this.root = null, this.darkMode = YE(); + this.items = /* @__PURE__ */ new Map(), this.nextItemKey = 0, this.root = null, this.darkMode = ES(); } attach(e) { this.root = document.createElement("div"), this.root.className = "-cbwsdk-snackbar-root", e.appendChild(this.root), this.render(); @@ -27937,21 +28449,21 @@ class YY { this.items.clear(), this.render(); } render() { - this.root && q1(Nr( + this.root && iv(Nr( "div", null, - Nr(fS, { darkMode: this.darkMode }, Array.from(this.items.entries()).map(([e, r]) => Nr(JY, Object.assign({}, r, { key: e })))) + Nr(BS, { darkMode: this.darkMode }, Array.from(this.items.entries()).map(([e, r]) => Nr(CJ, Object.assign({}, r, { key: e })))) ), this.root); } } -const fS = (t) => Nr( +const BS = (t) => Nr( "div", - { class: Gf("-cbwsdk-snackbar-container") }, - Nr("style", null, KY), + { class: tl("-cbwsdk-snackbar-container") }, + Nr("style", null, AJ), Nr("div", { class: "-cbwsdk-snackbar" }, t.children) -), JY = ({ autoExpand: t, message: e, menuItems: r }) => { - const [n, i] = S6(!0), [s, o] = S6(t ?? !1); - qY(() => { +), CJ = ({ autoExpand: t, message: e, menuItems: r }) => { + const [n, i] = j_(!0), [s, o] = j_(t ?? !1); + xJ(() => { const u = [ window.setTimeout(() => { i(!1); @@ -27969,11 +28481,11 @@ const fS = (t) => Nr( }; return Nr( "div", - { class: Gf("-cbwsdk-snackbar-instance", n && "-cbwsdk-snackbar-instance-hidden", s && "-cbwsdk-snackbar-instance-expanded") }, + { class: tl("-cbwsdk-snackbar-instance", n && "-cbwsdk-snackbar-instance-hidden", s && "-cbwsdk-snackbar-instance-expanded") }, Nr( "div", { class: "-cbwsdk-snackbar-instance-header", onClick: a }, - Nr("img", { src: VY, class: "-cbwsdk-snackbar-instance-header-cblogo" }), + Nr("img", { src: PJ, class: "-cbwsdk-snackbar-instance-header-cblogo" }), " ", Nr("div", { class: "-cbwsdk-snackbar-instance-header-message" }, e), Nr( @@ -27984,30 +28496,30 @@ const fS = (t) => Nr( { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, Nr("circle", { cx: "12", cy: "12", r: "12", fill: "#F5F7F8" }) ), - Nr("img", { src: GY, class: "-gear-icon", title: "Expand" }) + Nr("img", { src: MJ, class: "-gear-icon", title: "Expand" }) ) ), r && r.length > 0 && Nr("div", { class: "-cbwsdk-snackbar-instance-menu" }, r.map((u, l) => Nr( "div", - { class: Gf("-cbwsdk-snackbar-instance-menu-item", u.isRed && "-cbwsdk-snackbar-instance-menu-item-is-red"), onClick: u.onClick, key: l }, + { class: tl("-cbwsdk-snackbar-instance-menu-item", u.isRed && "-cbwsdk-snackbar-instance-menu-item-is-red"), onClick: u.onClick, key: l }, Nr( "svg", { width: u.svgWidth, height: u.svgHeight, viewBox: "0 0 10 11", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, Nr("path", { "fill-rule": u.defaultFillRule, "clip-rule": u.defaultClipRule, d: u.path, fill: "#AAAAAA" }) ), - Nr("span", { class: Gf("-cbwsdk-snackbar-instance-menu-item-info", u.isRed && "-cbwsdk-snackbar-instance-menu-item-info-is-red") }, u.info) + Nr("span", { class: tl("-cbwsdk-snackbar-instance-menu-item-info", u.isRed && "-cbwsdk-snackbar-instance-menu-item-info-is-red") }, u.info) ))) ); }; -class XY { +class TJ { constructor() { - this.attached = !1, this.snackbar = new YY(); + this.attached = !1, this.snackbar = new IJ(); } attach() { if (this.attached) throw new Error("Coinbase Wallet SDK UI is already attached"); const e = document.documentElement, r = document.createElement("div"); - r.className = "-cbwsdk-css-reset", e.appendChild(r), this.snackbar.attach(r), this.attached = !0, JE(); + r.className = "-cbwsdk-css-reset", e.appendChild(r), this.snackbar.attach(r), this.attached = !0, SS(); } showConnecting(e) { let r; @@ -28053,14 +28565,14 @@ class XY { }, this.snackbar.presentItem(r); } } -const ZY = ".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}"; -class QY { +const RJ = ".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}"; +class DJ { constructor() { - this.root = null, this.darkMode = YE(); + this.root = null, this.darkMode = ES(); } attach() { const e = document.documentElement; - this.root = document.createElement("div"), this.root.className = "-cbwsdk-css-reset", e.appendChild(this.root), JE(); + this.root = document.createElement("div"), this.root.className = "-cbwsdk-css-reset", e.appendChild(this.root), SS(); } present(e) { this.render(e); @@ -28069,33 +28581,33 @@ class QY { this.render(null); } render(e) { - this.root && (q1(null, this.root), e && q1(Nr(eJ, Object.assign({}, e, { onDismiss: () => { + this.root && (iv(null, this.root), e && iv(Nr(OJ, Object.assign({}, e, { onDismiss: () => { this.clear(); }, darkMode: this.darkMode })), this.root)); } } -const eJ = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: i }) => { +const OJ = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: i }) => { const s = r ? "dark" : "light"; return Nr( - fS, + BS, { darkMode: r }, Nr( "div", { class: "-cbwsdk-redirect-dialog" }, - Nr("style", null, ZY), + Nr("style", null, RJ), Nr("div", { class: "-cbwsdk-redirect-dialog-backdrop", onClick: i }), Nr( "div", - { class: Gf("-cbwsdk-redirect-dialog-box", s) }, + { class: tl("-cbwsdk-redirect-dialog-box", s) }, Nr("p", null, t), Nr("button", { onClick: n }, e) ) ) ); -}, tJ = "https://keys.coinbase.com/connect", P6 = "https://www.walletlink.org", rJ = "https://go.cb-w.com/walletlink"; -class M6 { +}, NJ = "https://keys.coinbase.com/connect", q_ = "https://www.walletlink.org", LJ = "https://go.cb-w.com/walletlink"; +class z_ { constructor() { - this.attached = !1, this.redirectDialog = new QY(); + this.attached = !1, this.redirectDialog = new DJ(); } attach() { if (this.attached) @@ -28103,8 +28615,8 @@ class M6 { this.redirectDialog.attach(), this.attached = !0; } redirectToCoinbaseWallet(e) { - const r = new URL(rJ); - r.searchParams.append("redirect_url", OY().href), e && r.searchParams.append("wl_url", e); + const r = new URL(LJ); + r.searchParams.append("redirect_url", hJ().href), e && r.searchParams.append("wl_url", e); const n = document.createElement("a"); n.target = "cbw-opener", n.href = r.href, n.rel = "noreferrer noopener", n.click(); } @@ -28125,11 +28637,11 @@ class M6 { }; } } -class Eo { +class Mo { constructor(e) { - this.chainCallbackParams = { chainId: "", jsonRpcUrl: "" }, this.isMobileWeb = NY(), this.linkedUpdated = (s) => { + this.chainCallbackParams = { chainId: "", jsonRpcUrl: "" }, this.isMobileWeb = dJ(), this.linkedUpdated = (s) => { this.isLinked = s; - const o = this.storage.getItem(B1); + const o = this.storage.getItem(ev); if (s && (this._session.linked = s), this.isUnlinkedErrorState = !1, o) { const a = o.split(" "), u = this.storage.getItem("IsStandaloneSigning") === "true"; a[0] !== "" && !s && this._session.linked && !u && (this.isUnlinkedErrorState = !0); @@ -28142,28 +28654,28 @@ class Eo { jsonRpcUrl: o }, this.chainCallback && this.chainCallback(o, Number.parseInt(s, 10))); }, this.accountUpdated = (s) => { - this.accountsCallback && this.accountsCallback([s]), Eo.accountRequestCallbackIds.size > 0 && (Array.from(Eo.accountRequestCallbackIds.values()).forEach((o) => { + this.accountsCallback && this.accountsCallback([s]), Mo.accountRequestCallbackIds.size > 0 && (Array.from(Mo.accountRequestCallbackIds.values()).forEach((o) => { this.invokeCallback(o, { method: "requestEthereumAccounts", result: [s] }); - }), Eo.accountRequestCallbackIds.clear()); + }), Mo.accountRequestCallbackIds.clear()); }, this.resetAndReload = this.resetAndReload.bind(this), this.linkAPIUrl = e.linkAPIUrl, this.storage = e.storage, this.metadata = e.metadata, this.accountsCallback = e.accountsCallback, this.chainCallback = e.chainCallback; const { session: r, ui: n, connection: i } = this.subscribe(); - this._session = r, this.connection = i, this.relayEventManager = new RY(), this.ui = n, this.ui.attach(); + this._session = r, this.connection = i, this.relayEventManager = new fJ(), this.ui = n, this.ui.attach(); } subscribe() { - const e = gu.load(this.storage) || gu.create(this.storage), { linkAPIUrl: r } = this, n = new TY({ + const e = Au.load(this.storage) || Au.create(this.storage), { linkAPIUrl: r } = this, n = new uJ({ session: e, linkAPIUrl: r, listener: this - }), i = this.isMobileWeb ? new M6() : new XY(); + }), i = this.isMobileWeb ? new z_() : new TJ(); return n.connect(), { session: e, ui: i, connection: n }; } resetAndReload() { this.connection.destroy().then(() => { - const e = gu.load(this.storage); - (e == null ? void 0 : e.id) === this._session.id && eo.clearAll(), document.location.reload(); + const e = Au.load(this.storage); + (e == null ? void 0 : e.id) === this._session.id && no.clearAll(), document.location.reload(); }).catch((e) => { }); } @@ -28173,13 +28685,13 @@ class Eo { params: { fromAddress: e.fromAddress, toAddress: e.toAddress, - weiValue: $s(e.weiValue), - data: Hf(e.data, !0), + weiValue: js(e.weiValue), + data: Zf(e.data, !0), nonce: e.nonce, - gasPriceInWei: e.gasPriceInWei ? $s(e.gasPriceInWei) : null, - maxFeePerGas: e.gasPriceInWei ? $s(e.gasPriceInWei) : null, - maxPriorityFeePerGas: e.gasPriceInWei ? $s(e.gasPriceInWei) : null, - gasLimit: e.gasLimit ? $s(e.gasLimit) : null, + gasPriceInWei: e.gasPriceInWei ? js(e.gasPriceInWei) : null, + maxFeePerGas: e.gasPriceInWei ? js(e.gasPriceInWei) : null, + maxPriorityFeePerGas: e.gasPriceInWei ? js(e.gasPriceInWei) : null, + gasLimit: e.gasLimit ? js(e.gasLimit) : null, chainId: e.chainId, shouldSubmit: !1 } @@ -28191,13 +28703,13 @@ class Eo { params: { fromAddress: e.fromAddress, toAddress: e.toAddress, - weiValue: $s(e.weiValue), - data: Hf(e.data, !0), + weiValue: js(e.weiValue), + data: Zf(e.data, !0), nonce: e.nonce, - gasPriceInWei: e.gasPriceInWei ? $s(e.gasPriceInWei) : null, - maxFeePerGas: e.maxFeePerGas ? $s(e.maxFeePerGas) : null, - maxPriorityFeePerGas: e.maxPriorityFeePerGas ? $s(e.maxPriorityFeePerGas) : null, - gasLimit: e.gasLimit ? $s(e.gasLimit) : null, + gasPriceInWei: e.gasPriceInWei ? js(e.gasPriceInWei) : null, + maxFeePerGas: e.maxFeePerGas ? js(e.maxFeePerGas) : null, + maxPriorityFeePerGas: e.maxPriorityFeePerGas ? js(e.maxPriorityFeePerGas) : null, + gasLimit: e.gasLimit ? js(e.gasLimit) : null, chainId: e.chainId, shouldSubmit: !0 } @@ -28207,7 +28719,7 @@ class Eo { return this.sendRequest({ method: "submitEthereumTransaction", params: { - signedTransaction: Hf(e, !0), + signedTransaction: Zf(e, !0), chainId: r } }); @@ -28217,7 +28729,7 @@ class Eo { } sendRequest(e) { let r = null; - const n = Qa(8), i = (s) => { + const n = sc(8), i = (s) => { this.publishWeb3RequestCanceledEvent(n), this.handleErrorResponse(n, e.method, s), r == null || r(); }; return new Promise((s, o) => { @@ -28245,7 +28757,7 @@ class Eo { } // copied from MobileRelay openCoinbaseWalletDeeplink(e) { - if (this.ui instanceof M6) + if (this.ui instanceof z_) switch (e) { case "requestEthereumAccounts": case "switchEthereumChain": @@ -28271,7 +28783,7 @@ class Eo { } handleWeb3ResponseMessage(e, r) { if (r.method === "requestEthereumAccounts") { - Eo.accountRequestCallbackIds.forEach((n) => this.invokeCallback(n, r)), Eo.accountRequestCallbackIds.clear(); + Mo.accountRequestCallbackIds.forEach((n) => this.invokeCallback(n, r)), Mo.accountRequestCallbackIds.clear(); return; } this.invokeCallback(e, r); @@ -28295,13 +28807,13 @@ class Eo { appName: e, appLogoUrl: r } - }, i = Qa(8); + }, i = sc(8); return new Promise((s, o) => { this.relayEventManager.callbacks.set(i, (a) => { if (jn(a)) return o(new Error(a.errorMessage)); s(a); - }), Eo.accountRequestCallbackIds.add(i), this.publishWeb3RequestEvent(i, n); + }), Mo.accountRequestCallbackIds.add(i), this.publishWeb3RequestEvent(i, n); }); } watchAsset(e, r, n, i, s, o) { @@ -28319,7 +28831,7 @@ class Eo { } }; let u = null; - const l = Qa(8), d = (p) => { + const l = sc(8), d = (p) => { this.publishWeb3RequestCanceledEvent(l), this.handleErrorResponse(l, a.method, p), u == null || u(); }; return u = this.ui.showConnecting({ @@ -28328,10 +28840,10 @@ class Eo { onResetConnection: this.resetAndReload // eslint-disable-line @typescript-eslint/unbound-method }), new Promise((p, w) => { - this.relayEventManager.callbacks.set(l, (A) => { - if (u == null || u(), jn(A)) - return w(new Error(A.errorMessage)); - p(A); + this.relayEventManager.callbacks.set(l, (_) => { + if (u == null || u(), jn(_)) + return w(new Error(_.errorMessage)); + p(_); }), this.publishWeb3RequestEvent(l, a); }); } @@ -28348,7 +28860,7 @@ class Eo { } }; let u = null; - const l = Qa(8), d = (p) => { + const l = sc(8), d = (p) => { this.publishWeb3RequestCanceledEvent(l), this.handleErrorResponse(l, a.method, p), u == null || u(); }; return u = this.ui.showConnecting({ @@ -28357,10 +28869,10 @@ class Eo { onResetConnection: this.resetAndReload // eslint-disable-line @typescript-eslint/unbound-method }), new Promise((p, w) => { - this.relayEventManager.callbacks.set(l, (A) => { - if (u == null || u(), jn(A)) - return w(new Error(A.errorMessage)); - p(A); + this.relayEventManager.callbacks.set(l, (_) => { + if (u == null || u(), jn(_)) + return w(new Error(_.errorMessage)); + p(_); }), this.publishWeb3RequestEvent(l, a); }); } @@ -28370,7 +28882,7 @@ class Eo { params: Object.assign({ chainId: e }, { address: r }) }; let i = null; - const s = Qa(8), o = (a) => { + const s = sc(8), o = (a) => { this.publishWeb3RequestCanceledEvent(s), this.handleErrorResponse(s, n.method, a), i == null || i(); }; return i = this.ui.showConnecting({ @@ -28381,7 +28893,7 @@ class Eo { }), new Promise((a, u) => { this.relayEventManager.callbacks.set(s, (l) => { if (i == null || i(), jn(l) && l.errorCode) - return u(Sr.provider.custom({ + return u(Ar.provider.custom({ code: l.errorCode, message: "Unrecognized chain ID. Try adding the chain using addEthereumChain first." })); @@ -28392,15 +28904,15 @@ class Eo { }); } } -Eo.accountRequestCallbackIds = /* @__PURE__ */ new Set(); -const I6 = "DefaultChainId", C6 = "DefaultJsonRpcUrl"; -class lS { +Mo.accountRequestCallbackIds = /* @__PURE__ */ new Set(); +const W_ = "DefaultChainId", H_ = "DefaultJsonRpcUrl"; +class FS { constructor(e) { - this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new eo("walletlink", P6), this.callback = e.callback || null; - const r = this._storage.getItem(B1); + this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new no("walletlink", q_), this.callback = e.callback || null; + const r = this._storage.getItem(ev); if (r) { const n = r.split(" "); - n[0] !== "" && (this._addresses = n.map((i) => ra(i))); + n[0] !== "" && (this._addresses = n.map((i) => ia(i))); } this.initializeRelay(); } @@ -28416,27 +28928,27 @@ class lS { } get jsonRpcUrl() { var e; - return (e = this._storage.getItem(C6)) !== null && e !== void 0 ? e : void 0; + return (e = this._storage.getItem(H_)) !== null && e !== void 0 ? e : void 0; } set jsonRpcUrl(e) { - this._storage.setItem(C6, e); + this._storage.setItem(H_, e); } updateProviderInfo(e, r) { var n; this.jsonRpcUrl = e; const i = this.getChainId(); - this._storage.setItem(I6, r.toString(10)), Kf(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", pa(r))); + this._storage.setItem(W_, r.toString(10)), Qf(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", ma(r))); } async watchAsset(e) { const r = Array.isArray(e) ? e[0] : e; if (!r.type) - throw Sr.rpc.invalidParams("Type is required"); + throw Ar.rpc.invalidParams("Type is required"); if ((r == null ? void 0 : r.type) !== "ERC20") - throw Sr.rpc.invalidParams(`Asset of type '${r.type}' is not supported`); + throw Ar.rpc.invalidParams(`Asset of type '${r.type}' is not supported`); if (!(r != null && r.options)) - throw Sr.rpc.invalidParams("Options are required"); + throw Ar.rpc.invalidParams("Options are required"); if (!(r != null && r.options.address)) - throw Sr.rpc.invalidParams("Address is required"); + throw Ar.rpc.invalidParams("Address is required"); const n = this.getChainId(), { address: i, symbol: s, image: o, decimals: a } = r.options, l = await this.initializeRelay().watchAsset(r.type, i, s, a, o, n == null ? void 0 : n.toString()); return jn(l) ? !1 : !!l.result; } @@ -28444,11 +28956,11 @@ class lS { var r, n; const i = e[0]; if (((r = i.rpcUrls) === null || r === void 0 ? void 0 : r.length) === 0) - throw Sr.rpc.invalidParams("please pass in at least 1 rpcUrl"); + throw Ar.rpc.invalidParams("please pass in at least 1 rpcUrl"); if (!i.chainName || i.chainName.trim() === "") - throw Sr.rpc.invalidParams("chainName is a required field"); + throw Ar.rpc.invalidParams("chainName is a required field"); if (!i.nativeCurrency) - throw Sr.rpc.invalidParams("nativeCurrency is a required field"); + throw Ar.rpc.invalidParams("nativeCurrency is a required field"); const s = Number.parseInt(i.chainId, 16); if (s === this.getChainId()) return !1; @@ -28457,7 +28969,7 @@ class lS { return !1; if (((n = w.result) === null || n === void 0 ? void 0 : n.isApproved) === !0) return this.updateProviderInfo(a[0], s), null; - throw Sr.rpc.internal("unable to add ethereum chain"); + throw Ar.rpc.internal("unable to add ethereum chain"); } async switchEthereumChain(e) { const r = e[0], n = Number.parseInt(r.chainId, 16), s = await this.initializeRelay().switchEthereumChain(n.toString(10), this.selectedAddress || void 0); @@ -28473,8 +28985,8 @@ class lS { var n; if (!Array.isArray(e)) throw new Error("addresses is not an array"); - const i = e.map((s) => ra(s)); - JSON.stringify(i) !== JSON.stringify(this._addresses) && (this._addresses = i, (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", i), this._storage.setItem(B1, i.join(" "))); + const i = e.map((s) => ia(s)); + JSON.stringify(i) !== JSON.stringify(this._addresses) && (this._addresses = i, (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", i), this._storage.setItem(ev, i.join(" "))); } async request(e) { const r = e.params || []; @@ -28486,7 +28998,7 @@ class lS { case "net_version": return this.getChainId().toString(10); case "eth_chainId": - return pa(this.getChainId()); + return ma(this.getChainId()); case "eth_requestAccounts": return this._eth_requestAccounts(); case "eth_ecRecover": @@ -28513,21 +29025,21 @@ class lS { return this.watchAsset(r); default: if (!this.jsonRpcUrl) - throw Sr.rpc.internal("No RPC URL set for chain"); - return BE(e, this.jsonRpcUrl); + throw Ar.rpc.internal("No RPC URL set for chain"); + return hS(e, this.jsonRpcUrl); } } _ensureKnownAddress(e) { - const r = ra(e); - if (!this._addresses.map((i) => ra(i)).includes(r)) + const r = ia(e); + if (!this._addresses.map((i) => ia(i)).includes(r)) throw new Error("Unknown Ethereum address"); } _prepareTransactionParams(e) { - const r = e.from ? ra(e.from) : this.selectedAddress; + const r = e.from ? ia(e.from) : this.selectedAddress; if (!r) throw new Error("Ethereum address is unavailable"); this._ensureKnownAddress(r); - const n = e.to ? ra(e.to) : null, i = e.value != null ? Rf(e.value) : BigInt(0), s = e.data ? $1(e.data) : Buffer.alloc(0), o = e.nonce != null ? Kf(e.nonce) : null, a = e.gasPrice != null ? Rf(e.gasPrice) : null, u = e.maxFeePerGas != null ? Rf(e.maxFeePerGas) : null, l = e.maxPriorityFeePerGas != null ? Rf(e.maxPriorityFeePerGas) : null, d = e.gas != null ? Rf(e.gas) : null, p = e.chainId ? Kf(e.chainId) : this.getChainId(); + const n = e.to ? ia(e.to) : null, i = e.value != null ? Bf(e.value) : BigInt(0), s = e.data ? Q1(e.data) : Buffer.alloc(0), o = e.nonce != null ? Qf(e.nonce) : null, a = e.gasPrice != null ? Bf(e.gasPrice) : null, u = e.maxFeePerGas != null ? Bf(e.maxFeePerGas) : null, l = e.maxPriorityFeePerGas != null ? Bf(e.maxPriorityFeePerGas) : null, d = e.gas != null ? Bf(e.gas) : null, p = e.chainId ? Qf(e.chainId) : this.getChainId(); return { fromAddress: r, toAddress: n, @@ -28544,12 +29056,12 @@ class lS { async ecRecover(e) { const { method: r, params: n } = e; if (!Array.isArray(n)) - throw Sr.rpc.invalidParams(); + throw Ar.rpc.invalidParams(); const s = await this.initializeRelay().sendRequest({ method: "ethereumAddressFromSignedMessage", params: { - message: _m(n[0]), - signature: _m(n[1]), + message: km(n[0]), + signature: km(n[1]), addPrefix: r === "personal_ecRecover" } }); @@ -28559,29 +29071,29 @@ class lS { } getChainId() { var e; - return Number.parseInt((e = this._storage.getItem(I6)) !== null && e !== void 0 ? e : "1", 10); + return Number.parseInt((e = this._storage.getItem(W_)) !== null && e !== void 0 ? e : "1", 10); } async _eth_requestAccounts() { var e, r; if (this._addresses.length > 0) - return (e = this.callback) === null || e === void 0 || e.call(this, "connect", { chainId: pa(this.getChainId()) }), this._addresses; + return (e = this.callback) === null || e === void 0 || e.call(this, "connect", { chainId: ma(this.getChainId()) }), this._addresses; const i = await this.initializeRelay().requestEthereumAccounts(); if (jn(i)) throw i; if (!i.result) throw new Error("accounts received is empty"); - return this._setAddresses(i.result), (r = this.callback) === null || r === void 0 || r.call(this, "connect", { chainId: pa(this.getChainId()) }), this._addresses; + return this._setAddresses(i.result), (r = this.callback) === null || r === void 0 || r.call(this, "connect", { chainId: ma(this.getChainId()) }), this._addresses; } async personalSign({ params: e }) { if (!Array.isArray(e)) - throw Sr.rpc.invalidParams(); + throw Ar.rpc.invalidParams(); const r = e[1], n = e[0]; this._ensureKnownAddress(r); const s = await this.initializeRelay().sendRequest({ method: "signEthereumMessage", params: { - address: ra(r), - message: _m(n), + address: ia(r), + message: km(n), addPrefix: !0, typedDataJson: null } @@ -28597,7 +29109,7 @@ class lS { return i.result; } async _eth_sendRawTransaction(e) { - const r = $1(e[0]), i = await this.initializeRelay().submitEthereumTransaction(r, this.getChainId()); + const r = Q1(e[0]), i = await this.initializeRelay().submitEthereumTransaction(r, this.getChainId()); if (jn(i)) throw i; return i.result; @@ -28611,23 +29123,23 @@ class lS { async signTypedData(e) { const { method: r, params: n } = e; if (!Array.isArray(n)) - throw Sr.rpc.invalidParams(); + throw Ar.rpc.invalidParams(); const i = (l) => { const d = { - eth_signTypedData_v1: dd.hashForSignTypedDataLegacy, - eth_signTypedData_v3: dd.hashForSignTypedData_v3, - eth_signTypedData_v4: dd.hashForSignTypedData_v4, - eth_signTypedData: dd.hashForSignTypedData_v4 + eth_signTypedData_v1: Sd.hashForSignTypedDataLegacy, + eth_signTypedData_v3: Sd.hashForSignTypedData_v3, + eth_signTypedData_v4: Sd.hashForSignTypedData_v4, + eth_signTypedData: Sd.hashForSignTypedData_v4 }; - return Hf(d[r]({ - data: YG(l) + return Zf(d[r]({ + data: IY(l) }), !0); }, s = n[r === "eth_signTypedData_v1" ? 1 : 0], o = n[r === "eth_signTypedData_v1" ? 0 : 1]; this._ensureKnownAddress(s); const u = await this.initializeRelay().sendRequest({ method: "signEthereumMessage", params: { - address: ra(s), + address: ia(s), message: i(o), typedDataJson: JSON.stringify(o, null, 2), addPrefix: !1 @@ -28638,8 +29150,8 @@ class lS { return u.result; } initializeRelay() { - return this._relay || (this._relay = new Eo({ - linkAPIUrl: P6, + return this._relay || (this._relay = new Mo({ + linkAPIUrl: q_, storage: this._storage, metadata: this.metadata, accountsCallback: this._setAddresses.bind(this), @@ -28647,16 +29159,16 @@ class lS { })), this._relay; } } -const hS = "SignerType", dS = new eo("CBWSDK", "SignerConfigurator"); -function nJ() { - return dS.getItem(hS); +const jS = "SignerType", US = new no("CBWSDK", "SignerConfigurator"); +function kJ() { + return US.getItem(jS); } -function iJ(t) { - dS.setItem(hS, t); +function $J(t) { + US.setItem(jS, t); } -async function sJ(t) { +async function BJ(t) { const { communicator: e, metadata: r, handshakeRequest: n, callback: i } = t; - aJ(e, r, i).catch(() => { + jJ(e, r, i).catch(() => { }); const s = { id: crypto.randomUUID(), @@ -28665,25 +29177,25 @@ async function sJ(t) { }, { data: o } = await e.postRequestAndWaitForResponse(s); return o; } -function oJ(t) { +function FJ(t) { const { signerType: e, metadata: r, communicator: n, callback: i } = t; switch (e) { case "scw": - return new cY({ + return new UY({ metadata: r, callback: i, communicator: n }); case "walletlink": - return new lS({ + return new FS({ metadata: r, callback: i }); } } -async function aJ(t, e, r) { +async function jJ(t, e, r) { await t.onMessage(({ event: i }) => i === "WalletLinkSessionRequest"); - const n = new lS({ + const n = new FS({ metadata: e, callback: r }); @@ -28695,9 +29207,9 @@ async function aJ(t, e, r) { data: { connected: !0 } }); } -const cJ = `Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. +const UJ = `Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. -Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`, uJ = () => { +Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`, qJ = () => { let t; return { getCrossOriginOpenerPolicy: () => t === void 0 ? "undefined" : t, @@ -28713,36 +29225,36 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene if (!r.ok) throw new Error(`HTTP error! status: ${r.status}`); const n = r.headers.get("Cross-Origin-Opener-Policy"); - t = n ?? "null", t === "same-origin" && console.error(cJ); + t = n ?? "null", t === "same-origin" && console.error(UJ); } catch (e) { console.error("Error checking Cross-Origin-Opener-Policy:", e.message), t = "error"; } } }; -}, { checkCrossOriginOpenerPolicy: fJ, getCrossOriginOpenerPolicy: lJ } = uJ(), T6 = 420, R6 = 540; -function hJ(t) { - const e = (window.innerWidth - T6) / 2 + window.screenX, r = (window.innerHeight - R6) / 2 + window.screenY; - pJ(t); - const n = window.open(t, "Smart Wallet", `width=${T6}, height=${R6}, left=${e}, top=${r}`); +}, { checkCrossOriginOpenerPolicy: zJ, getCrossOriginOpenerPolicy: WJ } = qJ(), K_ = 420, V_ = 540; +function HJ(t) { + const e = (window.innerWidth - K_) / 2 + window.screenX, r = (window.innerHeight - V_) / 2 + window.screenY; + VJ(t); + const n = window.open(t, "Smart Wallet", `width=${K_}, height=${V_}, left=${e}, top=${r}`); if (n == null || n.focus(), !n) - throw Sr.rpc.internal("Pop up window failed to open"); + throw Ar.rpc.internal("Pop up window failed to open"); return n; } -function dJ(t) { +function KJ(t) { t && !t.closed && t.close(); } -function pJ(t) { +function VJ(t) { const e = { - sdkName: $E, - sdkVersion: nh, + sdkName: lS, + sdkVersion: hh, origin: window.location.origin, - coop: lJ() + coop: WJ() }; for (const [r, n] of Object.entries(e)) t.searchParams.append(r, n.toString()); } -class gJ { - constructor({ url: e = tJ, metadata: r, preference: n }) { +class GJ { + constructor({ url: e = NJ, metadata: r, preference: n }) { this.popup = null, this.listeners = /* @__PURE__ */ new Map(), this.postMessage = async (i) => { (await this.waitForPopupLoaded()).postMessage(i, this.url.origin); }, this.postRequestAndWaitForResponse = async (i) => { @@ -28757,15 +29269,15 @@ class gJ { }; window.addEventListener("message", a), this.listeners.set(a, { reject: o }); }), this.disconnect = () => { - dJ(this.popup), this.popup = null, this.listeners.forEach(({ reject: i }, s) => { - i(Sr.provider.userRejectedRequest("Request rejected")), window.removeEventListener("message", s); + KJ(this.popup), this.popup = null, this.listeners.forEach(({ reject: i }, s) => { + i(Ar.provider.userRejectedRequest("Request rejected")), window.removeEventListener("message", s); }), this.listeners.clear(); - }, this.waitForPopupLoaded = async () => this.popup && !this.popup.closed ? (this.popup.focus(), this.popup) : (this.popup = hJ(this.url), this.onMessage(({ event: i }) => i === "PopupUnload").then(this.disconnect).catch(() => { + }, this.waitForPopupLoaded = async () => this.popup && !this.popup.closed ? (this.popup.focus(), this.popup) : (this.popup = HJ(this.url), this.onMessage(({ event: i }) => i === "PopupUnload").then(this.disconnect).catch(() => { }), this.onMessage(({ event: i }) => i === "PopupLoaded").then((i) => { this.postMessage({ requestId: i.id, data: { - version: nh, + version: hh, metadata: this.metadata, preference: this.preference, location: window.location.toString() @@ -28773,18 +29285,18 @@ class gJ { }); }).then(() => { if (!this.popup) - throw Sr.rpc.internal(); + throw Ar.rpc.internal(); return this.popup; })), this.url = new URL(e), this.metadata = r, this.preference = n; } } -function mJ(t) { - const e = WG(vJ(t), { +function YJ(t) { + const e = EY(JJ(t), { shouldIncludeStack: !0 }), r = new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors"); - return r.searchParams.set("version", nh), r.searchParams.set("code", e.code.toString()), r.searchParams.set("message", e.message), Object.assign(Object.assign({}, e), { docUrl: r.href }); + return r.searchParams.set("version", hh), r.searchParams.set("code", e.code.toString()), r.searchParams.set("message", e.message), Object.assign(Object.assign({}, e), { docUrl: r.href }); } -function vJ(t) { +function JJ(t) { var e; if (typeof t == "string") return { @@ -28801,7 +29313,7 @@ function vJ(t) { } return t; } -var pS = { exports: {} }; +var qS = { exports: {} }; (function(t) { var e = Object.prototype.hasOwnProperty, r = "~"; function n() { @@ -28813,8 +29325,8 @@ var pS = { exports: {} }; function s(u, l, d, p, w) { if (typeof d != "function") throw new TypeError("The listener must be a function"); - var A = new i(d, p || u, w), M = r ? r + l : l; - return u._events[M] ? u._events[M].fn ? u._events[M] = [u._events[M], A] : u._events[M].push(A) : (u._events[M] = A, u._eventsCount++), u; + var _ = new i(d, p || u, w), P = r ? r + l : l; + return u._events[P] ? u._events[P].fn ? u._events[P] = [u._events[P], _] : u._events[P].push(_) : (u._events[P] = _, u._eventsCount++), u; } function o(u, l) { --u._eventsCount === 0 ? u._events = new n() : delete u._events[l]; @@ -28832,16 +29344,16 @@ var pS = { exports: {} }; var d = r ? r + l : l, p = this._events[d]; if (!p) return []; if (p.fn) return [p.fn]; - for (var w = 0, A = p.length, M = new Array(A); w < A; w++) - M[w] = p[w].fn; - return M; + for (var w = 0, _ = p.length, P = new Array(_); w < _; w++) + P[w] = p[w].fn; + return P; }, a.prototype.listenerCount = function(l) { var d = r ? r + l : l, p = this._events[d]; return p ? p.fn ? 1 : p.length : 0; - }, a.prototype.emit = function(l, d, p, w, A, M) { - var N = r ? r + l : l; - if (!this._events[N]) return !1; - var L = this._events[N], B = arguments.length, $, H; + }, a.prototype.emit = function(l, d, p, w, _, P) { + var O = r ? r + l : l; + if (!this._events[O]) return !1; + var L = this._events[O], B = arguments.length, k, q; if (L.fn) { switch (L.once && this.removeListener(l, L.fn, void 0, !0), B) { case 1: @@ -28853,33 +29365,33 @@ var pS = { exports: {} }; case 4: return L.fn.call(L.context, d, p, w), !0; case 5: - return L.fn.call(L.context, d, p, w, A), !0; + return L.fn.call(L.context, d, p, w, _), !0; case 6: - return L.fn.call(L.context, d, p, w, A, M), !0; + return L.fn.call(L.context, d, p, w, _, P), !0; } - for (H = 1, $ = new Array(B - 1); H < B; H++) - $[H - 1] = arguments[H]; - L.fn.apply(L.context, $); + for (q = 1, k = new Array(B - 1); q < B; q++) + k[q - 1] = arguments[q]; + L.fn.apply(L.context, k); } else { var U = L.length, V; - for (H = 0; H < U; H++) - switch (L[H].once && this.removeListener(l, L[H].fn, void 0, !0), B) { + for (q = 0; q < U; q++) + switch (L[q].once && this.removeListener(l, L[q].fn, void 0, !0), B) { case 1: - L[H].fn.call(L[H].context); + L[q].fn.call(L[q].context); break; case 2: - L[H].fn.call(L[H].context, d); + L[q].fn.call(L[q].context, d); break; case 3: - L[H].fn.call(L[H].context, d, p); + L[q].fn.call(L[q].context, d, p); break; case 4: - L[H].fn.call(L[H].context, d, p, w); + L[q].fn.call(L[q].context, d, p, w); break; default: - if (!$) for (V = 1, $ = new Array(B - 1); V < B; V++) - $[V - 1] = arguments[V]; - L[H].fn.apply(L[H].context, $); + if (!k) for (V = 1, k = new Array(B - 1); V < B; V++) + k[V - 1] = arguments[V]; + L[q].fn.apply(L[q].context, k); } } return !0; @@ -28888,29 +29400,29 @@ var pS = { exports: {} }; }, a.prototype.once = function(l, d, p) { return s(this, l, d, p, !0); }, a.prototype.removeListener = function(l, d, p, w) { - var A = r ? r + l : l; - if (!this._events[A]) return this; + var _ = r ? r + l : l; + if (!this._events[_]) return this; if (!d) - return o(this, A), this; - var M = this._events[A]; - if (M.fn) - M.fn === d && (!w || M.once) && (!p || M.context === p) && o(this, A); + return o(this, _), this; + var P = this._events[_]; + if (P.fn) + P.fn === d && (!w || P.once) && (!p || P.context === p) && o(this, _); else { - for (var N = 0, L = [], B = M.length; N < B; N++) - (M[N].fn !== d || w && !M[N].once || p && M[N].context !== p) && L.push(M[N]); - L.length ? this._events[A] = L.length === 1 ? L[0] : L : o(this, A); + for (var O = 0, L = [], B = P.length; O < B; O++) + (P[O].fn !== d || w && !P[O].once || p && P[O].context !== p) && L.push(P[O]); + L.length ? this._events[_] = L.length === 1 ? L[0] : L : o(this, _); } return this; }, a.prototype.removeAllListeners = function(l) { var d; return l ? (d = r ? r + l : l, this._events[d] && o(this, d)) : (this._events = new n(), this._eventsCount = 0), this; }, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = r, a.EventEmitter = a, t.exports = a; -})(pS); -var bJ = pS.exports; -const yJ = /* @__PURE__ */ ts(bJ); -class wJ extends yJ { +})(qS); +var XJ = qS.exports; +const ZJ = /* @__PURE__ */ ns(XJ); +class QJ extends ZJ { } -var xJ = function(t, e) { +var eX = function(t, e) { var r = {}; for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); if (t != null && typeof Object.getOwnPropertySymbols == "function") @@ -28918,37 +29430,37 @@ var xJ = function(t, e) { e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]); return r; }; -class _J extends wJ { +class tX extends QJ { constructor(e) { - var { metadata: r } = e, n = e.preference, { keysUrl: i } = n, s = xJ(n, ["keysUrl"]); - super(), this.signer = null, this.isCoinbaseWallet = !0, this.metadata = r, this.preference = s, this.communicator = new gJ({ + var { metadata: r } = e, n = e.preference, { keysUrl: i } = n, s = eX(n, ["keysUrl"]); + super(), this.signer = null, this.isCoinbaseWallet = !0, this.metadata = r, this.preference = s, this.communicator = new GJ({ url: i, metadata: r, preference: s }); - const o = nJ(); + const o = kJ(); o && (this.signer = this.initSigner(o)); } async request(e) { try { - if (aY(e), !this.signer) + if (jY(e), !this.signer) switch (e.method) { case "eth_requestAccounts": { const r = await this.requestSignerSelection(e), n = this.initSigner(r); - await n.handshake(e), this.signer = n, iJ(r); + await n.handshake(e), this.signer = n, $J(r); break; } case "net_version": return 1; case "eth_chainId": - return pa(1); + return ma(1); default: - throw Sr.provider.unauthorized("Must call 'eth_requestAccounts' before other methods"); + throw Ar.provider.unauthorized("Must call 'eth_requestAccounts' before other methods"); } return this.signer.request(e); } catch (r) { const { code: n } = r; - return n === fn.provider.unauthorized && this.disconnect(), Promise.reject(mJ(r)); + return n === fn.provider.unauthorized && this.disconnect(), Promise.reject(YJ(r)); } } /** @deprecated Use `.request({ method: 'eth_requestAccounts' })` instead. */ @@ -28959,10 +29471,10 @@ class _J extends wJ { } async disconnect() { var e; - await ((e = this.signer) === null || e === void 0 ? void 0 : e.cleanup()), this.signer = null, eo.clearAll(), this.emit("disconnect", Sr.provider.disconnected("User initiated disconnection")); + await ((e = this.signer) === null || e === void 0 ? void 0 : e.cleanup()), this.signer = null, no.clearAll(), this.emit("disconnect", Ar.provider.disconnected("User initiated disconnection")); } requestSignerSelection(e) { - return sJ({ + return BJ({ communicator: this.communicator, preference: this.preference, metadata: this.metadata, @@ -28971,7 +29483,7 @@ class _J extends wJ { }); } initSigner(e) { - return oJ({ + return FJ({ signerType: e, metadata: this.metadata, communicator: this.communicator, @@ -28979,7 +29491,7 @@ class _J extends wJ { }); } } -function EJ(t) { +function rX(t) { if (t) { if (!["all", "smartWalletOnly", "eoaOnly"].includes(t.options)) throw new Error(`Invalid options: ${t.options}`); @@ -28987,66 +29499,66 @@ function EJ(t) { throw new Error("Attribution cannot contain both auto and dataSuffix properties"); } } -function SJ(t) { +function nX(t) { var e; const r = { metadata: t.metadata, preference: t.preference }; - return (e = oY(r)) !== null && e !== void 0 ? e : new _J(r); + return (e = FY(r)) !== null && e !== void 0 ? e : new tX(r); } -const AJ = { +const iX = { options: "all" }; -function PJ(t) { +function sX(t) { var e; - new eo("CBWSDK").setItem("VERSION", nh), fJ(); + new no("CBWSDK").setItem("VERSION", hh), zJ(); const n = { metadata: { appName: t.appName || "Dapp", appLogoUrl: t.appLogoUrl || "", appChainIds: t.appChainIds || [] }, - preference: Object.assign(AJ, (e = t.preference) !== null && e !== void 0 ? e : {}) + preference: Object.assign(iX, (e = t.preference) !== null && e !== void 0 ? e : {}) }; - EJ(n.preference); + rX(n.preference); let i = null; return { - getProvider: () => (i || (i = SJ(n)), i) + getProvider: () => (i || (i = nX(n)), i) }; } -function gS(t, e) { +function zS(t, e) { return function() { return t.apply(e, arguments); }; } -const { toString: MJ } = Object.prototype, { getPrototypeOf: Ab } = Object, fp = /* @__PURE__ */ ((t) => (e) => { - const r = MJ.call(e); +const { toString: oX } = Object.prototype, { getPrototypeOf: Fb } = Object, Sp = /* @__PURE__ */ ((t) => (e) => { + const r = oX.call(e); return t[r] || (t[r] = r.slice(8, -1).toLowerCase()); -})(/* @__PURE__ */ Object.create(null)), Ps = (t) => (t = t.toLowerCase(), (e) => fp(e) === t), lp = (t) => (e) => typeof e === t, { isArray: Wu } = Array, Ml = lp("undefined"); -function IJ(t) { - return t !== null && !Ml(t) && t.constructor !== null && !Ml(t.constructor) && Oi(t.constructor.isBuffer) && t.constructor.isBuffer(t); +})(/* @__PURE__ */ Object.create(null)), Ts = (t) => (t = t.toLowerCase(), (e) => Sp(e) === t), Ap = (t) => (e) => typeof e === t, { isArray: Xu } = Array, Bl = Ap("undefined"); +function aX(t) { + return t !== null && !Bl(t) && t.constructor !== null && !Bl(t.constructor) && Ni(t.constructor.isBuffer) && t.constructor.isBuffer(t); } -const mS = Ps("ArrayBuffer"); -function CJ(t) { +const WS = Ts("ArrayBuffer"); +function cX(t) { let e; - return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && mS(t.buffer), e; + return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && WS(t.buffer), e; } -const TJ = lp("string"), Oi = lp("function"), vS = lp("number"), hp = (t) => t !== null && typeof t == "object", RJ = (t) => t === !0 || t === !1, kd = (t) => { - if (fp(t) !== "object") +const uX = Ap("string"), Ni = Ap("function"), HS = Ap("number"), Pp = (t) => t !== null && typeof t == "object", fX = (t) => t === !0 || t === !1, Gd = (t) => { + if (Sp(t) !== "object") return !1; - const e = Ab(t); + const e = Fb(t); return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in t) && !(Symbol.iterator in t); -}, DJ = Ps("Date"), OJ = Ps("File"), NJ = Ps("Blob"), LJ = Ps("FileList"), kJ = (t) => hp(t) && Oi(t.pipe), $J = (t) => { +}, lX = Ts("Date"), hX = Ts("File"), dX = Ts("Blob"), pX = Ts("FileList"), gX = (t) => Pp(t) && Ni(t.pipe), mX = (t) => { let e; - return t && (typeof FormData == "function" && t instanceof FormData || Oi(t.append) && ((e = fp(t)) === "formdata" || // detect form-data instance - e === "object" && Oi(t.toString) && t.toString() === "[object FormData]")); -}, BJ = Ps("URLSearchParams"), [FJ, jJ, UJ, qJ] = ["ReadableStream", "Request", "Response", "Headers"].map(Ps), zJ = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); -function sh(t, e, { allOwnKeys: r = !1 } = {}) { + return t && (typeof FormData == "function" && t instanceof FormData || Ni(t.append) && ((e = Sp(t)) === "formdata" || // detect form-data instance + e === "object" && Ni(t.toString) && t.toString() === "[object FormData]")); +}, vX = Ts("URLSearchParams"), [bX, yX, wX, xX] = ["ReadableStream", "Request", "Response", "Headers"].map(Ts), _X = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); +function ph(t, e, { allOwnKeys: r = !1 } = {}) { if (t === null || typeof t > "u") return; let n, i; - if (typeof t != "object" && (t = [t]), Wu(t)) + if (typeof t != "object" && (t = [t]), Xu(t)) for (n = 0, i = t.length; n < i; n++) e.call(null, t[n], n, t); else { @@ -29056,7 +29568,7 @@ function sh(t, e, { allOwnKeys: r = !1 } = {}) { a = s[n], e.call(null, t[a], a, t); } } -function bS(t, e) { +function KS(t, e) { e = e.toLowerCase(); const r = Object.keys(t); let n = r.length, i; @@ -29065,75 +29577,75 @@ function bS(t, e) { return i; return null; } -const ic = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, yS = (t) => !Ml(t) && t !== ic; -function H1() { - const { caseless: t } = yS(this) && this || {}, e = {}, r = (n, i) => { - const s = t && bS(e, i) || i; - kd(e[s]) && kd(n) ? e[s] = H1(e[s], n) : kd(n) ? e[s] = H1({}, n) : Wu(n) ? e[s] = n.slice() : e[s] = n; +const lc = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, VS = (t) => !Bl(t) && t !== lc; +function av() { + const { caseless: t } = VS(this) && this || {}, e = {}, r = (n, i) => { + const s = t && KS(e, i) || i; + Gd(e[s]) && Gd(n) ? e[s] = av(e[s], n) : Gd(n) ? e[s] = av({}, n) : Xu(n) ? e[s] = n.slice() : e[s] = n; }; for (let n = 0, i = arguments.length; n < i; n++) - arguments[n] && sh(arguments[n], r); + arguments[n] && ph(arguments[n], r); return e; } -const WJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { - r && Oi(i) ? t[s] = gS(i, r) : t[s] = i; -}, { allOwnKeys: n }), t), HJ = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), KJ = (t, e, r, n) => { +const EX = (t, e, r, { allOwnKeys: n } = {}) => (ph(e, (i, s) => { + r && Ni(i) ? t[s] = zS(i, r) : t[s] = i; +}, { allOwnKeys: n }), t), SX = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), AX = (t, e, r, n) => { t.prototype = Object.create(e.prototype, n), t.prototype.constructor = t, Object.defineProperty(t, "super", { value: e.prototype }), r && Object.assign(t.prototype, r); -}, VJ = (t, e, r, n) => { +}, PX = (t, e, r, n) => { let i, s, o; const a = {}; if (e = e || {}, t == null) return e; do { for (i = Object.getOwnPropertyNames(t), s = i.length; s-- > 0; ) o = i[s], (!n || n(o, t, e)) && !a[o] && (e[o] = t[o], a[o] = !0); - t = r !== !1 && Ab(t); + t = r !== !1 && Fb(t); } while (t && (!r || r(t, e)) && t !== Object.prototype); return e; -}, GJ = (t, e, r) => { +}, MX = (t, e, r) => { t = String(t), (r === void 0 || r > t.length) && (r = t.length), r -= e.length; const n = t.indexOf(e, r); return n !== -1 && n === r; -}, YJ = (t) => { +}, IX = (t) => { if (!t) return null; - if (Wu(t)) return t; + if (Xu(t)) return t; let e = t.length; - if (!vS(e)) return null; + if (!HS(e)) return null; const r = new Array(e); for (; e-- > 0; ) r[e] = t[e]; return r; -}, JJ = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Ab(Uint8Array)), XJ = (t, e) => { +}, CX = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Fb(Uint8Array)), TX = (t, e) => { const n = (t && t[Symbol.iterator]).call(t); let i; for (; (i = n.next()) && !i.done; ) { const s = i.value; e.call(t, s[0], s[1]); } -}, ZJ = (t, e) => { +}, RX = (t, e) => { let r; const n = []; for (; (r = t.exec(e)) !== null; ) n.push(r); return n; -}, QJ = Ps("HTMLFormElement"), eX = (t) => t.toLowerCase().replace( +}, DX = Ts("HTMLFormElement"), OX = (t) => t.toLowerCase().replace( /[-_\s]([a-z\d])(\w*)/g, function(r, n, i) { return n.toUpperCase() + i; } -), D6 = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), tX = Ps("RegExp"), wS = (t, e) => { +), G_ = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), NX = Ts("RegExp"), GS = (t, e) => { const r = Object.getOwnPropertyDescriptors(t), n = {}; - sh(r, (i, s) => { + ph(r, (i, s) => { let o; (o = e(i, s, t)) !== !1 && (n[s] = o || i); }), Object.defineProperties(t, n); -}, rX = (t) => { - wS(t, (e, r) => { - if (Oi(t) && ["arguments", "caller", "callee"].indexOf(r) !== -1) +}, LX = (t) => { + GS(t, (e, r) => { + if (Ni(t) && ["arguments", "caller", "callee"].indexOf(r) !== -1) return !1; const n = t[r]; - if (Oi(n)) { + if (Ni(n)) { if (e.enumerable = !1, "writable" in e) { e.writable = !1; return; @@ -29143,111 +29655,111 @@ const WJ = (t, e, r, { allOwnKeys: n } = {}) => (sh(e, (i, s) => { }); } }); -}, nX = (t, e) => { +}, kX = (t, e) => { const r = {}, n = (i) => { i.forEach((s) => { r[s] = !0; }); }; - return Wu(t) ? n(t) : n(String(t).split(e)), r; -}, iX = () => { -}, sX = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, Im = "abcdefghijklmnopqrstuvwxyz", O6 = "0123456789", xS = { - DIGIT: O6, - ALPHA: Im, - ALPHA_DIGIT: Im + Im.toUpperCase() + O6 -}, oX = (t = 16, e = xS.ALPHA_DIGIT) => { + return Xu(t) ? n(t) : n(String(t).split(e)), r; +}, $X = () => { +}, BX = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, qm = "abcdefghijklmnopqrstuvwxyz", Y_ = "0123456789", YS = { + DIGIT: Y_, + ALPHA: qm, + ALPHA_DIGIT: qm + qm.toUpperCase() + Y_ +}, FX = (t = 16, e = YS.ALPHA_DIGIT) => { let r = ""; const { length: n } = e; for (; t--; ) r += e[Math.random() * n | 0]; return r; }; -function aX(t) { - return !!(t && Oi(t.append) && t[Symbol.toStringTag] === "FormData" && t[Symbol.iterator]); +function jX(t) { + return !!(t && Ni(t.append) && t[Symbol.toStringTag] === "FormData" && t[Symbol.iterator]); } -const cX = (t) => { +const UX = (t) => { const e = new Array(10), r = (n, i) => { - if (hp(n)) { + if (Pp(n)) { if (e.indexOf(n) >= 0) return; if (!("toJSON" in n)) { e[i] = n; - const s = Wu(n) ? [] : {}; - return sh(n, (o, a) => { + const s = Xu(n) ? [] : {}; + return ph(n, (o, a) => { const u = r(o, i + 1); - !Ml(u) && (s[a] = u); + !Bl(u) && (s[a] = u); }), e[i] = void 0, s; } } return n; }; return r(t, 0); -}, uX = Ps("AsyncFunction"), fX = (t) => t && (hp(t) || Oi(t)) && Oi(t.then) && Oi(t.catch), _S = ((t, e) => t ? setImmediate : e ? ((r, n) => (ic.addEventListener("message", ({ source: i, data: s }) => { - i === ic && s === r && n.length && n.shift()(); +}, qX = Ts("AsyncFunction"), zX = (t) => t && (Pp(t) || Ni(t)) && Ni(t.then) && Ni(t.catch), JS = ((t, e) => t ? setImmediate : e ? ((r, n) => (lc.addEventListener("message", ({ source: i, data: s }) => { + i === lc && s === r && n.length && n.shift()(); }, !1), (i) => { - n.push(i), ic.postMessage(r, "*"); + n.push(i), lc.postMessage(r, "*"); }))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))( typeof setImmediate == "function", - Oi(ic.postMessage) -), lX = typeof queueMicrotask < "u" ? queueMicrotask.bind(ic) : typeof process < "u" && process.nextTick || _S, Oe = { - isArray: Wu, - isArrayBuffer: mS, - isBuffer: IJ, - isFormData: $J, - isArrayBufferView: CJ, - isString: TJ, - isNumber: vS, - isBoolean: RJ, - isObject: hp, - isPlainObject: kd, - isReadableStream: FJ, - isRequest: jJ, - isResponse: UJ, - isHeaders: qJ, - isUndefined: Ml, - isDate: DJ, - isFile: OJ, - isBlob: NJ, - isRegExp: tX, - isFunction: Oi, - isStream: kJ, - isURLSearchParams: BJ, - isTypedArray: JJ, - isFileList: LJ, - forEach: sh, - merge: H1, - extend: WJ, - trim: zJ, - stripBOM: HJ, - inherits: KJ, - toFlatObject: VJ, - kindOf: fp, - kindOfTest: Ps, - endsWith: GJ, - toArray: YJ, - forEachEntry: XJ, - matchAll: ZJ, - isHTMLForm: QJ, - hasOwnProperty: D6, - hasOwnProp: D6, + Ni(lc.postMessage) +), WX = typeof queueMicrotask < "u" ? queueMicrotask.bind(lc) : typeof process < "u" && process.nextTick || JS, Oe = { + isArray: Xu, + isArrayBuffer: WS, + isBuffer: aX, + isFormData: mX, + isArrayBufferView: cX, + isString: uX, + isNumber: HS, + isBoolean: fX, + isObject: Pp, + isPlainObject: Gd, + isReadableStream: bX, + isRequest: yX, + isResponse: wX, + isHeaders: xX, + isUndefined: Bl, + isDate: lX, + isFile: hX, + isBlob: dX, + isRegExp: NX, + isFunction: Ni, + isStream: gX, + isURLSearchParams: vX, + isTypedArray: CX, + isFileList: pX, + forEach: ph, + merge: av, + extend: EX, + trim: _X, + stripBOM: SX, + inherits: AX, + toFlatObject: PX, + kindOf: Sp, + kindOfTest: Ts, + endsWith: MX, + toArray: IX, + forEachEntry: TX, + matchAll: RX, + isHTMLForm: DX, + hasOwnProperty: G_, + hasOwnProp: G_, // an alias to avoid ESLint no-prototype-builtins detection - reduceDescriptors: wS, - freezeMethods: rX, - toObjectSet: nX, - toCamelCase: eX, - noop: iX, - toFiniteNumber: sX, - findKey: bS, - global: ic, - isContextDefined: yS, - ALPHABET: xS, - generateString: oX, - isSpecCompliantForm: aX, - toJSONObject: cX, - isAsyncFn: uX, - isThenable: fX, - setImmediate: _S, - asap: lX + reduceDescriptors: GS, + freezeMethods: LX, + toObjectSet: kX, + toCamelCase: OX, + noop: $X, + toFiniteNumber: BX, + findKey: KS, + global: lc, + isContextDefined: VS, + ALPHABET: YS, + generateString: FX, + isSpecCompliantForm: jX, + toJSONObject: UX, + isAsyncFn: qX, + isThenable: zX, + setImmediate: JS, + asap: WX }; function or(t, e, r, n, i) { Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = t, this.name = "AxiosError", e && (this.code = e), r && (this.config = r), n && (this.request = n), i && (this.response = i, this.status = i.status ? i.status : null); @@ -29273,7 +29785,7 @@ Oe.inherits(or, Error, { }; } }); -const ES = or.prototype, SS = {}; +const XS = or.prototype, ZS = {}; [ "ERR_BAD_OPTION_VALUE", "ERR_BAD_OPTION", @@ -29289,96 +29801,96 @@ const ES = or.prototype, SS = {}; "ERR_INVALID_URL" // eslint-disable-next-line func-names ].forEach((t) => { - SS[t] = { value: t }; + ZS[t] = { value: t }; }); -Object.defineProperties(or, SS); -Object.defineProperty(ES, "isAxiosError", { value: !0 }); +Object.defineProperties(or, ZS); +Object.defineProperty(XS, "isAxiosError", { value: !0 }); or.from = (t, e, r, n, i, s) => { - const o = Object.create(ES); + const o = Object.create(XS); return Oe.toFlatObject(t, o, function(u) { return u !== Error.prototype; }, (a) => a !== "isAxiosError"), or.call(o, t.message, e, r, n, i), o.cause = t, o.name = t.name, s && Object.assign(o, s), o; }; -const hX = null; -function K1(t) { +const HX = null; +function cv(t) { return Oe.isPlainObject(t) || Oe.isArray(t); } -function AS(t) { +function QS(t) { return Oe.endsWith(t, "[]") ? t.slice(0, -2) : t; } -function N6(t, e, r) { +function J_(t, e, r) { return t ? t.concat(e).map(function(i, s) { - return i = AS(i), !r && s ? "[" + i + "]" : i; + return i = QS(i), !r && s ? "[" + i + "]" : i; }).join(r ? "." : "") : e; } -function dX(t) { - return Oe.isArray(t) && !t.some(K1); +function KX(t) { + return Oe.isArray(t) && !t.some(cv); } -const pX = Oe.toFlatObject(Oe, {}, null, function(e) { +const VX = Oe.toFlatObject(Oe, {}, null, function(e) { return /^is[A-Z]/.test(e); }); -function dp(t, e, r) { +function Mp(t, e, r) { if (!Oe.isObject(t)) throw new TypeError("target must be an object"); e = e || new FormData(), r = Oe.toFlatObject(r, { metaTokens: !0, dots: !1, indexes: !1 - }, !1, function(N, L) { - return !Oe.isUndefined(L[N]); + }, !1, function(O, L) { + return !Oe.isUndefined(L[O]); }); const n = r.metaTokens, i = r.visitor || d, s = r.dots, o = r.indexes, u = (r.Blob || typeof Blob < "u" && Blob) && Oe.isSpecCompliantForm(e); if (!Oe.isFunction(i)) throw new TypeError("visitor must be a function"); - function l(M) { - if (M === null) return ""; - if (Oe.isDate(M)) - return M.toISOString(); - if (!u && Oe.isBlob(M)) + function l(P) { + if (P === null) return ""; + if (Oe.isDate(P)) + return P.toISOString(); + if (!u && Oe.isBlob(P)) throw new or("Blob is not supported. Use a Buffer instead."); - return Oe.isArrayBuffer(M) || Oe.isTypedArray(M) ? u && typeof Blob == "function" ? new Blob([M]) : Buffer.from(M) : M; - } - function d(M, N, L) { - let B = M; - if (M && !L && typeof M == "object") { - if (Oe.endsWith(N, "{}")) - N = n ? N : N.slice(0, -2), M = JSON.stringify(M); - else if (Oe.isArray(M) && dX(M) || (Oe.isFileList(M) || Oe.endsWith(N, "[]")) && (B = Oe.toArray(M))) - return N = AS(N), B.forEach(function(H, U) { - !(Oe.isUndefined(H) || H === null) && e.append( + return Oe.isArrayBuffer(P) || Oe.isTypedArray(P) ? u && typeof Blob == "function" ? new Blob([P]) : Buffer.from(P) : P; + } + function d(P, O, L) { + let B = P; + if (P && !L && typeof P == "object") { + if (Oe.endsWith(O, "{}")) + O = n ? O : O.slice(0, -2), P = JSON.stringify(P); + else if (Oe.isArray(P) && KX(P) || (Oe.isFileList(P) || Oe.endsWith(O, "[]")) && (B = Oe.toArray(P))) + return O = QS(O), B.forEach(function(q, U) { + !(Oe.isUndefined(q) || q === null) && e.append( // eslint-disable-next-line no-nested-ternary - o === !0 ? N6([N], U, s) : o === null ? N : N + "[]", - l(H) + o === !0 ? J_([O], U, s) : o === null ? O : O + "[]", + l(q) ); }), !1; } - return K1(M) ? !0 : (e.append(N6(L, N, s), l(M)), !1); + return cv(P) ? !0 : (e.append(J_(L, O, s), l(P)), !1); } - const p = [], w = Object.assign(pX, { + const p = [], w = Object.assign(VX, { defaultVisitor: d, convertValue: l, - isVisitable: K1 + isVisitable: cv }); - function A(M, N) { - if (!Oe.isUndefined(M)) { - if (p.indexOf(M) !== -1) - throw Error("Circular reference detected in " + N.join(".")); - p.push(M), Oe.forEach(M, function(B, $) { + function _(P, O) { + if (!Oe.isUndefined(P)) { + if (p.indexOf(P) !== -1) + throw Error("Circular reference detected in " + O.join(".")); + p.push(P), Oe.forEach(P, function(B, k) { (!(Oe.isUndefined(B) || B === null) && i.call( e, B, - Oe.isString($) ? $.trim() : $, - N, + Oe.isString(k) ? k.trim() : k, + O, w - )) === !0 && A(B, N ? N.concat($) : [$]); + )) === !0 && _(B, O ? O.concat(k) : [k]); }), p.pop(); } } if (!Oe.isObject(t)) throw new TypeError("data must be an object"); - return A(t), e; + return _(t), e; } -function L6(t) { +function X_(t) { const e = { "!": "%21", "'": "%27", @@ -29392,40 +29904,40 @@ function L6(t) { return e[n]; }); } -function Pb(t, e) { - this._pairs = [], t && dp(t, this, e); +function jb(t, e) { + this._pairs = [], t && Mp(t, this, e); } -const PS = Pb.prototype; -PS.append = function(e, r) { +const e7 = jb.prototype; +e7.append = function(e, r) { this._pairs.push([e, r]); }; -PS.toString = function(e) { +e7.toString = function(e) { const r = e ? function(n) { - return e.call(this, n, L6); - } : L6; + return e.call(this, n, X_); + } : X_; return this._pairs.map(function(i) { return r(i[0]) + "=" + r(i[1]); }, "").join("&"); }; -function gX(t) { +function GX(t) { return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]"); } -function MS(t, e, r) { +function t7(t, e, r) { if (!e) return t; - const n = r && r.encode || gX; + const n = r && r.encode || GX; Oe.isFunction(r) && (r = { serialize: r }); const i = r && r.serialize; let s; - if (i ? s = i(e, r) : s = Oe.isURLSearchParams(e) ? e.toString() : new Pb(e, r).toString(n), s) { + if (i ? s = i(e, r) : s = Oe.isURLSearchParams(e) ? e.toString() : new jb(e, r).toString(n), s) { const o = t.indexOf("#"); o !== -1 && (t = t.slice(0, o)), t += (t.indexOf("?") === -1 ? "?" : "&") + s; } return t; } -class k6 { +class Z_ { constructor() { this.handlers = []; } @@ -29479,41 +29991,41 @@ class k6 { }); } } -const IS = { +const r7 = { silentJSONParsing: !0, forcedJSONParsing: !0, clarifyTimeoutError: !1 -}, mX = typeof URLSearchParams < "u" ? URLSearchParams : Pb, vX = typeof FormData < "u" ? FormData : null, bX = typeof Blob < "u" ? Blob : null, yX = { +}, YX = typeof URLSearchParams < "u" ? URLSearchParams : jb, JX = typeof FormData < "u" ? FormData : null, XX = typeof Blob < "u" ? Blob : null, ZX = { isBrowser: !0, classes: { - URLSearchParams: mX, - FormData: vX, - Blob: bX + URLSearchParams: YX, + FormData: JX, + Blob: XX }, protocols: ["http", "https", "file", "blob", "url", "data"] -}, Mb = typeof window < "u" && typeof document < "u", V1 = typeof navigator == "object" && navigator || void 0, wX = Mb && (!V1 || ["ReactNative", "NativeScript", "NS"].indexOf(V1.product) < 0), xX = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef -self instanceof WorkerGlobalScope && typeof self.importScripts == "function", _X = Mb && window.location.href || "http://localhost", EX = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}, Ub = typeof window < "u" && typeof document < "u", uv = typeof navigator == "object" && navigator || void 0, QX = Ub && (!uv || ["ReactNative", "NativeScript", "NS"].indexOf(uv.product) < 0), eZ = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef +self instanceof WorkerGlobalScope && typeof self.importScripts == "function", tZ = Ub && window.location.href || "http://localhost", rZ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - hasBrowserEnv: Mb, - hasStandardBrowserEnv: wX, - hasStandardBrowserWebWorkerEnv: xX, - navigator: V1, - origin: _X + hasBrowserEnv: Ub, + hasStandardBrowserEnv: QX, + hasStandardBrowserWebWorkerEnv: eZ, + navigator: uv, + origin: tZ }, Symbol.toStringTag, { value: "Module" })), Jn = { - ...EX, - ...yX + ...rZ, + ...ZX }; -function SX(t, e) { - return dp(t, new Jn.classes.URLSearchParams(), Object.assign({ +function nZ(t, e) { + return Mp(t, new Jn.classes.URLSearchParams(), Object.assign({ visitor: function(r, n, i, s) { return Jn.isNode && Oe.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : s.defaultVisitor.apply(this, arguments); } }, e)); } -function AX(t) { +function iZ(t) { return Oe.matchAll(/\w+|\[(\w*)]/g, t).map((e) => e[0] === "[]" ? "" : e[1] || e[0]); } -function PX(t) { +function sZ(t) { const e = {}, r = Object.keys(t); let n; const i = r.length; @@ -29522,22 +30034,22 @@ function PX(t) { s = r[n], e[s] = t[s]; return e; } -function CS(t) { +function n7(t) { function e(r, n, i, s) { let o = r[s++]; if (o === "__proto__") return !0; const a = Number.isFinite(+o), u = s >= r.length; - return o = !o && Oe.isArray(i) ? i.length : o, u ? (Oe.hasOwnProp(i, o) ? i[o] = [i[o], n] : i[o] = n, !a) : ((!i[o] || !Oe.isObject(i[o])) && (i[o] = []), e(r, n, i[o], s) && Oe.isArray(i[o]) && (i[o] = PX(i[o])), !a); + return o = !o && Oe.isArray(i) ? i.length : o, u ? (Oe.hasOwnProp(i, o) ? i[o] = [i[o], n] : i[o] = n, !a) : ((!i[o] || !Oe.isObject(i[o])) && (i[o] = []), e(r, n, i[o], s) && Oe.isArray(i[o]) && (i[o] = sZ(i[o])), !a); } if (Oe.isFormData(t) && Oe.isFunction(t.entries)) { const r = {}; return Oe.forEachEntry(t, (n, i) => { - e(AX(n), i, r, 0); + e(iZ(n), i, r, 0); }), r; } return null; } -function MX(t, e, r) { +function oZ(t, e, r) { if (Oe.isString(t)) try { return (e || JSON.parse)(t), Oe.trim(t); @@ -29547,13 +30059,13 @@ function MX(t, e, r) { } return (r || JSON.stringify)(t); } -const oh = { - transitional: IS, +const gh = { + transitional: r7, adapter: ["xhr", "http", "fetch"], transformRequest: [function(e, r) { const n = r.getContentType() || "", i = n.indexOf("application/json") > -1, s = Oe.isObject(e); if (s && Oe.isHTMLForm(e) && (e = new FormData(e)), Oe.isFormData(e)) - return i ? JSON.stringify(CS(e)) : e; + return i ? JSON.stringify(n7(e)) : e; if (Oe.isArrayBuffer(e) || Oe.isBuffer(e) || Oe.isStream(e) || Oe.isFile(e) || Oe.isBlob(e) || Oe.isReadableStream(e)) return e; if (Oe.isArrayBufferView(e)) @@ -29563,20 +30075,20 @@ const oh = { let a; if (s) { if (n.indexOf("application/x-www-form-urlencoded") > -1) - return SX(e, this.formSerializer).toString(); + return nZ(e, this.formSerializer).toString(); if ((a = Oe.isFileList(e)) || n.indexOf("multipart/form-data") > -1) { const u = this.env && this.env.FormData; - return dp( + return Mp( a ? { "files[]": e } : e, u && new u(), this.formSerializer ); } } - return s || i ? (r.setContentType("application/json", !1), MX(e)) : e; + return s || i ? (r.setContentType("application/json", !1), oZ(e)) : e; }], transformResponse: [function(e) { - const r = this.transitional || oh.transitional, n = r && r.forcedJSONParsing, i = this.responseType === "json"; + const r = this.transitional || gh.transitional, n = r && r.forcedJSONParsing, i = this.responseType === "json"; if (Oe.isResponse(e) || Oe.isReadableStream(e)) return e; if (e && Oe.isString(e) && (n && !this.responseType || i)) { @@ -29614,9 +30126,9 @@ const oh = { } }; Oe.forEach(["delete", "get", "head", "post", "put", "patch"], (t) => { - oh.headers[t] = {}; + gh.headers[t] = {}; }); -const IX = Oe.toObjectSet([ +const aZ = Oe.toObjectSet([ "age", "authorization", "content-length", @@ -29634,29 +30146,29 @@ const IX = Oe.toObjectSet([ "referer", "retry-after", "user-agent" -]), CX = (t) => { +]), cZ = (t) => { const e = {}; let r, n, i; return t && t.split(` `).forEach(function(o) { - i = o.indexOf(":"), r = o.substring(0, i).trim().toLowerCase(), n = o.substring(i + 1).trim(), !(!r || e[r] && IX[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n); + i = o.indexOf(":"), r = o.substring(0, i).trim().toLowerCase(), n = o.substring(i + 1).trim(), !(!r || e[r] && aZ[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n); }), e; -}, $6 = Symbol("internals"); -function Df(t) { +}, Q_ = Symbol("internals"); +function Ff(t) { return t && String(t).trim().toLowerCase(); } -function $d(t) { - return t === !1 || t == null ? t : Oe.isArray(t) ? t.map($d) : String(t); +function Yd(t) { + return t === !1 || t == null ? t : Oe.isArray(t) ? t.map(Yd) : String(t); } -function TX(t) { +function uZ(t) { const e = /* @__PURE__ */ Object.create(null), r = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; let n; for (; n = r.exec(t); ) e[n[1]] = n[2]; return e; } -const RX = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()); -function Cm(t, e, r, n, i) { +const fZ = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()); +function zm(t, e, r, n, i) { if (Oe.isFunction(n)) return n.call(this, e, r); if (i && (e = r), !!Oe.isString(e)) { @@ -29666,10 +30178,10 @@ function Cm(t, e, r, n, i) { return n.test(e); } } -function DX(t) { +function lZ(t) { return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, r, n) => r.toUpperCase() + n); } -function OX(t, e) { +function hZ(t, e) { const r = Oe.toCamelCase(" " + e); ["get", "set", "has"].forEach((n) => { Object.defineProperty(t, n + r, { @@ -29687,17 +30199,17 @@ let yi = class { set(e, r, n) { const i = this; function s(a, u, l) { - const d = Df(u); + const d = Ff(u); if (!d) throw new Error("header name must be a non-empty string"); const p = Oe.findKey(i, d); - (!p || i[p] === void 0 || l === !0 || l === void 0 && i[p] !== !1) && (i[p || u] = $d(a)); + (!p || i[p] === void 0 || l === !0 || l === void 0 && i[p] !== !1) && (i[p || u] = Yd(a)); } const o = (a, u) => Oe.forEach(a, (l, d) => s(l, d, u)); if (Oe.isPlainObject(e) || e instanceof this.constructor) o(e, r); - else if (Oe.isString(e) && (e = e.trim()) && !RX(e)) - o(CX(e), r); + else if (Oe.isString(e) && (e = e.trim()) && !fZ(e)) + o(cZ(e), r); else if (Oe.isHeaders(e)) for (const [a, u] of e.entries()) s(u, a, n); @@ -29706,14 +30218,14 @@ let yi = class { return this; } get(e, r) { - if (e = Df(e), e) { + if (e = Ff(e), e) { const n = Oe.findKey(this, e); if (n) { const i = this[n]; if (!r) return i; if (r === !0) - return TX(i); + return uZ(i); if (Oe.isFunction(r)) return r.call(this, i, n); if (Oe.isRegExp(r)) @@ -29723,9 +30235,9 @@ let yi = class { } } has(e, r) { - if (e = Df(e), e) { + if (e = Ff(e), e) { const n = Oe.findKey(this, e); - return !!(n && this[n] !== void 0 && (!r || Cm(this, this[n], n, r))); + return !!(n && this[n] !== void 0 && (!r || zm(this, this[n], n, r))); } return !1; } @@ -29733,9 +30245,9 @@ let yi = class { const n = this; let i = !1; function s(o) { - if (o = Df(o), o) { + if (o = Ff(o), o) { const a = Oe.findKey(n, o); - a && (!r || Cm(n, n[a], a, r)) && (delete n[a], i = !0); + a && (!r || zm(n, n[a], a, r)) && (delete n[a], i = !0); } } return Oe.isArray(e) ? e.forEach(s) : s(e), i; @@ -29745,7 +30257,7 @@ let yi = class { let n = r.length, i = !1; for (; n--; ) { const s = r[n]; - (!e || Cm(this, this[s], s, e, !0)) && (delete this[s], i = !0); + (!e || zm(this, this[s], s, e, !0)) && (delete this[s], i = !0); } return i; } @@ -29754,11 +30266,11 @@ let yi = class { return Oe.forEach(this, (i, s) => { const o = Oe.findKey(n, s); if (o) { - r[o] = $d(i), delete r[s]; + r[o] = Yd(i), delete r[s]; return; } - const a = e ? DX(s) : String(s).trim(); - a !== s && delete r[s], r[a] = $d(i), n[a] = !0; + const a = e ? lZ(s) : String(s).trim(); + a !== s && delete r[s], r[a] = Yd(i), n[a] = !0; }), this; } concat(...e) { @@ -29788,12 +30300,12 @@ let yi = class { return r.forEach((i) => n.set(i)), n; } static accessor(e) { - const n = (this[$6] = this[$6] = { + const n = (this[Q_] = this[Q_] = { accessors: {} }).accessors, i = this.prototype; function s(o) { - const a = Df(o); - n[a] || (OX(i, o), n[a] = !0); + const a = Ff(o); + n[a] || (hZ(i, o), n[a] = !0); } return Oe.isArray(e) ? e.forEach(s) : s(e), this; } @@ -29809,23 +30321,23 @@ Oe.reduceDescriptors(yi.prototype, ({ value: t }, e) => { }; }); Oe.freezeMethods(yi); -function Tm(t, e) { - const r = this || oh, n = e || r, i = yi.from(n.headers); +function Wm(t, e) { + const r = this || gh, n = e || r, i = yi.from(n.headers); let s = n.data; return Oe.forEach(t, function(a) { s = a.call(r, s, i.normalize(), e ? e.status : void 0); }), i.normalize(), s; } -function TS(t) { +function i7(t) { return !!(t && t.__CANCEL__); } -function Hu(t, e, r) { +function Zu(t, e, r) { or.call(this, t ?? "canceled", or.ERR_CANCELED, e, r), this.name = "CanceledError"; } -Oe.inherits(Hu, or, { +Oe.inherits(Zu, or, { __CANCEL__: !0 }); -function RS(t, e, r) { +function s7(t, e, r) { const n = r.config.validateStatus; !r.status || !n || n(r.status) ? t(r) : e(new or( "Request failed with status code " + r.status, @@ -29835,11 +30347,11 @@ function RS(t, e, r) { r )); } -function NX(t) { +function dZ(t) { const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(t); return e && e[1] || ""; } -function LX(t, e) { +function pZ(t, e) { t = t || 10; const r = new Array(t), n = new Array(t); let i = 0, s = 0, o; @@ -29851,11 +30363,11 @@ function LX(t, e) { w += r[p++], p = p % t; if (i = (i + 1) % t, i === s && (s = (s + 1) % t), l - o < e) return; - const A = d && l - d; - return A ? Math.round(w * 1e3 / A) : void 0; + const _ = d && l - d; + return _ ? Math.round(w * 1e3 / _) : void 0; }; } -function kX(t, e) { +function gZ(t, e) { let r = 0, n = 1e3 / e, i, s; const o = (l, d = Date.now()) => { r = d, i = null, s && (clearTimeout(s), s = null), t.apply(null, l); @@ -29867,10 +30379,10 @@ function kX(t, e) { }, n - p))); }, () => i && o(i)]; } -const g0 = (t, e, r = 3) => { +const M0 = (t, e, r = 3) => { let n = 0; - const i = LX(50, 250); - return kX((s) => { + const i = pZ(50, 250); + return gZ((s) => { const o = s.loaded, a = s.lengthComputable ? s.total : void 0, u = o - n, l = i(u), d = o <= a; n = o; const p = { @@ -29886,17 +30398,17 @@ const g0 = (t, e, r = 3) => { }; t(p); }, r); -}, B6 = (t, e) => { +}, e6 = (t, e) => { const r = t != null; return [(n) => e[0]({ lengthComputable: r, total: t, loaded: n }), e[1]]; -}, F6 = (t) => (...e) => Oe.asap(() => t(...e)), $X = Jn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Jn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( +}, t6 = (t) => (...e) => Oe.asap(() => t(...e)), mZ = Jn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Jn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( new URL(Jn.origin), Jn.navigator && /(msie|trident)/i.test(Jn.navigator.userAgent) -) : () => !0, BX = Jn.hasStandardBrowserEnv ? ( +) : () => !0, vZ = Jn.hasStandardBrowserEnv ? ( // Standard browser envs support document.cookie { write(t, e, r, n, i, s) { @@ -29923,17 +30435,17 @@ const g0 = (t, e, r = 3) => { } } ); -function FX(t) { +function bZ(t) { return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t); } -function jX(t, e) { +function yZ(t, e) { return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t; } -function DS(t, e) { - return t && !FX(e) ? jX(t, e) : e; +function o7(t, e) { + return t && !bZ(e) ? yZ(t, e) : e; } -const j6 = (t) => t instanceof yi ? { ...t } : t; -function gc(t, e) { +const r6 = (t) => t instanceof yi ? { ...t } : t; +function Ec(t, e) { e = e || {}; const r = {}; function n(l, d, p, w) { @@ -29990,17 +30502,17 @@ function gc(t, e) { socketPath: o, responseEncoding: o, validateStatus: a, - headers: (l, d, p) => i(j6(l), j6(d), p, !0) + headers: (l, d, p) => i(r6(l), r6(d), p, !0) }; return Oe.forEach(Object.keys(Object.assign({}, t, e)), function(d) { const p = u[d] || i, w = p(t[d], e[d], d); Oe.isUndefined(w) && p !== a || (r[d] = w); }), r; } -const OS = (t) => { - const e = gc({}, t); +const a7 = (t) => { + const e = Ec({}, t); let { data: r, withXSRFToken: n, xsrfHeaderName: i, xsrfCookieName: s, headers: o, auth: a } = e; - e.headers = o = yi.from(o), e.url = MS(DS(e.baseURL, e.url), t.params, t.paramsSerializer), a && o.set( + e.headers = o = yi.from(o), e.url = t7(o7(e.baseURL, e.url), t.params, t.paramsSerializer), a && o.set( "Authorization", "Basic " + btoa((a.username || "") + ":" + (a.password ? unescape(encodeURIComponent(a.password)) : "")) ); @@ -30013,39 +30525,39 @@ const OS = (t) => { o.setContentType([l || "multipart/form-data", ...d].join("; ")); } } - if (Jn.hasStandardBrowserEnv && (n && Oe.isFunction(n) && (n = n(e)), n || n !== !1 && $X(e.url))) { - const l = i && s && BX.read(s); + if (Jn.hasStandardBrowserEnv && (n && Oe.isFunction(n) && (n = n(e)), n || n !== !1 && mZ(e.url))) { + const l = i && s && vZ.read(s); l && o.set(i, l); } return e; -}, UX = typeof XMLHttpRequest < "u", qX = UX && function(t) { +}, wZ = typeof XMLHttpRequest < "u", xZ = wZ && function(t) { return new Promise(function(r, n) { - const i = OS(t); + const i = a7(t); let s = i.data; const o = yi.from(i.headers).normalize(); - let { responseType: a, onUploadProgress: u, onDownloadProgress: l } = i, d, p, w, A, M; - function N() { - A && A(), M && M(), i.cancelToken && i.cancelToken.unsubscribe(d), i.signal && i.signal.removeEventListener("abort", d); + let { responseType: a, onUploadProgress: u, onDownloadProgress: l } = i, d, p, w, _, P; + function O() { + _ && _(), P && P(), i.cancelToken && i.cancelToken.unsubscribe(d), i.signal && i.signal.removeEventListener("abort", d); } let L = new XMLHttpRequest(); L.open(i.method.toUpperCase(), i.url, !0), L.timeout = i.timeout; function B() { if (!L) return; - const H = yi.from( + const q = yi.from( "getAllResponseHeaders" in L && L.getAllResponseHeaders() ), V = { data: !a || a === "text" || a === "json" ? L.responseText : L.response, status: L.status, statusText: L.statusText, - headers: H, + headers: q, config: t, request: L }; - RS(function(R) { - r(R), N(); + s7(function(R) { + r(R), O(); }, function(R) { - n(R), N(); + n(R), O(); }, V), L = null; } "onloadend" in L ? L.onloadend = B : L.onreadystatechange = function() { @@ -30056,7 +30568,7 @@ const OS = (t) => { n(new or("Network Error", or.ERR_NETWORK, t, L)), L = null; }, L.ontimeout = function() { let U = i.timeout ? "timeout of " + i.timeout + "ms exceeded" : "timeout exceeded"; - const V = i.transitional || IS; + const V = i.transitional || r7; i.timeoutErrorMessage && (U = i.timeoutErrorMessage), n(new or( U, V.clarifyTimeoutError ? or.ETIMEDOUT : or.ECONNABORTED, @@ -30065,17 +30577,17 @@ const OS = (t) => { )), L = null; }, s === void 0 && o.setContentType(null), "setRequestHeader" in L && Oe.forEach(o.toJSON(), function(U, V) { L.setRequestHeader(V, U); - }), Oe.isUndefined(i.withCredentials) || (L.withCredentials = !!i.withCredentials), a && a !== "json" && (L.responseType = i.responseType), l && ([w, M] = g0(l, !0), L.addEventListener("progress", w)), u && L.upload && ([p, A] = g0(u), L.upload.addEventListener("progress", p), L.upload.addEventListener("loadend", A)), (i.cancelToken || i.signal) && (d = (H) => { - L && (n(!H || H.type ? new Hu(null, t, L) : H), L.abort(), L = null); + }), Oe.isUndefined(i.withCredentials) || (L.withCredentials = !!i.withCredentials), a && a !== "json" && (L.responseType = i.responseType), l && ([w, P] = M0(l, !0), L.addEventListener("progress", w)), u && L.upload && ([p, _] = M0(u), L.upload.addEventListener("progress", p), L.upload.addEventListener("loadend", _)), (i.cancelToken || i.signal) && (d = (q) => { + L && (n(!q || q.type ? new Zu(null, t, L) : q), L.abort(), L = null); }, i.cancelToken && i.cancelToken.subscribe(d), i.signal && (i.signal.aborted ? d() : i.signal.addEventListener("abort", d))); - const $ = NX(i.url); - if ($ && Jn.protocols.indexOf($) === -1) { - n(new or("Unsupported protocol " + $ + ":", or.ERR_BAD_REQUEST, t)); + const k = dZ(i.url); + if (k && Jn.protocols.indexOf(k) === -1) { + n(new or("Unsupported protocol " + k + ":", or.ERR_BAD_REQUEST, t)); return; } L.send(s || null); }); -}, zX = (t, e) => { +}, _Z = (t, e) => { const { length: r } = t = t ? t.filter(Boolean) : []; if (e || r) { let n = new AbortController(), i; @@ -30083,7 +30595,7 @@ const OS = (t) => { if (!i) { i = !0, a(); const d = l instanceof Error ? l : this.reason; - n.abort(d instanceof or ? d : new Hu(d instanceof Error ? d.message : d)); + n.abort(d instanceof or ? d : new Zu(d instanceof Error ? d.message : d)); } }; let o = e && setTimeout(() => { @@ -30098,7 +30610,7 @@ const OS = (t) => { const { signal: u } = n; return u.unsubscribe = () => Oe.asap(a), u; } -}, WX = function* (t, e) { +}, EZ = function* (t, e) { let r = t.byteLength; if (r < e) { yield t; @@ -30107,10 +30619,10 @@ const OS = (t) => { let n = 0, i; for (; n < r; ) i = n + e, yield t.slice(n, i), n = i; -}, HX = async function* (t, e) { - for await (const r of KX(t)) - yield* WX(r, e); -}, KX = async function* (t) { +}, SZ = async function* (t, e) { + for await (const r of AZ(t)) + yield* EZ(r, e); +}, AZ = async function* (t) { if (t[Symbol.asyncIterator]) { yield* t; return; @@ -30126,8 +30638,8 @@ const OS = (t) => { } finally { await e.cancel(); } -}, U6 = (t, e, r, n) => { - const i = HX(t, e); +}, n6 = (t, e, r, n) => { + const i = SZ(t, e); let s = 0, o, a = (u) => { o || (o = !0, n && n(u)); }; @@ -30155,13 +30667,13 @@ const OS = (t) => { }, { highWaterMark: 2 }); -}, pp = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", NS = pp && typeof ReadableStream == "function", VX = pp && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), LS = (t, ...e) => { +}, Ip = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", c7 = Ip && typeof ReadableStream == "function", PZ = Ip && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), u7 = (t, ...e) => { try { return !!t(...e); } catch { return !1; } -}, GX = NS && LS(() => { +}, MZ = c7 && u7(() => { let t = !1; const e = new Request(Jn.origin, { body: new ReadableStream(), @@ -30171,17 +30683,17 @@ const OS = (t) => { } }).headers.has("Content-Type"); return t && !e; -}), q6 = 64 * 1024, G1 = NS && LS(() => Oe.isReadableStream(new Response("").body)), m0 = { - stream: G1 && ((t) => t.body) +}), i6 = 64 * 1024, fv = c7 && u7(() => Oe.isReadableStream(new Response("").body)), I0 = { + stream: fv && ((t) => t.body) }; -pp && ((t) => { +Ip && ((t) => { ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => { - !m0[e] && (m0[e] = Oe.isFunction(t[e]) ? (r) => r[e]() : (r, n) => { + !I0[e] && (I0[e] = Oe.isFunction(t[e]) ? (r) => r[e]() : (r, n) => { throw new or(`Response type '${e}' is not supported`, or.ERR_NOT_SUPPORT, n); }); }); })(new Response()); -const YX = async (t) => { +const IZ = async (t) => { if (t == null) return 0; if (Oe.isBlob(t)) @@ -30194,11 +30706,11 @@ const YX = async (t) => { if (Oe.isArrayBufferView(t) || Oe.isArrayBuffer(t)) return t.byteLength; if (Oe.isURLSearchParams(t) && (t = t + ""), Oe.isString(t)) - return (await VX(t)).byteLength; -}, JX = async (t, e) => { + return (await PZ(t)).byteLength; +}, CZ = async (t, e) => { const r = Oe.toFiniteNumber(t.getContentLength()); - return r ?? YX(e); -}, XX = pp && (async (t) => { + return r ?? IZ(e); +}, TZ = Ip && (async (t) => { let { url: e, method: r, @@ -30212,83 +30724,83 @@ const YX = async (t) => { headers: d, withCredentials: p = "same-origin", fetchOptions: w - } = OS(t); + } = a7(t); l = l ? (l + "").toLowerCase() : "text"; - let A = zX([i, s && s.toAbortSignal()], o), M; - const N = A && A.unsubscribe && (() => { - A.unsubscribe(); + let _ = _Z([i, s && s.toAbortSignal()], o), P; + const O = _ && _.unsubscribe && (() => { + _.unsubscribe(); }); let L; try { - if (u && GX && r !== "get" && r !== "head" && (L = await JX(d, n)) !== 0) { + if (u && MZ && r !== "get" && r !== "head" && (L = await CZ(d, n)) !== 0) { let V = new Request(e, { method: "POST", body: n, duplex: "half" - }), te; - if (Oe.isFormData(n) && (te = V.headers.get("content-type")) && d.setContentType(te), V.body) { - const [R, K] = B6( + }), Q; + if (Oe.isFormData(n) && (Q = V.headers.get("content-type")) && d.setContentType(Q), V.body) { + const [R, K] = e6( L, - g0(F6(u)) + M0(t6(u)) ); - n = U6(V.body, q6, R, K); + n = n6(V.body, i6, R, K); } } Oe.isString(p) || (p = p ? "include" : "omit"); const B = "credentials" in Request.prototype; - M = new Request(e, { + P = new Request(e, { ...w, - signal: A, + signal: _, method: r.toUpperCase(), headers: d.normalize().toJSON(), body: n, duplex: "half", credentials: B ? p : void 0 }); - let $ = await fetch(M); - const H = G1 && (l === "stream" || l === "response"); - if (G1 && (a || H && N)) { + let k = await fetch(P); + const q = fv && (l === "stream" || l === "response"); + if (fv && (a || q && O)) { const V = {}; ["status", "statusText", "headers"].forEach((ge) => { - V[ge] = $[ge]; + V[ge] = k[ge]; }); - const te = Oe.toFiniteNumber($.headers.get("content-length")), [R, K] = a && B6( - te, - g0(F6(a), !0) + const Q = Oe.toFiniteNumber(k.headers.get("content-length")), [R, K] = a && e6( + Q, + M0(t6(a), !0) ) || []; - $ = new Response( - U6($.body, q6, R, () => { - K && K(), N && N(); + k = new Response( + n6(k.body, i6, R, () => { + K && K(), O && O(); }), V ); } l = l || "text"; - let U = await m0[Oe.findKey(m0, l) || "text"]($, t); - return !H && N && N(), await new Promise((V, te) => { - RS(V, te, { + let U = await I0[Oe.findKey(I0, l) || "text"](k, t); + return !q && O && O(), await new Promise((V, Q) => { + s7(V, Q, { data: U, - headers: yi.from($.headers), - status: $.status, - statusText: $.statusText, + headers: yi.from(k.headers), + status: k.status, + statusText: k.statusText, config: t, - request: M + request: P }); }); } catch (B) { - throw N && N(), B && B.name === "TypeError" && /fetch/i.test(B.message) ? Object.assign( - new or("Network Error", or.ERR_NETWORK, t, M), + throw O && O(), B && B.name === "TypeError" && /fetch/i.test(B.message) ? Object.assign( + new or("Network Error", or.ERR_NETWORK, t, P), { cause: B.cause || B } - ) : or.from(B, B && B.code, t, M); + ) : or.from(B, B && B.code, t, P); } -}), Y1 = { - http: hX, - xhr: qX, - fetch: XX +}), lv = { + http: HX, + xhr: xZ, + fetch: TZ }; -Oe.forEach(Y1, (t, e) => { +Oe.forEach(lv, (t, e) => { if (t) { try { Object.defineProperty(t, "name", { value: e }); @@ -30297,7 +30809,7 @@ Oe.forEach(Y1, (t, e) => { Object.defineProperty(t, "adapterName", { value: e }); } }); -const z6 = (t) => `- ${t}`, ZX = (t) => Oe.isFunction(t) || t === null || t === !1, kS = { +const s6 = (t) => `- ${t}`, RZ = (t) => Oe.isFunction(t) || t === null || t === !1, f7 = { getAdapter: (t) => { t = Oe.isArray(t) ? t : [t]; const { length: e } = t; @@ -30306,7 +30818,7 @@ const z6 = (t) => `- ${t}`, ZX = (t) => Oe.isFunction(t) || t === null || t === for (let s = 0; s < e; s++) { r = t[s]; let o; - if (n = r, !ZX(r) && (n = Y1[(o = String(r)).toLowerCase()], n === void 0)) + if (n = r, !RZ(r) && (n = lv[(o = String(r)).toLowerCase()], n === void 0)) throw new or(`Unknown adapter '${o}'`); if (n) break; @@ -30317,8 +30829,8 @@ const z6 = (t) => `- ${t}`, ZX = (t) => Oe.isFunction(t) || t === null || t === ([a, u]) => `adapter ${a} ` + (u === !1 ? "is not supported by the environment" : "is not available in the build") ); let o = e ? s.length > 1 ? `since : -` + s.map(z6).join(` -`) : " " + z6(s[0]) : "as no adapter specified"; +` + s.map(s6).join(` +`) : " " + s6(s[0]) : "as no adapter specified"; throw new or( "There is no suitable adapter to dispatch the request " + o, "ERR_NOT_SUPPORT" @@ -30326,40 +30838,40 @@ const z6 = (t) => `- ${t}`, ZX = (t) => Oe.isFunction(t) || t === null || t === } return n; }, - adapters: Y1 + adapters: lv }; -function Rm(t) { +function Hm(t) { if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted) - throw new Hu(null, t); + throw new Zu(null, t); } -function W6(t) { - return Rm(t), t.headers = yi.from(t.headers), t.data = Tm.call( +function o6(t) { + return Hm(t), t.headers = yi.from(t.headers), t.data = Wm.call( t, t.transformRequest - ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), kS.getAdapter(t.adapter || oh.adapter)(t).then(function(n) { - return Rm(t), n.data = Tm.call( + ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), f7.getAdapter(t.adapter || gh.adapter)(t).then(function(n) { + return Hm(t), n.data = Wm.call( t, t.transformResponse, n ), n.headers = yi.from(n.headers), n; }, function(n) { - return TS(n) || (Rm(t), n && n.response && (n.response.data = Tm.call( + return i7(n) || (Hm(t), n && n.response && (n.response.data = Wm.call( t, t.transformResponse, n.response ), n.response.headers = yi.from(n.response.headers))), Promise.reject(n); }); } -const $S = "1.7.8", gp = {}; +const l7 = "1.7.8", Cp = {}; ["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => { - gp[t] = function(n) { + Cp[t] = function(n) { return typeof n === t || "a" + (e < 1 ? "n " : " ") + t; }; }); -const H6 = {}; -gp.transitional = function(e, r, n) { +const a6 = {}; +Cp.transitional = function(e, r, n) { function i(s, o) { - return "[Axios v" + $S + "] Transitional option '" + s + "'" + o + (n ? ". " + n : ""); + return "[Axios v" + l7 + "] Transitional option '" + s + "'" + o + (n ? ". " + n : ""); } return (s, o, a) => { if (e === !1) @@ -30367,7 +30879,7 @@ gp.transitional = function(e, r, n) { i(o, " has been removed" + (r ? " in " + r : "")), or.ERR_DEPRECATED ); - return r && !H6[o] && (H6[o] = !0, console.warn( + return r && !a6[o] && (a6[o] = !0, console.warn( i( o, " has been deprecated since v" + r + " and will be removed in the near future" @@ -30375,10 +30887,10 @@ gp.transitional = function(e, r, n) { )), e ? e(s, o, a) : !0; }; }; -gp.spelling = function(e) { +Cp.spelling = function(e) { return (r, n) => (console.warn(`${n} is likely a misspelling of ${e}`), !0); }; -function QX(t, e, r) { +function DZ(t, e, r) { if (typeof t != "object") throw new or("options must be an object", or.ERR_BAD_OPTION_VALUE); const n = Object.keys(t); @@ -30395,15 +30907,15 @@ function QX(t, e, r) { throw new or("Unknown option " + s, or.ERR_BAD_OPTION); } } -const Bd = { - assertOptions: QX, - validators: gp -}, Bs = Bd.validators; -let ac = class { +const Jd = { + assertOptions: DZ, + validators: Cp +}, Us = Jd.validators; +let pc = class { constructor(e) { this.defaults = e, this.interceptors = { - request: new k6(), - response: new k6() + request: new Z_(), + response: new Z_() }; } /** @@ -30432,20 +30944,20 @@ let ac = class { } } _request(e, r) { - typeof e == "string" ? (r = r || {}, r.url = e) : r = e || {}, r = gc(this.defaults, r); + typeof e == "string" ? (r = r || {}, r.url = e) : r = e || {}, r = Ec(this.defaults, r); const { transitional: n, paramsSerializer: i, headers: s } = r; - n !== void 0 && Bd.assertOptions(n, { - silentJSONParsing: Bs.transitional(Bs.boolean), - forcedJSONParsing: Bs.transitional(Bs.boolean), - clarifyTimeoutError: Bs.transitional(Bs.boolean) + n !== void 0 && Jd.assertOptions(n, { + silentJSONParsing: Us.transitional(Us.boolean), + forcedJSONParsing: Us.transitional(Us.boolean), + clarifyTimeoutError: Us.transitional(Us.boolean) }, !1), i != null && (Oe.isFunction(i) ? r.paramsSerializer = { serialize: i - } : Bd.assertOptions(i, { - encode: Bs.function, - serialize: Bs.function - }, !0)), Bd.assertOptions(r, { - baseUrl: Bs.spelling("baseURL"), - withXsrfToken: Bs.spelling("withXSRFToken") + } : Jd.assertOptions(i, { + encode: Us.function, + serialize: Us.function + }, !0)), Jd.assertOptions(r, { + baseUrl: Us.spelling("baseURL"), + withXsrfToken: Us.spelling("withXSRFToken") }, !0), r.method = (r.method || this.defaults.method || "get").toLowerCase(); let o = s && Oe.merge( s.common, @@ -30453,55 +30965,55 @@ let ac = class { ); s && Oe.forEach( ["delete", "get", "head", "post", "put", "patch", "common"], - (M) => { - delete s[M]; + (P) => { + delete s[P]; } ), r.headers = yi.concat(o, s); const a = []; let u = !0; - this.interceptors.request.forEach(function(N) { - typeof N.runWhen == "function" && N.runWhen(r) === !1 || (u = u && N.synchronous, a.unshift(N.fulfilled, N.rejected)); + this.interceptors.request.forEach(function(O) { + typeof O.runWhen == "function" && O.runWhen(r) === !1 || (u = u && O.synchronous, a.unshift(O.fulfilled, O.rejected)); }); const l = []; - this.interceptors.response.forEach(function(N) { - l.push(N.fulfilled, N.rejected); + this.interceptors.response.forEach(function(O) { + l.push(O.fulfilled, O.rejected); }); let d, p = 0, w; if (!u) { - const M = [W6.bind(this), void 0]; - for (M.unshift.apply(M, a), M.push.apply(M, l), w = M.length, d = Promise.resolve(r); p < w; ) - d = d.then(M[p++], M[p++]); + const P = [o6.bind(this), void 0]; + for (P.unshift.apply(P, a), P.push.apply(P, l), w = P.length, d = Promise.resolve(r); p < w; ) + d = d.then(P[p++], P[p++]); return d; } w = a.length; - let A = r; + let _ = r; for (p = 0; p < w; ) { - const M = a[p++], N = a[p++]; + const P = a[p++], O = a[p++]; try { - A = M(A); + _ = P(_); } catch (L) { - N.call(this, L); + O.call(this, L); break; } } try { - d = W6.call(this, A); - } catch (M) { - return Promise.reject(M); + d = o6.call(this, _); + } catch (P) { + return Promise.reject(P); } for (p = 0, w = l.length; p < w; ) d = d.then(l[p++], l[p++]); return d; } getUri(e) { - e = gc(this.defaults, e); - const r = DS(e.baseURL, e.url); - return MS(r, e.params, e.paramsSerializer); + e = Ec(this.defaults, e); + const r = o7(e.baseURL, e.url); + return t7(r, e.params, e.paramsSerializer); } }; Oe.forEach(["delete", "get", "head", "options"], function(e) { - ac.prototype[e] = function(r, n) { - return this.request(gc(n || {}, { + pc.prototype[e] = function(r, n) { + return this.request(Ec(n || {}, { method: e, url: r, data: (n || {}).data @@ -30511,7 +31023,7 @@ Oe.forEach(["delete", "get", "head", "options"], function(e) { Oe.forEach(["post", "put", "patch"], function(e) { function r(n) { return function(s, o, a) { - return this.request(gc(a || {}, { + return this.request(Ec(a || {}, { method: e, headers: n ? { "Content-Type": "multipart/form-data" @@ -30521,9 +31033,9 @@ Oe.forEach(["post", "put", "patch"], function(e) { })); }; } - ac.prototype[e] = r(), ac.prototype[e + "Form"] = r(!0); + pc.prototype[e] = r(), pc.prototype[e + "Form"] = r(!0); }); -let eZ = class BS { +let OZ = class h7 { constructor(e) { if (typeof e != "function") throw new TypeError("executor must be a function."); @@ -30547,7 +31059,7 @@ let eZ = class BS { n.unsubscribe(s); }, o; }, e(function(s, o, a) { - n.reason || (n.reason = new Hu(s, o, a), r(n.reason)); + n.reason || (n.reason = new Zu(s, o, a), r(n.reason)); }); } /** @@ -30589,22 +31101,22 @@ let eZ = class BS { static source() { let e; return { - token: new BS(function(i) { + token: new h7(function(i) { e = i; }), cancel: e }; } }; -function tZ(t) { +function NZ(t) { return function(r) { return t.apply(null, r); }; } -function rZ(t) { +function LZ(t) { return Oe.isObject(t) && t.isAxiosError === !0; } -const J1 = { +const hv = { Continue: 100, SwitchingProtocols: 101, Processing: 102, @@ -30669,63 +31181,63 @@ const J1 = { NotExtended: 510, NetworkAuthenticationRequired: 511 }; -Object.entries(J1).forEach(([t, e]) => { - J1[e] = t; +Object.entries(hv).forEach(([t, e]) => { + hv[e] = t; }); -function FS(t) { - const e = new ac(t), r = gS(ac.prototype.request, e); - return Oe.extend(r, ac.prototype, e, { allOwnKeys: !0 }), Oe.extend(r, e, null, { allOwnKeys: !0 }), r.create = function(i) { - return FS(gc(t, i)); +function d7(t) { + const e = new pc(t), r = zS(pc.prototype.request, e); + return Oe.extend(r, pc.prototype, e, { allOwnKeys: !0 }), Oe.extend(r, e, null, { allOwnKeys: !0 }), r.create = function(i) { + return d7(Ec(t, i)); }, r; } -const mn = FS(oh); -mn.Axios = ac; -mn.CanceledError = Hu; -mn.CancelToken = eZ; -mn.isCancel = TS; -mn.VERSION = $S; -mn.toFormData = dp; +const mn = d7(gh); +mn.Axios = pc; +mn.CanceledError = Zu; +mn.CancelToken = OZ; +mn.isCancel = i7; +mn.VERSION = l7; +mn.toFormData = Mp; mn.AxiosError = or; mn.Cancel = mn.CanceledError; mn.all = function(e) { return Promise.all(e); }; -mn.spread = tZ; -mn.isAxiosError = rZ; -mn.mergeConfig = gc; +mn.spread = NZ; +mn.isAxiosError = LZ; +mn.mergeConfig = Ec; mn.AxiosHeaders = yi; -mn.formToJSON = (t) => CS(Oe.isHTMLForm(t) ? new FormData(t) : t); -mn.getAdapter = kS.getAdapter; -mn.HttpStatusCode = J1; +mn.formToJSON = (t) => n7(Oe.isHTMLForm(t) ? new FormData(t) : t); +mn.getAdapter = f7.getAdapter; +mn.HttpStatusCode = hv; mn.default = mn; const { - Axios: ioe, - AxiosError: jS, - CanceledError: soe, - isCancel: ooe, - CancelToken: aoe, - VERSION: coe, - all: uoe, - Cancel: foe, - isAxiosError: loe, - spread: hoe, - toFormData: doe, - AxiosHeaders: poe, - HttpStatusCode: goe, - formToJSON: moe, - getAdapter: voe, - mergeConfig: boe -} = mn, US = mn.create({ + Axios: Boe, + AxiosError: p7, + CanceledError: Foe, + isCancel: joe, + CancelToken: Uoe, + VERSION: qoe, + all: zoe, + Cancel: Woe, + isAxiosError: Hoe, + spread: Koe, + toFormData: Voe, + AxiosHeaders: Goe, + HttpStatusCode: Yoe, + formToJSON: Joe, + getAdapter: Xoe, + mergeConfig: Zoe +} = mn, g7 = mn.create({ timeout: 6e4, headers: { "Content-Type": "application/json", token: localStorage.getItem("auth") } }); -function nZ(t) { +function kZ(t) { var e, r, n; if (((e = t.data) == null ? void 0 : e.success) !== !0) { - const i = new jS( + const i = new p7( (r = t.data) == null ? void 0 : r.errorMessage, (n = t.data) == null ? void 0 : n.errorCode, t.config, @@ -30736,13 +31248,13 @@ function nZ(t) { } else return t; } -function iZ(t) { +function $Z(t) { var r; console.log(t); const e = (r = t.response) == null ? void 0 : r.data; if (e) { console.log(e, "responseData"); - const n = new jS( + const n = new p7( e.errorMessage, t.code, t.config, @@ -30753,13 +31265,13 @@ function iZ(t) { } else return Promise.reject(t); } -US.interceptors.response.use( - nZ, - iZ +g7.interceptors.response.use( + kZ, + $Z ); -class sZ { +class BZ { constructor(e) { - Ds(this, "_apiBase", ""); + vs(this, "_apiBase", ""); this.request = e; } setApiBase(e) { @@ -30794,7 +31306,7 @@ class sZ { return (await this.request.post("/api/v2/user/account/bind", e)).data; } } -const Ta = new sZ(US), oZ = { +const ka = new BZ(g7), FZ = { projectId: "7a4434fefbcc9af474fb5c995e47d286", metadata: { name: "codatta", @@ -30802,84 +31314,86 @@ const Ta = new sZ(US), oZ = { url: "https://codatta.io/", icons: ["https://avatars.githubusercontent.com/u/171659315"] } -}, aZ = PJ({ +}, jZ = sX({ appName: "codatta", appLogoUrl: "https://avatars.githubusercontent.com/u/171659315" -}), qS = Sa({ +}), m7 = Ta({ saveLastUsedWallet: () => { }, lastUsedWallet: null, wallets: [], initialized: !1, - featuredWallets: [] + featuredWallets: [], + chains: [] }); -function mp() { - return Tn(qS); -} -function yoe(t) { - const { apiBaseUrl: e } = t, [r, n] = Yt([]), [i, s] = Yt([]), [o, a] = Yt(null), [u, l] = Yt(!1), d = (A) => { - a(A); - const N = { - provider: A.provider instanceof N1 ? "UniversalProvider" : "EIP1193Provider", - key: A.key, +function Tp() { + return Tn(m7); +} +function Qoe(t) { + const { apiBaseUrl: e } = t, [r, n] = Yt([]), [i, s] = Yt([]), [o, a] = Yt(null), [u, l] = Yt(!1), [d, p] = Yt([]), w = (O) => { + a(O); + const B = { + provider: O.provider instanceof J1 ? "UniversalProvider" : "EIP1193Provider", + key: O.key, timestamp: Date.now() }; - localStorage.setItem("xn-last-used-info", JSON.stringify(N)); + localStorage.setItem("xn-last-used-info", JSON.stringify(B)); }; - function p(A) { - const M = A.find((N) => { - var L; - return ((L = N.config) == null ? void 0 : L.name) === t.singleWalletName; + function _(O) { + const L = O.find((B) => { + var k; + return ((k = B.config) == null ? void 0 : k.name) === t.singleWalletName; }); - if (M) - s([M]); + if (L) + s([L]); else { - const N = A.filter(($) => $.featured || $.installed), L = A.filter(($) => !$.featured && !$.installed), B = [...N, ...L]; - n(B), s(N); - } - } - async function w() { - const A = [], M = /* @__PURE__ */ new Map(); - qR.forEach((L) => { - const B = new vl(L); - L.name === "Coinbase Wallet" && B.EIP6963Detected({ - info: { name: "Coinbase Wallet", uuid: "coinbase", icon: L.image, rdns: "coinbase" }, - provider: aZ.getProvider() - }), M.set(B.key, B), A.push(B); - }), (await UG()).forEach((L) => { - const B = M.get(L.info.name); - if (B) - B.EIP6963Detected(L); + const B = O.filter((U) => U.featured || U.installed), k = O.filter((U) => !U.featured && !U.installed), q = [...B, ...k]; + n(q), s(B); + } + } + async function P() { + const O = [], L = /* @__PURE__ */ new Map(); + mD.forEach((k) => { + const q = new Il(k); + k.name === "Coinbase Wallet" && q.EIP6963Detected({ + info: { name: "Coinbase Wallet", uuid: "coinbase", icon: k.image, rdns: "coinbase" }, + provider: jZ.getProvider() + }), L.set(q.key, q), O.push(q); + }), (await wY()).forEach((k) => { + const q = L.get(k.info.name); + if (q) + q.EIP6963Detected(k); else { - const $ = new vl(L); - M.set($.key, $), A.push($); + const U = new Il(k); + L.set(U.key, U), O.push(U); } }); try { - const L = JSON.parse(localStorage.getItem("xn-last-used-info") || "{}"), B = M.get(L.key); - if (B) { - if (B.lastUsed = !0, L.provider === "UniversalProvider") { - const $ = await N1.init(oZ); - $.session && (B.setUniversalProvider($), console.log("Restored UniversalProvider for wallet:", B.key)); - } else L.provider === "EIP1193Provider" && B.installed && console.log("Using detected EIP1193Provider for wallet:", B.key); - a(B); + const k = JSON.parse(localStorage.getItem("xn-last-used-info") || "{}"), q = L.get(k.key); + if (q) { + if (q.lastUsed = !0, k.provider === "UniversalProvider") { + const U = await J1.init(FZ); + U.session && (q.setUniversalProvider(U), console.log("Restored UniversalProvider for wallet:", q.key)); + } else k.provider === "EIP1193Provider" && q.installed && console.log("Using detected EIP1193Provider for wallet:", q.key); + a(q); } - } catch (L) { - console.log(L); + } catch (k) { + console.log(k); } - p(A), l(!0); + t.chains && p(t.chains), _(O), l(!0); } return Dn(() => { - w(), Ta.setApiBase(e); + P(), ka.setApiBase(e); }, []), /* @__PURE__ */ le.jsx( - qS.Provider, + m7.Provider, { value: { - saveLastUsedWallet: d, + saveLastUsedWallet: w, wallets: r, initialized: u, lastUsedWallet: o, - featuredWallets: i + featuredWallets: i, + chains: d }, children: t.children } @@ -30891,14 +31405,14 @@ function yoe(t) { * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const cZ = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), zS = (...t) => t.filter((e, r, n) => !!e && e.trim() !== "" && n.indexOf(e) === r).join(" ").trim(); +const UZ = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), v7 = (...t) => t.filter((e, r, n) => !!e && e.trim() !== "" && n.indexOf(e) === r).join(" ").trim(); /** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -var uZ = { +var qZ = { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, @@ -30915,7 +31429,7 @@ var uZ = { * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const fZ = mv( +const zZ = Dv( ({ color: t = "currentColor", size: e = 24, @@ -30925,20 +31439,20 @@ const fZ = mv( children: s, iconNode: o, ...a - }, u) => qd( + }, u) => e0( "svg", { ref: u, - ...uZ, + ...qZ, width: e, height: e, stroke: t, strokeWidth: n ? Number(r) * 24 / Number(e) : r, - className: zS("lucide", i), + className: v7("lucide", i), ...a }, [ - ...o.map(([l, d]) => qd(l, d)), + ...o.map(([l, d]) => e0(l, d)), ...Array.isArray(s) ? s : [s] ] ) @@ -30949,12 +31463,12 @@ const fZ = mv( * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const us = (t, e) => { - const r = mv( - ({ className: n, ...i }, s) => qd(fZ, { +const ls = (t, e) => { + const r = Dv( + ({ className: n, ...i }, s) => e0(zZ, { ref: s, iconNode: e, - className: zS(`lucide-${cZ(t)}`, n), + className: v7(`lucide-${UZ(t)}`, n), ...i }) ); @@ -30966,7 +31480,7 @@ const us = (t, e) => { * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const lZ = us("ArrowLeft", [ +const WZ = ls("ArrowLeft", [ ["path", { d: "m12 19-7-7 7-7", key: "1l729n" }], ["path", { d: "M19 12H5", key: "x3x0zl" }] ]); @@ -30976,7 +31490,7 @@ const lZ = us("ArrowLeft", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const WS = us("ArrowRight", [ +const b7 = ls("ArrowRight", [ ["path", { d: "M5 12h14", key: "1ays0h" }], ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }] ]); @@ -30986,7 +31500,7 @@ const WS = us("ArrowRight", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const hZ = us("ChevronRight", [ +const HZ = ls("ChevronRight", [ ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }] ]); /** @@ -30995,7 +31509,7 @@ const hZ = us("ChevronRight", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const dZ = us("CircleCheckBig", [ +const KZ = ls("CircleCheckBig", [ ["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }], ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }] ]); @@ -31005,7 +31519,7 @@ const dZ = us("CircleCheckBig", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const pZ = us("Download", [ +const VZ = ls("Download", [ ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }], ["polyline", { points: "7 10 12 15 17 10", key: "2ggqvy" }], ["line", { x1: "12", x2: "12", y1: "15", y2: "3", key: "1vk2je" }] @@ -31016,7 +31530,7 @@ const pZ = us("Download", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const gZ = us("Globe", [ +const GZ = ls("Globe", [ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }], ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }], ["path", { d: "M2 12h20", key: "9i4pu4" }] @@ -31027,7 +31541,7 @@ const gZ = us("Globe", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const HS = us("Laptop", [ +const y7 = ls("Laptop", [ [ "path", { @@ -31042,7 +31556,7 @@ const HS = us("Laptop", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const mZ = us("Link2", [ +const YZ = ls("Link2", [ ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }], ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }], ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }] @@ -31053,7 +31567,7 @@ const mZ = us("Link2", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const mc = us("LoaderCircle", [ +const Sc = ls("LoaderCircle", [ ["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }] ]); /** @@ -31062,7 +31576,7 @@ const mc = us("LoaderCircle", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const vZ = us("Mail", [ +const JZ = ls("Mail", [ ["rect", { width: "20", height: "16", x: "2", y: "4", rx: "2", key: "18n3k1" }], ["path", { d: "m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7", key: "1ocrg3" }] ]); @@ -31072,7 +31586,7 @@ const vZ = us("Mail", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const KS = us("Search", [ +const w7 = ls("Search", [ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }], ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }] ]); @@ -31082,18 +31596,18 @@ const KS = us("Search", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const bZ = us("UserRoundCheck", [ +const XZ = ls("UserRoundCheck", [ ["path", { d: "M2 21a8 8 0 0 1 13.292-6", key: "bjp14o" }], ["circle", { cx: "10", cy: "8", r: "5", key: "o932ke" }], ["path", { d: "m16 19 2 2 4-4", key: "1b14m6" }] -]), K6 = /* @__PURE__ */ new Set(); -function vp(t, e, r) { - t || K6.has(e) || (console.warn(e), K6.add(e)); +]), c6 = /* @__PURE__ */ new Set(); +function Rp(t, e, r) { + t || c6.has(e) || (console.warn(e), c6.add(e)); } -function yZ(t) { +function ZZ(t) { if (typeof Proxy > "u") return t; - const e = /* @__PURE__ */ new Map(), r = (...n) => (process.env.NODE_ENV !== "production" && vp(!1, "motion() is deprecated. Use motion.create() instead."), t(...n)); + const e = /* @__PURE__ */ new Map(), r = (...n) => (process.env.NODE_ENV !== "production" && Rp(!1, "motion() is deprecated. Use motion.create() instead."), t(...n)); return new Proxy(r, { /** * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc. @@ -31103,11 +31617,11 @@ function yZ(t) { get: (n, i) => i === "create" ? t : (e.has(i) || e.set(i, t(i)), e.get(i)) }); } -function bp(t) { +function Dp(t) { return t !== null && typeof t == "object" && typeof t.start == "function"; } -const X1 = (t) => Array.isArray(t); -function VS(t, e) { +const dv = (t) => Array.isArray(t); +function x7(t, e) { if (!Array.isArray(e)) return !1; const r = e.length; @@ -31118,31 +31632,31 @@ function VS(t, e) { return !1; return !0; } -function Il(t) { +function Fl(t) { return typeof t == "string" || Array.isArray(t); } -function V6(t) { +function u6(t) { const e = [{}, {}]; return t == null || t.values.forEach((r, n) => { e[0][n] = r.get(), e[1][n] = r.getVelocity(); }), e; } -function Ib(t, e, r, n) { +function qb(t, e, r, n) { if (typeof e == "function") { - const [i, s] = V6(n); + const [i, s] = u6(n); e = e(r !== void 0 ? r : t.custom, i, s); } if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") { - const [i, s] = V6(n); + const [i, s] = u6(n); e = e(r !== void 0 ? r : t.custom, i, s); } return e; } -function yp(t, e, r) { +function Op(t, e, r) { const n = t.getProps(); - return Ib(n, e, r !== void 0 ? r : n.custom, t); + return qb(n, e, r !== void 0 ? r : n.custom, t); } -const Cb = [ +const zb = [ "animate", "whileInView", "whileFocus", @@ -31150,7 +31664,7 @@ const Cb = [ "whileTap", "whileDrag", "exit" -], Tb = ["initial", ...Cb], ah = [ +], Wb = ["initial", ...zb], mh = [ "transformPerspective", "x", "y", @@ -31168,36 +31682,36 @@ const Cb = [ "skew", "skewX", "skewY" -], Ac = new Set(ah), Vs = (t) => t * 1e3, To = (t) => t / 1e3, wZ = { +], Lc = new Set(mh), Js = (t) => t * 1e3, No = (t) => t / 1e3, QZ = { type: "spring", stiffness: 500, damping: 25, restSpeed: 10 -}, xZ = (t) => ({ +}, eQ = (t) => ({ type: "spring", stiffness: 550, damping: t === 0 ? 2 * Math.sqrt(550) : 30, restSpeed: 10 -}), _Z = { +}), tQ = { type: "keyframes", duration: 0.8 -}, EZ = { +}, rQ = { type: "keyframes", ease: [0.25, 0.1, 0.35, 1], duration: 0.3 -}, SZ = (t, { keyframes: e }) => e.length > 2 ? _Z : Ac.has(t) ? t.startsWith("scale") ? xZ(e[1]) : wZ : EZ; -function Rb(t, e) { +}, nQ = (t, { keyframes: e }) => e.length > 2 ? tQ : Lc.has(t) ? t.startsWith("scale") ? eQ(e[1]) : QZ : rQ; +function Hb(t, e) { return t ? t[e] || t.default || t : void 0; } -const AZ = { +const iQ = { useManualTiming: !1 -}, PZ = (t) => t !== null; -function wp(t, { repeat: e, repeatType: r = "loop" }, n) { - const i = t.filter(PZ), s = e && r !== "loop" && e % 2 === 1 ? 0 : i.length - 1; +}, sQ = (t) => t !== null; +function Np(t, { repeat: e, repeatType: r = "loop" }, n) { + const i = t.filter(sQ), s = e && r !== "loop" && e % 2 === 1 ? 0 : i.length - 1; return !s || n === void 0 ? i[s] : n; } const Un = (t) => t; -function MZ(t) { +function oQ(t) { let e = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), n = !1, i = !1; const s = /* @__PURE__ */ new WeakSet(); let o = { @@ -31213,8 +31727,8 @@ function MZ(t) { * Schedule a process to run on the next frame. */ schedule: (l, d = !1, p = !1) => { - const A = p && n ? e : r; - return d && s.add(l), A.has(l) || A.add(l), l; + const _ = p && n ? e : r; + return d && s.add(l), _.has(l) || _.add(l), l; }, /** * Cancel the provided callback from running on the next frame. @@ -31235,7 +31749,7 @@ function MZ(t) { }; return u; } -const gd = [ +const Pd = [ "read", // Read "resolveKeyframes", @@ -31248,95 +31762,95 @@ const gd = [ // Write "postRender" // Compute -], IZ = 40; -function GS(t, e) { +], aQ = 40; +function _7(t, e) { let r = !1, n = !0; const i = { delta: 0, timestamp: 0, isProcessing: !1 - }, s = () => r = !0, o = gd.reduce((B, $) => (B[$] = MZ(s), B), {}), { read: a, resolveKeyframes: u, update: l, preRender: d, render: p, postRender: w } = o, A = () => { + }, s = () => r = !0, o = Pd.reduce((B, k) => (B[k] = oQ(s), B), {}), { read: a, resolveKeyframes: u, update: l, preRender: d, render: p, postRender: w } = o, _ = () => { const B = performance.now(); - r = !1, i.delta = n ? 1e3 / 60 : Math.max(Math.min(B - i.timestamp, IZ), 1), i.timestamp = B, i.isProcessing = !0, a.process(i), u.process(i), l.process(i), d.process(i), p.process(i), w.process(i), i.isProcessing = !1, r && e && (n = !1, t(A)); - }, M = () => { - r = !0, n = !0, i.isProcessing || t(A); + r = !1, i.delta = n ? 1e3 / 60 : Math.max(Math.min(B - i.timestamp, aQ), 1), i.timestamp = B, i.isProcessing = !0, a.process(i), u.process(i), l.process(i), d.process(i), p.process(i), w.process(i), i.isProcessing = !1, r && e && (n = !1, t(_)); + }, P = () => { + r = !0, n = !0, i.isProcessing || t(_); }; - return { schedule: gd.reduce((B, $) => { - const H = o[$]; - return B[$] = (U, V = !1, te = !1) => (r || M(), H.schedule(U, V, te)), B; + return { schedule: Pd.reduce((B, k) => { + const q = o[k]; + return B[k] = (U, V = !1, Q = !1) => (r || P(), q.schedule(U, V, Q)), B; }, {}), cancel: (B) => { - for (let $ = 0; $ < gd.length; $++) - o[gd[$]].cancel(B); + for (let k = 0; k < Pd.length; k++) + o[Pd[k]].cancel(B); }, state: i, steps: o }; } -const { schedule: Lr, cancel: wa, state: Fn, steps: Dm } = GS(typeof requestAnimationFrame < "u" ? requestAnimationFrame : Un, !0), YS = (t, e, r) => (((1 - 3 * r + 3 * e) * t + (3 * r - 6 * e)) * t + 3 * e) * t, CZ = 1e-7, TZ = 12; -function RZ(t, e, r, n, i) { +const { schedule: Lr, cancel: Pa, state: Fn, steps: Km } = _7(typeof requestAnimationFrame < "u" ? requestAnimationFrame : Un, !0), E7 = (t, e, r) => (((1 - 3 * r + 3 * e) * t + (3 * r - 6 * e)) * t + 3 * e) * t, cQ = 1e-7, uQ = 12; +function fQ(t, e, r, n, i) { let s, o, a = 0; do - o = e + (r - e) / 2, s = YS(o, n, i) - t, s > 0 ? r = o : e = o; - while (Math.abs(s) > CZ && ++a < TZ); + o = e + (r - e) / 2, s = E7(o, n, i) - t, s > 0 ? r = o : e = o; + while (Math.abs(s) > cQ && ++a < uQ); return o; } -function ch(t, e, r, n) { +function vh(t, e, r, n) { if (t === e && r === n) return Un; - const i = (s) => RZ(s, 0, 1, t, r); - return (s) => s === 0 || s === 1 ? s : YS(i(s), e, n); + const i = (s) => fQ(s, 0, 1, t, r); + return (s) => s === 0 || s === 1 ? s : E7(i(s), e, n); } -const JS = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, XS = (t) => (e) => 1 - t(1 - e), ZS = /* @__PURE__ */ ch(0.33, 1.53, 0.69, 0.99), Db = /* @__PURE__ */ XS(ZS), QS = /* @__PURE__ */ JS(Db), e7 = (t) => (t *= 2) < 1 ? 0.5 * Db(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Ob = (t) => 1 - Math.sin(Math.acos(t)), t7 = XS(Ob), r7 = JS(Ob), n7 = (t) => /^0[^.\s]+$/u.test(t); -function DZ(t) { - return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || n7(t) : !0; +const S7 = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, A7 = (t) => (e) => 1 - t(1 - e), P7 = /* @__PURE__ */ vh(0.33, 1.53, 0.69, 0.99), Kb = /* @__PURE__ */ A7(P7), M7 = /* @__PURE__ */ S7(Kb), I7 = (t) => (t *= 2) < 1 ? 0.5 * Kb(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Vb = (t) => 1 - Math.sin(Math.acos(t)), C7 = A7(Vb), T7 = S7(Vb), R7 = (t) => /^0[^.\s]+$/u.test(t); +function lQ(t) { + return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || R7(t) : !0; } -let Ku = Un, Uo = Un; -process.env.NODE_ENV !== "production" && (Ku = (t, e) => { +let Qu = Un, Wo = Un; +process.env.NODE_ENV !== "production" && (Qu = (t, e) => { !t && typeof console < "u" && console.warn(e); -}, Uo = (t, e) => { +}, Wo = (t, e) => { if (!t) throw new Error(e); }); -const i7 = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), s7 = (t) => (e) => typeof e == "string" && e.startsWith(t), o7 = /* @__PURE__ */ s7("--"), OZ = /* @__PURE__ */ s7("var(--"), Nb = (t) => OZ(t) ? NZ.test(t.split("/*")[0].trim()) : !1, NZ = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, LZ = ( +const D7 = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), O7 = (t) => (e) => typeof e == "string" && e.startsWith(t), N7 = /* @__PURE__ */ O7("--"), hQ = /* @__PURE__ */ O7("var(--"), Gb = (t) => hQ(t) ? dQ.test(t.split("/*")[0].trim()) : !1, dQ = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, pQ = ( // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u ); -function kZ(t) { - const e = LZ.exec(t); +function gQ(t) { + const e = pQ.exec(t); if (!e) return [,]; const [, r, n, i] = e; return [`--${r ?? n}`, i]; } -const $Z = 4; -function a7(t, e, r = 1) { - Uo(r <= $Z, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`); - const [n, i] = kZ(t); +const mQ = 4; +function L7(t, e, r = 1) { + Wo(r <= mQ, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`); + const [n, i] = gQ(t); if (!n) return; const s = window.getComputedStyle(e).getPropertyValue(n); if (s) { const o = s.trim(); - return i7(o) ? parseFloat(o) : o; + return D7(o) ? parseFloat(o) : o; } - return Nb(i) ? a7(i, e, r + 1) : i; + return Gb(i) ? L7(i, e, r + 1) : i; } -const xa = (t, e, r) => r > e ? e : r < t ? t : r, Vu = { +const Ma = (t, e, r) => r > e ? e : r < t ? t : r, ef = { test: (t) => typeof t == "number", parse: parseFloat, transform: (t) => t -}, Cl = { - ...Vu, - transform: (t) => xa(0, 1, t) -}, md = { - ...Vu, +}, jl = { + ...ef, + transform: (t) => Ma(0, 1, t) +}, Md = { + ...ef, default: 1 -}, uh = (t) => ({ +}, bh = (t) => ({ test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1, parse: parseFloat, transform: (e) => `${e}${t}` -}), oa = /* @__PURE__ */ uh("deg"), Gs = /* @__PURE__ */ uh("%"), Vt = /* @__PURE__ */ uh("px"), BZ = /* @__PURE__ */ uh("vh"), FZ = /* @__PURE__ */ uh("vw"), G6 = { - ...Gs, - parse: (t) => Gs.parse(t) / 100, - transform: (t) => Gs.transform(t * 100) -}, jZ = /* @__PURE__ */ new Set([ +}), ca = /* @__PURE__ */ bh("deg"), Xs = /* @__PURE__ */ bh("%"), Vt = /* @__PURE__ */ bh("px"), vQ = /* @__PURE__ */ bh("vh"), bQ = /* @__PURE__ */ bh("vw"), f6 = { + ...Xs, + parse: (t) => Xs.parse(t) / 100, + transform: (t) => Xs.transform(t * 100) +}, yQ = /* @__PURE__ */ new Set([ "width", "height", "top", @@ -31347,25 +31861,25 @@ const xa = (t, e, r) => r > e ? e : r < t ? t : r, Vu = { "y", "translateX", "translateY" -]), Y6 = (t) => t === Vu || t === Vt, J6 = (t, e) => parseFloat(t.split(", ")[e]), X6 = (t, e) => (r, { transform: n }) => { +]), l6 = (t) => t === ef || t === Vt, h6 = (t, e) => parseFloat(t.split(", ")[e]), d6 = (t, e) => (r, { transform: n }) => { if (n === "none" || !n) return 0; const i = n.match(/^matrix3d\((.+)\)$/u); if (i) - return J6(i[1], e); + return h6(i[1], e); { const s = n.match(/^matrix\((.+)\)$/u); - return s ? J6(s[1], t) : 0; + return s ? h6(s[1], t) : 0; } -}, UZ = /* @__PURE__ */ new Set(["x", "y", "z"]), qZ = ah.filter((t) => !UZ.has(t)); -function zZ(t) { +}, wQ = /* @__PURE__ */ new Set(["x", "y", "z"]), xQ = mh.filter((t) => !wQ.has(t)); +function _Q(t) { const e = []; - return qZ.forEach((r) => { + return xQ.forEach((r) => { const n = t.getValue(r); n !== void 0 && (e.push([r, n.get()]), n.set(r.startsWith("scale") ? 1 : 0)); }), e; } -const Mu = { +const ku = { // Dimensions width: ({ x: t }, { paddingLeft: e = "0", paddingRight: r = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(r), height: ({ y: t }, { paddingTop: e = "0", paddingBottom: r = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(r), @@ -31374,21 +31888,21 @@ const Mu = { bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min), right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min), // Transform - x: X6(4, 13), - y: X6(5, 14) + x: d6(4, 13), + y: d6(5, 14) }; -Mu.translateX = Mu.x; -Mu.translateY = Mu.y; -const c7 = (t) => (e) => e.test(t), WZ = { +ku.translateX = ku.x; +ku.translateY = ku.y; +const k7 = (t) => (e) => e.test(t), EQ = { test: (t) => t === "auto", parse: (t) => t -}, u7 = [Vu, Vt, Gs, oa, FZ, BZ, WZ], Z6 = (t) => u7.find(c7(t)), cc = /* @__PURE__ */ new Set(); -let Z1 = !1, Q1 = !1; -function f7() { - if (Q1) { - const t = Array.from(cc).filter((n) => n.needsMeasurement), e = new Set(t.map((n) => n.element)), r = /* @__PURE__ */ new Map(); +}, $7 = [ef, Vt, Xs, ca, bQ, vQ, EQ], p6 = (t) => $7.find(k7(t)), gc = /* @__PURE__ */ new Set(); +let pv = !1, gv = !1; +function B7() { + if (gv) { + const t = Array.from(gc).filter((n) => n.needsMeasurement), e = new Set(t.map((n) => n.element)), r = /* @__PURE__ */ new Map(); e.forEach((n) => { - const i = zZ(n); + const i = _Q(n); i.length && (r.set(n, i), n.render()); }), t.forEach((n) => n.measureInitialState()), e.forEach((n) => { n.render(); @@ -31401,22 +31915,22 @@ function f7() { n.suspendedScrollY !== void 0 && window.scrollTo(0, n.suspendedScrollY); }); } - Q1 = !1, Z1 = !1, cc.forEach((t) => t.complete()), cc.clear(); + gv = !1, pv = !1, gc.forEach((t) => t.complete()), gc.clear(); } -function l7() { - cc.forEach((t) => { - t.readKeyframes(), t.needsMeasurement && (Q1 = !0); +function F7() { + gc.forEach((t) => { + t.readKeyframes(), t.needsMeasurement && (gv = !0); }); } -function HZ() { - l7(), f7(); +function SQ() { + F7(), B7(); } -class Lb { +class Yb { constructor(e, r, n, i, s, o = !1) { this.isComplete = !1, this.isAsync = !1, this.needsMeasurement = !1, this.isScheduled = !1, this.unresolvedKeyframes = [...e], this.onComplete = r, this.name = n, this.motionValue = i, this.element = s, this.isAsync = o; } scheduleResolve() { - this.isScheduled = !0, this.isAsync ? (cc.add(this), Z1 || (Z1 = !0, Lr.read(l7), Lr.resolveKeyframes(f7))) : (this.readKeyframes(), this.complete()); + this.isScheduled = !0, this.isAsync ? (gc.add(this), pv || (pv = !0, Lr.read(F7), Lr.resolveKeyframes(B7))) : (this.readKeyframes(), this.complete()); } readKeyframes() { const { unresolvedKeyframes: e, name: r, element: n, motionValue: i } = this; @@ -31443,38 +31957,38 @@ class Lb { measureEndState() { } complete() { - this.isComplete = !0, this.onComplete(this.unresolvedKeyframes, this.finalKeyframe), cc.delete(this); + this.isComplete = !0, this.onComplete(this.unresolvedKeyframes, this.finalKeyframe), gc.delete(this); } cancel() { - this.isComplete || (this.isScheduled = !1, cc.delete(this)); + this.isComplete || (this.isScheduled = !1, gc.delete(this)); } resume() { this.isComplete || this.scheduleResolve(); } } -const Yf = (t) => Math.round(t * 1e5) / 1e5, kb = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; -function KZ(t) { +const rl = (t) => Math.round(t * 1e5) / 1e5, Jb = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; +function AQ(t) { return t == null; } -const VZ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, $b = (t, e) => (r) => !!(typeof r == "string" && VZ.test(r) && r.startsWith(t) || e && !KZ(r) && Object.prototype.hasOwnProperty.call(r, e)), h7 = (t, e, r) => (n) => { +const PQ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, Xb = (t, e) => (r) => !!(typeof r == "string" && PQ.test(r) && r.startsWith(t) || e && !AQ(r) && Object.prototype.hasOwnProperty.call(r, e)), j7 = (t, e, r) => (n) => { if (typeof n != "string") return n; - const [i, s, o, a] = n.match(kb); + const [i, s, o, a] = n.match(Jb); return { [t]: parseFloat(i), [e]: parseFloat(s), [r]: parseFloat(o), alpha: a !== void 0 ? parseFloat(a) : 1 }; -}, GZ = (t) => xa(0, 255, t), Om = { - ...Vu, - transform: (t) => Math.round(GZ(t)) -}, sc = { - test: /* @__PURE__ */ $b("rgb", "red"), - parse: /* @__PURE__ */ h7("red", "green", "blue"), - transform: ({ red: t, green: e, blue: r, alpha: n = 1 }) => "rgba(" + Om.transform(t) + ", " + Om.transform(e) + ", " + Om.transform(r) + ", " + Yf(Cl.transform(n)) + ")" -}; -function YZ(t) { +}, MQ = (t) => Ma(0, 255, t), Vm = { + ...ef, + transform: (t) => Math.round(MQ(t)) +}, hc = { + test: /* @__PURE__ */ Xb("rgb", "red"), + parse: /* @__PURE__ */ j7("red", "green", "blue"), + transform: ({ red: t, green: e, blue: r, alpha: n = 1 }) => "rgba(" + Vm.transform(t) + ", " + Vm.transform(e) + ", " + Vm.transform(r) + ", " + rl(jl.transform(n)) + ")" +}; +function IQ(t) { let e = "", r = "", n = "", i = ""; return t.length > 5 ? (e = t.substring(1, 3), r = t.substring(3, 5), n = t.substring(5, 7), i = t.substring(7, 9)) : (e = t.substring(1, 2), r = t.substring(2, 3), n = t.substring(3, 4), i = t.substring(4, 5), e += e, r += r, n += n, i += i), { red: parseInt(e, 16), @@ -31483,78 +31997,78 @@ function YZ(t) { alpha: i ? parseInt(i, 16) / 255 : 1 }; } -const ev = { - test: /* @__PURE__ */ $b("#"), - parse: YZ, - transform: sc.transform -}, eu = { - test: /* @__PURE__ */ $b("hsl", "hue"), - parse: /* @__PURE__ */ h7("hue", "saturation", "lightness"), - transform: ({ hue: t, saturation: e, lightness: r, alpha: n = 1 }) => "hsla(" + Math.round(t) + ", " + Gs.transform(Yf(e)) + ", " + Gs.transform(Yf(r)) + ", " + Yf(Cl.transform(n)) + ")" +const mv = { + test: /* @__PURE__ */ Xb("#"), + parse: IQ, + transform: hc.transform +}, fu = { + test: /* @__PURE__ */ Xb("hsl", "hue"), + parse: /* @__PURE__ */ j7("hue", "saturation", "lightness"), + transform: ({ hue: t, saturation: e, lightness: r, alpha: n = 1 }) => "hsla(" + Math.round(t) + ", " + Xs.transform(rl(e)) + ", " + Xs.transform(rl(r)) + ", " + rl(jl.transform(n)) + ")" }, Yn = { - test: (t) => sc.test(t) || ev.test(t) || eu.test(t), - parse: (t) => sc.test(t) ? sc.parse(t) : eu.test(t) ? eu.parse(t) : ev.parse(t), - transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? sc.transform(t) : eu.transform(t) -}, JZ = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu; -function XZ(t) { + test: (t) => hc.test(t) || mv.test(t) || fu.test(t), + parse: (t) => hc.test(t) ? hc.parse(t) : fu.test(t) ? fu.parse(t) : mv.parse(t), + transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? hc.transform(t) : fu.transform(t) +}, CQ = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu; +function TQ(t) { var e, r; - return isNaN(t) && typeof t == "string" && (((e = t.match(kb)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match(JZ)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; + return isNaN(t) && typeof t == "string" && (((e = t.match(Jb)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match(CQ)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; } -const d7 = "number", p7 = "color", ZZ = "var", QZ = "var(", Q6 = "${}", eQ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; -function Tl(t) { +const U7 = "number", q7 = "color", RQ = "var", DQ = "var(", g6 = "${}", OQ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; +function Ul(t) { const e = t.toString(), r = [], n = { color: [], number: [], var: [] }, i = []; let s = 0; - const a = e.replace(eQ, (u) => (Yn.test(u) ? (n.color.push(s), i.push(p7), r.push(Yn.parse(u))) : u.startsWith(QZ) ? (n.var.push(s), i.push(ZZ), r.push(u)) : (n.number.push(s), i.push(d7), r.push(parseFloat(u))), ++s, Q6)).split(Q6); + const a = e.replace(OQ, (u) => (Yn.test(u) ? (n.color.push(s), i.push(q7), r.push(Yn.parse(u))) : u.startsWith(DQ) ? (n.var.push(s), i.push(RQ), r.push(u)) : (n.number.push(s), i.push(U7), r.push(parseFloat(u))), ++s, g6)).split(g6); return { values: r, split: a, indexes: n, types: i }; } -function g7(t) { - return Tl(t).values; +function z7(t) { + return Ul(t).values; } -function m7(t) { - const { split: e, types: r } = Tl(t), n = e.length; +function W7(t) { + const { split: e, types: r } = Ul(t), n = e.length; return (i) => { let s = ""; for (let o = 0; o < n; o++) if (s += e[o], i[o] !== void 0) { const a = r[o]; - a === d7 ? s += Yf(i[o]) : a === p7 ? s += Yn.transform(i[o]) : s += i[o]; + a === U7 ? s += rl(i[o]) : a === q7 ? s += Yn.transform(i[o]) : s += i[o]; } return s; }; } -const tQ = (t) => typeof t == "number" ? 0 : t; -function rQ(t) { - const e = g7(t); - return m7(t)(e.map(tQ)); -} -const _a = { - test: XZ, - parse: g7, - createTransformer: m7, - getAnimatableNone: rQ -}, nQ = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]); -function iQ(t) { +const NQ = (t) => typeof t == "number" ? 0 : t; +function LQ(t) { + const e = z7(t); + return W7(t)(e.map(NQ)); +} +const Ia = { + test: TQ, + parse: z7, + createTransformer: W7, + getAnimatableNone: LQ +}, kQ = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]); +function $Q(t) { const [e, r] = t.slice(0, -1).split("("); if (e === "drop-shadow") return t; - const [n] = r.match(kb) || []; + const [n] = r.match(Jb) || []; if (!n) return t; const i = r.replace(n, ""); - let s = nQ.has(e) ? 1 : 0; + let s = kQ.has(e) ? 1 : 0; return n !== r && (s *= 100), e + "(" + s + i + ")"; } -const sQ = /\b([a-z-]*)\(.*?\)/gu, tv = { - ..._a, +const BQ = /\b([a-z-]*)\(.*?\)/gu, vv = { + ...Ia, getAnimatableNone: (t) => { - const e = t.match(sQ); - return e ? e.map(iQ).join(" ") : t; + const e = t.match(BQ); + return e ? e.map($Q).join(" ") : t; } -}, oQ = { +}, FQ = { // Border props borderWidth: Vt, borderTopWidth: Vt, @@ -31590,18 +32104,18 @@ const sQ = /\b([a-z-]*)\(.*?\)/gu, tv = { // Misc backgroundPositionX: Vt, backgroundPositionY: Vt -}, aQ = { - rotate: oa, - rotateX: oa, - rotateY: oa, - rotateZ: oa, - scale: md, - scaleX: md, - scaleY: md, - scaleZ: md, - skew: oa, - skewX: oa, - skewY: oa, +}, jQ = { + rotate: ca, + rotateX: ca, + rotateY: ca, + rotateZ: ca, + scale: Md, + scaleX: Md, + scaleY: Md, + scaleZ: Md, + skew: ca, + skewX: ca, + skewY: ca, distance: Vt, translateX: Vt, translateY: Vt, @@ -31611,24 +32125,24 @@ const sQ = /\b([a-z-]*)\(.*?\)/gu, tv = { z: Vt, perspective: Vt, transformPerspective: Vt, - opacity: Cl, - originX: G6, - originY: G6, + opacity: jl, + originX: f6, + originY: f6, originZ: Vt -}, e_ = { - ...Vu, +}, m6 = { + ...ef, transform: Math.round -}, Bb = { - ...oQ, - ...aQ, - zIndex: e_, +}, Zb = { + ...FQ, + ...jQ, + zIndex: m6, size: Vt, // SVG - fillOpacity: Cl, - strokeOpacity: Cl, - numOctaves: e_ -}, cQ = { - ...Bb, + fillOpacity: jl, + strokeOpacity: jl, + numOctaves: m6 +}, UQ = { + ...Zb, // Color props color: Yn, backgroundColor: Yn, @@ -31641,25 +32155,25 @@ const sQ = /\b([a-z-]*)\(.*?\)/gu, tv = { borderRightColor: Yn, borderBottomColor: Yn, borderLeftColor: Yn, - filter: tv, - WebkitFilter: tv -}, Fb = (t) => cQ[t]; -function v7(t, e) { - let r = Fb(t); - return r !== tv && (r = _a), r.getAnimatableNone ? r.getAnimatableNone(e) : void 0; -} -const uQ = /* @__PURE__ */ new Set(["auto", "none", "0"]); -function fQ(t, e, r) { + filter: vv, + WebkitFilter: vv +}, Qb = (t) => UQ[t]; +function H7(t, e) { + let r = Qb(t); + return r !== vv && (r = Ia), r.getAnimatableNone ? r.getAnimatableNone(e) : void 0; +} +const qQ = /* @__PURE__ */ new Set(["auto", "none", "0"]); +function zQ(t, e, r) { let n = 0, i; for (; n < t.length && !i; ) { const s = t[n]; - typeof s == "string" && !uQ.has(s) && Tl(s).values.length && (i = t[n]), n++; + typeof s == "string" && !qQ.has(s) && Ul(s).values.length && (i = t[n]), n++; } if (i && r) for (const s of e) - t[s] = v7(r, i); + t[s] = H7(r, i); } -class b7 extends Lb { +class K7 extends Yb { constructor(e, r, n, i, s) { super(e, r, n, i, s, !0); } @@ -31670,16 +32184,16 @@ class b7 extends Lb { super.readKeyframes(); for (let u = 0; u < e.length; u++) { let l = e[u]; - if (typeof l == "string" && (l = l.trim(), Nb(l))) { - const d = a7(l, r.current); + if (typeof l == "string" && (l = l.trim(), Gb(l))) { + const d = L7(l, r.current); d !== void 0 && (e[u] = d), u === e.length - 1 && (this.finalKeyframe = l); } } - if (this.resolveNoneKeyframes(), !jZ.has(n) || e.length !== 2) + if (this.resolveNoneKeyframes(), !yQ.has(n) || e.length !== 2) return; - const [i, s] = e, o = Z6(i), a = Z6(s); + const [i, s] = e, o = p6(i), a = p6(s); if (o !== a) - if (Y6(o) && Y6(a)) + if (l6(o) && l6(a)) for (let u = 0; u < e.length; u++) { const l = e[u]; typeof l == "string" && (e[u] = parseFloat(l)); @@ -31690,14 +32204,14 @@ class b7 extends Lb { resolveNoneKeyframes() { const { unresolvedKeyframes: e, name: r } = this, n = []; for (let i = 0; i < e.length; i++) - DZ(e[i]) && n.push(i); - n.length && fQ(e, n, r); + lQ(e[i]) && n.push(i); + n.length && zQ(e, n, r); } measureInitialState() { const { element: e, unresolvedKeyframes: r, name: n } = this; if (!e || !e.current) return; - n === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = Mu[n](e.measureViewportBox(), window.getComputedStyle(e.current)), r[0] = this.measuredOrigin; + n === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = ku[n](e.measureViewportBox(), window.getComputedStyle(e.current)), r[0] = this.measuredOrigin; const i = r[r.length - 1]; i !== void 0 && e.getValue(n, i).jump(i, !1); } @@ -31709,27 +32223,27 @@ class b7 extends Lb { const s = r.getValue(n); s && s.jump(this.measuredOrigin, !1); const o = i.length - 1, a = i[o]; - i[o] = Mu[n](r.measureViewportBox(), window.getComputedStyle(r.current)), a !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = a), !((e = this.removedTransforms) === null || e === void 0) && e.length && this.removedTransforms.forEach(([u, l]) => { + i[o] = ku[n](r.measureViewportBox(), window.getComputedStyle(r.current)), a !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = a), !((e = this.removedTransforms) === null || e === void 0) && e.length && this.removedTransforms.forEach(([u, l]) => { r.getValue(u).set(l); }), this.resolveNoneKeyframes(); } } -function jb(t) { +function ey(t) { return typeof t == "function"; } -let Fd; -function lQ() { - Fd = void 0; +let Xd; +function WQ() { + Xd = void 0; } -const Ys = { - now: () => (Fd === void 0 && Ys.set(Fn.isProcessing || AZ.useManualTiming ? Fn.timestamp : performance.now()), Fd), +const Zs = { + now: () => (Xd === void 0 && Zs.set(Fn.isProcessing || iQ.useManualTiming ? Fn.timestamp : performance.now()), Xd), set: (t) => { - Fd = t, queueMicrotask(lQ); + Xd = t, queueMicrotask(WQ); } -}, t_ = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string -(_a.test(t) || t === "0") && // And it contains numbers and/or colors +}, v6 = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string +(Ia.test(t) || t === "0") && // And it contains numbers and/or colors !t.startsWith("url(")); -function hQ(t) { +function HQ(t) { const e = t[0]; if (t.length === 1) return !0; @@ -31737,19 +32251,19 @@ function hQ(t) { if (t[r] !== e) return !0; } -function dQ(t, e, r, n) { +function KQ(t, e, r, n) { const i = t[0]; if (i === null) return !1; if (e === "display" || e === "visibility") return !0; - const s = t[t.length - 1], o = t_(i, e), a = t_(s, e); - return Ku(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : hQ(t) || (r === "spring" || jb(r)) && n; + const s = t[t.length - 1], o = v6(i, e), a = v6(s, e); + return Qu(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : HQ(t) || (r === "spring" || ey(r)) && n; } -const pQ = 40; -class y7 { +const VQ = 40; +class V7 { constructor({ autoplay: e = !0, delay: r = 0, type: n = "keyframes", repeat: i = 0, repeatDelay: s = 0, repeatType: o = "loop", ...a }) { - this.isStopped = !1, this.hasAttemptedResolve = !1, this.createdAt = Ys.now(), this.options = { + this.isStopped = !1, this.hasAttemptedResolve = !1, this.createdAt = Zs.now(), this.options = { autoplay: e, delay: r, type: n, @@ -31770,7 +32284,7 @@ class y7 { * to avoid a sudden jump into the animation. */ calcStartTime() { - return this.resolvedAt ? this.resolvedAt - this.createdAt > pQ ? this.resolvedAt : this.createdAt : this.createdAt; + return this.resolvedAt ? this.resolvedAt - this.createdAt > VQ ? this.resolvedAt : this.createdAt : this.createdAt; } /** * A getter for resolved data. If keyframes are not yet resolved, accessing @@ -31778,7 +32292,7 @@ class y7 { * This is a deoptimisation, but at its worst still batches read/writes. */ get resolved() { - return !this._resolved && !this.hasAttemptedResolve && HZ(), this._resolved; + return !this._resolved && !this.hasAttemptedResolve && SQ(), this._resolved; } /** * A method to be called when the keyframes resolver completes. This method @@ -31786,13 +32300,13 @@ class y7 { * Otherwise, it will call initPlayback on the implementing class. */ onKeyframesResolved(e, r) { - this.resolvedAt = Ys.now(), this.hasAttemptedResolve = !0; + this.resolvedAt = Zs.now(), this.hasAttemptedResolve = !0; const { name: n, type: i, velocity: s, delay: o, onComplete: a, onUpdate: u, isGenerator: l } = this.options; - if (!l && !dQ(e, n, i, s)) + if (!l && !KQ(e, n, i, s)) if (o) this.options.duration = 0; else { - u == null || u(wp(e, this.options, r)), a == null || a(), this.resolveFinishedPromise(); + u == null || u(Np(e, this.options, r)), a == null || a(), this.resolveFinishedPromise(); return; } const d = this.initPlayback(e, r); @@ -31821,34 +32335,34 @@ class y7 { }); } } -function w7(t, e) { +function G7(t, e) { return e ? t * (1e3 / e) : 0; } -const gQ = 5; -function x7(t, e, r) { - const n = Math.max(e - gQ, 0); - return w7(r - t(n), e - n); +const GQ = 5; +function Y7(t, e, r) { + const n = Math.max(e - GQ, 0); + return G7(r - t(n), e - n); } -const Nm = 1e-3, mQ = 0.01, r_ = 10, vQ = 0.05, bQ = 1; -function yQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }) { +const Gm = 1e-3, YQ = 0.01, b6 = 10, JQ = 0.05, XQ = 1; +function ZQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }) { let i, s; - Ku(t <= Vs(r_), "Spring duration must be 10 seconds or less"); + Qu(t <= Js(b6), "Spring duration must be 10 seconds or less"); let o = 1 - e; - o = xa(vQ, bQ, o), t = xa(mQ, r_, To(t)), o < 1 ? (i = (l) => { - const d = l * o, p = d * t, w = d - r, A = rv(l, o), M = Math.exp(-p); - return Nm - w / A * M; + o = Ma(JQ, XQ, o), t = Ma(YQ, b6, No(t)), o < 1 ? (i = (l) => { + const d = l * o, p = d * t, w = d - r, _ = bv(l, o), P = Math.exp(-p); + return Gm - w / _ * P; }, s = (l) => { - const p = l * o * t, w = p * r + r, A = Math.pow(o, 2) * Math.pow(l, 2) * t, M = Math.exp(-p), N = rv(Math.pow(l, 2), o); - return (-i(l) + Nm > 0 ? -1 : 1) * ((w - A) * M) / N; + const p = l * o * t, w = p * r + r, _ = Math.pow(o, 2) * Math.pow(l, 2) * t, P = Math.exp(-p), O = bv(Math.pow(l, 2), o); + return (-i(l) + Gm > 0 ? -1 : 1) * ((w - _) * P) / O; }) : (i = (l) => { const d = Math.exp(-l * t), p = (l - r) * t + 1; - return -Nm + d * p; + return -Gm + d * p; }, s = (l) => { const d = Math.exp(-l * t), p = (r - l) * (t * t); return d * p; }); - const a = 5 / t, u = xQ(i, s, a); - if (t = Vs(t), isNaN(u)) + const a = 5 / t, u = eee(i, s, a); + if (t = Js(t), isNaN(u)) return { stiffness: 100, damping: 10, @@ -31863,21 +32377,21 @@ function yQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }; } } -const wQ = 12; -function xQ(t, e, r) { +const QQ = 12; +function eee(t, e, r) { let n = r; - for (let i = 1; i < wQ; i++) + for (let i = 1; i < QQ; i++) n = n - t(n) / e(n); return n; } -function rv(t, e) { +function bv(t, e) { return t * Math.sqrt(1 - e * e); } -const _Q = ["duration", "bounce"], EQ = ["stiffness", "damping", "mass"]; -function n_(t, e) { +const tee = ["duration", "bounce"], ree = ["stiffness", "damping", "mass"]; +function y6(t, e) { return e.some((r) => t[r] !== void 0); } -function SQ(t) { +function nee(t) { let e = { velocity: 0, stiffness: 100, @@ -31886,8 +32400,8 @@ function SQ(t) { isResolvedFromDuration: !1, ...t }; - if (!n_(t, EQ) && n_(t, _Q)) { - const r = yQ(t); + if (!y6(t, ree) && y6(t, tee)) { + const r = ZQ(t); e = { ...e, ...r, @@ -31896,61 +32410,61 @@ function SQ(t) { } return e; } -function _7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { - const i = t[0], s = t[t.length - 1], o = { done: !1, value: i }, { stiffness: a, damping: u, mass: l, duration: d, velocity: p, isResolvedFromDuration: w } = SQ({ +function J7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { + const i = t[0], s = t[t.length - 1], o = { done: !1, value: i }, { stiffness: a, damping: u, mass: l, duration: d, velocity: p, isResolvedFromDuration: w } = nee({ ...n, - velocity: -To(n.velocity || 0) - }), A = p || 0, M = u / (2 * Math.sqrt(a * l)), N = s - i, L = To(Math.sqrt(a / l)), B = Math.abs(N) < 5; + velocity: -No(n.velocity || 0) + }), _ = p || 0, P = u / (2 * Math.sqrt(a * l)), O = s - i, L = No(Math.sqrt(a / l)), B = Math.abs(O) < 5; r || (r = B ? 0.01 : 2), e || (e = B ? 5e-3 : 0.5); - let $; - if (M < 1) { - const H = rv(L, M); - $ = (U) => { - const V = Math.exp(-M * L * U); - return s - V * ((A + M * L * N) / H * Math.sin(H * U) + N * Math.cos(H * U)); + let k; + if (P < 1) { + const q = bv(L, P); + k = (U) => { + const V = Math.exp(-P * L * U); + return s - V * ((_ + P * L * O) / q * Math.sin(q * U) + O * Math.cos(q * U)); }; - } else if (M === 1) - $ = (H) => s - Math.exp(-L * H) * (N + (A + L * N) * H); + } else if (P === 1) + k = (q) => s - Math.exp(-L * q) * (O + (_ + L * O) * q); else { - const H = L * Math.sqrt(M * M - 1); - $ = (U) => { - const V = Math.exp(-M * L * U), te = Math.min(H * U, 300); - return s - V * ((A + M * L * N) * Math.sinh(te) + H * N * Math.cosh(te)) / H; + const q = L * Math.sqrt(P * P - 1); + k = (U) => { + const V = Math.exp(-P * L * U), Q = Math.min(q * U, 300); + return s - V * ((_ + P * L * O) * Math.sinh(Q) + q * O * Math.cosh(Q)) / q; }; } return { calculatedDuration: w && d || null, - next: (H) => { - const U = $(H); + next: (q) => { + const U = k(q); if (w) - o.done = H >= d; + o.done = q >= d; else { let V = 0; - M < 1 && (V = H === 0 ? Vs(A) : x7($, H, U)); - const te = Math.abs(V) <= r, R = Math.abs(s - U) <= e; - o.done = te && R; + P < 1 && (V = q === 0 ? Js(_) : Y7(k, q, U)); + const Q = Math.abs(V) <= r, R = Math.abs(s - U) <= e; + o.done = Q && R; } return o.value = o.done ? s : U, o; } }; } -function i_({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: u, restDelta: l = 0.5, restSpeed: d }) { +function w6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: u, restDelta: l = 0.5, restSpeed: d }) { const p = t[0], w = { done: !1, value: p - }, A = (K) => a !== void 0 && K < a || u !== void 0 && K > u, M = (K) => a === void 0 ? u : u === void 0 || Math.abs(a - K) < Math.abs(u - K) ? a : u; - let N = r * e; - const L = p + N, B = o === void 0 ? L : o(L); - B !== L && (N = B - p); - const $ = (K) => -N * Math.exp(-K / n), H = (K) => B + $(K), U = (K) => { - const ge = $(K), Ee = H(K); + }, _ = (K) => a !== void 0 && K < a || u !== void 0 && K > u, P = (K) => a === void 0 ? u : u === void 0 || Math.abs(a - K) < Math.abs(u - K) ? a : u; + let O = r * e; + const L = p + O, B = o === void 0 ? L : o(L); + B !== L && (O = B - p); + const k = (K) => -O * Math.exp(-K / n), q = (K) => B + k(K), U = (K) => { + const ge = k(K), Ee = q(K); w.done = Math.abs(ge) <= l, w.value = w.done ? B : Ee; }; - let V, te; + let V, Q; const R = (K) => { - A(w.value) && (V = K, te = _7({ - keyframes: [w.value, M(w.value)], - velocity: x7(H, K, w.value), + _(w.value) && (V = K, Q = J7({ + keyframes: [w.value, P(w.value)], + velocity: Y7(q, K, w.value), // TODO: This should be passing * 1000 damping: i, stiffness: s, @@ -31962,45 +32476,45 @@ function i_({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 3 calculatedDuration: null, next: (K) => { let ge = !1; - return !te && V === void 0 && (ge = !0, U(K), R(K)), V !== void 0 && K >= V ? te.next(K - V) : (!ge && U(K), w); + return !Q && V === void 0 && (ge = !0, U(K), R(K)), V !== void 0 && K >= V ? Q.next(K - V) : (!ge && U(K), w); } }; } -const AQ = /* @__PURE__ */ ch(0.42, 0, 1, 1), PQ = /* @__PURE__ */ ch(0, 0, 0.58, 1), E7 = /* @__PURE__ */ ch(0.42, 0, 0.58, 1), MQ = (t) => Array.isArray(t) && typeof t[0] != "number", Ub = (t) => Array.isArray(t) && typeof t[0] == "number", s_ = { +const iee = /* @__PURE__ */ vh(0.42, 0, 1, 1), see = /* @__PURE__ */ vh(0, 0, 0.58, 1), X7 = /* @__PURE__ */ vh(0.42, 0, 0.58, 1), oee = (t) => Array.isArray(t) && typeof t[0] != "number", ty = (t) => Array.isArray(t) && typeof t[0] == "number", x6 = { linear: Un, - easeIn: AQ, - easeInOut: E7, - easeOut: PQ, - circIn: Ob, - circInOut: r7, - circOut: t7, - backIn: Db, - backInOut: QS, - backOut: ZS, - anticipate: e7 -}, o_ = (t) => { - if (Ub(t)) { - Uo(t.length === 4, "Cubic bezier arrays must contain four numerical values."); + easeIn: iee, + easeInOut: X7, + easeOut: see, + circIn: Vb, + circInOut: T7, + circOut: C7, + backIn: Kb, + backInOut: M7, + backOut: P7, + anticipate: I7 +}, _6 = (t) => { + if (ty(t)) { + Wo(t.length === 4, "Cubic bezier arrays must contain four numerical values."); const [e, r, n, i] = t; - return ch(e, r, n, i); + return vh(e, r, n, i); } else if (typeof t == "string") - return Uo(s_[t] !== void 0, `Invalid easing type '${t}'`), s_[t]; + return Wo(x6[t] !== void 0, `Invalid easing type '${t}'`), x6[t]; return t; -}, IQ = (t, e) => (r) => e(t(r)), Ro = (...t) => t.reduce(IQ), Iu = (t, e, r) => { +}, aee = (t, e) => (r) => e(t(r)), Lo = (...t) => t.reduce(aee), $u = (t, e, r) => { const n = e - t; return n === 0 ? 1 : (r - t) / n; }, Qr = (t, e, r) => t + (e - t) * r; -function Lm(t, e, r) { +function Ym(t, e, r) { return r < 0 && (r += 1), r > 1 && (r -= 1), r < 1 / 6 ? t + (e - t) * 6 * r : r < 1 / 2 ? e : r < 2 / 3 ? t + (e - t) * (2 / 3 - r) * 6 : t; } -function CQ({ hue: t, saturation: e, lightness: r, alpha: n }) { +function cee({ hue: t, saturation: e, lightness: r, alpha: n }) { t /= 360, e /= 100, r /= 100; let i = 0, s = 0, o = 0; if (!e) i = s = o = r; else { const a = r < 0.5 ? r * (1 + e) : r + e - r * e, u = 2 * r - a; - i = Lm(u, a, t + 1 / 3), s = Lm(u, a, t), o = Lm(u, a, t - 1 / 3); + i = Ym(u, a, t + 1 / 3), s = Ym(u, a, t), o = Ym(u, a, t - 1 / 3); } return { red: Math.round(i * 255), @@ -32009,55 +32523,55 @@ function CQ({ hue: t, saturation: e, lightness: r, alpha: n }) { alpha: n }; } -function v0(t, e) { +function C0(t, e) { return (r) => r > 0 ? e : t; } -const km = (t, e, r) => { +const Jm = (t, e, r) => { const n = t * t, i = r * (e * e - n) + n; return i < 0 ? 0 : Math.sqrt(i); -}, TQ = [ev, sc, eu], RQ = (t) => TQ.find((e) => e.test(t)); -function a_(t) { - const e = RQ(t); - if (Ku(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e) +}, uee = [mv, hc, fu], fee = (t) => uee.find((e) => e.test(t)); +function E6(t) { + const e = fee(t); + if (Qu(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e) return !1; let r = e.parse(t); - return e === eu && (r = CQ(r)), r; + return e === fu && (r = cee(r)), r; } -const c_ = (t, e) => { - const r = a_(t), n = a_(e); +const S6 = (t, e) => { + const r = E6(t), n = E6(e); if (!r || !n) - return v0(t, e); + return C0(t, e); const i = { ...r }; - return (s) => (i.red = km(r.red, n.red, s), i.green = km(r.green, n.green, s), i.blue = km(r.blue, n.blue, s), i.alpha = Qr(r.alpha, n.alpha, s), sc.transform(i)); -}, nv = /* @__PURE__ */ new Set(["none", "hidden"]); -function DQ(t, e) { - return nv.has(t) ? (r) => r <= 0 ? t : e : (r) => r >= 1 ? e : t; + return (s) => (i.red = Jm(r.red, n.red, s), i.green = Jm(r.green, n.green, s), i.blue = Jm(r.blue, n.blue, s), i.alpha = Qr(r.alpha, n.alpha, s), hc.transform(i)); +}, yv = /* @__PURE__ */ new Set(["none", "hidden"]); +function lee(t, e) { + return yv.has(t) ? (r) => r <= 0 ? t : e : (r) => r >= 1 ? e : t; } -function OQ(t, e) { +function hee(t, e) { return (r) => Qr(t, e, r); } -function qb(t) { - return typeof t == "number" ? OQ : typeof t == "string" ? Nb(t) ? v0 : Yn.test(t) ? c_ : kQ : Array.isArray(t) ? S7 : typeof t == "object" ? Yn.test(t) ? c_ : NQ : v0; +function ry(t) { + return typeof t == "number" ? hee : typeof t == "string" ? Gb(t) ? C0 : Yn.test(t) ? S6 : gee : Array.isArray(t) ? Z7 : typeof t == "object" ? Yn.test(t) ? S6 : dee : C0; } -function S7(t, e) { - const r = [...t], n = r.length, i = t.map((s, o) => qb(s)(s, e[o])); +function Z7(t, e) { + const r = [...t], n = r.length, i = t.map((s, o) => ry(s)(s, e[o])); return (s) => { for (let o = 0; o < n; o++) r[o] = i[o](s); return r; }; } -function NQ(t, e) { +function dee(t, e) { const r = { ...t, ...e }, n = {}; for (const i in r) - t[i] !== void 0 && e[i] !== void 0 && (n[i] = qb(t[i])(t[i], e[i])); + t[i] !== void 0 && e[i] !== void 0 && (n[i] = ry(t[i])(t[i], e[i])); return (i) => { for (const s in n) r[s] = n[s](i); return r; }; } -function LQ(t, e) { +function pee(t, e) { var r; const n = [], i = { color: 0, var: 0, number: 0 }; for (let s = 0; s < e.values.length; s++) { @@ -32066,104 +32580,104 @@ function LQ(t, e) { } return n; } -const kQ = (t, e) => { - const r = _a.createTransformer(e), n = Tl(t), i = Tl(e); - return n.indexes.var.length === i.indexes.var.length && n.indexes.color.length === i.indexes.color.length && n.indexes.number.length >= i.indexes.number.length ? nv.has(t) && !i.values.length || nv.has(e) && !n.values.length ? DQ(t, e) : Ro(S7(LQ(n, i), i.values), r) : (Ku(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), v0(t, e)); +const gee = (t, e) => { + const r = Ia.createTransformer(e), n = Ul(t), i = Ul(e); + return n.indexes.var.length === i.indexes.var.length && n.indexes.color.length === i.indexes.color.length && n.indexes.number.length >= i.indexes.number.length ? yv.has(t) && !i.values.length || yv.has(e) && !n.values.length ? lee(t, e) : Lo(Z7(pee(n, i), i.values), r) : (Qu(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), C0(t, e)); }; -function A7(t, e, r) { - return typeof t == "number" && typeof e == "number" && typeof r == "number" ? Qr(t, e, r) : qb(t)(t, e); +function Q7(t, e, r) { + return typeof t == "number" && typeof e == "number" && typeof r == "number" ? Qr(t, e, r) : ry(t)(t, e); } -function $Q(t, e, r) { - const n = [], i = r || A7, s = t.length - 1; +function mee(t, e, r) { + const n = [], i = r || Q7, s = t.length - 1; for (let o = 0; o < s; o++) { let a = i(t[o], t[o + 1]); if (e) { const u = Array.isArray(e) ? e[o] || Un : e; - a = Ro(u, a); + a = Lo(u, a); } n.push(a); } return n; } -function BQ(t, e, { clamp: r = !0, ease: n, mixer: i } = {}) { +function vee(t, e, { clamp: r = !0, ease: n, mixer: i } = {}) { const s = t.length; - if (Uo(s === e.length, "Both input and output ranges must be the same length"), s === 1) + if (Wo(s === e.length, "Both input and output ranges must be the same length"), s === 1) return () => e[0]; if (s === 2 && t[0] === t[1]) return () => e[1]; t[0] > t[s - 1] && (t = [...t].reverse(), e = [...e].reverse()); - const o = $Q(e, n, i), a = o.length, u = (l) => { + const o = mee(e, n, i), a = o.length, u = (l) => { let d = 0; if (a > 1) for (; d < t.length - 2 && !(l < t[d + 1]); d++) ; - const p = Iu(t[d], t[d + 1], l); + const p = $u(t[d], t[d + 1], l); return o[d](p); }; - return r ? (l) => u(xa(t[0], t[s - 1], l)) : u; + return r ? (l) => u(Ma(t[0], t[s - 1], l)) : u; } -function FQ(t, e) { +function bee(t, e) { const r = t[t.length - 1]; for (let n = 1; n <= e; n++) { - const i = Iu(0, e, n); + const i = $u(0, e, n); t.push(Qr(r, 1, i)); } } -function jQ(t) { +function yee(t) { const e = [0]; - return FQ(e, t.length - 1), e; + return bee(e, t.length - 1), e; } -function UQ(t, e) { +function wee(t, e) { return t.map((r) => r * e); } -function qQ(t, e) { - return t.map(() => e || E7).splice(0, t.length - 1); +function xee(t, e) { + return t.map(() => e || X7).splice(0, t.length - 1); } -function b0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" }) { - const i = MQ(n) ? n.map(o_) : o_(n), s = { +function T0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" }) { + const i = oee(n) ? n.map(_6) : _6(n), s = { done: !1, value: e[0] - }, o = UQ( + }, o = wee( // Only use the provided offsets if they're the correct length // TODO Maybe we should warn here if there's a length mismatch - r && r.length === e.length ? r : jQ(e), + r && r.length === e.length ? r : yee(e), t - ), a = BQ(o, e, { - ease: Array.isArray(i) ? i : qQ(e, i) + ), a = vee(o, e, { + ease: Array.isArray(i) ? i : xee(e, i) }); return { calculatedDuration: t, next: (u) => (s.value = a(u), s.done = u >= t, s) }; } -const u_ = 2e4; -function zQ(t) { +const A6 = 2e4; +function _ee(t) { let e = 0; const r = 50; let n = t.next(e); - for (; !n.done && e < u_; ) + for (; !n.done && e < A6; ) e += r, n = t.next(e); - return e >= u_ ? 1 / 0 : e; + return e >= A6 ? 1 / 0 : e; } -const WQ = (t) => { +const Eee = (t) => { const e = ({ timestamp: r }) => t(r); return { start: () => Lr.update(e, !0), - stop: () => wa(e), + stop: () => Pa(e), /** * If we're processing this frame we can use the * framelocked timestamp to keep things in sync. */ - now: () => Fn.isProcessing ? Fn.timestamp : Ys.now() + now: () => Fn.isProcessing ? Fn.timestamp : Zs.now() }; -}, HQ = { - decay: i_, - inertia: i_, - tween: b0, - keyframes: b0, - spring: _7 -}, KQ = (t) => t / 100; -class zb extends y7 { +}, See = { + decay: w6, + inertia: w6, + tween: T0, + keyframes: T0, + spring: J7 +}, Aee = (t) => t / 100; +class ny extends V7 { constructor(e) { super(e), this.holdTime = null, this.cancelTime = null, this.currentTime = 0, this.playbackSpeed = 1, this.pendingPlayState = "running", this.startTime = null, this.state = "idle", this.stop = () => { if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle") @@ -32172,30 +32686,30 @@ class zb extends y7 { const { onStop: u } = this.options; u && u(); }; - const { name: r, motionValue: n, element: i, keyframes: s } = this.options, o = (i == null ? void 0 : i.KeyframeResolver) || Lb, a = (u, l) => this.onKeyframesResolved(u, l); + const { name: r, motionValue: n, element: i, keyframes: s } = this.options, o = (i == null ? void 0 : i.KeyframeResolver) || Yb, a = (u, l) => this.onKeyframesResolved(u, l); this.resolver = new o(s, a, r, n, i), this.resolver.scheduleResolve(); } flatten() { super.flatten(), this._resolved && Object.assign(this._resolved, this.initPlayback(this._resolved.keyframes)); } initPlayback(e) { - const { type: r = "keyframes", repeat: n = 0, repeatDelay: i = 0, repeatType: s, velocity: o = 0 } = this.options, a = jb(r) ? r : HQ[r] || b0; + const { type: r = "keyframes", repeat: n = 0, repeatDelay: i = 0, repeatType: s, velocity: o = 0 } = this.options, a = ey(r) ? r : See[r] || T0; let u, l; - a !== b0 && typeof e[0] != "number" && (process.env.NODE_ENV !== "production" && Uo(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), u = Ro(KQ, A7(e[0], e[1])), e = [0, 100]); + a !== T0 && typeof e[0] != "number" && (process.env.NODE_ENV !== "production" && Wo(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), u = Lo(Aee, Q7(e[0], e[1])), e = [0, 100]); const d = a({ ...this.options, keyframes: e }); s === "mirror" && (l = a({ ...this.options, keyframes: [...e].reverse(), velocity: -o - })), d.calculatedDuration === null && (d.calculatedDuration = zQ(d)); - const { calculatedDuration: p } = d, w = p + i, A = w * (n + 1) - i; + })), d.calculatedDuration === null && (d.calculatedDuration = _ee(d)); + const { calculatedDuration: p } = d, w = p + i, _ = w * (n + 1) - i; return { generator: d, mirroredGenerator: l, mapPercentToKeyframes: u, calculatedDuration: p, resolvedDuration: w, - totalDuration: A + totalDuration: _ }; } onPostResolved() { @@ -32211,39 +32725,39 @@ class zb extends y7 { const { finalKeyframe: i, generator: s, mirroredGenerator: o, mapPercentToKeyframes: a, keyframes: u, calculatedDuration: l, totalDuration: d, resolvedDuration: p } = n; if (this.startTime === null) return s.next(0); - const { delay: w, repeat: A, repeatType: M, repeatDelay: N, onUpdate: L } = this.options; + const { delay: w, repeat: _, repeatType: P, repeatDelay: O, onUpdate: L } = this.options; this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - d / this.speed, this.startTime)), r ? this.currentTime = e : this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = Math.round(e - this.startTime) * this.speed; - const B = this.currentTime - w * (this.speed >= 0 ? 1 : -1), $ = this.speed >= 0 ? B < 0 : B > d; + const B = this.currentTime - w * (this.speed >= 0 ? 1 : -1), k = this.speed >= 0 ? B < 0 : B > d; this.currentTime = Math.max(B, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = d); - let H = this.currentTime, U = s; - if (A) { + let q = this.currentTime, U = s; + if (_) { const K = Math.min(this.currentTime, d) / p; let ge = Math.floor(K), Ee = K % 1; - !Ee && K >= 1 && (Ee = 1), Ee === 1 && ge--, ge = Math.min(ge, A + 1), !!(ge % 2) && (M === "reverse" ? (Ee = 1 - Ee, N && (Ee -= N / p)) : M === "mirror" && (U = o)), H = xa(0, 1, Ee) * p; + !Ee && K >= 1 && (Ee = 1), Ee === 1 && ge--, ge = Math.min(ge, _ + 1), !!(ge % 2) && (P === "reverse" ? (Ee = 1 - Ee, O && (Ee -= O / p)) : P === "mirror" && (U = o)), q = Ma(0, 1, Ee) * p; } - const V = $ ? { done: !1, value: u[0] } : U.next(H); + const V = k ? { done: !1, value: u[0] } : U.next(q); a && (V.value = a(V.value)); - let { done: te } = V; - !$ && l !== null && (te = this.speed >= 0 ? this.currentTime >= d : this.currentTime <= 0); - const R = this.holdTime === null && (this.state === "finished" || this.state === "running" && te); - return R && i !== void 0 && (V.value = wp(u, this.options, i)), L && L(V.value), R && this.finish(), V; + let { done: Q } = V; + !k && l !== null && (Q = this.speed >= 0 ? this.currentTime >= d : this.currentTime <= 0); + const R = this.holdTime === null && (this.state === "finished" || this.state === "running" && Q); + return R && i !== void 0 && (V.value = Np(u, this.options, i)), L && L(V.value), R && this.finish(), V; } get duration() { const { resolved: e } = this; - return e ? To(e.calculatedDuration) : 0; + return e ? No(e.calculatedDuration) : 0; } get time() { - return To(this.currentTime); + return No(this.currentTime); } set time(e) { - e = Vs(e), this.currentTime = e, this.holdTime !== null || this.speed === 0 ? this.holdTime = e : this.driver && (this.startTime = this.driver.now() - e / this.speed); + e = Js(e), this.currentTime = e, this.holdTime !== null || this.speed === 0 ? this.holdTime = e : this.driver && (this.startTime = this.driver.now() - e / this.speed); } get speed() { return this.playbackSpeed; } set speed(e) { const r = this.playbackSpeed !== e; - this.playbackSpeed = e, r && (this.time = To(this.currentTime)); + this.playbackSpeed = e, r && (this.time = No(this.currentTime)); } play() { if (this.resolver.isScheduled || this.resolver.resume(), !this._resolved) { @@ -32252,7 +32766,7 @@ class zb extends y7 { } if (this.isStopped) return; - const { driver: e = WQ, onPlay: r, startTime: n } = this.options; + const { driver: e = Eee, onPlay: r, startTime: n } = this.options; this.driver || (this.driver = e((s) => this.tick(s))), r && r(); const i = this.driver.now(); this.holdTime !== null ? this.startTime = i - this.holdTime : this.startTime ? this.state === "finished" && (this.startTime = i) : this.startTime = n ?? this.calcStartTime(), this.state === "finished" && this.updateFinishedPromise(), this.cancelTime = this.startTime, this.holdTime = null, this.state = "running", this.driver.start(); @@ -32286,7 +32800,7 @@ class zb extends y7 { return this.startTime = 0, this.tick(e, !0); } } -const VQ = /* @__PURE__ */ new Set([ +const Pee = /* @__PURE__ */ new Set([ "opacity", "clipPath", "filter", @@ -32294,28 +32808,28 @@ const VQ = /* @__PURE__ */ new Set([ // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved // or until we implement support for linear() easing. // "background-color" -]), GQ = 10, YQ = (t, e) => { +]), Mee = 10, Iee = (t, e) => { let r = ""; - const n = Math.max(Math.round(e / GQ), 2); + const n = Math.max(Math.round(e / Mee), 2); for (let i = 0; i < n; i++) - r += t(Iu(0, n - 1, i)) + ", "; + r += t($u(0, n - 1, i)) + ", "; return `linear(${r.substring(0, r.length - 2)})`; }; -function Wb(t) { +function iy(t) { let e; return () => (e === void 0 && (e = t()), e); } -const JQ = { +const Cee = { linearEasing: void 0 }; -function XQ(t, e) { - const r = Wb(t); +function Tee(t, e) { + const r = iy(t); return () => { var n; - return (n = JQ[e]) !== null && n !== void 0 ? n : r(); + return (n = Cee[e]) !== null && n !== void 0 ? n : r(); }; } -const y0 = /* @__PURE__ */ XQ(() => { +const R0 = /* @__PURE__ */ Tee(() => { try { document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" }); } catch { @@ -32323,28 +32837,28 @@ const y0 = /* @__PURE__ */ XQ(() => { } return !0; }, "linearEasing"); -function P7(t) { - return !!(typeof t == "function" && y0() || !t || typeof t == "string" && (t in iv || y0()) || Ub(t) || Array.isArray(t) && t.every(P7)); +function e9(t) { + return !!(typeof t == "function" && R0() || !t || typeof t == "string" && (t in wv || R0()) || ty(t) || Array.isArray(t) && t.every(e9)); } -const jf = ([t, e, r, n]) => `cubic-bezier(${t}, ${e}, ${r}, ${n})`, iv = { +const Vf = ([t, e, r, n]) => `cubic-bezier(${t}, ${e}, ${r}, ${n})`, wv = { linear: "linear", ease: "ease", easeIn: "ease-in", easeOut: "ease-out", easeInOut: "ease-in-out", - circIn: /* @__PURE__ */ jf([0, 0.65, 0.55, 1]), - circOut: /* @__PURE__ */ jf([0.55, 0, 1, 0.45]), - backIn: /* @__PURE__ */ jf([0.31, 0.01, 0.66, -0.59]), - backOut: /* @__PURE__ */ jf([0.33, 1.53, 0.69, 0.99]) + circIn: /* @__PURE__ */ Vf([0, 0.65, 0.55, 1]), + circOut: /* @__PURE__ */ Vf([0.55, 0, 1, 0.45]), + backIn: /* @__PURE__ */ Vf([0.31, 0.01, 0.66, -0.59]), + backOut: /* @__PURE__ */ Vf([0.33, 1.53, 0.69, 0.99]) }; -function M7(t, e) { +function t9(t, e) { if (t) - return typeof t == "function" && y0() ? YQ(t, e) : Ub(t) ? jf(t) : Array.isArray(t) ? t.map((r) => M7(r, e) || iv.easeOut) : iv[t]; + return typeof t == "function" && R0() ? Iee(t, e) : ty(t) ? Vf(t) : Array.isArray(t) ? t.map((r) => t9(r, e) || wv.easeOut) : wv[t]; } -function ZQ(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatType: o = "loop", ease: a = "easeInOut", times: u } = {}) { +function Ree(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatType: o = "loop", ease: a = "easeInOut", times: u } = {}) { const l = { [e]: r }; u && (l.offset = u); - const d = M7(a, i); + const d = t9(a, i); return Array.isArray(d) && (l.easing = d), t.animate(l, { delay: n, duration: i, @@ -32354,15 +32868,15 @@ function ZQ(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatTyp direction: o === "reverse" ? "alternate" : "normal" }); } -function f_(t, e) { +function P6(t, e) { t.timeline = e, t.onfinish = null; } -const QQ = /* @__PURE__ */ Wb(() => Object.hasOwnProperty.call(Element.prototype, "animate")), w0 = 10, eee = 2e4; -function tee(t) { - return jb(t.type) || t.type === "spring" || !P7(t.ease); +const Dee = /* @__PURE__ */ iy(() => Object.hasOwnProperty.call(Element.prototype, "animate")), D0 = 10, Oee = 2e4; +function Nee(t) { + return ey(t.type) || t.type === "spring" || !e9(t.ease); } -function ree(t, e) { - const r = new zb({ +function Lee(t, e) { + const r = new ny({ ...e, keyframes: t, repeat: 0, @@ -32372,42 +32886,42 @@ function ree(t, e) { let n = { done: !1, value: t[0] }; const i = []; let s = 0; - for (; !n.done && s < eee; ) - n = r.sample(s), i.push(n.value), s += w0; + for (; !n.done && s < Oee; ) + n = r.sample(s), i.push(n.value), s += D0; return { times: void 0, keyframes: i, - duration: s - w0, + duration: s - D0, ease: "linear" }; } -const I7 = { - anticipate: e7, - backInOut: QS, - circInOut: r7 +const r9 = { + anticipate: I7, + backInOut: M7, + circInOut: T7 }; -function nee(t) { - return t in I7; +function kee(t) { + return t in r9; } -class l_ extends y7 { +class M6 extends V7 { constructor(e) { super(e); const { name: r, motionValue: n, element: i, keyframes: s } = this.options; - this.resolver = new b7(s, (o, a) => this.onKeyframesResolved(o, a), r, n, i), this.resolver.scheduleResolve(); + this.resolver = new K7(s, (o, a) => this.onKeyframesResolved(o, a), r, n, i), this.resolver.scheduleResolve(); } initPlayback(e, r) { var n; let { duration: i = 300, times: s, ease: o, type: a, motionValue: u, name: l, startTime: d } = this.options; if (!(!((n = u.owner) === null || n === void 0) && n.current)) return !1; - if (typeof o == "string" && y0() && nee(o) && (o = I7[o]), tee(this.options)) { - const { onComplete: w, onUpdate: A, motionValue: M, element: N, ...L } = this.options, B = ree(e, L); + if (typeof o == "string" && R0() && kee(o) && (o = r9[o]), Nee(this.options)) { + const { onComplete: w, onUpdate: _, motionValue: P, element: O, ...L } = this.options, B = Lee(e, L); e = B.keyframes, e.length === 1 && (e[1] = e[0]), i = B.duration, s = B.times, o = B.ease, a = "keyframes"; } - const p = ZQ(u.owner.current, l, e, { ...this.options, duration: i, times: s, ease: o }); - return p.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (f_(p, this.pendingTimeline), this.pendingTimeline = void 0) : p.onfinish = () => { + const p = Ree(u.owner.current, l, e, { ...this.options, duration: i, times: s, ease: o }); + return p.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (P6(p, this.pendingTimeline), this.pendingTimeline = void 0) : p.onfinish = () => { const { onComplete: w } = this.options; - u.set(wp(e, this.options, r)), w && w(), this.cancel(), this.resolveFinishedPromise(); + u.set(Np(e, this.options, r)), w && w(), this.cancel(), this.resolveFinishedPromise(); }, { animation: p, duration: i, @@ -32422,21 +32936,21 @@ class l_ extends y7 { if (!e) return 0; const { duration: r } = e; - return To(r); + return No(r); } get time() { const { resolved: e } = this; if (!e) return 0; const { animation: r } = e; - return To(r.currentTime || 0); + return No(r.currentTime || 0); } set time(e) { const { resolved: r } = this; if (!r) return; const { animation: n } = r; - n.currentTime = Vs(e); + n.currentTime = Js(e); } get speed() { const { resolved: e } = this; @@ -32478,7 +32992,7 @@ class l_ extends y7 { if (!r) return Un; const { animation: n } = r; - f_(n, e); + P6(n, e); } return Un; } @@ -32509,16 +33023,16 @@ class l_ extends y7 { if (r.playState === "idle" || r.playState === "finished") return; if (this.time) { - const { motionValue: l, onUpdate: d, onComplete: p, element: w, ...A } = this.options, M = new zb({ - ...A, + const { motionValue: l, onUpdate: d, onComplete: p, element: w, ..._ } = this.options, P = new ny({ + ..._, keyframes: n, duration: i, type: s, ease: o, times: a, isGenerator: !0 - }), N = Vs(this.time); - l.setWithVelocity(M.sample(N - w0).value, M.sample(N).value, w0); + }), O = Js(this.time); + l.setWithVelocity(P.sample(O - D0).value, P.sample(O).value, D0); } const { onStop: u } = this.options; u && u(), this.cancel(); @@ -32533,15 +33047,15 @@ class l_ extends y7 { } static supports(e) { const { motionValue: r, name: n, repeatDelay: i, repeatType: s, damping: o, type: a } = e; - return QQ() && n && VQ.has(n) && r && r.owner && r.owner.current instanceof HTMLElement && /** + return Dee() && n && Pee.has(n) && r && r.owner && r.owner.current instanceof HTMLElement && /** * If we're outputting values to onUpdate then we can't use WAAPI as there's * no way to read the value from WAAPI every frame. */ !r.owner.getProps().onUpdate && !i && s !== "mirror" && o !== 0 && a !== "inertia"; } } -const iee = Wb(() => window.ScrollTimeline !== void 0); -class see { +const $ee = iy(() => window.ScrollTimeline !== void 0); +class Bee { constructor(e) { this.stop = () => this.runAll("stop"), this.animations = e.filter(Boolean); } @@ -32559,7 +33073,7 @@ class see { this.animations[n][e] = r; } attachTimeline(e, r) { - const n = this.animations.map((i) => iee() && i.attachTimeline ? i.attachTimeline(e) : r(i)); + const n = this.animations.map((i) => $ee() && i.attachTimeline ? i.attachTimeline(e) : r(i)); return () => { n.forEach((i, s) => { i && i(), this.animations[s].stop(); @@ -32606,13 +33120,13 @@ class see { this.runAll("complete"); } } -function oee({ when: t, delay: e, delayChildren: r, staggerChildren: n, staggerDirection: i, repeat: s, repeatType: o, repeatDelay: a, from: u, elapsed: l, ...d }) { +function Fee({ when: t, delay: e, delayChildren: r, staggerChildren: n, staggerDirection: i, repeat: s, repeatType: o, repeatDelay: a, from: u, elapsed: l, ...d }) { return !!Object.keys(d).length; } -const Hb = (t, e, r, n = {}, i, s) => (o) => { - const a = Rb(n, t) || {}, u = a.delay || n.delay || 0; +const sy = (t, e, r, n = {}, i, s) => (o) => { + const a = Hb(n, t) || {}, u = a.delay || n.delay || 0; let { elapsed: l = 0 } = n; - l = l - Vs(u); + l = l - Js(u); let d = { keyframes: Array.isArray(r) ? r : [null, r], ease: "easeOut", @@ -32629,33 +33143,33 @@ const Hb = (t, e, r, n = {}, i, s) => (o) => { motionValue: e, element: s ? void 0 : i }; - oee(a) || (d = { + Fee(a) || (d = { ...d, - ...SZ(t, d) - }), d.duration && (d.duration = Vs(d.duration)), d.repeatDelay && (d.repeatDelay = Vs(d.repeatDelay)), d.from !== void 0 && (d.keyframes[0] = d.from); + ...nQ(t, d) + }), d.duration && (d.duration = Js(d.duration)), d.repeatDelay && (d.repeatDelay = Js(d.repeatDelay)), d.from !== void 0 && (d.keyframes[0] = d.from); let p = !1; if ((d.type === !1 || d.duration === 0 && !d.repeatDelay) && (d.duration = 0, d.delay === 0 && (p = !0)), p && !s && e.get() !== void 0) { - const w = wp(d.keyframes, a); + const w = Np(d.keyframes, a); if (w !== void 0) return Lr.update(() => { d.onUpdate(w), d.onComplete(); - }), new see([]); + }), new Bee([]); } - return !s && l_.supports(d) ? new l_(d) : new zb(d); -}, aee = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), cee = (t) => X1(t) ? t[t.length - 1] || 0 : t; -function Kb(t, e) { + return !s && M6.supports(d) ? new M6(d) : new ny(d); +}, jee = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), Uee = (t) => dv(t) ? t[t.length - 1] || 0 : t; +function oy(t, e) { t.indexOf(e) === -1 && t.push(e); } -function Vb(t, e) { +function ay(t, e) { const r = t.indexOf(e); r > -1 && t.splice(r, 1); } -class Gb { +class cy { constructor() { this.subscriptions = []; } add(e) { - return Kb(this.subscriptions, e), () => Vb(this.subscriptions, e); + return oy(this.subscriptions, e), () => ay(this.subscriptions, e); } notify(e, r, n) { const i = this.subscriptions.length; @@ -32675,8 +33189,8 @@ class Gb { this.subscriptions.length = 0; } } -const h_ = 30, uee = (t) => !isNaN(parseFloat(t)); -class fee { +const I6 = 30, qee = (t) => !isNaN(parseFloat(t)); +class zee { /** * @param init - The initiating value * @param config - Optional configuration options @@ -32687,12 +33201,12 @@ class fee { */ constructor(e, r = {}) { this.version = "11.11.17", this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (n, i = !0) => { - const s = Ys.now(); + const s = Zs.now(); this.updatedAt !== s && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(n), this.current !== this.prev && this.events.change && this.events.change.notify(this.current), i && this.events.renderRequest && this.events.renderRequest.notify(this.current); }, this.hasAnimated = !1, this.setCurrent(e), this.owner = r.owner; } setCurrent(e) { - this.current = e, this.updatedAt = Ys.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = uee(this.current)); + this.current = e, this.updatedAt = Zs.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = qee(this.current)); } setPrevFrameValue(e = this.current) { this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt; @@ -32738,10 +33252,10 @@ class fee { * @deprecated */ onChange(e) { - return process.env.NODE_ENV !== "production" && vp(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e); + return process.env.NODE_ENV !== "production" && Rp(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e); } on(e, r) { - this.events[e] || (this.events[e] = new Gb()); + this.events[e] || (this.events[e] = new cy()); const n = this.events[e].add(r); return e === "change" ? () => { n(), Lr.read(() => { @@ -32813,11 +33327,11 @@ class fee { * @public */ getVelocity() { - const e = Ys.now(); - if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > h_) + const e = Zs.now(); + if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > I6) return 0; - const r = Math.min(this.updatedAt - this.prevUpdatedAt, h_); - return w7(parseFloat(this.current) - parseFloat(this.prevFrameValue), r); + const r = Math.min(this.updatedAt - this.prevUpdatedAt, I6); + return G7(parseFloat(this.current) - parseFloat(this.prevFrameValue), r); } /** * Registers a new animation to control this `MotionValue`. Only one @@ -32870,77 +33384,77 @@ class fee { this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect(); } } -function Rl(t, e) { - return new fee(t, e); +function ql(t, e) { + return new zee(t, e); } -function lee(t, e, r) { - t.hasValue(e) ? t.getValue(e).set(r) : t.addValue(e, Rl(r)); +function Wee(t, e, r) { + t.hasValue(e) ? t.getValue(e).set(r) : t.addValue(e, ql(r)); } -function hee(t, e) { - const r = yp(t, e); +function Hee(t, e) { + const r = Op(t, e); let { transitionEnd: n = {}, transition: i = {}, ...s } = r || {}; s = { ...s, ...n }; for (const o in s) { - const a = cee(s[o]); - lee(t, o, a); + const a = Uee(s[o]); + Wee(t, o, a); } } -const Yb = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), dee = "framerAppearId", C7 = "data-" + Yb(dee); -function T7(t) { - return t.props[C7]; +const uy = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), Kee = "framerAppearId", n9 = "data-" + uy(Kee); +function i9(t) { + return t.props[n9]; } -const Xn = (t) => !!(t && t.getVelocity); -function pee(t) { - return !!(Xn(t) && t.add); +const Zn = (t) => !!(t && t.getVelocity); +function Vee(t) { + return !!(Zn(t) && t.add); } -function sv(t, e) { +function xv(t, e) { const r = t.getValue("willChange"); - if (pee(r)) + if (Vee(r)) return r.add(e); } -function gee({ protectedKeys: t, needsAnimating: e }, r) { +function Gee({ protectedKeys: t, needsAnimating: e }, r) { const n = t.hasOwnProperty(r) && e[r] !== !0; return e[r] = !1, n; } -function R7(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { +function s9(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { var s; let { transition: o = t.getDefaultTransition(), transitionEnd: a, ...u } = e; n && (o = n); const l = [], d = i && t.animationState && t.animationState.getState()[i]; for (const p in u) { - const w = t.getValue(p, (s = t.latestValues[p]) !== null && s !== void 0 ? s : null), A = u[p]; - if (A === void 0 || d && gee(d, p)) + const w = t.getValue(p, (s = t.latestValues[p]) !== null && s !== void 0 ? s : null), _ = u[p]; + if (_ === void 0 || d && Gee(d, p)) continue; - const M = { + const P = { delay: r, - ...Rb(o || {}, p) + ...Hb(o || {}, p) }; - let N = !1; + let O = !1; if (window.MotionHandoffAnimation) { - const B = T7(t); + const B = i9(t); if (B) { - const $ = window.MotionHandoffAnimation(B, p, Lr); - $ !== null && (M.startTime = $, N = !0); + const k = window.MotionHandoffAnimation(B, p, Lr); + k !== null && (P.startTime = k, O = !0); } } - sv(t, p), w.start(Hb(p, w, A, t.shouldReduceMotion && Ac.has(p) ? { type: !1 } : M, t, N)); + xv(t, p), w.start(sy(p, w, _, t.shouldReduceMotion && Lc.has(p) ? { type: !1 } : P, t, O)); const L = w.animation; L && l.push(L); } return a && Promise.all(l).then(() => { Lr.update(() => { - a && hee(t, a); + a && Hee(t, a); }); }), l; } -function ov(t, e, r = {}) { +function _v(t, e, r = {}) { var n; - const i = yp(t, e, r.type === "exit" ? (n = t.presenceContext) === null || n === void 0 ? void 0 : n.custom : void 0); + const i = Op(t, e, r.type === "exit" ? (n = t.presenceContext) === null || n === void 0 ? void 0 : n.custom : void 0); let { transition: s = t.getDefaultTransition() || {} } = i || {}; r.transitionOverride && (s = r.transitionOverride); - const o = i ? () => Promise.all(R7(t, i, r)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (l = 0) => { + const o = i ? () => Promise.all(s9(t, i, r)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (l = 0) => { const { delayChildren: d = 0, staggerChildren: p, staggerDirection: w } = s; - return mee(t, e, d + l, p, w, r); + return Yee(t, e, d + l, p, w, r); } : () => Promise.resolve(), { when: u } = s; if (u) { const [l, d] = u === "beforeChildren" ? [o, a] : [a, o]; @@ -32948,61 +33462,61 @@ function ov(t, e, r = {}) { } else return Promise.all([o(), a(r.delay)]); } -function mee(t, e, r = 0, n = 0, i = 1, s) { +function Yee(t, e, r = 0, n = 0, i = 1, s) { const o = [], a = (t.variantChildren.size - 1) * n, u = i === 1 ? (l = 0) => l * n : (l = 0) => a - l * n; - return Array.from(t.variantChildren).sort(vee).forEach((l, d) => { - l.notify("AnimationStart", e), o.push(ov(l, e, { + return Array.from(t.variantChildren).sort(Jee).forEach((l, d) => { + l.notify("AnimationStart", e), o.push(_v(l, e, { ...s, delay: r + u(d) }).then(() => l.notify("AnimationComplete", e))); }), Promise.all(o); } -function vee(t, e) { +function Jee(t, e) { return t.sortNodePosition(e); } -function bee(t, e, r = {}) { +function Xee(t, e, r = {}) { t.notify("AnimationStart", e); let n; if (Array.isArray(e)) { - const i = e.map((s) => ov(t, s, r)); + const i = e.map((s) => _v(t, s, r)); n = Promise.all(i); } else if (typeof e == "string") - n = ov(t, e, r); + n = _v(t, e, r); else { - const i = typeof e == "function" ? yp(t, e, r.custom) : e; - n = Promise.all(R7(t, i, r)); + const i = typeof e == "function" ? Op(t, e, r.custom) : e; + n = Promise.all(s9(t, i, r)); } return n.then(() => { t.notify("AnimationComplete", e); }); } -const yee = Tb.length; -function D7(t) { +const Zee = Wb.length; +function o9(t) { if (!t) return; if (!t.isControllingVariants) { - const r = t.parent ? D7(t.parent) || {} : {}; + const r = t.parent ? o9(t.parent) || {} : {}; return t.props.initial !== void 0 && (r.initial = t.props.initial), r; } const e = {}; - for (let r = 0; r < yee; r++) { - const n = Tb[r], i = t.props[n]; - (Il(i) || i === !1) && (e[n] = i); + for (let r = 0; r < Zee; r++) { + const n = Wb[r], i = t.props[n]; + (Fl(i) || i === !1) && (e[n] = i); } return e; } -const wee = [...Cb].reverse(), xee = Cb.length; -function _ee(t) { - return (e) => Promise.all(e.map(({ animation: r, options: n }) => bee(t, r, n))); +const Qee = [...zb].reverse(), ete = zb.length; +function tte(t) { + return (e) => Promise.all(e.map(({ animation: r, options: n }) => Xee(t, r, n))); } -function Eee(t) { - let e = _ee(t), r = d_(), n = !0; +function rte(t) { + let e = tte(t), r = C6(), n = !0; const i = (u) => (l, d) => { var p; - const w = yp(t, d, u === "exit" ? (p = t.presenceContext) === null || p === void 0 ? void 0 : p.custom : void 0); + const w = Op(t, d, u === "exit" ? (p = t.presenceContext) === null || p === void 0 ? void 0 : p.custom : void 0); if (w) { - const { transition: A, transitionEnd: M, ...N } = w; - l = { ...l, ...N, ...M }; + const { transition: _, transitionEnd: P, ...O } = w; + l = { ...l, ...O, ...P }; } return l; }; @@ -33010,40 +33524,40 @@ function Eee(t) { e = u(t); } function o(u) { - const { props: l } = t, d = D7(t.parent) || {}, p = [], w = /* @__PURE__ */ new Set(); - let A = {}, M = 1 / 0; - for (let L = 0; L < xee; L++) { - const B = wee[L], $ = r[B], H = l[B] !== void 0 ? l[B] : d[B], U = Il(H), V = B === u ? $.isActive : null; - V === !1 && (M = L); - let te = H === d[B] && H !== l[B] && U; - if (te && n && t.manuallyAnimateOnMount && (te = !1), $.protectedKeys = { ...A }, // If it isn't active and hasn't *just* been set as inactive - !$.isActive && V === null || // If we didn't and don't have any defined prop for this animation type - !H && !$.prevProp || // Or if the prop doesn't define an animation - bp(H) || typeof H == "boolean") + const { props: l } = t, d = o9(t.parent) || {}, p = [], w = /* @__PURE__ */ new Set(); + let _ = {}, P = 1 / 0; + for (let L = 0; L < ete; L++) { + const B = Qee[L], k = r[B], q = l[B] !== void 0 ? l[B] : d[B], U = Fl(q), V = B === u ? k.isActive : null; + V === !1 && (P = L); + let Q = q === d[B] && q !== l[B] && U; + if (Q && n && t.manuallyAnimateOnMount && (Q = !1), k.protectedKeys = { ..._ }, // If it isn't active and hasn't *just* been set as inactive + !k.isActive && V === null || // If we didn't and don't have any defined prop for this animation type + !q && !k.prevProp || // Or if the prop doesn't define an animation + Dp(q) || typeof q == "boolean") continue; - const R = See($.prevProp, H); + const R = nte(k.prevProp, q); let K = R || // If we're making this variant active, we want to always make it active - B === u && $.isActive && !te && U || // If we removed a higher-priority variant (i is in reverse order) - L > M && U, ge = !1; - const Ee = Array.isArray(H) ? H : [H]; + B === u && k.isActive && !Q && U || // If we removed a higher-priority variant (i is in reverse order) + L > P && U, ge = !1; + const Ee = Array.isArray(q) ? q : [q]; let Y = Ee.reduce(i(B), {}); V === !1 && (Y = {}); - const { prevResolvedValues: S = {} } = $, m = { - ...S, + const { prevResolvedValues: A = {} } = k, m = { + ...A, ...Y }, f = (x) => { - K = !0, w.has(x) && (ge = !0, w.delete(x)), $.needsAnimating[x] = !0; - const _ = t.getValue(x); - _ && (_.liveStyle = !1); + K = !0, w.has(x) && (ge = !0, w.delete(x)), k.needsAnimating[x] = !0; + const E = t.getValue(x); + E && (E.liveStyle = !1); }; for (const x in m) { - const _ = Y[x], E = S[x]; - if (A.hasOwnProperty(x)) + const E = Y[x], S = A[x]; + if (_.hasOwnProperty(x)) continue; let v = !1; - X1(_) && X1(E) ? v = !VS(_, E) : v = _ !== E, v ? _ != null ? f(x) : w.add(x) : _ !== void 0 && w.has(x) ? f(x) : $.protectedKeys[x] = !0; + dv(E) && dv(S) ? v = !x7(E, S) : v = E !== S, v ? E != null ? f(x) : w.add(x) : E !== void 0 && w.has(x) ? f(x) : k.protectedKeys[x] = !0; } - $.prevProp = H, $.prevResolvedValues = Y, $.isActive && (A = { ...A, ...Y }), n && t.blockInitialAnimation && (K = !1), K && (!(te && R) || ge) && p.push(...Ee.map((x) => ({ + k.prevProp = q, k.prevResolvedValues = Y, k.isActive && (_ = { ..._, ...Y }), n && t.blockInitialAnimation && (K = !1), K && (!(Q && R) || ge) && p.push(...Ee.map((x) => ({ animation: x, options: { type: B } }))); @@ -33051,20 +33565,20 @@ function Eee(t) { if (w.size) { const L = {}; w.forEach((B) => { - const $ = t.getBaseTarget(B), H = t.getValue(B); - H && (H.liveStyle = !0), L[B] = $ ?? null; + const k = t.getBaseTarget(B), q = t.getValue(B); + q && (q.liveStyle = !0), L[B] = k ?? null; }), p.push({ animation: L }); } - let N = !!p.length; - return n && (l.initial === !1 || l.initial === l.animate) && !t.manuallyAnimateOnMount && (N = !1), n = !1, N ? e(p) : Promise.resolve(); + let O = !!p.length; + return n && (l.initial === !1 || l.initial === l.animate) && !t.manuallyAnimateOnMount && (O = !1), n = !1, O ? e(p) : Promise.resolve(); } function a(u, l) { var d; if (r[u].isActive === l) return Promise.resolve(); (d = t.variantChildren) === null || d === void 0 || d.forEach((w) => { - var A; - return (A = w.animationState) === null || A === void 0 ? void 0 : A.setActive(u, l); + var _; + return (_ = w.animationState) === null || _ === void 0 ? void 0 : _.setActive(u, l); }), r[u].isActive = l; const p = o(u); for (const w in r) @@ -33077,14 +33591,14 @@ function Eee(t) { setAnimateFunction: s, getState: () => r, reset: () => { - r = d_(), n = !0; + r = C6(), n = !0; } }; } -function See(t, e) { - return typeof e == "string" ? e !== t : Array.isArray(e) ? !VS(e, t) : !1; +function nte(t, e) { + return typeof e == "string" ? e !== t : Array.isArray(e) ? !x7(e, t) : !1; } -function Va(t = !1) { +function Qa(t = !1) { return { isActive: t, protectedKeys: {}, @@ -33092,36 +33606,36 @@ function Va(t = !1) { prevResolvedValues: {} }; } -function d_() { +function C6() { return { - animate: Va(!0), - whileInView: Va(), - whileHover: Va(), - whileTap: Va(), - whileDrag: Va(), - whileFocus: Va(), - exit: Va() + animate: Qa(!0), + whileInView: Qa(), + whileHover: Qa(), + whileTap: Qa(), + whileDrag: Qa(), + whileFocus: Qa(), + exit: Qa() }; } -class Ra { +class $a { constructor(e) { this.isMounted = !1, this.node = e; } update() { } } -class Aee extends Ra { +class ite extends $a { /** * We dynamically generate the AnimationState manager as it contains a reference * to the underlying animation library. We only want to load that if we load this, * so people can optionally code split it out using the `m` component. */ constructor(e) { - super(e), e.animationState || (e.animationState = Eee(e)); + super(e), e.animationState || (e.animationState = rte(e)); } updateAnimationControlsSubscription() { const { animate: e } = this.node.getProps(); - bp(e) && (this.unmountControls = e.subscribe(this.node)); + Dp(e) && (this.unmountControls = e.subscribe(this.node)); } /** * Subscribe any provided AnimationControls to the component's VisualElement @@ -33138,10 +33652,10 @@ class Aee extends Ra { this.node.animationState.reset(), (e = this.unmountControls) === null || e === void 0 || e.call(this); } } -let Pee = 0; -class Mee extends Ra { +let ste = 0; +class ote extends $a { constructor() { - super(...arguments), this.id = Pee++; + super(...arguments), this.id = ste++; } update() { if (!this.node.presenceContext) @@ -33159,15 +33673,15 @@ class Mee extends Ra { unmount() { } } -const Iee = { +const ate = { animation: { - Feature: Aee + Feature: ite }, exit: { - Feature: Mee + Feature: ote } -}, O7 = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1; -function xp(t, e = "page") { +}, a9 = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1; +function Lp(t, e = "page") { return { point: { x: t[`${e}X`], @@ -33175,84 +33689,84 @@ function xp(t, e = "page") { } }; } -const Cee = (t) => (e) => O7(e) && t(e, xp(e)); -function Mo(t, e, r, n = { passive: !0 }) { +const cte = (t) => (e) => a9(e) && t(e, Lp(e)); +function Ro(t, e, r, n = { passive: !0 }) { return t.addEventListener(e, r, n), () => t.removeEventListener(e, r); } -function Do(t, e, r, n) { - return Mo(t, e, Cee(r), n); +function ko(t, e, r, n) { + return Ro(t, e, cte(r), n); } -const p_ = (t, e) => Math.abs(t - e); -function Tee(t, e) { - const r = p_(t.x, e.x), n = p_(t.y, e.y); +const T6 = (t, e) => Math.abs(t - e); +function ute(t, e) { + const r = T6(t.x, e.x), n = T6(t.y, e.y); return Math.sqrt(r ** 2 + n ** 2); } -class N7 { +class c9 { constructor(e, r, { transformPagePoint: n, contextWindow: i, dragSnapToOrigin: s = !1 } = {}) { if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.updatePoint = () => { if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return; - const p = Bm(this.lastMoveEventInfo, this.history), w = this.startEvent !== null, A = Tee(p.offset, { x: 0, y: 0 }) >= 3; - if (!w && !A) + const p = Zm(this.lastMoveEventInfo, this.history), w = this.startEvent !== null, _ = ute(p.offset, { x: 0, y: 0 }) >= 3; + if (!w && !_) return; - const { point: M } = p, { timestamp: N } = Fn; - this.history.push({ ...M, timestamp: N }); + const { point: P } = p, { timestamp: O } = Fn; + this.history.push({ ...P, timestamp: O }); const { onStart: L, onMove: B } = this.handlers; w || (L && L(this.lastMoveEvent, p), this.startEvent = this.lastMoveEvent), B && B(this.lastMoveEvent, p); }, this.handlePointerMove = (p, w) => { - this.lastMoveEvent = p, this.lastMoveEventInfo = $m(w, this.transformPagePoint), Lr.update(this.updatePoint, !0); + this.lastMoveEvent = p, this.lastMoveEventInfo = Xm(w, this.transformPagePoint), Lr.update(this.updatePoint, !0); }, this.handlePointerUp = (p, w) => { this.end(); - const { onEnd: A, onSessionEnd: M, resumeAnimation: N } = this.handlers; - if (this.dragSnapToOrigin && N && N(), !(this.lastMoveEvent && this.lastMoveEventInfo)) + const { onEnd: _, onSessionEnd: P, resumeAnimation: O } = this.handlers; + if (this.dragSnapToOrigin && O && O(), !(this.lastMoveEvent && this.lastMoveEventInfo)) return; - const L = Bm(p.type === "pointercancel" ? this.lastMoveEventInfo : $m(w, this.transformPagePoint), this.history); - this.startEvent && A && A(p, L), M && M(p, L); - }, !O7(e)) + const L = Zm(p.type === "pointercancel" ? this.lastMoveEventInfo : Xm(w, this.transformPagePoint), this.history); + this.startEvent && _ && _(p, L), P && P(p, L); + }, !a9(e)) return; this.dragSnapToOrigin = s, this.handlers = r, this.transformPagePoint = n, this.contextWindow = i || window; - const o = xp(e), a = $m(o, this.transformPagePoint), { point: u } = a, { timestamp: l } = Fn; + const o = Lp(e), a = Xm(o, this.transformPagePoint), { point: u } = a, { timestamp: l } = Fn; this.history = [{ ...u, timestamp: l }]; const { onSessionStart: d } = r; - d && d(e, Bm(a, this.history)), this.removeListeners = Ro(Do(this.contextWindow, "pointermove", this.handlePointerMove), Do(this.contextWindow, "pointerup", this.handlePointerUp), Do(this.contextWindow, "pointercancel", this.handlePointerUp)); + d && d(e, Zm(a, this.history)), this.removeListeners = Lo(ko(this.contextWindow, "pointermove", this.handlePointerMove), ko(this.contextWindow, "pointerup", this.handlePointerUp), ko(this.contextWindow, "pointercancel", this.handlePointerUp)); } updateHandlers(e) { this.handlers = e; } end() { - this.removeListeners && this.removeListeners(), wa(this.updatePoint); + this.removeListeners && this.removeListeners(), Pa(this.updatePoint); } } -function $m(t, e) { +function Xm(t, e) { return e ? { point: e(t.point) } : t; } -function g_(t, e) { +function R6(t, e) { return { x: t.x - e.x, y: t.y - e.y }; } -function Bm({ point: t }, e) { +function Zm({ point: t }, e) { return { point: t, - delta: g_(t, L7(e)), - offset: g_(t, Ree(e)), - velocity: Dee(e, 0.1) + delta: R6(t, u9(e)), + offset: R6(t, fte(e)), + velocity: lte(e, 0.1) }; } -function Ree(t) { +function fte(t) { return t[0]; } -function L7(t) { +function u9(t) { return t[t.length - 1]; } -function Dee(t, e) { +function lte(t, e) { if (t.length < 2) return { x: 0, y: 0 }; let r = t.length - 1, n = null; - const i = L7(t); - for (; r >= 0 && (n = t[r], !(i.timestamp - n.timestamp > Vs(e))); ) + const i = u9(t); + for (; r >= 0 && (n = t[r], !(i.timestamp - n.timestamp > Js(e))); ) r--; if (!n) return { x: 0, y: 0 }; - const s = To(i.timestamp - n.timestamp); + const s = No(i.timestamp - n.timestamp); if (s === 0) return { x: 0, y: 0 }; const o = { @@ -33261,7 +33775,7 @@ function Dee(t, e) { }; return o.x === 1 / 0 && (o.x = 0), o.y === 1 / 0 && (o.y = 0), o; } -function k7(t) { +function f9(t) { let e = null; return () => { const r = () => { @@ -33270,128 +33784,128 @@ function k7(t) { return e === null ? (e = t, r) : !1; }; } -const m_ = k7("dragHorizontal"), v_ = k7("dragVertical"); -function $7(t) { +const D6 = f9("dragHorizontal"), O6 = f9("dragVertical"); +function l9(t) { let e = !1; if (t === "y") - e = v_(); + e = O6(); else if (t === "x") - e = m_(); + e = D6(); else { - const r = m_(), n = v_(); + const r = D6(), n = O6(); r && n ? e = () => { r(), n(); } : (r && r(), n && n()); } return e; } -function B7() { - const t = $7(!0); +function h9() { + const t = l9(!0); return t ? (t(), !1) : !0; } -function tu(t) { +function lu(t) { return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current"); } -const F7 = 1e-4, Oee = 1 - F7, Nee = 1 + F7, j7 = 0.01, Lee = 0 - j7, kee = 0 + j7; -function Li(t) { +const d9 = 1e-4, hte = 1 - d9, dte = 1 + d9, p9 = 0.01, pte = 0 - p9, gte = 0 + p9; +function ki(t) { return t.max - t.min; } -function $ee(t, e, r) { +function mte(t, e, r) { return Math.abs(t - e) <= r; } -function b_(t, e, r, n = 0.5) { - t.origin = n, t.originPoint = Qr(e.min, e.max, t.origin), t.scale = Li(r) / Li(e), t.translate = Qr(r.min, r.max, t.origin) - t.originPoint, (t.scale >= Oee && t.scale <= Nee || isNaN(t.scale)) && (t.scale = 1), (t.translate >= Lee && t.translate <= kee || isNaN(t.translate)) && (t.translate = 0); +function N6(t, e, r, n = 0.5) { + t.origin = n, t.originPoint = Qr(e.min, e.max, t.origin), t.scale = ki(r) / ki(e), t.translate = Qr(r.min, r.max, t.origin) - t.originPoint, (t.scale >= hte && t.scale <= dte || isNaN(t.scale)) && (t.scale = 1), (t.translate >= pte && t.translate <= gte || isNaN(t.translate)) && (t.translate = 0); } -function Jf(t, e, r, n) { - b_(t.x, e.x, r.x, n ? n.originX : void 0), b_(t.y, e.y, r.y, n ? n.originY : void 0); +function nl(t, e, r, n) { + N6(t.x, e.x, r.x, n ? n.originX : void 0), N6(t.y, e.y, r.y, n ? n.originY : void 0); } -function y_(t, e, r) { - t.min = r.min + e.min, t.max = t.min + Li(e); +function L6(t, e, r) { + t.min = r.min + e.min, t.max = t.min + ki(e); } -function Bee(t, e, r) { - y_(t.x, e.x, r.x), y_(t.y, e.y, r.y); +function vte(t, e, r) { + L6(t.x, e.x, r.x), L6(t.y, e.y, r.y); } -function w_(t, e, r) { - t.min = e.min - r.min, t.max = t.min + Li(e); +function k6(t, e, r) { + t.min = e.min - r.min, t.max = t.min + ki(e); } -function Xf(t, e, r) { - w_(t.x, e.x, r.x), w_(t.y, e.y, r.y); +function il(t, e, r) { + k6(t.x, e.x, r.x), k6(t.y, e.y, r.y); } -function Fee(t, { min: e, max: r }, n) { +function bte(t, { min: e, max: r }, n) { return e !== void 0 && t < e ? t = n ? Qr(e, t, n.min) : Math.max(t, e) : r !== void 0 && t > r && (t = n ? Qr(r, t, n.max) : Math.min(t, r)), t; } -function x_(t, e, r) { +function $6(t, e, r) { return { min: e !== void 0 ? t.min + e : void 0, max: r !== void 0 ? t.max + r - (t.max - t.min) : void 0 }; } -function jee(t, { top: e, left: r, bottom: n, right: i }) { +function yte(t, { top: e, left: r, bottom: n, right: i }) { return { - x: x_(t.x, r, i), - y: x_(t.y, e, n) + x: $6(t.x, r, i), + y: $6(t.y, e, n) }; } -function __(t, e) { +function B6(t, e) { let r = e.min - t.min, n = e.max - t.max; return e.max - e.min < t.max - t.min && ([r, n] = [n, r]), { min: r, max: n }; } -function Uee(t, e) { +function wte(t, e) { return { - x: __(t.x, e.x), - y: __(t.y, e.y) + x: B6(t.x, e.x), + y: B6(t.y, e.y) }; } -function qee(t, e) { +function xte(t, e) { let r = 0.5; - const n = Li(t), i = Li(e); - return i > n ? r = Iu(e.min, e.max - n, t.min) : n > i && (r = Iu(t.min, t.max - i, e.min)), xa(0, 1, r); + const n = ki(t), i = ki(e); + return i > n ? r = $u(e.min, e.max - n, t.min) : n > i && (r = $u(t.min, t.max - i, e.min)), Ma(0, 1, r); } -function zee(t, e) { +function _te(t, e) { const r = {}; return e.min !== void 0 && (r.min = e.min - t.min), e.max !== void 0 && (r.max = e.max - t.min), r; } -const av = 0.35; -function Wee(t = av) { - return t === !1 ? t = 0 : t === !0 && (t = av), { - x: E_(t, "left", "right"), - y: E_(t, "top", "bottom") +const Ev = 0.35; +function Ete(t = Ev) { + return t === !1 ? t = 0 : t === !0 && (t = Ev), { + x: F6(t, "left", "right"), + y: F6(t, "top", "bottom") }; } -function E_(t, e, r) { +function F6(t, e, r) { return { - min: S_(t, e), - max: S_(t, r) + min: j6(t, e), + max: j6(t, r) }; } -function S_(t, e) { +function j6(t, e) { return typeof t == "number" ? t : t[e] || 0; } -const A_ = () => ({ +const U6 = () => ({ translate: 0, scale: 1, origin: 0, originPoint: 0 -}), ru = () => ({ - x: A_(), - y: A_() -}), P_ = () => ({ min: 0, max: 0 }), ln = () => ({ - x: P_(), - y: P_() +}), hu = () => ({ + x: U6(), + y: U6() +}), q6 = () => ({ min: 0, max: 0 }), ln = () => ({ + x: q6(), + y: q6() }); -function Xi(t) { +function Qi(t) { return [t("x"), t("y")]; } -function U7({ top: t, left: e, right: r, bottom: n }) { +function g9({ top: t, left: e, right: r, bottom: n }) { return { x: { min: e, max: r }, y: { min: t, max: n } }; } -function Hee({ x: t, y: e }) { +function Ste({ x: t, y: e }) { return { top: e.min, right: t.max, bottom: e.max, left: t.min }; } -function Kee(t, e) { +function Ate(t, e) { if (!e) return t; const r = e({ x: t.left, y: t.top }), n = e({ x: t.right, y: t.bottom }); @@ -33402,36 +33916,36 @@ function Kee(t, e) { right: n.x }; } -function Fm(t) { +function Qm(t) { return t === void 0 || t === 1; } -function cv({ scale: t, scaleX: e, scaleY: r }) { - return !Fm(t) || !Fm(e) || !Fm(r); +function Sv({ scale: t, scaleX: e, scaleY: r }) { + return !Qm(t) || !Qm(e) || !Qm(r); } -function Ya(t) { - return cv(t) || q7(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY; +function tc(t) { + return Sv(t) || m9(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY; } -function q7(t) { - return M_(t.x) || M_(t.y); +function m9(t) { + return z6(t.x) || z6(t.y); } -function M_(t) { +function z6(t) { return t && t !== "0%"; } -function x0(t, e, r) { +function O0(t, e, r) { const n = t - r, i = e * n; return r + i; } -function I_(t, e, r, n, i) { - return i !== void 0 && (t = x0(t, i, n)), x0(t, r, n) + e; +function W6(t, e, r, n, i) { + return i !== void 0 && (t = O0(t, i, n)), O0(t, r, n) + e; } -function uv(t, e = 0, r = 1, n, i) { - t.min = I_(t.min, e, r, n, i), t.max = I_(t.max, e, r, n, i); +function Av(t, e = 0, r = 1, n, i) { + t.min = W6(t.min, e, r, n, i), t.max = W6(t.max, e, r, n, i); } -function z7(t, { x: e, y: r }) { - uv(t.x, e.translate, e.scale, e.originPoint), uv(t.y, r.translate, r.scale, r.originPoint); +function v9(t, { x: e, y: r }) { + Av(t.x, e.translate, e.scale, e.originPoint), Av(t.y, r.translate, r.scale, r.originPoint); } -const C_ = 0.999999999999, T_ = 1.0000000000001; -function Vee(t, e, r, n = !1) { +const H6 = 0.999999999999, K6 = 1.0000000000001; +function Pte(t, e, r, n = !1) { const i = r.length; if (!i) return; @@ -33440,32 +33954,32 @@ function Vee(t, e, r, n = !1) { for (let a = 0; a < i; a++) { s = r[a], o = s.projectionDelta; const { visualElement: u } = s.options; - u && u.props.style && u.props.style.display === "contents" || (n && s.options.layoutScroll && s.scroll && s !== s.root && iu(t, { + u && u.props.style && u.props.style.display === "contents" || (n && s.options.layoutScroll && s.scroll && s !== s.root && pu(t, { x: -s.scroll.offset.x, y: -s.scroll.offset.y - }), o && (e.x *= o.x.scale, e.y *= o.y.scale, z7(t, o)), n && Ya(s.latestValues) && iu(t, s.latestValues)); + }), o && (e.x *= o.x.scale, e.y *= o.y.scale, v9(t, o)), n && tc(s.latestValues) && pu(t, s.latestValues)); } - e.x < T_ && e.x > C_ && (e.x = 1), e.y < T_ && e.y > C_ && (e.y = 1); + e.x < K6 && e.x > H6 && (e.x = 1), e.y < K6 && e.y > H6 && (e.y = 1); } -function nu(t, e) { +function du(t, e) { t.min = t.min + e, t.max = t.max + e; } -function R_(t, e, r, n, i = 0.5) { +function V6(t, e, r, n, i = 0.5) { const s = Qr(t.min, t.max, i); - uv(t, e, r, s, n); + Av(t, e, r, s, n); } -function iu(t, e) { - R_(t.x, e.x, e.scaleX, e.scale, e.originX), R_(t.y, e.y, e.scaleY, e.scale, e.originY); +function pu(t, e) { + V6(t.x, e.x, e.scaleX, e.scale, e.originX), V6(t.y, e.y, e.scaleY, e.scale, e.originY); } -function W7(t, e) { - return U7(Kee(t.getBoundingClientRect(), e)); +function b9(t, e) { + return g9(Ate(t.getBoundingClientRect(), e)); } -function Gee(t, e, r) { - const n = W7(t, r), { scroll: i } = e; - return i && (nu(n.x, i.offset.x), nu(n.y, i.offset.y)), n; +function Mte(t, e, r) { + const n = b9(t, r), { scroll: i } = e; + return i && (du(n.x, i.offset.x), du(n.y, i.offset.y)), n; } -const H7 = ({ current: t }) => t ? t.ownerDocument.defaultView : null, Yee = /* @__PURE__ */ new WeakMap(); -class Jee { +const y9 = ({ current: t }) => t ? t.ownerDocument.defaultView : null, Ite = /* @__PURE__ */ new WeakMap(); +class Cte { constructor(e) { this.openGlobalLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = ln(), this.visualElement = e; } @@ -33475,39 +33989,39 @@ class Jee { return; const i = (d) => { const { dragSnapToOrigin: p } = this.getProps(); - p ? this.pauseAnimation() : this.stopAnimation(), r && this.snapToCursor(xp(d, "page").point); + p ? this.pauseAnimation() : this.stopAnimation(), r && this.snapToCursor(Lp(d, "page").point); }, s = (d, p) => { - const { drag: w, dragPropagation: A, onDragStart: M } = this.getProps(); - if (w && !A && (this.openGlobalLock && this.openGlobalLock(), this.openGlobalLock = $7(w), !this.openGlobalLock)) + const { drag: w, dragPropagation: _, onDragStart: P } = this.getProps(); + if (w && !_ && (this.openGlobalLock && this.openGlobalLock(), this.openGlobalLock = l9(w), !this.openGlobalLock)) return; - this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), Xi((L) => { + this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), Qi((L) => { let B = this.getAxisMotionValue(L).get() || 0; - if (Gs.test(B)) { - const { projection: $ } = this.visualElement; - if ($ && $.layout) { - const H = $.layout.layoutBox[L]; - H && (B = Li(H) * (parseFloat(B) / 100)); + if (Xs.test(B)) { + const { projection: k } = this.visualElement; + if (k && k.layout) { + const q = k.layout.layoutBox[L]; + q && (B = ki(q) * (parseFloat(B) / 100)); } } this.originPoint[L] = B; - }), M && Lr.postRender(() => M(d, p)), sv(this.visualElement, "transform"); - const { animationState: N } = this.visualElement; - N && N.setActive("whileDrag", !0); + }), P && Lr.postRender(() => P(d, p)), xv(this.visualElement, "transform"); + const { animationState: O } = this.visualElement; + O && O.setActive("whileDrag", !0); }, o = (d, p) => { - const { dragPropagation: w, dragDirectionLock: A, onDirectionLock: M, onDrag: N } = this.getProps(); + const { dragPropagation: w, dragDirectionLock: _, onDirectionLock: P, onDrag: O } = this.getProps(); if (!w && !this.openGlobalLock) return; const { offset: L } = p; - if (A && this.currentDirection === null) { - this.currentDirection = Xee(L), this.currentDirection !== null && M && M(this.currentDirection); + if (_ && this.currentDirection === null) { + this.currentDirection = Tte(L), this.currentDirection !== null && P && P(this.currentDirection); return; } - this.updateAxis("x", p.point, L), this.updateAxis("y", p.point, L), this.visualElement.render(), N && N(d, p); - }, a = (d, p) => this.stop(d, p), u = () => Xi((d) => { + this.updateAxis("x", p.point, L), this.updateAxis("y", p.point, L), this.visualElement.render(), O && O(d, p); + }, a = (d, p) => this.stop(d, p), u = () => Qi((d) => { var p; return this.getAnimationState(d) === "paused" && ((p = this.getAxisMotionValue(d).animation) === null || p === void 0 ? void 0 : p.play()); }), { dragSnapToOrigin: l } = this.getProps(); - this.panSession = new N7(e, { + this.panSession = new c9(e, { onSessionStart: i, onStart: s, onMove: o, @@ -33516,7 +34030,7 @@ class Jee { }, { transformPagePoint: this.visualElement.getTransformPagePoint(), dragSnapToOrigin: l, - contextWindow: H7(this.visualElement) + contextWindow: y9(this.visualElement) }); } stop(e, r) { @@ -33537,66 +34051,66 @@ class Jee { } updateAxis(e, r, n) { const { drag: i } = this.getProps(); - if (!n || !vd(e, i, this.currentDirection)) + if (!n || !Id(e, i, this.currentDirection)) return; const s = this.getAxisMotionValue(e); let o = this.originPoint[e] + n[e]; - this.constraints && this.constraints[e] && (o = Fee(o, this.constraints[e], this.elastic[e])), s.set(o); + this.constraints && this.constraints[e] && (o = bte(o, this.constraints[e], this.elastic[e])), s.set(o); } resolveConstraints() { var e; const { dragConstraints: r, dragElastic: n } = this.getProps(), i = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : (e = this.visualElement.projection) === null || e === void 0 ? void 0 : e.layout, s = this.constraints; - r && tu(r) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : r && i ? this.constraints = jee(i.layoutBox, r) : this.constraints = !1, this.elastic = Wee(n), s !== this.constraints && i && this.constraints && !this.hasMutatedConstraints && Xi((o) => { - this.constraints !== !1 && this.getAxisMotionValue(o) && (this.constraints[o] = zee(i.layoutBox[o], this.constraints[o])); + r && lu(r) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : r && i ? this.constraints = yte(i.layoutBox, r) : this.constraints = !1, this.elastic = Ete(n), s !== this.constraints && i && this.constraints && !this.hasMutatedConstraints && Qi((o) => { + this.constraints !== !1 && this.getAxisMotionValue(o) && (this.constraints[o] = _te(i.layoutBox[o], this.constraints[o])); }); } resolveRefConstraints() { const { dragConstraints: e, onMeasureDragConstraints: r } = this.getProps(); - if (!e || !tu(e)) + if (!e || !lu(e)) return !1; const n = e.current; - Uo(n !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop."); + Wo(n !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop."); const { projection: i } = this.visualElement; if (!i || !i.layout) return !1; - const s = Gee(n, i.root, this.visualElement.getTransformPagePoint()); - let o = Uee(i.layout.layoutBox, s); + const s = Mte(n, i.root, this.visualElement.getTransformPagePoint()); + let o = wte(i.layout.layoutBox, s); if (r) { - const a = r(Hee(o)); - this.hasMutatedConstraints = !!a, a && (o = U7(a)); + const a = r(Ste(o)); + this.hasMutatedConstraints = !!a, a && (o = g9(a)); } return o; } startAnimation(e) { - const { drag: r, dragMomentum: n, dragElastic: i, dragTransition: s, dragSnapToOrigin: o, onDragTransitionEnd: a } = this.getProps(), u = this.constraints || {}, l = Xi((d) => { - if (!vd(d, r, this.currentDirection)) + const { drag: r, dragMomentum: n, dragElastic: i, dragTransition: s, dragSnapToOrigin: o, onDragTransitionEnd: a } = this.getProps(), u = this.constraints || {}, l = Qi((d) => { + if (!Id(d, r, this.currentDirection)) return; let p = u && u[d] || {}; o && (p = { min: 0, max: 0 }); - const w = i ? 200 : 1e6, A = i ? 40 : 1e7, M = { + const w = i ? 200 : 1e6, _ = i ? 40 : 1e7, P = { type: "inertia", velocity: n ? e[d] : 0, bounceStiffness: w, - bounceDamping: A, + bounceDamping: _, timeConstant: 750, restDelta: 1, restSpeed: 10, ...s, ...p }; - return this.startAxisValueAnimation(d, M); + return this.startAxisValueAnimation(d, P); }); return Promise.all(l).then(a); } startAxisValueAnimation(e, r) { const n = this.getAxisMotionValue(e); - return sv(this.visualElement, e), n.start(Hb(e, n, 0, r, this.visualElement, !1)); + return xv(this.visualElement, e), n.start(sy(e, n, 0, r, this.visualElement, !1)); } stopAnimation() { - Xi((e) => this.getAxisMotionValue(e).stop()); + Qi((e) => this.getAxisMotionValue(e).stop()); } pauseAnimation() { - Xi((e) => { + Qi((e) => { var r; return (r = this.getAxisMotionValue(e).animation) === null || r === void 0 ? void 0 : r.pause(); }); @@ -33616,9 +34130,9 @@ class Jee { return i || this.visualElement.getValue(e, (n.initial ? n.initial[e] : void 0) || 0); } snapToCursor(e) { - Xi((r) => { + Qi((r) => { const { drag: n } = this.getProps(); - if (!vd(r, n, this.currentDirection)) + if (!Id(r, n, this.currentDirection)) return; const { projection: i } = this.visualElement, s = this.getAxisMotionValue(r); if (i && i.layout) { @@ -33636,20 +34150,20 @@ class Jee { if (!this.visualElement.current) return; const { drag: e, dragConstraints: r } = this.getProps(), { projection: n } = this.visualElement; - if (!tu(r) || !n || !this.constraints) + if (!lu(r) || !n || !this.constraints) return; this.stopAnimation(); const i = { x: 0, y: 0 }; - Xi((o) => { + Qi((o) => { const a = this.getAxisMotionValue(o); if (a && this.constraints !== !1) { const u = a.get(); - i[o] = qee({ min: u, max: u }, this.constraints[o]); + i[o] = xte({ min: u, max: u }, this.constraints[o]); } }); const { transformTemplate: s } = this.visualElement.getProps(); - this.visualElement.current.style.transform = s ? s({}, "") : "none", n.root && n.root.updateScroll(), n.updateLayout(), this.resolveConstraints(), Xi((o) => { - if (!vd(o, e, null)) + this.visualElement.current.style.transform = s ? s({}, "") : "none", n.root && n.root.updateScroll(), n.updateLayout(), this.resolveConstraints(), Qi((o) => { + if (!Id(o, e, null)) return; const a = this.getAxisMotionValue(o), { min: u, max: l } = this.constraints[o]; a.set(Qr(u, l, i[o])); @@ -33658,17 +34172,17 @@ class Jee { addListeners() { if (!this.visualElement.current) return; - Yee.set(this.visualElement, this); - const e = this.visualElement.current, r = Do(e, "pointerdown", (u) => { + Ite.set(this.visualElement, this); + const e = this.visualElement.current, r = ko(e, "pointerdown", (u) => { const { drag: l, dragListener: d = !0 } = this.getProps(); l && d && this.start(u); }), n = () => { const { dragConstraints: u } = this.getProps(); - tu(u) && u.current && (this.constraints = this.resolveRefConstraints()); + lu(u) && u.current && (this.constraints = this.resolveRefConstraints()); }, { projection: i } = this.visualElement, s = i.addEventListener("measure", n); i && !i.layout && (i.root && i.root.updateScroll(), i.updateLayout()), Lr.read(n); - const o = Mo(window, "resize", () => this.scalePositionWithinConstraints()), a = i.addEventListener("didUpdate", ({ delta: u, hasLayoutChanged: l }) => { - this.isDragging && l && (Xi((d) => { + const o = Ro(window, "resize", () => this.scalePositionWithinConstraints()), a = i.addEventListener("didUpdate", ({ delta: u, hasLayoutChanged: l }) => { + this.isDragging && l && (Qi((d) => { const p = this.getAxisMotionValue(d); p && (this.originPoint[d] += u[d].translate, p.set(p.get() + u[d].translate)); }), this.visualElement.render()); @@ -33678,7 +34192,7 @@ class Jee { }; } getProps() { - const e = this.visualElement.getProps(), { drag: r = !1, dragDirectionLock: n = !1, dragPropagation: i = !1, dragConstraints: s = !1, dragElastic: o = av, dragMomentum: a = !0 } = e; + const e = this.visualElement.getProps(), { drag: r = !1, dragDirectionLock: n = !1, dragPropagation: i = !1, dragConstraints: s = !1, dragElastic: o = Ev, dragMomentum: a = !0 } = e; return { ...e, drag: r, @@ -33690,16 +34204,16 @@ class Jee { }; } } -function vd(t, e, r) { +function Id(t, e, r) { return (e === !0 || e === t) && (r === null || r === t); } -function Xee(t, e = 10) { +function Tte(t, e = 10) { let r = null; return Math.abs(t.y) > e ? r = "y" : Math.abs(t.x) > e && (r = "x"), r; } -class Zee extends Ra { +class Rte extends $a { constructor(e) { - super(e), this.removeGroupControls = Un, this.removeListeners = Un, this.controls = new Jee(e); + super(e), this.removeGroupControls = Un, this.removeListeners = Un, this.controls = new Cte(e); } mount() { const { dragControls: e } = this.node.getProps(); @@ -33709,24 +34223,24 @@ class Zee extends Ra { this.removeGroupControls(), this.removeListeners(); } } -const D_ = (t) => (e, r) => { +const G6 = (t) => (e, r) => { t && Lr.postRender(() => t(e, r)); }; -class Qee extends Ra { +class Dte extends $a { constructor() { super(...arguments), this.removePointerDownListener = Un; } onPointerDown(e) { - this.session = new N7(e, this.createPanHandlers(), { + this.session = new c9(e, this.createPanHandlers(), { transformPagePoint: this.node.getTransformPagePoint(), - contextWindow: H7(this.node) + contextWindow: y9(this.node) }); } createPanHandlers() { const { onPanSessionStart: e, onPanStart: r, onPan: n, onPanEnd: i } = this.node.getProps(); return { - onSessionStart: D_(e), - onStart: D_(r), + onSessionStart: G6(e), + onStart: G6(r), onMove: n, onEnd: (s, o) => { delete this.session, i && Lr.postRender(() => i(s, o)); @@ -33734,7 +34248,7 @@ class Qee extends Ra { }; } mount() { - this.removePointerDownListener = Do(this.node.current, "pointerdown", (e) => this.onPointerDown(e)); + this.removePointerDownListener = ko(this.node.current, "pointerdown", (e) => this.onPointerDown(e)); } update() { this.session && this.session.updateHandlers(this.createPanHandlers()); @@ -33743,17 +34257,17 @@ class Qee extends Ra { this.removePointerDownListener(), this.session && this.session.end(); } } -const _p = Sa(null); -function ete() { - const t = Tn(_p); +const kp = Ta(null); +function Ote() { + const t = Tn(kp); if (t === null) return [!0, null]; - const { isPresent: e, onExitComplete: r, register: n } = t, i = vv(); + const { isPresent: e, onExitComplete: r, register: n } = t, i = Ov(); Dn(() => n(i), []); - const s = bv(() => r && r(i), [i, r]); + const s = Nv(() => r && r(i), [i, r]); return !e && r ? [!1, s] : [!0]; } -const Jb = Sa({}), K7 = Sa({}), jd = { +const fy = Ta({}), w9 = Ta({}), Zd = { /** * Global flag as to whether the tree has animated since the last time * we resized the window @@ -33765,10 +34279,10 @@ const Jb = Sa({}), K7 = Sa({}), jd = { */ hasEverUpdated: !1 }; -function O_(t, e) { +function Y6(t, e) { return e.max === e.min ? 0 : t / (e.max - e.min) * 100; } -const Of = { +const jf = { correct: (t, e) => { if (!e.target) return t; @@ -33777,25 +34291,25 @@ const Of = { t = parseFloat(t); else return t; - const r = O_(t, e.target.x), n = O_(t, e.target.y); + const r = Y6(t, e.target.x), n = Y6(t, e.target.y); return `${r}% ${n}%`; } -}, tte = { +}, Nte = { correct: (t, { treeScale: e, projectionDelta: r }) => { - const n = t, i = _a.parse(t); + const n = t, i = Ia.parse(t); if (i.length > 5) return n; - const s = _a.createTransformer(t), o = typeof i[0] != "number" ? 1 : 0, a = r.x.scale * e.x, u = r.y.scale * e.y; + const s = Ia.createTransformer(t), o = typeof i[0] != "number" ? 1 : 0, a = r.x.scale * e.x, u = r.y.scale * e.y; i[0 + o] /= a, i[1 + o] /= u; const l = Qr(a, u, 0.5); return typeof i[2 + o] == "number" && (i[2 + o] /= l), typeof i[3 + o] == "number" && (i[3 + o] /= l), s(i); } -}, _0 = {}; -function rte(t) { - Object.assign(_0, t); +}, N0 = {}; +function Lte(t) { + Object.assign(N0, t); } -const { schedule: Xb } = GS(queueMicrotask, !1); -class nte extends kR { +const { schedule: ly } = _7(queueMicrotask, !1); +class kte extends fD { /** * This only mounts projection nodes for components that * need measuring, we might want to do it for all components @@ -33803,12 +34317,12 @@ class nte extends kR { */ componentDidMount() { const { visualElement: e, layoutGroup: r, switchLayoutGroup: n, layoutId: i } = this.props, { projection: s } = e; - rte(ite), s && (r.group && r.group.add(s), n && n.register && i && n.register(s), s.root.didUpdate(), s.addEventListener("animationComplete", () => { + Lte($te), s && (r.group && r.group.add(s), n && n.register && i && n.register(s), s.root.didUpdate(), s.addEventListener("animationComplete", () => { this.safeToRemove(); }), s.setOptions({ ...s.options, onExitComplete: () => this.safeToRemove() - })), jd.hasEverUpdated = !0; + })), Zd.hasEverUpdated = !0; } getSnapshotBeforeUpdate(e) { const { layoutDependency: r, visualElement: n, drag: i, isPresent: s } = this.props, o = n.projection; @@ -33819,7 +34333,7 @@ class nte extends kR { } componentDidUpdate() { const { projection: e } = this.props.visualElement; - e && (e.root.didUpdate(), Xb.postRender(() => { + e && (e.root.didUpdate(), ly.postRender(() => { !e.currentAnimation && e.isLead() && this.safeToRemove(); })); } @@ -33835,13 +34349,13 @@ class nte extends kR { return null; } } -function V7(t) { - const [e, r] = ete(), n = Tn(Jb); - return le.jsx(nte, { ...t, layoutGroup: n, switchLayoutGroup: Tn(K7), isPresent: e, safeToRemove: r }); +function x9(t) { + const [e, r] = Ote(), n = Tn(fy); + return le.jsx(kte, { ...t, layoutGroup: n, switchLayoutGroup: Tn(w9), isPresent: e, safeToRemove: r }); } -const ite = { +const $te = { borderRadius: { - ...Of, + ...jf, applyTo: [ "borderTopLeftRadius", "borderTopRightRadius", @@ -33849,93 +34363,93 @@ const ite = { "borderBottomRightRadius" ] }, - borderTopLeftRadius: Of, - borderTopRightRadius: Of, - borderBottomLeftRadius: Of, - borderBottomRightRadius: Of, - boxShadow: tte -}, G7 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], ste = G7.length, N_ = (t) => typeof t == "string" ? parseFloat(t) : t, L_ = (t) => typeof t == "number" || Vt.test(t); -function ote(t, e, r, n, i, s) { + borderTopLeftRadius: jf, + borderTopRightRadius: jf, + borderBottomLeftRadius: jf, + borderBottomRightRadius: jf, + boxShadow: Nte +}, _9 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], Bte = _9.length, J6 = (t) => typeof t == "string" ? parseFloat(t) : t, X6 = (t) => typeof t == "number" || Vt.test(t); +function Fte(t, e, r, n, i, s) { i ? (t.opacity = Qr( 0, // TODO Reinstate this if only child r.opacity !== void 0 ? r.opacity : 1, - ate(n) - ), t.opacityExit = Qr(e.opacity !== void 0 ? e.opacity : 1, 0, cte(n))) : s && (t.opacity = Qr(e.opacity !== void 0 ? e.opacity : 1, r.opacity !== void 0 ? r.opacity : 1, n)); - for (let o = 0; o < ste; o++) { - const a = `border${G7[o]}Radius`; - let u = k_(e, a), l = k_(r, a); + jte(n) + ), t.opacityExit = Qr(e.opacity !== void 0 ? e.opacity : 1, 0, Ute(n))) : s && (t.opacity = Qr(e.opacity !== void 0 ? e.opacity : 1, r.opacity !== void 0 ? r.opacity : 1, n)); + for (let o = 0; o < Bte; o++) { + const a = `border${_9[o]}Radius`; + let u = Z6(e, a), l = Z6(r, a); if (u === void 0 && l === void 0) continue; - u || (u = 0), l || (l = 0), u === 0 || l === 0 || L_(u) === L_(l) ? (t[a] = Math.max(Qr(N_(u), N_(l), n), 0), (Gs.test(l) || Gs.test(u)) && (t[a] += "%")) : t[a] = l; + u || (u = 0), l || (l = 0), u === 0 || l === 0 || X6(u) === X6(l) ? (t[a] = Math.max(Qr(J6(u), J6(l), n), 0), (Xs.test(l) || Xs.test(u)) && (t[a] += "%")) : t[a] = l; } (e.rotate || r.rotate) && (t.rotate = Qr(e.rotate || 0, r.rotate || 0, n)); } -function k_(t, e) { +function Z6(t, e) { return t[e] !== void 0 ? t[e] : t.borderRadius; } -const ate = /* @__PURE__ */ Y7(0, 0.5, t7), cte = /* @__PURE__ */ Y7(0.5, 0.95, Un); -function Y7(t, e, r) { - return (n) => n < t ? 0 : n > e ? 1 : r(Iu(t, e, n)); +const jte = /* @__PURE__ */ E9(0, 0.5, C7), Ute = /* @__PURE__ */ E9(0.5, 0.95, Un); +function E9(t, e, r) { + return (n) => n < t ? 0 : n > e ? 1 : r($u(t, e, n)); } -function $_(t, e) { +function Q6(t, e) { t.min = e.min, t.max = e.max; } -function Yi(t, e) { - $_(t.x, e.x), $_(t.y, e.y); +function Xi(t, e) { + Q6(t.x, e.x), Q6(t.y, e.y); } -function B_(t, e) { +function e5(t, e) { t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin; } -function F_(t, e, r, n, i) { - return t -= e, t = x0(t, 1 / r, n), i !== void 0 && (t = x0(t, 1 / i, n)), t; +function t5(t, e, r, n, i) { + return t -= e, t = O0(t, 1 / r, n), i !== void 0 && (t = O0(t, 1 / i, n)), t; } -function ute(t, e = 0, r = 1, n = 0.5, i, s = t, o = t) { - if (Gs.test(e) && (e = parseFloat(e), e = Qr(o.min, o.max, e / 100) - o.min), typeof e != "number") +function qte(t, e = 0, r = 1, n = 0.5, i, s = t, o = t) { + if (Xs.test(e) && (e = parseFloat(e), e = Qr(o.min, o.max, e / 100) - o.min), typeof e != "number") return; let a = Qr(s.min, s.max, n); - t === s && (a -= e), t.min = F_(t.min, e, r, a, i), t.max = F_(t.max, e, r, a, i); + t === s && (a -= e), t.min = t5(t.min, e, r, a, i), t.max = t5(t.max, e, r, a, i); } -function j_(t, e, [r, n, i], s, o) { - ute(t, e[r], e[n], e[i], e.scale, s, o); +function r5(t, e, [r, n, i], s, o) { + qte(t, e[r], e[n], e[i], e.scale, s, o); } -const fte = ["x", "scaleX", "originX"], lte = ["y", "scaleY", "originY"]; -function U_(t, e, r, n) { - j_(t.x, e, fte, r ? r.x : void 0, n ? n.x : void 0), j_(t.y, e, lte, r ? r.y : void 0, n ? n.y : void 0); +const zte = ["x", "scaleX", "originX"], Wte = ["y", "scaleY", "originY"]; +function n5(t, e, r, n) { + r5(t.x, e, zte, r ? r.x : void 0, n ? n.x : void 0), r5(t.y, e, Wte, r ? r.y : void 0, n ? n.y : void 0); } -function q_(t) { +function i5(t) { return t.translate === 0 && t.scale === 1; } -function J7(t) { - return q_(t.x) && q_(t.y); +function S9(t) { + return i5(t.x) && i5(t.y); } -function z_(t, e) { +function s5(t, e) { return t.min === e.min && t.max === e.max; } -function hte(t, e) { - return z_(t.x, e.x) && z_(t.y, e.y); +function Hte(t, e) { + return s5(t.x, e.x) && s5(t.y, e.y); } -function W_(t, e) { +function o5(t, e) { return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max); } -function X7(t, e) { - return W_(t.x, e.x) && W_(t.y, e.y); +function A9(t, e) { + return o5(t.x, e.x) && o5(t.y, e.y); } -function H_(t) { - return Li(t.x) / Li(t.y); +function a5(t) { + return ki(t.x) / ki(t.y); } -function K_(t, e) { +function c5(t, e) { return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint; } -class dte { +class Kte { constructor() { this.members = []; } add(e) { - Kb(this.members, e), e.scheduleRender(); + oy(this.members, e), e.scheduleRender(); } remove(e) { - if (Vb(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) { + if (ay(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) { const r = this.members[this.members.length - 1]; r && this.promote(r); } @@ -33981,88 +34495,88 @@ class dte { this.lead && this.lead.snapshot && (this.lead.snapshot = void 0); } } -function pte(t, e, r) { +function Vte(t, e, r) { let n = ""; const i = t.x.translate / e.x, s = t.y.translate / e.y, o = (r == null ? void 0 : r.z) || 0; if ((i || s || o) && (n = `translate3d(${i}px, ${s}px, ${o}px) `), (e.x !== 1 || e.y !== 1) && (n += `scale(${1 / e.x}, ${1 / e.y}) `), r) { - const { transformPerspective: l, rotate: d, rotateX: p, rotateY: w, skewX: A, skewY: M } = r; - l && (n = `perspective(${l}px) ${n}`), d && (n += `rotate(${d}deg) `), p && (n += `rotateX(${p}deg) `), w && (n += `rotateY(${w}deg) `), A && (n += `skewX(${A}deg) `), M && (n += `skewY(${M}deg) `); + const { transformPerspective: l, rotate: d, rotateX: p, rotateY: w, skewX: _, skewY: P } = r; + l && (n = `perspective(${l}px) ${n}`), d && (n += `rotate(${d}deg) `), p && (n += `rotateX(${p}deg) `), w && (n += `rotateY(${w}deg) `), _ && (n += `skewX(${_}deg) `), P && (n += `skewY(${P}deg) `); } const a = t.x.scale * e.x, u = t.y.scale * e.y; return (a !== 1 || u !== 1) && (n += `scale(${a}, ${u})`), n || "none"; } -const gte = (t, e) => t.depth - e.depth; -class mte { +const Gte = (t, e) => t.depth - e.depth; +class Yte { constructor() { this.children = [], this.isDirty = !1; } add(e) { - Kb(this.children, e), this.isDirty = !0; + oy(this.children, e), this.isDirty = !0; } remove(e) { - Vb(this.children, e), this.isDirty = !0; + ay(this.children, e), this.isDirty = !0; } forEach(e) { - this.isDirty && this.children.sort(gte), this.isDirty = !1, this.children.forEach(e); + this.isDirty && this.children.sort(Gte), this.isDirty = !1, this.children.forEach(e); } } -function Ud(t) { - const e = Xn(t) ? t.get() : t; - return aee(e) ? e.toValue() : e; +function Qd(t) { + const e = Zn(t) ? t.get() : t; + return jee(e) ? e.toValue() : e; } -function vte(t, e) { - const r = Ys.now(), n = ({ timestamp: i }) => { +function Jte(t, e) { + const r = Zs.now(), n = ({ timestamp: i }) => { const s = i - r; - s >= e && (wa(n), t(s - e)); + s >= e && (Pa(n), t(s - e)); }; - return Lr.read(n, !0), () => wa(n); + return Lr.read(n, !0), () => Pa(n); } -function bte(t) { +function Xte(t) { return t instanceof SVGElement && t.tagName !== "svg"; } -function yte(t, e, r) { - const n = Xn(t) ? t : Rl(t); - return n.start(Hb("", n, e, r)), n.animation; +function Zte(t, e, r) { + const n = Zn(t) ? t : ql(t); + return n.start(sy("", n, e, r)), n.animation; } -const Ja = { +const rc = { type: "projectionFrame", totalNodes: 0, resolvedTargetDeltas: 0, recalculatedProjection: 0 -}, Uf = typeof window < "u" && window.MotionDebug !== void 0, jm = ["", "X", "Y", "Z"], wte = { visibility: "hidden" }, V_ = 1e3; -let xte = 0; -function Um(t, e, r, n) { +}, Gf = typeof window < "u" && window.MotionDebug !== void 0, e1 = ["", "X", "Y", "Z"], Qte = { visibility: "hidden" }, u5 = 1e3; +let ere = 0; +function t1(t, e, r, n) { const { latestValues: i } = e; i[t] && (r[t] = i[t], e.setStaticValue(t, 0), n && (n[t] = 0)); } -function Z7(t) { +function P9(t) { if (t.hasCheckedOptimisedAppear = !0, t.root === t) return; const { visualElement: e } = t.options; if (!e) return; - const r = T7(e); + const r = i9(e); if (window.MotionHasOptimisedAnimation(r, "transform")) { const { layout: i, layoutId: s } = t.options; window.MotionCancelOptimisedAnimation(r, "transform", Lr, !(i || s)); } const { parent: n } = t; - n && !n.hasCheckedOptimisedAppear && Z7(n); + n && !n.hasCheckedOptimisedAppear && P9(n); } -function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, checkIsScrollRoot: n, resetTransform: i }) { +function M9({ attachResizeListener: t, defaultParent: e, measureScroll: r, checkIsScrollRoot: n, resetTransform: i }) { return class { constructor(o = {}, a = e == null ? void 0 : e()) { - this.id = xte++, this.animationId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => { + this.id = ere++, this.animationId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => { this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots()); }, this.updateProjection = () => { - this.projectionUpdateScheduled = !1, Uf && (Ja.totalNodes = Ja.resolvedTargetDeltas = Ja.recalculatedProjection = 0), this.nodes.forEach(Ste), this.nodes.forEach(Cte), this.nodes.forEach(Tte), this.nodes.forEach(Ate), Uf && window.MotionDebug.record(Ja); + this.projectionUpdateScheduled = !1, Gf && (rc.totalNodes = rc.resolvedTargetDeltas = rc.recalculatedProjection = 0), this.nodes.forEach(nre), this.nodes.forEach(cre), this.nodes.forEach(ure), this.nodes.forEach(ire), Gf && window.MotionDebug.record(rc); }, this.resolvedRelativeTargetAt = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = o, this.root = a ? a.root || a : this, this.path = a ? [...a.path, a] : [], this.parent = a, this.depth = a ? a.depth + 1 : 0; for (let u = 0; u < this.path.length; u++) this.path[u].shouldResetTransform = !0; - this.root === this && (this.nodes = new mte()); + this.root === this && (this.nodes = new Yte()); } addEventListener(o, a) { - return this.eventHandlers.has(o) || this.eventHandlers.set(o, new Gb()), this.eventHandlers.get(o).add(a); + return this.eventHandlers.has(o) || this.eventHandlers.set(o, new cy()), this.eventHandlers.get(o).add(a); } notifyListeners(o, ...a) { const u = this.eventHandlers.get(o); @@ -34077,38 +34591,38 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check mount(o, a = this.root.hasTreeAnimated) { if (this.instance) return; - this.isSVG = bte(o), this.instance = o; + this.isSVG = Xte(o), this.instance = o; const { layoutId: u, layout: l, visualElement: d } = this.options; if (d && !d.current && d.mount(o), this.root.nodes.add(this), this.parent && this.parent.children.add(this), a && (l || u) && (this.isLayoutDirty = !0), t) { let p; const w = () => this.root.updateBlockedByResize = !1; t(o, () => { - this.root.updateBlockedByResize = !0, p && p(), p = vte(w, 250), jd.hasAnimatedSinceResize && (jd.hasAnimatedSinceResize = !1, this.nodes.forEach(Y_)); + this.root.updateBlockedByResize = !0, p && p(), p = Jte(w, 250), Zd.hasAnimatedSinceResize && (Zd.hasAnimatedSinceResize = !1, this.nodes.forEach(l5)); }); } - u && this.root.registerSharedNode(u, this), this.options.animate !== !1 && d && (u || l) && this.addEventListener("didUpdate", ({ delta: p, hasLayoutChanged: w, hasRelativeTargetChanged: A, layout: M }) => { + u && this.root.registerSharedNode(u, this), this.options.animate !== !1 && d && (u || l) && this.addEventListener("didUpdate", ({ delta: p, hasLayoutChanged: w, hasRelativeTargetChanged: _, layout: P }) => { if (this.isTreeAnimationBlocked()) { this.target = void 0, this.relativeTarget = void 0; return; } - const N = this.options.transition || d.getDefaultTransition() || Lte, { onLayoutAnimationStart: L, onLayoutAnimationComplete: B } = d.getProps(), $ = !this.targetLayout || !X7(this.targetLayout, M) || A, H = !w && A; - if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || H || w && ($ || !this.currentAnimation)) { - this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0), this.setAnimationOrigin(p, H); + const O = this.options.transition || d.getDefaultTransition() || pre, { onLayoutAnimationStart: L, onLayoutAnimationComplete: B } = d.getProps(), k = !this.targetLayout || !A9(this.targetLayout, P) || _, q = !w && _; + if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || q || w && (k || !this.currentAnimation)) { + this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0), this.setAnimationOrigin(p, q); const U = { - ...Rb(N, "layout"), + ...Hb(O, "layout"), onPlay: L, onComplete: B }; (d.shouldReduceMotion || this.options.layoutRoot) && (U.delay = 0, U.type = !1), this.startAnimation(U); } else - w || Y_(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete(); - this.targetLayout = M; + w || l5(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete(); + this.targetLayout = P; }); } unmount() { this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this); const o = this.getStack(); - o && o.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, wa(this.updateProjection); + o && o.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, Pa(this.updateProjection); } // only on the root blockUpdate() { @@ -34125,7 +34639,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check } // Note: currently only running on root node startUpdate() { - this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(Rte), this.animationId++); + this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(fre), this.animationId++); } getTransformTemplate() { const { visualElement: o } = this.options; @@ -34136,7 +34650,7 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.options.onExitComplete && this.options.onExitComplete(); return; } - if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && Z7(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty) + if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && P9(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty) return; this.isLayoutDirty = !0; for (let d = 0; d < this.path.length; d++) { @@ -34151,18 +34665,18 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check } update() { if (this.updateScheduled = !1, this.isUpdateBlocked()) { - this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(G_); + this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(f5); return; } - this.isUpdating || this.nodes.forEach(Mte), this.isUpdating = !1, this.nodes.forEach(Ite), this.nodes.forEach(_te), this.nodes.forEach(Ete), this.clearAllSnapshots(); - const a = Ys.now(); - Fn.delta = xa(0, 1e3 / 60, a - Fn.timestamp), Fn.timestamp = a, Fn.isProcessing = !0, Dm.update.process(Fn), Dm.preRender.process(Fn), Dm.render.process(Fn), Fn.isProcessing = !1; + this.isUpdating || this.nodes.forEach(ore), this.isUpdating = !1, this.nodes.forEach(are), this.nodes.forEach(tre), this.nodes.forEach(rre), this.clearAllSnapshots(); + const a = Zs.now(); + Fn.delta = Ma(0, 1e3 / 60, a - Fn.timestamp), Fn.timestamp = a, Fn.isProcessing = !0, Km.update.process(Fn), Km.preRender.process(Fn), Km.render.process(Fn), Fn.isProcessing = !1; } didUpdate() { - this.updateScheduled || (this.updateScheduled = !0, Xb.read(this.scheduleUpdate)); + this.updateScheduled || (this.updateScheduled = !0, ly.read(this.scheduleUpdate)); } clearAllSnapshots() { - this.nodes.forEach(Pte), this.sharedNodes.forEach(Dte); + this.nodes.forEach(sre), this.sharedNodes.forEach(lre); } scheduleUpdateProjection() { this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, Lr.preRender(this.updateProjection, !1, !0)); @@ -34205,13 +34719,13 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check resetTransform() { if (!i) return; - const o = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, a = this.projectionDelta && !J7(this.projectionDelta), u = this.getTransformTemplate(), l = u ? u(this.latestValues, "") : void 0, d = l !== this.prevTransformTemplateValue; - o && (a || Ya(this.latestValues) || d) && (i(this.instance, l), this.shouldResetTransform = !1, this.scheduleRender()); + const o = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, a = this.projectionDelta && !S9(this.projectionDelta), u = this.getTransformTemplate(), l = u ? u(this.latestValues, "") : void 0, d = l !== this.prevTransformTemplateValue; + o && (a || tc(this.latestValues) || d) && (i(this.instance, l), this.shouldResetTransform = !1, this.scheduleRender()); } measure(o = !0) { const a = this.measurePageBox(); let u = this.removeElementScroll(a); - return o && (u = this.removeTransform(u)), kte(u), { + return o && (u = this.removeTransform(u)), gre(u), { animationId: this.root.animationId, measuredBox: a, layoutBox: u, @@ -34225,47 +34739,47 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check if (!a) return ln(); const u = a.measureViewportBox(); - if (!(((o = this.scroll) === null || o === void 0 ? void 0 : o.wasRoot) || this.path.some($te))) { + if (!(((o = this.scroll) === null || o === void 0 ? void 0 : o.wasRoot) || this.path.some(mre))) { const { scroll: d } = this.root; - d && (nu(u.x, d.offset.x), nu(u.y, d.offset.y)); + d && (du(u.x, d.offset.x), du(u.y, d.offset.y)); } return u; } removeElementScroll(o) { var a; const u = ln(); - if (Yi(u, o), !((a = this.scroll) === null || a === void 0) && a.wasRoot) + if (Xi(u, o), !((a = this.scroll) === null || a === void 0) && a.wasRoot) return u; for (let l = 0; l < this.path.length; l++) { const d = this.path[l], { scroll: p, options: w } = d; - d !== this.root && p && w.layoutScroll && (p.wasRoot && Yi(u, o), nu(u.x, p.offset.x), nu(u.y, p.offset.y)); + d !== this.root && p && w.layoutScroll && (p.wasRoot && Xi(u, o), du(u.x, p.offset.x), du(u.y, p.offset.y)); } return u; } applyTransform(o, a = !1) { const u = ln(); - Yi(u, o); + Xi(u, o); for (let l = 0; l < this.path.length; l++) { const d = this.path[l]; - !a && d.options.layoutScroll && d.scroll && d !== d.root && iu(u, { + !a && d.options.layoutScroll && d.scroll && d !== d.root && pu(u, { x: -d.scroll.offset.x, y: -d.scroll.offset.y - }), Ya(d.latestValues) && iu(u, d.latestValues); + }), tc(d.latestValues) && pu(u, d.latestValues); } - return Ya(this.latestValues) && iu(u, this.latestValues), u; + return tc(this.latestValues) && pu(u, this.latestValues), u; } removeTransform(o) { const a = ln(); - Yi(a, o); + Xi(a, o); for (let u = 0; u < this.path.length; u++) { const l = this.path[u]; - if (!l.instance || !Ya(l.latestValues)) + if (!l.instance || !tc(l.latestValues)) continue; - cv(l.latestValues) && l.updateSnapshot(); + Sv(l.latestValues) && l.updateSnapshot(); const d = ln(), p = l.measurePageBox(); - Yi(d, p), U_(a, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, d); + Xi(d, p), n5(a, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, d); } - return Ya(this.latestValues) && U_(a, this.latestValues), a; + return tc(this.latestValues) && n5(a, this.latestValues), a; } setTargetDelta(o) { this.targetDelta = o, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0; @@ -34293,21 +34807,21 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check const { layout: p, layoutId: w } = this.options; if (!(!this.layout || !(p || w))) { if (this.resolvedRelativeTargetAt = Fn.timestamp, !this.targetDelta && !this.relativeTarget) { - const A = this.getClosestProjectingParent(); - A && A.layout && this.animationProgress !== 1 ? (this.relativeParent = A, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), Xf(this.relativeTargetOrigin, this.layout.layoutBox, A.layout.layoutBox), Yi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; + const _ = this.getClosestProjectingParent(); + _ && _.layout && this.animationProgress !== 1 ? (this.relativeParent = _, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), il(this.relativeTargetOrigin, this.layout.layoutBox, _.layout.layoutBox), Xi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; } if (!(!this.relativeTarget && !this.targetDelta)) { - if (this.target || (this.target = ln(), this.targetWithTransforms = ln()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), Bee(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : Yi(this.target, this.layout.layoutBox), z7(this.target, this.targetDelta)) : Yi(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget) { + if (this.target || (this.target = ln(), this.targetWithTransforms = ln()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), vte(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : Xi(this.target, this.layout.layoutBox), v9(this.target, this.targetDelta)) : Xi(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget) { this.attemptToResolveRelativeTarget = !1; - const A = this.getClosestProjectingParent(); - A && !!A.resumingFrom == !!this.resumingFrom && !A.options.layoutScroll && A.target && this.animationProgress !== 1 ? (this.relativeParent = A, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), Xf(this.relativeTargetOrigin, this.target, A.target), Yi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; + const _ = this.getClosestProjectingParent(); + _ && !!_.resumingFrom == !!this.resumingFrom && !_.options.layoutScroll && _.target && this.animationProgress !== 1 ? (this.relativeParent = _, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), il(this.relativeTargetOrigin, this.target, _.target), Xi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; } - Uf && Ja.resolvedTargetDeltas++; + Gf && rc.resolvedTargetDeltas++; } } } getClosestProjectingParent() { - if (!(!this.parent || cv(this.parent.latestValues) || q7(this.parent.latestValues))) + if (!(!this.parent || Sv(this.parent.latestValues) || m9(this.parent.latestValues))) return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent(); } isProjecting() { @@ -34322,15 +34836,15 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check const { layout: d, layoutId: p } = this.options; if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(d || p)) return; - Yi(this.layoutCorrected, this.layout.layoutBox); - const w = this.treeScale.x, A = this.treeScale.y; - Vee(this.layoutCorrected, this.treeScale, this.path, u), a.layout && !a.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (a.target = a.layout.layoutBox, a.targetWithTransforms = ln()); - const { target: M } = a; - if (!M) { + Xi(this.layoutCorrected, this.layout.layoutBox); + const w = this.treeScale.x, _ = this.treeScale.y; + Pte(this.layoutCorrected, this.treeScale, this.path, u), a.layout && !a.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (a.target = a.layout.layoutBox, a.targetWithTransforms = ln()); + const { target: P } = a; + if (!P) { this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender()); return; } - !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (B_(this.prevProjectionDelta.x, this.projectionDelta.x), B_(this.prevProjectionDelta.y, this.projectionDelta.y)), Jf(this.projectionDelta, this.layoutCorrected, M, this.latestValues), (this.treeScale.x !== w || this.treeScale.y !== A || !K_(this.projectionDelta.x, this.prevProjectionDelta.x) || !K_(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", M)), Uf && Ja.recalculatedProjection++; + !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (e5(this.prevProjectionDelta.x, this.projectionDelta.x), e5(this.prevProjectionDelta.y, this.projectionDelta.y)), nl(this.projectionDelta, this.layoutCorrected, P, this.latestValues), (this.treeScale.x !== w || this.treeScale.y !== _ || !c5(this.projectionDelta.x, this.prevProjectionDelta.x) || !c5(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", P)), Gf && rc.recalculatedProjection++; } hide() { this.isVisible = !1; @@ -34347,22 +34861,22 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0); } createProjectionDeltas() { - this.prevProjectionDelta = ru(), this.projectionDelta = ru(), this.projectionDeltaWithTransform = ru(); + this.prevProjectionDelta = hu(), this.projectionDelta = hu(), this.projectionDeltaWithTransform = hu(); } setAnimationOrigin(o, a = !1) { - const u = this.snapshot, l = u ? u.latestValues : {}, d = { ...this.latestValues }, p = ru(); + const u = this.snapshot, l = u ? u.latestValues : {}, d = { ...this.latestValues }, p = hu(); (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !a; - const w = ln(), A = u ? u.source : void 0, M = this.layout ? this.layout.source : void 0, N = A !== M, L = this.getStack(), B = !L || L.members.length <= 1, $ = !!(N && !B && this.options.crossfade === !0 && !this.path.some(Nte)); + const w = ln(), _ = u ? u.source : void 0, P = this.layout ? this.layout.source : void 0, O = _ !== P, L = this.getStack(), B = !L || L.members.length <= 1, k = !!(O && !B && this.options.crossfade === !0 && !this.path.some(dre)); this.animationProgress = 0; - let H; + let q; this.mixTargetDelta = (U) => { const V = U / 1e3; - J_(p.x, o.x, V), J_(p.y, o.y, V), this.setTargetDelta(p), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Xf(w, this.layout.layoutBox, this.relativeParent.layout.layoutBox), Ote(this.relativeTarget, this.relativeTargetOrigin, w, V), H && hte(this.relativeTarget, H) && (this.isProjectionDirty = !1), H || (H = ln()), Yi(H, this.relativeTarget)), N && (this.animationValues = d, ote(d, l, this.latestValues, V, $, B)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V; + h5(p.x, o.x, V), h5(p.y, o.y, V), this.setTargetDelta(p), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (il(w, this.layout.layoutBox, this.relativeParent.layout.layoutBox), hre(this.relativeTarget, this.relativeTargetOrigin, w, V), q && Hte(this.relativeTarget, q) && (this.isProjectionDirty = !1), q || (q = ln()), Xi(q, this.relativeTarget)), O && (this.animationValues = d, Fte(d, l, this.latestValues, V, k, B)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V; }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0); } startAnimation(o) { - this.notifyListeners("animationStart"), this.currentAnimation && this.currentAnimation.stop(), this.resumingFrom && this.resumingFrom.currentAnimation && this.resumingFrom.currentAnimation.stop(), this.pendingAnimation && (wa(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = Lr.update(() => { - jd.hasAnimatedSinceResize = !0, this.currentAnimation = yte(0, V_, { + this.notifyListeners("animationStart"), this.currentAnimation && this.currentAnimation.stop(), this.resumingFrom && this.resumingFrom.currentAnimation && this.resumingFrom.currentAnimation.stop(), this.pendingAnimation && (Pa(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = Lr.update(() => { + Zd.hasAnimatedSinceResize = !0, this.currentAnimation = Zte(0, u5, { ...o, onUpdate: (a) => { this.mixTargetDelta(a), o.onUpdate && o.onUpdate(a); @@ -34379,24 +34893,24 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check o && o.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete"); } finishAnimation() { - this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(V_), this.currentAnimation.stop()), this.completeAnimation(); + this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(u5), this.currentAnimation.stop()), this.completeAnimation(); } applyTransformsToTarget() { const o = this.getLead(); let { targetWithTransforms: a, target: u, layout: l, latestValues: d } = o; if (!(!a || !u || !l)) { - if (this !== o && this.layout && l && e9(this.options.animationType, this.layout.layoutBox, l.layoutBox)) { + if (this !== o && this.layout && l && I9(this.options.animationType, this.layout.layoutBox, l.layoutBox)) { u = this.target || ln(); - const p = Li(this.layout.layoutBox.x); + const p = ki(this.layout.layoutBox.x); u.x.min = o.target.x.min, u.x.max = u.x.min + p; - const w = Li(this.layout.layoutBox.y); + const w = ki(this.layout.layoutBox.y); u.y.min = o.target.y.min, u.y.max = u.y.min + w; } - Yi(a, u), iu(a, d), Jf(this.projectionDeltaWithTransform, this.layoutCorrected, a, d); + Xi(a, u), pu(a, d), nl(this.projectionDeltaWithTransform, this.layoutCorrected, a, d); } } registerSharedNode(o, a) { - this.sharedNodes.has(o) || this.sharedNodes.set(o, new dte()), this.sharedNodes.get(o).add(a); + this.sharedNodes.has(o) || this.sharedNodes.set(o, new Kte()), this.sharedNodes.get(o).add(a); const l = a.options.initialPromotionConfig; a.promote({ transition: l ? l.transition : void 0, @@ -34439,9 +34953,9 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check if ((u.z || u.rotate || u.rotateX || u.rotateY || u.rotateZ || u.skewX || u.skewY) && (a = !0), !a) return; const l = {}; - u.z && Um("z", o, l, this.animationValues); - for (let d = 0; d < jm.length; d++) - Um(`rotate${jm[d]}`, o, l, this.animationValues), Um(`skew${jm[d]}`, o, l, this.animationValues); + u.z && t1("z", o, l, this.animationValues); + for (let d = 0; d < e1.length; d++) + t1(`rotate${e1[d]}`, o, l, this.animationValues), t1(`skew${e1[d]}`, o, l, this.animationValues); o.render(); for (const d in l) o.setStaticValue(d, l[d]), this.animationValues && (this.animationValues[d] = l[d]); @@ -34452,33 +34966,33 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check if (!this.instance || this.isSVG) return; if (!this.isVisible) - return wte; + return Qte; const l = { visibility: "" }, d = this.getTransformTemplate(); if (this.needsReset) - return this.needsReset = !1, l.opacity = "", l.pointerEvents = Ud(o == null ? void 0 : o.pointerEvents) || "", l.transform = d ? d(this.latestValues, "") : "none", l; + return this.needsReset = !1, l.opacity = "", l.pointerEvents = Qd(o == null ? void 0 : o.pointerEvents) || "", l.transform = d ? d(this.latestValues, "") : "none", l; const p = this.getLead(); if (!this.projectionDelta || !this.layout || !p.target) { - const N = {}; - return this.options.layoutId && (N.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, N.pointerEvents = Ud(o == null ? void 0 : o.pointerEvents) || ""), this.hasProjected && !Ya(this.latestValues) && (N.transform = d ? d({}, "") : "none", this.hasProjected = !1), N; + const O = {}; + return this.options.layoutId && (O.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, O.pointerEvents = Qd(o == null ? void 0 : o.pointerEvents) || ""), this.hasProjected && !tc(this.latestValues) && (O.transform = d ? d({}, "") : "none", this.hasProjected = !1), O; } const w = p.animationValues || p.latestValues; - this.applyTransformsToTarget(), l.transform = pte(this.projectionDeltaWithTransform, this.treeScale, w), d && (l.transform = d(w, l.transform)); - const { x: A, y: M } = this.projectionDelta; - l.transformOrigin = `${A.origin * 100}% ${M.origin * 100}% 0`, p.animationValues ? l.opacity = p === this ? (u = (a = w.opacity) !== null && a !== void 0 ? a : this.latestValues.opacity) !== null && u !== void 0 ? u : 1 : this.preserveOpacity ? this.latestValues.opacity : w.opacityExit : l.opacity = p === this ? w.opacity !== void 0 ? w.opacity : "" : w.opacityExit !== void 0 ? w.opacityExit : 0; - for (const N in _0) { - if (w[N] === void 0) + this.applyTransformsToTarget(), l.transform = Vte(this.projectionDeltaWithTransform, this.treeScale, w), d && (l.transform = d(w, l.transform)); + const { x: _, y: P } = this.projectionDelta; + l.transformOrigin = `${_.origin * 100}% ${P.origin * 100}% 0`, p.animationValues ? l.opacity = p === this ? (u = (a = w.opacity) !== null && a !== void 0 ? a : this.latestValues.opacity) !== null && u !== void 0 ? u : 1 : this.preserveOpacity ? this.latestValues.opacity : w.opacityExit : l.opacity = p === this ? w.opacity !== void 0 ? w.opacity : "" : w.opacityExit !== void 0 ? w.opacityExit : 0; + for (const O in N0) { + if (w[O] === void 0) continue; - const { correct: L, applyTo: B } = _0[N], $ = l.transform === "none" ? w[N] : L(w[N], p); + const { correct: L, applyTo: B } = N0[O], k = l.transform === "none" ? w[O] : L(w[O], p); if (B) { - const H = B.length; - for (let U = 0; U < H; U++) - l[B[U]] = $; + const q = B.length; + for (let U = 0; U < q; U++) + l[B[U]] = k; } else - l[N] = $; + l[O] = k; } - return this.options.layoutId && (l.pointerEvents = p === this ? Ud(o == null ? void 0 : o.pointerEvents) || "" : "none"), l; + return this.options.layoutId && (l.pointerEvents = p === this ? Qd(o == null ? void 0 : o.pointerEvents) || "" : "none"), l; } clearSnapshot() { this.resumeFrom = this.snapshot = void 0; @@ -34488,40 +35002,40 @@ function Q7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.root.nodes.forEach((o) => { var a; return (a = o.currentAnimation) === null || a === void 0 ? void 0 : a.stop(); - }), this.root.nodes.forEach(G_), this.root.sharedNodes.clear(); + }), this.root.nodes.forEach(f5), this.root.sharedNodes.clear(); } }; } -function _te(t) { +function tre(t) { t.updateLayout(); } -function Ete(t) { +function rre(t) { var e; const r = ((e = t.resumeFrom) === null || e === void 0 ? void 0 : e.snapshot) || t.snapshot; if (t.isLead() && t.layout && r && t.hasListeners("didUpdate")) { const { layoutBox: n, measuredBox: i } = t.layout, { animationType: s } = t.options, o = r.source !== t.layout.source; - s === "size" ? Xi((p) => { - const w = o ? r.measuredBox[p] : r.layoutBox[p], A = Li(w); - w.min = n[p].min, w.max = w.min + A; - }) : e9(s, r.layoutBox, n) && Xi((p) => { - const w = o ? r.measuredBox[p] : r.layoutBox[p], A = Li(n[p]); - w.max = w.min + A, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[p].max = t.relativeTarget[p].min + A); - }); - const a = ru(); - Jf(a, n, r.layoutBox); - const u = ru(); - o ? Jf(u, t.applyTransform(i, !0), r.measuredBox) : Jf(u, n, r.layoutBox); - const l = !J7(a); + s === "size" ? Qi((p) => { + const w = o ? r.measuredBox[p] : r.layoutBox[p], _ = ki(w); + w.min = n[p].min, w.max = w.min + _; + }) : I9(s, r.layoutBox, n) && Qi((p) => { + const w = o ? r.measuredBox[p] : r.layoutBox[p], _ = ki(n[p]); + w.max = w.min + _, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[p].max = t.relativeTarget[p].min + _); + }); + const a = hu(); + nl(a, n, r.layoutBox); + const u = hu(); + o ? nl(u, t.applyTransform(i, !0), r.measuredBox) : nl(u, n, r.layoutBox); + const l = !S9(a); let d = !1; if (!t.resumeFrom) { const p = t.getClosestProjectingParent(); if (p && !p.resumeFrom) { - const { snapshot: w, layout: A } = p; - if (w && A) { - const M = ln(); - Xf(M, r.layoutBox, w.layoutBox); - const N = ln(); - Xf(N, n, A.layoutBox), X7(M, N) || (d = !0), p.options.layoutRoot && (t.relativeTarget = N, t.relativeTargetOrigin = M, t.relativeParent = p); + const { snapshot: w, layout: _ } = p; + if (w && _) { + const P = ln(); + il(P, r.layoutBox, w.layoutBox); + const O = ln(); + il(O, n, _.layoutBox), A9(P, O) || (d = !0), p.options.layoutRoot && (t.relativeTarget = O, t.relativeTargetOrigin = P, t.relativeParent = p); } } } @@ -34539,125 +35053,125 @@ function Ete(t) { } t.options.transition = void 0; } -function Ste(t) { - Uf && Ja.totalNodes++, t.parent && (t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty), t.isSharedProjectionDirty || (t.isSharedProjectionDirty = !!(t.isProjectionDirty || t.parent.isProjectionDirty || t.parent.isSharedProjectionDirty)), t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty)); +function nre(t) { + Gf && rc.totalNodes++, t.parent && (t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty), t.isSharedProjectionDirty || (t.isSharedProjectionDirty = !!(t.isProjectionDirty || t.parent.isProjectionDirty || t.parent.isSharedProjectionDirty)), t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty)); } -function Ate(t) { +function ire(t) { t.isProjectionDirty = t.isSharedProjectionDirty = t.isTransformDirty = !1; } -function Pte(t) { +function sre(t) { t.clearSnapshot(); } -function G_(t) { +function f5(t) { t.clearMeasurements(); } -function Mte(t) { +function ore(t) { t.isLayoutDirty = !1; } -function Ite(t) { +function are(t) { const { visualElement: e } = t.options; e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform(); } -function Y_(t) { +function l5(t) { t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0; } -function Cte(t) { +function cre(t) { t.resolveTargetDelta(); } -function Tte(t) { +function ure(t) { t.calcProjection(); } -function Rte(t) { +function fre(t) { t.resetSkewAndRotation(); } -function Dte(t) { +function lre(t) { t.removeLeadSnapshot(); } -function J_(t, e, r) { +function h5(t, e, r) { t.translate = Qr(e.translate, 0, r), t.scale = Qr(e.scale, 1, r), t.origin = e.origin, t.originPoint = e.originPoint; } -function X_(t, e, r, n) { +function d5(t, e, r, n) { t.min = Qr(e.min, r.min, n), t.max = Qr(e.max, r.max, n); } -function Ote(t, e, r, n) { - X_(t.x, e.x, r.x, n), X_(t.y, e.y, r.y, n); +function hre(t, e, r, n) { + d5(t.x, e.x, r.x, n), d5(t.y, e.y, r.y, n); } -function Nte(t) { +function dre(t) { return t.animationValues && t.animationValues.opacityExit !== void 0; } -const Lte = { +const pre = { duration: 0.45, ease: [0.4, 0, 0.1, 1] -}, Z_ = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Q_ = Z_("applewebkit/") && !Z_("chrome/") ? Math.round : Un; -function e5(t) { - t.min = Q_(t.min), t.max = Q_(t.max); +}, p5 = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), g5 = p5("applewebkit/") && !p5("chrome/") ? Math.round : Un; +function m5(t) { + t.min = g5(t.min), t.max = g5(t.max); } -function kte(t) { - e5(t.x), e5(t.y); +function gre(t) { + m5(t.x), m5(t.y); } -function e9(t, e, r) { - return t === "position" || t === "preserve-aspect" && !$ee(H_(e), H_(r), 0.2); +function I9(t, e, r) { + return t === "position" || t === "preserve-aspect" && !mte(a5(e), a5(r), 0.2); } -function $te(t) { +function mre(t) { var e; return t !== t.root && ((e = t.scroll) === null || e === void 0 ? void 0 : e.wasRoot); } -const Bte = Q7({ - attachResizeListener: (t, e) => Mo(t, "resize", e), +const vre = M9({ + attachResizeListener: (t, e) => Ro(t, "resize", e), measureScroll: () => ({ x: document.documentElement.scrollLeft || document.body.scrollLeft, y: document.documentElement.scrollTop || document.body.scrollTop }), checkIsScrollRoot: () => !0 -}), qm = { +}), r1 = { current: void 0 -}, t9 = Q7({ +}, C9 = M9({ measureScroll: (t) => ({ x: t.scrollLeft, y: t.scrollTop }), defaultParent: () => { - if (!qm.current) { - const t = new Bte({}); - t.mount(window), t.setOptions({ layoutScroll: !0 }), qm.current = t; + if (!r1.current) { + const t = new vre({}); + t.mount(window), t.setOptions({ layoutScroll: !0 }), r1.current = t; } - return qm.current; + return r1.current; }, resetTransform: (t, e) => { t.style.transform = e !== void 0 ? e : "none"; }, checkIsScrollRoot: (t) => window.getComputedStyle(t).position === "fixed" -}), Fte = { +}), bre = { pan: { - Feature: Qee + Feature: Dte }, drag: { - Feature: Zee, - ProjectionNode: t9, - MeasureLayout: V7 + Feature: Rte, + ProjectionNode: C9, + MeasureLayout: x9 } }; -function t5(t, e) { +function v5(t, e) { const r = e ? "pointerenter" : "pointerleave", n = e ? "onHoverStart" : "onHoverEnd", i = (s, o) => { - if (s.pointerType === "touch" || B7()) + if (s.pointerType === "touch" || h9()) return; const a = t.getProps(); t.animationState && a.whileHover && t.animationState.setActive("whileHover", e); const u = a[n]; u && Lr.postRender(() => u(s, o)); }; - return Do(t.current, r, i, { + return ko(t.current, r, i, { passive: !t.getProps()[n] }); } -class jte extends Ra { +class yre extends $a { mount() { - this.unmount = Ro(t5(this.node, !0), t5(this.node, !1)); + this.unmount = Lo(v5(this.node, !0), v5(this.node, !1)); } unmount() { } } -class Ute extends Ra { +class wre extends $a { constructor() { super(...arguments), this.isActive = !1; } @@ -34674,52 +35188,52 @@ class Ute extends Ra { !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1); } mount() { - this.unmount = Ro(Mo(this.node.current, "focus", () => this.onFocus()), Mo(this.node.current, "blur", () => this.onBlur())); + this.unmount = Lo(Ro(this.node.current, "focus", () => this.onFocus()), Ro(this.node.current, "blur", () => this.onBlur())); } unmount() { } } -const r9 = (t, e) => e ? t === e ? !0 : r9(t, e.parentElement) : !1; -function zm(t, e) { +const T9 = (t, e) => e ? t === e ? !0 : T9(t, e.parentElement) : !1; +function n1(t, e) { if (!e) return; const r = new PointerEvent("pointer" + t); - e(r, xp(r)); + e(r, Lp(r)); } -class qte extends Ra { +class xre extends $a { constructor() { super(...arguments), this.removeStartListeners = Un, this.removeEndListeners = Un, this.removeAccessibleListeners = Un, this.startPointerPress = (e, r) => { if (this.isPressing) return; this.removeEndListeners(); - const n = this.node.getProps(), s = Do(window, "pointerup", (a, u) => { + const n = this.node.getProps(), s = ko(window, "pointerup", (a, u) => { if (!this.checkPressEnd()) return; - const { onTap: l, onTapCancel: d, globalTapTarget: p } = this.node.getProps(), w = !p && !r9(this.node.current, a.target) ? d : l; + const { onTap: l, onTapCancel: d, globalTapTarget: p } = this.node.getProps(), w = !p && !T9(this.node.current, a.target) ? d : l; w && Lr.update(() => w(a, u)); }, { passive: !(n.onTap || n.onPointerUp) - }), o = Do(window, "pointercancel", (a, u) => this.cancelPress(a, u), { + }), o = ko(window, "pointercancel", (a, u) => this.cancelPress(a, u), { passive: !(n.onTapCancel || n.onPointerCancel) }); - this.removeEndListeners = Ro(s, o), this.startPress(e, r); + this.removeEndListeners = Lo(s, o), this.startPress(e, r); }, this.startAccessiblePress = () => { const e = (s) => { if (s.key !== "Enter" || this.isPressing) return; const o = (a) => { - a.key !== "Enter" || !this.checkPressEnd() || zm("up", (u, l) => { + a.key !== "Enter" || !this.checkPressEnd() || n1("up", (u, l) => { const { onTap: d } = this.node.getProps(); d && Lr.postRender(() => d(u, l)); }); }; - this.removeEndListeners(), this.removeEndListeners = Mo(this.node.current, "keyup", o), zm("down", (a, u) => { + this.removeEndListeners(), this.removeEndListeners = Ro(this.node.current, "keyup", o), n1("down", (a, u) => { this.startPress(a, u); }); - }, r = Mo(this.node.current, "keydown", e), n = () => { - this.isPressing && zm("cancel", (s, o) => this.cancelPress(s, o)); - }, i = Mo(this.node.current, "blur", n); - this.removeAccessibleListeners = Ro(r, i); + }, r = Ro(this.node.current, "keydown", e), n = () => { + this.isPressing && n1("cancel", (s, o) => this.cancelPress(s, o)); + }, i = Ro(this.node.current, "blur", n); + this.removeAccessibleListeners = Lo(r, i); }; } startPress(e, r) { @@ -34728,7 +35242,7 @@ class qte extends Ra { i && this.node.animationState && this.node.animationState.setActive("whileTap", !0), n && Lr.postRender(() => n(e, r)); } checkPressEnd() { - return this.removeEndListeners(), this.isPressing = !1, this.node.getProps().whileTap && this.node.animationState && this.node.animationState.setActive("whileTap", !1), !B7(); + return this.removeEndListeners(), this.isPressing = !1, this.node.getProps().whileTap && this.node.animationState && this.node.animationState.setActive("whileTap", !1), !h9(); } cancelPress(e, r) { if (!this.checkPressEnd()) @@ -34737,38 +35251,38 @@ class qte extends Ra { n && Lr.postRender(() => n(e, r)); } mount() { - const e = this.node.getProps(), r = Do(e.globalTapTarget ? window : this.node.current, "pointerdown", this.startPointerPress, { + const e = this.node.getProps(), r = ko(e.globalTapTarget ? window : this.node.current, "pointerdown", this.startPointerPress, { passive: !(e.onTapStart || e.onPointerStart) - }), n = Mo(this.node.current, "focus", this.startAccessiblePress); - this.removeStartListeners = Ro(r, n); + }), n = Ro(this.node.current, "focus", this.startAccessiblePress); + this.removeStartListeners = Lo(r, n); } unmount() { this.removeStartListeners(), this.removeEndListeners(), this.removeAccessibleListeners(); } } -const fv = /* @__PURE__ */ new WeakMap(), Wm = /* @__PURE__ */ new WeakMap(), zte = (t) => { - const e = fv.get(t.target); +const Pv = /* @__PURE__ */ new WeakMap(), i1 = /* @__PURE__ */ new WeakMap(), _re = (t) => { + const e = Pv.get(t.target); e && e(t); -}, Wte = (t) => { - t.forEach(zte); +}, Ere = (t) => { + t.forEach(_re); }; -function Hte({ root: t, ...e }) { +function Sre({ root: t, ...e }) { const r = t || document; - Wm.has(r) || Wm.set(r, {}); - const n = Wm.get(r), i = JSON.stringify(e); - return n[i] || (n[i] = new IntersectionObserver(Wte, { root: t, ...e })), n[i]; -} -function Kte(t, e, r) { - const n = Hte(e); - return fv.set(t, r), n.observe(t), () => { - fv.delete(t), n.unobserve(t); + i1.has(r) || i1.set(r, {}); + const n = i1.get(r), i = JSON.stringify(e); + return n[i] || (n[i] = new IntersectionObserver(Ere, { root: t, ...e })), n[i]; +} +function Are(t, e, r) { + const n = Sre(e); + return Pv.set(t, r), n.observe(t), () => { + Pv.delete(t), n.unobserve(t); }; } -const Vte = { +const Pre = { some: 0, all: 1 }; -class Gte extends Ra { +class Mre extends $a { constructor() { super(...arguments), this.hasEnteredView = !1, this.isInView = !1; } @@ -34777,7 +35291,7 @@ class Gte extends Ra { const { viewport: e = {} } = this.node.getProps(), { root: r, margin: n, amount: i = "some", once: s } = e, o = { root: r ? r.current : void 0, rootMargin: n, - threshold: typeof i == "number" ? i : Vte[i] + threshold: typeof i == "number" ? i : Pre[i] }, a = (u) => { const { isIntersecting: l } = u; if (this.isInView === l || (this.isInView = l, s && !l && this.hasEnteredView)) @@ -34786,7 +35300,7 @@ class Gte extends Ra { const { onViewportEnter: d, onViewportLeave: p } = this.node.getProps(), w = l ? d : p; w && w(u); }; - return Kte(this.node.current, o, a); + return Are(this.node.current, o, a); } mount() { this.startObserver(); @@ -34795,40 +35309,40 @@ class Gte extends Ra { if (typeof IntersectionObserver > "u") return; const { props: e, prevProps: r } = this.node; - ["amount", "margin", "root"].some(Yte(e, r)) && this.startObserver(); + ["amount", "margin", "root"].some(Ire(e, r)) && this.startObserver(); } unmount() { } } -function Yte({ viewport: t = {} }, { viewport: e = {} } = {}) { +function Ire({ viewport: t = {} }, { viewport: e = {} } = {}) { return (r) => t[r] !== e[r]; } -const Jte = { +const Cre = { inView: { - Feature: Gte + Feature: Mre }, tap: { - Feature: qte + Feature: xre }, focus: { - Feature: Ute + Feature: wre }, hover: { - Feature: jte + Feature: yre } -}, Xte = { +}, Tre = { layout: { - ProjectionNode: t9, - MeasureLayout: V7 + ProjectionNode: C9, + MeasureLayout: x9 } -}, Zb = Sa({ +}, hy = Ta({ transformPagePoint: (t) => t, isStatic: !1, reducedMotion: "never" -}), Ep = Sa({}), Qb = typeof window < "u", n9 = Qb ? $R : Dn, i9 = Sa({ strict: !1 }); -function Zte(t, e, r, n, i) { +}), $p = Ta({}), dy = typeof window < "u", R9 = dy ? lD : Dn, D9 = Ta({ strict: !1 }); +function Rre(t, e, r, n, i) { var s, o; - const { visualElement: a } = Tn(Ep), u = Tn(i9), l = Tn(_p), d = Tn(Zb).reducedMotion, p = Zn(); + const { visualElement: a } = Tn($p), u = Tn(D9), l = Tn(kp), d = Tn(hy).reducedMotion, p = Qn(); n = n || u.renderer, !p.current && n && (p.current = n(t, { visualState: e, parent: a, @@ -34837,28 +35351,28 @@ function Zte(t, e, r, n, i) { blockInitialAnimation: l ? l.initial === !1 : !1, reducedMotionConfig: d })); - const w = p.current, A = Tn(K7); - w && !w.projection && i && (w.type === "html" || w.type === "svg") && Qte(p.current, r, i, A); - const M = Zn(!1); - y5(() => { - w && M.current && w.update(r, l); + const w = p.current, _ = Tn(w9); + w && !w.projection && i && (w.type === "html" || w.type === "svg") && Dre(p.current, r, i, _); + const P = Qn(!1); + L5(() => { + w && P.current && w.update(r, l); }); - const N = r[C7], L = Zn(!!N && !(!((s = window.MotionHandoffIsComplete) === null || s === void 0) && s.call(window, N)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, N))); - return n9(() => { - w && (M.current = !0, window.MotionIsMounted = !0, w.updateFeatures(), Xb.render(w.render), L.current && w.animationState && w.animationState.animateChanges()); + const O = r[n9], L = Qn(!!O && !(!((s = window.MotionHandoffIsComplete) === null || s === void 0) && s.call(window, O)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, O))); + return R9(() => { + w && (P.current = !0, window.MotionIsMounted = !0, w.updateFeatures(), ly.render(w.render), L.current && w.animationState && w.animationState.animateChanges()); }), Dn(() => { w && (!L.current && w.animationState && w.animationState.animateChanges(), L.current && (queueMicrotask(() => { var B; - (B = window.MotionHandoffMarkAsComplete) === null || B === void 0 || B.call(window, N); + (B = window.MotionHandoffMarkAsComplete) === null || B === void 0 || B.call(window, O); }), L.current = !1)); }), w; } -function Qte(t, e, r, n) { +function Dre(t, e, r, n) { const { layoutId: i, layout: s, drag: o, dragConstraints: a, layoutScroll: u, layoutRoot: l } = e; - t.projection = new r(t.latestValues, e["data-framer-portal-id"] ? void 0 : s9(t.parent)), t.projection.setOptions({ + t.projection = new r(t.latestValues, e["data-framer-portal-id"] ? void 0 : O9(t.parent)), t.projection.setOptions({ layoutId: i, layout: s, - alwaysMeasureLayout: !!o || a && tu(a), + alwaysMeasureLayout: !!o || a && lu(a), visualElement: t, /** * TODO: Update options in an effect. This could be tricky as it'll be too late @@ -34873,14 +35387,14 @@ function Qte(t, e, r, n) { layoutRoot: l }); } -function s9(t) { +function O9(t) { if (t) - return t.options.allowProjection !== !1 ? t.projection : s9(t.parent); + return t.options.allowProjection !== !1 ? t.projection : O9(t.parent); } -function ere(t, e, r) { - return bv( +function Ore(t, e, r) { + return Nv( (n) => { - n && t.mount && t.mount(n), e && (n ? e.mount(n) : e.unmount()), r && (typeof r == "function" ? r(n) : tu(r) && (r.current = n)); + n && t.mount && t.mount(n), e && (n ? e.mount(n) : e.unmount()), r && (typeof r == "function" ? r(n) : lu(r) && (r.current = n)); }, /** * Only pass a new ref callback to React if we've received a visual element @@ -34890,30 +35404,30 @@ function ere(t, e, r) { [e] ); } -function Sp(t) { - return bp(t.animate) || Tb.some((e) => Il(t[e])); +function Bp(t) { + return Dp(t.animate) || Wb.some((e) => Fl(t[e])); } -function o9(t) { - return !!(Sp(t) || t.variants); +function N9(t) { + return !!(Bp(t) || t.variants); } -function tre(t, e) { - if (Sp(t)) { +function Nre(t, e) { + if (Bp(t)) { const { initial: r, animate: n } = t; return { - initial: r === !1 || Il(r) ? r : void 0, - animate: Il(n) ? n : void 0 + initial: r === !1 || Fl(r) ? r : void 0, + animate: Fl(n) ? n : void 0 }; } return t.inherit !== !1 ? e : {}; } -function rre(t) { - const { initial: e, animate: r } = tre(t, Tn(Ep)); - return wi(() => ({ initial: e, animate: r }), [r5(e), r5(r)]); +function Lre(t) { + const { initial: e, animate: r } = Nre(t, Tn($p)); + return wi(() => ({ initial: e, animate: r }), [b5(e), b5(r)]); } -function r5(t) { +function b5(t) { return Array.isArray(t) ? t.join(" ") : t; } -const n5 = { +const y5 = { animation: [ "animate", "variants", @@ -34932,51 +35446,51 @@ const n5 = { pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"], inView: ["whileInView", "onViewportEnter", "onViewportLeave"], layout: ["layout", "layoutId"] -}, Cu = {}; -for (const t in n5) - Cu[t] = { - isEnabled: (e) => n5[t].some((r) => !!e[r]) +}, Bu = {}; +for (const t in y5) + Bu[t] = { + isEnabled: (e) => y5[t].some((r) => !!e[r]) }; -function nre(t) { +function kre(t) { for (const e in t) - Cu[e] = { - ...Cu[e], + Bu[e] = { + ...Bu[e], ...t[e] }; } -const ire = Symbol.for("motionComponentSymbol"); -function sre({ preloadedFeatures: t, createVisualElement: e, useRender: r, useVisualState: n, Component: i }) { - t && nre(t); +const $re = Symbol.for("motionComponentSymbol"); +function Bre({ preloadedFeatures: t, createVisualElement: e, useRender: r, useVisualState: n, Component: i }) { + t && kre(t); function s(a, u) { let l; const d = { - ...Tn(Zb), + ...Tn(hy), ...a, - layoutId: ore(a) - }, { isStatic: p } = d, w = rre(a), A = n(a, p); - if (!p && Qb) { - are(d, t); - const M = cre(d); - l = M.MeasureLayout, w.visualElement = Zte(i, A, d, e, M.ProjectionNode); + layoutId: Fre(a) + }, { isStatic: p } = d, w = Lre(a), _ = n(a, p); + if (!p && dy) { + jre(d, t); + const P = Ure(d); + l = P.MeasureLayout, w.visualElement = Rre(i, _, d, e, P.ProjectionNode); } - return le.jsxs(Ep.Provider, { value: w, children: [l && w.visualElement ? le.jsx(l, { visualElement: w.visualElement, ...d }) : null, r(i, a, ere(A, w.visualElement, u), A, p, w.visualElement)] }); + return le.jsxs($p.Provider, { value: w, children: [l && w.visualElement ? le.jsx(l, { visualElement: w.visualElement, ...d }) : null, r(i, a, Ore(_, w.visualElement, u), _, p, w.visualElement)] }); } - const o = mv(s); - return o[ire] = i, o; + const o = Dv(s); + return o[$re] = i, o; } -function ore({ layoutId: t }) { - const e = Tn(Jb).id; +function Fre({ layoutId: t }) { + const e = Tn(fy).id; return e && t !== void 0 ? e + "-" + t : t; } -function are(t, e) { - const r = Tn(i9).strict; +function jre(t, e) { + const r = Tn(D9).strict; if (process.env.NODE_ENV !== "production" && e && r) { const n = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead."; - t.ignoreStrict ? Ku(!1, n) : Uo(!1, n); + t.ignoreStrict ? Qu(!1, n) : Wo(!1, n); } } -function cre(t) { - const { drag: e, layout: r } = Cu; +function Ure(t) { + const { drag: e, layout: r } = Bu; if (!e && !r) return {}; const n = { ...e, ...r }; @@ -34985,7 +35499,7 @@ function cre(t) { ProjectionNode: n.ProjectionNode }; } -const ure = [ +const qre = [ "animate", "circle", "defs", @@ -35012,7 +35526,7 @@ const ure = [ "use", "view" ]; -function ey(t) { +function py(t) { return ( /** * If it's not a string, it's a custom React component. Currently we only support @@ -35025,19 +35539,19 @@ function ey(t) { /** * If it's in our list of lowercase SVG tags, it's an SVG component */ - !!(ure.indexOf(t) > -1 || /** + !!(qre.indexOf(t) > -1 || /** * If it contains a capital letter, it's an SVG component */ /[A-Z]/u.test(t)) ) ); } -function a9(t, { style: e, vars: r }, n, i) { +function L9(t, { style: e, vars: r }, n, i) { Object.assign(t.style, e, i && i.getProjectionStyles(n)); for (const s in r) t.style.setProperty(s, r[s]); } -const c9 = /* @__PURE__ */ new Set([ +const k9 = /* @__PURE__ */ new Set([ "baseFrequency", "diffuseConstant", "kernelMatrix", @@ -35062,102 +35576,102 @@ const c9 = /* @__PURE__ */ new Set([ "textLength", "lengthAdjust" ]); -function u9(t, e, r, n) { - a9(t, e, void 0, n); +function $9(t, e, r, n) { + L9(t, e, void 0, n); for (const i in e.attrs) - t.setAttribute(c9.has(i) ? i : Yb(i), e.attrs[i]); + t.setAttribute(k9.has(i) ? i : uy(i), e.attrs[i]); } -function f9(t, { layout: e, layoutId: r }) { - return Ac.has(t) || t.startsWith("origin") || (e || r !== void 0) && (!!_0[t] || t === "opacity"); +function B9(t, { layout: e, layoutId: r }) { + return Lc.has(t) || t.startsWith("origin") || (e || r !== void 0) && (!!N0[t] || t === "opacity"); } -function ty(t, e, r) { +function gy(t, e, r) { var n; const { style: i } = t, s = {}; for (const o in i) - (Xn(i[o]) || e.style && Xn(e.style[o]) || f9(o, t) || ((n = r == null ? void 0 : r.getValue(o)) === null || n === void 0 ? void 0 : n.liveStyle) !== void 0) && (s[o] = i[o]); + (Zn(i[o]) || e.style && Zn(e.style[o]) || B9(o, t) || ((n = r == null ? void 0 : r.getValue(o)) === null || n === void 0 ? void 0 : n.liveStyle) !== void 0) && (s[o] = i[o]); return s; } -function l9(t, e, r) { - const n = ty(t, e, r); +function F9(t, e, r) { + const n = gy(t, e, r); for (const i in t) - if (Xn(t[i]) || Xn(e[i])) { - const s = ah.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i; + if (Zn(t[i]) || Zn(e[i])) { + const s = mh.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i; n[s] = t[i]; } return n; } -function ry(t) { - const e = Zn(null); +function my(t) { + const e = Qn(null); return e.current === null && (e.current = t()), e.current; } -function fre({ scrapeMotionValuesFromProps: t, createRenderState: e, onMount: r }, n, i, s) { +function zre({ scrapeMotionValuesFromProps: t, createRenderState: e, onMount: r }, n, i, s) { const o = { - latestValues: lre(n, i, s, t), + latestValues: Wre(n, i, s, t), renderState: e() }; return r && (o.mount = (a) => r(n, a, o)), o; } -const h9 = (t) => (e, r) => { - const n = Tn(Ep), i = Tn(_p), s = () => fre(t, e, n, i); - return r ? s() : ry(s); +const j9 = (t) => (e, r) => { + const n = Tn($p), i = Tn(kp), s = () => zre(t, e, n, i); + return r ? s() : my(s); }; -function lre(t, e, r, n) { +function Wre(t, e, r, n) { const i = {}, s = n(t, {}); for (const w in s) - i[w] = Ud(s[w]); + i[w] = Qd(s[w]); let { initial: o, animate: a } = t; - const u = Sp(t), l = o9(t); + const u = Bp(t), l = N9(t); e && l && !u && t.inherit !== !1 && (o === void 0 && (o = e.initial), a === void 0 && (a = e.animate)); let d = r ? r.initial === !1 : !1; d = d || o === !1; const p = d ? a : o; - if (p && typeof p != "boolean" && !bp(p)) { + if (p && typeof p != "boolean" && !Dp(p)) { const w = Array.isArray(p) ? p : [p]; - for (let A = 0; A < w.length; A++) { - const M = Ib(t, w[A]); - if (M) { - const { transitionEnd: N, transition: L, ...B } = M; - for (const $ in B) { - let H = B[$]; - if (Array.isArray(H)) { - const U = d ? H.length - 1 : 0; - H = H[U]; + for (let _ = 0; _ < w.length; _++) { + const P = qb(t, w[_]); + if (P) { + const { transitionEnd: O, transition: L, ...B } = P; + for (const k in B) { + let q = B[k]; + if (Array.isArray(q)) { + const U = d ? q.length - 1 : 0; + q = q[U]; } - H !== null && (i[$] = H); + q !== null && (i[k] = q); } - for (const $ in N) - i[$] = N[$]; + for (const k in O) + i[k] = O[k]; } } } return i; } -const ny = () => ({ +const vy = () => ({ style: {}, transform: {}, transformOrigin: {}, vars: {} -}), d9 = () => ({ - ...ny(), +}), U9 = () => ({ + ...vy(), attrs: {} -}), p9 = (t, e) => e && typeof t == "number" ? e.transform(t) : t, hre = { +}), q9 = (t, e) => e && typeof t == "number" ? e.transform(t) : t, Hre = { x: "translateX", y: "translateY", z: "translateZ", transformPerspective: "perspective" -}, dre = ah.length; -function pre(t, e, r) { +}, Kre = mh.length; +function Vre(t, e, r) { let n = "", i = !0; - for (let s = 0; s < dre; s++) { - const o = ah[s], a = t[o]; + for (let s = 0; s < Kre; s++) { + const o = mh[s], a = t[o]; if (a === void 0) continue; let u = !0; if (typeof a == "number" ? u = a === (o.startsWith("scale") ? 1 : 0) : u = parseFloat(a) === 0, !u || r) { - const l = p9(a, Bb[o]); + const l = q9(a, Zb[o]); if (!u) { i = !1; - const d = hre[o] || o; + const d = Hre[o] || o; n += `${d}(${l}) `; } r && (e[o] = l); @@ -35165,49 +35679,49 @@ function pre(t, e, r) { } return n = n.trim(), r ? n = r(e, i ? "" : n) : i && (n = "none"), n; } -function iy(t, e, r) { +function by(t, e, r) { const { style: n, vars: i, transformOrigin: s } = t; let o = !1, a = !1; for (const u in e) { const l = e[u]; - if (Ac.has(u)) { + if (Lc.has(u)) { o = !0; continue; - } else if (o7(u)) { + } else if (N7(u)) { i[u] = l; continue; } else { - const d = p9(l, Bb[u]); + const d = q9(l, Zb[u]); u.startsWith("origin") ? (a = !0, s[u] = d) : n[u] = d; } } - if (e.transform || (o || r ? n.transform = pre(e, t.transform, r) : n.transform && (n.transform = "none")), a) { + if (e.transform || (o || r ? n.transform = Vre(e, t.transform, r) : n.transform && (n.transform = "none")), a) { const { originX: u = "50%", originY: l = "50%", originZ: d = 0 } = s; n.transformOrigin = `${u} ${l} ${d}`; } } -function i5(t, e, r) { +function w5(t, e, r) { return typeof t == "string" ? t : Vt.transform(e + r * t); } -function gre(t, e, r) { - const n = i5(e, t.x, t.width), i = i5(r, t.y, t.height); +function Gre(t, e, r) { + const n = w5(e, t.x, t.width), i = w5(r, t.y, t.height); return `${n} ${i}`; } -const mre = { +const Yre = { offset: "stroke-dashoffset", array: "stroke-dasharray" -}, vre = { +}, Jre = { offset: "strokeDashoffset", array: "strokeDasharray" }; -function bre(t, e, r = 1, n = 0, i = !0) { +function Xre(t, e, r = 1, n = 0, i = !0) { t.pathLength = 1; - const s = i ? mre : vre; + const s = i ? Yre : Jre; t[s.offset] = Vt.transform(-n); const o = Vt.transform(e), a = Vt.transform(r); t[s.array] = `${o} ${a}`; } -function sy(t, { +function yy(t, { attrX: e, attrY: r, attrScale: n, @@ -35219,18 +35733,18 @@ function sy(t, { // This is object creation, which we try to avoid per-frame. ...l }, d, p) { - if (iy(t, l, p), d) { + if (by(t, l, p), d) { t.style.viewBox && (t.attrs.viewBox = t.style.viewBox); return; } t.attrs = t.style, t.style = {}; - const { attrs: w, style: A, dimensions: M } = t; - w.transform && (M && (A.transform = w.transform), delete w.transform), M && (i !== void 0 || s !== void 0 || A.transform) && (A.transformOrigin = gre(M, i !== void 0 ? i : 0.5, s !== void 0 ? s : 0.5)), e !== void 0 && (w.x = e), r !== void 0 && (w.y = r), n !== void 0 && (w.scale = n), o !== void 0 && bre(w, o, a, u, !1); + const { attrs: w, style: _, dimensions: P } = t; + w.transform && (P && (_.transform = w.transform), delete w.transform), P && (i !== void 0 || s !== void 0 || _.transform) && (_.transformOrigin = Gre(P, i !== void 0 ? i : 0.5, s !== void 0 ? s : 0.5)), e !== void 0 && (w.x = e), r !== void 0 && (w.y = r), n !== void 0 && (w.scale = n), o !== void 0 && Xre(w, o, a, u, !1); } -const oy = (t) => typeof t == "string" && t.toLowerCase() === "svg", yre = { - useVisualState: h9({ - scrapeMotionValuesFromProps: l9, - createRenderState: d9, +const wy = (t) => typeof t == "string" && t.toLowerCase() === "svg", Zre = { + useVisualState: j9({ + scrapeMotionValuesFromProps: F9, + createRenderState: U9, onMount: (t, e, { renderState: r, latestValues: n }) => { Lr.read(() => { try { @@ -35244,35 +35758,35 @@ const oy = (t) => typeof t == "string" && t.toLowerCase() === "svg", yre = { }; } }), Lr.render(() => { - sy(r, n, oy(e.tagName), t.transformTemplate), u9(e, r); + yy(r, n, wy(e.tagName), t.transformTemplate), $9(e, r); }); } }) -}, wre = { - useVisualState: h9({ - scrapeMotionValuesFromProps: ty, - createRenderState: ny +}, Qre = { + useVisualState: j9({ + scrapeMotionValuesFromProps: gy, + createRenderState: vy }) }; -function g9(t, e, r) { +function z9(t, e, r) { for (const n in e) - !Xn(e[n]) && !f9(n, r) && (t[n] = e[n]); + !Zn(e[n]) && !B9(n, r) && (t[n] = e[n]); } -function xre({ transformTemplate: t }, e) { +function ene({ transformTemplate: t }, e) { return wi(() => { - const r = ny(); - return iy(r, e, t), Object.assign({}, r.vars, r.style); + const r = vy(); + return by(r, e, t), Object.assign({}, r.vars, r.style); }, [e]); } -function _re(t, e) { +function tne(t, e) { const r = t.style || {}, n = {}; - return g9(n, r, t), Object.assign(n, xre(t, e)), n; + return z9(n, r, t), Object.assign(n, ene(t, e)), n; } -function Ere(t, e) { - const r = {}, n = _re(t, e); +function rne(t, e) { + const r = {}, n = tne(t, e); return t.drag && t.dragListener !== !1 && (r.draggable = !1, n.userSelect = n.WebkitUserSelect = n.WebkitTouchCallout = "none", n.touchAction = t.drag === !0 ? "none" : `pan-${t.drag === "x" ? "y" : "x"}`), t.tabIndex === void 0 && (t.onTap || t.onTapStart || t.whileTap) && (r.tabIndex = 0), r.style = n, r; } -const Sre = /* @__PURE__ */ new Set([ +const nne = /* @__PURE__ */ new Set([ "animate", "exit", "variants", @@ -35304,89 +35818,89 @@ const Sre = /* @__PURE__ */ new Set([ "ignoreStrict", "viewport" ]); -function E0(t) { - return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || Sre.has(t); +function L0(t) { + return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || nne.has(t); } -let m9 = (t) => !E0(t); -function Are(t) { - t && (m9 = (e) => e.startsWith("on") ? !E0(e) : t(e)); +let W9 = (t) => !L0(t); +function ine(t) { + t && (W9 = (e) => e.startsWith("on") ? !L0(e) : t(e)); } try { - Are(require("@emotion/is-prop-valid").default); + ine(require("@emotion/is-prop-valid").default); } catch { } -function Pre(t, e, r) { +function sne(t, e, r) { const n = {}; for (const i in t) - i === "values" && typeof t.values == "object" || (m9(i) || r === !0 && E0(i) || !e && !E0(i) || // If trying to use native HTML drag events, forward drag listeners + i === "values" && typeof t.values == "object" || (W9(i) || r === !0 && L0(i) || !e && !L0(i) || // If trying to use native HTML drag events, forward drag listeners t.draggable && i.startsWith("onDrag")) && (n[i] = t[i]); return n; } -function Mre(t, e, r, n) { +function one(t, e, r, n) { const i = wi(() => { - const s = d9(); - return sy(s, e, oy(n), t.transformTemplate), { + const s = U9(); + return yy(s, e, wy(n), t.transformTemplate), { ...s.attrs, style: { ...s.style } }; }, [e]); if (t.style) { const s = {}; - g9(s, t.style, t), i.style = { ...s, ...i.style }; + z9(s, t.style, t), i.style = { ...s, ...i.style }; } return i; } -function Ire(t = !1) { +function ane(t = !1) { return (r, n, i, { latestValues: s }, o) => { - const u = (ey(r) ? Mre : Ere)(n, s, o, r), l = Pre(n, typeof r == "string", t), d = r !== w5 ? { ...l, ...u, ref: i } : {}, { children: p } = n, w = wi(() => Xn(p) ? p.get() : p, [p]); - return qd(r, { + const u = (py(r) ? one : rne)(n, s, o, r), l = sne(n, typeof r == "string", t), d = r !== k5 ? { ...l, ...u, ref: i } : {}, { children: p } = n, w = wi(() => Zn(p) ? p.get() : p, [p]); + return e0(r, { ...d, children: w }); }; } -function Cre(t, e) { +function cne(t, e) { return function(n, { forwardMotionProps: i } = { forwardMotionProps: !1 }) { const o = { - ...ey(n) ? yre : wre, + ...py(n) ? Zre : Qre, preloadedFeatures: t, - useRender: Ire(i), + useRender: ane(i), createVisualElement: e, Component: n }; - return sre(o); + return Bre(o); }; } -const lv = { current: null }, v9 = { current: !1 }; -function Tre() { - if (v9.current = !0, !!Qb) +const Mv = { current: null }, H9 = { current: !1 }; +function une() { + if (H9.current = !0, !!dy) if (window.matchMedia) { - const t = window.matchMedia("(prefers-reduced-motion)"), e = () => lv.current = t.matches; + const t = window.matchMedia("(prefers-reduced-motion)"), e = () => Mv.current = t.matches; t.addListener(e), e(); } else - lv.current = !1; + Mv.current = !1; } -function Rre(t, e, r) { +function fne(t, e, r) { for (const n in e) { const i = e[n], s = r[n]; - if (Xn(i)) - t.addValue(n, i), process.env.NODE_ENV === "development" && vp(i.version === "11.11.17", `Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`); - else if (Xn(s)) - t.addValue(n, Rl(i, { owner: t })); + if (Zn(i)) + t.addValue(n, i), process.env.NODE_ENV === "development" && Rp(i.version === "11.11.17", `Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`); + else if (Zn(s)) + t.addValue(n, ql(i, { owner: t })); else if (s !== i) if (t.hasValue(n)) { const o = t.getValue(n); o.liveStyle === !0 ? o.jump(i) : o.hasAnimated || o.set(i); } else { const o = t.getStaticValue(n); - t.addValue(n, Rl(o !== void 0 ? o : i, { owner: t })); + t.addValue(n, ql(o !== void 0 ? o : i, { owner: t })); } } for (const n in r) e[n] === void 0 && t.removeValue(n); return e; } -const s5 = /* @__PURE__ */ new WeakMap(), Dre = [...u7, Yn, _a], Ore = (t) => Dre.find(c7(t)), o5 = [ +const x5 = /* @__PURE__ */ new WeakMap(), lne = [...$7, Yn, Ia], hne = (t) => lne.find(k7(t)), _5 = [ "AnimationStart", "AnimationComplete", "Update", @@ -35395,7 +35909,7 @@ const s5 = /* @__PURE__ */ new WeakMap(), Dre = [...u7, Yn, _a], Ore = (t) => Dr "LayoutAnimationStart", "LayoutAnimationComplete" ]; -class Nre { +class dne { /** * This method takes React props and returns found MotionValues. For example, HTML * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays. @@ -35407,25 +35921,25 @@ class Nre { return {}; } constructor({ parent: e, props: r, presenceContext: n, reducedMotionConfig: i, blockInitialAnimation: s, visualState: o }, a = {}) { - this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = Lb, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => { + this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = Yb, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => { this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection)); }, this.renderScheduledAt = 0, this.scheduleRender = () => { - const w = Ys.now(); + const w = Zs.now(); this.renderScheduledAt < w && (this.renderScheduledAt = w, Lr.render(this.render, !1, !0)); }; const { latestValues: u, renderState: l } = o; - this.latestValues = u, this.baseTarget = { ...u }, this.initialValues = r.initial ? { ...u } : {}, this.renderState = l, this.parent = e, this.props = r, this.presenceContext = n, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!s, this.isControllingVariants = Sp(r), this.isVariantNode = o9(r), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current); + this.latestValues = u, this.baseTarget = { ...u }, this.initialValues = r.initial ? { ...u } : {}, this.renderState = l, this.parent = e, this.props = r, this.presenceContext = n, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!s, this.isControllingVariants = Bp(r), this.isVariantNode = N9(r), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current); const { willChange: d, ...p } = this.scrapeMotionValuesFromProps(r, {}, this); for (const w in p) { - const A = p[w]; - u[w] !== void 0 && Xn(A) && A.set(u[w], !1); + const _ = p[w]; + u[w] !== void 0 && Zn(_) && _.set(u[w], !1); } } mount(e) { - this.current = e, s5.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((r, n) => this.bindToMotionValue(n, r)), v9.current || Tre(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : lv.current, process.env.NODE_ENV !== "production" && vp(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext); + this.current = e, x5.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((r, n) => this.bindToMotionValue(n, r)), H9.current || une(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : Mv.current, process.env.NODE_ENV !== "production" && Rp(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext); } unmount() { - s5.delete(this.current), this.projection && this.projection.unmount(), wa(this.notifyUpdate), wa(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this); + x5.delete(this.current), this.projection && this.projection.unmount(), Pa(this.notifyUpdate), Pa(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this); for (const e in this.events) this.events[e].clear(); for (const e in this.features) { @@ -35436,7 +35950,7 @@ class Nre { } bindToMotionValue(e, r) { this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)(); - const n = Ac.has(e), i = r.on("change", (a) => { + const n = Lc.has(e), i = r.on("change", (a) => { this.latestValues[e] = a, this.props.onUpdate && Lr.preRender(this.notifyUpdate), n && this.projection && (this.projection.isTransformDirty = !0); }), s = r.on("renderRequest", this.scheduleRender); let o; @@ -35449,8 +35963,8 @@ class Nre { } updateFeatures() { let e = "animation"; - for (e in Cu) { - const r = Cu[e]; + for (e in Bu) { + const r = Bu[e]; if (!r) continue; const { isEnabled: n, Feature: i } = r; @@ -35483,13 +35997,13 @@ class Nre { */ update(e, r) { (e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = r; - for (let n = 0; n < o5.length; n++) { - const i = o5[n]; + for (let n = 0; n < _5.length; n++) { + const i = _5[n]; this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]); const s = "on" + i, o = e[s]; o && (this.propEventSubscriptions[i] = this.on(i, o)); } - this.prevMotionValues = Rre(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue(); + this.prevMotionValues = fne(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue(); } getProps() { return this.props; @@ -35545,7 +36059,7 @@ class Nre { if (this.props.values && this.props.values[e]) return this.props.values[e]; let n = this.values.get(e); - return n === void 0 && r !== void 0 && (n = Rl(r === null ? void 0 : r, { owner: this }), this.addValue(e, n)), n; + return n === void 0 && r !== void 0 && (n = ql(r === null ? void 0 : r, { owner: this }), this.addValue(e, n)), n; } /** * If we're trying to animate to a previously unencountered value, @@ -35555,7 +36069,7 @@ class Nre { readValue(e, r) { var n; let i = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : (n = this.getBaseTargetFromProps(this.props, e)) !== null && n !== void 0 ? n : this.readValueFromInstance(this.current, e, this.options); - return i != null && (typeof i == "string" && (i7(i) || n7(i)) ? i = parseFloat(i) : !Ore(i) && _a.test(r) && (i = v7(e, r)), this.setBaseTarget(e, Xn(i) ? i.get() : i)), Xn(i) ? i.get() : i; + return i != null && (typeof i == "string" && (D7(i) || R7(i)) ? i = parseFloat(i) : !hne(i) && Ia.test(r) && (i = H7(e, r)), this.setBaseTarget(e, Zn(i) ? i.get() : i)), Zn(i) ? i.get() : i; } /** * Set the base target to later animate back to. This is currently @@ -35573,24 +36087,24 @@ class Nre { const { initial: n } = this.props; let i; if (typeof n == "string" || typeof n == "object") { - const o = Ib(this.props, n, (r = this.presenceContext) === null || r === void 0 ? void 0 : r.custom); + const o = qb(this.props, n, (r = this.presenceContext) === null || r === void 0 ? void 0 : r.custom); o && (i = o[e]); } if (n && i !== void 0) return i; const s = this.getBaseTargetFromProps(this.props, e); - return s !== void 0 && !Xn(s) ? s : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e]; + return s !== void 0 && !Zn(s) ? s : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e]; } on(e, r) { - return this.events[e] || (this.events[e] = new Gb()), this.events[e].add(r); + return this.events[e] || (this.events[e] = new cy()), this.events[e].add(r); } notify(e, ...r) { this.events[e] && this.events[e].notify(...r); } } -class b9 extends Nre { +class K9 extends dne { constructor() { - super(...arguments), this.KeyframeResolver = b7; + super(...arguments), this.KeyframeResolver = K7; } sortInstanceNodePosition(e, r) { return e.compareDocumentPosition(r) & 2 ? 1 : -1; @@ -35602,40 +36116,40 @@ class b9 extends Nre { delete r[e], delete n[e]; } } -function Lre(t) { +function pne(t) { return window.getComputedStyle(t); } -class kre extends b9 { +class gne extends K9 { constructor() { - super(...arguments), this.type = "html", this.renderInstance = a9; + super(...arguments), this.type = "html", this.renderInstance = L9; } readValueFromInstance(e, r) { - if (Ac.has(r)) { - const n = Fb(r); + if (Lc.has(r)) { + const n = Qb(r); return n && n.default || 0; } else { - const n = Lre(e), i = (o7(r) ? n.getPropertyValue(r) : n[r]) || 0; + const n = pne(e), i = (N7(r) ? n.getPropertyValue(r) : n[r]) || 0; return typeof i == "string" ? i.trim() : i; } } measureInstanceViewportBox(e, { transformPagePoint: r }) { - return W7(e, r); + return b9(e, r); } build(e, r, n) { - iy(e, r, n.transformTemplate); + by(e, r, n.transformTemplate); } scrapeMotionValuesFromProps(e, r, n) { - return ty(e, r, n); + return gy(e, r, n); } handleChildMotionValue() { this.childSubscription && (this.childSubscription(), delete this.childSubscription); const { children: e } = this.props; - Xn(e) && (this.childSubscription = e.on("change", (r) => { + Zn(e) && (this.childSubscription = e.on("change", (r) => { this.current && (this.current.textContent = `${r}`); })); } } -class $re extends b9 { +class mne extends K9 { constructor() { super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = ln; } @@ -35643,34 +36157,34 @@ class $re extends b9 { return e[r]; } readValueFromInstance(e, r) { - if (Ac.has(r)) { - const n = Fb(r); + if (Lc.has(r)) { + const n = Qb(r); return n && n.default || 0; } - return r = c9.has(r) ? r : Yb(r), e.getAttribute(r); + return r = k9.has(r) ? r : uy(r), e.getAttribute(r); } scrapeMotionValuesFromProps(e, r, n) { - return l9(e, r, n); + return F9(e, r, n); } build(e, r, n) { - sy(e, r, this.isSVGTag, n.transformTemplate); + yy(e, r, this.isSVGTag, n.transformTemplate); } renderInstance(e, r, n, i) { - u9(e, r, n, i); + $9(e, r, n, i); } mount(e) { - this.isSVGTag = oy(e.tagName), super.mount(e); - } -} -const Bre = (t, e) => ey(t) ? new $re(e) : new kre(e, { - allowProjection: t !== w5 -}), Fre = /* @__PURE__ */ Cre({ - ...Iee, - ...Jte, - ...Fte, - ...Xte -}, Bre), jre = /* @__PURE__ */ yZ(Fre); -class Ure extends Gt.Component { + this.isSVGTag = wy(e.tagName), super.mount(e); + } +} +const vne = (t, e) => py(t) ? new mne(e) : new gne(e, { + allowProjection: t !== k5 +}), bne = /* @__PURE__ */ cne({ + ...ate, + ...Cre, + ...bre, + ...Tre +}, vne), yne = /* @__PURE__ */ ZZ(bne); +class wne extends Gt.Component { getSnapshotBeforeUpdate(e) { const r = this.props.childRef.current; if (r && e.isPresent && !this.props.isPresent) { @@ -35688,14 +36202,14 @@ class Ure extends Gt.Component { return this.props.children; } } -function qre({ children: t, isPresent: e }) { - const r = vv(), n = Zn(null), i = Zn({ +function xne({ children: t, isPresent: e }) { + const r = Ov(), n = Qn(null), i = Qn({ width: 0, height: 0, top: 0, left: 0 - }), { nonce: s } = Tn(Zb); - return y5(() => { + }), { nonce: s } = Tn(hy); + return L5(() => { const { width: o, height: a, top: u, left: l } = i.current; if (e || !n.current || !o || !a) return; @@ -35712,10 +36226,10 @@ function qre({ children: t, isPresent: e }) { `), () => { document.head.removeChild(d); }; - }, [e]), le.jsx(Ure, { isPresent: e, childRef: n, sizeRef: i, children: Gt.cloneElement(t, { ref: n }) }); + }, [e]), le.jsx(wne, { isPresent: e, childRef: n, sizeRef: i, children: Gt.cloneElement(t, { ref: n }) }); } -const zre = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: i, presenceAffectsLayout: s, mode: o }) => { - const a = ry(Wre), u = vv(), l = bv((p) => { +const _ne = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: i, presenceAffectsLayout: s, mode: o }) => { + const a = my(Ene), u = Ov(), l = Nv((p) => { a.set(p, !0); for (const w of a.values()) if (!w) @@ -35741,55 +36255,55 @@ const zre = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: a.forEach((p, w) => a.set(w, !1)); }, [r]), Gt.useEffect(() => { !r && !a.size && n && n(); - }, [r]), o === "popLayout" && (t = le.jsx(qre, { isPresent: r, children: t })), le.jsx(_p.Provider, { value: d, children: t }); + }, [r]), o === "popLayout" && (t = le.jsx(xne, { isPresent: r, children: t })), le.jsx(kp.Provider, { value: d, children: t }); }; -function Wre() { +function Ene() { return /* @__PURE__ */ new Map(); } -const bd = (t) => t.key || ""; -function a5(t) { +const Cd = (t) => t.key || ""; +function E5(t) { const e = []; - return BR.forEach(t, (r) => { - FR(r) && e.push(r); + return hD.forEach(t, (r) => { + dD(r) && e.push(r); }), e; } -const Hre = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExitComplete: i, presenceAffectsLayout: s = !0, mode: o = "sync" }) => { - Uo(!e, "Replace exitBeforeEnter with mode='wait'"); - const a = wi(() => a5(t), [t]), u = a.map(bd), l = Zn(!0), d = Zn(a), p = ry(() => /* @__PURE__ */ new Map()), [w, A] = Yt(a), [M, N] = Yt(a); - n9(() => { +const Sne = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExitComplete: i, presenceAffectsLayout: s = !0, mode: o = "sync" }) => { + Wo(!e, "Replace exitBeforeEnter with mode='wait'"); + const a = wi(() => E5(t), [t]), u = a.map(Cd), l = Qn(!0), d = Qn(a), p = my(() => /* @__PURE__ */ new Map()), [w, _] = Yt(a), [P, O] = Yt(a); + R9(() => { l.current = !1, d.current = a; - for (let $ = 0; $ < M.length; $++) { - const H = bd(M[$]); - u.includes(H) ? p.delete(H) : p.get(H) !== !0 && p.set(H, !1); + for (let k = 0; k < P.length; k++) { + const q = Cd(P[k]); + u.includes(q) ? p.delete(q) : p.get(q) !== !0 && p.set(q, !1); } - }, [M, u.length, u.join("-")]); + }, [P, u.length, u.join("-")]); const L = []; if (a !== w) { - let $ = [...a]; - for (let H = 0; H < M.length; H++) { - const U = M[H], V = bd(U); - u.includes(V) || ($.splice(H, 0, U), L.push(U)); + let k = [...a]; + for (let q = 0; q < P.length; q++) { + const U = P[q], V = Cd(U); + u.includes(V) || (k.splice(q, 0, U), L.push(U)); } - o === "wait" && L.length && ($ = L), N(a5($)), A(a); + o === "wait" && L.length && (k = L), O(E5(k)), _(a); return; } - process.env.NODE_ENV !== "production" && o === "wait" && M.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`); - const { forceRender: B } = Tn(Jb); - return le.jsx(le.Fragment, { children: M.map(($) => { - const H = bd($), U = a === M || u.includes(H), V = () => { - if (p.has(H)) - p.set(H, !0); + process.env.NODE_ENV !== "production" && o === "wait" && P.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`); + const { forceRender: B } = Tn(fy); + return le.jsx(le.Fragment, { children: P.map((k) => { + const q = Cd(k), U = a === P || u.includes(q), V = () => { + if (p.has(q)) + p.set(q, !0); else return; - let te = !0; + let Q = !0; p.forEach((R) => { - R || (te = !1); - }), te && (B == null || B(), N(d.current), i && i()); + R || (Q = !1); + }), Q && (B == null || B(), O(d.current), i && i()); }; - return le.jsx(zre, { isPresent: U, initial: !l.current || n ? void 0 : !1, custom: U ? void 0 : r, presenceAffectsLayout: s, mode: o, onExitComplete: U ? void 0 : V, children: $ }, H); + return le.jsx(_ne, { isPresent: U, initial: !l.current || n ? void 0 : !1, custom: U ? void 0 : r, presenceAffectsLayout: s, mode: o, onExitComplete: U ? void 0 : V, children: k }, q); }) }); -}, Ms = (t) => /* @__PURE__ */ le.jsx(Hre, { children: /* @__PURE__ */ le.jsx( - jre.div, +}, Rs = (t) => /* @__PURE__ */ le.jsx(Sne, { children: /* @__PURE__ */ le.jsx( + yne.div, { initial: { x: 0, opacity: 0 }, animate: { x: 0, opacity: 1 }, @@ -35799,7 +36313,7 @@ const Hre = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onEx children: t.children } ) }); -function ay(t) { +function xy(t) { const { icon: e, title: r, extra: n, onClick: i } = t; function s() { i && i(); @@ -35814,13 +36328,13 @@ function ay(t) { r, /* @__PURE__ */ le.jsxs("div", { className: "xc-relative xc-ml-auto xc-h-6", children: [ /* @__PURE__ */ le.jsx("div", { className: "xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0", children: n }), - /* @__PURE__ */ le.jsx("div", { className: "xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100", children: /* @__PURE__ */ le.jsx(hZ, {}) }) + /* @__PURE__ */ le.jsx("div", { className: "xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100", children: /* @__PURE__ */ le.jsx(HZ, {}) }) ] }) ] } ); } -function Kre(t) { +function Ane(t) { return t.lastUsed ? /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500", children: [ /* @__PURE__ */ le.jsx("div", { className: "xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]" }), "Last Used" @@ -35829,59 +36343,59 @@ function Kre(t) { "Installed" ] }) : null; } -function y9(t) { +function V9(t) { var o, a; - const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: (o = e.config) == null ? void 0 : o.image }), i = ((a = e.config) == null ? void 0 : a.name) || "", s = wi(() => Kre(e), [e]); - return /* @__PURE__ */ le.jsx(ay, { icon: n, title: i, extra: s, onClick: () => r(e) }); + const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: (o = e.config) == null ? void 0 : o.image }), i = ((a = e.config) == null ? void 0 : a.name) || "", s = wi(() => Ane(e), [e]); + return /* @__PURE__ */ le.jsx(xy, { icon: n, title: i, extra: s, onClick: () => r(e) }); } -function w9(t) { +function G9(t) { var e, r, n = ""; if (typeof t == "string" || typeof t == "number") n += t; else if (typeof t == "object") if (Array.isArray(t)) { var i = t.length; - for (e = 0; e < i; e++) t[e] && (r = w9(t[e])) && (n && (n += " "), n += r); + for (e = 0; e < i; e++) t[e] && (r = G9(t[e])) && (n && (n += " "), n += r); } else for (r in t) t[r] && (n && (n += " "), n += r); return n; } -function Vre() { - for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++) (t = arguments[r]) && (e = w9(t)) && (n && (n += " "), n += e); +function Pne() { + for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++) (t = arguments[r]) && (e = G9(t)) && (n && (n += " "), n += e); return n; } -const Gre = Vre, cy = "-", Yre = (t) => { - const e = Xre(t), { +const Mne = Pne, _y = "-", Ine = (t) => { + const e = Tne(t), { conflictingClassGroups: r, conflictingClassGroupModifiers: n } = t; return { getClassGroupId: (o) => { - const a = o.split(cy); - return a[0] === "" && a.length !== 1 && a.shift(), x9(a, e) || Jre(o); + const a = o.split(_y); + return a[0] === "" && a.length !== 1 && a.shift(), Y9(a, e) || Cne(o); }, getConflictingClassGroupIds: (o, a) => { const u = r[o] || []; return a && n[o] ? [...u, ...n[o]] : u; } }; -}, x9 = (t, e) => { +}, Y9 = (t, e) => { var o; if (t.length === 0) return e.classGroupId; - const r = t[0], n = e.nextPart.get(r), i = n ? x9(t.slice(1), n) : void 0; + const r = t[0], n = e.nextPart.get(r), i = n ? Y9(t.slice(1), n) : void 0; if (i) return i; if (e.validators.length === 0) return; - const s = t.join(cy); + const s = t.join(_y); return (o = e.validators.find(({ validator: a }) => a(s))) == null ? void 0 : o.classGroupId; -}, c5 = /^\[(.+)\]$/, Jre = (t) => { - if (c5.test(t)) { - const e = c5.exec(t)[1], r = e == null ? void 0 : e.substring(0, e.indexOf(":")); +}, S5 = /^\[(.+)\]$/, Cne = (t) => { + if (S5.test(t)) { + const e = S5.exec(t)[1], r = e == null ? void 0 : e.substring(0, e.indexOf(":")); if (r) return "arbitrary.." + r; } -}, Xre = (t) => { +}, Tne = (t) => { const { theme: e, prefix: r @@ -35889,19 +36403,19 @@ const Gre = Vre, cy = "-", Yre = (t) => { nextPart: /* @__PURE__ */ new Map(), validators: [] }; - return Qre(Object.entries(t.classGroups), r).forEach(([s, o]) => { - hv(o, n, s, e); + return Dne(Object.entries(t.classGroups), r).forEach(([s, o]) => { + Iv(o, n, s, e); }), n; -}, hv = (t, e, r, n) => { +}, Iv = (t, e, r, n) => { t.forEach((i) => { if (typeof i == "string") { - const s = i === "" ? e : u5(e, i); + const s = i === "" ? e : A5(e, i); s.classGroupId = r; return; } if (typeof i == "function") { - if (Zre(i)) { - hv(i(n), e, r, n); + if (Rne(i)) { + Iv(i(n), e, r, n); return; } e.validators.push({ @@ -35911,21 +36425,21 @@ const Gre = Vre, cy = "-", Yre = (t) => { return; } Object.entries(i).forEach(([s, o]) => { - hv(o, u5(e, s), r, n); + Iv(o, A5(e, s), r, n); }); }); -}, u5 = (t, e) => { +}, A5 = (t, e) => { let r = t; - return e.split(cy).forEach((n) => { + return e.split(_y).forEach((n) => { r.nextPart.has(n) || r.nextPart.set(n, { nextPart: /* @__PURE__ */ new Map(), validators: [] }), r = r.nextPart.get(n); }), r; -}, Zre = (t) => t.isThemeGetter, Qre = (t, e) => e ? t.map(([r, n]) => { +}, Rne = (t) => t.isThemeGetter, Dne = (t, e) => e ? t.map(([r, n]) => { const i = n.map((s) => typeof s == "string" ? e + s : typeof s == "object" ? Object.fromEntries(Object.entries(s).map(([o, a]) => [e + o, a])) : s); return [r, i]; -}) : t, ene = (t) => { +}) : t, One = (t) => { if (t < 1) return { get: () => { @@ -35949,7 +36463,7 @@ const Gre = Vre, cy = "-", Yre = (t) => { r.has(s) ? r.set(s, o) : i(s, o); } }; -}, _9 = "!", tne = (t) => { +}, J9 = "!", Nne = (t) => { const { separator: e, experimentalParseClassName: r @@ -35970,19 +36484,19 @@ const Gre = Vre, cy = "-", Yre = (t) => { } B === "[" ? l++ : B === "]" && l--; } - const w = u.length === 0 ? a : a.substring(d), A = w.startsWith(_9), M = A ? w.substring(1) : w, N = p && p > d ? p - d : void 0; + const w = u.length === 0 ? a : a.substring(d), _ = w.startsWith(J9), P = _ ? w.substring(1) : w, O = p && p > d ? p - d : void 0; return { modifiers: u, - hasImportantModifier: A, - baseClassName: M, - maybePostfixModifierPosition: N + hasImportantModifier: _, + baseClassName: P, + maybePostfixModifierPosition: O }; }; return r ? (a) => r({ className: a, parseClassName: o }) : o; -}, rne = (t) => { +}, Lne = (t) => { if (t.length <= 1) return t; const e = []; @@ -35990,122 +36504,122 @@ const Gre = Vre, cy = "-", Yre = (t) => { return t.forEach((n) => { n[0] === "[" ? (e.push(...r.sort(), n), r = []) : r.push(n); }), e.push(...r.sort()), e; -}, nne = (t) => ({ - cache: ene(t.cacheSize), - parseClassName: tne(t), - ...Yre(t) -}), ine = /\s+/, sne = (t, e) => { +}, kne = (t) => ({ + cache: One(t.cacheSize), + parseClassName: Nne(t), + ...Ine(t) +}), $ne = /\s+/, Bne = (t, e) => { const { parseClassName: r, getClassGroupId: n, getConflictingClassGroupIds: i - } = e, s = [], o = t.trim().split(ine); + } = e, s = [], o = t.trim().split($ne); let a = ""; for (let u = o.length - 1; u >= 0; u -= 1) { const l = o[u], { modifiers: d, hasImportantModifier: p, baseClassName: w, - maybePostfixModifierPosition: A + maybePostfixModifierPosition: _ } = r(l); - let M = !!A, N = n(M ? w.substring(0, A) : w); - if (!N) { - if (!M) { + let P = !!_, O = n(P ? w.substring(0, _) : w); + if (!O) { + if (!P) { a = l + (a.length > 0 ? " " + a : a); continue; } - if (N = n(w), !N) { + if (O = n(w), !O) { a = l + (a.length > 0 ? " " + a : a); continue; } - M = !1; + P = !1; } - const L = rne(d).join(":"), B = p ? L + _9 : L, $ = B + N; - if (s.includes($)) + const L = Lne(d).join(":"), B = p ? L + J9 : L, k = B + O; + if (s.includes(k)) continue; - s.push($); - const H = i(N, M); - for (let U = 0; U < H.length; ++U) { - const V = H[U]; + s.push(k); + const q = i(O, P); + for (let U = 0; U < q.length; ++U) { + const V = q[U]; s.push(B + V); } a = l + (a.length > 0 ? " " + a : a); } return a; }; -function one() { +function Fne() { let t = 0, e, r, n = ""; for (; t < arguments.length; ) - (e = arguments[t++]) && (r = E9(e)) && (n && (n += " "), n += r); + (e = arguments[t++]) && (r = X9(e)) && (n && (n += " "), n += r); return n; } -const E9 = (t) => { +const X9 = (t) => { if (typeof t == "string") return t; let e, r = ""; for (let n = 0; n < t.length; n++) - t[n] && (e = E9(t[n])) && (r && (r += " "), r += e); + t[n] && (e = X9(t[n])) && (r && (r += " "), r += e); return r; }; -function ane(t, ...e) { +function jne(t, ...e) { let r, n, i, s = o; function o(u) { const l = e.reduce((d, p) => p(d), t()); - return r = nne(l), n = r.cache.get, i = r.cache.set, s = a, a(u); + return r = kne(l), n = r.cache.get, i = r.cache.set, s = a, a(u); } function a(u) { const l = n(u); if (l) return l; - const d = sne(u, r); + const d = Bne(u, r); return i(u, d), d; } return function() { - return s(one.apply(null, arguments)); + return s(Fne.apply(null, arguments)); }; } const Gr = (t) => { const e = (r) => r[t] || []; return e.isThemeGetter = !0, e; -}, S9 = /^\[(?:([a-z-]+):)?(.+)\]$/i, cne = /^\d+\/\d+$/, une = /* @__PURE__ */ new Set(["px", "full", "screen"]), fne = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, lne = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, hne = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, dne = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, pne = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, bo = (t) => mu(t) || une.has(t) || cne.test(t), na = (t) => Gu(t, "length", _ne), mu = (t) => !!t && !Number.isNaN(Number(t)), Hm = (t) => Gu(t, "number", mu), Nf = (t) => !!t && Number.isInteger(Number(t)), gne = (t) => t.endsWith("%") && mu(t.slice(0, -1)), ur = (t) => S9.test(t), ia = (t) => fne.test(t), mne = /* @__PURE__ */ new Set(["length", "size", "percentage"]), vne = (t) => Gu(t, mne, A9), bne = (t) => Gu(t, "position", A9), yne = /* @__PURE__ */ new Set(["image", "url"]), wne = (t) => Gu(t, yne, Sne), xne = (t) => Gu(t, "", Ene), Lf = () => !0, Gu = (t, e, r) => { - const n = S9.exec(t); +}, Z9 = /^\[(?:([a-z-]+):)?(.+)\]$/i, Une = /^\d+\/\d+$/, qne = /* @__PURE__ */ new Set(["px", "full", "screen"]), zne = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, Wne = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, Hne = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, Kne = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, Vne = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, _o = (t) => Pu(t) || qne.has(t) || Une.test(t), sa = (t) => tf(t, "length", tie), Pu = (t) => !!t && !Number.isNaN(Number(t)), s1 = (t) => tf(t, "number", Pu), Uf = (t) => !!t && Number.isInteger(Number(t)), Gne = (t) => t.endsWith("%") && Pu(t.slice(0, -1)), ur = (t) => Z9.test(t), oa = (t) => zne.test(t), Yne = /* @__PURE__ */ new Set(["length", "size", "percentage"]), Jne = (t) => tf(t, Yne, Q9), Xne = (t) => tf(t, "position", Q9), Zne = /* @__PURE__ */ new Set(["image", "url"]), Qne = (t) => tf(t, Zne, nie), eie = (t) => tf(t, "", rie), qf = () => !0, tf = (t, e, r) => { + const n = Z9.exec(t); return n ? n[1] ? typeof e == "string" ? n[1] === e : e.has(n[1]) : r(n[2]) : !1; -}, _ne = (t) => ( +}, tie = (t) => ( // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths. // For example, `hsl(0 0% 0%)` would be classified as a length without this check. // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough. - lne.test(t) && !hne.test(t) -), A9 = () => !1, Ene = (t) => dne.test(t), Sne = (t) => pne.test(t), Ane = () => { - const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), u = Gr("contrast"), l = Gr("grayscale"), d = Gr("hueRotate"), p = Gr("invert"), w = Gr("gap"), A = Gr("gradientColorStops"), M = Gr("gradientColorStopPositions"), N = Gr("inset"), L = Gr("margin"), B = Gr("opacity"), $ = Gr("padding"), H = Gr("saturate"), U = Gr("scale"), V = Gr("sepia"), te = Gr("skew"), R = Gr("space"), K = Gr("translate"), ge = () => ["auto", "contain", "none"], Ee = () => ["auto", "hidden", "clip", "visible", "scroll"], Y = () => ["auto", ur, e], S = () => [ur, e], m = () => ["", bo, na], f = () => ["auto", mu, ur], g = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], b = () => ["solid", "dashed", "dotted", "double", "none"], x = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], _ = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], E = () => ["", "0", ur], v = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], P = () => [mu, ur]; + Wne.test(t) && !Hne.test(t) +), Q9 = () => !1, rie = (t) => Kne.test(t), nie = (t) => Vne.test(t), iie = () => { + const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), u = Gr("contrast"), l = Gr("grayscale"), d = Gr("hueRotate"), p = Gr("invert"), w = Gr("gap"), _ = Gr("gradientColorStops"), P = Gr("gradientColorStopPositions"), O = Gr("inset"), L = Gr("margin"), B = Gr("opacity"), k = Gr("padding"), q = Gr("saturate"), U = Gr("scale"), V = Gr("sepia"), Q = Gr("skew"), R = Gr("space"), K = Gr("translate"), ge = () => ["auto", "contain", "none"], Ee = () => ["auto", "hidden", "clip", "visible", "scroll"], Y = () => ["auto", ur, e], A = () => [ur, e], m = () => ["", _o, sa], f = () => ["auto", Pu, ur], g = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], b = () => ["solid", "dashed", "dotted", "double", "none"], x = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], E = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], S = () => ["", "0", ur], v = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], M = () => [Pu, ur]; return { cacheSize: 500, separator: ":", theme: { - colors: [Lf], - spacing: [bo, na], - blur: ["none", "", ia, ur], - brightness: P(), + colors: [qf], + spacing: [_o, sa], + blur: ["none", "", oa, ur], + brightness: M(), borderColor: [t], - borderRadius: ["none", "", "full", ia, ur], - borderSpacing: S(), + borderRadius: ["none", "", "full", oa, ur], + borderSpacing: A(), borderWidth: m(), - contrast: P(), - grayscale: E(), - hueRotate: P(), - invert: E(), - gap: S(), + contrast: M(), + grayscale: S(), + hueRotate: M(), + invert: S(), + gap: A(), gradientColorStops: [t], - gradientColorStopPositions: [gne, na], + gradientColorStopPositions: [Gne, sa], inset: Y(), margin: Y(), - opacity: P(), - padding: S(), - saturate: P(), - scale: P(), - sepia: E(), - skew: P(), - space: S(), - translate: S() + opacity: M(), + padding: A(), + saturate: M(), + scale: M(), + sepia: S(), + skew: M(), + space: A(), + translate: A() }, classGroups: { // Layout @@ -36126,7 +36640,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/columns */ columns: [{ - columns: [ia] + columns: [oa] }], /** * Break After @@ -36253,63 +36767,63 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/top-right-bottom-left */ inset: [{ - inset: [N] + inset: [O] }], /** * Right / Left * @see https://tailwindcss.com/docs/top-right-bottom-left */ "inset-x": [{ - "inset-x": [N] + "inset-x": [O] }], /** * Top / Bottom * @see https://tailwindcss.com/docs/top-right-bottom-left */ "inset-y": [{ - "inset-y": [N] + "inset-y": [O] }], /** * Start * @see https://tailwindcss.com/docs/top-right-bottom-left */ start: [{ - start: [N] + start: [O] }], /** * End * @see https://tailwindcss.com/docs/top-right-bottom-left */ end: [{ - end: [N] + end: [O] }], /** * Top * @see https://tailwindcss.com/docs/top-right-bottom-left */ top: [{ - top: [N] + top: [O] }], /** * Right * @see https://tailwindcss.com/docs/top-right-bottom-left */ right: [{ - right: [N] + right: [O] }], /** * Bottom * @see https://tailwindcss.com/docs/top-right-bottom-left */ bottom: [{ - bottom: [N] + bottom: [O] }], /** * Left * @see https://tailwindcss.com/docs/top-right-bottom-left */ left: [{ - left: [N] + left: [O] }], /** * Visibility @@ -36321,7 +36835,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/z-index */ z: [{ - z: ["auto", Nf, ur] + z: ["auto", Uf, ur] }], // Flexbox and Grid /** @@ -36357,28 +36871,28 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/flex-grow */ grow: [{ - grow: E() + grow: S() }], /** * Flex Shrink * @see https://tailwindcss.com/docs/flex-shrink */ shrink: [{ - shrink: E() + shrink: S() }], /** * Order * @see https://tailwindcss.com/docs/order */ order: [{ - order: ["first", "last", "none", Nf, ur] + order: ["first", "last", "none", Uf, ur] }], /** * Grid Template Columns * @see https://tailwindcss.com/docs/grid-template-columns */ "grid-cols": [{ - "grid-cols": [Lf] + "grid-cols": [qf] }], /** * Grid Column Start / End @@ -36386,7 +36900,7 @@ const Gr = (t) => { */ "col-start-end": [{ col: ["auto", { - span: ["full", Nf, ur] + span: ["full", Uf, ur] }, ur] }], /** @@ -36408,7 +36922,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/grid-template-rows */ "grid-rows": [{ - "grid-rows": [Lf] + "grid-rows": [qf] }], /** * Grid Row Start / End @@ -36416,7 +36930,7 @@ const Gr = (t) => { */ "row-start-end": [{ row: ["auto", { - span: [Nf, ur] + span: [Uf, ur] }, ur] }], /** @@ -36480,7 +36994,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/justify-content */ "justify-content": [{ - justify: ["normal", ..._()] + justify: ["normal", ...E()] }], /** * Justify Items @@ -36501,7 +37015,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/align-content */ "align-content": [{ - content: ["normal", ..._(), "baseline"] + content: ["normal", ...E(), "baseline"] }], /** * Align Items @@ -36522,7 +37036,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/place-content */ "place-content": [{ - "place-content": [..._(), "baseline"] + "place-content": [...E(), "baseline"] }], /** * Place Items @@ -36544,63 +37058,63 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/padding */ p: [{ - p: [$] + p: [k] }], /** * Padding X * @see https://tailwindcss.com/docs/padding */ px: [{ - px: [$] + px: [k] }], /** * Padding Y * @see https://tailwindcss.com/docs/padding */ py: [{ - py: [$] + py: [k] }], /** * Padding Start * @see https://tailwindcss.com/docs/padding */ ps: [{ - ps: [$] + ps: [k] }], /** * Padding End * @see https://tailwindcss.com/docs/padding */ pe: [{ - pe: [$] + pe: [k] }], /** * Padding Top * @see https://tailwindcss.com/docs/padding */ pt: [{ - pt: [$] + pt: [k] }], /** * Padding Right * @see https://tailwindcss.com/docs/padding */ pr: [{ - pr: [$] + pr: [k] }], /** * Padding Bottom * @see https://tailwindcss.com/docs/padding */ pb: [{ - pb: [$] + pb: [k] }], /** * Padding Left * @see https://tailwindcss.com/docs/padding */ pl: [{ - pl: [$] + pl: [k] }], /** * Margin @@ -36710,8 +37224,8 @@ const Gr = (t) => { */ "max-w": [{ "max-w": [ur, e, "none", "full", "min", "max", "fit", "prose", { - screen: [ia] - }, ia] + screen: [oa] + }, oa] }], /** * Height @@ -36747,7 +37261,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/font-size */ "font-size": [{ - text: ["base", ia, na] + text: ["base", oa, sa] }], /** * Font Smoothing @@ -36764,14 +37278,14 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/font-weight */ "font-weight": [{ - font: ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black", Hm] + font: ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black", s1] }], /** * Font Family * @see https://tailwindcss.com/docs/font-family */ "font-family": [{ - font: [Lf] + font: [qf] }], /** * Font Variant Numeric @@ -36815,14 +37329,14 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/line-clamp */ "line-clamp": [{ - "line-clamp": ["none", mu, Hm] + "line-clamp": ["none", Pu, s1] }], /** * Line Height * @see https://tailwindcss.com/docs/line-height */ leading: [{ - leading: ["none", "tight", "snug", "normal", "relaxed", "loose", bo, ur] + leading: ["none", "tight", "snug", "normal", "relaxed", "loose", _o, ur] }], /** * List Style Image @@ -36898,14 +37412,14 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/text-decoration-thickness */ "text-decoration-thickness": [{ - decoration: ["auto", "from-font", bo, na] + decoration: ["auto", "from-font", _o, sa] }], /** * Text Underline Offset * @see https://tailwindcss.com/docs/text-underline-offset */ "underline-offset": [{ - "underline-offset": ["auto", bo, ur] + "underline-offset": ["auto", _o, ur] }], /** * Text Decoration Color @@ -36936,7 +37450,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/text-indent */ indent: [{ - indent: S() + indent: A() }], /** * Vertical Alignment @@ -37008,7 +37522,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/background-position */ "bg-position": [{ - bg: [...g(), bne] + bg: [...g(), Xne] }], /** * Background Repeat @@ -37024,7 +37538,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/background-size */ "bg-size": [{ - bg: ["auto", "cover", "contain", vne] + bg: ["auto", "cover", "contain", Jne] }], /** * Background Image @@ -37033,7 +37547,7 @@ const Gr = (t) => { "bg-image": [{ bg: ["none", { "gradient-to": ["t", "tr", "r", "br", "b", "bl", "l", "tl"] - }, wne] + }, Qne] }], /** * Background Color @@ -37047,42 +37561,42 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/gradient-color-stops */ "gradient-from-pos": [{ - from: [M] + from: [P] }], /** * Gradient Color Stops Via Position * @see https://tailwindcss.com/docs/gradient-color-stops */ "gradient-via-pos": [{ - via: [M] + via: [P] }], /** * Gradient Color Stops To Position * @see https://tailwindcss.com/docs/gradient-color-stops */ "gradient-to-pos": [{ - to: [M] + to: [P] }], /** * Gradient Color Stops From * @see https://tailwindcss.com/docs/gradient-color-stops */ "gradient-from": [{ - from: [A] + from: [_] }], /** * Gradient Color Stops Via * @see https://tailwindcss.com/docs/gradient-color-stops */ "gradient-via": [{ - via: [A] + via: [_] }], /** * Gradient Color Stops To * @see https://tailwindcss.com/docs/gradient-color-stops */ "gradient-to": [{ - to: [A] + to: [_] }], // Borders /** @@ -37387,14 +37901,14 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/outline-offset */ "outline-offset": [{ - "outline-offset": [bo, ur] + "outline-offset": [_o, ur] }], /** * Outline Width * @see https://tailwindcss.com/docs/outline-width */ "outline-w": [{ - outline: [bo, na] + outline: [_o, sa] }], /** * Outline Color @@ -37434,7 +37948,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/ring-offset-width */ "ring-offset-w": [{ - "ring-offset": [bo, na] + "ring-offset": [_o, sa] }], /** * Ring Offset Color @@ -37449,14 +37963,14 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/box-shadow */ shadow: [{ - shadow: ["", "inner", "none", ia, xne] + shadow: ["", "inner", "none", oa, eie] }], /** * Box Shadow Color * @see https://tailwindcss.com/docs/box-shadow-color */ "shadow-color": [{ - shadow: [Lf] + shadow: [qf] }], /** * Opacity @@ -37514,7 +38028,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/drop-shadow */ "drop-shadow": [{ - "drop-shadow": ["", "none", ia, ur] + "drop-shadow": ["", "none", oa, ur] }], /** * Grayscale @@ -37542,7 +38056,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/saturate */ saturate: [{ - saturate: [H] + saturate: [q] }], /** * Sepia @@ -37613,7 +38127,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/backdrop-saturate */ "backdrop-saturate": [{ - "backdrop-saturate": [H] + "backdrop-saturate": [q] }], /** * Backdrop Sepia @@ -37678,7 +38192,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/transition-duration */ duration: [{ - duration: P() + duration: M() }], /** * Transition Timing Function @@ -37692,7 +38206,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/transition-delay */ delay: [{ - delay: P() + delay: M() }], /** * Animation @@ -37735,7 +38249,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/rotate */ rotate: [{ - rotate: [Nf, ur] + rotate: [Uf, ur] }], /** * Translate X @@ -37756,14 +38270,14 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/skew */ "skew-x": [{ - "skew-x": [te] + "skew-x": [Q] }], /** * Skew Y * @see https://tailwindcss.com/docs/skew */ "skew-y": [{ - "skew-y": [te] + "skew-y": [Q] }], /** * Transform Origin @@ -37827,126 +38341,126 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/scroll-margin */ "scroll-m": [{ - "scroll-m": S() + "scroll-m": A() }], /** * Scroll Margin X * @see https://tailwindcss.com/docs/scroll-margin */ "scroll-mx": [{ - "scroll-mx": S() + "scroll-mx": A() }], /** * Scroll Margin Y * @see https://tailwindcss.com/docs/scroll-margin */ "scroll-my": [{ - "scroll-my": S() + "scroll-my": A() }], /** * Scroll Margin Start * @see https://tailwindcss.com/docs/scroll-margin */ "scroll-ms": [{ - "scroll-ms": S() + "scroll-ms": A() }], /** * Scroll Margin End * @see https://tailwindcss.com/docs/scroll-margin */ "scroll-me": [{ - "scroll-me": S() + "scroll-me": A() }], /** * Scroll Margin Top * @see https://tailwindcss.com/docs/scroll-margin */ "scroll-mt": [{ - "scroll-mt": S() + "scroll-mt": A() }], /** * Scroll Margin Right * @see https://tailwindcss.com/docs/scroll-margin */ "scroll-mr": [{ - "scroll-mr": S() + "scroll-mr": A() }], /** * Scroll Margin Bottom * @see https://tailwindcss.com/docs/scroll-margin */ "scroll-mb": [{ - "scroll-mb": S() + "scroll-mb": A() }], /** * Scroll Margin Left * @see https://tailwindcss.com/docs/scroll-margin */ "scroll-ml": [{ - "scroll-ml": S() + "scroll-ml": A() }], /** * Scroll Padding * @see https://tailwindcss.com/docs/scroll-padding */ "scroll-p": [{ - "scroll-p": S() + "scroll-p": A() }], /** * Scroll Padding X * @see https://tailwindcss.com/docs/scroll-padding */ "scroll-px": [{ - "scroll-px": S() + "scroll-px": A() }], /** * Scroll Padding Y * @see https://tailwindcss.com/docs/scroll-padding */ "scroll-py": [{ - "scroll-py": S() + "scroll-py": A() }], /** * Scroll Padding Start * @see https://tailwindcss.com/docs/scroll-padding */ "scroll-ps": [{ - "scroll-ps": S() + "scroll-ps": A() }], /** * Scroll Padding End * @see https://tailwindcss.com/docs/scroll-padding */ "scroll-pe": [{ - "scroll-pe": S() + "scroll-pe": A() }], /** * Scroll Padding Top * @see https://tailwindcss.com/docs/scroll-padding */ "scroll-pt": [{ - "scroll-pt": S() + "scroll-pt": A() }], /** * Scroll Padding Right * @see https://tailwindcss.com/docs/scroll-padding */ "scroll-pr": [{ - "scroll-pr": S() + "scroll-pr": A() }], /** * Scroll Padding Bottom * @see https://tailwindcss.com/docs/scroll-padding */ "scroll-pb": [{ - "scroll-pb": S() + "scroll-pb": A() }], /** * Scroll Padding Left * @see https://tailwindcss.com/docs/scroll-padding */ "scroll-pl": [{ - "scroll-pl": S() + "scroll-pl": A() }], /** * Scroll Snap Align @@ -38029,7 +38543,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/stroke-width */ "stroke-w": [{ - stroke: [bo, na, Hm] + stroke: [_o, sa, s1] }], /** * Stroke @@ -38104,19 +38618,19 @@ const Gr = (t) => { "font-size": ["leading"] } }; -}, Pne = /* @__PURE__ */ ane(Ane); -function Oo(...t) { - return Pne(Gre(t)); +}, sie = /* @__PURE__ */ jne(iie); +function $o(...t) { + return sie(Mne(t)); } -function P9(t) { +function eA(t) { const { className: e } = t; - return /* @__PURE__ */ le.jsxs("div", { className: Oo("xc-flex xc-items-center xc-gap-2"), children: [ - /* @__PURE__ */ le.jsx("hr", { className: Oo("xc-flex-1 xc-border-gray-200", e) }), + return /* @__PURE__ */ le.jsxs("div", { className: $o("xc-flex xc-items-center xc-gap-2"), children: [ + /* @__PURE__ */ le.jsx("hr", { className: $o("xc-flex-1 xc-border-gray-200", e) }), /* @__PURE__ */ le.jsx("div", { className: "xc-shrink-0", children: t.children }), - /* @__PURE__ */ le.jsx("hr", { className: Oo("xc-flex-1 xc-border-gray-200", e) }) + /* @__PURE__ */ le.jsx("hr", { className: $o("xc-flex-1 xc-border-gray-200", e) }) ] }); } -function Mne(t) { +function oie(t) { var n, i; const { wallet: e, onClick: r } = t; return /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4", children: [ @@ -38130,100 +38644,100 @@ function Mne(t) { ] }) ] }); } -const Ine = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton"; -function Cne(t) { +const aie = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton"; +function cie(t) { const { onClick: e } = t; function r() { e && e(); } - return /* @__PURE__ */ le.jsx(P9, { className: "xc-opacity-20", children: /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-cursor-pointer", onClick: r, children: [ + return /* @__PURE__ */ le.jsx(eA, { className: "xc-opacity-20", children: /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-cursor-pointer", onClick: r, children: [ /* @__PURE__ */ le.jsx("span", { className: "xc-text-sm", children: "View more wallets" }), - /* @__PURE__ */ le.jsx(WS, { size: 16 }) + /* @__PURE__ */ le.jsx(b7, { size: 16 }) ] }) }); } -function M9(t) { - const [e, r] = Yt(""), { featuredWallets: n, initialized: i } = mp(), { onEmailConfirm: s, onSelectWallet: o, onSelectMoreWallets: a, onSelectTonConnect: u, config: l } = t, d = wi(() => { - const N = /[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu, L = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; - return !N.test(e) && L.test(e); +function tA(t) { + const [e, r] = Yt(""), { featuredWallets: n, initialized: i } = Tp(), { onEmailConfirm: s, onSelectWallet: o, onSelectMoreWallets: a, onSelectTonConnect: u, config: l } = t, d = wi(() => { + const O = /[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu, L = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; + return !O.test(e) && L.test(e); }, [e]); - function p(N) { - o(N); + function p(O) { + o(O); } - function w(N) { - r(N.target.value); + function w(O) { + r(O.target.value); } - async function A() { + async function _() { s(e); } - function M(N) { - N.key === "Enter" && d && A(); + function P(O) { + O.key === "Enter" && d && _(); } - return /* @__PURE__ */ le.jsx(Ms, { children: i && /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ + return /* @__PURE__ */ le.jsx(Rs, { children: i && /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ t.header || /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6 xc-text-xl xc-font-bold", children: "Log in or sign up" }), - n.length === 1 && /* @__PURE__ */ le.jsx("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: n.map((N) => /* @__PURE__ */ le.jsx( - Mne, + n.length === 1 && /* @__PURE__ */ le.jsx("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: n.map((O) => /* @__PURE__ */ le.jsx( + oie, { - wallet: N, + wallet: O, onClick: p }, - `feature-${N.key}` + `feature-${O.key}` )) }), n.length > 1 && /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ /* @__PURE__ */ le.jsxs("div", { children: [ /* @__PURE__ */ le.jsxs("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: [ - l.showFeaturedWallets && n && n.map((N) => /* @__PURE__ */ le.jsx( - y9, + l.showFeaturedWallets && n && n.map((O) => /* @__PURE__ */ le.jsx( + V9, { - wallet: N, + wallet: O, onClick: p }, - `feature-${N.key}` + `feature-${O.key}` )), l.showTonConnect && /* @__PURE__ */ le.jsx( - ay, + xy, { - icon: /* @__PURE__ */ le.jsx("img", { className: "xc-h-5 xc-w-5", src: Ine }), + icon: /* @__PURE__ */ le.jsx("img", { className: "xc-h-5 xc-w-5", src: aie }), title: "TON Connect", onClick: u } ) ] }), - l.showMoreWallets && /* @__PURE__ */ le.jsx(Cne, { onClick: a }) + l.showMoreWallets && /* @__PURE__ */ le.jsx(cie, { onClick: a }) ] }), - l.showEmailSignIn && (l.showFeaturedWallets || l.showTonConnect) && /* @__PURE__ */ le.jsx("div", { className: "xc-mb-4 xc-mt-4", children: /* @__PURE__ */ le.jsxs(P9, { className: "xc-opacity-20", children: [ + l.showEmailSignIn && (l.showFeaturedWallets || l.showTonConnect) && /* @__PURE__ */ le.jsx("div", { className: "xc-mb-4 xc-mt-4", children: /* @__PURE__ */ le.jsxs(eA, { className: "xc-opacity-20", children: [ " ", /* @__PURE__ */ le.jsx("span", { className: "xc-text-sm xc-opacity-20", children: "OR" }) ] }) }), l.showEmailSignIn && /* @__PURE__ */ le.jsxs("div", { className: "xc-mb-4", children: [ - /* @__PURE__ */ le.jsx("input", { className: "xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3", placeholder: "Enter your email", type: "email", onChange: w, onKeyDown: M }), - /* @__PURE__ */ le.jsx("button", { disabled: !d, className: "xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all", onClick: A, children: "Continue" }) + /* @__PURE__ */ le.jsx("input", { className: "xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3", placeholder: "Enter your email", type: "email", onChange: w, onKeyDown: P }), + /* @__PURE__ */ le.jsx("button", { disabled: !d, className: "xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all", onClick: _, children: "Continue" }) ] }) ] }) ] }) }); } -function Pc(t) { +function kc(t) { const { title: e } = t; return /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2", children: [ - /* @__PURE__ */ le.jsx(lZ, { onClick: t.onBack, size: 20, className: "xc-cursor-pointer" }), + /* @__PURE__ */ le.jsx(WZ, { onClick: t.onBack, size: 20, className: "xc-cursor-pointer" }), /* @__PURE__ */ le.jsx("span", { children: e }) ] }); } -const I9 = Sa({ +const rA = Ta({ channel: "", device: "WEB", app: "", inviterCode: "", role: "C" }); -function uy() { - return Tn(I9); +function Ey() { + return Tn(rA); } -function Tne(t) { +function uie(t) { const { config: e } = t, [r, n] = Yt(e.channel), [i, s] = Yt(e.device), [o, a] = Yt(e.app), [u, l] = Yt(e.role || "C"), [d, p] = Yt(e.inviterCode); return Dn(() => { n(e.channel), s(e.device), a(e.app), p(e.inviterCode), l(e.role || "C"); }, [e]), /* @__PURE__ */ le.jsx( - I9.Provider, + rA.Provider, { value: { channel: r, @@ -38236,62 +38750,62 @@ function Tne(t) { } ); } -var Rne = Object.defineProperty, Dne = Object.defineProperties, One = Object.getOwnPropertyDescriptors, S0 = Object.getOwnPropertySymbols, C9 = Object.prototype.hasOwnProperty, T9 = Object.prototype.propertyIsEnumerable, f5 = (t, e, r) => e in t ? Rne(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Nne = (t, e) => { - for (var r in e || (e = {})) C9.call(e, r) && f5(t, r, e[r]); - if (S0) for (var r of S0(e)) T9.call(e, r) && f5(t, r, e[r]); +var fie = Object.defineProperty, lie = Object.defineProperties, hie = Object.getOwnPropertyDescriptors, k0 = Object.getOwnPropertySymbols, nA = Object.prototype.hasOwnProperty, iA = Object.prototype.propertyIsEnumerable, P5 = (t, e, r) => e in t ? fie(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, die = (t, e) => { + for (var r in e || (e = {})) nA.call(e, r) && P5(t, r, e[r]); + if (k0) for (var r of k0(e)) iA.call(e, r) && P5(t, r, e[r]); return t; -}, Lne = (t, e) => Dne(t, One(e)), kne = (t, e) => { +}, pie = (t, e) => lie(t, hie(e)), gie = (t, e) => { var r = {}; - for (var n in t) C9.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); - if (t != null && S0) for (var n of S0(t)) e.indexOf(n) < 0 && T9.call(t, n) && (r[n] = t[n]); + for (var n in t) nA.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); + if (t != null && k0) for (var n of k0(t)) e.indexOf(n) < 0 && iA.call(t, n) && (r[n] = t[n]); return r; }; -function $ne(t) { +function mie(t) { let e = setTimeout(t, 0), r = setTimeout(t, 10), n = setTimeout(t, 50); return [e, r, n]; } -function Bne(t) { +function vie(t) { let e = Gt.useRef(); return Gt.useEffect(() => { e.current = t; }), e.current; } -var Fne = 18, R9 = 40, jne = `${R9}px`, Une = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(","); -function qne({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isFocused: n }) { +var bie = 18, sA = 40, yie = `${sA}px`, wie = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(","); +function xie({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isFocused: n }) { let [i, s] = Gt.useState(!1), [o, a] = Gt.useState(!1), [u, l] = Gt.useState(!1), d = Gt.useMemo(() => r === "none" ? !1 : (r === "increase-width" || r === "experimental-no-flickering") && i && o, [i, o, r]), p = Gt.useCallback(() => { - let w = t.current, A = e.current; - if (!w || !A || u || r === "none") return; - let M = w, N = M.getBoundingClientRect().left + M.offsetWidth, L = M.getBoundingClientRect().top + M.offsetHeight / 2, B = N - Fne, $ = L; - document.querySelectorAll(Une).length === 0 && document.elementFromPoint(B, $) === w || (s(!0), l(!0)); + let w = t.current, _ = e.current; + if (!w || !_ || u || r === "none") return; + let P = w, O = P.getBoundingClientRect().left + P.offsetWidth, L = P.getBoundingClientRect().top + P.offsetHeight / 2, B = O - bie, k = L; + document.querySelectorAll(wie).length === 0 && document.elementFromPoint(B, k) === w || (s(!0), l(!0)); }, [t, e, u, r]); return Gt.useEffect(() => { let w = t.current; if (!w || r === "none") return; - function A() { - let N = window.innerWidth - w.getBoundingClientRect().right; - a(N >= R9); + function _() { + let O = window.innerWidth - w.getBoundingClientRect().right; + a(O >= sA); } - A(); - let M = setInterval(A, 1e3); + _(); + let P = setInterval(_, 1e3); return () => { - clearInterval(M); + clearInterval(P); }; }, [t, r]), Gt.useEffect(() => { let w = n || document.activeElement === e.current; if (r === "none" || !w) return; - let A = setTimeout(p, 0), M = setTimeout(p, 2e3), N = setTimeout(p, 5e3), L = setTimeout(() => { + let _ = setTimeout(p, 0), P = setTimeout(p, 2e3), O = setTimeout(p, 5e3), L = setTimeout(() => { l(!0); }, 6e3); return () => { - clearTimeout(A), clearTimeout(M), clearTimeout(N), clearTimeout(L); + clearTimeout(_), clearTimeout(P), clearTimeout(O), clearTimeout(L); }; - }, [e, n, r, p]), { hasPWMBadge: i, willPushPWMBadge: d, PWM_BADGE_SPACE_WIDTH: jne }; + }, [e, n, r, p]), { hasPWMBadge: i, willPushPWMBadge: d, PWM_BADGE_SPACE_WIDTH: yie }; } -var D9 = Gt.createContext({}), O9 = Gt.forwardRef((t, e) => { - var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: u, inputMode: l = "numeric", onComplete: d, pushPasswordManagerStrategy: p = "increase-width", pasteTransformer: w, containerClassName: A, noScriptCSSFallback: M = zne, render: N, children: L } = r, B = kne(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), $, H, U, V, te; - let [R, K] = Gt.useState(typeof B.defaultValue == "string" ? B.defaultValue : ""), ge = n ?? R, Ee = Bne(ge), Y = Gt.useCallback((ie) => { +var oA = Gt.createContext({}), aA = Gt.forwardRef((t, e) => { + var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: u, inputMode: l = "numeric", onComplete: d, pushPasswordManagerStrategy: p = "increase-width", pasteTransformer: w, containerClassName: _, noScriptCSSFallback: P = _ie, render: O, children: L } = r, B = gie(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), k, q, U, V, Q; + let [R, K] = Gt.useState(typeof B.defaultValue == "string" ? B.defaultValue : ""), ge = n ?? R, Ee = vie(ge), Y = Gt.useCallback((ie) => { i == null || i(ie), K(ie); - }, [i]), S = Gt.useMemo(() => a ? typeof a == "string" ? new RegExp(a) : a : null, [a]), m = Gt.useRef(null), f = Gt.useRef(null), g = Gt.useRef({ value: ge, onChange: Y, isIOS: typeof window < "u" && ((H = ($ = window == null ? void 0 : window.CSS) == null ? void 0 : $.supports) == null ? void 0 : H.call($, "-webkit-touch-callout", "none")) }), b = Gt.useRef({ prev: [(U = m.current) == null ? void 0 : U.selectionStart, (V = m.current) == null ? void 0 : V.selectionEnd, (te = m.current) == null ? void 0 : te.selectionDirection] }); + }, [i]), A = Gt.useMemo(() => a ? typeof a == "string" ? new RegExp(a) : a : null, [a]), m = Gt.useRef(null), f = Gt.useRef(null), g = Gt.useRef({ value: ge, onChange: Y, isIOS: typeof window < "u" && ((q = (k = window == null ? void 0 : window.CSS) == null ? void 0 : k.supports) == null ? void 0 : q.call(k, "-webkit-touch-callout", "none")) }), b = Gt.useRef({ prev: [(U = m.current) == null ? void 0 : U.selectionStart, (V = m.current) == null ? void 0 : V.selectionEnd, (Q = m.current) == null ? void 0 : Q.selectionDirection] }); Gt.useImperativeHandle(e, () => m.current, []), Gt.useEffect(() => { let ie = m.current, ue = f.current; if (!ie || !ue) return; @@ -38327,7 +38841,7 @@ var D9 = Gt.createContext({}), O9 = Gt.forwardRef((t, e) => { let Ce = document.createElement("style"); if (Ce.id = "input-otp-style", document.head.appendChild(Ce), Ce.sheet) { let $e = "background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;"; - kf(Ce.sheet, "[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"), kf(Ce.sheet, `[data-input-otp]:autofill { ${$e} }`), kf(Ce.sheet, `[data-input-otp]:-webkit-autofill { ${$e} }`), kf(Ce.sheet, "@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"), kf(Ce.sheet, "[data-input-otp] + * { pointer-events: all !important; }"); + zf(Ce.sheet, "[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"), zf(Ce.sheet, `[data-input-otp]:autofill { ${$e} }`), zf(Ce.sheet, `[data-input-otp]:-webkit-autofill { ${$e} }`), zf(Ce.sheet, "@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"), zf(Ce.sheet, "[data-input-otp] + * { pointer-events: all !important; }"); } } let Pe = () => { @@ -38339,25 +38853,25 @@ var D9 = Gt.createContext({}), O9 = Gt.forwardRef((t, e) => { document.removeEventListener("selectionchange", ve, { capture: !0 }), De.disconnect(); }; }, []); - let [x, _] = Gt.useState(!1), [E, v] = Gt.useState(!1), [P, I] = Gt.useState(null), [F, ce] = Gt.useState(null); + let [x, E] = Gt.useState(!1), [S, v] = Gt.useState(!1), [M, I] = Gt.useState(null), [F, ce] = Gt.useState(null); Gt.useEffect(() => { - $ne(() => { + mie(() => { var ie, ue, ve, Pe; (ie = m.current) == null || ie.dispatchEvent(new Event("input")); let De = (ue = m.current) == null ? void 0 : ue.selectionStart, Ce = (ve = m.current) == null ? void 0 : ve.selectionEnd, $e = (Pe = m.current) == null ? void 0 : Pe.selectionDirection; De !== null && Ce !== null && (I(De), ce(Ce), b.current.prev = [De, Ce, $e]); }); - }, [ge, E]), Gt.useEffect(() => { + }, [ge, S]), Gt.useEffect(() => { Ee !== void 0 && ge !== Ee && Ee.length < s && ge.length === s && (d == null || d(ge)); }, [s, d, Ee, ge]); - let D = qne({ containerRef: f, inputRef: m, pushPasswordManagerStrategy: p, isFocused: E }), oe = Gt.useCallback((ie) => { + let D = xie({ containerRef: f, inputRef: m, pushPasswordManagerStrategy: p, isFocused: S }), oe = Gt.useCallback((ie) => { let ue = ie.currentTarget.value.slice(0, s); - if (ue.length > 0 && S && !S.test(ue)) { + if (ue.length > 0 && A && !A.test(ue)) { ie.preventDefault(); return; } typeof Ee == "string" && ue.length < Ee.length && document.dispatchEvent(new Event("selectionchange")), Y(ue); - }, [s, Y, Ee, S]), Z = Gt.useCallback(() => { + }, [s, Y, Ee, A]), Z = Gt.useCallback(() => { var ie; if (m.current) { let ue = Math.min(m.current.value.length, s - 1), ve = m.current.value.length; @@ -38371,41 +38885,41 @@ var D9 = Gt.createContext({}), O9 = Gt.forwardRef((t, e) => { let De = ie.clipboardData.getData("text/plain"), Ce = w ? w(De) : De; console.log({ _content: De, content: Ce }), ie.preventDefault(); let $e = (ue = m.current) == null ? void 0 : ue.selectionStart, Me = (ve = m.current) == null ? void 0 : ve.selectionEnd, Ne = ($e !== Me ? ge.slice(0, $e) + Ce + ge.slice(Me) : ge.slice(0, $e) + Ce + ge.slice($e)).slice(0, s); - if (Ne.length > 0 && S && !S.test(Ne)) return; + if (Ne.length > 0 && A && !A.test(Ne)) return; Pe.value = Ne, Y(Ne); let Ke = Math.min(Ne.length, s - 1), Le = Ne.length; Pe.setSelectionRange(Ke, Le), I(Ke), ce(Le); - }, [s, Y, S, ge]), Q = Gt.useMemo(() => ({ position: "relative", cursor: B.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [B.disabled]), T = Gt.useMemo(() => ({ position: "absolute", inset: 0, width: D.willPushPWMBadge ? `calc(100% + ${D.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: D.willPushPWMBadge ? `inset(0 ${D.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: o, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [D.PWM_BADGE_SPACE_WIDTH, D.willPushPWMBadge, o]), X = Gt.useMemo(() => Gt.createElement("input", Lne(Nne({ autoComplete: B.autoComplete || "one-time-code" }, B), { "data-input-otp": !0, "data-input-otp-placeholder-shown": ge.length === 0 || void 0, "data-input-otp-mss": P, "data-input-otp-mse": F, inputMode: l, pattern: S == null ? void 0 : S.source, "aria-placeholder": u, style: T, maxLength: s, value: ge, ref: m, onPaste: (ie) => { + }, [s, Y, A, ge]), ee = Gt.useMemo(() => ({ position: "relative", cursor: B.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [B.disabled]), T = Gt.useMemo(() => ({ position: "absolute", inset: 0, width: D.willPushPWMBadge ? `calc(100% + ${D.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: D.willPushPWMBadge ? `inset(0 ${D.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: o, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [D.PWM_BADGE_SPACE_WIDTH, D.willPushPWMBadge, o]), X = Gt.useMemo(() => Gt.createElement("input", pie(die({ autoComplete: B.autoComplete || "one-time-code" }, B), { "data-input-otp": !0, "data-input-otp-placeholder-shown": ge.length === 0 || void 0, "data-input-otp-mss": M, "data-input-otp-mse": F, inputMode: l, pattern: A == null ? void 0 : A.source, "aria-placeholder": u, style: T, maxLength: s, value: ge, ref: m, onPaste: (ie) => { var ue; J(ie), (ue = B.onPaste) == null || ue.call(B, ie); }, onChange: oe, onMouseOver: (ie) => { var ue; - _(!0), (ue = B.onMouseOver) == null || ue.call(B, ie); + E(!0), (ue = B.onMouseOver) == null || ue.call(B, ie); }, onMouseLeave: (ie) => { var ue; - _(!1), (ue = B.onMouseLeave) == null || ue.call(B, ie); + E(!1), (ue = B.onMouseLeave) == null || ue.call(B, ie); }, onFocus: (ie) => { var ue; Z(), (ue = B.onFocus) == null || ue.call(B, ie); }, onBlur: (ie) => { var ue; v(!1), (ue = B.onBlur) == null || ue.call(B, ie); - } })), [oe, Z, J, l, T, s, F, P, B, S == null ? void 0 : S.source, ge]), re = Gt.useMemo(() => ({ slots: Array.from({ length: s }).map((ie, ue) => { + } })), [oe, Z, J, l, T, s, F, M, B, A == null ? void 0 : A.source, ge]), re = Gt.useMemo(() => ({ slots: Array.from({ length: s }).map((ie, ue) => { var ve; - let Pe = E && P !== null && F !== null && (P === F && ue === P || ue >= P && ue < F), De = ge[ue] !== void 0 ? ge[ue] : null, Ce = ge[0] !== void 0 ? null : (ve = u == null ? void 0 : u[ue]) != null ? ve : null; + let Pe = S && M !== null && F !== null && (M === F && ue === M || ue >= M && ue < F), De = ge[ue] !== void 0 ? ge[ue] : null, Ce = ge[0] !== void 0 ? null : (ve = u == null ? void 0 : u[ue]) != null ? ve : null; return { char: De, placeholderChar: Ce, isActive: Pe, hasFakeCaret: Pe && De === null }; - }), isFocused: E, isHovering: !B.disabled && x }), [E, x, s, F, P, B.disabled, ge]), pe = Gt.useMemo(() => N ? N(re) : Gt.createElement(D9.Provider, { value: re }, L), [L, re, N]); - return Gt.createElement(Gt.Fragment, null, M !== null && Gt.createElement("noscript", null, Gt.createElement("style", null, M)), Gt.createElement("div", { ref: f, "data-input-otp-container": !0, style: Q, className: A }, pe, Gt.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, X))); + }), isFocused: S, isHovering: !B.disabled && x }), [S, x, s, F, M, B.disabled, ge]), pe = Gt.useMemo(() => O ? O(re) : Gt.createElement(oA.Provider, { value: re }, L), [L, re, O]); + return Gt.createElement(Gt.Fragment, null, P !== null && Gt.createElement("noscript", null, Gt.createElement("style", null, P)), Gt.createElement("div", { ref: f, "data-input-otp-container": !0, style: ee, className: _ }, pe, Gt.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, X))); }); -O9.displayName = "Input"; -function kf(t, e) { +aA.displayName = "Input"; +function zf(t, e) { try { t.insertRule(e); } catch { console.error("input-otp could not insert CSS rule:", e); } } -var zne = ` +var _ie = ` [data-input-otp] { --nojs-bg: white !important; --nojs-fg: black !important; @@ -38425,28 +38939,28 @@ var zne = ` --nojs-fg: white !important; } }`; -const N9 = Gt.forwardRef(({ className: t, containerClassName: e, ...r }, n) => /* @__PURE__ */ le.jsx( - O9, +const cA = Gt.forwardRef(({ className: t, containerClassName: e, ...r }, n) => /* @__PURE__ */ le.jsx( + aA, { ref: n, - containerClassName: Oo( + containerClassName: $o( "xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50", e ), - className: Oo("disabled:xc-cursor-not-allowed", t), + className: $o("disabled:xc-cursor-not-allowed", t), ...r } )); -N9.displayName = "InputOTP"; -const L9 = Gt.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ le.jsx("div", { ref: r, className: Oo("xc-flex xc-items-center", t), ...e })); -L9.displayName = "InputOTPGroup"; -const Xa = Gt.forwardRef(({ index: t, className: e, ...r }, n) => { - const i = Gt.useContext(D9), { char: s, hasFakeCaret: o, isActive: a } = i.slots[t]; +cA.displayName = "InputOTP"; +const uA = Gt.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ le.jsx("div", { ref: r, className: $o("xc-flex xc-items-center", t), ...e })); +uA.displayName = "InputOTPGroup"; +const nc = Gt.forwardRef(({ index: t, className: e, ...r }, n) => { + const i = Gt.useContext(oA), { char: s, hasFakeCaret: o, isActive: a } = i.slots[t]; return /* @__PURE__ */ le.jsxs( "div", { ref: n, - className: Oo( + className: $o( "xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all", a && "xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background", e @@ -38459,15 +38973,15 @@ const Xa = Gt.forwardRef(({ index: t, className: e, ...r }, n) => { } ); }); -Xa.displayName = "InputOTPSlot"; -function Wne(t) { +nc.displayName = "InputOTPSlot"; +function Eie(t) { const { spinning: e, children: r, className: n } = t; return /* @__PURE__ */ le.jsxs("div", { className: "xc-inline-block xc-relative", children: [ r, - e && /* @__PURE__ */ le.jsx("div", { className: Oo("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center", n), children: /* @__PURE__ */ le.jsx(mc, { className: "xc-animate-spin" }) }) + e && /* @__PURE__ */ le.jsx("div", { className: $o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center", n), children: /* @__PURE__ */ le.jsx(Sc, { className: "xc-animate-spin" }) }) ] }); } -function k9(t) { +function fA(t) { const { email: e } = t, [r, n] = Yt(0), [i, s] = Yt(!1), [o, a] = Yt(""); async function u() { n(60); @@ -38488,20 +39002,20 @@ function k9(t) { } return Dn(() => { u(); - }, []), /* @__PURE__ */ le.jsxs(Ms, { children: [ + }, []), /* @__PURE__ */ le.jsxs(Rs, { children: [ /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ - /* @__PURE__ */ le.jsx(vZ, { className: "xc-mb-4", size: 60 }), + /* @__PURE__ */ le.jsx(JZ, { className: "xc-mb-4", size: 60 }), /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16", children: [ /* @__PURE__ */ le.jsx("p", { className: "xc-text-lg xc-mb-1", children: "We’ve sent a verification code to" }), /* @__PURE__ */ le.jsx("p", { className: "xc-font-bold xc-text-center", children: e }) ] }), - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-2 xc-h-12", children: /* @__PURE__ */ le.jsx(Wne, { spinning: i, className: "xc-rounded-xl", children: /* @__PURE__ */ le.jsx(N9, { maxLength: 6, onChange: l, disabled: i, className: "disabled:xc-opacity-20", children: /* @__PURE__ */ le.jsx(L9, { children: /* @__PURE__ */ le.jsxs("div", { className: Oo("xc-flex xc-gap-2", i ? "xc-opacity-20" : ""), children: [ - /* @__PURE__ */ le.jsx(Xa, { index: 0 }), - /* @__PURE__ */ le.jsx(Xa, { index: 1 }), - /* @__PURE__ */ le.jsx(Xa, { index: 2 }), - /* @__PURE__ */ le.jsx(Xa, { index: 3 }), - /* @__PURE__ */ le.jsx(Xa, { index: 4 }), - /* @__PURE__ */ le.jsx(Xa, { index: 5 }) + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-2 xc-h-12", children: /* @__PURE__ */ le.jsx(Eie, { spinning: i, className: "xc-rounded-xl", children: /* @__PURE__ */ le.jsx(cA, { maxLength: 6, onChange: l, disabled: i, className: "disabled:xc-opacity-20", children: /* @__PURE__ */ le.jsx(uA, { children: /* @__PURE__ */ le.jsxs("div", { className: $o("xc-flex xc-gap-2", i ? "xc-opacity-20" : ""), children: [ + /* @__PURE__ */ le.jsx(nc, { index: 0 }), + /* @__PURE__ */ le.jsx(nc, { index: 1 }), + /* @__PURE__ */ le.jsx(nc, { index: 2 }), + /* @__PURE__ */ le.jsx(nc, { index: 3 }), + /* @__PURE__ */ le.jsx(nc, { index: 4 }), + /* @__PURE__ */ le.jsx(nc, { index: 5 }) ] }) }) }) }) }), o && /* @__PURE__ */ le.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ le.jsx("p", { children: o }) }) ] }), @@ -38512,22 +39026,22 @@ function k9(t) { /* @__PURE__ */ le.jsx("div", { id: "captcha-element" }) ] }); } -function $9(t) { +function lA(t) { const { email: e } = t, [r, n] = Yt(!1), [i, s] = Yt(""), o = wi(() => `xn-btn-${(/* @__PURE__ */ new Date()).getTime()}`, [e]); - async function a(w, A) { - n(!0), s(""), await Ta.getEmailCode({ account_type: "email", email: w }, A), n(!1); + async function a(w, _) { + n(!0), s(""), await ka.getEmailCode({ account_type: "email", email: w }, _), n(!1); } async function u(w) { try { return await a(e, JSON.stringify(w)), { captchaResult: !0, bizResult: !0 }; - } catch (A) { - return s(A.message), { captchaResult: !1, bizResult: !1 }; + } catch (_) { + return s(_.message), { captchaResult: !1, bizResult: !1 }; } } async function l(w) { w && t.onCodeSend(); } - const d = Zn(); + const d = Qn(); function p(w) { d.current = w; } @@ -38549,21 +39063,21 @@ function $9(t) { language: "en", region: "cn" }), () => { - var w, A; - (w = document.getElementById("aliyunCaptcha-mask")) == null || w.remove(), (A = document.getElementById("aliyunCaptcha-window-popup")) == null || A.remove(); + var w, _; + (w = document.getElementById("aliyunCaptcha-mask")) == null || w.remove(), (_ = document.getElementById("aliyunCaptcha-window-popup")) == null || _.remove(); }; - }, [e]), /* @__PURE__ */ le.jsxs(Ms, { children: [ + }, [e]), /* @__PURE__ */ le.jsxs(Rs, { children: [ /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ - /* @__PURE__ */ le.jsx(bZ, { className: "xc-mb-4", size: 60 }), - /* @__PURE__ */ le.jsx("button", { className: "xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2", id: o, children: r ? /* @__PURE__ */ le.jsx(mc, { className: "xc-animate-spin" }) : "I'm not a robot" }) + /* @__PURE__ */ le.jsx(XZ, { className: "xc-mb-4", size: 60 }), + /* @__PURE__ */ le.jsx("button", { className: "xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2", id: o, children: r ? /* @__PURE__ */ le.jsx(Sc, { className: "xc-animate-spin" }) : "I'm not a robot" }) ] }), i && /* @__PURE__ */ le.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ le.jsx("p", { children: i }) }) ] }); } -function Hne(t) { - const { email: e } = t, r = uy(), [n, i] = Yt("captcha"); +function Sie(t) { + const { email: e } = t, r = Ey(), [n, i] = Yt("captcha"); async function s(o, a) { - const u = await Ta.emailLogin({ + const u = await ka.emailLogin({ account_type: "email", connector: "codatta_email", account_enum: "C", @@ -38578,13 +39092,13 @@ function Hne(t) { }); t.onLogin(u.data); } - return /* @__PURE__ */ le.jsxs(Ms, { children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ le.jsx(Pc, { title: "Sign in with email", onBack: t.onBack }) }), - n === "captcha" && /* @__PURE__ */ le.jsx($9, { email: e, onCodeSend: () => i("verify-email") }), - n === "verify-email" && /* @__PURE__ */ le.jsx(k9, { email: e, onInputCode: s, onResendCode: () => i("captcha") }) + return /* @__PURE__ */ le.jsxs(Rs, { children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ le.jsx(kc, { title: "Sign in with email", onBack: t.onBack }) }), + n === "captcha" && /* @__PURE__ */ le.jsx(lA, { email: e, onCodeSend: () => i("verify-email") }), + n === "verify-email" && /* @__PURE__ */ le.jsx(fA, { email: e, onInputCode: s, onResendCode: () => i("captcha") }) ] }); } -var B9 = { exports: {} }; +var hA = { exports: {} }; (function(t, e) { (function(r, n) { t.exports = n(); @@ -38592,52 +39106,52 @@ var B9 = { exports: {} }; var r = { 873: (o, a) => { var u, l, d = function() { var p = function(f, g) { - var b = f, x = B[g], _ = null, E = 0, v = null, P = [], I = {}, F = function(re, pe) { - _ = function(ie) { + var b = f, x = B[g], E = null, S = 0, v = null, M = [], I = {}, F = function(re, pe) { + E = function(ie) { for (var ue = new Array(ie), ve = 0; ve < ie; ve += 1) { ue[ve] = new Array(ie); for (var Pe = 0; Pe < ie; Pe += 1) ue[ve][Pe] = null; } return ue; - }(E = 4 * b + 17), ce(0, 0), ce(E - 7, 0), ce(0, E - 7), oe(), D(), J(re, pe), b >= 7 && Z(re), v == null && (v = T(b, x, P)), Q(v, pe); + }(S = 4 * b + 17), ce(0, 0), ce(S - 7, 0), ce(0, S - 7), oe(), D(), J(re, pe), b >= 7 && Z(re), v == null && (v = T(b, x, M)), ee(v, pe); }, ce = function(re, pe) { - for (var ie = -1; ie <= 7; ie += 1) if (!(re + ie <= -1 || E <= re + ie)) for (var ue = -1; ue <= 7; ue += 1) pe + ue <= -1 || E <= pe + ue || (_[re + ie][pe + ue] = 0 <= ie && ie <= 6 && (ue == 0 || ue == 6) || 0 <= ue && ue <= 6 && (ie == 0 || ie == 6) || 2 <= ie && ie <= 4 && 2 <= ue && ue <= 4); + for (var ie = -1; ie <= 7; ie += 1) if (!(re + ie <= -1 || S <= re + ie)) for (var ue = -1; ue <= 7; ue += 1) pe + ue <= -1 || S <= pe + ue || (E[re + ie][pe + ue] = 0 <= ie && ie <= 6 && (ue == 0 || ue == 6) || 0 <= ue && ue <= 6 && (ie == 0 || ie == 6) || 2 <= ie && ie <= 4 && 2 <= ue && ue <= 4); }, D = function() { - for (var re = 8; re < E - 8; re += 1) _[re][6] == null && (_[re][6] = re % 2 == 0); - for (var pe = 8; pe < E - 8; pe += 1) _[6][pe] == null && (_[6][pe] = pe % 2 == 0); + for (var re = 8; re < S - 8; re += 1) E[re][6] == null && (E[re][6] = re % 2 == 0); + for (var pe = 8; pe < S - 8; pe += 1) E[6][pe] == null && (E[6][pe] = pe % 2 == 0); }, oe = function() { - for (var re = $.getPatternPosition(b), pe = 0; pe < re.length; pe += 1) for (var ie = 0; ie < re.length; ie += 1) { + for (var re = k.getPatternPosition(b), pe = 0; pe < re.length; pe += 1) for (var ie = 0; ie < re.length; ie += 1) { var ue = re[pe], ve = re[ie]; - if (_[ue][ve] == null) for (var Pe = -2; Pe <= 2; Pe += 1) for (var De = -2; De <= 2; De += 1) _[ue + Pe][ve + De] = Pe == -2 || Pe == 2 || De == -2 || De == 2 || Pe == 0 && De == 0; + if (E[ue][ve] == null) for (var Pe = -2; Pe <= 2; Pe += 1) for (var De = -2; De <= 2; De += 1) E[ue + Pe][ve + De] = Pe == -2 || Pe == 2 || De == -2 || De == 2 || Pe == 0 && De == 0; } }, Z = function(re) { - for (var pe = $.getBCHTypeNumber(b), ie = 0; ie < 18; ie += 1) { + for (var pe = k.getBCHTypeNumber(b), ie = 0; ie < 18; ie += 1) { var ue = !re && (pe >> ie & 1) == 1; - _[Math.floor(ie / 3)][ie % 3 + E - 8 - 3] = ue; + E[Math.floor(ie / 3)][ie % 3 + S - 8 - 3] = ue; } - for (ie = 0; ie < 18; ie += 1) ue = !re && (pe >> ie & 1) == 1, _[ie % 3 + E - 8 - 3][Math.floor(ie / 3)] = ue; + for (ie = 0; ie < 18; ie += 1) ue = !re && (pe >> ie & 1) == 1, E[ie % 3 + S - 8 - 3][Math.floor(ie / 3)] = ue; }, J = function(re, pe) { - for (var ie = x << 3 | pe, ue = $.getBCHTypeInfo(ie), ve = 0; ve < 15; ve += 1) { + for (var ie = x << 3 | pe, ue = k.getBCHTypeInfo(ie), ve = 0; ve < 15; ve += 1) { var Pe = !re && (ue >> ve & 1) == 1; - ve < 6 ? _[ve][8] = Pe : ve < 8 ? _[ve + 1][8] = Pe : _[E - 15 + ve][8] = Pe; + ve < 6 ? E[ve][8] = Pe : ve < 8 ? E[ve + 1][8] = Pe : E[S - 15 + ve][8] = Pe; } - for (ve = 0; ve < 15; ve += 1) Pe = !re && (ue >> ve & 1) == 1, ve < 8 ? _[8][E - ve - 1] = Pe : ve < 9 ? _[8][15 - ve - 1 + 1] = Pe : _[8][15 - ve - 1] = Pe; - _[E - 8][8] = !re; - }, Q = function(re, pe) { - for (var ie = -1, ue = E - 1, ve = 7, Pe = 0, De = $.getMaskFunction(pe), Ce = E - 1; Ce > 0; Ce -= 2) for (Ce == 6 && (Ce -= 1); ; ) { - for (var $e = 0; $e < 2; $e += 1) if (_[ue][Ce - $e] == null) { + for (ve = 0; ve < 15; ve += 1) Pe = !re && (ue >> ve & 1) == 1, ve < 8 ? E[8][S - ve - 1] = Pe : ve < 9 ? E[8][15 - ve - 1 + 1] = Pe : E[8][15 - ve - 1] = Pe; + E[S - 8][8] = !re; + }, ee = function(re, pe) { + for (var ie = -1, ue = S - 1, ve = 7, Pe = 0, De = k.getMaskFunction(pe), Ce = S - 1; Ce > 0; Ce -= 2) for (Ce == 6 && (Ce -= 1); ; ) { + for (var $e = 0; $e < 2; $e += 1) if (E[ue][Ce - $e] == null) { var Me = !1; - Pe < re.length && (Me = (re[Pe] >>> ve & 1) == 1), De(ue, Ce - $e) && (Me = !Me), _[ue][Ce - $e] = Me, (ve -= 1) == -1 && (Pe += 1, ve = 7); + Pe < re.length && (Me = (re[Pe] >>> ve & 1) == 1), De(ue, Ce - $e) && (Me = !Me), E[ue][Ce - $e] = Me, (ve -= 1) == -1 && (Pe += 1, ve = 7); } - if ((ue += ie) < 0 || E <= ue) { + if ((ue += ie) < 0 || S <= ue) { ue -= ie, ie = -ie; break; } } }, T = function(re, pe, ie) { - for (var ue = V.getRSBlocks(re, pe), ve = te(), Pe = 0; Pe < ie.length; Pe += 1) { + for (var ue = V.getRSBlocks(re, pe), ve = Q(), Pe = 0; Pe < ie.length; Pe += 1) { var De = ie[Pe]; - ve.put(De.getMode(), 4), ve.put(De.getLength(), $.getLengthInBits(De.getMode(), re)), De.write(ve); + ve.put(De.getMode(), 4), ve.put(De.getLength(), k.getLengthInBits(De.getMode(), re)), De.write(ve); } var Ce = 0; for (Pe = 0; Pe < ue.length; Pe += 1) Ce += ue[Pe].dataCount; @@ -38650,7 +39164,7 @@ var B9 = { exports: {} }; Ke = Math.max(Ke, Ze), Le = Math.max(Le, at), qe[_e] = new Array(Ze); for (var ke = 0; ke < qe[_e].length; ke += 1) qe[_e][ke] = 255 & $e.getBuffer()[ke + Ne]; Ne += Ze; - var Qe = $.getErrorCorrectPolynomial(at), tt = U(qe[_e], Qe.getLength() - 1).mod(Qe); + var Qe = k.getErrorCorrectPolynomial(at), tt = U(qe[_e], Qe.getLength() - 1).mod(Qe); for (ze[_e] = new Array(Qe.getLength() - 1), ke = 0; ke < ze[_e].length; ke += 1) { var Ye = ke + tt.getLength() - ze[_e].length; ze[_e][ke] = Ye >= 0 ? tt.getAt(Ye) : 0; @@ -38682,18 +39196,18 @@ var B9 = { exports: {} }; default: throw "mode:" + pe; } - P.push(ie), v = null; + M.push(ie), v = null; }, I.isDark = function(re, pe) { - if (re < 0 || E <= re || pe < 0 || E <= pe) throw re + "," + pe; - return _[re][pe]; + if (re < 0 || S <= re || pe < 0 || S <= pe) throw re + "," + pe; + return E[re][pe]; }, I.getModuleCount = function() { - return E; + return S; }, I.make = function() { if (b < 1) { for (var re = 1; re < 40; re++) { - for (var pe = V.getRSBlocks(re, x), ie = te(), ue = 0; ue < P.length; ue++) { - var ve = P[ue]; - ie.put(ve.getMode(), 4), ie.put(ve.getLength(), $.getLengthInBits(ve.getMode(), re)), ve.write(ie); + for (var pe = V.getRSBlocks(re, x), ie = Q(), ue = 0; ue < M.length; ue++) { + var ve = M[ue]; + ie.put(ve.getMode(), 4), ie.put(ve.getLength(), k.getLengthInBits(ve.getMode(), re)), ve.write(ie); } var Pe = 0; for (ue = 0; ue < pe.length; ue++) Pe += pe[ue].dataCount; @@ -38704,7 +39218,7 @@ var B9 = { exports: {} }; F(!1, function() { for (var De = 0, Ce = 0, $e = 0; $e < 8; $e += 1) { F(!0, $e); - var Me = $.getLostPoint(I); + var Me = k.getLostPoint(I); ($e == 0 || De > Me) && (De = Me, Ce = $e); } return Ce; @@ -38794,43 +39308,43 @@ var B9 = { exports: {} }; return g; } }).default, p.createStringToBytes = function(f, g) { var b = function() { - for (var _ = S(f), E = function() { - var D = _.read(); + for (var E = A(f), S = function() { + var D = E.read(); if (D == -1) throw "eof"; return D; - }, v = 0, P = {}; ; ) { - var I = _.read(); + }, v = 0, M = {}; ; ) { + var I = E.read(); if (I == -1) break; - var F = E(), ce = E() << 8 | E(); - P[String.fromCharCode(I << 8 | F)] = ce, v += 1; + var F = S(), ce = S() << 8 | S(); + M[String.fromCharCode(I << 8 | F)] = ce, v += 1; } if (v != g) throw v + " != " + g; - return P; + return M; }(), x = 63; - return function(_) { - for (var E = [], v = 0; v < _.length; v += 1) { - var P = _.charCodeAt(v); - if (P < 128) E.push(P); + return function(E) { + for (var S = [], v = 0; v < E.length; v += 1) { + var M = E.charCodeAt(v); + if (M < 128) S.push(M); else { - var I = b[_.charAt(v)]; - typeof I == "number" ? (255 & I) == I ? E.push(I) : (E.push(I >>> 8), E.push(255 & I)) : E.push(x); + var I = b[E.charAt(v)]; + typeof I == "number" ? (255 & I) == I ? S.push(I) : (S.push(I >>> 8), S.push(255 & I)) : S.push(x); } } - return E; + return S; }; }; - var w, A, M, N, L, B = { L: 1, M: 0, Q: 3, H: 2 }, $ = (w = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], A = 1335, M = 7973, L = function(f) { + var w, _, P, O, L, B = { L: 1, M: 0, Q: 3, H: 2 }, k = (w = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], _ = 1335, P = 7973, L = function(f) { for (var g = 0; f != 0; ) g += 1, f >>>= 1; return g; - }, (N = {}).getBCHTypeInfo = function(f) { - for (var g = f << 10; L(g) - L(A) >= 0; ) g ^= A << L(g) - L(A); + }, (O = {}).getBCHTypeInfo = function(f) { + for (var g = f << 10; L(g) - L(_) >= 0; ) g ^= _ << L(g) - L(_); return 21522 ^ (f << 10 | g); - }, N.getBCHTypeNumber = function(f) { - for (var g = f << 12; L(g) - L(M) >= 0; ) g ^= M << L(g) - L(M); + }, O.getBCHTypeNumber = function(f) { + for (var g = f << 12; L(g) - L(P) >= 0; ) g ^= P << L(g) - L(P); return f << 12 | g; - }, N.getPatternPosition = function(f) { + }, O.getPatternPosition = function(f) { return w[f - 1]; - }, N.getMaskFunction = function(f) { + }, O.getMaskFunction = function(f) { switch (f) { case 0: return function(g, b) { @@ -38867,10 +39381,10 @@ var B9 = { exports: {} }; default: throw "bad maskPattern:" + f; } - }, N.getErrorCorrectPolynomial = function(f) { - for (var g = U([1], 0), b = 0; b < f; b += 1) g = g.multiply(U([1, H.gexp(b)], 0)); + }, O.getErrorCorrectPolynomial = function(f) { + for (var g = U([1], 0), b = 0; b < f; b += 1) g = g.multiply(U([1, q.gexp(b)], 0)); return g; - }, N.getLengthInBits = function(f, g) { + }, O.getLengthInBits = function(f, g) { if (1 <= g && g < 10) switch (f) { case 1: return 10; @@ -38909,21 +39423,21 @@ var B9 = { exports: {} }; throw "mode:" + f; } } - }, N.getLostPoint = function(f) { - for (var g = f.getModuleCount(), b = 0, x = 0; x < g; x += 1) for (var _ = 0; _ < g; _ += 1) { - for (var E = 0, v = f.isDark(x, _), P = -1; P <= 1; P += 1) if (!(x + P < 0 || g <= x + P)) for (var I = -1; I <= 1; I += 1) _ + I < 0 || g <= _ + I || P == 0 && I == 0 || v == f.isDark(x + P, _ + I) && (E += 1); - E > 5 && (b += 3 + E - 5); + }, O.getLostPoint = function(f) { + for (var g = f.getModuleCount(), b = 0, x = 0; x < g; x += 1) for (var E = 0; E < g; E += 1) { + for (var S = 0, v = f.isDark(x, E), M = -1; M <= 1; M += 1) if (!(x + M < 0 || g <= x + M)) for (var I = -1; I <= 1; I += 1) E + I < 0 || g <= E + I || M == 0 && I == 0 || v == f.isDark(x + M, E + I) && (S += 1); + S > 5 && (b += 3 + S - 5); } - for (x = 0; x < g - 1; x += 1) for (_ = 0; _ < g - 1; _ += 1) { + for (x = 0; x < g - 1; x += 1) for (E = 0; E < g - 1; E += 1) { var F = 0; - f.isDark(x, _) && (F += 1), f.isDark(x + 1, _) && (F += 1), f.isDark(x, _ + 1) && (F += 1), f.isDark(x + 1, _ + 1) && (F += 1), F != 0 && F != 4 || (b += 3); + f.isDark(x, E) && (F += 1), f.isDark(x + 1, E) && (F += 1), f.isDark(x, E + 1) && (F += 1), f.isDark(x + 1, E + 1) && (F += 1), F != 0 && F != 4 || (b += 3); } - for (x = 0; x < g; x += 1) for (_ = 0; _ < g - 6; _ += 1) f.isDark(x, _) && !f.isDark(x, _ + 1) && f.isDark(x, _ + 2) && f.isDark(x, _ + 3) && f.isDark(x, _ + 4) && !f.isDark(x, _ + 5) && f.isDark(x, _ + 6) && (b += 40); - for (_ = 0; _ < g; _ += 1) for (x = 0; x < g - 6; x += 1) f.isDark(x, _) && !f.isDark(x + 1, _) && f.isDark(x + 2, _) && f.isDark(x + 3, _) && f.isDark(x + 4, _) && !f.isDark(x + 5, _) && f.isDark(x + 6, _) && (b += 40); + for (x = 0; x < g; x += 1) for (E = 0; E < g - 6; E += 1) f.isDark(x, E) && !f.isDark(x, E + 1) && f.isDark(x, E + 2) && f.isDark(x, E + 3) && f.isDark(x, E + 4) && !f.isDark(x, E + 5) && f.isDark(x, E + 6) && (b += 40); + for (E = 0; E < g; E += 1) for (x = 0; x < g - 6; x += 1) f.isDark(x, E) && !f.isDark(x + 1, E) && f.isDark(x + 2, E) && f.isDark(x + 3, E) && f.isDark(x + 4, E) && !f.isDark(x + 5, E) && f.isDark(x + 6, E) && (b += 40); var ce = 0; - for (_ = 0; _ < g; _ += 1) for (x = 0; x < g; x += 1) f.isDark(x, _) && (ce += 1); + for (E = 0; E < g; E += 1) for (x = 0; x < g; x += 1) f.isDark(x, E) && (ce += 1); return b + Math.abs(100 * ce / g / g - 50) / 5 * 10; - }, N), H = function() { + }, O), q = function() { for (var f = new Array(256), g = new Array(256), b = 0; b < 8; b += 1) f[b] = 1 << b; for (b = 8; b < 256; b += 1) f[b] = f[b - 4] ^ f[b - 5] ^ f[b - 6] ^ f[b - 8]; for (b = 0; b < 255; b += 1) g[f[b]] = b; @@ -38939,30 +39453,30 @@ var B9 = { exports: {} }; function U(f, g) { if (f.length === void 0) throw f.length + "/" + g; var b = function() { - for (var _ = 0; _ < f.length && f[_] == 0; ) _ += 1; - for (var E = new Array(f.length - _ + g), v = 0; v < f.length - _; v += 1) E[v] = f[v + _]; - return E; - }(), x = { getAt: function(_) { - return b[_]; + for (var E = 0; E < f.length && f[E] == 0; ) E += 1; + for (var S = new Array(f.length - E + g), v = 0; v < f.length - E; v += 1) S[v] = f[v + E]; + return S; + }(), x = { getAt: function(E) { + return b[E]; }, getLength: function() { return b.length; - }, multiply: function(_) { - for (var E = new Array(x.getLength() + _.getLength() - 1), v = 0; v < x.getLength(); v += 1) for (var P = 0; P < _.getLength(); P += 1) E[v + P] ^= H.gexp(H.glog(x.getAt(v)) + H.glog(_.getAt(P))); - return U(E, 0); - }, mod: function(_) { - if (x.getLength() - _.getLength() < 0) return x; - for (var E = H.glog(x.getAt(0)) - H.glog(_.getAt(0)), v = new Array(x.getLength()), P = 0; P < x.getLength(); P += 1) v[P] = x.getAt(P); - for (P = 0; P < _.getLength(); P += 1) v[P] ^= H.gexp(H.glog(_.getAt(P)) + E); - return U(v, 0).mod(_); + }, multiply: function(E) { + for (var S = new Array(x.getLength() + E.getLength() - 1), v = 0; v < x.getLength(); v += 1) for (var M = 0; M < E.getLength(); M += 1) S[v + M] ^= q.gexp(q.glog(x.getAt(v)) + q.glog(E.getAt(M))); + return U(S, 0); + }, mod: function(E) { + if (x.getLength() - E.getLength() < 0) return x; + for (var S = q.glog(x.getAt(0)) - q.glog(E.getAt(0)), v = new Array(x.getLength()), M = 0; M < x.getLength(); M += 1) v[M] = x.getAt(M); + for (M = 0; M < E.getLength(); M += 1) v[M] ^= q.gexp(q.glog(E.getAt(M)) + S); + return U(v, 0).mod(E); } }; return x; } var V = /* @__PURE__ */ function() { - var f = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12, 7, 37, 13], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]], g = function(x, _) { - var E = {}; - return E.totalCount = x, E.dataCount = _, E; - }, b = { getRSBlocks: function(x, _) { - var E = function(Z, J) { + var f = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12, 7, 37, 13], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]], g = function(x, E) { + var S = {}; + return S.totalCount = x, S.dataCount = E, S; + }, b = { getRSBlocks: function(x, E) { + var S = function(Z, J) { switch (J) { case B.L: return f[4 * (Z - 1) + 0]; @@ -38975,55 +39489,55 @@ var B9 = { exports: {} }; default: return; } - }(x, _); - if (E === void 0) throw "bad rs block @ typeNumber:" + x + "/errorCorrectionLevel:" + _; - for (var v = E.length / 3, P = [], I = 0; I < v; I += 1) for (var F = E[3 * I + 0], ce = E[3 * I + 1], D = E[3 * I + 2], oe = 0; oe < F; oe += 1) P.push(g(ce, D)); - return P; + }(x, E); + if (S === void 0) throw "bad rs block @ typeNumber:" + x + "/errorCorrectionLevel:" + E; + for (var v = S.length / 3, M = [], I = 0; I < v; I += 1) for (var F = S[3 * I + 0], ce = S[3 * I + 1], D = S[3 * I + 2], oe = 0; oe < F; oe += 1) M.push(g(ce, D)); + return M; } }; return b; - }(), te = function() { + }(), Q = function() { var f = [], g = 0, b = { getBuffer: function() { return f; }, getAt: function(x) { - var _ = Math.floor(x / 8); - return (f[_] >>> 7 - x % 8 & 1) == 1; - }, put: function(x, _) { - for (var E = 0; E < _; E += 1) b.putBit((x >>> _ - E - 1 & 1) == 1); + var E = Math.floor(x / 8); + return (f[E] >>> 7 - x % 8 & 1) == 1; + }, put: function(x, E) { + for (var S = 0; S < E; S += 1) b.putBit((x >>> E - S - 1 & 1) == 1); }, getLengthInBits: function() { return g; }, putBit: function(x) { - var _ = Math.floor(g / 8); - f.length <= _ && f.push(0), x && (f[_] |= 128 >>> g % 8), g += 1; + var E = Math.floor(g / 8); + f.length <= E && f.push(0), x && (f[E] |= 128 >>> g % 8), g += 1; } }; return b; }, R = function(f) { var g = f, b = { getMode: function() { return 1; - }, getLength: function(E) { + }, getLength: function(S) { return g.length; - }, write: function(E) { - for (var v = g, P = 0; P + 2 < v.length; ) E.put(x(v.substring(P, P + 3)), 10), P += 3; - P < v.length && (v.length - P == 1 ? E.put(x(v.substring(P, P + 1)), 4) : v.length - P == 2 && E.put(x(v.substring(P, P + 2)), 7)); - } }, x = function(E) { - for (var v = 0, P = 0; P < E.length; P += 1) v = 10 * v + _(E.charAt(P)); + }, write: function(S) { + for (var v = g, M = 0; M + 2 < v.length; ) S.put(x(v.substring(M, M + 3)), 10), M += 3; + M < v.length && (v.length - M == 1 ? S.put(x(v.substring(M, M + 1)), 4) : v.length - M == 2 && S.put(x(v.substring(M, M + 2)), 7)); + } }, x = function(S) { + for (var v = 0, M = 0; M < S.length; M += 1) v = 10 * v + E(S.charAt(M)); return v; - }, _ = function(E) { - if ("0" <= E && E <= "9") return E.charCodeAt(0) - 48; - throw "illegal char :" + E; + }, E = function(S) { + if ("0" <= S && S <= "9") return S.charCodeAt(0) - 48; + throw "illegal char :" + S; }; return b; }, K = function(f) { var g = f, b = { getMode: function() { return 2; - }, getLength: function(_) { + }, getLength: function(E) { return g.length; - }, write: function(_) { - for (var E = g, v = 0; v + 1 < E.length; ) _.put(45 * x(E.charAt(v)) + x(E.charAt(v + 1)), 11), v += 2; - v < E.length && _.put(x(E.charAt(v)), 6); - } }, x = function(_) { - if ("0" <= _ && _ <= "9") return _.charCodeAt(0) - 48; - if ("A" <= _ && _ <= "Z") return _.charCodeAt(0) - 65 + 10; - switch (_) { + }, write: function(E) { + for (var S = g, v = 0; v + 1 < S.length; ) E.put(45 * x(S.charAt(v)) + x(S.charAt(v + 1)), 11), v += 2; + v < S.length && E.put(x(S.charAt(v)), 6); + } }, x = function(E) { + if ("0" <= E && E <= "9") return E.charCodeAt(0) - 48; + if ("A" <= E && E <= "Z") return E.charCodeAt(0) - 65 + 10; + switch (E) { case " ": return 36; case "$": @@ -39043,7 +39557,7 @@ var B9 = { exports: {} }; case ":": return 44; default: - throw "illegal char :" + _; + throw "illegal char :" + E; } }; return b; @@ -39060,24 +39574,24 @@ var B9 = { exports: {} }; var g = p.stringToBytesFuncs.SJIS; if (!g) throw "sjis not supported."; (function() { - var _ = g("友"); - if (_.length != 2 || (_[0] << 8 | _[1]) != 38726) throw "sjis not supported."; + var E = g("友"); + if (E.length != 2 || (E[0] << 8 | E[1]) != 38726) throw "sjis not supported."; })(); var b = g(f), x = { getMode: function() { return 8; - }, getLength: function(_) { + }, getLength: function(E) { return ~~(b.length / 2); - }, write: function(_) { - for (var E = b, v = 0; v + 1 < E.length; ) { - var P = (255 & E[v]) << 8 | 255 & E[v + 1]; - if (33088 <= P && P <= 40956) P -= 33088; + }, write: function(E) { + for (var S = b, v = 0; v + 1 < S.length; ) { + var M = (255 & S[v]) << 8 | 255 & S[v + 1]; + if (33088 <= M && M <= 40956) M -= 33088; else { - if (!(57408 <= P && P <= 60351)) throw "illegal char at " + (v + 1) + "/" + P; - P -= 49472; + if (!(57408 <= M && M <= 60351)) throw "illegal char at " + (v + 1) + "/" + M; + M -= 49472; } - P = 192 * (P >>> 8 & 255) + (255 & P), _.put(P, 13), v += 2; + M = 192 * (M >>> 8 & 255) + (255 & M), E.put(M, 13), v += 2; } - if (v < E.length) throw "illegal char at " + (v + 1); + if (v < S.length) throw "illegal char at " + (v + 1); } }; return x; }, Y = function() { @@ -39085,9 +39599,9 @@ var B9 = { exports: {} }; f.push(255 & b); }, writeShort: function(b) { g.writeByte(b), g.writeByte(b >>> 8); - }, writeBytes: function(b, x, _) { - x = x || 0, _ = _ || b.length; - for (var E = 0; E < _; E += 1) g.writeByte(b[E + x]); + }, writeBytes: function(b, x, E) { + x = x || 0, E = E || b.length; + for (var S = 0; S < E; S += 1) g.writeByte(b[S + x]); }, writeString: function(b) { for (var x = 0; x < b.length; x += 1) g.writeByte(b.charCodeAt(x)); }, toByteArray: function() { @@ -39099,31 +39613,31 @@ var B9 = { exports: {} }; return b + "]"; } }; return g; - }, S = function(f) { - var g = f, b = 0, x = 0, _ = 0, E = { read: function() { - for (; _ < 8; ) { + }, A = function(f) { + var g = f, b = 0, x = 0, E = 0, S = { read: function() { + for (; E < 8; ) { if (b >= g.length) { - if (_ == 0) return -1; - throw "unexpected end of file./" + _; + if (E == 0) return -1; + throw "unexpected end of file./" + E; } - var P = g.charAt(b); - if (b += 1, P == "=") return _ = 0, -1; - P.match(/^\s$/) || (x = x << 6 | v(P.charCodeAt(0)), _ += 6); + var M = g.charAt(b); + if (b += 1, M == "=") return E = 0, -1; + M.match(/^\s$/) || (x = x << 6 | v(M.charCodeAt(0)), E += 6); } - var I = x >>> _ - 8 & 255; - return _ -= 8, I; - } }, v = function(P) { - if (65 <= P && P <= 90) return P - 65; - if (97 <= P && P <= 122) return P - 97 + 26; - if (48 <= P && P <= 57) return P - 48 + 52; - if (P == 43) return 62; - if (P == 47) return 63; - throw "c:" + P; + var I = x >>> E - 8 & 255; + return E -= 8, I; + } }, v = function(M) { + if (65 <= M && M <= 90) return M - 65; + if (97 <= M && M <= 122) return M - 97 + 26; + if (48 <= M && M <= 57) return M - 48 + 52; + if (M == 43) return 62; + if (M == 47) return 63; + throw "c:" + M; }; - return E; + return S; }, m = function(f, g, b) { for (var x = function(ce, D) { - var oe = ce, Z = D, J = new Array(ce * D), Q = { setPixel: function(re, pe, ie) { + var oe = ce, Z = D, J = new Array(ce * D), ee = { setPixel: function(re, pe, ie) { J[pe * oe + re] = ie; }, write: function(re) { re.writeString("GIF87a"), re.writeShort(oe), re.writeShort(Z), re.writeByte(128), re.writeByte(0), re.writeByte(0), re.writeByte(0), re.writeByte(0), re.writeByte(0), re.writeByte(255), re.writeByte(255), re.writeByte(255), re.writeString(","), re.writeShort(0), re.writeShort(0), re.writeShort(oe), re.writeShort(Z), re.writeByte(0); @@ -39161,12 +39675,12 @@ var B9 = { exports: {} }; } }; return ie; }; - return Q; - }(f, g), _ = 0; _ < g; _ += 1) for (var E = 0; E < f; E += 1) x.setPixel(E, _, b(E, _)); + return ee; + }(f, g), E = 0; E < g; E += 1) for (var S = 0; S < f; S += 1) x.setPixel(S, E, b(S, E)); var v = Y(); x.write(v); - for (var P = function() { - var ce = 0, D = 0, oe = 0, Z = "", J = {}, Q = function(X) { + for (var M = function() { + var ce = 0, D = 0, oe = 0, Z = "", J = {}, ee = function(X) { Z += String.fromCharCode(T(63 & X)); }, T = function(X) { if (!(X < 0)) { @@ -39179,24 +39693,24 @@ var B9 = { exports: {} }; throw "n:" + X; }; return J.writeByte = function(X) { - for (ce = ce << 8 | 255 & X, D += 8, oe += 1; D >= 6; ) Q(ce >>> D - 6), D -= 6; + for (ce = ce << 8 | 255 & X, D += 8, oe += 1; D >= 6; ) ee(ce >>> D - 6), D -= 6; }, J.flush = function() { - if (D > 0 && (Q(ce << 6 - D), ce = 0, D = 0), oe % 3 != 0) for (var X = 3 - oe % 3, re = 0; re < X; re += 1) Z += "="; + if (D > 0 && (ee(ce << 6 - D), ce = 0, D = 0), oe % 3 != 0) for (var X = 3 - oe % 3, re = 0; re < X; re += 1) Z += "="; }, J.toString = function() { return Z; }, J; - }(), I = v.toByteArray(), F = 0; F < I.length; F += 1) P.writeByte(I[F]); - return P.flush(), "data:image/gif;base64," + P; + }(), I = v.toByteArray(), F = 0; F < I.length; F += 1) M.writeByte(I[F]); + return M.flush(), "data:image/gif;base64," + M; }; return p; }(); d.stringToBytesFuncs["UTF-8"] = function(p) { return function(w) { - for (var A = [], M = 0; M < w.length; M++) { - var N = w.charCodeAt(M); - N < 128 ? A.push(N) : N < 2048 ? A.push(192 | N >> 6, 128 | 63 & N) : N < 55296 || N >= 57344 ? A.push(224 | N >> 12, 128 | N >> 6 & 63, 128 | 63 & N) : (M++, N = 65536 + ((1023 & N) << 10 | 1023 & w.charCodeAt(M)), A.push(240 | N >> 18, 128 | N >> 12 & 63, 128 | N >> 6 & 63, 128 | 63 & N)); + for (var _ = [], P = 0; P < w.length; P++) { + var O = w.charCodeAt(P); + O < 128 ? _.push(O) : O < 2048 ? _.push(192 | O >> 6, 128 | 63 & O) : O < 55296 || O >= 57344 ? _.push(224 | O >> 12, 128 | O >> 6 & 63, 128 | 63 & O) : (P++, O = 65536 + ((1023 & O) << 10 | 1023 & w.charCodeAt(P)), _.push(240 | O >> 18, 128 | O >> 12 & 63, 128 | O >> 6 & 63, 128 | 63 & O)); } - return A; + return _; }(p); }, (l = typeof (u = function() { return d; @@ -39217,18 +39731,18 @@ var B9 = { exports: {} }; var s = {}; return (() => { i.d(s, { default: () => Y }); - const o = (S) => !!S && typeof S == "object" && !Array.isArray(S); - function a(S, ...m) { - if (!m.length) return S; + const o = (A) => !!A && typeof A == "object" && !Array.isArray(A); + function a(A, ...m) { + if (!m.length) return A; const f = m.shift(); - return f !== void 0 && o(S) && o(f) ? (S = Object.assign({}, S), Object.keys(f).forEach((g) => { - const b = S[g], x = f[g]; - Array.isArray(b) && Array.isArray(x) ? S[g] = x : o(b) && o(x) ? S[g] = a(Object.assign({}, b), x) : S[g] = x; - }), a(S, ...m)) : S; + return f !== void 0 && o(A) && o(f) ? (A = Object.assign({}, A), Object.keys(f).forEach((g) => { + const b = A[g], x = f[g]; + Array.isArray(b) && Array.isArray(x) ? A[g] = x : o(b) && o(x) ? A[g] = a(Object.assign({}, b), x) : A[g] = x; + }), a(A, ...m)) : A; } - function u(S, m) { + function u(A, m) { const f = document.createElement("a"); - f.download = m, f.href = S, document.body.appendChild(f), f.click(), document.body.removeChild(f); + f.download = m, f.href = A, document.body.appendChild(f), f.click(), document.body.removeChild(f); } const l = { L: 0.07, M: 0.15, Q: 0.25, H: 0.3 }; class d { @@ -39259,9 +39773,9 @@ var B9 = { exports: {} }; x.call(this, { x: m, y: f, size: g, getNeighbor: b }); } _rotateFigure({ x: m, y: f, size: g, rotation: b = 0, draw: x }) { - var _; - const E = m + g / 2, v = f + g / 2; - x(), (_ = this._element) === null || _ === void 0 || _.setAttribute("transform", `rotate(${180 * b / Math.PI},${E},${v})`); + var E; + const S = m + g / 2, v = f + g / 2; + x(), (E = this._element) === null || E === void 0 || E.setAttribute("transform", `rotate(${180 * b / Math.PI},${S},${v})`); } _basicDot(m) { const { size: f, x: g, y: b } = m; @@ -39306,42 +39820,42 @@ var B9 = { exports: {} }; this._basicSquare({ x: m, y: f, size: g, rotation: 0 }); } _drawRounded({ x: m, y: f, size: g, getNeighbor: b }) { - const x = b ? +b(-1, 0) : 0, _ = b ? +b(1, 0) : 0, E = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0, P = x + _ + E + v; - if (P !== 0) if (P > 2 || x && _ || E && v) this._basicSquare({ x: m, y: f, size: g, rotation: 0 }); + const x = b ? +b(-1, 0) : 0, E = b ? +b(1, 0) : 0, S = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0, M = x + E + S + v; + if (M !== 0) if (M > 2 || x && E || S && v) this._basicSquare({ x: m, y: f, size: g, rotation: 0 }); else { - if (P === 2) { + if (M === 2) { let I = 0; - return x && E ? I = Math.PI / 2 : E && _ ? I = Math.PI : _ && v && (I = -Math.PI / 2), void this._basicCornerRounded({ x: m, y: f, size: g, rotation: I }); + return x && S ? I = Math.PI / 2 : S && E ? I = Math.PI : E && v && (I = -Math.PI / 2), void this._basicCornerRounded({ x: m, y: f, size: g, rotation: I }); } - if (P === 1) { + if (M === 1) { let I = 0; - return E ? I = Math.PI / 2 : _ ? I = Math.PI : v && (I = -Math.PI / 2), void this._basicSideRounded({ x: m, y: f, size: g, rotation: I }); + return S ? I = Math.PI / 2 : E ? I = Math.PI : v && (I = -Math.PI / 2), void this._basicSideRounded({ x: m, y: f, size: g, rotation: I }); } } else this._basicDot({ x: m, y: f, size: g, rotation: 0 }); } _drawExtraRounded({ x: m, y: f, size: g, getNeighbor: b }) { - const x = b ? +b(-1, 0) : 0, _ = b ? +b(1, 0) : 0, E = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0, P = x + _ + E + v; - if (P !== 0) if (P > 2 || x && _ || E && v) this._basicSquare({ x: m, y: f, size: g, rotation: 0 }); + const x = b ? +b(-1, 0) : 0, E = b ? +b(1, 0) : 0, S = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0, M = x + E + S + v; + if (M !== 0) if (M > 2 || x && E || S && v) this._basicSquare({ x: m, y: f, size: g, rotation: 0 }); else { - if (P === 2) { + if (M === 2) { let I = 0; - return x && E ? I = Math.PI / 2 : E && _ ? I = Math.PI : _ && v && (I = -Math.PI / 2), void this._basicCornerExtraRounded({ x: m, y: f, size: g, rotation: I }); + return x && S ? I = Math.PI / 2 : S && E ? I = Math.PI : E && v && (I = -Math.PI / 2), void this._basicCornerExtraRounded({ x: m, y: f, size: g, rotation: I }); } - if (P === 1) { + if (M === 1) { let I = 0; - return E ? I = Math.PI / 2 : _ ? I = Math.PI : v && (I = -Math.PI / 2), void this._basicSideRounded({ x: m, y: f, size: g, rotation: I }); + return S ? I = Math.PI / 2 : E ? I = Math.PI : v && (I = -Math.PI / 2), void this._basicSideRounded({ x: m, y: f, size: g, rotation: I }); } } else this._basicDot({ x: m, y: f, size: g, rotation: 0 }); } _drawClassy({ x: m, y: f, size: g, getNeighbor: b }) { - const x = b ? +b(-1, 0) : 0, _ = b ? +b(1, 0) : 0, E = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0; - x + _ + E + v !== 0 ? x || E ? _ || v ? this._basicSquare({ x: m, y: f, size: g, rotation: 0 }) : this._basicCornerRounded({ x: m, y: f, size: g, rotation: Math.PI / 2 }) : this._basicCornerRounded({ x: m, y: f, size: g, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: m, y: f, size: g, rotation: Math.PI / 2 }); + const x = b ? +b(-1, 0) : 0, E = b ? +b(1, 0) : 0, S = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0; + x + E + S + v !== 0 ? x || S ? E || v ? this._basicSquare({ x: m, y: f, size: g, rotation: 0 }) : this._basicCornerRounded({ x: m, y: f, size: g, rotation: Math.PI / 2 }) : this._basicCornerRounded({ x: m, y: f, size: g, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: m, y: f, size: g, rotation: Math.PI / 2 }); } _drawClassyRounded({ x: m, y: f, size: g, getNeighbor: b }) { - const x = b ? +b(-1, 0) : 0, _ = b ? +b(1, 0) : 0, E = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0; - x + _ + E + v !== 0 ? x || E ? _ || v ? this._basicSquare({ x: m, y: f, size: g, rotation: 0 }) : this._basicCornerExtraRounded({ x: m, y: f, size: g, rotation: Math.PI / 2 }) : this._basicCornerExtraRounded({ x: m, y: f, size: g, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: m, y: f, size: g, rotation: Math.PI / 2 }); + const x = b ? +b(-1, 0) : 0, E = b ? +b(1, 0) : 0, S = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0; + x + E + S + v !== 0 ? x || S ? E || v ? this._basicSquare({ x: m, y: f, size: g, rotation: 0 }) : this._basicCornerExtraRounded({ x: m, y: f, size: g, rotation: Math.PI / 2 }) : this._basicCornerExtraRounded({ x: m, y: f, size: g, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: m, y: f, size: g, rotation: Math.PI / 2 }); } } class p { @@ -39363,9 +39877,9 @@ var B9 = { exports: {} }; x.call(this, { x: m, y: f, size: g, rotation: b }); } _rotateFigure({ x: m, y: f, size: g, rotation: b = 0, draw: x }) { - var _; - const E = m + g / 2, v = f + g / 2; - x(), (_ = this._element) === null || _ === void 0 || _.setAttribute("transform", `rotate(${180 * b / Math.PI},${E},${v})`); + var E; + const S = m + g / 2, v = f + g / 2; + x(), (E = this._element) === null || E === void 0 || E.setAttribute("transform", `rotate(${180 * b / Math.PI},${S},${v})`); } _basicDot(m) { const { size: f, x: g, y: b } = m, x = f / 7; @@ -39404,9 +39918,9 @@ var B9 = { exports: {} }; x = this._type === "square" ? this._drawSquare : this._drawDot, x.call(this, { x: m, y: f, size: g, rotation: b }); } _rotateFigure({ x: m, y: f, size: g, rotation: b = 0, draw: x }) { - var _; - const E = m + g / 2, v = f + g / 2; - x(), (_ = this._element) === null || _ === void 0 || _.setAttribute("transform", `rotate(${180 * b / Math.PI},${E},${v})`); + var E; + const S = m + g / 2, v = f + g / 2; + x(), (E = this._element) === null || E === void 0 || E.setAttribute("transform", `rotate(${180 * b / Math.PI},${S},${v})`); } _basicDot(m) { const { size: f, x: g, y: b } = m; @@ -39427,7 +39941,7 @@ var B9 = { exports: {} }; this._basicSquare({ x: m, y: f, size: g, rotation: b }); } } - const A = "circle", M = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]], N = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]; + const _ = "circle", P = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]], O = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]; class L { constructor(m, f) { this._roundSize = (g) => this._options.dotsOptions.roundSize ? Math.floor(g) : g, this._window = f, this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._element.setAttribute("width", String(m.width)), this._element.setAttribute("height", String(m.height)), this._element.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), m.dotsOptions.roundSize || this._element.setAttribute("shape-rendering", "crispEdges"), this._element.setAttribute("viewBox", `0 0 ${m.width} ${m.height}`), this._defs = this._window.document.createElementNS("http://www.w3.org/2000/svg", "defs"), this._element.appendChild(this._defs), this._imageUri = m.image, this._instanceId = L.instanceCount++, this._options = m; @@ -39442,32 +39956,32 @@ var B9 = { exports: {} }; return this._element; } async drawQR(m) { - const f = m.getModuleCount(), g = Math.min(this._options.width, this._options.height) - 2 * this._options.margin, b = this._options.shape === A ? g / Math.sqrt(2) : g, x = this._roundSize(b / f); - let _ = { hideXDots: 0, hideYDots: 0, width: 0, height: 0 }; + const f = m.getModuleCount(), g = Math.min(this._options.width, this._options.height) - 2 * this._options.margin, b = this._options.shape === _ ? g / Math.sqrt(2) : g, x = this._roundSize(b / f); + let E = { hideXDots: 0, hideYDots: 0, width: 0, height: 0 }; if (this._qr = m, this._options.image) { if (await this.loadImage(), !this._image) return; - const { imageOptions: E, qrOptions: v } = this._options, P = E.imageSize * l[v.errorCorrectionLevel], I = Math.floor(P * f * f); - _ = function({ originalHeight: F, originalWidth: ce, maxHiddenDots: D, maxHiddenAxisDots: oe, dotSize: Z }) { - const J = { x: 0, y: 0 }, Q = { x: 0, y: 0 }; + const { imageOptions: S, qrOptions: v } = this._options, M = S.imageSize * l[v.errorCorrectionLevel], I = Math.floor(M * f * f); + E = function({ originalHeight: F, originalWidth: ce, maxHiddenDots: D, maxHiddenAxisDots: oe, dotSize: Z }) { + const J = { x: 0, y: 0 }, ee = { x: 0, y: 0 }; if (F <= 0 || ce <= 0 || D <= 0 || Z <= 0) return { height: 0, width: 0, hideYDots: 0, hideXDots: 0 }; const T = F / ce; - return J.x = Math.floor(Math.sqrt(D / T)), J.x <= 0 && (J.x = 1), oe && oe < J.x && (J.x = oe), J.x % 2 == 0 && J.x--, Q.x = J.x * Z, J.y = 1 + 2 * Math.ceil((J.x * T - 1) / 2), Q.y = Math.round(Q.x * T), (J.y * J.x > D || oe && oe < J.y) && (oe && oe < J.y ? (J.y = oe, J.y % 2 == 0 && J.x--) : J.y -= 2, Q.y = J.y * Z, J.x = 1 + 2 * Math.ceil((J.y / T - 1) / 2), Q.x = Math.round(Q.y / T)), { height: Q.y, width: Q.x, hideYDots: J.y, hideXDots: J.x }; + return J.x = Math.floor(Math.sqrt(D / T)), J.x <= 0 && (J.x = 1), oe && oe < J.x && (J.x = oe), J.x % 2 == 0 && J.x--, ee.x = J.x * Z, J.y = 1 + 2 * Math.ceil((J.x * T - 1) / 2), ee.y = Math.round(ee.x * T), (J.y * J.x > D || oe && oe < J.y) && (oe && oe < J.y ? (J.y = oe, J.y % 2 == 0 && J.x--) : J.y -= 2, ee.y = J.y * Z, J.x = 1 + 2 * Math.ceil((J.y / T - 1) / 2), ee.x = Math.round(ee.y / T)), { height: ee.y, width: ee.x, hideYDots: J.y, hideXDots: J.x }; }({ originalWidth: this._image.width, originalHeight: this._image.height, maxHiddenDots: I, maxHiddenAxisDots: f - 14, dotSize: x }); } - this.drawBackground(), this.drawDots((E, v) => { - var P, I, F, ce, D, oe; - return !(this._options.imageOptions.hideBackgroundDots && E >= (f - _.hideYDots) / 2 && E < (f + _.hideYDots) / 2 && v >= (f - _.hideXDots) / 2 && v < (f + _.hideXDots) / 2 || !((P = M[E]) === null || P === void 0) && P[v] || !((I = M[E - f + 7]) === null || I === void 0) && I[v] || !((F = M[E]) === null || F === void 0) && F[v - f + 7] || !((ce = N[E]) === null || ce === void 0) && ce[v] || !((D = N[E - f + 7]) === null || D === void 0) && D[v] || !((oe = N[E]) === null || oe === void 0) && oe[v - f + 7]); - }), this.drawCorners(), this._options.image && await this.drawImage({ width: _.width, height: _.height, count: f, dotSize: x }); + this.drawBackground(), this.drawDots((S, v) => { + var M, I, F, ce, D, oe; + return !(this._options.imageOptions.hideBackgroundDots && S >= (f - E.hideYDots) / 2 && S < (f + E.hideYDots) / 2 && v >= (f - E.hideXDots) / 2 && v < (f + E.hideXDots) / 2 || !((M = P[S]) === null || M === void 0) && M[v] || !((I = P[S - f + 7]) === null || I === void 0) && I[v] || !((F = P[S]) === null || F === void 0) && F[v - f + 7] || !((ce = O[S]) === null || ce === void 0) && ce[v] || !((D = O[S - f + 7]) === null || D === void 0) && D[v] || !((oe = O[S]) === null || oe === void 0) && oe[v - f + 7]); + }), this.drawCorners(), this._options.image && await this.drawImage({ width: E.width, height: E.height, count: f, dotSize: x }); } drawBackground() { var m, f, g; const b = this._element, x = this._options; if (b) { - const _ = (m = x.backgroundOptions) === null || m === void 0 ? void 0 : m.gradient, E = (f = x.backgroundOptions) === null || f === void 0 ? void 0 : f.color; - let v = x.height, P = x.width; - if (_ || E) { + const E = (m = x.backgroundOptions) === null || m === void 0 ? void 0 : m.gradient, S = (f = x.backgroundOptions) === null || f === void 0 ? void 0 : f.color; + let v = x.height, M = x.width; + if (E || S) { const I = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"); - this._backgroundClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._backgroundClipPath.setAttribute("id", `clip-path-background-color-${this._instanceId}`), this._defs.appendChild(this._backgroundClipPath), !((g = x.backgroundOptions) === null || g === void 0) && g.round && (v = P = Math.min(x.width, x.height), I.setAttribute("rx", String(v / 2 * x.backgroundOptions.round))), I.setAttribute("x", String(this._roundSize((x.width - P) / 2))), I.setAttribute("y", String(this._roundSize((x.height - v) / 2))), I.setAttribute("width", String(P)), I.setAttribute("height", String(v)), this._backgroundClipPath.appendChild(I), this._createColor({ options: _, color: E, additionalRotation: 0, x: 0, y: 0, height: x.height, width: x.width, name: `background-color-${this._instanceId}` }); + this._backgroundClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._backgroundClipPath.setAttribute("id", `clip-path-background-color-${this._instanceId}`), this._defs.appendChild(this._backgroundClipPath), !((g = x.backgroundOptions) === null || g === void 0) && g.round && (v = M = Math.min(x.width, x.height), I.setAttribute("rx", String(v / 2 * x.backgroundOptions.round))), I.setAttribute("x", String(this._roundSize((x.width - M) / 2))), I.setAttribute("y", String(this._roundSize((x.height - v) / 2))), I.setAttribute("width", String(M)), I.setAttribute("height", String(v)), this._backgroundClipPath.appendChild(I), this._createColor({ options: E, color: S, additionalRotation: 0, x: 0, y: 0, height: x.height, width: x.width, name: `background-color-${this._instanceId}` }); } } } @@ -39476,14 +39990,14 @@ var B9 = { exports: {} }; if (!this._qr) throw "QR code is not defined"; const b = this._options, x = this._qr.getModuleCount(); if (x > b.width || x > b.height) throw "The canvas is too small."; - const _ = Math.min(b.width, b.height) - 2 * b.margin, E = b.shape === A ? _ / Math.sqrt(2) : _, v = this._roundSize(E / x), P = this._roundSize((b.width - x * v) / 2), I = this._roundSize((b.height - x * v) / 2), F = new d({ svg: this._element, type: b.dotsOptions.type, window: this._window }); + const E = Math.min(b.width, b.height) - 2 * b.margin, S = b.shape === _ ? E / Math.sqrt(2) : E, v = this._roundSize(S / x), M = this._roundSize((b.width - x * v) / 2), I = this._roundSize((b.height - x * v) / 2), F = new d({ svg: this._element, type: b.dotsOptions.type, window: this._window }); this._dotsClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._dotsClipPath.setAttribute("id", `clip-path-dot-color-${this._instanceId}`), this._defs.appendChild(this._dotsClipPath), this._createColor({ options: (f = b.dotsOptions) === null || f === void 0 ? void 0 : f.gradient, color: b.dotsOptions.color, additionalRotation: 0, x: 0, y: 0, height: b.height, width: b.width, name: `dot-color-${this._instanceId}` }); - for (let ce = 0; ce < x; ce++) for (let D = 0; D < x; D++) m && !m(ce, D) || !((g = this._qr) === null || g === void 0) && g.isDark(ce, D) && (F.draw(P + D * v, I + ce * v, v, (oe, Z) => !(D + oe < 0 || ce + Z < 0 || D + oe >= x || ce + Z >= x) && !(m && !m(ce + Z, D + oe)) && !!this._qr && this._qr.isDark(ce + Z, D + oe)), F._element && this._dotsClipPath && this._dotsClipPath.appendChild(F._element)); - if (b.shape === A) { - const ce = this._roundSize((_ / v - x) / 2), D = x + 2 * ce, oe = P - ce * v, Z = I - ce * v, J = [], Q = this._roundSize(D / 2); + for (let ce = 0; ce < x; ce++) for (let D = 0; D < x; D++) m && !m(ce, D) || !((g = this._qr) === null || g === void 0) && g.isDark(ce, D) && (F.draw(M + D * v, I + ce * v, v, (oe, Z) => !(D + oe < 0 || ce + Z < 0 || D + oe >= x || ce + Z >= x) && !(m && !m(ce + Z, D + oe)) && !!this._qr && this._qr.isDark(ce + Z, D + oe)), F._element && this._dotsClipPath && this._dotsClipPath.appendChild(F._element)); + if (b.shape === _) { + const ce = this._roundSize((E / v - x) / 2), D = x + 2 * ce, oe = M - ce * v, Z = I - ce * v, J = [], ee = this._roundSize(D / 2); for (let T = 0; T < D; T++) { J[T] = []; - for (let X = 0; X < D; X++) T >= ce - 1 && T <= D - ce && X >= ce - 1 && X <= D - ce || Math.sqrt((T - Q) * (T - Q) + (X - Q) * (X - Q)) > Q ? J[T][X] = 0 : J[T][X] = this._qr.isDark(X - 2 * ce < 0 ? X : X >= x ? X - 2 * ce : X - ce, T - 2 * ce < 0 ? T : T >= x ? T - 2 * ce : T - ce) ? 1 : 0; + for (let X = 0; X < D; X++) T >= ce - 1 && T <= D - ce && X >= ce - 1 && X <= D - ce || Math.sqrt((T - ee) * (T - ee) + (X - ee) * (X - ee)) > ee ? J[T][X] = 0 : J[T][X] = this._qr.isDark(X - 2 * ce < 0 ? X : X >= x ? X - 2 * ce : X - ce, T - 2 * ce < 0 ? T : T >= x ? T - 2 * ce : T - ce) ? 1 : 0; } for (let T = 0; T < D; T++) for (let X = 0; X < D; X++) J[T][X] && (F.draw(oe + X * v, Z + T * v, v, (re, pe) => { var ie; @@ -39495,29 +40009,29 @@ var B9 = { exports: {} }; if (!this._qr) throw "QR code is not defined"; const m = this._element, f = this._options; if (!m) throw "Element code is not defined"; - const g = this._qr.getModuleCount(), b = Math.min(f.width, f.height) - 2 * f.margin, x = f.shape === A ? b / Math.sqrt(2) : b, _ = this._roundSize(x / g), E = 7 * _, v = 3 * _, P = this._roundSize((f.width - g * _) / 2), I = this._roundSize((f.height - g * _) / 2); + const g = this._qr.getModuleCount(), b = Math.min(f.width, f.height) - 2 * f.margin, x = f.shape === _ ? b / Math.sqrt(2) : b, E = this._roundSize(x / g), S = 7 * E, v = 3 * E, M = this._roundSize((f.width - g * E) / 2), I = this._roundSize((f.height - g * E) / 2); [[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach(([F, ce, D]) => { - var oe, Z, J, Q, T, X, re, pe, ie, ue, ve, Pe; - const De = P + F * _ * (g - 7), Ce = I + ce * _ * (g - 7); + var oe, Z, J, ee, T, X, re, pe, ie, ue, ve, Pe; + const De = M + F * E * (g - 7), Ce = I + ce * E * (g - 7); let $e = this._dotsClipPath, Me = this._dotsClipPath; - if ((!((oe = f.cornersSquareOptions) === null || oe === void 0) && oe.gradient || !((Z = f.cornersSquareOptions) === null || Z === void 0) && Z.color) && ($e = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), $e.setAttribute("id", `clip-path-corners-square-color-${F}-${ce}-${this._instanceId}`), this._defs.appendChild($e), this._cornersSquareClipPath = this._cornersDotClipPath = Me = $e, this._createColor({ options: (J = f.cornersSquareOptions) === null || J === void 0 ? void 0 : J.gradient, color: (Q = f.cornersSquareOptions) === null || Q === void 0 ? void 0 : Q.color, additionalRotation: D, x: De, y: Ce, height: E, width: E, name: `corners-square-color-${F}-${ce}-${this._instanceId}` })), (T = f.cornersSquareOptions) === null || T === void 0 ? void 0 : T.type) { + if ((!((oe = f.cornersSquareOptions) === null || oe === void 0) && oe.gradient || !((Z = f.cornersSquareOptions) === null || Z === void 0) && Z.color) && ($e = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), $e.setAttribute("id", `clip-path-corners-square-color-${F}-${ce}-${this._instanceId}`), this._defs.appendChild($e), this._cornersSquareClipPath = this._cornersDotClipPath = Me = $e, this._createColor({ options: (J = f.cornersSquareOptions) === null || J === void 0 ? void 0 : J.gradient, color: (ee = f.cornersSquareOptions) === null || ee === void 0 ? void 0 : ee.color, additionalRotation: D, x: De, y: Ce, height: S, width: S, name: `corners-square-color-${F}-${ce}-${this._instanceId}` })), (T = f.cornersSquareOptions) === null || T === void 0 ? void 0 : T.type) { const Ne = new p({ svg: this._element, type: f.cornersSquareOptions.type, window: this._window }); - Ne.draw(De, Ce, E, D), Ne._element && $e && $e.appendChild(Ne._element); + Ne.draw(De, Ce, S, D), Ne._element && $e && $e.appendChild(Ne._element); } else { const Ne = new d({ svg: this._element, type: f.dotsOptions.type, window: this._window }); - for (let Ke = 0; Ke < M.length; Ke++) for (let Le = 0; Le < M[Ke].length; Le++) !((X = M[Ke]) === null || X === void 0) && X[Le] && (Ne.draw(De + Le * _, Ce + Ke * _, _, (qe, ze) => { + for (let Ke = 0; Ke < P.length; Ke++) for (let Le = 0; Le < P[Ke].length; Le++) !((X = P[Ke]) === null || X === void 0) && X[Le] && (Ne.draw(De + Le * E, Ce + Ke * E, E, (qe, ze) => { var _e; - return !!(!((_e = M[Ke + ze]) === null || _e === void 0) && _e[Le + qe]); + return !!(!((_e = P[Ke + ze]) === null || _e === void 0) && _e[Le + qe]); }), Ne._element && $e && $e.appendChild(Ne._element)); } - if ((!((re = f.cornersDotOptions) === null || re === void 0) && re.gradient || !((pe = f.cornersDotOptions) === null || pe === void 0) && pe.color) && (Me = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), Me.setAttribute("id", `clip-path-corners-dot-color-${F}-${ce}-${this._instanceId}`), this._defs.appendChild(Me), this._cornersDotClipPath = Me, this._createColor({ options: (ie = f.cornersDotOptions) === null || ie === void 0 ? void 0 : ie.gradient, color: (ue = f.cornersDotOptions) === null || ue === void 0 ? void 0 : ue.color, additionalRotation: D, x: De + 2 * _, y: Ce + 2 * _, height: v, width: v, name: `corners-dot-color-${F}-${ce}-${this._instanceId}` })), (ve = f.cornersDotOptions) === null || ve === void 0 ? void 0 : ve.type) { + if ((!((re = f.cornersDotOptions) === null || re === void 0) && re.gradient || !((pe = f.cornersDotOptions) === null || pe === void 0) && pe.color) && (Me = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), Me.setAttribute("id", `clip-path-corners-dot-color-${F}-${ce}-${this._instanceId}`), this._defs.appendChild(Me), this._cornersDotClipPath = Me, this._createColor({ options: (ie = f.cornersDotOptions) === null || ie === void 0 ? void 0 : ie.gradient, color: (ue = f.cornersDotOptions) === null || ue === void 0 ? void 0 : ue.color, additionalRotation: D, x: De + 2 * E, y: Ce + 2 * E, height: v, width: v, name: `corners-dot-color-${F}-${ce}-${this._instanceId}` })), (ve = f.cornersDotOptions) === null || ve === void 0 ? void 0 : ve.type) { const Ne = new w({ svg: this._element, type: f.cornersDotOptions.type, window: this._window }); - Ne.draw(De + 2 * _, Ce + 2 * _, v, D), Ne._element && Me && Me.appendChild(Ne._element); + Ne.draw(De + 2 * E, Ce + 2 * E, v, D), Ne._element && Me && Me.appendChild(Ne._element); } else { const Ne = new d({ svg: this._element, type: f.dotsOptions.type, window: this._window }); - for (let Ke = 0; Ke < N.length; Ke++) for (let Le = 0; Le < N[Ke].length; Le++) !((Pe = N[Ke]) === null || Pe === void 0) && Pe[Le] && (Ne.draw(De + Le * _, Ce + Ke * _, _, (qe, ze) => { + for (let Ke = 0; Ke < O.length; Ke++) for (let Le = 0; Le < O[Ke].length; Le++) !((Pe = O[Ke]) === null || Pe === void 0) && Pe[Le] && (Ne.draw(De + Le * E, Ce + Ke * E, E, (qe, ze) => { var _e; - return !!(!((_e = N[Ke + ze]) === null || _e === void 0) && _e[Le + qe]); + return !!(!((_e = O[Ke + ze]) === null || _e === void 0) && _e[Le + qe]); }), Ne._element && Me && Me.appendChild(Ne._element)); } }); @@ -39528,25 +40042,25 @@ var B9 = { exports: {} }; const b = this._options; if (!b.image) return f("Image is not defined"); if (!((g = b.nodeCanvas) === null || g === void 0) && g.loadImage) b.nodeCanvas.loadImage(b.image).then((x) => { - var _, E; + var E, S; if (this._image = x, this._options.imageOptions.saveAsBlob) { - const v = (_ = b.nodeCanvas) === null || _ === void 0 ? void 0 : _.createCanvas(this._image.width, this._image.height); - (E = v == null ? void 0 : v.getContext("2d")) === null || E === void 0 || E.drawImage(x, 0, 0), this._imageUri = v == null ? void 0 : v.toDataURL(); + const v = (E = b.nodeCanvas) === null || E === void 0 ? void 0 : E.createCanvas(this._image.width, this._image.height); + (S = v == null ? void 0 : v.getContext("2d")) === null || S === void 0 || S.drawImage(x, 0, 0), this._imageUri = v == null ? void 0 : v.toDataURL(); } m(); }).catch(f); else { const x = new this._window.Image(); typeof b.imageOptions.crossOrigin == "string" && (x.crossOrigin = b.imageOptions.crossOrigin), this._image = x, x.onload = async () => { - this._options.imageOptions.saveAsBlob && (this._imageUri = await async function(_, E) { + this._options.imageOptions.saveAsBlob && (this._imageUri = await async function(E, S) { return new Promise((v) => { - const P = new E.XMLHttpRequest(); - P.onload = function() { - const I = new E.FileReader(); + const M = new S.XMLHttpRequest(); + M.onload = function() { + const I = new S.FileReader(); I.onloadend = function() { v(I.result); - }, I.readAsDataURL(P.response); - }, P.open("GET", _), P.responseType = "blob", P.send(); + }, I.readAsDataURL(M.response); + }, M.open("GET", E), M.responseType = "blob", M.send(); }); }(b.image || "", this._window)), m(); }, x.src = b.image; @@ -39554,18 +40068,18 @@ var B9 = { exports: {} }; }); } async drawImage({ width: m, height: f, count: g, dotSize: b }) { - const x = this._options, _ = this._roundSize((x.width - g * b) / 2), E = this._roundSize((x.height - g * b) / 2), v = _ + this._roundSize(x.imageOptions.margin + (g * b - m) / 2), P = E + this._roundSize(x.imageOptions.margin + (g * b - f) / 2), I = m - 2 * x.imageOptions.margin, F = f - 2 * x.imageOptions.margin, ce = this._window.document.createElementNS("http://www.w3.org/2000/svg", "image"); - ce.setAttribute("href", this._imageUri || ""), ce.setAttribute("x", String(v)), ce.setAttribute("y", String(P)), ce.setAttribute("width", `${I}px`), ce.setAttribute("height", `${F}px`), this._element.appendChild(ce); + const x = this._options, E = this._roundSize((x.width - g * b) / 2), S = this._roundSize((x.height - g * b) / 2), v = E + this._roundSize(x.imageOptions.margin + (g * b - m) / 2), M = S + this._roundSize(x.imageOptions.margin + (g * b - f) / 2), I = m - 2 * x.imageOptions.margin, F = f - 2 * x.imageOptions.margin, ce = this._window.document.createElementNS("http://www.w3.org/2000/svg", "image"); + ce.setAttribute("href", this._imageUri || ""), ce.setAttribute("x", String(v)), ce.setAttribute("y", String(M)), ce.setAttribute("width", `${I}px`), ce.setAttribute("height", `${F}px`), this._element.appendChild(ce); } - _createColor({ options: m, color: f, additionalRotation: g, x: b, y: x, height: _, width: E, name: v }) { - const P = E > _ ? E : _, I = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"); - if (I.setAttribute("x", String(b)), I.setAttribute("y", String(x)), I.setAttribute("height", String(_)), I.setAttribute("width", String(E)), I.setAttribute("clip-path", `url('#clip-path-${v}')`), m) { + _createColor({ options: m, color: f, additionalRotation: g, x: b, y: x, height: E, width: S, name: v }) { + const M = S > E ? S : E, I = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"); + if (I.setAttribute("x", String(b)), I.setAttribute("y", String(x)), I.setAttribute("height", String(E)), I.setAttribute("width", String(S)), I.setAttribute("clip-path", `url('#clip-path-${v}')`), m) { let F; - if (m.type === "radial") F = this._window.document.createElementNS("http://www.w3.org/2000/svg", "radialGradient"), F.setAttribute("id", v), F.setAttribute("gradientUnits", "userSpaceOnUse"), F.setAttribute("fx", String(b + E / 2)), F.setAttribute("fy", String(x + _ / 2)), F.setAttribute("cx", String(b + E / 2)), F.setAttribute("cy", String(x + _ / 2)), F.setAttribute("r", String(P / 2)); + if (m.type === "radial") F = this._window.document.createElementNS("http://www.w3.org/2000/svg", "radialGradient"), F.setAttribute("id", v), F.setAttribute("gradientUnits", "userSpaceOnUse"), F.setAttribute("fx", String(b + S / 2)), F.setAttribute("fy", String(x + E / 2)), F.setAttribute("cx", String(b + S / 2)), F.setAttribute("cy", String(x + E / 2)), F.setAttribute("r", String(M / 2)); else { const ce = ((m.rotation || 0) + g) % (2 * Math.PI), D = (ce + 2 * Math.PI) % (2 * Math.PI); - let oe = b + E / 2, Z = x + _ / 2, J = b + E / 2, Q = x + _ / 2; - D >= 0 && D <= 0.25 * Math.PI || D > 1.75 * Math.PI && D <= 2 * Math.PI ? (oe -= E / 2, Z -= _ / 2 * Math.tan(ce), J += E / 2, Q += _ / 2 * Math.tan(ce)) : D > 0.25 * Math.PI && D <= 0.75 * Math.PI ? (Z -= _ / 2, oe -= E / 2 / Math.tan(ce), Q += _ / 2, J += E / 2 / Math.tan(ce)) : D > 0.75 * Math.PI && D <= 1.25 * Math.PI ? (oe += E / 2, Z += _ / 2 * Math.tan(ce), J -= E / 2, Q -= _ / 2 * Math.tan(ce)) : D > 1.25 * Math.PI && D <= 1.75 * Math.PI && (Z += _ / 2, oe += E / 2 / Math.tan(ce), Q -= _ / 2, J -= E / 2 / Math.tan(ce)), F = this._window.document.createElementNS("http://www.w3.org/2000/svg", "linearGradient"), F.setAttribute("id", v), F.setAttribute("gradientUnits", "userSpaceOnUse"), F.setAttribute("x1", String(Math.round(oe))), F.setAttribute("y1", String(Math.round(Z))), F.setAttribute("x2", String(Math.round(J))), F.setAttribute("y2", String(Math.round(Q))); + let oe = b + S / 2, Z = x + E / 2, J = b + S / 2, ee = x + E / 2; + D >= 0 && D <= 0.25 * Math.PI || D > 1.75 * Math.PI && D <= 2 * Math.PI ? (oe -= S / 2, Z -= E / 2 * Math.tan(ce), J += S / 2, ee += E / 2 * Math.tan(ce)) : D > 0.25 * Math.PI && D <= 0.75 * Math.PI ? (Z -= E / 2, oe -= S / 2 / Math.tan(ce), ee += E / 2, J += S / 2 / Math.tan(ce)) : D > 0.75 * Math.PI && D <= 1.25 * Math.PI ? (oe += S / 2, Z += E / 2 * Math.tan(ce), J -= S / 2, ee -= E / 2 * Math.tan(ce)) : D > 1.25 * Math.PI && D <= 1.75 * Math.PI && (Z += E / 2, oe += S / 2 / Math.tan(ce), ee -= E / 2, J -= S / 2 / Math.tan(ce)), F = this._window.document.createElementNS("http://www.w3.org/2000/svg", "linearGradient"), F.setAttribute("id", v), F.setAttribute("gradientUnits", "userSpaceOnUse"), F.setAttribute("x1", String(Math.round(oe))), F.setAttribute("y1", String(Math.round(Z))), F.setAttribute("x2", String(Math.round(J))), F.setAttribute("y2", String(Math.round(ee))); } m.colorStops.forEach(({ offset: ce, color: D }) => { const oe = this._window.document.createElementNS("http://www.w3.org/2000/svg", "stop"); @@ -39576,29 +40090,29 @@ var B9 = { exports: {} }; } } L.instanceCount = 0; - const B = L, $ = "canvas", H = {}; - for (let S = 0; S <= 40; S++) H[S] = S; - const U = { type: $, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: H[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: !0, hideBackgroundDots: !0, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: !0 }, backgroundOptions: { round: 0, color: "#fff" } }; - function V(S) { - const m = Object.assign({}, S); + const B = L, k = "canvas", q = {}; + for (let A = 0; A <= 40; A++) q[A] = A; + const U = { type: k, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: q[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: !0, hideBackgroundDots: !0, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: !0 }, backgroundOptions: { round: 0, color: "#fff" } }; + function V(A) { + const m = Object.assign({}, A); if (!m.colorStops || !m.colorStops.length) throw "Field 'colorStops' is required in gradient"; return m.rotation ? m.rotation = Number(m.rotation) : m.rotation = 0, m.colorStops = m.colorStops.map((f) => Object.assign(Object.assign({}, f), { offset: Number(f.offset) })), m; } - function te(S) { - const m = Object.assign({}, S); + function Q(A) { + const m = Object.assign({}, A); return m.width = Number(m.width), m.height = Number(m.height), m.margin = Number(m.margin), m.imageOptions = Object.assign(Object.assign({}, m.imageOptions), { hideBackgroundDots: !!m.imageOptions.hideBackgroundDots, imageSize: Number(m.imageOptions.imageSize), margin: Number(m.imageOptions.margin) }), m.margin > Math.min(m.width, m.height) && (m.margin = Math.min(m.width, m.height)), m.dotsOptions = Object.assign({}, m.dotsOptions), m.dotsOptions.gradient && (m.dotsOptions.gradient = V(m.dotsOptions.gradient)), m.cornersSquareOptions && (m.cornersSquareOptions = Object.assign({}, m.cornersSquareOptions), m.cornersSquareOptions.gradient && (m.cornersSquareOptions.gradient = V(m.cornersSquareOptions.gradient))), m.cornersDotOptions && (m.cornersDotOptions = Object.assign({}, m.cornersDotOptions), m.cornersDotOptions.gradient && (m.cornersDotOptions.gradient = V(m.cornersDotOptions.gradient))), m.backgroundOptions && (m.backgroundOptions = Object.assign({}, m.backgroundOptions), m.backgroundOptions.gradient && (m.backgroundOptions.gradient = V(m.backgroundOptions.gradient))), m; } var R = i(873), K = i.n(R); - function ge(S) { - if (!S) throw new Error("Extension must be defined"); - S[0] === "." && (S = S.substring(1)); - const m = { bmp: "image/bmp", gif: "image/gif", ico: "image/vnd.microsoft.icon", jpeg: "image/jpeg", jpg: "image/jpeg", png: "image/png", svg: "image/svg+xml", tif: "image/tiff", tiff: "image/tiff", webp: "image/webp", pdf: "application/pdf" }[S.toLowerCase()]; - if (!m) throw new Error(`Extension "${S}" is not supported`); + function ge(A) { + if (!A) throw new Error("Extension must be defined"); + A[0] === "." && (A = A.substring(1)); + const m = { bmp: "image/bmp", gif: "image/gif", ico: "image/vnd.microsoft.icon", jpeg: "image/jpeg", jpg: "image/jpeg", png: "image/png", svg: "image/svg+xml", tif: "image/tiff", tiff: "image/tiff", webp: "image/webp", pdf: "application/pdf" }[A.toLowerCase()]; + if (!m) throw new Error(`Extension "${A}" is not supported`); return m; } class Ee { constructor(m) { - m != null && m.jsdom ? this._window = new m.jsdom("", { resources: "usable" }).window : this._window = window, this._options = m ? te(a(U, m)) : U, this.update(); + m != null && m.jsdom ? this._window = new m.jsdom("", { resources: "usable" }).window : this._window = window, this._options = m ? Q(a(U, m)) : U, this.update(); } static _clearContainer(m) { m && (m.innerHTML = ""); @@ -39616,18 +40130,18 @@ var B9 = { exports: {} }; this._qr && (!((m = this._options.nodeCanvas) === null || m === void 0) && m.createCanvas ? (this._nodeCanvas = this._options.nodeCanvas.createCanvas(this._options.width, this._options.height), this._nodeCanvas.width = this._options.width, this._nodeCanvas.height = this._options.height) : (this._domCanvas = document.createElement("canvas"), this._domCanvas.width = this._options.width, this._domCanvas.height = this._options.height), this._setupSvg(), this._canvasDrawingPromise = (f = this._svgDrawingPromise) === null || f === void 0 ? void 0 : f.then(() => { var g; if (!this._svg) return; - const b = this._svg, x = new this._window.XMLSerializer().serializeToString(b), _ = btoa(x), E = `data:${ge("svg")};base64,${_}`; - if (!((g = this._options.nodeCanvas) === null || g === void 0) && g.loadImage) return this._options.nodeCanvas.loadImage(E).then((v) => { - var P, I; - v.width = this._options.width, v.height = this._options.height, (I = (P = this._nodeCanvas) === null || P === void 0 ? void 0 : P.getContext("2d")) === null || I === void 0 || I.drawImage(v, 0, 0); + const b = this._svg, x = new this._window.XMLSerializer().serializeToString(b), E = btoa(x), S = `data:${ge("svg")};base64,${E}`; + if (!((g = this._options.nodeCanvas) === null || g === void 0) && g.loadImage) return this._options.nodeCanvas.loadImage(S).then((v) => { + var M, I; + v.width = this._options.width, v.height = this._options.height, (I = (M = this._nodeCanvas) === null || M === void 0 ? void 0 : M.getContext("2d")) === null || I === void 0 || I.drawImage(v, 0, 0); }); { const v = new this._window.Image(); - return new Promise((P) => { + return new Promise((M) => { v.onload = () => { var I, F; - (F = (I = this._domCanvas) === null || I === void 0 ? void 0 : I.getContext("2d")) === null || F === void 0 || F.drawImage(v, 0, 0), P(); - }, v.src = E; + (F = (I = this._domCanvas) === null || I === void 0 ? void 0 : I.getContext("2d")) === null || F === void 0 || F.drawImage(v, 0, 0), M(); + }, v.src = S; }); } })); @@ -39637,7 +40151,7 @@ var B9 = { exports: {} }; return m.toLowerCase() === "svg" ? (this._svg && this._svgDrawingPromise || this._setupSvg(), await this._svgDrawingPromise, this._svg) : ((this._domCanvas || this._nodeCanvas) && this._canvasDrawingPromise || this._setupCanvas(), await this._canvasDrawingPromise, this._domCanvas || this._nodeCanvas); } update(m) { - Ee._clearContainer(this._container), this._options = m ? te(a(this._options, m)) : this._options, this._options.data && (this._qr = K()(this._options.qrOptions.typeNumber, this._options.qrOptions.errorCorrectionLevel), this._qr.addData(this._options.data, this._options.qrOptions.mode || function(f) { + Ee._clearContainer(this._container), this._options = m ? Q(a(this._options, m)) : this._options, this._options.data && (this._qr = K()(this._options.qrOptions.typeNumber, this._options.qrOptions.errorCorrectionLevel), this._qr.addData(this._options.data, this._options.qrOptions.mode || function(f) { switch (!0) { case /^[0-9]*$/.test(f): return "Numeric"; @@ -39646,12 +40160,12 @@ var B9 = { exports: {} }; default: return "Byte"; } - }(this._options.data)), this._qr.make(), this._options.type === $ ? this._setupCanvas() : this._setupSvg(), this.append(this._container)); + }(this._options.data)), this._qr.make(), this._options.type === k ? this._setupCanvas() : this._setupSvg(), this.append(this._container)); } append(m) { if (m) { if (typeof m.appendChild != "function") throw "Container should be a single DOM node"; - this._options.type === $ ? this._domCanvas && m.appendChild(this._domCanvas) : this._svg && m.appendChild(this._svg), this._container = m; + this._options.type === k ? this._domCanvas && m.appendChild(this._domCanvas) : this._svg && m.appendChild(this._svg), this._container = m; } } applyExtension(m) { @@ -39697,10 +40211,10 @@ ${new this._window.XMLSerializer().serializeToString(f)}`; const Y = Ee; })(), s.default; })()); -})(B9); -var Kne = B9.exports; -const F9 = /* @__PURE__ */ ts(Kne); -class sa extends yt { +})(hA); +var Aie = hA.exports; +const dA = /* @__PURE__ */ ns(Aie); +class aa extends gt { constructor(e) { const { docsPath: r, field: n, metaMessages: i } = e; super(`Invalid Sign-In with Ethereum message field "${n}".`, { @@ -39710,10 +40224,10 @@ class sa extends yt { }); } } -function l5(t) { +function M5(t) { if (/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t) || /%[^0-9a-f]/i.test(t) || /%[0-9a-f](:?[^0-9a-f]|$)/i.test(t)) return !1; - const e = Vne(t), r = e[1], n = e[2], i = e[3], s = e[4], o = e[5]; + const e = Pie(t), r = e[1], n = e[2], i = e[3], s = e[4], o = e[5]; if (!(r != null && r.length && i.length >= 0)) return !1; if (n != null && n.length) { @@ -39726,14 +40240,14 @@ function l5(t) { let a = ""; return a += `${r}:`, n != null && n.length && (a += `//${n}`), a += i, s != null && s.length && (a += `?${s}`), o != null && o.length && (a += `#${o}`), a; } -function Vne(t) { +function Pie(t) { return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/); } -function j9(t) { +function pA(t) { const { chainId: e, domain: r, expirationTime: n, issuedAt: i = /* @__PURE__ */ new Date(), nonce: s, notBefore: o, requestId: a, resources: u, scheme: l, uri: d, version: p } = t; { if (e !== Math.floor(e)) - throw new sa({ + throw new aa({ field: "chainId", metaMessages: [ "- Chain ID must be a EIP-155 chain ID.", @@ -39742,8 +40256,8 @@ function j9(t) { `Provided value: ${e}` ] }); - if (!(Gne.test(r) || Yne.test(r) || Jne.test(r))) - throw new sa({ + if (!(Mie.test(r) || Iie.test(r) || Cie.test(r))) + throw new aa({ field: "domain", metaMessages: [ "- Domain must be an RFC 3986 authority.", @@ -39752,8 +40266,8 @@ function j9(t) { `Provided value: ${r}` ] }); - if (!Xne.test(s)) - throw new sa({ + if (!Tie.test(s)) + throw new aa({ field: "nonce", metaMessages: [ "- Nonce must be at least 8 characters.", @@ -39762,8 +40276,8 @@ function j9(t) { `Provided value: ${s}` ] }); - if (!l5(d)) - throw new sa({ + if (!M5(d)) + throw new aa({ field: "uri", metaMessages: [ "- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.", @@ -39773,7 +40287,7 @@ function j9(t) { ] }); if (p !== "1") - throw new sa({ + throw new aa({ field: "version", metaMessages: [ "- Version must be '1'.", @@ -39781,8 +40295,8 @@ function j9(t) { `Provided value: ${p}` ] }); - if (l && !Zne.test(l)) - throw new sa({ + if (l && !Rie.test(l)) + throw new aa({ field: "scheme", metaMessages: [ "- Scheme must be an RFC 3986 URI scheme.", @@ -39794,7 +40308,7 @@ function j9(t) { const B = t.statement; if (B != null && B.includes(` `)) - throw new sa({ + throw new aa({ field: "statement", metaMessages: [ "- Statement must not include '\\n'.", @@ -39803,11 +40317,11 @@ function j9(t) { ] }); } - const w = Sv(t.address), A = l ? `${l}://${r}` : r, M = t.statement ? `${t.statement} -` : "", N = `${A} wants you to sign in with your Ethereum account: + const w = Fv(t.address), _ = l ? `${l}://${r}` : r, P = t.statement ? `${t.statement} +` : "", O = `${_} wants you to sign in with your Ethereum account: ${w} -${M}`; +${P}`; let L = `URI: ${d} Version: ${p} Chain ID: ${e} @@ -39819,34 +40333,34 @@ Not Before: ${o.toISOString()}`), a && (L += ` Request ID: ${a}`), u) { let B = ` Resources:`; - for (const $ of u) { - if (!l5($)) - throw new sa({ + for (const k of u) { + if (!M5(k)) + throw new aa({ field: "resources", metaMessages: [ "- Every resource must be a RFC 3986 URI.", "- See https://www.rfc-editor.org/rfc/rfc3986", "", - `Provided value: ${$}` + `Provided value: ${k}` ] }); B += ` -- ${$}`; +- ${k}`; } L += B; } - return `${N} + return `${O} ${L}`; } -const Gne = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/, Yne = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/, Jne = /^localhost(:[0-9]{1,5})?$/, Xne = /^[a-zA-Z0-9]{8,}$/, Zne = /^([a-zA-Z][a-zA-Z0-9+-.]*)$/, U9 = "7a4434fefbcc9af474fb5c995e47d286", Qne = { - projectId: U9, +const Mie = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/, Iie = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/, Cie = /^localhost(:[0-9]{1,5})?$/, Tie = /^[a-zA-Z0-9]{8,}$/, Rie = /^([a-zA-Z][a-zA-Z0-9+-.]*)$/, gA = "7a4434fefbcc9af474fb5c995e47d286", Die = { + projectId: gA, metadata: { name: "codatta", description: "codatta", url: "https://codatta.io/", icons: ["https://avatars.githubusercontent.com/u/171659315"] } -}, eie = { +}, Oie = { namespaces: { eip155: { methods: [ @@ -39859,15 +40373,15 @@ const Gne = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0- chains: ["eip155:1"], events: ["chainChanged", "accountsChanged", "disconnect"], rpcMap: { - 1: `https://rpc.walletconnect.com?chainId=eip155:1&projectId=${U9}` + 1: `https://rpc.walletconnect.com?chainId=eip155:1&projectId=${gA}` } } }, skipPairing: !1 }; -function tie(t, e) { +function Nie(t, e) { const r = window.location.host, n = window.location.href; - return j9({ + return pA({ address: t, chainId: 1, domain: r, @@ -39876,13 +40390,13 @@ function tie(t, e) { version: "1" }); } -function q9(t) { +function mA(t) { var ge, Ee, Y; - const e = Zn(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Yt(""), [a, u] = Yt(!1), [l, d] = Yt(""), [p, w] = Yt("scan"), A = Zn(), [M, N] = Yt((ge = r.config) == null ? void 0 : ge.image), [L, B] = Yt(!1), { saveLastUsedWallet: $ } = mp(); - async function H(S) { + const e = Qn(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Yt(""), [a, u] = Yt(!1), [l, d] = Yt(""), [p, w] = Yt("scan"), _ = Qn(), [P, O] = Yt((ge = r.config) == null ? void 0 : ge.image), [L, B] = Yt(!1), { saveLastUsedWallet: k } = Tp(); + async function q(A) { var f, g, b, x; u(!0); - const m = await jG.init(Qne); + const m = await yY.init(Die); m.session && await m.disconnect(); try { if (w("scan"), m.on("display_uri", (ce) => { @@ -39891,27 +40405,27 @@ function q9(t) { console.log(ce); }), m.on("session_update", (ce) => { console.log("session_update", ce); - }), !await m.connect(eie)) throw new Error("Walletconnect init failed"); - const E = new vl(m); - N(((f = E.config) == null ? void 0 : f.image) || ((g = S.config) == null ? void 0 : g.image)); - const v = await E.getAddress(), P = await Ta.getNonce({ account_type: "block_chain" }); - console.log("get nonce", P); - const I = tie(v, P); + }), !await m.connect(Oie)) throw new Error("Walletconnect init failed"); + const S = new Il(m); + O(((f = S.config) == null ? void 0 : f.image) || ((g = A.config) == null ? void 0 : g.image)); + const v = await S.getAddress(), M = await ka.getNonce({ account_type: "block_chain" }); + console.log("get nonce", M); + const I = Nie(v, M); w("sign"); - const F = await E.signMessage(I, v); - w("waiting"), await i(E, { + const F = await S.signMessage(I, v); + w("waiting"), await i(S, { message: I, - nonce: P, + nonce: M, signature: F, address: v, - wallet_name: ((b = E.config) == null ? void 0 : b.name) || ((x = S.config) == null ? void 0 : x.name) || "" - }), $(E); - } catch (_) { - console.log("err", _), d(_.details || _.message); + wallet_name: ((b = S.config) == null ? void 0 : b.name) || ((x = A.config) == null ? void 0 : x.name) || "" + }), k(S); + } catch (E) { + console.log("err", E), d(E.details || E.message); } } function U() { - A.current = new F9({ + _.current = new dA({ width: 264, height: 264, margin: 0, @@ -39927,23 +40441,23 @@ function q9(t) { backgroundOptions: { color: "transparent" } - }), A.current.append(e.current); + }), _.current.append(e.current); } - function V(S) { + function V(A) { var m; - console.log(A.current), (m = A.current) == null || m.update({ - data: S + console.log(_.current), (m = _.current) == null || m.update({ + data: A }); } Dn(() => { s && V(s); }, [s]), Dn(() => { - H(r); + q(r); }, [r]), Dn(() => { U(); }, []); - function te() { - d(""), V(""), H(r); + function Q() { + d(""), V(""), q(r); } function R() { B(!0), navigator.clipboard.writeText(s), setTimeout(() => { @@ -39952,15 +40466,15 @@ function q9(t) { } function K() { var f; - const S = (f = r.config) == null ? void 0 : f.desktop_link; - if (!S) return; - const m = `${S}?uri=${encodeURIComponent(s)}`; + const A = (f = r.config) == null ? void 0 : f.desktop_link; + if (!A) return; + const m = `${A}?uri=${encodeURIComponent(s)}`; window.open(m, "_blank"); } return /* @__PURE__ */ le.jsxs("div", { children: [ /* @__PURE__ */ le.jsx("div", { className: "xc-text-center", children: /* @__PURE__ */ le.jsxs("div", { className: "xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1", children: [ /* @__PURE__ */ le.jsx("div", { className: "xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center", ref: e }), - /* @__PURE__ */ le.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: a ? /* @__PURE__ */ le.jsx(mc, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ le.jsx("img", { className: "xc-h-10 xc-w-10", src: M }) }) + /* @__PURE__ */ le.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: a ? /* @__PURE__ */ le.jsx(Sc, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ le.jsx("img", { className: "xc-h-10 xc-w-10", src: P }) }) ] }) }), /* @__PURE__ */ le.jsxs("div", { className: "xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3", children: [ /* @__PURE__ */ le.jsx( @@ -39971,10 +40485,10 @@ function q9(t) { className: "xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent", children: L ? /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ " ", - /* @__PURE__ */ le.jsx(dZ, {}), + /* @__PURE__ */ le.jsx(KZ, {}), " Copied!" ] }) : /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ - /* @__PURE__ */ le.jsx(mZ, {}), + /* @__PURE__ */ le.jsx(YZ, {}), "Copy QR URL" ] }) } @@ -39985,7 +40499,7 @@ function q9(t) { className: "xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black", onClick: n, children: [ - /* @__PURE__ */ le.jsx(pZ, {}), + /* @__PURE__ */ le.jsx(VZ, {}), "Get Extension" ] } @@ -39997,7 +40511,7 @@ function q9(t) { className: "xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black", onClick: K, children: [ - /* @__PURE__ */ le.jsx(HS, {}), + /* @__PURE__ */ le.jsx(y7, {}), "Desktop" ] } @@ -40005,73 +40519,79 @@ function q9(t) { ] }), /* @__PURE__ */ le.jsx("div", { className: "xc-text-center", children: l ? /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ /* @__PURE__ */ le.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: l }), - /* @__PURE__ */ le.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: te, children: "Retry" }) + /* @__PURE__ */ le.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: Q, children: "Retry" }) ] }) : /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ p === "scan" && /* @__PURE__ */ le.jsx("p", { children: "Scan this QR code from your mobile wallet or phone's camera to connect." }), p === "connect" && /* @__PURE__ */ le.jsx("p", { children: "Click connect in your wallet app" }), p === "sign" && /* @__PURE__ */ le.jsx("p", { children: "Click sign-in in your wallet to confirm you own this wallet." }), - p === "waiting" && /* @__PURE__ */ le.jsx("div", { className: "xc-text-center", children: /* @__PURE__ */ le.jsx(mc, { className: "xc-inline-block xc-animate-spin" }) }) + p === "waiting" && /* @__PURE__ */ le.jsx("div", { className: "xc-text-center", children: /* @__PURE__ */ le.jsx(Sc, { className: "xc-inline-block xc-animate-spin" }) }) ] }) }) ] }); } -const rie = "Accept connection request in the wallet", nie = "Accept sign-in request in your wallet"; -function iie(t, e) { - const r = window.location.host, n = window.location.href; - return j9({ +const Lie = "Accept connection request in the wallet", kie = "Accept sign-in request in your wallet"; +function $ie(t, e, r) { + const n = window.location.host, i = window.location.href; + return pA({ address: t, - chainId: 1, - domain: r, + chainId: r, + domain: n, nonce: e, - uri: n, + uri: i, version: "1" }); } -function z9(t) { - var p; - const [e, r] = Yt(), { wallet: n, onSignFinish: i } = t, s = Zn(), [o, a] = Yt("connect"), { saveLastUsedWallet: u } = mp(); - async function l(w) { - var A; +function vA(t) { + var w; + const [e, r] = Yt(), { wallet: n, onSignFinish: i } = t, s = Qn(), [o, a] = Yt("connect"), { saveLastUsedWallet: u, chains: l } = Tp(); + async function d(_) { + var P; try { a("connect"); - const M = await n.connect(); - if (!M || M.length === 0) + const O = await n.connect(); + if (!O || O.length === 0) throw new Error("Wallet connect error"); - const N = Sv(M[0]), L = iie(N, w); + const L = await n.getChain(), B = l.find((Q) => Q.id === L), k = l[0]; + B || (console.log("switch chain", l[0]), a("switch-chain"), await n.switchChain(l[0])); + const q = Fv(O[0]), U = $ie(q, _, k.id); a("sign"); - const B = await n.signMessage(L, N); - if (!B || B.length === 0) + const V = await n.signMessage(U, q); + if (!V || V.length === 0) throw new Error("user sign error"); - a("waiting"), await i(n, { address: N, signature: B, message: L, nonce: w, wallet_name: ((A = n.config) == null ? void 0 : A.name) || "" }), u(n); - } catch (M) { - console.log(M.details), r(M.details || M.message); + a("waiting"), await i(n, { address: q, signature: V, message: U, nonce: _, wallet_name: ((P = n.config) == null ? void 0 : P.name) || "" }), u(n); + } catch (O) { + console.log("walletSignin error", O.stack), console.log(O.details || O.message), r(O.details || O.message); } } - async function d() { + async function p() { try { r(""); - const w = await Ta.getNonce({ account_type: "block_chain" }); - s.current = w, l(s.current); - } catch (w) { - console.log(w.details), r(w.message); + const _ = await ka.getNonce({ account_type: "block_chain" }); + s.current = _, d(s.current); + } catch (_) { + console.log(_.details), r(_.message); } } return Dn(() => { - d(); + p(); }, []), /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4", children: [ - /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-h-16 xc-w-16", src: (p = n.config) == null ? void 0 : p.image, alt: "" }), + /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-h-16 xc-w-16", src: (w = n.config) == null ? void 0 : w.image, alt: "" }), e && /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ /* @__PURE__ */ le.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: e }), - /* @__PURE__ */ le.jsx("div", { className: "xc-flex xc-gap-2", children: /* @__PURE__ */ le.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: d, children: "Retry" }) }) + /* @__PURE__ */ le.jsx("div", { className: "xc-flex xc-gap-2", children: /* @__PURE__ */ le.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: p, children: "Retry" }) }) ] }), !e && /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ - o === "connect" && /* @__PURE__ */ le.jsx("span", { className: "xc-text-center", children: rie }), - o === "sign" && /* @__PURE__ */ le.jsx("span", { className: "xc-text-center", children: nie }), - o === "waiting" && /* @__PURE__ */ le.jsx("span", { className: "xc-text-center", children: /* @__PURE__ */ le.jsx(mc, { className: "xc-animate-spin" }) }) + o === "connect" && /* @__PURE__ */ le.jsx("span", { className: "xc-text-center", children: Lie }), + o === "sign" && /* @__PURE__ */ le.jsx("span", { className: "xc-text-center", children: kie }), + o === "waiting" && /* @__PURE__ */ le.jsx("span", { className: "xc-text-center", children: /* @__PURE__ */ le.jsx(Sc, { className: "xc-animate-spin" }) }), + o === "switch-chain" && /* @__PURE__ */ le.jsxs("span", { className: "xc-text-center", children: [ + "Switch to ", + l[0].name + ] }) ] }) ] }); } -const Gc = "https://static.codatta.io/codatta-connect/wallet-icons.svg", sie = "https://itunes.apple.com/app/", oie = "https://play.google.com/store/apps/details?id=", aie = "https://chromewebstore.google.com/detail/", cie = "https://chromewebstore.google.com/detail/", uie = "https://addons.mozilla.org/en-US/firefox/addon/", fie = "https://microsoftedge.microsoft.com/addons/detail/"; -function Yc(t) { +const iu = "https://static.codatta.io/codatta-connect/wallet-icons.svg", Bie = "https://itunes.apple.com/app/", Fie = "https://play.google.com/store/apps/details?id=", jie = "https://chromewebstore.google.com/detail/", Uie = "https://chromewebstore.google.com/detail/", qie = "https://addons.mozilla.org/en-US/firefox/addon/", zie = "https://microsoftedge.microsoft.com/addons/detail/"; +function su(t) { const { icon: e, title: r, link: n } = t; return /* @__PURE__ */ le.jsxs( "a", @@ -40082,12 +40602,12 @@ function Yc(t) { children: [ /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-1 xc-h-6 xc-w-6", src: e, alt: "" }), r, - /* @__PURE__ */ le.jsx(WS, { className: "xc-ml-auto xc-text-gray-400" }) + /* @__PURE__ */ le.jsx(b7, { className: "xc-ml-auto xc-text-gray-400" }) ] } ); } -function lie(t) { +function Wie(t) { const e = { appStoreLink: "", playStoreLink: "", @@ -40096,11 +40616,11 @@ function lie(t) { firefoxStoreLink: "", edgeStoreLink: "" }; - return t != null && t.app_store_id && (e.appStoreLink = `${sie}${t.app_store_id}`), t != null && t.play_store_id && (e.playStoreLink = `${oie}${t.play_store_id}`), t != null && t.chrome_store_id && (e.chromeStoreLink = `${aie}${t.chrome_store_id}`), t != null && t.brave_store_id && (e.braveStoreLink = `${cie}${t.brave_store_id}`), t != null && t.firefox_addon_id && (e.firefoxStoreLink = `${uie}${t.firefox_addon_id}`), t != null && t.edge_addon_id && (e.edgeStoreLink = `${fie}${t.edge_addon_id}`), e; + return t != null && t.app_store_id && (e.appStoreLink = `${Bie}${t.app_store_id}`), t != null && t.play_store_id && (e.playStoreLink = `${Fie}${t.play_store_id}`), t != null && t.chrome_store_id && (e.chromeStoreLink = `${jie}${t.chrome_store_id}`), t != null && t.brave_store_id && (e.braveStoreLink = `${Uie}${t.brave_store_id}`), t != null && t.firefox_addon_id && (e.firefoxStoreLink = `${qie}${t.firefox_addon_id}`), t != null && t.edge_addon_id && (e.edgeStoreLink = `${zie}${t.edge_addon_id}`), e; } -function W9(t) { +function bA(t) { var i, s, o; - const { wallet: e } = t, r = (i = e.config) == null ? void 0 : i.getWallet, n = lie(r); + const { wallet: e } = t, r = (i = e.config) == null ? void 0 : i.getWallet, n = Wie(r); return /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-mb-2 xc-h-12 xc-w-12", src: (s = e.config) == null ? void 0 : s.image, alt: "" }), /* @__PURE__ */ le.jsxs("p", { className: "xc-text-lg xc-font-bold", children: [ @@ -40111,61 +40631,61 @@ function W9(t) { /* @__PURE__ */ le.jsx("p", { className: "xc-mb-6 xc-text-sm xc-text-gray-500", children: "Select from your preferred options below:" }), /* @__PURE__ */ le.jsxs("div", { className: "xc-grid xc-w-full xc-grid-cols-1 xc-gap-3", children: [ (r == null ? void 0 : r.chrome_store_id) && /* @__PURE__ */ le.jsx( - Yc, + su, { link: n.chromeStoreLink, - icon: `${Gc}#chrome`, + icon: `${iu}#chrome`, title: "Google Play Store" } ), (r == null ? void 0 : r.app_store_id) && /* @__PURE__ */ le.jsx( - Yc, + su, { link: n.appStoreLink, - icon: `${Gc}#apple-dark`, + icon: `${iu}#apple-dark`, title: "Apple App Store" } ), (r == null ? void 0 : r.play_store_id) && /* @__PURE__ */ le.jsx( - Yc, + su, { link: n.playStoreLink, - icon: `${Gc}#android`, + icon: `${iu}#android`, title: "Google Play Store" } ), (r == null ? void 0 : r.edge_addon_id) && /* @__PURE__ */ le.jsx( - Yc, + su, { link: n.edgeStoreLink, - icon: `${Gc}#edge`, + icon: `${iu}#edge`, title: "Microsoft Edge" } ), (r == null ? void 0 : r.brave_store_id) && /* @__PURE__ */ le.jsx( - Yc, + su, { link: n.braveStoreLink, - icon: `${Gc}#brave`, + icon: `${iu}#brave`, title: "Brave extension" } ), (r == null ? void 0 : r.firefox_addon_id) && /* @__PURE__ */ le.jsx( - Yc, + su, { link: n.firefoxStoreLink, - icon: `${Gc}#firefox`, + icon: `${iu}#firefox`, title: "Mozilla Firefox" } ) ] }) ] }); } -function hie(t) { - const { wallet: e } = t, [r, n] = Yt(e.installed ? "connect" : "qr"), i = uy(); +function Hie(t) { + const { wallet: e } = t, [r, n] = Yt(e.installed ? "connect" : "qr"), i = Ey(); async function s(o, a) { var l; - const u = await Ta.walletLogin({ + const u = await ka.walletLogin({ account_type: "block_chain", account_enum: i.role, connector: "codatta_wallet", @@ -40184,10 +40704,10 @@ function hie(t) { }); await t.onLogin(u.data); } - return /* @__PURE__ */ le.jsxs(Ms, { children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), + return /* @__PURE__ */ le.jsxs(Rs, { children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(kc, { title: "Connect wallet", onBack: t.onBack }) }), r === "qr" && /* @__PURE__ */ le.jsx( - q9, + mA, { wallet: e, onGetExtension: () => n("get-extension"), @@ -40195,21 +40715,21 @@ function hie(t) { } ), r === "connect" && /* @__PURE__ */ le.jsx( - z9, + vA, { onShowQrCode: () => n("qr"), wallet: e, onSignFinish: s } ), - r === "get-extension" && /* @__PURE__ */ le.jsx(W9, { wallet: e }) + r === "get-extension" && /* @__PURE__ */ le.jsx(bA, { wallet: e }) ] }); } -function die(t) { +function Kie(t) { const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: e.imageUrl }), i = e.name || ""; - return /* @__PURE__ */ le.jsx(ay, { icon: n, title: i, onClick: () => r(e) }); + return /* @__PURE__ */ le.jsx(xy, { icon: n, title: i, onClick: () => r(e) }); } -function H9(t) { +function yA(t) { const { connector: e } = t, [r, n] = Yt(), [i, s] = Yt([]), o = wi(() => r ? i.filter((d) => d.name.toLowerCase().includes(r.toLowerCase())) : i, [r, i]); function a(d) { n(d.target.value); @@ -40224,16 +40744,16 @@ function H9(t) { function l(d) { t.onSelect(d); } - return /* @__PURE__ */ le.jsxs(Ms, { children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(Pc, { title: "Select wallet", onBack: t.onBack }) }), + return /* @__PURE__ */ le.jsxs(Rs, { children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(kc, { title: "Select wallet", onBack: t.onBack }) }), /* @__PURE__ */ le.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ - /* @__PURE__ */ le.jsx(KS, { className: "xc-shrink-0 xc-opacity-50" }), + /* @__PURE__ */ le.jsx(w7, { className: "xc-shrink-0 xc-opacity-50" }), /* @__PURE__ */ le.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: a }) ] }), - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: o == null ? void 0 : o.map((d) => /* @__PURE__ */ le.jsx(die, { wallet: d, onClick: l }, d.name)) }) + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: o == null ? void 0 : o.map((d) => /* @__PURE__ */ le.jsx(Kie, { wallet: d, onClick: l }, d.name)) }) ] }); } -var K9 = { exports: {} }; +var wA = { exports: {} }; (function(t) { (function(e, r) { t.exports ? t.exports = r() : (e.nacl || (e.nacl = {}), e.nacl.util = r()); @@ -40271,246 +40791,246 @@ var K9 = { exports: {} }; return o; }), e; }); -})(K9); -var pie = K9.exports; -const Dl = /* @__PURE__ */ ts(pie); -var V9 = { exports: {} }; +})(wA); +var Vie = wA.exports; +const zl = /* @__PURE__ */ ns(Vie); +var xA = { exports: {} }; (function(t) { (function(e) { - var r = function(k) { - var q, W = new Float64Array(16); - if (k) for (q = 0; q < k.length; q++) W[q] = k[q]; - return W; + var r = function($) { + var z, H = new Float64Array(16); + if ($) for (z = 0; z < $.length; z++) H[z] = $[z]; + return H; }, n = function() { throw new Error("no PRNG"); }, i = new Uint8Array(16), s = new Uint8Array(32); s[0] = 9; - var o = r(), a = r([1]), u = r([56129, 1]), l = r([30883, 4953, 19914, 30187, 55467, 16705, 2637, 112, 59544, 30585, 16505, 36039, 65139, 11119, 27886, 20995]), d = r([61785, 9906, 39828, 60374, 45398, 33411, 5274, 224, 53552, 61171, 33010, 6542, 64743, 22239, 55772, 9222]), p = r([54554, 36645, 11616, 51542, 42930, 38181, 51040, 26924, 56412, 64982, 57905, 49316, 21502, 52590, 14035, 8553]), w = r([26200, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214]), A = r([41136, 18958, 6951, 50414, 58488, 44335, 6150, 12099, 55207, 15867, 153, 11085, 57099, 20417, 9344, 11139]); - function M(k, q, W, C) { - k[q] = W >> 24 & 255, k[q + 1] = W >> 16 & 255, k[q + 2] = W >> 8 & 255, k[q + 3] = W & 255, k[q + 4] = C >> 24 & 255, k[q + 5] = C >> 16 & 255, k[q + 6] = C >> 8 & 255, k[q + 7] = C & 255; + var o = r(), a = r([1]), u = r([56129, 1]), l = r([30883, 4953, 19914, 30187, 55467, 16705, 2637, 112, 59544, 30585, 16505, 36039, 65139, 11119, 27886, 20995]), d = r([61785, 9906, 39828, 60374, 45398, 33411, 5274, 224, 53552, 61171, 33010, 6542, 64743, 22239, 55772, 9222]), p = r([54554, 36645, 11616, 51542, 42930, 38181, 51040, 26924, 56412, 64982, 57905, 49316, 21502, 52590, 14035, 8553]), w = r([26200, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214]), _ = r([41136, 18958, 6951, 50414, 58488, 44335, 6150, 12099, 55207, 15867, 153, 11085, 57099, 20417, 9344, 11139]); + function P($, z, H, C) { + $[z] = H >> 24 & 255, $[z + 1] = H >> 16 & 255, $[z + 2] = H >> 8 & 255, $[z + 3] = H & 255, $[z + 4] = C >> 24 & 255, $[z + 5] = C >> 16 & 255, $[z + 6] = C >> 8 & 255, $[z + 7] = C & 255; } - function N(k, q, W, C, G) { + function O($, z, H, C, G) { var j, se = 0; - for (j = 0; j < G; j++) se |= k[q + j] ^ W[C + j]; + for (j = 0; j < G; j++) se |= $[z + j] ^ H[C + j]; return (1 & se - 1 >>> 8) - 1; } - function L(k, q, W, C) { - return N(k, q, W, C, 16); + function L($, z, H, C) { + return O($, z, H, C, 16); } - function B(k, q, W, C) { - return N(k, q, W, C, 32); + function B($, z, H, C) { + return O($, z, H, C, 32); } - function $(k, q, W, C) { - for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = W[0] & 255 | (W[1] & 255) << 8 | (W[2] & 255) << 16 | (W[3] & 255) << 24, se = W[4] & 255 | (W[5] & 255) << 8 | (W[6] & 255) << 16 | (W[7] & 255) << 24, de = W[8] & 255 | (W[9] & 255) << 8 | (W[10] & 255) << 16 | (W[11] & 255) << 24, xe = W[12] & 255 | (W[13] & 255) << 8 | (W[14] & 255) << 16 | (W[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = q[0] & 255 | (q[1] & 255) << 8 | (q[2] & 255) << 16 | (q[3] & 255) << 24, nt = q[4] & 255 | (q[5] & 255) << 8 | (q[6] & 255) << 16 | (q[7] & 255) << 24, je = q[8] & 255 | (q[9] & 255) << 8 | (q[10] & 255) << 16 | (q[11] & 255) << 24, pt = q[12] & 255 | (q[13] & 255) << 8 | (q[14] & 255) << 16 | (q[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = W[16] & 255 | (W[17] & 255) << 8 | (W[18] & 255) << 16 | (W[19] & 255) << 24, St = W[20] & 255 | (W[21] & 255) << 8 | (W[22] & 255) << 16 | (W[23] & 255) << 24, Tt = W[24] & 255 | (W[25] & 255) << 8 | (W[26] & 255) << 16 | (W[27] & 255) << 24, At = W[28] & 255 | (W[29] & 255) << 8 | (W[30] & 255) << 16 | (W[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = de, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, he, rr = 0; rr < 20; rr += 2) - he = ht + Lt | 0, ut ^= he << 7 | he >>> 25, he = ut + ht | 0, Ve ^= he << 9 | he >>> 23, he = Ve + ut | 0, Lt ^= he << 13 | he >>> 19, he = Lt + Ve | 0, ht ^= he << 18 | he >>> 14, he = ot + xt | 0, Fe ^= he << 7 | he >>> 25, he = Fe + ot | 0, zt ^= he << 9 | he >>> 23, he = zt + Fe | 0, xt ^= he << 13 | he >>> 19, he = xt + zt | 0, ot ^= he << 18 | he >>> 14, he = Ue + Se | 0, Zt ^= he << 7 | he >>> 25, he = Zt + Ue | 0, st ^= he << 9 | he >>> 23, he = st + Zt | 0, Se ^= he << 13 | he >>> 19, he = Se + st | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Je | 0, bt ^= he << 7 | he >>> 25, he = bt + Wt | 0, Ae ^= he << 9 | he >>> 23, he = Ae + bt | 0, Je ^= he << 13 | he >>> 19, he = Je + Ae | 0, Wt ^= he << 18 | he >>> 14, he = ht + bt | 0, xt ^= he << 7 | he >>> 25, he = xt + ht | 0, st ^= he << 9 | he >>> 23, he = st + xt | 0, bt ^= he << 13 | he >>> 19, he = bt + st | 0, ht ^= he << 18 | he >>> 14, he = ot + ut | 0, Se ^= he << 7 | he >>> 25, he = Se + ot | 0, Ae ^= he << 9 | he >>> 23, he = Ae + Se | 0, ut ^= he << 13 | he >>> 19, he = ut + Ae | 0, ot ^= he << 18 | he >>> 14, he = Ue + Fe | 0, Je ^= he << 7 | he >>> 25, he = Je + Ue | 0, Ve ^= he << 9 | he >>> 23, he = Ve + Je | 0, Fe ^= he << 13 | he >>> 19, he = Fe + Ve | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Zt | 0, Lt ^= he << 7 | he >>> 25, he = Lt + Wt | 0, zt ^= he << 9 | he >>> 23, he = zt + Lt | 0, Zt ^= he << 13 | he >>> 19, he = Zt + zt | 0, Wt ^= he << 18 | he >>> 14; - ht = ht + G | 0, xt = xt + j | 0, st = st + se | 0, bt = bt + de | 0, ut = ut + xe | 0, ot = ot + Te | 0, Se = Se + Re | 0, Ae = Ae + nt | 0, Ve = Ve + je | 0, Fe = Fe + pt | 0, Ue = Ue + it | 0, Je = Je + et | 0, Lt = Lt + St | 0, zt = zt + Tt | 0, Zt = Zt + At | 0, Wt = Wt + _t | 0, k[0] = ht >>> 0 & 255, k[1] = ht >>> 8 & 255, k[2] = ht >>> 16 & 255, k[3] = ht >>> 24 & 255, k[4] = xt >>> 0 & 255, k[5] = xt >>> 8 & 255, k[6] = xt >>> 16 & 255, k[7] = xt >>> 24 & 255, k[8] = st >>> 0 & 255, k[9] = st >>> 8 & 255, k[10] = st >>> 16 & 255, k[11] = st >>> 24 & 255, k[12] = bt >>> 0 & 255, k[13] = bt >>> 8 & 255, k[14] = bt >>> 16 & 255, k[15] = bt >>> 24 & 255, k[16] = ut >>> 0 & 255, k[17] = ut >>> 8 & 255, k[18] = ut >>> 16 & 255, k[19] = ut >>> 24 & 255, k[20] = ot >>> 0 & 255, k[21] = ot >>> 8 & 255, k[22] = ot >>> 16 & 255, k[23] = ot >>> 24 & 255, k[24] = Se >>> 0 & 255, k[25] = Se >>> 8 & 255, k[26] = Se >>> 16 & 255, k[27] = Se >>> 24 & 255, k[28] = Ae >>> 0 & 255, k[29] = Ae >>> 8 & 255, k[30] = Ae >>> 16 & 255, k[31] = Ae >>> 24 & 255, k[32] = Ve >>> 0 & 255, k[33] = Ve >>> 8 & 255, k[34] = Ve >>> 16 & 255, k[35] = Ve >>> 24 & 255, k[36] = Fe >>> 0 & 255, k[37] = Fe >>> 8 & 255, k[38] = Fe >>> 16 & 255, k[39] = Fe >>> 24 & 255, k[40] = Ue >>> 0 & 255, k[41] = Ue >>> 8 & 255, k[42] = Ue >>> 16 & 255, k[43] = Ue >>> 24 & 255, k[44] = Je >>> 0 & 255, k[45] = Je >>> 8 & 255, k[46] = Je >>> 16 & 255, k[47] = Je >>> 24 & 255, k[48] = Lt >>> 0 & 255, k[49] = Lt >>> 8 & 255, k[50] = Lt >>> 16 & 255, k[51] = Lt >>> 24 & 255, k[52] = zt >>> 0 & 255, k[53] = zt >>> 8 & 255, k[54] = zt >>> 16 & 255, k[55] = zt >>> 24 & 255, k[56] = Zt >>> 0 & 255, k[57] = Zt >>> 8 & 255, k[58] = Zt >>> 16 & 255, k[59] = Zt >>> 24 & 255, k[60] = Wt >>> 0 & 255, k[61] = Wt >>> 8 & 255, k[62] = Wt >>> 16 & 255, k[63] = Wt >>> 24 & 255; + function k($, z, H, C) { + for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = H[0] & 255 | (H[1] & 255) << 8 | (H[2] & 255) << 16 | (H[3] & 255) << 24, se = H[4] & 255 | (H[5] & 255) << 8 | (H[6] & 255) << 16 | (H[7] & 255) << 24, de = H[8] & 255 | (H[9] & 255) << 8 | (H[10] & 255) << 16 | (H[11] & 255) << 24, xe = H[12] & 255 | (H[13] & 255) << 8 | (H[14] & 255) << 16 | (H[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = z[0] & 255 | (z[1] & 255) << 8 | (z[2] & 255) << 16 | (z[3] & 255) << 24, nt = z[4] & 255 | (z[5] & 255) << 8 | (z[6] & 255) << 16 | (z[7] & 255) << 24, je = z[8] & 255 | (z[9] & 255) << 8 | (z[10] & 255) << 16 | (z[11] & 255) << 24, pt = z[12] & 255 | (z[13] & 255) << 8 | (z[14] & 255) << 16 | (z[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = H[16] & 255 | (H[17] & 255) << 8 | (H[18] & 255) << 16 | (H[19] & 255) << 24, St = H[20] & 255 | (H[21] & 255) << 8 | (H[22] & 255) << 16 | (H[23] & 255) << 24, Tt = H[24] & 255 | (H[25] & 255) << 8 | (H[26] & 255) << 16 | (H[27] & 255) << 24, At = H[28] & 255 | (H[29] & 255) << 8 | (H[30] & 255) << 16 | (H[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, yt = de, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, he, rr = 0; rr < 20; rr += 2) + he = ht + Lt | 0, ut ^= he << 7 | he >>> 25, he = ut + ht | 0, Ve ^= he << 9 | he >>> 23, he = Ve + ut | 0, Lt ^= he << 13 | he >>> 19, he = Lt + Ve | 0, ht ^= he << 18 | he >>> 14, he = ot + xt | 0, Fe ^= he << 7 | he >>> 25, he = Fe + ot | 0, zt ^= he << 9 | he >>> 23, he = zt + Fe | 0, xt ^= he << 13 | he >>> 19, he = xt + zt | 0, ot ^= he << 18 | he >>> 14, he = Ue + Se | 0, Zt ^= he << 7 | he >>> 25, he = Zt + Ue | 0, st ^= he << 9 | he >>> 23, he = st + Zt | 0, Se ^= he << 13 | he >>> 19, he = Se + st | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Je | 0, yt ^= he << 7 | he >>> 25, he = yt + Wt | 0, Ae ^= he << 9 | he >>> 23, he = Ae + yt | 0, Je ^= he << 13 | he >>> 19, he = Je + Ae | 0, Wt ^= he << 18 | he >>> 14, he = ht + yt | 0, xt ^= he << 7 | he >>> 25, he = xt + ht | 0, st ^= he << 9 | he >>> 23, he = st + xt | 0, yt ^= he << 13 | he >>> 19, he = yt + st | 0, ht ^= he << 18 | he >>> 14, he = ot + ut | 0, Se ^= he << 7 | he >>> 25, he = Se + ot | 0, Ae ^= he << 9 | he >>> 23, he = Ae + Se | 0, ut ^= he << 13 | he >>> 19, he = ut + Ae | 0, ot ^= he << 18 | he >>> 14, he = Ue + Fe | 0, Je ^= he << 7 | he >>> 25, he = Je + Ue | 0, Ve ^= he << 9 | he >>> 23, he = Ve + Je | 0, Fe ^= he << 13 | he >>> 19, he = Fe + Ve | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Zt | 0, Lt ^= he << 7 | he >>> 25, he = Lt + Wt | 0, zt ^= he << 9 | he >>> 23, he = zt + Lt | 0, Zt ^= he << 13 | he >>> 19, he = Zt + zt | 0, Wt ^= he << 18 | he >>> 14; + ht = ht + G | 0, xt = xt + j | 0, st = st + se | 0, yt = yt + de | 0, ut = ut + xe | 0, ot = ot + Te | 0, Se = Se + Re | 0, Ae = Ae + nt | 0, Ve = Ve + je | 0, Fe = Fe + pt | 0, Ue = Ue + it | 0, Je = Je + et | 0, Lt = Lt + St | 0, zt = zt + Tt | 0, Zt = Zt + At | 0, Wt = Wt + _t | 0, $[0] = ht >>> 0 & 255, $[1] = ht >>> 8 & 255, $[2] = ht >>> 16 & 255, $[3] = ht >>> 24 & 255, $[4] = xt >>> 0 & 255, $[5] = xt >>> 8 & 255, $[6] = xt >>> 16 & 255, $[7] = xt >>> 24 & 255, $[8] = st >>> 0 & 255, $[9] = st >>> 8 & 255, $[10] = st >>> 16 & 255, $[11] = st >>> 24 & 255, $[12] = yt >>> 0 & 255, $[13] = yt >>> 8 & 255, $[14] = yt >>> 16 & 255, $[15] = yt >>> 24 & 255, $[16] = ut >>> 0 & 255, $[17] = ut >>> 8 & 255, $[18] = ut >>> 16 & 255, $[19] = ut >>> 24 & 255, $[20] = ot >>> 0 & 255, $[21] = ot >>> 8 & 255, $[22] = ot >>> 16 & 255, $[23] = ot >>> 24 & 255, $[24] = Se >>> 0 & 255, $[25] = Se >>> 8 & 255, $[26] = Se >>> 16 & 255, $[27] = Se >>> 24 & 255, $[28] = Ae >>> 0 & 255, $[29] = Ae >>> 8 & 255, $[30] = Ae >>> 16 & 255, $[31] = Ae >>> 24 & 255, $[32] = Ve >>> 0 & 255, $[33] = Ve >>> 8 & 255, $[34] = Ve >>> 16 & 255, $[35] = Ve >>> 24 & 255, $[36] = Fe >>> 0 & 255, $[37] = Fe >>> 8 & 255, $[38] = Fe >>> 16 & 255, $[39] = Fe >>> 24 & 255, $[40] = Ue >>> 0 & 255, $[41] = Ue >>> 8 & 255, $[42] = Ue >>> 16 & 255, $[43] = Ue >>> 24 & 255, $[44] = Je >>> 0 & 255, $[45] = Je >>> 8 & 255, $[46] = Je >>> 16 & 255, $[47] = Je >>> 24 & 255, $[48] = Lt >>> 0 & 255, $[49] = Lt >>> 8 & 255, $[50] = Lt >>> 16 & 255, $[51] = Lt >>> 24 & 255, $[52] = zt >>> 0 & 255, $[53] = zt >>> 8 & 255, $[54] = zt >>> 16 & 255, $[55] = zt >>> 24 & 255, $[56] = Zt >>> 0 & 255, $[57] = Zt >>> 8 & 255, $[58] = Zt >>> 16 & 255, $[59] = Zt >>> 24 & 255, $[60] = Wt >>> 0 & 255, $[61] = Wt >>> 8 & 255, $[62] = Wt >>> 16 & 255, $[63] = Wt >>> 24 & 255; } - function H(k, q, W, C) { - for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = W[0] & 255 | (W[1] & 255) << 8 | (W[2] & 255) << 16 | (W[3] & 255) << 24, se = W[4] & 255 | (W[5] & 255) << 8 | (W[6] & 255) << 16 | (W[7] & 255) << 24, de = W[8] & 255 | (W[9] & 255) << 8 | (W[10] & 255) << 16 | (W[11] & 255) << 24, xe = W[12] & 255 | (W[13] & 255) << 8 | (W[14] & 255) << 16 | (W[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = q[0] & 255 | (q[1] & 255) << 8 | (q[2] & 255) << 16 | (q[3] & 255) << 24, nt = q[4] & 255 | (q[5] & 255) << 8 | (q[6] & 255) << 16 | (q[7] & 255) << 24, je = q[8] & 255 | (q[9] & 255) << 8 | (q[10] & 255) << 16 | (q[11] & 255) << 24, pt = q[12] & 255 | (q[13] & 255) << 8 | (q[14] & 255) << 16 | (q[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = W[16] & 255 | (W[17] & 255) << 8 | (W[18] & 255) << 16 | (W[19] & 255) << 24, St = W[20] & 255 | (W[21] & 255) << 8 | (W[22] & 255) << 16 | (W[23] & 255) << 24, Tt = W[24] & 255 | (W[25] & 255) << 8 | (W[26] & 255) << 16 | (W[27] & 255) << 24, At = W[28] & 255 | (W[29] & 255) << 8 | (W[30] & 255) << 16 | (W[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, bt = de, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, he, rr = 0; rr < 20; rr += 2) - he = ht + Lt | 0, ut ^= he << 7 | he >>> 25, he = ut + ht | 0, Ve ^= he << 9 | he >>> 23, he = Ve + ut | 0, Lt ^= he << 13 | he >>> 19, he = Lt + Ve | 0, ht ^= he << 18 | he >>> 14, he = ot + xt | 0, Fe ^= he << 7 | he >>> 25, he = Fe + ot | 0, zt ^= he << 9 | he >>> 23, he = zt + Fe | 0, xt ^= he << 13 | he >>> 19, he = xt + zt | 0, ot ^= he << 18 | he >>> 14, he = Ue + Se | 0, Zt ^= he << 7 | he >>> 25, he = Zt + Ue | 0, st ^= he << 9 | he >>> 23, he = st + Zt | 0, Se ^= he << 13 | he >>> 19, he = Se + st | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Je | 0, bt ^= he << 7 | he >>> 25, he = bt + Wt | 0, Ae ^= he << 9 | he >>> 23, he = Ae + bt | 0, Je ^= he << 13 | he >>> 19, he = Je + Ae | 0, Wt ^= he << 18 | he >>> 14, he = ht + bt | 0, xt ^= he << 7 | he >>> 25, he = xt + ht | 0, st ^= he << 9 | he >>> 23, he = st + xt | 0, bt ^= he << 13 | he >>> 19, he = bt + st | 0, ht ^= he << 18 | he >>> 14, he = ot + ut | 0, Se ^= he << 7 | he >>> 25, he = Se + ot | 0, Ae ^= he << 9 | he >>> 23, he = Ae + Se | 0, ut ^= he << 13 | he >>> 19, he = ut + Ae | 0, ot ^= he << 18 | he >>> 14, he = Ue + Fe | 0, Je ^= he << 7 | he >>> 25, he = Je + Ue | 0, Ve ^= he << 9 | he >>> 23, he = Ve + Je | 0, Fe ^= he << 13 | he >>> 19, he = Fe + Ve | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Zt | 0, Lt ^= he << 7 | he >>> 25, he = Lt + Wt | 0, zt ^= he << 9 | he >>> 23, he = zt + Lt | 0, Zt ^= he << 13 | he >>> 19, he = Zt + zt | 0, Wt ^= he << 18 | he >>> 14; - k[0] = ht >>> 0 & 255, k[1] = ht >>> 8 & 255, k[2] = ht >>> 16 & 255, k[3] = ht >>> 24 & 255, k[4] = ot >>> 0 & 255, k[5] = ot >>> 8 & 255, k[6] = ot >>> 16 & 255, k[7] = ot >>> 24 & 255, k[8] = Ue >>> 0 & 255, k[9] = Ue >>> 8 & 255, k[10] = Ue >>> 16 & 255, k[11] = Ue >>> 24 & 255, k[12] = Wt >>> 0 & 255, k[13] = Wt >>> 8 & 255, k[14] = Wt >>> 16 & 255, k[15] = Wt >>> 24 & 255, k[16] = Se >>> 0 & 255, k[17] = Se >>> 8 & 255, k[18] = Se >>> 16 & 255, k[19] = Se >>> 24 & 255, k[20] = Ae >>> 0 & 255, k[21] = Ae >>> 8 & 255, k[22] = Ae >>> 16 & 255, k[23] = Ae >>> 24 & 255, k[24] = Ve >>> 0 & 255, k[25] = Ve >>> 8 & 255, k[26] = Ve >>> 16 & 255, k[27] = Ve >>> 24 & 255, k[28] = Fe >>> 0 & 255, k[29] = Fe >>> 8 & 255, k[30] = Fe >>> 16 & 255, k[31] = Fe >>> 24 & 255; + function q($, z, H, C) { + for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = H[0] & 255 | (H[1] & 255) << 8 | (H[2] & 255) << 16 | (H[3] & 255) << 24, se = H[4] & 255 | (H[5] & 255) << 8 | (H[6] & 255) << 16 | (H[7] & 255) << 24, de = H[8] & 255 | (H[9] & 255) << 8 | (H[10] & 255) << 16 | (H[11] & 255) << 24, xe = H[12] & 255 | (H[13] & 255) << 8 | (H[14] & 255) << 16 | (H[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = z[0] & 255 | (z[1] & 255) << 8 | (z[2] & 255) << 16 | (z[3] & 255) << 24, nt = z[4] & 255 | (z[5] & 255) << 8 | (z[6] & 255) << 16 | (z[7] & 255) << 24, je = z[8] & 255 | (z[9] & 255) << 8 | (z[10] & 255) << 16 | (z[11] & 255) << 24, pt = z[12] & 255 | (z[13] & 255) << 8 | (z[14] & 255) << 16 | (z[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = H[16] & 255 | (H[17] & 255) << 8 | (H[18] & 255) << 16 | (H[19] & 255) << 24, St = H[20] & 255 | (H[21] & 255) << 8 | (H[22] & 255) << 16 | (H[23] & 255) << 24, Tt = H[24] & 255 | (H[25] & 255) << 8 | (H[26] & 255) << 16 | (H[27] & 255) << 24, At = H[28] & 255 | (H[29] & 255) << 8 | (H[30] & 255) << 16 | (H[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, yt = de, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, he, rr = 0; rr < 20; rr += 2) + he = ht + Lt | 0, ut ^= he << 7 | he >>> 25, he = ut + ht | 0, Ve ^= he << 9 | he >>> 23, he = Ve + ut | 0, Lt ^= he << 13 | he >>> 19, he = Lt + Ve | 0, ht ^= he << 18 | he >>> 14, he = ot + xt | 0, Fe ^= he << 7 | he >>> 25, he = Fe + ot | 0, zt ^= he << 9 | he >>> 23, he = zt + Fe | 0, xt ^= he << 13 | he >>> 19, he = xt + zt | 0, ot ^= he << 18 | he >>> 14, he = Ue + Se | 0, Zt ^= he << 7 | he >>> 25, he = Zt + Ue | 0, st ^= he << 9 | he >>> 23, he = st + Zt | 0, Se ^= he << 13 | he >>> 19, he = Se + st | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Je | 0, yt ^= he << 7 | he >>> 25, he = yt + Wt | 0, Ae ^= he << 9 | he >>> 23, he = Ae + yt | 0, Je ^= he << 13 | he >>> 19, he = Je + Ae | 0, Wt ^= he << 18 | he >>> 14, he = ht + yt | 0, xt ^= he << 7 | he >>> 25, he = xt + ht | 0, st ^= he << 9 | he >>> 23, he = st + xt | 0, yt ^= he << 13 | he >>> 19, he = yt + st | 0, ht ^= he << 18 | he >>> 14, he = ot + ut | 0, Se ^= he << 7 | he >>> 25, he = Se + ot | 0, Ae ^= he << 9 | he >>> 23, he = Ae + Se | 0, ut ^= he << 13 | he >>> 19, he = ut + Ae | 0, ot ^= he << 18 | he >>> 14, he = Ue + Fe | 0, Je ^= he << 7 | he >>> 25, he = Je + Ue | 0, Ve ^= he << 9 | he >>> 23, he = Ve + Je | 0, Fe ^= he << 13 | he >>> 19, he = Fe + Ve | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Zt | 0, Lt ^= he << 7 | he >>> 25, he = Lt + Wt | 0, zt ^= he << 9 | he >>> 23, he = zt + Lt | 0, Zt ^= he << 13 | he >>> 19, he = Zt + zt | 0, Wt ^= he << 18 | he >>> 14; + $[0] = ht >>> 0 & 255, $[1] = ht >>> 8 & 255, $[2] = ht >>> 16 & 255, $[3] = ht >>> 24 & 255, $[4] = ot >>> 0 & 255, $[5] = ot >>> 8 & 255, $[6] = ot >>> 16 & 255, $[7] = ot >>> 24 & 255, $[8] = Ue >>> 0 & 255, $[9] = Ue >>> 8 & 255, $[10] = Ue >>> 16 & 255, $[11] = Ue >>> 24 & 255, $[12] = Wt >>> 0 & 255, $[13] = Wt >>> 8 & 255, $[14] = Wt >>> 16 & 255, $[15] = Wt >>> 24 & 255, $[16] = Se >>> 0 & 255, $[17] = Se >>> 8 & 255, $[18] = Se >>> 16 & 255, $[19] = Se >>> 24 & 255, $[20] = Ae >>> 0 & 255, $[21] = Ae >>> 8 & 255, $[22] = Ae >>> 16 & 255, $[23] = Ae >>> 24 & 255, $[24] = Ve >>> 0 & 255, $[25] = Ve >>> 8 & 255, $[26] = Ve >>> 16 & 255, $[27] = Ve >>> 24 & 255, $[28] = Fe >>> 0 & 255, $[29] = Fe >>> 8 & 255, $[30] = Fe >>> 16 & 255, $[31] = Fe >>> 24 & 255; } - function U(k, q, W, C) { - $(k, q, W, C); + function U($, z, H, C) { + k($, z, H, C); } - function V(k, q, W, C) { - H(k, q, W, C); + function V($, z, H, C) { + q($, z, H, C); } - var te = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); - function R(k, q, W, C, G, j, se) { + var Q = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); + function R($, z, H, C, G, j, se) { var de = new Uint8Array(16), xe = new Uint8Array(64), Te, Re; for (Re = 0; Re < 16; Re++) de[Re] = 0; for (Re = 0; Re < 8; Re++) de[Re] = j[Re]; for (; G >= 64; ) { - for (U(xe, de, se, te), Re = 0; Re < 64; Re++) k[q + Re] = W[C + Re] ^ xe[Re]; + for (U(xe, de, se, Q), Re = 0; Re < 64; Re++) $[z + Re] = H[C + Re] ^ xe[Re]; for (Te = 1, Re = 8; Re < 16; Re++) Te = Te + (de[Re] & 255) | 0, de[Re] = Te & 255, Te >>>= 8; - G -= 64, q += 64, C += 64; + G -= 64, z += 64, C += 64; } if (G > 0) - for (U(xe, de, se, te), Re = 0; Re < G; Re++) k[q + Re] = W[C + Re] ^ xe[Re]; + for (U(xe, de, se, Q), Re = 0; Re < G; Re++) $[z + Re] = H[C + Re] ^ xe[Re]; return 0; } - function K(k, q, W, C, G) { + function K($, z, H, C, G) { var j = new Uint8Array(16), se = new Uint8Array(64), de, xe; for (xe = 0; xe < 16; xe++) j[xe] = 0; for (xe = 0; xe < 8; xe++) j[xe] = C[xe]; - for (; W >= 64; ) { - for (U(se, j, G, te), xe = 0; xe < 64; xe++) k[q + xe] = se[xe]; + for (; H >= 64; ) { + for (U(se, j, G, Q), xe = 0; xe < 64; xe++) $[z + xe] = se[xe]; for (de = 1, xe = 8; xe < 16; xe++) de = de + (j[xe] & 255) | 0, j[xe] = de & 255, de >>>= 8; - W -= 64, q += 64; + H -= 64, z += 64; } - if (W > 0) - for (U(se, j, G, te), xe = 0; xe < W; xe++) k[q + xe] = se[xe]; + if (H > 0) + for (U(se, j, G, Q), xe = 0; xe < H; xe++) $[z + xe] = se[xe]; return 0; } - function ge(k, q, W, C, G) { + function ge($, z, H, C, G) { var j = new Uint8Array(32); - V(j, C, G, te); + V(j, C, G, Q); for (var se = new Uint8Array(8), de = 0; de < 8; de++) se[de] = C[de + 16]; - return K(k, q, W, se, j); + return K($, z, H, se, j); } - function Ee(k, q, W, C, G, j, se) { + function Ee($, z, H, C, G, j, se) { var de = new Uint8Array(32); - V(de, j, se, te); + V(de, j, se, Q); for (var xe = new Uint8Array(8), Te = 0; Te < 8; Te++) xe[Te] = j[Te + 16]; - return R(k, q, W, C, G, xe, de); + return R($, z, H, C, G, xe, de); } - var Y = function(k) { + var Y = function($) { this.buffer = new Uint8Array(16), this.r = new Uint16Array(10), this.h = new Uint16Array(10), this.pad = new Uint16Array(8), this.leftover = 0, this.fin = 0; - var q, W, C, G, j, se, de, xe; - q = k[0] & 255 | (k[1] & 255) << 8, this.r[0] = q & 8191, W = k[2] & 255 | (k[3] & 255) << 8, this.r[1] = (q >>> 13 | W << 3) & 8191, C = k[4] & 255 | (k[5] & 255) << 8, this.r[2] = (W >>> 10 | C << 6) & 7939, G = k[6] & 255 | (k[7] & 255) << 8, this.r[3] = (C >>> 7 | G << 9) & 8191, j = k[8] & 255 | (k[9] & 255) << 8, this.r[4] = (G >>> 4 | j << 12) & 255, this.r[5] = j >>> 1 & 8190, se = k[10] & 255 | (k[11] & 255) << 8, this.r[6] = (j >>> 14 | se << 2) & 8191, de = k[12] & 255 | (k[13] & 255) << 8, this.r[7] = (se >>> 11 | de << 5) & 8065, xe = k[14] & 255 | (k[15] & 255) << 8, this.r[8] = (de >>> 8 | xe << 8) & 8191, this.r[9] = xe >>> 5 & 127, this.pad[0] = k[16] & 255 | (k[17] & 255) << 8, this.pad[1] = k[18] & 255 | (k[19] & 255) << 8, this.pad[2] = k[20] & 255 | (k[21] & 255) << 8, this.pad[3] = k[22] & 255 | (k[23] & 255) << 8, this.pad[4] = k[24] & 255 | (k[25] & 255) << 8, this.pad[5] = k[26] & 255 | (k[27] & 255) << 8, this.pad[6] = k[28] & 255 | (k[29] & 255) << 8, this.pad[7] = k[30] & 255 | (k[31] & 255) << 8; + var z, H, C, G, j, se, de, xe; + z = $[0] & 255 | ($[1] & 255) << 8, this.r[0] = z & 8191, H = $[2] & 255 | ($[3] & 255) << 8, this.r[1] = (z >>> 13 | H << 3) & 8191, C = $[4] & 255 | ($[5] & 255) << 8, this.r[2] = (H >>> 10 | C << 6) & 7939, G = $[6] & 255 | ($[7] & 255) << 8, this.r[3] = (C >>> 7 | G << 9) & 8191, j = $[8] & 255 | ($[9] & 255) << 8, this.r[4] = (G >>> 4 | j << 12) & 255, this.r[5] = j >>> 1 & 8190, se = $[10] & 255 | ($[11] & 255) << 8, this.r[6] = (j >>> 14 | se << 2) & 8191, de = $[12] & 255 | ($[13] & 255) << 8, this.r[7] = (se >>> 11 | de << 5) & 8065, xe = $[14] & 255 | ($[15] & 255) << 8, this.r[8] = (de >>> 8 | xe << 8) & 8191, this.r[9] = xe >>> 5 & 127, this.pad[0] = $[16] & 255 | ($[17] & 255) << 8, this.pad[1] = $[18] & 255 | ($[19] & 255) << 8, this.pad[2] = $[20] & 255 | ($[21] & 255) << 8, this.pad[3] = $[22] & 255 | ($[23] & 255) << 8, this.pad[4] = $[24] & 255 | ($[25] & 255) << 8, this.pad[5] = $[26] & 255 | ($[27] & 255) << 8, this.pad[6] = $[28] & 255 | ($[29] & 255) << 8, this.pad[7] = $[30] & 255 | ($[31] & 255) << 8; }; - Y.prototype.blocks = function(k, q, W) { - for (var C = this.fin ? 0 : 2048, G, j, se, de, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt = this.h[0], ut = this.h[1], ot = this.h[2], Se = this.h[3], Ae = this.h[4], Ve = this.h[5], Fe = this.h[6], Ue = this.h[7], Je = this.h[8], Lt = this.h[9], zt = this.r[0], Zt = this.r[1], Wt = this.r[2], he = this.r[3], rr = this.r[4], dr = this.r[5], pr = this.r[6], Qt = this.r[7], gr = this.r[8], lr = this.r[9]; W >= 16; ) - G = k[q + 0] & 255 | (k[q + 1] & 255) << 8, bt += G & 8191, j = k[q + 2] & 255 | (k[q + 3] & 255) << 8, ut += (G >>> 13 | j << 3) & 8191, se = k[q + 4] & 255 | (k[q + 5] & 255) << 8, ot += (j >>> 10 | se << 6) & 8191, de = k[q + 6] & 255 | (k[q + 7] & 255) << 8, Se += (se >>> 7 | de << 9) & 8191, xe = k[q + 8] & 255 | (k[q + 9] & 255) << 8, Ae += (de >>> 4 | xe << 12) & 8191, Ve += xe >>> 1 & 8191, Te = k[q + 10] & 255 | (k[q + 11] & 255) << 8, Fe += (xe >>> 14 | Te << 2) & 8191, Re = k[q + 12] & 255 | (k[q + 13] & 255) << 8, Ue += (Te >>> 11 | Re << 5) & 8191, nt = k[q + 14] & 255 | (k[q + 15] & 255) << 8, Je += (Re >>> 8 | nt << 8) & 8191, Lt += nt >>> 5 | C, je = 0, pt = je, pt += bt * zt, pt += ut * (5 * lr), pt += ot * (5 * gr), pt += Se * (5 * Qt), pt += Ae * (5 * pr), je = pt >>> 13, pt &= 8191, pt += Ve * (5 * dr), pt += Fe * (5 * rr), pt += Ue * (5 * he), pt += Je * (5 * Wt), pt += Lt * (5 * Zt), je += pt >>> 13, pt &= 8191, it = je, it += bt * Zt, it += ut * zt, it += ot * (5 * lr), it += Se * (5 * gr), it += Ae * (5 * Qt), je = it >>> 13, it &= 8191, it += Ve * (5 * pr), it += Fe * (5 * dr), it += Ue * (5 * rr), it += Je * (5 * he), it += Lt * (5 * Wt), je += it >>> 13, it &= 8191, et = je, et += bt * Wt, et += ut * Zt, et += ot * zt, et += Se * (5 * lr), et += Ae * (5 * gr), je = et >>> 13, et &= 8191, et += Ve * (5 * Qt), et += Fe * (5 * pr), et += Ue * (5 * dr), et += Je * (5 * rr), et += Lt * (5 * he), je += et >>> 13, et &= 8191, St = je, St += bt * he, St += ut * Wt, St += ot * Zt, St += Se * zt, St += Ae * (5 * lr), je = St >>> 13, St &= 8191, St += Ve * (5 * gr), St += Fe * (5 * Qt), St += Ue * (5 * pr), St += Je * (5 * dr), St += Lt * (5 * rr), je += St >>> 13, St &= 8191, Tt = je, Tt += bt * rr, Tt += ut * he, Tt += ot * Wt, Tt += Se * Zt, Tt += Ae * zt, je = Tt >>> 13, Tt &= 8191, Tt += Ve * (5 * lr), Tt += Fe * (5 * gr), Tt += Ue * (5 * Qt), Tt += Je * (5 * pr), Tt += Lt * (5 * dr), je += Tt >>> 13, Tt &= 8191, At = je, At += bt * dr, At += ut * rr, At += ot * he, At += Se * Wt, At += Ae * Zt, je = At >>> 13, At &= 8191, At += Ve * zt, At += Fe * (5 * lr), At += Ue * (5 * gr), At += Je * (5 * Qt), At += Lt * (5 * pr), je += At >>> 13, At &= 8191, _t = je, _t += bt * pr, _t += ut * dr, _t += ot * rr, _t += Se * he, _t += Ae * Wt, je = _t >>> 13, _t &= 8191, _t += Ve * Zt, _t += Fe * zt, _t += Ue * (5 * lr), _t += Je * (5 * gr), _t += Lt * (5 * Qt), je += _t >>> 13, _t &= 8191, ht = je, ht += bt * Qt, ht += ut * pr, ht += ot * dr, ht += Se * rr, ht += Ae * he, je = ht >>> 13, ht &= 8191, ht += Ve * Wt, ht += Fe * Zt, ht += Ue * zt, ht += Je * (5 * lr), ht += Lt * (5 * gr), je += ht >>> 13, ht &= 8191, xt = je, xt += bt * gr, xt += ut * Qt, xt += ot * pr, xt += Se * dr, xt += Ae * rr, je = xt >>> 13, xt &= 8191, xt += Ve * he, xt += Fe * Wt, xt += Ue * Zt, xt += Je * zt, xt += Lt * (5 * lr), je += xt >>> 13, xt &= 8191, st = je, st += bt * lr, st += ut * gr, st += ot * Qt, st += Se * pr, st += Ae * dr, je = st >>> 13, st &= 8191, st += Ve * rr, st += Fe * he, st += Ue * Wt, st += Je * Zt, st += Lt * zt, je += st >>> 13, st &= 8191, je = (je << 2) + je | 0, je = je + pt | 0, pt = je & 8191, je = je >>> 13, it += je, bt = pt, ut = it, ot = et, Se = St, Ae = Tt, Ve = At, Fe = _t, Ue = ht, Je = xt, Lt = st, q += 16, W -= 16; - this.h[0] = bt, this.h[1] = ut, this.h[2] = ot, this.h[3] = Se, this.h[4] = Ae, this.h[5] = Ve, this.h[6] = Fe, this.h[7] = Ue, this.h[8] = Je, this.h[9] = Lt; - }, Y.prototype.finish = function(k, q) { - var W = new Uint16Array(10), C, G, j, se; + Y.prototype.blocks = function($, z, H) { + for (var C = this.fin ? 0 : 2048, G, j, se, de, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, yt = this.h[0], ut = this.h[1], ot = this.h[2], Se = this.h[3], Ae = this.h[4], Ve = this.h[5], Fe = this.h[6], Ue = this.h[7], Je = this.h[8], Lt = this.h[9], zt = this.r[0], Zt = this.r[1], Wt = this.r[2], he = this.r[3], rr = this.r[4], dr = this.r[5], pr = this.r[6], Qt = this.r[7], gr = this.r[8], lr = this.r[9]; H >= 16; ) + G = $[z + 0] & 255 | ($[z + 1] & 255) << 8, yt += G & 8191, j = $[z + 2] & 255 | ($[z + 3] & 255) << 8, ut += (G >>> 13 | j << 3) & 8191, se = $[z + 4] & 255 | ($[z + 5] & 255) << 8, ot += (j >>> 10 | se << 6) & 8191, de = $[z + 6] & 255 | ($[z + 7] & 255) << 8, Se += (se >>> 7 | de << 9) & 8191, xe = $[z + 8] & 255 | ($[z + 9] & 255) << 8, Ae += (de >>> 4 | xe << 12) & 8191, Ve += xe >>> 1 & 8191, Te = $[z + 10] & 255 | ($[z + 11] & 255) << 8, Fe += (xe >>> 14 | Te << 2) & 8191, Re = $[z + 12] & 255 | ($[z + 13] & 255) << 8, Ue += (Te >>> 11 | Re << 5) & 8191, nt = $[z + 14] & 255 | ($[z + 15] & 255) << 8, Je += (Re >>> 8 | nt << 8) & 8191, Lt += nt >>> 5 | C, je = 0, pt = je, pt += yt * zt, pt += ut * (5 * lr), pt += ot * (5 * gr), pt += Se * (5 * Qt), pt += Ae * (5 * pr), je = pt >>> 13, pt &= 8191, pt += Ve * (5 * dr), pt += Fe * (5 * rr), pt += Ue * (5 * he), pt += Je * (5 * Wt), pt += Lt * (5 * Zt), je += pt >>> 13, pt &= 8191, it = je, it += yt * Zt, it += ut * zt, it += ot * (5 * lr), it += Se * (5 * gr), it += Ae * (5 * Qt), je = it >>> 13, it &= 8191, it += Ve * (5 * pr), it += Fe * (5 * dr), it += Ue * (5 * rr), it += Je * (5 * he), it += Lt * (5 * Wt), je += it >>> 13, it &= 8191, et = je, et += yt * Wt, et += ut * Zt, et += ot * zt, et += Se * (5 * lr), et += Ae * (5 * gr), je = et >>> 13, et &= 8191, et += Ve * (5 * Qt), et += Fe * (5 * pr), et += Ue * (5 * dr), et += Je * (5 * rr), et += Lt * (5 * he), je += et >>> 13, et &= 8191, St = je, St += yt * he, St += ut * Wt, St += ot * Zt, St += Se * zt, St += Ae * (5 * lr), je = St >>> 13, St &= 8191, St += Ve * (5 * gr), St += Fe * (5 * Qt), St += Ue * (5 * pr), St += Je * (5 * dr), St += Lt * (5 * rr), je += St >>> 13, St &= 8191, Tt = je, Tt += yt * rr, Tt += ut * he, Tt += ot * Wt, Tt += Se * Zt, Tt += Ae * zt, je = Tt >>> 13, Tt &= 8191, Tt += Ve * (5 * lr), Tt += Fe * (5 * gr), Tt += Ue * (5 * Qt), Tt += Je * (5 * pr), Tt += Lt * (5 * dr), je += Tt >>> 13, Tt &= 8191, At = je, At += yt * dr, At += ut * rr, At += ot * he, At += Se * Wt, At += Ae * Zt, je = At >>> 13, At &= 8191, At += Ve * zt, At += Fe * (5 * lr), At += Ue * (5 * gr), At += Je * (5 * Qt), At += Lt * (5 * pr), je += At >>> 13, At &= 8191, _t = je, _t += yt * pr, _t += ut * dr, _t += ot * rr, _t += Se * he, _t += Ae * Wt, je = _t >>> 13, _t &= 8191, _t += Ve * Zt, _t += Fe * zt, _t += Ue * (5 * lr), _t += Je * (5 * gr), _t += Lt * (5 * Qt), je += _t >>> 13, _t &= 8191, ht = je, ht += yt * Qt, ht += ut * pr, ht += ot * dr, ht += Se * rr, ht += Ae * he, je = ht >>> 13, ht &= 8191, ht += Ve * Wt, ht += Fe * Zt, ht += Ue * zt, ht += Je * (5 * lr), ht += Lt * (5 * gr), je += ht >>> 13, ht &= 8191, xt = je, xt += yt * gr, xt += ut * Qt, xt += ot * pr, xt += Se * dr, xt += Ae * rr, je = xt >>> 13, xt &= 8191, xt += Ve * he, xt += Fe * Wt, xt += Ue * Zt, xt += Je * zt, xt += Lt * (5 * lr), je += xt >>> 13, xt &= 8191, st = je, st += yt * lr, st += ut * gr, st += ot * Qt, st += Se * pr, st += Ae * dr, je = st >>> 13, st &= 8191, st += Ve * rr, st += Fe * he, st += Ue * Wt, st += Je * Zt, st += Lt * zt, je += st >>> 13, st &= 8191, je = (je << 2) + je | 0, je = je + pt | 0, pt = je & 8191, je = je >>> 13, it += je, yt = pt, ut = it, ot = et, Se = St, Ae = Tt, Ve = At, Fe = _t, Ue = ht, Je = xt, Lt = st, z += 16, H -= 16; + this.h[0] = yt, this.h[1] = ut, this.h[2] = ot, this.h[3] = Se, this.h[4] = Ae, this.h[5] = Ve, this.h[6] = Fe, this.h[7] = Ue, this.h[8] = Je, this.h[9] = Lt; + }, Y.prototype.finish = function($, z) { + var H = new Uint16Array(10), C, G, j, se; if (this.leftover) { for (se = this.leftover, this.buffer[se++] = 1; se < 16; se++) this.buffer[se] = 0; this.fin = 1, this.blocks(this.buffer, 0, 16); } for (C = this.h[1] >>> 13, this.h[1] &= 8191, se = 2; se < 10; se++) this.h[se] += C, C = this.h[se] >>> 13, this.h[se] &= 8191; - for (this.h[0] += C * 5, C = this.h[0] >>> 13, this.h[0] &= 8191, this.h[1] += C, C = this.h[1] >>> 13, this.h[1] &= 8191, this.h[2] += C, W[0] = this.h[0] + 5, C = W[0] >>> 13, W[0] &= 8191, se = 1; se < 10; se++) - W[se] = this.h[se] + C, C = W[se] >>> 13, W[se] &= 8191; - for (W[9] -= 8192, G = (C ^ 1) - 1, se = 0; se < 10; se++) W[se] &= G; - for (G = ~G, se = 0; se < 10; se++) this.h[se] = this.h[se] & G | W[se]; + for (this.h[0] += C * 5, C = this.h[0] >>> 13, this.h[0] &= 8191, this.h[1] += C, C = this.h[1] >>> 13, this.h[1] &= 8191, this.h[2] += C, H[0] = this.h[0] + 5, C = H[0] >>> 13, H[0] &= 8191, se = 1; se < 10; se++) + H[se] = this.h[se] + C, C = H[se] >>> 13, H[se] &= 8191; + for (H[9] -= 8192, G = (C ^ 1) - 1, se = 0; se < 10; se++) H[se] &= G; + for (G = ~G, se = 0; se < 10; se++) this.h[se] = this.h[se] & G | H[se]; for (this.h[0] = (this.h[0] | this.h[1] << 13) & 65535, this.h[1] = (this.h[1] >>> 3 | this.h[2] << 10) & 65535, this.h[2] = (this.h[2] >>> 6 | this.h[3] << 7) & 65535, this.h[3] = (this.h[3] >>> 9 | this.h[4] << 4) & 65535, this.h[4] = (this.h[4] >>> 12 | this.h[5] << 1 | this.h[6] << 14) & 65535, this.h[5] = (this.h[6] >>> 2 | this.h[7] << 11) & 65535, this.h[6] = (this.h[7] >>> 5 | this.h[8] << 8) & 65535, this.h[7] = (this.h[8] >>> 8 | this.h[9] << 5) & 65535, j = this.h[0] + this.pad[0], this.h[0] = j & 65535, se = 1; se < 8; se++) j = (this.h[se] + this.pad[se] | 0) + (j >>> 16) | 0, this.h[se] = j & 65535; - k[q + 0] = this.h[0] >>> 0 & 255, k[q + 1] = this.h[0] >>> 8 & 255, k[q + 2] = this.h[1] >>> 0 & 255, k[q + 3] = this.h[1] >>> 8 & 255, k[q + 4] = this.h[2] >>> 0 & 255, k[q + 5] = this.h[2] >>> 8 & 255, k[q + 6] = this.h[3] >>> 0 & 255, k[q + 7] = this.h[3] >>> 8 & 255, k[q + 8] = this.h[4] >>> 0 & 255, k[q + 9] = this.h[4] >>> 8 & 255, k[q + 10] = this.h[5] >>> 0 & 255, k[q + 11] = this.h[5] >>> 8 & 255, k[q + 12] = this.h[6] >>> 0 & 255, k[q + 13] = this.h[6] >>> 8 & 255, k[q + 14] = this.h[7] >>> 0 & 255, k[q + 15] = this.h[7] >>> 8 & 255; - }, Y.prototype.update = function(k, q, W) { + $[z + 0] = this.h[0] >>> 0 & 255, $[z + 1] = this.h[0] >>> 8 & 255, $[z + 2] = this.h[1] >>> 0 & 255, $[z + 3] = this.h[1] >>> 8 & 255, $[z + 4] = this.h[2] >>> 0 & 255, $[z + 5] = this.h[2] >>> 8 & 255, $[z + 6] = this.h[3] >>> 0 & 255, $[z + 7] = this.h[3] >>> 8 & 255, $[z + 8] = this.h[4] >>> 0 & 255, $[z + 9] = this.h[4] >>> 8 & 255, $[z + 10] = this.h[5] >>> 0 & 255, $[z + 11] = this.h[5] >>> 8 & 255, $[z + 12] = this.h[6] >>> 0 & 255, $[z + 13] = this.h[6] >>> 8 & 255, $[z + 14] = this.h[7] >>> 0 & 255, $[z + 15] = this.h[7] >>> 8 & 255; + }, Y.prototype.update = function($, z, H) { var C, G; if (this.leftover) { - for (G = 16 - this.leftover, G > W && (G = W), C = 0; C < G; C++) - this.buffer[this.leftover + C] = k[q + C]; - if (W -= G, q += G, this.leftover += G, this.leftover < 16) + for (G = 16 - this.leftover, G > H && (G = H), C = 0; C < G; C++) + this.buffer[this.leftover + C] = $[z + C]; + if (H -= G, z += G, this.leftover += G, this.leftover < 16) return; this.blocks(this.buffer, 0, 16), this.leftover = 0; } - if (W >= 16 && (G = W - W % 16, this.blocks(k, q, G), q += G, W -= G), W) { - for (C = 0; C < W; C++) - this.buffer[this.leftover + C] = k[q + C]; - this.leftover += W; + if (H >= 16 && (G = H - H % 16, this.blocks($, z, G), z += G, H -= G), H) { + for (C = 0; C < H; C++) + this.buffer[this.leftover + C] = $[z + C]; + this.leftover += H; } }; - function S(k, q, W, C, G, j) { + function A($, z, H, C, G, j) { var se = new Y(j); - return se.update(W, C, G), se.finish(k, q), 0; + return se.update(H, C, G), se.finish($, z), 0; } - function m(k, q, W, C, G, j) { + function m($, z, H, C, G, j) { var se = new Uint8Array(16); - return S(se, 0, W, C, G, j), L(k, q, se, 0); + return A(se, 0, H, C, G, j), L($, z, se, 0); } - function f(k, q, W, C, G) { + function f($, z, H, C, G) { var j; - if (W < 32) return -1; - for (Ee(k, 0, q, 0, W, C, G), S(k, 16, k, 32, W - 32, k), j = 0; j < 16; j++) k[j] = 0; + if (H < 32) return -1; + for (Ee($, 0, z, 0, H, C, G), A($, 16, $, 32, H - 32, $), j = 0; j < 16; j++) $[j] = 0; return 0; } - function g(k, q, W, C, G) { + function g($, z, H, C, G) { var j, se = new Uint8Array(32); - if (W < 32 || (ge(se, 0, 32, C, G), m(q, 16, q, 32, W - 32, se) !== 0)) return -1; - for (Ee(k, 0, q, 0, W, C, G), j = 0; j < 32; j++) k[j] = 0; + if (H < 32 || (ge(se, 0, 32, C, G), m(z, 16, z, 32, H - 32, se) !== 0)) return -1; + for (Ee($, 0, z, 0, H, C, G), j = 0; j < 32; j++) $[j] = 0; return 0; } - function b(k, q) { - var W; - for (W = 0; W < 16; W++) k[W] = q[W] | 0; + function b($, z) { + var H; + for (H = 0; H < 16; H++) $[H] = z[H] | 0; } - function x(k) { - var q, W, C = 1; - for (q = 0; q < 16; q++) - W = k[q] + C + 65535, C = Math.floor(W / 65536), k[q] = W - C * 65536; - k[0] += C - 1 + 37 * (C - 1); + function x($) { + var z, H, C = 1; + for (z = 0; z < 16; z++) + H = $[z] + C + 65535, C = Math.floor(H / 65536), $[z] = H - C * 65536; + $[0] += C - 1 + 37 * (C - 1); } - function _(k, q, W) { - for (var C, G = ~(W - 1), j = 0; j < 16; j++) - C = G & (k[j] ^ q[j]), k[j] ^= C, q[j] ^= C; + function E($, z, H) { + for (var C, G = ~(H - 1), j = 0; j < 16; j++) + C = G & ($[j] ^ z[j]), $[j] ^= C, z[j] ^= C; } - function E(k, q) { - var W, C, G, j = r(), se = r(); - for (W = 0; W < 16; W++) se[W] = q[W]; + function S($, z) { + var H, C, G, j = r(), se = r(); + for (H = 0; H < 16; H++) se[H] = z[H]; for (x(se), x(se), x(se), C = 0; C < 2; C++) { - for (j[0] = se[0] - 65517, W = 1; W < 15; W++) - j[W] = se[W] - 65535 - (j[W - 1] >> 16 & 1), j[W - 1] &= 65535; - j[15] = se[15] - 32767 - (j[14] >> 16 & 1), G = j[15] >> 16 & 1, j[14] &= 65535, _(se, j, 1 - G); + for (j[0] = se[0] - 65517, H = 1; H < 15; H++) + j[H] = se[H] - 65535 - (j[H - 1] >> 16 & 1), j[H - 1] &= 65535; + j[15] = se[15] - 32767 - (j[14] >> 16 & 1), G = j[15] >> 16 & 1, j[14] &= 65535, E(se, j, 1 - G); } - for (W = 0; W < 16; W++) - k[2 * W] = se[W] & 255, k[2 * W + 1] = se[W] >> 8; + for (H = 0; H < 16; H++) + $[2 * H] = se[H] & 255, $[2 * H + 1] = se[H] >> 8; } - function v(k, q) { - var W = new Uint8Array(32), C = new Uint8Array(32); - return E(W, k), E(C, q), B(W, 0, C, 0); + function v($, z) { + var H = new Uint8Array(32), C = new Uint8Array(32); + return S(H, $), S(C, z), B(H, 0, C, 0); } - function P(k) { - var q = new Uint8Array(32); - return E(q, k), q[0] & 1; + function M($) { + var z = new Uint8Array(32); + return S(z, $), z[0] & 1; } - function I(k, q) { - var W; - for (W = 0; W < 16; W++) k[W] = q[2 * W] + (q[2 * W + 1] << 8); - k[15] &= 32767; + function I($, z) { + var H; + for (H = 0; H < 16; H++) $[H] = z[2 * H] + (z[2 * H + 1] << 8); + $[15] &= 32767; } - function F(k, q, W) { - for (var C = 0; C < 16; C++) k[C] = q[C] + W[C]; + function F($, z, H) { + for (var C = 0; C < 16; C++) $[C] = z[C] + H[C]; } - function ce(k, q, W) { - for (var C = 0; C < 16; C++) k[C] = q[C] - W[C]; + function ce($, z, H) { + for (var C = 0; C < 16; C++) $[C] = z[C] - H[C]; } - function D(k, q, W) { - var C, G, j = 0, se = 0, de = 0, xe = 0, Te = 0, Re = 0, nt = 0, je = 0, pt = 0, it = 0, et = 0, St = 0, Tt = 0, At = 0, _t = 0, ht = 0, xt = 0, st = 0, bt = 0, ut = 0, ot = 0, Se = 0, Ae = 0, Ve = 0, Fe = 0, Ue = 0, Je = 0, Lt = 0, zt = 0, Zt = 0, Wt = 0, he = W[0], rr = W[1], dr = W[2], pr = W[3], Qt = W[4], gr = W[5], lr = W[6], Rr = W[7], mr = W[8], yr = W[9], $r = W[10], Br = W[11], Ir = W[12], nn = W[13], sn = W[14], on = W[15]; - C = q[0], j += C * he, se += C * rr, de += C * dr, xe += C * pr, Te += C * Qt, Re += C * gr, nt += C * lr, je += C * Rr, pt += C * mr, it += C * yr, et += C * $r, St += C * Br, Tt += C * Ir, At += C * nn, _t += C * sn, ht += C * on, C = q[1], se += C * he, de += C * rr, xe += C * dr, Te += C * pr, Re += C * Qt, nt += C * gr, je += C * lr, pt += C * Rr, it += C * mr, et += C * yr, St += C * $r, Tt += C * Br, At += C * Ir, _t += C * nn, ht += C * sn, xt += C * on, C = q[2], de += C * he, xe += C * rr, Te += C * dr, Re += C * pr, nt += C * Qt, je += C * gr, pt += C * lr, it += C * Rr, et += C * mr, St += C * yr, Tt += C * $r, At += C * Br, _t += C * Ir, ht += C * nn, xt += C * sn, st += C * on, C = q[3], xe += C * he, Te += C * rr, Re += C * dr, nt += C * pr, je += C * Qt, pt += C * gr, it += C * lr, et += C * Rr, St += C * mr, Tt += C * yr, At += C * $r, _t += C * Br, ht += C * Ir, xt += C * nn, st += C * sn, bt += C * on, C = q[4], Te += C * he, Re += C * rr, nt += C * dr, je += C * pr, pt += C * Qt, it += C * gr, et += C * lr, St += C * Rr, Tt += C * mr, At += C * yr, _t += C * $r, ht += C * Br, xt += C * Ir, st += C * nn, bt += C * sn, ut += C * on, C = q[5], Re += C * he, nt += C * rr, je += C * dr, pt += C * pr, it += C * Qt, et += C * gr, St += C * lr, Tt += C * Rr, At += C * mr, _t += C * yr, ht += C * $r, xt += C * Br, st += C * Ir, bt += C * nn, ut += C * sn, ot += C * on, C = q[6], nt += C * he, je += C * rr, pt += C * dr, it += C * pr, et += C * Qt, St += C * gr, Tt += C * lr, At += C * Rr, _t += C * mr, ht += C * yr, xt += C * $r, st += C * Br, bt += C * Ir, ut += C * nn, ot += C * sn, Se += C * on, C = q[7], je += C * he, pt += C * rr, it += C * dr, et += C * pr, St += C * Qt, Tt += C * gr, At += C * lr, _t += C * Rr, ht += C * mr, xt += C * yr, st += C * $r, bt += C * Br, ut += C * Ir, ot += C * nn, Se += C * sn, Ae += C * on, C = q[8], pt += C * he, it += C * rr, et += C * dr, St += C * pr, Tt += C * Qt, At += C * gr, _t += C * lr, ht += C * Rr, xt += C * mr, st += C * yr, bt += C * $r, ut += C * Br, ot += C * Ir, Se += C * nn, Ae += C * sn, Ve += C * on, C = q[9], it += C * he, et += C * rr, St += C * dr, Tt += C * pr, At += C * Qt, _t += C * gr, ht += C * lr, xt += C * Rr, st += C * mr, bt += C * yr, ut += C * $r, ot += C * Br, Se += C * Ir, Ae += C * nn, Ve += C * sn, Fe += C * on, C = q[10], et += C * he, St += C * rr, Tt += C * dr, At += C * pr, _t += C * Qt, ht += C * gr, xt += C * lr, st += C * Rr, bt += C * mr, ut += C * yr, ot += C * $r, Se += C * Br, Ae += C * Ir, Ve += C * nn, Fe += C * sn, Ue += C * on, C = q[11], St += C * he, Tt += C * rr, At += C * dr, _t += C * pr, ht += C * Qt, xt += C * gr, st += C * lr, bt += C * Rr, ut += C * mr, ot += C * yr, Se += C * $r, Ae += C * Br, Ve += C * Ir, Fe += C * nn, Ue += C * sn, Je += C * on, C = q[12], Tt += C * he, At += C * rr, _t += C * dr, ht += C * pr, xt += C * Qt, st += C * gr, bt += C * lr, ut += C * Rr, ot += C * mr, Se += C * yr, Ae += C * $r, Ve += C * Br, Fe += C * Ir, Ue += C * nn, Je += C * sn, Lt += C * on, C = q[13], At += C * he, _t += C * rr, ht += C * dr, xt += C * pr, st += C * Qt, bt += C * gr, ut += C * lr, ot += C * Rr, Se += C * mr, Ae += C * yr, Ve += C * $r, Fe += C * Br, Ue += C * Ir, Je += C * nn, Lt += C * sn, zt += C * on, C = q[14], _t += C * he, ht += C * rr, xt += C * dr, st += C * pr, bt += C * Qt, ut += C * gr, ot += C * lr, Se += C * Rr, Ae += C * mr, Ve += C * yr, Fe += C * $r, Ue += C * Br, Je += C * Ir, Lt += C * nn, zt += C * sn, Zt += C * on, C = q[15], ht += C * he, xt += C * rr, st += C * dr, bt += C * pr, ut += C * Qt, ot += C * gr, Se += C * lr, Ae += C * Rr, Ve += C * mr, Fe += C * yr, Ue += C * $r, Je += C * Br, Lt += C * Ir, zt += C * nn, Zt += C * sn, Wt += C * on, j += 38 * xt, se += 38 * st, de += 38 * bt, xe += 38 * ut, Te += 38 * ot, Re += 38 * Se, nt += 38 * Ae, je += 38 * Ve, pt += 38 * Fe, it += 38 * Ue, et += 38 * Je, St += 38 * Lt, Tt += 38 * zt, At += 38 * Zt, _t += 38 * Wt, G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = de + G + 65535, G = Math.floor(C / 65536), de = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = de + G + 65535, G = Math.floor(C / 65536), de = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), k[0] = j, k[1] = se, k[2] = de, k[3] = xe, k[4] = Te, k[5] = Re, k[6] = nt, k[7] = je, k[8] = pt, k[9] = it, k[10] = et, k[11] = St, k[12] = Tt, k[13] = At, k[14] = _t, k[15] = ht; + function D($, z, H) { + var C, G, j = 0, se = 0, de = 0, xe = 0, Te = 0, Re = 0, nt = 0, je = 0, pt = 0, it = 0, et = 0, St = 0, Tt = 0, At = 0, _t = 0, ht = 0, xt = 0, st = 0, yt = 0, ut = 0, ot = 0, Se = 0, Ae = 0, Ve = 0, Fe = 0, Ue = 0, Je = 0, Lt = 0, zt = 0, Zt = 0, Wt = 0, he = H[0], rr = H[1], dr = H[2], pr = H[3], Qt = H[4], gr = H[5], lr = H[6], Rr = H[7], mr = H[8], wr = H[9], $r = H[10], Br = H[11], Ir = H[12], nn = H[13], sn = H[14], on = H[15]; + C = z[0], j += C * he, se += C * rr, de += C * dr, xe += C * pr, Te += C * Qt, Re += C * gr, nt += C * lr, je += C * Rr, pt += C * mr, it += C * wr, et += C * $r, St += C * Br, Tt += C * Ir, At += C * nn, _t += C * sn, ht += C * on, C = z[1], se += C * he, de += C * rr, xe += C * dr, Te += C * pr, Re += C * Qt, nt += C * gr, je += C * lr, pt += C * Rr, it += C * mr, et += C * wr, St += C * $r, Tt += C * Br, At += C * Ir, _t += C * nn, ht += C * sn, xt += C * on, C = z[2], de += C * he, xe += C * rr, Te += C * dr, Re += C * pr, nt += C * Qt, je += C * gr, pt += C * lr, it += C * Rr, et += C * mr, St += C * wr, Tt += C * $r, At += C * Br, _t += C * Ir, ht += C * nn, xt += C * sn, st += C * on, C = z[3], xe += C * he, Te += C * rr, Re += C * dr, nt += C * pr, je += C * Qt, pt += C * gr, it += C * lr, et += C * Rr, St += C * mr, Tt += C * wr, At += C * $r, _t += C * Br, ht += C * Ir, xt += C * nn, st += C * sn, yt += C * on, C = z[4], Te += C * he, Re += C * rr, nt += C * dr, je += C * pr, pt += C * Qt, it += C * gr, et += C * lr, St += C * Rr, Tt += C * mr, At += C * wr, _t += C * $r, ht += C * Br, xt += C * Ir, st += C * nn, yt += C * sn, ut += C * on, C = z[5], Re += C * he, nt += C * rr, je += C * dr, pt += C * pr, it += C * Qt, et += C * gr, St += C * lr, Tt += C * Rr, At += C * mr, _t += C * wr, ht += C * $r, xt += C * Br, st += C * Ir, yt += C * nn, ut += C * sn, ot += C * on, C = z[6], nt += C * he, je += C * rr, pt += C * dr, it += C * pr, et += C * Qt, St += C * gr, Tt += C * lr, At += C * Rr, _t += C * mr, ht += C * wr, xt += C * $r, st += C * Br, yt += C * Ir, ut += C * nn, ot += C * sn, Se += C * on, C = z[7], je += C * he, pt += C * rr, it += C * dr, et += C * pr, St += C * Qt, Tt += C * gr, At += C * lr, _t += C * Rr, ht += C * mr, xt += C * wr, st += C * $r, yt += C * Br, ut += C * Ir, ot += C * nn, Se += C * sn, Ae += C * on, C = z[8], pt += C * he, it += C * rr, et += C * dr, St += C * pr, Tt += C * Qt, At += C * gr, _t += C * lr, ht += C * Rr, xt += C * mr, st += C * wr, yt += C * $r, ut += C * Br, ot += C * Ir, Se += C * nn, Ae += C * sn, Ve += C * on, C = z[9], it += C * he, et += C * rr, St += C * dr, Tt += C * pr, At += C * Qt, _t += C * gr, ht += C * lr, xt += C * Rr, st += C * mr, yt += C * wr, ut += C * $r, ot += C * Br, Se += C * Ir, Ae += C * nn, Ve += C * sn, Fe += C * on, C = z[10], et += C * he, St += C * rr, Tt += C * dr, At += C * pr, _t += C * Qt, ht += C * gr, xt += C * lr, st += C * Rr, yt += C * mr, ut += C * wr, ot += C * $r, Se += C * Br, Ae += C * Ir, Ve += C * nn, Fe += C * sn, Ue += C * on, C = z[11], St += C * he, Tt += C * rr, At += C * dr, _t += C * pr, ht += C * Qt, xt += C * gr, st += C * lr, yt += C * Rr, ut += C * mr, ot += C * wr, Se += C * $r, Ae += C * Br, Ve += C * Ir, Fe += C * nn, Ue += C * sn, Je += C * on, C = z[12], Tt += C * he, At += C * rr, _t += C * dr, ht += C * pr, xt += C * Qt, st += C * gr, yt += C * lr, ut += C * Rr, ot += C * mr, Se += C * wr, Ae += C * $r, Ve += C * Br, Fe += C * Ir, Ue += C * nn, Je += C * sn, Lt += C * on, C = z[13], At += C * he, _t += C * rr, ht += C * dr, xt += C * pr, st += C * Qt, yt += C * gr, ut += C * lr, ot += C * Rr, Se += C * mr, Ae += C * wr, Ve += C * $r, Fe += C * Br, Ue += C * Ir, Je += C * nn, Lt += C * sn, zt += C * on, C = z[14], _t += C * he, ht += C * rr, xt += C * dr, st += C * pr, yt += C * Qt, ut += C * gr, ot += C * lr, Se += C * Rr, Ae += C * mr, Ve += C * wr, Fe += C * $r, Ue += C * Br, Je += C * Ir, Lt += C * nn, zt += C * sn, Zt += C * on, C = z[15], ht += C * he, xt += C * rr, st += C * dr, yt += C * pr, ut += C * Qt, ot += C * gr, Se += C * lr, Ae += C * Rr, Ve += C * mr, Fe += C * wr, Ue += C * $r, Je += C * Br, Lt += C * Ir, zt += C * nn, Zt += C * sn, Wt += C * on, j += 38 * xt, se += 38 * st, de += 38 * yt, xe += 38 * ut, Te += 38 * ot, Re += 38 * Se, nt += 38 * Ae, je += 38 * Ve, pt += 38 * Fe, it += 38 * Ue, et += 38 * Je, St += 38 * Lt, Tt += 38 * zt, At += 38 * Zt, _t += 38 * Wt, G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = de + G + 65535, G = Math.floor(C / 65536), de = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = de + G + 65535, G = Math.floor(C / 65536), de = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), $[0] = j, $[1] = se, $[2] = de, $[3] = xe, $[4] = Te, $[5] = Re, $[6] = nt, $[7] = je, $[8] = pt, $[9] = it, $[10] = et, $[11] = St, $[12] = Tt, $[13] = At, $[14] = _t, $[15] = ht; } - function oe(k, q) { - D(k, q, q); + function oe($, z) { + D($, z, z); } - function Z(k, q) { - var W = r(), C; - for (C = 0; C < 16; C++) W[C] = q[C]; + function Z($, z) { + var H = r(), C; + for (C = 0; C < 16; C++) H[C] = z[C]; for (C = 253; C >= 0; C--) - oe(W, W), C !== 2 && C !== 4 && D(W, W, q); - for (C = 0; C < 16; C++) k[C] = W[C]; + oe(H, H), C !== 2 && C !== 4 && D(H, H, z); + for (C = 0; C < 16; C++) $[C] = H[C]; } - function J(k, q) { - var W = r(), C; - for (C = 0; C < 16; C++) W[C] = q[C]; + function J($, z) { + var H = r(), C; + for (C = 0; C < 16; C++) H[C] = z[C]; for (C = 250; C >= 0; C--) - oe(W, W), C !== 1 && D(W, W, q); - for (C = 0; C < 16; C++) k[C] = W[C]; + oe(H, H), C !== 1 && D(H, H, z); + for (C = 0; C < 16; C++) $[C] = H[C]; } - function Q(k, q, W) { + function ee($, z, H) { var C = new Uint8Array(32), G = new Float64Array(80), j, se, de = r(), xe = r(), Te = r(), Re = r(), nt = r(), je = r(); - for (se = 0; se < 31; se++) C[se] = q[se]; - for (C[31] = q[31] & 127 | 64, C[0] &= 248, I(G, W), se = 0; se < 16; se++) + for (se = 0; se < 31; se++) C[se] = z[se]; + for (C[31] = z[31] & 127 | 64, C[0] &= 248, I(G, H), se = 0; se < 16; se++) xe[se] = G[se], Re[se] = de[se] = Te[se] = 0; for (de[0] = Re[0] = 1, se = 254; se >= 0; --se) - j = C[se >>> 3] >>> (se & 7) & 1, _(de, xe, j), _(Te, Re, j), F(nt, de, Te), ce(de, de, Te), F(Te, xe, Re), ce(xe, xe, Re), oe(Re, nt), oe(je, de), D(de, Te, de), D(Te, xe, nt), F(nt, de, Te), ce(de, de, Te), oe(xe, de), ce(Te, Re, je), D(de, Te, u), F(de, de, Re), D(Te, Te, de), D(de, Re, je), D(Re, xe, G), oe(xe, nt), _(de, xe, j), _(Te, Re, j); + j = C[se >>> 3] >>> (se & 7) & 1, E(de, xe, j), E(Te, Re, j), F(nt, de, Te), ce(de, de, Te), F(Te, xe, Re), ce(xe, xe, Re), oe(Re, nt), oe(je, de), D(de, Te, de), D(Te, xe, nt), F(nt, de, Te), ce(de, de, Te), oe(xe, de), ce(Te, Re, je), D(de, Te, u), F(de, de, Re), D(Te, Te, de), D(de, Re, je), D(Re, xe, G), oe(xe, nt), E(de, xe, j), E(Te, Re, j); for (se = 0; se < 16; se++) G[se + 16] = de[se], G[se + 32] = Te[se], G[se + 48] = xe[se], G[se + 64] = Re[se]; var pt = G.subarray(32), it = G.subarray(16); - return Z(pt, pt), D(it, it, pt), E(k, it), 0; + return Z(pt, pt), D(it, it, pt), S($, it), 0; } - function T(k, q) { - return Q(k, q, s); + function T($, z) { + return ee($, z, s); } - function X(k, q) { - return n(q, 32), T(k, q); + function X($, z) { + return n(z, 32), T($, z); } - function re(k, q, W) { + function re($, z, H) { var C = new Uint8Array(32); - return Q(C, W, q), V(k, i, C, te); + return ee(C, H, z), V($, i, C, Q); } var pe = f, ie = g; - function ue(k, q, W, C, G, j) { + function ue($, z, H, C, G, j) { var se = new Uint8Array(32); - return re(se, G, j), pe(k, q, W, C, se); + return re(se, G, j), pe($, z, H, C, se); } - function ve(k, q, W, C, G, j) { + function ve($, z, H, C, G, j) { var se = new Uint8Array(32); - return re(se, G, j), ie(k, q, W, C, se); + return re(se, G, j), ie($, z, H, C, se); } var Pe = [ 1116352408, @@ -40674,115 +41194,115 @@ var V9 = { exports: {} }; 1816402316, 1246189591 ]; - function De(k, q, W, C) { - for (var G = new Int32Array(16), j = new Int32Array(16), se, de, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, bt, ut, ot, Se, Ae, Ve, Fe, Ue, Je, Lt = k[0], zt = k[1], Zt = k[2], Wt = k[3], he = k[4], rr = k[5], dr = k[6], pr = k[7], Qt = q[0], gr = q[1], lr = q[2], Rr = q[3], mr = q[4], yr = q[5], $r = q[6], Br = q[7], Ir = 0; C >= 128; ) { + function De($, z, H, C) { + for (var G = new Int32Array(16), j = new Int32Array(16), se, de, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, yt, ut, ot, Se, Ae, Ve, Fe, Ue, Je, Lt = $[0], zt = $[1], Zt = $[2], Wt = $[3], he = $[4], rr = $[5], dr = $[6], pr = $[7], Qt = z[0], gr = z[1], lr = z[2], Rr = z[3], mr = z[4], wr = z[5], $r = z[6], Br = z[7], Ir = 0; C >= 128; ) { for (ut = 0; ut < 16; ut++) - ot = 8 * ut + Ir, G[ut] = W[ot + 0] << 24 | W[ot + 1] << 16 | W[ot + 2] << 8 | W[ot + 3], j[ut] = W[ot + 4] << 24 | W[ot + 5] << 16 | W[ot + 6] << 8 | W[ot + 7]; + ot = 8 * ut + Ir, G[ut] = H[ot + 0] << 24 | H[ot + 1] << 16 | H[ot + 2] << 8 | H[ot + 3], j[ut] = H[ot + 4] << 24 | H[ot + 5] << 16 | H[ot + 6] << 8 | H[ot + 7]; for (ut = 0; ut < 80; ut++) - if (se = Lt, de = zt, xe = Zt, Te = Wt, Re = he, nt = rr, je = dr, pt = pr, it = Qt, et = gr, St = lr, Tt = Rr, At = mr, _t = yr, ht = $r, xt = Br, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (he >>> 14 | mr << 18) ^ (he >>> 18 | mr << 14) ^ (mr >>> 9 | he << 23), Ae = (mr >>> 14 | he << 18) ^ (mr >>> 18 | he << 14) ^ (he >>> 9 | mr << 23), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = he & rr ^ ~he & dr, Ae = mr & yr ^ ~mr & $r, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Pe[ut * 2], Ae = Pe[ut * 2 + 1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = G[ut % 16], Ae = j[ut % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, st = Ue & 65535 | Je << 16, bt = Ve & 65535 | Fe << 16, Se = st, Ae = bt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (Lt >>> 28 | Qt << 4) ^ (Qt >>> 2 | Lt << 30) ^ (Qt >>> 7 | Lt << 25), Ae = (Qt >>> 28 | Lt << 4) ^ (Lt >>> 2 | Qt << 30) ^ (Lt >>> 7 | Qt << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Lt & zt ^ Lt & Zt ^ zt & Zt, Ae = Qt & gr ^ Qt & lr ^ gr & lr, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, pt = Ue & 65535 | Je << 16, xt = Ve & 65535 | Fe << 16, Se = Te, Ae = Tt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = st, Ae = bt, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, Te = Ue & 65535 | Je << 16, Tt = Ve & 65535 | Fe << 16, zt = se, Zt = de, Wt = xe, he = Te, rr = Re, dr = nt, pr = je, Lt = pt, gr = it, lr = et, Rr = St, mr = Tt, yr = At, $r = _t, Br = ht, Qt = xt, ut % 16 === 15) + if (se = Lt, de = zt, xe = Zt, Te = Wt, Re = he, nt = rr, je = dr, pt = pr, it = Qt, et = gr, St = lr, Tt = Rr, At = mr, _t = wr, ht = $r, xt = Br, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (he >>> 14 | mr << 18) ^ (he >>> 18 | mr << 14) ^ (mr >>> 9 | he << 23), Ae = (mr >>> 14 | he << 18) ^ (mr >>> 18 | he << 14) ^ (he >>> 9 | mr << 23), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = he & rr ^ ~he & dr, Ae = mr & wr ^ ~mr & $r, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Pe[ut * 2], Ae = Pe[ut * 2 + 1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = G[ut % 16], Ae = j[ut % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, st = Ue & 65535 | Je << 16, yt = Ve & 65535 | Fe << 16, Se = st, Ae = yt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (Lt >>> 28 | Qt << 4) ^ (Qt >>> 2 | Lt << 30) ^ (Qt >>> 7 | Lt << 25), Ae = (Qt >>> 28 | Lt << 4) ^ (Lt >>> 2 | Qt << 30) ^ (Lt >>> 7 | Qt << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Lt & zt ^ Lt & Zt ^ zt & Zt, Ae = Qt & gr ^ Qt & lr ^ gr & lr, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, pt = Ue & 65535 | Je << 16, xt = Ve & 65535 | Fe << 16, Se = Te, Ae = Tt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = st, Ae = yt, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, Te = Ue & 65535 | Je << 16, Tt = Ve & 65535 | Fe << 16, zt = se, Zt = de, Wt = xe, he = Te, rr = Re, dr = nt, pr = je, Lt = pt, gr = it, lr = et, Rr = St, mr = Tt, wr = At, $r = _t, Br = ht, Qt = xt, ut % 16 === 15) for (ot = 0; ot < 16; ot++) - Se = G[ot], Ae = j[ot], Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = G[(ot + 9) % 16], Ae = j[(ot + 9) % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, st = G[(ot + 1) % 16], bt = j[(ot + 1) % 16], Se = (st >>> 1 | bt << 31) ^ (st >>> 8 | bt << 24) ^ st >>> 7, Ae = (bt >>> 1 | st << 31) ^ (bt >>> 8 | st << 24) ^ (bt >>> 7 | st << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, st = G[(ot + 14) % 16], bt = j[(ot + 14) % 16], Se = (st >>> 19 | bt << 13) ^ (bt >>> 29 | st << 3) ^ st >>> 6, Ae = (bt >>> 19 | st << 13) ^ (st >>> 29 | bt << 3) ^ (bt >>> 6 | st << 26), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, G[ot] = Ue & 65535 | Je << 16, j[ot] = Ve & 65535 | Fe << 16; - Se = Lt, Ae = Qt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[0], Ae = q[0], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[0] = Lt = Ue & 65535 | Je << 16, q[0] = Qt = Ve & 65535 | Fe << 16, Se = zt, Ae = gr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[1], Ae = q[1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[1] = zt = Ue & 65535 | Je << 16, q[1] = gr = Ve & 65535 | Fe << 16, Se = Zt, Ae = lr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[2], Ae = q[2], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[2] = Zt = Ue & 65535 | Je << 16, q[2] = lr = Ve & 65535 | Fe << 16, Se = Wt, Ae = Rr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[3], Ae = q[3], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[3] = Wt = Ue & 65535 | Je << 16, q[3] = Rr = Ve & 65535 | Fe << 16, Se = he, Ae = mr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[4], Ae = q[4], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[4] = he = Ue & 65535 | Je << 16, q[4] = mr = Ve & 65535 | Fe << 16, Se = rr, Ae = yr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[5], Ae = q[5], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[5] = rr = Ue & 65535 | Je << 16, q[5] = yr = Ve & 65535 | Fe << 16, Se = dr, Ae = $r, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[6], Ae = q[6], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[6] = dr = Ue & 65535 | Je << 16, q[6] = $r = Ve & 65535 | Fe << 16, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = k[7], Ae = q[7], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, k[7] = pr = Ue & 65535 | Je << 16, q[7] = Br = Ve & 65535 | Fe << 16, Ir += 128, C -= 128; + Se = G[ot], Ae = j[ot], Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = G[(ot + 9) % 16], Ae = j[(ot + 9) % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, st = G[(ot + 1) % 16], yt = j[(ot + 1) % 16], Se = (st >>> 1 | yt << 31) ^ (st >>> 8 | yt << 24) ^ st >>> 7, Ae = (yt >>> 1 | st << 31) ^ (yt >>> 8 | st << 24) ^ (yt >>> 7 | st << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, st = G[(ot + 14) % 16], yt = j[(ot + 14) % 16], Se = (st >>> 19 | yt << 13) ^ (yt >>> 29 | st << 3) ^ st >>> 6, Ae = (yt >>> 19 | st << 13) ^ (st >>> 29 | yt << 3) ^ (yt >>> 6 | st << 26), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, G[ot] = Ue & 65535 | Je << 16, j[ot] = Ve & 65535 | Fe << 16; + Se = Lt, Ae = Qt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[0], Ae = z[0], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[0] = Lt = Ue & 65535 | Je << 16, z[0] = Qt = Ve & 65535 | Fe << 16, Se = zt, Ae = gr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[1], Ae = z[1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[1] = zt = Ue & 65535 | Je << 16, z[1] = gr = Ve & 65535 | Fe << 16, Se = Zt, Ae = lr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[2], Ae = z[2], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[2] = Zt = Ue & 65535 | Je << 16, z[2] = lr = Ve & 65535 | Fe << 16, Se = Wt, Ae = Rr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[3], Ae = z[3], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[3] = Wt = Ue & 65535 | Je << 16, z[3] = Rr = Ve & 65535 | Fe << 16, Se = he, Ae = mr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[4], Ae = z[4], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[4] = he = Ue & 65535 | Je << 16, z[4] = mr = Ve & 65535 | Fe << 16, Se = rr, Ae = wr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[5], Ae = z[5], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[5] = rr = Ue & 65535 | Je << 16, z[5] = wr = Ve & 65535 | Fe << 16, Se = dr, Ae = $r, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[6], Ae = z[6], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[6] = dr = Ue & 65535 | Je << 16, z[6] = $r = Ve & 65535 | Fe << 16, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[7], Ae = z[7], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[7] = pr = Ue & 65535 | Je << 16, z[7] = Br = Ve & 65535 | Fe << 16, Ir += 128, C -= 128; } return C; } - function Ce(k, q, W) { - var C = new Int32Array(8), G = new Int32Array(8), j = new Uint8Array(256), se, de = W; - for (C[0] = 1779033703, C[1] = 3144134277, C[2] = 1013904242, C[3] = 2773480762, C[4] = 1359893119, C[5] = 2600822924, C[6] = 528734635, C[7] = 1541459225, G[0] = 4089235720, G[1] = 2227873595, G[2] = 4271175723, G[3] = 1595750129, G[4] = 2917565137, G[5] = 725511199, G[6] = 4215389547, G[7] = 327033209, De(C, G, q, W), W %= 128, se = 0; se < W; se++) j[se] = q[de - W + se]; - for (j[W] = 128, W = 256 - 128 * (W < 112 ? 1 : 0), j[W - 9] = 0, M(j, W - 8, de / 536870912 | 0, de << 3), De(C, G, j, W), se = 0; se < 8; se++) M(k, 8 * se, C[se], G[se]); + function Ce($, z, H) { + var C = new Int32Array(8), G = new Int32Array(8), j = new Uint8Array(256), se, de = H; + for (C[0] = 1779033703, C[1] = 3144134277, C[2] = 1013904242, C[3] = 2773480762, C[4] = 1359893119, C[5] = 2600822924, C[6] = 528734635, C[7] = 1541459225, G[0] = 4089235720, G[1] = 2227873595, G[2] = 4271175723, G[3] = 1595750129, G[4] = 2917565137, G[5] = 725511199, G[6] = 4215389547, G[7] = 327033209, De(C, G, z, H), H %= 128, se = 0; se < H; se++) j[se] = z[de - H + se]; + for (j[H] = 128, H = 256 - 128 * (H < 112 ? 1 : 0), j[H - 9] = 0, P(j, H - 8, de / 536870912 | 0, de << 3), De(C, G, j, H), se = 0; se < 8; se++) P($, 8 * se, C[se], G[se]); return 0; } - function $e(k, q) { - var W = r(), C = r(), G = r(), j = r(), se = r(), de = r(), xe = r(), Te = r(), Re = r(); - ce(W, k[1], k[0]), ce(Re, q[1], q[0]), D(W, W, Re), F(C, k[0], k[1]), F(Re, q[0], q[1]), D(C, C, Re), D(G, k[3], q[3]), D(G, G, d), D(j, k[2], q[2]), F(j, j, j), ce(se, C, W), ce(de, j, G), F(xe, j, G), F(Te, C, W), D(k[0], se, de), D(k[1], Te, xe), D(k[2], xe, de), D(k[3], se, Te); + function $e($, z) { + var H = r(), C = r(), G = r(), j = r(), se = r(), de = r(), xe = r(), Te = r(), Re = r(); + ce(H, $[1], $[0]), ce(Re, z[1], z[0]), D(H, H, Re), F(C, $[0], $[1]), F(Re, z[0], z[1]), D(C, C, Re), D(G, $[3], z[3]), D(G, G, d), D(j, $[2], z[2]), F(j, j, j), ce(se, C, H), ce(de, j, G), F(xe, j, G), F(Te, C, H), D($[0], se, de), D($[1], Te, xe), D($[2], xe, de), D($[3], se, Te); } - function Me(k, q, W) { + function Me($, z, H) { var C; for (C = 0; C < 4; C++) - _(k[C], q[C], W); + E($[C], z[C], H); } - function Ne(k, q) { - var W = r(), C = r(), G = r(); - Z(G, q[2]), D(W, q[0], G), D(C, q[1], G), E(k, C), k[31] ^= P(W) << 7; + function Ne($, z) { + var H = r(), C = r(), G = r(); + Z(G, z[2]), D(H, z[0], G), D(C, z[1], G), S($, C), $[31] ^= M(H) << 7; } - function Ke(k, q, W) { + function Ke($, z, H) { var C, G; - for (b(k[0], o), b(k[1], a), b(k[2], a), b(k[3], o), G = 255; G >= 0; --G) - C = W[G / 8 | 0] >> (G & 7) & 1, Me(k, q, C), $e(q, k), $e(k, k), Me(k, q, C); + for (b($[0], o), b($[1], a), b($[2], a), b($[3], o), G = 255; G >= 0; --G) + C = H[G / 8 | 0] >> (G & 7) & 1, Me($, z, C), $e(z, $), $e($, $), Me($, z, C); } - function Le(k, q) { - var W = [r(), r(), r(), r()]; - b(W[0], p), b(W[1], w), b(W[2], a), D(W[3], p, w), Ke(k, W, q); + function Le($, z) { + var H = [r(), r(), r(), r()]; + b(H[0], p), b(H[1], w), b(H[2], a), D(H[3], p, w), Ke($, H, z); } - function qe(k, q, W) { + function qe($, z, H) { var C = new Uint8Array(64), G = [r(), r(), r(), r()], j; - for (W || n(q, 32), Ce(C, q, 32), C[0] &= 248, C[31] &= 127, C[31] |= 64, Le(G, C), Ne(k, G), j = 0; j < 32; j++) q[j + 32] = k[j]; + for (H || n(z, 32), Ce(C, z, 32), C[0] &= 248, C[31] &= 127, C[31] |= 64, Le(G, C), Ne($, G), j = 0; j < 32; j++) z[j + 32] = $[j]; return 0; } var ze = new Float64Array([237, 211, 245, 92, 26, 99, 18, 88, 214, 156, 247, 162, 222, 249, 222, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16]); - function _e(k, q) { - var W, C, G, j; + function _e($, z) { + var H, C, G, j; for (C = 63; C >= 32; --C) { - for (W = 0, G = C - 32, j = C - 12; G < j; ++G) - q[G] += W - 16 * q[C] * ze[G - (C - 32)], W = Math.floor((q[G] + 128) / 256), q[G] -= W * 256; - q[G] += W, q[C] = 0; + for (H = 0, G = C - 32, j = C - 12; G < j; ++G) + z[G] += H - 16 * z[C] * ze[G - (C - 32)], H = Math.floor((z[G] + 128) / 256), z[G] -= H * 256; + z[G] += H, z[C] = 0; } - for (W = 0, G = 0; G < 32; G++) - q[G] += W - (q[31] >> 4) * ze[G], W = q[G] >> 8, q[G] &= 255; - for (G = 0; G < 32; G++) q[G] -= W * ze[G]; + for (H = 0, G = 0; G < 32; G++) + z[G] += H - (z[31] >> 4) * ze[G], H = z[G] >> 8, z[G] &= 255; + for (G = 0; G < 32; G++) z[G] -= H * ze[G]; for (C = 0; C < 32; C++) - q[C + 1] += q[C] >> 8, k[C] = q[C] & 255; + z[C + 1] += z[C] >> 8, $[C] = z[C] & 255; } - function Ze(k) { - var q = new Float64Array(64), W; - for (W = 0; W < 64; W++) q[W] = k[W]; - for (W = 0; W < 64; W++) k[W] = 0; - _e(k, q); + function Ze($) { + var z = new Float64Array(64), H; + for (H = 0; H < 64; H++) z[H] = $[H]; + for (H = 0; H < 64; H++) $[H] = 0; + _e($, z); } - function at(k, q, W, C) { + function at($, z, H, C) { var G = new Uint8Array(64), j = new Uint8Array(64), se = new Uint8Array(64), de, xe, Te = new Float64Array(64), Re = [r(), r(), r(), r()]; Ce(G, C, 32), G[0] &= 248, G[31] &= 127, G[31] |= 64; - var nt = W + 64; - for (de = 0; de < W; de++) k[64 + de] = q[de]; - for (de = 0; de < 32; de++) k[32 + de] = G[32 + de]; - for (Ce(se, k.subarray(32), W + 32), Ze(se), Le(Re, se), Ne(k, Re), de = 32; de < 64; de++) k[de] = C[de]; - for (Ce(j, k, W + 64), Ze(j), de = 0; de < 64; de++) Te[de] = 0; + var nt = H + 64; + for (de = 0; de < H; de++) $[64 + de] = z[de]; + for (de = 0; de < 32; de++) $[32 + de] = G[32 + de]; + for (Ce(se, $.subarray(32), H + 32), Ze(se), Le(Re, se), Ne($, Re), de = 32; de < 64; de++) $[de] = C[de]; + for (Ce(j, $, H + 64), Ze(j), de = 0; de < 64; de++) Te[de] = 0; for (de = 0; de < 32; de++) Te[de] = se[de]; for (de = 0; de < 32; de++) for (xe = 0; xe < 32; xe++) Te[de + xe] += j[de] * G[xe]; - return _e(k.subarray(32), Te), nt; + return _e($.subarray(32), Te), nt; } - function ke(k, q) { - var W = r(), C = r(), G = r(), j = r(), se = r(), de = r(), xe = r(); - return b(k[2], a), I(k[1], q), oe(G, k[1]), D(j, G, l), ce(G, G, k[2]), F(j, k[2], j), oe(se, j), oe(de, se), D(xe, de, se), D(W, xe, G), D(W, W, j), J(W, W), D(W, W, G), D(W, W, j), D(W, W, j), D(k[0], W, j), oe(C, k[0]), D(C, C, j), v(C, G) && D(k[0], k[0], A), oe(C, k[0]), D(C, C, j), v(C, G) ? -1 : (P(k[0]) === q[31] >> 7 && ce(k[0], o, k[0]), D(k[3], k[0], k[1]), 0); + function ke($, z) { + var H = r(), C = r(), G = r(), j = r(), se = r(), de = r(), xe = r(); + return b($[2], a), I($[1], z), oe(G, $[1]), D(j, G, l), ce(G, G, $[2]), F(j, $[2], j), oe(se, j), oe(de, se), D(xe, de, se), D(H, xe, G), D(H, H, j), J(H, H), D(H, H, G), D(H, H, j), D(H, H, j), D($[0], H, j), oe(C, $[0]), D(C, C, j), v(C, G) && D($[0], $[0], _), oe(C, $[0]), D(C, C, j), v(C, G) ? -1 : (M($[0]) === z[31] >> 7 && ce($[0], o, $[0]), D($[3], $[0], $[1]), 0); } - function Qe(k, q, W, C) { + function Qe($, z, H, C) { var G, j = new Uint8Array(32), se = new Uint8Array(64), de = [r(), r(), r(), r()], xe = [r(), r(), r(), r()]; - if (W < 64 || ke(xe, C)) return -1; - for (G = 0; G < W; G++) k[G] = q[G]; - for (G = 0; G < 32; G++) k[G + 32] = C[G]; - if (Ce(se, k, W), Ze(se), Ke(de, xe, se), Le(xe, q.subarray(32)), $e(de, xe), Ne(j, de), W -= 64, B(q, 0, j, 0)) { - for (G = 0; G < W; G++) k[G] = 0; + if (H < 64 || ke(xe, C)) return -1; + for (G = 0; G < H; G++) $[G] = z[G]; + for (G = 0; G < 32; G++) $[G + 32] = C[G]; + if (Ce(se, $, H), Ze(se), Ke(de, xe, se), Le(xe, z.subarray(32)), $e(de, xe), Ne(j, de), H -= 64, B(z, 0, j, 0)) { + for (G = 0; G < H; G++) $[G] = 0; return -1; } - for (G = 0; G < W; G++) k[G] = q[G + 64]; - return W; + for (G = 0; G < H; G++) $[G] = z[G + 64]; + return H; } - var tt = 32, Ye = 24, dt = 32, lt = 16, ct = 32, qt = 32, Jt = 32, Et = 32, er = 32, Xt = Ye, Dt = dt, kt = lt, Ct = 64, gt = 32, Rt = 64, Nt = 32, vt = 64; + var tt = 32, Ye = 24, dt = 32, lt = 16, ct = 32, qt = 32, Jt = 32, Et = 32, er = 32, Xt = Ye, Dt = dt, kt = lt, Ct = 64, mt = 32, Rt = 64, Nt = 32, bt = 64; e.lowlevel = { crypto_core_hsalsa20: V, crypto_stream_xor: Ee, crypto_stream: ge, crypto_stream_salsa20_xor: R, crypto_stream_salsa20: K, - crypto_onetimeauth: S, + crypto_onetimeauth: A, crypto_onetimeauth_verify: m, crypto_verify_16: L, crypto_verify_32: B, crypto_secretbox: f, crypto_secretbox_open: g, - crypto_scalarmult: Q, + crypto_scalarmult: ee, crypto_scalarmult_base: T, crypto_box_beforenm: re, crypto_box_afternm: pe, @@ -40806,14 +41326,14 @@ var V9 = { exports: {} }; crypto_box_ZEROBYTES: Dt, crypto_box_BOXZEROBYTES: kt, crypto_sign_BYTES: Ct, - crypto_sign_PUBLICKEYBYTES: gt, + crypto_sign_PUBLICKEYBYTES: mt, crypto_sign_SECRETKEYBYTES: Rt, crypto_sign_SEEDBYTES: Nt, - crypto_hash_BYTES: vt, + crypto_hash_BYTES: bt, gf: r, D: l, L: ze, - pack25519: E, + pack25519: S, unpack25519: I, M: D, A: F, @@ -40826,170 +41346,170 @@ var V9 = { exports: {} }; scalarmult: Ke, scalarbase: Le }; - function $t(k, q) { - if (k.length !== tt) throw new Error("bad key size"); - if (q.length !== Ye) throw new Error("bad nonce size"); + function $t($, z) { + if ($.length !== tt) throw new Error("bad key size"); + if (z.length !== Ye) throw new Error("bad nonce size"); } - function Ft(k, q) { - if (k.length !== Jt) throw new Error("bad public key size"); - if (q.length !== Et) throw new Error("bad secret key size"); + function Ft($, z) { + if ($.length !== Jt) throw new Error("bad public key size"); + if (z.length !== Et) throw new Error("bad secret key size"); } function rt() { - for (var k = 0; k < arguments.length; k++) - if (!(arguments[k] instanceof Uint8Array)) + for (var $ = 0; $ < arguments.length; $++) + if (!(arguments[$] instanceof Uint8Array)) throw new TypeError("unexpected type, use Uint8Array"); } - function Bt(k) { - for (var q = 0; q < k.length; q++) k[q] = 0; - } - e.randomBytes = function(k) { - var q = new Uint8Array(k); - return n(q, k), q; - }, e.secretbox = function(k, q, W) { - rt(k, q, W), $t(W, q); - for (var C = new Uint8Array(dt + k.length), G = new Uint8Array(C.length), j = 0; j < k.length; j++) C[j + dt] = k[j]; - return f(G, C, C.length, q, W), G.subarray(lt); - }, e.secretbox.open = function(k, q, W) { - rt(k, q, W), $t(W, q); - for (var C = new Uint8Array(lt + k.length), G = new Uint8Array(C.length), j = 0; j < k.length; j++) C[j + lt] = k[j]; - return C.length < 32 || g(G, C, C.length, q, W) !== 0 ? null : G.subarray(dt); - }, e.secretbox.keyLength = tt, e.secretbox.nonceLength = Ye, e.secretbox.overheadLength = lt, e.scalarMult = function(k, q) { - if (rt(k, q), k.length !== qt) throw new Error("bad n size"); - if (q.length !== ct) throw new Error("bad p size"); - var W = new Uint8Array(ct); - return Q(W, k, q), W; - }, e.scalarMult.base = function(k) { - if (rt(k), k.length !== qt) throw new Error("bad n size"); - var q = new Uint8Array(ct); - return T(q, k), q; - }, e.scalarMult.scalarLength = qt, e.scalarMult.groupElementLength = ct, e.box = function(k, q, W, C) { - var G = e.box.before(W, C); - return e.secretbox(k, q, G); - }, e.box.before = function(k, q) { - rt(k, q), Ft(k, q); - var W = new Uint8Array(er); - return re(W, k, q), W; - }, e.box.after = e.secretbox, e.box.open = function(k, q, W, C) { - var G = e.box.before(W, C); - return e.secretbox.open(k, q, G); + function Bt($) { + for (var z = 0; z < $.length; z++) $[z] = 0; + } + e.randomBytes = function($) { + var z = new Uint8Array($); + return n(z, $), z; + }, e.secretbox = function($, z, H) { + rt($, z, H), $t(H, z); + for (var C = new Uint8Array(dt + $.length), G = new Uint8Array(C.length), j = 0; j < $.length; j++) C[j + dt] = $[j]; + return f(G, C, C.length, z, H), G.subarray(lt); + }, e.secretbox.open = function($, z, H) { + rt($, z, H), $t(H, z); + for (var C = new Uint8Array(lt + $.length), G = new Uint8Array(C.length), j = 0; j < $.length; j++) C[j + lt] = $[j]; + return C.length < 32 || g(G, C, C.length, z, H) !== 0 ? null : G.subarray(dt); + }, e.secretbox.keyLength = tt, e.secretbox.nonceLength = Ye, e.secretbox.overheadLength = lt, e.scalarMult = function($, z) { + if (rt($, z), $.length !== qt) throw new Error("bad n size"); + if (z.length !== ct) throw new Error("bad p size"); + var H = new Uint8Array(ct); + return ee(H, $, z), H; + }, e.scalarMult.base = function($) { + if (rt($), $.length !== qt) throw new Error("bad n size"); + var z = new Uint8Array(ct); + return T(z, $), z; + }, e.scalarMult.scalarLength = qt, e.scalarMult.groupElementLength = ct, e.box = function($, z, H, C) { + var G = e.box.before(H, C); + return e.secretbox($, z, G); + }, e.box.before = function($, z) { + rt($, z), Ft($, z); + var H = new Uint8Array(er); + return re(H, $, z), H; + }, e.box.after = e.secretbox, e.box.open = function($, z, H, C) { + var G = e.box.before(H, C); + return e.secretbox.open($, z, G); }, e.box.open.after = e.secretbox.open, e.box.keyPair = function() { - var k = new Uint8Array(Jt), q = new Uint8Array(Et); - return X(k, q), { publicKey: k, secretKey: q }; - }, e.box.keyPair.fromSecretKey = function(k) { - if (rt(k), k.length !== Et) + var $ = new Uint8Array(Jt), z = new Uint8Array(Et); + return X($, z), { publicKey: $, secretKey: z }; + }, e.box.keyPair.fromSecretKey = function($) { + if (rt($), $.length !== Et) throw new Error("bad secret key size"); - var q = new Uint8Array(Jt); - return T(q, k), { publicKey: q, secretKey: new Uint8Array(k) }; - }, e.box.publicKeyLength = Jt, e.box.secretKeyLength = Et, e.box.sharedKeyLength = er, e.box.nonceLength = Xt, e.box.overheadLength = e.secretbox.overheadLength, e.sign = function(k, q) { - if (rt(k, q), q.length !== Rt) + var z = new Uint8Array(Jt); + return T(z, $), { publicKey: z, secretKey: new Uint8Array($) }; + }, e.box.publicKeyLength = Jt, e.box.secretKeyLength = Et, e.box.sharedKeyLength = er, e.box.nonceLength = Xt, e.box.overheadLength = e.secretbox.overheadLength, e.sign = function($, z) { + if (rt($, z), z.length !== Rt) throw new Error("bad secret key size"); - var W = new Uint8Array(Ct + k.length); - return at(W, k, k.length, q), W; - }, e.sign.open = function(k, q) { - if (rt(k, q), q.length !== gt) + var H = new Uint8Array(Ct + $.length); + return at(H, $, $.length, z), H; + }, e.sign.open = function($, z) { + if (rt($, z), z.length !== mt) throw new Error("bad public key size"); - var W = new Uint8Array(k.length), C = Qe(W, k, k.length, q); + var H = new Uint8Array($.length), C = Qe(H, $, $.length, z); if (C < 0) return null; - for (var G = new Uint8Array(C), j = 0; j < G.length; j++) G[j] = W[j]; + for (var G = new Uint8Array(C), j = 0; j < G.length; j++) G[j] = H[j]; return G; - }, e.sign.detached = function(k, q) { - for (var W = e.sign(k, q), C = new Uint8Array(Ct), G = 0; G < C.length; G++) C[G] = W[G]; + }, e.sign.detached = function($, z) { + for (var H = e.sign($, z), C = new Uint8Array(Ct), G = 0; G < C.length; G++) C[G] = H[G]; return C; - }, e.sign.detached.verify = function(k, q, W) { - if (rt(k, q, W), q.length !== Ct) + }, e.sign.detached.verify = function($, z, H) { + if (rt($, z, H), z.length !== Ct) throw new Error("bad signature size"); - if (W.length !== gt) + if (H.length !== mt) throw new Error("bad public key size"); - var C = new Uint8Array(Ct + k.length), G = new Uint8Array(Ct + k.length), j; - for (j = 0; j < Ct; j++) C[j] = q[j]; - for (j = 0; j < k.length; j++) C[j + Ct] = k[j]; - return Qe(G, C, C.length, W) >= 0; + var C = new Uint8Array(Ct + $.length), G = new Uint8Array(Ct + $.length), j; + for (j = 0; j < Ct; j++) C[j] = z[j]; + for (j = 0; j < $.length; j++) C[j + Ct] = $[j]; + return Qe(G, C, C.length, H) >= 0; }, e.sign.keyPair = function() { - var k = new Uint8Array(gt), q = new Uint8Array(Rt); - return qe(k, q), { publicKey: k, secretKey: q }; - }, e.sign.keyPair.fromSecretKey = function(k) { - if (rt(k), k.length !== Rt) + var $ = new Uint8Array(mt), z = new Uint8Array(Rt); + return qe($, z), { publicKey: $, secretKey: z }; + }, e.sign.keyPair.fromSecretKey = function($) { + if (rt($), $.length !== Rt) throw new Error("bad secret key size"); - for (var q = new Uint8Array(gt), W = 0; W < q.length; W++) q[W] = k[32 + W]; - return { publicKey: q, secretKey: new Uint8Array(k) }; - }, e.sign.keyPair.fromSeed = function(k) { - if (rt(k), k.length !== Nt) + for (var z = new Uint8Array(mt), H = 0; H < z.length; H++) z[H] = $[32 + H]; + return { publicKey: z, secretKey: new Uint8Array($) }; + }, e.sign.keyPair.fromSeed = function($) { + if (rt($), $.length !== Nt) throw new Error("bad seed size"); - for (var q = new Uint8Array(gt), W = new Uint8Array(Rt), C = 0; C < 32; C++) W[C] = k[C]; - return qe(q, W, !0), { publicKey: q, secretKey: W }; - }, e.sign.publicKeyLength = gt, e.sign.secretKeyLength = Rt, e.sign.seedLength = Nt, e.sign.signatureLength = Ct, e.hash = function(k) { - rt(k); - var q = new Uint8Array(vt); - return Ce(q, k, k.length), q; - }, e.hash.hashLength = vt, e.verify = function(k, q) { - return rt(k, q), k.length === 0 || q.length === 0 || k.length !== q.length ? !1 : N(k, 0, q, 0, k.length) === 0; - }, e.setPRNG = function(k) { - n = k; + for (var z = new Uint8Array(mt), H = new Uint8Array(Rt), C = 0; C < 32; C++) H[C] = $[C]; + return qe(z, H, !0), { publicKey: z, secretKey: H }; + }, e.sign.publicKeyLength = mt, e.sign.secretKeyLength = Rt, e.sign.seedLength = Nt, e.sign.signatureLength = Ct, e.hash = function($) { + rt($); + var z = new Uint8Array(bt); + return Ce(z, $, $.length), z; + }, e.hash.hashLength = bt, e.verify = function($, z) { + return rt($, z), $.length === 0 || z.length === 0 || $.length !== z.length ? !1 : O($, 0, z, 0, $.length) === 0; + }, e.setPRNG = function($) { + n = $; }, function() { - var k = typeof self < "u" ? self.crypto || self.msCrypto : null; - if (k && k.getRandomValues) { - var q = 65536; - e.setPRNG(function(W, C) { + var $ = typeof self < "u" ? self.crypto || self.msCrypto : null; + if ($ && $.getRandomValues) { + var z = 65536; + e.setPRNG(function(H, C) { var G, j = new Uint8Array(C); - for (G = 0; G < C; G += q) - k.getRandomValues(j.subarray(G, G + Math.min(C - G, q))); - for (G = 0; G < C; G++) W[G] = j[G]; + for (G = 0; G < C; G += z) + $.getRandomValues(j.subarray(G, G + Math.min(C - G, z))); + for (G = 0; G < C; G++) H[G] = j[G]; Bt(j); }); - } else typeof P4 < "u" && (k = Wl, k && k.randomBytes && e.setPRNG(function(W, C) { - var G, j = k.randomBytes(C); - for (G = 0; G < C; G++) W[G] = j[G]; + } else typeof e8 < "u" && ($ = Ql, $ && $.randomBytes && e.setPRNG(function(H, C) { + var G, j = $.randomBytes(C); + for (G = 0; G < C; G++) H[G] = j[G]; Bt(j); })); }(); })(t.exports ? t.exports : self.nacl = self.nacl || {}); -})(V9); -var gie = V9.exports; -const yd = /* @__PURE__ */ ts(gie); -var fa; +})(xA); +var Gie = xA.exports; +const Td = /* @__PURE__ */ ns(Gie); +var ha; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.MANIFEST_NOT_FOUND_ERROR = 2] = "MANIFEST_NOT_FOUND_ERROR", t[t.MANIFEST_CONTENT_ERROR = 3] = "MANIFEST_CONTENT_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(fa || (fa = {})); -var h5; +})(ha || (ha = {})); +var I5; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(h5 || (h5 = {})); -var su; +})(I5 || (I5 = {})); +var gu; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(su || (su = {})); -var d5; +})(gu || (gu = {})); +var C5; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(d5 || (d5 = {})); -var p5; +})(C5 || (C5 = {})); +var T5; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(p5 || (p5 = {})); -var g5; +})(T5 || (T5 = {})); +var R5; (function(t) { t.MAINNET = "-239", t.TESTNET = "-3"; -})(g5 || (g5 = {})); -function mie(t, e) { - const r = Dl.encodeBase64(t); +})(R5 || (R5 = {})); +function Yie(t, e) { + const r = zl.encodeBase64(t); return e ? encodeURIComponent(r) : r; } -function vie(t, e) { - return e && (t = decodeURIComponent(t)), Dl.decodeBase64(t); +function Jie(t, e) { + return e && (t = decodeURIComponent(t)), zl.decodeBase64(t); } -function bie(t, e = !1) { +function Xie(t, e = !1) { let r; - return t instanceof Uint8Array ? r = t : (typeof t != "string" && (t = JSON.stringify(t)), r = Dl.decodeUTF8(t)), mie(r, e); + return t instanceof Uint8Array ? r = t : (typeof t != "string" && (t = JSON.stringify(t)), r = zl.decodeUTF8(t)), Yie(r, e); } -function yie(t, e = !1) { - const r = vie(t, e); +function Zie(t, e = !1) { + const r = Jie(t, e); return { toString() { - return Dl.encodeUTF8(r); + return zl.encodeUTF8(r); }, toObject() { try { - return JSON.parse(Dl.encodeUTF8(r)); + return JSON.parse(zl.encodeUTF8(r)); } catch { return null; } @@ -40999,27 +41519,27 @@ function yie(t, e = !1) { } }; } -const G9 = { - encode: bie, - decode: yie +const _A = { + encode: Xie, + decode: Zie }; -function wie(t, e) { +function Qie(t, e) { const r = new Uint8Array(t.length + e.length); return r.set(t), r.set(e, t.length), r; } -function xie(t, e) { +function ese(t, e) { if (e >= t.length) throw new Error("Index is out of buffer"); const r = t.slice(0, e), n = t.slice(e); return [r, n]; } -function Km(t) { +function o1(t) { let e = ""; return t.forEach((r) => { e += ("0" + (r & 255).toString(16)).slice(-2); }), e; } -function A0(t) { +function $0(t) { if (t.length % 2 !== 0) throw new Error(`Cannot convert ${t} to bytesArray`); const e = new Uint8Array(t.length / 2); @@ -41027,28 +41547,28 @@ function A0(t) { e[r / 2] = parseInt(t.slice(r, r + 2), 16); return e; } -class dv { +class Cv { constructor(e) { - this.nonceLength = 24, this.keyPair = e ? this.createKeypairFromString(e) : this.createKeypair(), this.sessionId = Km(this.keyPair.publicKey); + this.nonceLength = 24, this.keyPair = e ? this.createKeypairFromString(e) : this.createKeypair(), this.sessionId = o1(this.keyPair.publicKey); } createKeypair() { - return yd.box.keyPair(); + return Td.box.keyPair(); } createKeypairFromString(e) { return { - publicKey: A0(e.publicKey), - secretKey: A0(e.secretKey) + publicKey: $0(e.publicKey), + secretKey: $0(e.secretKey) }; } createNonce() { - return yd.randomBytes(this.nonceLength); + return Td.randomBytes(this.nonceLength); } encrypt(e, r) { - const n = new TextEncoder().encode(e), i = this.createNonce(), s = yd.box(n, i, r, this.keyPair.secretKey); - return wie(i, s); + const n = new TextEncoder().encode(e), i = this.createNonce(), s = Td.box(n, i, r, this.keyPair.secretKey); + return Qie(i, s); } decrypt(e, r) { - const [n, i] = xie(e, this.nonceLength), s = yd.box.open(i, n, r, this.keyPair.secretKey); + const [n, i] = ese(e, this.nonceLength), s = Td.box.open(i, n, r, this.keyPair.secretKey); if (!s) throw new Error(`Decryption error: message: ${e.toString()} @@ -41059,8 +41579,8 @@ class dv { } stringifyKeypair() { return { - publicKey: Km(this.keyPair.publicKey), - secretKey: Km(this.keyPair.secretKey) + publicKey: o1(this.keyPair.publicKey), + secretKey: o1(this.keyPair.secretKey) }; } } @@ -41078,7 +41598,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ -function _ie(t, e) { +function tse(t, e) { var r = {}; for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); if (t != null && typeof Object.getOwnPropertySymbols == "function") @@ -41123,121 +41643,121 @@ class jt extends Error { } } jt.prefix = "[TON_CONNECT_SDK_ERROR]"; -class fy extends jt { +class Sy extends jt { get info() { return "Passed DappMetadata is in incorrect format."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, fy.prototype); + super(...e), Object.setPrototypeOf(this, Sy.prototype); } } -class Ap extends jt { +class Fp extends jt { get info() { return "Passed `tonconnect-manifest.json` contains errors. Check format of your manifest. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, Ap.prototype); + super(...e), Object.setPrototypeOf(this, Fp.prototype); } } -class Pp extends jt { +class jp extends jt { get info() { return "Manifest not found. Make sure you added `tonconnect-manifest.json` to the root of your app or passed correct manifestUrl. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, Pp.prototype); + super(...e), Object.setPrototypeOf(this, jp.prototype); } } -class ly extends jt { +class Ay extends jt { get info() { return "Wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, ly.prototype); + super(...e), Object.setPrototypeOf(this, Ay.prototype); } } -class P0 extends jt { +class B0 extends jt { get info() { return "Send transaction or other protocol methods called while wallet is not connected."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, P0.prototype); + super(...e), Object.setPrototypeOf(this, B0.prototype); } } -function Eie(t) { +function rse(t) { return "jsBridgeKey" in t; } -class Mp extends jt { +class Up extends jt { get info() { return "User rejects the action in the wallet."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, Mp.prototype); + super(...e), Object.setPrototypeOf(this, Up.prototype); } } -class Ip extends jt { +class qp extends jt { get info() { return "Request to the wallet contains errors."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, Ip.prototype); + super(...e), Object.setPrototypeOf(this, qp.prototype); } } -class Cp extends jt { +class zp extends jt { get info() { return "App tries to send rpc request to the injected wallet while not connected."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, Cp.prototype); + super(...e), Object.setPrototypeOf(this, zp.prototype); } } -class hy extends jt { +class Py extends jt { get info() { return "There is an attempt to connect to the injected wallet while it is not exists in the webpage."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, hy.prototype); + super(...e), Object.setPrototypeOf(this, Py.prototype); } } -class dy extends jt { +class My extends jt { get info() { return "An error occurred while fetching the wallets list."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, dy.prototype); + super(...e), Object.setPrototypeOf(this, My.prototype); } } -class Ea extends jt { +class Ca extends jt { constructor(...e) { - super(...e), Object.setPrototypeOf(this, Ea.prototype); + super(...e), Object.setPrototypeOf(this, Ca.prototype); } } -const m5 = { - [fa.UNKNOWN_ERROR]: Ea, - [fa.USER_REJECTS_ERROR]: Mp, - [fa.BAD_REQUEST_ERROR]: Ip, - [fa.UNKNOWN_APP_ERROR]: Cp, - [fa.MANIFEST_NOT_FOUND_ERROR]: Pp, - [fa.MANIFEST_CONTENT_ERROR]: Ap +const D5 = { + [ha.UNKNOWN_ERROR]: Ca, + [ha.USER_REJECTS_ERROR]: Up, + [ha.BAD_REQUEST_ERROR]: qp, + [ha.UNKNOWN_APP_ERROR]: zp, + [ha.MANIFEST_NOT_FOUND_ERROR]: jp, + [ha.MANIFEST_CONTENT_ERROR]: Fp }; -class Sie { +class nse { parseError(e) { - let r = Ea; - return e.code in m5 && (r = m5[e.code] || Ea), new r(e.message); + let r = Ca; + return e.code in D5 && (r = D5[e.code] || Ca), new r(e.message); } } -const Aie = new Sie(); -class Pie { +const ise = new nse(); +class sse { isError(e) { return "error" in e; } } -const v5 = { - [su.UNKNOWN_ERROR]: Ea, - [su.USER_REJECTS_ERROR]: Mp, - [su.BAD_REQUEST_ERROR]: Ip, - [su.UNKNOWN_APP_ERROR]: Cp +const O5 = { + [gu.UNKNOWN_ERROR]: Ca, + [gu.USER_REJECTS_ERROR]: Up, + [gu.BAD_REQUEST_ERROR]: qp, + [gu.UNKNOWN_APP_ERROR]: zp }; -class Mie extends Pie { +class ose extends sse { convertToRpcRequest(e) { return { method: "sendTransaction", @@ -41245,8 +41765,8 @@ class Mie extends Pie { }; } parseAndThrowError(e) { - let r = Ea; - throw e.error.code in v5 && (r = v5[e.error.code] || Ea), new r(e.error.message); + let r = Ca; + throw e.error.code in O5 && (r = O5[e.error.code] || Ca), new r(e.error.message); } convertFromRpcResponse(e) { return { @@ -41254,8 +41774,8 @@ class Mie extends Pie { }; } } -const wd = new Mie(); -class Iie { +const Rd = new ose(); +class ase { constructor(e, r) { this.storage = e, this.storeKey = "ton-connect-storage_http-bridge-gateway::" + r; } @@ -41276,22 +41796,22 @@ class Iie { }); } } -function Cie(t) { +function cse(t) { return t.slice(-1) === "/" ? t.slice(0, -1) : t; } -function Y9(t, e) { - return Cie(t) + "/" + e; +function EA(t, e) { + return cse(t) + "/" + e; } -function Tie(t) { +function use(t) { if (!t) return !1; const e = new URL(t); return e.protocol === "tg:" || e.hostname === "t.me"; } -function Rie(t) { +function fse(t) { return t.replaceAll(".", "%2E").replaceAll("-", "%2D").replaceAll("_", "%5F").replaceAll("&", "-").replaceAll("=", "__").replaceAll("%", "--"); } -function J9(t, e) { +function SA(t, e) { return Mt(this, void 0, void 0, function* () { return new Promise((r, n) => { var i, s; @@ -41306,14 +41826,14 @@ function J9(t, e) { }); }); } -function _s(t) { +function As(t) { const e = new AbortController(); return t != null && t.aborted ? e.abort() : t == null || t.addEventListener("abort", () => e.abort(), { once: !0 }), e; } -function Zf(t, e) { +function sl(t, e) { var r, n; return Mt(this, void 0, void 0, function* () { - const i = (r = e == null ? void 0 : e.attempts) !== null && r !== void 0 ? r : 10, s = (n = e == null ? void 0 : e.delayMs) !== null && n !== void 0 ? n : 200, o = _s(e == null ? void 0 : e.signal); + const i = (r = e == null ? void 0 : e.attempts) !== null && r !== void 0 ? r : 10, s = (n = e == null ? void 0 : e.delayMs) !== null && n !== void 0 ? n : 200, o = As(e == null ? void 0 : e.signal); if (typeof t != "function") throw new jt(`Expected a function, got ${typeof t}`); let a = 0, u; @@ -41323,42 +41843,42 @@ function Zf(t, e) { try { return yield t({ signal: o.signal }); } catch (l) { - u = l, a++, a < i && (yield J9(s)); + u = l, a++, a < i && (yield SA(s)); } } throw u; }); } -function Sn(...t) { +function An(...t) { try { console.debug("[TON_CONNECT_SDK]", ...t); } catch { } } -function No(...t) { +function Bo(...t) { try { console.error("[TON_CONNECT_SDK]", ...t); } catch { } } -function Die(...t) { +function lse(...t) { try { console.warn("[TON_CONNECT_SDK]", ...t); } catch { } } -function Oie(t, e) { +function hse(t, e) { let r = null, n = null, i = null, s = null, o = null; const a = (p, ...w) => Mt(this, void 0, void 0, function* () { - if (s = p ?? null, o == null || o.abort(), o = _s(p), o.signal.aborted) + if (s = p ?? null, o == null || o.abort(), o = As(p), o.signal.aborted) throw new jt("Resource creation was aborted"); n = w ?? null; - const A = t(o.signal, ...w); - i = A; - const M = yield A; - if (i !== A && M !== r) - throw yield e(M), new jt("Resource creation was aborted by a new resource creation"); - return r = M, r; + const _ = t(o.signal, ...w); + i = _; + const P = yield _; + if (i !== _ && P !== r) + throw yield e(P), new jt("Resource creation was aborted by a new resource creation"); + return r = P, r; }); return { create: a, @@ -41381,15 +41901,15 @@ function Oie(t, e) { } }), recreate: (p) => Mt(this, void 0, void 0, function* () { - const w = r, A = i, M = n, N = s; - if (yield J9(p), w === r && A === i && M === n && N === s) - return yield a(s, ...M ?? []); + const w = r, _ = i, P = n, O = s; + if (yield SA(p), w === r && _ === i && P === n && O === s) + return yield a(s, ...P ?? []); throw new jt("Resource recreation was aborted by a new resource creation"); }) }; } -function Nie(t, e) { - const r = e == null ? void 0 : e.timeout, n = e == null ? void 0 : e.signal, i = _s(n); +function dse(t, e) { + const r = e == null ? void 0 : e.timeout, n = e == null ? void 0 : e.signal, i = As(n); return new Promise((s, o) => Mt(this, void 0, void 0, function* () { if (i.signal.aborted) { o(new jt("Operation aborted")); @@ -41409,9 +41929,9 @@ function Nie(t, e) { }, u); })); } -class Vm { +class a1 { constructor(e, r, n, i, s) { - this.bridgeUrl = r, this.sessionId = n, this.listener = i, this.errorsListener = s, this.ssePath = "events", this.postPath = "message", this.heartbeatMessage = "heartbeat", this.defaultTtl = 300, this.defaultReconnectDelay = 2e3, this.defaultResendDelay = 5e3, this.eventSource = Oie((o, a) => Mt(this, void 0, void 0, function* () { + this.bridgeUrl = r, this.sessionId = n, this.listener = i, this.errorsListener = s, this.ssePath = "events", this.postPath = "message", this.heartbeatMessage = "heartbeat", this.defaultTtl = 300, this.defaultReconnectDelay = 2e3, this.defaultResendDelay = 5e3, this.eventSource = hse((o, a) => Mt(this, void 0, void 0, function* () { const u = { bridgeUrl: this.bridgeUrl, ssePath: this.ssePath, @@ -41422,10 +41942,10 @@ class Vm { signal: o, openingDeadlineMS: a }; - return yield Lie(u); + return yield pse(u); }), (o) => Mt(this, void 0, void 0, function* () { o.close(); - })), this.bridgeGatewayStorage = new Iie(e, r); + })), this.bridgeGatewayStorage = new ase(e, r); } get isReady() { const e = this.eventSource.current(); @@ -41449,10 +41969,10 @@ class Vm { return Mt(this, void 0, void 0, function* () { const o = {}; typeof i == "number" ? o.ttl = i : (o.ttl = i == null ? void 0 : i.ttl, o.signal = i == null ? void 0 : i.signal, o.attempts = i == null ? void 0 : i.attempts); - const a = new URL(Y9(this.bridgeUrl, this.postPath)); + const a = new URL(EA(this.bridgeUrl, this.postPath)); a.searchParams.append("client_id", this.sessionId), a.searchParams.append("to", r), a.searchParams.append("ttl", ((o == null ? void 0 : o.ttl) || this.defaultTtl).toString()), a.searchParams.append("topic", n); - const u = G9.encode(e); - yield Zf((l) => Mt(this, void 0, void 0, function* () { + const u = _A.encode(e); + yield sl((l) => Mt(this, void 0, void 0, function* () { const d = yield this.post(a, u, l.signal); if (!d.ok) throw new jt(`Bridge send failed, status ${d.status}`); @@ -41464,7 +41984,7 @@ class Vm { }); } pause() { - this.eventSource.dispose().catch((e) => No(`Bridge pause failed, ${e}`)); + this.eventSource.dispose().catch((e) => Bo(`Bridge pause failed, ${e}`)); } unPause() { return Mt(this, void 0, void 0, function* () { @@ -41473,7 +41993,7 @@ class Vm { } close() { return Mt(this, void 0, void 0, function* () { - yield this.eventSource.dispose().catch((e) => No(`Bridge close failed, ${e}`)); + yield this.eventSource.dispose().catch((e) => Bo(`Bridge close failed, ${e}`)); }); } setListener(e) { @@ -41506,7 +42026,7 @@ class Vm { return; } if (this.isClosed) - return e.close(), Sn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`), yield this.eventSource.recreate(this.defaultReconnectDelay); + return e.close(), An(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`), yield this.eventSource.recreate(this.defaultReconnectDelay); throw new jt("Bridge error, unknown state"); }); } @@ -41524,16 +42044,16 @@ class Vm { }); } } -function Lie(t) { +function pse(t) { return Mt(this, void 0, void 0, function* () { - return yield Nie((e, r, n) => Mt(this, void 0, void 0, function* () { + return yield dse((e, r, n) => Mt(this, void 0, void 0, function* () { var i; - const o = _s(n.signal).signal; + const o = As(n.signal).signal; if (o.aborted) { r(new jt("Bridge connection aborted")); return; } - const a = new URL(Y9(t.bridgeUrl, t.ssePath)); + const a = new URL(EA(t.bridgeUrl, t.ssePath)); a.searchParams.append("client_id", t.sessionId); const u = yield t.bridgeGatewayStorage.getLastEventId(); if (u && a.searchParams.append("last_event_id", u), o.aborted) { @@ -41570,10 +42090,10 @@ function Lie(t) { }), { timeout: t.openingDeadlineMS, signal: t.signal }); }); } -function Qf(t) { +function ol(t) { return !("connectEvent" in t); } -class Ol { +class Wl { constructor(e) { this.storage = e, this.storeKey = "ton-connect-storage_bridge-connection"; } @@ -41581,7 +42101,7 @@ class Ol { return Mt(this, void 0, void 0, function* () { if (e.type === "injected") return this.storage.setItem(this.storeKey, JSON.stringify(e)); - if (!Qf(e)) { + if (!ol(e)) { const n = { sessionKeyPair: e.session.sessionCrypto.stringifyKeypair(), walletPublicKey: e.session.walletPublicKey, @@ -41617,7 +42137,7 @@ class Ol { if (r.type === "injected") return r; if ("connectEvent" in r) { - const n = new dv(r.session.sessionKeyPair); + const n = new Cv(r.session.sessionKeyPair); return { type: "http", connectEvent: r.connectEvent, @@ -41632,7 +42152,7 @@ class Ol { } return { type: "http", - sessionCrypto: new dv(r.sessionCrypto), + sessionCrypto: new Cv(r.sessionCrypto), connectionSource: r.connectionSource }; }); @@ -41654,7 +42174,7 @@ class Ol { throw new jt("Trying to read HTTP connection source while nothing is stored"); if (e.type === "injected") throw new jt("Trying to read HTTP connection source while injected connection is stored"); - if (!Qf(e)) + if (!ol(e)) throw new jt("Trying to read HTTP-pending connection while http connection is stored"); return e; }); @@ -41678,7 +42198,7 @@ class Ol { storeLastWalletEventId(e) { return Mt(this, void 0, void 0, function* () { const r = yield this.getConnection(); - if (r && r.type === "http" && !Qf(r)) + if (r && r.type === "http" && !ol(r)) return r.lastWalletEventId = e, this.storeConnection(r); }); } @@ -41705,22 +42225,22 @@ class Ol { }); } } -const X9 = 2; -class Nl { +const AA = 2; +class Hl { constructor(e, r) { - this.storage = e, this.walletConnectionSource = r, this.type = "http", this.standardUniversalLink = "tc://", this.pendingRequests = /* @__PURE__ */ new Map(), this.session = null, this.gateway = null, this.pendingGateways = [], this.listeners = [], this.defaultOpeningDeadlineMS = 12e3, this.defaultRetryTimeoutMS = 2e3, this.connectionStorage = new Ol(e); + this.storage = e, this.walletConnectionSource = r, this.type = "http", this.standardUniversalLink = "tc://", this.pendingRequests = /* @__PURE__ */ new Map(), this.session = null, this.gateway = null, this.pendingGateways = [], this.listeners = [], this.defaultOpeningDeadlineMS = 12e3, this.defaultRetryTimeoutMS = 2e3, this.connectionStorage = new Wl(e); } static fromStorage(e) { return Mt(this, void 0, void 0, function* () { - const n = yield new Ol(e).getHttpConnection(); - return Qf(n) ? new Nl(e, n.connectionSource) : new Nl(e, { bridgeUrl: n.session.bridgeUrl }); + const n = yield new Wl(e).getHttpConnection(); + return ol(n) ? new Hl(e, n.connectionSource) : new Hl(e, { bridgeUrl: n.session.bridgeUrl }); }); } connect(e, r) { var n; - const i = _s(r == null ? void 0 : r.signal); + const i = As(r == null ? void 0 : r.signal); (n = this.abortController) === null || n === void 0 || n.abort(), this.abortController = i, this.closeGateways(); - const s = new dv(); + const s = new Cv(); this.session = { sessionCrypto: s, bridgeUrl: "bridgeUrl" in this.walletConnectionSource ? this.walletConnectionSource.bridgeUrl : "" @@ -41729,7 +42249,7 @@ class Nl { connectionSource: this.walletConnectionSource, sessionCrypto: s }).then(() => Mt(this, void 0, void 0, function* () { - i.signal.aborted || (yield Zf((a) => { + i.signal.aborted || (yield sl((a) => { var u; return this.openGateways(s, { openingDeadlineMS: (u = r == null ? void 0 : r.openingDeadlineMS) !== null && u !== void 0 ? u : this.defaultOpeningDeadlineMS, @@ -41747,7 +42267,7 @@ class Nl { restoreConnection(e) { var r, n; return Mt(this, void 0, void 0, function* () { - const i = _s(e == null ? void 0 : e.signal); + const i = As(e == null ? void 0 : e.signal); if ((r = this.abortController) === null || r === void 0 || r.abort(), this.abortController = i, i.signal.aborted) return; this.closeGateways(); @@ -41755,7 +42275,7 @@ class Nl { if (!s || i.signal.aborted) return; const o = (n = e == null ? void 0 : e.openingDeadlineMS) !== null && n !== void 0 ? n : this.defaultOpeningDeadlineMS; - if (Qf(s)) + if (ol(s)) return this.session = { sessionCrypto: s.sessionCrypto, bridgeUrl: "bridgeUrl" in this.walletConnectionSource ? this.walletConnectionSource.bridgeUrl : "" @@ -41765,10 +42285,10 @@ class Nl { }); if (Array.isArray(this.walletConnectionSource)) throw new jt("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected."); - if (this.session = s.session, this.gateway && (Sn("Gateway is already opened, closing previous gateway"), yield this.gateway.close()), this.gateway = new Vm(this.storage, this.walletConnectionSource.bridgeUrl, s.session.sessionCrypto.sessionId, this.gatewayListener.bind(this), this.gatewayErrorsListener.bind(this)), !i.signal.aborted) { + if (this.session = s.session, this.gateway && (An("Gateway is already opened, closing previous gateway"), yield this.gateway.close()), this.gateway = new a1(this.storage, this.walletConnectionSource.bridgeUrl, s.session.sessionCrypto.sessionId, this.gatewayListener.bind(this), this.gatewayErrorsListener.bind(this)), !i.signal.aborted) { this.listeners.forEach((a) => a(s.connectEvent)); try { - yield Zf((a) => this.gateway.registerSession({ + yield sl((a) => this.gateway.registerSession({ openingDeadlineMS: o, signal: a.signal }), { @@ -41790,8 +42310,8 @@ class Nl { if (!this.gateway || !this.session || !("walletPublicKey" in this.session)) throw new jt("Trying to send bridge request without session"); const a = (yield this.connectionStorage.getNextRpcRequestId()).toString(); - yield this.connectionStorage.increaseNextRpcRequestId(), Sn("Send http-bridge request:", Object.assign(Object.assign({}, e), { id: a })); - const u = this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({}, e), { id: a })), A0(this.session.walletPublicKey)); + yield this.connectionStorage.increaseNextRpcRequestId(), An("Send http-bridge request:", Object.assign(Object.assign({}, e), { id: a })); + const u = this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({}, e), { id: a })), $0(this.session.walletPublicKey)); try { yield this.gateway.send(u, this.session.walletPublicKey, e.method, { attempts: n == null ? void 0 : n.attempts, signal: n == null ? void 0 : n.signal }), (o = n == null ? void 0 : n.onRequestSent) === null || o === void 0 || o.call(n), this.pendingRequests.set(a.toString(), i); } catch (l) { @@ -41811,7 +42331,7 @@ class Nl { }; try { this.closeGateways(); - const o = _s(e == null ? void 0 : e.signal); + const o = As(e == null ? void 0 : e.signal); i = setTimeout(() => { o.abort(); }, this.defaultOpeningDeadlineMS), yield this.sendRequest({ method: "disconnect", params: [] }, { @@ -41820,7 +42340,7 @@ class Nl { attempts: 1 }); } catch (o) { - Sn("Disconnect error:", o), n || this.removeBridgeAndSession().then(r); + An("Disconnect error:", o), n || this.removeBridgeAndSession().then(r); } finally { i && clearTimeout(i), s(); } @@ -41846,16 +42366,16 @@ class Nl { yield e.close(); return; } - return this.closeGateways({ except: e }), this.gateway && (Sn("Gateway is already opened, closing previous gateway"), yield this.gateway.close()), this.session.bridgeUrl = r, this.gateway = e, this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)), this.gateway.setListener(this.gatewayListener.bind(this)), this.gatewayListener(n); + return this.closeGateways({ except: e }), this.gateway && (An("Gateway is already opened, closing previous gateway"), yield this.gateway.close()), this.session.bridgeUrl = r, this.gateway = e, this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)), this.gateway.setListener(this.gatewayListener.bind(this)), this.gatewayListener(n); }); } gatewayListener(e) { return Mt(this, void 0, void 0, function* () { - const r = JSON.parse(this.session.sessionCrypto.decrypt(G9.decode(e.message).toUint8Array(), A0(e.from))); - if (Sn("Wallet message received:", r), !("event" in r)) { + const r = JSON.parse(this.session.sessionCrypto.decrypt(_A.decode(e.message).toUint8Array(), $0(e.from))); + if (An("Wallet message received:", r), !("event" in r)) { const i = r.id.toString(), s = this.pendingRequests.get(i); if (!s) { - Sn(`Response id ${i} doesn't match any request's id`); + An(`Response id ${i} doesn't match any request's id`); return; } s(r), this.pendingRequests.delete(i); @@ -41864,13 +42384,13 @@ class Nl { if (r.id !== void 0) { const i = yield this.connectionStorage.getLastWalletEventId(); if (i !== void 0 && r.id <= i) { - No(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `); + Bo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `); return; } r.event !== "connect" && (yield this.connectionStorage.storeLastWalletEventId(r.id)); } const n = this.listeners; - r.event === "connect" && (yield this.updateSession(r, e.from)), r.event === "disconnect" && (Sn("Removing bridge and session: received disconnect event"), yield this.removeBridgeAndSession()), n.forEach((i) => i(r)); + r.event === "connect" && (yield this.updateSession(r, e.from)), r.event === "disconnect" && (An("Removing bridge and session: received disconnect event"), yield this.removeBridgeAndSession()), n.forEach((i) => i(r)); }); } gatewayErrorsListener(e) { @@ -41897,14 +42417,14 @@ class Nl { }); } generateUniversalLink(e, r) { - return Tie(e) ? this.generateTGUniversalLink(e, r) : this.generateRegularUniversalLink(e, r); + return use(e) ? this.generateTGUniversalLink(e, r) : this.generateRegularUniversalLink(e, r); } generateRegularUniversalLink(e, r) { const n = new URL(e); - return n.searchParams.append("v", X9.toString()), n.searchParams.append("id", this.session.sessionCrypto.sessionId), n.searchParams.append("r", JSON.stringify(r)), n.toString(); + return n.searchParams.append("v", AA.toString()), n.searchParams.append("id", this.session.sessionCrypto.sessionId), n.searchParams.append("r", JSON.stringify(r)), n.toString(); } generateTGUniversalLink(e, r) { - const i = this.generateRegularUniversalLink("about:blank", r).split("?")[1], s = "tonconnect-" + Rie(i), o = this.convertToDirectLink(e), a = new URL(o); + const i = this.generateRegularUniversalLink("about:blank", r).split("?")[1], s = "tonconnect-" + fse(i), o = this.convertToDirectLink(e), a = new URL(o); return a.searchParams.append("startapp", s), a.toString(); } // TODO: Remove this method after all dApps and the wallets-list.json have been updated @@ -41916,11 +42436,11 @@ class Nl { return Mt(this, void 0, void 0, function* () { if (Array.isArray(this.walletConnectionSource)) { this.pendingGateways.map((n) => n.close().catch()), this.pendingGateways = this.walletConnectionSource.map((n) => { - const i = new Vm(this.storage, n.bridgeUrl, e.sessionId, () => { + const i = new a1(this.storage, n.bridgeUrl, e.sessionId, () => { }, () => { }); return i.setListener((s) => this.pendingGatewaysListener(i, n.bridgeUrl, s)), i; - }), yield Promise.allSettled(this.pendingGateways.map((n) => Zf((i) => { + }), yield Promise.allSettled(this.pendingGateways.map((n) => sl((i) => { var s; return this.pendingGateways.some((o) => o === n) ? n.registerSession({ openingDeadlineMS: (s = r == null ? void 0 : r.openingDeadlineMS) !== null && s !== void 0 ? s : this.defaultOpeningDeadlineMS, @@ -41933,7 +42453,7 @@ class Nl { }))); return; } else - return this.gateway && (Sn("Gateway is already opened, closing previous gateway"), yield this.gateway.close()), this.gateway = new Vm(this.storage, this.walletConnectionSource.bridgeUrl, e.sessionId, this.gatewayListener.bind(this), this.gatewayErrorsListener.bind(this)), yield this.gateway.registerSession({ + return this.gateway && (An("Gateway is already opened, closing previous gateway"), yield this.gateway.close()), this.gateway = new a1(this.storage, this.walletConnectionSource.bridgeUrl, e.sessionId, this.gatewayListener.bind(this), this.gatewayErrorsListener.bind(this)), yield this.gateway.registerSession({ openingDeadlineMS: r == null ? void 0 : r.openingDeadlineMS, signal: r == null ? void 0 : r.signal }); @@ -41944,15 +42464,15 @@ class Nl { (r = this.gateway) === null || r === void 0 || r.close(), this.pendingGateways.filter((n) => n !== (e == null ? void 0 : e.except)).forEach((n) => n.close()), this.pendingGateways = []; } } -function b5(t, e) { - return Z9(t, [e]); +function N5(t, e) { + return PA(t, [e]); } -function Z9(t, e) { +function PA(t, e) { return !t || typeof t != "object" ? !1 : e.every((r) => r in t); } -function kie(t) { +function gse(t) { try { - return !b5(t, "tonconnect") || !b5(t.tonconnect, "walletInfo") ? !1 : Z9(t.tonconnect.walletInfo, [ + return !N5(t, "tonconnect") || !N5(t.tonconnect, "walletInfo") ? !1 : PA(t.tonconnect.walletInfo, [ "name", "app_name", "image", @@ -41963,12 +42483,12 @@ function kie(t) { return !1; } } -class ou { +class mu { constructor() { this.storage = {}; } static getInstance() { - return ou.instance || (ou.instance = new ou()), ou.instance; + return mu.instance || (mu.instance = new mu()), mu.instance; } get length() { return Object.keys(this.storage).length; @@ -41992,12 +42512,12 @@ class ou { this.storage[e] = r; } } -function Tp() { +function Wp() { if (!(typeof window > "u")) return window; } -function $ie() { - const t = Tp(); +function mse() { + const t = Wp(); if (!t) return []; try { @@ -42006,54 +42526,54 @@ function $ie() { return []; } } -function Bie() { +function vse() { if (!(typeof document > "u")) return document; } -function Fie() { +function bse() { var t; - const e = (t = Tp()) === null || t === void 0 ? void 0 : t.location.origin; + const e = (t = Wp()) === null || t === void 0 ? void 0 : t.location.origin; return e ? e + "/tonconnect-manifest.json" : ""; } -function jie() { - if (Uie()) +function yse() { + if (wse()) return localStorage; - if (qie()) + if (xse()) throw new jt("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector"); - return ou.getInstance(); + return mu.getInstance(); } -function Uie() { +function wse() { try { return typeof localStorage < "u"; } catch { return !1; } } -function qie() { +function xse() { return typeof process < "u" && process.versions != null && process.versions.node != null; } -class vi { +class bi { constructor(e, r) { this.injectedWalletKey = r, this.type = "injected", this.unsubscribeCallback = null, this.listenSubscriptions = !1, this.listeners = []; - const n = vi.window; - if (!vi.isWindowContainsWallet(n, r)) - throw new hy(); - this.connectionStorage = new Ol(e), this.injectedWallet = n[r].tonconnect; + const n = bi.window; + if (!bi.isWindowContainsWallet(n, r)) + throw new Py(); + this.connectionStorage = new Wl(e), this.injectedWallet = n[r].tonconnect; } static fromStorage(e) { return Mt(this, void 0, void 0, function* () { - const n = yield new Ol(e).getInjectedConnection(); - return new vi(e, n.jsBridgeKey); + const n = yield new Wl(e).getInjectedConnection(); + return new bi(e, n.jsBridgeKey); }); } static isWalletInjected(e) { - return vi.isWindowContainsWallet(this.window, e); + return bi.isWindowContainsWallet(this.window, e); } static isInsideWalletBrowser(e) { - return vi.isWindowContainsWallet(this.window, e) ? this.window[e].tonconnect.isWalletBrowser : !1; + return bi.isWindowContainsWallet(this.window, e) ? this.window[e].tonconnect.isWalletBrowser : !1; } static getCurrentlyInjectedWallets() { - return this.window ? $ie().filter(([n, i]) => kie(i)).map(([n, i]) => ({ + return this.window ? mse().filter(([n, i]) => gse(i)).map(([n, i]) => ({ name: i.tonconnect.walletInfo.name, appName: i.tonconnect.walletInfo.app_name, aboutUrl: i.tonconnect.walletInfo.about_url, @@ -42069,14 +42589,14 @@ class vi { return !!e && r in e && typeof e[r] == "object" && "tonconnect" in e[r]; } connect(e) { - this._connect(X9, e); + this._connect(AA, e); } restoreConnection() { return Mt(this, void 0, void 0, function* () { try { - Sn("Injected Provider restoring connection..."); + An("Injected Provider restoring connection..."); const e = yield this.injectedWallet.restoreConnection(); - Sn("Injected Provider restoring connection response", e), e.event === "connect" ? (this.makeSubscriptions(), this.listeners.forEach((r) => r(e))) : yield this.connectionStorage.removeConnection(); + An("Injected Provider restoring connection response", e), e.event === "connect" ? (this.makeSubscriptions(), this.listeners.forEach((r) => r(e))) : yield this.connectionStorage.removeConnection(); } catch (e) { yield this.connectionStorage.removeConnection(), console.error(e); } @@ -42094,7 +42614,7 @@ class vi { try { this.injectedWallet.disconnect(), r(); } catch (n) { - Sn(n), this.sendRequest({ + An(n), this.sendRequest({ method: "disconnect", params: [] }, r); @@ -42115,19 +42635,19 @@ class vi { const i = {}; typeof r == "function" ? i.onRequestSent = r : (i.onRequestSent = r == null ? void 0 : r.onRequestSent, i.signal = r == null ? void 0 : r.signal); const s = (yield this.connectionStorage.getNextRpcRequestId()).toString(); - yield this.connectionStorage.increaseNextRpcRequestId(), Sn("Send injected-bridge request:", Object.assign(Object.assign({}, e), { id: s })); + yield this.connectionStorage.increaseNextRpcRequestId(), An("Send injected-bridge request:", Object.assign(Object.assign({}, e), { id: s })); const o = this.injectedWallet.send(Object.assign(Object.assign({}, e), { id: s })); - return o.then((a) => Sn("Wallet message received:", a)), (n = i == null ? void 0 : i.onRequestSent) === null || n === void 0 || n.call(i), o; + return o.then((a) => An("Wallet message received:", a)), (n = i == null ? void 0 : i.onRequestSent) === null || n === void 0 || n.call(i), o; }); } _connect(e, r) { return Mt(this, void 0, void 0, function* () { try { - Sn(`Injected Provider connect request: protocolVersion: ${e}, message:`, r); + An(`Injected Provider connect request: protocolVersion: ${e}, message:`, r); const n = yield this.injectedWallet.connect(e, r); - Sn("Injected Provider connect response:", n), n.event === "connect" && (yield this.updateSession(), this.makeSubscriptions()), this.listeners.forEach((i) => i(n)); + An("Injected Provider connect response:", n), n.event === "connect" && (yield this.updateSession(), this.makeSubscriptions()), this.listeners.forEach((i) => i(n)); } catch (n) { - Sn("Injected Provider connect error:", n); + An("Injected Provider connect error:", n); const i = { event: "connect_error", payload: { @@ -42141,7 +42661,7 @@ class vi { } makeSubscriptions() { this.listenSubscriptions = !0, this.unsubscribeCallback = this.injectedWallet.listen((e) => { - Sn("Wallet message received:", e), this.listenSubscriptions && this.listeners.forEach((r) => r(e)), e.event === "disconnect" && this.disconnect(); + An("Wallet message received:", e), this.listenSubscriptions && this.listeners.forEach((r) => r(e)), e.event === "disconnect" && this.disconnect(); }); } updateSession() { @@ -42152,10 +42672,10 @@ class vi { }); } } -vi.window = Tp(); -class zie { +bi.window = Wp(); +class _se { constructor() { - this.localStorage = jie(); + this.localStorage = yse(); } getItem(e) { return Mt(this, void 0, void 0, function* () { @@ -42173,16 +42693,16 @@ class zie { }); } } -function Q9(t) { - return Hie(t) && t.injected; +function MA(t) { + return Sse(t) && t.injected; } -function Wie(t) { - return Q9(t) && t.embedded; +function Ese(t) { + return MA(t) && t.embedded; } -function Hie(t) { +function Sse(t) { return "jsBridgeKey" in t; } -const Kie = [ +const Ase = [ { app_name: "telegram-wallet", name: "Wallet", @@ -42382,7 +42902,7 @@ const Kie = [ platforms: ["chrome", "safari", "firefox", "ios", "android"] } ]; -class pv { +class Tv { constructor(e) { this.walletsListCache = null, this.walletsListCacheCreationTimestamp = null, this.walletsListSource = "https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json", e != null && e.walletsListSource && (this.walletsListSource = e.walletsListSource), e != null && e.cacheTTLMs && (this.cacheTTLMs = e.cacheTTLMs); } @@ -42397,7 +42917,7 @@ class pv { } getEmbeddedWallet() { return Mt(this, void 0, void 0, function* () { - const r = (yield this.getWallets()).filter(Wie); + const r = (yield this.getWallets()).filter(Ese); return r.length !== 1 ? null : r[0]; }); } @@ -42406,17 +42926,17 @@ class pv { let e = []; try { if (e = yield (yield fetch(this.walletsListSource)).json(), !Array.isArray(e)) - throw new dy("Wrong wallets list format, wallets list must be an array."); + throw new My("Wrong wallets list format, wallets list must be an array."); const i = e.filter((s) => !this.isCorrectWalletConfigDTO(s)); - i.length && (No(`Wallet(s) ${i.map((s) => s.name).join(", ")} config format is wrong. They were removed from the wallets list.`), e = e.filter((s) => this.isCorrectWalletConfigDTO(s))); + i.length && (Bo(`Wallet(s) ${i.map((s) => s.name).join(", ")} config format is wrong. They were removed from the wallets list.`), e = e.filter((s) => this.isCorrectWalletConfigDTO(s))); } catch (n) { - No(n), e = Kie; + Bo(n), e = Ase; } let r = []; try { - r = vi.getCurrentlyInjectedWallets(); + r = bi.getCurrentlyInjectedWallets(); } catch (n) { - No(n); + Bo(n); } return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e), r); }); @@ -42434,7 +42954,7 @@ class pv { return r.bridge.forEach((s) => { if (s.type === "sse" && (i.bridgeUrl = s.url, i.universalLink = r.universal_url, i.deepLink = r.deepLink), s.type === "js") { const o = s.key; - i.jsBridgeKey = o, i.injected = vi.isWalletInjected(o), i.embedded = vi.isInsideWalletBrowser(o); + i.jsBridgeKey = o, i.injected = bi.isWalletInjected(o), i.embedded = bi.isInsideWalletBrowser(o); } }), i; }); @@ -42462,43 +42982,43 @@ class pv { return !(l && (!("key" in l) || !l.key)); } } -class M0 extends jt { +class F0 extends jt { get info() { return "Wallet doesn't support requested feature method."; } constructor(...e) { - super(...e), Object.setPrototypeOf(this, M0.prototype); + super(...e), Object.setPrototypeOf(this, F0.prototype); } } -function Vie(t, e) { +function Pse(t, e) { const r = t.includes("SendTransaction"), n = t.find((i) => i && typeof i == "object" && i.name === "SendTransaction"); if (!r && !n) - throw new M0("Wallet doesn't support SendTransaction feature."); + throw new F0("Wallet doesn't support SendTransaction feature."); if (n && n.maxMessages !== void 0) { if (n.maxMessages < e.requiredMessagesNumber) - throw new M0(`Wallet is not able to handle such SendTransaction request. Max support messages number is ${n.maxMessages}, but ${e.requiredMessagesNumber} is required.`); + throw new F0(`Wallet is not able to handle such SendTransaction request. Max support messages number is ${n.maxMessages}, but ${e.requiredMessagesNumber} is required.`); return; } - Die("Connected wallet didn't provide information about max allowed messages in the SendTransaction request. Request may be rejected by the wallet."); + lse("Connected wallet didn't provide information about max allowed messages in the SendTransaction request. Request may be rejected by the wallet."); } -function Gie() { +function Mse() { return { type: "request-version" }; } -function Yie(t) { +function Ise(t) { return { type: "response-version", version: t }; } -function Yu(t) { +function rf(t) { return { ton_connect_sdk_lib: t.ton_connect_sdk_lib, ton_connect_ui_lib: t.ton_connect_ui_lib }; } -function Ju(t, e) { +function nf(t, e) { var r, n, i, s, o, a, u, l; const p = ((r = e == null ? void 0 : e.connectItems) === null || r === void 0 ? void 0 : r.tonProof) && "proof" in e.connectItems.tonProof ? "ton_proof" : "ton_addr"; return { @@ -42506,45 +43026,45 @@ function Ju(t, e) { wallet_type: (s = e == null ? void 0 : e.device.appName) !== null && s !== void 0 ? s : null, wallet_version: (o = e == null ? void 0 : e.device.appVersion) !== null && o !== void 0 ? o : null, auth_type: p, - custom_data: Object.assign({ chain_id: (u = (a = e == null ? void 0 : e.account) === null || a === void 0 ? void 0 : a.chain) !== null && u !== void 0 ? u : null, provider: (l = e == null ? void 0 : e.provider) !== null && l !== void 0 ? l : null }, Yu(t)) + custom_data: Object.assign({ chain_id: (u = (a = e == null ? void 0 : e.account) === null || a === void 0 ? void 0 : a.chain) !== null && u !== void 0 ? u : null, provider: (l = e == null ? void 0 : e.provider) !== null && l !== void 0 ? l : null }, rf(t)) }; } -function Jie(t) { +function Cse(t) { return { type: "connection-started", - custom_data: Yu(t) + custom_data: rf(t) }; } -function Xie(t, e) { - return Object.assign({ type: "connection-completed", is_success: !0 }, Ju(t, e)); +function Tse(t, e) { + return Object.assign({ type: "connection-completed", is_success: !0 }, nf(t, e)); } -function Zie(t, e, r) { +function Rse(t, e, r) { return { type: "connection-error", is_success: !1, error_message: e, error_code: r ?? null, - custom_data: Yu(t) + custom_data: rf(t) }; } -function Qie(t) { +function Dse(t) { return { type: "connection-restoring-started", - custom_data: Yu(t) + custom_data: rf(t) }; } -function ese(t, e) { - return Object.assign({ type: "connection-restoring-completed", is_success: !0 }, Ju(t, e)); +function Ose(t, e) { + return Object.assign({ type: "connection-restoring-completed", is_success: !0 }, nf(t, e)); } -function tse(t, e) { +function Nse(t, e) { return { type: "connection-restoring-error", is_success: !1, error_message: e, - custom_data: Yu(t) + custom_data: rf(t) }; } -function py(t, e) { +function Iy(t, e) { var r, n, i, s; return { valid_until: (r = String(e.validUntil)) !== null && r !== void 0 ? r : null, @@ -42558,21 +43078,21 @@ function py(t, e) { }) }; } -function rse(t, e, r) { - return Object.assign(Object.assign({ type: "transaction-sent-for-signature" }, Ju(t, e)), py(e, r)); +function Lse(t, e, r) { + return Object.assign(Object.assign({ type: "transaction-sent-for-signature" }, nf(t, e)), Iy(e, r)); } -function nse(t, e, r, n) { - return Object.assign(Object.assign({ type: "transaction-signed", is_success: !0, signed_transaction: n.boc }, Ju(t, e)), py(e, r)); +function kse(t, e, r, n) { + return Object.assign(Object.assign({ type: "transaction-signed", is_success: !0, signed_transaction: n.boc }, nf(t, e)), Iy(e, r)); } -function ise(t, e, r, n, i) { - return Object.assign(Object.assign({ type: "transaction-signing-failed", is_success: !1, error_message: n, error_code: i ?? null }, Ju(t, e)), py(e, r)); +function $se(t, e, r, n, i) { + return Object.assign(Object.assign({ type: "transaction-signing-failed", is_success: !1, error_message: n, error_code: i ?? null }, nf(t, e)), Iy(e, r)); } -function sse(t, e, r) { - return Object.assign({ type: "disconnection", scope: r }, Ju(t, e)); +function Bse(t, e, r) { + return Object.assign({ type: "disconnection", scope: r }, nf(t, e)); } -class ose { +class Fse { constructor() { - this.window = Tp(); + this.window = Wp(); } /** * Dispatches an event with the given name and details to the browser window. @@ -42604,16 +43124,16 @@ class ose { }); } } -class ase { +class jse { constructor(e) { var r; - this.eventPrefix = "ton-connect-", this.tonConnectUiVersion = null, this.eventDispatcher = (r = e == null ? void 0 : e.eventDispatcher) !== null && r !== void 0 ? r : new ose(), this.tonConnectSdkVersion = e.tonConnectSdkVersion, this.init().catch(); + this.eventPrefix = "ton-connect-", this.tonConnectUiVersion = null, this.eventDispatcher = (r = e == null ? void 0 : e.eventDispatcher) !== null && r !== void 0 ? r : new Fse(), this.tonConnectSdkVersion = e.tonConnectSdkVersion, this.init().catch(); } /** * Version of the library. */ get version() { - return Yu({ + return rf({ ton_connect_sdk_lib: this.tonConnectSdkVersion, ton_connect_ui_lib: this.tonConnectUiVersion }); @@ -42636,7 +43156,7 @@ class ase { setRequestVersionHandler() { return Mt(this, void 0, void 0, function* () { yield this.eventDispatcher.addEventListener("ton-connect-request-version", () => Mt(this, void 0, void 0, function* () { - yield this.eventDispatcher.dispatchEvent("ton-connect-response-version", Yie(this.tonConnectSdkVersion)); + yield this.eventDispatcher.dispatchEvent("ton-connect-response-version", Ise(this.tonConnectSdkVersion)); })); }); } @@ -42650,7 +43170,7 @@ class ase { try { yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version", (n) => { e(n.detail.version); - }, { once: !0 }), yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version", Gie()); + }, { once: !0 }), yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version", Mse()); } catch (n) { r(n); } @@ -42674,7 +43194,7 @@ class ase { */ trackConnectionStarted(...e) { try { - const r = Jie(this.version, ...e); + const r = Cse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42685,7 +43205,7 @@ class ase { */ trackConnectionCompleted(...e) { try { - const r = Xie(this.version, ...e); + const r = Tse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42696,7 +43216,7 @@ class ase { */ trackConnectionError(...e) { try { - const r = Zie(this.version, ...e); + const r = Rse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42707,7 +43227,7 @@ class ase { */ trackConnectionRestoringStarted(...e) { try { - const r = Qie(this.version, ...e); + const r = Dse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42718,7 +43238,7 @@ class ase { */ trackConnectionRestoringCompleted(...e) { try { - const r = ese(this.version, ...e); + const r = Ose(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42729,7 +43249,7 @@ class ase { */ trackConnectionRestoringError(...e) { try { - const r = tse(this.version, ...e); + const r = Nse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42740,7 +43260,7 @@ class ase { */ trackDisconnection(...e) { try { - const r = sse(this.version, ...e); + const r = Bse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42751,7 +43271,7 @@ class ase { */ trackTransactionSentForSignature(...e) { try { - const r = rse(this.version, ...e); + const r = Lse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42762,7 +43282,7 @@ class ase { */ trackTransactionSigned(...e) { try { - const r = nse(this.version, ...e); + const r = kse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -42773,27 +43293,27 @@ class ase { */ trackTransactionSigningFailed(...e) { try { - const r = ise(this.version, ...e); + const r = $se(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } } } -const cse = "3.0.5"; -class fh { +const Use = "3.0.5"; +class yh { constructor(e) { - if (this.walletsList = new pv(), this._wallet = null, this.provider = null, this.statusChangeSubscriptions = [], this.statusChangeErrorSubscriptions = [], this.dappSettings = { - manifestUrl: (e == null ? void 0 : e.manifestUrl) || Fie(), - storage: (e == null ? void 0 : e.storage) || new zie() - }, this.walletsList = new pv({ + if (this.walletsList = new Tv(), this._wallet = null, this.provider = null, this.statusChangeSubscriptions = [], this.statusChangeErrorSubscriptions = [], this.dappSettings = { + manifestUrl: (e == null ? void 0 : e.manifestUrl) || bse(), + storage: (e == null ? void 0 : e.storage) || new _se() + }, this.walletsList = new Tv({ walletsListSource: e == null ? void 0 : e.walletsListSource, cacheTTLMs: e == null ? void 0 : e.walletsListCacheTTLMs - }), this.tracker = new ase({ + }), this.tracker = new jse({ eventDispatcher: e == null ? void 0 : e.eventDispatcher, - tonConnectSdkVersion: cse + tonConnectSdkVersion: Use }), !this.dappSettings.manifestUrl) - throw new fy("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"); - this.bridgeConnectionStorage = new Ol(this.dappSettings.storage), e != null && e.disableAutoPauseConnection || this.addWindowFocusAndBlurSubscriptions(); + throw new Sy("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"); + this.bridgeConnectionStorage = new Wl(this.dappSettings.storage), e != null && e.disableAutoPauseConnection || this.addWindowFocusAndBlurSubscriptions(); } /** * Returns available wallets list. @@ -42844,8 +43364,8 @@ class fh { var n, i; const s = {}; if (typeof r == "object" && "tonProof" in r && (s.request = r), typeof r == "object" && ("openingDeadlineMS" in r || "signal" in r || "request" in r) && (s.request = r == null ? void 0 : r.request, s.openingDeadlineMS = r == null ? void 0 : r.openingDeadlineMS, s.signal = r == null ? void 0 : r.signal), this.connected) - throw new ly(); - const o = _s(s == null ? void 0 : s.signal); + throw new Ay(); + const o = As(s == null ? void 0 : s.signal); if ((n = this.abortController) === null || n === void 0 || n.abort(), this.abortController = o, o.signal.aborted) throw new jt("Connection was aborted"); return (i = this.provider) === null || i === void 0 || i.closeConnection(), this.provider = this.createProvider(e), o.signal.addEventListener("abort", () => { @@ -42863,7 +43383,7 @@ class fh { var r, n; return Mt(this, void 0, void 0, function* () { this.tracker.trackConnectionRestoringStarted(); - const i = _s(e == null ? void 0 : e.signal); + const i = As(e == null ? void 0 : e.signal); if ((r = this.abortController) === null || r === void 0 || r.abort(), this.abortController = i, i.signal.aborted) { this.tracker.trackConnectionRestoringError("Connection restoring was aborted"); return; @@ -42880,10 +43400,10 @@ class fh { try { switch (s) { case "http": - a = yield Nl.fromStorage(this.dappSettings.storage); + a = yield Hl.fromStorage(this.dappSettings.storage); break; case "injected": - a = yield vi.fromStorage(this.dappSettings.storage); + a = yield bi.fromStorage(this.dappSettings.storage); break; default: if (o) @@ -42900,7 +43420,7 @@ class fh { return; } if (!a) { - No("Provider is not restored"), this.tracker.trackConnectionRestoringError("Provider is not restored"); + Bo("Provider is not restored"), this.tracker.trackConnectionRestoringError("Provider is not restored"); return; } (n = this.provider) === null || n === void 0 || n.closeConnection(), this.provider = a, a.listen(this.walletEventsListener.bind(this)); @@ -42908,7 +43428,7 @@ class fh { this.tracker.trackConnectionRestoringError("Connection restoring was aborted"), a == null || a.closeConnection(), a = null; }; i.signal.addEventListener("abort", u); - const l = Zf((p) => Mt(this, void 0, void 0, function* () { + const l = sl((p) => Mt(this, void 0, void 0, function* () { yield a == null ? void 0 : a.restoreConnection({ openingDeadlineMS: e == null ? void 0 : e.openingDeadlineMS, signal: p.signal @@ -42928,20 +43448,20 @@ class fh { return Mt(this, void 0, void 0, function* () { const n = {}; typeof r == "function" ? n.onRequestSent = r : (n.onRequestSent = r == null ? void 0 : r.onRequestSent, n.signal = r == null ? void 0 : r.signal); - const i = _s(n == null ? void 0 : n.signal); + const i = As(n == null ? void 0 : n.signal); if (i.signal.aborted) throw new jt("Transaction sending was aborted"); - this.checkConnection(), Vie(this.wallet.device.features, { + this.checkConnection(), Pse(this.wallet.device.features, { requiredMessagesNumber: e.messages.length }), this.tracker.trackTransactionSentForSignature(this.wallet, e); - const { validUntil: s } = e, o = _ie(e, ["validUntil"]), a = e.from || this.account.address, u = e.network || this.account.chain, l = yield this.provider.sendRequest(wd.convertToRpcRequest(Object.assign(Object.assign({}, o), { + const { validUntil: s } = e, o = tse(e, ["validUntil"]), a = e.from || this.account.address, u = e.network || this.account.chain, l = yield this.provider.sendRequest(Rd.convertToRpcRequest(Object.assign(Object.assign({}, o), { valid_until: s, from: a, network: u })), { onRequestSent: n.onRequestSent, signal: i.signal }); - if (wd.isError(l)) - return this.tracker.trackTransactionSigningFailed(this.wallet, e, l.error.message, l.error.code), wd.parseAndThrowError(l); - const d = wd.convertFromRpcResponse(l); + if (Rd.isError(l)) + return this.tracker.trackTransactionSigningFailed(this.wallet, e, l.error.message, l.error.code), Rd.parseAndThrowError(l); + const d = Rd.convertFromRpcResponse(l); return this.tracker.trackTransactionSigned(this.wallet, e, d), d; }); } @@ -42952,8 +43472,8 @@ class fh { var r; return Mt(this, void 0, void 0, function* () { if (!this.connected) - throw new P0(); - const n = _s(e == null ? void 0 : e.signal), i = this.abortController; + throw new B0(); + const n = As(e == null ? void 0 : e.signal), i = this.abortController; if (this.abortController = n, n.signal.aborted) throw new jt("Disconnect was aborted"); this.onWalletDisconnected("dapp"), yield (r = this.provider) === null || r === void 0 ? void 0 : r.disconnect({ @@ -42977,19 +43497,19 @@ class fh { return ((e = this.provider) === null || e === void 0 ? void 0 : e.type) !== "http" ? Promise.resolve() : this.provider.unPause(); } addWindowFocusAndBlurSubscriptions() { - const e = Bie(); + const e = vse(); if (e) try { e.addEventListener("visibilitychange", () => { e.hidden ? this.pauseConnection() : this.unPauseConnection().catch(); }); } catch (r) { - No("Cannot subscribe to the document.visibilitychange: ", r); + Bo("Cannot subscribe to the document.visibilitychange: ", r); } } createProvider(e) { let r; - return !Array.isArray(e) && Eie(e) ? r = new vi(this.dappSettings.storage, e.jsBridgeKey) : r = new Nl(this.dappSettings.storage, e), r.listen(this.walletEventsListener.bind(this)), r; + return !Array.isArray(e) && rse(e) ? r = new bi(this.dappSettings.storage, e.jsBridgeKey) : r = new Hl(this.dappSettings.storage, e), r.listen(this.walletEventsListener.bind(this)), r; } walletEventsListener(e) { switch (e.event) { @@ -43022,16 +43542,16 @@ class fh { }), this.wallet = i, this.tracker.trackConnectionCompleted(i); } onWalletConnectError(e) { - const r = Aie.parseError(e); - if (this.statusChangeErrorSubscriptions.forEach((n) => n(r)), Sn(r), this.tracker.trackConnectionError(e.message, e.code), r instanceof Pp || r instanceof Ap) - throw No(r), r; + const r = ise.parseError(e); + if (this.statusChangeErrorSubscriptions.forEach((n) => n(r)), An(r), this.tracker.trackConnectionError(e.message, e.code), r instanceof jp || r instanceof Fp) + throw Bo(r), r; } onWalletDisconnected(e) { this.tracker.trackDisconnection(this.wallet, e), this.wallet = null; } checkConnection() { if (!this.connected) - throw new P0(); + throw new B0(); } createConnectRequest(e) { const r = [ @@ -43048,19 +43568,19 @@ class fh { }; } } -fh.walletsList = new pv(); -fh.isWalletInjected = (t) => vi.isWalletInjected(t); -fh.isInsideWalletBrowser = (t) => vi.isInsideWalletBrowser(t); +yh.walletsList = new Tv(); +yh.isWalletInjected = (t) => bi.isWalletInjected(t); +yh.isInsideWalletBrowser = (t) => bi.isInsideWalletBrowser(t); for (let t = 0; t <= 255; t++) { let e = t.toString(16); e.length < 2 && (e = "0" + e); } -function Gm(t) { +function c1(t) { const { children: e, onClick: r } = t; return /* @__PURE__ */ le.jsx("button", { onClick: r, className: "xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center", children: e }); } -function eA(t) { - const { wallet: e, connector: r, loading: n } = t, i = Zn(null), s = Zn(), [o, a] = Yt(), [u, l] = Yt(), [d, p] = Yt("connect"), [w, A] = Yt(!1), [M, N] = Yt(); +function IA(t) { + const { wallet: e, connector: r, loading: n } = t, i = Qn(null), s = Qn(), [o, a] = Yt(), [u, l] = Yt(), [d, p] = Yt("connect"), [w, _] = Yt(!1), [P, O] = Yt(); function L(K) { var ge; (ge = s.current) == null || ge.update({ @@ -43068,10 +43588,10 @@ function eA(t) { }); } async function B() { - A(!0); + _(!0); try { a(""); - const K = await Ta.getNonce({ account_type: "block_chain" }); + const K = await ka.getNonce({ account_type: "block_chain" }); if ("universalLink" in e && e.universalLink) { const ge = r.connect({ universalLink: e.universalLink, @@ -43080,15 +43600,15 @@ function eA(t) { request: { tonProof: K } }); if (!ge) return; - N(ge), L(ge), l(K); + O(ge), L(ge), l(K); } } catch (K) { a(K.message); } - A(!1); + _(!1); } - function $() { - s.current = new F9({ + function k() { + s.current = new dA({ width: 264, height: 264, margin: 0, @@ -43105,56 +43625,56 @@ function eA(t) { } }), s.current.append(i.current); } - function H() { + function q() { r.connect(e, { request: { tonProof: u } }); } function U() { if ("deepLink" in e) { - if (!e.deepLink || !M) return; - const K = new URL(M), ge = `${e.deepLink}${K.search}`; + if (!e.deepLink || !P) return; + const K = new URL(P), ge = `${e.deepLink}${K.search}`; window.open(ge); } } function V() { - "universalLink" in e && e.universalLink && /t.me/.test(e.universalLink) && window.open(M); + "universalLink" in e && e.universalLink && /t.me/.test(e.universalLink) && window.open(P); } - const te = wi(() => !!("deepLink" in e && e.deepLink), [e]), R = wi(() => !!("universalLink" in e && e.universalLink && /t.me/.test(e.universalLink)), [e]); + const Q = wi(() => !!("deepLink" in e && e.deepLink), [e]), R = wi(() => !!("universalLink" in e && e.universalLink && /t.me/.test(e.universalLink)), [e]); return Dn(() => { - $(), B(); - }, []), /* @__PURE__ */ le.jsxs(Ms, { children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), + k(), B(); + }, []), /* @__PURE__ */ le.jsxs(Rs, { children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(kc, { title: "Connect wallet", onBack: t.onBack }) }), /* @__PURE__ */ le.jsxs("div", { className: "xc-text-center xc-mb-6", children: [ /* @__PURE__ */ le.jsxs("div", { className: "xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1", children: [ /* @__PURE__ */ le.jsx("div", { className: "xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center", ref: i }), - /* @__PURE__ */ le.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: w ? /* @__PURE__ */ le.jsx(mc, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ le.jsx("img", { className: "xc-h-10 xc-w-10 xc-rounded-md", src: e.imageUrl }) }) + /* @__PURE__ */ le.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: w ? /* @__PURE__ */ le.jsx(Sc, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ le.jsx("img", { className: "xc-h-10 xc-w-10 xc-rounded-md", src: e.imageUrl }) }) ] }), /* @__PURE__ */ le.jsx("p", { className: "xc-text-center", children: "Scan the QR code below with your phone's camera. " }) ] }), /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-justify-center xc-gap-2", children: [ - n && /* @__PURE__ */ le.jsx(mc, { className: "xc-animate-spin" }), + n && /* @__PURE__ */ le.jsx(Sc, { className: "xc-animate-spin" }), !w && !n && /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ - Q9(e) && /* @__PURE__ */ le.jsxs(Gm, { onClick: H, children: [ - /* @__PURE__ */ le.jsx(gZ, { className: "xc-opacity-80" }), + MA(e) && /* @__PURE__ */ le.jsxs(c1, { onClick: q, children: [ + /* @__PURE__ */ le.jsx(GZ, { className: "xc-opacity-80" }), "Extension" ] }), - te && /* @__PURE__ */ le.jsxs(Gm, { onClick: U, children: [ - /* @__PURE__ */ le.jsx(HS, { className: "xc-opacity-80" }), + Q && /* @__PURE__ */ le.jsxs(c1, { onClick: U, children: [ + /* @__PURE__ */ le.jsx(y7, { className: "xc-opacity-80" }), "Desktop" ] }), - R && /* @__PURE__ */ le.jsx(Gm, { onClick: V, children: "Telegram Mini App" }) + R && /* @__PURE__ */ le.jsx(c1, { onClick: V, children: "Telegram Mini App" }) ] }) ] }) ] }); } -function use(t) { - const [e, r] = Yt(""), [n, i] = Yt(), [s, o] = Yt(), a = uy(), [u, l] = Yt(!1); +function qse(t) { + const [e, r] = Yt(""), [n, i] = Yt(), [s, o] = Yt(), a = Ey(), [u, l] = Yt(!1); async function d(w) { - var M, N; - if (!w || !((M = w.connectItems) != null && M.tonProof)) return; + var P, O; + if (!w || !((P = w.connectItems) != null && P.tonProof)) return; l(!0); - const A = await Ta.tonLogin({ + const _ = await ka.tonLogin({ account_type: "block_chain", connector: "codatta_ton", account_enum: "C", @@ -43164,7 +43684,7 @@ function use(t) { chain: w.account.chain, connect_info: [ { name: "ton_addr", network: w.account.chain, ...w.account }, - (N = w.connectItems) == null ? void 0 : N.tonProof + (O = w.connectItems) == null ? void 0 : O.tonProof ], source: { device: a.device, @@ -43172,20 +43692,20 @@ function use(t) { app: a.app } }); - await t.onLogin(A.data), l(!1); + await t.onLogin(_.data), l(!1); } Dn(() => { - const w = new fh({ + const w = new yh({ manifestUrl: "https://static.codatta.io/static/tonconnect-manifest.json?v=2" - }), A = w.onStatusChange(d); - return o(w), r("select"), A; + }), _ = w.onStatusChange(d); + return o(w), r("select"), _; }, []); function p(w) { r("connect"), i(w); } - return /* @__PURE__ */ le.jsxs(Ms, { children: [ + return /* @__PURE__ */ le.jsxs(Rs, { children: [ e === "select" && /* @__PURE__ */ le.jsx( - H9, + yA, { connector: s, onSelect: p, @@ -43193,7 +43713,7 @@ function use(t) { } ), e === "connect" && /* @__PURE__ */ le.jsx( - eA, + IA, { connector: s, wallet: n, @@ -43203,8 +43723,8 @@ function use(t) { ) ] }); } -function tA(t) { - const { children: e, className: r } = t, n = Zn(null), [i, s] = gv.useState(0); +function CA(t) { + const { children: e, className: r } = t, n = Qn(null), [i, s] = Rv.useState(0); function o() { var a; try { @@ -43236,7 +43756,7 @@ function tA(t) { } ); } -function fse() { +function zse() { return /* @__PURE__ */ le.jsxs("svg", { width: "121", height: "120", viewBox: "0 0 121 120", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [ /* @__PURE__ */ le.jsx("rect", { x: "0.5", width: "120", height: "120", rx: "60", fill: "#404049" }), /* @__PURE__ */ le.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z", fill: "#252532" }), @@ -43246,39 +43766,39 @@ function fse() { /* @__PURE__ */ le.jsx("path", { d: "M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829", stroke: "#77777D", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) ] }); } -function rA(t) { - const { wallets: e } = mp(), [r, n] = Yt(), i = wi(() => r ? e.filter((a) => a.key.toLowerCase().includes(r.toLowerCase())) : e, [r]); +function TA(t) { + const { wallets: e } = Tp(), [r, n] = Yt(), i = wi(() => r ? e.filter((a) => a.key.toLowerCase().includes(r.toLowerCase())) : e, [r]); function s(a) { t.onSelectWallet(a); } function o(a) { n(a.target.value); } - return /* @__PURE__ */ le.jsxs(Ms, { children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(Pc, { title: "Select wallet", onBack: t.onBack }) }), + return /* @__PURE__ */ le.jsxs(Rs, { children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(kc, { title: "Select wallet", onBack: t.onBack }) }), /* @__PURE__ */ le.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ - /* @__PURE__ */ le.jsx(KS, { className: "xc-shrink-0 xc-opacity-50" }), + /* @__PURE__ */ le.jsx(w7, { className: "xc-shrink-0 xc-opacity-50" }), /* @__PURE__ */ le.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: o }) ] }), /* @__PURE__ */ le.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: i.length ? i.map((a) => /* @__PURE__ */ le.jsx( - y9, + V9, { wallet: a, onClick: s }, `feature-${a.key}` - )) : /* @__PURE__ */ le.jsx(fse, {}) }) + )) : /* @__PURE__ */ le.jsx(zse, {}) }) ] }); } -function xoe(t) { +function tae(t) { const { onLogin: e, header: r, showEmailSignIn: n = !0, showMoreWallets: i = !0, showTonConnect: s = !0, showFeaturedWallets: o = !0 } = t, [a, u] = Yt(""), [l, d] = Yt(null), [p, w] = Yt(""); - function A(B) { + function _(B) { d(B), u("evm-wallet"); } - function M(B) { + function P(B) { u("email"), w(B); } - async function N(B) { + async function O(B) { await e(B); } function L() { @@ -43286,29 +43806,29 @@ function xoe(t) { } return Dn(() => { u("index"); - }, []), /* @__PURE__ */ le.jsx(Tne, { config: t.config, children: /* @__PURE__ */ le.jsxs(tA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ + }, []), /* @__PURE__ */ le.jsx(uie, { config: t.config, children: /* @__PURE__ */ le.jsxs(CA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ a === "evm-wallet" && /* @__PURE__ */ le.jsx( - hie, + Hie, { onBack: () => u("index"), - onLogin: N, + onLogin: O, wallet: l } ), a === "ton-wallet" && /* @__PURE__ */ le.jsx( - use, + qse, { onBack: () => u("index"), - onLogin: N + onLogin: O } ), - a === "email" && /* @__PURE__ */ le.jsx(Hne, { email: p, onBack: () => u("index"), onLogin: N }), + a === "email" && /* @__PURE__ */ le.jsx(Sie, { email: p, onBack: () => u("index"), onLogin: O }), a === "index" && /* @__PURE__ */ le.jsx( - M9, + tA, { header: r, - onEmailConfirm: M, - onSelectWallet: A, + onEmailConfirm: P, + onSelectWallet: _, onSelectMoreWallets: () => { u("all-wallet"); }, @@ -43322,23 +43842,23 @@ function xoe(t) { } ), a === "all-wallet" && /* @__PURE__ */ le.jsx( - rA, + TA, { onBack: () => u("index"), - onSelectWallet: A + onSelectWallet: _ } ) ] }) }); } -function lse(t) { +function Wse(t) { const { wallet: e, onConnect: r } = t, [n, i] = Yt(e.installed ? "connect" : "qr"); async function s(o, a) { await r(o, a); } - return /* @__PURE__ */ le.jsxs(Ms, { children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(Pc, { title: "Connect wallet", onBack: t.onBack }) }), + return /* @__PURE__ */ le.jsxs(Rs, { children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(kc, { title: "Connect wallet", onBack: t.onBack }) }), n === "qr" && /* @__PURE__ */ le.jsx( - q9, + mA, { wallet: e, onGetExtension: () => i("get-extension"), @@ -43346,36 +43866,36 @@ function lse(t) { } ), n === "connect" && /* @__PURE__ */ le.jsx( - z9, + vA, { onShowQrCode: () => i("qr"), wallet: e, onSignFinish: s } ), - n === "get-extension" && /* @__PURE__ */ le.jsx(W9, { wallet: e }) + n === "get-extension" && /* @__PURE__ */ le.jsx(bA, { wallet: e }) ] }); } -function hse(t) { +function Hse(t) { const { email: e } = t, [r, n] = Yt("captcha"); - return /* @__PURE__ */ le.jsxs(Ms, { children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ le.jsx(Pc, { title: "Sign in with email", onBack: t.onBack }) }), - r === "captcha" && /* @__PURE__ */ le.jsx($9, { email: e, onCodeSend: () => n("verify-email") }), - r === "verify-email" && /* @__PURE__ */ le.jsx(k9, { email: e, onInputCode: t.onInputCode, onResendCode: () => n("captcha") }) + return /* @__PURE__ */ le.jsxs(Rs, { children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ le.jsx(kc, { title: "Sign in with email", onBack: t.onBack }) }), + r === "captcha" && /* @__PURE__ */ le.jsx(lA, { email: e, onCodeSend: () => n("verify-email") }), + r === "verify-email" && /* @__PURE__ */ le.jsx(fA, { email: e, onInputCode: t.onInputCode, onResendCode: () => n("captcha") }) ] }); } -function _oe(t) { +function rae(t) { const { onEvmWalletConnect: e, onTonWalletConnect: r, onEmailConnect: n, config: i = { showEmailSignIn: !1, showFeaturedWallets: !0, showMoreWallets: !0, showTonConnect: !0 - } } = t, [s, o] = Yt(""), [a, u] = Yt(), [l, d] = Yt(), p = Zn(), [w, A] = Yt(""); - function M(U) { + } } = t, [s, o] = Yt(""), [a, u] = Yt(), [l, d] = Yt(), p = Qn(), [w, _] = Yt(""); + function P(U) { u(U), o("evm-wallet-connect"); } - function N(U) { - A(U), o("email-connect"); + function O(U) { + _(U), o("email-connect"); } async function L(U, V) { await (e == null ? void 0 : e({ @@ -43388,10 +43908,10 @@ function _oe(t) { async function B(U, V) { await (n == null ? void 0 : n(U, V)); } - function $(U) { + function k(U) { d(U), o("ton-wallet-connect"); } - async function H(U) { + async function q(U) { U && await (r == null ? void 0 : r({ chain_type: "ton", client: p.current, @@ -43400,21 +43920,21 @@ function _oe(t) { })); } return Dn(() => { - p.current = new fh({ + p.current = new yh({ manifestUrl: "https://static.codatta.io/static/tonconnect-manifest.json?v=2" }); - const U = p.current.onStatusChange(H); + const U = p.current.onStatusChange(q); return o("index"), U; - }, []), /* @__PURE__ */ le.jsxs(tA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ + }, []), /* @__PURE__ */ le.jsxs(CA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ s === "evm-wallet-select" && /* @__PURE__ */ le.jsx( - rA, + TA, { onBack: () => o("index"), - onSelectWallet: M + onSelectWallet: P } ), s === "evm-wallet-connect" && /* @__PURE__ */ le.jsx( - lse, + Wse, { onBack: () => o("index"), onConnect: L, @@ -43422,27 +43942,27 @@ function _oe(t) { } ), s === "ton-wallet-select" && /* @__PURE__ */ le.jsx( - H9, + yA, { connector: p.current, - onSelect: $, + onSelect: k, onBack: () => o("index") } ), s === "ton-wallet-connect" && /* @__PURE__ */ le.jsx( - eA, + IA, { connector: p.current, wallet: l, onBack: () => o("index") } ), - s === "email-connect" && /* @__PURE__ */ le.jsx(hse, { email: w, onBack: () => o("index"), onInputCode: B }), + s === "email-connect" && /* @__PURE__ */ le.jsx(Hse, { email: w, onBack: () => o("index"), onInputCode: B }), s === "index" && /* @__PURE__ */ le.jsx( - M9, + tA, { - onEmailConfirm: N, - onSelectWallet: M, + onEmailConfirm: O, + onSelectWallet: P, onSelectMoreWallets: () => o("evm-wallet-select"), onSelectTonConnect: () => o("ton-wallet-select"), config: i @@ -43451,18 +43971,23 @@ function _oe(t) { ] }); } export { - yoe as C, - C5 as H, - vl as W, - aZ as a, - Ll as b, - vse as c, - xoe as d, - Hd as e, - _oe as f, - mse as h, - bse as r, - n4 as s, - C0 as t, - mp as u + Qoe as C, + V5 as H, + Il as W, + mc as a, + XD as b, + Xse as c, + Yse as d, + al as e, + n0 as f, + r0 as g, + Jse as h, + HD as i, + jZ as j, + tae as k, + rae as l, + Zse as r, + qN as s, + q0 as t, + Tp as u }; diff --git a/dist/secp256k1-ChAPgt46.js b/dist/secp256k1-ChAPgt46.js deleted file mode 100644 index 3fa8f39..0000000 --- a/dist/secp256k1-ChAPgt46.js +++ /dev/null @@ -1,1286 +0,0 @@ -import { H as ee, h as ne, t as re, e as Zt, b as oe, r as ie, c as se, s as ce } from "./main-CeikbqJc.js"; -class Kt extends ee { - constructor(n, t) { - super(), this.finished = !1, this.destroyed = !1, ne(n); - const r = re(t); - if (this.iHash = n.create(), typeof this.iHash.update != "function") - throw new Error("Expected instance of class which extends utils.Hash"); - this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen; - const s = this.blockLen, o = new Uint8Array(s); - o.set(r.length > s ? n.create().update(r).digest() : r); - for (let a = 0; a < o.length; a++) - o[a] ^= 54; - this.iHash.update(o), this.oHash = n.create(); - for (let a = 0; a < o.length; a++) - o[a] ^= 106; - this.oHash.update(o), o.fill(0); - } - update(n) { - return Zt(this), this.iHash.update(n), this; - } - digestInto(n) { - Zt(this), oe(n, this.outputLen), this.finished = !0, this.iHash.digestInto(n), this.oHash.update(n), this.oHash.digestInto(n), this.destroy(); - } - digest() { - const n = new Uint8Array(this.oHash.outputLen); - return this.digestInto(n), n; - } - _cloneInto(n) { - n || (n = Object.create(Object.getPrototypeOf(this), {})); - const { oHash: t, iHash: r, finished: s, destroyed: o, blockLen: a, outputLen: f } = this; - return n = n, n.finished = s, n.destroyed = o, n.blockLen = a, n.outputLen = f, n.oHash = t._cloneInto(n.oHash), n.iHash = r._cloneInto(n.iHash), n; - } - destroy() { - this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy(); - } -} -const Pt = (e, n, t) => new Kt(e, n).update(t).digest(); -Pt.create = (e, n) => new Kt(e, n); -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -const qt = /* @__PURE__ */ BigInt(0), wt = /* @__PURE__ */ BigInt(1), fe = /* @__PURE__ */ BigInt(2); -function nt(e) { - return e instanceof Uint8Array || e != null && typeof e == "object" && e.constructor.name === "Uint8Array"; -} -function ht(e) { - if (!nt(e)) - throw new Error("Uint8Array expected"); -} -function ct(e, n) { - if (typeof n != "boolean") - throw new Error(`${e} must be valid boolean, got "${n}".`); -} -const ae = /* @__PURE__ */ Array.from({ length: 256 }, (e, n) => n.toString(16).padStart(2, "0")); -function ft(e) { - ht(e); - let n = ""; - for (let t = 0; t < e.length; t++) - n += ae[e[t]]; - return n; -} -function st(e) { - const n = e.toString(16); - return n.length & 1 ? `0${n}` : n; -} -function Ot(e) { - if (typeof e != "string") - throw new Error("hex string expected, got " + typeof e); - return BigInt(e === "" ? "0" : `0x${e}`); -} -const P = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 }; -function Rt(e) { - if (e >= P._0 && e <= P._9) - return e - P._0; - if (e >= P._A && e <= P._F) - return e - (P._A - 10); - if (e >= P._a && e <= P._f) - return e - (P._a - 10); -} -function at(e) { - if (typeof e != "string") - throw new Error("hex string expected, got " + typeof e); - const n = e.length, t = n / 2; - if (n % 2) - throw new Error("padded hex string expected, got unpadded hex of length " + n); - const r = new Uint8Array(t); - for (let s = 0, o = 0; s < t; s++, o += 2) { - const a = Rt(e.charCodeAt(o)), f = Rt(e.charCodeAt(o + 1)); - if (a === void 0 || f === void 0) { - const i = e[o] + e[o + 1]; - throw new Error('hex string expected, got non-hex character "' + i + '" at index ' + o); - } - r[s] = a * 16 + f; - } - return r; -} -function tt(e) { - return Ot(ft(e)); -} -function Nt(e) { - return ht(e), Ot(ft(Uint8Array.from(e).reverse())); -} -function lt(e, n) { - return at(e.toString(16).padStart(n * 2, "0")); -} -function $t(e, n) { - return lt(e, n).reverse(); -} -function le(e) { - return at(st(e)); -} -function K(e, n, t) { - let r; - if (typeof n == "string") - try { - r = at(n); - } catch (o) { - throw new Error(`${e} must be valid hex string, got "${n}". Cause: ${o}`); - } - else if (nt(n)) - r = Uint8Array.from(n); - else - throw new Error(`${e} must be hex string or Uint8Array`); - const s = r.length; - if (typeof t == "number" && s !== t) - throw new Error(`${e} expected ${t} bytes, got ${s}`); - return r; -} -function dt(...e) { - let n = 0; - for (let r = 0; r < e.length; r++) { - const s = e[r]; - ht(s), n += s.length; - } - const t = new Uint8Array(n); - for (let r = 0, s = 0; r < e.length; r++) { - const o = e[r]; - t.set(o, s), s += o.length; - } - return t; -} -function ue(e, n) { - if (e.length !== n.length) - return !1; - let t = 0; - for (let r = 0; r < e.length; r++) - t |= e[r] ^ n[r]; - return t === 0; -} -function de(e) { - if (typeof e != "string") - throw new Error(`utf8ToBytes expected string, got ${typeof e}`); - return new Uint8Array(new TextEncoder().encode(e)); -} -const mt = (e) => typeof e == "bigint" && qt <= e; -function yt(e, n, t) { - return mt(e) && mt(n) && mt(t) && n <= e && e < t; -} -function et(e, n, t, r) { - if (!yt(n, t, r)) - throw new Error(`expected valid ${e}: ${t} <= n < ${r}, got ${typeof n} ${n}`); -} -function Ft(e) { - let n; - for (n = 0; e > qt; e >>= wt, n += 1) - ; - return n; -} -function he(e, n) { - return e >> BigInt(n) & wt; -} -function ge(e, n, t) { - return e | (t ? wt : qt) << BigInt(n); -} -const Lt = (e) => (fe << BigInt(e - 1)) - wt, bt = (e) => new Uint8Array(e), zt = (e) => Uint8Array.from(e); -function Gt(e, n, t) { - if (typeof e != "number" || e < 2) - throw new Error("hashLen must be a number"); - if (typeof n != "number" || n < 2) - throw new Error("qByteLen must be a number"); - if (typeof t != "function") - throw new Error("hmacFn must be a function"); - let r = bt(e), s = bt(e), o = 0; - const a = () => { - r.fill(1), s.fill(0), o = 0; - }, f = (...E) => t(s, r, ...E), i = (E = bt()) => { - s = f(zt([0]), E), r = f(), E.length !== 0 && (s = f(zt([1]), E), r = f()); - }, l = () => { - if (o++ >= 1e3) - throw new Error("drbg: tried 1000 values"); - let E = 0; - const u = []; - for (; E < n; ) { - r = f(); - const q = r.slice(); - u.push(q), E += r.length; - } - return dt(...u); - }; - return (E, u) => { - a(), i(E); - let q; - for (; !(q = u(l())); ) - i(); - return a(), q; - }; -} -const we = { - bigint: (e) => typeof e == "bigint", - function: (e) => typeof e == "function", - boolean: (e) => typeof e == "boolean", - string: (e) => typeof e == "string", - stringOrUint8Array: (e) => typeof e == "string" || nt(e), - isSafeInteger: (e) => Number.isSafeInteger(e), - array: (e) => Array.isArray(e), - field: (e, n) => n.Fp.isValid(e), - hash: (e) => typeof e == "function" && Number.isSafeInteger(e.outputLen) -}; -function gt(e, n, t = {}) { - const r = (s, o, a) => { - const f = we[o]; - if (typeof f != "function") - throw new Error(`Invalid validator "${o}", expected function`); - const i = e[s]; - if (!(a && i === void 0) && !f(i, e)) - throw new Error(`Invalid param ${String(s)}=${i} (${typeof i}), expected ${o}`); - }; - for (const [s, o] of Object.entries(n)) - r(s, o, !1); - for (const [s, o] of Object.entries(t)) - r(s, o, !0); - return e; -} -const ye = () => { - throw new Error("not implemented"); -}; -function vt(e) { - const n = /* @__PURE__ */ new WeakMap(); - return (t, ...r) => { - const s = n.get(t); - if (s !== void 0) - return s; - const o = e(t, ...r); - return n.set(t, o), o; - }; -} -const pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - aInRange: et, - abool: ct, - abytes: ht, - bitGet: he, - bitLen: Ft, - bitMask: Lt, - bitSet: ge, - bytesToHex: ft, - bytesToNumberBE: tt, - bytesToNumberLE: Nt, - concatBytes: dt, - createHmacDrbg: Gt, - ensureBytes: K, - equalBytes: ue, - hexToBytes: at, - hexToNumber: Ot, - inRange: yt, - isBytes: nt, - memoized: vt, - notImplemented: ye, - numberToBytesBE: lt, - numberToBytesLE: $t, - numberToHexUnpadded: st, - numberToVarBytesBE: le, - utf8ToBytes: de, - validateObject: gt -}, Symbol.toStringTag, { value: "Module" })); -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -const R = BigInt(0), _ = BigInt(1), J = BigInt(2), me = BigInt(3), xt = BigInt(4), kt = BigInt(5), Ut = BigInt(8); -BigInt(9); -BigInt(16); -function U(e, n) { - const t = e % n; - return t >= R ? t : n + t; -} -function be(e, n, t) { - if (t <= R || n < R) - throw new Error("Expected power/modulo > 0"); - if (t === _) - return R; - let r = _; - for (; n > R; ) - n & _ && (r = r * e % t), e = e * e % t, n >>= _; - return r; -} -function V(e, n, t) { - let r = e; - for (; n-- > R; ) - r *= r, r %= t; - return r; -} -function St(e, n) { - if (e === R || n <= R) - throw new Error(`invert: expected positive integers, got n=${e} mod=${n}`); - let t = U(e, n), r = n, s = R, o = _; - for (; t !== R; ) { - const f = r / t, i = r % t, l = s - o * f; - r = t, t = i, s = o, o = l; - } - if (r !== _) - throw new Error("invert: does not exist"); - return U(s, n); -} -function Ee(e) { - const n = (e - _) / J; - let t, r, s; - for (t = e - _, r = 0; t % J === R; t /= J, r++) - ; - for (s = J; s < e && be(s, n, e) !== e - _; s++) - ; - if (r === 1) { - const a = (e + _) / xt; - return function(i, l) { - const m = i.pow(l, a); - if (!i.eql(i.sqr(m), l)) - throw new Error("Cannot find square root"); - return m; - }; - } - const o = (t + _) / J; - return function(f, i) { - if (f.pow(i, n) === f.neg(f.ONE)) - throw new Error("Cannot find square root"); - let l = r, m = f.pow(f.mul(f.ONE, s), t), E = f.pow(i, o), u = f.pow(i, t); - for (; !f.eql(u, f.ONE); ) { - if (f.eql(u, f.ZERO)) - return f.ZERO; - let q = 1; - for (let p = f.sqr(u); q < l && !f.eql(p, f.ONE); q++) - p = f.sqr(p); - const T = f.pow(m, _ << BigInt(l - q - 1)); - m = f.sqr(T), E = f.mul(E, T), u = f.mul(u, m), l = q; - } - return E; - }; -} -function Be(e) { - if (e % xt === me) { - const n = (e + _) / xt; - return function(r, s) { - const o = r.pow(s, n); - if (!r.eql(r.sqr(o), s)) - throw new Error("Cannot find square root"); - return o; - }; - } - if (e % Ut === kt) { - const n = (e - kt) / Ut; - return function(r, s) { - const o = r.mul(s, J), a = r.pow(o, n), f = r.mul(s, a), i = r.mul(r.mul(f, J), a), l = r.mul(f, r.sub(i, r.ONE)); - if (!r.eql(r.sqr(l), s)) - throw new Error("Cannot find square root"); - return l; - }; - } - return Ee(e); -} -const ve = [ - "create", - "isValid", - "is0", - "neg", - "inv", - "sqrt", - "sqr", - "eql", - "add", - "sub", - "mul", - "pow", - "div", - "addN", - "subN", - "mulN", - "sqrN" -]; -function xe(e) { - const n = { - ORDER: "bigint", - MASK: "bigint", - BYTES: "isSafeInteger", - BITS: "isSafeInteger" - }, t = ve.reduce((r, s) => (r[s] = "function", r), n); - return gt(e, t); -} -function Se(e, n, t) { - if (t < R) - throw new Error("Expected power > 0"); - if (t === R) - return e.ONE; - if (t === _) - return n; - let r = e.ONE, s = n; - for (; t > R; ) - t & _ && (r = e.mul(r, s)), s = e.sqr(s), t >>= _; - return r; -} -function Ie(e, n) { - const t = new Array(n.length), r = n.reduce((o, a, f) => e.is0(a) ? o : (t[f] = o, e.mul(o, a)), e.ONE), s = e.inv(r); - return n.reduceRight((o, a, f) => e.is0(a) ? o : (t[f] = e.mul(o, t[f]), e.mul(o, a)), s), t; -} -function Wt(e, n) { - const t = n !== void 0 ? n : e.toString(2).length, r = Math.ceil(t / 8); - return { nBitLength: t, nByteLength: r }; -} -function Xt(e, n, t = !1, r = {}) { - if (e <= R) - throw new Error(`Expected Field ORDER > 0, got ${e}`); - const { nBitLength: s, nByteLength: o } = Wt(e, n); - if (o > 2048) - throw new Error("Field lengths over 2048 bytes are not supported"); - const a = Be(e), f = Object.freeze({ - ORDER: e, - BITS: s, - BYTES: o, - MASK: Lt(s), - ZERO: R, - ONE: _, - create: (i) => U(i, e), - isValid: (i) => { - if (typeof i != "bigint") - throw new Error(`Invalid field element: expected bigint, got ${typeof i}`); - return R <= i && i < e; - }, - is0: (i) => i === R, - isOdd: (i) => (i & _) === _, - neg: (i) => U(-i, e), - eql: (i, l) => i === l, - sqr: (i) => U(i * i, e), - add: (i, l) => U(i + l, e), - sub: (i, l) => U(i - l, e), - mul: (i, l) => U(i * l, e), - pow: (i, l) => Se(f, i, l), - div: (i, l) => U(i * St(l, e), e), - // Same as above, but doesn't normalize - sqrN: (i) => i * i, - addN: (i, l) => i + l, - subN: (i, l) => i - l, - mulN: (i, l) => i * l, - inv: (i) => St(i, e), - sqrt: r.sqrt || ((i) => a(f, i)), - invertBatch: (i) => Ie(f, i), - // TODO: do we really need constant cmov? - // We don't have const-time bigints anyway, so probably will be not very useful - cmov: (i, l, m) => m ? l : i, - toBytes: (i) => t ? $t(i, o) : lt(i, o), - fromBytes: (i) => { - if (i.length !== o) - throw new Error(`Fp.fromBytes: expected ${o}, got ${i.length}`); - return t ? Nt(i) : tt(i); - } - }); - return Object.freeze(f); -} -function Dt(e) { - if (typeof e != "bigint") - throw new Error("field order must be bigint"); - const n = e.toString(2).length; - return Math.ceil(n / 8); -} -function Qt(e) { - const n = Dt(e); - return n + Math.ceil(n / 2); -} -function Ae(e, n, t = !1) { - const r = e.length, s = Dt(n), o = Qt(n); - if (r < 16 || r < o || r > 1024) - throw new Error(`expected ${o}-1024 bytes of input, got ${r}`); - const a = t ? tt(e) : Nt(e), f = U(a, n - _) + _; - return t ? $t(f, s) : lt(f, s); -} -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -const qe = BigInt(0), Et = BigInt(1), Bt = /* @__PURE__ */ new WeakMap(), Ct = /* @__PURE__ */ new WeakMap(); -function Oe(e, n) { - const t = (o, a) => { - const f = a.negate(); - return o ? f : a; - }, r = (o) => { - if (!Number.isSafeInteger(o) || o <= 0 || o > n) - throw new Error(`Wrong window size=${o}, should be [1..${n}]`); - }, s = (o) => { - r(o); - const a = Math.ceil(n / o) + 1, f = 2 ** (o - 1); - return { windows: a, windowSize: f }; - }; - return { - constTimeNegate: t, - // non-const time multiplication ladder - unsafeLadder(o, a) { - let f = e.ZERO, i = o; - for (; a > qe; ) - a & Et && (f = f.add(i)), i = i.double(), a >>= Et; - return f; - }, - /** - * Creates a wNAF precomputation window. Used for caching. - * Default window size is set by `utils.precompute()` and is equal to 8. - * Number of precomputed points depends on the curve size: - * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: - * - 𝑊 is the window size - * - 𝑛 is the bitlength of the curve order. - * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. - * @returns precomputed point tables flattened to a single array - */ - precomputeWindow(o, a) { - const { windows: f, windowSize: i } = s(a), l = []; - let m = o, E = m; - for (let u = 0; u < f; u++) { - E = m, l.push(E); - for (let q = 1; q < i; q++) - E = E.add(m), l.push(E); - m = E.double(); - } - return l; - }, - /** - * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. - * @param W window size - * @param precomputes precomputed tables - * @param n scalar (we don't check here, but should be less than curve order) - * @returns real and fake (for const-time) points - */ - wNAF(o, a, f) { - const { windows: i, windowSize: l } = s(o); - let m = e.ZERO, E = e.BASE; - const u = BigInt(2 ** o - 1), q = 2 ** o, T = BigInt(o); - for (let p = 0; p < i; p++) { - const c = p * l; - let h = Number(f & u); - f >>= T, h > l && (h -= q, f += Et); - const y = c, B = c + Math.abs(h) - 1, x = p % 2 !== 0, O = h < 0; - h === 0 ? E = E.add(t(x, a[y])) : m = m.add(t(O, a[B])); - } - return { p: m, f: E }; - }, - wNAFCached(o, a, f) { - const i = Ct.get(o) || 1; - let l = Bt.get(o); - return l || (l = this.precomputeWindow(o, i), i !== 1 && Bt.set(o, f(l))), this.wNAF(i, l, a); - }, - // We calculate precomputes for elliptic curve point multiplication - // using windowed method. This specifies window size and - // stores precomputed values. Usually only base point would be precomputed. - setWindowSize(o, a) { - r(a), Ct.set(o, a), Bt.delete(o); - } - }; -} -function Ne(e, n, t, r) { - if (!Array.isArray(t) || !Array.isArray(r) || r.length !== t.length) - throw new Error("arrays of points and scalars must have equal length"); - r.forEach((m, E) => { - if (!n.isValid(m)) - throw new Error(`wrong scalar at index ${E}`); - }), t.forEach((m, E) => { - if (!(m instanceof e)) - throw new Error(`wrong point at index ${E}`); - }); - const s = Ft(BigInt(t.length)), o = s > 12 ? s - 3 : s > 4 ? s - 2 : s ? 2 : 1, a = (1 << o) - 1, f = new Array(a + 1).fill(e.ZERO), i = Math.floor((n.BITS - 1) / o) * o; - let l = e.ZERO; - for (let m = i; m >= 0; m -= o) { - f.fill(e.ZERO); - for (let u = 0; u < r.length; u++) { - const q = r[u], T = Number(q >> BigInt(m) & BigInt(a)); - f[T] = f[T].add(t[u]); - } - let E = e.ZERO; - for (let u = f.length - 1, q = e.ZERO; u > 0; u--) - q = q.add(f[u]), E = E.add(q); - if (l = l.add(E), m !== 0) - for (let u = 0; u < o; u++) - l = l.double(); - } - return l; -} -function Jt(e) { - return xe(e.Fp), gt(e, { - n: "bigint", - h: "bigint", - Gx: "field", - Gy: "field" - }, { - nBitLength: "isSafeInteger", - nByteLength: "isSafeInteger" - }), Object.freeze({ - ...Wt(e.n, e.nBitLength), - ...e, - p: e.Fp.ORDER - }); -} -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -function jt(e) { - e.lowS !== void 0 && ct("lowS", e.lowS), e.prehash !== void 0 && ct("prehash", e.prehash); -} -function $e(e) { - const n = Jt(e); - gt(n, { - a: "field", - b: "field" - }, { - allowedPrivateKeyLengths: "array", - wrapPrivateKey: "boolean", - isTorsionFree: "function", - clearCofactor: "function", - allowInfinityPoint: "boolean", - fromBytes: "function", - toBytes: "function" - }); - const { endo: t, Fp: r, a: s } = n; - if (t) { - if (!r.eql(s, r.ZERO)) - throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0"); - if (typeof t != "object" || typeof t.beta != "bigint" || typeof t.splitScalar != "function") - throw new Error("Expected endomorphism with beta: bigint and splitScalar: function"); - } - return Object.freeze({ ...n }); -} -const { bytesToNumberBE: Le, hexToBytes: _e } = pe, F = { - // asn.1 DER encoding utils - Err: class extends Error { - constructor(n = "") { - super(n); - } - }, - // Basic building block is TLV (Tag-Length-Value) - _tlv: { - encode: (e, n) => { - const { Err: t } = F; - if (e < 0 || e > 256) - throw new t("tlv.encode: wrong tag"); - if (n.length & 1) - throw new t("tlv.encode: unpadded data"); - const r = n.length / 2, s = st(r); - if (s.length / 2 & 128) - throw new t("tlv.encode: long form length too big"); - const o = r > 127 ? st(s.length / 2 | 128) : ""; - return `${st(e)}${o}${s}${n}`; - }, - // v - value, l - left bytes (unparsed) - decode(e, n) { - const { Err: t } = F; - let r = 0; - if (e < 0 || e > 256) - throw new t("tlv.encode: wrong tag"); - if (n.length < 2 || n[r++] !== e) - throw new t("tlv.decode: wrong tlv"); - const s = n[r++], o = !!(s & 128); - let a = 0; - if (!o) - a = s; - else { - const i = s & 127; - if (!i) - throw new t("tlv.decode(long): indefinite length not supported"); - if (i > 4) - throw new t("tlv.decode(long): byte length is too big"); - const l = n.subarray(r, r + i); - if (l.length !== i) - throw new t("tlv.decode: length bytes not complete"); - if (l[0] === 0) - throw new t("tlv.decode(long): zero leftmost byte"); - for (const m of l) - a = a << 8 | m; - if (r += i, a < 128) - throw new t("tlv.decode(long): not minimal encoding"); - } - const f = n.subarray(r, r + a); - if (f.length !== a) - throw new t("tlv.decode: wrong value length"); - return { v: f, l: n.subarray(r + a) }; - } - }, - // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag, - // since we always use positive integers here. It must always be empty: - // - add zero byte if exists - // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding) - _int: { - encode(e) { - const { Err: n } = F; - if (e < G) - throw new n("integer: negative integers are not allowed"); - let t = st(e); - if (Number.parseInt(t[0], 16) & 8 && (t = "00" + t), t.length & 1) - throw new n("unexpected assertion"); - return t; - }, - decode(e) { - const { Err: n } = F; - if (e[0] & 128) - throw new n("Invalid signature integer: negative"); - if (e[0] === 0 && !(e[1] & 128)) - throw new n("Invalid signature integer: unnecessary leading zero"); - return Le(e); - } - }, - toSig(e) { - const { Err: n, _int: t, _tlv: r } = F, s = typeof e == "string" ? _e(e) : e; - ht(s); - const { v: o, l: a } = r.decode(48, s); - if (a.length) - throw new n("Invalid signature: left bytes after parsing"); - const { v: f, l: i } = r.decode(2, o), { v: l, l: m } = r.decode(2, i); - if (m.length) - throw new n("Invalid signature: left bytes after parsing"); - return { r: t.decode(f), s: t.decode(l) }; - }, - hexFromSig(e) { - const { _tlv: n, _int: t } = F, r = `${n.encode(2, t.encode(e.r))}${n.encode(2, t.encode(e.s))}`; - return n.encode(48, r); - } -}, G = BigInt(0), Z = BigInt(1); -BigInt(2); -const Vt = BigInt(3); -BigInt(4); -function Te(e) { - const n = $e(e), { Fp: t } = n, r = Xt(n.n, n.nBitLength), s = n.toBytes || ((p, c, h) => { - const y = c.toAffine(); - return dt(Uint8Array.from([4]), t.toBytes(y.x), t.toBytes(y.y)); - }), o = n.fromBytes || ((p) => { - const c = p.subarray(1), h = t.fromBytes(c.subarray(0, t.BYTES)), y = t.fromBytes(c.subarray(t.BYTES, 2 * t.BYTES)); - return { x: h, y }; - }); - function a(p) { - const { a: c, b: h } = n, y = t.sqr(p), B = t.mul(y, p); - return t.add(t.add(B, t.mul(p, c)), h); - } - if (!t.eql(t.sqr(n.Gy), a(n.Gx))) - throw new Error("bad generator point: equation left != right"); - function f(p) { - return yt(p, Z, n.n); - } - function i(p) { - const { allowedPrivateKeyLengths: c, nByteLength: h, wrapPrivateKey: y, n: B } = n; - if (c && typeof p != "bigint") { - if (nt(p) && (p = ft(p)), typeof p != "string" || !c.includes(p.length)) - throw new Error("Invalid key"); - p = p.padStart(h * 2, "0"); - } - let x; - try { - x = typeof p == "bigint" ? p : tt(K("private key", p, h)); - } catch { - throw new Error(`private key must be ${h} bytes, hex or bigint, not ${typeof p}`); - } - return y && (x = U(x, B)), et("private key", x, Z, B), x; - } - function l(p) { - if (!(p instanceof u)) - throw new Error("ProjectivePoint expected"); - } - const m = vt((p, c) => { - const { px: h, py: y, pz: B } = p; - if (t.eql(B, t.ONE)) - return { x: h, y }; - const x = p.is0(); - c == null && (c = x ? t.ONE : t.inv(B)); - const O = t.mul(h, c), S = t.mul(y, c), b = t.mul(B, c); - if (x) - return { x: t.ZERO, y: t.ZERO }; - if (!t.eql(b, t.ONE)) - throw new Error("invZ was invalid"); - return { x: O, y: S }; - }), E = vt((p) => { - if (p.is0()) { - if (n.allowInfinityPoint && !t.is0(p.py)) - return; - throw new Error("bad point: ZERO"); - } - const { x: c, y: h } = p.toAffine(); - if (!t.isValid(c) || !t.isValid(h)) - throw new Error("bad point: x or y not FE"); - const y = t.sqr(h), B = a(c); - if (!t.eql(y, B)) - throw new Error("bad point: equation left != right"); - if (!p.isTorsionFree()) - throw new Error("bad point: not in prime-order subgroup"); - return !0; - }); - class u { - constructor(c, h, y) { - if (this.px = c, this.py = h, this.pz = y, c == null || !t.isValid(c)) - throw new Error("x required"); - if (h == null || !t.isValid(h)) - throw new Error("y required"); - if (y == null || !t.isValid(y)) - throw new Error("z required"); - Object.freeze(this); - } - // Does not validate if the point is on-curve. - // Use fromHex instead, or call assertValidity() later. - static fromAffine(c) { - const { x: h, y } = c || {}; - if (!c || !t.isValid(h) || !t.isValid(y)) - throw new Error("invalid affine point"); - if (c instanceof u) - throw new Error("projective point not allowed"); - const B = (x) => t.eql(x, t.ZERO); - return B(h) && B(y) ? u.ZERO : new u(h, y, t.ONE); - } - get x() { - return this.toAffine().x; - } - get y() { - return this.toAffine().y; - } - /** - * Takes a bunch of Projective Points but executes only one - * inversion on all of them. Inversion is very slow operation, - * so this improves performance massively. - * Optimization: converts a list of projective points to a list of identical points with Z=1. - */ - static normalizeZ(c) { - const h = t.invertBatch(c.map((y) => y.pz)); - return c.map((y, B) => y.toAffine(h[B])).map(u.fromAffine); - } - /** - * Converts hash string or Uint8Array to Point. - * @param hex short/long ECDSA hex - */ - static fromHex(c) { - const h = u.fromAffine(o(K("pointHex", c))); - return h.assertValidity(), h; - } - // Multiplies generator point by privateKey. - static fromPrivateKey(c) { - return u.BASE.multiply(i(c)); - } - // Multiscalar Multiplication - static msm(c, h) { - return Ne(u, r, c, h); - } - // "Private method", don't use it directly - _setWindowSize(c) { - T.setWindowSize(this, c); - } - // A point on curve is valid if it conforms to equation. - assertValidity() { - E(this); - } - hasEvenY() { - const { y: c } = this.toAffine(); - if (t.isOdd) - return !t.isOdd(c); - throw new Error("Field doesn't support isOdd"); - } - /** - * Compare one point to another. - */ - equals(c) { - l(c); - const { px: h, py: y, pz: B } = this, { px: x, py: O, pz: S } = c, b = t.eql(t.mul(h, S), t.mul(x, B)), v = t.eql(t.mul(y, S), t.mul(O, B)); - return b && v; - } - /** - * Flips point to one corresponding to (x, -y) in Affine coordinates. - */ - negate() { - return new u(this.px, t.neg(this.py), this.pz); - } - // Renes-Costello-Batina exception-free doubling formula. - // There is 30% faster Jacobian formula, but it is not complete. - // https://eprint.iacr.org/2015/1060, algorithm 3 - // Cost: 8M + 3S + 3*a + 2*b3 + 15add. - double() { - const { a: c, b: h } = n, y = t.mul(h, Vt), { px: B, py: x, pz: O } = this; - let S = t.ZERO, b = t.ZERO, v = t.ZERO, A = t.mul(B, B), j = t.mul(x, x), L = t.mul(O, O), N = t.mul(B, x); - return N = t.add(N, N), v = t.mul(B, O), v = t.add(v, v), S = t.mul(c, v), b = t.mul(y, L), b = t.add(S, b), S = t.sub(j, b), b = t.add(j, b), b = t.mul(S, b), S = t.mul(N, S), v = t.mul(y, v), L = t.mul(c, L), N = t.sub(A, L), N = t.mul(c, N), N = t.add(N, v), v = t.add(A, A), A = t.add(v, A), A = t.add(A, L), A = t.mul(A, N), b = t.add(b, A), L = t.mul(x, O), L = t.add(L, L), A = t.mul(L, N), S = t.sub(S, A), v = t.mul(L, j), v = t.add(v, v), v = t.add(v, v), new u(S, b, v); - } - // Renes-Costello-Batina exception-free addition formula. - // There is 30% faster Jacobian formula, but it is not complete. - // https://eprint.iacr.org/2015/1060, algorithm 1 - // Cost: 12M + 0S + 3*a + 3*b3 + 23add. - add(c) { - l(c); - const { px: h, py: y, pz: B } = this, { px: x, py: O, pz: S } = c; - let b = t.ZERO, v = t.ZERO, A = t.ZERO; - const j = n.a, L = t.mul(n.b, Vt); - let N = t.mul(h, x), C = t.mul(y, O), d = t.mul(B, S), g = t.add(h, y), w = t.add(x, O); - g = t.mul(g, w), w = t.add(N, C), g = t.sub(g, w), w = t.add(h, B); - let I = t.add(x, S); - return w = t.mul(w, I), I = t.add(N, d), w = t.sub(w, I), I = t.add(y, B), b = t.add(O, S), I = t.mul(I, b), b = t.add(C, d), I = t.sub(I, b), A = t.mul(j, w), b = t.mul(L, d), A = t.add(b, A), b = t.sub(C, A), A = t.add(C, A), v = t.mul(b, A), C = t.add(N, N), C = t.add(C, N), d = t.mul(j, d), w = t.mul(L, w), C = t.add(C, d), d = t.sub(N, d), d = t.mul(j, d), w = t.add(w, d), N = t.mul(C, w), v = t.add(v, N), N = t.mul(I, w), b = t.mul(g, b), b = t.sub(b, N), N = t.mul(g, C), A = t.mul(I, A), A = t.add(A, N), new u(b, v, A); - } - subtract(c) { - return this.add(c.negate()); - } - is0() { - return this.equals(u.ZERO); - } - wNAF(c) { - return T.wNAFCached(this, c, u.normalizeZ); - } - /** - * Non-constant-time multiplication. Uses double-and-add algorithm. - * It's faster, but should only be used when you don't care about - * an exposed private key e.g. sig verification, which works over *public* keys. - */ - multiplyUnsafe(c) { - et("scalar", c, G, n.n); - const h = u.ZERO; - if (c === G) - return h; - if (c === Z) - return this; - const { endo: y } = n; - if (!y) - return T.unsafeLadder(this, c); - let { k1neg: B, k1: x, k2neg: O, k2: S } = y.splitScalar(c), b = h, v = h, A = this; - for (; x > G || S > G; ) - x & Z && (b = b.add(A)), S & Z && (v = v.add(A)), A = A.double(), x >>= Z, S >>= Z; - return B && (b = b.negate()), O && (v = v.negate()), v = new u(t.mul(v.px, y.beta), v.py, v.pz), b.add(v); - } - /** - * Constant time multiplication. - * Uses wNAF method. Windowed method may be 10% faster, - * but takes 2x longer to generate and consumes 2x memory. - * Uses precomputes when available. - * Uses endomorphism for Koblitz curves. - * @param scalar by which the point would be multiplied - * @returns New point - */ - multiply(c) { - const { endo: h, n: y } = n; - et("scalar", c, Z, y); - let B, x; - if (h) { - const { k1neg: O, k1: S, k2neg: b, k2: v } = h.splitScalar(c); - let { p: A, f: j } = this.wNAF(S), { p: L, f: N } = this.wNAF(v); - A = T.constTimeNegate(O, A), L = T.constTimeNegate(b, L), L = new u(t.mul(L.px, h.beta), L.py, L.pz), B = A.add(L), x = j.add(N); - } else { - const { p: O, f: S } = this.wNAF(c); - B = O, x = S; - } - return u.normalizeZ([B, x])[0]; - } - /** - * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly. - * Not using Strauss-Shamir trick: precomputation tables are faster. - * The trick could be useful if both P and Q are not G (not in our case). - * @returns non-zero affine point - */ - multiplyAndAddUnsafe(c, h, y) { - const B = u.BASE, x = (S, b) => b === G || b === Z || !S.equals(B) ? S.multiplyUnsafe(b) : S.multiply(b), O = x(this, h).add(x(c, y)); - return O.is0() ? void 0 : O; - } - // Converts Projective point to affine (x, y) coordinates. - // Can accept precomputed Z^-1 - for example, from invertBatch. - // (x, y, z) ∋ (x=x/z, y=y/z) - toAffine(c) { - return m(this, c); - } - isTorsionFree() { - const { h: c, isTorsionFree: h } = n; - if (c === Z) - return !0; - if (h) - return h(u, this); - throw new Error("isTorsionFree() has not been declared for the elliptic curve"); - } - clearCofactor() { - const { h: c, clearCofactor: h } = n; - return c === Z ? this : h ? h(u, this) : this.multiplyUnsafe(n.h); - } - toRawBytes(c = !0) { - return ct("isCompressed", c), this.assertValidity(), s(u, this, c); - } - toHex(c = !0) { - return ct("isCompressed", c), ft(this.toRawBytes(c)); - } - } - u.BASE = new u(n.Gx, n.Gy, t.ONE), u.ZERO = new u(t.ZERO, t.ONE, t.ZERO); - const q = n.nBitLength, T = Oe(u, n.endo ? Math.ceil(q / 2) : q); - return { - CURVE: n, - ProjectivePoint: u, - normPrivateKeyToScalar: i, - weierstrassEquation: a, - isWithinCurveOrder: f - }; -} -function He(e) { - const n = Jt(e); - return gt(n, { - hash: "hash", - hmac: "function", - randomBytes: "function" - }, { - bits2int: "function", - bits2int_modN: "function", - lowS: "boolean" - }), Object.freeze({ lowS: !0, ...n }); -} -function Ze(e) { - const n = He(e), { Fp: t, n: r } = n, s = t.BYTES + 1, o = 2 * t.BYTES + 1; - function a(d) { - return U(d, r); - } - function f(d) { - return St(d, r); - } - const { ProjectivePoint: i, normPrivateKeyToScalar: l, weierstrassEquation: m, isWithinCurveOrder: E } = Te({ - ...n, - toBytes(d, g, w) { - const I = g.toAffine(), $ = t.toBytes(I.x), H = dt; - return ct("isCompressed", w), w ? H(Uint8Array.from([g.hasEvenY() ? 2 : 3]), $) : H(Uint8Array.from([4]), $, t.toBytes(I.y)); - }, - fromBytes(d) { - const g = d.length, w = d[0], I = d.subarray(1); - if (g === s && (w === 2 || w === 3)) { - const $ = tt(I); - if (!yt($, Z, t.ORDER)) - throw new Error("Point is not on curve"); - const H = m($); - let z; - try { - z = t.sqrt(H); - } catch (M) { - const X = M instanceof Error ? ": " + M.message : ""; - throw new Error("Point is not on curve" + X); - } - const k = (z & Z) === Z; - return (w & 1) === 1 !== k && (z = t.neg(z)), { x: $, y: z }; - } else if (g === o && w === 4) { - const $ = t.fromBytes(I.subarray(0, t.BYTES)), H = t.fromBytes(I.subarray(t.BYTES, 2 * t.BYTES)); - return { x: $, y: H }; - } else - throw new Error(`Point of length ${g} was invalid. Expected ${s} compressed bytes or ${o} uncompressed bytes`); - } - }), u = (d) => ft(lt(d, n.nByteLength)); - function q(d) { - const g = r >> Z; - return d > g; - } - function T(d) { - return q(d) ? a(-d) : d; - } - const p = (d, g, w) => tt(d.slice(g, w)); - class c { - constructor(g, w, I) { - this.r = g, this.s = w, this.recovery = I, this.assertValidity(); - } - // pair (bytes of r, bytes of s) - static fromCompact(g) { - const w = n.nByteLength; - return g = K("compactSignature", g, w * 2), new c(p(g, 0, w), p(g, w, 2 * w)); - } - // DER encoded ECDSA signature - // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script - static fromDER(g) { - const { r: w, s: I } = F.toSig(K("DER", g)); - return new c(w, I); - } - assertValidity() { - et("r", this.r, Z, r), et("s", this.s, Z, r); - } - addRecoveryBit(g) { - return new c(this.r, this.s, g); - } - recoverPublicKey(g) { - const { r: w, s: I, recovery: $ } = this, H = S(K("msgHash", g)); - if ($ == null || ![0, 1, 2, 3].includes($)) - throw new Error("recovery id invalid"); - const z = $ === 2 || $ === 3 ? w + n.n : w; - if (z >= t.ORDER) - throw new Error("recovery id 2 or 3 invalid"); - const k = $ & 1 ? "03" : "02", W = i.fromHex(k + u(z)), M = f(z), X = a(-H * M), ut = a(I * M), D = i.BASE.multiplyAndAddUnsafe(W, X, ut); - if (!D) - throw new Error("point at infinify"); - return D.assertValidity(), D; - } - // Signatures should be low-s, to prevent malleability. - hasHighS() { - return q(this.s); - } - normalizeS() { - return this.hasHighS() ? new c(this.r, a(-this.s), this.recovery) : this; - } - // DER-encoded - toDERRawBytes() { - return at(this.toDERHex()); - } - toDERHex() { - return F.hexFromSig({ r: this.r, s: this.s }); - } - // padded bytes of r, then padded bytes of s - toCompactRawBytes() { - return at(this.toCompactHex()); - } - toCompactHex() { - return u(this.r) + u(this.s); - } - } - const h = { - isValidPrivateKey(d) { - try { - return l(d), !0; - } catch { - return !1; - } - }, - normPrivateKeyToScalar: l, - /** - * Produces cryptographically secure private key from random of size - * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible. - */ - randomPrivateKey: () => { - const d = Qt(n.n); - return Ae(n.randomBytes(d), n.n); - }, - /** - * Creates precompute table for an arbitrary EC point. Makes point "cached". - * Allows to massively speed-up `point.multiply(scalar)`. - * @returns cached point - * @example - * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey)); - * fast.multiply(privKey); // much faster ECDH now - */ - precompute(d = 8, g = i.BASE) { - return g._setWindowSize(d), g.multiply(BigInt(3)), g; - } - }; - function y(d, g = !0) { - return i.fromPrivateKey(d).toRawBytes(g); - } - function B(d) { - const g = nt(d), w = typeof d == "string", I = (g || w) && d.length; - return g ? I === s || I === o : w ? I === 2 * s || I === 2 * o : d instanceof i; - } - function x(d, g, w = !0) { - if (B(d)) - throw new Error("first arg must be private key"); - if (!B(g)) - throw new Error("second arg must be public key"); - return i.fromHex(g).multiply(l(d)).toRawBytes(w); - } - const O = n.bits2int || function(d) { - const g = tt(d), w = d.length * 8 - n.nBitLength; - return w > 0 ? g >> BigInt(w) : g; - }, S = n.bits2int_modN || function(d) { - return a(O(d)); - }, b = Lt(n.nBitLength); - function v(d) { - return et(`num < 2^${n.nBitLength}`, d, G, b), lt(d, n.nByteLength); - } - function A(d, g, w = j) { - if (["recovered", "canonical"].some((Q) => Q in w)) - throw new Error("sign() legacy options not supported"); - const { hash: I, randomBytes: $ } = n; - let { lowS: H, prehash: z, extraEntropy: k } = w; - H == null && (H = !0), d = K("msgHash", d), jt(w), z && (d = K("prehashed msgHash", I(d))); - const W = S(d), M = l(g), X = [v(M), v(W)]; - if (k != null && k !== !1) { - const Q = k === !0 ? $(t.BYTES) : k; - X.push(K("extraEntropy", Q)); - } - const ut = dt(...X), D = W; - function pt(Q) { - const rt = O(Q); - if (!E(rt)) - return; - const _t = f(rt), ot = i.BASE.multiply(rt).toAffine(), Y = a(ot.x); - if (Y === G) - return; - const it = a(_t * a(D + Y * M)); - if (it === G) - return; - let Tt = (ot.x === Y ? 0 : 2) | Number(ot.y & Z), Ht = it; - return H && q(it) && (Ht = T(it), Tt ^= 1), new c(Y, Ht, Tt); - } - return { seed: ut, k2sig: pt }; - } - const j = { lowS: n.lowS, prehash: !1 }, L = { lowS: n.lowS, prehash: !1 }; - function N(d, g, w = j) { - const { seed: I, k2sig: $ } = A(d, g, w), H = n; - return Gt(H.hash.outputLen, H.nByteLength, H.hmac)(I, $); - } - i.BASE._setWindowSize(8); - function C(d, g, w, I = L) { - var ot; - const $ = d; - if (g = K("msgHash", g), w = K("publicKey", w), "strict" in I) - throw new Error("options.strict was renamed to lowS"); - jt(I); - const { lowS: H, prehash: z } = I; - let k, W; - try { - if (typeof $ == "string" || nt($)) - try { - k = c.fromDER($); - } catch (Y) { - if (!(Y instanceof F.Err)) - throw Y; - k = c.fromCompact($); - } - else if (typeof $ == "object" && typeof $.r == "bigint" && typeof $.s == "bigint") { - const { r: Y, s: it } = $; - k = new c(Y, it); - } else - throw new Error("PARSE"); - W = i.fromHex(w); - } catch (Y) { - if (Y.message === "PARSE") - throw new Error("signature must be Signature instance, Uint8Array or hex string"); - return !1; - } - if (H && k.hasHighS()) - return !1; - z && (g = n.hash(g)); - const { r: M, s: X } = k, ut = S(g), D = f(X), pt = a(ut * D), Q = a(M * D), rt = (ot = i.BASE.multiplyAndAddUnsafe(W, pt, Q)) == null ? void 0 : ot.toAffine(); - return rt ? a(rt.x) === M : !1; - } - return { - CURVE: n, - getPublicKey: y, - getSharedSecret: x, - sign: N, - verify: C, - ProjectivePoint: i, - Signature: c, - utils: h - }; -} -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -function Re(e) { - return { - hash: e, - hmac: (n, ...t) => Pt(e, n, se(...t)), - randomBytes: ie - }; -} -function ze(e, n) { - const t = (r) => Ze({ ...e, ...Re(r) }); - return Object.freeze({ ...t(n), create: t }); -} -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -const te = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), Mt = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), ke = BigInt(1), It = BigInt(2), Yt = (e, n) => (e + n / It) / n; -function Ue(e) { - const n = te, t = BigInt(3), r = BigInt(6), s = BigInt(11), o = BigInt(22), a = BigInt(23), f = BigInt(44), i = BigInt(88), l = e * e * e % n, m = l * l * e % n, E = V(m, t, n) * m % n, u = V(E, t, n) * m % n, q = V(u, It, n) * l % n, T = V(q, s, n) * q % n, p = V(T, o, n) * T % n, c = V(p, f, n) * p % n, h = V(c, i, n) * c % n, y = V(h, f, n) * p % n, B = V(y, t, n) * m % n, x = V(B, a, n) * T % n, O = V(x, r, n) * l % n, S = V(O, It, n); - if (!At.eql(At.sqr(S), e)) - throw new Error("Cannot find square root"); - return S; -} -const At = Xt(te, void 0, void 0, { sqrt: Ue }), Ce = ze({ - a: BigInt(0), - // equation params: a, b - b: BigInt(7), - // Seem to be rigid: bitcointalk.org/index.php?topic=289795.msg3183975#msg3183975 - Fp: At, - // Field's prime: 2n**256n - 2n**32n - 2n**9n - 2n**8n - 2n**7n - 2n**6n - 2n**4n - 1n - n: Mt, - // Curve order, total count of valid points in the field - // Base point (x, y) aka generator point - Gx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"), - Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"), - h: BigInt(1), - // Cofactor - lowS: !0, - // Allow only low-S signatures by default in sign() and verify() - /** - * secp256k1 belongs to Koblitz curves: it has efficiently computable endomorphism. - * Endomorphism uses 2x less RAM, speeds up precomputation by 2x and ECDH / key recovery by 20%. - * For precomputed wNAF it trades off 1/2 init time & 1/3 ram for 20% perf hit. - * Explanation: https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066 - */ - endo: { - beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"), - splitScalar: (e) => { - const n = Mt, t = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), r = -ke * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), s = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), o = t, a = BigInt("0x100000000000000000000000000000000"), f = Yt(o * e, n), i = Yt(-r * e, n); - let l = U(e - f * t - i * s, n), m = U(-f * r - i * o, n); - const E = l > a, u = m > a; - if (E && (l = n - l), u && (m = n - m), l > a || m > a) - throw new Error("splitScalar: Endomorphism failed, k=" + e); - return { k1neg: E, k1: l, k2neg: u, k2: m }; - } - } -}, ce); -BigInt(0); -Ce.ProjectivePoint; -export { - Ce as secp256k1 -}; diff --git a/dist/secp256k1-D5_JzNmG.js b/dist/secp256k1-D5_JzNmG.js new file mode 100644 index 0000000..3a4292e --- /dev/null +++ b/dist/secp256k1-D5_JzNmG.js @@ -0,0 +1,1290 @@ +import { a as at, b as st, h as xt, i as Tt, c as F, H as Jt, d as te, t as ee, e as ne, f as qt, g as re, r as oe, s as ie } from "./main-D7TyRk7o.js"; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +const St = /* @__PURE__ */ BigInt(0), Et = /* @__PURE__ */ BigInt(1); +function lt(e, n) { + if (typeof n != "boolean") + throw new Error(e + " boolean expected, got " + n); +} +function ct(e) { + const n = e.toString(16); + return n.length & 1 ? "0" + n : n; +} +function kt(e) { + if (typeof e != "string") + throw new Error("hex string expected, got " + typeof e); + return e === "" ? St : BigInt("0x" + e); +} +function dt(e) { + return kt(st(e)); +} +function jt(e) { + return at(e), kt(st(Uint8Array.from(e).reverse())); +} +function It(e, n) { + return xt(e.toString(16).padStart(n * 2, "0")); +} +function Ut(e, n) { + return It(e, n).reverse(); +} +function $(e, n, t) { + let r; + if (typeof n == "string") + try { + r = xt(n); + } catch (i) { + throw new Error(e + " must be hex string or Uint8Array, cause: " + i); + } + else if (Tt(n)) + r = Uint8Array.from(n); + else + throw new Error(e + " must be hex string or Uint8Array"); + const s = r.length; + if (typeof t == "number" && s !== t) + throw new Error(e + " of length " + t + " expected, got " + s); + return r; +} +const mt = (e) => typeof e == "bigint" && St <= e; +function se(e, n, t) { + return mt(e) && mt(n) && mt(t) && n <= e && e < t; +} +function ce(e, n, t, r) { + if (!se(n, t, r)) + throw new Error("expected valid " + e + ": " + t + " <= n < " + r + ", got " + n); +} +function fe(e) { + let n; + for (n = 0; e > St; e >>= Et, n += 1) + ; + return n; +} +const ht = (e) => (Et << BigInt(e)) - Et; +function ae(e, n, t) { + if (typeof e != "number" || e < 2) + throw new Error("hashLen must be a number"); + if (typeof n != "number" || n < 2) + throw new Error("qByteLen must be a number"); + if (typeof t != "function") + throw new Error("hmacFn must be a function"); + const r = (S) => new Uint8Array(S), s = (S) => Uint8Array.of(S); + let i = r(e), o = r(e), a = 0; + const l = () => { + i.fill(1), o.fill(0), a = 0; + }, g = (...S) => t(o, i, ...S), c = (S = r(0)) => { + o = g(s(0), S), i = g(), S.length !== 0 && (o = g(s(1), S), i = g()); + }, E = () => { + if (a++ >= 1e3) + throw new Error("drbg: tried 1000 values"); + let S = 0; + const _ = []; + for (; S < n; ) { + i = g(); + const N = i.slice(); + _.push(N), S += i.length; + } + return F(..._); + }; + return (S, _) => { + l(), c(S); + let N; + for (; !(N = _(E())); ) + c(); + return l(), N; + }; +} +function Nt(e, n, t = {}) { + if (!e || typeof e != "object") + throw new Error("expected valid options object"); + function r(s, i, o) { + const a = e[s]; + if (o && a === void 0) + return; + const l = typeof a; + if (l !== i || a === null) + throw new Error(`param "${s}" is invalid: expected ${i}, got ${l}`); + } + Object.entries(n).forEach(([s, i]) => r(s, i, !1)), Object.entries(t).forEach(([s, i]) => r(s, i, !0)); +} +function At(e) { + const n = /* @__PURE__ */ new WeakMap(); + return (t, ...r) => { + const s = n.get(t); + if (s !== void 0) + return s; + const i = e(t, ...r); + return n.set(t, i), i; + }; +} +class Mt extends Jt { + constructor(n, t) { + super(), this.finished = !1, this.destroyed = !1, te(n); + const r = ee(t); + if (this.iHash = n.create(), typeof this.iHash.update != "function") + throw new Error("Expected instance of class which extends utils.Hash"); + this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen; + const s = this.blockLen, i = new Uint8Array(s); + i.set(r.length > s ? n.create().update(r).digest() : r); + for (let o = 0; o < i.length; o++) + i[o] ^= 54; + this.iHash.update(i), this.oHash = n.create(); + for (let o = 0; o < i.length; o++) + i[o] ^= 106; + this.oHash.update(i), ne(i); + } + update(n) { + return qt(this), this.iHash.update(n), this; + } + digestInto(n) { + qt(this), at(n, this.outputLen), this.finished = !0, this.iHash.digestInto(n), this.oHash.update(n), this.oHash.digestInto(n), this.destroy(); + } + digest() { + const n = new Uint8Array(this.oHash.outputLen); + return this.digestInto(n), n; + } + _cloneInto(n) { + n || (n = Object.create(Object.getPrototypeOf(this), {})); + const { oHash: t, iHash: r, finished: s, destroyed: i, blockLen: o, outputLen: a } = this; + return n = n, n.finished = s, n.destroyed = i, n.blockLen = o, n.outputLen = a, n.oHash = t._cloneInto(n.oHash), n.iHash = r._cloneInto(n.iHash), n; + } + clone() { + return this._cloneInto(); + } + destroy() { + this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy(); + } +} +const $t = (e, n, t) => new Mt(e, n).update(t).digest(); +$t.create = (e, n) => new Mt(e, n); +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +const j = BigInt(0), k = BigInt(1), P = /* @__PURE__ */ BigInt(2), le = /* @__PURE__ */ BigInt(3), Ct = /* @__PURE__ */ BigInt(4), Vt = /* @__PURE__ */ BigInt(5), Kt = /* @__PURE__ */ BigInt(8); +function C(e, n) { + const t = e % n; + return t >= j ? t : n + t; +} +function M(e, n, t) { + let r = e; + for (; n-- > j; ) + r *= r, r %= t; + return r; +} +function _t(e, n) { + if (e === j) + throw new Error("invert: expected non-zero number"); + if (n <= j) + throw new Error("invert: expected positive modulus, got " + n); + let t = C(e, n), r = n, s = j, i = k; + for (; t !== j; ) { + const a = r / t, l = r % t, g = s - i * a; + r = t, t = l, s = i, i = g; + } + if (r !== k) + throw new Error("invert: does not exist"); + return C(s, n); +} +function Yt(e, n) { + const t = (e.ORDER + k) / Ct, r = e.pow(n, t); + if (!e.eql(e.sqr(r), n)) + throw new Error("Cannot find square root"); + return r; +} +function ue(e, n) { + const t = (e.ORDER - Vt) / Kt, r = e.mul(n, P), s = e.pow(r, t), i = e.mul(n, s), o = e.mul(e.mul(i, P), s), a = e.mul(i, e.sub(o, e.ONE)); + if (!e.eql(e.sqr(a), n)) + throw new Error("Cannot find square root"); + return a; +} +function de(e) { + if (e < BigInt(3)) + throw new Error("sqrt is not defined for small field"); + let n = e - k, t = 0; + for (; n % P === j; ) + n /= P, t++; + let r = P; + const s = wt(e); + for (; Ht(s, r) === 1; ) + if (r++ > 1e3) + throw new Error("Cannot find square root: probably non-prime P"); + if (t === 1) + return Yt; + let i = s.pow(r, n); + const o = (n + k) / P; + return function(l, g) { + if (l.is0(g)) + return g; + if (Ht(l, g) !== 1) + throw new Error("Cannot find square root"); + let c = t, E = l.mul(l.ONE, i), x = l.pow(g, n), S = l.pow(g, o); + for (; !l.eql(x, l.ONE); ) { + if (l.is0(x)) + return l.ZERO; + let _ = 1, N = l.sqr(x); + for (; !l.eql(N, l.ONE); ) + if (_++, N = l.sqr(N), _ === c) + throw new Error("Cannot find square root"); + const L = k << BigInt(c - _ - 1), U = l.pow(E, L); + c = _, E = l.sqr(U), x = l.mul(x, E), S = l.mul(S, U); + } + return S; + }; +} +function he(e) { + return e % Ct === le ? Yt : e % Kt === Vt ? ue : de(e); +} +const we = [ + "create", + "isValid", + "is0", + "neg", + "inv", + "sqrt", + "sqr", + "eql", + "add", + "sub", + "mul", + "pow", + "div", + "addN", + "subN", + "mulN", + "sqrN" +]; +function ge(e) { + const n = { + ORDER: "bigint", + MASK: "bigint", + BYTES: "number", + BITS: "number" + }, t = we.reduce((r, s) => (r[s] = "function", r), n); + return Nt(e, t), e; +} +function me(e, n, t) { + if (t < j) + throw new Error("invalid exponent, negatives unsupported"); + if (t === j) + return e.ONE; + if (t === k) + return n; + let r = e.ONE, s = n; + for (; t > j; ) + t & k && (r = e.mul(r, s)), s = e.sqr(s), t >>= k; + return r; +} +function Dt(e, n, t = !1) { + const r = new Array(n.length).fill(t ? e.ZERO : void 0), s = n.reduce((o, a, l) => e.is0(a) ? o : (r[l] = o, e.mul(o, a)), e.ONE), i = e.inv(s); + return n.reduceRight((o, a, l) => e.is0(a) ? o : (r[l] = e.mul(o, r[l]), e.mul(o, a)), i), r; +} +function Ht(e, n) { + const t = (e.ORDER - k) / P, r = e.pow(n, t), s = e.eql(r, e.ONE), i = e.eql(r, e.ZERO), o = e.eql(r, e.neg(e.ONE)); + if (!s && !i && !o) + throw new Error("invalid Legendre symbol result"); + return s ? 1 : i ? 0 : -1; +} +function ye(e, n) { + n !== void 0 && re(n); + const t = n !== void 0 ? n : e.toString(2).length, r = Math.ceil(t / 8); + return { nBitLength: t, nByteLength: r }; +} +function wt(e, n, t = !1, r = {}) { + if (e <= j) + throw new Error("invalid field: expected ORDER > 0, got " + e); + let s, i; + if (typeof n == "object" && n != null) { + if (r.sqrt || t) + throw new Error("cannot specify opts in two arguments"); + const c = n; + c.BITS && (s = c.BITS), c.sqrt && (i = c.sqrt), typeof c.isLE == "boolean" && (t = c.isLE); + } else + typeof n == "number" && (s = n), r.sqrt && (i = r.sqrt); + const { nBitLength: o, nByteLength: a } = ye(e, s); + if (a > 2048) + throw new Error("invalid field: expected ORDER of <= 2048 bytes"); + let l; + const g = Object.freeze({ + ORDER: e, + isLE: t, + BITS: o, + BYTES: a, + MASK: ht(o), + ZERO: j, + ONE: k, + create: (c) => C(c, e), + isValid: (c) => { + if (typeof c != "bigint") + throw new Error("invalid field element: expected bigint, got " + typeof c); + return j <= c && c < e; + }, + is0: (c) => c === j, + // is valid and invertible + isValidNot0: (c) => !g.is0(c) && g.isValid(c), + isOdd: (c) => (c & k) === k, + neg: (c) => C(-c, e), + eql: (c, E) => c === E, + sqr: (c) => C(c * c, e), + add: (c, E) => C(c + E, e), + sub: (c, E) => C(c - E, e), + mul: (c, E) => C(c * E, e), + pow: (c, E) => me(g, c, E), + div: (c, E) => C(c * _t(E, e), e), + // Same as above, but doesn't normalize + sqrN: (c) => c * c, + addN: (c, E) => c + E, + subN: (c, E) => c - E, + mulN: (c, E) => c * E, + inv: (c) => _t(c, e), + sqrt: i || ((c) => (l || (l = he(e)), l(g, c))), + toBytes: (c) => t ? Ut(c, a) : It(c, a), + fromBytes: (c) => { + if (c.length !== a) + throw new Error("Field.fromBytes: expected " + a + " bytes, got " + c.length); + return t ? jt(c) : dt(c); + }, + // TODO: we don't need it here, move out to separate fn + invertBatch: (c) => Dt(g, c), + // We can't move this out because Fp6, Fp12 implement it + // and it's unclear what to return in there. + cmov: (c, E, x) => x ? E : c + }); + return Object.freeze(g); +} +function Gt(e) { + if (typeof e != "bigint") + throw new Error("field order must be bigint"); + const n = e.toString(2).length; + return Math.ceil(n / 8); +} +function Ft(e) { + const n = Gt(e); + return n + Math.ceil(n / 2); +} +function pe(e, n, t = !1) { + const r = e.length, s = Gt(n), i = Ft(n); + if (r < 16 || r < i || r > 1024) + throw new Error("expected " + i + "-1024 bytes of input, got " + r); + const o = t ? jt(e) : dt(e), a = C(o, n - k) + k; + return t ? Ut(a, s) : It(a, s); +} +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +const et = BigInt(0), X = BigInt(1); +function rt(e, n) { + const t = n.negate(); + return e ? t : n; +} +function be(e, n, t) { + const r = (o) => o.pz, s = Dt(e.Fp, t.map(r)); + return t.map((o, a) => o.toAffine(s[a])).map(e.fromAffine); +} +function Pt(e, n) { + if (!Number.isSafeInteger(e) || e <= 0 || e > n) + throw new Error("invalid window size, expected [1.." + n + "], got W=" + e); +} +function yt(e, n) { + Pt(e, n); + const t = Math.ceil(n / e) + 1, r = 2 ** (e - 1), s = 2 ** e, i = ht(e), o = BigInt(e); + return { windows: t, windowSize: r, mask: i, maxNumber: s, shiftBy: o }; +} +function Ot(e, n, t) { + const { windowSize: r, mask: s, maxNumber: i, shiftBy: o } = t; + let a = Number(e & s), l = e >> o; + a > r && (a -= i, l += X); + const g = n * r, c = g + Math.abs(a) - 1, E = a === 0, x = a < 0, S = n % 2 !== 0; + return { nextN: l, offset: c, isZero: E, isNeg: x, isNegF: S, offsetF: g }; +} +function Ee(e, n) { + if (!Array.isArray(e)) + throw new Error("array expected"); + e.forEach((t, r) => { + if (!(t instanceof n)) + throw new Error("invalid point at index " + r); + }); +} +function Be(e, n) { + if (!Array.isArray(e)) + throw new Error("array of scalars expected"); + e.forEach((t, r) => { + if (!n.isValid(t)) + throw new Error("invalid scalar at index " + r); + }); +} +const pt = /* @__PURE__ */ new WeakMap(), Xt = /* @__PURE__ */ new WeakMap(); +function bt(e) { + return Xt.get(e) || 1; +} +function Zt(e) { + if (e !== et) + throw new Error("invalid wNAF"); +} +function ve(e, n) { + return { + constTimeNegate: rt, + hasPrecomputes(t) { + return bt(t) !== 1; + }, + // non-const time multiplication ladder + unsafeLadder(t, r, s = e.ZERO) { + let i = t; + for (; r > et; ) + r & X && (s = s.add(i)), i = i.double(), r >>= X; + return s; + }, + /** + * Creates a wNAF precomputation window. Used for caching. + * Default window size is set by `utils.precompute()` and is equal to 8. + * Number of precomputed points depends on the curve size: + * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: + * - 𝑊 is the window size + * - 𝑛 is the bitlength of the curve order. + * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. + * @param elm Point instance + * @param W window size + * @returns precomputed point tables flattened to a single array + */ + precomputeWindow(t, r) { + const { windows: s, windowSize: i } = yt(r, n), o = []; + let a = t, l = a; + for (let g = 0; g < s; g++) { + l = a, o.push(l); + for (let c = 1; c < i; c++) + l = l.add(a), o.push(l); + a = l.double(); + } + return o; + }, + /** + * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. + * @param W window size + * @param precomputes precomputed tables + * @param n scalar (we don't check here, but should be less than curve order) + * @returns real and fake (for const-time) points + */ + wNAF(t, r, s) { + let i = e.ZERO, o = e.BASE; + const a = yt(t, n); + for (let l = 0; l < a.windows; l++) { + const { nextN: g, offset: c, isZero: E, isNeg: x, isNegF: S, offsetF: _ } = Ot(s, l, a); + s = g, E ? o = o.add(rt(S, r[_])) : i = i.add(rt(x, r[c])); + } + return Zt(s), { p: i, f: o }; + }, + /** + * Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form. + * @param W window size + * @param precomputes precomputed tables + * @param n scalar (we don't check here, but should be less than curve order) + * @param acc accumulator point to add result of multiplication + * @returns point + */ + wNAFUnsafe(t, r, s, i = e.ZERO) { + const o = yt(t, n); + for (let a = 0; a < o.windows && s !== et; a++) { + const { nextN: l, offset: g, isZero: c, isNeg: E } = Ot(s, a, o); + if (s = l, !c) { + const x = r[g]; + i = i.add(E ? x.negate() : x); + } + } + return Zt(s), i; + }, + getPrecomputes(t, r, s) { + let i = pt.get(r); + return i || (i = this.precomputeWindow(r, t), t !== 1 && (typeof s == "function" && (i = s(i)), pt.set(r, i))), i; + }, + wNAFCached(t, r, s) { + const i = bt(t); + return this.wNAF(i, this.getPrecomputes(i, t, s), r); + }, + wNAFCachedUnsafe(t, r, s, i) { + const o = bt(t); + return o === 1 ? this.unsafeLadder(t, r, i) : this.wNAFUnsafe(o, this.getPrecomputes(o, t, s), r, i); + }, + // We calculate precomputes for elliptic curve point multiplication + // using windowed method. This specifies window size and + // stores precomputed values. Usually only base point would be precomputed. + setWindowSize(t, r) { + Pt(r, n), Xt.set(t, r), pt.delete(t); + } + }; +} +function xe(e, n, t, r) { + let s = n, i = e.ZERO, o = e.ZERO; + for (; t > et || r > et; ) + t & X && (i = i.add(s)), r & X && (o = o.add(s)), s = s.double(), t >>= X, r >>= X; + return { p1: i, p2: o }; +} +function Se(e, n, t, r) { + Ee(t, e), Be(r, n); + const s = t.length, i = r.length; + if (s !== i) + throw new Error("arrays of points and scalars must have equal length"); + const o = e.ZERO, a = fe(BigInt(s)); + let l = 1; + a > 12 ? l = a - 3 : a > 4 ? l = a - 2 : a > 0 && (l = 2); + const g = ht(l), c = new Array(Number(g) + 1).fill(o), E = Math.floor((n.BITS - 1) / l) * l; + let x = o; + for (let S = E; S >= 0; S -= l) { + c.fill(o); + for (let N = 0; N < i; N++) { + const L = r[N], U = Number(L >> BigInt(S) & g); + c[U] = c[U].add(t[N]); + } + let _ = o; + for (let N = c.length - 1, L = o; N > 0; N--) + L = L.add(c[N]), _ = _.add(L); + if (x = x.add(_), S !== 0) + for (let N = 0; N < l; N++) + x = x.double(); + } + return x; +} +function Rt(e, n) { + if (n) { + if (n.ORDER !== e) + throw new Error("Field.ORDER must match order: Fp == p, Fn == n"); + return ge(n), n; + } else + return wt(e); +} +function Ie(e, n, t = {}) { + if (!n || typeof n != "object") + throw new Error(`expected valid ${e} CURVE object`); + for (const a of ["p", "n", "h"]) { + const l = n[a]; + if (!(typeof l == "bigint" && l > et)) + throw new Error(`CURVE.${a} must be positive bigint`); + } + const r = Rt(n.p, t.Fp), s = Rt(n.n, t.Fn), o = ["Gx", "Gy", "a", "b"]; + for (const a of o) + if (!r.isValid(n[a])) + throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`); + return { Fp: r, Fn: s }; +} +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +function Lt(e) { + e.lowS !== void 0 && lt("lowS", e.lowS), e.prehash !== void 0 && lt("prehash", e.prehash); +} +class Ne extends Error { + constructor(n = "") { + super(n); + } +} +const V = { + // asn.1 DER encoding utils + Err: Ne, + // Basic building block is TLV (Tag-Length-Value) + _tlv: { + encode: (e, n) => { + const { Err: t } = V; + if (e < 0 || e > 256) + throw new t("tlv.encode: wrong tag"); + if (n.length & 1) + throw new t("tlv.encode: unpadded data"); + const r = n.length / 2, s = ct(r); + if (s.length / 2 & 128) + throw new t("tlv.encode: long form length too big"); + const i = r > 127 ? ct(s.length / 2 | 128) : ""; + return ct(e) + i + s + n; + }, + // v - value, l - left bytes (unparsed) + decode(e, n) { + const { Err: t } = V; + let r = 0; + if (e < 0 || e > 256) + throw new t("tlv.encode: wrong tag"); + if (n.length < 2 || n[r++] !== e) + throw new t("tlv.decode: wrong tlv"); + const s = n[r++], i = !!(s & 128); + let o = 0; + if (!i) + o = s; + else { + const l = s & 127; + if (!l) + throw new t("tlv.decode(long): indefinite length not supported"); + if (l > 4) + throw new t("tlv.decode(long): byte length is too big"); + const g = n.subarray(r, r + l); + if (g.length !== l) + throw new t("tlv.decode: length bytes not complete"); + if (g[0] === 0) + throw new t("tlv.decode(long): zero leftmost byte"); + for (const c of g) + o = o << 8 | c; + if (r += l, o < 128) + throw new t("tlv.decode(long): not minimal encoding"); + } + const a = n.subarray(r, r + o); + if (a.length !== o) + throw new t("tlv.decode: wrong value length"); + return { v: a, l: n.subarray(r + o) }; + } + }, + // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag, + // since we always use positive integers here. It must always be empty: + // - add zero byte if exists + // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding) + _int: { + encode(e) { + const { Err: n } = V; + if (e < ot) + throw new n("integer: negative integers are not allowed"); + let t = ct(e); + if (Number.parseInt(t[0], 16) & 8 && (t = "00" + t), t.length & 1) + throw new n("unexpected DER parsing assertion: unpadded hex"); + return t; + }, + decode(e) { + const { Err: n } = V; + if (e[0] & 128) + throw new n("invalid signature integer: negative"); + if (e[0] === 0 && !(e[1] & 128)) + throw new n("invalid signature integer: unnecessary leading zero"); + return dt(e); + } + }, + toSig(e) { + const { Err: n, _int: t, _tlv: r } = V, s = $("signature", e), { v: i, l: o } = r.decode(48, s); + if (o.length) + throw new n("invalid signature: left bytes after parsing"); + const { v: a, l } = r.decode(2, i), { v: g, l: c } = r.decode(2, l); + if (c.length) + throw new n("invalid signature: left bytes after parsing"); + return { r: t.decode(a), s: t.decode(g) }; + }, + hexFromSig(e) { + const { _tlv: n, _int: t } = V, r = n.encode(2, t.encode(e.r)), s = n.encode(2, t.encode(e.s)), i = r + s; + return n.encode(48, i); + } +}, ot = BigInt(0), it = BigInt(1), qe = BigInt(2), ft = BigInt(3), Ae = BigInt(4); +function _e(e, n, t) { + function r(s) { + const i = e.sqr(s), o = e.mul(i, s); + return e.add(e.add(o, e.mul(s, n)), t); + } + return r; +} +function Wt(e, n, t) { + const { BYTES: r } = e; + function s(i) { + let o; + if (typeof i == "bigint") + o = i; + else { + let a = $("private key", i); + if (n) { + if (!n.includes(a.length * 2)) + throw new Error("invalid private key"); + const l = new Uint8Array(r); + l.set(a, l.length - a.length), a = l; + } + try { + o = e.fromBytes(a); + } catch { + throw new Error(`invalid private key: expected ui8a of size ${r}, got ${typeof i}`); + } + } + if (t && (o = e.create(o)), !e.isValidNot0(o)) + throw new Error("invalid private key: out of range [1..N-1]"); + return o; + } + return s; +} +function He(e, n = {}) { + const { Fp: t, Fn: r } = Ie("weierstrass", e, n), { h: s, n: i } = e; + Nt(n, {}, { + allowInfinityPoint: "boolean", + clearCofactor: "function", + isTorsionFree: "function", + fromBytes: "function", + toBytes: "function", + endo: "object", + wrapPrivateKey: "boolean" + }); + const { endo: o } = n; + if (o && (!t.is0(e.a) || typeof o.beta != "bigint" || typeof o.splitScalar != "function")) + throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function'); + function a() { + if (!t.isOdd) + throw new Error("compression is not supported: Field does not have .isOdd()"); + } + function l(H, f, h) { + const { x: u, y: d } = f.toAffine(), w = t.toBytes(u); + if (lt("isCompressed", h), h) { + a(); + const p = !t.isOdd(d); + return F(Qt(p), w); + } else + return F(Uint8Array.of(4), w, t.toBytes(d)); + } + function g(H) { + at(H); + const f = t.BYTES, h = f + 1, u = 2 * f + 1, d = H.length, w = H[0], p = H.subarray(1); + if (d === h && (w === 2 || w === 3)) { + const m = t.fromBytes(p); + if (!t.isValid(m)) + throw new Error("bad point: is not on curve, wrong x"); + const y = x(m); + let B; + try { + B = t.sqrt(y); + } catch (q) { + const v = q instanceof Error ? ": " + q.message : ""; + throw new Error("bad point: is not on curve, sqrt error" + v); + } + a(); + const b = t.isOdd(B); + return (w & 1) === 1 !== b && (B = t.neg(B)), { x: m, y: B }; + } else if (d === u && w === 4) { + const m = t.fromBytes(p.subarray(f * 0, f * 1)), y = t.fromBytes(p.subarray(f * 1, f * 2)); + if (!S(m, y)) + throw new Error("bad point: is not on curve"); + return { x: m, y }; + } else + throw new Error(`bad point: got length ${d}, expected compressed=${h} or uncompressed=${u}`); + } + const c = n.toBytes || l, E = n.fromBytes || g, x = _e(t, e.a, e.b); + function S(H, f) { + const h = t.sqr(f), u = x(H); + return t.eql(h, u); + } + if (!S(e.Gx, e.Gy)) + throw new Error("bad curve params: generator point"); + const _ = t.mul(t.pow(e.a, ft), Ae), N = t.mul(t.sqr(e.b), BigInt(27)); + if (t.is0(t.add(_, N))) + throw new Error("bad curve params: a or b"); + function L(H, f, h = !1) { + if (!t.isValid(f) || h && t.is0(f)) + throw new Error(`bad point coordinate ${H}`); + return f; + } + function U(H) { + if (!(H instanceof I)) + throw new Error("ProjectivePoint expected"); + } + const W = At((H, f) => { + const { px: h, py: u, pz: d } = H; + if (t.eql(d, t.ONE)) + return { x: h, y: u }; + const w = H.is0(); + f == null && (f = w ? t.ONE : t.inv(d)); + const p = t.mul(h, f), m = t.mul(u, f), y = t.mul(d, f); + if (w) + return { x: t.ZERO, y: t.ZERO }; + if (!t.eql(y, t.ONE)) + throw new Error("invZ was invalid"); + return { x: p, y: m }; + }), Y = At((H) => { + if (H.is0()) { + if (n.allowInfinityPoint && !t.is0(H.py)) + return; + throw new Error("bad point: ZERO"); + } + const { x: f, y: h } = H.toAffine(); + if (!t.isValid(f) || !t.isValid(h)) + throw new Error("bad point: x or y not field elements"); + if (!S(f, h)) + throw new Error("bad point: equation left != right"); + if (!H.isTorsionFree()) + throw new Error("bad point: not in prime-order subgroup"); + return !0; + }); + function Q(H, f, h, u, d) { + return h = new I(t.mul(h.px, H), h.py, h.pz), f = rt(u, f), h = rt(d, h), f.add(h); + } + class I { + /** Does NOT validate if the point is valid. Use `.assertValidity()`. */ + constructor(f, h, u) { + this.px = L("x", f), this.py = L("y", h, !0), this.pz = L("z", u), Object.freeze(this); + } + /** Does NOT validate if the point is valid. Use `.assertValidity()`. */ + static fromAffine(f) { + const { x: h, y: u } = f || {}; + if (!f || !t.isValid(h) || !t.isValid(u)) + throw new Error("invalid affine point"); + if (f instanceof I) + throw new Error("projective point not allowed"); + return t.is0(h) && t.is0(u) ? I.ZERO : new I(h, u, t.ONE); + } + get x() { + return this.toAffine().x; + } + get y() { + return this.toAffine().y; + } + static normalizeZ(f) { + return be(I, "pz", f); + } + static fromBytes(f) { + return at(f), I.fromHex(f); + } + /** Converts hash string or Uint8Array to Point. */ + static fromHex(f) { + const h = I.fromAffine(E($("pointHex", f))); + return h.assertValidity(), h; + } + /** Multiplies generator point by privateKey. */ + static fromPrivateKey(f) { + const h = Wt(r, n.allowedPrivateKeyLengths, n.wrapPrivateKey); + return I.BASE.multiply(h(f)); + } + /** Multiscalar Multiplication */ + static msm(f, h) { + return Se(I, r, f, h); + } + /** + * + * @param windowSize + * @param isLazy true will defer table computation until the first multiplication + * @returns + */ + precompute(f = 8, h = !0) { + return K.setWindowSize(this, f), h || this.multiply(ft), this; + } + /** "Private method", don't use it directly */ + _setWindowSize(f) { + this.precompute(f); + } + // TODO: return `this` + /** A point on curve is valid if it conforms to equation. */ + assertValidity() { + Y(this); + } + hasEvenY() { + const { y: f } = this.toAffine(); + if (!t.isOdd) + throw new Error("Field doesn't support isOdd"); + return !t.isOdd(f); + } + /** Compare one point to another. */ + equals(f) { + U(f); + const { px: h, py: u, pz: d } = this, { px: w, py: p, pz: m } = f, y = t.eql(t.mul(h, m), t.mul(w, d)), B = t.eql(t.mul(u, m), t.mul(p, d)); + return y && B; + } + /** Flips point to one corresponding to (x, -y) in Affine coordinates. */ + negate() { + return new I(this.px, t.neg(this.py), this.pz); + } + // Renes-Costello-Batina exception-free doubling formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 3 + // Cost: 8M + 3S + 3*a + 2*b3 + 15add. + double() { + const { a: f, b: h } = e, u = t.mul(h, ft), { px: d, py: w, pz: p } = this; + let m = t.ZERO, y = t.ZERO, B = t.ZERO, b = t.mul(d, d), O = t.mul(w, w), q = t.mul(p, p), v = t.mul(d, w); + return v = t.add(v, v), B = t.mul(d, p), B = t.add(B, B), m = t.mul(f, B), y = t.mul(u, q), y = t.add(m, y), m = t.sub(O, y), y = t.add(O, y), y = t.mul(m, y), m = t.mul(v, m), B = t.mul(u, B), q = t.mul(f, q), v = t.sub(b, q), v = t.mul(f, v), v = t.add(v, B), B = t.add(b, b), b = t.add(B, b), b = t.add(b, q), b = t.mul(b, v), y = t.add(y, b), q = t.mul(w, p), q = t.add(q, q), b = t.mul(q, v), m = t.sub(m, b), B = t.mul(q, O), B = t.add(B, B), B = t.add(B, B), new I(m, y, B); + } + // Renes-Costello-Batina exception-free addition formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 1 + // Cost: 12M + 0S + 3*a + 3*b3 + 23add. + add(f) { + U(f); + const { px: h, py: u, pz: d } = this, { px: w, py: p, pz: m } = f; + let y = t.ZERO, B = t.ZERO, b = t.ZERO; + const O = e.a, q = t.mul(e.b, ft); + let v = t.mul(h, w), Z = t.mul(u, p), R = t.mul(d, m), z = t.add(h, u), A = t.add(w, p); + z = t.mul(z, A), A = t.add(v, Z), z = t.sub(z, A), A = t.add(h, d); + let T = t.add(w, m); + return A = t.mul(A, T), T = t.add(v, R), A = t.sub(A, T), T = t.add(u, d), y = t.add(p, m), T = t.mul(T, y), y = t.add(Z, R), T = t.sub(T, y), b = t.mul(O, A), y = t.mul(q, R), b = t.add(y, b), y = t.sub(Z, b), b = t.add(Z, b), B = t.mul(y, b), Z = t.add(v, v), Z = t.add(Z, v), R = t.mul(O, R), A = t.mul(q, A), Z = t.add(Z, R), R = t.sub(v, R), R = t.mul(O, R), A = t.add(A, R), v = t.mul(Z, A), B = t.add(B, v), v = t.mul(T, A), y = t.mul(z, y), y = t.sub(y, v), v = t.mul(z, Z), b = t.mul(T, b), b = t.add(b, v), new I(y, B, b); + } + subtract(f) { + return this.add(f.negate()); + } + is0() { + return this.equals(I.ZERO); + } + /** + * Constant time multiplication. + * Uses wNAF method. Windowed method may be 10% faster, + * but takes 2x longer to generate and consumes 2x memory. + * Uses precomputes when available. + * Uses endomorphism for Koblitz curves. + * @param scalar by which the point would be multiplied + * @returns New point + */ + multiply(f) { + const { endo: h } = n; + if (!r.isValidNot0(f)) + throw new Error("invalid scalar: out of range"); + let u, d; + const w = (p) => K.wNAFCached(this, p, I.normalizeZ); + if (h) { + const { k1neg: p, k1: m, k2neg: y, k2: B } = h.splitScalar(f), { p: b, f: O } = w(m), { p: q, f: v } = w(B); + d = O.add(v), u = Q(h.beta, b, q, p, y); + } else { + const { p, f: m } = w(f); + u = p, d = m; + } + return I.normalizeZ([u, d])[0]; + } + /** + * Non-constant-time multiplication. Uses double-and-add algorithm. + * It's faster, but should only be used when you don't care about + * an exposed private key e.g. sig verification, which works over *public* keys. + */ + multiplyUnsafe(f) { + const { endo: h } = n, u = this; + if (!r.isValid(f)) + throw new Error("invalid scalar: out of range"); + if (f === ot || u.is0()) + return I.ZERO; + if (f === it) + return u; + if (K.hasPrecomputes(this)) + return this.multiply(f); + if (h) { + const { k1neg: d, k1: w, k2neg: p, k2: m } = h.splitScalar(f), { p1: y, p2: B } = xe(I, u, w, m); + return Q(h.beta, y, B, d, p); + } else + return K.wNAFCachedUnsafe(u, f); + } + multiplyAndAddUnsafe(f, h, u) { + const d = this.multiplyUnsafe(h).add(f.multiplyUnsafe(u)); + return d.is0() ? void 0 : d; + } + /** + * Converts Projective point to affine (x, y) coordinates. + * @param invertedZ Z^-1 (inverted zero) - optional, precomputation is useful for invertBatch + */ + toAffine(f) { + return W(this, f); + } + /** + * Checks whether Point is free of torsion elements (is in prime subgroup). + * Always torsion-free for cofactor=1 curves. + */ + isTorsionFree() { + const { isTorsionFree: f } = n; + return s === it ? !0 : f ? f(I, this) : K.wNAFCachedUnsafe(this, i).is0(); + } + clearCofactor() { + const { clearCofactor: f } = n; + return s === it ? this : f ? f(I, this) : this.multiplyUnsafe(s); + } + toBytes(f = !0) { + return lt("isCompressed", f), this.assertValidity(), c(I, this, f); + } + /** @deprecated use `toBytes` */ + toRawBytes(f = !0) { + return this.toBytes(f); + } + toHex(f = !0) { + return st(this.toBytes(f)); + } + toString() { + return ``; + } + } + I.BASE = new I(e.Gx, e.Gy, t.ONE), I.ZERO = new I(t.ZERO, t.ONE, t.ZERO), I.Fp = t, I.Fn = r; + const D = r.BITS, K = ve(I, n.endo ? Math.ceil(D / 2) : D); + return I; +} +function Qt(e) { + return Uint8Array.of(e ? 2 : 3); +} +function Oe(e, n, t = {}) { + Nt(n, { hash: "function" }, { + hmac: "function", + lowS: "boolean", + randomBytes: "function", + bits2int: "function", + bits2int_modN: "function" + }); + const r = n.randomBytes || oe, s = n.hmac || ((u, ...d) => $t(n.hash, u, F(...d))), { Fp: i, Fn: o } = e, { ORDER: a, BITS: l } = o; + function g(u) { + const d = a >> it; + return u > d; + } + function c(u) { + return g(u) ? o.neg(u) : u; + } + function E(u, d) { + if (!o.isValidNot0(d)) + throw new Error(`invalid signature ${u}: out of range 1..CURVE.n`); + } + class x { + constructor(d, w, p) { + E("r", d), E("s", w), this.r = d, this.s = w, p != null && (this.recovery = p), Object.freeze(this); + } + // pair (bytes of r, bytes of s) + static fromCompact(d) { + const w = o.BYTES, p = $("compactSignature", d, w * 2); + return new x(o.fromBytes(p.subarray(0, w)), o.fromBytes(p.subarray(w, w * 2))); + } + // DER encoded ECDSA signature + // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script + static fromDER(d) { + const { r: w, s: p } = V.toSig($("DER", d)); + return new x(w, p); + } + /** + * @todo remove + * @deprecated + */ + assertValidity() { + } + addRecoveryBit(d) { + return new x(this.r, this.s, d); + } + // ProjPointType + recoverPublicKey(d) { + const w = i.ORDER, { r: p, s: m, recovery: y } = this; + if (y == null || ![0, 1, 2, 3].includes(y)) + throw new Error("recovery id invalid"); + if (a * qe < w && y > 1) + throw new Error("recovery id is ambiguous for h>1 curve"); + const b = y === 2 || y === 3 ? p + a : p; + if (!i.isValid(b)) + throw new Error("recovery id 2 or 3 invalid"); + const O = i.toBytes(b), q = e.fromHex(F(Qt((y & 1) === 0), O)), v = o.inv(b), Z = Y($("msgHash", d)), R = o.create(-Z * v), z = o.create(m * v), A = e.BASE.multiplyUnsafe(R).add(q.multiplyUnsafe(z)); + if (A.is0()) + throw new Error("point at infinify"); + return A.assertValidity(), A; + } + // Signatures should be low-s, to prevent malleability. + hasHighS() { + return g(this.s); + } + normalizeS() { + return this.hasHighS() ? new x(this.r, o.neg(this.s), this.recovery) : this; + } + toBytes(d) { + if (d === "compact") + return F(o.toBytes(this.r), o.toBytes(this.s)); + if (d === "der") + return xt(V.hexFromSig(this)); + throw new Error("invalid format"); + } + // DER-encoded + toDERRawBytes() { + return this.toBytes("der"); + } + toDERHex() { + return st(this.toBytes("der")); + } + // padded bytes of r, then padded bytes of s + toCompactRawBytes() { + return this.toBytes("compact"); + } + toCompactHex() { + return st(this.toBytes("compact")); + } + } + const S = Wt(o, t.allowedPrivateKeyLengths, t.wrapPrivateKey), _ = { + isValidPrivateKey(u) { + try { + return S(u), !0; + } catch { + return !1; + } + }, + normPrivateKeyToScalar: S, + /** + * Produces cryptographically secure private key from random of size + * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible. + */ + randomPrivateKey: () => { + const u = a; + return pe(r(Ft(u)), u); + }, + precompute(u = 8, d = e.BASE) { + return d.precompute(u, !1); + } + }; + function N(u, d = !0) { + return e.fromPrivateKey(u).toBytes(d); + } + function L(u) { + if (typeof u == "bigint") + return !1; + if (u instanceof e) + return !0; + const w = $("key", u).length, p = i.BYTES, m = p + 1, y = 2 * p + 1; + if (!(t.allowedPrivateKeyLengths || o.BYTES === m)) + return w === m || w === y; + } + function U(u, d, w = !0) { + if (L(u) === !0) + throw new Error("first arg must be private key"); + if (L(d) === !1) + throw new Error("second arg must be public key"); + return e.fromHex(d).multiply(S(u)).toBytes(w); + } + const W = n.bits2int || function(u) { + if (u.length > 8192) + throw new Error("input is too large"); + const d = dt(u), w = u.length * 8 - l; + return w > 0 ? d >> BigInt(w) : d; + }, Y = n.bits2int_modN || function(u) { + return o.create(W(u)); + }, Q = ht(l); + function I(u) { + return ce("num < 2^" + l, u, ot, Q), o.toBytes(u); + } + function D(u, d, w = K) { + if (["recovered", "canonical"].some((z) => z in w)) + throw new Error("sign() legacy options not supported"); + const { hash: p } = n; + let { lowS: m, prehash: y, extraEntropy: B } = w; + m == null && (m = !0), u = $("msgHash", u), Lt(w), y && (u = $("prehashed msgHash", p(u))); + const b = Y(u), O = S(d), q = [I(O), I(b)]; + if (B != null && B !== !1) { + const z = B === !0 ? r(i.BYTES) : B; + q.push($("extraEntropy", z)); + } + const v = F(...q), Z = b; + function R(z) { + const A = W(z); + if (!o.isValidNot0(A)) + return; + const T = o.inv(A), nt = e.BASE.multiply(A).toAffine(), J = o.create(nt.x); + if (J === ot) + return; + const G = o.create(T * o.create(Z + J * O)); + if (G === ot) + return; + let gt = (nt.x === J ? 0 : 2) | Number(nt.y & it), tt = G; + return m && g(G) && (tt = c(G), gt ^= 1), new x(J, tt, gt); + } + return { seed: v, k2sig: R }; + } + const K = { lowS: n.lowS, prehash: !1 }, H = { lowS: n.lowS, prehash: !1 }; + function f(u, d, w = K) { + const { seed: p, k2sig: m } = D(u, d, w); + return ae(n.hash.outputLen, o.BYTES, s)(p, m); + } + e.BASE.precompute(8); + function h(u, d, w, p = H) { + const m = u; + d = $("msgHash", d), w = $("publicKey", w), Lt(p); + const { lowS: y, prehash: B, format: b } = p; + if ("strict" in p) + throw new Error("options.strict was renamed to lowS"); + if (b !== void 0 && !["compact", "der", "js"].includes(b)) + throw new Error('format must be "compact", "der" or "js"'); + const O = typeof m == "string" || Tt(m), q = !O && !b && typeof m == "object" && m !== null && typeof m.r == "bigint" && typeof m.s == "bigint"; + if (!O && !q) + throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance"); + let v, Z; + try { + if (q) + if (b === void 0 || b === "js") + v = new x(m.r, m.s); + else + throw new Error("invalid format"); + if (O) { + try { + b !== "compact" && (v = x.fromDER(m)); + } catch (tt) { + if (!(tt instanceof V.Err)) + throw tt; + } + !v && b !== "der" && (v = x.fromCompact(m)); + } + Z = e.fromHex(w); + } catch { + return !1; + } + if (!v || y && v.hasHighS()) + return !1; + B && (d = n.hash(d)); + const { r: R, s: z } = v, A = Y(d), T = o.inv(z), nt = o.create(A * T), J = o.create(R * T), G = e.BASE.multiplyUnsafe(nt).add(Z.multiplyUnsafe(J)); + return G.is0() ? !1 : o.create(G.x) === R; + } + return Object.freeze({ + getPublicKey: N, + getSharedSecret: U, + sign: f, + verify: h, + utils: _, + Point: e, + Signature: x + }); +} +function Ze(e) { + const n = { + a: e.a, + b: e.b, + p: e.Fp.ORDER, + n: e.n, + h: e.h, + Gx: e.Gx, + Gy: e.Gy + }, t = e.Fp, r = wt(n.n, e.nBitLength), s = { + Fp: t, + Fn: r, + allowedPrivateKeyLengths: e.allowedPrivateKeyLengths, + allowInfinityPoint: e.allowInfinityPoint, + endo: e.endo, + wrapPrivateKey: e.wrapPrivateKey, + isTorsionFree: e.isTorsionFree, + clearCofactor: e.clearCofactor, + fromBytes: e.fromBytes, + toBytes: e.toBytes + }; + return { CURVE: n, curveOpts: s }; +} +function Re(e) { + const { CURVE: n, curveOpts: t } = Ze(e), r = { + hash: e.hash, + hmac: e.hmac, + randomBytes: e.randomBytes, + lowS: e.lowS, + bits2int: e.bits2int, + bits2int_modN: e.bits2int_modN + }; + return { CURVE: n, curveOpts: t, ecdsaOpts: r }; +} +function Le(e, n) { + return Object.assign({}, n, { + ProjectivePoint: n.Point, + CURVE: e + }); +} +function ze(e) { + const { CURVE: n, curveOpts: t, ecdsaOpts: r } = Re(e), s = He(n, t), i = Oe(s, r, t); + return Le(e, i); +} +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +function Te(e, n) { + const t = (r) => ze({ ...e, hash: r }); + return { ...t(n), create: t }; +} +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +const ut = { + p: BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), + n: BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), + h: BigInt(1), + a: BigInt(0), + b: BigInt(7), + Gx: BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"), + Gy: BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8") +}; +BigInt(0); +const ke = BigInt(1), Bt = BigInt(2), zt = (e, n) => (e + n / Bt) / n; +function je(e) { + const n = ut.p, t = BigInt(3), r = BigInt(6), s = BigInt(11), i = BigInt(22), o = BigInt(23), a = BigInt(44), l = BigInt(88), g = e * e * e % n, c = g * g * e % n, E = M(c, t, n) * c % n, x = M(E, t, n) * c % n, S = M(x, Bt, n) * g % n, _ = M(S, s, n) * S % n, N = M(_, i, n) * _ % n, L = M(N, a, n) * N % n, U = M(L, l, n) * L % n, W = M(U, a, n) * N % n, Y = M(W, t, n) * c % n, Q = M(Y, o, n) * _ % n, I = M(Q, r, n) * g % n, D = M(I, Bt, n); + if (!vt.eql(vt.sqr(D), e)) + throw new Error("Cannot find square root"); + return D; +} +const vt = wt(ut.p, void 0, void 0, { sqrt: je }), Me = Te({ + ...ut, + Fp: vt, + lowS: !0, + // Allow only low-S signatures by default in sign() and verify() + endo: { + // Endomorphism, see above + beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"), + splitScalar: (e) => { + const n = ut.n, t = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), r = -ke * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), s = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), i = t, o = BigInt("0x100000000000000000000000000000000"), a = zt(i * e, n), l = zt(-r * e, n); + let g = C(e - a * t - l * s, n), c = C(-a * r - l * i, n); + const E = g > o, x = c > o; + if (E && (g = n - g), x && (c = n - c), g > o || c > o) + throw new Error("splitScalar: Endomorphism failed, k=" + e); + return { k1neg: E, k1: g, k2neg: x, k2: c }; + } + } +}, ie); +export { + Me as secp256k1 +}; diff --git a/dist/types/wallet-item.class.d.ts b/dist/types/wallet-item.class.d.ts index afac606..01728c8 100644 --- a/dist/types/wallet-item.class.d.ts +++ b/dist/types/wallet-item.class.d.ts @@ -1,4 +1,4 @@ -import { WalletClient } from 'viem'; +import { Chain, WalletClient } from 'viem'; import { WalletConfig } from '../constant/wallet-book'; import { default as UniversalProvider } from '@walletconnect/universal-provider'; import { EIP6963ProviderDetail } from '../utils/eip6963-detect'; @@ -11,6 +11,7 @@ export declare class WalletItem { private _fatured; private _installed; lastUsed: boolean; + private _client; get address(): `0x${string}` | null; get connected(): boolean; get featured(): boolean; @@ -29,8 +30,9 @@ export declare class WalletItem { constructor(params: UniversalProvider); EIP6963Detected(detail: EIP6963ProviderDetail): void; setUniversalProvider(provider: UniversalProvider): void; + switchChain(chain: Chain): Promise; private testConnect; - connect(): Promise<`0x${string}`[]>; + connect(): Promise; getAddress(): Promise<`0x${string}`>; getChain(): Promise; signMessage(message: string, address: `0x${string}`): Promise<`0x${string}` | undefined>; diff --git a/lib/codatta-connect-context-provider.tsx b/lib/codatta-connect-context-provider.tsx index af06bd0..c6e4316 100644 --- a/lib/codatta-connect-context-provider.tsx +++ b/lib/codatta-connect-context-provider.tsx @@ -5,6 +5,7 @@ import UniversalProvider, { UniversalProviderOpts } from '@walletconnect/univers import { EIP6963Detect } from './utils/eip6963-detect' import { createCoinbaseWalletSDK } from '@coinbase/wallet-sdk' import accountApi from './api/account.api' +import { Chain } from 'viem' const walletConnectConfig: UniversalProviderOpts = { projectId: '7a4434fefbcc9af474fb5c995e47d286', @@ -36,6 +37,7 @@ interface CodattaConnectContext { featuredWallets: WalletItem[] lastUsedWallet: WalletItem | null saveLastUsedWallet: (wallet: WalletItem) => void + chains: Chain[] } const CodattaSigninContext = createContext({ @@ -43,7 +45,8 @@ const CodattaSigninContext = createContext({ lastUsedWallet: null, wallets: [], initialized: false, - featuredWallets: [] + featuredWallets: [], + chains: [] }) export function useCodattaConnectContext() { @@ -54,6 +57,7 @@ interface CodattaConnectContextProviderProps { children: React.ReactNode apiBaseUrl?: string singleWalletName?: string + chains?: Chain[] } interface LastUsedWalletInfo { @@ -68,6 +72,7 @@ export function CodattaConnectContextProvider(props: CodattaConnectContextProvid const [featuredWallets, setFeaturedWallets] = useState([]) const [lastUsedWallet, setLastUsedWallet] = useState(null) const [initialized, setInitialized] = useState(false) + const [chains, setChains] = useState([]) const saveLastUsedWallet = (wallet: WalletItem) => { setLastUsedWallet(wallet) @@ -95,7 +100,7 @@ export function CodattaConnectContextProvider(props: CodattaConnectContextProvid } } - async function init() { + async function init() { const wallets: WalletItem[] = [] const walletMap = new Map() @@ -150,6 +155,9 @@ export function CodattaConnectContextProvider(props: CodattaConnectContextProvid console.log(err) } + // + if (props.chains) setChains(props.chains) + // sort wallets by featured, installed, and rest sortWallet(wallets) @@ -169,7 +177,8 @@ export function CodattaConnectContextProvider(props: CodattaConnectContextProvid wallets, initialized, lastUsedWallet, - featuredWallets + featuredWallets, + chains }} > {props.children} diff --git a/lib/components/evm-wallet-login-widget.tsx b/lib/components/evm-wallet-login-widget.tsx index 4dc15d8..1b618fe 100644 --- a/lib/components/evm-wallet-login-widget.tsx +++ b/lib/components/evm-wallet-login-widget.tsx @@ -8,7 +8,7 @@ import { WalletItem } from '../types/wallet-item.class' import accountApi, { ILoginResponse } from '../api/account.api' import { useCodattaSigninContext } from '@/providers/codatta-signin-context-provider' -export default function WalletLogin(props: { +export default function EvmWalletLoginWidget(props: { wallet: WalletItem onLogin: (res: ILoginResponse) => void onBack: () => void diff --git a/lib/components/wallet-connect.tsx b/lib/components/wallet-connect.tsx index 9ea906c..daad1bd 100644 --- a/lib/components/wallet-connect.tsx +++ b/lib/components/wallet-connect.tsx @@ -17,12 +17,12 @@ export interface WalletSignInfo { wallet_name: string } -function getSiweMessage(address: `0x${string}`, nonce: string) { +function getSiweMessage(address: `0x${string}`, nonce: string, chainId: number) { const domain = window.location.host const uri = window.location.href const message = createSiweMessage({ address: address, - chainId: 1, + chainId: chainId, domain, nonce, uri, @@ -39,18 +39,31 @@ export default function WalletConnect(props: { const [error, setError] = useState() const { wallet, onSignFinish } = props const nonce = useRef() - const [guideType, setGuideType] = useState<'connect' | 'sign' | 'waiting'>('connect') - const { saveLastUsedWallet } = useCodattaConnectContext() + const [guideType, setGuideType] = useState<'connect' | 'sign' | 'waiting' | 'switch-chain'>('connect') + const { saveLastUsedWallet, chains } = useCodattaConnectContext() async function walletSignin(nonce: string) { try { setGuideType('connect') + // get addresses const addresses = await wallet.connect() if (!addresses || addresses.length === 0) { throw new Error('Wallet connect error') } + + // check chain + const currentChain = await wallet.getChain() + const findChain = chains.find((c) => c.id === currentChain) + const targetChain = chains[0] + if (!findChain) { + console.log('switch chain', chains[0]) + setGuideType('switch-chain') + await wallet.switchChain(chains[0]) + } + const address = getAddress(addresses[0]) - const message = getSiweMessage(address, nonce) + const message = getSiweMessage(address, nonce, targetChain.id) + setGuideType('sign') const signature = await wallet.signMessage(message, address) if (!signature || signature.length === 0) { @@ -59,8 +72,9 @@ export default function WalletConnect(props: { setGuideType('waiting') await onSignFinish(wallet, { address, signature, message, nonce, wallet_name: wallet.config?.name || '' }) saveLastUsedWallet(wallet) - } catch (err: any) { - console.log(err.details) + } catch (err:any) { + console.log('walletSignin error', err.stack) + console.log(err.details || err.message) setError(err.details || err.message) } } @@ -109,6 +123,7 @@ export default function WalletConnect(props: { )} + {guideType === 'switch-chain' && Switch to {chains[0].name}} )}
diff --git a/lib/types/wallet-item.class.ts b/lib/types/wallet-item.class.ts index 2de9d9c..6b099cc 100644 --- a/lib/types/wallet-item.class.ts +++ b/lib/types/wallet-item.class.ts @@ -1,4 +1,4 @@ -import { EIP1193Provider, WalletClient, createWalletClient, custom } from 'viem' +import { Chain, EIP1193Provider, WalletClient, createWalletClient, custom } from 'viem' import { WalletConfig } from '../constant/wallet-book' import UniversalProvider from '@walletconnect/universal-provider' import { EIP6963ProviderDetail } from '../utils/eip6963-detect' @@ -13,6 +13,7 @@ export class WalletItem { private _fatured: boolean = false private _installed: boolean = false public lastUsed: boolean = false + private _client: WalletClient | null = null public get address() { return this._address @@ -40,8 +41,8 @@ export class WalletItem { public get client(): WalletClient | null { - if (!this._provider) return null - return createWalletClient({ transport: custom(this._provider) }) + if (!this._client) return null + return this._client } public get config() { @@ -66,6 +67,7 @@ export class WalletItem { if (!params.session) throw new Error('session is null') this._key = params.session?.peer.metadata.name this._provider = params + this._client = createWalletClient({ transport: custom(this._provider) }) this._config = { name: params.session.peer.metadata.name, image: params.session.peer.metadata.icons[0], @@ -76,6 +78,7 @@ export class WalletItem { this._key = params.info.name this._provider = params.provider this._installed = true + this._client = createWalletClient({ transport: custom(this._provider) }) this._config = { name: params.info.name, image: params.info.icon, @@ -89,6 +92,7 @@ export class WalletItem { public EIP6963Detected(detail: EIP6963ProviderDetail) { this._provider = detail.provider + this._client = createWalletClient({ transport: custom(this._provider) }) this._installed = true this._provider.on('disconnect', this.disconnect) this._provider.on('accountsChanged', (addresses: `0x${string}`[]) => { @@ -100,9 +104,26 @@ export class WalletItem { public setUniversalProvider(provider: UniversalProvider) { this._provider = provider + this._client = createWalletClient({ transport: custom(this._provider) }) this.testConnect() } + public async switchChain(chain: Chain) { + try { + const currentChain = await this.client?.getChainId() + if (currentChain === chain.id) return true + await this.client?.switchChain(chain) + return true + } catch (error: any) { + if (error.code === 4902) { + await this.client?.addChain({chain}) + await this.client?.switchChain(chain) + return true + } + throw error + } + } + private async testConnect() { const address = await this.client?.getAddresses() if (address && address.length > 0) { @@ -115,7 +136,7 @@ export class WalletItem { } async connect() { - const addresses = await this.client?.request({ method: 'eth_requestAccounts', params: undefined }) + const addresses = await this.client?.requestAddresses() if (!addresses) throw new Error('connect failed') return addresses } @@ -132,7 +153,7 @@ export class WalletItem { return chain } - async signMessage(message: string, address:`0x${string}`) { + async signMessage(message: string, address: `0x${string}`) { const signature = await this.client?.signMessage({ message, account: address }) return signature } @@ -140,7 +161,7 @@ export class WalletItem { async disconnect() { if (this._provider && 'session' in this._provider) { await this._provider.disconnect() - } + } this._connected = false this._address = null } diff --git a/package-lock.json b/package-lock.json index 910bb81..dd55529 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "codatta-connect", - "version": "2.4.5", + "version": "2.5.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "codatta-connect", - "version": "2.4.5", + "version": "2.5.2", "dependencies": { "@binance/w3w-utils": "^1.1.6", "@coinbase/wallet-sdk": "^4.2.4", @@ -28,15 +28,16 @@ "react-dom": "^18.3.1", "tailwindcss": "^3.4.15", "valtio": "^2.1.2", - "viem": "^2.21.45", + "viem": "^2.31.3", "vite": "^5.4.11", "vite-plugin-dts": "^4.3.0" } }, "node_modules/@adraffy/ens-normalize": { "version": "1.11.0", - "resolved": "https://registry.npmmirror.com/@adraffy/ens-normalize/-/ens-normalize-1.11.0.tgz", - "integrity": "sha512-/3DDPKHqqIqxUULp8yP4zODUY1i+2xvVWsv8A79xGWdCAG+8sb0hRh0Rk2QyOJUnnbyPUAZYcpBuRe3nS2OIUg==" + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.11.0.tgz", + "integrity": "sha512-/3DDPKHqqIqxUULp8yP4zODUY1i+2xvVWsv8A79xGWdCAG+8sb0hRh0Rk2QyOJUnnbyPUAZYcpBuRe3nS2OIUg==", + "license": "MIT" }, "node_modules/@alloc/quick-lru": { "version": "5.2.0", @@ -1219,12 +1220,25 @@ "resolve": "~1.22.2" } }, + "node_modules/@noble/ciphers": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz", + "integrity": "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@noble/curves": { - "version": "1.6.0", - "resolved": "https://registry.npmmirror.com/@noble/curves/-/curves-1.6.0.tgz", - "integrity": "sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==", + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.2.tgz", + "integrity": "sha512-HxngEd2XUcg9xi20JkwlLCtYwfoFw4JGkuZpT+WlsPD4gB/cxkvTD8fSsoAnphGZhFdZYKeQIPCuFlWPm1uE0g==", + "license": "MIT", "dependencies": { - "@noble/hashes": "1.5.0" + "@noble/hashes": "1.8.0" }, "engines": { "node": "^14.21.3 || >=16" @@ -1234,9 +1248,10 @@ } }, "node_modules/@noble/hashes": { - "version": "1.5.0", - "resolved": "https://registry.npmmirror.com/@noble/hashes/-/hashes-1.5.0.tgz", - "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", "engines": { "node": "^14.21.3 || >=16" }, @@ -1976,33 +1991,36 @@ } }, "node_modules/@scure/base": { - "version": "1.1.9", - "resolved": "https://registry.npmmirror.com/@scure/base/-/base-1.1.9.tgz", - "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.6.tgz", + "integrity": "sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==", + "license": "MIT", "funding": { "url": "https://paulmillr.com/funding/" } }, "node_modules/@scure/bip32": { - "version": "1.5.0", - "resolved": "https://registry.npmmirror.com/@scure/bip32/-/bip32-1.5.0.tgz", - "integrity": "sha512-8EnFYkqEQdnkuGBVpCzKxyIwDCBLDVj3oiX0EKUFre/tOjL/Hqba1D6n/8RcmaQy4f95qQFrO2A8Sr6ybh4NRw==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.7.0.tgz", + "integrity": "sha512-E4FFX/N3f4B80AKWp5dP6ow+flD1LQZo/w8UnLGYZO674jS6YnYeepycOOksv+vLPSpgN35wgKgy+ybfTb2SMw==", + "license": "MIT", "dependencies": { - "@noble/curves": "~1.6.0", - "@noble/hashes": "~1.5.0", - "@scure/base": "~1.1.7" + "@noble/curves": "~1.9.0", + "@noble/hashes": "~1.8.0", + "@scure/base": "~1.2.5" }, "funding": { "url": "https://paulmillr.com/funding/" } }, "node_modules/@scure/bip39": { - "version": "1.4.0", - "resolved": "https://registry.npmmirror.com/@scure/bip39/-/bip39-1.4.0.tgz", - "integrity": "sha512-BEEm6p8IueV/ZTfQLp/0vhw4NPnT9oWf5+28nvmeUICjP99f4vr2d+qc7AVGDDtwRep6ifR43Yed9ERVmiITzw==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.6.0.tgz", + "integrity": "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A==", + "license": "MIT", "dependencies": { - "@noble/hashes": "~1.5.0", - "@scure/base": "~1.1.8" + "@noble/hashes": "~1.8.0", + "@scure/base": "~1.2.5" }, "funding": { "url": "https://paulmillr.com/funding/" @@ -2688,9 +2706,10 @@ } }, "node_modules/abitype": { - "version": "1.0.6", - "resolved": "https://registry.npmmirror.com/abitype/-/abitype-1.0.6.tgz", - "integrity": "sha512-MMSqYh4+C/aVqI2RQaWqbvI4Kxo5cQV40WQ4QFtDnNzCkqChm8MuENhElmynZlO0qUy/ObkEUaXtKqYnx1Kp3A==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.8.tgz", + "integrity": "sha512-ZeiI6h3GnW06uYDLx0etQtX/p8E24UaHHBj57RSjK7YBFe7iuVn07EDpOeP451D06sF27VOz9JJPlIKJmXgkEg==", + "license": "MIT", "funding": { "url": "https://github.com/sponsors/wevm" }, @@ -3917,15 +3936,16 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, "node_modules/isows": { - "version": "1.0.6", - "resolved": "https://registry.npmmirror.com/isows/-/isows-1.0.6.tgz", - "integrity": "sha512-lPHCayd40oW98/I0uvgaHKWCSvkzY27LjWLbtzOm64yQ+G3Q5npjjbdppU65iZXkK1Zt+kH9pfegli0AYfwYYw==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.7.tgz", + "integrity": "sha512-I1fSfDCZL5P0v33sVqeTDSpcstAg/N+wF5HS033mogOVIp4B+oHC7oOCsA3axAbBSGTJ8QubbNmnIRN/h8U7hg==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/wevm" } ], + "license": "MIT", "peerDependencies": { "ws": "*" } @@ -4418,22 +4438,24 @@ } }, "node_modules/ox": { - "version": "0.1.2", - "resolved": "https://registry.npmmirror.com/ox/-/ox-0.1.2.tgz", - "integrity": "sha512-ak/8K0Rtphg9vnRJlbOdaX9R7cmxD2MiSthjWGaQdMk3D7hrAlDoM+6Lxn7hN52Za3vrXfZ7enfke/5WjolDww==", + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/ox/-/ox-0.8.1.tgz", + "integrity": "sha512-e+z5epnzV+Zuz91YYujecW8cF01mzmrUtWotJ0oEPym/G82uccs7q0WDHTYL3eiONbTUEvcZrptAKLgTBD3u2A==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/wevm" } ], - "dependencies": { - "@adraffy/ens-normalize": "^1.10.1", - "@noble/curves": "^1.6.0", - "@noble/hashes": "^1.5.0", - "@scure/bip32": "^1.5.0", - "@scure/bip39": "^1.4.0", - "abitype": "^1.0.6", + "license": "MIT", + "dependencies": { + "@adraffy/ens-normalize": "^1.11.0", + "@noble/ciphers": "^1.3.0", + "@noble/curves": "^1.9.1", + "@noble/hashes": "^1.8.0", + "@scure/bip32": "^1.7.0", + "@scure/bip39": "^1.6.0", + "abitype": "^1.0.8", "eventemitter3": "5.0.1" }, "peerDependencies": { @@ -5609,25 +5631,25 @@ } }, "node_modules/viem": { - "version": "2.21.45", - "resolved": "https://registry.npmmirror.com/viem/-/viem-2.21.45.tgz", - "integrity": "sha512-I+On/IiaObQdhDKWU5Rurh6nf3G7reVkAODG5ECIfjsrGQ3EPJnxirUPT4FNV6bWER5iphoG62/TidwuTSOA1A==", + "version": "2.31.3", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.31.3.tgz", + "integrity": "sha512-q3JGI5QFB4LEiLfg9f2ZwjUygAn2W0wMLtj++7E/L2i8Y7zKAkR4TEEOhwBn7gyYXpuc7f1vfd26PJbkEKuj5w==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/wevm" } ], + "license": "MIT", "dependencies": { - "@noble/curves": "1.6.0", - "@noble/hashes": "1.5.0", - "@scure/bip32": "1.5.0", - "@scure/bip39": "1.4.0", - "abitype": "1.0.6", - "isows": "1.0.6", - "ox": "0.1.2", - "webauthn-p256": "0.0.10", - "ws": "8.18.0" + "@noble/curves": "1.9.2", + "@noble/hashes": "1.8.0", + "@scure/bip32": "1.7.0", + "@scure/bip39": "1.6.0", + "abitype": "1.0.8", + "isows": "1.0.7", + "ox": "0.8.1", + "ws": "8.18.2" }, "peerDependencies": { "typescript": ">=5.0.4" @@ -5729,21 +5751,6 @@ "resolved": "https://registry.npmmirror.com/vscode-uri/-/vscode-uri-3.0.8.tgz", "integrity": "sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==" }, - "node_modules/webauthn-p256": { - "version": "0.0.10", - "resolved": "https://registry.npmmirror.com/webauthn-p256/-/webauthn-p256-0.0.10.tgz", - "integrity": "sha512-EeYD+gmIT80YkSIDb2iWq0lq2zbHo1CxHlQTeJ+KkCILWpVy3zASH3ByD4bopzfk0uCwXxLqKGLqp2W4O28VFA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/wevm" - } - ], - "dependencies": { - "@noble/curves": "^1.4.0", - "@noble/hashes": "^1.4.0" - } - }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmmirror.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz", @@ -5862,9 +5869,10 @@ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, "node_modules/ws": { - "version": "8.18.0", - "resolved": "https://registry.npmmirror.com/ws/-/ws-8.18.0.tgz", - "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", + "version": "8.18.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.2.tgz", + "integrity": "sha512-DMricUmwGZUVr++AEAe2uiVM7UoO9MAVZMDu05UQOaUII0lp+zOzLLU4Xqh/JvTqklB1T4uELaaPBKyjE1r4fQ==", + "license": "MIT", "engines": { "node": ">=10.0.0" }, diff --git a/package.json b/package.json index 37850e7..38f9958 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codatta-connect", - "version": "2.5.1", + "version": "2.5.3", "type": "module", "main": "./dist/index.umd.js", "module": "./dist/index.es.js", @@ -34,7 +34,7 @@ "react-dom": "^18.3.1", "tailwindcss": "^3.4.15", "valtio": "^2.1.2", - "viem": "^2.21.45", + "viem": "^2.31.3", "vite": "^5.4.11", "vite-plugin-dts": "^4.3.0" } diff --git a/src/layout/app-layout.tsx b/src/layout/app-layout.tsx index cbcadb6..69acb03 100644 --- a/src/layout/app-layout.tsx +++ b/src/layout/app-layout.tsx @@ -1,8 +1,31 @@ import React from 'react' import { CodattaConnectContextProvider } from '../../lib/main' +import { bsc, mainnet } from 'viem/chains' +import { defineChain } from 'viem' + +const BSC_CHAIN = defineChain({ + id: 56, + name: 'BNB Smart Chain Mainnet', + nativeCurrency: { + name: 'BNB', + symbol: 'BNB', + decimals: 18, + }, + rpcUrls: { + default: { + http: ['https://bsc-dataseed1.bnbchain.org'], + }, + }, + blockExplorers: { + default: { + name: 'BSCScan', + url: 'https://bscscan.com/', + }, + }, +}) export default function AppLayout(props: { children: React.ReactNode }) { - return + return
{props.children}
diff --git a/src/views/login-view.tsx b/src/views/login-view.tsx index 6015796..fc2be62 100644 --- a/src/views/login-view.tsx +++ b/src/views/login-view.tsx @@ -1,3 +1,4 @@ +import { defineChain } from "viem"; import accountApi, { ILoginResponse } from "../../lib/api/account.api"; import { EmvWalletConnectInfo, @@ -6,6 +7,8 @@ import { import { CodattaSignin, CodattaConnect, useCodattaConnectContext } from "../../lib/main"; import React, { useEffect } from "react"; + + export default function LoginView() { const { lastUsedWallet } = useCodattaConnectContext(); diff --git a/vite.config.build.ts.timestamp-1750323952300-797e593ea1f06.mjs b/vite.config.build.ts.timestamp-1750323952300-797e593ea1f06.mjs new file mode 100644 index 0000000..abb8273 --- /dev/null +++ b/vite.config.build.ts.timestamp-1750323952300-797e593ea1f06.mjs @@ -0,0 +1,41 @@ +// vite.config.build.ts +import { defineConfig } from "file:///Users/zhanglei/work/codatta-connect/node_modules/vite/dist/node/index.js"; +import react from "file:///Users/zhanglei/work/codatta-connect/node_modules/@vitejs/plugin-react/dist/index.mjs"; +import dts from "file:///Users/zhanglei/work/codatta-connect/node_modules/vite-plugin-dts/dist/index.mjs"; +import path from "path"; +import tailwindcss from "file:///Users/zhanglei/work/codatta-connect/node_modules/tailwindcss/lib/index.js"; +var __vite_injected_original_dirname = "/Users/zhanglei/work/codatta-connect"; +var vite_config_build_default = defineConfig({ + resolve: { + alias: { + "@": path.resolve(__vite_injected_original_dirname, "./lib") + } + }, + build: { + lib: { + entry: path.resolve("./", "./lib/main.ts"), + name: "xny-connect", + fileName: (format) => `index.${format}.js` + }, + rollupOptions: { + external: ["react", "react-dom"], + output: { + globals: { + react: "React", + "react-dom": "ReactDOM" + } + } + }, + emptyOutDir: true + }, + plugins: [react(), dts()], + css: { + postcss: { + plugins: [tailwindcss] + } + } +}); +export { + vite_config_build_default as default +}; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcuYnVpbGQudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCIvVXNlcnMvemhhbmdsZWkvd29yay9jb2RhdHRhLWNvbm5lY3RcIjtjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZmlsZW5hbWUgPSBcIi9Vc2Vycy96aGFuZ2xlaS93b3JrL2NvZGF0dGEtY29ubmVjdC92aXRlLmNvbmZpZy5idWlsZC50c1wiO2NvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9pbXBvcnRfbWV0YV91cmwgPSBcImZpbGU6Ly8vVXNlcnMvemhhbmdsZWkvd29yay9jb2RhdHRhLWNvbm5lY3Qvdml0ZS5jb25maWcuYnVpbGQudHNcIjtpbXBvcnQgeyBkZWZpbmVDb25maWcgfSBmcm9tICd2aXRlJ1xuaW1wb3J0IHJlYWN0IGZyb20gJ0B2aXRlanMvcGx1Z2luLXJlYWN0J1xuaW1wb3J0IGR0cyBmcm9tICd2aXRlLXBsdWdpbi1kdHMnXG5pbXBvcnQgcGF0aCBmcm9tICdwYXRoJ1xuaW1wb3J0IHRhaWx3aW5kY3NzIGZyb20gXCJ0YWlsd2luZGNzc1wiXG5cbmV4cG9ydCBkZWZhdWx0IGRlZmluZUNvbmZpZyh7XG4gIHJlc29sdmU6IHtcbiAgICBhbGlhczoge1xuICAgICAgXCJAXCI6IHBhdGgucmVzb2x2ZShfX2Rpcm5hbWUsIFwiLi9saWJcIiksXG4gICAgfSxcbiAgfSxcbiAgYnVpbGQ6IHtcblxuICAgIGxpYjoge1xuICAgICAgZW50cnk6IHBhdGgucmVzb2x2ZSgnLi8nLCAnLi9saWIvbWFpbi50cycpLFxuICAgICAgbmFtZTogJ3hueS1jb25uZWN0JyxcbiAgICAgIGZpbGVOYW1lOiAoZm9ybWF0KSA9PiBgaW5kZXguJHtmb3JtYXR9LmpzYCxcbiAgICB9LFxuXG4gICAgcm9sbHVwT3B0aW9uczoge1xuICAgICAgZXh0ZXJuYWw6IFsncmVhY3QnLCAncmVhY3QtZG9tJ10sXG4gICAgICBvdXRwdXQ6IHtcbiAgICAgICAgZ2xvYmFsczoge1xuICAgICAgICAgIHJlYWN0OiBcIlJlYWN0XCIsXG4gICAgICAgICAgXCJyZWFjdC1kb21cIjogXCJSZWFjdERPTVwiLFxuICAgICAgICB9LFxuICAgICAgfSxcbiAgICB9LFxuICAgIGVtcHR5T3V0RGlyOiB0cnVlLFxuICB9LFxuXG4gIHBsdWdpbnM6IFtyZWFjdCgpLCBkdHMoKV0sXG4gIGNzczoge1xuICAgIHBvc3Rjc3M6IHtcbiAgICAgIHBsdWdpbnM6IFt0YWlsd2luZGNzc10sXG4gICAgfSxcbiAgfVxufSlcbiJdLAogICJtYXBwaW5ncyI6ICI7QUFBMFMsU0FBUyxvQkFBb0I7QUFDdlUsT0FBTyxXQUFXO0FBQ2xCLE9BQU8sU0FBUztBQUNoQixPQUFPLFVBQVU7QUFDakIsT0FBTyxpQkFBaUI7QUFKeEIsSUFBTSxtQ0FBbUM7QUFNekMsSUFBTyw0QkFBUSxhQUFhO0FBQUEsRUFDMUIsU0FBUztBQUFBLElBQ1AsT0FBTztBQUFBLE1BQ0wsS0FBSyxLQUFLLFFBQVEsa0NBQVcsT0FBTztBQUFBLElBQ3RDO0FBQUEsRUFDRjtBQUFBLEVBQ0EsT0FBTztBQUFBLElBRUwsS0FBSztBQUFBLE1BQ0gsT0FBTyxLQUFLLFFBQVEsTUFBTSxlQUFlO0FBQUEsTUFDekMsTUFBTTtBQUFBLE1BQ04sVUFBVSxDQUFDLFdBQVcsU0FBUyxNQUFNO0FBQUEsSUFDdkM7QUFBQSxJQUVBLGVBQWU7QUFBQSxNQUNiLFVBQVUsQ0FBQyxTQUFTLFdBQVc7QUFBQSxNQUMvQixRQUFRO0FBQUEsUUFDTixTQUFTO0FBQUEsVUFDUCxPQUFPO0FBQUEsVUFDUCxhQUFhO0FBQUEsUUFDZjtBQUFBLE1BQ0Y7QUFBQSxJQUNGO0FBQUEsSUFDQSxhQUFhO0FBQUEsRUFDZjtBQUFBLEVBRUEsU0FBUyxDQUFDLE1BQU0sR0FBRyxJQUFJLENBQUM7QUFBQSxFQUN4QixLQUFLO0FBQUEsSUFDSCxTQUFTO0FBQUEsTUFDUCxTQUFTLENBQUMsV0FBVztBQUFBLElBQ3ZCO0FBQUEsRUFDRjtBQUNGLENBQUM7IiwKICAibmFtZXMiOiBbXQp9Cg== From 79a3d8d55e04fc0a2a187a9ca0b357a3567941aa Mon Sep 17 00:00:00 2001 From: Meow Lord Date: Thu, 19 Jun 2025 17:15:09 +0800 Subject: [PATCH 18/25] only have chains config, then check chain --- lib/components/wallet-connect.tsx | 10 ++++++---- src/layout/app-layout.tsx | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/components/wallet-connect.tsx b/lib/components/wallet-connect.tsx index daad1bd..1d88d83 100644 --- a/lib/components/wallet-connect.tsx +++ b/lib/components/wallet-connect.tsx @@ -5,6 +5,7 @@ import { Loader2 } from 'lucide-react' import { WalletItem } from '../types/wallet-item.class' import { useCodattaConnectContext } from '../codatta-connect-context-provider' import { getAddress } from 'viem' +import { mainnet } from 'viem/chains' const CONNECT_GUIDE_MESSAGE = 'Accept connection request in the wallet' const MESSAGE_SIGN_GUIDE_MESSAGE = 'Accept sign-in request in your wallet' @@ -54,11 +55,12 @@ export default function WalletConnect(props: { // check chain const currentChain = await wallet.getChain() const findChain = chains.find((c) => c.id === currentChain) - const targetChain = chains[0] - if (!findChain) { - console.log('switch chain', chains[0]) + const targetChain = findChain || chains[0] || mainnet + + // chain check and switch + if (!findChain && chains.length > 0) { setGuideType('switch-chain') - await wallet.switchChain(chains[0]) + await wallet.switchChain(targetChain) } const address = getAddress(addresses[0]) diff --git a/src/layout/app-layout.tsx b/src/layout/app-layout.tsx index 69acb03..cca16b8 100644 --- a/src/layout/app-layout.tsx +++ b/src/layout/app-layout.tsx @@ -25,7 +25,7 @@ const BSC_CHAIN = defineChain({ }) export default function AppLayout(props: { children: React.ReactNode }) { - return + return
{props.children}
From 36d93137fb41abb406b05681f9a04ee3d7fa338f Mon Sep 17 00:00:00 2001 From: Meow Lord Date: Thu, 14 Aug 2025 09:44:31 +0800 Subject: [PATCH 19/25] version 2.5.6 fix walletconnect lastused wallet --- dist/index.es.js | 2 +- dist/index.umd.js | 86 +- dist/{main-D7TyRk7o.js => main-bMMpd4wM.js} | 6775 +++++++++-------- ...56k1-D5_JzNmG.js => secp256k1-BeAu1v7B.js} | 2 +- lib/codatta-connect-context-provider.tsx | 24 +- lib/components/wallet-qr.tsx | 1 + lib/types/wallet-item.class.ts | 1 + package.json | 2 +- 8 files changed, 3463 insertions(+), 3430 deletions(-) rename dist/{main-D7TyRk7o.js => main-bMMpd4wM.js} (91%) rename dist/{secp256k1-D5_JzNmG.js => secp256k1-BeAu1v7B.js} (99%) diff --git a/dist/index.es.js b/dist/index.es.js index d5abbfb..73d7ffc 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -1,4 +1,4 @@ -import { l as o, C as e, k as n, W as C, j as s, u as d } from "./main-D7TyRk7o.js"; +import { l as o, C as e, k as n, W as C, j as s, u as d } from "./main-bMMpd4wM.js"; export { o as CodattaConnect, e as CodattaConnectContextProvider, diff --git a/dist/index.umd.js b/dist/index.umd.js index 9a12faa..61882f2 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -1,4 +1,4 @@ -(function(Pn,Ee){typeof exports=="object"&&typeof module<"u"?Ee(exports,require("react"),require("https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js")):typeof define=="function"&&define.amd?define(["exports","react","https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"],Ee):(Pn=typeof globalThis<"u"?globalThis:Pn||self,Ee(Pn["xny-connect"]={},Pn.React))})(this,function(Pn,Ee){"use strict";var Uoe=Object.defineProperty;var qoe=(Pn,Ee,qc)=>Ee in Pn?Uoe(Pn,Ee,{enumerable:!0,configurable:!0,writable:!0,value:qc}):Pn[Ee]=qc;var Ns=(Pn,Ee,qc)=>qoe(Pn,typeof Ee!="symbol"?Ee+"":Ee,qc);function qc(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const Yt=qc(Ee);var nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ji(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function cg(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var ug={exports:{}},mf={};/** +(function(Pn,Ee){typeof exports=="object"&&typeof module<"u"?Ee(exports,require("react"),require("https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js")):typeof define=="function"&&define.amd?define(["exports","react","https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"],Ee):(Pn=typeof globalThis<"u"?globalThis:Pn||self,Ee(Pn["xny-connect"]={},Pn.React))})(this,function(Pn,Ee){"use strict";var zoe=Object.defineProperty;var Hoe=(Pn,Ee,zc)=>Ee in Pn?zoe(Pn,Ee,{enumerable:!0,configurable:!0,writable:!0,value:zc}):Pn[Ee]=zc;var Ns=(Pn,Ee,zc)=>Hoe(Pn,typeof Ee!="symbol"?Ee+"":Ee,zc);function zc(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const Yt=zc(Ee);var nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ji(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function cg(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var ug={exports:{}},mf={};/** * @license React * react-jsx-runtime.production.min.js * @@ -27,7 +27,7 @@ Check the top-level render call using <`+pe+">.")}return ae}}function yt(q,ae){{ <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; - <%s key={someKey} {...props} />`,dt,Mt,_t,Mt),Ft[Mt+dt]=!0}}return q===n?nt(tt):jt(tt),tt}}function K(q,ae,pe){return $(q,ae,pe,!0)}function G(q,ae,pe){return $(q,ae,pe,!1)}var C=G,Y=K;vf.Fragment=n,vf.jsx=C,vf.jsxs=Y}()),vf}process.env.NODE_ENV==="production"?ug.exports=PP():ug.exports=MP();var le=ug.exports;const Ls="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2",IP=[{featured:!0,name:"MetaMask",rdns:"io.metamask",image:`${Ls}#metamask`,getWallet:{chrome_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",brave_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",edge_addon_id:"ejbalbakoplchlghecdalmeeeajnimhm",firefox_addon_id:"ether-metamask",play_store_id:"io.metamask",app_store_id:"id1438144202"},deep_link:"metamask://wc",universal_link:"https://metamask.app.link/wc"},{featured:!0,name:"OKX Wallet",rdns:"com.okex.wallet",image:`${Ls}#okx`,getWallet:{chrome_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",brave_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",edge_addon_id:"pbpjkcldjiffchgbbndmhojiacbgflha",play_store_id:"com.okinc.okex.gp",app_store_id:"id1327268470"},deep_link:"okex://main/wc",universal_link:"okex://main/wc"},{featured:!0,name:"WalletConnect",image:`${Ls}#walletconnect`},{featured:!1,name:"Coinbase Wallet",image:`${Ls}#coinbase`},{featured:!1,name:"GateWallet",rdns:"io.gate.wallet",image:`${Ls}#6e528abf-7a7d-47bd-d84d-481f169b1200`,getWallet:{chrome_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",brave_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",play_store_id:"com.gateio.gateio",app_store_id:"id1294998195",mac_app_store_id:"id1609559473"},deep_link:"https://www.gate.io/mobileapp",universal_link:"https://www.gate.io/mobileapp"},{featured:!1,name:"Onekey",rdns:"so.onekey.app.wallet",image:`${Ls}#onekey`,getWallet:{chrome_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",brave_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",play_store_id:"so.onekey.app.wallet",app_store_id:"id1609559473"},deep_link:"onekey-wallet://",universal_link:"onekey://wc"},{featured:!1,name:"Infinity Wallet",image:`${Ls}#9f259366-0bcd-4817-0af9-f78773e41900`,desktop_link:"infinity://wc"},{name:"Rabby Wallet",rdns:"io.rabby",featured:!1,image:`${Ls}#rabby`,getWallet:{chrome_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",brave_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",play_store_id:"com.debank.rabbymobile",app_store_id:"id6474381673"}},{name:"Binance Web3 Wallet",featured:!1,image:`${Ls}#ebac7b39-688c-41e3-7912-a4fefba74600`,getWallet:{play_store_id:"com.binance.dev",app_store_id:"id1436799971"}},{name:"Rainbow Wallet",rdns:"me.rainbow",featured:!1,image:`${Ls}#rainbow`,getWallet:{chrome_store_id:"opfgelmcmbiajamepnmloijbpoleiama",edge_addon_id:"cpojfbodiccabbabgimdeohkkpjfpbnf",firefox_addon_id:"rainbow-extension",app_store_id:"id1457119021",play_store_id:"me.rainbow"}}];function CP(t,e){const r=t.exec(e);return r==null?void 0:r.groups}const nw=/^tuple(?(\[(\d*)\])*)$/;function fg(t){let e=t.type;if(nw.test(t.type)&&"components"in t){e="(";const r=t.components.length;for(let i=0;ie(t,s)}function zc(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new qP(t.type);return`${t.name}(${lg(t.inputs,{includeName:e})})`}function lg(t,{includeName:e=!1}={}){return t?t.map(r=>RP(r,{includeName:e})).join(e?", ":","):""}function RP(t,{includeName:e}){return t.type.startsWith("tuple")?`(${lg(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}function Jo(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function vn(t){return Jo(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const iw="2.31.3";let yf={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${iw}`};class pt extends Error{constructor(e,r={}){var a;const n=(()=>{var u;return r.cause instanceof pt?r.cause.details:(u=r.cause)!=null&&u.message?r.cause.message:r.details})(),i=r.cause instanceof pt&&r.cause.docsPath||r.docsPath,s=(a=yf.getDocsUrl)==null?void 0:a.call(yf,{...r,docsPath:i}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...yf.version?[`Version: ${yf.version}`]:[]].join(` + <%s key={someKey} {...props} />`,dt,Mt,_t,Mt),Ft[Mt+dt]=!0}}return q===n?nt(tt):jt(tt),tt}}function K(q,ae,pe){return $(q,ae,pe,!0)}function G(q,ae,pe){return $(q,ae,pe,!1)}var C=G,Y=K;vf.Fragment=n,vf.jsx=C,vf.jsxs=Y}()),vf}process.env.NODE_ENV==="production"?ug.exports=PP():ug.exports=MP();var le=ug.exports;const Ls="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2",IP=[{featured:!0,name:"MetaMask",rdns:"io.metamask",image:`${Ls}#metamask`,getWallet:{chrome_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",brave_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",edge_addon_id:"ejbalbakoplchlghecdalmeeeajnimhm",firefox_addon_id:"ether-metamask",play_store_id:"io.metamask",app_store_id:"id1438144202"},deep_link:"metamask://wc",universal_link:"https://metamask.app.link/wc"},{featured:!0,name:"OKX Wallet",rdns:"com.okex.wallet",image:`${Ls}#okx`,getWallet:{chrome_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",brave_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",edge_addon_id:"pbpjkcldjiffchgbbndmhojiacbgflha",play_store_id:"com.okinc.okex.gp",app_store_id:"id1327268470"},deep_link:"okex://main/wc",universal_link:"okex://main/wc"},{featured:!0,name:"WalletConnect",image:`${Ls}#walletconnect`},{featured:!1,name:"Coinbase Wallet",image:`${Ls}#coinbase`},{featured:!1,name:"GateWallet",rdns:"io.gate.wallet",image:`${Ls}#6e528abf-7a7d-47bd-d84d-481f169b1200`,getWallet:{chrome_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",brave_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",play_store_id:"com.gateio.gateio",app_store_id:"id1294998195",mac_app_store_id:"id1609559473"},deep_link:"https://www.gate.io/mobileapp",universal_link:"https://www.gate.io/mobileapp"},{featured:!1,name:"Onekey",rdns:"so.onekey.app.wallet",image:`${Ls}#onekey`,getWallet:{chrome_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",brave_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",play_store_id:"so.onekey.app.wallet",app_store_id:"id1609559473"},deep_link:"onekey-wallet://",universal_link:"onekey://wc"},{featured:!1,name:"Infinity Wallet",image:`${Ls}#9f259366-0bcd-4817-0af9-f78773e41900`,desktop_link:"infinity://wc"},{name:"Rabby Wallet",rdns:"io.rabby",featured:!1,image:`${Ls}#rabby`,getWallet:{chrome_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",brave_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",play_store_id:"com.debank.rabbymobile",app_store_id:"id6474381673"}},{name:"Binance Web3 Wallet",featured:!1,image:`${Ls}#ebac7b39-688c-41e3-7912-a4fefba74600`,getWallet:{play_store_id:"com.binance.dev",app_store_id:"id1436799971"}},{name:"Rainbow Wallet",rdns:"me.rainbow",featured:!1,image:`${Ls}#rainbow`,getWallet:{chrome_store_id:"opfgelmcmbiajamepnmloijbpoleiama",edge_addon_id:"cpojfbodiccabbabgimdeohkkpjfpbnf",firefox_addon_id:"rainbow-extension",app_store_id:"id1457119021",play_store_id:"me.rainbow"}}];function CP(t,e){const r=t.exec(e);return r==null?void 0:r.groups}const nw=/^tuple(?(\[(\d*)\])*)$/;function fg(t){let e=t.type;if(nw.test(t.type)&&"components"in t){e="(";const r=t.components.length;for(let i=0;ie(t,s)}function Hc(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new qP(t.type);return`${t.name}(${lg(t.inputs,{includeName:e})})`}function lg(t,{includeName:e=!1}={}){return t?t.map(r=>RP(r,{includeName:e})).join(e?", ":","):""}function RP(t,{includeName:e}){return t.type.startsWith("tuple")?`(${lg(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}function Jo(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function vn(t){return Jo(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const iw="2.31.3";let yf={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${iw}`};class pt extends Error{constructor(e,r={}){var a;const n=(()=>{var u;return r.cause instanceof pt?r.cause.details:(u=r.cause)!=null&&u.message?r.cause.message:r.details})(),i=r.cause instanceof pt&&r.cause.docsPath||r.docsPath,s=(a=yf.getDocsUrl)==null?void 0:a.call(yf,{...r,docsPath:i}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...yf.version?[`Version: ${yf.version}`]:[]].join(` `);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=iw}walk(e){return sw(this,e)}}function sw(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?sw(t.cause,e):e?null:t}class DP extends pt{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` `),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class ow extends pt{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` `),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class OP extends pt{constructor({data:e,params:r,size:n}){super([`Data size of ${n} bytes is too small for given parameters.`].join(` @@ -35,21 +35,21 @@ React keys must be passed directly to JSX without using spread: `),{name:"AbiEncodingArrayLengthMismatchError"})}}class LP extends pt{constructor({expectedSize:e,value:r}){super(`Size of bytes "${r}" (bytes${vn(r)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class kP extends pt{constructor({expectedLength:e,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${r}`].join(` `),{name:"AbiEncodingLengthMismatchError"})}}class aw extends pt{constructor(e,{docsPath:r}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(` `),{docsPath:r,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class cw extends pt{constructor(e,{docsPath:r}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` -`),{docsPath:r,name:"AbiFunctionNotFoundError"})}}class BP extends pt{constructor(e,r){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${zc(e.abiItem)}\`, and`,`\`${r.type}\` in \`${zc(r.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class $P extends pt{constructor({expectedSize:e,givenSize:r}){super(`Expected bytes${e}, got bytes${r}.`,{name:"BytesSizeMismatchError"})}}class FP extends pt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(` +`),{docsPath:r,name:"AbiFunctionNotFoundError"})}}class BP extends pt{constructor(e,r){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${Hc(e.abiItem)}\`, and`,`\`${r.type}\` in \`${Hc(r.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class $P extends pt{constructor({expectedSize:e,givenSize:r}){super(`Expected bytes${e}, got bytes${r}.`,{name:"BytesSizeMismatchError"})}}class FP extends pt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(` `),{docsPath:r,name:"InvalidAbiEncodingType"})}}class jP extends pt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` `),{docsPath:r,name:"InvalidAbiDecodingType"})}}class UP extends pt{constructor(e){super([`Value "${e}" is not a valid array.`].join(` `),{name:"InvalidArrayError"})}}class qP extends pt{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` -`),{name:"InvalidDefinitionTypeError"})}}class uw extends pt{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}class fw extends pt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}class lw extends pt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function Hc(t,{dir:e,size:r=32}={}){return typeof t=="string"?Xo(t,{dir:e,size:r}):zP(t,{dir:e,size:r})}function Xo(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new fw({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function zP(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new fw({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie)throw new WP({givenSize:vn(t),maxSize:e})}function Zo(t,e={}){const{signed:r}=e;e.size&&ks(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<e.toString(16).padStart(2,"0"));function kh(t,e={}){return typeof t=="number"||typeof t=="bigint"?dr(t,e):typeof t=="string"?Bh(t,e):typeof t=="boolean"?dw(t,e):ui(t,e)}function dw(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(ks(r,{size:e.size}),Hc(r,{size:e.size})):r}function ui(t,e={}){let r="";for(let i=0;is||i=fo.zero&&t<=fo.nine)return t-fo.zero;if(t>=fo.A&&t<=fo.F)return t-(fo.A-10);if(t>=fo.a&&t<=fo.f)return t-(fo.a-10)}function lo(t,e={}){let r=t;e.size&&(ks(r,{size:e.size}),r=Hc(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o>mw&$h)}:{h:Number(t>>mw&$h)|0,l:Number(t&$h)|0}}function ZP(t,e=!1){const r=t.length;let n=new Uint32Array(r),i=new Uint32Array(r);for(let s=0;st<>>32-r,eM=(t,e,r)=>e<>>32-r,tM=(t,e,r)=>e<>>64-r,rM=(t,e,r)=>t<>>64-r,Wc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function pg(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function wf(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function ps(t,...e){if(!pg(t))throw new Error("Uint8Array expected");e.length>0}function nM(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");wf(t.outputLen),wf(t.blockLen)}function Kc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function vw(t,e){ps(t);const r=e.outputLen;if(t.length>>e}const sM=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function oM(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function aM(t){for(let e=0;et:aM,yw=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",cM=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Gc(t){if(ps(t),yw)return t.toHex();let e="";for(let r=0;r=ho._0&&t<=ho._9)return t-ho._0;if(t>=ho.A&&t<=ho.F)return t-(ho.A-10);if(t>=ho.a&&t<=ho.f)return t-(ho.a-10)}function mg(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(yw)return Uint8Array.fromHex(t);const e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;it().update(xf(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function fM(t){const e=(n,i)=>t(i).update(xf(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function lM(t=32){if(Wc&&typeof Wc.getRandomValues=="function")return Wc.getRandomValues(new Uint8Array(t));if(Wc&&typeof Wc.randomBytes=="function")return Uint8Array.from(Wc.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}const hM=BigInt(0),_f=BigInt(1),dM=BigInt(2),pM=BigInt(7),gM=BigInt(256),mM=BigInt(113),_w=[],Ew=[],Sw=[];for(let t=0,e=_f,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],_w.push(2*(5*n+r)),Ew.push((t+1)*(t+2)/2%64);let i=hM;for(let s=0;s<7;s++)e=(e<<_f^(e>>pM)*mM)%gM,e&dM&&(i^=_f<<(_f<r>32?tM(t,e,r):QP(t,e,r),Mw=(t,e,r)=>r>32?rM(t,e,r):eM(t,e,r);function Iw(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,u=(o+2)%10,l=r[u],d=r[u+1],p=Pw(l,d,1)^r[a],y=Mw(l,d,1)^r[a+1];for(let _=0;_<50;_+=10)t[o+_]^=p,t[o+_+1]^=y}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=Ew[o],u=Pw(i,s,a),l=Mw(i,s,a),d=_w[o];i=t[d],s=t[d+1],t[d]=u,t[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=vM[n],t[1]^=bM[n]}Vc(r)}class Ef extends vg{constructor(e,r,n,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,wf(n),!(0=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return wf(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(vw(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Vc(this.state)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new Ef(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const ea=(t,e,r)=>xw(()=>new Ef(e,t,r)),yM=ea(6,144,224/8),wM=ea(6,136,256/8),xM=ea(6,104,384/8),_M=ea(6,72,512/8),EM=ea(1,144,224/8),Cw=ea(1,136,256/8),SM=ea(1,104,384/8),AM=ea(1,72,512/8),Tw=(t,e,r)=>fM((n={})=>new Ef(e,t,n.dkLen===void 0?r:n.dkLen,!0)),PM=Object.freeze(Object.defineProperty({__proto__:null,Keccak:Ef,keccakP:Iw,keccak_224:EM,keccak_256:Cw,keccak_384:SM,keccak_512:AM,sha3_224:yM,sha3_256:wM,sha3_384:xM,sha3_512:_M,shake128:Tw(31,168,128/8),shake256:Tw(31,136,256/8)},Symbol.toStringTag,{value:"Module"}));function Fh(t,e){const r=e||"hex",n=Cw(Jo(t,{strict:!1})?dg(t):t);return r==="bytes"?n:kh(n)}const MM=t=>Fh(dg(t));function IM(t){return MM(t)}function CM(t){let e=!0,r="",n=0,i="",s=!1;for(let o=0;o{const e=typeof t=="string"?t:TP(t);return CM(e)};function Rw(t){return IM(TM(t))}const RM=Rw;class ta extends pt{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class jh extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const bg=new jh(8192);function Sf(t,e){if(bg.has(`${t}.${e}`))return bg.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=Fh(gw(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return bg.set(`${t}.${e}`,s),s}function yg(t,e){if(!gs(t,{strict:!1}))throw new ta({address:t});return Sf(t,e)}const DM=/^0x[a-fA-F0-9]{40}$/,wg=new jh(8192);function gs(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(wg.has(n))return wg.get(n);const i=DM.test(t)?t.toLowerCase()===t?!0:r?Sf(t)===t:!0:!1;return wg.set(n,i),i}function ra(t){return typeof t[0]=="string"?Uh(t):OM(t)}function OM(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function Uh(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}function qh(t,e,r,{strict:n}={}){return Jo(t,{strict:!1})?xg(t,e,r,{strict:n}):Nw(t,e,r,{strict:n})}function Dw(t,e){if(typeof e=="number"&&e>0&&e>vn(t)-1)throw new uw({offset:e,position:"start",size:vn(t)})}function Ow(t,e,r){if(typeof e=="number"&&typeof r=="number"&&vn(t)!==r-e)throw new uw({offset:r,position:"end",size:vn(t)})}function Nw(t,e,r,{strict:n}={}){Dw(t,e);const i=t.slice(e,r);return n&&Ow(i,e,r),i}function xg(t,e,r,{strict:n}={}){Dw(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&Ow(i,e,r),i}const NM=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Lw=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function kw(t,e){if(t.length!==e.length)throw new kP({expectedLength:t.length,givenLength:e.length});const r=LM({params:t,values:e}),n=Eg(r);return n.length===0?"0x":n}function LM({params:t,values:e}){const r=[];for(let n=0;n0?ra([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:ra(s.map(({encoded:o})=>o))}}function $M(t,{param:e}){const[,r]=e.type.split("bytes"),n=vn(t);if(!r){let i=t;return n%32!==0&&(i=Xo(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:ra([Xo(dr(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new LP({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:Xo(t,{dir:"right"})}}function FM(t){if(typeof t!="boolean")throw new pt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Xo(dw(t))}}function jM(t,{signed:e,size:r=256}){if(typeof r=="number"){const n=2n**(BigInt(r)-(e?1n:0n))-1n,i=e?-n-1n:0n;if(t>n||ti))}}function Sg(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const Ag=t=>qh(Rw(t),0,4);function Bw(t){const{abi:e,args:r=[],name:n}=t,i=Jo(n,{strict:!1}),s=e.filter(a=>i?a.type==="function"?Ag(a)===n:a.type==="event"?RM(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((l,d)=>{const p="inputs"in a&&a.inputs[d];return p?Pg(l,p):!1})){if(o&&"inputs"in o&&o.inputs){const l=$w(a.inputs,o.inputs,r);if(l)throw new BP({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||s[0]}function Pg(t,e){const r=typeof t,n=e.type;switch(n){case"address":return gs(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>Pg(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>Pg(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function $w(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return $w(i.components,s.components,r[n]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?gs(r[n],{strict:!1}):o.includes("address")&&o.includes("bytes")?gs(r[n],{strict:!1}):!1)return o}}function fi(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const Fw="/docs/contract/encodeFunctionData";function zM(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=Bw({abi:e,args:r,name:n});if(!s)throw new cw(n,{docsPath:Fw});i=s}if(i.type!=="function")throw new cw(void 0,{docsPath:Fw});return{abi:[i],functionName:Ag(zc(i))}}function jw(t){const{args:e}=t,{abi:r,functionName:n}=(()=>{var a;return t.abi.length===1&&((a=t.functionName)!=null&&a.startsWith("0x"))?t:zM(t)})(),i=r[0],s=n,o="inputs"in i&&i.inputs?kw(i.inputs,e??[]):void 0;return Uh([s,o??"0x"])}const HM={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},WM={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},KM={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Uw extends pt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class VM extends pt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class GM extends pt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const YM={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new GM({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new VM({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Uw({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Uw({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function Mg(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(YM);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function JM(t,e={}){typeof e.size<"u"&&ks(t,{size:e.size});const r=ui(t,e);return Zo(r,e)}function XM(t,e={}){let r=t;if(typeof e.size<"u"&&(ks(r,{size:e.size}),r=Lh(r)),r.length>1||r[0]>1)throw new HP(r);return!!r[0]}function po(t,e={}){typeof e.size<"u"&&ks(t,{size:e.size});const r=ui(t,e);return Qo(r,e)}function ZM(t,e={}){let r=t;return typeof e.size<"u"&&(ks(r,{size:e.size}),r=Lh(r,{dir:"right"})),new TextDecoder().decode(r)}function QM(t,e){const r=typeof e=="string"?lo(e):e,n=Mg(r);if(vn(r)===0&&t.length>0)throw new hg;if(vn(e)&&vn(e)<32)throw new OP({data:typeof e=="string"?e:ui(e),params:t,size:vn(e)});let i=0;const s=[];for(let o=0;o48?JM(i,{signed:r}):po(i,{signed:r}),32]}function sI(t,e,{staticPosition:r}){const n=e.components.length===0||e.components.some(({name:o})=>!o),i=n?[]:{};let s=0;if(Af(e)){const o=po(t.readBytes(Ig)),a=r+o;for(let u=0;uo.type==="error"&&n===Ag(zc(o)));if(!s)throw new aw(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?QM(s.inputs,qh(r,4)):void 0,errorName:s.name}}const qa=(t,e,r)=>JSON.stringify(t,(n,i)=>typeof i=="bigint"?i.toString():i,r);function zw({abiItem:t,args:e,includeFunctionName:r=!0,includeName:n=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${r?t.name:""}(${t.inputs.map((i,s)=>`${n&&i.name?`${i.name}: `:""}${typeof e[s]=="object"?qa(e[s]):e[s]}`).join(", ")})`}const cI={gwei:9,wei:18},uI={ether:-9,wei:9};function Hw(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}function Ww(t,e="wei"){return Hw(t,cI[e])}function ms(t,e="wei"){return Hw(t,uI[e])}class fI extends pt{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class lI extends pt{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function zh(t){const e=Object.entries(t).map(([n,i])=>i===void 0||i===!1?null:[n,i]).filter(Boolean),r=e.reduce((n,[i])=>Math.max(n,i.length),0);return e.map(([n,i])=>` ${`${n}:`.padEnd(r+1)} ${i}`).join(` +`),{name:"InvalidDefinitionTypeError"})}}class uw extends pt{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}class fw extends pt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}class lw extends pt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function Wc(t,{dir:e,size:r=32}={}){return typeof t=="string"?Xo(t,{dir:e,size:r}):zP(t,{dir:e,size:r})}function Xo(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new fw({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function zP(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new fw({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie)throw new WP({givenSize:vn(t),maxSize:e})}function Zo(t,e={}){const{signed:r}=e;e.size&&ks(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<e.toString(16).padStart(2,"0"));function kh(t,e={}){return typeof t=="number"||typeof t=="bigint"?dr(t,e):typeof t=="string"?Bh(t,e):typeof t=="boolean"?dw(t,e):ui(t,e)}function dw(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(ks(r,{size:e.size}),Wc(r,{size:e.size})):r}function ui(t,e={}){let r="";for(let i=0;is||i=fo.zero&&t<=fo.nine)return t-fo.zero;if(t>=fo.A&&t<=fo.F)return t-(fo.A-10);if(t>=fo.a&&t<=fo.f)return t-(fo.a-10)}function lo(t,e={}){let r=t;e.size&&(ks(r,{size:e.size}),r=Wc(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o>mw&$h)}:{h:Number(t>>mw&$h)|0,l:Number(t&$h)|0}}function ZP(t,e=!1){const r=t.length;let n=new Uint32Array(r),i=new Uint32Array(r);for(let s=0;st<>>32-r,eM=(t,e,r)=>e<>>32-r,tM=(t,e,r)=>e<>>64-r,rM=(t,e,r)=>t<>>64-r,Kc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function pg(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function wf(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function ps(t,...e){if(!pg(t))throw new Error("Uint8Array expected");e.length>0}function nM(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");wf(t.outputLen),wf(t.blockLen)}function Vc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function vw(t,e){ps(t);const r=e.outputLen;if(t.length>>e}const sM=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function oM(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function aM(t){for(let e=0;et:aM,yw=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",cM=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Yc(t){if(ps(t),yw)return t.toHex();let e="";for(let r=0;r=ho._0&&t<=ho._9)return t-ho._0;if(t>=ho.A&&t<=ho.F)return t-(ho.A-10);if(t>=ho.a&&t<=ho.f)return t-(ho.a-10)}function mg(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(yw)return Uint8Array.fromHex(t);const e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;it().update(xf(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function fM(t){const e=(n,i)=>t(i).update(xf(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function lM(t=32){if(Kc&&typeof Kc.getRandomValues=="function")return Kc.getRandomValues(new Uint8Array(t));if(Kc&&typeof Kc.randomBytes=="function")return Uint8Array.from(Kc.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}const hM=BigInt(0),_f=BigInt(1),dM=BigInt(2),pM=BigInt(7),gM=BigInt(256),mM=BigInt(113),_w=[],Ew=[],Sw=[];for(let t=0,e=_f,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],_w.push(2*(5*n+r)),Ew.push((t+1)*(t+2)/2%64);let i=hM;for(let s=0;s<7;s++)e=(e<<_f^(e>>pM)*mM)%gM,e&dM&&(i^=_f<<(_f<r>32?tM(t,e,r):QP(t,e,r),Mw=(t,e,r)=>r>32?rM(t,e,r):eM(t,e,r);function Iw(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,u=(o+2)%10,l=r[u],d=r[u+1],p=Pw(l,d,1)^r[a],y=Mw(l,d,1)^r[a+1];for(let _=0;_<50;_+=10)t[o+_]^=p,t[o+_+1]^=y}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=Ew[o],u=Pw(i,s,a),l=Mw(i,s,a),d=_w[o];i=t[d],s=t[d+1],t[d]=u,t[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=vM[n],t[1]^=bM[n]}Gc(r)}class Ef extends vg{constructor(e,r,n,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,wf(n),!(0=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return wf(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(vw(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Gc(this.state)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new Ef(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const ea=(t,e,r)=>xw(()=>new Ef(e,t,r)),yM=ea(6,144,224/8),wM=ea(6,136,256/8),xM=ea(6,104,384/8),_M=ea(6,72,512/8),EM=ea(1,144,224/8),Cw=ea(1,136,256/8),SM=ea(1,104,384/8),AM=ea(1,72,512/8),Tw=(t,e,r)=>fM((n={})=>new Ef(e,t,n.dkLen===void 0?r:n.dkLen,!0)),PM=Object.freeze(Object.defineProperty({__proto__:null,Keccak:Ef,keccakP:Iw,keccak_224:EM,keccak_256:Cw,keccak_384:SM,keccak_512:AM,sha3_224:yM,sha3_256:wM,sha3_384:xM,sha3_512:_M,shake128:Tw(31,168,128/8),shake256:Tw(31,136,256/8)},Symbol.toStringTag,{value:"Module"}));function Fh(t,e){const r=e||"hex",n=Cw(Jo(t,{strict:!1})?dg(t):t);return r==="bytes"?n:kh(n)}const MM=t=>Fh(dg(t));function IM(t){return MM(t)}function CM(t){let e=!0,r="",n=0,i="",s=!1;for(let o=0;o{const e=typeof t=="string"?t:TP(t);return CM(e)};function Rw(t){return IM(TM(t))}const RM=Rw;class ta extends pt{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class jh extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const bg=new jh(8192);function Sf(t,e){if(bg.has(`${t}.${e}`))return bg.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=Fh(gw(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return bg.set(`${t}.${e}`,s),s}function yg(t,e){if(!gs(t,{strict:!1}))throw new ta({address:t});return Sf(t,e)}const DM=/^0x[a-fA-F0-9]{40}$/,wg=new jh(8192);function gs(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(wg.has(n))return wg.get(n);const i=DM.test(t)?t.toLowerCase()===t?!0:r?Sf(t)===t:!0:!1;return wg.set(n,i),i}function ra(t){return typeof t[0]=="string"?Uh(t):OM(t)}function OM(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function Uh(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}function qh(t,e,r,{strict:n}={}){return Jo(t,{strict:!1})?xg(t,e,r,{strict:n}):Nw(t,e,r,{strict:n})}function Dw(t,e){if(typeof e=="number"&&e>0&&e>vn(t)-1)throw new uw({offset:e,position:"start",size:vn(t)})}function Ow(t,e,r){if(typeof e=="number"&&typeof r=="number"&&vn(t)!==r-e)throw new uw({offset:r,position:"end",size:vn(t)})}function Nw(t,e,r,{strict:n}={}){Dw(t,e);const i=t.slice(e,r);return n&&Ow(i,e,r),i}function xg(t,e,r,{strict:n}={}){Dw(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&Ow(i,e,r),i}const NM=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Lw=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function kw(t,e){if(t.length!==e.length)throw new kP({expectedLength:t.length,givenLength:e.length});const r=LM({params:t,values:e}),n=Eg(r);return n.length===0?"0x":n}function LM({params:t,values:e}){const r=[];for(let n=0;n0?ra([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:ra(s.map(({encoded:o})=>o))}}function $M(t,{param:e}){const[,r]=e.type.split("bytes"),n=vn(t);if(!r){let i=t;return n%32!==0&&(i=Xo(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:ra([Xo(dr(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new LP({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:Xo(t,{dir:"right"})}}function FM(t){if(typeof t!="boolean")throw new pt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Xo(dw(t))}}function jM(t,{signed:e,size:r=256}){if(typeof r=="number"){const n=2n**(BigInt(r)-(e?1n:0n))-1n,i=e?-n-1n:0n;if(t>n||ti))}}function Sg(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const Ag=t=>qh(Rw(t),0,4);function Bw(t){const{abi:e,args:r=[],name:n}=t,i=Jo(n,{strict:!1}),s=e.filter(a=>i?a.type==="function"?Ag(a)===n:a.type==="event"?RM(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((l,d)=>{const p="inputs"in a&&a.inputs[d];return p?Pg(l,p):!1})){if(o&&"inputs"in o&&o.inputs){const l=$w(a.inputs,o.inputs,r);if(l)throw new BP({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||s[0]}function Pg(t,e){const r=typeof t,n=e.type;switch(n){case"address":return gs(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>Pg(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>Pg(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function $w(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return $w(i.components,s.components,r[n]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?gs(r[n],{strict:!1}):o.includes("address")&&o.includes("bytes")?gs(r[n],{strict:!1}):!1)return o}}function fi(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const Fw="/docs/contract/encodeFunctionData";function zM(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=Bw({abi:e,args:r,name:n});if(!s)throw new cw(n,{docsPath:Fw});i=s}if(i.type!=="function")throw new cw(void 0,{docsPath:Fw});return{abi:[i],functionName:Ag(Hc(i))}}function jw(t){const{args:e}=t,{abi:r,functionName:n}=(()=>{var a;return t.abi.length===1&&((a=t.functionName)!=null&&a.startsWith("0x"))?t:zM(t)})(),i=r[0],s=n,o="inputs"in i&&i.inputs?kw(i.inputs,e??[]):void 0;return Uh([s,o??"0x"])}const HM={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},WM={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},KM={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Uw extends pt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class VM extends pt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class GM extends pt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const YM={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new GM({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new VM({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Uw({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Uw({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function Mg(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(YM);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function JM(t,e={}){typeof e.size<"u"&&ks(t,{size:e.size});const r=ui(t,e);return Zo(r,e)}function XM(t,e={}){let r=t;if(typeof e.size<"u"&&(ks(r,{size:e.size}),r=Lh(r)),r.length>1||r[0]>1)throw new HP(r);return!!r[0]}function po(t,e={}){typeof e.size<"u"&&ks(t,{size:e.size});const r=ui(t,e);return Qo(r,e)}function ZM(t,e={}){let r=t;return typeof e.size<"u"&&(ks(r,{size:e.size}),r=Lh(r,{dir:"right"})),new TextDecoder().decode(r)}function QM(t,e){const r=typeof e=="string"?lo(e):e,n=Mg(r);if(vn(r)===0&&t.length>0)throw new hg;if(vn(e)&&vn(e)<32)throw new OP({data:typeof e=="string"?e:ui(e),params:t,size:vn(e)});let i=0;const s=[];for(let o=0;o48?JM(i,{signed:r}):po(i,{signed:r}),32]}function sI(t,e,{staticPosition:r}){const n=e.components.length===0||e.components.some(({name:o})=>!o),i=n?[]:{};let s=0;if(Af(e)){const o=po(t.readBytes(Ig)),a=r+o;for(let u=0;uo.type==="error"&&n===Ag(Hc(o)));if(!s)throw new aw(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?QM(s.inputs,qh(r,4)):void 0,errorName:s.name}}const qa=(t,e,r)=>JSON.stringify(t,(n,i)=>typeof i=="bigint"?i.toString():i,r);function zw({abiItem:t,args:e,includeFunctionName:r=!0,includeName:n=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${r?t.name:""}(${t.inputs.map((i,s)=>`${n&&i.name?`${i.name}: `:""}${typeof e[s]=="object"?qa(e[s]):e[s]}`).join(", ")})`}const cI={gwei:9,wei:18},uI={ether:-9,wei:9};function Hw(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}function Ww(t,e="wei"){return Hw(t,cI[e])}function ms(t,e="wei"){return Hw(t,uI[e])}class fI extends pt{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class lI extends pt{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function zh(t){const e=Object.entries(t).map(([n,i])=>i===void 0||i===!1?null:[n,i]).filter(Boolean),r=e.reduce((n,[i])=>Math.max(n,i.length),0);return e.map(([n,i])=>` ${`${n}:`.padEnd(r+1)} ${i}`).join(` `)}class hI extends pt{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(` -`),{name:"FeeConflictError"})}}class dI extends pt{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",zh(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class pI extends pt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var M;const _=zh({chain:i&&`${i==null?void 0:i.name} (id: ${i==null?void 0:i.id})`,from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Ww(y)} ${((M=i==null?void 0:i.nativeCurrency)==null?void 0:M.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${ms(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${ms(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ms(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",_].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const gI=t=>t,Kw=t=>t;class mI extends pt{constructor(e,{abi:r,args:n,contractAddress:i,docsPath:s,functionName:o,sender:a}){const u=Bw({abi:r,args:n,name:o}),l=u?zw({abiItem:u,args:n,includeFunctionName:!1,includeName:!1}):void 0,d=u?zc(u,{includeName:!0}):void 0,p=zh({address:i&&gI(i),function:d,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:s,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],p&&"Contract Call:",p].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=e,this.contractAddress=i,this.functionName=o,this.sender=a}}class vI extends pt{constructor({abi:e,data:r,functionName:n,message:i}){let s,o,a,u;if(r&&r!=="0x")try{o=aI({abi:e,data:r});const{abiItem:d,errorName:p,args:y}=o;if(p==="Error")u=y[0];else if(p==="Panic"){const[_]=y;u=HM[_]}else{const _=d?zc(d,{includeName:!0}):void 0,M=d&&y?zw({abiItem:d,args:y,includeFunctionName:!1,includeName:!1}):void 0;a=[_?`Error: ${_}`:"",M&&M!=="()"?` ${[...Array((p==null?void 0:p.length)??0).keys()].map(()=>" ").join("")}${M}`:""]}}catch(d){s=d}else i&&(u=i);let l;s instanceof aw&&(l=s.signature,a=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(u&&u!=="execution reverted"||l?[`The contract function "${n}" reverted with the following ${l?"signature":"reason"}:`,u||l].join(` +`),{name:"FeeConflictError"})}}class dI extends pt{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",zh(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class pI extends pt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var M;const _=zh({chain:i&&`${i==null?void 0:i.name} (id: ${i==null?void 0:i.id})`,from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Ww(y)} ${((M=i==null?void 0:i.nativeCurrency)==null?void 0:M.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${ms(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${ms(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ms(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",_].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const gI=t=>t,Kw=t=>t;class mI extends pt{constructor(e,{abi:r,args:n,contractAddress:i,docsPath:s,functionName:o,sender:a}){const u=Bw({abi:r,args:n,name:o}),l=u?zw({abiItem:u,args:n,includeFunctionName:!1,includeName:!1}):void 0,d=u?Hc(u,{includeName:!0}):void 0,p=zh({address:i&&gI(i),function:d,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:s,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],p&&"Contract Call:",p].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=e,this.contractAddress=i,this.functionName=o,this.sender=a}}class vI extends pt{constructor({abi:e,data:r,functionName:n,message:i}){let s,o,a,u;if(r&&r!=="0x")try{o=aI({abi:e,data:r});const{abiItem:d,errorName:p,args:y}=o;if(p==="Error")u=y[0];else if(p==="Panic"){const[_]=y;u=HM[_]}else{const _=d?Hc(d,{includeName:!0}):void 0,M=d&&y?zw({abiItem:d,args:y,includeFunctionName:!1,includeName:!1}):void 0;a=[_?`Error: ${_}`:"",M&&M!=="()"?` ${[...Array((p==null?void 0:p.length)??0).keys()].map(()=>" ").join("")}${M}`:""]}}catch(d){s=d}else i&&(u=i);let l;s instanceof aw&&(l=s.signature,a=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(u&&u!=="execution reverted"||l?[`The contract function "${n}" reverted with the following ${l?"signature":"reason"}:`,u||l].join(` `):`The contract function "${n}" reverted.`,{cause:s,metaMessages:a,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.raw=r,this.reason=u,this.signature=l}}class bI extends pt{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class yI extends pt{constructor({data:e,message:r}){super(r||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}class Vw extends pt{constructor({body:e,cause:r,details:n,headers:i,status:s,url:o}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${Kw(o)}`,e&&`Request body: ${qa(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=i,this.status=s,this.url=o}}class Gw extends pt{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${Kw(n)}`,`Request body: ${qa(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code,this.data=r.data}}const wI=-1;class li extends pt{constructor(e,{code:r,docsPath:n,metaMessages:i,name:s,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:i||(e==null?void 0:e.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||e.name,this.code=e instanceof Gw?e.code:r??wI}}class Pi extends li{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class Pf extends li{constructor(e){super(e,{code:Pf.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Pf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Mf extends li{constructor(e){super(e,{code:Mf.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Mf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class If extends li{constructor(e,{method:r}={}){super(e,{code:If.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(If,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Cf extends li{constructor(e){super(e,{code:Cf.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` `)})}}Object.defineProperty(Cf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class za extends li{constructor(e){super(e,{code:za.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(za,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Tf extends li{constructor(e){super(e,{code:Tf.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` -`)})}}Object.defineProperty(Tf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Rf extends li{constructor(e){super(e,{code:Rf.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Rf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Df extends li{constructor(e){super(e,{code:Df.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Df,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Of extends li{constructor(e){super(e,{code:Of.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Of,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Ha extends li{constructor(e,{method:r}={}){super(e,{code:Ha.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not supported.`})}}Object.defineProperty(Ha,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Jc extends li{constructor(e){super(e,{code:Jc.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Jc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Nf extends li{constructor(e){super(e,{code:Nf.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Nf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Xc extends Pi{constructor(e){super(e,{code:Xc.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Xc,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Lf extends Pi{constructor(e){super(e,{code:Lf.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Lf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class kf extends Pi{constructor(e,{method:r}={}){super(e,{code:kf.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(kf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Bf extends Pi{constructor(e){super(e,{code:Bf.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Bf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class $f extends Pi{constructor(e){super(e,{code:$f.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty($f,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Ff extends Pi{constructor(e){super(e,{code:Ff.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Ff,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class Zc extends Pi{constructor(e){super(e,{code:Zc.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(Zc,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class jf extends Pi{constructor(e){super(e,{code:jf.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(jf,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class Uf extends Pi{constructor(e){super(e,{code:Uf.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(Uf,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class qf extends Pi{constructor(e){super(e,{code:qf.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(qf,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class zf extends Pi{constructor(e){super(e,{code:zf.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(zf,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class Hf extends Pi{constructor(e){super(e,{code:Hf.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(Hf,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class Qc extends Pi{constructor(e){super(e,{code:Qc.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(Qc,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class xI extends li{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const _I=3;function EI(t,{abi:e,address:r,args:n,docsPath:i,functionName:s,sender:o}){const a=t instanceof yI?t:t instanceof pt?t.walk(M=>"data"in M)||t.walk():{},{code:u,data:l,details:d,message:p,shortMessage:y}=a,_=t instanceof hg?new bI({functionName:s}):[_I,za.code].includes(u)&&(l||d||p||y)?new vI({abi:e,data:typeof l=="object"?l.data:l,functionName:s,message:a instanceof Gw?d:y??p}):t;return new mI(_,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:o})}function SI(t){const e=Fh(`0x${t.substring(4)}`).substring(26);return Sf(`0x${e}`)}async function AI({hash:t,signature:e}){const r=Jo(t)?t:kh(t),{secp256k1:n}=await Promise.resolve().then(()=>pT);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:d,v:p,yParity:y}=e,_=Number(y??p),M=Yw(_);return new n.Signature(Zo(l),Zo(d)).addRecoveryBit(M)}const o=Jo(e)?e:kh(e);if(vn(o)!==65)throw new Error("invalid signature length");const a=Qo(`0x${o.slice(130)}`),u=Yw(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Yw(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function PI({hash:t,signature:e}){return SI(await AI({hash:t,signature:e}))}function MI(t,e="hex"){const r=Jw(t),n=Mg(new Uint8Array(r.length));return r.encode(n),e==="hex"?ui(n.bytes):n.bytes}function Jw(t){return Array.isArray(t)?II(t.map(e=>Jw(e))):CI(t)}function II(t){const e=t.reduce((i,s)=>i+s.length,0),r=Xw(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function CI(t){const e=typeof t=="string"?lo(t):t,r=Xw(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function Xw(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new pt("Length is too large.")}function TI(t){const{chainId:e,nonce:r,to:n}=t,i=t.contractAddress??t.address,s=Fh(Uh(["0x05",MI([e?dr(e):"0x",i,r?dr(r):"0x"])]));return n==="bytes"?lo(s):s}async function Zw(t){const{authorization:e,signature:r}=t;return PI({hash:TI(e),signature:r??e})}class RI extends pt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var M;const _=zh({from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Ww(y)} ${((M=i==null?void 0:i.nativeCurrency)==null?void 0:M.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${ms(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${ms(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ms(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",_].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class eu extends pt{constructor({cause:e,message:r}={}){var i;const n=(i=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(eu,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(eu,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Hh extends pt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${ms(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(Hh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class Cg extends pt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${ms(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(Cg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class Tg extends pt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(Tg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Rg extends pt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` +`)})}}Object.defineProperty(Tf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Rf extends li{constructor(e){super(e,{code:Rf.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Rf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Df extends li{constructor(e){super(e,{code:Df.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Df,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Of extends li{constructor(e){super(e,{code:Of.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Of,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Ha extends li{constructor(e,{method:r}={}){super(e,{code:Ha.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not supported.`})}}Object.defineProperty(Ha,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Xc extends li{constructor(e){super(e,{code:Xc.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Xc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Nf extends li{constructor(e){super(e,{code:Nf.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Nf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Zc extends Pi{constructor(e){super(e,{code:Zc.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Zc,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Lf extends Pi{constructor(e){super(e,{code:Lf.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Lf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class kf extends Pi{constructor(e,{method:r}={}){super(e,{code:kf.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(kf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Bf extends Pi{constructor(e){super(e,{code:Bf.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Bf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class $f extends Pi{constructor(e){super(e,{code:$f.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty($f,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Ff extends Pi{constructor(e){super(e,{code:Ff.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Ff,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class Qc extends Pi{constructor(e){super(e,{code:Qc.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(Qc,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class jf extends Pi{constructor(e){super(e,{code:jf.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(jf,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class Uf extends Pi{constructor(e){super(e,{code:Uf.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(Uf,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class qf extends Pi{constructor(e){super(e,{code:qf.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(qf,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class zf extends Pi{constructor(e){super(e,{code:zf.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(zf,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class Hf extends Pi{constructor(e){super(e,{code:Hf.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(Hf,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class eu extends Pi{constructor(e){super(e,{code:eu.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(eu,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class xI extends li{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const _I=3;function EI(t,{abi:e,address:r,args:n,docsPath:i,functionName:s,sender:o}){const a=t instanceof yI?t:t instanceof pt?t.walk(M=>"data"in M)||t.walk():{},{code:u,data:l,details:d,message:p,shortMessage:y}=a,_=t instanceof hg?new bI({functionName:s}):[_I,za.code].includes(u)&&(l||d||p||y)?new vI({abi:e,data:typeof l=="object"?l.data:l,functionName:s,message:a instanceof Gw?d:y??p}):t;return new mI(_,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:o})}function SI(t){const e=Fh(`0x${t.substring(4)}`).substring(26);return Sf(`0x${e}`)}async function AI({hash:t,signature:e}){const r=Jo(t)?t:kh(t),{secp256k1:n}=await Promise.resolve().then(()=>gT);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:d,v:p,yParity:y}=e,_=Number(y??p),M=Yw(_);return new n.Signature(Zo(l),Zo(d)).addRecoveryBit(M)}const o=Jo(e)?e:kh(e);if(vn(o)!==65)throw new Error("invalid signature length");const a=Qo(`0x${o.slice(130)}`),u=Yw(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Yw(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function PI({hash:t,signature:e}){return SI(await AI({hash:t,signature:e}))}function MI(t,e="hex"){const r=Jw(t),n=Mg(new Uint8Array(r.length));return r.encode(n),e==="hex"?ui(n.bytes):n.bytes}function Jw(t){return Array.isArray(t)?II(t.map(e=>Jw(e))):CI(t)}function II(t){const e=t.reduce((i,s)=>i+s.length,0),r=Xw(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function CI(t){const e=typeof t=="string"?lo(t):t,r=Xw(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function Xw(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new pt("Length is too large.")}function TI(t){const{chainId:e,nonce:r,to:n}=t,i=t.contractAddress??t.address,s=Fh(Uh(["0x05",MI([e?dr(e):"0x",i,r?dr(r):"0x"])]));return n==="bytes"?lo(s):s}async function Zw(t){const{authorization:e,signature:r}=t;return PI({hash:TI(e),signature:r??e})}class RI extends pt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var M;const _=zh({from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Ww(y)} ${((M=i==null?void 0:i.nativeCurrency)==null?void 0:M.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${ms(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${ms(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ms(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",_].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class tu extends pt{constructor({cause:e,message:r}={}){var i;const n=(i=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(tu,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(tu,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Hh extends pt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${ms(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(Hh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class Cg extends pt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${ms(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(Cg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class Tg extends pt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(Tg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Rg extends pt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` `),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(Rg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Dg extends pt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(Dg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Og extends pt{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` `),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(Og,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Ng extends pt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(Ng,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Lg extends pt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(Lg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class kg extends pt{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(kg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Wh extends pt{constructor({cause:e,maxPriorityFeePerGas:r,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${r?` = ${ms(r)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${ms(n)} gwei`:""}).`].join(` -`),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(Wh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Bg extends pt{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function Qw(t,e){const r=(t.details||"").toLowerCase(),n=t instanceof pt?t.walk(i=>(i==null?void 0:i.code)===eu.code):t;return n instanceof pt?new eu({cause:t,message:n.details}):eu.nodeMessage.test(r)?new eu({cause:t,message:t.details}):Hh.nodeMessage.test(r)?new Hh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):Cg.nodeMessage.test(r)?new Cg({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):Tg.nodeMessage.test(r)?new Tg({cause:t,nonce:e==null?void 0:e.nonce}):Rg.nodeMessage.test(r)?new Rg({cause:t,nonce:e==null?void 0:e.nonce}):Dg.nodeMessage.test(r)?new Dg({cause:t,nonce:e==null?void 0:e.nonce}):Og.nodeMessage.test(r)?new Og({cause:t}):Ng.nodeMessage.test(r)?new Ng({cause:t,gas:e==null?void 0:e.gas}):Lg.nodeMessage.test(r)?new Lg({cause:t,gas:e==null?void 0:e.gas}):kg.nodeMessage.test(r)?new kg({cause:t}):Wh.nodeMessage.test(r)?new Wh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new Bg({cause:t})}function DI(t,{docsPath:e,...r}){const n=(()=>{const i=Qw(t,r);return i instanceof Bg?t:i})();return new RI(n,{docsPath:e,...r})}function e2(t,{format:e}){if(!e)return{};const r={};function n(s){const o=Object.keys(s);for(const a of o)a in t&&(r[a]=t[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}const i=e(t||{});return n(i),r}const OI={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function $g(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=NI(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(r=>ui(r)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=dr(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=dr(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=dr(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=dr(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=dr(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=dr(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=OI[t.type]),typeof t.value<"u"&&(e.value=dr(t.value)),e}function NI(t){return t.map(e=>({address:e.address,r:e.r?dr(BigInt(e.r)):e.r,s:e.s?dr(BigInt(e.s)):e.s,chainId:dr(e.chainId),nonce:dr(e.nonce),...typeof e.yParity<"u"?{yParity:dr(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:dr(e.v)}:{}}))}function t2(t){if(!(!t||t.length===0))return t.reduce((e,{slot:r,value:n})=>{if(r.length!==66)throw new lw({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new lw({size:n.length,targetSize:66,type:"hex"});return e[r]=n,e},{})}function LI(t){const{balance:e,nonce:r,state:n,stateDiff:i,code:s}=t,o={};if(s!==void 0&&(o.code=s),e!==void 0&&(o.balance=dr(e)),r!==void 0&&(o.nonce=dr(r)),n!==void 0&&(o.state=t2(n)),i!==void 0){if(o.state)throw new lI;o.stateDiff=t2(i)}return o}function kI(t){if(!t)return;const e={};for(const{address:r,...n}of t){if(!gs(r,{strict:!1}))throw new ta({address:r});if(e[r])throw new fI({address:r});e[r]=LI(n)}return e}const BI=2n**256n-1n;function Kh(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?fi(e):void 0;if(o&&!gs(o.address))throw new ta({address:o.address});if(s&&!gs(s))throw new ta({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new hI;if(n&&n>BI)throw new Hh({maxFeePerGas:n});if(i&&n&&i>n)throw new Wh({maxFeePerGas:n,maxPriorityFeePerGas:i})}class $I extends pt{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Fg extends pt{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class FI extends pt{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${ms(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class jI extends pt{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}const UI={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function qI(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?Qo(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?Qo(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?UI[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=zI(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function zI(t){return t.map(e=>({address:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function HI(t){const e=(t.transactions??[]).map(r=>typeof r=="string"?r:qI(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function Vh(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){var d,p,y;const s=n??"latest",o=i??!1,a=r!==void 0?dr(r):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,o]},{dedupe:!0}):u=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]},{dedupe:!!a}),!u)throw new jI({blockHash:e,blockNumber:r});return(((y=(p=(d=t.chain)==null?void 0:d.formatters)==null?void 0:p.block)==null?void 0:y.format)||HI)(u)}async function r2(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function WI(t,e){var s,o;const{block:r,chain:n=t.chain,request:i}=e||{};try{const a=((s=n==null?void 0:n.fees)==null?void 0:s.maxPriorityFeePerGas)??((o=n==null?void 0:n.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=r||await Wn(t,Vh,"getBlock")({}),d=await a({block:l,client:t,request:i});if(d===null)throw new Error;return d}if(typeof a<"u")return a;const u=await t.request({method:"eth_maxPriorityFeePerGas"});return Zo(u)}catch{const[a,u]=await Promise.all([r?Promise.resolve(r):Wn(t,Vh,"getBlock")({}),Wn(t,r2,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new Fg;const l=u-a.baseFeePerGas;return l<0n?0n:l}}async function n2(t,e){var y,_;const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>{var M,O;return typeof((M=n==null?void 0:n.fees)==null?void 0:M.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):((O=n==null?void 0:n.fees)==null?void 0:O.baseFeeMultiplier)??1.2})();if(o<1)throw new $I;const u=10**(((y=o.toString().split(".")[1])==null?void 0:y.length)??0),l=M=>M*BigInt(Math.ceil(o*u))/BigInt(u),d=r||await Wn(t,Vh,"getBlock")({});if(typeof((_=n==null?void 0:n.fees)==null?void 0:_.estimateFeesPerGas)=="function"){const M=await n.fees.estimateFeesPerGas({block:r,client:t,multiply:l,request:i,type:s});if(M!==null)return M}if(s==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new Fg;const M=typeof(i==null?void 0:i.maxPriorityFeePerGas)=="bigint"?i.maxPriorityFeePerGas:await WI(t,{block:d,chain:n,request:i}),O=l(d.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??O+M,maxPriorityFeePerGas:M}}return{gasPrice:(i==null?void 0:i.gasPrice)??l(await Wn(t,r2,"getGasPrice")({}))}}async function i2(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,typeof n=="bigint"?dr(n):r]},{dedupe:!!n});return Qo(i)}function s2(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(s=>lo(s)):t.blobs,i=[];for(const s of n)i.push(Uint8Array.from(e.blobToKzgCommitment(s)));return r==="bytes"?i:i.map(s=>ui(s))}function o2(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>lo(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>lo(o)):t.commitments,s=[];for(let o=0;oui(o))}function KI(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),u=n?4:0,l=n?0:4;t.setUint32(e+u,o,n),t.setUint32(e+l,a,n)}function VI(t,e,r){return t&e^~t&r}function GI(t,e,r){return t&e^t&r^e&r}class YI extends vg{constructor(e,r,n,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(e),this.view=gg(this.buffer)}update(e){Kc(this),e=xf(e),ps(e);const{view:r,buffer:n,blockLen:i}=this,s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let p=o;pd.length)throw new Error("_sha2: outputLen bigger than state");for(let p=0;p>>3,O=Bs(_,17)^Bs(_,19)^_>>>10;ia[p]=O+ia[p-7]+M+ia[p-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:u,G:l,H:d}=this;for(let p=0;p<64;p++){const y=Bs(a,6)^Bs(a,11)^Bs(a,25),_=d+y+VI(a,u,l)+JI[p]+ia[p]|0,O=(Bs(n,2)^Bs(n,13)^Bs(n,22))+GI(n,i,s)|0;d=l,l=u,u=a,a=o+_|0,o=s,s=i,i=n,n=_+O|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(n,i,s,o,a,u,l,d)}roundClean(){Vc(ia)}destroy(){this.set(0,0,0,0,0,0,0,0),Vc(this.buffer)}};const a2=xw(()=>new XI),c2=a2;function ZI(t,e){return c2(Jo(t,{strict:!1})?dg(t):t)}function QI(t){const{commitment:e,version:r=1}=t,n=t.to??(typeof e=="string"?"hex":"bytes"),i=ZI(e);return i.set([r],0),n==="bytes"?i:ui(i)}function eC(t){const{commitments:e,version:r}=t,n=t.to??(typeof e[0]=="string"?"hex":"bytes"),i=[];for(const s of e)i.push(QI({commitment:s,to:n,version:r}));return i}const u2=6,f2=32,jg=4096,l2=f2*jg,h2=l2*u2-1-1*jg*u2;class tC extends pt{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class rC extends pt{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function nC(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),r=typeof t.data=="string"?lo(t.data):t.data,n=vn(r);if(!n)throw new rC;if(n>h2)throw new tC({maxSize:h2,size:n});const i=[];let s=!0,o=0;for(;s;){const a=Mg(new Uint8Array(l2));let u=0;for(;ua.bytes):i.map(a=>ui(a.bytes))}function iC(t){const{data:e,kzg:r,to:n}=t,i=t.blobs??nC({data:e,to:n}),s=t.commitments??s2({blobs:i,kzg:r,to:n}),o=t.proofs??o2({blobs:i,commitments:s,kzg:r,to:n}),a=[];for(let u=0;u"u"&&p)if(u){const B=await L();y.nonce=await u.consume({address:p.address,chainId:B,client:t})}else y.nonce=await Wn(t,i2,"getTransactionCount")({address:p.address,blockTag:"pending"});if((l.includes("blobVersionedHashes")||l.includes("sidecars"))&&n&&o){const B=s2({blobs:n,kzg:o});if(l.includes("blobVersionedHashes")){const k=eC({commitments:B,to:"hex"});y.blobVersionedHashes=k}if(l.includes("sidecars")){const k=o2({blobs:n,commitments:B,kzg:o}),H=iC({blobs:n,commitments:B,proofs:k,to:"hex"});y.sidecars=H}}if(l.includes("chainId")&&(y.chainId=await L()),(l.includes("fees")||l.includes("type"))&&typeof d>"u")try{y.type=sC(y)}catch{let B=p2.get(t.uid);if(typeof B>"u"){const k=await M();B=typeof(k==null?void 0:k.baseFeePerGas)=="bigint",p2.set(t.uid,B)}y.type=B?"eip1559":"legacy"}if(l.includes("fees"))if(y.type!=="legacy"&&y.type!=="eip2930"){if(typeof y.maxFeePerGas>"u"||typeof y.maxPriorityFeePerGas>"u"){const B=await M(),{maxFeePerGas:k,maxPriorityFeePerGas:H}=await n2(t,{block:B,chain:i,request:y});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"){const B=await M(),{gasPrice:k}=await n2(t,{block:B,chain:i,request:y,type:"legacy"});y.gasPrice=k}}return l.includes("gas")&&typeof s>"u"&&(y.gas=await Wn(t,aC,"estimateGas")({...y,account:p&&{address:p.address,type:"json-rpc"}})),Kh(y),delete y.parameters,y}async function oC(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=typeof r=="bigint"?dr(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function aC(t,e){var i,s,o;const{account:r=t.account}=e,n=r?fi(r):void 0;try{let f=function(v){const{block:x,request:S,rpcStateOverride:A}=v;return t.request({method:"eth_estimateGas",params:A?[S,x??"latest",A]:x?[S,x]:[S]})};const{accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,blockNumber:p,blockTag:y,data:_,gas:M,gasPrice:O,maxFeePerBlobGas:L,maxFeePerGas:B,maxPriorityFeePerGas:k,nonce:H,value:U,stateOverride:z,...Z}=await Ug(t,{...e,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),W=(typeof p=="bigint"?dr(p):void 0)||y,ie=kI(z),me=await(async()=>{if(Z.to)return Z.to;if(u&&u.length>0)return await Zw({authorization:u[0]}).catch(()=>{throw new pt("`to` is required. Could not infer from `authorizationList`")})})();Kh(e);const j=(o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:o.format,m=(j||$g)({...e2(Z,{format:j}),from:n==null?void 0:n.address,accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,data:_,gas:M,gasPrice:O,maxFeePerBlobGas:L,maxFeePerGas:B,maxPriorityFeePerGas:k,nonce:H,to:me,value:U});let g=BigInt(await f({block:W,request:m,rpcStateOverride:ie}));if(u){const v=await oC(t,{address:m.from}),x=await Promise.all(u.map(async S=>{const{address:A}=S,b=await f({block:W,request:{authorizationList:void 0,data:_,from:n==null?void 0:n.address,to:A,value:dr(v)},rpcStateOverride:ie}).catch(()=>100000n);return 2n*BigInt(b)}));g+=x.reduce((S,A)=>S+A,0n)}return g}catch(a){throw DI(a,{...e,account:n,chain:t.chain})}}function cC(t,e){if(!gs(t,{strict:!1}))throw new ta({address:t});if(!gs(e,{strict:!1}))throw new ta({address:e});return t.toLowerCase()===e.toLowerCase()}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const qg=BigInt(0),zg=BigInt(1);function Gh(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}function Yh(t){const e=t.toString(16);return e.length&1?"0"+e:e}function g2(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?qg:BigInt("0x"+t)}function Jh(t){return g2(Gc(t))}function m2(t){return ps(t),g2(Gc(Uint8Array.from(t).reverse()))}function Hg(t,e){return mg(t.toString(16).padStart(e*2,"0"))}function v2(t,e){return Hg(t,e).reverse()}function Ui(t,e,r){let n;if(typeof e=="string")try{n=mg(e)}catch(s){throw new Error(t+" must be hex string or Uint8Array, cause: "+s)}else if(pg(e))n=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const i=n.length;if(typeof r=="number"&&i!==r)throw new Error(t+" of length "+r+" expected, got "+i);return n}const Wg=t=>typeof t=="bigint"&&qg<=t;function uC(t,e,r){return Wg(t)&&Wg(e)&&Wg(r)&&e<=t&&tqg;t>>=zg,e+=1);return e}const Xh=t=>(zg<new Uint8Array(_),i=_=>Uint8Array.of(_);let s=n(t),o=n(t),a=0;const u=()=>{s.fill(1),o.fill(0),a=0},l=(..._)=>r(o,s,..._),d=(_=n(0))=>{o=l(i(0),_),s=l(),_.length!==0&&(o=l(i(1),_),s=l())},p=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let _=0;const M=[];for(;_{u(),d(_);let O;for(;!(O=M(p()));)d();return u(),O}}function Kg(t,e,r={}){if(!t||typeof t!="object")throw new Error("expected valid options object");function n(i,s,o){const a=t[i];if(o&&a===void 0)return;const u=typeof a;if(u!==s||a===null)throw new Error(`param "${i}" is invalid: expected ${s}, got ${u}`)}Object.entries(e).forEach(([i,s])=>n(i,s,!1)),Object.entries(r).forEach(([i,s])=>n(i,s,!0))}function b2(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}class dC extends pt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class pC extends pt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` +`),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(Wh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Bg extends pt{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function Qw(t,e){const r=(t.details||"").toLowerCase(),n=t instanceof pt?t.walk(i=>(i==null?void 0:i.code)===tu.code):t;return n instanceof pt?new tu({cause:t,message:n.details}):tu.nodeMessage.test(r)?new tu({cause:t,message:t.details}):Hh.nodeMessage.test(r)?new Hh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):Cg.nodeMessage.test(r)?new Cg({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):Tg.nodeMessage.test(r)?new Tg({cause:t,nonce:e==null?void 0:e.nonce}):Rg.nodeMessage.test(r)?new Rg({cause:t,nonce:e==null?void 0:e.nonce}):Dg.nodeMessage.test(r)?new Dg({cause:t,nonce:e==null?void 0:e.nonce}):Og.nodeMessage.test(r)?new Og({cause:t}):Ng.nodeMessage.test(r)?new Ng({cause:t,gas:e==null?void 0:e.gas}):Lg.nodeMessage.test(r)?new Lg({cause:t,gas:e==null?void 0:e.gas}):kg.nodeMessage.test(r)?new kg({cause:t}):Wh.nodeMessage.test(r)?new Wh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new Bg({cause:t})}function DI(t,{docsPath:e,...r}){const n=(()=>{const i=Qw(t,r);return i instanceof Bg?t:i})();return new RI(n,{docsPath:e,...r})}function e2(t,{format:e}){if(!e)return{};const r={};function n(s){const o=Object.keys(s);for(const a of o)a in t&&(r[a]=t[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}const i=e(t||{});return n(i),r}const OI={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function $g(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=NI(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(r=>ui(r)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=dr(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=dr(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=dr(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=dr(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=dr(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=dr(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=OI[t.type]),typeof t.value<"u"&&(e.value=dr(t.value)),e}function NI(t){return t.map(e=>({address:e.address,r:e.r?dr(BigInt(e.r)):e.r,s:e.s?dr(BigInt(e.s)):e.s,chainId:dr(e.chainId),nonce:dr(e.nonce),...typeof e.yParity<"u"?{yParity:dr(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:dr(e.v)}:{}}))}function t2(t){if(!(!t||t.length===0))return t.reduce((e,{slot:r,value:n})=>{if(r.length!==66)throw new lw({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new lw({size:n.length,targetSize:66,type:"hex"});return e[r]=n,e},{})}function LI(t){const{balance:e,nonce:r,state:n,stateDiff:i,code:s}=t,o={};if(s!==void 0&&(o.code=s),e!==void 0&&(o.balance=dr(e)),r!==void 0&&(o.nonce=dr(r)),n!==void 0&&(o.state=t2(n)),i!==void 0){if(o.state)throw new lI;o.stateDiff=t2(i)}return o}function kI(t){if(!t)return;const e={};for(const{address:r,...n}of t){if(!gs(r,{strict:!1}))throw new ta({address:r});if(e[r])throw new fI({address:r});e[r]=LI(n)}return e}const BI=2n**256n-1n;function Kh(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?fi(e):void 0;if(o&&!gs(o.address))throw new ta({address:o.address});if(s&&!gs(s))throw new ta({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new hI;if(n&&n>BI)throw new Hh({maxFeePerGas:n});if(i&&n&&i>n)throw new Wh({maxFeePerGas:n,maxPriorityFeePerGas:i})}class $I extends pt{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Fg extends pt{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class FI extends pt{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${ms(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class jI extends pt{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}const UI={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function qI(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?Qo(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?Qo(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?UI[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=zI(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function zI(t){return t.map(e=>({address:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function HI(t){const e=(t.transactions??[]).map(r=>typeof r=="string"?r:qI(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function Vh(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){var d,p,y;const s=n??"latest",o=i??!1,a=r!==void 0?dr(r):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,o]},{dedupe:!0}):u=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]},{dedupe:!!a}),!u)throw new jI({blockHash:e,blockNumber:r});return(((y=(p=(d=t.chain)==null?void 0:d.formatters)==null?void 0:p.block)==null?void 0:y.format)||HI)(u)}async function r2(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function WI(t,e){var s,o;const{block:r,chain:n=t.chain,request:i}=e||{};try{const a=((s=n==null?void 0:n.fees)==null?void 0:s.maxPriorityFeePerGas)??((o=n==null?void 0:n.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=r||await Wn(t,Vh,"getBlock")({}),d=await a({block:l,client:t,request:i});if(d===null)throw new Error;return d}if(typeof a<"u")return a;const u=await t.request({method:"eth_maxPriorityFeePerGas"});return Zo(u)}catch{const[a,u]=await Promise.all([r?Promise.resolve(r):Wn(t,Vh,"getBlock")({}),Wn(t,r2,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new Fg;const l=u-a.baseFeePerGas;return l<0n?0n:l}}async function n2(t,e){var y,_;const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>{var M,O;return typeof((M=n==null?void 0:n.fees)==null?void 0:M.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):((O=n==null?void 0:n.fees)==null?void 0:O.baseFeeMultiplier)??1.2})();if(o<1)throw new $I;const u=10**(((y=o.toString().split(".")[1])==null?void 0:y.length)??0),l=M=>M*BigInt(Math.ceil(o*u))/BigInt(u),d=r||await Wn(t,Vh,"getBlock")({});if(typeof((_=n==null?void 0:n.fees)==null?void 0:_.estimateFeesPerGas)=="function"){const M=await n.fees.estimateFeesPerGas({block:r,client:t,multiply:l,request:i,type:s});if(M!==null)return M}if(s==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new Fg;const M=typeof(i==null?void 0:i.maxPriorityFeePerGas)=="bigint"?i.maxPriorityFeePerGas:await WI(t,{block:d,chain:n,request:i}),O=l(d.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??O+M,maxPriorityFeePerGas:M}}return{gasPrice:(i==null?void 0:i.gasPrice)??l(await Wn(t,r2,"getGasPrice")({}))}}async function i2(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,typeof n=="bigint"?dr(n):r]},{dedupe:!!n});return Qo(i)}function s2(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(s=>lo(s)):t.blobs,i=[];for(const s of n)i.push(Uint8Array.from(e.blobToKzgCommitment(s)));return r==="bytes"?i:i.map(s=>ui(s))}function o2(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>lo(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>lo(o)):t.commitments,s=[];for(let o=0;oui(o))}function KI(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),u=n?4:0,l=n?0:4;t.setUint32(e+u,o,n),t.setUint32(e+l,a,n)}function VI(t,e,r){return t&e^~t&r}function GI(t,e,r){return t&e^t&r^e&r}class YI extends vg{constructor(e,r,n,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(e),this.view=gg(this.buffer)}update(e){Vc(this),e=xf(e),ps(e);const{view:r,buffer:n,blockLen:i}=this,s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let p=o;pd.length)throw new Error("_sha2: outputLen bigger than state");for(let p=0;p>>3,O=Bs(_,17)^Bs(_,19)^_>>>10;ia[p]=O+ia[p-7]+M+ia[p-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:u,G:l,H:d}=this;for(let p=0;p<64;p++){const y=Bs(a,6)^Bs(a,11)^Bs(a,25),_=d+y+VI(a,u,l)+JI[p]+ia[p]|0,O=(Bs(n,2)^Bs(n,13)^Bs(n,22))+GI(n,i,s)|0;d=l,l=u,u=a,a=o+_|0,o=s,s=i,i=n,n=_+O|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(n,i,s,o,a,u,l,d)}roundClean(){Gc(ia)}destroy(){this.set(0,0,0,0,0,0,0,0),Gc(this.buffer)}};const a2=xw(()=>new XI),c2=a2;function ZI(t,e){return c2(Jo(t,{strict:!1})?dg(t):t)}function QI(t){const{commitment:e,version:r=1}=t,n=t.to??(typeof e=="string"?"hex":"bytes"),i=ZI(e);return i.set([r],0),n==="bytes"?i:ui(i)}function eC(t){const{commitments:e,version:r}=t,n=t.to??(typeof e[0]=="string"?"hex":"bytes"),i=[];for(const s of e)i.push(QI({commitment:s,to:n,version:r}));return i}const u2=6,f2=32,jg=4096,l2=f2*jg,h2=l2*u2-1-1*jg*u2;class tC extends pt{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class rC extends pt{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function nC(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),r=typeof t.data=="string"?lo(t.data):t.data,n=vn(r);if(!n)throw new rC;if(n>h2)throw new tC({maxSize:h2,size:n});const i=[];let s=!0,o=0;for(;s;){const a=Mg(new Uint8Array(l2));let u=0;for(;ua.bytes):i.map(a=>ui(a.bytes))}function iC(t){const{data:e,kzg:r,to:n}=t,i=t.blobs??nC({data:e,to:n}),s=t.commitments??s2({blobs:i,kzg:r,to:n}),o=t.proofs??o2({blobs:i,commitments:s,kzg:r,to:n}),a=[];for(let u=0;u"u"&&p)if(u){const B=await L();y.nonce=await u.consume({address:p.address,chainId:B,client:t})}else y.nonce=await Wn(t,i2,"getTransactionCount")({address:p.address,blockTag:"pending"});if((l.includes("blobVersionedHashes")||l.includes("sidecars"))&&n&&o){const B=s2({blobs:n,kzg:o});if(l.includes("blobVersionedHashes")){const k=eC({commitments:B,to:"hex"});y.blobVersionedHashes=k}if(l.includes("sidecars")){const k=o2({blobs:n,commitments:B,kzg:o}),H=iC({blobs:n,commitments:B,proofs:k,to:"hex"});y.sidecars=H}}if(l.includes("chainId")&&(y.chainId=await L()),(l.includes("fees")||l.includes("type"))&&typeof d>"u")try{y.type=sC(y)}catch{let B=p2.get(t.uid);if(typeof B>"u"){const k=await M();B=typeof(k==null?void 0:k.baseFeePerGas)=="bigint",p2.set(t.uid,B)}y.type=B?"eip1559":"legacy"}if(l.includes("fees"))if(y.type!=="legacy"&&y.type!=="eip2930"){if(typeof y.maxFeePerGas>"u"||typeof y.maxPriorityFeePerGas>"u"){const B=await M(),{maxFeePerGas:k,maxPriorityFeePerGas:H}=await n2(t,{block:B,chain:i,request:y});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"){const B=await M(),{gasPrice:k}=await n2(t,{block:B,chain:i,request:y,type:"legacy"});y.gasPrice=k}}return l.includes("gas")&&typeof s>"u"&&(y.gas=await Wn(t,aC,"estimateGas")({...y,account:p&&{address:p.address,type:"json-rpc"}})),Kh(y),delete y.parameters,y}async function oC(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=typeof r=="bigint"?dr(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function aC(t,e){var i,s,o;const{account:r=t.account}=e,n=r?fi(r):void 0;try{let f=function(v){const{block:x,request:S,rpcStateOverride:A}=v;return t.request({method:"eth_estimateGas",params:A?[S,x??"latest",A]:x?[S,x]:[S]})};const{accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,blockNumber:p,blockTag:y,data:_,gas:M,gasPrice:O,maxFeePerBlobGas:L,maxFeePerGas:B,maxPriorityFeePerGas:k,nonce:H,value:U,stateOverride:z,...Z}=await Ug(t,{...e,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),W=(typeof p=="bigint"?dr(p):void 0)||y,ie=kI(z),me=await(async()=>{if(Z.to)return Z.to;if(u&&u.length>0)return await Zw({authorization:u[0]}).catch(()=>{throw new pt("`to` is required. Could not infer from `authorizationList`")})})();Kh(e);const j=(o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:o.format,m=(j||$g)({...e2(Z,{format:j}),from:n==null?void 0:n.address,accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,data:_,gas:M,gasPrice:O,maxFeePerBlobGas:L,maxFeePerGas:B,maxPriorityFeePerGas:k,nonce:H,to:me,value:U});let g=BigInt(await f({block:W,request:m,rpcStateOverride:ie}));if(u){const v=await oC(t,{address:m.from}),x=await Promise.all(u.map(async S=>{const{address:A}=S,b=await f({block:W,request:{authorizationList:void 0,data:_,from:n==null?void 0:n.address,to:A,value:dr(v)},rpcStateOverride:ie}).catch(()=>100000n);return 2n*BigInt(b)}));g+=x.reduce((S,A)=>S+A,0n)}return g}catch(a){throw DI(a,{...e,account:n,chain:t.chain})}}function cC(t,e){if(!gs(t,{strict:!1}))throw new ta({address:t});if(!gs(e,{strict:!1}))throw new ta({address:e});return t.toLowerCase()===e.toLowerCase()}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const qg=BigInt(0),zg=BigInt(1);function Gh(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}function Yh(t){const e=t.toString(16);return e.length&1?"0"+e:e}function g2(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?qg:BigInt("0x"+t)}function Jh(t){return g2(Yc(t))}function m2(t){return ps(t),g2(Yc(Uint8Array.from(t).reverse()))}function Hg(t,e){return mg(t.toString(16).padStart(e*2,"0"))}function v2(t,e){return Hg(t,e).reverse()}function Ui(t,e,r){let n;if(typeof e=="string")try{n=mg(e)}catch(s){throw new Error(t+" must be hex string or Uint8Array, cause: "+s)}else if(pg(e))n=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const i=n.length;if(typeof r=="number"&&i!==r)throw new Error(t+" of length "+r+" expected, got "+i);return n}const Wg=t=>typeof t=="bigint"&&qg<=t;function uC(t,e,r){return Wg(t)&&Wg(e)&&Wg(r)&&e<=t&&tqg;t>>=zg,e+=1);return e}const Xh=t=>(zg<new Uint8Array(_),i=_=>Uint8Array.of(_);let s=n(t),o=n(t),a=0;const u=()=>{s.fill(1),o.fill(0),a=0},l=(..._)=>r(o,s,..._),d=(_=n(0))=>{o=l(i(0),_),s=l(),_.length!==0&&(o=l(i(1),_),s=l())},p=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let _=0;const M=[];for(;_{u(),d(_);let O;for(;!(O=M(p()));)d();return u(),O}}function Kg(t,e,r={}){if(!t||typeof t!="object")throw new Error("expected valid options object");function n(i,s,o){const a=t[i];if(o&&a===void 0)return;const u=typeof a;if(u!==s||a===null)throw new Error(`param "${i}" is invalid: expected ${s}, got ${u}`)}Object.entries(e).forEach(([i,s])=>n(i,s,!1)),Object.entries(r).forEach(([i,s])=>n(i,s,!0))}function b2(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}class dC extends pt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class pC extends pt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` `),{name:"ChainNotFoundError"})}}const Vg="/docs/contract/encodeDeployData";function gC(t){const{abi:e,args:r,bytecode:n}=t;if(!r||r.length===0)return n;const i=e.find(o=>"type"in o&&o.type==="constructor");if(!i)throw new DP({docsPath:Vg});if(!("inputs"in i))throw new ow({docsPath:Vg});if(!i.inputs||i.inputs.length===0)throw new ow({docsPath:Vg});const s=kw(i.inputs,r);return Uh([n,s])}function mC(){let t=()=>{},e=()=>{};return{promise:new Promise((n,i)=>{t=n,e=i}),resolve:t,reject:e}}const Gg=new Map,y2=new Map;let vC=0;function bC(t,e,r){const n=++vC,i=()=>Gg.get(t)||[],s=()=>{const d=i();Gg.set(t,d.filter(p=>p.id!==n))},o=()=>{const d=i();if(!d.some(y=>y.id===n))return;const p=y2.get(t);if(d.length===1&&p){const y=p();y instanceof Promise&&y.catch(()=>{})}s()},a=i();if(Gg.set(t,[...a,{id:n,fns:e}]),a&&a.length>0)return o;const u={};for(const d in e)u[d]=(...p)=>{var _,M;const y=i();if(y.length!==0)for(const O of y)(M=(_=O.fns)[d])==null||M.call(_,...p)};const l=r(u);return typeof l=="function"&&y2.set(t,l),o}async function Yg(t){return new Promise(e=>setTimeout(e,t))}function yC(t,{emitOnBegin:e,initialWaitTime:r,interval:n}){let i=!0;const s=()=>i=!1;return(async()=>{let a;a=await t({unpoll:s});const u=await(r==null?void 0:r(a))??n;await Yg(u);const l=async()=>{i&&(await t({unpoll:s}),await Yg(n),l())};l()})(),s}class Wa extends pt{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` -`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class Zh extends pt{constructor({docsPath:e,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:e,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function w2({chain:t,currentChainId:e}){if(!t)throw new pC;if(e!==t.id)throw new dC({chain:t,currentChainId:e})}function x2(t,{docsPath:e,...r}){const n=(()=>{const i=Qw(t,r);return i instanceof Bg?t:i})();return new pI(n,{docsPath:e,...r})}async function _2(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const Jg=new jh(128);async function Qh(t,e){var k,H,U,z;const{account:r=t.account,chain:n=t.chain,accessList:i,authorizationList:s,blobs:o,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:_,type:M,value:O,...L}=e;if(typeof r>"u")throw new Wa({docsPath:"/docs/actions/wallet/sendTransaction"});const B=r?fi(r):null;try{Kh(e);const Z=await(async()=>{if(e.to)return e.to;if(e.to!==null&&s&&s.length>0)return await Zw({authorization:s[0]}).catch(()=>{throw new pt("`to` is required. Could not infer from `authorizationList`.")})})();if((B==null?void 0:B.type)==="json-rpc"||B===null){let R;n!==null&&(R=await Wn(t,Wf,"getChainId")({}),w2({currentChainId:R,chain:n}));const W=(U=(H=(k=t.chain)==null?void 0:k.formatters)==null?void 0:H.transactionRequest)==null?void 0:U.format,me=(W||$g)({...e2(L,{format:W}),accessList:i,authorizationList:s,blobs:o,chainId:R,data:a,from:B==null?void 0:B.address,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:_,to:Z,type:M,value:O}),j=Jg.get(t.uid),E=j?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:E,params:[me]},{retryCount:0})}catch(m){if(j===!1)throw m;const f=m;if(f.name==="InvalidInputRpcError"||f.name==="InvalidParamsRpcError"||f.name==="MethodNotFoundRpcError"||f.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[me]},{retryCount:0}).then(g=>(Jg.set(t.uid,!0),g)).catch(g=>{const v=g;throw v.name==="MethodNotFoundRpcError"||v.name==="MethodNotSupportedRpcError"?(Jg.set(t.uid,!1),f):v});throw f}}if((B==null?void 0:B.type)==="local"){const R=await Wn(t,Ug,"prepareTransactionRequest")({account:B,accessList:i,authorizationList:s,blobs:o,chain:n,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:_,nonceManager:B.nonceManager,parameters:[...d2,"sidecars"],type:M,value:O,...L,to:Z}),W=(z=n==null?void 0:n.serializers)==null?void 0:z.transaction,ie=await B.signTransaction(R,{serializer:W});return await Wn(t,_2,"sendRawTransaction")({serializedTransaction:ie})}throw(B==null?void 0:B.type)==="smart"?new Zh({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Zh({docsPath:"/docs/actions/wallet/sendTransaction",type:B==null?void 0:B.type})}catch(Z){throw Z instanceof Zh?Z:x2(Z,{...e,account:B,chain:e.chain||void 0})}}async function wC(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:o,functionName:a,...u}=e;if(typeof n>"u")throw new Wa({docsPath:"/docs/contract/writeContract"});const l=n?fi(n):null,d=jw({abi:r,args:s,functionName:a});try{return await Wn(t,Qh,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:i,account:l,...u})}catch(p){throw EI(p,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:a,sender:l==null?void 0:l.address})}}const xC={"0x0":"reverted","0x1":"success"},E2="0x5792579257925792579257925792579257925792579257925792579257925792",S2=dr(0,{size:32});async function _C(t,e){const{account:r=t.account,capabilities:n,chain:i=t.chain,experimental_fallback:s,experimental_fallbackDelay:o=32,forceAtomic:a=!1,id:u,version:l="2.0.0"}=e,d=r?fi(r):null,p=e.calls.map(y=>{const _=y,M=_.abi?jw({abi:_.abi,functionName:_.functionName,args:_.args}):_.data;return{data:_.dataSuffix&&M?ra([M,_.dataSuffix]):M,to:_.to,value:_.value?dr(_.value):void 0}});try{const y=await t.request({method:"wallet_sendCalls",params:[{atomicRequired:a,calls:p,capabilities:n,chainId:dr(i.id),from:d==null?void 0:d.address,id:u,version:l}]},{retryCount:0});return typeof y=="string"?{id:y}:y}catch(y){const _=y;if(s&&(_.name==="MethodNotFoundRpcError"||_.name==="MethodNotSupportedRpcError"||_.name==="UnknownRpcError"||_.details.toLowerCase().includes("does not exist / is not available")||_.details.toLowerCase().includes("missing or invalid. request()")||_.details.toLowerCase().includes("did not match any variant of untagged enum")||_.details.toLowerCase().includes("account upgraded to unsupported contract")||_.details.toLowerCase().includes("eip-7702 not supported")||_.details.toLowerCase().includes("unsupported wc_ method"))){if(n&&Object.values(n).some(k=>!k.optional)){const k="non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";throw new Zc(new pt(k,{details:k}))}if(a&&p.length>1){const B="`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";throw new Qc(new pt(B,{details:B}))}const M=[];for(const B of p){const k=Qh(t,{account:d,chain:i,data:B.data,to:B.to,value:B.value?Zo(B.value):void 0});M.push(k),o>0&&await new Promise(H=>setTimeout(H,o))}const O=await Promise.allSettled(M);if(O.every(B=>B.status==="rejected"))throw O[0].reason;const L=O.map(B=>B.status==="fulfilled"?B.value:S2);return{id:ra([...L,dr(i.id,{size:32}),E2])}}throw x2(y,{...e,account:d,chain:e.chain})}}async function A2(t,e){async function r(d){if(d.endsWith(E2.slice(2))){const y=Lh(xg(d,-64,-32)),_=xg(d,0,-64).slice(2).match(/.{1,64}/g),M=await Promise.all(_.map(L=>S2.slice(2)!==L?t.request({method:"eth_getTransactionReceipt",params:[`0x${L}`]},{dedupe:!0}):void 0)),O=M.some(L=>L===null)?100:M.every(L=>(L==null?void 0:L.status)==="0x1")?200:M.every(L=>(L==null?void 0:L.status)==="0x0")?500:600;return{atomic:!1,chainId:Qo(y),receipts:M.filter(Boolean),status:O,version:"2.0.0"}}return t.request({method:"wallet_getCallsStatus",params:[d]})}const{atomic:n=!1,chainId:i,receipts:s,version:o="2.0.0",...a}=await r(e.id),[u,l]=(()=>{const d=a.status;return d>=100&&d<200?["pending",d]:d>=200&&d<300?["success",d]:d>=300&&d<700?["failure",d]:d==="CONFIRMED"?["success",200]:d==="PENDING"?["pending",100]:[void 0,d]})();return{...a,atomic:n,chainId:i?Qo(i):void 0,receipts:(s==null?void 0:s.map(d=>({...d,blockNumber:Zo(d.blockNumber),gasUsed:Zo(d.gasUsed),status:xC[d.status]})))??[],statusCode:l,status:u,version:o}}async function EC(t,e){const{id:r,pollingInterval:n=t.pollingInterval,status:i=({statusCode:y})=>y>=200,timeout:s=6e4}=e,o=qa(["waitForCallsStatus",t.uid,r]),{promise:a,resolve:u,reject:l}=mC();let d;const p=bC(o,{resolve:u,reject:l},y=>{const _=yC(async()=>{const M=O=>{clearTimeout(d),_(),O(),p()};try{const O=await A2(t,{id:r});if(!i(O))return;M(()=>y.resolve(O))}catch(O){M(()=>y.reject(O))}},{interval:n,emitOnBegin:!0});return _});return d=s?setTimeout(()=>{p(),clearTimeout(d),l(new SC({id:r}))},s):void 0,await a}class SC extends pt{constructor({id:e}){super(`Timed out while waiting for call bundle with id "${e}" to be confirmed.`,{name:"WaitForCallsStatusTimeoutError"})}}const Xg=256;let ed=Xg,td;function P2(t=11){if(!td||ed+t>Xg*2){td="",ed=0;for(let e=0;e{const U=H(k);for(const Z in L)delete U[Z];const z={...k,...U};return Object.assign(z,{extend:B(z)})}}return Object.assign(L,{extend:B(L)})}const rd=new jh(8192);function PC(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(rd.get(r))return rd.get(r);const n=t().finally(()=>rd.delete(r));return rd.set(r,n),n}function MC(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const u=async({error:l})=>{const d=typeof e=="function"?e({count:a,error:l}):e;d&&await Yg(d),o({count:a+1})};try{const l=await t();i(l)}catch(l){if(a{var p;const{dedupe:i=!1,methods:s,retryDelay:o=150,retryCount:a=3,uid:u}={...e,...n},{method:l}=r;if((p=s==null?void 0:s.exclude)!=null&&p.includes(l))throw new Ha(new Error("method not supported"),{method:l});if(s!=null&&s.include&&!s.include.includes(l))throw new Ha(new Error("method not supported"),{method:l});const d=i?Bh(`${u}.${qa(r)}`):void 0;return PC(()=>MC(async()=>{try{return await t(r)}catch(y){const _=y;switch(_.code){case Pf.code:throw new Pf(_);case Mf.code:throw new Mf(_);case If.code:throw new If(_,{method:r.method});case Cf.code:throw new Cf(_);case za.code:throw new za(_);case Tf.code:throw new Tf(_);case Rf.code:throw new Rf(_);case Df.code:throw new Df(_);case Of.code:throw new Of(_);case Ha.code:throw new Ha(_,{method:r.method});case Jc.code:throw new Jc(_);case Nf.code:throw new Nf(_);case Xc.code:throw new Xc(_);case Lf.code:throw new Lf(_);case kf.code:throw new kf(_);case Bf.code:throw new Bf(_);case $f.code:throw new $f(_);case Ff.code:throw new Ff(_);case Zc.code:throw new Zc(_);case jf.code:throw new jf(_);case Uf.code:throw new Uf(_);case qf.code:throw new qf(_);case zf.code:throw new zf(_);case Hf.code:throw new Hf(_);case Qc.code:throw new Qc(_);case 5e3:throw new Xc(_);default:throw y instanceof pt?y:new xI(_)}}},{delay:({count:y,error:_})=>{var M;if(_&&_ instanceof Vw){const O=(M=_==null?void 0:_.headers)==null?void 0:M.get("Retry-After");if(O!=null&&O.match(/\d/))return Number.parseInt(O)*1e3}return~~(1<CC(y)}),{enabled:i,id:d})}}function CC(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Jc.code||t.code===za.code:t instanceof Vw&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function TC({key:t,methods:e,name:r,request:n,retryCount:i=3,retryDelay:s=150,timeout:o,type:a},u){const l=P2();return{config:{key:t,methods:e,name:r,request:n,retryCount:i,retryDelay:s,timeout:o,type:a},request:IC(n,{methods:e,retryCount:i,retryDelay:s,uid:l}),value:u}}function nd(t,e={}){const{key:r="custom",methods:n,name:i="Custom Provider",retryDelay:s}=e;return({retryCount:o})=>TC({key:r,methods:n,name:i,request:t.request.bind(t),retryCount:e.retryCount??o,retryDelay:s,type:"custom"})}class RC extends pt{constructor({domain:e}){super(`Invalid domain "${qa(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class DC extends pt{constructor({primaryType:e,types:r}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class OC extends pt{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function NC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(u,l)=>{const d={...l};for(const p of u){const{name:y,type:_}=p;_==="address"&&(d[y]=d[y].toLowerCase())}return d},o=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return qa({domain:o,message:a,primaryType:n,types:i})}function LC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(o,a)=>{for(const u of o){const{name:l,type:d}=u,p=a[l],y=d.match(Lw);if(y&&(typeof p=="number"||typeof p=="bigint")){const[O,L,B]=y;dr(p,{signed:L==="int",size:Number.parseInt(B)/8})}if(d==="address"&&typeof p=="string"&&!gs(p))throw new ta({address:p});const _=d.match(NM);if(_){const[O,L]=_;if(L&&vn(p)!==Number.parseInt(L))throw new $P({expectedSize:Number.parseInt(L),givenSize:vn(p)})}const M=i[d];M&&(BC(d),s(M,p))}};if(i.EIP712Domain&&e){if(typeof e!="object")throw new RC({domain:e});s(i.EIP712Domain,e)}if(n!=="EIP712Domain")if(i[n])s(i[n],r);else throw new DC({primaryType:n,types:i})}function kC({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},(typeof(t==null?void 0:t.chainId)=="number"||typeof(t==null?void 0:t.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function BC(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new OC({type:t})}let M2=class extends vg{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,nM(e);const n=xf(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew M2(t,e).update(r).digest();I2.create=(t,e)=>new M2(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const hi=BigInt(0),ei=BigInt(1),Ka=BigInt(2),$C=BigInt(3),C2=BigInt(4),T2=BigInt(5),R2=BigInt(8);function qi(t,e){const r=t%e;return r>=hi?r:e+r}function zi(t,e,r){let n=t;for(;e-- >hi;)n*=n,n%=r;return n}function D2(t,e){if(t===hi)throw new Error("invert: expected non-zero number");if(e<=hi)throw new Error("invert: expected positive modulus, got "+e);let r=qi(t,e),n=e,i=hi,s=ei;for(;r!==hi;){const a=n/r,u=n%r,l=i-s*a;n=r,r=u,i=s,s=l}if(n!==ei)throw new Error("invert: does not exist");return qi(i,e)}function O2(t,e){const r=(t.ORDER+ei)/C2,n=t.pow(e,r);if(!t.eql(t.sqr(n),e))throw new Error("Cannot find square root");return n}function FC(t,e){const r=(t.ORDER-T2)/R2,n=t.mul(e,Ka),i=t.pow(n,r),s=t.mul(e,i),o=t.mul(t.mul(s,Ka),i),a=t.mul(s,t.sub(o,t.ONE));if(!t.eql(t.sqr(a),e))throw new Error("Cannot find square root");return a}function jC(t){if(t1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return O2;let s=i.pow(n,e);const o=(e+ei)/Ka;return function(u,l){if(u.is0(l))return l;if(L2(u,l)!==1)throw new Error("Cannot find square root");let d=r,p=u.mul(u.ONE,s),y=u.pow(l,e),_=u.pow(l,o);for(;!u.eql(y,u.ONE);){if(u.is0(y))return u.ZERO;let M=1,O=u.sqr(y);for(;!u.eql(O,u.ONE);)if(M++,O=u.sqr(O),M===d)throw new Error("Cannot find square root");const L=ei<(n[i]="function",n),e);return Kg(t,r),t}function HC(t,e,r){if(rhi;)r&ei&&(n=t.mul(n,i)),i=t.sqr(i),r>>=ei;return n}function N2(t,e,r=!1){const n=new Array(e.length).fill(r?t.ZERO:void 0),i=e.reduce((o,a,u)=>t.is0(a)?o:(n[u]=o,t.mul(o,a)),t.ONE),s=t.inv(i);return e.reduceRight((o,a,u)=>t.is0(a)?o:(n[u]=t.mul(o,n[u]),t.mul(o,a)),s),n}function L2(t,e){const r=(t.ORDER-ei)/Ka,n=t.pow(e,r),i=t.eql(n,t.ONE),s=t.eql(n,t.ZERO),o=t.eql(n,t.neg(t.ONE));if(!i&&!s&&!o)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function WC(t,e){e!==void 0&&wf(e);const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function id(t,e,r=!1,n={}){if(t<=hi)throw new Error("invalid field: expected ORDER > 0, got "+t);let i,s;if(typeof e=="object"&&e!=null){if(n.sqrt||r)throw new Error("cannot specify opts in two arguments");const d=e;d.BITS&&(i=d.BITS),d.sqrt&&(s=d.sqrt),typeof d.isLE=="boolean"&&(r=d.isLE)}else typeof e=="number"&&(i=e),n.sqrt&&(s=n.sqrt);const{nBitLength:o,nByteLength:a}=WC(t,i);if(a>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let u;const l=Object.freeze({ORDER:t,isLE:r,BITS:o,BYTES:a,MASK:Xh(o),ZERO:hi,ONE:ei,create:d=>qi(d,t),isValid:d=>{if(typeof d!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof d);return hi<=d&&dd===hi,isValidNot0:d=>!l.is0(d)&&l.isValid(d),isOdd:d=>(d&ei)===ei,neg:d=>qi(-d,t),eql:(d,p)=>d===p,sqr:d=>qi(d*d,t),add:(d,p)=>qi(d+p,t),sub:(d,p)=>qi(d-p,t),mul:(d,p)=>qi(d*p,t),pow:(d,p)=>HC(l,d,p),div:(d,p)=>qi(d*D2(p,t),t),sqrN:d=>d*d,addN:(d,p)=>d+p,subN:(d,p)=>d-p,mulN:(d,p)=>d*p,inv:d=>D2(d,t),sqrt:s||(d=>(u||(u=UC(t)),u(l,d))),toBytes:d=>r?v2(d,a):Hg(d,a),fromBytes:d=>{if(d.length!==a)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+d.length);return r?m2(d):Jh(d)},invertBatch:d=>N2(l,d),cmov:(d,p,y)=>y?p:d});return Object.freeze(l)}function k2(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function B2(t){const e=k2(t);return e+Math.ceil(e/2)}function KC(t,e,r=!1){const n=t.length,i=k2(e),s=B2(e);if(n<16||n1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);const o=r?m2(t):Jh(t),a=qi(o,e-ei)+ei;return r?v2(a,i):Hg(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const tu=BigInt(0),Va=BigInt(1);function Kf(t,e){const r=e.negate();return t?r:e}function VC(t,e,r){const n=o=>o.pz,i=N2(t.Fp,r.map(n));return r.map((o,a)=>o.toAffine(i[a])).map(t.fromAffine)}function $2(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function Zg(t,e){$2(t,e);const r=Math.ceil(e/t)+1,n=2**(t-1),i=2**t,s=Xh(t),o=BigInt(t);return{windows:r,windowSize:n,mask:s,maxNumber:i,shiftBy:o}}function F2(t,e,r){const{windowSize:n,mask:i,maxNumber:s,shiftBy:o}=r;let a=Number(t&i),u=t>>o;a>n&&(a-=s,u+=Va);const l=e*n,d=l+Math.abs(a)-1,p=a===0,y=a<0,_=e%2!==0;return{nextN:u,offset:d,isZero:p,isNeg:y,isNegF:_,offsetF:l}}function GC(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function YC(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}const Qg=new WeakMap,j2=new WeakMap;function em(t){return j2.get(t)||1}function U2(t){if(t!==tu)throw new Error("invalid wNAF")}function JC(t,e){return{constTimeNegate:Kf,hasPrecomputes(r){return em(r)!==1},unsafeLadder(r,n,i=t.ZERO){let s=r;for(;n>tu;)n&Va&&(i=i.add(s)),s=s.double(),n>>=Va;return i},precomputeWindow(r,n){const{windows:i,windowSize:s}=Zg(n,e),o=[];let a=r,u=a;for(let l=0;ltu||n>tu;)r&Va&&(s=s.add(i)),n&Va&&(o=o.add(i)),i=i.double(),r>>=Va,n>>=Va;return{p1:s,p2:o}}function ZC(t,e,r,n){GC(r,t),YC(n,e);const i=r.length,s=n.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");const o=t.ZERO,a=lC(BigInt(i));let u=1;a>12?u=a-3:a>4?u=a-2:a>0&&(u=2);const l=Xh(u),d=new Array(Number(l)+1).fill(o),p=Math.floor((e.BITS-1)/u)*u;let y=o;for(let _=p;_>=0;_-=u){d.fill(o);for(let O=0;O>BigInt(_)&l);d[B]=d[B].add(r[O])}let M=o;for(let O=d.length-1,L=o;O>0;O--)L=L.add(d[O]),M=M.add(L);if(y=y.add(M),_!==0)for(let O=0;Otu))throw new Error(`CURVE.${a} must be positive bigint`)}const n=q2(e.p,r.Fp),i=q2(e.n,r.Fn),o=["Gx","Gy","a","b"];for(const a of o)if(!n.isValid(e[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return{Fp:n,Fn:i}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function z2(t){t.lowS!==void 0&&Gh("lowS",t.lowS),t.prehash!==void 0&&Gh("prehash",t.prehash)}class eT extends Error{constructor(e=""){super(e)}}const go={Err:eT,_tlv:{encode:(t,e)=>{const{Err:r}=go;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=Yh(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?Yh(i.length/2|128):"";return Yh(t)+s+i+e},decode(t,e){const{Err:r}=go;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");const l=e.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const d of l)o=o<<8|d;if(n+=u,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=go;if(t{const{px:me,py:j,pz:E}=W;if(r.eql(E,r.ONE))return{x:me,y:j};const m=W.is0();ie==null&&(ie=m?r.ONE:r.inv(E));const f=r.mul(me,ie),g=r.mul(j,ie),v=r.mul(E,ie);if(m)return{x:r.ZERO,y:r.ZERO};if(!r.eql(v,r.ONE))throw new Error("invZ was invalid");return{x:f,y:g}}),H=b2(W=>{if(W.is0()){if(e.allowInfinityPoint&&!r.is0(W.py))return;throw new Error("bad point: ZERO")}const{x:ie,y:me}=W.toAffine();if(!r.isValid(ie)||!r.isValid(me))throw new Error("bad point: x or y not field elements");if(!_(ie,me))throw new Error("bad point: equation left != right");if(!W.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function U(W,ie,me,j,E){return me=new z(r.mul(me.px,W),me.py,me.pz),ie=Kf(j,ie),me=Kf(E,me),ie.add(me)}class z{constructor(ie,me,j){this.px=L("x",ie),this.py=L("y",me,!0),this.pz=L("z",j),Object.freeze(this)}static fromAffine(ie){const{x:me,y:j}=ie||{};if(!ie||!r.isValid(me)||!r.isValid(j))throw new Error("invalid affine point");if(ie instanceof z)throw new Error("projective point not allowed");return r.is0(me)&&r.is0(j)?z.ZERO:new z(me,j,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(ie){return VC(z,"pz",ie)}static fromBytes(ie){return ps(ie),z.fromHex(ie)}static fromHex(ie){const me=z.fromAffine(p(Ui("pointHex",ie)));return me.assertValidity(),me}static fromPrivateKey(ie){const me=H2(n,e.allowedPrivateKeyLengths,e.wrapPrivateKey);return z.BASE.multiply(me(ie))}static msm(ie,me){return ZC(z,n,ie,me)}precompute(ie=8,me=!0){return R.setWindowSize(this,ie),me||this.multiply(sd),this}_setWindowSize(ie){this.precompute(ie)}assertValidity(){H(this)}hasEvenY(){const{y:ie}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(ie)}equals(ie){B(ie);const{px:me,py:j,pz:E}=this,{px:m,py:f,pz:g}=ie,v=r.eql(r.mul(me,g),r.mul(m,E)),x=r.eql(r.mul(j,g),r.mul(f,E));return v&&x}negate(){return new z(this.px,r.neg(this.py),this.pz)}double(){const{a:ie,b:me}=t,j=r.mul(me,sd),{px:E,py:m,pz:f}=this;let g=r.ZERO,v=r.ZERO,x=r.ZERO,S=r.mul(E,E),A=r.mul(m,m),b=r.mul(f,f),P=r.mul(E,m);return P=r.add(P,P),x=r.mul(E,f),x=r.add(x,x),g=r.mul(ie,x),v=r.mul(j,b),v=r.add(g,v),g=r.sub(A,v),v=r.add(A,v),v=r.mul(g,v),g=r.mul(P,g),x=r.mul(j,x),b=r.mul(ie,b),P=r.sub(S,b),P=r.mul(ie,P),P=r.add(P,x),x=r.add(S,S),S=r.add(x,S),S=r.add(S,b),S=r.mul(S,P),v=r.add(v,S),b=r.mul(m,f),b=r.add(b,b),S=r.mul(b,P),g=r.sub(g,S),x=r.mul(b,A),x=r.add(x,x),x=r.add(x,x),new z(g,v,x)}add(ie){B(ie);const{px:me,py:j,pz:E}=this,{px:m,py:f,pz:g}=ie;let v=r.ZERO,x=r.ZERO,S=r.ZERO;const A=t.a,b=r.mul(t.b,sd);let P=r.mul(me,m),I=r.mul(j,f),F=r.mul(E,g),ce=r.add(me,j),D=r.add(m,f);ce=r.mul(ce,D),D=r.add(P,I),ce=r.sub(ce,D),D=r.add(me,E);let se=r.add(m,g);return D=r.mul(D,se),se=r.add(P,F),D=r.sub(D,se),se=r.add(j,E),v=r.add(f,g),se=r.mul(se,v),v=r.add(I,F),se=r.sub(se,v),S=r.mul(A,D),v=r.mul(b,F),S=r.add(v,S),v=r.sub(I,S),S=r.add(I,S),x=r.mul(v,S),I=r.add(P,P),I=r.add(I,P),F=r.mul(A,F),D=r.mul(b,D),I=r.add(I,F),F=r.sub(P,F),F=r.mul(A,F),D=r.add(D,F),P=r.mul(I,D),x=r.add(x,P),P=r.mul(se,D),v=r.mul(ce,v),v=r.sub(v,P),P=r.mul(ce,I),S=r.mul(se,S),S=r.add(S,P),new z(v,x,S)}subtract(ie){return this.add(ie.negate())}is0(){return this.equals(z.ZERO)}multiply(ie){const{endo:me}=e;if(!n.isValidNot0(ie))throw new Error("invalid scalar: out of range");let j,E;const m=f=>R.wNAFCached(this,f,z.normalizeZ);if(me){const{k1neg:f,k1:g,k2neg:v,k2:x}=me.splitScalar(ie),{p:S,f:A}=m(g),{p:b,f:P}=m(x);E=A.add(P),j=U(me.beta,S,b,f,v)}else{const{p:f,f:g}=m(ie);j=f,E=g}return z.normalizeZ([j,E])[0]}multiplyUnsafe(ie){const{endo:me}=e,j=this;if(!n.isValid(ie))throw new Error("invalid scalar: out of range");if(ie===Vf||j.is0())return z.ZERO;if(ie===Gf)return j;if(R.hasPrecomputes(this))return this.multiply(ie);if(me){const{k1neg:E,k1:m,k2neg:f,k2:g}=me.splitScalar(ie),{p1:v,p2:x}=XC(z,j,m,g);return U(me.beta,v,x,E,f)}else return R.wNAFCachedUnsafe(j,ie)}multiplyAndAddUnsafe(ie,me,j){const E=this.multiplyUnsafe(me).add(ie.multiplyUnsafe(j));return E.is0()?void 0:E}toAffine(ie){return k(this,ie)}isTorsionFree(){const{isTorsionFree:ie}=e;return i===Gf?!0:ie?ie(z,this):R.wNAFCachedUnsafe(this,s).is0()}clearCofactor(){const{clearCofactor:ie}=e;return i===Gf?this:ie?ie(z,this):this.multiplyUnsafe(i)}toBytes(ie=!0){return Gh("isCompressed",ie),this.assertValidity(),d(z,this,ie)}toRawBytes(ie=!0){return this.toBytes(ie)}toHex(ie=!0){return Gc(this.toBytes(ie))}toString(){return``}}z.BASE=new z(t.Gx,t.Gy,r.ONE),z.ZERO=new z(r.ZERO,r.ONE,r.ZERO),z.Fp=r,z.Fn=n;const Z=n.BITS,R=JC(z,e.endo?Math.ceil(Z/2):Z);return z}function W2(t){return Uint8Array.of(t?2:3)}function sT(t,e,r={}){Kg(e,{hash:"function"},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const n=e.randomBytes||lM,i=e.hmac||((j,...E)=>I2(e.hash,j,Ua(...E))),{Fp:s,Fn:o}=t,{ORDER:a,BITS:u}=o;function l(j){const E=a>>Gf;return j>E}function d(j){return l(j)?o.neg(j):j}function p(j,E){if(!o.isValidNot0(E))throw new Error(`invalid signature ${j}: out of range 1..CURVE.n`)}class y{constructor(E,m,f){p("r",E),p("s",m),this.r=E,this.s=m,f!=null&&(this.recovery=f),Object.freeze(this)}static fromCompact(E){const m=o.BYTES,f=Ui("compactSignature",E,m*2);return new y(o.fromBytes(f.subarray(0,m)),o.fromBytes(f.subarray(m,m*2)))}static fromDER(E){const{r:m,s:f}=go.toSig(Ui("DER",E));return new y(m,f)}assertValidity(){}addRecoveryBit(E){return new y(this.r,this.s,E)}recoverPublicKey(E){const m=s.ORDER,{r:f,s:g,recovery:v}=this;if(v==null||![0,1,2,3].includes(v))throw new Error("recovery id invalid");if(a*tT1)throw new Error("recovery id is ambiguous for h>1 curve");const S=v===2||v===3?f+a:f;if(!s.isValid(S))throw new Error("recovery id 2 or 3 invalid");const A=s.toBytes(S),b=t.fromHex(Ua(W2((v&1)===0),A)),P=o.inv(S),I=H(Ui("msgHash",E)),F=o.create(-I*P),ce=o.create(g*P),D=t.BASE.multiplyUnsafe(F).add(b.multiplyUnsafe(ce));if(D.is0())throw new Error("point at infinify");return D.assertValidity(),D}hasHighS(){return l(this.s)}normalizeS(){return this.hasHighS()?new y(this.r,o.neg(this.s),this.recovery):this}toBytes(E){if(E==="compact")return Ua(o.toBytes(this.r),o.toBytes(this.s));if(E==="der")return mg(go.hexFromSig(this));throw new Error("invalid format")}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return Gc(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return Gc(this.toBytes("compact"))}}const _=H2(o,r.allowedPrivateKeyLengths,r.wrapPrivateKey),M={isValidPrivateKey(j){try{return _(j),!0}catch{return!1}},normPrivateKeyToScalar:_,randomPrivateKey:()=>{const j=a;return KC(n(B2(j)),j)},precompute(j=8,E=t.BASE){return E.precompute(j,!1)}};function O(j,E=!0){return t.fromPrivateKey(j).toBytes(E)}function L(j){if(typeof j=="bigint")return!1;if(j instanceof t)return!0;const m=Ui("key",j).length,f=s.BYTES,g=f+1,v=2*f+1;if(!(r.allowedPrivateKeyLengths||o.BYTES===g))return m===g||m===v}function B(j,E,m=!0){if(L(j)===!0)throw new Error("first arg must be private key");if(L(E)===!1)throw new Error("second arg must be public key");return t.fromHex(E).multiply(_(j)).toBytes(m)}const k=e.bits2int||function(j){if(j.length>8192)throw new Error("input is too large");const E=Jh(j),m=j.length*8-u;return m>0?E>>BigInt(m):E},H=e.bits2int_modN||function(j){return o.create(k(j))},U=Xh(u);function z(j){return fC("num < 2^"+u,j,Vf,U),o.toBytes(j)}function Z(j,E,m=R){if(["recovered","canonical"].some(ce=>ce in m))throw new Error("sign() legacy options not supported");const{hash:f}=e;let{lowS:g,prehash:v,extraEntropy:x}=m;g==null&&(g=!0),j=Ui("msgHash",j),z2(m),v&&(j=Ui("prehashed msgHash",f(j)));const S=H(j),A=_(E),b=[z(A),z(S)];if(x!=null&&x!==!1){const ce=x===!0?n(s.BYTES):x;b.push(Ui("extraEntropy",ce))}const P=Ua(...b),I=S;function F(ce){const D=k(ce);if(!o.isValidNot0(D))return;const se=o.inv(D),ee=t.BASE.multiply(D).toAffine(),J=o.create(ee.x);if(J===Vf)return;const Q=o.create(se*o.create(I+J*A));if(Q===Vf)return;let T=(ee.x===J?0:2)|Number(ee.y&Gf),X=Q;return g&&l(Q)&&(X=d(Q),T^=1),new y(J,X,T)}return{seed:P,k2sig:F}}const R={lowS:e.lowS,prehash:!1},W={lowS:e.lowS,prehash:!1};function ie(j,E,m=R){const{seed:f,k2sig:g}=Z(j,E,m);return hC(e.hash.outputLen,o.BYTES,i)(f,g)}t.BASE.precompute(8);function me(j,E,m,f=W){const g=j;E=Ui("msgHash",E),m=Ui("publicKey",m),z2(f);const{lowS:v,prehash:x,format:S}=f;if("strict"in f)throw new Error("options.strict was renamed to lowS");if(S!==void 0&&!["compact","der","js"].includes(S))throw new Error('format must be "compact", "der" or "js"');const A=typeof g=="string"||pg(g),b=!A&&!S&&typeof g=="object"&&g!==null&&typeof g.r=="bigint"&&typeof g.s=="bigint";if(!A&&!b)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let P,I;try{if(b)if(S===void 0||S==="js")P=new y(g.r,g.s);else throw new Error("invalid format");if(A){try{S!=="compact"&&(P=y.fromDER(g))}catch(X){if(!(X instanceof go.Err))throw X}!P&&S!=="der"&&(P=y.fromCompact(g))}I=t.fromHex(m)}catch{return!1}if(!P||v&&P.hasHighS())return!1;x&&(E=e.hash(E));const{r:F,s:ce}=P,D=H(E),se=o.inv(ce),ee=o.create(D*se),J=o.create(F*se),Q=t.BASE.multiplyUnsafe(ee).add(I.multiplyUnsafe(J));return Q.is0()?!1:o.create(Q.x)===F}return Object.freeze({getPublicKey:O,getSharedSecret:B,sign:ie,verify:me,utils:M,Point:t,Signature:y})}function oT(t){const e={a:t.a,b:t.b,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r=t.Fp,n=id(e.n,t.nBitLength),i={Fp:r,Fn:n,allowedPrivateKeyLengths:t.allowedPrivateKeyLengths,allowInfinityPoint:t.allowInfinityPoint,endo:t.endo,wrapPrivateKey:t.wrapPrivateKey,isTorsionFree:t.isTorsionFree,clearCofactor:t.clearCofactor,fromBytes:t.fromBytes,toBytes:t.toBytes};return{CURVE:e,curveOpts:i}}function aT(t){const{CURVE:e,curveOpts:r}=oT(t),n={hash:t.hash,hmac:t.hmac,randomBytes:t.randomBytes,lowS:t.lowS,bits2int:t.bits2int,bits2int_modN:t.bits2int_modN};return{CURVE:e,curveOpts:r,ecdsaOpts:n}}function cT(t,e){return Object.assign({},e,{ProjectivePoint:e.Point,CURVE:t})}function uT(t){const{CURVE:e,curveOpts:r,ecdsaOpts:n}=aT(t),i=iT(e,r),s=sT(i,n,r);return cT(t,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function fT(t,e){const r=n=>uT({...t,hash:n});return{...r(e),create:r}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const od={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")};BigInt(0);const lT=BigInt(1),tm=BigInt(2),K2=(t,e)=>(t+e/tm)/e;function hT(t){const e=od.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),u=BigInt(88),l=t*t*t%e,d=l*l*t%e,p=zi(d,r,e)*d%e,y=zi(p,r,e)*d%e,_=zi(y,tm,e)*l%e,M=zi(_,i,e)*_%e,O=zi(M,s,e)*M%e,L=zi(O,a,e)*O%e,B=zi(L,u,e)*L%e,k=zi(B,a,e)*O%e,H=zi(k,r,e)*d%e,U=zi(H,o,e)*M%e,z=zi(U,n,e)*l%e,Z=zi(z,tm,e);if(!rm.eql(rm.sqr(Z),t))throw new Error("Cannot find square root");return Z}const rm=id(od.p,void 0,void 0,{sqrt:hT}),dT=fT({...od,Fp:rm,lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=od.n,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-lT*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=K2(s*t,e),u=K2(-n*t,e);let l=qi(t-a*r-u*i,e),d=qi(-a*n-u*s,e);const p=l>o,y=d>o;if(p&&(l=e-l),y&&(d=e-d),l>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:p,k1:l,k2neg:y,k2:d}}}},a2),pT=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:dT},Symbol.toStringTag,{value:"Module"}));async function gT(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:dr(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}function mT(t,e){const{abi:r,args:n,bytecode:i,...s}=e,o=gC({abi:r,args:n,bytecode:i});return Qh(t,{...s,...s.authorizationList?{to:null}:{},data:o})}async function vT(t){var r;return((r=t.account)==null?void 0:r.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(n=>Sf(n))}async function bT(t,e={}){const{account:r=t.account,chainId:n}=e,i=r?fi(r):void 0,s=n?[i==null?void 0:i.address,[dr(n)]]:[i==null?void 0:i.address],o=await t.request({method:"wallet_getCapabilities",params:s}),a={};for(const[u,l]of Object.entries(o)){a[Number(u)]={};for(let[d,p]of Object.entries(l))d==="addSubAccount"&&(d="unstable_addSubAccount"),a[Number(u)][d]=p}return typeof n=="number"?a[n]:a}async function yT(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}async function V2(t,e){var u;const{account:r=t.account,chainId:n,nonce:i}=e;if(!r)throw new Wa({docsPath:"/docs/eip7702/prepareAuthorization"});const s=fi(r),o=(()=>{if(e.executor)return e.executor==="self"?e.executor:fi(e.executor)})(),a={address:e.contractAddress??e.address,chainId:n,nonce:i};return typeof a.chainId>"u"&&(a.chainId=((u=t.chain)==null?void 0:u.id)??await Wn(t,Wf,"getChainId")({})),typeof a.nonce>"u"&&(a.nonce=await Wn(t,i2,"getTransactionCount")({address:s.address,blockTag:"pending"}),(o==="self"||o!=null&&o.address&&cC(o.address,s.address))&&(a.nonce+=1)),a}async function wT(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>yg(r))}async function xT(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function _T(t,e){const{id:r}=e;await t.request({method:"wallet_showCallsStatus",params:[r]})}async function ET(t,e){const{account:r=t.account}=e;if(!r)throw new Wa({docsPath:"/docs/eip7702/signAuthorization"});const n=fi(r);if(!n.signAuthorization)throw new Zh({docsPath:"/docs/eip7702/signAuthorization",metaMessages:["The `signAuthorization` Action does not support JSON-RPC Accounts."],type:n.type});const i=await V2(t,e);return n.signAuthorization(i)}async function ST(t,{account:e=t.account,message:r}){if(!e)throw new Wa({docsPath:"/docs/actions/wallet/signMessage"});const n=fi(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Bh(r):r.raw instanceof Uint8Array?kh(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function AT(t,e){var l,d,p,y;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new Wa({docsPath:"/docs/actions/wallet/signTransaction"});const s=fi(r);Kh({account:s,...e});const o=await Wn(t,Wf,"getChainId")({});n!==null&&w2({currentChainId:o,chain:n});const a=(n==null?void 0:n.formatters)||((l=t.chain)==null?void 0:l.formatters),u=((d=a==null?void 0:a.transactionRequest)==null?void 0:d.format)||$g;return s.signTransaction?s.signTransaction({...i,chainId:o},{serializer:(y=(p=t.chain)==null?void 0:p.serializers)==null?void 0:y.transaction}):await t.request({method:"eth_signTransaction",params:[{...u(i),chainId:dr(o),from:s.address}]},{retryCount:0})}async function PT(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new Wa({docsPath:"/docs/actions/wallet/signTypedData"});const o=fi(r),a={EIP712Domain:kC({domain:n}),...e.types};if(LC({domain:n,message:i,primaryType:s,types:a}),o.signTypedData)return o.signTypedData({domain:n,message:i,primaryType:s,types:a});const u=NC({domain:n,message:i,primaryType:s,types:a});return t.request({method:"eth_signTypedData_v4",params:[o.address,u]},{retryCount:0})}async function MT(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:dr(e)}]},{retryCount:0})}async function IT(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}function CT(t){return{addChain:e=>gT(t,e),deployContract:e=>mT(t,e),getAddresses:()=>vT(t),getCallsStatus:e=>A2(t,e),getCapabilities:e=>bT(t,e),getChainId:()=>Wf(t),getPermissions:()=>yT(t),prepareAuthorization:e=>V2(t,e),prepareTransactionRequest:e=>Ug(t,e),requestAddresses:()=>wT(t),requestPermissions:e=>xT(t,e),sendCalls:e=>_C(t,e),sendRawTransaction:e=>_2(t,e),sendTransaction:e=>Qh(t,e),showCallsStatus:e=>_T(t,e),signAuthorization:e=>ET(t,e),signMessage:e=>ST(t,e),signTransaction:e=>AT(t,e),signTypedData:e=>PT(t,e),switchChain:e=>MT(t,e),waitForCallsStatus:e=>EC(t,e),watchAsset:e=>IT(t,e),writeContract:e=>wC(t,e)}}function ad(t){const{key:e="wallet",name:r="Wallet Client",transport:n}=t;return AC({...t,key:e,name:r,transport:n,type:"walletClient"}).extend(CT)}class ru{constructor(e){Ns(this,"_key");Ns(this,"_config",null);Ns(this,"_provider",null);Ns(this,"_connected",!1);Ns(this,"_address",null);Ns(this,"_fatured",!1);Ns(this,"_installed",!1);Ns(this,"lastUsed",!1);Ns(this,"_client",null);var r;if("name"in e&&"image"in e)this._key=e.name,this._config=e,this._fatured=e.featured;else if("session"in e){if(!e.session)throw new Error("session is null");this._key=(r=e.session)==null?void 0:r.peer.metadata.name,this._provider=e,this._client=ad({transport:nd(this._provider)}),this._config={name:e.session.peer.metadata.name,image:e.session.peer.metadata.icons[0],featured:!1}}else if("info"in e)this._key=e.info.name,this._provider=e.provider,this._installed=!0,this._client=ad({transport:nd(this._provider)}),this._config={name:e.info.name,image:e.info.icon,featured:!1},this.testConnect();else throw new Error("unknown params")}get address(){return this._address}get connected(){return this._connected}get featured(){return this._fatured}get key(){return this._key}get installed(){return this._installed}get provider(){return this._provider}get client(){return this._client?this._client:null}get config(){return this._config}static fromWalletConfig(e){return new ru(e)}EIP6963Detected(e){this._provider=e.provider,this._client=ad({transport:nd(this._provider)}),this._installed=!0,this._provider.on("disconnect",this.disconnect),this._provider.on("accountsChanged",r=>{this._address=r[0],this._connected=!0}),this.testConnect()}setUniversalProvider(e){this._provider=e,this._client=ad({transport:nd(this._provider)}),this.testConnect()}async switchChain(e){var r,n,i,s;try{return await((r=this.client)==null?void 0:r.getChainId())===e.id||await((n=this.client)==null?void 0:n.switchChain(e)),!0}catch(o){if(o.code===4902)return await((i=this.client)==null?void 0:i.addChain({chain:e})),await((s=this.client)==null?void 0:s.switchChain(e)),!0;throw o}}async testConnect(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());e&&e.length>0?(this._address=e[0],this._connected=!0):(this._address=null,this._connected=!1)}async connect(){var r;const e=await((r=this.client)==null?void 0:r.requestAddresses());if(!e)throw new Error("connect failed");return e}async getAddress(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());if(!e)throw new Error("get address failed");return e[0]}async getChain(){var r;const e=await((r=this.client)==null?void 0:r.getChainId());if(!e)throw new Error("get chain failed");return e}async signMessage(e,r){var i;return await((i=this.client)==null?void 0:i.signMessage({message:e,account:r}))}async disconnect(){this._provider&&"session"in this._provider&&await this._provider.disconnect(),this._connected=!1,this._address=null}}var nm={exports:{}},nu=typeof Reflect=="object"?Reflect:null,G2=nu&&typeof nu.apply=="function"?nu.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},cd;nu&&typeof nu.ownKeys=="function"?cd=nu.ownKeys:Object.getOwnPropertySymbols?cd=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:cd=function(e){return Object.getOwnPropertyNames(e)};function TT(t){console&&console.warn&&console.warn(t)}var Y2=Number.isNaN||function(e){return e!==e};function Rr(){Rr.init.call(this)}nm.exports=Rr,nm.exports.once=NT,Rr.EventEmitter=Rr,Rr.prototype._events=void 0,Rr.prototype._eventsCount=0,Rr.prototype._maxListeners=void 0;var J2=10;function ud(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Rr,"defaultMaxListeners",{enumerable:!0,get:function(){return J2},set:function(t){if(typeof t!="number"||t<0||Y2(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");J2=t}}),Rr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Rr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Y2(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function X2(t){return t._maxListeners===void 0?Rr.defaultMaxListeners:t._maxListeners}Rr.prototype.getMaxListeners=function(){return X2(this)},Rr.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")G2(u,this,r);else for(var l=u.length,d=rx(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,TT(a)}return t}Rr.prototype.addListener=function(e,r){return Z2(this,e,r,!1)},Rr.prototype.on=Rr.prototype.addListener,Rr.prototype.prependListener=function(e,r){return Z2(this,e,r,!0)};function RT(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Q2(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=RT.bind(n);return i.listener=r,n.wrapFn=i,i}Rr.prototype.once=function(e,r){return ud(r),this.on(e,Q2(this,e,r)),this},Rr.prototype.prependOnceListener=function(e,r){return ud(r),this.prependListener(e,Q2(this,e,r)),this},Rr.prototype.removeListener=function(e,r){var n,i,s,o,a;if(ud(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():DT(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Rr.prototype.off=Rr.prototype.removeListener,Rr.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function ex(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?OT(i):rx(i,i.length)}Rr.prototype.listeners=function(e){return ex(this,e,!0)},Rr.prototype.rawListeners=function(e){return ex(this,e,!1)},Rr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):tx.call(t,e)},Rr.prototype.listenerCount=tx;function tx(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Rr.prototype.eventNames=function(){return this._eventsCount>0?cd(this._events):[]};function rx(t,e){for(var r=new Array(e),n=0;n{const i=Qw(t,r);return i instanceof Bg?t:i})();return new pI(n,{docsPath:e,...r})}async function _2(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const Jg=new jh(128);async function Qh(t,e){var k,H,U,z;const{account:r=t.account,chain:n=t.chain,accessList:i,authorizationList:s,blobs:o,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:_,type:M,value:O,...L}=e;if(typeof r>"u")throw new Wa({docsPath:"/docs/actions/wallet/sendTransaction"});const B=r?fi(r):null;try{Kh(e);const Z=await(async()=>{if(e.to)return e.to;if(e.to!==null&&s&&s.length>0)return await Zw({authorization:s[0]}).catch(()=>{throw new pt("`to` is required. Could not infer from `authorizationList`.")})})();if((B==null?void 0:B.type)==="json-rpc"||B===null){let R;n!==null&&(R=await Wn(t,Wf,"getChainId")({}),w2({currentChainId:R,chain:n}));const W=(U=(H=(k=t.chain)==null?void 0:k.formatters)==null?void 0:H.transactionRequest)==null?void 0:U.format,me=(W||$g)({...e2(L,{format:W}),accessList:i,authorizationList:s,blobs:o,chainId:R,data:a,from:B==null?void 0:B.address,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:_,to:Z,type:M,value:O}),j=Jg.get(t.uid),E=j?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:E,params:[me]},{retryCount:0})}catch(m){if(j===!1)throw m;const f=m;if(f.name==="InvalidInputRpcError"||f.name==="InvalidParamsRpcError"||f.name==="MethodNotFoundRpcError"||f.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[me]},{retryCount:0}).then(g=>(Jg.set(t.uid,!0),g)).catch(g=>{const v=g;throw v.name==="MethodNotFoundRpcError"||v.name==="MethodNotSupportedRpcError"?(Jg.set(t.uid,!1),f):v});throw f}}if((B==null?void 0:B.type)==="local"){const R=await Wn(t,Ug,"prepareTransactionRequest")({account:B,accessList:i,authorizationList:s,blobs:o,chain:n,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:_,nonceManager:B.nonceManager,parameters:[...d2,"sidecars"],type:M,value:O,...L,to:Z}),W=(z=n==null?void 0:n.serializers)==null?void 0:z.transaction,ie=await B.signTransaction(R,{serializer:W});return await Wn(t,_2,"sendRawTransaction")({serializedTransaction:ie})}throw(B==null?void 0:B.type)==="smart"?new Zh({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Zh({docsPath:"/docs/actions/wallet/sendTransaction",type:B==null?void 0:B.type})}catch(Z){throw Z instanceof Zh?Z:x2(Z,{...e,account:B,chain:e.chain||void 0})}}async function wC(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:o,functionName:a,...u}=e;if(typeof n>"u")throw new Wa({docsPath:"/docs/contract/writeContract"});const l=n?fi(n):null,d=jw({abi:r,args:s,functionName:a});try{return await Wn(t,Qh,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:i,account:l,...u})}catch(p){throw EI(p,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:a,sender:l==null?void 0:l.address})}}const xC={"0x0":"reverted","0x1":"success"},E2="0x5792579257925792579257925792579257925792579257925792579257925792",S2=dr(0,{size:32});async function _C(t,e){const{account:r=t.account,capabilities:n,chain:i=t.chain,experimental_fallback:s,experimental_fallbackDelay:o=32,forceAtomic:a=!1,id:u,version:l="2.0.0"}=e,d=r?fi(r):null,p=e.calls.map(y=>{const _=y,M=_.abi?jw({abi:_.abi,functionName:_.functionName,args:_.args}):_.data;return{data:_.dataSuffix&&M?ra([M,_.dataSuffix]):M,to:_.to,value:_.value?dr(_.value):void 0}});try{const y=await t.request({method:"wallet_sendCalls",params:[{atomicRequired:a,calls:p,capabilities:n,chainId:dr(i.id),from:d==null?void 0:d.address,id:u,version:l}]},{retryCount:0});return typeof y=="string"?{id:y}:y}catch(y){const _=y;if(s&&(_.name==="MethodNotFoundRpcError"||_.name==="MethodNotSupportedRpcError"||_.name==="UnknownRpcError"||_.details.toLowerCase().includes("does not exist / is not available")||_.details.toLowerCase().includes("missing or invalid. request()")||_.details.toLowerCase().includes("did not match any variant of untagged enum")||_.details.toLowerCase().includes("account upgraded to unsupported contract")||_.details.toLowerCase().includes("eip-7702 not supported")||_.details.toLowerCase().includes("unsupported wc_ method"))){if(n&&Object.values(n).some(k=>!k.optional)){const k="non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";throw new Qc(new pt(k,{details:k}))}if(a&&p.length>1){const B="`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";throw new eu(new pt(B,{details:B}))}const M=[];for(const B of p){const k=Qh(t,{account:d,chain:i,data:B.data,to:B.to,value:B.value?Zo(B.value):void 0});M.push(k),o>0&&await new Promise(H=>setTimeout(H,o))}const O=await Promise.allSettled(M);if(O.every(B=>B.status==="rejected"))throw O[0].reason;const L=O.map(B=>B.status==="fulfilled"?B.value:S2);return{id:ra([...L,dr(i.id,{size:32}),E2])}}throw x2(y,{...e,account:d,chain:e.chain})}}async function A2(t,e){async function r(d){if(d.endsWith(E2.slice(2))){const y=Lh(xg(d,-64,-32)),_=xg(d,0,-64).slice(2).match(/.{1,64}/g),M=await Promise.all(_.map(L=>S2.slice(2)!==L?t.request({method:"eth_getTransactionReceipt",params:[`0x${L}`]},{dedupe:!0}):void 0)),O=M.some(L=>L===null)?100:M.every(L=>(L==null?void 0:L.status)==="0x1")?200:M.every(L=>(L==null?void 0:L.status)==="0x0")?500:600;return{atomic:!1,chainId:Qo(y),receipts:M.filter(Boolean),status:O,version:"2.0.0"}}return t.request({method:"wallet_getCallsStatus",params:[d]})}const{atomic:n=!1,chainId:i,receipts:s,version:o="2.0.0",...a}=await r(e.id),[u,l]=(()=>{const d=a.status;return d>=100&&d<200?["pending",d]:d>=200&&d<300?["success",d]:d>=300&&d<700?["failure",d]:d==="CONFIRMED"?["success",200]:d==="PENDING"?["pending",100]:[void 0,d]})();return{...a,atomic:n,chainId:i?Qo(i):void 0,receipts:(s==null?void 0:s.map(d=>({...d,blockNumber:Zo(d.blockNumber),gasUsed:Zo(d.gasUsed),status:xC[d.status]})))??[],statusCode:l,status:u,version:o}}async function EC(t,e){const{id:r,pollingInterval:n=t.pollingInterval,status:i=({statusCode:y})=>y>=200,timeout:s=6e4}=e,o=qa(["waitForCallsStatus",t.uid,r]),{promise:a,resolve:u,reject:l}=mC();let d;const p=bC(o,{resolve:u,reject:l},y=>{const _=yC(async()=>{const M=O=>{clearTimeout(d),_(),O(),p()};try{const O=await A2(t,{id:r});if(!i(O))return;M(()=>y.resolve(O))}catch(O){M(()=>y.reject(O))}},{interval:n,emitOnBegin:!0});return _});return d=s?setTimeout(()=>{p(),clearTimeout(d),l(new SC({id:r}))},s):void 0,await a}class SC extends pt{constructor({id:e}){super(`Timed out while waiting for call bundle with id "${e}" to be confirmed.`,{name:"WaitForCallsStatusTimeoutError"})}}const Xg=256;let ed=Xg,td;function P2(t=11){if(!td||ed+t>Xg*2){td="",ed=0;for(let e=0;e{const U=H(k);for(const Z in L)delete U[Z];const z={...k,...U};return Object.assign(z,{extend:B(z)})}}return Object.assign(L,{extend:B(L)})}const rd=new jh(8192);function PC(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(rd.get(r))return rd.get(r);const n=t().finally(()=>rd.delete(r));return rd.set(r,n),n}function MC(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const u=async({error:l})=>{const d=typeof e=="function"?e({count:a,error:l}):e;d&&await Yg(d),o({count:a+1})};try{const l=await t();i(l)}catch(l){if(a{var p;const{dedupe:i=!1,methods:s,retryDelay:o=150,retryCount:a=3,uid:u}={...e,...n},{method:l}=r;if((p=s==null?void 0:s.exclude)!=null&&p.includes(l))throw new Ha(new Error("method not supported"),{method:l});if(s!=null&&s.include&&!s.include.includes(l))throw new Ha(new Error("method not supported"),{method:l});const d=i?Bh(`${u}.${qa(r)}`):void 0;return PC(()=>MC(async()=>{try{return await t(r)}catch(y){const _=y;switch(_.code){case Pf.code:throw new Pf(_);case Mf.code:throw new Mf(_);case If.code:throw new If(_,{method:r.method});case Cf.code:throw new Cf(_);case za.code:throw new za(_);case Tf.code:throw new Tf(_);case Rf.code:throw new Rf(_);case Df.code:throw new Df(_);case Of.code:throw new Of(_);case Ha.code:throw new Ha(_,{method:r.method});case Xc.code:throw new Xc(_);case Nf.code:throw new Nf(_);case Zc.code:throw new Zc(_);case Lf.code:throw new Lf(_);case kf.code:throw new kf(_);case Bf.code:throw new Bf(_);case $f.code:throw new $f(_);case Ff.code:throw new Ff(_);case Qc.code:throw new Qc(_);case jf.code:throw new jf(_);case Uf.code:throw new Uf(_);case qf.code:throw new qf(_);case zf.code:throw new zf(_);case Hf.code:throw new Hf(_);case eu.code:throw new eu(_);case 5e3:throw new Zc(_);default:throw y instanceof pt?y:new xI(_)}}},{delay:({count:y,error:_})=>{var M;if(_&&_ instanceof Vw){const O=(M=_==null?void 0:_.headers)==null?void 0:M.get("Retry-After");if(O!=null&&O.match(/\d/))return Number.parseInt(O)*1e3}return~~(1<CC(y)}),{enabled:i,id:d})}}function CC(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Xc.code||t.code===za.code:t instanceof Vw&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function TC({key:t,methods:e,name:r,request:n,retryCount:i=3,retryDelay:s=150,timeout:o,type:a},u){const l=P2();return{config:{key:t,methods:e,name:r,request:n,retryCount:i,retryDelay:s,timeout:o,type:a},request:IC(n,{methods:e,retryCount:i,retryDelay:s,uid:l}),value:u}}function nd(t,e={}){const{key:r="custom",methods:n,name:i="Custom Provider",retryDelay:s}=e;return({retryCount:o})=>TC({key:r,methods:n,name:i,request:t.request.bind(t),retryCount:e.retryCount??o,retryDelay:s,type:"custom"})}function RC(t){return{formatters:void 0,fees:void 0,serializers:void 0,...t}}class DC extends pt{constructor({domain:e}){super(`Invalid domain "${qa(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class OC extends pt{constructor({primaryType:e,types:r}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class NC extends pt{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function LC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(u,l)=>{const d={...l};for(const p of u){const{name:y,type:_}=p;_==="address"&&(d[y]=d[y].toLowerCase())}return d},o=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return qa({domain:o,message:a,primaryType:n,types:i})}function kC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(o,a)=>{for(const u of o){const{name:l,type:d}=u,p=a[l],y=d.match(Lw);if(y&&(typeof p=="number"||typeof p=="bigint")){const[O,L,B]=y;dr(p,{signed:L==="int",size:Number.parseInt(B)/8})}if(d==="address"&&typeof p=="string"&&!gs(p))throw new ta({address:p});const _=d.match(NM);if(_){const[O,L]=_;if(L&&vn(p)!==Number.parseInt(L))throw new $P({expectedSize:Number.parseInt(L),givenSize:vn(p)})}const M=i[d];M&&($C(d),s(M,p))}};if(i.EIP712Domain&&e){if(typeof e!="object")throw new DC({domain:e});s(i.EIP712Domain,e)}if(n!=="EIP712Domain")if(i[n])s(i[n],r);else throw new OC({primaryType:n,types:i})}function BC({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},(typeof(t==null?void 0:t.chainId)=="number"||typeof(t==null?void 0:t.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function $C(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new NC({type:t})}let M2=class extends vg{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,nM(e);const n=xf(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew M2(t,e).update(r).digest();I2.create=(t,e)=>new M2(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const hi=BigInt(0),ei=BigInt(1),Ka=BigInt(2),FC=BigInt(3),C2=BigInt(4),T2=BigInt(5),R2=BigInt(8);function qi(t,e){const r=t%e;return r>=hi?r:e+r}function zi(t,e,r){let n=t;for(;e-- >hi;)n*=n,n%=r;return n}function D2(t,e){if(t===hi)throw new Error("invert: expected non-zero number");if(e<=hi)throw new Error("invert: expected positive modulus, got "+e);let r=qi(t,e),n=e,i=hi,s=ei;for(;r!==hi;){const a=n/r,u=n%r,l=i-s*a;n=r,r=u,i=s,s=l}if(n!==ei)throw new Error("invert: does not exist");return qi(i,e)}function O2(t,e){const r=(t.ORDER+ei)/C2,n=t.pow(e,r);if(!t.eql(t.sqr(n),e))throw new Error("Cannot find square root");return n}function jC(t,e){const r=(t.ORDER-T2)/R2,n=t.mul(e,Ka),i=t.pow(n,r),s=t.mul(e,i),o=t.mul(t.mul(s,Ka),i),a=t.mul(s,t.sub(o,t.ONE));if(!t.eql(t.sqr(a),e))throw new Error("Cannot find square root");return a}function UC(t){if(t1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return O2;let s=i.pow(n,e);const o=(e+ei)/Ka;return function(u,l){if(u.is0(l))return l;if(L2(u,l)!==1)throw new Error("Cannot find square root");let d=r,p=u.mul(u.ONE,s),y=u.pow(l,e),_=u.pow(l,o);for(;!u.eql(y,u.ONE);){if(u.is0(y))return u.ZERO;let M=1,O=u.sqr(y);for(;!u.eql(O,u.ONE);)if(M++,O=u.sqr(O),M===d)throw new Error("Cannot find square root");const L=ei<(n[i]="function",n),e);return Kg(t,r),t}function WC(t,e,r){if(rhi;)r&ei&&(n=t.mul(n,i)),i=t.sqr(i),r>>=ei;return n}function N2(t,e,r=!1){const n=new Array(e.length).fill(r?t.ZERO:void 0),i=e.reduce((o,a,u)=>t.is0(a)?o:(n[u]=o,t.mul(o,a)),t.ONE),s=t.inv(i);return e.reduceRight((o,a,u)=>t.is0(a)?o:(n[u]=t.mul(o,n[u]),t.mul(o,a)),s),n}function L2(t,e){const r=(t.ORDER-ei)/Ka,n=t.pow(e,r),i=t.eql(n,t.ONE),s=t.eql(n,t.ZERO),o=t.eql(n,t.neg(t.ONE));if(!i&&!s&&!o)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function KC(t,e){e!==void 0&&wf(e);const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function id(t,e,r=!1,n={}){if(t<=hi)throw new Error("invalid field: expected ORDER > 0, got "+t);let i,s;if(typeof e=="object"&&e!=null){if(n.sqrt||r)throw new Error("cannot specify opts in two arguments");const d=e;d.BITS&&(i=d.BITS),d.sqrt&&(s=d.sqrt),typeof d.isLE=="boolean"&&(r=d.isLE)}else typeof e=="number"&&(i=e),n.sqrt&&(s=n.sqrt);const{nBitLength:o,nByteLength:a}=KC(t,i);if(a>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let u;const l=Object.freeze({ORDER:t,isLE:r,BITS:o,BYTES:a,MASK:Xh(o),ZERO:hi,ONE:ei,create:d=>qi(d,t),isValid:d=>{if(typeof d!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof d);return hi<=d&&dd===hi,isValidNot0:d=>!l.is0(d)&&l.isValid(d),isOdd:d=>(d&ei)===ei,neg:d=>qi(-d,t),eql:(d,p)=>d===p,sqr:d=>qi(d*d,t),add:(d,p)=>qi(d+p,t),sub:(d,p)=>qi(d-p,t),mul:(d,p)=>qi(d*p,t),pow:(d,p)=>WC(l,d,p),div:(d,p)=>qi(d*D2(p,t),t),sqrN:d=>d*d,addN:(d,p)=>d+p,subN:(d,p)=>d-p,mulN:(d,p)=>d*p,inv:d=>D2(d,t),sqrt:s||(d=>(u||(u=qC(t)),u(l,d))),toBytes:d=>r?v2(d,a):Hg(d,a),fromBytes:d=>{if(d.length!==a)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+d.length);return r?m2(d):Jh(d)},invertBatch:d=>N2(l,d),cmov:(d,p,y)=>y?p:d});return Object.freeze(l)}function k2(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function B2(t){const e=k2(t);return e+Math.ceil(e/2)}function VC(t,e,r=!1){const n=t.length,i=k2(e),s=B2(e);if(n<16||n1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);const o=r?m2(t):Jh(t),a=qi(o,e-ei)+ei;return r?v2(a,i):Hg(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ru=BigInt(0),Va=BigInt(1);function Kf(t,e){const r=e.negate();return t?r:e}function GC(t,e,r){const n=o=>o.pz,i=N2(t.Fp,r.map(n));return r.map((o,a)=>o.toAffine(i[a])).map(t.fromAffine)}function $2(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function Zg(t,e){$2(t,e);const r=Math.ceil(e/t)+1,n=2**(t-1),i=2**t,s=Xh(t),o=BigInt(t);return{windows:r,windowSize:n,mask:s,maxNumber:i,shiftBy:o}}function F2(t,e,r){const{windowSize:n,mask:i,maxNumber:s,shiftBy:o}=r;let a=Number(t&i),u=t>>o;a>n&&(a-=s,u+=Va);const l=e*n,d=l+Math.abs(a)-1,p=a===0,y=a<0,_=e%2!==0;return{nextN:u,offset:d,isZero:p,isNeg:y,isNegF:_,offsetF:l}}function YC(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function JC(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}const Qg=new WeakMap,j2=new WeakMap;function em(t){return j2.get(t)||1}function U2(t){if(t!==ru)throw new Error("invalid wNAF")}function XC(t,e){return{constTimeNegate:Kf,hasPrecomputes(r){return em(r)!==1},unsafeLadder(r,n,i=t.ZERO){let s=r;for(;n>ru;)n&Va&&(i=i.add(s)),s=s.double(),n>>=Va;return i},precomputeWindow(r,n){const{windows:i,windowSize:s}=Zg(n,e),o=[];let a=r,u=a;for(let l=0;lru||n>ru;)r&Va&&(s=s.add(i)),n&Va&&(o=o.add(i)),i=i.double(),r>>=Va,n>>=Va;return{p1:s,p2:o}}function QC(t,e,r,n){YC(r,t),JC(n,e);const i=r.length,s=n.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");const o=t.ZERO,a=lC(BigInt(i));let u=1;a>12?u=a-3:a>4?u=a-2:a>0&&(u=2);const l=Xh(u),d=new Array(Number(l)+1).fill(o),p=Math.floor((e.BITS-1)/u)*u;let y=o;for(let _=p;_>=0;_-=u){d.fill(o);for(let O=0;O>BigInt(_)&l);d[B]=d[B].add(r[O])}let M=o;for(let O=d.length-1,L=o;O>0;O--)L=L.add(d[O]),M=M.add(L);if(y=y.add(M),_!==0)for(let O=0;Oru))throw new Error(`CURVE.${a} must be positive bigint`)}const n=q2(e.p,r.Fp),i=q2(e.n,r.Fn),o=["Gx","Gy","a","b"];for(const a of o)if(!n.isValid(e[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return{Fp:n,Fn:i}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function z2(t){t.lowS!==void 0&&Gh("lowS",t.lowS),t.prehash!==void 0&&Gh("prehash",t.prehash)}class tT extends Error{constructor(e=""){super(e)}}const go={Err:tT,_tlv:{encode:(t,e)=>{const{Err:r}=go;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=Yh(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?Yh(i.length/2|128):"";return Yh(t)+s+i+e},decode(t,e){const{Err:r}=go;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");const l=e.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const d of l)o=o<<8|d;if(n+=u,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=go;if(t{const{px:me,py:j,pz:E}=W;if(r.eql(E,r.ONE))return{x:me,y:j};const m=W.is0();ie==null&&(ie=m?r.ONE:r.inv(E));const f=r.mul(me,ie),g=r.mul(j,ie),v=r.mul(E,ie);if(m)return{x:r.ZERO,y:r.ZERO};if(!r.eql(v,r.ONE))throw new Error("invZ was invalid");return{x:f,y:g}}),H=b2(W=>{if(W.is0()){if(e.allowInfinityPoint&&!r.is0(W.py))return;throw new Error("bad point: ZERO")}const{x:ie,y:me}=W.toAffine();if(!r.isValid(ie)||!r.isValid(me))throw new Error("bad point: x or y not field elements");if(!_(ie,me))throw new Error("bad point: equation left != right");if(!W.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function U(W,ie,me,j,E){return me=new z(r.mul(me.px,W),me.py,me.pz),ie=Kf(j,ie),me=Kf(E,me),ie.add(me)}class z{constructor(ie,me,j){this.px=L("x",ie),this.py=L("y",me,!0),this.pz=L("z",j),Object.freeze(this)}static fromAffine(ie){const{x:me,y:j}=ie||{};if(!ie||!r.isValid(me)||!r.isValid(j))throw new Error("invalid affine point");if(ie instanceof z)throw new Error("projective point not allowed");return r.is0(me)&&r.is0(j)?z.ZERO:new z(me,j,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(ie){return GC(z,"pz",ie)}static fromBytes(ie){return ps(ie),z.fromHex(ie)}static fromHex(ie){const me=z.fromAffine(p(Ui("pointHex",ie)));return me.assertValidity(),me}static fromPrivateKey(ie){const me=H2(n,e.allowedPrivateKeyLengths,e.wrapPrivateKey);return z.BASE.multiply(me(ie))}static msm(ie,me){return QC(z,n,ie,me)}precompute(ie=8,me=!0){return R.setWindowSize(this,ie),me||this.multiply(sd),this}_setWindowSize(ie){this.precompute(ie)}assertValidity(){H(this)}hasEvenY(){const{y:ie}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(ie)}equals(ie){B(ie);const{px:me,py:j,pz:E}=this,{px:m,py:f,pz:g}=ie,v=r.eql(r.mul(me,g),r.mul(m,E)),x=r.eql(r.mul(j,g),r.mul(f,E));return v&&x}negate(){return new z(this.px,r.neg(this.py),this.pz)}double(){const{a:ie,b:me}=t,j=r.mul(me,sd),{px:E,py:m,pz:f}=this;let g=r.ZERO,v=r.ZERO,x=r.ZERO,S=r.mul(E,E),A=r.mul(m,m),b=r.mul(f,f),P=r.mul(E,m);return P=r.add(P,P),x=r.mul(E,f),x=r.add(x,x),g=r.mul(ie,x),v=r.mul(j,b),v=r.add(g,v),g=r.sub(A,v),v=r.add(A,v),v=r.mul(g,v),g=r.mul(P,g),x=r.mul(j,x),b=r.mul(ie,b),P=r.sub(S,b),P=r.mul(ie,P),P=r.add(P,x),x=r.add(S,S),S=r.add(x,S),S=r.add(S,b),S=r.mul(S,P),v=r.add(v,S),b=r.mul(m,f),b=r.add(b,b),S=r.mul(b,P),g=r.sub(g,S),x=r.mul(b,A),x=r.add(x,x),x=r.add(x,x),new z(g,v,x)}add(ie){B(ie);const{px:me,py:j,pz:E}=this,{px:m,py:f,pz:g}=ie;let v=r.ZERO,x=r.ZERO,S=r.ZERO;const A=t.a,b=r.mul(t.b,sd);let P=r.mul(me,m),I=r.mul(j,f),F=r.mul(E,g),ce=r.add(me,j),D=r.add(m,f);ce=r.mul(ce,D),D=r.add(P,I),ce=r.sub(ce,D),D=r.add(me,E);let se=r.add(m,g);return D=r.mul(D,se),se=r.add(P,F),D=r.sub(D,se),se=r.add(j,E),v=r.add(f,g),se=r.mul(se,v),v=r.add(I,F),se=r.sub(se,v),S=r.mul(A,D),v=r.mul(b,F),S=r.add(v,S),v=r.sub(I,S),S=r.add(I,S),x=r.mul(v,S),I=r.add(P,P),I=r.add(I,P),F=r.mul(A,F),D=r.mul(b,D),I=r.add(I,F),F=r.sub(P,F),F=r.mul(A,F),D=r.add(D,F),P=r.mul(I,D),x=r.add(x,P),P=r.mul(se,D),v=r.mul(ce,v),v=r.sub(v,P),P=r.mul(ce,I),S=r.mul(se,S),S=r.add(S,P),new z(v,x,S)}subtract(ie){return this.add(ie.negate())}is0(){return this.equals(z.ZERO)}multiply(ie){const{endo:me}=e;if(!n.isValidNot0(ie))throw new Error("invalid scalar: out of range");let j,E;const m=f=>R.wNAFCached(this,f,z.normalizeZ);if(me){const{k1neg:f,k1:g,k2neg:v,k2:x}=me.splitScalar(ie),{p:S,f:A}=m(g),{p:b,f:P}=m(x);E=A.add(P),j=U(me.beta,S,b,f,v)}else{const{p:f,f:g}=m(ie);j=f,E=g}return z.normalizeZ([j,E])[0]}multiplyUnsafe(ie){const{endo:me}=e,j=this;if(!n.isValid(ie))throw new Error("invalid scalar: out of range");if(ie===Vf||j.is0())return z.ZERO;if(ie===Gf)return j;if(R.hasPrecomputes(this))return this.multiply(ie);if(me){const{k1neg:E,k1:m,k2neg:f,k2:g}=me.splitScalar(ie),{p1:v,p2:x}=ZC(z,j,m,g);return U(me.beta,v,x,E,f)}else return R.wNAFCachedUnsafe(j,ie)}multiplyAndAddUnsafe(ie,me,j){const E=this.multiplyUnsafe(me).add(ie.multiplyUnsafe(j));return E.is0()?void 0:E}toAffine(ie){return k(this,ie)}isTorsionFree(){const{isTorsionFree:ie}=e;return i===Gf?!0:ie?ie(z,this):R.wNAFCachedUnsafe(this,s).is0()}clearCofactor(){const{clearCofactor:ie}=e;return i===Gf?this:ie?ie(z,this):this.multiplyUnsafe(i)}toBytes(ie=!0){return Gh("isCompressed",ie),this.assertValidity(),d(z,this,ie)}toRawBytes(ie=!0){return this.toBytes(ie)}toHex(ie=!0){return Yc(this.toBytes(ie))}toString(){return``}}z.BASE=new z(t.Gx,t.Gy,r.ONE),z.ZERO=new z(r.ZERO,r.ONE,r.ZERO),z.Fp=r,z.Fn=n;const Z=n.BITS,R=XC(z,e.endo?Math.ceil(Z/2):Z);return z}function W2(t){return Uint8Array.of(t?2:3)}function oT(t,e,r={}){Kg(e,{hash:"function"},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const n=e.randomBytes||lM,i=e.hmac||((j,...E)=>I2(e.hash,j,Ua(...E))),{Fp:s,Fn:o}=t,{ORDER:a,BITS:u}=o;function l(j){const E=a>>Gf;return j>E}function d(j){return l(j)?o.neg(j):j}function p(j,E){if(!o.isValidNot0(E))throw new Error(`invalid signature ${j}: out of range 1..CURVE.n`)}class y{constructor(E,m,f){p("r",E),p("s",m),this.r=E,this.s=m,f!=null&&(this.recovery=f),Object.freeze(this)}static fromCompact(E){const m=o.BYTES,f=Ui("compactSignature",E,m*2);return new y(o.fromBytes(f.subarray(0,m)),o.fromBytes(f.subarray(m,m*2)))}static fromDER(E){const{r:m,s:f}=go.toSig(Ui("DER",E));return new y(m,f)}assertValidity(){}addRecoveryBit(E){return new y(this.r,this.s,E)}recoverPublicKey(E){const m=s.ORDER,{r:f,s:g,recovery:v}=this;if(v==null||![0,1,2,3].includes(v))throw new Error("recovery id invalid");if(a*rT1)throw new Error("recovery id is ambiguous for h>1 curve");const S=v===2||v===3?f+a:f;if(!s.isValid(S))throw new Error("recovery id 2 or 3 invalid");const A=s.toBytes(S),b=t.fromHex(Ua(W2((v&1)===0),A)),P=o.inv(S),I=H(Ui("msgHash",E)),F=o.create(-I*P),ce=o.create(g*P),D=t.BASE.multiplyUnsafe(F).add(b.multiplyUnsafe(ce));if(D.is0())throw new Error("point at infinify");return D.assertValidity(),D}hasHighS(){return l(this.s)}normalizeS(){return this.hasHighS()?new y(this.r,o.neg(this.s),this.recovery):this}toBytes(E){if(E==="compact")return Ua(o.toBytes(this.r),o.toBytes(this.s));if(E==="der")return mg(go.hexFromSig(this));throw new Error("invalid format")}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return Yc(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return Yc(this.toBytes("compact"))}}const _=H2(o,r.allowedPrivateKeyLengths,r.wrapPrivateKey),M={isValidPrivateKey(j){try{return _(j),!0}catch{return!1}},normPrivateKeyToScalar:_,randomPrivateKey:()=>{const j=a;return VC(n(B2(j)),j)},precompute(j=8,E=t.BASE){return E.precompute(j,!1)}};function O(j,E=!0){return t.fromPrivateKey(j).toBytes(E)}function L(j){if(typeof j=="bigint")return!1;if(j instanceof t)return!0;const m=Ui("key",j).length,f=s.BYTES,g=f+1,v=2*f+1;if(!(r.allowedPrivateKeyLengths||o.BYTES===g))return m===g||m===v}function B(j,E,m=!0){if(L(j)===!0)throw new Error("first arg must be private key");if(L(E)===!1)throw new Error("second arg must be public key");return t.fromHex(E).multiply(_(j)).toBytes(m)}const k=e.bits2int||function(j){if(j.length>8192)throw new Error("input is too large");const E=Jh(j),m=j.length*8-u;return m>0?E>>BigInt(m):E},H=e.bits2int_modN||function(j){return o.create(k(j))},U=Xh(u);function z(j){return fC("num < 2^"+u,j,Vf,U),o.toBytes(j)}function Z(j,E,m=R){if(["recovered","canonical"].some(ce=>ce in m))throw new Error("sign() legacy options not supported");const{hash:f}=e;let{lowS:g,prehash:v,extraEntropy:x}=m;g==null&&(g=!0),j=Ui("msgHash",j),z2(m),v&&(j=Ui("prehashed msgHash",f(j)));const S=H(j),A=_(E),b=[z(A),z(S)];if(x!=null&&x!==!1){const ce=x===!0?n(s.BYTES):x;b.push(Ui("extraEntropy",ce))}const P=Ua(...b),I=S;function F(ce){const D=k(ce);if(!o.isValidNot0(D))return;const se=o.inv(D),ee=t.BASE.multiply(D).toAffine(),J=o.create(ee.x);if(J===Vf)return;const Q=o.create(se*o.create(I+J*A));if(Q===Vf)return;let T=(ee.x===J?0:2)|Number(ee.y&Gf),X=Q;return g&&l(Q)&&(X=d(Q),T^=1),new y(J,X,T)}return{seed:P,k2sig:F}}const R={lowS:e.lowS,prehash:!1},W={lowS:e.lowS,prehash:!1};function ie(j,E,m=R){const{seed:f,k2sig:g}=Z(j,E,m);return hC(e.hash.outputLen,o.BYTES,i)(f,g)}t.BASE.precompute(8);function me(j,E,m,f=W){const g=j;E=Ui("msgHash",E),m=Ui("publicKey",m),z2(f);const{lowS:v,prehash:x,format:S}=f;if("strict"in f)throw new Error("options.strict was renamed to lowS");if(S!==void 0&&!["compact","der","js"].includes(S))throw new Error('format must be "compact", "der" or "js"');const A=typeof g=="string"||pg(g),b=!A&&!S&&typeof g=="object"&&g!==null&&typeof g.r=="bigint"&&typeof g.s=="bigint";if(!A&&!b)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let P,I;try{if(b)if(S===void 0||S==="js")P=new y(g.r,g.s);else throw new Error("invalid format");if(A){try{S!=="compact"&&(P=y.fromDER(g))}catch(X){if(!(X instanceof go.Err))throw X}!P&&S!=="der"&&(P=y.fromCompact(g))}I=t.fromHex(m)}catch{return!1}if(!P||v&&P.hasHighS())return!1;x&&(E=e.hash(E));const{r:F,s:ce}=P,D=H(E),se=o.inv(ce),ee=o.create(D*se),J=o.create(F*se),Q=t.BASE.multiplyUnsafe(ee).add(I.multiplyUnsafe(J));return Q.is0()?!1:o.create(Q.x)===F}return Object.freeze({getPublicKey:O,getSharedSecret:B,sign:ie,verify:me,utils:M,Point:t,Signature:y})}function aT(t){const e={a:t.a,b:t.b,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r=t.Fp,n=id(e.n,t.nBitLength),i={Fp:r,Fn:n,allowedPrivateKeyLengths:t.allowedPrivateKeyLengths,allowInfinityPoint:t.allowInfinityPoint,endo:t.endo,wrapPrivateKey:t.wrapPrivateKey,isTorsionFree:t.isTorsionFree,clearCofactor:t.clearCofactor,fromBytes:t.fromBytes,toBytes:t.toBytes};return{CURVE:e,curveOpts:i}}function cT(t){const{CURVE:e,curveOpts:r}=aT(t),n={hash:t.hash,hmac:t.hmac,randomBytes:t.randomBytes,lowS:t.lowS,bits2int:t.bits2int,bits2int_modN:t.bits2int_modN};return{CURVE:e,curveOpts:r,ecdsaOpts:n}}function uT(t,e){return Object.assign({},e,{ProjectivePoint:e.Point,CURVE:t})}function fT(t){const{CURVE:e,curveOpts:r,ecdsaOpts:n}=cT(t),i=sT(e,r),s=oT(i,n,r);return uT(t,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function lT(t,e){const r=n=>fT({...t,hash:n});return{...r(e),create:r}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const od={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")};BigInt(0);const hT=BigInt(1),tm=BigInt(2),K2=(t,e)=>(t+e/tm)/e;function dT(t){const e=od.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),u=BigInt(88),l=t*t*t%e,d=l*l*t%e,p=zi(d,r,e)*d%e,y=zi(p,r,e)*d%e,_=zi(y,tm,e)*l%e,M=zi(_,i,e)*_%e,O=zi(M,s,e)*M%e,L=zi(O,a,e)*O%e,B=zi(L,u,e)*L%e,k=zi(B,a,e)*O%e,H=zi(k,r,e)*d%e,U=zi(H,o,e)*M%e,z=zi(U,n,e)*l%e,Z=zi(z,tm,e);if(!rm.eql(rm.sqr(Z),t))throw new Error("Cannot find square root");return Z}const rm=id(od.p,void 0,void 0,{sqrt:dT}),pT=lT({...od,Fp:rm,lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=od.n,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-hT*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=K2(s*t,e),u=K2(-n*t,e);let l=qi(t-a*r-u*i,e),d=qi(-a*n-u*s,e);const p=l>o,y=d>o;if(p&&(l=e-l),y&&(d=e-d),l>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:p,k1:l,k2neg:y,k2:d}}}},a2),gT=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:pT},Symbol.toStringTag,{value:"Module"}));async function mT(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:dr(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}function vT(t,e){const{abi:r,args:n,bytecode:i,...s}=e,o=gC({abi:r,args:n,bytecode:i});return Qh(t,{...s,...s.authorizationList?{to:null}:{},data:o})}async function bT(t){var r;return((r=t.account)==null?void 0:r.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(n=>Sf(n))}async function yT(t,e={}){const{account:r=t.account,chainId:n}=e,i=r?fi(r):void 0,s=n?[i==null?void 0:i.address,[dr(n)]]:[i==null?void 0:i.address],o=await t.request({method:"wallet_getCapabilities",params:s}),a={};for(const[u,l]of Object.entries(o)){a[Number(u)]={};for(let[d,p]of Object.entries(l))d==="addSubAccount"&&(d="unstable_addSubAccount"),a[Number(u)][d]=p}return typeof n=="number"?a[n]:a}async function wT(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}async function V2(t,e){var u;const{account:r=t.account,chainId:n,nonce:i}=e;if(!r)throw new Wa({docsPath:"/docs/eip7702/prepareAuthorization"});const s=fi(r),o=(()=>{if(e.executor)return e.executor==="self"?e.executor:fi(e.executor)})(),a={address:e.contractAddress??e.address,chainId:n,nonce:i};return typeof a.chainId>"u"&&(a.chainId=((u=t.chain)==null?void 0:u.id)??await Wn(t,Wf,"getChainId")({})),typeof a.nonce>"u"&&(a.nonce=await Wn(t,i2,"getTransactionCount")({address:s.address,blockTag:"pending"}),(o==="self"||o!=null&&o.address&&cC(o.address,s.address))&&(a.nonce+=1)),a}async function xT(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>yg(r))}async function _T(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function ET(t,e){const{id:r}=e;await t.request({method:"wallet_showCallsStatus",params:[r]})}async function ST(t,e){const{account:r=t.account}=e;if(!r)throw new Wa({docsPath:"/docs/eip7702/signAuthorization"});const n=fi(r);if(!n.signAuthorization)throw new Zh({docsPath:"/docs/eip7702/signAuthorization",metaMessages:["The `signAuthorization` Action does not support JSON-RPC Accounts."],type:n.type});const i=await V2(t,e);return n.signAuthorization(i)}async function AT(t,{account:e=t.account,message:r}){if(!e)throw new Wa({docsPath:"/docs/actions/wallet/signMessage"});const n=fi(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Bh(r):r.raw instanceof Uint8Array?kh(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function PT(t,e){var l,d,p,y;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new Wa({docsPath:"/docs/actions/wallet/signTransaction"});const s=fi(r);Kh({account:s,...e});const o=await Wn(t,Wf,"getChainId")({});n!==null&&w2({currentChainId:o,chain:n});const a=(n==null?void 0:n.formatters)||((l=t.chain)==null?void 0:l.formatters),u=((d=a==null?void 0:a.transactionRequest)==null?void 0:d.format)||$g;return s.signTransaction?s.signTransaction({...i,chainId:o},{serializer:(y=(p=t.chain)==null?void 0:p.serializers)==null?void 0:y.transaction}):await t.request({method:"eth_signTransaction",params:[{...u(i),chainId:dr(o),from:s.address}]},{retryCount:0})}async function MT(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new Wa({docsPath:"/docs/actions/wallet/signTypedData"});const o=fi(r),a={EIP712Domain:BC({domain:n}),...e.types};if(kC({domain:n,message:i,primaryType:s,types:a}),o.signTypedData)return o.signTypedData({domain:n,message:i,primaryType:s,types:a});const u=LC({domain:n,message:i,primaryType:s,types:a});return t.request({method:"eth_signTypedData_v4",params:[o.address,u]},{retryCount:0})}async function IT(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:dr(e)}]},{retryCount:0})}async function CT(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}function TT(t){return{addChain:e=>mT(t,e),deployContract:e=>vT(t,e),getAddresses:()=>bT(t),getCallsStatus:e=>A2(t,e),getCapabilities:e=>yT(t,e),getChainId:()=>Wf(t),getPermissions:()=>wT(t),prepareAuthorization:e=>V2(t,e),prepareTransactionRequest:e=>Ug(t,e),requestAddresses:()=>xT(t),requestPermissions:e=>_T(t,e),sendCalls:e=>_C(t,e),sendRawTransaction:e=>_2(t,e),sendTransaction:e=>Qh(t,e),showCallsStatus:e=>ET(t,e),signAuthorization:e=>ST(t,e),signMessage:e=>AT(t,e),signTransaction:e=>PT(t,e),signTypedData:e=>MT(t,e),switchChain:e=>IT(t,e),waitForCallsStatus:e=>EC(t,e),watchAsset:e=>CT(t,e),writeContract:e=>wC(t,e)}}function ad(t){const{key:e="wallet",name:r="Wallet Client",transport:n}=t;return AC({...t,key:e,name:r,transport:n,type:"walletClient"}).extend(TT)}class Ga{constructor(e){Ns(this,"_key");Ns(this,"_config",null);Ns(this,"_provider",null);Ns(this,"_connected",!1);Ns(this,"_address",null);Ns(this,"_fatured",!1);Ns(this,"_installed",!1);Ns(this,"lastUsed",!1);Ns(this,"_client",null);var r;if("name"in e&&"image"in e)this._key=e.name,this._config=e,this._fatured=e.featured;else if("session"in e){if(!e.session)throw new Error("session is null");this._key=(r=e.session)==null?void 0:r.peer.metadata.name,this._provider=e,this._client=ad({transport:nd(this._provider)}),this._config={name:e.session.peer.metadata.name,image:e.session.peer.metadata.icons[0],featured:!1},this.testConnect()}else if("info"in e)this._key=e.info.name,this._provider=e.provider,this._installed=!0,this._client=ad({transport:nd(this._provider)}),this._config={name:e.info.name,image:e.info.icon,featured:!1},this.testConnect();else throw new Error("unknown params")}get address(){return this._address}get connected(){return this._connected}get featured(){return this._fatured}get key(){return this._key}get installed(){return this._installed}get provider(){return this._provider}get client(){return this._client?this._client:null}get config(){return this._config}static fromWalletConfig(e){return new Ga(e)}EIP6963Detected(e){this._provider=e.provider,this._client=ad({transport:nd(this._provider)}),this._installed=!0,this._provider.on("disconnect",this.disconnect),this._provider.on("accountsChanged",r=>{this._address=r[0],this._connected=!0}),this.testConnect()}setUniversalProvider(e){this._provider=e,this._client=ad({transport:nd(this._provider)}),this.testConnect()}async switchChain(e){var r,n,i,s;try{return await((r=this.client)==null?void 0:r.getChainId())===e.id||await((n=this.client)==null?void 0:n.switchChain(e)),!0}catch(o){if(o.code===4902)return await((i=this.client)==null?void 0:i.addChain({chain:e})),await((s=this.client)==null?void 0:s.switchChain(e)),!0;throw o}}async testConnect(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());e&&e.length>0?(this._address=e[0],this._connected=!0):(this._address=null,this._connected=!1)}async connect(){var r;const e=await((r=this.client)==null?void 0:r.requestAddresses());if(!e)throw new Error("connect failed");return e}async getAddress(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());if(!e)throw new Error("get address failed");return e[0]}async getChain(){var r;const e=await((r=this.client)==null?void 0:r.getChainId());if(!e)throw new Error("get chain failed");return e}async signMessage(e,r){var i;return await((i=this.client)==null?void 0:i.signMessage({message:e,account:r}))}async disconnect(){this._provider&&"session"in this._provider&&await this._provider.disconnect(),this._connected=!1,this._address=null}}var nm={exports:{}},nu=typeof Reflect=="object"?Reflect:null,G2=nu&&typeof nu.apply=="function"?nu.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},cd;nu&&typeof nu.ownKeys=="function"?cd=nu.ownKeys:Object.getOwnPropertySymbols?cd=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:cd=function(e){return Object.getOwnPropertyNames(e)};function RT(t){console&&console.warn&&console.warn(t)}var Y2=Number.isNaN||function(e){return e!==e};function Rr(){Rr.init.call(this)}nm.exports=Rr,nm.exports.once=LT,Rr.EventEmitter=Rr,Rr.prototype._events=void 0,Rr.prototype._eventsCount=0,Rr.prototype._maxListeners=void 0;var J2=10;function ud(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Rr,"defaultMaxListeners",{enumerable:!0,get:function(){return J2},set:function(t){if(typeof t!="number"||t<0||Y2(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");J2=t}}),Rr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Rr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Y2(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function X2(t){return t._maxListeners===void 0?Rr.defaultMaxListeners:t._maxListeners}Rr.prototype.getMaxListeners=function(){return X2(this)},Rr.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")G2(u,this,r);else for(var l=u.length,d=rx(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,RT(a)}return t}Rr.prototype.addListener=function(e,r){return Z2(this,e,r,!1)},Rr.prototype.on=Rr.prototype.addListener,Rr.prototype.prependListener=function(e,r){return Z2(this,e,r,!0)};function DT(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Q2(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=DT.bind(n);return i.listener=r,n.wrapFn=i,i}Rr.prototype.once=function(e,r){return ud(r),this.on(e,Q2(this,e,r)),this},Rr.prototype.prependOnceListener=function(e,r){return ud(r),this.prependListener(e,Q2(this,e,r)),this},Rr.prototype.removeListener=function(e,r){var n,i,s,o,a;if(ud(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():OT(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Rr.prototype.off=Rr.prototype.removeListener,Rr.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function ex(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?NT(i):rx(i,i.length)}Rr.prototype.listeners=function(e){return ex(this,e,!0)},Rr.prototype.rawListeners=function(e){return ex(this,e,!1)},Rr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):tx.call(t,e)},Rr.prototype.listenerCount=tx;function tx(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Rr.prototype.eventNames=function(){return this._eventsCount>0?cd(this._events):[]};function rx(t,e){for(var r=new Array(e),n=0;n=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function FT(t,e){return function(r,n){e(r,n,t)}}function jT(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function UT(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(d){try{l(n.next(d))}catch(p){o(p)}}function u(d){try{l(n.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):i(d.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function qT(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return u([l,d])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ix(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function WT(){for(var t=[],e=0;e1||a(y,_)})})}function a(y,_){try{u(n[y](_))}catch(M){p(s[0][3],M)}}function u(y){y.value instanceof Yf?Promise.resolve(y.value.v).then(l,d):p(s[0][2],y)}function l(y){a("next",y)}function d(y){a("throw",y)}function p(y,_){y(_),s.shift(),s.length&&a(s[0][0],s[0][1])}}function GT(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Yf(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function YT(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof am=="function"?am(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function JT(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function XT(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function ZT(t){return t&&t.__esModule?t:{default:t}}function QT(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function eR(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const Jf=cg(Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return om},__asyncDelegator:GT,__asyncGenerator:VT,__asyncValues:YT,__await:Yf,__awaiter:UT,__classPrivateFieldGet:QT,__classPrivateFieldSet:eR,__createBinding:zT,__decorate:$T,__exportStar:HT,__extends:kT,__generator:qT,__importDefault:ZT,__importStar:XT,__makeTemplateObject:JT,__metadata:jT,__param:FT,__read:ix,__rest:BT,__spread:WT,__spreadArrays:KT,__values:am},Symbol.toStringTag,{value:"Module"})));var cm={},Xf={},sx;function tR(){if(sx)return Xf;sx=1,Object.defineProperty(Xf,"__esModule",{value:!0}),Xf.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Xf.delay=t,Xf}var Ga={},um={},Ya={},ox;function rR(){return ox||(ox=1,Object.defineProperty(Ya,"__esModule",{value:!0}),Ya.ONE_THOUSAND=Ya.ONE_HUNDRED=void 0,Ya.ONE_HUNDRED=100,Ya.ONE_THOUSAND=1e3),Ya}var fm={},ax;function nR(){return ax||(ax=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(fm)),fm}var cx;function ux(){return cx||(cx=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Jf;e.__exportStar(rR(),t),e.__exportStar(nR(),t)}(um)),um}var fx;function iR(){if(fx)return Ga;fx=1,Object.defineProperty(Ga,"__esModule",{value:!0}),Ga.fromMiliseconds=Ga.toMiliseconds=void 0;const t=ux();function e(n){return n*t.ONE_THOUSAND}Ga.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return Ga.fromMiliseconds=r,Ga}var lx;function sR(){return lx||(lx=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Jf;e.__exportStar(tR(),t),e.__exportStar(iR(),t)}(cm)),cm}var iu={},hx;function oR(){if(hx)return iu;hx=1,Object.defineProperty(iu,"__esModule",{value:!0}),iu.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return iu.Watch=t,iu.default=t,iu}var lm={},Zf={},dx;function aR(){if(dx)return Zf;dx=1,Object.defineProperty(Zf,"__esModule",{value:!0}),Zf.IWatch=void 0;class t{}return Zf.IWatch=t,Zf}var px;function cR(){return px||(px=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Jf.__exportStar(aR(),t)}(lm)),lm}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Jf;e.__exportStar(sR(),t),e.__exportStar(oR(),t),e.__exportStar(cR(),t),e.__exportStar(ux(),t)})(vt);class Ja{}let uR=class extends Ja{constructor(e){super()}};const gx=vt.FIVE_SECONDS,su={pulse:"heartbeat_pulse"};let fR=class EP extends uR{constructor(e){super(e),this.events=new Hi.EventEmitter,this.interval=gx,this.interval=(e==null?void 0:e.interval)||gx}static async init(e){const r=new EP(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),vt.toMiliseconds(this.interval))}pulse(){this.events.emit(su.pulse)}};const lR=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,hR=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,dR=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function pR(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){gR(t);return}return e}function gR(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function fd(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!dR.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(lR.test(t)||hR.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,pR)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function mR(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Mn(t,...e){try{return mR(t(...e))}catch(r){return Promise.reject(r)}}function vR(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function bR(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function ld(t){if(vR(t))return String(t);if(bR(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return ld(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function mx(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const hm="base64:";function yR(t){if(typeof t=="string")return t;mx();const e=Buffer.from(t).toString("base64");return hm+e}function wR(t){return typeof t!="string"||!t.startsWith(hm)?t:(mx(),Buffer.from(t.slice(hm.length),"base64"))}function di(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function xR(...t){return di(t.join(":"))}function hd(t){return t=di(t),t?t+":":""}function Koe(t){return t}const _R="memory",ER=()=>{const t=new Map;return{name:_R,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function SR(t={}){const e={mounts:{"":t.driver||ER()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const d of e.mountpoints)if(l.startsWith(d))return{base:d,relativeKey:l.slice(d.length),driver:e.mounts[d]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,d)=>e.mountpoints.filter(p=>p.startsWith(l)||d&&l.startsWith(p)).map(p=>({relativeBase:l.length>p.length?l.slice(p.length):void 0,mountpoint:p,driver:e.mounts[p]})),i=(l,d)=>{if(e.watching){d=di(d);for(const p of e.watchListeners)p(l,d)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await vx(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,d,p)=>{const y=new Map,_=M=>{let O=y.get(M.base);return O||(O={driver:M.driver,base:M.base,items:[]},y.set(M.base,O)),O};for(const M of l){const O=typeof M=="string",L=di(O?M:M.key),B=O?void 0:M.value,k=O||!M.options?d:{...d,...M.options},H=r(L);_(H).items.push({key:L,value:B,relativeKey:H.relativeKey,options:k})}return Promise.all([...y.values()].map(M=>p(M))).then(M=>M.flat())},u={hasItem(l,d={}){l=di(l);const{relativeKey:p,driver:y}=r(l);return Mn(y.hasItem,p,d)},getItem(l,d={}){l=di(l);const{relativeKey:p,driver:y}=r(l);return Mn(y.getItem,p,d).then(_=>fd(_))},getItems(l,d){return a(l,d,p=>p.driver.getItems?Mn(p.driver.getItems,p.items.map(y=>({key:y.relativeKey,options:y.options})),d).then(y=>y.map(_=>({key:xR(p.base,_.key),value:fd(_.value)}))):Promise.all(p.items.map(y=>Mn(p.driver.getItem,y.relativeKey,y.options).then(_=>({key:y.key,value:fd(_)})))))},getItemRaw(l,d={}){l=di(l);const{relativeKey:p,driver:y}=r(l);return y.getItemRaw?Mn(y.getItemRaw,p,d):Mn(y.getItem,p,d).then(_=>wR(_))},async setItem(l,d,p={}){if(d===void 0)return u.removeItem(l);l=di(l);const{relativeKey:y,driver:_}=r(l);_.setItem&&(await Mn(_.setItem,y,ld(d),p),_.watch||i("update",l))},async setItems(l,d){await a(l,d,async p=>{if(p.driver.setItems)return Mn(p.driver.setItems,p.items.map(y=>({key:y.relativeKey,value:ld(y.value),options:y.options})),d);p.driver.setItem&&await Promise.all(p.items.map(y=>Mn(p.driver.setItem,y.relativeKey,ld(y.value),y.options)))})},async setItemRaw(l,d,p={}){if(d===void 0)return u.removeItem(l,p);l=di(l);const{relativeKey:y,driver:_}=r(l);if(_.setItemRaw)await Mn(_.setItemRaw,y,d,p);else if(_.setItem)await Mn(_.setItem,y,yR(d),p);else return;_.watch||i("update",l)},async removeItem(l,d={}){typeof d=="boolean"&&(d={removeMeta:d}),l=di(l);const{relativeKey:p,driver:y}=r(l);y.removeItem&&(await Mn(y.removeItem,p,d),(d.removeMeta||d.removeMata)&&await Mn(y.removeItem,p+"$",d),y.watch||i("remove",l))},async getMeta(l,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),l=di(l);const{relativeKey:p,driver:y}=r(l),_=Object.create(null);if(y.getMeta&&Object.assign(_,await Mn(y.getMeta,p,d)),!d.nativeOnly){const M=await Mn(y.getItem,p+"$",d).then(O=>fd(O));M&&typeof M=="object"&&(typeof M.atime=="string"&&(M.atime=new Date(M.atime)),typeof M.mtime=="string"&&(M.mtime=new Date(M.mtime)),Object.assign(_,M))}return _},setMeta(l,d,p={}){return this.setItem(l+"$",d,p)},removeMeta(l,d={}){return this.removeItem(l+"$",d)},async getKeys(l,d={}){l=hd(l);const p=n(l,!0);let y=[];const _=[];for(const M of p){const O=await Mn(M.driver.getKeys,M.relativeBase,d);for(const L of O){const B=M.mountpoint+di(L);y.some(k=>B.startsWith(k))||_.push(B)}y=[M.mountpoint,...y.filter(L=>!L.startsWith(M.mountpoint))]}return l?_.filter(M=>M.startsWith(l)&&M[M.length-1]!=="$"):_.filter(M=>M[M.length-1]!=="$")},async clear(l,d={}){l=hd(l),await Promise.all(n(l,!1).map(async p=>{if(p.driver.clear)return Mn(p.driver.clear,p.relativeBase,d);if(p.driver.removeItem){const y=await p.driver.getKeys(p.relativeBase||"",d);return Promise.all(y.map(_=>p.driver.removeItem(_,d)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>bx(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(d=>d!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,d){if(l=hd(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((p,y)=>y.length-p.length)),e.mounts[l]=d,e.watching&&Promise.resolve(vx(d,i,l)).then(p=>{e.unwatch[l]=p}).catch(console.error),u},async unmount(l,d=!0){l=hd(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),d&&await bx(e.mounts[l]),e.mountpoints=e.mountpoints.filter(p=>p!==l),delete e.mounts[l])},getMount(l=""){l=di(l)+":";const d=r(l);return{driver:d.driver,base:d.base}},getMounts(l="",d={}){return l=di(l),n(l,d.parents).map(y=>({driver:y.driver,base:y.mountpoint}))},keys:(l,d={})=>u.getKeys(l,d),get:(l,d={})=>u.getItem(l,d),set:(l,d,p={})=>u.setItem(l,d,p),has:(l,d={})=>u.hasItem(l,d),del:(l,d={})=>u.removeItem(l,d),remove:(l,d={})=>u.removeItem(l,d)};return u}function vx(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function bx(t){typeof t.dispose=="function"&&await Mn(t.dispose)}function Xa(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function yx(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Xa(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let dm;function Qf(){return dm||(dm=yx("keyval-store","keyval")),dm}function wx(t,e=Qf()){return e("readonly",r=>Xa(r.get(t)))}function AR(t,e,r=Qf()){return r("readwrite",n=>(n.put(e,t),Xa(n.transaction)))}function PR(t,e=Qf()){return e("readwrite",r=>(r.delete(t),Xa(r.transaction)))}function MR(t=Qf()){return t("readwrite",e=>(e.clear(),Xa(e.transaction)))}function IR(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Xa(t.transaction)}function CR(t=Qf()){return t("readonly",e=>{if(e.getAllKeys)return Xa(e.getAllKeys());const r=[];return IR(e,n=>r.push(n.key)).then(()=>r)})}const TR=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),RR=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Za(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return RR(t)}catch{return t}}function mo(t){return typeof t=="string"?t:TR(t)||""}const DR="idb-keyval";var OR=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=yx(t.dbName,t.storeName)),{name:DR,options:t,async hasItem(i){return!(typeof await wx(r(i),n)>"u")},async getItem(i){return await wx(r(i),n)??null},setItem(i,s){return AR(r(i),s,n)},removeItem(i){return PR(r(i),n)},getKeys(){return CR(n)},clear(){return MR(n)}}};const NR="WALLET_CONNECT_V2_INDEXED_DB",LR="keyvaluestorage";let kR=class{constructor(){this.indexedDb=SR({driver:OR({dbName:NR,storeName:LR})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,mo(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var pm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},dd={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof pm<"u"&&pm.localStorage?dd.exports=pm.localStorage:typeof window<"u"&&window.localStorage?dd.exports=window.localStorage:dd.exports=new e})();function BR(t){var e;return[t[0],Za((e=t[1])!=null?e:"")]}let $R=class{constructor(){this.localStorage=dd.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(BR)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Za(r)}async setItem(e,r){this.localStorage.setItem(e,mo(r))}async removeItem(e){this.localStorage.removeItem(e)}};const FR="wc_storage_version",xx=1,jR=async(t,e,r)=>{const n=FR,i=await e.getItem(n);if(i&&i>=xx){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,xx),r(e),UR(t,o)},UR=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let qR=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new $R;this.storage=e;try{const r=new kR;jR(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function zR(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var HR=WR;function WR(t,e,r){var n=r&&r.stringify||zR,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?p:0,t.charCodeAt(_+1)){case 100:case 102:if(d>=u||e[d]==null)break;p<_&&(l+=t.slice(p,_)),l+=Number(e[d]),p=_+2,_++;break;case 105:if(d>=u||e[d]==null)break;p<_&&(l+=t.slice(p,_)),l+=Math.floor(Number(e[d])),p=_+2,_++;break;case 79:case 111:case 106:if(d>=u||e[d]===void 0)break;p<_&&(l+=t.slice(p,_));var M=typeof e[d];if(M==="string"){l+="'"+e[d]+"'",p=_+2,_++;break}if(M==="function"){l+=e[d].name||"",p=_+2,_++;break}l+=n(e[d]),p=_+2,_++;break;case 115:if(d>=u)break;p<_&&(l+=t.slice(p,_)),l+=String(e[d]),p=_+2,_++;break;case 37:p<_&&(l+=t.slice(p,_)),l+="%",p=_+2,_++,d--;break}++d}++_}return p===-1?t:(p-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",u=Object.create(r);u.log||(u.log=tl),Object.defineProperty(u,"levelVal",{get:d}),Object.defineProperty(u,"level",{get:p,set:y});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:ZR(t)};u.levels=vo.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=tl,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=_,e&&(u._logEvent=gm());function d(){return this.level==="silent"?1/0:this.levels.values[this.level]}function p(){return this._level}function y(M){if(M!=="silent"&&!this.levels.values[M])throw Error("unknown level "+M);this._level=M,au(l,u,"error","log"),au(l,u,"fatal","error"),au(l,u,"warn","error"),au(l,u,"info","log"),au(l,u,"debug","log"),au(l,u,"trace","log")}function _(M,O){if(!M)throw new Error("missing bindings for child Pino");O=O||{},i&&M.serializers&&(O.serializers=M.serializers);const L=O.serializers;if(i&&L){var B=Object.assign({},n,L),k=t.browser.serialize===!0?Object.keys(B):i;delete M.serializers,pd([M],k,B,this._stdErrSerialize)}function H(U){this._childLevel=(U._childLevel|0)+1,this.error=cu(U,M,"error"),this.fatal=cu(U,M,"fatal"),this.warn=cu(U,M,"warn"),this.info=cu(U,M,"info"),this.debug=cu(U,M,"debug"),this.trace=cu(U,M,"trace"),B&&(this.serializers=B,this._serialize=k),e&&(this._logEvent=gm([].concat(U._logEvent.bindings,M)))}return H.prototype=this,new H(this)}return u}vo.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},vo.stdSerializers=KR,vo.stdTimeFunctions=Object.assign({},{nullTime:Ex,epochTime:Sx,unixTime:QR,isoTime:eD});function au(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?tl:i[r]?i[r]:el[r]||el[n]||tl,GR(t,e,r)}function GR(t,e,r){!t.transmit&&e[r]===tl||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===el?el:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function cu(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},Px=class{constructor(e,r=vm){this.level=e??"error",this.levelValue=ou.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Ax(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===ou.levels.values.error?console.error(e):r===ou.levels.values.warn?console.warn(e):r===ou.levels.values.debug?console.debug(e):r===ou.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(mo({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new Ax(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(mo({extraMetadata:e})),new Blob(r,{type:"application/json"})}},iD=class{constructor(e,r=vm){this.baseChunkLogger=new Px(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},sD=class{constructor(e,r=vm){this.baseChunkLogger=new Px(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var oD=Object.defineProperty,aD=Object.defineProperties,cD=Object.getOwnPropertyDescriptors,Mx=Object.getOwnPropertySymbols,uD=Object.prototype.hasOwnProperty,fD=Object.prototype.propertyIsEnumerable,Ix=(t,e,r)=>e in t?oD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,md=(t,e)=>{for(var r in e||(e={}))uD.call(e,r)&&Ix(t,r,e[r]);if(Mx)for(var r of Mx(e))fD.call(e,r)&&Ix(t,r,e[r]);return t},vd=(t,e)=>aD(t,cD(e));function bd(t){return vd(md({},t),{level:(t==null?void 0:t.level)||rD.level})}function lD(t,e=nl){return t[e]||""}function hD(t,e,r=nl){return t[r]=e,t}function pi(t,e=nl){let r="";return typeof t.bindings>"u"?r=lD(t,e):r=t.bindings().context||"",r}function dD(t,e,r=nl){const n=pi(t,r);return n.trim()?`${n}/${e}`:e}function ti(t,e,r=nl){const n=dD(t,e,r),i=t.child({context:n});return hD(i,n,r)}function pD(t){var e,r;const n=new iD((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:rl(vd(md({},t.opts),{level:"trace",browser:vd(md({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function gD(t){var e;const r=new sD((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:rl(vd(md({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function mD(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?pD(t):gD(t)}let vD=class extends Ja{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},bD=class extends Ja{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},yD=class{constructor(e,r){this.logger=e,this.core=r}},wD=class extends Ja{constructor(e,r){super(),this.relayer=e,this.logger=r}},xD=class extends Ja{constructor(e){super()}},_D=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},ED=class extends Ja{constructor(e,r){super(),this.relayer=e,this.logger=r}},SD=class extends Ja{constructor(e,r){super(),this.core=e,this.logger=r}},AD=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},PD=class{constructor(e,r){this.projectId=e,this.logger=r}},MD=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},ID=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},CD=class{constructor(e){this.client=e}};var bm={},sa={},yd={},wd={};Object.defineProperty(wd,"__esModule",{value:!0}),wd.BrowserRandomSource=void 0;const Cx=65536;class TD{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let n=0;n>>16&65535,d=a&65535,p=u>>>16&65535,y=u&65535;return d*y+(l*y+d*p<<16>>>0)|0}t.mul=Math.imul||e;function r(a,u){return a+u|0}t.add=r;function n(a,u){return a-u|0}t.sub=n;function i(a,u){return a<>>32-u}t.rotl=i;function s(a,u){return a<<32-u|a>>>u}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(Rx),Object.defineProperty(or,"__esModule",{value:!0});var Dx=Rx;function BD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}or.readInt16BE=BD;function $D(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}or.readUint16BE=$D;function FD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}or.readInt16LE=FD;function jD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}or.readUint16LE=jD;function Ox(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}or.writeUint16BE=Ox,or.writeInt16BE=Ox;function Nx(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}or.writeUint16LE=Nx,or.writeInt16LE=Nx;function ym(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}or.readInt32BE=ym;function wm(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}or.readUint32BE=wm;function xm(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}or.readInt32LE=xm;function _m(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}or.readUint32LE=_m;function _d(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}or.writeUint32BE=_d,or.writeInt32BE=_d;function Ed(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}or.writeUint32LE=Ed,or.writeInt32LE=Ed;function UD(t,e){e===void 0&&(e=0);var r=ym(t,e),n=ym(t,e+4);return r*4294967296+n-(n>>31)*4294967296}or.readInt64BE=UD;function qD(t,e){e===void 0&&(e=0);var r=wm(t,e),n=wm(t,e+4);return r*4294967296+n}or.readUint64BE=qD;function zD(t,e){e===void 0&&(e=0);var r=xm(t,e),n=xm(t,e+4);return n*4294967296+r-(r>>31)*4294967296}or.readInt64LE=zD;function HD(t,e){e===void 0&&(e=0);var r=_m(t,e),n=_m(t,e+4);return n*4294967296+r}or.readUint64LE=HD;function Lx(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),_d(t/4294967296>>>0,e,r),_d(t>>>0,e,r+4),e}or.writeUint64BE=Lx,or.writeInt64BE=Lx;function kx(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Ed(t>>>0,e,r),Ed(t/4294967296>>>0,e,r+4),e}or.writeUint64LE=kx,or.writeInt64LE=kx;function WD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}or.readUintBE=WD;function KD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}or.writeUintBE=VD;function GD(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Dx.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s256)throw new Error("randomString charset is too long");let y="";const _=d.length,M=256-256%_;for(;l>0;){const O=i(Math.ceil(l*256/M),p);for(let L=0;L0;L++){const B=O[L];B0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,_=l%128<112?128:256;this._buffer[d]=128;for(var M=d+1;M<_-8;M++)this._buffer[M]=0;e.writeUint32BE(p,this._buffer,_-8),e.writeUint32BE(y,this._buffer,_-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,_),this._finished=!0}for(var M=0;M0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._stateHi.set(u.stateHi),this._stateLo.set(u.stateLo),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.stateHi),r.wipe(u.stateLo),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,u,l,d,p,y,_){for(var M=l[0],O=l[1],L=l[2],B=l[3],k=l[4],H=l[5],U=l[6],z=l[7],Z=d[0],R=d[1],W=d[2],ie=d[3],me=d[4],j=d[5],E=d[6],m=d[7],f,g,v,x,S,A,b,P;_>=128;){for(var I=0;I<16;I++){var F=8*I+y;a[I]=e.readUint32BE(p,F),u[I]=e.readUint32BE(p,F+4)}for(var I=0;I<80;I++){var ce=M,D=O,se=L,ee=B,J=k,Q=H,T=U,X=z,re=Z,ge=R,oe=W,fe=ie,be=me,Me=j,Ne=E,Te=m;if(f=z,g=m,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=(k>>>14|me<<18)^(k>>>18|me<<14)^(me>>>9|k<<23),g=(me>>>14|k<<18)^(me>>>18|k<<14)^(k>>>9|me<<23),S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,f=k&H^~k&U,g=me&j^~me&E,S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,f=i[I*2],g=i[I*2+1],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,f=a[I%16],g=u[I%16],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,v=b&65535|P<<16,x=S&65535|A<<16,f=v,g=x,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=(M>>>28|Z<<4)^(Z>>>2|M<<30)^(Z>>>7|M<<25),g=(Z>>>28|M<<4)^(M>>>2|Z<<30)^(M>>>7|Z<<25),S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,f=M&O^M&L^O&L,g=Z&R^Z&W^R&W,S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,X=b&65535|P<<16,Te=S&65535|A<<16,f=ee,g=fe,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=v,g=x,S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,ee=b&65535|P<<16,fe=S&65535|A<<16,O=ce,L=D,B=se,k=ee,H=J,U=Q,z=T,M=X,R=re,W=ge,ie=oe,me=fe,j=be,E=Me,m=Ne,Z=Te,I%16===15)for(var F=0;F<16;F++)f=a[F],g=u[F],S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=a[(F+9)%16],g=u[(F+9)%16],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,v=a[(F+1)%16],x=u[(F+1)%16],f=(v>>>1|x<<31)^(v>>>8|x<<24)^v>>>7,g=(x>>>1|v<<31)^(x>>>8|v<<24)^(x>>>7|v<<25),S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,v=a[(F+14)%16],x=u[(F+14)%16],f=(v>>>19|x<<13)^(x>>>29|v<<3)^v>>>6,g=(x>>>19|v<<13)^(v>>>29|x<<3)^(x>>>6|v<<26),S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,a[F]=b&65535|P<<16,u[F]=S&65535|A<<16}f=M,g=Z,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[0],g=d[0],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[0]=M=b&65535|P<<16,d[0]=Z=S&65535|A<<16,f=O,g=R,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[1],g=d[1],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[1]=O=b&65535|P<<16,d[1]=R=S&65535|A<<16,f=L,g=W,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[2],g=d[2],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[2]=L=b&65535|P<<16,d[2]=W=S&65535|A<<16,f=B,g=ie,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[3],g=d[3],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[3]=B=b&65535|P<<16,d[3]=ie=S&65535|A<<16,f=k,g=me,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[4],g=d[4],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[4]=k=b&65535|P<<16,d[4]=me=S&65535|A<<16,f=H,g=j,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[5],g=d[5],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[5]=H=b&65535|P<<16,d[5]=j=S&65535|A<<16,f=U,g=E,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[6],g=d[6],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[6]=U=b&65535|P<<16,d[6]=E=S&65535|A<<16,f=z,g=m,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[7],g=d[7],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[7]=z=b&65535|P<<16,d[7]=m=S&65535|A<<16,y+=128,_-=128}return y}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(Bx),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=sa,r=Bx,n=Mi;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(ee){const J=new Float64Array(16);if(ee)for(let Q=0;Q>16&1),Q[ge-1]&=65535;Q[15]=T[15]-32767-(Q[14]>>16&1);const re=Q[15]>>16&1;Q[14]&=65535,O(T,Q,1-re)}for(let X=0;X<16;X++)ee[2*X]=T[X]&255,ee[2*X+1]=T[X]>>8}function B(ee,J){let Q=0;for(let T=0;T<32;T++)Q|=ee[T]^J[T];return(1&Q-1>>>8)-1}function k(ee,J){const Q=new Uint8Array(32),T=new Uint8Array(32);return L(Q,ee),L(T,J),B(Q,T)}function H(ee){const J=new Uint8Array(32);return L(J,ee),J[0]&1}function U(ee,J){for(let Q=0;Q<16;Q++)ee[Q]=J[2*Q]+(J[2*Q+1]<<8);ee[15]&=32767}function z(ee,J,Q){for(let T=0;T<16;T++)ee[T]=J[T]+Q[T]}function Z(ee,J,Q){for(let T=0;T<16;T++)ee[T]=J[T]-Q[T]}function R(ee,J,Q){let T,X,re=0,ge=0,oe=0,fe=0,be=0,Me=0,Ne=0,Te=0,$e=0,Ie=0,Le=0,Ve=0,ke=0,ze=0,He=0,Se=0,Qe=0,ct=0,Be=0,et=0,rt=0,Je=0,gt=0,ht=0,ft=0,Ht=0,Jt=0,St=0,er=0,Xt=0,Ot=0,Bt=Q[0],Tt=Q[1],bt=Q[2],Dt=Q[3],Lt=Q[4],yt=Q[5],$t=Q[6],jt=Q[7],nt=Q[8],Ft=Q[9],$=Q[10],K=Q[11],G=Q[12],C=Q[13],Y=Q[14],q=Q[15];T=J[0],re+=T*Bt,ge+=T*Tt,oe+=T*bt,fe+=T*Dt,be+=T*Lt,Me+=T*yt,Ne+=T*$t,Te+=T*jt,$e+=T*nt,Ie+=T*Ft,Le+=T*$,Ve+=T*K,ke+=T*G,ze+=T*C,He+=T*Y,Se+=T*q,T=J[1],ge+=T*Bt,oe+=T*Tt,fe+=T*bt,be+=T*Dt,Me+=T*Lt,Ne+=T*yt,Te+=T*$t,$e+=T*jt,Ie+=T*nt,Le+=T*Ft,Ve+=T*$,ke+=T*K,ze+=T*G,He+=T*C,Se+=T*Y,Qe+=T*q,T=J[2],oe+=T*Bt,fe+=T*Tt,be+=T*bt,Me+=T*Dt,Ne+=T*Lt,Te+=T*yt,$e+=T*$t,Ie+=T*jt,Le+=T*nt,Ve+=T*Ft,ke+=T*$,ze+=T*K,He+=T*G,Se+=T*C,Qe+=T*Y,ct+=T*q,T=J[3],fe+=T*Bt,be+=T*Tt,Me+=T*bt,Ne+=T*Dt,Te+=T*Lt,$e+=T*yt,Ie+=T*$t,Le+=T*jt,Ve+=T*nt,ke+=T*Ft,ze+=T*$,He+=T*K,Se+=T*G,Qe+=T*C,ct+=T*Y,Be+=T*q,T=J[4],be+=T*Bt,Me+=T*Tt,Ne+=T*bt,Te+=T*Dt,$e+=T*Lt,Ie+=T*yt,Le+=T*$t,Ve+=T*jt,ke+=T*nt,ze+=T*Ft,He+=T*$,Se+=T*K,Qe+=T*G,ct+=T*C,Be+=T*Y,et+=T*q,T=J[5],Me+=T*Bt,Ne+=T*Tt,Te+=T*bt,$e+=T*Dt,Ie+=T*Lt,Le+=T*yt,Ve+=T*$t,ke+=T*jt,ze+=T*nt,He+=T*Ft,Se+=T*$,Qe+=T*K,ct+=T*G,Be+=T*C,et+=T*Y,rt+=T*q,T=J[6],Ne+=T*Bt,Te+=T*Tt,$e+=T*bt,Ie+=T*Dt,Le+=T*Lt,Ve+=T*yt,ke+=T*$t,ze+=T*jt,He+=T*nt,Se+=T*Ft,Qe+=T*$,ct+=T*K,Be+=T*G,et+=T*C,rt+=T*Y,Je+=T*q,T=J[7],Te+=T*Bt,$e+=T*Tt,Ie+=T*bt,Le+=T*Dt,Ve+=T*Lt,ke+=T*yt,ze+=T*$t,He+=T*jt,Se+=T*nt,Qe+=T*Ft,ct+=T*$,Be+=T*K,et+=T*G,rt+=T*C,Je+=T*Y,gt+=T*q,T=J[8],$e+=T*Bt,Ie+=T*Tt,Le+=T*bt,Ve+=T*Dt,ke+=T*Lt,ze+=T*yt,He+=T*$t,Se+=T*jt,Qe+=T*nt,ct+=T*Ft,Be+=T*$,et+=T*K,rt+=T*G,Je+=T*C,gt+=T*Y,ht+=T*q,T=J[9],Ie+=T*Bt,Le+=T*Tt,Ve+=T*bt,ke+=T*Dt,ze+=T*Lt,He+=T*yt,Se+=T*$t,Qe+=T*jt,ct+=T*nt,Be+=T*Ft,et+=T*$,rt+=T*K,Je+=T*G,gt+=T*C,ht+=T*Y,ft+=T*q,T=J[10],Le+=T*Bt,Ve+=T*Tt,ke+=T*bt,ze+=T*Dt,He+=T*Lt,Se+=T*yt,Qe+=T*$t,ct+=T*jt,Be+=T*nt,et+=T*Ft,rt+=T*$,Je+=T*K,gt+=T*G,ht+=T*C,ft+=T*Y,Ht+=T*q,T=J[11],Ve+=T*Bt,ke+=T*Tt,ze+=T*bt,He+=T*Dt,Se+=T*Lt,Qe+=T*yt,ct+=T*$t,Be+=T*jt,et+=T*nt,rt+=T*Ft,Je+=T*$,gt+=T*K,ht+=T*G,ft+=T*C,Ht+=T*Y,Jt+=T*q,T=J[12],ke+=T*Bt,ze+=T*Tt,He+=T*bt,Se+=T*Dt,Qe+=T*Lt,ct+=T*yt,Be+=T*$t,et+=T*jt,rt+=T*nt,Je+=T*Ft,gt+=T*$,ht+=T*K,ft+=T*G,Ht+=T*C,Jt+=T*Y,St+=T*q,T=J[13],ze+=T*Bt,He+=T*Tt,Se+=T*bt,Qe+=T*Dt,ct+=T*Lt,Be+=T*yt,et+=T*$t,rt+=T*jt,Je+=T*nt,gt+=T*Ft,ht+=T*$,ft+=T*K,Ht+=T*G,Jt+=T*C,St+=T*Y,er+=T*q,T=J[14],He+=T*Bt,Se+=T*Tt,Qe+=T*bt,ct+=T*Dt,Be+=T*Lt,et+=T*yt,rt+=T*$t,Je+=T*jt,gt+=T*nt,ht+=T*Ft,ft+=T*$,Ht+=T*K,Jt+=T*G,St+=T*C,er+=T*Y,Xt+=T*q,T=J[15],Se+=T*Bt,Qe+=T*Tt,ct+=T*bt,Be+=T*Dt,et+=T*Lt,rt+=T*yt,Je+=T*$t,gt+=T*jt,ht+=T*nt,ft+=T*Ft,Ht+=T*$,Jt+=T*K,St+=T*G,er+=T*C,Xt+=T*Y,Ot+=T*q,re+=38*Qe,ge+=38*ct,oe+=38*Be,fe+=38*et,be+=38*rt,Me+=38*Je,Ne+=38*gt,Te+=38*ht,$e+=38*ft,Ie+=38*Ht,Le+=38*Jt,Ve+=38*St,ke+=38*er,ze+=38*Xt,He+=38*Ot,X=1,T=re+X+65535,X=Math.floor(T/65536),re=T-X*65536,T=ge+X+65535,X=Math.floor(T/65536),ge=T-X*65536,T=oe+X+65535,X=Math.floor(T/65536),oe=T-X*65536,T=fe+X+65535,X=Math.floor(T/65536),fe=T-X*65536,T=be+X+65535,X=Math.floor(T/65536),be=T-X*65536,T=Me+X+65535,X=Math.floor(T/65536),Me=T-X*65536,T=Ne+X+65535,X=Math.floor(T/65536),Ne=T-X*65536,T=Te+X+65535,X=Math.floor(T/65536),Te=T-X*65536,T=$e+X+65535,X=Math.floor(T/65536),$e=T-X*65536,T=Ie+X+65535,X=Math.floor(T/65536),Ie=T-X*65536,T=Le+X+65535,X=Math.floor(T/65536),Le=T-X*65536,T=Ve+X+65535,X=Math.floor(T/65536),Ve=T-X*65536,T=ke+X+65535,X=Math.floor(T/65536),ke=T-X*65536,T=ze+X+65535,X=Math.floor(T/65536),ze=T-X*65536,T=He+X+65535,X=Math.floor(T/65536),He=T-X*65536,T=Se+X+65535,X=Math.floor(T/65536),Se=T-X*65536,re+=X-1+37*(X-1),X=1,T=re+X+65535,X=Math.floor(T/65536),re=T-X*65536,T=ge+X+65535,X=Math.floor(T/65536),ge=T-X*65536,T=oe+X+65535,X=Math.floor(T/65536),oe=T-X*65536,T=fe+X+65535,X=Math.floor(T/65536),fe=T-X*65536,T=be+X+65535,X=Math.floor(T/65536),be=T-X*65536,T=Me+X+65535,X=Math.floor(T/65536),Me=T-X*65536,T=Ne+X+65535,X=Math.floor(T/65536),Ne=T-X*65536,T=Te+X+65535,X=Math.floor(T/65536),Te=T-X*65536,T=$e+X+65535,X=Math.floor(T/65536),$e=T-X*65536,T=Ie+X+65535,X=Math.floor(T/65536),Ie=T-X*65536,T=Le+X+65535,X=Math.floor(T/65536),Le=T-X*65536,T=Ve+X+65535,X=Math.floor(T/65536),Ve=T-X*65536,T=ke+X+65535,X=Math.floor(T/65536),ke=T-X*65536,T=ze+X+65535,X=Math.floor(T/65536),ze=T-X*65536,T=He+X+65535,X=Math.floor(T/65536),He=T-X*65536,T=Se+X+65535,X=Math.floor(T/65536),Se=T-X*65536,re+=X-1+37*(X-1),ee[0]=re,ee[1]=ge,ee[2]=oe,ee[3]=fe,ee[4]=be,ee[5]=Me,ee[6]=Ne,ee[7]=Te,ee[8]=$e,ee[9]=Ie,ee[10]=Le,ee[11]=Ve,ee[12]=ke,ee[13]=ze,ee[14]=He,ee[15]=Se}function W(ee,J){R(ee,J,J)}function ie(ee,J){const Q=i();let T;for(T=0;T<16;T++)Q[T]=J[T];for(T=253;T>=0;T--)W(Q,Q),T!==2&&T!==4&&R(Q,Q,J);for(T=0;T<16;T++)ee[T]=Q[T]}function me(ee,J){const Q=i();let T;for(T=0;T<16;T++)Q[T]=J[T];for(T=250;T>=0;T--)W(Q,Q),T!==1&&R(Q,Q,J);for(T=0;T<16;T++)ee[T]=Q[T]}function j(ee,J){const Q=i(),T=i(),X=i(),re=i(),ge=i(),oe=i(),fe=i(),be=i(),Me=i();Z(Q,ee[1],ee[0]),Z(Me,J[1],J[0]),R(Q,Q,Me),z(T,ee[0],ee[1]),z(Me,J[0],J[1]),R(T,T,Me),R(X,ee[3],J[3]),R(X,X,l),R(re,ee[2],J[2]),z(re,re,re),Z(ge,T,Q),Z(oe,re,X),z(fe,re,X),z(be,T,Q),R(ee[0],ge,oe),R(ee[1],be,fe),R(ee[2],fe,oe),R(ee[3],ge,be)}function E(ee,J,Q){for(let T=0;T<4;T++)O(ee[T],J[T],Q)}function m(ee,J){const Q=i(),T=i(),X=i();ie(X,J[2]),R(Q,J[0],X),R(T,J[1],X),L(ee,T),ee[31]^=H(Q)<<7}function f(ee,J,Q){_(ee[0],o),_(ee[1],a),_(ee[2],a),_(ee[3],o);for(let T=255;T>=0;--T){const X=Q[T/8|0]>>(T&7)&1;E(ee,J,X),j(J,ee),j(ee,ee),E(ee,J,X)}}function g(ee,J){const Q=[i(),i(),i(),i()];_(Q[0],d),_(Q[1],p),_(Q[2],a),R(Q[3],d,p),f(ee,Q,J)}function v(ee){if(ee.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const J=(0,r.hash)(ee);J[0]&=248,J[31]&=127,J[31]|=64;const Q=new Uint8Array(32),T=[i(),i(),i(),i()];g(T,J),m(Q,T);const X=new Uint8Array(64);return X.set(ee),X.set(Q,32),{publicKey:Q,secretKey:X}}t.generateKeyPairFromSeed=v;function x(ee){const J=(0,e.randomBytes)(32,ee),Q=v(J);return(0,n.wipe)(J),Q}t.generateKeyPair=x;function S(ee){if(ee.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(ee.subarray(32))}t.extractPublicKeyFromSecretKey=S;const A=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function b(ee,J){let Q,T,X,re;for(T=63;T>=32;--T){for(Q=0,X=T-32,re=T-12;X>4)*A[X],Q=J[X]>>8,J[X]&=255;for(X=0;X<32;X++)J[X]-=Q*A[X];for(T=0;T<32;T++)J[T+1]+=J[T]>>8,ee[T]=J[T]&255}function P(ee){const J=new Float64Array(64);for(let Q=0;Q<64;Q++)J[Q]=ee[Q];for(let Q=0;Q<64;Q++)ee[Q]=0;b(ee,J)}function I(ee,J){const Q=new Float64Array(64),T=[i(),i(),i(),i()],X=(0,r.hash)(ee.subarray(0,32));X[0]&=248,X[31]&=127,X[31]|=64;const re=new Uint8Array(64);re.set(X.subarray(32),32);const ge=new r.SHA512;ge.update(re.subarray(32)),ge.update(J);const oe=ge.digest();ge.clean(),P(oe),g(T,oe),m(re,T),ge.reset(),ge.update(re.subarray(0,32)),ge.update(ee.subarray(32)),ge.update(J);const fe=ge.digest();P(fe);for(let be=0;be<32;be++)Q[be]=oe[be];for(let be=0;be<32;be++)for(let Me=0;Me<32;Me++)Q[be+Me]+=fe[be]*X[Me];return b(re.subarray(32),Q),re}t.sign=I;function F(ee,J){const Q=i(),T=i(),X=i(),re=i(),ge=i(),oe=i(),fe=i();return _(ee[2],a),U(ee[1],J),W(X,ee[1]),R(re,X,u),Z(X,X,ee[2]),z(re,ee[2],re),W(ge,re),W(oe,ge),R(fe,oe,ge),R(Q,fe,X),R(Q,Q,re),me(Q,Q),R(Q,Q,X),R(Q,Q,re),R(Q,Q,re),R(ee[0],Q,re),W(T,ee[0]),R(T,T,re),k(T,X)&&R(ee[0],ee[0],y),W(T,ee[0]),R(T,T,re),k(T,X)?-1:(H(ee[0])===J[31]>>7&&Z(ee[0],o,ee[0]),R(ee[3],ee[0],ee[1]),0)}function ce(ee,J,Q){const T=new Uint8Array(32),X=[i(),i(),i(),i()],re=[i(),i(),i(),i()];if(Q.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(F(re,ee))return!1;const ge=new r.SHA512;ge.update(Q.subarray(0,32)),ge.update(ee),ge.update(J);const oe=ge.digest();return P(oe),f(X,re,oe),g(re,Q.subarray(32)),j(X,re),m(T,X),!B(Q,T)}t.verify=ce;function D(ee){let J=[i(),i(),i(),i()];if(F(J,ee))throw new Error("Ed25519: invalid public key");let Q=i(),T=i(),X=J[1];z(Q,a,X),Z(T,a,X),ie(T,T),R(Q,Q,T);let re=new Uint8Array(32);return L(re,Q),re}t.convertPublicKeyToX25519=D;function se(ee){const J=(0,r.hash)(ee.subarray(0,32));J[0]&=248,J[31]&=127,J[31]|=64;const Q=new Uint8Array(J.subarray(0,32));return(0,n.wipe)(J),Q}t.convertSecretKeyToX25519=se}(bm);const nO="EdDSA",iO="JWT",Sd=".",Ad="base64url",$x="utf8",Fx="utf8",sO=":",oO="did",aO="key",jx="base58btc",cO="z",uO="K36",fO=32;function Ux(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Pd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=Ux(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function lO(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(H);B!==k;){for(var z=M[B],Z=0,R=H-1;(z!==0||Z>>0,U[R]=z%a>>>0,z=z/a>>>0;if(z!==0)throw new Error("Non-zero carry");L=Z,B++}for(var W=H-L;W!==H&&U[W]===0;)W++;for(var ie=u.repeat(O);W>>0,H=new Uint8Array(k);M[O];){var U=r[M.charCodeAt(O)];if(U===255)return;for(var z=0,Z=k-1;(U!==0||z>>0,H[Z]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");B=z,O++}if(M[O]!==" "){for(var R=k-B;R!==k&&H[R]===0;)R++;for(var W=new Uint8Array(L+(k-R)),ie=L;R!==k;)W[ie++]=H[R++];return W}}}function _(M){var O=y(M);if(O)return O;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:_}}var hO=lO,dO=hO;const pO=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},gO=t=>new TextEncoder().encode(t),mO=t=>new TextDecoder().decode(t);class vO{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class bO{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return qx(this,e)}}class yO{constructor(e){this.decoders=e}or(e){return qx(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const qx=(t,e)=>new yO({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class wO{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new vO(e,r,n),this.decoder=new bO(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Md=({name:t,prefix:e,encode:r,decode:n})=>new wO(t,e,r,n),sl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=dO(r,e);return Md({prefix:t,name:e,encode:n,decode:s=>pO(i(s))})},xO=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},_O=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Md({prefix:e,name:t,encode(i){return _O(i,n,r)},decode(i){return xO(i,n,r,t)}}),EO=Md({prefix:"\0",name:"identity",encode:t=>mO(t),decode:t=>gO(t)}),SO=Object.freeze(Object.defineProperty({__proto__:null,identity:EO},Symbol.toStringTag,{value:"Module"})),AO=Bn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),PO=Object.freeze(Object.defineProperty({__proto__:null,base2:AO},Symbol.toStringTag,{value:"Module"})),MO=Bn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),IO=Object.freeze(Object.defineProperty({__proto__:null,base8:MO},Symbol.toStringTag,{value:"Module"})),CO=sl({prefix:"9",name:"base10",alphabet:"0123456789"}),TO=Object.freeze(Object.defineProperty({__proto__:null,base10:CO},Symbol.toStringTag,{value:"Module"})),RO=Bn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),DO=Bn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),OO=Object.freeze(Object.defineProperty({__proto__:null,base16:RO,base16upper:DO},Symbol.toStringTag,{value:"Module"})),NO=Bn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),LO=Bn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),kO=Bn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),BO=Bn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),$O=Bn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),FO=Bn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),jO=Bn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),UO=Bn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),qO=Bn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),zO=Object.freeze(Object.defineProperty({__proto__:null,base32:NO,base32hex:$O,base32hexpad:jO,base32hexpadupper:UO,base32hexupper:FO,base32pad:kO,base32padupper:BO,base32upper:LO,base32z:qO},Symbol.toStringTag,{value:"Module"})),HO=sl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),WO=sl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),KO=Object.freeze(Object.defineProperty({__proto__:null,base36:HO,base36upper:WO},Symbol.toStringTag,{value:"Module"})),VO=sl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),GO=sl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),YO=Object.freeze(Object.defineProperty({__proto__:null,base58btc:VO,base58flickr:GO},Symbol.toStringTag,{value:"Module"})),JO=Bn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),XO=Bn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ZO=Bn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),QO=Bn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),eN=Object.freeze(Object.defineProperty({__proto__:null,base64:JO,base64pad:XO,base64url:ZO,base64urlpad:QO},Symbol.toStringTag,{value:"Module"})),zx=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),tN=zx.reduce((t,e,r)=>(t[r]=e,t),[]),rN=zx.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function nN(t){return t.reduce((e,r)=>(e+=tN[r],e),"")}function iN(t){const e=[];for(const r of t){const n=rN[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const sN=Md({prefix:"🚀",name:"base256emoji",encode:nN,decode:iN}),oN=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:sN},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const Hx={...SO,...PO,...IO,...TO,...OO,...zO,...KO,...YO,...eN,...oN};function Wx(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const Kx=Wx("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Em=Wx("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=Ux(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new mN:typeof navigator<"u"?_N(navigator.userAgent):SN()}function xN(t){return t!==""&&yN.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function _N(t){var e=xN(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new gN;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length-1){const L=M.getAttribute("href");if(L)if(L.toLowerCase().indexOf("https:")===-1&&L.toLowerCase().indexOf("http:")===-1&&L.indexOf("//")!==0){let B=e.protocol+"//"+e.host;if(L.indexOf("/")===0)B+=L;else{const k=e.pathname.split("/");k.pop();const H=k.join("/");B+=H+"/"+L}y.push(B)}else if(L.indexOf("//")===0){const B=e.protocol+L;y.push(B)}else y.push(L)}}return y}function n(...p){const y=t.getElementsByTagName("meta");for(let _=0;_M.getAttribute(L)).filter(L=>L?p.includes(L):!1);if(O.length&&O){const L=M.getAttribute("content");if(L)return L}}return""}function i(){let p=n("name","og:site_name","og:title","twitter:title");return p||(p=t.title),p}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}t3=Pm.getWindowMetadata=kN;var al={},BN=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),n3="%[a-f0-9]{2}",i3=new RegExp("("+n3+")|([^%]+?)","gi"),s3=new RegExp("("+n3+")+","gi");function Mm(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],Mm(r),Mm(n))}function $N(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(i3)||[],r=1;r{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},qN=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;sk==null,o=Symbol("encodeFragmentIdentifier");function a(k){switch(k.arrayFormat){case"index":return H=>(U,z)=>{const Z=U.length;return z===void 0||k.skipNull&&z===null||k.skipEmptyString&&z===""?U:z===null?[...U,[d(H,k),"[",Z,"]"].join("")]:[...U,[d(H,k),"[",d(Z,k),"]=",d(z,k)].join("")]};case"bracket":return H=>(U,z)=>z===void 0||k.skipNull&&z===null||k.skipEmptyString&&z===""?U:z===null?[...U,[d(H,k),"[]"].join("")]:[...U,[d(H,k),"[]=",d(z,k)].join("")];case"colon-list-separator":return H=>(U,z)=>z===void 0||k.skipNull&&z===null||k.skipEmptyString&&z===""?U:z===null?[...U,[d(H,k),":list="].join("")]:[...U,[d(H,k),":list=",d(z,k)].join("")];case"comma":case"separator":case"bracket-separator":{const H=k.arrayFormat==="bracket-separator"?"[]=":"=";return U=>(z,Z)=>Z===void 0||k.skipNull&&Z===null||k.skipEmptyString&&Z===""?z:(Z=Z===null?"":Z,z.length===0?[[d(U,k),H,d(Z,k)].join("")]:[[z,d(Z,k)].join(k.arrayFormatSeparator)])}default:return H=>(U,z)=>z===void 0||k.skipNull&&z===null||k.skipEmptyString&&z===""?U:z===null?[...U,d(H,k)]:[...U,[d(H,k),"=",d(z,k)].join("")]}}function u(k){let H;switch(k.arrayFormat){case"index":return(U,z,Z)=>{if(H=/\[(\d*)\]$/.exec(U),U=U.replace(/\[\d*\]$/,""),!H){Z[U]=z;return}Z[U]===void 0&&(Z[U]={}),Z[U][H[1]]=z};case"bracket":return(U,z,Z)=>{if(H=/(\[\])$/.exec(U),U=U.replace(/\[\]$/,""),!H){Z[U]=z;return}if(Z[U]===void 0){Z[U]=[z];return}Z[U]=[].concat(Z[U],z)};case"colon-list-separator":return(U,z,Z)=>{if(H=/(:list)$/.exec(U),U=U.replace(/:list$/,""),!H){Z[U]=z;return}if(Z[U]===void 0){Z[U]=[z];return}Z[U]=[].concat(Z[U],z)};case"comma":case"separator":return(U,z,Z)=>{const R=typeof z=="string"&&z.includes(k.arrayFormatSeparator),W=typeof z=="string"&&!R&&p(z,k).includes(k.arrayFormatSeparator);z=W?p(z,k):z;const ie=R||W?z.split(k.arrayFormatSeparator).map(me=>p(me,k)):z===null?z:p(z,k);Z[U]=ie};case"bracket-separator":return(U,z,Z)=>{const R=/(\[\])$/.test(U);if(U=U.replace(/\[\]$/,""),!R){Z[U]=z&&p(z,k);return}const W=z===null?[]:z.split(k.arrayFormatSeparator).map(ie=>p(ie,k));if(Z[U]===void 0){Z[U]=W;return}Z[U]=[].concat(Z[U],W)};default:return(U,z,Z)=>{if(Z[U]===void 0){Z[U]=z;return}Z[U]=[].concat(Z[U],z)}}}function l(k){if(typeof k!="string"||k.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function d(k,H){return H.encode?H.strict?e(k):encodeURIComponent(k):k}function p(k,H){return H.decode?r(k):k}function y(k){return Array.isArray(k)?k.sort():typeof k=="object"?y(Object.keys(k)).sort((H,U)=>Number(H)-Number(U)).map(H=>k[H]):k}function _(k){const H=k.indexOf("#");return H!==-1&&(k=k.slice(0,H)),k}function M(k){let H="";const U=k.indexOf("#");return U!==-1&&(H=k.slice(U)),H}function O(k){k=_(k);const H=k.indexOf("?");return H===-1?"":k.slice(H+1)}function L(k,H){return H.parseNumbers&&!Number.isNaN(Number(k))&&typeof k=="string"&&k.trim()!==""?k=Number(k):H.parseBooleans&&k!==null&&(k.toLowerCase()==="true"||k.toLowerCase()==="false")&&(k=k.toLowerCase()==="true"),k}function B(k,H){H=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},H),l(H.arrayFormatSeparator);const U=u(H),z=Object.create(null);if(typeof k!="string"||(k=k.trim().replace(/^[?#&]/,""),!k))return z;for(const Z of k.split("&")){if(Z==="")continue;let[R,W]=n(H.decode?Z.replace(/\+/g," "):Z,"=");W=W===void 0?null:["comma","separator","bracket-separator"].includes(H.arrayFormat)?W:p(W,H),U(p(R,H),W,z)}for(const Z of Object.keys(z)){const R=z[Z];if(typeof R=="object"&&R!==null)for(const W of Object.keys(R))R[W]=L(R[W],H);else z[Z]=L(R,H)}return H.sort===!1?z:(H.sort===!0?Object.keys(z).sort():Object.keys(z).sort(H.sort)).reduce((Z,R)=>{const W=z[R];return W&&typeof W=="object"&&!Array.isArray(W)?Z[R]=y(W):Z[R]=W,Z},Object.create(null))}t.extract=O,t.parse=B,t.stringify=(k,H)=>{if(!k)return"";H=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},H),l(H.arrayFormatSeparator);const U=W=>H.skipNull&&s(k[W])||H.skipEmptyString&&k[W]==="",z=a(H),Z={};for(const W of Object.keys(k))U(W)||(Z[W]=k[W]);const R=Object.keys(Z);return H.sort!==!1&&R.sort(H.sort),R.map(W=>{const ie=k[W];return ie===void 0?"":ie===null?d(W,H):Array.isArray(ie)?ie.length===0&&H.arrayFormat==="bracket-separator"?d(W,H)+"[]":ie.reduce(z(W),[]).join("&"):d(W,H)+"="+d(ie,H)}).filter(W=>W.length>0).join("&")},t.parseUrl=(k,H)=>{H=Object.assign({decode:!0},H);const[U,z]=n(k,"#");return Object.assign({url:U.split("?")[0]||"",query:B(O(k),H)},H&&H.parseFragmentIdentifier&&z?{fragmentIdentifier:p(z,H)}:{})},t.stringifyUrl=(k,H)=>{H=Object.assign({encode:!0,strict:!0,[o]:!0},H);const U=_(k.url).split("?")[0]||"",z=t.extract(k.url),Z=t.parse(z,{sort:!1}),R=Object.assign(Z,k.query);let W=t.stringify(R,H);W&&(W=`?${W}`);let ie=M(k.url);return k.fragmentIdentifier&&(ie=`#${H[o]?d(k.fragmentIdentifier,H):k.fragmentIdentifier}`),`${U}${W}${ie}`},t.pick=(k,H,U)=>{U=Object.assign({parseFragmentIdentifier:!0,[o]:!1},U);const{url:z,query:Z,fragmentIdentifier:R}=t.parseUrl(k,U);return t.stringifyUrl({url:z,query:i(Z,H),fragmentIdentifier:R},U)},t.exclude=(k,H,U)=>{const z=Array.isArray(H)?Z=>!H.includes(Z):(Z,R)=>!H(Z,R);return t.pick(k,z,U)}})(al);var o3={exports:{}};/** + ***************************************************************************** */var sm=function(t,e){return sm=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},sm(t,e)};function BT(t,e){sm(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var om=function(){return om=Object.assign||function(e){for(var r,n=1,i=arguments.length;n=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function jT(t,e){return function(r,n){e(r,n,t)}}function UT(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function qT(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(d){try{l(n.next(d))}catch(p){o(p)}}function u(d){try{l(n.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):i(d.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function zT(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return u([l,d])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ix(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function KT(){for(var t=[],e=0;e1||a(y,_)})})}function a(y,_){try{u(n[y](_))}catch(M){p(s[0][3],M)}}function u(y){y.value instanceof Yf?Promise.resolve(y.value.v).then(l,d):p(s[0][2],y)}function l(y){a("next",y)}function d(y){a("throw",y)}function p(y,_){y(_),s.shift(),s.length&&a(s[0][0],s[0][1])}}function YT(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Yf(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function JT(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof am=="function"?am(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function XT(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function ZT(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function QT(t){return t&&t.__esModule?t:{default:t}}function eR(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function tR(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const Jf=cg(Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return om},__asyncDelegator:YT,__asyncGenerator:GT,__asyncValues:JT,__await:Yf,__awaiter:qT,__classPrivateFieldGet:eR,__classPrivateFieldSet:tR,__createBinding:HT,__decorate:FT,__exportStar:WT,__extends:BT,__generator:zT,__importDefault:QT,__importStar:ZT,__makeTemplateObject:XT,__metadata:UT,__param:jT,__read:ix,__rest:$T,__spread:KT,__spreadArrays:VT,__values:am},Symbol.toStringTag,{value:"Module"})));var cm={},Xf={},sx;function rR(){if(sx)return Xf;sx=1,Object.defineProperty(Xf,"__esModule",{value:!0}),Xf.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Xf.delay=t,Xf}var Ya={},um={},Ja={},ox;function nR(){return ox||(ox=1,Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.ONE_THOUSAND=Ja.ONE_HUNDRED=void 0,Ja.ONE_HUNDRED=100,Ja.ONE_THOUSAND=1e3),Ja}var fm={},ax;function iR(){return ax||(ax=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(fm)),fm}var cx;function ux(){return cx||(cx=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Jf;e.__exportStar(nR(),t),e.__exportStar(iR(),t)}(um)),um}var fx;function sR(){if(fx)return Ya;fx=1,Object.defineProperty(Ya,"__esModule",{value:!0}),Ya.fromMiliseconds=Ya.toMiliseconds=void 0;const t=ux();function e(n){return n*t.ONE_THOUSAND}Ya.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return Ya.fromMiliseconds=r,Ya}var lx;function oR(){return lx||(lx=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Jf;e.__exportStar(rR(),t),e.__exportStar(sR(),t)}(cm)),cm}var iu={},hx;function aR(){if(hx)return iu;hx=1,Object.defineProperty(iu,"__esModule",{value:!0}),iu.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return iu.Watch=t,iu.default=t,iu}var lm={},Zf={},dx;function cR(){if(dx)return Zf;dx=1,Object.defineProperty(Zf,"__esModule",{value:!0}),Zf.IWatch=void 0;class t{}return Zf.IWatch=t,Zf}var px;function uR(){return px||(px=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Jf.__exportStar(cR(),t)}(lm)),lm}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Jf;e.__exportStar(oR(),t),e.__exportStar(aR(),t),e.__exportStar(uR(),t),e.__exportStar(ux(),t)})(vt);class Xa{}let fR=class extends Xa{constructor(e){super()}};const gx=vt.FIVE_SECONDS,su={pulse:"heartbeat_pulse"};let lR=class EP extends fR{constructor(e){super(e),this.events=new Hi.EventEmitter,this.interval=gx,this.interval=(e==null?void 0:e.interval)||gx}static async init(e){const r=new EP(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),vt.toMiliseconds(this.interval))}pulse(){this.events.emit(su.pulse)}};const hR=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,dR=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,pR=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function gR(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){mR(t);return}return e}function mR(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function fd(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!pR.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(hR.test(t)||dR.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,gR)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function vR(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Mn(t,...e){try{return vR(t(...e))}catch(r){return Promise.reject(r)}}function bR(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function yR(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function ld(t){if(bR(t))return String(t);if(yR(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return ld(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function mx(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const hm="base64:";function wR(t){if(typeof t=="string")return t;mx();const e=Buffer.from(t).toString("base64");return hm+e}function xR(t){return typeof t!="string"||!t.startsWith(hm)?t:(mx(),Buffer.from(t.slice(hm.length),"base64"))}function di(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function _R(...t){return di(t.join(":"))}function hd(t){return t=di(t),t?t+":":""}function Goe(t){return t}const ER="memory",SR=()=>{const t=new Map;return{name:ER,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function AR(t={}){const e={mounts:{"":t.driver||SR()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const d of e.mountpoints)if(l.startsWith(d))return{base:d,relativeKey:l.slice(d.length),driver:e.mounts[d]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,d)=>e.mountpoints.filter(p=>p.startsWith(l)||d&&l.startsWith(p)).map(p=>({relativeBase:l.length>p.length?l.slice(p.length):void 0,mountpoint:p,driver:e.mounts[p]})),i=(l,d)=>{if(e.watching){d=di(d);for(const p of e.watchListeners)p(l,d)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await vx(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,d,p)=>{const y=new Map,_=M=>{let O=y.get(M.base);return O||(O={driver:M.driver,base:M.base,items:[]},y.set(M.base,O)),O};for(const M of l){const O=typeof M=="string",L=di(O?M:M.key),B=O?void 0:M.value,k=O||!M.options?d:{...d,...M.options},H=r(L);_(H).items.push({key:L,value:B,relativeKey:H.relativeKey,options:k})}return Promise.all([...y.values()].map(M=>p(M))).then(M=>M.flat())},u={hasItem(l,d={}){l=di(l);const{relativeKey:p,driver:y}=r(l);return Mn(y.hasItem,p,d)},getItem(l,d={}){l=di(l);const{relativeKey:p,driver:y}=r(l);return Mn(y.getItem,p,d).then(_=>fd(_))},getItems(l,d){return a(l,d,p=>p.driver.getItems?Mn(p.driver.getItems,p.items.map(y=>({key:y.relativeKey,options:y.options})),d).then(y=>y.map(_=>({key:_R(p.base,_.key),value:fd(_.value)}))):Promise.all(p.items.map(y=>Mn(p.driver.getItem,y.relativeKey,y.options).then(_=>({key:y.key,value:fd(_)})))))},getItemRaw(l,d={}){l=di(l);const{relativeKey:p,driver:y}=r(l);return y.getItemRaw?Mn(y.getItemRaw,p,d):Mn(y.getItem,p,d).then(_=>xR(_))},async setItem(l,d,p={}){if(d===void 0)return u.removeItem(l);l=di(l);const{relativeKey:y,driver:_}=r(l);_.setItem&&(await Mn(_.setItem,y,ld(d),p),_.watch||i("update",l))},async setItems(l,d){await a(l,d,async p=>{if(p.driver.setItems)return Mn(p.driver.setItems,p.items.map(y=>({key:y.relativeKey,value:ld(y.value),options:y.options})),d);p.driver.setItem&&await Promise.all(p.items.map(y=>Mn(p.driver.setItem,y.relativeKey,ld(y.value),y.options)))})},async setItemRaw(l,d,p={}){if(d===void 0)return u.removeItem(l,p);l=di(l);const{relativeKey:y,driver:_}=r(l);if(_.setItemRaw)await Mn(_.setItemRaw,y,d,p);else if(_.setItem)await Mn(_.setItem,y,wR(d),p);else return;_.watch||i("update",l)},async removeItem(l,d={}){typeof d=="boolean"&&(d={removeMeta:d}),l=di(l);const{relativeKey:p,driver:y}=r(l);y.removeItem&&(await Mn(y.removeItem,p,d),(d.removeMeta||d.removeMata)&&await Mn(y.removeItem,p+"$",d),y.watch||i("remove",l))},async getMeta(l,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),l=di(l);const{relativeKey:p,driver:y}=r(l),_=Object.create(null);if(y.getMeta&&Object.assign(_,await Mn(y.getMeta,p,d)),!d.nativeOnly){const M=await Mn(y.getItem,p+"$",d).then(O=>fd(O));M&&typeof M=="object"&&(typeof M.atime=="string"&&(M.atime=new Date(M.atime)),typeof M.mtime=="string"&&(M.mtime=new Date(M.mtime)),Object.assign(_,M))}return _},setMeta(l,d,p={}){return this.setItem(l+"$",d,p)},removeMeta(l,d={}){return this.removeItem(l+"$",d)},async getKeys(l,d={}){l=hd(l);const p=n(l,!0);let y=[];const _=[];for(const M of p){const O=await Mn(M.driver.getKeys,M.relativeBase,d);for(const L of O){const B=M.mountpoint+di(L);y.some(k=>B.startsWith(k))||_.push(B)}y=[M.mountpoint,...y.filter(L=>!L.startsWith(M.mountpoint))]}return l?_.filter(M=>M.startsWith(l)&&M[M.length-1]!=="$"):_.filter(M=>M[M.length-1]!=="$")},async clear(l,d={}){l=hd(l),await Promise.all(n(l,!1).map(async p=>{if(p.driver.clear)return Mn(p.driver.clear,p.relativeBase,d);if(p.driver.removeItem){const y=await p.driver.getKeys(p.relativeBase||"",d);return Promise.all(y.map(_=>p.driver.removeItem(_,d)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>bx(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(d=>d!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,d){if(l=hd(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((p,y)=>y.length-p.length)),e.mounts[l]=d,e.watching&&Promise.resolve(vx(d,i,l)).then(p=>{e.unwatch[l]=p}).catch(console.error),u},async unmount(l,d=!0){l=hd(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),d&&await bx(e.mounts[l]),e.mountpoints=e.mountpoints.filter(p=>p!==l),delete e.mounts[l])},getMount(l=""){l=di(l)+":";const d=r(l);return{driver:d.driver,base:d.base}},getMounts(l="",d={}){return l=di(l),n(l,d.parents).map(y=>({driver:y.driver,base:y.mountpoint}))},keys:(l,d={})=>u.getKeys(l,d),get:(l,d={})=>u.getItem(l,d),set:(l,d,p={})=>u.setItem(l,d,p),has:(l,d={})=>u.hasItem(l,d),del:(l,d={})=>u.removeItem(l,d),remove:(l,d={})=>u.removeItem(l,d)};return u}function vx(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function bx(t){typeof t.dispose=="function"&&await Mn(t.dispose)}function Za(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function yx(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Za(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let dm;function Qf(){return dm||(dm=yx("keyval-store","keyval")),dm}function wx(t,e=Qf()){return e("readonly",r=>Za(r.get(t)))}function PR(t,e,r=Qf()){return r("readwrite",n=>(n.put(e,t),Za(n.transaction)))}function MR(t,e=Qf()){return e("readwrite",r=>(r.delete(t),Za(r.transaction)))}function IR(t=Qf()){return t("readwrite",e=>(e.clear(),Za(e.transaction)))}function CR(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Za(t.transaction)}function TR(t=Qf()){return t("readonly",e=>{if(e.getAllKeys)return Za(e.getAllKeys());const r=[];return CR(e,n=>r.push(n.key)).then(()=>r)})}const RR=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),DR=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Qa(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return DR(t)}catch{return t}}function mo(t){return typeof t=="string"?t:RR(t)||""}const OR="idb-keyval";var NR=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=yx(t.dbName,t.storeName)),{name:OR,options:t,async hasItem(i){return!(typeof await wx(r(i),n)>"u")},async getItem(i){return await wx(r(i),n)??null},setItem(i,s){return PR(r(i),s,n)},removeItem(i){return MR(r(i),n)},getKeys(){return TR(n)},clear(){return IR(n)}}};const LR="WALLET_CONNECT_V2_INDEXED_DB",kR="keyvaluestorage";let BR=class{constructor(){this.indexedDb=AR({driver:NR({dbName:LR,storeName:kR})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,mo(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var pm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},dd={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof pm<"u"&&pm.localStorage?dd.exports=pm.localStorage:typeof window<"u"&&window.localStorage?dd.exports=window.localStorage:dd.exports=new e})();function $R(t){var e;return[t[0],Qa((e=t[1])!=null?e:"")]}let FR=class{constructor(){this.localStorage=dd.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map($R)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Qa(r)}async setItem(e,r){this.localStorage.setItem(e,mo(r))}async removeItem(e){this.localStorage.removeItem(e)}};const jR="wc_storage_version",xx=1,UR=async(t,e,r)=>{const n=jR,i=await e.getItem(n);if(i&&i>=xx){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,xx),r(e),qR(t,o)},qR=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let zR=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new FR;this.storage=e;try{const r=new BR;UR(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function HR(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var WR=KR;function KR(t,e,r){var n=r&&r.stringify||HR,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?p:0,t.charCodeAt(_+1)){case 100:case 102:if(d>=u||e[d]==null)break;p<_&&(l+=t.slice(p,_)),l+=Number(e[d]),p=_+2,_++;break;case 105:if(d>=u||e[d]==null)break;p<_&&(l+=t.slice(p,_)),l+=Math.floor(Number(e[d])),p=_+2,_++;break;case 79:case 111:case 106:if(d>=u||e[d]===void 0)break;p<_&&(l+=t.slice(p,_));var M=typeof e[d];if(M==="string"){l+="'"+e[d]+"'",p=_+2,_++;break}if(M==="function"){l+=e[d].name||"",p=_+2,_++;break}l+=n(e[d]),p=_+2,_++;break;case 115:if(d>=u)break;p<_&&(l+=t.slice(p,_)),l+=String(e[d]),p=_+2,_++;break;case 37:p<_&&(l+=t.slice(p,_)),l+="%",p=_+2,_++,d--;break}++d}++_}return p===-1?t:(p-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",u=Object.create(r);u.log||(u.log=tl),Object.defineProperty(u,"levelVal",{get:d}),Object.defineProperty(u,"level",{get:p,set:y});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:QR(t)};u.levels=vo.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=tl,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=_,e&&(u._logEvent=gm());function d(){return this.level==="silent"?1/0:this.levels.values[this.level]}function p(){return this._level}function y(M){if(M!=="silent"&&!this.levels.values[M])throw Error("unknown level "+M);this._level=M,au(l,u,"error","log"),au(l,u,"fatal","error"),au(l,u,"warn","error"),au(l,u,"info","log"),au(l,u,"debug","log"),au(l,u,"trace","log")}function _(M,O){if(!M)throw new Error("missing bindings for child Pino");O=O||{},i&&M.serializers&&(O.serializers=M.serializers);const L=O.serializers;if(i&&L){var B=Object.assign({},n,L),k=t.browser.serialize===!0?Object.keys(B):i;delete M.serializers,pd([M],k,B,this._stdErrSerialize)}function H(U){this._childLevel=(U._childLevel|0)+1,this.error=cu(U,M,"error"),this.fatal=cu(U,M,"fatal"),this.warn=cu(U,M,"warn"),this.info=cu(U,M,"info"),this.debug=cu(U,M,"debug"),this.trace=cu(U,M,"trace"),B&&(this.serializers=B,this._serialize=k),e&&(this._logEvent=gm([].concat(U._logEvent.bindings,M)))}return H.prototype=this,new H(this)}return u}vo.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},vo.stdSerializers=VR,vo.stdTimeFunctions=Object.assign({},{nullTime:Ex,epochTime:Sx,unixTime:eD,isoTime:tD});function au(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?tl:i[r]?i[r]:el[r]||el[n]||tl,YR(t,e,r)}function YR(t,e,r){!t.transmit&&e[r]===tl||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===el?el:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function cu(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},Px=class{constructor(e,r=vm){this.level=e??"error",this.levelValue=ou.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Ax(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===ou.levels.values.error?console.error(e):r===ou.levels.values.warn?console.warn(e):r===ou.levels.values.debug?console.debug(e):r===ou.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(mo({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new Ax(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(mo({extraMetadata:e})),new Blob(r,{type:"application/json"})}},sD=class{constructor(e,r=vm){this.baseChunkLogger=new Px(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},oD=class{constructor(e,r=vm){this.baseChunkLogger=new Px(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var aD=Object.defineProperty,cD=Object.defineProperties,uD=Object.getOwnPropertyDescriptors,Mx=Object.getOwnPropertySymbols,fD=Object.prototype.hasOwnProperty,lD=Object.prototype.propertyIsEnumerable,Ix=(t,e,r)=>e in t?aD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,md=(t,e)=>{for(var r in e||(e={}))fD.call(e,r)&&Ix(t,r,e[r]);if(Mx)for(var r of Mx(e))lD.call(e,r)&&Ix(t,r,e[r]);return t},vd=(t,e)=>cD(t,uD(e));function bd(t){return vd(md({},t),{level:(t==null?void 0:t.level)||nD.level})}function hD(t,e=nl){return t[e]||""}function dD(t,e,r=nl){return t[r]=e,t}function pi(t,e=nl){let r="";return typeof t.bindings>"u"?r=hD(t,e):r=t.bindings().context||"",r}function pD(t,e,r=nl){const n=pi(t,r);return n.trim()?`${n}/${e}`:e}function ti(t,e,r=nl){const n=pD(t,e,r),i=t.child({context:n});return dD(i,n,r)}function gD(t){var e,r;const n=new sD((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:rl(vd(md({},t.opts),{level:"trace",browser:vd(md({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function mD(t){var e;const r=new oD((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:rl(vd(md({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function vD(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?gD(t):mD(t)}let bD=class extends Xa{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},yD=class extends Xa{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},wD=class{constructor(e,r){this.logger=e,this.core=r}},xD=class extends Xa{constructor(e,r){super(),this.relayer=e,this.logger=r}},_D=class extends Xa{constructor(e){super()}},ED=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},SD=class extends Xa{constructor(e,r){super(),this.relayer=e,this.logger=r}},AD=class extends Xa{constructor(e,r){super(),this.core=e,this.logger=r}},PD=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},MD=class{constructor(e,r){this.projectId=e,this.logger=r}},ID=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},CD=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},TD=class{constructor(e){this.client=e}};var bm={},sa={},yd={},wd={};Object.defineProperty(wd,"__esModule",{value:!0}),wd.BrowserRandomSource=void 0;const Cx=65536;class RD{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let n=0;n>>16&65535,d=a&65535,p=u>>>16&65535,y=u&65535;return d*y+(l*y+d*p<<16>>>0)|0}t.mul=Math.imul||e;function r(a,u){return a+u|0}t.add=r;function n(a,u){return a-u|0}t.sub=n;function i(a,u){return a<>>32-u}t.rotl=i;function s(a,u){return a<<32-u|a>>>u}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(Rx),Object.defineProperty(or,"__esModule",{value:!0});var Dx=Rx;function $D(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}or.readInt16BE=$D;function FD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}or.readUint16BE=FD;function jD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}or.readInt16LE=jD;function UD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}or.readUint16LE=UD;function Ox(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}or.writeUint16BE=Ox,or.writeInt16BE=Ox;function Nx(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}or.writeUint16LE=Nx,or.writeInt16LE=Nx;function ym(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}or.readInt32BE=ym;function wm(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}or.readUint32BE=wm;function xm(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}or.readInt32LE=xm;function _m(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}or.readUint32LE=_m;function _d(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}or.writeUint32BE=_d,or.writeInt32BE=_d;function Ed(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}or.writeUint32LE=Ed,or.writeInt32LE=Ed;function qD(t,e){e===void 0&&(e=0);var r=ym(t,e),n=ym(t,e+4);return r*4294967296+n-(n>>31)*4294967296}or.readInt64BE=qD;function zD(t,e){e===void 0&&(e=0);var r=wm(t,e),n=wm(t,e+4);return r*4294967296+n}or.readUint64BE=zD;function HD(t,e){e===void 0&&(e=0);var r=xm(t,e),n=xm(t,e+4);return n*4294967296+r-(r>>31)*4294967296}or.readInt64LE=HD;function WD(t,e){e===void 0&&(e=0);var r=_m(t,e),n=_m(t,e+4);return n*4294967296+r}or.readUint64LE=WD;function Lx(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),_d(t/4294967296>>>0,e,r),_d(t>>>0,e,r+4),e}or.writeUint64BE=Lx,or.writeInt64BE=Lx;function kx(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Ed(t>>>0,e,r),Ed(t/4294967296>>>0,e,r+4),e}or.writeUint64LE=kx,or.writeInt64LE=kx;function KD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}or.readUintBE=KD;function VD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}or.writeUintBE=GD;function YD(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Dx.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s256)throw new Error("randomString charset is too long");let y="";const _=d.length,M=256-256%_;for(;l>0;){const O=i(Math.ceil(l*256/M),p);for(let L=0;L0;L++){const B=O[L];B0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,_=l%128<112?128:256;this._buffer[d]=128;for(var M=d+1;M<_-8;M++)this._buffer[M]=0;e.writeUint32BE(p,this._buffer,_-8),e.writeUint32BE(y,this._buffer,_-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,_),this._finished=!0}for(var M=0;M0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._stateHi.set(u.stateHi),this._stateLo.set(u.stateLo),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.stateHi),r.wipe(u.stateLo),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,u,l,d,p,y,_){for(var M=l[0],O=l[1],L=l[2],B=l[3],k=l[4],H=l[5],U=l[6],z=l[7],Z=d[0],R=d[1],W=d[2],ie=d[3],me=d[4],j=d[5],E=d[6],m=d[7],f,g,v,x,S,A,b,P;_>=128;){for(var I=0;I<16;I++){var F=8*I+y;a[I]=e.readUint32BE(p,F),u[I]=e.readUint32BE(p,F+4)}for(var I=0;I<80;I++){var ce=M,D=O,se=L,ee=B,J=k,Q=H,T=U,X=z,re=Z,ge=R,oe=W,fe=ie,be=me,Me=j,Ne=E,Te=m;if(f=z,g=m,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=(k>>>14|me<<18)^(k>>>18|me<<14)^(me>>>9|k<<23),g=(me>>>14|k<<18)^(me>>>18|k<<14)^(k>>>9|me<<23),S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,f=k&H^~k&U,g=me&j^~me&E,S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,f=i[I*2],g=i[I*2+1],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,f=a[I%16],g=u[I%16],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,v=b&65535|P<<16,x=S&65535|A<<16,f=v,g=x,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=(M>>>28|Z<<4)^(Z>>>2|M<<30)^(Z>>>7|M<<25),g=(Z>>>28|M<<4)^(M>>>2|Z<<30)^(M>>>7|Z<<25),S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,f=M&O^M&L^O&L,g=Z&R^Z&W^R&W,S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,X=b&65535|P<<16,Te=S&65535|A<<16,f=ee,g=fe,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=v,g=x,S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,ee=b&65535|P<<16,fe=S&65535|A<<16,O=ce,L=D,B=se,k=ee,H=J,U=Q,z=T,M=X,R=re,W=ge,ie=oe,me=fe,j=be,E=Me,m=Ne,Z=Te,I%16===15)for(var F=0;F<16;F++)f=a[F],g=u[F],S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=a[(F+9)%16],g=u[(F+9)%16],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,v=a[(F+1)%16],x=u[(F+1)%16],f=(v>>>1|x<<31)^(v>>>8|x<<24)^v>>>7,g=(x>>>1|v<<31)^(x>>>8|v<<24)^(x>>>7|v<<25),S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,v=a[(F+14)%16],x=u[(F+14)%16],f=(v>>>19|x<<13)^(x>>>29|v<<3)^v>>>6,g=(x>>>19|v<<13)^(v>>>29|x<<3)^(x>>>6|v<<26),S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,a[F]=b&65535|P<<16,u[F]=S&65535|A<<16}f=M,g=Z,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[0],g=d[0],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[0]=M=b&65535|P<<16,d[0]=Z=S&65535|A<<16,f=O,g=R,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[1],g=d[1],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[1]=O=b&65535|P<<16,d[1]=R=S&65535|A<<16,f=L,g=W,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[2],g=d[2],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[2]=L=b&65535|P<<16,d[2]=W=S&65535|A<<16,f=B,g=ie,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[3],g=d[3],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[3]=B=b&65535|P<<16,d[3]=ie=S&65535|A<<16,f=k,g=me,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[4],g=d[4],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[4]=k=b&65535|P<<16,d[4]=me=S&65535|A<<16,f=H,g=j,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[5],g=d[5],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[5]=H=b&65535|P<<16,d[5]=j=S&65535|A<<16,f=U,g=E,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[6],g=d[6],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[6]=U=b&65535|P<<16,d[6]=E=S&65535|A<<16,f=z,g=m,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[7],g=d[7],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[7]=z=b&65535|P<<16,d[7]=m=S&65535|A<<16,y+=128,_-=128}return y}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(Bx),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=sa,r=Bx,n=Mi;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(ee){const J=new Float64Array(16);if(ee)for(let Q=0;Q>16&1),Q[ge-1]&=65535;Q[15]=T[15]-32767-(Q[14]>>16&1);const re=Q[15]>>16&1;Q[14]&=65535,O(T,Q,1-re)}for(let X=0;X<16;X++)ee[2*X]=T[X]&255,ee[2*X+1]=T[X]>>8}function B(ee,J){let Q=0;for(let T=0;T<32;T++)Q|=ee[T]^J[T];return(1&Q-1>>>8)-1}function k(ee,J){const Q=new Uint8Array(32),T=new Uint8Array(32);return L(Q,ee),L(T,J),B(Q,T)}function H(ee){const J=new Uint8Array(32);return L(J,ee),J[0]&1}function U(ee,J){for(let Q=0;Q<16;Q++)ee[Q]=J[2*Q]+(J[2*Q+1]<<8);ee[15]&=32767}function z(ee,J,Q){for(let T=0;T<16;T++)ee[T]=J[T]+Q[T]}function Z(ee,J,Q){for(let T=0;T<16;T++)ee[T]=J[T]-Q[T]}function R(ee,J,Q){let T,X,re=0,ge=0,oe=0,fe=0,be=0,Me=0,Ne=0,Te=0,$e=0,Ie=0,Le=0,Ve=0,ke=0,ze=0,He=0,Se=0,Qe=0,ct=0,Be=0,et=0,rt=0,Je=0,gt=0,ht=0,ft=0,Ht=0,Jt=0,St=0,er=0,Xt=0,Ot=0,Bt=Q[0],Tt=Q[1],bt=Q[2],Dt=Q[3],Lt=Q[4],yt=Q[5],$t=Q[6],jt=Q[7],nt=Q[8],Ft=Q[9],$=Q[10],K=Q[11],G=Q[12],C=Q[13],Y=Q[14],q=Q[15];T=J[0],re+=T*Bt,ge+=T*Tt,oe+=T*bt,fe+=T*Dt,be+=T*Lt,Me+=T*yt,Ne+=T*$t,Te+=T*jt,$e+=T*nt,Ie+=T*Ft,Le+=T*$,Ve+=T*K,ke+=T*G,ze+=T*C,He+=T*Y,Se+=T*q,T=J[1],ge+=T*Bt,oe+=T*Tt,fe+=T*bt,be+=T*Dt,Me+=T*Lt,Ne+=T*yt,Te+=T*$t,$e+=T*jt,Ie+=T*nt,Le+=T*Ft,Ve+=T*$,ke+=T*K,ze+=T*G,He+=T*C,Se+=T*Y,Qe+=T*q,T=J[2],oe+=T*Bt,fe+=T*Tt,be+=T*bt,Me+=T*Dt,Ne+=T*Lt,Te+=T*yt,$e+=T*$t,Ie+=T*jt,Le+=T*nt,Ve+=T*Ft,ke+=T*$,ze+=T*K,He+=T*G,Se+=T*C,Qe+=T*Y,ct+=T*q,T=J[3],fe+=T*Bt,be+=T*Tt,Me+=T*bt,Ne+=T*Dt,Te+=T*Lt,$e+=T*yt,Ie+=T*$t,Le+=T*jt,Ve+=T*nt,ke+=T*Ft,ze+=T*$,He+=T*K,Se+=T*G,Qe+=T*C,ct+=T*Y,Be+=T*q,T=J[4],be+=T*Bt,Me+=T*Tt,Ne+=T*bt,Te+=T*Dt,$e+=T*Lt,Ie+=T*yt,Le+=T*$t,Ve+=T*jt,ke+=T*nt,ze+=T*Ft,He+=T*$,Se+=T*K,Qe+=T*G,ct+=T*C,Be+=T*Y,et+=T*q,T=J[5],Me+=T*Bt,Ne+=T*Tt,Te+=T*bt,$e+=T*Dt,Ie+=T*Lt,Le+=T*yt,Ve+=T*$t,ke+=T*jt,ze+=T*nt,He+=T*Ft,Se+=T*$,Qe+=T*K,ct+=T*G,Be+=T*C,et+=T*Y,rt+=T*q,T=J[6],Ne+=T*Bt,Te+=T*Tt,$e+=T*bt,Ie+=T*Dt,Le+=T*Lt,Ve+=T*yt,ke+=T*$t,ze+=T*jt,He+=T*nt,Se+=T*Ft,Qe+=T*$,ct+=T*K,Be+=T*G,et+=T*C,rt+=T*Y,Je+=T*q,T=J[7],Te+=T*Bt,$e+=T*Tt,Ie+=T*bt,Le+=T*Dt,Ve+=T*Lt,ke+=T*yt,ze+=T*$t,He+=T*jt,Se+=T*nt,Qe+=T*Ft,ct+=T*$,Be+=T*K,et+=T*G,rt+=T*C,Je+=T*Y,gt+=T*q,T=J[8],$e+=T*Bt,Ie+=T*Tt,Le+=T*bt,Ve+=T*Dt,ke+=T*Lt,ze+=T*yt,He+=T*$t,Se+=T*jt,Qe+=T*nt,ct+=T*Ft,Be+=T*$,et+=T*K,rt+=T*G,Je+=T*C,gt+=T*Y,ht+=T*q,T=J[9],Ie+=T*Bt,Le+=T*Tt,Ve+=T*bt,ke+=T*Dt,ze+=T*Lt,He+=T*yt,Se+=T*$t,Qe+=T*jt,ct+=T*nt,Be+=T*Ft,et+=T*$,rt+=T*K,Je+=T*G,gt+=T*C,ht+=T*Y,ft+=T*q,T=J[10],Le+=T*Bt,Ve+=T*Tt,ke+=T*bt,ze+=T*Dt,He+=T*Lt,Se+=T*yt,Qe+=T*$t,ct+=T*jt,Be+=T*nt,et+=T*Ft,rt+=T*$,Je+=T*K,gt+=T*G,ht+=T*C,ft+=T*Y,Ht+=T*q,T=J[11],Ve+=T*Bt,ke+=T*Tt,ze+=T*bt,He+=T*Dt,Se+=T*Lt,Qe+=T*yt,ct+=T*$t,Be+=T*jt,et+=T*nt,rt+=T*Ft,Je+=T*$,gt+=T*K,ht+=T*G,ft+=T*C,Ht+=T*Y,Jt+=T*q,T=J[12],ke+=T*Bt,ze+=T*Tt,He+=T*bt,Se+=T*Dt,Qe+=T*Lt,ct+=T*yt,Be+=T*$t,et+=T*jt,rt+=T*nt,Je+=T*Ft,gt+=T*$,ht+=T*K,ft+=T*G,Ht+=T*C,Jt+=T*Y,St+=T*q,T=J[13],ze+=T*Bt,He+=T*Tt,Se+=T*bt,Qe+=T*Dt,ct+=T*Lt,Be+=T*yt,et+=T*$t,rt+=T*jt,Je+=T*nt,gt+=T*Ft,ht+=T*$,ft+=T*K,Ht+=T*G,Jt+=T*C,St+=T*Y,er+=T*q,T=J[14],He+=T*Bt,Se+=T*Tt,Qe+=T*bt,ct+=T*Dt,Be+=T*Lt,et+=T*yt,rt+=T*$t,Je+=T*jt,gt+=T*nt,ht+=T*Ft,ft+=T*$,Ht+=T*K,Jt+=T*G,St+=T*C,er+=T*Y,Xt+=T*q,T=J[15],Se+=T*Bt,Qe+=T*Tt,ct+=T*bt,Be+=T*Dt,et+=T*Lt,rt+=T*yt,Je+=T*$t,gt+=T*jt,ht+=T*nt,ft+=T*Ft,Ht+=T*$,Jt+=T*K,St+=T*G,er+=T*C,Xt+=T*Y,Ot+=T*q,re+=38*Qe,ge+=38*ct,oe+=38*Be,fe+=38*et,be+=38*rt,Me+=38*Je,Ne+=38*gt,Te+=38*ht,$e+=38*ft,Ie+=38*Ht,Le+=38*Jt,Ve+=38*St,ke+=38*er,ze+=38*Xt,He+=38*Ot,X=1,T=re+X+65535,X=Math.floor(T/65536),re=T-X*65536,T=ge+X+65535,X=Math.floor(T/65536),ge=T-X*65536,T=oe+X+65535,X=Math.floor(T/65536),oe=T-X*65536,T=fe+X+65535,X=Math.floor(T/65536),fe=T-X*65536,T=be+X+65535,X=Math.floor(T/65536),be=T-X*65536,T=Me+X+65535,X=Math.floor(T/65536),Me=T-X*65536,T=Ne+X+65535,X=Math.floor(T/65536),Ne=T-X*65536,T=Te+X+65535,X=Math.floor(T/65536),Te=T-X*65536,T=$e+X+65535,X=Math.floor(T/65536),$e=T-X*65536,T=Ie+X+65535,X=Math.floor(T/65536),Ie=T-X*65536,T=Le+X+65535,X=Math.floor(T/65536),Le=T-X*65536,T=Ve+X+65535,X=Math.floor(T/65536),Ve=T-X*65536,T=ke+X+65535,X=Math.floor(T/65536),ke=T-X*65536,T=ze+X+65535,X=Math.floor(T/65536),ze=T-X*65536,T=He+X+65535,X=Math.floor(T/65536),He=T-X*65536,T=Se+X+65535,X=Math.floor(T/65536),Se=T-X*65536,re+=X-1+37*(X-1),X=1,T=re+X+65535,X=Math.floor(T/65536),re=T-X*65536,T=ge+X+65535,X=Math.floor(T/65536),ge=T-X*65536,T=oe+X+65535,X=Math.floor(T/65536),oe=T-X*65536,T=fe+X+65535,X=Math.floor(T/65536),fe=T-X*65536,T=be+X+65535,X=Math.floor(T/65536),be=T-X*65536,T=Me+X+65535,X=Math.floor(T/65536),Me=T-X*65536,T=Ne+X+65535,X=Math.floor(T/65536),Ne=T-X*65536,T=Te+X+65535,X=Math.floor(T/65536),Te=T-X*65536,T=$e+X+65535,X=Math.floor(T/65536),$e=T-X*65536,T=Ie+X+65535,X=Math.floor(T/65536),Ie=T-X*65536,T=Le+X+65535,X=Math.floor(T/65536),Le=T-X*65536,T=Ve+X+65535,X=Math.floor(T/65536),Ve=T-X*65536,T=ke+X+65535,X=Math.floor(T/65536),ke=T-X*65536,T=ze+X+65535,X=Math.floor(T/65536),ze=T-X*65536,T=He+X+65535,X=Math.floor(T/65536),He=T-X*65536,T=Se+X+65535,X=Math.floor(T/65536),Se=T-X*65536,re+=X-1+37*(X-1),ee[0]=re,ee[1]=ge,ee[2]=oe,ee[3]=fe,ee[4]=be,ee[5]=Me,ee[6]=Ne,ee[7]=Te,ee[8]=$e,ee[9]=Ie,ee[10]=Le,ee[11]=Ve,ee[12]=ke,ee[13]=ze,ee[14]=He,ee[15]=Se}function W(ee,J){R(ee,J,J)}function ie(ee,J){const Q=i();let T;for(T=0;T<16;T++)Q[T]=J[T];for(T=253;T>=0;T--)W(Q,Q),T!==2&&T!==4&&R(Q,Q,J);for(T=0;T<16;T++)ee[T]=Q[T]}function me(ee,J){const Q=i();let T;for(T=0;T<16;T++)Q[T]=J[T];for(T=250;T>=0;T--)W(Q,Q),T!==1&&R(Q,Q,J);for(T=0;T<16;T++)ee[T]=Q[T]}function j(ee,J){const Q=i(),T=i(),X=i(),re=i(),ge=i(),oe=i(),fe=i(),be=i(),Me=i();Z(Q,ee[1],ee[0]),Z(Me,J[1],J[0]),R(Q,Q,Me),z(T,ee[0],ee[1]),z(Me,J[0],J[1]),R(T,T,Me),R(X,ee[3],J[3]),R(X,X,l),R(re,ee[2],J[2]),z(re,re,re),Z(ge,T,Q),Z(oe,re,X),z(fe,re,X),z(be,T,Q),R(ee[0],ge,oe),R(ee[1],be,fe),R(ee[2],fe,oe),R(ee[3],ge,be)}function E(ee,J,Q){for(let T=0;T<4;T++)O(ee[T],J[T],Q)}function m(ee,J){const Q=i(),T=i(),X=i();ie(X,J[2]),R(Q,J[0],X),R(T,J[1],X),L(ee,T),ee[31]^=H(Q)<<7}function f(ee,J,Q){_(ee[0],o),_(ee[1],a),_(ee[2],a),_(ee[3],o);for(let T=255;T>=0;--T){const X=Q[T/8|0]>>(T&7)&1;E(ee,J,X),j(J,ee),j(ee,ee),E(ee,J,X)}}function g(ee,J){const Q=[i(),i(),i(),i()];_(Q[0],d),_(Q[1],p),_(Q[2],a),R(Q[3],d,p),f(ee,Q,J)}function v(ee){if(ee.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const J=(0,r.hash)(ee);J[0]&=248,J[31]&=127,J[31]|=64;const Q=new Uint8Array(32),T=[i(),i(),i(),i()];g(T,J),m(Q,T);const X=new Uint8Array(64);return X.set(ee),X.set(Q,32),{publicKey:Q,secretKey:X}}t.generateKeyPairFromSeed=v;function x(ee){const J=(0,e.randomBytes)(32,ee),Q=v(J);return(0,n.wipe)(J),Q}t.generateKeyPair=x;function S(ee){if(ee.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(ee.subarray(32))}t.extractPublicKeyFromSecretKey=S;const A=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function b(ee,J){let Q,T,X,re;for(T=63;T>=32;--T){for(Q=0,X=T-32,re=T-12;X>4)*A[X],Q=J[X]>>8,J[X]&=255;for(X=0;X<32;X++)J[X]-=Q*A[X];for(T=0;T<32;T++)J[T+1]+=J[T]>>8,ee[T]=J[T]&255}function P(ee){const J=new Float64Array(64);for(let Q=0;Q<64;Q++)J[Q]=ee[Q];for(let Q=0;Q<64;Q++)ee[Q]=0;b(ee,J)}function I(ee,J){const Q=new Float64Array(64),T=[i(),i(),i(),i()],X=(0,r.hash)(ee.subarray(0,32));X[0]&=248,X[31]&=127,X[31]|=64;const re=new Uint8Array(64);re.set(X.subarray(32),32);const ge=new r.SHA512;ge.update(re.subarray(32)),ge.update(J);const oe=ge.digest();ge.clean(),P(oe),g(T,oe),m(re,T),ge.reset(),ge.update(re.subarray(0,32)),ge.update(ee.subarray(32)),ge.update(J);const fe=ge.digest();P(fe);for(let be=0;be<32;be++)Q[be]=oe[be];for(let be=0;be<32;be++)for(let Me=0;Me<32;Me++)Q[be+Me]+=fe[be]*X[Me];return b(re.subarray(32),Q),re}t.sign=I;function F(ee,J){const Q=i(),T=i(),X=i(),re=i(),ge=i(),oe=i(),fe=i();return _(ee[2],a),U(ee[1],J),W(X,ee[1]),R(re,X,u),Z(X,X,ee[2]),z(re,ee[2],re),W(ge,re),W(oe,ge),R(fe,oe,ge),R(Q,fe,X),R(Q,Q,re),me(Q,Q),R(Q,Q,X),R(Q,Q,re),R(Q,Q,re),R(ee[0],Q,re),W(T,ee[0]),R(T,T,re),k(T,X)&&R(ee[0],ee[0],y),W(T,ee[0]),R(T,T,re),k(T,X)?-1:(H(ee[0])===J[31]>>7&&Z(ee[0],o,ee[0]),R(ee[3],ee[0],ee[1]),0)}function ce(ee,J,Q){const T=new Uint8Array(32),X=[i(),i(),i(),i()],re=[i(),i(),i(),i()];if(Q.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(F(re,ee))return!1;const ge=new r.SHA512;ge.update(Q.subarray(0,32)),ge.update(ee),ge.update(J);const oe=ge.digest();return P(oe),f(X,re,oe),g(re,Q.subarray(32)),j(X,re),m(T,X),!B(Q,T)}t.verify=ce;function D(ee){let J=[i(),i(),i(),i()];if(F(J,ee))throw new Error("Ed25519: invalid public key");let Q=i(),T=i(),X=J[1];z(Q,a,X),Z(T,a,X),ie(T,T),R(Q,Q,T);let re=new Uint8Array(32);return L(re,Q),re}t.convertPublicKeyToX25519=D;function se(ee){const J=(0,r.hash)(ee.subarray(0,32));J[0]&=248,J[31]&=127,J[31]|=64;const Q=new Uint8Array(J.subarray(0,32));return(0,n.wipe)(J),Q}t.convertSecretKeyToX25519=se}(bm);const iO="EdDSA",sO="JWT",Sd=".",Ad="base64url",$x="utf8",Fx="utf8",oO=":",aO="did",cO="key",jx="base58btc",uO="z",fO="K36",lO=32;function Ux(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Pd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=Ux(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function hO(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(H);B!==k;){for(var z=M[B],Z=0,R=H-1;(z!==0||Z>>0,U[R]=z%a>>>0,z=z/a>>>0;if(z!==0)throw new Error("Non-zero carry");L=Z,B++}for(var W=H-L;W!==H&&U[W]===0;)W++;for(var ie=u.repeat(O);W>>0,H=new Uint8Array(k);M[O];){var U=r[M.charCodeAt(O)];if(U===255)return;for(var z=0,Z=k-1;(U!==0||z>>0,H[Z]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");B=z,O++}if(M[O]!==" "){for(var R=k-B;R!==k&&H[R]===0;)R++;for(var W=new Uint8Array(L+(k-R)),ie=L;R!==k;)W[ie++]=H[R++];return W}}}function _(M){var O=y(M);if(O)return O;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:_}}var dO=hO,pO=dO;const gO=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},mO=t=>new TextEncoder().encode(t),vO=t=>new TextDecoder().decode(t);class bO{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class yO{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return qx(this,e)}}class wO{constructor(e){this.decoders=e}or(e){return qx(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const qx=(t,e)=>new wO({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class xO{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new bO(e,r,n),this.decoder=new yO(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Md=({name:t,prefix:e,encode:r,decode:n})=>new xO(t,e,r,n),sl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=pO(r,e);return Md({prefix:t,name:e,encode:n,decode:s=>gO(i(s))})},_O=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},EO=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Md({prefix:e,name:t,encode(i){return EO(i,n,r)},decode(i){return _O(i,n,r,t)}}),SO=Md({prefix:"\0",name:"identity",encode:t=>vO(t),decode:t=>mO(t)}),AO=Object.freeze(Object.defineProperty({__proto__:null,identity:SO},Symbol.toStringTag,{value:"Module"})),PO=Bn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),MO=Object.freeze(Object.defineProperty({__proto__:null,base2:PO},Symbol.toStringTag,{value:"Module"})),IO=Bn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),CO=Object.freeze(Object.defineProperty({__proto__:null,base8:IO},Symbol.toStringTag,{value:"Module"})),TO=sl({prefix:"9",name:"base10",alphabet:"0123456789"}),RO=Object.freeze(Object.defineProperty({__proto__:null,base10:TO},Symbol.toStringTag,{value:"Module"})),DO=Bn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),OO=Bn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),NO=Object.freeze(Object.defineProperty({__proto__:null,base16:DO,base16upper:OO},Symbol.toStringTag,{value:"Module"})),LO=Bn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),kO=Bn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),BO=Bn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),$O=Bn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),FO=Bn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),jO=Bn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),UO=Bn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),qO=Bn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),zO=Bn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),HO=Object.freeze(Object.defineProperty({__proto__:null,base32:LO,base32hex:FO,base32hexpad:UO,base32hexpadupper:qO,base32hexupper:jO,base32pad:BO,base32padupper:$O,base32upper:kO,base32z:zO},Symbol.toStringTag,{value:"Module"})),WO=sl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),KO=sl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),VO=Object.freeze(Object.defineProperty({__proto__:null,base36:WO,base36upper:KO},Symbol.toStringTag,{value:"Module"})),GO=sl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),YO=sl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),JO=Object.freeze(Object.defineProperty({__proto__:null,base58btc:GO,base58flickr:YO},Symbol.toStringTag,{value:"Module"})),XO=Bn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ZO=Bn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),QO=Bn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),eN=Bn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),tN=Object.freeze(Object.defineProperty({__proto__:null,base64:XO,base64pad:ZO,base64url:QO,base64urlpad:eN},Symbol.toStringTag,{value:"Module"})),zx=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),rN=zx.reduce((t,e,r)=>(t[r]=e,t),[]),nN=zx.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function iN(t){return t.reduce((e,r)=>(e+=rN[r],e),"")}function sN(t){const e=[];for(const r of t){const n=nN[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const oN=Md({prefix:"🚀",name:"base256emoji",encode:iN,decode:sN}),aN=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:oN},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const Hx={...AO,...MO,...CO,...RO,...NO,...HO,...VO,...JO,...tN,...aN};function Wx(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const Kx=Wx("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Em=Wx("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=Ux(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new vN:typeof navigator<"u"?EN(navigator.userAgent):AN()}function _N(t){return t!==""&&wN.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function EN(t){var e=_N(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new mN;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length-1){const L=M.getAttribute("href");if(L)if(L.toLowerCase().indexOf("https:")===-1&&L.toLowerCase().indexOf("http:")===-1&&L.indexOf("//")!==0){let B=e.protocol+"//"+e.host;if(L.indexOf("/")===0)B+=L;else{const k=e.pathname.split("/");k.pop();const H=k.join("/");B+=H+"/"+L}y.push(B)}else if(L.indexOf("//")===0){const B=e.protocol+L;y.push(B)}else y.push(L)}}return y}function n(...p){const y=t.getElementsByTagName("meta");for(let _=0;_M.getAttribute(L)).filter(L=>L?p.includes(L):!1);if(O.length&&O){const L=M.getAttribute("content");if(L)return L}}return""}function i(){let p=n("name","og:site_name","og:title","twitter:title");return p||(p=t.title),p}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}t3=Pm.getWindowMetadata=BN;var al={},$N=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),n3="%[a-f0-9]{2}",i3=new RegExp("("+n3+")|([^%]+?)","gi"),s3=new RegExp("("+n3+")+","gi");function Mm(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],Mm(r),Mm(n))}function FN(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(i3)||[],r=1;r{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},zN=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;sk==null,o=Symbol("encodeFragmentIdentifier");function a(k){switch(k.arrayFormat){case"index":return H=>(U,z)=>{const Z=U.length;return z===void 0||k.skipNull&&z===null||k.skipEmptyString&&z===""?U:z===null?[...U,[d(H,k),"[",Z,"]"].join("")]:[...U,[d(H,k),"[",d(Z,k),"]=",d(z,k)].join("")]};case"bracket":return H=>(U,z)=>z===void 0||k.skipNull&&z===null||k.skipEmptyString&&z===""?U:z===null?[...U,[d(H,k),"[]"].join("")]:[...U,[d(H,k),"[]=",d(z,k)].join("")];case"colon-list-separator":return H=>(U,z)=>z===void 0||k.skipNull&&z===null||k.skipEmptyString&&z===""?U:z===null?[...U,[d(H,k),":list="].join("")]:[...U,[d(H,k),":list=",d(z,k)].join("")];case"comma":case"separator":case"bracket-separator":{const H=k.arrayFormat==="bracket-separator"?"[]=":"=";return U=>(z,Z)=>Z===void 0||k.skipNull&&Z===null||k.skipEmptyString&&Z===""?z:(Z=Z===null?"":Z,z.length===0?[[d(U,k),H,d(Z,k)].join("")]:[[z,d(Z,k)].join(k.arrayFormatSeparator)])}default:return H=>(U,z)=>z===void 0||k.skipNull&&z===null||k.skipEmptyString&&z===""?U:z===null?[...U,d(H,k)]:[...U,[d(H,k),"=",d(z,k)].join("")]}}function u(k){let H;switch(k.arrayFormat){case"index":return(U,z,Z)=>{if(H=/\[(\d*)\]$/.exec(U),U=U.replace(/\[\d*\]$/,""),!H){Z[U]=z;return}Z[U]===void 0&&(Z[U]={}),Z[U][H[1]]=z};case"bracket":return(U,z,Z)=>{if(H=/(\[\])$/.exec(U),U=U.replace(/\[\]$/,""),!H){Z[U]=z;return}if(Z[U]===void 0){Z[U]=[z];return}Z[U]=[].concat(Z[U],z)};case"colon-list-separator":return(U,z,Z)=>{if(H=/(:list)$/.exec(U),U=U.replace(/:list$/,""),!H){Z[U]=z;return}if(Z[U]===void 0){Z[U]=[z];return}Z[U]=[].concat(Z[U],z)};case"comma":case"separator":return(U,z,Z)=>{const R=typeof z=="string"&&z.includes(k.arrayFormatSeparator),W=typeof z=="string"&&!R&&p(z,k).includes(k.arrayFormatSeparator);z=W?p(z,k):z;const ie=R||W?z.split(k.arrayFormatSeparator).map(me=>p(me,k)):z===null?z:p(z,k);Z[U]=ie};case"bracket-separator":return(U,z,Z)=>{const R=/(\[\])$/.test(U);if(U=U.replace(/\[\]$/,""),!R){Z[U]=z&&p(z,k);return}const W=z===null?[]:z.split(k.arrayFormatSeparator).map(ie=>p(ie,k));if(Z[U]===void 0){Z[U]=W;return}Z[U]=[].concat(Z[U],W)};default:return(U,z,Z)=>{if(Z[U]===void 0){Z[U]=z;return}Z[U]=[].concat(Z[U],z)}}}function l(k){if(typeof k!="string"||k.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function d(k,H){return H.encode?H.strict?e(k):encodeURIComponent(k):k}function p(k,H){return H.decode?r(k):k}function y(k){return Array.isArray(k)?k.sort():typeof k=="object"?y(Object.keys(k)).sort((H,U)=>Number(H)-Number(U)).map(H=>k[H]):k}function _(k){const H=k.indexOf("#");return H!==-1&&(k=k.slice(0,H)),k}function M(k){let H="";const U=k.indexOf("#");return U!==-1&&(H=k.slice(U)),H}function O(k){k=_(k);const H=k.indexOf("?");return H===-1?"":k.slice(H+1)}function L(k,H){return H.parseNumbers&&!Number.isNaN(Number(k))&&typeof k=="string"&&k.trim()!==""?k=Number(k):H.parseBooleans&&k!==null&&(k.toLowerCase()==="true"||k.toLowerCase()==="false")&&(k=k.toLowerCase()==="true"),k}function B(k,H){H=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},H),l(H.arrayFormatSeparator);const U=u(H),z=Object.create(null);if(typeof k!="string"||(k=k.trim().replace(/^[?#&]/,""),!k))return z;for(const Z of k.split("&")){if(Z==="")continue;let[R,W]=n(H.decode?Z.replace(/\+/g," "):Z,"=");W=W===void 0?null:["comma","separator","bracket-separator"].includes(H.arrayFormat)?W:p(W,H),U(p(R,H),W,z)}for(const Z of Object.keys(z)){const R=z[Z];if(typeof R=="object"&&R!==null)for(const W of Object.keys(R))R[W]=L(R[W],H);else z[Z]=L(R,H)}return H.sort===!1?z:(H.sort===!0?Object.keys(z).sort():Object.keys(z).sort(H.sort)).reduce((Z,R)=>{const W=z[R];return W&&typeof W=="object"&&!Array.isArray(W)?Z[R]=y(W):Z[R]=W,Z},Object.create(null))}t.extract=O,t.parse=B,t.stringify=(k,H)=>{if(!k)return"";H=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},H),l(H.arrayFormatSeparator);const U=W=>H.skipNull&&s(k[W])||H.skipEmptyString&&k[W]==="",z=a(H),Z={};for(const W of Object.keys(k))U(W)||(Z[W]=k[W]);const R=Object.keys(Z);return H.sort!==!1&&R.sort(H.sort),R.map(W=>{const ie=k[W];return ie===void 0?"":ie===null?d(W,H):Array.isArray(ie)?ie.length===0&&H.arrayFormat==="bracket-separator"?d(W,H)+"[]":ie.reduce(z(W),[]).join("&"):d(W,H)+"="+d(ie,H)}).filter(W=>W.length>0).join("&")},t.parseUrl=(k,H)=>{H=Object.assign({decode:!0},H);const[U,z]=n(k,"#");return Object.assign({url:U.split("?")[0]||"",query:B(O(k),H)},H&&H.parseFragmentIdentifier&&z?{fragmentIdentifier:p(z,H)}:{})},t.stringifyUrl=(k,H)=>{H=Object.assign({encode:!0,strict:!0,[o]:!0},H);const U=_(k.url).split("?")[0]||"",z=t.extract(k.url),Z=t.parse(z,{sort:!1}),R=Object.assign(Z,k.query);let W=t.stringify(R,H);W&&(W=`?${W}`);let ie=M(k.url);return k.fragmentIdentifier&&(ie=`#${H[o]?d(k.fragmentIdentifier,H):k.fragmentIdentifier}`),`${U}${W}${ie}`},t.pick=(k,H,U)=>{U=Object.assign({parseFragmentIdentifier:!0,[o]:!1},U);const{url:z,query:Z,fragmentIdentifier:R}=t.parseUrl(k,U);return t.stringifyUrl({url:z,query:i(Z,H),fragmentIdentifier:R},U)},t.exclude=(k,H,U)=>{const z=Array.isArray(H)?Z=>!H.includes(Z):(Z,R)=>!H(Z,R);return t.pick(k,z,U)}})(al);var o3={exports:{}};/** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.8.0 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT - */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=nn:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],p=[4,1024,262144,67108864],y=[1,256,65536,16777216],_=[6,1536,393216,100663296],M=[0,8,16,24],O=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],L=[224,256,384,512],B=[128,256],k=["hex","buffer","arrayBuffer","array","digest"],H={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(D){return Object.prototype.toString.call(D)==="[object Array]"}),u&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(D){return typeof D=="object"&&D.buffer&&D.buffer.constructor===ArrayBuffer});for(var U=function(D,se,ee){return function(J){return new I(D,se,D).update(J)[ee]()}},z=function(D,se,ee){return function(J,Q){return new I(D,se,Q).update(J)[ee]()}},Z=function(D,se,ee){return function(J,Q,T,X){return f["cshake"+D].update(J,Q,T,X)[ee]()}},R=function(D,se,ee){return function(J,Q,T,X){return f["kmac"+D].update(J,Q,T,X)[ee]()}},W=function(D,se,ee,J){for(var Q=0;Q>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ee>>5,this.extraBytes=(ee&31)>>3;for(var J=0;J<50;++J)this.s[J]=0}I.prototype.update=function(D){if(this.finalized)throw new Error(r);var se,ee=typeof D;if(ee!=="string"){if(ee==="object"){if(D===null)throw new Error(e);if(u&&D.constructor===ArrayBuffer)D=new Uint8Array(D);else if(!Array.isArray(D)&&(!u||!ArrayBuffer.isView(D)))throw new Error(e)}else throw new Error(e);se=!0}for(var J=this.blocks,Q=this.byteCount,T=D.length,X=this.blockCount,re=0,ge=this.s,oe,fe;re>2]|=D[re]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(J[oe>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=Q){for(this.start=oe-Q,this.block=J[X],oe=0;oe>8,ee=D&255;ee>0;)Q.unshift(ee),D=D>>8,ee=D&255,++J;return se?Q.push(J):Q.unshift(J),this.update(Q),Q.length},I.prototype.encodeString=function(D){var se,ee=typeof D;if(ee!=="string"){if(ee==="object"){if(D===null)throw new Error(e);if(u&&D.constructor===ArrayBuffer)D=new Uint8Array(D);else if(!Array.isArray(D)&&(!u||!ArrayBuffer.isView(D)))throw new Error(e)}else throw new Error(e);se=!0}var J=0,Q=D.length;if(se)J=Q;else for(var T=0;T=57344?J+=3:(X=65536+((X&1023)<<10|D.charCodeAt(++T)&1023),J+=4)}return J+=this.encode(J*8),this.update(D),J},I.prototype.bytepad=function(D,se){for(var ee=this.encode(se),J=0;J>2]|=this.padding[se&3],this.lastByteIndex===this.byteCount)for(D[0]=D[ee],se=1;se>4&15]+l[re&15]+l[re>>12&15]+l[re>>8&15]+l[re>>20&15]+l[re>>16&15]+l[re>>28&15]+l[re>>24&15];T%D===0&&(ce(se),Q=0)}return J&&(re=se[Q],X+=l[re>>4&15]+l[re&15],J>1&&(X+=l[re>>12&15]+l[re>>8&15]),J>2&&(X+=l[re>>20&15]+l[re>>16&15])),X},I.prototype.arrayBuffer=function(){this.finalize();var D=this.blockCount,se=this.s,ee=this.outputBlocks,J=this.extraBytes,Q=0,T=0,X=this.outputBits>>3,re;J?re=new ArrayBuffer(ee+1<<2):re=new ArrayBuffer(X);for(var ge=new Uint32Array(re);T>8&255,X[re+2]=ge>>16&255,X[re+3]=ge>>24&255;T%D===0&&ce(se)}return J&&(re=T<<2,ge=se[Q],X[re]=ge&255,J>1&&(X[re+1]=ge>>8&255),J>2&&(X[re+2]=ge>>16&255)),X};function F(D,se,ee){I.call(this,D,se,ee)}F.prototype=new I,F.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var ce=function(D){var se,ee,J,Q,T,X,re,ge,oe,fe,be,Me,Ne,Te,$e,Ie,Le,Ve,ke,ze,He,Se,Qe,ct,Be,et,rt,Je,gt,ht,ft,Ht,Jt,St,er,Xt,Ot,Bt,Tt,bt,Dt,Lt,yt,$t,jt,nt,Ft,$,K,G,C,Y,q,ae,pe,_e,Re,De,it,Ue,mt,st,tt;for(J=0;J<48;J+=2)Q=D[0]^D[10]^D[20]^D[30]^D[40],T=D[1]^D[11]^D[21]^D[31]^D[41],X=D[2]^D[12]^D[22]^D[32]^D[42],re=D[3]^D[13]^D[23]^D[33]^D[43],ge=D[4]^D[14]^D[24]^D[34]^D[44],oe=D[5]^D[15]^D[25]^D[35]^D[45],fe=D[6]^D[16]^D[26]^D[36]^D[46],be=D[7]^D[17]^D[27]^D[37]^D[47],Me=D[8]^D[18]^D[28]^D[38]^D[48],Ne=D[9]^D[19]^D[29]^D[39]^D[49],se=Me^(X<<1|re>>>31),ee=Ne^(re<<1|X>>>31),D[0]^=se,D[1]^=ee,D[10]^=se,D[11]^=ee,D[20]^=se,D[21]^=ee,D[30]^=se,D[31]^=ee,D[40]^=se,D[41]^=ee,se=Q^(ge<<1|oe>>>31),ee=T^(oe<<1|ge>>>31),D[2]^=se,D[3]^=ee,D[12]^=se,D[13]^=ee,D[22]^=se,D[23]^=ee,D[32]^=se,D[33]^=ee,D[42]^=se,D[43]^=ee,se=X^(fe<<1|be>>>31),ee=re^(be<<1|fe>>>31),D[4]^=se,D[5]^=ee,D[14]^=se,D[15]^=ee,D[24]^=se,D[25]^=ee,D[34]^=se,D[35]^=ee,D[44]^=se,D[45]^=ee,se=ge^(Me<<1|Ne>>>31),ee=oe^(Ne<<1|Me>>>31),D[6]^=se,D[7]^=ee,D[16]^=se,D[17]^=ee,D[26]^=se,D[27]^=ee,D[36]^=se,D[37]^=ee,D[46]^=se,D[47]^=ee,se=fe^(Q<<1|T>>>31),ee=be^(T<<1|Q>>>31),D[8]^=se,D[9]^=ee,D[18]^=se,D[19]^=ee,D[28]^=se,D[29]^=ee,D[38]^=se,D[39]^=ee,D[48]^=se,D[49]^=ee,Te=D[0],$e=D[1],nt=D[11]<<4|D[10]>>>28,Ft=D[10]<<4|D[11]>>>28,Je=D[20]<<3|D[21]>>>29,gt=D[21]<<3|D[20]>>>29,Ue=D[31]<<9|D[30]>>>23,mt=D[30]<<9|D[31]>>>23,Lt=D[40]<<18|D[41]>>>14,yt=D[41]<<18|D[40]>>>14,St=D[2]<<1|D[3]>>>31,er=D[3]<<1|D[2]>>>31,Ie=D[13]<<12|D[12]>>>20,Le=D[12]<<12|D[13]>>>20,$=D[22]<<10|D[23]>>>22,K=D[23]<<10|D[22]>>>22,ht=D[33]<<13|D[32]>>>19,ft=D[32]<<13|D[33]>>>19,st=D[42]<<2|D[43]>>>30,tt=D[43]<<2|D[42]>>>30,ae=D[5]<<30|D[4]>>>2,pe=D[4]<<30|D[5]>>>2,Xt=D[14]<<6|D[15]>>>26,Ot=D[15]<<6|D[14]>>>26,Ve=D[25]<<11|D[24]>>>21,ke=D[24]<<11|D[25]>>>21,G=D[34]<<15|D[35]>>>17,C=D[35]<<15|D[34]>>>17,Ht=D[45]<<29|D[44]>>>3,Jt=D[44]<<29|D[45]>>>3,ct=D[6]<<28|D[7]>>>4,Be=D[7]<<28|D[6]>>>4,_e=D[17]<<23|D[16]>>>9,Re=D[16]<<23|D[17]>>>9,Bt=D[26]<<25|D[27]>>>7,Tt=D[27]<<25|D[26]>>>7,ze=D[36]<<21|D[37]>>>11,He=D[37]<<21|D[36]>>>11,Y=D[47]<<24|D[46]>>>8,q=D[46]<<24|D[47]>>>8,$t=D[8]<<27|D[9]>>>5,jt=D[9]<<27|D[8]>>>5,et=D[18]<<20|D[19]>>>12,rt=D[19]<<20|D[18]>>>12,De=D[29]<<7|D[28]>>>25,it=D[28]<<7|D[29]>>>25,bt=D[38]<<8|D[39]>>>24,Dt=D[39]<<8|D[38]>>>24,Se=D[48]<<14|D[49]>>>18,Qe=D[49]<<14|D[48]>>>18,D[0]=Te^~Ie&Ve,D[1]=$e^~Le&ke,D[10]=ct^~et&Je,D[11]=Be^~rt>,D[20]=St^~Xt&Bt,D[21]=er^~Ot&Tt,D[30]=$t^~nt&$,D[31]=jt^~Ft&K,D[40]=ae^~_e&De,D[41]=pe^~Re&it,D[2]=Ie^~Ve&ze,D[3]=Le^~ke&He,D[12]=et^~Je&ht,D[13]=rt^~gt&ft,D[22]=Xt^~Bt&bt,D[23]=Ot^~Tt&Dt,D[32]=nt^~$&G,D[33]=Ft^~K&C,D[42]=_e^~De&Ue,D[43]=Re^~it&mt,D[4]=Ve^~ze&Se,D[5]=ke^~He&Qe,D[14]=Je^~ht&Ht,D[15]=gt^~ft&Jt,D[24]=Bt^~bt&Lt,D[25]=Tt^~Dt&yt,D[34]=$^~G&Y,D[35]=K^~C&q,D[44]=De^~Ue&st,D[45]=it^~mt&tt,D[6]=ze^~Se&Te,D[7]=He^~Qe&$e,D[16]=ht^~Ht&ct,D[17]=ft^~Jt&Be,D[26]=bt^~Lt&St,D[27]=Dt^~yt&er,D[36]=G^~Y&$t,D[37]=C^~q&jt,D[46]=Ue^~st&ae,D[47]=mt^~tt&pe,D[8]=Se^~Te&Ie,D[9]=Qe^~$e&Le,D[18]=Ht^~ct&et,D[19]=Jt^~Be&rt,D[28]=Lt^~St&Xt,D[29]=yt^~er&Ot,D[38]=Y^~$t&nt,D[39]=q^~jt&Ft,D[48]=st^~ae&_e,D[49]=tt^~pe&Re,D[0]^=O[J],D[1]^=O[J+1]};if(a)t.exports=f;else for(v=0;v{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const f3=KN();var Cm;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(Cm||(Cm={}));var vs;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(vs||(vs={}));const l3="0123456789abcdef";class Kr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();Cd[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(u3>Cd[n])&&console.log.apply(console,r)}debug(...e){this._log(Kr.levels.DEBUG,e)}info(...e){this._log(Kr.levels.INFO,e)}warn(...e){this._log(Kr.levels.WARNING,e)}makeError(e,r,n){if(c3)return this.makeError("censored error",r,{});r||(r=Kr.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(u=>{const l=n[u];try{if(l instanceof Uint8Array){let d="";for(let p=0;p>4],d+=l3[l[p]&15];i.push(u+"=Uint8Array(0x"+d+")")}else i.push(u+"="+JSON.stringify(l))}catch{i.push(u+"="+JSON.stringify(n[u].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case vs.NUMERIC_FAULT:{o="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case vs.CALL_EXCEPTION:case vs.INSUFFICIENT_FUNDS:case vs.MISSING_NEW:case vs.NONCE_EXPIRED:case vs.REPLACEMENT_UNDERPRICED:case vs.TRANSACTION_REPLACED:case vs.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(u){a[u]=n[u]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Kr.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){f3&&this.throwError("platform missing String.prototype.normalize",Kr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:f3})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Kr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Kr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return Im||(Im=new Kr(WN)),Im}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),a3){if(!e)return;this.globalLogger().throwError("error censorship permanent",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}c3=!!e,a3=!!r}static setLogLevel(e){const r=Cd[e.toLowerCase()];if(r==null){Kr.globalLogger().warn("invalid log level - "+e);return}u3=r}static from(e){return new Kr(e)}}Kr.errors=vs,Kr.levels=Cm;const VN="bytes/5.7.0",sn=new Kr(VN);function h3(t){return!!t.toHexString}function fu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return fu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function GN(t){return $s(t)&&!(t.length%2)||Tm(t)}function d3(t){return typeof t=="number"&&t==t&&t%1===0}function Tm(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!d3(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function bn(t,e){if(e||(e={}),typeof t=="number"){sn.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),fu(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),h3(t)&&(t=t.toHexString()),$s(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":sn.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ibn(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),fu(n)}function JN(t,e){t=bn(t),t.length>e&&sn.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),fu(r)}function $s(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Rm="0123456789abcdef";function Ii(t,e){if(e||(e={}),typeof t=="number"){sn.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=Rm[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),h3(t))return t.toHexString();if($s(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":sn.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Tm(t)){let r="0x";for(let n=0;n>4]+Rm[i&15]}return r}return sn.throwArgumentError("invalid hexlify value","value",t)}function XN(t){if(typeof t!="string")t=Ii(t);else if(!$s(t)||t.length%2)return null;return(t.length-2)/2}function p3(t,e,r){return typeof t!="string"?t=Ii(t):(!$s(t)||t.length%2)&&sn.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function lu(t,e){for(typeof t!="string"?t=Ii(t):$s(t)||sn.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&sn.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function g3(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(GN(t)){let r=bn(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64))):r.length===65?(e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64)),e.v=r[64]):sn.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:sn.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Ii(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=JN(bn(e._vs),32);e._vs=Ii(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&sn.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=Ii(i);e.s==null?e.s=o:e.s!==o&&sn.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?sn.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&sn.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!$s(e.r)?sn.throwArgumentError("signature missing or invalid r","signature",t):e.r=lu(e.r,32),e.s==null||!$s(e.s)?sn.throwArgumentError("signature missing or invalid s","signature",t):e.s=lu(e.s,32);const r=bn(e.s);r[0]>=128&&sn.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=Ii(r);e._vs&&($s(e._vs)||sn.throwArgumentError("signature invalid _vs","signature",t),e._vs=lu(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&sn.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Dm(t){return"0x"+HN.keccak_256(bn(t))}var Om={exports:{}};Om.exports,function(t){(function(e,r){function n(m,f){if(!m)throw new Error(f||"Assertion failed")}function i(m,f){m.super_=f;var g=function(){};g.prototype=f.prototype,m.prototype=new g,m.prototype.constructor=m}function s(m,f,g){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((f==="le"||f==="be")&&(g=f,f=10),this._init(m||0,f||10,g||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=il.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,g){return f.cmp(g)>0?f:g},s.min=function(f,g){return f.cmp(g)<0?f:g},s.prototype._init=function(f,g,v){if(typeof f=="number")return this._initNumber(f,g,v);if(typeof f=="object")return this._initArray(f,g,v);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),f=f.toString().replace(/\s+/g,"");var x=0;f[0]==="-"&&(x++,this.negative=1),x=0;x-=3)A=f[x]|f[x-1]<<8|f[x-2]<<16,this.words[S]|=A<>>26-b&67108863,b+=24,b>=26&&(b-=26,S++);else if(v==="le")for(x=0,S=0;x>>26-b&67108863,b+=24,b>=26&&(b-=26,S++);return this._strip()};function a(m,f){var g=m.charCodeAt(f);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+m)}function u(m,f,g){var v=a(m,g);return g-1>=f&&(v|=a(m,g-1)<<4),v}s.prototype._parseHex=function(f,g,v){this.length=Math.ceil((f.length-g)/6),this.words=new Array(this.length);for(var x=0;x=g;x-=2)b=u(f,g,x)<=18?(S-=18,A+=1,this.words[A]|=b>>>26):S+=8;else{var P=f.length-g;for(x=P%2===0?g+1:g;x=18?(S-=18,A+=1,this.words[A]|=b>>>26):S+=8}this._strip()};function l(m,f,g,v){for(var x=0,S=0,A=Math.min(m.length,g),b=f;b=49?S=P-49+10:P>=17?S=P-17+10:S=P,n(P>=0&&S1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{s.prototype.inspect=p}else s.prototype.inspect=p;function p(){return(this.red?""}var y=["","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"],_=[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],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(f,g){f=f||10,g=g|0||1;var v;if(f===16||f==="hex"){v="";for(var x=0,S=0,A=0;A>>24-x&16777215,x+=2,x>=26&&(x-=26,A--),S!==0||A!==this.length-1?v=y[6-P.length]+P+v:v=P+v}for(S!==0&&(v=S.toString(16)+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(f===(f|0)&&f>=2&&f<=36){var I=_[f],F=M[f];v="";var ce=this.clone();for(ce.negative=0;!ce.isZero();){var D=ce.modrn(F).toString(f);ce=ce.idivn(F),ce.isZero()?v=D+v:v=y[I-D.length]+D+v}for(this.isZero()&&(v="0"+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,g){return this.toArrayLike(o,f,g)}),s.prototype.toArray=function(f,g){return this.toArrayLike(Array,f,g)};var O=function(f,g){return f.allocUnsafe?f.allocUnsafe(g):new f(g)};s.prototype.toArrayLike=function(f,g,v){this._strip();var x=this.byteLength(),S=v||Math.max(1,x);n(x<=S,"byte array longer than desired length"),n(S>0,"Requested array length <= 0");var A=O(f,S),b=g==="le"?"LE":"BE";return this["_toArrayLike"+b](A,x),A},s.prototype._toArrayLikeLE=function(f,g){for(var v=0,x=0,S=0,A=0;S>8&255),v>16&255),A===6?(v>24&255),x=0,A=0):(x=b>>>24,A+=2)}if(v=0&&(f[v--]=b>>8&255),v>=0&&(f[v--]=b>>16&255),A===6?(v>=0&&(f[v--]=b>>24&255),x=0,A=0):(x=b>>>24,A+=2)}if(v>=0)for(f[v--]=x;v>=0;)f[v--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var g=f,v=0;return g>=4096&&(v+=13,g>>>=13),g>=64&&(v+=7,g>>>=7),g>=8&&(v+=4,g>>>=4),g>=2&&(v+=2,g>>>=2),v+g},s.prototype._zeroBits=function(f){if(f===0)return 26;var g=f,v=0;return g&8191||(v+=13,g>>>=13),g&127||(v+=7,g>>>=7),g&15||(v+=4,g>>>=4),g&3||(v+=2,g>>>=2),g&1||v++,v},s.prototype.bitLength=function(){var f=this.words[this.length-1],g=this._countBits(f);return(this.length-1)*26+g};function L(m){for(var f=new Array(m.bitLength()),g=0;g>>x&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,g=0;gf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var g;this.length>f.length?g=f:g=this;for(var v=0;vf.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var g,v;this.length>f.length?(g=this,v=f):(g=f,v=this);for(var x=0;xf.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var g=Math.ceil(f/26)|0,v=f%26;this._expand(g),v>0&&g--;for(var x=0;x0&&(this.words[x]=~this.words[x]&67108863>>26-v),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,g){n(typeof f=="number"&&f>=0);var v=f/26|0,x=f%26;return this._expand(v+1),g?this.words[v]=this.words[v]|1<f.length?(v=this,x=f):(v=f,x=this);for(var S=0,A=0;A>>26;for(;S!==0&&A>>26;if(this.length=v.length,S!==0)this.words[this.length]=S,this.length++;else if(v!==this)for(;Af.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var g=this.iadd(f);return f.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var v=this.cmp(f);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,S;v>0?(x=this,S=f):(x=f,S=this);for(var A=0,b=0;b>26,this.words[b]=g&67108863;for(;A!==0&&b>26,this.words[b]=g&67108863;if(A===0&&b>>26,ce=P&67108863,D=Math.min(I,f.length-1),se=Math.max(0,I-m.length+1);se<=D;se++){var ee=I-se|0;x=m.words[ee]|0,S=f.words[se]|0,A=x*S+ce,F+=A/67108864|0,ce=A&67108863}g.words[I]=ce|0,P=F|0}return P!==0?g.words[I]=P|0:g.length--,g._strip()}var k=function(f,g,v){var x=f.words,S=g.words,A=v.words,b=0,P,I,F,ce=x[0]|0,D=ce&8191,se=ce>>>13,ee=x[1]|0,J=ee&8191,Q=ee>>>13,T=x[2]|0,X=T&8191,re=T>>>13,ge=x[3]|0,oe=ge&8191,fe=ge>>>13,be=x[4]|0,Me=be&8191,Ne=be>>>13,Te=x[5]|0,$e=Te&8191,Ie=Te>>>13,Le=x[6]|0,Ve=Le&8191,ke=Le>>>13,ze=x[7]|0,He=ze&8191,Se=ze>>>13,Qe=x[8]|0,ct=Qe&8191,Be=Qe>>>13,et=x[9]|0,rt=et&8191,Je=et>>>13,gt=S[0]|0,ht=gt&8191,ft=gt>>>13,Ht=S[1]|0,Jt=Ht&8191,St=Ht>>>13,er=S[2]|0,Xt=er&8191,Ot=er>>>13,Bt=S[3]|0,Tt=Bt&8191,bt=Bt>>>13,Dt=S[4]|0,Lt=Dt&8191,yt=Dt>>>13,$t=S[5]|0,jt=$t&8191,nt=$t>>>13,Ft=S[6]|0,$=Ft&8191,K=Ft>>>13,G=S[7]|0,C=G&8191,Y=G>>>13,q=S[8]|0,ae=q&8191,pe=q>>>13,_e=S[9]|0,Re=_e&8191,De=_e>>>13;v.negative=f.negative^g.negative,v.length=19,P=Math.imul(D,ht),I=Math.imul(D,ft),I=I+Math.imul(se,ht)|0,F=Math.imul(se,ft);var it=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(it>>>26)|0,it&=67108863,P=Math.imul(J,ht),I=Math.imul(J,ft),I=I+Math.imul(Q,ht)|0,F=Math.imul(Q,ft),P=P+Math.imul(D,Jt)|0,I=I+Math.imul(D,St)|0,I=I+Math.imul(se,Jt)|0,F=F+Math.imul(se,St)|0;var Ue=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,P=Math.imul(X,ht),I=Math.imul(X,ft),I=I+Math.imul(re,ht)|0,F=Math.imul(re,ft),P=P+Math.imul(J,Jt)|0,I=I+Math.imul(J,St)|0,I=I+Math.imul(Q,Jt)|0,F=F+Math.imul(Q,St)|0,P=P+Math.imul(D,Xt)|0,I=I+Math.imul(D,Ot)|0,I=I+Math.imul(se,Xt)|0,F=F+Math.imul(se,Ot)|0;var mt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(mt>>>26)|0,mt&=67108863,P=Math.imul(oe,ht),I=Math.imul(oe,ft),I=I+Math.imul(fe,ht)|0,F=Math.imul(fe,ft),P=P+Math.imul(X,Jt)|0,I=I+Math.imul(X,St)|0,I=I+Math.imul(re,Jt)|0,F=F+Math.imul(re,St)|0,P=P+Math.imul(J,Xt)|0,I=I+Math.imul(J,Ot)|0,I=I+Math.imul(Q,Xt)|0,F=F+Math.imul(Q,Ot)|0,P=P+Math.imul(D,Tt)|0,I=I+Math.imul(D,bt)|0,I=I+Math.imul(se,Tt)|0,F=F+Math.imul(se,bt)|0;var st=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(st>>>26)|0,st&=67108863,P=Math.imul(Me,ht),I=Math.imul(Me,ft),I=I+Math.imul(Ne,ht)|0,F=Math.imul(Ne,ft),P=P+Math.imul(oe,Jt)|0,I=I+Math.imul(oe,St)|0,I=I+Math.imul(fe,Jt)|0,F=F+Math.imul(fe,St)|0,P=P+Math.imul(X,Xt)|0,I=I+Math.imul(X,Ot)|0,I=I+Math.imul(re,Xt)|0,F=F+Math.imul(re,Ot)|0,P=P+Math.imul(J,Tt)|0,I=I+Math.imul(J,bt)|0,I=I+Math.imul(Q,Tt)|0,F=F+Math.imul(Q,bt)|0,P=P+Math.imul(D,Lt)|0,I=I+Math.imul(D,yt)|0,I=I+Math.imul(se,Lt)|0,F=F+Math.imul(se,yt)|0;var tt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(tt>>>26)|0,tt&=67108863,P=Math.imul($e,ht),I=Math.imul($e,ft),I=I+Math.imul(Ie,ht)|0,F=Math.imul(Ie,ft),P=P+Math.imul(Me,Jt)|0,I=I+Math.imul(Me,St)|0,I=I+Math.imul(Ne,Jt)|0,F=F+Math.imul(Ne,St)|0,P=P+Math.imul(oe,Xt)|0,I=I+Math.imul(oe,Ot)|0,I=I+Math.imul(fe,Xt)|0,F=F+Math.imul(fe,Ot)|0,P=P+Math.imul(X,Tt)|0,I=I+Math.imul(X,bt)|0,I=I+Math.imul(re,Tt)|0,F=F+Math.imul(re,bt)|0,P=P+Math.imul(J,Lt)|0,I=I+Math.imul(J,yt)|0,I=I+Math.imul(Q,Lt)|0,F=F+Math.imul(Q,yt)|0,P=P+Math.imul(D,jt)|0,I=I+Math.imul(D,nt)|0,I=I+Math.imul(se,jt)|0,F=F+Math.imul(se,nt)|0;var At=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(At>>>26)|0,At&=67108863,P=Math.imul(Ve,ht),I=Math.imul(Ve,ft),I=I+Math.imul(ke,ht)|0,F=Math.imul(ke,ft),P=P+Math.imul($e,Jt)|0,I=I+Math.imul($e,St)|0,I=I+Math.imul(Ie,Jt)|0,F=F+Math.imul(Ie,St)|0,P=P+Math.imul(Me,Xt)|0,I=I+Math.imul(Me,Ot)|0,I=I+Math.imul(Ne,Xt)|0,F=F+Math.imul(Ne,Ot)|0,P=P+Math.imul(oe,Tt)|0,I=I+Math.imul(oe,bt)|0,I=I+Math.imul(fe,Tt)|0,F=F+Math.imul(fe,bt)|0,P=P+Math.imul(X,Lt)|0,I=I+Math.imul(X,yt)|0,I=I+Math.imul(re,Lt)|0,F=F+Math.imul(re,yt)|0,P=P+Math.imul(J,jt)|0,I=I+Math.imul(J,nt)|0,I=I+Math.imul(Q,jt)|0,F=F+Math.imul(Q,nt)|0,P=P+Math.imul(D,$)|0,I=I+Math.imul(D,K)|0,I=I+Math.imul(se,$)|0,F=F+Math.imul(se,K)|0;var Rt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,P=Math.imul(He,ht),I=Math.imul(He,ft),I=I+Math.imul(Se,ht)|0,F=Math.imul(Se,ft),P=P+Math.imul(Ve,Jt)|0,I=I+Math.imul(Ve,St)|0,I=I+Math.imul(ke,Jt)|0,F=F+Math.imul(ke,St)|0,P=P+Math.imul($e,Xt)|0,I=I+Math.imul($e,Ot)|0,I=I+Math.imul(Ie,Xt)|0,F=F+Math.imul(Ie,Ot)|0,P=P+Math.imul(Me,Tt)|0,I=I+Math.imul(Me,bt)|0,I=I+Math.imul(Ne,Tt)|0,F=F+Math.imul(Ne,bt)|0,P=P+Math.imul(oe,Lt)|0,I=I+Math.imul(oe,yt)|0,I=I+Math.imul(fe,Lt)|0,F=F+Math.imul(fe,yt)|0,P=P+Math.imul(X,jt)|0,I=I+Math.imul(X,nt)|0,I=I+Math.imul(re,jt)|0,F=F+Math.imul(re,nt)|0,P=P+Math.imul(J,$)|0,I=I+Math.imul(J,K)|0,I=I+Math.imul(Q,$)|0,F=F+Math.imul(Q,K)|0,P=P+Math.imul(D,C)|0,I=I+Math.imul(D,Y)|0,I=I+Math.imul(se,C)|0,F=F+Math.imul(se,Y)|0;var Mt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,P=Math.imul(ct,ht),I=Math.imul(ct,ft),I=I+Math.imul(Be,ht)|0,F=Math.imul(Be,ft),P=P+Math.imul(He,Jt)|0,I=I+Math.imul(He,St)|0,I=I+Math.imul(Se,Jt)|0,F=F+Math.imul(Se,St)|0,P=P+Math.imul(Ve,Xt)|0,I=I+Math.imul(Ve,Ot)|0,I=I+Math.imul(ke,Xt)|0,F=F+Math.imul(ke,Ot)|0,P=P+Math.imul($e,Tt)|0,I=I+Math.imul($e,bt)|0,I=I+Math.imul(Ie,Tt)|0,F=F+Math.imul(Ie,bt)|0,P=P+Math.imul(Me,Lt)|0,I=I+Math.imul(Me,yt)|0,I=I+Math.imul(Ne,Lt)|0,F=F+Math.imul(Ne,yt)|0,P=P+Math.imul(oe,jt)|0,I=I+Math.imul(oe,nt)|0,I=I+Math.imul(fe,jt)|0,F=F+Math.imul(fe,nt)|0,P=P+Math.imul(X,$)|0,I=I+Math.imul(X,K)|0,I=I+Math.imul(re,$)|0,F=F+Math.imul(re,K)|0,P=P+Math.imul(J,C)|0,I=I+Math.imul(J,Y)|0,I=I+Math.imul(Q,C)|0,F=F+Math.imul(Q,Y)|0,P=P+Math.imul(D,ae)|0,I=I+Math.imul(D,pe)|0,I=I+Math.imul(se,ae)|0,F=F+Math.imul(se,pe)|0;var Et=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Et>>>26)|0,Et&=67108863,P=Math.imul(rt,ht),I=Math.imul(rt,ft),I=I+Math.imul(Je,ht)|0,F=Math.imul(Je,ft),P=P+Math.imul(ct,Jt)|0,I=I+Math.imul(ct,St)|0,I=I+Math.imul(Be,Jt)|0,F=F+Math.imul(Be,St)|0,P=P+Math.imul(He,Xt)|0,I=I+Math.imul(He,Ot)|0,I=I+Math.imul(Se,Xt)|0,F=F+Math.imul(Se,Ot)|0,P=P+Math.imul(Ve,Tt)|0,I=I+Math.imul(Ve,bt)|0,I=I+Math.imul(ke,Tt)|0,F=F+Math.imul(ke,bt)|0,P=P+Math.imul($e,Lt)|0,I=I+Math.imul($e,yt)|0,I=I+Math.imul(Ie,Lt)|0,F=F+Math.imul(Ie,yt)|0,P=P+Math.imul(Me,jt)|0,I=I+Math.imul(Me,nt)|0,I=I+Math.imul(Ne,jt)|0,F=F+Math.imul(Ne,nt)|0,P=P+Math.imul(oe,$)|0,I=I+Math.imul(oe,K)|0,I=I+Math.imul(fe,$)|0,F=F+Math.imul(fe,K)|0,P=P+Math.imul(X,C)|0,I=I+Math.imul(X,Y)|0,I=I+Math.imul(re,C)|0,F=F+Math.imul(re,Y)|0,P=P+Math.imul(J,ae)|0,I=I+Math.imul(J,pe)|0,I=I+Math.imul(Q,ae)|0,F=F+Math.imul(Q,pe)|0,P=P+Math.imul(D,Re)|0,I=I+Math.imul(D,De)|0,I=I+Math.imul(se,Re)|0,F=F+Math.imul(se,De)|0;var dt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(dt>>>26)|0,dt&=67108863,P=Math.imul(rt,Jt),I=Math.imul(rt,St),I=I+Math.imul(Je,Jt)|0,F=Math.imul(Je,St),P=P+Math.imul(ct,Xt)|0,I=I+Math.imul(ct,Ot)|0,I=I+Math.imul(Be,Xt)|0,F=F+Math.imul(Be,Ot)|0,P=P+Math.imul(He,Tt)|0,I=I+Math.imul(He,bt)|0,I=I+Math.imul(Se,Tt)|0,F=F+Math.imul(Se,bt)|0,P=P+Math.imul(Ve,Lt)|0,I=I+Math.imul(Ve,yt)|0,I=I+Math.imul(ke,Lt)|0,F=F+Math.imul(ke,yt)|0,P=P+Math.imul($e,jt)|0,I=I+Math.imul($e,nt)|0,I=I+Math.imul(Ie,jt)|0,F=F+Math.imul(Ie,nt)|0,P=P+Math.imul(Me,$)|0,I=I+Math.imul(Me,K)|0,I=I+Math.imul(Ne,$)|0,F=F+Math.imul(Ne,K)|0,P=P+Math.imul(oe,C)|0,I=I+Math.imul(oe,Y)|0,I=I+Math.imul(fe,C)|0,F=F+Math.imul(fe,Y)|0,P=P+Math.imul(X,ae)|0,I=I+Math.imul(X,pe)|0,I=I+Math.imul(re,ae)|0,F=F+Math.imul(re,pe)|0,P=P+Math.imul(J,Re)|0,I=I+Math.imul(J,De)|0,I=I+Math.imul(Q,Re)|0,F=F+Math.imul(Q,De)|0;var _t=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(_t>>>26)|0,_t&=67108863,P=Math.imul(rt,Xt),I=Math.imul(rt,Ot),I=I+Math.imul(Je,Xt)|0,F=Math.imul(Je,Ot),P=P+Math.imul(ct,Tt)|0,I=I+Math.imul(ct,bt)|0,I=I+Math.imul(Be,Tt)|0,F=F+Math.imul(Be,bt)|0,P=P+Math.imul(He,Lt)|0,I=I+Math.imul(He,yt)|0,I=I+Math.imul(Se,Lt)|0,F=F+Math.imul(Se,yt)|0,P=P+Math.imul(Ve,jt)|0,I=I+Math.imul(Ve,nt)|0,I=I+Math.imul(ke,jt)|0,F=F+Math.imul(ke,nt)|0,P=P+Math.imul($e,$)|0,I=I+Math.imul($e,K)|0,I=I+Math.imul(Ie,$)|0,F=F+Math.imul(Ie,K)|0,P=P+Math.imul(Me,C)|0,I=I+Math.imul(Me,Y)|0,I=I+Math.imul(Ne,C)|0,F=F+Math.imul(Ne,Y)|0,P=P+Math.imul(oe,ae)|0,I=I+Math.imul(oe,pe)|0,I=I+Math.imul(fe,ae)|0,F=F+Math.imul(fe,pe)|0,P=P+Math.imul(X,Re)|0,I=I+Math.imul(X,De)|0,I=I+Math.imul(re,Re)|0,F=F+Math.imul(re,De)|0;var ot=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(ot>>>26)|0,ot&=67108863,P=Math.imul(rt,Tt),I=Math.imul(rt,bt),I=I+Math.imul(Je,Tt)|0,F=Math.imul(Je,bt),P=P+Math.imul(ct,Lt)|0,I=I+Math.imul(ct,yt)|0,I=I+Math.imul(Be,Lt)|0,F=F+Math.imul(Be,yt)|0,P=P+Math.imul(He,jt)|0,I=I+Math.imul(He,nt)|0,I=I+Math.imul(Se,jt)|0,F=F+Math.imul(Se,nt)|0,P=P+Math.imul(Ve,$)|0,I=I+Math.imul(Ve,K)|0,I=I+Math.imul(ke,$)|0,F=F+Math.imul(ke,K)|0,P=P+Math.imul($e,C)|0,I=I+Math.imul($e,Y)|0,I=I+Math.imul(Ie,C)|0,F=F+Math.imul(Ie,Y)|0,P=P+Math.imul(Me,ae)|0,I=I+Math.imul(Me,pe)|0,I=I+Math.imul(Ne,ae)|0,F=F+Math.imul(Ne,pe)|0,P=P+Math.imul(oe,Re)|0,I=I+Math.imul(oe,De)|0,I=I+Math.imul(fe,Re)|0,F=F+Math.imul(fe,De)|0;var wt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(wt>>>26)|0,wt&=67108863,P=Math.imul(rt,Lt),I=Math.imul(rt,yt),I=I+Math.imul(Je,Lt)|0,F=Math.imul(Je,yt),P=P+Math.imul(ct,jt)|0,I=I+Math.imul(ct,nt)|0,I=I+Math.imul(Be,jt)|0,F=F+Math.imul(Be,nt)|0,P=P+Math.imul(He,$)|0,I=I+Math.imul(He,K)|0,I=I+Math.imul(Se,$)|0,F=F+Math.imul(Se,K)|0,P=P+Math.imul(Ve,C)|0,I=I+Math.imul(Ve,Y)|0,I=I+Math.imul(ke,C)|0,F=F+Math.imul(ke,Y)|0,P=P+Math.imul($e,ae)|0,I=I+Math.imul($e,pe)|0,I=I+Math.imul(Ie,ae)|0,F=F+Math.imul(Ie,pe)|0,P=P+Math.imul(Me,Re)|0,I=I+Math.imul(Me,De)|0,I=I+Math.imul(Ne,Re)|0,F=F+Math.imul(Ne,De)|0;var lt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(lt>>>26)|0,lt&=67108863,P=Math.imul(rt,jt),I=Math.imul(rt,nt),I=I+Math.imul(Je,jt)|0,F=Math.imul(Je,nt),P=P+Math.imul(ct,$)|0,I=I+Math.imul(ct,K)|0,I=I+Math.imul(Be,$)|0,F=F+Math.imul(Be,K)|0,P=P+Math.imul(He,C)|0,I=I+Math.imul(He,Y)|0,I=I+Math.imul(Se,C)|0,F=F+Math.imul(Se,Y)|0,P=P+Math.imul(Ve,ae)|0,I=I+Math.imul(Ve,pe)|0,I=I+Math.imul(ke,ae)|0,F=F+Math.imul(ke,pe)|0,P=P+Math.imul($e,Re)|0,I=I+Math.imul($e,De)|0,I=I+Math.imul(Ie,Re)|0,F=F+Math.imul(Ie,De)|0;var at=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(at>>>26)|0,at&=67108863,P=Math.imul(rt,$),I=Math.imul(rt,K),I=I+Math.imul(Je,$)|0,F=Math.imul(Je,K),P=P+Math.imul(ct,C)|0,I=I+Math.imul(ct,Y)|0,I=I+Math.imul(Be,C)|0,F=F+Math.imul(Be,Y)|0,P=P+Math.imul(He,ae)|0,I=I+Math.imul(He,pe)|0,I=I+Math.imul(Se,ae)|0,F=F+Math.imul(Se,pe)|0,P=P+Math.imul(Ve,Re)|0,I=I+Math.imul(Ve,De)|0,I=I+Math.imul(ke,Re)|0,F=F+Math.imul(ke,De)|0;var Ae=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,P=Math.imul(rt,C),I=Math.imul(rt,Y),I=I+Math.imul(Je,C)|0,F=Math.imul(Je,Y),P=P+Math.imul(ct,ae)|0,I=I+Math.imul(ct,pe)|0,I=I+Math.imul(Be,ae)|0,F=F+Math.imul(Be,pe)|0,P=P+Math.imul(He,Re)|0,I=I+Math.imul(He,De)|0,I=I+Math.imul(Se,Re)|0,F=F+Math.imul(Se,De)|0;var Pe=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,P=Math.imul(rt,ae),I=Math.imul(rt,pe),I=I+Math.imul(Je,ae)|0,F=Math.imul(Je,pe),P=P+Math.imul(ct,Re)|0,I=I+Math.imul(ct,De)|0,I=I+Math.imul(Be,Re)|0,F=F+Math.imul(Be,De)|0;var Ge=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,P=Math.imul(rt,Re),I=Math.imul(rt,De),I=I+Math.imul(Je,Re)|0,F=Math.imul(Je,De);var je=(b+P|0)+((I&8191)<<13)|0;return b=(F+(I>>>13)|0)+(je>>>26)|0,je&=67108863,A[0]=it,A[1]=Ue,A[2]=mt,A[3]=st,A[4]=tt,A[5]=At,A[6]=Rt,A[7]=Mt,A[8]=Et,A[9]=dt,A[10]=_t,A[11]=ot,A[12]=wt,A[13]=lt,A[14]=at,A[15]=Ae,A[16]=Pe,A[17]=Ge,A[18]=je,b!==0&&(A[19]=b,v.length++),v};Math.imul||(k=B);function H(m,f,g){g.negative=f.negative^m.negative,g.length=m.length+f.length;for(var v=0,x=0,S=0;S>>26)|0,x+=A>>>26,A&=67108863}g.words[S]=b,v=A,A=x}return v!==0?g.words[S]=v:g.length--,g._strip()}function U(m,f,g){return H(m,f,g)}s.prototype.mulTo=function(f,g){var v,x=this.length+f.length;return this.length===10&&f.length===10?v=k(this,f,g):x<63?v=B(this,f,g):x<1024?v=H(this,f,g):v=U(this,f,g),v},s.prototype.mul=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),this.mulTo(f,g)},s.prototype.mulf=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),U(this,f,g)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var g=f<0;g&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var v=0,x=0;x>=26,v+=S/67108864|0,v+=A>>>26,this.words[x]=A&67108863}return v!==0&&(this.words[x]=v,this.length++),g?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var g=L(f);if(g.length===0)return new s(1);for(var v=this,x=0;x=0);var g=f%26,v=(f-g)/26,x=67108863>>>26-g<<26-g,S;if(g!==0){var A=0;for(S=0;S>>26-g}A&&(this.words[S]=A,this.length++)}if(v!==0){for(S=this.length-1;S>=0;S--)this.words[S+v]=this.words[S];for(S=0;S=0);var x;g?x=(g-g%26)/26:x=0;var S=f%26,A=Math.min((f-S)/26,this.length),b=67108863^67108863>>>S<A)for(this.length-=A,I=0;I=0&&(F!==0||I>=x);I--){var ce=this.words[I]|0;this.words[I]=F<<26-S|ce>>>S,F=ce&b}return P&&F!==0&&(P.words[P.length++]=F),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,g,v){return n(this.negative===0),this.iushrn(f,g,v)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var g=f%26,v=(f-g)/26,x=1<=0);var g=f%26,v=(f-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(g!==0&&v++,this.length=Math.min(v,this.length),g!==0){var x=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(P/67108864|0),this.words[S+v]=A&67108863}for(;S>26,this.words[S+v]=A&67108863;if(b===0)return this._strip();for(n(b===-1),b=0,S=0;S>26,this.words[S]=A&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,g){var v=this.length-f.length,x=this.clone(),S=f,A=S.words[S.length-1]|0,b=this._countBits(A);v=26-b,v!==0&&(S=S.ushln(v),x.iushln(v),A=S.words[S.length-1]|0);var P=x.length-S.length,I;if(g!=="mod"){I=new s(null),I.length=P+1,I.words=new Array(I.length);for(var F=0;F=0;D--){var se=(x.words[S.length+D]|0)*67108864+(x.words[S.length+D-1]|0);for(se=Math.min(se/A|0,67108863),x._ishlnsubmul(S,se,D);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(S,1,D),x.isZero()||(x.negative^=1);I&&(I.words[D]=se)}return I&&I._strip(),x._strip(),g!=="div"&&v!==0&&x.iushrn(v),{div:I||null,mod:x}},s.prototype.divmod=function(f,g,v){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,S,A;return this.negative!==0&&f.negative===0?(A=this.neg().divmod(f,g),g!=="mod"&&(x=A.div.neg()),g!=="div"&&(S=A.mod.neg(),v&&S.negative!==0&&S.iadd(f)),{div:x,mod:S}):this.negative===0&&f.negative!==0?(A=this.divmod(f.neg(),g),g!=="mod"&&(x=A.div.neg()),{div:x,mod:A.mod}):this.negative&f.negative?(A=this.neg().divmod(f.neg(),g),g!=="div"&&(S=A.mod.neg(),v&&S.negative!==0&&S.isub(f)),{div:A.div,mod:S}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?g==="div"?{div:this.divn(f.words[0]),mod:null}:g==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,g)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var g=this.divmod(f);if(g.mod.isZero())return g.div;var v=g.div.negative!==0?g.mod.isub(f):g.mod,x=f.ushrn(1),S=f.andln(1),A=v.cmp(x);return A<0||S===1&&A===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},s.prototype.modrn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=(1<<26)%f,x=0,S=this.length-1;S>=0;S--)x=(v*x+(this.words[S]|0))%f;return g?-x:x},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=0,x=this.length-1;x>=0;x--){var S=(this.words[x]|0)+v*67108864;this.words[x]=S/f|0,v=S%f}return this._strip(),g?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),S=new s(0),A=new s(0),b=new s(1),P=0;g.isEven()&&v.isEven();)g.iushrn(1),v.iushrn(1),++P;for(var I=v.clone(),F=g.clone();!g.isZero();){for(var ce=0,D=1;!(g.words[0]&D)&&ce<26;++ce,D<<=1);if(ce>0)for(g.iushrn(ce);ce-- >0;)(x.isOdd()||S.isOdd())&&(x.iadd(I),S.isub(F)),x.iushrn(1),S.iushrn(1);for(var se=0,ee=1;!(v.words[0]&ee)&&se<26;++se,ee<<=1);if(se>0)for(v.iushrn(se);se-- >0;)(A.isOdd()||b.isOdd())&&(A.iadd(I),b.isub(F)),A.iushrn(1),b.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(A),S.isub(b)):(v.isub(g),A.isub(x),b.isub(S))}return{a:A,b,gcd:v.iushln(P)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),S=new s(0),A=v.clone();g.cmpn(1)>0&&v.cmpn(1)>0;){for(var b=0,P=1;!(g.words[0]&P)&&b<26;++b,P<<=1);if(b>0)for(g.iushrn(b);b-- >0;)x.isOdd()&&x.iadd(A),x.iushrn(1);for(var I=0,F=1;!(v.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(v.iushrn(I);I-- >0;)S.isOdd()&&S.iadd(A),S.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(S)):(v.isub(g),S.isub(x))}var ce;return g.cmpn(1)===0?ce=x:ce=S,ce.cmpn(0)<0&&ce.iadd(f),ce},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var g=this.clone(),v=f.clone();g.negative=0,v.negative=0;for(var x=0;g.isEven()&&v.isEven();x++)g.iushrn(1),v.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;v.isEven();)v.iushrn(1);var S=g.cmp(v);if(S<0){var A=g;g=v,v=A}else if(S===0||v.cmpn(1)===0)break;g.isub(v)}while(!0);return v.iushln(x)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var g=f%26,v=(f-g)/26,x=1<>>26,b&=67108863,this.words[A]=b}return S!==0&&(this.words[A]=S,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var g=f<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var v;if(this.length>1)v=1;else{g&&(f=-f),n(f<=67108863,"Number is too big");var x=this.words[0]|0;v=x===f?0:xf.length)return 1;if(this.length=0;v--){var x=this.words[v]|0,S=f.words[v]|0;if(x!==S){xS&&(g=1);break}}return g},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new j(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var z={k256:null,p224:null,p192:null,p25519:null};function Z(m,f){this.name=m,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Z.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},Z.prototype.ireduce=function(f){var g=f,v;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),v=g.bitLength();while(v>this.n);var x=v0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},Z.prototype.split=function(f,g){f.iushrn(this.n,0,g)},Z.prototype.imulK=function(f){return f.imul(this.k)};function R(){Z.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(R,Z),R.prototype.split=function(f,g){for(var v=4194303,x=Math.min(f.length,9),S=0;S>>22,A=b}A>>>=22,f.words[S-10]=A,A===0&&f.length>10?f.length-=10:f.length-=9},R.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var g=0,v=0;v>>=26,f.words[v]=S,g=x}return g!==0&&(f.words[f.length++]=g),f},s._prime=function(f){if(z[f])return z[f];var g;if(f==="k256")g=new R;else if(f==="p224")g=new W;else if(f==="p192")g=new ie;else if(f==="p25519")g=new me;else throw new Error("Unknown prime "+f);return z[f]=g,g};function j(m){if(typeof m=="string"){var f=s._prime(m);this.m=f.p,this.prime=f}else n(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}j.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},j.prototype._verify2=function(f,g){n((f.negative|g.negative)===0,"red works only with positives"),n(f.red&&f.red===g.red,"red works only with red numbers")},j.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(d(f,f.umod(this.m)._forceRed(this)),f)},j.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},j.prototype.add=function(f,g){this._verify2(f,g);var v=f.add(g);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},j.prototype.iadd=function(f,g){this._verify2(f,g);var v=f.iadd(g);return v.cmp(this.m)>=0&&v.isub(this.m),v},j.prototype.sub=function(f,g){this._verify2(f,g);var v=f.sub(g);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},j.prototype.isub=function(f,g){this._verify2(f,g);var v=f.isub(g);return v.cmpn(0)<0&&v.iadd(this.m),v},j.prototype.shl=function(f,g){return this._verify1(f),this.imod(f.ushln(g))},j.prototype.imul=function(f,g){return this._verify2(f,g),this.imod(f.imul(g))},j.prototype.mul=function(f,g){return this._verify2(f,g),this.imod(f.mul(g))},j.prototype.isqr=function(f){return this.imul(f,f.clone())},j.prototype.sqr=function(f){return this.mul(f,f)},j.prototype.sqrt=function(f){if(f.isZero())return f.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(f,v)}for(var x=this.m.subn(1),S=0;!x.isZero()&&x.andln(1)===0;)S++,x.iushrn(1);n(!x.isZero());var A=new s(1).toRed(this),b=A.redNeg(),P=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,P).cmp(b)!==0;)I.redIAdd(b);for(var F=this.pow(I,x),ce=this.pow(f,x.addn(1).iushrn(1)),D=this.pow(f,x),se=S;D.cmp(A)!==0;){for(var ee=D,J=0;ee.cmp(A)!==0;J++)ee=ee.redSqr();n(J=0;S--){for(var F=g.words[S],ce=I-1;ce>=0;ce--){var D=F>>ce&1;if(A!==x[0]&&(A=this.sqr(A)),D===0&&b===0){P=0;continue}b<<=1,b|=D,P++,!(P!==v&&(S!==0||ce!==0))&&(A=this.mul(A,x[b]),P=0,b=0)}I=26}return A},j.prototype.convertTo=function(f){var g=f.umod(this.m);return g===f?g.clone():g},j.prototype.convertFrom=function(f){var g=f.clone();return g.red=null,g},s.mont=function(f){return new E(f)};function E(m){j.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(E,j),E.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},E.prototype.convertFrom=function(f){var g=this.imod(f.mul(this.rinv));return g.red=null,g},E.prototype.imul=function(f,g){if(f.isZero()||g.isZero())return f.words[0]=0,f.length=1,f;var v=f.imul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=v.isub(x).iushrn(this.shift),A=S;return S.cmp(this.m)>=0?A=S.isub(this.m):S.cmpn(0)<0&&(A=S.iadd(this.m)),A._forceRed(this)},E.prototype.mul=function(f,g){if(f.isZero()||g.isZero())return new s(0)._forceRed(this);var v=f.mul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=v.isub(x).iushrn(this.shift),A=S;return S.cmp(this.m)>=0?A=S.isub(this.m):S.cmpn(0)<0&&(A=S.iadd(this.m)),A._forceRed(this)},E.prototype.invm=function(f){var g=this.imod(f._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,nn)}(Om);var ZN=Om.exports;const rr=ji(ZN);var QN=rr.BN;function eL(t){return new QN(t,36).toString(16)}const tL="strings/5.7.0",rL=new Kr(tL);var Td;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(Td||(Td={}));var m3;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(m3||(m3={}));function Nm(t,e=Td.current){e!=Td.current&&(rL.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return bn(r)}const nL=`Ethereum Signed Message: -`;function v3(t){return typeof t=="string"&&(t=Nm(t)),Dm(YN([Nm(nL),Nm(String(t.length)),t]))}const iL="address/5.7.0",cl=new Kr(iL);function b3(t){$s(t,20)||cl.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=bn(Dm(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const sL=9007199254740991;function oL(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const Lm={};for(let t=0;t<10;t++)Lm[String(t)]=String(t);for(let t=0;t<26;t++)Lm[String.fromCharCode(65+t)]=String(10+t);const y3=Math.floor(oL(sL));function aL(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Lm[n]).join("");for(;e.length>=y3;){let n=e.substring(0,y3);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function cL(t){let e=null;if(typeof t!="string"&&cl.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=b3(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&cl.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==aL(t)&&cl.throwArgumentError("bad icap checksum","address",t),e=eL(t.substring(4));e.length<40;)e="0"+e;e=b3("0x"+e)}else cl.throwArgumentError("invalid address","address",t);return e}function ul(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var fl={},wr={},ec=w3;function w3(t,e){if(!t)throw new Error(e||"Assertion failed")}w3.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var km={exports:{}};typeof Object.create=="function"?km.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:km.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var Rd=km.exports,uL=ec,fL=Rd;wr.inherits=fL;function lL(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function hL(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):lL(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}wr.htonl=x3;function pL(t,e){for(var r="",n=0;n>>0}return s}wr.join32=gL;function mL(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}wr.split32=mL;function vL(t,e){return t>>>e|t<<32-e}wr.rotr32=vL;function bL(t,e){return t<>>32-e}wr.rotl32=bL;function yL(t,e){return t+e>>>0}wr.sum32=yL;function wL(t,e,r){return t+e+r>>>0}wr.sum32_3=wL;function xL(t,e,r,n){return t+e+r+n>>>0}wr.sum32_4=xL;function _L(t,e,r,n,i){return t+e+r+n+i>>>0}wr.sum32_5=_L;function EL(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}wr.sum64=EL;function SL(t,e,r,n){var i=e+n>>>0,s=(i>>0}wr.sum64_hi=SL;function AL(t,e,r,n){var i=e+n;return i>>>0}wr.sum64_lo=AL;function PL(t,e,r,n,i,s,o,a){var u=0,l=e;l=l+n>>>0,u+=l>>0,u+=l>>0,u+=l>>0}wr.sum64_4_hi=PL;function ML(t,e,r,n,i,s,o,a){var u=e+n+s+a;return u>>>0}wr.sum64_4_lo=ML;function IL(t,e,r,n,i,s,o,a,u,l){var d=0,p=e;p=p+n>>>0,d+=p>>0,d+=p>>0,d+=p>>0,d+=p>>0}wr.sum64_5_hi=IL;function CL(t,e,r,n,i,s,o,a,u,l){var d=e+n+s+a+l;return d>>>0}wr.sum64_5_lo=CL;function TL(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}wr.rotr64_hi=TL;function RL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}wr.rotr64_lo=RL;function DL(t,e,r){return t>>>r}wr.shr64_hi=DL;function OL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}wr.shr64_lo=OL;var hu={},S3=wr,NL=ec;function Dd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}hu.BlockHash=Dd,Dd.prototype.update=function(e,r){if(e=S3.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=S3.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}Fs.g0_256=FL;function jL(t){return js(t,17)^js(t,19)^t>>>10}Fs.g1_256=jL;var pu=wr,UL=hu,qL=Fs,Bm=pu.rotl32,ll=pu.sum32,zL=pu.sum32_5,HL=qL.ft_1,I3=UL.BlockHash,WL=[1518500249,1859775393,2400959708,3395469782];function Us(){if(!(this instanceof Us))return new Us;I3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}pu.inherits(Us,I3);var KL=Us;Us.blockSize=512,Us.outSize=160,Us.hmacStrength=80,Us.padLength=64,Us.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),Ok(e.length<=this.blockSize);for(var r=e.length;r>8,y=d&255;p?u.push(p,y):u.push(y)}return u}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",u=0;u(y>>1)-1?O=(y>>1)-L:O=L,_.isubn(O)):O=0,p[M]=O,_.iushrn(1)}return p}r.getNAF=n;function i(u,l){var d=[[],[]];u=u.clone(),l=l.clone();for(var p=0,y=0,_;u.cmpn(-p)>0||l.cmpn(-y)>0;){var M=u.andln(3)+p&3,O=l.andln(3)+y&3;M===3&&(M=-1),O===3&&(O=-1);var L;M&1?(_=u.andln(7)+p&7,(_===3||_===5)&&O===2?L=-M:L=M):L=0,d[0].push(L);var B;O&1?(_=l.andln(7)+y&7,(_===3||_===5)&&M===2?B=-O:B=O):B=0,d[1].push(B),2*p===L+1&&(p=1-p),2*y===B+1&&(y=1-y),u.iushrn(1),l.iushrn(1)}return d}r.getJSF=i;function s(u,l,d){var p="_"+l;u.prototype[l]=function(){return this[p]!==void 0?this[p]:this[p]=d.call(this)}}r.cachedProperty=s;function o(u){return typeof u=="string"?r.toArray(u,"hex"):u}r.parseBytes=o;function a(u){return new rr(u,"hex","le")}r.intFromLE=a}),Nd=Ci.getNAF,kk=Ci.getJSF,Ld=Ci.assert;function aa(t,e){this.type=t,this.p=new rr(e.p,16),this.red=e.prime?rr.red(e.prime):rr.mont(this.p),this.zero=new rr(0).toRed(this.red),this.one=new rr(1).toRed(this.red),this.two=new rr(2).toRed(this.red),this.n=e.n&&new rr(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var rc=aa;aa.prototype.point=function(){throw new Error("Not implemented")},aa.prototype.validate=function(){throw new Error("Not implemented")},aa.prototype._fixedNafMul=function(e,r){Ld(e.precomputed);var n=e._getDoubles(),i=Nd(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Ld(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},aa.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var M=d-1,O=d;if(o[M]!==1||o[O]!==1){u[M]=Nd(n[M],o[M],this._bitLength),u[O]=Nd(n[O],o[O],this._bitLength),l=Math.max(u[M].length,l),l=Math.max(u[O].length,l);continue}var L=[r[M],null,null,r[O]];r[M].y.cmp(r[O].y)===0?(L[1]=r[M].add(r[O]),L[2]=r[M].toJ().mixedAdd(r[O].neg())):r[M].y.cmp(r[O].y.redNeg())===0?(L[1]=r[M].toJ().mixedAdd(r[O]),L[2]=r[M].add(r[O].neg())):(L[1]=r[M].toJ().mixedAdd(r[O]),L[2]=r[M].toJ().mixedAdd(r[O].neg()));var B=[-3,-1,-5,-7,0,7,5,1,3],k=kk(n[M],n[O]);for(l=Math.max(k[0].length,l),u[M]=new Array(l),u[O]=new Array(l),p=0;p=0;d--){for(var R=0;d>=0;){var W=!0;for(p=0;p=0&&R++,z=z.dblp(R),d<0)break;for(p=0;p0?y=a[p][ie-1>>1]:ie<0&&(y=a[p][-ie-1>>1].neg()),y.type==="affine"?z=z.mixedAdd(y):z=z.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Wi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(_=l,M=d),p.negative&&(p=p.neg(),y=y.neg()),_.negative&&(_=_.neg(),M=M.neg()),[{a:p,b:y},{a:_,b:M}]},Ki.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Ki.prototype.pointFromX=function(e,r){e=new rr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Ki.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Ki.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Tn.prototype.isInfinity=function(){return this.inf},Tn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Tn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Tn.prototype.getX=function(){return this.x.fromRed()},Tn.prototype.getY=function(){return this.y.fromRed()},Tn.prototype.mul=function(e){return e=new rr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Tn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Tn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Tn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Tn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Tn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function $n(t,e,r,n){rc.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new rr(0)):(this.x=new rr(e,16),this.y=new rr(r,16),this.z=new rr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}zm($n,rc.BasePoint),Ki.prototype.jpoint=function(e,r,n){return new $n(this,e,r,n)},$n.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},$n.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},$n.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),_=l.redSqr().redIAdd(p).redISub(y).redISub(y),M=l.redMul(y.redISub(_)).redISub(o.redMul(p)),O=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(_,M,O)},$n.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),_=u.redMul(p.redISub(y)).redISub(s.redMul(d)),M=this.z.redMul(a);return this.curve.jpoint(y,_,M)},$n.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},$n.prototype.inspect=function(){return this.isInfinity()?"":""},$n.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var kd=bu(function(t,e){var r=e;r.base=rc,r.short=$k,r.mont=null,r.edwards=null}),Bd=bu(function(t,e){var r=e,n=Ci.assert;function i(a){a.type==="short"?this.curve=new kd.short(a):a.type==="edwards"?this.curve=new kd.edwards(a):this.curve=new kd.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,u){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(u);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:wo.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:wo.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:wo.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:wo.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:wo.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:wo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function ca(t){if(!(this instanceof ca))return new ca(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ws.toArray(t.entropy,t.entropyEnc||"hex"),r=ws.toArray(t.nonce,t.nonceEnc||"hex"),n=ws.toArray(t.pers,t.persEnc||"hex");qm(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var z3=ca;ca.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ca.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=ws.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var Fk=Ci.assert;function $d(t,e){if(t instanceof $d)return t;this._importDER(t,e)||(Fk(t.r&&t.s,"Signature without r or s"),this.r=new rr(t.r,16),this.s=new rr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Fd=$d;function jk(){this.place=0}function Km(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function H3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}$d.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=H3(r),n=H3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Vm(i,r.length),i=i.concat(r),i.push(2),Vm(i,n.length);var s=i.concat(n),o=[48];return Vm(o,s.length),o=o.concat(s),Ci.encode(o,e)};var Uk=function(){throw new Error("unsupported")},W3=Ci.assert;function Vi(t){if(!(this instanceof Vi))return new Vi(t);typeof t=="string"&&(W3(Object.prototype.hasOwnProperty.call(Bd,t),"Unknown curve "+t),t=Bd[t]),t instanceof Bd.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var qk=Vi;Vi.prototype.keyPair=function(e){return new Wm(this,e)},Vi.prototype.keyFromPrivate=function(e,r){return Wm.fromPrivate(this,e,r)},Vi.prototype.keyFromPublic=function(e,r){return Wm.fromPublic(this,e,r)},Vi.prototype.genKeyPair=function(e){e||(e={});for(var r=new z3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Uk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new rr(2));;){var s=new rr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Vi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Vi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new rr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new z3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new rr(1)),d=0;;d++){var p=i.k?i.k(d):new rr(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var _=y.getX(),M=_.umod(this.n);if(M.cmpn(0)!==0){var O=p.invm(this.n).mul(M.mul(r.getPrivate()).iadd(e));if(O=O.umod(this.n),O.cmpn(0)!==0){var L=(y.getY().isOdd()?1:0)|(_.cmp(M)!==0?2:0);return i.canonical&&O.cmp(this.nh)>0&&(O=this.n.sub(O),L^=1),new Fd({r:M,s:O,recoveryParam:L})}}}}}},Vi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new rr(e,16)),n=this.keyFromPublic(n,i),r=new Fd(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),u=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.eqXToP(s)):(d=this.g.mulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.getX().umod(this.n).cmp(s)===0)},Vi.prototype.recoverPubKey=function(t,e,r,n){W3((3&r)===r,"The recovery param is more than two bits"),e=new Fd(e,n);var i=this.n,s=new rr(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Vi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Fd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var zk=bu(function(t,e){var r=e;r.version="6.5.4",r.utils=Ci,r.rand=function(){throw new Error("unsupported")},r.curve=kd,r.curves=Bd,r.ec=qk,r.eddsa=null}),Hk=zk.ec;const Wk="signing-key/5.7.0",Gm=new Kr(Wk);let Ym=null;function ua(){return Ym||(Ym=new Hk("secp256k1")),Ym}class Kk{constructor(e){ul(this,"curve","secp256k1"),ul(this,"privateKey",Ii(e)),XN(this.privateKey)!==32&&Gm.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=ua().keyFromPrivate(bn(this.privateKey));ul(this,"publicKey","0x"+r.getPublic(!1,"hex")),ul(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ul(this,"_isSigningKey",!0)}_addPoint(e){const r=ua().keyFromPublic(bn(this.publicKey)),n=ua().keyFromPublic(bn(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=ua().keyFromPrivate(bn(this.privateKey)),n=bn(e);n.length!==32&&Gm.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return g3({recoveryParam:i.recoveryParam,r:lu("0x"+i.r.toString(16),32),s:lu("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=ua().keyFromPrivate(bn(this.privateKey)),n=ua().keyFromPublic(bn(K3(e)));return lu("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function Vk(t,e){const r=g3(e),n={r:bn(r.r),s:bn(r.s)};return"0x"+ua().recoverPubKey(bn(t),n,r.recoveryParam).encode("hex",!1)}function K3(t,e){const r=bn(t);return r.length===32?new Kk(r).publicKey:r.length===33?"0x"+ua().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?Ii(r):Gm.throwArgumentError("invalid public or private key","key","[REDACTED]")}var V3;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(V3||(V3={}));function Gk(t){const e=K3(t);return cL(p3(Dm(p3(e,1)),12))}function Yk(t,e){return Gk(Vk(bn(t),e))}var Jm={},jd={};Object.defineProperty(jd,"__esModule",{value:!0});var Vn=or,Xm=Mi,Jk=20;function Xk(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],p=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],_=r[27]<<24|r[26]<<16|r[25]<<8|r[24],M=r[31]<<24|r[30]<<16|r[29]<<8|r[28],O=e[3]<<24|e[2]<<16|e[1]<<8|e[0],L=e[7]<<24|e[6]<<16|e[5]<<8|e[4],B=e[11]<<24|e[10]<<16|e[9]<<8|e[8],k=e[15]<<24|e[14]<<16|e[13]<<8|e[12],H=n,U=i,z=s,Z=o,R=a,W=u,ie=l,me=d,j=p,E=y,m=_,f=M,g=O,v=L,x=B,S=k,A=0;A>>16|g<<16,j=j+g|0,R^=j,R=R>>>20|R<<12,U=U+W|0,v^=U,v=v>>>16|v<<16,E=E+v|0,W^=E,W=W>>>20|W<<12,z=z+ie|0,x^=z,x=x>>>16|x<<16,m=m+x|0,ie^=m,ie=ie>>>20|ie<<12,Z=Z+me|0,S^=Z,S=S>>>16|S<<16,f=f+S|0,me^=f,me=me>>>20|me<<12,z=z+ie|0,x^=z,x=x>>>24|x<<8,m=m+x|0,ie^=m,ie=ie>>>25|ie<<7,Z=Z+me|0,S^=Z,S=S>>>24|S<<8,f=f+S|0,me^=f,me=me>>>25|me<<7,U=U+W|0,v^=U,v=v>>>24|v<<8,E=E+v|0,W^=E,W=W>>>25|W<<7,H=H+R|0,g^=H,g=g>>>24|g<<8,j=j+g|0,R^=j,R=R>>>25|R<<7,H=H+W|0,S^=H,S=S>>>16|S<<16,m=m+S|0,W^=m,W=W>>>20|W<<12,U=U+ie|0,g^=U,g=g>>>16|g<<16,f=f+g|0,ie^=f,ie=ie>>>20|ie<<12,z=z+me|0,v^=z,v=v>>>16|v<<16,j=j+v|0,me^=j,me=me>>>20|me<<12,Z=Z+R|0,x^=Z,x=x>>>16|x<<16,E=E+x|0,R^=E,R=R>>>20|R<<12,z=z+me|0,v^=z,v=v>>>24|v<<8,j=j+v|0,me^=j,me=me>>>25|me<<7,Z=Z+R|0,x^=Z,x=x>>>24|x<<8,E=E+x|0,R^=E,R=R>>>25|R<<7,U=U+ie|0,g^=U,g=g>>>24|g<<8,f=f+g|0,ie^=f,ie=ie>>>25|ie<<7,H=H+W|0,S^=H,S=S>>>24|S<<8,m=m+S|0,W^=m,W=W>>>25|W<<7;Vn.writeUint32LE(H+n|0,t,0),Vn.writeUint32LE(U+i|0,t,4),Vn.writeUint32LE(z+s|0,t,8),Vn.writeUint32LE(Z+o|0,t,12),Vn.writeUint32LE(R+a|0,t,16),Vn.writeUint32LE(W+u|0,t,20),Vn.writeUint32LE(ie+l|0,t,24),Vn.writeUint32LE(me+d|0,t,28),Vn.writeUint32LE(j+p|0,t,32),Vn.writeUint32LE(E+y|0,t,36),Vn.writeUint32LE(m+_|0,t,40),Vn.writeUint32LE(f+M|0,t,44),Vn.writeUint32LE(g+O|0,t,48),Vn.writeUint32LE(v+L|0,t,52),Vn.writeUint32LE(x+B|0,t,56),Vn.writeUint32LE(S+k|0,t,60)}function G3(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var Y3={},fa={};Object.defineProperty(fa,"__esModule",{value:!0});function eB(t,e,r){return~(t-1)&e|t-1&r}fa.select=eB;function tB(t,e){return(t|0)-(e|0)-1>>>31&1}fa.lessOrEqual=tB;function J3(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}fa.compare=J3;function rB(t,e){return t.length===0||e.length===0?!1:J3(t,e)!==0}fa.equal=rB,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=fa,r=Mi;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var u=a[0]|a[1]<<8;this._r[0]=u&8191;var l=a[2]|a[3]<<8;this._r[1]=(u>>>13|l<<3)&8191;var d=a[4]|a[5]<<8;this._r[2]=(l>>>10|d<<6)&7939;var p=a[6]|a[7]<<8;this._r[3]=(d>>>7|p<<9)&8191;var y=a[8]|a[9]<<8;this._r[4]=(p>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var _=a[10]|a[11]<<8;this._r[6]=(y>>>14|_<<2)&8191;var M=a[12]|a[13]<<8;this._r[7]=(_>>>11|M<<5)&8065;var O=a[14]|a[15]<<8;this._r[8]=(M>>>8|O<<8)&8191,this._r[9]=O>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,u,l){for(var d=this._fin?0:2048,p=this._h[0],y=this._h[1],_=this._h[2],M=this._h[3],O=this._h[4],L=this._h[5],B=this._h[6],k=this._h[7],H=this._h[8],U=this._h[9],z=this._r[0],Z=this._r[1],R=this._r[2],W=this._r[3],ie=this._r[4],me=this._r[5],j=this._r[6],E=this._r[7],m=this._r[8],f=this._r[9];l>=16;){var g=a[u+0]|a[u+1]<<8;p+=g&8191;var v=a[u+2]|a[u+3]<<8;y+=(g>>>13|v<<3)&8191;var x=a[u+4]|a[u+5]<<8;_+=(v>>>10|x<<6)&8191;var S=a[u+6]|a[u+7]<<8;M+=(x>>>7|S<<9)&8191;var A=a[u+8]|a[u+9]<<8;O+=(S>>>4|A<<12)&8191,L+=A>>>1&8191;var b=a[u+10]|a[u+11]<<8;B+=(A>>>14|b<<2)&8191;var P=a[u+12]|a[u+13]<<8;k+=(b>>>11|P<<5)&8191;var I=a[u+14]|a[u+15]<<8;H+=(P>>>8|I<<8)&8191,U+=I>>>5|d;var F=0,ce=F;ce+=p*z,ce+=y*(5*f),ce+=_*(5*m),ce+=M*(5*E),ce+=O*(5*j),F=ce>>>13,ce&=8191,ce+=L*(5*me),ce+=B*(5*ie),ce+=k*(5*W),ce+=H*(5*R),ce+=U*(5*Z),F+=ce>>>13,ce&=8191;var D=F;D+=p*Z,D+=y*z,D+=_*(5*f),D+=M*(5*m),D+=O*(5*E),F=D>>>13,D&=8191,D+=L*(5*j),D+=B*(5*me),D+=k*(5*ie),D+=H*(5*W),D+=U*(5*R),F+=D>>>13,D&=8191;var se=F;se+=p*R,se+=y*Z,se+=_*z,se+=M*(5*f),se+=O*(5*m),F=se>>>13,se&=8191,se+=L*(5*E),se+=B*(5*j),se+=k*(5*me),se+=H*(5*ie),se+=U*(5*W),F+=se>>>13,se&=8191;var ee=F;ee+=p*W,ee+=y*R,ee+=_*Z,ee+=M*z,ee+=O*(5*f),F=ee>>>13,ee&=8191,ee+=L*(5*m),ee+=B*(5*E),ee+=k*(5*j),ee+=H*(5*me),ee+=U*(5*ie),F+=ee>>>13,ee&=8191;var J=F;J+=p*ie,J+=y*W,J+=_*R,J+=M*Z,J+=O*z,F=J>>>13,J&=8191,J+=L*(5*f),J+=B*(5*m),J+=k*(5*E),J+=H*(5*j),J+=U*(5*me),F+=J>>>13,J&=8191;var Q=F;Q+=p*me,Q+=y*ie,Q+=_*W,Q+=M*R,Q+=O*Z,F=Q>>>13,Q&=8191,Q+=L*z,Q+=B*(5*f),Q+=k*(5*m),Q+=H*(5*E),Q+=U*(5*j),F+=Q>>>13,Q&=8191;var T=F;T+=p*j,T+=y*me,T+=_*ie,T+=M*W,T+=O*R,F=T>>>13,T&=8191,T+=L*Z,T+=B*z,T+=k*(5*f),T+=H*(5*m),T+=U*(5*E),F+=T>>>13,T&=8191;var X=F;X+=p*E,X+=y*j,X+=_*me,X+=M*ie,X+=O*W,F=X>>>13,X&=8191,X+=L*R,X+=B*Z,X+=k*z,X+=H*(5*f),X+=U*(5*m),F+=X>>>13,X&=8191;var re=F;re+=p*m,re+=y*E,re+=_*j,re+=M*me,re+=O*ie,F=re>>>13,re&=8191,re+=L*W,re+=B*R,re+=k*Z,re+=H*z,re+=U*(5*f),F+=re>>>13,re&=8191;var ge=F;ge+=p*f,ge+=y*m,ge+=_*E,ge+=M*j,ge+=O*me,F=ge>>>13,ge&=8191,ge+=L*ie,ge+=B*W,ge+=k*R,ge+=H*Z,ge+=U*z,F+=ge>>>13,ge&=8191,F=(F<<2)+F|0,F=F+ce|0,ce=F&8191,F=F>>>13,D+=F,p=ce,y=D,_=se,M=ee,O=J,L=Q,B=T,k=X,H=re,U=ge,u+=16,l-=16}this._h[0]=p,this._h[1]=y,this._h[2]=_,this._h[3]=M,this._h[4]=O,this._h[5]=L,this._h[6]=B,this._h[7]=k,this._h[8]=H,this._h[9]=U},o.prototype.finish=function(a,u){u===void 0&&(u=0);var l=new Uint16Array(10),d,p,y,_;if(this._leftover){for(_=this._leftover,this._buffer[_++]=1;_<16;_++)this._buffer[_]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(d=this._h[1]>>>13,this._h[1]&=8191,_=2;_<10;_++)this._h[_]+=d,d=this._h[_]>>>13,this._h[_]&=8191;for(this._h[0]+=d*5,d=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=d,d=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=d,l[0]=this._h[0]+5,d=l[0]>>>13,l[0]&=8191,_=1;_<10;_++)l[_]=this._h[_]+d,d=l[_]>>>13,l[_]&=8191;for(l[9]-=8192,p=(d^1)-1,_=0;_<10;_++)l[_]&=p;for(p=~p,_=0;_<10;_++)this._h[_]=this._h[_]&p|l[_];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,y=this._h[0]+this._pad[0],this._h[0]=y&65535,_=1;_<8;_++)y=(this._h[_]+this._pad[_]|0)+(y>>>16)|0,this._h[_]=y&65535;return a[u+0]=this._h[0]>>>0,a[u+1]=this._h[0]>>>8,a[u+2]=this._h[1]>>>0,a[u+3]=this._h[1]>>>8,a[u+4]=this._h[2]>>>0,a[u+5]=this._h[2]>>>8,a[u+6]=this._h[3]>>>0,a[u+7]=this._h[3]>>>8,a[u+8]=this._h[4]>>>0,a[u+9]=this._h[4]>>>8,a[u+10]=this._h[5]>>>0,a[u+11]=this._h[5]>>>8,a[u+12]=this._h[6]>>>0,a[u+13]=this._h[6]>>>8,a[u+14]=this._h[7]>>>0,a[u+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var u=0,l=a.length,d;if(this._leftover){d=16-this._leftover,d>l&&(d=l);for(var p=0;p=16&&(d=l-l%16,this._blocks(a,u,d),u+=d,l-=d),l){for(var p=0;p16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var _=new Uint8Array(16);_.set(l,_.length-l.length);var M=new Uint8Array(32);e.stream(this._key,_,M,4);var O=d.length+this.tagLength,L;if(y){if(y.length!==O)throw new Error("ChaCha20Poly1305: incorrect destination length");L=y}else L=new Uint8Array(O);return e.streamXOR(this._key,_,d,L,4),this._authenticate(L.subarray(L.length-this.tagLength,L.length),M,L.subarray(0,L.length-this.tagLength),p),n.wipe(_),L},u.prototype.open=function(l,d,p,y){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(d.length0&&_.update(o.subarray(y.length%16))),_.update(p),p.length%16>0&&_.update(o.subarray(p.length%16));var M=new Uint8Array(8);y&&i.writeUint64LE(y.length,M),_.update(M),i.writeUint64LE(p.length,M),_.update(M);for(var O=_.digest(),L=0;Lthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._temp,this._state,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,_=l%64<56?64:128;this._buffer[d]=128;for(var M=d+1;M<_-8;M++)this._buffer[M]=0;e.writeUint32BE(p,this._buffer,_-8),e.writeUint32BE(y,this._buffer,_-4),s(this._temp,this._state,this._buffer,0,_),this._finished=!0}for(var M=0;M0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._state.set(u.state),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.state),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,u,l,d,p){for(;p>=64;){for(var y=u[0],_=u[1],M=u[2],O=u[3],L=u[4],B=u[5],k=u[6],H=u[7],U=0;U<16;U++){var z=d+U*4;a[U]=e.readUint32BE(l,z)}for(var U=16;U<64;U++){var Z=a[U-2],R=(Z>>>17|Z<<15)^(Z>>>19|Z<<13)^Z>>>10;Z=a[U-15];var W=(Z>>>7|Z<<25)^(Z>>>18|Z<<14)^Z>>>3;a[U]=(R+a[U-7]|0)+(W+a[U-16]|0)}for(var U=0;U<64;U++){var R=(((L>>>6|L<<26)^(L>>>11|L<<21)^(L>>>25|L<<7))+(L&B^~L&k)|0)+(H+(i[U]+a[U]|0)|0)|0,W=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&_^y&M^_&M)|0;H=k,k=B,B=L,L=O+R|0,O=M,M=_,_=y,y=R+W|0}u[0]+=y,u[1]+=_,u[2]+=M,u[3]+=O,u[4]+=L,u[5]+=B,u[6]+=k,u[7]+=H,d+=64,p-=64}return d}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(pl);var Qm={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=sa,r=Mi;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(U){const z=new Float64Array(16);if(U)for(let Z=0;Z>16&1),Z[me-1]&=65535;Z[15]=R[15]-32767-(Z[14]>>16&1);const ie=Z[15]>>16&1;Z[14]&=65535,a(R,Z,1-ie)}for(let W=0;W<16;W++)U[2*W]=R[W]&255,U[2*W+1]=R[W]>>8}function l(U,z){for(let Z=0;Z<16;Z++)U[Z]=z[2*Z]+(z[2*Z+1]<<8);U[15]&=32767}function d(U,z,Z){for(let R=0;R<16;R++)U[R]=z[R]+Z[R]}function p(U,z,Z){for(let R=0;R<16;R++)U[R]=z[R]-Z[R]}function y(U,z,Z){let R,W,ie=0,me=0,j=0,E=0,m=0,f=0,g=0,v=0,x=0,S=0,A=0,b=0,P=0,I=0,F=0,ce=0,D=0,se=0,ee=0,J=0,Q=0,T=0,X=0,re=0,ge=0,oe=0,fe=0,be=0,Me=0,Ne=0,Te=0,$e=Z[0],Ie=Z[1],Le=Z[2],Ve=Z[3],ke=Z[4],ze=Z[5],He=Z[6],Se=Z[7],Qe=Z[8],ct=Z[9],Be=Z[10],et=Z[11],rt=Z[12],Je=Z[13],gt=Z[14],ht=Z[15];R=z[0],ie+=R*$e,me+=R*Ie,j+=R*Le,E+=R*Ve,m+=R*ke,f+=R*ze,g+=R*He,v+=R*Se,x+=R*Qe,S+=R*ct,A+=R*Be,b+=R*et,P+=R*rt,I+=R*Je,F+=R*gt,ce+=R*ht,R=z[1],me+=R*$e,j+=R*Ie,E+=R*Le,m+=R*Ve,f+=R*ke,g+=R*ze,v+=R*He,x+=R*Se,S+=R*Qe,A+=R*ct,b+=R*Be,P+=R*et,I+=R*rt,F+=R*Je,ce+=R*gt,D+=R*ht,R=z[2],j+=R*$e,E+=R*Ie,m+=R*Le,f+=R*Ve,g+=R*ke,v+=R*ze,x+=R*He,S+=R*Se,A+=R*Qe,b+=R*ct,P+=R*Be,I+=R*et,F+=R*rt,ce+=R*Je,D+=R*gt,se+=R*ht,R=z[3],E+=R*$e,m+=R*Ie,f+=R*Le,g+=R*Ve,v+=R*ke,x+=R*ze,S+=R*He,A+=R*Se,b+=R*Qe,P+=R*ct,I+=R*Be,F+=R*et,ce+=R*rt,D+=R*Je,se+=R*gt,ee+=R*ht,R=z[4],m+=R*$e,f+=R*Ie,g+=R*Le,v+=R*Ve,x+=R*ke,S+=R*ze,A+=R*He,b+=R*Se,P+=R*Qe,I+=R*ct,F+=R*Be,ce+=R*et,D+=R*rt,se+=R*Je,ee+=R*gt,J+=R*ht,R=z[5],f+=R*$e,g+=R*Ie,v+=R*Le,x+=R*Ve,S+=R*ke,A+=R*ze,b+=R*He,P+=R*Se,I+=R*Qe,F+=R*ct,ce+=R*Be,D+=R*et,se+=R*rt,ee+=R*Je,J+=R*gt,Q+=R*ht,R=z[6],g+=R*$e,v+=R*Ie,x+=R*Le,S+=R*Ve,A+=R*ke,b+=R*ze,P+=R*He,I+=R*Se,F+=R*Qe,ce+=R*ct,D+=R*Be,se+=R*et,ee+=R*rt,J+=R*Je,Q+=R*gt,T+=R*ht,R=z[7],v+=R*$e,x+=R*Ie,S+=R*Le,A+=R*Ve,b+=R*ke,P+=R*ze,I+=R*He,F+=R*Se,ce+=R*Qe,D+=R*ct,se+=R*Be,ee+=R*et,J+=R*rt,Q+=R*Je,T+=R*gt,X+=R*ht,R=z[8],x+=R*$e,S+=R*Ie,A+=R*Le,b+=R*Ve,P+=R*ke,I+=R*ze,F+=R*He,ce+=R*Se,D+=R*Qe,se+=R*ct,ee+=R*Be,J+=R*et,Q+=R*rt,T+=R*Je,X+=R*gt,re+=R*ht,R=z[9],S+=R*$e,A+=R*Ie,b+=R*Le,P+=R*Ve,I+=R*ke,F+=R*ze,ce+=R*He,D+=R*Se,se+=R*Qe,ee+=R*ct,J+=R*Be,Q+=R*et,T+=R*rt,X+=R*Je,re+=R*gt,ge+=R*ht,R=z[10],A+=R*$e,b+=R*Ie,P+=R*Le,I+=R*Ve,F+=R*ke,ce+=R*ze,D+=R*He,se+=R*Se,ee+=R*Qe,J+=R*ct,Q+=R*Be,T+=R*et,X+=R*rt,re+=R*Je,ge+=R*gt,oe+=R*ht,R=z[11],b+=R*$e,P+=R*Ie,I+=R*Le,F+=R*Ve,ce+=R*ke,D+=R*ze,se+=R*He,ee+=R*Se,J+=R*Qe,Q+=R*ct,T+=R*Be,X+=R*et,re+=R*rt,ge+=R*Je,oe+=R*gt,fe+=R*ht,R=z[12],P+=R*$e,I+=R*Ie,F+=R*Le,ce+=R*Ve,D+=R*ke,se+=R*ze,ee+=R*He,J+=R*Se,Q+=R*Qe,T+=R*ct,X+=R*Be,re+=R*et,ge+=R*rt,oe+=R*Je,fe+=R*gt,be+=R*ht,R=z[13],I+=R*$e,F+=R*Ie,ce+=R*Le,D+=R*Ve,se+=R*ke,ee+=R*ze,J+=R*He,Q+=R*Se,T+=R*Qe,X+=R*ct,re+=R*Be,ge+=R*et,oe+=R*rt,fe+=R*Je,be+=R*gt,Me+=R*ht,R=z[14],F+=R*$e,ce+=R*Ie,D+=R*Le,se+=R*Ve,ee+=R*ke,J+=R*ze,Q+=R*He,T+=R*Se,X+=R*Qe,re+=R*ct,ge+=R*Be,oe+=R*et,fe+=R*rt,be+=R*Je,Me+=R*gt,Ne+=R*ht,R=z[15],ce+=R*$e,D+=R*Ie,se+=R*Le,ee+=R*Ve,J+=R*ke,Q+=R*ze,T+=R*He,X+=R*Se,re+=R*Qe,ge+=R*ct,oe+=R*Be,fe+=R*et,be+=R*rt,Me+=R*Je,Ne+=R*gt,Te+=R*ht,ie+=38*D,me+=38*se,j+=38*ee,E+=38*J,m+=38*Q,f+=38*T,g+=38*X,v+=38*re,x+=38*ge,S+=38*oe,A+=38*fe,b+=38*be,P+=38*Me,I+=38*Ne,F+=38*Te,W=1,R=ie+W+65535,W=Math.floor(R/65536),ie=R-W*65536,R=me+W+65535,W=Math.floor(R/65536),me=R-W*65536,R=j+W+65535,W=Math.floor(R/65536),j=R-W*65536,R=E+W+65535,W=Math.floor(R/65536),E=R-W*65536,R=m+W+65535,W=Math.floor(R/65536),m=R-W*65536,R=f+W+65535,W=Math.floor(R/65536),f=R-W*65536,R=g+W+65535,W=Math.floor(R/65536),g=R-W*65536,R=v+W+65535,W=Math.floor(R/65536),v=R-W*65536,R=x+W+65535,W=Math.floor(R/65536),x=R-W*65536,R=S+W+65535,W=Math.floor(R/65536),S=R-W*65536,R=A+W+65535,W=Math.floor(R/65536),A=R-W*65536,R=b+W+65535,W=Math.floor(R/65536),b=R-W*65536,R=P+W+65535,W=Math.floor(R/65536),P=R-W*65536,R=I+W+65535,W=Math.floor(R/65536),I=R-W*65536,R=F+W+65535,W=Math.floor(R/65536),F=R-W*65536,R=ce+W+65535,W=Math.floor(R/65536),ce=R-W*65536,ie+=W-1+37*(W-1),W=1,R=ie+W+65535,W=Math.floor(R/65536),ie=R-W*65536,R=me+W+65535,W=Math.floor(R/65536),me=R-W*65536,R=j+W+65535,W=Math.floor(R/65536),j=R-W*65536,R=E+W+65535,W=Math.floor(R/65536),E=R-W*65536,R=m+W+65535,W=Math.floor(R/65536),m=R-W*65536,R=f+W+65535,W=Math.floor(R/65536),f=R-W*65536,R=g+W+65535,W=Math.floor(R/65536),g=R-W*65536,R=v+W+65535,W=Math.floor(R/65536),v=R-W*65536,R=x+W+65535,W=Math.floor(R/65536),x=R-W*65536,R=S+W+65535,W=Math.floor(R/65536),S=R-W*65536,R=A+W+65535,W=Math.floor(R/65536),A=R-W*65536,R=b+W+65535,W=Math.floor(R/65536),b=R-W*65536,R=P+W+65535,W=Math.floor(R/65536),P=R-W*65536,R=I+W+65535,W=Math.floor(R/65536),I=R-W*65536,R=F+W+65535,W=Math.floor(R/65536),F=R-W*65536,R=ce+W+65535,W=Math.floor(R/65536),ce=R-W*65536,ie+=W-1+37*(W-1),U[0]=ie,U[1]=me,U[2]=j,U[3]=E,U[4]=m,U[5]=f,U[6]=g,U[7]=v,U[8]=x,U[9]=S,U[10]=A,U[11]=b,U[12]=P,U[13]=I,U[14]=F,U[15]=ce}function _(U,z){y(U,z,z)}function M(U,z){const Z=n();for(let R=0;R<16;R++)Z[R]=z[R];for(let R=253;R>=0;R--)_(Z,Z),R!==2&&R!==4&&y(Z,Z,z);for(let R=0;R<16;R++)U[R]=Z[R]}function O(U,z){const Z=new Uint8Array(32),R=new Float64Array(80),W=n(),ie=n(),me=n(),j=n(),E=n(),m=n();for(let x=0;x<31;x++)Z[x]=U[x];Z[31]=U[31]&127|64,Z[0]&=248,l(R,z);for(let x=0;x<16;x++)ie[x]=R[x];W[0]=j[0]=1;for(let x=254;x>=0;--x){const S=Z[x>>>3]>>>(x&7)&1;a(W,ie,S),a(me,j,S),d(E,W,me),p(W,W,me),d(me,ie,j),p(ie,ie,j),_(j,E),_(m,W),y(W,me,W),y(me,ie,E),d(E,W,me),p(W,W,me),_(ie,W),p(me,j,m),y(W,me,s),d(W,W,j),y(me,me,W),y(W,j,m),y(j,ie,R),_(ie,E),a(W,ie,S),a(me,j,S)}for(let x=0;x<16;x++)R[x+16]=W[x],R[x+32]=me[x],R[x+48]=ie[x],R[x+64]=j[x];const f=R.subarray(32),g=R.subarray(16);M(f,f),y(g,g,f);const v=new Uint8Array(32);return u(v,g),v}t.scalarMult=O;function L(U){return O(U,i)}t.scalarMultBase=L;function B(U){if(U.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const z=new Uint8Array(U);return{publicKey:L(z),secretKey:z}}t.generateKeyPairFromSeed=B;function k(U){const z=(0,e.randomBytes)(32,U),Z=B(z);return(0,r.wipe)(z),Z}t.generateKeyPair=k;function H(U,z,Z=!1){if(U.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(z.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const R=O(U,z);if(Z){let W=0;for(let ie=0;ie",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}};var Ti={},e1={exports:{}};e1.exports,function(t){(function(e,r){function n(j,E){if(!j)throw new Error(E||"Assertion failed")}function i(j,E){j.super_=E;var m=function(){};m.prototype=E.prototype,j.prototype=new m,j.prototype.constructor=j}function s(j,E,m){if(s.isBN(j))return j;this.negative=0,this.words=null,this.length=0,this.red=null,j!==null&&((E==="le"||E==="be")&&(m=E,E=10),this._init(j||0,E||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=il.Buffer}catch{}s.isBN=function(E){return E instanceof s?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===s.wordSize&&Array.isArray(E.words)},s.max=function(E,m){return E.cmp(m)>0?E:m},s.min=function(E,m){return E.cmp(m)<0?E:m},s.prototype._init=function(E,m,f){if(typeof E=="number")return this._initNumber(E,m,f);if(typeof E=="object")return this._initArray(E,m,f);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),E=E.toString().replace(/\s+/g,"");var g=0;E[0]==="-"&&(g++,this.negative=1),g=0;g-=3)x=E[g]|E[g-1]<<8|E[g-2]<<16,this.words[v]|=x<>>26-S&67108863,S+=24,S>=26&&(S-=26,v++);else if(f==="le")for(g=0,v=0;g>>26-S&67108863,S+=24,S>=26&&(S-=26,v++);return this.strip()};function a(j,E){var m=j.charCodeAt(E);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function u(j,E,m){var f=a(j,m);return m-1>=E&&(f|=a(j,m-1)<<4),f}s.prototype._parseHex=function(E,m,f){this.length=Math.ceil((E.length-m)/6),this.words=new Array(this.length);for(var g=0;g=m;g-=2)S=u(E,m,g)<=18?(v-=18,x+=1,this.words[x]|=S>>>26):v+=8;else{var A=E.length-m;for(g=A%2===0?m+1:m;g=18?(v-=18,x+=1,this.words[x]|=S>>>26):v+=8}this.strip()};function l(j,E,m,f){for(var g=0,v=Math.min(j.length,m),x=E;x=49?g+=S-49+10:S>=17?g+=S-17+10:g+=S}return g}s.prototype._parseBase=function(E,m,f){this.words=[0],this.length=1;for(var g=0,v=1;v<=67108863;v*=m)g++;g--,v=v/m|0;for(var x=E.length-f,S=x%g,A=Math.min(x,x-S)+f,b=0,P=f;P1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var d=["","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"],p=[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],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(E,m){E=E||10,m=m|0||1;var f;if(E===16||E==="hex"){f="";for(var g=0,v=0,x=0;x>>24-g&16777215,g+=2,g>=26&&(g-=26,x--),v!==0||x!==this.length-1?f=d[6-A.length]+A+f:f=A+f}for(v!==0&&(f=v.toString(16)+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(E===(E|0)&&E>=2&&E<=36){var b=p[E],P=y[E];f="";var I=this.clone();for(I.negative=0;!I.isZero();){var F=I.modn(P).toString(E);I=I.idivn(P),I.isZero()?f=F+f:f=d[b-F.length]+F+f}for(this.isZero()&&(f="0"+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(E,m){return n(typeof o<"u"),this.toArrayLike(o,E,m)},s.prototype.toArray=function(E,m){return this.toArrayLike(Array,E,m)},s.prototype.toArrayLike=function(E,m,f){var g=this.byteLength(),v=f||Math.max(1,g);n(g<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var x=m==="le",S=new E(v),A,b,P=this.clone();if(x){for(b=0;!P.isZero();b++)A=P.andln(255),P.iushrn(8),S[b]=A;for(;b=4096&&(f+=13,m>>>=13),m>=64&&(f+=7,m>>>=7),m>=8&&(f+=4,m>>>=4),m>=2&&(f+=2,m>>>=2),f+m},s.prototype._zeroBits=function(E){if(E===0)return 26;var m=E,f=0;return m&8191||(f+=13,m>>>=13),m&127||(f+=7,m>>>=7),m&15||(f+=4,m>>>=4),m&3||(f+=2,m>>>=2),m&1||f++,f},s.prototype.bitLength=function(){var E=this.words[this.length-1],m=this._countBits(E);return(this.length-1)*26+m};function _(j){for(var E=new Array(j.bitLength()),m=0;m>>g}return E}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,m=0;mE.length?this.clone().ior(E):E.clone().ior(this)},s.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},s.prototype.iuand=function(E){var m;this.length>E.length?m=E:m=this;for(var f=0;fE.length?this.clone().iand(E):E.clone().iand(this)},s.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},s.prototype.iuxor=function(E){var m,f;this.length>E.length?(m=this,f=E):(m=E,f=this);for(var g=0;gE.length?this.clone().ixor(E):E.clone().ixor(this)},s.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},s.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var m=Math.ceil(E/26)|0,f=E%26;this._expand(m),f>0&&m--;for(var g=0;g0&&(this.words[g]=~this.words[g]&67108863>>26-f),this.strip()},s.prototype.notn=function(E){return this.clone().inotn(E)},s.prototype.setn=function(E,m){n(typeof E=="number"&&E>=0);var f=E/26|0,g=E%26;return this._expand(f+1),m?this.words[f]=this.words[f]|1<E.length?(f=this,g=E):(f=E,g=this);for(var v=0,x=0;x>>26;for(;v!==0&&x>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;xE.length?this.clone().iadd(E):E.clone().iadd(this)},s.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var m=this.iadd(E);return E.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var f=this.cmp(E);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var g,v;f>0?(g=this,v=E):(g=E,v=this);for(var x=0,S=0;S>26,this.words[S]=m&67108863;for(;x!==0&&S>26,this.words[S]=m&67108863;if(x===0&&S>>26,I=A&67108863,F=Math.min(b,E.length-1),ce=Math.max(0,b-j.length+1);ce<=F;ce++){var D=b-ce|0;g=j.words[D]|0,v=E.words[ce]|0,x=g*v+I,P+=x/67108864|0,I=x&67108863}m.words[b]=I|0,A=P|0}return A!==0?m.words[b]=A|0:m.length--,m.strip()}var O=function(E,m,f){var g=E.words,v=m.words,x=f.words,S=0,A,b,P,I=g[0]|0,F=I&8191,ce=I>>>13,D=g[1]|0,se=D&8191,ee=D>>>13,J=g[2]|0,Q=J&8191,T=J>>>13,X=g[3]|0,re=X&8191,ge=X>>>13,oe=g[4]|0,fe=oe&8191,be=oe>>>13,Me=g[5]|0,Ne=Me&8191,Te=Me>>>13,$e=g[6]|0,Ie=$e&8191,Le=$e>>>13,Ve=g[7]|0,ke=Ve&8191,ze=Ve>>>13,He=g[8]|0,Se=He&8191,Qe=He>>>13,ct=g[9]|0,Be=ct&8191,et=ct>>>13,rt=v[0]|0,Je=rt&8191,gt=rt>>>13,ht=v[1]|0,ft=ht&8191,Ht=ht>>>13,Jt=v[2]|0,St=Jt&8191,er=Jt>>>13,Xt=v[3]|0,Ot=Xt&8191,Bt=Xt>>>13,Tt=v[4]|0,bt=Tt&8191,Dt=Tt>>>13,Lt=v[5]|0,yt=Lt&8191,$t=Lt>>>13,jt=v[6]|0,nt=jt&8191,Ft=jt>>>13,$=v[7]|0,K=$&8191,G=$>>>13,C=v[8]|0,Y=C&8191,q=C>>>13,ae=v[9]|0,pe=ae&8191,_e=ae>>>13;f.negative=E.negative^m.negative,f.length=19,A=Math.imul(F,Je),b=Math.imul(F,gt),b=b+Math.imul(ce,Je)|0,P=Math.imul(ce,gt);var Re=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(Re>>>26)|0,Re&=67108863,A=Math.imul(se,Je),b=Math.imul(se,gt),b=b+Math.imul(ee,Je)|0,P=Math.imul(ee,gt),A=A+Math.imul(F,ft)|0,b=b+Math.imul(F,Ht)|0,b=b+Math.imul(ce,ft)|0,P=P+Math.imul(ce,Ht)|0;var De=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(De>>>26)|0,De&=67108863,A=Math.imul(Q,Je),b=Math.imul(Q,gt),b=b+Math.imul(T,Je)|0,P=Math.imul(T,gt),A=A+Math.imul(se,ft)|0,b=b+Math.imul(se,Ht)|0,b=b+Math.imul(ee,ft)|0,P=P+Math.imul(ee,Ht)|0,A=A+Math.imul(F,St)|0,b=b+Math.imul(F,er)|0,b=b+Math.imul(ce,St)|0,P=P+Math.imul(ce,er)|0;var it=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(it>>>26)|0,it&=67108863,A=Math.imul(re,Je),b=Math.imul(re,gt),b=b+Math.imul(ge,Je)|0,P=Math.imul(ge,gt),A=A+Math.imul(Q,ft)|0,b=b+Math.imul(Q,Ht)|0,b=b+Math.imul(T,ft)|0,P=P+Math.imul(T,Ht)|0,A=A+Math.imul(se,St)|0,b=b+Math.imul(se,er)|0,b=b+Math.imul(ee,St)|0,P=P+Math.imul(ee,er)|0,A=A+Math.imul(F,Ot)|0,b=b+Math.imul(F,Bt)|0,b=b+Math.imul(ce,Ot)|0,P=P+Math.imul(ce,Bt)|0;var Ue=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,A=Math.imul(fe,Je),b=Math.imul(fe,gt),b=b+Math.imul(be,Je)|0,P=Math.imul(be,gt),A=A+Math.imul(re,ft)|0,b=b+Math.imul(re,Ht)|0,b=b+Math.imul(ge,ft)|0,P=P+Math.imul(ge,Ht)|0,A=A+Math.imul(Q,St)|0,b=b+Math.imul(Q,er)|0,b=b+Math.imul(T,St)|0,P=P+Math.imul(T,er)|0,A=A+Math.imul(se,Ot)|0,b=b+Math.imul(se,Bt)|0,b=b+Math.imul(ee,Ot)|0,P=P+Math.imul(ee,Bt)|0,A=A+Math.imul(F,bt)|0,b=b+Math.imul(F,Dt)|0,b=b+Math.imul(ce,bt)|0,P=P+Math.imul(ce,Dt)|0;var mt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(mt>>>26)|0,mt&=67108863,A=Math.imul(Ne,Je),b=Math.imul(Ne,gt),b=b+Math.imul(Te,Je)|0,P=Math.imul(Te,gt),A=A+Math.imul(fe,ft)|0,b=b+Math.imul(fe,Ht)|0,b=b+Math.imul(be,ft)|0,P=P+Math.imul(be,Ht)|0,A=A+Math.imul(re,St)|0,b=b+Math.imul(re,er)|0,b=b+Math.imul(ge,St)|0,P=P+Math.imul(ge,er)|0,A=A+Math.imul(Q,Ot)|0,b=b+Math.imul(Q,Bt)|0,b=b+Math.imul(T,Ot)|0,P=P+Math.imul(T,Bt)|0,A=A+Math.imul(se,bt)|0,b=b+Math.imul(se,Dt)|0,b=b+Math.imul(ee,bt)|0,P=P+Math.imul(ee,Dt)|0,A=A+Math.imul(F,yt)|0,b=b+Math.imul(F,$t)|0,b=b+Math.imul(ce,yt)|0,P=P+Math.imul(ce,$t)|0;var st=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(st>>>26)|0,st&=67108863,A=Math.imul(Ie,Je),b=Math.imul(Ie,gt),b=b+Math.imul(Le,Je)|0,P=Math.imul(Le,gt),A=A+Math.imul(Ne,ft)|0,b=b+Math.imul(Ne,Ht)|0,b=b+Math.imul(Te,ft)|0,P=P+Math.imul(Te,Ht)|0,A=A+Math.imul(fe,St)|0,b=b+Math.imul(fe,er)|0,b=b+Math.imul(be,St)|0,P=P+Math.imul(be,er)|0,A=A+Math.imul(re,Ot)|0,b=b+Math.imul(re,Bt)|0,b=b+Math.imul(ge,Ot)|0,P=P+Math.imul(ge,Bt)|0,A=A+Math.imul(Q,bt)|0,b=b+Math.imul(Q,Dt)|0,b=b+Math.imul(T,bt)|0,P=P+Math.imul(T,Dt)|0,A=A+Math.imul(se,yt)|0,b=b+Math.imul(se,$t)|0,b=b+Math.imul(ee,yt)|0,P=P+Math.imul(ee,$t)|0,A=A+Math.imul(F,nt)|0,b=b+Math.imul(F,Ft)|0,b=b+Math.imul(ce,nt)|0,P=P+Math.imul(ce,Ft)|0;var tt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(tt>>>26)|0,tt&=67108863,A=Math.imul(ke,Je),b=Math.imul(ke,gt),b=b+Math.imul(ze,Je)|0,P=Math.imul(ze,gt),A=A+Math.imul(Ie,ft)|0,b=b+Math.imul(Ie,Ht)|0,b=b+Math.imul(Le,ft)|0,P=P+Math.imul(Le,Ht)|0,A=A+Math.imul(Ne,St)|0,b=b+Math.imul(Ne,er)|0,b=b+Math.imul(Te,St)|0,P=P+Math.imul(Te,er)|0,A=A+Math.imul(fe,Ot)|0,b=b+Math.imul(fe,Bt)|0,b=b+Math.imul(be,Ot)|0,P=P+Math.imul(be,Bt)|0,A=A+Math.imul(re,bt)|0,b=b+Math.imul(re,Dt)|0,b=b+Math.imul(ge,bt)|0,P=P+Math.imul(ge,Dt)|0,A=A+Math.imul(Q,yt)|0,b=b+Math.imul(Q,$t)|0,b=b+Math.imul(T,yt)|0,P=P+Math.imul(T,$t)|0,A=A+Math.imul(se,nt)|0,b=b+Math.imul(se,Ft)|0,b=b+Math.imul(ee,nt)|0,P=P+Math.imul(ee,Ft)|0,A=A+Math.imul(F,K)|0,b=b+Math.imul(F,G)|0,b=b+Math.imul(ce,K)|0,P=P+Math.imul(ce,G)|0;var At=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(At>>>26)|0,At&=67108863,A=Math.imul(Se,Je),b=Math.imul(Se,gt),b=b+Math.imul(Qe,Je)|0,P=Math.imul(Qe,gt),A=A+Math.imul(ke,ft)|0,b=b+Math.imul(ke,Ht)|0,b=b+Math.imul(ze,ft)|0,P=P+Math.imul(ze,Ht)|0,A=A+Math.imul(Ie,St)|0,b=b+Math.imul(Ie,er)|0,b=b+Math.imul(Le,St)|0,P=P+Math.imul(Le,er)|0,A=A+Math.imul(Ne,Ot)|0,b=b+Math.imul(Ne,Bt)|0,b=b+Math.imul(Te,Ot)|0,P=P+Math.imul(Te,Bt)|0,A=A+Math.imul(fe,bt)|0,b=b+Math.imul(fe,Dt)|0,b=b+Math.imul(be,bt)|0,P=P+Math.imul(be,Dt)|0,A=A+Math.imul(re,yt)|0,b=b+Math.imul(re,$t)|0,b=b+Math.imul(ge,yt)|0,P=P+Math.imul(ge,$t)|0,A=A+Math.imul(Q,nt)|0,b=b+Math.imul(Q,Ft)|0,b=b+Math.imul(T,nt)|0,P=P+Math.imul(T,Ft)|0,A=A+Math.imul(se,K)|0,b=b+Math.imul(se,G)|0,b=b+Math.imul(ee,K)|0,P=P+Math.imul(ee,G)|0,A=A+Math.imul(F,Y)|0,b=b+Math.imul(F,q)|0,b=b+Math.imul(ce,Y)|0,P=P+Math.imul(ce,q)|0;var Rt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,A=Math.imul(Be,Je),b=Math.imul(Be,gt),b=b+Math.imul(et,Je)|0,P=Math.imul(et,gt),A=A+Math.imul(Se,ft)|0,b=b+Math.imul(Se,Ht)|0,b=b+Math.imul(Qe,ft)|0,P=P+Math.imul(Qe,Ht)|0,A=A+Math.imul(ke,St)|0,b=b+Math.imul(ke,er)|0,b=b+Math.imul(ze,St)|0,P=P+Math.imul(ze,er)|0,A=A+Math.imul(Ie,Ot)|0,b=b+Math.imul(Ie,Bt)|0,b=b+Math.imul(Le,Ot)|0,P=P+Math.imul(Le,Bt)|0,A=A+Math.imul(Ne,bt)|0,b=b+Math.imul(Ne,Dt)|0,b=b+Math.imul(Te,bt)|0,P=P+Math.imul(Te,Dt)|0,A=A+Math.imul(fe,yt)|0,b=b+Math.imul(fe,$t)|0,b=b+Math.imul(be,yt)|0,P=P+Math.imul(be,$t)|0,A=A+Math.imul(re,nt)|0,b=b+Math.imul(re,Ft)|0,b=b+Math.imul(ge,nt)|0,P=P+Math.imul(ge,Ft)|0,A=A+Math.imul(Q,K)|0,b=b+Math.imul(Q,G)|0,b=b+Math.imul(T,K)|0,P=P+Math.imul(T,G)|0,A=A+Math.imul(se,Y)|0,b=b+Math.imul(se,q)|0,b=b+Math.imul(ee,Y)|0,P=P+Math.imul(ee,q)|0,A=A+Math.imul(F,pe)|0,b=b+Math.imul(F,_e)|0,b=b+Math.imul(ce,pe)|0,P=P+Math.imul(ce,_e)|0;var Mt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,A=Math.imul(Be,ft),b=Math.imul(Be,Ht),b=b+Math.imul(et,ft)|0,P=Math.imul(et,Ht),A=A+Math.imul(Se,St)|0,b=b+Math.imul(Se,er)|0,b=b+Math.imul(Qe,St)|0,P=P+Math.imul(Qe,er)|0,A=A+Math.imul(ke,Ot)|0,b=b+Math.imul(ke,Bt)|0,b=b+Math.imul(ze,Ot)|0,P=P+Math.imul(ze,Bt)|0,A=A+Math.imul(Ie,bt)|0,b=b+Math.imul(Ie,Dt)|0,b=b+Math.imul(Le,bt)|0,P=P+Math.imul(Le,Dt)|0,A=A+Math.imul(Ne,yt)|0,b=b+Math.imul(Ne,$t)|0,b=b+Math.imul(Te,yt)|0,P=P+Math.imul(Te,$t)|0,A=A+Math.imul(fe,nt)|0,b=b+Math.imul(fe,Ft)|0,b=b+Math.imul(be,nt)|0,P=P+Math.imul(be,Ft)|0,A=A+Math.imul(re,K)|0,b=b+Math.imul(re,G)|0,b=b+Math.imul(ge,K)|0,P=P+Math.imul(ge,G)|0,A=A+Math.imul(Q,Y)|0,b=b+Math.imul(Q,q)|0,b=b+Math.imul(T,Y)|0,P=P+Math.imul(T,q)|0,A=A+Math.imul(se,pe)|0,b=b+Math.imul(se,_e)|0,b=b+Math.imul(ee,pe)|0,P=P+Math.imul(ee,_e)|0;var Et=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(Et>>>26)|0,Et&=67108863,A=Math.imul(Be,St),b=Math.imul(Be,er),b=b+Math.imul(et,St)|0,P=Math.imul(et,er),A=A+Math.imul(Se,Ot)|0,b=b+Math.imul(Se,Bt)|0,b=b+Math.imul(Qe,Ot)|0,P=P+Math.imul(Qe,Bt)|0,A=A+Math.imul(ke,bt)|0,b=b+Math.imul(ke,Dt)|0,b=b+Math.imul(ze,bt)|0,P=P+Math.imul(ze,Dt)|0,A=A+Math.imul(Ie,yt)|0,b=b+Math.imul(Ie,$t)|0,b=b+Math.imul(Le,yt)|0,P=P+Math.imul(Le,$t)|0,A=A+Math.imul(Ne,nt)|0,b=b+Math.imul(Ne,Ft)|0,b=b+Math.imul(Te,nt)|0,P=P+Math.imul(Te,Ft)|0,A=A+Math.imul(fe,K)|0,b=b+Math.imul(fe,G)|0,b=b+Math.imul(be,K)|0,P=P+Math.imul(be,G)|0,A=A+Math.imul(re,Y)|0,b=b+Math.imul(re,q)|0,b=b+Math.imul(ge,Y)|0,P=P+Math.imul(ge,q)|0,A=A+Math.imul(Q,pe)|0,b=b+Math.imul(Q,_e)|0,b=b+Math.imul(T,pe)|0,P=P+Math.imul(T,_e)|0;var dt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(dt>>>26)|0,dt&=67108863,A=Math.imul(Be,Ot),b=Math.imul(Be,Bt),b=b+Math.imul(et,Ot)|0,P=Math.imul(et,Bt),A=A+Math.imul(Se,bt)|0,b=b+Math.imul(Se,Dt)|0,b=b+Math.imul(Qe,bt)|0,P=P+Math.imul(Qe,Dt)|0,A=A+Math.imul(ke,yt)|0,b=b+Math.imul(ke,$t)|0,b=b+Math.imul(ze,yt)|0,P=P+Math.imul(ze,$t)|0,A=A+Math.imul(Ie,nt)|0,b=b+Math.imul(Ie,Ft)|0,b=b+Math.imul(Le,nt)|0,P=P+Math.imul(Le,Ft)|0,A=A+Math.imul(Ne,K)|0,b=b+Math.imul(Ne,G)|0,b=b+Math.imul(Te,K)|0,P=P+Math.imul(Te,G)|0,A=A+Math.imul(fe,Y)|0,b=b+Math.imul(fe,q)|0,b=b+Math.imul(be,Y)|0,P=P+Math.imul(be,q)|0,A=A+Math.imul(re,pe)|0,b=b+Math.imul(re,_e)|0,b=b+Math.imul(ge,pe)|0,P=P+Math.imul(ge,_e)|0;var _t=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(_t>>>26)|0,_t&=67108863,A=Math.imul(Be,bt),b=Math.imul(Be,Dt),b=b+Math.imul(et,bt)|0,P=Math.imul(et,Dt),A=A+Math.imul(Se,yt)|0,b=b+Math.imul(Se,$t)|0,b=b+Math.imul(Qe,yt)|0,P=P+Math.imul(Qe,$t)|0,A=A+Math.imul(ke,nt)|0,b=b+Math.imul(ke,Ft)|0,b=b+Math.imul(ze,nt)|0,P=P+Math.imul(ze,Ft)|0,A=A+Math.imul(Ie,K)|0,b=b+Math.imul(Ie,G)|0,b=b+Math.imul(Le,K)|0,P=P+Math.imul(Le,G)|0,A=A+Math.imul(Ne,Y)|0,b=b+Math.imul(Ne,q)|0,b=b+Math.imul(Te,Y)|0,P=P+Math.imul(Te,q)|0,A=A+Math.imul(fe,pe)|0,b=b+Math.imul(fe,_e)|0,b=b+Math.imul(be,pe)|0,P=P+Math.imul(be,_e)|0;var ot=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(ot>>>26)|0,ot&=67108863,A=Math.imul(Be,yt),b=Math.imul(Be,$t),b=b+Math.imul(et,yt)|0,P=Math.imul(et,$t),A=A+Math.imul(Se,nt)|0,b=b+Math.imul(Se,Ft)|0,b=b+Math.imul(Qe,nt)|0,P=P+Math.imul(Qe,Ft)|0,A=A+Math.imul(ke,K)|0,b=b+Math.imul(ke,G)|0,b=b+Math.imul(ze,K)|0,P=P+Math.imul(ze,G)|0,A=A+Math.imul(Ie,Y)|0,b=b+Math.imul(Ie,q)|0,b=b+Math.imul(Le,Y)|0,P=P+Math.imul(Le,q)|0,A=A+Math.imul(Ne,pe)|0,b=b+Math.imul(Ne,_e)|0,b=b+Math.imul(Te,pe)|0,P=P+Math.imul(Te,_e)|0;var wt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(wt>>>26)|0,wt&=67108863,A=Math.imul(Be,nt),b=Math.imul(Be,Ft),b=b+Math.imul(et,nt)|0,P=Math.imul(et,Ft),A=A+Math.imul(Se,K)|0,b=b+Math.imul(Se,G)|0,b=b+Math.imul(Qe,K)|0,P=P+Math.imul(Qe,G)|0,A=A+Math.imul(ke,Y)|0,b=b+Math.imul(ke,q)|0,b=b+Math.imul(ze,Y)|0,P=P+Math.imul(ze,q)|0,A=A+Math.imul(Ie,pe)|0,b=b+Math.imul(Ie,_e)|0,b=b+Math.imul(Le,pe)|0,P=P+Math.imul(Le,_e)|0;var lt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(lt>>>26)|0,lt&=67108863,A=Math.imul(Be,K),b=Math.imul(Be,G),b=b+Math.imul(et,K)|0,P=Math.imul(et,G),A=A+Math.imul(Se,Y)|0,b=b+Math.imul(Se,q)|0,b=b+Math.imul(Qe,Y)|0,P=P+Math.imul(Qe,q)|0,A=A+Math.imul(ke,pe)|0,b=b+Math.imul(ke,_e)|0,b=b+Math.imul(ze,pe)|0,P=P+Math.imul(ze,_e)|0;var at=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(at>>>26)|0,at&=67108863,A=Math.imul(Be,Y),b=Math.imul(Be,q),b=b+Math.imul(et,Y)|0,P=Math.imul(et,q),A=A+Math.imul(Se,pe)|0,b=b+Math.imul(Se,_e)|0,b=b+Math.imul(Qe,pe)|0,P=P+Math.imul(Qe,_e)|0;var Ae=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,A=Math.imul(Be,pe),b=Math.imul(Be,_e),b=b+Math.imul(et,pe)|0,P=Math.imul(et,_e);var Pe=(S+A|0)+((b&8191)<<13)|0;return S=(P+(b>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,x[0]=Re,x[1]=De,x[2]=it,x[3]=Ue,x[4]=mt,x[5]=st,x[6]=tt,x[7]=At,x[8]=Rt,x[9]=Mt,x[10]=Et,x[11]=dt,x[12]=_t,x[13]=ot,x[14]=wt,x[15]=lt,x[16]=at,x[17]=Ae,x[18]=Pe,S!==0&&(x[19]=S,f.length++),f};Math.imul||(O=M);function L(j,E,m){m.negative=E.negative^j.negative,m.length=j.length+E.length;for(var f=0,g=0,v=0;v>>26)|0,g+=x>>>26,x&=67108863}m.words[v]=S,f=x,x=g}return f!==0?m.words[v]=f:m.length--,m.strip()}function B(j,E,m){var f=new k;return f.mulp(j,E,m)}s.prototype.mulTo=function(E,m){var f,g=this.length+E.length;return this.length===10&&E.length===10?f=O(this,E,m):g<63?f=M(this,E,m):g<1024?f=L(this,E,m):f=B(this,E,m),f};function k(j,E){this.x=j,this.y=E}k.prototype.makeRBT=function(E){for(var m=new Array(E),f=s.prototype._countBits(E)-1,g=0;g>=1;return g},k.prototype.permute=function(E,m,f,g,v,x){for(var S=0;S>>1)v++;return 1<>>13,f[2*x+1]=v&8191,v=v>>>13;for(x=2*m;x>=26,m+=g/67108864|0,m+=v>>>26,this.words[f]=v&67108863}return m!==0&&(this.words[f]=m,this.length++),this},s.prototype.muln=function(E){return this.clone().imuln(E)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(E){var m=_(E);if(m.length===0)return new s(1);for(var f=this,g=0;g=0);var m=E%26,f=(E-m)/26,g=67108863>>>26-m<<26-m,v;if(m!==0){var x=0;for(v=0;v>>26-m}x&&(this.words[v]=x,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var g;m?g=(m-m%26)/26:g=0;var v=E%26,x=Math.min((E-v)/26,this.length),S=67108863^67108863>>>v<x)for(this.length-=x,b=0;b=0&&(P!==0||b>=g);b--){var I=this.words[b]|0;this.words[b]=P<<26-v|I>>>v,P=I&S}return A&&P!==0&&(A.words[A.length++]=P),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(E,m,f){return n(this.negative===0),this.iushrn(E,m,f)},s.prototype.shln=function(E){return this.clone().ishln(E)},s.prototype.ushln=function(E){return this.clone().iushln(E)},s.prototype.shrn=function(E){return this.clone().ishrn(E)},s.prototype.ushrn=function(E){return this.clone().iushrn(E)},s.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var m=E%26,f=(E-m)/26,g=1<=0);var m=E%26,f=(E-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(m!==0&&f++,this.length=Math.min(f,this.length),m!==0){var g=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(A/67108864|0),this.words[v+f]=x&67108863}for(;v>26,this.words[v+f]=x&67108863;if(S===0)return this.strip();for(n(S===-1),S=0,v=0;v>26,this.words[v]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(E,m){var f=this.length-E.length,g=this.clone(),v=E,x=v.words[v.length-1]|0,S=this._countBits(x);f=26-S,f!==0&&(v=v.ushln(f),g.iushln(f),x=v.words[v.length-1]|0);var A=g.length-v.length,b;if(m!=="mod"){b=new s(null),b.length=A+1,b.words=new Array(b.length);for(var P=0;P=0;F--){var ce=(g.words[v.length+F]|0)*67108864+(g.words[v.length+F-1]|0);for(ce=Math.min(ce/x|0,67108863),g._ishlnsubmul(v,ce,F);g.negative!==0;)ce--,g.negative=0,g._ishlnsubmul(v,1,F),g.isZero()||(g.negative^=1);b&&(b.words[F]=ce)}return b&&b.strip(),g.strip(),m!=="div"&&f!==0&&g.iushrn(f),{div:b||null,mod:g}},s.prototype.divmod=function(E,m,f){if(n(!E.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var g,v,x;return this.negative!==0&&E.negative===0?(x=this.neg().divmod(E,m),m!=="mod"&&(g=x.div.neg()),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.iadd(E)),{div:g,mod:v}):this.negative===0&&E.negative!==0?(x=this.divmod(E.neg(),m),m!=="mod"&&(g=x.div.neg()),{div:g,mod:x.mod}):this.negative&E.negative?(x=this.neg().divmod(E.neg(),m),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.isub(E)),{div:x.div,mod:v}):E.length>this.length||this.cmp(E)<0?{div:new s(0),mod:this}:E.length===1?m==="div"?{div:this.divn(E.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new s(this.modn(E.words[0]))}:this._wordDiv(E,m)},s.prototype.div=function(E){return this.divmod(E,"div",!1).div},s.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},s.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},s.prototype.divRound=function(E){var m=this.divmod(E);if(m.mod.isZero())return m.div;var f=m.div.negative!==0?m.mod.isub(E):m.mod,g=E.ushrn(1),v=E.andln(1),x=f.cmp(g);return x<0||v===1&&x===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(E){n(E<=67108863);for(var m=(1<<26)%E,f=0,g=this.length-1;g>=0;g--)f=(m*f+(this.words[g]|0))%E;return f},s.prototype.idivn=function(E){n(E<=67108863);for(var m=0,f=this.length-1;f>=0;f--){var g=(this.words[f]|0)+m*67108864;this.words[f]=g/E|0,m=g%E}return this.strip()},s.prototype.divn=function(E){return this.clone().idivn(E)},s.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=new s(0),S=new s(1),A=0;m.isEven()&&f.isEven();)m.iushrn(1),f.iushrn(1),++A;for(var b=f.clone(),P=m.clone();!m.isZero();){for(var I=0,F=1;!(m.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(m.iushrn(I);I-- >0;)(g.isOdd()||v.isOdd())&&(g.iadd(b),v.isub(P)),g.iushrn(1),v.iushrn(1);for(var ce=0,D=1;!(f.words[0]&D)&&ce<26;++ce,D<<=1);if(ce>0)for(f.iushrn(ce);ce-- >0;)(x.isOdd()||S.isOdd())&&(x.iadd(b),S.isub(P)),x.iushrn(1),S.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(x),v.isub(S)):(f.isub(m),x.isub(g),S.isub(v))}return{a:x,b:S,gcd:f.iushln(A)}},s.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=f.clone();m.cmpn(1)>0&&f.cmpn(1)>0;){for(var S=0,A=1;!(m.words[0]&A)&&S<26;++S,A<<=1);if(S>0)for(m.iushrn(S);S-- >0;)g.isOdd()&&g.iadd(x),g.iushrn(1);for(var b=0,P=1;!(f.words[0]&P)&&b<26;++b,P<<=1);if(b>0)for(f.iushrn(b);b-- >0;)v.isOdd()&&v.iadd(x),v.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(v)):(f.isub(m),v.isub(g))}var I;return m.cmpn(1)===0?I=g:I=v,I.cmpn(0)<0&&I.iadd(E),I},s.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var m=this.clone(),f=E.clone();m.negative=0,f.negative=0;for(var g=0;m.isEven()&&f.isEven();g++)m.iushrn(1),f.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=m.cmp(f);if(v<0){var x=m;m=f,f=x}else if(v===0||f.cmpn(1)===0)break;m.isub(f)}while(!0);return f.iushln(g)},s.prototype.invm=function(E){return this.egcd(E).a.umod(E)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(E){return this.words[0]&E},s.prototype.bincn=function(E){n(typeof E=="number");var m=E%26,f=(E-m)/26,g=1<>>26,S&=67108863,this.words[x]=S}return v!==0&&(this.words[x]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(E){var m=E<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var f;if(this.length>1)f=1;else{m&&(E=-E),n(E<=67108863,"Number is too big");var g=this.words[0]|0;f=g===E?0:gE.length)return 1;if(this.length=0;f--){var g=this.words[f]|0,v=E.words[f]|0;if(g!==v){gv&&(m=1);break}}return m},s.prototype.gtn=function(E){return this.cmpn(E)===1},s.prototype.gt=function(E){return this.cmp(E)===1},s.prototype.gten=function(E){return this.cmpn(E)>=0},s.prototype.gte=function(E){return this.cmp(E)>=0},s.prototype.ltn=function(E){return this.cmpn(E)===-1},s.prototype.lt=function(E){return this.cmp(E)===-1},s.prototype.lten=function(E){return this.cmpn(E)<=0},s.prototype.lte=function(E){return this.cmp(E)<=0},s.prototype.eqn=function(E){return this.cmpn(E)===0},s.prototype.eq=function(E){return this.cmp(E)===0},s.red=function(E){return new ie(E)},s.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(E){return this.red=E,this},s.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},s.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},s.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},s.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},s.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},s.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},s.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},s.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var H={k256:null,p224:null,p192:null,p25519:null};function U(j,E){this.name=j,this.p=new s(E,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var E=new s(null);return E.words=new Array(Math.ceil(this.n/13)),E},U.prototype.ireduce=function(E){var m=E,f;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),f=m.bitLength();while(f>this.n);var g=f0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},U.prototype.split=function(E,m){E.iushrn(this.n,0,m)},U.prototype.imulK=function(E){return E.imul(this.k)};function z(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(z,U),z.prototype.split=function(E,m){for(var f=4194303,g=Math.min(E.length,9),v=0;v>>22,x=S}x>>>=22,E.words[v-10]=x,x===0&&E.length>10?E.length-=10:E.length-=9},z.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var m=0,f=0;f>>=26,E.words[f]=v,m=g}return m!==0&&(E.words[E.length++]=m),E},s._prime=function(E){if(H[E])return H[E];var m;if(E==="k256")m=new z;else if(E==="p224")m=new Z;else if(E==="p192")m=new R;else if(E==="p25519")m=new W;else throw new Error("Unknown prime "+E);return H[E]=m,m};function ie(j){if(typeof j=="string"){var E=s._prime(j);this.m=E.p,this.prime=E}else n(j.gtn(1),"modulus must be greater than 1"),this.m=j,this.prime=null}ie.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},ie.prototype._verify2=function(E,m){n((E.negative|m.negative)===0,"red works only with positives"),n(E.red&&E.red===m.red,"red works only with red numbers")},ie.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},ie.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},ie.prototype.add=function(E,m){this._verify2(E,m);var f=E.add(m);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},ie.prototype.iadd=function(E,m){this._verify2(E,m);var f=E.iadd(m);return f.cmp(this.m)>=0&&f.isub(this.m),f},ie.prototype.sub=function(E,m){this._verify2(E,m);var f=E.sub(m);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},ie.prototype.isub=function(E,m){this._verify2(E,m);var f=E.isub(m);return f.cmpn(0)<0&&f.iadd(this.m),f},ie.prototype.shl=function(E,m){return this._verify1(E),this.imod(E.ushln(m))},ie.prototype.imul=function(E,m){return this._verify2(E,m),this.imod(E.imul(m))},ie.prototype.mul=function(E,m){return this._verify2(E,m),this.imod(E.mul(m))},ie.prototype.isqr=function(E){return this.imul(E,E.clone())},ie.prototype.sqr=function(E){return this.mul(E,E)},ie.prototype.sqrt=function(E){if(E.isZero())return E.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(E,f)}for(var g=this.m.subn(1),v=0;!g.isZero()&&g.andln(1)===0;)v++,g.iushrn(1);n(!g.isZero());var x=new s(1).toRed(this),S=x.redNeg(),A=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new s(2*b*b).toRed(this);this.pow(b,A).cmp(S)!==0;)b.redIAdd(S);for(var P=this.pow(b,g),I=this.pow(E,g.addn(1).iushrn(1)),F=this.pow(E,g),ce=v;F.cmp(x)!==0;){for(var D=F,se=0;D.cmp(x)!==0;se++)D=D.redSqr();n(se=0;v--){for(var P=m.words[v],I=b-1;I>=0;I--){var F=P>>I&1;if(x!==g[0]&&(x=this.sqr(x)),F===0&&S===0){A=0;continue}S<<=1,S|=F,A++,!(A!==f&&(v!==0||I!==0))&&(x=this.mul(x,g[S]),A=0,S=0)}b=26}return x},ie.prototype.convertTo=function(E){var m=E.umod(this.m);return m===E?m.clone():m},ie.prototype.convertFrom=function(E){var m=E.clone();return m.red=null,m},s.mont=function(E){return new me(E)};function me(j){ie.call(this,j),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(me,ie),me.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},me.prototype.convertFrom=function(E){var m=this.imod(E.mul(this.rinv));return m.red=null,m},me.prototype.imul=function(E,m){if(E.isZero()||m.isZero())return E.words[0]=0,E.length=1,E;var f=E.imul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},me.prototype.mul=function(E,m){if(E.isZero()||m.isZero())return new s(0)._forceRed(this);var f=E.mul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},me.prototype.invm=function(E){var m=this.imod(E._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,nn)}(e1);var xo=e1.exports,t1={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var u=0;u>8,p=l&255;d?a.push(d,p):a.push(p)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(O>>1)-1?B=(O>>1)-k:B=k,L.isubn(B)):B=0,_[M]=B,L.iushrn(1)}return _}e.getNAF=s;function o(d,p){var y=[[],[]];d=d.clone(),p=p.clone();for(var _=0,M=0,O;d.cmpn(-_)>0||p.cmpn(-M)>0;){var L=d.andln(3)+_&3,B=p.andln(3)+M&3;L===3&&(L=-1),B===3&&(B=-1);var k;L&1?(O=d.andln(7)+_&7,(O===3||O===5)&&B===2?k=-L:k=L):k=0,y[0].push(k);var H;B&1?(O=p.andln(7)+M&7,(O===3||O===5)&&L===2?H=-B:H=B):H=0,y[1].push(H),2*_===k+1&&(_=1-_),2*M===H+1&&(M=1-M),d.iushrn(1),p.iushrn(1)}return y}e.getJSF=o;function a(d,p,y){var _="_"+p;d.prototype[p]=function(){return this[_]!==void 0?this[_]:this[_]=y.call(this)}}e.cachedProperty=a;function u(d){return typeof d=="string"?e.toArray(d,"hex"):d}e.parseBytes=u;function l(d){return new r(d,"hex","le")}e.intFromLE=l}(Ti);var r1={exports:{}},n1;r1.exports=function(e){return n1||(n1=new la(null)),n1.generate(e)};function la(t){this.rand=t}if(r1.exports.Rand=la,la.prototype.generate=function(e){return this._rand(e)},la.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var zd=ha;ha.prototype.point=function(){throw new Error("Not implemented")},ha.prototype.validate=function(){throw new Error("Not implemented")},ha.prototype._fixedNafMul=function(e,r){qd(e.precomputed);var n=e._getDoubles(),i=Ud(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];qd(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},ha.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var M=d-1,O=d;if(o[M]!==1||o[O]!==1){u[M]=Ud(n[M],o[M],this._bitLength),u[O]=Ud(n[O],o[O],this._bitLength),l=Math.max(u[M].length,l),l=Math.max(u[O].length,l);continue}var L=[r[M],null,null,r[O]];r[M].y.cmp(r[O].y)===0?(L[1]=r[M].add(r[O]),L[2]=r[M].toJ().mixedAdd(r[O].neg())):r[M].y.cmp(r[O].y.redNeg())===0?(L[1]=r[M].toJ().mixedAdd(r[O]),L[2]=r[M].add(r[O].neg())):(L[1]=r[M].toJ().mixedAdd(r[O]),L[2]=r[M].toJ().mixedAdd(r[O].neg()));var B=[-3,-1,-5,-7,0,7,5,1,3],k=fB(n[M],n[O]);for(l=Math.max(k[0].length,l),u[M]=new Array(l),u[O]=new Array(l),p=0;p=0;d--){for(var R=0;d>=0;){var W=!0;for(p=0;p=0&&R++,z=z.dblp(R),d<0)break;for(p=0;p0?y=a[p][ie-1>>1]:ie<0&&(y=a[p][-ie-1>>1].neg()),y.type==="affine"?z=z.mixedAdd(y):z=z.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Gi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(_=l,M=d),p.negative&&(p=p.neg(),y=y.neg()),_.negative&&(_=_.neg(),M=M.neg()),[{a:p,b:y},{a:_,b:M}]},Yi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Yi.prototype.pointFromX=function(e,r){e=new en(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Yi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Yi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Rn.prototype.isInfinity=function(){return this.inf},Rn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Rn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Rn.prototype.getX=function(){return this.x.fromRed()},Rn.prototype.getY=function(){return this.y.fromRed()},Rn.prototype.mul=function(e){return e=new en(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Rn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Rn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Rn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Rn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Rn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Fn(t,e,r,n){yu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new en(0)):(this.x=new en(e,16),this.y=new en(r,16),this.z=new en(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}s1(Fn,yu.BasePoint),Yi.prototype.jpoint=function(e,r,n){return new Fn(this,e,r,n)},Fn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},Fn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Fn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),_=l.redSqr().redIAdd(p).redISub(y).redISub(y),M=l.redMul(y.redISub(_)).redISub(o.redMul(p)),O=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(_,M,O)},Fn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),_=u.redMul(p.redISub(y)).redISub(s.redMul(d)),M=this.z.redMul(a);return this.curve.jpoint(y,_,M)},Fn.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},Fn.prototype.inspect=function(){return this.isInfinity()?"":""},Fn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var wu=xo,i_=Rd,Hd=zd,pB=Ti;function xu(t){Hd.call(this,"mont",t),this.a=new wu(t.a,16).toRed(this.red),this.b=new wu(t.b,16).toRed(this.red),this.i4=new wu(4).toRed(this.red).redInvm(),this.two=new wu(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}i_(xu,Hd);var gB=xu;xu.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function Dn(t,e,r){Hd.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new wu(e,16),this.z=new wu(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i_(Dn,Hd.BasePoint),xu.prototype.decodePoint=function(e,r){return this.point(pB.toArray(e,r),1)},xu.prototype.point=function(e,r){return new Dn(this,e,r)},xu.prototype.pointFromJSON=function(e){return Dn.fromJSON(this,e)},Dn.prototype.precompute=function(){},Dn.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Dn.fromJSON=function(e,r){return new Dn(e,r[0],r[1]||e.one)},Dn.prototype.inspect=function(){return this.isInfinity()?"":""},Dn.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Dn.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)},Dn.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Dn.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),u=s.redMul(i),l=r.z.redMul(a.redAdd(u).redSqr()),d=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(l,d)},Dn.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i},Dn.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Dn.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Dn.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Dn.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Dn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var mB=Ti,_o=xo,s_=Rd,Wd=zd,vB=mB.assert;function Vs(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Wd.call(this,"edwards",t),this.a=new _o(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new _o(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new _o(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),vB(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}s_(Vs,Wd);var bB=Vs;Vs.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},Vs.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},Vs.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)},Vs.prototype.pointFromX=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var u=a.fromRed().isOdd();return(r&&!u||!r&&u)&&(a=a.redNeg()),this.point(e,a)},Vs.prototype.pointFromY=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)},Vs.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function Hr(t,e,r,n,i){Wd.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new _o(e,16),this.y=new _o(r,16),this.z=n?new _o(n,16):this.curve.one,this.t=i&&new _o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}s_(Hr,Wd.BasePoint),Vs.prototype.pointFromJSON=function(e){return Hr.fromJSON(this,e)},Vs.prototype.point=function(e,r,n,i){return new Hr(this,e,r,n,i)},Hr.fromJSON=function(e,r){return new Hr(e,r[0],r[1],r[2])},Hr.prototype.inspect=function(){return this.isInfinity()?"":""},Hr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Hr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),u=i.redSub(r),l=s.redMul(a),d=o.redMul(u),p=s.redMul(u),y=a.redMul(o);return this.curve.point(l,d,y,p)},Hr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,u,l;if(this.curve.twisted){a=this.curve._mulA(r);var d=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(d.redSub(this.curve.two)),s=d.redMul(a.redSub(n)),o=d.redSqr().redSub(d).redSub(d)):(u=this.z.redSqr(),l=d.redSub(u).redISub(u),i=e.redSub(r).redISub(n).redMul(l),s=d.redMul(a.redSub(n)),o=d.redMul(l))}else a=r.redAdd(n),u=this.curve._mulC(this.z).redSqr(),l=a.redSub(u).redSub(u),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)},Hr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Hr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),u=s.redAdd(i),l=n.redAdd(r),d=o.redMul(a),p=u.redMul(l),y=o.redMul(l),_=a.redMul(u);return this.curve.point(d,p,_,y)},Hr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),u=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),d=r.redMul(a).redMul(l),p,y;return this.curve.twisted?(p=r.redMul(u).redMul(s.redSub(this.curve._mulA(i))),y=a.redMul(u)):(p=r.redMul(u).redMul(s.redSub(i)),y=this.curve._mulC(a).redMul(u)),this.curve.point(d,p,y)},Hr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Hr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Hr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)},Hr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)},Hr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Hr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Hr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Hr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Hr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Hr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Hr.prototype.toP=Hr.prototype.normalize,Hr.prototype.mixedAdd=Hr.prototype.add,function(t){var e=t;e.base=zd,e.short=dB,e.mont=gB,e.edwards=bB}(i1);var Kd={},o1,o_;function yB(){return o_||(o_=1,o1={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),o1}(function(t){var e=t,r=fl,n=i1,i=Ti,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,d){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var p=new o(d);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:p}),p}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=yB()}catch{u=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})})(Kd);var wB=fl,ic=t1,a_=ec;function da(t){if(!(this instanceof da))return new da(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ic.toArray(t.entropy,t.entropyEnc||"hex"),r=ic.toArray(t.nonce,t.nonceEnc||"hex"),n=ic.toArray(t.pers,t.persEnc||"hex");a_(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var xB=da;da.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},da.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=ic.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var Vd=xo,c1=Ti,AB=c1.assert;function Gd(t,e){if(t instanceof Gd)return t;this._importDER(t,e)||(AB(t.r&&t.s,"Signature without r or s"),this.r=new Vd(t.r,16),this.s=new Vd(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var PB=Gd;function MB(){this.place=0}function u1(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function c_(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Gd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=c_(r),n=c_(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];f1(i,r.length),i=i.concat(r),i.push(2),f1(i,n.length);var s=i.concat(n),o=[48];return f1(o,s.length),o=o.concat(s),c1.encode(o,e)};var Eo=xo,u_=xB,IB=Ti,l1=Kd,CB=n_,f_=IB.assert,h1=SB,Yd=PB;function Ji(t){if(!(this instanceof Ji))return new Ji(t);typeof t=="string"&&(f_(Object.prototype.hasOwnProperty.call(l1,t),"Unknown curve "+t),t=l1[t]),t instanceof l1.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var TB=Ji;Ji.prototype.keyPair=function(e){return new h1(this,e)},Ji.prototype.keyFromPrivate=function(e,r){return h1.fromPrivate(this,e,r)},Ji.prototype.keyFromPublic=function(e,r){return h1.fromPublic(this,e,r)},Ji.prototype.genKeyPair=function(e){e||(e={});for(var r=new u_({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||CB(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new Eo(2));;){var s=new Eo(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Ji.prototype._truncateToN=function(e,r,n){var i;if(Eo.isBN(e)||typeof e=="number")e=new Eo(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new Eo(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new Eo(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Ji.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new u_({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new Eo(1)),d=0;;d++){var p=i.k?i.k(d):new Eo(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var _=y.getX(),M=_.umod(this.n);if(M.cmpn(0)!==0){var O=p.invm(this.n).mul(M.mul(r.getPrivate()).iadd(e));if(O=O.umod(this.n),O.cmpn(0)!==0){var L=(y.getY().isOdd()?1:0)|(_.cmp(M)!==0?2:0);return i.canonical&&O.cmp(this.nh)>0&&(O=this.n.sub(O),L^=1),new Yd({r:M,s:O,recoveryParam:L})}}}}}},Ji.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new Yd(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),l=u.mul(e).umod(this.n),d=u.mul(o).umod(this.n),p;return this.curve._maxwellTrick?(p=this.g.jmulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.eqXToP(o)):(p=this.g.mulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.getX().umod(this.n).cmp(o)===0)},Ji.prototype.recoverPubKey=function(t,e,r,n){f_((3&r)===r,"The recovery param is more than two bits"),e=new Yd(e,n);var i=this.n,s=new Eo(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Ji.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Yd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var ml=Ti,l_=ml.assert,h_=ml.parseBytes,_u=ml.cachedProperty;function On(t,e){this.eddsa=t,this._secret=h_(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=h_(e.pub)}On.fromPublic=function(e,r){return r instanceof On?r:new On(e,{pub:r})},On.fromSecret=function(e,r){return r instanceof On?r:new On(e,{secret:r})},On.prototype.secret=function(){return this._secret},_u(On,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),_u(On,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),_u(On,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i}),_u(On,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),_u(On,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),_u(On,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),On.prototype.sign=function(e){return l_(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},On.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},On.prototype.getSecret=function(e){return l_(this._secret,"KeyPair is public only"),ml.encode(this.secret(),e)},On.prototype.getPublic=function(e){return ml.encode(this.pubBytes(),e)};var RB=On,DB=xo,Jd=Ti,d_=Jd.assert,Xd=Jd.cachedProperty,OB=Jd.parseBytes;function sc(t,e){this.eddsa=t,typeof e!="object"&&(e=OB(e)),Array.isArray(e)&&(d_(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),d_(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof DB&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Xd(sc,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Xd(sc,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Xd(sc,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Xd(sc,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),sc.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},sc.prototype.toHex=function(){return Jd.encode(this.toBytes(),"hex").toUpperCase()};var NB=sc,LB=fl,kB=Kd,Eu=Ti,BB=Eu.assert,p_=Eu.parseBytes,g_=RB,m_=NB;function mi(t){if(BB(t==="ed25519","only tested with ed25519 so far"),!(this instanceof mi))return new mi(t);t=kB[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=LB.sha512}var $B=mi;mi.prototype.sign=function(e,r){e=p_(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),u=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:u,Rencoded:o})},mi.prototype.verify=function(e,r,n){if(e=p_(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)},mi.prototype.hashInt=function(){for(var e=this.hash(),r=0;re in t?UB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,w_=(t,e)=>{for(var r in e||(e={}))qB.call(e,r)&&y_(t,r,e[r]);if(b_)for(var r of b_(e))zB.call(e,r)&&y_(t,r,e[r]);return t};const HB="ReactNative",Ri={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},WB="js";function Zd(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Au(){return!ol()&&!!Am()&&navigator.product===HB}function vl(){return!Zd()&&!!Am()&&!!ol()}function bl(){return Au()?Ri.reactNative:Zd()?Ri.node:vl()?Ri.browser:Ri.unknown}function KB(){var t;try{return Au()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function VB(t,e){let r=al.parse(t);return r=w_(w_({},r),e),t=al.stringify(r),t}function x_(){return t3()||{name:"",description:"",url:"",icons:[""]}}function GB(){if(bl()===Ri.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=wN();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function YB(){var t;const e=bl();return e===Ri.browser?[e,((t=e3())==null?void 0:t.host)||"unknown"].join(":"):e}function __(t,e,r){const n=GB(),i=YB();return[[t,e].join("-"),[WB,r].join("-"),n,i].join("/")}function JB({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const u=r.split("?"),l=__(t,e,n),d={auth:i,ua:l,projectId:s,useOnCloseEvent:o,origin:a||void 0},p=VB(u[1]||"",d);return u[0]+"?"+p}function oc(t,e){return t.filter(r=>e.includes(r)).length===t.length}function E_(t){return Object.fromEntries(t.entries())}function S_(t){return new Map(Object.entries(t))}function ac(t=vt.FIVE_MINUTES,e){const r=vt.toMiliseconds(t||vt.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Pu(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function A_(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function XB(t){return A_("topic",t)}function ZB(t){return A_("id",t)}function P_(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function _n(t,e){return vt.fromMiliseconds(Date.now()+vt.toMiliseconds(t))}function pa(t){return Date.now()>=vt.toMiliseconds(t)}function br(t,e){return`${t}${e?`:${e}`:""}`}function Qd(t=[],e=[]){return[...new Set([...t,...e])]}async function QB({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=e$(s,t,e),a=bl();if(a===Ri.browser){if(!((n=ol())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,r$()?"_blank":"_self","noreferrer noopener")}else a===Ri.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function e$(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${n$(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function t$(t,e){let r="";try{if(vl()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function M_(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function I_(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function d1(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function r$(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function n$(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function C_(t){return Buffer.from(t,"base64").toString("utf-8")}const i$="https://rpc.walletconnect.org/v1";async function s$(t,e,r,n,i,s){switch(r.t){case"eip191":return o$(t,e,r.s);case"eip1271":return await a$(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function o$(t,e,r){return Yk(v3(e),r).toLowerCase()===t.toLowerCase()}async function a$(t,e,r,n,i,s){const o=Su(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",d=r.substring(2),p=v3(e).substring(2),y=a+p+u+l+d,_=await fetch(`${s||i$}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:c$(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:y},"latest"]})}),{result:M}=await _.json();return M?M.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function c$(){return Date.now()+Math.floor(Math.random()*1e3)}var u$=Object.defineProperty,f$=Object.defineProperties,l$=Object.getOwnPropertyDescriptors,T_=Object.getOwnPropertySymbols,h$=Object.prototype.hasOwnProperty,d$=Object.prototype.propertyIsEnumerable,R_=(t,e,r)=>e in t?u$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,p$=(t,e)=>{for(var r in e||(e={}))h$.call(e,r)&&R_(t,r,e[r]);if(T_)for(var r of T_(e))d$.call(e,r)&&R_(t,r,e[r]);return t},g$=(t,e)=>f$(t,l$(e));const m$="did:pkh:",p1=t=>t==null?void 0:t.split(":"),v$=t=>{const e=t&&p1(t);if(e)return t.includes(m$)?e[3]:e[1]},g1=t=>{const e=t&&p1(t);if(e)return e[2]+":"+e[3]},e0=t=>{const e=t&&p1(t);if(e)return e.pop()};async function D_(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=O_(i,i.iss),o=e0(i.iss);return await s$(o,s,n,g1(i.iss),r)}const O_=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=e0(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${v$(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,d=t.exp?`Expiration Time: ${t.exp}`:void 0,p=t.nbf?`Not Before: ${t.nbf}`:void 0,y=t.requestId?`Request ID: ${t.requestId}`:void 0,_=t.resources?`Resources:${t.resources.map(O=>` -- ${O}`).join("")}`:void 0,M=t0(t.resources);if(M){const O=yl(M);i=P$(i,O)}return[r,n,"",i,"",s,o,a,u,l,d,p,y,_].filter(O=>O!=null).join(` -`)};function b$(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function y$(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function cc(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function w$(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:x$(e,r,n)}}}function x$(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function N_(t){return cc(t),`urn:recap:${b$(t).replace(/=/g,"")}`}function yl(t){const e=y$(t.replace("urn:recap:",""));return cc(e),e}function _$(t,e,r){const n=w$(t,e,r);return N_(n)}function E$(t){return t&&t.includes("urn:recap:")}function S$(t,e){const r=yl(t),n=yl(e),i=A$(r,n);return N_(i)}function A$(t,e){cc(t),cc(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,u)=>a.localeCompare(u)).forEach(a=>{var u,l;n.att[i]=g$(p$({},n.att[i]),{[a]:((u=t.att[i])==null?void 0:u[a])||((l=e.att[i])==null?void 0:l[a])})})}),n}function P$(t="",e){cc(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const u=Object.keys(e.att[a]).map(p=>({ability:p.split("/")[0],action:p.split("/")[1]}));u.sort((p,y)=>p.action.localeCompare(y.action));const l={};u.forEach(p=>{l[p.ability]||(l[p.ability]=[]),l[p.ability].push(p.action)});const d=Object.keys(l).map(p=>(i++,`(${i}) '${p}': '${l[p].join("', '")}' for '${a}'.`));n.push(d.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function L_(t){var e;const r=yl(t);cc(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function k_(t){const e=yl(t);cc(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function t0(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return E$(e)?e:void 0}const B_="base10",ri="base16",ga="base64pad",wl="base64url",xl="utf8",$_=0,So=1,_l=2,M$=0,F_=1,El=12,m1=32;function I$(){const t=Qm.generateKeyPair();return{privateKey:In(t.secretKey,ri),publicKey:In(t.publicKey,ri)}}function v1(){const t=sa.randomBytes(m1);return In(t,ri)}function C$(t,e){const r=Qm.sharedKey(Cn(t,ri),Cn(e,ri),!0),n=new cB(pl.SHA256,r).expand(m1);return In(n,ri)}function r0(t){const e=pl.hash(Cn(t,ri));return In(e,ri)}function Ao(t){const e=pl.hash(Cn(t,xl));return In(e,ri)}function j_(t){return Cn(`${t}`,B_)}function uc(t){return Number(In(t,B_))}function T$(t){const e=j_(typeof t.type<"u"?t.type:$_);if(uc(e)===So&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Cn(t.senderPublicKey,ri):void 0,n=typeof t.iv<"u"?Cn(t.iv,ri):sa.randomBytes(El),i=new Jm.ChaCha20Poly1305(Cn(t.symKey,ri)).seal(n,Cn(t.message,xl));return U_({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function R$(t,e){const r=j_(_l),n=sa.randomBytes(El),i=Cn(t,xl);return U_({type:r,sealed:i,iv:n,encoding:e})}function D$(t){const e=new Jm.ChaCha20Poly1305(Cn(t.symKey,ri)),{sealed:r,iv:n}=Sl({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return In(i,xl)}function O$(t,e){const{sealed:r}=Sl({encoded:t,encoding:e});return In(r,xl)}function U_(t){const{encoding:e=ga}=t;if(uc(t.type)===_l)return In(Pd([t.type,t.sealed]),e);if(uc(t.type)===So){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return In(Pd([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return In(Pd([t.type,t.iv,t.sealed]),e)}function Sl(t){const{encoded:e,encoding:r=ga}=t,n=Cn(e,r),i=n.slice(M$,F_),s=F_;if(uc(i)===So){const l=s+m1,d=l+El,p=n.slice(s,l),y=n.slice(l,d),_=n.slice(d);return{type:i,sealed:_,iv:y,senderPublicKey:p}}if(uc(i)===_l){const l=n.slice(s),d=sa.randomBytes(El);return{type:i,sealed:l,iv:d}}const o=s+El,a=n.slice(s,o),u=n.slice(o);return{type:i,sealed:u,iv:a}}function N$(t,e){const r=Sl({encoded:t,encoding:e==null?void 0:e.encoding});return q_({type:uc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?In(r.senderPublicKey,ri):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function q_(t){const e=(t==null?void 0:t.type)||$_;if(e===So){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function z_(t){return t.type===So&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function H_(t){return t.type===_l}function L$(t){return new t_.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function k$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function B$(t){return Buffer.from(k$(t),"base64")}function $$(t,e){const[r,n,i]=t.split("."),s=B$(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),u=`${r}.${n}`,l=new pl.SHA256().update(Buffer.from(u)).digest(),d=L$(e),p=Buffer.from(l).toString("hex");if(!d.verify(p,{r:o,s:a}))throw new Error("Invalid signature");return Sm(t).payload}const F$="irn";function b1(t){return(t==null?void 0:t.relay)||{protocol:F$}}function Al(t){const e=FB[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var j$=Object.defineProperty,U$=Object.defineProperties,q$=Object.getOwnPropertyDescriptors,W_=Object.getOwnPropertySymbols,z$=Object.prototype.hasOwnProperty,H$=Object.prototype.propertyIsEnumerable,K_=(t,e,r)=>e in t?j$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,V_=(t,e)=>{for(var r in e||(e={}))z$.call(e,r)&&K_(t,r,e[r]);if(W_)for(var r of W_(e))H$.call(e,r)&&K_(t,r,e[r]);return t},W$=(t,e)=>U$(t,q$(e));function K$(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function G_(t){if(!t.includes("wc:")){const u=C_(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=al.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:V$(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:K$(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function V$(t){return t.startsWith("//")?t.substring(2):t}function G$(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function Y_(t){return`${t.protocol}:${t.topic}@${t.version}?`+al.stringify(V_(W$(V_({symKey:t.symKey},G$(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function n0(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Mu(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function Y$(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Mu(r.accounts))}),e}function J$(t,e){const r=[];return Object.values(t).forEach(n=>{Mu(n.accounts).includes(e)&&r.push(...n.methods)}),r}function X$(t,e){const r=[];return Object.values(t).forEach(n=>{Mu(n.accounts).includes(e)&&r.push(...n.events)}),r}function y1(t){return t.includes(":")}function Pl(t){return y1(t)?t.split(":")[0]:t}function Z$(t){const e={};return t==null||t.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function J_(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=Z$(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=Qd(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const Q$={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},eF={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ut(t,e){const{message:r,code:n}=eF[t];return{message:e?`${r} ${e}`:r,code:n}}function Dr(t,e){const{message:r,code:n}=Q$[t];return{message:e?`${r} ${e}`:r,code:n}}function fc(t,e){return!!Array.isArray(t)}function Ml(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function vi(t){return typeof t>"u"}function on(t,e){return e&&vi(t)?!0:typeof t=="string"&&!!t.trim().length}function w1(t,e){return typeof t=="number"&&!isNaN(t)}function tF(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return oc(i,n)?(n.forEach(o=>{const{accounts:a,methods:u,events:l}=t.namespaces[o],d=Mu(a),p=r[o];(!oc(v_(o,p),d)||!oc(p.methods,u)||!oc(p.events,l))&&(s=!1)}),s):!1}function i0(t){return on(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function rF(t){if(on(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&i0(r)}}return!1}function nF(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(on(t,!1)){if(e(t))return!0;const r=C_(t);return e(r)}}catch{}return!1}function iF(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function sF(t){return t==null?void 0:t.topic}function oF(t,e){let r=null;return on(t==null?void 0:t.publicKey,!1)||(r=ut("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function X_(t){let e=!0;return fc(t)?t.length&&(e=t.every(r=>on(r,!1))):e=!1,e}function aF(t,e,r){let n=null;return fc(e)&&e.length?e.forEach(i=>{n||i0(i)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):i0(t)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function cF(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=aF(i,v_(i,s),`${e} ${r}`);o&&(n=o)}),n}function uF(t,e){let r=null;return fc(t)?t.forEach(n=>{r||rF(n)||(r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function fF(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=uF(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function lF(t,e){let r=null;return X_(t==null?void 0:t.methods)?X_(t==null?void 0:t.events)||(r=Dr("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Dr("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function Z_(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=lF(n,`${e}, namespace`);i&&(r=i)}),r}function hF(t,e,r){let n=null;if(t&&Ml(t)){const i=Z_(t,e);i&&(n=i);const s=cF(t,e,r);s&&(n=s)}else n=ut("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function x1(t,e){let r=null;if(t&&Ml(t)){const n=Z_(t,e);n&&(r=n);const i=fF(t,e);i&&(r=i)}else r=ut("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function Q_(t){return on(t.protocol,!0)}function dF(t,e){let r=!1;return t?t&&fc(t)&&t.length&&t.forEach(n=>{r=Q_(n)}):r=!0,r}function pF(t){return typeof t=="number"}function bi(t){return typeof t<"u"&&typeof t!==null}function gF(t){return!(!t||typeof t!="object"||!t.code||!w1(t.code)||!t.message||!on(t.message,!1))}function mF(t){return!(vi(t)||!on(t.method,!1))}function vF(t){return!(vi(t)||vi(t.result)&&vi(t.error)||!w1(t.id)||!on(t.jsonrpc,!1))}function bF(t){return!(vi(t)||!on(t.name,!1))}function e6(t,e){return!(!i0(e)||!Y$(t).includes(e))}function yF(t,e,r){return on(r,!1)?J$(t,e).includes(r):!1}function wF(t,e,r){return on(r,!1)?X$(t,e).includes(r):!1}function t6(t,e,r){let n=null;const i=xF(t),s=_F(e),o=Object.keys(i),a=Object.keys(s),u=r6(Object.keys(t)),l=r6(Object.keys(e)),d=u.filter(p=>!l.includes(p));return d.length&&(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. + */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=nn:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],p=[4,1024,262144,67108864],y=[1,256,65536,16777216],_=[6,1536,393216,100663296],M=[0,8,16,24],O=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],L=[224,256,384,512],B=[128,256],k=["hex","buffer","arrayBuffer","array","digest"],H={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(D){return Object.prototype.toString.call(D)==="[object Array]"}),u&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(D){return typeof D=="object"&&D.buffer&&D.buffer.constructor===ArrayBuffer});for(var U=function(D,se,ee){return function(J){return new I(D,se,D).update(J)[ee]()}},z=function(D,se,ee){return function(J,Q){return new I(D,se,Q).update(J)[ee]()}},Z=function(D,se,ee){return function(J,Q,T,X){return f["cshake"+D].update(J,Q,T,X)[ee]()}},R=function(D,se,ee){return function(J,Q,T,X){return f["kmac"+D].update(J,Q,T,X)[ee]()}},W=function(D,se,ee,J){for(var Q=0;Q>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ee>>5,this.extraBytes=(ee&31)>>3;for(var J=0;J<50;++J)this.s[J]=0}I.prototype.update=function(D){if(this.finalized)throw new Error(r);var se,ee=typeof D;if(ee!=="string"){if(ee==="object"){if(D===null)throw new Error(e);if(u&&D.constructor===ArrayBuffer)D=new Uint8Array(D);else if(!Array.isArray(D)&&(!u||!ArrayBuffer.isView(D)))throw new Error(e)}else throw new Error(e);se=!0}for(var J=this.blocks,Q=this.byteCount,T=D.length,X=this.blockCount,re=0,ge=this.s,oe,fe;re>2]|=D[re]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(J[oe>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=Q){for(this.start=oe-Q,this.block=J[X],oe=0;oe>8,ee=D&255;ee>0;)Q.unshift(ee),D=D>>8,ee=D&255,++J;return se?Q.push(J):Q.unshift(J),this.update(Q),Q.length},I.prototype.encodeString=function(D){var se,ee=typeof D;if(ee!=="string"){if(ee==="object"){if(D===null)throw new Error(e);if(u&&D.constructor===ArrayBuffer)D=new Uint8Array(D);else if(!Array.isArray(D)&&(!u||!ArrayBuffer.isView(D)))throw new Error(e)}else throw new Error(e);se=!0}var J=0,Q=D.length;if(se)J=Q;else for(var T=0;T=57344?J+=3:(X=65536+((X&1023)<<10|D.charCodeAt(++T)&1023),J+=4)}return J+=this.encode(J*8),this.update(D),J},I.prototype.bytepad=function(D,se){for(var ee=this.encode(se),J=0;J>2]|=this.padding[se&3],this.lastByteIndex===this.byteCount)for(D[0]=D[ee],se=1;se>4&15]+l[re&15]+l[re>>12&15]+l[re>>8&15]+l[re>>20&15]+l[re>>16&15]+l[re>>28&15]+l[re>>24&15];T%D===0&&(ce(se),Q=0)}return J&&(re=se[Q],X+=l[re>>4&15]+l[re&15],J>1&&(X+=l[re>>12&15]+l[re>>8&15]),J>2&&(X+=l[re>>20&15]+l[re>>16&15])),X},I.prototype.arrayBuffer=function(){this.finalize();var D=this.blockCount,se=this.s,ee=this.outputBlocks,J=this.extraBytes,Q=0,T=0,X=this.outputBits>>3,re;J?re=new ArrayBuffer(ee+1<<2):re=new ArrayBuffer(X);for(var ge=new Uint32Array(re);T>8&255,X[re+2]=ge>>16&255,X[re+3]=ge>>24&255;T%D===0&&ce(se)}return J&&(re=T<<2,ge=se[Q],X[re]=ge&255,J>1&&(X[re+1]=ge>>8&255),J>2&&(X[re+2]=ge>>16&255)),X};function F(D,se,ee){I.call(this,D,se,ee)}F.prototype=new I,F.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var ce=function(D){var se,ee,J,Q,T,X,re,ge,oe,fe,be,Me,Ne,Te,$e,Ie,Le,Ve,ke,ze,He,Se,Qe,ct,Be,et,rt,Je,gt,ht,ft,Ht,Jt,St,er,Xt,Ot,Bt,Tt,bt,Dt,Lt,yt,$t,jt,nt,Ft,$,K,G,C,Y,q,ae,pe,_e,Re,De,it,Ue,mt,st,tt;for(J=0;J<48;J+=2)Q=D[0]^D[10]^D[20]^D[30]^D[40],T=D[1]^D[11]^D[21]^D[31]^D[41],X=D[2]^D[12]^D[22]^D[32]^D[42],re=D[3]^D[13]^D[23]^D[33]^D[43],ge=D[4]^D[14]^D[24]^D[34]^D[44],oe=D[5]^D[15]^D[25]^D[35]^D[45],fe=D[6]^D[16]^D[26]^D[36]^D[46],be=D[7]^D[17]^D[27]^D[37]^D[47],Me=D[8]^D[18]^D[28]^D[38]^D[48],Ne=D[9]^D[19]^D[29]^D[39]^D[49],se=Me^(X<<1|re>>>31),ee=Ne^(re<<1|X>>>31),D[0]^=se,D[1]^=ee,D[10]^=se,D[11]^=ee,D[20]^=se,D[21]^=ee,D[30]^=se,D[31]^=ee,D[40]^=se,D[41]^=ee,se=Q^(ge<<1|oe>>>31),ee=T^(oe<<1|ge>>>31),D[2]^=se,D[3]^=ee,D[12]^=se,D[13]^=ee,D[22]^=se,D[23]^=ee,D[32]^=se,D[33]^=ee,D[42]^=se,D[43]^=ee,se=X^(fe<<1|be>>>31),ee=re^(be<<1|fe>>>31),D[4]^=se,D[5]^=ee,D[14]^=se,D[15]^=ee,D[24]^=se,D[25]^=ee,D[34]^=se,D[35]^=ee,D[44]^=se,D[45]^=ee,se=ge^(Me<<1|Ne>>>31),ee=oe^(Ne<<1|Me>>>31),D[6]^=se,D[7]^=ee,D[16]^=se,D[17]^=ee,D[26]^=se,D[27]^=ee,D[36]^=se,D[37]^=ee,D[46]^=se,D[47]^=ee,se=fe^(Q<<1|T>>>31),ee=be^(T<<1|Q>>>31),D[8]^=se,D[9]^=ee,D[18]^=se,D[19]^=ee,D[28]^=se,D[29]^=ee,D[38]^=se,D[39]^=ee,D[48]^=se,D[49]^=ee,Te=D[0],$e=D[1],nt=D[11]<<4|D[10]>>>28,Ft=D[10]<<4|D[11]>>>28,Je=D[20]<<3|D[21]>>>29,gt=D[21]<<3|D[20]>>>29,Ue=D[31]<<9|D[30]>>>23,mt=D[30]<<9|D[31]>>>23,Lt=D[40]<<18|D[41]>>>14,yt=D[41]<<18|D[40]>>>14,St=D[2]<<1|D[3]>>>31,er=D[3]<<1|D[2]>>>31,Ie=D[13]<<12|D[12]>>>20,Le=D[12]<<12|D[13]>>>20,$=D[22]<<10|D[23]>>>22,K=D[23]<<10|D[22]>>>22,ht=D[33]<<13|D[32]>>>19,ft=D[32]<<13|D[33]>>>19,st=D[42]<<2|D[43]>>>30,tt=D[43]<<2|D[42]>>>30,ae=D[5]<<30|D[4]>>>2,pe=D[4]<<30|D[5]>>>2,Xt=D[14]<<6|D[15]>>>26,Ot=D[15]<<6|D[14]>>>26,Ve=D[25]<<11|D[24]>>>21,ke=D[24]<<11|D[25]>>>21,G=D[34]<<15|D[35]>>>17,C=D[35]<<15|D[34]>>>17,Ht=D[45]<<29|D[44]>>>3,Jt=D[44]<<29|D[45]>>>3,ct=D[6]<<28|D[7]>>>4,Be=D[7]<<28|D[6]>>>4,_e=D[17]<<23|D[16]>>>9,Re=D[16]<<23|D[17]>>>9,Bt=D[26]<<25|D[27]>>>7,Tt=D[27]<<25|D[26]>>>7,ze=D[36]<<21|D[37]>>>11,He=D[37]<<21|D[36]>>>11,Y=D[47]<<24|D[46]>>>8,q=D[46]<<24|D[47]>>>8,$t=D[8]<<27|D[9]>>>5,jt=D[9]<<27|D[8]>>>5,et=D[18]<<20|D[19]>>>12,rt=D[19]<<20|D[18]>>>12,De=D[29]<<7|D[28]>>>25,it=D[28]<<7|D[29]>>>25,bt=D[38]<<8|D[39]>>>24,Dt=D[39]<<8|D[38]>>>24,Se=D[48]<<14|D[49]>>>18,Qe=D[49]<<14|D[48]>>>18,D[0]=Te^~Ie&Ve,D[1]=$e^~Le&ke,D[10]=ct^~et&Je,D[11]=Be^~rt>,D[20]=St^~Xt&Bt,D[21]=er^~Ot&Tt,D[30]=$t^~nt&$,D[31]=jt^~Ft&K,D[40]=ae^~_e&De,D[41]=pe^~Re&it,D[2]=Ie^~Ve&ze,D[3]=Le^~ke&He,D[12]=et^~Je&ht,D[13]=rt^~gt&ft,D[22]=Xt^~Bt&bt,D[23]=Ot^~Tt&Dt,D[32]=nt^~$&G,D[33]=Ft^~K&C,D[42]=_e^~De&Ue,D[43]=Re^~it&mt,D[4]=Ve^~ze&Se,D[5]=ke^~He&Qe,D[14]=Je^~ht&Ht,D[15]=gt^~ft&Jt,D[24]=Bt^~bt&Lt,D[25]=Tt^~Dt&yt,D[34]=$^~G&Y,D[35]=K^~C&q,D[44]=De^~Ue&st,D[45]=it^~mt&tt,D[6]=ze^~Se&Te,D[7]=He^~Qe&$e,D[16]=ht^~Ht&ct,D[17]=ft^~Jt&Be,D[26]=bt^~Lt&St,D[27]=Dt^~yt&er,D[36]=G^~Y&$t,D[37]=C^~q&jt,D[46]=Ue^~st&ae,D[47]=mt^~tt&pe,D[8]=Se^~Te&Ie,D[9]=Qe^~$e&Le,D[18]=Ht^~ct&et,D[19]=Jt^~Be&rt,D[28]=Lt^~St&Xt,D[29]=yt^~er&Ot,D[38]=Y^~$t&nt,D[39]=q^~jt&Ft,D[48]=st^~ae&_e,D[49]=tt^~pe&Re,D[0]^=O[J],D[1]^=O[J+1]};if(a)t.exports=f;else for(v=0;v{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const f3=VN();var Cm;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(Cm||(Cm={}));var vs;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(vs||(vs={}));const l3="0123456789abcdef";class Kr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();Cd[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(u3>Cd[n])&&console.log.apply(console,r)}debug(...e){this._log(Kr.levels.DEBUG,e)}info(...e){this._log(Kr.levels.INFO,e)}warn(...e){this._log(Kr.levels.WARNING,e)}makeError(e,r,n){if(c3)return this.makeError("censored error",r,{});r||(r=Kr.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(u=>{const l=n[u];try{if(l instanceof Uint8Array){let d="";for(let p=0;p>4],d+=l3[l[p]&15];i.push(u+"=Uint8Array(0x"+d+")")}else i.push(u+"="+JSON.stringify(l))}catch{i.push(u+"="+JSON.stringify(n[u].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case vs.NUMERIC_FAULT:{o="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case vs.CALL_EXCEPTION:case vs.INSUFFICIENT_FUNDS:case vs.MISSING_NEW:case vs.NONCE_EXPIRED:case vs.REPLACEMENT_UNDERPRICED:case vs.TRANSACTION_REPLACED:case vs.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(u){a[u]=n[u]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Kr.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){f3&&this.throwError("platform missing String.prototype.normalize",Kr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:f3})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Kr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Kr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return Im||(Im=new Kr(KN)),Im}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),a3){if(!e)return;this.globalLogger().throwError("error censorship permanent",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}c3=!!e,a3=!!r}static setLogLevel(e){const r=Cd[e.toLowerCase()];if(r==null){Kr.globalLogger().warn("invalid log level - "+e);return}u3=r}static from(e){return new Kr(e)}}Kr.errors=vs,Kr.levels=Cm;const GN="bytes/5.7.0",sn=new Kr(GN);function h3(t){return!!t.toHexString}function fu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return fu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function YN(t){return $s(t)&&!(t.length%2)||Tm(t)}function d3(t){return typeof t=="number"&&t==t&&t%1===0}function Tm(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!d3(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function bn(t,e){if(e||(e={}),typeof t=="number"){sn.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),fu(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),h3(t)&&(t=t.toHexString()),$s(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":sn.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ibn(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),fu(n)}function XN(t,e){t=bn(t),t.length>e&&sn.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),fu(r)}function $s(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Rm="0123456789abcdef";function Ii(t,e){if(e||(e={}),typeof t=="number"){sn.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=Rm[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),h3(t))return t.toHexString();if($s(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":sn.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Tm(t)){let r="0x";for(let n=0;n>4]+Rm[i&15]}return r}return sn.throwArgumentError("invalid hexlify value","value",t)}function ZN(t){if(typeof t!="string")t=Ii(t);else if(!$s(t)||t.length%2)return null;return(t.length-2)/2}function p3(t,e,r){return typeof t!="string"?t=Ii(t):(!$s(t)||t.length%2)&&sn.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function lu(t,e){for(typeof t!="string"?t=Ii(t):$s(t)||sn.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&sn.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function g3(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(YN(t)){let r=bn(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64))):r.length===65?(e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64)),e.v=r[64]):sn.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:sn.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Ii(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=XN(bn(e._vs),32);e._vs=Ii(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&sn.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=Ii(i);e.s==null?e.s=o:e.s!==o&&sn.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?sn.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&sn.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!$s(e.r)?sn.throwArgumentError("signature missing or invalid r","signature",t):e.r=lu(e.r,32),e.s==null||!$s(e.s)?sn.throwArgumentError("signature missing or invalid s","signature",t):e.s=lu(e.s,32);const r=bn(e.s);r[0]>=128&&sn.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=Ii(r);e._vs&&($s(e._vs)||sn.throwArgumentError("signature invalid _vs","signature",t),e._vs=lu(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&sn.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Dm(t){return"0x"+WN.keccak_256(bn(t))}var Om={exports:{}};Om.exports,function(t){(function(e,r){function n(m,f){if(!m)throw new Error(f||"Assertion failed")}function i(m,f){m.super_=f;var g=function(){};g.prototype=f.prototype,m.prototype=new g,m.prototype.constructor=m}function s(m,f,g){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((f==="le"||f==="be")&&(g=f,f=10),this._init(m||0,f||10,g||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=il.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,g){return f.cmp(g)>0?f:g},s.min=function(f,g){return f.cmp(g)<0?f:g},s.prototype._init=function(f,g,v){if(typeof f=="number")return this._initNumber(f,g,v);if(typeof f=="object")return this._initArray(f,g,v);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),f=f.toString().replace(/\s+/g,"");var x=0;f[0]==="-"&&(x++,this.negative=1),x=0;x-=3)A=f[x]|f[x-1]<<8|f[x-2]<<16,this.words[S]|=A<>>26-b&67108863,b+=24,b>=26&&(b-=26,S++);else if(v==="le")for(x=0,S=0;x>>26-b&67108863,b+=24,b>=26&&(b-=26,S++);return this._strip()};function a(m,f){var g=m.charCodeAt(f);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+m)}function u(m,f,g){var v=a(m,g);return g-1>=f&&(v|=a(m,g-1)<<4),v}s.prototype._parseHex=function(f,g,v){this.length=Math.ceil((f.length-g)/6),this.words=new Array(this.length);for(var x=0;x=g;x-=2)b=u(f,g,x)<=18?(S-=18,A+=1,this.words[A]|=b>>>26):S+=8;else{var P=f.length-g;for(x=P%2===0?g+1:g;x=18?(S-=18,A+=1,this.words[A]|=b>>>26):S+=8}this._strip()};function l(m,f,g,v){for(var x=0,S=0,A=Math.min(m.length,g),b=f;b=49?S=P-49+10:P>=17?S=P-17+10:S=P,n(P>=0&&S1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{s.prototype.inspect=p}else s.prototype.inspect=p;function p(){return(this.red?""}var y=["","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"],_=[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],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(f,g){f=f||10,g=g|0||1;var v;if(f===16||f==="hex"){v="";for(var x=0,S=0,A=0;A>>24-x&16777215,x+=2,x>=26&&(x-=26,A--),S!==0||A!==this.length-1?v=y[6-P.length]+P+v:v=P+v}for(S!==0&&(v=S.toString(16)+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(f===(f|0)&&f>=2&&f<=36){var I=_[f],F=M[f];v="";var ce=this.clone();for(ce.negative=0;!ce.isZero();){var D=ce.modrn(F).toString(f);ce=ce.idivn(F),ce.isZero()?v=D+v:v=y[I-D.length]+D+v}for(this.isZero()&&(v="0"+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,g){return this.toArrayLike(o,f,g)}),s.prototype.toArray=function(f,g){return this.toArrayLike(Array,f,g)};var O=function(f,g){return f.allocUnsafe?f.allocUnsafe(g):new f(g)};s.prototype.toArrayLike=function(f,g,v){this._strip();var x=this.byteLength(),S=v||Math.max(1,x);n(x<=S,"byte array longer than desired length"),n(S>0,"Requested array length <= 0");var A=O(f,S),b=g==="le"?"LE":"BE";return this["_toArrayLike"+b](A,x),A},s.prototype._toArrayLikeLE=function(f,g){for(var v=0,x=0,S=0,A=0;S>8&255),v>16&255),A===6?(v>24&255),x=0,A=0):(x=b>>>24,A+=2)}if(v=0&&(f[v--]=b>>8&255),v>=0&&(f[v--]=b>>16&255),A===6?(v>=0&&(f[v--]=b>>24&255),x=0,A=0):(x=b>>>24,A+=2)}if(v>=0)for(f[v--]=x;v>=0;)f[v--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var g=f,v=0;return g>=4096&&(v+=13,g>>>=13),g>=64&&(v+=7,g>>>=7),g>=8&&(v+=4,g>>>=4),g>=2&&(v+=2,g>>>=2),v+g},s.prototype._zeroBits=function(f){if(f===0)return 26;var g=f,v=0;return g&8191||(v+=13,g>>>=13),g&127||(v+=7,g>>>=7),g&15||(v+=4,g>>>=4),g&3||(v+=2,g>>>=2),g&1||v++,v},s.prototype.bitLength=function(){var f=this.words[this.length-1],g=this._countBits(f);return(this.length-1)*26+g};function L(m){for(var f=new Array(m.bitLength()),g=0;g>>x&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,g=0;gf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var g;this.length>f.length?g=f:g=this;for(var v=0;vf.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var g,v;this.length>f.length?(g=this,v=f):(g=f,v=this);for(var x=0;xf.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var g=Math.ceil(f/26)|0,v=f%26;this._expand(g),v>0&&g--;for(var x=0;x0&&(this.words[x]=~this.words[x]&67108863>>26-v),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,g){n(typeof f=="number"&&f>=0);var v=f/26|0,x=f%26;return this._expand(v+1),g?this.words[v]=this.words[v]|1<f.length?(v=this,x=f):(v=f,x=this);for(var S=0,A=0;A>>26;for(;S!==0&&A>>26;if(this.length=v.length,S!==0)this.words[this.length]=S,this.length++;else if(v!==this)for(;Af.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var g=this.iadd(f);return f.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var v=this.cmp(f);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,S;v>0?(x=this,S=f):(x=f,S=this);for(var A=0,b=0;b>26,this.words[b]=g&67108863;for(;A!==0&&b>26,this.words[b]=g&67108863;if(A===0&&b>>26,ce=P&67108863,D=Math.min(I,f.length-1),se=Math.max(0,I-m.length+1);se<=D;se++){var ee=I-se|0;x=m.words[ee]|0,S=f.words[se]|0,A=x*S+ce,F+=A/67108864|0,ce=A&67108863}g.words[I]=ce|0,P=F|0}return P!==0?g.words[I]=P|0:g.length--,g._strip()}var k=function(f,g,v){var x=f.words,S=g.words,A=v.words,b=0,P,I,F,ce=x[0]|0,D=ce&8191,se=ce>>>13,ee=x[1]|0,J=ee&8191,Q=ee>>>13,T=x[2]|0,X=T&8191,re=T>>>13,ge=x[3]|0,oe=ge&8191,fe=ge>>>13,be=x[4]|0,Me=be&8191,Ne=be>>>13,Te=x[5]|0,$e=Te&8191,Ie=Te>>>13,Le=x[6]|0,Ve=Le&8191,ke=Le>>>13,ze=x[7]|0,He=ze&8191,Se=ze>>>13,Qe=x[8]|0,ct=Qe&8191,Be=Qe>>>13,et=x[9]|0,rt=et&8191,Je=et>>>13,gt=S[0]|0,ht=gt&8191,ft=gt>>>13,Ht=S[1]|0,Jt=Ht&8191,St=Ht>>>13,er=S[2]|0,Xt=er&8191,Ot=er>>>13,Bt=S[3]|0,Tt=Bt&8191,bt=Bt>>>13,Dt=S[4]|0,Lt=Dt&8191,yt=Dt>>>13,$t=S[5]|0,jt=$t&8191,nt=$t>>>13,Ft=S[6]|0,$=Ft&8191,K=Ft>>>13,G=S[7]|0,C=G&8191,Y=G>>>13,q=S[8]|0,ae=q&8191,pe=q>>>13,_e=S[9]|0,Re=_e&8191,De=_e>>>13;v.negative=f.negative^g.negative,v.length=19,P=Math.imul(D,ht),I=Math.imul(D,ft),I=I+Math.imul(se,ht)|0,F=Math.imul(se,ft);var it=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(it>>>26)|0,it&=67108863,P=Math.imul(J,ht),I=Math.imul(J,ft),I=I+Math.imul(Q,ht)|0,F=Math.imul(Q,ft),P=P+Math.imul(D,Jt)|0,I=I+Math.imul(D,St)|0,I=I+Math.imul(se,Jt)|0,F=F+Math.imul(se,St)|0;var Ue=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,P=Math.imul(X,ht),I=Math.imul(X,ft),I=I+Math.imul(re,ht)|0,F=Math.imul(re,ft),P=P+Math.imul(J,Jt)|0,I=I+Math.imul(J,St)|0,I=I+Math.imul(Q,Jt)|0,F=F+Math.imul(Q,St)|0,P=P+Math.imul(D,Xt)|0,I=I+Math.imul(D,Ot)|0,I=I+Math.imul(se,Xt)|0,F=F+Math.imul(se,Ot)|0;var mt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(mt>>>26)|0,mt&=67108863,P=Math.imul(oe,ht),I=Math.imul(oe,ft),I=I+Math.imul(fe,ht)|0,F=Math.imul(fe,ft),P=P+Math.imul(X,Jt)|0,I=I+Math.imul(X,St)|0,I=I+Math.imul(re,Jt)|0,F=F+Math.imul(re,St)|0,P=P+Math.imul(J,Xt)|0,I=I+Math.imul(J,Ot)|0,I=I+Math.imul(Q,Xt)|0,F=F+Math.imul(Q,Ot)|0,P=P+Math.imul(D,Tt)|0,I=I+Math.imul(D,bt)|0,I=I+Math.imul(se,Tt)|0,F=F+Math.imul(se,bt)|0;var st=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(st>>>26)|0,st&=67108863,P=Math.imul(Me,ht),I=Math.imul(Me,ft),I=I+Math.imul(Ne,ht)|0,F=Math.imul(Ne,ft),P=P+Math.imul(oe,Jt)|0,I=I+Math.imul(oe,St)|0,I=I+Math.imul(fe,Jt)|0,F=F+Math.imul(fe,St)|0,P=P+Math.imul(X,Xt)|0,I=I+Math.imul(X,Ot)|0,I=I+Math.imul(re,Xt)|0,F=F+Math.imul(re,Ot)|0,P=P+Math.imul(J,Tt)|0,I=I+Math.imul(J,bt)|0,I=I+Math.imul(Q,Tt)|0,F=F+Math.imul(Q,bt)|0,P=P+Math.imul(D,Lt)|0,I=I+Math.imul(D,yt)|0,I=I+Math.imul(se,Lt)|0,F=F+Math.imul(se,yt)|0;var tt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(tt>>>26)|0,tt&=67108863,P=Math.imul($e,ht),I=Math.imul($e,ft),I=I+Math.imul(Ie,ht)|0,F=Math.imul(Ie,ft),P=P+Math.imul(Me,Jt)|0,I=I+Math.imul(Me,St)|0,I=I+Math.imul(Ne,Jt)|0,F=F+Math.imul(Ne,St)|0,P=P+Math.imul(oe,Xt)|0,I=I+Math.imul(oe,Ot)|0,I=I+Math.imul(fe,Xt)|0,F=F+Math.imul(fe,Ot)|0,P=P+Math.imul(X,Tt)|0,I=I+Math.imul(X,bt)|0,I=I+Math.imul(re,Tt)|0,F=F+Math.imul(re,bt)|0,P=P+Math.imul(J,Lt)|0,I=I+Math.imul(J,yt)|0,I=I+Math.imul(Q,Lt)|0,F=F+Math.imul(Q,yt)|0,P=P+Math.imul(D,jt)|0,I=I+Math.imul(D,nt)|0,I=I+Math.imul(se,jt)|0,F=F+Math.imul(se,nt)|0;var At=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(At>>>26)|0,At&=67108863,P=Math.imul(Ve,ht),I=Math.imul(Ve,ft),I=I+Math.imul(ke,ht)|0,F=Math.imul(ke,ft),P=P+Math.imul($e,Jt)|0,I=I+Math.imul($e,St)|0,I=I+Math.imul(Ie,Jt)|0,F=F+Math.imul(Ie,St)|0,P=P+Math.imul(Me,Xt)|0,I=I+Math.imul(Me,Ot)|0,I=I+Math.imul(Ne,Xt)|0,F=F+Math.imul(Ne,Ot)|0,P=P+Math.imul(oe,Tt)|0,I=I+Math.imul(oe,bt)|0,I=I+Math.imul(fe,Tt)|0,F=F+Math.imul(fe,bt)|0,P=P+Math.imul(X,Lt)|0,I=I+Math.imul(X,yt)|0,I=I+Math.imul(re,Lt)|0,F=F+Math.imul(re,yt)|0,P=P+Math.imul(J,jt)|0,I=I+Math.imul(J,nt)|0,I=I+Math.imul(Q,jt)|0,F=F+Math.imul(Q,nt)|0,P=P+Math.imul(D,$)|0,I=I+Math.imul(D,K)|0,I=I+Math.imul(se,$)|0,F=F+Math.imul(se,K)|0;var Rt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,P=Math.imul(He,ht),I=Math.imul(He,ft),I=I+Math.imul(Se,ht)|0,F=Math.imul(Se,ft),P=P+Math.imul(Ve,Jt)|0,I=I+Math.imul(Ve,St)|0,I=I+Math.imul(ke,Jt)|0,F=F+Math.imul(ke,St)|0,P=P+Math.imul($e,Xt)|0,I=I+Math.imul($e,Ot)|0,I=I+Math.imul(Ie,Xt)|0,F=F+Math.imul(Ie,Ot)|0,P=P+Math.imul(Me,Tt)|0,I=I+Math.imul(Me,bt)|0,I=I+Math.imul(Ne,Tt)|0,F=F+Math.imul(Ne,bt)|0,P=P+Math.imul(oe,Lt)|0,I=I+Math.imul(oe,yt)|0,I=I+Math.imul(fe,Lt)|0,F=F+Math.imul(fe,yt)|0,P=P+Math.imul(X,jt)|0,I=I+Math.imul(X,nt)|0,I=I+Math.imul(re,jt)|0,F=F+Math.imul(re,nt)|0,P=P+Math.imul(J,$)|0,I=I+Math.imul(J,K)|0,I=I+Math.imul(Q,$)|0,F=F+Math.imul(Q,K)|0,P=P+Math.imul(D,C)|0,I=I+Math.imul(D,Y)|0,I=I+Math.imul(se,C)|0,F=F+Math.imul(se,Y)|0;var Mt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,P=Math.imul(ct,ht),I=Math.imul(ct,ft),I=I+Math.imul(Be,ht)|0,F=Math.imul(Be,ft),P=P+Math.imul(He,Jt)|0,I=I+Math.imul(He,St)|0,I=I+Math.imul(Se,Jt)|0,F=F+Math.imul(Se,St)|0,P=P+Math.imul(Ve,Xt)|0,I=I+Math.imul(Ve,Ot)|0,I=I+Math.imul(ke,Xt)|0,F=F+Math.imul(ke,Ot)|0,P=P+Math.imul($e,Tt)|0,I=I+Math.imul($e,bt)|0,I=I+Math.imul(Ie,Tt)|0,F=F+Math.imul(Ie,bt)|0,P=P+Math.imul(Me,Lt)|0,I=I+Math.imul(Me,yt)|0,I=I+Math.imul(Ne,Lt)|0,F=F+Math.imul(Ne,yt)|0,P=P+Math.imul(oe,jt)|0,I=I+Math.imul(oe,nt)|0,I=I+Math.imul(fe,jt)|0,F=F+Math.imul(fe,nt)|0,P=P+Math.imul(X,$)|0,I=I+Math.imul(X,K)|0,I=I+Math.imul(re,$)|0,F=F+Math.imul(re,K)|0,P=P+Math.imul(J,C)|0,I=I+Math.imul(J,Y)|0,I=I+Math.imul(Q,C)|0,F=F+Math.imul(Q,Y)|0,P=P+Math.imul(D,ae)|0,I=I+Math.imul(D,pe)|0,I=I+Math.imul(se,ae)|0,F=F+Math.imul(se,pe)|0;var Et=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Et>>>26)|0,Et&=67108863,P=Math.imul(rt,ht),I=Math.imul(rt,ft),I=I+Math.imul(Je,ht)|0,F=Math.imul(Je,ft),P=P+Math.imul(ct,Jt)|0,I=I+Math.imul(ct,St)|0,I=I+Math.imul(Be,Jt)|0,F=F+Math.imul(Be,St)|0,P=P+Math.imul(He,Xt)|0,I=I+Math.imul(He,Ot)|0,I=I+Math.imul(Se,Xt)|0,F=F+Math.imul(Se,Ot)|0,P=P+Math.imul(Ve,Tt)|0,I=I+Math.imul(Ve,bt)|0,I=I+Math.imul(ke,Tt)|0,F=F+Math.imul(ke,bt)|0,P=P+Math.imul($e,Lt)|0,I=I+Math.imul($e,yt)|0,I=I+Math.imul(Ie,Lt)|0,F=F+Math.imul(Ie,yt)|0,P=P+Math.imul(Me,jt)|0,I=I+Math.imul(Me,nt)|0,I=I+Math.imul(Ne,jt)|0,F=F+Math.imul(Ne,nt)|0,P=P+Math.imul(oe,$)|0,I=I+Math.imul(oe,K)|0,I=I+Math.imul(fe,$)|0,F=F+Math.imul(fe,K)|0,P=P+Math.imul(X,C)|0,I=I+Math.imul(X,Y)|0,I=I+Math.imul(re,C)|0,F=F+Math.imul(re,Y)|0,P=P+Math.imul(J,ae)|0,I=I+Math.imul(J,pe)|0,I=I+Math.imul(Q,ae)|0,F=F+Math.imul(Q,pe)|0,P=P+Math.imul(D,Re)|0,I=I+Math.imul(D,De)|0,I=I+Math.imul(se,Re)|0,F=F+Math.imul(se,De)|0;var dt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(dt>>>26)|0,dt&=67108863,P=Math.imul(rt,Jt),I=Math.imul(rt,St),I=I+Math.imul(Je,Jt)|0,F=Math.imul(Je,St),P=P+Math.imul(ct,Xt)|0,I=I+Math.imul(ct,Ot)|0,I=I+Math.imul(Be,Xt)|0,F=F+Math.imul(Be,Ot)|0,P=P+Math.imul(He,Tt)|0,I=I+Math.imul(He,bt)|0,I=I+Math.imul(Se,Tt)|0,F=F+Math.imul(Se,bt)|0,P=P+Math.imul(Ve,Lt)|0,I=I+Math.imul(Ve,yt)|0,I=I+Math.imul(ke,Lt)|0,F=F+Math.imul(ke,yt)|0,P=P+Math.imul($e,jt)|0,I=I+Math.imul($e,nt)|0,I=I+Math.imul(Ie,jt)|0,F=F+Math.imul(Ie,nt)|0,P=P+Math.imul(Me,$)|0,I=I+Math.imul(Me,K)|0,I=I+Math.imul(Ne,$)|0,F=F+Math.imul(Ne,K)|0,P=P+Math.imul(oe,C)|0,I=I+Math.imul(oe,Y)|0,I=I+Math.imul(fe,C)|0,F=F+Math.imul(fe,Y)|0,P=P+Math.imul(X,ae)|0,I=I+Math.imul(X,pe)|0,I=I+Math.imul(re,ae)|0,F=F+Math.imul(re,pe)|0,P=P+Math.imul(J,Re)|0,I=I+Math.imul(J,De)|0,I=I+Math.imul(Q,Re)|0,F=F+Math.imul(Q,De)|0;var _t=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(_t>>>26)|0,_t&=67108863,P=Math.imul(rt,Xt),I=Math.imul(rt,Ot),I=I+Math.imul(Je,Xt)|0,F=Math.imul(Je,Ot),P=P+Math.imul(ct,Tt)|0,I=I+Math.imul(ct,bt)|0,I=I+Math.imul(Be,Tt)|0,F=F+Math.imul(Be,bt)|0,P=P+Math.imul(He,Lt)|0,I=I+Math.imul(He,yt)|0,I=I+Math.imul(Se,Lt)|0,F=F+Math.imul(Se,yt)|0,P=P+Math.imul(Ve,jt)|0,I=I+Math.imul(Ve,nt)|0,I=I+Math.imul(ke,jt)|0,F=F+Math.imul(ke,nt)|0,P=P+Math.imul($e,$)|0,I=I+Math.imul($e,K)|0,I=I+Math.imul(Ie,$)|0,F=F+Math.imul(Ie,K)|0,P=P+Math.imul(Me,C)|0,I=I+Math.imul(Me,Y)|0,I=I+Math.imul(Ne,C)|0,F=F+Math.imul(Ne,Y)|0,P=P+Math.imul(oe,ae)|0,I=I+Math.imul(oe,pe)|0,I=I+Math.imul(fe,ae)|0,F=F+Math.imul(fe,pe)|0,P=P+Math.imul(X,Re)|0,I=I+Math.imul(X,De)|0,I=I+Math.imul(re,Re)|0,F=F+Math.imul(re,De)|0;var ot=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(ot>>>26)|0,ot&=67108863,P=Math.imul(rt,Tt),I=Math.imul(rt,bt),I=I+Math.imul(Je,Tt)|0,F=Math.imul(Je,bt),P=P+Math.imul(ct,Lt)|0,I=I+Math.imul(ct,yt)|0,I=I+Math.imul(Be,Lt)|0,F=F+Math.imul(Be,yt)|0,P=P+Math.imul(He,jt)|0,I=I+Math.imul(He,nt)|0,I=I+Math.imul(Se,jt)|0,F=F+Math.imul(Se,nt)|0,P=P+Math.imul(Ve,$)|0,I=I+Math.imul(Ve,K)|0,I=I+Math.imul(ke,$)|0,F=F+Math.imul(ke,K)|0,P=P+Math.imul($e,C)|0,I=I+Math.imul($e,Y)|0,I=I+Math.imul(Ie,C)|0,F=F+Math.imul(Ie,Y)|0,P=P+Math.imul(Me,ae)|0,I=I+Math.imul(Me,pe)|0,I=I+Math.imul(Ne,ae)|0,F=F+Math.imul(Ne,pe)|0,P=P+Math.imul(oe,Re)|0,I=I+Math.imul(oe,De)|0,I=I+Math.imul(fe,Re)|0,F=F+Math.imul(fe,De)|0;var wt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(wt>>>26)|0,wt&=67108863,P=Math.imul(rt,Lt),I=Math.imul(rt,yt),I=I+Math.imul(Je,Lt)|0,F=Math.imul(Je,yt),P=P+Math.imul(ct,jt)|0,I=I+Math.imul(ct,nt)|0,I=I+Math.imul(Be,jt)|0,F=F+Math.imul(Be,nt)|0,P=P+Math.imul(He,$)|0,I=I+Math.imul(He,K)|0,I=I+Math.imul(Se,$)|0,F=F+Math.imul(Se,K)|0,P=P+Math.imul(Ve,C)|0,I=I+Math.imul(Ve,Y)|0,I=I+Math.imul(ke,C)|0,F=F+Math.imul(ke,Y)|0,P=P+Math.imul($e,ae)|0,I=I+Math.imul($e,pe)|0,I=I+Math.imul(Ie,ae)|0,F=F+Math.imul(Ie,pe)|0,P=P+Math.imul(Me,Re)|0,I=I+Math.imul(Me,De)|0,I=I+Math.imul(Ne,Re)|0,F=F+Math.imul(Ne,De)|0;var lt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(lt>>>26)|0,lt&=67108863,P=Math.imul(rt,jt),I=Math.imul(rt,nt),I=I+Math.imul(Je,jt)|0,F=Math.imul(Je,nt),P=P+Math.imul(ct,$)|0,I=I+Math.imul(ct,K)|0,I=I+Math.imul(Be,$)|0,F=F+Math.imul(Be,K)|0,P=P+Math.imul(He,C)|0,I=I+Math.imul(He,Y)|0,I=I+Math.imul(Se,C)|0,F=F+Math.imul(Se,Y)|0,P=P+Math.imul(Ve,ae)|0,I=I+Math.imul(Ve,pe)|0,I=I+Math.imul(ke,ae)|0,F=F+Math.imul(ke,pe)|0,P=P+Math.imul($e,Re)|0,I=I+Math.imul($e,De)|0,I=I+Math.imul(Ie,Re)|0,F=F+Math.imul(Ie,De)|0;var at=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(at>>>26)|0,at&=67108863,P=Math.imul(rt,$),I=Math.imul(rt,K),I=I+Math.imul(Je,$)|0,F=Math.imul(Je,K),P=P+Math.imul(ct,C)|0,I=I+Math.imul(ct,Y)|0,I=I+Math.imul(Be,C)|0,F=F+Math.imul(Be,Y)|0,P=P+Math.imul(He,ae)|0,I=I+Math.imul(He,pe)|0,I=I+Math.imul(Se,ae)|0,F=F+Math.imul(Se,pe)|0,P=P+Math.imul(Ve,Re)|0,I=I+Math.imul(Ve,De)|0,I=I+Math.imul(ke,Re)|0,F=F+Math.imul(ke,De)|0;var Ae=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,P=Math.imul(rt,C),I=Math.imul(rt,Y),I=I+Math.imul(Je,C)|0,F=Math.imul(Je,Y),P=P+Math.imul(ct,ae)|0,I=I+Math.imul(ct,pe)|0,I=I+Math.imul(Be,ae)|0,F=F+Math.imul(Be,pe)|0,P=P+Math.imul(He,Re)|0,I=I+Math.imul(He,De)|0,I=I+Math.imul(Se,Re)|0,F=F+Math.imul(Se,De)|0;var Pe=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,P=Math.imul(rt,ae),I=Math.imul(rt,pe),I=I+Math.imul(Je,ae)|0,F=Math.imul(Je,pe),P=P+Math.imul(ct,Re)|0,I=I+Math.imul(ct,De)|0,I=I+Math.imul(Be,Re)|0,F=F+Math.imul(Be,De)|0;var Ge=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,P=Math.imul(rt,Re),I=Math.imul(rt,De),I=I+Math.imul(Je,Re)|0,F=Math.imul(Je,De);var je=(b+P|0)+((I&8191)<<13)|0;return b=(F+(I>>>13)|0)+(je>>>26)|0,je&=67108863,A[0]=it,A[1]=Ue,A[2]=mt,A[3]=st,A[4]=tt,A[5]=At,A[6]=Rt,A[7]=Mt,A[8]=Et,A[9]=dt,A[10]=_t,A[11]=ot,A[12]=wt,A[13]=lt,A[14]=at,A[15]=Ae,A[16]=Pe,A[17]=Ge,A[18]=je,b!==0&&(A[19]=b,v.length++),v};Math.imul||(k=B);function H(m,f,g){g.negative=f.negative^m.negative,g.length=m.length+f.length;for(var v=0,x=0,S=0;S>>26)|0,x+=A>>>26,A&=67108863}g.words[S]=b,v=A,A=x}return v!==0?g.words[S]=v:g.length--,g._strip()}function U(m,f,g){return H(m,f,g)}s.prototype.mulTo=function(f,g){var v,x=this.length+f.length;return this.length===10&&f.length===10?v=k(this,f,g):x<63?v=B(this,f,g):x<1024?v=H(this,f,g):v=U(this,f,g),v},s.prototype.mul=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),this.mulTo(f,g)},s.prototype.mulf=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),U(this,f,g)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var g=f<0;g&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var v=0,x=0;x>=26,v+=S/67108864|0,v+=A>>>26,this.words[x]=A&67108863}return v!==0&&(this.words[x]=v,this.length++),g?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var g=L(f);if(g.length===0)return new s(1);for(var v=this,x=0;x=0);var g=f%26,v=(f-g)/26,x=67108863>>>26-g<<26-g,S;if(g!==0){var A=0;for(S=0;S>>26-g}A&&(this.words[S]=A,this.length++)}if(v!==0){for(S=this.length-1;S>=0;S--)this.words[S+v]=this.words[S];for(S=0;S=0);var x;g?x=(g-g%26)/26:x=0;var S=f%26,A=Math.min((f-S)/26,this.length),b=67108863^67108863>>>S<A)for(this.length-=A,I=0;I=0&&(F!==0||I>=x);I--){var ce=this.words[I]|0;this.words[I]=F<<26-S|ce>>>S,F=ce&b}return P&&F!==0&&(P.words[P.length++]=F),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,g,v){return n(this.negative===0),this.iushrn(f,g,v)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var g=f%26,v=(f-g)/26,x=1<=0);var g=f%26,v=(f-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(g!==0&&v++,this.length=Math.min(v,this.length),g!==0){var x=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(P/67108864|0),this.words[S+v]=A&67108863}for(;S>26,this.words[S+v]=A&67108863;if(b===0)return this._strip();for(n(b===-1),b=0,S=0;S>26,this.words[S]=A&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,g){var v=this.length-f.length,x=this.clone(),S=f,A=S.words[S.length-1]|0,b=this._countBits(A);v=26-b,v!==0&&(S=S.ushln(v),x.iushln(v),A=S.words[S.length-1]|0);var P=x.length-S.length,I;if(g!=="mod"){I=new s(null),I.length=P+1,I.words=new Array(I.length);for(var F=0;F=0;D--){var se=(x.words[S.length+D]|0)*67108864+(x.words[S.length+D-1]|0);for(se=Math.min(se/A|0,67108863),x._ishlnsubmul(S,se,D);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(S,1,D),x.isZero()||(x.negative^=1);I&&(I.words[D]=se)}return I&&I._strip(),x._strip(),g!=="div"&&v!==0&&x.iushrn(v),{div:I||null,mod:x}},s.prototype.divmod=function(f,g,v){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,S,A;return this.negative!==0&&f.negative===0?(A=this.neg().divmod(f,g),g!=="mod"&&(x=A.div.neg()),g!=="div"&&(S=A.mod.neg(),v&&S.negative!==0&&S.iadd(f)),{div:x,mod:S}):this.negative===0&&f.negative!==0?(A=this.divmod(f.neg(),g),g!=="mod"&&(x=A.div.neg()),{div:x,mod:A.mod}):this.negative&f.negative?(A=this.neg().divmod(f.neg(),g),g!=="div"&&(S=A.mod.neg(),v&&S.negative!==0&&S.isub(f)),{div:A.div,mod:S}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?g==="div"?{div:this.divn(f.words[0]),mod:null}:g==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,g)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var g=this.divmod(f);if(g.mod.isZero())return g.div;var v=g.div.negative!==0?g.mod.isub(f):g.mod,x=f.ushrn(1),S=f.andln(1),A=v.cmp(x);return A<0||S===1&&A===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},s.prototype.modrn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=(1<<26)%f,x=0,S=this.length-1;S>=0;S--)x=(v*x+(this.words[S]|0))%f;return g?-x:x},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=0,x=this.length-1;x>=0;x--){var S=(this.words[x]|0)+v*67108864;this.words[x]=S/f|0,v=S%f}return this._strip(),g?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),S=new s(0),A=new s(0),b=new s(1),P=0;g.isEven()&&v.isEven();)g.iushrn(1),v.iushrn(1),++P;for(var I=v.clone(),F=g.clone();!g.isZero();){for(var ce=0,D=1;!(g.words[0]&D)&&ce<26;++ce,D<<=1);if(ce>0)for(g.iushrn(ce);ce-- >0;)(x.isOdd()||S.isOdd())&&(x.iadd(I),S.isub(F)),x.iushrn(1),S.iushrn(1);for(var se=0,ee=1;!(v.words[0]&ee)&&se<26;++se,ee<<=1);if(se>0)for(v.iushrn(se);se-- >0;)(A.isOdd()||b.isOdd())&&(A.iadd(I),b.isub(F)),A.iushrn(1),b.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(A),S.isub(b)):(v.isub(g),A.isub(x),b.isub(S))}return{a:A,b,gcd:v.iushln(P)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),S=new s(0),A=v.clone();g.cmpn(1)>0&&v.cmpn(1)>0;){for(var b=0,P=1;!(g.words[0]&P)&&b<26;++b,P<<=1);if(b>0)for(g.iushrn(b);b-- >0;)x.isOdd()&&x.iadd(A),x.iushrn(1);for(var I=0,F=1;!(v.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(v.iushrn(I);I-- >0;)S.isOdd()&&S.iadd(A),S.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(S)):(v.isub(g),S.isub(x))}var ce;return g.cmpn(1)===0?ce=x:ce=S,ce.cmpn(0)<0&&ce.iadd(f),ce},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var g=this.clone(),v=f.clone();g.negative=0,v.negative=0;for(var x=0;g.isEven()&&v.isEven();x++)g.iushrn(1),v.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;v.isEven();)v.iushrn(1);var S=g.cmp(v);if(S<0){var A=g;g=v,v=A}else if(S===0||v.cmpn(1)===0)break;g.isub(v)}while(!0);return v.iushln(x)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var g=f%26,v=(f-g)/26,x=1<>>26,b&=67108863,this.words[A]=b}return S!==0&&(this.words[A]=S,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var g=f<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var v;if(this.length>1)v=1;else{g&&(f=-f),n(f<=67108863,"Number is too big");var x=this.words[0]|0;v=x===f?0:xf.length)return 1;if(this.length=0;v--){var x=this.words[v]|0,S=f.words[v]|0;if(x!==S){xS&&(g=1);break}}return g},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new j(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var z={k256:null,p224:null,p192:null,p25519:null};function Z(m,f){this.name=m,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Z.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},Z.prototype.ireduce=function(f){var g=f,v;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),v=g.bitLength();while(v>this.n);var x=v0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},Z.prototype.split=function(f,g){f.iushrn(this.n,0,g)},Z.prototype.imulK=function(f){return f.imul(this.k)};function R(){Z.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(R,Z),R.prototype.split=function(f,g){for(var v=4194303,x=Math.min(f.length,9),S=0;S>>22,A=b}A>>>=22,f.words[S-10]=A,A===0&&f.length>10?f.length-=10:f.length-=9},R.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var g=0,v=0;v>>=26,f.words[v]=S,g=x}return g!==0&&(f.words[f.length++]=g),f},s._prime=function(f){if(z[f])return z[f];var g;if(f==="k256")g=new R;else if(f==="p224")g=new W;else if(f==="p192")g=new ie;else if(f==="p25519")g=new me;else throw new Error("Unknown prime "+f);return z[f]=g,g};function j(m){if(typeof m=="string"){var f=s._prime(m);this.m=f.p,this.prime=f}else n(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}j.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},j.prototype._verify2=function(f,g){n((f.negative|g.negative)===0,"red works only with positives"),n(f.red&&f.red===g.red,"red works only with red numbers")},j.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(d(f,f.umod(this.m)._forceRed(this)),f)},j.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},j.prototype.add=function(f,g){this._verify2(f,g);var v=f.add(g);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},j.prototype.iadd=function(f,g){this._verify2(f,g);var v=f.iadd(g);return v.cmp(this.m)>=0&&v.isub(this.m),v},j.prototype.sub=function(f,g){this._verify2(f,g);var v=f.sub(g);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},j.prototype.isub=function(f,g){this._verify2(f,g);var v=f.isub(g);return v.cmpn(0)<0&&v.iadd(this.m),v},j.prototype.shl=function(f,g){return this._verify1(f),this.imod(f.ushln(g))},j.prototype.imul=function(f,g){return this._verify2(f,g),this.imod(f.imul(g))},j.prototype.mul=function(f,g){return this._verify2(f,g),this.imod(f.mul(g))},j.prototype.isqr=function(f){return this.imul(f,f.clone())},j.prototype.sqr=function(f){return this.mul(f,f)},j.prototype.sqrt=function(f){if(f.isZero())return f.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(f,v)}for(var x=this.m.subn(1),S=0;!x.isZero()&&x.andln(1)===0;)S++,x.iushrn(1);n(!x.isZero());var A=new s(1).toRed(this),b=A.redNeg(),P=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,P).cmp(b)!==0;)I.redIAdd(b);for(var F=this.pow(I,x),ce=this.pow(f,x.addn(1).iushrn(1)),D=this.pow(f,x),se=S;D.cmp(A)!==0;){for(var ee=D,J=0;ee.cmp(A)!==0;J++)ee=ee.redSqr();n(J=0;S--){for(var F=g.words[S],ce=I-1;ce>=0;ce--){var D=F>>ce&1;if(A!==x[0]&&(A=this.sqr(A)),D===0&&b===0){P=0;continue}b<<=1,b|=D,P++,!(P!==v&&(S!==0||ce!==0))&&(A=this.mul(A,x[b]),P=0,b=0)}I=26}return A},j.prototype.convertTo=function(f){var g=f.umod(this.m);return g===f?g.clone():g},j.prototype.convertFrom=function(f){var g=f.clone();return g.red=null,g},s.mont=function(f){return new E(f)};function E(m){j.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(E,j),E.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},E.prototype.convertFrom=function(f){var g=this.imod(f.mul(this.rinv));return g.red=null,g},E.prototype.imul=function(f,g){if(f.isZero()||g.isZero())return f.words[0]=0,f.length=1,f;var v=f.imul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=v.isub(x).iushrn(this.shift),A=S;return S.cmp(this.m)>=0?A=S.isub(this.m):S.cmpn(0)<0&&(A=S.iadd(this.m)),A._forceRed(this)},E.prototype.mul=function(f,g){if(f.isZero()||g.isZero())return new s(0)._forceRed(this);var v=f.mul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=v.isub(x).iushrn(this.shift),A=S;return S.cmp(this.m)>=0?A=S.isub(this.m):S.cmpn(0)<0&&(A=S.iadd(this.m)),A._forceRed(this)},E.prototype.invm=function(f){var g=this.imod(f._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,nn)}(Om);var QN=Om.exports;const rr=ji(QN);var eL=rr.BN;function tL(t){return new eL(t,36).toString(16)}const rL="strings/5.7.0",nL=new Kr(rL);var Td;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(Td||(Td={}));var m3;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(m3||(m3={}));function Nm(t,e=Td.current){e!=Td.current&&(nL.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return bn(r)}const iL=`Ethereum Signed Message: +`;function v3(t){return typeof t=="string"&&(t=Nm(t)),Dm(JN([Nm(iL),Nm(String(t.length)),t]))}const sL="address/5.7.0",cl=new Kr(sL);function b3(t){$s(t,20)||cl.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=bn(Dm(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const oL=9007199254740991;function aL(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const Lm={};for(let t=0;t<10;t++)Lm[String(t)]=String(t);for(let t=0;t<26;t++)Lm[String.fromCharCode(65+t)]=String(10+t);const y3=Math.floor(aL(oL));function cL(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Lm[n]).join("");for(;e.length>=y3;){let n=e.substring(0,y3);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function uL(t){let e=null;if(typeof t!="string"&&cl.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=b3(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&cl.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==cL(t)&&cl.throwArgumentError("bad icap checksum","address",t),e=tL(t.substring(4));e.length<40;)e="0"+e;e=b3("0x"+e)}else cl.throwArgumentError("invalid address","address",t);return e}function ul(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var fl={},wr={},tc=w3;function w3(t,e){if(!t)throw new Error(e||"Assertion failed")}w3.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var km={exports:{}};typeof Object.create=="function"?km.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:km.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var Rd=km.exports,fL=tc,lL=Rd;wr.inherits=lL;function hL(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function dL(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):hL(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}wr.htonl=x3;function gL(t,e){for(var r="",n=0;n>>0}return s}wr.join32=mL;function vL(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}wr.split32=vL;function bL(t,e){return t>>>e|t<<32-e}wr.rotr32=bL;function yL(t,e){return t<>>32-e}wr.rotl32=yL;function wL(t,e){return t+e>>>0}wr.sum32=wL;function xL(t,e,r){return t+e+r>>>0}wr.sum32_3=xL;function _L(t,e,r,n){return t+e+r+n>>>0}wr.sum32_4=_L;function EL(t,e,r,n,i){return t+e+r+n+i>>>0}wr.sum32_5=EL;function SL(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}wr.sum64=SL;function AL(t,e,r,n){var i=e+n>>>0,s=(i>>0}wr.sum64_hi=AL;function PL(t,e,r,n){var i=e+n;return i>>>0}wr.sum64_lo=PL;function ML(t,e,r,n,i,s,o,a){var u=0,l=e;l=l+n>>>0,u+=l>>0,u+=l>>0,u+=l>>0}wr.sum64_4_hi=ML;function IL(t,e,r,n,i,s,o,a){var u=e+n+s+a;return u>>>0}wr.sum64_4_lo=IL;function CL(t,e,r,n,i,s,o,a,u,l){var d=0,p=e;p=p+n>>>0,d+=p>>0,d+=p>>0,d+=p>>0,d+=p>>0}wr.sum64_5_hi=CL;function TL(t,e,r,n,i,s,o,a,u,l){var d=e+n+s+a+l;return d>>>0}wr.sum64_5_lo=TL;function RL(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}wr.rotr64_hi=RL;function DL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}wr.rotr64_lo=DL;function OL(t,e,r){return t>>>r}wr.shr64_hi=OL;function NL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}wr.shr64_lo=NL;var hu={},S3=wr,LL=tc;function Dd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}hu.BlockHash=Dd,Dd.prototype.update=function(e,r){if(e=S3.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=S3.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}Fs.g0_256=jL;function UL(t){return js(t,17)^js(t,19)^t>>>10}Fs.g1_256=UL;var pu=wr,qL=hu,zL=Fs,Bm=pu.rotl32,ll=pu.sum32,HL=pu.sum32_5,WL=zL.ft_1,I3=qL.BlockHash,KL=[1518500249,1859775393,2400959708,3395469782];function Us(){if(!(this instanceof Us))return new Us;I3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}pu.inherits(Us,I3);var VL=Us;Us.blockSize=512,Us.outSize=160,Us.hmacStrength=80,Us.padLength=64,Us.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),Nk(e.length<=this.blockSize);for(var r=e.length;r>8,y=d&255;p?u.push(p,y):u.push(y)}return u}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",u=0;u(y>>1)-1?O=(y>>1)-L:O=L,_.isubn(O)):O=0,p[M]=O,_.iushrn(1)}return p}r.getNAF=n;function i(u,l){var d=[[],[]];u=u.clone(),l=l.clone();for(var p=0,y=0,_;u.cmpn(-p)>0||l.cmpn(-y)>0;){var M=u.andln(3)+p&3,O=l.andln(3)+y&3;M===3&&(M=-1),O===3&&(O=-1);var L;M&1?(_=u.andln(7)+p&7,(_===3||_===5)&&O===2?L=-M:L=M):L=0,d[0].push(L);var B;O&1?(_=l.andln(7)+y&7,(_===3||_===5)&&M===2?B=-O:B=O):B=0,d[1].push(B),2*p===L+1&&(p=1-p),2*y===B+1&&(y=1-y),u.iushrn(1),l.iushrn(1)}return d}r.getJSF=i;function s(u,l,d){var p="_"+l;u.prototype[l]=function(){return this[p]!==void 0?this[p]:this[p]=d.call(this)}}r.cachedProperty=s;function o(u){return typeof u=="string"?r.toArray(u,"hex"):u}r.parseBytes=o;function a(u){return new rr(u,"hex","le")}r.intFromLE=a}),Nd=Ci.getNAF,Bk=Ci.getJSF,Ld=Ci.assert;function aa(t,e){this.type=t,this.p=new rr(e.p,16),this.red=e.prime?rr.red(e.prime):rr.mont(this.p),this.zero=new rr(0).toRed(this.red),this.one=new rr(1).toRed(this.red),this.two=new rr(2).toRed(this.red),this.n=e.n&&new rr(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var nc=aa;aa.prototype.point=function(){throw new Error("Not implemented")},aa.prototype.validate=function(){throw new Error("Not implemented")},aa.prototype._fixedNafMul=function(e,r){Ld(e.precomputed);var n=e._getDoubles(),i=Nd(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Ld(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},aa.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var M=d-1,O=d;if(o[M]!==1||o[O]!==1){u[M]=Nd(n[M],o[M],this._bitLength),u[O]=Nd(n[O],o[O],this._bitLength),l=Math.max(u[M].length,l),l=Math.max(u[O].length,l);continue}var L=[r[M],null,null,r[O]];r[M].y.cmp(r[O].y)===0?(L[1]=r[M].add(r[O]),L[2]=r[M].toJ().mixedAdd(r[O].neg())):r[M].y.cmp(r[O].y.redNeg())===0?(L[1]=r[M].toJ().mixedAdd(r[O]),L[2]=r[M].add(r[O].neg())):(L[1]=r[M].toJ().mixedAdd(r[O]),L[2]=r[M].toJ().mixedAdd(r[O].neg()));var B=[-3,-1,-5,-7,0,7,5,1,3],k=Bk(n[M],n[O]);for(l=Math.max(k[0].length,l),u[M]=new Array(l),u[O]=new Array(l),p=0;p=0;d--){for(var R=0;d>=0;){var W=!0;for(p=0;p=0&&R++,z=z.dblp(R),d<0)break;for(p=0;p0?y=a[p][ie-1>>1]:ie<0&&(y=a[p][-ie-1>>1].neg()),y.type==="affine"?z=z.mixedAdd(y):z=z.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Wi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(_=l,M=d),p.negative&&(p=p.neg(),y=y.neg()),_.negative&&(_=_.neg(),M=M.neg()),[{a:p,b:y},{a:_,b:M}]},Ki.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Ki.prototype.pointFromX=function(e,r){e=new rr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Ki.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Ki.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Tn.prototype.isInfinity=function(){return this.inf},Tn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Tn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Tn.prototype.getX=function(){return this.x.fromRed()},Tn.prototype.getY=function(){return this.y.fromRed()},Tn.prototype.mul=function(e){return e=new rr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Tn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Tn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Tn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Tn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Tn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function $n(t,e,r,n){nc.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new rr(0)):(this.x=new rr(e,16),this.y=new rr(r,16),this.z=new rr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}zm($n,nc.BasePoint),Ki.prototype.jpoint=function(e,r,n){return new $n(this,e,r,n)},$n.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},$n.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},$n.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),_=l.redSqr().redIAdd(p).redISub(y).redISub(y),M=l.redMul(y.redISub(_)).redISub(o.redMul(p)),O=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(_,M,O)},$n.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),_=u.redMul(p.redISub(y)).redISub(s.redMul(d)),M=this.z.redMul(a);return this.curve.jpoint(y,_,M)},$n.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},$n.prototype.inspect=function(){return this.isInfinity()?"":""},$n.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var kd=bu(function(t,e){var r=e;r.base=nc,r.short=Fk,r.mont=null,r.edwards=null}),Bd=bu(function(t,e){var r=e,n=Ci.assert;function i(a){a.type==="short"?this.curve=new kd.short(a):a.type==="edwards"?this.curve=new kd.edwards(a):this.curve=new kd.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,u){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(u);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:wo.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:wo.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:wo.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:wo.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:wo.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:wo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function ca(t){if(!(this instanceof ca))return new ca(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ws.toArray(t.entropy,t.entropyEnc||"hex"),r=ws.toArray(t.nonce,t.nonceEnc||"hex"),n=ws.toArray(t.pers,t.persEnc||"hex");qm(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var z3=ca;ca.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ca.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=ws.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var jk=Ci.assert;function $d(t,e){if(t instanceof $d)return t;this._importDER(t,e)||(jk(t.r&&t.s,"Signature without r or s"),this.r=new rr(t.r,16),this.s=new rr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Fd=$d;function Uk(){this.place=0}function Km(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function H3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}$d.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=H3(r),n=H3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Vm(i,r.length),i=i.concat(r),i.push(2),Vm(i,n.length);var s=i.concat(n),o=[48];return Vm(o,s.length),o=o.concat(s),Ci.encode(o,e)};var qk=function(){throw new Error("unsupported")},W3=Ci.assert;function Vi(t){if(!(this instanceof Vi))return new Vi(t);typeof t=="string"&&(W3(Object.prototype.hasOwnProperty.call(Bd,t),"Unknown curve "+t),t=Bd[t]),t instanceof Bd.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var zk=Vi;Vi.prototype.keyPair=function(e){return new Wm(this,e)},Vi.prototype.keyFromPrivate=function(e,r){return Wm.fromPrivate(this,e,r)},Vi.prototype.keyFromPublic=function(e,r){return Wm.fromPublic(this,e,r)},Vi.prototype.genKeyPair=function(e){e||(e={});for(var r=new z3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||qk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new rr(2));;){var s=new rr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Vi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Vi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new rr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new z3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new rr(1)),d=0;;d++){var p=i.k?i.k(d):new rr(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var _=y.getX(),M=_.umod(this.n);if(M.cmpn(0)!==0){var O=p.invm(this.n).mul(M.mul(r.getPrivate()).iadd(e));if(O=O.umod(this.n),O.cmpn(0)!==0){var L=(y.getY().isOdd()?1:0)|(_.cmp(M)!==0?2:0);return i.canonical&&O.cmp(this.nh)>0&&(O=this.n.sub(O),L^=1),new Fd({r:M,s:O,recoveryParam:L})}}}}}},Vi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new rr(e,16)),n=this.keyFromPublic(n,i),r=new Fd(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),u=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.eqXToP(s)):(d=this.g.mulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.getX().umod(this.n).cmp(s)===0)},Vi.prototype.recoverPubKey=function(t,e,r,n){W3((3&r)===r,"The recovery param is more than two bits"),e=new Fd(e,n);var i=this.n,s=new rr(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Vi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Fd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var Hk=bu(function(t,e){var r=e;r.version="6.5.4",r.utils=Ci,r.rand=function(){throw new Error("unsupported")},r.curve=kd,r.curves=Bd,r.ec=zk,r.eddsa=null}),Wk=Hk.ec;const Kk="signing-key/5.7.0",Gm=new Kr(Kk);let Ym=null;function ua(){return Ym||(Ym=new Wk("secp256k1")),Ym}class Vk{constructor(e){ul(this,"curve","secp256k1"),ul(this,"privateKey",Ii(e)),ZN(this.privateKey)!==32&&Gm.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=ua().keyFromPrivate(bn(this.privateKey));ul(this,"publicKey","0x"+r.getPublic(!1,"hex")),ul(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ul(this,"_isSigningKey",!0)}_addPoint(e){const r=ua().keyFromPublic(bn(this.publicKey)),n=ua().keyFromPublic(bn(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=ua().keyFromPrivate(bn(this.privateKey)),n=bn(e);n.length!==32&&Gm.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return g3({recoveryParam:i.recoveryParam,r:lu("0x"+i.r.toString(16),32),s:lu("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=ua().keyFromPrivate(bn(this.privateKey)),n=ua().keyFromPublic(bn(K3(e)));return lu("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function Gk(t,e){const r=g3(e),n={r:bn(r.r),s:bn(r.s)};return"0x"+ua().recoverPubKey(bn(t),n,r.recoveryParam).encode("hex",!1)}function K3(t,e){const r=bn(t);return r.length===32?new Vk(r).publicKey:r.length===33?"0x"+ua().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?Ii(r):Gm.throwArgumentError("invalid public or private key","key","[REDACTED]")}var V3;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(V3||(V3={}));function Yk(t){const e=K3(t);return uL(p3(Dm(p3(e,1)),12))}function Jk(t,e){return Yk(Gk(bn(t),e))}var Jm={},jd={};Object.defineProperty(jd,"__esModule",{value:!0});var Vn=or,Xm=Mi,Xk=20;function Zk(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],p=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],_=r[27]<<24|r[26]<<16|r[25]<<8|r[24],M=r[31]<<24|r[30]<<16|r[29]<<8|r[28],O=e[3]<<24|e[2]<<16|e[1]<<8|e[0],L=e[7]<<24|e[6]<<16|e[5]<<8|e[4],B=e[11]<<24|e[10]<<16|e[9]<<8|e[8],k=e[15]<<24|e[14]<<16|e[13]<<8|e[12],H=n,U=i,z=s,Z=o,R=a,W=u,ie=l,me=d,j=p,E=y,m=_,f=M,g=O,v=L,x=B,S=k,A=0;A>>16|g<<16,j=j+g|0,R^=j,R=R>>>20|R<<12,U=U+W|0,v^=U,v=v>>>16|v<<16,E=E+v|0,W^=E,W=W>>>20|W<<12,z=z+ie|0,x^=z,x=x>>>16|x<<16,m=m+x|0,ie^=m,ie=ie>>>20|ie<<12,Z=Z+me|0,S^=Z,S=S>>>16|S<<16,f=f+S|0,me^=f,me=me>>>20|me<<12,z=z+ie|0,x^=z,x=x>>>24|x<<8,m=m+x|0,ie^=m,ie=ie>>>25|ie<<7,Z=Z+me|0,S^=Z,S=S>>>24|S<<8,f=f+S|0,me^=f,me=me>>>25|me<<7,U=U+W|0,v^=U,v=v>>>24|v<<8,E=E+v|0,W^=E,W=W>>>25|W<<7,H=H+R|0,g^=H,g=g>>>24|g<<8,j=j+g|0,R^=j,R=R>>>25|R<<7,H=H+W|0,S^=H,S=S>>>16|S<<16,m=m+S|0,W^=m,W=W>>>20|W<<12,U=U+ie|0,g^=U,g=g>>>16|g<<16,f=f+g|0,ie^=f,ie=ie>>>20|ie<<12,z=z+me|0,v^=z,v=v>>>16|v<<16,j=j+v|0,me^=j,me=me>>>20|me<<12,Z=Z+R|0,x^=Z,x=x>>>16|x<<16,E=E+x|0,R^=E,R=R>>>20|R<<12,z=z+me|0,v^=z,v=v>>>24|v<<8,j=j+v|0,me^=j,me=me>>>25|me<<7,Z=Z+R|0,x^=Z,x=x>>>24|x<<8,E=E+x|0,R^=E,R=R>>>25|R<<7,U=U+ie|0,g^=U,g=g>>>24|g<<8,f=f+g|0,ie^=f,ie=ie>>>25|ie<<7,H=H+W|0,S^=H,S=S>>>24|S<<8,m=m+S|0,W^=m,W=W>>>25|W<<7;Vn.writeUint32LE(H+n|0,t,0),Vn.writeUint32LE(U+i|0,t,4),Vn.writeUint32LE(z+s|0,t,8),Vn.writeUint32LE(Z+o|0,t,12),Vn.writeUint32LE(R+a|0,t,16),Vn.writeUint32LE(W+u|0,t,20),Vn.writeUint32LE(ie+l|0,t,24),Vn.writeUint32LE(me+d|0,t,28),Vn.writeUint32LE(j+p|0,t,32),Vn.writeUint32LE(E+y|0,t,36),Vn.writeUint32LE(m+_|0,t,40),Vn.writeUint32LE(f+M|0,t,44),Vn.writeUint32LE(g+O|0,t,48),Vn.writeUint32LE(v+L|0,t,52),Vn.writeUint32LE(x+B|0,t,56),Vn.writeUint32LE(S+k|0,t,60)}function G3(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var Y3={},fa={};Object.defineProperty(fa,"__esModule",{value:!0});function tB(t,e,r){return~(t-1)&e|t-1&r}fa.select=tB;function rB(t,e){return(t|0)-(e|0)-1>>>31&1}fa.lessOrEqual=rB;function J3(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}fa.compare=J3;function nB(t,e){return t.length===0||e.length===0?!1:J3(t,e)!==0}fa.equal=nB,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=fa,r=Mi;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var u=a[0]|a[1]<<8;this._r[0]=u&8191;var l=a[2]|a[3]<<8;this._r[1]=(u>>>13|l<<3)&8191;var d=a[4]|a[5]<<8;this._r[2]=(l>>>10|d<<6)&7939;var p=a[6]|a[7]<<8;this._r[3]=(d>>>7|p<<9)&8191;var y=a[8]|a[9]<<8;this._r[4]=(p>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var _=a[10]|a[11]<<8;this._r[6]=(y>>>14|_<<2)&8191;var M=a[12]|a[13]<<8;this._r[7]=(_>>>11|M<<5)&8065;var O=a[14]|a[15]<<8;this._r[8]=(M>>>8|O<<8)&8191,this._r[9]=O>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,u,l){for(var d=this._fin?0:2048,p=this._h[0],y=this._h[1],_=this._h[2],M=this._h[3],O=this._h[4],L=this._h[5],B=this._h[6],k=this._h[7],H=this._h[8],U=this._h[9],z=this._r[0],Z=this._r[1],R=this._r[2],W=this._r[3],ie=this._r[4],me=this._r[5],j=this._r[6],E=this._r[7],m=this._r[8],f=this._r[9];l>=16;){var g=a[u+0]|a[u+1]<<8;p+=g&8191;var v=a[u+2]|a[u+3]<<8;y+=(g>>>13|v<<3)&8191;var x=a[u+4]|a[u+5]<<8;_+=(v>>>10|x<<6)&8191;var S=a[u+6]|a[u+7]<<8;M+=(x>>>7|S<<9)&8191;var A=a[u+8]|a[u+9]<<8;O+=(S>>>4|A<<12)&8191,L+=A>>>1&8191;var b=a[u+10]|a[u+11]<<8;B+=(A>>>14|b<<2)&8191;var P=a[u+12]|a[u+13]<<8;k+=(b>>>11|P<<5)&8191;var I=a[u+14]|a[u+15]<<8;H+=(P>>>8|I<<8)&8191,U+=I>>>5|d;var F=0,ce=F;ce+=p*z,ce+=y*(5*f),ce+=_*(5*m),ce+=M*(5*E),ce+=O*(5*j),F=ce>>>13,ce&=8191,ce+=L*(5*me),ce+=B*(5*ie),ce+=k*(5*W),ce+=H*(5*R),ce+=U*(5*Z),F+=ce>>>13,ce&=8191;var D=F;D+=p*Z,D+=y*z,D+=_*(5*f),D+=M*(5*m),D+=O*(5*E),F=D>>>13,D&=8191,D+=L*(5*j),D+=B*(5*me),D+=k*(5*ie),D+=H*(5*W),D+=U*(5*R),F+=D>>>13,D&=8191;var se=F;se+=p*R,se+=y*Z,se+=_*z,se+=M*(5*f),se+=O*(5*m),F=se>>>13,se&=8191,se+=L*(5*E),se+=B*(5*j),se+=k*(5*me),se+=H*(5*ie),se+=U*(5*W),F+=se>>>13,se&=8191;var ee=F;ee+=p*W,ee+=y*R,ee+=_*Z,ee+=M*z,ee+=O*(5*f),F=ee>>>13,ee&=8191,ee+=L*(5*m),ee+=B*(5*E),ee+=k*(5*j),ee+=H*(5*me),ee+=U*(5*ie),F+=ee>>>13,ee&=8191;var J=F;J+=p*ie,J+=y*W,J+=_*R,J+=M*Z,J+=O*z,F=J>>>13,J&=8191,J+=L*(5*f),J+=B*(5*m),J+=k*(5*E),J+=H*(5*j),J+=U*(5*me),F+=J>>>13,J&=8191;var Q=F;Q+=p*me,Q+=y*ie,Q+=_*W,Q+=M*R,Q+=O*Z,F=Q>>>13,Q&=8191,Q+=L*z,Q+=B*(5*f),Q+=k*(5*m),Q+=H*(5*E),Q+=U*(5*j),F+=Q>>>13,Q&=8191;var T=F;T+=p*j,T+=y*me,T+=_*ie,T+=M*W,T+=O*R,F=T>>>13,T&=8191,T+=L*Z,T+=B*z,T+=k*(5*f),T+=H*(5*m),T+=U*(5*E),F+=T>>>13,T&=8191;var X=F;X+=p*E,X+=y*j,X+=_*me,X+=M*ie,X+=O*W,F=X>>>13,X&=8191,X+=L*R,X+=B*Z,X+=k*z,X+=H*(5*f),X+=U*(5*m),F+=X>>>13,X&=8191;var re=F;re+=p*m,re+=y*E,re+=_*j,re+=M*me,re+=O*ie,F=re>>>13,re&=8191,re+=L*W,re+=B*R,re+=k*Z,re+=H*z,re+=U*(5*f),F+=re>>>13,re&=8191;var ge=F;ge+=p*f,ge+=y*m,ge+=_*E,ge+=M*j,ge+=O*me,F=ge>>>13,ge&=8191,ge+=L*ie,ge+=B*W,ge+=k*R,ge+=H*Z,ge+=U*z,F+=ge>>>13,ge&=8191,F=(F<<2)+F|0,F=F+ce|0,ce=F&8191,F=F>>>13,D+=F,p=ce,y=D,_=se,M=ee,O=J,L=Q,B=T,k=X,H=re,U=ge,u+=16,l-=16}this._h[0]=p,this._h[1]=y,this._h[2]=_,this._h[3]=M,this._h[4]=O,this._h[5]=L,this._h[6]=B,this._h[7]=k,this._h[8]=H,this._h[9]=U},o.prototype.finish=function(a,u){u===void 0&&(u=0);var l=new Uint16Array(10),d,p,y,_;if(this._leftover){for(_=this._leftover,this._buffer[_++]=1;_<16;_++)this._buffer[_]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(d=this._h[1]>>>13,this._h[1]&=8191,_=2;_<10;_++)this._h[_]+=d,d=this._h[_]>>>13,this._h[_]&=8191;for(this._h[0]+=d*5,d=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=d,d=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=d,l[0]=this._h[0]+5,d=l[0]>>>13,l[0]&=8191,_=1;_<10;_++)l[_]=this._h[_]+d,d=l[_]>>>13,l[_]&=8191;for(l[9]-=8192,p=(d^1)-1,_=0;_<10;_++)l[_]&=p;for(p=~p,_=0;_<10;_++)this._h[_]=this._h[_]&p|l[_];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,y=this._h[0]+this._pad[0],this._h[0]=y&65535,_=1;_<8;_++)y=(this._h[_]+this._pad[_]|0)+(y>>>16)|0,this._h[_]=y&65535;return a[u+0]=this._h[0]>>>0,a[u+1]=this._h[0]>>>8,a[u+2]=this._h[1]>>>0,a[u+3]=this._h[1]>>>8,a[u+4]=this._h[2]>>>0,a[u+5]=this._h[2]>>>8,a[u+6]=this._h[3]>>>0,a[u+7]=this._h[3]>>>8,a[u+8]=this._h[4]>>>0,a[u+9]=this._h[4]>>>8,a[u+10]=this._h[5]>>>0,a[u+11]=this._h[5]>>>8,a[u+12]=this._h[6]>>>0,a[u+13]=this._h[6]>>>8,a[u+14]=this._h[7]>>>0,a[u+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var u=0,l=a.length,d;if(this._leftover){d=16-this._leftover,d>l&&(d=l);for(var p=0;p=16&&(d=l-l%16,this._blocks(a,u,d),u+=d,l-=d),l){for(var p=0;p16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var _=new Uint8Array(16);_.set(l,_.length-l.length);var M=new Uint8Array(32);e.stream(this._key,_,M,4);var O=d.length+this.tagLength,L;if(y){if(y.length!==O)throw new Error("ChaCha20Poly1305: incorrect destination length");L=y}else L=new Uint8Array(O);return e.streamXOR(this._key,_,d,L,4),this._authenticate(L.subarray(L.length-this.tagLength,L.length),M,L.subarray(0,L.length-this.tagLength),p),n.wipe(_),L},u.prototype.open=function(l,d,p,y){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(d.length0&&_.update(o.subarray(y.length%16))),_.update(p),p.length%16>0&&_.update(o.subarray(p.length%16));var M=new Uint8Array(8);y&&i.writeUint64LE(y.length,M),_.update(M),i.writeUint64LE(p.length,M),_.update(M);for(var O=_.digest(),L=0;Lthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._temp,this._state,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,_=l%64<56?64:128;this._buffer[d]=128;for(var M=d+1;M<_-8;M++)this._buffer[M]=0;e.writeUint32BE(p,this._buffer,_-8),e.writeUint32BE(y,this._buffer,_-4),s(this._temp,this._state,this._buffer,0,_),this._finished=!0}for(var M=0;M0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._state.set(u.state),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.state),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,u,l,d,p){for(;p>=64;){for(var y=u[0],_=u[1],M=u[2],O=u[3],L=u[4],B=u[5],k=u[6],H=u[7],U=0;U<16;U++){var z=d+U*4;a[U]=e.readUint32BE(l,z)}for(var U=16;U<64;U++){var Z=a[U-2],R=(Z>>>17|Z<<15)^(Z>>>19|Z<<13)^Z>>>10;Z=a[U-15];var W=(Z>>>7|Z<<25)^(Z>>>18|Z<<14)^Z>>>3;a[U]=(R+a[U-7]|0)+(W+a[U-16]|0)}for(var U=0;U<64;U++){var R=(((L>>>6|L<<26)^(L>>>11|L<<21)^(L>>>25|L<<7))+(L&B^~L&k)|0)+(H+(i[U]+a[U]|0)|0)|0,W=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&_^y&M^_&M)|0;H=k,k=B,B=L,L=O+R|0,O=M,M=_,_=y,y=R+W|0}u[0]+=y,u[1]+=_,u[2]+=M,u[3]+=O,u[4]+=L,u[5]+=B,u[6]+=k,u[7]+=H,d+=64,p-=64}return d}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(pl);var Qm={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=sa,r=Mi;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(U){const z=new Float64Array(16);if(U)for(let Z=0;Z>16&1),Z[me-1]&=65535;Z[15]=R[15]-32767-(Z[14]>>16&1);const ie=Z[15]>>16&1;Z[14]&=65535,a(R,Z,1-ie)}for(let W=0;W<16;W++)U[2*W]=R[W]&255,U[2*W+1]=R[W]>>8}function l(U,z){for(let Z=0;Z<16;Z++)U[Z]=z[2*Z]+(z[2*Z+1]<<8);U[15]&=32767}function d(U,z,Z){for(let R=0;R<16;R++)U[R]=z[R]+Z[R]}function p(U,z,Z){for(let R=0;R<16;R++)U[R]=z[R]-Z[R]}function y(U,z,Z){let R,W,ie=0,me=0,j=0,E=0,m=0,f=0,g=0,v=0,x=0,S=0,A=0,b=0,P=0,I=0,F=0,ce=0,D=0,se=0,ee=0,J=0,Q=0,T=0,X=0,re=0,ge=0,oe=0,fe=0,be=0,Me=0,Ne=0,Te=0,$e=Z[0],Ie=Z[1],Le=Z[2],Ve=Z[3],ke=Z[4],ze=Z[5],He=Z[6],Se=Z[7],Qe=Z[8],ct=Z[9],Be=Z[10],et=Z[11],rt=Z[12],Je=Z[13],gt=Z[14],ht=Z[15];R=z[0],ie+=R*$e,me+=R*Ie,j+=R*Le,E+=R*Ve,m+=R*ke,f+=R*ze,g+=R*He,v+=R*Se,x+=R*Qe,S+=R*ct,A+=R*Be,b+=R*et,P+=R*rt,I+=R*Je,F+=R*gt,ce+=R*ht,R=z[1],me+=R*$e,j+=R*Ie,E+=R*Le,m+=R*Ve,f+=R*ke,g+=R*ze,v+=R*He,x+=R*Se,S+=R*Qe,A+=R*ct,b+=R*Be,P+=R*et,I+=R*rt,F+=R*Je,ce+=R*gt,D+=R*ht,R=z[2],j+=R*$e,E+=R*Ie,m+=R*Le,f+=R*Ve,g+=R*ke,v+=R*ze,x+=R*He,S+=R*Se,A+=R*Qe,b+=R*ct,P+=R*Be,I+=R*et,F+=R*rt,ce+=R*Je,D+=R*gt,se+=R*ht,R=z[3],E+=R*$e,m+=R*Ie,f+=R*Le,g+=R*Ve,v+=R*ke,x+=R*ze,S+=R*He,A+=R*Se,b+=R*Qe,P+=R*ct,I+=R*Be,F+=R*et,ce+=R*rt,D+=R*Je,se+=R*gt,ee+=R*ht,R=z[4],m+=R*$e,f+=R*Ie,g+=R*Le,v+=R*Ve,x+=R*ke,S+=R*ze,A+=R*He,b+=R*Se,P+=R*Qe,I+=R*ct,F+=R*Be,ce+=R*et,D+=R*rt,se+=R*Je,ee+=R*gt,J+=R*ht,R=z[5],f+=R*$e,g+=R*Ie,v+=R*Le,x+=R*Ve,S+=R*ke,A+=R*ze,b+=R*He,P+=R*Se,I+=R*Qe,F+=R*ct,ce+=R*Be,D+=R*et,se+=R*rt,ee+=R*Je,J+=R*gt,Q+=R*ht,R=z[6],g+=R*$e,v+=R*Ie,x+=R*Le,S+=R*Ve,A+=R*ke,b+=R*ze,P+=R*He,I+=R*Se,F+=R*Qe,ce+=R*ct,D+=R*Be,se+=R*et,ee+=R*rt,J+=R*Je,Q+=R*gt,T+=R*ht,R=z[7],v+=R*$e,x+=R*Ie,S+=R*Le,A+=R*Ve,b+=R*ke,P+=R*ze,I+=R*He,F+=R*Se,ce+=R*Qe,D+=R*ct,se+=R*Be,ee+=R*et,J+=R*rt,Q+=R*Je,T+=R*gt,X+=R*ht,R=z[8],x+=R*$e,S+=R*Ie,A+=R*Le,b+=R*Ve,P+=R*ke,I+=R*ze,F+=R*He,ce+=R*Se,D+=R*Qe,se+=R*ct,ee+=R*Be,J+=R*et,Q+=R*rt,T+=R*Je,X+=R*gt,re+=R*ht,R=z[9],S+=R*$e,A+=R*Ie,b+=R*Le,P+=R*Ve,I+=R*ke,F+=R*ze,ce+=R*He,D+=R*Se,se+=R*Qe,ee+=R*ct,J+=R*Be,Q+=R*et,T+=R*rt,X+=R*Je,re+=R*gt,ge+=R*ht,R=z[10],A+=R*$e,b+=R*Ie,P+=R*Le,I+=R*Ve,F+=R*ke,ce+=R*ze,D+=R*He,se+=R*Se,ee+=R*Qe,J+=R*ct,Q+=R*Be,T+=R*et,X+=R*rt,re+=R*Je,ge+=R*gt,oe+=R*ht,R=z[11],b+=R*$e,P+=R*Ie,I+=R*Le,F+=R*Ve,ce+=R*ke,D+=R*ze,se+=R*He,ee+=R*Se,J+=R*Qe,Q+=R*ct,T+=R*Be,X+=R*et,re+=R*rt,ge+=R*Je,oe+=R*gt,fe+=R*ht,R=z[12],P+=R*$e,I+=R*Ie,F+=R*Le,ce+=R*Ve,D+=R*ke,se+=R*ze,ee+=R*He,J+=R*Se,Q+=R*Qe,T+=R*ct,X+=R*Be,re+=R*et,ge+=R*rt,oe+=R*Je,fe+=R*gt,be+=R*ht,R=z[13],I+=R*$e,F+=R*Ie,ce+=R*Le,D+=R*Ve,se+=R*ke,ee+=R*ze,J+=R*He,Q+=R*Se,T+=R*Qe,X+=R*ct,re+=R*Be,ge+=R*et,oe+=R*rt,fe+=R*Je,be+=R*gt,Me+=R*ht,R=z[14],F+=R*$e,ce+=R*Ie,D+=R*Le,se+=R*Ve,ee+=R*ke,J+=R*ze,Q+=R*He,T+=R*Se,X+=R*Qe,re+=R*ct,ge+=R*Be,oe+=R*et,fe+=R*rt,be+=R*Je,Me+=R*gt,Ne+=R*ht,R=z[15],ce+=R*$e,D+=R*Ie,se+=R*Le,ee+=R*Ve,J+=R*ke,Q+=R*ze,T+=R*He,X+=R*Se,re+=R*Qe,ge+=R*ct,oe+=R*Be,fe+=R*et,be+=R*rt,Me+=R*Je,Ne+=R*gt,Te+=R*ht,ie+=38*D,me+=38*se,j+=38*ee,E+=38*J,m+=38*Q,f+=38*T,g+=38*X,v+=38*re,x+=38*ge,S+=38*oe,A+=38*fe,b+=38*be,P+=38*Me,I+=38*Ne,F+=38*Te,W=1,R=ie+W+65535,W=Math.floor(R/65536),ie=R-W*65536,R=me+W+65535,W=Math.floor(R/65536),me=R-W*65536,R=j+W+65535,W=Math.floor(R/65536),j=R-W*65536,R=E+W+65535,W=Math.floor(R/65536),E=R-W*65536,R=m+W+65535,W=Math.floor(R/65536),m=R-W*65536,R=f+W+65535,W=Math.floor(R/65536),f=R-W*65536,R=g+W+65535,W=Math.floor(R/65536),g=R-W*65536,R=v+W+65535,W=Math.floor(R/65536),v=R-W*65536,R=x+W+65535,W=Math.floor(R/65536),x=R-W*65536,R=S+W+65535,W=Math.floor(R/65536),S=R-W*65536,R=A+W+65535,W=Math.floor(R/65536),A=R-W*65536,R=b+W+65535,W=Math.floor(R/65536),b=R-W*65536,R=P+W+65535,W=Math.floor(R/65536),P=R-W*65536,R=I+W+65535,W=Math.floor(R/65536),I=R-W*65536,R=F+W+65535,W=Math.floor(R/65536),F=R-W*65536,R=ce+W+65535,W=Math.floor(R/65536),ce=R-W*65536,ie+=W-1+37*(W-1),W=1,R=ie+W+65535,W=Math.floor(R/65536),ie=R-W*65536,R=me+W+65535,W=Math.floor(R/65536),me=R-W*65536,R=j+W+65535,W=Math.floor(R/65536),j=R-W*65536,R=E+W+65535,W=Math.floor(R/65536),E=R-W*65536,R=m+W+65535,W=Math.floor(R/65536),m=R-W*65536,R=f+W+65535,W=Math.floor(R/65536),f=R-W*65536,R=g+W+65535,W=Math.floor(R/65536),g=R-W*65536,R=v+W+65535,W=Math.floor(R/65536),v=R-W*65536,R=x+W+65535,W=Math.floor(R/65536),x=R-W*65536,R=S+W+65535,W=Math.floor(R/65536),S=R-W*65536,R=A+W+65535,W=Math.floor(R/65536),A=R-W*65536,R=b+W+65535,W=Math.floor(R/65536),b=R-W*65536,R=P+W+65535,W=Math.floor(R/65536),P=R-W*65536,R=I+W+65535,W=Math.floor(R/65536),I=R-W*65536,R=F+W+65535,W=Math.floor(R/65536),F=R-W*65536,R=ce+W+65535,W=Math.floor(R/65536),ce=R-W*65536,ie+=W-1+37*(W-1),U[0]=ie,U[1]=me,U[2]=j,U[3]=E,U[4]=m,U[5]=f,U[6]=g,U[7]=v,U[8]=x,U[9]=S,U[10]=A,U[11]=b,U[12]=P,U[13]=I,U[14]=F,U[15]=ce}function _(U,z){y(U,z,z)}function M(U,z){const Z=n();for(let R=0;R<16;R++)Z[R]=z[R];for(let R=253;R>=0;R--)_(Z,Z),R!==2&&R!==4&&y(Z,Z,z);for(let R=0;R<16;R++)U[R]=Z[R]}function O(U,z){const Z=new Uint8Array(32),R=new Float64Array(80),W=n(),ie=n(),me=n(),j=n(),E=n(),m=n();for(let x=0;x<31;x++)Z[x]=U[x];Z[31]=U[31]&127|64,Z[0]&=248,l(R,z);for(let x=0;x<16;x++)ie[x]=R[x];W[0]=j[0]=1;for(let x=254;x>=0;--x){const S=Z[x>>>3]>>>(x&7)&1;a(W,ie,S),a(me,j,S),d(E,W,me),p(W,W,me),d(me,ie,j),p(ie,ie,j),_(j,E),_(m,W),y(W,me,W),y(me,ie,E),d(E,W,me),p(W,W,me),_(ie,W),p(me,j,m),y(W,me,s),d(W,W,j),y(me,me,W),y(W,j,m),y(j,ie,R),_(ie,E),a(W,ie,S),a(me,j,S)}for(let x=0;x<16;x++)R[x+16]=W[x],R[x+32]=me[x],R[x+48]=ie[x],R[x+64]=j[x];const f=R.subarray(32),g=R.subarray(16);M(f,f),y(g,g,f);const v=new Uint8Array(32);return u(v,g),v}t.scalarMult=O;function L(U){return O(U,i)}t.scalarMultBase=L;function B(U){if(U.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const z=new Uint8Array(U);return{publicKey:L(z),secretKey:z}}t.generateKeyPairFromSeed=B;function k(U){const z=(0,e.randomBytes)(32,U),Z=B(z);return(0,r.wipe)(z),Z}t.generateKeyPair=k;function H(U,z,Z=!1){if(U.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(z.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const R=O(U,z);if(Z){let W=0;for(let ie=0;ie",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}};var Ti={},e1={exports:{}};e1.exports,function(t){(function(e,r){function n(j,E){if(!j)throw new Error(E||"Assertion failed")}function i(j,E){j.super_=E;var m=function(){};m.prototype=E.prototype,j.prototype=new m,j.prototype.constructor=j}function s(j,E,m){if(s.isBN(j))return j;this.negative=0,this.words=null,this.length=0,this.red=null,j!==null&&((E==="le"||E==="be")&&(m=E,E=10),this._init(j||0,E||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=il.Buffer}catch{}s.isBN=function(E){return E instanceof s?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===s.wordSize&&Array.isArray(E.words)},s.max=function(E,m){return E.cmp(m)>0?E:m},s.min=function(E,m){return E.cmp(m)<0?E:m},s.prototype._init=function(E,m,f){if(typeof E=="number")return this._initNumber(E,m,f);if(typeof E=="object")return this._initArray(E,m,f);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),E=E.toString().replace(/\s+/g,"");var g=0;E[0]==="-"&&(g++,this.negative=1),g=0;g-=3)x=E[g]|E[g-1]<<8|E[g-2]<<16,this.words[v]|=x<>>26-S&67108863,S+=24,S>=26&&(S-=26,v++);else if(f==="le")for(g=0,v=0;g>>26-S&67108863,S+=24,S>=26&&(S-=26,v++);return this.strip()};function a(j,E){var m=j.charCodeAt(E);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function u(j,E,m){var f=a(j,m);return m-1>=E&&(f|=a(j,m-1)<<4),f}s.prototype._parseHex=function(E,m,f){this.length=Math.ceil((E.length-m)/6),this.words=new Array(this.length);for(var g=0;g=m;g-=2)S=u(E,m,g)<=18?(v-=18,x+=1,this.words[x]|=S>>>26):v+=8;else{var A=E.length-m;for(g=A%2===0?m+1:m;g=18?(v-=18,x+=1,this.words[x]|=S>>>26):v+=8}this.strip()};function l(j,E,m,f){for(var g=0,v=Math.min(j.length,m),x=E;x=49?g+=S-49+10:S>=17?g+=S-17+10:g+=S}return g}s.prototype._parseBase=function(E,m,f){this.words=[0],this.length=1;for(var g=0,v=1;v<=67108863;v*=m)g++;g--,v=v/m|0;for(var x=E.length-f,S=x%g,A=Math.min(x,x-S)+f,b=0,P=f;P1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var d=["","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"],p=[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],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(E,m){E=E||10,m=m|0||1;var f;if(E===16||E==="hex"){f="";for(var g=0,v=0,x=0;x>>24-g&16777215,g+=2,g>=26&&(g-=26,x--),v!==0||x!==this.length-1?f=d[6-A.length]+A+f:f=A+f}for(v!==0&&(f=v.toString(16)+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(E===(E|0)&&E>=2&&E<=36){var b=p[E],P=y[E];f="";var I=this.clone();for(I.negative=0;!I.isZero();){var F=I.modn(P).toString(E);I=I.idivn(P),I.isZero()?f=F+f:f=d[b-F.length]+F+f}for(this.isZero()&&(f="0"+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(E,m){return n(typeof o<"u"),this.toArrayLike(o,E,m)},s.prototype.toArray=function(E,m){return this.toArrayLike(Array,E,m)},s.prototype.toArrayLike=function(E,m,f){var g=this.byteLength(),v=f||Math.max(1,g);n(g<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var x=m==="le",S=new E(v),A,b,P=this.clone();if(x){for(b=0;!P.isZero();b++)A=P.andln(255),P.iushrn(8),S[b]=A;for(;b=4096&&(f+=13,m>>>=13),m>=64&&(f+=7,m>>>=7),m>=8&&(f+=4,m>>>=4),m>=2&&(f+=2,m>>>=2),f+m},s.prototype._zeroBits=function(E){if(E===0)return 26;var m=E,f=0;return m&8191||(f+=13,m>>>=13),m&127||(f+=7,m>>>=7),m&15||(f+=4,m>>>=4),m&3||(f+=2,m>>>=2),m&1||f++,f},s.prototype.bitLength=function(){var E=this.words[this.length-1],m=this._countBits(E);return(this.length-1)*26+m};function _(j){for(var E=new Array(j.bitLength()),m=0;m>>g}return E}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,m=0;mE.length?this.clone().ior(E):E.clone().ior(this)},s.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},s.prototype.iuand=function(E){var m;this.length>E.length?m=E:m=this;for(var f=0;fE.length?this.clone().iand(E):E.clone().iand(this)},s.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},s.prototype.iuxor=function(E){var m,f;this.length>E.length?(m=this,f=E):(m=E,f=this);for(var g=0;gE.length?this.clone().ixor(E):E.clone().ixor(this)},s.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},s.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var m=Math.ceil(E/26)|0,f=E%26;this._expand(m),f>0&&m--;for(var g=0;g0&&(this.words[g]=~this.words[g]&67108863>>26-f),this.strip()},s.prototype.notn=function(E){return this.clone().inotn(E)},s.prototype.setn=function(E,m){n(typeof E=="number"&&E>=0);var f=E/26|0,g=E%26;return this._expand(f+1),m?this.words[f]=this.words[f]|1<E.length?(f=this,g=E):(f=E,g=this);for(var v=0,x=0;x>>26;for(;v!==0&&x>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;xE.length?this.clone().iadd(E):E.clone().iadd(this)},s.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var m=this.iadd(E);return E.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var f=this.cmp(E);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var g,v;f>0?(g=this,v=E):(g=E,v=this);for(var x=0,S=0;S>26,this.words[S]=m&67108863;for(;x!==0&&S>26,this.words[S]=m&67108863;if(x===0&&S>>26,I=A&67108863,F=Math.min(b,E.length-1),ce=Math.max(0,b-j.length+1);ce<=F;ce++){var D=b-ce|0;g=j.words[D]|0,v=E.words[ce]|0,x=g*v+I,P+=x/67108864|0,I=x&67108863}m.words[b]=I|0,A=P|0}return A!==0?m.words[b]=A|0:m.length--,m.strip()}var O=function(E,m,f){var g=E.words,v=m.words,x=f.words,S=0,A,b,P,I=g[0]|0,F=I&8191,ce=I>>>13,D=g[1]|0,se=D&8191,ee=D>>>13,J=g[2]|0,Q=J&8191,T=J>>>13,X=g[3]|0,re=X&8191,ge=X>>>13,oe=g[4]|0,fe=oe&8191,be=oe>>>13,Me=g[5]|0,Ne=Me&8191,Te=Me>>>13,$e=g[6]|0,Ie=$e&8191,Le=$e>>>13,Ve=g[7]|0,ke=Ve&8191,ze=Ve>>>13,He=g[8]|0,Se=He&8191,Qe=He>>>13,ct=g[9]|0,Be=ct&8191,et=ct>>>13,rt=v[0]|0,Je=rt&8191,gt=rt>>>13,ht=v[1]|0,ft=ht&8191,Ht=ht>>>13,Jt=v[2]|0,St=Jt&8191,er=Jt>>>13,Xt=v[3]|0,Ot=Xt&8191,Bt=Xt>>>13,Tt=v[4]|0,bt=Tt&8191,Dt=Tt>>>13,Lt=v[5]|0,yt=Lt&8191,$t=Lt>>>13,jt=v[6]|0,nt=jt&8191,Ft=jt>>>13,$=v[7]|0,K=$&8191,G=$>>>13,C=v[8]|0,Y=C&8191,q=C>>>13,ae=v[9]|0,pe=ae&8191,_e=ae>>>13;f.negative=E.negative^m.negative,f.length=19,A=Math.imul(F,Je),b=Math.imul(F,gt),b=b+Math.imul(ce,Je)|0,P=Math.imul(ce,gt);var Re=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(Re>>>26)|0,Re&=67108863,A=Math.imul(se,Je),b=Math.imul(se,gt),b=b+Math.imul(ee,Je)|0,P=Math.imul(ee,gt),A=A+Math.imul(F,ft)|0,b=b+Math.imul(F,Ht)|0,b=b+Math.imul(ce,ft)|0,P=P+Math.imul(ce,Ht)|0;var De=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(De>>>26)|0,De&=67108863,A=Math.imul(Q,Je),b=Math.imul(Q,gt),b=b+Math.imul(T,Je)|0,P=Math.imul(T,gt),A=A+Math.imul(se,ft)|0,b=b+Math.imul(se,Ht)|0,b=b+Math.imul(ee,ft)|0,P=P+Math.imul(ee,Ht)|0,A=A+Math.imul(F,St)|0,b=b+Math.imul(F,er)|0,b=b+Math.imul(ce,St)|0,P=P+Math.imul(ce,er)|0;var it=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(it>>>26)|0,it&=67108863,A=Math.imul(re,Je),b=Math.imul(re,gt),b=b+Math.imul(ge,Je)|0,P=Math.imul(ge,gt),A=A+Math.imul(Q,ft)|0,b=b+Math.imul(Q,Ht)|0,b=b+Math.imul(T,ft)|0,P=P+Math.imul(T,Ht)|0,A=A+Math.imul(se,St)|0,b=b+Math.imul(se,er)|0,b=b+Math.imul(ee,St)|0,P=P+Math.imul(ee,er)|0,A=A+Math.imul(F,Ot)|0,b=b+Math.imul(F,Bt)|0,b=b+Math.imul(ce,Ot)|0,P=P+Math.imul(ce,Bt)|0;var Ue=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,A=Math.imul(fe,Je),b=Math.imul(fe,gt),b=b+Math.imul(be,Je)|0,P=Math.imul(be,gt),A=A+Math.imul(re,ft)|0,b=b+Math.imul(re,Ht)|0,b=b+Math.imul(ge,ft)|0,P=P+Math.imul(ge,Ht)|0,A=A+Math.imul(Q,St)|0,b=b+Math.imul(Q,er)|0,b=b+Math.imul(T,St)|0,P=P+Math.imul(T,er)|0,A=A+Math.imul(se,Ot)|0,b=b+Math.imul(se,Bt)|0,b=b+Math.imul(ee,Ot)|0,P=P+Math.imul(ee,Bt)|0,A=A+Math.imul(F,bt)|0,b=b+Math.imul(F,Dt)|0,b=b+Math.imul(ce,bt)|0,P=P+Math.imul(ce,Dt)|0;var mt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(mt>>>26)|0,mt&=67108863,A=Math.imul(Ne,Je),b=Math.imul(Ne,gt),b=b+Math.imul(Te,Je)|0,P=Math.imul(Te,gt),A=A+Math.imul(fe,ft)|0,b=b+Math.imul(fe,Ht)|0,b=b+Math.imul(be,ft)|0,P=P+Math.imul(be,Ht)|0,A=A+Math.imul(re,St)|0,b=b+Math.imul(re,er)|0,b=b+Math.imul(ge,St)|0,P=P+Math.imul(ge,er)|0,A=A+Math.imul(Q,Ot)|0,b=b+Math.imul(Q,Bt)|0,b=b+Math.imul(T,Ot)|0,P=P+Math.imul(T,Bt)|0,A=A+Math.imul(se,bt)|0,b=b+Math.imul(se,Dt)|0,b=b+Math.imul(ee,bt)|0,P=P+Math.imul(ee,Dt)|0,A=A+Math.imul(F,yt)|0,b=b+Math.imul(F,$t)|0,b=b+Math.imul(ce,yt)|0,P=P+Math.imul(ce,$t)|0;var st=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(st>>>26)|0,st&=67108863,A=Math.imul(Ie,Je),b=Math.imul(Ie,gt),b=b+Math.imul(Le,Je)|0,P=Math.imul(Le,gt),A=A+Math.imul(Ne,ft)|0,b=b+Math.imul(Ne,Ht)|0,b=b+Math.imul(Te,ft)|0,P=P+Math.imul(Te,Ht)|0,A=A+Math.imul(fe,St)|0,b=b+Math.imul(fe,er)|0,b=b+Math.imul(be,St)|0,P=P+Math.imul(be,er)|0,A=A+Math.imul(re,Ot)|0,b=b+Math.imul(re,Bt)|0,b=b+Math.imul(ge,Ot)|0,P=P+Math.imul(ge,Bt)|0,A=A+Math.imul(Q,bt)|0,b=b+Math.imul(Q,Dt)|0,b=b+Math.imul(T,bt)|0,P=P+Math.imul(T,Dt)|0,A=A+Math.imul(se,yt)|0,b=b+Math.imul(se,$t)|0,b=b+Math.imul(ee,yt)|0,P=P+Math.imul(ee,$t)|0,A=A+Math.imul(F,nt)|0,b=b+Math.imul(F,Ft)|0,b=b+Math.imul(ce,nt)|0,P=P+Math.imul(ce,Ft)|0;var tt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(tt>>>26)|0,tt&=67108863,A=Math.imul(ke,Je),b=Math.imul(ke,gt),b=b+Math.imul(ze,Je)|0,P=Math.imul(ze,gt),A=A+Math.imul(Ie,ft)|0,b=b+Math.imul(Ie,Ht)|0,b=b+Math.imul(Le,ft)|0,P=P+Math.imul(Le,Ht)|0,A=A+Math.imul(Ne,St)|0,b=b+Math.imul(Ne,er)|0,b=b+Math.imul(Te,St)|0,P=P+Math.imul(Te,er)|0,A=A+Math.imul(fe,Ot)|0,b=b+Math.imul(fe,Bt)|0,b=b+Math.imul(be,Ot)|0,P=P+Math.imul(be,Bt)|0,A=A+Math.imul(re,bt)|0,b=b+Math.imul(re,Dt)|0,b=b+Math.imul(ge,bt)|0,P=P+Math.imul(ge,Dt)|0,A=A+Math.imul(Q,yt)|0,b=b+Math.imul(Q,$t)|0,b=b+Math.imul(T,yt)|0,P=P+Math.imul(T,$t)|0,A=A+Math.imul(se,nt)|0,b=b+Math.imul(se,Ft)|0,b=b+Math.imul(ee,nt)|0,P=P+Math.imul(ee,Ft)|0,A=A+Math.imul(F,K)|0,b=b+Math.imul(F,G)|0,b=b+Math.imul(ce,K)|0,P=P+Math.imul(ce,G)|0;var At=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(At>>>26)|0,At&=67108863,A=Math.imul(Se,Je),b=Math.imul(Se,gt),b=b+Math.imul(Qe,Je)|0,P=Math.imul(Qe,gt),A=A+Math.imul(ke,ft)|0,b=b+Math.imul(ke,Ht)|0,b=b+Math.imul(ze,ft)|0,P=P+Math.imul(ze,Ht)|0,A=A+Math.imul(Ie,St)|0,b=b+Math.imul(Ie,er)|0,b=b+Math.imul(Le,St)|0,P=P+Math.imul(Le,er)|0,A=A+Math.imul(Ne,Ot)|0,b=b+Math.imul(Ne,Bt)|0,b=b+Math.imul(Te,Ot)|0,P=P+Math.imul(Te,Bt)|0,A=A+Math.imul(fe,bt)|0,b=b+Math.imul(fe,Dt)|0,b=b+Math.imul(be,bt)|0,P=P+Math.imul(be,Dt)|0,A=A+Math.imul(re,yt)|0,b=b+Math.imul(re,$t)|0,b=b+Math.imul(ge,yt)|0,P=P+Math.imul(ge,$t)|0,A=A+Math.imul(Q,nt)|0,b=b+Math.imul(Q,Ft)|0,b=b+Math.imul(T,nt)|0,P=P+Math.imul(T,Ft)|0,A=A+Math.imul(se,K)|0,b=b+Math.imul(se,G)|0,b=b+Math.imul(ee,K)|0,P=P+Math.imul(ee,G)|0,A=A+Math.imul(F,Y)|0,b=b+Math.imul(F,q)|0,b=b+Math.imul(ce,Y)|0,P=P+Math.imul(ce,q)|0;var Rt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,A=Math.imul(Be,Je),b=Math.imul(Be,gt),b=b+Math.imul(et,Je)|0,P=Math.imul(et,gt),A=A+Math.imul(Se,ft)|0,b=b+Math.imul(Se,Ht)|0,b=b+Math.imul(Qe,ft)|0,P=P+Math.imul(Qe,Ht)|0,A=A+Math.imul(ke,St)|0,b=b+Math.imul(ke,er)|0,b=b+Math.imul(ze,St)|0,P=P+Math.imul(ze,er)|0,A=A+Math.imul(Ie,Ot)|0,b=b+Math.imul(Ie,Bt)|0,b=b+Math.imul(Le,Ot)|0,P=P+Math.imul(Le,Bt)|0,A=A+Math.imul(Ne,bt)|0,b=b+Math.imul(Ne,Dt)|0,b=b+Math.imul(Te,bt)|0,P=P+Math.imul(Te,Dt)|0,A=A+Math.imul(fe,yt)|0,b=b+Math.imul(fe,$t)|0,b=b+Math.imul(be,yt)|0,P=P+Math.imul(be,$t)|0,A=A+Math.imul(re,nt)|0,b=b+Math.imul(re,Ft)|0,b=b+Math.imul(ge,nt)|0,P=P+Math.imul(ge,Ft)|0,A=A+Math.imul(Q,K)|0,b=b+Math.imul(Q,G)|0,b=b+Math.imul(T,K)|0,P=P+Math.imul(T,G)|0,A=A+Math.imul(se,Y)|0,b=b+Math.imul(se,q)|0,b=b+Math.imul(ee,Y)|0,P=P+Math.imul(ee,q)|0,A=A+Math.imul(F,pe)|0,b=b+Math.imul(F,_e)|0,b=b+Math.imul(ce,pe)|0,P=P+Math.imul(ce,_e)|0;var Mt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,A=Math.imul(Be,ft),b=Math.imul(Be,Ht),b=b+Math.imul(et,ft)|0,P=Math.imul(et,Ht),A=A+Math.imul(Se,St)|0,b=b+Math.imul(Se,er)|0,b=b+Math.imul(Qe,St)|0,P=P+Math.imul(Qe,er)|0,A=A+Math.imul(ke,Ot)|0,b=b+Math.imul(ke,Bt)|0,b=b+Math.imul(ze,Ot)|0,P=P+Math.imul(ze,Bt)|0,A=A+Math.imul(Ie,bt)|0,b=b+Math.imul(Ie,Dt)|0,b=b+Math.imul(Le,bt)|0,P=P+Math.imul(Le,Dt)|0,A=A+Math.imul(Ne,yt)|0,b=b+Math.imul(Ne,$t)|0,b=b+Math.imul(Te,yt)|0,P=P+Math.imul(Te,$t)|0,A=A+Math.imul(fe,nt)|0,b=b+Math.imul(fe,Ft)|0,b=b+Math.imul(be,nt)|0,P=P+Math.imul(be,Ft)|0,A=A+Math.imul(re,K)|0,b=b+Math.imul(re,G)|0,b=b+Math.imul(ge,K)|0,P=P+Math.imul(ge,G)|0,A=A+Math.imul(Q,Y)|0,b=b+Math.imul(Q,q)|0,b=b+Math.imul(T,Y)|0,P=P+Math.imul(T,q)|0,A=A+Math.imul(se,pe)|0,b=b+Math.imul(se,_e)|0,b=b+Math.imul(ee,pe)|0,P=P+Math.imul(ee,_e)|0;var Et=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(Et>>>26)|0,Et&=67108863,A=Math.imul(Be,St),b=Math.imul(Be,er),b=b+Math.imul(et,St)|0,P=Math.imul(et,er),A=A+Math.imul(Se,Ot)|0,b=b+Math.imul(Se,Bt)|0,b=b+Math.imul(Qe,Ot)|0,P=P+Math.imul(Qe,Bt)|0,A=A+Math.imul(ke,bt)|0,b=b+Math.imul(ke,Dt)|0,b=b+Math.imul(ze,bt)|0,P=P+Math.imul(ze,Dt)|0,A=A+Math.imul(Ie,yt)|0,b=b+Math.imul(Ie,$t)|0,b=b+Math.imul(Le,yt)|0,P=P+Math.imul(Le,$t)|0,A=A+Math.imul(Ne,nt)|0,b=b+Math.imul(Ne,Ft)|0,b=b+Math.imul(Te,nt)|0,P=P+Math.imul(Te,Ft)|0,A=A+Math.imul(fe,K)|0,b=b+Math.imul(fe,G)|0,b=b+Math.imul(be,K)|0,P=P+Math.imul(be,G)|0,A=A+Math.imul(re,Y)|0,b=b+Math.imul(re,q)|0,b=b+Math.imul(ge,Y)|0,P=P+Math.imul(ge,q)|0,A=A+Math.imul(Q,pe)|0,b=b+Math.imul(Q,_e)|0,b=b+Math.imul(T,pe)|0,P=P+Math.imul(T,_e)|0;var dt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(dt>>>26)|0,dt&=67108863,A=Math.imul(Be,Ot),b=Math.imul(Be,Bt),b=b+Math.imul(et,Ot)|0,P=Math.imul(et,Bt),A=A+Math.imul(Se,bt)|0,b=b+Math.imul(Se,Dt)|0,b=b+Math.imul(Qe,bt)|0,P=P+Math.imul(Qe,Dt)|0,A=A+Math.imul(ke,yt)|0,b=b+Math.imul(ke,$t)|0,b=b+Math.imul(ze,yt)|0,P=P+Math.imul(ze,$t)|0,A=A+Math.imul(Ie,nt)|0,b=b+Math.imul(Ie,Ft)|0,b=b+Math.imul(Le,nt)|0,P=P+Math.imul(Le,Ft)|0,A=A+Math.imul(Ne,K)|0,b=b+Math.imul(Ne,G)|0,b=b+Math.imul(Te,K)|0,P=P+Math.imul(Te,G)|0,A=A+Math.imul(fe,Y)|0,b=b+Math.imul(fe,q)|0,b=b+Math.imul(be,Y)|0,P=P+Math.imul(be,q)|0,A=A+Math.imul(re,pe)|0,b=b+Math.imul(re,_e)|0,b=b+Math.imul(ge,pe)|0,P=P+Math.imul(ge,_e)|0;var _t=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(_t>>>26)|0,_t&=67108863,A=Math.imul(Be,bt),b=Math.imul(Be,Dt),b=b+Math.imul(et,bt)|0,P=Math.imul(et,Dt),A=A+Math.imul(Se,yt)|0,b=b+Math.imul(Se,$t)|0,b=b+Math.imul(Qe,yt)|0,P=P+Math.imul(Qe,$t)|0,A=A+Math.imul(ke,nt)|0,b=b+Math.imul(ke,Ft)|0,b=b+Math.imul(ze,nt)|0,P=P+Math.imul(ze,Ft)|0,A=A+Math.imul(Ie,K)|0,b=b+Math.imul(Ie,G)|0,b=b+Math.imul(Le,K)|0,P=P+Math.imul(Le,G)|0,A=A+Math.imul(Ne,Y)|0,b=b+Math.imul(Ne,q)|0,b=b+Math.imul(Te,Y)|0,P=P+Math.imul(Te,q)|0,A=A+Math.imul(fe,pe)|0,b=b+Math.imul(fe,_e)|0,b=b+Math.imul(be,pe)|0,P=P+Math.imul(be,_e)|0;var ot=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(ot>>>26)|0,ot&=67108863,A=Math.imul(Be,yt),b=Math.imul(Be,$t),b=b+Math.imul(et,yt)|0,P=Math.imul(et,$t),A=A+Math.imul(Se,nt)|0,b=b+Math.imul(Se,Ft)|0,b=b+Math.imul(Qe,nt)|0,P=P+Math.imul(Qe,Ft)|0,A=A+Math.imul(ke,K)|0,b=b+Math.imul(ke,G)|0,b=b+Math.imul(ze,K)|0,P=P+Math.imul(ze,G)|0,A=A+Math.imul(Ie,Y)|0,b=b+Math.imul(Ie,q)|0,b=b+Math.imul(Le,Y)|0,P=P+Math.imul(Le,q)|0,A=A+Math.imul(Ne,pe)|0,b=b+Math.imul(Ne,_e)|0,b=b+Math.imul(Te,pe)|0,P=P+Math.imul(Te,_e)|0;var wt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(wt>>>26)|0,wt&=67108863,A=Math.imul(Be,nt),b=Math.imul(Be,Ft),b=b+Math.imul(et,nt)|0,P=Math.imul(et,Ft),A=A+Math.imul(Se,K)|0,b=b+Math.imul(Se,G)|0,b=b+Math.imul(Qe,K)|0,P=P+Math.imul(Qe,G)|0,A=A+Math.imul(ke,Y)|0,b=b+Math.imul(ke,q)|0,b=b+Math.imul(ze,Y)|0,P=P+Math.imul(ze,q)|0,A=A+Math.imul(Ie,pe)|0,b=b+Math.imul(Ie,_e)|0,b=b+Math.imul(Le,pe)|0,P=P+Math.imul(Le,_e)|0;var lt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(lt>>>26)|0,lt&=67108863,A=Math.imul(Be,K),b=Math.imul(Be,G),b=b+Math.imul(et,K)|0,P=Math.imul(et,G),A=A+Math.imul(Se,Y)|0,b=b+Math.imul(Se,q)|0,b=b+Math.imul(Qe,Y)|0,P=P+Math.imul(Qe,q)|0,A=A+Math.imul(ke,pe)|0,b=b+Math.imul(ke,_e)|0,b=b+Math.imul(ze,pe)|0,P=P+Math.imul(ze,_e)|0;var at=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(at>>>26)|0,at&=67108863,A=Math.imul(Be,Y),b=Math.imul(Be,q),b=b+Math.imul(et,Y)|0,P=Math.imul(et,q),A=A+Math.imul(Se,pe)|0,b=b+Math.imul(Se,_e)|0,b=b+Math.imul(Qe,pe)|0,P=P+Math.imul(Qe,_e)|0;var Ae=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,A=Math.imul(Be,pe),b=Math.imul(Be,_e),b=b+Math.imul(et,pe)|0,P=Math.imul(et,_e);var Pe=(S+A|0)+((b&8191)<<13)|0;return S=(P+(b>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,x[0]=Re,x[1]=De,x[2]=it,x[3]=Ue,x[4]=mt,x[5]=st,x[6]=tt,x[7]=At,x[8]=Rt,x[9]=Mt,x[10]=Et,x[11]=dt,x[12]=_t,x[13]=ot,x[14]=wt,x[15]=lt,x[16]=at,x[17]=Ae,x[18]=Pe,S!==0&&(x[19]=S,f.length++),f};Math.imul||(O=M);function L(j,E,m){m.negative=E.negative^j.negative,m.length=j.length+E.length;for(var f=0,g=0,v=0;v>>26)|0,g+=x>>>26,x&=67108863}m.words[v]=S,f=x,x=g}return f!==0?m.words[v]=f:m.length--,m.strip()}function B(j,E,m){var f=new k;return f.mulp(j,E,m)}s.prototype.mulTo=function(E,m){var f,g=this.length+E.length;return this.length===10&&E.length===10?f=O(this,E,m):g<63?f=M(this,E,m):g<1024?f=L(this,E,m):f=B(this,E,m),f};function k(j,E){this.x=j,this.y=E}k.prototype.makeRBT=function(E){for(var m=new Array(E),f=s.prototype._countBits(E)-1,g=0;g>=1;return g},k.prototype.permute=function(E,m,f,g,v,x){for(var S=0;S>>1)v++;return 1<>>13,f[2*x+1]=v&8191,v=v>>>13;for(x=2*m;x>=26,m+=g/67108864|0,m+=v>>>26,this.words[f]=v&67108863}return m!==0&&(this.words[f]=m,this.length++),this},s.prototype.muln=function(E){return this.clone().imuln(E)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(E){var m=_(E);if(m.length===0)return new s(1);for(var f=this,g=0;g=0);var m=E%26,f=(E-m)/26,g=67108863>>>26-m<<26-m,v;if(m!==0){var x=0;for(v=0;v>>26-m}x&&(this.words[v]=x,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var g;m?g=(m-m%26)/26:g=0;var v=E%26,x=Math.min((E-v)/26,this.length),S=67108863^67108863>>>v<x)for(this.length-=x,b=0;b=0&&(P!==0||b>=g);b--){var I=this.words[b]|0;this.words[b]=P<<26-v|I>>>v,P=I&S}return A&&P!==0&&(A.words[A.length++]=P),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(E,m,f){return n(this.negative===0),this.iushrn(E,m,f)},s.prototype.shln=function(E){return this.clone().ishln(E)},s.prototype.ushln=function(E){return this.clone().iushln(E)},s.prototype.shrn=function(E){return this.clone().ishrn(E)},s.prototype.ushrn=function(E){return this.clone().iushrn(E)},s.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var m=E%26,f=(E-m)/26,g=1<=0);var m=E%26,f=(E-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(m!==0&&f++,this.length=Math.min(f,this.length),m!==0){var g=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(A/67108864|0),this.words[v+f]=x&67108863}for(;v>26,this.words[v+f]=x&67108863;if(S===0)return this.strip();for(n(S===-1),S=0,v=0;v>26,this.words[v]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(E,m){var f=this.length-E.length,g=this.clone(),v=E,x=v.words[v.length-1]|0,S=this._countBits(x);f=26-S,f!==0&&(v=v.ushln(f),g.iushln(f),x=v.words[v.length-1]|0);var A=g.length-v.length,b;if(m!=="mod"){b=new s(null),b.length=A+1,b.words=new Array(b.length);for(var P=0;P=0;F--){var ce=(g.words[v.length+F]|0)*67108864+(g.words[v.length+F-1]|0);for(ce=Math.min(ce/x|0,67108863),g._ishlnsubmul(v,ce,F);g.negative!==0;)ce--,g.negative=0,g._ishlnsubmul(v,1,F),g.isZero()||(g.negative^=1);b&&(b.words[F]=ce)}return b&&b.strip(),g.strip(),m!=="div"&&f!==0&&g.iushrn(f),{div:b||null,mod:g}},s.prototype.divmod=function(E,m,f){if(n(!E.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var g,v,x;return this.negative!==0&&E.negative===0?(x=this.neg().divmod(E,m),m!=="mod"&&(g=x.div.neg()),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.iadd(E)),{div:g,mod:v}):this.negative===0&&E.negative!==0?(x=this.divmod(E.neg(),m),m!=="mod"&&(g=x.div.neg()),{div:g,mod:x.mod}):this.negative&E.negative?(x=this.neg().divmod(E.neg(),m),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.isub(E)),{div:x.div,mod:v}):E.length>this.length||this.cmp(E)<0?{div:new s(0),mod:this}:E.length===1?m==="div"?{div:this.divn(E.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new s(this.modn(E.words[0]))}:this._wordDiv(E,m)},s.prototype.div=function(E){return this.divmod(E,"div",!1).div},s.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},s.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},s.prototype.divRound=function(E){var m=this.divmod(E);if(m.mod.isZero())return m.div;var f=m.div.negative!==0?m.mod.isub(E):m.mod,g=E.ushrn(1),v=E.andln(1),x=f.cmp(g);return x<0||v===1&&x===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(E){n(E<=67108863);for(var m=(1<<26)%E,f=0,g=this.length-1;g>=0;g--)f=(m*f+(this.words[g]|0))%E;return f},s.prototype.idivn=function(E){n(E<=67108863);for(var m=0,f=this.length-1;f>=0;f--){var g=(this.words[f]|0)+m*67108864;this.words[f]=g/E|0,m=g%E}return this.strip()},s.prototype.divn=function(E){return this.clone().idivn(E)},s.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=new s(0),S=new s(1),A=0;m.isEven()&&f.isEven();)m.iushrn(1),f.iushrn(1),++A;for(var b=f.clone(),P=m.clone();!m.isZero();){for(var I=0,F=1;!(m.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(m.iushrn(I);I-- >0;)(g.isOdd()||v.isOdd())&&(g.iadd(b),v.isub(P)),g.iushrn(1),v.iushrn(1);for(var ce=0,D=1;!(f.words[0]&D)&&ce<26;++ce,D<<=1);if(ce>0)for(f.iushrn(ce);ce-- >0;)(x.isOdd()||S.isOdd())&&(x.iadd(b),S.isub(P)),x.iushrn(1),S.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(x),v.isub(S)):(f.isub(m),x.isub(g),S.isub(v))}return{a:x,b:S,gcd:f.iushln(A)}},s.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=f.clone();m.cmpn(1)>0&&f.cmpn(1)>0;){for(var S=0,A=1;!(m.words[0]&A)&&S<26;++S,A<<=1);if(S>0)for(m.iushrn(S);S-- >0;)g.isOdd()&&g.iadd(x),g.iushrn(1);for(var b=0,P=1;!(f.words[0]&P)&&b<26;++b,P<<=1);if(b>0)for(f.iushrn(b);b-- >0;)v.isOdd()&&v.iadd(x),v.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(v)):(f.isub(m),v.isub(g))}var I;return m.cmpn(1)===0?I=g:I=v,I.cmpn(0)<0&&I.iadd(E),I},s.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var m=this.clone(),f=E.clone();m.negative=0,f.negative=0;for(var g=0;m.isEven()&&f.isEven();g++)m.iushrn(1),f.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=m.cmp(f);if(v<0){var x=m;m=f,f=x}else if(v===0||f.cmpn(1)===0)break;m.isub(f)}while(!0);return f.iushln(g)},s.prototype.invm=function(E){return this.egcd(E).a.umod(E)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(E){return this.words[0]&E},s.prototype.bincn=function(E){n(typeof E=="number");var m=E%26,f=(E-m)/26,g=1<>>26,S&=67108863,this.words[x]=S}return v!==0&&(this.words[x]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(E){var m=E<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var f;if(this.length>1)f=1;else{m&&(E=-E),n(E<=67108863,"Number is too big");var g=this.words[0]|0;f=g===E?0:gE.length)return 1;if(this.length=0;f--){var g=this.words[f]|0,v=E.words[f]|0;if(g!==v){gv&&(m=1);break}}return m},s.prototype.gtn=function(E){return this.cmpn(E)===1},s.prototype.gt=function(E){return this.cmp(E)===1},s.prototype.gten=function(E){return this.cmpn(E)>=0},s.prototype.gte=function(E){return this.cmp(E)>=0},s.prototype.ltn=function(E){return this.cmpn(E)===-1},s.prototype.lt=function(E){return this.cmp(E)===-1},s.prototype.lten=function(E){return this.cmpn(E)<=0},s.prototype.lte=function(E){return this.cmp(E)<=0},s.prototype.eqn=function(E){return this.cmpn(E)===0},s.prototype.eq=function(E){return this.cmp(E)===0},s.red=function(E){return new ie(E)},s.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(E){return this.red=E,this},s.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},s.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},s.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},s.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},s.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},s.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},s.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},s.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var H={k256:null,p224:null,p192:null,p25519:null};function U(j,E){this.name=j,this.p=new s(E,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var E=new s(null);return E.words=new Array(Math.ceil(this.n/13)),E},U.prototype.ireduce=function(E){var m=E,f;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),f=m.bitLength();while(f>this.n);var g=f0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},U.prototype.split=function(E,m){E.iushrn(this.n,0,m)},U.prototype.imulK=function(E){return E.imul(this.k)};function z(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(z,U),z.prototype.split=function(E,m){for(var f=4194303,g=Math.min(E.length,9),v=0;v>>22,x=S}x>>>=22,E.words[v-10]=x,x===0&&E.length>10?E.length-=10:E.length-=9},z.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var m=0,f=0;f>>=26,E.words[f]=v,m=g}return m!==0&&(E.words[E.length++]=m),E},s._prime=function(E){if(H[E])return H[E];var m;if(E==="k256")m=new z;else if(E==="p224")m=new Z;else if(E==="p192")m=new R;else if(E==="p25519")m=new W;else throw new Error("Unknown prime "+E);return H[E]=m,m};function ie(j){if(typeof j=="string"){var E=s._prime(j);this.m=E.p,this.prime=E}else n(j.gtn(1),"modulus must be greater than 1"),this.m=j,this.prime=null}ie.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},ie.prototype._verify2=function(E,m){n((E.negative|m.negative)===0,"red works only with positives"),n(E.red&&E.red===m.red,"red works only with red numbers")},ie.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},ie.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},ie.prototype.add=function(E,m){this._verify2(E,m);var f=E.add(m);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},ie.prototype.iadd=function(E,m){this._verify2(E,m);var f=E.iadd(m);return f.cmp(this.m)>=0&&f.isub(this.m),f},ie.prototype.sub=function(E,m){this._verify2(E,m);var f=E.sub(m);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},ie.prototype.isub=function(E,m){this._verify2(E,m);var f=E.isub(m);return f.cmpn(0)<0&&f.iadd(this.m),f},ie.prototype.shl=function(E,m){return this._verify1(E),this.imod(E.ushln(m))},ie.prototype.imul=function(E,m){return this._verify2(E,m),this.imod(E.imul(m))},ie.prototype.mul=function(E,m){return this._verify2(E,m),this.imod(E.mul(m))},ie.prototype.isqr=function(E){return this.imul(E,E.clone())},ie.prototype.sqr=function(E){return this.mul(E,E)},ie.prototype.sqrt=function(E){if(E.isZero())return E.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(E,f)}for(var g=this.m.subn(1),v=0;!g.isZero()&&g.andln(1)===0;)v++,g.iushrn(1);n(!g.isZero());var x=new s(1).toRed(this),S=x.redNeg(),A=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new s(2*b*b).toRed(this);this.pow(b,A).cmp(S)!==0;)b.redIAdd(S);for(var P=this.pow(b,g),I=this.pow(E,g.addn(1).iushrn(1)),F=this.pow(E,g),ce=v;F.cmp(x)!==0;){for(var D=F,se=0;D.cmp(x)!==0;se++)D=D.redSqr();n(se=0;v--){for(var P=m.words[v],I=b-1;I>=0;I--){var F=P>>I&1;if(x!==g[0]&&(x=this.sqr(x)),F===0&&S===0){A=0;continue}S<<=1,S|=F,A++,!(A!==f&&(v!==0||I!==0))&&(x=this.mul(x,g[S]),A=0,S=0)}b=26}return x},ie.prototype.convertTo=function(E){var m=E.umod(this.m);return m===E?m.clone():m},ie.prototype.convertFrom=function(E){var m=E.clone();return m.red=null,m},s.mont=function(E){return new me(E)};function me(j){ie.call(this,j),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(me,ie),me.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},me.prototype.convertFrom=function(E){var m=this.imod(E.mul(this.rinv));return m.red=null,m},me.prototype.imul=function(E,m){if(E.isZero()||m.isZero())return E.words[0]=0,E.length=1,E;var f=E.imul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},me.prototype.mul=function(E,m){if(E.isZero()||m.isZero())return new s(0)._forceRed(this);var f=E.mul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},me.prototype.invm=function(E){var m=this.imod(E._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,nn)}(e1);var xo=e1.exports,t1={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var u=0;u>8,p=l&255;d?a.push(d,p):a.push(p)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(O>>1)-1?B=(O>>1)-k:B=k,L.isubn(B)):B=0,_[M]=B,L.iushrn(1)}return _}e.getNAF=s;function o(d,p){var y=[[],[]];d=d.clone(),p=p.clone();for(var _=0,M=0,O;d.cmpn(-_)>0||p.cmpn(-M)>0;){var L=d.andln(3)+_&3,B=p.andln(3)+M&3;L===3&&(L=-1),B===3&&(B=-1);var k;L&1?(O=d.andln(7)+_&7,(O===3||O===5)&&B===2?k=-L:k=L):k=0,y[0].push(k);var H;B&1?(O=p.andln(7)+M&7,(O===3||O===5)&&L===2?H=-B:H=B):H=0,y[1].push(H),2*_===k+1&&(_=1-_),2*M===H+1&&(M=1-M),d.iushrn(1),p.iushrn(1)}return y}e.getJSF=o;function a(d,p,y){var _="_"+p;d.prototype[p]=function(){return this[_]!==void 0?this[_]:this[_]=y.call(this)}}e.cachedProperty=a;function u(d){return typeof d=="string"?e.toArray(d,"hex"):d}e.parseBytes=u;function l(d){return new r(d,"hex","le")}e.intFromLE=l}(Ti);var r1={exports:{}},n1;r1.exports=function(e){return n1||(n1=new la(null)),n1.generate(e)};function la(t){this.rand=t}if(r1.exports.Rand=la,la.prototype.generate=function(e){return this._rand(e)},la.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var zd=ha;ha.prototype.point=function(){throw new Error("Not implemented")},ha.prototype.validate=function(){throw new Error("Not implemented")},ha.prototype._fixedNafMul=function(e,r){qd(e.precomputed);var n=e._getDoubles(),i=Ud(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];qd(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},ha.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var M=d-1,O=d;if(o[M]!==1||o[O]!==1){u[M]=Ud(n[M],o[M],this._bitLength),u[O]=Ud(n[O],o[O],this._bitLength),l=Math.max(u[M].length,l),l=Math.max(u[O].length,l);continue}var L=[r[M],null,null,r[O]];r[M].y.cmp(r[O].y)===0?(L[1]=r[M].add(r[O]),L[2]=r[M].toJ().mixedAdd(r[O].neg())):r[M].y.cmp(r[O].y.redNeg())===0?(L[1]=r[M].toJ().mixedAdd(r[O]),L[2]=r[M].add(r[O].neg())):(L[1]=r[M].toJ().mixedAdd(r[O]),L[2]=r[M].toJ().mixedAdd(r[O].neg()));var B=[-3,-1,-5,-7,0,7,5,1,3],k=lB(n[M],n[O]);for(l=Math.max(k[0].length,l),u[M]=new Array(l),u[O]=new Array(l),p=0;p=0;d--){for(var R=0;d>=0;){var W=!0;for(p=0;p=0&&R++,z=z.dblp(R),d<0)break;for(p=0;p0?y=a[p][ie-1>>1]:ie<0&&(y=a[p][-ie-1>>1].neg()),y.type==="affine"?z=z.mixedAdd(y):z=z.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Gi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(_=l,M=d),p.negative&&(p=p.neg(),y=y.neg()),_.negative&&(_=_.neg(),M=M.neg()),[{a:p,b:y},{a:_,b:M}]},Yi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Yi.prototype.pointFromX=function(e,r){e=new en(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Yi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Yi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Rn.prototype.isInfinity=function(){return this.inf},Rn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Rn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Rn.prototype.getX=function(){return this.x.fromRed()},Rn.prototype.getY=function(){return this.y.fromRed()},Rn.prototype.mul=function(e){return e=new en(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Rn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Rn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Rn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Rn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Rn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Fn(t,e,r,n){yu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new en(0)):(this.x=new en(e,16),this.y=new en(r,16),this.z=new en(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}s1(Fn,yu.BasePoint),Yi.prototype.jpoint=function(e,r,n){return new Fn(this,e,r,n)},Fn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},Fn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Fn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),_=l.redSqr().redIAdd(p).redISub(y).redISub(y),M=l.redMul(y.redISub(_)).redISub(o.redMul(p)),O=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(_,M,O)},Fn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),_=u.redMul(p.redISub(y)).redISub(s.redMul(d)),M=this.z.redMul(a);return this.curve.jpoint(y,_,M)},Fn.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},Fn.prototype.inspect=function(){return this.isInfinity()?"":""},Fn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var wu=xo,i_=Rd,Hd=zd,gB=Ti;function xu(t){Hd.call(this,"mont",t),this.a=new wu(t.a,16).toRed(this.red),this.b=new wu(t.b,16).toRed(this.red),this.i4=new wu(4).toRed(this.red).redInvm(),this.two=new wu(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}i_(xu,Hd);var mB=xu;xu.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function Dn(t,e,r){Hd.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new wu(e,16),this.z=new wu(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i_(Dn,Hd.BasePoint),xu.prototype.decodePoint=function(e,r){return this.point(gB.toArray(e,r),1)},xu.prototype.point=function(e,r){return new Dn(this,e,r)},xu.prototype.pointFromJSON=function(e){return Dn.fromJSON(this,e)},Dn.prototype.precompute=function(){},Dn.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Dn.fromJSON=function(e,r){return new Dn(e,r[0],r[1]||e.one)},Dn.prototype.inspect=function(){return this.isInfinity()?"":""},Dn.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Dn.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)},Dn.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Dn.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),u=s.redMul(i),l=r.z.redMul(a.redAdd(u).redSqr()),d=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(l,d)},Dn.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i},Dn.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Dn.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Dn.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Dn.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Dn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var vB=Ti,_o=xo,s_=Rd,Wd=zd,bB=vB.assert;function Vs(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Wd.call(this,"edwards",t),this.a=new _o(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new _o(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new _o(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),bB(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}s_(Vs,Wd);var yB=Vs;Vs.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},Vs.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},Vs.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)},Vs.prototype.pointFromX=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var u=a.fromRed().isOdd();return(r&&!u||!r&&u)&&(a=a.redNeg()),this.point(e,a)},Vs.prototype.pointFromY=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)},Vs.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function Hr(t,e,r,n,i){Wd.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new _o(e,16),this.y=new _o(r,16),this.z=n?new _o(n,16):this.curve.one,this.t=i&&new _o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}s_(Hr,Wd.BasePoint),Vs.prototype.pointFromJSON=function(e){return Hr.fromJSON(this,e)},Vs.prototype.point=function(e,r,n,i){return new Hr(this,e,r,n,i)},Hr.fromJSON=function(e,r){return new Hr(e,r[0],r[1],r[2])},Hr.prototype.inspect=function(){return this.isInfinity()?"":""},Hr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Hr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),u=i.redSub(r),l=s.redMul(a),d=o.redMul(u),p=s.redMul(u),y=a.redMul(o);return this.curve.point(l,d,y,p)},Hr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,u,l;if(this.curve.twisted){a=this.curve._mulA(r);var d=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(d.redSub(this.curve.two)),s=d.redMul(a.redSub(n)),o=d.redSqr().redSub(d).redSub(d)):(u=this.z.redSqr(),l=d.redSub(u).redISub(u),i=e.redSub(r).redISub(n).redMul(l),s=d.redMul(a.redSub(n)),o=d.redMul(l))}else a=r.redAdd(n),u=this.curve._mulC(this.z).redSqr(),l=a.redSub(u).redSub(u),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)},Hr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Hr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),u=s.redAdd(i),l=n.redAdd(r),d=o.redMul(a),p=u.redMul(l),y=o.redMul(l),_=a.redMul(u);return this.curve.point(d,p,_,y)},Hr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),u=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),d=r.redMul(a).redMul(l),p,y;return this.curve.twisted?(p=r.redMul(u).redMul(s.redSub(this.curve._mulA(i))),y=a.redMul(u)):(p=r.redMul(u).redMul(s.redSub(i)),y=this.curve._mulC(a).redMul(u)),this.curve.point(d,p,y)},Hr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Hr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Hr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)},Hr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)},Hr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Hr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Hr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Hr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Hr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Hr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Hr.prototype.toP=Hr.prototype.normalize,Hr.prototype.mixedAdd=Hr.prototype.add,function(t){var e=t;e.base=zd,e.short=pB,e.mont=mB,e.edwards=yB}(i1);var Kd={},o1,o_;function wB(){return o_||(o_=1,o1={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),o1}(function(t){var e=t,r=fl,n=i1,i=Ti,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,d){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var p=new o(d);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:p}),p}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=wB()}catch{u=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})})(Kd);var xB=fl,sc=t1,a_=tc;function da(t){if(!(this instanceof da))return new da(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=sc.toArray(t.entropy,t.entropyEnc||"hex"),r=sc.toArray(t.nonce,t.nonceEnc||"hex"),n=sc.toArray(t.pers,t.persEnc||"hex");a_(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var _B=da;da.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},da.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=sc.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var Vd=xo,c1=Ti,PB=c1.assert;function Gd(t,e){if(t instanceof Gd)return t;this._importDER(t,e)||(PB(t.r&&t.s,"Signature without r or s"),this.r=new Vd(t.r,16),this.s=new Vd(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var MB=Gd;function IB(){this.place=0}function u1(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function c_(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Gd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=c_(r),n=c_(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];f1(i,r.length),i=i.concat(r),i.push(2),f1(i,n.length);var s=i.concat(n),o=[48];return f1(o,s.length),o=o.concat(s),c1.encode(o,e)};var Eo=xo,u_=_B,CB=Ti,l1=Kd,TB=n_,f_=CB.assert,h1=AB,Yd=MB;function Ji(t){if(!(this instanceof Ji))return new Ji(t);typeof t=="string"&&(f_(Object.prototype.hasOwnProperty.call(l1,t),"Unknown curve "+t),t=l1[t]),t instanceof l1.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var RB=Ji;Ji.prototype.keyPair=function(e){return new h1(this,e)},Ji.prototype.keyFromPrivate=function(e,r){return h1.fromPrivate(this,e,r)},Ji.prototype.keyFromPublic=function(e,r){return h1.fromPublic(this,e,r)},Ji.prototype.genKeyPair=function(e){e||(e={});for(var r=new u_({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||TB(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new Eo(2));;){var s=new Eo(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Ji.prototype._truncateToN=function(e,r,n){var i;if(Eo.isBN(e)||typeof e=="number")e=new Eo(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new Eo(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new Eo(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Ji.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new u_({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new Eo(1)),d=0;;d++){var p=i.k?i.k(d):new Eo(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var _=y.getX(),M=_.umod(this.n);if(M.cmpn(0)!==0){var O=p.invm(this.n).mul(M.mul(r.getPrivate()).iadd(e));if(O=O.umod(this.n),O.cmpn(0)!==0){var L=(y.getY().isOdd()?1:0)|(_.cmp(M)!==0?2:0);return i.canonical&&O.cmp(this.nh)>0&&(O=this.n.sub(O),L^=1),new Yd({r:M,s:O,recoveryParam:L})}}}}}},Ji.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new Yd(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),l=u.mul(e).umod(this.n),d=u.mul(o).umod(this.n),p;return this.curve._maxwellTrick?(p=this.g.jmulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.eqXToP(o)):(p=this.g.mulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.getX().umod(this.n).cmp(o)===0)},Ji.prototype.recoverPubKey=function(t,e,r,n){f_((3&r)===r,"The recovery param is more than two bits"),e=new Yd(e,n);var i=this.n,s=new Eo(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Ji.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Yd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var ml=Ti,l_=ml.assert,h_=ml.parseBytes,_u=ml.cachedProperty;function On(t,e){this.eddsa=t,this._secret=h_(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=h_(e.pub)}On.fromPublic=function(e,r){return r instanceof On?r:new On(e,{pub:r})},On.fromSecret=function(e,r){return r instanceof On?r:new On(e,{secret:r})},On.prototype.secret=function(){return this._secret},_u(On,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),_u(On,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),_u(On,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i}),_u(On,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),_u(On,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),_u(On,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),On.prototype.sign=function(e){return l_(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},On.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},On.prototype.getSecret=function(e){return l_(this._secret,"KeyPair is public only"),ml.encode(this.secret(),e)},On.prototype.getPublic=function(e){return ml.encode(this.pubBytes(),e)};var DB=On,OB=xo,Jd=Ti,d_=Jd.assert,Xd=Jd.cachedProperty,NB=Jd.parseBytes;function oc(t,e){this.eddsa=t,typeof e!="object"&&(e=NB(e)),Array.isArray(e)&&(d_(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),d_(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof OB&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Xd(oc,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Xd(oc,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Xd(oc,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Xd(oc,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),oc.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},oc.prototype.toHex=function(){return Jd.encode(this.toBytes(),"hex").toUpperCase()};var LB=oc,kB=fl,BB=Kd,Eu=Ti,$B=Eu.assert,p_=Eu.parseBytes,g_=DB,m_=LB;function mi(t){if($B(t==="ed25519","only tested with ed25519 so far"),!(this instanceof mi))return new mi(t);t=BB[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=kB.sha512}var FB=mi;mi.prototype.sign=function(e,r){e=p_(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),u=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:u,Rencoded:o})},mi.prototype.verify=function(e,r,n){if(e=p_(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)},mi.prototype.hashInt=function(){for(var e=this.hash(),r=0;re in t?qB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,w_=(t,e)=>{for(var r in e||(e={}))zB.call(e,r)&&y_(t,r,e[r]);if(b_)for(var r of b_(e))HB.call(e,r)&&y_(t,r,e[r]);return t};const WB="ReactNative",Ri={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},KB="js";function Zd(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Au(){return!ol()&&!!Am()&&navigator.product===WB}function vl(){return!Zd()&&!!Am()&&!!ol()}function bl(){return Au()?Ri.reactNative:Zd()?Ri.node:vl()?Ri.browser:Ri.unknown}function VB(){var t;try{return Au()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function GB(t,e){let r=al.parse(t);return r=w_(w_({},r),e),t=al.stringify(r),t}function x_(){return t3()||{name:"",description:"",url:"",icons:[""]}}function YB(){if(bl()===Ri.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=xN();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function JB(){var t;const e=bl();return e===Ri.browser?[e,((t=e3())==null?void 0:t.host)||"unknown"].join(":"):e}function __(t,e,r){const n=YB(),i=JB();return[[t,e].join("-"),[KB,r].join("-"),n,i].join("/")}function XB({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const u=r.split("?"),l=__(t,e,n),d={auth:i,ua:l,projectId:s,useOnCloseEvent:o,origin:a||void 0},p=GB(u[1]||"",d);return u[0]+"?"+p}function ac(t,e){return t.filter(r=>e.includes(r)).length===t.length}function E_(t){return Object.fromEntries(t.entries())}function S_(t){return new Map(Object.entries(t))}function cc(t=vt.FIVE_MINUTES,e){const r=vt.toMiliseconds(t||vt.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Pu(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function A_(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function ZB(t){return A_("topic",t)}function QB(t){return A_("id",t)}function P_(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function _n(t,e){return vt.fromMiliseconds(Date.now()+vt.toMiliseconds(t))}function pa(t){return Date.now()>=vt.toMiliseconds(t)}function br(t,e){return`${t}${e?`:${e}`:""}`}function Qd(t=[],e=[]){return[...new Set([...t,...e])]}async function e$({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=t$(s,t,e),a=bl();if(a===Ri.browser){if(!((n=ol())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,n$()?"_blank":"_self","noreferrer noopener")}else a===Ri.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function t$(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${i$(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function r$(t,e){let r="";try{if(vl()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function M_(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function I_(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function d1(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function n$(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function i$(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function C_(t){return Buffer.from(t,"base64").toString("utf-8")}const s$="https://rpc.walletconnect.org/v1";async function o$(t,e,r,n,i,s){switch(r.t){case"eip191":return a$(t,e,r.s);case"eip1271":return await c$(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function a$(t,e,r){return Jk(v3(e),r).toLowerCase()===t.toLowerCase()}async function c$(t,e,r,n,i,s){const o=Su(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",d=r.substring(2),p=v3(e).substring(2),y=a+p+u+l+d,_=await fetch(`${s||s$}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:u$(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:y},"latest"]})}),{result:M}=await _.json();return M?M.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function u$(){return Date.now()+Math.floor(Math.random()*1e3)}var f$=Object.defineProperty,l$=Object.defineProperties,h$=Object.getOwnPropertyDescriptors,T_=Object.getOwnPropertySymbols,d$=Object.prototype.hasOwnProperty,p$=Object.prototype.propertyIsEnumerable,R_=(t,e,r)=>e in t?f$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,g$=(t,e)=>{for(var r in e||(e={}))d$.call(e,r)&&R_(t,r,e[r]);if(T_)for(var r of T_(e))p$.call(e,r)&&R_(t,r,e[r]);return t},m$=(t,e)=>l$(t,h$(e));const v$="did:pkh:",p1=t=>t==null?void 0:t.split(":"),b$=t=>{const e=t&&p1(t);if(e)return t.includes(v$)?e[3]:e[1]},g1=t=>{const e=t&&p1(t);if(e)return e[2]+":"+e[3]},e0=t=>{const e=t&&p1(t);if(e)return e.pop()};async function D_(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=O_(i,i.iss),o=e0(i.iss);return await o$(o,s,n,g1(i.iss),r)}const O_=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=e0(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${b$(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,d=t.exp?`Expiration Time: ${t.exp}`:void 0,p=t.nbf?`Not Before: ${t.nbf}`:void 0,y=t.requestId?`Request ID: ${t.requestId}`:void 0,_=t.resources?`Resources:${t.resources.map(O=>` +- ${O}`).join("")}`:void 0,M=t0(t.resources);if(M){const O=yl(M);i=M$(i,O)}return[r,n,"",i,"",s,o,a,u,l,d,p,y,_].filter(O=>O!=null).join(` +`)};function y$(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function w$(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function uc(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function x$(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:_$(e,r,n)}}}function _$(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function N_(t){return uc(t),`urn:recap:${y$(t).replace(/=/g,"")}`}function yl(t){const e=w$(t.replace("urn:recap:",""));return uc(e),e}function E$(t,e,r){const n=x$(t,e,r);return N_(n)}function S$(t){return t&&t.includes("urn:recap:")}function A$(t,e){const r=yl(t),n=yl(e),i=P$(r,n);return N_(i)}function P$(t,e){uc(t),uc(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,u)=>a.localeCompare(u)).forEach(a=>{var u,l;n.att[i]=m$(g$({},n.att[i]),{[a]:((u=t.att[i])==null?void 0:u[a])||((l=e.att[i])==null?void 0:l[a])})})}),n}function M$(t="",e){uc(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const u=Object.keys(e.att[a]).map(p=>({ability:p.split("/")[0],action:p.split("/")[1]}));u.sort((p,y)=>p.action.localeCompare(y.action));const l={};u.forEach(p=>{l[p.ability]||(l[p.ability]=[]),l[p.ability].push(p.action)});const d=Object.keys(l).map(p=>(i++,`(${i}) '${p}': '${l[p].join("', '")}' for '${a}'.`));n.push(d.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function L_(t){var e;const r=yl(t);uc(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function k_(t){const e=yl(t);uc(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function t0(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return S$(e)?e:void 0}const B_="base10",ri="base16",ga="base64pad",wl="base64url",xl="utf8",$_=0,So=1,_l=2,I$=0,F_=1,El=12,m1=32;function C$(){const t=Qm.generateKeyPair();return{privateKey:In(t.secretKey,ri),publicKey:In(t.publicKey,ri)}}function v1(){const t=sa.randomBytes(m1);return In(t,ri)}function T$(t,e){const r=Qm.sharedKey(Cn(t,ri),Cn(e,ri),!0),n=new uB(pl.SHA256,r).expand(m1);return In(n,ri)}function r0(t){const e=pl.hash(Cn(t,ri));return In(e,ri)}function Ao(t){const e=pl.hash(Cn(t,xl));return In(e,ri)}function j_(t){return Cn(`${t}`,B_)}function fc(t){return Number(In(t,B_))}function R$(t){const e=j_(typeof t.type<"u"?t.type:$_);if(fc(e)===So&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Cn(t.senderPublicKey,ri):void 0,n=typeof t.iv<"u"?Cn(t.iv,ri):sa.randomBytes(El),i=new Jm.ChaCha20Poly1305(Cn(t.symKey,ri)).seal(n,Cn(t.message,xl));return U_({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function D$(t,e){const r=j_(_l),n=sa.randomBytes(El),i=Cn(t,xl);return U_({type:r,sealed:i,iv:n,encoding:e})}function O$(t){const e=new Jm.ChaCha20Poly1305(Cn(t.symKey,ri)),{sealed:r,iv:n}=Sl({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return In(i,xl)}function N$(t,e){const{sealed:r}=Sl({encoded:t,encoding:e});return In(r,xl)}function U_(t){const{encoding:e=ga}=t;if(fc(t.type)===_l)return In(Pd([t.type,t.sealed]),e);if(fc(t.type)===So){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return In(Pd([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return In(Pd([t.type,t.iv,t.sealed]),e)}function Sl(t){const{encoded:e,encoding:r=ga}=t,n=Cn(e,r),i=n.slice(I$,F_),s=F_;if(fc(i)===So){const l=s+m1,d=l+El,p=n.slice(s,l),y=n.slice(l,d),_=n.slice(d);return{type:i,sealed:_,iv:y,senderPublicKey:p}}if(fc(i)===_l){const l=n.slice(s),d=sa.randomBytes(El);return{type:i,sealed:l,iv:d}}const o=s+El,a=n.slice(s,o),u=n.slice(o);return{type:i,sealed:u,iv:a}}function L$(t,e){const r=Sl({encoded:t,encoding:e==null?void 0:e.encoding});return q_({type:fc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?In(r.senderPublicKey,ri):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function q_(t){const e=(t==null?void 0:t.type)||$_;if(e===So){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function z_(t){return t.type===So&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function H_(t){return t.type===_l}function k$(t){return new t_.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function B$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function $$(t){return Buffer.from(B$(t),"base64")}function F$(t,e){const[r,n,i]=t.split("."),s=$$(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),u=`${r}.${n}`,l=new pl.SHA256().update(Buffer.from(u)).digest(),d=k$(e),p=Buffer.from(l).toString("hex");if(!d.verify(p,{r:o,s:a}))throw new Error("Invalid signature");return Sm(t).payload}const j$="irn";function b1(t){return(t==null?void 0:t.relay)||{protocol:j$}}function Al(t){const e=jB[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var U$=Object.defineProperty,q$=Object.defineProperties,z$=Object.getOwnPropertyDescriptors,W_=Object.getOwnPropertySymbols,H$=Object.prototype.hasOwnProperty,W$=Object.prototype.propertyIsEnumerable,K_=(t,e,r)=>e in t?U$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,V_=(t,e)=>{for(var r in e||(e={}))H$.call(e,r)&&K_(t,r,e[r]);if(W_)for(var r of W_(e))W$.call(e,r)&&K_(t,r,e[r]);return t},K$=(t,e)=>q$(t,z$(e));function V$(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function G_(t){if(!t.includes("wc:")){const u=C_(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=al.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:G$(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:V$(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function G$(t){return t.startsWith("//")?t.substring(2):t}function Y$(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function Y_(t){return`${t.protocol}:${t.topic}@${t.version}?`+al.stringify(V_(K$(V_({symKey:t.symKey},Y$(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function n0(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Mu(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function J$(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Mu(r.accounts))}),e}function X$(t,e){const r=[];return Object.values(t).forEach(n=>{Mu(n.accounts).includes(e)&&r.push(...n.methods)}),r}function Z$(t,e){const r=[];return Object.values(t).forEach(n=>{Mu(n.accounts).includes(e)&&r.push(...n.events)}),r}function y1(t){return t.includes(":")}function Pl(t){return y1(t)?t.split(":")[0]:t}function Q$(t){const e={};return t==null||t.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function J_(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=Q$(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=Qd(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const eF={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},tF={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ut(t,e){const{message:r,code:n}=tF[t];return{message:e?`${r} ${e}`:r,code:n}}function Dr(t,e){const{message:r,code:n}=eF[t];return{message:e?`${r} ${e}`:r,code:n}}function lc(t,e){return!!Array.isArray(t)}function Ml(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function vi(t){return typeof t>"u"}function on(t,e){return e&&vi(t)?!0:typeof t=="string"&&!!t.trim().length}function w1(t,e){return typeof t=="number"&&!isNaN(t)}function rF(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return ac(i,n)?(n.forEach(o=>{const{accounts:a,methods:u,events:l}=t.namespaces[o],d=Mu(a),p=r[o];(!ac(v_(o,p),d)||!ac(p.methods,u)||!ac(p.events,l))&&(s=!1)}),s):!1}function i0(t){return on(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function nF(t){if(on(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&i0(r)}}return!1}function iF(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(on(t,!1)){if(e(t))return!0;const r=C_(t);return e(r)}}catch{}return!1}function sF(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function oF(t){return t==null?void 0:t.topic}function aF(t,e){let r=null;return on(t==null?void 0:t.publicKey,!1)||(r=ut("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function X_(t){let e=!0;return lc(t)?t.length&&(e=t.every(r=>on(r,!1))):e=!1,e}function cF(t,e,r){let n=null;return lc(e)&&e.length?e.forEach(i=>{n||i0(i)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):i0(t)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function uF(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=cF(i,v_(i,s),`${e} ${r}`);o&&(n=o)}),n}function fF(t,e){let r=null;return lc(t)?t.forEach(n=>{r||nF(n)||(r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function lF(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=fF(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function hF(t,e){let r=null;return X_(t==null?void 0:t.methods)?X_(t==null?void 0:t.events)||(r=Dr("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Dr("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function Z_(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=hF(n,`${e}, namespace`);i&&(r=i)}),r}function dF(t,e,r){let n=null;if(t&&Ml(t)){const i=Z_(t,e);i&&(n=i);const s=uF(t,e,r);s&&(n=s)}else n=ut("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function x1(t,e){let r=null;if(t&&Ml(t)){const n=Z_(t,e);n&&(r=n);const i=lF(t,e);i&&(r=i)}else r=ut("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function Q_(t){return on(t.protocol,!0)}function pF(t,e){let r=!1;return t?t&&lc(t)&&t.length&&t.forEach(n=>{r=Q_(n)}):r=!0,r}function gF(t){return typeof t=="number"}function bi(t){return typeof t<"u"&&typeof t!==null}function mF(t){return!(!t||typeof t!="object"||!t.code||!w1(t.code)||!t.message||!on(t.message,!1))}function vF(t){return!(vi(t)||!on(t.method,!1))}function bF(t){return!(vi(t)||vi(t.result)&&vi(t.error)||!w1(t.id)||!on(t.jsonrpc,!1))}function yF(t){return!(vi(t)||!on(t.name,!1))}function e6(t,e){return!(!i0(e)||!J$(t).includes(e))}function wF(t,e,r){return on(r,!1)?X$(t,e).includes(r):!1}function xF(t,e,r){return on(r,!1)?Z$(t,e).includes(r):!1}function t6(t,e,r){let n=null;const i=_F(t),s=EF(e),o=Object.keys(i),a=Object.keys(s),u=r6(Object.keys(t)),l=r6(Object.keys(e)),d=u.filter(p=>!l.includes(p));return d.length&&(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${d.toString()} - Received: ${Object.keys(e).toString()}`)),oc(o,a)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. + Received: ${Object.keys(e).toString()}`)),ac(o,a)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} Approved: ${a.toString()}`)),Object.keys(e).forEach(p=>{if(!p.includes(":")||n)return;const y=Mu(e[p].accounts);y.includes(p)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${p} Required: ${p} - Approved: ${y.toString()}`))}),o.forEach(p=>{n||(oc(i[p].methods,s[p].methods)?oc(i[p].events,s[p].events)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${p}`)):n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${p}`))}),n}function xF(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function r6(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function _F(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Mu(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function EF(t,e){return w1(t)&&t<=e.max&&t>=e.min}function n6(){const t=bl();return new Promise(e=>{switch(t){case Ri.browser:e(SF());break;case Ri.reactNative:e(AF());break;case Ri.node:e(PF());break;default:e(!0)}})}function SF(){return vl()&&(navigator==null?void 0:navigator.onLine)}async function AF(){if(Au()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function PF(){return!0}function MF(t){switch(bl()){case Ri.browser:IF(t);break;case Ri.reactNative:CF(t);break}}function IF(t){!Au()&&vl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function CF(t){Au()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const _1={};class Il{static get(e){return _1[e]}static set(e,r){_1[e]=r}static delete(e){delete _1[e]}}const TF="PARSE_ERROR",RF="INVALID_REQUEST",DF="METHOD_NOT_FOUND",OF="INVALID_PARAMS",i6="INTERNAL_ERROR",E1="SERVER_ERROR",NF=[-32700,-32600,-32601,-32602,-32603],Cl={[TF]:{code:-32700,message:"Parse error"},[RF]:{code:-32600,message:"Invalid Request"},[DF]:{code:-32601,message:"Method not found"},[OF]:{code:-32602,message:"Invalid params"},[i6]:{code:-32603,message:"Internal error"},[E1]:{code:-32e3,message:"Server error"}},s6=E1;function LF(t){return NF.includes(t)}function o6(t){return Object.keys(Cl).includes(t)?Cl[t]:Cl[s6]}function kF(t){const e=Object.values(Cl).find(r=>r.code===t);return e||Cl[s6]}function a6(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var c6={},Po={},u6;function BF(){if(u6)return Po;u6=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.isBrowserCryptoAvailable=Po.getSubtleCrypto=Po.getBrowerCrypto=void 0;function t(){return(nn==null?void 0:nn.crypto)||(nn==null?void 0:nn.msCrypto)||{}}Po.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Po.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Po.isBrowserCryptoAvailable=r,Po}var Mo={},f6;function $F(){if(f6)return Mo;f6=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.isBrowser=Mo.isNode=Mo.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Mo.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Mo.isNode=e;function r(){return!t()&&!e()}return Mo.isBrowser=r,Mo}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Jf;e.__exportStar(BF(),t),e.__exportStar($F(),t)})(c6);function ma(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function lc(t=6){return BigInt(ma(t))}function va(t,e,r){return{id:r||ma(),jsonrpc:"2.0",method:t,params:e}}function s0(t,e){return{id:t,jsonrpc:"2.0",result:e}}function o0(t,e,r){return{id:t,jsonrpc:"2.0",error:FF(e)}}function FF(t,e){return typeof t>"u"?o6(i6):(typeof t=="string"&&(t=Object.assign(Object.assign({},o6(E1)),{message:t})),LF(t.code)&&(t=kF(t.code)),t)}let jF=class{},UF=class extends jF{constructor(){super()}},qF=class extends UF{constructor(e){super()}};const zF="^https?:",HF="^wss?:";function WF(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function l6(t,e){const r=WF(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function h6(t){return l6(t,zF)}function d6(t){return l6(t,HF)}function KF(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function p6(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function S1(t){return p6(t)&&"method"in t}function a0(t){return p6(t)&&(Gs(t)||Xi(t))}function Gs(t){return"result"in t}function Xi(t){return"error"in t}let Zi=class extends qF{constructor(e){super(e),this.events=new Hi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(va(e.method,e.params||[],e.id||lc().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Xi(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),a0(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const VF=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),GF=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",g6=t=>t.split("?")[0],m6=10,YF=VF();let JF=class{constructor(e){if(this.url=e,this.events=new Hi.EventEmitter,this.registering=!1,!d6(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(mo(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!d6(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=c6.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!KF(e)},o=new YF(e,[],s);GF()?o.onerror=a=>{const u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Za(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=o0(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return a6(e,g6(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>m6&&this.events.setMaxListeners(m6)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${g6(this.url)}`));return this.events.emit("register_error",r),r}};var c0={exports:{}};c0.exports,function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",u="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",p="[object Date]",y="[object Error]",_="[object Function]",M="[object GeneratorFunction]",O="[object Map]",L="[object Number]",B="[object Null]",k="[object Object]",H="[object Promise]",U="[object Proxy]",z="[object RegExp]",Z="[object Set]",R="[object String]",W="[object Symbol]",ie="[object Undefined]",me="[object WeakMap]",j="[object ArrayBuffer]",E="[object DataView]",m="[object Float32Array]",f="[object Float64Array]",g="[object Int8Array]",v="[object Int16Array]",x="[object Int32Array]",S="[object Uint8Array]",A="[object Uint8ClampedArray]",b="[object Uint16Array]",P="[object Uint32Array]",I=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,ce=/^(?:0|[1-9]\d*)$/,D={};D[m]=D[f]=D[g]=D[v]=D[x]=D[S]=D[A]=D[b]=D[P]=!0,D[a]=D[u]=D[j]=D[d]=D[E]=D[p]=D[y]=D[_]=D[O]=D[L]=D[k]=D[z]=D[Z]=D[R]=D[me]=!1;var se=typeof nn=="object"&&nn&&nn.Object===Object&&nn,ee=typeof self=="object"&&self&&self.Object===Object&&self,J=se||ee||Function("return this")(),Q=e&&!e.nodeType&&e,T=Q&&!0&&t&&!t.nodeType&&t,X=T&&T.exports===Q,re=X&&se.process,ge=function(){try{return re&&re.binding&&re.binding("util")}catch{}}(),oe=ge&&ge.isTypedArray;function fe(ue,we){for(var Ye=-1,It=ue==null?0:ue.length,jr=0,ir=[];++Ye-1}function st(ue,we){var Ye=this.__data__,It=Xe(Ye,ue);return It<0?(++this.size,Ye.push([ue,we])):Ye[It][1]=we,this}Re.prototype.clear=De,Re.prototype.delete=it,Re.prototype.get=Ue,Re.prototype.has=mt,Re.prototype.set=st;function tt(ue){var we=-1,Ye=ue==null?0:ue.length;for(this.clear();++wewn))return!1;var Ur=ir.get(ue);if(Ur&&ir.get(we))return Ur==we;var pn=-1,xi=!0,xn=Ye&s?new _t:void 0;for(ir.set(ue,we),ir.set(we,ue);++pn-1&&ue%1==0&&ue-1&&ue%1==0&&ue<=o}function xp(ue){var we=typeof ue;return ue!=null&&(we=="object"||we=="function")}function Dc(ue){return ue!=null&&typeof ue=="object"}var _p=oe?Te(oe):pr;function Xb(ue){return Yb(ue)?qe(ue):gr(ue)}function Fr(){return[]}function kr(){return!1}t.exports=Jb}(c0,c0.exports);var XF=c0.exports;const ZF=ji(XF),v6="wc",b6=2,y6="core",Ys=`${v6}@2:${y6}:`,QF={logger:"error"},ej={database:":memory:"},tj="crypto",w6="client_ed25519_seed",rj=vt.ONE_DAY,nj="keychain",ij="0.3",sj="messages",oj="0.3",aj=vt.SIX_HOURS,cj="publisher",x6="irn",uj="error",_6="wss://relay.walletconnect.org",fj="relayer",ni={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},lj="_subscription",Qi={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},hj=.1,A1="2.17.2",Wr={link_mode:"link_mode",relay:"relay"},dj="0.3",pj="WALLETCONNECT_CLIENT_ID",E6="WALLETCONNECT_LINK_MODE_APPS",Js={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},gj="subscription",mj="0.3",vj=vt.FIVE_SECONDS*1e3,bj="pairing",yj="0.3",Tl={wc_pairingDelete:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:vt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:vt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:0},res:{ttl:vt.ONE_DAY,prompt:!1,tag:0}}},hc={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},xs={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},wj="history",xj="0.3",_j="expirer",es={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},Ej="0.3",Sj="verify-api",Aj="https://verify.walletconnect.com",S6="https://verify.walletconnect.org",Rl=S6,Pj=`${Rl}/v3`,Mj=[Aj,S6],Ij="echo",Cj="https://echo.walletconnect.com",Xs={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},Io={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},_s={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},dc={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},pc={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Dl={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},Tj=.1,Rj="event-client",Dj=86400,Oj="https://pulse.walletconnect.org/batch";function Nj(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(H);B!==k;){for(var z=M[B],Z=0,R=H-1;(z!==0||Z>>0,U[R]=z%a>>>0,z=z/a>>>0;if(z!==0)throw new Error("Non-zero carry");L=Z,B++}for(var W=H-L;W!==H&&U[W]===0;)W++;for(var ie=u.repeat(O);W>>0,H=new Uint8Array(k);M[O];){var U=r[M.charCodeAt(O)];if(U===255)return;for(var z=0,Z=k-1;(U!==0||z>>0,H[Z]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");B=z,O++}if(M[O]!==" "){for(var R=k-B;R!==k&&H[R]===0;)R++;for(var W=new Uint8Array(L+(k-R)),ie=L;R!==k;)W[ie++]=H[R++];return W}}}function _(M){var O=y(M);if(O)return O;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:_}}var Lj=Nj,kj=Lj;const A6=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},Bj=t=>new TextEncoder().encode(t),$j=t=>new TextDecoder().decode(t);class Fj{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class jj{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return P6(this,e)}}class Uj{constructor(e){this.decoders=e}or(e){return P6(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const P6=(t,e)=>new Uj({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class qj{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Fj(e,r,n),this.decoder=new jj(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const u0=({name:t,prefix:e,encode:r,decode:n})=>new qj(t,e,r,n),Ol=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=kj(r,e);return u0({prefix:t,name:e,encode:n,decode:s=>A6(i(s))})},zj=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},Hj=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<u0({prefix:e,name:t,encode(i){return Hj(i,n,r)},decode(i){return zj(i,n,r,t)}}),Wj=u0({prefix:"\0",name:"identity",encode:t=>$j(t),decode:t=>Bj(t)});var Kj=Object.freeze({__proto__:null,identity:Wj});const Vj=jn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Gj=Object.freeze({__proto__:null,base2:Vj});const Yj=jn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Jj=Object.freeze({__proto__:null,base8:Yj});const Xj=Ol({prefix:"9",name:"base10",alphabet:"0123456789"});var Zj=Object.freeze({__proto__:null,base10:Xj});const Qj=jn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),eU=jn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var tU=Object.freeze({__proto__:null,base16:Qj,base16upper:eU});const rU=jn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),nU=jn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),iU=jn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),sU=jn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),oU=jn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),aU=jn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),cU=jn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),uU=jn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),fU=jn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var lU=Object.freeze({__proto__:null,base32:rU,base32upper:nU,base32pad:iU,base32padupper:sU,base32hex:oU,base32hexupper:aU,base32hexpad:cU,base32hexpadupper:uU,base32z:fU});const hU=Ol({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),dU=Ol({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var pU=Object.freeze({__proto__:null,base36:hU,base36upper:dU});const gU=Ol({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mU=Ol({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var vU=Object.freeze({__proto__:null,base58btc:gU,base58flickr:mU});const bU=jn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),yU=jn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wU=jn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),xU=jn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var _U=Object.freeze({__proto__:null,base64:bU,base64pad:yU,base64url:wU,base64urlpad:xU});const M6=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),EU=M6.reduce((t,e,r)=>(t[r]=e,t),[]),SU=M6.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function AU(t){return t.reduce((e,r)=>(e+=EU[r],e),"")}function PU(t){const e=[];for(const r of t){const n=SU[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const MU=u0({prefix:"🚀",name:"base256emoji",encode:AU,decode:PU});var IU=Object.freeze({__proto__:null,base256emoji:MU}),CU=C6,I6=128,TU=127,RU=~TU,DU=Math.pow(2,31);function C6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=DU;)e[r++]=t&255|I6,t/=128;for(;t&RU;)e[r++]=t&255|I6,t>>>=7;return e[r]=t|0,C6.bytes=r-n+1,e}var OU=P1,NU=128,T6=127;function P1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw P1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&T6)<=NU);return P1.bytes=s-n,r}var LU=Math.pow(2,7),kU=Math.pow(2,14),BU=Math.pow(2,21),$U=Math.pow(2,28),FU=Math.pow(2,35),jU=Math.pow(2,42),UU=Math.pow(2,49),qU=Math.pow(2,56),zU=Math.pow(2,63),HU=function(t){return t(R6.encode(t,e,r),e),O6=t=>R6.encodingLength(t),M1=(t,e)=>{const r=e.byteLength,n=O6(t),i=n+O6(r),s=new Uint8Array(i+r);return D6(t,s,0),D6(r,s,n),s.set(e,i),new KU(t,r,e,s)};class KU{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const N6=({name:t,code:e,encode:r})=>new VU(t,e,r);class VU{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?M1(this.code,r):r.then(n=>M1(this.code,n))}else throw Error("Unknown type, must be binary type")}}const L6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),GU=N6({name:"sha2-256",code:18,encode:L6("SHA-256")}),YU=N6({name:"sha2-512",code:19,encode:L6("SHA-512")});var JU=Object.freeze({__proto__:null,sha256:GU,sha512:YU});const k6=0,XU="identity",B6=A6;var ZU=Object.freeze({__proto__:null,identity:{code:k6,name:XU,encode:B6,digest:t=>M1(k6,B6(t))}});new TextEncoder,new TextDecoder;const $6={...Kj,...Gj,...Jj,...Zj,...tU,...lU,...pU,...vU,..._U,...IU};({...JU,...ZU});function QU(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function F6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const j6=F6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),I1=F6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=QU(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=ut("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=ti(r,this.name)}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,E_(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?S_(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}},nq=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=tj,this.randomSessionIdentifier=v1(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=Jx(i);return Yx(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=I$();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=Jx(s),a=this.randomSessionIdentifier;return await lN(a,i,rj,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),u=C$(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||r0(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=q_(o),u=mo(s);if(H_(a))return R$(u,o==null?void 0:o.encoding);if(z_(a)){const y=a.senderPublicKey,_=a.receiverPublicKey;i=await this.generateSharedKey(y,_)}const l=this.getSymKey(i),{type:d,senderPublicKey:p}=a;return T$({type:d,symKey:l,message:u,senderPublicKey:p,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=N$(s,o);if(H_(a)){const u=O$(s,o==null?void 0:o.encoding);return Za(u)}if(z_(a)){const u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{const u=this.getSymKey(i),l=D$({symKey:u,encoded:s,encoding:o==null?void 0:o.encoding});return Za(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=(i,s=ga)=>{const o=Sl({encoded:i,encoding:s});return uc(o.type)},this.getPayloadSenderPublicKey=(i,s=ga)=>{const o=Sl({encoded:i,encoding:s});return o.senderPublicKey?In(o.senderPublicKey,ri):void 0},this.core=e,this.logger=ti(r,this.name),this.keychain=n||new rq(this.core,this.logger)}get context(){return pi(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(w6)}catch{e=v1(),await this.keychain.set(w6,e)}return tq(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}};class iq extends yD{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=sj,this.version=oj,this.initialized=!1,this.storagePrefix=Ys,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Ao(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Ao(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=ti(e,this.name),this.core=r}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,E_(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?S_(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class sq extends wD{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new Hi.EventEmitter,this.name=cj,this.queue=new Map,this.publishTimeout=vt.toMiliseconds(vt.ONE_MINUTE),this.failedPublishTimeout=vt.toMiliseconds(vt.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||aj,u=b1(s),l=(s==null?void 0:s.prompt)||!1,d=(s==null?void 0:s.tag)||0,p=(s==null?void 0:s.id)||lc().toString(),y={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:d,id:p,attestation:s==null?void 0:s.attestation}},_=`Failed to publish payload, please try again. id:${p} tag:${d}`,M=Date.now();let O,L=1;try{for(;O===void 0;){if(Date.now()-M>this.publishTimeout)throw new Error(_);this.logger.trace({id:p,attempts:L},`publisher.publish - attempt ${L}`),O=await await Pu(this.rpcPublish(n,i,a,u,l,d,p,s==null?void 0:s.attestation).catch(B=>this.logger.warn(B)),this.publishTimeout,_),L++,O||await new Promise(B=>setTimeout(B,this.failedPublishTimeout))}this.relayer.events.emit(ni.publish,y),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:p,topic:n,message:i,opts:s}})}catch(B){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(B),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw B;this.queue.set(p,y)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=ti(r,this.name),this.registerEventListeners()}get context(){return pi(this.logger)}rpcPublish(e,r,n,i,s,o,a,u){var l,d,p,y;const _={method:Al(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:u},id:a};return vi((l=_.params)==null?void 0:l.prompt)&&((d=_.params)==null||delete d.prompt),vi((p=_.params)==null?void 0:p.tag)&&((y=_.params)==null||delete y.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:_}),this.relayer.request(_)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(su.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ni.connection_stalled);return}this.checkQueue()}),this.relayer.on(ni.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class oq{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var aq=Object.defineProperty,cq=Object.defineProperties,uq=Object.getOwnPropertyDescriptors,U6=Object.getOwnPropertySymbols,fq=Object.prototype.hasOwnProperty,lq=Object.prototype.propertyIsEnumerable,q6=(t,e,r)=>e in t?aq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Nl=(t,e)=>{for(var r in e||(e={}))fq.call(e,r)&&q6(t,r,e[r]);if(U6)for(var r of U6(e))lq.call(e,r)&&q6(t,r,e[r]);return t},C1=(t,e)=>cq(t,uq(e));class hq extends ED{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new oq,this.events=new Hi.EventEmitter,this.name=gj,this.version=mj,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Ys,this.subscribeTimeout=vt.toMiliseconds(vt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=b1(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new vt.Watch;a.start(i);const u=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(u),a.stop(i),s(!0)),a.elapsed(i)>=vj&&(clearInterval(u),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ti(r,this.name),this.clientId=""}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=b1(n);await this.rpcUnsubscribe(e,r,i);const s=Dr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===Wr.relay&&await this.restartToComplete();const s={method:Al(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=Ao(e+this.clientId);if((n==null?void 0:n.transportType)===Wr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},vt.toMiliseconds(vt.ONE_SECOND)),a;const u=await Pu(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return u?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ni.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:Al(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Pu(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(ni.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:Al(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Pu(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(ni.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:Al(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,C1(Nl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Nl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Nl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Js.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Js.deleted,C1(Nl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Js.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);fc(r)&&this.onBatchSubscribe(r.map((n,i)=>C1(Nl({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(su.pulse,async()=>{await this.checkPending()}),this.events.on(Js.created,async e=>{const r=Js.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Js.deleted,async e=>{const r=Js.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var dq=Object.defineProperty,z6=Object.getOwnPropertySymbols,pq=Object.prototype.hasOwnProperty,gq=Object.prototype.propertyIsEnumerable,H6=(t,e,r)=>e in t?dq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,W6=(t,e)=>{for(var r in e||(e={}))pq.call(e,r)&&H6(t,r,e[r]);if(z6)for(var r of z6(e))gq.call(e,r)&&H6(t,r,e[r]);return t};class mq extends xD{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Hi.EventEmitter,this.name=fj,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=vt.toMiliseconds(vt.THIRTY_SECONDS+vt.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||lc().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(u,l)=>{const d=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Qi.disconnect,d);const p=await o;this.provider.off(Qi.disconnect,d),u(p)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(Zd())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(ni.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ni.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Qi.payload,this.onPayloadHandler),this.provider.on(Qi.connect,this.onConnectHandler),this.provider.on(Qi.disconnect,this.onDisconnectHandler),this.provider.on(Qi.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ti(e.logger,this.name):rl(bd({level:e.logger||uj})),this.messages=new iq(this.logger,e.core),this.subscriber=new hq(this,this.logger),this.publisher=new sq(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||_6,this.projectId=e.projectId,this.bundleId=KB(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return pi(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Wr.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",u;const l=d=>{d.topic===e&&(this.subscriber.off(Js.created,l),u())};return await Promise.all([new Promise(d=>{u=d,this.subscriber.on(Js.created,l)}),new Promise(async(d,p)=>{a=await this.subscriber.subscribe(e,W6({internal:{throwOnFailedPublish:o}},r)).catch(y=>{o&&p(y)})||a,d()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Pu(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Qi.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Qi.disconnect,i),await Pu(this.provider.connect(),vt.toMiliseconds(vt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await n6())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=_n(vt.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(ni.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(Zd())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Zi(new JF(JB({sdkVersion:A1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),S1(e)){if(!e.method.endsWith(lj))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:Wr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(W6({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else a0(e)&&this.events.emit(ni.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ni.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=s0(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Qi.payload,this.onPayloadHandler),this.provider.off(Qi.connect,this.onConnectHandler),this.provider.off(Qi.disconnect,this.onDisconnectHandler),this.provider.off(Qi.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await n6();MF(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(ni.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},vt.toMiliseconds(hj))))}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var vq=Object.defineProperty,K6=Object.getOwnPropertySymbols,bq=Object.prototype.hasOwnProperty,yq=Object.prototype.propertyIsEnumerable,V6=(t,e,r)=>e in t?vq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,G6=(t,e)=>{for(var r in e||(e={}))bq.call(e,r)&&V6(t,r,e[r]);if(K6)for(var r of K6(e))yq.call(e,r)&&V6(t,r,e[r]);return t};class gc extends _D{constructor(e,r,n,i=Ys,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=dj,this.cached=[],this.initialized=!1,this.storagePrefix=Ys,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!vi(o)?this.map.set(this.getKey(o),o):iF(o)?this.map.set(o.id,o):sF(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>ZF(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const u=G6(G6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=ti(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class wq{constructor(e,r){this.core=e,this.logger=r,this.name=bj,this.version=yj,this.events=new im,this.initialized=!1,this.storagePrefix=Ys,this.ignoredPayloadTypes=[So],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=v1(),s=await this.core.crypto.setSymKey(i),o=_n(vt.FIVE_MINUTES),a={protocol:x6},u={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=Y_({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(hc.create,u),this.core.expirer.set(s,o),await this.pairings.set(s,u),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Xs.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:u,methods:l}=G_(n.uri);i.props.properties.topic=s,i.addTrace(Xs.pairing_uri_validation_success),i.addTrace(Xs.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(Xs.existing_pairing),d.active)throw i.setError(Io.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Xs.pairing_not_expired)}const p=u||_n(vt.FIVE_MINUTES),y={topic:s,relay:a,expiry:p,active:!1,methods:l};this.core.expirer.set(s,p),await this.pairings.set(s,y),i.addTrace(Xs.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(hc.create,y),i.addTrace(Xs.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Xs.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Io.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(_){throw i.setError(Io.subscribe_pairing_topic_failure),_}return i.addTrace(Xs.subscribe_pairing_topic_success),y},this.activate=async({topic:n})=>{this.isInitialized();const i=_n(vt.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=ac();this.events.once(br("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Dr("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,u=this.core.crypto.keychain.get(i);return Y_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:u,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=va(i,s),a=await this.core.crypto.encode(n,o),u=Tl[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{const o=s0(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Tl[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=o0(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Tl[u.request.method]?Tl[u.request.method].res:Tl.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Dr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>pa(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(hc.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{Gs(i)?this.events.emit(br("pairing_ping",s),{}):Xi(i)&&this.events.emit(br("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(hc.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Dr("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Dr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!bi(n)){const{message:a}=ut("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!nF(n.uri)){const{message:a}=ut("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}const o=G_(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&vt.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!bi(n)){const{message:s}=ut("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!bi(n)){const{message:s}=ut("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!on(n,!1)){const{message:i}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(pa(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ut("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=ti(r,this.name),this.pairings=new gc(this.core,this.logger,this.name,this.storagePrefix)}get context(){return pi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ni.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===Wr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{S1(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):a0(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(es.expired,async e=>{const{topic:r}=P_(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(hc.expire,{topic:r}))})}}class xq extends bD{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new Hi.EventEmitter,this.name=wj,this.version=xj,this.cached=[],this.initialized=!1,this.storagePrefix=Ys,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:_n(vt.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(xs.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Xi(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(xs.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(xs.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ti(r,this.name)}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:va(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(xs.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(xs.created,e=>{const r=xs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(xs.updated,e=>{const r=xs.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(xs.deleted,e=>{const r=xs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(su.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{vt.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(xs.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class _q extends SD{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new Hi.EventEmitter,this.name=_j,this.version=Ej,this.cached=[],this.initialized=!1,this.storagePrefix=Ys,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(es.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(es.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ti(r,this.name)}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return XB(e);if(typeof e=="number")return ZB(e);const{message:r}=ut("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(es.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;vt.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(es.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(su.pulse,()=>this.checkExpirations()),this.events.on(es.created,e=>{const r=es.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(es.expired,e=>{const r=es.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(es.deleted,e=>{const r=es.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Eq extends AD{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=Sj,this.verifyUrlV3=Pj,this.storagePrefix=Ys,this.version=b6,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&vt.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!vl()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,u=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=ol(),d=this.startAbortTimer(vt.ONE_SECOND*5),p=await new Promise((y,_)=>{const M=()=>{window.removeEventListener("message",L),l.body.removeChild(O),_("attestation aborted")};this.abortController.signal.addEventListener("abort",M);const O=l.createElement("iframe");O.src=u,O.style.display="none",O.addEventListener("error",M,{signal:this.abortController.signal});const L=B=>{if(B.data&&typeof B.data=="string")try{const k=JSON.parse(B.data);if(k.type==="verify_attestation"){if(Sm(k.attestation).payload.id!==o)return;clearInterval(d),l.body.removeChild(O),this.abortController.signal.removeEventListener("abort",M),window.removeEventListener("message",L),y(k.attestation===null?"":k.attestation)}}catch(k){this.logger.warn(k)}};l.body.appendChild(O),window.addEventListener("message",L,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",p),p}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(Sm(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const u=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,u)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(vt.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Rl;return Mj.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Rl}`),s=Rl),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(vt.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=$$(i,s.publicKey),a={hasExpired:vt.toMiliseconds(o.exp)this.abortController.abort(),vt.toMiliseconds(e))}}class Sq extends PD{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=Ij,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${Cj}/${this.projectId}/clients`;await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=ti(r,this.context)}}var Aq=Object.defineProperty,Y6=Object.getOwnPropertySymbols,Pq=Object.prototype.hasOwnProperty,Mq=Object.prototype.propertyIsEnumerable,J6=(t,e,r)=>e in t?Aq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ll=(t,e)=>{for(var r in e||(e={}))Pq.call(e,r)&&J6(t,r,e[r]);if(Y6)for(var r of Y6(e))Mq.call(e,r)&&J6(t,r,e[r]);return t};class Iq extends MD{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=Rj,this.storagePrefix=Ys,this.storageVersion=Tj,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!d1())try{const i={eventId:I_(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:__(this.core.relayer.protocol,this.core.relayer.version,A1)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:u}}=i,l=I_(),d=this.core.projectId||"",p=Date.now(),y=Ll({eventId:l,timestamp:p,props:{event:s,type:o,properties:{topic:a,trace:u}},bundleId:d,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,y),this.shouldPersist=!0),y},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(u=>u.props.properties.topic===o);if(a)return Ll(Ll({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(su.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{vt.fromMiliseconds(Date.now())-vt.fromMiliseconds(i.timestamp)>Dj&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Ll(Ll({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${Oj}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${A1}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>x_().url,this.logger=ti(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var Cq=Object.defineProperty,X6=Object.getOwnPropertySymbols,Tq=Object.prototype.hasOwnProperty,Rq=Object.prototype.propertyIsEnumerable,Z6=(t,e,r)=>e in t?Cq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Q6=(t,e)=>{for(var r in e||(e={}))Tq.call(e,r)&&Z6(t,r,e[r]);if(X6)for(var r of X6(e))Rq.call(e,r)&&Z6(t,r,e[r]);return t};class T1 extends vD{constructor(e){var r;super(e),this.protocol=v6,this.version=b6,this.name=y6,this.events=new Hi.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:u})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:Wr.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||_6,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=bd({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:QF.logger}),{logger:i,chunkLoggerController:s}=mD({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ti(i,this.name),this.heartbeat=new fR,this.crypto=new nq(this,this.logger,e==null?void 0:e.keychain),this.history=new xq(this,this.logger),this.expirer=new _q(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new qR(Q6(Q6({},ej),e==null?void 0:e.storageOptions)),this.relayer=new mq({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new wq(this,this.logger),this.verify=new Eq(this,this.logger,this.storage),this.echoClient=new Sq(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new Iq(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new T1(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(pj,n),r}get context(){return pi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(E6,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(E6)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const Dq=T1,e5="wc",t5=2,r5="client",R1=`${e5}@${t5}:${r5}:`,D1={name:r5,logger:"error"},n5="WALLETCONNECT_DEEPLINK_CHOICE",Oq="proposal",i5="Proposal expired",Nq="session",Iu=vt.SEVEN_DAYS,Lq="engine",Nn={wc_sessionPropose:{req:{ttl:vt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:vt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:vt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:vt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:vt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1119}}},O1={min:vt.FIVE_MINUTES,max:vt.SEVEN_DAYS},Zs={idle:"IDLE",active:"ACTIVE"},kq="request",Bq=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],$q="wc",Fq="auth",jq="authKeys",Uq="pairingTopics",qq="requests",f0=`${$q}@${1.5}:${Fq}:`,l0=`${f0}:PUB_KEY`;var zq=Object.defineProperty,Hq=Object.defineProperties,Wq=Object.getOwnPropertyDescriptors,s5=Object.getOwnPropertySymbols,Kq=Object.prototype.hasOwnProperty,Vq=Object.prototype.propertyIsEnumerable,o5=(t,e,r)=>e in t?zq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))Kq.call(e,r)&&o5(t,r,e[r]);if(s5)for(var r of s5(e))Vq.call(e,r)&&o5(t,r,e[r]);return t},Es=(t,e)=>Hq(t,Wq(e));class Gq extends CD{constructor(e){super(e),this.name=Lq,this.events=new im,this.initialized=!1,this.requestQueue={state:Zs.idle,queue:[]},this.sessionRequestQueue={state:Zs.idle,queue:[]},this.requestQueueDelay=vt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Nn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},vt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=Es(tn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n;let l=i,d,p=!1;try{l&&(p=this.client.core.pairing.pairings.get(l).active)}catch(U){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),U}if(!l||!p){const{topic:U,uri:z}=await this.client.core.pairing.create();l=U,d=z}if(!l){const{message:U}=ut("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(U)}const y=await this.client.core.crypto.generateKeyPair(),_=Nn.wc_sessionPropose.req.ttl||vt.FIVE_MINUTES,M=_n(_),O=tn({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:x6}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:M,pairingTopic:l},a&&{sessionProperties:a}),{reject:L,resolve:B,done:k}=ac(_,i5);this.events.once(br("session_connect"),async({error:U,session:z})=>{if(U)L(U);else if(z){z.self.publicKey=y;const Z=Es(tn({},z),{pairingTopic:O.pairingTopic,requiredNamespaces:O.requiredNamespaces,optionalNamespaces:O.optionalNamespaces,transportType:Wr.relay});await this.client.session.set(z.topic,Z),await this.setExpiry(z.topic,z.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:z.peer.metadata}),this.cleanupDuplicatePairings(Z),B(Z)}});const H=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:O,throwOnFailedPublish:!0});return await this.setProposal(H,tn({id:H},O)),{uri:d,approval:k}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[_s.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(W){throw o.setError(dc.no_internet_connection),W}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(W){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(dc.proposal_not_found),W}try{await this.isValidApprove(r)}catch(W){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(dc.session_approve_namespace_validation_failure),W}const{id:a,relayProtocol:u,namespaces:l,sessionProperties:d,sessionConfig:p}=r,y=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:_,proposer:M,requiredNamespaces:O,optionalNamespaces:L}=y;let B=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:_});B||(B=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:_s.session_approve_started,properties:{topic:_,trace:[_s.session_approve_started,_s.session_namespaces_validation_success]}}));const k=await this.client.core.crypto.generateKeyPair(),H=M.publicKey,U=await this.client.core.crypto.generateSharedKey(k,H),z=tn(tn({relay:{protocol:u??"irn"},namespaces:l,controller:{publicKey:k,metadata:this.client.metadata},expiry:_n(Iu)},d&&{sessionProperties:d}),p&&{sessionConfig:p}),Z=Wr.relay;B.addTrace(_s.subscribing_session_topic);try{await this.client.core.relayer.subscribe(U,{transportType:Z})}catch(W){throw B.setError(dc.subscribe_session_topic_failure),W}B.addTrace(_s.subscribe_session_topic_success);const R=Es(tn({},z),{topic:U,requiredNamespaces:O,optionalNamespaces:L,pairingTopic:_,acknowledged:!1,self:z.controller,peer:{publicKey:M.publicKey,metadata:M.metadata},controller:k,transportType:Wr.relay});await this.client.session.set(U,R),B.addTrace(_s.store_session);try{B.addTrace(_s.publishing_session_settle),await this.sendRequest({topic:U,method:"wc_sessionSettle",params:z,throwOnFailedPublish:!0}).catch(W=>{throw B==null||B.setError(dc.session_settle_publish_failure),W}),B.addTrace(_s.session_settle_publish_success),B.addTrace(_s.publishing_session_approve),await this.sendResult({id:a,topic:_,result:{relay:{protocol:u??"irn"},responderPublicKey:k},throwOnFailedPublish:!0}).catch(W=>{throw B==null||B.setError(dc.session_approve_publish_failure),W}),B.addTrace(_s.session_approve_publish_success)}catch(W){throw this.client.logger.error(W),this.client.session.delete(U,Dr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(U),W}return this.client.core.eventClient.deleteEvent({eventId:B.eventId}),await this.client.core.pairing.updateMetadata({topic:_,metadata:M.metadata}),await this.client.proposal.delete(a,Dr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:_}),await this.setExpiry(U,_n(Iu)),{topic:U,acknowledged:()=>Promise.resolve(this.client.session.get(U))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:Nn.wc_sessionPropose.reject}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(p){throw this.client.logger.error("update() -> isValidUpdate() failed"),p}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=ac(),u=ma(),l=lc().toString(),d=this.client.session.get(n).namespaces;return this.events.once(br("session_update",u),({error:p})=>{p?a(p):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:u,relayRpcId:l}).catch(p=>{this.client.logger.error(p),this.client.session.update(n,{namespaces:d}),a(p)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(u){throw this.client.logger.error("extend() -> isValidExtend() failed"),u}const{topic:n}=r,i=ma(),{done:s,resolve:o,reject:a}=ac();return this.events.once(br("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,_n(Iu)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(u=>{a(u)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(M){throw this.client.logger.error("request() -> isValidRequest() failed"),M}const{chainId:n,request:i,topic:s,expiry:o=Nn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=ma(),l=lc().toString(),{done:d,resolve:p,reject:y}=ac(o,"Request expired. Please try again.");this.events.once(br("session_request",u),({error:M,result:O})=>{M?y(M):p(O)});const _=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return _?(await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:Es(tn({},i),{expiryTimestamp:_n(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:_}).catch(M=>y(M)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),await d()):await Promise.all([new Promise(async M=>{await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:Es(tn({},i),{expiryTimestamp:_n(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(O=>y(O)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),M()}),new Promise(async M=>{var O;if(!((O=a.sessionConfig)!=null&&O.disableDeepLink)){const L=await t$(this.client.core.storage,n5);await QB({id:u,topic:s,wcDeepLink:L})}M()}),d()]).then(M=>M[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);Gs(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Xi(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=ma(),s=lc().toString(),{done:o,resolve:a,reject:u}=ac();this.events.once(br("session_ping",i),({error:l})=>{l?u(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=lc().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Dr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ut("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>tF(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?Wr.link_mode:Wr.relay;o===Wr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:u="",uri:l,domain:d,nonce:p,type:y,exp:_,nbf:M,methods:O=[],expiry:L}=r,B=[...r.resources||[]],{topic:k,uri:H}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:k,uri:H}});const U=await this.client.core.crypto.generateKeyPair(),z=r0(U);if(await Promise.all([this.client.auth.authKeys.set(l0,{responseTopic:z,publicKey:U}),this.client.auth.pairingTopics.set(z,{topic:z,pairingTopic:k})]),await this.client.core.relayer.subscribe(z,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${k}`),O.length>0){const{namespace:S}=Su(a[0]);let A=_$(S,"request",O);t0(B)&&(A=S$(A,B.pop())),B.push(A)}const Z=L&&L>Nn.wc_sessionAuthenticate.req.ttl?L:Nn.wc_sessionAuthenticate.req.ttl,R={authPayload:{type:y??"caip122",chains:a,statement:u,aud:l,domain:d,version:"1",nonce:p,iat:new Date().toISOString(),exp:_,nbf:M,resources:B},requester:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:_n(Z)},W={eip155:{chains:a,methods:[...new Set(["personal_sign",...O])],events:["chainChanged","accountsChanged"]}},ie={requiredNamespaces:{},optionalNamespaces:W,relays:[{protocol:"irn"}],pairingTopic:k,proposer:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:_n(Nn.wc_sessionPropose.req.ttl)},{done:me,resolve:j,reject:E}=ac(Z,"Request expired"),m=async({error:S,session:A})=>{if(this.events.off(br("session_request",g),f),S)E(S);else if(A){A.self.publicKey=U,await this.client.session.set(A.topic,A),await this.setExpiry(A.topic,A.expiry),k&&await this.client.core.pairing.updateMetadata({topic:k,metadata:A.peer.metadata});const b=this.client.session.get(A.topic);await this.deleteProposal(v),j({session:b})}},f=async S=>{var A,b,P;if(await this.deletePendingAuthRequest(g,{message:"fulfilled",code:0}),S.error){const J=Dr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return S.error.code===J.code?void 0:(this.events.off(br("session_connect"),m),E(S.error.message))}await this.deleteProposal(v),this.events.off(br("session_connect"),m);const{cacaos:I,responder:F}=S.result,ce=[],D=[];for(const J of I){await D_({cacao:J,projectId:this.client.core.projectId})||(this.client.logger.error(J,"Signature verification failed"),E(Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Q}=J,T=t0(Q.resources),X=[g1(Q.iss)],re=e0(Q.iss);if(T){const ge=L_(T),oe=k_(T);ce.push(...ge),X.push(...oe)}for(const ge of X)D.push(`${ge}:${re}`)}const se=await this.client.core.crypto.generateSharedKey(U,F.publicKey);let ee;ce.length>0&&(ee={topic:se,acknowledged:!0,self:{publicKey:U,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:_n(Iu),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:k,namespaces:J_([...new Set(ce)],[...new Set(D)]),transportType:o},await this.client.core.relayer.subscribe(se,{transportType:o}),await this.client.session.set(se,ee),k&&await this.client.core.pairing.updateMetadata({topic:k,metadata:F.metadata}),ee=this.client.session.get(se)),(A=this.client.metadata.redirect)!=null&&A.linkMode&&(b=F.metadata.redirect)!=null&&b.linkMode&&(P=F.metadata.redirect)!=null&&P.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(se,{transportType:Wr.link_mode})),j({auths:I,session:ee})},g=ma(),v=ma();this.events.once(br("session_connect"),m),this.events.once(br("session_request",g),f);let x;try{if(s){const S=va("wc_sessionAuthenticate",R,g);this.client.core.history.set(k,S);const A=await this.client.core.crypto.encode("",S,{type:_l,encoding:wl});x=n0(n,k,A)}else await Promise.all([this.sendRequest({topic:k,method:"wc_sessionAuthenticate",params:R,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:g}),this.sendRequest({topic:k,method:"wc_sessionPropose",params:ie,expiry:Nn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:v})])}catch(S){throw this.events.off(br("session_connect"),m),this.events.off(br("session_request",g),f),S}return await this.setProposal(v,tn({id:v},ie)),await this.setAuthRequest(g,{request:Es(tn({},R),{verifyContext:{}}),pairingTopic:k,transportType:o}),{uri:x??H,response:me}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[pc.authenticated_session_approve_started]}});try{this.isInitialized()}catch(L){throw s.setError(Dl.no_internet_connection),L}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Dl.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||Wr.relay;a===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=r0(u),p={type:So,receiverPublicKey:u,senderPublicKey:l},y=[],_=[];for(const L of i){if(!await D_({cacao:L,projectId:this.client.core.projectId})){s.setError(Dl.invalid_cacao);const z=Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:z,encodeOpts:p}),new Error(z.message)}s.addTrace(pc.cacaos_verified);const{p:B}=L,k=t0(B.resources),H=[g1(B.iss)],U=e0(B.iss);if(k){const z=L_(k),Z=k_(k);y.push(...z),H.push(...Z)}for(const z of H)_.push(`${z}:${U}`)}const M=await this.client.core.crypto.generateSharedKey(l,u);s.addTrace(pc.create_authenticated_session_topic);let O;if((y==null?void 0:y.length)>0){O={topic:M,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:u,metadata:o.requester.metadata},controller:u,expiry:_n(Iu),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:J_([...new Set(y)],[...new Set(_)]),transportType:a},s.addTrace(pc.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(M,{transportType:a})}catch(L){throw s.setError(Dl.subscribe_authenticated_session_topic_failure),L}s.addTrace(pc.subscribe_authenticated_session_topic_success),await this.client.session.set(M,O),s.addTrace(pc.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(pc.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:p,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(L){throw s.setError(Dl.authenticated_session_approve_publish_failure),L}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:O}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),u=r0(o),l={type:So,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:u,error:i,encodeOpts:l,rpcOpts:Nn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return O_(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:u}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Dr("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(n5).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,Dr("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Zs.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(dc.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Dr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Zs.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,_n(Nn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=Wr.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||_n(Nn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l,appLink:d}=r,p=va(i,s,u);let y;const _=!!d;try{const L=_?wl:ga;y=await this.client.core.crypto.encode(n,p,{encoding:L})}catch(L){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),L}let M;if(Bq.includes(i)){const L=Ao(JSON.stringify(p)),B=Ao(y);M=await this.client.core.verify.register({id:B,decryptedId:L})}const O=Nn[i].req;if(O.attestation=M,o&&(O.ttl=o),a&&(O.id=a),this.client.core.history.set(n,p),_){const L=n0(d,n,y);await global.Linking.openURL(L,this.client.name)}else{const L=Nn[i].req;o&&(L.ttl=o),a&&(L.id=a),l?(L.internal=Es(tn({},L.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,y,L)):this.client.core.relayer.publish(n,y,L).catch(B=>this.client.logger.error(B))}return p.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:u}=r,l=s0(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const _=p?wl:ga;d=await this.client.core.crypto.encode(i,l,Es(tn({},a||{}),{encoding:_}))}catch(_){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),_}let y;try{y=await this.client.core.history.get(i,n)}catch(_){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),_}if(p){const _=n0(u,i,d);await global.Linking.openURL(_,this.client.name)}else{const _=Nn[y.request.method].res;o?(_.internal=Es(tn({},_.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,_)):this.client.core.relayer.publish(i,d,_).catch(M=>this.client.logger.error(M))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:u}=r,l=o0(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const _=p?wl:ga;d=await this.client.core.crypto.encode(i,l,Es(tn({},o||{}),{encoding:_}))}catch(_){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),_}let y;try{y=await this.client.core.history.get(i,n)}catch(_){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),_}if(p){const _=n0(u,i,d);await global.Linking.openURL(_,this.client.name)}else{const _=a||Nn[y.request.method].res;this.client.core.relayer.publish(i,d,_)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;pa(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{pa(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Zs.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Zs.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Zs.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,u=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:u}))switch(u){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=ut("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:u}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(tn({},i.params));const d=a.expiryTimestamp||_n(Nn.wc_sessionPropose.req.ttl),p=tn({id:u,pairingTopic:n,expiryTimestamp:d},a);await this.setProposal(u,p);const y=await this.getVerifyContext({attestationId:s,hash:Ao(JSON.stringify(i)),encryptedId:o,metadata:p.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(Io.proposal_listener_not_found)),l==null||l.addTrace(Xs.emit_session_proposal),this.client.events.emit("session_proposal",{id:u,params:p,verifyContext:y})}catch(l){await this.sendError({id:u,topic:n,error:l,rpcOpts:Nn.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(Gs(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const u=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const d=await this.client.core.crypto.generateSharedKey(u,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:d});const p=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:p}),await this.client.core.pairing.activate({topic:r})}else if(Xi(n)){await this.client.proposal.delete(s,Dr("USER_DISCONNECTED"));const o=br("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(br("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:u,namespaces:l,sessionProperties:d,sessionConfig:p}=n.params,y=Es(tn(tn({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},d&&{sessionProperties:d}),p&&{sessionConfig:p}),{transportType:Wr.relay}),_=br("session_connect");if(this.events.listenerCount(_)===0)throw new Error(`emitting ${_} without any listeners 997`);this.events.emit(br("session_connect"),{session:y}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;Gs(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(br("session_approve",i),{})):Xi(n)&&(await this.client.session.delete(r,Dr("USER_DISCONNECTED")),this.events.emit(br("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Il.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Dr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(tn({topic:r},i));try{Il.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(u){throw Il.delete(o),u}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=br("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Gs(n)?this.events.emit(br("session_update",i),{}):Xi(n)&&this.events.emit(br("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,_n(Iu)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=br("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Gs(n)?this.events.emit(br("session_extend",i),{}):Xi(n)&&this.events.emit(br("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=br("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{Gs(n)?this.events.emit(br("session_ping",i),{}):Xi(n)&&this.events.emit(br("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(ni.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Dr("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:u,encryptedId:l,transportType:d}=r,{id:p,params:y}=a;try{await this.isValidRequest(tn({topic:o},y));const _=this.client.session.get(o),M=await this.getVerifyContext({attestationId:u,hash:Ao(JSON.stringify(va("wc_sessionRequest",y,p))),encryptedId:l,metadata:_.peer.metadata,transportType:d}),O={id:p,topic:o,params:y,verifyContext:M};await this.setPendingSessionRequest(O),d===Wr.link_mode&&(n=_.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=_.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(O):(this.addSessionRequestToSessionRequestQueue(O),this.processSessionRequestQueue())}catch(_){await this.sendError({id:p,topic:o,error:_}),this.client.logger.error(_)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=br("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Gs(n)?this.events.emit(br("session_request",i),{result:n.result}):Xi(n)&&this.events.emit(br("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Il.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(tn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Il.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),Gs(n)?this.events.emit(br("session_request",i),{result:n.result}):Xi(n)&&this.events.emit(br("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:u}=r;try{const{requester:l,authPayload:d,expiryTimestamp:p}=s.params,y=await this.getVerifyContext({attestationId:o,hash:Ao(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:u}),_={requester:l,pairingTopic:i,id:s.id,authPayload:d,verifyContext:y,expiryTimestamp:p};await this.setAuthRequest(s.id,{request:_,pairingTopic:i,transportType:u}),u===Wr.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:y})}catch(l){this.client.logger.error(l);const d=s.params.requester.publicKey,p=await this.client.core.crypto.generateKeyPair(),y=this.getAppLinkIfEnabled(s.params.requester.metadata,u),_={type:So,receiverPublicKey:d,senderPublicKey:p};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:_,rpcOpts:Nn.wc_sessionAuthenticate.autoReject,appLink:y})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Zs.idle,this.processSessionRequestQueue()},vt.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=br("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(br("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Zs.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Zs.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:va("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!bi(r)){const{message:u}=ut("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(vi(n)||await this.isValidPairingTopic(n),!dF(a)){const{message:u}=ut("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!vi(i)&&Ml(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!vi(s)&&Ml(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),vi(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=hF(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!bi(r))throw new Error(ut("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),u=x1(i,"approve()");if(u)throw new Error(u.message);const l=t6(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!on(s,!0)){const{message:d}=ut("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}vi(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!bi(r)){const{message:s}=ut("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!gF(i)){const{message:s}=ut("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!bi(r)){const{message:l}=ut("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!Q_(n)){const{message:l}=ut("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=oF(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const u=x1(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(pa(o)){const{message:l}=ut("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!bi(r)){const{message:u}=ut("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=x1(i,"update()");if(o)throw new Error(o.message);const a=t6(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!bi(r)){const{message:i}=ut("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!bi(r)){const{message:u}=ut("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!e6(a,s)){const{message:u}=ut("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!mF(i)){const{message:u}=ut("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!yF(a,s,i.method)){const{message:u}=ut("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!EF(o,O1)){const{message:u}=ut("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${O1.min} and ${O1.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!bi(r)){const{message:o}=ut("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!vF(s)){const{message:o}=ut("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!bi(r)){const{message:i}=ut("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!bi(r)){const{message:a}=ut("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!e6(o,s)){const{message:a}=ut("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!bF(i)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!wF(o,s,i.name)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!bi(r)){const{message:i}=ut("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!on(i,!1))throw new Error("uri is required parameter");if(!on(s,!1))throw new Error("domain is required parameter");if(!on(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(u=>Su(u).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Su(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,u={verified:{verifyUrl:o.verifyUrl||Rl,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Wr.link_mode){const d=this.getAppLinkIfEnabled(o,a);return u.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",u}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(u.verified.origin=l.origin,u.verified.isScam=l.isScam,u.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(u)}`),u},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!on(i,!1)){const{message:s}=ut("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,u,l,d,p,y;return!r||n!==Wr.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(u=this.client.metadata)==null?void 0:u.redirect)==null?void 0:l.universal)!==""&&((d=r==null?void 0:r.redirect)==null?void 0:d.universal)!==void 0&&((p=r==null?void 0:r.redirect)==null?void 0:p.universal)!==""&&((y=r==null?void 0:r.redirect)==null?void 0:y.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=M_(r,"topic")||"",i=decodeURIComponent(M_(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:Wr.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(d1()||Au()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ni.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(l0)?this.client.auth.authKeys.get(l0):{publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===Wr.link_mode?wl:ga});try{S1(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:Ao(n)})):a0(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(u){this.client.logger.error(u)}}registerExpirerEvents(){this.client.core.expirer.on(es.expired,async e=>{const{topic:r,id:n}=P_(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ut("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,ut("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(hc.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(hc.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!on(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(pa(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=ut("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!on(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(pa(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=ut("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=ut("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(on(e,!1)){const{message:r}=ut("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=ut("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!pF(e)){const{message:r}=ut("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(pa(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=ut("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class Yq extends gc{constructor(e,r){super(e,r,Oq,R1),this.core=e,this.logger=r}}let Jq=class extends gc{constructor(e,r){super(e,r,Nq,R1),this.core=e,this.logger=r}};class Xq extends gc{constructor(e,r){super(e,r,kq,R1,n=>n.id),this.core=e,this.logger=r}}class Zq extends gc{constructor(e,r){super(e,r,jq,f0,()=>l0),this.core=e,this.logger=r}}class Qq extends gc{constructor(e,r){super(e,r,Uq,f0),this.core=e,this.logger=r}}class ez extends gc{constructor(e,r){super(e,r,qq,f0,n=>n.id),this.core=e,this.logger=r}}class tz{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new Zq(this.core,this.logger),this.pairingTopics=new Qq(this.core,this.logger),this.requests=new ez(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class N1 extends ID{constructor(e){super(e),this.protocol=e5,this.version=t5,this.name=D1.name,this.events=new Hi.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||D1.name,this.metadata=(e==null?void 0:e.metadata)||x_(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:rl(bd({level:(e==null?void 0:e.logger)||D1.logger}));this.core=(e==null?void 0:e.core)||new Dq(e),this.logger=ti(r,this.name),this.session=new Jq(this.core,this.logger),this.proposal=new Yq(this.core,this.logger),this.pendingRequest=new Xq(this.core,this.logger),this.engine=new Gq(this),this.auth=new tz(this.core,this.logger)}static async init(e){const r=new N1(e);return await r.initialize(),r}get context(){return pi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var h0={exports:{}};/** + Approved: ${y.toString()}`))}),o.forEach(p=>{n||(ac(i[p].methods,s[p].methods)?ac(i[p].events,s[p].events)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${p}`)):n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${p}`))}),n}function _F(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function r6(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function EF(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Mu(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function SF(t,e){return w1(t)&&t<=e.max&&t>=e.min}function n6(){const t=bl();return new Promise(e=>{switch(t){case Ri.browser:e(AF());break;case Ri.reactNative:e(PF());break;case Ri.node:e(MF());break;default:e(!0)}})}function AF(){return vl()&&(navigator==null?void 0:navigator.onLine)}async function PF(){if(Au()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function MF(){return!0}function IF(t){switch(bl()){case Ri.browser:CF(t);break;case Ri.reactNative:TF(t);break}}function CF(t){!Au()&&vl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function TF(t){Au()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const _1={};class Il{static get(e){return _1[e]}static set(e,r){_1[e]=r}static delete(e){delete _1[e]}}const RF="PARSE_ERROR",DF="INVALID_REQUEST",OF="METHOD_NOT_FOUND",NF="INVALID_PARAMS",i6="INTERNAL_ERROR",E1="SERVER_ERROR",LF=[-32700,-32600,-32601,-32602,-32603],Cl={[RF]:{code:-32700,message:"Parse error"},[DF]:{code:-32600,message:"Invalid Request"},[OF]:{code:-32601,message:"Method not found"},[NF]:{code:-32602,message:"Invalid params"},[i6]:{code:-32603,message:"Internal error"},[E1]:{code:-32e3,message:"Server error"}},s6=E1;function kF(t){return LF.includes(t)}function o6(t){return Object.keys(Cl).includes(t)?Cl[t]:Cl[s6]}function BF(t){const e=Object.values(Cl).find(r=>r.code===t);return e||Cl[s6]}function a6(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var c6={},Po={},u6;function $F(){if(u6)return Po;u6=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.isBrowserCryptoAvailable=Po.getSubtleCrypto=Po.getBrowerCrypto=void 0;function t(){return(nn==null?void 0:nn.crypto)||(nn==null?void 0:nn.msCrypto)||{}}Po.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Po.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Po.isBrowserCryptoAvailable=r,Po}var Mo={},f6;function FF(){if(f6)return Mo;f6=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.isBrowser=Mo.isNode=Mo.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Mo.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Mo.isNode=e;function r(){return!t()&&!e()}return Mo.isBrowser=r,Mo}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Jf;e.__exportStar($F(),t),e.__exportStar(FF(),t)})(c6);function ma(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function hc(t=6){return BigInt(ma(t))}function va(t,e,r){return{id:r||ma(),jsonrpc:"2.0",method:t,params:e}}function s0(t,e){return{id:t,jsonrpc:"2.0",result:e}}function o0(t,e,r){return{id:t,jsonrpc:"2.0",error:jF(e)}}function jF(t,e){return typeof t>"u"?o6(i6):(typeof t=="string"&&(t=Object.assign(Object.assign({},o6(E1)),{message:t})),kF(t.code)&&(t=BF(t.code)),t)}let UF=class{},qF=class extends UF{constructor(){super()}},zF=class extends qF{constructor(e){super()}};const HF="^https?:",WF="^wss?:";function KF(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function l6(t,e){const r=KF(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function h6(t){return l6(t,HF)}function d6(t){return l6(t,WF)}function VF(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function p6(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function S1(t){return p6(t)&&"method"in t}function a0(t){return p6(t)&&(Gs(t)||Xi(t))}function Gs(t){return"result"in t}function Xi(t){return"error"in t}let Zi=class extends zF{constructor(e){super(e),this.events=new Hi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(va(e.method,e.params||[],e.id||hc().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Xi(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),a0(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const GF=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),YF=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",g6=t=>t.split("?")[0],m6=10,JF=GF();let XF=class{constructor(e){if(this.url=e,this.events=new Hi.EventEmitter,this.registering=!1,!d6(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(mo(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!d6(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=c6.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!VF(e)},o=new JF(e,[],s);YF()?o.onerror=a=>{const u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Qa(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=o0(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return a6(e,g6(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>m6&&this.events.setMaxListeners(m6)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${g6(this.url)}`));return this.events.emit("register_error",r),r}};var c0={exports:{}};c0.exports,function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",u="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",p="[object Date]",y="[object Error]",_="[object Function]",M="[object GeneratorFunction]",O="[object Map]",L="[object Number]",B="[object Null]",k="[object Object]",H="[object Promise]",U="[object Proxy]",z="[object RegExp]",Z="[object Set]",R="[object String]",W="[object Symbol]",ie="[object Undefined]",me="[object WeakMap]",j="[object ArrayBuffer]",E="[object DataView]",m="[object Float32Array]",f="[object Float64Array]",g="[object Int8Array]",v="[object Int16Array]",x="[object Int32Array]",S="[object Uint8Array]",A="[object Uint8ClampedArray]",b="[object Uint16Array]",P="[object Uint32Array]",I=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,ce=/^(?:0|[1-9]\d*)$/,D={};D[m]=D[f]=D[g]=D[v]=D[x]=D[S]=D[A]=D[b]=D[P]=!0,D[a]=D[u]=D[j]=D[d]=D[E]=D[p]=D[y]=D[_]=D[O]=D[L]=D[k]=D[z]=D[Z]=D[R]=D[me]=!1;var se=typeof nn=="object"&&nn&&nn.Object===Object&&nn,ee=typeof self=="object"&&self&&self.Object===Object&&self,J=se||ee||Function("return this")(),Q=e&&!e.nodeType&&e,T=Q&&!0&&t&&!t.nodeType&&t,X=T&&T.exports===Q,re=X&&se.process,ge=function(){try{return re&&re.binding&&re.binding("util")}catch{}}(),oe=ge&&ge.isTypedArray;function fe(ue,we){for(var Ye=-1,It=ue==null?0:ue.length,jr=0,ir=[];++Ye-1}function st(ue,we){var Ye=this.__data__,It=Xe(Ye,ue);return It<0?(++this.size,Ye.push([ue,we])):Ye[It][1]=we,this}Re.prototype.clear=De,Re.prototype.delete=it,Re.prototype.get=Ue,Re.prototype.has=mt,Re.prototype.set=st;function tt(ue){var we=-1,Ye=ue==null?0:ue.length;for(this.clear();++wewn))return!1;var Ur=ir.get(ue);if(Ur&&ir.get(we))return Ur==we;var pn=-1,xi=!0,xn=Ye&s?new _t:void 0;for(ir.set(ue,we),ir.set(we,ue);++pn-1&&ue%1==0&&ue-1&&ue%1==0&&ue<=o}function xp(ue){var we=typeof ue;return ue!=null&&(we=="object"||we=="function")}function Oc(ue){return ue!=null&&typeof ue=="object"}var _p=oe?Te(oe):pr;function Xb(ue){return Yb(ue)?qe(ue):gr(ue)}function Fr(){return[]}function kr(){return!1}t.exports=Jb}(c0,c0.exports);var ZF=c0.exports;const QF=ji(ZF),v6="wc",b6=2,y6="core",Ys=`${v6}@2:${y6}:`,ej={logger:"error"},tj={database:":memory:"},rj="crypto",w6="client_ed25519_seed",nj=vt.ONE_DAY,ij="keychain",sj="0.3",oj="messages",aj="0.3",cj=vt.SIX_HOURS,uj="publisher",x6="irn",fj="error",_6="wss://relay.walletconnect.org",lj="relayer",ni={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},hj="_subscription",Qi={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},dj=.1,A1="2.17.2",Wr={link_mode:"link_mode",relay:"relay"},pj="0.3",gj="WALLETCONNECT_CLIENT_ID",E6="WALLETCONNECT_LINK_MODE_APPS",Js={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},mj="subscription",vj="0.3",bj=vt.FIVE_SECONDS*1e3,yj="pairing",wj="0.3",Tl={wc_pairingDelete:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:vt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:vt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:0},res:{ttl:vt.ONE_DAY,prompt:!1,tag:0}}},dc={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},xs={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},xj="history",_j="0.3",Ej="expirer",es={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},Sj="0.3",Aj="verify-api",Pj="https://verify.walletconnect.com",S6="https://verify.walletconnect.org",Rl=S6,Mj=`${Rl}/v3`,Ij=[Pj,S6],Cj="echo",Tj="https://echo.walletconnect.com",Xs={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},Io={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},_s={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},pc={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},gc={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Dl={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},Rj=.1,Dj="event-client",Oj=86400,Nj="https://pulse.walletconnect.org/batch";function Lj(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(H);B!==k;){for(var z=M[B],Z=0,R=H-1;(z!==0||Z>>0,U[R]=z%a>>>0,z=z/a>>>0;if(z!==0)throw new Error("Non-zero carry");L=Z,B++}for(var W=H-L;W!==H&&U[W]===0;)W++;for(var ie=u.repeat(O);W>>0,H=new Uint8Array(k);M[O];){var U=r[M.charCodeAt(O)];if(U===255)return;for(var z=0,Z=k-1;(U!==0||z>>0,H[Z]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");B=z,O++}if(M[O]!==" "){for(var R=k-B;R!==k&&H[R]===0;)R++;for(var W=new Uint8Array(L+(k-R)),ie=L;R!==k;)W[ie++]=H[R++];return W}}}function _(M){var O=y(M);if(O)return O;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:_}}var kj=Lj,Bj=kj;const A6=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},$j=t=>new TextEncoder().encode(t),Fj=t=>new TextDecoder().decode(t);class jj{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Uj{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return P6(this,e)}}class qj{constructor(e){this.decoders=e}or(e){return P6(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const P6=(t,e)=>new qj({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class zj{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new jj(e,r,n),this.decoder=new Uj(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const u0=({name:t,prefix:e,encode:r,decode:n})=>new zj(t,e,r,n),Ol=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=Bj(r,e);return u0({prefix:t,name:e,encode:n,decode:s=>A6(i(s))})},Hj=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},Wj=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<u0({prefix:e,name:t,encode(i){return Wj(i,n,r)},decode(i){return Hj(i,n,r,t)}}),Kj=u0({prefix:"\0",name:"identity",encode:t=>Fj(t),decode:t=>$j(t)});var Vj=Object.freeze({__proto__:null,identity:Kj});const Gj=jn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Yj=Object.freeze({__proto__:null,base2:Gj});const Jj=jn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Xj=Object.freeze({__proto__:null,base8:Jj});const Zj=Ol({prefix:"9",name:"base10",alphabet:"0123456789"});var Qj=Object.freeze({__proto__:null,base10:Zj});const eU=jn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),tU=jn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var rU=Object.freeze({__proto__:null,base16:eU,base16upper:tU});const nU=jn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),iU=jn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),sU=jn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),oU=jn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),aU=jn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),cU=jn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),uU=jn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),fU=jn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),lU=jn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var hU=Object.freeze({__proto__:null,base32:nU,base32upper:iU,base32pad:sU,base32padupper:oU,base32hex:aU,base32hexupper:cU,base32hexpad:uU,base32hexpadupper:fU,base32z:lU});const dU=Ol({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),pU=Ol({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var gU=Object.freeze({__proto__:null,base36:dU,base36upper:pU});const mU=Ol({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),vU=Ol({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var bU=Object.freeze({__proto__:null,base58btc:mU,base58flickr:vU});const yU=jn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),wU=jn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),xU=jn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),_U=jn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var EU=Object.freeze({__proto__:null,base64:yU,base64pad:wU,base64url:xU,base64urlpad:_U});const M6=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),SU=M6.reduce((t,e,r)=>(t[r]=e,t),[]),AU=M6.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function PU(t){return t.reduce((e,r)=>(e+=SU[r],e),"")}function MU(t){const e=[];for(const r of t){const n=AU[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const IU=u0({prefix:"🚀",name:"base256emoji",encode:PU,decode:MU});var CU=Object.freeze({__proto__:null,base256emoji:IU}),TU=C6,I6=128,RU=127,DU=~RU,OU=Math.pow(2,31);function C6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=OU;)e[r++]=t&255|I6,t/=128;for(;t&DU;)e[r++]=t&255|I6,t>>>=7;return e[r]=t|0,C6.bytes=r-n+1,e}var NU=P1,LU=128,T6=127;function P1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw P1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&T6)<=LU);return P1.bytes=s-n,r}var kU=Math.pow(2,7),BU=Math.pow(2,14),$U=Math.pow(2,21),FU=Math.pow(2,28),jU=Math.pow(2,35),UU=Math.pow(2,42),qU=Math.pow(2,49),zU=Math.pow(2,56),HU=Math.pow(2,63),WU=function(t){return t(R6.encode(t,e,r),e),O6=t=>R6.encodingLength(t),M1=(t,e)=>{const r=e.byteLength,n=O6(t),i=n+O6(r),s=new Uint8Array(i+r);return D6(t,s,0),D6(r,s,n),s.set(e,i),new VU(t,r,e,s)};class VU{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const N6=({name:t,code:e,encode:r})=>new GU(t,e,r);class GU{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?M1(this.code,r):r.then(n=>M1(this.code,n))}else throw Error("Unknown type, must be binary type")}}const L6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),YU=N6({name:"sha2-256",code:18,encode:L6("SHA-256")}),JU=N6({name:"sha2-512",code:19,encode:L6("SHA-512")});var XU=Object.freeze({__proto__:null,sha256:YU,sha512:JU});const k6=0,ZU="identity",B6=A6;var QU=Object.freeze({__proto__:null,identity:{code:k6,name:ZU,encode:B6,digest:t=>M1(k6,B6(t))}});new TextEncoder,new TextDecoder;const $6={...Vj,...Yj,...Xj,...Qj,...rU,...hU,...gU,...bU,...EU,...CU};({...XU,...QU});function eq(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function F6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const j6=F6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),I1=F6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=eq(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=ut("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=ti(r,this.name)}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,E_(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?S_(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}},iq=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=rj,this.randomSessionIdentifier=v1(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=Jx(i);return Yx(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=C$();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=Jx(s),a=this.randomSessionIdentifier;return await hN(a,i,nj,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),u=T$(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||r0(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=q_(o),u=mo(s);if(H_(a))return D$(u,o==null?void 0:o.encoding);if(z_(a)){const y=a.senderPublicKey,_=a.receiverPublicKey;i=await this.generateSharedKey(y,_)}const l=this.getSymKey(i),{type:d,senderPublicKey:p}=a;return R$({type:d,symKey:l,message:u,senderPublicKey:p,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=L$(s,o);if(H_(a)){const u=N$(s,o==null?void 0:o.encoding);return Qa(u)}if(z_(a)){const u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{const u=this.getSymKey(i),l=O$({symKey:u,encoded:s,encoding:o==null?void 0:o.encoding});return Qa(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=(i,s=ga)=>{const o=Sl({encoded:i,encoding:s});return fc(o.type)},this.getPayloadSenderPublicKey=(i,s=ga)=>{const o=Sl({encoded:i,encoding:s});return o.senderPublicKey?In(o.senderPublicKey,ri):void 0},this.core=e,this.logger=ti(r,this.name),this.keychain=n||new nq(this.core,this.logger)}get context(){return pi(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(w6)}catch{e=v1(),await this.keychain.set(w6,e)}return rq(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}};class sq extends wD{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=oj,this.version=aj,this.initialized=!1,this.storagePrefix=Ys,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Ao(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Ao(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=ti(e,this.name),this.core=r}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,E_(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?S_(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class oq extends xD{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new Hi.EventEmitter,this.name=uj,this.queue=new Map,this.publishTimeout=vt.toMiliseconds(vt.ONE_MINUTE),this.failedPublishTimeout=vt.toMiliseconds(vt.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||cj,u=b1(s),l=(s==null?void 0:s.prompt)||!1,d=(s==null?void 0:s.tag)||0,p=(s==null?void 0:s.id)||hc().toString(),y={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:d,id:p,attestation:s==null?void 0:s.attestation}},_=`Failed to publish payload, please try again. id:${p} tag:${d}`,M=Date.now();let O,L=1;try{for(;O===void 0;){if(Date.now()-M>this.publishTimeout)throw new Error(_);this.logger.trace({id:p,attempts:L},`publisher.publish - attempt ${L}`),O=await await Pu(this.rpcPublish(n,i,a,u,l,d,p,s==null?void 0:s.attestation).catch(B=>this.logger.warn(B)),this.publishTimeout,_),L++,O||await new Promise(B=>setTimeout(B,this.failedPublishTimeout))}this.relayer.events.emit(ni.publish,y),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:p,topic:n,message:i,opts:s}})}catch(B){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(B),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw B;this.queue.set(p,y)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=ti(r,this.name),this.registerEventListeners()}get context(){return pi(this.logger)}rpcPublish(e,r,n,i,s,o,a,u){var l,d,p,y;const _={method:Al(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:u},id:a};return vi((l=_.params)==null?void 0:l.prompt)&&((d=_.params)==null||delete d.prompt),vi((p=_.params)==null?void 0:p.tag)&&((y=_.params)==null||delete y.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:_}),this.relayer.request(_)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(su.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ni.connection_stalled);return}this.checkQueue()}),this.relayer.on(ni.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class aq{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var cq=Object.defineProperty,uq=Object.defineProperties,fq=Object.getOwnPropertyDescriptors,U6=Object.getOwnPropertySymbols,lq=Object.prototype.hasOwnProperty,hq=Object.prototype.propertyIsEnumerable,q6=(t,e,r)=>e in t?cq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Nl=(t,e)=>{for(var r in e||(e={}))lq.call(e,r)&&q6(t,r,e[r]);if(U6)for(var r of U6(e))hq.call(e,r)&&q6(t,r,e[r]);return t},C1=(t,e)=>uq(t,fq(e));class dq extends SD{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new aq,this.events=new Hi.EventEmitter,this.name=mj,this.version=vj,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Ys,this.subscribeTimeout=vt.toMiliseconds(vt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=b1(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new vt.Watch;a.start(i);const u=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(u),a.stop(i),s(!0)),a.elapsed(i)>=bj&&(clearInterval(u),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ti(r,this.name),this.clientId=""}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=b1(n);await this.rpcUnsubscribe(e,r,i);const s=Dr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===Wr.relay&&await this.restartToComplete();const s={method:Al(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=Ao(e+this.clientId);if((n==null?void 0:n.transportType)===Wr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},vt.toMiliseconds(vt.ONE_SECOND)),a;const u=await Pu(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return u?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ni.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:Al(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Pu(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(ni.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:Al(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Pu(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(ni.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:Al(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,C1(Nl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Nl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Nl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Js.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Js.deleted,C1(Nl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Js.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);lc(r)&&this.onBatchSubscribe(r.map((n,i)=>C1(Nl({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(su.pulse,async()=>{await this.checkPending()}),this.events.on(Js.created,async e=>{const r=Js.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Js.deleted,async e=>{const r=Js.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var pq=Object.defineProperty,z6=Object.getOwnPropertySymbols,gq=Object.prototype.hasOwnProperty,mq=Object.prototype.propertyIsEnumerable,H6=(t,e,r)=>e in t?pq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,W6=(t,e)=>{for(var r in e||(e={}))gq.call(e,r)&&H6(t,r,e[r]);if(z6)for(var r of z6(e))mq.call(e,r)&&H6(t,r,e[r]);return t};class vq extends _D{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Hi.EventEmitter,this.name=lj,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=vt.toMiliseconds(vt.THIRTY_SECONDS+vt.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||hc().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(u,l)=>{const d=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Qi.disconnect,d);const p=await o;this.provider.off(Qi.disconnect,d),u(p)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(Zd())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(ni.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ni.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Qi.payload,this.onPayloadHandler),this.provider.on(Qi.connect,this.onConnectHandler),this.provider.on(Qi.disconnect,this.onDisconnectHandler),this.provider.on(Qi.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ti(e.logger,this.name):rl(bd({level:e.logger||fj})),this.messages=new sq(this.logger,e.core),this.subscriber=new dq(this,this.logger),this.publisher=new oq(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||_6,this.projectId=e.projectId,this.bundleId=VB(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return pi(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Wr.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",u;const l=d=>{d.topic===e&&(this.subscriber.off(Js.created,l),u())};return await Promise.all([new Promise(d=>{u=d,this.subscriber.on(Js.created,l)}),new Promise(async(d,p)=>{a=await this.subscriber.subscribe(e,W6({internal:{throwOnFailedPublish:o}},r)).catch(y=>{o&&p(y)})||a,d()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Pu(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Qi.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Qi.disconnect,i),await Pu(this.provider.connect(),vt.toMiliseconds(vt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await n6())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=_n(vt.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(ni.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(Zd())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Zi(new XF(XB({sdkVersion:A1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),S1(e)){if(!e.method.endsWith(hj))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:Wr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(W6({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else a0(e)&&this.events.emit(ni.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ni.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=s0(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Qi.payload,this.onPayloadHandler),this.provider.off(Qi.connect,this.onConnectHandler),this.provider.off(Qi.disconnect,this.onDisconnectHandler),this.provider.off(Qi.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await n6();IF(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(ni.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},vt.toMiliseconds(dj))))}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var bq=Object.defineProperty,K6=Object.getOwnPropertySymbols,yq=Object.prototype.hasOwnProperty,wq=Object.prototype.propertyIsEnumerable,V6=(t,e,r)=>e in t?bq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,G6=(t,e)=>{for(var r in e||(e={}))yq.call(e,r)&&V6(t,r,e[r]);if(K6)for(var r of K6(e))wq.call(e,r)&&V6(t,r,e[r]);return t};class mc extends ED{constructor(e,r,n,i=Ys,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=pj,this.cached=[],this.initialized=!1,this.storagePrefix=Ys,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!vi(o)?this.map.set(this.getKey(o),o):sF(o)?this.map.set(o.id,o):oF(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>QF(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const u=G6(G6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=ti(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class xq{constructor(e,r){this.core=e,this.logger=r,this.name=yj,this.version=wj,this.events=new im,this.initialized=!1,this.storagePrefix=Ys,this.ignoredPayloadTypes=[So],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=v1(),s=await this.core.crypto.setSymKey(i),o=_n(vt.FIVE_MINUTES),a={protocol:x6},u={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=Y_({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(dc.create,u),this.core.expirer.set(s,o),await this.pairings.set(s,u),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Xs.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:u,methods:l}=G_(n.uri);i.props.properties.topic=s,i.addTrace(Xs.pairing_uri_validation_success),i.addTrace(Xs.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(Xs.existing_pairing),d.active)throw i.setError(Io.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Xs.pairing_not_expired)}const p=u||_n(vt.FIVE_MINUTES),y={topic:s,relay:a,expiry:p,active:!1,methods:l};this.core.expirer.set(s,p),await this.pairings.set(s,y),i.addTrace(Xs.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(dc.create,y),i.addTrace(Xs.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Xs.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Io.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(_){throw i.setError(Io.subscribe_pairing_topic_failure),_}return i.addTrace(Xs.subscribe_pairing_topic_success),y},this.activate=async({topic:n})=>{this.isInitialized();const i=_n(vt.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=cc();this.events.once(br("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Dr("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,u=this.core.crypto.keychain.get(i);return Y_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:u,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=va(i,s),a=await this.core.crypto.encode(n,o),u=Tl[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{const o=s0(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Tl[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=o0(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Tl[u.request.method]?Tl[u.request.method].res:Tl.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Dr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>pa(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(dc.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{Gs(i)?this.events.emit(br("pairing_ping",s),{}):Xi(i)&&this.events.emit(br("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(dc.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Dr("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Dr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!bi(n)){const{message:a}=ut("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!iF(n.uri)){const{message:a}=ut("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}const o=G_(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&vt.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!bi(n)){const{message:s}=ut("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!bi(n)){const{message:s}=ut("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!on(n,!1)){const{message:i}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(pa(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ut("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=ti(r,this.name),this.pairings=new mc(this.core,this.logger,this.name,this.storagePrefix)}get context(){return pi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ni.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===Wr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{S1(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):a0(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(es.expired,async e=>{const{topic:r}=P_(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(dc.expire,{topic:r}))})}}class _q extends yD{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new Hi.EventEmitter,this.name=xj,this.version=_j,this.cached=[],this.initialized=!1,this.storagePrefix=Ys,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:_n(vt.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(xs.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Xi(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(xs.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(xs.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ti(r,this.name)}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:va(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(xs.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(xs.created,e=>{const r=xs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(xs.updated,e=>{const r=xs.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(xs.deleted,e=>{const r=xs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(su.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{vt.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(xs.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Eq extends AD{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new Hi.EventEmitter,this.name=Ej,this.version=Sj,this.cached=[],this.initialized=!1,this.storagePrefix=Ys,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(es.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(es.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ti(r,this.name)}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return ZB(e);if(typeof e=="number")return QB(e);const{message:r}=ut("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(es.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;vt.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(es.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(su.pulse,()=>this.checkExpirations()),this.events.on(es.created,e=>{const r=es.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(es.expired,e=>{const r=es.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(es.deleted,e=>{const r=es.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Sq extends PD{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=Aj,this.verifyUrlV3=Mj,this.storagePrefix=Ys,this.version=b6,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&vt.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!vl()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,u=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=ol(),d=this.startAbortTimer(vt.ONE_SECOND*5),p=await new Promise((y,_)=>{const M=()=>{window.removeEventListener("message",L),l.body.removeChild(O),_("attestation aborted")};this.abortController.signal.addEventListener("abort",M);const O=l.createElement("iframe");O.src=u,O.style.display="none",O.addEventListener("error",M,{signal:this.abortController.signal});const L=B=>{if(B.data&&typeof B.data=="string")try{const k=JSON.parse(B.data);if(k.type==="verify_attestation"){if(Sm(k.attestation).payload.id!==o)return;clearInterval(d),l.body.removeChild(O),this.abortController.signal.removeEventListener("abort",M),window.removeEventListener("message",L),y(k.attestation===null?"":k.attestation)}}catch(k){this.logger.warn(k)}};l.body.appendChild(O),window.addEventListener("message",L,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",p),p}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(Sm(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const u=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,u)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(vt.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Rl;return Ij.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Rl}`),s=Rl),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(vt.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=F$(i,s.publicKey),a={hasExpired:vt.toMiliseconds(o.exp)this.abortController.abort(),vt.toMiliseconds(e))}}class Aq extends MD{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=Cj,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${Tj}/${this.projectId}/clients`;await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=ti(r,this.context)}}var Pq=Object.defineProperty,Y6=Object.getOwnPropertySymbols,Mq=Object.prototype.hasOwnProperty,Iq=Object.prototype.propertyIsEnumerable,J6=(t,e,r)=>e in t?Pq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ll=(t,e)=>{for(var r in e||(e={}))Mq.call(e,r)&&J6(t,r,e[r]);if(Y6)for(var r of Y6(e))Iq.call(e,r)&&J6(t,r,e[r]);return t};class Cq extends ID{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=Dj,this.storagePrefix=Ys,this.storageVersion=Rj,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!d1())try{const i={eventId:I_(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:__(this.core.relayer.protocol,this.core.relayer.version,A1)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:u}}=i,l=I_(),d=this.core.projectId||"",p=Date.now(),y=Ll({eventId:l,timestamp:p,props:{event:s,type:o,properties:{topic:a,trace:u}},bundleId:d,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,y),this.shouldPersist=!0),y},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(u=>u.props.properties.topic===o);if(a)return Ll(Ll({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(su.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{vt.fromMiliseconds(Date.now())-vt.fromMiliseconds(i.timestamp)>Oj&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Ll(Ll({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${Nj}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${A1}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>x_().url,this.logger=ti(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var Tq=Object.defineProperty,X6=Object.getOwnPropertySymbols,Rq=Object.prototype.hasOwnProperty,Dq=Object.prototype.propertyIsEnumerable,Z6=(t,e,r)=>e in t?Tq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Q6=(t,e)=>{for(var r in e||(e={}))Rq.call(e,r)&&Z6(t,r,e[r]);if(X6)for(var r of X6(e))Dq.call(e,r)&&Z6(t,r,e[r]);return t};class T1 extends bD{constructor(e){var r;super(e),this.protocol=v6,this.version=b6,this.name=y6,this.events=new Hi.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:u})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:Wr.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||_6,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=bd({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:ej.logger}),{logger:i,chunkLoggerController:s}=vD({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ti(i,this.name),this.heartbeat=new lR,this.crypto=new iq(this,this.logger,e==null?void 0:e.keychain),this.history=new _q(this,this.logger),this.expirer=new Eq(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new zR(Q6(Q6({},tj),e==null?void 0:e.storageOptions)),this.relayer=new vq({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new xq(this,this.logger),this.verify=new Sq(this,this.logger,this.storage),this.echoClient=new Aq(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new Cq(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new T1(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(gj,n),r}get context(){return pi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(E6,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(E6)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const Oq=T1,e5="wc",t5=2,r5="client",R1=`${e5}@${t5}:${r5}:`,D1={name:r5,logger:"error"},n5="WALLETCONNECT_DEEPLINK_CHOICE",Nq="proposal",i5="Proposal expired",Lq="session",Iu=vt.SEVEN_DAYS,kq="engine",Nn={wc_sessionPropose:{req:{ttl:vt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:vt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:vt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:vt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:vt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1119}}},O1={min:vt.FIVE_MINUTES,max:vt.SEVEN_DAYS},Zs={idle:"IDLE",active:"ACTIVE"},Bq="request",$q=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],Fq="wc",jq="auth",Uq="authKeys",qq="pairingTopics",zq="requests",f0=`${Fq}@${1.5}:${jq}:`,l0=`${f0}:PUB_KEY`;var Hq=Object.defineProperty,Wq=Object.defineProperties,Kq=Object.getOwnPropertyDescriptors,s5=Object.getOwnPropertySymbols,Vq=Object.prototype.hasOwnProperty,Gq=Object.prototype.propertyIsEnumerable,o5=(t,e,r)=>e in t?Hq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))Vq.call(e,r)&&o5(t,r,e[r]);if(s5)for(var r of s5(e))Gq.call(e,r)&&o5(t,r,e[r]);return t},Es=(t,e)=>Wq(t,Kq(e));class Yq extends TD{constructor(e){super(e),this.name=kq,this.events=new im,this.initialized=!1,this.requestQueue={state:Zs.idle,queue:[]},this.sessionRequestQueue={state:Zs.idle,queue:[]},this.requestQueueDelay=vt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Nn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},vt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=Es(tn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n;let l=i,d,p=!1;try{l&&(p=this.client.core.pairing.pairings.get(l).active)}catch(U){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),U}if(!l||!p){const{topic:U,uri:z}=await this.client.core.pairing.create();l=U,d=z}if(!l){const{message:U}=ut("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(U)}const y=await this.client.core.crypto.generateKeyPair(),_=Nn.wc_sessionPropose.req.ttl||vt.FIVE_MINUTES,M=_n(_),O=tn({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:x6}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:M,pairingTopic:l},a&&{sessionProperties:a}),{reject:L,resolve:B,done:k}=cc(_,i5);this.events.once(br("session_connect"),async({error:U,session:z})=>{if(U)L(U);else if(z){z.self.publicKey=y;const Z=Es(tn({},z),{pairingTopic:O.pairingTopic,requiredNamespaces:O.requiredNamespaces,optionalNamespaces:O.optionalNamespaces,transportType:Wr.relay});await this.client.session.set(z.topic,Z),await this.setExpiry(z.topic,z.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:z.peer.metadata}),this.cleanupDuplicatePairings(Z),B(Z)}});const H=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:O,throwOnFailedPublish:!0});return await this.setProposal(H,tn({id:H},O)),{uri:d,approval:k}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[_s.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(W){throw o.setError(pc.no_internet_connection),W}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(W){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(pc.proposal_not_found),W}try{await this.isValidApprove(r)}catch(W){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(pc.session_approve_namespace_validation_failure),W}const{id:a,relayProtocol:u,namespaces:l,sessionProperties:d,sessionConfig:p}=r,y=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:_,proposer:M,requiredNamespaces:O,optionalNamespaces:L}=y;let B=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:_});B||(B=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:_s.session_approve_started,properties:{topic:_,trace:[_s.session_approve_started,_s.session_namespaces_validation_success]}}));const k=await this.client.core.crypto.generateKeyPair(),H=M.publicKey,U=await this.client.core.crypto.generateSharedKey(k,H),z=tn(tn({relay:{protocol:u??"irn"},namespaces:l,controller:{publicKey:k,metadata:this.client.metadata},expiry:_n(Iu)},d&&{sessionProperties:d}),p&&{sessionConfig:p}),Z=Wr.relay;B.addTrace(_s.subscribing_session_topic);try{await this.client.core.relayer.subscribe(U,{transportType:Z})}catch(W){throw B.setError(pc.subscribe_session_topic_failure),W}B.addTrace(_s.subscribe_session_topic_success);const R=Es(tn({},z),{topic:U,requiredNamespaces:O,optionalNamespaces:L,pairingTopic:_,acknowledged:!1,self:z.controller,peer:{publicKey:M.publicKey,metadata:M.metadata},controller:k,transportType:Wr.relay});await this.client.session.set(U,R),B.addTrace(_s.store_session);try{B.addTrace(_s.publishing_session_settle),await this.sendRequest({topic:U,method:"wc_sessionSettle",params:z,throwOnFailedPublish:!0}).catch(W=>{throw B==null||B.setError(pc.session_settle_publish_failure),W}),B.addTrace(_s.session_settle_publish_success),B.addTrace(_s.publishing_session_approve),await this.sendResult({id:a,topic:_,result:{relay:{protocol:u??"irn"},responderPublicKey:k},throwOnFailedPublish:!0}).catch(W=>{throw B==null||B.setError(pc.session_approve_publish_failure),W}),B.addTrace(_s.session_approve_publish_success)}catch(W){throw this.client.logger.error(W),this.client.session.delete(U,Dr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(U),W}return this.client.core.eventClient.deleteEvent({eventId:B.eventId}),await this.client.core.pairing.updateMetadata({topic:_,metadata:M.metadata}),await this.client.proposal.delete(a,Dr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:_}),await this.setExpiry(U,_n(Iu)),{topic:U,acknowledged:()=>Promise.resolve(this.client.session.get(U))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:Nn.wc_sessionPropose.reject}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(p){throw this.client.logger.error("update() -> isValidUpdate() failed"),p}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=cc(),u=ma(),l=hc().toString(),d=this.client.session.get(n).namespaces;return this.events.once(br("session_update",u),({error:p})=>{p?a(p):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:u,relayRpcId:l}).catch(p=>{this.client.logger.error(p),this.client.session.update(n,{namespaces:d}),a(p)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(u){throw this.client.logger.error("extend() -> isValidExtend() failed"),u}const{topic:n}=r,i=ma(),{done:s,resolve:o,reject:a}=cc();return this.events.once(br("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,_n(Iu)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(u=>{a(u)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(M){throw this.client.logger.error("request() -> isValidRequest() failed"),M}const{chainId:n,request:i,topic:s,expiry:o=Nn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=ma(),l=hc().toString(),{done:d,resolve:p,reject:y}=cc(o,"Request expired. Please try again.");this.events.once(br("session_request",u),({error:M,result:O})=>{M?y(M):p(O)});const _=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return _?(await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:Es(tn({},i),{expiryTimestamp:_n(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:_}).catch(M=>y(M)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),await d()):await Promise.all([new Promise(async M=>{await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:Es(tn({},i),{expiryTimestamp:_n(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(O=>y(O)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),M()}),new Promise(async M=>{var O;if(!((O=a.sessionConfig)!=null&&O.disableDeepLink)){const L=await r$(this.client.core.storage,n5);await e$({id:u,topic:s,wcDeepLink:L})}M()}),d()]).then(M=>M[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);Gs(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Xi(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=ma(),s=hc().toString(),{done:o,resolve:a,reject:u}=cc();this.events.once(br("session_ping",i),({error:l})=>{l?u(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=hc().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Dr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ut("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>rF(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?Wr.link_mode:Wr.relay;o===Wr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:u="",uri:l,domain:d,nonce:p,type:y,exp:_,nbf:M,methods:O=[],expiry:L}=r,B=[...r.resources||[]],{topic:k,uri:H}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:k,uri:H}});const U=await this.client.core.crypto.generateKeyPair(),z=r0(U);if(await Promise.all([this.client.auth.authKeys.set(l0,{responseTopic:z,publicKey:U}),this.client.auth.pairingTopics.set(z,{topic:z,pairingTopic:k})]),await this.client.core.relayer.subscribe(z,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${k}`),O.length>0){const{namespace:S}=Su(a[0]);let A=E$(S,"request",O);t0(B)&&(A=A$(A,B.pop())),B.push(A)}const Z=L&&L>Nn.wc_sessionAuthenticate.req.ttl?L:Nn.wc_sessionAuthenticate.req.ttl,R={authPayload:{type:y??"caip122",chains:a,statement:u,aud:l,domain:d,version:"1",nonce:p,iat:new Date().toISOString(),exp:_,nbf:M,resources:B},requester:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:_n(Z)},W={eip155:{chains:a,methods:[...new Set(["personal_sign",...O])],events:["chainChanged","accountsChanged"]}},ie={requiredNamespaces:{},optionalNamespaces:W,relays:[{protocol:"irn"}],pairingTopic:k,proposer:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:_n(Nn.wc_sessionPropose.req.ttl)},{done:me,resolve:j,reject:E}=cc(Z,"Request expired"),m=async({error:S,session:A})=>{if(this.events.off(br("session_request",g),f),S)E(S);else if(A){A.self.publicKey=U,await this.client.session.set(A.topic,A),await this.setExpiry(A.topic,A.expiry),k&&await this.client.core.pairing.updateMetadata({topic:k,metadata:A.peer.metadata});const b=this.client.session.get(A.topic);await this.deleteProposal(v),j({session:b})}},f=async S=>{var A,b,P;if(await this.deletePendingAuthRequest(g,{message:"fulfilled",code:0}),S.error){const J=Dr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return S.error.code===J.code?void 0:(this.events.off(br("session_connect"),m),E(S.error.message))}await this.deleteProposal(v),this.events.off(br("session_connect"),m);const{cacaos:I,responder:F}=S.result,ce=[],D=[];for(const J of I){await D_({cacao:J,projectId:this.client.core.projectId})||(this.client.logger.error(J,"Signature verification failed"),E(Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Q}=J,T=t0(Q.resources),X=[g1(Q.iss)],re=e0(Q.iss);if(T){const ge=L_(T),oe=k_(T);ce.push(...ge),X.push(...oe)}for(const ge of X)D.push(`${ge}:${re}`)}const se=await this.client.core.crypto.generateSharedKey(U,F.publicKey);let ee;ce.length>0&&(ee={topic:se,acknowledged:!0,self:{publicKey:U,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:_n(Iu),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:k,namespaces:J_([...new Set(ce)],[...new Set(D)]),transportType:o},await this.client.core.relayer.subscribe(se,{transportType:o}),await this.client.session.set(se,ee),k&&await this.client.core.pairing.updateMetadata({topic:k,metadata:F.metadata}),ee=this.client.session.get(se)),(A=this.client.metadata.redirect)!=null&&A.linkMode&&(b=F.metadata.redirect)!=null&&b.linkMode&&(P=F.metadata.redirect)!=null&&P.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(se,{transportType:Wr.link_mode})),j({auths:I,session:ee})},g=ma(),v=ma();this.events.once(br("session_connect"),m),this.events.once(br("session_request",g),f);let x;try{if(s){const S=va("wc_sessionAuthenticate",R,g);this.client.core.history.set(k,S);const A=await this.client.core.crypto.encode("",S,{type:_l,encoding:wl});x=n0(n,k,A)}else await Promise.all([this.sendRequest({topic:k,method:"wc_sessionAuthenticate",params:R,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:g}),this.sendRequest({topic:k,method:"wc_sessionPropose",params:ie,expiry:Nn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:v})])}catch(S){throw this.events.off(br("session_connect"),m),this.events.off(br("session_request",g),f),S}return await this.setProposal(v,tn({id:v},ie)),await this.setAuthRequest(g,{request:Es(tn({},R),{verifyContext:{}}),pairingTopic:k,transportType:o}),{uri:x??H,response:me}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[gc.authenticated_session_approve_started]}});try{this.isInitialized()}catch(L){throw s.setError(Dl.no_internet_connection),L}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Dl.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||Wr.relay;a===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=r0(u),p={type:So,receiverPublicKey:u,senderPublicKey:l},y=[],_=[];for(const L of i){if(!await D_({cacao:L,projectId:this.client.core.projectId})){s.setError(Dl.invalid_cacao);const z=Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:z,encodeOpts:p}),new Error(z.message)}s.addTrace(gc.cacaos_verified);const{p:B}=L,k=t0(B.resources),H=[g1(B.iss)],U=e0(B.iss);if(k){const z=L_(k),Z=k_(k);y.push(...z),H.push(...Z)}for(const z of H)_.push(`${z}:${U}`)}const M=await this.client.core.crypto.generateSharedKey(l,u);s.addTrace(gc.create_authenticated_session_topic);let O;if((y==null?void 0:y.length)>0){O={topic:M,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:u,metadata:o.requester.metadata},controller:u,expiry:_n(Iu),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:J_([...new Set(y)],[...new Set(_)]),transportType:a},s.addTrace(gc.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(M,{transportType:a})}catch(L){throw s.setError(Dl.subscribe_authenticated_session_topic_failure),L}s.addTrace(gc.subscribe_authenticated_session_topic_success),await this.client.session.set(M,O),s.addTrace(gc.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(gc.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:p,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(L){throw s.setError(Dl.authenticated_session_approve_publish_failure),L}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:O}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),u=r0(o),l={type:So,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:u,error:i,encodeOpts:l,rpcOpts:Nn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return O_(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:u}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Dr("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(n5).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,Dr("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Zs.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(pc.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Dr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Zs.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,_n(Nn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=Wr.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||_n(Nn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l,appLink:d}=r,p=va(i,s,u);let y;const _=!!d;try{const L=_?wl:ga;y=await this.client.core.crypto.encode(n,p,{encoding:L})}catch(L){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),L}let M;if($q.includes(i)){const L=Ao(JSON.stringify(p)),B=Ao(y);M=await this.client.core.verify.register({id:B,decryptedId:L})}const O=Nn[i].req;if(O.attestation=M,o&&(O.ttl=o),a&&(O.id=a),this.client.core.history.set(n,p),_){const L=n0(d,n,y);await global.Linking.openURL(L,this.client.name)}else{const L=Nn[i].req;o&&(L.ttl=o),a&&(L.id=a),l?(L.internal=Es(tn({},L.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,y,L)):this.client.core.relayer.publish(n,y,L).catch(B=>this.client.logger.error(B))}return p.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:u}=r,l=s0(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const _=p?wl:ga;d=await this.client.core.crypto.encode(i,l,Es(tn({},a||{}),{encoding:_}))}catch(_){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),_}let y;try{y=await this.client.core.history.get(i,n)}catch(_){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),_}if(p){const _=n0(u,i,d);await global.Linking.openURL(_,this.client.name)}else{const _=Nn[y.request.method].res;o?(_.internal=Es(tn({},_.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,_)):this.client.core.relayer.publish(i,d,_).catch(M=>this.client.logger.error(M))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:u}=r,l=o0(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const _=p?wl:ga;d=await this.client.core.crypto.encode(i,l,Es(tn({},o||{}),{encoding:_}))}catch(_){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),_}let y;try{y=await this.client.core.history.get(i,n)}catch(_){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),_}if(p){const _=n0(u,i,d);await global.Linking.openURL(_,this.client.name)}else{const _=a||Nn[y.request.method].res;this.client.core.relayer.publish(i,d,_)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;pa(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{pa(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Zs.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Zs.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Zs.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,u=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:u}))switch(u){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=ut("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:u}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(tn({},i.params));const d=a.expiryTimestamp||_n(Nn.wc_sessionPropose.req.ttl),p=tn({id:u,pairingTopic:n,expiryTimestamp:d},a);await this.setProposal(u,p);const y=await this.getVerifyContext({attestationId:s,hash:Ao(JSON.stringify(i)),encryptedId:o,metadata:p.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(Io.proposal_listener_not_found)),l==null||l.addTrace(Xs.emit_session_proposal),this.client.events.emit("session_proposal",{id:u,params:p,verifyContext:y})}catch(l){await this.sendError({id:u,topic:n,error:l,rpcOpts:Nn.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(Gs(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const u=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const d=await this.client.core.crypto.generateSharedKey(u,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:d});const p=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:p}),await this.client.core.pairing.activate({topic:r})}else if(Xi(n)){await this.client.proposal.delete(s,Dr("USER_DISCONNECTED"));const o=br("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(br("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:u,namespaces:l,sessionProperties:d,sessionConfig:p}=n.params,y=Es(tn(tn({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},d&&{sessionProperties:d}),p&&{sessionConfig:p}),{transportType:Wr.relay}),_=br("session_connect");if(this.events.listenerCount(_)===0)throw new Error(`emitting ${_} without any listeners 997`);this.events.emit(br("session_connect"),{session:y}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;Gs(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(br("session_approve",i),{})):Xi(n)&&(await this.client.session.delete(r,Dr("USER_DISCONNECTED")),this.events.emit(br("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Il.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Dr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(tn({topic:r},i));try{Il.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(u){throw Il.delete(o),u}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=br("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Gs(n)?this.events.emit(br("session_update",i),{}):Xi(n)&&this.events.emit(br("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,_n(Iu)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=br("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Gs(n)?this.events.emit(br("session_extend",i),{}):Xi(n)&&this.events.emit(br("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=br("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{Gs(n)?this.events.emit(br("session_ping",i),{}):Xi(n)&&this.events.emit(br("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(ni.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Dr("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:u,encryptedId:l,transportType:d}=r,{id:p,params:y}=a;try{await this.isValidRequest(tn({topic:o},y));const _=this.client.session.get(o),M=await this.getVerifyContext({attestationId:u,hash:Ao(JSON.stringify(va("wc_sessionRequest",y,p))),encryptedId:l,metadata:_.peer.metadata,transportType:d}),O={id:p,topic:o,params:y,verifyContext:M};await this.setPendingSessionRequest(O),d===Wr.link_mode&&(n=_.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=_.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(O):(this.addSessionRequestToSessionRequestQueue(O),this.processSessionRequestQueue())}catch(_){await this.sendError({id:p,topic:o,error:_}),this.client.logger.error(_)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=br("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Gs(n)?this.events.emit(br("session_request",i),{result:n.result}):Xi(n)&&this.events.emit(br("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Il.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(tn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Il.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),Gs(n)?this.events.emit(br("session_request",i),{result:n.result}):Xi(n)&&this.events.emit(br("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:u}=r;try{const{requester:l,authPayload:d,expiryTimestamp:p}=s.params,y=await this.getVerifyContext({attestationId:o,hash:Ao(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:u}),_={requester:l,pairingTopic:i,id:s.id,authPayload:d,verifyContext:y,expiryTimestamp:p};await this.setAuthRequest(s.id,{request:_,pairingTopic:i,transportType:u}),u===Wr.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:y})}catch(l){this.client.logger.error(l);const d=s.params.requester.publicKey,p=await this.client.core.crypto.generateKeyPair(),y=this.getAppLinkIfEnabled(s.params.requester.metadata,u),_={type:So,receiverPublicKey:d,senderPublicKey:p};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:_,rpcOpts:Nn.wc_sessionAuthenticate.autoReject,appLink:y})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Zs.idle,this.processSessionRequestQueue()},vt.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=br("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(br("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Zs.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Zs.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:va("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!bi(r)){const{message:u}=ut("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(vi(n)||await this.isValidPairingTopic(n),!pF(a)){const{message:u}=ut("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!vi(i)&&Ml(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!vi(s)&&Ml(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),vi(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=dF(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!bi(r))throw new Error(ut("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),u=x1(i,"approve()");if(u)throw new Error(u.message);const l=t6(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!on(s,!0)){const{message:d}=ut("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}vi(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!bi(r)){const{message:s}=ut("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!mF(i)){const{message:s}=ut("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!bi(r)){const{message:l}=ut("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!Q_(n)){const{message:l}=ut("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=aF(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const u=x1(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(pa(o)){const{message:l}=ut("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!bi(r)){const{message:u}=ut("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=x1(i,"update()");if(o)throw new Error(o.message);const a=t6(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!bi(r)){const{message:i}=ut("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!bi(r)){const{message:u}=ut("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!e6(a,s)){const{message:u}=ut("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!vF(i)){const{message:u}=ut("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!wF(a,s,i.method)){const{message:u}=ut("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!SF(o,O1)){const{message:u}=ut("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${O1.min} and ${O1.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!bi(r)){const{message:o}=ut("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!bF(s)){const{message:o}=ut("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!bi(r)){const{message:i}=ut("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!bi(r)){const{message:a}=ut("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!e6(o,s)){const{message:a}=ut("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!yF(i)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!xF(o,s,i.name)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!bi(r)){const{message:i}=ut("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!on(i,!1))throw new Error("uri is required parameter");if(!on(s,!1))throw new Error("domain is required parameter");if(!on(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(u=>Su(u).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Su(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,u={verified:{verifyUrl:o.verifyUrl||Rl,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Wr.link_mode){const d=this.getAppLinkIfEnabled(o,a);return u.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",u}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(u.verified.origin=l.origin,u.verified.isScam=l.isScam,u.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(u)}`),u},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!on(i,!1)){const{message:s}=ut("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,u,l,d,p,y;return!r||n!==Wr.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(u=this.client.metadata)==null?void 0:u.redirect)==null?void 0:l.universal)!==""&&((d=r==null?void 0:r.redirect)==null?void 0:d.universal)!==void 0&&((p=r==null?void 0:r.redirect)==null?void 0:p.universal)!==""&&((y=r==null?void 0:r.redirect)==null?void 0:y.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=M_(r,"topic")||"",i=decodeURIComponent(M_(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:Wr.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(d1()||Au()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ni.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(l0)?this.client.auth.authKeys.get(l0):{publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===Wr.link_mode?wl:ga});try{S1(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:Ao(n)})):a0(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(u){this.client.logger.error(u)}}registerExpirerEvents(){this.client.core.expirer.on(es.expired,async e=>{const{topic:r,id:n}=P_(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ut("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,ut("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(dc.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(dc.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!on(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(pa(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=ut("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!on(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(pa(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=ut("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=ut("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(on(e,!1)){const{message:r}=ut("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=ut("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!gF(e)){const{message:r}=ut("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(pa(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=ut("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class Jq extends mc{constructor(e,r){super(e,r,Nq,R1),this.core=e,this.logger=r}}let Xq=class extends mc{constructor(e,r){super(e,r,Lq,R1),this.core=e,this.logger=r}};class Zq extends mc{constructor(e,r){super(e,r,Bq,R1,n=>n.id),this.core=e,this.logger=r}}class Qq extends mc{constructor(e,r){super(e,r,Uq,f0,()=>l0),this.core=e,this.logger=r}}class ez extends mc{constructor(e,r){super(e,r,qq,f0),this.core=e,this.logger=r}}class tz extends mc{constructor(e,r){super(e,r,zq,f0,n=>n.id),this.core=e,this.logger=r}}class rz{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new Qq(this.core,this.logger),this.pairingTopics=new ez(this.core,this.logger),this.requests=new tz(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class N1 extends CD{constructor(e){super(e),this.protocol=e5,this.version=t5,this.name=D1.name,this.events=new Hi.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||D1.name,this.metadata=(e==null?void 0:e.metadata)||x_(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:rl(bd({level:(e==null?void 0:e.logger)||D1.logger}));this.core=(e==null?void 0:e.core)||new Oq(e),this.logger=ti(r,this.name),this.session=new Xq(this.core,this.logger),this.proposal=new Jq(this.core,this.logger),this.pendingRequest=new Zq(this.core,this.logger),this.engine=new Yq(this),this.auth=new rz(this.core,this.logger)}static async init(e){const r=new N1(e);return await r.initialize(),r}get context(){return pi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var h0={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */h0.exports,function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",l=500,d="__lodash_placeholder__",p=1,y=2,_=4,M=1,O=2,L=1,B=2,k=4,H=8,U=16,z=32,Z=64,R=128,W=256,ie=512,me=30,j="...",E=800,m=16,f=1,g=2,v=3,x=1/0,S=9007199254740991,A=17976931348623157e292,b=NaN,P=4294967295,I=P-1,F=P>>>1,ce=[["ary",R],["bind",L],["bindKey",B],["curry",H],["curryRight",U],["flip",ie],["partial",z],["partialRight",Z],["rearg",W]],D="[object Arguments]",se="[object Array]",ee="[object AsyncFunction]",J="[object Boolean]",Q="[object Date]",T="[object DOMException]",X="[object Error]",re="[object Function]",ge="[object GeneratorFunction]",oe="[object Map]",fe="[object Number]",be="[object Null]",Me="[object Object]",Ne="[object Promise]",Te="[object Proxy]",$e="[object RegExp]",Ie="[object Set]",Le="[object String]",Ve="[object Symbol]",ke="[object Undefined]",ze="[object WeakMap]",He="[object WeakSet]",Se="[object ArrayBuffer]",Qe="[object DataView]",ct="[object Float32Array]",Be="[object Float64Array]",et="[object Int8Array]",rt="[object Int16Array]",Je="[object Int32Array]",gt="[object Uint8Array]",ht="[object Uint8ClampedArray]",ft="[object Uint16Array]",Ht="[object Uint32Array]",Jt=/\b__p \+= '';/g,St=/\b(__p \+=) '' \+/g,er=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Xt=/&(?:amp|lt|gt|quot|#39);/g,Ot=/[&<>"']/g,Bt=RegExp(Xt.source),Tt=RegExp(Ot.source),bt=/<%-([\s\S]+?)%>/g,Dt=/<%([\s\S]+?)%>/g,Lt=/<%=([\s\S]+?)%>/g,yt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$t=/^\w*$/,jt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(nt.source),$=/^\s+/,K=/\s/,G=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C=/\{\n\/\* \[wrapped with (.+)\] \*/,Y=/,? & /,q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ae=/[()=,{}\[\]\/\s]/,pe=/\\(\\)?/g,_e=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Re=/\w*$/,De=/^[-+]0x[0-9a-f]+$/i,it=/^0b[01]+$/i,Ue=/^\[object .+?Constructor\]$/,mt=/^0o[0-7]+$/i,st=/^(?:0|[1-9]\d*)$/,tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,Rt=/['\n\r\u2028\u2029\\]/g,Mt="\\ud800-\\udfff",Et="\\u0300-\\u036f",dt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",ot=Et+dt+_t,wt="\\u2700-\\u27bf",lt="a-z\\xdf-\\xf6\\xf8-\\xff",at="\\xac\\xb1\\xd7\\xf7",Ae="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Pe="\\u2000-\\u206f",Ge=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="A-Z\\xc0-\\xd6\\xd8-\\xde",qe="\\ufe0e\\ufe0f",Xe=at+Ae+Pe+Ge,kt="['’]",Wt="["+Mt+"]",Zt="["+Xe+"]",Kt="["+ot+"]",de="\\d+",nr="["+wt+"]",pr="["+lt+"]",gr="[^"+Mt+Xe+de+wt+lt+je+"]",Qt="\\ud83c[\\udffb-\\udfff]",mr="(?:"+Kt+"|"+Qt+")",lr="[^"+Mt+"]",Lr="(?:\\ud83c[\\udde6-\\uddff]){2}",vr="[\\ud800-\\udbff][\\udc00-\\udfff]",xr="["+je+"]",Br="\\u200d",$r="(?:"+pr+"|"+gr+")",Ir="(?:"+xr+"|"+gr+")",ln="(?:"+kt+"(?:d|ll|m|re|s|t|ve))?",hn="(?:"+kt+"(?:D|LL|M|RE|S|T|VE))?",dn=mr+"?",vp="["+qe+"]?",Gb="(?:"+Br+"(?:"+[lr,Lr,vr].join("|")+")"+vp+dn+")*",jo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",bp="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",yp=vp+dn+Gb,ef="(?:"+[nr,Lr,vr].join("|")+")"+yp,Yb="(?:"+[lr+Kt+"?",Kt,Lr,vr,Wt].join("|")+")",bh=RegExp(kt,"g"),Jb=RegExp(Kt,"g"),tf=RegExp(Qt+"(?="+Qt+")|"+Yb+yp,"g"),wp=RegExp([xr+"?"+pr+"+"+ln+"(?="+[Zt,xr,"$"].join("|")+")",Ir+"+"+hn+"(?="+[Zt,xr+$r,"$"].join("|")+")",xr+"?"+$r+"+"+ln,xr+"+"+hn,bp,jo,de,ef].join("|"),"g"),xp=RegExp("["+Br+Mt+ot+qe+"]"),Dc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,_p=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Xb=-1,Fr={};Fr[ct]=Fr[Be]=Fr[et]=Fr[rt]=Fr[Je]=Fr[gt]=Fr[ht]=Fr[ft]=Fr[Ht]=!0,Fr[D]=Fr[se]=Fr[Se]=Fr[J]=Fr[Qe]=Fr[Q]=Fr[X]=Fr[re]=Fr[oe]=Fr[fe]=Fr[Me]=Fr[$e]=Fr[Ie]=Fr[Le]=Fr[ze]=!1;var kr={};kr[D]=kr[se]=kr[Se]=kr[Qe]=kr[J]=kr[Q]=kr[ct]=kr[Be]=kr[et]=kr[rt]=kr[Je]=kr[oe]=kr[fe]=kr[Me]=kr[$e]=kr[Ie]=kr[Le]=kr[Ve]=kr[gt]=kr[ht]=kr[ft]=kr[Ht]=!0,kr[X]=kr[re]=kr[ze]=!1;var ue={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},we={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye={"&":"&","<":"<",">":">",""":'"',"'":"'"},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},jr=parseFloat,ir=parseInt,Yr=typeof nn=="object"&&nn&&nn.Object===Object&&nn,wn=typeof self=="object"&&self&&self.Object===Object&&self,Er=Yr||wn||Function("return this")(),Ur=e&&!e.nodeType&&e,pn=Ur&&!0&&t&&!t.nodeType&&t,xi=pn&&pn.exports===Ur,xn=xi&&Yr.process,Jr=function(){try{var ye=pn&&pn.require&&pn.require("util").types;return ye||xn&&xn.binding&&xn.binding("util")}catch{}}(),si=Jr&&Jr.isArrayBuffer,Cs=Jr&&Jr.isDate,os=Jr&&Jr.isMap,oo=Jr&&Jr.isRegExp,yh=Jr&&Jr.isSet,Oc=Jr&&Jr.isTypedArray;function Ln(ye,Fe,Ce){switch(Ce.length){case 0:return ye.call(Fe);case 1:return ye.call(Fe,Ce[0]);case 2:return ye.call(Fe,Ce[0],Ce[1]);case 3:return ye.call(Fe,Ce[0],Ce[1],Ce[2])}return ye.apply(Fe,Ce)}function fee(ye,Fe,Ce,Ct){for(var tr=-1,Mr=ye==null?0:ye.length;++tr-1}function Zb(ye,Fe,Ce){for(var Ct=-1,tr=ye==null?0:ye.length;++Ct-1;);return Ce}function R9(ye,Fe){for(var Ce=ye.length;Ce--&&rf(Fe,ye[Ce],0)>-1;);return Ce}function yee(ye,Fe){for(var Ce=ye.length,Ct=0;Ce--;)ye[Ce]===Fe&&++Ct;return Ct}var wee=ry(ue),xee=ry(we);function _ee(ye){return"\\"+It[ye]}function Eee(ye,Fe){return ye==null?r:ye[Fe]}function nf(ye){return xp.test(ye)}function See(ye){return Dc.test(ye)}function Aee(ye){for(var Fe,Ce=[];!(Fe=ye.next()).done;)Ce.push(Fe.value);return Ce}function oy(ye){var Fe=-1,Ce=Array(ye.size);return ye.forEach(function(Ct,tr){Ce[++Fe]=[tr,Ct]}),Ce}function D9(ye,Fe){return function(Ce){return ye(Fe(Ce))}}function Na(ye,Fe){for(var Ce=-1,Ct=ye.length,tr=0,Mr=[];++Ce-1}function hte(c,h){var w=this.__data__,N=jp(w,c);return N<0?(++this.size,w.push([c,h])):w[N][1]=h,this}Uo.prototype.clear=cte,Uo.prototype.delete=ute,Uo.prototype.get=fte,Uo.prototype.has=lte,Uo.prototype.set=hte;function qo(c){var h=-1,w=c==null?0:c.length;for(this.clear();++h=h?c:h)),c}function fs(c,h,w,N,V,ne){var he,ve=h&p,xe=h&y,We=h&_;if(w&&(he=V?w(c,N,V,ne):w(c)),he!==r)return he;if(!Qr(c))return c;var Ke=sr(c);if(Ke){if(he=mre(c),!ve)return _i(c,he)}else{var Ze=Qn(c),xt=Ze==re||Ze==ge;if(ja(c))return pA(c,ve);if(Ze==Me||Ze==D||xt&&!V){if(he=xe||xt?{}:OA(c),!ve)return xe?sre(c,Ite(he,c)):ire(c,H9(he,c))}else{if(!kr[Ze])return V?c:{};he=vre(c,Ze,ve)}}ne||(ne=new Rs);var Nt=ne.get(c);if(Nt)return Nt;ne.set(c,he),cP(c)?c.forEach(function(Gt){he.add(fs(Gt,h,w,Gt,c,ne))}):oP(c)&&c.forEach(function(Gt,yr){he.set(yr,fs(Gt,h,w,yr,c,ne))});var Vt=We?xe?Dy:Ry:xe?Si:kn,fr=Ke?r:Vt(c);return as(fr||c,function(Gt,yr){fr&&(yr=Gt,Gt=c[yr]),Ph(he,yr,fs(Gt,h,w,yr,c,ne))}),he}function Cte(c){var h=kn(c);return function(w){return W9(w,c,h)}}function W9(c,h,w){var N=w.length;if(c==null)return!N;for(c=qr(c);N--;){var V=w[N],ne=h[V],he=c[V];if(he===r&&!(V in c)||!ne(he))return!1}return!0}function K9(c,h,w){if(typeof c!="function")throw new cs(o);return Oh(function(){c.apply(r,w)},h)}function Mh(c,h,w,N){var V=-1,ne=Ep,he=!0,ve=c.length,xe=[],We=h.length;if(!ve)return xe;w&&(h=Xr(h,Li(w))),N?(ne=Zb,he=!1):h.length>=i&&(ne=wh,he=!1,h=new kc(h));e:for(;++VV?0:V+w),N=N===r||N>V?V:ur(N),N<0&&(N+=V),N=w>N?0:fP(N);w0&&w(ve)?h>1?Hn(ve,h-1,w,N,V):Oa(V,ve):N||(V[V.length]=ve)}return V}var dy=wA(),Y9=wA(!0);function ao(c,h){return c&&dy(c,h,kn)}function py(c,h){return c&&Y9(c,h,kn)}function qp(c,h){return Da(h,function(w){return Vo(c[w])})}function $c(c,h){h=$a(h,c);for(var w=0,N=h.length;c!=null&&wh}function Dte(c,h){return c!=null&&Tr.call(c,h)}function Ote(c,h){return c!=null&&h in qr(c)}function Nte(c,h,w){return c>=Zn(h,w)&&c=120&&Ke.length>=120)?new kc(he&&Ke):r}Ke=c[0];var Ze=-1,xt=ve[0];e:for(;++Ze-1;)ve!==c&&Op.call(ve,xe,1),Op.call(c,xe,1);return c}function oA(c,h){for(var w=c?h.length:0,N=w-1;w--;){var V=h[w];if(w==N||V!==ne){var ne=V;Ko(V)?Op.call(c,V,1):Sy(c,V)}}return c}function xy(c,h){return c+kp(j9()*(h-c+1))}function Vte(c,h,w,N){for(var V=-1,ne=An(Lp((h-c)/(w||1)),0),he=Ce(ne);ne--;)he[N?ne:++V]=c,c+=w;return he}function _y(c,h){var w="";if(!c||h<1||h>S)return w;do h%2&&(w+=c),h=kp(h/2),h&&(c+=c);while(h);return w}function hr(c,h){return Fy(kA(c,h,Ai),c+"")}function Gte(c){return z9(gf(c))}function Yte(c,h){var w=gf(c);return Qp(w,Bc(h,0,w.length))}function Th(c,h,w,N){if(!Qr(c))return c;h=$a(h,c);for(var V=-1,ne=h.length,he=ne-1,ve=c;ve!=null&&++VV?0:V+h),w=w>V?V:w,w<0&&(w+=V),V=h>w?0:w-h>>>0,h>>>=0;for(var ne=Ce(V);++N>>1,he=c[ne];he!==null&&!Bi(he)&&(w?he<=h:he=i){var We=h?null:ure(c);if(We)return Ap(We);he=!1,V=wh,xe=new kc}else xe=h?[]:ve;e:for(;++N=N?c:ls(c,h,w)}var dA=jee||function(c){return Er.clearTimeout(c)};function pA(c,h){if(h)return c.slice();var w=c.length,N=L9?L9(w):new c.constructor(w);return c.copy(N),N}function Iy(c){var h=new c.constructor(c.byteLength);return new Rp(h).set(new Rp(c)),h}function ere(c,h){var w=h?Iy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.byteLength)}function tre(c){var h=new c.constructor(c.source,Re.exec(c));return h.lastIndex=c.lastIndex,h}function rre(c){return Ah?qr(Ah.call(c)):{}}function gA(c,h){var w=h?Iy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.length)}function mA(c,h){if(c!==h){var w=c!==r,N=c===null,V=c===c,ne=Bi(c),he=h!==r,ve=h===null,xe=h===h,We=Bi(h);if(!ve&&!We&&!ne&&c>h||ne&&he&&xe&&!ve&&!We||N&&he&&xe||!w&&xe||!V)return 1;if(!N&&!ne&&!We&&c=ve)return xe;var We=w[N];return xe*(We=="desc"?-1:1)}}return c.index-h.index}function vA(c,h,w,N){for(var V=-1,ne=c.length,he=w.length,ve=-1,xe=h.length,We=An(ne-he,0),Ke=Ce(xe+We),Ze=!N;++ve1?w[V-1]:r,he=V>2?w[2]:r;for(ne=c.length>3&&typeof ne=="function"?(V--,ne):r,he&&ai(w[0],w[1],he)&&(ne=V<3?r:ne,V=1),h=qr(h);++N-1?V[ne?h[he]:he]:r}}function EA(c){return Wo(function(h){var w=h.length,N=w,V=us.prototype.thru;for(c&&h.reverse();N--;){var ne=h[N];if(typeof ne!="function")throw new cs(o);if(V&&!he&&Xp(ne)=="wrapper")var he=new us([],!0)}for(N=he?N:w;++N1&&Sr.reverse(),Ke&&xeve))return!1;var We=ne.get(c),Ke=ne.get(h);if(We&&Ke)return We==h&&Ke==c;var Ze=-1,xt=!0,Nt=w&O?new kc:r;for(ne.set(c,h),ne.set(h,c);++Ze1?"& ":"")+h[N],h=h.join(w>2?", ":" "),c.replace(G,`{ + */h0.exports,function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",l=500,d="__lodash_placeholder__",p=1,y=2,_=4,M=1,O=2,L=1,B=2,k=4,H=8,U=16,z=32,Z=64,R=128,W=256,ie=512,me=30,j="...",E=800,m=16,f=1,g=2,v=3,x=1/0,S=9007199254740991,A=17976931348623157e292,b=NaN,P=4294967295,I=P-1,F=P>>>1,ce=[["ary",R],["bind",L],["bindKey",B],["curry",H],["curryRight",U],["flip",ie],["partial",z],["partialRight",Z],["rearg",W]],D="[object Arguments]",se="[object Array]",ee="[object AsyncFunction]",J="[object Boolean]",Q="[object Date]",T="[object DOMException]",X="[object Error]",re="[object Function]",ge="[object GeneratorFunction]",oe="[object Map]",fe="[object Number]",be="[object Null]",Me="[object Object]",Ne="[object Promise]",Te="[object Proxy]",$e="[object RegExp]",Ie="[object Set]",Le="[object String]",Ve="[object Symbol]",ke="[object Undefined]",ze="[object WeakMap]",He="[object WeakSet]",Se="[object ArrayBuffer]",Qe="[object DataView]",ct="[object Float32Array]",Be="[object Float64Array]",et="[object Int8Array]",rt="[object Int16Array]",Je="[object Int32Array]",gt="[object Uint8Array]",ht="[object Uint8ClampedArray]",ft="[object Uint16Array]",Ht="[object Uint32Array]",Jt=/\b__p \+= '';/g,St=/\b(__p \+=) '' \+/g,er=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Xt=/&(?:amp|lt|gt|quot|#39);/g,Ot=/[&<>"']/g,Bt=RegExp(Xt.source),Tt=RegExp(Ot.source),bt=/<%-([\s\S]+?)%>/g,Dt=/<%([\s\S]+?)%>/g,Lt=/<%=([\s\S]+?)%>/g,yt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$t=/^\w*$/,jt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(nt.source),$=/^\s+/,K=/\s/,G=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C=/\{\n\/\* \[wrapped with (.+)\] \*/,Y=/,? & /,q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ae=/[()=,{}\[\]\/\s]/,pe=/\\(\\)?/g,_e=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Re=/\w*$/,De=/^[-+]0x[0-9a-f]+$/i,it=/^0b[01]+$/i,Ue=/^\[object .+?Constructor\]$/,mt=/^0o[0-7]+$/i,st=/^(?:0|[1-9]\d*)$/,tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,Rt=/['\n\r\u2028\u2029\\]/g,Mt="\\ud800-\\udfff",Et="\\u0300-\\u036f",dt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",ot=Et+dt+_t,wt="\\u2700-\\u27bf",lt="a-z\\xdf-\\xf6\\xf8-\\xff",at="\\xac\\xb1\\xd7\\xf7",Ae="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Pe="\\u2000-\\u206f",Ge=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="A-Z\\xc0-\\xd6\\xd8-\\xde",qe="\\ufe0e\\ufe0f",Xe=at+Ae+Pe+Ge,kt="['’]",Wt="["+Mt+"]",Zt="["+Xe+"]",Kt="["+ot+"]",de="\\d+",nr="["+wt+"]",pr="["+lt+"]",gr="[^"+Mt+Xe+de+wt+lt+je+"]",Qt="\\ud83c[\\udffb-\\udfff]",mr="(?:"+Kt+"|"+Qt+")",lr="[^"+Mt+"]",Lr="(?:\\ud83c[\\udde6-\\uddff]){2}",vr="[\\ud800-\\udbff][\\udc00-\\udfff]",xr="["+je+"]",Br="\\u200d",$r="(?:"+pr+"|"+gr+")",Ir="(?:"+xr+"|"+gr+")",ln="(?:"+kt+"(?:d|ll|m|re|s|t|ve))?",hn="(?:"+kt+"(?:D|LL|M|RE|S|T|VE))?",dn=mr+"?",vp="["+qe+"]?",Gb="(?:"+Br+"(?:"+[lr,Lr,vr].join("|")+")"+vp+dn+")*",jo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",bp="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",yp=vp+dn+Gb,ef="(?:"+[nr,Lr,vr].join("|")+")"+yp,Yb="(?:"+[lr+Kt+"?",Kt,Lr,vr,Wt].join("|")+")",bh=RegExp(kt,"g"),Jb=RegExp(Kt,"g"),tf=RegExp(Qt+"(?="+Qt+")|"+Yb+yp,"g"),wp=RegExp([xr+"?"+pr+"+"+ln+"(?="+[Zt,xr,"$"].join("|")+")",Ir+"+"+hn+"(?="+[Zt,xr+$r,"$"].join("|")+")",xr+"?"+$r+"+"+ln,xr+"+"+hn,bp,jo,de,ef].join("|"),"g"),xp=RegExp("["+Br+Mt+ot+qe+"]"),Oc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,_p=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Xb=-1,Fr={};Fr[ct]=Fr[Be]=Fr[et]=Fr[rt]=Fr[Je]=Fr[gt]=Fr[ht]=Fr[ft]=Fr[Ht]=!0,Fr[D]=Fr[se]=Fr[Se]=Fr[J]=Fr[Qe]=Fr[Q]=Fr[X]=Fr[re]=Fr[oe]=Fr[fe]=Fr[Me]=Fr[$e]=Fr[Ie]=Fr[Le]=Fr[ze]=!1;var kr={};kr[D]=kr[se]=kr[Se]=kr[Qe]=kr[J]=kr[Q]=kr[ct]=kr[Be]=kr[et]=kr[rt]=kr[Je]=kr[oe]=kr[fe]=kr[Me]=kr[$e]=kr[Ie]=kr[Le]=kr[Ve]=kr[gt]=kr[ht]=kr[ft]=kr[Ht]=!0,kr[X]=kr[re]=kr[ze]=!1;var ue={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},we={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye={"&":"&","<":"<",">":">",""":'"',"'":"'"},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},jr=parseFloat,ir=parseInt,Yr=typeof nn=="object"&&nn&&nn.Object===Object&&nn,wn=typeof self=="object"&&self&&self.Object===Object&&self,Er=Yr||wn||Function("return this")(),Ur=e&&!e.nodeType&&e,pn=Ur&&!0&&t&&!t.nodeType&&t,xi=pn&&pn.exports===Ur,xn=xi&&Yr.process,Jr=function(){try{var ye=pn&&pn.require&&pn.require("util").types;return ye||xn&&xn.binding&&xn.binding("util")}catch{}}(),si=Jr&&Jr.isArrayBuffer,Cs=Jr&&Jr.isDate,os=Jr&&Jr.isMap,oo=Jr&&Jr.isRegExp,yh=Jr&&Jr.isSet,Nc=Jr&&Jr.isTypedArray;function Ln(ye,Fe,Ce){switch(Ce.length){case 0:return ye.call(Fe);case 1:return ye.call(Fe,Ce[0]);case 2:return ye.call(Fe,Ce[0],Ce[1]);case 3:return ye.call(Fe,Ce[0],Ce[1],Ce[2])}return ye.apply(Fe,Ce)}function hee(ye,Fe,Ce,Ct){for(var tr=-1,Mr=ye==null?0:ye.length;++tr-1}function Zb(ye,Fe,Ce){for(var Ct=-1,tr=ye==null?0:ye.length;++Ct-1;);return Ce}function R9(ye,Fe){for(var Ce=ye.length;Ce--&&rf(Fe,ye[Ce],0)>-1;);return Ce}function xee(ye,Fe){for(var Ce=ye.length,Ct=0;Ce--;)ye[Ce]===Fe&&++Ct;return Ct}var _ee=ry(ue),Eee=ry(we);function See(ye){return"\\"+It[ye]}function Aee(ye,Fe){return ye==null?r:ye[Fe]}function nf(ye){return xp.test(ye)}function Pee(ye){return Oc.test(ye)}function Mee(ye){for(var Fe,Ce=[];!(Fe=ye.next()).done;)Ce.push(Fe.value);return Ce}function oy(ye){var Fe=-1,Ce=Array(ye.size);return ye.forEach(function(Ct,tr){Ce[++Fe]=[tr,Ct]}),Ce}function D9(ye,Fe){return function(Ce){return ye(Fe(Ce))}}function Na(ye,Fe){for(var Ce=-1,Ct=ye.length,tr=0,Mr=[];++Ce-1}function pte(c,h){var w=this.__data__,N=jp(w,c);return N<0?(++this.size,w.push([c,h])):w[N][1]=h,this}Uo.prototype.clear=fte,Uo.prototype.delete=lte,Uo.prototype.get=hte,Uo.prototype.has=dte,Uo.prototype.set=pte;function qo(c){var h=-1,w=c==null?0:c.length;for(this.clear();++h=h?c:h)),c}function fs(c,h,w,N,V,ne){var he,ve=h&p,xe=h&y,We=h&_;if(w&&(he=V?w(c,N,V,ne):w(c)),he!==r)return he;if(!Qr(c))return c;var Ke=sr(c);if(Ke){if(he=bre(c),!ve)return _i(c,he)}else{var Ze=Qn(c),xt=Ze==re||Ze==ge;if(ja(c))return pA(c,ve);if(Ze==Me||Ze==D||xt&&!V){if(he=xe||xt?{}:OA(c),!ve)return xe?are(c,Tte(he,c)):ore(c,H9(he,c))}else{if(!kr[Ze])return V?c:{};he=yre(c,Ze,ve)}}ne||(ne=new Rs);var Nt=ne.get(c);if(Nt)return Nt;ne.set(c,he),cP(c)?c.forEach(function(Gt){he.add(fs(Gt,h,w,Gt,c,ne))}):oP(c)&&c.forEach(function(Gt,yr){he.set(yr,fs(Gt,h,w,yr,c,ne))});var Vt=We?xe?Dy:Ry:xe?Si:kn,fr=Ke?r:Vt(c);return as(fr||c,function(Gt,yr){fr&&(yr=Gt,Gt=c[yr]),Ph(he,yr,fs(Gt,h,w,yr,c,ne))}),he}function Rte(c){var h=kn(c);return function(w){return W9(w,c,h)}}function W9(c,h,w){var N=w.length;if(c==null)return!N;for(c=qr(c);N--;){var V=w[N],ne=h[V],he=c[V];if(he===r&&!(V in c)||!ne(he))return!1}return!0}function K9(c,h,w){if(typeof c!="function")throw new cs(o);return Oh(function(){c.apply(r,w)},h)}function Mh(c,h,w,N){var V=-1,ne=Ep,he=!0,ve=c.length,xe=[],We=h.length;if(!ve)return xe;w&&(h=Xr(h,Li(w))),N?(ne=Zb,he=!1):h.length>=i&&(ne=wh,he=!1,h=new Bc(h));e:for(;++VV?0:V+w),N=N===r||N>V?V:ur(N),N<0&&(N+=V),N=w>N?0:fP(N);w0&&w(ve)?h>1?Hn(ve,h-1,w,N,V):Oa(V,ve):N||(V[V.length]=ve)}return V}var dy=wA(),Y9=wA(!0);function ao(c,h){return c&&dy(c,h,kn)}function py(c,h){return c&&Y9(c,h,kn)}function qp(c,h){return Da(h,function(w){return Vo(c[w])})}function Fc(c,h){h=$a(h,c);for(var w=0,N=h.length;c!=null&&wh}function Nte(c,h){return c!=null&&Tr.call(c,h)}function Lte(c,h){return c!=null&&h in qr(c)}function kte(c,h,w){return c>=Zn(h,w)&&c=120&&Ke.length>=120)?new Bc(he&&Ke):r}Ke=c[0];var Ze=-1,xt=ve[0];e:for(;++Ze-1;)ve!==c&&Op.call(ve,xe,1),Op.call(c,xe,1);return c}function oA(c,h){for(var w=c?h.length:0,N=w-1;w--;){var V=h[w];if(w==N||V!==ne){var ne=V;Ko(V)?Op.call(c,V,1):Sy(c,V)}}return c}function xy(c,h){return c+kp(j9()*(h-c+1))}function Yte(c,h,w,N){for(var V=-1,ne=An(Lp((h-c)/(w||1)),0),he=Ce(ne);ne--;)he[N?ne:++V]=c,c+=w;return he}function _y(c,h){var w="";if(!c||h<1||h>S)return w;do h%2&&(w+=c),h=kp(h/2),h&&(c+=c);while(h);return w}function hr(c,h){return Fy(kA(c,h,Ai),c+"")}function Jte(c){return z9(gf(c))}function Xte(c,h){var w=gf(c);return Qp(w,$c(h,0,w.length))}function Th(c,h,w,N){if(!Qr(c))return c;h=$a(h,c);for(var V=-1,ne=h.length,he=ne-1,ve=c;ve!=null&&++VV?0:V+h),w=w>V?V:w,w<0&&(w+=V),V=h>w?0:w-h>>>0,h>>>=0;for(var ne=Ce(V);++N>>1,he=c[ne];he!==null&&!Bi(he)&&(w?he<=h:he=i){var We=h?null:lre(c);if(We)return Ap(We);he=!1,V=wh,xe=new Bc}else xe=h?[]:ve;e:for(;++N=N?c:ls(c,h,w)}var dA=qee||function(c){return Er.clearTimeout(c)};function pA(c,h){if(h)return c.slice();var w=c.length,N=L9?L9(w):new c.constructor(w);return c.copy(N),N}function Iy(c){var h=new c.constructor(c.byteLength);return new Rp(h).set(new Rp(c)),h}function rre(c,h){var w=h?Iy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.byteLength)}function nre(c){var h=new c.constructor(c.source,Re.exec(c));return h.lastIndex=c.lastIndex,h}function ire(c){return Ah?qr(Ah.call(c)):{}}function gA(c,h){var w=h?Iy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.length)}function mA(c,h){if(c!==h){var w=c!==r,N=c===null,V=c===c,ne=Bi(c),he=h!==r,ve=h===null,xe=h===h,We=Bi(h);if(!ve&&!We&&!ne&&c>h||ne&&he&&xe&&!ve&&!We||N&&he&&xe||!w&&xe||!V)return 1;if(!N&&!ne&&!We&&c=ve)return xe;var We=w[N];return xe*(We=="desc"?-1:1)}}return c.index-h.index}function vA(c,h,w,N){for(var V=-1,ne=c.length,he=w.length,ve=-1,xe=h.length,We=An(ne-he,0),Ke=Ce(xe+We),Ze=!N;++ve1?w[V-1]:r,he=V>2?w[2]:r;for(ne=c.length>3&&typeof ne=="function"?(V--,ne):r,he&&ai(w[0],w[1],he)&&(ne=V<3?r:ne,V=1),h=qr(h);++N-1?V[ne?h[he]:he]:r}}function EA(c){return Wo(function(h){var w=h.length,N=w,V=us.prototype.thru;for(c&&h.reverse();N--;){var ne=h[N];if(typeof ne!="function")throw new cs(o);if(V&&!he&&Xp(ne)=="wrapper")var he=new us([],!0)}for(N=he?N:w;++N1&&Sr.reverse(),Ke&&xeve))return!1;var We=ne.get(c),Ke=ne.get(h);if(We&&Ke)return We==h&&Ke==c;var Ze=-1,xt=!0,Nt=w&O?new Bc:r;for(ne.set(c,h),ne.set(h,c);++Ze1?"& ":"")+h[N],h=h.join(w>2?", ":" "),c.replace(G,`{ /* [wrapped with `+h+`] */ -`)}function yre(c){return sr(c)||Uc(c)||!!($9&&c&&c[$9])}function Ko(c,h){var w=typeof c;return h=h??S,!!h&&(w=="number"||w!="symbol"&&st.test(c))&&c>-1&&c%1==0&&c0){if(++h>=E)return arguments[0]}else h=0;return c.apply(r,arguments)}}function Qp(c,h){var w=-1,N=c.length,V=N-1;for(h=h===r?N:h;++w1?c[h-1]:r;return w=typeof w=="function"?(c.pop(),w):r,GA(c,w)});function YA(c){var h=te(c);return h.__chain__=!0,h}function Tne(c,h){return h(c),c}function eg(c,h){return h(c)}var Rne=Wo(function(c){var h=c.length,w=h?c[0]:0,N=this.__wrapped__,V=function(ne){return hy(ne,c)};return h>1||this.__actions__.length||!(N instanceof _r)||!Ko(w)?this.thru(V):(N=N.slice(w,+w+(h?1:0)),N.__actions__.push({func:eg,args:[V],thisArg:r}),new us(N,this.__chain__).thru(function(ne){return h&&!ne.length&&ne.push(r),ne}))});function Dne(){return YA(this)}function One(){return new us(this.value(),this.__chain__)}function Nne(){this.__values__===r&&(this.__values__=uP(this.value()));var c=this.__index__>=this.__values__.length,h=c?r:this.__values__[this.__index__++];return{done:c,value:h}}function Lne(){return this}function kne(c){for(var h,w=this;w instanceof Fp;){var N=qA(w);N.__index__=0,N.__values__=r,h?V.__wrapped__=N:h=N;var V=N;w=w.__wrapped__}return V.__wrapped__=c,h}function Bne(){var c=this.__wrapped__;if(c instanceof _r){var h=c;return this.__actions__.length&&(h=new _r(this)),h=h.reverse(),h.__actions__.push({func:eg,args:[jy],thisArg:r}),new us(h,this.__chain__)}return this.thru(jy)}function $ne(){return lA(this.__wrapped__,this.__actions__)}var Fne=Kp(function(c,h,w){Tr.call(c,w)?++c[w]:zo(c,w,1)});function jne(c,h,w){var N=sr(c)?S9:Tte;return w&&ai(c,h,w)&&(h=r),N(c,qt(h,3))}function Une(c,h){var w=sr(c)?Da:G9;return w(c,qt(h,3))}var qne=_A(zA),zne=_A(HA);function Hne(c,h){return Hn(tg(c,h),1)}function Wne(c,h){return Hn(tg(c,h),x)}function Kne(c,h,w){return w=w===r?1:ur(w),Hn(tg(c,h),w)}function JA(c,h){var w=sr(c)?as:ka;return w(c,qt(h,3))}function XA(c,h){var w=sr(c)?lee:V9;return w(c,qt(h,3))}var Vne=Kp(function(c,h,w){Tr.call(c,w)?c[w].push(h):zo(c,w,[h])});function Gne(c,h,w,N){c=Ei(c)?c:gf(c),w=w&&!N?ur(w):0;var V=c.length;return w<0&&(w=An(V+w,0)),og(c)?w<=V&&c.indexOf(h,w)>-1:!!V&&rf(c,h,w)>-1}var Yne=hr(function(c,h,w){var N=-1,V=typeof h=="function",ne=Ei(c)?Ce(c.length):[];return ka(c,function(he){ne[++N]=V?Ln(h,he,w):Ih(he,h,w)}),ne}),Jne=Kp(function(c,h,w){zo(c,w,h)});function tg(c,h){var w=sr(c)?Xr:eA;return w(c,qt(h,3))}function Xne(c,h,w,N){return c==null?[]:(sr(h)||(h=h==null?[]:[h]),w=N?r:w,sr(w)||(w=w==null?[]:[w]),iA(c,h,w))}var Zne=Kp(function(c,h,w){c[w?0:1].push(h)},function(){return[[],[]]});function Qne(c,h,w){var N=sr(c)?Qb:I9,V=arguments.length<3;return N(c,qt(h,4),w,V,ka)}function eie(c,h,w){var N=sr(c)?hee:I9,V=arguments.length<3;return N(c,qt(h,4),w,V,V9)}function tie(c,h){var w=sr(c)?Da:G9;return w(c,ig(qt(h,3)))}function rie(c){var h=sr(c)?z9:Gte;return h(c)}function nie(c,h,w){(w?ai(c,h,w):h===r)?h=1:h=ur(h);var N=sr(c)?Ate:Yte;return N(c,h)}function iie(c){var h=sr(c)?Pte:Xte;return h(c)}function sie(c){if(c==null)return 0;if(Ei(c))return og(c)?sf(c):c.length;var h=Qn(c);return h==oe||h==Ie?c.size:by(c).length}function oie(c,h,w){var N=sr(c)?ey:Zte;return w&&ai(c,h,w)&&(h=r),N(c,qt(h,3))}var aie=hr(function(c,h){if(c==null)return[];var w=h.length;return w>1&&ai(c,h[0],h[1])?h=[]:w>2&&ai(h[0],h[1],h[2])&&(h=[h[0]]),iA(c,Hn(h,1),[])}),rg=Uee||function(){return Er.Date.now()};function cie(c,h){if(typeof h!="function")throw new cs(o);return c=ur(c),function(){if(--c<1)return h.apply(this,arguments)}}function ZA(c,h,w){return h=w?r:h,h=c&&h==null?c.length:h,Ho(c,R,r,r,r,r,h)}function QA(c,h){var w;if(typeof h!="function")throw new cs(o);return c=ur(c),function(){return--c>0&&(w=h.apply(this,arguments)),c<=1&&(h=r),w}}var qy=hr(function(c,h,w){var N=L;if(w.length){var V=Na(w,df(qy));N|=z}return Ho(c,N,h,w,V)}),eP=hr(function(c,h,w){var N=L|B;if(w.length){var V=Na(w,df(eP));N|=z}return Ho(h,N,c,w,V)});function tP(c,h,w){h=w?r:h;var N=Ho(c,H,r,r,r,r,r,h);return N.placeholder=tP.placeholder,N}function rP(c,h,w){h=w?r:h;var N=Ho(c,U,r,r,r,r,r,h);return N.placeholder=rP.placeholder,N}function nP(c,h,w){var N,V,ne,he,ve,xe,We=0,Ke=!1,Ze=!1,xt=!0;if(typeof c!="function")throw new cs(o);h=ds(h)||0,Qr(w)&&(Ke=!!w.leading,Ze="maxWait"in w,ne=Ze?An(ds(w.maxWait)||0,h):ne,xt="trailing"in w?!!w.trailing:xt);function Nt(mn){var Os=N,Yo=V;return N=V=r,We=mn,he=c.apply(Yo,Os),he}function Vt(mn){return We=mn,ve=Oh(yr,h),Ke?Nt(mn):he}function fr(mn){var Os=mn-xe,Yo=mn-We,_P=h-Os;return Ze?Zn(_P,ne-Yo):_P}function Gt(mn){var Os=mn-xe,Yo=mn-We;return xe===r||Os>=h||Os<0||Ze&&Yo>=ne}function yr(){var mn=rg();if(Gt(mn))return Sr(mn);ve=Oh(yr,fr(mn))}function Sr(mn){return ve=r,xt&&N?Nt(mn):(N=V=r,he)}function $i(){ve!==r&&dA(ve),We=0,N=xe=V=ve=r}function ci(){return ve===r?he:Sr(rg())}function Fi(){var mn=rg(),Os=Gt(mn);if(N=arguments,V=this,xe=mn,Os){if(ve===r)return Vt(xe);if(Ze)return dA(ve),ve=Oh(yr,h),Nt(xe)}return ve===r&&(ve=Oh(yr,h)),he}return Fi.cancel=$i,Fi.flush=ci,Fi}var uie=hr(function(c,h){return K9(c,1,h)}),fie=hr(function(c,h,w){return K9(c,ds(h)||0,w)});function lie(c){return Ho(c,ie)}function ng(c,h){if(typeof c!="function"||h!=null&&typeof h!="function")throw new cs(o);var w=function(){var N=arguments,V=h?h.apply(this,N):N[0],ne=w.cache;if(ne.has(V))return ne.get(V);var he=c.apply(this,N);return w.cache=ne.set(V,he)||ne,he};return w.cache=new(ng.Cache||qo),w}ng.Cache=qo;function ig(c){if(typeof c!="function")throw new cs(o);return function(){var h=arguments;switch(h.length){case 0:return!c.call(this);case 1:return!c.call(this,h[0]);case 2:return!c.call(this,h[0],h[1]);case 3:return!c.call(this,h[0],h[1],h[2])}return!c.apply(this,h)}}function hie(c){return QA(2,c)}var die=Qte(function(c,h){h=h.length==1&&sr(h[0])?Xr(h[0],Li(qt())):Xr(Hn(h,1),Li(qt()));var w=h.length;return hr(function(N){for(var V=-1,ne=Zn(N.length,w);++V=h}),Uc=X9(function(){return arguments}())?X9:function(c){return rn(c)&&Tr.call(c,"callee")&&!B9.call(c,"callee")},sr=Ce.isArray,Iie=si?Li(si):kte;function Ei(c){return c!=null&&sg(c.length)&&!Vo(c)}function gn(c){return rn(c)&&Ei(c)}function Cie(c){return c===!0||c===!1||rn(c)&&oi(c)==J}var ja=zee||ew,Tie=Cs?Li(Cs):Bte;function Rie(c){return rn(c)&&c.nodeType===1&&!Nh(c)}function Die(c){if(c==null)return!0;if(Ei(c)&&(sr(c)||typeof c=="string"||typeof c.splice=="function"||ja(c)||pf(c)||Uc(c)))return!c.length;var h=Qn(c);if(h==oe||h==Ie)return!c.size;if(Dh(c))return!by(c).length;for(var w in c)if(Tr.call(c,w))return!1;return!0}function Oie(c,h){return Ch(c,h)}function Nie(c,h,w){w=typeof w=="function"?w:r;var N=w?w(c,h):r;return N===r?Ch(c,h,r,w):!!N}function Hy(c){if(!rn(c))return!1;var h=oi(c);return h==X||h==T||typeof c.message=="string"&&typeof c.name=="string"&&!Nh(c)}function Lie(c){return typeof c=="number"&&F9(c)}function Vo(c){if(!Qr(c))return!1;var h=oi(c);return h==re||h==ge||h==ee||h==Te}function sP(c){return typeof c=="number"&&c==ur(c)}function sg(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=S}function Qr(c){var h=typeof c;return c!=null&&(h=="object"||h=="function")}function rn(c){return c!=null&&typeof c=="object"}var oP=os?Li(os):Fte;function kie(c,h){return c===h||vy(c,h,Ny(h))}function Bie(c,h,w){return w=typeof w=="function"?w:r,vy(c,h,Ny(h),w)}function $ie(c){return aP(c)&&c!=+c}function Fie(c){if(_re(c))throw new tr(s);return Z9(c)}function jie(c){return c===null}function Uie(c){return c==null}function aP(c){return typeof c=="number"||rn(c)&&oi(c)==fe}function Nh(c){if(!rn(c)||oi(c)!=Me)return!1;var h=Dp(c);if(h===null)return!0;var w=Tr.call(h,"constructor")&&h.constructor;return typeof w=="function"&&w instanceof w&&Ip.call(w)==Bee}var Wy=oo?Li(oo):jte;function qie(c){return sP(c)&&c>=-S&&c<=S}var cP=yh?Li(yh):Ute;function og(c){return typeof c=="string"||!sr(c)&&rn(c)&&oi(c)==Le}function Bi(c){return typeof c=="symbol"||rn(c)&&oi(c)==Ve}var pf=Oc?Li(Oc):qte;function zie(c){return c===r}function Hie(c){return rn(c)&&Qn(c)==ze}function Wie(c){return rn(c)&&oi(c)==He}var Kie=Jp(yy),Vie=Jp(function(c,h){return c<=h});function uP(c){if(!c)return[];if(Ei(c))return og(c)?Ts(c):_i(c);if(xh&&c[xh])return Aee(c[xh]());var h=Qn(c),w=h==oe?oy:h==Ie?Ap:gf;return w(c)}function Go(c){if(!c)return c===0?c:0;if(c=ds(c),c===x||c===-x){var h=c<0?-1:1;return h*A}return c===c?c:0}function ur(c){var h=Go(c),w=h%1;return h===h?w?h-w:h:0}function fP(c){return c?Bc(ur(c),0,P):0}function ds(c){if(typeof c=="number")return c;if(Bi(c))return b;if(Qr(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=Qr(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=C9(c);var w=it.test(c);return w||mt.test(c)?ir(c.slice(2),w?2:8):De.test(c)?b:+c}function lP(c){return co(c,Si(c))}function Gie(c){return c?Bc(ur(c),-S,S):c===0?c:0}function Cr(c){return c==null?"":ki(c)}var Yie=lf(function(c,h){if(Dh(h)||Ei(h)){co(h,kn(h),c);return}for(var w in h)Tr.call(h,w)&&Ph(c,w,h[w])}),hP=lf(function(c,h){co(h,Si(h),c)}),ag=lf(function(c,h,w,N){co(h,Si(h),c,N)}),Jie=lf(function(c,h,w,N){co(h,kn(h),c,N)}),Xie=Wo(hy);function Zie(c,h){var w=ff(c);return h==null?w:H9(w,h)}var Qie=hr(function(c,h){c=qr(c);var w=-1,N=h.length,V=N>2?h[2]:r;for(V&&ai(h[0],h[1],V)&&(N=1);++w1),ne}),co(c,Dy(c),w),N&&(w=fs(w,p|y|_,fre));for(var V=h.length;V--;)Sy(w,h[V]);return w});function vse(c,h){return pP(c,ig(qt(h)))}var bse=Wo(function(c,h){return c==null?{}:Wte(c,h)});function pP(c,h){if(c==null)return{};var w=Xr(Dy(c),function(N){return[N]});return h=qt(h),sA(c,w,function(N,V){return h(N,V[0])})}function yse(c,h,w){h=$a(h,c);var N=-1,V=h.length;for(V||(V=1,c=r);++Nh){var N=c;c=h,h=N}if(w||c%1||h%1){var V=j9();return Zn(c+V*(h-c+jr("1e-"+((V+"").length-1))),h)}return xy(c,h)}var Tse=hf(function(c,h,w){return h=h.toLowerCase(),c+(w?vP(h):h)});function vP(c){return Gy(Cr(c).toLowerCase())}function bP(c){return c=Cr(c),c&&c.replace(tt,wee).replace(Jb,"")}function Rse(c,h,w){c=Cr(c),h=ki(h);var N=c.length;w=w===r?N:Bc(ur(w),0,N);var V=w;return w-=h.length,w>=0&&c.slice(w,V)==h}function Dse(c){return c=Cr(c),c&&Tt.test(c)?c.replace(Ot,xee):c}function Ose(c){return c=Cr(c),c&&Ft.test(c)?c.replace(nt,"\\$&"):c}var Nse=hf(function(c,h,w){return c+(w?"-":"")+h.toLowerCase()}),Lse=hf(function(c,h,w){return c+(w?" ":"")+h.toLowerCase()}),kse=xA("toLowerCase");function Bse(c,h,w){c=Cr(c),h=ur(h);var N=h?sf(c):0;if(!h||N>=h)return c;var V=(h-N)/2;return Yp(kp(V),w)+c+Yp(Lp(V),w)}function $se(c,h,w){c=Cr(c),h=ur(h);var N=h?sf(c):0;return h&&N>>0,w?(c=Cr(c),c&&(typeof h=="string"||h!=null&&!Wy(h))&&(h=ki(h),!h&&nf(c))?Fa(Ts(c),0,w):c.split(h,w)):[]}var Wse=hf(function(c,h,w){return c+(w?" ":"")+Gy(h)});function Kse(c,h,w){return c=Cr(c),w=w==null?0:Bc(ur(w),0,c.length),h=ki(h),c.slice(w,w+h.length)==h}function Vse(c,h,w){var N=te.templateSettings;w&&ai(c,h,w)&&(h=r),c=Cr(c),h=ag({},h,N,IA);var V=ag({},h.imports,N.imports,IA),ne=kn(V),he=sy(V,ne),ve,xe,We=0,Ke=h.interpolate||At,Ze="__p += '",xt=ay((h.escape||At).source+"|"+Ke.source+"|"+(Ke===Lt?_e:At).source+"|"+(h.evaluate||At).source+"|$","g"),Nt="//# sourceURL="+(Tr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Xb+"]")+` -`;c.replace(xt,function(Gt,yr,Sr,$i,ci,Fi){return Sr||(Sr=$i),Ze+=c.slice(We,Fi).replace(Rt,_ee),yr&&(ve=!0,Ze+=`' + +`)}function xre(c){return sr(c)||qc(c)||!!($9&&c&&c[$9])}function Ko(c,h){var w=typeof c;return h=h??S,!!h&&(w=="number"||w!="symbol"&&st.test(c))&&c>-1&&c%1==0&&c0){if(++h>=E)return arguments[0]}else h=0;return c.apply(r,arguments)}}function Qp(c,h){var w=-1,N=c.length,V=N-1;for(h=h===r?N:h;++w1?c[h-1]:r;return w=typeof w=="function"?(c.pop(),w):r,GA(c,w)});function YA(c){var h=te(c);return h.__chain__=!0,h}function Dne(c,h){return h(c),c}function eg(c,h){return h(c)}var One=Wo(function(c){var h=c.length,w=h?c[0]:0,N=this.__wrapped__,V=function(ne){return hy(ne,c)};return h>1||this.__actions__.length||!(N instanceof _r)||!Ko(w)?this.thru(V):(N=N.slice(w,+w+(h?1:0)),N.__actions__.push({func:eg,args:[V],thisArg:r}),new us(N,this.__chain__).thru(function(ne){return h&&!ne.length&&ne.push(r),ne}))});function Nne(){return YA(this)}function Lne(){return new us(this.value(),this.__chain__)}function kne(){this.__values__===r&&(this.__values__=uP(this.value()));var c=this.__index__>=this.__values__.length,h=c?r:this.__values__[this.__index__++];return{done:c,value:h}}function Bne(){return this}function $ne(c){for(var h,w=this;w instanceof Fp;){var N=qA(w);N.__index__=0,N.__values__=r,h?V.__wrapped__=N:h=N;var V=N;w=w.__wrapped__}return V.__wrapped__=c,h}function Fne(){var c=this.__wrapped__;if(c instanceof _r){var h=c;return this.__actions__.length&&(h=new _r(this)),h=h.reverse(),h.__actions__.push({func:eg,args:[jy],thisArg:r}),new us(h,this.__chain__)}return this.thru(jy)}function jne(){return lA(this.__wrapped__,this.__actions__)}var Une=Kp(function(c,h,w){Tr.call(c,w)?++c[w]:zo(c,w,1)});function qne(c,h,w){var N=sr(c)?S9:Dte;return w&&ai(c,h,w)&&(h=r),N(c,qt(h,3))}function zne(c,h){var w=sr(c)?Da:G9;return w(c,qt(h,3))}var Hne=_A(zA),Wne=_A(HA);function Kne(c,h){return Hn(tg(c,h),1)}function Vne(c,h){return Hn(tg(c,h),x)}function Gne(c,h,w){return w=w===r?1:ur(w),Hn(tg(c,h),w)}function JA(c,h){var w=sr(c)?as:ka;return w(c,qt(h,3))}function XA(c,h){var w=sr(c)?dee:V9;return w(c,qt(h,3))}var Yne=Kp(function(c,h,w){Tr.call(c,w)?c[w].push(h):zo(c,w,[h])});function Jne(c,h,w,N){c=Ei(c)?c:gf(c),w=w&&!N?ur(w):0;var V=c.length;return w<0&&(w=An(V+w,0)),og(c)?w<=V&&c.indexOf(h,w)>-1:!!V&&rf(c,h,w)>-1}var Xne=hr(function(c,h,w){var N=-1,V=typeof h=="function",ne=Ei(c)?Ce(c.length):[];return ka(c,function(he){ne[++N]=V?Ln(h,he,w):Ih(he,h,w)}),ne}),Zne=Kp(function(c,h,w){zo(c,w,h)});function tg(c,h){var w=sr(c)?Xr:eA;return w(c,qt(h,3))}function Qne(c,h,w,N){return c==null?[]:(sr(h)||(h=h==null?[]:[h]),w=N?r:w,sr(w)||(w=w==null?[]:[w]),iA(c,h,w))}var eie=Kp(function(c,h,w){c[w?0:1].push(h)},function(){return[[],[]]});function tie(c,h,w){var N=sr(c)?Qb:I9,V=arguments.length<3;return N(c,qt(h,4),w,V,ka)}function rie(c,h,w){var N=sr(c)?pee:I9,V=arguments.length<3;return N(c,qt(h,4),w,V,V9)}function nie(c,h){var w=sr(c)?Da:G9;return w(c,ig(qt(h,3)))}function iie(c){var h=sr(c)?z9:Jte;return h(c)}function sie(c,h,w){(w?ai(c,h,w):h===r)?h=1:h=ur(h);var N=sr(c)?Mte:Xte;return N(c,h)}function oie(c){var h=sr(c)?Ite:Qte;return h(c)}function aie(c){if(c==null)return 0;if(Ei(c))return og(c)?sf(c):c.length;var h=Qn(c);return h==oe||h==Ie?c.size:by(c).length}function cie(c,h,w){var N=sr(c)?ey:ere;return w&&ai(c,h,w)&&(h=r),N(c,qt(h,3))}var uie=hr(function(c,h){if(c==null)return[];var w=h.length;return w>1&&ai(c,h[0],h[1])?h=[]:w>2&&ai(h[0],h[1],h[2])&&(h=[h[0]]),iA(c,Hn(h,1),[])}),rg=zee||function(){return Er.Date.now()};function fie(c,h){if(typeof h!="function")throw new cs(o);return c=ur(c),function(){if(--c<1)return h.apply(this,arguments)}}function ZA(c,h,w){return h=w?r:h,h=c&&h==null?c.length:h,Ho(c,R,r,r,r,r,h)}function QA(c,h){var w;if(typeof h!="function")throw new cs(o);return c=ur(c),function(){return--c>0&&(w=h.apply(this,arguments)),c<=1&&(h=r),w}}var qy=hr(function(c,h,w){var N=L;if(w.length){var V=Na(w,df(qy));N|=z}return Ho(c,N,h,w,V)}),eP=hr(function(c,h,w){var N=L|B;if(w.length){var V=Na(w,df(eP));N|=z}return Ho(h,N,c,w,V)});function tP(c,h,w){h=w?r:h;var N=Ho(c,H,r,r,r,r,r,h);return N.placeholder=tP.placeholder,N}function rP(c,h,w){h=w?r:h;var N=Ho(c,U,r,r,r,r,r,h);return N.placeholder=rP.placeholder,N}function nP(c,h,w){var N,V,ne,he,ve,xe,We=0,Ke=!1,Ze=!1,xt=!0;if(typeof c!="function")throw new cs(o);h=ds(h)||0,Qr(w)&&(Ke=!!w.leading,Ze="maxWait"in w,ne=Ze?An(ds(w.maxWait)||0,h):ne,xt="trailing"in w?!!w.trailing:xt);function Nt(mn){var Os=N,Yo=V;return N=V=r,We=mn,he=c.apply(Yo,Os),he}function Vt(mn){return We=mn,ve=Oh(yr,h),Ke?Nt(mn):he}function fr(mn){var Os=mn-xe,Yo=mn-We,_P=h-Os;return Ze?Zn(_P,ne-Yo):_P}function Gt(mn){var Os=mn-xe,Yo=mn-We;return xe===r||Os>=h||Os<0||Ze&&Yo>=ne}function yr(){var mn=rg();if(Gt(mn))return Sr(mn);ve=Oh(yr,fr(mn))}function Sr(mn){return ve=r,xt&&N?Nt(mn):(N=V=r,he)}function $i(){ve!==r&&dA(ve),We=0,N=xe=V=ve=r}function ci(){return ve===r?he:Sr(rg())}function Fi(){var mn=rg(),Os=Gt(mn);if(N=arguments,V=this,xe=mn,Os){if(ve===r)return Vt(xe);if(Ze)return dA(ve),ve=Oh(yr,h),Nt(xe)}return ve===r&&(ve=Oh(yr,h)),he}return Fi.cancel=$i,Fi.flush=ci,Fi}var lie=hr(function(c,h){return K9(c,1,h)}),hie=hr(function(c,h,w){return K9(c,ds(h)||0,w)});function die(c){return Ho(c,ie)}function ng(c,h){if(typeof c!="function"||h!=null&&typeof h!="function")throw new cs(o);var w=function(){var N=arguments,V=h?h.apply(this,N):N[0],ne=w.cache;if(ne.has(V))return ne.get(V);var he=c.apply(this,N);return w.cache=ne.set(V,he)||ne,he};return w.cache=new(ng.Cache||qo),w}ng.Cache=qo;function ig(c){if(typeof c!="function")throw new cs(o);return function(){var h=arguments;switch(h.length){case 0:return!c.call(this);case 1:return!c.call(this,h[0]);case 2:return!c.call(this,h[0],h[1]);case 3:return!c.call(this,h[0],h[1],h[2])}return!c.apply(this,h)}}function pie(c){return QA(2,c)}var gie=tre(function(c,h){h=h.length==1&&sr(h[0])?Xr(h[0],Li(qt())):Xr(Hn(h,1),Li(qt()));var w=h.length;return hr(function(N){for(var V=-1,ne=Zn(N.length,w);++V=h}),qc=X9(function(){return arguments}())?X9:function(c){return rn(c)&&Tr.call(c,"callee")&&!B9.call(c,"callee")},sr=Ce.isArray,Tie=si?Li(si):$te;function Ei(c){return c!=null&&sg(c.length)&&!Vo(c)}function gn(c){return rn(c)&&Ei(c)}function Rie(c){return c===!0||c===!1||rn(c)&&oi(c)==J}var ja=Wee||ew,Die=Cs?Li(Cs):Fte;function Oie(c){return rn(c)&&c.nodeType===1&&!Nh(c)}function Nie(c){if(c==null)return!0;if(Ei(c)&&(sr(c)||typeof c=="string"||typeof c.splice=="function"||ja(c)||pf(c)||qc(c)))return!c.length;var h=Qn(c);if(h==oe||h==Ie)return!c.size;if(Dh(c))return!by(c).length;for(var w in c)if(Tr.call(c,w))return!1;return!0}function Lie(c,h){return Ch(c,h)}function kie(c,h,w){w=typeof w=="function"?w:r;var N=w?w(c,h):r;return N===r?Ch(c,h,r,w):!!N}function Hy(c){if(!rn(c))return!1;var h=oi(c);return h==X||h==T||typeof c.message=="string"&&typeof c.name=="string"&&!Nh(c)}function Bie(c){return typeof c=="number"&&F9(c)}function Vo(c){if(!Qr(c))return!1;var h=oi(c);return h==re||h==ge||h==ee||h==Te}function sP(c){return typeof c=="number"&&c==ur(c)}function sg(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=S}function Qr(c){var h=typeof c;return c!=null&&(h=="object"||h=="function")}function rn(c){return c!=null&&typeof c=="object"}var oP=os?Li(os):Ute;function $ie(c,h){return c===h||vy(c,h,Ny(h))}function Fie(c,h,w){return w=typeof w=="function"?w:r,vy(c,h,Ny(h),w)}function jie(c){return aP(c)&&c!=+c}function Uie(c){if(Sre(c))throw new tr(s);return Z9(c)}function qie(c){return c===null}function zie(c){return c==null}function aP(c){return typeof c=="number"||rn(c)&&oi(c)==fe}function Nh(c){if(!rn(c)||oi(c)!=Me)return!1;var h=Dp(c);if(h===null)return!0;var w=Tr.call(h,"constructor")&&h.constructor;return typeof w=="function"&&w instanceof w&&Ip.call(w)==Fee}var Wy=oo?Li(oo):qte;function Hie(c){return sP(c)&&c>=-S&&c<=S}var cP=yh?Li(yh):zte;function og(c){return typeof c=="string"||!sr(c)&&rn(c)&&oi(c)==Le}function Bi(c){return typeof c=="symbol"||rn(c)&&oi(c)==Ve}var pf=Nc?Li(Nc):Hte;function Wie(c){return c===r}function Kie(c){return rn(c)&&Qn(c)==ze}function Vie(c){return rn(c)&&oi(c)==He}var Gie=Jp(yy),Yie=Jp(function(c,h){return c<=h});function uP(c){if(!c)return[];if(Ei(c))return og(c)?Ts(c):_i(c);if(xh&&c[xh])return Mee(c[xh]());var h=Qn(c),w=h==oe?oy:h==Ie?Ap:gf;return w(c)}function Go(c){if(!c)return c===0?c:0;if(c=ds(c),c===x||c===-x){var h=c<0?-1:1;return h*A}return c===c?c:0}function ur(c){var h=Go(c),w=h%1;return h===h?w?h-w:h:0}function fP(c){return c?$c(ur(c),0,P):0}function ds(c){if(typeof c=="number")return c;if(Bi(c))return b;if(Qr(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=Qr(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=C9(c);var w=it.test(c);return w||mt.test(c)?ir(c.slice(2),w?2:8):De.test(c)?b:+c}function lP(c){return co(c,Si(c))}function Jie(c){return c?$c(ur(c),-S,S):c===0?c:0}function Cr(c){return c==null?"":ki(c)}var Xie=lf(function(c,h){if(Dh(h)||Ei(h)){co(h,kn(h),c);return}for(var w in h)Tr.call(h,w)&&Ph(c,w,h[w])}),hP=lf(function(c,h){co(h,Si(h),c)}),ag=lf(function(c,h,w,N){co(h,Si(h),c,N)}),Zie=lf(function(c,h,w,N){co(h,kn(h),c,N)}),Qie=Wo(hy);function ese(c,h){var w=ff(c);return h==null?w:H9(w,h)}var tse=hr(function(c,h){c=qr(c);var w=-1,N=h.length,V=N>2?h[2]:r;for(V&&ai(h[0],h[1],V)&&(N=1);++w1),ne}),co(c,Dy(c),w),N&&(w=fs(w,p|y|_,hre));for(var V=h.length;V--;)Sy(w,h[V]);return w});function yse(c,h){return pP(c,ig(qt(h)))}var wse=Wo(function(c,h){return c==null?{}:Vte(c,h)});function pP(c,h){if(c==null)return{};var w=Xr(Dy(c),function(N){return[N]});return h=qt(h),sA(c,w,function(N,V){return h(N,V[0])})}function xse(c,h,w){h=$a(h,c);var N=-1,V=h.length;for(V||(V=1,c=r);++Nh){var N=c;c=h,h=N}if(w||c%1||h%1){var V=j9();return Zn(c+V*(h-c+jr("1e-"+((V+"").length-1))),h)}return xy(c,h)}var Dse=hf(function(c,h,w){return h=h.toLowerCase(),c+(w?vP(h):h)});function vP(c){return Gy(Cr(c).toLowerCase())}function bP(c){return c=Cr(c),c&&c.replace(tt,_ee).replace(Jb,"")}function Ose(c,h,w){c=Cr(c),h=ki(h);var N=c.length;w=w===r?N:$c(ur(w),0,N);var V=w;return w-=h.length,w>=0&&c.slice(w,V)==h}function Nse(c){return c=Cr(c),c&&Tt.test(c)?c.replace(Ot,Eee):c}function Lse(c){return c=Cr(c),c&&Ft.test(c)?c.replace(nt,"\\$&"):c}var kse=hf(function(c,h,w){return c+(w?"-":"")+h.toLowerCase()}),Bse=hf(function(c,h,w){return c+(w?" ":"")+h.toLowerCase()}),$se=xA("toLowerCase");function Fse(c,h,w){c=Cr(c),h=ur(h);var N=h?sf(c):0;if(!h||N>=h)return c;var V=(h-N)/2;return Yp(kp(V),w)+c+Yp(Lp(V),w)}function jse(c,h,w){c=Cr(c),h=ur(h);var N=h?sf(c):0;return h&&N>>0,w?(c=Cr(c),c&&(typeof h=="string"||h!=null&&!Wy(h))&&(h=ki(h),!h&&nf(c))?Fa(Ts(c),0,w):c.split(h,w)):[]}var Vse=hf(function(c,h,w){return c+(w?" ":"")+Gy(h)});function Gse(c,h,w){return c=Cr(c),w=w==null?0:$c(ur(w),0,c.length),h=ki(h),c.slice(w,w+h.length)==h}function Yse(c,h,w){var N=te.templateSettings;w&&ai(c,h,w)&&(h=r),c=Cr(c),h=ag({},h,N,IA);var V=ag({},h.imports,N.imports,IA),ne=kn(V),he=sy(V,ne),ve,xe,We=0,Ke=h.interpolate||At,Ze="__p += '",xt=ay((h.escape||At).source+"|"+Ke.source+"|"+(Ke===Lt?_e:At).source+"|"+(h.evaluate||At).source+"|$","g"),Nt="//# sourceURL="+(Tr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Xb+"]")+` +`;c.replace(xt,function(Gt,yr,Sr,$i,ci,Fi){return Sr||(Sr=$i),Ze+=c.slice(We,Fi).replace(Rt,See),yr&&(ve=!0,Ze+=`' + __e(`+yr+`) + '`),ci&&(xe=!0,Ze+=`'; `+ci+`; @@ -104,39 +104,39 @@ __p += '`),Sr&&(Ze+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+Ze+`return __p -}`;var fr=wP(function(){return Mr(ne,Nt+"return "+Ze).apply(r,he)});if(fr.source=Ze,Hy(fr))throw fr;return fr}function Gse(c){return Cr(c).toLowerCase()}function Yse(c){return Cr(c).toUpperCase()}function Jse(c,h,w){if(c=Cr(c),c&&(w||h===r))return C9(c);if(!c||!(h=ki(h)))return c;var N=Ts(c),V=Ts(h),ne=T9(N,V),he=R9(N,V)+1;return Fa(N,ne,he).join("")}function Xse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.slice(0,O9(c)+1);if(!c||!(h=ki(h)))return c;var N=Ts(c),V=R9(N,Ts(h))+1;return Fa(N,0,V).join("")}function Zse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.replace($,"");if(!c||!(h=ki(h)))return c;var N=Ts(c),V=T9(N,Ts(h));return Fa(N,V).join("")}function Qse(c,h){var w=me,N=j;if(Qr(h)){var V="separator"in h?h.separator:V;w="length"in h?ur(h.length):w,N="omission"in h?ki(h.omission):N}c=Cr(c);var ne=c.length;if(nf(c)){var he=Ts(c);ne=he.length}if(w>=ne)return c;var ve=w-sf(N);if(ve<1)return N;var xe=he?Fa(he,0,ve).join(""):c.slice(0,ve);if(V===r)return xe+N;if(he&&(ve+=xe.length-ve),Wy(V)){if(c.slice(ve).search(V)){var We,Ke=xe;for(V.global||(V=ay(V.source,Cr(Re.exec(V))+"g")),V.lastIndex=0;We=V.exec(Ke);)var Ze=We.index;xe=xe.slice(0,Ze===r?ve:Ze)}}else if(c.indexOf(ki(V),ve)!=ve){var xt=xe.lastIndexOf(V);xt>-1&&(xe=xe.slice(0,xt))}return xe+N}function eoe(c){return c=Cr(c),c&&Bt.test(c)?c.replace(Xt,Cee):c}var toe=hf(function(c,h,w){return c+(w?" ":"")+h.toUpperCase()}),Gy=xA("toUpperCase");function yP(c,h,w){return c=Cr(c),h=w?r:h,h===r?See(c)?Dee(c):gee(c):c.match(h)||[]}var wP=hr(function(c,h){try{return Ln(c,r,h)}catch(w){return Hy(w)?w:new tr(w)}}),roe=Wo(function(c,h){return as(h,function(w){w=uo(w),zo(c,w,qy(c[w],c))}),c});function noe(c){var h=c==null?0:c.length,w=qt();return c=h?Xr(c,function(N){if(typeof N[1]!="function")throw new cs(o);return[w(N[0]),N[1]]}):[],hr(function(N){for(var V=-1;++VS)return[];var w=P,N=Zn(c,P);h=qt(h),c-=P;for(var V=iy(N,h);++w0||h<0)?new _r(w):(c<0?w=w.takeRight(-c):c&&(w=w.drop(c)),h!==r&&(h=ur(h),w=h<0?w.dropRight(-h):w.take(h-c)),w)},_r.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},_r.prototype.toArray=function(){return this.take(P)},ao(_r.prototype,function(c,h){var w=/^(?:filter|find|map|reject)|While$/.test(h),N=/^(?:head|last)$/.test(h),V=te[N?"take"+(h=="last"?"Right":""):h],ne=N||/^find/.test(h);V&&(te.prototype[h]=function(){var he=this.__wrapped__,ve=N?[1]:arguments,xe=he instanceof _r,We=ve[0],Ke=xe||sr(he),Ze=function(yr){var Sr=V.apply(te,Oa([yr],ve));return N&&xt?Sr[0]:Sr};Ke&&w&&typeof We=="function"&&We.length!=1&&(xe=Ke=!1);var xt=this.__chain__,Nt=!!this.__actions__.length,Vt=ne&&!xt,fr=xe&&!Nt;if(!ne&&Ke){he=fr?he:new _r(this);var Gt=c.apply(he,ve);return Gt.__actions__.push({func:eg,args:[Ze],thisArg:r}),new us(Gt,xt)}return Vt&&fr?c.apply(this,ve):(Gt=this.thru(Ze),Vt?N?Gt.value()[0]:Gt.value():Gt)})}),as(["pop","push","shift","sort","splice","unshift"],function(c){var h=Pp[c],w=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",N=/^(?:pop|shift)$/.test(c);te.prototype[c]=function(){var V=arguments;if(N&&!this.__chain__){var ne=this.value();return h.apply(sr(ne)?ne:[],V)}return this[w](function(he){return h.apply(sr(he)?he:[],V)})}}),ao(_r.prototype,function(c,h){var w=te[h];if(w){var N=w.name+"";Tr.call(uf,N)||(uf[N]=[]),uf[N].push({name:h,func:w})}}),uf[Vp(r,B).name]=[{name:"wrapper",func:r}],_r.prototype.clone=ete,_r.prototype.reverse=tte,_r.prototype.value=rte,te.prototype.at=Rne,te.prototype.chain=Dne,te.prototype.commit=One,te.prototype.next=Nne,te.prototype.plant=kne,te.prototype.reverse=Bne,te.prototype.toJSON=te.prototype.valueOf=te.prototype.value=$ne,te.prototype.first=te.prototype.head,xh&&(te.prototype[xh]=Lne),te},of=Oee();pn?((pn.exports=of)._=of,Ur._=of):Er._=of}).call(nn)}(h0,h0.exports);var rz=h0.exports,L1={exports:{}};(function(t,e){var r=typeof self<"u"?self:nn,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function u(f){return f&&DataView.prototype.isPrototypeOf(f)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(f){return f&&l.indexOf(Object.prototype.toString.call(f))>-1};function p(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function y(f){return typeof f!="string"&&(f=String(f)),f}function _(f){var g={next:function(){var v=f.shift();return{done:v===void 0,value:v}}};return a.iterable&&(g[Symbol.iterator]=function(){return g}),g}function M(f){this.map={},f instanceof M?f.forEach(function(g,v){this.append(v,g)},this):Array.isArray(f)?f.forEach(function(g){this.append(g[0],g[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(g){this.append(g,f[g])},this)}M.prototype.append=function(f,g){f=p(f),g=y(g);var v=this.map[f];this.map[f]=v?v+", "+g:g},M.prototype.delete=function(f){delete this.map[p(f)]},M.prototype.get=function(f){return f=p(f),this.has(f)?this.map[f]:null},M.prototype.has=function(f){return this.map.hasOwnProperty(p(f))},M.prototype.set=function(f,g){this.map[p(f)]=y(g)},M.prototype.forEach=function(f,g){for(var v in this.map)this.map.hasOwnProperty(v)&&f.call(g,this.map[v],v,this)},M.prototype.keys=function(){var f=[];return this.forEach(function(g,v){f.push(v)}),_(f)},M.prototype.values=function(){var f=[];return this.forEach(function(g){f.push(g)}),_(f)},M.prototype.entries=function(){var f=[];return this.forEach(function(g,v){f.push([v,g])}),_(f)},a.iterable&&(M.prototype[Symbol.iterator]=M.prototype.entries);function O(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function L(f){return new Promise(function(g,v){f.onload=function(){g(f.result)},f.onerror=function(){v(f.error)}})}function B(f){var g=new FileReader,v=L(g);return g.readAsArrayBuffer(f),v}function k(f){var g=new FileReader,v=L(g);return g.readAsText(f),v}function H(f){for(var g=new Uint8Array(f),v=new Array(g.length),x=0;x-1?g:f}function W(f,g){g=g||{};var v=g.body;if(f instanceof W){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,g.headers||(this.headers=new M(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!v&&f._bodyInit!=null&&(v=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=g.credentials||this.credentials||"same-origin",(g.headers||!this.headers)&&(this.headers=new M(g.headers)),this.method=R(g.method||this.method||"GET"),this.mode=g.mode||this.mode||null,this.signal=g.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(v)}W.prototype.clone=function(){return new W(this,{body:this._bodyInit})};function ie(f){var g=new FormData;return f.trim().split("&").forEach(function(v){if(v){var x=v.split("="),S=x.shift().replace(/\+/g," "),A=x.join("=").replace(/\+/g," ");g.append(decodeURIComponent(S),decodeURIComponent(A))}}),g}function me(f){var g=new M,v=f.replace(/\r?\n[\t ]+/g," ");return v.split(/\r?\n/).forEach(function(x){var S=x.split(":"),A=S.shift().trim();if(A){var b=S.join(":").trim();g.append(A,b)}}),g}z.call(W.prototype);function j(f,g){g||(g={}),this.type="default",this.status=g.status===void 0?200:g.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in g?g.statusText:"OK",this.headers=new M(g.headers),this.url=g.url||"",this._initBody(f)}z.call(j.prototype),j.prototype.clone=function(){return new j(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new M(this.headers),url:this.url})},j.error=function(){var f=new j(null,{status:0,statusText:""});return f.type="error",f};var E=[301,302,303,307,308];j.redirect=function(f,g){if(E.indexOf(g)===-1)throw new RangeError("Invalid status code");return new j(null,{status:g,headers:{location:f}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(g,v){this.message=g,this.name=v;var x=Error(g);this.stack=x.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function m(f,g){return new Promise(function(v,x){var S=new W(f,g);if(S.signal&&S.signal.aborted)return x(new o.DOMException("Aborted","AbortError"));var A=new XMLHttpRequest;function b(){A.abort()}A.onload=function(){var P={status:A.status,statusText:A.statusText,headers:me(A.getAllResponseHeaders()||"")};P.url="responseURL"in A?A.responseURL:P.headers.get("X-Request-URL");var I="response"in A?A.response:A.responseText;v(new j(I,P))},A.onerror=function(){x(new TypeError("Network request failed"))},A.ontimeout=function(){x(new TypeError("Network request failed"))},A.onabort=function(){x(new o.DOMException("Aborted","AbortError"))},A.open(S.method,S.url,!0),S.credentials==="include"?A.withCredentials=!0:S.credentials==="omit"&&(A.withCredentials=!1),"responseType"in A&&a.blob&&(A.responseType="blob"),S.headers.forEach(function(P,I){A.setRequestHeader(I,P)}),S.signal&&(S.signal.addEventListener("abort",b),A.onreadystatechange=function(){A.readyState===4&&S.signal.removeEventListener("abort",b)}),A.send(typeof S._bodyInit>"u"?null:S._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=M,s.Request=W,s.Response=j),o.Headers=M,o.Request=W,o.Response=j,o.fetch=m,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(L1,L1.exports);var nz=L1.exports;const a5=ji(nz);var iz=Object.defineProperty,sz=Object.defineProperties,oz=Object.getOwnPropertyDescriptors,c5=Object.getOwnPropertySymbols,az=Object.prototype.hasOwnProperty,cz=Object.prototype.propertyIsEnumerable,u5=(t,e,r)=>e in t?iz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,f5=(t,e)=>{for(var r in e||(e={}))az.call(e,r)&&u5(t,r,e[r]);if(c5)for(var r of c5(e))cz.call(e,r)&&u5(t,r,e[r]);return t},l5=(t,e)=>sz(t,oz(e));const uz={Accept:"application/json","Content-Type":"application/json"},fz="POST",h5={headers:uz,method:fz},d5=10;let Ss=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new Hi.EventEmitter,this.isAvailable=!1,this.registering=!1,!h6(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=mo(e),n=await(await a5(this.url,l5(f5({},h5),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!h6(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=mo({id:1,jsonrpc:"2.0",method:"test",params:[]});await a5(e,l5(f5({},h5),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Za(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=o0(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return a6(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>d5&&this.events.setMaxListeners(d5)}};const p5="error",lz="wss://relay.walletconnect.org",hz="wc",dz="universal_provider",g5=`${hz}@2:${dz}:`,m5="https://rpc.walletconnect.org/v1/",Cu="generic",pz=`${m5}bundler`,ts={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var gz=Object.defineProperty,mz=Object.defineProperties,vz=Object.getOwnPropertyDescriptors,v5=Object.getOwnPropertySymbols,bz=Object.prototype.hasOwnProperty,yz=Object.prototype.propertyIsEnumerable,b5=(t,e,r)=>e in t?gz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,d0=(t,e)=>{for(var r in e||(e={}))bz.call(e,r)&&b5(t,r,e[r]);if(v5)for(var r of v5(e))yz.call(e,r)&&b5(t,r,e[r]);return t},wz=(t,e)=>mz(t,vz(e));function Di(t,e,r){var n;const i=Su(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${m5}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function mc(t){return t.includes(":")?t.split(":")[1]:t}function y5(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function xz(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function k1(t={},e={}){const r=w5(t),n=w5(e);return rz.merge(r,n)}function w5(t){var e,r,n,i;const s={};if(!Ml(t))return s;for(const[o,a]of Object.entries(t)){const u=y1(o)?[o]:a.chains,l=a.methods||[],d=a.events||[],p=a.rpcMap||{},y=Pl(o);s[y]=wz(d0(d0({},s[y]),a),{chains:Qd(u,(e=s[y])==null?void 0:e.chains),methods:Qd(l,(r=s[y])==null?void 0:r.methods),events:Qd(d,(n=s[y])==null?void 0:n.events),rpcMap:d0(d0({},p),(i=s[y])==null?void 0:i.rpcMap)})}return s}function _z(t){return t.includes(":")?t.split(":")[2]:t}function x5(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=y1(r)?[r]:n.chains?n.chains:y5(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function B1(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const _5={},Pr=t=>_5[t],$1=(t,e)=>{_5[t]=e};class Ez{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=mc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}}var Sz=Object.defineProperty,Az=Object.defineProperties,Pz=Object.getOwnPropertyDescriptors,E5=Object.getOwnPropertySymbols,Mz=Object.prototype.hasOwnProperty,Iz=Object.prototype.propertyIsEnumerable,S5=(t,e,r)=>e in t?Sz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A5=(t,e)=>{for(var r in e||(e={}))Mz.call(e,r)&&S5(t,r,e[r]);if(E5)for(var r of E5(e))Iz.call(e,r)&&S5(t,r,e[r]);return t},P5=(t,e)=>Az(t,Pz(e));class Cz{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(mc(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const u=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:P5(A5({},o.sessionProperties||{}),{capabilities:P5(A5({},a||{}),{[s]:u})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return u}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(va("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${pz}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class Tz{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=mc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}}let Rz=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=mc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}},Dz=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Zi(new Ss(n,Pr("disableProviderPing")))}},Oz=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=mc(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}},Nz=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=mc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}};class Lz{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=mc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}}let kz=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Zi(new Ss(n,Pr("disableProviderPing")))}};class Bz{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Zi(new Ss(n))}}class $z{constructor(e){this.name=Cu,this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=Su(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}}var Fz=Object.defineProperty,jz=Object.defineProperties,Uz=Object.getOwnPropertyDescriptors,M5=Object.getOwnPropertySymbols,qz=Object.prototype.hasOwnProperty,zz=Object.prototype.propertyIsEnumerable,I5=(t,e,r)=>e in t?Fz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,p0=(t,e)=>{for(var r in e||(e={}))qz.call(e,r)&&I5(t,r,e[r]);if(M5)for(var r of M5(e))zz.call(e,r)&&I5(t,r,e[r]);return t},F1=(t,e)=>jz(t,Uz(e));let j1=class SP{constructor(e){this.events=new im,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:rl(bd({level:(e==null?void 0:e.logger)||p5})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new SP(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:p0({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,s0(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Dr("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=x5(this.session.namespaces);this.namespaces=k1(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=x5(s.namespaces);this.namespaces=k1(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==i5)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Cu?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(fc(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await N1.init({core:this.providerOpts.core,logger:this.providerOpts.logger||p5,relayUrl:this.providerOpts.relayUrl||lz,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>Pl(r)))];$1("client",this.client),$1("events",this.events),$1("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=xz(r,this.session),i=y5(n),s=k1(this.namespaces,this.optionalNamespaces),o=F1(p0({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new Cz({namespace:o});break;case"algorand":this.rpcProviders[r]=new Dz({namespace:o});break;case"solana":this.rpcProviders[r]=new Tz({namespace:o});break;case"cosmos":this.rpcProviders[r]=new Rz({namespace:o});break;case"polkadot":this.rpcProviders[r]=new Ez({namespace:o});break;case"cip34":this.rpcProviders[r]=new Oz({namespace:o});break;case"elrond":this.rpcProviders[r]=new Nz({namespace:o});break;case"multiversx":this.rpcProviders[r]=new Lz({namespace:o});break;case"near":this.rpcProviders[r]=new kz({namespace:o});break;case"tezos":this.rpcProviders[r]=new Bz({namespace:o});break;default:this.rpcProviders[Cu]?this.rpcProviders[Cu].updateNamespace(o):this.rpcProviders[Cu]=new $z({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&fc(i)&&this.events.emit("accountsChanged",i.map(_z))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=Pl(i),a=B1(i)!==B1(s)?`${o}:${B1(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=F1(p0({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",F1(p0({},Dr("USER_DISCONNECTED")),{data:e.topic}))}),this.on(ts.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Cu]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>Pl(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=Pl(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${g5}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${g5}/${e}`)}};const Hz=j1;function Wz(){return new Promise(t=>{const e=[];let r;window.addEventListener("eip6963:announceProvider",n=>{const{detail:i}=n;r&&clearTimeout(r),e.push(i),r=setTimeout(()=>t(e),200)}),r=setTimeout(()=>t(e),200),window.dispatchEvent(new Event("eip6963:requestProvider"))})}class Qs{constructor(e,r){this.scope=e,this.module=r}storeObject(e,r){this.setItem(e,JSON.stringify(r))}loadObject(e){const r=this.getItem(e);return r?JSON.parse(r):void 0}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new Qs("CBWSDK").clear(),new Qs("walletlink").clear()}}const an={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},U1={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},C5="Unspecified error message.",Kz="Unspecified server error.";function q1(t,e=C5){if(t&&Number.isInteger(t)){const r=t.toString();if(z1(U1,r))return U1[r].message;if(T5(t))return Kz}return e}function Vz(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(U1[e]||T5(t))}function Gz(t,{shouldIncludeStack:e=!1}={}){const r={};if(t&&typeof t=="object"&&!Array.isArray(t)&&z1(t,"code")&&Vz(t.code)){const n=t;r.code=n.code,n.message&&typeof n.message=="string"?(r.message=n.message,z1(n,"data")&&(r.data=n.data)):(r.message=q1(r.code),r.data={originalError:R5(t)})}else r.code=an.rpc.internal,r.message=D5(t,"message")?t.message:C5,r.data={originalError:R5(t)};return e&&(r.stack=D5(t,"stack")?t.stack:void 0),r}function T5(t){return t>=-32099&&t<=-32e3}function R5(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function z1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function D5(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const Ar={rpc:{parse:t=>rs(an.rpc.parse,t),invalidRequest:t=>rs(an.rpc.invalidRequest,t),invalidParams:t=>rs(an.rpc.invalidParams,t),methodNotFound:t=>rs(an.rpc.methodNotFound,t),internal:t=>rs(an.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return rs(e,t)},invalidInput:t=>rs(an.rpc.invalidInput,t),resourceNotFound:t=>rs(an.rpc.resourceNotFound,t),resourceUnavailable:t=>rs(an.rpc.resourceUnavailable,t),transactionRejected:t=>rs(an.rpc.transactionRejected,t),methodNotSupported:t=>rs(an.rpc.methodNotSupported,t),limitExceeded:t=>rs(an.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Tu(an.provider.userRejectedRequest,t),unauthorized:t=>Tu(an.provider.unauthorized,t),unsupportedMethod:t=>Tu(an.provider.unsupportedMethod,t),disconnected:t=>Tu(an.provider.disconnected,t),chainDisconnected:t=>Tu(an.provider.chainDisconnected,t),unsupportedChain:t=>Tu(an.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new L5(e,r,n)}}};function rs(t,e){const[r,n]=O5(e);return new N5(t,r||q1(t),n)}function Tu(t,e){const[r,n]=O5(e);return new L5(t,r||q1(t),n)}function O5(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}class N5 extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}}class L5 extends N5{constructor(e,r,n){if(!Yz(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}function Yz(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function H1(){return t=>t}const kl=H1(),Jz=H1(),Xz=H1();function Co(t){return Math.floor(t)}const k5=/^[0-9]*$/,B5=/^[a-f0-9]*$/;function vc(t){return W1(crypto.getRandomValues(new Uint8Array(t)))}function W1(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function g0(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function Bl(t,e=!1){const r=t.toString("hex");return kl(e?`0x${r}`:r)}function K1(t){return Bl(Y1(t),!0)}function eo(t){return Xz(t.toString(10))}function ba(t){return kl(`0x${BigInt(t).toString(16)}`)}function $5(t){return t.startsWith("0x")||t.startsWith("0X")}function V1(t){return $5(t)?t.slice(2):t}function F5(t){return $5(t)?`0x${t.slice(2)}`:`0x${t}`}function m0(t){if(typeof t!="string")return!1;const e=V1(t).toLowerCase();return B5.test(e)}function Zz(t,e=!1){if(typeof t=="string"){const r=V1(t).toLowerCase();if(B5.test(r))return kl(e?`0x${r}`:r)}throw Ar.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function G1(t,e=!1){let r=Zz(t,!1);return r.length%2===1&&(r=kl(`0${r}`)),e?kl(`0x${r}`):r}function ya(t){if(typeof t=="string"){const e=V1(t).toLowerCase();if(m0(e)&&e.length===40)return Jz(F5(e))}throw Ar.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function Y1(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(m0(t)){const e=G1(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Ar.rpc.invalidParams(`Not binary data: ${String(t)}`)}function $l(t){if(typeof t=="number"&&Number.isInteger(t))return Co(t);if(typeof t=="string"){if(k5.test(t))return Co(Number(t));if(m0(t))return Co(Number(BigInt(G1(t,!0))))}throw Ar.rpc.invalidParams(`Not an integer: ${String(t)}`)}function Fl(t){if(t!==null&&(typeof t=="bigint"||eH(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt($l(t));if(typeof t=="string"){if(k5.test(t))return BigInt(t);if(m0(t))return BigInt(G1(t,!0))}throw Ar.rpc.invalidParams(`Not an integer: ${String(t)}`)}function Qz(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Ar.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function eH(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function tH(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function rH(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function nH(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,new TextEncoder().encode(e));return{iv:r,cipherText:n}}async function iH(t,{iv:e,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return new TextDecoder().decode(n)}function j5(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function U5(t,e){const r=j5(t),n=await crypto.subtle.exportKey(r,e);return W1(new Uint8Array(n))}async function q5(t,e){const r=j5(t),n=g0(e).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function sH(t,e){const r=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return nH(e,r)}async function oH(t,e){return JSON.parse(await iH(e,t))}const J1={storageKey:"ownPrivateKey",keyType:"private"},X1={storageKey:"ownPublicKey",keyType:"public"},Z1={storageKey:"peerPublicKey",keyType:"public"};class aH{constructor(){this.storage=new Qs("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(Z1,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(X1.storageKey),this.storage.removeItem(J1.storageKey),this.storage.removeItem(Z1.storageKey)}async generateKeyPair(){const e=await tH();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(J1,e.privateKey),await this.storeKey(X1,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(J1)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(X1)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(Z1)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await rH(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const r=this.storage.getItem(e.storageKey);return r?q5(e.keyType,r):null}async storeKey(e,r){const n=await U5(e.keyType,r);this.storage.setItem(e.storageKey,n)}}const jl="4.2.4",z5="@coinbase/wallet-sdk";async function H5(t,e){const r=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":jl,"X-Cbw-Sdk-Platform":z5}}),{result:i,error:s}=await n.json();if(s)throw s;return i}function cH(){return globalThis.coinbaseWalletExtension}function uH(){var t,e;try{const r=globalThis;return(t=r.ethereum)!==null&&t!==void 0?t:(e=r.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function fH({metadata:t,preference:e}){var r,n;const{appName:i,appLogoUrl:s,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const u=cH();if(u)return(r=u.setAppInfo)===null||r===void 0||r.call(u,i,s,o,e),u}const a=uH();if(a!=null&&a.isCoinbaseBrowser)return(n=a.setAppInfo)===null||n===void 0||n.call(a,i,s,o,e),a}function lH(t){if(!t||typeof t!="object"||Array.isArray(t))throw Ar.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:r}=t;if(typeof e!="string"||e.length===0)throw Ar.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Ar.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw Ar.provider.unsupportedMethod()}}const W5="accounts",K5="activeChain",V5="availableChains",G5="walletCapabilities";class hH{constructor(e){var r,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new aH,this.storage=new Qs("CBWSDK","SCWStateManager"),this.accounts=(r=this.storage.loadObject(W5))!==null&&r!==void 0?r:[],this.chain=this.storage.loadObject(K5)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var r,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(r=e.params)!==null&&r!==void 0?r:{})}}),s=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in s.content)throw s.content.failure;const o=await q5("public",s.sender);await this.keyManager.setPeerPublicKey(o);const u=(await this.decryptResponseMessage(s)).result;if("error"in u)throw u.error;const l=u.value;this.accounts=l,this.storage.storeObject(W5,l),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",l)}async request(e){var r;if(this.accounts.length===0)throw Ar.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:ba(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return ba(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(G5);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw Ar.rpc.internal("No RPC URL set for chain");return H5(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var r,n;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const i=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(i)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,r;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(r=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&r!==void 0?r:1}}async handleSwitchChainRequest(e){var r;const n=e.params;if(!n||!(!((r=n[0])===null||r===void 0)&&r.chainId))throw Ar.rpc.invalidParams();const i=$l(n[0].chainId);if(this.updateChain(i))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(i),o}async sendEncryptedRequest(e){const r=await this.keyManager.getSharedSecret();if(!r)throw Ar.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await sH({action:e,chainId:this.chain.id},r),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const r=await U5("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:r,content:e,timestamp:new Date}}async decryptResponseMessage(e){var r,n;const i=e.content;if("failure"in i)throw i.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw Ar.provider.unauthorized("Invalid session");const o=await oH(i.encrypted,s),a=(r=o.data)===null||r===void 0?void 0:r.chains;if(a){const l=Object.entries(a).map(([d,p])=>({id:Number(d),rpcUrl:p}));this.storage.storeObject(V5,l),this.updateChain(this.chain.id,l)}const u=(n=o.data)===null||n===void 0?void 0:n.capabilities;return u&&this.storage.storeObject(G5,u),o}updateChain(e,r){var n;const i=r??this.storage.loadObject(V5),s=i==null?void 0:i.find(o=>o.id===e);return s?(s!==this.chain&&(this.chain=s,this.storage.storeObject(K5,s),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",ba(s.id))),!0):!1}}const dH=cg(PM),{keccak_256:pH}=dH;function Y5(t){return Buffer.allocUnsafe(t).fill(0)}function gH(t){return t.toString(2).length}function J5(t,e){let r=t.toString(16);r.length%2!==0&&(r="0"+r);const n=r.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(r=n4(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(to(t,e[s]));if(r==="dynamic"){var o=to("uint256",e.length);i.unshift(o)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([to("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,ii.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Ru(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return ii.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Ru(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=bc(e);const a=ii.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+a);if(n<0)throw new Error("Supplied uint is negative");return ii.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(r=Ru(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=bc(e);const a=ii.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied int exceeds width: "+r+" vs "+a);const u=ii.twosFromBigInt(n,256);return ii.bufferBEFromBigInt(u,32)}else if(t.startsWith("ufixed")){if(r=r4(t),n=bc(e),n<0)throw new Error("Supplied ufixed is negative");return to("uint256",n*BigInt(2)**BigInt(r[1]))}else if(t.startsWith("fixed"))return r=r4(t),to("int256",bc(e)*BigInt(2)**BigInt(r[1]))}throw new Error("Unsupported or invalid type: "+t)}function xH(t){return t==="string"||t==="bytes"||n4(t)==="dynamic"}function _H(t){return t.lastIndexOf("]")===t.length-1}function EH(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var o=t4(t[s]),a=e[s],u=to(o,a);xH(o)?(r.push(to("uint256",i)),n.push(u),i+=u.length):r.push(u)}return Buffer.concat(r.concat(n))}function i4(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(ii.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=Ru(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=bc(a);const u=ii.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+u);i.push(ii.bufferBEFromBigInt(n,r/8))}else if(o.startsWith("int")){if(r=Ru(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=bc(a);const u=ii.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied int exceeds width: "+r+" vs "+u);const l=ii.twosFromBigInt(n,r);i.push(ii.bufferBEFromBigInt(l,r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function SH(t,e){return ii.keccak(i4(t,e))}var AH={rawEncode:EH,solidityPack:i4,soliditySHA3:SH};const As=e4,Ul=AH,s4={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},Q1={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const o=(a,u,l)=>{if(r[u]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":As.keccak(this.encodeData(u,l,r,n))];if(l===void 0)throw new Error(`missing value for field ${a} of type ${u}`);if(u==="bytes")return["bytes32",As.keccak(l)];if(u==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",As.keccak(l)];if(u.lastIndexOf("]")===u.length-1){const d=u.slice(0,u.lastIndexOf("[")),p=l.map(y=>o(a,d,y));return["bytes32",As.keccak(Ul.rawEncode(p.map(([y])=>y),p.map(([,y])=>y)))]}return[u,l]};for(const a of r[t]){const[u,l]=o(a.name,a.type,e[a.name]);i.push(u),s.push(l)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=As.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=As.keccak(a),s.push(a);else if(r[o.type]!==void 0)i.push("bytes32"),a=As.keccak(this.encodeData(o.type,a,r,n)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return Ul.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return As.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return As.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in s4.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),As.keccak(Buffer.concat(n))}};var PH={TYPED_MESSAGE_SCHEMA:s4,TypedDataUtils:Q1,hashForSignTypedDataLegacy:function(t){return MH(t.data)},hashForSignTypedData_v3:function(t){return Q1.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return Q1.hash(t.data)}};function MH(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?As.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return Ul.soliditySHA3(["bytes32","bytes32"],[Ul.soliditySHA3(new Array(t.length).fill("string"),i),Ul.soliditySHA3(n,r)])}const b0=ji(PH),IH="walletUsername",ev="Addresses",CH="AppVersion";function Un(t){return t.errorMessage!==void 0}class TH{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",g0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),a=16,u=o.slice(o.byteLength-a),l=o.slice(0,o.byteLength-a),d=new Uint8Array(u),p=new Uint8Array(l),y=new Uint8Array([...n,...d,...p]);return W1(y)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",g0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=g0(e),a=o.slice(0,12),u=o.slice(12,28),l=o.slice(28),d=new Uint8Array([...l,...u]),p={name:"AES-GCM",iv:new Uint8Array(a)};try{const y=await window.crypto.subtle.decrypt(p,s,d),_=new TextDecoder;n(_.decode(y))}catch(y){i(y)}})()})}}class RH{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}var To;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(To||(To={}));class DH{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,To.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.DISCONNECTED)},i.onopen=s=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(u=>this.sendData(u)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const u=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,u)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,To.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const o4=1e4,OH=6e4;class NH{constructor({session:e,linkAPIUrl:r,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Co(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,u)=>{const l=s[u];l!==void 0&&a(l)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,u)},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(IH,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(CH,s)},this.handleChainUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(s),l=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(u,l)},this.session=e,this.cipher=new TH(e.secret),this.listener=n;const i=new DH(`${r}/rpc`,WebSocket);i.setConnectionStateListener(async s=>{let o=!1;switch(s){case To.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(u=>setTimeout(u,5e3)),this.destroyed||i.connect().catch(()=>{a()})};a()}break;case To.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},o4),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case To.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(s=>{var o;switch(s.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=s.type==="IsLinkedOK"?s.linked:void 0;this.linked=a||s.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(s.metadata);break}case"Event":{this.handleIncomingEvent(s);break}}s.id!==void 0&&((o=this.requestResolutions.get(s.id))===null||o===void 0||o(s))}),this.ws=i,this.http=new RH(r,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:s,response:o}=i;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s,o)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Co(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>o4*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r={timeout:OH}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r.timeout)}),new Promise(s=>{this.requestResolutions.set(n,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Co(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Co(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id}),!0)}}class LH{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=F5(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}const a4="session:id",c4="session:secret",u4="session:linked";class Du{constructor(e,r,n,i=!1){this.storage=e,this.id=r,this.secret=n,this.key=Gc(c2(`${r}, ${n} WalletLink`)),this._linked=!!i}static create(e){const r=vc(16),n=vc(32);return new Du(e,r,n).save()}static load(e){const r=e.getItem(a4),n=e.getItem(u4),i=e.getItem(c4);return r&&i?new Du(e,r,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(a4,this.id),this.storage.setItem(c4,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(u4,this._linked?"1":"0")}}function kH(){try{return window.frameElement!==null}catch{return!1}}function BH(){try{return kH()&&window.top?window.top.location:window.location}catch{return window.location}}function $H(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function f4(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const FH='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function l4(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(FH)),document.documentElement.appendChild(t)}function h4(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e2&&(o.children=arguments.length>3?y0.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return w0(t,o,n,i,null)}function w0(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++d4,__i:-1,__u:0};return i==null&&Vr.vnode!=null&&Vr.vnode(s),s}function Hl(t){return t.children}function x0(t,e){this.props=t,this.context=e}function Ou(t,e){if(e==null)return t.__?Ou(t.__,t.__i+1):null;for(var r;ee&&yc.sort(tv));_0.__r=0}function w4(t,e,r,n,i,s,o,a,u,l,d){var p,y,_,M,O,L,B=n&&n.__k||v4,k=e.length;for(u=UH(r,e,B,u),p=0;p0?w0(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,(u=s.__i=qH(s,r,a,p))!==-1&&(p--,(o=r[u])&&(o.__u|=2)),o==null||o.__v===null?(u==-1&&y--,typeof s.type!="function"&&(s.__u|=4)):u!==a&&(u==a-1?y--:u==a+1?y++:(u>a?y--:y++,s.__u|=4))):s=t.__k[i]=null;if(p)for(i=0;i(u!=null&&!(2&u.__u)?1:0))for(;o>=0||a=0){if((u=e[o])&&!(2&u.__u)&&i==u.key&&s===u.type)return o;o--}if(a=r.__.length&&r.__.push({}),r.__[t]}function L4(t){return lv=1,WH(B4,t)}function WH(t,e,r){var n=N4(S0++,2);if(n.t=t,!n.__c&&(n.__=[B4(void 0,e),function(a){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,a);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=cn,!cn.u)){var i=function(a,u,l){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(y){return!!y.__c});if(d.every(function(y){return!y.__N}))return!s||s.call(this,a,u,l);var p=n.__c.props!==a;return d.forEach(function(y){if(y.__N){var _=y.__[0];y.__=y.__N,y.__N=void 0,_!==y.__[0]&&(p=!0)}}),s&&s.call(this,a,u,l)||p};cn.u=!0;var s=cn.shouldComponentUpdate,o=cn.componentWillUpdate;cn.componentWillUpdate=function(a,u,l){if(this.__e){var d=s;s=void 0,i(a,u,l),s=d}o&&o.call(this,a,u,l)},cn.shouldComponentUpdate=i}return n.__N||n.__}function KH(t,e){var r=N4(S0++,3);!yn.__s&&YH(r.__H,e)&&(r.__=t,r.i=e,cn.__H.__h.push(r))}function VH(){for(var t;t=M4.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(A0),t.__H.__h.forEach(hv),t.__H.__h=[]}catch(e){t.__H.__h=[],yn.__e(e,t.__v)}}yn.__b=function(t){cn=null,I4&&I4(t)},yn.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),O4&&O4(t,e)},yn.__r=function(t){C4&&C4(t),S0=0;var e=(cn=t.__c).__H;e&&(fv===cn?(e.__h=[],cn.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(A0),e.__h.forEach(hv),e.__h=[],S0=0)),fv=cn},yn.diffed=function(t){T4&&T4(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(M4.push(e)!==1&&P4===yn.requestAnimationFrame||((P4=yn.requestAnimationFrame)||GH)(VH)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),fv=cn=null},yn.__c=function(t,e){e.some(function(r){try{r.__h.forEach(A0),r.__h=r.__h.filter(function(n){return!n.__||hv(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],yn.__e(n,r.__v)}}),R4&&R4(t,e)},yn.unmount=function(t){D4&&D4(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{A0(n)}catch(i){e=i}}),r.__H=void 0,e&&yn.__e(e,r.__v))};var k4=typeof requestAnimationFrame=="function";function GH(t){var e,r=function(){clearTimeout(n),k4&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);k4&&(e=requestAnimationFrame(r))}function A0(t){var e=cn,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),cn=e}function hv(t){var e=cn;t.__c=t.__(),cn=e}function YH(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function B4(t,e){return typeof e=="function"?e(t):e}const JH=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",XH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",ZH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class QH{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=f4()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const r=this.nextItemKey++;return this.items.set(r,e),this.render(),()=>{this.items.delete(r),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&uv(Or("div",null,Or($4,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,r])=>Or(eW,Object.assign({},r,{key:e}))))),this.root)}}const $4=t=>Or("div",{class:ql("-cbwsdk-snackbar-container")},Or("style",null,JH),Or("div",{class:"-cbwsdk-snackbar"},t.children)),eW=({autoExpand:t,message:e,menuItems:r})=>{const[n,i]=L4(!0),[s,o]=L4(t??!1);KH(()=>{const u=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{u.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return Or("div",{class:ql("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},Or("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},Or("img",{src:XH,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",Or("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),Or("div",{class:"-gear-container"},!s&&Or("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),Or("img",{src:ZH,class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&Or("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((u,l)=>Or("div",{class:ql("-cbwsdk-snackbar-instance-menu-item",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:u.onClick,key:l},Or("svg",{width:u.svgWidth,height:u.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("path",{"fill-rule":u.defaultFillRule,"clip-rule":u.defaultClipRule,d:u.path,fill:"#AAAAAA"})),Or("span",{class:ql("-cbwsdk-snackbar-instance-menu-item-info",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},u.info)))))};class tW{constructor(){this.attached=!1,this.snackbar=new QH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.snackbar.attach(r),this.attached=!0,l4()}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}}const rW=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class nW{constructor(){this.root=null,this.darkMode=f4()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),l4()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(uv(null,this.root),e&&uv(Or(iW,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const iW=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return Or($4,{darkMode:r},Or("div",{class:"-cbwsdk-redirect-dialog"},Or("style",null,rW),Or("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),Or("div",{class:ql("-cbwsdk-redirect-dialog-box",s)},Or("p",null,t),Or("button",{onClick:n},e))))},sW="https://keys.coinbase.com/connect",F4="https://www.walletlink.org",oW="https://go.cb-w.com/walletlink";class j4{constructor(){this.attached=!1,this.redirectDialog=new nW}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const r=new URL(oW);r.searchParams.append("redirect_url",BH().href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class Ro{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=$H(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(ev);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!u&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),Ro.accountRequestCallbackIds.size>0&&(Array.from(Ro.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),Ro.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new LH,this.ui=n,this.ui.attach()}subscribe(){const e=Du.load(this.storage)||Du.create(this.storage),{linkAPIUrl:r}=this,n=new NH({session:e,linkAPIUrl:r,listener:this}),i=this.isMobileWeb?new j4:new tW;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=Du.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Qs.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:eo(e.weiValue),data:Bl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?eo(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?eo(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?eo(e.gasPriceInWei):null,gasLimit:e.gasLimit?eo(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:eo(e.weiValue),data:Bl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?eo(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?eo(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?eo(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?eo(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Bl(e,!0),chainId:r}})}getWalletLinkSession(){return this._session}sendRequest(e){let r=null;const n=vc(8),i=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,s),r==null||r()};return new Promise((s,o)=>{r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,a=>{if(r==null||r(),Un(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,r){const n={type:"WEB3_REQUEST",id:e,request:r};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:r.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(r.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof j4)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e,r){if(r.method==="requestEthereumAccounts"){Ro.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,r)),Ro.accountRequestCallbackIds.clear();return}this.invokeCallback(e,r)}handleErrorResponse(e,r,n){var i;const s=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:r,errorMessage:s})}invokeCallback(e,r){const n=this.relayEventManager.callbacks.get(e);n&&(n(r),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:r}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:r}},i=vc(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(Un(a))return o(new Error(a.errorMessage));s(a)}),Ro.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,r,n,i,s,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:o}};let u=null;const l=vc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,_=>{if(u==null||u(),Un(_))return y(new Error(_.errorMessage));p(_)}),this.publishWeb3RequestEvent(l,a)})}addEthereumChain(e,r,n,i,s,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:o}};let u=null;const l=vc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,_=>{if(u==null||u(),Un(_))return y(new Error(_.errorMessage));p(_)}),this.publishWeb3RequestEvent(l,a)})}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})};let i=null;const s=vc(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,u)=>{this.relayEventManager.callbacks.set(s,l=>{if(i==null||i(),Un(l)&&l.errorCode)return u(Ar.provider.custom({code:l.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(Un(l))return u(new Error(l.errorMessage));a(l)}),this.publishWeb3RequestEvent(s,n)})}}Ro.accountRequestCallbackIds=new Set;const U4="DefaultChainId",q4="DefaultJsonRpcUrl";class z4{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new Qs("walletlink",F4),this.callback=e.callback||null;const r=this._storage.getItem(ev);if(r){const n=r.split(" ");n[0]!==""&&(this._addresses=n.map(i=>ya(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:r,secret:n}=e.getWalletLinkSession();return{id:r,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(q4))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(q4,e)}updateProviderInfo(e,r){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(U4,r.toString(10)),$l(r)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",ba(r)))}async watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw Ar.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw Ar.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw Ar.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw Ar.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=r.options,l=await this.initializeRelay().watchAsset(r.type,i,s,a,o,n==null?void 0:n.toString());return Un(l)?!1:!!l.result}async addEthereumChain(e){var r,n;const i=e[0];if(((r=i.rpcUrls)===null||r===void 0?void 0:r.length)===0)throw Ar.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw Ar.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw Ar.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:u=[],chainName:l,iconUrls:d=[],nativeCurrency:p}=i,y=await o.addEthereumChain(s.toString(),a,d,u,l,p);if(Un(y))return!1;if(((n=y.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw Ar.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const r=e[0],n=Number.parseInt(r.chainId,16),s=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(Un(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,r){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(s=>ya(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(ev,i.join(" ")))}async request(e){const r=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return ba(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(r);case"wallet_switchEthereumChain":return this.switchEthereumChain(r);case"wallet_watchAsset":return this.watchAsset(r);default:if(!this.jsonRpcUrl)throw Ar.rpc.internal("No RPC URL set for chain");return H5(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const r=ya(e);if(!this._addresses.map(i=>ya(i)).includes(r))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?ya(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?ya(e.to):null,i=e.value!=null?Fl(e.value):BigInt(0),s=e.data?Y1(e.data):Buffer.alloc(0),o=e.nonce!=null?$l(e.nonce):null,a=e.gasPrice!=null?Fl(e.gasPrice):null,u=e.maxFeePerGas!=null?Fl(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?Fl(e.maxPriorityFeePerGas):null,d=e.gas!=null?Fl(e.gas):null,p=e.chainId?$l(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:u,maxPriorityFeePerGas:l,gasLimit:d,chainId:p}}async ecRecover(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Ar.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:K1(n[0]),signature:K1(n[1]),addPrefix:r==="personal_ecRecover"}});if(Un(s))throw s;return s.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(U4))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,r;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:ba(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(Un(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:ba(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw Ar.rpc.invalidParams();const r=e[1],n=e[0];this._ensureKnownAddress(r);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ya(r),message:K1(n),addPrefix:!0,typedDataJson:null}});if(Un(s))throw s;return s.result}async _eth_signTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(r);if(Un(i))throw i;return i.result}async _eth_sendRawTransaction(e){const r=Y1(e[0]),i=await this.initializeRelay().submitEthereumTransaction(r,this.getChainId());if(Un(i))throw i;return i.result}async _eth_sendTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(r);if(Un(i))throw i;return i.result}async signTypedData(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Ar.rpc.invalidParams();const i=l=>{const d={eth_signTypedData_v1:b0.hashForSignTypedDataLegacy,eth_signTypedData_v3:b0.hashForSignTypedData_v3,eth_signTypedData_v4:b0.hashForSignTypedData_v4,eth_signTypedData:b0.hashForSignTypedData_v4};return Bl(d[r]({data:Qz(l)}),!0)},s=n[r==="eth_signTypedData_v1"?1:0],o=n[r==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const u=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ya(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(Un(u))throw u;return u.result}initializeRelay(){return this._relay||(this._relay=new Ro({linkAPIUrl:F4,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const H4="SignerType",W4=new Qs("CBWSDK","SignerConfigurator");function aW(){return W4.getItem(H4)}function cW(t){W4.setItem(H4,t)}async function uW(t){const{communicator:e,metadata:r,handshakeRequest:n,callback:i}=t;lW(e,r,i).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:o}=await e.postRequestAndWaitForResponse(s);return o}function fW(t){const{signerType:e,metadata:r,communicator:n,callback:i}=t;switch(e){case"scw":return new hH({metadata:r,callback:i,communicator:n});case"walletlink":return new z4({metadata:r,callback:i})}}async function lW(t,e,r){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new z4({metadata:e,callback:r});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const hW=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. +}`;var fr=wP(function(){return Mr(ne,Nt+"return "+Ze).apply(r,he)});if(fr.source=Ze,Hy(fr))throw fr;return fr}function Jse(c){return Cr(c).toLowerCase()}function Xse(c){return Cr(c).toUpperCase()}function Zse(c,h,w){if(c=Cr(c),c&&(w||h===r))return C9(c);if(!c||!(h=ki(h)))return c;var N=Ts(c),V=Ts(h),ne=T9(N,V),he=R9(N,V)+1;return Fa(N,ne,he).join("")}function Qse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.slice(0,O9(c)+1);if(!c||!(h=ki(h)))return c;var N=Ts(c),V=R9(N,Ts(h))+1;return Fa(N,0,V).join("")}function eoe(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.replace($,"");if(!c||!(h=ki(h)))return c;var N=Ts(c),V=T9(N,Ts(h));return Fa(N,V).join("")}function toe(c,h){var w=me,N=j;if(Qr(h)){var V="separator"in h?h.separator:V;w="length"in h?ur(h.length):w,N="omission"in h?ki(h.omission):N}c=Cr(c);var ne=c.length;if(nf(c)){var he=Ts(c);ne=he.length}if(w>=ne)return c;var ve=w-sf(N);if(ve<1)return N;var xe=he?Fa(he,0,ve).join(""):c.slice(0,ve);if(V===r)return xe+N;if(he&&(ve+=xe.length-ve),Wy(V)){if(c.slice(ve).search(V)){var We,Ke=xe;for(V.global||(V=ay(V.source,Cr(Re.exec(V))+"g")),V.lastIndex=0;We=V.exec(Ke);)var Ze=We.index;xe=xe.slice(0,Ze===r?ve:Ze)}}else if(c.indexOf(ki(V),ve)!=ve){var xt=xe.lastIndexOf(V);xt>-1&&(xe=xe.slice(0,xt))}return xe+N}function roe(c){return c=Cr(c),c&&Bt.test(c)?c.replace(Xt,Ree):c}var noe=hf(function(c,h,w){return c+(w?" ":"")+h.toUpperCase()}),Gy=xA("toUpperCase");function yP(c,h,w){return c=Cr(c),h=w?r:h,h===r?Pee(c)?Nee(c):vee(c):c.match(h)||[]}var wP=hr(function(c,h){try{return Ln(c,r,h)}catch(w){return Hy(w)?w:new tr(w)}}),ioe=Wo(function(c,h){return as(h,function(w){w=uo(w),zo(c,w,qy(c[w],c))}),c});function soe(c){var h=c==null?0:c.length,w=qt();return c=h?Xr(c,function(N){if(typeof N[1]!="function")throw new cs(o);return[w(N[0]),N[1]]}):[],hr(function(N){for(var V=-1;++VS)return[];var w=P,N=Zn(c,P);h=qt(h),c-=P;for(var V=iy(N,h);++w0||h<0)?new _r(w):(c<0?w=w.takeRight(-c):c&&(w=w.drop(c)),h!==r&&(h=ur(h),w=h<0?w.dropRight(-h):w.take(h-c)),w)},_r.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},_r.prototype.toArray=function(){return this.take(P)},ao(_r.prototype,function(c,h){var w=/^(?:filter|find|map|reject)|While$/.test(h),N=/^(?:head|last)$/.test(h),V=te[N?"take"+(h=="last"?"Right":""):h],ne=N||/^find/.test(h);V&&(te.prototype[h]=function(){var he=this.__wrapped__,ve=N?[1]:arguments,xe=he instanceof _r,We=ve[0],Ke=xe||sr(he),Ze=function(yr){var Sr=V.apply(te,Oa([yr],ve));return N&&xt?Sr[0]:Sr};Ke&&w&&typeof We=="function"&&We.length!=1&&(xe=Ke=!1);var xt=this.__chain__,Nt=!!this.__actions__.length,Vt=ne&&!xt,fr=xe&&!Nt;if(!ne&&Ke){he=fr?he:new _r(this);var Gt=c.apply(he,ve);return Gt.__actions__.push({func:eg,args:[Ze],thisArg:r}),new us(Gt,xt)}return Vt&&fr?c.apply(this,ve):(Gt=this.thru(Ze),Vt?N?Gt.value()[0]:Gt.value():Gt)})}),as(["pop","push","shift","sort","splice","unshift"],function(c){var h=Pp[c],w=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",N=/^(?:pop|shift)$/.test(c);te.prototype[c]=function(){var V=arguments;if(N&&!this.__chain__){var ne=this.value();return h.apply(sr(ne)?ne:[],V)}return this[w](function(he){return h.apply(sr(he)?he:[],V)})}}),ao(_r.prototype,function(c,h){var w=te[h];if(w){var N=w.name+"";Tr.call(uf,N)||(uf[N]=[]),uf[N].push({name:h,func:w})}}),uf[Vp(r,B).name]=[{name:"wrapper",func:r}],_r.prototype.clone=rte,_r.prototype.reverse=nte,_r.prototype.value=ite,te.prototype.at=One,te.prototype.chain=Nne,te.prototype.commit=Lne,te.prototype.next=kne,te.prototype.plant=$ne,te.prototype.reverse=Fne,te.prototype.toJSON=te.prototype.valueOf=te.prototype.value=jne,te.prototype.first=te.prototype.head,xh&&(te.prototype[xh]=Bne),te},of=Lee();pn?((pn.exports=of)._=of,Ur._=of):Er._=of}).call(nn)}(h0,h0.exports);var nz=h0.exports,L1={exports:{}};(function(t,e){var r=typeof self<"u"?self:nn,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function u(f){return f&&DataView.prototype.isPrototypeOf(f)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(f){return f&&l.indexOf(Object.prototype.toString.call(f))>-1};function p(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function y(f){return typeof f!="string"&&(f=String(f)),f}function _(f){var g={next:function(){var v=f.shift();return{done:v===void 0,value:v}}};return a.iterable&&(g[Symbol.iterator]=function(){return g}),g}function M(f){this.map={},f instanceof M?f.forEach(function(g,v){this.append(v,g)},this):Array.isArray(f)?f.forEach(function(g){this.append(g[0],g[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(g){this.append(g,f[g])},this)}M.prototype.append=function(f,g){f=p(f),g=y(g);var v=this.map[f];this.map[f]=v?v+", "+g:g},M.prototype.delete=function(f){delete this.map[p(f)]},M.prototype.get=function(f){return f=p(f),this.has(f)?this.map[f]:null},M.prototype.has=function(f){return this.map.hasOwnProperty(p(f))},M.prototype.set=function(f,g){this.map[p(f)]=y(g)},M.prototype.forEach=function(f,g){for(var v in this.map)this.map.hasOwnProperty(v)&&f.call(g,this.map[v],v,this)},M.prototype.keys=function(){var f=[];return this.forEach(function(g,v){f.push(v)}),_(f)},M.prototype.values=function(){var f=[];return this.forEach(function(g){f.push(g)}),_(f)},M.prototype.entries=function(){var f=[];return this.forEach(function(g,v){f.push([v,g])}),_(f)},a.iterable&&(M.prototype[Symbol.iterator]=M.prototype.entries);function O(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function L(f){return new Promise(function(g,v){f.onload=function(){g(f.result)},f.onerror=function(){v(f.error)}})}function B(f){var g=new FileReader,v=L(g);return g.readAsArrayBuffer(f),v}function k(f){var g=new FileReader,v=L(g);return g.readAsText(f),v}function H(f){for(var g=new Uint8Array(f),v=new Array(g.length),x=0;x-1?g:f}function W(f,g){g=g||{};var v=g.body;if(f instanceof W){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,g.headers||(this.headers=new M(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!v&&f._bodyInit!=null&&(v=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=g.credentials||this.credentials||"same-origin",(g.headers||!this.headers)&&(this.headers=new M(g.headers)),this.method=R(g.method||this.method||"GET"),this.mode=g.mode||this.mode||null,this.signal=g.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(v)}W.prototype.clone=function(){return new W(this,{body:this._bodyInit})};function ie(f){var g=new FormData;return f.trim().split("&").forEach(function(v){if(v){var x=v.split("="),S=x.shift().replace(/\+/g," "),A=x.join("=").replace(/\+/g," ");g.append(decodeURIComponent(S),decodeURIComponent(A))}}),g}function me(f){var g=new M,v=f.replace(/\r?\n[\t ]+/g," ");return v.split(/\r?\n/).forEach(function(x){var S=x.split(":"),A=S.shift().trim();if(A){var b=S.join(":").trim();g.append(A,b)}}),g}z.call(W.prototype);function j(f,g){g||(g={}),this.type="default",this.status=g.status===void 0?200:g.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in g?g.statusText:"OK",this.headers=new M(g.headers),this.url=g.url||"",this._initBody(f)}z.call(j.prototype),j.prototype.clone=function(){return new j(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new M(this.headers),url:this.url})},j.error=function(){var f=new j(null,{status:0,statusText:""});return f.type="error",f};var E=[301,302,303,307,308];j.redirect=function(f,g){if(E.indexOf(g)===-1)throw new RangeError("Invalid status code");return new j(null,{status:g,headers:{location:f}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(g,v){this.message=g,this.name=v;var x=Error(g);this.stack=x.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function m(f,g){return new Promise(function(v,x){var S=new W(f,g);if(S.signal&&S.signal.aborted)return x(new o.DOMException("Aborted","AbortError"));var A=new XMLHttpRequest;function b(){A.abort()}A.onload=function(){var P={status:A.status,statusText:A.statusText,headers:me(A.getAllResponseHeaders()||"")};P.url="responseURL"in A?A.responseURL:P.headers.get("X-Request-URL");var I="response"in A?A.response:A.responseText;v(new j(I,P))},A.onerror=function(){x(new TypeError("Network request failed"))},A.ontimeout=function(){x(new TypeError("Network request failed"))},A.onabort=function(){x(new o.DOMException("Aborted","AbortError"))},A.open(S.method,S.url,!0),S.credentials==="include"?A.withCredentials=!0:S.credentials==="omit"&&(A.withCredentials=!1),"responseType"in A&&a.blob&&(A.responseType="blob"),S.headers.forEach(function(P,I){A.setRequestHeader(I,P)}),S.signal&&(S.signal.addEventListener("abort",b),A.onreadystatechange=function(){A.readyState===4&&S.signal.removeEventListener("abort",b)}),A.send(typeof S._bodyInit>"u"?null:S._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=M,s.Request=W,s.Response=j),o.Headers=M,o.Request=W,o.Response=j,o.fetch=m,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(L1,L1.exports);var iz=L1.exports;const a5=ji(iz);var sz=Object.defineProperty,oz=Object.defineProperties,az=Object.getOwnPropertyDescriptors,c5=Object.getOwnPropertySymbols,cz=Object.prototype.hasOwnProperty,uz=Object.prototype.propertyIsEnumerable,u5=(t,e,r)=>e in t?sz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,f5=(t,e)=>{for(var r in e||(e={}))cz.call(e,r)&&u5(t,r,e[r]);if(c5)for(var r of c5(e))uz.call(e,r)&&u5(t,r,e[r]);return t},l5=(t,e)=>oz(t,az(e));const fz={Accept:"application/json","Content-Type":"application/json"},lz="POST",h5={headers:fz,method:lz},d5=10;let Ss=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new Hi.EventEmitter,this.isAvailable=!1,this.registering=!1,!h6(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=mo(e),n=await(await a5(this.url,l5(f5({},h5),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!h6(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=mo({id:1,jsonrpc:"2.0",method:"test",params:[]});await a5(e,l5(f5({},h5),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Qa(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=o0(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return a6(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>d5&&this.events.setMaxListeners(d5)}};const p5="error",hz="wss://relay.walletconnect.org",dz="wc",pz="universal_provider",g5=`${dz}@2:${pz}:`,m5="https://rpc.walletconnect.org/v1/",Cu="generic",gz=`${m5}bundler`,ts={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var mz=Object.defineProperty,vz=Object.defineProperties,bz=Object.getOwnPropertyDescriptors,v5=Object.getOwnPropertySymbols,yz=Object.prototype.hasOwnProperty,wz=Object.prototype.propertyIsEnumerable,b5=(t,e,r)=>e in t?mz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,d0=(t,e)=>{for(var r in e||(e={}))yz.call(e,r)&&b5(t,r,e[r]);if(v5)for(var r of v5(e))wz.call(e,r)&&b5(t,r,e[r]);return t},xz=(t,e)=>vz(t,bz(e));function Di(t,e,r){var n;const i=Su(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${m5}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function vc(t){return t.includes(":")?t.split(":")[1]:t}function y5(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function _z(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function k1(t={},e={}){const r=w5(t),n=w5(e);return nz.merge(r,n)}function w5(t){var e,r,n,i;const s={};if(!Ml(t))return s;for(const[o,a]of Object.entries(t)){const u=y1(o)?[o]:a.chains,l=a.methods||[],d=a.events||[],p=a.rpcMap||{},y=Pl(o);s[y]=xz(d0(d0({},s[y]),a),{chains:Qd(u,(e=s[y])==null?void 0:e.chains),methods:Qd(l,(r=s[y])==null?void 0:r.methods),events:Qd(d,(n=s[y])==null?void 0:n.events),rpcMap:d0(d0({},p),(i=s[y])==null?void 0:i.rpcMap)})}return s}function Ez(t){return t.includes(":")?t.split(":")[2]:t}function x5(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=y1(r)?[r]:n.chains?n.chains:y5(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function B1(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const _5={},Pr=t=>_5[t],$1=(t,e)=>{_5[t]=e};class Sz{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=vc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}}var Az=Object.defineProperty,Pz=Object.defineProperties,Mz=Object.getOwnPropertyDescriptors,E5=Object.getOwnPropertySymbols,Iz=Object.prototype.hasOwnProperty,Cz=Object.prototype.propertyIsEnumerable,S5=(t,e,r)=>e in t?Az(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A5=(t,e)=>{for(var r in e||(e={}))Iz.call(e,r)&&S5(t,r,e[r]);if(E5)for(var r of E5(e))Cz.call(e,r)&&S5(t,r,e[r]);return t},P5=(t,e)=>Pz(t,Mz(e));class Tz{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(vc(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const u=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:P5(A5({},o.sessionProperties||{}),{capabilities:P5(A5({},a||{}),{[s]:u})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return u}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(va("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${gz}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class Rz{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=vc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}}let Dz=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=vc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}},Oz=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Zi(new Ss(n,Pr("disableProviderPing")))}},Nz=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=vc(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}},Lz=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=vc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}};class kz{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=vc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}}let Bz=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Zi(new Ss(n,Pr("disableProviderPing")))}};class $z{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Zi(new Ss(n))}}class Fz{constructor(e){this.name=Cu,this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=Su(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}}var jz=Object.defineProperty,Uz=Object.defineProperties,qz=Object.getOwnPropertyDescriptors,M5=Object.getOwnPropertySymbols,zz=Object.prototype.hasOwnProperty,Hz=Object.prototype.propertyIsEnumerable,I5=(t,e,r)=>e in t?jz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,p0=(t,e)=>{for(var r in e||(e={}))zz.call(e,r)&&I5(t,r,e[r]);if(M5)for(var r of M5(e))Hz.call(e,r)&&I5(t,r,e[r]);return t},F1=(t,e)=>Uz(t,qz(e));let j1=class SP{constructor(e){this.events=new im,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:rl(bd({level:(e==null?void 0:e.logger)||p5})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new SP(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:p0({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,s0(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Dr("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=x5(this.session.namespaces);this.namespaces=k1(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=x5(s.namespaces);this.namespaces=k1(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==i5)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Cu?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(lc(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await N1.init({core:this.providerOpts.core,logger:this.providerOpts.logger||p5,relayUrl:this.providerOpts.relayUrl||hz,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>Pl(r)))];$1("client",this.client),$1("events",this.events),$1("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=_z(r,this.session),i=y5(n),s=k1(this.namespaces,this.optionalNamespaces),o=F1(p0({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new Tz({namespace:o});break;case"algorand":this.rpcProviders[r]=new Oz({namespace:o});break;case"solana":this.rpcProviders[r]=new Rz({namespace:o});break;case"cosmos":this.rpcProviders[r]=new Dz({namespace:o});break;case"polkadot":this.rpcProviders[r]=new Sz({namespace:o});break;case"cip34":this.rpcProviders[r]=new Nz({namespace:o});break;case"elrond":this.rpcProviders[r]=new Lz({namespace:o});break;case"multiversx":this.rpcProviders[r]=new kz({namespace:o});break;case"near":this.rpcProviders[r]=new Bz({namespace:o});break;case"tezos":this.rpcProviders[r]=new $z({namespace:o});break;default:this.rpcProviders[Cu]?this.rpcProviders[Cu].updateNamespace(o):this.rpcProviders[Cu]=new Fz({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&lc(i)&&this.events.emit("accountsChanged",i.map(Ez))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=Pl(i),a=B1(i)!==B1(s)?`${o}:${B1(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=F1(p0({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",F1(p0({},Dr("USER_DISCONNECTED")),{data:e.topic}))}),this.on(ts.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Cu]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>Pl(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=Pl(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${g5}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${g5}/${e}`)}};const Wz=j1;function Kz(){return new Promise(t=>{const e=[];let r;window.addEventListener("eip6963:announceProvider",n=>{const{detail:i}=n;r&&clearTimeout(r),e.push(i),r=setTimeout(()=>t(e),200)}),r=setTimeout(()=>t(e),200),window.dispatchEvent(new Event("eip6963:requestProvider"))})}class Qs{constructor(e,r){this.scope=e,this.module=r}storeObject(e,r){this.setItem(e,JSON.stringify(r))}loadObject(e){const r=this.getItem(e);return r?JSON.parse(r):void 0}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new Qs("CBWSDK").clear(),new Qs("walletlink").clear()}}const an={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},U1={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},C5="Unspecified error message.",Vz="Unspecified server error.";function q1(t,e=C5){if(t&&Number.isInteger(t)){const r=t.toString();if(z1(U1,r))return U1[r].message;if(T5(t))return Vz}return e}function Gz(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(U1[e]||T5(t))}function Yz(t,{shouldIncludeStack:e=!1}={}){const r={};if(t&&typeof t=="object"&&!Array.isArray(t)&&z1(t,"code")&&Gz(t.code)){const n=t;r.code=n.code,n.message&&typeof n.message=="string"?(r.message=n.message,z1(n,"data")&&(r.data=n.data)):(r.message=q1(r.code),r.data={originalError:R5(t)})}else r.code=an.rpc.internal,r.message=D5(t,"message")?t.message:C5,r.data={originalError:R5(t)};return e&&(r.stack=D5(t,"stack")?t.stack:void 0),r}function T5(t){return t>=-32099&&t<=-32e3}function R5(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function z1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function D5(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const Ar={rpc:{parse:t=>rs(an.rpc.parse,t),invalidRequest:t=>rs(an.rpc.invalidRequest,t),invalidParams:t=>rs(an.rpc.invalidParams,t),methodNotFound:t=>rs(an.rpc.methodNotFound,t),internal:t=>rs(an.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return rs(e,t)},invalidInput:t=>rs(an.rpc.invalidInput,t),resourceNotFound:t=>rs(an.rpc.resourceNotFound,t),resourceUnavailable:t=>rs(an.rpc.resourceUnavailable,t),transactionRejected:t=>rs(an.rpc.transactionRejected,t),methodNotSupported:t=>rs(an.rpc.methodNotSupported,t),limitExceeded:t=>rs(an.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Tu(an.provider.userRejectedRequest,t),unauthorized:t=>Tu(an.provider.unauthorized,t),unsupportedMethod:t=>Tu(an.provider.unsupportedMethod,t),disconnected:t=>Tu(an.provider.disconnected,t),chainDisconnected:t=>Tu(an.provider.chainDisconnected,t),unsupportedChain:t=>Tu(an.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new L5(e,r,n)}}};function rs(t,e){const[r,n]=O5(e);return new N5(t,r||q1(t),n)}function Tu(t,e){const[r,n]=O5(e);return new L5(t,r||q1(t),n)}function O5(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}class N5 extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}}class L5 extends N5{constructor(e,r,n){if(!Jz(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}function Jz(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function H1(){return t=>t}const kl=H1(),Xz=H1(),Zz=H1();function Co(t){return Math.floor(t)}const k5=/^[0-9]*$/,B5=/^[a-f0-9]*$/;function bc(t){return W1(crypto.getRandomValues(new Uint8Array(t)))}function W1(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function g0(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function Bl(t,e=!1){const r=t.toString("hex");return kl(e?`0x${r}`:r)}function K1(t){return Bl(Y1(t),!0)}function eo(t){return Zz(t.toString(10))}function ba(t){return kl(`0x${BigInt(t).toString(16)}`)}function $5(t){return t.startsWith("0x")||t.startsWith("0X")}function V1(t){return $5(t)?t.slice(2):t}function F5(t){return $5(t)?`0x${t.slice(2)}`:`0x${t}`}function m0(t){if(typeof t!="string")return!1;const e=V1(t).toLowerCase();return B5.test(e)}function Qz(t,e=!1){if(typeof t=="string"){const r=V1(t).toLowerCase();if(B5.test(r))return kl(e?`0x${r}`:r)}throw Ar.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function G1(t,e=!1){let r=Qz(t,!1);return r.length%2===1&&(r=kl(`0${r}`)),e?kl(`0x${r}`):r}function ya(t){if(typeof t=="string"){const e=V1(t).toLowerCase();if(m0(e)&&e.length===40)return Xz(F5(e))}throw Ar.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function Y1(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(m0(t)){const e=G1(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Ar.rpc.invalidParams(`Not binary data: ${String(t)}`)}function $l(t){if(typeof t=="number"&&Number.isInteger(t))return Co(t);if(typeof t=="string"){if(k5.test(t))return Co(Number(t));if(m0(t))return Co(Number(BigInt(G1(t,!0))))}throw Ar.rpc.invalidParams(`Not an integer: ${String(t)}`)}function Fl(t){if(t!==null&&(typeof t=="bigint"||tH(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt($l(t));if(typeof t=="string"){if(k5.test(t))return BigInt(t);if(m0(t))return BigInt(G1(t,!0))}throw Ar.rpc.invalidParams(`Not an integer: ${String(t)}`)}function eH(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Ar.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function tH(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function rH(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function nH(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function iH(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,new TextEncoder().encode(e));return{iv:r,cipherText:n}}async function sH(t,{iv:e,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return new TextDecoder().decode(n)}function j5(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function U5(t,e){const r=j5(t),n=await crypto.subtle.exportKey(r,e);return W1(new Uint8Array(n))}async function q5(t,e){const r=j5(t),n=g0(e).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function oH(t,e){const r=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return iH(e,r)}async function aH(t,e){return JSON.parse(await sH(e,t))}const J1={storageKey:"ownPrivateKey",keyType:"private"},X1={storageKey:"ownPublicKey",keyType:"public"},Z1={storageKey:"peerPublicKey",keyType:"public"};class cH{constructor(){this.storage=new Qs("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(Z1,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(X1.storageKey),this.storage.removeItem(J1.storageKey),this.storage.removeItem(Z1.storageKey)}async generateKeyPair(){const e=await rH();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(J1,e.privateKey),await this.storeKey(X1,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(J1)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(X1)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(Z1)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await nH(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const r=this.storage.getItem(e.storageKey);return r?q5(e.keyType,r):null}async storeKey(e,r){const n=await U5(e.keyType,r);this.storage.setItem(e.storageKey,n)}}const jl="4.2.4",z5="@coinbase/wallet-sdk";async function H5(t,e){const r=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":jl,"X-Cbw-Sdk-Platform":z5}}),{result:i,error:s}=await n.json();if(s)throw s;return i}function uH(){return globalThis.coinbaseWalletExtension}function fH(){var t,e;try{const r=globalThis;return(t=r.ethereum)!==null&&t!==void 0?t:(e=r.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function lH({metadata:t,preference:e}){var r,n;const{appName:i,appLogoUrl:s,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const u=uH();if(u)return(r=u.setAppInfo)===null||r===void 0||r.call(u,i,s,o,e),u}const a=fH();if(a!=null&&a.isCoinbaseBrowser)return(n=a.setAppInfo)===null||n===void 0||n.call(a,i,s,o,e),a}function hH(t){if(!t||typeof t!="object"||Array.isArray(t))throw Ar.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:r}=t;if(typeof e!="string"||e.length===0)throw Ar.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Ar.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw Ar.provider.unsupportedMethod()}}const W5="accounts",K5="activeChain",V5="availableChains",G5="walletCapabilities";class dH{constructor(e){var r,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new cH,this.storage=new Qs("CBWSDK","SCWStateManager"),this.accounts=(r=this.storage.loadObject(W5))!==null&&r!==void 0?r:[],this.chain=this.storage.loadObject(K5)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var r,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(r=e.params)!==null&&r!==void 0?r:{})}}),s=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in s.content)throw s.content.failure;const o=await q5("public",s.sender);await this.keyManager.setPeerPublicKey(o);const u=(await this.decryptResponseMessage(s)).result;if("error"in u)throw u.error;const l=u.value;this.accounts=l,this.storage.storeObject(W5,l),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",l)}async request(e){var r;if(this.accounts.length===0)throw Ar.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:ba(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return ba(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(G5);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw Ar.rpc.internal("No RPC URL set for chain");return H5(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var r,n;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const i=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(i)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,r;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(r=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&r!==void 0?r:1}}async handleSwitchChainRequest(e){var r;const n=e.params;if(!n||!(!((r=n[0])===null||r===void 0)&&r.chainId))throw Ar.rpc.invalidParams();const i=$l(n[0].chainId);if(this.updateChain(i))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(i),o}async sendEncryptedRequest(e){const r=await this.keyManager.getSharedSecret();if(!r)throw Ar.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await oH({action:e,chainId:this.chain.id},r),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const r=await U5("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:r,content:e,timestamp:new Date}}async decryptResponseMessage(e){var r,n;const i=e.content;if("failure"in i)throw i.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw Ar.provider.unauthorized("Invalid session");const o=await aH(i.encrypted,s),a=(r=o.data)===null||r===void 0?void 0:r.chains;if(a){const l=Object.entries(a).map(([d,p])=>({id:Number(d),rpcUrl:p}));this.storage.storeObject(V5,l),this.updateChain(this.chain.id,l)}const u=(n=o.data)===null||n===void 0?void 0:n.capabilities;return u&&this.storage.storeObject(G5,u),o}updateChain(e,r){var n;const i=r??this.storage.loadObject(V5),s=i==null?void 0:i.find(o=>o.id===e);return s?(s!==this.chain&&(this.chain=s,this.storage.storeObject(K5,s),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",ba(s.id))),!0):!1}}const pH=cg(PM),{keccak_256:gH}=pH;function Y5(t){return Buffer.allocUnsafe(t).fill(0)}function mH(t){return t.toString(2).length}function J5(t,e){let r=t.toString(16);r.length%2!==0&&(r="0"+r);const n=r.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(r=n4(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(to(t,e[s]));if(r==="dynamic"){var o=to("uint256",e.length);i.unshift(o)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([to("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,ii.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Ru(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return ii.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Ru(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=yc(e);const a=ii.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+a);if(n<0)throw new Error("Supplied uint is negative");return ii.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(r=Ru(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=yc(e);const a=ii.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied int exceeds width: "+r+" vs "+a);const u=ii.twosFromBigInt(n,256);return ii.bufferBEFromBigInt(u,32)}else if(t.startsWith("ufixed")){if(r=r4(t),n=yc(e),n<0)throw new Error("Supplied ufixed is negative");return to("uint256",n*BigInt(2)**BigInt(r[1]))}else if(t.startsWith("fixed"))return r=r4(t),to("int256",yc(e)*BigInt(2)**BigInt(r[1]))}throw new Error("Unsupported or invalid type: "+t)}function _H(t){return t==="string"||t==="bytes"||n4(t)==="dynamic"}function EH(t){return t.lastIndexOf("]")===t.length-1}function SH(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var o=t4(t[s]),a=e[s],u=to(o,a);_H(o)?(r.push(to("uint256",i)),n.push(u),i+=u.length):r.push(u)}return Buffer.concat(r.concat(n))}function i4(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(ii.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=Ru(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=yc(a);const u=ii.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+u);i.push(ii.bufferBEFromBigInt(n,r/8))}else if(o.startsWith("int")){if(r=Ru(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=yc(a);const u=ii.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied int exceeds width: "+r+" vs "+u);const l=ii.twosFromBigInt(n,r);i.push(ii.bufferBEFromBigInt(l,r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function AH(t,e){return ii.keccak(i4(t,e))}var PH={rawEncode:SH,solidityPack:i4,soliditySHA3:AH};const As=e4,Ul=PH,s4={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},Q1={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const o=(a,u,l)=>{if(r[u]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":As.keccak(this.encodeData(u,l,r,n))];if(l===void 0)throw new Error(`missing value for field ${a} of type ${u}`);if(u==="bytes")return["bytes32",As.keccak(l)];if(u==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",As.keccak(l)];if(u.lastIndexOf("]")===u.length-1){const d=u.slice(0,u.lastIndexOf("[")),p=l.map(y=>o(a,d,y));return["bytes32",As.keccak(Ul.rawEncode(p.map(([y])=>y),p.map(([,y])=>y)))]}return[u,l]};for(const a of r[t]){const[u,l]=o(a.name,a.type,e[a.name]);i.push(u),s.push(l)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=As.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=As.keccak(a),s.push(a);else if(r[o.type]!==void 0)i.push("bytes32"),a=As.keccak(this.encodeData(o.type,a,r,n)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return Ul.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return As.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return As.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in s4.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),As.keccak(Buffer.concat(n))}};var MH={TYPED_MESSAGE_SCHEMA:s4,TypedDataUtils:Q1,hashForSignTypedDataLegacy:function(t){return IH(t.data)},hashForSignTypedData_v3:function(t){return Q1.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return Q1.hash(t.data)}};function IH(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?As.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return Ul.soliditySHA3(["bytes32","bytes32"],[Ul.soliditySHA3(new Array(t.length).fill("string"),i),Ul.soliditySHA3(n,r)])}const b0=ji(MH),CH="walletUsername",ev="Addresses",TH="AppVersion";function Un(t){return t.errorMessage!==void 0}class RH{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",g0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),a=16,u=o.slice(o.byteLength-a),l=o.slice(0,o.byteLength-a),d=new Uint8Array(u),p=new Uint8Array(l),y=new Uint8Array([...n,...d,...p]);return W1(y)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",g0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=g0(e),a=o.slice(0,12),u=o.slice(12,28),l=o.slice(28),d=new Uint8Array([...l,...u]),p={name:"AES-GCM",iv:new Uint8Array(a)};try{const y=await window.crypto.subtle.decrypt(p,s,d),_=new TextDecoder;n(_.decode(y))}catch(y){i(y)}})()})}}class DH{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}var To;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(To||(To={}));class OH{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,To.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.DISCONNECTED)},i.onopen=s=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(u=>this.sendData(u)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const u=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,u)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,To.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const o4=1e4,NH=6e4;class LH{constructor({session:e,linkAPIUrl:r,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Co(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,u)=>{const l=s[u];l!==void 0&&a(l)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,u)},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(CH,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(TH,s)},this.handleChainUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(s),l=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(u,l)},this.session=e,this.cipher=new RH(e.secret),this.listener=n;const i=new OH(`${r}/rpc`,WebSocket);i.setConnectionStateListener(async s=>{let o=!1;switch(s){case To.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(u=>setTimeout(u,5e3)),this.destroyed||i.connect().catch(()=>{a()})};a()}break;case To.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},o4),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case To.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(s=>{var o;switch(s.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=s.type==="IsLinkedOK"?s.linked:void 0;this.linked=a||s.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(s.metadata);break}case"Event":{this.handleIncomingEvent(s);break}}s.id!==void 0&&((o=this.requestResolutions.get(s.id))===null||o===void 0||o(s))}),this.ws=i,this.http=new DH(r,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:s,response:o}=i;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s,o)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Co(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>o4*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r={timeout:NH}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r.timeout)}),new Promise(s=>{this.requestResolutions.set(n,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Co(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Co(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id}),!0)}}class kH{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=F5(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}const a4="session:id",c4="session:secret",u4="session:linked";class Du{constructor(e,r,n,i=!1){this.storage=e,this.id=r,this.secret=n,this.key=Yc(c2(`${r}, ${n} WalletLink`)),this._linked=!!i}static create(e){const r=bc(16),n=bc(32);return new Du(e,r,n).save()}static load(e){const r=e.getItem(a4),n=e.getItem(u4),i=e.getItem(c4);return r&&i?new Du(e,r,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(a4,this.id),this.storage.setItem(c4,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(u4,this._linked?"1":"0")}}function BH(){try{return window.frameElement!==null}catch{return!1}}function $H(){try{return BH()&&window.top?window.top.location:window.location}catch{return window.location}}function FH(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function f4(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const jH='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function l4(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(jH)),document.documentElement.appendChild(t)}function h4(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e2&&(o.children=arguments.length>3?y0.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return w0(t,o,n,i,null)}function w0(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++d4,__i:-1,__u:0};return i==null&&Vr.vnode!=null&&Vr.vnode(s),s}function Hl(t){return t.children}function x0(t,e){this.props=t,this.context=e}function Ou(t,e){if(e==null)return t.__?Ou(t.__,t.__i+1):null;for(var r;ee&&wc.sort(tv));_0.__r=0}function w4(t,e,r,n,i,s,o,a,u,l,d){var p,y,_,M,O,L,B=n&&n.__k||v4,k=e.length;for(u=qH(r,e,B,u),p=0;p0?w0(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,(u=s.__i=zH(s,r,a,p))!==-1&&(p--,(o=r[u])&&(o.__u|=2)),o==null||o.__v===null?(u==-1&&y--,typeof s.type!="function"&&(s.__u|=4)):u!==a&&(u==a-1?y--:u==a+1?y++:(u>a?y--:y++,s.__u|=4))):s=t.__k[i]=null;if(p)for(i=0;i(u!=null&&!(2&u.__u)?1:0))for(;o>=0||a=0){if((u=e[o])&&!(2&u.__u)&&i==u.key&&s===u.type)return o;o--}if(a=r.__.length&&r.__.push({}),r.__[t]}function L4(t){return lv=1,KH(B4,t)}function KH(t,e,r){var n=N4(S0++,2);if(n.t=t,!n.__c&&(n.__=[B4(void 0,e),function(a){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,a);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=cn,!cn.u)){var i=function(a,u,l){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(y){return!!y.__c});if(d.every(function(y){return!y.__N}))return!s||s.call(this,a,u,l);var p=n.__c.props!==a;return d.forEach(function(y){if(y.__N){var _=y.__[0];y.__=y.__N,y.__N=void 0,_!==y.__[0]&&(p=!0)}}),s&&s.call(this,a,u,l)||p};cn.u=!0;var s=cn.shouldComponentUpdate,o=cn.componentWillUpdate;cn.componentWillUpdate=function(a,u,l){if(this.__e){var d=s;s=void 0,i(a,u,l),s=d}o&&o.call(this,a,u,l)},cn.shouldComponentUpdate=i}return n.__N||n.__}function VH(t,e){var r=N4(S0++,3);!yn.__s&&JH(r.__H,e)&&(r.__=t,r.i=e,cn.__H.__h.push(r))}function GH(){for(var t;t=M4.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(A0),t.__H.__h.forEach(hv),t.__H.__h=[]}catch(e){t.__H.__h=[],yn.__e(e,t.__v)}}yn.__b=function(t){cn=null,I4&&I4(t)},yn.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),O4&&O4(t,e)},yn.__r=function(t){C4&&C4(t),S0=0;var e=(cn=t.__c).__H;e&&(fv===cn?(e.__h=[],cn.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(A0),e.__h.forEach(hv),e.__h=[],S0=0)),fv=cn},yn.diffed=function(t){T4&&T4(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(M4.push(e)!==1&&P4===yn.requestAnimationFrame||((P4=yn.requestAnimationFrame)||YH)(GH)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),fv=cn=null},yn.__c=function(t,e){e.some(function(r){try{r.__h.forEach(A0),r.__h=r.__h.filter(function(n){return!n.__||hv(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],yn.__e(n,r.__v)}}),R4&&R4(t,e)},yn.unmount=function(t){D4&&D4(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{A0(n)}catch(i){e=i}}),r.__H=void 0,e&&yn.__e(e,r.__v))};var k4=typeof requestAnimationFrame=="function";function YH(t){var e,r=function(){clearTimeout(n),k4&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);k4&&(e=requestAnimationFrame(r))}function A0(t){var e=cn,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),cn=e}function hv(t){var e=cn;t.__c=t.__(),cn=e}function JH(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function B4(t,e){return typeof e=="function"?e(t):e}const XH=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",ZH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",QH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class eW{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=f4()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const r=this.nextItemKey++;return this.items.set(r,e),this.render(),()=>{this.items.delete(r),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&uv(Or("div",null,Or($4,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,r])=>Or(tW,Object.assign({},r,{key:e}))))),this.root)}}const $4=t=>Or("div",{class:ql("-cbwsdk-snackbar-container")},Or("style",null,XH),Or("div",{class:"-cbwsdk-snackbar"},t.children)),tW=({autoExpand:t,message:e,menuItems:r})=>{const[n,i]=L4(!0),[s,o]=L4(t??!1);VH(()=>{const u=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{u.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return Or("div",{class:ql("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},Or("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},Or("img",{src:ZH,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",Or("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),Or("div",{class:"-gear-container"},!s&&Or("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),Or("img",{src:QH,class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&Or("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((u,l)=>Or("div",{class:ql("-cbwsdk-snackbar-instance-menu-item",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:u.onClick,key:l},Or("svg",{width:u.svgWidth,height:u.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("path",{"fill-rule":u.defaultFillRule,"clip-rule":u.defaultClipRule,d:u.path,fill:"#AAAAAA"})),Or("span",{class:ql("-cbwsdk-snackbar-instance-menu-item-info",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},u.info)))))};class rW{constructor(){this.attached=!1,this.snackbar=new eW}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.snackbar.attach(r),this.attached=!0,l4()}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}}const nW=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class iW{constructor(){this.root=null,this.darkMode=f4()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),l4()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(uv(null,this.root),e&&uv(Or(sW,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const sW=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return Or($4,{darkMode:r},Or("div",{class:"-cbwsdk-redirect-dialog"},Or("style",null,nW),Or("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),Or("div",{class:ql("-cbwsdk-redirect-dialog-box",s)},Or("p",null,t),Or("button",{onClick:n},e))))},oW="https://keys.coinbase.com/connect",F4="https://www.walletlink.org",aW="https://go.cb-w.com/walletlink";class j4{constructor(){this.attached=!1,this.redirectDialog=new iW}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const r=new URL(aW);r.searchParams.append("redirect_url",$H().href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class Ro{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=FH(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(ev);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!u&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),Ro.accountRequestCallbackIds.size>0&&(Array.from(Ro.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),Ro.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new kH,this.ui=n,this.ui.attach()}subscribe(){const e=Du.load(this.storage)||Du.create(this.storage),{linkAPIUrl:r}=this,n=new LH({session:e,linkAPIUrl:r,listener:this}),i=this.isMobileWeb?new j4:new rW;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=Du.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Qs.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:eo(e.weiValue),data:Bl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?eo(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?eo(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?eo(e.gasPriceInWei):null,gasLimit:e.gasLimit?eo(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:eo(e.weiValue),data:Bl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?eo(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?eo(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?eo(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?eo(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Bl(e,!0),chainId:r}})}getWalletLinkSession(){return this._session}sendRequest(e){let r=null;const n=bc(8),i=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,s),r==null||r()};return new Promise((s,o)=>{r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,a=>{if(r==null||r(),Un(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,r){const n={type:"WEB3_REQUEST",id:e,request:r};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:r.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(r.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof j4)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e,r){if(r.method==="requestEthereumAccounts"){Ro.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,r)),Ro.accountRequestCallbackIds.clear();return}this.invokeCallback(e,r)}handleErrorResponse(e,r,n){var i;const s=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:r,errorMessage:s})}invokeCallback(e,r){const n=this.relayEventManager.callbacks.get(e);n&&(n(r),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:r}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:r}},i=bc(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(Un(a))return o(new Error(a.errorMessage));s(a)}),Ro.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,r,n,i,s,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:o}};let u=null;const l=bc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,_=>{if(u==null||u(),Un(_))return y(new Error(_.errorMessage));p(_)}),this.publishWeb3RequestEvent(l,a)})}addEthereumChain(e,r,n,i,s,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:o}};let u=null;const l=bc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,_=>{if(u==null||u(),Un(_))return y(new Error(_.errorMessage));p(_)}),this.publishWeb3RequestEvent(l,a)})}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})};let i=null;const s=bc(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,u)=>{this.relayEventManager.callbacks.set(s,l=>{if(i==null||i(),Un(l)&&l.errorCode)return u(Ar.provider.custom({code:l.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(Un(l))return u(new Error(l.errorMessage));a(l)}),this.publishWeb3RequestEvent(s,n)})}}Ro.accountRequestCallbackIds=new Set;const U4="DefaultChainId",q4="DefaultJsonRpcUrl";class z4{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new Qs("walletlink",F4),this.callback=e.callback||null;const r=this._storage.getItem(ev);if(r){const n=r.split(" ");n[0]!==""&&(this._addresses=n.map(i=>ya(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:r,secret:n}=e.getWalletLinkSession();return{id:r,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(q4))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(q4,e)}updateProviderInfo(e,r){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(U4,r.toString(10)),$l(r)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",ba(r)))}async watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw Ar.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw Ar.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw Ar.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw Ar.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=r.options,l=await this.initializeRelay().watchAsset(r.type,i,s,a,o,n==null?void 0:n.toString());return Un(l)?!1:!!l.result}async addEthereumChain(e){var r,n;const i=e[0];if(((r=i.rpcUrls)===null||r===void 0?void 0:r.length)===0)throw Ar.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw Ar.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw Ar.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:u=[],chainName:l,iconUrls:d=[],nativeCurrency:p}=i,y=await o.addEthereumChain(s.toString(),a,d,u,l,p);if(Un(y))return!1;if(((n=y.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw Ar.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const r=e[0],n=Number.parseInt(r.chainId,16),s=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(Un(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,r){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(s=>ya(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(ev,i.join(" ")))}async request(e){const r=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return ba(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(r);case"wallet_switchEthereumChain":return this.switchEthereumChain(r);case"wallet_watchAsset":return this.watchAsset(r);default:if(!this.jsonRpcUrl)throw Ar.rpc.internal("No RPC URL set for chain");return H5(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const r=ya(e);if(!this._addresses.map(i=>ya(i)).includes(r))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?ya(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?ya(e.to):null,i=e.value!=null?Fl(e.value):BigInt(0),s=e.data?Y1(e.data):Buffer.alloc(0),o=e.nonce!=null?$l(e.nonce):null,a=e.gasPrice!=null?Fl(e.gasPrice):null,u=e.maxFeePerGas!=null?Fl(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?Fl(e.maxPriorityFeePerGas):null,d=e.gas!=null?Fl(e.gas):null,p=e.chainId?$l(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:u,maxPriorityFeePerGas:l,gasLimit:d,chainId:p}}async ecRecover(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Ar.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:K1(n[0]),signature:K1(n[1]),addPrefix:r==="personal_ecRecover"}});if(Un(s))throw s;return s.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(U4))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,r;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:ba(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(Un(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:ba(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw Ar.rpc.invalidParams();const r=e[1],n=e[0];this._ensureKnownAddress(r);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ya(r),message:K1(n),addPrefix:!0,typedDataJson:null}});if(Un(s))throw s;return s.result}async _eth_signTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(r);if(Un(i))throw i;return i.result}async _eth_sendRawTransaction(e){const r=Y1(e[0]),i=await this.initializeRelay().submitEthereumTransaction(r,this.getChainId());if(Un(i))throw i;return i.result}async _eth_sendTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(r);if(Un(i))throw i;return i.result}async signTypedData(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Ar.rpc.invalidParams();const i=l=>{const d={eth_signTypedData_v1:b0.hashForSignTypedDataLegacy,eth_signTypedData_v3:b0.hashForSignTypedData_v3,eth_signTypedData_v4:b0.hashForSignTypedData_v4,eth_signTypedData:b0.hashForSignTypedData_v4};return Bl(d[r]({data:eH(l)}),!0)},s=n[r==="eth_signTypedData_v1"?1:0],o=n[r==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const u=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ya(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(Un(u))throw u;return u.result}initializeRelay(){return this._relay||(this._relay=new Ro({linkAPIUrl:F4,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const H4="SignerType",W4=new Qs("CBWSDK","SignerConfigurator");function cW(){return W4.getItem(H4)}function uW(t){W4.setItem(H4,t)}async function fW(t){const{communicator:e,metadata:r,handshakeRequest:n,callback:i}=t;hW(e,r,i).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:o}=await e.postRequestAndWaitForResponse(s);return o}function lW(t){const{signerType:e,metadata:r,communicator:n,callback:i}=t;switch(e){case"scw":return new dH({metadata:r,callback:i,communicator:n});case"walletlink":return new z4({metadata:r,callback:i})}}async function hW(t,e,r){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new z4({metadata:e,callback:r});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const dW=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. -Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,dW=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,r=await fetch(e,{method:"HEAD"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const n=r.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(hW)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:pW,getCrossOriginOpenerPolicy:gW}=dW(),K4=420,V4=540;function mW(t){const e=(window.innerWidth-K4)/2+window.screenX,r=(window.innerHeight-V4)/2+window.screenY;bW(t);const n=window.open(t,"Smart Wallet",`width=${K4}, height=${V4}, left=${e}, top=${r}`);if(n==null||n.focus(),!n)throw Ar.rpc.internal("Pop up window failed to open");return n}function vW(t){t&&!t.closed&&t.close()}function bW(t){const e={sdkName:z5,sdkVersion:jl,origin:window.location.origin,coop:gW()};for(const[r,n]of Object.entries(e))t.searchParams.append(r,n.toString())}class yW{constructor({url:e=sW,metadata:r,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=u=>{if(u.origin!==this.url.origin)return;const l=u.data;i(l)&&(s(l),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{vW(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(Ar.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=mW(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:jl,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw Ar.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=r,this.preference=n}}function wW(t){const e=Gz(xW(t),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",jl),r.searchParams.set("code",e.code.toString()),r.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:r.href})}function xW(t){var e;if(typeof t=="string")return{message:t,code:an.rpc.internal};if(Un(t)){const r=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:r.match(/(denied|rejected)/i)?an.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:r,code:n,data:{method:t.method}})}return t}var G4={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,l,d){this.fn=u,this.context=l,this.once=d||!1}function s(u,l,d,p,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var _=new i(d,p||u,y),M=r?r+l:l;return u._events[M]?u._events[M].fn?u._events[M]=[u._events[M],_]:u._events[M].push(_):(u._events[M]=_,u._eventsCount++),u}function o(u,l){--u._eventsCount===0?u._events=new n:delete u._events[l]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,p;if(this._eventsCount===0)return l;for(p in d=this._events)e.call(d,p)&&l.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=r?r+l:l,p=this._events[d];if(!p)return[];if(p.fn)return[p.fn];for(var y=0,_=p.length,M=new Array(_);y<_;y++)M[y]=p[y].fn;return M},a.prototype.listenerCount=function(l){var d=r?r+l:l,p=this._events[d];return p?p.fn?1:p.length:0},a.prototype.emit=function(l,d,p,y,_,M){var O=r?r+l:l;if(!this._events[O])return!1;var L=this._events[O],B=arguments.length,k,H;if(L.fn){switch(L.once&&this.removeListener(l,L.fn,void 0,!0),B){case 1:return L.fn.call(L.context),!0;case 2:return L.fn.call(L.context,d),!0;case 3:return L.fn.call(L.context,d,p),!0;case 4:return L.fn.call(L.context,d,p,y),!0;case 5:return L.fn.call(L.context,d,p,y,_),!0;case 6:return L.fn.call(L.context,d,p,y,_,M),!0}for(H=1,k=new Array(B-1);H(i||(i=IW(n)),i)}}function Y4(t,e){return function(){return t.apply(e,arguments)}}const{toString:RW}=Object.prototype,{getPrototypeOf:dv}=Object,P0=(t=>e=>{const r=RW.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Ps=t=>(t=t.toLowerCase(),e=>P0(e)===t),M0=t=>e=>typeof e===t,{isArray:Nu}=Array,Wl=M0("undefined");function DW(t){return t!==null&&!Wl(t)&&t.constructor!==null&&!Wl(t.constructor)&&Oi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const J4=Ps("ArrayBuffer");function OW(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&J4(t.buffer),e}const NW=M0("string"),Oi=M0("function"),X4=M0("number"),I0=t=>t!==null&&typeof t=="object",LW=t=>t===!0||t===!1,C0=t=>{if(P0(t)!=="object")return!1;const e=dv(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},kW=Ps("Date"),BW=Ps("File"),$W=Ps("Blob"),FW=Ps("FileList"),jW=t=>I0(t)&&Oi(t.pipe),UW=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Oi(t.append)&&((e=P0(t))==="formdata"||e==="object"&&Oi(t.toString)&&t.toString()==="[object FormData]"))},qW=Ps("URLSearchParams"),[zW,HW,WW,KW]=["ReadableStream","Request","Response","Headers"].map(Ps),VW=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Kl(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Nu(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const wc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Q4=t=>!Wl(t)&&t!==wc;function pv(){const{caseless:t}=Q4(this)&&this||{},e={},r=(n,i)=>{const s=t&&Z4(e,i)||i;C0(e[s])&&C0(n)?e[s]=pv(e[s],n):C0(n)?e[s]=pv({},n):Nu(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(Kl(e,(i,s)=>{r&&Oi(i)?t[s]=Y4(i,r):t[s]=i},{allOwnKeys:n}),t),YW=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),JW=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},XW=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&dv(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},ZW=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},QW=t=>{if(!t)return null;if(Nu(t))return t;let e=t.length;if(!X4(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},eK=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&dv(Uint8Array)),tK=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},rK=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},nK=Ps("HTMLFormElement"),iK=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),e8=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),sK=Ps("RegExp"),t8=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};Kl(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},oK=t=>{t8(t,(e,r)=>{if(Oi(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Oi(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},aK=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Nu(t)?n(t):n(String(t).split(e)),r},cK=()=>{},uK=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,gv="abcdefghijklmnopqrstuvwxyz",r8="0123456789",n8={DIGIT:r8,ALPHA:gv,ALPHA_DIGIT:gv+gv.toUpperCase()+r8},fK=(t=16,e=n8.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function lK(t){return!!(t&&Oi(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const hK=t=>{const e=new Array(10),r=(n,i)=>{if(I0(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Nu(n)?[]:{};return Kl(n,(o,a)=>{const u=r(o,i+1);!Wl(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},dK=Ps("AsyncFunction"),pK=t=>t&&(I0(t)||Oi(t))&&Oi(t.then)&&Oi(t.catch),i8=((t,e)=>t?setImmediate:e?((r,n)=>(wc.addEventListener("message",({source:i,data:s})=>{i===wc&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),wc.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Oi(wc.postMessage)),gK=typeof queueMicrotask<"u"?queueMicrotask.bind(wc):typeof process<"u"&&process.nextTick||i8,Oe={isArray:Nu,isArrayBuffer:J4,isBuffer:DW,isFormData:UW,isArrayBufferView:OW,isString:NW,isNumber:X4,isBoolean:LW,isObject:I0,isPlainObject:C0,isReadableStream:zW,isRequest:HW,isResponse:WW,isHeaders:KW,isUndefined:Wl,isDate:kW,isFile:BW,isBlob:$W,isRegExp:sK,isFunction:Oi,isStream:jW,isURLSearchParams:qW,isTypedArray:eK,isFileList:FW,forEach:Kl,merge:pv,extend:GW,trim:VW,stripBOM:YW,inherits:JW,toFlatObject:XW,kindOf:P0,kindOfTest:Ps,endsWith:ZW,toArray:QW,forEachEntry:tK,matchAll:rK,isHTMLForm:nK,hasOwnProperty:e8,hasOwnProp:e8,reduceDescriptors:t8,freezeMethods:oK,toObjectSet:aK,toCamelCase:iK,noop:cK,toFiniteNumber:uK,findKey:Z4,global:wc,isContextDefined:Q4,ALPHABET:n8,generateString:fK,isSpecCompliantForm:lK,toJSONObject:hK,isAsyncFn:dK,isThenable:pK,setImmediate:i8,asap:gK};function ar(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Oe.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const s8=ar.prototype,o8={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{o8[t]={value:t}}),Object.defineProperties(ar,o8),Object.defineProperty(s8,"isAxiosError",{value:!0}),ar.from=(t,e,r,n,i,s)=>{const o=Object.create(s8);return Oe.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),ar.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const mK=null;function mv(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function a8(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function c8(t,e,r){return t?t.concat(e).map(function(i,s){return i=a8(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function vK(t){return Oe.isArray(t)&&!t.some(mv)}const bK=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function T0(t,e,r){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Oe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(O,L){return!Oe.isUndefined(L[O])});const n=r.metaTokens,i=r.visitor||d,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(i))throw new TypeError("visitor must be a function");function l(M){if(M===null)return"";if(Oe.isDate(M))return M.toISOString();if(!u&&Oe.isBlob(M))throw new ar("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(M)||Oe.isTypedArray(M)?u&&typeof Blob=="function"?new Blob([M]):Buffer.from(M):M}function d(M,O,L){let B=M;if(M&&!L&&typeof M=="object"){if(Oe.endsWith(O,"{}"))O=n?O:O.slice(0,-2),M=JSON.stringify(M);else if(Oe.isArray(M)&&vK(M)||(Oe.isFileList(M)||Oe.endsWith(O,"[]"))&&(B=Oe.toArray(M)))return O=a8(O),B.forEach(function(H,U){!(Oe.isUndefined(H)||H===null)&&e.append(o===!0?c8([O],U,s):o===null?O:O+"[]",l(H))}),!1}return mv(M)?!0:(e.append(c8(L,O,s),l(M)),!1)}const p=[],y=Object.assign(bK,{defaultVisitor:d,convertValue:l,isVisitable:mv});function _(M,O){if(!Oe.isUndefined(M)){if(p.indexOf(M)!==-1)throw Error("Circular reference detected in "+O.join("."));p.push(M),Oe.forEach(M,function(B,k){(!(Oe.isUndefined(B)||B===null)&&i.call(e,B,Oe.isString(k)?k.trim():k,O,y))===!0&&_(B,O?O.concat(k):[k])}),p.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return _(t),e}function u8(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function vv(t,e){this._pairs=[],t&&T0(t,this,e)}const f8=vv.prototype;f8.append=function(e,r){this._pairs.push([e,r])},f8.toString=function(e){const r=e?function(n){return e.call(this,n,u8)}:u8;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function yK(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function l8(t,e,r){if(!e)return t;const n=r&&r.encode||yK;Oe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(e,r):s=Oe.isURLSearchParams(e)?e.toString():new vv(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class h8{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(n){n!==null&&e(n)})}}const d8={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},wK={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:vv,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},bv=typeof window<"u"&&typeof document<"u",yv=typeof navigator=="object"&&navigator||void 0,xK=bv&&(!yv||["ReactNative","NativeScript","NS"].indexOf(yv.product)<0),_K=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",EK=bv&&window.location.href||"http://localhost",Yn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:bv,hasStandardBrowserEnv:xK,hasStandardBrowserWebWorkerEnv:_K,navigator:yv,origin:EK},Symbol.toStringTag,{value:"Module"})),...wK};function SK(t,e){return T0(t,new Yn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Yn.isNode&&Oe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function AK(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function PK(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&Oe.isArray(i)?i.length:o,u?(Oe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Oe.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Oe.isArray(i[o])&&(i[o]=PK(i[o])),!a)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const r={};return Oe.forEachEntry(t,(n,i)=>{e(AK(n),i,r,0)}),r}return null}function MK(t,e,r){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const Vl={transitional:d8,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Oe.isObject(e);if(s&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return i?JSON.stringify(p8(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return SK(e,this.formSerializer).toString();if((a=Oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return T0(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),MK(e)):e}],transformResponse:[function(e){const r=this.transitional||Vl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ar.from(a,ar.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Yn.classes.FormData,Blob:Yn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{Vl.headers[t]={}});const IK=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),CK=t=>{const e={};let r,n,i;return t&&t.split(` -`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&IK[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},g8=Symbol("internals");function Gl(t){return t&&String(t).trim().toLowerCase()}function R0(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(R0):String(t)}function TK(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const RK=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function wv(t,e,r,n,i){if(Oe.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Oe.isString(e)){if(Oe.isString(n))return e.indexOf(n)!==-1;if(Oe.isRegExp(n))return n.test(e)}}function DK(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function OK(t,e){const r=Oe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}let yi=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,u,l){const d=Gl(u);if(!d)throw new Error("header name must be a non-empty string");const p=Oe.findKey(i,d);(!p||i[p]===void 0||l===!0||l===void 0&&i[p]!==!1)&&(i[p||u]=R0(a))}const o=(a,u)=>Oe.forEach(a,(l,d)=>s(l,d,u));if(Oe.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(Oe.isString(e)&&(e=e.trim())&&!RK(e))o(CK(e),r);else if(Oe.isHeaders(e))for(const[a,u]of e.entries())s(u,a,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=Gl(e),e){const n=Oe.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return TK(i);if(Oe.isFunction(r))return r.call(this,i,n);if(Oe.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Gl(e),e){const n=Oe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||wv(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=Gl(o),o){const a=Oe.findKey(n,o);a&&(!r||wv(n,n[a],a,r))&&(delete n[a],i=!0)}}return Oe.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||wv(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Oe.forEach(this,(i,s)=>{const o=Oe.findKey(n,s);if(o){r[o]=R0(i),delete r[s];return}const a=e?DK(s):String(s).trim();a!==s&&delete r[s],r[a]=R0(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Oe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Oe.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[g8]=this[g8]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Gl(o);n[a]||(OK(i,o),n[a]=!0)}return Oe.isArray(e)?e.forEach(s):s(e),this}};yi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Oe.reduceDescriptors(yi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),Oe.freezeMethods(yi);function xv(t,e){const r=this||Vl,n=e||r,i=yi.from(n.headers);let s=n.data;return Oe.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function m8(t){return!!(t&&t.__CANCEL__)}function Lu(t,e,r){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,r),this.name="CanceledError"}Oe.inherits(Lu,ar,{__CANCEL__:!0});function v8(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new ar("Request failed with status code "+r.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function NK(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function LK(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),d=n[s];o||(o=l),r[i]=u,n[i]=l;let p=s,y=0;for(;p!==i;)y+=r[p++],p=p%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),l-o{r=d,i=null,s&&(clearTimeout(s),s=null),t.apply(null,l)};return[(...l)=>{const d=Date.now(),p=d-r;p>=n?o(l,d):(i=l,s||(s=setTimeout(()=>{s=null,o(i)},n-p)))},()=>i&&o(i)]}const D0=(t,e,r=3)=>{let n=0;const i=LK(50,250);return kK(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,u=o-n,l=i(u),d=o<=a;n=o;const p={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:l||void 0,estimated:l&&a&&d?(a-o)/l:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(p)},r)},b8=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},y8=t=>(...e)=>Oe.asap(()=>t(...e)),BK=Yn.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Yn.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Yn.origin),Yn.navigator&&/(msie|trident)/i.test(Yn.navigator.userAgent)):()=>!0,$K=Yn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];Oe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Oe.isString(n)&&o.push("path="+n),Oe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function FK(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function jK(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function w8(t,e){return t&&!FK(e)?jK(t,e):e}const x8=t=>t instanceof yi?{...t}:t;function xc(t,e){e=e||{};const r={};function n(l,d,p,y){return Oe.isPlainObject(l)&&Oe.isPlainObject(d)?Oe.merge.call({caseless:y},l,d):Oe.isPlainObject(d)?Oe.merge({},d):Oe.isArray(d)?d.slice():d}function i(l,d,p,y){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l,p,y)}else return n(l,d,p,y)}function s(l,d){if(!Oe.isUndefined(d))return n(void 0,d)}function o(l,d){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l)}else return n(void 0,d)}function a(l,d,p){if(p in e)return n(l,d);if(p in t)return n(void 0,l)}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,d,p)=>i(x8(l),x8(d),p,!0)};return Oe.forEach(Object.keys(Object.assign({},t,e)),function(d){const p=u[d]||i,y=p(t[d],e[d],d);Oe.isUndefined(y)&&p!==a||(r[d]=y)}),r}const _8=t=>{const e=xc({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=yi.from(o),e.url=l8(w8(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(Oe.isFormData(r)){if(Yn.hasStandardBrowserEnv||Yn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[l,...d]=u?u.split(";").map(p=>p.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...d].join("; "))}}if(Yn.hasStandardBrowserEnv&&(n&&Oe.isFunction(n)&&(n=n(e)),n||n!==!1&&BK(e.url))){const l=i&&s&&$K.read(s);l&&o.set(i,l)}return e},UK=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=_8(t);let s=i.data;const o=yi.from(i.headers).normalize();let{responseType:a,onUploadProgress:u,onDownloadProgress:l}=i,d,p,y,_,M;function O(){_&&_(),M&&M(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let L=new XMLHttpRequest;L.open(i.method.toUpperCase(),i.url,!0),L.timeout=i.timeout;function B(){if(!L)return;const H=yi.from("getAllResponseHeaders"in L&&L.getAllResponseHeaders()),z={data:!a||a==="text"||a==="json"?L.responseText:L.response,status:L.status,statusText:L.statusText,headers:H,config:t,request:L};v8(function(R){r(R),O()},function(R){n(R),O()},z),L=null}"onloadend"in L?L.onloadend=B:L.onreadystatechange=function(){!L||L.readyState!==4||L.status===0&&!(L.responseURL&&L.responseURL.indexOf("file:")===0)||setTimeout(B)},L.onabort=function(){L&&(n(new ar("Request aborted",ar.ECONNABORTED,t,L)),L=null)},L.onerror=function(){n(new ar("Network Error",ar.ERR_NETWORK,t,L)),L=null},L.ontimeout=function(){let U=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const z=i.transitional||d8;i.timeoutErrorMessage&&(U=i.timeoutErrorMessage),n(new ar(U,z.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,L)),L=null},s===void 0&&o.setContentType(null),"setRequestHeader"in L&&Oe.forEach(o.toJSON(),function(U,z){L.setRequestHeader(z,U)}),Oe.isUndefined(i.withCredentials)||(L.withCredentials=!!i.withCredentials),a&&a!=="json"&&(L.responseType=i.responseType),l&&([y,M]=D0(l,!0),L.addEventListener("progress",y)),u&&L.upload&&([p,_]=D0(u),L.upload.addEventListener("progress",p),L.upload.addEventListener("loadend",_)),(i.cancelToken||i.signal)&&(d=H=>{L&&(n(!H||H.type?new Lu(null,t,L):H),L.abort(),L=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const k=NK(i.url);if(k&&Yn.protocols.indexOf(k)===-1){n(new ar("Unsupported protocol "+k+":",ar.ERR_BAD_REQUEST,t));return}L.send(s||null)})},qK=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i;const s=function(l){if(!i){i=!0,a();const d=l instanceof Error?l:this.reason;n.abort(d instanceof ar?d:new Lu(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,s(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),t=null)};t.forEach(l=>l.addEventListener("abort",s));const{signal:u}=n;return u.unsubscribe=()=>Oe.asap(a),u}},zK=function*(t,e){let r=t.byteLength;if(r{const i=HK(t,e);let s=0,o,a=u=>{o||(o=!0,n&&n(u))};return new ReadableStream({async pull(u){try{const{done:l,value:d}=await i.next();if(l){a(),u.close();return}let p=d.byteLength;if(r){let y=s+=p;r(y)}u.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(u){return a(u),i.return()}},{highWaterMark:2})},O0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",S8=O0&&typeof ReadableStream=="function",KK=O0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),A8=(t,...e)=>{try{return!!t(...e)}catch{return!1}},VK=S8&&A8(()=>{let t=!1;const e=new Request(Yn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),P8=64*1024,_v=S8&&A8(()=>Oe.isReadableStream(new Response("").body)),N0={stream:_v&&(t=>t.body)};O0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!N0[e]&&(N0[e]=Oe.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,n)})})})(new Response);const GK=async t=>{if(t==null)return 0;if(Oe.isBlob(t))return t.size;if(Oe.isSpecCompliantForm(t))return(await new Request(Yn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(t)||Oe.isArrayBuffer(t))return t.byteLength;if(Oe.isURLSearchParams(t)&&(t=t+""),Oe.isString(t))return(await KK(t)).byteLength},YK=async(t,e)=>{const r=Oe.toFiniteNumber(t.getContentLength());return r??GK(e)},Ev={http:mK,xhr:UK,fetch:O0&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:l,headers:d,withCredentials:p="same-origin",fetchOptions:y}=_8(t);l=l?(l+"").toLowerCase():"text";let _=qK([i,s&&s.toAbortSignal()],o),M;const O=_&&_.unsubscribe&&(()=>{_.unsubscribe()});let L;try{if(u&&VK&&r!=="get"&&r!=="head"&&(L=await YK(d,n))!==0){let z=new Request(e,{method:"POST",body:n,duplex:"half"}),Z;if(Oe.isFormData(n)&&(Z=z.headers.get("content-type"))&&d.setContentType(Z),z.body){const[R,W]=b8(L,D0(y8(u)));n=E8(z.body,P8,R,W)}}Oe.isString(p)||(p=p?"include":"omit");const B="credentials"in Request.prototype;M=new Request(e,{...y,signal:_,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:B?p:void 0});let k=await fetch(M);const H=_v&&(l==="stream"||l==="response");if(_v&&(a||H&&O)){const z={};["status","statusText","headers"].forEach(ie=>{z[ie]=k[ie]});const Z=Oe.toFiniteNumber(k.headers.get("content-length")),[R,W]=a&&b8(Z,D0(y8(a),!0))||[];k=new Response(E8(k.body,P8,R,()=>{W&&W(),O&&O()}),z)}l=l||"text";let U=await N0[Oe.findKey(N0,l)||"text"](k,t);return!H&&O&&O(),await new Promise((z,Z)=>{v8(z,Z,{data:U,headers:yi.from(k.headers),status:k.status,statusText:k.statusText,config:t,request:M})})}catch(B){throw O&&O(),B&&B.name==="TypeError"&&/fetch/i.test(B.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,M),{cause:B.cause||B}):ar.from(B,B&&B.code,t,M)}})};Oe.forEach(Ev,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const M8=t=>`- ${t}`,JK=t=>Oe.isFunction(t)||t===null||t===!1,I8={getAdapter:t=>{t=Oe.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : +Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,pW=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,r=await fetch(e,{method:"HEAD"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const n=r.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(dW)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:gW,getCrossOriginOpenerPolicy:mW}=pW(),K4=420,V4=540;function vW(t){const e=(window.innerWidth-K4)/2+window.screenX,r=(window.innerHeight-V4)/2+window.screenY;yW(t);const n=window.open(t,"Smart Wallet",`width=${K4}, height=${V4}, left=${e}, top=${r}`);if(n==null||n.focus(),!n)throw Ar.rpc.internal("Pop up window failed to open");return n}function bW(t){t&&!t.closed&&t.close()}function yW(t){const e={sdkName:z5,sdkVersion:jl,origin:window.location.origin,coop:mW()};for(const[r,n]of Object.entries(e))t.searchParams.append(r,n.toString())}class wW{constructor({url:e=oW,metadata:r,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=u=>{if(u.origin!==this.url.origin)return;const l=u.data;i(l)&&(s(l),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{bW(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(Ar.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=vW(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:jl,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw Ar.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=r,this.preference=n}}function xW(t){const e=Yz(_W(t),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",jl),r.searchParams.set("code",e.code.toString()),r.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:r.href})}function _W(t){var e;if(typeof t=="string")return{message:t,code:an.rpc.internal};if(Un(t)){const r=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:r.match(/(denied|rejected)/i)?an.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:r,code:n,data:{method:t.method}})}return t}var G4={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,l,d){this.fn=u,this.context=l,this.once=d||!1}function s(u,l,d,p,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var _=new i(d,p||u,y),M=r?r+l:l;return u._events[M]?u._events[M].fn?u._events[M]=[u._events[M],_]:u._events[M].push(_):(u._events[M]=_,u._eventsCount++),u}function o(u,l){--u._eventsCount===0?u._events=new n:delete u._events[l]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,p;if(this._eventsCount===0)return l;for(p in d=this._events)e.call(d,p)&&l.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=r?r+l:l,p=this._events[d];if(!p)return[];if(p.fn)return[p.fn];for(var y=0,_=p.length,M=new Array(_);y<_;y++)M[y]=p[y].fn;return M},a.prototype.listenerCount=function(l){var d=r?r+l:l,p=this._events[d];return p?p.fn?1:p.length:0},a.prototype.emit=function(l,d,p,y,_,M){var O=r?r+l:l;if(!this._events[O])return!1;var L=this._events[O],B=arguments.length,k,H;if(L.fn){switch(L.once&&this.removeListener(l,L.fn,void 0,!0),B){case 1:return L.fn.call(L.context),!0;case 2:return L.fn.call(L.context,d),!0;case 3:return L.fn.call(L.context,d,p),!0;case 4:return L.fn.call(L.context,d,p,y),!0;case 5:return L.fn.call(L.context,d,p,y,_),!0;case 6:return L.fn.call(L.context,d,p,y,_,M),!0}for(H=1,k=new Array(B-1);H(i||(i=CW(n)),i)}}function Y4(t,e){return function(){return t.apply(e,arguments)}}const{toString:DW}=Object.prototype,{getPrototypeOf:dv}=Object,P0=(t=>e=>{const r=DW.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Ps=t=>(t=t.toLowerCase(),e=>P0(e)===t),M0=t=>e=>typeof e===t,{isArray:Nu}=Array,Wl=M0("undefined");function OW(t){return t!==null&&!Wl(t)&&t.constructor!==null&&!Wl(t.constructor)&&Oi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const J4=Ps("ArrayBuffer");function NW(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&J4(t.buffer),e}const LW=M0("string"),Oi=M0("function"),X4=M0("number"),I0=t=>t!==null&&typeof t=="object",kW=t=>t===!0||t===!1,C0=t=>{if(P0(t)!=="object")return!1;const e=dv(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},BW=Ps("Date"),$W=Ps("File"),FW=Ps("Blob"),jW=Ps("FileList"),UW=t=>I0(t)&&Oi(t.pipe),qW=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Oi(t.append)&&((e=P0(t))==="formdata"||e==="object"&&Oi(t.toString)&&t.toString()==="[object FormData]"))},zW=Ps("URLSearchParams"),[HW,WW,KW,VW]=["ReadableStream","Request","Response","Headers"].map(Ps),GW=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Kl(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Nu(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const xc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Q4=t=>!Wl(t)&&t!==xc;function pv(){const{caseless:t}=Q4(this)&&this||{},e={},r=(n,i)=>{const s=t&&Z4(e,i)||i;C0(e[s])&&C0(n)?e[s]=pv(e[s],n):C0(n)?e[s]=pv({},n):Nu(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(Kl(e,(i,s)=>{r&&Oi(i)?t[s]=Y4(i,r):t[s]=i},{allOwnKeys:n}),t),JW=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),XW=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},ZW=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&dv(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},QW=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},eK=t=>{if(!t)return null;if(Nu(t))return t;let e=t.length;if(!X4(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},tK=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&dv(Uint8Array)),rK=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},nK=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},iK=Ps("HTMLFormElement"),sK=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),e8=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),oK=Ps("RegExp"),t8=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};Kl(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},aK=t=>{t8(t,(e,r)=>{if(Oi(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Oi(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},cK=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Nu(t)?n(t):n(String(t).split(e)),r},uK=()=>{},fK=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,gv="abcdefghijklmnopqrstuvwxyz",r8="0123456789",n8={DIGIT:r8,ALPHA:gv,ALPHA_DIGIT:gv+gv.toUpperCase()+r8},lK=(t=16,e=n8.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function hK(t){return!!(t&&Oi(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const dK=t=>{const e=new Array(10),r=(n,i)=>{if(I0(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Nu(n)?[]:{};return Kl(n,(o,a)=>{const u=r(o,i+1);!Wl(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},pK=Ps("AsyncFunction"),gK=t=>t&&(I0(t)||Oi(t))&&Oi(t.then)&&Oi(t.catch),i8=((t,e)=>t?setImmediate:e?((r,n)=>(xc.addEventListener("message",({source:i,data:s})=>{i===xc&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),xc.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Oi(xc.postMessage)),mK=typeof queueMicrotask<"u"?queueMicrotask.bind(xc):typeof process<"u"&&process.nextTick||i8,Oe={isArray:Nu,isArrayBuffer:J4,isBuffer:OW,isFormData:qW,isArrayBufferView:NW,isString:LW,isNumber:X4,isBoolean:kW,isObject:I0,isPlainObject:C0,isReadableStream:HW,isRequest:WW,isResponse:KW,isHeaders:VW,isUndefined:Wl,isDate:BW,isFile:$W,isBlob:FW,isRegExp:oK,isFunction:Oi,isStream:UW,isURLSearchParams:zW,isTypedArray:tK,isFileList:jW,forEach:Kl,merge:pv,extend:YW,trim:GW,stripBOM:JW,inherits:XW,toFlatObject:ZW,kindOf:P0,kindOfTest:Ps,endsWith:QW,toArray:eK,forEachEntry:rK,matchAll:nK,isHTMLForm:iK,hasOwnProperty:e8,hasOwnProp:e8,reduceDescriptors:t8,freezeMethods:aK,toObjectSet:cK,toCamelCase:sK,noop:uK,toFiniteNumber:fK,findKey:Z4,global:xc,isContextDefined:Q4,ALPHABET:n8,generateString:lK,isSpecCompliantForm:hK,toJSONObject:dK,isAsyncFn:pK,isThenable:gK,setImmediate:i8,asap:mK};function ar(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Oe.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const s8=ar.prototype,o8={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{o8[t]={value:t}}),Object.defineProperties(ar,o8),Object.defineProperty(s8,"isAxiosError",{value:!0}),ar.from=(t,e,r,n,i,s)=>{const o=Object.create(s8);return Oe.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),ar.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const vK=null;function mv(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function a8(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function c8(t,e,r){return t?t.concat(e).map(function(i,s){return i=a8(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function bK(t){return Oe.isArray(t)&&!t.some(mv)}const yK=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function T0(t,e,r){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Oe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(O,L){return!Oe.isUndefined(L[O])});const n=r.metaTokens,i=r.visitor||d,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(i))throw new TypeError("visitor must be a function");function l(M){if(M===null)return"";if(Oe.isDate(M))return M.toISOString();if(!u&&Oe.isBlob(M))throw new ar("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(M)||Oe.isTypedArray(M)?u&&typeof Blob=="function"?new Blob([M]):Buffer.from(M):M}function d(M,O,L){let B=M;if(M&&!L&&typeof M=="object"){if(Oe.endsWith(O,"{}"))O=n?O:O.slice(0,-2),M=JSON.stringify(M);else if(Oe.isArray(M)&&bK(M)||(Oe.isFileList(M)||Oe.endsWith(O,"[]"))&&(B=Oe.toArray(M)))return O=a8(O),B.forEach(function(H,U){!(Oe.isUndefined(H)||H===null)&&e.append(o===!0?c8([O],U,s):o===null?O:O+"[]",l(H))}),!1}return mv(M)?!0:(e.append(c8(L,O,s),l(M)),!1)}const p=[],y=Object.assign(yK,{defaultVisitor:d,convertValue:l,isVisitable:mv});function _(M,O){if(!Oe.isUndefined(M)){if(p.indexOf(M)!==-1)throw Error("Circular reference detected in "+O.join("."));p.push(M),Oe.forEach(M,function(B,k){(!(Oe.isUndefined(B)||B===null)&&i.call(e,B,Oe.isString(k)?k.trim():k,O,y))===!0&&_(B,O?O.concat(k):[k])}),p.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return _(t),e}function u8(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function vv(t,e){this._pairs=[],t&&T0(t,this,e)}const f8=vv.prototype;f8.append=function(e,r){this._pairs.push([e,r])},f8.toString=function(e){const r=e?function(n){return e.call(this,n,u8)}:u8;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function wK(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function l8(t,e,r){if(!e)return t;const n=r&&r.encode||wK;Oe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(e,r):s=Oe.isURLSearchParams(e)?e.toString():new vv(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class h8{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(n){n!==null&&e(n)})}}const d8={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},xK={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:vv,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},bv=typeof window<"u"&&typeof document<"u",yv=typeof navigator=="object"&&navigator||void 0,_K=bv&&(!yv||["ReactNative","NativeScript","NS"].indexOf(yv.product)<0),EK=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",SK=bv&&window.location.href||"http://localhost",Yn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:bv,hasStandardBrowserEnv:_K,hasStandardBrowserWebWorkerEnv:EK,navigator:yv,origin:SK},Symbol.toStringTag,{value:"Module"})),...xK};function AK(t,e){return T0(t,new Yn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Yn.isNode&&Oe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function PK(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function MK(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&Oe.isArray(i)?i.length:o,u?(Oe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Oe.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Oe.isArray(i[o])&&(i[o]=MK(i[o])),!a)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const r={};return Oe.forEachEntry(t,(n,i)=>{e(PK(n),i,r,0)}),r}return null}function IK(t,e,r){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const Vl={transitional:d8,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Oe.isObject(e);if(s&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return i?JSON.stringify(p8(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return AK(e,this.formSerializer).toString();if((a=Oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return T0(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),IK(e)):e}],transformResponse:[function(e){const r=this.transitional||Vl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ar.from(a,ar.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Yn.classes.FormData,Blob:Yn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{Vl.headers[t]={}});const CK=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),TK=t=>{const e={};let r,n,i;return t&&t.split(` +`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&CK[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},g8=Symbol("internals");function Gl(t){return t&&String(t).trim().toLowerCase()}function R0(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(R0):String(t)}function RK(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const DK=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function wv(t,e,r,n,i){if(Oe.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Oe.isString(e)){if(Oe.isString(n))return e.indexOf(n)!==-1;if(Oe.isRegExp(n))return n.test(e)}}function OK(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function NK(t,e){const r=Oe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}let yi=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,u,l){const d=Gl(u);if(!d)throw new Error("header name must be a non-empty string");const p=Oe.findKey(i,d);(!p||i[p]===void 0||l===!0||l===void 0&&i[p]!==!1)&&(i[p||u]=R0(a))}const o=(a,u)=>Oe.forEach(a,(l,d)=>s(l,d,u));if(Oe.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(Oe.isString(e)&&(e=e.trim())&&!DK(e))o(TK(e),r);else if(Oe.isHeaders(e))for(const[a,u]of e.entries())s(u,a,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=Gl(e),e){const n=Oe.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return RK(i);if(Oe.isFunction(r))return r.call(this,i,n);if(Oe.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Gl(e),e){const n=Oe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||wv(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=Gl(o),o){const a=Oe.findKey(n,o);a&&(!r||wv(n,n[a],a,r))&&(delete n[a],i=!0)}}return Oe.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||wv(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Oe.forEach(this,(i,s)=>{const o=Oe.findKey(n,s);if(o){r[o]=R0(i),delete r[s];return}const a=e?OK(s):String(s).trim();a!==s&&delete r[s],r[a]=R0(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Oe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Oe.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[g8]=this[g8]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Gl(o);n[a]||(NK(i,o),n[a]=!0)}return Oe.isArray(e)?e.forEach(s):s(e),this}};yi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Oe.reduceDescriptors(yi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),Oe.freezeMethods(yi);function xv(t,e){const r=this||Vl,n=e||r,i=yi.from(n.headers);let s=n.data;return Oe.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function m8(t){return!!(t&&t.__CANCEL__)}function Lu(t,e,r){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,r),this.name="CanceledError"}Oe.inherits(Lu,ar,{__CANCEL__:!0});function v8(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new ar("Request failed with status code "+r.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function LK(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function kK(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),d=n[s];o||(o=l),r[i]=u,n[i]=l;let p=s,y=0;for(;p!==i;)y+=r[p++],p=p%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),l-o{r=d,i=null,s&&(clearTimeout(s),s=null),t.apply(null,l)};return[(...l)=>{const d=Date.now(),p=d-r;p>=n?o(l,d):(i=l,s||(s=setTimeout(()=>{s=null,o(i)},n-p)))},()=>i&&o(i)]}const D0=(t,e,r=3)=>{let n=0;const i=kK(50,250);return BK(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,u=o-n,l=i(u),d=o<=a;n=o;const p={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:l||void 0,estimated:l&&a&&d?(a-o)/l:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(p)},r)},b8=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},y8=t=>(...e)=>Oe.asap(()=>t(...e)),$K=Yn.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Yn.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Yn.origin),Yn.navigator&&/(msie|trident)/i.test(Yn.navigator.userAgent)):()=>!0,FK=Yn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];Oe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Oe.isString(n)&&o.push("path="+n),Oe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function jK(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function UK(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function w8(t,e){return t&&!jK(e)?UK(t,e):e}const x8=t=>t instanceof yi?{...t}:t;function _c(t,e){e=e||{};const r={};function n(l,d,p,y){return Oe.isPlainObject(l)&&Oe.isPlainObject(d)?Oe.merge.call({caseless:y},l,d):Oe.isPlainObject(d)?Oe.merge({},d):Oe.isArray(d)?d.slice():d}function i(l,d,p,y){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l,p,y)}else return n(l,d,p,y)}function s(l,d){if(!Oe.isUndefined(d))return n(void 0,d)}function o(l,d){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l)}else return n(void 0,d)}function a(l,d,p){if(p in e)return n(l,d);if(p in t)return n(void 0,l)}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,d,p)=>i(x8(l),x8(d),p,!0)};return Oe.forEach(Object.keys(Object.assign({},t,e)),function(d){const p=u[d]||i,y=p(t[d],e[d],d);Oe.isUndefined(y)&&p!==a||(r[d]=y)}),r}const _8=t=>{const e=_c({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=yi.from(o),e.url=l8(w8(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(Oe.isFormData(r)){if(Yn.hasStandardBrowserEnv||Yn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[l,...d]=u?u.split(";").map(p=>p.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...d].join("; "))}}if(Yn.hasStandardBrowserEnv&&(n&&Oe.isFunction(n)&&(n=n(e)),n||n!==!1&&$K(e.url))){const l=i&&s&&FK.read(s);l&&o.set(i,l)}return e},qK=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=_8(t);let s=i.data;const o=yi.from(i.headers).normalize();let{responseType:a,onUploadProgress:u,onDownloadProgress:l}=i,d,p,y,_,M;function O(){_&&_(),M&&M(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let L=new XMLHttpRequest;L.open(i.method.toUpperCase(),i.url,!0),L.timeout=i.timeout;function B(){if(!L)return;const H=yi.from("getAllResponseHeaders"in L&&L.getAllResponseHeaders()),z={data:!a||a==="text"||a==="json"?L.responseText:L.response,status:L.status,statusText:L.statusText,headers:H,config:t,request:L};v8(function(R){r(R),O()},function(R){n(R),O()},z),L=null}"onloadend"in L?L.onloadend=B:L.onreadystatechange=function(){!L||L.readyState!==4||L.status===0&&!(L.responseURL&&L.responseURL.indexOf("file:")===0)||setTimeout(B)},L.onabort=function(){L&&(n(new ar("Request aborted",ar.ECONNABORTED,t,L)),L=null)},L.onerror=function(){n(new ar("Network Error",ar.ERR_NETWORK,t,L)),L=null},L.ontimeout=function(){let U=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const z=i.transitional||d8;i.timeoutErrorMessage&&(U=i.timeoutErrorMessage),n(new ar(U,z.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,L)),L=null},s===void 0&&o.setContentType(null),"setRequestHeader"in L&&Oe.forEach(o.toJSON(),function(U,z){L.setRequestHeader(z,U)}),Oe.isUndefined(i.withCredentials)||(L.withCredentials=!!i.withCredentials),a&&a!=="json"&&(L.responseType=i.responseType),l&&([y,M]=D0(l,!0),L.addEventListener("progress",y)),u&&L.upload&&([p,_]=D0(u),L.upload.addEventListener("progress",p),L.upload.addEventListener("loadend",_)),(i.cancelToken||i.signal)&&(d=H=>{L&&(n(!H||H.type?new Lu(null,t,L):H),L.abort(),L=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const k=LK(i.url);if(k&&Yn.protocols.indexOf(k)===-1){n(new ar("Unsupported protocol "+k+":",ar.ERR_BAD_REQUEST,t));return}L.send(s||null)})},zK=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i;const s=function(l){if(!i){i=!0,a();const d=l instanceof Error?l:this.reason;n.abort(d instanceof ar?d:new Lu(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,s(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),t=null)};t.forEach(l=>l.addEventListener("abort",s));const{signal:u}=n;return u.unsubscribe=()=>Oe.asap(a),u}},HK=function*(t,e){let r=t.byteLength;if(r{const i=WK(t,e);let s=0,o,a=u=>{o||(o=!0,n&&n(u))};return new ReadableStream({async pull(u){try{const{done:l,value:d}=await i.next();if(l){a(),u.close();return}let p=d.byteLength;if(r){let y=s+=p;r(y)}u.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(u){return a(u),i.return()}},{highWaterMark:2})},O0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",S8=O0&&typeof ReadableStream=="function",VK=O0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),A8=(t,...e)=>{try{return!!t(...e)}catch{return!1}},GK=S8&&A8(()=>{let t=!1;const e=new Request(Yn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),P8=64*1024,_v=S8&&A8(()=>Oe.isReadableStream(new Response("").body)),N0={stream:_v&&(t=>t.body)};O0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!N0[e]&&(N0[e]=Oe.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,n)})})})(new Response);const YK=async t=>{if(t==null)return 0;if(Oe.isBlob(t))return t.size;if(Oe.isSpecCompliantForm(t))return(await new Request(Yn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(t)||Oe.isArrayBuffer(t))return t.byteLength;if(Oe.isURLSearchParams(t)&&(t=t+""),Oe.isString(t))return(await VK(t)).byteLength},JK=async(t,e)=>{const r=Oe.toFiniteNumber(t.getContentLength());return r??YK(e)},Ev={http:vK,xhr:qK,fetch:O0&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:l,headers:d,withCredentials:p="same-origin",fetchOptions:y}=_8(t);l=l?(l+"").toLowerCase():"text";let _=zK([i,s&&s.toAbortSignal()],o),M;const O=_&&_.unsubscribe&&(()=>{_.unsubscribe()});let L;try{if(u&&GK&&r!=="get"&&r!=="head"&&(L=await JK(d,n))!==0){let z=new Request(e,{method:"POST",body:n,duplex:"half"}),Z;if(Oe.isFormData(n)&&(Z=z.headers.get("content-type"))&&d.setContentType(Z),z.body){const[R,W]=b8(L,D0(y8(u)));n=E8(z.body,P8,R,W)}}Oe.isString(p)||(p=p?"include":"omit");const B="credentials"in Request.prototype;M=new Request(e,{...y,signal:_,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:B?p:void 0});let k=await fetch(M);const H=_v&&(l==="stream"||l==="response");if(_v&&(a||H&&O)){const z={};["status","statusText","headers"].forEach(ie=>{z[ie]=k[ie]});const Z=Oe.toFiniteNumber(k.headers.get("content-length")),[R,W]=a&&b8(Z,D0(y8(a),!0))||[];k=new Response(E8(k.body,P8,R,()=>{W&&W(),O&&O()}),z)}l=l||"text";let U=await N0[Oe.findKey(N0,l)||"text"](k,t);return!H&&O&&O(),await new Promise((z,Z)=>{v8(z,Z,{data:U,headers:yi.from(k.headers),status:k.status,statusText:k.statusText,config:t,request:M})})}catch(B){throw O&&O(),B&&B.name==="TypeError"&&/fetch/i.test(B.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,M),{cause:B.cause||B}):ar.from(B,B&&B.code,t,M)}})};Oe.forEach(Ev,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const M8=t=>`- ${t}`,XK=t=>Oe.isFunction(t)||t===null||t===!1,I8={getAdapter:t=>{t=Oe.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : `+s.map(M8).join(` -`):" "+M8(s[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:Ev};function Sv(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Lu(null,t)}function C8(t){return Sv(t),t.headers=yi.from(t.headers),t.data=xv.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),I8.getAdapter(t.adapter||Vl.adapter)(t).then(function(n){return Sv(t),n.data=xv.call(t,t.transformResponse,n),n.headers=yi.from(n.headers),n},function(n){return m8(n)||(Sv(t),n&&n.response&&(n.response.data=xv.call(t,t.transformResponse,n.response),n.response.headers=yi.from(n.response.headers))),Promise.reject(n)})}const T8="1.7.8",L0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{L0[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const R8={};L0.transitional=function(e,r,n){function i(s,o){return"[Axios v"+T8+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new ar(i(o," has been removed"+(r?" in "+r:"")),ar.ERR_DEPRECATED);return r&&!R8[o]&&(R8[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}},L0.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function XK(t,e,r){if(typeof t!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new ar("option "+s+" must be "+u,ar.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ar("Unknown option "+s,ar.ERR_BAD_OPTION)}}const k0={assertOptions:XK,validators:L0},ro=k0.validators;let _c=class{constructor(e){this.defaults=e,this.interceptors={request:new h8,response:new h8}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` -`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=xc(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&k0.assertOptions(n,{silentJSONParsing:ro.transitional(ro.boolean),forcedJSONParsing:ro.transitional(ro.boolean),clarifyTimeoutError:ro.transitional(ro.boolean)},!1),i!=null&&(Oe.isFunction(i)?r.paramsSerializer={serialize:i}:k0.assertOptions(i,{encode:ro.function,serialize:ro.function},!0)),k0.assertOptions(r,{baseUrl:ro.spelling("baseURL"),withXsrfToken:ro.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Oe.merge(s.common,s[r.method]);s&&Oe.forEach(["delete","get","head","post","put","patch","common"],M=>{delete s[M]}),r.headers=yi.concat(o,s);const a=[];let u=!0;this.interceptors.request.forEach(function(O){typeof O.runWhen=="function"&&O.runWhen(r)===!1||(u=u&&O.synchronous,a.unshift(O.fulfilled,O.rejected))});const l=[];this.interceptors.response.forEach(function(O){l.push(O.fulfilled,O.rejected)});let d,p=0,y;if(!u){const M=[C8.bind(this),void 0];for(M.unshift.apply(M,a),M.push.apply(M,l),y=M.length,d=Promise.resolve(r);p{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new Lu(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new AP(function(i){e=i}),cancel:e}}};function QK(t){return function(r){return t.apply(null,r)}}function eV(t){return Oe.isObject(t)&&t.isAxiosError===!0}const Av={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Av).forEach(([t,e])=>{Av[e]=t});function D8(t){const e=new _c(t),r=Y4(_c.prototype.request,e);return Oe.extend(r,_c.prototype,e,{allOwnKeys:!0}),Oe.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return D8(xc(t,i))},r}const un=D8(Vl);un.Axios=_c,un.CanceledError=Lu,un.CancelToken=ZK,un.isCancel=m8,un.VERSION=T8,un.toFormData=T0,un.AxiosError=ar,un.Cancel=un.CanceledError,un.all=function(e){return Promise.all(e)},un.spread=QK,un.isAxiosError=eV,un.mergeConfig=xc,un.AxiosHeaders=yi,un.formToJSON=t=>p8(Oe.isHTMLForm(t)?new FormData(t):t),un.getAdapter=I8.getAdapter,un.HttpStatusCode=Av,un.default=un;const{Axios:vae,AxiosError:O8,CanceledError:bae,isCancel:yae,CancelToken:wae,VERSION:xae,all:_ae,Cancel:Eae,isAxiosError:Sae,spread:Aae,toFormData:Pae,AxiosHeaders:Mae,HttpStatusCode:Iae,formToJSON:Cae,getAdapter:Tae,mergeConfig:Rae}=un,N8=un.create({timeout:6e4,headers:{"Content-Type":"application/json",token:localStorage.getItem("auth")}});function tV(t){var e,r,n;if(((e=t.data)==null?void 0:e.success)!==!0){const i=new O8((r=t.data)==null?void 0:r.errorMessage,(n=t.data)==null?void 0:n.errorCode,t.config,t.request,t);return Promise.reject(i)}else return t}function rV(t){var r;console.log(t);const e=(r=t.response)==null?void 0:r.data;if(e){console.log(e,"responseData");const n=new O8(e.errorMessage,t.code,t.config,t.request,t.response);return Promise.reject(n)}else return Promise.reject(t)}N8.interceptors.response.use(tV,rV);class nV{constructor(e){Ns(this,"_apiBase","");this.request=e}setApiBase(e){this._apiBase=e||""}async getNonce(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/nonce`,e);return r.data}async getEmailCode(e,r){const{data:n}=await this.request.post(`${this._apiBase}/api/v2/user/get_code`,e,{headers:{"Captcha-Param":r}});return n.data}async emailLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async walletLogin(e){return e.account_enum==="C"?(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data:(await this.request.post(`${this._apiBase}/api/v2/business/login`,e)).data}async tonLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async bindEmail(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindTonWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindEvmWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}}const xa=new nV(N8),iV={projectId:"7a4434fefbcc9af474fb5c995e47d286",metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},L8=TW({appName:"codatta",appLogoUrl:"https://avatars.githubusercontent.com/u/171659315"}),k8=Ee.createContext({saveLastUsedWallet:()=>{},lastUsedWallet:null,wallets:[],initialized:!1,featuredWallets:[],chains:[]});function Yl(){return Ee.useContext(k8)}function sV(t){const{apiBaseUrl:e}=t,[r,n]=Ee.useState([]),[i,s]=Ee.useState([]),[o,a]=Ee.useState(null),[u,l]=Ee.useState(!1),[d,p]=Ee.useState([]),y=O=>{a(O);const B={provider:O.provider instanceof j1?"UniversalProvider":"EIP1193Provider",key:O.key,timestamp:Date.now()};localStorage.setItem("xn-last-used-info",JSON.stringify(B))};function _(O){const L=O.find(B=>{var k;return((k=B.config)==null?void 0:k.name)===t.singleWalletName});if(L)s([L]);else{const B=O.filter(U=>U.featured||U.installed),k=O.filter(U=>!U.featured&&!U.installed),H=[...B,...k];n(H),s(B)}}async function M(){const O=[],L=new Map;IP.forEach(k=>{const H=new ru(k);k.name==="Coinbase Wallet"&&H.EIP6963Detected({info:{name:"Coinbase Wallet",uuid:"coinbase",icon:k.image,rdns:"coinbase"},provider:L8.getProvider()}),L.set(H.key,H),O.push(H)}),(await Wz()).forEach(k=>{const H=L.get(k.info.name);if(H)H.EIP6963Detected(k);else{const U=new ru(k);L.set(U.key,U),O.push(U)}});try{const k=JSON.parse(localStorage.getItem("xn-last-used-info")||"{}"),H=L.get(k.key);if(H){if(H.lastUsed=!0,k.provider==="UniversalProvider"){const U=await j1.init(iV);U.session&&(H.setUniversalProvider(U),console.log("Restored UniversalProvider for wallet:",H.key))}else k.provider==="EIP1193Provider"&&H.installed&&console.log("Using detected EIP1193Provider for wallet:",H.key);a(H)}}catch(k){console.log(k)}t.chains&&p(t.chains),_(O),l(!0)}return Ee.useEffect(()=>{M(),xa.setApiBase(e)},[]),le.jsx(k8.Provider,{value:{saveLastUsedWallet:y,wallets:r,initialized:u,lastUsedWallet:o,featuredWallets:i,chains:d},children:t.children})}/** +`):" "+M8(s[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:Ev};function Sv(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Lu(null,t)}function C8(t){return Sv(t),t.headers=yi.from(t.headers),t.data=xv.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),I8.getAdapter(t.adapter||Vl.adapter)(t).then(function(n){return Sv(t),n.data=xv.call(t,t.transformResponse,n),n.headers=yi.from(n.headers),n},function(n){return m8(n)||(Sv(t),n&&n.response&&(n.response.data=xv.call(t,t.transformResponse,n.response),n.response.headers=yi.from(n.response.headers))),Promise.reject(n)})}const T8="1.7.8",L0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{L0[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const R8={};L0.transitional=function(e,r,n){function i(s,o){return"[Axios v"+T8+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new ar(i(o," has been removed"+(r?" in "+r:"")),ar.ERR_DEPRECATED);return r&&!R8[o]&&(R8[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}},L0.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function ZK(t,e,r){if(typeof t!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new ar("option "+s+" must be "+u,ar.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ar("Unknown option "+s,ar.ERR_BAD_OPTION)}}const k0={assertOptions:ZK,validators:L0},ro=k0.validators;let Ec=class{constructor(e){this.defaults=e,this.interceptors={request:new h8,response:new h8}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` +`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=_c(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&k0.assertOptions(n,{silentJSONParsing:ro.transitional(ro.boolean),forcedJSONParsing:ro.transitional(ro.boolean),clarifyTimeoutError:ro.transitional(ro.boolean)},!1),i!=null&&(Oe.isFunction(i)?r.paramsSerializer={serialize:i}:k0.assertOptions(i,{encode:ro.function,serialize:ro.function},!0)),k0.assertOptions(r,{baseUrl:ro.spelling("baseURL"),withXsrfToken:ro.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Oe.merge(s.common,s[r.method]);s&&Oe.forEach(["delete","get","head","post","put","patch","common"],M=>{delete s[M]}),r.headers=yi.concat(o,s);const a=[];let u=!0;this.interceptors.request.forEach(function(O){typeof O.runWhen=="function"&&O.runWhen(r)===!1||(u=u&&O.synchronous,a.unshift(O.fulfilled,O.rejected))});const l=[];this.interceptors.response.forEach(function(O){l.push(O.fulfilled,O.rejected)});let d,p=0,y;if(!u){const M=[C8.bind(this),void 0];for(M.unshift.apply(M,a),M.push.apply(M,l),y=M.length,d=Promise.resolve(r);p{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new Lu(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new AP(function(i){e=i}),cancel:e}}};function eV(t){return function(r){return t.apply(null,r)}}function tV(t){return Oe.isObject(t)&&t.isAxiosError===!0}const Av={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Av).forEach(([t,e])=>{Av[e]=t});function D8(t){const e=new Ec(t),r=Y4(Ec.prototype.request,e);return Oe.extend(r,Ec.prototype,e,{allOwnKeys:!0}),Oe.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return D8(_c(t,i))},r}const un=D8(Vl);un.Axios=Ec,un.CanceledError=Lu,un.CancelToken=QK,un.isCancel=m8,un.VERSION=T8,un.toFormData=T0,un.AxiosError=ar,un.Cancel=un.CanceledError,un.all=function(e){return Promise.all(e)},un.spread=eV,un.isAxiosError=tV,un.mergeConfig=_c,un.AxiosHeaders=yi,un.formToJSON=t=>p8(Oe.isHTMLForm(t)?new FormData(t):t),un.getAdapter=I8.getAdapter,un.HttpStatusCode=Av,un.default=un;const{Axios:yae,AxiosError:O8,CanceledError:wae,isCancel:xae,CancelToken:_ae,VERSION:Eae,all:Sae,Cancel:Aae,isAxiosError:Pae,spread:Mae,toFormData:Iae,AxiosHeaders:Cae,HttpStatusCode:Tae,formToJSON:Rae,getAdapter:Dae,mergeConfig:Oae}=un,N8=un.create({timeout:6e4,headers:{"Content-Type":"application/json",token:localStorage.getItem("auth")}});function rV(t){var e,r,n;if(((e=t.data)==null?void 0:e.success)!==!0){const i=new O8((r=t.data)==null?void 0:r.errorMessage,(n=t.data)==null?void 0:n.errorCode,t.config,t.request,t);return Promise.reject(i)}else return t}function nV(t){var r;console.log(t);const e=(r=t.response)==null?void 0:r.data;if(e){console.log(e,"responseData");const n=new O8(e.errorMessage,t.code,t.config,t.request,t.response);return Promise.reject(n)}else return Promise.reject(t)}N8.interceptors.response.use(rV,nV);class iV{constructor(e){Ns(this,"_apiBase","");this.request=e}setApiBase(e){this._apiBase=e||""}async getNonce(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/nonce`,e);return r.data}async getEmailCode(e,r){const{data:n}=await this.request.post(`${this._apiBase}/api/v2/user/get_code`,e,{headers:{"Captcha-Param":r}});return n.data}async emailLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async walletLogin(e){return e.account_enum==="C"?(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data:(await this.request.post(`${this._apiBase}/api/v2/business/login`,e)).data}async tonLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async bindEmail(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindTonWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindEvmWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}}const xa=new iV(N8),sV={projectId:"7a4434fefbcc9af474fb5c995e47d286",metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},L8=RW({appName:"codatta",appLogoUrl:"https://avatars.githubusercontent.com/u/171659315"}),k8=Ee.createContext({saveLastUsedWallet:()=>{},lastUsedWallet:null,wallets:[],initialized:!1,featuredWallets:[],chains:[]});function Yl(){return Ee.useContext(k8)}function oV(t){const{apiBaseUrl:e}=t,[r,n]=Ee.useState([]),[i,s]=Ee.useState([]),[o,a]=Ee.useState(null),[u,l]=Ee.useState(!1),[d,p]=Ee.useState([]),y=O=>{a(O);const B={provider:O.provider instanceof j1?"UniversalProvider":"EIP1193Provider",key:O.key,timestamp:Date.now()};localStorage.setItem("xn-last-used-info",JSON.stringify(B))};function _(O){const L=O.find(B=>{var k;return((k=B.config)==null?void 0:k.name)===t.singleWalletName});if(L)s([L]);else{const B=O.filter(U=>U.featured||U.installed),k=O.filter(U=>!U.featured&&!U.installed),H=[...B,...k];n(H),s(B)}}async function M(){const O=[],L=new Map;IP.forEach(k=>{const H=new Ga(k);k.name==="Coinbase Wallet"&&H.EIP6963Detected({info:{name:"Coinbase Wallet",uuid:"coinbase",icon:k.image,rdns:"coinbase"},provider:L8.getProvider()}),L.set(H.key,H),O.push(H)}),(await Kz()).forEach(k=>{const H=L.get(k.info.name);if(H)H.EIP6963Detected(k);else{const U=new Ga(k);L.set(U.key,U),O.push(U)}});try{const k=JSON.parse(localStorage.getItem("xn-last-used-info")||"{}"),H=L.get(k.key);if(H&&k.provider==="EIP1193Provider"&&H.installed)a(H);else if(k.provider==="UniversalProvider"){const U=await j1.init(sV);if(U.session){const z=new Ga(U);a(z),console.log("Restored UniversalProvider for wallet:",z.key)}}}catch(k){console.log(k)}t.chains&&p(t.chains),_(O),l(!0)}return Ee.useEffect(()=>{M(),xa.setApiBase(e)},[]),le.jsx(k8.Provider,{value:{saveLastUsedWallet:y,wallets:r,initialized:u,lastUsedWallet:o,featuredWallets:i,chains:d},children:t.children})}/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const oV=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),B8=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/** + */const aV=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),B8=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */var aV={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + */var cV={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cV=Ee.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:s,iconNode:o,...a},u)=>Ee.createElement("svg",{ref:u,...aV,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:B8("lucide",i),...a},[...o.map(([l,d])=>Ee.createElement(l,d)),...Array.isArray(s)?s:[s]]));/** + */const uV=Ee.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:s,iconNode:o,...a},u)=>Ee.createElement("svg",{ref:u,...cV,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:B8("lucide",i),...a},[...o.map(([l,d])=>Ee.createElement(l,d)),...Array.isArray(s)?s:[s]]));/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ns=(t,e)=>{const r=Ee.forwardRef(({className:n,...i},s)=>Ee.createElement(cV,{ref:s,iconNode:e,className:B8(`lucide-${oV(t)}`,n),...i}));return r.displayName=`${t}`,r};/** + */const ns=(t,e)=>{const r=Ee.forwardRef(({className:n,...i},s)=>Ee.createElement(uV,{ref:s,iconNode:e,className:B8(`lucide-${aV(t)}`,n),...i}));return r.displayName=`${t}`,r};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const uV=ns("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + */const fV=ns("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -146,22 +146,22 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fV=ns("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const lV=ns("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lV=ns("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** + */const hV=ns("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hV=ns("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + */const dV=ns("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dV=ns("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** + */const pV=ns("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -171,17 +171,17 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const pV=ns("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** + */const gV=ns("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ec=ns("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + */const Sc=ns("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gV=ns("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** + */const mV=ns("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -191,7 +191,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mV=ns("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]),U8=new Set;function B0(t,e,r){t||U8.has(e)||(console.warn(e),U8.add(e))}function vV(t){if(typeof Proxy>"u")return t;const e=new Map,r=(...n)=>(process.env.NODE_ENV!=="production"&&B0(!1,"motion() is deprecated. Use motion.create() instead."),t(...n));return new Proxy(r,{get:(n,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}function $0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const Pv=t=>Array.isArray(t);function q8(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function Mv(t,e,r,n){if(typeof e=="function"){const[i,s]=z8(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=z8(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function F0(t,e,r){const n=t.getProps();return Mv(n,e,r!==void 0?r:n.custom,t)}const Iv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Cv=["initial",...Iv],Xl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Sc=new Set(Xl),no=t=>t*1e3,Do=t=>t/1e3,bV={type:"spring",stiffness:500,damping:25,restSpeed:10},yV=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),wV={type:"keyframes",duration:.8},xV={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},_V=(t,{keyframes:e})=>e.length>2?wV:Sc.has(t)?t.startsWith("scale")?yV(e[1]):bV:xV;function Tv(t,e){return t?t[e]||t.default||t:void 0}const EV={useManualTiming:!1},SV=t=>t!==null;function j0(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(SV),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const qn=t=>t;function AV(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){s.has(l)&&(u.schedule(l),t()),l(o)}const u={schedule:(l,d=!1,p=!1)=>{const _=p&&n?e:r;return d&&s.add(l),_.has(l)||_.add(l),l},cancel:l=>{r.delete(l),s.delete(l)},process:l=>{if(o=l,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,u.process(l))}};return u}const U0=["read","resolveKeyframes","update","preRender","render","postRender"],PV=40;function H8(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=U0.reduce((B,k)=>(B[k]=AV(s),B),{}),{read:a,resolveKeyframes:u,update:l,preRender:d,render:p,postRender:y}=o,_=()=>{const B=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(B-i.timestamp,PV),1),i.timestamp=B,i.isProcessing=!0,a.process(i),u.process(i),l.process(i),d.process(i),p.process(i),y.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(_))},M=()=>{r=!0,n=!0,i.isProcessing||t(_)};return{schedule:U0.reduce((B,k)=>{const H=o[k];return B[k]=(U,z=!1,Z=!1)=>(r||M(),H.schedule(U,z,Z)),B},{}),cancel:B=>{for(let k=0;k(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,MV=1e-7,IV=12;function CV(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=W8(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>MV&&++aCV(s,0,1,t,r);return s=>s===0||s===1?s:W8(i(s),e,n)}const K8=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,V8=t=>e=>1-t(1-e),G8=Zl(.33,1.53,.69,.99),Dv=V8(G8),Y8=K8(Dv),J8=t=>(t*=2)<1?.5*Dv(t):.5*(2-Math.pow(2,-10*(t-1))),Ov=t=>1-Math.sin(Math.acos(t)),X8=V8(Ov),Z8=K8(Ov),Q8=t=>/^0[^.\s]+$/u.test(t);function TV(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Q8(t):!0}let ku=qn,Oo=qn;process.env.NODE_ENV!=="production"&&(ku=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},Oo=(t,e)=>{if(!t)throw new Error(e)});const eE=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),tE=t=>e=>typeof e=="string"&&e.startsWith(t),rE=tE("--"),RV=tE("var(--"),Nv=t=>RV(t)?DV.test(t.split("/*")[0].trim()):!1,DV=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,OV=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function NV(t){const e=OV.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}const LV=4;function nE(t,e,r=1){Oo(r<=LV,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[n,i]=NV(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return eE(o)?parseFloat(o):o}return Nv(i)?nE(i,e,r+1):i}const Ea=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},Ql={...Bu,transform:t=>Ea(0,1,t)},q0={...Bu,default:1},eh=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Sa=eh("deg"),io=eh("%"),zt=eh("px"),kV=eh("vh"),BV=eh("vw"),iE={...io,parse:t=>io.parse(t)/100,transform:t=>io.transform(t*100)},$V=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),sE=t=>t===Bu||t===zt,oE=(t,e)=>parseFloat(t.split(", ")[e]),aE=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return oE(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?oE(s[1],t):0}},FV=new Set(["x","y","z"]),jV=Xl.filter(t=>!FV.has(t));function UV(t){const e=[];return jV.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const $u={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:aE(4,13),y:aE(5,14)};$u.translateX=$u.x,$u.translateY=$u.y;const cE=t=>e=>e.test(t),uE=[Bu,zt,io,Sa,BV,kV,{test:t=>t==="auto",parse:t=>t}],fE=t=>uE.find(cE(t)),Ac=new Set;let Lv=!1,kv=!1;function lE(){if(kv){const t=Array.from(Ac).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=UV(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}kv=!1,Lv=!1,Ac.forEach(t=>t.complete()),Ac.clear()}function hE(){Ac.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(kv=!0)})}function qV(){hE(),lE()}class Bv{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Ac.add(this),Lv||(Lv=!0,Nr.read(hE),Nr.resolveKeyframes(lE))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sMath.round(t*1e5)/1e5,$v=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function zV(t){return t==null}const HV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Fv=(t,e)=>r=>!!(typeof r=="string"&&HV.test(r)&&r.startsWith(t)||e&&!zV(r)&&Object.prototype.hasOwnProperty.call(r,e)),dE=(t,e,r)=>n=>{if(typeof n!="string")return n;const[i,s,o,a]=n.match($v);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},WV=t=>Ea(0,255,t),jv={...Bu,transform:t=>Math.round(WV(t))},Pc={test:Fv("rgb","red"),parse:dE("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+jv.transform(t)+", "+jv.transform(e)+", "+jv.transform(r)+", "+th(Ql.transform(n))+")"};function KV(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const Uv={test:Fv("#"),parse:KV,transform:Pc.transform},Fu={test:Fv("hsl","hue"),parse:dE("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+io.transform(th(e))+", "+io.transform(th(r))+", "+th(Ql.transform(n))+")"},Jn={test:t=>Pc.test(t)||Uv.test(t)||Fu.test(t),parse:t=>Pc.test(t)?Pc.parse(t):Fu.test(t)?Fu.parse(t):Uv.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Pc.transform(t):Fu.transform(t)},VV=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function GV(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match($v))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(VV))===null||r===void 0?void 0:r.length)||0)>0}const pE="number",gE="color",YV="var",JV="var(",mE="${}",XV=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function rh(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(XV,u=>(Jn.test(u)?(n.color.push(s),i.push(gE),r.push(Jn.parse(u))):u.startsWith(JV)?(n.var.push(s),i.push(YV),r.push(u)):(n.number.push(s),i.push(pE),r.push(parseFloat(u))),++s,mE)).split(mE);return{values:r,split:a,indexes:n,types:i}}function vE(t){return rh(t).values}function bE(t){const{split:e,types:r}=rh(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function QV(t){const e=vE(t);return bE(t)(e.map(ZV))}const Aa={test:GV,parse:vE,createTransformer:bE,getAnimatableNone:QV},eG=new Set(["brightness","contrast","saturate","opacity"]);function tG(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match($v)||[];if(!n)return t;const i=r.replace(n,"");let s=eG.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const rG=/\b([a-z-]*)\(.*?\)/gu,qv={...Aa,getAnimatableNone:t=>{const e=t.match(rG);return e?e.map(tG).join(" "):t}},nG={borderWidth:zt,borderTopWidth:zt,borderRightWidth:zt,borderBottomWidth:zt,borderLeftWidth:zt,borderRadius:zt,radius:zt,borderTopLeftRadius:zt,borderTopRightRadius:zt,borderBottomRightRadius:zt,borderBottomLeftRadius:zt,width:zt,maxWidth:zt,height:zt,maxHeight:zt,top:zt,right:zt,bottom:zt,left:zt,padding:zt,paddingTop:zt,paddingRight:zt,paddingBottom:zt,paddingLeft:zt,margin:zt,marginTop:zt,marginRight:zt,marginBottom:zt,marginLeft:zt,backgroundPositionX:zt,backgroundPositionY:zt},iG={rotate:Sa,rotateX:Sa,rotateY:Sa,rotateZ:Sa,scale:q0,scaleX:q0,scaleY:q0,scaleZ:q0,skew:Sa,skewX:Sa,skewY:Sa,distance:zt,translateX:zt,translateY:zt,translateZ:zt,x:zt,y:zt,z:zt,perspective:zt,transformPerspective:zt,opacity:Ql,originX:iE,originY:iE,originZ:zt},yE={...Bu,transform:Math.round},zv={...nG,...iG,zIndex:yE,size:zt,fillOpacity:Ql,strokeOpacity:Ql,numOctaves:yE},sG={...zv,color:Jn,backgroundColor:Jn,outlineColor:Jn,fill:Jn,stroke:Jn,borderColor:Jn,borderTopColor:Jn,borderRightColor:Jn,borderBottomColor:Jn,borderLeftColor:Jn,filter:qv,WebkitFilter:qv},Hv=t=>sG[t];function wE(t,e){let r=Hv(t);return r!==qv&&(r=Aa),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const oG=new Set(["auto","none","0"]);function aG(t,e,r){let n=0,i;for(;n{r.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function Wv(t){return typeof t=="function"}let z0;function cG(){z0=void 0}const so={now:()=>(z0===void 0&&so.set(zn.isProcessing||EV.useManualTiming?zn.timestamp:performance.now()),z0),set:t=>{z0=t,queueMicrotask(cG)}},_E=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Aa.test(t)||t==="0")&&!t.startsWith("url("));function uG(t){const e=t[0];if(t.length===1)return!0;for(let r=0;rlG?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&qV(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=so.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:u,isGenerator:l}=this.options;if(!l&&!fG(e,n,i,s))if(o)this.options.duration=0;else{u==null||u(j0(e,this.options,r)),a==null||a(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,r);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...d},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function SE(t,e){return e?t*(1e3/e):0}const hG=5;function AE(t,e,r){const n=Math.max(e-hG,0);return SE(r-t(n),e-n)}const Kv=.001,dG=.01,PE=10,pG=.05,gG=1;function mG({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;ku(t<=no(PE),"Spring duration must be 10 seconds or less");let o=1-e;o=Ea(pG,gG,o),t=Ea(dG,PE,Do(t)),o<1?(i=l=>{const d=l*o,p=d*t,y=d-r,_=Vv(l,o),M=Math.exp(-p);return Kv-y/_*M},s=l=>{const p=l*o*t,y=p*r+r,_=Math.pow(o,2)*Math.pow(l,2)*t,M=Math.exp(-p),O=Vv(Math.pow(l,2),o);return(-i(l)+Kv>0?-1:1)*((y-_)*M)/O}):(i=l=>{const d=Math.exp(-l*t),p=(l-r)*t+1;return-Kv+d*p},s=l=>{const d=Math.exp(-l*t),p=(r-l)*(t*t);return d*p});const a=5/t,u=bG(i,s,a);if(t=no(t),isNaN(u))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(u,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:t}}}const vG=12;function bG(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function xG(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!ME(t,wG)&&ME(t,yG)){const r=mG(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function IE({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:u,mass:l,duration:d,velocity:p,isResolvedFromDuration:y}=xG({...n,velocity:-Do(n.velocity||0)}),_=p||0,M=u/(2*Math.sqrt(a*l)),O=s-i,L=Do(Math.sqrt(a/l)),B=Math.abs(O)<5;r||(r=B?.01:2),e||(e=B?.005:.5);let k;if(M<1){const H=Vv(L,M);k=U=>{const z=Math.exp(-M*L*U);return s-z*((_+M*L*O)/H*Math.sin(H*U)+O*Math.cos(H*U))}}else if(M===1)k=H=>s-Math.exp(-L*H)*(O+(_+L*O)*H);else{const H=L*Math.sqrt(M*M-1);k=U=>{const z=Math.exp(-M*L*U),Z=Math.min(H*U,300);return s-z*((_+M*L*O)*Math.sinh(Z)+H*O*Math.cosh(Z))/H}}return{calculatedDuration:y&&d||null,next:H=>{const U=k(H);if(y)o.done=H>=d;else{let z=0;M<1&&(z=H===0?no(_):AE(k,H,U));const Z=Math.abs(z)<=r,R=Math.abs(s-U)<=e;o.done=Z&&R}return o.value=o.done?s:U,o}}}function CE({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:d}){const p=t[0],y={done:!1,value:p},_=W=>a!==void 0&&Wu,M=W=>a===void 0?u:u===void 0||Math.abs(a-W)-O*Math.exp(-W/n),H=W=>B+k(W),U=W=>{const ie=k(W),me=H(W);y.done=Math.abs(ie)<=l,y.value=y.done?B:me};let z,Z;const R=W=>{_(y.value)&&(z=W,Z=IE({keyframes:[y.value,M(y.value)],velocity:AE(H,W,y.value),damping:i,stiffness:s,restDelta:l,restSpeed:d}))};return R(0),{calculatedDuration:null,next:W=>{let ie=!1;return!Z&&z===void 0&&(ie=!0,U(W),R(W)),z!==void 0&&W>=z?Z.next(W-z):(!ie&&U(W),y)}}}const _G=Zl(.42,0,1,1),EG=Zl(0,0,.58,1),TE=Zl(.42,0,.58,1),SG=t=>Array.isArray(t)&&typeof t[0]!="number",Gv=t=>Array.isArray(t)&&typeof t[0]=="number",RE={linear:qn,easeIn:_G,easeInOut:TE,easeOut:EG,circIn:Ov,circInOut:Z8,circOut:X8,backIn:Dv,backInOut:Y8,backOut:G8,anticipate:J8},DE=t=>{if(Gv(t)){Oo(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,r,n,i]=t;return Zl(e,r,n,i)}else if(typeof t=="string")return Oo(RE[t]!==void 0,`Invalid easing type '${t}'`),RE[t];return t},AG=(t,e)=>r=>e(t(r)),No=(...t)=>t.reduce(AG),ju=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},Zr=(t,e,r)=>t+(e-t)*r;function Yv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function PG({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,u=2*r-a;i=Yv(u,a,t+1/3),s=Yv(u,a,t),o=Yv(u,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function H0(t,e){return r=>r>0?e:t}const Jv=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},MG=[Uv,Pc,Fu],IG=t=>MG.find(e=>e.test(t));function OE(t){const e=IG(t);if(ku(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let r=e.parse(t);return e===Fu&&(r=PG(r)),r}const NE=(t,e)=>{const r=OE(t),n=OE(e);if(!r||!n)return H0(t,e);const i={...r};return s=>(i.red=Jv(r.red,n.red,s),i.green=Jv(r.green,n.green,s),i.blue=Jv(r.blue,n.blue,s),i.alpha=Zr(r.alpha,n.alpha,s),Pc.transform(i))},Xv=new Set(["none","hidden"]);function CG(t,e){return Xv.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function TG(t,e){return r=>Zr(t,e,r)}function Zv(t){return typeof t=="number"?TG:typeof t=="string"?Nv(t)?H0:Jn.test(t)?NE:OG:Array.isArray(t)?LE:typeof t=="object"?Jn.test(t)?NE:RG:H0}function LE(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>Zv(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function DG(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=Aa.createTransformer(e),n=rh(t),i=rh(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?Xv.has(t)&&!i.values.length||Xv.has(e)&&!n.values.length?CG(t,e):No(LE(DG(n,i),i.values),r):(ku(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),H0(t,e))};function kE(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Zr(t,e,r):Zv(t)(t,e)}function NG(t,e,r){const n=[],i=r||kE,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=NG(e,n,i),a=o.length,u=l=>{let d=0;if(a>1)for(;du(Ea(t[0],t[s-1],l)):u}function kG(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=ju(0,e,n);t.push(Zr(r,1,i))}}function BG(t){const e=[0];return kG(e,t.length-1),e}function $G(t,e){return t.map(r=>r*e)}function FG(t,e){return t.map(()=>e||TE).splice(0,t.length-1)}function W0({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=SG(n)?n.map(DE):DE(n),s={done:!1,value:e[0]},o=$G(r&&r.length===e.length?r:BG(e),t),a=LG(o,e,{ease:Array.isArray(i)?i:FG(e,i)});return{calculatedDuration:t,next:u=>(s.value=a(u),s.done=u>=t,s)}}const BE=2e4;function jG(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=BE?1/0:e}const UG=t=>{const e=({timestamp:r})=>t(r);return{start:()=>Nr.update(e,!0),stop:()=>_a(e),now:()=>zn.isProcessing?zn.timestamp:so.now()}},qG={decay:CE,inertia:CE,tween:W0,keyframes:W0,spring:IE},zG=t=>t/100;class Qv extends EE{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:u}=this.options;u&&u()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Bv,a=(u,l)=>this.onKeyframesResolved(u,l);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=Wv(r)?r:qG[r]||W0;let u,l;a!==W0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&Oo(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),u=No(zG,kE(e[0],e[1])),e=[0,100]);const d=a({...this.options,keyframes:e});s==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=jG(d));const{calculatedDuration:p}=d,y=p+i,_=y*(n+1)-i;return{generator:d,mirroredGenerator:l,mapPercentToKeyframes:u,calculatedDuration:p,resolvedDuration:y,totalDuration:_}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:W}=this.options;return{done:!0,value:W[W.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:u,calculatedDuration:l,totalDuration:d,resolvedDuration:p}=n;if(this.startTime===null)return s.next(0);const{delay:y,repeat:_,repeatType:M,repeatDelay:O,onUpdate:L}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const B=this.currentTime-y*(this.speed>=0?1:-1),k=this.speed>=0?B<0:B>d;this.currentTime=Math.max(B,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let H=this.currentTime,U=s;if(_){const W=Math.min(this.currentTime,d)/p;let ie=Math.floor(W),me=W%1;!me&&W>=1&&(me=1),me===1&&ie--,ie=Math.min(ie,_+1),!!(ie%2)&&(M==="reverse"?(me=1-me,O&&(me-=O/p)):M==="mirror"&&(U=o)),H=Ea(0,1,me)*p}const z=k?{done:!1,value:u[0]}:U.next(H);a&&(z.value=a(z.value));let{done:Z}=z;!k&&l!==null&&(Z=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const R=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&Z);return R&&i!==void 0&&(z.value=j0(u,this.options,i)),L&&L(z.value),R&&this.finish(),z}get duration(){const{resolved:e}=this;return e?Do(e.calculatedDuration):0}get time(){return Do(this.currentTime)}set time(e){e=no(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=Do(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=UG,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const HG=new Set(["opacity","clipPath","filter","transform"]),WG=10,KG=(t,e)=>{let r="";const n=Math.max(Math.round(e/WG),2);for(let i=0;i(e===void 0&&(e=t()),e)}const VG={linearEasing:void 0};function GG(t,e){const r=eb(t);return()=>{var n;return(n=VG[e])!==null&&n!==void 0?n:r()}}const K0=GG(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function $E(t){return!!(typeof t=="function"&&K0()||!t||typeof t=="string"&&(t in tb||K0())||Gv(t)||Array.isArray(t)&&t.every($E))}const nh=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,tb={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:nh([0,.65,.55,1]),circOut:nh([.55,0,1,.45]),backIn:nh([.31,.01,.66,-.59]),backOut:nh([.33,1.53,.69,.99])};function FE(t,e){if(t)return typeof t=="function"&&K0()?KG(t,e):Gv(t)?nh(t):Array.isArray(t)?t.map(r=>FE(r,e)||tb.easeOut):tb[t]}function YG(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:u}={}){const l={[e]:r};u&&(l.offset=u);const d=FE(a,i);return Array.isArray(d)&&(l.easing=d),t.animate(l,{delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function jE(t,e){t.timeline=e,t.onfinish=null}const JG=eb(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),V0=10,XG=2e4;function ZG(t){return Wv(t.type)||t.type==="spring"||!$E(t.ease)}function QG(t,e){const r=new Qv({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&sthis.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:u,name:l,startTime:d}=this.options;if(!(!((n=u.owner)===null||n===void 0)&&n.current))return!1;if(typeof o=="string"&&K0()&&eY(o)&&(o=UE[o]),ZG(this.options)){const{onComplete:y,onUpdate:_,motionValue:M,element:O,...L}=this.options,B=QG(e,L);e=B.keyframes,e.length===1&&(e[1]=e[0]),i=B.duration,s=B.times,o=B.ease,a="keyframes"}const p=YG(u.owner.current,l,e,{...this.options,duration:i,times:s,ease:o});return p.startTime=d??this.calcStartTime(),this.pendingTimeline?(jE(p,this.pendingTimeline),this.pendingTimeline=void 0):p.onfinish=()=>{const{onComplete:y}=this.options;u.set(j0(e,this.options,r)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:p,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return Do(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return Do(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=no(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return qn;const{animation:n}=r;jE(n,e)}return qn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:d,onComplete:p,element:y,..._}=this.options,M=new Qv({..._,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),O=no(this.time);l.setWithVelocity(M.sample(O-V0).value,M.sample(O).value,V0)}const{onStop:u}=this.options;u&&u(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return JG()&&n&&HG.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}const tY=eb(()=>window.ScrollTimeline!==void 0);class rY{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;ntY()&&i.attachTimeline?i.attachTimeline(e):r(i));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function nY({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:u,elapsed:l,...d}){return!!Object.keys(d).length}const rb=(t,e,r,n={},i,s)=>o=>{const a=Tv(n,t)||{},u=a.delay||n.delay||0;let{elapsed:l=0}=n;l=l-no(u);let d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:y=>{e.set(y),a.onUpdate&&a.onUpdate(y)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:i};nY(a)||(d={...d,..._V(t,d)}),d.duration&&(d.duration=no(d.duration)),d.repeatDelay&&(d.repeatDelay=no(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let p=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(p=!0)),p&&!s&&e.get()!==void 0){const y=j0(d.keyframes,a);if(y!==void 0)return Nr.update(()=>{d.onUpdate(y),d.onComplete()}),new rY([])}return!s&&qE.supports(d)?new qE(d):new Qv(d)},iY=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),sY=t=>Pv(t)?t[t.length-1]||0:t;function nb(t,e){t.indexOf(e)===-1&&t.push(e)}function ib(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class sb{constructor(){this.subscriptions=[]}add(e){return nb(this.subscriptions,e),()=>ib(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class aY{constructor(e,r={}){this.version="11.11.17",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=so.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=so.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=oY(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&B0(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new sb);const n=this.events[e].add(r);return e==="change"?()=>{n(),Nr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=so.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>zE)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,zE);return SE(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ih(t,e){return new aY(t,e)}function cY(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,ih(r))}function uY(t,e){const r=F0(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=sY(s[o]);cY(t,o,a)}}const ob=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),HE="data-"+ob("framerAppearId");function WE(t){return t.props[HE]}const Xn=t=>!!(t&&t.getVelocity);function fY(t){return!!(Xn(t)&&t.add)}function ab(t,e){const r=t.getValue("willChange");if(fY(r))return r.add(e)}function lY({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function KE(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...u}=e;n&&(o=n);const l=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const p in u){const y=t.getValue(p,(s=t.latestValues[p])!==null&&s!==void 0?s:null),_=u[p];if(_===void 0||d&&lY(d,p))continue;const M={delay:r,...Tv(o||{},p)};let O=!1;if(window.MotionHandoffAnimation){const B=WE(t);if(B){const k=window.MotionHandoffAnimation(B,p,Nr);k!==null&&(M.startTime=k,O=!0)}}ab(t,p),y.start(rb(p,y,_,t.shouldReduceMotion&&Sc.has(p)?{type:!1}:M,t,O));const L=y.animation;L&&l.push(L)}return a&&Promise.all(l).then(()=>{Nr.update(()=>{a&&uY(t,a)})}),l}function cb(t,e,r={}){var n;const i=F0(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(KE(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:y}=s;return hY(t,e,d+l,p,y,r)}:()=>Promise.resolve(),{when:u}=s;if(u){const[l,d]=u==="beforeChildren"?[o,a]:[a,o];return l().then(()=>d())}else return Promise.all([o(),a(r.delay)])}function hY(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,u=i===1?(l=0)=>l*n:(l=0)=>a-l*n;return Array.from(t.variantChildren).sort(dY).forEach((l,d)=>{l.notify("AnimationStart",e),o.push(cb(l,e,{...s,delay:r+u(d)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function dY(t,e){return t.sortNodePosition(e)}function pY(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>cb(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=cb(t,e,r);else{const i=typeof e=="function"?F0(t,e,r.custom):e;n=Promise.all(KE(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const gY=Cv.length;function VE(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?VE(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;rPromise.all(e.map(({animation:r,options:n})=>pY(t,r,n)))}function yY(t){let e=bY(t),r=GE(),n=!0;const i=u=>(l,d)=>{var p;const y=F0(t,d,u==="exit"?(p=t.presenceContext)===null||p===void 0?void 0:p.custom:void 0);if(y){const{transition:_,transitionEnd:M,...O}=y;l={...l,...O,...M}}return l};function s(u){e=u(t)}function o(u){const{props:l}=t,d=VE(t.parent)||{},p=[],y=new Set;let _={},M=1/0;for(let L=0;LM&&U,ie=!1;const me=Array.isArray(H)?H:[H];let j=me.reduce(i(B),{});z===!1&&(j={});const{prevResolvedValues:E={}}=k,m={...E,...j},f=x=>{W=!0,y.has(x)&&(ie=!0,y.delete(x)),k.needsAnimating[x]=!0;const S=t.getValue(x);S&&(S.liveStyle=!1)};for(const x in m){const S=j[x],A=E[x];if(_.hasOwnProperty(x))continue;let b=!1;Pv(S)&&Pv(A)?b=!q8(S,A):b=S!==A,b?S!=null?f(x):y.add(x):S!==void 0&&y.has(x)?f(x):k.protectedKeys[x]=!0}k.prevProp=H,k.prevResolvedValues=j,k.isActive&&(_={..._,...j}),n&&t.blockInitialAnimation&&(W=!1),W&&(!(Z&&R)||ie)&&p.push(...me.map(x=>({animation:x,options:{type:B}})))}if(y.size){const L={};y.forEach(B=>{const k=t.getBaseTarget(B),H=t.getValue(B);H&&(H.liveStyle=!0),L[B]=k??null}),p.push({animation:L})}let O=!!p.length;return n&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(O=!1),n=!1,O?e(p):Promise.resolve()}function a(u,l){var d;if(r[u].isActive===l)return Promise.resolve();(d=t.variantChildren)===null||d===void 0||d.forEach(y=>{var _;return(_=y.animationState)===null||_===void 0?void 0:_.setActive(u,l)}),r[u].isActive=l;const p=o(u);for(const y in r)r[y].protectedKeys={};return p}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=GE(),n=!0}}}function wY(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!q8(e,t):!1}function Mc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function GE(){return{animate:Mc(!0),whileInView:Mc(),whileHover:Mc(),whileTap:Mc(),whileDrag:Mc(),whileFocus:Mc(),exit:Mc()}}class Pa{constructor(e){this.isMounted=!1,this.node=e}update(){}}class xY extends Pa{constructor(e){super(e),e.animationState||(e.animationState=yY(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();$0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let _Y=0;class EY extends Pa{constructor(){super(...arguments),this.id=_Y++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const SY={animation:{Feature:xY},exit:{Feature:EY}},YE=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function G0(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const AY=t=>e=>YE(e)&&t(e,G0(e));function Lo(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function ko(t,e,r,n){return Lo(t,e,AY(r),n)}const JE=(t,e)=>Math.abs(t-e);function PY(t,e){const r=JE(t.x,e.x),n=JE(t.y,e.y);return Math.sqrt(r**2+n**2)}class XE{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=fb(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,_=PY(p.offset,{x:0,y:0})>=3;if(!y&&!_)return;const{point:M}=p,{timestamp:O}=zn;this.history.push({...M,timestamp:O});const{onStart:L,onMove:B}=this.handlers;y||(L&&L(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),B&&B(this.lastMoveEvent,p)},this.handlePointerMove=(p,y)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=ub(y,this.transformPagePoint),Nr.update(this.updatePoint,!0)},this.handlePointerUp=(p,y)=>{this.end();const{onEnd:_,onSessionEnd:M,resumeAnimation:O}=this.handlers;if(this.dragSnapToOrigin&&O&&O(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const L=fb(p.type==="pointercancel"?this.lastMoveEventInfo:ub(y,this.transformPagePoint),this.history);this.startEvent&&_&&_(p,L),M&&M(p,L)},!YE(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=G0(e),a=ub(o,this.transformPagePoint),{point:u}=a,{timestamp:l}=zn;this.history=[{...u,timestamp:l}];const{onSessionStart:d}=r;d&&d(e,fb(a,this.history)),this.removeListeners=No(ko(this.contextWindow,"pointermove",this.handlePointerMove),ko(this.contextWindow,"pointerup",this.handlePointerUp),ko(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),_a(this.updatePoint)}}function ub(t,e){return e?{point:e(t.point)}:t}function ZE(t,e){return{x:t.x-e.x,y:t.y-e.y}}function fb({point:t},e){return{point:t,delta:ZE(t,QE(e)),offset:ZE(t,MY(e)),velocity:IY(e,.1)}}function MY(t){return t[0]}function QE(t){return t[t.length-1]}function IY(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=QE(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>no(e)));)r--;if(!n)return{x:0,y:0};const s=Do(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function eS(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const tS=eS("dragHorizontal"),rS=eS("dragVertical");function nS(t){let e=!1;if(t==="y")e=rS();else if(t==="x")e=tS();else{const r=tS(),n=rS();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function iS(){const t=nS(!0);return t?(t(),!1):!0}function Uu(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const sS=1e-4,CY=1-sS,TY=1+sS,oS=.01,RY=0-oS,DY=0+oS;function Ni(t){return t.max-t.min}function OY(t,e,r){return Math.abs(t-e)<=r}function aS(t,e,r,n=.5){t.origin=n,t.originPoint=Zr(e.min,e.max,t.origin),t.scale=Ni(r)/Ni(e),t.translate=Zr(r.min,r.max,t.origin)-t.originPoint,(t.scale>=CY&&t.scale<=TY||isNaN(t.scale))&&(t.scale=1),(t.translate>=RY&&t.translate<=DY||isNaN(t.translate))&&(t.translate=0)}function sh(t,e,r,n){aS(t.x,e.x,r.x,n?n.originX:void 0),aS(t.y,e.y,r.y,n?n.originY:void 0)}function cS(t,e,r){t.min=r.min+e.min,t.max=t.min+Ni(e)}function NY(t,e,r){cS(t.x,e.x,r.x),cS(t.y,e.y,r.y)}function uS(t,e,r){t.min=e.min-r.min,t.max=t.min+Ni(e)}function oh(t,e,r){uS(t.x,e.x,r.x),uS(t.y,e.y,r.y)}function LY(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?Zr(r,t,n.max):Math.min(t,r)),t}function fS(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function kY(t,{top:e,left:r,bottom:n,right:i}){return{x:fS(t.x,r,i),y:fS(t.y,e,n)}}function lS(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=ju(e.min,e.max-n,t.min):n>i&&(r=ju(t.min,t.max-i,e.min)),Ea(0,1,r)}function FY(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const lb=.35;function jY(t=lb){return t===!1?t=0:t===!0&&(t=lb),{x:hS(t,"left","right"),y:hS(t,"top","bottom")}}function hS(t,e,r){return{min:dS(t,e),max:dS(t,r)}}function dS(t,e){return typeof t=="number"?t:t[e]||0}const pS=()=>({translate:0,scale:1,origin:0,originPoint:0}),qu=()=>({x:pS(),y:pS()}),gS=()=>({min:0,max:0}),fn=()=>({x:gS(),y:gS()});function is(t){return[t("x"),t("y")]}function mS({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function UY({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function qY(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function hb(t){return t===void 0||t===1}function db({scale:t,scaleX:e,scaleY:r}){return!hb(t)||!hb(e)||!hb(r)}function Ic(t){return db(t)||vS(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function vS(t){return bS(t.x)||bS(t.y)}function bS(t){return t&&t!=="0%"}function Y0(t,e,r){const n=t-r,i=e*n;return r+i}function yS(t,e,r,n,i){return i!==void 0&&(t=Y0(t,i,n)),Y0(t,r,n)+e}function pb(t,e=0,r=1,n,i){t.min=yS(t.min,e,r,n,i),t.max=yS(t.max,e,r,n,i)}function wS(t,{x:e,y:r}){pb(t.x,e.translate,e.scale,e.originPoint),pb(t.y,r.translate,r.scale,r.originPoint)}const xS=.999999999999,_S=1.0000000000001;function zY(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;axS&&(e.x=1),e.y<_S&&e.y>xS&&(e.y=1)}function zu(t,e){t.min=t.min+e,t.max=t.max+e}function ES(t,e,r,n,i=.5){const s=Zr(t.min,t.max,i);pb(t,e,r,s,n)}function Hu(t,e){ES(t.x,e.x,e.scaleX,e.scale,e.originX),ES(t.y,e.y,e.scaleY,e.scale,e.originY)}function SS(t,e){return mS(qY(t.getBoundingClientRect(),e))}function HY(t,e,r){const n=SS(t,r),{scroll:i}=e;return i&&(zu(n.x,i.offset.x),zu(n.y,i.offset.y)),n}const AS=({current:t})=>t?t.ownerDocument.defaultView:null,WY=new WeakMap;class KY{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=fn(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:p}=this.getProps();p?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(G0(d,"page").point)},s=(d,p)=>{const{drag:y,dragPropagation:_,onDragStart:M}=this.getProps();if(y&&!_&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=nS(y),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),is(L=>{let B=this.getAxisMotionValue(L).get()||0;if(io.test(B)){const{projection:k}=this.visualElement;if(k&&k.layout){const H=k.layout.layoutBox[L];H&&(B=Ni(H)*(parseFloat(B)/100))}}this.originPoint[L]=B}),M&&Nr.postRender(()=>M(d,p)),ab(this.visualElement,"transform");const{animationState:O}=this.visualElement;O&&O.setActive("whileDrag",!0)},o=(d,p)=>{const{dragPropagation:y,dragDirectionLock:_,onDirectionLock:M,onDrag:O}=this.getProps();if(!y&&!this.openGlobalLock)return;const{offset:L}=p;if(_&&this.currentDirection===null){this.currentDirection=VY(L),this.currentDirection!==null&&M&&M(this.currentDirection);return}this.updateAxis("x",p.point,L),this.updateAxis("y",p.point,L),this.visualElement.render(),O&&O(d,p)},a=(d,p)=>this.stop(d,p),u=()=>is(d=>{var p;return this.getAnimationState(d)==="paused"&&((p=this.getAxisMotionValue(d).animation)===null||p===void 0?void 0:p.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new XE(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:AS(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Nr.postRender(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!J0(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=LY(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&Uu(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=kY(i.layoutBox,r):this.constraints=!1,this.elastic=jY(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&is(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=FY(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!Uu(e))return!1;const n=e.current;Oo(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=HY(n,i.root,this.visualElement.getTransformPagePoint());let o=BY(i.layout.layoutBox,s);if(r){const a=r(UY(o));this.hasMutatedConstraints=!!a,a&&(o=mS(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),u=this.constraints||{},l=is(d=>{if(!J0(d,r,this.currentDirection))return;let p=u&&u[d]||{};o&&(p={min:0,max:0});const y=i?200:1e6,_=i?40:1e7,M={type:"inertia",velocity:n?e[d]:0,bounceStiffness:y,bounceDamping:_,timeConstant:750,restDelta:1,restSpeed:10,...s,...p};return this.startAxisValueAnimation(d,M)});return Promise.all(l).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return ab(this.visualElement,e),n.start(rb(e,n,0,r,this.visualElement,!1))}stopAnimation(){is(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){is(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){is(r=>{const{drag:n}=this.getProps();if(!J0(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-Zr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!Uu(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};is(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const u=a.get();i[o]=$Y({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),is(o=>{if(!J0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:u,max:l}=this.constraints[o];a.set(Zr(u,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;WY.set(this.visualElement,this);const e=this.visualElement.current,r=ko(e,"pointerdown",u=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();Uu(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Nr.read(n);const o=Lo(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(is(d=>{const p=this.getAxisMotionValue(d);p&&(this.originPoint[d]+=u[d].translate,p.set(p.get()+u[d].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=lb,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function J0(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function VY(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class GY extends Pa{constructor(e){super(e),this.removeGroupControls=qn,this.removeListeners=qn,this.controls=new KY(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||qn}unmount(){this.removeGroupControls(),this.removeListeners()}}const PS=t=>(e,r)=>{t&&Nr.postRender(()=>t(e,r))};class YY extends Pa{constructor(){super(...arguments),this.removePointerDownListener=qn}onPointerDown(e){this.session=new XE(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:AS(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:PS(e),onStart:PS(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&Nr.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=ko(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const X0=Ee.createContext(null);function JY(){const t=Ee.useContext(X0);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=Ee.useId();Ee.useEffect(()=>n(i),[]);const s=Ee.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const gb=Ee.createContext({}),MS=Ee.createContext({}),Z0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function IS(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ah={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(zt.test(t))t=parseFloat(t);else return t;const r=IS(t,e.target.x),n=IS(t,e.target.y);return`${r}% ${n}%`}},XY={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=Aa.parse(t);if(i.length>5)return n;const s=Aa.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,u=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=u;const l=Zr(a,u,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),s(i)}},Q0={};function ZY(t){Object.assign(Q0,t)}const{schedule:mb}=H8(queueMicrotask,!1);class QY extends Ee.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;ZY(eJ),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),Z0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Nr.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),mb.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function CS(t){const[e,r]=JY(),n=Ee.useContext(gb);return le.jsx(QY,{...t,layoutGroup:n,switchLayoutGroup:Ee.useContext(MS),isPresent:e,safeToRemove:r})}const eJ={borderRadius:{...ah,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ah,borderTopRightRadius:ah,borderBottomLeftRadius:ah,borderBottomRightRadius:ah,boxShadow:XY},TS=["TopLeft","TopRight","BottomLeft","BottomRight"],tJ=TS.length,RS=t=>typeof t=="string"?parseFloat(t):t,DS=t=>typeof t=="number"||zt.test(t);function rJ(t,e,r,n,i,s){i?(t.opacity=Zr(0,r.opacity!==void 0?r.opacity:1,nJ(n)),t.opacityExit=Zr(e.opacity!==void 0?e.opacity:1,0,iJ(n))):s&&(t.opacity=Zr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(ju(t,e,n))}function LS(t,e){t.min=e.min,t.max=e.max}function ss(t,e){LS(t.x,e.x),LS(t.y,e.y)}function kS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function BS(t,e,r,n,i){return t-=e,t=Y0(t,1/r,n),i!==void 0&&(t=Y0(t,1/i,n)),t}function sJ(t,e=0,r=1,n=.5,i,s=t,o=t){if(io.test(e)&&(e=parseFloat(e),e=Zr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Zr(s.min,s.max,n);t===s&&(a-=e),t.min=BS(t.min,e,r,a,i),t.max=BS(t.max,e,r,a,i)}function $S(t,e,[r,n,i],s,o){sJ(t,e[r],e[n],e[i],e.scale,s,o)}const oJ=["x","scaleX","originX"],aJ=["y","scaleY","originY"];function FS(t,e,r,n){$S(t.x,e,oJ,r?r.x:void 0,n?n.x:void 0),$S(t.y,e,aJ,r?r.y:void 0,n?n.y:void 0)}function jS(t){return t.translate===0&&t.scale===1}function US(t){return jS(t.x)&&jS(t.y)}function qS(t,e){return t.min===e.min&&t.max===e.max}function cJ(t,e){return qS(t.x,e.x)&&qS(t.y,e.y)}function zS(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function HS(t,e){return zS(t.x,e.x)&&zS(t.y,e.y)}function WS(t){return Ni(t.x)/Ni(t.y)}function KS(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class uJ{constructor(){this.members=[]}add(e){nb(this.members,e),e.scheduleRender()}remove(e){if(ib(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function fJ(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:l,rotate:d,rotateX:p,rotateY:y,skewX:_,skewY:M}=r;l&&(n=`perspective(${l}px) ${n}`),d&&(n+=`rotate(${d}deg) `),p&&(n+=`rotateX(${p}deg) `),y&&(n+=`rotateY(${y}deg) `),_&&(n+=`skewX(${_}deg) `),M&&(n+=`skewY(${M}deg) `)}const a=t.x.scale*e.x,u=t.y.scale*e.y;return(a!==1||u!==1)&&(n+=`scale(${a}, ${u})`),n||"none"}const lJ=(t,e)=>t.depth-e.depth;class hJ{constructor(){this.children=[],this.isDirty=!1}add(e){nb(this.children,e),this.isDirty=!0}remove(e){ib(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(lJ),this.isDirty=!1,this.children.forEach(e)}}function ep(t){const e=Xn(t)?t.get():t;return iY(e)?e.toValue():e}function dJ(t,e){const r=so.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(_a(n),t(s-e))};return Nr.read(n,!0),()=>_a(n)}function pJ(t){return t instanceof SVGElement&&t.tagName!=="svg"}function gJ(t,e,r){const n=Xn(t)?t:ih(t);return n.start(rb("",n,e,r)),n.animation}const Cc={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},ch=typeof window<"u"&&window.MotionDebug!==void 0,vb=["","X","Y","Z"],mJ={visibility:"hidden"},VS=1e3;let vJ=0;function bb(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function GS(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=WE(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Nr,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&GS(n)}function YS({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=vJ++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,ch&&(Cc.totalNodes=Cc.resolvedTargetDeltas=Cc.recalculatedProjection=0),this.nodes.forEach(wJ),this.nodes.forEach(AJ),this.nodes.forEach(PJ),this.nodes.forEach(xJ),ch&&window.MotionDebug.record(Cc)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let u=0;uthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,p&&p(),p=dJ(y,250),Z0.hasAnimatedSinceResize&&(Z0.hasAnimatedSinceResize=!1,this.nodes.forEach(XS))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&d&&(u||l)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:y,hasRelativeTargetChanged:_,layout:M})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const O=this.options.transition||d.getDefaultTransition()||RJ,{onLayoutAnimationStart:L,onLayoutAnimationComplete:B}=d.getProps(),k=!this.targetLayout||!HS(this.targetLayout,M)||_,H=!y&&_;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||H||y&&(k||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(p,H);const U={...Tv(O,"layout"),onPlay:L,onComplete:B};(d.shouldReduceMotion||this.options.layoutRoot)&&(U.delay=0,U.type=!1),this.startAnimation(U)}else y||XS(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=M})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,_a(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(MJ),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&GS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u{const z=U/1e3;ZS(p.x,o.x,z),ZS(p.y,o.y,z),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(oh(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),CJ(this.relativeTarget,this.relativeTargetOrigin,y,z),H&&cJ(this.relativeTarget,H)&&(this.isProjectionDirty=!1),H||(H=fn()),ss(H,this.relativeTarget)),O&&(this.animationValues=d,rJ(d,l,this.latestValues,z,k,B)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=z},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(_a(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nr.update(()=>{Z0.hasAnimatedSinceResize=!0,this.currentAnimation=gJ(0,VS,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(VS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:u,layout:l,latestValues:d}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&n7(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||fn();const p=Ni(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+p;const y=Ni(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+y}ss(a,u),Hu(a,d),sh(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new uJ),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(a=!0),!a)return;const l={};u.z&&bb("z",o,l,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(JS),this.root.sharedNodes.clear()}}}function bJ(t){t.updateLayout()}function yJ(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?is(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],_=Ni(y);y.min=n[p].min,y.max=y.min+_}):n7(s,r.layoutBox,n)&&is(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],_=Ni(n[p]);y.max=y.min+_,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[p].max=t.relativeTarget[p].min+_)});const a=qu();sh(a,n,r.layoutBox);const u=qu();o?sh(u,t.applyTransform(i,!0),r.measuredBox):sh(u,n,r.layoutBox);const l=!US(a);let d=!1;if(!t.resumeFrom){const p=t.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:y,layout:_}=p;if(y&&_){const M=fn();oh(M,r.layoutBox,y.layoutBox);const O=fn();oh(O,n,_.layoutBox),HS(M,O)||(d=!0),p.options.layoutRoot&&(t.relativeTarget=O,t.relativeTargetOrigin=M,t.relativeParent=p)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:u,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function wJ(t){ch&&Cc.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function xJ(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function _J(t){t.clearSnapshot()}function JS(t){t.clearMeasurements()}function EJ(t){t.isLayoutDirty=!1}function SJ(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function XS(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function AJ(t){t.resolveTargetDelta()}function PJ(t){t.calcProjection()}function MJ(t){t.resetSkewAndRotation()}function IJ(t){t.removeLeadSnapshot()}function ZS(t,e,r){t.translate=Zr(e.translate,0,r),t.scale=Zr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function QS(t,e,r,n){t.min=Zr(e.min,r.min,n),t.max=Zr(e.max,r.max,n)}function CJ(t,e,r,n){QS(t.x,e.x,r.x,n),QS(t.y,e.y,r.y,n)}function TJ(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const RJ={duration:.45,ease:[.4,0,.1,1]},e7=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),t7=e7("applewebkit/")&&!e7("chrome/")?Math.round:qn;function r7(t){t.min=t7(t.min),t.max=t7(t.max)}function DJ(t){r7(t.x),r7(t.y)}function n7(t,e,r){return t==="position"||t==="preserve-aspect"&&!OY(WS(e),WS(r),.2)}function OJ(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const NJ=YS({attachResizeListener:(t,e)=>Lo(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),yb={current:void 0},i7=YS({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!yb.current){const t=new NJ({});t.mount(window),t.setOptions({layoutScroll:!0}),yb.current=t}return yb.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),LJ={pan:{Feature:YY},drag:{Feature:GY,ProjectionNode:i7,MeasureLayout:CS}};function s7(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||iS())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const u=a[n];u&&Nr.postRender(()=>u(s,o))};return ko(t.current,r,i,{passive:!t.getProps()[n]})}class kJ extends Pa{mount(){this.unmount=No(s7(this.node,!0),s7(this.node,!1))}unmount(){}}class BJ extends Pa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=No(Lo(this.node.current,"focus",()=>this.onFocus()),Lo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const o7=(t,e)=>e?t===e?!0:o7(t,e.parentElement):!1;function wb(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,G0(r))}class $J extends Pa{constructor(){super(...arguments),this.removeStartListeners=qn,this.removeEndListeners=qn,this.removeAccessibleListeners=qn,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=ko(window,"pointerup",(a,u)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:d,globalTapTarget:p}=this.node.getProps(),y=!p&&!o7(this.node.current,a.target)?d:l;y&&Nr.update(()=>y(a,u))},{passive:!(n.onTap||n.onPointerUp)}),o=ko(window,"pointercancel",(a,u)=>this.cancelPress(a,u),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=No(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||wb("up",(u,l)=>{const{onTap:d}=this.node.getProps();d&&Nr.postRender(()=>d(u,l))})};this.removeEndListeners(),this.removeEndListeners=Lo(this.node.current,"keyup",o),wb("down",(a,u)=>{this.startPress(a,u)})},r=Lo(this.node.current,"keydown",e),n=()=>{this.isPressing&&wb("cancel",(s,o)=>this.cancelPress(s,o))},i=Lo(this.node.current,"blur",n);this.removeAccessibleListeners=No(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Nr.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!iS()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Nr.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=ko(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=Lo(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=No(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const xb=new WeakMap,_b=new WeakMap,FJ=t=>{const e=xb.get(t.target);e&&e(t)},jJ=t=>{t.forEach(FJ)};function UJ({root:t,...e}){const r=t||document;_b.has(r)||_b.set(r,{});const n=_b.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(jJ,{root:t,...e})),n[i]}function qJ(t,e,r){const n=UJ(e);return xb.set(t,r),n.observe(t),()=>{xb.delete(t),n.unobserve(t)}}const zJ={some:0,all:1};class HJ extends Pa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:zJ[i]},a=u=>{const{isIntersecting:l}=u;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:p}=this.node.getProps(),y=l?d:p;y&&y(u)};return qJ(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(WJ(e,r))&&this.startObserver()}unmount(){}}function WJ({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const KJ={inView:{Feature:HJ},tap:{Feature:$J},focus:{Feature:BJ},hover:{Feature:kJ}},VJ={layout:{ProjectionNode:i7,MeasureLayout:CS}},Eb=Ee.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),tp=Ee.createContext({}),Sb=typeof window<"u",a7=Sb?Ee.useLayoutEffect:Ee.useEffect,c7=Ee.createContext({strict:!1});function GJ(t,e,r,n,i){var s,o;const{visualElement:a}=Ee.useContext(tp),u=Ee.useContext(c7),l=Ee.useContext(X0),d=Ee.useContext(Eb).reducedMotion,p=Ee.useRef();n=n||u.renderer,!p.current&&n&&(p.current=n(t,{visualState:e,parent:a,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d}));const y=p.current,_=Ee.useContext(MS);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&YJ(p.current,r,i,_);const M=Ee.useRef(!1);Ee.useInsertionEffect(()=>{y&&M.current&&y.update(r,l)});const O=r[HE],L=Ee.useRef(!!O&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,O))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,O)));return a7(()=>{y&&(M.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),mb.render(y.render),L.current&&y.animationState&&y.animationState.animateChanges())}),Ee.useEffect(()=>{y&&(!L.current&&y.animationState&&y.animationState.animateChanges(),L.current&&(queueMicrotask(()=>{var B;(B=window.MotionHandoffMarkAsComplete)===null||B===void 0||B.call(window,O)}),L.current=!1))}),y}function YJ(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:u,layoutRoot:l}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:u7(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&Uu(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:u,layoutRoot:l})}function u7(t){if(t)return t.options.allowProjection!==!1?t.projection:u7(t.parent)}function JJ(t,e,r){return Ee.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):Uu(r)&&(r.current=n))},[e])}function rp(t){return $0(t.animate)||Cv.some(e=>Jl(t[e]))}function f7(t){return!!(rp(t)||t.variants)}function XJ(t,e){if(rp(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Jl(r)?r:void 0,animate:Jl(n)?n:void 0}}return t.inherit!==!1?e:{}}function ZJ(t){const{initial:e,animate:r}=XJ(t,Ee.useContext(tp));return Ee.useMemo(()=>({initial:e,animate:r}),[l7(e),l7(r)])}function l7(t){return Array.isArray(t)?t.join(" "):t}const h7={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Wu={};for(const t in h7)Wu[t]={isEnabled:e=>h7[t].some(r=>!!e[r])};function QJ(t){for(const e in t)Wu[e]={...Wu[e],...t[e]}}const eX=Symbol.for("motionComponentSymbol");function tX({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&QJ(t);function s(a,u){let l;const d={...Ee.useContext(Eb),...a,layoutId:rX(a)},{isStatic:p}=d,y=ZJ(a),_=n(a,p);if(!p&&Sb){nX(d,t);const M=iX(d);l=M.MeasureLayout,y.visualElement=GJ(i,_,d,e,M.ProjectionNode)}return le.jsxs(tp.Provider,{value:y,children:[l&&y.visualElement?le.jsx(l,{visualElement:y.visualElement,...d}):null,r(i,a,JJ(_,y.visualElement,u),_,p,y.visualElement)]})}const o=Ee.forwardRef(s);return o[eX]=i,o}function rX({layoutId:t}){const e=Ee.useContext(gb).id;return e&&t!==void 0?e+"-"+t:t}function nX(t,e){const r=Ee.useContext(c7).strict;if(process.env.NODE_ENV!=="production"&&e&&r){const n="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?ku(!1,n):Oo(!1,n)}}function iX(t){const{drag:e,layout:r}=Wu;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const sX=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Ab(t){return typeof t!="string"||t.includes("-")?!1:!!(sX.indexOf(t)>-1||/[A-Z]/u.test(t))}function d7(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const p7=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function g7(t,e,r,n){d7(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(p7.has(i)?i:ob(i),e.attrs[i])}function m7(t,{layout:e,layoutId:r}){return Sc.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!Q0[t]||t==="opacity")}function Pb(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(Xn(i[o])||e.style&&Xn(e.style[o])||m7(o,t)||((n=r==null?void 0:r.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function v7(t,e,r){const n=Pb(t,e,r);for(const i in t)if(Xn(t[i])||Xn(e[i])){const s=Xl.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function Mb(t){const e=Ee.useRef(null);return e.current===null&&(e.current=t()),e.current}function oX({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:aX(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const b7=t=>(e,r)=>{const n=Ee.useContext(tp),i=Ee.useContext(X0),s=()=>oX(t,e,n,i);return r?s():Mb(s)};function aX(t,e,r,n){const i={},s=n(t,{});for(const y in s)i[y]=ep(s[y]);let{initial:o,animate:a}=t;const u=rp(t),l=f7(t);e&&l&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const p=d?a:o;if(p&&typeof p!="boolean"&&!$0(p)){const y=Array.isArray(p)?p:[p];for(let _=0;_({style:{},transform:{},transformOrigin:{},vars:{}}),y7=()=>({...Ib(),attrs:{}}),w7=(t,e)=>e&&typeof t=="number"?e.transform(t):t,cX={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},uX=Xl.length;function fX(t,e,r){let n="",i=!0;for(let s=0;stypeof t=="string"&&t.toLowerCase()==="svg",gX={useVisualState:b7({scrapeMotionValuesFromProps:v7,createRenderState:y7,onMount:(t,e,{renderState:r,latestValues:n})=>{Nr.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),Nr.render(()=>{Tb(r,n,Rb(e.tagName),t.transformTemplate),g7(e,r)})}})},mX={useVisualState:b7({scrapeMotionValuesFromProps:Pb,createRenderState:Ib})};function _7(t,e,r){for(const n in e)!Xn(e[n])&&!m7(n,r)&&(t[n]=e[n])}function vX({transformTemplate:t},e){return Ee.useMemo(()=>{const r=Ib();return Cb(r,e,t),Object.assign({},r.vars,r.style)},[e])}function bX(t,e){const r=t.style||{},n={};return _7(n,r,t),Object.assign(n,vX(t,e)),n}function yX(t,e){const r={},n=bX(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const wX=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function np(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||wX.has(t)}let E7=t=>!np(t);function xX(t){t&&(E7=e=>e.startsWith("on")?!np(e):t(e))}try{xX(require("@emotion/is-prop-valid").default)}catch{}function _X(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(E7(i)||r===!0&&np(i)||!e&&!np(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function EX(t,e,r,n){const i=Ee.useMemo(()=>{const s=y7();return Tb(s,e,Rb(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};_7(s,t.style,t),i.style={...s,...i.style}}return i}function SX(t=!1){return(r,n,i,{latestValues:s},o)=>{const u=(Ab(r)?EX:yX)(n,s,o,r),l=_X(n,typeof r=="string",t),d=r!==Ee.Fragment?{...l,...u,ref:i}:{},{children:p}=n,y=Ee.useMemo(()=>Xn(p)?p.get():p,[p]);return Ee.createElement(r,{...d,children:y})}}function AX(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...Ab(n)?gX:mX,preloadedFeatures:t,useRender:SX(i),createVisualElement:e,Component:n};return tX(o)}}const Db={current:null},S7={current:!1};function PX(){if(S7.current=!0,!!Sb)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Db.current=t.matches;t.addListener(e),e()}else Db.current=!1}function MX(t,e,r){for(const n in e){const i=e[n],s=r[n];if(Xn(i))t.addValue(n,i),process.env.NODE_ENV==="development"&&B0(i.version==="11.11.17",`Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`);else if(Xn(s))t.addValue(n,ih(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,ih(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const A7=new WeakMap,IX=[...uE,Jn,Aa],CX=t=>IX.find(cE(t)),P7=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class TX{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Bv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=so.now();this.renderScheduledAtthis.bindToMotionValue(n,r)),S7.current||PX(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Db.current,process.env.NODE_ENV!=="production"&&B0(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){A7.delete(this.current),this.projection&&this.projection.unmount(),_a(this.notifyUpdate),_a(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=Sc.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Nr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Wu){const r=Wu[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):fn()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=ih(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(eE(i)||Q8(i))?i=parseFloat(i):!CX(i)&&Aa.test(r)&&(i=wE(e,r)),this.setBaseTarget(e,Xn(i)?i.get():i)),Xn(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=Mv(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Xn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new sb),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class M7 extends TX{constructor(){super(...arguments),this.KeyframeResolver=xE}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function RX(t){return window.getComputedStyle(t)}class DX extends M7{constructor(){super(...arguments),this.type="html",this.renderInstance=d7}readValueFromInstance(e,r){if(Sc.has(r)){const n=Hv(r);return n&&n.default||0}else{const n=RX(e),i=(rE(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return SS(e,r)}build(e,r,n){Cb(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return Pb(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Xn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class OX extends M7{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=fn}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(Sc.has(r)){const n=Hv(r);return n&&n.default||0}return r=p7.has(r)?r:ob(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return v7(e,r,n)}build(e,r,n){Tb(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){g7(e,r,n,i)}mount(e){this.isSVGTag=Rb(e.tagName),super.mount(e)}}const NX=(t,e)=>Ab(t)?new OX(e):new DX(e,{allowProjection:t!==Ee.Fragment}),LX=AX({...SY,...KJ,...LJ,...VJ},NX),kX=vV(LX);class BX extends Yt.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function $X({children:t,isPresent:e}){const r=Ee.useId(),n=Ee.useRef(null),i=Ee.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=Ee.useContext(Eb);return Ee.useInsertionEffect(()=>{const{width:o,height:a,top:u,left:l}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` + */const vV=ns("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]),U8=new Set;function B0(t,e,r){t||U8.has(e)||(console.warn(e),U8.add(e))}function bV(t){if(typeof Proxy>"u")return t;const e=new Map,r=(...n)=>(process.env.NODE_ENV!=="production"&&B0(!1,"motion() is deprecated. Use motion.create() instead."),t(...n));return new Proxy(r,{get:(n,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}function $0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const Pv=t=>Array.isArray(t);function q8(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function Mv(t,e,r,n){if(typeof e=="function"){const[i,s]=z8(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=z8(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function F0(t,e,r){const n=t.getProps();return Mv(n,e,r!==void 0?r:n.custom,t)}const Iv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Cv=["initial",...Iv],Xl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ac=new Set(Xl),no=t=>t*1e3,Do=t=>t/1e3,yV={type:"spring",stiffness:500,damping:25,restSpeed:10},wV=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),xV={type:"keyframes",duration:.8},_V={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},EV=(t,{keyframes:e})=>e.length>2?xV:Ac.has(t)?t.startsWith("scale")?wV(e[1]):yV:_V;function Tv(t,e){return t?t[e]||t.default||t:void 0}const SV={useManualTiming:!1},AV=t=>t!==null;function j0(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(AV),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const qn=t=>t;function PV(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){s.has(l)&&(u.schedule(l),t()),l(o)}const u={schedule:(l,d=!1,p=!1)=>{const _=p&&n?e:r;return d&&s.add(l),_.has(l)||_.add(l),l},cancel:l=>{r.delete(l),s.delete(l)},process:l=>{if(o=l,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,u.process(l))}};return u}const U0=["read","resolveKeyframes","update","preRender","render","postRender"],MV=40;function H8(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=U0.reduce((B,k)=>(B[k]=PV(s),B),{}),{read:a,resolveKeyframes:u,update:l,preRender:d,render:p,postRender:y}=o,_=()=>{const B=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(B-i.timestamp,MV),1),i.timestamp=B,i.isProcessing=!0,a.process(i),u.process(i),l.process(i),d.process(i),p.process(i),y.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(_))},M=()=>{r=!0,n=!0,i.isProcessing||t(_)};return{schedule:U0.reduce((B,k)=>{const H=o[k];return B[k]=(U,z=!1,Z=!1)=>(r||M(),H.schedule(U,z,Z)),B},{}),cancel:B=>{for(let k=0;k(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,IV=1e-7,CV=12;function TV(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=W8(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>IV&&++aTV(s,0,1,t,r);return s=>s===0||s===1?s:W8(i(s),e,n)}const K8=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,V8=t=>e=>1-t(1-e),G8=Zl(.33,1.53,.69,.99),Dv=V8(G8),Y8=K8(Dv),J8=t=>(t*=2)<1?.5*Dv(t):.5*(2-Math.pow(2,-10*(t-1))),Ov=t=>1-Math.sin(Math.acos(t)),X8=V8(Ov),Z8=K8(Ov),Q8=t=>/^0[^.\s]+$/u.test(t);function RV(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Q8(t):!0}let ku=qn,Oo=qn;process.env.NODE_ENV!=="production"&&(ku=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},Oo=(t,e)=>{if(!t)throw new Error(e)});const eE=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),tE=t=>e=>typeof e=="string"&&e.startsWith(t),rE=tE("--"),DV=tE("var(--"),Nv=t=>DV(t)?OV.test(t.split("/*")[0].trim()):!1,OV=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,NV=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function LV(t){const e=NV.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}const kV=4;function nE(t,e,r=1){Oo(r<=kV,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[n,i]=LV(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return eE(o)?parseFloat(o):o}return Nv(i)?nE(i,e,r+1):i}const Ea=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},Ql={...Bu,transform:t=>Ea(0,1,t)},q0={...Bu,default:1},eh=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Sa=eh("deg"),io=eh("%"),zt=eh("px"),BV=eh("vh"),$V=eh("vw"),iE={...io,parse:t=>io.parse(t)/100,transform:t=>io.transform(t*100)},FV=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),sE=t=>t===Bu||t===zt,oE=(t,e)=>parseFloat(t.split(", ")[e]),aE=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return oE(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?oE(s[1],t):0}},jV=new Set(["x","y","z"]),UV=Xl.filter(t=>!jV.has(t));function qV(t){const e=[];return UV.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const $u={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:aE(4,13),y:aE(5,14)};$u.translateX=$u.x,$u.translateY=$u.y;const cE=t=>e=>e.test(t),uE=[Bu,zt,io,Sa,$V,BV,{test:t=>t==="auto",parse:t=>t}],fE=t=>uE.find(cE(t)),Pc=new Set;let Lv=!1,kv=!1;function lE(){if(kv){const t=Array.from(Pc).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=qV(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}kv=!1,Lv=!1,Pc.forEach(t=>t.complete()),Pc.clear()}function hE(){Pc.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(kv=!0)})}function zV(){hE(),lE()}class Bv{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Pc.add(this),Lv||(Lv=!0,Nr.read(hE),Nr.resolveKeyframes(lE))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sMath.round(t*1e5)/1e5,$v=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function HV(t){return t==null}const WV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Fv=(t,e)=>r=>!!(typeof r=="string"&&WV.test(r)&&r.startsWith(t)||e&&!HV(r)&&Object.prototype.hasOwnProperty.call(r,e)),dE=(t,e,r)=>n=>{if(typeof n!="string")return n;const[i,s,o,a]=n.match($v);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},KV=t=>Ea(0,255,t),jv={...Bu,transform:t=>Math.round(KV(t))},Mc={test:Fv("rgb","red"),parse:dE("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+jv.transform(t)+", "+jv.transform(e)+", "+jv.transform(r)+", "+th(Ql.transform(n))+")"};function VV(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const Uv={test:Fv("#"),parse:VV,transform:Mc.transform},Fu={test:Fv("hsl","hue"),parse:dE("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+io.transform(th(e))+", "+io.transform(th(r))+", "+th(Ql.transform(n))+")"},Jn={test:t=>Mc.test(t)||Uv.test(t)||Fu.test(t),parse:t=>Mc.test(t)?Mc.parse(t):Fu.test(t)?Fu.parse(t):Uv.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Mc.transform(t):Fu.transform(t)},GV=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function YV(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match($v))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(GV))===null||r===void 0?void 0:r.length)||0)>0}const pE="number",gE="color",JV="var",XV="var(",mE="${}",ZV=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function rh(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(ZV,u=>(Jn.test(u)?(n.color.push(s),i.push(gE),r.push(Jn.parse(u))):u.startsWith(XV)?(n.var.push(s),i.push(JV),r.push(u)):(n.number.push(s),i.push(pE),r.push(parseFloat(u))),++s,mE)).split(mE);return{values:r,split:a,indexes:n,types:i}}function vE(t){return rh(t).values}function bE(t){const{split:e,types:r}=rh(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function eG(t){const e=vE(t);return bE(t)(e.map(QV))}const Aa={test:YV,parse:vE,createTransformer:bE,getAnimatableNone:eG},tG=new Set(["brightness","contrast","saturate","opacity"]);function rG(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match($v)||[];if(!n)return t;const i=r.replace(n,"");let s=tG.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const nG=/\b([a-z-]*)\(.*?\)/gu,qv={...Aa,getAnimatableNone:t=>{const e=t.match(nG);return e?e.map(rG).join(" "):t}},iG={borderWidth:zt,borderTopWidth:zt,borderRightWidth:zt,borderBottomWidth:zt,borderLeftWidth:zt,borderRadius:zt,radius:zt,borderTopLeftRadius:zt,borderTopRightRadius:zt,borderBottomRightRadius:zt,borderBottomLeftRadius:zt,width:zt,maxWidth:zt,height:zt,maxHeight:zt,top:zt,right:zt,bottom:zt,left:zt,padding:zt,paddingTop:zt,paddingRight:zt,paddingBottom:zt,paddingLeft:zt,margin:zt,marginTop:zt,marginRight:zt,marginBottom:zt,marginLeft:zt,backgroundPositionX:zt,backgroundPositionY:zt},sG={rotate:Sa,rotateX:Sa,rotateY:Sa,rotateZ:Sa,scale:q0,scaleX:q0,scaleY:q0,scaleZ:q0,skew:Sa,skewX:Sa,skewY:Sa,distance:zt,translateX:zt,translateY:zt,translateZ:zt,x:zt,y:zt,z:zt,perspective:zt,transformPerspective:zt,opacity:Ql,originX:iE,originY:iE,originZ:zt},yE={...Bu,transform:Math.round},zv={...iG,...sG,zIndex:yE,size:zt,fillOpacity:Ql,strokeOpacity:Ql,numOctaves:yE},oG={...zv,color:Jn,backgroundColor:Jn,outlineColor:Jn,fill:Jn,stroke:Jn,borderColor:Jn,borderTopColor:Jn,borderRightColor:Jn,borderBottomColor:Jn,borderLeftColor:Jn,filter:qv,WebkitFilter:qv},Hv=t=>oG[t];function wE(t,e){let r=Hv(t);return r!==qv&&(r=Aa),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const aG=new Set(["auto","none","0"]);function cG(t,e,r){let n=0,i;for(;n{r.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function Wv(t){return typeof t=="function"}let z0;function uG(){z0=void 0}const so={now:()=>(z0===void 0&&so.set(zn.isProcessing||SV.useManualTiming?zn.timestamp:performance.now()),z0),set:t=>{z0=t,queueMicrotask(uG)}},_E=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Aa.test(t)||t==="0")&&!t.startsWith("url("));function fG(t){const e=t[0];if(t.length===1)return!0;for(let r=0;rhG?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&zV(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=so.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:u,isGenerator:l}=this.options;if(!l&&!lG(e,n,i,s))if(o)this.options.duration=0;else{u==null||u(j0(e,this.options,r)),a==null||a(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,r);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...d},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function SE(t,e){return e?t*(1e3/e):0}const dG=5;function AE(t,e,r){const n=Math.max(e-dG,0);return SE(r-t(n),e-n)}const Kv=.001,pG=.01,PE=10,gG=.05,mG=1;function vG({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;ku(t<=no(PE),"Spring duration must be 10 seconds or less");let o=1-e;o=Ea(gG,mG,o),t=Ea(pG,PE,Do(t)),o<1?(i=l=>{const d=l*o,p=d*t,y=d-r,_=Vv(l,o),M=Math.exp(-p);return Kv-y/_*M},s=l=>{const p=l*o*t,y=p*r+r,_=Math.pow(o,2)*Math.pow(l,2)*t,M=Math.exp(-p),O=Vv(Math.pow(l,2),o);return(-i(l)+Kv>0?-1:1)*((y-_)*M)/O}):(i=l=>{const d=Math.exp(-l*t),p=(l-r)*t+1;return-Kv+d*p},s=l=>{const d=Math.exp(-l*t),p=(r-l)*(t*t);return d*p});const a=5/t,u=yG(i,s,a);if(t=no(t),isNaN(u))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(u,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:t}}}const bG=12;function yG(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function _G(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!ME(t,xG)&&ME(t,wG)){const r=vG(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function IE({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:u,mass:l,duration:d,velocity:p,isResolvedFromDuration:y}=_G({...n,velocity:-Do(n.velocity||0)}),_=p||0,M=u/(2*Math.sqrt(a*l)),O=s-i,L=Do(Math.sqrt(a/l)),B=Math.abs(O)<5;r||(r=B?.01:2),e||(e=B?.005:.5);let k;if(M<1){const H=Vv(L,M);k=U=>{const z=Math.exp(-M*L*U);return s-z*((_+M*L*O)/H*Math.sin(H*U)+O*Math.cos(H*U))}}else if(M===1)k=H=>s-Math.exp(-L*H)*(O+(_+L*O)*H);else{const H=L*Math.sqrt(M*M-1);k=U=>{const z=Math.exp(-M*L*U),Z=Math.min(H*U,300);return s-z*((_+M*L*O)*Math.sinh(Z)+H*O*Math.cosh(Z))/H}}return{calculatedDuration:y&&d||null,next:H=>{const U=k(H);if(y)o.done=H>=d;else{let z=0;M<1&&(z=H===0?no(_):AE(k,H,U));const Z=Math.abs(z)<=r,R=Math.abs(s-U)<=e;o.done=Z&&R}return o.value=o.done?s:U,o}}}function CE({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:d}){const p=t[0],y={done:!1,value:p},_=W=>a!==void 0&&Wu,M=W=>a===void 0?u:u===void 0||Math.abs(a-W)-O*Math.exp(-W/n),H=W=>B+k(W),U=W=>{const ie=k(W),me=H(W);y.done=Math.abs(ie)<=l,y.value=y.done?B:me};let z,Z;const R=W=>{_(y.value)&&(z=W,Z=IE({keyframes:[y.value,M(y.value)],velocity:AE(H,W,y.value),damping:i,stiffness:s,restDelta:l,restSpeed:d}))};return R(0),{calculatedDuration:null,next:W=>{let ie=!1;return!Z&&z===void 0&&(ie=!0,U(W),R(W)),z!==void 0&&W>=z?Z.next(W-z):(!ie&&U(W),y)}}}const EG=Zl(.42,0,1,1),SG=Zl(0,0,.58,1),TE=Zl(.42,0,.58,1),AG=t=>Array.isArray(t)&&typeof t[0]!="number",Gv=t=>Array.isArray(t)&&typeof t[0]=="number",RE={linear:qn,easeIn:EG,easeInOut:TE,easeOut:SG,circIn:Ov,circInOut:Z8,circOut:X8,backIn:Dv,backInOut:Y8,backOut:G8,anticipate:J8},DE=t=>{if(Gv(t)){Oo(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,r,n,i]=t;return Zl(e,r,n,i)}else if(typeof t=="string")return Oo(RE[t]!==void 0,`Invalid easing type '${t}'`),RE[t];return t},PG=(t,e)=>r=>e(t(r)),No=(...t)=>t.reduce(PG),ju=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},Zr=(t,e,r)=>t+(e-t)*r;function Yv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function MG({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,u=2*r-a;i=Yv(u,a,t+1/3),s=Yv(u,a,t),o=Yv(u,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function H0(t,e){return r=>r>0?e:t}const Jv=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},IG=[Uv,Mc,Fu],CG=t=>IG.find(e=>e.test(t));function OE(t){const e=CG(t);if(ku(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let r=e.parse(t);return e===Fu&&(r=MG(r)),r}const NE=(t,e)=>{const r=OE(t),n=OE(e);if(!r||!n)return H0(t,e);const i={...r};return s=>(i.red=Jv(r.red,n.red,s),i.green=Jv(r.green,n.green,s),i.blue=Jv(r.blue,n.blue,s),i.alpha=Zr(r.alpha,n.alpha,s),Mc.transform(i))},Xv=new Set(["none","hidden"]);function TG(t,e){return Xv.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function RG(t,e){return r=>Zr(t,e,r)}function Zv(t){return typeof t=="number"?RG:typeof t=="string"?Nv(t)?H0:Jn.test(t)?NE:NG:Array.isArray(t)?LE:typeof t=="object"?Jn.test(t)?NE:DG:H0}function LE(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>Zv(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function OG(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=Aa.createTransformer(e),n=rh(t),i=rh(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?Xv.has(t)&&!i.values.length||Xv.has(e)&&!n.values.length?TG(t,e):No(LE(OG(n,i),i.values),r):(ku(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),H0(t,e))};function kE(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Zr(t,e,r):Zv(t)(t,e)}function LG(t,e,r){const n=[],i=r||kE,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=LG(e,n,i),a=o.length,u=l=>{let d=0;if(a>1)for(;du(Ea(t[0],t[s-1],l)):u}function BG(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=ju(0,e,n);t.push(Zr(r,1,i))}}function $G(t){const e=[0];return BG(e,t.length-1),e}function FG(t,e){return t.map(r=>r*e)}function jG(t,e){return t.map(()=>e||TE).splice(0,t.length-1)}function W0({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=AG(n)?n.map(DE):DE(n),s={done:!1,value:e[0]},o=FG(r&&r.length===e.length?r:$G(e),t),a=kG(o,e,{ease:Array.isArray(i)?i:jG(e,i)});return{calculatedDuration:t,next:u=>(s.value=a(u),s.done=u>=t,s)}}const BE=2e4;function UG(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=BE?1/0:e}const qG=t=>{const e=({timestamp:r})=>t(r);return{start:()=>Nr.update(e,!0),stop:()=>_a(e),now:()=>zn.isProcessing?zn.timestamp:so.now()}},zG={decay:CE,inertia:CE,tween:W0,keyframes:W0,spring:IE},HG=t=>t/100;class Qv extends EE{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:u}=this.options;u&&u()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Bv,a=(u,l)=>this.onKeyframesResolved(u,l);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=Wv(r)?r:zG[r]||W0;let u,l;a!==W0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&Oo(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),u=No(HG,kE(e[0],e[1])),e=[0,100]);const d=a({...this.options,keyframes:e});s==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=UG(d));const{calculatedDuration:p}=d,y=p+i,_=y*(n+1)-i;return{generator:d,mirroredGenerator:l,mapPercentToKeyframes:u,calculatedDuration:p,resolvedDuration:y,totalDuration:_}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:W}=this.options;return{done:!0,value:W[W.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:u,calculatedDuration:l,totalDuration:d,resolvedDuration:p}=n;if(this.startTime===null)return s.next(0);const{delay:y,repeat:_,repeatType:M,repeatDelay:O,onUpdate:L}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const B=this.currentTime-y*(this.speed>=0?1:-1),k=this.speed>=0?B<0:B>d;this.currentTime=Math.max(B,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let H=this.currentTime,U=s;if(_){const W=Math.min(this.currentTime,d)/p;let ie=Math.floor(W),me=W%1;!me&&W>=1&&(me=1),me===1&&ie--,ie=Math.min(ie,_+1),!!(ie%2)&&(M==="reverse"?(me=1-me,O&&(me-=O/p)):M==="mirror"&&(U=o)),H=Ea(0,1,me)*p}const z=k?{done:!1,value:u[0]}:U.next(H);a&&(z.value=a(z.value));let{done:Z}=z;!k&&l!==null&&(Z=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const R=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&Z);return R&&i!==void 0&&(z.value=j0(u,this.options,i)),L&&L(z.value),R&&this.finish(),z}get duration(){const{resolved:e}=this;return e?Do(e.calculatedDuration):0}get time(){return Do(this.currentTime)}set time(e){e=no(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=Do(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=qG,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const WG=new Set(["opacity","clipPath","filter","transform"]),KG=10,VG=(t,e)=>{let r="";const n=Math.max(Math.round(e/KG),2);for(let i=0;i(e===void 0&&(e=t()),e)}const GG={linearEasing:void 0};function YG(t,e){const r=eb(t);return()=>{var n;return(n=GG[e])!==null&&n!==void 0?n:r()}}const K0=YG(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function $E(t){return!!(typeof t=="function"&&K0()||!t||typeof t=="string"&&(t in tb||K0())||Gv(t)||Array.isArray(t)&&t.every($E))}const nh=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,tb={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:nh([0,.65,.55,1]),circOut:nh([.55,0,1,.45]),backIn:nh([.31,.01,.66,-.59]),backOut:nh([.33,1.53,.69,.99])};function FE(t,e){if(t)return typeof t=="function"&&K0()?VG(t,e):Gv(t)?nh(t):Array.isArray(t)?t.map(r=>FE(r,e)||tb.easeOut):tb[t]}function JG(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:u}={}){const l={[e]:r};u&&(l.offset=u);const d=FE(a,i);return Array.isArray(d)&&(l.easing=d),t.animate(l,{delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function jE(t,e){t.timeline=e,t.onfinish=null}const XG=eb(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),V0=10,ZG=2e4;function QG(t){return Wv(t.type)||t.type==="spring"||!$E(t.ease)}function eY(t,e){const r=new Qv({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&sthis.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:u,name:l,startTime:d}=this.options;if(!(!((n=u.owner)===null||n===void 0)&&n.current))return!1;if(typeof o=="string"&&K0()&&tY(o)&&(o=UE[o]),QG(this.options)){const{onComplete:y,onUpdate:_,motionValue:M,element:O,...L}=this.options,B=eY(e,L);e=B.keyframes,e.length===1&&(e[1]=e[0]),i=B.duration,s=B.times,o=B.ease,a="keyframes"}const p=JG(u.owner.current,l,e,{...this.options,duration:i,times:s,ease:o});return p.startTime=d??this.calcStartTime(),this.pendingTimeline?(jE(p,this.pendingTimeline),this.pendingTimeline=void 0):p.onfinish=()=>{const{onComplete:y}=this.options;u.set(j0(e,this.options,r)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:p,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return Do(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return Do(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=no(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return qn;const{animation:n}=r;jE(n,e)}return qn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:d,onComplete:p,element:y,..._}=this.options,M=new Qv({..._,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),O=no(this.time);l.setWithVelocity(M.sample(O-V0).value,M.sample(O).value,V0)}const{onStop:u}=this.options;u&&u(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return XG()&&n&&WG.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}const rY=eb(()=>window.ScrollTimeline!==void 0);class nY{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;nrY()&&i.attachTimeline?i.attachTimeline(e):r(i));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function iY({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:u,elapsed:l,...d}){return!!Object.keys(d).length}const rb=(t,e,r,n={},i,s)=>o=>{const a=Tv(n,t)||{},u=a.delay||n.delay||0;let{elapsed:l=0}=n;l=l-no(u);let d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:y=>{e.set(y),a.onUpdate&&a.onUpdate(y)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:i};iY(a)||(d={...d,...EV(t,d)}),d.duration&&(d.duration=no(d.duration)),d.repeatDelay&&(d.repeatDelay=no(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let p=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(p=!0)),p&&!s&&e.get()!==void 0){const y=j0(d.keyframes,a);if(y!==void 0)return Nr.update(()=>{d.onUpdate(y),d.onComplete()}),new nY([])}return!s&&qE.supports(d)?new qE(d):new Qv(d)},sY=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),oY=t=>Pv(t)?t[t.length-1]||0:t;function nb(t,e){t.indexOf(e)===-1&&t.push(e)}function ib(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class sb{constructor(){this.subscriptions=[]}add(e){return nb(this.subscriptions,e),()=>ib(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class cY{constructor(e,r={}){this.version="11.11.17",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=so.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=so.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=aY(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&B0(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new sb);const n=this.events[e].add(r);return e==="change"?()=>{n(),Nr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=so.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>zE)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,zE);return SE(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ih(t,e){return new cY(t,e)}function uY(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,ih(r))}function fY(t,e){const r=F0(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=oY(s[o]);uY(t,o,a)}}const ob=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),HE="data-"+ob("framerAppearId");function WE(t){return t.props[HE]}const Xn=t=>!!(t&&t.getVelocity);function lY(t){return!!(Xn(t)&&t.add)}function ab(t,e){const r=t.getValue("willChange");if(lY(r))return r.add(e)}function hY({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function KE(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...u}=e;n&&(o=n);const l=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const p in u){const y=t.getValue(p,(s=t.latestValues[p])!==null&&s!==void 0?s:null),_=u[p];if(_===void 0||d&&hY(d,p))continue;const M={delay:r,...Tv(o||{},p)};let O=!1;if(window.MotionHandoffAnimation){const B=WE(t);if(B){const k=window.MotionHandoffAnimation(B,p,Nr);k!==null&&(M.startTime=k,O=!0)}}ab(t,p),y.start(rb(p,y,_,t.shouldReduceMotion&&Ac.has(p)?{type:!1}:M,t,O));const L=y.animation;L&&l.push(L)}return a&&Promise.all(l).then(()=>{Nr.update(()=>{a&&fY(t,a)})}),l}function cb(t,e,r={}){var n;const i=F0(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(KE(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:y}=s;return dY(t,e,d+l,p,y,r)}:()=>Promise.resolve(),{when:u}=s;if(u){const[l,d]=u==="beforeChildren"?[o,a]:[a,o];return l().then(()=>d())}else return Promise.all([o(),a(r.delay)])}function dY(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,u=i===1?(l=0)=>l*n:(l=0)=>a-l*n;return Array.from(t.variantChildren).sort(pY).forEach((l,d)=>{l.notify("AnimationStart",e),o.push(cb(l,e,{...s,delay:r+u(d)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function pY(t,e){return t.sortNodePosition(e)}function gY(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>cb(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=cb(t,e,r);else{const i=typeof e=="function"?F0(t,e,r.custom):e;n=Promise.all(KE(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const mY=Cv.length;function VE(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?VE(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;rPromise.all(e.map(({animation:r,options:n})=>gY(t,r,n)))}function wY(t){let e=yY(t),r=GE(),n=!0;const i=u=>(l,d)=>{var p;const y=F0(t,d,u==="exit"?(p=t.presenceContext)===null||p===void 0?void 0:p.custom:void 0);if(y){const{transition:_,transitionEnd:M,...O}=y;l={...l,...O,...M}}return l};function s(u){e=u(t)}function o(u){const{props:l}=t,d=VE(t.parent)||{},p=[],y=new Set;let _={},M=1/0;for(let L=0;LM&&U,ie=!1;const me=Array.isArray(H)?H:[H];let j=me.reduce(i(B),{});z===!1&&(j={});const{prevResolvedValues:E={}}=k,m={...E,...j},f=x=>{W=!0,y.has(x)&&(ie=!0,y.delete(x)),k.needsAnimating[x]=!0;const S=t.getValue(x);S&&(S.liveStyle=!1)};for(const x in m){const S=j[x],A=E[x];if(_.hasOwnProperty(x))continue;let b=!1;Pv(S)&&Pv(A)?b=!q8(S,A):b=S!==A,b?S!=null?f(x):y.add(x):S!==void 0&&y.has(x)?f(x):k.protectedKeys[x]=!0}k.prevProp=H,k.prevResolvedValues=j,k.isActive&&(_={..._,...j}),n&&t.blockInitialAnimation&&(W=!1),W&&(!(Z&&R)||ie)&&p.push(...me.map(x=>({animation:x,options:{type:B}})))}if(y.size){const L={};y.forEach(B=>{const k=t.getBaseTarget(B),H=t.getValue(B);H&&(H.liveStyle=!0),L[B]=k??null}),p.push({animation:L})}let O=!!p.length;return n&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(O=!1),n=!1,O?e(p):Promise.resolve()}function a(u,l){var d;if(r[u].isActive===l)return Promise.resolve();(d=t.variantChildren)===null||d===void 0||d.forEach(y=>{var _;return(_=y.animationState)===null||_===void 0?void 0:_.setActive(u,l)}),r[u].isActive=l;const p=o(u);for(const y in r)r[y].protectedKeys={};return p}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=GE(),n=!0}}}function xY(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!q8(e,t):!1}function Ic(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function GE(){return{animate:Ic(!0),whileInView:Ic(),whileHover:Ic(),whileTap:Ic(),whileDrag:Ic(),whileFocus:Ic(),exit:Ic()}}class Pa{constructor(e){this.isMounted=!1,this.node=e}update(){}}class _Y extends Pa{constructor(e){super(e),e.animationState||(e.animationState=wY(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();$0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let EY=0;class SY extends Pa{constructor(){super(...arguments),this.id=EY++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const AY={animation:{Feature:_Y},exit:{Feature:SY}},YE=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function G0(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const PY=t=>e=>YE(e)&&t(e,G0(e));function Lo(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function ko(t,e,r,n){return Lo(t,e,PY(r),n)}const JE=(t,e)=>Math.abs(t-e);function MY(t,e){const r=JE(t.x,e.x),n=JE(t.y,e.y);return Math.sqrt(r**2+n**2)}class XE{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=fb(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,_=MY(p.offset,{x:0,y:0})>=3;if(!y&&!_)return;const{point:M}=p,{timestamp:O}=zn;this.history.push({...M,timestamp:O});const{onStart:L,onMove:B}=this.handlers;y||(L&&L(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),B&&B(this.lastMoveEvent,p)},this.handlePointerMove=(p,y)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=ub(y,this.transformPagePoint),Nr.update(this.updatePoint,!0)},this.handlePointerUp=(p,y)=>{this.end();const{onEnd:_,onSessionEnd:M,resumeAnimation:O}=this.handlers;if(this.dragSnapToOrigin&&O&&O(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const L=fb(p.type==="pointercancel"?this.lastMoveEventInfo:ub(y,this.transformPagePoint),this.history);this.startEvent&&_&&_(p,L),M&&M(p,L)},!YE(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=G0(e),a=ub(o,this.transformPagePoint),{point:u}=a,{timestamp:l}=zn;this.history=[{...u,timestamp:l}];const{onSessionStart:d}=r;d&&d(e,fb(a,this.history)),this.removeListeners=No(ko(this.contextWindow,"pointermove",this.handlePointerMove),ko(this.contextWindow,"pointerup",this.handlePointerUp),ko(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),_a(this.updatePoint)}}function ub(t,e){return e?{point:e(t.point)}:t}function ZE(t,e){return{x:t.x-e.x,y:t.y-e.y}}function fb({point:t},e){return{point:t,delta:ZE(t,QE(e)),offset:ZE(t,IY(e)),velocity:CY(e,.1)}}function IY(t){return t[0]}function QE(t){return t[t.length-1]}function CY(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=QE(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>no(e)));)r--;if(!n)return{x:0,y:0};const s=Do(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function eS(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const tS=eS("dragHorizontal"),rS=eS("dragVertical");function nS(t){let e=!1;if(t==="y")e=rS();else if(t==="x")e=tS();else{const r=tS(),n=rS();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function iS(){const t=nS(!0);return t?(t(),!1):!0}function Uu(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const sS=1e-4,TY=1-sS,RY=1+sS,oS=.01,DY=0-oS,OY=0+oS;function Ni(t){return t.max-t.min}function NY(t,e,r){return Math.abs(t-e)<=r}function aS(t,e,r,n=.5){t.origin=n,t.originPoint=Zr(e.min,e.max,t.origin),t.scale=Ni(r)/Ni(e),t.translate=Zr(r.min,r.max,t.origin)-t.originPoint,(t.scale>=TY&&t.scale<=RY||isNaN(t.scale))&&(t.scale=1),(t.translate>=DY&&t.translate<=OY||isNaN(t.translate))&&(t.translate=0)}function sh(t,e,r,n){aS(t.x,e.x,r.x,n?n.originX:void 0),aS(t.y,e.y,r.y,n?n.originY:void 0)}function cS(t,e,r){t.min=r.min+e.min,t.max=t.min+Ni(e)}function LY(t,e,r){cS(t.x,e.x,r.x),cS(t.y,e.y,r.y)}function uS(t,e,r){t.min=e.min-r.min,t.max=t.min+Ni(e)}function oh(t,e,r){uS(t.x,e.x,r.x),uS(t.y,e.y,r.y)}function kY(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?Zr(r,t,n.max):Math.min(t,r)),t}function fS(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function BY(t,{top:e,left:r,bottom:n,right:i}){return{x:fS(t.x,r,i),y:fS(t.y,e,n)}}function lS(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=ju(e.min,e.max-n,t.min):n>i&&(r=ju(t.min,t.max-i,e.min)),Ea(0,1,r)}function jY(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const lb=.35;function UY(t=lb){return t===!1?t=0:t===!0&&(t=lb),{x:hS(t,"left","right"),y:hS(t,"top","bottom")}}function hS(t,e,r){return{min:dS(t,e),max:dS(t,r)}}function dS(t,e){return typeof t=="number"?t:t[e]||0}const pS=()=>({translate:0,scale:1,origin:0,originPoint:0}),qu=()=>({x:pS(),y:pS()}),gS=()=>({min:0,max:0}),fn=()=>({x:gS(),y:gS()});function is(t){return[t("x"),t("y")]}function mS({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function qY({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function zY(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function hb(t){return t===void 0||t===1}function db({scale:t,scaleX:e,scaleY:r}){return!hb(t)||!hb(e)||!hb(r)}function Cc(t){return db(t)||vS(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function vS(t){return bS(t.x)||bS(t.y)}function bS(t){return t&&t!=="0%"}function Y0(t,e,r){const n=t-r,i=e*n;return r+i}function yS(t,e,r,n,i){return i!==void 0&&(t=Y0(t,i,n)),Y0(t,r,n)+e}function pb(t,e=0,r=1,n,i){t.min=yS(t.min,e,r,n,i),t.max=yS(t.max,e,r,n,i)}function wS(t,{x:e,y:r}){pb(t.x,e.translate,e.scale,e.originPoint),pb(t.y,r.translate,r.scale,r.originPoint)}const xS=.999999999999,_S=1.0000000000001;function HY(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;axS&&(e.x=1),e.y<_S&&e.y>xS&&(e.y=1)}function zu(t,e){t.min=t.min+e,t.max=t.max+e}function ES(t,e,r,n,i=.5){const s=Zr(t.min,t.max,i);pb(t,e,r,s,n)}function Hu(t,e){ES(t.x,e.x,e.scaleX,e.scale,e.originX),ES(t.y,e.y,e.scaleY,e.scale,e.originY)}function SS(t,e){return mS(zY(t.getBoundingClientRect(),e))}function WY(t,e,r){const n=SS(t,r),{scroll:i}=e;return i&&(zu(n.x,i.offset.x),zu(n.y,i.offset.y)),n}const AS=({current:t})=>t?t.ownerDocument.defaultView:null,KY=new WeakMap;class VY{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=fn(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:p}=this.getProps();p?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(G0(d,"page").point)},s=(d,p)=>{const{drag:y,dragPropagation:_,onDragStart:M}=this.getProps();if(y&&!_&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=nS(y),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),is(L=>{let B=this.getAxisMotionValue(L).get()||0;if(io.test(B)){const{projection:k}=this.visualElement;if(k&&k.layout){const H=k.layout.layoutBox[L];H&&(B=Ni(H)*(parseFloat(B)/100))}}this.originPoint[L]=B}),M&&Nr.postRender(()=>M(d,p)),ab(this.visualElement,"transform");const{animationState:O}=this.visualElement;O&&O.setActive("whileDrag",!0)},o=(d,p)=>{const{dragPropagation:y,dragDirectionLock:_,onDirectionLock:M,onDrag:O}=this.getProps();if(!y&&!this.openGlobalLock)return;const{offset:L}=p;if(_&&this.currentDirection===null){this.currentDirection=GY(L),this.currentDirection!==null&&M&&M(this.currentDirection);return}this.updateAxis("x",p.point,L),this.updateAxis("y",p.point,L),this.visualElement.render(),O&&O(d,p)},a=(d,p)=>this.stop(d,p),u=()=>is(d=>{var p;return this.getAnimationState(d)==="paused"&&((p=this.getAxisMotionValue(d).animation)===null||p===void 0?void 0:p.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new XE(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:AS(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Nr.postRender(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!J0(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=kY(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&Uu(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=BY(i.layoutBox,r):this.constraints=!1,this.elastic=UY(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&is(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=jY(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!Uu(e))return!1;const n=e.current;Oo(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=WY(n,i.root,this.visualElement.getTransformPagePoint());let o=$Y(i.layout.layoutBox,s);if(r){const a=r(qY(o));this.hasMutatedConstraints=!!a,a&&(o=mS(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),u=this.constraints||{},l=is(d=>{if(!J0(d,r,this.currentDirection))return;let p=u&&u[d]||{};o&&(p={min:0,max:0});const y=i?200:1e6,_=i?40:1e7,M={type:"inertia",velocity:n?e[d]:0,bounceStiffness:y,bounceDamping:_,timeConstant:750,restDelta:1,restSpeed:10,...s,...p};return this.startAxisValueAnimation(d,M)});return Promise.all(l).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return ab(this.visualElement,e),n.start(rb(e,n,0,r,this.visualElement,!1))}stopAnimation(){is(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){is(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){is(r=>{const{drag:n}=this.getProps();if(!J0(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-Zr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!Uu(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};is(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const u=a.get();i[o]=FY({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),is(o=>{if(!J0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:u,max:l}=this.constraints[o];a.set(Zr(u,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;KY.set(this.visualElement,this);const e=this.visualElement.current,r=ko(e,"pointerdown",u=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();Uu(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Nr.read(n);const o=Lo(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(is(d=>{const p=this.getAxisMotionValue(d);p&&(this.originPoint[d]+=u[d].translate,p.set(p.get()+u[d].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=lb,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function J0(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function GY(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class YY extends Pa{constructor(e){super(e),this.removeGroupControls=qn,this.removeListeners=qn,this.controls=new VY(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||qn}unmount(){this.removeGroupControls(),this.removeListeners()}}const PS=t=>(e,r)=>{t&&Nr.postRender(()=>t(e,r))};class JY extends Pa{constructor(){super(...arguments),this.removePointerDownListener=qn}onPointerDown(e){this.session=new XE(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:AS(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:PS(e),onStart:PS(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&Nr.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=ko(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const X0=Ee.createContext(null);function XY(){const t=Ee.useContext(X0);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=Ee.useId();Ee.useEffect(()=>n(i),[]);const s=Ee.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const gb=Ee.createContext({}),MS=Ee.createContext({}),Z0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function IS(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ah={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(zt.test(t))t=parseFloat(t);else return t;const r=IS(t,e.target.x),n=IS(t,e.target.y);return`${r}% ${n}%`}},ZY={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=Aa.parse(t);if(i.length>5)return n;const s=Aa.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,u=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=u;const l=Zr(a,u,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),s(i)}},Q0={};function QY(t){Object.assign(Q0,t)}const{schedule:mb}=H8(queueMicrotask,!1);class eJ extends Ee.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;QY(tJ),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),Z0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Nr.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),mb.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function CS(t){const[e,r]=XY(),n=Ee.useContext(gb);return le.jsx(eJ,{...t,layoutGroup:n,switchLayoutGroup:Ee.useContext(MS),isPresent:e,safeToRemove:r})}const tJ={borderRadius:{...ah,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ah,borderTopRightRadius:ah,borderBottomLeftRadius:ah,borderBottomRightRadius:ah,boxShadow:ZY},TS=["TopLeft","TopRight","BottomLeft","BottomRight"],rJ=TS.length,RS=t=>typeof t=="string"?parseFloat(t):t,DS=t=>typeof t=="number"||zt.test(t);function nJ(t,e,r,n,i,s){i?(t.opacity=Zr(0,r.opacity!==void 0?r.opacity:1,iJ(n)),t.opacityExit=Zr(e.opacity!==void 0?e.opacity:1,0,sJ(n))):s&&(t.opacity=Zr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(ju(t,e,n))}function LS(t,e){t.min=e.min,t.max=e.max}function ss(t,e){LS(t.x,e.x),LS(t.y,e.y)}function kS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function BS(t,e,r,n,i){return t-=e,t=Y0(t,1/r,n),i!==void 0&&(t=Y0(t,1/i,n)),t}function oJ(t,e=0,r=1,n=.5,i,s=t,o=t){if(io.test(e)&&(e=parseFloat(e),e=Zr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Zr(s.min,s.max,n);t===s&&(a-=e),t.min=BS(t.min,e,r,a,i),t.max=BS(t.max,e,r,a,i)}function $S(t,e,[r,n,i],s,o){oJ(t,e[r],e[n],e[i],e.scale,s,o)}const aJ=["x","scaleX","originX"],cJ=["y","scaleY","originY"];function FS(t,e,r,n){$S(t.x,e,aJ,r?r.x:void 0,n?n.x:void 0),$S(t.y,e,cJ,r?r.y:void 0,n?n.y:void 0)}function jS(t){return t.translate===0&&t.scale===1}function US(t){return jS(t.x)&&jS(t.y)}function qS(t,e){return t.min===e.min&&t.max===e.max}function uJ(t,e){return qS(t.x,e.x)&&qS(t.y,e.y)}function zS(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function HS(t,e){return zS(t.x,e.x)&&zS(t.y,e.y)}function WS(t){return Ni(t.x)/Ni(t.y)}function KS(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class fJ{constructor(){this.members=[]}add(e){nb(this.members,e),e.scheduleRender()}remove(e){if(ib(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function lJ(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:l,rotate:d,rotateX:p,rotateY:y,skewX:_,skewY:M}=r;l&&(n=`perspective(${l}px) ${n}`),d&&(n+=`rotate(${d}deg) `),p&&(n+=`rotateX(${p}deg) `),y&&(n+=`rotateY(${y}deg) `),_&&(n+=`skewX(${_}deg) `),M&&(n+=`skewY(${M}deg) `)}const a=t.x.scale*e.x,u=t.y.scale*e.y;return(a!==1||u!==1)&&(n+=`scale(${a}, ${u})`),n||"none"}const hJ=(t,e)=>t.depth-e.depth;class dJ{constructor(){this.children=[],this.isDirty=!1}add(e){nb(this.children,e),this.isDirty=!0}remove(e){ib(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(hJ),this.isDirty=!1,this.children.forEach(e)}}function ep(t){const e=Xn(t)?t.get():t;return sY(e)?e.toValue():e}function pJ(t,e){const r=so.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(_a(n),t(s-e))};return Nr.read(n,!0),()=>_a(n)}function gJ(t){return t instanceof SVGElement&&t.tagName!=="svg"}function mJ(t,e,r){const n=Xn(t)?t:ih(t);return n.start(rb("",n,e,r)),n.animation}const Tc={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},ch=typeof window<"u"&&window.MotionDebug!==void 0,vb=["","X","Y","Z"],vJ={visibility:"hidden"},VS=1e3;let bJ=0;function bb(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function GS(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=WE(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Nr,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&GS(n)}function YS({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=bJ++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,ch&&(Tc.totalNodes=Tc.resolvedTargetDeltas=Tc.recalculatedProjection=0),this.nodes.forEach(xJ),this.nodes.forEach(PJ),this.nodes.forEach(MJ),this.nodes.forEach(_J),ch&&window.MotionDebug.record(Tc)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let u=0;uthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,p&&p(),p=pJ(y,250),Z0.hasAnimatedSinceResize&&(Z0.hasAnimatedSinceResize=!1,this.nodes.forEach(XS))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&d&&(u||l)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:y,hasRelativeTargetChanged:_,layout:M})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const O=this.options.transition||d.getDefaultTransition()||DJ,{onLayoutAnimationStart:L,onLayoutAnimationComplete:B}=d.getProps(),k=!this.targetLayout||!HS(this.targetLayout,M)||_,H=!y&&_;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||H||y&&(k||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(p,H);const U={...Tv(O,"layout"),onPlay:L,onComplete:B};(d.shouldReduceMotion||this.options.layoutRoot)&&(U.delay=0,U.type=!1),this.startAnimation(U)}else y||XS(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=M})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,_a(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(IJ),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&GS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u{const z=U/1e3;ZS(p.x,o.x,z),ZS(p.y,o.y,z),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(oh(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),TJ(this.relativeTarget,this.relativeTargetOrigin,y,z),H&&uJ(this.relativeTarget,H)&&(this.isProjectionDirty=!1),H||(H=fn()),ss(H,this.relativeTarget)),O&&(this.animationValues=d,nJ(d,l,this.latestValues,z,k,B)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=z},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(_a(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nr.update(()=>{Z0.hasAnimatedSinceResize=!0,this.currentAnimation=mJ(0,VS,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(VS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:u,layout:l,latestValues:d}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&n7(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||fn();const p=Ni(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+p;const y=Ni(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+y}ss(a,u),Hu(a,d),sh(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new fJ),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(a=!0),!a)return;const l={};u.z&&bb("z",o,l,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(JS),this.root.sharedNodes.clear()}}}function yJ(t){t.updateLayout()}function wJ(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?is(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],_=Ni(y);y.min=n[p].min,y.max=y.min+_}):n7(s,r.layoutBox,n)&&is(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],_=Ni(n[p]);y.max=y.min+_,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[p].max=t.relativeTarget[p].min+_)});const a=qu();sh(a,n,r.layoutBox);const u=qu();o?sh(u,t.applyTransform(i,!0),r.measuredBox):sh(u,n,r.layoutBox);const l=!US(a);let d=!1;if(!t.resumeFrom){const p=t.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:y,layout:_}=p;if(y&&_){const M=fn();oh(M,r.layoutBox,y.layoutBox);const O=fn();oh(O,n,_.layoutBox),HS(M,O)||(d=!0),p.options.layoutRoot&&(t.relativeTarget=O,t.relativeTargetOrigin=M,t.relativeParent=p)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:u,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function xJ(t){ch&&Tc.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function _J(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function EJ(t){t.clearSnapshot()}function JS(t){t.clearMeasurements()}function SJ(t){t.isLayoutDirty=!1}function AJ(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function XS(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function PJ(t){t.resolveTargetDelta()}function MJ(t){t.calcProjection()}function IJ(t){t.resetSkewAndRotation()}function CJ(t){t.removeLeadSnapshot()}function ZS(t,e,r){t.translate=Zr(e.translate,0,r),t.scale=Zr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function QS(t,e,r,n){t.min=Zr(e.min,r.min,n),t.max=Zr(e.max,r.max,n)}function TJ(t,e,r,n){QS(t.x,e.x,r.x,n),QS(t.y,e.y,r.y,n)}function RJ(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const DJ={duration:.45,ease:[.4,0,.1,1]},e7=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),t7=e7("applewebkit/")&&!e7("chrome/")?Math.round:qn;function r7(t){t.min=t7(t.min),t.max=t7(t.max)}function OJ(t){r7(t.x),r7(t.y)}function n7(t,e,r){return t==="position"||t==="preserve-aspect"&&!NY(WS(e),WS(r),.2)}function NJ(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const LJ=YS({attachResizeListener:(t,e)=>Lo(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),yb={current:void 0},i7=YS({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!yb.current){const t=new LJ({});t.mount(window),t.setOptions({layoutScroll:!0}),yb.current=t}return yb.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),kJ={pan:{Feature:JY},drag:{Feature:YY,ProjectionNode:i7,MeasureLayout:CS}};function s7(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||iS())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const u=a[n];u&&Nr.postRender(()=>u(s,o))};return ko(t.current,r,i,{passive:!t.getProps()[n]})}class BJ extends Pa{mount(){this.unmount=No(s7(this.node,!0),s7(this.node,!1))}unmount(){}}class $J extends Pa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=No(Lo(this.node.current,"focus",()=>this.onFocus()),Lo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const o7=(t,e)=>e?t===e?!0:o7(t,e.parentElement):!1;function wb(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,G0(r))}class FJ extends Pa{constructor(){super(...arguments),this.removeStartListeners=qn,this.removeEndListeners=qn,this.removeAccessibleListeners=qn,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=ko(window,"pointerup",(a,u)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:d,globalTapTarget:p}=this.node.getProps(),y=!p&&!o7(this.node.current,a.target)?d:l;y&&Nr.update(()=>y(a,u))},{passive:!(n.onTap||n.onPointerUp)}),o=ko(window,"pointercancel",(a,u)=>this.cancelPress(a,u),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=No(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||wb("up",(u,l)=>{const{onTap:d}=this.node.getProps();d&&Nr.postRender(()=>d(u,l))})};this.removeEndListeners(),this.removeEndListeners=Lo(this.node.current,"keyup",o),wb("down",(a,u)=>{this.startPress(a,u)})},r=Lo(this.node.current,"keydown",e),n=()=>{this.isPressing&&wb("cancel",(s,o)=>this.cancelPress(s,o))},i=Lo(this.node.current,"blur",n);this.removeAccessibleListeners=No(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Nr.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!iS()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Nr.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=ko(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=Lo(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=No(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const xb=new WeakMap,_b=new WeakMap,jJ=t=>{const e=xb.get(t.target);e&&e(t)},UJ=t=>{t.forEach(jJ)};function qJ({root:t,...e}){const r=t||document;_b.has(r)||_b.set(r,{});const n=_b.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(UJ,{root:t,...e})),n[i]}function zJ(t,e,r){const n=qJ(e);return xb.set(t,r),n.observe(t),()=>{xb.delete(t),n.unobserve(t)}}const HJ={some:0,all:1};class WJ extends Pa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:HJ[i]},a=u=>{const{isIntersecting:l}=u;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:p}=this.node.getProps(),y=l?d:p;y&&y(u)};return zJ(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(KJ(e,r))&&this.startObserver()}unmount(){}}function KJ({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const VJ={inView:{Feature:WJ},tap:{Feature:FJ},focus:{Feature:$J},hover:{Feature:BJ}},GJ={layout:{ProjectionNode:i7,MeasureLayout:CS}},Eb=Ee.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),tp=Ee.createContext({}),Sb=typeof window<"u",a7=Sb?Ee.useLayoutEffect:Ee.useEffect,c7=Ee.createContext({strict:!1});function YJ(t,e,r,n,i){var s,o;const{visualElement:a}=Ee.useContext(tp),u=Ee.useContext(c7),l=Ee.useContext(X0),d=Ee.useContext(Eb).reducedMotion,p=Ee.useRef();n=n||u.renderer,!p.current&&n&&(p.current=n(t,{visualState:e,parent:a,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d}));const y=p.current,_=Ee.useContext(MS);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&JJ(p.current,r,i,_);const M=Ee.useRef(!1);Ee.useInsertionEffect(()=>{y&&M.current&&y.update(r,l)});const O=r[HE],L=Ee.useRef(!!O&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,O))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,O)));return a7(()=>{y&&(M.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),mb.render(y.render),L.current&&y.animationState&&y.animationState.animateChanges())}),Ee.useEffect(()=>{y&&(!L.current&&y.animationState&&y.animationState.animateChanges(),L.current&&(queueMicrotask(()=>{var B;(B=window.MotionHandoffMarkAsComplete)===null||B===void 0||B.call(window,O)}),L.current=!1))}),y}function JJ(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:u,layoutRoot:l}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:u7(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&Uu(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:u,layoutRoot:l})}function u7(t){if(t)return t.options.allowProjection!==!1?t.projection:u7(t.parent)}function XJ(t,e,r){return Ee.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):Uu(r)&&(r.current=n))},[e])}function rp(t){return $0(t.animate)||Cv.some(e=>Jl(t[e]))}function f7(t){return!!(rp(t)||t.variants)}function ZJ(t,e){if(rp(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Jl(r)?r:void 0,animate:Jl(n)?n:void 0}}return t.inherit!==!1?e:{}}function QJ(t){const{initial:e,animate:r}=ZJ(t,Ee.useContext(tp));return Ee.useMemo(()=>({initial:e,animate:r}),[l7(e),l7(r)])}function l7(t){return Array.isArray(t)?t.join(" "):t}const h7={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Wu={};for(const t in h7)Wu[t]={isEnabled:e=>h7[t].some(r=>!!e[r])};function eX(t){for(const e in t)Wu[e]={...Wu[e],...t[e]}}const tX=Symbol.for("motionComponentSymbol");function rX({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&eX(t);function s(a,u){let l;const d={...Ee.useContext(Eb),...a,layoutId:nX(a)},{isStatic:p}=d,y=QJ(a),_=n(a,p);if(!p&&Sb){iX(d,t);const M=sX(d);l=M.MeasureLayout,y.visualElement=YJ(i,_,d,e,M.ProjectionNode)}return le.jsxs(tp.Provider,{value:y,children:[l&&y.visualElement?le.jsx(l,{visualElement:y.visualElement,...d}):null,r(i,a,XJ(_,y.visualElement,u),_,p,y.visualElement)]})}const o=Ee.forwardRef(s);return o[tX]=i,o}function nX({layoutId:t}){const e=Ee.useContext(gb).id;return e&&t!==void 0?e+"-"+t:t}function iX(t,e){const r=Ee.useContext(c7).strict;if(process.env.NODE_ENV!=="production"&&e&&r){const n="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?ku(!1,n):Oo(!1,n)}}function sX(t){const{drag:e,layout:r}=Wu;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const oX=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Ab(t){return typeof t!="string"||t.includes("-")?!1:!!(oX.indexOf(t)>-1||/[A-Z]/u.test(t))}function d7(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const p7=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function g7(t,e,r,n){d7(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(p7.has(i)?i:ob(i),e.attrs[i])}function m7(t,{layout:e,layoutId:r}){return Ac.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!Q0[t]||t==="opacity")}function Pb(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(Xn(i[o])||e.style&&Xn(e.style[o])||m7(o,t)||((n=r==null?void 0:r.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function v7(t,e,r){const n=Pb(t,e,r);for(const i in t)if(Xn(t[i])||Xn(e[i])){const s=Xl.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function Mb(t){const e=Ee.useRef(null);return e.current===null&&(e.current=t()),e.current}function aX({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:cX(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const b7=t=>(e,r)=>{const n=Ee.useContext(tp),i=Ee.useContext(X0),s=()=>aX(t,e,n,i);return r?s():Mb(s)};function cX(t,e,r,n){const i={},s=n(t,{});for(const y in s)i[y]=ep(s[y]);let{initial:o,animate:a}=t;const u=rp(t),l=f7(t);e&&l&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const p=d?a:o;if(p&&typeof p!="boolean"&&!$0(p)){const y=Array.isArray(p)?p:[p];for(let _=0;_({style:{},transform:{},transformOrigin:{},vars:{}}),y7=()=>({...Ib(),attrs:{}}),w7=(t,e)=>e&&typeof t=="number"?e.transform(t):t,uX={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},fX=Xl.length;function lX(t,e,r){let n="",i=!0;for(let s=0;stypeof t=="string"&&t.toLowerCase()==="svg",mX={useVisualState:b7({scrapeMotionValuesFromProps:v7,createRenderState:y7,onMount:(t,e,{renderState:r,latestValues:n})=>{Nr.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),Nr.render(()=>{Tb(r,n,Rb(e.tagName),t.transformTemplate),g7(e,r)})}})},vX={useVisualState:b7({scrapeMotionValuesFromProps:Pb,createRenderState:Ib})};function _7(t,e,r){for(const n in e)!Xn(e[n])&&!m7(n,r)&&(t[n]=e[n])}function bX({transformTemplate:t},e){return Ee.useMemo(()=>{const r=Ib();return Cb(r,e,t),Object.assign({},r.vars,r.style)},[e])}function yX(t,e){const r=t.style||{},n={};return _7(n,r,t),Object.assign(n,bX(t,e)),n}function wX(t,e){const r={},n=yX(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const xX=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function np(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||xX.has(t)}let E7=t=>!np(t);function _X(t){t&&(E7=e=>e.startsWith("on")?!np(e):t(e))}try{_X(require("@emotion/is-prop-valid").default)}catch{}function EX(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(E7(i)||r===!0&&np(i)||!e&&!np(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function SX(t,e,r,n){const i=Ee.useMemo(()=>{const s=y7();return Tb(s,e,Rb(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};_7(s,t.style,t),i.style={...s,...i.style}}return i}function AX(t=!1){return(r,n,i,{latestValues:s},o)=>{const u=(Ab(r)?SX:wX)(n,s,o,r),l=EX(n,typeof r=="string",t),d=r!==Ee.Fragment?{...l,...u,ref:i}:{},{children:p}=n,y=Ee.useMemo(()=>Xn(p)?p.get():p,[p]);return Ee.createElement(r,{...d,children:y})}}function PX(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...Ab(n)?mX:vX,preloadedFeatures:t,useRender:AX(i),createVisualElement:e,Component:n};return rX(o)}}const Db={current:null},S7={current:!1};function MX(){if(S7.current=!0,!!Sb)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Db.current=t.matches;t.addListener(e),e()}else Db.current=!1}function IX(t,e,r){for(const n in e){const i=e[n],s=r[n];if(Xn(i))t.addValue(n,i),process.env.NODE_ENV==="development"&&B0(i.version==="11.11.17",`Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`);else if(Xn(s))t.addValue(n,ih(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,ih(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const A7=new WeakMap,CX=[...uE,Jn,Aa],TX=t=>CX.find(cE(t)),P7=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class RX{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Bv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=so.now();this.renderScheduledAtthis.bindToMotionValue(n,r)),S7.current||MX(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Db.current,process.env.NODE_ENV!=="production"&&B0(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){A7.delete(this.current),this.projection&&this.projection.unmount(),_a(this.notifyUpdate),_a(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=Ac.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Nr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Wu){const r=Wu[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):fn()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=ih(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(eE(i)||Q8(i))?i=parseFloat(i):!TX(i)&&Aa.test(r)&&(i=wE(e,r)),this.setBaseTarget(e,Xn(i)?i.get():i)),Xn(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=Mv(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Xn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new sb),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class M7 extends RX{constructor(){super(...arguments),this.KeyframeResolver=xE}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function DX(t){return window.getComputedStyle(t)}class OX extends M7{constructor(){super(...arguments),this.type="html",this.renderInstance=d7}readValueFromInstance(e,r){if(Ac.has(r)){const n=Hv(r);return n&&n.default||0}else{const n=DX(e),i=(rE(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return SS(e,r)}build(e,r,n){Cb(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return Pb(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Xn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class NX extends M7{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=fn}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(Ac.has(r)){const n=Hv(r);return n&&n.default||0}return r=p7.has(r)?r:ob(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return v7(e,r,n)}build(e,r,n){Tb(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){g7(e,r,n,i)}mount(e){this.isSVGTag=Rb(e.tagName),super.mount(e)}}const LX=(t,e)=>Ab(t)?new NX(e):new OX(e,{allowProjection:t!==Ee.Fragment}),kX=PX({...AY,...VJ,...kJ,...GJ},LX),BX=bV(kX);class $X extends Yt.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function FX({children:t,isPresent:e}){const r=Ee.useId(),n=Ee.useRef(null),i=Ee.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=Ee.useContext(Eb);return Ee.useInsertionEffect(()=>{const{width:o,height:a,top:u,left:l}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` [data-motion-pop-id="${r}"] { position: absolute !important; width: ${o}px !important; @@ -199,7 +199,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene top: ${u}px !important; left: ${l}px !important; } - `),()=>{document.head.removeChild(d)}},[e]),le.jsx(BX,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const FX=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=Mb(jX),u=Ee.useId(),l=Ee.useCallback(p=>{a.set(p,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Ee.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:p=>(a.set(p,!1),()=>a.delete(p))}),s?[Math.random(),l]:[r,l]);return Ee.useMemo(()=>{a.forEach((p,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=le.jsx($X,{isPresent:r,children:t})),le.jsx(X0.Provider,{value:d,children:t})};function jX(){return new Map}const ip=t=>t.key||"";function I7(t){const e=[];return Ee.Children.forEach(t,r=>{Ee.isValidElement(r)&&e.push(r)}),e}const UX=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Oo(!e,"Replace exitBeforeEnter with mode='wait'");const a=Ee.useMemo(()=>I7(t),[t]),u=a.map(ip),l=Ee.useRef(!0),d=Ee.useRef(a),p=Mb(()=>new Map),[y,_]=Ee.useState(a),[M,O]=Ee.useState(a);a7(()=>{l.current=!1,d.current=a;for(let k=0;k1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:B}=Ee.useContext(gb);return le.jsx(le.Fragment,{children:M.map(k=>{const H=ip(k),U=a===M||u.includes(H),z=()=>{if(p.has(H))p.set(H,!0);else return;let Z=!0;p.forEach(R=>{R||(Z=!1)}),Z&&(B==null||B(),O(d.current),i&&i())};return le.jsx(FX,{isPresent:U,initial:!l.current||n?void 0:!1,custom:U?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:U?void 0:z,children:k},H)})})},Ms=t=>le.jsx(UX,{children:le.jsx(kX.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Ob(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return le.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,le.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[le.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),le.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:le.jsx(fV,{})})]})]})}function qX(t){return t.lastUsed?le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[le.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[le.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function C7(t){var o,a;const{wallet:e,onClick:r}=t,n=le.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Ee.useMemo(()=>qX(e),[e]);return le.jsx(Ob,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function T7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=VX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Nb);return a[0]===""&&a.length!==1&&a.shift(),R7(a,e)||KX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},R7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?R7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Nb);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},D7=/^\[(.+)\]$/,KX=t=>{if(D7.test(t)){const e=D7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},VX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return YX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Lb(o,n,s,e)}),n},Lb=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:O7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(GX(i)){Lb(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Lb(o,O7(e,s),r,n)})})},O7=(t,e)=>{let r=t;return e.split(Nb).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},GX=t=>t.isThemeGetter,YX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,JX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},N7="!",XX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,p;for(let L=0;Ld?p-d:void 0;return{modifiers:u,hasImportantModifier:_,baseClassName:M,maybePostfixModifierPosition:O}};return r?a=>r({className:a,parseClassName:o}):o},ZX=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},QX=t=>({cache:JX(t.cacheSize),parseClassName:XX(t),...WX(t)}),eZ=/\s+/,tZ=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(eZ);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:_}=r(l);let M=!!_,O=n(M?y.substring(0,_):y);if(!O){if(!M){a=l+(a.length>0?" "+a:a);continue}if(O=n(y),!O){a=l+(a.length>0?" "+a:a);continue}M=!1}const L=ZX(d).join(":"),B=p?L+N7:L,k=B+O;if(s.includes(k))continue;s.push(k);const H=i(O,M);for(let U=0;U0?" "+a:a)}return a};function rZ(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;np(d),t());return r=QX(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=tZ(u,r);return i(u,d),d}return function(){return s(rZ.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},k7=/^\[(?:([a-z-]+):)?(.+)\]$/i,iZ=/^\d+\/\d+$/,sZ=new Set(["px","full","screen"]),oZ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,aZ=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,cZ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,uZ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,fZ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bo=t=>Ku(t)||sZ.has(t)||iZ.test(t),Ma=t=>Vu(t,"length",bZ),Ku=t=>!!t&&!Number.isNaN(Number(t)),kb=t=>Vu(t,"number",Ku),uh=t=>!!t&&Number.isInteger(Number(t)),lZ=t=>t.endsWith("%")&&Ku(t.slice(0,-1)),cr=t=>k7.test(t),Ia=t=>oZ.test(t),hZ=new Set(["length","size","percentage"]),dZ=t=>Vu(t,hZ,B7),pZ=t=>Vu(t,"position",B7),gZ=new Set(["image","url"]),mZ=t=>Vu(t,gZ,wZ),vZ=t=>Vu(t,"",yZ),fh=()=>!0,Vu=(t,e,r)=>{const n=k7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},bZ=t=>aZ.test(t)&&!cZ.test(t),B7=()=>!1,yZ=t=>uZ.test(t),wZ=t=>fZ.test(t),xZ=nZ(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),p=Gr("invert"),y=Gr("gap"),_=Gr("gradientColorStops"),M=Gr("gradientColorStopPositions"),O=Gr("inset"),L=Gr("margin"),B=Gr("opacity"),k=Gr("padding"),H=Gr("saturate"),U=Gr("scale"),z=Gr("sepia"),Z=Gr("skew"),R=Gr("space"),W=Gr("translate"),ie=()=>["auto","contain","none"],me=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",Bo,Ma],f=()=>["auto",Ku,cr],g=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],S=()=>["start","end","center","between","around","evenly","stretch"],A=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>[Ku,cr];return{cacheSize:500,separator:":",theme:{colors:[fh],spacing:[Bo,Ma],blur:["none","",Ia,cr],brightness:P(),borderColor:[t],borderRadius:["none","","full",Ia,cr],borderSpacing:E(),borderWidth:m(),contrast:P(),grayscale:A(),hueRotate:P(),invert:A(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[lZ,Ma],inset:j(),margin:j(),opacity:P(),padding:E(),saturate:P(),scale:P(),sepia:A(),skew:P(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Ia]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...g(),cr]}],overflow:[{overflow:me()}],"overflow-x":[{"overflow-x":me()}],"overflow-y":[{"overflow-y":me()}],overscroll:[{overscroll:ie()}],"overscroll-x":[{"overscroll-x":ie()}],"overscroll-y":[{"overscroll-y":ie()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[O]}],"inset-x":[{"inset-x":[O]}],"inset-y":[{"inset-y":[O]}],start:[{start:[O]}],end:[{end:[O]}],top:[{top:[O]}],right:[{right:[O]}],bottom:[{bottom:[O]}],left:[{left:[O]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",uh,cr]}],basis:[{basis:j()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:A()}],shrink:[{shrink:A()}],order:[{order:["first","last","none",uh,cr]}],"grid-cols":[{"grid-cols":[fh]}],"col-start-end":[{col:["auto",{span:["full",uh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[fh]}],"row-start-end":[{row:["auto",{span:[uh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",...S()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...S(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...S(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[k]}],px:[{px:[k]}],py:[{py:[k]}],ps:[{ps:[k]}],pe:[{pe:[k]}],pt:[{pt:[k]}],pr:[{pr:[k]}],pb:[{pb:[k]}],pl:[{pl:[k]}],m:[{m:[L]}],mx:[{mx:[L]}],my:[{my:[L]}],ms:[{ms:[L]}],me:[{me:[L]}],mt:[{mt:[L]}],mr:[{mr:[L]}],mb:[{mb:[L]}],ml:[{ml:[L]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Ia]},Ia]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Ia,Ma]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",kb]}],"font-family":[{font:[fh]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Ku,kb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Bo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[B]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[B]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Bo,Ma]}],"underline-offset":[{"underline-offset":["auto",Bo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[B]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...g(),pZ]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",dZ]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},mZ]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[M]}],"gradient-via-pos":[{via:[M]}],"gradient-to-pos":[{to:[M]}],"gradient-from":[{from:[_]}],"gradient-via":[{via:[_]}],"gradient-to":[{to:[_]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[B]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[B]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[Bo,cr]}],"outline-w":[{outline:[Bo,Ma]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[B]}],"ring-offset-w":[{"ring-offset":[Bo,Ma]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Ia,vZ]}],"shadow-color":[{shadow:[fh]}],opacity:[{opacity:[B]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Ia,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[p]}],saturate:[{saturate:[H]}],sepia:[{sepia:[z]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[B]}],"backdrop-saturate":[{"backdrop-saturate":[H]}],"backdrop-sepia":[{"backdrop-sepia":[z]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:P()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:P()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[U]}],"scale-x":[{"scale-x":[U]}],"scale-y":[{"scale-y":[U]}],rotate:[{rotate:[uh,cr]}],"translate-x":[{"translate-x":[W]}],"translate-y":[{"translate-y":[W]}],"skew-x":[{"skew-x":[Z]}],"skew-y":[{"skew-y":[Z]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Bo,Ma,kb]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function $o(...t){return xZ(HX(t))}function $7(t){const{className:e}=t;return le.jsxs("div",{className:$o("xc-flex xc-items-center xc-gap-2"),children:[le.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)}),le.jsx("div",{className:"xc-shrink-0",children:t.children}),le.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)})]})}function _Z(t){var n,i;const{wallet:e,onClick:r}=t;return le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[le.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(n=e.config)==null?void 0:n.image,alt:""}),le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsxs("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:["Connect to ",(i=e.config)==null?void 0:i.name]}),le.jsx("div",{className:"xc-flex xc-gap-2",children:le.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:()=>r(e),children:"Connect"})})]})]})}const EZ="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function SZ(t){const{onClick:e}=t;function r(){e&&e()}return le.jsx($7,{className:"xc-opacity-20",children:le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[le.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),le.jsx($8,{size:16})]})})}function F7(t){const[e,r]=Ee.useState(""),{featuredWallets:n,initialized:i}=Yl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Ee.useMemo(()=>{const O=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,L=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!O.test(e)&&L.test(e)},[e]);function p(O){o(O)}function y(O){r(O.target.value)}async function _(){s(e)}function M(O){O.key==="Enter"&&d&&_()}return le.jsx(Ms,{children:i&&le.jsxs(le.Fragment,{children:[t.header||le.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),n.length===1&&le.jsx("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:n.map(O=>le.jsx(_Z,{wallet:O,onClick:p},`feature-${O.key}`))}),n.length>1&&le.jsxs(le.Fragment,{children:[le.jsxs("div",{children:[le.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(O=>le.jsx(C7,{wallet:O,onClick:p},`feature-${O.key}`)),l.showTonConnect&&le.jsx(Ob,{icon:le.jsx("img",{className:"xc-h-5 xc-w-5",src:EZ}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&le.jsx(SZ,{onClick:a})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&le.jsx("div",{className:"xc-mb-4 xc-mt-4",children:le.jsxs($7,{className:"xc-opacity-20",children:[" ",le.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),l.showEmailSignIn&&le.jsxs("div",{className:"xc-mb-4",children:[le.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:y,onKeyDown:M}),le.jsx("button",{disabled:!d,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:_,children:"Continue"})]})]})]})})}function Tc(t){const{title:e}=t;return le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[le.jsx(uV,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),le.jsx("span",{children:e})]})}const j7=Ee.createContext({channel:"",device:"WEB",app:"",inviterCode:"",role:"C"});function Bb(){return Ee.useContext(j7)}function AZ(t){const{config:e}=t,[r,n]=Ee.useState(e.channel),[i,s]=Ee.useState(e.device),[o,a]=Ee.useState(e.app),[u,l]=Ee.useState(e.role||"C"),[d,p]=Ee.useState(e.inviterCode);return Ee.useEffect(()=>{n(e.channel),s(e.device),a(e.app),p(e.inviterCode),l(e.role||"C")},[e]),le.jsx(j7.Provider,{value:{channel:r,device:i,app:o,inviterCode:d,role:u},children:t.children})}var PZ=Object.defineProperty,MZ=Object.defineProperties,IZ=Object.getOwnPropertyDescriptors,sp=Object.getOwnPropertySymbols,U7=Object.prototype.hasOwnProperty,q7=Object.prototype.propertyIsEnumerable,z7=(t,e,r)=>e in t?PZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,CZ=(t,e)=>{for(var r in e||(e={}))U7.call(e,r)&&z7(t,r,e[r]);if(sp)for(var r of sp(e))q7.call(e,r)&&z7(t,r,e[r]);return t},TZ=(t,e)=>MZ(t,IZ(e)),RZ=(t,e)=>{var r={};for(var n in t)U7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&sp)for(var n of sp(t))e.indexOf(n)<0&&q7.call(t,n)&&(r[n]=t[n]);return r};function DZ(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function OZ(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var NZ=18,H7=40,LZ=`${H7}px`,kZ=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function BZ({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),p=Yt.useCallback(()=>{let y=t.current,_=e.current;if(!y||!_||u||r==="none")return;let M=y,O=M.getBoundingClientRect().left+M.offsetWidth,L=M.getBoundingClientRect().top+M.offsetHeight/2,B=O-NZ,k=L;document.querySelectorAll(kZ).length===0&&document.elementFromPoint(B,k)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function _(){let O=window.innerWidth-y.getBoundingClientRect().right;a(O>=H7)}_();let M=setInterval(_,1e3);return()=>{clearInterval(M)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let _=setTimeout(p,0),M=setTimeout(p,2e3),O=setTimeout(p,5e3),L=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(_),clearTimeout(M),clearTimeout(O),clearTimeout(L)}},[e,n,r,p]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:LZ}}var W7=Yt.createContext({}),K7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:p="increase-width",pasteTransformer:y,containerClassName:_,noScriptCSSFallback:M=$Z,render:O,children:L}=r,B=RZ(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),k,H,U,z,Z;let[R,W]=Yt.useState(typeof B.defaultValue=="string"?B.defaultValue:""),ie=n??R,me=OZ(ie),j=Yt.useCallback(oe=>{i==null||i(oe),W(oe)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),g=Yt.useRef({value:ie,onChange:j,isIOS:typeof window<"u"&&((H=(k=window==null?void 0:window.CSS)==null?void 0:k.supports)==null?void 0:H.call(k,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(U=m.current)==null?void 0:U.selectionStart,(z=m.current)==null?void 0:z.selectionEnd,(Z=m.current)==null?void 0:Z.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let oe=m.current,fe=f.current;if(!oe||!fe)return;g.current.value!==oe.value&&g.current.onChange(oe.value),v.current.prev=[oe.selectionStart,oe.selectionEnd,oe.selectionDirection];function be(){if(document.activeElement!==oe){I(null),ce(null);return}let Te=oe.selectionStart,$e=oe.selectionEnd,Ie=oe.selectionDirection,Le=oe.maxLength,Ve=oe.value,ke=v.current.prev,ze=-1,He=-1,Se;if(Ve.length!==0&&Te!==null&&$e!==null){let et=Te===$e,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let gt=0;if(ke[0]!==null&&ke[1]!==null){Se=Je{fe&&fe.style.setProperty("--root-height",`${oe.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(oe),()=>{document.removeEventListener("selectionchange",be,{capture:!0}),Ne.disconnect()}},[]);let[x,S]=Yt.useState(!1),[A,b]=Yt.useState(!1),[P,I]=Yt.useState(null),[F,ce]=Yt.useState(null);Yt.useEffect(()=>{DZ(()=>{var oe,fe,be,Me;(oe=m.current)==null||oe.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(be=m.current)==null?void 0:be.selectionEnd,$e=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ce(Te),v.current.prev=[Ne,Te,$e])})},[ie,A]),Yt.useEffect(()=>{me!==void 0&&ie!==me&&me.length{let fe=oe.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){oe.preventDefault();return}typeof me=="string"&&fe.length{var oe;if(m.current){let fe=Math.min(m.current.value.length,s-1),be=m.current.value.length;(oe=m.current)==null||oe.setSelectionRange(fe,be),I(fe),ce(be)}b(!0)},[s]),J=Yt.useCallback(oe=>{var fe,be;let Me=m.current;if(!y&&(!g.current.isIOS||!oe.clipboardData||!Me))return;let Ne=oe.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),oe.preventDefault();let $e=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(be=m.current)==null?void 0:be.selectionEnd,Le=($e!==Ie?ie.slice(0,$e)+Te+ie.slice(Ie):ie.slice(0,$e)+Te+ie.slice($e)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,j(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ce(ke)},[s,j,E,ie]),Q=Yt.useMemo(()=>({position:"relative",cursor:B.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[B.disabled]),T=Yt.useMemo(()=>({position:"absolute",inset:0,width:D.willPushPWMBadge?`calc(100% + ${D.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:D.willPushPWMBadge?`inset(0 ${D.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[D.PWM_BADGE_SPACE_WIDTH,D.willPushPWMBadge,o]),X=Yt.useMemo(()=>Yt.createElement("input",TZ(CZ({autoComplete:B.autoComplete||"one-time-code"},B),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ie.length===0||void 0,"data-input-otp-mss":P,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:T,maxLength:s,value:ie,ref:m,onPaste:oe=>{var fe;J(oe),(fe=B.onPaste)==null||fe.call(B,oe)},onChange:se,onMouseOver:oe=>{var fe;S(!0),(fe=B.onMouseOver)==null||fe.call(B,oe)},onMouseLeave:oe=>{var fe;S(!1),(fe=B.onMouseLeave)==null||fe.call(B,oe)},onFocus:oe=>{var fe;ee(),(fe=B.onFocus)==null||fe.call(B,oe)},onBlur:oe=>{var fe;b(!1),(fe=B.onBlur)==null||fe.call(B,oe)}})),[se,ee,J,l,T,s,F,P,B,E==null?void 0:E.source,ie]),re=Yt.useMemo(()=>({slots:Array.from({length:s}).map((oe,fe)=>{var be;let Me=A&&P!==null&&F!==null&&(P===F&&fe===P||fe>=P&&feO?O(re):Yt.createElement(W7.Provider,{value:re},L),[L,re,O]);return Yt.createElement(Yt.Fragment,null,M!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,M)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:_},ge,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},X)))});K7.displayName="Input";function lh(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var $Z=` + `),()=>{document.head.removeChild(d)}},[e]),le.jsx($X,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const jX=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=Mb(UX),u=Ee.useId(),l=Ee.useCallback(p=>{a.set(p,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Ee.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:p=>(a.set(p,!1),()=>a.delete(p))}),s?[Math.random(),l]:[r,l]);return Ee.useMemo(()=>{a.forEach((p,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=le.jsx(FX,{isPresent:r,children:t})),le.jsx(X0.Provider,{value:d,children:t})};function UX(){return new Map}const ip=t=>t.key||"";function I7(t){const e=[];return Ee.Children.forEach(t,r=>{Ee.isValidElement(r)&&e.push(r)}),e}const qX=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Oo(!e,"Replace exitBeforeEnter with mode='wait'");const a=Ee.useMemo(()=>I7(t),[t]),u=a.map(ip),l=Ee.useRef(!0),d=Ee.useRef(a),p=Mb(()=>new Map),[y,_]=Ee.useState(a),[M,O]=Ee.useState(a);a7(()=>{l.current=!1,d.current=a;for(let k=0;k1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:B}=Ee.useContext(gb);return le.jsx(le.Fragment,{children:M.map(k=>{const H=ip(k),U=a===M||u.includes(H),z=()=>{if(p.has(H))p.set(H,!0);else return;let Z=!0;p.forEach(R=>{R||(Z=!1)}),Z&&(B==null||B(),O(d.current),i&&i())};return le.jsx(jX,{isPresent:U,initial:!l.current||n?void 0:!1,custom:U?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:U?void 0:z,children:k},H)})})},Ms=t=>le.jsx(qX,{children:le.jsx(BX.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Ob(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return le.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,le.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[le.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),le.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:le.jsx(lV,{})})]})]})}function zX(t){return t.lastUsed?le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[le.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[le.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function C7(t){var o,a;const{wallet:e,onClick:r}=t,n=le.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Ee.useMemo(()=>zX(e),[e]);return le.jsx(Ob,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function T7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=GX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Nb);return a[0]===""&&a.length!==1&&a.shift(),R7(a,e)||VX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},R7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?R7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Nb);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},D7=/^\[(.+)\]$/,VX=t=>{if(D7.test(t)){const e=D7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},GX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return JX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Lb(o,n,s,e)}),n},Lb=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:O7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(YX(i)){Lb(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Lb(o,O7(e,s),r,n)})})},O7=(t,e)=>{let r=t;return e.split(Nb).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},YX=t=>t.isThemeGetter,JX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,XX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},N7="!",ZX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,p;for(let L=0;Ld?p-d:void 0;return{modifiers:u,hasImportantModifier:_,baseClassName:M,maybePostfixModifierPosition:O}};return r?a=>r({className:a,parseClassName:o}):o},QX=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},eZ=t=>({cache:XX(t.cacheSize),parseClassName:ZX(t),...KX(t)}),tZ=/\s+/,rZ=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(tZ);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:_}=r(l);let M=!!_,O=n(M?y.substring(0,_):y);if(!O){if(!M){a=l+(a.length>0?" "+a:a);continue}if(O=n(y),!O){a=l+(a.length>0?" "+a:a);continue}M=!1}const L=QX(d).join(":"),B=p?L+N7:L,k=B+O;if(s.includes(k))continue;s.push(k);const H=i(O,M);for(let U=0;U0?" "+a:a)}return a};function nZ(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;np(d),t());return r=eZ(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=rZ(u,r);return i(u,d),d}return function(){return s(nZ.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},k7=/^\[(?:([a-z-]+):)?(.+)\]$/i,sZ=/^\d+\/\d+$/,oZ=new Set(["px","full","screen"]),aZ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,cZ=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,uZ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,fZ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,lZ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bo=t=>Ku(t)||oZ.has(t)||sZ.test(t),Ma=t=>Vu(t,"length",yZ),Ku=t=>!!t&&!Number.isNaN(Number(t)),kb=t=>Vu(t,"number",Ku),uh=t=>!!t&&Number.isInteger(Number(t)),hZ=t=>t.endsWith("%")&&Ku(t.slice(0,-1)),cr=t=>k7.test(t),Ia=t=>aZ.test(t),dZ=new Set(["length","size","percentage"]),pZ=t=>Vu(t,dZ,B7),gZ=t=>Vu(t,"position",B7),mZ=new Set(["image","url"]),vZ=t=>Vu(t,mZ,xZ),bZ=t=>Vu(t,"",wZ),fh=()=>!0,Vu=(t,e,r)=>{const n=k7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},yZ=t=>cZ.test(t)&&!uZ.test(t),B7=()=>!1,wZ=t=>fZ.test(t),xZ=t=>lZ.test(t),_Z=iZ(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),p=Gr("invert"),y=Gr("gap"),_=Gr("gradientColorStops"),M=Gr("gradientColorStopPositions"),O=Gr("inset"),L=Gr("margin"),B=Gr("opacity"),k=Gr("padding"),H=Gr("saturate"),U=Gr("scale"),z=Gr("sepia"),Z=Gr("skew"),R=Gr("space"),W=Gr("translate"),ie=()=>["auto","contain","none"],me=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",Bo,Ma],f=()=>["auto",Ku,cr],g=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],S=()=>["start","end","center","between","around","evenly","stretch"],A=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>[Ku,cr];return{cacheSize:500,separator:":",theme:{colors:[fh],spacing:[Bo,Ma],blur:["none","",Ia,cr],brightness:P(),borderColor:[t],borderRadius:["none","","full",Ia,cr],borderSpacing:E(),borderWidth:m(),contrast:P(),grayscale:A(),hueRotate:P(),invert:A(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[hZ,Ma],inset:j(),margin:j(),opacity:P(),padding:E(),saturate:P(),scale:P(),sepia:A(),skew:P(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Ia]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...g(),cr]}],overflow:[{overflow:me()}],"overflow-x":[{"overflow-x":me()}],"overflow-y":[{"overflow-y":me()}],overscroll:[{overscroll:ie()}],"overscroll-x":[{"overscroll-x":ie()}],"overscroll-y":[{"overscroll-y":ie()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[O]}],"inset-x":[{"inset-x":[O]}],"inset-y":[{"inset-y":[O]}],start:[{start:[O]}],end:[{end:[O]}],top:[{top:[O]}],right:[{right:[O]}],bottom:[{bottom:[O]}],left:[{left:[O]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",uh,cr]}],basis:[{basis:j()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:A()}],shrink:[{shrink:A()}],order:[{order:["first","last","none",uh,cr]}],"grid-cols":[{"grid-cols":[fh]}],"col-start-end":[{col:["auto",{span:["full",uh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[fh]}],"row-start-end":[{row:["auto",{span:[uh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",...S()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...S(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...S(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[k]}],px:[{px:[k]}],py:[{py:[k]}],ps:[{ps:[k]}],pe:[{pe:[k]}],pt:[{pt:[k]}],pr:[{pr:[k]}],pb:[{pb:[k]}],pl:[{pl:[k]}],m:[{m:[L]}],mx:[{mx:[L]}],my:[{my:[L]}],ms:[{ms:[L]}],me:[{me:[L]}],mt:[{mt:[L]}],mr:[{mr:[L]}],mb:[{mb:[L]}],ml:[{ml:[L]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Ia]},Ia]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Ia,Ma]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",kb]}],"font-family":[{font:[fh]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Ku,kb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Bo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[B]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[B]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Bo,Ma]}],"underline-offset":[{"underline-offset":["auto",Bo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[B]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...g(),gZ]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",pZ]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},vZ]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[M]}],"gradient-via-pos":[{via:[M]}],"gradient-to-pos":[{to:[M]}],"gradient-from":[{from:[_]}],"gradient-via":[{via:[_]}],"gradient-to":[{to:[_]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[B]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[B]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[Bo,cr]}],"outline-w":[{outline:[Bo,Ma]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[B]}],"ring-offset-w":[{"ring-offset":[Bo,Ma]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Ia,bZ]}],"shadow-color":[{shadow:[fh]}],opacity:[{opacity:[B]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Ia,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[p]}],saturate:[{saturate:[H]}],sepia:[{sepia:[z]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[B]}],"backdrop-saturate":[{"backdrop-saturate":[H]}],"backdrop-sepia":[{"backdrop-sepia":[z]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:P()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:P()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[U]}],"scale-x":[{"scale-x":[U]}],"scale-y":[{"scale-y":[U]}],rotate:[{rotate:[uh,cr]}],"translate-x":[{"translate-x":[W]}],"translate-y":[{"translate-y":[W]}],"skew-x":[{"skew-x":[Z]}],"skew-y":[{"skew-y":[Z]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Bo,Ma,kb]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function $o(...t){return _Z(WX(t))}function $7(t){const{className:e}=t;return le.jsxs("div",{className:$o("xc-flex xc-items-center xc-gap-2"),children:[le.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)}),le.jsx("div",{className:"xc-shrink-0",children:t.children}),le.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)})]})}function EZ(t){var n,i;const{wallet:e,onClick:r}=t;return le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[le.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(n=e.config)==null?void 0:n.image,alt:""}),le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsxs("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:["Connect to ",(i=e.config)==null?void 0:i.name]}),le.jsx("div",{className:"xc-flex xc-gap-2",children:le.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:()=>r(e),children:"Connect"})})]})]})}const SZ="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function AZ(t){const{onClick:e}=t;function r(){e&&e()}return le.jsx($7,{className:"xc-opacity-20",children:le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[le.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),le.jsx($8,{size:16})]})})}function F7(t){const[e,r]=Ee.useState(""),{featuredWallets:n,initialized:i}=Yl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Ee.useMemo(()=>{const O=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,L=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!O.test(e)&&L.test(e)},[e]);function p(O){o(O)}function y(O){r(O.target.value)}async function _(){s(e)}function M(O){O.key==="Enter"&&d&&_()}return le.jsx(Ms,{children:i&&le.jsxs(le.Fragment,{children:[t.header||le.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),n.length===1&&le.jsx("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:n.map(O=>le.jsx(EZ,{wallet:O,onClick:p},`feature-${O.key}`))}),n.length>1&&le.jsxs(le.Fragment,{children:[le.jsxs("div",{children:[le.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(O=>le.jsx(C7,{wallet:O,onClick:p},`feature-${O.key}`)),l.showTonConnect&&le.jsx(Ob,{icon:le.jsx("img",{className:"xc-h-5 xc-w-5",src:SZ}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&le.jsx(AZ,{onClick:a})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&le.jsx("div",{className:"xc-mb-4 xc-mt-4",children:le.jsxs($7,{className:"xc-opacity-20",children:[" ",le.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),l.showEmailSignIn&&le.jsxs("div",{className:"xc-mb-4",children:[le.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:y,onKeyDown:M}),le.jsx("button",{disabled:!d,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:_,children:"Continue"})]})]})]})})}function Rc(t){const{title:e}=t;return le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[le.jsx(fV,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),le.jsx("span",{children:e})]})}const j7=Ee.createContext({channel:"",device:"WEB",app:"",inviterCode:"",role:"C"});function Bb(){return Ee.useContext(j7)}function PZ(t){const{config:e}=t,[r,n]=Ee.useState(e.channel),[i,s]=Ee.useState(e.device),[o,a]=Ee.useState(e.app),[u,l]=Ee.useState(e.role||"C"),[d,p]=Ee.useState(e.inviterCode);return Ee.useEffect(()=>{n(e.channel),s(e.device),a(e.app),p(e.inviterCode),l(e.role||"C")},[e]),le.jsx(j7.Provider,{value:{channel:r,device:i,app:o,inviterCode:d,role:u},children:t.children})}var MZ=Object.defineProperty,IZ=Object.defineProperties,CZ=Object.getOwnPropertyDescriptors,sp=Object.getOwnPropertySymbols,U7=Object.prototype.hasOwnProperty,q7=Object.prototype.propertyIsEnumerable,z7=(t,e,r)=>e in t?MZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,TZ=(t,e)=>{for(var r in e||(e={}))U7.call(e,r)&&z7(t,r,e[r]);if(sp)for(var r of sp(e))q7.call(e,r)&&z7(t,r,e[r]);return t},RZ=(t,e)=>IZ(t,CZ(e)),DZ=(t,e)=>{var r={};for(var n in t)U7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&sp)for(var n of sp(t))e.indexOf(n)<0&&q7.call(t,n)&&(r[n]=t[n]);return r};function OZ(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function NZ(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var LZ=18,H7=40,kZ=`${H7}px`,BZ=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function $Z({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),p=Yt.useCallback(()=>{let y=t.current,_=e.current;if(!y||!_||u||r==="none")return;let M=y,O=M.getBoundingClientRect().left+M.offsetWidth,L=M.getBoundingClientRect().top+M.offsetHeight/2,B=O-LZ,k=L;document.querySelectorAll(BZ).length===0&&document.elementFromPoint(B,k)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function _(){let O=window.innerWidth-y.getBoundingClientRect().right;a(O>=H7)}_();let M=setInterval(_,1e3);return()=>{clearInterval(M)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let _=setTimeout(p,0),M=setTimeout(p,2e3),O=setTimeout(p,5e3),L=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(_),clearTimeout(M),clearTimeout(O),clearTimeout(L)}},[e,n,r,p]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:kZ}}var W7=Yt.createContext({}),K7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:p="increase-width",pasteTransformer:y,containerClassName:_,noScriptCSSFallback:M=FZ,render:O,children:L}=r,B=DZ(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),k,H,U,z,Z;let[R,W]=Yt.useState(typeof B.defaultValue=="string"?B.defaultValue:""),ie=n??R,me=NZ(ie),j=Yt.useCallback(oe=>{i==null||i(oe),W(oe)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),g=Yt.useRef({value:ie,onChange:j,isIOS:typeof window<"u"&&((H=(k=window==null?void 0:window.CSS)==null?void 0:k.supports)==null?void 0:H.call(k,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(U=m.current)==null?void 0:U.selectionStart,(z=m.current)==null?void 0:z.selectionEnd,(Z=m.current)==null?void 0:Z.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let oe=m.current,fe=f.current;if(!oe||!fe)return;g.current.value!==oe.value&&g.current.onChange(oe.value),v.current.prev=[oe.selectionStart,oe.selectionEnd,oe.selectionDirection];function be(){if(document.activeElement!==oe){I(null),ce(null);return}let Te=oe.selectionStart,$e=oe.selectionEnd,Ie=oe.selectionDirection,Le=oe.maxLength,Ve=oe.value,ke=v.current.prev,ze=-1,He=-1,Se;if(Ve.length!==0&&Te!==null&&$e!==null){let et=Te===$e,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let gt=0;if(ke[0]!==null&&ke[1]!==null){Se=Je{fe&&fe.style.setProperty("--root-height",`${oe.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(oe),()=>{document.removeEventListener("selectionchange",be,{capture:!0}),Ne.disconnect()}},[]);let[x,S]=Yt.useState(!1),[A,b]=Yt.useState(!1),[P,I]=Yt.useState(null),[F,ce]=Yt.useState(null);Yt.useEffect(()=>{OZ(()=>{var oe,fe,be,Me;(oe=m.current)==null||oe.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(be=m.current)==null?void 0:be.selectionEnd,$e=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ce(Te),v.current.prev=[Ne,Te,$e])})},[ie,A]),Yt.useEffect(()=>{me!==void 0&&ie!==me&&me.length{let fe=oe.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){oe.preventDefault();return}typeof me=="string"&&fe.length{var oe;if(m.current){let fe=Math.min(m.current.value.length,s-1),be=m.current.value.length;(oe=m.current)==null||oe.setSelectionRange(fe,be),I(fe),ce(be)}b(!0)},[s]),J=Yt.useCallback(oe=>{var fe,be;let Me=m.current;if(!y&&(!g.current.isIOS||!oe.clipboardData||!Me))return;let Ne=oe.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),oe.preventDefault();let $e=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(be=m.current)==null?void 0:be.selectionEnd,Le=($e!==Ie?ie.slice(0,$e)+Te+ie.slice(Ie):ie.slice(0,$e)+Te+ie.slice($e)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,j(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ce(ke)},[s,j,E,ie]),Q=Yt.useMemo(()=>({position:"relative",cursor:B.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[B.disabled]),T=Yt.useMemo(()=>({position:"absolute",inset:0,width:D.willPushPWMBadge?`calc(100% + ${D.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:D.willPushPWMBadge?`inset(0 ${D.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[D.PWM_BADGE_SPACE_WIDTH,D.willPushPWMBadge,o]),X=Yt.useMemo(()=>Yt.createElement("input",RZ(TZ({autoComplete:B.autoComplete||"one-time-code"},B),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ie.length===0||void 0,"data-input-otp-mss":P,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:T,maxLength:s,value:ie,ref:m,onPaste:oe=>{var fe;J(oe),(fe=B.onPaste)==null||fe.call(B,oe)},onChange:se,onMouseOver:oe=>{var fe;S(!0),(fe=B.onMouseOver)==null||fe.call(B,oe)},onMouseLeave:oe=>{var fe;S(!1),(fe=B.onMouseLeave)==null||fe.call(B,oe)},onFocus:oe=>{var fe;ee(),(fe=B.onFocus)==null||fe.call(B,oe)},onBlur:oe=>{var fe;b(!1),(fe=B.onBlur)==null||fe.call(B,oe)}})),[se,ee,J,l,T,s,F,P,B,E==null?void 0:E.source,ie]),re=Yt.useMemo(()=>({slots:Array.from({length:s}).map((oe,fe)=>{var be;let Me=A&&P!==null&&F!==null&&(P===F&&fe===P||fe>=P&&feO?O(re):Yt.createElement(W7.Provider,{value:re},L),[L,re,O]);return Yt.createElement(Yt.Fragment,null,M!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,M)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:_},ge,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},X)))});K7.displayName="Input";function lh(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var FZ=` [data-input-otp] { --nojs-bg: white !important; --nojs-fg: black !important; @@ -218,11 +218,11 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene --nojs-bg: black !important; --nojs-fg: white !important; } -}`;const V7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>le.jsx(K7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));V7.displayName="InputOTP";const G7=Yt.forwardRef(({className:t,...e},r)=>le.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));G7.displayName="InputOTPGroup";const Rc=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(W7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return le.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&le.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:le.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Rc.displayName="InputOTPSlot";function FZ(t){const{spinning:e,children:r,className:n}=t;return le.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&le.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:le.jsx(Ec,{className:"xc-animate-spin"})})]})}function Y7(t){const{email:e}=t,[r,n]=Ee.useState(0),[i,s]=Ee.useState(!1),[o,a]=Ee.useState("");async function u(){n(60);const d=setInterval(()=>{n(p=>p===0?(clearInterval(d),0):p-1)},1e3)}async function l(d){if(a(""),!(d.length<6)){s(!0);try{await t.onInputCode(e,d)}catch(p){a(p.message)}s(!1)}}return Ee.useEffect(()=>{u()},[]),le.jsxs(Ms,{children:[le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[le.jsx(gV,{className:"xc-mb-4",size:60}),le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:[le.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),le.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]}),le.jsx("div",{className:"xc-mb-2 xc-h-12",children:le.jsx(FZ,{spinning:i,className:"xc-rounded-xl",children:le.jsx(V7,{maxLength:6,onChange:l,disabled:i,className:"disabled:xc-opacity-20",children:le.jsx(G7,{children:le.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[le.jsx(Rc,{index:0}),le.jsx(Rc,{index:1}),le.jsx(Rc,{index:2}),le.jsx(Rc,{index:3}),le.jsx(Rc,{index:4}),le.jsx(Rc,{index:5})]})})})})}),o&&le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{children:o})})]}),le.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Resend in ${r}s`:le.jsx("button",{id:"sendCodeButton",onClick:t.onResendCode,children:"Send again"})]}),le.jsx("div",{id:"captcha-element"})]})}function J7(t){const{email:e}=t,[r,n]=Ee.useState(!1),[i,s]=Ee.useState(""),o=Ee.useMemo(()=>`xn-btn-${new Date().getTime()}`,[e]);async function a(y,_){n(!0),s(""),await xa.getEmailCode({account_type:"email",email:y},_),n(!1)}async function u(y){try{return await a(e,JSON.stringify(y)),{captchaResult:!0,bizResult:!0}}catch(_){return s(_.message),{captchaResult:!1,bizResult:!1}}}async function l(y){y&&t.onCodeSend()}const d=Ee.useRef();function p(y){d.current=y}return Ee.useEffect(()=>{if(e)return window.initAliyunCaptcha({SceneId:"tqyu8129d",prefix:"1mfsn5f",mode:"popup",element:"#captcha-element",button:`#${o}`,captchaVerifyCallback:u,onBizResultCallback:l,getInstance:p,slideStyle:{width:360,height:40},language:"en",region:"cn"}),()=>{var y,_;(y=document.getElementById("aliyunCaptcha-mask"))==null||y.remove(),(_=document.getElementById("aliyunCaptcha-window-popup"))==null||_.remove()}},[e]),le.jsxs(Ms,{children:[le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[le.jsx(mV,{className:"xc-mb-4",size:60}),le.jsx("button",{className:"xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2",id:o,children:r?le.jsx(Ec,{className:"xc-animate-spin"}):"I'm not a robot"})]}),i&&le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{children:i})})]})}function jZ(t){const{email:e}=t,r=Bb(),[n,i]=Ee.useState("captcha");async function s(o,a){const u=await xa.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:a,email:o,inviter_code:r.inviterCode,source:{device:r.device,channel:r.channel,app:r.app}});t.onLogin(u.data)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-12",children:le.jsx(Tc,{title:"Sign in with email",onBack:t.onBack})}),n==="captcha"&&le.jsx(J7,{email:e,onCodeSend:()=>i("verify-email")}),n==="verify-email"&&le.jsx(Y7,{email:e,onInputCode:s,onResendCode:()=>i("captcha")})]})}var X7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var p=function(f,g){var v=f,x=B[g],S=null,A=0,b=null,P=[],I={},F=function(re,ge){S=function(oe){for(var fe=new Array(oe),be=0;be=7&&ee(re),b==null&&(b=T(v,x,P)),Q(b,ge)},ce=function(re,ge){for(var oe=-1;oe<=7;oe+=1)if(!(re+oe<=-1||A<=re+oe))for(var fe=-1;fe<=7;fe+=1)ge+fe<=-1||A<=ge+fe||(S[re+oe][ge+fe]=0<=oe&&oe<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(oe==0||oe==6)||2<=oe&&oe<=4&&2<=fe&&fe<=4)},D=function(){for(var re=8;re>oe&1)==1;S[Math.floor(oe/3)][oe%3+A-8-3]=fe}for(oe=0;oe<18;oe+=1)fe=!re&&(ge>>oe&1)==1,S[oe%3+A-8-3][Math.floor(oe/3)]=fe},J=function(re,ge){for(var oe=x<<3|ge,fe=k.getBCHTypeInfo(oe),be=0;be<15;be+=1){var Me=!re&&(fe>>be&1)==1;be<6?S[be][8]=Me:be<8?S[be+1][8]=Me:S[A-15+be][8]=Me}for(be=0;be<15;be+=1)Me=!re&&(fe>>be&1)==1,be<8?S[8][A-be-1]=Me:be<9?S[8][15-be-1+1]=Me:S[8][15-be-1]=Me;S[A-8][8]=!re},Q=function(re,ge){for(var oe=-1,fe=A-1,be=7,Me=0,Ne=k.getMaskFunction(ge),Te=A-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var $e=0;$e<2;$e+=1)if(S[fe][Te-$e]==null){var Ie=!1;Me>>be&1)==1),Ne(fe,Te-$e)&&(Ie=!Ie),S[fe][Te-$e]=Ie,(be-=1)==-1&&(Me+=1,be=7)}if((fe+=oe)<0||A<=fe){fe-=oe,oe=-oe;break}}},T=function(re,ge,oe){for(var fe=z.getRSBlocks(re,ge),be=Z(),Me=0;Me8*Te)throw"code length overflow. ("+be.getLengthInBits()+">"+8*Te+")";for(be.getLengthInBits()+4<=8*Te&&be.put(0,4);be.getLengthInBits()%8!=0;)be.putBit(!1);for(;!(be.getLengthInBits()>=8*Te||(be.put(236,8),be.getLengthInBits()>=8*Te));)be.put(17,8);return function($e,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Se=0;Se=0?rt.getAt(Je):0}}var gt=0;for(Be=0;BeIe)&&(Ne=Ie,Te=$e)}return Te}())},I.createTableTag=function(re,ge){re=re||2;var oe="";oe+='";for(var be=0;be';oe+=""}return(oe+="")+"
"},I.createSvgTag=function(re,ge,oe,fe){var be={};typeof arguments[0]=="object"&&(re=(be=arguments[0]).cellSize,ge=be.margin,oe=be.alt,fe=be.title),re=re||2,ge=ge===void 0?4*re:ge,(oe=typeof oe=="string"?{text:oe}:oe||{}).text=oe.text||null,oe.id=oe.text?oe.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*re+2*ge,Le="";for($e="l"+re+",0 0,"+re+" -"+re+",0 0,-"+re+"z ",Le+=''+X(fe.text)+"":"",Le+=oe.text?''+X(oe.text)+"":"",Le+='',Le+='"},I.createDataURL=function(re,ge){re=re||2,ge=ge===void 0?4*re:ge;var oe=I.getModuleCount()*re+2*ge,fe=ge,be=oe-ge;return m(oe,oe,function(Me,Ne){if(fe<=Me&&Me"};var X=function(re){for(var ge="",oe=0;oe":ge+=">";break;case"&":ge+="&";break;case'"':ge+=""";break;default:ge+=fe}}return ge};return I.createASCII=function(re,ge){if((re=re||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Se,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,gt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:gt[Be];ft+=` +}`;const V7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>le.jsx(K7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));V7.displayName="InputOTP";const G7=Yt.forwardRef(({className:t,...e},r)=>le.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));G7.displayName="InputOTPGroup";const Dc=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(W7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return le.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&le.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:le.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Dc.displayName="InputOTPSlot";function jZ(t){const{spinning:e,children:r,className:n}=t;return le.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&le.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:le.jsx(Sc,{className:"xc-animate-spin"})})]})}function Y7(t){const{email:e}=t,[r,n]=Ee.useState(0),[i,s]=Ee.useState(!1),[o,a]=Ee.useState("");async function u(){n(60);const d=setInterval(()=>{n(p=>p===0?(clearInterval(d),0):p-1)},1e3)}async function l(d){if(a(""),!(d.length<6)){s(!0);try{await t.onInputCode(e,d)}catch(p){a(p.message)}s(!1)}}return Ee.useEffect(()=>{u()},[]),le.jsxs(Ms,{children:[le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[le.jsx(mV,{className:"xc-mb-4",size:60}),le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:[le.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),le.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]}),le.jsx("div",{className:"xc-mb-2 xc-h-12",children:le.jsx(jZ,{spinning:i,className:"xc-rounded-xl",children:le.jsx(V7,{maxLength:6,onChange:l,disabled:i,className:"disabled:xc-opacity-20",children:le.jsx(G7,{children:le.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[le.jsx(Dc,{index:0}),le.jsx(Dc,{index:1}),le.jsx(Dc,{index:2}),le.jsx(Dc,{index:3}),le.jsx(Dc,{index:4}),le.jsx(Dc,{index:5})]})})})})}),o&&le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{children:o})})]}),le.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Resend in ${r}s`:le.jsx("button",{id:"sendCodeButton",onClick:t.onResendCode,children:"Send again"})]}),le.jsx("div",{id:"captcha-element"})]})}function J7(t){const{email:e}=t,[r,n]=Ee.useState(!1),[i,s]=Ee.useState(""),o=Ee.useMemo(()=>`xn-btn-${new Date().getTime()}`,[e]);async function a(y,_){n(!0),s(""),await xa.getEmailCode({account_type:"email",email:y},_),n(!1)}async function u(y){try{return await a(e,JSON.stringify(y)),{captchaResult:!0,bizResult:!0}}catch(_){return s(_.message),{captchaResult:!1,bizResult:!1}}}async function l(y){y&&t.onCodeSend()}const d=Ee.useRef();function p(y){d.current=y}return Ee.useEffect(()=>{if(e)return window.initAliyunCaptcha({SceneId:"tqyu8129d",prefix:"1mfsn5f",mode:"popup",element:"#captcha-element",button:`#${o}`,captchaVerifyCallback:u,onBizResultCallback:l,getInstance:p,slideStyle:{width:360,height:40},language:"en",region:"cn"}),()=>{var y,_;(y=document.getElementById("aliyunCaptcha-mask"))==null||y.remove(),(_=document.getElementById("aliyunCaptcha-window-popup"))==null||_.remove()}},[e]),le.jsxs(Ms,{children:[le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[le.jsx(vV,{className:"xc-mb-4",size:60}),le.jsx("button",{className:"xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2",id:o,children:r?le.jsx(Sc,{className:"xc-animate-spin"}):"I'm not a robot"})]}),i&&le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{children:i})})]})}function UZ(t){const{email:e}=t,r=Bb(),[n,i]=Ee.useState("captcha");async function s(o,a){const u=await xa.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:a,email:o,inviter_code:r.inviterCode,source:{device:r.device,channel:r.channel,app:r.app}});t.onLogin(u.data)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-12",children:le.jsx(Rc,{title:"Sign in with email",onBack:t.onBack})}),n==="captcha"&&le.jsx(J7,{email:e,onCodeSend:()=>i("verify-email")}),n==="verify-email"&&le.jsx(Y7,{email:e,onInputCode:s,onResendCode:()=>i("captcha")})]})}var X7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var p=function(f,g){var v=f,x=B[g],S=null,A=0,b=null,P=[],I={},F=function(re,ge){S=function(oe){for(var fe=new Array(oe),be=0;be=7&&ee(re),b==null&&(b=T(v,x,P)),Q(b,ge)},ce=function(re,ge){for(var oe=-1;oe<=7;oe+=1)if(!(re+oe<=-1||A<=re+oe))for(var fe=-1;fe<=7;fe+=1)ge+fe<=-1||A<=ge+fe||(S[re+oe][ge+fe]=0<=oe&&oe<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(oe==0||oe==6)||2<=oe&&oe<=4&&2<=fe&&fe<=4)},D=function(){for(var re=8;re>oe&1)==1;S[Math.floor(oe/3)][oe%3+A-8-3]=fe}for(oe=0;oe<18;oe+=1)fe=!re&&(ge>>oe&1)==1,S[oe%3+A-8-3][Math.floor(oe/3)]=fe},J=function(re,ge){for(var oe=x<<3|ge,fe=k.getBCHTypeInfo(oe),be=0;be<15;be+=1){var Me=!re&&(fe>>be&1)==1;be<6?S[be][8]=Me:be<8?S[be+1][8]=Me:S[A-15+be][8]=Me}for(be=0;be<15;be+=1)Me=!re&&(fe>>be&1)==1,be<8?S[8][A-be-1]=Me:be<9?S[8][15-be-1+1]=Me:S[8][15-be-1]=Me;S[A-8][8]=!re},Q=function(re,ge){for(var oe=-1,fe=A-1,be=7,Me=0,Ne=k.getMaskFunction(ge),Te=A-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var $e=0;$e<2;$e+=1)if(S[fe][Te-$e]==null){var Ie=!1;Me>>be&1)==1),Ne(fe,Te-$e)&&(Ie=!Ie),S[fe][Te-$e]=Ie,(be-=1)==-1&&(Me+=1,be=7)}if((fe+=oe)<0||A<=fe){fe-=oe,oe=-oe;break}}},T=function(re,ge,oe){for(var fe=z.getRSBlocks(re,ge),be=Z(),Me=0;Me8*Te)throw"code length overflow. ("+be.getLengthInBits()+">"+8*Te+")";for(be.getLengthInBits()+4<=8*Te&&be.put(0,4);be.getLengthInBits()%8!=0;)be.putBit(!1);for(;!(be.getLengthInBits()>=8*Te||(be.put(236,8),be.getLengthInBits()>=8*Te));)be.put(17,8);return function($e,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Se=0;Se=0?rt.getAt(Je):0}}var gt=0;for(Be=0;BeIe)&&(Ne=Ie,Te=$e)}return Te}())},I.createTableTag=function(re,ge){re=re||2;var oe="";oe+='";for(var be=0;be';oe+=""}return(oe+="")+"
"},I.createSvgTag=function(re,ge,oe,fe){var be={};typeof arguments[0]=="object"&&(re=(be=arguments[0]).cellSize,ge=be.margin,oe=be.alt,fe=be.title),re=re||2,ge=ge===void 0?4*re:ge,(oe=typeof oe=="string"?{text:oe}:oe||{}).text=oe.text||null,oe.id=oe.text?oe.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*re+2*ge,Le="";for($e="l"+re+",0 0,"+re+" -"+re+",0 0,-"+re+"z ",Le+=''+X(fe.text)+"":"",Le+=oe.text?''+X(oe.text)+"":"",Le+='',Le+='"},I.createDataURL=function(re,ge){re=re||2,ge=ge===void 0?4*re:ge;var oe=I.getModuleCount()*re+2*ge,fe=ge,be=oe-ge;return m(oe,oe,function(Me,Ne){if(fe<=Me&&Me"};var X=function(re){for(var ge="",oe=0;oe":ge+=">";break;case"&":ge+="&";break;case'"':ge+=""";break;default:ge+=fe}}return ge};return I.createASCII=function(re,ge){if((re=re||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Se,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,gt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:gt[Be];ft+=` `}return et%2&&ze>0?ft.substring(0,ft.length-et-1)+Array(et+1).join("▀"):ft.substring(0,ft.length-1)}(ge);re-=1,ge=ge===void 0?2*re:ge;var oe,fe,be,Me,Ne=I.getModuleCount()*re+2*ge,Te=ge,$e=Ne-ge,Ie=Array(re+1).join("██"),Le=Array(re+1).join(" "),Ve="",ke="";for(oe=0;oe>>8),A.push(255&I)):A.push(x)}}return A}};var y,_,M,O,L,B={L:1,M:0,Q:3,H:2},k=(y=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],_=1335,M=7973,L=function(f){for(var g=0;f!=0;)g+=1,f>>>=1;return g},(O={}).getBCHTypeInfo=function(f){for(var g=f<<10;L(g)-L(_)>=0;)g^=_<=0;)g^=M<5&&(v+=3+A-5)}for(x=0;x=256;)x-=255;return f[x]}}}();function U(f,g){if(f.length===void 0)throw f.length+"/"+g;var v=function(){for(var S=0;S>>7-x%8&1)==1},put:function(x,S){for(var A=0;A>>S-A-1&1)==1)},getLengthInBits:function(){return g},putBit:function(x){var S=Math.floor(g/8);f.length<=S&&f.push(0),x&&(f[S]|=128>>>g%8),g+=1}};return v},R=function(f){var g=f,v={getMode:function(){return 1},getLength:function(A){return g.length},write:function(A){for(var b=g,P=0;P+2>>8&255)+(255&P),S.put(P,13),b+=2}if(b>>8)},writeBytes:function(v,x,S){x=x||0,S=S||v.length;for(var A=0;A0&&(v+=","),v+=f[x];return v+"]"}};return g},E=function(f){var g=f,v=0,x=0,S=0,A={read:function(){for(;S<8;){if(v>=g.length){if(S==0)return-1;throw"unexpected end of file./"+S}var P=g.charAt(v);if(v+=1,P=="=")return S=0,-1;P.match(/^\s$/)||(x=x<<6|b(P.charCodeAt(0)),S+=6)}var I=x>>>S-8&255;return S-=8,I}},b=function(P){if(65<=P&&P<=90)return P-65;if(97<=P&&P<=122)return P-97+26;if(48<=P&&P<=57)return P-48+52;if(P==43)return 62;if(P==47)return 63;throw"c:"+P};return A},m=function(f,g,v){for(var x=function(ce,D){var se=ce,ee=D,J=new Array(ce*D),Q={setPixel:function(re,ge,oe){J[ge*se+re]=oe},write:function(re){re.writeString("GIF87a"),re.writeShort(se),re.writeShort(ee),re.writeByte(128),re.writeByte(0),re.writeByte(0),re.writeByte(0),re.writeByte(0),re.writeByte(0),re.writeByte(255),re.writeByte(255),re.writeByte(255),re.writeString(","),re.writeShort(0),re.writeShort(0),re.writeShort(se),re.writeShort(ee),re.writeByte(0);var ge=T(2);re.writeByte(2);for(var oe=0;ge.length-oe>255;)re.writeByte(255),re.writeBytes(ge,oe,255),oe+=255;re.writeByte(ge.length-oe),re.writeBytes(ge,oe,ge.length-oe),re.writeByte(0),re.writeString(";")}},T=function(re){for(var ge=1<>>Se)throw"length over";for(;Te+Se>=8;)Ne.writeByte(255&(He<>>=8-Te,$e=0,Te=0;$e|=He<0&&Ne.writeByte($e)}});Le.write(ge,fe);var Ve=0,ke=String.fromCharCode(J[Ve]);for(Ve+=1;Ve=6;)Q(ce>>>D-6),D-=6},J.flush=function(){if(D>0&&(Q(ce<<6-D),ce=0,D=0),se%3!=0)for(var X=3-se%3,re=0;re>6,128|63&O):O<55296||O>=57344?_.push(224|O>>12,128|O>>6&63,128|63&O):(M++,O=65536+((1023&O)<<10|1023&y.charCodeAt(M)),_.push(240|O>>18,128|O>>12&63,128|O>>6&63,128|63&O))}return _}(p)},(l=typeof(u=function(){return d})=="function"?u.apply(a,[]):u)===void 0||(o.exports=l)}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var u=n[o]={exports:{}};return r[o](u,u.exports,i),u.exports}i.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return i.d(a,{a}),a},i.d=(o,a)=>{for(var u in a)i.o(a,u)&&!i.o(o,u)&&Object.defineProperty(o,u,{enumerable:!0,get:a[u]})},i.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a);var s={};return(()=>{i.d(s,{default:()=>j});const o=E=>!!E&&typeof E=="object"&&!Array.isArray(E);function a(E,...m){if(!m.length)return E;const f=m.shift();return f!==void 0&&o(E)&&o(f)?(E=Object.assign({},E),Object.keys(f).forEach(g=>{const v=E[g],x=f[g];Array.isArray(v)&&Array.isArray(x)?E[g]=x:o(v)&&o(x)?E[g]=a(Object.assign({},v),x):E[g]=x}),a(E,...m)):E}function u(E,m){const f=document.createElement("a");f.download=m,f.href=E,document.body.appendChild(f),f.click(),document.body.removeChild(f)}const l={L:.07,M:.15,Q:.25,H:.3};class d{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"dots":x=this._drawDot;break;case"classy":x=this._drawClassy;break;case"classy-rounded":x=this._drawClassyRounded;break;case"rounded":x=this._drawRounded;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawSquare}x.call(this,{x:m,y:f,size:g,getNeighbor:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var S;const A=m+g/2,b=f+g/2;x(),(S=this._element)===null||S===void 0||S.setAttribute("transform",`rotate(${180*v/Math.PI},${A},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_basicSideRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, 0 ${-f}`)}}))}_basicCornerRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_basicCornerExtraRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`)}}))}_basicCornersRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${f/2} ${f/2}h `+f/2+"v "+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_drawDot({x:m,y:f,size:g}){this._basicDot({x:m,y:f,size:g,rotation:0})}_drawSquare({x:m,y:f,size:g}){this._basicSquare({x:m,y:f,size:g,rotation:0})}_drawRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,S=v?+v(1,0):0,A=v?+v(0,-1):0,b=v?+v(0,1):0,P=x+S+A+b;if(P!==0)if(P>2||x&&S||A&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(P===2){let I=0;return x&&A?I=Math.PI/2:A&&S?I=Math.PI:S&&b&&(I=-Math.PI/2),void this._basicCornerRounded({x:m,y:f,size:g,rotation:I})}if(P===1){let I=0;return A?I=Math.PI/2:S?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawExtraRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,S=v?+v(1,0):0,A=v?+v(0,-1):0,b=v?+v(0,1):0,P=x+S+A+b;if(P!==0)if(P>2||x&&S||A&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(P===2){let I=0;return x&&A?I=Math.PI/2:A&&S?I=Math.PI:S&&b&&(I=-Math.PI/2),void this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:I})}if(P===1){let I=0;return A?I=Math.PI/2:S?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawClassy({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,S=v?+v(1,0):0,A=v?+v(0,-1):0,b=v?+v(0,1):0;x+S+A+b!==0?x||A?S||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}_drawClassyRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,S=v?+v(1,0):0,A=v?+v(0,-1):0,b=v?+v(0,1):0;x+S+A+b!==0?x||A?S||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}}class p{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"square":x=this._drawSquare;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawDot}x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var S;const A=m+g/2,b=f+g/2;x(),(S=this._element)===null||S===void 0||S.setAttribute("transform",`rotate(${180*v/Math.PI},${A},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g+f/2} ${v}a ${f/2} ${f/2} 0 1 0 0.1 0zm 0 ${x}a ${f/2-x} ${f/2-x} 0 1 1 -0.1 0Z`)}}))}_basicSquare(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f+`zM ${g+x} ${v+x}h `+(f-2*x)+"v "+(f-2*x)+"h "+(2*x-f)+"z")}}))}_basicExtraRounded(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v+2.5*x}v `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*x}h `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*-x}v `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*-x}h `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*x}M ${g+2.5*x} ${v+x}h `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*x}v `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*x}h `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*-x}v `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*-x}`)}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}_drawExtraRounded({x:m,y:f,size:g,rotation:v}){this._basicExtraRounded({x:m,y:f,size:g,rotation:v})}}class y{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;x=this._type==="square"?this._drawSquare:this._drawDot,x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var S;const A=m+g/2,b=f+g/2;x(),(S=this._element)===null||S===void 0||S.setAttribute("transform",`rotate(${180*v/Math.PI},${A},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}}const _="circle",M=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],O=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class L{constructor(m,f){this._roundSize=g=>this._options.dotsOptions.roundSize?Math.floor(g):g,this._window=f,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(m.width)),this._element.setAttribute("height",String(m.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),m.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=m.image,this._instanceId=L.instanceCount++,this._options=m}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(m){const f=m.getModuleCount(),g=Math.min(this._options.width,this._options.height)-2*this._options.margin,v=this._options.shape===_?g/Math.sqrt(2):g,x=this._roundSize(v/f);let S={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=m,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:A,qrOptions:b}=this._options,P=A.imageSize*l[b.errorCorrectionLevel],I=Math.floor(P*f*f);S=function({originalHeight:F,originalWidth:ce,maxHiddenDots:D,maxHiddenAxisDots:se,dotSize:ee}){const J={x:0,y:0},Q={x:0,y:0};if(F<=0||ce<=0||D<=0||ee<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const T=F/ce;return J.x=Math.floor(Math.sqrt(D/T)),J.x<=0&&(J.x=1),se&&seD||se&&se{var P,I,F,ce,D,se;return!(this._options.imageOptions.hideBackgroundDots&&A>=(f-S.hideYDots)/2&&A<(f+S.hideYDots)/2&&b>=(f-S.hideXDots)/2&&b<(f+S.hideXDots)/2||!((P=M[A])===null||P===void 0)&&P[b]||!((I=M[A-f+7])===null||I===void 0)&&I[b]||!((F=M[A])===null||F===void 0)&&F[b-f+7]||!((ce=O[A])===null||ce===void 0)&&ce[b]||!((D=O[A-f+7])===null||D===void 0)&&D[b]||!((se=O[A])===null||se===void 0)&&se[b-f+7])}),this.drawCorners(),this._options.image&&await this.drawImage({width:S.width,height:S.height,count:f,dotSize:x})}drawBackground(){var m,f,g;const v=this._element,x=this._options;if(v){const S=(m=x.backgroundOptions)===null||m===void 0?void 0:m.gradient,A=(f=x.backgroundOptions)===null||f===void 0?void 0:f.color;let b=x.height,P=x.width;if(S||A){const I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((g=x.backgroundOptions)===null||g===void 0)&&g.round&&(b=P=Math.min(x.width,x.height),I.setAttribute("rx",String(b/2*x.backgroundOptions.round))),I.setAttribute("x",String(this._roundSize((x.width-P)/2))),I.setAttribute("y",String(this._roundSize((x.height-b)/2))),I.setAttribute("width",String(P)),I.setAttribute("height",String(b)),this._backgroundClipPath.appendChild(I),this._createColor({options:S,color:A,additionalRotation:0,x:0,y:0,height:x.height,width:x.width,name:`background-color-${this._instanceId}`})}}}drawDots(m){var f,g;if(!this._qr)throw"QR code is not defined";const v=this._options,x=this._qr.getModuleCount();if(x>v.width||x>v.height)throw"The canvas is too small.";const S=Math.min(v.width,v.height)-2*v.margin,A=v.shape===_?S/Math.sqrt(2):S,b=this._roundSize(A/x),P=this._roundSize((v.width-x*b)/2),I=this._roundSize((v.height-x*b)/2),F=new d({svg:this._element,type:v.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(f=v.dotsOptions)===null||f===void 0?void 0:f.gradient,color:v.dotsOptions.color,additionalRotation:0,x:0,y:0,height:v.height,width:v.width,name:`dot-color-${this._instanceId}`});for(let ce=0;ce!(D+se<0||ce+ee<0||D+se>=x||ce+ee>=x)&&!(m&&!m(ce+ee,D+se))&&!!this._qr&&this._qr.isDark(ce+ee,D+se)),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element));if(v.shape===_){const ce=this._roundSize((S/b-x)/2),D=x+2*ce,se=P-ce*b,ee=I-ce*b,J=[],Q=this._roundSize(D/2);for(let T=0;T=ce-1&&T<=D-ce&&X>=ce-1&&X<=D-ce||Math.sqrt((T-Q)*(T-Q)+(X-Q)*(X-Q))>Q?J[T][X]=0:J[T][X]=this._qr.isDark(X-2*ce<0?X:X>=x?X-2*ce:X-ce,T-2*ce<0?T:T>=x?T-2*ce:T-ce)?1:0}for(let T=0;T{var oe;return!!(!((oe=J[T+ge])===null||oe===void 0)&&oe[X+re])}),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const m=this._element,f=this._options;if(!m)throw"Element code is not defined";const g=this._qr.getModuleCount(),v=Math.min(f.width,f.height)-2*f.margin,x=f.shape===_?v/Math.sqrt(2):v,S=this._roundSize(x/g),A=7*S,b=3*S,P=this._roundSize((f.width-g*S)/2),I=this._roundSize((f.height-g*S)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([F,ce,D])=>{var se,ee,J,Q,T,X,re,ge,oe,fe,be,Me;const Ne=P+F*S*(g-7),Te=I+ce*S*(g-7);let $e=this._dotsClipPath,Ie=this._dotsClipPath;if((!((se=f.cornersSquareOptions)===null||se===void 0)&&se.gradient||!((ee=f.cornersSquareOptions)===null||ee===void 0)&&ee.color)&&($e=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),$e.setAttribute("id",`clip-path-corners-square-color-${F}-${ce}-${this._instanceId}`),this._defs.appendChild($e),this._cornersSquareClipPath=this._cornersDotClipPath=Ie=$e,this._createColor({options:(J=f.cornersSquareOptions)===null||J===void 0?void 0:J.gradient,color:(Q=f.cornersSquareOptions)===null||Q===void 0?void 0:Q.color,additionalRotation:D,x:Ne,y:Te,height:A,width:A,name:`corners-square-color-${F}-${ce}-${this._instanceId}`})),(T=f.cornersSquareOptions)===null||T===void 0?void 0:T.type){const Le=new p({svg:this._element,type:f.cornersSquareOptions.type,window:this._window});Le.draw(Ne,Te,A,D),Le._element&&$e&&$e.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Se;return!!(!((Se=M[Ve+He])===null||Se===void 0)&&Se[ke+ze])}),Le._element&&$e&&$e.appendChild(Le._element))}if((!((re=f.cornersDotOptions)===null||re===void 0)&&re.gradient||!((ge=f.cornersDotOptions)===null||ge===void 0)&&ge.color)&&(Ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Ie.setAttribute("id",`clip-path-corners-dot-color-${F}-${ce}-${this._instanceId}`),this._defs.appendChild(Ie),this._cornersDotClipPath=Ie,this._createColor({options:(oe=f.cornersDotOptions)===null||oe===void 0?void 0:oe.gradient,color:(fe=f.cornersDotOptions)===null||fe===void 0?void 0:fe.color,additionalRotation:D,x:Ne+2*S,y:Te+2*S,height:b,width:b,name:`corners-dot-color-${F}-${ce}-${this._instanceId}`})),(be=f.cornersDotOptions)===null||be===void 0?void 0:be.type){const Le=new y({svg:this._element,type:f.cornersDotOptions.type,window:this._window});Le.draw(Ne+2*S,Te+2*S,b,D),Le._element&&Ie&&Ie.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Se;return!!(!((Se=O[Ve+He])===null||Se===void 0)&&Se[ke+ze])}),Le._element&&Ie&&Ie.appendChild(Le._element))}})}loadImage(){return new Promise((m,f)=>{var g;const v=this._options;if(!v.image)return f("Image is not defined");if(!((g=v.nodeCanvas)===null||g===void 0)&&g.loadImage)v.nodeCanvas.loadImage(v.image).then(x=>{var S,A;if(this._image=x,this._options.imageOptions.saveAsBlob){const b=(S=v.nodeCanvas)===null||S===void 0?void 0:S.createCanvas(this._image.width,this._image.height);(A=b==null?void 0:b.getContext("2d"))===null||A===void 0||A.drawImage(x,0,0),this._imageUri=b==null?void 0:b.toDataURL()}m()}).catch(f);else{const x=new this._window.Image;typeof v.imageOptions.crossOrigin=="string"&&(x.crossOrigin=v.imageOptions.crossOrigin),this._image=x,x.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await async function(S,A){return new Promise(b=>{const P=new A.XMLHttpRequest;P.onload=function(){const I=new A.FileReader;I.onloadend=function(){b(I.result)},I.readAsDataURL(P.response)},P.open("GET",S),P.responseType="blob",P.send()})}(v.image||"",this._window)),m()},x.src=v.image}})}async drawImage({width:m,height:f,count:g,dotSize:v}){const x=this._options,S=this._roundSize((x.width-g*v)/2),A=this._roundSize((x.height-g*v)/2),b=S+this._roundSize(x.imageOptions.margin+(g*v-m)/2),P=A+this._roundSize(x.imageOptions.margin+(g*v-f)/2),I=m-2*x.imageOptions.margin,F=f-2*x.imageOptions.margin,ce=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");ce.setAttribute("href",this._imageUri||""),ce.setAttribute("x",String(b)),ce.setAttribute("y",String(P)),ce.setAttribute("width",`${I}px`),ce.setAttribute("height",`${F}px`),this._element.appendChild(ce)}_createColor({options:m,color:f,additionalRotation:g,x:v,y:x,height:S,width:A,name:b}){const P=A>S?A:S,I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(I.setAttribute("x",String(v)),I.setAttribute("y",String(x)),I.setAttribute("height",String(S)),I.setAttribute("width",String(A)),I.setAttribute("clip-path",`url('#clip-path-${b}')`),m){let F;if(m.type==="radial")F=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("fx",String(v+A/2)),F.setAttribute("fy",String(x+S/2)),F.setAttribute("cx",String(v+A/2)),F.setAttribute("cy",String(x+S/2)),F.setAttribute("r",String(P/2));else{const ce=((m.rotation||0)+g)%(2*Math.PI),D=(ce+2*Math.PI)%(2*Math.PI);let se=v+A/2,ee=x+S/2,J=v+A/2,Q=x+S/2;D>=0&&D<=.25*Math.PI||D>1.75*Math.PI&&D<=2*Math.PI?(se-=A/2,ee-=S/2*Math.tan(ce),J+=A/2,Q+=S/2*Math.tan(ce)):D>.25*Math.PI&&D<=.75*Math.PI?(ee-=S/2,se-=A/2/Math.tan(ce),Q+=S/2,J+=A/2/Math.tan(ce)):D>.75*Math.PI&&D<=1.25*Math.PI?(se+=A/2,ee+=S/2*Math.tan(ce),J-=A/2,Q-=S/2*Math.tan(ce)):D>1.25*Math.PI&&D<=1.75*Math.PI&&(ee+=S/2,se+=A/2/Math.tan(ce),Q-=S/2,J-=A/2/Math.tan(ce)),F=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("x1",String(Math.round(se))),F.setAttribute("y1",String(Math.round(ee))),F.setAttribute("x2",String(Math.round(J))),F.setAttribute("y2",String(Math.round(Q)))}m.colorStops.forEach(({offset:ce,color:D})=>{const se=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");se.setAttribute("offset",100*ce+"%"),se.setAttribute("stop-color",D),F.appendChild(se)}),I.setAttribute("fill",`url('#${b}')`),this._defs.appendChild(F)}else f&&I.setAttribute("fill",f);this._element.appendChild(I)}}L.instanceCount=0;const B=L,k="canvas",H={};for(let E=0;E<=40;E++)H[E]=E;const U={type:k,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:H[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function z(E){const m=Object.assign({},E);if(!m.colorStops||!m.colorStops.length)throw"Field 'colorStops' is required in gradient";return m.rotation?m.rotation=Number(m.rotation):m.rotation=0,m.colorStops=m.colorStops.map(f=>Object.assign(Object.assign({},f),{offset:Number(f.offset)})),m}function Z(E){const m=Object.assign({},E);return m.width=Number(m.width),m.height=Number(m.height),m.margin=Number(m.margin),m.imageOptions=Object.assign(Object.assign({},m.imageOptions),{hideBackgroundDots:!!m.imageOptions.hideBackgroundDots,imageSize:Number(m.imageOptions.imageSize),margin:Number(m.imageOptions.margin)}),m.margin>Math.min(m.width,m.height)&&(m.margin=Math.min(m.width,m.height)),m.dotsOptions=Object.assign({},m.dotsOptions),m.dotsOptions.gradient&&(m.dotsOptions.gradient=z(m.dotsOptions.gradient)),m.cornersSquareOptions&&(m.cornersSquareOptions=Object.assign({},m.cornersSquareOptions),m.cornersSquareOptions.gradient&&(m.cornersSquareOptions.gradient=z(m.cornersSquareOptions.gradient))),m.cornersDotOptions&&(m.cornersDotOptions=Object.assign({},m.cornersDotOptions),m.cornersDotOptions.gradient&&(m.cornersDotOptions.gradient=z(m.cornersDotOptions.gradient))),m.backgroundOptions&&(m.backgroundOptions=Object.assign({},m.backgroundOptions),m.backgroundOptions.gradient&&(m.backgroundOptions.gradient=z(m.backgroundOptions.gradient))),m}var R=i(873),W=i.n(R);function ie(E){if(!E)throw new Error("Extension must be defined");E[0]==="."&&(E=E.substring(1));const m={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[E.toLowerCase()];if(!m)throw new Error(`Extension "${E}" is not supported`);return m}class me{constructor(m){m!=null&&m.jsdom?this._window=new m.jsdom("",{resources:"usable"}).window:this._window=window,this._options=m?Z(a(U,m)):U,this.update()}static _clearContainer(m){m&&(m.innerHTML="")}_setupSvg(){if(!this._qr)return;const m=new B(this._options,this._window);this._svg=m.getElement(),this._svgDrawingPromise=m.drawQR(this._qr).then(()=>{var f;this._svg&&((f=this._extension)===null||f===void 0||f.call(this,m.getElement(),this._options))})}_setupCanvas(){var m,f;this._qr&&(!((m=this._options.nodeCanvas)===null||m===void 0)&&m.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(f=this._svgDrawingPromise)===null||f===void 0?void 0:f.then(()=>{var g;if(!this._svg)return;const v=this._svg,x=new this._window.XMLSerializer().serializeToString(v),S=btoa(x),A=`data:${ie("svg")};base64,${S}`;if(!((g=this._options.nodeCanvas)===null||g===void 0)&&g.loadImage)return this._options.nodeCanvas.loadImage(A).then(b=>{var P,I;b.width=this._options.width,b.height=this._options.height,(I=(P=this._nodeCanvas)===null||P===void 0?void 0:P.getContext("2d"))===null||I===void 0||I.drawImage(b,0,0)});{const b=new this._window.Image;return new Promise(P=>{b.onload=()=>{var I,F;(F=(I=this._domCanvas)===null||I===void 0?void 0:I.getContext("2d"))===null||F===void 0||F.drawImage(b,0,0),P()},b.src=A})}}))}async _getElement(m="png"){if(!this._qr)throw"QR code is empty";return m.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(m){me._clearContainer(this._container),this._options=m?Z(a(this._options,m)):this._options,this._options.data&&(this._qr=W()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(f){switch(!0){case/^[0-9]*$/.test(f):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(f):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===k?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(m){if(m){if(typeof m.appendChild!="function")throw"Container should be a single DOM node";this._options.type===k?this._domCanvas&&m.appendChild(this._domCanvas):this._svg&&m.appendChild(this._svg),this._container=m}}applyExtension(m){if(!m)throw"Extension function should be defined.";this._extension=m,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(m="png"){if(!this._qr)throw"QR code is empty";const f=await this._getElement(m),g=ie(m);if(!f)return null;if(m.toLowerCase()==="svg"){const v=`\r ${new this._window.XMLSerializer().serializeToString(f)}`;return typeof Blob>"u"||this._options.jsdom?Buffer.from(v):new Blob([v],{type:g})}return new Promise(v=>{const x=f;if("toBuffer"in x)if(g==="image/png")v(x.toBuffer(g));else if(g==="image/jpeg")v(x.toBuffer(g));else{if(g!=="application/pdf")throw Error("Unsupported extension");v(x.toBuffer(g))}else"toBlob"in x&&x.toBlob(v,g,1)})}async download(m){if(!this._qr)throw"QR code is empty";if(typeof Blob>"u")throw"Cannot download in Node.js, call getRawData instead.";let f="png",g="qr";typeof m=="string"?(f=m,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):typeof m=="object"&&m!==null&&(m.name&&(g=m.name),m.extension&&(f=m.extension));const v=await this._getElement(f);if(v)if(f.toLowerCase()==="svg"){let x=new XMLSerializer().serializeToString(v);x=`\r -`+x,u(`data:${ie(f)};charset=utf-8,${encodeURIComponent(x)}`,`${g}.svg`)}else u(v.toDataURL(ie(f)),`${g}.${f}`)}}const j=me})(),s.default})())})(X7);var UZ=X7.exports;const Z7=ji(UZ);class Ca extends pt{constructor(e){const{docsPath:r,field:n,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${n}".`,{docsPath:r,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}function Q7(t){if(/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t)||/%[^0-9a-f]/i.test(t)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(t))return!1;const e=qZ(t),r=e[1],n=e[2],i=e[3],s=e[4],o=e[5];if(!(r!=null&&r.length&&i.length>=0))return!1;if(n!=null&&n.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9\+\-\.]*$/.test(r.toLowerCase()))return!1;let a="";return a+=`${r}:`,n!=null&&n.length&&(a+=`//${n}`),a+=i,s!=null&&s.length&&(a+=`?${s}`),o!=null&&o.length&&(a+=`#${o}`),a}function qZ(t){return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}function e9(t){const{chainId:e,domain:r,expirationTime:n,issuedAt:i=new Date,nonce:s,notBefore:o,requestId:a,resources:u,scheme:l,uri:d,version:p}=t;{if(e!==Math.floor(e))throw new Ca({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${e}`]});if(!(zZ.test(r)||HZ.test(r)||WZ.test(r)))throw new Ca({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${r}`]});if(!KZ.test(s))throw new Ca({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${s}`]});if(!Q7(d))throw new Ca({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${d}`]});if(p!=="1")throw new Ca({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${p}`]});if(l&&!VZ.test(l))throw new Ca({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${l}`]});const B=t.statement;if(B!=null&&B.includes(` +`+x,u(`data:${ie(f)};charset=utf-8,${encodeURIComponent(x)}`,`${g}.svg`)}else u(v.toDataURL(ie(f)),`${g}.${f}`)}}const j=me})(),s.default})())})(X7);var qZ=X7.exports;const Z7=ji(qZ);class Ca extends pt{constructor(e){const{docsPath:r,field:n,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${n}".`,{docsPath:r,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}function Q7(t){if(/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t)||/%[^0-9a-f]/i.test(t)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(t))return!1;const e=zZ(t),r=e[1],n=e[2],i=e[3],s=e[4],o=e[5];if(!(r!=null&&r.length&&i.length>=0))return!1;if(n!=null&&n.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9\+\-\.]*$/.test(r.toLowerCase()))return!1;let a="";return a+=`${r}:`,n!=null&&n.length&&(a+=`//${n}`),a+=i,s!=null&&s.length&&(a+=`?${s}`),o!=null&&o.length&&(a+=`#${o}`),a}function zZ(t){return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}function e9(t){const{chainId:e,domain:r,expirationTime:n,issuedAt:i=new Date,nonce:s,notBefore:o,requestId:a,resources:u,scheme:l,uri:d,version:p}=t;{if(e!==Math.floor(e))throw new Ca({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${e}`]});if(!(HZ.test(r)||WZ.test(r)||KZ.test(r)))throw new Ca({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${r}`]});if(!VZ.test(s))throw new Ca({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${s}`]});if(!Q7(d))throw new Ca({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${d}`]});if(p!=="1")throw new Ca({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${p}`]});if(l&&!GZ.test(l))throw new Ca({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${l}`]});const B=t.statement;if(B!=null&&B.includes(` `))throw new Ca({field:"statement",metaMessages:["- Statement must not include '\\n'.","",`Provided value: ${B}`]})}const y=yg(t.address),_=l?`${l}://${r}`:r,M=t.statement?`${t.statement} `:"",O=`${_} wants you to sign in with your Ethereum account: ${y} @@ -237,7 +237,7 @@ Not Before: ${o.toISOString()}`),a&&(L+=` Request ID: ${a}`),u){let B=` Resources:`;for(const k of u){if(!Q7(k))throw new Ca({field:"resources",metaMessages:["- Every resource must be a RFC 3986 URI.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${k}`]});B+=` - ${k}`}L+=B}return`${O} -${L}`}const zZ=/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/,HZ=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/,WZ=/^localhost(:[0-9]{1,5})?$/,KZ=/^[a-zA-Z0-9]{8,}$/,VZ=/^([a-zA-Z][a-zA-Z0-9+-.]*)$/,t9="7a4434fefbcc9af474fb5c995e47d286",GZ={projectId:t9,metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},YZ={namespaces:{eip155:{methods:["eth_sendTransaction","eth_signTransaction","eth_sign","personal_sign","eth_signTypedData"],chains:["eip155:1"],events:["chainChanged","accountsChanged","disconnect"],rpcMap:{1:`https://rpc.walletconnect.com?chainId=eip155:1&projectId=${t9}`}}},skipPairing:!1};function JZ(t,e){const r=window.location.host,n=window.location.href;return e9({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function r9(t){var ie,me,j;const e=Ee.useRef(null),{wallet:r,onGetExtension:n,onSignFinish:i}=t,[s,o]=Ee.useState(""),[a,u]=Ee.useState(!1),[l,d]=Ee.useState(""),[p,y]=Ee.useState("scan"),_=Ee.useRef(),[M,O]=Ee.useState((ie=r.config)==null?void 0:ie.image),[L,B]=Ee.useState(!1),{saveLastUsedWallet:k}=Yl();async function H(E){var f,g,v,x;u(!0);const m=await Hz.init(GZ);m.session&&await m.disconnect();try{if(y("scan"),m.on("display_uri",ce=>{o(ce),u(!1),y("scan")}),m.on("error",ce=>{console.log(ce)}),m.on("session_update",ce=>{console.log("session_update",ce)}),!await m.connect(YZ))throw new Error("Walletconnect init failed");const A=new ru(m);O(((f=A.config)==null?void 0:f.image)||((g=E.config)==null?void 0:g.image));const b=await A.getAddress(),P=await xa.getNonce({account_type:"block_chain"});console.log("get nonce",P);const I=JZ(b,P);y("sign");const F=await A.signMessage(I,b);y("waiting"),await i(A,{message:I,nonce:P,signature:F,address:b,wallet_name:((v=A.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),k(A)}catch(S){console.log("err",S),d(S.details||S.message)}}function U(){_.current=new Z7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),_.current.append(e.current)}function z(E){var m;console.log(_.current),(m=_.current)==null||m.update({data:E})}Ee.useEffect(()=>{s&&z(s)},[s]),Ee.useEffect(()=>{H(r)},[r]),Ee.useEffect(()=>{U()},[]);function Z(){d(""),z(""),H(r)}function R(){B(!0),navigator.clipboard.writeText(s),setTimeout(()=>{B(!1)},2500)}function W(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return le.jsxs("div",{children:[le.jsx("div",{className:"xc-text-center",children:le.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[le.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),le.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?le.jsx(Ec,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):le.jsx("img",{className:"xc-h-10 xc-w-10",src:M})})]})}),le.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[le.jsx("button",{disabled:!s,onClick:R,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:L?le.jsxs(le.Fragment,{children:[" ",le.jsx(lV,{})," Copied!"]}):le.jsxs(le.Fragment,{children:[le.jsx(pV,{}),"Copy QR URL"]})}),((me=r.config)==null?void 0:me.getWallet)&&le.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[le.jsx(hV,{}),"Get Extension"]}),((j=r.config)==null?void 0:j.desktop_link)&&le.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:W,children:[le.jsx(F8,{}),"Desktop"]})]}),le.jsx("div",{className:"xc-text-center",children:l?le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),le.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:Z,children:"Retry"})]}):le.jsxs(le.Fragment,{children:[p==="scan"&&le.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),p==="connect"&&le.jsx("p",{children:"Click connect in your wallet app"}),p==="sign"&&le.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),p==="waiting"&&le.jsx("div",{className:"xc-text-center",children:le.jsx(Ec,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const XZ="Accept connection request in the wallet",ZZ="Accept sign-in request in your wallet";function QZ(t,e,r){const n=window.location.host,i=window.location.href;return e9({address:t,chainId:r,domain:n,nonce:e,uri:i,version:"1"})}function n9(t){var y;const[e,r]=Ee.useState(),{wallet:n,onSignFinish:i}=t,s=Ee.useRef(),[o,a]=Ee.useState("connect"),{saveLastUsedWallet:u,chains:l}=Yl();async function d(_){var M;try{a("connect");const O=await n.connect();if(!O||O.length===0)throw new Error("Wallet connect error");const L=await n.getChain(),B=l.find(Z=>Z.id===L),k=l[0];B||(console.log("switch chain",l[0]),a("switch-chain"),await n.switchChain(l[0]));const H=yg(O[0]),U=QZ(H,_,k.id);a("sign");const z=await n.signMessage(U,H);if(!z||z.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:H,signature:z,message:U,nonce:_,wallet_name:((M=n.config)==null?void 0:M.name)||""}),u(n)}catch(O){console.log("walletSignin error",O.stack),console.log(O.details||O.message),r(O.details||O.message)}}async function p(){try{r("");const _=await xa.getNonce({account_type:"block_chain"});s.current=_,d(s.current)}catch(_){console.log(_.details),r(_.message)}}return Ee.useEffect(()=>{p()},[]),le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[le.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(y=n.config)==null?void 0:y.image,alt:""}),e&&le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),le.jsx("div",{className:"xc-flex xc-gap-2",children:le.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:p,children:"Retry"})})]}),!e&&le.jsxs(le.Fragment,{children:[o==="connect"&&le.jsx("span",{className:"xc-text-center",children:XZ}),o==="sign"&&le.jsx("span",{className:"xc-text-center",children:ZZ}),o==="waiting"&&le.jsx("span",{className:"xc-text-center",children:le.jsx(Ec,{className:"xc-animate-spin"})}),o==="switch-chain"&&le.jsxs("span",{className:"xc-text-center",children:["Switch to ",l[0].name]})]})]})}const Gu="https://static.codatta.io/codatta-connect/wallet-icons.svg",eQ="https://itunes.apple.com/app/",tQ="https://play.google.com/store/apps/details?id=",rQ="https://chromewebstore.google.com/detail/",nQ="https://chromewebstore.google.com/detail/",iQ="https://addons.mozilla.org/en-US/firefox/addon/",sQ="https://microsoftedge.microsoft.com/addons/detail/";function Yu(t){const{icon:e,title:r,link:n}=t;return le.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[le.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,le.jsx($8,{className:"xc-ml-auto xc-text-gray-400"})]})}function oQ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${eQ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${tQ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${rQ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${nQ}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${iQ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${sQ}${t.edge_addon_id}`),e}function i9(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=oQ(r);return le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),le.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),le.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),le.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&le.jsx(Yu,{link:n.chromeStoreLink,icon:`${Gu}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&le.jsx(Yu,{link:n.appStoreLink,icon:`${Gu}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&le.jsx(Yu,{link:n.playStoreLink,icon:`${Gu}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&le.jsx(Yu,{link:n.edgeStoreLink,icon:`${Gu}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&le.jsx(Yu,{link:n.braveStoreLink,icon:`${Gu}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&le.jsx(Yu,{link:n.firefoxStoreLink,icon:`${Gu}#firefox`,title:"Mozilla Firefox"})]})]})}function aQ(t){const{wallet:e}=t,[r,n]=Ee.useState(e.installed?"connect":"qr"),i=Bb();async function s(o,a){var l;const u=await xa.walletLogin({account_type:"block_chain",account_enum:i.role,connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Tc,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&le.jsx(r9,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&le.jsx(n9,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&le.jsx(i9,{wallet:e})]})}function cQ(t){const{wallet:e,onClick:r}=t,n=le.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return le.jsx(Ob,{icon:n,title:i,onClick:()=>r(e)})}function s9(t){const{connector:e}=t,[r,n]=Ee.useState(),[i,s]=Ee.useState([]),o=Ee.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d)}Ee.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Tc,{title:"Select wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[le.jsx(j8,{className:"xc-shrink-0 xc-opacity-50"}),le.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),le.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>le.jsx(cQ,{wallet:d,onClick:l},d.name))})]})}var o9={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,$[K+1]=G>>16&255,$[K+2]=G>>8&255,$[K+3]=G&255,$[K+4]=C>>24&255,$[K+5]=C>>16&255,$[K+6]=C>>8&255,$[K+7]=C&255}function O($,K,G,C,Y){var q,ae=0;for(q=0;q>>8)-1}function L($,K,G,C){return O($,K,G,C,16)}function B($,K,G,C){return O($,K,G,C,32)}function k($,K,G,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=G[0]&255|(G[1]&255)<<8|(G[2]&255)<<16|(G[3]&255)<<24,ae=G[4]&255|(G[5]&255)<<8|(G[6]&255)<<16|(G[7]&255)<<24,pe=G[8]&255|(G[9]&255)<<8|(G[10]&255)<<16|(G[11]&255)<<24,_e=G[12]&255|(G[13]&255)<<8|(G[14]&255)<<16|(G[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=K[0]&255|(K[1]&255)<<8|(K[2]&255)<<16|(K[3]&255)<<24,it=K[4]&255|(K[5]&255)<<8|(K[6]&255)<<16|(K[7]&255)<<24,Ue=K[8]&255|(K[9]&255)<<8|(K[10]&255)<<16|(K[11]&255)<<24,mt=K[12]&255|(K[13]&255)<<8|(K[14]&255)<<16|(K[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=G[16]&255|(G[17]&255)<<8|(G[18]&255)<<16|(G[19]&255)<<24,At=G[20]&255|(G[21]&255)<<8|(G[22]&255)<<16|(G[23]&255)<<24,Rt=G[24]&255|(G[25]&255)<<8|(G[26]&255)<<16|(G[27]&255)<<24,Mt=G[28]&255|(G[29]&255)<<8|(G[30]&255)<<16|(G[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=ae,wt=pe,lt=_e,at=Re,Ae=De,Pe=it,Ge=Ue,je=mt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;dt=dt+Y|0,_t=_t+q|0,ot=ot+ae|0,wt=wt+pe|0,lt=lt+_e|0,at=at+Re|0,Ae=Ae+De|0,Pe=Pe+it|0,Ge=Ge+Ue|0,je=je+mt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=_t>>>0&255,$[5]=_t>>>8&255,$[6]=_t>>>16&255,$[7]=_t>>>24&255,$[8]=ot>>>0&255,$[9]=ot>>>8&255,$[10]=ot>>>16&255,$[11]=ot>>>24&255,$[12]=wt>>>0&255,$[13]=wt>>>8&255,$[14]=wt>>>16&255,$[15]=wt>>>24&255,$[16]=lt>>>0&255,$[17]=lt>>>8&255,$[18]=lt>>>16&255,$[19]=lt>>>24&255,$[20]=at>>>0&255,$[21]=at>>>8&255,$[22]=at>>>16&255,$[23]=at>>>24&255,$[24]=Ae>>>0&255,$[25]=Ae>>>8&255,$[26]=Ae>>>16&255,$[27]=Ae>>>24&255,$[28]=Pe>>>0&255,$[29]=Pe>>>8&255,$[30]=Pe>>>16&255,$[31]=Pe>>>24&255,$[32]=Ge>>>0&255,$[33]=Ge>>>8&255,$[34]=Ge>>>16&255,$[35]=Ge>>>24&255,$[36]=je>>>0&255,$[37]=je>>>8&255,$[38]=je>>>16&255,$[39]=je>>>24&255,$[40]=qe>>>0&255,$[41]=qe>>>8&255,$[42]=qe>>>16&255,$[43]=qe>>>24&255,$[44]=Xe>>>0&255,$[45]=Xe>>>8&255,$[46]=Xe>>>16&255,$[47]=Xe>>>24&255,$[48]=kt>>>0&255,$[49]=kt>>>8&255,$[50]=kt>>>16&255,$[51]=kt>>>24&255,$[52]=Wt>>>0&255,$[53]=Wt>>>8&255,$[54]=Wt>>>16&255,$[55]=Wt>>>24&255,$[56]=Zt>>>0&255,$[57]=Zt>>>8&255,$[58]=Zt>>>16&255,$[59]=Zt>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255}function H($,K,G,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=G[0]&255|(G[1]&255)<<8|(G[2]&255)<<16|(G[3]&255)<<24,ae=G[4]&255|(G[5]&255)<<8|(G[6]&255)<<16|(G[7]&255)<<24,pe=G[8]&255|(G[9]&255)<<8|(G[10]&255)<<16|(G[11]&255)<<24,_e=G[12]&255|(G[13]&255)<<8|(G[14]&255)<<16|(G[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=K[0]&255|(K[1]&255)<<8|(K[2]&255)<<16|(K[3]&255)<<24,it=K[4]&255|(K[5]&255)<<8|(K[6]&255)<<16|(K[7]&255)<<24,Ue=K[8]&255|(K[9]&255)<<8|(K[10]&255)<<16|(K[11]&255)<<24,mt=K[12]&255|(K[13]&255)<<8|(K[14]&255)<<16|(K[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=G[16]&255|(G[17]&255)<<8|(G[18]&255)<<16|(G[19]&255)<<24,At=G[20]&255|(G[21]&255)<<8|(G[22]&255)<<16|(G[23]&255)<<24,Rt=G[24]&255|(G[25]&255)<<8|(G[26]&255)<<16|(G[27]&255)<<24,Mt=G[28]&255|(G[29]&255)<<8|(G[30]&255)<<16|(G[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=ae,wt=pe,lt=_e,at=Re,Ae=De,Pe=it,Ge=Ue,je=mt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=at>>>0&255,$[5]=at>>>8&255,$[6]=at>>>16&255,$[7]=at>>>24&255,$[8]=qe>>>0&255,$[9]=qe>>>8&255,$[10]=qe>>>16&255,$[11]=qe>>>24&255,$[12]=Kt>>>0&255,$[13]=Kt>>>8&255,$[14]=Kt>>>16&255,$[15]=Kt>>>24&255,$[16]=Ae>>>0&255,$[17]=Ae>>>8&255,$[18]=Ae>>>16&255,$[19]=Ae>>>24&255,$[20]=Pe>>>0&255,$[21]=Pe>>>8&255,$[22]=Pe>>>16&255,$[23]=Pe>>>24&255,$[24]=Ge>>>0&255,$[25]=Ge>>>8&255,$[26]=Ge>>>16&255,$[27]=Ge>>>24&255,$[28]=je>>>0&255,$[29]=je>>>8&255,$[30]=je>>>16&255,$[31]=je>>>24&255}function U($,K,G,C){k($,K,G,C)}function z($,K,G,C){H($,K,G,C)}var Z=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function R($,K,G,C,Y,q,ae){var pe=new Uint8Array(16),_e=new Uint8Array(64),Re,De;for(De=0;De<16;De++)pe[De]=0;for(De=0;De<8;De++)pe[De]=q[De];for(;Y>=64;){for(U(_e,pe,ae,Z),De=0;De<64;De++)$[K+De]=G[C+De]^_e[De];for(Re=1,De=8;De<16;De++)Re=Re+(pe[De]&255)|0,pe[De]=Re&255,Re>>>=8;Y-=64,K+=64,C+=64}if(Y>0)for(U(_e,pe,ae,Z),De=0;De=64;){for(U(ae,q,Y,Z),_e=0;_e<64;_e++)$[K+_e]=ae[_e];for(pe=1,_e=8;_e<16;_e++)pe=pe+(q[_e]&255)|0,q[_e]=pe&255,pe>>>=8;G-=64,K+=64}if(G>0)for(U(ae,q,Y,Z),_e=0;_e>>13|G<<3)&8191,C=$[4]&255|($[5]&255)<<8,this.r[2]=(G>>>10|C<<6)&7939,Y=$[6]&255|($[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,q=$[8]&255|($[9]&255)<<8,this.r[4]=(Y>>>4|q<<12)&255,this.r[5]=q>>>1&8190,ae=$[10]&255|($[11]&255)<<8,this.r[6]=(q>>>14|ae<<2)&8191,pe=$[12]&255|($[13]&255)<<8,this.r[7]=(ae>>>11|pe<<5)&8065,_e=$[14]&255|($[15]&255)<<8,this.r[8]=(pe>>>8|_e<<8)&8191,this.r[9]=_e>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};j.prototype.blocks=function($,K,G){for(var C=this.fin?0:2048,Y,q,ae,pe,_e,Re,De,it,Ue,mt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Ae=this.h[3],Pe=this.h[4],Ge=this.h[5],je=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],de=this.r[3],nr=this.r[4],pr=this.r[5],gr=this.r[6],Qt=this.r[7],mr=this.r[8],lr=this.r[9];G>=16;)Y=$[K+0]&255|($[K+1]&255)<<8,wt+=Y&8191,q=$[K+2]&255|($[K+3]&255)<<8,lt+=(Y>>>13|q<<3)&8191,ae=$[K+4]&255|($[K+5]&255)<<8,at+=(q>>>10|ae<<6)&8191,pe=$[K+6]&255|($[K+7]&255)<<8,Ae+=(ae>>>7|pe<<9)&8191,_e=$[K+8]&255|($[K+9]&255)<<8,Pe+=(pe>>>4|_e<<12)&8191,Ge+=_e>>>1&8191,Re=$[K+10]&255|($[K+11]&255)<<8,je+=(_e>>>14|Re<<2)&8191,De=$[K+12]&255|($[K+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=$[K+14]&255|($[K+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,Ue=0,mt=Ue,mt+=wt*Wt,mt+=lt*(5*lr),mt+=at*(5*mr),mt+=Ae*(5*Qt),mt+=Pe*(5*gr),Ue=mt>>>13,mt&=8191,mt+=Ge*(5*pr),mt+=je*(5*nr),mt+=qe*(5*de),mt+=Xe*(5*Kt),mt+=kt*(5*Zt),Ue+=mt>>>13,mt&=8191,st=Ue,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Ae*(5*mr),st+=Pe*(5*Qt),Ue=st>>>13,st&=8191,st+=Ge*(5*gr),st+=je*(5*pr),st+=qe*(5*nr),st+=Xe*(5*de),st+=kt*(5*Kt),Ue+=st>>>13,st&=8191,tt=Ue,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Ae*(5*lr),tt+=Pe*(5*mr),Ue=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=je*(5*gr),tt+=qe*(5*pr),tt+=Xe*(5*nr),tt+=kt*(5*de),Ue+=tt>>>13,tt&=8191,At=Ue,At+=wt*de,At+=lt*Kt,At+=at*Zt,At+=Ae*Wt,At+=Pe*(5*lr),Ue=At>>>13,At&=8191,At+=Ge*(5*mr),At+=je*(5*Qt),At+=qe*(5*gr),At+=Xe*(5*pr),At+=kt*(5*nr),Ue+=At>>>13,At&=8191,Rt=Ue,Rt+=wt*nr,Rt+=lt*de,Rt+=at*Kt,Rt+=Ae*Zt,Rt+=Pe*Wt,Ue=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=je*(5*mr),Rt+=qe*(5*Qt),Rt+=Xe*(5*gr),Rt+=kt*(5*pr),Ue+=Rt>>>13,Rt&=8191,Mt=Ue,Mt+=wt*pr,Mt+=lt*nr,Mt+=at*de,Mt+=Ae*Kt,Mt+=Pe*Zt,Ue=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=je*(5*lr),Mt+=qe*(5*mr),Mt+=Xe*(5*Qt),Mt+=kt*(5*gr),Ue+=Mt>>>13,Mt&=8191,Et=Ue,Et+=wt*gr,Et+=lt*pr,Et+=at*nr,Et+=Ae*de,Et+=Pe*Kt,Ue=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=je*Wt,Et+=qe*(5*lr),Et+=Xe*(5*mr),Et+=kt*(5*Qt),Ue+=Et>>>13,Et&=8191,dt=Ue,dt+=wt*Qt,dt+=lt*gr,dt+=at*pr,dt+=Ae*nr,dt+=Pe*de,Ue=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=je*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*mr),Ue+=dt>>>13,dt&=8191,_t=Ue,_t+=wt*mr,_t+=lt*Qt,_t+=at*gr,_t+=Ae*pr,_t+=Pe*nr,Ue=_t>>>13,_t&=8191,_t+=Ge*de,_t+=je*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),Ue+=_t>>>13,_t&=8191,ot=Ue,ot+=wt*lr,ot+=lt*mr,ot+=at*Qt,ot+=Ae*gr,ot+=Pe*pr,Ue=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=je*de,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,Ue+=ot>>>13,ot&=8191,Ue=(Ue<<2)+Ue|0,Ue=Ue+mt|0,mt=Ue&8191,Ue=Ue>>>13,st+=Ue,wt=mt,lt=st,at=tt,Ae=At,Pe=Rt,Ge=Mt,je=Et,qe=dt,Xe=_t,kt=ot,K+=16,G-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Ae,this.h[4]=Pe,this.h[5]=Ge,this.h[6]=je,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},j.prototype.finish=function($,K){var G=new Uint16Array(10),C,Y,q,ae;if(this.leftover){for(ae=this.leftover,this.buffer[ae++]=1;ae<16;ae++)this.buffer[ae]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,ae=2;ae<10;ae++)this.h[ae]+=C,C=this.h[ae]>>>13,this.h[ae]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,G[0]=this.h[0]+5,C=G[0]>>>13,G[0]&=8191,ae=1;ae<10;ae++)G[ae]=this.h[ae]+C,C=G[ae]>>>13,G[ae]&=8191;for(G[9]-=8192,Y=(C^1)-1,ae=0;ae<10;ae++)G[ae]&=Y;for(Y=~Y,ae=0;ae<10;ae++)this.h[ae]=this.h[ae]&Y|G[ae];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,q=this.h[0]+this.pad[0],this.h[0]=q&65535,ae=1;ae<8;ae++)q=(this.h[ae]+this.pad[ae]|0)+(q>>>16)|0,this.h[ae]=q&65535;$[K+0]=this.h[0]>>>0&255,$[K+1]=this.h[0]>>>8&255,$[K+2]=this.h[1]>>>0&255,$[K+3]=this.h[1]>>>8&255,$[K+4]=this.h[2]>>>0&255,$[K+5]=this.h[2]>>>8&255,$[K+6]=this.h[3]>>>0&255,$[K+7]=this.h[3]>>>8&255,$[K+8]=this.h[4]>>>0&255,$[K+9]=this.h[4]>>>8&255,$[K+10]=this.h[5]>>>0&255,$[K+11]=this.h[5]>>>8&255,$[K+12]=this.h[6]>>>0&255,$[K+13]=this.h[6]>>>8&255,$[K+14]=this.h[7]>>>0&255,$[K+15]=this.h[7]>>>8&255},j.prototype.update=function($,K,G){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>G&&(Y=G),C=0;C=16&&(Y=G-G%16,this.blocks($,K,Y),K+=Y,G-=Y),G){for(C=0;C>16&1),q[G-1]&=65535;q[15]=ae[15]-32767-(q[14]>>16&1),Y=q[15]>>16&1,q[14]&=65535,S(ae,q,1-Y)}for(G=0;G<16;G++)$[2*G]=ae[G]&255,$[2*G+1]=ae[G]>>8}function b($,K){var G=new Uint8Array(32),C=new Uint8Array(32);return A(G,$),A(C,K),B(G,0,C,0)}function P($){var K=new Uint8Array(32);return A(K,$),K[0]&1}function I($,K){var G;for(G=0;G<16;G++)$[G]=K[2*G]+(K[2*G+1]<<8);$[15]&=32767}function F($,K,G){for(var C=0;C<16;C++)$[C]=K[C]+G[C]}function ce($,K,G){for(var C=0;C<16;C++)$[C]=K[C]-G[C]}function D($,K,G){var C,Y,q=0,ae=0,pe=0,_e=0,Re=0,De=0,it=0,Ue=0,mt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Ae=0,Pe=0,Ge=0,je=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,de=G[0],nr=G[1],pr=G[2],gr=G[3],Qt=G[4],mr=G[5],lr=G[6],Lr=G[7],vr=G[8],xr=G[9],Br=G[10],$r=G[11],Ir=G[12],ln=G[13],hn=G[14],dn=G[15];C=K[0],q+=C*de,ae+=C*nr,pe+=C*pr,_e+=C*gr,Re+=C*Qt,De+=C*mr,it+=C*lr,Ue+=C*Lr,mt+=C*vr,st+=C*xr,tt+=C*Br,At+=C*$r,Rt+=C*Ir,Mt+=C*ln,Et+=C*hn,dt+=C*dn,C=K[1],ae+=C*de,pe+=C*nr,_e+=C*pr,Re+=C*gr,De+=C*Qt,it+=C*mr,Ue+=C*lr,mt+=C*Lr,st+=C*vr,tt+=C*xr,At+=C*Br,Rt+=C*$r,Mt+=C*Ir,Et+=C*ln,dt+=C*hn,_t+=C*dn,C=K[2],pe+=C*de,_e+=C*nr,Re+=C*pr,De+=C*gr,it+=C*Qt,Ue+=C*mr,mt+=C*lr,st+=C*Lr,tt+=C*vr,At+=C*xr,Rt+=C*Br,Mt+=C*$r,Et+=C*Ir,dt+=C*ln,_t+=C*hn,ot+=C*dn,C=K[3],_e+=C*de,Re+=C*nr,De+=C*pr,it+=C*gr,Ue+=C*Qt,mt+=C*mr,st+=C*lr,tt+=C*Lr,At+=C*vr,Rt+=C*xr,Mt+=C*Br,Et+=C*$r,dt+=C*Ir,_t+=C*ln,ot+=C*hn,wt+=C*dn,C=K[4],Re+=C*de,De+=C*nr,it+=C*pr,Ue+=C*gr,mt+=C*Qt,st+=C*mr,tt+=C*lr,At+=C*Lr,Rt+=C*vr,Mt+=C*xr,Et+=C*Br,dt+=C*$r,_t+=C*Ir,ot+=C*ln,wt+=C*hn,lt+=C*dn,C=K[5],De+=C*de,it+=C*nr,Ue+=C*pr,mt+=C*gr,st+=C*Qt,tt+=C*mr,At+=C*lr,Rt+=C*Lr,Mt+=C*vr,Et+=C*xr,dt+=C*Br,_t+=C*$r,ot+=C*Ir,wt+=C*ln,lt+=C*hn,at+=C*dn,C=K[6],it+=C*de,Ue+=C*nr,mt+=C*pr,st+=C*gr,tt+=C*Qt,At+=C*mr,Rt+=C*lr,Mt+=C*Lr,Et+=C*vr,dt+=C*xr,_t+=C*Br,ot+=C*$r,wt+=C*Ir,lt+=C*ln,at+=C*hn,Ae+=C*dn,C=K[7],Ue+=C*de,mt+=C*nr,st+=C*pr,tt+=C*gr,At+=C*Qt,Rt+=C*mr,Mt+=C*lr,Et+=C*Lr,dt+=C*vr,_t+=C*xr,ot+=C*Br,wt+=C*$r,lt+=C*Ir,at+=C*ln,Ae+=C*hn,Pe+=C*dn,C=K[8],mt+=C*de,st+=C*nr,tt+=C*pr,At+=C*gr,Rt+=C*Qt,Mt+=C*mr,Et+=C*lr,dt+=C*Lr,_t+=C*vr,ot+=C*xr,wt+=C*Br,lt+=C*$r,at+=C*Ir,Ae+=C*ln,Pe+=C*hn,Ge+=C*dn,C=K[9],st+=C*de,tt+=C*nr,At+=C*pr,Rt+=C*gr,Mt+=C*Qt,Et+=C*mr,dt+=C*lr,_t+=C*Lr,ot+=C*vr,wt+=C*xr,lt+=C*Br,at+=C*$r,Ae+=C*Ir,Pe+=C*ln,Ge+=C*hn,je+=C*dn,C=K[10],tt+=C*de,At+=C*nr,Rt+=C*pr,Mt+=C*gr,Et+=C*Qt,dt+=C*mr,_t+=C*lr,ot+=C*Lr,wt+=C*vr,lt+=C*xr,at+=C*Br,Ae+=C*$r,Pe+=C*Ir,Ge+=C*ln,je+=C*hn,qe+=C*dn,C=K[11],At+=C*de,Rt+=C*nr,Mt+=C*pr,Et+=C*gr,dt+=C*Qt,_t+=C*mr,ot+=C*lr,wt+=C*Lr,lt+=C*vr,at+=C*xr,Ae+=C*Br,Pe+=C*$r,Ge+=C*Ir,je+=C*ln,qe+=C*hn,Xe+=C*dn,C=K[12],Rt+=C*de,Mt+=C*nr,Et+=C*pr,dt+=C*gr,_t+=C*Qt,ot+=C*mr,wt+=C*lr,lt+=C*Lr,at+=C*vr,Ae+=C*xr,Pe+=C*Br,Ge+=C*$r,je+=C*Ir,qe+=C*ln,Xe+=C*hn,kt+=C*dn,C=K[13],Mt+=C*de,Et+=C*nr,dt+=C*pr,_t+=C*gr,ot+=C*Qt,wt+=C*mr,lt+=C*lr,at+=C*Lr,Ae+=C*vr,Pe+=C*xr,Ge+=C*Br,je+=C*$r,qe+=C*Ir,Xe+=C*ln,kt+=C*hn,Wt+=C*dn,C=K[14],Et+=C*de,dt+=C*nr,_t+=C*pr,ot+=C*gr,wt+=C*Qt,lt+=C*mr,at+=C*lr,Ae+=C*Lr,Pe+=C*vr,Ge+=C*xr,je+=C*Br,qe+=C*$r,Xe+=C*Ir,kt+=C*ln,Wt+=C*hn,Zt+=C*dn,C=K[15],dt+=C*de,_t+=C*nr,ot+=C*pr,wt+=C*gr,lt+=C*Qt,at+=C*mr,Ae+=C*lr,Pe+=C*Lr,Ge+=C*vr,je+=C*xr,qe+=C*Br,Xe+=C*$r,kt+=C*Ir,Wt+=C*ln,Zt+=C*hn,Kt+=C*dn,q+=38*_t,ae+=38*ot,pe+=38*wt,_e+=38*lt,Re+=38*at,De+=38*Ae,it+=38*Pe,Ue+=38*Ge,mt+=38*je,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=ae+Y+65535,Y=Math.floor(C/65536),ae=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=_e+Y+65535,Y=Math.floor(C/65536),_e=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=mt+Y+65535,Y=Math.floor(C/65536),mt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=ae+Y+65535,Y=Math.floor(C/65536),ae=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=_e+Y+65535,Y=Math.floor(C/65536),_e=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=mt+Y+65535,Y=Math.floor(C/65536),mt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),$[0]=q,$[1]=ae,$[2]=pe,$[3]=_e,$[4]=Re,$[5]=De,$[6]=it,$[7]=Ue,$[8]=mt,$[9]=st,$[10]=tt,$[11]=At,$[12]=Rt,$[13]=Mt,$[14]=Et,$[15]=dt}function se($,K){D($,K,K)}function ee($,K){var G=r(),C;for(C=0;C<16;C++)G[C]=K[C];for(C=253;C>=0;C--)se(G,G),C!==2&&C!==4&&D(G,G,K);for(C=0;C<16;C++)$[C]=G[C]}function J($,K){var G=r(),C;for(C=0;C<16;C++)G[C]=K[C];for(C=250;C>=0;C--)se(G,G),C!==1&&D(G,G,K);for(C=0;C<16;C++)$[C]=G[C]}function Q($,K,G){var C=new Uint8Array(32),Y=new Float64Array(80),q,ae,pe=r(),_e=r(),Re=r(),De=r(),it=r(),Ue=r();for(ae=0;ae<31;ae++)C[ae]=K[ae];for(C[31]=K[31]&127|64,C[0]&=248,I(Y,G),ae=0;ae<16;ae++)_e[ae]=Y[ae],De[ae]=pe[ae]=Re[ae]=0;for(pe[0]=De[0]=1,ae=254;ae>=0;--ae)q=C[ae>>>3]>>>(ae&7)&1,S(pe,_e,q),S(Re,De,q),F(it,pe,Re),ce(pe,pe,Re),F(Re,_e,De),ce(_e,_e,De),se(De,it),se(Ue,pe),D(pe,Re,pe),D(Re,_e,it),F(it,pe,Re),ce(pe,pe,Re),se(_e,pe),ce(Re,De,Ue),D(pe,Re,u),F(pe,pe,De),D(Re,Re,pe),D(pe,De,Ue),D(De,_e,Y),se(_e,it),S(pe,_e,q),S(Re,De,q);for(ae=0;ae<16;ae++)Y[ae+16]=pe[ae],Y[ae+32]=Re[ae],Y[ae+48]=_e[ae],Y[ae+64]=De[ae];var mt=Y.subarray(32),st=Y.subarray(16);return ee(mt,mt),D(st,st,mt),A($,st),0}function T($,K){return Q($,K,s)}function X($,K){return n(K,32),T($,K)}function re($,K,G){var C=new Uint8Array(32);return Q(C,G,K),z($,i,C,Z)}var ge=f,oe=g;function fe($,K,G,C,Y,q){var ae=new Uint8Array(32);return re(ae,Y,q),ge($,K,G,C,ae)}function be($,K,G,C,Y,q){var ae=new Uint8Array(32);return re(ae,Y,q),oe($,K,G,C,ae)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne($,K,G,C){for(var Y=new Int32Array(16),q=new Int32Array(16),ae,pe,_e,Re,De,it,Ue,mt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Ae,Pe,Ge,je,qe,Xe,kt=$[0],Wt=$[1],Zt=$[2],Kt=$[3],de=$[4],nr=$[5],pr=$[6],gr=$[7],Qt=K[0],mr=K[1],lr=K[2],Lr=K[3],vr=K[4],xr=K[5],Br=K[6],$r=K[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=G[at+0]<<24|G[at+1]<<16|G[at+2]<<8|G[at+3],q[lt]=G[at+4]<<24|G[at+5]<<16|G[at+6]<<8|G[at+7];for(lt=0;lt<80;lt++)if(ae=kt,pe=Wt,_e=Zt,Re=Kt,De=de,it=nr,Ue=pr,mt=gr,st=Qt,tt=mr,At=lr,Rt=Lr,Mt=vr,Et=xr,dt=Br,_t=$r,Ae=gr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(de>>>14|vr<<18)^(de>>>18|vr<<14)^(vr>>>9|de<<23),Pe=(vr>>>14|de<<18)^(vr>>>18|de<<14)^(de>>>9|vr<<23),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=de&nr^~de&pr,Pe=vr&xr^~vr&Br,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Me[lt*2],Pe=Me[lt*2+1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Y[lt%16],Pe=q[lt%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|je<<16,Ae=ot,Pe=wt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Pe=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=kt&Wt^kt&Zt^Wt&Zt,Pe=Qt&mr^Qt&lr^mr&lr,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,mt=qe&65535|Xe<<16,_t=Ge&65535|je<<16,Ae=Re,Pe=Rt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=ot,Pe=wt,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|je<<16,Wt=ae,Zt=pe,Kt=_e,de=Re,nr=De,pr=it,gr=Ue,kt=mt,mr=st,lr=tt,Lr=At,vr=Rt,xr=Mt,Br=Et,$r=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Ae=Y[at],Pe=q[at],Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=Y[(at+9)%16],Pe=q[(at+9)%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+1)%16],wt=q[(at+1)%16],Ae=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Pe=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+14)%16],wt=q[(at+14)%16],Ae=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Pe=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,q[at]=Ge&65535|je<<16;Ae=kt,Pe=Qt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[0],Pe=K[0],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[0]=kt=qe&65535|Xe<<16,K[0]=Qt=Ge&65535|je<<16,Ae=Wt,Pe=mr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[1],Pe=K[1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[1]=Wt=qe&65535|Xe<<16,K[1]=mr=Ge&65535|je<<16,Ae=Zt,Pe=lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[2],Pe=K[2],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[2]=Zt=qe&65535|Xe<<16,K[2]=lr=Ge&65535|je<<16,Ae=Kt,Pe=Lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[3],Pe=K[3],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[3]=Kt=qe&65535|Xe<<16,K[3]=Lr=Ge&65535|je<<16,Ae=de,Pe=vr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[4],Pe=K[4],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[4]=de=qe&65535|Xe<<16,K[4]=vr=Ge&65535|je<<16,Ae=nr,Pe=xr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[5],Pe=K[5],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[5]=nr=qe&65535|Xe<<16,K[5]=xr=Ge&65535|je<<16,Ae=pr,Pe=Br,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[6],Pe=K[6],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[6]=pr=qe&65535|Xe<<16,K[6]=Br=Ge&65535|je<<16,Ae=gr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[7],Pe=K[7],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[7]=gr=qe&65535|Xe<<16,K[7]=$r=Ge&65535|je<<16,Ir+=128,C-=128}return C}function Te($,K,G){var C=new Int32Array(8),Y=new Int32Array(8),q=new Uint8Array(256),ae,pe=G;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,K,G),G%=128,ae=0;ae=0;--Y)C=G[Y/8|0]>>(Y&7)&1,Ie($,K,C),$e(K,$),$e($,$),Ie($,K,C)}function ke($,K){var G=[r(),r(),r(),r()];v(G[0],p),v(G[1],y),v(G[2],a),D(G[3],p,y),Ve($,G,K)}function ze($,K,G){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],q;for(G||n(K,32),Te(C,K,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le($,Y),q=0;q<32;q++)K[q+32]=$[q];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Se($,K){var G,C,Y,q;for(C=63;C>=32;--C){for(G=0,Y=C-32,q=C-12;Y>4)*He[Y],G=K[Y]>>8,K[Y]&=255;for(Y=0;Y<32;Y++)K[Y]-=G*He[Y];for(C=0;C<32;C++)K[C+1]+=K[C]>>8,$[C]=K[C]&255}function Qe($){var K=new Float64Array(64),G;for(G=0;G<64;G++)K[G]=$[G];for(G=0;G<64;G++)$[G]=0;Se($,K)}function ct($,K,G,C){var Y=new Uint8Array(64),q=new Uint8Array(64),ae=new Uint8Array(64),pe,_e,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=G+64;for(pe=0;pe>7&&ce($[0],o,$[0]),D($[3],$[0],$[1]),0)}function et($,K,G,C){var Y,q=new Uint8Array(32),ae=new Uint8Array(64),pe=[r(),r(),r(),r()],_e=[r(),r(),r(),r()];if(G<64||Be(_e,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var $=new Uint8Array(bt),K=new Uint8Array(Dt);return ze($,K),{publicKey:$,secretKey:K}},e.sign.keyPair.fromSecretKey=function($){if(nt($),$.length!==Dt)throw new Error("bad secret key size");for(var K=new Uint8Array(bt),G=0;G=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function $b(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function ap(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{o(ce),u(!1),y("scan")}),m.on("error",ce=>{console.log(ce)}),m.on("session_update",ce=>{console.log("session_update",ce)}),!await m.connect(JZ))throw new Error("Walletconnect init failed");const A=new Ga(m);O(((f=A.config)==null?void 0:f.image)||((g=E.config)==null?void 0:g.image));const b=await A.getAddress(),P=await xa.getNonce({account_type:"block_chain"});console.log("get nonce",P);const I=XZ(b,P);y("sign");const F=await A.signMessage(I,b);y("waiting"),await i(A,{message:I,nonce:P,signature:F,address:b,wallet_name:((v=A.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),console.log("save wallet connect wallet!"),k(A)}catch(S){console.log("err",S),d(S.details||S.message)}}function U(){_.current=new Z7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),_.current.append(e.current)}function z(E){var m;console.log(_.current),(m=_.current)==null||m.update({data:E})}Ee.useEffect(()=>{s&&z(s)},[s]),Ee.useEffect(()=>{H(r)},[r]),Ee.useEffect(()=>{U()},[]);function Z(){d(""),z(""),H(r)}function R(){B(!0),navigator.clipboard.writeText(s),setTimeout(()=>{B(!1)},2500)}function W(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return le.jsxs("div",{children:[le.jsx("div",{className:"xc-text-center",children:le.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[le.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),le.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?le.jsx(Sc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):le.jsx("img",{className:"xc-h-10 xc-w-10",src:M})})]})}),le.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[le.jsx("button",{disabled:!s,onClick:R,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:L?le.jsxs(le.Fragment,{children:[" ",le.jsx(hV,{})," Copied!"]}):le.jsxs(le.Fragment,{children:[le.jsx(gV,{}),"Copy QR URL"]})}),((me=r.config)==null?void 0:me.getWallet)&&le.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[le.jsx(dV,{}),"Get Extension"]}),((j=r.config)==null?void 0:j.desktop_link)&&le.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:W,children:[le.jsx(F8,{}),"Desktop"]})]}),le.jsx("div",{className:"xc-text-center",children:l?le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),le.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:Z,children:"Retry"})]}):le.jsxs(le.Fragment,{children:[p==="scan"&&le.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),p==="connect"&&le.jsx("p",{children:"Click connect in your wallet app"}),p==="sign"&&le.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),p==="waiting"&&le.jsx("div",{className:"xc-text-center",children:le.jsx(Sc,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const ZZ=RC({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),QZ="Accept connection request in the wallet",eQ="Accept sign-in request in your wallet";function tQ(t,e,r){const n=window.location.host,i=window.location.href;return e9({address:t,chainId:r,domain:n,nonce:e,uri:i,version:"1"})}function n9(t){var y;const[e,r]=Ee.useState(),{wallet:n,onSignFinish:i}=t,s=Ee.useRef(),[o,a]=Ee.useState("connect"),{saveLastUsedWallet:u,chains:l}=Yl();async function d(_){var M;try{a("connect");const O=await n.connect();if(!O||O.length===0)throw new Error("Wallet connect error");const L=await n.getChain(),B=l.find(Z=>Z.id===L),k=B||l[0]||ZZ;!B&&l.length>0&&(a("switch-chain"),await n.switchChain(k));const H=yg(O[0]),U=tQ(H,_,k.id);a("sign");const z=await n.signMessage(U,H);if(!z||z.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:H,signature:z,message:U,nonce:_,wallet_name:((M=n.config)==null?void 0:M.name)||""}),u(n)}catch(O){console.log("walletSignin error",O.stack),console.log(O.details||O.message),r(O.details||O.message)}}async function p(){try{r("");const _=await xa.getNonce({account_type:"block_chain"});s.current=_,d(s.current)}catch(_){console.log(_.details),r(_.message)}}return Ee.useEffect(()=>{p()},[]),le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[le.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(y=n.config)==null?void 0:y.image,alt:""}),e&&le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),le.jsx("div",{className:"xc-flex xc-gap-2",children:le.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:p,children:"Retry"})})]}),!e&&le.jsxs(le.Fragment,{children:[o==="connect"&&le.jsx("span",{className:"xc-text-center",children:QZ}),o==="sign"&&le.jsx("span",{className:"xc-text-center",children:eQ}),o==="waiting"&&le.jsx("span",{className:"xc-text-center",children:le.jsx(Sc,{className:"xc-animate-spin"})}),o==="switch-chain"&&le.jsxs("span",{className:"xc-text-center",children:["Switch to ",l[0].name]})]})]})}const Gu="https://static.codatta.io/codatta-connect/wallet-icons.svg",rQ="https://itunes.apple.com/app/",nQ="https://play.google.com/store/apps/details?id=",iQ="https://chromewebstore.google.com/detail/",sQ="https://chromewebstore.google.com/detail/",oQ="https://addons.mozilla.org/en-US/firefox/addon/",aQ="https://microsoftedge.microsoft.com/addons/detail/";function Yu(t){const{icon:e,title:r,link:n}=t;return le.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[le.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,le.jsx($8,{className:"xc-ml-auto xc-text-gray-400"})]})}function cQ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${rQ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${nQ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${iQ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${sQ}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${oQ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${aQ}${t.edge_addon_id}`),e}function i9(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=cQ(r);return le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),le.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),le.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),le.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&le.jsx(Yu,{link:n.chromeStoreLink,icon:`${Gu}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&le.jsx(Yu,{link:n.appStoreLink,icon:`${Gu}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&le.jsx(Yu,{link:n.playStoreLink,icon:`${Gu}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&le.jsx(Yu,{link:n.edgeStoreLink,icon:`${Gu}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&le.jsx(Yu,{link:n.braveStoreLink,icon:`${Gu}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&le.jsx(Yu,{link:n.firefoxStoreLink,icon:`${Gu}#firefox`,title:"Mozilla Firefox"})]})]})}function uQ(t){const{wallet:e}=t,[r,n]=Ee.useState(e.installed?"connect":"qr"),i=Bb();async function s(o,a){var l;const u=await xa.walletLogin({account_type:"block_chain",account_enum:i.role,connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Rc,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&le.jsx(r9,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&le.jsx(n9,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&le.jsx(i9,{wallet:e})]})}function fQ(t){const{wallet:e,onClick:r}=t,n=le.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return le.jsx(Ob,{icon:n,title:i,onClick:()=>r(e)})}function s9(t){const{connector:e}=t,[r,n]=Ee.useState(),[i,s]=Ee.useState([]),o=Ee.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d)}Ee.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Rc,{title:"Select wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[le.jsx(j8,{className:"xc-shrink-0 xc-opacity-50"}),le.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),le.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>le.jsx(fQ,{wallet:d,onClick:l},d.name))})]})}var o9={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,$[K+1]=G>>16&255,$[K+2]=G>>8&255,$[K+3]=G&255,$[K+4]=C>>24&255,$[K+5]=C>>16&255,$[K+6]=C>>8&255,$[K+7]=C&255}function O($,K,G,C,Y){var q,ae=0;for(q=0;q>>8)-1}function L($,K,G,C){return O($,K,G,C,16)}function B($,K,G,C){return O($,K,G,C,32)}function k($,K,G,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=G[0]&255|(G[1]&255)<<8|(G[2]&255)<<16|(G[3]&255)<<24,ae=G[4]&255|(G[5]&255)<<8|(G[6]&255)<<16|(G[7]&255)<<24,pe=G[8]&255|(G[9]&255)<<8|(G[10]&255)<<16|(G[11]&255)<<24,_e=G[12]&255|(G[13]&255)<<8|(G[14]&255)<<16|(G[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=K[0]&255|(K[1]&255)<<8|(K[2]&255)<<16|(K[3]&255)<<24,it=K[4]&255|(K[5]&255)<<8|(K[6]&255)<<16|(K[7]&255)<<24,Ue=K[8]&255|(K[9]&255)<<8|(K[10]&255)<<16|(K[11]&255)<<24,mt=K[12]&255|(K[13]&255)<<8|(K[14]&255)<<16|(K[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=G[16]&255|(G[17]&255)<<8|(G[18]&255)<<16|(G[19]&255)<<24,At=G[20]&255|(G[21]&255)<<8|(G[22]&255)<<16|(G[23]&255)<<24,Rt=G[24]&255|(G[25]&255)<<8|(G[26]&255)<<16|(G[27]&255)<<24,Mt=G[28]&255|(G[29]&255)<<8|(G[30]&255)<<16|(G[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=ae,wt=pe,lt=_e,at=Re,Ae=De,Pe=it,Ge=Ue,je=mt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;dt=dt+Y|0,_t=_t+q|0,ot=ot+ae|0,wt=wt+pe|0,lt=lt+_e|0,at=at+Re|0,Ae=Ae+De|0,Pe=Pe+it|0,Ge=Ge+Ue|0,je=je+mt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=_t>>>0&255,$[5]=_t>>>8&255,$[6]=_t>>>16&255,$[7]=_t>>>24&255,$[8]=ot>>>0&255,$[9]=ot>>>8&255,$[10]=ot>>>16&255,$[11]=ot>>>24&255,$[12]=wt>>>0&255,$[13]=wt>>>8&255,$[14]=wt>>>16&255,$[15]=wt>>>24&255,$[16]=lt>>>0&255,$[17]=lt>>>8&255,$[18]=lt>>>16&255,$[19]=lt>>>24&255,$[20]=at>>>0&255,$[21]=at>>>8&255,$[22]=at>>>16&255,$[23]=at>>>24&255,$[24]=Ae>>>0&255,$[25]=Ae>>>8&255,$[26]=Ae>>>16&255,$[27]=Ae>>>24&255,$[28]=Pe>>>0&255,$[29]=Pe>>>8&255,$[30]=Pe>>>16&255,$[31]=Pe>>>24&255,$[32]=Ge>>>0&255,$[33]=Ge>>>8&255,$[34]=Ge>>>16&255,$[35]=Ge>>>24&255,$[36]=je>>>0&255,$[37]=je>>>8&255,$[38]=je>>>16&255,$[39]=je>>>24&255,$[40]=qe>>>0&255,$[41]=qe>>>8&255,$[42]=qe>>>16&255,$[43]=qe>>>24&255,$[44]=Xe>>>0&255,$[45]=Xe>>>8&255,$[46]=Xe>>>16&255,$[47]=Xe>>>24&255,$[48]=kt>>>0&255,$[49]=kt>>>8&255,$[50]=kt>>>16&255,$[51]=kt>>>24&255,$[52]=Wt>>>0&255,$[53]=Wt>>>8&255,$[54]=Wt>>>16&255,$[55]=Wt>>>24&255,$[56]=Zt>>>0&255,$[57]=Zt>>>8&255,$[58]=Zt>>>16&255,$[59]=Zt>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255}function H($,K,G,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=G[0]&255|(G[1]&255)<<8|(G[2]&255)<<16|(G[3]&255)<<24,ae=G[4]&255|(G[5]&255)<<8|(G[6]&255)<<16|(G[7]&255)<<24,pe=G[8]&255|(G[9]&255)<<8|(G[10]&255)<<16|(G[11]&255)<<24,_e=G[12]&255|(G[13]&255)<<8|(G[14]&255)<<16|(G[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=K[0]&255|(K[1]&255)<<8|(K[2]&255)<<16|(K[3]&255)<<24,it=K[4]&255|(K[5]&255)<<8|(K[6]&255)<<16|(K[7]&255)<<24,Ue=K[8]&255|(K[9]&255)<<8|(K[10]&255)<<16|(K[11]&255)<<24,mt=K[12]&255|(K[13]&255)<<8|(K[14]&255)<<16|(K[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=G[16]&255|(G[17]&255)<<8|(G[18]&255)<<16|(G[19]&255)<<24,At=G[20]&255|(G[21]&255)<<8|(G[22]&255)<<16|(G[23]&255)<<24,Rt=G[24]&255|(G[25]&255)<<8|(G[26]&255)<<16|(G[27]&255)<<24,Mt=G[28]&255|(G[29]&255)<<8|(G[30]&255)<<16|(G[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=ae,wt=pe,lt=_e,at=Re,Ae=De,Pe=it,Ge=Ue,je=mt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=at>>>0&255,$[5]=at>>>8&255,$[6]=at>>>16&255,$[7]=at>>>24&255,$[8]=qe>>>0&255,$[9]=qe>>>8&255,$[10]=qe>>>16&255,$[11]=qe>>>24&255,$[12]=Kt>>>0&255,$[13]=Kt>>>8&255,$[14]=Kt>>>16&255,$[15]=Kt>>>24&255,$[16]=Ae>>>0&255,$[17]=Ae>>>8&255,$[18]=Ae>>>16&255,$[19]=Ae>>>24&255,$[20]=Pe>>>0&255,$[21]=Pe>>>8&255,$[22]=Pe>>>16&255,$[23]=Pe>>>24&255,$[24]=Ge>>>0&255,$[25]=Ge>>>8&255,$[26]=Ge>>>16&255,$[27]=Ge>>>24&255,$[28]=je>>>0&255,$[29]=je>>>8&255,$[30]=je>>>16&255,$[31]=je>>>24&255}function U($,K,G,C){k($,K,G,C)}function z($,K,G,C){H($,K,G,C)}var Z=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function R($,K,G,C,Y,q,ae){var pe=new Uint8Array(16),_e=new Uint8Array(64),Re,De;for(De=0;De<16;De++)pe[De]=0;for(De=0;De<8;De++)pe[De]=q[De];for(;Y>=64;){for(U(_e,pe,ae,Z),De=0;De<64;De++)$[K+De]=G[C+De]^_e[De];for(Re=1,De=8;De<16;De++)Re=Re+(pe[De]&255)|0,pe[De]=Re&255,Re>>>=8;Y-=64,K+=64,C+=64}if(Y>0)for(U(_e,pe,ae,Z),De=0;De=64;){for(U(ae,q,Y,Z),_e=0;_e<64;_e++)$[K+_e]=ae[_e];for(pe=1,_e=8;_e<16;_e++)pe=pe+(q[_e]&255)|0,q[_e]=pe&255,pe>>>=8;G-=64,K+=64}if(G>0)for(U(ae,q,Y,Z),_e=0;_e>>13|G<<3)&8191,C=$[4]&255|($[5]&255)<<8,this.r[2]=(G>>>10|C<<6)&7939,Y=$[6]&255|($[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,q=$[8]&255|($[9]&255)<<8,this.r[4]=(Y>>>4|q<<12)&255,this.r[5]=q>>>1&8190,ae=$[10]&255|($[11]&255)<<8,this.r[6]=(q>>>14|ae<<2)&8191,pe=$[12]&255|($[13]&255)<<8,this.r[7]=(ae>>>11|pe<<5)&8065,_e=$[14]&255|($[15]&255)<<8,this.r[8]=(pe>>>8|_e<<8)&8191,this.r[9]=_e>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};j.prototype.blocks=function($,K,G){for(var C=this.fin?0:2048,Y,q,ae,pe,_e,Re,De,it,Ue,mt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Ae=this.h[3],Pe=this.h[4],Ge=this.h[5],je=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],de=this.r[3],nr=this.r[4],pr=this.r[5],gr=this.r[6],Qt=this.r[7],mr=this.r[8],lr=this.r[9];G>=16;)Y=$[K+0]&255|($[K+1]&255)<<8,wt+=Y&8191,q=$[K+2]&255|($[K+3]&255)<<8,lt+=(Y>>>13|q<<3)&8191,ae=$[K+4]&255|($[K+5]&255)<<8,at+=(q>>>10|ae<<6)&8191,pe=$[K+6]&255|($[K+7]&255)<<8,Ae+=(ae>>>7|pe<<9)&8191,_e=$[K+8]&255|($[K+9]&255)<<8,Pe+=(pe>>>4|_e<<12)&8191,Ge+=_e>>>1&8191,Re=$[K+10]&255|($[K+11]&255)<<8,je+=(_e>>>14|Re<<2)&8191,De=$[K+12]&255|($[K+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=$[K+14]&255|($[K+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,Ue=0,mt=Ue,mt+=wt*Wt,mt+=lt*(5*lr),mt+=at*(5*mr),mt+=Ae*(5*Qt),mt+=Pe*(5*gr),Ue=mt>>>13,mt&=8191,mt+=Ge*(5*pr),mt+=je*(5*nr),mt+=qe*(5*de),mt+=Xe*(5*Kt),mt+=kt*(5*Zt),Ue+=mt>>>13,mt&=8191,st=Ue,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Ae*(5*mr),st+=Pe*(5*Qt),Ue=st>>>13,st&=8191,st+=Ge*(5*gr),st+=je*(5*pr),st+=qe*(5*nr),st+=Xe*(5*de),st+=kt*(5*Kt),Ue+=st>>>13,st&=8191,tt=Ue,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Ae*(5*lr),tt+=Pe*(5*mr),Ue=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=je*(5*gr),tt+=qe*(5*pr),tt+=Xe*(5*nr),tt+=kt*(5*de),Ue+=tt>>>13,tt&=8191,At=Ue,At+=wt*de,At+=lt*Kt,At+=at*Zt,At+=Ae*Wt,At+=Pe*(5*lr),Ue=At>>>13,At&=8191,At+=Ge*(5*mr),At+=je*(5*Qt),At+=qe*(5*gr),At+=Xe*(5*pr),At+=kt*(5*nr),Ue+=At>>>13,At&=8191,Rt=Ue,Rt+=wt*nr,Rt+=lt*de,Rt+=at*Kt,Rt+=Ae*Zt,Rt+=Pe*Wt,Ue=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=je*(5*mr),Rt+=qe*(5*Qt),Rt+=Xe*(5*gr),Rt+=kt*(5*pr),Ue+=Rt>>>13,Rt&=8191,Mt=Ue,Mt+=wt*pr,Mt+=lt*nr,Mt+=at*de,Mt+=Ae*Kt,Mt+=Pe*Zt,Ue=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=je*(5*lr),Mt+=qe*(5*mr),Mt+=Xe*(5*Qt),Mt+=kt*(5*gr),Ue+=Mt>>>13,Mt&=8191,Et=Ue,Et+=wt*gr,Et+=lt*pr,Et+=at*nr,Et+=Ae*de,Et+=Pe*Kt,Ue=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=je*Wt,Et+=qe*(5*lr),Et+=Xe*(5*mr),Et+=kt*(5*Qt),Ue+=Et>>>13,Et&=8191,dt=Ue,dt+=wt*Qt,dt+=lt*gr,dt+=at*pr,dt+=Ae*nr,dt+=Pe*de,Ue=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=je*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*mr),Ue+=dt>>>13,dt&=8191,_t=Ue,_t+=wt*mr,_t+=lt*Qt,_t+=at*gr,_t+=Ae*pr,_t+=Pe*nr,Ue=_t>>>13,_t&=8191,_t+=Ge*de,_t+=je*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),Ue+=_t>>>13,_t&=8191,ot=Ue,ot+=wt*lr,ot+=lt*mr,ot+=at*Qt,ot+=Ae*gr,ot+=Pe*pr,Ue=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=je*de,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,Ue+=ot>>>13,ot&=8191,Ue=(Ue<<2)+Ue|0,Ue=Ue+mt|0,mt=Ue&8191,Ue=Ue>>>13,st+=Ue,wt=mt,lt=st,at=tt,Ae=At,Pe=Rt,Ge=Mt,je=Et,qe=dt,Xe=_t,kt=ot,K+=16,G-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Ae,this.h[4]=Pe,this.h[5]=Ge,this.h[6]=je,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},j.prototype.finish=function($,K){var G=new Uint16Array(10),C,Y,q,ae;if(this.leftover){for(ae=this.leftover,this.buffer[ae++]=1;ae<16;ae++)this.buffer[ae]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,ae=2;ae<10;ae++)this.h[ae]+=C,C=this.h[ae]>>>13,this.h[ae]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,G[0]=this.h[0]+5,C=G[0]>>>13,G[0]&=8191,ae=1;ae<10;ae++)G[ae]=this.h[ae]+C,C=G[ae]>>>13,G[ae]&=8191;for(G[9]-=8192,Y=(C^1)-1,ae=0;ae<10;ae++)G[ae]&=Y;for(Y=~Y,ae=0;ae<10;ae++)this.h[ae]=this.h[ae]&Y|G[ae];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,q=this.h[0]+this.pad[0],this.h[0]=q&65535,ae=1;ae<8;ae++)q=(this.h[ae]+this.pad[ae]|0)+(q>>>16)|0,this.h[ae]=q&65535;$[K+0]=this.h[0]>>>0&255,$[K+1]=this.h[0]>>>8&255,$[K+2]=this.h[1]>>>0&255,$[K+3]=this.h[1]>>>8&255,$[K+4]=this.h[2]>>>0&255,$[K+5]=this.h[2]>>>8&255,$[K+6]=this.h[3]>>>0&255,$[K+7]=this.h[3]>>>8&255,$[K+8]=this.h[4]>>>0&255,$[K+9]=this.h[4]>>>8&255,$[K+10]=this.h[5]>>>0&255,$[K+11]=this.h[5]>>>8&255,$[K+12]=this.h[6]>>>0&255,$[K+13]=this.h[6]>>>8&255,$[K+14]=this.h[7]>>>0&255,$[K+15]=this.h[7]>>>8&255},j.prototype.update=function($,K,G){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>G&&(Y=G),C=0;C=16&&(Y=G-G%16,this.blocks($,K,Y),K+=Y,G-=Y),G){for(C=0;C>16&1),q[G-1]&=65535;q[15]=ae[15]-32767-(q[14]>>16&1),Y=q[15]>>16&1,q[14]&=65535,S(ae,q,1-Y)}for(G=0;G<16;G++)$[2*G]=ae[G]&255,$[2*G+1]=ae[G]>>8}function b($,K){var G=new Uint8Array(32),C=new Uint8Array(32);return A(G,$),A(C,K),B(G,0,C,0)}function P($){var K=new Uint8Array(32);return A(K,$),K[0]&1}function I($,K){var G;for(G=0;G<16;G++)$[G]=K[2*G]+(K[2*G+1]<<8);$[15]&=32767}function F($,K,G){for(var C=0;C<16;C++)$[C]=K[C]+G[C]}function ce($,K,G){for(var C=0;C<16;C++)$[C]=K[C]-G[C]}function D($,K,G){var C,Y,q=0,ae=0,pe=0,_e=0,Re=0,De=0,it=0,Ue=0,mt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Ae=0,Pe=0,Ge=0,je=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,de=G[0],nr=G[1],pr=G[2],gr=G[3],Qt=G[4],mr=G[5],lr=G[6],Lr=G[7],vr=G[8],xr=G[9],Br=G[10],$r=G[11],Ir=G[12],ln=G[13],hn=G[14],dn=G[15];C=K[0],q+=C*de,ae+=C*nr,pe+=C*pr,_e+=C*gr,Re+=C*Qt,De+=C*mr,it+=C*lr,Ue+=C*Lr,mt+=C*vr,st+=C*xr,tt+=C*Br,At+=C*$r,Rt+=C*Ir,Mt+=C*ln,Et+=C*hn,dt+=C*dn,C=K[1],ae+=C*de,pe+=C*nr,_e+=C*pr,Re+=C*gr,De+=C*Qt,it+=C*mr,Ue+=C*lr,mt+=C*Lr,st+=C*vr,tt+=C*xr,At+=C*Br,Rt+=C*$r,Mt+=C*Ir,Et+=C*ln,dt+=C*hn,_t+=C*dn,C=K[2],pe+=C*de,_e+=C*nr,Re+=C*pr,De+=C*gr,it+=C*Qt,Ue+=C*mr,mt+=C*lr,st+=C*Lr,tt+=C*vr,At+=C*xr,Rt+=C*Br,Mt+=C*$r,Et+=C*Ir,dt+=C*ln,_t+=C*hn,ot+=C*dn,C=K[3],_e+=C*de,Re+=C*nr,De+=C*pr,it+=C*gr,Ue+=C*Qt,mt+=C*mr,st+=C*lr,tt+=C*Lr,At+=C*vr,Rt+=C*xr,Mt+=C*Br,Et+=C*$r,dt+=C*Ir,_t+=C*ln,ot+=C*hn,wt+=C*dn,C=K[4],Re+=C*de,De+=C*nr,it+=C*pr,Ue+=C*gr,mt+=C*Qt,st+=C*mr,tt+=C*lr,At+=C*Lr,Rt+=C*vr,Mt+=C*xr,Et+=C*Br,dt+=C*$r,_t+=C*Ir,ot+=C*ln,wt+=C*hn,lt+=C*dn,C=K[5],De+=C*de,it+=C*nr,Ue+=C*pr,mt+=C*gr,st+=C*Qt,tt+=C*mr,At+=C*lr,Rt+=C*Lr,Mt+=C*vr,Et+=C*xr,dt+=C*Br,_t+=C*$r,ot+=C*Ir,wt+=C*ln,lt+=C*hn,at+=C*dn,C=K[6],it+=C*de,Ue+=C*nr,mt+=C*pr,st+=C*gr,tt+=C*Qt,At+=C*mr,Rt+=C*lr,Mt+=C*Lr,Et+=C*vr,dt+=C*xr,_t+=C*Br,ot+=C*$r,wt+=C*Ir,lt+=C*ln,at+=C*hn,Ae+=C*dn,C=K[7],Ue+=C*de,mt+=C*nr,st+=C*pr,tt+=C*gr,At+=C*Qt,Rt+=C*mr,Mt+=C*lr,Et+=C*Lr,dt+=C*vr,_t+=C*xr,ot+=C*Br,wt+=C*$r,lt+=C*Ir,at+=C*ln,Ae+=C*hn,Pe+=C*dn,C=K[8],mt+=C*de,st+=C*nr,tt+=C*pr,At+=C*gr,Rt+=C*Qt,Mt+=C*mr,Et+=C*lr,dt+=C*Lr,_t+=C*vr,ot+=C*xr,wt+=C*Br,lt+=C*$r,at+=C*Ir,Ae+=C*ln,Pe+=C*hn,Ge+=C*dn,C=K[9],st+=C*de,tt+=C*nr,At+=C*pr,Rt+=C*gr,Mt+=C*Qt,Et+=C*mr,dt+=C*lr,_t+=C*Lr,ot+=C*vr,wt+=C*xr,lt+=C*Br,at+=C*$r,Ae+=C*Ir,Pe+=C*ln,Ge+=C*hn,je+=C*dn,C=K[10],tt+=C*de,At+=C*nr,Rt+=C*pr,Mt+=C*gr,Et+=C*Qt,dt+=C*mr,_t+=C*lr,ot+=C*Lr,wt+=C*vr,lt+=C*xr,at+=C*Br,Ae+=C*$r,Pe+=C*Ir,Ge+=C*ln,je+=C*hn,qe+=C*dn,C=K[11],At+=C*de,Rt+=C*nr,Mt+=C*pr,Et+=C*gr,dt+=C*Qt,_t+=C*mr,ot+=C*lr,wt+=C*Lr,lt+=C*vr,at+=C*xr,Ae+=C*Br,Pe+=C*$r,Ge+=C*Ir,je+=C*ln,qe+=C*hn,Xe+=C*dn,C=K[12],Rt+=C*de,Mt+=C*nr,Et+=C*pr,dt+=C*gr,_t+=C*Qt,ot+=C*mr,wt+=C*lr,lt+=C*Lr,at+=C*vr,Ae+=C*xr,Pe+=C*Br,Ge+=C*$r,je+=C*Ir,qe+=C*ln,Xe+=C*hn,kt+=C*dn,C=K[13],Mt+=C*de,Et+=C*nr,dt+=C*pr,_t+=C*gr,ot+=C*Qt,wt+=C*mr,lt+=C*lr,at+=C*Lr,Ae+=C*vr,Pe+=C*xr,Ge+=C*Br,je+=C*$r,qe+=C*Ir,Xe+=C*ln,kt+=C*hn,Wt+=C*dn,C=K[14],Et+=C*de,dt+=C*nr,_t+=C*pr,ot+=C*gr,wt+=C*Qt,lt+=C*mr,at+=C*lr,Ae+=C*Lr,Pe+=C*vr,Ge+=C*xr,je+=C*Br,qe+=C*$r,Xe+=C*Ir,kt+=C*ln,Wt+=C*hn,Zt+=C*dn,C=K[15],dt+=C*de,_t+=C*nr,ot+=C*pr,wt+=C*gr,lt+=C*Qt,at+=C*mr,Ae+=C*lr,Pe+=C*Lr,Ge+=C*vr,je+=C*xr,qe+=C*Br,Xe+=C*$r,kt+=C*Ir,Wt+=C*ln,Zt+=C*hn,Kt+=C*dn,q+=38*_t,ae+=38*ot,pe+=38*wt,_e+=38*lt,Re+=38*at,De+=38*Ae,it+=38*Pe,Ue+=38*Ge,mt+=38*je,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=ae+Y+65535,Y=Math.floor(C/65536),ae=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=_e+Y+65535,Y=Math.floor(C/65536),_e=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=mt+Y+65535,Y=Math.floor(C/65536),mt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=ae+Y+65535,Y=Math.floor(C/65536),ae=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=_e+Y+65535,Y=Math.floor(C/65536),_e=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=mt+Y+65535,Y=Math.floor(C/65536),mt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),$[0]=q,$[1]=ae,$[2]=pe,$[3]=_e,$[4]=Re,$[5]=De,$[6]=it,$[7]=Ue,$[8]=mt,$[9]=st,$[10]=tt,$[11]=At,$[12]=Rt,$[13]=Mt,$[14]=Et,$[15]=dt}function se($,K){D($,K,K)}function ee($,K){var G=r(),C;for(C=0;C<16;C++)G[C]=K[C];for(C=253;C>=0;C--)se(G,G),C!==2&&C!==4&&D(G,G,K);for(C=0;C<16;C++)$[C]=G[C]}function J($,K){var G=r(),C;for(C=0;C<16;C++)G[C]=K[C];for(C=250;C>=0;C--)se(G,G),C!==1&&D(G,G,K);for(C=0;C<16;C++)$[C]=G[C]}function Q($,K,G){var C=new Uint8Array(32),Y=new Float64Array(80),q,ae,pe=r(),_e=r(),Re=r(),De=r(),it=r(),Ue=r();for(ae=0;ae<31;ae++)C[ae]=K[ae];for(C[31]=K[31]&127|64,C[0]&=248,I(Y,G),ae=0;ae<16;ae++)_e[ae]=Y[ae],De[ae]=pe[ae]=Re[ae]=0;for(pe[0]=De[0]=1,ae=254;ae>=0;--ae)q=C[ae>>>3]>>>(ae&7)&1,S(pe,_e,q),S(Re,De,q),F(it,pe,Re),ce(pe,pe,Re),F(Re,_e,De),ce(_e,_e,De),se(De,it),se(Ue,pe),D(pe,Re,pe),D(Re,_e,it),F(it,pe,Re),ce(pe,pe,Re),se(_e,pe),ce(Re,De,Ue),D(pe,Re,u),F(pe,pe,De),D(Re,Re,pe),D(pe,De,Ue),D(De,_e,Y),se(_e,it),S(pe,_e,q),S(Re,De,q);for(ae=0;ae<16;ae++)Y[ae+16]=pe[ae],Y[ae+32]=Re[ae],Y[ae+48]=_e[ae],Y[ae+64]=De[ae];var mt=Y.subarray(32),st=Y.subarray(16);return ee(mt,mt),D(st,st,mt),A($,st),0}function T($,K){return Q($,K,s)}function X($,K){return n(K,32),T($,K)}function re($,K,G){var C=new Uint8Array(32);return Q(C,G,K),z($,i,C,Z)}var ge=f,oe=g;function fe($,K,G,C,Y,q){var ae=new Uint8Array(32);return re(ae,Y,q),ge($,K,G,C,ae)}function be($,K,G,C,Y,q){var ae=new Uint8Array(32);return re(ae,Y,q),oe($,K,G,C,ae)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne($,K,G,C){for(var Y=new Int32Array(16),q=new Int32Array(16),ae,pe,_e,Re,De,it,Ue,mt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Ae,Pe,Ge,je,qe,Xe,kt=$[0],Wt=$[1],Zt=$[2],Kt=$[3],de=$[4],nr=$[5],pr=$[6],gr=$[7],Qt=K[0],mr=K[1],lr=K[2],Lr=K[3],vr=K[4],xr=K[5],Br=K[6],$r=K[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=G[at+0]<<24|G[at+1]<<16|G[at+2]<<8|G[at+3],q[lt]=G[at+4]<<24|G[at+5]<<16|G[at+6]<<8|G[at+7];for(lt=0;lt<80;lt++)if(ae=kt,pe=Wt,_e=Zt,Re=Kt,De=de,it=nr,Ue=pr,mt=gr,st=Qt,tt=mr,At=lr,Rt=Lr,Mt=vr,Et=xr,dt=Br,_t=$r,Ae=gr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(de>>>14|vr<<18)^(de>>>18|vr<<14)^(vr>>>9|de<<23),Pe=(vr>>>14|de<<18)^(vr>>>18|de<<14)^(de>>>9|vr<<23),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=de&nr^~de&pr,Pe=vr&xr^~vr&Br,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Me[lt*2],Pe=Me[lt*2+1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Y[lt%16],Pe=q[lt%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|je<<16,Ae=ot,Pe=wt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Pe=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=kt&Wt^kt&Zt^Wt&Zt,Pe=Qt&mr^Qt&lr^mr&lr,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,mt=qe&65535|Xe<<16,_t=Ge&65535|je<<16,Ae=Re,Pe=Rt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=ot,Pe=wt,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|je<<16,Wt=ae,Zt=pe,Kt=_e,de=Re,nr=De,pr=it,gr=Ue,kt=mt,mr=st,lr=tt,Lr=At,vr=Rt,xr=Mt,Br=Et,$r=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Ae=Y[at],Pe=q[at],Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=Y[(at+9)%16],Pe=q[(at+9)%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+1)%16],wt=q[(at+1)%16],Ae=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Pe=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+14)%16],wt=q[(at+14)%16],Ae=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Pe=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,q[at]=Ge&65535|je<<16;Ae=kt,Pe=Qt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[0],Pe=K[0],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[0]=kt=qe&65535|Xe<<16,K[0]=Qt=Ge&65535|je<<16,Ae=Wt,Pe=mr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[1],Pe=K[1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[1]=Wt=qe&65535|Xe<<16,K[1]=mr=Ge&65535|je<<16,Ae=Zt,Pe=lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[2],Pe=K[2],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[2]=Zt=qe&65535|Xe<<16,K[2]=lr=Ge&65535|je<<16,Ae=Kt,Pe=Lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[3],Pe=K[3],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[3]=Kt=qe&65535|Xe<<16,K[3]=Lr=Ge&65535|je<<16,Ae=de,Pe=vr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[4],Pe=K[4],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[4]=de=qe&65535|Xe<<16,K[4]=vr=Ge&65535|je<<16,Ae=nr,Pe=xr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[5],Pe=K[5],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[5]=nr=qe&65535|Xe<<16,K[5]=xr=Ge&65535|je<<16,Ae=pr,Pe=Br,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[6],Pe=K[6],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[6]=pr=qe&65535|Xe<<16,K[6]=Br=Ge&65535|je<<16,Ae=gr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[7],Pe=K[7],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[7]=gr=qe&65535|Xe<<16,K[7]=$r=Ge&65535|je<<16,Ir+=128,C-=128}return C}function Te($,K,G){var C=new Int32Array(8),Y=new Int32Array(8),q=new Uint8Array(256),ae,pe=G;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,K,G),G%=128,ae=0;ae=0;--Y)C=G[Y/8|0]>>(Y&7)&1,Ie($,K,C),$e(K,$),$e($,$),Ie($,K,C)}function ke($,K){var G=[r(),r(),r(),r()];v(G[0],p),v(G[1],y),v(G[2],a),D(G[3],p,y),Ve($,G,K)}function ze($,K,G){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],q;for(G||n(K,32),Te(C,K,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le($,Y),q=0;q<32;q++)K[q+32]=$[q];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Se($,K){var G,C,Y,q;for(C=63;C>=32;--C){for(G=0,Y=C-32,q=C-12;Y>4)*He[Y],G=K[Y]>>8,K[Y]&=255;for(Y=0;Y<32;Y++)K[Y]-=G*He[Y];for(C=0;C<32;C++)K[C+1]+=K[C]>>8,$[C]=K[C]&255}function Qe($){var K=new Float64Array(64),G;for(G=0;G<64;G++)K[G]=$[G];for(G=0;G<64;G++)$[G]=0;Se($,K)}function ct($,K,G,C){var Y=new Uint8Array(64),q=new Uint8Array(64),ae=new Uint8Array(64),pe,_e,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=G+64;for(pe=0;pe>7&&ce($[0],o,$[0]),D($[3],$[0],$[1]),0)}function et($,K,G,C){var Y,q=new Uint8Array(32),ae=new Uint8Array(64),pe=[r(),r(),r(),r()],_e=[r(),r(),r(),r()];if(G<64||Be(_e,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var $=new Uint8Array(bt),K=new Uint8Array(Dt);return ze($,K),{publicKey:$,secretKey:K}},e.sign.keyPair.fromSecretKey=function($){if(nt($),$.length!==Dt)throw new Error("bad secret key size");for(var K=new Uint8Array(bt),G=0;G=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function $b(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function ap(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new Ut("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new Ut("Delay aborted"))})})})}function Is(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function dh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=Is(e==null?void 0:e.signal);if(typeof t!="function")throw new Ut(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=p??null,o==null||o.abort(),o=Is(p),o.signal.aborted)throw new Ut("Resource creation was aborted");n=y??null;const _=t(o.signal,...y);i=_;const M=yield _;if(i!==_&&M!==r)throw yield e(M),new Ut("Resource creation was aborted by a new resource creation");return r=M,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const p=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([p?e(p):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:p=>Pt(this,void 0,void 0,function*(){const y=r,_=i,M=n,O=s;if(yield m9(p),y===r&&_===i&&M===n&&O===s)return yield a(s,...M??[]);throw new Ut("Resource recreation was aborted by a new resource creation")})}}function CQ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=Is(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new Ut("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new Ut(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new Ut("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class Hb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=IQ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield TQ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new EQ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(g9(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=h9.encode(e);yield dh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new Ut(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Fo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Fo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new Ut(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new Ut("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),En(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Ut("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new Ut(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function TQ(t){return Pt(this,void 0,void 0,function*(){return yield CQ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=Is(n.signal).signal;if(o.aborted){r(new Ut("Bridge connection aborted"));return}const a=new URL(g9(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new Ut("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}try{const p=yield t.errorHandler(l,d);p!==l&&l.close(),p&&p!==l&&e(p)}catch(p){l.close(),r(p)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new Ut("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function ph(t){return!("connectEvent"in t)}class gh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!ph(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Fb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Fb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");if(!ph(e))throw new Ut("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new Ut("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!ph(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const v9=2;class mh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new gh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new gh(e).getHttpConnection();return ph(n)?new mh(e,n.connectionSource):new mh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=Is(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Fb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield dh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=Is(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(ph(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new Ut("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(En("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Hb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield dh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Ut("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),En("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),ap(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=Is(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){En("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(En("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(h9.decode(e.message).toUint8Array(),ap(e.from)));if(En("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){En(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Fo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(En("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new Ut(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return AQ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",v9.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+PQ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new Hb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>dh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(En("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Hb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function b9(t,e){return y9(t,[e])}function y9(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function RQ(t){try{return!b9(t,"tonconnect")||!b9(t.tonconnect,"walletInfo")?!1:y9(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Xu{constructor(){this.storage={}}static getInstance(){return Xu.instance||(Xu.instance=new Xu),Xu.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function gp(){if(!(typeof window>"u"))return window}function DQ(){const t=gp();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function OQ(){if(!(typeof document>"u"))return document}function NQ(){var t;const e=(t=gp())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function LQ(){if(kQ())return localStorage;if(BQ())throw new Ut("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Xu.getInstance()}function kQ(){try{return typeof localStorage<"u"}catch{return!1}}function BQ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class wi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=wi.window;if(!wi.isWindowContainsWallet(n,r))throw new qb;this.connectionStorage=new gh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new gh(e).getInjectedConnection();return new wi(e,n.jsBridgeKey)})}static isWalletInjected(e){return wi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return wi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?DQ().filter(([n,i])=>RQ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(v9,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{En("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();En("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){En(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),En("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>En("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{En(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);En("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){En("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{En("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}wi.window=gp();class $Q{constructor(){this.localStorage=LQ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function w9(t){return jQ(t)&&t.injected}function FQ(t){return w9(t)&&t.embedded}function jQ(t){return"jsBridgeKey"in t}const UQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class Wb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(FQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new zb("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Fo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Fo(n),e=UQ}let r=[];try{r=wi.getCurrentlyInjectedWallets()}catch(n){Fo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=wi.isWalletInjected(o),i.embedded=wi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class mp extends Ut{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,mp.prototype)}}function qQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new mp("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function XQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Qu(t,e)),Kb(e,r))}function ZQ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Qu(t,e)),Kb(e,r))}function QQ(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Qu(t,e)),Kb(e,r))}function eee(t,e,r){return Object.assign({type:"disconnection",scope:r},Qu(t,e))}class tee{constructor(){this.window=gp()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class ree{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new tee,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Zu({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",HQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",zQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=WQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=KQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=VQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=GQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=YQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=JQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=eee(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=XQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=ZQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=QQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const nee="3.0.5";class vh{constructor(e){if(this.walletsList=new Wb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||NQ(),storage:(e==null?void 0:e.storage)||new $Q},this.walletsList=new Wb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new ree({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:nee}),!this.dappSettings.manifestUrl)throw new jb("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new gh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Ub;const o=Is(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new Ut("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=Is(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield mh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield wi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Fo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=dh(p=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:p.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(p=>setTimeout(()=>p(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=Is(n==null?void 0:n.signal);if(i.signal.aborted)throw new Ut("Transaction sending was aborted");this.checkConnection(),qQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=vQ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(pp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(pp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),pp.parseAndThrowError(l);const d=pp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new fp;const n=Is(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Ut("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=OQ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Fo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&bQ(e)?r=new wi(this.dappSettings.storage,e.jsBridgeKey):r=new mh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new Ut("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=wQ.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),En(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof up||r instanceof cp)throw Fo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new fp}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}vh.walletsList=new Wb,vh.isWalletInjected=t=>wi.isWalletInjected(t),vh.isInsideWalletBrowser=t=>wi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function Vb(t){const{children:e,onClick:r}=t;return le.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function x9(t){const{wallet:e,connector:r,loading:n}=t,i=Ee.useRef(null),s=Ee.useRef(),[o,a]=Ee.useState(),[u,l]=Ee.useState(),[d,p]=Ee.useState("connect"),[y,_]=Ee.useState(!1),[M,O]=Ee.useState();function L(W){var ie;(ie=s.current)==null||ie.update({data:W})}async function B(){_(!0);try{a("");const W=await xa.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ie=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:W}});if(!ie)return;O(ie),L(ie),l(W)}}catch(W){a(W.message)}_(!1)}function k(){s.current=new Z7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function H(){r.connect(e,{request:{tonProof:u}})}function U(){if("deepLink"in e){if(!e.deepLink||!M)return;const W=new URL(M),ie=`${e.deepLink}${W.search}`;window.open(ie)}}function z(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(M)}const Z=Ee.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),R=Ee.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Ee.useEffect(()=>{k(),B()},[]),le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Tc,{title:"Connect wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-text-center xc-mb-6",children:[le.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[le.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),le.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?le.jsx(Ec,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):le.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),le.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),le.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&le.jsx(Ec,{className:"xc-animate-spin"}),!y&&!n&&le.jsxs(le.Fragment,{children:[w9(e)&&le.jsxs(Vb,{onClick:H,children:[le.jsx(dV,{className:"xc-opacity-80"}),"Extension"]}),Z&&le.jsxs(Vb,{onClick:U,children:[le.jsx(F8,{className:"xc-opacity-80"}),"Desktop"]}),R&&le.jsx(Vb,{onClick:z,children:"Telegram Mini App"})]})]})]})}function iee(t){const[e,r]=Ee.useState(""),[n,i]=Ee.useState(),[s,o]=Ee.useState(),a=Bb(),[u,l]=Ee.useState(!1);async function d(y){var M,O;if(!y||!((M=y.connectItems)!=null&&M.tonProof))return;l(!0);const _=await xa.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(O=y.connectItems)==null?void 0:O.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(_.data),l(!1)}Ee.useEffect(()=>{const y=new vh({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),_=y.onStatusChange(d);return o(y),r("select"),_},[]);function p(y){r("connect"),i(y)}return le.jsxs(Ms,{children:[e==="select"&&le.jsx(s9,{connector:s,onSelect:p,onBack:t.onBack}),e==="connect"&&le.jsx(x9,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function _9(t){const{children:e,className:r}=t,n=Ee.useRef(null),[i,s]=Ee.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Ee.useEffect(()=>{console.log("maxHeight",i)},[i]),le.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function see(){return le.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[le.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),le.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function E9(t){const{wallets:e}=Yl(),[r,n]=Ee.useState(),i=Ee.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Tc,{title:"Select wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[le.jsx(j8,{className:"xc-shrink-0 xc-opacity-50"}),le.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),le.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>le.jsx(C7,{wallet:a,onClick:s},`feature-${a.key}`)):le.jsx(see,{})})]})}function oee(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Ee.useState(""),[l,d]=Ee.useState(null),[p,y]=Ee.useState("");function _(B){d(B),u("evm-wallet")}function M(B){u("email"),y(B)}async function O(B){await e(B)}function L(){u("ton-wallet")}return Ee.useEffect(()=>{u("index")},[]),le.jsx(AZ,{config:t.config,children:le.jsxs(_9,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&le.jsx(aQ,{onBack:()=>u("index"),onLogin:O,wallet:l}),a==="ton-wallet"&&le.jsx(iee,{onBack:()=>u("index"),onLogin:O}),a==="email"&&le.jsx(jZ,{email:p,onBack:()=>u("index"),onLogin:O}),a==="index"&&le.jsx(F7,{header:r,onEmailConfirm:M,onSelectWallet:_,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:L,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&le.jsx(E9,{onBack:()=>u("index"),onSelectWallet:_})]})})}function aee(t){const{wallet:e,onConnect:r}=t,[n,i]=Ee.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Tc,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&le.jsx(r9,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&le.jsx(n9,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&le.jsx(i9,{wallet:e})]})}function cee(t){const{email:e}=t,[r,n]=Ee.useState("captcha");return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-12",children:le.jsx(Tc,{title:"Sign in with email",onBack:t.onBack})}),r==="captcha"&&le.jsx(J7,{email:e,onCodeSend:()=>n("verify-email")}),r==="verify-email"&&le.jsx(Y7,{email:e,onInputCode:t.onInputCode,onResendCode:()=>n("captcha")})]})}function uee(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Ee.useState(""),[a,u]=Ee.useState(),[l,d]=Ee.useState(),p=Ee.useRef(),[y,_]=Ee.useState("");function M(U){u(U),o("evm-wallet-connect")}function O(U){_(U),o("email-connect")}async function L(U,z){await(e==null?void 0:e({chain_type:"eip155",client:U.client,connect_info:z,wallet:U})),o("index")}async function B(U,z){await(n==null?void 0:n(U,z))}function k(U){d(U),o("ton-wallet-connect")}async function H(U){U&&await(r==null?void 0:r({chain_type:"ton",client:p.current,connect_info:U,wallet:U}))}return Ee.useEffect(()=>{p.current=new vh({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const U=p.current.onStatusChange(H);return o("index"),U},[]),le.jsxs(_9,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&le.jsx(E9,{onBack:()=>o("index"),onSelectWallet:M}),s==="evm-wallet-connect"&&le.jsx(aee,{onBack:()=>o("index"),onConnect:L,wallet:a}),s==="ton-wallet-select"&&le.jsx(s9,{connector:p.current,onSelect:k,onBack:()=>o("index")}),s==="ton-wallet-connect"&&le.jsx(x9,{connector:p.current,wallet:l,onBack:()=>o("index")}),s==="email-connect"&&le.jsx(cee,{email:y,onBack:()=>o("index"),onInputCode:B}),s==="index"&&le.jsx(F7,{onEmailConfirm:O,onSelectWallet:M,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Pn.CodattaConnect=uee,Pn.CodattaConnectContextProvider=sV,Pn.CodattaSignin=oee,Pn.WalletItem=ru,Pn.coinbaseWallet=L8,Pn.useCodattaConnectContext=Yl,Object.defineProperty(Pn,Symbol.toStringTag,{value:"Module"})}); + ***************************************************************************** */function yQ(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new Ut("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new Ut("Delay aborted"))})})})}function Is(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function dh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=Is(e==null?void 0:e.signal);if(typeof t!="function")throw new Ut(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=p??null,o==null||o.abort(),o=Is(p),o.signal.aborted)throw new Ut("Resource creation was aborted");n=y??null;const _=t(o.signal,...y);i=_;const M=yield _;if(i!==_&&M!==r)throw yield e(M),new Ut("Resource creation was aborted by a new resource creation");return r=M,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const p=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([p?e(p):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:p=>Pt(this,void 0,void 0,function*(){const y=r,_=i,M=n,O=s;if(yield m9(p),y===r&&_===i&&M===n&&O===s)return yield a(s,...M??[]);throw new Ut("Resource recreation was aborted by a new resource creation")})}}function RQ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=Is(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new Ut("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new Ut(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new Ut("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class Hb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=TQ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield DQ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new AQ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(g9(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=h9.encode(e);yield dh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new Ut(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Fo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Fo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new Ut(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new Ut("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),En(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Ut("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new Ut(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function DQ(t){return Pt(this,void 0,void 0,function*(){return yield RQ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=Is(n.signal).signal;if(o.aborted){r(new Ut("Bridge connection aborted"));return}const a=new URL(g9(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new Ut("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}try{const p=yield t.errorHandler(l,d);p!==l&&l.close(),p&&p!==l&&e(p)}catch(p){l.close(),r(p)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new Ut("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function ph(t){return!("connectEvent"in t)}class gh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!ph(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Fb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Fb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");if(!ph(e))throw new Ut("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new Ut("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!ph(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const v9=2;class mh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new gh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new gh(e).getHttpConnection();return ph(n)?new mh(e,n.connectionSource):new mh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=Is(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Fb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield dh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=Is(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(ph(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new Ut("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(En("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Hb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield dh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Ut("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),En("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),ap(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=Is(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){En("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(En("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(h9.decode(e.message).toUint8Array(),ap(e.from)));if(En("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){En(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Fo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(En("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new Ut(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return MQ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",v9.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+IQ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new Hb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>dh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(En("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Hb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function b9(t,e){return y9(t,[e])}function y9(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function OQ(t){try{return!b9(t,"tonconnect")||!b9(t.tonconnect,"walletInfo")?!1:y9(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Xu{constructor(){this.storage={}}static getInstance(){return Xu.instance||(Xu.instance=new Xu),Xu.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function gp(){if(!(typeof window>"u"))return window}function NQ(){const t=gp();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function LQ(){if(!(typeof document>"u"))return document}function kQ(){var t;const e=(t=gp())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function BQ(){if($Q())return localStorage;if(FQ())throw new Ut("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Xu.getInstance()}function $Q(){try{return typeof localStorage<"u"}catch{return!1}}function FQ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class wi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=wi.window;if(!wi.isWindowContainsWallet(n,r))throw new qb;this.connectionStorage=new gh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new gh(e).getInjectedConnection();return new wi(e,n.jsBridgeKey)})}static isWalletInjected(e){return wi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return wi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?NQ().filter(([n,i])=>OQ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(v9,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{En("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();En("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){En(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),En("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>En("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{En(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);En("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){En("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{En("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}wi.window=gp();class jQ{constructor(){this.localStorage=BQ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function w9(t){return qQ(t)&&t.injected}function UQ(t){return w9(t)&&t.embedded}function qQ(t){return"jsBridgeKey"in t}const zQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class Wb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(UQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new zb("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Fo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Fo(n),e=zQ}let r=[];try{r=wi.getCurrentlyInjectedWallets()}catch(n){Fo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=wi.isWalletInjected(o),i.embedded=wi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class mp extends Ut{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,mp.prototype)}}function HQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new mp("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function QQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Qu(t,e)),Kb(e,r))}function eee(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Qu(t,e)),Kb(e,r))}function tee(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Qu(t,e)),Kb(e,r))}function ree(t,e,r){return Object.assign({type:"disconnection",scope:r},Qu(t,e))}class nee{constructor(){this.window=gp()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class iee{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new nee,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Zu({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",KQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",WQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=VQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=GQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=YQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=JQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=XQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=ZQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=ree(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=QQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=eee(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=tee(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const see="3.0.5";class vh{constructor(e){if(this.walletsList=new Wb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||kQ(),storage:(e==null?void 0:e.storage)||new jQ},this.walletsList=new Wb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new iee({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:see}),!this.dappSettings.manifestUrl)throw new jb("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new gh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Ub;const o=Is(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new Ut("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=Is(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield mh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield wi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Fo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=dh(p=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:p.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(p=>setTimeout(()=>p(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=Is(n==null?void 0:n.signal);if(i.signal.aborted)throw new Ut("Transaction sending was aborted");this.checkConnection(),HQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=yQ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(pp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(pp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),pp.parseAndThrowError(l);const d=pp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new fp;const n=Is(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Ut("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=LQ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Fo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&wQ(e)?r=new wi(this.dappSettings.storage,e.jsBridgeKey):r=new mh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new Ut("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=_Q.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),En(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof up||r instanceof cp)throw Fo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new fp}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}vh.walletsList=new Wb,vh.isWalletInjected=t=>wi.isWalletInjected(t),vh.isInsideWalletBrowser=t=>wi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function Vb(t){const{children:e,onClick:r}=t;return le.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function x9(t){const{wallet:e,connector:r,loading:n}=t,i=Ee.useRef(null),s=Ee.useRef(),[o,a]=Ee.useState(),[u,l]=Ee.useState(),[d,p]=Ee.useState("connect"),[y,_]=Ee.useState(!1),[M,O]=Ee.useState();function L(W){var ie;(ie=s.current)==null||ie.update({data:W})}async function B(){_(!0);try{a("");const W=await xa.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ie=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:W}});if(!ie)return;O(ie),L(ie),l(W)}}catch(W){a(W.message)}_(!1)}function k(){s.current=new Z7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function H(){r.connect(e,{request:{tonProof:u}})}function U(){if("deepLink"in e){if(!e.deepLink||!M)return;const W=new URL(M),ie=`${e.deepLink}${W.search}`;window.open(ie)}}function z(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(M)}const Z=Ee.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),R=Ee.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Ee.useEffect(()=>{k(),B()},[]),le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Rc,{title:"Connect wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-text-center xc-mb-6",children:[le.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[le.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),le.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?le.jsx(Sc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):le.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),le.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),le.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&le.jsx(Sc,{className:"xc-animate-spin"}),!y&&!n&&le.jsxs(le.Fragment,{children:[w9(e)&&le.jsxs(Vb,{onClick:H,children:[le.jsx(pV,{className:"xc-opacity-80"}),"Extension"]}),Z&&le.jsxs(Vb,{onClick:U,children:[le.jsx(F8,{className:"xc-opacity-80"}),"Desktop"]}),R&&le.jsx(Vb,{onClick:z,children:"Telegram Mini App"})]})]})]})}function oee(t){const[e,r]=Ee.useState(""),[n,i]=Ee.useState(),[s,o]=Ee.useState(),a=Bb(),[u,l]=Ee.useState(!1);async function d(y){var M,O;if(!y||!((M=y.connectItems)!=null&&M.tonProof))return;l(!0);const _=await xa.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(O=y.connectItems)==null?void 0:O.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(_.data),l(!1)}Ee.useEffect(()=>{const y=new vh({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),_=y.onStatusChange(d);return o(y),r("select"),_},[]);function p(y){r("connect"),i(y)}return le.jsxs(Ms,{children:[e==="select"&&le.jsx(s9,{connector:s,onSelect:p,onBack:t.onBack}),e==="connect"&&le.jsx(x9,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function _9(t){const{children:e,className:r}=t,n=Ee.useRef(null),[i,s]=Ee.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Ee.useEffect(()=>{console.log("maxHeight",i)},[i]),le.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function aee(){return le.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[le.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),le.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function E9(t){const{wallets:e}=Yl(),[r,n]=Ee.useState(),i=Ee.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Rc,{title:"Select wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[le.jsx(j8,{className:"xc-shrink-0 xc-opacity-50"}),le.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),le.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>le.jsx(C7,{wallet:a,onClick:s},`feature-${a.key}`)):le.jsx(aee,{})})]})}function cee(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Ee.useState(""),[l,d]=Ee.useState(null),[p,y]=Ee.useState("");function _(B){d(B),u("evm-wallet")}function M(B){u("email"),y(B)}async function O(B){await e(B)}function L(){u("ton-wallet")}return Ee.useEffect(()=>{u("index")},[]),le.jsx(PZ,{config:t.config,children:le.jsxs(_9,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&le.jsx(uQ,{onBack:()=>u("index"),onLogin:O,wallet:l}),a==="ton-wallet"&&le.jsx(oee,{onBack:()=>u("index"),onLogin:O}),a==="email"&&le.jsx(UZ,{email:p,onBack:()=>u("index"),onLogin:O}),a==="index"&&le.jsx(F7,{header:r,onEmailConfirm:M,onSelectWallet:_,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:L,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&le.jsx(E9,{onBack:()=>u("index"),onSelectWallet:_})]})})}function uee(t){const{wallet:e,onConnect:r}=t,[n,i]=Ee.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Rc,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&le.jsx(r9,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&le.jsx(n9,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&le.jsx(i9,{wallet:e})]})}function fee(t){const{email:e}=t,[r,n]=Ee.useState("captcha");return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-12",children:le.jsx(Rc,{title:"Sign in with email",onBack:t.onBack})}),r==="captcha"&&le.jsx(J7,{email:e,onCodeSend:()=>n("verify-email")}),r==="verify-email"&&le.jsx(Y7,{email:e,onInputCode:t.onInputCode,onResendCode:()=>n("captcha")})]})}function lee(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Ee.useState(""),[a,u]=Ee.useState(),[l,d]=Ee.useState(),p=Ee.useRef(),[y,_]=Ee.useState("");function M(U){u(U),o("evm-wallet-connect")}function O(U){_(U),o("email-connect")}async function L(U,z){await(e==null?void 0:e({chain_type:"eip155",client:U.client,connect_info:z,wallet:U})),o("index")}async function B(U,z){await(n==null?void 0:n(U,z))}function k(U){d(U),o("ton-wallet-connect")}async function H(U){U&&await(r==null?void 0:r({chain_type:"ton",client:p.current,connect_info:U,wallet:U}))}return Ee.useEffect(()=>{p.current=new vh({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const U=p.current.onStatusChange(H);return o("index"),U},[]),le.jsxs(_9,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&le.jsx(E9,{onBack:()=>o("index"),onSelectWallet:M}),s==="evm-wallet-connect"&&le.jsx(uee,{onBack:()=>o("index"),onConnect:L,wallet:a}),s==="ton-wallet-select"&&le.jsx(s9,{connector:p.current,onSelect:k,onBack:()=>o("index")}),s==="ton-wallet-connect"&&le.jsx(x9,{connector:p.current,wallet:l,onBack:()=>o("index")}),s==="email-connect"&&le.jsx(fee,{email:y,onBack:()=>o("index"),onInputCode:B}),s==="index"&&le.jsx(F7,{onEmailConfirm:O,onSelectWallet:M,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Pn.CodattaConnect=lee,Pn.CodattaConnectContextProvider=oV,Pn.CodattaSignin=cee,Pn.WalletItem=Ga,Pn.coinbaseWallet=L8,Pn.useCodattaConnectContext=Yl,Object.defineProperty(Pn,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/main-D7TyRk7o.js b/dist/main-bMMpd4wM.js similarity index 91% rename from dist/main-D7TyRk7o.js rename to dist/main-bMMpd4wM.js index 7b3e9c4..8216de3 100644 --- a/dist/main-D7TyRk7o.js +++ b/dist/main-bMMpd4wM.js @@ -27,7 +27,7 @@ function Lv(t) { }); }), r; } -var u1 = { exports: {} }, _f = {}; +var u1 = { exports: {} }, Ef = {}; /** * @license React * react-jsx-runtime.production.min.js @@ -39,7 +39,7 @@ var u1 = { exports: {} }, _f = {}; */ var I2; function pD() { - if (I2) return _f; + if (I2) return Ef; I2 = 1; var t = Rv, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 }; function o(a, u, l) { @@ -49,9 +49,9 @@ function pD() { if (a && a.defaultProps) for (d in u = a.defaultProps, u) p[d] === void 0 && (p[d] = u[d]); return { $$typeof: e, type: a, key: w, ref: _, props: p, _owner: i.current }; } - return _f.Fragment = r, _f.jsx = o, _f.jsxs = o, _f; + return Ef.Fragment = r, Ef.jsx = o, Ef.jsxs = o, Ef; } -var Ef = {}; +var Sf = {}; /** * @license React * react-jsx-runtime.development.js @@ -76,10 +76,10 @@ function gD() { { for (var se = arguments.length, de = new Array(se > 1 ? se - 1 : 0), xe = 1; xe < se; xe++) de[xe - 1] = arguments[xe]; - q("error", j, de); + W("error", j, de); } } - function q(j, se, de) { + function W(j, se, de) { { var xe = B.ReactDebugCurrentFrame, Te = xe.getStackAddendum(); Te !== "" && (se += "%s", de = de.concat([Te])); @@ -645,15 +645,15 @@ React keys must be passed directly to JSX without using spread: return j === n ? rt(et) : Ft(et), et; } } - function z(j, se, de) { + function q(j, se, de) { return $(j, se, de, !0); } function H(j, se, de) { return $(j, se, de, !1); } - var C = H, G = z; - Ef.Fragment = n, Ef.jsx = C, Ef.jsxs = G; - }()), Ef; + var C = H, G = q; + Sf.Fragment = n, Sf.jsx = C, Sf.jsxs = G; + }()), Sf; } process.env.NODE_ENV === "production" ? u1.exports = pD() : u1.exports = gD(); var le = u1.exports; @@ -791,7 +791,7 @@ function f1(t) { } return "indexed" in t && t.indexed && (e = `${e} indexed`), t.name ? `${e} ${t.name}` : e; } -function Sf(t) { +function Af(t) { let e = ""; const r = t.length; for (let n = 0; n < r; n++) { @@ -802,7 +802,7 @@ function Sf(t) { } function bD(t) { var e; - return t.type === "function" ? `function ${t.name}(${Sf(t.inputs)})${t.stateMutability && t.stateMutability !== "nonpayable" ? ` ${t.stateMutability}` : ""}${(e = t.outputs) != null && e.length ? ` returns (${Sf(t.outputs)})` : ""}` : t.type === "event" ? `event ${t.name}(${Sf(t.inputs)})` : t.type === "error" ? `error ${t.name}(${Sf(t.inputs)})` : t.type === "constructor" ? `constructor(${Sf(t.inputs)})${t.stateMutability === "payable" ? " payable" : ""}` : t.type === "fallback" ? `fallback() external${t.stateMutability === "payable" ? " payable" : ""}` : "receive() external payable"; + return t.type === "function" ? `function ${t.name}(${Af(t.inputs)})${t.stateMutability && t.stateMutability !== "nonpayable" ? ` ${t.stateMutability}` : ""}${(e = t.outputs) != null && e.length ? ` returns (${Af(t.outputs)})` : ""}` : t.type === "event" ? `event ${t.name}(${Af(t.inputs)})` : t.type === "error" ? `error ${t.name}(${Af(t.inputs)})` : t.type === "constructor" ? `constructor(${Af(t.inputs)})${t.stateMutability === "payable" ? " payable" : ""}` : t.type === "fallback" ? `fallback() external${t.stateMutability === "payable" ? " payable" : ""}` : "receive() external payable"; } function Xn(t, e, r) { const n = t[e.name]; @@ -811,7 +811,7 @@ function Xn(t, e, r) { const i = t[r]; return typeof i == "function" ? i : (s) => e(t, s); } -function Mu(t, { includeName: e = !1 } = {}) { +function Iu(t, { includeName: e = !1 } = {}) { if (t.type !== "function" && t.type !== "event" && t.type !== "error") throw new TD(t.type); return `${t.name}(${kv(t.inputs, { includeName: e })})`; @@ -829,7 +829,7 @@ function xn(t) { return ya(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length; } const $5 = "2.31.3"; -let Af = { +let Pf = { getDocsUrl: ({ docsBaseUrl: t, docsPath: e = "", docsSlug: r }) => e ? `${t ?? "https://viem.sh"}${e}${r ? `#${r}` : ""}` : void 0, version: `viem@${$5}` }; @@ -839,13 +839,13 @@ class gt extends Error { const n = (() => { var u; return r.cause instanceof gt ? r.cause.details : (u = r.cause) != null && u.message ? r.cause.message : r.details; - })(), i = r.cause instanceof gt && r.cause.docsPath || r.docsPath, s = (a = Af.getDocsUrl) == null ? void 0 : a.call(Af, { ...r, docsPath: i }), o = [ + })(), i = r.cause instanceof gt && r.cause.docsPath || r.docsPath, s = (a = Pf.getDocsUrl) == null ? void 0 : a.call(Pf, { ...r, docsPath: i }), o = [ e || "An error occurred.", "", ...r.metaMessages ? [...r.metaMessages, ""] : [], ...s ? [`Docs: ${s}`] : [], ...n ? [`Details: ${n}`] : [], - ...Af.version ? [`Version: ${Af.version}`] : [] + ...Pf.version ? [`Version: ${Pf.version}`] : [] ].join(` `); super(o, r.cause ? { cause: r.cause } : void 0), Object.defineProperty(this, "details", { @@ -1004,8 +1004,8 @@ class AD extends gt { constructor(e, r) { super("Found ambiguous types in overloaded ABI items.", { metaMessages: [ - `\`${e.type}\` in \`${Mu(e.abiItem)}\`, and`, - `\`${r.type}\` in \`${Mu(r.abiItem)}\``, + `\`${e.type}\` in \`${Iu(e.abiItem)}\`, and`, + `\`${r.type}\` in \`${Iu(r.abiItem)}\``, "", "These types encode differently and cannot be distinguished at runtime.", "Remove one of the ambiguous items in the ABI." @@ -1071,7 +1071,7 @@ class O2 extends gt { super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`, { name: "InvalidBytesLengthError" }); } } -function Fu(t, { dir: e, size: r = 32 } = {}) { +function ju(t, { dir: e, size: r = 32 } = {}) { return typeof t == "string" ? ba(t, { dir: e, size: r }) : RD(t, { dir: e, size: r }); } function ba(t, { dir: e, size: r = 32 } = {}) { @@ -1150,14 +1150,14 @@ function t0(t, e = {}) { } function z5(t, e = {}) { const r = `0x${Number(t)}`; - return typeof e.size == "number" ? (io(r, { size: e.size }), Fu(r, { size: e.size })) : r; + return typeof e.size == "number" ? (io(r, { size: e.size }), ju(r, { size: e.size })) : r; } function xi(t, e = {}) { let r = ""; for (let i = 0; i < t.length; i++) r += ND[t[i]]; const n = `0x${r}`; - return typeof e.size == "number" ? (io(n, { size: e.size }), Fu(n, { dir: "right", size: e.size })) : n; + return typeof e.size == "number" ? (io(n, { size: e.size }), ju(n, { dir: "right", size: e.size })) : n; } function vr(t, e = {}) { const { signed: r, size: n } = e, i = BigInt(t); @@ -1175,7 +1175,7 @@ function vr(t, e = {}) { }); } const a = `0x${(r && i < 0 ? (1n << BigInt(n * 8)) + BigInt(i) : i).toString(16)}`; - return n ? Fu(a, { size: n }) : a; + return n ? ju(a, { size: n }) : a; } const LD = /* @__PURE__ */ new TextEncoder(); function U0(t, e = {}) { @@ -1188,7 +1188,7 @@ function Bv(t, e = {}) { } function $D(t, e = {}) { const r = new Uint8Array(1); - return r[0] = Number(t), typeof e.size == "number" ? (io(r, { size: e.size }), Fu(r, { size: e.size })) : r; + return r[0] = Number(t), typeof e.size == "number" ? (io(r, { size: e.size }), ju(r, { size: e.size })) : r; } const bo = { zero: 48, @@ -1208,7 +1208,7 @@ function N2(t) { } function Fo(t, e = {}) { let r = t; - e.size && (io(r, { size: e.size }), r = Fu(r, { dir: "right", size: e.size })); + e.size && (io(r, { size: e.size }), r = ju(r, { dir: "right", size: e.size })); let n = r.slice(2); n.length % 2 && (n = `0${n}`); const i = n.length / 2, s = new Uint8Array(i); @@ -1226,7 +1226,7 @@ function BD(t, e) { } function W5(t, e = {}) { const r = kD.encode(t); - return typeof e.size == "number" ? (io(r, { size: e.size }), Fu(r, { dir: "right", size: e.size })) : r; + return typeof e.size == "number" ? (io(r, { size: e.size }), ju(r, { dir: "right", size: e.size })) : r; } const ld = /* @__PURE__ */ BigInt(2 ** 32 - 1), L2 = /* @__PURE__ */ BigInt(32); function FD(t, e = !1) { @@ -1255,7 +1255,7 @@ function mc(t, ...e) { throw new Error("Uint8Array expected"); e.length > 0; } -function Yse(t) { +function Xse(t) { if (typeof t != "function" || typeof t.create != "function") throw new Error("Hash should be wrapped by utils.createHasher"); r0(t.outputLen), r0(t.blockLen); @@ -1275,7 +1275,7 @@ function H5(t, e) { function KD(t) { return new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)); } -function al(...t) { +function cl(...t) { for (let e = 0; e < t.length; e++) t[e].fill(0); } @@ -1312,7 +1312,7 @@ function $2(t) { if (t >= yo.a && t <= yo.f) return t - (yo.a - 10); } -function Jse(t) { +function Zse(t) { if (typeof t != "string") throw new Error("hex string expected, got " + typeof t); if (K5) @@ -1339,7 +1339,7 @@ function ZD(t) { function q0(t) { return typeof t == "string" && (t = ZD(t)), mc(t), t; } -function Xse(...t) { +function Qse(...t) { let e = 0; for (let n = 0; n < t.length; n++) { const i = t[n]; @@ -1362,19 +1362,19 @@ function QD(t) { const e = (n, i) => t(i).update(q0(n)).digest(), r = t({}); return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = (n) => t(n), e; } -function Zse(t = 32) { +function eoe(t = 32) { if (Zc && typeof Zc.getRandomValues == "function") return Zc.getRandomValues(new Uint8Array(t)); if (Zc && typeof Zc.randomBytes == "function") return Uint8Array.from(Zc.randomBytes(t)); throw new Error("crypto.getRandomValues must be defined"); } -const eO = BigInt(0), Pf = BigInt(1), tO = BigInt(2), rO = BigInt(7), nO = BigInt(256), iO = BigInt(113), Y5 = [], J5 = [], X5 = []; -for (let t = 0, e = Pf, r = 1, n = 0; t < 24; t++) { +const eO = BigInt(0), Mf = BigInt(1), tO = BigInt(2), rO = BigInt(7), nO = BigInt(256), iO = BigInt(113), Y5 = [], J5 = [], X5 = []; +for (let t = 0, e = Mf, r = 1, n = 0; t < 24; t++) { [r, n] = [n, (2 * r + 3 * n) % 5], Y5.push(2 * (5 * n + r)), J5.push((t + 1) * (t + 2) / 2 % 64); let i = eO; for (let s = 0; s < 7; s++) - e = (e << Pf ^ (e >> rO) * iO) % nO, e & tO && (i ^= Pf << (Pf << /* @__PURE__ */ BigInt(s)) - Pf); + e = (e << Mf ^ (e >> rO) * iO) % nO, e & tO && (i ^= Mf << (Mf << /* @__PURE__ */ BigInt(s)) - Mf); X5.push(i); } const Z5 = jD(X5, !0), sO = Z5[0], oO = Z5[1], B2 = (t, e, r) => r > 32 ? zD(t, e, r) : UD(t, e, r), F2 = (t, e, r) => r > 32 ? WD(t, e, r) : qD(t, e, r); @@ -1401,7 +1401,7 @@ function Q5(t, e = 24) { } t[0] ^= sO[n], t[1] ^= oO[n]; } - al(r); + cl(r); } class Kl extends V5 { // NOTE: we accept arguments in bytes instead of bits here. @@ -1461,7 +1461,7 @@ class Kl extends V5 { return this.digestInto(new Uint8Array(this.outputLen)); } destroy() { - this.destroyed = !0, al(this.state); + this.destroyed = !0, cl(this.state); } _cloneInto(e) { const { blockLen: r, suffix: n, outputLen: i, rounds: s, enableXOF: o } = this; @@ -1896,7 +1896,7 @@ function OO(t) { throw new D2(void 0, { docsPath: j2 }); return { abi: [i], - functionName: zv(Mu(i)) + functionName: zv(Iu(i)) }; } function f4(t) { @@ -2151,7 +2151,7 @@ function HO(t, e, { length: r, staticPosition: n }) { if (!r) { const o = Do(t.readBytes(d1)), a = n + o, u = a + q2; t.setPosition(a); - const l = Do(t.readBytes(q2)), d = cl(e); + const l = Do(t.readBytes(q2)), d = ul(e); let p = 0; const w = []; for (let _ = 0; _ < l; ++_) { @@ -2163,7 +2163,7 @@ function HO(t, e, { length: r, staticPosition: n }) { } return t.setPosition(n + 32), [w, 32]; } - if (cl(e)) { + if (ul(e)) { const o = Do(t.readBytes(d1)), a = n + o, u = []; for (let l = 0; l < r; ++l) { t.setPosition(a + l * 32); @@ -2210,7 +2210,7 @@ function GO(t, e) { function YO(t, e, { staticPosition: r }) { const n = e.components.length === 0 || e.components.some(({ name: o }) => !o), i = n ? [] : {}; let s = 0; - if (cl(e)) { + if (ul(e)) { const o = Do(t.readBytes(d1)), a = r + o; for (let u = 0; u < e.components.length; ++u) { const l = e.components[u]; @@ -2239,21 +2239,21 @@ function JO(t, { staticPosition: e }) { const s = t.readBytes(i, 32), o = qO(j0(s)); return t.setPosition(e + 32), [o, 32]; } -function cl(t) { +function ul(t) { var n; const { type: e } = t; if (e === "string" || e === "bytes" || e.endsWith("[]")) return !0; if (e === "tuple") - return (n = t.components) == null ? void 0 : n.some(cl); + return (n = t.components) == null ? void 0 : n.some(ul); const r = qv(t.type); - return !!(r && cl({ ...t, type: r[1] })); + return !!(r && ul({ ...t, type: r[1] })); } function XO(t) { const { abi: e, data: r } = t, n = i0(r, 0, 4); if (n === "0x") throw new $v(); - const s = [...e || [], LO, kO].find((o) => o.type === "error" && n === zv(Mu(o))); + const s = [...e || [], LO, kO].find((o) => o.type === "error" && n === zv(Iu(o))); if (!s) throw new F5(n, { docsPath: "/docs/contract/decodeErrorResult" @@ -2381,7 +2381,7 @@ class oN extends gt { args: n, includeFunctionName: !1, includeName: !1 - }) : void 0, d = u ? Mu(u, { includeName: !0 }) : void 0, p = K0({ + }) : void 0, d = u ? Iu(u, { includeName: !0 }) : void 0, p = K0({ address: i && sN(i), function: d, args: l && l !== "()" && `${[...Array((o == null ? void 0 : o.length) ?? 0).keys()].map(() => " ").join("")}${l}`, @@ -2447,7 +2447,7 @@ class aN extends gt { const [_] = w; u = NO[_]; } else { - const _ = d ? Mu(d, { includeName: !0 }) : void 0, P = d && w ? l4({ + const _ = d ? Iu(d, { includeName: !0 }) : void 0, P = d && w ? l4({ abiItem: d, args: w, includeFunctionName: !1, @@ -2606,55 +2606,55 @@ class $i extends Ai { }), this.data = r.data; } } -class ul extends Ai { +class fl extends Ai { constructor(e) { super(e, { - code: ul.code, + code: fl.code, name: "ParseRpcError", shortMessage: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text." }); } } -Object.defineProperty(ul, "code", { +Object.defineProperty(fl, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32700 }); -class fl extends Ai { +class ll extends Ai { constructor(e) { super(e, { - code: fl.code, + code: ll.code, name: "InvalidRequestRpcError", shortMessage: "JSON is not a valid request object." }); } } -Object.defineProperty(fl, "code", { +Object.defineProperty(ll, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32600 }); -class ll extends Ai { +class hl extends Ai { constructor(e, { method: r } = {}) { super(e, { - code: ll.code, + code: hl.code, name: "MethodNotFoundRpcError", shortMessage: `The method${r ? ` "${r}"` : ""} does not exist / is not available.` }); } } -Object.defineProperty(ll, "code", { +Object.defineProperty(hl, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32601 }); -class hl extends Ai { +class dl extends Ai { constructor(e) { super(e, { - code: hl.code, + code: dl.code, name: "InvalidParamsRpcError", shortMessage: [ "Invalid parameters were provided to the RPC method.", @@ -2664,7 +2664,7 @@ class hl extends Ai { }); } } -Object.defineProperty(hl, "code", { +Object.defineProperty(dl, "code", { enumerable: !0, configurable: !0, writable: !0, @@ -2685,10 +2685,10 @@ Object.defineProperty(vc, "code", { writable: !0, value: -32603 }); -class dl extends Ai { +class pl extends Ai { constructor(e) { super(e, { - code: dl.code, + code: pl.code, name: "InvalidInputRpcError", shortMessage: [ "Missing or invalid parameters.", @@ -2698,16 +2698,16 @@ class dl extends Ai { }); } } -Object.defineProperty(dl, "code", { +Object.defineProperty(pl, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32e3 }); -class pl extends Ai { +class gl extends Ai { constructor(e) { super(e, { - code: pl.code, + code: gl.code, name: "ResourceNotFoundRpcError", shortMessage: "Requested resource not found." }), Object.defineProperty(this, "name", { @@ -2718,37 +2718,37 @@ class pl extends Ai { }); } } -Object.defineProperty(pl, "code", { +Object.defineProperty(gl, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32001 }); -class gl extends Ai { +class ml extends Ai { constructor(e) { super(e, { - code: gl.code, + code: ml.code, name: "ResourceUnavailableRpcError", shortMessage: "Requested resource not available." }); } } -Object.defineProperty(gl, "code", { +Object.defineProperty(ml, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32002 }); -class ml extends Ai { +class vl extends Ai { constructor(e) { super(e, { - code: ml.code, + code: vl.code, name: "TransactionRejectedRpcError", shortMessage: "Transaction creation failed." }); } } -Object.defineProperty(ml, "code", { +Object.defineProperty(vl, "code", { enumerable: !0, configurable: !0, writable: !0, @@ -2769,31 +2769,31 @@ Object.defineProperty(cc, "code", { writable: !0, value: -32004 }); -class Iu extends Ai { +class Cu extends Ai { constructor(e) { super(e, { - code: Iu.code, + code: Cu.code, name: "LimitExceededRpcError", shortMessage: "Request exceeds defined limit." }); } } -Object.defineProperty(Iu, "code", { +Object.defineProperty(Cu, "code", { enumerable: !0, configurable: !0, writable: !0, value: -32005 }); -class vl extends Ai { +class bl extends Ai { constructor(e) { super(e, { - code: vl.code, + code: bl.code, name: "JsonRpcVersionUnsupportedError", shortMessage: "Version of JSON-RPC protocol is not supported." }); } } -Object.defineProperty(vl, "code", { +Object.defineProperty(bl, "code", { enumerable: !0, configurable: !0, writable: !0, @@ -2814,181 +2814,181 @@ Object.defineProperty(bu, "code", { writable: !0, value: 4001 }); -class bl extends $i { +class yl extends $i { constructor(e) { super(e, { - code: bl.code, + code: yl.code, name: "UnauthorizedProviderError", shortMessage: "The requested method and/or account has not been authorized by the user." }); } } -Object.defineProperty(bl, "code", { +Object.defineProperty(yl, "code", { enumerable: !0, configurable: !0, writable: !0, value: 4100 }); -class yl extends $i { +class wl extends $i { constructor(e, { method: r } = {}) { super(e, { - code: yl.code, + code: wl.code, name: "UnsupportedProviderMethodError", shortMessage: `The Provider does not support the requested method${r ? ` " ${r}"` : ""}.` }); } } -Object.defineProperty(yl, "code", { +Object.defineProperty(wl, "code", { enumerable: !0, configurable: !0, writable: !0, value: 4200 }); -class wl extends $i { +class xl extends $i { constructor(e) { super(e, { - code: wl.code, + code: xl.code, name: "ProviderDisconnectedError", shortMessage: "The Provider is disconnected from all chains." }); } } -Object.defineProperty(wl, "code", { +Object.defineProperty(xl, "code", { enumerable: !0, configurable: !0, writable: !0, value: 4900 }); -class xl extends $i { +class _l extends $i { constructor(e) { super(e, { - code: xl.code, + code: _l.code, name: "ChainDisconnectedError", shortMessage: "The Provider is not connected to the requested chain." }); } } -Object.defineProperty(xl, "code", { +Object.defineProperty(_l, "code", { enumerable: !0, configurable: !0, writable: !0, value: 4901 }); -class _l extends $i { +class El extends $i { constructor(e) { super(e, { - code: _l.code, + code: El.code, name: "SwitchChainError", shortMessage: "An error occurred when attempting to switch chain." }); } } -Object.defineProperty(_l, "code", { +Object.defineProperty(El, "code", { enumerable: !0, configurable: !0, writable: !0, value: 4902 }); -class Cu extends $i { +class Tu extends $i { constructor(e) { super(e, { - code: Cu.code, + code: Tu.code, name: "UnsupportedNonOptionalCapabilityError", shortMessage: "This Wallet does not support a capability that was not marked as optional." }); } } -Object.defineProperty(Cu, "code", { +Object.defineProperty(Tu, "code", { enumerable: !0, configurable: !0, writable: !0, value: 5700 }); -class El extends $i { +class Sl extends $i { constructor(e) { super(e, { - code: El.code, + code: Sl.code, name: "UnsupportedChainIdError", shortMessage: "This Wallet does not support the requested chain ID." }); } } -Object.defineProperty(El, "code", { +Object.defineProperty(Sl, "code", { enumerable: !0, configurable: !0, writable: !0, value: 5710 }); -class Sl extends $i { +class Al extends $i { constructor(e) { super(e, { - code: Sl.code, + code: Al.code, name: "DuplicateIdError", shortMessage: "There is already a bundle submitted with this ID." }); } } -Object.defineProperty(Sl, "code", { +Object.defineProperty(Al, "code", { enumerable: !0, configurable: !0, writable: !0, value: 5720 }); -class Al extends $i { +class Pl extends $i { constructor(e) { super(e, { - code: Al.code, + code: Pl.code, name: "UnknownBundleIdError", shortMessage: "This bundle id is unknown / has not been submitted" }); } } -Object.defineProperty(Al, "code", { +Object.defineProperty(Pl, "code", { enumerable: !0, configurable: !0, writable: !0, value: 5730 }); -class Pl extends $i { +class Ml extends $i { constructor(e) { super(e, { - code: Pl.code, + code: Ml.code, name: "BundleTooLargeError", shortMessage: "The call bundle is too large for the Wallet to process." }); } } -Object.defineProperty(Pl, "code", { +Object.defineProperty(Ml, "code", { enumerable: !0, configurable: !0, writable: !0, value: 5740 }); -class Ml extends $i { +class Il extends $i { constructor(e) { super(e, { - code: Ml.code, + code: Il.code, name: "AtomicReadyWalletRejectedUpgradeError", shortMessage: "The Wallet can support atomicity after an upgrade, but the user rejected the upgrade." }); } } -Object.defineProperty(Ml, "code", { +Object.defineProperty(Il, "code", { enumerable: !0, configurable: !0, writable: !0, value: 5750 }); -class Tu extends $i { +class Ru extends $i { constructor(e) { super(e, { - code: Tu.code, + code: Ru.code, name: "AtomicityNotSupportedError", shortMessage: "The wallet does not support atomic execution but the request requires it." }); } } -Object.defineProperty(Tu, "code", { +Object.defineProperty(Ru, "code", { enumerable: !0, configurable: !0, writable: !0, @@ -3024,7 +3024,7 @@ function pN(t) { return Vl(`0x${e}`); } async function gN({ hash: t, signature: e }) { - const r = ya(t) ? t : t0(t), { secp256k1: n } = await import("./secp256k1-D5_JzNmG.js"); + const r = ya(t) ? t : t0(t), { secp256k1: n } = await import("./secp256k1-BeAu1v7B.js"); return `0x${(() => { if (typeof e == "object" && "r" in e && "s" in e) { const { r: l, s: d, v: p, yParity: w } = e, _ = Number(w ?? p), P = z2(_); @@ -3685,7 +3685,7 @@ class FN extends V5 { n0(this), H5(e, this), this.finished = !0; const { buffer: r, view: n, blockLen: i, isLE: s } = this; let { pos: o } = this; - r[o++] = 128, al(this.buffer.subarray(o)), this.padOffset > i - o && (this.process(n, 0), o = 0); + r[o++] = 128, cl(this.buffer.subarray(o)), this.padOffset > i - o && (this.process(n, 0), o = 0); for (let p = o; p < i; p++) r[p] = 0; kN(n, i - 8, BigInt(this.length * 8), s), this.process(n, 0); @@ -3815,10 +3815,10 @@ let UN = class extends FN { n = n + this.A | 0, i = i + this.B | 0, s = s + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, u = u + this.F | 0, l = l + this.G | 0, d = d + this.H | 0, this.set(n, i, s, o, a, u, l, d); } roundClean() { - al(ra); + cl(ra); } destroy() { - this.set(0, 0, 0, 0, 0, 0, 0, 0), al(this.buffer); + this.set(0, 0, 0, 0, 0, 0, 0, 0), cl(this.buffer); } }; const qN = /* @__PURE__ */ G5(() => new UN()), P4 = qN; @@ -3951,13 +3951,13 @@ async function Yv(t, e) { w.blobVersionedHashes = k; } if (l.includes("sidecars")) { - const k = A4({ blobs: n, commitments: B, kzg: o }), q = YN({ + const k = A4({ blobs: n, commitments: B, kzg: o }), W = YN({ blobs: n, commitments: B, proofs: k, to: "hex" }); - w.sidecars = q; + w.sidecars = W; } } if (l.includes("chainId") && (w.chainId = await L()), (l.includes("fees") || l.includes("type")) && typeof d > "u") @@ -3974,16 +3974,16 @@ async function Yv(t, e) { if (l.includes("fees")) if (w.type !== "legacy" && w.type !== "eip2930") { if (typeof w.maxFeePerGas > "u" || typeof w.maxPriorityFeePerGas > "u") { - const B = await P(), { maxFeePerGas: k, maxPriorityFeePerGas: q } = await H2(t, { + const B = await P(), { maxFeePerGas: k, maxPriorityFeePerGas: W } = await H2(t, { block: B, chain: i, request: w }); - if (typeof e.maxPriorityFeePerGas > "u" && e.maxFeePerGas && e.maxFeePerGas < q) + if (typeof e.maxPriorityFeePerGas > "u" && e.maxFeePerGas && e.maxFeePerGas < W) throw new CN({ - maxPriorityFeePerGas: q + maxPriorityFeePerGas: W }); - w.maxPriorityFeePerGas = q, w.maxFeePerGas = k; + w.maxPriorityFeePerGas = W, w.maxFeePerGas = k; } } else { if (typeof e.maxFeePerGas < "u" || typeof e.maxPriorityFeePerGas < "u") @@ -4021,7 +4021,7 @@ async function ZN(t, e) { params: S ? [E, x ?? "latest", S] : x ? [E, x] : [E] }); }; - const { accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, blockNumber: p, blockTag: w, data: _, gas: P, gasPrice: O, maxFeePerBlobGas: L, maxFeePerGas: B, maxPriorityFeePerGas: k, nonce: q, value: U, stateOverride: V, ...Q } = await Yv(t, { + const { accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, blockNumber: p, blockTag: w, data: _, gas: P, gasPrice: O, maxFeePerBlobGas: L, maxFeePerGas: B, maxPriorityFeePerGas: k, nonce: W, value: U, stateOverride: V, ...Q } = await Yv(t, { ...e, parameters: ( // Some RPC Providers do not compute versioned hashes from blobs. We will need @@ -4053,7 +4053,7 @@ async function ZN(t, e) { maxFeePerBlobGas: L, maxFeePerGas: B, maxPriorityFeePerGas: k, - nonce: q, + nonce: W, to: Ee, value: U }); @@ -4234,7 +4234,7 @@ async function D4(t, { serializedTransaction: e }) { } const nm = new W0(128); async function G0(t, e) { - var k, q, U, V; + var k, W, U, V; const { account: r = t.account, chain: n = t.chain, accessList: i, authorizationList: s, blobs: o, data: a, gas: u, gasPrice: l, maxFeePerBlobGas: d, maxFeePerGas: p, maxPriorityFeePerGas: w, nonce: _, type: P, value: O, ...L } = e; if (typeof r > "u") throw new Pc({ @@ -4259,7 +4259,7 @@ async function G0(t, e) { currentChainId: R, chain: n })); - const K = (U = (q = (k = t.chain) == null ? void 0 : k.formatters) == null ? void 0 : q.transactionRequest) == null ? void 0 : U.format, Ee = (K || Kv)({ + const K = (U = (W = (k = t.chain) == null ? void 0 : k.formatters) == null ? void 0 : W.transactionRequest) == null ? void 0 : U.format, Ee = (K || Kv)({ // Pick out extra data that might exist on the chain's transaction request type. ...x4(L, { format: K }), accessList: i, @@ -4412,13 +4412,13 @@ async function uL(t, e) { if (s && (_.name === "MethodNotFoundRpcError" || _.name === "MethodNotSupportedRpcError" || _.name === "UnknownRpcError" || _.details.toLowerCase().includes("does not exist / is not available") || _.details.toLowerCase().includes("missing or invalid. request()") || _.details.toLowerCase().includes("did not match any variant of untagged enum") || _.details.toLowerCase().includes("account upgraded to unsupported contract") || _.details.toLowerCase().includes("eip-7702 not supported") || _.details.toLowerCase().includes("unsupported wc_ method"))) { if (n && Object.values(n).some((k) => !k.optional)) { const k = "non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`."; - throw new Cu(new gt(k, { + throw new Tu(new gt(k, { details: k })); } if (a && p.length > 1) { const B = "`forceAtomic` is not supported on fallback to `eth_sendTransaction`."; - throw new Tu(new gt(B, { + throw new Ru(new gt(B, { details: B })); } @@ -4431,7 +4431,7 @@ async function uL(t, e) { to: B.to, value: B.value ? wa(B.value) : void 0 }); - P.push(k), o > 0 && await new Promise((q) => setTimeout(q, o)); + P.push(k), o > 0 && await new Promise((W) => setTimeout(W, o)); } const O = await Promise.allSettled(P); if (O.every((B) => B.status === "rejected")) @@ -4552,8 +4552,8 @@ function hL(t) { uid: k4() }; function B(k) { - return (q) => { - const U = q(k); + return (W) => { + const U = W(k); for (const Q in L) delete U[Q]; const V = { ...k, ...U }; @@ -4612,36 +4612,34 @@ function gL(t, e = {}) { } catch (w) { const _ = w; switch (_.code) { - case ul.code: - throw new ul(_); case fl.code: throw new fl(_); case ll.code: - throw new ll(_, { method: r.method }); + throw new ll(_); case hl.code: - throw new hl(_); - case vc.code: - throw new vc(_); + throw new hl(_, { method: r.method }); case dl.code: throw new dl(_); + case vc.code: + throw new vc(_); case pl.code: throw new pl(_); case gl.code: throw new gl(_); case ml.code: throw new ml(_); + case vl.code: + throw new vl(_); case cc.code: throw new cc(_, { method: r.method }); - case Iu.code: - throw new Iu(_); - case vl.code: - throw new vl(_); - case bu.code: - throw new bu(_); + case Cu.code: + throw new Cu(_); case bl.code: throw new bl(_); + case bu.code: + throw new bu(_); case yl.code: throw new yl(_); case wl.code: @@ -4650,10 +4648,10 @@ function gL(t, e = {}) { throw new xl(_); case _l.code: throw new _l(_); - case Cu.code: - throw new Cu(_); case El.code: throw new El(_); + case Tu.code: + throw new Tu(_); case Sl.code: throw new Sl(_); case Al.code: @@ -4662,8 +4660,10 @@ function gL(t, e = {}) { throw new Pl(_); case Ml.code: throw new Ml(_); - case Tu.code: - throw new Tu(_); + case Il.code: + throw new Il(_); + case Ru.code: + throw new Ru(_); case 5e3: throw new bu(_); default: @@ -4686,7 +4686,7 @@ function gL(t, e = {}) { }; } function mL(t) { - return "code" in t && typeof t.code == "number" ? t.code === -1 || t.code === Iu.code || t.code === vc.code : t instanceof g4 && t.status ? t.status === 403 || t.status === 408 || t.status === 413 || t.status === 429 || t.status === 500 || t.status === 502 || t.status === 503 || t.status === 504 : !0; + return "code" in t && typeof t.code == "number" ? t.code === -1 || t.code === Cu.code || t.code === vc.code : t instanceof g4 && t.status ? t.status === 403 || t.status === 408 || t.status === 413 || t.status === 429 || t.status === 500 || t.status === 502 || t.status === 503 || t.status === 504 : !0; } function vL({ key: t, methods: e, name: r, request: n, retryCount: i = 3, retryDelay: s = 150, timeout: o, type: a }, u) { const l = k4(); @@ -4717,14 +4717,22 @@ function gd(t, e = {}) { type: "custom" }); } -class bL extends gt { +function bL(t) { + return { + formatters: void 0, + fees: void 0, + serializers: void 0, + ...t + }; +} +class yL extends gt { constructor({ domain: e }) { super(`Invalid domain "${Ac(e)}".`, { metaMessages: ["Must be a valid EIP-712 domain."] }); } } -class yL extends gt { +class wL extends gt { constructor({ primaryType: e, types: r }) { super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`, { docsPath: "/api/glossary/Errors#typeddatainvalidprimarytypeerror", @@ -4732,7 +4740,7 @@ class yL extends gt { }); } } -class wL extends gt { +class xL extends gt { constructor({ type: e }) { super(`Struct type "${e}" is invalid.`, { metaMessages: ["Struct type must not be a Solidity type."], @@ -4740,7 +4748,7 @@ class wL extends gt { }); } } -function xL(t) { +function _L(t) { const { domain: e, message: r, primaryType: n, types: i } = t, s = (u, l) => { const d = { ...l }; for (const p of u) { @@ -4754,7 +4762,7 @@ function xL(t) { })(); return Ac({ domain: o, message: a, primaryType: n, types: i }); } -function _L(t) { +function EL(t) { const { domain: e, message: r, primaryType: n, types: i } = t, s = (o, a) => { for (const u of o) { const { name: l, type: d } = u, p = a[l], w = d.match(o4); @@ -4777,21 +4785,21 @@ function _L(t) { }); } const P = i[d]; - P && (SL(d), s(P, p)); + P && (AL(d), s(P, p)); } }; if (i.EIP712Domain && e) { if (typeof e != "object") - throw new bL({ domain: e }); + throw new yL({ domain: e }); s(i.EIP712Domain, e); } if (n !== "EIP712Domain") if (i[n]) s(i[n], r); else - throw new yL({ primaryType: n, types: i }); + throw new wL({ primaryType: n, types: i }); } -function EL({ domain: t }) { +function SL({ domain: t }) { return [ typeof (t == null ? void 0 : t.name) == "string" && { name: "name", type: "string" }, (t == null ? void 0 : t.version) && { name: "version", type: "string" }, @@ -4806,11 +4814,11 @@ function EL({ domain: t }) { (t == null ? void 0 : t.salt) && { name: "salt", type: "bytes32" } ].filter(Boolean); } -function SL(t) { +function AL(t) { if (t === "address" || t === "bool" || t === "string" || t.startsWith("bytes") || t.startsWith("uint") || t.startsWith("int")) - throw new wL({ type: t }); + throw new xL({ type: t }); } -async function AL(t, { chain: e }) { +async function PL(t, { chain: e }) { const { id: r, name: n, nativeCurrency: i, rpcUrls: s, blockExplorers: o } = e; await t.request({ method: "wallet_addEthereumChain", @@ -4825,7 +4833,7 @@ async function AL(t, { chain: e }) { ] }, { dedupe: !0, retryCount: 0 }); } -function PL(t, e) { +function ML(t, e) { const { abi: r, args: n, bytecode: i, ...s } = e, o = rL({ abi: r, args: n, bytecode: i }); return G0(t, { ...s, @@ -4833,11 +4841,11 @@ function PL(t, e) { data: o }); } -async function ML(t) { +async function IL(t) { var r; return ((r = t.account) == null ? void 0 : r.type) === "local" ? [t.account.address] : (await t.request({ method: "eth_accounts" }, { dedupe: !0 })).map((n) => Vl(n)); } -async function IL(t, e = {}) { +async function CL(t, e = {}) { const { account: r = t.account, chainId: n } = e, i = r ? _i(r) : void 0, s = n ? [i == null ? void 0 : i.address, [vr(n)]] : [i == null ? void 0 : i.address], o = await t.request({ method: "wallet_getCapabilities", params: s @@ -4849,7 +4857,7 @@ async function IL(t, e = {}) { } return typeof n == "number" ? a[n] : a; } -async function CL(t) { +async function TL(t) { return await t.request({ method: "wallet_getPermissions" }, { dedupe: !0 }); } async function $4(t, e) { @@ -4872,23 +4880,23 @@ async function $4(t, e) { blockTag: "pending" }), (o === "self" || o != null && o.address && QN(o.address, s.address)) && (a.nonce += 1)), a; } -async function TL(t) { +async function RL(t) { return (await t.request({ method: "eth_requestAccounts" }, { dedupe: !0, retryCount: 0 })).map((r) => Fv(r)); } -async function RL(t, e) { +async function DL(t, e) { return t.request({ method: "wallet_requestPermissions", params: [e] }, { retryCount: 0 }); } -async function DL(t, e) { +async function OL(t, e) { const { id: r } = e; await t.request({ method: "wallet_showCallsStatus", params: [r] }); } -async function OL(t, e) { +async function NL(t, e) { const { account: r = t.account } = e; if (!r) throw new Pc({ @@ -4906,7 +4914,7 @@ async function OL(t, e) { const i = await $4(t, e); return n.signAuthorization(i); } -async function NL(t, { account: e = t.account, message: r }) { +async function LL(t, { account: e = t.account, message: r }) { if (!e) throw new Pc({ docsPath: "/docs/actions/wallet/signMessage" @@ -4920,7 +4928,7 @@ async function NL(t, { account: e = t.account, message: r }) { params: [i, n.address] }, { retryCount: 0 }); } -async function LL(t, e) { +async function kL(t, e) { var l, d, p, w; const { account: r = t.account, chain: n = t.chain, ...i } = e; if (!r) @@ -4952,25 +4960,25 @@ async function LL(t, e) { ] }, { retryCount: 0 }); } -async function kL(t, e) { +async function $L(t, e) { const { account: r = t.account, domain: n, message: i, primaryType: s } = e; if (!r) throw new Pc({ docsPath: "/docs/actions/wallet/signTypedData" }); const o = _i(r), a = { - EIP712Domain: EL({ domain: n }), + EIP712Domain: SL({ domain: n }), ...e.types }; - if (_L({ domain: n, message: i, primaryType: s, types: a }), o.signTypedData) + if (EL({ domain: n, message: i, primaryType: s, types: a }), o.signTypedData) return o.signTypedData({ domain: n, message: i, primaryType: s, types: a }); - const u = xL({ domain: n, message: i, primaryType: s, types: a }); + const u = _L({ domain: n, message: i, primaryType: s, types: a }); return t.request({ method: "eth_signTypedData_v4", params: [o.address, u] }, { retryCount: 0 }); } -async function $L(t, { id: e }) { +async function BL(t, { id: e }) { await t.request({ method: "wallet_switchEthereumChain", params: [ @@ -4980,36 +4988,36 @@ async function $L(t, { id: e }) { ] }, { retryCount: 0 }); } -async function BL(t, e) { +async function FL(t, e) { return await t.request({ method: "wallet_watchAsset", params: e }, { retryCount: 0 }); } -function FL(t) { +function jL(t) { return { - addChain: (e) => AL(t, e), - deployContract: (e) => PL(t, e), - getAddresses: () => ML(t), + addChain: (e) => PL(t, e), + deployContract: (e) => ML(t, e), + getAddresses: () => IL(t), getCallsStatus: (e) => L4(t, e), - getCapabilities: (e) => IL(t, e), + getCapabilities: (e) => CL(t, e), getChainId: () => Gl(t), - getPermissions: () => CL(t), + getPermissions: () => TL(t), prepareAuthorization: (e) => $4(t, e), prepareTransactionRequest: (e) => Yv(t, e), - requestAddresses: () => TL(t), - requestPermissions: (e) => RL(t, e), + requestAddresses: () => RL(t), + requestPermissions: (e) => DL(t, e), sendCalls: (e) => uL(t, e), sendRawTransaction: (e) => D4(t, e), sendTransaction: (e) => G0(t, e), - showCallsStatus: (e) => DL(t, e), - signAuthorization: (e) => OL(t, e), - signMessage: (e) => NL(t, e), - signTransaction: (e) => LL(t, e), - signTypedData: (e) => kL(t, e), - switchChain: (e) => $L(t, e), + showCallsStatus: (e) => OL(t, e), + signAuthorization: (e) => NL(t, e), + signMessage: (e) => LL(t, e), + signTransaction: (e) => kL(t, e), + signTypedData: (e) => $L(t, e), + switchChain: (e) => BL(t, e), waitForCallsStatus: (e) => fL(t, e), - watchAsset: (e) => BL(t, e), + watchAsset: (e) => FL(t, e), writeContract: (e) => aL(t, e) }; } @@ -5021,9 +5029,9 @@ function md(t) { name: r, transport: n, type: "walletClient" - }).extend(FL); + }).extend(jL); } -class Il { +class yu { constructor(e) { vs(this, "_key"); vs(this, "_config", null); @@ -5043,7 +5051,7 @@ class Il { name: e.session.peer.metadata.name, image: e.session.peer.metadata.icons[0], featured: !1 - }; + }, this.testConnect(); } else if ("info" in e) this._key = e.info.name, this._provider = e.provider, this._installed = !0, this._client = md({ transport: gd(this._provider) }), this._config = { name: e.info.name, @@ -5078,7 +5086,7 @@ class Il { return this._config; } static fromWalletConfig(e) { - return new Il(e); + return new yu(e); } EIP6963Detected(e) { this._provider = e.provider, this._client = md({ transport: gd(this._provider) }), this._installed = !0, this._provider.on("disconnect", this.disconnect), this._provider.on("accountsChanged", (r) => { @@ -5129,15 +5137,15 @@ class Il { this._provider && "session" in this._provider && await this._provider.disconnect(), this._connected = !1, this._address = null; } } -var Jv = { exports: {} }, yu = typeof Reflect == "object" ? Reflect : null, J2 = yu && typeof yu.apply == "function" ? yu.apply : function(e, r, n) { +var Jv = { exports: {} }, wu = typeof Reflect == "object" ? Reflect : null, J2 = wu && typeof wu.apply == "function" ? wu.apply : function(e, r, n) { return Function.prototype.apply.call(e, r, n); }, Od; -yu && typeof yu.ownKeys == "function" ? Od = yu.ownKeys : Object.getOwnPropertySymbols ? Od = function(e) { +wu && typeof wu.ownKeys == "function" ? Od = wu.ownKeys : Object.getOwnPropertySymbols ? Od = function(e) { return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e)); } : Od = function(e) { return Object.getOwnPropertyNames(e); }; -function jL(t) { +function UL(t) { console && console.warn && console.warn(t); } var B4 = Number.isNaN || function(e) { @@ -5147,7 +5155,7 @@ function kr() { kr.init.call(this); } Jv.exports = kr; -Jv.exports.once = WL; +Jv.exports.once = HL; kr.EventEmitter = kr; kr.prototype._events = void 0; kr.prototype._eventsCount = 0; @@ -5217,7 +5225,7 @@ function j4(t, e, r, n) { else if (typeof o == "function" ? o = s[e] = n ? [r, o] : [o, r] : n ? o.unshift(r) : o.push(r), i = F4(t), i > 0 && o.length > i && !o.warned) { o.warned = !0; var a = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit"); - a.name = "MaxListenersExceededWarning", a.emitter = t, a.type = e, a.count = o.length, jL(a); + a.name = "MaxListenersExceededWarning", a.emitter = t, a.type = e, a.count = o.length, UL(a); } return t; } @@ -5228,12 +5236,12 @@ kr.prototype.on = kr.prototype.addListener; kr.prototype.prependListener = function(e, r) { return j4(this, e, r, !0); }; -function UL() { +function qL() { if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments); } function U4(t, e, r) { - var n = { fired: !1, wrapFn: void 0, target: t, type: e, listener: r }, i = UL.bind(n); + var n = { fired: !1, wrapFn: void 0, target: t, type: e, listener: r }, i = qL.bind(n); return i.listener = r, n.wrapFn = i, i; } kr.prototype.once = function(e, r) { @@ -5258,7 +5266,7 @@ kr.prototype.removeListener = function(e, r) { } if (s < 0) return this; - s === 0 ? n.shift() : qL(n, s), n.length === 1 && (i[e] = n[0]), i.removeListener !== void 0 && this.emit("removeListener", e, a || r); + s === 0 ? n.shift() : zL(n, s), n.length === 1 && (i[e] = n[0]), i.removeListener !== void 0 && this.emit("removeListener", e, a || r); } return this; }; @@ -5287,7 +5295,7 @@ function q4(t, e, r) { if (n === void 0) return []; var i = n[e]; - return i === void 0 ? [] : typeof i == "function" ? r ? [i.listener || i] : [i] : r ? zL(i) : W4(i, i.length); + return i === void 0 ? [] : typeof i == "function" ? r ? [i.listener || i] : [i] : r ? WL(i) : W4(i, i.length); } kr.prototype.listeners = function(e) { return q4(this, e, !0); @@ -5318,17 +5326,17 @@ function W4(t, e) { r[n] = t[n]; return r; } -function qL(t, e) { +function zL(t, e) { for (; e + 1 < t.length; e++) t[e] = t[e + 1]; t.pop(); } -function zL(t) { +function WL(t) { for (var e = new Array(t.length), r = 0; r < e.length; ++r) e[r] = t[r].listener || t[r]; return e; } -function WL(t, e) { +function HL(t, e) { return new Promise(function(r, n) { function i(o) { t.removeListener(e, s), n(o); @@ -5336,10 +5344,10 @@ function WL(t, e) { function s() { typeof t.removeListener == "function" && t.removeListener("error", i), r([].slice.call(arguments)); } - H4(t, e, s, { once: !0 }), e !== "error" && HL(t, i, { once: !0 }); + H4(t, e, s, { once: !0 }), e !== "error" && KL(t, i, { once: !0 }); }); } -function HL(t, e, r) { +function KL(t, e, r) { typeof t.on == "function" && H4(t, "error", e, r); } function H4(t, e, r, n) { @@ -5376,7 +5384,7 @@ var S1 = function(t, e) { for (var i in n) n.hasOwnProperty(i) && (r[i] = n[i]); }, S1(t, e); }; -function KL(t, e) { +function VL(t, e) { S1(t, e); function r() { this.constructor = t; @@ -5392,7 +5400,7 @@ var A1 = function() { return e; }, A1.apply(this, arguments); }; -function VL(t, e) { +function GL(t, e) { var r = {}; for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); if (t != null && typeof Object.getOwnPropertySymbols == "function") @@ -5400,21 +5408,21 @@ function VL(t, e) { e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]); return r; } -function GL(t, e, r, n) { +function YL(t, e, r, n) { var i = arguments.length, s = i < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, r) : n, o; if (typeof Reflect == "object" && typeof Reflect.decorate == "function") s = Reflect.decorate(t, e, r, n); else for (var a = t.length - 1; a >= 0; a--) (o = t[a]) && (s = (i < 3 ? o(s) : i > 3 ? o(e, r, s) : o(e, r)) || s); return i > 3 && s && Object.defineProperty(e, r, s), s; } -function YL(t, e) { +function JL(t, e) { return function(r, n) { e(r, n, t); }; } -function JL(t, e) { +function XL(t, e) { if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(t, e); } -function XL(t, e, r, n) { +function ZL(t, e, r, n) { function i(s) { return s instanceof r ? s : new r(function(o) { o(s); @@ -5441,7 +5449,7 @@ function XL(t, e, r, n) { l((n = n.apply(t, e || [])).next()); }); } -function ZL(t, e) { +function QL(t, e) { var r = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; @@ -5501,10 +5509,10 @@ function ZL(t, e) { return { value: l[0] ? l[1] : void 0, done: !0 }; } } -function QL(t, e, r, n) { +function ek(t, e, r, n) { n === void 0 && (n = r), t[n] = e[r]; } -function ek(t, e) { +function tk(t, e) { for (var r in t) r !== "default" && !e.hasOwnProperty(r) && (e[r] = t[r]); } function P1(t) { @@ -5534,12 +5542,12 @@ function K4(t, e) { } return s; } -function tk() { +function rk() { for (var t = [], e = 0; e < arguments.length; e++) t = t.concat(K4(arguments[e])); return t; } -function rk() { +function nk() { for (var t = 0, e = 0, r = arguments.length; e < r; e++) t += arguments[e].length; for (var n = Array(t), i = 0, e = 0; e < r; e++) for (var s = arguments[e], o = 0, a = s.length; o < a; o++, i++) @@ -5549,7 +5557,7 @@ function rk() { function Cl(t) { return this instanceof Cl ? (this.v = t, this) : new Cl(t); } -function nk(t, e, r) { +function ik(t, e, r) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var n = r.apply(t, e || []), i, s = []; return i = {}, o("next"), o("throw"), o("return"), i[Symbol.asyncIterator] = function() { @@ -5582,7 +5590,7 @@ function nk(t, e, r) { w(_), s.shift(), s.length && a(s[0][0], s[0][1]); } } -function ik(t) { +function sk(t) { var e, r; return e = {}, n("next"), n("throw", function(i) { throw i; @@ -5595,7 +5603,7 @@ function ik(t) { } : s; } } -function sk(t) { +function ok(t) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var e = t[Symbol.asyncIterator], r; return e ? e.call(t) : (t = typeof P1 == "function" ? P1(t) : t[Symbol.iterator](), r = {}, n("next"), n("throw"), n("return"), r[Symbol.asyncIterator] = function() { @@ -5614,60 +5622,60 @@ function sk(t) { }, o); } } -function ok(t, e) { +function ak(t, e) { return Object.defineProperty ? Object.defineProperty(t, "raw", { value: e }) : t.raw = e, t; } -function ak(t) { +function ck(t) { if (t && t.__esModule) return t; var e = {}; if (t != null) for (var r in t) Object.hasOwnProperty.call(t, r) && (e[r] = t[r]); return e.default = t, e; } -function ck(t) { +function uk(t) { return t && t.__esModule ? t : { default: t }; } -function uk(t, e) { +function fk(t, e) { if (!e.has(t)) throw new TypeError("attempted to get private field on non-instance"); return e.get(t); } -function fk(t, e, r) { +function lk(t, e, r) { if (!e.has(t)) throw new TypeError("attempted to set private field on non-instance"); return e.set(t, r), r; } -const lk = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +const hk = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, get __assign() { return A1; }, - __asyncDelegator: ik, - __asyncGenerator: nk, - __asyncValues: sk, + __asyncDelegator: sk, + __asyncGenerator: ik, + __asyncValues: ok, __await: Cl, - __awaiter: XL, - __classPrivateFieldGet: uk, - __classPrivateFieldSet: fk, - __createBinding: QL, - __decorate: GL, - __exportStar: ek, - __extends: KL, - __generator: ZL, - __importDefault: ck, - __importStar: ak, - __makeTemplateObject: ok, - __metadata: JL, - __param: YL, + __awaiter: ZL, + __classPrivateFieldGet: fk, + __classPrivateFieldSet: lk, + __createBinding: ek, + __decorate: YL, + __exportStar: tk, + __extends: VL, + __generator: QL, + __importDefault: uk, + __importStar: ck, + __makeTemplateObject: ak, + __metadata: XL, + __param: JL, __read: K4, - __rest: VL, - __spread: tk, - __spreadArrays: rk, + __rest: GL, + __spread: rk, + __spreadArrays: nk, __values: P1 -}, Symbol.toStringTag, { value: "Module" })), Yl = /* @__PURE__ */ Lv(lk); -var im = {}, Mf = {}, Z2; -function hk() { - if (Z2) return Mf; - Z2 = 1, Object.defineProperty(Mf, "__esModule", { value: !0 }), Mf.delay = void 0; +}, Symbol.toStringTag, { value: "Module" })), Yl = /* @__PURE__ */ Lv(hk); +var im = {}, If = {}, Z2; +function dk() { + if (Z2) return If; + Z2 = 1, Object.defineProperty(If, "__esModule", { value: !0 }), If.delay = void 0; function t(e) { return new Promise((r) => { setTimeout(() => { @@ -5675,14 +5683,14 @@ function hk() { }, e); }); } - return Mf.delay = t, Mf; + return If.delay = t, If; } var Ga = {}, sm = {}, Ya = {}, Q2; -function dk() { +function pk() { return Q2 || (Q2 = 1, Object.defineProperty(Ya, "__esModule", { value: !0 }), Ya.ONE_THOUSAND = Ya.ONE_HUNDRED = void 0, Ya.ONE_HUNDRED = 100, Ya.ONE_THOUSAND = 1e3), Ya; } var om = {}, ex; -function pk() { +function gk() { return ex || (ex = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.ONE_YEAR = t.FOUR_WEEKS = t.THREE_WEEKS = t.TWO_WEEKS = t.ONE_WEEK = t.THIRTY_DAYS = t.SEVEN_DAYS = t.FIVE_DAYS = t.THREE_DAYS = t.ONE_DAY = t.TWENTY_FOUR_HOURS = t.TWELVE_HOURS = t.SIX_HOURS = t.THREE_HOURS = t.ONE_HOUR = t.SIXTY_MINUTES = t.THIRTY_MINUTES = t.TEN_MINUTES = t.FIVE_MINUTES = t.ONE_MINUTE = t.SIXTY_SECONDS = t.THIRTY_SECONDS = t.TEN_SECONDS = t.FIVE_SECONDS = t.ONE_SECOND = void 0, t.ONE_SECOND = 1, t.FIVE_SECONDS = 5, t.TEN_SECONDS = 10, t.THIRTY_SECONDS = 30, t.SIXTY_SECONDS = 60, t.ONE_MINUTE = t.SIXTY_SECONDS, t.FIVE_MINUTES = t.ONE_MINUTE * 5, t.TEN_MINUTES = t.ONE_MINUTE * 10, t.THIRTY_MINUTES = t.ONE_MINUTE * 30, t.SIXTY_MINUTES = t.ONE_MINUTE * 60, t.ONE_HOUR = t.SIXTY_MINUTES, t.THREE_HOURS = t.ONE_HOUR * 3, t.SIX_HOURS = t.ONE_HOUR * 6, t.TWELVE_HOURS = t.ONE_HOUR * 12, t.TWENTY_FOUR_HOURS = t.ONE_HOUR * 24, t.ONE_DAY = t.TWENTY_FOUR_HOURS, t.THREE_DAYS = t.ONE_DAY * 3, t.FIVE_DAYS = t.ONE_DAY * 5, t.SEVEN_DAYS = t.ONE_DAY * 7, t.THIRTY_DAYS = t.ONE_DAY * 30, t.ONE_WEEK = t.SEVEN_DAYS, t.TWO_WEEKS = t.ONE_WEEK * 2, t.THREE_WEEKS = t.ONE_WEEK * 3, t.FOUR_WEEKS = t.ONE_WEEK * 4, t.ONE_YEAR = t.ONE_DAY * 365; }(om)), om; @@ -5692,11 +5700,11 @@ function V4() { return tx || (tx = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); const e = Yl; - e.__exportStar(dk(), t), e.__exportStar(pk(), t); + e.__exportStar(pk(), t), e.__exportStar(gk(), t); }(sm)), sm; } var rx; -function gk() { +function mk() { if (rx) return Ga; rx = 1, Object.defineProperty(Ga, "__esModule", { value: !0 }), Ga.fromMiliseconds = Ga.toMiliseconds = void 0; const t = V4(); @@ -5710,15 +5718,15 @@ function gk() { return Ga.fromMiliseconds = r, Ga; } var nx; -function mk() { +function vk() { return nx || (nx = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); const e = Yl; - e.__exportStar(hk(), t), e.__exportStar(gk(), t); + e.__exportStar(dk(), t), e.__exportStar(mk(), t); }(im)), im; } var Qc = {}, ix; -function vk() { +function bk() { if (ix) return Qc; ix = 1, Object.defineProperty(Qc, "__esModule", { value: !0 }), Qc.Watch = void 0; class t { @@ -5750,34 +5758,34 @@ function vk() { } return Qc.Watch = t, Qc.default = t, Qc; } -var am = {}, If = {}, sx; -function bk() { - if (sx) return If; - sx = 1, Object.defineProperty(If, "__esModule", { value: !0 }), If.IWatch = void 0; +var am = {}, Cf = {}, sx; +function yk() { + if (sx) return Cf; + sx = 1, Object.defineProperty(Cf, "__esModule", { value: !0 }), Cf.IWatch = void 0; class t { } - return If.IWatch = t, If; + return Cf.IWatch = t, Cf; } var ox; -function yk() { +function wk() { return ox || (ox = 1, function(t) { - Object.defineProperty(t, "__esModule", { value: !0 }), Yl.__exportStar(bk(), t); + Object.defineProperty(t, "__esModule", { value: !0 }), Yl.__exportStar(yk(), t); }(am)), am; } (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); const e = Yl; - e.__exportStar(mk(), t), e.__exportStar(vk(), t), e.__exportStar(yk(), t), e.__exportStar(V4(), t); + e.__exportStar(vk(), t), e.__exportStar(bk(), t), e.__exportStar(wk(), t), e.__exportStar(V4(), t); })(vt); class Mc { } -let wk = class extends Mc { +let xk = class extends Mc { constructor(e) { super(); } }; -const ax = vt.FIVE_SECONDS, ju = { pulse: "heartbeat_pulse" }; -let xk = class G4 extends wk { +const ax = vt.FIVE_SECONDS, Uu = { pulse: "heartbeat_pulse" }; +let _k = class G4 extends xk { constructor(e) { super(e), this.events = new is.EventEmitter(), this.interval = ax, this.interval = (e == null ? void 0 : e.interval) || ax; } @@ -5807,18 +5815,18 @@ let xk = class G4 extends wk { this.intervalRef = setInterval(() => this.pulse(), vt.toMiliseconds(this.interval)); } pulse() { - this.events.emit(ju.pulse); + this.events.emit(Uu.pulse); } }; -const _k = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/, Ek = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/, Sk = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/; -function Ak(t, e) { +const Ek = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/, Sk = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/, Ak = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/; +function Pk(t, e) { if (t === "__proto__" || t === "constructor" && e && typeof e == "object" && "prototype" in e) { - Pk(t); + Mk(t); return; } return e; } -function Pk(t) { +function Mk(t) { console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`); } function vd(t, e = {}) { @@ -5847,16 +5855,16 @@ function vd(t, e = {}) { if (n === "-infinity") return Number.NEGATIVE_INFINITY; } - if (!Sk.test(t)) { + if (!Ak.test(t)) { if (e.strict) throw new SyntaxError("[destr] Invalid JSON"); return t; } try { - if (_k.test(t) || Ek.test(t)) { + if (Ek.test(t) || Sk.test(t)) { if (e.strict) throw new Error("[destr] Possible prototype pollution"); - return JSON.parse(t, Ak); + return JSON.parse(t, Pk); } return JSON.parse(t); } catch (n) { @@ -5865,28 +5873,28 @@ function vd(t, e = {}) { return t; } } -function Mk(t) { +function Ik(t) { return !t || typeof t.then != "function" ? Promise.resolve(t) : t; } function Cn(t, ...e) { try { - return Mk(t(...e)); + return Ik(t(...e)); } catch (r) { return Promise.reject(r); } } -function Ik(t) { +function Ck(t) { const e = typeof t; return t === null || e !== "object" && e !== "function"; } -function Ck(t) { +function Tk(t) { const e = Object.getPrototypeOf(t); return !e || e.isPrototypeOf(Object); } function Nd(t) { - if (Ik(t)) + if (Ck(t)) return String(t); - if (Ck(t) || Array.isArray(t)) + if (Tk(t) || Array.isArray(t)) return JSON.stringify(t); if (typeof t.toJSON == "function") return Nd(t.toJSON()); @@ -5897,29 +5905,29 @@ function Y4() { throw new TypeError("[unstorage] Buffer is not supported!"); } const M1 = "base64:"; -function Tk(t) { +function Rk(t) { if (typeof t == "string") return t; Y4(); const e = Buffer.from(t).toString("base64"); return M1 + e; } -function Rk(t) { +function Dk(t) { return typeof t != "string" || !t.startsWith(M1) ? t : (Y4(), Buffer.from(t.slice(M1.length), "base64")); } function gi(t) { return t ? t.split("?")[0].replace(/[/\\]/g, ":").replace(/:+/g, ":").replace(/^:|:$/g, "") : ""; } -function Dk(...t) { +function Ok(...t) { return gi(t.join(":")); } function bd(t) { return t = gi(t), t ? t + ":" : ""; } -const Ok = "memory", Nk = () => { +const Nk = "memory", Lk = () => { const t = /* @__PURE__ */ new Map(); return { - name: Ok, + name: Nk, getInstance: () => t, hasItem(e) { return t.has(e); @@ -5950,9 +5958,9 @@ const Ok = "memory", Nk = () => { } }; }; -function Lk(t = {}) { +function kk(t = {}) { const e = { - mounts: { "": t.driver || Nk() }, + mounts: { "": t.driver || Lk() }, mountpoints: [""], watching: !1, watchListeners: [], @@ -6008,11 +6016,11 @@ function Lk(t = {}) { }, w.set(P.base, O)), O; }; for (const P of l) { - const O = typeof P == "string", L = gi(O ? P : P.key), B = O ? void 0 : P.value, k = O || !P.options ? d : { ...d, ...P.options }, q = r(L); - _(q).items.push({ + const O = typeof P == "string", L = gi(O ? P : P.key), B = O ? void 0 : P.value, k = O || !P.options ? d : { ...d, ...P.options }, W = r(L); + _(W).items.push({ key: L, value: B, - relativeKey: q.relativeKey, + relativeKey: W.relativeKey, options: k }); } @@ -6043,7 +6051,7 @@ function Lk(t = {}) { d ).then( (w) => w.map((_) => ({ - key: Dk(p.base, _.key), + key: Ok(p.base, _.key), value: vd(_.value) })) ) : Promise.all( @@ -6061,7 +6069,7 @@ function Lk(t = {}) { l = gi(l); const { relativeKey: p, driver: w } = r(l); return w.getItemRaw ? Cn(w.getItemRaw, p, d) : Cn(w.getItem, p, d).then( - (_) => Rk(_) + (_) => Dk(_) ); }, async setItem(l, d, p = {}) { @@ -6101,7 +6109,7 @@ function Lk(t = {}) { if (_.setItemRaw) await Cn(_.setItemRaw, w, d, p); else if (_.setItem) - await Cn(_.setItem, w, Tk(d), p); + await Cn(_.setItem, w, Rk(d), p); else return; _.watch || i("update", l); @@ -6246,29 +6254,29 @@ function Jl() { function fx(t, e = Jl()) { return e("readonly", (r) => Ic(r.get(t))); } -function kk(t, e, r = Jl()) { +function $k(t, e, r = Jl()) { return r("readwrite", (n) => (n.put(e, t), Ic(n.transaction))); } -function $k(t, e = Jl()) { +function Bk(t, e = Jl()) { return e("readwrite", (r) => (r.delete(t), Ic(r.transaction))); } -function Bk(t = Jl()) { +function Fk(t = Jl()) { return t("readwrite", (e) => (e.clear(), Ic(e.transaction))); } -function Fk(t, e) { +function jk(t, e) { return t.openCursor().onsuccess = function() { this.result && (e(this.result), this.result.continue()); }, Ic(t.transaction); } -function jk(t = Jl()) { +function Uk(t = Jl()) { return t("readonly", (e) => { if (e.getAllKeys) return Ic(e.getAllKeys()); const r = []; - return Fk(e, (n) => r.push(n.key)).then(() => r); + return jk(e, (n) => r.push(n.key)).then(() => r); }); } -const Uk = (t) => JSON.stringify(t, (e, r) => typeof r == "bigint" ? r.toString() + "n" : r), qk = (t) => { +const qk = (t) => JSON.stringify(t, (e, r) => typeof r == "bigint" ? r.toString() + "n" : r), zk = (t) => { const e = /([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g, r = t.replace(e, '$1"$2n"$3'); return JSON.parse(r, (n, i) => typeof i == "string" && i.match(/^\d+n$/) ? BigInt(i.substring(0, i.length - 1)) : i); }; @@ -6276,36 +6284,36 @@ function bc(t) { if (typeof t != "string") throw new Error(`Cannot safe json parse value of type ${typeof t}`); try { - return qk(t); + return zk(t); } catch { return t; } } function jo(t) { - return typeof t == "string" ? t : Uk(t) || ""; + return typeof t == "string" ? t : qk(t) || ""; } -const zk = "idb-keyval"; -var Wk = (t = {}) => { +const Wk = "idb-keyval"; +var Hk = (t = {}) => { const e = t.base && t.base.length > 0 ? `${t.base}:` : "", r = (i) => e + i; let n; - return t.dbName && t.storeName && (n = J4(t.dbName, t.storeName)), { name: zk, options: t, async hasItem(i) { + return t.dbName && t.storeName && (n = J4(t.dbName, t.storeName)), { name: Wk, options: t, async hasItem(i) { return !(typeof await fx(r(i), n) > "u"); }, async getItem(i) { return await fx(r(i), n) ?? null; }, setItem(i, s) { - return kk(r(i), s, n); + return $k(r(i), s, n); }, removeItem(i) { - return $k(r(i), n); + return Bk(r(i), n); }, getKeys() { - return jk(n); + return Uk(n); }, clear() { - return Bk(n); + return Fk(n); } }; }; -const Hk = "WALLET_CONNECT_V2_INDEXED_DB", Kk = "keyvaluestorage"; -let Vk = class { +const Kk = "WALLET_CONNECT_V2_INDEXED_DB", Vk = "keyvaluestorage"; +let Gk = class { constructor() { - this.indexedDb = Lk({ driver: Wk({ dbName: Hk, storeName: Kk }) }); + this.indexedDb = kk({ driver: Hk({ dbName: Kk, storeName: Vk }) }); } async getKeys() { return this.indexedDb.getKeys(); @@ -6346,11 +6354,11 @@ var um = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t return Object.keys(this).length; }), typeof um < "u" && um.localStorage ? Ld.exports = um.localStorage : typeof window < "u" && window.localStorage ? Ld.exports = window.localStorage : Ld.exports = new e(); })(); -function Gk(t) { +function Yk(t) { var e; return [t[0], bc((e = t[1]) != null ? e : "")]; } -let Yk = class { +let Jk = class { constructor() { this.localStorage = Ld.exports; } @@ -6358,7 +6366,7 @@ let Yk = class { return Object.keys(this.localStorage); } async getEntries() { - return Object.entries(this.localStorage).map(Gk); + return Object.entries(this.localStorage).map(Yk); } async getItem(e) { const r = this.localStorage.getItem(e); @@ -6371,8 +6379,8 @@ let Yk = class { this.localStorage.removeItem(e); } }; -const Jk = "wc_storage_version", lx = 1, Xk = async (t, e, r) => { - const n = Jk, i = await e.getItem(n); +const Xk = "wc_storage_version", lx = 1, Zk = async (t, e, r) => { + const n = Xk, i = await e.getItem(n); if (i && i >= lx) { r(e); return; @@ -6392,22 +6400,22 @@ const Jk = "wc_storage_version", lx = 1, Xk = async (t, e, r) => { await e.setItem(a, l), o.push(a); } } - await e.setItem(n, lx), r(e), Zk(t, o); -}, Zk = async (t, e) => { + await e.setItem(n, lx), r(e), Qk(t, o); +}, Qk = async (t, e) => { e.length && e.forEach(async (r) => { await t.removeItem(r); }); }; -let Qk = class { +let e$ = class { constructor() { this.initialized = !1, this.setInitialized = (r) => { this.storage = r, this.initialized = !0; }; - const e = new Yk(); + const e = new Jk(); this.storage = e; try { - const r = new Vk(); - Xk(e, r, this.setInitialized); + const r = new Gk(); + Zk(e, r, this.setInitialized); } catch { this.initialized = !0; } @@ -6435,16 +6443,16 @@ let Qk = class { }); } }; -function e$(t) { +function t$(t) { try { return JSON.stringify(t); } catch { return '"[Circular]"'; } } -var t$ = r$; -function r$(t, e, r) { - var n = r && r.stringify || e$, i = 1; +var r$ = n$; +function n$(t, e, r) { + var n = r && r.stringify || t$, i = 1; if (typeof t == "object" && t !== null) { var s = e.length + i; if (s === 1) return t; @@ -6501,9 +6509,9 @@ function r$(t, e, r) { } return p === -1 ? t : (p < w && (l += t.slice(p)), l); } -const hx = t$; +const hx = r$; var ou = Uo; -const Tl = h$().console || {}, n$ = { +const Tl = d$().console || {}, i$ = { mapHttpRequest: yd, mapHttpResponse: yd, wrapRequestSerializer: fm, @@ -6511,9 +6519,9 @@ const Tl = h$().console || {}, n$ = { wrapErrorSerializer: fm, req: yd, res: yd, - err: c$ + err: u$ }; -function i$(t, e) { +function s$(t, e) { return Array.isArray(t) ? t.filter(function(n) { return n !== "!stdSerializers.err"; }) : t === !0 ? Object.keys(e) : !1; @@ -6525,7 +6533,7 @@ function Uo(t) { throw Error("pino: transmit option must have a send function"); const r = t.browser.write || Tl; t.browser.write && (t.browser.asObject = !0); - const n = t.serializers || {}, i = i$(t.browser.serialize, n); + const n = t.serializers || {}, i = s$(t.browser.serialize, n); let s = t.browser.serialize; Array.isArray(t.browser.serialize) && t.browser.serialize.indexOf("!stdSerializers.err") > -1 && (s = !1); const o = ["error", "fatal", "warn", "info", "debug", "trace"]; @@ -6542,7 +6550,7 @@ function Uo(t) { serialize: i, asObject: t.browser.asObject, levels: o, - timestamp: u$(t) + timestamp: f$(t) }; u.levels = Uo.levels, u.level = a, u.setMaxListeners = u.getMaxListeners = u.emit = u.addListener = u.on = u.prependListener = u.once = u.prependOnceListener = u.removeListener = u.removeAllListeners = u.listeners = u.listenerCount = u.eventNames = u.write = u.flush = Rl, u.serializers = n, u._serialize = i, u._stdErrSerialize = s, u.child = _, e && (u._logEvent = I1()); function d() { @@ -6565,12 +6573,12 @@ function Uo(t) { var B = Object.assign({}, n, L), k = t.browser.serialize === !0 ? Object.keys(B) : i; delete P.serializers, J0([P], k, B, this._stdErrSerialize); } - function q(U) { + function W(U) { this._childLevel = (U._childLevel | 0) + 1, this.error = tu(U, P, "error"), this.fatal = tu(U, P, "fatal"), this.warn = tu(U, P, "warn"), this.info = tu(U, P, "info"), this.debug = tu(U, P, "debug"), this.trace = tu(U, P, "trace"), B && (this.serializers = B, this._serialize = k), e && (this._logEvent = I1( [].concat(U._logEvent.bindings, P) )); } - return q.prototype = this, new q(this); + return W.prototype = this, new W(this); } return u; } @@ -6592,21 +6600,21 @@ Uo.levels = { 60: "fatal" } }; -Uo.stdSerializers = n$; -Uo.stdTimeFunctions = Object.assign({}, { nullTime: X4, epochTime: Z4, unixTime: f$, isoTime: l$ }); +Uo.stdSerializers = i$; +Uo.stdTimeFunctions = Object.assign({}, { nullTime: X4, epochTime: Z4, unixTime: l$, isoTime: h$ }); function eu(t, e, r, n) { const i = Object.getPrototypeOf(e); - e[r] = e.levelVal > e.levels.values[r] ? Rl : i[r] ? i[r] : Tl[r] || Tl[n] || Rl, s$(t, e, r); + e[r] = e.levelVal > e.levels.values[r] ? Rl : i[r] ? i[r] : Tl[r] || Tl[n] || Rl, o$(t, e, r); } -function s$(t, e, r) { +function o$(t, e, r) { !t.transmit && e[r] === Rl || (e[r] = /* @__PURE__ */ function(n) { return function() { const s = t.timestamp(), o = new Array(arguments.length), a = Object.getPrototypeOf && Object.getPrototypeOf(this) === Tl ? Tl : this; for (var u = 0; u < o.length; u++) o[u] = arguments[u]; - if (t.serialize && !t.asObject && J0(o, this._serialize, this.serializers, this._stdErrSerialize), t.asObject ? n.call(a, o$(this, r, o, s)) : n.apply(a, o), t.transmit) { + if (t.serialize && !t.asObject && J0(o, this._serialize, this.serializers, this._stdErrSerialize), t.asObject ? n.call(a, a$(this, r, o, s)) : n.apply(a, o), t.transmit) { const l = t.transmit.level || e.level, d = Uo.levels.values[l], p = Uo.levels.values[r]; if (p < d) return; - a$(this, { + c$(this, { ts: s, methodLevel: r, methodValue: p, @@ -6617,7 +6625,7 @@ function s$(t, e, r) { }; }(e[r])); } -function o$(t, e, r, n) { +function a$(t, e, r, n) { t._serialize && J0(r, t._serialize, t.serializers, t._stdErrSerialize); const i = r.slice(); let s = i[0]; @@ -6648,7 +6656,7 @@ function tu(t, e, r) { return t[r].apply(this, n); }; } -function a$(t, e, r) { +function c$(t, e, r) { const n = e.send, i = e.ts, s = e.methodLevel, o = e.methodValue, a = e.val, u = t._logEvent.bindings; J0( r, @@ -6667,7 +6675,7 @@ function I1(t) { level: { label: "", value: 0 } }; } -function c$(t) { +function u$(t) { const e = { type: t.constructor.name, msg: t.message, @@ -6677,7 +6685,7 @@ function c$(t) { e[r] === void 0 && (e[r] = t[r]); return e; } -function u$(t) { +function f$(t) { return typeof t.timestamp == "function" ? t.timestamp : t.timestamp === !1 ? X4 : Z4; } function yd() { @@ -6694,13 +6702,13 @@ function X4() { function Z4() { return Date.now(); } -function f$() { +function l$() { return Math.round(Date.now() / 1e3); } -function l$() { +function h$() { return new Date(Date.now()).toISOString(); } -function h$() { +function d$() { function t(e) { return typeof e < "u" && e; } @@ -6715,8 +6723,8 @@ function h$() { return t(self) || t(window) || t(this) || {}; } } -const Xl = /* @__PURE__ */ ns(ou), d$ = { level: "info" }, Zl = "custom_context", Zv = 1e3 * 1024; -let p$ = class { +const Xl = /* @__PURE__ */ ns(ou), p$ = { level: "info" }, Zl = "custom_context", Zv = 1e3 * 1024; +let g$ = class { constructor(e) { this.nodeValue = e, this.sizeInBytes = new TextEncoder().encode(this.nodeValue).length, this.next = null; } @@ -6731,7 +6739,7 @@ let p$ = class { this.head = null, this.tail = null, this.lengthInNodes = 0, this.maxSizeInBytes = e, this.sizeInBytes = 0; } append(e) { - const r = new p$(e); + const r = new g$(e); if (r.size > this.maxSizeInBytes) throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`); for (; this.size + r.size > this.maxSizeInBytes; ) this.shift(); this.head ? (this.tail && (this.tail.next = r), this.tail = r) : (this.head = r, this.tail = r), this.lengthInNodes++, this.sizeInBytes += r.size; @@ -6789,7 +6797,7 @@ let p$ = class { const r = this.getLogArray(); return r.push(jo({ extraMetadata: e })), new Blob(r, { type: "application/json" }); } -}, g$ = class { +}, m$ = class { constructor(e, r = Zv) { this.baseChunkLogger = new Q4(e, r); } @@ -6812,7 +6820,7 @@ let p$ = class { const r = URL.createObjectURL(this.logsToBlob(e)), n = document.createElement("a"); n.href = r, n.download = `walletconnect-logs-${(/* @__PURE__ */ new Date()).toISOString()}.txt`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(r); } -}, m$ = class { +}, v$ = class { constructor(e, r = Zv) { this.baseChunkLogger = new Q4(e, r); } @@ -6832,94 +6840,94 @@ let p$ = class { return this.baseChunkLogger.logsToBlob(e); } }; -var v$ = Object.defineProperty, b$ = Object.defineProperties, y$ = Object.getOwnPropertyDescriptors, px = Object.getOwnPropertySymbols, w$ = Object.prototype.hasOwnProperty, x$ = Object.prototype.propertyIsEnumerable, gx = (t, e, r) => e in t ? v$(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, c0 = (t, e) => { - for (var r in e || (e = {})) w$.call(e, r) && gx(t, r, e[r]); - if (px) for (var r of px(e)) x$.call(e, r) && gx(t, r, e[r]); +var b$ = Object.defineProperty, y$ = Object.defineProperties, w$ = Object.getOwnPropertyDescriptors, px = Object.getOwnPropertySymbols, x$ = Object.prototype.hasOwnProperty, _$ = Object.prototype.propertyIsEnumerable, gx = (t, e, r) => e in t ? b$(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, c0 = (t, e) => { + for (var r in e || (e = {})) x$.call(e, r) && gx(t, r, e[r]); + if (px) for (var r of px(e)) _$.call(e, r) && gx(t, r, e[r]); return t; -}, u0 = (t, e) => b$(t, y$(e)); +}, u0 = (t, e) => y$(t, w$(e)); function X0(t) { - return u0(c0({}, t), { level: (t == null ? void 0 : t.level) || d$.level }); + return u0(c0({}, t), { level: (t == null ? void 0 : t.level) || p$.level }); } -function _$(t, e = Zl) { +function E$(t, e = Zl) { return t[e] || ""; } -function E$(t, e, r = Zl) { +function S$(t, e, r = Zl) { return t[r] = e, t; } function Pi(t, e = Zl) { let r = ""; - return typeof t.bindings > "u" ? r = _$(t, e) : r = t.bindings().context || "", r; + return typeof t.bindings > "u" ? r = E$(t, e) : r = t.bindings().context || "", r; } -function S$(t, e, r = Zl) { +function A$(t, e, r = Zl) { const n = Pi(t, r); return n.trim() ? `${n}/${e}` : e; } function ui(t, e, r = Zl) { - const n = S$(t, e, r), i = t.child({ context: n }); - return E$(i, n, r); + const n = A$(t, e, r), i = t.child({ context: n }); + return S$(i, n, r); } -function A$(t) { +function P$(t) { var e, r; - const n = new g$((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); + const n = new m$((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); return { logger: Xl(u0(c0({}, t.opts), { level: "trace", browser: u0(c0({}, (r = t.opts) == null ? void 0 : r.browser), { write: (i) => n.write(i) }) })), chunkLoggerController: n }; } -function P$(t) { +function M$(t) { var e; - const r = new m$((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); + const r = new v$((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); return { logger: Xl(u0(c0({}, t.opts), { level: "trace" }), r), chunkLoggerController: r }; } -function M$(t) { - return typeof t.loggerOverride < "u" && typeof t.loggerOverride != "string" ? { logger: t.loggerOverride, chunkLoggerController: null } : typeof window < "u" ? A$(t) : P$(t); +function I$(t) { + return typeof t.loggerOverride < "u" && typeof t.loggerOverride != "string" ? { logger: t.loggerOverride, chunkLoggerController: null } : typeof window < "u" ? P$(t) : M$(t); } -let I$ = class extends Mc { +let C$ = class extends Mc { constructor(e) { super(), this.opts = e, this.protocol = "wc", this.version = 2; } -}, C$ = class extends Mc { +}, T$ = class extends Mc { constructor(e, r) { super(), this.core = e, this.logger = r, this.records = /* @__PURE__ */ new Map(); } -}, T$ = class { +}, R$ = class { constructor(e, r) { this.logger = e, this.core = r; } -}, R$ = class extends Mc { +}, D$ = class extends Mc { constructor(e, r) { super(), this.relayer = e, this.logger = r; } -}, D$ = class extends Mc { +}, O$ = class extends Mc { constructor(e) { super(); } -}, O$ = class { +}, N$ = class { constructor(e, r, n, i) { this.core = e, this.logger = r, this.name = n; } -}, N$ = class extends Mc { +}, L$ = class extends Mc { constructor(e, r) { super(), this.relayer = e, this.logger = r; } -}, L$ = class extends Mc { +}, k$ = class extends Mc { constructor(e, r) { super(), this.core = e, this.logger = r; } -}, k$ = class { +}, $$ = class { constructor(e, r, n) { this.core = e, this.logger = r, this.store = n; } -}, $$ = class { +}, B$ = class { constructor(e, r) { this.projectId = e, this.logger = r; } -}, B$ = class { +}, F$ = class { constructor(e, r, n) { this.core = e, this.logger = r, this.telemetryEnabled = n; } -}, F$ = class { +}, j$ = class { constructor(e) { this.opts = e, this.protocol = "wc", this.version = 2; } -}, j$ = class { +}, U$ = class { constructor(e) { this.client = e; } @@ -6928,7 +6936,7 @@ var Qv = {}, Da = {}, Z0 = {}, Q0 = {}; Object.defineProperty(Q0, "__esModule", { value: !0 }); Q0.BrowserRandomSource = void 0; const mx = 65536; -class U$ { +class q$ { constructor() { this.isAvailable = !1, this.isInstantiated = !1; const e = typeof self < "u" ? self.crypto || self.msCrypto : null; @@ -6943,26 +6951,26 @@ class U$ { return r; } } -Q0.BrowserRandomSource = U$; +Q0.BrowserRandomSource = q$; function e8(t) { throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } var ep = {}, Bi = {}; Object.defineProperty(Bi, "__esModule", { value: !0 }); -function q$(t) { +function z$(t) { for (var e = 0; e < t.length; e++) t[e] = 0; return t; } -Bi.wipe = q$; -const z$ = {}, W$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +Bi.wipe = z$; +const W$ = {}, H$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - default: z$ -}, Symbol.toStringTag, { value: "Module" })), Ql = /* @__PURE__ */ Lv(W$); + default: W$ +}, Symbol.toStringTag, { value: "Module" })), Ql = /* @__PURE__ */ Lv(H$); Object.defineProperty(ep, "__esModule", { value: !0 }); ep.NodeRandomSource = void 0; -const H$ = Bi; -class K$ { +const K$ = Bi; +class V$ { constructor() { if (this.isAvailable = !1, this.isInstantiated = !1, typeof e8 < "u") { const e = Ql; @@ -6978,20 +6986,20 @@ class K$ { const n = new Uint8Array(e); for (let i = 0; i < n.length; i++) n[i] = r[i]; - return (0, H$.wipe)(r), n; + return (0, K$.wipe)(r), n; } } -ep.NodeRandomSource = K$; +ep.NodeRandomSource = V$; Object.defineProperty(Z0, "__esModule", { value: !0 }); Z0.SystemRandomSource = void 0; -const V$ = Q0, G$ = ep; -class Y$ { +const G$ = Q0, Y$ = ep; +class J$ { constructor() { - if (this.isAvailable = !1, this.name = "", this._source = new V$.BrowserRandomSource(), this._source.isAvailable) { + if (this.isAvailable = !1, this.name = "", this._source = new G$.BrowserRandomSource(), this._source.isAvailable) { this.isAvailable = !0, this.name = "Browser"; return; } - if (this._source = new G$.NodeRandomSource(), this._source.isAvailable) { + if (this._source = new Y$.NodeRandomSource(), this._source.isAvailable) { this.isAvailable = !0, this.name = "Node"; return; } @@ -7002,7 +7010,7 @@ class Y$ { return this._source.randomBytes(e); } } -Z0.SystemRandomSource = Y$; +Z0.SystemRandomSource = J$; var ar = {}, t8 = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); @@ -7036,22 +7044,22 @@ var ar = {}, t8 = {}; })(t8); Object.defineProperty(ar, "__esModule", { value: !0 }); var r8 = t8; -function J$(t, e) { +function X$(t, e) { return e === void 0 && (e = 0), (t[e + 0] << 8 | t[e + 1]) << 16 >> 16; } -ar.readInt16BE = J$; -function X$(t, e) { +ar.readInt16BE = X$; +function Z$(t, e) { return e === void 0 && (e = 0), (t[e + 0] << 8 | t[e + 1]) >>> 0; } -ar.readUint16BE = X$; -function Z$(t, e) { +ar.readUint16BE = Z$; +function Q$(t, e) { return e === void 0 && (e = 0), (t[e + 1] << 8 | t[e]) << 16 >> 16; } -ar.readInt16LE = Z$; -function Q$(t, e) { +ar.readInt16LE = Q$; +function eB(t, e) { return e === void 0 && (e = 0), (t[e + 1] << 8 | t[e]) >>> 0; } -ar.readUint16LE = Q$; +ar.readUint16LE = eB; function n8(t, e, r) { return e === void 0 && (e = new Uint8Array(2)), r === void 0 && (r = 0), e[r + 0] = t >>> 8, e[r + 1] = t >>> 0, e; } @@ -7088,30 +7096,30 @@ function l0(t, e, r) { } ar.writeUint32LE = l0; ar.writeInt32LE = l0; -function eB(t, e) { +function tB(t, e) { e === void 0 && (e = 0); var r = C1(t, e), n = C1(t, e + 4); return r * 4294967296 + n - (n >> 31) * 4294967296; } -ar.readInt64BE = eB; -function tB(t, e) { +ar.readInt64BE = tB; +function rB(t, e) { e === void 0 && (e = 0); var r = T1(t, e), n = T1(t, e + 4); return r * 4294967296 + n; } -ar.readUint64BE = tB; -function rB(t, e) { +ar.readUint64BE = rB; +function nB(t, e) { e === void 0 && (e = 0); var r = R1(t, e), n = R1(t, e + 4); return n * 4294967296 + r - (r >> 31) * 4294967296; } -ar.readInt64LE = rB; -function nB(t, e) { +ar.readInt64LE = nB; +function iB(t, e) { e === void 0 && (e = 0); var r = D1(t, e), n = D1(t, e + 4); return n * 4294967296 + r; } -ar.readUint64LE = nB; +ar.readUint64LE = iB; function s8(t, e, r) { return e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0), f0(t / 4294967296 >>> 0, e, r), f0(t >>> 0, e, r + 4), e; } @@ -7122,7 +7130,7 @@ function o8(t, e, r) { } ar.writeUint64LE = o8; ar.writeInt64LE = o8; -function iB(t, e, r) { +function sB(t, e, r) { if (r === void 0 && (r = 0), t % 8 !== 0) throw new Error("readUintBE supports only bitLengths divisible by 8"); if (t / 8 > e.length - r) @@ -7131,8 +7139,8 @@ function iB(t, e, r) { n += e[s] * i, i *= 256; return n; } -ar.readUintBE = iB; -function sB(t, e, r) { +ar.readUintBE = sB; +function oB(t, e, r) { if (r === void 0 && (r = 0), t % 8 !== 0) throw new Error("readUintLE supports only bitLengths divisible by 8"); if (t / 8 > e.length - r) @@ -7141,8 +7149,8 @@ function sB(t, e, r) { n += e[s] * i, i *= 256; return n; } -ar.readUintLE = sB; -function oB(t, e, r, n) { +ar.readUintLE = oB; +function aB(t, e, r, n) { if (r === void 0 && (r = new Uint8Array(t / 8)), n === void 0 && (n = 0), t % 8 !== 0) throw new Error("writeUintBE supports only bitLengths divisible by 8"); if (!r8.isSafeInteger(e)) @@ -7151,8 +7159,8 @@ function oB(t, e, r, n) { r[s] = e / i & 255, i *= 256; return r; } -ar.writeUintBE = oB; -function aB(t, e, r, n) { +ar.writeUintBE = aB; +function cB(t, e, r, n) { if (r === void 0 && (r = new Uint8Array(t / 8)), n === void 0 && (n = 0), t % 8 !== 0) throw new Error("writeUintLE supports only bitLengths divisible by 8"); if (!r8.isSafeInteger(e)) @@ -7161,55 +7169,55 @@ function aB(t, e, r, n) { r[s] = e / i & 255, i *= 256; return r; } -ar.writeUintLE = aB; -function cB(t, e) { +ar.writeUintLE = cB; +function uB(t, e) { e === void 0 && (e = 0); var r = new DataView(t.buffer, t.byteOffset, t.byteLength); return r.getFloat32(e); } -ar.readFloat32BE = cB; -function uB(t, e) { +ar.readFloat32BE = uB; +function fB(t, e) { e === void 0 && (e = 0); var r = new DataView(t.buffer, t.byteOffset, t.byteLength); return r.getFloat32(e, !0); } -ar.readFloat32LE = uB; -function fB(t, e) { +ar.readFloat32LE = fB; +function lB(t, e) { e === void 0 && (e = 0); var r = new DataView(t.buffer, t.byteOffset, t.byteLength); return r.getFloat64(e); } -ar.readFloat64BE = fB; -function lB(t, e) { +ar.readFloat64BE = lB; +function hB(t, e) { e === void 0 && (e = 0); var r = new DataView(t.buffer, t.byteOffset, t.byteLength); return r.getFloat64(e, !0); } -ar.readFloat64LE = lB; -function hB(t, e, r) { +ar.readFloat64LE = hB; +function dB(t, e, r) { e === void 0 && (e = new Uint8Array(4)), r === void 0 && (r = 0); var n = new DataView(e.buffer, e.byteOffset, e.byteLength); return n.setFloat32(r, t), e; } -ar.writeFloat32BE = hB; -function dB(t, e, r) { +ar.writeFloat32BE = dB; +function pB(t, e, r) { e === void 0 && (e = new Uint8Array(4)), r === void 0 && (r = 0); var n = new DataView(e.buffer, e.byteOffset, e.byteLength); return n.setFloat32(r, t, !0), e; } -ar.writeFloat32LE = dB; -function pB(t, e, r) { +ar.writeFloat32LE = pB; +function gB(t, e, r) { e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0); var n = new DataView(e.buffer, e.byteOffset, e.byteLength); return n.setFloat64(r, t), e; } -ar.writeFloat64BE = pB; -function gB(t, e, r) { +ar.writeFloat64BE = gB; +function mB(t, e, r) { e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0); var n = new DataView(e.buffer, e.byteOffset, e.byteLength); return n.setFloat64(r, t, !0), e; } -ar.writeFloat64LE = gB; +ar.writeFloat64LE = mB; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.randomStringForEntropy = t.randomString = t.randomUint32 = t.randomBytes = t.defaultRandomSource = void 0; const e = Z0, r = ar, n = Bi; @@ -7472,18 +7480,18 @@ var a8 = {}; 1246189591 ]); function s(a, u, l, d, p, w, _) { - for (var P = l[0], O = l[1], L = l[2], B = l[3], k = l[4], q = l[5], U = l[6], V = l[7], Q = d[0], R = d[1], K = d[2], ge = d[3], Ee = d[4], Y = d[5], A = d[6], m = d[7], f, g, b, x, E, S, v, M; _ >= 128; ) { + for (var P = l[0], O = l[1], L = l[2], B = l[3], k = l[4], W = l[5], U = l[6], V = l[7], Q = d[0], R = d[1], K = d[2], ge = d[3], Ee = d[4], Y = d[5], A = d[6], m = d[7], f, g, b, x, E, S, v, M; _ >= 128; ) { for (var I = 0; I < 16; I++) { var F = 8 * I + w; a[I] = e.readUint32BE(p, F), u[I] = e.readUint32BE(p, F + 4); } for (var I = 0; I < 80; I++) { - var ce = P, D = O, oe = L, Z = B, J = k, ee = q, T = U, X = V, re = Q, pe = R, ie = K, ue = ge, ve = Ee, Pe = Y, De = A, Ce = m; - if (f = V, g = m, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = (k >>> 14 | Ee << 18) ^ (k >>> 18 | Ee << 14) ^ (Ee >>> 9 | k << 23), g = (Ee >>> 14 | k << 18) ^ (Ee >>> 18 | k << 14) ^ (k >>> 9 | Ee << 23), E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, f = k & q ^ ~k & U, g = Ee & Y ^ ~Ee & A, E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, f = i[I * 2], g = i[I * 2 + 1], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, f = a[I % 16], g = u[I % 16], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, b = v & 65535 | M << 16, x = E & 65535 | S << 16, f = b, g = x, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = (P >>> 28 | Q << 4) ^ (Q >>> 2 | P << 30) ^ (Q >>> 7 | P << 25), g = (Q >>> 28 | P << 4) ^ (P >>> 2 | Q << 30) ^ (P >>> 7 | Q << 25), E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, f = P & O ^ P & L ^ O & L, g = Q & R ^ Q & K ^ R & K, E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, X = v & 65535 | M << 16, Ce = E & 65535 | S << 16, f = Z, g = ue, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = b, g = x, E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, Z = v & 65535 | M << 16, ue = E & 65535 | S << 16, O = ce, L = D, B = oe, k = Z, q = J, U = ee, V = T, P = X, R = re, K = pe, ge = ie, Ee = ue, Y = ve, A = Pe, m = De, Q = Ce, I % 16 === 15) + var ce = P, D = O, oe = L, Z = B, J = k, ee = W, T = U, X = V, re = Q, pe = R, ie = K, ue = ge, ve = Ee, Pe = Y, De = A, Ce = m; + if (f = V, g = m, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = (k >>> 14 | Ee << 18) ^ (k >>> 18 | Ee << 14) ^ (Ee >>> 9 | k << 23), g = (Ee >>> 14 | k << 18) ^ (Ee >>> 18 | k << 14) ^ (k >>> 9 | Ee << 23), E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, f = k & W ^ ~k & U, g = Ee & Y ^ ~Ee & A, E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, f = i[I * 2], g = i[I * 2 + 1], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, f = a[I % 16], g = u[I % 16], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, b = v & 65535 | M << 16, x = E & 65535 | S << 16, f = b, g = x, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = (P >>> 28 | Q << 4) ^ (Q >>> 2 | P << 30) ^ (Q >>> 7 | P << 25), g = (Q >>> 28 | P << 4) ^ (P >>> 2 | Q << 30) ^ (P >>> 7 | Q << 25), E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, f = P & O ^ P & L ^ O & L, g = Q & R ^ Q & K ^ R & K, E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, X = v & 65535 | M << 16, Ce = E & 65535 | S << 16, f = Z, g = ue, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = b, g = x, E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, Z = v & 65535 | M << 16, ue = E & 65535 | S << 16, O = ce, L = D, B = oe, k = Z, W = J, U = ee, V = T, P = X, R = re, K = pe, ge = ie, Ee = ue, Y = ve, A = Pe, m = De, Q = Ce, I % 16 === 15) for (var F = 0; F < 16; F++) f = a[F], g = u[F], E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = a[(F + 9) % 16], g = u[(F + 9) % 16], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, b = a[(F + 1) % 16], x = u[(F + 1) % 16], f = (b >>> 1 | x << 31) ^ (b >>> 8 | x << 24) ^ b >>> 7, g = (x >>> 1 | b << 31) ^ (x >>> 8 | b << 24) ^ (x >>> 7 | b << 25), E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, b = a[(F + 14) % 16], x = u[(F + 14) % 16], f = (b >>> 19 | x << 13) ^ (x >>> 29 | b << 3) ^ b >>> 6, g = (x >>> 19 | b << 13) ^ (b >>> 29 | x << 3) ^ (x >>> 6 | b << 26), E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, a[F] = v & 65535 | M << 16, u[F] = E & 65535 | S << 16; } - f = P, g = Q, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[0], g = d[0], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[0] = P = v & 65535 | M << 16, d[0] = Q = E & 65535 | S << 16, f = O, g = R, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[1], g = d[1], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[1] = O = v & 65535 | M << 16, d[1] = R = E & 65535 | S << 16, f = L, g = K, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[2], g = d[2], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[2] = L = v & 65535 | M << 16, d[2] = K = E & 65535 | S << 16, f = B, g = ge, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[3], g = d[3], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[3] = B = v & 65535 | M << 16, d[3] = ge = E & 65535 | S << 16, f = k, g = Ee, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[4], g = d[4], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[4] = k = v & 65535 | M << 16, d[4] = Ee = E & 65535 | S << 16, f = q, g = Y, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[5], g = d[5], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[5] = q = v & 65535 | M << 16, d[5] = Y = E & 65535 | S << 16, f = U, g = A, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[6], g = d[6], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[6] = U = v & 65535 | M << 16, d[6] = A = E & 65535 | S << 16, f = V, g = m, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[7], g = d[7], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[7] = V = v & 65535 | M << 16, d[7] = m = E & 65535 | S << 16, w += 128, _ -= 128; + f = P, g = Q, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[0], g = d[0], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[0] = P = v & 65535 | M << 16, d[0] = Q = E & 65535 | S << 16, f = O, g = R, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[1], g = d[1], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[1] = O = v & 65535 | M << 16, d[1] = R = E & 65535 | S << 16, f = L, g = K, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[2], g = d[2], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[2] = L = v & 65535 | M << 16, d[2] = K = E & 65535 | S << 16, f = B, g = ge, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[3], g = d[3], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[3] = B = v & 65535 | M << 16, d[3] = ge = E & 65535 | S << 16, f = k, g = Ee, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[4], g = d[4], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[4] = k = v & 65535 | M << 16, d[4] = Ee = E & 65535 | S << 16, f = W, g = Y, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[5], g = d[5], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[5] = W = v & 65535 | M << 16, d[5] = Y = E & 65535 | S << 16, f = U, g = A, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[6], g = d[6], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[6] = U = v & 65535 | M << 16, d[6] = A = E & 65535 | S << 16, f = V, g = m, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[7], g = d[7], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[7] = V = v & 65535 | M << 16, d[7] = m = E & 65535 | S << 16, w += 128, _ -= 128; } return w; } @@ -7639,7 +7647,7 @@ var a8 = {}; const ee = new Uint8Array(32), T = new Uint8Array(32); return L(ee, Z), L(T, J), B(ee, T); } - function q(Z) { + function W(Z) { const J = new Uint8Array(32); return L(J, Z), J[0] & 1; } @@ -7657,8 +7665,8 @@ var a8 = {}; Z[T] = J[T] - ee[T]; } function R(Z, J, ee) { - let T, X, re = 0, pe = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = 0, Me = 0, Ne = 0, Ke = 0, Le = 0, qe = 0, ze = 0, _e = 0, Ze = 0, at = 0, ke = 0, Qe = 0, tt = 0, Ye = 0, dt = 0, lt = 0, ct = 0, qt = 0, Jt = 0, Et = 0, er = 0, Xt = 0, Dt = 0, kt = ee[0], Ct = ee[1], mt = ee[2], Rt = ee[3], Nt = ee[4], bt = ee[5], $t = ee[6], Ft = ee[7], rt = ee[8], Bt = ee[9], $ = ee[10], z = ee[11], H = ee[12], C = ee[13], G = ee[14], j = ee[15]; - T = J[0], re += T * kt, pe += T * Ct, ie += T * mt, ue += T * Rt, ve += T * Nt, Pe += T * bt, De += T * $t, Ce += T * Ft, $e += T * rt, Me += T * Bt, Ne += T * $, Ke += T * z, Le += T * H, qe += T * C, ze += T * G, _e += T * j, T = J[1], pe += T * kt, ie += T * Ct, ue += T * mt, ve += T * Rt, Pe += T * Nt, De += T * bt, Ce += T * $t, $e += T * Ft, Me += T * rt, Ne += T * Bt, Ke += T * $, Le += T * z, qe += T * H, ze += T * C, _e += T * G, Ze += T * j, T = J[2], ie += T * kt, ue += T * Ct, ve += T * mt, Pe += T * Rt, De += T * Nt, Ce += T * bt, $e += T * $t, Me += T * Ft, Ne += T * rt, Ke += T * Bt, Le += T * $, qe += T * z, ze += T * H, _e += T * C, Ze += T * G, at += T * j, T = J[3], ue += T * kt, ve += T * Ct, Pe += T * mt, De += T * Rt, Ce += T * Nt, $e += T * bt, Me += T * $t, Ne += T * Ft, Ke += T * rt, Le += T * Bt, qe += T * $, ze += T * z, _e += T * H, Ze += T * C, at += T * G, ke += T * j, T = J[4], ve += T * kt, Pe += T * Ct, De += T * mt, Ce += T * Rt, $e += T * Nt, Me += T * bt, Ne += T * $t, Ke += T * Ft, Le += T * rt, qe += T * Bt, ze += T * $, _e += T * z, Ze += T * H, at += T * C, ke += T * G, Qe += T * j, T = J[5], Pe += T * kt, De += T * Ct, Ce += T * mt, $e += T * Rt, Me += T * Nt, Ne += T * bt, Ke += T * $t, Le += T * Ft, qe += T * rt, ze += T * Bt, _e += T * $, Ze += T * z, at += T * H, ke += T * C, Qe += T * G, tt += T * j, T = J[6], De += T * kt, Ce += T * Ct, $e += T * mt, Me += T * Rt, Ne += T * Nt, Ke += T * bt, Le += T * $t, qe += T * Ft, ze += T * rt, _e += T * Bt, Ze += T * $, at += T * z, ke += T * H, Qe += T * C, tt += T * G, Ye += T * j, T = J[7], Ce += T * kt, $e += T * Ct, Me += T * mt, Ne += T * Rt, Ke += T * Nt, Le += T * bt, qe += T * $t, ze += T * Ft, _e += T * rt, Ze += T * Bt, at += T * $, ke += T * z, Qe += T * H, tt += T * C, Ye += T * G, dt += T * j, T = J[8], $e += T * kt, Me += T * Ct, Ne += T * mt, Ke += T * Rt, Le += T * Nt, qe += T * bt, ze += T * $t, _e += T * Ft, Ze += T * rt, at += T * Bt, ke += T * $, Qe += T * z, tt += T * H, Ye += T * C, dt += T * G, lt += T * j, T = J[9], Me += T * kt, Ne += T * Ct, Ke += T * mt, Le += T * Rt, qe += T * Nt, ze += T * bt, _e += T * $t, Ze += T * Ft, at += T * rt, ke += T * Bt, Qe += T * $, tt += T * z, Ye += T * H, dt += T * C, lt += T * G, ct += T * j, T = J[10], Ne += T * kt, Ke += T * Ct, Le += T * mt, qe += T * Rt, ze += T * Nt, _e += T * bt, Ze += T * $t, at += T * Ft, ke += T * rt, Qe += T * Bt, tt += T * $, Ye += T * z, dt += T * H, lt += T * C, ct += T * G, qt += T * j, T = J[11], Ke += T * kt, Le += T * Ct, qe += T * mt, ze += T * Rt, _e += T * Nt, Ze += T * bt, at += T * $t, ke += T * Ft, Qe += T * rt, tt += T * Bt, Ye += T * $, dt += T * z, lt += T * H, ct += T * C, qt += T * G, Jt += T * j, T = J[12], Le += T * kt, qe += T * Ct, ze += T * mt, _e += T * Rt, Ze += T * Nt, at += T * bt, ke += T * $t, Qe += T * Ft, tt += T * rt, Ye += T * Bt, dt += T * $, lt += T * z, ct += T * H, qt += T * C, Jt += T * G, Et += T * j, T = J[13], qe += T * kt, ze += T * Ct, _e += T * mt, Ze += T * Rt, at += T * Nt, ke += T * bt, Qe += T * $t, tt += T * Ft, Ye += T * rt, dt += T * Bt, lt += T * $, ct += T * z, qt += T * H, Jt += T * C, Et += T * G, er += T * j, T = J[14], ze += T * kt, _e += T * Ct, Ze += T * mt, at += T * Rt, ke += T * Nt, Qe += T * bt, tt += T * $t, Ye += T * Ft, dt += T * rt, lt += T * Bt, ct += T * $, qt += T * z, Jt += T * H, Et += T * C, er += T * G, Xt += T * j, T = J[15], _e += T * kt, Ze += T * Ct, at += T * mt, ke += T * Rt, Qe += T * Nt, tt += T * bt, Ye += T * $t, dt += T * Ft, lt += T * rt, ct += T * Bt, qt += T * $, Jt += T * z, Et += T * H, er += T * C, Xt += T * G, Dt += T * j, re += 38 * Ze, pe += 38 * at, ie += 38 * ke, ue += 38 * Qe, ve += 38 * tt, Pe += 38 * Ye, De += 38 * dt, Ce += 38 * lt, $e += 38 * ct, Me += 38 * qt, Ne += 38 * Jt, Ke += 38 * Et, Le += 38 * er, qe += 38 * Xt, ze += 38 * Dt, X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = pe + X + 65535, X = Math.floor(T / 65536), pe = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = pe + X + 65535, X = Math.floor(T / 65536), pe = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), Z[0] = re, Z[1] = pe, Z[2] = ie, Z[3] = ue, Z[4] = ve, Z[5] = Pe, Z[6] = De, Z[7] = Ce, Z[8] = $e, Z[9] = Me, Z[10] = Ne, Z[11] = Ke, Z[12] = Le, Z[13] = qe, Z[14] = ze, Z[15] = _e; + let T, X, re = 0, pe = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = 0, Me = 0, Ne = 0, Ke = 0, Le = 0, qe = 0, ze = 0, _e = 0, Ze = 0, at = 0, ke = 0, Qe = 0, tt = 0, Ye = 0, dt = 0, lt = 0, ct = 0, qt = 0, Jt = 0, Et = 0, er = 0, Xt = 0, Dt = 0, kt = ee[0], Ct = ee[1], mt = ee[2], Rt = ee[3], Nt = ee[4], bt = ee[5], $t = ee[6], Ft = ee[7], rt = ee[8], Bt = ee[9], $ = ee[10], q = ee[11], H = ee[12], C = ee[13], G = ee[14], j = ee[15]; + T = J[0], re += T * kt, pe += T * Ct, ie += T * mt, ue += T * Rt, ve += T * Nt, Pe += T * bt, De += T * $t, Ce += T * Ft, $e += T * rt, Me += T * Bt, Ne += T * $, Ke += T * q, Le += T * H, qe += T * C, ze += T * G, _e += T * j, T = J[1], pe += T * kt, ie += T * Ct, ue += T * mt, ve += T * Rt, Pe += T * Nt, De += T * bt, Ce += T * $t, $e += T * Ft, Me += T * rt, Ne += T * Bt, Ke += T * $, Le += T * q, qe += T * H, ze += T * C, _e += T * G, Ze += T * j, T = J[2], ie += T * kt, ue += T * Ct, ve += T * mt, Pe += T * Rt, De += T * Nt, Ce += T * bt, $e += T * $t, Me += T * Ft, Ne += T * rt, Ke += T * Bt, Le += T * $, qe += T * q, ze += T * H, _e += T * C, Ze += T * G, at += T * j, T = J[3], ue += T * kt, ve += T * Ct, Pe += T * mt, De += T * Rt, Ce += T * Nt, $e += T * bt, Me += T * $t, Ne += T * Ft, Ke += T * rt, Le += T * Bt, qe += T * $, ze += T * q, _e += T * H, Ze += T * C, at += T * G, ke += T * j, T = J[4], ve += T * kt, Pe += T * Ct, De += T * mt, Ce += T * Rt, $e += T * Nt, Me += T * bt, Ne += T * $t, Ke += T * Ft, Le += T * rt, qe += T * Bt, ze += T * $, _e += T * q, Ze += T * H, at += T * C, ke += T * G, Qe += T * j, T = J[5], Pe += T * kt, De += T * Ct, Ce += T * mt, $e += T * Rt, Me += T * Nt, Ne += T * bt, Ke += T * $t, Le += T * Ft, qe += T * rt, ze += T * Bt, _e += T * $, Ze += T * q, at += T * H, ke += T * C, Qe += T * G, tt += T * j, T = J[6], De += T * kt, Ce += T * Ct, $e += T * mt, Me += T * Rt, Ne += T * Nt, Ke += T * bt, Le += T * $t, qe += T * Ft, ze += T * rt, _e += T * Bt, Ze += T * $, at += T * q, ke += T * H, Qe += T * C, tt += T * G, Ye += T * j, T = J[7], Ce += T * kt, $e += T * Ct, Me += T * mt, Ne += T * Rt, Ke += T * Nt, Le += T * bt, qe += T * $t, ze += T * Ft, _e += T * rt, Ze += T * Bt, at += T * $, ke += T * q, Qe += T * H, tt += T * C, Ye += T * G, dt += T * j, T = J[8], $e += T * kt, Me += T * Ct, Ne += T * mt, Ke += T * Rt, Le += T * Nt, qe += T * bt, ze += T * $t, _e += T * Ft, Ze += T * rt, at += T * Bt, ke += T * $, Qe += T * q, tt += T * H, Ye += T * C, dt += T * G, lt += T * j, T = J[9], Me += T * kt, Ne += T * Ct, Ke += T * mt, Le += T * Rt, qe += T * Nt, ze += T * bt, _e += T * $t, Ze += T * Ft, at += T * rt, ke += T * Bt, Qe += T * $, tt += T * q, Ye += T * H, dt += T * C, lt += T * G, ct += T * j, T = J[10], Ne += T * kt, Ke += T * Ct, Le += T * mt, qe += T * Rt, ze += T * Nt, _e += T * bt, Ze += T * $t, at += T * Ft, ke += T * rt, Qe += T * Bt, tt += T * $, Ye += T * q, dt += T * H, lt += T * C, ct += T * G, qt += T * j, T = J[11], Ke += T * kt, Le += T * Ct, qe += T * mt, ze += T * Rt, _e += T * Nt, Ze += T * bt, at += T * $t, ke += T * Ft, Qe += T * rt, tt += T * Bt, Ye += T * $, dt += T * q, lt += T * H, ct += T * C, qt += T * G, Jt += T * j, T = J[12], Le += T * kt, qe += T * Ct, ze += T * mt, _e += T * Rt, Ze += T * Nt, at += T * bt, ke += T * $t, Qe += T * Ft, tt += T * rt, Ye += T * Bt, dt += T * $, lt += T * q, ct += T * H, qt += T * C, Jt += T * G, Et += T * j, T = J[13], qe += T * kt, ze += T * Ct, _e += T * mt, Ze += T * Rt, at += T * Nt, ke += T * bt, Qe += T * $t, tt += T * Ft, Ye += T * rt, dt += T * Bt, lt += T * $, ct += T * q, qt += T * H, Jt += T * C, Et += T * G, er += T * j, T = J[14], ze += T * kt, _e += T * Ct, Ze += T * mt, at += T * Rt, ke += T * Nt, Qe += T * bt, tt += T * $t, Ye += T * Ft, dt += T * rt, lt += T * Bt, ct += T * $, qt += T * q, Jt += T * H, Et += T * C, er += T * G, Xt += T * j, T = J[15], _e += T * kt, Ze += T * Ct, at += T * mt, ke += T * Rt, Qe += T * Nt, tt += T * bt, Ye += T * $t, dt += T * Ft, lt += T * rt, ct += T * Bt, qt += T * $, Jt += T * q, Et += T * H, er += T * C, Xt += T * G, Dt += T * j, re += 38 * Ze, pe += 38 * at, ie += 38 * ke, ue += 38 * Qe, ve += 38 * tt, Pe += 38 * Ye, De += 38 * dt, Ce += 38 * lt, $e += 38 * ct, Me += 38 * qt, Ne += 38 * Jt, Ke += 38 * Et, Le += 38 * er, qe += 38 * Xt, ze += 38 * Dt, X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = pe + X + 65535, X = Math.floor(T / 65536), pe = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = pe + X + 65535, X = Math.floor(T / 65536), pe = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), Z[0] = re, Z[1] = pe, Z[2] = ie, Z[3] = ue, Z[4] = ve, Z[5] = Pe, Z[6] = De, Z[7] = Ce, Z[8] = $e, Z[9] = Me, Z[10] = Ne, Z[11] = Ke, Z[12] = Le, Z[13] = qe, Z[14] = ze, Z[15] = _e; } function K(Z, J) { R(Z, J, J); @@ -7693,7 +7701,7 @@ var a8 = {}; } function m(Z, J) { const ee = i(), T = i(), X = i(); - ge(X, J[2]), R(ee, J[0], X), R(T, J[1], X), L(Z, T), Z[31] ^= q(ee) << 7; + ge(X, J[2]), R(ee, J[0], X), R(T, J[1], X), L(Z, T), Z[31] ^= W(ee) << 7; } function f(Z, J, ee) { _(Z[0], o), _(Z[1], a), _(Z[2], a), _(Z[3], o); @@ -7808,7 +7816,7 @@ var a8 = {}; t.sign = I; function F(Z, J) { const ee = i(), T = i(), X = i(), re = i(), pe = i(), ie = i(), ue = i(); - return _(Z[2], a), U(Z[1], J), K(X, Z[1]), R(re, X, u), Q(X, X, Z[2]), V(re, Z[2], re), K(pe, re), K(ie, pe), R(ue, ie, pe), R(ee, ue, X), R(ee, ee, re), Ee(ee, ee), R(ee, ee, X), R(ee, ee, re), R(ee, ee, re), R(Z[0], ee, re), K(T, Z[0]), R(T, T, re), k(T, X) && R(Z[0], Z[0], w), K(T, Z[0]), R(T, T, re), k(T, X) ? -1 : (q(Z[0]) === J[31] >> 7 && Q(Z[0], o, Z[0]), R(Z[3], Z[0], Z[1]), 0); + return _(Z[2], a), U(Z[1], J), K(X, Z[1]), R(re, X, u), Q(X, X, Z[2]), V(re, Z[2], re), K(pe, re), K(ie, pe), R(ue, ie, pe), R(ee, ue, X), R(ee, ee, re), Ee(ee, ee), R(ee, ee, X), R(ee, ee, re), R(ee, ee, re), R(Z[0], ee, re), K(T, Z[0]), R(T, T, re), k(T, X) && R(Z[0], Z[0], w), K(T, Z[0]), R(T, T, re), k(T, X) ? -1 : (W(Z[0]) === J[31] >> 7 && Q(Z[0], o, Z[0]), R(Z[3], Z[0], Z[1]), 0); } function ce(Z, J, ee) { const T = new Uint8Array(32), X = [i(), i(), i(), i()], re = [i(), i(), i(), i()]; @@ -7840,7 +7848,7 @@ var a8 = {}; } t.convertSecretKeyToX25519 = oe; })(Qv); -const mB = "EdDSA", vB = "JWT", h0 = ".", tp = "base64url", c8 = "utf8", u8 = "utf8", bB = ":", yB = "did", wB = "key", vx = "base58btc", xB = "z", _B = "K36", EB = 32; +const vB = "EdDSA", bB = "JWT", h0 = ".", tp = "base64url", c8 = "utf8", u8 = "utf8", yB = ":", wB = "did", xB = "key", vx = "base58btc", _B = "z", EB = "K36", SB = 32; function f8(t = 0) { return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); } @@ -7852,7 +7860,7 @@ function kd(t, e) { r.set(i, n), n += i.length; return r; } -function SB(t, e) { +function AB(t, e) { if (t.length >= 255) throw new TypeError("Alphabet too long"); for (var r = new Uint8Array(256), n = 0; n < r.length; n++) @@ -7871,16 +7879,16 @@ function SB(t, e) { return ""; for (var O = 0, L = 0, B = 0, k = P.length; B !== k && P[B] === 0; ) B++, O++; - for (var q = (k - B) * d + 1 >>> 0, U = new Uint8Array(q); B !== k; ) { - for (var V = P[B], Q = 0, R = q - 1; (V !== 0 || Q < L) && R !== -1; R--, Q++) + for (var W = (k - B) * d + 1 >>> 0, U = new Uint8Array(W); B !== k; ) { + for (var V = P[B], Q = 0, R = W - 1; (V !== 0 || Q < L) && R !== -1; R--, Q++) V += 256 * U[R] >>> 0, U[R] = V % a >>> 0, V = V / a >>> 0; if (V !== 0) throw new Error("Non-zero carry"); L = Q, B++; } - for (var K = q - L; K !== q && U[K] === 0; ) + for (var K = W - L; K !== W && U[K] === 0; ) K++; - for (var ge = u.repeat(O); K < q; ++K) + for (var ge = u.repeat(O); K < W; ++K) ge += t.charAt(U[K]); return ge; } @@ -7893,21 +7901,21 @@ function SB(t, e) { if (P[O] !== " ") { for (var L = 0, B = 0; P[O] === u; ) L++, O++; - for (var k = (P.length - O) * l + 1 >>> 0, q = new Uint8Array(k); P[O]; ) { + for (var k = (P.length - O) * l + 1 >>> 0, W = new Uint8Array(k); P[O]; ) { var U = r[P.charCodeAt(O)]; if (U === 255) return; for (var V = 0, Q = k - 1; (U !== 0 || V < B) && Q !== -1; Q--, V++) - U += a * q[Q] >>> 0, q[Q] = U % 256 >>> 0, U = U / 256 >>> 0; + U += a * W[Q] >>> 0, W[Q] = U % 256 >>> 0, U = U / 256 >>> 0; if (U !== 0) throw new Error("Non-zero carry"); B = V, O++; } if (P[O] !== " ") { - for (var R = k - B; R !== k && q[R] === 0; ) + for (var R = k - B; R !== k && W[R] === 0; ) R++; for (var K = new Uint8Array(L + (k - R)), ge = L; R !== k; ) - K[ge++] = q[R++]; + K[ge++] = W[R++]; return K; } } @@ -7924,8 +7932,8 @@ function SB(t, e) { decode: _ }; } -var AB = SB, PB = AB; -const MB = (t) => { +var PB = AB, MB = PB; +const IB = (t) => { if (t instanceof Uint8Array && t.constructor.name === "Uint8Array") return t; if (t instanceof ArrayBuffer) @@ -7933,8 +7941,8 @@ const MB = (t) => { if (ArrayBuffer.isView(t)) return new Uint8Array(t.buffer, t.byteOffset, t.byteLength); throw new Error("Unknown type, must be binary type"); -}, IB = (t) => new TextEncoder().encode(t), CB = (t) => new TextDecoder().decode(t); -class TB { +}, CB = (t) => new TextEncoder().encode(t), TB = (t) => new TextDecoder().decode(t); +class RB { constructor(e, r, n) { this.name = e, this.prefix = r, this.baseEncode = n; } @@ -7944,7 +7952,7 @@ class TB { throw Error("Unknown type, must be binary type"); } } -class RB { +class DB { constructor(e, r, n) { if (this.name = e, this.prefix = r, r.codePointAt(0) === void 0) throw new Error("Invalid prefix character"); @@ -7962,7 +7970,7 @@ class RB { return l8(this, e); } } -class DB { +class OB { constructor(e) { this.decoders = e; } @@ -7976,13 +7984,13 @@ class DB { throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`); } } -const l8 = (t, e) => new DB({ +const l8 = (t, e) => new OB({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); -class OB { +class NB { constructor(e, r, n, i) { - this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new TB(e, r, n), this.decoder = new RB(e, r, i); + this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new RB(e, r, n), this.decoder = new DB(e, r, i); } encode(e) { return this.encoder.encode(e); @@ -7991,15 +7999,15 @@ class OB { return this.decoder.decode(e); } } -const rp = ({ name: t, prefix: e, encode: r, decode: n }) => new OB(t, e, r, n), eh = ({ prefix: t, name: e, alphabet: r }) => { - const { encode: n, decode: i } = PB(r, e); +const rp = ({ name: t, prefix: e, encode: r, decode: n }) => new NB(t, e, r, n), eh = ({ prefix: t, name: e, alphabet: r }) => { + const { encode: n, decode: i } = MB(r, e); return rp({ prefix: t, name: e, encode: n, - decode: (s) => MB(i(s)) + decode: (s) => IB(i(s)) }); -}, NB = (t, e, r, n) => { +}, LB = (t, e, r, n) => { const i = {}; for (let d = 0; d < e.length; ++d) i[e[d]] = d; @@ -8017,7 +8025,7 @@ const rp = ({ name: t, prefix: e, encode: r, decode: n }) => new OB(t, e, r, n), if (a >= r || 255 & u << 8 - a) throw new SyntaxError("Unexpected end of data"); return o; -}, LB = (t, e, r) => { +}, kB = (t, e, r) => { const n = e[e.length - 1] === "=", i = (1 << r) - 1; let s = "", o = 0, a = 0; for (let u = 0; u < t.length; ++u) @@ -8031,198 +8039,198 @@ const rp = ({ name: t, prefix: e, encode: r, decode: n }) => new OB(t, e, r, n), prefix: e, name: t, encode(i) { - return LB(i, n, r); + return kB(i, n, r); }, decode(i) { - return NB(i, n, r, t); + return LB(i, n, r, t); } -}), kB = rp({ +}), $B = rp({ prefix: "\0", name: "identity", - encode: (t) => CB(t), - decode: (t) => IB(t) -}), $B = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + encode: (t) => TB(t), + decode: (t) => CB(t) +}), BB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - identity: kB -}, Symbol.toStringTag, { value: "Module" })), BB = qn({ + identity: $B +}, Symbol.toStringTag, { value: "Module" })), FB = qn({ prefix: "0", name: "base2", alphabet: "01", bitsPerChar: 1 -}), FB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), jB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base2: BB -}, Symbol.toStringTag, { value: "Module" })), jB = qn({ + base2: FB +}, Symbol.toStringTag, { value: "Module" })), UB = qn({ prefix: "7", name: "base8", alphabet: "01234567", bitsPerChar: 3 -}), UB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), qB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base8: jB -}, Symbol.toStringTag, { value: "Module" })), qB = eh({ + base8: UB +}, Symbol.toStringTag, { value: "Module" })), zB = eh({ prefix: "9", name: "base10", alphabet: "0123456789" -}), zB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), WB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base10: qB -}, Symbol.toStringTag, { value: "Module" })), WB = qn({ + base10: zB +}, Symbol.toStringTag, { value: "Module" })), HB = qn({ prefix: "f", name: "base16", alphabet: "0123456789abcdef", bitsPerChar: 4 -}), HB = qn({ +}), KB = qn({ prefix: "F", name: "base16upper", alphabet: "0123456789ABCDEF", bitsPerChar: 4 -}), KB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), VB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base16: WB, - base16upper: HB -}, Symbol.toStringTag, { value: "Module" })), VB = qn({ + base16: HB, + base16upper: KB +}, Symbol.toStringTag, { value: "Module" })), GB = qn({ prefix: "b", name: "base32", alphabet: "abcdefghijklmnopqrstuvwxyz234567", bitsPerChar: 5 -}), GB = qn({ +}), YB = qn({ prefix: "B", name: "base32upper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", bitsPerChar: 5 -}), YB = qn({ +}), JB = qn({ prefix: "c", name: "base32pad", alphabet: "abcdefghijklmnopqrstuvwxyz234567=", bitsPerChar: 5 -}), JB = qn({ +}), XB = qn({ prefix: "C", name: "base32padupper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", bitsPerChar: 5 -}), XB = qn({ +}), ZB = qn({ prefix: "v", name: "base32hex", alphabet: "0123456789abcdefghijklmnopqrstuv", bitsPerChar: 5 -}), ZB = qn({ +}), QB = qn({ prefix: "V", name: "base32hexupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", bitsPerChar: 5 -}), QB = qn({ +}), eF = qn({ prefix: "t", name: "base32hexpad", alphabet: "0123456789abcdefghijklmnopqrstuv=", bitsPerChar: 5 -}), eF = qn({ +}), tF = qn({ prefix: "T", name: "base32hexpadupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=", bitsPerChar: 5 -}), tF = qn({ +}), rF = qn({ prefix: "h", name: "base32z", alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769", bitsPerChar: 5 -}), rF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), nF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base32: VB, - base32hex: XB, - base32hexpad: QB, - base32hexpadupper: eF, - base32hexupper: ZB, - base32pad: YB, - base32padupper: JB, - base32upper: GB, - base32z: tF -}, Symbol.toStringTag, { value: "Module" })), nF = eh({ + base32: GB, + base32hex: ZB, + base32hexpad: eF, + base32hexpadupper: tF, + base32hexupper: QB, + base32pad: JB, + base32padupper: XB, + base32upper: YB, + base32z: rF +}, Symbol.toStringTag, { value: "Module" })), iF = eh({ prefix: "k", name: "base36", alphabet: "0123456789abcdefghijklmnopqrstuvwxyz" -}), iF = eh({ +}), sF = eh({ prefix: "K", name: "base36upper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" -}), sF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), oF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base36: nF, - base36upper: iF -}, Symbol.toStringTag, { value: "Module" })), oF = eh({ + base36: iF, + base36upper: sF +}, Symbol.toStringTag, { value: "Module" })), aF = eh({ name: "base58btc", prefix: "z", alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" -}), aF = eh({ +}), cF = eh({ name: "base58flickr", prefix: "Z", alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" -}), cF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), uF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base58btc: oF, - base58flickr: aF -}, Symbol.toStringTag, { value: "Module" })), uF = qn({ + base58btc: aF, + base58flickr: cF +}, Symbol.toStringTag, { value: "Module" })), fF = qn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 -}), fF = qn({ +}), lF = qn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 -}), lF = qn({ +}), hF = qn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 -}), hF = qn({ +}), dF = qn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", bitsPerChar: 6 -}), dF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}), pF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base64: uF, - base64pad: fF, - base64url: lF, - base64urlpad: hF -}, Symbol.toStringTag, { value: "Module" })), h8 = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), pF = h8.reduce((t, e, r) => (t[r] = e, t), []), gF = h8.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); -function mF(t) { - return t.reduce((e, r) => (e += pF[r], e), ""); -} + base64: fF, + base64pad: lF, + base64url: hF, + base64urlpad: dF +}, Symbol.toStringTag, { value: "Module" })), h8 = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), gF = h8.reduce((t, e, r) => (t[r] = e, t), []), mF = h8.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); function vF(t) { + return t.reduce((e, r) => (e += gF[r], e), ""); +} +function bF(t) { const e = []; for (const r of t) { - const n = gF[r.codePointAt(0)]; + const n = mF[r.codePointAt(0)]; if (n === void 0) throw new Error(`Non-base256emoji character: ${r}`); e.push(n); } return new Uint8Array(e); } -const bF = rp({ +const yF = rp({ prefix: "🚀", name: "base256emoji", - encode: mF, - decode: vF -}), yF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + encode: vF, + decode: bF +}), wF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - base256emoji: bF + base256emoji: yF }, Symbol.toStringTag, { value: "Module" })); new TextEncoder(); new TextDecoder(); const bx = { - ...$B, - ...FB, - ...UB, - ...zB, - ...KB, - ...rF, - ...sF, - ...cF, - ...dF, - ...yF + ...BB, + ...jB, + ...qB, + ...WB, + ...VB, + ...nF, + ...oF, + ...uF, + ...pF, + ...wF }; function d8(t, e, r, n) { return { @@ -8275,41 +8283,41 @@ function d0(t) { return On(Rn(jo(t), c8), tp); } function g8(t) { - const e = Rn(_B, vx), r = xB + On(kd([e, t]), vx); - return [yB, wB, r].join(bB); + const e = Rn(EB, vx), r = _B + On(kd([e, t]), vx); + return [wB, xB, r].join(yB); } -function wF(t) { +function xF(t) { return On(t, tp); } -function xF(t) { +function _F(t) { return Rn(t, tp); } -function _F(t) { +function EF(t) { return Rn([d0(t.header), d0(t.payload)].join(h0), u8); } -function EF(t) { +function SF(t) { return [ d0(t.header), d0(t.payload), - wF(t.signature) + xF(t.signature) ].join(h0); } function O1(t) { - const e = t.split(h0), r = wx(e[0]), n = wx(e[1]), i = xF(e[2]), s = Rn(e.slice(0, 2).join(h0), u8); + const e = t.split(h0), r = wx(e[0]), n = wx(e[1]), i = _F(e[2]), s = Rn(e.slice(0, 2).join(h0), u8); return { header: r, payload: n, signature: i, data: s }; } -function xx(t = Da.randomBytes(EB)) { +function xx(t = Da.randomBytes(SB)) { return Qv.generateKeyPairFromSeed(t); } -async function SF(t, e, r, n, i = vt.fromMiliseconds(Date.now())) { - const s = { alg: mB, typ: vB }, o = g8(n.publicKey), a = i + r, u = { iss: o, sub: t, aud: e, iat: i, exp: a }, l = _F({ header: s, payload: u }), d = Qv.sign(n.secretKey, l); - return EF({ header: s, payload: u, signature: d }); +async function AF(t, e, r, n, i = vt.fromMiliseconds(Date.now())) { + const s = { alg: vB, typ: bB }, o = g8(n.publicKey), a = i + r, u = { iss: o, sub: t, aud: e, iat: i, exp: a }, l = EF({ header: s, payload: u }), d = Qv.sign(n.secretKey, l); + return SF({ header: s, payload: u, signature: d }); } var _x = function(t, e, r) { if (r || arguments.length === 2) for (var n = 0, i = e.length, s; n < i; n++) (s || !(n in e)) && (s || (s = Array.prototype.slice.call(e, 0, n)), s[n] = e[n]); return t.concat(s || Array.prototype.slice.call(e)); -}, AF = ( +}, PF = ( /** @class */ /* @__PURE__ */ function() { function t(e, r, n) { @@ -8317,7 +8325,7 @@ var _x = function(t, e, r) { } return t; }() -), PF = ( +), MF = ( /** @class */ /* @__PURE__ */ function() { function t(e) { @@ -8325,7 +8333,7 @@ var _x = function(t, e, r) { } return t; }() -), MF = ( +), IF = ( /** @class */ /* @__PURE__ */ function() { function t(e, r, n, i) { @@ -8333,7 +8341,7 @@ var _x = function(t, e, r) { } return t; }() -), IF = ( +), CF = ( /** @class */ /* @__PURE__ */ function() { function t() { @@ -8341,7 +8349,7 @@ var _x = function(t, e, r) { } return t; }() -), CF = ( +), TF = ( /** @class */ /* @__PURE__ */ function() { function t() { @@ -8349,7 +8357,7 @@ var _x = function(t, e, r) { } return t; }() -), TF = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/, RF = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, Ex = 3, DF = [ +), RF = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/, DF = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, Ex = 3, OF = [ ["aol", /AOLShield\/([0-9\._]+)/], ["edge", /Edge\/([0-9\._]+)/], ["edge-ios", /EdgiOS\/([0-9\._]+)/], @@ -8387,7 +8395,7 @@ var _x = function(t, e, r) { ["ios-webview", /AppleWebKit\/([0-9\.]+).*Mobile/], ["ios-webview", /AppleWebKit\/([0-9\.]+).*Gecko\)$/], ["curl", /^curl\/([0-9\.]+)$/], - ["searchbot", TF] + ["searchbot", RF] ], Sx = [ ["iOS", /iP(hone|od|ad)/], ["Android OS", /Android/], @@ -8416,11 +8424,11 @@ var _x = function(t, e, r) { ["BeOS", /BeOS/], ["OS/2", /OS\/2/] ]; -function OF(t) { - return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative" ? new CF() : typeof navigator < "u" ? LF(navigator.userAgent) : $F(); -} function NF(t) { - return t !== "" && DF.reduce(function(e, r) { + return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative" ? new TF() : typeof navigator < "u" ? kF(navigator.userAgent) : BF(); +} +function LF(t) { + return t !== "" && OF.reduce(function(e, r) { var n = r[0], i = r[1]; if (e) return e; @@ -8428,19 +8436,19 @@ function NF(t) { return !!s && [n, s]; }, !1); } -function LF(t) { - var e = NF(t); +function kF(t) { + var e = LF(t); if (!e) return null; var r = e[0], n = e[1]; if (r === "searchbot") - return new IF(); + return new CF(); var i = n[1] && n[1].split(".").join("_").split("_").slice(0, 3); - i ? i.length < Ex && (i = _x(_x([], i, !0), BF(Ex - i.length), !0)) : i = []; - var s = i.join("."), o = kF(t), a = RF.exec(t); - return a && a[1] ? new MF(r, s, o, a[1]) : new AF(r, s, o); + i ? i.length < Ex && (i = _x(_x([], i, !0), FF(Ex - i.length), !0)) : i = []; + var s = i.join("."), o = $F(t), a = DF.exec(t); + return a && a[1] ? new IF(r, s, o, a[1]) : new PF(r, s, o); } -function kF(t) { +function $F(t) { for (var e = 0, r = Sx.length; e < r; e++) { var n = Sx[e], i = n[0], s = n[1], o = s.exec(t); if (o) @@ -8448,11 +8456,11 @@ function kF(t) { } return null; } -function $F() { +function BF() { var t = typeof process < "u" && process.version; - return t ? new PF(process.version.slice(1)) : null; + return t ? new MF(process.version.slice(1)) : null; } -function BF(t) { +function FF(t) { for (var e = [], r = 0; r < t; r++) e.push("0"); return e; @@ -8465,58 +8473,58 @@ function Cc(t) { return typeof window < "u" && typeof window[t] < "u" && (e = window[t]), e; } Wr.getFromWindow = Cc; -function Uu(t) { +function qu(t) { const e = Cc(t); if (!e) throw new Error(`${t} is not defined in Window`); return e; } -Wr.getFromWindowOrThrow = Uu; -function FF() { - return Uu("document"); -} -Wr.getDocumentOrThrow = FF; +Wr.getFromWindowOrThrow = qu; function jF() { - return Cc("document"); + return qu("document"); } -var th = Wr.getDocument = jF; +Wr.getDocumentOrThrow = jF; function UF() { - return Uu("navigator"); + return Cc("document"); } -Wr.getNavigatorOrThrow = UF; +var th = Wr.getDocument = UF; function qF() { - return Cc("navigator"); + return qu("navigator"); } -var eb = Wr.getNavigator = qF; +Wr.getNavigatorOrThrow = qF; function zF() { - return Uu("location"); + return Cc("navigator"); } -Wr.getLocationOrThrow = zF; +var eb = Wr.getNavigator = zF; function WF() { - return Cc("location"); + return qu("location"); } -var m8 = Wr.getLocation = WF; +Wr.getLocationOrThrow = WF; function HF() { - return Uu("crypto"); + return Cc("location"); } -Wr.getCryptoOrThrow = HF; +var m8 = Wr.getLocation = HF; function KF() { - return Cc("crypto"); + return qu("crypto"); } -Wr.getCrypto = KF; +Wr.getCryptoOrThrow = KF; function VF() { - return Uu("localStorage"); + return Cc("crypto"); } -Wr.getLocalStorageOrThrow = VF; +Wr.getCrypto = VF; function GF() { + return qu("localStorage"); +} +Wr.getLocalStorageOrThrow = GF; +function YF() { return Cc("localStorage"); } -Wr.getLocalStorage = GF; +Wr.getLocalStorage = YF; var tb = {}; Object.defineProperty(tb, "__esModule", { value: !0 }); var v8 = tb.getWindowMetadata = void 0; const Ax = Wr; -function YF() { +function JF() { let t, e; try { t = Ax.getDocumentOrThrow(), e = Ax.getLocationOrThrow(); @@ -8537,8 +8545,8 @@ function YF() { else { const k = e.pathname.split("/"); k.pop(); - const q = k.join("/"); - B += q + "/" + L; + const W = k.join("/"); + B += W + "/" + L; } w.push(B); } else if (L.indexOf("//") === 0) { @@ -8577,8 +8585,8 @@ function YF() { name: o }; } -v8 = tb.getWindowMetadata = YF; -var Dl = {}, JF = (t) => encodeURIComponent(t).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), b8 = "%[a-f0-9]{2}", Px = new RegExp("(" + b8 + ")|([^%]+?)", "gi"), Mx = new RegExp("(" + b8 + ")+", "gi"); +v8 = tb.getWindowMetadata = JF; +var Dl = {}, XF = (t) => encodeURIComponent(t).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), b8 = "%[a-f0-9]{2}", Px = new RegExp("(" + b8 + ")|([^%]+?)", "gi"), Mx = new RegExp("(" + b8 + ")+", "gi"); function N1(t, e) { try { return [decodeURIComponent(t.join(""))]; @@ -8590,7 +8598,7 @@ function N1(t, e) { var r = t.slice(0, e), n = t.slice(e); return Array.prototype.concat.call([], N1(r), N1(n)); } -function XF(t) { +function ZF(t) { try { return decodeURIComponent(t); } catch { @@ -8599,7 +8607,7 @@ function XF(t) { return t; } } -function ZF(t) { +function QF(t) { for (var e = { "%FE%FF": "��", "%FF%FE": "��" @@ -8607,7 +8615,7 @@ function ZF(t) { try { e[r[0]] = decodeURIComponent(r[0]); } catch { - var n = XF(r[0]); + var n = ZF(r[0]); n !== r[0] && (e[r[0]] = n); } r = Mx.exec(t); @@ -8619,15 +8627,15 @@ function ZF(t) { } return t; } -var QF = function(t) { +var ej = function(t) { if (typeof t != "string") throw new TypeError("Expected `encodedURI` to be of type `string`, got `" + typeof t + "`"); try { return t = t.replace(/\+/g, " "), decodeURIComponent(t); } catch { - return ZF(t); + return QF(t); } -}, ej = (t, e) => { +}, tj = (t, e) => { if (!(typeof t == "string" && typeof e == "string")) throw new TypeError("Expected the arguments to be of type `string`"); if (e === "") @@ -8637,7 +8645,7 @@ var QF = function(t) { t.slice(0, r), t.slice(r + e.length) ]; -}, tj = function(t, e) { +}, rj = function(t, e) { for (var r = {}, n = Object.keys(t), i = Array.isArray(e), s = 0; s < n.length; s++) { var o = n[s], a = t[o]; (i ? e.indexOf(o) !== -1 : e(o, a, t)) && (r[o] = a); @@ -8645,45 +8653,45 @@ var QF = function(t) { return r; }; (function(t) { - const e = JF, r = QF, n = ej, i = tj, s = (k) => k == null, o = Symbol("encodeFragmentIdentifier"); + const e = XF, r = ej, n = tj, i = rj, s = (k) => k == null, o = Symbol("encodeFragmentIdentifier"); function a(k) { switch (k.arrayFormat) { case "index": - return (q) => (U, V) => { + return (W) => (U, V) => { const Q = U.length; - return V === void 0 || k.skipNull && V === null || k.skipEmptyString && V === "" ? U : V === null ? [...U, [d(q, k), "[", Q, "]"].join("")] : [ + return V === void 0 || k.skipNull && V === null || k.skipEmptyString && V === "" ? U : V === null ? [...U, [d(W, k), "[", Q, "]"].join("")] : [ ...U, - [d(q, k), "[", d(Q, k), "]=", d(V, k)].join("") + [d(W, k), "[", d(Q, k), "]=", d(V, k)].join("") ]; }; case "bracket": - return (q) => (U, V) => V === void 0 || k.skipNull && V === null || k.skipEmptyString && V === "" ? U : V === null ? [...U, [d(q, k), "[]"].join("")] : [...U, [d(q, k), "[]=", d(V, k)].join("")]; + return (W) => (U, V) => V === void 0 || k.skipNull && V === null || k.skipEmptyString && V === "" ? U : V === null ? [...U, [d(W, k), "[]"].join("")] : [...U, [d(W, k), "[]=", d(V, k)].join("")]; case "colon-list-separator": - return (q) => (U, V) => V === void 0 || k.skipNull && V === null || k.skipEmptyString && V === "" ? U : V === null ? [...U, [d(q, k), ":list="].join("")] : [...U, [d(q, k), ":list=", d(V, k)].join("")]; + return (W) => (U, V) => V === void 0 || k.skipNull && V === null || k.skipEmptyString && V === "" ? U : V === null ? [...U, [d(W, k), ":list="].join("")] : [...U, [d(W, k), ":list=", d(V, k)].join("")]; case "comma": case "separator": case "bracket-separator": { - const q = k.arrayFormat === "bracket-separator" ? "[]=" : "="; - return (U) => (V, Q) => Q === void 0 || k.skipNull && Q === null || k.skipEmptyString && Q === "" ? V : (Q = Q === null ? "" : Q, V.length === 0 ? [[d(U, k), q, d(Q, k)].join("")] : [[V, d(Q, k)].join(k.arrayFormatSeparator)]); + const W = k.arrayFormat === "bracket-separator" ? "[]=" : "="; + return (U) => (V, Q) => Q === void 0 || k.skipNull && Q === null || k.skipEmptyString && Q === "" ? V : (Q = Q === null ? "" : Q, V.length === 0 ? [[d(U, k), W, d(Q, k)].join("")] : [[V, d(Q, k)].join(k.arrayFormatSeparator)]); } default: - return (q) => (U, V) => V === void 0 || k.skipNull && V === null || k.skipEmptyString && V === "" ? U : V === null ? [...U, d(q, k)] : [...U, [d(q, k), "=", d(V, k)].join("")]; + return (W) => (U, V) => V === void 0 || k.skipNull && V === null || k.skipEmptyString && V === "" ? U : V === null ? [...U, d(W, k)] : [...U, [d(W, k), "=", d(V, k)].join("")]; } } function u(k) { - let q; + let W; switch (k.arrayFormat) { case "index": return (U, V, Q) => { - if (q = /\[(\d*)\]$/.exec(U), U = U.replace(/\[\d*\]$/, ""), !q) { + if (W = /\[(\d*)\]$/.exec(U), U = U.replace(/\[\d*\]$/, ""), !W) { Q[U] = V; return; } - Q[U] === void 0 && (Q[U] = {}), Q[U][q[1]] = V; + Q[U] === void 0 && (Q[U] = {}), Q[U][W[1]] = V; }; case "bracket": return (U, V, Q) => { - if (q = /(\[\])$/.exec(U), U = U.replace(/\[\]$/, ""), !q) { + if (W = /(\[\])$/.exec(U), U = U.replace(/\[\]$/, ""), !W) { Q[U] = V; return; } @@ -8695,7 +8703,7 @@ var QF = function(t) { }; case "colon-list-separator": return (U, V, Q) => { - if (q = /(:list)$/.exec(U), U = U.replace(/:list$/, ""), !q) { + if (W = /(:list)$/.exec(U), U = U.replace(/:list$/, ""), !W) { Q[U] = V; return; } @@ -8741,104 +8749,104 @@ var QF = function(t) { if (typeof k != "string" || k.length !== 1) throw new TypeError("arrayFormatSeparator must be single character string"); } - function d(k, q) { - return q.encode ? q.strict ? e(k) : encodeURIComponent(k) : k; + function d(k, W) { + return W.encode ? W.strict ? e(k) : encodeURIComponent(k) : k; } - function p(k, q) { - return q.decode ? r(k) : k; + function p(k, W) { + return W.decode ? r(k) : k; } function w(k) { - return Array.isArray(k) ? k.sort() : typeof k == "object" ? w(Object.keys(k)).sort((q, U) => Number(q) - Number(U)).map((q) => k[q]) : k; + return Array.isArray(k) ? k.sort() : typeof k == "object" ? w(Object.keys(k)).sort((W, U) => Number(W) - Number(U)).map((W) => k[W]) : k; } function _(k) { - const q = k.indexOf("#"); - return q !== -1 && (k = k.slice(0, q)), k; + const W = k.indexOf("#"); + return W !== -1 && (k = k.slice(0, W)), k; } function P(k) { - let q = ""; + let W = ""; const U = k.indexOf("#"); - return U !== -1 && (q = k.slice(U)), q; + return U !== -1 && (W = k.slice(U)), W; } function O(k) { k = _(k); - const q = k.indexOf("?"); - return q === -1 ? "" : k.slice(q + 1); + const W = k.indexOf("?"); + return W === -1 ? "" : k.slice(W + 1); } - function L(k, q) { - return q.parseNumbers && !Number.isNaN(Number(k)) && typeof k == "string" && k.trim() !== "" ? k = Number(k) : q.parseBooleans && k !== null && (k.toLowerCase() === "true" || k.toLowerCase() === "false") && (k = k.toLowerCase() === "true"), k; + function L(k, W) { + return W.parseNumbers && !Number.isNaN(Number(k)) && typeof k == "string" && k.trim() !== "" ? k = Number(k) : W.parseBooleans && k !== null && (k.toLowerCase() === "true" || k.toLowerCase() === "false") && (k = k.toLowerCase() === "true"), k; } - function B(k, q) { - q = Object.assign({ + function B(k, W) { + W = Object.assign({ decode: !0, sort: !0, arrayFormat: "none", arrayFormatSeparator: ",", parseNumbers: !1, parseBooleans: !1 - }, q), l(q.arrayFormatSeparator); - const U = u(q), V = /* @__PURE__ */ Object.create(null); + }, W), l(W.arrayFormatSeparator); + const U = u(W), V = /* @__PURE__ */ Object.create(null); if (typeof k != "string" || (k = k.trim().replace(/^[?#&]/, ""), !k)) return V; for (const Q of k.split("&")) { if (Q === "") continue; - let [R, K] = n(q.decode ? Q.replace(/\+/g, " ") : Q, "="); - K = K === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(q.arrayFormat) ? K : p(K, q), U(p(R, q), K, V); + let [R, K] = n(W.decode ? Q.replace(/\+/g, " ") : Q, "="); + K = K === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(W.arrayFormat) ? K : p(K, W), U(p(R, W), K, V); } for (const Q of Object.keys(V)) { const R = V[Q]; if (typeof R == "object" && R !== null) for (const K of Object.keys(R)) - R[K] = L(R[K], q); + R[K] = L(R[K], W); else - V[Q] = L(R, q); + V[Q] = L(R, W); } - return q.sort === !1 ? V : (q.sort === !0 ? Object.keys(V).sort() : Object.keys(V).sort(q.sort)).reduce((Q, R) => { + return W.sort === !1 ? V : (W.sort === !0 ? Object.keys(V).sort() : Object.keys(V).sort(W.sort)).reduce((Q, R) => { const K = V[R]; return K && typeof K == "object" && !Array.isArray(K) ? Q[R] = w(K) : Q[R] = K, Q; }, /* @__PURE__ */ Object.create(null)); } - t.extract = O, t.parse = B, t.stringify = (k, q) => { + t.extract = O, t.parse = B, t.stringify = (k, W) => { if (!k) return ""; - q = Object.assign({ + W = Object.assign({ encode: !0, strict: !0, arrayFormat: "none", arrayFormatSeparator: "," - }, q), l(q.arrayFormatSeparator); - const U = (K) => q.skipNull && s(k[K]) || q.skipEmptyString && k[K] === "", V = a(q), Q = {}; + }, W), l(W.arrayFormatSeparator); + const U = (K) => W.skipNull && s(k[K]) || W.skipEmptyString && k[K] === "", V = a(W), Q = {}; for (const K of Object.keys(k)) U(K) || (Q[K] = k[K]); const R = Object.keys(Q); - return q.sort !== !1 && R.sort(q.sort), R.map((K) => { + return W.sort !== !1 && R.sort(W.sort), R.map((K) => { const ge = k[K]; - return ge === void 0 ? "" : ge === null ? d(K, q) : Array.isArray(ge) ? ge.length === 0 && q.arrayFormat === "bracket-separator" ? d(K, q) + "[]" : ge.reduce(V(K), []).join("&") : d(K, q) + "=" + d(ge, q); + return ge === void 0 ? "" : ge === null ? d(K, W) : Array.isArray(ge) ? ge.length === 0 && W.arrayFormat === "bracket-separator" ? d(K, W) + "[]" : ge.reduce(V(K), []).join("&") : d(K, W) + "=" + d(ge, W); }).filter((K) => K.length > 0).join("&"); - }, t.parseUrl = (k, q) => { - q = Object.assign({ + }, t.parseUrl = (k, W) => { + W = Object.assign({ decode: !0 - }, q); + }, W); const [U, V] = n(k, "#"); return Object.assign( { url: U.split("?")[0] || "", - query: B(O(k), q) + query: B(O(k), W) }, - q && q.parseFragmentIdentifier && V ? { fragmentIdentifier: p(V, q) } : {} + W && W.parseFragmentIdentifier && V ? { fragmentIdentifier: p(V, W) } : {} ); - }, t.stringifyUrl = (k, q) => { - q = Object.assign({ + }, t.stringifyUrl = (k, W) => { + W = Object.assign({ encode: !0, strict: !0, [o]: !0 - }, q); + }, W); const U = _(k.url).split("?")[0] || "", V = t.extract(k.url), Q = t.parse(V, { sort: !1 }), R = Object.assign(Q, k.query); - let K = t.stringify(R, q); + let K = t.stringify(R, W); K && (K = `?${K}`); let ge = P(k.url); - return k.fragmentIdentifier && (ge = `#${q[o] ? d(k.fragmentIdentifier, q) : k.fragmentIdentifier}`), `${U}${K}${ge}`; - }, t.pick = (k, q, U) => { + return k.fragmentIdentifier && (ge = `#${W[o] ? d(k.fragmentIdentifier, W) : k.fragmentIdentifier}`), `${U}${K}${ge}`; + }, t.pick = (k, W, U) => { U = Object.assign({ parseFragmentIdentifier: !0, [o]: !1 @@ -8846,11 +8854,11 @@ var QF = function(t) { const { url: V, query: Q, fragmentIdentifier: R } = t.parseUrl(k, U); return t.stringifyUrl({ url: V, - query: i(Q, q), + query: i(Q, W), fragmentIdentifier: R }, U); - }, t.exclude = (k, q, U) => { - const V = Array.isArray(q) ? (Q) => !q.includes(Q) : (Q, R) => !q(Q, R); + }, t.exclude = (k, W, U) => { + const V = Array.isArray(W) ? (Q) => !W.includes(Q) : (Q, R) => !W(Q, R); return t.pick(k, V, U); }; })(Dl); @@ -8918,7 +8926,7 @@ var y8 = { exports: {} }; 0, 2147516424, 2147483648 - ], L = [224, 256, 384, 512], B = [128, 256], k = ["hex", "buffer", "arrayBuffer", "array", "digest"], q = { + ], L = [224, 256, 384, 512], B = [128, 256], k = ["hex", "buffer", "arrayBuffer", "array", "digest"], W = { 128: 168, 256: 136 }; @@ -8964,14 +8972,14 @@ var y8 = { exports: {} }; return Z.create(ee).update(J); }, K(Z, V, D, oe); }, Y = function(D, oe) { - var Z = q[D], J = Q(D, oe, "hex"); + var Z = W[D], J = Q(D, oe, "hex"); return J.create = function(ee, T, X) { return !T && !X ? f["shake" + D].create(ee) : new I(D, oe, ee).bytepad([T, X], Z); }, J.update = function(ee, T, X, re) { return J.create(T, X, re).update(ee); }, K(J, Q, D, oe); }, A = function(D, oe) { - var Z = q[D], J = R(D, oe, "hex"); + var Z = W[D], J = R(D, oe, "hex"); return J.create = function(ee, T, X) { return new F(D, oe, T).bytepad(["KMAC", X], Z).bytepad([ee], Z); }, J.update = function(ee, T, X, re) { @@ -9108,9 +9116,9 @@ var y8 = { exports: {} }; return this.encode(this.outputBits, !0), I.prototype.finalize.call(this); }; var ce = function(D) { - var oe, Z, J, ee, T, X, re, pe, ie, ue, ve, Pe, De, Ce, $e, Me, Ne, Ke, Le, qe, ze, _e, Ze, at, ke, Qe, tt, Ye, dt, lt, ct, qt, Jt, Et, er, Xt, Dt, kt, Ct, mt, Rt, Nt, bt, $t, Ft, rt, Bt, $, z, H, C, G, j, se, de, xe, Te, Re, nt, je, pt, it, et; + var oe, Z, J, ee, T, X, re, pe, ie, ue, ve, Pe, De, Ce, $e, Me, Ne, Ke, Le, qe, ze, _e, Ze, at, ke, Qe, tt, Ye, dt, lt, ct, qt, Jt, Et, er, Xt, Dt, kt, Ct, mt, Rt, Nt, bt, $t, Ft, rt, Bt, $, q, H, C, G, j, se, de, xe, Te, Re, nt, je, pt, it, et; for (J = 0; J < 48; J += 2) - ee = D[0] ^ D[10] ^ D[20] ^ D[30] ^ D[40], T = D[1] ^ D[11] ^ D[21] ^ D[31] ^ D[41], X = D[2] ^ D[12] ^ D[22] ^ D[32] ^ D[42], re = D[3] ^ D[13] ^ D[23] ^ D[33] ^ D[43], pe = D[4] ^ D[14] ^ D[24] ^ D[34] ^ D[44], ie = D[5] ^ D[15] ^ D[25] ^ D[35] ^ D[45], ue = D[6] ^ D[16] ^ D[26] ^ D[36] ^ D[46], ve = D[7] ^ D[17] ^ D[27] ^ D[37] ^ D[47], Pe = D[8] ^ D[18] ^ D[28] ^ D[38] ^ D[48], De = D[9] ^ D[19] ^ D[29] ^ D[39] ^ D[49], oe = Pe ^ (X << 1 | re >>> 31), Z = De ^ (re << 1 | X >>> 31), D[0] ^= oe, D[1] ^= Z, D[10] ^= oe, D[11] ^= Z, D[20] ^= oe, D[21] ^= Z, D[30] ^= oe, D[31] ^= Z, D[40] ^= oe, D[41] ^= Z, oe = ee ^ (pe << 1 | ie >>> 31), Z = T ^ (ie << 1 | pe >>> 31), D[2] ^= oe, D[3] ^= Z, D[12] ^= oe, D[13] ^= Z, D[22] ^= oe, D[23] ^= Z, D[32] ^= oe, D[33] ^= Z, D[42] ^= oe, D[43] ^= Z, oe = X ^ (ue << 1 | ve >>> 31), Z = re ^ (ve << 1 | ue >>> 31), D[4] ^= oe, D[5] ^= Z, D[14] ^= oe, D[15] ^= Z, D[24] ^= oe, D[25] ^= Z, D[34] ^= oe, D[35] ^= Z, D[44] ^= oe, D[45] ^= Z, oe = pe ^ (Pe << 1 | De >>> 31), Z = ie ^ (De << 1 | Pe >>> 31), D[6] ^= oe, D[7] ^= Z, D[16] ^= oe, D[17] ^= Z, D[26] ^= oe, D[27] ^= Z, D[36] ^= oe, D[37] ^= Z, D[46] ^= oe, D[47] ^= Z, oe = ue ^ (ee << 1 | T >>> 31), Z = ve ^ (T << 1 | ee >>> 31), D[8] ^= oe, D[9] ^= Z, D[18] ^= oe, D[19] ^= Z, D[28] ^= oe, D[29] ^= Z, D[38] ^= oe, D[39] ^= Z, D[48] ^= oe, D[49] ^= Z, Ce = D[0], $e = D[1], rt = D[11] << 4 | D[10] >>> 28, Bt = D[10] << 4 | D[11] >>> 28, Ye = D[20] << 3 | D[21] >>> 29, dt = D[21] << 3 | D[20] >>> 29, je = D[31] << 9 | D[30] >>> 23, pt = D[30] << 9 | D[31] >>> 23, Nt = D[40] << 18 | D[41] >>> 14, bt = D[41] << 18 | D[40] >>> 14, Et = D[2] << 1 | D[3] >>> 31, er = D[3] << 1 | D[2] >>> 31, Me = D[13] << 12 | D[12] >>> 20, Ne = D[12] << 12 | D[13] >>> 20, $ = D[22] << 10 | D[23] >>> 22, z = D[23] << 10 | D[22] >>> 22, lt = D[33] << 13 | D[32] >>> 19, ct = D[32] << 13 | D[33] >>> 19, it = D[42] << 2 | D[43] >>> 30, et = D[43] << 2 | D[42] >>> 30, se = D[5] << 30 | D[4] >>> 2, de = D[4] << 30 | D[5] >>> 2, Xt = D[14] << 6 | D[15] >>> 26, Dt = D[15] << 6 | D[14] >>> 26, Ke = D[25] << 11 | D[24] >>> 21, Le = D[24] << 11 | D[25] >>> 21, H = D[34] << 15 | D[35] >>> 17, C = D[35] << 15 | D[34] >>> 17, qt = D[45] << 29 | D[44] >>> 3, Jt = D[44] << 29 | D[45] >>> 3, at = D[6] << 28 | D[7] >>> 4, ke = D[7] << 28 | D[6] >>> 4, xe = D[17] << 23 | D[16] >>> 9, Te = D[16] << 23 | D[17] >>> 9, kt = D[26] << 25 | D[27] >>> 7, Ct = D[27] << 25 | D[26] >>> 7, qe = D[36] << 21 | D[37] >>> 11, ze = D[37] << 21 | D[36] >>> 11, G = D[47] << 24 | D[46] >>> 8, j = D[46] << 24 | D[47] >>> 8, $t = D[8] << 27 | D[9] >>> 5, Ft = D[9] << 27 | D[8] >>> 5, Qe = D[18] << 20 | D[19] >>> 12, tt = D[19] << 20 | D[18] >>> 12, Re = D[29] << 7 | D[28] >>> 25, nt = D[28] << 7 | D[29] >>> 25, mt = D[38] << 8 | D[39] >>> 24, Rt = D[39] << 8 | D[38] >>> 24, _e = D[48] << 14 | D[49] >>> 18, Ze = D[49] << 14 | D[48] >>> 18, D[0] = Ce ^ ~Me & Ke, D[1] = $e ^ ~Ne & Le, D[10] = at ^ ~Qe & Ye, D[11] = ke ^ ~tt & dt, D[20] = Et ^ ~Xt & kt, D[21] = er ^ ~Dt & Ct, D[30] = $t ^ ~rt & $, D[31] = Ft ^ ~Bt & z, D[40] = se ^ ~xe & Re, D[41] = de ^ ~Te & nt, D[2] = Me ^ ~Ke & qe, D[3] = Ne ^ ~Le & ze, D[12] = Qe ^ ~Ye & lt, D[13] = tt ^ ~dt & ct, D[22] = Xt ^ ~kt & mt, D[23] = Dt ^ ~Ct & Rt, D[32] = rt ^ ~$ & H, D[33] = Bt ^ ~z & C, D[42] = xe ^ ~Re & je, D[43] = Te ^ ~nt & pt, D[4] = Ke ^ ~qe & _e, D[5] = Le ^ ~ze & Ze, D[14] = Ye ^ ~lt & qt, D[15] = dt ^ ~ct & Jt, D[24] = kt ^ ~mt & Nt, D[25] = Ct ^ ~Rt & bt, D[34] = $ ^ ~H & G, D[35] = z ^ ~C & j, D[44] = Re ^ ~je & it, D[45] = nt ^ ~pt & et, D[6] = qe ^ ~_e & Ce, D[7] = ze ^ ~Ze & $e, D[16] = lt ^ ~qt & at, D[17] = ct ^ ~Jt & ke, D[26] = mt ^ ~Nt & Et, D[27] = Rt ^ ~bt & er, D[36] = H ^ ~G & $t, D[37] = C ^ ~j & Ft, D[46] = je ^ ~it & se, D[47] = pt ^ ~et & de, D[8] = _e ^ ~Ce & Me, D[9] = Ze ^ ~$e & Ne, D[18] = qt ^ ~at & Qe, D[19] = Jt ^ ~ke & tt, D[28] = Nt ^ ~Et & Xt, D[29] = bt ^ ~er & Dt, D[38] = G ^ ~$t & rt, D[39] = j ^ ~Ft & Bt, D[48] = it ^ ~se & xe, D[49] = et ^ ~de & Te, D[0] ^= O[J], D[1] ^= O[J + 1]; + ee = D[0] ^ D[10] ^ D[20] ^ D[30] ^ D[40], T = D[1] ^ D[11] ^ D[21] ^ D[31] ^ D[41], X = D[2] ^ D[12] ^ D[22] ^ D[32] ^ D[42], re = D[3] ^ D[13] ^ D[23] ^ D[33] ^ D[43], pe = D[4] ^ D[14] ^ D[24] ^ D[34] ^ D[44], ie = D[5] ^ D[15] ^ D[25] ^ D[35] ^ D[45], ue = D[6] ^ D[16] ^ D[26] ^ D[36] ^ D[46], ve = D[7] ^ D[17] ^ D[27] ^ D[37] ^ D[47], Pe = D[8] ^ D[18] ^ D[28] ^ D[38] ^ D[48], De = D[9] ^ D[19] ^ D[29] ^ D[39] ^ D[49], oe = Pe ^ (X << 1 | re >>> 31), Z = De ^ (re << 1 | X >>> 31), D[0] ^= oe, D[1] ^= Z, D[10] ^= oe, D[11] ^= Z, D[20] ^= oe, D[21] ^= Z, D[30] ^= oe, D[31] ^= Z, D[40] ^= oe, D[41] ^= Z, oe = ee ^ (pe << 1 | ie >>> 31), Z = T ^ (ie << 1 | pe >>> 31), D[2] ^= oe, D[3] ^= Z, D[12] ^= oe, D[13] ^= Z, D[22] ^= oe, D[23] ^= Z, D[32] ^= oe, D[33] ^= Z, D[42] ^= oe, D[43] ^= Z, oe = X ^ (ue << 1 | ve >>> 31), Z = re ^ (ve << 1 | ue >>> 31), D[4] ^= oe, D[5] ^= Z, D[14] ^= oe, D[15] ^= Z, D[24] ^= oe, D[25] ^= Z, D[34] ^= oe, D[35] ^= Z, D[44] ^= oe, D[45] ^= Z, oe = pe ^ (Pe << 1 | De >>> 31), Z = ie ^ (De << 1 | Pe >>> 31), D[6] ^= oe, D[7] ^= Z, D[16] ^= oe, D[17] ^= Z, D[26] ^= oe, D[27] ^= Z, D[36] ^= oe, D[37] ^= Z, D[46] ^= oe, D[47] ^= Z, oe = ue ^ (ee << 1 | T >>> 31), Z = ve ^ (T << 1 | ee >>> 31), D[8] ^= oe, D[9] ^= Z, D[18] ^= oe, D[19] ^= Z, D[28] ^= oe, D[29] ^= Z, D[38] ^= oe, D[39] ^= Z, D[48] ^= oe, D[49] ^= Z, Ce = D[0], $e = D[1], rt = D[11] << 4 | D[10] >>> 28, Bt = D[10] << 4 | D[11] >>> 28, Ye = D[20] << 3 | D[21] >>> 29, dt = D[21] << 3 | D[20] >>> 29, je = D[31] << 9 | D[30] >>> 23, pt = D[30] << 9 | D[31] >>> 23, Nt = D[40] << 18 | D[41] >>> 14, bt = D[41] << 18 | D[40] >>> 14, Et = D[2] << 1 | D[3] >>> 31, er = D[3] << 1 | D[2] >>> 31, Me = D[13] << 12 | D[12] >>> 20, Ne = D[12] << 12 | D[13] >>> 20, $ = D[22] << 10 | D[23] >>> 22, q = D[23] << 10 | D[22] >>> 22, lt = D[33] << 13 | D[32] >>> 19, ct = D[32] << 13 | D[33] >>> 19, it = D[42] << 2 | D[43] >>> 30, et = D[43] << 2 | D[42] >>> 30, se = D[5] << 30 | D[4] >>> 2, de = D[4] << 30 | D[5] >>> 2, Xt = D[14] << 6 | D[15] >>> 26, Dt = D[15] << 6 | D[14] >>> 26, Ke = D[25] << 11 | D[24] >>> 21, Le = D[24] << 11 | D[25] >>> 21, H = D[34] << 15 | D[35] >>> 17, C = D[35] << 15 | D[34] >>> 17, qt = D[45] << 29 | D[44] >>> 3, Jt = D[44] << 29 | D[45] >>> 3, at = D[6] << 28 | D[7] >>> 4, ke = D[7] << 28 | D[6] >>> 4, xe = D[17] << 23 | D[16] >>> 9, Te = D[16] << 23 | D[17] >>> 9, kt = D[26] << 25 | D[27] >>> 7, Ct = D[27] << 25 | D[26] >>> 7, qe = D[36] << 21 | D[37] >>> 11, ze = D[37] << 21 | D[36] >>> 11, G = D[47] << 24 | D[46] >>> 8, j = D[46] << 24 | D[47] >>> 8, $t = D[8] << 27 | D[9] >>> 5, Ft = D[9] << 27 | D[8] >>> 5, Qe = D[18] << 20 | D[19] >>> 12, tt = D[19] << 20 | D[18] >>> 12, Re = D[29] << 7 | D[28] >>> 25, nt = D[28] << 7 | D[29] >>> 25, mt = D[38] << 8 | D[39] >>> 24, Rt = D[39] << 8 | D[38] >>> 24, _e = D[48] << 14 | D[49] >>> 18, Ze = D[49] << 14 | D[48] >>> 18, D[0] = Ce ^ ~Me & Ke, D[1] = $e ^ ~Ne & Le, D[10] = at ^ ~Qe & Ye, D[11] = ke ^ ~tt & dt, D[20] = Et ^ ~Xt & kt, D[21] = er ^ ~Dt & Ct, D[30] = $t ^ ~rt & $, D[31] = Ft ^ ~Bt & q, D[40] = se ^ ~xe & Re, D[41] = de ^ ~Te & nt, D[2] = Me ^ ~Ke & qe, D[3] = Ne ^ ~Le & ze, D[12] = Qe ^ ~Ye & lt, D[13] = tt ^ ~dt & ct, D[22] = Xt ^ ~kt & mt, D[23] = Dt ^ ~Ct & Rt, D[32] = rt ^ ~$ & H, D[33] = Bt ^ ~q & C, D[42] = xe ^ ~Re & je, D[43] = Te ^ ~nt & pt, D[4] = Ke ^ ~qe & _e, D[5] = Le ^ ~ze & Ze, D[14] = Ye ^ ~lt & qt, D[15] = dt ^ ~ct & Jt, D[24] = kt ^ ~mt & Nt, D[25] = Ct ^ ~Rt & bt, D[34] = $ ^ ~H & G, D[35] = q ^ ~C & j, D[44] = Re ^ ~je & it, D[45] = nt ^ ~pt & et, D[6] = qe ^ ~_e & Ce, D[7] = ze ^ ~Ze & $e, D[16] = lt ^ ~qt & at, D[17] = ct ^ ~Jt & ke, D[26] = mt ^ ~Nt & Et, D[27] = Rt ^ ~bt & er, D[36] = H ^ ~G & $t, D[37] = C ^ ~j & Ft, D[46] = je ^ ~it & se, D[47] = pt ^ ~et & de, D[8] = _e ^ ~Ce & Me, D[9] = Ze ^ ~$e & Ne, D[18] = qt ^ ~at & Qe, D[19] = Jt ^ ~ke & tt, D[28] = Nt ^ ~Et & Xt, D[29] = bt ^ ~er & Dt, D[38] = G ^ ~$t & rt, D[39] = j ^ ~Ft & Bt, D[48] = it ^ ~se & xe, D[49] = et ^ ~de & Te, D[0] ^= O[J], D[1] ^= O[J + 1]; }; if (a) t.exports = f; @@ -9119,12 +9127,12 @@ var y8 = { exports: {} }; i[g[b]] = f[g[b]]; })(); })(y8); -var rj = y8.exports; -const nj = /* @__PURE__ */ ns(rj), ij = "logger/5.7.0"; +var nj = y8.exports; +const ij = /* @__PURE__ */ ns(nj), sj = "logger/5.7.0"; let Ix = !1, Cx = !1; const $d = { debug: 1, default: 2, info: 2, warning: 3, error: 4, off: 5 }; let Tx = $d.default, hm = null; -function sj() { +function oj() { try { const t = []; if (["NFD", "NFC", "NFKD", "NFKC"].forEach((e) => { @@ -9143,7 +9151,7 @@ function sj() { } return null; } -const Rx = sj(); +const Rx = oj(); var L1; (function(t) { t.DEBUG = "DEBUG", t.INFO = "INFO", t.WARNING = "WARNING", t.ERROR = "ERROR", t.OFF = "OFF"; @@ -9279,7 +9287,7 @@ class Yr { e === r ? this.throwError("cannot instantiate abstract class " + JSON.stringify(r.name) + " directly; use a sub-class", Yr.errors.UNSUPPORTED_OPERATION, { name: e.name, operation: "new" }) : (e === Object || e == null) && this.throwError("missing new", Yr.errors.MISSING_NEW, { name: r.name }); } static globalLogger() { - return hm || (hm = new Yr(ij)), hm; + return hm || (hm = new Yr(sj)), hm; } static setCensorship(e, r) { if (!e && r && this.globalLogger().throwError("cannot permanently disable censorship", Yr.errors.UNSUPPORTED_OPERATION, { @@ -9307,17 +9315,17 @@ class Yr { } Yr.errors = Es; Yr.levels = L1; -const oj = "bytes/5.7.0", hn = new Yr(oj); +const aj = "bytes/5.7.0", hn = new Yr(aj); function w8(t) { return !!t.toHexString; } -function wu(t) { +function xu(t) { return t.slice || (t.slice = function() { const e = Array.prototype.slice.call(arguments); - return wu(new Uint8Array(Array.prototype.slice.apply(t, e))); + return xu(new Uint8Array(Array.prototype.slice.apply(t, e))); }), t; } -function aj(t) { +function cj(t) { return Ks(t) && !(t.length % 2) || rb(t); } function Ox(t) { @@ -9343,7 +9351,7 @@ function wn(t, e) { const r = []; for (; t; ) r.unshift(t & 255), t = parseInt(String(t / 256)); - return r.length === 0 && r.push(0), wu(new Uint8Array(r)); + return r.length === 0 && r.push(0), xu(new Uint8Array(r)); } if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), w8(t) && (t = t.toHexString()), Ks(t)) { let r = t.substring(2); @@ -9351,18 +9359,18 @@ function wn(t, e) { const n = []; for (let i = 0; i < r.length; i += 2) n.push(parseInt(r.substring(i, i + 2), 16)); - return wu(new Uint8Array(n)); + return xu(new Uint8Array(n)); } - return rb(t) ? wu(new Uint8Array(t)) : hn.throwArgumentError("invalid arrayify value", "value", t); + return rb(t) ? xu(new Uint8Array(t)) : hn.throwArgumentError("invalid arrayify value", "value", t); } -function cj(t) { +function uj(t) { const e = t.map((i) => wn(i)), r = e.reduce((i, s) => i + s.length, 0), n = new Uint8Array(r); - return e.reduce((i, s) => (n.set(s, i), i + s.length), 0), wu(n); + return e.reduce((i, s) => (n.set(s, i), i + s.length), 0), xu(n); } -function uj(t, e) { +function fj(t, e) { t = wn(t), t.length > e && hn.throwArgumentError("value out of range", "value", arguments[0]); const r = new Uint8Array(e); - return r.set(t, e - t.length), wu(r); + return r.set(t, e - t.length), xu(r); } function Ks(t, e) { return !(typeof t != "string" || !t.match(/^0x[0-9A-Fa-f]*$/) || e && t.length !== 2 + 2 * e); @@ -9392,7 +9400,7 @@ function Di(t, e) { } return hn.throwArgumentError("invalid hexlify value", "value", t); } -function fj(t) { +function lj(t) { if (typeof t != "string") t = Di(t); else if (!Ks(t) || t.length % 2) @@ -9402,7 +9410,7 @@ function fj(t) { function Nx(t, e, r) { return typeof t != "string" ? t = Di(t) : (!Ks(t) || t.length % 2) && hn.throwArgumentError("invalid hexData", "value", t), e = 2 + 2 * e, "0x" + t.substring(e); } -function xu(t, e) { +function _u(t, e) { for (typeof t != "string" ? t = Di(t) : Ks(t) || hn.throwArgumentError("invalid hex string", "value", t), t.length > 2 * e + 2 && hn.throwArgumentError("value out of range", "value", arguments[1]); t.length < 2 * e + 2; ) t = "0x0" + t.substring(2); return t; @@ -9417,12 +9425,12 @@ function x8(t) { yParityAndS: "0x", compact: "0x" }; - if (aj(t)) { + if (cj(t)) { let r = wn(t); r.length === 64 ? (e.v = 27 + (r[32] >> 7), r[32] &= 127, e.r = Di(r.slice(0, 32)), e.s = Di(r.slice(32, 64))) : r.length === 65 ? (e.r = Di(r.slice(0, 32)), e.s = Di(r.slice(32, 64)), e.v = r[64]) : hn.throwArgumentError("invalid signature string", "signature", t), e.v < 27 && (e.v === 0 || e.v === 1 ? e.v += 27 : hn.throwArgumentError("signature invalid v byte", "signature", t)), e.recoveryParam = 1 - e.v % 2, e.recoveryParam && (r[32] |= 128), e._vs = Di(r.slice(32, 64)); } else { if (e.r = t.r, e.s = t.s, e.v = t.v, e.recoveryParam = t.recoveryParam, e._vs = t._vs, e._vs != null) { - const i = uj(wn(e._vs), 32); + const i = fj(wn(e._vs), 32); e._vs = Di(i); const s = i[0] >= 128 ? 1 : 0; e.recoveryParam == null ? e.recoveryParam = s : e.recoveryParam !== s && hn.throwArgumentError("signature recoveryParam mismatch _vs", "signature", t), i[0] &= 127; @@ -9437,16 +9445,16 @@ function x8(t) { const i = e.v === 0 || e.v === 1 ? e.v : 1 - e.v % 2; e.recoveryParam !== i && hn.throwArgumentError("signature recoveryParam mismatch v", "signature", t); } - e.r == null || !Ks(e.r) ? hn.throwArgumentError("signature missing or invalid r", "signature", t) : e.r = xu(e.r, 32), e.s == null || !Ks(e.s) ? hn.throwArgumentError("signature missing or invalid s", "signature", t) : e.s = xu(e.s, 32); + e.r == null || !Ks(e.r) ? hn.throwArgumentError("signature missing or invalid r", "signature", t) : e.r = _u(e.r, 32), e.s == null || !Ks(e.s) ? hn.throwArgumentError("signature missing or invalid s", "signature", t) : e.s = _u(e.s, 32); const r = wn(e.s); r[0] >= 128 && hn.throwArgumentError("signature s out of range", "signature", t), e.recoveryParam && (r[0] |= 128); const n = Di(r); - e._vs && (Ks(e._vs) || hn.throwArgumentError("signature invalid _vs", "signature", t), e._vs = xu(e._vs, 32)), e._vs == null ? e._vs = n : e._vs !== n && hn.throwArgumentError("signature _vs mismatch v and s", "signature", t); + e._vs && (Ks(e._vs) || hn.throwArgumentError("signature invalid _vs", "signature", t), e._vs = _u(e._vs, 32)), e._vs == null ? e._vs = n : e._vs !== n && hn.throwArgumentError("signature _vs mismatch v and s", "signature", t); } return e.yParityAndS = e._vs, e.compact = e.r + e.yParityAndS.substring(2), e; } function nb(t) { - return "0x" + nj.keccak_256(wn(t)); + return "0x" + ij.keccak_256(wn(t)); } var ib = { exports: {} }; ib.exports; @@ -9911,7 +9919,7 @@ ib.exports; return M !== 0 ? g.words[I] = M | 0 : g.length--, g._strip(); } var k = function(f, g, b) { - var x = f.words, E = g.words, S = b.words, v = 0, M, I, F, ce = x[0] | 0, D = ce & 8191, oe = ce >>> 13, Z = x[1] | 0, J = Z & 8191, ee = Z >>> 13, T = x[2] | 0, X = T & 8191, re = T >>> 13, pe = x[3] | 0, ie = pe & 8191, ue = pe >>> 13, ve = x[4] | 0, Pe = ve & 8191, De = ve >>> 13, Ce = x[5] | 0, $e = Ce & 8191, Me = Ce >>> 13, Ne = x[6] | 0, Ke = Ne & 8191, Le = Ne >>> 13, qe = x[7] | 0, ze = qe & 8191, _e = qe >>> 13, Ze = x[8] | 0, at = Ze & 8191, ke = Ze >>> 13, Qe = x[9] | 0, tt = Qe & 8191, Ye = Qe >>> 13, dt = E[0] | 0, lt = dt & 8191, ct = dt >>> 13, qt = E[1] | 0, Jt = qt & 8191, Et = qt >>> 13, er = E[2] | 0, Xt = er & 8191, Dt = er >>> 13, kt = E[3] | 0, Ct = kt & 8191, mt = kt >>> 13, Rt = E[4] | 0, Nt = Rt & 8191, bt = Rt >>> 13, $t = E[5] | 0, Ft = $t & 8191, rt = $t >>> 13, Bt = E[6] | 0, $ = Bt & 8191, z = Bt >>> 13, H = E[7] | 0, C = H & 8191, G = H >>> 13, j = E[8] | 0, se = j & 8191, de = j >>> 13, xe = E[9] | 0, Te = xe & 8191, Re = xe >>> 13; + var x = f.words, E = g.words, S = b.words, v = 0, M, I, F, ce = x[0] | 0, D = ce & 8191, oe = ce >>> 13, Z = x[1] | 0, J = Z & 8191, ee = Z >>> 13, T = x[2] | 0, X = T & 8191, re = T >>> 13, pe = x[3] | 0, ie = pe & 8191, ue = pe >>> 13, ve = x[4] | 0, Pe = ve & 8191, De = ve >>> 13, Ce = x[5] | 0, $e = Ce & 8191, Me = Ce >>> 13, Ne = x[6] | 0, Ke = Ne & 8191, Le = Ne >>> 13, qe = x[7] | 0, ze = qe & 8191, _e = qe >>> 13, Ze = x[8] | 0, at = Ze & 8191, ke = Ze >>> 13, Qe = x[9] | 0, tt = Qe & 8191, Ye = Qe >>> 13, dt = E[0] | 0, lt = dt & 8191, ct = dt >>> 13, qt = E[1] | 0, Jt = qt & 8191, Et = qt >>> 13, er = E[2] | 0, Xt = er & 8191, Dt = er >>> 13, kt = E[3] | 0, Ct = kt & 8191, mt = kt >>> 13, Rt = E[4] | 0, Nt = Rt & 8191, bt = Rt >>> 13, $t = E[5] | 0, Ft = $t & 8191, rt = $t >>> 13, Bt = E[6] | 0, $ = Bt & 8191, q = Bt >>> 13, H = E[7] | 0, C = H & 8191, G = H >>> 13, j = E[8] | 0, se = j & 8191, de = j >>> 13, xe = E[9] | 0, Te = xe & 8191, Re = xe >>> 13; b.negative = f.negative ^ g.negative, b.length = 19, M = Math.imul(D, lt), I = Math.imul(D, ct), I = I + Math.imul(oe, lt) | 0, F = Math.imul(oe, ct); var nt = (v + M | 0) + ((I & 8191) << 13) | 0; v = (F + (I >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, M = Math.imul(J, lt), I = Math.imul(J, ct), I = I + Math.imul(ee, lt) | 0, F = Math.imul(ee, ct), M = M + Math.imul(D, Jt) | 0, I = I + Math.imul(D, Et) | 0, I = I + Math.imul(oe, Jt) | 0, F = F + Math.imul(oe, Et) | 0; @@ -9924,25 +9932,25 @@ ib.exports; var et = (v + M | 0) + ((I & 8191) << 13) | 0; v = (F + (I >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, M = Math.imul($e, lt), I = Math.imul($e, ct), I = I + Math.imul(Me, lt) | 0, F = Math.imul(Me, ct), M = M + Math.imul(Pe, Jt) | 0, I = I + Math.imul(Pe, Et) | 0, I = I + Math.imul(De, Jt) | 0, F = F + Math.imul(De, Et) | 0, M = M + Math.imul(ie, Xt) | 0, I = I + Math.imul(ie, Dt) | 0, I = I + Math.imul(ue, Xt) | 0, F = F + Math.imul(ue, Dt) | 0, M = M + Math.imul(X, Ct) | 0, I = I + Math.imul(X, mt) | 0, I = I + Math.imul(re, Ct) | 0, F = F + Math.imul(re, mt) | 0, M = M + Math.imul(J, Nt) | 0, I = I + Math.imul(J, bt) | 0, I = I + Math.imul(ee, Nt) | 0, F = F + Math.imul(ee, bt) | 0, M = M + Math.imul(D, Ft) | 0, I = I + Math.imul(D, rt) | 0, I = I + Math.imul(oe, Ft) | 0, F = F + Math.imul(oe, rt) | 0; var St = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, M = Math.imul(Ke, lt), I = Math.imul(Ke, ct), I = I + Math.imul(Le, lt) | 0, F = Math.imul(Le, ct), M = M + Math.imul($e, Jt) | 0, I = I + Math.imul($e, Et) | 0, I = I + Math.imul(Me, Jt) | 0, F = F + Math.imul(Me, Et) | 0, M = M + Math.imul(Pe, Xt) | 0, I = I + Math.imul(Pe, Dt) | 0, I = I + Math.imul(De, Xt) | 0, F = F + Math.imul(De, Dt) | 0, M = M + Math.imul(ie, Ct) | 0, I = I + Math.imul(ie, mt) | 0, I = I + Math.imul(ue, Ct) | 0, F = F + Math.imul(ue, mt) | 0, M = M + Math.imul(X, Nt) | 0, I = I + Math.imul(X, bt) | 0, I = I + Math.imul(re, Nt) | 0, F = F + Math.imul(re, bt) | 0, M = M + Math.imul(J, Ft) | 0, I = I + Math.imul(J, rt) | 0, I = I + Math.imul(ee, Ft) | 0, F = F + Math.imul(ee, rt) | 0, M = M + Math.imul(D, $) | 0, I = I + Math.imul(D, z) | 0, I = I + Math.imul(oe, $) | 0, F = F + Math.imul(oe, z) | 0; + v = (F + (I >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, M = Math.imul(Ke, lt), I = Math.imul(Ke, ct), I = I + Math.imul(Le, lt) | 0, F = Math.imul(Le, ct), M = M + Math.imul($e, Jt) | 0, I = I + Math.imul($e, Et) | 0, I = I + Math.imul(Me, Jt) | 0, F = F + Math.imul(Me, Et) | 0, M = M + Math.imul(Pe, Xt) | 0, I = I + Math.imul(Pe, Dt) | 0, I = I + Math.imul(De, Xt) | 0, F = F + Math.imul(De, Dt) | 0, M = M + Math.imul(ie, Ct) | 0, I = I + Math.imul(ie, mt) | 0, I = I + Math.imul(ue, Ct) | 0, F = F + Math.imul(ue, mt) | 0, M = M + Math.imul(X, Nt) | 0, I = I + Math.imul(X, bt) | 0, I = I + Math.imul(re, Nt) | 0, F = F + Math.imul(re, bt) | 0, M = M + Math.imul(J, Ft) | 0, I = I + Math.imul(J, rt) | 0, I = I + Math.imul(ee, Ft) | 0, F = F + Math.imul(ee, rt) | 0, M = M + Math.imul(D, $) | 0, I = I + Math.imul(D, q) | 0, I = I + Math.imul(oe, $) | 0, F = F + Math.imul(oe, q) | 0; var Tt = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, M = Math.imul(ze, lt), I = Math.imul(ze, ct), I = I + Math.imul(_e, lt) | 0, F = Math.imul(_e, ct), M = M + Math.imul(Ke, Jt) | 0, I = I + Math.imul(Ke, Et) | 0, I = I + Math.imul(Le, Jt) | 0, F = F + Math.imul(Le, Et) | 0, M = M + Math.imul($e, Xt) | 0, I = I + Math.imul($e, Dt) | 0, I = I + Math.imul(Me, Xt) | 0, F = F + Math.imul(Me, Dt) | 0, M = M + Math.imul(Pe, Ct) | 0, I = I + Math.imul(Pe, mt) | 0, I = I + Math.imul(De, Ct) | 0, F = F + Math.imul(De, mt) | 0, M = M + Math.imul(ie, Nt) | 0, I = I + Math.imul(ie, bt) | 0, I = I + Math.imul(ue, Nt) | 0, F = F + Math.imul(ue, bt) | 0, M = M + Math.imul(X, Ft) | 0, I = I + Math.imul(X, rt) | 0, I = I + Math.imul(re, Ft) | 0, F = F + Math.imul(re, rt) | 0, M = M + Math.imul(J, $) | 0, I = I + Math.imul(J, z) | 0, I = I + Math.imul(ee, $) | 0, F = F + Math.imul(ee, z) | 0, M = M + Math.imul(D, C) | 0, I = I + Math.imul(D, G) | 0, I = I + Math.imul(oe, C) | 0, F = F + Math.imul(oe, G) | 0; + v = (F + (I >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, M = Math.imul(ze, lt), I = Math.imul(ze, ct), I = I + Math.imul(_e, lt) | 0, F = Math.imul(_e, ct), M = M + Math.imul(Ke, Jt) | 0, I = I + Math.imul(Ke, Et) | 0, I = I + Math.imul(Le, Jt) | 0, F = F + Math.imul(Le, Et) | 0, M = M + Math.imul($e, Xt) | 0, I = I + Math.imul($e, Dt) | 0, I = I + Math.imul(Me, Xt) | 0, F = F + Math.imul(Me, Dt) | 0, M = M + Math.imul(Pe, Ct) | 0, I = I + Math.imul(Pe, mt) | 0, I = I + Math.imul(De, Ct) | 0, F = F + Math.imul(De, mt) | 0, M = M + Math.imul(ie, Nt) | 0, I = I + Math.imul(ie, bt) | 0, I = I + Math.imul(ue, Nt) | 0, F = F + Math.imul(ue, bt) | 0, M = M + Math.imul(X, Ft) | 0, I = I + Math.imul(X, rt) | 0, I = I + Math.imul(re, Ft) | 0, F = F + Math.imul(re, rt) | 0, M = M + Math.imul(J, $) | 0, I = I + Math.imul(J, q) | 0, I = I + Math.imul(ee, $) | 0, F = F + Math.imul(ee, q) | 0, M = M + Math.imul(D, C) | 0, I = I + Math.imul(D, G) | 0, I = I + Math.imul(oe, C) | 0, F = F + Math.imul(oe, G) | 0; var At = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, M = Math.imul(at, lt), I = Math.imul(at, ct), I = I + Math.imul(ke, lt) | 0, F = Math.imul(ke, ct), M = M + Math.imul(ze, Jt) | 0, I = I + Math.imul(ze, Et) | 0, I = I + Math.imul(_e, Jt) | 0, F = F + Math.imul(_e, Et) | 0, M = M + Math.imul(Ke, Xt) | 0, I = I + Math.imul(Ke, Dt) | 0, I = I + Math.imul(Le, Xt) | 0, F = F + Math.imul(Le, Dt) | 0, M = M + Math.imul($e, Ct) | 0, I = I + Math.imul($e, mt) | 0, I = I + Math.imul(Me, Ct) | 0, F = F + Math.imul(Me, mt) | 0, M = M + Math.imul(Pe, Nt) | 0, I = I + Math.imul(Pe, bt) | 0, I = I + Math.imul(De, Nt) | 0, F = F + Math.imul(De, bt) | 0, M = M + Math.imul(ie, Ft) | 0, I = I + Math.imul(ie, rt) | 0, I = I + Math.imul(ue, Ft) | 0, F = F + Math.imul(ue, rt) | 0, M = M + Math.imul(X, $) | 0, I = I + Math.imul(X, z) | 0, I = I + Math.imul(re, $) | 0, F = F + Math.imul(re, z) | 0, M = M + Math.imul(J, C) | 0, I = I + Math.imul(J, G) | 0, I = I + Math.imul(ee, C) | 0, F = F + Math.imul(ee, G) | 0, M = M + Math.imul(D, se) | 0, I = I + Math.imul(D, de) | 0, I = I + Math.imul(oe, se) | 0, F = F + Math.imul(oe, de) | 0; + v = (F + (I >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, M = Math.imul(at, lt), I = Math.imul(at, ct), I = I + Math.imul(ke, lt) | 0, F = Math.imul(ke, ct), M = M + Math.imul(ze, Jt) | 0, I = I + Math.imul(ze, Et) | 0, I = I + Math.imul(_e, Jt) | 0, F = F + Math.imul(_e, Et) | 0, M = M + Math.imul(Ke, Xt) | 0, I = I + Math.imul(Ke, Dt) | 0, I = I + Math.imul(Le, Xt) | 0, F = F + Math.imul(Le, Dt) | 0, M = M + Math.imul($e, Ct) | 0, I = I + Math.imul($e, mt) | 0, I = I + Math.imul(Me, Ct) | 0, F = F + Math.imul(Me, mt) | 0, M = M + Math.imul(Pe, Nt) | 0, I = I + Math.imul(Pe, bt) | 0, I = I + Math.imul(De, Nt) | 0, F = F + Math.imul(De, bt) | 0, M = M + Math.imul(ie, Ft) | 0, I = I + Math.imul(ie, rt) | 0, I = I + Math.imul(ue, Ft) | 0, F = F + Math.imul(ue, rt) | 0, M = M + Math.imul(X, $) | 0, I = I + Math.imul(X, q) | 0, I = I + Math.imul(re, $) | 0, F = F + Math.imul(re, q) | 0, M = M + Math.imul(J, C) | 0, I = I + Math.imul(J, G) | 0, I = I + Math.imul(ee, C) | 0, F = F + Math.imul(ee, G) | 0, M = M + Math.imul(D, se) | 0, I = I + Math.imul(D, de) | 0, I = I + Math.imul(oe, se) | 0, F = F + Math.imul(oe, de) | 0; var _t = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, M = Math.imul(tt, lt), I = Math.imul(tt, ct), I = I + Math.imul(Ye, lt) | 0, F = Math.imul(Ye, ct), M = M + Math.imul(at, Jt) | 0, I = I + Math.imul(at, Et) | 0, I = I + Math.imul(ke, Jt) | 0, F = F + Math.imul(ke, Et) | 0, M = M + Math.imul(ze, Xt) | 0, I = I + Math.imul(ze, Dt) | 0, I = I + Math.imul(_e, Xt) | 0, F = F + Math.imul(_e, Dt) | 0, M = M + Math.imul(Ke, Ct) | 0, I = I + Math.imul(Ke, mt) | 0, I = I + Math.imul(Le, Ct) | 0, F = F + Math.imul(Le, mt) | 0, M = M + Math.imul($e, Nt) | 0, I = I + Math.imul($e, bt) | 0, I = I + Math.imul(Me, Nt) | 0, F = F + Math.imul(Me, bt) | 0, M = M + Math.imul(Pe, Ft) | 0, I = I + Math.imul(Pe, rt) | 0, I = I + Math.imul(De, Ft) | 0, F = F + Math.imul(De, rt) | 0, M = M + Math.imul(ie, $) | 0, I = I + Math.imul(ie, z) | 0, I = I + Math.imul(ue, $) | 0, F = F + Math.imul(ue, z) | 0, M = M + Math.imul(X, C) | 0, I = I + Math.imul(X, G) | 0, I = I + Math.imul(re, C) | 0, F = F + Math.imul(re, G) | 0, M = M + Math.imul(J, se) | 0, I = I + Math.imul(J, de) | 0, I = I + Math.imul(ee, se) | 0, F = F + Math.imul(ee, de) | 0, M = M + Math.imul(D, Te) | 0, I = I + Math.imul(D, Re) | 0, I = I + Math.imul(oe, Te) | 0, F = F + Math.imul(oe, Re) | 0; + v = (F + (I >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, M = Math.imul(tt, lt), I = Math.imul(tt, ct), I = I + Math.imul(Ye, lt) | 0, F = Math.imul(Ye, ct), M = M + Math.imul(at, Jt) | 0, I = I + Math.imul(at, Et) | 0, I = I + Math.imul(ke, Jt) | 0, F = F + Math.imul(ke, Et) | 0, M = M + Math.imul(ze, Xt) | 0, I = I + Math.imul(ze, Dt) | 0, I = I + Math.imul(_e, Xt) | 0, F = F + Math.imul(_e, Dt) | 0, M = M + Math.imul(Ke, Ct) | 0, I = I + Math.imul(Ke, mt) | 0, I = I + Math.imul(Le, Ct) | 0, F = F + Math.imul(Le, mt) | 0, M = M + Math.imul($e, Nt) | 0, I = I + Math.imul($e, bt) | 0, I = I + Math.imul(Me, Nt) | 0, F = F + Math.imul(Me, bt) | 0, M = M + Math.imul(Pe, Ft) | 0, I = I + Math.imul(Pe, rt) | 0, I = I + Math.imul(De, Ft) | 0, F = F + Math.imul(De, rt) | 0, M = M + Math.imul(ie, $) | 0, I = I + Math.imul(ie, q) | 0, I = I + Math.imul(ue, $) | 0, F = F + Math.imul(ue, q) | 0, M = M + Math.imul(X, C) | 0, I = I + Math.imul(X, G) | 0, I = I + Math.imul(re, C) | 0, F = F + Math.imul(re, G) | 0, M = M + Math.imul(J, se) | 0, I = I + Math.imul(J, de) | 0, I = I + Math.imul(ee, se) | 0, F = F + Math.imul(ee, de) | 0, M = M + Math.imul(D, Te) | 0, I = I + Math.imul(D, Re) | 0, I = I + Math.imul(oe, Te) | 0, F = F + Math.imul(oe, Re) | 0; var ht = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, M = Math.imul(tt, Jt), I = Math.imul(tt, Et), I = I + Math.imul(Ye, Jt) | 0, F = Math.imul(Ye, Et), M = M + Math.imul(at, Xt) | 0, I = I + Math.imul(at, Dt) | 0, I = I + Math.imul(ke, Xt) | 0, F = F + Math.imul(ke, Dt) | 0, M = M + Math.imul(ze, Ct) | 0, I = I + Math.imul(ze, mt) | 0, I = I + Math.imul(_e, Ct) | 0, F = F + Math.imul(_e, mt) | 0, M = M + Math.imul(Ke, Nt) | 0, I = I + Math.imul(Ke, bt) | 0, I = I + Math.imul(Le, Nt) | 0, F = F + Math.imul(Le, bt) | 0, M = M + Math.imul($e, Ft) | 0, I = I + Math.imul($e, rt) | 0, I = I + Math.imul(Me, Ft) | 0, F = F + Math.imul(Me, rt) | 0, M = M + Math.imul(Pe, $) | 0, I = I + Math.imul(Pe, z) | 0, I = I + Math.imul(De, $) | 0, F = F + Math.imul(De, z) | 0, M = M + Math.imul(ie, C) | 0, I = I + Math.imul(ie, G) | 0, I = I + Math.imul(ue, C) | 0, F = F + Math.imul(ue, G) | 0, M = M + Math.imul(X, se) | 0, I = I + Math.imul(X, de) | 0, I = I + Math.imul(re, se) | 0, F = F + Math.imul(re, de) | 0, M = M + Math.imul(J, Te) | 0, I = I + Math.imul(J, Re) | 0, I = I + Math.imul(ee, Te) | 0, F = F + Math.imul(ee, Re) | 0; + v = (F + (I >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, M = Math.imul(tt, Jt), I = Math.imul(tt, Et), I = I + Math.imul(Ye, Jt) | 0, F = Math.imul(Ye, Et), M = M + Math.imul(at, Xt) | 0, I = I + Math.imul(at, Dt) | 0, I = I + Math.imul(ke, Xt) | 0, F = F + Math.imul(ke, Dt) | 0, M = M + Math.imul(ze, Ct) | 0, I = I + Math.imul(ze, mt) | 0, I = I + Math.imul(_e, Ct) | 0, F = F + Math.imul(_e, mt) | 0, M = M + Math.imul(Ke, Nt) | 0, I = I + Math.imul(Ke, bt) | 0, I = I + Math.imul(Le, Nt) | 0, F = F + Math.imul(Le, bt) | 0, M = M + Math.imul($e, Ft) | 0, I = I + Math.imul($e, rt) | 0, I = I + Math.imul(Me, Ft) | 0, F = F + Math.imul(Me, rt) | 0, M = M + Math.imul(Pe, $) | 0, I = I + Math.imul(Pe, q) | 0, I = I + Math.imul(De, $) | 0, F = F + Math.imul(De, q) | 0, M = M + Math.imul(ie, C) | 0, I = I + Math.imul(ie, G) | 0, I = I + Math.imul(ue, C) | 0, F = F + Math.imul(ue, G) | 0, M = M + Math.imul(X, se) | 0, I = I + Math.imul(X, de) | 0, I = I + Math.imul(re, se) | 0, F = F + Math.imul(re, de) | 0, M = M + Math.imul(J, Te) | 0, I = I + Math.imul(J, Re) | 0, I = I + Math.imul(ee, Te) | 0, F = F + Math.imul(ee, Re) | 0; var xt = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, M = Math.imul(tt, Xt), I = Math.imul(tt, Dt), I = I + Math.imul(Ye, Xt) | 0, F = Math.imul(Ye, Dt), M = M + Math.imul(at, Ct) | 0, I = I + Math.imul(at, mt) | 0, I = I + Math.imul(ke, Ct) | 0, F = F + Math.imul(ke, mt) | 0, M = M + Math.imul(ze, Nt) | 0, I = I + Math.imul(ze, bt) | 0, I = I + Math.imul(_e, Nt) | 0, F = F + Math.imul(_e, bt) | 0, M = M + Math.imul(Ke, Ft) | 0, I = I + Math.imul(Ke, rt) | 0, I = I + Math.imul(Le, Ft) | 0, F = F + Math.imul(Le, rt) | 0, M = M + Math.imul($e, $) | 0, I = I + Math.imul($e, z) | 0, I = I + Math.imul(Me, $) | 0, F = F + Math.imul(Me, z) | 0, M = M + Math.imul(Pe, C) | 0, I = I + Math.imul(Pe, G) | 0, I = I + Math.imul(De, C) | 0, F = F + Math.imul(De, G) | 0, M = M + Math.imul(ie, se) | 0, I = I + Math.imul(ie, de) | 0, I = I + Math.imul(ue, se) | 0, F = F + Math.imul(ue, de) | 0, M = M + Math.imul(X, Te) | 0, I = I + Math.imul(X, Re) | 0, I = I + Math.imul(re, Te) | 0, F = F + Math.imul(re, Re) | 0; + v = (F + (I >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, M = Math.imul(tt, Xt), I = Math.imul(tt, Dt), I = I + Math.imul(Ye, Xt) | 0, F = Math.imul(Ye, Dt), M = M + Math.imul(at, Ct) | 0, I = I + Math.imul(at, mt) | 0, I = I + Math.imul(ke, Ct) | 0, F = F + Math.imul(ke, mt) | 0, M = M + Math.imul(ze, Nt) | 0, I = I + Math.imul(ze, bt) | 0, I = I + Math.imul(_e, Nt) | 0, F = F + Math.imul(_e, bt) | 0, M = M + Math.imul(Ke, Ft) | 0, I = I + Math.imul(Ke, rt) | 0, I = I + Math.imul(Le, Ft) | 0, F = F + Math.imul(Le, rt) | 0, M = M + Math.imul($e, $) | 0, I = I + Math.imul($e, q) | 0, I = I + Math.imul(Me, $) | 0, F = F + Math.imul(Me, q) | 0, M = M + Math.imul(Pe, C) | 0, I = I + Math.imul(Pe, G) | 0, I = I + Math.imul(De, C) | 0, F = F + Math.imul(De, G) | 0, M = M + Math.imul(ie, se) | 0, I = I + Math.imul(ie, de) | 0, I = I + Math.imul(ue, se) | 0, F = F + Math.imul(ue, de) | 0, M = M + Math.imul(X, Te) | 0, I = I + Math.imul(X, Re) | 0, I = I + Math.imul(re, Te) | 0, F = F + Math.imul(re, Re) | 0; var st = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, M = Math.imul(tt, Ct), I = Math.imul(tt, mt), I = I + Math.imul(Ye, Ct) | 0, F = Math.imul(Ye, mt), M = M + Math.imul(at, Nt) | 0, I = I + Math.imul(at, bt) | 0, I = I + Math.imul(ke, Nt) | 0, F = F + Math.imul(ke, bt) | 0, M = M + Math.imul(ze, Ft) | 0, I = I + Math.imul(ze, rt) | 0, I = I + Math.imul(_e, Ft) | 0, F = F + Math.imul(_e, rt) | 0, M = M + Math.imul(Ke, $) | 0, I = I + Math.imul(Ke, z) | 0, I = I + Math.imul(Le, $) | 0, F = F + Math.imul(Le, z) | 0, M = M + Math.imul($e, C) | 0, I = I + Math.imul($e, G) | 0, I = I + Math.imul(Me, C) | 0, F = F + Math.imul(Me, G) | 0, M = M + Math.imul(Pe, se) | 0, I = I + Math.imul(Pe, de) | 0, I = I + Math.imul(De, se) | 0, F = F + Math.imul(De, de) | 0, M = M + Math.imul(ie, Te) | 0, I = I + Math.imul(ie, Re) | 0, I = I + Math.imul(ue, Te) | 0, F = F + Math.imul(ue, Re) | 0; + v = (F + (I >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, M = Math.imul(tt, Ct), I = Math.imul(tt, mt), I = I + Math.imul(Ye, Ct) | 0, F = Math.imul(Ye, mt), M = M + Math.imul(at, Nt) | 0, I = I + Math.imul(at, bt) | 0, I = I + Math.imul(ke, Nt) | 0, F = F + Math.imul(ke, bt) | 0, M = M + Math.imul(ze, Ft) | 0, I = I + Math.imul(ze, rt) | 0, I = I + Math.imul(_e, Ft) | 0, F = F + Math.imul(_e, rt) | 0, M = M + Math.imul(Ke, $) | 0, I = I + Math.imul(Ke, q) | 0, I = I + Math.imul(Le, $) | 0, F = F + Math.imul(Le, q) | 0, M = M + Math.imul($e, C) | 0, I = I + Math.imul($e, G) | 0, I = I + Math.imul(Me, C) | 0, F = F + Math.imul(Me, G) | 0, M = M + Math.imul(Pe, se) | 0, I = I + Math.imul(Pe, de) | 0, I = I + Math.imul(De, se) | 0, F = F + Math.imul(De, de) | 0, M = M + Math.imul(ie, Te) | 0, I = I + Math.imul(ie, Re) | 0, I = I + Math.imul(ue, Te) | 0, F = F + Math.imul(ue, Re) | 0; var yt = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (yt >>> 26) | 0, yt &= 67108863, M = Math.imul(tt, Nt), I = Math.imul(tt, bt), I = I + Math.imul(Ye, Nt) | 0, F = Math.imul(Ye, bt), M = M + Math.imul(at, Ft) | 0, I = I + Math.imul(at, rt) | 0, I = I + Math.imul(ke, Ft) | 0, F = F + Math.imul(ke, rt) | 0, M = M + Math.imul(ze, $) | 0, I = I + Math.imul(ze, z) | 0, I = I + Math.imul(_e, $) | 0, F = F + Math.imul(_e, z) | 0, M = M + Math.imul(Ke, C) | 0, I = I + Math.imul(Ke, G) | 0, I = I + Math.imul(Le, C) | 0, F = F + Math.imul(Le, G) | 0, M = M + Math.imul($e, se) | 0, I = I + Math.imul($e, de) | 0, I = I + Math.imul(Me, se) | 0, F = F + Math.imul(Me, de) | 0, M = M + Math.imul(Pe, Te) | 0, I = I + Math.imul(Pe, Re) | 0, I = I + Math.imul(De, Te) | 0, F = F + Math.imul(De, Re) | 0; + v = (F + (I >>> 13) | 0) + (yt >>> 26) | 0, yt &= 67108863, M = Math.imul(tt, Nt), I = Math.imul(tt, bt), I = I + Math.imul(Ye, Nt) | 0, F = Math.imul(Ye, bt), M = M + Math.imul(at, Ft) | 0, I = I + Math.imul(at, rt) | 0, I = I + Math.imul(ke, Ft) | 0, F = F + Math.imul(ke, rt) | 0, M = M + Math.imul(ze, $) | 0, I = I + Math.imul(ze, q) | 0, I = I + Math.imul(_e, $) | 0, F = F + Math.imul(_e, q) | 0, M = M + Math.imul(Ke, C) | 0, I = I + Math.imul(Ke, G) | 0, I = I + Math.imul(Le, C) | 0, F = F + Math.imul(Le, G) | 0, M = M + Math.imul($e, se) | 0, I = I + Math.imul($e, de) | 0, I = I + Math.imul(Me, se) | 0, F = F + Math.imul(Me, de) | 0, M = M + Math.imul(Pe, Te) | 0, I = I + Math.imul(Pe, Re) | 0, I = I + Math.imul(De, Te) | 0, F = F + Math.imul(De, Re) | 0; var ut = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, M = Math.imul(tt, Ft), I = Math.imul(tt, rt), I = I + Math.imul(Ye, Ft) | 0, F = Math.imul(Ye, rt), M = M + Math.imul(at, $) | 0, I = I + Math.imul(at, z) | 0, I = I + Math.imul(ke, $) | 0, F = F + Math.imul(ke, z) | 0, M = M + Math.imul(ze, C) | 0, I = I + Math.imul(ze, G) | 0, I = I + Math.imul(_e, C) | 0, F = F + Math.imul(_e, G) | 0, M = M + Math.imul(Ke, se) | 0, I = I + Math.imul(Ke, de) | 0, I = I + Math.imul(Le, se) | 0, F = F + Math.imul(Le, de) | 0, M = M + Math.imul($e, Te) | 0, I = I + Math.imul($e, Re) | 0, I = I + Math.imul(Me, Te) | 0, F = F + Math.imul(Me, Re) | 0; + v = (F + (I >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, M = Math.imul(tt, Ft), I = Math.imul(tt, rt), I = I + Math.imul(Ye, Ft) | 0, F = Math.imul(Ye, rt), M = M + Math.imul(at, $) | 0, I = I + Math.imul(at, q) | 0, I = I + Math.imul(ke, $) | 0, F = F + Math.imul(ke, q) | 0, M = M + Math.imul(ze, C) | 0, I = I + Math.imul(ze, G) | 0, I = I + Math.imul(_e, C) | 0, F = F + Math.imul(_e, G) | 0, M = M + Math.imul(Ke, se) | 0, I = I + Math.imul(Ke, de) | 0, I = I + Math.imul(Le, se) | 0, F = F + Math.imul(Le, de) | 0, M = M + Math.imul($e, Te) | 0, I = I + Math.imul($e, Re) | 0, I = I + Math.imul(Me, Te) | 0, F = F + Math.imul(Me, Re) | 0; var ot = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, M = Math.imul(tt, $), I = Math.imul(tt, z), I = I + Math.imul(Ye, $) | 0, F = Math.imul(Ye, z), M = M + Math.imul(at, C) | 0, I = I + Math.imul(at, G) | 0, I = I + Math.imul(ke, C) | 0, F = F + Math.imul(ke, G) | 0, M = M + Math.imul(ze, se) | 0, I = I + Math.imul(ze, de) | 0, I = I + Math.imul(_e, se) | 0, F = F + Math.imul(_e, de) | 0, M = M + Math.imul(Ke, Te) | 0, I = I + Math.imul(Ke, Re) | 0, I = I + Math.imul(Le, Te) | 0, F = F + Math.imul(Le, Re) | 0; + v = (F + (I >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, M = Math.imul(tt, $), I = Math.imul(tt, q), I = I + Math.imul(Ye, $) | 0, F = Math.imul(Ye, q), M = M + Math.imul(at, C) | 0, I = I + Math.imul(at, G) | 0, I = I + Math.imul(ke, C) | 0, F = F + Math.imul(ke, G) | 0, M = M + Math.imul(ze, se) | 0, I = I + Math.imul(ze, de) | 0, I = I + Math.imul(_e, se) | 0, F = F + Math.imul(_e, de) | 0, M = M + Math.imul(Ke, Te) | 0, I = I + Math.imul(Ke, Re) | 0, I = I + Math.imul(Le, Te) | 0, F = F + Math.imul(Le, Re) | 0; var Se = (v + M | 0) + ((I & 8191) << 13) | 0; v = (F + (I >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, M = Math.imul(tt, C), I = Math.imul(tt, G), I = I + Math.imul(Ye, C) | 0, F = Math.imul(Ye, G), M = M + Math.imul(at, se) | 0, I = I + Math.imul(at, de) | 0, I = I + Math.imul(ke, se) | 0, F = F + Math.imul(ke, de) | 0, M = M + Math.imul(ze, Te) | 0, I = I + Math.imul(ze, Re) | 0, I = I + Math.imul(_e, Te) | 0, F = F + Math.imul(_e, Re) | 0; var Ae = (v + M | 0) + ((I & 8191) << 13) | 0; @@ -9953,7 +9961,7 @@ ib.exports; return v = (F + (I >>> 13) | 0) + (Fe >>> 26) | 0, Fe &= 67108863, S[0] = nt, S[1] = je, S[2] = pt, S[3] = it, S[4] = et, S[5] = St, S[6] = Tt, S[7] = At, S[8] = _t, S[9] = ht, S[10] = xt, S[11] = st, S[12] = yt, S[13] = ut, S[14] = ot, S[15] = Se, S[16] = Ae, S[17] = Ve, S[18] = Fe, v !== 0 && (S[19] = v, b.length++), b; }; Math.imul || (k = B); - function q(m, f, g) { + function W(m, f, g) { g.negative = f.negative ^ m.negative, g.length = m.length + f.length; for (var b = 0, x = 0, E = 0; E < g.length - 1; E++) { var S = x; @@ -9967,11 +9975,11 @@ ib.exports; return b !== 0 ? g.words[E] = b : g.length--, g._strip(); } function U(m, f, g) { - return q(m, f, g); + return W(m, f, g); } s.prototype.mulTo = function(f, g) { var b, x = this.length + f.length; - return this.length === 10 && f.length === 10 ? b = k(this, f, g) : x < 63 ? b = B(this, f, g) : x < 1024 ? b = q(this, f, g) : b = U(this, f, g), b; + return this.length === 10 && f.length === 10 ? b = k(this, f, g) : x < 63 ? b = B(this, f, g) : x < 1024 ? b = W(this, f, g) : b = U(this, f, g), b; }, s.prototype.mul = function(f) { var g = new s(null); return g.words = new Array(this.length + f.length), this.mulTo(f, g); @@ -10575,13 +10583,13 @@ ib.exports; }; })(t, gn); })(ib); -var lj = ib.exports; -const sr = /* @__PURE__ */ ns(lj); -var hj = sr.BN; -function dj(t) { - return new hj(t, 36).toString(16); +var hj = ib.exports; +const sr = /* @__PURE__ */ ns(hj); +var dj = sr.BN; +function pj(t) { + return new dj(t, 36).toString(16); } -const pj = "strings/5.7.0", gj = new Yr(pj); +const gj = "strings/5.7.0", mj = new Yr(gj); var p0; (function(t) { t.current = "", t.NFC = "NFC", t.NFD = "NFD", t.NFKC = "NFKC", t.NFKD = "NFKD"; @@ -10591,7 +10599,7 @@ var Lx; t.UNEXPECTED_CONTINUE = "unexpected continuation byte", t.BAD_PREFIX = "bad codepoint prefix", t.OVERRUN = "string overrun", t.MISSING_CONTINUE = "missing continuation byte", t.OUT_OF_RANGE = "out of UTF-8 range", t.UTF16_SURROGATE = "UTF-16 surrogate", t.OVERLONG = "overlong representation"; })(Lx || (Lx = {})); function pm(t, e = p0.current) { - e != p0.current && (gj.checkNormalize(), t = t.normalize(e)); + e != p0.current && (mj.checkNormalize(), t = t.normalize(e)); let r = []; for (let n = 0; n < t.length; n++) { const i = t.charCodeAt(n); @@ -10611,18 +10619,18 @@ function pm(t, e = p0.current) { } return wn(r); } -const mj = `Ethereum Signed Message: +const vj = `Ethereum Signed Message: `; function _8(t) { - return typeof t == "string" && (t = pm(t)), nb(cj([ - pm(mj), + return typeof t == "string" && (t = pm(t)), nb(uj([ + pm(vj), pm(String(t.length)), t ])); } -const vj = "address/5.7.0", Wf = new Yr(vj); +const bj = "address/5.7.0", Hf = new Yr(bj); function kx(t) { - Ks(t, 20) || Wf.throwArgumentError("invalid address", "address", t), t = t.toLowerCase(); + Ks(t, 20) || Hf.throwArgumentError("invalid address", "address", t), t = t.toLowerCase(); const e = t.substring(2).split(""), r = new Uint8Array(40); for (let i = 0; i < 40; i++) r[i] = e[i].charCodeAt(0); @@ -10631,8 +10639,8 @@ function kx(t) { n[i >> 1] >> 4 >= 8 && (e[i] = e[i].toUpperCase()), (n[i >> 1] & 15) >= 8 && (e[i + 1] = e[i + 1].toUpperCase()); return "0x" + e.join(""); } -const bj = 9007199254740991; -function yj(t) { +const yj = 9007199254740991; +function wj(t) { return Math.log10 ? Math.log10(t) : Math.log(t) / Math.LN10; } const sb = {}; @@ -10640,8 +10648,8 @@ for (let t = 0; t < 10; t++) sb[String(t)] = String(t); for (let t = 0; t < 26; t++) sb[String.fromCharCode(65 + t)] = String(10 + t); -const $x = Math.floor(yj(bj)); -function wj(t) { +const $x = Math.floor(wj(yj)); +function xj(t) { t = t.toUpperCase(), t = t.substring(4) + t.substring(0, 2) + "00"; let e = t.split("").map((n) => sb[n]).join(""); for (; e.length >= $x; ) { @@ -10653,19 +10661,19 @@ function wj(t) { r = "0" + r; return r; } -function xj(t) { +function _j(t) { let e = null; - if (typeof t != "string" && Wf.throwArgumentError("invalid address", "address", t), t.match(/^(0x)?[0-9a-fA-F]{40}$/)) - t.substring(0, 2) !== "0x" && (t = "0x" + t), e = kx(t), t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && e !== t && Wf.throwArgumentError("bad address checksum", "address", t); + if (typeof t != "string" && Hf.throwArgumentError("invalid address", "address", t), t.match(/^(0x)?[0-9a-fA-F]{40}$/)) + t.substring(0, 2) !== "0x" && (t = "0x" + t), e = kx(t), t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && e !== t && Hf.throwArgumentError("bad address checksum", "address", t); else if (t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { - for (t.substring(2, 4) !== wj(t) && Wf.throwArgumentError("bad icap checksum", "address", t), e = dj(t.substring(4)); e.length < 40; ) + for (t.substring(2, 4) !== xj(t) && Hf.throwArgumentError("bad icap checksum", "address", t), e = pj(t.substring(4)); e.length < 40; ) e = "0" + e; e = kx("0x" + e); } else - Wf.throwArgumentError("invalid address", "address", t); + Hf.throwArgumentError("invalid address", "address", t); return e; } -function Cf(t, e, r) { +function Tf(t, e, r) { Object.defineProperty(t, e, { enumerable: !0, value: r, @@ -10699,12 +10707,12 @@ typeof Object.create == "function" ? k1.exports = function(e, r) { n.prototype = r.prototype, e.prototype = new n(), e.prototype.constructor = e; } }; -var np = k1.exports, _j = Tc, Ej = np; -_r.inherits = Ej; -function Sj(t, e) { +var np = k1.exports, Ej = Tc, Sj = np; +_r.inherits = Sj; +function Aj(t, e) { return (t.charCodeAt(e) & 64512) !== 55296 || e < 0 || e + 1 >= t.length ? !1 : (t.charCodeAt(e + 1) & 64512) === 56320; } -function Aj(t, e) { +function Pj(t, e) { if (Array.isArray(t)) return t.slice(); if (!t) @@ -10717,33 +10725,33 @@ function Aj(t, e) { r.push(parseInt(t[i] + t[i + 1], 16)); } else for (var n = 0, i = 0; i < t.length; i++) { var s = t.charCodeAt(i); - s < 128 ? r[n++] = s : s < 2048 ? (r[n++] = s >> 6 | 192, r[n++] = s & 63 | 128) : Sj(t, i) ? (s = 65536 + ((s & 1023) << 10) + (t.charCodeAt(++i) & 1023), r[n++] = s >> 18 | 240, r[n++] = s >> 12 & 63 | 128, r[n++] = s >> 6 & 63 | 128, r[n++] = s & 63 | 128) : (r[n++] = s >> 12 | 224, r[n++] = s >> 6 & 63 | 128, r[n++] = s & 63 | 128); + s < 128 ? r[n++] = s : s < 2048 ? (r[n++] = s >> 6 | 192, r[n++] = s & 63 | 128) : Aj(t, i) ? (s = 65536 + ((s & 1023) << 10) + (t.charCodeAt(++i) & 1023), r[n++] = s >> 18 | 240, r[n++] = s >> 12 & 63 | 128, r[n++] = s >> 6 & 63 | 128, r[n++] = s & 63 | 128) : (r[n++] = s >> 12 | 224, r[n++] = s >> 6 & 63 | 128, r[n++] = s & 63 | 128); } else for (i = 0; i < t.length; i++) r[i] = t[i] | 0; return r; } -_r.toArray = Aj; -function Pj(t) { +_r.toArray = Pj; +function Mj(t) { for (var e = "", r = 0; r < t.length; r++) e += A8(t[r].toString(16)); return e; } -_r.toHex = Pj; +_r.toHex = Mj; function S8(t) { var e = t >>> 24 | t >>> 8 & 65280 | t << 8 & 16711680 | (t & 255) << 24; return e >>> 0; } _r.htonl = S8; -function Mj(t, e) { +function Ij(t, e) { for (var r = "", n = 0; n < t.length; n++) { var i = t[n]; e === "little" && (i = S8(i)), r += P8(i.toString(16)); } return r; } -_r.toHex32 = Mj; +_r.toHex32 = Ij; function A8(t) { return t.length === 1 ? "0" + t : t; } @@ -10752,111 +10760,111 @@ function P8(t) { return t.length === 7 ? "0" + t : t.length === 6 ? "00" + t : t.length === 5 ? "000" + t : t.length === 4 ? "0000" + t : t.length === 3 ? "00000" + t : t.length === 2 ? "000000" + t : t.length === 1 ? "0000000" + t : t; } _r.zero8 = P8; -function Ij(t, e, r, n) { +function Cj(t, e, r, n) { var i = r - e; - _j(i % 4 === 0); + Ej(i % 4 === 0); for (var s = new Array(i / 4), o = 0, a = e; o < s.length; o++, a += 4) { var u; n === "big" ? u = t[a] << 24 | t[a + 1] << 16 | t[a + 2] << 8 | t[a + 3] : u = t[a + 3] << 24 | t[a + 2] << 16 | t[a + 1] << 8 | t[a], s[o] = u >>> 0; } return s; } -_r.join32 = Ij; -function Cj(t, e) { +_r.join32 = Cj; +function Tj(t, e) { for (var r = new Array(t.length * 4), n = 0, i = 0; n < t.length; n++, i += 4) { var s = t[n]; e === "big" ? (r[i] = s >>> 24, r[i + 1] = s >>> 16 & 255, r[i + 2] = s >>> 8 & 255, r[i + 3] = s & 255) : (r[i + 3] = s >>> 24, r[i + 2] = s >>> 16 & 255, r[i + 1] = s >>> 8 & 255, r[i] = s & 255); } return r; } -_r.split32 = Cj; -function Tj(t, e) { +_r.split32 = Tj; +function Rj(t, e) { return t >>> e | t << 32 - e; } -_r.rotr32 = Tj; -function Rj(t, e) { +_r.rotr32 = Rj; +function Dj(t, e) { return t << e | t >>> 32 - e; } -_r.rotl32 = Rj; -function Dj(t, e) { +_r.rotl32 = Dj; +function Oj(t, e) { return t + e >>> 0; } -_r.sum32 = Dj; -function Oj(t, e, r) { +_r.sum32 = Oj; +function Nj(t, e, r) { return t + e + r >>> 0; } -_r.sum32_3 = Oj; -function Nj(t, e, r, n) { +_r.sum32_3 = Nj; +function Lj(t, e, r, n) { return t + e + r + n >>> 0; } -_r.sum32_4 = Nj; -function Lj(t, e, r, n, i) { +_r.sum32_4 = Lj; +function kj(t, e, r, n, i) { return t + e + r + n + i >>> 0; } -_r.sum32_5 = Lj; -function kj(t, e, r, n) { +_r.sum32_5 = kj; +function $j(t, e, r, n) { var i = t[e], s = t[e + 1], o = n + s >>> 0, a = (o < n ? 1 : 0) + r + i; t[e] = a >>> 0, t[e + 1] = o; } -_r.sum64 = kj; -function $j(t, e, r, n) { +_r.sum64 = $j; +function Bj(t, e, r, n) { var i = e + n >>> 0, s = (i < e ? 1 : 0) + t + r; return s >>> 0; } -_r.sum64_hi = $j; -function Bj(t, e, r, n) { +_r.sum64_hi = Bj; +function Fj(t, e, r, n) { var i = e + n; return i >>> 0; } -_r.sum64_lo = Bj; -function Fj(t, e, r, n, i, s, o, a) { +_r.sum64_lo = Fj; +function jj(t, e, r, n, i, s, o, a) { var u = 0, l = e; l = l + n >>> 0, u += l < e ? 1 : 0, l = l + s >>> 0, u += l < s ? 1 : 0, l = l + a >>> 0, u += l < a ? 1 : 0; var d = t + r + i + o + u; return d >>> 0; } -_r.sum64_4_hi = Fj; -function jj(t, e, r, n, i, s, o, a) { +_r.sum64_4_hi = jj; +function Uj(t, e, r, n, i, s, o, a) { var u = e + n + s + a; return u >>> 0; } -_r.sum64_4_lo = jj; -function Uj(t, e, r, n, i, s, o, a, u, l) { +_r.sum64_4_lo = Uj; +function qj(t, e, r, n, i, s, o, a, u, l) { var d = 0, p = e; p = p + n >>> 0, d += p < e ? 1 : 0, p = p + s >>> 0, d += p < s ? 1 : 0, p = p + a >>> 0, d += p < a ? 1 : 0, p = p + l >>> 0, d += p < l ? 1 : 0; var w = t + r + i + o + u + d; return w >>> 0; } -_r.sum64_5_hi = Uj; -function qj(t, e, r, n, i, s, o, a, u, l) { +_r.sum64_5_hi = qj; +function zj(t, e, r, n, i, s, o, a, u, l) { var d = e + n + s + a + l; return d >>> 0; } -_r.sum64_5_lo = qj; -function zj(t, e, r) { +_r.sum64_5_lo = zj; +function Wj(t, e, r) { var n = e << 32 - r | t >>> r; return n >>> 0; } -_r.rotr64_hi = zj; -function Wj(t, e, r) { +_r.rotr64_hi = Wj; +function Hj(t, e, r) { var n = t << 32 - r | e >>> r; return n >>> 0; } -_r.rotr64_lo = Wj; -function Hj(t, e, r) { +_r.rotr64_lo = Hj; +function Kj(t, e, r) { return t >>> r; } -_r.shr64_hi = Hj; -function Kj(t, e, r) { +_r.shr64_hi = Kj; +function Vj(t, e, r) { var n = t << 32 - r | e >>> r; return n >>> 0; } -_r.shr64_lo = Kj; -var qu = {}, Bx = _r, Vj = Tc; +_r.shr64_lo = Vj; +var zu = {}, Bx = _r, Gj = Tc; function ip() { this.pending = null, this.pendingTotal = 0, this.blockSize = this.constructor.blockSize, this.outSize = this.constructor.outSize, this.hmacStrength = this.constructor.hmacStrength, this.padLength = this.constructor.padLength / 8, this.endian = "big", this._delta8 = this.blockSize / 8, this._delta32 = this.blockSize / 32; } -qu.BlockHash = ip; +zu.BlockHash = ip; ip.prototype.update = function(e, r) { if (e = Bx.toArray(e, r), this.pending ? this.pending = this.pending.concat(e) : this.pending = e, this.pendingTotal += e.length, this.pending.length >= this._delta8) { e = this.pending; @@ -10868,7 +10876,7 @@ ip.prototype.update = function(e, r) { return this; }; ip.prototype.digest = function(e) { - return this.update(this._pad()), Vj(this.pending === null), this._digest(e); + return this.update(this._pad()), Gj(this.pending === null), this._digest(e); }; ip.prototype._pad = function() { var e = this.pendingTotal, r = this._delta8, n = r - (e + this.padLength) % r, i = new Array(n + this.padLength); @@ -10884,8 +10892,8 @@ ip.prototype._pad = function() { i[s++] = 0; return i; }; -var zu = {}, so = {}, Gj = _r, Vs = Gj.rotr32; -function Yj(t, e, r, n) { +var Wu = {}, so = {}, Yj = _r, Vs = Yj.rotr32; +function Jj(t, e, r, n) { if (t === 0) return M8(e, r, n); if (t === 1 || t === 3) @@ -10893,7 +10901,7 @@ function Yj(t, e, r, n) { if (t === 2) return I8(e, r, n); } -so.ft_1 = Yj; +so.ft_1 = Jj; function M8(t, e, r) { return t & e ^ ~t & r; } @@ -10906,23 +10914,23 @@ function C8(t, e, r) { return t ^ e ^ r; } so.p32 = C8; -function Jj(t) { +function Xj(t) { return Vs(t, 2) ^ Vs(t, 13) ^ Vs(t, 22); } -so.s0_256 = Jj; -function Xj(t) { +so.s0_256 = Xj; +function Zj(t) { return Vs(t, 6) ^ Vs(t, 11) ^ Vs(t, 25); } -so.s1_256 = Xj; -function Zj(t) { +so.s1_256 = Zj; +function Qj(t) { return Vs(t, 7) ^ Vs(t, 18) ^ t >>> 3; } -so.g0_256 = Zj; -function Qj(t) { +so.g0_256 = Qj; +function eU(t) { return Vs(t, 17) ^ Vs(t, 19) ^ t >>> 10; } -so.g1_256 = Qj; -var Ru = _r, eU = qu, tU = so, gm = Ru.rotl32, Tf = Ru.sum32, rU = Ru.sum32_5, nU = tU.ft_1, T8 = eU.BlockHash, iU = [ +so.g1_256 = eU; +var Du = _r, tU = zu, rU = so, gm = Du.rotl32, Rf = Du.sum32, nU = Du.sum32_5, iU = rU.ft_1, T8 = tU.BlockHash, sU = [ 1518500249, 1859775393, 2400959708, @@ -10939,8 +10947,8 @@ function Qs() { 3285377520 ], this.W = new Array(80); } -Ru.inherits(Qs, T8); -var sU = Qs; +Du.inherits(Qs, T8); +var oU = Qs; Qs.blockSize = 512; Qs.outSize = 160; Qs.hmacStrength = 80; @@ -10952,15 +10960,15 @@ Qs.prototype._update = function(e, r) { n[i] = gm(n[i - 3] ^ n[i - 8] ^ n[i - 14] ^ n[i - 16], 1); var s = this.h[0], o = this.h[1], a = this.h[2], u = this.h[3], l = this.h[4]; for (i = 0; i < n.length; i++) { - var d = ~~(i / 20), p = rU(gm(s, 5), nU(d, o, a, u), l, n[i], iU[d]); + var d = ~~(i / 20), p = nU(gm(s, 5), iU(d, o, a, u), l, n[i], sU[d]); l = u, u = a, a = gm(o, 30), o = s, s = p; } - this.h[0] = Tf(this.h[0], s), this.h[1] = Tf(this.h[1], o), this.h[2] = Tf(this.h[2], a), this.h[3] = Tf(this.h[3], u), this.h[4] = Tf(this.h[4], l); + this.h[0] = Rf(this.h[0], s), this.h[1] = Rf(this.h[1], o), this.h[2] = Rf(this.h[2], a), this.h[3] = Rf(this.h[3], u), this.h[4] = Rf(this.h[4], l); }; Qs.prototype._digest = function(e) { - return e === "hex" ? Ru.toHex32(this.h, "big") : Ru.split32(this.h, "big"); + return e === "hex" ? Du.toHex32(this.h, "big") : Du.split32(this.h, "big"); }; -var Du = _r, oU = qu, Wu = so, aU = Tc, bs = Du.sum32, cU = Du.sum32_4, uU = Du.sum32_5, fU = Wu.ch32, lU = Wu.maj32, hU = Wu.s0_256, dU = Wu.s1_256, pU = Wu.g0_256, gU = Wu.g1_256, R8 = oU.BlockHash, mU = [ +var Ou = _r, aU = zu, Hu = so, cU = Tc, bs = Ou.sum32, uU = Ou.sum32_4, fU = Ou.sum32_5, lU = Hu.ch32, hU = Hu.maj32, dU = Hu.s0_256, pU = Hu.s1_256, gU = Hu.g0_256, mU = Hu.g1_256, R8 = aU.BlockHash, vU = [ 1116352408, 1899447441, 3049323471, @@ -11038,9 +11046,9 @@ function eo() { 2600822924, 528734635, 1541459225 - ], this.k = mU, this.W = new Array(64); + ], this.k = vU, this.W = new Array(64); } -Du.inherits(eo, R8); +Ou.inherits(eo, R8); var D8 = eo; eo.blockSize = 512; eo.outSize = 256; @@ -11050,16 +11058,16 @@ eo.prototype._update = function(e, r) { for (var n = this.W, i = 0; i < 16; i++) n[i] = e[r + i]; for (; i < n.length; i++) - n[i] = cU(gU(n[i - 2]), n[i - 7], pU(n[i - 15]), n[i - 16]); + n[i] = uU(mU(n[i - 2]), n[i - 7], gU(n[i - 15]), n[i - 16]); var s = this.h[0], o = this.h[1], a = this.h[2], u = this.h[3], l = this.h[4], d = this.h[5], p = this.h[6], w = this.h[7]; - for (aU(this.k.length === n.length), i = 0; i < n.length; i++) { - var _ = uU(w, dU(l), fU(l, d, p), this.k[i], n[i]), P = bs(hU(s), lU(s, o, a)); + for (cU(this.k.length === n.length), i = 0; i < n.length; i++) { + var _ = fU(w, pU(l), lU(l, d, p), this.k[i], n[i]), P = bs(dU(s), hU(s, o, a)); w = p, p = d, d = l, l = bs(u, _), u = a, a = o, o = s, s = bs(_, P); } this.h[0] = bs(this.h[0], s), this.h[1] = bs(this.h[1], o), this.h[2] = bs(this.h[2], a), this.h[3] = bs(this.h[3], u), this.h[4] = bs(this.h[4], l), this.h[5] = bs(this.h[5], d), this.h[6] = bs(this.h[6], p), this.h[7] = bs(this.h[7], w); }; eo.prototype._digest = function(e) { - return e === "hex" ? Du.toHex32(this.h, "big") : Du.split32(this.h, "big"); + return e === "hex" ? Ou.toHex32(this.h, "big") : Ou.split32(this.h, "big"); }; var $1 = _r, O8 = D8; function qo() { @@ -11077,7 +11085,7 @@ function qo() { ]; } $1.inherits(qo, O8); -var vU = qo; +var bU = qo; qo.blockSize = 512; qo.outSize = 224; qo.hmacStrength = 192; @@ -11085,7 +11093,7 @@ qo.padLength = 64; qo.prototype._digest = function(e) { return e === "hex" ? $1.toHex32(this.h.slice(0, 7), "big") : $1.split32(this.h.slice(0, 7), "big"); }; -var Ei = _r, bU = qu, yU = Tc, Gs = Ei.rotr64_hi, Ys = Ei.rotr64_lo, N8 = Ei.shr64_hi, L8 = Ei.shr64_lo, na = Ei.sum64, mm = Ei.sum64_hi, vm = Ei.sum64_lo, wU = Ei.sum64_4_hi, xU = Ei.sum64_4_lo, _U = Ei.sum64_5_hi, EU = Ei.sum64_5_lo, k8 = bU.BlockHash, SU = [ +var Ei = _r, yU = zu, wU = Tc, Gs = Ei.rotr64_hi, Ys = Ei.rotr64_lo, N8 = Ei.shr64_hi, L8 = Ei.shr64_lo, na = Ei.sum64, mm = Ei.sum64_hi, vm = Ei.sum64_lo, xU = Ei.sum64_4_hi, _U = Ei.sum64_4_lo, EU = Ei.sum64_5_hi, SU = Ei.sum64_5_lo, k8 = yU.BlockHash, AU = [ 1116352408, 3609767458, 1899447441, @@ -11267,7 +11275,7 @@ function Is() { 4215389547, 1541459225, 327033209 - ], this.k = SU, this.W = new Array(160); + ], this.k = AU, this.W = new Array(160); } Ei.inherits(Is, k8); var $8 = Is; @@ -11279,8 +11287,8 @@ Is.prototype._prepareBlock = function(e, r) { for (var n = this.W, i = 0; i < 32; i++) n[i] = e[r + i]; for (; i < n.length; i += 2) { - var s = LU(n[i - 4], n[i - 3]), o = kU(n[i - 4], n[i - 3]), a = n[i - 14], u = n[i - 13], l = OU(n[i - 30], n[i - 29]), d = NU(n[i - 30], n[i - 29]), p = n[i - 32], w = n[i - 31]; - n[i] = wU( + var s = kU(n[i - 4], n[i - 3]), o = $U(n[i - 4], n[i - 3]), a = n[i - 14], u = n[i - 13], l = NU(n[i - 30], n[i - 29]), d = LU(n[i - 30], n[i - 29]), p = n[i - 32], w = n[i - 31]; + n[i] = xU( s, o, a, @@ -11289,7 +11297,7 @@ Is.prototype._prepareBlock = function(e, r) { d, p, w - ), n[i + 1] = xU( + ), n[i + 1] = _U( s, o, a, @@ -11303,10 +11311,10 @@ Is.prototype._prepareBlock = function(e, r) { }; Is.prototype._update = function(e, r) { this._prepareBlock(e, r); - var n = this.W, i = this.h[0], s = this.h[1], o = this.h[2], a = this.h[3], u = this.h[4], l = this.h[5], d = this.h[6], p = this.h[7], w = this.h[8], _ = this.h[9], P = this.h[10], O = this.h[11], L = this.h[12], B = this.h[13], k = this.h[14], q = this.h[15]; - yU(this.k.length === n.length); + var n = this.W, i = this.h[0], s = this.h[1], o = this.h[2], a = this.h[3], u = this.h[4], l = this.h[5], d = this.h[6], p = this.h[7], w = this.h[8], _ = this.h[9], P = this.h[10], O = this.h[11], L = this.h[12], B = this.h[13], k = this.h[14], W = this.h[15]; + wU(this.k.length === n.length); for (var U = 0; U < n.length; U += 2) { - var V = k, Q = q, R = RU(w, _), K = DU(w, _), ge = AU(w, _, P, O, L), Ee = PU(w, _, P, O, L, B), Y = this.k[U], A = this.k[U + 1], m = n[U], f = n[U + 1], g = _U( + var V = k, Q = W, R = DU(w, _), K = OU(w, _), ge = PU(w, _, P, O, L), Ee = MU(w, _, P, O, L, B), Y = this.k[U], A = this.k[U + 1], m = n[U], f = n[U + 1], g = EU( V, Q, R, @@ -11317,7 +11325,7 @@ Is.prototype._update = function(e, r) { A, m, f - ), b = EU( + ), b = SU( V, Q, R, @@ -11329,60 +11337,60 @@ Is.prototype._update = function(e, r) { m, f ); - V = CU(i, s), Q = TU(i, s), R = MU(i, s, o, a, u), K = IU(i, s, o, a, u, l); + V = TU(i, s), Q = RU(i, s), R = IU(i, s, o, a, u), K = CU(i, s, o, a, u, l); var x = mm(V, Q, R, K), E = vm(V, Q, R, K); - k = L, q = B, L = P, B = O, P = w, O = _, w = mm(d, p, g, b), _ = vm(p, p, g, b), d = u, p = l, u = o, l = a, o = i, a = s, i = mm(g, b, x, E), s = vm(g, b, x, E); + k = L, W = B, L = P, B = O, P = w, O = _, w = mm(d, p, g, b), _ = vm(p, p, g, b), d = u, p = l, u = o, l = a, o = i, a = s, i = mm(g, b, x, E), s = vm(g, b, x, E); } - na(this.h, 0, i, s), na(this.h, 2, o, a), na(this.h, 4, u, l), na(this.h, 6, d, p), na(this.h, 8, w, _), na(this.h, 10, P, O), na(this.h, 12, L, B), na(this.h, 14, k, q); + na(this.h, 0, i, s), na(this.h, 2, o, a), na(this.h, 4, u, l), na(this.h, 6, d, p), na(this.h, 8, w, _), na(this.h, 10, P, O), na(this.h, 12, L, B), na(this.h, 14, k, W); }; Is.prototype._digest = function(e) { return e === "hex" ? Ei.toHex32(this.h, "big") : Ei.split32(this.h, "big"); }; -function AU(t, e, r, n, i) { +function PU(t, e, r, n, i) { var s = t & r ^ ~t & i; return s < 0 && (s += 4294967296), s; } -function PU(t, e, r, n, i, s) { +function MU(t, e, r, n, i, s) { var o = e & n ^ ~e & s; return o < 0 && (o += 4294967296), o; } -function MU(t, e, r, n, i) { +function IU(t, e, r, n, i) { var s = t & r ^ t & i ^ r & i; return s < 0 && (s += 4294967296), s; } -function IU(t, e, r, n, i, s) { +function CU(t, e, r, n, i, s) { var o = e & n ^ e & s ^ n & s; return o < 0 && (o += 4294967296), o; } -function CU(t, e) { +function TU(t, e) { var r = Gs(t, e, 28), n = Gs(e, t, 2), i = Gs(e, t, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function TU(t, e) { +function RU(t, e) { var r = Ys(t, e, 28), n = Ys(e, t, 2), i = Ys(e, t, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function RU(t, e) { +function DU(t, e) { var r = Gs(t, e, 14), n = Gs(t, e, 18), i = Gs(e, t, 9), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function DU(t, e) { +function OU(t, e) { var r = Ys(t, e, 14), n = Ys(t, e, 18), i = Ys(e, t, 9), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function OU(t, e) { +function NU(t, e) { var r = Gs(t, e, 1), n = Gs(t, e, 8), i = N8(t, e, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function NU(t, e) { +function LU(t, e) { var r = Ys(t, e, 1), n = Ys(t, e, 8), i = L8(t, e, 7), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function LU(t, e) { +function kU(t, e) { var r = Gs(t, e, 19), n = Gs(e, t, 29), i = N8(t, e, 6), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } -function kU(t, e) { +function $U(t, e) { var r = Ys(t, e, 19), n = Ys(e, t, 29), i = L8(t, e, 6), s = r ^ n ^ i; return s < 0 && (s += 4294967296), s; } @@ -11410,7 +11418,7 @@ function zo() { ]; } B1.inherits(zo, B8); -var $U = zo; +var BU = zo; zo.blockSize = 1024; zo.outSize = 384; zo.hmacStrength = 192; @@ -11418,12 +11426,12 @@ zo.padLength = 128; zo.prototype._digest = function(e) { return e === "hex" ? B1.toHex32(this.h.slice(0, 12), "big") : B1.split32(this.h.slice(0, 12), "big"); }; -zu.sha1 = sU; -zu.sha224 = vU; -zu.sha256 = D8; -zu.sha384 = $U; -zu.sha512 = $8; -var F8 = {}, yc = _r, BU = qu, wd = yc.rotl32, Fx = yc.sum32, Rf = yc.sum32_3, jx = yc.sum32_4, j8 = BU.BlockHash; +Wu.sha1 = oU; +Wu.sha224 = bU; +Wu.sha256 = D8; +Wu.sha384 = BU; +Wu.sha512 = $8; +var F8 = {}, yc = _r, FU = zu, wd = yc.rotl32, Fx = yc.sum32, Df = yc.sum32_3, jx = yc.sum32_4, j8 = FU.BlockHash; function to() { if (!(this instanceof to)) return new to(); @@ -11439,20 +11447,20 @@ to.prototype._update = function(e, r) { for (var n = this.h[0], i = this.h[1], s = this.h[2], o = this.h[3], a = this.h[4], u = n, l = i, d = s, p = o, w = a, _ = 0; _ < 80; _++) { var P = Fx( wd( - jx(n, Ux(_, i, s, o), e[UU[_] + r], FU(_)), - zU[_] + jx(n, Ux(_, i, s, o), e[qU[_] + r], jU(_)), + WU[_] ), a ); n = a, a = o, o = wd(s, 10), s = i, i = P, P = Fx( wd( - jx(u, Ux(79 - _, l, d, p), e[qU[_] + r], jU(_)), - WU[_] + jx(u, Ux(79 - _, l, d, p), e[zU[_] + r], UU(_)), + HU[_] ), w ), u = w, w = p, p = wd(d, 10), d = l, l = P; } - P = Rf(this.h[1], s, p), this.h[1] = Rf(this.h[2], o, w), this.h[2] = Rf(this.h[3], a, u), this.h[3] = Rf(this.h[4], n, l), this.h[4] = Rf(this.h[0], i, d), this.h[0] = P; + P = Df(this.h[1], s, p), this.h[1] = Df(this.h[2], o, w), this.h[2] = Df(this.h[3], a, u), this.h[3] = Df(this.h[4], n, l), this.h[4] = Df(this.h[0], i, d), this.h[0] = P; }; to.prototype._digest = function(e) { return e === "hex" ? yc.toHex32(this.h, "little") : yc.split32(this.h, "little"); @@ -11460,13 +11468,13 @@ to.prototype._digest = function(e) { function Ux(t, e, r, n) { return t <= 15 ? e ^ r ^ n : t <= 31 ? e & r | ~e & n : t <= 47 ? (e | ~r) ^ n : t <= 63 ? e & n | r & ~n : e ^ (r | ~n); } -function FU(t) { +function jU(t) { return t <= 15 ? 0 : t <= 31 ? 1518500249 : t <= 47 ? 1859775393 : t <= 63 ? 2400959708 : 2840853838; } -function jU(t) { +function UU(t) { return t <= 15 ? 1352829926 : t <= 31 ? 1548603684 : t <= 47 ? 1836072691 : t <= 63 ? 2053994217 : 0; } -var UU = [ +var qU = [ 0, 1, 2, @@ -11547,7 +11555,7 @@ var UU = [ 6, 15, 13 -], qU = [ +], zU = [ 5, 14, 7, @@ -11628,7 +11636,7 @@ var UU = [ 3, 9, 11 -], zU = [ +], WU = [ 11, 14, 15, @@ -11709,7 +11717,7 @@ var UU = [ 8, 5, 6 -], WU = [ +], HU = [ 8, 9, 9, @@ -11790,15 +11798,15 @@ var UU = [ 13, 11, 11 -], HU = _r, KU = Tc; -function Ou(t, e, r) { - if (!(this instanceof Ou)) - return new Ou(t, e, r); - this.Hash = t, this.blockSize = t.blockSize / 8, this.outSize = t.outSize / 8, this.inner = null, this.outer = null, this._init(HU.toArray(e, r)); -} -var VU = Ou; -Ou.prototype._init = function(e) { - e.length > this.blockSize && (e = new this.Hash().update(e).digest()), KU(e.length <= this.blockSize); +], KU = _r, VU = Tc; +function Nu(t, e, r) { + if (!(this instanceof Nu)) + return new Nu(t, e, r); + this.Hash = t, this.blockSize = t.blockSize / 8, this.outSize = t.outSize / 8, this.inner = null, this.outer = null, this._init(KU.toArray(e, r)); +} +var GU = Nu; +Nu.prototype._init = function(e) { + e.length > this.blockSize && (e = new this.Hash().update(e).digest()), VU(e.length <= this.blockSize); for (var r = e.length; r < this.blockSize; r++) e.push(0); for (r = 0; r < e.length; r++) @@ -11807,27 +11815,27 @@ Ou.prototype._init = function(e) { e[r] ^= 106; this.outer = new this.Hash().update(e); }; -Ou.prototype.update = function(e, r) { +Nu.prototype.update = function(e, r) { return this.inner.update(e, r), this; }; -Ou.prototype.digest = function(e) { +Nu.prototype.digest = function(e) { return this.outer.update(this.inner.digest()), this.outer.digest(e); }; (function(t) { var e = t; - e.utils = _r, e.common = qu, e.sha = zu, e.ripemd = F8, e.hmac = VU, e.sha1 = e.sha.sha1, e.sha256 = e.sha.sha256, e.sha224 = e.sha.sha224, e.sha384 = e.sha.sha384, e.sha512 = e.sha.sha512, e.ripemd160 = e.ripemd.ripemd160; + e.utils = _r, e.common = zu, e.sha = Wu, e.ripemd = F8, e.hmac = GU, e.sha1 = e.sha.sha1, e.sha256 = e.sha.sha256, e.sha224 = e.sha.sha224, e.sha384 = e.sha.sha384, e.sha512 = e.sha.sha512, e.ripemd160 = e.ripemd.ripemd160; })(rh); const Eo = /* @__PURE__ */ ns(rh); -function Hu(t, e, r) { +function Ku(t, e, r) { return r = { path: e, exports: {}, require: function(n, i) { - return GU(n, i ?? r.path); + return YU(n, i ?? r.path); } }, t(r, r.exports), r.exports; } -function GU() { +function YU() { throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs"); } var ob = U8; @@ -11839,7 +11847,7 @@ U8.equal = function(e, r, n) { if (e != r) throw new Error(n || "Assertion failed: " + e + " != " + r); }; -var Ss = Hu(function(t, e) { +var Ss = Ku(function(t, e) { var r = e; function n(o, a) { if (Array.isArray(o)) @@ -11876,7 +11884,7 @@ var Ss = Hu(function(t, e) { r.toHex = s, r.encode = function(a, u) { return u === "hex" ? s(a) : a; }; -}), Fi = Hu(function(t, e) { +}), Fi = Ku(function(t, e) { var r = e; r.assert = ob, r.toArray = Ss.toArray, r.zero2 = Ss.zero2, r.toHex = Ss.toHex, r.encode = Ss.encode; function n(u, l, d) { @@ -11921,7 +11929,7 @@ var Ss = Hu(function(t, e) { return new sr(u, "hex", "le"); } r.intFromLE = a; -}), g0 = Fi.getNAF, YU = Fi.getJSF, m0 = Fi.assert; +}), g0 = Fi.getNAF, JU = Fi.getJSF, m0 = Fi.assert; function Oa(t, e) { this.type = t, this.p = new sr(e.p, 16), this.red = e.prime ? sr.red(e.prime) : sr.mont(this.p), this.zero = new sr(0).toRed(this.red), this.one = new sr(1).toRed(this.red), this.two = new sr(2).toRed(this.red), this.n = e.n && new sr(e.n, 16), this.g = e.g && this.pointFromJSON(e.g, e.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; var r = this.n && this.p.div(this.n); @@ -12008,10 +12016,10 @@ Oa.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 1 0 */ 3 /* 1 1 */ - ], k = YU(n[P], n[O]); + ], k = JU(n[P], n[O]); for (l = Math.max(k[0].length, l), u[P] = new Array(l), u[O] = new Array(l), p = 0; p < l; p++) { - var q = k[0][p] | 0, U = k[1][p] | 0; - u[P][p] = B[(q + 1) * 3 + (U + 1)], u[O][p] = 0, a[P] = L; + var W = k[0][p] | 0, U = k[1][p] | 0; + u[P][p] = B[(W + 1) * 3 + (U + 1)], u[O][p] = 0, a[P] = L; } } var V = this.jpoint(null, null, null), Q = this._wnafT4; @@ -12116,7 +12124,7 @@ ss.prototype.dblp = function(e) { r = r.dbl(); return r; }; -var ab = Hu(function(t) { +var ab = Ku(function(t) { typeof Object.create == "function" ? t.exports = function(r, n) { n && (r.super_ = n, r.prototype = Object.create(n.prototype, { constructor: { @@ -12134,12 +12142,12 @@ var ab = Hu(function(t) { i.prototype = n.prototype, r.prototype = new i(), r.prototype.constructor = r; } }; -}), JU = Fi.assert; +}), XU = Fi.assert; function os(t) { Rc.call(this, "short", t), this.a = new sr(t.a, 16).toRed(this.red), this.b = new sr(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); } ab(os, Rc); -var XU = os; +var ZU = os; os.prototype._getEndomorphism = function(e) { if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { var r, n; @@ -12153,7 +12161,7 @@ os.prototype._getEndomorphism = function(e) { n = new sr(e.lambda, 16); else { var s = this._getEndoRoots(this.n); - this.g.mul(s[0]).x.cmp(this.g.x.redMul(r)) === 0 ? n = s[0] : (n = s[1], JU(this.g.mul(n).x.cmp(this.g.x.redMul(r)) === 0)); + this.g.mul(s[0]).x.cmp(this.g.x.redMul(r)) === 0 ? n = s[0] : (n = s[1], XU(this.g.mul(n).x.cmp(this.g.x.redMul(r)) === 0)); } var o; return e.basis ? o = e.basis.map(function(a) { @@ -12174,9 +12182,9 @@ os.prototype._getEndoRoots = function(e) { }; os.prototype._getEndoBasis = function(e) { for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new sr(1), o = new sr(0), a = new sr(0), u = new sr(1), l, d, p, w, _, P, O, L = 0, B, k; n.cmpn(0) !== 0; ) { - var q = i.div(n); - B = i.sub(q.mul(n)), k = a.sub(q.mul(s)); - var U = u.sub(q.mul(o)); + var W = i.div(n); + B = i.sub(W.mul(n)), k = a.sub(W.mul(s)); + var U = u.sub(W.mul(o)); if (!p && B.cmp(r) < 0) l = O.neg(), d = s, p = B.neg(), w = k; else if (p && ++L === 2) @@ -12419,8 +12427,8 @@ zn.prototype.dblp = function(e) { for (r = 0; r < e; r++) { var p = o.redSqr(), w = d.redSqr(), _ = w.redSqr(), P = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), O = o.redMul(w), L = P.redSqr().redISub(O.redAdd(O)), B = O.redISub(L), k = P.redMul(B); k = k.redIAdd(k).redISub(_); - var q = d.redMul(u); - r + 1 < e && (l = l.redMul(_)), o = L, u = q, d = k; + var W = d.redMul(u); + r + 1 < e && (l = l.redMul(_)), o = L, u = W, d = k; } return this.curve.jpoint(o, d.redMul(s), u); }; @@ -12518,12 +12526,12 @@ zn.prototype.inspect = function() { zn.prototype.isInfinity = function() { return this.z.cmpn(0) === 0; }; -var Bd = Hu(function(t, e) { +var Bd = Ku(function(t, e) { var r = e; - r.base = Rc, r.short = XU, r.mont = /*RicMoo:ethers:require(./mont)*/ + r.base = Rc, r.short = ZU, r.mont = /*RicMoo:ethers:require(./mont)*/ null, r.edwards = /*RicMoo:ethers:require(./edwards)*/ null; -}), Fd = Hu(function(t, e) { +}), Fd = Ku(function(t, e) { var r = e, n = Fi.assert; function i(a) { a.type === "short" ? this.curve = new Bd.short(a) : a.type === "edwards" ? this.curve = new Bd.edwards(a) : this.curve = new Bd.mont(a), this.g = this.curve.g, this.n = this.curve.n, this.hash = a.hash, n(this.g.validate(), "Invalid curve"), n(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); @@ -12763,14 +12771,14 @@ ei.prototype.verify = function(e, r) { ei.prototype.inspect = function() { return ""; }; -var ZU = Fi.assert; +var QU = Fi.assert; function sp(t, e) { if (t instanceof sp) return t; - this._importDER(t, e) || (ZU(t.r && t.s, "Signature without r or s"), this.r = new sr(t.r, 16), this.s = new sr(t.s, 16), t.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = t.recoveryParam); + this._importDER(t, e) || (QU(t.r && t.s, "Signature without r or s"), this.r = new sr(t.r, 16), this.s = new sr(t.s, 16), t.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = t.recoveryParam); } var op = sp; -function QU() { +function eq() { this.place = 0; } function bm(t, e) { @@ -12791,7 +12799,7 @@ function qx(t) { } sp.prototype._importDER = function(e, r) { e = Fi.toArray(e, r); - var n = new QU(); + var n = new eq(); if (e[n.place++] !== 48) return !1; var i = bm(e, n); @@ -12838,7 +12846,7 @@ sp.prototype.toDER = function(e) { var s = i.concat(n), o = [48]; return ym(o, s.length), o = o.concat(s), Fi.encode(o, e); }; -var eq = ( +var tq = ( /*RicMoo:ethers:require(brorand)*/ function() { throw new Error("unsupported"); @@ -12852,7 +12860,7 @@ function ts(t) { "Unknown curve " + t ), t = Fd[t]), t instanceof Fd.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; } -var tq = ts; +var rq = ts; ts.prototype.keyPair = function(e) { return new cb(this, e); }; @@ -12868,7 +12876,7 @@ ts.prototype.genKeyPair = function(e) { hash: this.hash, pers: e.pers, persEnc: e.persEnc || "utf8", - entropy: e.entropy || eq(this.hash.hmacStrength), + entropy: e.entropy || tq(this.hash.hmacStrength), entropyEnc: e.entropy && e.entropyEnc || "utf8", nonce: this.n.toArray() }), n = this.n.byteLength(), i = this.n.sub(new sr(2)); ; ) { @@ -12938,24 +12946,24 @@ ts.prototype.getKeyRecoveryParam = function(t, e, r, n) { } throw new Error("Unable to find valid recovery factor"); }; -var rq = Hu(function(t, e) { +var nq = Ku(function(t, e) { var r = e; r.version = "6.5.4", r.utils = Fi, r.rand = /*RicMoo:ethers:require(brorand)*/ function() { throw new Error("unsupported"); - }, r.curve = Bd, r.curves = Fd, r.ec = tq, r.eddsa = /*RicMoo:ethers:require(./elliptic/eddsa)*/ + }, r.curve = Bd, r.curves = Fd, r.ec = rq, r.eddsa = /*RicMoo:ethers:require(./elliptic/eddsa)*/ null; -}), nq = rq.ec; -const iq = "signing-key/5.7.0", j1 = new Yr(iq); +}), iq = nq.ec; +const sq = "signing-key/5.7.0", j1 = new Yr(sq); let wm = null; function ua() { - return wm || (wm = new nq("secp256k1")), wm; + return wm || (wm = new iq("secp256k1")), wm; } -class sq { +class oq { constructor(e) { - Cf(this, "curve", "secp256k1"), Cf(this, "privateKey", Di(e)), fj(this.privateKey) !== 32 && j1.throwArgumentError("invalid private key", "privateKey", "[[ REDACTED ]]"); + Tf(this, "curve", "secp256k1"), Tf(this, "privateKey", Di(e)), lj(this.privateKey) !== 32 && j1.throwArgumentError("invalid private key", "privateKey", "[[ REDACTED ]]"); const r = ua().keyFromPrivate(wn(this.privateKey)); - Cf(this, "publicKey", "0x" + r.getPublic(!1, "hex")), Cf(this, "compressedPublicKey", "0x" + r.getPublic(!0, "hex")), Cf(this, "_isSigningKey", !0); + Tf(this, "publicKey", "0x" + r.getPublic(!1, "hex")), Tf(this, "compressedPublicKey", "0x" + r.getPublic(!0, "hex")), Tf(this, "_isSigningKey", !0); } _addPoint(e) { const r = ua().keyFromPublic(wn(this.publicKey)), n = ua().keyFromPublic(wn(e)); @@ -12967,44 +12975,44 @@ class sq { const i = r.sign(n, { canonical: !0 }); return x8({ recoveryParam: i.recoveryParam, - r: xu("0x" + i.r.toString(16), 32), - s: xu("0x" + i.s.toString(16), 32) + r: _u("0x" + i.r.toString(16), 32), + s: _u("0x" + i.s.toString(16), 32) }); } computeSharedSecret(e) { const r = ua().keyFromPrivate(wn(this.privateKey)), n = ua().keyFromPublic(wn(W8(e))); - return xu("0x" + r.derive(n.getPublic()).toString(16), 32); + return _u("0x" + r.derive(n.getPublic()).toString(16), 32); } static isSigningKey(e) { return !!(e && e._isSigningKey); } } -function oq(t, e) { +function aq(t, e) { const r = x8(e), n = { r: wn(r.r), s: wn(r.s) }; return "0x" + ua().recoverPubKey(wn(t), n, r.recoveryParam).encode("hex", !1); } function W8(t, e) { const r = wn(t); - return r.length === 32 ? new sq(r).publicKey : r.length === 33 ? "0x" + ua().keyFromPublic(r).getPublic(!1, "hex") : r.length === 65 ? Di(r) : j1.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); + return r.length === 32 ? new oq(r).publicKey : r.length === 33 ? "0x" + ua().keyFromPublic(r).getPublic(!1, "hex") : r.length === 65 ? Di(r) : j1.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); } var zx; (function(t) { t[t.legacy = 0] = "legacy", t[t.eip2930 = 1] = "eip2930", t[t.eip1559 = 2] = "eip1559"; })(zx || (zx = {})); -function aq(t) { +function cq(t) { const e = W8(t); - return xj(Nx(nb(Nx(e, 1)), 12)); + return _j(Nx(nb(Nx(e, 1)), 12)); } -function cq(t, e) { - return aq(oq(wn(t), e)); +function uq(t, e) { + return cq(aq(wn(t), e)); } var ub = {}, ap = {}; Object.defineProperty(ap, "__esModule", { value: !0 }); -var Gn = ar, U1 = Bi, uq = 20; -function fq(t, e, r) { - for (var n = 1634760805, i = 857760878, s = 2036477234, o = 1797285236, a = r[3] << 24 | r[2] << 16 | r[1] << 8 | r[0], u = r[7] << 24 | r[6] << 16 | r[5] << 8 | r[4], l = r[11] << 24 | r[10] << 16 | r[9] << 8 | r[8], d = r[15] << 24 | r[14] << 16 | r[13] << 8 | r[12], p = r[19] << 24 | r[18] << 16 | r[17] << 8 | r[16], w = r[23] << 24 | r[22] << 16 | r[21] << 8 | r[20], _ = r[27] << 24 | r[26] << 16 | r[25] << 8 | r[24], P = r[31] << 24 | r[30] << 16 | r[29] << 8 | r[28], O = e[3] << 24 | e[2] << 16 | e[1] << 8 | e[0], L = e[7] << 24 | e[6] << 16 | e[5] << 8 | e[4], B = e[11] << 24 | e[10] << 16 | e[9] << 8 | e[8], k = e[15] << 24 | e[14] << 16 | e[13] << 8 | e[12], q = n, U = i, V = s, Q = o, R = a, K = u, ge = l, Ee = d, Y = p, A = w, m = _, f = P, g = O, b = L, x = B, E = k, S = 0; S < uq; S += 2) - q = q + R | 0, g ^= q, g = g >>> 16 | g << 16, Y = Y + g | 0, R ^= Y, R = R >>> 20 | R << 12, U = U + K | 0, b ^= U, b = b >>> 16 | b << 16, A = A + b | 0, K ^= A, K = K >>> 20 | K << 12, V = V + ge | 0, x ^= V, x = x >>> 16 | x << 16, m = m + x | 0, ge ^= m, ge = ge >>> 20 | ge << 12, Q = Q + Ee | 0, E ^= Q, E = E >>> 16 | E << 16, f = f + E | 0, Ee ^= f, Ee = Ee >>> 20 | Ee << 12, V = V + ge | 0, x ^= V, x = x >>> 24 | x << 8, m = m + x | 0, ge ^= m, ge = ge >>> 25 | ge << 7, Q = Q + Ee | 0, E ^= Q, E = E >>> 24 | E << 8, f = f + E | 0, Ee ^= f, Ee = Ee >>> 25 | Ee << 7, U = U + K | 0, b ^= U, b = b >>> 24 | b << 8, A = A + b | 0, K ^= A, K = K >>> 25 | K << 7, q = q + R | 0, g ^= q, g = g >>> 24 | g << 8, Y = Y + g | 0, R ^= Y, R = R >>> 25 | R << 7, q = q + K | 0, E ^= q, E = E >>> 16 | E << 16, m = m + E | 0, K ^= m, K = K >>> 20 | K << 12, U = U + ge | 0, g ^= U, g = g >>> 16 | g << 16, f = f + g | 0, ge ^= f, ge = ge >>> 20 | ge << 12, V = V + Ee | 0, b ^= V, b = b >>> 16 | b << 16, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 20 | Ee << 12, Q = Q + R | 0, x ^= Q, x = x >>> 16 | x << 16, A = A + x | 0, R ^= A, R = R >>> 20 | R << 12, V = V + Ee | 0, b ^= V, b = b >>> 24 | b << 8, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 25 | Ee << 7, Q = Q + R | 0, x ^= Q, x = x >>> 24 | x << 8, A = A + x | 0, R ^= A, R = R >>> 25 | R << 7, U = U + ge | 0, g ^= U, g = g >>> 24 | g << 8, f = f + g | 0, ge ^= f, ge = ge >>> 25 | ge << 7, q = q + K | 0, E ^= q, E = E >>> 24 | E << 8, m = m + E | 0, K ^= m, K = K >>> 25 | K << 7; - Gn.writeUint32LE(q + n | 0, t, 0), Gn.writeUint32LE(U + i | 0, t, 4), Gn.writeUint32LE(V + s | 0, t, 8), Gn.writeUint32LE(Q + o | 0, t, 12), Gn.writeUint32LE(R + a | 0, t, 16), Gn.writeUint32LE(K + u | 0, t, 20), Gn.writeUint32LE(ge + l | 0, t, 24), Gn.writeUint32LE(Ee + d | 0, t, 28), Gn.writeUint32LE(Y + p | 0, t, 32), Gn.writeUint32LE(A + w | 0, t, 36), Gn.writeUint32LE(m + _ | 0, t, 40), Gn.writeUint32LE(f + P | 0, t, 44), Gn.writeUint32LE(g + O | 0, t, 48), Gn.writeUint32LE(b + L | 0, t, 52), Gn.writeUint32LE(x + B | 0, t, 56), Gn.writeUint32LE(E + k | 0, t, 60); +var Gn = ar, U1 = Bi, fq = 20; +function lq(t, e, r) { + for (var n = 1634760805, i = 857760878, s = 2036477234, o = 1797285236, a = r[3] << 24 | r[2] << 16 | r[1] << 8 | r[0], u = r[7] << 24 | r[6] << 16 | r[5] << 8 | r[4], l = r[11] << 24 | r[10] << 16 | r[9] << 8 | r[8], d = r[15] << 24 | r[14] << 16 | r[13] << 8 | r[12], p = r[19] << 24 | r[18] << 16 | r[17] << 8 | r[16], w = r[23] << 24 | r[22] << 16 | r[21] << 8 | r[20], _ = r[27] << 24 | r[26] << 16 | r[25] << 8 | r[24], P = r[31] << 24 | r[30] << 16 | r[29] << 8 | r[28], O = e[3] << 24 | e[2] << 16 | e[1] << 8 | e[0], L = e[7] << 24 | e[6] << 16 | e[5] << 8 | e[4], B = e[11] << 24 | e[10] << 16 | e[9] << 8 | e[8], k = e[15] << 24 | e[14] << 16 | e[13] << 8 | e[12], W = n, U = i, V = s, Q = o, R = a, K = u, ge = l, Ee = d, Y = p, A = w, m = _, f = P, g = O, b = L, x = B, E = k, S = 0; S < fq; S += 2) + W = W + R | 0, g ^= W, g = g >>> 16 | g << 16, Y = Y + g | 0, R ^= Y, R = R >>> 20 | R << 12, U = U + K | 0, b ^= U, b = b >>> 16 | b << 16, A = A + b | 0, K ^= A, K = K >>> 20 | K << 12, V = V + ge | 0, x ^= V, x = x >>> 16 | x << 16, m = m + x | 0, ge ^= m, ge = ge >>> 20 | ge << 12, Q = Q + Ee | 0, E ^= Q, E = E >>> 16 | E << 16, f = f + E | 0, Ee ^= f, Ee = Ee >>> 20 | Ee << 12, V = V + ge | 0, x ^= V, x = x >>> 24 | x << 8, m = m + x | 0, ge ^= m, ge = ge >>> 25 | ge << 7, Q = Q + Ee | 0, E ^= Q, E = E >>> 24 | E << 8, f = f + E | 0, Ee ^= f, Ee = Ee >>> 25 | Ee << 7, U = U + K | 0, b ^= U, b = b >>> 24 | b << 8, A = A + b | 0, K ^= A, K = K >>> 25 | K << 7, W = W + R | 0, g ^= W, g = g >>> 24 | g << 8, Y = Y + g | 0, R ^= Y, R = R >>> 25 | R << 7, W = W + K | 0, E ^= W, E = E >>> 16 | E << 16, m = m + E | 0, K ^= m, K = K >>> 20 | K << 12, U = U + ge | 0, g ^= U, g = g >>> 16 | g << 16, f = f + g | 0, ge ^= f, ge = ge >>> 20 | ge << 12, V = V + Ee | 0, b ^= V, b = b >>> 16 | b << 16, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 20 | Ee << 12, Q = Q + R | 0, x ^= Q, x = x >>> 16 | x << 16, A = A + x | 0, R ^= A, R = R >>> 20 | R << 12, V = V + Ee | 0, b ^= V, b = b >>> 24 | b << 8, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 25 | Ee << 7, Q = Q + R | 0, x ^= Q, x = x >>> 24 | x << 8, A = A + x | 0, R ^= A, R = R >>> 25 | R << 7, U = U + ge | 0, g ^= U, g = g >>> 24 | g << 8, f = f + g | 0, ge ^= f, ge = ge >>> 25 | ge << 7, W = W + K | 0, E ^= W, E = E >>> 24 | E << 8, m = m + E | 0, K ^= m, K = K >>> 25 | K << 7; + Gn.writeUint32LE(W + n | 0, t, 0), Gn.writeUint32LE(U + i | 0, t, 4), Gn.writeUint32LE(V + s | 0, t, 8), Gn.writeUint32LE(Q + o | 0, t, 12), Gn.writeUint32LE(R + a | 0, t, 16), Gn.writeUint32LE(K + u | 0, t, 20), Gn.writeUint32LE(ge + l | 0, t, 24), Gn.writeUint32LE(Ee + d | 0, t, 28), Gn.writeUint32LE(Y + p | 0, t, 32), Gn.writeUint32LE(A + w | 0, t, 36), Gn.writeUint32LE(m + _ | 0, t, 40), Gn.writeUint32LE(f + P | 0, t, 44), Gn.writeUint32LE(g + O | 0, t, 48), Gn.writeUint32LE(b + L | 0, t, 52), Gn.writeUint32LE(x + B | 0, t, 56), Gn.writeUint32LE(E + k | 0, t, 60); } function H8(t, e, r, n, i) { if (i === void 0 && (i = 0), t.length !== 32) @@ -13022,19 +13030,19 @@ function H8(t, e, r, n, i) { s = e, o = i; } for (var a = new Uint8Array(64), u = 0; u < r.length; u += 64) { - fq(a, s, t); + lq(a, s, t); for (var l = u; l < u + 64 && l < r.length; l++) n[l] = r[l] ^ a[l - u]; - hq(s, 0, o); + dq(s, 0, o); } return U1.wipe(a), i === 0 && U1.wipe(s), n; } ap.streamXOR = H8; -function lq(t, e, r, n) { +function hq(t, e, r, n) { return n === void 0 && (n = 0), U1.wipe(r), H8(t, e, r, r, n); } -ap.stream = lq; -function hq(t, e, r) { +ap.stream = hq; +function dq(t, e, r) { for (var n = 1; r--; ) n = n + (t[e] & 255) | 0, t[e] = n & 255, n >>>= 8, e++; if (n > 0) @@ -13042,14 +13050,14 @@ function hq(t, e, r) { } var K8 = {}, Na = {}; Object.defineProperty(Na, "__esModule", { value: !0 }); -function dq(t, e, r) { +function pq(t, e, r) { return ~(t - 1) & e | t - 1 & r; } -Na.select = dq; -function pq(t, e) { +Na.select = pq; +function gq(t, e) { return (t | 0) - (e | 0) - 1 >>> 31 & 1; } -Na.lessOrEqual = pq; +Na.lessOrEqual = gq; function V8(t, e) { if (t.length !== e.length) return 0; @@ -13058,10 +13066,10 @@ function V8(t, e) { return 1 & r - 1 >>> 8; } Na.compare = V8; -function gq(t, e) { +function mq(t, e) { return t.length === 0 || e.length === 0 ? !1 : V8(t, e) !== 0; } -Na.equal = gq; +Na.equal = mq; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); var e = Na, r = Bi; @@ -13089,7 +13097,7 @@ Na.equal = gq; this._r[8] = (P >>> 8 | O << 8) & 8191, this._r[9] = O >>> 5 & 127, this._pad[0] = a[16] | a[17] << 8, this._pad[1] = a[18] | a[19] << 8, this._pad[2] = a[20] | a[21] << 8, this._pad[3] = a[22] | a[23] << 8, this._pad[4] = a[24] | a[25] << 8, this._pad[5] = a[26] | a[27] << 8, this._pad[6] = a[28] | a[29] << 8, this._pad[7] = a[30] | a[31] << 8; } return o.prototype._blocks = function(a, u, l) { - for (var d = this._fin ? 0 : 2048, p = this._h[0], w = this._h[1], _ = this._h[2], P = this._h[3], O = this._h[4], L = this._h[5], B = this._h[6], k = this._h[7], q = this._h[8], U = this._h[9], V = this._r[0], Q = this._r[1], R = this._r[2], K = this._r[3], ge = this._r[4], Ee = this._r[5], Y = this._r[6], A = this._r[7], m = this._r[8], f = this._r[9]; l >= 16; ) { + for (var d = this._fin ? 0 : 2048, p = this._h[0], w = this._h[1], _ = this._h[2], P = this._h[3], O = this._h[4], L = this._h[5], B = this._h[6], k = this._h[7], W = this._h[8], U = this._h[9], V = this._r[0], Q = this._r[1], R = this._r[2], K = this._r[3], ge = this._r[4], Ee = this._r[5], Y = this._r[6], A = this._r[7], m = this._r[8], f = this._r[9]; l >= 16; ) { var g = a[u + 0] | a[u + 1] << 8; p += g & 8191; var b = a[u + 2] | a[u + 3] << 8; @@ -13105,29 +13113,29 @@ Na.equal = gq; var M = a[u + 12] | a[u + 13] << 8; k += (v >>> 11 | M << 5) & 8191; var I = a[u + 14] | a[u + 15] << 8; - q += (M >>> 8 | I << 8) & 8191, U += I >>> 5 | d; + W += (M >>> 8 | I << 8) & 8191, U += I >>> 5 | d; var F = 0, ce = F; - ce += p * V, ce += w * (5 * f), ce += _ * (5 * m), ce += P * (5 * A), ce += O * (5 * Y), F = ce >>> 13, ce &= 8191, ce += L * (5 * Ee), ce += B * (5 * ge), ce += k * (5 * K), ce += q * (5 * R), ce += U * (5 * Q), F += ce >>> 13, ce &= 8191; + ce += p * V, ce += w * (5 * f), ce += _ * (5 * m), ce += P * (5 * A), ce += O * (5 * Y), F = ce >>> 13, ce &= 8191, ce += L * (5 * Ee), ce += B * (5 * ge), ce += k * (5 * K), ce += W * (5 * R), ce += U * (5 * Q), F += ce >>> 13, ce &= 8191; var D = F; - D += p * Q, D += w * V, D += _ * (5 * f), D += P * (5 * m), D += O * (5 * A), F = D >>> 13, D &= 8191, D += L * (5 * Y), D += B * (5 * Ee), D += k * (5 * ge), D += q * (5 * K), D += U * (5 * R), F += D >>> 13, D &= 8191; + D += p * Q, D += w * V, D += _ * (5 * f), D += P * (5 * m), D += O * (5 * A), F = D >>> 13, D &= 8191, D += L * (5 * Y), D += B * (5 * Ee), D += k * (5 * ge), D += W * (5 * K), D += U * (5 * R), F += D >>> 13, D &= 8191; var oe = F; - oe += p * R, oe += w * Q, oe += _ * V, oe += P * (5 * f), oe += O * (5 * m), F = oe >>> 13, oe &= 8191, oe += L * (5 * A), oe += B * (5 * Y), oe += k * (5 * Ee), oe += q * (5 * ge), oe += U * (5 * K), F += oe >>> 13, oe &= 8191; + oe += p * R, oe += w * Q, oe += _ * V, oe += P * (5 * f), oe += O * (5 * m), F = oe >>> 13, oe &= 8191, oe += L * (5 * A), oe += B * (5 * Y), oe += k * (5 * Ee), oe += W * (5 * ge), oe += U * (5 * K), F += oe >>> 13, oe &= 8191; var Z = F; - Z += p * K, Z += w * R, Z += _ * Q, Z += P * V, Z += O * (5 * f), F = Z >>> 13, Z &= 8191, Z += L * (5 * m), Z += B * (5 * A), Z += k * (5 * Y), Z += q * (5 * Ee), Z += U * (5 * ge), F += Z >>> 13, Z &= 8191; + Z += p * K, Z += w * R, Z += _ * Q, Z += P * V, Z += O * (5 * f), F = Z >>> 13, Z &= 8191, Z += L * (5 * m), Z += B * (5 * A), Z += k * (5 * Y), Z += W * (5 * Ee), Z += U * (5 * ge), F += Z >>> 13, Z &= 8191; var J = F; - J += p * ge, J += w * K, J += _ * R, J += P * Q, J += O * V, F = J >>> 13, J &= 8191, J += L * (5 * f), J += B * (5 * m), J += k * (5 * A), J += q * (5 * Y), J += U * (5 * Ee), F += J >>> 13, J &= 8191; + J += p * ge, J += w * K, J += _ * R, J += P * Q, J += O * V, F = J >>> 13, J &= 8191, J += L * (5 * f), J += B * (5 * m), J += k * (5 * A), J += W * (5 * Y), J += U * (5 * Ee), F += J >>> 13, J &= 8191; var ee = F; - ee += p * Ee, ee += w * ge, ee += _ * K, ee += P * R, ee += O * Q, F = ee >>> 13, ee &= 8191, ee += L * V, ee += B * (5 * f), ee += k * (5 * m), ee += q * (5 * A), ee += U * (5 * Y), F += ee >>> 13, ee &= 8191; + ee += p * Ee, ee += w * ge, ee += _ * K, ee += P * R, ee += O * Q, F = ee >>> 13, ee &= 8191, ee += L * V, ee += B * (5 * f), ee += k * (5 * m), ee += W * (5 * A), ee += U * (5 * Y), F += ee >>> 13, ee &= 8191; var T = F; - T += p * Y, T += w * Ee, T += _ * ge, T += P * K, T += O * R, F = T >>> 13, T &= 8191, T += L * Q, T += B * V, T += k * (5 * f), T += q * (5 * m), T += U * (5 * A), F += T >>> 13, T &= 8191; + T += p * Y, T += w * Ee, T += _ * ge, T += P * K, T += O * R, F = T >>> 13, T &= 8191, T += L * Q, T += B * V, T += k * (5 * f), T += W * (5 * m), T += U * (5 * A), F += T >>> 13, T &= 8191; var X = F; - X += p * A, X += w * Y, X += _ * Ee, X += P * ge, X += O * K, F = X >>> 13, X &= 8191, X += L * R, X += B * Q, X += k * V, X += q * (5 * f), X += U * (5 * m), F += X >>> 13, X &= 8191; + X += p * A, X += w * Y, X += _ * Ee, X += P * ge, X += O * K, F = X >>> 13, X &= 8191, X += L * R, X += B * Q, X += k * V, X += W * (5 * f), X += U * (5 * m), F += X >>> 13, X &= 8191; var re = F; - re += p * m, re += w * A, re += _ * Y, re += P * Ee, re += O * ge, F = re >>> 13, re &= 8191, re += L * K, re += B * R, re += k * Q, re += q * V, re += U * (5 * f), F += re >>> 13, re &= 8191; + re += p * m, re += w * A, re += _ * Y, re += P * Ee, re += O * ge, F = re >>> 13, re &= 8191, re += L * K, re += B * R, re += k * Q, re += W * V, re += U * (5 * f), F += re >>> 13, re &= 8191; var pe = F; - pe += p * f, pe += w * m, pe += _ * A, pe += P * Y, pe += O * Ee, F = pe >>> 13, pe &= 8191, pe += L * ge, pe += B * K, pe += k * R, pe += q * Q, pe += U * V, F += pe >>> 13, pe &= 8191, F = (F << 2) + F | 0, F = F + ce | 0, ce = F & 8191, F = F >>> 13, D += F, p = ce, w = D, _ = oe, P = Z, O = J, L = ee, B = T, k = X, q = re, U = pe, u += 16, l -= 16; + pe += p * f, pe += w * m, pe += _ * A, pe += P * Y, pe += O * Ee, F = pe >>> 13, pe &= 8191, pe += L * ge, pe += B * K, pe += k * R, pe += W * Q, pe += U * V, F += pe >>> 13, pe &= 8191, F = (F << 2) + F | 0, F = F + ce | 0, ce = F & 8191, F = F >>> 13, D += F, p = ce, w = D, _ = oe, P = Z, O = J, L = ee, B = T, k = X, W = re, U = pe, u += 16, l -= 16; } - this._h[0] = p, this._h[1] = w, this._h[2] = _, this._h[3] = P, this._h[4] = O, this._h[5] = L, this._h[6] = B, this._h[7] = k, this._h[8] = q, this._h[9] = U; + this._h[0] = p, this._h[1] = w, this._h[2] = _, this._h[3] = P, this._h[4] = O, this._h[5] = L, this._h[6] = B, this._h[7] = k, this._h[8] = W, this._h[9] = U; }, o.prototype.finish = function(a, u) { u === void 0 && (u = 0); var l = new Uint16Array(10), d, p, w, _; @@ -13250,12 +13258,12 @@ Na.equal = gq; })(ub); var G8 = {}, nh = {}, fb = {}; Object.defineProperty(fb, "__esModule", { value: !0 }); -function mq(t) { +function vq(t) { return typeof t.saveState < "u" && typeof t.restoreState < "u" && typeof t.cleanSavedState < "u"; } -fb.isSerializableHash = mq; +fb.isSerializableHash = vq; Object.defineProperty(nh, "__esModule", { value: !0 }); -var Bs = fb, vq = Na, bq = Bi, Y8 = ( +var Bs = fb, bq = Na, yq = Bi, Y8 = ( /** @class */ function() { function t(e, r) { @@ -13267,7 +13275,7 @@ var Bs = fb, vq = Na, bq = Bi, Y8 = ( this._inner.update(n); for (var i = 0; i < n.length; i++) n[i] ^= 106; - this._outer.update(n), Bs.isSerializableHash(this._inner) && Bs.isSerializableHash(this._outer) && (this._innerKeyedState = this._inner.saveState(), this._outerKeyedState = this._outer.saveState()), bq.wipe(n); + this._outer.update(n), Bs.isSerializableHash(this._inner) && Bs.isSerializableHash(this._outer) && (this._innerKeyedState = this._inner.saveState(), this._outerKeyedState = this._outer.saveState()), yq.wipe(n); } return t.prototype.reset = function() { if (!Bs.isSerializableHash(this._inner) || !Bs.isSerializableHash(this._outer)) @@ -13298,16 +13306,16 @@ var Bs = fb, vq = Na, bq = Bi, Y8 = ( }() ); nh.HMAC = Y8; -function yq(t, e, r) { +function wq(t, e, r) { var n = new Y8(t, e); n.update(r); var i = n.digest(); return n.clean(), i; } -nh.hmac = yq; -nh.equal = vq.equal; +nh.hmac = wq; +nh.equal = bq.equal; Object.defineProperty(G8, "__esModule", { value: !0 }); -var Wx = nh, Hx = Bi, wq = ( +var Wx = nh, Hx = Bi, xq = ( /** @class */ function() { function t(e, r, n, i) { @@ -13329,7 +13337,7 @@ var Wx = nh, Hx = Bi, wq = ( this._hmac.clean(), Hx.wipe(this._buffer), Hx.wipe(this._counter), this._bufpos = 0; }, t; }() -), xq = G8.HKDF = wq, ih = {}; +), _q = G8.HKDF = xq, ih = {}; (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); var e = ar, r = Bi; @@ -13457,7 +13465,7 @@ var Wx = nh, Hx = Bi, wq = ( ]); function s(a, u, l, d, p) { for (; p >= 64; ) { - for (var w = u[0], _ = u[1], P = u[2], O = u[3], L = u[4], B = u[5], k = u[6], q = u[7], U = 0; U < 16; U++) { + for (var w = u[0], _ = u[1], P = u[2], O = u[3], L = u[4], B = u[5], k = u[6], W = u[7], U = 0; U < 16; U++) { var V = d + U * 4; a[U] = e.readUint32BE(l, V); } @@ -13468,10 +13476,10 @@ var Wx = nh, Hx = Bi, wq = ( a[U] = (R + a[U - 7] | 0) + (K + a[U - 16] | 0); } for (var U = 0; U < 64; U++) { - var R = (((L >>> 6 | L << 26) ^ (L >>> 11 | L << 21) ^ (L >>> 25 | L << 7)) + (L & B ^ ~L & k) | 0) + (q + (i[U] + a[U] | 0) | 0) | 0, K = ((w >>> 2 | w << 30) ^ (w >>> 13 | w << 19) ^ (w >>> 22 | w << 10)) + (w & _ ^ w & P ^ _ & P) | 0; - q = k, k = B, B = L, L = O + R | 0, O = P, P = _, _ = w, w = R + K | 0; + var R = (((L >>> 6 | L << 26) ^ (L >>> 11 | L << 21) ^ (L >>> 25 | L << 7)) + (L & B ^ ~L & k) | 0) + (W + (i[U] + a[U] | 0) | 0) | 0, K = ((w >>> 2 | w << 30) ^ (w >>> 13 | w << 19) ^ (w >>> 22 | w << 10)) + (w & _ ^ w & P ^ _ & P) | 0; + W = k, k = B, B = L, L = O + R | 0, O = P, P = _, _ = w, w = R + K | 0; } - u[0] += w, u[1] += _, u[2] += P, u[3] += O, u[4] += L, u[5] += B, u[6] += k, u[7] += q, d += 64, p -= 64; + u[0] += w, u[1] += _, u[2] += P, u[3] += O, u[4] += L, u[5] += B, u[6] += k, u[7] += W, d += 64, p -= 64; } return d; } @@ -13597,7 +13605,7 @@ var lb = {}; return (0, r.wipe)(V), Q; } t.generateKeyPair = k; - function q(U, V, Q = !1) { + function W(U, V, Q = !1) { if (U.length !== t.PUBLIC_KEY_LENGTH) throw new Error("X25519: incorrect secret key length"); if (V.length !== t.PUBLIC_KEY_LENGTH) @@ -13612,28 +13620,28 @@ var lb = {}; } return R; } - t.sharedKey = q; + t.sharedKey = W; })(lb); var J8 = {}; -const _q = "elliptic", Eq = "6.6.0", Sq = "EC cryptography", Aq = "lib/elliptic.js", Pq = [ +const Eq = "elliptic", Sq = "6.6.0", Aq = "EC cryptography", Pq = "lib/elliptic.js", Mq = [ "lib" -], Mq = { +], Iq = { lint: "eslint lib test", "lint:fix": "npm run lint -- --fix", unit: "istanbul test _mocha --reporter=spec test/index.js", test: "npm run lint && npm run unit", version: "grunt dist && git add dist/" -}, Iq = { +}, Cq = { type: "git", url: "git@github.com:indutny/elliptic" -}, Cq = [ +}, Tq = [ "EC", "Elliptic", "curve", "Cryptography" -], Tq = "Fedor Indutny ", Rq = "MIT", Dq = { +], Rq = "Fedor Indutny ", Dq = "MIT", Oq = { url: "https://github.com/indutny/elliptic/issues" -}, Oq = "https://github.com/indutny/elliptic", Nq = { +}, Nq = "https://github.com/indutny/elliptic", Lq = { brfs: "^2.0.2", coveralls: "^3.1.0", eslint: "^7.6.0", @@ -13647,7 +13655,7 @@ const _q = "elliptic", Eq = "6.6.0", Sq = "EC cryptography", Aq = "lib/elliptic. "grunt-saucelabs": "^9.0.1", istanbul: "^0.4.5", mocha: "^8.0.1" -}, Lq = { +}, kq = { "bn.js": "^4.11.9", brorand: "^1.1.0", "hash.js": "^1.0.0", @@ -13655,21 +13663,21 @@ const _q = "elliptic", Eq = "6.6.0", Sq = "EC cryptography", Aq = "lib/elliptic. inherits: "^2.0.4", "minimalistic-assert": "^1.0.1", "minimalistic-crypto-utils": "^1.0.1" -}, kq = { - name: _q, - version: Eq, - description: Sq, - main: Aq, - files: Pq, - scripts: Mq, - repository: Iq, - keywords: Cq, - author: Tq, - license: Rq, - bugs: Dq, - homepage: Oq, - devDependencies: Nq, - dependencies: Lq +}, $q = { + name: Eq, + version: Sq, + description: Aq, + main: Pq, + files: Mq, + scripts: Iq, + repository: Cq, + keywords: Tq, + author: Rq, + license: Dq, + bugs: Oq, + homepage: Nq, + devDependencies: Lq, + dependencies: kq }; var ji = {}, hb = { exports: {} }; hb.exports; @@ -14104,7 +14112,7 @@ hb.exports; return S !== 0 ? m.words[v] = S | 0 : m.length--, m.strip(); } var O = function(A, m, f) { - var g = A.words, b = m.words, x = f.words, E = 0, S, v, M, I = g[0] | 0, F = I & 8191, ce = I >>> 13, D = g[1] | 0, oe = D & 8191, Z = D >>> 13, J = g[2] | 0, ee = J & 8191, T = J >>> 13, X = g[3] | 0, re = X & 8191, pe = X >>> 13, ie = g[4] | 0, ue = ie & 8191, ve = ie >>> 13, Pe = g[5] | 0, De = Pe & 8191, Ce = Pe >>> 13, $e = g[6] | 0, Me = $e & 8191, Ne = $e >>> 13, Ke = g[7] | 0, Le = Ke & 8191, qe = Ke >>> 13, ze = g[8] | 0, _e = ze & 8191, Ze = ze >>> 13, at = g[9] | 0, ke = at & 8191, Qe = at >>> 13, tt = b[0] | 0, Ye = tt & 8191, dt = tt >>> 13, lt = b[1] | 0, ct = lt & 8191, qt = lt >>> 13, Jt = b[2] | 0, Et = Jt & 8191, er = Jt >>> 13, Xt = b[3] | 0, Dt = Xt & 8191, kt = Xt >>> 13, Ct = b[4] | 0, mt = Ct & 8191, Rt = Ct >>> 13, Nt = b[5] | 0, bt = Nt & 8191, $t = Nt >>> 13, Ft = b[6] | 0, rt = Ft & 8191, Bt = Ft >>> 13, $ = b[7] | 0, z = $ & 8191, H = $ >>> 13, C = b[8] | 0, G = C & 8191, j = C >>> 13, se = b[9] | 0, de = se & 8191, xe = se >>> 13; + var g = A.words, b = m.words, x = f.words, E = 0, S, v, M, I = g[0] | 0, F = I & 8191, ce = I >>> 13, D = g[1] | 0, oe = D & 8191, Z = D >>> 13, J = g[2] | 0, ee = J & 8191, T = J >>> 13, X = g[3] | 0, re = X & 8191, pe = X >>> 13, ie = g[4] | 0, ue = ie & 8191, ve = ie >>> 13, Pe = g[5] | 0, De = Pe & 8191, Ce = Pe >>> 13, $e = g[6] | 0, Me = $e & 8191, Ne = $e >>> 13, Ke = g[7] | 0, Le = Ke & 8191, qe = Ke >>> 13, ze = g[8] | 0, _e = ze & 8191, Ze = ze >>> 13, at = g[9] | 0, ke = at & 8191, Qe = at >>> 13, tt = b[0] | 0, Ye = tt & 8191, dt = tt >>> 13, lt = b[1] | 0, ct = lt & 8191, qt = lt >>> 13, Jt = b[2] | 0, Et = Jt & 8191, er = Jt >>> 13, Xt = b[3] | 0, Dt = Xt & 8191, kt = Xt >>> 13, Ct = b[4] | 0, mt = Ct & 8191, Rt = Ct >>> 13, Nt = b[5] | 0, bt = Nt & 8191, $t = Nt >>> 13, Ft = b[6] | 0, rt = Ft & 8191, Bt = Ft >>> 13, $ = b[7] | 0, q = $ & 8191, H = $ >>> 13, C = b[8] | 0, G = C & 8191, j = C >>> 13, se = b[9] | 0, de = se & 8191, xe = se >>> 13; f.negative = A.negative ^ m.negative, f.length = 19, S = Math.imul(F, Ye), v = Math.imul(F, dt), v = v + Math.imul(ce, Ye) | 0, M = Math.imul(ce, dt); var Te = (E + S | 0) + ((v & 8191) << 13) | 0; E = (M + (v >>> 13) | 0) + (Te >>> 26) | 0, Te &= 67108863, S = Math.imul(oe, Ye), v = Math.imul(oe, dt), v = v + Math.imul(Z, Ye) | 0, M = Math.imul(Z, dt), S = S + Math.imul(F, ct) | 0, v = v + Math.imul(F, qt) | 0, v = v + Math.imul(ce, ct) | 0, M = M + Math.imul(ce, qt) | 0; @@ -14119,25 +14127,25 @@ hb.exports; var it = (E + S | 0) + ((v & 8191) << 13) | 0; E = (M + (v >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, S = Math.imul(Me, Ye), v = Math.imul(Me, dt), v = v + Math.imul(Ne, Ye) | 0, M = Math.imul(Ne, dt), S = S + Math.imul(De, ct) | 0, v = v + Math.imul(De, qt) | 0, v = v + Math.imul(Ce, ct) | 0, M = M + Math.imul(Ce, qt) | 0, S = S + Math.imul(ue, Et) | 0, v = v + Math.imul(ue, er) | 0, v = v + Math.imul(ve, Et) | 0, M = M + Math.imul(ve, er) | 0, S = S + Math.imul(re, Dt) | 0, v = v + Math.imul(re, kt) | 0, v = v + Math.imul(pe, Dt) | 0, M = M + Math.imul(pe, kt) | 0, S = S + Math.imul(ee, mt) | 0, v = v + Math.imul(ee, Rt) | 0, v = v + Math.imul(T, mt) | 0, M = M + Math.imul(T, Rt) | 0, S = S + Math.imul(oe, bt) | 0, v = v + Math.imul(oe, $t) | 0, v = v + Math.imul(Z, bt) | 0, M = M + Math.imul(Z, $t) | 0, S = S + Math.imul(F, rt) | 0, v = v + Math.imul(F, Bt) | 0, v = v + Math.imul(ce, rt) | 0, M = M + Math.imul(ce, Bt) | 0; var et = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, S = Math.imul(Le, Ye), v = Math.imul(Le, dt), v = v + Math.imul(qe, Ye) | 0, M = Math.imul(qe, dt), S = S + Math.imul(Me, ct) | 0, v = v + Math.imul(Me, qt) | 0, v = v + Math.imul(Ne, ct) | 0, M = M + Math.imul(Ne, qt) | 0, S = S + Math.imul(De, Et) | 0, v = v + Math.imul(De, er) | 0, v = v + Math.imul(Ce, Et) | 0, M = M + Math.imul(Ce, er) | 0, S = S + Math.imul(ue, Dt) | 0, v = v + Math.imul(ue, kt) | 0, v = v + Math.imul(ve, Dt) | 0, M = M + Math.imul(ve, kt) | 0, S = S + Math.imul(re, mt) | 0, v = v + Math.imul(re, Rt) | 0, v = v + Math.imul(pe, mt) | 0, M = M + Math.imul(pe, Rt) | 0, S = S + Math.imul(ee, bt) | 0, v = v + Math.imul(ee, $t) | 0, v = v + Math.imul(T, bt) | 0, M = M + Math.imul(T, $t) | 0, S = S + Math.imul(oe, rt) | 0, v = v + Math.imul(oe, Bt) | 0, v = v + Math.imul(Z, rt) | 0, M = M + Math.imul(Z, Bt) | 0, S = S + Math.imul(F, z) | 0, v = v + Math.imul(F, H) | 0, v = v + Math.imul(ce, z) | 0, M = M + Math.imul(ce, H) | 0; + E = (M + (v >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, S = Math.imul(Le, Ye), v = Math.imul(Le, dt), v = v + Math.imul(qe, Ye) | 0, M = Math.imul(qe, dt), S = S + Math.imul(Me, ct) | 0, v = v + Math.imul(Me, qt) | 0, v = v + Math.imul(Ne, ct) | 0, M = M + Math.imul(Ne, qt) | 0, S = S + Math.imul(De, Et) | 0, v = v + Math.imul(De, er) | 0, v = v + Math.imul(Ce, Et) | 0, M = M + Math.imul(Ce, er) | 0, S = S + Math.imul(ue, Dt) | 0, v = v + Math.imul(ue, kt) | 0, v = v + Math.imul(ve, Dt) | 0, M = M + Math.imul(ve, kt) | 0, S = S + Math.imul(re, mt) | 0, v = v + Math.imul(re, Rt) | 0, v = v + Math.imul(pe, mt) | 0, M = M + Math.imul(pe, Rt) | 0, S = S + Math.imul(ee, bt) | 0, v = v + Math.imul(ee, $t) | 0, v = v + Math.imul(T, bt) | 0, M = M + Math.imul(T, $t) | 0, S = S + Math.imul(oe, rt) | 0, v = v + Math.imul(oe, Bt) | 0, v = v + Math.imul(Z, rt) | 0, M = M + Math.imul(Z, Bt) | 0, S = S + Math.imul(F, q) | 0, v = v + Math.imul(F, H) | 0, v = v + Math.imul(ce, q) | 0, M = M + Math.imul(ce, H) | 0; var St = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, S = Math.imul(_e, Ye), v = Math.imul(_e, dt), v = v + Math.imul(Ze, Ye) | 0, M = Math.imul(Ze, dt), S = S + Math.imul(Le, ct) | 0, v = v + Math.imul(Le, qt) | 0, v = v + Math.imul(qe, ct) | 0, M = M + Math.imul(qe, qt) | 0, S = S + Math.imul(Me, Et) | 0, v = v + Math.imul(Me, er) | 0, v = v + Math.imul(Ne, Et) | 0, M = M + Math.imul(Ne, er) | 0, S = S + Math.imul(De, Dt) | 0, v = v + Math.imul(De, kt) | 0, v = v + Math.imul(Ce, Dt) | 0, M = M + Math.imul(Ce, kt) | 0, S = S + Math.imul(ue, mt) | 0, v = v + Math.imul(ue, Rt) | 0, v = v + Math.imul(ve, mt) | 0, M = M + Math.imul(ve, Rt) | 0, S = S + Math.imul(re, bt) | 0, v = v + Math.imul(re, $t) | 0, v = v + Math.imul(pe, bt) | 0, M = M + Math.imul(pe, $t) | 0, S = S + Math.imul(ee, rt) | 0, v = v + Math.imul(ee, Bt) | 0, v = v + Math.imul(T, rt) | 0, M = M + Math.imul(T, Bt) | 0, S = S + Math.imul(oe, z) | 0, v = v + Math.imul(oe, H) | 0, v = v + Math.imul(Z, z) | 0, M = M + Math.imul(Z, H) | 0, S = S + Math.imul(F, G) | 0, v = v + Math.imul(F, j) | 0, v = v + Math.imul(ce, G) | 0, M = M + Math.imul(ce, j) | 0; + E = (M + (v >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, S = Math.imul(_e, Ye), v = Math.imul(_e, dt), v = v + Math.imul(Ze, Ye) | 0, M = Math.imul(Ze, dt), S = S + Math.imul(Le, ct) | 0, v = v + Math.imul(Le, qt) | 0, v = v + Math.imul(qe, ct) | 0, M = M + Math.imul(qe, qt) | 0, S = S + Math.imul(Me, Et) | 0, v = v + Math.imul(Me, er) | 0, v = v + Math.imul(Ne, Et) | 0, M = M + Math.imul(Ne, er) | 0, S = S + Math.imul(De, Dt) | 0, v = v + Math.imul(De, kt) | 0, v = v + Math.imul(Ce, Dt) | 0, M = M + Math.imul(Ce, kt) | 0, S = S + Math.imul(ue, mt) | 0, v = v + Math.imul(ue, Rt) | 0, v = v + Math.imul(ve, mt) | 0, M = M + Math.imul(ve, Rt) | 0, S = S + Math.imul(re, bt) | 0, v = v + Math.imul(re, $t) | 0, v = v + Math.imul(pe, bt) | 0, M = M + Math.imul(pe, $t) | 0, S = S + Math.imul(ee, rt) | 0, v = v + Math.imul(ee, Bt) | 0, v = v + Math.imul(T, rt) | 0, M = M + Math.imul(T, Bt) | 0, S = S + Math.imul(oe, q) | 0, v = v + Math.imul(oe, H) | 0, v = v + Math.imul(Z, q) | 0, M = M + Math.imul(Z, H) | 0, S = S + Math.imul(F, G) | 0, v = v + Math.imul(F, j) | 0, v = v + Math.imul(ce, G) | 0, M = M + Math.imul(ce, j) | 0; var Tt = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, S = Math.imul(ke, Ye), v = Math.imul(ke, dt), v = v + Math.imul(Qe, Ye) | 0, M = Math.imul(Qe, dt), S = S + Math.imul(_e, ct) | 0, v = v + Math.imul(_e, qt) | 0, v = v + Math.imul(Ze, ct) | 0, M = M + Math.imul(Ze, qt) | 0, S = S + Math.imul(Le, Et) | 0, v = v + Math.imul(Le, er) | 0, v = v + Math.imul(qe, Et) | 0, M = M + Math.imul(qe, er) | 0, S = S + Math.imul(Me, Dt) | 0, v = v + Math.imul(Me, kt) | 0, v = v + Math.imul(Ne, Dt) | 0, M = M + Math.imul(Ne, kt) | 0, S = S + Math.imul(De, mt) | 0, v = v + Math.imul(De, Rt) | 0, v = v + Math.imul(Ce, mt) | 0, M = M + Math.imul(Ce, Rt) | 0, S = S + Math.imul(ue, bt) | 0, v = v + Math.imul(ue, $t) | 0, v = v + Math.imul(ve, bt) | 0, M = M + Math.imul(ve, $t) | 0, S = S + Math.imul(re, rt) | 0, v = v + Math.imul(re, Bt) | 0, v = v + Math.imul(pe, rt) | 0, M = M + Math.imul(pe, Bt) | 0, S = S + Math.imul(ee, z) | 0, v = v + Math.imul(ee, H) | 0, v = v + Math.imul(T, z) | 0, M = M + Math.imul(T, H) | 0, S = S + Math.imul(oe, G) | 0, v = v + Math.imul(oe, j) | 0, v = v + Math.imul(Z, G) | 0, M = M + Math.imul(Z, j) | 0, S = S + Math.imul(F, de) | 0, v = v + Math.imul(F, xe) | 0, v = v + Math.imul(ce, de) | 0, M = M + Math.imul(ce, xe) | 0; + E = (M + (v >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, S = Math.imul(ke, Ye), v = Math.imul(ke, dt), v = v + Math.imul(Qe, Ye) | 0, M = Math.imul(Qe, dt), S = S + Math.imul(_e, ct) | 0, v = v + Math.imul(_e, qt) | 0, v = v + Math.imul(Ze, ct) | 0, M = M + Math.imul(Ze, qt) | 0, S = S + Math.imul(Le, Et) | 0, v = v + Math.imul(Le, er) | 0, v = v + Math.imul(qe, Et) | 0, M = M + Math.imul(qe, er) | 0, S = S + Math.imul(Me, Dt) | 0, v = v + Math.imul(Me, kt) | 0, v = v + Math.imul(Ne, Dt) | 0, M = M + Math.imul(Ne, kt) | 0, S = S + Math.imul(De, mt) | 0, v = v + Math.imul(De, Rt) | 0, v = v + Math.imul(Ce, mt) | 0, M = M + Math.imul(Ce, Rt) | 0, S = S + Math.imul(ue, bt) | 0, v = v + Math.imul(ue, $t) | 0, v = v + Math.imul(ve, bt) | 0, M = M + Math.imul(ve, $t) | 0, S = S + Math.imul(re, rt) | 0, v = v + Math.imul(re, Bt) | 0, v = v + Math.imul(pe, rt) | 0, M = M + Math.imul(pe, Bt) | 0, S = S + Math.imul(ee, q) | 0, v = v + Math.imul(ee, H) | 0, v = v + Math.imul(T, q) | 0, M = M + Math.imul(T, H) | 0, S = S + Math.imul(oe, G) | 0, v = v + Math.imul(oe, j) | 0, v = v + Math.imul(Z, G) | 0, M = M + Math.imul(Z, j) | 0, S = S + Math.imul(F, de) | 0, v = v + Math.imul(F, xe) | 0, v = v + Math.imul(ce, de) | 0, M = M + Math.imul(ce, xe) | 0; var At = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, S = Math.imul(ke, ct), v = Math.imul(ke, qt), v = v + Math.imul(Qe, ct) | 0, M = Math.imul(Qe, qt), S = S + Math.imul(_e, Et) | 0, v = v + Math.imul(_e, er) | 0, v = v + Math.imul(Ze, Et) | 0, M = M + Math.imul(Ze, er) | 0, S = S + Math.imul(Le, Dt) | 0, v = v + Math.imul(Le, kt) | 0, v = v + Math.imul(qe, Dt) | 0, M = M + Math.imul(qe, kt) | 0, S = S + Math.imul(Me, mt) | 0, v = v + Math.imul(Me, Rt) | 0, v = v + Math.imul(Ne, mt) | 0, M = M + Math.imul(Ne, Rt) | 0, S = S + Math.imul(De, bt) | 0, v = v + Math.imul(De, $t) | 0, v = v + Math.imul(Ce, bt) | 0, M = M + Math.imul(Ce, $t) | 0, S = S + Math.imul(ue, rt) | 0, v = v + Math.imul(ue, Bt) | 0, v = v + Math.imul(ve, rt) | 0, M = M + Math.imul(ve, Bt) | 0, S = S + Math.imul(re, z) | 0, v = v + Math.imul(re, H) | 0, v = v + Math.imul(pe, z) | 0, M = M + Math.imul(pe, H) | 0, S = S + Math.imul(ee, G) | 0, v = v + Math.imul(ee, j) | 0, v = v + Math.imul(T, G) | 0, M = M + Math.imul(T, j) | 0, S = S + Math.imul(oe, de) | 0, v = v + Math.imul(oe, xe) | 0, v = v + Math.imul(Z, de) | 0, M = M + Math.imul(Z, xe) | 0; + E = (M + (v >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, S = Math.imul(ke, ct), v = Math.imul(ke, qt), v = v + Math.imul(Qe, ct) | 0, M = Math.imul(Qe, qt), S = S + Math.imul(_e, Et) | 0, v = v + Math.imul(_e, er) | 0, v = v + Math.imul(Ze, Et) | 0, M = M + Math.imul(Ze, er) | 0, S = S + Math.imul(Le, Dt) | 0, v = v + Math.imul(Le, kt) | 0, v = v + Math.imul(qe, Dt) | 0, M = M + Math.imul(qe, kt) | 0, S = S + Math.imul(Me, mt) | 0, v = v + Math.imul(Me, Rt) | 0, v = v + Math.imul(Ne, mt) | 0, M = M + Math.imul(Ne, Rt) | 0, S = S + Math.imul(De, bt) | 0, v = v + Math.imul(De, $t) | 0, v = v + Math.imul(Ce, bt) | 0, M = M + Math.imul(Ce, $t) | 0, S = S + Math.imul(ue, rt) | 0, v = v + Math.imul(ue, Bt) | 0, v = v + Math.imul(ve, rt) | 0, M = M + Math.imul(ve, Bt) | 0, S = S + Math.imul(re, q) | 0, v = v + Math.imul(re, H) | 0, v = v + Math.imul(pe, q) | 0, M = M + Math.imul(pe, H) | 0, S = S + Math.imul(ee, G) | 0, v = v + Math.imul(ee, j) | 0, v = v + Math.imul(T, G) | 0, M = M + Math.imul(T, j) | 0, S = S + Math.imul(oe, de) | 0, v = v + Math.imul(oe, xe) | 0, v = v + Math.imul(Z, de) | 0, M = M + Math.imul(Z, xe) | 0; var _t = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, S = Math.imul(ke, Et), v = Math.imul(ke, er), v = v + Math.imul(Qe, Et) | 0, M = Math.imul(Qe, er), S = S + Math.imul(_e, Dt) | 0, v = v + Math.imul(_e, kt) | 0, v = v + Math.imul(Ze, Dt) | 0, M = M + Math.imul(Ze, kt) | 0, S = S + Math.imul(Le, mt) | 0, v = v + Math.imul(Le, Rt) | 0, v = v + Math.imul(qe, mt) | 0, M = M + Math.imul(qe, Rt) | 0, S = S + Math.imul(Me, bt) | 0, v = v + Math.imul(Me, $t) | 0, v = v + Math.imul(Ne, bt) | 0, M = M + Math.imul(Ne, $t) | 0, S = S + Math.imul(De, rt) | 0, v = v + Math.imul(De, Bt) | 0, v = v + Math.imul(Ce, rt) | 0, M = M + Math.imul(Ce, Bt) | 0, S = S + Math.imul(ue, z) | 0, v = v + Math.imul(ue, H) | 0, v = v + Math.imul(ve, z) | 0, M = M + Math.imul(ve, H) | 0, S = S + Math.imul(re, G) | 0, v = v + Math.imul(re, j) | 0, v = v + Math.imul(pe, G) | 0, M = M + Math.imul(pe, j) | 0, S = S + Math.imul(ee, de) | 0, v = v + Math.imul(ee, xe) | 0, v = v + Math.imul(T, de) | 0, M = M + Math.imul(T, xe) | 0; + E = (M + (v >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, S = Math.imul(ke, Et), v = Math.imul(ke, er), v = v + Math.imul(Qe, Et) | 0, M = Math.imul(Qe, er), S = S + Math.imul(_e, Dt) | 0, v = v + Math.imul(_e, kt) | 0, v = v + Math.imul(Ze, Dt) | 0, M = M + Math.imul(Ze, kt) | 0, S = S + Math.imul(Le, mt) | 0, v = v + Math.imul(Le, Rt) | 0, v = v + Math.imul(qe, mt) | 0, M = M + Math.imul(qe, Rt) | 0, S = S + Math.imul(Me, bt) | 0, v = v + Math.imul(Me, $t) | 0, v = v + Math.imul(Ne, bt) | 0, M = M + Math.imul(Ne, $t) | 0, S = S + Math.imul(De, rt) | 0, v = v + Math.imul(De, Bt) | 0, v = v + Math.imul(Ce, rt) | 0, M = M + Math.imul(Ce, Bt) | 0, S = S + Math.imul(ue, q) | 0, v = v + Math.imul(ue, H) | 0, v = v + Math.imul(ve, q) | 0, M = M + Math.imul(ve, H) | 0, S = S + Math.imul(re, G) | 0, v = v + Math.imul(re, j) | 0, v = v + Math.imul(pe, G) | 0, M = M + Math.imul(pe, j) | 0, S = S + Math.imul(ee, de) | 0, v = v + Math.imul(ee, xe) | 0, v = v + Math.imul(T, de) | 0, M = M + Math.imul(T, xe) | 0; var ht = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, S = Math.imul(ke, Dt), v = Math.imul(ke, kt), v = v + Math.imul(Qe, Dt) | 0, M = Math.imul(Qe, kt), S = S + Math.imul(_e, mt) | 0, v = v + Math.imul(_e, Rt) | 0, v = v + Math.imul(Ze, mt) | 0, M = M + Math.imul(Ze, Rt) | 0, S = S + Math.imul(Le, bt) | 0, v = v + Math.imul(Le, $t) | 0, v = v + Math.imul(qe, bt) | 0, M = M + Math.imul(qe, $t) | 0, S = S + Math.imul(Me, rt) | 0, v = v + Math.imul(Me, Bt) | 0, v = v + Math.imul(Ne, rt) | 0, M = M + Math.imul(Ne, Bt) | 0, S = S + Math.imul(De, z) | 0, v = v + Math.imul(De, H) | 0, v = v + Math.imul(Ce, z) | 0, M = M + Math.imul(Ce, H) | 0, S = S + Math.imul(ue, G) | 0, v = v + Math.imul(ue, j) | 0, v = v + Math.imul(ve, G) | 0, M = M + Math.imul(ve, j) | 0, S = S + Math.imul(re, de) | 0, v = v + Math.imul(re, xe) | 0, v = v + Math.imul(pe, de) | 0, M = M + Math.imul(pe, xe) | 0; + E = (M + (v >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, S = Math.imul(ke, Dt), v = Math.imul(ke, kt), v = v + Math.imul(Qe, Dt) | 0, M = Math.imul(Qe, kt), S = S + Math.imul(_e, mt) | 0, v = v + Math.imul(_e, Rt) | 0, v = v + Math.imul(Ze, mt) | 0, M = M + Math.imul(Ze, Rt) | 0, S = S + Math.imul(Le, bt) | 0, v = v + Math.imul(Le, $t) | 0, v = v + Math.imul(qe, bt) | 0, M = M + Math.imul(qe, $t) | 0, S = S + Math.imul(Me, rt) | 0, v = v + Math.imul(Me, Bt) | 0, v = v + Math.imul(Ne, rt) | 0, M = M + Math.imul(Ne, Bt) | 0, S = S + Math.imul(De, q) | 0, v = v + Math.imul(De, H) | 0, v = v + Math.imul(Ce, q) | 0, M = M + Math.imul(Ce, H) | 0, S = S + Math.imul(ue, G) | 0, v = v + Math.imul(ue, j) | 0, v = v + Math.imul(ve, G) | 0, M = M + Math.imul(ve, j) | 0, S = S + Math.imul(re, de) | 0, v = v + Math.imul(re, xe) | 0, v = v + Math.imul(pe, de) | 0, M = M + Math.imul(pe, xe) | 0; var xt = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, S = Math.imul(ke, mt), v = Math.imul(ke, Rt), v = v + Math.imul(Qe, mt) | 0, M = Math.imul(Qe, Rt), S = S + Math.imul(_e, bt) | 0, v = v + Math.imul(_e, $t) | 0, v = v + Math.imul(Ze, bt) | 0, M = M + Math.imul(Ze, $t) | 0, S = S + Math.imul(Le, rt) | 0, v = v + Math.imul(Le, Bt) | 0, v = v + Math.imul(qe, rt) | 0, M = M + Math.imul(qe, Bt) | 0, S = S + Math.imul(Me, z) | 0, v = v + Math.imul(Me, H) | 0, v = v + Math.imul(Ne, z) | 0, M = M + Math.imul(Ne, H) | 0, S = S + Math.imul(De, G) | 0, v = v + Math.imul(De, j) | 0, v = v + Math.imul(Ce, G) | 0, M = M + Math.imul(Ce, j) | 0, S = S + Math.imul(ue, de) | 0, v = v + Math.imul(ue, xe) | 0, v = v + Math.imul(ve, de) | 0, M = M + Math.imul(ve, xe) | 0; + E = (M + (v >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, S = Math.imul(ke, mt), v = Math.imul(ke, Rt), v = v + Math.imul(Qe, mt) | 0, M = Math.imul(Qe, Rt), S = S + Math.imul(_e, bt) | 0, v = v + Math.imul(_e, $t) | 0, v = v + Math.imul(Ze, bt) | 0, M = M + Math.imul(Ze, $t) | 0, S = S + Math.imul(Le, rt) | 0, v = v + Math.imul(Le, Bt) | 0, v = v + Math.imul(qe, rt) | 0, M = M + Math.imul(qe, Bt) | 0, S = S + Math.imul(Me, q) | 0, v = v + Math.imul(Me, H) | 0, v = v + Math.imul(Ne, q) | 0, M = M + Math.imul(Ne, H) | 0, S = S + Math.imul(De, G) | 0, v = v + Math.imul(De, j) | 0, v = v + Math.imul(Ce, G) | 0, M = M + Math.imul(Ce, j) | 0, S = S + Math.imul(ue, de) | 0, v = v + Math.imul(ue, xe) | 0, v = v + Math.imul(ve, de) | 0, M = M + Math.imul(ve, xe) | 0; var st = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, S = Math.imul(ke, bt), v = Math.imul(ke, $t), v = v + Math.imul(Qe, bt) | 0, M = Math.imul(Qe, $t), S = S + Math.imul(_e, rt) | 0, v = v + Math.imul(_e, Bt) | 0, v = v + Math.imul(Ze, rt) | 0, M = M + Math.imul(Ze, Bt) | 0, S = S + Math.imul(Le, z) | 0, v = v + Math.imul(Le, H) | 0, v = v + Math.imul(qe, z) | 0, M = M + Math.imul(qe, H) | 0, S = S + Math.imul(Me, G) | 0, v = v + Math.imul(Me, j) | 0, v = v + Math.imul(Ne, G) | 0, M = M + Math.imul(Ne, j) | 0, S = S + Math.imul(De, de) | 0, v = v + Math.imul(De, xe) | 0, v = v + Math.imul(Ce, de) | 0, M = M + Math.imul(Ce, xe) | 0; + E = (M + (v >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, S = Math.imul(ke, bt), v = Math.imul(ke, $t), v = v + Math.imul(Qe, bt) | 0, M = Math.imul(Qe, $t), S = S + Math.imul(_e, rt) | 0, v = v + Math.imul(_e, Bt) | 0, v = v + Math.imul(Ze, rt) | 0, M = M + Math.imul(Ze, Bt) | 0, S = S + Math.imul(Le, q) | 0, v = v + Math.imul(Le, H) | 0, v = v + Math.imul(qe, q) | 0, M = M + Math.imul(qe, H) | 0, S = S + Math.imul(Me, G) | 0, v = v + Math.imul(Me, j) | 0, v = v + Math.imul(Ne, G) | 0, M = M + Math.imul(Ne, j) | 0, S = S + Math.imul(De, de) | 0, v = v + Math.imul(De, xe) | 0, v = v + Math.imul(Ce, de) | 0, M = M + Math.imul(Ce, xe) | 0; var yt = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (yt >>> 26) | 0, yt &= 67108863, S = Math.imul(ke, rt), v = Math.imul(ke, Bt), v = v + Math.imul(Qe, rt) | 0, M = Math.imul(Qe, Bt), S = S + Math.imul(_e, z) | 0, v = v + Math.imul(_e, H) | 0, v = v + Math.imul(Ze, z) | 0, M = M + Math.imul(Ze, H) | 0, S = S + Math.imul(Le, G) | 0, v = v + Math.imul(Le, j) | 0, v = v + Math.imul(qe, G) | 0, M = M + Math.imul(qe, j) | 0, S = S + Math.imul(Me, de) | 0, v = v + Math.imul(Me, xe) | 0, v = v + Math.imul(Ne, de) | 0, M = M + Math.imul(Ne, xe) | 0; + E = (M + (v >>> 13) | 0) + (yt >>> 26) | 0, yt &= 67108863, S = Math.imul(ke, rt), v = Math.imul(ke, Bt), v = v + Math.imul(Qe, rt) | 0, M = Math.imul(Qe, Bt), S = S + Math.imul(_e, q) | 0, v = v + Math.imul(_e, H) | 0, v = v + Math.imul(Ze, q) | 0, M = M + Math.imul(Ze, H) | 0, S = S + Math.imul(Le, G) | 0, v = v + Math.imul(Le, j) | 0, v = v + Math.imul(qe, G) | 0, M = M + Math.imul(qe, j) | 0, S = S + Math.imul(Me, de) | 0, v = v + Math.imul(Me, xe) | 0, v = v + Math.imul(Ne, de) | 0, M = M + Math.imul(Ne, xe) | 0; var ut = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, S = Math.imul(ke, z), v = Math.imul(ke, H), v = v + Math.imul(Qe, z) | 0, M = Math.imul(Qe, H), S = S + Math.imul(_e, G) | 0, v = v + Math.imul(_e, j) | 0, v = v + Math.imul(Ze, G) | 0, M = M + Math.imul(Ze, j) | 0, S = S + Math.imul(Le, de) | 0, v = v + Math.imul(Le, xe) | 0, v = v + Math.imul(qe, de) | 0, M = M + Math.imul(qe, xe) | 0; + E = (M + (v >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, S = Math.imul(ke, q), v = Math.imul(ke, H), v = v + Math.imul(Qe, q) | 0, M = Math.imul(Qe, H), S = S + Math.imul(_e, G) | 0, v = v + Math.imul(_e, j) | 0, v = v + Math.imul(Ze, G) | 0, M = M + Math.imul(Ze, j) | 0, S = S + Math.imul(Le, de) | 0, v = v + Math.imul(Le, xe) | 0, v = v + Math.imul(qe, de) | 0, M = M + Math.imul(qe, xe) | 0; var ot = (E + S | 0) + ((v & 8191) << 13) | 0; E = (M + (v >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, S = Math.imul(ke, G), v = Math.imul(ke, j), v = v + Math.imul(Qe, G) | 0, M = Math.imul(Qe, j), S = S + Math.imul(_e, de) | 0, v = v + Math.imul(_e, xe) | 0, v = v + Math.imul(Ze, de) | 0, M = M + Math.imul(Ze, xe) | 0; var Se = (E + S | 0) + ((v & 8191) << 13) | 0; @@ -14607,7 +14615,7 @@ hb.exports; }, s.prototype.redPow = function(A) { return n(this.red && !A.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, A); }; - var q = { + var W = { k256: null, p224: null, p192: null, @@ -14689,7 +14697,7 @@ hb.exports; } return m !== 0 && (A.words[A.length++] = m), A; }, s._prime = function(A) { - if (q[A]) return q[A]; + if (W[A]) return W[A]; var m; if (A === "k256") m = new V(); @@ -14701,7 +14709,7 @@ hb.exports; m = new K(); else throw new Error("Unknown prime " + A); - return q[A] = m, m; + return W[A] = m, m; }; function ge(Y) { if (typeof Y == "string") { @@ -14888,8 +14896,8 @@ var Ho = hb.exports, db = {}; L === 3 && (L = -1), B === 3 && (B = -1); var k; L & 1 ? (O = d.andln(7) + _ & 7, (O === 3 || O === 5) && B === 2 ? k = -L : k = L) : k = 0, w[0].push(k); - var q; - B & 1 ? (O = p.andln(7) + P & 7, (O === 3 || O === 5) && L === 2 ? q = -B : q = B) : q = 0, w[1].push(q), 2 * _ === k + 1 && (_ = 1 - _), 2 * P === q + 1 && (P = 1 - P), d.iushrn(1), p.iushrn(1); + var W; + B & 1 ? (O = p.andln(7) + P & 7, (O === 3 || O === 5) && L === 2 ? W = -B : W = B) : W = 0, w[1].push(W), 2 * _ === k + 1 && (_ = 1 - _), 2 * P === W + 1 && (P = 1 - P), d.iushrn(1), p.iushrn(1); } return w; } @@ -14948,7 +14956,7 @@ else }; } catch { } -var X8 = pb.exports, gb = {}, Ja = Ho, sh = ji, v0 = sh.getNAF, $q = sh.getJSF, b0 = sh.assert; +var X8 = pb.exports, gb = {}, Ja = Ho, sh = ji, v0 = sh.getNAF, Bq = sh.getJSF, b0 = sh.assert; function La(t, e) { this.type = t, this.p = new Ja(e.p, 16), this.red = e.prime ? Ja.red(e.prime) : Ja.mont(this.p), this.zero = new Ja(0).toRed(this.red), this.one = new Ja(1).toRed(this.red), this.two = new Ja(2).toRed(this.red), this.n = e.n && new Ja(e.n, 16), this.g = e.g && this.pointFromJSON(e.g, e.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; var r = this.n && this.p.div(this.n); @@ -15035,10 +15043,10 @@ La.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 1 0 */ 3 /* 1 1 */ - ], k = $q(n[P], n[O]); + ], k = Bq(n[P], n[O]); for (l = Math.max(k[0].length, l), u[P] = new Array(l), u[O] = new Array(l), p = 0; p < l; p++) { - var q = k[0][p] | 0, U = k[1][p] | 0; - u[P][p] = B[(q + 1) * 3 + (U + 1)], u[O][p] = 0, a[P] = L; + var W = k[0][p] | 0, U = k[1][p] | 0; + u[P][p] = B[(W + 1) * 3 + (U + 1)], u[O][p] = 0, a[P] = L; } } var V = this.jpoint(null, null, null), Q = this._wnafT4; @@ -15143,12 +15151,12 @@ as.prototype.dblp = function(e) { r = r.dbl(); return r; }; -var Bq = ji, rn = Ho, mb = np, Ku = cp, Fq = Bq.assert; +var Fq = ji, rn = Ho, mb = np, Vu = cp, jq = Fq.assert; function cs(t) { - Ku.call(this, "short", t), this.a = new rn(t.a, 16).toRed(this.red), this.b = new rn(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); + Vu.call(this, "short", t), this.a = new rn(t.a, 16).toRed(this.red), this.b = new rn(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); } -mb(cs, Ku); -var jq = cs; +mb(cs, Vu); +var Uq = cs; cs.prototype._getEndomorphism = function(e) { if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { var r, n; @@ -15162,7 +15170,7 @@ cs.prototype._getEndomorphism = function(e) { n = new rn(e.lambda, 16); else { var s = this._getEndoRoots(this.n); - this.g.mul(s[0]).x.cmp(this.g.x.redMul(r)) === 0 ? n = s[0] : (n = s[1], Fq(this.g.mul(n).x.cmp(this.g.x.redMul(r)) === 0)); + this.g.mul(s[0]).x.cmp(this.g.x.redMul(r)) === 0 ? n = s[0] : (n = s[1], jq(this.g.mul(n).x.cmp(this.g.x.redMul(r)) === 0)); } var o; return e.basis ? o = e.basis.map(function(a) { @@ -15183,9 +15191,9 @@ cs.prototype._getEndoRoots = function(e) { }; cs.prototype._getEndoBasis = function(e) { for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new rn(1), o = new rn(0), a = new rn(0), u = new rn(1), l, d, p, w, _, P, O, L = 0, B, k; n.cmpn(0) !== 0; ) { - var q = i.div(n); - B = i.sub(q.mul(n)), k = a.sub(q.mul(s)); - var U = u.sub(q.mul(o)); + var W = i.div(n); + B = i.sub(W.mul(n)), k = a.sub(W.mul(s)); + var U = u.sub(W.mul(o)); if (!p && B.cmp(r) < 0) l = O.neg(), d = s, p = B.neg(), w = k; else if (p && ++L === 2) @@ -15227,9 +15235,9 @@ cs.prototype._endoWnafMulAdd = function(e, r, n) { return d; }; function $n(t, e, r, n) { - Ku.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new rn(e, 16), this.y = new rn(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); + Vu.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new rn(e, 16), this.y = new rn(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); } -mb($n, Ku.BasePoint); +mb($n, Vu.BasePoint); cs.prototype.point = function(e, r, n) { return new $n(this, e, r, n); }; @@ -15373,9 +15381,9 @@ $n.prototype.toJ = function() { return e; }; function Wn(t, e, r, n) { - Ku.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new rn(0)) : (this.x = new rn(e, 16), this.y = new rn(r, 16), this.z = new rn(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; + Vu.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new rn(0)) : (this.x = new rn(e, 16), this.y = new rn(r, 16), this.z = new rn(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; } -mb(Wn, Ku.BasePoint); +mb(Wn, Vu.BasePoint); cs.prototype.jpoint = function(e, r, n) { return new Wn(this, e, r, n); }; @@ -15428,8 +15436,8 @@ Wn.prototype.dblp = function(e) { for (r = 0; r < e; r++) { var p = o.redSqr(), w = d.redSqr(), _ = w.redSqr(), P = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), O = o.redMul(w), L = P.redSqr().redISub(O.redAdd(O)), B = O.redISub(L), k = P.redMul(B); k = k.redIAdd(k).redISub(_); - var q = d.redMul(u); - r + 1 < e && (l = l.redMul(_)), o = L, u = q, d = k; + var W = d.redMul(u); + r + 1 < e && (l = l.redMul(_)), o = L, u = W, d = k; } return this.curve.jpoint(o, d.redMul(s), u); }; @@ -15527,13 +15535,13 @@ Wn.prototype.inspect = function() { Wn.prototype.isInfinity = function() { return this.z.cmpn(0) === 0; }; -var uu = Ho, Z8 = np, up = cp, Uq = ji; -function Vu(t) { +var uu = Ho, Z8 = np, up = cp, qq = ji; +function Gu(t) { up.call(this, "mont", t), this.a = new uu(t.a, 16).toRed(this.red), this.b = new uu(t.b, 16).toRed(this.red), this.i4 = new uu(4).toRed(this.red).redInvm(), this.two = new uu(2).toRed(this.red), this.a24 = this.i4.redMul(this.a.redAdd(this.two)); } -Z8(Vu, up); -var qq = Vu; -Vu.prototype.validate = function(e) { +Z8(Gu, up); +var zq = Gu; +Gu.prototype.validate = function(e) { var r = e.normalize().x, n = r.redSqr(), i = n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r), s = i.redSqrt(); return s.redSqr().cmp(i) === 0; }; @@ -15541,13 +15549,13 @@ function Ln(t, e, r) { up.BasePoint.call(this, t, "projective"), e === null && r === null ? (this.x = this.curve.one, this.z = this.curve.zero) : (this.x = new uu(e, 16), this.z = new uu(r, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red))); } Z8(Ln, up.BasePoint); -Vu.prototype.decodePoint = function(e, r) { - return this.point(Uq.toArray(e, r), 1); +Gu.prototype.decodePoint = function(e, r) { + return this.point(qq.toArray(e, r), 1); }; -Vu.prototype.point = function(e, r) { +Gu.prototype.point = function(e, r) { return new Ln(this, e, r); }; -Vu.prototype.pointFromJSON = function(e) { +Gu.prototype.pointFromJSON = function(e) { return Ln.fromJSON(this, e); }; Ln.prototype.precompute = function() { @@ -15597,12 +15605,12 @@ Ln.prototype.normalize = function() { Ln.prototype.getX = function() { return this.normalize(), this.x.fromRed(); }; -var zq = ji, Io = Ho, Q8 = np, fp = cp, Wq = zq.assert; +var Wq = ji, Io = Ho, Q8 = np, fp = cp, Hq = Wq.assert; function oo(t) { - this.twisted = (t.a | 0) !== 1, this.mOneA = this.twisted && (t.a | 0) === -1, this.extended = this.mOneA, fp.call(this, "edwards", t), this.a = new Io(t.a, 16).umod(this.red.m), this.a = this.a.toRed(this.red), this.c = new Io(t.c, 16).toRed(this.red), this.c2 = this.c.redSqr(), this.d = new Io(t.d, 16).toRed(this.red), this.dd = this.d.redAdd(this.d), Wq(!this.twisted || this.c.fromRed().cmpn(1) === 0), this.oneC = (t.c | 0) === 1; + this.twisted = (t.a | 0) !== 1, this.mOneA = this.twisted && (t.a | 0) === -1, this.extended = this.mOneA, fp.call(this, "edwards", t), this.a = new Io(t.a, 16).umod(this.red.m), this.a = this.a.toRed(this.red), this.c = new Io(t.c, 16).toRed(this.red), this.c2 = this.c.redSqr(), this.d = new Io(t.d, 16).toRed(this.red), this.dd = this.d.redAdd(this.d), Hq(!this.twisted || this.c.fromRed().cmpn(1) === 0), this.oneC = (t.c | 0) === 1; } Q8(oo, fp); -var Hq = oo; +var Kq = oo; oo.prototype._mulA = function(e) { return this.mOneA ? e.redNeg() : this.a.redMul(e); }; @@ -15736,10 +15744,10 @@ Hr.prototype.toP = Hr.prototype.normalize; Hr.prototype.mixedAdd = Hr.prototype.add; (function(t) { var e = t; - e.base = cp, e.short = jq, e.mont = qq, e.edwards = Hq; + e.base = cp, e.short = Uq, e.mont = zq, e.edwards = Kq; })(gb); var lp = {}, _m, Vx; -function Kq() { +function Vq() { return Vx || (Vx = 1, _m = { doubles: { step: 4, @@ -16637,7 +16645,7 @@ function Kq() { }); var u; try { - u = Kq(); + u = Vq(); } catch { u = void 0; } @@ -16671,7 +16679,7 @@ function Kq() { ] }); })(lp); -var Vq = rh, dc = db, eE = Tc; +var Gq = rh, dc = db, eE = Tc; function Aa(t) { if (!(this instanceof Aa)) return new Aa(t); @@ -16682,7 +16690,7 @@ function Aa(t) { "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._init(e, r, n); } -var Gq = Aa; +var Yq = Aa; Aa.prototype._init = function(e, r, n) { var i = e.concat(r).concat(n); this.K = new Array(this.outLen / 8), this.V = new Array(this.outLen / 8); @@ -16691,7 +16699,7 @@ Aa.prototype._init = function(e, r, n) { this._update(i), this._reseed = 1, this.reseedInterval = 281474976710656; }; Aa.prototype._hmac = function() { - return new Vq.hmac(this.hash, this.K); + return new Gq.hmac(this.hash, this.K); }; Aa.prototype._update = function(e) { var r = this._hmac().update(this.V).update([0]); @@ -16712,11 +16720,11 @@ Aa.prototype.generate = function(e, r, n, i) { var o = s.slice(0, e); return this._update(n), this._reseed++, dc.encode(o, r); }; -var Yq = Ho, Jq = ji, q1 = Jq.assert; +var Jq = Ho, Xq = ji, q1 = Xq.assert; function ti(t, e) { this.ec = t, this.priv = null, this.pub = null, e.priv && this._importPrivate(e.priv, e.privEnc), e.pub && this._importPublic(e.pub, e.pubEnc); } -var Xq = ti; +var Zq = ti; ti.fromPublic = function(e, r, n) { return r instanceof ti ? r : new ti(e, { pub: r, @@ -16740,7 +16748,7 @@ ti.prototype.getPrivate = function(e) { return e === "hex" ? this.priv.toString(16, 2) : this.priv; }; ti.prototype._importPrivate = function(e, r) { - this.priv = new Yq(e, r || 16), this.priv = this.priv.umod(this.ec.curve.n); + this.priv = new Jq(e, r || 16), this.priv = this.priv.umod(this.ec.curve.n); }; ti.prototype._importPublic = function(e, r) { if (e.x || e.y) { @@ -16761,14 +16769,14 @@ ti.prototype.verify = function(e, r, n) { ti.prototype.inspect = function() { return ""; }; -var y0 = Ho, vb = ji, Zq = vb.assert; +var y0 = Ho, vb = ji, Qq = vb.assert; function hp(t, e) { if (t instanceof hp) return t; - this._importDER(t, e) || (Zq(t.r && t.s, "Signature without r or s"), this.r = new y0(t.r, 16), this.s = new y0(t.s, 16), t.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = t.recoveryParam); + this._importDER(t, e) || (Qq(t.r && t.s, "Signature without r or s"), this.r = new y0(t.r, 16), this.s = new y0(t.s, 16), t.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = t.recoveryParam); } -var Qq = hp; -function ez() { +var ez = hp; +function tz() { this.place = 0; } function Em(t, e) { @@ -16789,7 +16797,7 @@ function Gx(t) { } hp.prototype._importDER = function(e, r) { e = vb.toArray(e, r); - var n = new ez(); + var n = new tz(); if (e[n.place++] !== 48) return !1; var i = Em(e, n); @@ -16836,7 +16844,7 @@ hp.prototype.toDER = function(e) { var s = i.concat(n), o = [48]; return Sm(o, s.length), o = o.concat(s), vb.encode(o, e); }; -var Co = Ho, tE = Gq, tz = ji, Am = lp, rz = X8, rE = tz.assert, bb = Xq, dp = Qq; +var Co = Ho, tE = Yq, rz = ji, Am = lp, nz = X8, rE = rz.assert, bb = Zq, dp = ez; function rs(t) { if (!(this instanceof rs)) return new rs(t); @@ -16845,7 +16853,7 @@ function rs(t) { "Unknown curve " + t ), t = Am[t]), t instanceof Am.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; } -var nz = rs; +var iz = rs; rs.prototype.keyPair = function(e) { return new bb(this, e); }; @@ -16861,7 +16869,7 @@ rs.prototype.genKeyPair = function(e) { hash: this.hash, pers: e.pers, persEnc: e.persEnc || "utf8", - entropy: e.entropy || rz(this.hash.hmacStrength), + entropy: e.entropy || nz(this.hash.hmacStrength), entropyEnc: e.entropy && e.entropyEnc || "utf8", nonce: this.n.toArray() }), n = this.n.byteLength(), i = this.n.sub(new Co(2)); ; ) { @@ -16941,7 +16949,7 @@ rs.prototype.getKeyRecoveryParam = function(t, e, r, n) { } throw new Error("Unable to find valid recovery factor"); }; -var oh = ji, nE = oh.assert, Yx = oh.parseBytes, Gu = oh.cachedProperty; +var oh = ji, nE = oh.assert, Yx = oh.parseBytes, Yu = oh.cachedProperty; function Nn(t, e) { this.eddsa = t, this._secret = Yx(e.secret), t.isPoint(e.pub) ? this._pub = e.pub : this._pubBytes = Yx(e.pub); } @@ -16954,23 +16962,23 @@ Nn.fromSecret = function(e, r) { Nn.prototype.secret = function() { return this._secret; }; -Gu(Nn, "pubBytes", function() { +Yu(Nn, "pubBytes", function() { return this.eddsa.encodePoint(this.pub()); }); -Gu(Nn, "pub", function() { +Yu(Nn, "pub", function() { return this._pubBytes ? this.eddsa.decodePoint(this._pubBytes) : this.eddsa.g.mul(this.priv()); }); -Gu(Nn, "privBytes", function() { +Yu(Nn, "privBytes", function() { var e = this.eddsa, r = this.hash(), n = e.encodingLength - 1, i = r.slice(0, e.encodingLength); return i[0] &= 248, i[n] &= 127, i[n] |= 64, i; }); -Gu(Nn, "priv", function() { +Yu(Nn, "priv", function() { return this.eddsa.decodeInt(this.privBytes()); }); -Gu(Nn, "hash", function() { +Yu(Nn, "hash", function() { return this.eddsa.hash().update(this.secret()).digest(); }); -Gu(Nn, "messagePrefix", function() { +Yu(Nn, "messagePrefix", function() { return this.hash().slice(this.eddsa.encodingLength); }); Nn.prototype.sign = function(e) { @@ -16985,12 +16993,12 @@ Nn.prototype.getSecret = function(e) { Nn.prototype.getPublic = function(e) { return oh.encode(this.pubBytes(), e); }; -var iz = Nn, sz = Ho, pp = ji, Jx = pp.assert, gp = pp.cachedProperty, oz = pp.parseBytes; +var sz = Nn, oz = Ho, pp = ji, Jx = pp.assert, gp = pp.cachedProperty, az = pp.parseBytes; function Dc(t, e) { - this.eddsa = t, typeof e != "object" && (e = oz(e)), Array.isArray(e) && (Jx(e.length === t.encodingLength * 2, "Signature has invalid size"), e = { + this.eddsa = t, typeof e != "object" && (e = az(e)), Array.isArray(e) && (Jx(e.length === t.encodingLength * 2, "Signature has invalid size"), e = { R: e.slice(0, t.encodingLength), S: e.slice(t.encodingLength) - }), Jx(e.R && e.S, "Signature without R or S"), t.isPoint(e.R) && (this._R = e.R), e.S instanceof sz && (this._S = e.S), this._Rencoded = Array.isArray(e.R) ? e.R : e.Rencoded, this._Sencoded = Array.isArray(e.S) ? e.S : e.Sencoded; + }), Jx(e.R && e.S, "Signature without R or S"), t.isPoint(e.R) && (this._R = e.R), e.S instanceof oz && (this._S = e.S), this._Rencoded = Array.isArray(e.R) ? e.R : e.Rencoded, this._Sencoded = Array.isArray(e.S) ? e.S : e.Sencoded; } gp(Dc, "S", function() { return this.eddsa.decodeInt(this.Sencoded()); @@ -17010,13 +17018,13 @@ Dc.prototype.toBytes = function() { Dc.prototype.toHex = function() { return pp.encode(this.toBytes(), "hex").toUpperCase(); }; -var az = Dc, cz = rh, uz = lp, Nu = ji, fz = Nu.assert, iE = Nu.parseBytes, sE = iz, Xx = az; +var cz = Dc, uz = rh, fz = lp, Lu = ji, lz = Lu.assert, iE = Lu.parseBytes, sE = sz, Xx = cz; function Si(t) { - if (fz(t === "ed25519", "only tested with ed25519 so far"), !(this instanceof Si)) + if (lz(t === "ed25519", "only tested with ed25519 so far"), !(this instanceof Si)) return new Si(t); - t = uz[t].curve, this.curve = t, this.g = t.g, this.g.precompute(t.n.bitLength() + 1), this.pointClass = t.point().constructor, this.encodingLength = Math.ceil(t.n.bitLength() / 8), this.hash = cz.sha512; + t = fz[t].curve, this.curve = t, this.g = t.g, this.g.precompute(t.n.bitLength() + 1), this.pointClass = t.point().constructor, this.encodingLength = Math.ceil(t.n.bitLength() / 8), this.hash = uz.sha512; } -var lz = Si; +var hz = Si; Si.prototype.sign = function(e, r) { e = iE(e); var n = this.keyFromSecret(r), i = this.hashInt(n.messagePrefix(), e), s = this.g.mul(i), o = this.encodePoint(s), a = this.hashInt(o, n.pubBytes(), e).mul(n.priv()), u = i.add(a).umod(this.curve.n); @@ -17031,7 +17039,7 @@ Si.prototype.verify = function(e, r, n) { Si.prototype.hashInt = function() { for (var e = this.hash(), r = 0; r < arguments.length; r++) e.update(arguments[r]); - return Nu.intFromLE(e.digest()).umod(this.curve.n); + return Lu.intFromLE(e.digest()).umod(this.curve.n); }; Si.prototype.keyFromPublic = function(e) { return sE.fromPublic(this, e); @@ -17047,85 +17055,85 @@ Si.prototype.encodePoint = function(e) { return r[this.encodingLength - 1] |= e.getX().isOdd() ? 128 : 0, r; }; Si.prototype.decodePoint = function(e) { - e = Nu.parseBytes(e); - var r = e.length - 1, n = e.slice(0, r).concat(e[r] & -129), i = (e[r] & 128) !== 0, s = Nu.intFromLE(n); + e = Lu.parseBytes(e); + var r = e.length - 1, n = e.slice(0, r).concat(e[r] & -129), i = (e[r] & 128) !== 0, s = Lu.intFromLE(n); return this.curve.pointFromY(s, i); }; Si.prototype.encodeInt = function(e) { return e.toArray("le", this.encodingLength); }; Si.prototype.decodeInt = function(e) { - return Nu.intFromLE(e); + return Lu.intFromLE(e); }; Si.prototype.isPoint = function(e) { return e instanceof this.pointClass; }; (function(t) { var e = t; - e.version = kq.version, e.utils = ji, e.rand = X8, e.curve = gb, e.curves = lp, e.ec = nz, e.eddsa = lz; + e.version = $q.version, e.utils = ji, e.rand = X8, e.curve = gb, e.curves = lp, e.ec = iz, e.eddsa = hz; })(J8); -const hz = { waku: { publish: "waku_publish", batchPublish: "waku_batchPublish", subscribe: "waku_subscribe", batchSubscribe: "waku_batchSubscribe", subscription: "waku_subscription", unsubscribe: "waku_unsubscribe", batchUnsubscribe: "waku_batchUnsubscribe", batchFetchMessages: "waku_batchFetchMessages" }, irn: { publish: "irn_publish", batchPublish: "irn_batchPublish", subscribe: "irn_subscribe", batchSubscribe: "irn_batchSubscribe", subscription: "irn_subscription", unsubscribe: "irn_unsubscribe", batchUnsubscribe: "irn_batchUnsubscribe", batchFetchMessages: "irn_batchFetchMessages" }, iridium: { publish: "iridium_publish", batchPublish: "iridium_batchPublish", subscribe: "iridium_subscribe", batchSubscribe: "iridium_batchSubscribe", subscription: "iridium_subscription", unsubscribe: "iridium_unsubscribe", batchUnsubscribe: "iridium_batchUnsubscribe", batchFetchMessages: "iridium_batchFetchMessages" } }, dz = ":"; -function _u(t) { - const [e, r] = t.split(dz); +const dz = { waku: { publish: "waku_publish", batchPublish: "waku_batchPublish", subscribe: "waku_subscribe", batchSubscribe: "waku_batchSubscribe", subscription: "waku_subscription", unsubscribe: "waku_unsubscribe", batchUnsubscribe: "waku_batchUnsubscribe", batchFetchMessages: "waku_batchFetchMessages" }, irn: { publish: "irn_publish", batchPublish: "irn_batchPublish", subscribe: "irn_subscribe", batchSubscribe: "irn_batchSubscribe", subscription: "irn_subscription", unsubscribe: "irn_unsubscribe", batchUnsubscribe: "irn_batchUnsubscribe", batchFetchMessages: "irn_batchFetchMessages" }, iridium: { publish: "iridium_publish", batchPublish: "iridium_batchPublish", subscribe: "iridium_subscribe", batchSubscribe: "iridium_batchSubscribe", subscription: "iridium_subscription", unsubscribe: "iridium_unsubscribe", batchUnsubscribe: "iridium_batchUnsubscribe", batchFetchMessages: "iridium_batchFetchMessages" } }, pz = ":"; +function Eu(t) { + const [e, r] = t.split(pz); return { namespace: e, reference: r }; } function oE(t, e) { return t.includes(":") ? [t] : e.chains || []; } -var pz = Object.defineProperty, Zx = Object.getOwnPropertySymbols, gz = Object.prototype.hasOwnProperty, mz = Object.prototype.propertyIsEnumerable, Qx = (t, e, r) => e in t ? pz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, e3 = (t, e) => { - for (var r in e || (e = {})) gz.call(e, r) && Qx(t, r, e[r]); - if (Zx) for (var r of Zx(e)) mz.call(e, r) && Qx(t, r, e[r]); +var gz = Object.defineProperty, Zx = Object.getOwnPropertySymbols, mz = Object.prototype.hasOwnProperty, vz = Object.prototype.propertyIsEnumerable, Qx = (t, e, r) => e in t ? gz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, e3 = (t, e) => { + for (var r in e || (e = {})) mz.call(e, r) && Qx(t, r, e[r]); + if (Zx) for (var r of Zx(e)) vz.call(e, r) && Qx(t, r, e[r]); return t; }; -const vz = "ReactNative", Oi = { reactNative: "react-native", node: "node", browser: "browser", unknown: "unknown" }, bz = "js"; +const bz = "ReactNative", Oi = { reactNative: "react-native", node: "node", browser: "browser", unknown: "unknown" }, yz = "js"; function w0() { return typeof process < "u" && typeof process.versions < "u" && typeof process.versions.node < "u"; } -function Yu() { - return !th() && !!eb() && navigator.product === vz; +function Ju() { + return !th() && !!eb() && navigator.product === bz; } function ah() { return !w0() && !!eb() && !!th(); } function ch() { - return Yu() ? Oi.reactNative : w0() ? Oi.node : ah() ? Oi.browser : Oi.unknown; + return Ju() ? Oi.reactNative : w0() ? Oi.node : ah() ? Oi.browser : Oi.unknown; } -function yz() { +function wz() { var t; try { - return Yu() && typeof global < "u" && typeof (global == null ? void 0 : global.Application) < "u" ? (t = global.Application) == null ? void 0 : t.applicationId : void 0; + return Ju() && typeof global < "u" && typeof (global == null ? void 0 : global.Application) < "u" ? (t = global.Application) == null ? void 0 : t.applicationId : void 0; } catch { return; } } -function wz(t, e) { +function xz(t, e) { let r = Dl.parse(t); return r = e3(e3({}, r), e), t = Dl.stringify(r), t; } function aE() { return v8() || { name: "", description: "", url: "", icons: [""] }; } -function xz() { +function _z() { if (ch() === Oi.reactNative && typeof global < "u" && typeof (global == null ? void 0 : global.Platform) < "u") { const { OS: r, Version: n } = global.Platform; return [r, n].join("-"); } - const t = OF(); + const t = NF(); if (t === null) return "unknown"; const e = t.os ? t.os.replace(" ", "").toLowerCase() : "unknown"; return t.type === "browser" ? [e, t.name, t.version].join("-") : [e, t.version].join("-"); } -function _z() { +function Ez() { var t; const e = ch(); return e === Oi.browser ? [e, ((t = m8()) == null ? void 0 : t.host) || "unknown"].join(":") : e; } function cE(t, e, r) { - const n = xz(), i = _z(); - return [[t, e].join("-"), [bz, r].join("-"), n, i].join("/"); + const n = _z(), i = Ez(); + return [[t, e].join("-"), [yz, r].join("-"), n, i].join("/"); } -function Ez({ protocol: t, version: e, relayUrl: r, sdkVersion: n, auth: i, projectId: s, useOnCloseEvent: o, bundleId: a }) { - const u = r.split("?"), l = cE(t, e, n), d = { auth: i, ua: l, projectId: s, useOnCloseEvent: o, origin: a || void 0 }, p = wz(u[1] || "", d); +function Sz({ protocol: t, version: e, relayUrl: r, sdkVersion: n, auth: i, projectId: s, useOnCloseEvent: o, bundleId: a }) { + const u = r.split("?"), l = cE(t, e, n), d = { auth: i, ua: l, projectId: s, useOnCloseEvent: o, origin: a || void 0 }, p = xz(u[1] || "", d); return u[0] + "?" + p; } function uc(t, e) { @@ -17150,7 +17158,7 @@ function ec(t = vt.FIVE_MINUTES, e) { }, r), n = o, i = a; }) }; } -function Eu(t, e, r) { +function Su(t, e, r) { return new Promise(async (n, i) => { const s = setTimeout(() => i(new Error(r)), e); try { @@ -17173,10 +17181,10 @@ function lE(t, e) { } throw new Error(`Unknown expirer target type: ${t}`); } -function Sz(t) { +function Az(t) { return lE("topic", t); } -function Az(t) { +function Pz(t) { return lE("id", t); } function hE(t) { @@ -17198,35 +17206,35 @@ function yr(t, e) { function jd(t = [], e = []) { return [.../* @__PURE__ */ new Set([...t, ...e])]; } -async function Pz({ id: t, topic: e, wcDeepLink: r }) { +async function Mz({ id: t, topic: e, wcDeepLink: r }) { var n; try { if (!r) return; const i = typeof r == "string" ? JSON.parse(r) : r, s = i == null ? void 0 : i.href; if (typeof s != "string") return; - const o = Mz(s, t, e), a = ch(); + const o = Iz(s, t, e), a = ch(); if (a === Oi.browser) { if (!((n = th()) != null && n.hasFocus())) { console.warn("Document does not have focus, skipping deeplink."); return; } - o.startsWith("https://") || o.startsWith("http://") ? window.open(o, "_blank", "noreferrer noopener") : window.open(o, Cz() ? "_blank" : "_self", "noreferrer noopener"); + o.startsWith("https://") || o.startsWith("http://") ? window.open(o, "_blank", "noreferrer noopener") : window.open(o, Tz() ? "_blank" : "_self", "noreferrer noopener"); } else a === Oi.reactNative && typeof (global == null ? void 0 : global.Linking) < "u" && await global.Linking.openURL(o); } catch (i) { console.error(i); } } -function Mz(t, e, r) { +function Iz(t, e, r) { const n = `requestId=${e}&sessionTopic=${r}`; t.endsWith("/") && (t = t.slice(0, -1)); let i = `${t}`; if (t.startsWith("https://t.me")) { const s = t.includes("?") ? "&startapp=" : "?startapp="; - i = `${i}${s}${Tz(n, !0)}`; + i = `${i}${s}${Rz(n, !0)}`; } else i = `${i}/wc?${n}`; return i; } -async function Iz(t, e) { +async function Cz(t, e) { let r = ""; try { if (ah() && (r = localStorage.getItem(e), r)) return r; @@ -17250,51 +17258,51 @@ function r3() { function yb() { return typeof process < "u" && process.env.IS_VITEST === "true"; } -function Cz() { +function Tz() { return typeof window < "u" && (!!window.TelegramWebviewProxy || !!window.Telegram || !!window.TelegramWebviewProxyProto); } -function Tz(t, e = !1) { +function Rz(t, e = !1) { const r = Buffer.from(t).toString("base64"); return e ? r.replace(/[=]/g, "") : r; } function dE(t) { return Buffer.from(t, "base64").toString("utf-8"); } -const Rz = "https://rpc.walletconnect.org/v1"; -async function Dz(t, e, r, n, i, s) { +const Dz = "https://rpc.walletconnect.org/v1"; +async function Oz(t, e, r, n, i, s) { switch (r.t) { case "eip191": - return Oz(t, e, r.s); + return Nz(t, e, r.s); case "eip1271": - return await Nz(t, e, r.s, n, i, s); + return await Lz(t, e, r.s, n, i, s); default: throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`); } } -function Oz(t, e, r) { - return cq(_8(e), r).toLowerCase() === t.toLowerCase(); +function Nz(t, e, r) { + return uq(_8(e), r).toLowerCase() === t.toLowerCase(); } -async function Nz(t, e, r, n, i, s) { - const o = _u(n); +async function Lz(t, e, r, n, i, s) { + const o = Eu(n); if (!o.namespace || !o.reference) throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`); try { - const a = "0x1626ba7e", u = "0000000000000000000000000000000000000000000000000000000000000040", l = "0000000000000000000000000000000000000000000000000000000000000041", d = r.substring(2), p = _8(e).substring(2), w = a + p + u + l + d, _ = await fetch(`${s || Rz}/?chainId=${n}&projectId=${i}`, { method: "POST", body: JSON.stringify({ id: Lz(), jsonrpc: "2.0", method: "eth_call", params: [{ to: t, data: w }, "latest"] }) }), { result: P } = await _.json(); + const a = "0x1626ba7e", u = "0000000000000000000000000000000000000000000000000000000000000040", l = "0000000000000000000000000000000000000000000000000000000000000041", d = r.substring(2), p = _8(e).substring(2), w = a + p + u + l + d, _ = await fetch(`${s || Dz}/?chainId=${n}&projectId=${i}`, { method: "POST", body: JSON.stringify({ id: kz(), jsonrpc: "2.0", method: "eth_call", params: [{ to: t, data: w }, "latest"] }) }), { result: P } = await _.json(); return P ? P.slice(0, a.length).toLowerCase() === a.toLowerCase() : !1; } catch (a) { return console.error("isValidEip1271Signature: ", a), !1; } } -function Lz() { +function kz() { return Date.now() + Math.floor(Math.random() * 1e3); } -var kz = Object.defineProperty, $z = Object.defineProperties, Bz = Object.getOwnPropertyDescriptors, n3 = Object.getOwnPropertySymbols, Fz = Object.prototype.hasOwnProperty, jz = Object.prototype.propertyIsEnumerable, i3 = (t, e, r) => e in t ? kz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Uz = (t, e) => { - for (var r in e || (e = {})) Fz.call(e, r) && i3(t, r, e[r]); - if (n3) for (var r of n3(e)) jz.call(e, r) && i3(t, r, e[r]); +var $z = Object.defineProperty, Bz = Object.defineProperties, Fz = Object.getOwnPropertyDescriptors, n3 = Object.getOwnPropertySymbols, jz = Object.prototype.hasOwnProperty, Uz = Object.prototype.propertyIsEnumerable, i3 = (t, e, r) => e in t ? $z(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, qz = (t, e) => { + for (var r in e || (e = {})) jz.call(e, r) && i3(t, r, e[r]); + if (n3) for (var r of n3(e)) Uz.call(e, r) && i3(t, r, e[r]); return t; -}, qz = (t, e) => $z(t, Bz(e)); -const zz = "did:pkh:", wb = (t) => t == null ? void 0 : t.split(":"), Wz = (t) => { +}, zz = (t, e) => Bz(t, Fz(e)); +const Wz = "did:pkh:", wb = (t) => t == null ? void 0 : t.split(":"), Hz = (t) => { const e = t && wb(t); - if (e) return t.includes(zz) ? e[3] : e[1]; + if (e) return t.includes(Wz) ? e[3] : e[1]; }, z1 = (t) => { const e = t && wb(t); if (e) return e[2] + ":" + e[3]; @@ -17304,25 +17312,25 @@ const zz = "did:pkh:", wb = (t) => t == null ? void 0 : t.split(":"), Wz = (t) = }; async function s3(t) { const { cacao: e, projectId: r } = t, { s: n, p: i } = e, s = pE(i, i.iss), o = x0(i.iss); - return await Dz(o, s, n, z1(i.iss), r); + return await Oz(o, s, n, z1(i.iss), r); } const pE = (t, e) => { const r = `${t.domain} wants you to sign in with your Ethereum account:`, n = x0(e); if (!t.aud && !t.uri) throw new Error("Either `aud` or `uri` is required to construct the message"); let i = t.statement || void 0; - const s = `URI: ${t.aud || t.uri}`, o = `Version: ${t.version}`, a = `Chain ID: ${Wz(e)}`, u = `Nonce: ${t.nonce}`, l = `Issued At: ${t.iat}`, d = t.exp ? `Expiration Time: ${t.exp}` : void 0, p = t.nbf ? `Not Before: ${t.nbf}` : void 0, w = t.requestId ? `Request ID: ${t.requestId}` : void 0, _ = t.resources ? `Resources:${t.resources.map((O) => ` + const s = `URI: ${t.aud || t.uri}`, o = `Version: ${t.version}`, a = `Chain ID: ${Hz(e)}`, u = `Nonce: ${t.nonce}`, l = `Issued At: ${t.iat}`, d = t.exp ? `Expiration Time: ${t.exp}` : void 0, p = t.nbf ? `Not Before: ${t.nbf}` : void 0, w = t.requestId ? `Request ID: ${t.requestId}` : void 0, _ = t.resources ? `Resources:${t.resources.map((O) => ` - ${O}`).join("")}` : void 0, P = Ud(t.resources); if (P) { const O = Ol(P); - i = Qz(i, O); + i = eW(i, O); } return [r, n, "", i, "", s, o, a, u, l, d, p, w, _].filter((O) => O != null).join(` `); }; -function Hz(t) { +function Kz(t) { return Buffer.from(JSON.stringify(t)).toString("base64"); } -function Kz(t) { +function Vz(t) { return JSON.parse(Buffer.from(t, "base64").toString("utf-8")); } function wc(t) { @@ -17345,44 +17353,44 @@ function wc(t) { }); }); } -function Vz(t, e, r, n = {}) { - return r == null || r.sort((i, s) => i.localeCompare(s)), { att: { [t]: Gz(e, r, n) } }; +function Gz(t, e, r, n = {}) { + return r == null || r.sort((i, s) => i.localeCompare(s)), { att: { [t]: Yz(e, r, n) } }; } -function Gz(t, e, r = {}) { +function Yz(t, e, r = {}) { e = e == null ? void 0 : e.sort((i, s) => i.localeCompare(s)); const n = e.map((i) => ({ [`${t}/${i}`]: [r] })); return Object.assign({}, ...n); } function gE(t) { - return wc(t), `urn:recap:${Hz(t).replace(/=/g, "")}`; + return wc(t), `urn:recap:${Kz(t).replace(/=/g, "")}`; } function Ol(t) { - const e = Kz(t.replace("urn:recap:", "")); + const e = Vz(t.replace("urn:recap:", "")); return wc(e), e; } -function Yz(t, e, r) { - const n = Vz(t, e, r); +function Jz(t, e, r) { + const n = Gz(t, e, r); return gE(n); } -function Jz(t) { +function Xz(t) { return t && t.includes("urn:recap:"); } -function Xz(t, e) { - const r = Ol(t), n = Ol(e), i = Zz(r, n); +function Zz(t, e) { + const r = Ol(t), n = Ol(e), i = Qz(r, n); return gE(i); } -function Zz(t, e) { +function Qz(t, e) { wc(t), wc(e); const r = Object.keys(t.att).concat(Object.keys(e.att)).sort((i, s) => i.localeCompare(s)), n = { att: {} }; return r.forEach((i) => { var s, o; Object.keys(((s = t.att) == null ? void 0 : s[i]) || {}).concat(Object.keys(((o = e.att) == null ? void 0 : o[i]) || {})).sort((a, u) => a.localeCompare(u)).forEach((a) => { var u, l; - n.att[i] = qz(Uz({}, n.att[i]), { [a]: ((u = t.att[i]) == null ? void 0 : u[a]) || ((l = e.att[i]) == null ? void 0 : l[a]) }); + n.att[i] = zz(qz({}, n.att[i]), { [a]: ((u = t.att[i]) == null ? void 0 : u[a]) || ((l = e.att[i]) == null ? void 0 : l[a]) }); }); }), n; } -function Qz(t = "", e) { +function eW(t = "", e) { wc(e); const r = "I further authorize the stated URI to perform the following actions on my behalf: "; if (t.includes(r)) return t; @@ -17422,10 +17430,10 @@ function a3(t) { function Ud(t) { if (!t) return; const e = t == null ? void 0 : t[t.length - 1]; - return Jz(e) ? e : void 0; + return Xz(e) ? e : void 0; } -const mE = "base10", ci = "base16", pa = "base64pad", Df = "base64url", uh = "utf8", vE = 0, Oo = 1, fh = 2, eW = 0, c3 = 1, Yf = 12, xb = 32; -function tW() { +const mE = "base10", ci = "base16", pa = "base64pad", Of = "base64url", uh = "utf8", vE = 0, Oo = 1, fh = 2, tW = 0, c3 = 1, Jf = 12, xb = 32; +function rW() { const t = lb.generateKeyPair(); return { privateKey: On(t.secretKey, ci), publicKey: On(t.publicKey, ci) }; } @@ -17433,8 +17441,8 @@ function W1() { const t = Da.randomBytes(xb); return On(t, ci); } -function rW(t, e) { - const r = lb.sharedKey(Rn(t, ci), Rn(e, ci), !0), n = new xq(ih.SHA256, r).expand(xb); +function nW(t, e) { + const r = lb.sharedKey(Rn(t, ci), Rn(e, ci), !0), n = new _q(ih.SHA256, r).expand(xb); return On(n, ci); } function qd(t) { @@ -17451,22 +17459,22 @@ function bE(t) { function xc(t) { return Number(On(t, mE)); } -function nW(t) { +function iW(t) { const e = bE(typeof t.type < "u" ? t.type : vE); if (xc(e) === Oo && typeof t.senderPublicKey > "u") throw new Error("Missing sender public key for type 1 envelope"); - const r = typeof t.senderPublicKey < "u" ? Rn(t.senderPublicKey, ci) : void 0, n = typeof t.iv < "u" ? Rn(t.iv, ci) : Da.randomBytes(Yf), i = new ub.ChaCha20Poly1305(Rn(t.symKey, ci)).seal(n, Rn(t.message, uh)); + const r = typeof t.senderPublicKey < "u" ? Rn(t.senderPublicKey, ci) : void 0, n = typeof t.iv < "u" ? Rn(t.iv, ci) : Da.randomBytes(Jf), i = new ub.ChaCha20Poly1305(Rn(t.symKey, ci)).seal(n, Rn(t.message, uh)); return yE({ type: e, sealed: i, iv: n, senderPublicKey: r, encoding: t.encoding }); } -function iW(t, e) { - const r = bE(fh), n = Da.randomBytes(Yf), i = Rn(t, uh); +function sW(t, e) { + const r = bE(fh), n = Da.randomBytes(Jf), i = Rn(t, uh); return yE({ type: r, sealed: i, iv: n, encoding: e }); } -function sW(t) { +function oW(t) { const e = new ub.ChaCha20Poly1305(Rn(t.symKey, ci)), { sealed: r, iv: n } = Nl({ encoded: t.encoded, encoding: t == null ? void 0 : t.encoding }), i = e.open(n, r); if (i === null) throw new Error("Failed to decrypt"); return On(i, uh); } -function oW(t, e) { +function aW(t, e) { const { sealed: r } = Nl({ encoded: t, encoding: e }); return On(r, uh); } @@ -17480,19 +17488,19 @@ function yE(t) { return On(kd([t.type, t.iv, t.sealed]), e); } function Nl(t) { - const { encoded: e, encoding: r = pa } = t, n = Rn(e, r), i = n.slice(eW, c3), s = c3; + const { encoded: e, encoding: r = pa } = t, n = Rn(e, r), i = n.slice(tW, c3), s = c3; if (xc(i) === Oo) { - const l = s + xb, d = l + Yf, p = n.slice(s, l), w = n.slice(l, d), _ = n.slice(d); + const l = s + xb, d = l + Jf, p = n.slice(s, l), w = n.slice(l, d), _ = n.slice(d); return { type: i, sealed: _, iv: w, senderPublicKey: p }; } if (xc(i) === fh) { - const l = n.slice(s), d = Da.randomBytes(Yf); + const l = n.slice(s), d = Da.randomBytes(Jf); return { type: i, sealed: l, iv: d }; } - const o = s + Yf, a = n.slice(s, o), u = n.slice(o); + const o = s + Jf, a = n.slice(s, o), u = n.slice(o); return { type: i, sealed: u, iv: a }; } -function aW(t, e) { +function cW(t, e) { const r = Nl({ encoded: t, encoding: e == null ? void 0 : e.encoding }); return wE({ type: xc(r.type), senderPublicKey: typeof r.senderPublicKey < "u" ? On(r.senderPublicKey, ci) : void 0, receiverPublicKey: e == null ? void 0 : e.receiverPublicKey }); } @@ -17510,39 +17518,39 @@ function u3(t) { function f3(t) { return t.type === fh; } -function cW(t) { +function uW(t) { return new J8.ec("p256").keyFromPublic({ x: Buffer.from(t.x, "base64").toString("hex"), y: Buffer.from(t.y, "base64").toString("hex") }, "hex"); } -function uW(t) { +function fW(t) { let e = t.replace(/-/g, "+").replace(/_/g, "/"); const r = e.length % 4; return r > 0 && (e += "=".repeat(4 - r)), e; } -function fW(t) { - return Buffer.from(uW(t), "base64"); +function lW(t) { + return Buffer.from(fW(t), "base64"); } -function lW(t, e) { - const [r, n, i] = t.split("."), s = fW(i); +function hW(t, e) { + const [r, n, i] = t.split("."), s = lW(i); if (s.length !== 64) throw new Error("Invalid signature length"); - const o = s.slice(0, 32).toString("hex"), a = s.slice(32, 64).toString("hex"), u = `${r}.${n}`, l = new ih.SHA256().update(Buffer.from(u)).digest(), d = cW(e), p = Buffer.from(l).toString("hex"); + const o = s.slice(0, 32).toString("hex"), a = s.slice(32, 64).toString("hex"), u = `${r}.${n}`, l = new ih.SHA256().update(Buffer.from(u)).digest(), d = uW(e), p = Buffer.from(l).toString("hex"); if (!d.verify(p, { r: o, s: a })) throw new Error("Invalid signature"); return O1(t).payload; } -const hW = "irn"; +const dW = "irn"; function H1(t) { - return (t == null ? void 0 : t.relay) || { protocol: hW }; + return (t == null ? void 0 : t.relay) || { protocol: dW }; } -function Hf(t) { - const e = hz[t]; +function Kf(t) { + const e = dz[t]; if (typeof e > "u") throw new Error(`Relay Protocol not supported: ${t}`); return e; } -var dW = Object.defineProperty, pW = Object.defineProperties, gW = Object.getOwnPropertyDescriptors, l3 = Object.getOwnPropertySymbols, mW = Object.prototype.hasOwnProperty, vW = Object.prototype.propertyIsEnumerable, h3 = (t, e, r) => e in t ? dW(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, d3 = (t, e) => { - for (var r in e || (e = {})) mW.call(e, r) && h3(t, r, e[r]); - if (l3) for (var r of l3(e)) vW.call(e, r) && h3(t, r, e[r]); +var pW = Object.defineProperty, gW = Object.defineProperties, mW = Object.getOwnPropertyDescriptors, l3 = Object.getOwnPropertySymbols, vW = Object.prototype.hasOwnProperty, bW = Object.prototype.propertyIsEnumerable, h3 = (t, e, r) => e in t ? pW(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, d3 = (t, e) => { + for (var r in e || (e = {})) vW.call(e, r) && h3(t, r, e[r]); + if (l3) for (var r of l3(e)) bW.call(e, r) && h3(t, r, e[r]); return t; -}, bW = (t, e) => pW(t, gW(e)); -function yW(t, e = "-") { +}, yW = (t, e) => gW(t, mW(e)); +function wW(t, e = "-") { const r = {}, n = "relay" + e; return Object.keys(t).forEach((i) => { if (i.startsWith(n)) { @@ -17558,12 +17566,12 @@ function p3(t) { } t = t.includes("wc://") ? t.replace("wc://", "") : t, t = t.includes("wc:") ? t.replace("wc:", "") : t; const e = t.indexOf(":"), r = t.indexOf("?") !== -1 ? t.indexOf("?") : void 0, n = t.substring(0, e), i = t.substring(e + 1, r).split("@"), s = typeof r < "u" ? t.substring(r) : "", o = Dl.parse(s), a = typeof o.methods == "string" ? o.methods.split(",") : void 0; - return { protocol: n, topic: wW(i[0]), version: parseInt(i[1], 10), symKey: o.symKey, relay: yW(o), methods: a, expiryTimestamp: o.expiryTimestamp ? parseInt(o.expiryTimestamp, 10) : void 0 }; + return { protocol: n, topic: xW(i[0]), version: parseInt(i[1], 10), symKey: o.symKey, relay: wW(o), methods: a, expiryTimestamp: o.expiryTimestamp ? parseInt(o.expiryTimestamp, 10) : void 0 }; } -function wW(t) { +function xW(t) { return t.startsWith("//") ? t.substring(2) : t; } -function xW(t, e = "-") { +function _W(t, e = "-") { const r = "relay", n = {}; return Object.keys(t).forEach((i) => { const s = r + e + i; @@ -17571,43 +17579,43 @@ function xW(t, e = "-") { }), n; } function g3(t) { - return `${t.protocol}:${t.topic}@${t.version}?` + Dl.stringify(d3(bW(d3({ symKey: t.symKey }, xW(t.relay)), { expiryTimestamp: t.expiryTimestamp }), t.methods ? { methods: t.methods.join(",") } : {})); + return `${t.protocol}:${t.topic}@${t.version}?` + Dl.stringify(d3(yW(d3({ symKey: t.symKey }, _W(t.relay)), { expiryTimestamp: t.expiryTimestamp }), t.methods ? { methods: t.methods.join(",") } : {})); } function xd(t, e, r) { return `${t}?wc_ev=${r}&topic=${e}`; } -function Ju(t) { +function Xu(t) { const e = []; return t.forEach((r) => { const [n, i] = r.split(":"); e.push(`${n}:${i}`); }), e; } -function _W(t) { +function EW(t) { const e = []; return Object.values(t).forEach((r) => { - e.push(...Ju(r.accounts)); + e.push(...Xu(r.accounts)); }), e; } -function EW(t, e) { +function SW(t, e) { const r = []; return Object.values(t).forEach((n) => { - Ju(n.accounts).includes(e) && r.push(...n.methods); + Xu(n.accounts).includes(e) && r.push(...n.methods); }), r; } -function SW(t, e) { +function AW(t, e) { const r = []; return Object.values(t).forEach((n) => { - Ju(n.accounts).includes(e) && r.push(...n.events); + Xu(n.accounts).includes(e) && r.push(...n.events); }), r; } function _b(t) { return t.includes(":"); } -function Kf(t) { +function Vf(t) { return _b(t) ? t.split(":")[0] : t; } -function AW(t) { +function PW(t) { const e = {}; return t == null || t.forEach((r) => { const [n, i] = r.split(":"); @@ -17616,17 +17624,17 @@ function AW(t) { } function m3(t, e) { e = e.map((n) => n.replace("did:pkh:", "")); - const r = AW(e); + const r = PW(e); for (const [n, i] of Object.entries(r)) i.methods ? i.methods = jd(i.methods, t) : i.methods = t, i.events = ["chainChanged", "accountsChanged"]; return r; } -const PW = { INVALID_METHOD: { message: "Invalid method.", code: 1001 }, INVALID_EVENT: { message: "Invalid event.", code: 1002 }, INVALID_UPDATE_REQUEST: { message: "Invalid update request.", code: 1003 }, INVALID_EXTEND_REQUEST: { message: "Invalid extend request.", code: 1004 }, INVALID_SESSION_SETTLE_REQUEST: { message: "Invalid session settle request.", code: 1005 }, UNAUTHORIZED_METHOD: { message: "Unauthorized method.", code: 3001 }, UNAUTHORIZED_EVENT: { message: "Unauthorized event.", code: 3002 }, UNAUTHORIZED_UPDATE_REQUEST: { message: "Unauthorized update request.", code: 3003 }, UNAUTHORIZED_EXTEND_REQUEST: { message: "Unauthorized extend request.", code: 3004 }, USER_REJECTED: { message: "User rejected.", code: 5e3 }, USER_REJECTED_CHAINS: { message: "User rejected chains.", code: 5001 }, USER_REJECTED_METHODS: { message: "User rejected methods.", code: 5002 }, USER_REJECTED_EVENTS: { message: "User rejected events.", code: 5003 }, UNSUPPORTED_CHAINS: { message: "Unsupported chains.", code: 5100 }, UNSUPPORTED_METHODS: { message: "Unsupported methods.", code: 5101 }, UNSUPPORTED_EVENTS: { message: "Unsupported events.", code: 5102 }, UNSUPPORTED_ACCOUNTS: { message: "Unsupported accounts.", code: 5103 }, UNSUPPORTED_NAMESPACE_KEY: { message: "Unsupported namespace key.", code: 5104 }, USER_DISCONNECTED: { message: "User disconnected.", code: 6e3 }, SESSION_SETTLEMENT_FAILED: { message: "Session settlement failed.", code: 7e3 }, WC_METHOD_UNSUPPORTED: { message: "Unsupported wc_ method.", code: 10001 } }, MW = { NOT_INITIALIZED: { message: "Not initialized.", code: 1 }, NO_MATCHING_KEY: { message: "No matching key.", code: 2 }, RESTORE_WILL_OVERRIDE: { message: "Restore will override.", code: 3 }, RESUBSCRIBED: { message: "Resubscribed.", code: 4 }, MISSING_OR_INVALID: { message: "Missing or invalid.", code: 5 }, EXPIRED: { message: "Expired.", code: 6 }, UNKNOWN_TYPE: { message: "Unknown type.", code: 7 }, MISMATCHED_TOPIC: { message: "Mismatched topic.", code: 8 }, NON_CONFORMING_NAMESPACES: { message: "Non conforming namespaces.", code: 9 } }; +const MW = { INVALID_METHOD: { message: "Invalid method.", code: 1001 }, INVALID_EVENT: { message: "Invalid event.", code: 1002 }, INVALID_UPDATE_REQUEST: { message: "Invalid update request.", code: 1003 }, INVALID_EXTEND_REQUEST: { message: "Invalid extend request.", code: 1004 }, INVALID_SESSION_SETTLE_REQUEST: { message: "Invalid session settle request.", code: 1005 }, UNAUTHORIZED_METHOD: { message: "Unauthorized method.", code: 3001 }, UNAUTHORIZED_EVENT: { message: "Unauthorized event.", code: 3002 }, UNAUTHORIZED_UPDATE_REQUEST: { message: "Unauthorized update request.", code: 3003 }, UNAUTHORIZED_EXTEND_REQUEST: { message: "Unauthorized extend request.", code: 3004 }, USER_REJECTED: { message: "User rejected.", code: 5e3 }, USER_REJECTED_CHAINS: { message: "User rejected chains.", code: 5001 }, USER_REJECTED_METHODS: { message: "User rejected methods.", code: 5002 }, USER_REJECTED_EVENTS: { message: "User rejected events.", code: 5003 }, UNSUPPORTED_CHAINS: { message: "Unsupported chains.", code: 5100 }, UNSUPPORTED_METHODS: { message: "Unsupported methods.", code: 5101 }, UNSUPPORTED_EVENTS: { message: "Unsupported events.", code: 5102 }, UNSUPPORTED_ACCOUNTS: { message: "Unsupported accounts.", code: 5103 }, UNSUPPORTED_NAMESPACE_KEY: { message: "Unsupported namespace key.", code: 5104 }, USER_DISCONNECTED: { message: "User disconnected.", code: 6e3 }, SESSION_SETTLEMENT_FAILED: { message: "Session settlement failed.", code: 7e3 }, WC_METHOD_UNSUPPORTED: { message: "Unsupported wc_ method.", code: 10001 } }, IW = { NOT_INITIALIZED: { message: "Not initialized.", code: 1 }, NO_MATCHING_KEY: { message: "No matching key.", code: 2 }, RESTORE_WILL_OVERRIDE: { message: "Restore will override.", code: 3 }, RESUBSCRIBED: { message: "Resubscribed.", code: 4 }, MISSING_OR_INVALID: { message: "Missing or invalid.", code: 5 }, EXPIRED: { message: "Expired.", code: 6 }, UNKNOWN_TYPE: { message: "Unknown type.", code: 7 }, MISMATCHED_TOPIC: { message: "Mismatched topic.", code: 8 }, NON_CONFORMING_NAMESPACES: { message: "Non conforming namespaces.", code: 9 } }; function ft(t, e) { - const { message: r, code: n } = MW[t]; + const { message: r, code: n } = IW[t]; return { message: e ? `${r} ${e}` : r, code: n }; } function Or(t, e) { - const { message: r, code: n } = PW[t]; + const { message: r, code: n } = MW[t]; return { message: e ? `${r} ${e}` : r, code: n }; } function _c(t, e) { @@ -17644,18 +17652,18 @@ function dn(t, e) { function Eb(t, e) { return typeof t == "number" && !isNaN(t); } -function IW(t, e) { +function CW(t, e) { const { requiredNamespaces: r } = e, n = Object.keys(t.namespaces), i = Object.keys(r); let s = !0; return uc(i, n) ? (n.forEach((o) => { - const { accounts: a, methods: u, events: l } = t.namespaces[o], d = Ju(a), p = r[o]; + const { accounts: a, methods: u, events: l } = t.namespaces[o], d = Xu(a), p = r[o]; (!uc(oE(o, p), d) || !uc(p.methods, u) || !uc(p.events, l)) && (s = !1); }), s) : !1; } function _0(t) { return dn(t, !1) && t.includes(":") ? t.split(":").length === 2 : !1; } -function CW(t) { +function TW(t) { if (dn(t, !1) && t.includes(":")) { const e = t.split(":"); if (e.length === 3) { @@ -17665,7 +17673,7 @@ function CW(t) { } return !1; } -function TW(t) { +function RW(t) { function e(r) { try { return typeof new URL(r) < "u"; @@ -17683,14 +17691,14 @@ function TW(t) { } return !1; } -function RW(t) { +function DW(t) { var e; return (e = t == null ? void 0 : t.proposer) == null ? void 0 : e.publicKey; } -function DW(t) { +function OW(t) { return t == null ? void 0 : t.topic; } -function OW(t, e) { +function NW(t, e) { let r = null; return dn(t == null ? void 0 : t.publicKey, !1) || (r = ft("MISSING_OR_INVALID", `${e} controller public key should be a string`)), r; } @@ -17698,35 +17706,35 @@ function v3(t) { let e = !0; return _c(t) ? t.length && (e = t.every((r) => dn(r, !1))) : e = !1, e; } -function NW(t, e, r) { +function LW(t, e, r) { let n = null; return _c(e) && e.length ? e.forEach((i) => { n || _0(i) || (n = Or("UNSUPPORTED_CHAINS", `${r}, chain ${i} should be a string and conform to "namespace:chainId" format`)); }) : _0(t) || (n = Or("UNSUPPORTED_CHAINS", `${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)), n; } -function LW(t, e, r) { +function kW(t, e, r) { let n = null; return Object.entries(t).forEach(([i, s]) => { if (n) return; - const o = NW(i, oE(i, s), `${e} ${r}`); + const o = LW(i, oE(i, s), `${e} ${r}`); o && (n = o); }), n; } -function kW(t, e) { +function $W(t, e) { let r = null; return _c(t) ? t.forEach((n) => { - r || CW(n) || (r = Or("UNSUPPORTED_ACCOUNTS", `${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`)); + r || TW(n) || (r = Or("UNSUPPORTED_ACCOUNTS", `${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`)); }) : r = Or("UNSUPPORTED_ACCOUNTS", `${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`), r; } -function $W(t, e) { +function BW(t, e) { let r = null; return Object.values(t).forEach((n) => { if (r) return; - const i = kW(n == null ? void 0 : n.accounts, `${e} namespace`); + const i = $W(n == null ? void 0 : n.accounts, `${e} namespace`); i && (r = i); }), r; } -function BW(t, e) { +function FW(t, e) { let r = null; return v3(t == null ? void 0 : t.methods) ? v3(t == null ? void 0 : t.events) || (r = Or("UNSUPPORTED_EVENTS", `${e}, events should be an array of strings or empty array for no events`)) : r = Or("UNSUPPORTED_METHODS", `${e}, methods should be an array of strings or empty array for no methods`), r; } @@ -17734,16 +17742,16 @@ function xE(t, e) { let r = null; return Object.values(t).forEach((n) => { if (r) return; - const i = BW(n, `${e}, namespace`); + const i = FW(n, `${e}, namespace`); i && (r = i); }), r; } -function FW(t, e, r) { +function jW(t, e, r) { let n = null; if (t && Ll(t)) { const i = xE(t, e); i && (n = i); - const s = LW(t, e, r); + const s = kW(t, e, r); s && (n = s); } else n = ft("MISSING_OR_INVALID", `${e}, ${r} should be an object with data`); return n; @@ -17753,7 +17761,7 @@ function Pm(t, e) { if (t && Ll(t)) { const n = xE(t, e); n && (r = n); - const i = $W(t, e); + const i = BW(t, e); i && (r = i); } else r = ft("MISSING_OR_INVALID", `${e}, namespaces should be an object with data`); return r; @@ -17761,49 +17769,49 @@ function Pm(t, e) { function _E(t) { return dn(t.protocol, !0); } -function jW(t, e) { +function UW(t, e) { let r = !1; return t ? t && _c(t) && t.length && t.forEach((n) => { r = _E(n); }) : r = !0, r; } -function UW(t) { +function qW(t) { return typeof t == "number"; } function mi(t) { return typeof t < "u" && typeof t !== null; } -function qW(t) { +function zW(t) { return !(!t || typeof t != "object" || !t.code || !Eb(t.code) || !t.message || !dn(t.message, !1)); } -function zW(t) { +function WW(t) { return !(vi(t) || !dn(t.method, !1)); } -function WW(t) { +function HW(t) { return !(vi(t) || vi(t.result) && vi(t.error) || !Eb(t.id) || !dn(t.jsonrpc, !1)); } -function HW(t) { +function KW(t) { return !(vi(t) || !dn(t.name, !1)); } function b3(t, e) { - return !(!_0(e) || !_W(t).includes(e)); -} -function KW(t, e, r) { - return dn(r, !1) ? EW(t, e).includes(r) : !1; + return !(!_0(e) || !EW(t).includes(e)); } function VW(t, e, r) { return dn(r, !1) ? SW(t, e).includes(r) : !1; } +function GW(t, e, r) { + return dn(r, !1) ? AW(t, e).includes(r) : !1; +} function y3(t, e, r) { let n = null; - const i = GW(t), s = YW(e), o = Object.keys(i), a = Object.keys(s), u = w3(Object.keys(t)), l = w3(Object.keys(e)), d = u.filter((p) => !l.includes(p)); + const i = YW(t), s = JW(e), o = Object.keys(i), a = Object.keys(s), u = w3(Object.keys(t)), l = w3(Object.keys(e)), d = u.filter((p) => !l.includes(p)); return d.length && (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces keys don't satisfy requiredNamespaces. Required: ${d.toString()} Received: ${Object.keys(e).toString()}`)), uc(o, a) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} Approved: ${a.toString()}`)), Object.keys(e).forEach((p) => { if (!p.includes(":") || n) return; - const w = Ju(e[p].accounts); + const w = Xu(e[p].accounts); w.includes(p) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces accounts don't satisfy namespace accounts for ${p} Required: ${p} Approved: ${w.toString()}`)); @@ -17811,7 +17819,7 @@ function y3(t, e, r) { n || (uc(i[p].methods, s[p].methods) ? uc(i[p].events, s[p].events) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces events don't satisfy namespace events for ${p}`)) : n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces methods don't satisfy namespace methods for ${p}`)); }), n; } -function GW(t) { +function YW(t) { const e = {}; return Object.keys(t).forEach((r) => { var n; @@ -17823,19 +17831,19 @@ function GW(t) { function w3(t) { return [...new Set(t.map((e) => e.includes(":") ? e.split(":")[0] : e))]; } -function YW(t) { +function JW(t) { const e = {}; return Object.keys(t).forEach((r) => { if (r.includes(":")) e[r] = t[r]; else { - const n = Ju(t[r].accounts); + const n = Xu(t[r].accounts); n == null || n.forEach((i) => { e[i] = { accounts: t[r].accounts.filter((s) => s.includes(`${i}:`)), methods: t[r].methods, events: t[r].events }; }); } }), e; } -function JW(t, e) { +function XW(t, e) { return Eb(t) && t <= e.max && t >= e.min; } function x3() { @@ -17843,50 +17851,50 @@ function x3() { return new Promise((e) => { switch (t) { case Oi.browser: - e(XW()); + e(ZW()); break; case Oi.reactNative: - e(ZW()); + e(QW()); break; case Oi.node: - e(QW()); + e(eH()); break; default: e(!0); } }); } -function XW() { +function ZW() { return ah() && (navigator == null ? void 0 : navigator.onLine); } -async function ZW() { - if (Yu() && typeof global < "u" && global != null && global.NetInfo) { +async function QW() { + if (Ju() && typeof global < "u" && global != null && global.NetInfo) { const t = await (global == null ? void 0 : global.NetInfo.fetch()); return t == null ? void 0 : t.isConnected; } return !0; } -function QW() { +function eH() { return !0; } -function eH(t) { +function tH(t) { switch (ch()) { case Oi.browser: - tH(t); + rH(t); break; case Oi.reactNative: - rH(t); + nH(t); break; } } -function tH(t) { - !Yu() && ah() && (window.addEventListener("online", () => t(!0)), window.addEventListener("offline", () => t(!1))); -} function rH(t) { - Yu() && typeof global < "u" && global != null && global.NetInfo && (global == null || global.NetInfo.addEventListener((e) => t(e == null ? void 0 : e.isConnected))); + !Ju() && ah() && (window.addEventListener("online", () => t(!0)), window.addEventListener("offline", () => t(!1))); +} +function nH(t) { + Ju() && typeof global < "u" && global != null && global.NetInfo && (global == null || global.NetInfo.addEventListener((e) => t(e == null ? void 0 : e.isConnected))); } const Mm = {}; -class Of { +class Nf { static get(e) { return Mm[e]; } @@ -17897,29 +17905,29 @@ class Of { delete Mm[e]; } } -const nH = "PARSE_ERROR", iH = "INVALID_REQUEST", sH = "METHOD_NOT_FOUND", oH = "INVALID_PARAMS", EE = "INTERNAL_ERROR", Sb = "SERVER_ERROR", aH = [-32700, -32600, -32601, -32602, -32603], Jf = { - [nH]: { code: -32700, message: "Parse error" }, - [iH]: { code: -32600, message: "Invalid Request" }, - [sH]: { code: -32601, message: "Method not found" }, - [oH]: { code: -32602, message: "Invalid params" }, +const iH = "PARSE_ERROR", sH = "INVALID_REQUEST", oH = "METHOD_NOT_FOUND", aH = "INVALID_PARAMS", EE = "INTERNAL_ERROR", Sb = "SERVER_ERROR", cH = [-32700, -32600, -32601, -32602, -32603], Xf = { + [iH]: { code: -32700, message: "Parse error" }, + [sH]: { code: -32600, message: "Invalid Request" }, + [oH]: { code: -32601, message: "Method not found" }, + [aH]: { code: -32602, message: "Invalid params" }, [EE]: { code: -32603, message: "Internal error" }, [Sb]: { code: -32e3, message: "Server error" } }, SE = Sb; -function cH(t) { - return aH.includes(t); +function uH(t) { + return cH.includes(t); } function _3(t) { - return Object.keys(Jf).includes(t) ? Jf[t] : Jf[SE]; + return Object.keys(Xf).includes(t) ? Xf[t] : Xf[SE]; } -function uH(t) { - const e = Object.values(Jf).find((r) => r.code === t); - return e || Jf[SE]; +function fH(t) { + const e = Object.values(Xf).find((r) => r.code === t); + return e || Xf[SE]; } function AE(t, e, r) { return t.message.includes("getaddrinfo ENOTFOUND") || t.message.includes("connect ECONNREFUSED") ? new Error(`Unavailable ${r} RPC url at ${e}`) : t; } var PE = {}, wo = {}, E3; -function fH() { +function lH() { if (E3) return wo; E3 = 1, Object.defineProperty(wo, "__esModule", { value: !0 }), wo.isBrowserCryptoAvailable = wo.getSubtleCrypto = wo.getBrowerCrypto = void 0; function t() { @@ -17937,7 +17945,7 @@ function fH() { return wo.isBrowserCryptoAvailable = r, wo; } var xo = {}, S3; -function lH() { +function hH() { if (S3) return xo; S3 = 1, Object.defineProperty(xo, "__esModule", { value: !0 }), xo.isBrowser = xo.isNode = xo.isReactNative = void 0; function t() { @@ -17956,7 +17964,7 @@ function lH() { (function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); const e = Yl; - e.__exportStar(fH(), t), e.__exportStar(lH(), t); + e.__exportStar(lH(), t), e.__exportStar(hH(), t); })(PE); function la(t = 3) { const e = Date.now() * Math.pow(10, t), r = Math.floor(Math.random() * Math.pow(10, t)); @@ -17984,39 +17992,39 @@ function vp(t, e, r) { return { id: t, jsonrpc: "2.0", - error: hH(e) + error: dH(e) }; } -function hH(t, e) { - return typeof t > "u" ? _3(EE) : (typeof t == "string" && (t = Object.assign(Object.assign({}, _3(Sb)), { message: t })), cH(t.code) && (t = uH(t.code)), t); +function dH(t, e) { + return typeof t > "u" ? _3(EE) : (typeof t == "string" && (t = Object.assign(Object.assign({}, _3(Sb)), { message: t })), uH(t.code) && (t = fH(t.code)), t); } -let dH = class { -}, pH = class extends dH { +let pH = class { +}, gH = class extends pH { constructor() { super(); } -}, gH = class extends pH { +}, mH = class extends gH { constructor(e) { super(); } }; -const mH = "^https?:", vH = "^wss?:"; -function bH(t) { +const vH = "^https?:", bH = "^wss?:"; +function yH(t) { const e = t.match(new RegExp(/^\w+:/, "gi")); if (!(!e || !e.length)) return e[0]; } function ME(t, e) { - const r = bH(t); + const r = yH(t); return typeof r > "u" ? !1 : new RegExp(e).test(r); } function A3(t) { - return ME(t, mH); + return ME(t, vH); } function P3(t) { - return ME(t, vH); + return ME(t, bH); } -function yH(t) { +function wH(t) { return new RegExp("wss?://localhost(:d{2,5})?").test(t); } function IE(t) { @@ -18034,7 +18042,7 @@ function zs(t) { function es(t) { return "error" in t; } -let us = class extends gH { +let us = class extends mH { constructor(e) { super(e), this.events = new is.EventEmitter(), this.hasRegisteredEventListeners = !1, this.connection = this.setConnection(e), this.connection.connected && this.registerEventListeners(); } @@ -18095,8 +18103,8 @@ let us = class extends gH { this.hasRegisteredEventListeners || (this.connection.on("payload", (e) => this.onPayload(e)), this.connection.on("close", (e) => this.onClose(e)), this.connection.on("error", (e) => this.events.emit("error", e)), this.connection.on("register_error", (e) => this.onClose()), this.hasRegisteredEventListeners = !0); } }; -const wH = () => typeof WebSocket < "u" ? WebSocket : typeof global < "u" && typeof global.WebSocket < "u" ? global.WebSocket : typeof window < "u" && typeof window.WebSocket < "u" ? window.WebSocket : typeof self < "u" && typeof self.WebSocket < "u" ? self.WebSocket : require("ws"), xH = () => typeof WebSocket < "u" || typeof global < "u" && typeof global.WebSocket < "u" || typeof window < "u" && typeof window.WebSocket < "u" || typeof self < "u" && typeof self.WebSocket < "u", M3 = (t) => t.split("?")[0], I3 = 10, _H = wH(); -let EH = class { +const xH = () => typeof WebSocket < "u" ? WebSocket : typeof global < "u" && typeof global.WebSocket < "u" ? global.WebSocket : typeof window < "u" && typeof window.WebSocket < "u" ? window.WebSocket : typeof self < "u" && typeof self.WebSocket < "u" ? self.WebSocket : require("ws"), _H = () => typeof WebSocket < "u" || typeof global < "u" && typeof global.WebSocket < "u" || typeof window < "u" && typeof window.WebSocket < "u" || typeof self < "u" && typeof self.WebSocket < "u", M3 = (t) => t.split("?")[0], I3 = 10, EH = xH(); +let SH = class { constructor(e) { if (this.url = e, this.events = new is.EventEmitter(), this.registering = !1, !P3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); this.url = e; @@ -18155,8 +18163,8 @@ let EH = class { }); } return this.url = e, this.registering = !0, new Promise((r, n) => { - const i = new URLSearchParams(e).get("origin"), s = PE.isReactNative() ? { headers: { origin: i } } : { rejectUnauthorized: !yH(e) }, o = new _H(e, [], s); - xH() ? o.onerror = (a) => { + const i = new URLSearchParams(e).get("origin"), s = PE.isReactNative() ? { headers: { origin: i } } : { rejectUnauthorized: !wH(e) }, o = new EH(e, [], s); + _H() ? o.onerror = (a) => { const u = a; n(this.emitError(u.error)); } : o.on("error", (a) => { @@ -18195,7 +18203,7 @@ let EH = class { var E0 = { exports: {} }; E0.exports; (function(t, e) { - var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", u = "[object Array]", l = "[object AsyncFunction]", d = "[object Boolean]", p = "[object Date]", w = "[object Error]", _ = "[object Function]", P = "[object GeneratorFunction]", O = "[object Map]", L = "[object Number]", B = "[object Null]", k = "[object Object]", q = "[object Promise]", U = "[object Proxy]", V = "[object RegExp]", Q = "[object Set]", R = "[object String]", K = "[object Symbol]", ge = "[object Undefined]", Ee = "[object WeakMap]", Y = "[object ArrayBuffer]", A = "[object DataView]", m = "[object Float32Array]", f = "[object Float64Array]", g = "[object Int8Array]", b = "[object Int16Array]", x = "[object Int32Array]", E = "[object Uint8Array]", S = "[object Uint8ClampedArray]", v = "[object Uint16Array]", M = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, F = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, D = {}; + var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", u = "[object Array]", l = "[object AsyncFunction]", d = "[object Boolean]", p = "[object Date]", w = "[object Error]", _ = "[object Function]", P = "[object GeneratorFunction]", O = "[object Map]", L = "[object Number]", B = "[object Null]", k = "[object Object]", W = "[object Promise]", U = "[object Proxy]", V = "[object RegExp]", Q = "[object Set]", R = "[object String]", K = "[object Symbol]", ge = "[object Undefined]", Ee = "[object WeakMap]", Y = "[object ArrayBuffer]", A = "[object DataView]", m = "[object Float32Array]", f = "[object Float64Array]", g = "[object Int8Array]", b = "[object Int16Array]", x = "[object Int32Array]", E = "[object Uint8Array]", S = "[object Uint8ClampedArray]", v = "[object Uint16Array]", M = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, F = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, D = {}; D[m] = D[f] = D[g] = D[b] = D[x] = D[E] = D[S] = D[v] = D[M] = !0, D[a] = D[u] = D[Y] = D[d] = D[A] = D[p] = D[w] = D[_] = D[O] = D[L] = D[k] = D[V] = D[Q] = D[R] = D[Ee] = !1; var oe = typeof gn == "object" && gn && gn.Object === Object && gn, Z = typeof self == "object" && self && self.Object === Object && self, J = oe || Z || Function("return this")(), ee = e && !e.nodeType && e, T = ee && !0 && t && !t.nodeType && t, X = T && T.exports === ee, re = X && oe.process, pe = function() { try { @@ -18259,7 +18267,7 @@ E0.exports; return ae ? "Symbol(src)_1." + ae : ""; }(), tt = _e.toString, Ye = RegExp( "^" + at.call(ke).replace(I, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" - ), dt = X ? J.Buffer : void 0, lt = J.Symbol, ct = J.Uint8Array, qt = _e.propertyIsEnumerable, Jt = qe.splice, Et = lt ? lt.toStringTag : void 0, er = Object.getOwnPropertySymbols, Xt = dt ? dt.isBuffer : void 0, Dt = Ke(Object.keys, Object), kt = wr(J, "DataView"), Ct = wr(J, "Map"), mt = wr(J, "Promise"), Rt = wr(J, "Set"), Nt = wr(J, "WeakMap"), bt = wr(Object, "create"), $t = ao(kt), Ft = ao(Ct), rt = ao(mt), Bt = ao(Rt), $ = ao(Nt), z = lt ? lt.prototype : void 0, H = z ? z.valueOf : void 0; + ), dt = X ? J.Buffer : void 0, lt = J.Symbol, ct = J.Uint8Array, qt = _e.propertyIsEnumerable, Jt = qe.splice, Et = lt ? lt.toStringTag : void 0, er = Object.getOwnPropertySymbols, Xt = dt ? dt.isBuffer : void 0, Dt = Ke(Object.keys, Object), kt = wr(J, "DataView"), Ct = wr(J, "Map"), mt = wr(J, "Promise"), Rt = wr(J, "Set"), Nt = wr(J, "WeakMap"), bt = wr(Object, "create"), $t = ao(kt), Ft = ao(Ct), rt = ao(mt), Bt = ao(Rt), $ = ao(Nt), q = lt ? lt.prototype : void 0, H = q ? q.valueOf : void 0; function C(ae) { var ye = -1, Ge = ae == null ? 0 : ae.length; for (this.clear(); ++ye < Ge; ) { @@ -18390,7 +18398,7 @@ E0.exports; } ut.prototype.clear = ot, ut.prototype.delete = Se, ut.prototype.get = Ae, ut.prototype.has = Ve, ut.prototype.set = Fe; function Ue(ae, ye) { - var Ge = $c(ae), Pt = !Ge && _h(ae), jr = !Ge && !Pt && sf(ae), nr = !Ge && !Pt && !jr && Ah(ae), Kr = Ge || Pt || jr || nr, vn = Kr ? De(ae.length, String) : [], Er = vn.length; + var Ge = $c(ae), Pt = !Ge && _h(ae), jr = !Ge && !Pt && of(ae), nr = !Ge && !Pt && !jr && Ah(ae), Kr = Ge || Pt || jr || nr, vn = Kr ? De(ae.length, String) : [], Er = vn.length; for (var Ur in ae) ke.call(ae, Ur) && !(Kr && // Safari 9 has enumerable `arguments.length` in strict mode. (Ur == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. @@ -18422,8 +18430,8 @@ E0.exports; var Kr = $c(ae), vn = $c(ye), Er = Kr ? u : Ir(ae), Ur = vn ? u : Ir(ye); Er = Er == a ? k : Er, Ur = Ur == a ? k : Ur; var an = Er == k, fi = Ur == k, bn = Er == Ur; - if (bn && sf(ae)) { - if (!sf(ye)) + if (bn && of(ae)) { + if (!of(ye)) return !1; Kr = !0, an = !1; } @@ -18541,8 +18549,8 @@ E0.exports; bn = vn[fi]; var Ui = ae[bn], Ds = ye[bn]; if (Pt) - var of = Kr ? Pt(Ds, Ui, bn, ye, ae, nr) : Pt(Ui, Ds, bn, ae, ye, nr); - if (!(of === void 0 ? Ui === Ds || jr(Ui, Ds, Ge, Pt, nr) : of)) { + var af = Kr ? Pt(Ds, Ui, bn, ye, ae, nr) : Pt(Ui, Ds, bn, ae, ye, nr); + if (!(af === void 0 ? Ui === Ds || jr(Ui, Ds, Ge, Pt, nr) : af)) { ri = !1; break; } @@ -18580,7 +18588,7 @@ E0.exports; return qt.call(ae, ye); })); } : Fr, Ir = zt; - (kt && Ir(new kt(new ArrayBuffer(1))) != A || Ct && Ir(new Ct()) != O || mt && Ir(mt.resolve()) != q || Rt && Ir(new Rt()) != Q || Nt && Ir(new Nt()) != Ee) && (Ir = function(ae) { + (kt && Ir(new kt(new ArrayBuffer(1))) != A || Ct && Ir(new Ct()) != O || mt && Ir(mt.resolve()) != W || Rt && Ir(new Rt()) != Q || Nt && Ir(new Nt()) != Ee) && (Ir = function(ae) { var ye = zt(ae), Ge = ye == k ? ae.constructor : void 0, Pt = Ge ? ao(Ge) : ""; if (Pt) switch (Pt) { @@ -18589,7 +18597,7 @@ E0.exports; case Ft: return O; case rt: - return q; + return W; case Bt: return Q; case $: @@ -18638,7 +18646,7 @@ E0.exports; function Kp(ae) { return ae != null && Eh(ae.length) && !Bc(ae); } - var sf = Xt || Dr; + var of = Xt || Dr; function Vp(ae, ye) { return Wt(ae, ye); } @@ -18670,9 +18678,9 @@ E0.exports; } t.exports = Vp; })(E0, E0.exports); -var SH = E0.exports; -const AH = /* @__PURE__ */ ns(SH), CE = "wc", TE = 2, RE = "core", ro = `${CE}@2:${RE}:`, PH = { logger: "error" }, MH = { database: ":memory:" }, IH = "crypto", C3 = "client_ed25519_seed", CH = vt.ONE_DAY, TH = "keychain", RH = "0.3", DH = "messages", OH = "0.3", NH = vt.SIX_HOURS, LH = "publisher", DE = "irn", kH = "error", OE = "wss://relay.walletconnect.org", $H = "relayer", ai = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", publish: "relayer_publish" }, BH = "_subscription", Yi = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, FH = 0.1, K1 = "2.17.2", zr = { link_mode: "link_mode", relay: "relay" }, jH = "0.3", UH = "WALLETCONNECT_CLIENT_ID", T3 = "WALLETCONNECT_LINK_MODE_APPS", Ws = { created: "subscription_created", deleted: "subscription_deleted", sync: "subscription_sync", resubscribed: "subscription_resubscribed" }, qH = "subscription", zH = "0.3", WH = vt.FIVE_SECONDS * 1e3, HH = "pairing", KH = "0.3", Nf = { wc_pairingDelete: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1e3 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1001 } }, wc_pairingPing: { req: { ttl: vt.THIRTY_SECONDS, prompt: !1, tag: 1002 }, res: { ttl: vt.THIRTY_SECONDS, prompt: !1, tag: 1003 } }, unregistered_method: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 0 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 0 } } }, ic = { create: "pairing_create", expire: "pairing_expire", delete: "pairing_delete", ping: "pairing_ping" }, ys = { created: "history_created", updated: "history_updated", deleted: "history_deleted", sync: "history_sync" }, VH = "history", GH = "0.3", YH = "expirer", Zi = { created: "expirer_created", deleted: "expirer_deleted", expired: "expirer_expired", sync: "expirer_sync" }, JH = "0.3", XH = "verify-api", ZH = "https://verify.walletconnect.com", NE = "https://verify.walletconnect.org", Xf = NE, QH = `${Xf}/v3`, eK = [ZH, NE], tK = "echo", rK = "https://echo.walletconnect.com", qs = { pairing_started: "pairing_started", pairing_uri_validation_success: "pairing_uri_validation_success", pairing_uri_not_expired: "pairing_uri_not_expired", store_new_pairing: "store_new_pairing", subscribing_pairing_topic: "subscribing_pairing_topic", subscribe_pairing_topic_success: "subscribe_pairing_topic_success", existing_pairing: "existing_pairing", pairing_not_expired: "pairing_not_expired", emit_inactive_pairing: "emit_inactive_pairing", emit_session_proposal: "emit_session_proposal" }, So = { no_internet_connection: "no_internet_connection", malformed_pairing_uri: "malformed_pairing_uri", active_pairing_already_exists: "active_pairing_already_exists", subscribe_pairing_topic_failure: "subscribe_pairing_topic_failure", pairing_expired: "pairing_expired", proposal_listener_not_found: "proposal_listener_not_found" }, ws = { session_approve_started: "session_approve_started", session_namespaces_validation_success: "session_namespaces_validation_success", subscribing_session_topic: "subscribing_session_topic", subscribe_session_topic_success: "subscribe_session_topic_success", publishing_session_approve: "publishing_session_approve", session_approve_publish_success: "session_approve_publish_success", store_session: "store_session", publishing_session_settle: "publishing_session_settle", session_settle_publish_success: "session_settle_publish_success" }, Xa = { no_internet_connection: "no_internet_connection", proposal_expired: "proposal_expired", subscribe_session_topic_failure: "subscribe_session_topic_failure", session_approve_publish_failure: "session_approve_publish_failure", session_settle_publish_failure: "session_settle_publish_failure", session_approve_namespace_validation_failure: "session_approve_namespace_validation_failure", proposal_not_found: "proposal_not_found" }, Za = { authenticated_session_approve_started: "authenticated_session_approve_started", create_authenticated_session_topic: "create_authenticated_session_topic", cacaos_verified: "cacaos_verified", store_authenticated_session: "store_authenticated_session", subscribing_authenticated_session_topic: "subscribing_authenticated_session_topic", subscribe_authenticated_session_topic_success: "subscribe_authenticated_session_topic_success", publishing_authenticated_session_approve: "publishing_authenticated_session_approve" }, Lf = { no_internet_connection: "no_internet_connection", invalid_cacao: "invalid_cacao", subscribe_authenticated_session_topic_failure: "subscribe_authenticated_session_topic_failure", authenticated_session_approve_publish_failure: "authenticated_session_approve_publish_failure", authenticated_session_pending_request_not_found: "authenticated_session_pending_request_not_found" }, nK = 0.1, iK = "event-client", sK = 86400, oK = "https://pulse.walletconnect.org/batch"; -function aK(t, e) { +var AH = E0.exports; +const PH = /* @__PURE__ */ ns(AH), CE = "wc", TE = 2, RE = "core", ro = `${CE}@2:${RE}:`, MH = { logger: "error" }, IH = { database: ":memory:" }, CH = "crypto", C3 = "client_ed25519_seed", TH = vt.ONE_DAY, RH = "keychain", DH = "0.3", OH = "messages", NH = "0.3", LH = vt.SIX_HOURS, kH = "publisher", DE = "irn", $H = "error", OE = "wss://relay.walletconnect.org", BH = "relayer", ai = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", publish: "relayer_publish" }, FH = "_subscription", Yi = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, jH = 0.1, K1 = "2.17.2", zr = { link_mode: "link_mode", relay: "relay" }, UH = "0.3", qH = "WALLETCONNECT_CLIENT_ID", T3 = "WALLETCONNECT_LINK_MODE_APPS", Ws = { created: "subscription_created", deleted: "subscription_deleted", sync: "subscription_sync", resubscribed: "subscription_resubscribed" }, zH = "subscription", WH = "0.3", HH = vt.FIVE_SECONDS * 1e3, KH = "pairing", VH = "0.3", Lf = { wc_pairingDelete: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1e3 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1001 } }, wc_pairingPing: { req: { ttl: vt.THIRTY_SECONDS, prompt: !1, tag: 1002 }, res: { ttl: vt.THIRTY_SECONDS, prompt: !1, tag: 1003 } }, unregistered_method: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 0 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 0 } } }, ic = { create: "pairing_create", expire: "pairing_expire", delete: "pairing_delete", ping: "pairing_ping" }, ys = { created: "history_created", updated: "history_updated", deleted: "history_deleted", sync: "history_sync" }, GH = "history", YH = "0.3", JH = "expirer", Zi = { created: "expirer_created", deleted: "expirer_deleted", expired: "expirer_expired", sync: "expirer_sync" }, XH = "0.3", ZH = "verify-api", QH = "https://verify.walletconnect.com", NE = "https://verify.walletconnect.org", Zf = NE, eK = `${Zf}/v3`, tK = [QH, NE], rK = "echo", nK = "https://echo.walletconnect.com", qs = { pairing_started: "pairing_started", pairing_uri_validation_success: "pairing_uri_validation_success", pairing_uri_not_expired: "pairing_uri_not_expired", store_new_pairing: "store_new_pairing", subscribing_pairing_topic: "subscribing_pairing_topic", subscribe_pairing_topic_success: "subscribe_pairing_topic_success", existing_pairing: "existing_pairing", pairing_not_expired: "pairing_not_expired", emit_inactive_pairing: "emit_inactive_pairing", emit_session_proposal: "emit_session_proposal" }, So = { no_internet_connection: "no_internet_connection", malformed_pairing_uri: "malformed_pairing_uri", active_pairing_already_exists: "active_pairing_already_exists", subscribe_pairing_topic_failure: "subscribe_pairing_topic_failure", pairing_expired: "pairing_expired", proposal_listener_not_found: "proposal_listener_not_found" }, ws = { session_approve_started: "session_approve_started", session_namespaces_validation_success: "session_namespaces_validation_success", subscribing_session_topic: "subscribing_session_topic", subscribe_session_topic_success: "subscribe_session_topic_success", publishing_session_approve: "publishing_session_approve", session_approve_publish_success: "session_approve_publish_success", store_session: "store_session", publishing_session_settle: "publishing_session_settle", session_settle_publish_success: "session_settle_publish_success" }, Xa = { no_internet_connection: "no_internet_connection", proposal_expired: "proposal_expired", subscribe_session_topic_failure: "subscribe_session_topic_failure", session_approve_publish_failure: "session_approve_publish_failure", session_settle_publish_failure: "session_settle_publish_failure", session_approve_namespace_validation_failure: "session_approve_namespace_validation_failure", proposal_not_found: "proposal_not_found" }, Za = { authenticated_session_approve_started: "authenticated_session_approve_started", create_authenticated_session_topic: "create_authenticated_session_topic", cacaos_verified: "cacaos_verified", store_authenticated_session: "store_authenticated_session", subscribing_authenticated_session_topic: "subscribing_authenticated_session_topic", subscribe_authenticated_session_topic_success: "subscribe_authenticated_session_topic_success", publishing_authenticated_session_approve: "publishing_authenticated_session_approve" }, kf = { no_internet_connection: "no_internet_connection", invalid_cacao: "invalid_cacao", subscribe_authenticated_session_topic_failure: "subscribe_authenticated_session_topic_failure", authenticated_session_approve_publish_failure: "authenticated_session_approve_publish_failure", authenticated_session_pending_request_not_found: "authenticated_session_pending_request_not_found" }, iK = 0.1, sK = "event-client", oK = 86400, aK = "https://pulse.walletconnect.org/batch"; +function cK(t, e) { if (t.length >= 255) throw new TypeError("Alphabet too long"); for (var r = new Uint8Array(256), n = 0; n < r.length; n++) r[n] = 255; for (var i = 0; i < t.length; i++) { @@ -18685,13 +18693,13 @@ function aK(t, e) { if (P instanceof Uint8Array || (ArrayBuffer.isView(P) ? P = new Uint8Array(P.buffer, P.byteOffset, P.byteLength) : Array.isArray(P) && (P = Uint8Array.from(P))), !(P instanceof Uint8Array)) throw new TypeError("Expected Uint8Array"); if (P.length === 0) return ""; for (var O = 0, L = 0, B = 0, k = P.length; B !== k && P[B] === 0; ) B++, O++; - for (var q = (k - B) * d + 1 >>> 0, U = new Uint8Array(q); B !== k; ) { - for (var V = P[B], Q = 0, R = q - 1; (V !== 0 || Q < L) && R !== -1; R--, Q++) V += 256 * U[R] >>> 0, U[R] = V % a >>> 0, V = V / a >>> 0; + for (var W = (k - B) * d + 1 >>> 0, U = new Uint8Array(W); B !== k; ) { + for (var V = P[B], Q = 0, R = W - 1; (V !== 0 || Q < L) && R !== -1; R--, Q++) V += 256 * U[R] >>> 0, U[R] = V % a >>> 0, V = V / a >>> 0; if (V !== 0) throw new Error("Non-zero carry"); L = Q, B++; } - for (var K = q - L; K !== q && U[K] === 0; ) K++; - for (var ge = u.repeat(O); K < q; ++K) ge += t.charAt(U[K]); + for (var K = W - L; K !== W && U[K] === 0; ) K++; + for (var ge = u.repeat(O); K < W; ++K) ge += t.charAt(U[K]); return ge; } function w(P) { @@ -18700,16 +18708,16 @@ function aK(t, e) { var O = 0; if (P[O] !== " ") { for (var L = 0, B = 0; P[O] === u; ) L++, O++; - for (var k = (P.length - O) * l + 1 >>> 0, q = new Uint8Array(k); P[O]; ) { + for (var k = (P.length - O) * l + 1 >>> 0, W = new Uint8Array(k); P[O]; ) { var U = r[P.charCodeAt(O)]; if (U === 255) return; - for (var V = 0, Q = k - 1; (U !== 0 || V < B) && Q !== -1; Q--, V++) U += a * q[Q] >>> 0, q[Q] = U % 256 >>> 0, U = U / 256 >>> 0; + for (var V = 0, Q = k - 1; (U !== 0 || V < B) && Q !== -1; Q--, V++) U += a * W[Q] >>> 0, W[Q] = U % 256 >>> 0, U = U / 256 >>> 0; if (U !== 0) throw new Error("Non-zero carry"); B = V, O++; } if (P[O] !== " ") { - for (var R = k - B; R !== k && q[R] === 0; ) R++; - for (var K = new Uint8Array(L + (k - R)), ge = L; R !== k; ) K[ge++] = q[R++]; + for (var R = k - B; R !== k && W[R] === 0; ) R++; + for (var K = new Uint8Array(L + (k - R)), ge = L; R !== k; ) K[ge++] = W[R++]; return K; } } @@ -18721,14 +18729,14 @@ function aK(t, e) { } return { encode: p, decodeUnsafe: w, decode: _ }; } -var cK = aK, uK = cK; +var uK = cK, fK = uK; const LE = (t) => { if (t instanceof Uint8Array && t.constructor.name === "Uint8Array") return t; if (t instanceof ArrayBuffer) return new Uint8Array(t); if (ArrayBuffer.isView(t)) return new Uint8Array(t.buffer, t.byteOffset, t.byteLength); throw new Error("Unknown type, must be binary type"); -}, fK = (t) => new TextEncoder().encode(t), lK = (t) => new TextDecoder().decode(t); -class hK { +}, lK = (t) => new TextEncoder().encode(t), hK = (t) => new TextDecoder().decode(t); +class dK { constructor(e, r, n) { this.name = e, this.prefix = r, this.baseEncode = n; } @@ -18737,7 +18745,7 @@ class hK { throw Error("Unknown type, must be binary type"); } } -class dK { +class pK { constructor(e, r, n) { if (this.name = e, this.prefix = r, r.codePointAt(0) === void 0) throw new Error("Invalid prefix character"); this.prefixCodePoint = r.codePointAt(0), this.baseDecode = n; @@ -18752,7 +18760,7 @@ class dK { return kE(this, e); } } -class pK { +class gK { constructor(e) { this.decoders = e; } @@ -18765,10 +18773,10 @@ class pK { throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`); } } -const kE = (t, e) => new pK({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); -class gK { +const kE = (t, e) => new gK({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); +class mK { constructor(e, r, n, i) { - this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new hK(e, r, n), this.decoder = new dK(e, r, i); + this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new dK(e, r, n), this.decoder = new pK(e, r, i); } encode(e) { return this.encoder.encode(e); @@ -18777,10 +18785,10 @@ class gK { return this.decoder.decode(e); } } -const yp = ({ name: t, prefix: e, encode: r, decode: n }) => new gK(t, e, r, n), lh = ({ prefix: t, name: e, alphabet: r }) => { - const { encode: n, decode: i } = uK(r, e); +const yp = ({ name: t, prefix: e, encode: r, decode: n }) => new mK(t, e, r, n), lh = ({ prefix: t, name: e, alphabet: r }) => { + const { encode: n, decode: i } = fK(r, e); return yp({ prefix: t, name: e, encode: n, decode: (s) => LE(i(s)) }); -}, mK = (t, e, r, n) => { +}, vK = (t, e, r, n) => { const i = {}; for (let d = 0; d < e.length; ++d) i[e[d]] = d; let s = t.length; @@ -18794,78 +18802,78 @@ const yp = ({ name: t, prefix: e, encode: r, decode: n }) => new gK(t, e, r, n), } if (a >= r || 255 & u << 8 - a) throw new SyntaxError("Unexpected end of data"); return o; -}, vK = (t, e, r) => { +}, bK = (t, e, r) => { const n = e[e.length - 1] === "=", i = (1 << r) - 1; let s = "", o = 0, a = 0; for (let u = 0; u < t.length; ++u) for (a = a << 8 | t[u], o += 8; o > r; ) o -= r, s += e[i & a >> o]; if (o && (s += e[i & a << r - o]), n) for (; s.length * r & 7; ) s += "="; return s; }, Hn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => yp({ prefix: e, name: t, encode(i) { - return vK(i, n, r); + return bK(i, n, r); }, decode(i) { - return mK(i, n, r, t); -} }), bK = yp({ prefix: "\0", name: "identity", encode: (t) => lK(t), decode: (t) => fK(t) }); -var yK = Object.freeze({ __proto__: null, identity: bK }); -const wK = Hn({ prefix: "0", name: "base2", alphabet: "01", bitsPerChar: 1 }); -var xK = Object.freeze({ __proto__: null, base2: wK }); -const _K = Hn({ prefix: "7", name: "base8", alphabet: "01234567", bitsPerChar: 3 }); -var EK = Object.freeze({ __proto__: null, base8: _K }); -const SK = lh({ prefix: "9", name: "base10", alphabet: "0123456789" }); -var AK = Object.freeze({ __proto__: null, base10: SK }); -const PK = Hn({ prefix: "f", name: "base16", alphabet: "0123456789abcdef", bitsPerChar: 4 }), MK = Hn({ prefix: "F", name: "base16upper", alphabet: "0123456789ABCDEF", bitsPerChar: 4 }); -var IK = Object.freeze({ __proto__: null, base16: PK, base16upper: MK }); -const CK = Hn({ prefix: "b", name: "base32", alphabet: "abcdefghijklmnopqrstuvwxyz234567", bitsPerChar: 5 }), TK = Hn({ prefix: "B", name: "base32upper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", bitsPerChar: 5 }), RK = Hn({ prefix: "c", name: "base32pad", alphabet: "abcdefghijklmnopqrstuvwxyz234567=", bitsPerChar: 5 }), DK = Hn({ prefix: "C", name: "base32padupper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", bitsPerChar: 5 }), OK = Hn({ prefix: "v", name: "base32hex", alphabet: "0123456789abcdefghijklmnopqrstuv", bitsPerChar: 5 }), NK = Hn({ prefix: "V", name: "base32hexupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", bitsPerChar: 5 }), LK = Hn({ prefix: "t", name: "base32hexpad", alphabet: "0123456789abcdefghijklmnopqrstuv=", bitsPerChar: 5 }), kK = Hn({ prefix: "T", name: "base32hexpadupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=", bitsPerChar: 5 }), $K = Hn({ prefix: "h", name: "base32z", alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769", bitsPerChar: 5 }); -var BK = Object.freeze({ __proto__: null, base32: CK, base32upper: TK, base32pad: RK, base32padupper: DK, base32hex: OK, base32hexupper: NK, base32hexpad: LK, base32hexpadupper: kK, base32z: $K }); -const FK = lh({ prefix: "k", name: "base36", alphabet: "0123456789abcdefghijklmnopqrstuvwxyz" }), jK = lh({ prefix: "K", name: "base36upper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" }); -var UK = Object.freeze({ __proto__: null, base36: FK, base36upper: jK }); -const qK = lh({ name: "base58btc", prefix: "z", alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" }), zK = lh({ name: "base58flickr", prefix: "Z", alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" }); -var WK = Object.freeze({ __proto__: null, base58btc: qK, base58flickr: zK }); -const HK = Hn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 }), KK = Hn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 }), VK = Hn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 }), GK = Hn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", bitsPerChar: 6 }); -var YK = Object.freeze({ __proto__: null, base64: HK, base64pad: KK, base64url: VK, base64urlpad: GK }); -const $E = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), JK = $E.reduce((t, e, r) => (t[r] = e, t), []), XK = $E.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); -function ZK(t) { - return t.reduce((e, r) => (e += JK[r], e), ""); -} + return vK(i, n, r, t); +} }), yK = yp({ prefix: "\0", name: "identity", encode: (t) => hK(t), decode: (t) => lK(t) }); +var wK = Object.freeze({ __proto__: null, identity: yK }); +const xK = Hn({ prefix: "0", name: "base2", alphabet: "01", bitsPerChar: 1 }); +var _K = Object.freeze({ __proto__: null, base2: xK }); +const EK = Hn({ prefix: "7", name: "base8", alphabet: "01234567", bitsPerChar: 3 }); +var SK = Object.freeze({ __proto__: null, base8: EK }); +const AK = lh({ prefix: "9", name: "base10", alphabet: "0123456789" }); +var PK = Object.freeze({ __proto__: null, base10: AK }); +const MK = Hn({ prefix: "f", name: "base16", alphabet: "0123456789abcdef", bitsPerChar: 4 }), IK = Hn({ prefix: "F", name: "base16upper", alphabet: "0123456789ABCDEF", bitsPerChar: 4 }); +var CK = Object.freeze({ __proto__: null, base16: MK, base16upper: IK }); +const TK = Hn({ prefix: "b", name: "base32", alphabet: "abcdefghijklmnopqrstuvwxyz234567", bitsPerChar: 5 }), RK = Hn({ prefix: "B", name: "base32upper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", bitsPerChar: 5 }), DK = Hn({ prefix: "c", name: "base32pad", alphabet: "abcdefghijklmnopqrstuvwxyz234567=", bitsPerChar: 5 }), OK = Hn({ prefix: "C", name: "base32padupper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", bitsPerChar: 5 }), NK = Hn({ prefix: "v", name: "base32hex", alphabet: "0123456789abcdefghijklmnopqrstuv", bitsPerChar: 5 }), LK = Hn({ prefix: "V", name: "base32hexupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", bitsPerChar: 5 }), kK = Hn({ prefix: "t", name: "base32hexpad", alphabet: "0123456789abcdefghijklmnopqrstuv=", bitsPerChar: 5 }), $K = Hn({ prefix: "T", name: "base32hexpadupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=", bitsPerChar: 5 }), BK = Hn({ prefix: "h", name: "base32z", alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769", bitsPerChar: 5 }); +var FK = Object.freeze({ __proto__: null, base32: TK, base32upper: RK, base32pad: DK, base32padupper: OK, base32hex: NK, base32hexupper: LK, base32hexpad: kK, base32hexpadupper: $K, base32z: BK }); +const jK = lh({ prefix: "k", name: "base36", alphabet: "0123456789abcdefghijklmnopqrstuvwxyz" }), UK = lh({ prefix: "K", name: "base36upper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" }); +var qK = Object.freeze({ __proto__: null, base36: jK, base36upper: UK }); +const zK = lh({ name: "base58btc", prefix: "z", alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" }), WK = lh({ name: "base58flickr", prefix: "Z", alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" }); +var HK = Object.freeze({ __proto__: null, base58btc: zK, base58flickr: WK }); +const KK = Hn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 }), VK = Hn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 }), GK = Hn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 }), YK = Hn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", bitsPerChar: 6 }); +var JK = Object.freeze({ __proto__: null, base64: KK, base64pad: VK, base64url: GK, base64urlpad: YK }); +const $E = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), XK = $E.reduce((t, e, r) => (t[r] = e, t), []), ZK = $E.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); function QK(t) { + return t.reduce((e, r) => (e += XK[r], e), ""); +} +function eV(t) { const e = []; for (const r of t) { - const n = XK[r.codePointAt(0)]; + const n = ZK[r.codePointAt(0)]; if (n === void 0) throw new Error(`Non-base256emoji character: ${r}`); e.push(n); } return new Uint8Array(e); } -const eV = yp({ prefix: "🚀", name: "base256emoji", encode: ZK, decode: QK }); -var tV = Object.freeze({ __proto__: null, base256emoji: eV }), rV = BE, R3 = 128, nV = 127, iV = ~nV, sV = Math.pow(2, 31); +const tV = yp({ prefix: "🚀", name: "base256emoji", encode: QK, decode: eV }); +var rV = Object.freeze({ __proto__: null, base256emoji: tV }), nV = BE, R3 = 128, iV = 127, sV = ~iV, oV = Math.pow(2, 31); function BE(t, e, r) { e = e || [], r = r || 0; - for (var n = r; t >= sV; ) e[r++] = t & 255 | R3, t /= 128; - for (; t & iV; ) e[r++] = t & 255 | R3, t >>>= 7; + for (var n = r; t >= oV; ) e[r++] = t & 255 | R3, t /= 128; + for (; t & sV; ) e[r++] = t & 255 | R3, t >>>= 7; return e[r] = t | 0, BE.bytes = r - n + 1, e; } -var oV = V1, aV = 128, D3 = 127; +var aV = V1, cV = 128, D3 = 127; function V1(t, n) { var r = 0, n = n || 0, i = 0, s = n, o, a = t.length; do { if (s >= a) throw V1.bytes = 0, new RangeError("Could not decode varint"); o = t[s++], r += i < 28 ? (o & D3) << i : (o & D3) * Math.pow(2, i), i += 7; - } while (o >= aV); + } while (o >= cV); return V1.bytes = s - n, r; } -var cV = Math.pow(2, 7), uV = Math.pow(2, 14), fV = Math.pow(2, 21), lV = Math.pow(2, 28), hV = Math.pow(2, 35), dV = Math.pow(2, 42), pV = Math.pow(2, 49), gV = Math.pow(2, 56), mV = Math.pow(2, 63), vV = function(t) { - return t < cV ? 1 : t < uV ? 2 : t < fV ? 3 : t < lV ? 4 : t < hV ? 5 : t < dV ? 6 : t < pV ? 7 : t < gV ? 8 : t < mV ? 9 : 10; -}, bV = { encode: rV, decode: oV, encodingLength: vV }, FE = bV; +var uV = Math.pow(2, 7), fV = Math.pow(2, 14), lV = Math.pow(2, 21), hV = Math.pow(2, 28), dV = Math.pow(2, 35), pV = Math.pow(2, 42), gV = Math.pow(2, 49), mV = Math.pow(2, 56), vV = Math.pow(2, 63), bV = function(t) { + return t < uV ? 1 : t < fV ? 2 : t < lV ? 3 : t < hV ? 4 : t < dV ? 5 : t < pV ? 6 : t < gV ? 7 : t < mV ? 8 : t < vV ? 9 : 10; +}, yV = { encode: nV, decode: aV, encodingLength: bV }, FE = yV; const O3 = (t, e, r = 0) => (FE.encode(t, e, r), e), N3 = (t) => FE.encodingLength(t), G1 = (t, e) => { const r = e.byteLength, n = N3(t), i = n + N3(r), s = new Uint8Array(i + r); - return O3(t, s, 0), O3(r, s, n), s.set(e, i), new yV(t, r, e, s); + return O3(t, s, 0), O3(r, s, n), s.set(e, i), new wV(t, r, e, s); }; -class yV { +class wV { constructor(e, r, n, i) { this.code = e, this.size = r, this.digest = n, this.bytes = i; } } -const jE = ({ name: t, code: e, encode: r }) => new wV(t, e, r); -class wV { +const jE = ({ name: t, code: e, encode: r }) => new xV(t, e, r); +class xV { constructor(e, r, n) { this.name = e, this.code = r, this.encode = n; } @@ -18876,14 +18884,14 @@ class wV { } else throw Error("Unknown type, must be binary type"); } } -const UE = (t) => async (e) => new Uint8Array(await crypto.subtle.digest(t, e)), xV = jE({ name: "sha2-256", code: 18, encode: UE("SHA-256") }), _V = jE({ name: "sha2-512", code: 19, encode: UE("SHA-512") }); -var EV = Object.freeze({ __proto__: null, sha256: xV, sha512: _V }); -const qE = 0, SV = "identity", zE = LE, AV = (t) => G1(qE, zE(t)), PV = { code: qE, name: SV, encode: zE, digest: AV }; -var MV = Object.freeze({ __proto__: null, identity: PV }); +const UE = (t) => async (e) => new Uint8Array(await crypto.subtle.digest(t, e)), _V = jE({ name: "sha2-256", code: 18, encode: UE("SHA-256") }), EV = jE({ name: "sha2-512", code: 19, encode: UE("SHA-512") }); +var SV = Object.freeze({ __proto__: null, sha256: _V, sha512: EV }); +const qE = 0, AV = "identity", zE = LE, PV = (t) => G1(qE, zE(t)), MV = { code: qE, name: AV, encode: zE, digest: PV }; +var IV = Object.freeze({ __proto__: null, identity: MV }); new TextEncoder(), new TextDecoder(); -const L3 = { ...yK, ...xK, ...EK, ...AK, ...IK, ...BK, ...UK, ...WK, ...YK, ...tV }; -({ ...EV, ...MV }); -function IV(t = 0) { +const L3 = { ...wK, ..._K, ...SK, ...PK, ...CK, ...FK, ...qK, ...HK, ...JK, ...rV }; +({ ...SV, ...IV }); +function CV(t = 0) { return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); } function WE(t, e, r, n) { @@ -18895,18 +18903,18 @@ const k3 = WE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) = return e; }, (t) => { t = t.substring(1); - const e = IV(t.length); + const e = CV(t.length); for (let r = 0; r < t.length; r++) e[r] = t.charCodeAt(r); return e; -}), CV = { utf8: k3, "utf-8": k3, hex: L3.base16, latin1: Im, ascii: Im, binary: Im, ...L3 }; -function TV(t, e = "utf8") { - const r = CV[e]; +}), TV = { utf8: k3, "utf-8": k3, hex: L3.base16, latin1: Im, ascii: Im, binary: Im, ...L3 }; +function RV(t, e = "utf8") { + const r = TV[e]; if (!r) throw new Error(`Unsupported encoding "${e}"`); return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t, "utf8") : r.decoder.decode(`${r.prefix}${t}`); } -let RV = class { +let DV = class { constructor(e, r) { - this.core = e, this.logger = r, this.keychain = /* @__PURE__ */ new Map(), this.name = TH, this.version = RH, this.initialized = !1, this.storagePrefix = ro, this.init = async () => { + this.core = e, this.logger = r, this.keychain = /* @__PURE__ */ new Map(), this.name = RH, this.version = DH, this.initialized = !1, this.storagePrefix = ro, this.init = async () => { if (!this.initialized) { const n = await this.getKeyChain(); typeof n < "u" && (this.keychain = n), this.initialized = !0; @@ -18947,9 +18955,9 @@ let RV = class { throw new Error(e); } } -}, DV = class { +}, OV = class { constructor(e, r, n) { - this.core = e, this.logger = r, this.name = IH, this.randomSessionIdentifier = W1(), this.initialized = !1, this.init = async () => { + this.core = e, this.logger = r, this.name = CH, this.randomSessionIdentifier = W1(), this.initialized = !1, this.init = async () => { this.initialized || (await this.keychain.init(), this.initialized = !0); }, this.hasKeys = (i) => (this.isInitialized(), this.keychain.has(i)), this.getClientId = async () => { this.isInitialized(); @@ -18957,15 +18965,15 @@ let RV = class { return g8(s.publicKey); }, this.generateKeyPair = () => { this.isInitialized(); - const i = tW(); + const i = rW(); return this.setPrivateKey(i.publicKey, i.privateKey); }, this.signJWT = async (i) => { this.isInitialized(); const s = await this.getClientSeed(), o = xx(s), a = this.randomSessionIdentifier; - return await SF(a, i, CH, o); + return await AF(a, i, TH, o); }, this.generateSharedKey = (i, s, o) => { this.isInitialized(); - const a = this.getPrivateKey(i), u = rW(a, s); + const a = this.getPrivateKey(i), u = nW(a, s); return this.setSymKey(u, o); }, this.setSymKey = async (i, s) => { this.isInitialized(); @@ -18978,18 +18986,18 @@ let RV = class { }, this.encode = async (i, s, o) => { this.isInitialized(); const a = wE(o), u = jo(s); - if (f3(a)) return iW(u, o == null ? void 0 : o.encoding); + if (f3(a)) return sW(u, o == null ? void 0 : o.encoding); if (u3(a)) { const w = a.senderPublicKey, _ = a.receiverPublicKey; i = await this.generateSharedKey(w, _); } const l = this.getSymKey(i), { type: d, senderPublicKey: p } = a; - return nW({ type: d, symKey: l, message: u, senderPublicKey: p, encoding: o == null ? void 0 : o.encoding }); + return iW({ type: d, symKey: l, message: u, senderPublicKey: p, encoding: o == null ? void 0 : o.encoding }); }, this.decode = async (i, s, o) => { this.isInitialized(); - const a = aW(s, o); + const a = cW(s, o); if (f3(a)) { - const u = oW(s, o == null ? void 0 : o.encoding); + const u = aW(s, o == null ? void 0 : o.encoding); return bc(u); } if (u3(a)) { @@ -18997,7 +19005,7 @@ let RV = class { i = await this.generateSharedKey(u, l); } try { - const u = this.getSymKey(i), l = sW({ symKey: u, encoded: s, encoding: o == null ? void 0 : o.encoding }); + const u = this.getSymKey(i), l = oW({ symKey: u, encoded: s, encoding: o == null ? void 0 : o.encoding }); return bc(l); } catch (u) { this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`), this.logger.error(u); @@ -19008,7 +19016,7 @@ let RV = class { }, this.getPayloadSenderPublicKey = (i, s = pa) => { const o = Nl({ encoded: i, encoding: s }); return o.senderPublicKey ? On(o.senderPublicKey, ci) : void 0; - }, this.core = e, this.logger = ui(r, this.name), this.keychain = n || new RV(this.core, this.logger); + }, this.core = e, this.logger = ui(r, this.name), this.keychain = n || new DV(this.core, this.logger); } get context() { return Pi(this.logger); @@ -19026,7 +19034,7 @@ let RV = class { } catch { e = W1(), await this.keychain.set(C3, e); } - return TV(e, "base16"); + return RV(e, "base16"); } getSymKey(e) { return this.keychain.get(e); @@ -19038,9 +19046,9 @@ let RV = class { } } }; -class OV extends T$ { +class NV extends R$ { constructor(e, r) { - super(e, r), this.logger = e, this.core = r, this.messages = /* @__PURE__ */ new Map(), this.name = DH, this.version = OH, this.initialized = !1, this.storagePrefix = ro, this.init = async () => { + super(e, r), this.logger = e, this.core = r, this.messages = /* @__PURE__ */ new Map(), this.name = OH, this.version = NH, this.initialized = !1, this.storagePrefix = ro, this.init = async () => { if (!this.initialized) { this.logger.trace("Initialized"); try { @@ -19092,17 +19100,17 @@ class OV extends T$ { } } } -class NV extends R$ { +class LV extends D$ { constructor(e, r) { - super(e, r), this.relayer = e, this.logger = r, this.events = new is.EventEmitter(), this.name = LH, this.queue = /* @__PURE__ */ new Map(), this.publishTimeout = vt.toMiliseconds(vt.ONE_MINUTE), this.failedPublishTimeout = vt.toMiliseconds(vt.ONE_SECOND), this.needsTransportRestart = !1, this.publish = async (n, i, s) => { + super(e, r), this.relayer = e, this.logger = r, this.events = new is.EventEmitter(), this.name = kH, this.queue = /* @__PURE__ */ new Map(), this.publishTimeout = vt.toMiliseconds(vt.ONE_MINUTE), this.failedPublishTimeout = vt.toMiliseconds(vt.ONE_SECOND), this.needsTransportRestart = !1, this.publish = async (n, i, s) => { var o; this.logger.debug("Publishing Payload"), this.logger.trace({ type: "method", method: "publish", params: { topic: n, message: i, opts: s } }); - const a = (s == null ? void 0 : s.ttl) || NH, u = H1(s), l = (s == null ? void 0 : s.prompt) || !1, d = (s == null ? void 0 : s.tag) || 0, p = (s == null ? void 0 : s.id) || fc().toString(), w = { topic: n, message: i, opts: { ttl: a, relay: u, prompt: l, tag: d, id: p, attestation: s == null ? void 0 : s.attestation } }, _ = `Failed to publish payload, please try again. id:${p} tag:${d}`, P = Date.now(); + const a = (s == null ? void 0 : s.ttl) || LH, u = H1(s), l = (s == null ? void 0 : s.prompt) || !1, d = (s == null ? void 0 : s.tag) || 0, p = (s == null ? void 0 : s.id) || fc().toString(), w = { topic: n, message: i, opts: { ttl: a, relay: u, prompt: l, tag: d, id: p, attestation: s == null ? void 0 : s.attestation } }, _ = `Failed to publish payload, please try again. id:${p} tag:${d}`, P = Date.now(); let O, L = 1; try { for (; O === void 0; ) { if (Date.now() - P > this.publishTimeout) throw new Error(_); - this.logger.trace({ id: p, attempts: L }, `publisher.publish - attempt ${L}`), O = await await Eu(this.rpcPublish(n, i, a, u, l, d, p, s == null ? void 0 : s.attestation).catch((B) => this.logger.warn(B)), this.publishTimeout, _), L++, O || await new Promise((B) => setTimeout(B, this.failedPublishTimeout)); + this.logger.trace({ id: p, attempts: L }, `publisher.publish - attempt ${L}`), O = await await Su(this.rpcPublish(n, i, a, u, l, d, p, s == null ? void 0 : s.attestation).catch((B) => this.logger.warn(B)), this.publishTimeout, _), L++, O || await new Promise((B) => setTimeout(B, this.failedPublishTimeout)); } this.relayer.events.emit(ai.publish, w), this.logger.debug("Successfully Published Payload"), this.logger.trace({ type: "method", method: "publish", params: { id: p, topic: n, message: i, opts: s } }); } catch (B) { @@ -19124,7 +19132,7 @@ class NV extends R$ { } rpcPublish(e, r, n, i, s, o, a, u) { var l, d, p, w; - const _ = { method: Hf(i.protocol).publish, params: { topic: e, message: r, ttl: n, prompt: s, tag: o, attestation: u }, id: a }; + const _ = { method: Kf(i.protocol).publish, params: { topic: e, message: r, ttl: n, prompt: s, tag: o, attestation: u }, id: a }; return vi((l = _.params) == null ? void 0 : l.prompt) && ((d = _.params) == null || delete d.prompt), vi((p = _.params) == null ? void 0 : p.tag) && ((w = _.params) == null || delete w.tag), this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "message", direction: "outgoing", request: _ }), this.relayer.request(_); } removeRequestFromQueue(e) { @@ -19137,7 +19145,7 @@ class NV extends R$ { }); } registerEventListeners() { - this.relayer.core.heartbeat.on(ju.pulse, () => { + this.relayer.core.heartbeat.on(Uu.pulse, () => { if (this.needsTransportRestart) { this.needsTransportRestart = !1, this.relayer.events.emit(ai.connection_stalled); return; @@ -19148,7 +19156,7 @@ class NV extends R$ { }); } } -class LV { +class kV { constructor() { this.map = /* @__PURE__ */ new Map(), this.set = (e, r) => { const n = this.get(e); @@ -19175,14 +19183,14 @@ class LV { return Array.from(this.map.keys()); } } -var kV = Object.defineProperty, $V = Object.defineProperties, BV = Object.getOwnPropertyDescriptors, $3 = Object.getOwnPropertySymbols, FV = Object.prototype.hasOwnProperty, jV = Object.prototype.propertyIsEnumerable, B3 = (t, e, r) => e in t ? kV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, kf = (t, e) => { - for (var r in e || (e = {})) FV.call(e, r) && B3(t, r, e[r]); - if ($3) for (var r of $3(e)) jV.call(e, r) && B3(t, r, e[r]); +var $V = Object.defineProperty, BV = Object.defineProperties, FV = Object.getOwnPropertyDescriptors, $3 = Object.getOwnPropertySymbols, jV = Object.prototype.hasOwnProperty, UV = Object.prototype.propertyIsEnumerable, B3 = (t, e, r) => e in t ? $V(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, $f = (t, e) => { + for (var r in e || (e = {})) jV.call(e, r) && B3(t, r, e[r]); + if ($3) for (var r of $3(e)) UV.call(e, r) && B3(t, r, e[r]); return t; -}, Cm = (t, e) => $V(t, BV(e)); -class UV extends N$ { +}, Cm = (t, e) => BV(t, FV(e)); +class qV extends L$ { constructor(e, r) { - super(e, r), this.relayer = e, this.logger = r, this.subscriptions = /* @__PURE__ */ new Map(), this.topicMap = new LV(), this.events = new is.EventEmitter(), this.name = qH, this.version = zH, this.pending = /* @__PURE__ */ new Map(), this.cached = [], this.initialized = !1, this.pendingSubscriptionWatchLabel = "pending_sub_watch_label", this.pollingInterval = 20, this.storagePrefix = ro, this.subscribeTimeout = vt.toMiliseconds(vt.ONE_MINUTE), this.restartInProgress = !1, this.batchSubscribeTopicsLimit = 500, this.pendingBatchMessages = [], this.init = async () => { + super(e, r), this.relayer = e, this.logger = r, this.subscriptions = /* @__PURE__ */ new Map(), this.topicMap = new kV(), this.events = new is.EventEmitter(), this.name = zH, this.version = WH, this.pending = /* @__PURE__ */ new Map(), this.cached = [], this.initialized = !1, this.pendingSubscriptionWatchLabel = "pending_sub_watch_label", this.pollingInterval = 20, this.storagePrefix = ro, this.subscribeTimeout = vt.toMiliseconds(vt.ONE_MINUTE), this.restartInProgress = !1, this.batchSubscribeTopicsLimit = 500, this.pendingBatchMessages = [], this.init = async () => { this.initialized || (this.logger.trace("Initialized"), this.registerEventListeners(), this.clientId = await this.relayer.core.crypto.getClientId(), await this.restore()), this.initialized = !0; }, this.subscribe = async (n, i) => { this.isInitialized(), this.logger.debug("Subscribing Topic"), this.logger.trace({ type: "method", method: "subscribe", params: { topic: n, opts: i } }); @@ -19203,7 +19211,7 @@ class UV extends N$ { const a = new vt.Watch(); a.start(i); const u = setInterval(() => { - !this.pending.has(n) && this.topics.includes(n) && (clearInterval(u), a.stop(i), s(!0)), a.elapsed(i) >= WH && (clearInterval(u), a.stop(i), o(new Error("Subscription resolution timeout"))); + !this.pending.has(n) && this.topics.includes(n) && (clearInterval(u), a.stop(i), s(!0)), a.elapsed(i) >= HH && (clearInterval(u), a.stop(i), o(new Error("Subscription resolution timeout"))); }, this.pollingInterval); }).catch(() => !1); }, this.on = (n, i) => { @@ -19272,7 +19280,7 @@ class UV extends N$ { async rpcSubscribe(e, r, n) { var i; (n == null ? void 0 : n.transportType) === zr.relay && await this.restartToComplete(); - const s = { method: Hf(r.protocol).subscribe, params: { topic: e } }; + const s = { method: Kf(r.protocol).subscribe, params: { topic: e } }; this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: s }); const o = (i = n == null ? void 0 : n.internal) == null ? void 0 : i.throwOnFailedPublish; try { @@ -19280,7 +19288,7 @@ class UV extends N$ { if ((n == null ? void 0 : n.transportType) === zr.link_mode) return setTimeout(() => { (this.relayer.connected || this.relayer.connecting) && this.relayer.request(s).catch((l) => this.logger.warn(l)); }, vt.toMiliseconds(vt.ONE_SECOND)), a; - const u = await Eu(this.relayer.request(s).catch((l) => this.logger.warn(l)), this.subscribeTimeout, `Subscribing to ${e} failed, please try again`); + const u = await Su(this.relayer.request(s).catch((l) => this.logger.warn(l)), this.subscribeTimeout, `Subscribing to ${e} failed, please try again`); if (!u && o) throw new Error(`Subscribing to ${e} failed, please try again`); return u ? a : null; } catch (a) { @@ -19290,36 +19298,36 @@ class UV extends N$ { } async rpcBatchSubscribe(e) { if (!e.length) return; - const r = e[0].relay, n = { method: Hf(r.protocol).batchSubscribe, params: { topics: e.map((i) => i.topic) } }; + const r = e[0].relay, n = { method: Kf(r.protocol).batchSubscribe, params: { topics: e.map((i) => i.topic) } }; this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: n }); try { - return await await Eu(this.relayer.request(n).catch((i) => this.logger.warn(i)), this.subscribeTimeout); + return await await Su(this.relayer.request(n).catch((i) => this.logger.warn(i)), this.subscribeTimeout); } catch { this.relayer.events.emit(ai.connection_stalled); } } async rpcBatchFetchMessages(e) { if (!e.length) return; - const r = e[0].relay, n = { method: Hf(r.protocol).batchFetchMessages, params: { topics: e.map((s) => s.topic) } }; + const r = e[0].relay, n = { method: Kf(r.protocol).batchFetchMessages, params: { topics: e.map((s) => s.topic) } }; this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: n }); let i; try { - i = await await Eu(this.relayer.request(n).catch((s) => this.logger.warn(s)), this.subscribeTimeout); + i = await await Su(this.relayer.request(n).catch((s) => this.logger.warn(s)), this.subscribeTimeout); } catch { this.relayer.events.emit(ai.connection_stalled); } return i; } rpcUnsubscribe(e, r, n) { - const i = { method: Hf(n.protocol).unsubscribe, params: { topic: e, id: r } }; + const i = { method: Kf(n.protocol).unsubscribe, params: { topic: e, id: r } }; return this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: i }), this.relayer.request(i); } onSubscribe(e, r) { - this.setSubscription(e, Cm(kf({}, r), { id: e })), this.pending.delete(r.topic); + this.setSubscription(e, Cm($f({}, r), { id: e })), this.pending.delete(r.topic); } onBatchSubscribe(e) { e.length && e.forEach((r) => { - this.setSubscription(r.id, kf({}, r)), this.pending.delete(r.topic); + this.setSubscription(r.id, $f({}, r)), this.pending.delete(r.topic); }); } async onUnsubscribe(e, r, n) { @@ -19335,7 +19343,7 @@ class UV extends N$ { this.logger.debug("Setting subscription"), this.logger.trace({ type: "method", method: "setSubscription", id: e, subscription: r }), this.addSubscription(e, r); } addSubscription(e, r) { - this.subscriptions.set(e, kf({}, r)), this.topicMap.set(r.topic, e), this.events.emit(Ws.created, r); + this.subscriptions.set(e, $f({}, r)), this.topicMap.set(r.topic, e), this.events.emit(Ws.created, r); } getSubscription(e) { this.logger.debug("Getting subscription"), this.logger.trace({ type: "method", method: "getSubscription", id: e }); @@ -19349,7 +19357,7 @@ class UV extends N$ { deleteSubscription(e, r) { this.logger.debug("Deleting subscription"), this.logger.trace({ type: "method", method: "deleteSubscription", id: e, reason: r }); const n = this.getSubscription(e); - this.subscriptions.delete(e), this.topicMap.delete(n.topic, e), this.events.emit(Ws.deleted, Cm(kf({}, n), { reason: r })); + this.subscriptions.delete(e), this.topicMap.delete(n.topic, e), this.events.emit(Ws.deleted, Cm($f({}, n), { reason: r })); } async persist() { await this.setRelayerSubscriptions(this.values), this.events.emit(Ws.sync); @@ -19380,7 +19388,7 @@ class UV extends N$ { async batchSubscribe(e) { if (!e.length) return; const r = await this.rpcBatchSubscribe(e); - _c(r) && this.onBatchSubscribe(r.map((n, i) => Cm(kf({}, e[i]), { id: n }))); + _c(r) && this.onBatchSubscribe(r.map((n, i) => Cm($f({}, e[i]), { id: n }))); } async batchFetchMessages(e) { if (!e.length) return; @@ -19402,7 +19410,7 @@ class UV extends N$ { }), await this.batchSubscribe(e), this.pendingBatchMessages.length && (await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages), this.pendingBatchMessages = []); } registerEventListeners() { - this.relayer.core.heartbeat.on(ju.pulse, async () => { + this.relayer.core.heartbeat.on(Uu.pulse, async () => { await this.checkPending(); }), this.events.on(Ws.created, async (e) => { const r = Ws.created; @@ -19426,14 +19434,14 @@ class UV extends N$ { }); } } -var qV = Object.defineProperty, F3 = Object.getOwnPropertySymbols, zV = Object.prototype.hasOwnProperty, WV = Object.prototype.propertyIsEnumerable, j3 = (t, e, r) => e in t ? qV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, U3 = (t, e) => { - for (var r in e || (e = {})) zV.call(e, r) && j3(t, r, e[r]); - if (F3) for (var r of F3(e)) WV.call(e, r) && j3(t, r, e[r]); +var zV = Object.defineProperty, F3 = Object.getOwnPropertySymbols, WV = Object.prototype.hasOwnProperty, HV = Object.prototype.propertyIsEnumerable, j3 = (t, e, r) => e in t ? zV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, U3 = (t, e) => { + for (var r in e || (e = {})) WV.call(e, r) && j3(t, r, e[r]); + if (F3) for (var r of F3(e)) HV.call(e, r) && j3(t, r, e[r]); return t; }; -class HV extends D$ { +class KV extends O$ { constructor(e) { - super(e), this.protocol = "wc", this.version = 2, this.events = new is.EventEmitter(), this.name = $H, this.transportExplicitlyClosed = !1, this.initialized = !1, this.connectionAttemptInProgress = !1, this.connectionStatusPollingInterval = 20, this.staleConnectionErrors = ["socket hang up", "stalled", "interrupted"], this.hasExperiencedNetworkDisruption = !1, this.requestsInFlight = /* @__PURE__ */ new Map(), this.heartBeatTimeout = vt.toMiliseconds(vt.THIRTY_SECONDS + vt.ONE_SECOND), this.request = async (r) => { + super(e), this.protocol = "wc", this.version = 2, this.events = new is.EventEmitter(), this.name = BH, this.transportExplicitlyClosed = !1, this.initialized = !1, this.connectionAttemptInProgress = !1, this.connectionStatusPollingInterval = 20, this.staleConnectionErrors = ["socket hang up", "stalled", "interrupted"], this.hasExperiencedNetworkDisruption = !1, this.requestsInFlight = /* @__PURE__ */ new Map(), this.heartBeatTimeout = vt.toMiliseconds(vt.THIRTY_SECONDS + vt.ONE_SECOND), this.request = async (r) => { var n, i; this.logger.debug("Publishing Request Payload"); const s = r.id || fc().toString(); @@ -19474,7 +19482,7 @@ class HV extends D$ { this.logger.error(r), this.events.emit(ai.error, r), this.logger.info("Fatal socket error received, closing transport"), this.transportClose(); }, this.registerProviderListeners = () => { this.provider.on(Yi.payload, this.onPayloadHandler), this.provider.on(Yi.connect, this.onConnectHandler), this.provider.on(Yi.disconnect, this.onDisconnectHandler), this.provider.on(Yi.error, this.onProviderErrorHandler); - }, this.core = e.core, this.logger = typeof e.logger < "u" && typeof e.logger != "string" ? ui(e.logger, this.name) : Xl(X0({ level: e.logger || kH })), this.messages = new OV(this.logger, e.core), this.subscriber = new UV(this, this.logger), this.publisher = new NV(this, this.logger), this.relayUrl = (e == null ? void 0 : e.relayUrl) || OE, this.projectId = e.projectId, this.bundleId = yz(), this.provider = {}; + }, this.core = e.core, this.logger = typeof e.logger < "u" && typeof e.logger != "string" ? ui(e.logger, this.name) : Xl(X0({ level: e.logger || $H })), this.messages = new NV(this.logger, e.core), this.subscriber = new qV(this, this.logger), this.publisher = new LV(this, this.logger), this.relayUrl = (e == null ? void 0 : e.relayUrl) || OE, this.projectId = e.projectId, this.bundleId = wz(), this.provider = {}; } async init() { if (this.logger.trace("Initialized"), this.registerEventListeners(), await Promise.all([this.messages.init(), this.subscriber.init()]), this.initialized = !0, this.subscriber.cached.length > 0) try { @@ -19534,7 +19542,7 @@ class HV extends D$ { } catch (e) { this.logger.warn(e); } - this.provider.disconnect && (this.hasExperiencedNetworkDisruption || this.connected) ? await Eu(this.provider.disconnect(), 2e3, "provider.disconnect()").catch(() => this.onProviderDisconnect()) : this.onProviderDisconnect(); + this.provider.disconnect && (this.hasExperiencedNetworkDisruption || this.connected) ? await Su(this.provider.disconnect(), 2e3, "provider.disconnect()").catch(() => this.onProviderDisconnect()) : this.onProviderDisconnect(); } async transportClose() { this.transportExplicitlyClosed = !0, await this.transportDisconnect(); @@ -19546,7 +19554,7 @@ class HV extends D$ { const i = () => { this.provider.off(Yi.disconnect, i), n(new Error("Connection interrupted while trying to subscribe")); }; - this.provider.on(Yi.disconnect, i), await Eu(this.provider.connect(), vt.toMiliseconds(vt.ONE_MINUTE), `Socket stalled when trying to connect to ${this.relayUrl}`).catch((s) => { + this.provider.on(Yi.disconnect, i), await Su(this.provider.connect(), vt.toMiliseconds(vt.ONE_MINUTE), `Socket stalled when trying to connect to ${this.relayUrl}`).catch((s) => { n(s); }).finally(() => { clearTimeout(this.reconnectTimeout), this.reconnectTimeout = void 0; @@ -19606,7 +19614,7 @@ class HV extends D$ { async createProvider() { this.provider.connection && this.unregisterProviderListeners(); const e = await this.core.crypto.signJWT(this.relayUrl); - this.provider = new us(new EH(Ez({ sdkVersion: K1, protocol: this.protocol, version: this.version, relayUrl: this.relayUrl, projectId: this.projectId, auth: e, useOnCloseEvent: !0, bundleId: this.bundleId }))), this.registerProviderListeners(); + this.provider = new us(new SH(Sz({ sdkVersion: K1, protocol: this.protocol, version: this.version, relayUrl: this.relayUrl, projectId: this.projectId, auth: e, useOnCloseEvent: !0, bundleId: this.bundleId }))), this.registerProviderListeners(); } async recordMessageEvent(e) { const { topic: r, message: n } = e; @@ -19621,7 +19629,7 @@ class HV extends D$ { } async onProviderPayload(e) { if (this.logger.debug("Incoming Relay Payload"), this.logger.trace({ type: "payload", direction: "incoming", payload: e }), Ab(e)) { - if (!e.method.endsWith(BH)) return; + if (!e.method.endsWith(FH)) return; const r = e.params, { topic: n, message: i, publishedAt: s, attestation: o } = r.data, a = { topic: n, message: i, publishedAt: s, transportType: zr.relay, attestation: o }; this.logger.debug("Emitting Relayer Payload"), this.logger.trace(U3({ type: "event", event: r.id }, a)), this.events.emit(r.id, a), await this.acknowledgePayload(e), await this.onMessageEvent(a); } else bp(e) && this.events.emit(ai.message_ack, e); @@ -19638,14 +19646,14 @@ class HV extends D$ { } async registerEventListeners() { let e = await x3(); - eH(async (r) => { + tH(async (r) => { e !== r && (e = r, r ? await this.restartTransport().catch((n) => this.logger.error(n)) : (this.hasExperiencedNetworkDisruption = !0, await this.transportDisconnect(), this.transportExplicitlyClosed = !1)); }); } async onProviderDisconnect() { await this.subscriber.stop(), this.requestsInFlight.clear(), clearTimeout(this.pingTimeout), this.events.emit(ai.disconnect), this.connectionAttemptInProgress = !1, !this.transportExplicitlyClosed && (this.reconnectTimeout || (this.reconnectTimeout = setTimeout(async () => { await this.transportOpen().catch((e) => this.logger.error(e)); - }, vt.toMiliseconds(FH)))); + }, vt.toMiliseconds(jH)))); } isInitialized() { if (!this.initialized) { @@ -19661,20 +19669,20 @@ class HV extends D$ { }), await this.transportOpen()); } } -var KV = Object.defineProperty, q3 = Object.getOwnPropertySymbols, VV = Object.prototype.hasOwnProperty, GV = Object.prototype.propertyIsEnumerable, z3 = (t, e, r) => e in t ? KV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, W3 = (t, e) => { - for (var r in e || (e = {})) VV.call(e, r) && z3(t, r, e[r]); - if (q3) for (var r of q3(e)) GV.call(e, r) && z3(t, r, e[r]); +var VV = Object.defineProperty, q3 = Object.getOwnPropertySymbols, GV = Object.prototype.hasOwnProperty, YV = Object.prototype.propertyIsEnumerable, z3 = (t, e, r) => e in t ? VV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, W3 = (t, e) => { + for (var r in e || (e = {})) GV.call(e, r) && z3(t, r, e[r]); + if (q3) for (var r of q3(e)) YV.call(e, r) && z3(t, r, e[r]); return t; }; -class Oc extends O$ { +class Oc extends N$ { constructor(e, r, n, i = ro, s = void 0) { - super(e, r, n, i), this.core = e, this.logger = r, this.name = n, this.map = /* @__PURE__ */ new Map(), this.version = jH, this.cached = [], this.initialized = !1, this.storagePrefix = ro, this.recentlyDeleted = [], this.recentlyDeletedLimit = 200, this.init = async () => { + super(e, r, n, i), this.core = e, this.logger = r, this.name = n, this.map = /* @__PURE__ */ new Map(), this.version = UH, this.cached = [], this.initialized = !1, this.storagePrefix = ro, this.recentlyDeleted = [], this.recentlyDeletedLimit = 200, this.init = async () => { this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((o) => { - this.getKey && o !== null && !vi(o) ? this.map.set(this.getKey(o), o) : RW(o) ? this.map.set(o.id, o) : DW(o) && this.map.set(o.topic, o); + this.getKey && o !== null && !vi(o) ? this.map.set(this.getKey(o), o) : DW(o) ? this.map.set(o.id, o) : OW(o) && this.map.set(o.topic, o); }), this.cached = [], this.initialized = !0); }, this.set = async (o, a) => { this.isInitialized(), this.map.has(o) ? await this.update(o, a) : (this.logger.debug("Setting value"), this.logger.trace({ type: "method", method: "set", key: o, value: a }), this.map.set(o, a), await this.persist()); - }, this.get = (o) => (this.isInitialized(), this.logger.debug("Getting value"), this.logger.trace({ type: "method", method: "get", key: o }), this.getData(o)), this.getAll = (o) => (this.isInitialized(), o ? this.values.filter((a) => Object.keys(o).every((u) => AH(a[u], o[u]))) : this.values), this.update = async (o, a) => { + }, this.get = (o) => (this.isInitialized(), this.logger.debug("Getting value"), this.logger.trace({ type: "method", method: "get", key: o }), this.getData(o)), this.getAll = (o) => (this.isInitialized(), o ? this.values.filter((a) => Object.keys(o).every((u) => PH(a[u], o[u]))) : this.values), this.update = async (o, a) => { this.isInitialized(), this.logger.debug("Updating value"), this.logger.trace({ type: "method", method: "update", key: o, update: a }); const u = W3(W3({}, this.getData(o)), a); this.map.set(o, u), await this.persist(); @@ -19741,9 +19749,9 @@ class Oc extends O$ { } } } -class YV { +class JV { constructor(e, r) { - this.core = e, this.logger = r, this.name = HH, this.version = KH, this.events = new Xv(), this.initialized = !1, this.storagePrefix = ro, this.ignoredPayloadTypes = [Oo], this.registeredMethods = [], this.init = async () => { + this.core = e, this.logger = r, this.name = KH, this.version = VH, this.events = new Xv(), this.initialized = !1, this.storagePrefix = ro, this.ignoredPayloadTypes = [Oo], this.registeredMethods = [], this.init = async () => { this.initialized || (await this.pairings.init(), await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.initialized = !0, this.logger.trace("Initialized")); }, this.register = ({ methods: n }) => { this.isInitialized(), this.registeredMethods = [.../* @__PURE__ */ new Set([...this.registeredMethods, ...n])]; @@ -19801,13 +19809,13 @@ class YV { const { topic: i, relay: s, expiry: o, methods: a } = n, u = this.core.crypto.keychain.get(i); return g3({ protocol: this.core.protocol, version: this.core.version, topic: i, symKey: u, relay: s, expiryTimestamp: o, methods: a }); }, this.sendRequest = async (n, i, s) => { - const o = ga(i, s), a = await this.core.crypto.encode(n, o), u = Nf[i].req; + const o = ga(i, s), a = await this.core.crypto.encode(n, o), u = Lf[i].req; return this.core.history.set(n, o), this.core.relayer.publish(n, a, u), o.id; }, this.sendResult = async (n, i, s) => { - const o = mp(n, s), a = await this.core.crypto.encode(i, o), u = await this.core.history.get(i, n), l = Nf[u.request.method].res; + const o = mp(n, s), a = await this.core.crypto.encode(i, o), u = await this.core.history.get(i, n), l = Lf[u.request.method].res; await this.core.relayer.publish(i, a, l), await this.core.history.resolve(o); }, this.sendError = async (n, i, s) => { - const o = vp(n, s), a = await this.core.crypto.encode(i, o), u = await this.core.history.get(i, n), l = Nf[u.request.method] ? Nf[u.request.method].res : Nf.unregistered_method.res; + const o = vp(n, s), a = await this.core.crypto.encode(i, o), u = await this.core.history.get(i, n), l = Lf[u.request.method] ? Lf[u.request.method].res : Lf.unregistered_method.res; await this.core.relayer.publish(i, a, l), await this.core.history.resolve(o); }, this.deletePairing = async (n, i) => { await this.core.relayer.unsubscribe(n), await Promise.all([this.pairings.delete(n, Or("USER_DISCONNECTED")), this.core.crypto.deleteSymKey(n), i ? Promise.resolve() : this.core.expirer.del(n)]); @@ -19868,7 +19876,7 @@ class YV { const { message: a } = ft("MISSING_OR_INVALID", `pair() params: ${n}`); throw i.setError(So.malformed_pairing_uri), new Error(a); } - if (!TW(n.uri)) { + if (!RW(n.uri)) { const { message: a } = ft("MISSING_OR_INVALID", `pair() uri: ${n.uri}`); throw i.setError(So.malformed_pairing_uri), new Error(a); } @@ -19944,9 +19952,9 @@ class YV { }); } } -class JV extends C$ { +class XV extends T$ { constructor(e, r) { - super(e, r), this.core = e, this.logger = r, this.records = /* @__PURE__ */ new Map(), this.events = new is.EventEmitter(), this.name = VH, this.version = GH, this.cached = [], this.initialized = !1, this.storagePrefix = ro, this.init = async () => { + super(e, r), this.core = e, this.logger = r, this.records = /* @__PURE__ */ new Map(), this.events = new is.EventEmitter(), this.name = GH, this.version = YH, this.cached = [], this.initialized = !1, this.storagePrefix = ro, this.init = async () => { this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((n) => this.records.set(n.id, n)), this.cached = [], this.registerEventListeners(), this.initialized = !0); }, this.set = (n, i, s) => { if (this.isInitialized(), this.logger.debug("Setting JSON-RPC request history record"), this.logger.trace({ type: "method", method: "set", topic: n, request: i, chainId: s }), this.records.has(i.id)) return; @@ -20037,7 +20045,7 @@ class JV extends C$ { }), this.events.on(ys.deleted, (e) => { const r = ys.deleted; this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, record: e }); - }), this.core.heartbeat.on(ju.pulse, () => { + }), this.core.heartbeat.on(Uu.pulse, () => { this.cleanup(); }); } @@ -20059,9 +20067,9 @@ class JV extends C$ { } } } -class XV extends L$ { +class ZV extends k$ { constructor(e, r) { - super(e, r), this.core = e, this.logger = r, this.expirations = /* @__PURE__ */ new Map(), this.events = new is.EventEmitter(), this.name = YH, this.version = JH, this.cached = [], this.initialized = !1, this.storagePrefix = ro, this.init = async () => { + super(e, r), this.core = e, this.logger = r, this.expirations = /* @__PURE__ */ new Map(), this.events = new is.EventEmitter(), this.name = JH, this.version = XH, this.cached = [], this.initialized = !1, this.storagePrefix = ro, this.init = async () => { this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((n) => this.expirations.set(n.target, n)), this.cached = [], this.registerEventListeners(), this.initialized = !0); }, this.has = (n) => { try { @@ -20109,8 +20117,8 @@ class XV extends L$ { return Array.from(this.expirations.values()); } formatTarget(e) { - if (typeof e == "string") return Sz(e); - if (typeof e == "number") return Az(e); + if (typeof e == "string") return Az(e); + if (typeof e == "number") return Pz(e); const { message: r } = ft("UNKNOWN_TYPE", `Target type: ${typeof e}`); throw new Error(r); } @@ -20155,7 +20163,7 @@ class XV extends L$ { this.core.relayer.connected && this.expirations.forEach((e, r) => this.checkExpiry(r, e)); } registerEventListeners() { - this.core.heartbeat.on(ju.pulse, () => this.checkExpirations()), this.events.on(Zi.created, (e) => { + this.core.heartbeat.on(Uu.pulse, () => this.checkExpirations()), this.events.on(Zi.created, (e) => { const r = Zi.created; this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), this.persist(); }), this.events.on(Zi.expired, (e) => { @@ -20173,9 +20181,9 @@ class XV extends L$ { } } } -class ZV extends k$ { +class QV extends $$ { constructor(e, r, n) { - super(e, r, n), this.core = e, this.logger = r, this.store = n, this.name = XH, this.verifyUrlV3 = QH, this.storagePrefix = ro, this.version = TE, this.init = async () => { + super(e, r, n), this.core = e, this.logger = r, this.store = n, this.name = ZH, this.verifyUrlV3 = eK, this.storagePrefix = ro, this.version = TE, this.init = async () => { var i; this.isDevEnv || (this.publicKey = await this.store.getItem(this.storeKey), this.publicKey && vt.toMiliseconds((i = this.publicKey) == null ? void 0 : i.expiresAt) < Date.now() && (this.logger.debug("verify v2 public key expired"), await this.removePublicKey())); }, this.register = async (i) => { @@ -20233,8 +20241,8 @@ class ZV extends k$ { const o = this.startAbortTimer(vt.ONE_SECOND * 5), a = await fetch(`${s}/attestation/${i}?v2Supported=true`, { signal: this.abortController.signal }); return clearTimeout(o), a.status === 200 ? await a.json() : void 0; }, this.getVerifyUrl = (i) => { - let s = i || Xf; - return eK.includes(s) || (this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Xf}`), s = Xf), s; + let s = i || Zf; + return tK.includes(s) || (this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Zf}`), s = Zf), s; }, this.fetchPublicKey = async () => { try { this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`); @@ -20269,7 +20277,7 @@ class ZV extends k$ { const i = await this.fetchPromise; return this.fetchPromise = void 0, i; }, this.validateAttestation = (i, s) => { - const o = lW(i, s.publicKey), a = { hasExpired: vt.toMiliseconds(o.exp) < Date.now(), payload: o }; + const o = hW(i, s.publicKey), a = { hasExpired: vt.toMiliseconds(o.exp) < Date.now(), payload: o }; if (a.hasExpired) throw this.logger.warn("resolve: jwt attestation expired"), new Error("JWT attestation expired"); return { origin: a.payload.origin, isScam: a.payload.isScam, isVerified: a.payload.isVerified }; }, this.logger = ui(r, this.name), this.abortController = new AbortController(), this.isDevEnv = yb(), this.init(); @@ -20284,22 +20292,22 @@ class ZV extends k$ { return this.abortController = new AbortController(), setTimeout(() => this.abortController.abort(), vt.toMiliseconds(e)); } } -class QV extends $$ { +class eG extends B$ { constructor(e, r) { - super(e, r), this.projectId = e, this.logger = r, this.context = tK, this.registerDeviceToken = async (n) => { - const { clientId: i, token: s, notificationType: o, enableEncrypted: a = !1 } = n, u = `${rK}/${this.projectId}/clients`; + super(e, r), this.projectId = e, this.logger = r, this.context = rK, this.registerDeviceToken = async (n) => { + const { clientId: i, token: s, notificationType: o, enableEncrypted: a = !1 } = n, u = `${nK}/${this.projectId}/clients`; await fetch(u, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ client_id: i, type: o, token: s, always_raw: a }) }); }, this.logger = ui(r, this.context); } } -var eG = Object.defineProperty, H3 = Object.getOwnPropertySymbols, tG = Object.prototype.hasOwnProperty, rG = Object.prototype.propertyIsEnumerable, K3 = (t, e, r) => e in t ? eG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, $f = (t, e) => { - for (var r in e || (e = {})) tG.call(e, r) && K3(t, r, e[r]); - if (H3) for (var r of H3(e)) rG.call(e, r) && K3(t, r, e[r]); +var tG = Object.defineProperty, H3 = Object.getOwnPropertySymbols, rG = Object.prototype.hasOwnProperty, nG = Object.prototype.propertyIsEnumerable, K3 = (t, e, r) => e in t ? tG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Bf = (t, e) => { + for (var r in e || (e = {})) rG.call(e, r) && K3(t, r, e[r]); + if (H3) for (var r of H3(e)) nG.call(e, r) && K3(t, r, e[r]); return t; }; -class nG extends B$ { +class iG extends F$ { constructor(e, r, n = !0) { - super(e, r, n), this.core = e, this.logger = r, this.context = iK, this.storagePrefix = ro, this.storageVersion = nK, this.events = /* @__PURE__ */ new Map(), this.shouldPersist = !1, this.init = async () => { + super(e, r, n), this.core = e, this.logger = r, this.context = sK, this.storagePrefix = ro, this.storageVersion = iK, this.events = /* @__PURE__ */ new Map(), this.shouldPersist = !1, this.init = async () => { if (!yb()) try { const i = { eventId: r3(), timestamp: Date.now(), domain: this.getAppDomain(), props: { event: "INIT", type: "", properties: { client_id: await this.core.crypto.getClientId(), user_agent: cE(this.core.relayer.protocol, this.core.relayer.version, K1) } } }; await this.sendEvent([i]); @@ -20307,20 +20315,20 @@ class nG extends B$ { this.logger.warn(i); } }, this.createEvent = (i) => { - const { event: s = "ERROR", type: o = "", properties: { topic: a, trace: u } } = i, l = r3(), d = this.core.projectId || "", p = Date.now(), w = $f({ eventId: l, timestamp: p, props: { event: s, type: o, properties: { topic: a, trace: u } }, bundleId: d, domain: this.getAppDomain() }, this.setMethods(l)); + const { event: s = "ERROR", type: o = "", properties: { topic: a, trace: u } } = i, l = r3(), d = this.core.projectId || "", p = Date.now(), w = Bf({ eventId: l, timestamp: p, props: { event: s, type: o, properties: { topic: a, trace: u } }, bundleId: d, domain: this.getAppDomain() }, this.setMethods(l)); return this.telemetryEnabled && (this.events.set(l, w), this.shouldPersist = !0), w; }, this.getEvent = (i) => { const { eventId: s, topic: o } = i; if (s) return this.events.get(s); const a = Array.from(this.events.values()).find((u) => u.props.properties.topic === o); - if (a) return $f($f({}, a), this.setMethods(a.eventId)); + if (a) return Bf(Bf({}, a), this.setMethods(a.eventId)); }, this.deleteEvent = (i) => { const { eventId: s } = i; this.events.delete(s), this.shouldPersist = !0; }, this.setEventListeners = () => { - this.core.heartbeat.on(ju.pulse, async () => { + this.core.heartbeat.on(Uu.pulse, async () => { this.shouldPersist && await this.persist(), this.events.forEach((i) => { - vt.fromMiliseconds(Date.now()) - vt.fromMiliseconds(i.timestamp) > sK && (this.events.delete(i.eventId), this.shouldPersist = !0); + vt.fromMiliseconds(Date.now()) - vt.fromMiliseconds(i.timestamp) > oK && (this.events.delete(i.eventId), this.shouldPersist = !0); }); }); }, this.setMethods = (i) => ({ addTrace: (s) => this.addTrace(i, s), setError: (s) => this.setError(i, s) }), this.addTrace = (i, s) => { @@ -20336,7 +20344,7 @@ class nG extends B$ { const i = await this.core.storage.getItem(this.storageKey) || []; if (!i.length) return; i.forEach((s) => { - this.events.set(s.eventId, $f($f({}, s), this.setMethods(s.eventId))); + this.events.set(s.eventId, Bf(Bf({}, s), this.setMethods(s.eventId))); }); } catch (i) { this.logger.warn(i); @@ -20352,7 +20360,7 @@ class nG extends B$ { } }, this.sendEvent = async (i) => { const s = this.getAppDomain() ? "" : "&sp=desktop"; - return await fetch(`${oK}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${K1}${s}`, { method: "POST", body: JSON.stringify(i) }); + return await fetch(`${aK}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${K1}${s}`, { method: "POST", body: JSON.stringify(i) }); }, this.getAppDomain = () => aE().url, this.logger = ui(r, this.context), this.telemetryEnabled = n, n ? this.restore().then(async () => { await this.submit(), this.setEventListeners(); }) : this.persist(); @@ -20361,12 +20369,12 @@ class nG extends B$ { return this.storagePrefix + this.storageVersion + this.core.customStoragePrefix + "//" + this.context; } } -var iG = Object.defineProperty, V3 = Object.getOwnPropertySymbols, sG = Object.prototype.hasOwnProperty, oG = Object.prototype.propertyIsEnumerable, G3 = (t, e, r) => e in t ? iG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Y3 = (t, e) => { - for (var r in e || (e = {})) sG.call(e, r) && G3(t, r, e[r]); - if (V3) for (var r of V3(e)) oG.call(e, r) && G3(t, r, e[r]); +var sG = Object.defineProperty, V3 = Object.getOwnPropertySymbols, oG = Object.prototype.hasOwnProperty, aG = Object.prototype.propertyIsEnumerable, G3 = (t, e, r) => e in t ? sG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Y3 = (t, e) => { + for (var r in e || (e = {})) oG.call(e, r) && G3(t, r, e[r]); + if (V3) for (var r of V3(e)) aG.call(e, r) && G3(t, r, e[r]); return t; }; -class Pb extends I$ { +class Pb extends C$ { constructor(e) { var r; super(e), this.protocol = CE, this.version = TE, this.name = RE, this.events = new is.EventEmitter(), this.initialized = !1, this.on = (o, a) => this.events.on(o, a), this.once = (o, a) => this.events.once(o, a), this.off = (o, a) => this.events.off(o, a), this.removeListener = (o, a) => this.events.removeListener(o, a), this.dispatchEnvelope = ({ topic: o, message: a, sessionExists: u }) => { @@ -20374,17 +20382,17 @@ class Pb extends I$ { const l = { topic: o, message: a, publishedAt: Date.now(), transportType: zr.link_mode }; this.relayer.onLinkMessageEvent(l, { sessionExists: u }); }, this.projectId = e == null ? void 0 : e.projectId, this.relayUrl = (e == null ? void 0 : e.relayUrl) || OE, this.customStoragePrefix = e != null && e.customStoragePrefix ? `:${e.customStoragePrefix}` : ""; - const n = X0({ level: typeof (e == null ? void 0 : e.logger) == "string" && e.logger ? e.logger : PH.logger }), { logger: i, chunkLoggerController: s } = M$({ opts: n, maxSizeInBytes: e == null ? void 0 : e.maxLogBlobSizeInBytes, loggerOverride: e == null ? void 0 : e.logger }); + const n = X0({ level: typeof (e == null ? void 0 : e.logger) == "string" && e.logger ? e.logger : MH.logger }), { logger: i, chunkLoggerController: s } = I$({ opts: n, maxSizeInBytes: e == null ? void 0 : e.maxLogBlobSizeInBytes, loggerOverride: e == null ? void 0 : e.logger }); this.logChunkController = s, (r = this.logChunkController) != null && r.downloadLogsBlobInBrowser && (window.downloadLogsBlobInBrowser = async () => { var o, a; (o = this.logChunkController) != null && o.downloadLogsBlobInBrowser && ((a = this.logChunkController) == null || a.downloadLogsBlobInBrowser({ clientId: await this.crypto.getClientId() })); - }), this.logger = ui(i, this.name), this.heartbeat = new xk(), this.crypto = new DV(this, this.logger, e == null ? void 0 : e.keychain), this.history = new JV(this, this.logger), this.expirer = new XV(this, this.logger), this.storage = e != null && e.storage ? e.storage : new Qk(Y3(Y3({}, MH), e == null ? void 0 : e.storageOptions)), this.relayer = new HV({ core: this, logger: this.logger, relayUrl: this.relayUrl, projectId: this.projectId }), this.pairing = new YV(this, this.logger), this.verify = new ZV(this, this.logger, this.storage), this.echoClient = new QV(this.projectId || "", this.logger), this.linkModeSupportedApps = [], this.eventClient = new nG(this, this.logger, e == null ? void 0 : e.telemetryEnabled); + }), this.logger = ui(i, this.name), this.heartbeat = new _k(), this.crypto = new OV(this, this.logger, e == null ? void 0 : e.keychain), this.history = new XV(this, this.logger), this.expirer = new ZV(this, this.logger), this.storage = e != null && e.storage ? e.storage : new e$(Y3(Y3({}, IH), e == null ? void 0 : e.storageOptions)), this.relayer = new KV({ core: this, logger: this.logger, relayUrl: this.relayUrl, projectId: this.projectId }), this.pairing = new JV(this, this.logger), this.verify = new QV(this, this.logger, this.storage), this.echoClient = new eG(this.projectId || "", this.logger), this.linkModeSupportedApps = [], this.eventClient = new iG(this, this.logger, e == null ? void 0 : e.telemetryEnabled); } static async init(e) { const r = new Pb(e); await r.initialize(); const n = await r.crypto.getClientId(); - return await r.storage.setItem(UH, n), r; + return await r.storage.setItem(qH, n), r; } get context() { return Pi(this.logger); @@ -20408,15 +20416,15 @@ class Pb extends I$ { } } } -const aG = Pb, HE = "wc", KE = 2, VE = "client", Mb = `${HE}@${KE}:${VE}:`, Tm = { name: VE, logger: "error" }, J3 = "WALLETCONNECT_DEEPLINK_CHOICE", cG = "proposal", GE = "Proposal expired", uG = "session", ru = vt.SEVEN_DAYS, fG = "engine", In = { wc_sessionPropose: { req: { ttl: vt.FIVE_MINUTES, prompt: !0, tag: 1100 }, res: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1101 }, reject: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1120 }, autoReject: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1121 } }, wc_sessionSettle: { req: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1102 }, res: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1103 } }, wc_sessionUpdate: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1104 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1105 } }, wc_sessionExtend: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1106 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1107 } }, wc_sessionRequest: { req: { ttl: vt.FIVE_MINUTES, prompt: !0, tag: 1108 }, res: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1109 } }, wc_sessionEvent: { req: { ttl: vt.FIVE_MINUTES, prompt: !0, tag: 1110 }, res: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1111 } }, wc_sessionDelete: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1112 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1113 } }, wc_sessionPing: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1114 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1115 } }, wc_sessionAuthenticate: { req: { ttl: vt.ONE_HOUR, prompt: !0, tag: 1116 }, res: { ttl: vt.ONE_HOUR, prompt: !1, tag: 1117 }, reject: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1118 }, autoReject: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1119 } } }, Rm = { min: vt.FIVE_MINUTES, max: vt.SEVEN_DAYS }, Fs = { idle: "IDLE", active: "ACTIVE" }, lG = "request", hG = ["wc_sessionPropose", "wc_sessionRequest", "wc_authRequest", "wc_sessionAuthenticate"], dG = "wc", pG = "auth", gG = "authKeys", mG = "pairingTopics", vG = "requests", wp = `${dG}@${1.5}:${pG}:`, zd = `${wp}:PUB_KEY`; -var bG = Object.defineProperty, yG = Object.defineProperties, wG = Object.getOwnPropertyDescriptors, X3 = Object.getOwnPropertySymbols, xG = Object.prototype.hasOwnProperty, _G = Object.prototype.propertyIsEnumerable, Z3 = (t, e, r) => e in t ? bG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, tn = (t, e) => { - for (var r in e || (e = {})) xG.call(e, r) && Z3(t, r, e[r]); - if (X3) for (var r of X3(e)) _G.call(e, r) && Z3(t, r, e[r]); +const cG = Pb, HE = "wc", KE = 2, VE = "client", Mb = `${HE}@${KE}:${VE}:`, Tm = { name: VE, logger: "error" }, J3 = "WALLETCONNECT_DEEPLINK_CHOICE", uG = "proposal", GE = "Proposal expired", fG = "session", ru = vt.SEVEN_DAYS, lG = "engine", In = { wc_sessionPropose: { req: { ttl: vt.FIVE_MINUTES, prompt: !0, tag: 1100 }, res: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1101 }, reject: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1120 }, autoReject: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1121 } }, wc_sessionSettle: { req: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1102 }, res: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1103 } }, wc_sessionUpdate: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1104 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1105 } }, wc_sessionExtend: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1106 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1107 } }, wc_sessionRequest: { req: { ttl: vt.FIVE_MINUTES, prompt: !0, tag: 1108 }, res: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1109 } }, wc_sessionEvent: { req: { ttl: vt.FIVE_MINUTES, prompt: !0, tag: 1110 }, res: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1111 } }, wc_sessionDelete: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1112 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1113 } }, wc_sessionPing: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1114 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1115 } }, wc_sessionAuthenticate: { req: { ttl: vt.ONE_HOUR, prompt: !0, tag: 1116 }, res: { ttl: vt.ONE_HOUR, prompt: !1, tag: 1117 }, reject: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1118 }, autoReject: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1119 } } }, Rm = { min: vt.FIVE_MINUTES, max: vt.SEVEN_DAYS }, Fs = { idle: "IDLE", active: "ACTIVE" }, hG = "request", dG = ["wc_sessionPropose", "wc_sessionRequest", "wc_authRequest", "wc_sessionAuthenticate"], pG = "wc", gG = "auth", mG = "authKeys", vG = "pairingTopics", bG = "requests", wp = `${pG}@${1.5}:${gG}:`, zd = `${wp}:PUB_KEY`; +var yG = Object.defineProperty, wG = Object.defineProperties, xG = Object.getOwnPropertyDescriptors, X3 = Object.getOwnPropertySymbols, _G = Object.prototype.hasOwnProperty, EG = Object.prototype.propertyIsEnumerable, Z3 = (t, e, r) => e in t ? yG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, tn = (t, e) => { + for (var r in e || (e = {})) _G.call(e, r) && Z3(t, r, e[r]); + if (X3) for (var r of X3(e)) EG.call(e, r) && Z3(t, r, e[r]); return t; -}, xs = (t, e) => yG(t, wG(e)); -class EG extends j$ { +}, xs = (t, e) => wG(t, xG(e)); +class SG extends U$ { constructor(e) { - super(e), this.name = fG, this.events = new Xv(), this.initialized = !1, this.requestQueue = { state: Fs.idle, queue: [] }, this.sessionRequestQueue = { state: Fs.idle, queue: [] }, this.requestQueueDelay = vt.ONE_SECOND, this.expectedPairingMethodMap = /* @__PURE__ */ new Map(), this.recentlyDeletedMap = /* @__PURE__ */ new Map(), this.recentlyDeletedLimit = 200, this.relayMessageCache = [], this.init = async () => { + super(e), this.name = lG, this.events = new Xv(), this.initialized = !1, this.requestQueue = { state: Fs.idle, queue: [] }, this.sessionRequestQueue = { state: Fs.idle, queue: [] }, this.requestQueueDelay = vt.ONE_SECOND, this.expectedPairingMethodMap = /* @__PURE__ */ new Map(), this.recentlyDeletedMap = /* @__PURE__ */ new Map(), this.recentlyDeletedLimit = 200, this.relayMessageCache = [], this.init = async () => { this.initialized || (await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.registerPairingEvents(), await this.registerLinkModeListeners(), this.client.core.pairing.register({ methods: Object.keys(In) }), this.initialized = !0, setTimeout(() => { this.sessionRequestQueue.queue = this.getPendingSessionRequests(), this.processSessionRequestQueue(); }, vt.toMiliseconds(this.requestQueueDelay))); @@ -20448,8 +20456,8 @@ class EG extends j$ { await this.client.session.set(V.topic, Q), await this.setExpiry(V.topic, V.expiry), l && await this.client.core.pairing.updateMetadata({ topic: l, metadata: V.peer.metadata }), this.cleanupDuplicatePairings(Q), B(Q); } }); - const q = await this.sendRequest({ topic: l, method: "wc_sessionPropose", params: O, throwOnFailedPublish: !0 }); - return await this.setProposal(q, tn({ id: q }, O)), { uri: d, approval: k }; + const W = await this.sendRequest({ topic: l, method: "wc_sessionPropose", params: O, throwOnFailedPublish: !0 }); + return await this.setProposal(W, tn({ id: W }, O)), { uri: d, approval: k }; }, this.pair = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); try { @@ -20480,7 +20488,7 @@ class EG extends j$ { const { pairingTopic: _, proposer: P, requiredNamespaces: O, optionalNamespaces: L } = w; let B = (i = this.client.core.eventClient) == null ? void 0 : i.getEvent({ topic: _ }); B || (B = (s = this.client.core.eventClient) == null ? void 0 : s.createEvent({ type: ws.session_approve_started, properties: { topic: _, trace: [ws.session_approve_started, ws.session_namespaces_validation_success] } })); - const k = await this.client.core.crypto.generateKeyPair(), q = P.publicKey, U = await this.client.core.crypto.generateSharedKey(k, q), V = tn(tn({ relay: { protocol: u ?? "irn" }, namespaces: l, controller: { publicKey: k, metadata: this.client.metadata }, expiry: Sn(ru) }, d && { sessionProperties: d }), p && { sessionConfig: p }), Q = zr.relay; + const k = await this.client.core.crypto.generateKeyPair(), W = P.publicKey, U = await this.client.core.crypto.generateSharedKey(k, W), V = tn(tn({ relay: { protocol: u ?? "irn" }, namespaces: l, controller: { publicKey: k, metadata: this.client.metadata }, expiry: Sn(ru) }, d && { sessionProperties: d }), p && { sessionConfig: p }), Q = zr.relay; B.addTrace(ws.subscribing_session_topic); try { await this.client.core.relayer.subscribe(U, { transportType: Q }); @@ -20560,8 +20568,8 @@ class EG extends j$ { }), new Promise(async (P) => { var O; if (!((O = a.sessionConfig) != null && O.disableDeepLink)) { - const L = await Iz(this.client.core.storage, J3); - await Pz({ id: u, topic: s, wcDeepLink: L }); + const L = await Cz(this.client.core.storage, J3); + await Mz({ id: u, topic: s, wcDeepLink: L }); } P(); }), d()]).then((P) => P[2]); @@ -20598,18 +20606,18 @@ class EG extends j$ { const { message: i } = ft("MISMATCHED_TOPIC", `Session or pairing topic not found: ${n}`); throw new Error(i); } - }, this.find = (r) => (this.isInitialized(), this.client.session.getAll().filter((n) => IW(n, r))), this.getPendingSessionRequests = () => this.client.pendingRequest.getAll(), this.authenticate = async (r, n) => { + }, this.find = (r) => (this.isInitialized(), this.client.session.getAll().filter((n) => CW(n, r))), this.getPendingSessionRequests = () => this.client.pendingRequest.getAll(), this.authenticate = async (r, n) => { var i; this.isInitialized(), this.isValidAuthenticate(r); const s = n && this.client.core.linkModeSupportedApps.includes(n) && ((i = this.client.metadata.redirect) == null ? void 0 : i.linkMode), o = s ? zr.link_mode : zr.relay; o === zr.relay && await this.confirmOnlineStateOrThrow(); - const { chains: a, statement: u = "", uri: l, domain: d, nonce: p, type: w, exp: _, nbf: P, methods: O = [], expiry: L } = r, B = [...r.resources || []], { topic: k, uri: q } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); - this.client.logger.info({ message: "Generated new pairing", pairing: { topic: k, uri: q } }); + const { chains: a, statement: u = "", uri: l, domain: d, nonce: p, type: w, exp: _, nbf: P, methods: O = [], expiry: L } = r, B = [...r.resources || []], { topic: k, uri: W } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); + this.client.logger.info({ message: "Generated new pairing", pairing: { topic: k, uri: W } }); const U = await this.client.core.crypto.generateKeyPair(), V = qd(U); if (await Promise.all([this.client.auth.authKeys.set(zd, { responseTopic: V, publicKey: U }), this.client.auth.pairingTopics.set(V, { topic: V, pairingTopic: k })]), await this.client.core.relayer.subscribe(V, { transportType: o }), this.client.logger.info(`sending request to new pairing topic: ${k}`), O.length > 0) { - const { namespace: E } = _u(a[0]); - let S = Yz(E, "request", O); - Ud(B) && (S = Xz(S, B.pop())), B.push(S); + const { namespace: E } = Eu(a[0]); + let S = Jz(E, "request", O); + Ud(B) && (S = Zz(S, B.pop())), B.push(S); } const Q = L && L > In.wc_sessionAuthenticate.req.ttl ? L : In.wc_sessionAuthenticate.req.ttl, R = { authPayload: { type: w ?? "caip122", chains: a, statement: u, aud: l, domain: d, version: "1", nonce: p, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: _, nbf: P, resources: B }, requester: { publicKey: U, metadata: this.client.metadata }, expiryTimestamp: Sn(Q) }, K = { eip155: { chains: a, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...O])], events: ["chainChanged", "accountsChanged"] } }, ge = { requiredNamespaces: {}, optionalNamespaces: K, relays: [{ protocol: "irn" }], pairingTopic: k, proposer: { publicKey: U, metadata: this.client.metadata }, expiryTimestamp: Sn(In.wc_sessionPropose.req.ttl) }, { done: Ee, resolve: Y, reject: A } = ec(Q, "Request expired"), m = async ({ error: E, session: S }) => { if (this.events.off(yr("session_request", g), f), E) A(E); @@ -20645,38 +20653,38 @@ class EG extends j$ { if (s) { const E = ga("wc_sessionAuthenticate", R, g); this.client.core.history.set(k, E); - const S = await this.client.core.crypto.encode("", E, { type: fh, encoding: Df }); + const S = await this.client.core.crypto.encode("", E, { type: fh, encoding: Of }); x = xd(n, k, S); } else await Promise.all([this.sendRequest({ topic: k, method: "wc_sessionAuthenticate", params: R, expiry: r.expiry, throwOnFailedPublish: !0, clientRpcId: g }), this.sendRequest({ topic: k, method: "wc_sessionPropose", params: ge, expiry: In.wc_sessionPropose.req.ttl, throwOnFailedPublish: !0, clientRpcId: b })]); } catch (E) { throw this.events.off(yr("session_connect"), m), this.events.off(yr("session_request", g), f), E; } - return await this.setProposal(b, tn({ id: b }, ge)), await this.setAuthRequest(g, { request: xs(tn({}, R), { verifyContext: {} }), pairingTopic: k, transportType: o }), { uri: x ?? q, response: Ee }; + return await this.setProposal(b, tn({ id: b }, ge)), await this.setAuthRequest(g, { request: xs(tn({}, R), { verifyContext: {} }), pairingTopic: k, transportType: o }), { uri: x ?? W, response: Ee }; }, this.approveSessionAuthenticate = async (r) => { const { id: n, auths: i } = r, s = this.client.core.eventClient.createEvent({ properties: { topic: n.toString(), trace: [Za.authenticated_session_approve_started] } }); try { this.isInitialized(); } catch (L) { - throw s.setError(Lf.no_internet_connection), L; + throw s.setError(kf.no_internet_connection), L; } const o = this.getPendingAuthRequest(n); - if (!o) throw s.setError(Lf.authenticated_session_pending_request_not_found), new Error(`Could not find pending auth request with id ${n}`); + if (!o) throw s.setError(kf.authenticated_session_pending_request_not_found), new Error(`Could not find pending auth request with id ${n}`); const a = o.transportType || zr.relay; a === zr.relay && await this.confirmOnlineStateOrThrow(); const u = o.requester.publicKey, l = await this.client.core.crypto.generateKeyPair(), d = qd(u), p = { type: Oo, receiverPublicKey: u, senderPublicKey: l }, w = [], _ = []; for (const L of i) { if (!await s3({ cacao: L, projectId: this.client.core.projectId })) { - s.setError(Lf.invalid_cacao); + s.setError(kf.invalid_cacao); const V = Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"); throw await this.sendError({ id: n, topic: d, error: V, encodeOpts: p }), new Error(V.message); } s.addTrace(Za.cacaos_verified); - const { p: B } = L, k = Ud(B.resources), q = [z1(B.iss)], U = x0(B.iss); + const { p: B } = L, k = Ud(B.resources), W = [z1(B.iss)], U = x0(B.iss); if (k) { const V = o3(k), Q = a3(k); - w.push(...V), q.push(...Q); + w.push(...V), W.push(...Q); } - for (const V of q) _.push(`${V}:${U}`); + for (const V of W) _.push(`${V}:${U}`); } const P = await this.client.core.crypto.generateSharedKey(l, u); s.addTrace(Za.create_authenticated_session_topic); @@ -20686,7 +20694,7 @@ class EG extends j$ { try { await this.client.core.relayer.subscribe(P, { transportType: a }); } catch (L) { - throw s.setError(Lf.subscribe_authenticated_session_topic_failure), L; + throw s.setError(kf.subscribe_authenticated_session_topic_failure), L; } s.addTrace(Za.subscribe_authenticated_session_topic_success), await this.client.session.set(P, O), s.addTrace(Za.store_authenticated_session), await this.client.core.pairing.updateMetadata({ topic: o.pairingTopic, metadata: o.requester.metadata }); } @@ -20694,7 +20702,7 @@ class EG extends j$ { try { await this.sendResult({ topic: d, id: n, result: { cacaos: i, responder: { publicKey: l, metadata: this.client.metadata } }, encodeOpts: p, throwOnFailedPublish: !0, appLink: this.getAppLinkIfEnabled(o.requester.metadata, a) }); } catch (L) { - throw s.setError(Lf.authenticated_session_approve_publish_failure), L; + throw s.setError(kf.authenticated_session_approve_publish_failure), L; } return await this.client.auth.requests.delete(n, { message: "fulfilled", code: 0 }), await this.client.core.pairing.activate({ topic: o.pairingTopic }), this.client.core.eventClient.deleteEvent({ eventId: s.eventId }), { session: O }; }, this.rejectSessionAuthenticate = async (r) => { @@ -20760,13 +20768,13 @@ class EG extends j$ { let w; const _ = !!d; try { - const L = _ ? Df : pa; + const L = _ ? Of : pa; w = await this.client.core.crypto.encode(n, p, { encoding: L }); } catch (L) { throw await this.cleanup(), this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`), L; } let P; - if (hG.includes(i)) { + if (dG.includes(i)) { const L = Ao(JSON.stringify(p)), B = Ao(w); P = await this.client.core.verify.register({ id: B, decryptedId: L }); } @@ -20784,7 +20792,7 @@ class EG extends j$ { let d; const p = u && typeof (global == null ? void 0 : global.Linking) < "u"; try { - const _ = p ? Df : pa; + const _ = p ? Of : pa; d = await this.client.core.crypto.encode(i, l, xs(tn({}, a || {}), { encoding: _ })); } catch (_) { throw await this.cleanup(), this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`), _; @@ -20808,7 +20816,7 @@ class EG extends j$ { let d; const p = u && typeof (global == null ? void 0 : global.Linking) < "u"; try { - const _ = p ? Df : pa; + const _ = p ? Of : pa; d = await this.client.core.crypto.encode(i, l, xs(tn({}, o || {}), { encoding: _ })); } catch (_) { throw await this.cleanup(), this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`), _; @@ -20951,16 +20959,16 @@ class EG extends j$ { }, this.onSessionUpdateRequest = async (r, n) => { const { params: i, id: s } = n; try { - const o = `${r}_session_update`, a = Of.get(o); + const o = `${r}_session_update`, a = Nf.get(o); if (a && this.isRequestOutOfSync(a, s)) { this.client.logger.info(`Discarding out of sync request - ${s}`), this.sendError({ id: s, topic: r, error: Or("INVALID_UPDATE_REQUEST") }); return; } this.isValidUpdate(tn({ topic: r }, i)); try { - Of.set(o, s), await this.client.session.update(r, { namespaces: i.namespaces }), await this.sendResult({ id: s, topic: r, result: !0, throwOnFailedPublish: !0 }); + Nf.set(o, s), await this.client.session.update(r, { namespaces: i.namespaces }), await this.sendResult({ id: s, topic: r, result: !0, throwOnFailedPublish: !0 }); } catch (u) { - throw Of.delete(o), u; + throw Nf.delete(o), u; } this.client.events.emit("session_update", { id: s, topic: r, params: i }); } catch (o) { @@ -21022,12 +21030,12 @@ class EG extends j$ { }, this.onSessionEventRequest = async (r, n) => { const { id: i, params: s } = n; try { - const o = `${r}_session_event_${s.event.name}`, a = Of.get(o); + const o = `${r}_session_event_${s.event.name}`, a = Nf.get(o); if (a && this.isRequestOutOfSync(a, i)) { this.client.logger.info(`Discarding out of sync request - ${i}`); return; } - this.isValidEmit(tn({ topic: r }, s)), this.client.events.emit("session_event", { id: i, topic: r, params: s }), Of.set(o, i); + this.isValidEmit(tn({ topic: r }, s)), this.client.events.emit("session_event", { id: i, topic: r, params: s }), Nf.set(o, i); } catch (o) { await this.sendError({ id: i, topic: r, error: o }), this.client.logger.error(o); } @@ -21085,13 +21093,13 @@ class EG extends j$ { throw new Error(u); } const { pairingTopic: n, requiredNamespaces: i, optionalNamespaces: s, sessionProperties: o, relays: a } = r; - if (vi(n) || await this.isValidPairingTopic(n), !jW(a)) { + if (vi(n) || await this.isValidPairingTopic(n), !UW(a)) { const { message: u } = ft("MISSING_OR_INVALID", `connect() relays: ${a}`); throw new Error(u); } !vi(i) && Ll(i) !== 0 && this.validateNamespaces(i, "requiredNamespaces"), !vi(s) && Ll(s) !== 0 && this.validateNamespaces(s, "optionalNamespaces"), vi(o) || this.validateSessionProps(o, "sessionProperties"); }, this.validateNamespaces = (r, n) => { - const i = FW(r, "connect()", n); + const i = jW(r, "connect()", n); if (i) throw new Error(i.message); }, this.isValidApprove = async (r) => { if (!mi(r)) throw new Error(ft("MISSING_OR_INVALID", `approve() params: ${r}`).message); @@ -21112,7 +21120,7 @@ class EG extends j$ { throw new Error(s); } const { id: n, reason: i } = r; - if (this.checkRecentlyDeleted(n), await this.isValidProposalId(n), !qW(i)) { + if (this.checkRecentlyDeleted(n), await this.isValidProposalId(n), !zW(i)) { const { message: s } = ft("MISSING_OR_INVALID", `reject() reason: ${JSON.stringify(i)}`); throw new Error(s); } @@ -21126,7 +21134,7 @@ class EG extends j$ { const { message: l } = ft("MISSING_OR_INVALID", "onSessionSettleRequest() relay protocol should be a string"); throw new Error(l); } - const a = OW(i, "onSessionSettleRequest()"); + const a = NW(i, "onSessionSettleRequest()"); if (a) throw new Error(a.message); const u = Pm(s, "onSessionSettleRequest()"); if (u) throw new Error(u.message); @@ -21164,15 +21172,15 @@ class EG extends j$ { const { message: u } = ft("MISSING_OR_INVALID", `request() chainId: ${s}`); throw new Error(u); } - if (!zW(i)) { + if (!WW(i)) { const { message: u } = ft("MISSING_OR_INVALID", `request() ${JSON.stringify(i)}`); throw new Error(u); } - if (!KW(a, s, i.method)) { + if (!VW(a, s, i.method)) { const { message: u } = ft("MISSING_OR_INVALID", `request() method: ${i.method}`); throw new Error(u); } - if (o && !JW(o, Rm)) { + if (o && !XW(o, Rm)) { const { message: u } = ft("MISSING_OR_INVALID", `request() expiry: ${o}. Expiry must be a number (in seconds) between ${Rm.min} and ${Rm.max}`); throw new Error(u); } @@ -21188,7 +21196,7 @@ class EG extends j$ { } catch (o) { throw (n = r == null ? void 0 : r.response) != null && n.id && this.cleanupAfterResponse(r), o; } - if (!WW(s)) { + if (!HW(s)) { const { message: o } = ft("MISSING_OR_INVALID", `respond() response: ${JSON.stringify(s)}`); throw new Error(o); } @@ -21211,11 +21219,11 @@ class EG extends j$ { const { message: a } = ft("MISSING_OR_INVALID", `emit() chainId: ${s}`); throw new Error(a); } - if (!HW(i)) { + if (!KW(i)) { const { message: a } = ft("MISSING_OR_INVALID", `emit() event: ${JSON.stringify(i)}`); throw new Error(a); } - if (!VW(o, s, i.name)) { + if (!GW(o, s, i.name)) { const { message: a } = ft("MISSING_OR_INVALID", `emit() event: ${JSON.stringify(i)}`); throw new Error(a); } @@ -21232,11 +21240,11 @@ class EG extends j$ { if (!dn(i, !1)) throw new Error("uri is required parameter"); if (!dn(s, !1)) throw new Error("domain is required parameter"); if (!dn(o, !1)) throw new Error("nonce is required parameter"); - if ([...new Set(n.map((u) => _u(u).namespace))].length > 1) throw new Error("Multi-namespace requests are not supported. Please request single namespace only."); - const { namespace: a } = _u(n[0]); + if ([...new Set(n.map((u) => Eu(u).namespace))].length > 1) throw new Error("Multi-namespace requests are not supported. Please request single namespace only."); + const { namespace: a } = Eu(n[0]); if (a !== "eip155") throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains."); }, this.getVerifyContext = async (r) => { - const { attestationId: n, hash: i, encryptedId: s, metadata: o, transportType: a } = r, u = { verified: { verifyUrl: o.verifyUrl || Xf, validation: "UNKNOWN", origin: o.url || "" } }; + const { attestationId: n, hash: i, encryptedId: s, metadata: o, transportType: a } = r, u = { verified: { verifyUrl: o.verifyUrl || Zf, validation: "UNKNOWN", origin: o.url || "" } }; try { if (a === zr.link_mode) { const d = this.getAppLinkIfEnabled(o, a); @@ -21285,7 +21293,7 @@ class EG extends j$ { s && this.client.session.update(n, { transportType: zr.link_mode }), this.client.core.dispatchEnvelope({ topic: n, message: i, sessionExists: s }); }, this.registerLinkModeListeners = async () => { var r; - if (yb() || Yu() && (r = this.client.metadata.redirect) != null && r.linkMode) { + if (yb() || Ju() && (r = this.client.metadata.redirect) != null && r.linkMode) { const n = global == null ? void 0 : global.Linking; if (typeof n < "u") { n.addEventListener("url", this.handleLinkModeMessage, this.client.name); @@ -21312,7 +21320,7 @@ class EG extends j$ { }); } async onRelayMessage(e) { - const { topic: r, message: n, attestation: i, transportType: s } = e, { publicKey: o } = this.client.auth.authKeys.keys.includes(zd) ? this.client.auth.authKeys.get(zd) : { publicKey: void 0 }, a = await this.client.core.crypto.decode(r, n, { receiverPublicKey: o, encoding: s === zr.link_mode ? Df : pa }); + const { topic: r, message: n, attestation: i, transportType: s } = e, { publicKey: o } = this.client.auth.authKeys.keys.includes(zd) ? this.client.auth.authKeys.get(zd) : { publicKey: void 0 }, a = await this.client.core.crypto.decode(r, n, { receiverPublicKey: o, encoding: s === zr.link_mode ? Of : pa }); try { Ab(a) ? (this.client.core.history.set(r, a), this.onRelayEventRequest({ topic: r, payload: a, attestation: i, transportType: s, encryptedId: Ao(n) })) : bp(a) ? (await this.client.core.history.resolve(a), await this.onRelayEventResponse({ topic: r, payload: a, transportType: s }), this.client.core.history.delete(r, a.id)) : this.onRelayEventUnknownPayload({ topic: r, payload: a, transportType: s }); } catch (u) { @@ -21377,7 +21385,7 @@ class EG extends j$ { } } async isValidProposalId(e) { - if (!UW(e)) { + if (!qW(e)) { const { message: r } = ft("MISSING_OR_INVALID", `proposal id should be a number: ${e}`); throw new Error(r); } @@ -21392,45 +21400,45 @@ class EG extends j$ { } } } -class SG extends Oc { +class AG extends Oc { constructor(e, r) { - super(e, r, cG, Mb), this.core = e, this.logger = r; + super(e, r, uG, Mb), this.core = e, this.logger = r; } } -let AG = class extends Oc { +let PG = class extends Oc { constructor(e, r) { - super(e, r, uG, Mb), this.core = e, this.logger = r; + super(e, r, fG, Mb), this.core = e, this.logger = r; } }; -class PG extends Oc { - constructor(e, r) { - super(e, r, lG, Mb, (n) => n.id), this.core = e, this.logger = r; - } -} class MG extends Oc { constructor(e, r) { - super(e, r, gG, wp, () => zd), this.core = e, this.logger = r; + super(e, r, hG, Mb, (n) => n.id), this.core = e, this.logger = r; } } class IG extends Oc { constructor(e, r) { - super(e, r, mG, wp), this.core = e, this.logger = r; + super(e, r, mG, wp, () => zd), this.core = e, this.logger = r; } } class CG extends Oc { constructor(e, r) { - super(e, r, vG, wp, (n) => n.id), this.core = e, this.logger = r; + super(e, r, vG, wp), this.core = e, this.logger = r; } } -class TG { +class TG extends Oc { constructor(e, r) { - this.core = e, this.logger = r, this.authKeys = new MG(this.core, this.logger), this.pairingTopics = new IG(this.core, this.logger), this.requests = new CG(this.core, this.logger); + super(e, r, bG, wp, (n) => n.id), this.core = e, this.logger = r; + } +} +class RG { + constructor(e, r) { + this.core = e, this.logger = r, this.authKeys = new IG(this.core, this.logger), this.pairingTopics = new CG(this.core, this.logger), this.requests = new TG(this.core, this.logger); } async init() { await this.authKeys.init(), await this.pairingTopics.init(), await this.requests.init(); } } -class Ib extends F$ { +class Ib extends j$ { constructor(e) { super(e), this.protocol = HE, this.version = KE, this.name = Tm.name, this.events = new is.EventEmitter(), this.on = (n, i) => this.events.on(n, i), this.once = (n, i) => this.events.once(n, i), this.off = (n, i) => this.events.off(n, i), this.removeListener = (n, i) => this.events.removeListener(n, i), this.removeAllListeners = (n) => this.events.removeAllListeners(n), this.connect = async (n) => { try { @@ -21536,7 +21544,7 @@ class Ib extends F$ { } }, this.name = (e == null ? void 0 : e.name) || Tm.name, this.metadata = (e == null ? void 0 : e.metadata) || aE(), this.signConfig = e == null ? void 0 : e.signConfig; const r = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : Xl(X0({ level: (e == null ? void 0 : e.logger) || Tm.logger })); - this.core = (e == null ? void 0 : e.core) || new aG(e), this.logger = ui(r, this.name), this.session = new AG(this.core, this.logger), this.proposal = new SG(this.core, this.logger), this.pendingRequest = new PG(this.core, this.logger), this.engine = new EG(this), this.auth = new TG(this.core, this.logger); + this.core = (e == null ? void 0 : e.core) || new cG(e), this.logger = ui(r, this.name), this.session = new PG(this.core, this.logger), this.proposal = new AG(this.core, this.logger), this.pendingRequest = new MG(this.core, this.logger), this.engine = new SG(this), this.auth = new RG(this.core, this.logger); } static async init(e) { const r = new Ib(e); @@ -21569,17 +21577,17 @@ var S0 = { exports: {} }; S0.exports; (function(t, e) { (function() { - var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", u = "__lodash_hash_undefined__", l = 500, d = "__lodash_placeholder__", p = 1, w = 2, _ = 4, P = 1, O = 2, L = 1, B = 2, k = 4, q = 8, U = 16, V = 32, Q = 64, R = 128, K = 256, ge = 512, Ee = 30, Y = "...", A = 800, m = 16, f = 1, g = 2, b = 3, x = 1 / 0, E = 9007199254740991, S = 17976931348623157e292, v = NaN, M = 4294967295, I = M - 1, F = M >>> 1, ce = [ + var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", u = "__lodash_hash_undefined__", l = 500, d = "__lodash_placeholder__", p = 1, w = 2, _ = 4, P = 1, O = 2, L = 1, B = 2, k = 4, W = 8, U = 16, V = 32, Q = 64, R = 128, K = 256, ge = 512, Ee = 30, Y = "...", A = 800, m = 16, f = 1, g = 2, b = 3, x = 1 / 0, E = 9007199254740991, S = 17976931348623157e292, v = NaN, M = 4294967295, I = M - 1, F = M >>> 1, ce = [ ["ary", R], ["bind", L], ["bindKey", B], - ["curry", q], + ["curry", W], ["curryRight", U], ["flip", ge], ["partial", V], ["partialRight", Q], ["rearg", K] - ], D = "[object Arguments]", oe = "[object Array]", Z = "[object AsyncFunction]", J = "[object Boolean]", ee = "[object Date]", T = "[object DOMException]", X = "[object Error]", re = "[object Function]", pe = "[object GeneratorFunction]", ie = "[object Map]", ue = "[object Number]", ve = "[object Null]", Pe = "[object Object]", De = "[object Promise]", Ce = "[object Proxy]", $e = "[object RegExp]", Me = "[object Set]", Ne = "[object String]", Ke = "[object Symbol]", Le = "[object Undefined]", qe = "[object WeakMap]", ze = "[object WeakSet]", _e = "[object ArrayBuffer]", Ze = "[object DataView]", at = "[object Float32Array]", ke = "[object Float64Array]", Qe = "[object Int8Array]", tt = "[object Int16Array]", Ye = "[object Int32Array]", dt = "[object Uint8Array]", lt = "[object Uint8ClampedArray]", ct = "[object Uint16Array]", qt = "[object Uint32Array]", Jt = /\b__p \+= '';/g, Et = /\b(__p \+=) '' \+/g, er = /(__e\(.*?\)|\b__t\)) \+\n'';/g, Xt = /&(?:amp|lt|gt|quot|#39);/g, Dt = /[&<>"']/g, kt = RegExp(Xt.source), Ct = RegExp(Dt.source), mt = /<%-([\s\S]+?)%>/g, Rt = /<%([\s\S]+?)%>/g, Nt = /<%=([\s\S]+?)%>/g, bt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $t = /^\w*$/, Ft = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, rt = /[\\^$.*+?()[\]{}|]/g, Bt = RegExp(rt.source), $ = /^\s+/, z = /\s/, H = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, C = /\{\n\/\* \[wrapped with (.+)\] \*/, G = /,? & /, j = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, se = /[()=,{}\[\]\/\s]/, de = /\\(\\)?/g, xe = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Te = /\w*$/, Re = /^[-+]0x[0-9a-f]+$/i, nt = /^0b[01]+$/i, je = /^\[object .+?Constructor\]$/, pt = /^0o[0-7]+$/i, it = /^(?:0|[1-9]\d*)$/, et = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, St = /($^)/, Tt = /['\n\r\u2028\u2029\\]/g, At = "\\ud800-\\udfff", _t = "\\u0300-\\u036f", ht = "\\ufe20-\\ufe2f", xt = "\\u20d0-\\u20ff", st = _t + ht + xt, yt = "\\u2700-\\u27bf", ut = "a-z\\xdf-\\xf6\\xf8-\\xff", ot = "\\xac\\xb1\\xd7\\xf7", Se = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Ae = "\\u2000-\\u206f", Ve = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Fe = "A-Z\\xc0-\\xd6\\xd8-\\xde", Ue = "\\ufe0e\\ufe0f", Je = ot + Se + Ae + Ve, Lt = "['’]", zt = "[" + At + "]", Zt = "[" + Je + "]", Wt = "[" + st + "]", he = "\\d+", rr = "[" + yt + "]", dr = "[" + ut + "]", pr = "[^" + At + Je + he + yt + ut + Fe + "]", Qt = "\\ud83c[\\udffb-\\udfff]", gr = "(?:" + Wt + "|" + Qt + ")", lr = "[^" + At + "]", Rr = "(?:\\ud83c[\\udde6-\\uddff]){2}", mr = "[\\ud800-\\udbff][\\udc00-\\udfff]", wr = "[" + Fe + "]", $r = "\\u200d", Br = "(?:" + dr + "|" + pr + ")", Ir = "(?:" + wr + "|" + pr + ")", nn = "(?:" + Lt + "(?:d|ll|m|re|s|t|ve))?", sn = "(?:" + Lt + "(?:D|LL|M|RE|S|T|VE))?", on = gr + "?", wh = "[" + Ue + "]?", Hp = "(?:" + $r + "(?:" + [lr, Rr, mr].join("|") + ")" + wh + on + ")*", ao = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", xh = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", _h = wh + on + Hp, $c = "(?:" + [rr, Rr, mr].join("|") + ")" + _h, Kp = "(?:" + [lr + Wt + "?", Wt, Rr, mr, zt].join("|") + ")", sf = RegExp(Lt, "g"), Vp = RegExp(Wt, "g"), Bc = RegExp(Qt + "(?=" + Qt + ")|" + Kp + _h, "g"), Eh = RegExp([ + ], D = "[object Arguments]", oe = "[object Array]", Z = "[object AsyncFunction]", J = "[object Boolean]", ee = "[object Date]", T = "[object DOMException]", X = "[object Error]", re = "[object Function]", pe = "[object GeneratorFunction]", ie = "[object Map]", ue = "[object Number]", ve = "[object Null]", Pe = "[object Object]", De = "[object Promise]", Ce = "[object Proxy]", $e = "[object RegExp]", Me = "[object Set]", Ne = "[object String]", Ke = "[object Symbol]", Le = "[object Undefined]", qe = "[object WeakMap]", ze = "[object WeakSet]", _e = "[object ArrayBuffer]", Ze = "[object DataView]", at = "[object Float32Array]", ke = "[object Float64Array]", Qe = "[object Int8Array]", tt = "[object Int16Array]", Ye = "[object Int32Array]", dt = "[object Uint8Array]", lt = "[object Uint8ClampedArray]", ct = "[object Uint16Array]", qt = "[object Uint32Array]", Jt = /\b__p \+= '';/g, Et = /\b(__p \+=) '' \+/g, er = /(__e\(.*?\)|\b__t\)) \+\n'';/g, Xt = /&(?:amp|lt|gt|quot|#39);/g, Dt = /[&<>"']/g, kt = RegExp(Xt.source), Ct = RegExp(Dt.source), mt = /<%-([\s\S]+?)%>/g, Rt = /<%([\s\S]+?)%>/g, Nt = /<%=([\s\S]+?)%>/g, bt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $t = /^\w*$/, Ft = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, rt = /[\\^$.*+?()[\]{}|]/g, Bt = RegExp(rt.source), $ = /^\s+/, q = /\s/, H = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, C = /\{\n\/\* \[wrapped with (.+)\] \*/, G = /,? & /, j = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, se = /[()=,{}\[\]\/\s]/, de = /\\(\\)?/g, xe = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Te = /\w*$/, Re = /^[-+]0x[0-9a-f]+$/i, nt = /^0b[01]+$/i, je = /^\[object .+?Constructor\]$/, pt = /^0o[0-7]+$/i, it = /^(?:0|[1-9]\d*)$/, et = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, St = /($^)/, Tt = /['\n\r\u2028\u2029\\]/g, At = "\\ud800-\\udfff", _t = "\\u0300-\\u036f", ht = "\\ufe20-\\ufe2f", xt = "\\u20d0-\\u20ff", st = _t + ht + xt, yt = "\\u2700-\\u27bf", ut = "a-z\\xdf-\\xf6\\xf8-\\xff", ot = "\\xac\\xb1\\xd7\\xf7", Se = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Ae = "\\u2000-\\u206f", Ve = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Fe = "A-Z\\xc0-\\xd6\\xd8-\\xde", Ue = "\\ufe0e\\ufe0f", Je = ot + Se + Ae + Ve, Lt = "['’]", zt = "[" + At + "]", Zt = "[" + Je + "]", Wt = "[" + st + "]", he = "\\d+", rr = "[" + yt + "]", dr = "[" + ut + "]", pr = "[^" + At + Je + he + yt + ut + Fe + "]", Qt = "\\ud83c[\\udffb-\\udfff]", gr = "(?:" + Wt + "|" + Qt + ")", lr = "[^" + At + "]", Rr = "(?:\\ud83c[\\udde6-\\uddff]){2}", mr = "[\\ud800-\\udbff][\\udc00-\\udfff]", wr = "[" + Fe + "]", $r = "\\u200d", Br = "(?:" + dr + "|" + pr + ")", Ir = "(?:" + wr + "|" + pr + ")", nn = "(?:" + Lt + "(?:d|ll|m|re|s|t|ve))?", sn = "(?:" + Lt + "(?:D|LL|M|RE|S|T|VE))?", on = gr + "?", wh = "[" + Ue + "]?", Hp = "(?:" + $r + "(?:" + [lr, Rr, mr].join("|") + ")" + wh + on + ")*", ao = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", xh = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", _h = wh + on + Hp, $c = "(?:" + [rr, Rr, mr].join("|") + ")" + _h, Kp = "(?:" + [lr + Wt + "?", Wt, Rr, mr, zt].join("|") + ")", of = RegExp(Lt, "g"), Vp = RegExp(Wt, "g"), Bc = RegExp(Qt + "(?=" + Qt + ")|" + Kp + _h, "g"), Eh = RegExp([ wr + "?" + dr + "+" + nn + "(?=" + [Zt, wr, "$"].join("|") + ")", Ir + "+" + sn + "(?=" + [Zt, wr + Br, "$"].join("|") + ")", wr + "?" + Br + "+" + nn, @@ -21841,7 +21849,7 @@ S0.exports; return be || bn && bn.binding && bn.binding("util"); } catch { } - }(), ri = Vr && Vr.isArrayBuffer, hs = Vr && Vr.isDate, Ui = Vr && Vr.isMap, Ds = Vr && Vr.isRegExp, of = Vr && Vr.isSet, Fa = Vr && Vr.isTypedArray; + }(), ri = Vr && Vr.isArrayBuffer, hs = Vr && Vr.isDate, Ui = Vr && Vr.isMap, Ds = Vr && Vr.isRegExp, af = Vr && Vr.isSet, Fa = Vr && Vr.isTypedArray; function Pn(be, Be, Ie) { switch (Ie.length) { case 0: @@ -22010,7 +22018,7 @@ S0.exports; return be[Ie]; }); } - function af(be, Be) { + function cf(be, Be) { return be.has(Be); } function Ly(be, Be) { @@ -22095,7 +22103,7 @@ S0.exports; return jc(be) ? ZA(be) : LA(be); } function By(be) { - for (var Be = be.length; Be-- && z.test(be.charAt(Be)); ) + for (var Be = be.length; Be-- && q.test(be.charAt(Be)); ) ; return Be; } @@ -22118,13 +22126,13 @@ S0.exports; return c ? "Symbol(src)_1." + c : ""; }(), Dh = zc.toString, iP = Rh.call(qr), sP = Er._, oP = ig( "^" + Rh.call(Tr).replace(rt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" - ), Oh = fi ? Be.Buffer : r, Yo = Be.Symbol, Nh = Be.Uint8Array, jy = Oh ? Oh.allocUnsafe : r, Lh = $y(qr.getPrototypeOf, qr), Uy = qr.create, qy = zc.propertyIsEnumerable, kh = Ch.splice, zy = Yo ? Yo.isConcatSpreadable : r, cf = Yo ? Yo.iterator : r, ja = Yo ? Yo.toStringTag : r, $h = function() { + ), Oh = fi ? Be.Buffer : r, Yo = Be.Symbol, Nh = Be.Uint8Array, jy = Oh ? Oh.allocUnsafe : r, Lh = $y(qr.getPrototypeOf, qr), Uy = qr.create, qy = zc.propertyIsEnumerable, kh = Ch.splice, zy = Yo ? Yo.isConcatSpreadable : r, uf = Yo ? Yo.iterator : r, ja = Yo ? Yo.toStringTag : r, $h = function() { try { var c = Ha(qr, "defineProperty"); return c({}, "", {}), c; } catch { } - }(), aP = Be.clearTimeout !== Er.clearTimeout && Be.clearTimeout, cP = It && It.now !== Er.Date.now && It.now, uP = Be.setTimeout !== Er.setTimeout && Be.setTimeout, Bh = _n.ceil, Fh = _n.floor, sg = qr.getOwnPropertySymbols, fP = Oh ? Oh.isBuffer : r, Wy = Be.isFinite, lP = Ch.join, hP = $y(qr.keys, qr), En = _n.max, Kn = _n.min, dP = It.now, pP = Be.parseInt, Hy = _n.random, gP = Ch.reverse, og = Ha(Be, "DataView"), uf = Ha(Be, "Map"), ag = Ha(Be, "Promise"), Wc = Ha(Be, "Set"), ff = Ha(Be, "WeakMap"), lf = Ha(qr, "create"), jh = ff && new ff(), Hc = {}, mP = Ka(og), vP = Ka(uf), bP = Ka(ag), yP = Ka(Wc), wP = Ka(ff), Uh = Yo ? Yo.prototype : r, hf = Uh ? Uh.valueOf : r, Ky = Uh ? Uh.toString : r; + }(), aP = Be.clearTimeout !== Er.clearTimeout && Be.clearTimeout, cP = It && It.now !== Er.Date.now && It.now, uP = Be.setTimeout !== Er.setTimeout && Be.setTimeout, Bh = _n.ceil, Fh = _n.floor, sg = qr.getOwnPropertySymbols, fP = Oh ? Oh.isBuffer : r, Wy = Be.isFinite, lP = Ch.join, hP = $y(qr.keys, qr), En = _n.max, Kn = _n.min, dP = It.now, pP = Be.parseInt, Hy = _n.random, gP = Ch.reverse, og = Ha(Be, "DataView"), ff = Ha(Be, "Map"), ag = Ha(Be, "Promise"), Wc = Ha(Be, "Set"), lf = Ha(Be, "WeakMap"), hf = Ha(qr, "create"), jh = lf && new lf(), Hc = {}, mP = Ka(og), vP = Ka(ff), bP = Ka(ag), yP = Ka(Wc), wP = Ka(lf), Uh = Yo ? Yo.prototype : r, df = Uh ? Uh.valueOf : r, Ky = Uh ? Uh.toString : r; function te(c) { if (en(c) && !ir(c) && !(c instanceof xr)) { if (c instanceof Wi) @@ -22213,8 +22221,8 @@ S0.exports; return c; } function EP() { - var c = this.__wrapped__.value(), h = this.__dir__, y = ir(c), N = h < 0, W = y ? c.length : 0, ne = LM(0, W, this.__views__), fe = ne.start, me = ne.end, we = me - fe, We = N ? me : fe - 1, He = this.__iteratees__, Xe = He.length, wt = 0, Ot = Kn(we, this.__takeCount__); - if (!y || !N && W == we && Ot == we) + var c = this.__wrapped__.value(), h = this.__dir__, y = ir(c), N = h < 0, z = y ? c.length : 0, ne = LM(0, z, this.__views__), fe = ne.start, me = ne.end, we = me - fe, We = N ? me : fe - 1, He = this.__iteratees__, Xe = He.length, wt = 0, Ot = Kn(we, this.__takeCount__); + if (!y || !N && z == we && Ot == we) return mw(c, this.__actions__); var Ht = []; e: @@ -22243,7 +22251,7 @@ S0.exports; } } function SP() { - this.__data__ = lf ? lf(null) : {}, this.size = 0; + this.__data__ = hf ? hf(null) : {}, this.size = 0; } function AP(c) { var h = this.has(c) && delete this.__data__[c]; @@ -22251,7 +22259,7 @@ S0.exports; } function PP(c) { var h = this.__data__; - if (lf) { + if (hf) { var y = h[c]; return y === u ? r : y; } @@ -22259,11 +22267,11 @@ S0.exports; } function MP(c) { var h = this.__data__; - return lf ? h[c] !== r : Tr.call(h, c); + return hf ? h[c] !== r : Tr.call(h, c); } function IP(c, h) { var y = this.__data__; - return this.size += this.has(c) ? 0 : 1, y[c] = lf && h === r ? u : h, this; + return this.size += this.has(c) ? 0 : 1, y[c] = hf && h === r ? u : h, this; } Ua.prototype.clear = SP, Ua.prototype.delete = AP, Ua.prototype.get = PP, Ua.prototype.has = MP, Ua.prototype.set = IP; function co(c) { @@ -22305,7 +22313,7 @@ S0.exports; function NP() { this.size = 0, this.__data__ = { hash: new Ua(), - map: new (uf || co)(), + map: new (ff || co)(), string: new Ua() }; } @@ -22357,7 +22365,7 @@ S0.exports; var y = this.__data__; if (y instanceof co) { var N = y.__data__; - if (!uf || N.length < i - 1) + if (!ff || N.length < i - 1) return N.push([c, h]), this.size = ++y.size, this; y = this.__data__ = new uo(N); } @@ -22365,11 +22373,11 @@ S0.exports; } ps.prototype.clear = UP, ps.prototype.delete = qP, ps.prototype.get = zP, ps.prototype.has = WP, ps.prototype.set = HP; function Vy(c, h) { - var y = ir(c), N = !y && Va(c), W = !y && !N && ea(c), ne = !y && !N && !W && Jc(c), fe = y || N || W || ne, me = fe ? tg(c.length, tP) : [], we = me.length; + var y = ir(c), N = !y && Va(c), z = !y && !N && ea(c), ne = !y && !N && !z && Jc(c), fe = y || N || z || ne, me = fe ? tg(c.length, tP) : [], we = me.length; for (var We in c) (h || Tr.call(c, We)) && !(fe && // Safari 9 has enumerable `arguments.length` in strict mode. (We == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. - W && (We == "offset" || We == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. + z && (We == "offset" || We == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. ne && (We == "buffer" || We == "byteLength" || We == "byteOffset") || // Skip index properties. po(We, we))) && me.push(We); return me; @@ -22387,7 +22395,7 @@ S0.exports; function cg(c, h, y) { (y !== r && !gs(c[h], y) || y === r && !(h in c)) && fo(c, h, y); } - function df(c, h, y) { + function pf(c, h, y) { var N = c[h]; (!(Tr.call(c, h) && gs(N, y)) || y === r && !(h in c)) && fo(c, h, y); } @@ -22398,8 +22406,8 @@ S0.exports; return -1; } function GP(c, h, y, N) { - return Jo(c, function(W, ne, fe) { - h(N, W, y(W), fe); + return Jo(c, function(z, ne, fe) { + h(N, z, y(z), fe); }), N; } function Yy(c, h) { @@ -22417,16 +22425,16 @@ S0.exports; }) : c[h] = y; } function ug(c, h) { - for (var y = -1, N = h.length, W = Ie(N), ne = c == null; ++y < N; ) - W[y] = ne ? r : zg(c, h[y]); - return W; + for (var y = -1, N = h.length, z = Ie(N), ne = c == null; ++y < N; ) + z[y] = ne ? r : zg(c, h[y]); + return z; } function za(c, h, y) { return c === c && (y !== r && (c = c <= y ? c : y), h !== r && (c = c >= h ? c : h)), c; } - function Hi(c, h, y, N, W, ne) { + function Hi(c, h, y, N, z, ne) { var fe, me = h & p, we = h & w, We = h & _; - if (y && (fe = W ? y(c, N, W, ne) : y(c)), fe !== r) + if (y && (fe = z ? y(c, N, z, ne) : y(c)), fe !== r) return fe; if (!Zr(c)) return c; @@ -22438,12 +22446,12 @@ S0.exports; var Xe = Vn(c), wt = Xe == re || Xe == pe; if (ea(c)) return yw(c, me); - if (Xe == Pe || Xe == D || wt && !W) { + if (Xe == Pe || Xe == D || wt && !z) { if (fe = we || wt ? {} : Bw(c), !me) return we ? PM(c, YP(fe, c)) : AM(c, Yy(fe, c)); } else { if (!Dr[Xe]) - return W ? c : {}; + return z ? c : {}; fe = BM(c, Xe, me); } } @@ -22458,7 +22466,7 @@ S0.exports; }); var Ht = We ? we ? Cg : Ig : we ? di : Mn, fr = He ? r : Ht(c); return qi(fr || c, function(Kt, br) { - fr && (br = Kt, Kt = c[br]), df(fe, br, Hi(Kt, h, y, br, c, ne)); + fr && (br = Kt, Kt = c[br]), pf(fe, br, Hi(Kt, h, y, br, c, ne)); }), fe; } function JP(c) { @@ -22472,8 +22480,8 @@ S0.exports; if (c == null) return !N; for (c = qr(c); N--; ) { - var W = y[N], ne = h[W], fe = c[W]; - if (fe === r && !(W in c) || !ne(fe)) + var z = y[N], ne = h[z], fe = c[z]; + if (fe === r && !(z in c) || !ne(fe)) return !1; } return !0; @@ -22481,18 +22489,18 @@ S0.exports; function Xy(c, h, y) { if (typeof c != "function") throw new zi(o); - return wf(function() { + return xf(function() { c.apply(r, y); }, h); } - function pf(c, h, y, N) { - var W = -1, ne = Ph, fe = !0, me = c.length, we = [], We = h.length; + function gf(c, h, y, N) { + var z = -1, ne = Ph, fe = !0, me = c.length, we = [], We = h.length; if (!me) return we; - y && (h = Xr(h, Mi(y))), N ? (ne = Yp, fe = !1) : h.length >= i && (ne = af, fe = !1, h = new qa(h)); + y && (h = Xr(h, Mi(y))), N ? (ne = Yp, fe = !1) : h.length >= i && (ne = cf, fe = !1, h = new qa(h)); e: - for (; ++W < me; ) { - var He = c[W], Xe = y == null ? He : y(He); + for (; ++z < me; ) { + var He = c[z], Xe = y == null ? He : y(He); if (He = N || He !== 0 ? He : 0, fe && Xe === Xe) { for (var wt = We; wt--; ) if (h[wt] === Xe) @@ -22505,12 +22513,12 @@ S0.exports; var Jo = Sw(Os), Zy = Sw(lg, !0); function XP(c, h) { var y = !0; - return Jo(c, function(N, W, ne) { - return y = !!h(N, W, ne), y; + return Jo(c, function(N, z, ne) { + return y = !!h(N, z, ne), y; }), y; } function Wh(c, h, y) { - for (var N = -1, W = c.length; ++N < W; ) { + for (var N = -1, z = c.length; ++N < z; ) { var ne = c[N], fe = h(ne); if (fe != null && (me === r ? fe === fe && !Ci(fe) : y(fe, me))) var me = fe, we = ne; @@ -22518,24 +22526,24 @@ S0.exports; return we; } function ZP(c, h, y, N) { - var W = c.length; - for (y = cr(y), y < 0 && (y = -y > W ? 0 : W + y), N = N === r || N > W ? W : cr(N), N < 0 && (N += W), N = y > N ? 0 : g2(N); y < N; ) + var z = c.length; + for (y = cr(y), y < 0 && (y = -y > z ? 0 : z + y), N = N === r || N > z ? z : cr(N), N < 0 && (N += z), N = y > N ? 0 : g2(N); y < N; ) c[y++] = h; return c; } function Qy(c, h) { var y = []; - return Jo(c, function(N, W, ne) { - h(N, W, ne) && y.push(N); + return Jo(c, function(N, z, ne) { + h(N, z, ne) && y.push(N); }), y; } - function Bn(c, h, y, N, W) { + function Bn(c, h, y, N, z) { var ne = -1, fe = c.length; - for (y || (y = jM), W || (W = []); ++ne < fe; ) { + for (y || (y = jM), z || (z = []); ++ne < fe; ) { var me = c[ne]; - h > 0 && y(me) ? h > 1 ? Bn(me, h - 1, y, N, W) : Vo(W, me) : N || (W[W.length] = me); + h > 0 && y(me) ? h > 1 ? Bn(me, h - 1, y, N, z) : Vo(z, me) : N || (z[z.length] = me); } - return W; + return z; } var fg = Aw(), ew = Aw(!0); function Os(c, h) { @@ -22575,19 +22583,19 @@ S0.exports; return c >= Kn(h, y) && c < En(h, y); } function dg(c, h, y) { - for (var N = y ? Yp : Ph, W = c[0].length, ne = c.length, fe = ne, me = Ie(ne), we = 1 / 0, We = []; fe--; ) { + for (var N = y ? Yp : Ph, z = c[0].length, ne = c.length, fe = ne, me = Ie(ne), we = 1 / 0, We = []; fe--; ) { var He = c[fe]; - fe && h && (He = Xr(He, Mi(h))), we = Kn(He.length, we), me[fe] = !y && (h || W >= 120 && He.length >= 120) ? new qa(fe && He) : r; + fe && h && (He = Xr(He, Mi(h))), we = Kn(He.length, we), me[fe] = !y && (h || z >= 120 && He.length >= 120) ? new qa(fe && He) : r; } He = c[0]; var Xe = -1, wt = me[0]; e: - for (; ++Xe < W && We.length < we; ) { + for (; ++Xe < z && We.length < we; ) { var Ot = He[Xe], Ht = h ? h(Ot) : Ot; - if (Ot = y || Ot !== 0 ? Ot : 0, !(wt ? af(wt, Ht) : N(We, Ht, y))) { + if (Ot = y || Ot !== 0 ? Ot : 0, !(wt ? cf(wt, Ht) : N(We, Ht, y))) { for (fe = ne; --fe; ) { var fr = me[fe]; - if (!(fr ? af(fr, Ht) : N(c[fe], Ht, y))) + if (!(fr ? cf(fr, Ht) : N(c[fe], Ht, y))) continue e; } wt && wt.push(Ht), We.push(Ot); @@ -22596,11 +22604,11 @@ S0.exports; return We; } function rM(c, h, y, N) { - return Os(c, function(W, ne, fe) { - h(N, y(W), ne, fe); + return Os(c, function(z, ne, fe) { + h(N, y(z), ne, fe); }), N; } - function gf(c, h, y) { + function mf(c, h, y) { h = Zo(h, c), c = qw(c, h); var N = c == null ? c : c[Ls(Vi(h))]; return N == null ? r : Pn(N, c, y); @@ -22614,10 +22622,10 @@ S0.exports; function iM(c) { return en(c) && ni(c) == ee; } - function mf(c, h, y, N, W) { - return c === h ? !0 : c == null || h == null || !en(c) && !en(h) ? c !== c && h !== h : sM(c, h, y, N, mf, W); + function vf(c, h, y, N, z) { + return c === h ? !0 : c == null || h == null || !en(c) && !en(h) ? c !== c && h !== h : sM(c, h, y, N, vf, z); } - function sM(c, h, y, N, W, ne) { + function sM(c, h, y, N, z, ne) { var fe = ir(c), me = ir(h), we = fe ? oe : Vn(c), We = me ? oe : Vn(h); we = we == D ? Pe : we, We = We == D ? Pe : We; var He = we == Pe, Xe = We == Pe, wt = we == We; @@ -22627,30 +22635,30 @@ S0.exports; fe = !0, He = !1; } if (wt && !He) - return ne || (ne = new ps()), fe || Jc(c) ? Lw(c, h, y, N, W, ne) : DM(c, h, we, y, N, W, ne); + return ne || (ne = new ps()), fe || Jc(c) ? Lw(c, h, y, N, z, ne) : DM(c, h, we, y, N, z, ne); if (!(y & P)) { var Ot = He && Tr.call(c, "__wrapped__"), Ht = Xe && Tr.call(h, "__wrapped__"); if (Ot || Ht) { var fr = Ot ? c.value() : c, Kt = Ht ? h.value() : h; - return ne || (ne = new ps()), W(fr, Kt, y, N, ne); + return ne || (ne = new ps()), z(fr, Kt, y, N, ne); } } - return wt ? (ne || (ne = new ps()), OM(c, h, y, N, W, ne)) : !1; + return wt ? (ne || (ne = new ps()), OM(c, h, y, N, z, ne)) : !1; } function oM(c) { return en(c) && Vn(c) == ie; } function pg(c, h, y, N) { - var W = y.length, ne = W, fe = !N; + var z = y.length, ne = z, fe = !N; if (c == null) return !ne; - for (c = qr(c); W--; ) { - var me = y[W]; + for (c = qr(c); z--; ) { + var me = y[z]; if (fe && me[2] ? me[1] !== c[me[0]] : !(me[0] in c)) return !1; } - for (; ++W < ne; ) { - me = y[W]; + for (; ++z < ne; ) { + me = y[z]; var we = me[0], We = c[we], He = me[1]; if (fe && me[2]) { if (We === r && !(we in c)) @@ -22659,7 +22667,7 @@ S0.exports; var Xe = new ps(); if (N) var wt = N(We, He, we, c, h, Xe); - if (!(wt === r ? mf(He, We, P | O, N, Xe) : wt)) + if (!(wt === r ? vf(He, We, P | O, N, Xe) : wt)) return !1; } } @@ -22684,7 +22692,7 @@ S0.exports; return typeof c == "function" ? c : c == null ? pi : typeof c == "object" ? ir(c) ? aw(c[0], c[1]) : ow(c) : P2(c); } function gg(c) { - if (!yf(c)) + if (!wf(c)) return hP(c); var h = []; for (var y in qr(c)) @@ -22694,7 +22702,7 @@ S0.exports; function fM(c) { if (!Zr(c)) return KM(c); - var h = yf(c), y = []; + var h = wf(c), y = []; for (var N in c) N == "constructor" && (h || !Tr.call(c, N)) || y.push(N); return y; @@ -22704,8 +22712,8 @@ S0.exports; } function sw(c, h) { var y = -1, N = hi(c) ? Ie(c.length) : []; - return Jo(c, function(W, ne, fe) { - N[++y] = h(W, ne, fe); + return Jo(c, function(z, ne, fe) { + N[++y] = h(z, ne, fe); }), N; } function ow(c) { @@ -22717,20 +22725,20 @@ S0.exports; function aw(c, h) { return Og(c) && Fw(h) ? jw(Ls(c), h) : function(y) { var N = zg(y, c); - return N === r && N === h ? Wg(y, c) : mf(h, N, P | O); + return N === r && N === h ? Wg(y, c) : vf(h, N, P | O); }; } - function Kh(c, h, y, N, W) { + function Kh(c, h, y, N, z) { c !== h && fg(h, function(ne, fe) { - if (W || (W = new ps()), Zr(ne)) - lM(c, h, fe, y, Kh, N, W); + if (z || (z = new ps()), Zr(ne)) + lM(c, h, fe, y, Kh, N, z); else { - var me = N ? N(Lg(c, fe), ne, fe + "", c, h, W) : r; + var me = N ? N(Lg(c, fe), ne, fe + "", c, h, z) : r; me === r && (me = ne), cg(c, fe, me); } }, di); } - function lM(c, h, y, N, W, ne, fe) { + function lM(c, h, y, N, z, ne, fe) { var me = Lg(c, y), we = Lg(h, y), We = fe.get(we); if (We) { cg(c, y, We); @@ -22739,9 +22747,9 @@ S0.exports; var He = ne ? ne(me, we, y + "", c, h, fe) : r, Xe = He === r; if (Xe) { var wt = ir(we), Ot = !wt && ea(we), Ht = !wt && !Ot && Jc(we); - He = we, wt || Ot || Ht ? ir(me) ? He = me : cn(me) ? He = li(me) : Ot ? (Xe = !1, He = yw(we, !0)) : Ht ? (Xe = !1, He = ww(we, !0)) : He = [] : xf(we) || Va(we) ? (He = me, Va(me) ? He = m2(me) : (!Zr(me) || go(me)) && (He = Bw(we))) : Xe = !1; + He = we, wt || Ot || Ht ? ir(me) ? He = me : cn(me) ? He = li(me) : Ot ? (Xe = !1, He = yw(we, !0)) : Ht ? (Xe = !1, He = ww(we, !0)) : He = [] : _f(we) || Va(we) ? (He = me, Va(me) ? He = m2(me) : (!Zr(me) || go(me)) && (He = Bw(we))) : Xe = !1; } - Xe && (fe.set(we, He), W(He, we, N, ne, fe), fe.delete(we)), cg(c, y, He); + Xe && (fe.set(we, He), z(He, we, N, ne, fe), fe.delete(we)), cg(c, y, He); } function cw(c, h) { var y = c.length; @@ -22756,13 +22764,13 @@ S0.exports; }) : h = [pi]; var N = -1; h = Xr(h, Mi(Ut())); - var W = sw(c, function(ne, fe, me) { + var z = sw(c, function(ne, fe, me) { var we = Xr(h, function(We) { return We(ne); }); return { criteria: we, index: ++N, value: ne }; }); - return BA(W, function(ne, fe) { + return BA(z, function(ne, fe) { return SM(ne, fe, y); }); } @@ -22772,9 +22780,9 @@ S0.exports; }); } function fw(c, h, y) { - for (var N = -1, W = h.length, ne = {}; ++N < W; ) { + for (var N = -1, z = h.length, ne = {}; ++N < z; ) { var fe = h[N], me = Wa(c, fe); - y(me, fe) && vf(ne, Zo(fe, c), me); + y(me, fe) && bf(ne, Zo(fe, c), me); } return ne; } @@ -22784,18 +22792,18 @@ S0.exports; }; } function vg(c, h, y, N) { - var W = N ? $A : Fc, ne = -1, fe = h.length, me = c; + var z = N ? $A : Fc, ne = -1, fe = h.length, me = c; for (c === h && (h = li(h)), y && (me = Xr(c, Mi(y))); ++ne < fe; ) - for (var we = 0, We = h[ne], He = y ? y(We) : We; (we = W(me, He, we, N)) > -1; ) + for (var we = 0, We = h[ne], He = y ? y(We) : We; (we = z(me, He, we, N)) > -1; ) me !== c && kh.call(me, we, 1), kh.call(c, we, 1); return c; } function lw(c, h) { for (var y = c ? h.length : 0, N = y - 1; y--; ) { - var W = h[y]; - if (y == N || W !== ne) { - var ne = W; - po(W) ? kh.call(c, W, 1) : xg(c, W); + var z = h[y]; + if (y == N || z !== ne) { + var ne = z; + po(z) ? kh.call(c, z, 1) : xg(c, z); } } return c; @@ -22804,8 +22812,8 @@ S0.exports; return c + Fh(Hy() * (h - c + 1)); } function pM(c, h, y, N) { - for (var W = -1, ne = En(Bh((h - c) / (y || 1)), 0), fe = Ie(ne); ne--; ) - fe[N ? ne : ++W] = c, c += y; + for (var z = -1, ne = En(Bh((h - c) / (y || 1)), 0), fe = Ie(ne); ne--; ) + fe[N ? ne : ++z] = c, c += y; return fe; } function yg(c, h) { @@ -22827,19 +22835,19 @@ S0.exports; var y = Xc(c); return rd(y, za(h, 0, y.length)); } - function vf(c, h, y, N) { + function bf(c, h, y, N) { if (!Zr(c)) return c; h = Zo(h, c); - for (var W = -1, ne = h.length, fe = ne - 1, me = c; me != null && ++W < ne; ) { - var we = Ls(h[W]), We = y; + for (var z = -1, ne = h.length, fe = ne - 1, me = c; me != null && ++z < ne; ) { + var we = Ls(h[z]), We = y; if (we === "__proto__" || we === "constructor" || we === "prototype") return c; - if (W != fe) { + if (z != fe) { var He = me[we]; - We = N ? N(He, we, me) : r, We === r && (We = Zr(He) ? He : po(h[W + 1]) ? [] : {}); + We = N ? N(He, we, me) : r, We === r && (We = Zr(He) ? He : po(h[z + 1]) ? [] : {}); } - df(me, we, We), me = me[we]; + pf(me, we, We), me = me[we]; } return c; } @@ -22857,49 +22865,49 @@ S0.exports; return rd(Xc(c)); } function Ki(c, h, y) { - var N = -1, W = c.length; - h < 0 && (h = -h > W ? 0 : W + h), y = y > W ? W : y, y < 0 && (y += W), W = h > y ? 0 : y - h >>> 0, h >>>= 0; - for (var ne = Ie(W); ++N < W; ) + var N = -1, z = c.length; + h < 0 && (h = -h > z ? 0 : z + h), y = y > z ? z : y, y < 0 && (y += z), z = h > y ? 0 : y - h >>> 0, h >>>= 0; + for (var ne = Ie(z); ++N < z; ) ne[N] = c[N + h]; return ne; } function yM(c, h) { var y; - return Jo(c, function(N, W, ne) { - return y = h(N, W, ne), !y; + return Jo(c, function(N, z, ne) { + return y = h(N, z, ne), !y; }), !!y; } function Vh(c, h, y) { - var N = 0, W = c == null ? N : c.length; - if (typeof h == "number" && h === h && W <= F) { - for (; N < W; ) { - var ne = N + W >>> 1, fe = c[ne]; - fe !== null && !Ci(fe) && (y ? fe <= h : fe < h) ? N = ne + 1 : W = ne; + var N = 0, z = c == null ? N : c.length; + if (typeof h == "number" && h === h && z <= F) { + for (; N < z; ) { + var ne = N + z >>> 1, fe = c[ne]; + fe !== null && !Ci(fe) && (y ? fe <= h : fe < h) ? N = ne + 1 : z = ne; } - return W; + return z; } return wg(c, h, pi, y); } function wg(c, h, y, N) { - var W = 0, ne = c == null ? 0 : c.length; + var z = 0, ne = c == null ? 0 : c.length; if (ne === 0) return 0; h = y(h); - for (var fe = h !== h, me = h === null, we = Ci(h), We = h === r; W < ne; ) { - var He = Fh((W + ne) / 2), Xe = y(c[He]), wt = Xe !== r, Ot = Xe === null, Ht = Xe === Xe, fr = Ci(Xe); + for (var fe = h !== h, me = h === null, we = Ci(h), We = h === r; z < ne; ) { + var He = Fh((z + ne) / 2), Xe = y(c[He]), wt = Xe !== r, Ot = Xe === null, Ht = Xe === Xe, fr = Ci(Xe); if (fe) var Kt = N || Ht; else We ? Kt = Ht && (N || wt) : me ? Kt = Ht && wt && (N || !Ot) : we ? Kt = Ht && wt && !Ot && (N || !fr) : Ot || fr ? Kt = !1 : Kt = N ? Xe <= h : Xe < h; - Kt ? W = He + 1 : ne = He; + Kt ? z = He + 1 : ne = He; } return Kn(ne, I); } function dw(c, h) { - for (var y = -1, N = c.length, W = 0, ne = []; ++y < N; ) { + for (var y = -1, N = c.length, z = 0, ne = []; ++y < N; ) { var fe = c[y], me = h ? h(fe) : fe; if (!y || !gs(me, we)) { var we = me; - ne[W++] = fe === 0 ? 0 : fe; + ne[z++] = fe === 0 ? 0 : fe; } } return ne; @@ -22918,14 +22926,14 @@ S0.exports; return h == "0" && 1 / c == -x ? "-0" : h; } function Xo(c, h, y) { - var N = -1, W = Ph, ne = c.length, fe = !0, me = [], we = me; + var N = -1, z = Ph, ne = c.length, fe = !0, me = [], we = me; if (y) - fe = !1, W = Yp; + fe = !1, z = Yp; else if (ne >= i) { var We = h ? null : TM(c); if (We) return Ih(We); - fe = !1, W = af, we = new qa(); + fe = !1, z = cf, we = new qa(); } else we = h ? [] : me; e: @@ -22936,7 +22944,7 @@ S0.exports; if (we[wt] === Xe) continue e; h && we.push(Xe), me.push(He); - } else W(we, Xe, y) || (we !== me && we.push(Xe), me.push(He)); + } else z(we, Xe, y) || (we !== me && we.push(Xe), me.push(He)); } return me; } @@ -22944,30 +22952,30 @@ S0.exports; return h = Zo(h, c), c = qw(c, h), c == null || delete c[Ls(Vi(h))]; } function gw(c, h, y, N) { - return vf(c, h, y(Wa(c, h)), N); + return bf(c, h, y(Wa(c, h)), N); } function Gh(c, h, y, N) { - for (var W = c.length, ne = N ? W : -1; (N ? ne-- : ++ne < W) && h(c[ne], ne, c); ) + for (var z = c.length, ne = N ? z : -1; (N ? ne-- : ++ne < z) && h(c[ne], ne, c); ) ; - return y ? Ki(c, N ? 0 : ne, N ? ne + 1 : W) : Ki(c, N ? ne + 1 : 0, N ? W : ne); + return y ? Ki(c, N ? 0 : ne, N ? ne + 1 : z) : Ki(c, N ? ne + 1 : 0, N ? z : ne); } function mw(c, h) { var y = c; - return y instanceof xr && (y = y.value()), Jp(h, function(N, W) { - return W.func.apply(W.thisArg, Vo([N], W.args)); + return y instanceof xr && (y = y.value()), Jp(h, function(N, z) { + return z.func.apply(z.thisArg, Vo([N], z.args)); }, y); } function _g(c, h, y) { var N = c.length; if (N < 2) return N ? Xo(c[0]) : []; - for (var W = -1, ne = Ie(N); ++W < N; ) - for (var fe = c[W], me = -1; ++me < N; ) - me != W && (ne[W] = pf(ne[W] || fe, c[me], h, y)); + for (var z = -1, ne = Ie(N); ++z < N; ) + for (var fe = c[z], me = -1; ++me < N; ) + me != z && (ne[z] = gf(ne[z] || fe, c[me], h, y)); return Xo(Bn(ne, 1), h, y); } function vw(c, h, y) { - for (var N = -1, W = c.length, ne = h.length, fe = {}; ++N < W; ) { + for (var N = -1, z = c.length, ne = h.length, fe = {}; ++N < z; ) { var me = N < ne ? h[N] : r; y(fe, c[N], me); } @@ -23009,7 +23017,7 @@ S0.exports; return h.lastIndex = c.lastIndex, h; } function EM(c) { - return hf ? qr(hf.call(c)) : {}; + return df ? qr(df.call(c)) : {}; } function ww(c, h) { var y = h ? Ag(c.buffer) : c.buffer; @@ -23017,17 +23025,17 @@ S0.exports; } function xw(c, h) { if (c !== h) { - var y = c !== r, N = c === null, W = c === c, ne = Ci(c), fe = h !== r, me = h === null, we = h === h, We = Ci(h); - if (!me && !We && !ne && c > h || ne && fe && we && !me && !We || N && fe && we || !y && we || !W) + var y = c !== r, N = c === null, z = c === c, ne = Ci(c), fe = h !== r, me = h === null, we = h === h, We = Ci(h); + if (!me && !We && !ne && c > h || ne && fe && we && !me && !We || N && fe && we || !y && we || !z) return 1; - if (!N && !ne && !We && c < h || We && y && W && !N && !ne || me && y && W || !fe && W || !we) + if (!N && !ne && !We && c < h || We && y && z && !N && !ne || me && y && z || !fe && z || !we) return -1; } return 0; } function SM(c, h, y) { - for (var N = -1, W = c.criteria, ne = h.criteria, fe = W.length, me = y.length; ++N < fe; ) { - var we = xw(W[N], ne[N]); + for (var N = -1, z = c.criteria, ne = h.criteria, fe = z.length, me = y.length; ++N < fe; ) { + var we = xw(z[N], ne[N]); if (we) { if (N >= me) return we; @@ -23038,21 +23046,21 @@ S0.exports; return c.index - h.index; } function _w(c, h, y, N) { - for (var W = -1, ne = c.length, fe = y.length, me = -1, we = h.length, We = En(ne - fe, 0), He = Ie(we + We), Xe = !N; ++me < we; ) + for (var z = -1, ne = c.length, fe = y.length, me = -1, we = h.length, We = En(ne - fe, 0), He = Ie(we + We), Xe = !N; ++me < we; ) He[me] = h[me]; - for (; ++W < fe; ) - (Xe || W < ne) && (He[y[W]] = c[W]); + for (; ++z < fe; ) + (Xe || z < ne) && (He[y[z]] = c[z]); for (; We--; ) - He[me++] = c[W++]; + He[me++] = c[z++]; return He; } function Ew(c, h, y, N) { - for (var W = -1, ne = c.length, fe = -1, me = y.length, we = -1, We = h.length, He = En(ne - me, 0), Xe = Ie(He + We), wt = !N; ++W < He; ) - Xe[W] = c[W]; - for (var Ot = W; ++we < We; ) + for (var z = -1, ne = c.length, fe = -1, me = y.length, we = -1, We = h.length, He = En(ne - me, 0), Xe = Ie(He + We), wt = !N; ++z < He; ) + Xe[z] = c[z]; + for (var Ot = z; ++we < We; ) Xe[Ot + we] = h[we]; for (; ++fe < me; ) - (wt || W < ne) && (Xe[Ot + y[fe]] = c[W++]); + (wt || z < ne) && (Xe[Ot + y[fe]] = c[z++]); return Xe; } function li(c, h) { @@ -23062,11 +23070,11 @@ S0.exports; return h; } function Ns(c, h, y, N) { - var W = !y; + var z = !y; y || (y = {}); for (var ne = -1, fe = h.length; ++ne < fe; ) { var me = h[ne], we = N ? N(y[me], c[me], me, y, c) : r; - we === r && (we = c[me]), W ? fo(y, me, we) : df(y, me, we); + we === r && (we = c[me]), z ? fo(y, me, we) : pf(y, me, we); } return y; } @@ -23078,14 +23086,14 @@ S0.exports; } function Yh(c, h) { return function(y, N) { - var W = ir(y) ? RA : GP, ne = h ? h() : {}; - return W(y, c, Ut(N, 2), ne); + var z = ir(y) ? RA : GP, ne = h ? h() : {}; + return z(y, c, Ut(N, 2), ne); }; } function Vc(c) { return hr(function(h, y) { - var N = -1, W = y.length, ne = W > 1 ? y[W - 1] : r, fe = W > 2 ? y[2] : r; - for (ne = c.length > 3 && typeof ne == "function" ? (W--, ne) : r, fe && ii(y[0], y[1], fe) && (ne = W < 3 ? r : ne, W = 1), h = qr(h); ++N < W; ) { + var N = -1, z = y.length, ne = z > 1 ? y[z - 1] : r, fe = z > 2 ? y[2] : r; + for (ne = c.length > 3 && typeof ne == "function" ? (z--, ne) : r, fe && ii(y[0], y[1], fe) && (ne = z < 3 ? r : ne, z = 1), h = qr(h); ++N < z; ) { var me = y[N]; me && c(h, me, N, ne); } @@ -23098,15 +23106,15 @@ S0.exports; return y; if (!hi(y)) return c(y, N); - for (var W = y.length, ne = h ? W : -1, fe = qr(y); (h ? ne-- : ++ne < W) && N(fe[ne], ne, fe) !== !1; ) + for (var z = y.length, ne = h ? z : -1, fe = qr(y); (h ? ne-- : ++ne < z) && N(fe[ne], ne, fe) !== !1; ) ; return y; }; } function Aw(c) { return function(h, y, N) { - for (var W = -1, ne = qr(h), fe = N(h), me = fe.length; me--; ) { - var we = fe[c ? me : ++W]; + for (var z = -1, ne = qr(h), fe = N(h), me = fe.length; me--; ) { + var we = fe[c ? me : ++z]; if (y(ne[we], we, ne) === !1) break; } @@ -23114,9 +23122,9 @@ S0.exports; }; } function MM(c, h, y) { - var N = h & L, W = bf(c); + var N = h & L, z = yf(c); function ne() { - var fe = this && this !== Er && this instanceof ne ? W : c; + var fe = this && this !== Er && this instanceof ne ? z : c; return fe.apply(N ? y : this, arguments); } return ne; @@ -23124,16 +23132,16 @@ S0.exports; function Pw(c) { return function(h) { h = Cr(h); - var y = jc(h) ? ds(h) : r, N = y ? y[0] : h.charAt(0), W = y ? Qo(y, 1).join("") : h.slice(1); - return N[c]() + W; + var y = jc(h) ? ds(h) : r, N = y ? y[0] : h.charAt(0), z = y ? Qo(y, 1).join("") : h.slice(1); + return N[c]() + z; }; } function Gc(c) { return function(h) { - return Jp(S2(E2(h).replace(sf, "")), c, ""); + return Jp(S2(E2(h).replace(of, "")), c, ""); }; } - function bf(c) { + function yf(c) { return function() { var h = arguments; switch (h.length) { @@ -23159,9 +23167,9 @@ S0.exports; }; } function IM(c, h, y) { - var N = bf(c); - function W() { - for (var ne = arguments.length, fe = Ie(ne), me = ne, we = Yc(W); me--; ) + var N = yf(c); + function z() { + for (var ne = arguments.length, fe = Ie(ne), me = ne, we = Yc(z); me--; ) fe[me] = arguments[me]; var We = ne < 3 && fe[0] !== we && fe[ne - 1] !== we ? [] : Go(fe, we); if (ne -= We.length, ne < y) @@ -23169,7 +23177,7 @@ S0.exports; c, h, Jh, - W.placeholder, + z.placeholder, r, fe, We, @@ -23177,38 +23185,38 @@ S0.exports; r, y - ne ); - var He = this && this !== Er && this instanceof W ? N : c; + var He = this && this !== Er && this instanceof z ? N : c; return Pn(He, this, fe); } - return W; + return z; } function Mw(c) { return function(h, y, N) { - var W = qr(h); + var z = qr(h); if (!hi(h)) { var ne = Ut(y, 3); h = Mn(h), y = function(me) { - return ne(W[me], me, W); + return ne(z[me], me, z); }; } var fe = c(h, y, N); - return fe > -1 ? W[ne ? h[fe] : fe] : r; + return fe > -1 ? z[ne ? h[fe] : fe] : r; }; } function Iw(c) { return ho(function(h) { - var y = h.length, N = y, W = Wi.prototype.thru; + var y = h.length, N = y, z = Wi.prototype.thru; for (c && h.reverse(); N--; ) { var ne = h[N]; if (typeof ne != "function") throw new zi(o); - if (W && !fe && ed(ne) == "wrapper") + if (z && !fe && ed(ne) == "wrapper") var fe = new Wi([], !0); } for (N = fe ? N : y; ++N < y; ) { ne = h[N]; var me = ed(ne), we = me == "wrapper" ? Tg(ne) : r; - we && Ng(we[0]) && we[1] == (R | q | V | K) && !we[4].length && we[9] == 1 ? fe = fe[ed(we[0])].apply(fe, we[3]) : fe = ne.length == 1 && Ng(ne) ? fe[me]() : fe.thru(ne); + we && Ng(we[0]) && we[1] == (R | W | V | K) && !we[4].length && we[9] == 1 ? fe = fe[ed(we[0])].apply(fe, we[3]) : fe = ne.length == 1 && Ng(ne) ? fe[me]() : fe.thru(ne); } return function() { var We = arguments, He = We[0]; @@ -23220,14 +23228,14 @@ S0.exports; }; }); } - function Jh(c, h, y, N, W, ne, fe, me, we, We) { - var He = h & R, Xe = h & L, wt = h & B, Ot = h & (q | U), Ht = h & ge, fr = wt ? r : bf(c); + function Jh(c, h, y, N, z, ne, fe, me, we, We) { + var He = h & R, Xe = h & L, wt = h & B, Ot = h & (W | U), Ht = h & ge, fr = wt ? r : yf(c); function Kt() { for (var br = arguments.length, Sr = Ie(br), Ti = br; Ti--; ) Sr[Ti] = arguments[Ti]; if (Ot) var si = Yc(Kt), Ri = jA(Sr, si); - if (N && (Sr = _w(Sr, N, W, Ot)), ne && (Sr = Ew(Sr, ne, fe, Ot)), br -= Ri, Ot && br < We) { + if (N && (Sr = _w(Sr, N, z, Ot)), ne && (Sr = Ew(Sr, ne, fe, Ot)), br -= Ri, Ot && br < We) { var un = Go(Sr, si); return Rw( c, @@ -23243,7 +23251,7 @@ S0.exports; ); } var ms = Xe ? y : this, vo = wt ? ms[c] : c; - return br = Sr.length, me ? Sr = GM(Sr, me) : Ht && br > 1 && Sr.reverse(), He && we < br && (Sr.length = we), this && this !== Er && this instanceof Kt && (vo = fr || bf(vo)), vo.apply(ms, Sr); + return br = Sr.length, me ? Sr = GM(Sr, me) : Ht && br > 1 && Sr.reverse(), He && we < br && (Sr.length = we), this && this !== Er && this instanceof Kt && (vo = fr || yf(vo)), vo.apply(ms, Sr); } return Kt; } @@ -23254,23 +23262,23 @@ S0.exports; } function Xh(c, h) { return function(y, N) { - var W; + var z; if (y === r && N === r) return h; - if (y !== r && (W = y), N !== r) { - if (W === r) + if (y !== r && (z = y), N !== r) { + if (z === r) return N; - typeof y == "string" || typeof N == "string" ? (y = Ii(y), N = Ii(N)) : (y = pw(y), N = pw(N)), W = c(y, N); + typeof y == "string" || typeof N == "string" ? (y = Ii(y), N = Ii(N)) : (y = pw(y), N = pw(N)), z = c(y, N); } - return W; + return z; }; } function Pg(c) { return ho(function(h) { return h = Xr(h, Mi(Ut())), hr(function(y) { var N = this; - return c(h, function(W) { - return Pn(W, N, y); + return c(h, function(z) { + return Pn(z, N, y); }); }); }); @@ -23284,13 +23292,13 @@ S0.exports; return jc(h) ? Qo(ds(N), 0, c).join("") : N.slice(0, c); } function CM(c, h, y, N) { - var W = h & L, ne = bf(c); + var z = h & L, ne = yf(c); function fe() { for (var me = -1, we = arguments.length, We = -1, He = N.length, Xe = Ie(He + we), wt = this && this !== Er && this instanceof fe ? ne : c; ++We < He; ) Xe[We] = N[We]; for (; we--; ) Xe[We++] = arguments[++me]; - return Pn(wt, W ? y : this, Xe); + return Pn(wt, z ? y : this, Xe); } return fe; } @@ -23304,13 +23312,13 @@ S0.exports; return typeof h == "string" && typeof y == "string" || (h = Gi(h), y = Gi(y)), c(h, y); }; } - function Rw(c, h, y, N, W, ne, fe, me, we, We) { - var He = h & q, Xe = He ? fe : r, wt = He ? r : fe, Ot = He ? ne : r, Ht = He ? r : ne; + function Rw(c, h, y, N, z, ne, fe, me, we, We) { + var He = h & W, Xe = He ? fe : r, wt = He ? r : fe, Ot = He ? ne : r, Ht = He ? r : ne; h |= He ? V : Q, h &= ~(He ? Q : V), h & k || (h &= ~(L | B)); var fr = [ c, h, - W, + z, Ot, Xe, Ht, @@ -23325,8 +23333,8 @@ S0.exports; var h = _n[c]; return function(y, N) { if (y = Gi(y), N = N == null ? 0 : Kn(cr(N), 292), N && Wy(y)) { - var W = (Cr(y) + "e").split("e"), ne = h(W[0] + "e" + (+W[1] + N)); - return W = (Cr(ne) + "e").split("e"), +(W[0] + "e" + (+W[1] - N)); + var z = (Cr(y) + "e").split("e"), ne = h(z[0] + "e" + (+z[1] + N)); + return z = (Cr(ne) + "e").split("e"), +(z[0] + "e" + (+z[1] - N)); } return h(y); }; @@ -23340,43 +23348,43 @@ S0.exports; return y == ie ? ng(h) : y == Me ? VA(h) : FA(h, c(h)); }; } - function lo(c, h, y, N, W, ne, fe, me) { + function lo(c, h, y, N, z, ne, fe, me) { var we = h & B; if (!we && typeof c != "function") throw new zi(o); var We = N ? N.length : 0; - if (We || (h &= ~(V | Q), N = W = r), fe = fe === r ? fe : En(cr(fe), 0), me = me === r ? me : cr(me), We -= W ? W.length : 0, h & Q) { - var He = N, Xe = W; - N = W = r; + if (We || (h &= ~(V | Q), N = z = r), fe = fe === r ? fe : En(cr(fe), 0), me = me === r ? me : cr(me), We -= z ? z.length : 0, h & Q) { + var He = N, Xe = z; + N = z = r; } var wt = we ? r : Tg(c), Ot = [ c, h, y, N, - W, + z, He, Xe, ne, fe, me ]; - if (wt && HM(Ot, wt), c = Ot[0], h = Ot[1], y = Ot[2], N = Ot[3], W = Ot[4], me = Ot[9] = Ot[9] === r ? we ? 0 : c.length : En(Ot[9] - We, 0), !me && h & (q | U) && (h &= ~(q | U)), !h || h == L) + if (wt && HM(Ot, wt), c = Ot[0], h = Ot[1], y = Ot[2], N = Ot[3], z = Ot[4], me = Ot[9] = Ot[9] === r ? we ? 0 : c.length : En(Ot[9] - We, 0), !me && h & (W | U) && (h &= ~(W | U)), !h || h == L) var Ht = MM(c, h, y); - else h == q || h == U ? Ht = IM(c, h, me) : (h == V || h == (L | V)) && !W.length ? Ht = CM(c, h, y, N) : Ht = Jh.apply(r, Ot); + else h == W || h == U ? Ht = IM(c, h, me) : (h == V || h == (L | V)) && !z.length ? Ht = CM(c, h, y, N) : Ht = Jh.apply(r, Ot); var fr = wt ? hw : zw; return Ww(fr(Ht, Ot), c, h); } function Ow(c, h, y, N) { return c === r || gs(c, zc[y]) && !Tr.call(N, y) ? h : c; } - function Nw(c, h, y, N, W, ne) { + function Nw(c, h, y, N, z, ne) { return Zr(c) && Zr(h) && (ne.set(h, c), Kh(c, h, r, Nw, ne), ne.delete(h)), c; } function RM(c) { - return xf(c) ? r : c; + return _f(c) ? r : c; } - function Lw(c, h, y, N, W, ne) { + function Lw(c, h, y, N, z, ne) { var fe = y & P, me = c.length, we = h.length; if (me != we && !(fe && we > me)) return !1; @@ -23396,20 +23404,20 @@ S0.exports; } if (Ot) { if (!Xp(h, function(br, Sr) { - if (!af(Ot, Sr) && (Ht === br || W(Ht, br, y, N, ne))) + if (!cf(Ot, Sr) && (Ht === br || z(Ht, br, y, N, ne))) return Ot.push(Sr); })) { wt = !1; break; } - } else if (!(Ht === fr || W(Ht, fr, y, N, ne))) { + } else if (!(Ht === fr || z(Ht, fr, y, N, ne))) { wt = !1; break; } } return ne.delete(c), ne.delete(h), wt; } - function DM(c, h, y, N, W, ne, fe) { + function DM(c, h, y, N, z, ne, fe) { switch (y) { case Ze: if (c.byteLength != h.byteLength || c.byteOffset != h.byteOffset) @@ -23436,15 +23444,15 @@ S0.exports; if (We) return We == h; N |= O, fe.set(c, h); - var He = Lw(me(c), me(h), N, W, ne, fe); + var He = Lw(me(c), me(h), N, z, ne, fe); return fe.delete(c), He; case Ke: - if (hf) - return hf.call(c) == hf.call(h); + if (df) + return df.call(c) == df.call(h); } return !1; } - function OM(c, h, y, N, W, ne) { + function OM(c, h, y, N, z, ne) { var fe = y & P, me = Ig(c), we = me.length, We = Ig(h), He = We.length; if (we != He && !fe) return !1; @@ -23463,7 +23471,7 @@ S0.exports; var br = c[wt], Sr = h[wt]; if (N) var Ti = fe ? N(Sr, br, wt, h, c, ne) : N(br, Sr, wt, c, h, ne); - if (!(Ti === r ? br === Sr || W(br, Sr, y, N, ne) : Ti)) { + if (!(Ti === r ? br === Sr || z(br, Sr, y, N, ne) : Ti)) { fr = !1; break; } @@ -23489,9 +23497,9 @@ S0.exports; } : Yg; function ed(c) { for (var h = c.name + "", y = Hc[h], N = Tr.call(Hc, h) ? y.length : 0; N--; ) { - var W = y[N], ne = W.func; + var z = y[N], ne = z.func; if (ne == null || ne == c) - return W.name; + return z.name; } return h; } @@ -23509,8 +23517,8 @@ S0.exports; } function Rg(c) { for (var h = Mn(c), y = h.length; y--; ) { - var N = h[y], W = c[N]; - h[y] = [N, W, Fw(W)]; + var N = h[y], z = c[N]; + h[y] = [N, z, Fw(z)]; } return h; } @@ -23525,8 +23533,8 @@ S0.exports; var N = !0; } catch { } - var W = Dh.call(c); - return N && (h ? c[ja] = y : delete c[ja]), W; + var z = Dh.call(c); + return N && (h ? c[ja] = y : delete c[ja]), z; } var Dg = sg ? function(c) { return c == null ? [] : (c = qr(c), Ko(sg(c), function(h) { @@ -23537,7 +23545,7 @@ S0.exports; Vo(h, Dg(c)), c = Lh(c); return h; } : Jg, Vn = ni; - (og && Vn(new og(new ArrayBuffer(1))) != Ze || uf && Vn(new uf()) != ie || ag && Vn(ag.resolve()) != De || Wc && Vn(new Wc()) != Me || ff && Vn(new ff()) != qe) && (Vn = function(c) { + (og && Vn(new og(new ArrayBuffer(1))) != Ze || ff && Vn(new ff()) != ie || ag && Vn(ag.resolve()) != De || Wc && Vn(new Wc()) != Me || lf && Vn(new lf()) != qe) && (Vn = function(c) { var h = ni(c), y = h == Pe ? c.constructor : r, N = y ? Ka(y) : ""; if (N) switch (N) { @@ -23555,7 +23563,7 @@ S0.exports; return h; }); function LM(c, h, y) { - for (var N = -1, W = y.length; ++N < W; ) { + for (var N = -1, z = y.length; ++N < z; ) { var ne = y[N], fe = ne.size; switch (ne.type) { case "drop": @@ -23580,20 +23588,20 @@ S0.exports; } function $w(c, h, y) { h = Zo(h, c); - for (var N = -1, W = h.length, ne = !1; ++N < W; ) { + for (var N = -1, z = h.length, ne = !1; ++N < z; ) { var fe = Ls(h[N]); if (!(ne = c != null && y(c, fe))) break; c = c[fe]; } - return ne || ++N != W ? ne : (W = c == null ? 0 : c.length, !!W && cd(W) && po(fe, W) && (ir(c) || Va(c))); + return ne || ++N != z ? ne : (z = c == null ? 0 : c.length, !!z && cd(z) && po(fe, z) && (ir(c) || Va(c))); } function $M(c) { var h = c.length, y = new c.constructor(h); return h && typeof c[0] == "string" && Tr.call(c, "index") && (y.index = c.index, y.input = c.input), y; } function Bw(c) { - return typeof c.constructor == "function" && !yf(c) ? Kc(Lh(c)) : {}; + return typeof c.constructor == "function" && !wf(c) ? Kc(Lh(c)) : {}; } function BM(c, h, y) { var N = c.constructor; @@ -23673,7 +23681,7 @@ S0.exports; return !!Fy && Fy in c; } var zM = Th ? go : Xg; - function yf(c) { + function wf(c) { var h = c && c.constructor, y = typeof h == "function" && h.prototype || zc; return c === y; } @@ -23692,16 +23700,16 @@ S0.exports; return h; } function HM(c, h) { - var y = c[1], N = h[1], W = y | N, ne = W < (L | B | R), fe = N == R && y == q || N == R && y == K && c[7].length <= h[8] || N == (R | K) && h[7].length <= h[8] && y == q; + var y = c[1], N = h[1], z = y | N, ne = z < (L | B | R), fe = N == R && y == W || N == R && y == K && c[7].length <= h[8] || N == (R | K) && h[7].length <= h[8] && y == W; if (!(ne || fe)) return c; - N & L && (c[2] = h[2], W |= y & L ? 0 : k); + N & L && (c[2] = h[2], z |= y & L ? 0 : k); var me = h[3]; if (me) { var we = c[3]; c[3] = we ? _w(we, me, h[4]) : me, c[4] = we ? Go(c[3], d) : h[4]; } - return me = h[5], me && (we = c[5], c[5] = we ? Ew(we, me, h[6]) : me, c[6] = we ? Go(c[5], d) : h[6]), me = h[7], me && (c[7] = me), N & R && (c[8] = c[8] == null ? h[8] : Kn(c[8], h[8])), c[9] == null && (c[9] = h[9]), c[0] = h[0], c[1] = W, c; + return me = h[5], me && (we = c[5], c[5] = we ? Ew(we, me, h[6]) : me, c[6] = we ? Go(c[5], d) : h[6]), me = h[7], me && (c[7] = me), N & R && (c[8] = c[8] == null ? h[8] : Kn(c[8], h[8])), c[9] == null && (c[9] = h[9]), c[0] = h[0], c[1] = z, c; } function KM(c) { var h = []; @@ -23715,11 +23723,11 @@ S0.exports; } function Uw(c, h, y) { return h = En(h === r ? c.length - 1 : h, 0), function() { - for (var N = arguments, W = -1, ne = En(N.length - h, 0), fe = Ie(ne); ++W < ne; ) - fe[W] = N[h + W]; - W = -1; - for (var me = Ie(h + 1); ++W < h; ) - me[W] = N[W]; + for (var N = arguments, z = -1, ne = En(N.length - h, 0), fe = Ie(ne); ++z < ne; ) + fe[z] = N[h + z]; + z = -1; + for (var me = Ie(h + 1); ++z < h; ) + me[z] = N[z]; return me[h] = y(fe), Pn(c, this, me); }; } @@ -23727,9 +23735,9 @@ S0.exports; return h.length < 2 ? c : Wa(c, Ki(h, 0, -1)); } function GM(c, h) { - for (var y = c.length, N = Kn(h.length, y), W = li(c); N--; ) { + for (var y = c.length, N = Kn(h.length, y), z = li(c); N--; ) { var ne = h[N]; - c[N] = po(ne, y) ? W[ne] : r; + c[N] = po(ne, y) ? z[ne] : r; } return c; } @@ -23737,7 +23745,7 @@ S0.exports; if (!(h === "constructor" && typeof c[h] == "function") && h != "__proto__") return c[h]; } - var zw = Hw(hw), wf = uP || function(c, h) { + var zw = Hw(hw), xf = uP || function(c, h) { return Er.setTimeout(c, h); }, kg = Hw(vM); function Ww(c, h, y) { @@ -23747,8 +23755,8 @@ S0.exports; function Hw(c) { var h = 0, y = 0; return function() { - var N = dP(), W = m - (N - y); - if (y = N, W > 0) { + var N = dP(), z = m - (N - y); + if (y = N, z > 0) { if (++h >= A) return arguments[0]; } else @@ -23757,17 +23765,17 @@ S0.exports; }; } function rd(c, h) { - var y = -1, N = c.length, W = N - 1; + var y = -1, N = c.length, z = N - 1; for (h = h === r ? N : h; ++y < h; ) { - var ne = bg(y, W), fe = c[ne]; + var ne = bg(y, z), fe = c[ne]; c[ne] = c[y], c[y] = fe; } return c.length = h, c; } var Kw = WM(function(c) { var h = []; - return c.charCodeAt(0) === 46 && h.push(""), c.replace(Ft, function(y, N, W, ne) { - h.push(W ? ne.replace(de, "$1") : N || y); + return c.charCodeAt(0) === 46 && h.push(""), c.replace(Ft, function(y, N, z, ne) { + h.push(z ? ne.replace(de, "$1") : N || y); }), h; }); function Ls(c) { @@ -23806,16 +23814,16 @@ S0.exports; var N = c == null ? 0 : c.length; if (!N || h < 1) return []; - for (var W = 0, ne = 0, fe = Ie(Bh(N / h)); W < N; ) - fe[ne++] = Ki(c, W, W += h); + for (var z = 0, ne = 0, fe = Ie(Bh(N / h)); z < N; ) + fe[ne++] = Ki(c, z, z += h); return fe; } function XM(c) { - for (var h = -1, y = c == null ? 0 : c.length, N = 0, W = []; ++h < y; ) { + for (var h = -1, y = c == null ? 0 : c.length, N = 0, z = []; ++h < y; ) { var ne = c[h]; - ne && (W[N++] = ne); + ne && (z[N++] = ne); } - return W; + return z; } function ZM() { var c = arguments.length; @@ -23826,13 +23834,13 @@ S0.exports; return Vo(ir(y) ? li(y) : [y], Bn(h, 1)); } var QM = hr(function(c, h) { - return cn(c) ? pf(c, Bn(h, 1, cn, !0)) : []; + return cn(c) ? gf(c, Bn(h, 1, cn, !0)) : []; }), eI = hr(function(c, h) { var y = Vi(h); - return cn(y) && (y = r), cn(c) ? pf(c, Bn(h, 1, cn, !0), Ut(y, 2)) : []; + return cn(y) && (y = r), cn(c) ? gf(c, Bn(h, 1, cn, !0), Ut(y, 2)) : []; }), tI = hr(function(c, h) { var y = Vi(h); - return cn(y) && (y = r), cn(c) ? pf(c, Bn(h, 1, cn, !0), r, y) : []; + return cn(y) && (y = r), cn(c) ? gf(c, Bn(h, 1, cn, !0), r, y) : []; }); function rI(c, h, y) { var N = c == null ? 0 : c.length; @@ -23849,22 +23857,22 @@ S0.exports; return c && c.length ? Gh(c, Ut(h, 3), !0) : []; } function oI(c, h, y, N) { - var W = c == null ? 0 : c.length; - return W ? (y && typeof y != "number" && ii(c, h, y) && (y = 0, N = W), ZP(c, h, y, N)) : []; + var z = c == null ? 0 : c.length; + return z ? (y && typeof y != "number" && ii(c, h, y) && (y = 0, N = z), ZP(c, h, y, N)) : []; } function Gw(c, h, y) { var N = c == null ? 0 : c.length; if (!N) return -1; - var W = y == null ? 0 : cr(y); - return W < 0 && (W = En(N + W, 0)), Mh(c, Ut(h, 3), W); + var z = y == null ? 0 : cr(y); + return z < 0 && (z = En(N + z, 0)), Mh(c, Ut(h, 3), z); } function Yw(c, h, y) { var N = c == null ? 0 : c.length; if (!N) return -1; - var W = N - 1; - return y !== r && (W = cr(y), W = y < 0 ? En(N + W, 0) : Kn(W, N - 1)), Mh(c, Ut(h, 3), W, !0); + var z = N - 1; + return y !== r && (z = cr(y), z = y < 0 ? En(N + z, 0) : Kn(z, N - 1)), Mh(c, Ut(h, 3), z, !0); } function Jw(c) { var h = c == null ? 0 : c.length; @@ -23880,8 +23888,8 @@ S0.exports; } function uI(c) { for (var h = -1, y = c == null ? 0 : c.length, N = {}; ++h < y; ) { - var W = c[h]; - N[W[0]] = W[1]; + var z = c[h]; + N[z[0]] = z[1]; } return N; } @@ -23892,8 +23900,8 @@ S0.exports; var N = c == null ? 0 : c.length; if (!N) return -1; - var W = y == null ? 0 : cr(y); - return W < 0 && (W = En(N + W, 0)), Fc(c, h, W); + var z = y == null ? 0 : cr(y); + return z < 0 && (z = En(N + z, 0)), Fc(c, h, z); } function lI(c) { var h = c == null ? 0 : c.length; @@ -23920,8 +23928,8 @@ S0.exports; var N = c == null ? 0 : c.length; if (!N) return -1; - var W = N; - return y !== r && (W = cr(y), W = W < 0 ? En(N + W, 0) : Kn(W, N - 1)), h === h ? YA(c, h, W) : Mh(c, Ry, W, !0); + var z = N; + return y !== r && (z = cr(y), z = z < 0 ? En(N + z, 0) : Kn(z, N - 1)), h === h ? YA(c, h, z) : Mh(c, Ry, z, !0); } function vI(c, h) { return c && c.length ? cw(c, cr(h)) : r; @@ -23938,20 +23946,20 @@ S0.exports; } var xI = ho(function(c, h) { var y = c == null ? 0 : c.length, N = ug(c, h); - return lw(c, Xr(h, function(W) { - return po(W, y) ? +W : W; + return lw(c, Xr(h, function(z) { + return po(z, y) ? +z : z; }).sort(xw)), N; }); function _I(c, h) { var y = []; if (!(c && c.length)) return y; - var N = -1, W = [], ne = c.length; + var N = -1, z = [], ne = c.length; for (h = Ut(h, 3); ++N < ne; ) { var fe = c[N]; - h(fe, N, c) && (y.push(fe), W.push(N)); + h(fe, N, c) && (y.push(fe), z.push(N)); } - return lw(c, W), y; + return lw(c, z), y; } function $g(c) { return c == null ? c : gP.call(c); @@ -24051,7 +24059,7 @@ S0.exports; }); } var zI = hr(function(c, h) { - return cn(c) ? pf(c, h) : []; + return cn(c) ? gf(c, h) : []; }), WI = hr(function(c) { return _g(Ko(c, cn)); }), HI = hr(function(c) { @@ -24062,10 +24070,10 @@ S0.exports; return h = typeof h == "function" ? h : r, _g(Ko(c, cn), r, h); }), VI = hr(Bg); function GI(c, h) { - return vw(c || [], h || [], df); + return vw(c || [], h || [], pf); } function YI(c, h) { - return vw(c || [], h || [], vf); + return vw(c || [], h || [], bf); } var JI = hr(function(c) { var h = c.length, y = h > 1 ? c[h - 1] : r; @@ -24082,12 +24090,12 @@ S0.exports; return h(c); } var ZI = ho(function(c) { - var h = c.length, y = h ? c[0] : 0, N = this.__wrapped__, W = function(ne) { + var h = c.length, y = h ? c[0] : 0, N = this.__wrapped__, z = function(ne) { return ug(ne, c); }; - return h > 1 || this.__actions__.length || !(N instanceof xr) || !po(y) ? this.thru(W) : (N = N.slice(y, +y + (h ? 1 : 0)), N.__actions__.push({ + return h > 1 || this.__actions__.length || !(N instanceof xr) || !po(y) ? this.thru(z) : (N = N.slice(y, +y + (h ? 1 : 0)), N.__actions__.push({ func: nd, - args: [W], + args: [z], thisArg: r }), new Wi(N, this.__chain__).thru(function(ne) { return h && !ne.length && ne.push(r), ne; @@ -24110,11 +24118,11 @@ S0.exports; function nC(c) { for (var h, y = this; y instanceof qh; ) { var N = Vw(y); - N.__index__ = 0, N.__values__ = r, h ? W.__wrapped__ = N : h = N; - var W = N; + N.__index__ = 0, N.__values__ = r, h ? z.__wrapped__ = N : h = N; + var z = N; y = y.__wrapped__; } - return W.__wrapped__ = c, h; + return z.__wrapped__ = c, h; } function iC() { var c = this.__wrapped__; @@ -24165,13 +24173,13 @@ S0.exports; }); function gC(c, h, y, N) { c = hi(c) ? c : Xc(c), y = y && !N ? cr(y) : 0; - var W = c.length; - return y < 0 && (y = En(W + y, 0)), ud(c) ? y <= W && c.indexOf(h, y) > -1 : !!W && Fc(c, h, y) > -1; + var z = c.length; + return y < 0 && (y = En(z + y, 0)), ud(c) ? y <= z && c.indexOf(h, y) > -1 : !!z && Fc(c, h, y) > -1; } var mC = hr(function(c, h, y) { - var N = -1, W = typeof h == "function", ne = hi(c) ? Ie(c.length) : []; + var N = -1, z = typeof h == "function", ne = hi(c) ? Ie(c.length) : []; return Jo(c, function(fe) { - ne[++N] = W ? Pn(h, fe, y) : gf(fe, h, y); + ne[++N] = z ? Pn(h, fe, y) : mf(fe, h, y); }), ne; }), vC = Yh(function(c, h, y) { fo(c, y, h); @@ -24189,12 +24197,12 @@ S0.exports; return [[], []]; }); function wC(c, h, y) { - var N = ir(c) ? Jp : Oy, W = arguments.length < 3; - return N(c, Ut(h, 4), y, W, Jo); + var N = ir(c) ? Jp : Oy, z = arguments.length < 3; + return N(c, Ut(h, 4), y, z, Jo); } function xC(c, h, y) { - var N = ir(c) ? OA : Oy, W = arguments.length < 3; - return N(c, Ut(h, 4), y, W, Zy); + var N = ir(c) ? OA : Oy, z = arguments.length < 3; + return N(c, Ut(h, 4), y, z, Zy); } function _C(c, h) { var y = ir(c) ? Ko : Qy; @@ -24255,21 +24263,21 @@ S0.exports; var Fg = hr(function(c, h, y) { var N = L; if (y.length) { - var W = Go(y, Yc(Fg)); + var z = Go(y, Yc(Fg)); N |= V; } - return lo(c, N, h, y, W); + return lo(c, N, h, y, z); }), s2 = hr(function(c, h, y) { var N = L | B; if (y.length) { - var W = Go(y, Yc(s2)); + var z = Go(y, Yc(s2)); N |= V; } - return lo(h, N, c, y, W); + return lo(h, N, c, y, z); }); function o2(c, h, y) { h = y ? r : h; - var N = lo(c, q, r, r, r, r, r, h); + var N = lo(c, W, r, r, r, r, r, h); return N.placeholder = o2.placeholder, N; } function a2(c, h, y) { @@ -24278,16 +24286,16 @@ S0.exports; return N.placeholder = a2.placeholder, N; } function c2(c, h, y) { - var N, W, ne, fe, me, we, We = 0, He = !1, Xe = !1, wt = !0; + var N, z, ne, fe, me, we, We = 0, He = !1, Xe = !1, wt = !0; if (typeof c != "function") throw new zi(o); h = Gi(h) || 0, Zr(y) && (He = !!y.leading, Xe = "maxWait" in y, ne = Xe ? En(Gi(y.maxWait) || 0, h) : ne, wt = "trailing" in y ? !!y.trailing : wt); function Ot(un) { - var ms = N, vo = W; - return N = W = r, We = un, fe = c.apply(vo, ms), fe; + var ms = N, vo = z; + return N = z = r, We = un, fe = c.apply(vo, ms), fe; } function Ht(un) { - return We = un, me = wf(br, h), He ? Ot(un) : fe; + return We = un, me = xf(br, h), He ? Ot(un) : fe; } function fr(un) { var ms = un - we, vo = un - We, M2 = h - ms; @@ -24301,26 +24309,26 @@ S0.exports; var un = sd(); if (Kt(un)) return Sr(un); - me = wf(br, fr(un)); + me = xf(br, fr(un)); } function Sr(un) { - return me = r, wt && N ? Ot(un) : (N = W = r, fe); + return me = r, wt && N ? Ot(un) : (N = z = r, fe); } function Ti() { - me !== r && bw(me), We = 0, N = we = W = me = r; + me !== r && bw(me), We = 0, N = we = z = me = r; } function si() { return me === r ? fe : Sr(sd()); } function Ri() { var un = sd(), ms = Kt(un); - if (N = arguments, W = this, we = un, ms) { + if (N = arguments, z = this, we = un, ms) { if (me === r) return Ht(we); if (Xe) - return bw(me), me = wf(br, h), Ot(we); + return bw(me), me = xf(br, h), Ot(we); } - return me === r && (me = wf(br, h)), fe; + return me === r && (me = xf(br, h)), fe; } return Ri.cancel = Ti, Ri.flush = si, Ri; } @@ -24336,11 +24344,11 @@ S0.exports; if (typeof c != "function" || h != null && typeof h != "function") throw new zi(o); var y = function() { - var N = arguments, W = h ? h.apply(this, N) : N[0], ne = y.cache; - if (ne.has(W)) - return ne.get(W); + var N = arguments, z = h ? h.apply(this, N) : N[0], ne = y.cache; + if (ne.has(z)) + return ne.get(z); var fe = c.apply(this, N); - return y.cache = ne.set(W, fe) || ne, fe; + return y.cache = ne.set(z, fe) || ne, fe; }; return y.cache = new (od.Cache || uo)(), y; } @@ -24370,8 +24378,8 @@ S0.exports; h = h.length == 1 && ir(h[0]) ? Xr(h[0], Mi(Ut())) : Xr(Bn(h, 1), Mi(Ut())); var y = h.length; return hr(function(N) { - for (var W = -1, ne = Kn(N.length, y); ++W < ne; ) - N[W] = h[W].call(this, N[W]); + for (var z = -1, ne = Kn(N.length, y); ++z < ne; ) + N[z] = h[z].call(this, N[z]); return Pn(c, this, N); }); }), jg = hr(function(c, h) { @@ -24392,18 +24400,18 @@ S0.exports; if (typeof c != "function") throw new zi(o); return h = h == null ? 0 : En(cr(h), 0), hr(function(y) { - var N = y[h], W = Qo(y, 0, h); - return N && Vo(W, N), Pn(c, this, W); + var N = y[h], z = Qo(y, 0, h); + return N && Vo(z, N), Pn(c, this, z); }); } function BC(c, h, y) { - var N = !0, W = !0; + var N = !0, z = !0; if (typeof c != "function") throw new zi(o); - return Zr(y) && (N = "leading" in y ? !!y.leading : N, W = "trailing" in y ? !!y.trailing : W), c2(c, h, { + return Zr(y) && (N = "leading" in y ? !!y.leading : N, z = "trailing" in y ? !!y.trailing : z), c2(c, h, { leading: N, maxWait: h, - trailing: W + trailing: z }); } function FC(c) { @@ -24454,7 +24462,7 @@ S0.exports; } var ea = fP || Xg, XC = hs ? Mi(hs) : iM; function ZC(c) { - return en(c) && c.nodeType === 1 && !xf(c); + return en(c) && c.nodeType === 1 && !_f(c); } function QC(c) { if (c == null) @@ -24464,7 +24472,7 @@ S0.exports; var h = Vn(c); if (h == ie || h == Me) return !c.size; - if (yf(c)) + if (wf(c)) return !gg(c).length; for (var y in c) if (Tr.call(c, y)) @@ -24472,18 +24480,18 @@ S0.exports; return !0; } function eT(c, h) { - return mf(c, h); + return vf(c, h); } function tT(c, h, y) { y = typeof y == "function" ? y : r; var N = y ? y(c, h) : r; - return N === r ? mf(c, h, r, y) : !!N; + return N === r ? vf(c, h, r, y) : !!N; } function Ug(c) { if (!en(c)) return !1; var h = ni(c); - return h == X || h == T || typeof c.message == "string" && typeof c.name == "string" && !xf(c); + return h == X || h == T || typeof c.message == "string" && typeof c.name == "string" && !_f(c); } function rT(c) { return typeof c == "number" && Wy(c); @@ -24531,7 +24539,7 @@ S0.exports; function h2(c) { return typeof c == "number" || en(c) && ni(c) == ue; } - function xf(c) { + function _f(c) { if (!en(c) || ni(c) != Pe) return !1; var h = Lh(c); @@ -24544,7 +24552,7 @@ S0.exports; function uT(c) { return f2(c) && c >= -E && c <= E; } - var d2 = of ? Mi(of) : cM; + var d2 = af ? Mi(af) : cM; function ud(c) { return typeof c == "string" || !ir(c) && en(c) && ni(c) == Ne; } @@ -24569,8 +24577,8 @@ S0.exports; return []; if (hi(c)) return ud(c) ? ds(c) : li(c); - if (cf && c[cf]) - return KA(c[cf]()); + if (uf && c[uf]) + return KA(c[uf]()); var h = Vn(c), y = h == ie ? ng : h == Me ? Ih : Xc; return y(c); } @@ -24615,12 +24623,12 @@ S0.exports; return c == null ? "" : Ii(c); } var mT = Vc(function(c, h) { - if (yf(h) || hi(h)) { + if (wf(h) || hi(h)) { Ns(h, Mn(h), c); return; } for (var y in h) - Tr.call(h, y) && df(c, y, h[y]); + Tr.call(h, y) && pf(c, y, h[y]); }), v2 = Vc(function(c, h) { Ns(h, di(h), c); }), fd = Vc(function(c, h, y, N) { @@ -24634,8 +24642,8 @@ S0.exports; } var wT = hr(function(c, h) { c = qr(c); - var y = -1, N = h.length, W = N > 2 ? h[2] : r; - for (W && ii(h[0], h[1], W) && (N = 1); ++y < N; ) + var y = -1, N = h.length, z = N > 2 ? h[2] : r; + for (z && ii(h[0], h[1], z) && (N = 1); ++y < N; ) for (var ne = h[y], fe = di(ne), me = -1, we = fe.length; ++me < we; ) { var We = fe[me], He = c[We]; (He === r || gs(He, zc[We]) && !Tr.call(c, We)) && (c[We] = ne[We]); @@ -24682,7 +24690,7 @@ S0.exports; h != null && typeof h.toString != "function" && (h = Dh.call(h)), c[h] = y; }, Kg(pi)), DT = Cw(function(c, h, y) { h != null && typeof h.toString != "function" && (h = Dh.call(h)), Tr.call(c, h) ? c[h].push(y) : c[h] = [y]; - }, Ut), OT = hr(gf); + }, Ut), OT = hr(mf); function Mn(c) { return hi(c) ? Vy(c) : gg(c); } @@ -24691,14 +24699,14 @@ S0.exports; } function NT(c, h) { var y = {}; - return h = Ut(h, 3), Os(c, function(N, W, ne) { - fo(y, h(N, W, ne), N); + return h = Ut(h, 3), Os(c, function(N, z, ne) { + fo(y, h(N, z, ne), N); }), y; } function LT(c, h) { var y = {}; - return h = Ut(h, 3), Os(c, function(N, W, ne) { - fo(y, W, h(N, W, ne)); + return h = Ut(h, 3), Os(c, function(N, z, ne) { + fo(y, z, h(N, z, ne)); }), y; } var kT = Vc(function(c, h, y) { @@ -24713,8 +24721,8 @@ S0.exports; h = Xr(h, function(ne) { return ne = Zo(ne, c), N || (N = ne.length > 1), ne; }), Ns(c, Cg(c), y), N && (y = Hi(y, p | w | _, RM)); - for (var W = h.length; W--; ) - xg(y, h[W]); + for (var z = h.length; z--; ) + xg(y, h[z]); return y; }); function BT(c, h) { @@ -24729,33 +24737,33 @@ S0.exports; var y = Xr(Cg(c), function(N) { return [N]; }); - return h = Ut(h), fw(c, y, function(N, W) { - return h(N, W[0]); + return h = Ut(h), fw(c, y, function(N, z) { + return h(N, z[0]); }); } function jT(c, h, y) { h = Zo(h, c); - var N = -1, W = h.length; - for (W || (W = 1, c = r); ++N < W; ) { + var N = -1, z = h.length; + for (z || (z = 1, c = r); ++N < z; ) { var ne = c == null ? r : c[Ls(h[N])]; - ne === r && (N = W, ne = y), c = go(ne) ? ne.call(c) : ne; + ne === r && (N = z, ne = y), c = go(ne) ? ne.call(c) : ne; } return c; } function UT(c, h, y) { - return c == null ? c : vf(c, h, y); + return c == null ? c : bf(c, h, y); } function qT(c, h, y, N) { - return N = typeof N == "function" ? N : r, c == null ? c : vf(c, h, y, N); + return N = typeof N == "function" ? N : r, c == null ? c : bf(c, h, y, N); } var w2 = Dw(Mn), x2 = Dw(di); function zT(c, h, y) { - var N = ir(c), W = N || ea(c) || Jc(c); + var N = ir(c), z = N || ea(c) || Jc(c); if (h = Ut(h, 4), y == null) { var ne = c && c.constructor; - W ? y = N ? new ne() : [] : Zr(c) ? y = go(ne) ? Kc(Lh(c)) : {} : y = {}; + z ? y = N ? new ne() : [] : Zr(c) ? y = go(ne) ? Kc(Lh(c)) : {} : y = {}; } - return (W ? qi : Os)(c, function(fe, me, we) { + return (z ? qi : Os)(c, function(fe, me, we) { return h(y, fe, me, we); }), y; } @@ -24786,8 +24794,8 @@ S0.exports; c = h, h = N; } if (y || c % 1 || h % 1) { - var W = Hy(); - return Kn(c + W * (h - c + jr("1e-" + ((W + "").length - 1))), h); + var z = Hy(); + return Kn(c + z * (h - c + jr("1e-" + ((z + "").length - 1))), h); } return bg(c, h); } @@ -24804,8 +24812,8 @@ S0.exports; c = Cr(c), h = Ii(h); var N = c.length; y = y === r ? N : za(cr(y), 0, N); - var W = y; - return y -= h.length, y >= 0 && c.slice(y, W) == h; + var z = y; + return y -= h.length, y >= 0 && c.slice(y, z) == h; } function QT(c) { return c = Cr(c), c && Ct.test(c) ? c.replace(Dt, qA) : c; @@ -24823,8 +24831,8 @@ S0.exports; var N = h ? Uc(c) : 0; if (!h || N >= h) return c; - var W = (h - N) / 2; - return Zh(Fh(W), y) + c + Zh(Bh(W), y); + var z = (h - N) / 2; + return Zh(Fh(z), y) + c + Zh(Bh(z), y); } function sR(c, h, y) { c = Cr(c), h = cr(h); @@ -24861,7 +24869,7 @@ S0.exports; function pR(c, h, y) { var N = te.templateSettings; y && ii(c, h, y) && (h = r), c = Cr(c), h = fd({}, h, N, Ow); - var W = fd({}, h.imports, N.imports, Ow), ne = Mn(W), fe = rg(W, ne), me, we, We = 0, He = h.interpolate || St, Xe = "__p += '", wt = ig( + var z = fd({}, h.imports, N.imports, Ow), ne = Mn(z), fe = rg(z, ne), me, we, We = 0, He = h.interpolate || St, Xe = "__p += '", wt = ig( (h.escape || St).source + "|" + He.source + "|" + (He === Nt ? xe : St).source + "|" + (h.evaluate || St).source + "|$", "g" ), Ot = "//# sourceURL=" + (Tr.call(h, "sourceURL") ? (h.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++Gp + "]") + ` @@ -24909,7 +24917,7 @@ function print() { __p += __j.call(arguments, '') } return Ny(c); if (!c || !(h = Ii(h))) return c; - var N = ds(c), W = ds(h), ne = Ly(N, W), fe = ky(N, W) + 1; + var N = ds(c), z = ds(h), ne = Ly(N, z), fe = ky(N, z) + 1; return Qo(N, ne, fe).join(""); } function bR(c, h, y) { @@ -24917,21 +24925,21 @@ function print() { __p += __j.call(arguments, '') } return c.slice(0, By(c) + 1); if (!c || !(h = Ii(h))) return c; - var N = ds(c), W = ky(N, ds(h)) + 1; - return Qo(N, 0, W).join(""); + var N = ds(c), z = ky(N, ds(h)) + 1; + return Qo(N, 0, z).join(""); } function yR(c, h, y) { if (c = Cr(c), c && (y || h === r)) return c.replace($, ""); if (!c || !(h = Ii(h))) return c; - var N = ds(c), W = Ly(N, ds(h)); - return Qo(N, W).join(""); + var N = ds(c), z = Ly(N, ds(h)); + return Qo(N, z).join(""); } function wR(c, h) { var y = Ee, N = Y; if (Zr(h)) { - var W = "separator" in h ? h.separator : W; + var z = "separator" in h ? h.separator : z; y = "length" in h ? cr(h.length) : y, N = "omission" in h ? Ii(h.omission) : N; } c = Cr(c); @@ -24946,17 +24954,17 @@ function print() { __p += __j.call(arguments, '') } if (me < 1) return N; var we = fe ? Qo(fe, 0, me).join("") : c.slice(0, me); - if (W === r) + if (z === r) return we + N; - if (fe && (me += we.length - me), qg(W)) { - if (c.slice(me).search(W)) { + if (fe && (me += we.length - me), qg(z)) { + if (c.slice(me).search(z)) { var We, He = we; - for (W.global || (W = ig(W.source, Cr(Te.exec(W)) + "g")), W.lastIndex = 0; We = W.exec(He); ) + for (z.global || (z = ig(z.source, Cr(Te.exec(z)) + "g")), z.lastIndex = 0; We = z.exec(He); ) var Xe = We.index; we = we.slice(0, Xe === r ? me : Xe); } - } else if (c.indexOf(Ii(W), me) != me) { - var wt = we.lastIndexOf(W); + } else if (c.indexOf(Ii(z), me) != me) { + var wt = we.lastIndexOf(z); wt > -1 && (we = we.slice(0, wt)); } return we + N; @@ -24988,8 +24996,8 @@ function print() { __p += __j.call(arguments, '') } throw new zi(o); return [y(N[0]), N[1]]; }) : [], hr(function(N) { - for (var W = -1; ++W < h; ) { - var ne = c[W]; + for (var z = -1; ++z < h; ) { + var ne = c[z]; if (Pn(ne[0], this, N)) return Pn(ne[1], this, N); } @@ -25021,18 +25029,18 @@ function print() { __p += __j.call(arguments, '') } } var RR = hr(function(c, h) { return function(y) { - return gf(y, c, h); + return mf(y, c, h); }; }), DR = hr(function(c, h) { return function(y) { - return gf(c, y, h); + return mf(c, y, h); }; }); function Gg(c, h, y) { - var N = Mn(h), W = Hh(h, N); - y == null && !(Zr(h) && (W.length || !N.length)) && (y = h, h = c, c = this, W = Hh(h, Mn(h))); + var N = Mn(h), z = Hh(h, N); + y == null && !(Zr(h) && (z.length || !N.length)) && (y = h, h = c, c = this, z = Hh(h, Mn(h))); var ne = !(Zr(y) && "chain" in y) || !!y.chain, fe = go(c); - return qi(W, function(me) { + return qi(z, function(me) { var we = h[me]; c[me] = we, fe && (c.prototype[me] = function() { var We = this.__chain__; @@ -25084,9 +25092,9 @@ function print() { __p += __j.call(arguments, '') } return []; var y = M, N = Kn(c, M); h = Ut(h), c -= M; - for (var W = tg(N, h); ++y < c; ) + for (var z = tg(N, h); ++y < c; ) h(y); - return W; + return z; } function HR(c) { return ir(c) ? Xr(c, Ls) : Ci(c) ? [c] : li(Kw(Cr(c))); @@ -25129,7 +25137,7 @@ function print() { __p += __j.call(arguments, '') } function aD(c, h) { return c && c.length ? eg(c, Ut(h, 2)) : 0; } - return te.after = CC, te.ary = n2, te.assign = mT, te.assignIn = v2, te.assignInWith = fd, te.assignWith = vT, te.at = bT, te.before = i2, te.bind = Fg, te.bindAll = ER, te.bindKey = s2, te.castArray = UC, te.chain = e2, te.chunk = JM, te.compact = XM, te.concat = ZM, te.cond = SR, te.conforms = AR, te.constant = Kg, te.countBy = oC, te.create = yT, te.curry = o2, te.curryRight = a2, te.debounce = c2, te.defaults = wT, te.defaultsDeep = xT, te.defer = TC, te.delay = RC, te.difference = QM, te.differenceBy = eI, te.differenceWith = tI, te.drop = rI, te.dropRight = nI, te.dropRightWhile = iI, te.dropWhile = sI, te.fill = oI, te.filter = cC, te.flatMap = lC, te.flatMapDeep = hC, te.flatMapDepth = dC, te.flatten = Jw, te.flattenDeep = aI, te.flattenDepth = cI, te.flip = DC, te.flow = MR, te.flowRight = IR, te.fromPairs = uI, te.functions = IT, te.functionsIn = CT, te.groupBy = pC, te.initial = lI, te.intersection = hI, te.intersectionBy = dI, te.intersectionWith = pI, te.invert = RT, te.invertBy = DT, te.invokeMap = mC, te.iteratee = Vg, te.keyBy = vC, te.keys = Mn, te.keysIn = di, te.map = id, te.mapKeys = NT, te.mapValues = LT, te.matches = CR, te.matchesProperty = TR, te.memoize = od, te.merge = kT, te.mergeWith = b2, te.method = RR, te.methodOf = DR, te.mixin = Gg, te.negate = ad, te.nthArg = NR, te.omit = $T, te.omitBy = BT, te.once = OC, te.orderBy = bC, te.over = LR, te.overArgs = NC, te.overEvery = kR, te.overSome = $R, te.partial = jg, te.partialRight = u2, te.partition = yC, te.pick = FT, te.pickBy = y2, te.property = P2, te.propertyOf = BR, te.pull = bI, te.pullAll = Zw, te.pullAllBy = yI, te.pullAllWith = wI, te.pullAt = xI, te.range = FR, te.rangeRight = jR, te.rearg = LC, te.reject = _C, te.remove = _I, te.rest = kC, te.reverse = $g, te.sampleSize = SC, te.set = UT, te.setWith = qT, te.shuffle = AC, te.slice = EI, te.sortBy = IC, te.sortedUniq = TI, te.sortedUniqBy = RI, te.split = lR, te.spread = $C, te.tail = DI, te.take = OI, te.takeRight = NI, te.takeRightWhile = LI, te.takeWhile = kI, te.tap = XI, te.throttle = BC, te.thru = nd, te.toArray = p2, te.toPairs = w2, te.toPairsIn = x2, te.toPath = HR, te.toPlainObject = m2, te.transform = zT, te.unary = FC, te.union = $I, te.unionBy = BI, te.unionWith = FI, te.uniq = jI, te.uniqBy = UI, te.uniqWith = qI, te.unset = WT, te.unzip = Bg, te.unzipWith = Qw, te.update = HT, te.updateWith = KT, te.values = Xc, te.valuesIn = VT, te.without = zI, te.words = S2, te.wrap = jC, te.xor = WI, te.xorBy = HI, te.xorWith = KI, te.zip = VI, te.zipObject = GI, te.zipObjectDeep = YI, te.zipWith = JI, te.entries = w2, te.entriesIn = x2, te.extend = v2, te.extendWith = fd, Gg(te, te), te.add = VR, te.attempt = A2, te.camelCase = XT, te.capitalize = _2, te.ceil = GR, te.clamp = GT, te.clone = qC, te.cloneDeep = WC, te.cloneDeepWith = HC, te.cloneWith = zC, te.conformsTo = KC, te.deburr = E2, te.defaultTo = PR, te.divide = YR, te.endsWith = ZT, te.eq = gs, te.escape = QT, te.escapeRegExp = eR, te.every = aC, te.find = uC, te.findIndex = Gw, te.findKey = _T, te.findLast = fC, te.findLastIndex = Yw, te.findLastKey = ET, te.floor = JR, te.forEach = t2, te.forEachRight = r2, te.forIn = ST, te.forInRight = AT, te.forOwn = PT, te.forOwnRight = MT, te.get = zg, te.gt = VC, te.gte = GC, te.has = TT, te.hasIn = Wg, te.head = Xw, te.identity = pi, te.includes = gC, te.indexOf = fI, te.inRange = YT, te.invoke = OT, te.isArguments = Va, te.isArray = ir, te.isArrayBuffer = YC, te.isArrayLike = hi, te.isArrayLikeObject = cn, te.isBoolean = JC, te.isBuffer = ea, te.isDate = XC, te.isElement = ZC, te.isEmpty = QC, te.isEqual = eT, te.isEqualWith = tT, te.isError = Ug, te.isFinite = rT, te.isFunction = go, te.isInteger = f2, te.isLength = cd, te.isMap = l2, te.isMatch = nT, te.isMatchWith = iT, te.isNaN = sT, te.isNative = oT, te.isNil = cT, te.isNull = aT, te.isNumber = h2, te.isObject = Zr, te.isObjectLike = en, te.isPlainObject = xf, te.isRegExp = qg, te.isSafeInteger = uT, te.isSet = d2, te.isString = ud, te.isSymbol = Ci, te.isTypedArray = Jc, te.isUndefined = fT, te.isWeakMap = lT, te.isWeakSet = hT, te.join = gI, te.kebabCase = tR, te.last = Vi, te.lastIndexOf = mI, te.lowerCase = rR, te.lowerFirst = nR, te.lt = dT, te.lte = pT, te.max = XR, te.maxBy = ZR, te.mean = QR, te.meanBy = eD, te.min = tD, te.minBy = rD, te.stubArray = Jg, te.stubFalse = Xg, te.stubObject = UR, te.stubString = qR, te.stubTrue = zR, te.multiply = nD, te.nth = vI, te.noConflict = OR, te.noop = Yg, te.now = sd, te.pad = iR, te.padEnd = sR, te.padStart = oR, te.parseInt = aR, te.random = JT, te.reduce = wC, te.reduceRight = xC, te.repeat = cR, te.replace = uR, te.result = jT, te.round = iD, te.runInContext = be, te.sample = EC, te.size = PC, te.snakeCase = fR, te.some = MC, te.sortedIndex = SI, te.sortedIndexBy = AI, te.sortedIndexOf = PI, te.sortedLastIndex = MI, te.sortedLastIndexBy = II, te.sortedLastIndexOf = CI, te.startCase = hR, te.startsWith = dR, te.subtract = sD, te.sum = oD, te.sumBy = aD, te.template = pR, te.times = WR, te.toFinite = mo, te.toInteger = cr, te.toLength = g2, te.toLower = gR, te.toNumber = Gi, te.toSafeInteger = gT, te.toString = Cr, te.toUpper = mR, te.trim = vR, te.trimEnd = bR, te.trimStart = yR, te.truncate = wR, te.unescape = xR, te.uniqueId = KR, te.upperCase = _R, te.upperFirst = Hg, te.each = t2, te.eachRight = r2, te.first = Xw, Gg(te, function() { + return te.after = CC, te.ary = n2, te.assign = mT, te.assignIn = v2, te.assignInWith = fd, te.assignWith = vT, te.at = bT, te.before = i2, te.bind = Fg, te.bindAll = ER, te.bindKey = s2, te.castArray = UC, te.chain = e2, te.chunk = JM, te.compact = XM, te.concat = ZM, te.cond = SR, te.conforms = AR, te.constant = Kg, te.countBy = oC, te.create = yT, te.curry = o2, te.curryRight = a2, te.debounce = c2, te.defaults = wT, te.defaultsDeep = xT, te.defer = TC, te.delay = RC, te.difference = QM, te.differenceBy = eI, te.differenceWith = tI, te.drop = rI, te.dropRight = nI, te.dropRightWhile = iI, te.dropWhile = sI, te.fill = oI, te.filter = cC, te.flatMap = lC, te.flatMapDeep = hC, te.flatMapDepth = dC, te.flatten = Jw, te.flattenDeep = aI, te.flattenDepth = cI, te.flip = DC, te.flow = MR, te.flowRight = IR, te.fromPairs = uI, te.functions = IT, te.functionsIn = CT, te.groupBy = pC, te.initial = lI, te.intersection = hI, te.intersectionBy = dI, te.intersectionWith = pI, te.invert = RT, te.invertBy = DT, te.invokeMap = mC, te.iteratee = Vg, te.keyBy = vC, te.keys = Mn, te.keysIn = di, te.map = id, te.mapKeys = NT, te.mapValues = LT, te.matches = CR, te.matchesProperty = TR, te.memoize = od, te.merge = kT, te.mergeWith = b2, te.method = RR, te.methodOf = DR, te.mixin = Gg, te.negate = ad, te.nthArg = NR, te.omit = $T, te.omitBy = BT, te.once = OC, te.orderBy = bC, te.over = LR, te.overArgs = NC, te.overEvery = kR, te.overSome = $R, te.partial = jg, te.partialRight = u2, te.partition = yC, te.pick = FT, te.pickBy = y2, te.property = P2, te.propertyOf = BR, te.pull = bI, te.pullAll = Zw, te.pullAllBy = yI, te.pullAllWith = wI, te.pullAt = xI, te.range = FR, te.rangeRight = jR, te.rearg = LC, te.reject = _C, te.remove = _I, te.rest = kC, te.reverse = $g, te.sampleSize = SC, te.set = UT, te.setWith = qT, te.shuffle = AC, te.slice = EI, te.sortBy = IC, te.sortedUniq = TI, te.sortedUniqBy = RI, te.split = lR, te.spread = $C, te.tail = DI, te.take = OI, te.takeRight = NI, te.takeRightWhile = LI, te.takeWhile = kI, te.tap = XI, te.throttle = BC, te.thru = nd, te.toArray = p2, te.toPairs = w2, te.toPairsIn = x2, te.toPath = HR, te.toPlainObject = m2, te.transform = zT, te.unary = FC, te.union = $I, te.unionBy = BI, te.unionWith = FI, te.uniq = jI, te.uniqBy = UI, te.uniqWith = qI, te.unset = WT, te.unzip = Bg, te.unzipWith = Qw, te.update = HT, te.updateWith = KT, te.values = Xc, te.valuesIn = VT, te.without = zI, te.words = S2, te.wrap = jC, te.xor = WI, te.xorBy = HI, te.xorWith = KI, te.zip = VI, te.zipObject = GI, te.zipObjectDeep = YI, te.zipWith = JI, te.entries = w2, te.entriesIn = x2, te.extend = v2, te.extendWith = fd, Gg(te, te), te.add = VR, te.attempt = A2, te.camelCase = XT, te.capitalize = _2, te.ceil = GR, te.clamp = GT, te.clone = qC, te.cloneDeep = WC, te.cloneDeepWith = HC, te.cloneWith = zC, te.conformsTo = KC, te.deburr = E2, te.defaultTo = PR, te.divide = YR, te.endsWith = ZT, te.eq = gs, te.escape = QT, te.escapeRegExp = eR, te.every = aC, te.find = uC, te.findIndex = Gw, te.findKey = _T, te.findLast = fC, te.findLastIndex = Yw, te.findLastKey = ET, te.floor = JR, te.forEach = t2, te.forEachRight = r2, te.forIn = ST, te.forInRight = AT, te.forOwn = PT, te.forOwnRight = MT, te.get = zg, te.gt = VC, te.gte = GC, te.has = TT, te.hasIn = Wg, te.head = Xw, te.identity = pi, te.includes = gC, te.indexOf = fI, te.inRange = YT, te.invoke = OT, te.isArguments = Va, te.isArray = ir, te.isArrayBuffer = YC, te.isArrayLike = hi, te.isArrayLikeObject = cn, te.isBoolean = JC, te.isBuffer = ea, te.isDate = XC, te.isElement = ZC, te.isEmpty = QC, te.isEqual = eT, te.isEqualWith = tT, te.isError = Ug, te.isFinite = rT, te.isFunction = go, te.isInteger = f2, te.isLength = cd, te.isMap = l2, te.isMatch = nT, te.isMatchWith = iT, te.isNaN = sT, te.isNative = oT, te.isNil = cT, te.isNull = aT, te.isNumber = h2, te.isObject = Zr, te.isObjectLike = en, te.isPlainObject = _f, te.isRegExp = qg, te.isSafeInteger = uT, te.isSet = d2, te.isString = ud, te.isSymbol = Ci, te.isTypedArray = Jc, te.isUndefined = fT, te.isWeakMap = lT, te.isWeakSet = hT, te.join = gI, te.kebabCase = tR, te.last = Vi, te.lastIndexOf = mI, te.lowerCase = rR, te.lowerFirst = nR, te.lt = dT, te.lte = pT, te.max = XR, te.maxBy = ZR, te.mean = QR, te.meanBy = eD, te.min = tD, te.minBy = rD, te.stubArray = Jg, te.stubFalse = Xg, te.stubObject = UR, te.stubString = qR, te.stubTrue = zR, te.multiply = nD, te.nth = vI, te.noConflict = OR, te.noop = Yg, te.now = sd, te.pad = iR, te.padEnd = sR, te.padStart = oR, te.parseInt = aR, te.random = JT, te.reduce = wC, te.reduceRight = xC, te.repeat = cR, te.replace = uR, te.result = jT, te.round = iD, te.runInContext = be, te.sample = EC, te.size = PC, te.snakeCase = fR, te.some = MC, te.sortedIndex = SI, te.sortedIndexBy = AI, te.sortedIndexOf = PI, te.sortedLastIndex = MI, te.sortedLastIndexBy = II, te.sortedLastIndexOf = CI, te.startCase = hR, te.startsWith = dR, te.subtract = sD, te.sum = oD, te.sumBy = aD, te.template = pR, te.times = WR, te.toFinite = mo, te.toInteger = cr, te.toLength = g2, te.toLower = gR, te.toNumber = Gi, te.toSafeInteger = gT, te.toString = Cr, te.toUpper = mR, te.trim = vR, te.trimEnd = bR, te.trimStart = yR, te.truncate = wR, te.unescape = xR, te.uniqueId = KR, te.upperCase = _R, te.upperFirst = Hg, te.each = t2, te.eachRight = r2, te.first = Xw, Gg(te, function() { var c = {}; return Os(te, function(h, y) { Tr.call(te.prototype, y) || (c[y] = h); @@ -25149,10 +25157,10 @@ function print() { __p += __j.call(arguments, '') } }; }), qi(["filter", "map", "takeWhile"], function(c, h) { var y = h + 1, N = y == f || y == b; - xr.prototype[c] = function(W) { + xr.prototype[c] = function(z) { var ne = this.clone(); return ne.__iteratees__.push({ - iteratee: Ut(W, 3), + iteratee: Ut(z, 3), type: y }), ne.__filtered__ = ne.__filtered__ || N, ne; }; @@ -25174,7 +25182,7 @@ function print() { __p += __j.call(arguments, '') } return this.reverse().find(c); }, xr.prototype.invokeMap = hr(function(c, h) { return typeof c == "function" ? new xr(this) : this.map(function(y) { - return gf(y, c, h); + return mf(y, c, h); }); }), xr.prototype.reject = function(c) { return this.filter(ad(Ut(c))); @@ -25187,10 +25195,10 @@ function print() { __p += __j.call(arguments, '') } }, xr.prototype.toArray = function() { return this.take(M); }, Os(xr.prototype, function(c, h) { - var y = /^(?:filter|find|map|reject)|While$/.test(h), N = /^(?:head|last)$/.test(h), W = te[N ? "take" + (h == "last" ? "Right" : "") : h], ne = N || /^find/.test(h); - W && (te.prototype[h] = function() { + var y = /^(?:filter|find|map|reject)|While$/.test(h), N = /^(?:head|last)$/.test(h), z = te[N ? "take" + (h == "last" ? "Right" : "") : h], ne = N || /^find/.test(h); + z && (te.prototype[h] = function() { var fe = this.__wrapped__, me = N ? [1] : arguments, we = fe instanceof xr, We = me[0], He = we || ir(fe), Xe = function(br) { - var Sr = W.apply(te, Vo([br], me)); + var Sr = z.apply(te, Vo([br], me)); return N && wt ? Sr[0] : Sr; }; He && y && typeof We == "function" && We.length != 1 && (we = He = !1); @@ -25205,13 +25213,13 @@ function print() { __p += __j.call(arguments, '') } }), qi(["pop", "push", "shift", "sort", "splice", "unshift"], function(c) { var h = Ch[c], y = /^(?:push|sort|unshift)$/.test(c) ? "tap" : "thru", N = /^(?:pop|shift)$/.test(c); te.prototype[c] = function() { - var W = arguments; + var z = arguments; if (N && !this.__chain__) { var ne = this.value(); - return h.apply(ir(ne) ? ne : [], W); + return h.apply(ir(ne) ? ne : [], z); } return this[y](function(fe) { - return h.apply(ir(fe) ? fe : [], W); + return h.apply(ir(fe) ? fe : [], z); }); }; }), Os(xr.prototype, function(c, h) { @@ -25223,12 +25231,12 @@ function print() { __p += __j.call(arguments, '') } }), Hc[Jh(r, B).name] = [{ name: "wrapper", func: r - }], xr.prototype.clone = xP, xr.prototype.reverse = _P, xr.prototype.value = EP, te.prototype.at = ZI, te.prototype.chain = QI, te.prototype.commit = eC, te.prototype.next = tC, te.prototype.plant = nC, te.prototype.reverse = iC, te.prototype.toJSON = te.prototype.valueOf = te.prototype.value = sC, te.prototype.first = te.prototype.head, cf && (te.prototype[cf] = rC), te; + }], xr.prototype.clone = xP, xr.prototype.reverse = _P, xr.prototype.value = EP, te.prototype.at = ZI, te.prototype.chain = QI, te.prototype.commit = eC, te.prototype.next = tC, te.prototype.plant = nC, te.prototype.reverse = iC, te.prototype.toJSON = te.prototype.valueOf = te.prototype.value = sC, te.prototype.first = te.prototype.head, uf && (te.prototype[uf] = rC), te; }, qc = eP(); an ? ((an.exports = qc)._ = qc, Ur._ = qc) : Er._ = qc; }).call(gn); })(S0, S0.exports); -var RG = S0.exports, Y1 = { exports: {} }; +var DG = S0.exports, Y1 = { exports: {} }; (function(t, e) { var r = typeof self < "u" ? self : gn, n = function() { function s() { @@ -25349,7 +25357,7 @@ var RG = S0.exports, Y1 = { exports: {} }; var g = new FileReader(), b = L(g); return g.readAsText(f), b; } - function q(f) { + function W(f) { for (var g = new Uint8Array(f), b = new Array(g.length), x = 0; x < g.length; x++) b[x] = String.fromCharCode(g[x]); return b.join(""); @@ -25383,7 +25391,7 @@ var RG = S0.exports, Y1 = { exports: {} }; if (this._bodyBlob) return k(this._bodyBlob); if (this._bodyArrayBuffer) - return Promise.resolve(q(this._bodyArrayBuffer)); + return Promise.resolve(W(this._bodyArrayBuffer)); if (this._bodyFormData) throw new Error("could not read FormData body as text"); return Promise.resolve(this._bodyText); @@ -25500,14 +25508,14 @@ var RG = S0.exports, Y1 = { exports: {} }; var i = n; e = i.fetch, e.default = i.fetch, e.fetch = i.fetch, e.Headers = i.Headers, e.Request = i.Request, e.Response = i.Response, t.exports = e; })(Y1, Y1.exports); -var DG = Y1.exports; -const Q3 = /* @__PURE__ */ ns(DG); -var OG = Object.defineProperty, NG = Object.defineProperties, LG = Object.getOwnPropertyDescriptors, e_ = Object.getOwnPropertySymbols, kG = Object.prototype.hasOwnProperty, $G = Object.prototype.propertyIsEnumerable, t_ = (t, e, r) => e in t ? OG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, r_ = (t, e) => { - for (var r in e || (e = {})) kG.call(e, r) && t_(t, r, e[r]); - if (e_) for (var r of e_(e)) $G.call(e, r) && t_(t, r, e[r]); +var OG = Y1.exports; +const Q3 = /* @__PURE__ */ ns(OG); +var NG = Object.defineProperty, LG = Object.defineProperties, kG = Object.getOwnPropertyDescriptors, e_ = Object.getOwnPropertySymbols, $G = Object.prototype.hasOwnProperty, BG = Object.prototype.propertyIsEnumerable, t_ = (t, e, r) => e in t ? NG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, r_ = (t, e) => { + for (var r in e || (e = {})) $G.call(e, r) && t_(t, r, e[r]); + if (e_) for (var r of e_(e)) BG.call(e, r) && t_(t, r, e[r]); return t; -}, n_ = (t, e) => NG(t, LG(e)); -const BG = { Accept: "application/json", "Content-Type": "application/json" }, FG = "POST", i_ = { headers: BG, method: FG }, s_ = 10; +}, n_ = (t, e) => LG(t, kG(e)); +const FG = { Accept: "application/json", "Content-Type": "application/json" }, jG = "POST", i_ = { headers: FG, method: jG }, s_ = 10; let Cs = class { constructor(e, r = !1) { if (this.url = e, this.disableProviderPing = r, this.events = new is.EventEmitter(), this.isAvailable = !1, this.registering = !1, !A3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); @@ -25594,15 +25602,15 @@ let Cs = class { this.events.getMaxListeners() > s_ && this.events.setMaxListeners(s_); } }; -const o_ = "error", jG = "wss://relay.walletconnect.org", UG = "wc", qG = "universal_provider", a_ = `${UG}@2:${qG}:`, YE = "https://rpc.walletconnect.org/v1/", au = "generic", zG = `${YE}bundler`, fs = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; -var WG = Object.defineProperty, HG = Object.defineProperties, KG = Object.getOwnPropertyDescriptors, c_ = Object.getOwnPropertySymbols, VG = Object.prototype.hasOwnProperty, GG = Object.prototype.propertyIsEnumerable, u_ = (t, e, r) => e in t ? WG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, _d = (t, e) => { - for (var r in e || (e = {})) VG.call(e, r) && u_(t, r, e[r]); - if (c_) for (var r of c_(e)) GG.call(e, r) && u_(t, r, e[r]); +const o_ = "error", UG = "wss://relay.walletconnect.org", qG = "wc", zG = "universal_provider", a_ = `${qG}@2:${zG}:`, YE = "https://rpc.walletconnect.org/v1/", au = "generic", WG = `${YE}bundler`, fs = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; +var HG = Object.defineProperty, KG = Object.defineProperties, VG = Object.getOwnPropertyDescriptors, c_ = Object.getOwnPropertySymbols, GG = Object.prototype.hasOwnProperty, YG = Object.prototype.propertyIsEnumerable, u_ = (t, e, r) => e in t ? HG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, _d = (t, e) => { + for (var r in e || (e = {})) GG.call(e, r) && u_(t, r, e[r]); + if (c_) for (var r of c_(e)) YG.call(e, r) && u_(t, r, e[r]); return t; -}, YG = (t, e) => HG(t, KG(e)); +}, JG = (t, e) => KG(t, VG(e)); function Li(t, e, r) { var n; - const i = _u(t); + const i = Eu(t); return ((n = e.rpcMap) == null ? void 0 : n[i.reference]) || `${YE}?chainId=${i.namespace}:${i.reference}&projectId=${r}`; } function Nc(t) { @@ -25611,7 +25619,7 @@ function Nc(t) { function JE(t) { return t.map((e) => `${e.split(":")[0]}:${e.split(":")[1]}`); } -function JG(t, e) { +function XG(t, e) { const r = Object.keys(e.namespaces).filter((i) => i.includes(t)); if (!r.length) return []; const n = []; @@ -25622,19 +25630,19 @@ function JG(t, e) { } function Dm(t = {}, e = {}) { const r = f_(t), n = f_(e); - return RG.merge(r, n); + return DG.merge(r, n); } function f_(t) { var e, r, n, i; const s = {}; if (!Ll(t)) return s; for (const [o, a] of Object.entries(t)) { - const u = _b(o) ? [o] : a.chains, l = a.methods || [], d = a.events || [], p = a.rpcMap || {}, w = Kf(o); - s[w] = YG(_d(_d({}, s[w]), a), { chains: jd(u, (e = s[w]) == null ? void 0 : e.chains), methods: jd(l, (r = s[w]) == null ? void 0 : r.methods), events: jd(d, (n = s[w]) == null ? void 0 : n.events), rpcMap: _d(_d({}, p), (i = s[w]) == null ? void 0 : i.rpcMap) }); + const u = _b(o) ? [o] : a.chains, l = a.methods || [], d = a.events || [], p = a.rpcMap || {}, w = Vf(o); + s[w] = JG(_d(_d({}, s[w]), a), { chains: jd(u, (e = s[w]) == null ? void 0 : e.chains), methods: jd(l, (r = s[w]) == null ? void 0 : r.methods), events: jd(d, (n = s[w]) == null ? void 0 : n.events), rpcMap: _d(_d({}, p), (i = s[w]) == null ? void 0 : i.rpcMap) }); } return s; } -function XG(t) { +function ZG(t) { return t.includes(":") ? t.split(":")[2] : t; } function l_(t) { @@ -25651,7 +25659,7 @@ function Om(t) { const XE = {}, Pr = (t) => XE[t], Nm = (t, e) => { XE[t] = e; }; -class ZG { +class QG { constructor(e) { this.name = "polkadot", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25701,12 +25709,12 @@ class ZG { return new us(new Cs(n, Pr("disableProviderPing"))); } } -var QG = Object.defineProperty, eY = Object.defineProperties, tY = Object.getOwnPropertyDescriptors, h_ = Object.getOwnPropertySymbols, rY = Object.prototype.hasOwnProperty, nY = Object.prototype.propertyIsEnumerable, d_ = (t, e, r) => e in t ? QG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, p_ = (t, e) => { - for (var r in e || (e = {})) rY.call(e, r) && d_(t, r, e[r]); - if (h_) for (var r of h_(e)) nY.call(e, r) && d_(t, r, e[r]); +var eY = Object.defineProperty, tY = Object.defineProperties, rY = Object.getOwnPropertyDescriptors, h_ = Object.getOwnPropertySymbols, nY = Object.prototype.hasOwnProperty, iY = Object.prototype.propertyIsEnumerable, d_ = (t, e, r) => e in t ? eY(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, p_ = (t, e) => { + for (var r in e || (e = {})) nY.call(e, r) && d_(t, r, e[r]); + if (h_) for (var r of h_(e)) iY.call(e, r) && d_(t, r, e[r]); return t; -}, g_ = (t, e) => eY(t, tY(e)); -class iY { +}, g_ = (t, e) => tY(t, rY(e)); +class sY { constructor(e) { this.name = "eip155", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.httpProviders = this.createHttpProviders(), this.chainId = parseInt(this.getDefaultChain()); } @@ -25823,10 +25831,10 @@ class iY { return await s.json(); } getBundlerUrl(e, r) { - return `${zG}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`; + return `${WG}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`; } } -class sY { +class oY { constructor(e) { this.name = "solana", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25876,7 +25884,7 @@ class sY { return new us(new Cs(n, Pr("disableProviderPing"))); } } -let oY = class { +let aY = class { constructor(e) { this.name = "cosmos", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25925,7 +25933,7 @@ let oY = class { if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); return new us(new Cs(n, Pr("disableProviderPing"))); } -}, aY = class { +}, cY = class { constructor(e) { this.name = "algorand", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -25977,7 +25985,7 @@ let oY = class { const n = r || Li(e, this.namespace, this.client.core.projectId); return typeof n > "u" ? void 0 : new us(new Cs(n, Pr("disableProviderPing"))); } -}, cY = class { +}, uY = class { constructor(e) { this.name = "cip34", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -26029,7 +26037,7 @@ let oY = class { if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); return new us(new Cs(n, Pr("disableProviderPing"))); } -}, uY = class { +}, fY = class { constructor(e) { this.name = "elrond", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -26079,7 +26087,7 @@ let oY = class { return new us(new Cs(n, Pr("disableProviderPing"))); } }; -class fY { +class lY { constructor(e) { this.name = "multiversx", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -26129,7 +26137,7 @@ class fY { return new us(new Cs(n, Pr("disableProviderPing"))); } } -let lY = class { +let hY = class { constructor(e) { this.name = "near", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -26182,7 +26190,7 @@ let lY = class { return typeof n > "u" ? void 0 : new us(new Cs(n, Pr("disableProviderPing"))); } }; -class hY { +class dY { constructor(e) { this.name = "tezos", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -26234,7 +26242,7 @@ class hY { return typeof n > "u" ? void 0 : new us(new Cs(n)); } } -class dY { +class pY { constructor(e) { this.name = au, this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); } @@ -26265,7 +26273,7 @@ class dY { var e, r; const n = {}; return (r = (e = this.namespace) == null ? void 0 : e.accounts) == null || r.forEach((i) => { - const s = _u(i); + const s = Eu(i); n[`${s.namespace}:${s.reference}`] = this.createHttpProvider(i); }), n; } @@ -26284,11 +26292,11 @@ class dY { return new us(new Cs(n, Pr("disableProviderPing"))); } } -var pY = Object.defineProperty, gY = Object.defineProperties, mY = Object.getOwnPropertyDescriptors, m_ = Object.getOwnPropertySymbols, vY = Object.prototype.hasOwnProperty, bY = Object.prototype.propertyIsEnumerable, v_ = (t, e, r) => e in t ? pY(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Ed = (t, e) => { - for (var r in e || (e = {})) vY.call(e, r) && v_(t, r, e[r]); - if (m_) for (var r of m_(e)) bY.call(e, r) && v_(t, r, e[r]); +var gY = Object.defineProperty, mY = Object.defineProperties, vY = Object.getOwnPropertyDescriptors, m_ = Object.getOwnPropertySymbols, bY = Object.prototype.hasOwnProperty, yY = Object.prototype.propertyIsEnumerable, v_ = (t, e, r) => e in t ? gY(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Ed = (t, e) => { + for (var r in e || (e = {})) bY.call(e, r) && v_(t, r, e[r]); + if (m_) for (var r of m_(e)) yY.call(e, r) && v_(t, r, e[r]); return t; -}, Lm = (t, e) => gY(t, mY(e)); +}, Lm = (t, e) => mY(t, vY(e)); let J1 = class ZE { constructor(e) { this.events = new Xv(), this.rpcProviders = {}, this.shouldAbortPairingAttempt = !1, this.maxPairingAttempts = 10, this.disableProviderPing = !1, this.providerOpts = e, this.logger = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : Xl(X0({ level: (e == null ? void 0 : e.logger) || o_ })), this.disableProviderPing = (e == null ? void 0 : e.disableProviderPing) || !1; @@ -26394,48 +26402,48 @@ let J1 = class ZE { this.logger.trace("Initialized"), await this.createClient(), await this.checkStorage(), this.registerEventListeners(); } async createClient() { - this.client = this.providerOpts.client || await Ib.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || o_, relayUrl: this.providerOpts.relayUrl || jG, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); + this.client = this.providerOpts.client || await Ib.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || o_, relayUrl: this.providerOpts.relayUrl || UG, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); } createProviders() { if (!this.client) throw new Error("Sign Client not initialized"); if (!this.session) throw new Error("Session not initialized. Please call connect() before enable()"); - const e = [...new Set(Object.keys(this.session.namespaces).map((r) => Kf(r)))]; + const e = [...new Set(Object.keys(this.session.namespaces).map((r) => Vf(r)))]; Nm("client", this.client), Nm("events", this.events), Nm("disableProviderPing", this.disableProviderPing), e.forEach((r) => { if (!this.session) return; - const n = JG(r, this.session), i = JE(n), s = Dm(this.namespaces, this.optionalNamespaces), o = Lm(Ed({}, s[r]), { accounts: n, chains: i }); + const n = XG(r, this.session), i = JE(n), s = Dm(this.namespaces, this.optionalNamespaces), o = Lm(Ed({}, s[r]), { accounts: n, chains: i }); switch (r) { case "eip155": - this.rpcProviders[r] = new iY({ namespace: o }); + this.rpcProviders[r] = new sY({ namespace: o }); break; case "algorand": - this.rpcProviders[r] = new aY({ namespace: o }); + this.rpcProviders[r] = new cY({ namespace: o }); break; case "solana": - this.rpcProviders[r] = new sY({ namespace: o }); + this.rpcProviders[r] = new oY({ namespace: o }); break; case "cosmos": - this.rpcProviders[r] = new oY({ namespace: o }); + this.rpcProviders[r] = new aY({ namespace: o }); break; case "polkadot": - this.rpcProviders[r] = new ZG({ namespace: o }); + this.rpcProviders[r] = new QG({ namespace: o }); break; case "cip34": - this.rpcProviders[r] = new cY({ namespace: o }); + this.rpcProviders[r] = new uY({ namespace: o }); break; case "elrond": - this.rpcProviders[r] = new uY({ namespace: o }); + this.rpcProviders[r] = new fY({ namespace: o }); break; case "multiversx": - this.rpcProviders[r] = new fY({ namespace: o }); + this.rpcProviders[r] = new lY({ namespace: o }); break; case "near": - this.rpcProviders[r] = new lY({ namespace: o }); + this.rpcProviders[r] = new hY({ namespace: o }); break; case "tezos": - this.rpcProviders[r] = new hY({ namespace: o }); + this.rpcProviders[r] = new dY({ namespace: o }); break; default: - this.rpcProviders[au] ? this.rpcProviders[au].updateNamespace(o) : this.rpcProviders[au] = new dY({ namespace: o }); + this.rpcProviders[au] ? this.rpcProviders[au].updateNamespace(o) : this.rpcProviders[au] = new pY({ namespace: o }); } }); } @@ -26447,9 +26455,9 @@ let J1 = class ZE { const { params: r } = e, { event: n } = r; if (n.name === "accountsChanged") { const i = n.data; - i && _c(i) && this.events.emit("accountsChanged", i.map(XG)); + i && _c(i) && this.events.emit("accountsChanged", i.map(ZG)); } else if (n.name === "chainChanged") { - const i = r.chainId, s = r.event.data, o = Kf(i), a = Om(i) !== Om(s) ? `${o}:${Om(s)}` : i; + const i = r.chainId, s = r.event.data, o = Vf(i), a = Om(i) !== Om(s) ? `${o}:${Om(s)}` : i; this.onChainChanged(a); } else this.events.emit(n.name, n.data); this.events.emit("session_event", e); @@ -26479,9 +26487,9 @@ let J1 = class ZE { validateChain(e) { const [r, n] = (e == null ? void 0 : e.split(":")) || ["", ""]; if (!this.namespaces || !Object.keys(this.namespaces).length) return [r, n]; - if (r && !Object.keys(this.namespaces || {}).map((o) => Kf(o)).includes(r)) throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`); + if (r && !Object.keys(this.namespaces || {}).map((o) => Vf(o)).includes(r)) throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`); if (r && n) return [r, n]; - const i = Kf(Object.keys(this.namespaces)[0]), s = this.rpcProviders[i].getDefaultChain(); + const i = Vf(Object.keys(this.namespaces)[0]), s = this.rpcProviders[i].getDefaultChain(); return [i, s]; } async requestAccounts() { @@ -26506,8 +26514,8 @@ let J1 = class ZE { return await this.client.core.storage.getItem(`${a_}/${e}`); } }; -const yY = J1; -function wY() { +const wY = J1; +function xY() { return new Promise((t) => { const e = []; let r; @@ -26643,26 +26651,26 @@ const fn = { standard: "EIP-3085", message: "Unrecognized chain ID." } -}, QE = "Unspecified error message.", xY = "Unspecified server error."; +}, QE = "Unspecified error message.", _Y = "Unspecified server error."; function Cb(t, e = QE) { if (t && Number.isInteger(t)) { const r = t.toString(); if (Z1(X1, r)) return X1[r].message; if (eS(t)) - return xY; + return _Y; } return e; } -function _Y(t) { +function EY(t) { if (!Number.isInteger(t)) return !1; const e = t.toString(); return !!(X1[e] || eS(t)); } -function EY(t, { shouldIncludeStack: e = !1 } = {}) { +function SY(t, { shouldIncludeStack: e = !1 } = {}) { const r = {}; - if (t && typeof t == "object" && !Array.isArray(t) && Z1(t, "code") && _Y(t.code)) { + if (t && typeof t == "object" && !Array.isArray(t) && Z1(t, "code") && EY(t.code)) { const n = t; r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, Z1(n, "data") && (r.data = n.data)) : (r.message = Cb(r.code), r.data = { originalError: b_(t) }); } else @@ -26756,18 +26764,18 @@ class nS extends rS { * `code` must be an integer in the 1000 <= 4999 range. */ constructor(e, r, n) { - if (!SY(e)) + if (!AY(e)) throw new Error('"code" must be an integer such that: 1000 <= code <= 4999'); super(e, r, n); } } -function SY(t) { +function AY(t) { return Number.isInteger(t) && t >= 1e3 && t <= 4999; } function Tb() { return (t) => t; } -const kl = Tb(), AY = Tb(), PY = Tb(); +const kl = Tb(), PY = Tb(), MY = Tb(); function Po(t) { return Math.floor(t); } @@ -26781,15 +26789,15 @@ function Rb(t) { function Wd(t) { return new Uint8Array(t.match(/.{1,2}/g).map((e) => Number.parseInt(e, 16))); } -function Zf(t, e = !1) { +function Qf(t, e = !1) { const r = t.toString("hex"); return kl(e ? `0x${r}` : r); } function km(t) { - return Zf(Q1(t), !0); + return Qf(Q1(t), !0); } function js(t) { - return PY(t.toString(10)); + return MY(t.toString(10)); } function ma(t) { return kl(`0x${BigInt(t).toString(16)}`); @@ -26809,7 +26817,7 @@ function xp(t) { const e = Db(t).toLowerCase(); return sS.test(e); } -function MY(t, e = !1) { +function IY(t, e = !1) { if (typeof t == "string") { const r = Db(t).toLowerCase(); if (sS.test(r)) @@ -26818,14 +26826,14 @@ function MY(t, e = !1) { throw Ar.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`); } function Ob(t, e = !1) { - let r = MY(t, !1); + let r = IY(t, !1); return r.length % 2 === 1 && (r = kl(`0${r}`)), e ? kl(`0x${r}`) : r; } function ia(t) { if (typeof t == "string") { const e = Db(t).toLowerCase(); if (xp(e) && e.length === 40) - return AY(aS(e)); + return PY(aS(e)); } throw Ar.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`); } @@ -26841,7 +26849,7 @@ function Q1(t) { } throw Ar.rpc.invalidParams(`Not binary data: ${String(t)}`); } -function Qf(t) { +function el(t) { if (typeof t == "number" && Number.isInteger(t)) return Po(t); if (typeof t == "string") { @@ -26852,11 +26860,11 @@ function Qf(t) { } throw Ar.rpc.invalidParams(`Not an integer: ${String(t)}`); } -function Bf(t) { - if (t !== null && (typeof t == "bigint" || CY(t))) +function Ff(t) { + if (t !== null && (typeof t == "bigint" || TY(t))) return BigInt(t.toString(10)); if (typeof t == "number") - return BigInt(Qf(t)); + return BigInt(el(t)); if (typeof t == "string") { if (iS.test(t)) return BigInt(t); @@ -26865,26 +26873,26 @@ function Bf(t) { } throw Ar.rpc.invalidParams(`Not an integer: ${String(t)}`); } -function IY(t) { +function CY(t) { if (typeof t == "string") return JSON.parse(t); if (typeof t == "object") return t; throw Ar.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`); } -function CY(t) { +function TY(t) { if (t == null || typeof t.constructor != "function") return !1; const { constructor: e } = t; return typeof e.config == "function" && typeof e.EUCLID == "number"; } -async function TY() { +async function RY() { return crypto.subtle.generateKey({ name: "ECDH", namedCurve: "P-256" }, !0, ["deriveKey"]); } -async function RY(t, e) { +async function DY(t, e) { return crypto.subtle.deriveKey({ name: "ECDH", public: e @@ -26893,14 +26901,14 @@ async function RY(t, e) { length: 256 }, !1, ["encrypt", "decrypt"]); } -async function DY(t, e) { +async function OY(t, e) { const r = crypto.getRandomValues(new Uint8Array(12)), n = await crypto.subtle.encrypt({ name: "AES-GCM", iv: r }, t, new TextEncoder().encode(e)); return { iv: r, cipherText: n }; } -async function OY(t, { iv: e, cipherText: r }) { +async function NY(t, { iv: e, cipherText: r }) { const n = await crypto.subtle.decrypt({ name: "AES-GCM", iv: e @@ -26926,17 +26934,17 @@ async function fS(t, e) { namedCurve: "P-256" }, !0, t === "private" ? ["deriveKey"] : []); } -async function NY(t, e) { +async function LY(t, e) { const r = JSON.stringify(t, (n, i) => { if (!(i instanceof Error)) return i; const s = i; return Object.assign(Object.assign({}, s.code ? { code: s.code } : {}), { message: s.message }); }); - return DY(e, r); + return OY(e, r); } -async function LY(t, e) { - return JSON.parse(await OY(e, t)); +async function kY(t, e) { + return JSON.parse(await NY(e, t)); } const $m = { storageKey: "ownPrivateKey", @@ -26948,7 +26956,7 @@ const $m = { storageKey: "peerPublicKey", keyType: "public" }; -class kY { +class $Y { constructor() { this.storage = new no("CBWSDK", "SCWKeyManager"), this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null; } @@ -26966,14 +26974,14 @@ class kY { this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null, this.storage.removeItem(Bm.storageKey), this.storage.removeItem($m.storageKey), this.storage.removeItem(Fm.storageKey); } async generateKeyPair() { - const e = await TY(); + const e = await RY(); this.ownPrivateKey = e.privateKey, this.ownPublicKey = e.publicKey, await this.storeKey($m, e.privateKey), await this.storeKey(Bm, e.publicKey); } async loadKeysIfNeeded() { if (this.ownPrivateKey === null && (this.ownPrivateKey = await this.loadKey($m)), this.ownPublicKey === null && (this.ownPublicKey = await this.loadKey(Bm)), (this.ownPrivateKey === null || this.ownPublicKey === null) && await this.generateKeyPair(), this.peerPublicKey === null && (this.peerPublicKey = await this.loadKey(Fm)), this.sharedSecret === null) { if (this.ownPrivateKey === null || this.peerPublicKey === null) return; - this.sharedSecret = await RY(this.ownPrivateKey, this.peerPublicKey); + this.sharedSecret = await DY(this.ownPrivateKey, this.peerPublicKey); } } // storage methods @@ -27002,10 +27010,10 @@ async function hS(t, e) { throw s; return i; } -function $Y() { +function BY() { return globalThis.coinbaseWalletExtension; } -function BY() { +function FY() { var t, e; try { const r = globalThis; @@ -27014,19 +27022,19 @@ function BY() { return; } } -function FY({ metadata: t, preference: e }) { +function jY({ metadata: t, preference: e }) { var r, n; const { appName: i, appLogoUrl: s, appChainIds: o } = t; if (e.options !== "smartWalletOnly") { - const u = $Y(); + const u = BY(); if (u) return (r = u.setAppInfo) === null || r === void 0 || r.call(u, i, s, o, e), u; } - const a = BY(); + const a = FY(); if (a != null && a.isCoinbaseBrowser) return (n = a.setAppInfo) === null || n === void 0 || n.call(a, i, s, o, e), a; } -function jY(t) { +function UY(t) { if (!t || typeof t != "object" || Array.isArray(t)) throw Ar.rpc.invalidParams({ message: "Expected a single, non-array, object argument.", @@ -27052,10 +27060,10 @@ function jY(t) { } } const w_ = "accounts", x_ = "activeChain", __ = "availableChains", E_ = "walletCapabilities"; -class UY { +class qY { constructor(e) { var r, n, i; - this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new kY(), this.storage = new no("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(w_)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(x_) || { + this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new $Y(), this.storage = new no("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(w_)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(x_) || { id: (i = (n = e.metadata.appChainIds) === null || n === void 0 ? void 0 : n[0]) !== null && i !== void 0 ? i : 1 }, this.handshake = this.handshake.bind(this), this.request = this.request.bind(this), this.createRequestMessage = this.createRequestMessage.bind(this), this.decryptResponseMessage = this.decryptResponseMessage.bind(this); } @@ -27140,7 +27148,7 @@ class UY { const n = e.params; if (!n || !(!((r = n[0]) === null || r === void 0) && r.chainId)) throw Ar.rpc.invalidParams(); - const i = Qf(n[0].chainId); + const i = el(n[0].chainId); if (this.updateChain(i)) return null; const o = await this.sendRequestToPopup(e); @@ -27150,7 +27158,7 @@ class UY { const r = await this.keyManager.getSharedSecret(); if (!r) throw Ar.provider.unauthorized("No valid session found, try requestAccounts before other methods"); - const n = await NY({ + const n = await LY({ action: e, chainId: this.chain.id }, r), i = await this.createRequestMessage({ encrypted: n }); @@ -27173,7 +27181,7 @@ class UY { const s = await this.keyManager.getSharedSecret(); if (!s) throw Ar.provider.unauthorized("Invalid session"); - const o = await LY(i.encrypted, s), a = (r = o.data) === null || r === void 0 ? void 0 : r.chains; + const o = await kY(i.encrypted, s), a = (r = o.data) === null || r === void 0 ? void 0 : r.chains; if (a) { const l = Object.entries(a).map(([d, p]) => ({ id: Number(d), @@ -27190,11 +27198,11 @@ class UY { return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(x_, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", ma(s.id))), !0) : !1; } } -const qY = /* @__PURE__ */ Lv(mO), { keccak_256: zY } = qY; +const zY = /* @__PURE__ */ Lv(mO), { keccak_256: WY } = zY; function dS(t) { return Buffer.allocUnsafe(t).fill(0); } -function WY(t) { +function HY(t) { return t.toString(2).length; } function pS(t, e) { @@ -27205,7 +27213,7 @@ function pS(t, e) { n.unshift(0); return Buffer.from(n); } -function HY(t, e) { +function KY(t, e) { const r = t < 0n; let n; if (r) { @@ -27219,7 +27227,7 @@ function gS(t, e, r) { const n = dS(e); return t = _p(t), r ? t.length < e ? (t.copy(n), n) : t.slice(0, e) : t.length < e ? (t.copy(n, e - t.length), n) : t.slice(-e); } -function KY(t, e) { +function VY(t, e) { return gS(t, e, !0); } function _p(t) { @@ -27227,7 +27235,7 @@ function _p(t) { if (Array.isArray(t)) t = Buffer.from(t); else if (typeof t == "string") - mS(t) ? t = Buffer.from(YY(vS(t)), "hex") : t = Buffer.from(t); + mS(t) ? t = Buffer.from(JY(vS(t)), "hex") : t = Buffer.from(t); else if (typeof t == "number") t = intToBuffer(t); else if (t == null) @@ -27240,15 +27248,15 @@ function _p(t) { throw new Error("invalid type"); return t; } -function VY(t) { +function GY(t) { return t = _p(t), "0x" + t.toString("hex"); } -function GY(t, e) { +function YY(t, e) { if (t = _p(t), e || (e = 256), e !== 256) throw new Error("unsupported"); - return Buffer.from(zY(new Uint8Array(t))); + return Buffer.from(WY(new Uint8Array(t))); } -function YY(t) { +function JY(t) { return t.length % 2 ? "0" + t : t; } function mS(t) { @@ -27260,21 +27268,21 @@ function vS(t) { var bS = { zeros: dS, setLength: gS, - setLengthRight: KY, + setLengthRight: VY, isHexString: mS, stripHexPrefix: vS, toBuffer: _p, - bufferToHex: VY, - keccak: GY, - bitLengthFromBigInt: WY, + bufferToHex: GY, + keccak: YY, + bitLengthFromBigInt: HY, bufferBEFromBigInt: pS, - twosFromBigInt: HY + twosFromBigInt: KY }; const oi = bS; function yS(t) { return t.startsWith("int[") ? "int256" + t.slice(3) : t === "int" ? "int256" : t.startsWith("uint[") ? "uint256" + t.slice(4) : t === "uint" ? "uint256" : t.startsWith("fixed[") ? "fixed128x128" + t.slice(5) : t === "fixed" ? "fixed128x128" : t.startsWith("ufixed[") ? "ufixed128x128" + t.slice(6) : t === "ufixed" ? "ufixed128x128" : t; } -function Su(t) { +function Au(t) { return Number.parseInt(/^\D+(\d+)$/.exec(t)[1], 10); } function S_(t) { @@ -27301,7 +27309,7 @@ function Hs(t, e) { return Hs("uint8", e ? 1 : 0); if (t === "string") return Hs("bytes", new Buffer(e, "utf8")); - if (XY(t)) { + if (ZY(t)) { if (typeof e.length > "u") throw new Error("Not an array?"); if (r = wS(t), r !== "dynamic" && r !== 0 && e.length > r) @@ -27318,11 +27326,11 @@ function Hs(t, e) { if (t === "bytes") return e = new Buffer(e), i = Buffer.concat([Hs("uint256", e.length), e]), e.length % 32 !== 0 && (i = Buffer.concat([i, oi.zeros(32 - e.length % 32)])), i; if (t.startsWith("bytes")) { - if (r = Su(t), r < 1 || r > 32) + if (r = Au(t), r < 1 || r > 32) throw new Error("Invalid bytes width: " + r); return oi.setLengthRight(e, 32); } else if (t.startsWith("uint")) { - if (r = Su(t), r % 8 || r < 8 || r > 256) + if (r = Au(t), r % 8 || r < 8 || r > 256) throw new Error("Invalid uint width: " + r); n = oc(e); const a = oi.bitLengthFromBigInt(n); @@ -27332,7 +27340,7 @@ function Hs(t, e) { throw new Error("Supplied uint is negative"); return oi.bufferBEFromBigInt(n, 32); } else if (t.startsWith("int")) { - if (r = Su(t), r % 8 || r < 8 || r > 256) + if (r = Au(t), r % 8 || r < 8 || r > 256) throw new Error("Invalid int width: " + r); n = oc(e); const a = oi.bitLengthFromBigInt(n); @@ -27349,17 +27357,17 @@ function Hs(t, e) { } throw new Error("Unsupported or invalid type: " + t); } -function JY(t) { +function XY(t) { return t === "string" || t === "bytes" || wS(t) === "dynamic"; } -function XY(t) { +function ZY(t) { return t.lastIndexOf("]") === t.length - 1; } -function ZY(t, e) { +function QY(t, e) { var r = [], n = [], i = 32 * t.length; for (var s in t) { var o = yS(t[s]), a = e[s], u = Hs(o, a); - JY(o) ? (r.push(Hs("uint256", i)), n.push(u), i += u.length) : r.push(u); + XY(o) ? (r.push(Hs("uint256", i)), n.push(u), i += u.length) : r.push(u); } return Buffer.concat(r.concat(n)); } @@ -27377,11 +27385,11 @@ function xS(t, e) { else if (o === "address") i.push(oi.setLength(a, 20)); else if (o.startsWith("bytes")) { - if (r = Su(o), r < 1 || r > 32) + if (r = Au(o), r < 1 || r > 32) throw new Error("Invalid bytes width: " + r); i.push(oi.setLengthRight(a, r)); } else if (o.startsWith("uint")) { - if (r = Su(o), r % 8 || r < 8 || r > 256) + if (r = Au(o), r % 8 || r < 8 || r > 256) throw new Error("Invalid uint width: " + r); n = oc(a); const u = oi.bitLengthFromBigInt(n); @@ -27389,7 +27397,7 @@ function xS(t, e) { throw new Error("Supplied uint exceeds width: " + r + " vs " + u); i.push(oi.bufferBEFromBigInt(n, r / 8)); } else if (o.startsWith("int")) { - if (r = Su(o), r % 8 || r < 8 || r > 256) + if (r = Au(o), r % 8 || r < 8 || r > 256) throw new Error("Invalid int width: " + r); n = oc(a); const u = oi.bitLengthFromBigInt(n); @@ -27402,15 +27410,15 @@ function xS(t, e) { } return Buffer.concat(i); } -function QY(t, e) { +function eJ(t, e) { return oi.keccak(xS(t, e)); } -var eJ = { - rawEncode: ZY, +var tJ = { + rawEncode: QY, solidityPack: xS, - soliditySHA3: QY + soliditySHA3: eJ }; -const _s = bS, el = eJ, _S = { +const _s = bS, tl = tJ, _S = { type: "object", properties: { types: { @@ -27455,7 +27463,7 @@ const _s = bS, el = eJ, _S = { return typeof l == "string" && (l = Buffer.from(l, "utf8")), ["bytes32", _s.keccak(l)]; if (u.lastIndexOf("]") === u.length - 1) { const d = u.slice(0, u.lastIndexOf("[")), p = l.map((w) => o(a, d, w)); - return ["bytes32", _s.keccak(el.rawEncode( + return ["bytes32", _s.keccak(tl.rawEncode( p.map(([w]) => w), p.map(([, w]) => w) ))]; @@ -27482,7 +27490,7 @@ const _s = bS, el = eJ, _S = { i.push(o.type), s.push(a); } } - return el.rawEncode(i, s); + return tl.rawEncode(i, s); }, /** * Encodes the type of an object by encoding a comma delimited list of its members @@ -27562,11 +27570,11 @@ const _s = bS, el = eJ, _S = { return n.push(this.hashStruct("EIP712Domain", r.domain, r.types, e)), r.primaryType !== "EIP712Domain" && n.push(this.hashStruct(r.primaryType, r.message, r.types, e)), _s.keccak(Buffer.concat(n)); } }; -var tJ = { +var rJ = { TYPED_MESSAGE_SCHEMA: _S, TypedDataUtils: jm, hashForSignTypedDataLegacy: function(t) { - return rJ(t.data); + return nJ(t.data); }, hashForSignTypedData_v3: function(t) { return jm.hash(t.data, !1); @@ -27575,7 +27583,7 @@ var tJ = { return jm.hash(t.data); } }; -function rJ(t) { +function nJ(t) { const e = new Error("Expect argument to be non-empty array"); if (typeof t != "object" || !t.length) throw e; const r = t.map(function(s) { @@ -27586,19 +27594,19 @@ function rJ(t) { if (!s.name) throw e; return s.type + " " + s.name; }); - return el.soliditySHA3( + return tl.soliditySHA3( ["bytes32", "bytes32"], [ - el.soliditySHA3(new Array(t.length).fill("string"), i), - el.soliditySHA3(n, r) + tl.soliditySHA3(new Array(t.length).fill("string"), i), + tl.soliditySHA3(n, r) ] ); } -const Sd = /* @__PURE__ */ ns(tJ), nJ = "walletUsername", ev = "Addresses", iJ = "AppVersion"; +const Sd = /* @__PURE__ */ ns(rJ), iJ = "walletUsername", ev = "Addresses", sJ = "AppVersion"; function jn(t) { return t.errorMessage !== void 0; } -class sJ { +class oJ { // @param secret hex representation of 32-byte secret constructor(e) { this.secret = e; @@ -27645,7 +27653,7 @@ class sJ { }); } } -class oJ { +class aJ { constructor(e, r, n) { this.linkAPIUrl = e, this.sessionId = r; const i = `${r}:${n}`; @@ -27687,7 +27695,7 @@ var To; (function(t) { t[t.DISCONNECTED = 0] = "DISCONNECTED", t[t.CONNECTING = 1] = "CONNECTING", t[t.CONNECTED = 2] = "CONNECTED"; })(To || (To = {})); -class aJ { +class cJ { setConnectionStateListener(e) { this.connectionStateListener = e; } @@ -27770,8 +27778,8 @@ class aJ { e && (this.webSocket = null, e.onclose = null, e.onerror = null, e.onmessage = null, e.onopen = null); } } -const A_ = 1e4, cJ = 6e4; -class uJ { +const A_ = 1e4, uJ = 6e4; +class fJ { /** * Constructor * @param session Session @@ -27809,15 +27817,15 @@ class uJ { const u = await this.cipher.decrypt(o); (a = this.listener) === null || a === void 0 || a.metadataUpdated(s, u); }, this.handleWalletUsernameUpdated = async (s) => { - this.handleMetadataUpdated(nJ, s); - }, this.handleAppVersionUpdated = async (s) => { this.handleMetadataUpdated(iJ, s); + }, this.handleAppVersionUpdated = async (s) => { + this.handleMetadataUpdated(sJ, s); }, this.handleChainUpdated = async (s, o) => { var a; const u = await this.cipher.decrypt(s), l = await this.cipher.decrypt(o); (a = this.listener) === null || a === void 0 || a.chainUpdated(u, l); - }, this.session = e, this.cipher = new sJ(e.secret), this.listener = n; - const i = new aJ(`${r}/rpc`, WebSocket); + }, this.session = e, this.cipher = new oJ(e.secret), this.listener = n; + const i = new cJ(`${r}/rpc`, WebSocket); i.setConnectionStateListener(async (s) => { let o = !1; switch (s) { @@ -27863,7 +27871,7 @@ class uJ { } } s.id !== void 0 && ((o = this.requestResolutions.get(s.id)) === null || o === void 0 || o(s)); - }), this.ws = i, this.http = new oJ(r, e.id, e.key); + }), this.ws = i, this.http = new aJ(r, e.id, e.key); } /** * Make a connection to the server @@ -27969,7 +27977,7 @@ class uJ { } catch { } } - async makeRequest(e, r = { timeout: cJ }) { + async makeRequest(e, r = { timeout: uJ }) { const n = e.id; this.sendData(e); let i; @@ -28003,7 +28011,7 @@ class uJ { }), !0); } } -class fJ { +class lJ { constructor() { this._nextRequestId = 0, this.callbacks = /* @__PURE__ */ new Map(); } @@ -28014,17 +28022,17 @@ class fJ { } } const P_ = "session:id", M_ = "session:secret", I_ = "session:linked"; -class Au { +class Pu { constructor(e, r, n, i = !1) { this.storage = e, this.id = r, this.secret = n, this.key = XD(P4(`${r}, ${n} WalletLink`)), this._linked = !!i; } static create(e) { const r = sc(16), n = sc(32); - return new Au(e, r, n).save(); + return new Pu(e, r, n).save(); } static load(e) { const r = e.getItem(P_), n = e.getItem(I_), i = e.getItem(M_); - return r && i ? new Au(e, r, i, n === "1") : null; + return r && i ? new Pu(e, r, i, n === "1") : null; } get linked() { return this._linked; @@ -28039,21 +28047,21 @@ class Au { this.storage.setItem(I_, this._linked ? "1" : "0"); } } -function lJ() { +function hJ() { try { return window.frameElement !== null; } catch { return !1; } } -function hJ() { +function dJ() { try { - return lJ() && window.top ? window.top.location : window.location; + return hJ() && window.top ? window.top.location : window.location; } catch { return window.location; } } -function dJ() { +function pJ() { var t; return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t = window == null ? void 0 : window.navigator) === null || t === void 0 ? void 0 : t.userAgent); } @@ -28061,10 +28069,10 @@ function ES() { var t, e; return (e = (t = window == null ? void 0 : window.matchMedia) === null || t === void 0 ? void 0 : t.call(window, "(prefers-color-scheme: dark)").matches) !== null && e !== void 0 ? e : !1; } -const pJ = '@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}'; +const gJ = '@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}'; function SS() { const t = document.createElement("style"); - t.type = "text/css", t.appendChild(document.createTextNode(pJ)), document.documentElement.appendChild(t); + t.type = "text/css", t.appendChild(document.createTextNode(gJ)), document.documentElement.appendChild(t); } function AS(t) { var e, r, n = ""; @@ -28073,11 +28081,11 @@ function AS(t) { else for (e in t) t[e] && (n && (n += " "), n += e); return n; } -function tl() { +function rl() { for (var t, e, r = 0, n = ""; r < arguments.length; ) (t = arguments[r++]) && (e = AS(t)) && (n && (n += " "), n += e); return n; } -var Ep, Jr, PS, ac, C_, MS, tv, IS, Nb, rv, nv, $l = {}, CS = [], gJ = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Lb = Array.isArray; +var Ep, Jr, PS, ac, C_, MS, tv, IS, Nb, rv, nv, $l = {}, CS = [], mJ = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Lb = Array.isArray; function va(t, e) { for (var r in e) t[r] = e[r]; return t; @@ -28101,10 +28109,10 @@ function dh(t) { function Kd(t, e) { this.props = t, this.context = e; } -function Lu(t, e) { - if (e == null) return t.__ ? Lu(t.__, t.__i + 1) : null; +function ku(t, e) { + if (e == null) return t.__ ? ku(t.__, t.__i + 1) : null; for (var r; e < t.__k.length; e++) if ((r = t.__k[e]) != null && r.__e != null) return r.__e; - return typeof t.type == "function" ? Lu(t) : null; + return typeof t.type == "function" ? ku(t) : null; } function TS(t) { var e, r; @@ -28121,18 +28129,18 @@ function T_(t) { } function A0() { var t, e, r, n, i, s, o, a; - for (ac.sort(tv); t = ac.shift(); ) t.__d && (e = ac.length, n = void 0, s = (i = (r = t).__v).__e, o = [], a = [], r.__P && ((n = va({}, i)).__v = i.__v + 1, Jr.vnode && Jr.vnode(n), $b(r.__P, n, i, r.__n, r.__P.namespaceURI, 32 & i.__u ? [s] : null, o, s ?? Lu(i), !!(32 & i.__u), a), n.__v = i.__v, n.__.__k[n.__i] = n, OS(o, n, a), n.__e != s && TS(n)), ac.length > e && ac.sort(tv)); + for (ac.sort(tv); t = ac.shift(); ) t.__d && (e = ac.length, n = void 0, s = (i = (r = t).__v).__e, o = [], a = [], r.__P && ((n = va({}, i)).__v = i.__v + 1, Jr.vnode && Jr.vnode(n), $b(r.__P, n, i, r.__n, r.__P.namespaceURI, 32 & i.__u ? [s] : null, o, s ?? ku(i), !!(32 & i.__u), a), n.__v = i.__v, n.__.__k[n.__i] = n, OS(o, n, a), n.__e != s && TS(n)), ac.length > e && ac.sort(tv)); A0.__r = 0; } function RS(t, e, r, n, i, s, o, a, u, l, d) { var p, w, _, P, O, L, B = n && n.__k || CS, k = e.length; - for (u = mJ(r, e, B, u), p = 0; p < k; p++) (_ = r.__k[p]) != null && (w = _.__i === -1 ? $l : B[_.__i] || $l, _.__i = p, L = $b(t, _, w, i, s, o, a, u, l, d), P = _.__e, _.ref && w.ref != _.ref && (w.ref && Bb(w.ref, null, _), d.push(_.ref, _.__c || P, _)), O == null && P != null && (O = P), 4 & _.__u || w.__k === _.__k ? u = DS(_, u, t) : typeof _.type == "function" && L !== void 0 ? u = L : P && (u = P.nextSibling), _.__u &= -7); + for (u = vJ(r, e, B, u), p = 0; p < k; p++) (_ = r.__k[p]) != null && (w = _.__i === -1 ? $l : B[_.__i] || $l, _.__i = p, L = $b(t, _, w, i, s, o, a, u, l, d), P = _.__e, _.ref && w.ref != _.ref && (w.ref && Bb(w.ref, null, _), d.push(_.ref, _.__c || P, _)), O == null && P != null && (O = P), 4 & _.__u || w.__k === _.__k ? u = DS(_, u, t) : typeof _.type == "function" && L !== void 0 ? u = L : P && (u = P.nextSibling), _.__u &= -7); return r.__e = O, u; } -function mJ(t, e, r, n) { +function vJ(t, e, r, n) { var i, s, o, a, u, l = e.length, d = r.length, p = d, w = 0; - for (t.__k = [], i = 0; i < l; i++) (s = e[i]) != null && typeof s != "boolean" && typeof s != "function" ? (a = i + w, (s = t.__k[i] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Hd(null, s, null, null, null) : Lb(s) ? Hd(dh, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? Hd(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, o = null, (u = s.__i = vJ(s, r, a, p)) !== -1 && (p--, (o = r[u]) && (o.__u |= 2)), o == null || o.__v === null ? (u == -1 && w--, typeof s.type != "function" && (s.__u |= 4)) : u !== a && (u == a - 1 ? w-- : u == a + 1 ? w++ : (u > a ? w-- : w++, s.__u |= 4))) : s = t.__k[i] = null; - if (p) for (i = 0; i < d; i++) (o = r[i]) != null && !(2 & o.__u) && (o.__e == n && (n = Lu(o)), NS(o, o)); + for (t.__k = [], i = 0; i < l; i++) (s = e[i]) != null && typeof s != "boolean" && typeof s != "function" ? (a = i + w, (s = t.__k[i] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Hd(null, s, null, null, null) : Lb(s) ? Hd(dh, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? Hd(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, o = null, (u = s.__i = bJ(s, r, a, p)) !== -1 && (p--, (o = r[u]) && (o.__u |= 2)), o == null || o.__v === null ? (u == -1 && w--, typeof s.type != "function" && (s.__u |= 4)) : u !== a && (u == a - 1 ? w-- : u == a + 1 ? w++ : (u > a ? w-- : w++, s.__u |= 4))) : s = t.__k[i] = null; + if (p) for (i = 0; i < d; i++) (o = r[i]) != null && !(2 & o.__u) && (o.__e == n && (n = ku(o)), NS(o, o)); return n; } function DS(t, e, r) { @@ -28141,13 +28149,13 @@ function DS(t, e, r) { for (n = t.__k, i = 0; n && i < n.length; i++) n[i] && (n[i].__ = t, e = DS(n[i], e, r)); return e; } - t.__e != e && (e && t.type && !r.contains(e) && (e = Lu(t)), r.insertBefore(t.__e, e || null), e = t.__e); + t.__e != e && (e && t.type && !r.contains(e) && (e = ku(t)), r.insertBefore(t.__e, e || null), e = t.__e); do e = e && e.nextSibling; while (e != null && e.nodeType === 8); return e; } -function vJ(t, e, r, n) { +function bJ(t, e, r, n) { var i = t.key, s = t.type, o = r - 1, a = r + 1, u = e[r]; if (u === null || u && i == u.key && s === u.type && !(2 & u.__u)) return r; if ((typeof s != "function" || s === dh || i) && n > (u != null && !(2 & u.__u) ? 1 : 0)) for (; o >= 0 || a < e.length; ) { @@ -28163,7 +28171,7 @@ function vJ(t, e, r, n) { return -1; } function R_(t, e, r) { - e[0] === "-" ? t.setProperty(e, r ?? "") : t[e] = r == null ? "" : typeof r != "number" || gJ.test(e) ? r : r + "px"; + e[0] === "-" ? t.setProperty(e, r ?? "") : t[e] = r == null ? "" : typeof r != "number" || mJ.test(e) ? r : r + "px"; } function Ad(t, e, r, n, i) { var s; @@ -28194,11 +28202,11 @@ function D_(t) { }; } function $b(t, e, r, n, i, s, o, a, u, l) { - var d, p, w, _, P, O, L, B, k, q, U, V, Q, R, K, ge, Ee, Y = e.type; + var d, p, w, _, P, O, L, B, k, W, U, V, Q, R, K, ge, Ee, Y = e.type; if (e.constructor !== void 0) return null; 128 & r.__u && (u = !!(32 & r.__u), s = [a = e.__e = r.__e]), (d = Jr.__b) && d(e); e: if (typeof Y == "function") try { - if (B = e.props, k = "prototype" in Y && Y.prototype.render, q = (d = Y.contextType) && n[d.__c], U = d ? q ? q.props.value : d.__ : n, r.__c ? L = (p = e.__c = r.__c).__ = p.__E : (k ? e.__c = p = new Y(B, U) : (e.__c = p = new Kd(B, U), p.constructor = Y, p.render = yJ), q && q.sub(p), p.props = B, p.state || (p.state = {}), p.context = U, p.__n = n, w = p.__d = !0, p.__h = [], p._sb = []), k && p.__s == null && (p.__s = p.state), k && Y.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = va({}, p.__s)), va(p.__s, Y.getDerivedStateFromProps(B, p.__s))), _ = p.props, P = p.state, p.__v = e, w) k && Y.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), k && p.componentDidMount != null && p.__h.push(p.componentDidMount); + if (B = e.props, k = "prototype" in Y && Y.prototype.render, W = (d = Y.contextType) && n[d.__c], U = d ? W ? W.props.value : d.__ : n, r.__c ? L = (p = e.__c = r.__c).__ = p.__E : (k ? e.__c = p = new Y(B, U) : (e.__c = p = new Kd(B, U), p.constructor = Y, p.render = wJ), W && W.sub(p), p.props = B, p.state || (p.state = {}), p.context = U, p.__n = n, w = p.__d = !0, p.__h = [], p._sb = []), k && p.__s == null && (p.__s = p.state), k && Y.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = va({}, p.__s)), va(p.__s, Y.getDerivedStateFromProps(B, p.__s))), _ = p.props, P = p.state, p.__v = e, w) k && Y.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), k && p.componentDidMount != null && p.__h.push(p.componentDidMount); else { if (k && Y.getDerivedStateFromProps == null && B !== _ && p.componentWillReceiveProps != null && p.componentWillReceiveProps(B, U), !p.__e && (p.shouldComponentUpdate != null && p.shouldComponentUpdate(B, p.__s, U) === !1 || e.__v === r.__v)) { for (e.__v !== r.__v && (p.props = B, p.state = p.__s, p.__d = !1), e.__e = r.__e, e.__k = r.__k, e.__k.some(function(A) { @@ -28226,7 +28234,7 @@ function $b(t, e, r, n, i, s, o, a, u, l) { else e.__e = r.__e, e.__k = r.__k; Jr.__e(A, e, r); } - else s == null && e.__v === r.__v ? (e.__k = r.__k, e.__e = r.__e) : a = e.__e = bJ(r.__e, e, r, n, i, s, o, u, l); + else s == null && e.__v === r.__v ? (e.__k = r.__k, e.__e = r.__e) : a = e.__e = yJ(r.__e, e, r, n, i, s, o, u, l); return (d = Jr.diffed) && d(e), 128 & e.__u ? void 0 : a; } function OS(t, e, r) { @@ -28241,7 +28249,7 @@ function OS(t, e, r) { } }); } -function bJ(t, e, r, n, i, s, o, a, u) { +function yJ(t, e, r, n, i, s, o, a, u) { var l, d, p, w, _, P, O, L = r.props, B = e.props, k = e.type; if (k === "svg" ? i = "http://www.w3.org/2000/svg" : k === "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) { for (l = 0; l < s.length; l++) if ((_ = s[l]) && "setAttribute" in _ == !!k && (k ? _.localName === k : _.nodeType === 3)) { @@ -28265,7 +28273,7 @@ function bJ(t, e, r, n, i, s, o, a, u) { } for (l in B) _ = B[l], l == "children" ? w = _ : l == "dangerouslySetInnerHTML" ? d = _ : l == "value" ? P = _ : l == "checked" ? O = _ : a && typeof _ != "function" || L[l] === _ || Ad(t, l, _, L[l], i); if (d) a || p && (d.__html === p.__html || d.__html === t.innerHTML) || (t.innerHTML = d.__html), e.__k = []; - else if (p && (t.innerHTML = ""), RS(t, Lb(w) ? w : [w], e, r, n, k === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && Lu(r, 0), a, u), s != null) for (l = s.length; l--; ) kb(s[l]); + else if (p && (t.innerHTML = ""), RS(t, Lb(w) ? w : [w], e, r, n, k === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && ku(r, 0), a, u), s != null) for (l = s.length; l--; ) kb(s[l]); a || (l = "value", k === "progress" && P == null ? t.removeAttribute("value") : P !== void 0 && (P !== t[l] || k === "progress" && !P || k === "option" && P !== L[l]) && Ad(t, l, P, L[l], i), l = "checked", O !== void 0 && O !== t[l] && Ad(t, l, O, L[l], i)); } return t; @@ -28293,7 +28301,7 @@ function NS(t, e, r) { if (n = t.__k) for (i = 0; i < n.length; i++) n[i] && NS(n[i], e, r || typeof t.type != "function"); r || kb(t.__e), t.__c = t.__ = t.__e = void 0; } -function yJ(t, e, r) { +function wJ(t, e, r) { return this.constructor(t, r); } function iv(t, e, r) { @@ -28322,9 +28330,9 @@ function kS(t, e) { return t >= r.__.length && r.__.push({}), r.__[t]; } function j_(t) { - return sv = 1, wJ($S, t); + return sv = 1, xJ($S, t); } -function wJ(t, e, r) { +function xJ(t, e, r) { var n = kS(P0++, 2); if (n.t = t, !n.__c && (n.__ = [$S(void 0, e), function(a) { var u = n.__N ? n.__N[0] : n.__[0], l = n.t(u, a); @@ -28358,11 +28366,11 @@ function wJ(t, e, r) { } return n.__N || n.__; } -function xJ(t, e) { +function _J(t, e) { var r = kS(P0++, 3); - !yn.__s && SJ(r.__H, e) && (r.__ = t, r.i = e, pn.__H.__h.push(r)); + !yn.__s && AJ(r.__H, e) && (r.__ = t, r.i = e, pn.__H.__h.push(r)); } -function _J() { +function EJ() { for (var t; t = LS.shift(); ) if (t.__P && t.__H) try { t.__H.__h.forEach(Vd), t.__H.__h.forEach(ov), t.__H.__h = []; } catch (e) { @@ -28382,7 +28390,7 @@ yn.__b = function(t) { }, yn.diffed = function(t) { k_ && k_(t); var e = t.__c; - e && e.__H && (e.__H.__h.length && (LS.push(e) !== 1 && O_ === yn.requestAnimationFrame || ((O_ = yn.requestAnimationFrame) || EJ)(_J)), e.__H.__.forEach(function(r) { + e && e.__H && (e.__H.__h.length && (LS.push(e) !== 1 && O_ === yn.requestAnimationFrame || ((O_ = yn.requestAnimationFrame) || SJ)(EJ)), e.__H.__.forEach(function(r) { r.i && (r.__H = r.i), r.i = void 0; })), Um = pn = null; }, yn.__c = function(t, e) { @@ -28409,7 +28417,7 @@ yn.__b = function(t) { }), r.__H = void 0, e && yn.__e(e, r.__v)); }; var U_ = typeof requestAnimationFrame == "function"; -function EJ(t) { +function SJ(t) { var e, r = function() { clearTimeout(n), U_ && cancelAnimationFrame(e), setTimeout(t); }, n = setTimeout(r, 100); @@ -28423,7 +28431,7 @@ function ov(t) { var e = pn; t.__c = t.__(), pn = e; } -function SJ(t, e) { +function AJ(t, e) { return !t || t.length !== e.length || e.some(function(r, n) { return r !== t[n]; }); @@ -28431,8 +28439,8 @@ function SJ(t, e) { function $S(t, e) { return typeof e == "function" ? e(t) : e; } -const AJ = ".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}", PJ = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+", MJ = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4="; -class IJ { +const PJ = ".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}", MJ = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+", IJ = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4="; +class CJ { constructor() { this.items = /* @__PURE__ */ new Map(), this.nextItemKey = 0, this.root = null, this.darkMode = ES(); } @@ -28452,18 +28460,18 @@ class IJ { this.root && iv(Nr( "div", null, - Nr(BS, { darkMode: this.darkMode }, Array.from(this.items.entries()).map(([e, r]) => Nr(CJ, Object.assign({}, r, { key: e })))) + Nr(BS, { darkMode: this.darkMode }, Array.from(this.items.entries()).map(([e, r]) => Nr(TJ, Object.assign({}, r, { key: e })))) ), this.root); } } const BS = (t) => Nr( "div", - { class: tl("-cbwsdk-snackbar-container") }, - Nr("style", null, AJ), + { class: rl("-cbwsdk-snackbar-container") }, + Nr("style", null, PJ), Nr("div", { class: "-cbwsdk-snackbar" }, t.children) -), CJ = ({ autoExpand: t, message: e, menuItems: r }) => { +), TJ = ({ autoExpand: t, message: e, menuItems: r }) => { const [n, i] = j_(!0), [s, o] = j_(t ?? !1); - xJ(() => { + _J(() => { const u = [ window.setTimeout(() => { i(!1); @@ -28481,11 +28489,11 @@ const BS = (t) => Nr( }; return Nr( "div", - { class: tl("-cbwsdk-snackbar-instance", n && "-cbwsdk-snackbar-instance-hidden", s && "-cbwsdk-snackbar-instance-expanded") }, + { class: rl("-cbwsdk-snackbar-instance", n && "-cbwsdk-snackbar-instance-hidden", s && "-cbwsdk-snackbar-instance-expanded") }, Nr( "div", { class: "-cbwsdk-snackbar-instance-header", onClick: a }, - Nr("img", { src: PJ, class: "-cbwsdk-snackbar-instance-header-cblogo" }), + Nr("img", { src: MJ, class: "-cbwsdk-snackbar-instance-header-cblogo" }), " ", Nr("div", { class: "-cbwsdk-snackbar-instance-header-message" }, e), Nr( @@ -28496,24 +28504,24 @@ const BS = (t) => Nr( { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, Nr("circle", { cx: "12", cy: "12", r: "12", fill: "#F5F7F8" }) ), - Nr("img", { src: MJ, class: "-gear-icon", title: "Expand" }) + Nr("img", { src: IJ, class: "-gear-icon", title: "Expand" }) ) ), r && r.length > 0 && Nr("div", { class: "-cbwsdk-snackbar-instance-menu" }, r.map((u, l) => Nr( "div", - { class: tl("-cbwsdk-snackbar-instance-menu-item", u.isRed && "-cbwsdk-snackbar-instance-menu-item-is-red"), onClick: u.onClick, key: l }, + { class: rl("-cbwsdk-snackbar-instance-menu-item", u.isRed && "-cbwsdk-snackbar-instance-menu-item-is-red"), onClick: u.onClick, key: l }, Nr( "svg", { width: u.svgWidth, height: u.svgHeight, viewBox: "0 0 10 11", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, Nr("path", { "fill-rule": u.defaultFillRule, "clip-rule": u.defaultClipRule, d: u.path, fill: "#AAAAAA" }) ), - Nr("span", { class: tl("-cbwsdk-snackbar-instance-menu-item-info", u.isRed && "-cbwsdk-snackbar-instance-menu-item-info-is-red") }, u.info) + Nr("span", { class: rl("-cbwsdk-snackbar-instance-menu-item-info", u.isRed && "-cbwsdk-snackbar-instance-menu-item-info-is-red") }, u.info) ))) ); }; -class TJ { +class RJ { constructor() { - this.attached = !1, this.snackbar = new IJ(); + this.attached = !1, this.snackbar = new CJ(); } attach() { if (this.attached) @@ -28565,8 +28573,8 @@ class TJ { }, this.snackbar.presentItem(r); } } -const RJ = ".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}"; -class DJ { +const DJ = ".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}"; +class OJ { constructor() { this.root = null, this.darkMode = ES(); } @@ -28581,12 +28589,12 @@ class DJ { this.render(null); } render(e) { - this.root && (iv(null, this.root), e && iv(Nr(OJ, Object.assign({}, e, { onDismiss: () => { + this.root && (iv(null, this.root), e && iv(Nr(NJ, Object.assign({}, e, { onDismiss: () => { this.clear(); }, darkMode: this.darkMode })), this.root)); } } -const OJ = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: i }) => { +const NJ = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: i }) => { const s = r ? "dark" : "light"; return Nr( BS, @@ -28594,20 +28602,20 @@ const OJ = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: Nr( "div", { class: "-cbwsdk-redirect-dialog" }, - Nr("style", null, RJ), + Nr("style", null, DJ), Nr("div", { class: "-cbwsdk-redirect-dialog-backdrop", onClick: i }), Nr( "div", - { class: tl("-cbwsdk-redirect-dialog-box", s) }, + { class: rl("-cbwsdk-redirect-dialog-box", s) }, Nr("p", null, t), Nr("button", { onClick: n }, e) ) ) ); -}, NJ = "https://keys.coinbase.com/connect", q_ = "https://www.walletlink.org", LJ = "https://go.cb-w.com/walletlink"; +}, LJ = "https://keys.coinbase.com/connect", q_ = "https://www.walletlink.org", kJ = "https://go.cb-w.com/walletlink"; class z_ { constructor() { - this.attached = !1, this.redirectDialog = new DJ(); + this.attached = !1, this.redirectDialog = new OJ(); } attach() { if (this.attached) @@ -28615,8 +28623,8 @@ class z_ { this.redirectDialog.attach(), this.attached = !0; } redirectToCoinbaseWallet(e) { - const r = new URL(LJ); - r.searchParams.append("redirect_url", hJ().href), e && r.searchParams.append("wl_url", e); + const r = new URL(kJ); + r.searchParams.append("redirect_url", dJ().href), e && r.searchParams.append("wl_url", e); const n = document.createElement("a"); n.target = "cbw-opener", n.href = r.href, n.rel = "noreferrer noopener", n.click(); } @@ -28639,7 +28647,7 @@ class z_ { } class Mo { constructor(e) { - this.chainCallbackParams = { chainId: "", jsonRpcUrl: "" }, this.isMobileWeb = dJ(), this.linkedUpdated = (s) => { + this.chainCallbackParams = { chainId: "", jsonRpcUrl: "" }, this.isMobileWeb = pJ(), this.linkedUpdated = (s) => { this.isLinked = s; const o = this.storage.getItem(ev); if (s && (this._session.linked = s), this.isUnlinkedErrorState = !1, o) { @@ -28662,19 +28670,19 @@ class Mo { }), Mo.accountRequestCallbackIds.clear()); }, this.resetAndReload = this.resetAndReload.bind(this), this.linkAPIUrl = e.linkAPIUrl, this.storage = e.storage, this.metadata = e.metadata, this.accountsCallback = e.accountsCallback, this.chainCallback = e.chainCallback; const { session: r, ui: n, connection: i } = this.subscribe(); - this._session = r, this.connection = i, this.relayEventManager = new fJ(), this.ui = n, this.ui.attach(); + this._session = r, this.connection = i, this.relayEventManager = new lJ(), this.ui = n, this.ui.attach(); } subscribe() { - const e = Au.load(this.storage) || Au.create(this.storage), { linkAPIUrl: r } = this, n = new uJ({ + const e = Pu.load(this.storage) || Pu.create(this.storage), { linkAPIUrl: r } = this, n = new fJ({ session: e, linkAPIUrl: r, listener: this - }), i = this.isMobileWeb ? new z_() : new TJ(); + }), i = this.isMobileWeb ? new z_() : new RJ(); return n.connect(), { session: e, ui: i, connection: n }; } resetAndReload() { this.connection.destroy().then(() => { - const e = Au.load(this.storage); + const e = Pu.load(this.storage); (e == null ? void 0 : e.id) === this._session.id && no.clearAll(), document.location.reload(); }).catch((e) => { }); @@ -28686,7 +28694,7 @@ class Mo { fromAddress: e.fromAddress, toAddress: e.toAddress, weiValue: js(e.weiValue), - data: Zf(e.data, !0), + data: Qf(e.data, !0), nonce: e.nonce, gasPriceInWei: e.gasPriceInWei ? js(e.gasPriceInWei) : null, maxFeePerGas: e.gasPriceInWei ? js(e.gasPriceInWei) : null, @@ -28704,7 +28712,7 @@ class Mo { fromAddress: e.fromAddress, toAddress: e.toAddress, weiValue: js(e.weiValue), - data: Zf(e.data, !0), + data: Qf(e.data, !0), nonce: e.nonce, gasPriceInWei: e.gasPriceInWei ? js(e.gasPriceInWei) : null, maxFeePerGas: e.maxFeePerGas ? js(e.maxFeePerGas) : null, @@ -28719,7 +28727,7 @@ class Mo { return this.sendRequest({ method: "submitEthereumTransaction", params: { - signedTransaction: Zf(e, !0), + signedTransaction: Qf(e, !0), chainId: r } }); @@ -28937,7 +28945,7 @@ class FS { var n; this.jsonRpcUrl = e; const i = this.getChainId(); - this._storage.setItem(W_, r.toString(10)), Qf(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", ma(r))); + this._storage.setItem(W_, r.toString(10)), el(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", ma(r))); } async watchAsset(e) { const r = Array.isArray(e) ? e[0] : e; @@ -29039,7 +29047,7 @@ class FS { if (!r) throw new Error("Ethereum address is unavailable"); this._ensureKnownAddress(r); - const n = e.to ? ia(e.to) : null, i = e.value != null ? Bf(e.value) : BigInt(0), s = e.data ? Q1(e.data) : Buffer.alloc(0), o = e.nonce != null ? Qf(e.nonce) : null, a = e.gasPrice != null ? Bf(e.gasPrice) : null, u = e.maxFeePerGas != null ? Bf(e.maxFeePerGas) : null, l = e.maxPriorityFeePerGas != null ? Bf(e.maxPriorityFeePerGas) : null, d = e.gas != null ? Bf(e.gas) : null, p = e.chainId ? Qf(e.chainId) : this.getChainId(); + const n = e.to ? ia(e.to) : null, i = e.value != null ? Ff(e.value) : BigInt(0), s = e.data ? Q1(e.data) : Buffer.alloc(0), o = e.nonce != null ? el(e.nonce) : null, a = e.gasPrice != null ? Ff(e.gasPrice) : null, u = e.maxFeePerGas != null ? Ff(e.maxFeePerGas) : null, l = e.maxPriorityFeePerGas != null ? Ff(e.maxPriorityFeePerGas) : null, d = e.gas != null ? Ff(e.gas) : null, p = e.chainId ? el(e.chainId) : this.getChainId(); return { fromAddress: r, toAddress: n, @@ -29131,8 +29139,8 @@ class FS { eth_signTypedData_v4: Sd.hashForSignTypedData_v4, eth_signTypedData: Sd.hashForSignTypedData_v4 }; - return Zf(d[r]({ - data: IY(l) + return Qf(d[r]({ + data: CY(l) }), !0); }, s = n[r === "eth_signTypedData_v1" ? 1 : 0], o = n[r === "eth_signTypedData_v1" ? 0 : 1]; this._ensureKnownAddress(s); @@ -29160,15 +29168,15 @@ class FS { } } const jS = "SignerType", US = new no("CBWSDK", "SignerConfigurator"); -function kJ() { +function $J() { return US.getItem(jS); } -function $J(t) { +function BJ(t) { US.setItem(jS, t); } -async function BJ(t) { +async function FJ(t) { const { communicator: e, metadata: r, handshakeRequest: n, callback: i } = t; - jJ(e, r, i).catch(() => { + UJ(e, r, i).catch(() => { }); const s = { id: crypto.randomUUID(), @@ -29177,11 +29185,11 @@ async function BJ(t) { }, { data: o } = await e.postRequestAndWaitForResponse(s); return o; } -function FJ(t) { +function jJ(t) { const { signerType: e, metadata: r, communicator: n, callback: i } = t; switch (e) { case "scw": - return new UY({ + return new qY({ metadata: r, callback: i, communicator: n @@ -29193,7 +29201,7 @@ function FJ(t) { }); } } -async function jJ(t, e, r) { +async function UJ(t, e, r) { await t.onMessage(({ event: i }) => i === "WalletLinkSessionRequest"); const n = new FS({ metadata: e, @@ -29207,9 +29215,9 @@ async function jJ(t, e, r) { data: { connected: !0 } }); } -const UJ = `Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. +const qJ = `Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. -Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`, qJ = () => { +Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`, zJ = () => { let t; return { getCrossOriginOpenerPolicy: () => t === void 0 ? "undefined" : t, @@ -29225,36 +29233,36 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene if (!r.ok) throw new Error(`HTTP error! status: ${r.status}`); const n = r.headers.get("Cross-Origin-Opener-Policy"); - t = n ?? "null", t === "same-origin" && console.error(UJ); + t = n ?? "null", t === "same-origin" && console.error(qJ); } catch (e) { console.error("Error checking Cross-Origin-Opener-Policy:", e.message), t = "error"; } } }; -}, { checkCrossOriginOpenerPolicy: zJ, getCrossOriginOpenerPolicy: WJ } = qJ(), K_ = 420, V_ = 540; -function HJ(t) { +}, { checkCrossOriginOpenerPolicy: WJ, getCrossOriginOpenerPolicy: HJ } = zJ(), K_ = 420, V_ = 540; +function KJ(t) { const e = (window.innerWidth - K_) / 2 + window.screenX, r = (window.innerHeight - V_) / 2 + window.screenY; - VJ(t); + GJ(t); const n = window.open(t, "Smart Wallet", `width=${K_}, height=${V_}, left=${e}, top=${r}`); if (n == null || n.focus(), !n) throw Ar.rpc.internal("Pop up window failed to open"); return n; } -function KJ(t) { +function VJ(t) { t && !t.closed && t.close(); } -function VJ(t) { +function GJ(t) { const e = { sdkName: lS, sdkVersion: hh, origin: window.location.origin, - coop: WJ() + coop: HJ() }; for (const [r, n] of Object.entries(e)) t.searchParams.append(r, n.toString()); } -class GJ { - constructor({ url: e = NJ, metadata: r, preference: n }) { +class YJ { + constructor({ url: e = LJ, metadata: r, preference: n }) { this.popup = null, this.listeners = /* @__PURE__ */ new Map(), this.postMessage = async (i) => { (await this.waitForPopupLoaded()).postMessage(i, this.url.origin); }, this.postRequestAndWaitForResponse = async (i) => { @@ -29269,10 +29277,10 @@ class GJ { }; window.addEventListener("message", a), this.listeners.set(a, { reject: o }); }), this.disconnect = () => { - KJ(this.popup), this.popup = null, this.listeners.forEach(({ reject: i }, s) => { + VJ(this.popup), this.popup = null, this.listeners.forEach(({ reject: i }, s) => { i(Ar.provider.userRejectedRequest("Request rejected")), window.removeEventListener("message", s); }), this.listeners.clear(); - }, this.waitForPopupLoaded = async () => this.popup && !this.popup.closed ? (this.popup.focus(), this.popup) : (this.popup = HJ(this.url), this.onMessage(({ event: i }) => i === "PopupUnload").then(this.disconnect).catch(() => { + }, this.waitForPopupLoaded = async () => this.popup && !this.popup.closed ? (this.popup.focus(), this.popup) : (this.popup = KJ(this.url), this.onMessage(({ event: i }) => i === "PopupUnload").then(this.disconnect).catch(() => { }), this.onMessage(({ event: i }) => i === "PopupLoaded").then((i) => { this.postMessage({ requestId: i.id, @@ -29290,13 +29298,13 @@ class GJ { })), this.url = new URL(e), this.metadata = r, this.preference = n; } } -function YJ(t) { - const e = EY(JJ(t), { +function JJ(t) { + const e = SY(XJ(t), { shouldIncludeStack: !0 }), r = new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors"); return r.searchParams.set("version", hh), r.searchParams.set("code", e.code.toString()), r.searchParams.set("message", e.message), Object.assign(Object.assign({}, e), { docUrl: r.href }); } -function JJ(t) { +function XJ(t) { var e; if (typeof t == "string") return { @@ -29353,7 +29361,7 @@ var qS = { exports: {} }; }, a.prototype.emit = function(l, d, p, w, _, P) { var O = r ? r + l : l; if (!this._events[O]) return !1; - var L = this._events[O], B = arguments.length, k, q; + var L = this._events[O], B = arguments.length, k, W; if (L.fn) { switch (L.once && this.removeListener(l, L.fn, void 0, !0), B) { case 1: @@ -29369,29 +29377,29 @@ var qS = { exports: {} }; case 6: return L.fn.call(L.context, d, p, w, _, P), !0; } - for (q = 1, k = new Array(B - 1); q < B; q++) - k[q - 1] = arguments[q]; + for (W = 1, k = new Array(B - 1); W < B; W++) + k[W - 1] = arguments[W]; L.fn.apply(L.context, k); } else { var U = L.length, V; - for (q = 0; q < U; q++) - switch (L[q].once && this.removeListener(l, L[q].fn, void 0, !0), B) { + for (W = 0; W < U; W++) + switch (L[W].once && this.removeListener(l, L[W].fn, void 0, !0), B) { case 1: - L[q].fn.call(L[q].context); + L[W].fn.call(L[W].context); break; case 2: - L[q].fn.call(L[q].context, d); + L[W].fn.call(L[W].context, d); break; case 3: - L[q].fn.call(L[q].context, d, p); + L[W].fn.call(L[W].context, d, p); break; case 4: - L[q].fn.call(L[q].context, d, p, w); + L[W].fn.call(L[W].context, d, p, w); break; default: if (!k) for (V = 1, k = new Array(B - 1); V < B; V++) k[V - 1] = arguments[V]; - L[q].fn.apply(L[q].context, k); + L[W].fn.apply(L[W].context, k); } } return !0; @@ -29418,11 +29426,11 @@ var qS = { exports: {} }; return l ? (d = r ? r + l : l, this._events[d] && o(this, d)) : (this._events = new n(), this._eventsCount = 0), this; }, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = r, a.EventEmitter = a, t.exports = a; })(qS); -var XJ = qS.exports; -const ZJ = /* @__PURE__ */ ns(XJ); -class QJ extends ZJ { +var ZJ = qS.exports; +const QJ = /* @__PURE__ */ ns(ZJ); +class eX extends QJ { } -var eX = function(t, e) { +var tX = function(t, e) { var r = {}; for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); if (t != null && typeof Object.getOwnPropertySymbols == "function") @@ -29430,24 +29438,24 @@ var eX = function(t, e) { e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]); return r; }; -class tX extends QJ { +class rX extends eX { constructor(e) { - var { metadata: r } = e, n = e.preference, { keysUrl: i } = n, s = eX(n, ["keysUrl"]); - super(), this.signer = null, this.isCoinbaseWallet = !0, this.metadata = r, this.preference = s, this.communicator = new GJ({ + var { metadata: r } = e, n = e.preference, { keysUrl: i } = n, s = tX(n, ["keysUrl"]); + super(), this.signer = null, this.isCoinbaseWallet = !0, this.metadata = r, this.preference = s, this.communicator = new YJ({ url: i, metadata: r, preference: s }); - const o = kJ(); + const o = $J(); o && (this.signer = this.initSigner(o)); } async request(e) { try { - if (jY(e), !this.signer) + if (UY(e), !this.signer) switch (e.method) { case "eth_requestAccounts": { const r = await this.requestSignerSelection(e), n = this.initSigner(r); - await n.handshake(e), this.signer = n, $J(r); + await n.handshake(e), this.signer = n, BJ(r); break; } case "net_version": @@ -29460,7 +29468,7 @@ class tX extends QJ { return this.signer.request(e); } catch (r) { const { code: n } = r; - return n === fn.provider.unauthorized && this.disconnect(), Promise.reject(YJ(r)); + return n === fn.provider.unauthorized && this.disconnect(), Promise.reject(JJ(r)); } } /** @deprecated Use `.request({ method: 'eth_requestAccounts' })` instead. */ @@ -29474,7 +29482,7 @@ class tX extends QJ { await ((e = this.signer) === null || e === void 0 ? void 0 : e.cleanup()), this.signer = null, no.clearAll(), this.emit("disconnect", Ar.provider.disconnected("User initiated disconnection")); } requestSignerSelection(e) { - return BJ({ + return FJ({ communicator: this.communicator, preference: this.preference, metadata: this.metadata, @@ -29483,7 +29491,7 @@ class tX extends QJ { }); } initSigner(e) { - return FJ({ + return jJ({ signerType: e, metadata: this.metadata, communicator: this.communicator, @@ -29491,7 +29499,7 @@ class tX extends QJ { }); } } -function rX(t) { +function nX(t) { if (t) { if (!["all", "smartWalletOnly", "eoaOnly"].includes(t.options)) throw new Error(`Invalid options: ${t.options}`); @@ -29499,32 +29507,32 @@ function rX(t) { throw new Error("Attribution cannot contain both auto and dataSuffix properties"); } } -function nX(t) { +function iX(t) { var e; const r = { metadata: t.metadata, preference: t.preference }; - return (e = FY(r)) !== null && e !== void 0 ? e : new tX(r); + return (e = jY(r)) !== null && e !== void 0 ? e : new rX(r); } -const iX = { +const sX = { options: "all" }; -function sX(t) { +function oX(t) { var e; - new no("CBWSDK").setItem("VERSION", hh), zJ(); + new no("CBWSDK").setItem("VERSION", hh), WJ(); const n = { metadata: { appName: t.appName || "Dapp", appLogoUrl: t.appLogoUrl || "", appChainIds: t.appChainIds || [] }, - preference: Object.assign(iX, (e = t.preference) !== null && e !== void 0 ? e : {}) + preference: Object.assign(sX, (e = t.preference) !== null && e !== void 0 ? e : {}) }; - rX(n.preference); + nX(n.preference); let i = null; return { - getProvider: () => (i || (i = nX(n)), i) + getProvider: () => (i || (i = iX(n)), i) }; } function zS(t, e) { @@ -29532,33 +29540,33 @@ function zS(t, e) { return t.apply(e, arguments); }; } -const { toString: oX } = Object.prototype, { getPrototypeOf: Fb } = Object, Sp = /* @__PURE__ */ ((t) => (e) => { - const r = oX.call(e); +const { toString: aX } = Object.prototype, { getPrototypeOf: Fb } = Object, Sp = /* @__PURE__ */ ((t) => (e) => { + const r = aX.call(e); return t[r] || (t[r] = r.slice(8, -1).toLowerCase()); -})(/* @__PURE__ */ Object.create(null)), Ts = (t) => (t = t.toLowerCase(), (e) => Sp(e) === t), Ap = (t) => (e) => typeof e === t, { isArray: Xu } = Array, Bl = Ap("undefined"); -function aX(t) { +})(/* @__PURE__ */ Object.create(null)), Ts = (t) => (t = t.toLowerCase(), (e) => Sp(e) === t), Ap = (t) => (e) => typeof e === t, { isArray: Zu } = Array, Bl = Ap("undefined"); +function cX(t) { return t !== null && !Bl(t) && t.constructor !== null && !Bl(t.constructor) && Ni(t.constructor.isBuffer) && t.constructor.isBuffer(t); } const WS = Ts("ArrayBuffer"); -function cX(t) { +function uX(t) { let e; return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && WS(t.buffer), e; } -const uX = Ap("string"), Ni = Ap("function"), HS = Ap("number"), Pp = (t) => t !== null && typeof t == "object", fX = (t) => t === !0 || t === !1, Gd = (t) => { +const fX = Ap("string"), Ni = Ap("function"), HS = Ap("number"), Pp = (t) => t !== null && typeof t == "object", lX = (t) => t === !0 || t === !1, Gd = (t) => { if (Sp(t) !== "object") return !1; const e = Fb(t); return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in t) && !(Symbol.iterator in t); -}, lX = Ts("Date"), hX = Ts("File"), dX = Ts("Blob"), pX = Ts("FileList"), gX = (t) => Pp(t) && Ni(t.pipe), mX = (t) => { +}, hX = Ts("Date"), dX = Ts("File"), pX = Ts("Blob"), gX = Ts("FileList"), mX = (t) => Pp(t) && Ni(t.pipe), vX = (t) => { let e; return t && (typeof FormData == "function" && t instanceof FormData || Ni(t.append) && ((e = Sp(t)) === "formdata" || // detect form-data instance e === "object" && Ni(t.toString) && t.toString() === "[object FormData]")); -}, vX = Ts("URLSearchParams"), [bX, yX, wX, xX] = ["ReadableStream", "Request", "Response", "Headers"].map(Ts), _X = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); +}, bX = Ts("URLSearchParams"), [yX, wX, xX, _X] = ["ReadableStream", "Request", "Response", "Headers"].map(Ts), EX = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); function ph(t, e, { allOwnKeys: r = !1 } = {}) { if (t === null || typeof t > "u") return; let n, i; - if (typeof t != "object" && (t = [t]), Xu(t)) + if (typeof t != "object" && (t = [t]), Zu(t)) for (n = 0, i = t.length; n < i; n++) e.call(null, t[n], n, t); else { @@ -29581,19 +29589,19 @@ const lc = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typ function av() { const { caseless: t } = VS(this) && this || {}, e = {}, r = (n, i) => { const s = t && KS(e, i) || i; - Gd(e[s]) && Gd(n) ? e[s] = av(e[s], n) : Gd(n) ? e[s] = av({}, n) : Xu(n) ? e[s] = n.slice() : e[s] = n; + Gd(e[s]) && Gd(n) ? e[s] = av(e[s], n) : Gd(n) ? e[s] = av({}, n) : Zu(n) ? e[s] = n.slice() : e[s] = n; }; for (let n = 0, i = arguments.length; n < i; n++) arguments[n] && ph(arguments[n], r); return e; } -const EX = (t, e, r, { allOwnKeys: n } = {}) => (ph(e, (i, s) => { +const SX = (t, e, r, { allOwnKeys: n } = {}) => (ph(e, (i, s) => { r && Ni(i) ? t[s] = zS(i, r) : t[s] = i; -}, { allOwnKeys: n }), t), SX = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), AX = (t, e, r, n) => { +}, { allOwnKeys: n }), t), AX = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), PX = (t, e, r, n) => { t.prototype = Object.create(e.prototype, n), t.prototype.constructor = t, Object.defineProperty(t, "super", { value: e.prototype }), r && Object.assign(t.prototype, r); -}, PX = (t, e, r, n) => { +}, MX = (t, e, r, n) => { let i, s, o; const a = {}; if (e = e || {}, t == null) return e; @@ -29603,44 +29611,44 @@ const EX = (t, e, r, { allOwnKeys: n } = {}) => (ph(e, (i, s) => { t = r !== !1 && Fb(t); } while (t && (!r || r(t, e)) && t !== Object.prototype); return e; -}, MX = (t, e, r) => { +}, IX = (t, e, r) => { t = String(t), (r === void 0 || r > t.length) && (r = t.length), r -= e.length; const n = t.indexOf(e, r); return n !== -1 && n === r; -}, IX = (t) => { +}, CX = (t) => { if (!t) return null; - if (Xu(t)) return t; + if (Zu(t)) return t; let e = t.length; if (!HS(e)) return null; const r = new Array(e); for (; e-- > 0; ) r[e] = t[e]; return r; -}, CX = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Fb(Uint8Array)), TX = (t, e) => { +}, TX = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Fb(Uint8Array)), RX = (t, e) => { const n = (t && t[Symbol.iterator]).call(t); let i; for (; (i = n.next()) && !i.done; ) { const s = i.value; e.call(t, s[0], s[1]); } -}, RX = (t, e) => { +}, DX = (t, e) => { let r; const n = []; for (; (r = t.exec(e)) !== null; ) n.push(r); return n; -}, DX = Ts("HTMLFormElement"), OX = (t) => t.toLowerCase().replace( +}, OX = Ts("HTMLFormElement"), NX = (t) => t.toLowerCase().replace( /[-_\s]([a-z\d])(\w*)/g, function(r, n, i) { return n.toUpperCase() + i; } -), G_ = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), NX = Ts("RegExp"), GS = (t, e) => { +), G_ = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), LX = Ts("RegExp"), GS = (t, e) => { const r = Object.getOwnPropertyDescriptors(t), n = {}; ph(r, (i, s) => { let o; (o = e(i, s, t)) !== !1 && (n[s] = o || i); }), Object.defineProperties(t, n); -}, LX = (t) => { +}, kX = (t) => { GS(t, (e, r) => { if (Ni(t) && ["arguments", "caller", "callee"].indexOf(r) !== -1) return !1; @@ -29655,36 +29663,36 @@ const EX = (t, e, r, { allOwnKeys: n } = {}) => (ph(e, (i, s) => { }); } }); -}, kX = (t, e) => { +}, $X = (t, e) => { const r = {}, n = (i) => { i.forEach((s) => { r[s] = !0; }); }; - return Xu(t) ? n(t) : n(String(t).split(e)), r; -}, $X = () => { -}, BX = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, qm = "abcdefghijklmnopqrstuvwxyz", Y_ = "0123456789", YS = { + return Zu(t) ? n(t) : n(String(t).split(e)), r; +}, BX = () => { +}, FX = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, qm = "abcdefghijklmnopqrstuvwxyz", Y_ = "0123456789", YS = { DIGIT: Y_, ALPHA: qm, ALPHA_DIGIT: qm + qm.toUpperCase() + Y_ -}, FX = (t = 16, e = YS.ALPHA_DIGIT) => { +}, jX = (t = 16, e = YS.ALPHA_DIGIT) => { let r = ""; const { length: n } = e; for (; t--; ) r += e[Math.random() * n | 0]; return r; }; -function jX(t) { +function UX(t) { return !!(t && Ni(t.append) && t[Symbol.toStringTag] === "FormData" && t[Symbol.iterator]); } -const UX = (t) => { +const qX = (t) => { const e = new Array(10), r = (n, i) => { if (Pp(n)) { if (e.indexOf(n) >= 0) return; if (!("toJSON" in n)) { e[i] = n; - const s = Xu(n) ? [] : {}; + const s = Zu(n) ? [] : {}; return ph(n, (o, a) => { const u = r(o, i + 1); !Bl(u) && (s[a] = u); @@ -29694,72 +29702,72 @@ const UX = (t) => { return n; }; return r(t, 0); -}, qX = Ts("AsyncFunction"), zX = (t) => t && (Pp(t) || Ni(t)) && Ni(t.then) && Ni(t.catch), JS = ((t, e) => t ? setImmediate : e ? ((r, n) => (lc.addEventListener("message", ({ source: i, data: s }) => { +}, zX = Ts("AsyncFunction"), WX = (t) => t && (Pp(t) || Ni(t)) && Ni(t.then) && Ni(t.catch), JS = ((t, e) => t ? setImmediate : e ? ((r, n) => (lc.addEventListener("message", ({ source: i, data: s }) => { i === lc && s === r && n.length && n.shift()(); }, !1), (i) => { n.push(i), lc.postMessage(r, "*"); }))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))( typeof setImmediate == "function", Ni(lc.postMessage) -), WX = typeof queueMicrotask < "u" ? queueMicrotask.bind(lc) : typeof process < "u" && process.nextTick || JS, Oe = { - isArray: Xu, +), HX = typeof queueMicrotask < "u" ? queueMicrotask.bind(lc) : typeof process < "u" && process.nextTick || JS, Oe = { + isArray: Zu, isArrayBuffer: WS, - isBuffer: aX, - isFormData: mX, - isArrayBufferView: cX, - isString: uX, + isBuffer: cX, + isFormData: vX, + isArrayBufferView: uX, + isString: fX, isNumber: HS, - isBoolean: fX, + isBoolean: lX, isObject: Pp, isPlainObject: Gd, - isReadableStream: bX, - isRequest: yX, - isResponse: wX, - isHeaders: xX, + isReadableStream: yX, + isRequest: wX, + isResponse: xX, + isHeaders: _X, isUndefined: Bl, - isDate: lX, - isFile: hX, - isBlob: dX, - isRegExp: NX, + isDate: hX, + isFile: dX, + isBlob: pX, + isRegExp: LX, isFunction: Ni, - isStream: gX, - isURLSearchParams: vX, - isTypedArray: CX, - isFileList: pX, + isStream: mX, + isURLSearchParams: bX, + isTypedArray: TX, + isFileList: gX, forEach: ph, merge: av, - extend: EX, - trim: _X, - stripBOM: SX, - inherits: AX, - toFlatObject: PX, + extend: SX, + trim: EX, + stripBOM: AX, + inherits: PX, + toFlatObject: MX, kindOf: Sp, kindOfTest: Ts, - endsWith: MX, - toArray: IX, - forEachEntry: TX, - matchAll: RX, - isHTMLForm: DX, + endsWith: IX, + toArray: CX, + forEachEntry: RX, + matchAll: DX, + isHTMLForm: OX, hasOwnProperty: G_, hasOwnProp: G_, // an alias to avoid ESLint no-prototype-builtins detection reduceDescriptors: GS, - freezeMethods: LX, - toObjectSet: kX, - toCamelCase: OX, - noop: $X, - toFiniteNumber: BX, + freezeMethods: kX, + toObjectSet: $X, + toCamelCase: NX, + noop: BX, + toFiniteNumber: FX, findKey: KS, global: lc, isContextDefined: VS, ALPHABET: YS, - generateString: FX, - isSpecCompliantForm: jX, - toJSONObject: UX, - isAsyncFn: qX, - isThenable: zX, + generateString: jX, + isSpecCompliantForm: UX, + toJSONObject: qX, + isAsyncFn: zX, + isThenable: WX, setImmediate: JS, - asap: WX + asap: HX }; function or(t, e, r, n, i) { Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = t, this.name = "AxiosError", e && (this.code = e), r && (this.config = r), n && (this.request = n), i && (this.response = i, this.status = i.status ? i.status : null); @@ -29811,7 +29819,7 @@ or.from = (t, e, r, n, i, s) => { return u !== Error.prototype; }, (a) => a !== "isAxiosError"), or.call(o, t.message, e, r, n, i), o.cause = t, o.name = t.name, s && Object.assign(o, s), o; }; -const HX = null; +const KX = null; function cv(t) { return Oe.isPlainObject(t) || Oe.isArray(t); } @@ -29823,10 +29831,10 @@ function J_(t, e, r) { return i = QS(i), !r && s ? "[" + i + "]" : i; }).join(r ? "." : "") : e; } -function KX(t) { +function VX(t) { return Oe.isArray(t) && !t.some(cv); } -const VX = Oe.toFlatObject(Oe, {}, null, function(e) { +const GX = Oe.toFlatObject(Oe, {}, null, function(e) { return /^is[A-Z]/.test(e); }); function Mp(t, e, r) { @@ -29855,18 +29863,18 @@ function Mp(t, e, r) { if (P && !L && typeof P == "object") { if (Oe.endsWith(O, "{}")) O = n ? O : O.slice(0, -2), P = JSON.stringify(P); - else if (Oe.isArray(P) && KX(P) || (Oe.isFileList(P) || Oe.endsWith(O, "[]")) && (B = Oe.toArray(P))) - return O = QS(O), B.forEach(function(q, U) { - !(Oe.isUndefined(q) || q === null) && e.append( + else if (Oe.isArray(P) && VX(P) || (Oe.isFileList(P) || Oe.endsWith(O, "[]")) && (B = Oe.toArray(P))) + return O = QS(O), B.forEach(function(W, U) { + !(Oe.isUndefined(W) || W === null) && e.append( // eslint-disable-next-line no-nested-ternary o === !0 ? J_([O], U, s) : o === null ? O : O + "[]", - l(q) + l(W) ); }), !1; } return cv(P) ? !0 : (e.append(J_(L, O, s), l(P)), !1); } - const p = [], w = Object.assign(VX, { + const p = [], w = Object.assign(GX, { defaultVisitor: d, convertValue: l, isVisitable: cv @@ -29919,13 +29927,13 @@ e7.toString = function(e) { return r(i[0]) + "=" + r(i[1]); }, "").join("&"); }; -function GX(t) { +function YX(t) { return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]"); } function t7(t, e, r) { if (!e) return t; - const n = r && r.encode || GX; + const n = r && r.encode || YX; Oe.isFunction(r) && (r = { serialize: r }); @@ -29995,37 +30003,37 @@ const r7 = { silentJSONParsing: !0, forcedJSONParsing: !0, clarifyTimeoutError: !1 -}, YX = typeof URLSearchParams < "u" ? URLSearchParams : jb, JX = typeof FormData < "u" ? FormData : null, XX = typeof Blob < "u" ? Blob : null, ZX = { +}, JX = typeof URLSearchParams < "u" ? URLSearchParams : jb, XX = typeof FormData < "u" ? FormData : null, ZX = typeof Blob < "u" ? Blob : null, QX = { isBrowser: !0, classes: { - URLSearchParams: YX, - FormData: JX, - Blob: XX + URLSearchParams: JX, + FormData: XX, + Blob: ZX }, protocols: ["http", "https", "file", "blob", "url", "data"] -}, Ub = typeof window < "u" && typeof document < "u", uv = typeof navigator == "object" && navigator || void 0, QX = Ub && (!uv || ["ReactNative", "NativeScript", "NS"].indexOf(uv.product) < 0), eZ = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef -self instanceof WorkerGlobalScope && typeof self.importScripts == "function", tZ = Ub && window.location.href || "http://localhost", rZ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +}, Ub = typeof window < "u" && typeof document < "u", uv = typeof navigator == "object" && navigator || void 0, eZ = Ub && (!uv || ["ReactNative", "NativeScript", "NS"].indexOf(uv.product) < 0), tZ = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef +self instanceof WorkerGlobalScope && typeof self.importScripts == "function", rZ = Ub && window.location.href || "http://localhost", nZ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, hasBrowserEnv: Ub, - hasStandardBrowserEnv: QX, - hasStandardBrowserWebWorkerEnv: eZ, + hasStandardBrowserEnv: eZ, + hasStandardBrowserWebWorkerEnv: tZ, navigator: uv, - origin: tZ + origin: rZ }, Symbol.toStringTag, { value: "Module" })), Jn = { - ...rZ, - ...ZX + ...nZ, + ...QX }; -function nZ(t, e) { +function iZ(t, e) { return Mp(t, new Jn.classes.URLSearchParams(), Object.assign({ visitor: function(r, n, i, s) { return Jn.isNode && Oe.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : s.defaultVisitor.apply(this, arguments); } }, e)); } -function iZ(t) { +function sZ(t) { return Oe.matchAll(/\w+|\[(\w*)]/g, t).map((e) => e[0] === "[]" ? "" : e[1] || e[0]); } -function sZ(t) { +function oZ(t) { const e = {}, r = Object.keys(t); let n; const i = r.length; @@ -30039,17 +30047,17 @@ function n7(t) { let o = r[s++]; if (o === "__proto__") return !0; const a = Number.isFinite(+o), u = s >= r.length; - return o = !o && Oe.isArray(i) ? i.length : o, u ? (Oe.hasOwnProp(i, o) ? i[o] = [i[o], n] : i[o] = n, !a) : ((!i[o] || !Oe.isObject(i[o])) && (i[o] = []), e(r, n, i[o], s) && Oe.isArray(i[o]) && (i[o] = sZ(i[o])), !a); + return o = !o && Oe.isArray(i) ? i.length : o, u ? (Oe.hasOwnProp(i, o) ? i[o] = [i[o], n] : i[o] = n, !a) : ((!i[o] || !Oe.isObject(i[o])) && (i[o] = []), e(r, n, i[o], s) && Oe.isArray(i[o]) && (i[o] = oZ(i[o])), !a); } if (Oe.isFormData(t) && Oe.isFunction(t.entries)) { const r = {}; return Oe.forEachEntry(t, (n, i) => { - e(iZ(n), i, r, 0); + e(sZ(n), i, r, 0); }), r; } return null; } -function oZ(t, e, r) { +function aZ(t, e, r) { if (Oe.isString(t)) try { return (e || JSON.parse)(t), Oe.trim(t); @@ -30075,7 +30083,7 @@ const gh = { let a; if (s) { if (n.indexOf("application/x-www-form-urlencoded") > -1) - return nZ(e, this.formSerializer).toString(); + return iZ(e, this.formSerializer).toString(); if ((a = Oe.isFileList(e)) || n.indexOf("multipart/form-data") > -1) { const u = this.env && this.env.FormData; return Mp( @@ -30085,7 +30093,7 @@ const gh = { ); } } - return s || i ? (r.setContentType("application/json", !1), oZ(e)) : e; + return s || i ? (r.setContentType("application/json", !1), aZ(e)) : e; }], transformResponse: [function(e) { const r = this.transitional || gh.transitional, n = r && r.forcedJSONParsing, i = this.responseType === "json"; @@ -30128,7 +30136,7 @@ const gh = { Oe.forEach(["delete", "get", "head", "post", "put", "patch"], (t) => { gh.headers[t] = {}; }); -const aZ = Oe.toObjectSet([ +const cZ = Oe.toObjectSet([ "age", "authorization", "content-length", @@ -30146,28 +30154,28 @@ const aZ = Oe.toObjectSet([ "referer", "retry-after", "user-agent" -]), cZ = (t) => { +]), uZ = (t) => { const e = {}; let r, n, i; return t && t.split(` `).forEach(function(o) { - i = o.indexOf(":"), r = o.substring(0, i).trim().toLowerCase(), n = o.substring(i + 1).trim(), !(!r || e[r] && aZ[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n); + i = o.indexOf(":"), r = o.substring(0, i).trim().toLowerCase(), n = o.substring(i + 1).trim(), !(!r || e[r] && cZ[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n); }), e; }, Q_ = Symbol("internals"); -function Ff(t) { +function jf(t) { return t && String(t).trim().toLowerCase(); } function Yd(t) { return t === !1 || t == null ? t : Oe.isArray(t) ? t.map(Yd) : String(t); } -function uZ(t) { +function fZ(t) { const e = /* @__PURE__ */ Object.create(null), r = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; let n; for (; n = r.exec(t); ) e[n[1]] = n[2]; return e; } -const fZ = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()); +const lZ = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()); function zm(t, e, r, n, i) { if (Oe.isFunction(n)) return n.call(this, e, r); @@ -30178,10 +30186,10 @@ function zm(t, e, r, n, i) { return n.test(e); } } -function lZ(t) { +function hZ(t) { return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, r, n) => r.toUpperCase() + n); } -function hZ(t, e) { +function dZ(t, e) { const r = Oe.toCamelCase(" " + e); ["get", "set", "has"].forEach((n) => { Object.defineProperty(t, n + r, { @@ -30199,7 +30207,7 @@ let yi = class { set(e, r, n) { const i = this; function s(a, u, l) { - const d = Ff(u); + const d = jf(u); if (!d) throw new Error("header name must be a non-empty string"); const p = Oe.findKey(i, d); @@ -30208,8 +30216,8 @@ let yi = class { const o = (a, u) => Oe.forEach(a, (l, d) => s(l, d, u)); if (Oe.isPlainObject(e) || e instanceof this.constructor) o(e, r); - else if (Oe.isString(e) && (e = e.trim()) && !fZ(e)) - o(cZ(e), r); + else if (Oe.isString(e) && (e = e.trim()) && !lZ(e)) + o(uZ(e), r); else if (Oe.isHeaders(e)) for (const [a, u] of e.entries()) s(u, a, n); @@ -30218,14 +30226,14 @@ let yi = class { return this; } get(e, r) { - if (e = Ff(e), e) { + if (e = jf(e), e) { const n = Oe.findKey(this, e); if (n) { const i = this[n]; if (!r) return i; if (r === !0) - return uZ(i); + return fZ(i); if (Oe.isFunction(r)) return r.call(this, i, n); if (Oe.isRegExp(r)) @@ -30235,7 +30243,7 @@ let yi = class { } } has(e, r) { - if (e = Ff(e), e) { + if (e = jf(e), e) { const n = Oe.findKey(this, e); return !!(n && this[n] !== void 0 && (!r || zm(this, this[n], n, r))); } @@ -30245,7 +30253,7 @@ let yi = class { const n = this; let i = !1; function s(o) { - if (o = Ff(o), o) { + if (o = jf(o), o) { const a = Oe.findKey(n, o); a && (!r || zm(n, n[a], a, r)) && (delete n[a], i = !0); } @@ -30269,7 +30277,7 @@ let yi = class { r[o] = Yd(i), delete r[s]; return; } - const a = e ? lZ(s) : String(s).trim(); + const a = e ? hZ(s) : String(s).trim(); a !== s && delete r[s], r[a] = Yd(i), n[a] = !0; }), this; } @@ -30304,8 +30312,8 @@ let yi = class { accessors: {} }).accessors, i = this.prototype; function s(o) { - const a = Ff(o); - n[a] || (hZ(i, o), n[a] = !0); + const a = jf(o); + n[a] || (dZ(i, o), n[a] = !0); } return Oe.isArray(e) ? e.forEach(s) : s(e), this; } @@ -30331,10 +30339,10 @@ function Wm(t, e) { function i7(t) { return !!(t && t.__CANCEL__); } -function Zu(t, e, r) { +function Qu(t, e, r) { or.call(this, t ?? "canceled", or.ERR_CANCELED, e, r), this.name = "CanceledError"; } -Oe.inherits(Zu, or, { +Oe.inherits(Qu, or, { __CANCEL__: !0 }); function s7(t, e, r) { @@ -30347,11 +30355,11 @@ function s7(t, e, r) { r )); } -function dZ(t) { +function pZ(t) { const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(t); return e && e[1] || ""; } -function pZ(t, e) { +function gZ(t, e) { t = t || 10; const r = new Array(t), n = new Array(t); let i = 0, s = 0, o; @@ -30367,7 +30375,7 @@ function pZ(t, e) { return _ ? Math.round(w * 1e3 / _) : void 0; }; } -function gZ(t, e) { +function mZ(t, e) { let r = 0, n = 1e3 / e, i, s; const o = (l, d = Date.now()) => { r = d, i = null, s && (clearTimeout(s), s = null), t.apply(null, l); @@ -30381,8 +30389,8 @@ function gZ(t, e) { } const M0 = (t, e, r = 3) => { let n = 0; - const i = pZ(50, 250); - return gZ((s) => { + const i = gZ(50, 250); + return mZ((s) => { const o = s.loaded, a = s.lengthComputable ? s.total : void 0, u = o - n, l = i(u), d = o <= a; n = o; const p = { @@ -30405,10 +30413,10 @@ const M0 = (t, e, r = 3) => { total: t, loaded: n }), e[1]]; -}, t6 = (t) => (...e) => Oe.asap(() => t(...e)), mZ = Jn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Jn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( +}, t6 = (t) => (...e) => Oe.asap(() => t(...e)), vZ = Jn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Jn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( new URL(Jn.origin), Jn.navigator && /(msie|trident)/i.test(Jn.navigator.userAgent) -) : () => !0, vZ = Jn.hasStandardBrowserEnv ? ( +) : () => !0, bZ = Jn.hasStandardBrowserEnv ? ( // Standard browser envs support document.cookie { write(t, e, r, n, i, s) { @@ -30435,14 +30443,14 @@ const M0 = (t, e, r = 3) => { } } ); -function bZ(t) { +function yZ(t) { return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t); } -function yZ(t, e) { +function wZ(t, e) { return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t; } function o7(t, e) { - return t && !bZ(e) ? yZ(t, e) : e; + return t && !yZ(e) ? wZ(t, e) : e; } const r6 = (t) => t instanceof yi ? { ...t } : t; function Ec(t, e) { @@ -30525,12 +30533,12 @@ const a7 = (t) => { o.setContentType([l || "multipart/form-data", ...d].join("; ")); } } - if (Jn.hasStandardBrowserEnv && (n && Oe.isFunction(n) && (n = n(e)), n || n !== !1 && mZ(e.url))) { - const l = i && s && vZ.read(s); + if (Jn.hasStandardBrowserEnv && (n && Oe.isFunction(n) && (n = n(e)), n || n !== !1 && vZ(e.url))) { + const l = i && s && bZ.read(s); l && o.set(i, l); } return e; -}, wZ = typeof XMLHttpRequest < "u", xZ = wZ && function(t) { +}, xZ = typeof XMLHttpRequest < "u", _Z = xZ && function(t) { return new Promise(function(r, n) { const i = a7(t); let s = i.data; @@ -30544,13 +30552,13 @@ const a7 = (t) => { function B() { if (!L) return; - const q = yi.from( + const W = yi.from( "getAllResponseHeaders" in L && L.getAllResponseHeaders() ), V = { data: !a || a === "text" || a === "json" ? L.responseText : L.response, status: L.status, statusText: L.statusText, - headers: q, + headers: W, config: t, request: L }; @@ -30577,17 +30585,17 @@ const a7 = (t) => { )), L = null; }, s === void 0 && o.setContentType(null), "setRequestHeader" in L && Oe.forEach(o.toJSON(), function(U, V) { L.setRequestHeader(V, U); - }), Oe.isUndefined(i.withCredentials) || (L.withCredentials = !!i.withCredentials), a && a !== "json" && (L.responseType = i.responseType), l && ([w, P] = M0(l, !0), L.addEventListener("progress", w)), u && L.upload && ([p, _] = M0(u), L.upload.addEventListener("progress", p), L.upload.addEventListener("loadend", _)), (i.cancelToken || i.signal) && (d = (q) => { - L && (n(!q || q.type ? new Zu(null, t, L) : q), L.abort(), L = null); + }), Oe.isUndefined(i.withCredentials) || (L.withCredentials = !!i.withCredentials), a && a !== "json" && (L.responseType = i.responseType), l && ([w, P] = M0(l, !0), L.addEventListener("progress", w)), u && L.upload && ([p, _] = M0(u), L.upload.addEventListener("progress", p), L.upload.addEventListener("loadend", _)), (i.cancelToken || i.signal) && (d = (W) => { + L && (n(!W || W.type ? new Qu(null, t, L) : W), L.abort(), L = null); }, i.cancelToken && i.cancelToken.subscribe(d), i.signal && (i.signal.aborted ? d() : i.signal.addEventListener("abort", d))); - const k = dZ(i.url); + const k = pZ(i.url); if (k && Jn.protocols.indexOf(k) === -1) { n(new or("Unsupported protocol " + k + ":", or.ERR_BAD_REQUEST, t)); return; } L.send(s || null); }); -}, _Z = (t, e) => { +}, EZ = (t, e) => { const { length: r } = t = t ? t.filter(Boolean) : []; if (e || r) { let n = new AbortController(), i; @@ -30595,7 +30603,7 @@ const a7 = (t) => { if (!i) { i = !0, a(); const d = l instanceof Error ? l : this.reason; - n.abort(d instanceof or ? d : new Zu(d instanceof Error ? d.message : d)); + n.abort(d instanceof or ? d : new Qu(d instanceof Error ? d.message : d)); } }; let o = e && setTimeout(() => { @@ -30610,7 +30618,7 @@ const a7 = (t) => { const { signal: u } = n; return u.unsubscribe = () => Oe.asap(a), u; } -}, EZ = function* (t, e) { +}, SZ = function* (t, e) { let r = t.byteLength; if (r < e) { yield t; @@ -30619,10 +30627,10 @@ const a7 = (t) => { let n = 0, i; for (; n < r; ) i = n + e, yield t.slice(n, i), n = i; -}, SZ = async function* (t, e) { - for await (const r of AZ(t)) - yield* EZ(r, e); -}, AZ = async function* (t) { +}, AZ = async function* (t, e) { + for await (const r of PZ(t)) + yield* SZ(r, e); +}, PZ = async function* (t) { if (t[Symbol.asyncIterator]) { yield* t; return; @@ -30639,7 +30647,7 @@ const a7 = (t) => { await e.cancel(); } }, n6 = (t, e, r, n) => { - const i = SZ(t, e); + const i = AZ(t, e); let s = 0, o, a = (u) => { o || (o = !0, n && n(u)); }; @@ -30667,13 +30675,13 @@ const a7 = (t) => { }, { highWaterMark: 2 }); -}, Ip = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", c7 = Ip && typeof ReadableStream == "function", PZ = Ip && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), u7 = (t, ...e) => { +}, Ip = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", c7 = Ip && typeof ReadableStream == "function", MZ = Ip && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), u7 = (t, ...e) => { try { return !!t(...e); } catch { return !1; } -}, MZ = c7 && u7(() => { +}, IZ = c7 && u7(() => { let t = !1; const e = new Request(Jn.origin, { body: new ReadableStream(), @@ -30693,7 +30701,7 @@ Ip && ((t) => { }); }); })(new Response()); -const IZ = async (t) => { +const CZ = async (t) => { if (t == null) return 0; if (Oe.isBlob(t)) @@ -30706,11 +30714,11 @@ const IZ = async (t) => { if (Oe.isArrayBufferView(t) || Oe.isArrayBuffer(t)) return t.byteLength; if (Oe.isURLSearchParams(t) && (t = t + ""), Oe.isString(t)) - return (await PZ(t)).byteLength; -}, CZ = async (t, e) => { + return (await MZ(t)).byteLength; +}, TZ = async (t, e) => { const r = Oe.toFiniteNumber(t.getContentLength()); - return r ?? IZ(e); -}, TZ = Ip && (async (t) => { + return r ?? CZ(e); +}, RZ = Ip && (async (t) => { let { url: e, method: r, @@ -30726,13 +30734,13 @@ const IZ = async (t) => { fetchOptions: w } = a7(t); l = l ? (l + "").toLowerCase() : "text"; - let _ = _Z([i, s && s.toAbortSignal()], o), P; + let _ = EZ([i, s && s.toAbortSignal()], o), P; const O = _ && _.unsubscribe && (() => { _.unsubscribe(); }); let L; try { - if (u && MZ && r !== "get" && r !== "head" && (L = await CZ(d, n)) !== 0) { + if (u && IZ && r !== "get" && r !== "head" && (L = await TZ(d, n)) !== 0) { let V = new Request(e, { method: "POST", body: n, @@ -30758,8 +30766,8 @@ const IZ = async (t) => { credentials: B ? p : void 0 }); let k = await fetch(P); - const q = fv && (l === "stream" || l === "response"); - if (fv && (a || q && O)) { + const W = fv && (l === "stream" || l === "response"); + if (fv && (a || W && O)) { const V = {}; ["status", "statusText", "headers"].forEach((ge) => { V[ge] = k[ge]; @@ -30777,7 +30785,7 @@ const IZ = async (t) => { } l = l || "text"; let U = await I0[Oe.findKey(I0, l) || "text"](k, t); - return !q && O && O(), await new Promise((V, Q) => { + return !W && O && O(), await new Promise((V, Q) => { s7(V, Q, { data: U, headers: yi.from(k.headers), @@ -30796,9 +30804,9 @@ const IZ = async (t) => { ) : or.from(B, B && B.code, t, P); } }), lv = { - http: HX, - xhr: xZ, - fetch: TZ + http: KX, + xhr: _Z, + fetch: RZ }; Oe.forEach(lv, (t, e) => { if (t) { @@ -30809,7 +30817,7 @@ Oe.forEach(lv, (t, e) => { Object.defineProperty(t, "adapterName", { value: e }); } }); -const s6 = (t) => `- ${t}`, RZ = (t) => Oe.isFunction(t) || t === null || t === !1, f7 = { +const s6 = (t) => `- ${t}`, DZ = (t) => Oe.isFunction(t) || t === null || t === !1, f7 = { getAdapter: (t) => { t = Oe.isArray(t) ? t : [t]; const { length: e } = t; @@ -30818,7 +30826,7 @@ const s6 = (t) => `- ${t}`, RZ = (t) => Oe.isFunction(t) || t === null || t === for (let s = 0; s < e; s++) { r = t[s]; let o; - if (n = r, !RZ(r) && (n = lv[(o = String(r)).toLowerCase()], n === void 0)) + if (n = r, !DZ(r) && (n = lv[(o = String(r)).toLowerCase()], n === void 0)) throw new or(`Unknown adapter '${o}'`); if (n) break; @@ -30842,7 +30850,7 @@ const s6 = (t) => `- ${t}`, RZ = (t) => Oe.isFunction(t) || t === null || t === }; function Hm(t) { if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted) - throw new Zu(null, t); + throw new Qu(null, t); } function o6(t) { return Hm(t), t.headers = yi.from(t.headers), t.data = Wm.call( @@ -30890,7 +30898,7 @@ Cp.transitional = function(e, r, n) { Cp.spelling = function(e) { return (r, n) => (console.warn(`${n} is likely a misspelling of ${e}`), !0); }; -function DZ(t, e, r) { +function OZ(t, e, r) { if (typeof t != "object") throw new or("options must be an object", or.ERR_BAD_OPTION_VALUE); const n = Object.keys(t); @@ -30908,7 +30916,7 @@ function DZ(t, e, r) { } } const Jd = { - assertOptions: DZ, + assertOptions: OZ, validators: Cp }, Us = Jd.validators; let pc = class { @@ -31035,7 +31043,7 @@ Oe.forEach(["post", "put", "patch"], function(e) { } pc.prototype[e] = r(), pc.prototype[e + "Form"] = r(!0); }); -let OZ = class h7 { +let NZ = class h7 { constructor(e) { if (typeof e != "function") throw new TypeError("executor must be a function."); @@ -31059,7 +31067,7 @@ let OZ = class h7 { n.unsubscribe(s); }, o; }, e(function(s, o, a) { - n.reason || (n.reason = new Zu(s, o, a), r(n.reason)); + n.reason || (n.reason = new Qu(s, o, a), r(n.reason)); }); } /** @@ -31108,12 +31116,12 @@ let OZ = class h7 { }; } }; -function NZ(t) { +function LZ(t) { return function(r) { return t.apply(null, r); }; } -function LZ(t) { +function kZ(t) { return Oe.isObject(t) && t.isAxiosError === !0; } const hv = { @@ -31192,8 +31200,8 @@ function d7(t) { } const mn = d7(gh); mn.Axios = pc; -mn.CanceledError = Zu; -mn.CancelToken = OZ; +mn.CanceledError = Qu; +mn.CancelToken = NZ; mn.isCancel = i7; mn.VERSION = l7; mn.toFormData = Mp; @@ -31202,8 +31210,8 @@ mn.Cancel = mn.CanceledError; mn.all = function(e) { return Promise.all(e); }; -mn.spread = NZ; -mn.isAxiosError = LZ; +mn.spread = LZ; +mn.isAxiosError = kZ; mn.mergeConfig = Ec; mn.AxiosHeaders = yi; mn.formToJSON = (t) => n7(Oe.isHTMLForm(t) ? new FormData(t) : t); @@ -31211,22 +31219,22 @@ mn.getAdapter = f7.getAdapter; mn.HttpStatusCode = hv; mn.default = mn; const { - Axios: Boe, + Axios: joe, AxiosError: p7, - CanceledError: Foe, - isCancel: joe, - CancelToken: Uoe, - VERSION: qoe, - all: zoe, - Cancel: Woe, - isAxiosError: Hoe, - spread: Koe, - toFormData: Voe, - AxiosHeaders: Goe, - HttpStatusCode: Yoe, - formToJSON: Joe, - getAdapter: Xoe, - mergeConfig: Zoe + CanceledError: Uoe, + isCancel: qoe, + CancelToken: zoe, + VERSION: Woe, + all: Hoe, + Cancel: Koe, + isAxiosError: Voe, + spread: Goe, + toFormData: Yoe, + AxiosHeaders: Joe, + HttpStatusCode: Xoe, + formToJSON: Zoe, + getAdapter: Qoe, + mergeConfig: eae } = mn, g7 = mn.create({ timeout: 6e4, headers: { @@ -31234,7 +31242,7 @@ const { token: localStorage.getItem("auth") } }); -function kZ(t) { +function $Z(t) { var e, r, n; if (((e = t.data) == null ? void 0 : e.success) !== !0) { const i = new p7( @@ -31248,7 +31256,7 @@ function kZ(t) { } else return t; } -function $Z(t) { +function BZ(t) { var r; console.log(t); const e = (r = t.response) == null ? void 0 : r.data; @@ -31266,10 +31274,10 @@ function $Z(t) { return Promise.reject(t); } g7.interceptors.response.use( - kZ, - $Z + $Z, + BZ ); -class BZ { +class FZ { constructor(e) { vs(this, "_apiBase", ""); this.request = e; @@ -31306,7 +31314,7 @@ class BZ { return (await this.request.post("/api/v2/user/account/bind", e)).data; } } -const ka = new BZ(g7), FZ = { +const ka = new FZ(g7), jZ = { projectId: "7a4434fefbcc9af474fb5c995e47d286", metadata: { name: "codatta", @@ -31314,7 +31322,7 @@ const ka = new BZ(g7), FZ = { url: "https://codatta.io/", icons: ["https://avatars.githubusercontent.com/u/171659315"] } -}, jZ = sX({ +}, UZ = oX({ appName: "codatta", appLogoUrl: "https://avatars.githubusercontent.com/u/171659315" }), m7 = Ta({ @@ -31329,7 +31337,7 @@ const ka = new BZ(g7), FZ = { function Tp() { return Tn(m7); } -function Qoe(t) { +function tae(t) { const { apiBaseUrl: e } = t, [r, n] = Yt([]), [i, s] = Yt([]), [o, a] = Yt(null), [u, l] = Yt(!1), [d, p] = Yt([]), w = (O) => { a(O); const B = { @@ -31347,35 +31355,37 @@ function Qoe(t) { if (L) s([L]); else { - const B = O.filter((U) => U.featured || U.installed), k = O.filter((U) => !U.featured && !U.installed), q = [...B, ...k]; - n(q), s(B); + const B = O.filter((U) => U.featured || U.installed), k = O.filter((U) => !U.featured && !U.installed), W = [...B, ...k]; + n(W), s(B); } } async function P() { const O = [], L = /* @__PURE__ */ new Map(); mD.forEach((k) => { - const q = new Il(k); - k.name === "Coinbase Wallet" && q.EIP6963Detected({ + const W = new yu(k); + k.name === "Coinbase Wallet" && W.EIP6963Detected({ info: { name: "Coinbase Wallet", uuid: "coinbase", icon: k.image, rdns: "coinbase" }, - provider: jZ.getProvider() - }), L.set(q.key, q), O.push(q); - }), (await wY()).forEach((k) => { - const q = L.get(k.info.name); - if (q) - q.EIP6963Detected(k); + provider: UZ.getProvider() + }), L.set(W.key, W), O.push(W); + }), (await xY()).forEach((k) => { + const W = L.get(k.info.name); + if (W) + W.EIP6963Detected(k); else { - const U = new Il(k); + const U = new yu(k); L.set(U.key, U), O.push(U); } }); try { - const k = JSON.parse(localStorage.getItem("xn-last-used-info") || "{}"), q = L.get(k.key); - if (q) { - if (q.lastUsed = !0, k.provider === "UniversalProvider") { - const U = await J1.init(FZ); - U.session && (q.setUniversalProvider(U), console.log("Restored UniversalProvider for wallet:", q.key)); - } else k.provider === "EIP1193Provider" && q.installed && console.log("Using detected EIP1193Provider for wallet:", q.key); - a(q); + const k = JSON.parse(localStorage.getItem("xn-last-used-info") || "{}"), W = L.get(k.key); + if (W && k.provider === "EIP1193Provider" && W.installed) + a(W); + else if (k.provider === "UniversalProvider") { + const U = await J1.init(jZ); + if (U.session) { + const V = new yu(U); + a(V), console.log("Restored UniversalProvider for wallet:", V.key); + } } } catch (k) { console.log(k); @@ -31405,14 +31415,14 @@ function Qoe(t) { * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const UZ = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), v7 = (...t) => t.filter((e, r, n) => !!e && e.trim() !== "" && n.indexOf(e) === r).join(" ").trim(); +const qZ = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), v7 = (...t) => t.filter((e, r, n) => !!e && e.trim() !== "" && n.indexOf(e) === r).join(" ").trim(); /** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -var qZ = { +var zZ = { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, @@ -31429,7 +31439,7 @@ var qZ = { * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const zZ = Dv( +const WZ = Dv( ({ color: t = "currentColor", size: e = 24, @@ -31443,7 +31453,7 @@ const zZ = Dv( "svg", { ref: u, - ...qZ, + ...zZ, width: e, height: e, stroke: t, @@ -31465,10 +31475,10 @@ const zZ = Dv( */ const ls = (t, e) => { const r = Dv( - ({ className: n, ...i }, s) => e0(zZ, { + ({ className: n, ...i }, s) => e0(WZ, { ref: s, iconNode: e, - className: v7(`lucide-${UZ(t)}`, n), + className: v7(`lucide-${qZ(t)}`, n), ...i }) ); @@ -31480,7 +31490,7 @@ const ls = (t, e) => { * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const WZ = ls("ArrowLeft", [ +const HZ = ls("ArrowLeft", [ ["path", { d: "m12 19-7-7 7-7", key: "1l729n" }], ["path", { d: "M19 12H5", key: "x3x0zl" }] ]); @@ -31500,7 +31510,7 @@ const b7 = ls("ArrowRight", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const HZ = ls("ChevronRight", [ +const KZ = ls("ChevronRight", [ ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }] ]); /** @@ -31509,7 +31519,7 @@ const HZ = ls("ChevronRight", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const KZ = ls("CircleCheckBig", [ +const VZ = ls("CircleCheckBig", [ ["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }], ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }] ]); @@ -31519,7 +31529,7 @@ const KZ = ls("CircleCheckBig", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const VZ = ls("Download", [ +const GZ = ls("Download", [ ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }], ["polyline", { points: "7 10 12 15 17 10", key: "2ggqvy" }], ["line", { x1: "12", x2: "12", y1: "15", y2: "3", key: "1vk2je" }] @@ -31530,7 +31540,7 @@ const VZ = ls("Download", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const GZ = ls("Globe", [ +const YZ = ls("Globe", [ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }], ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }], ["path", { d: "M2 12h20", key: "9i4pu4" }] @@ -31556,7 +31566,7 @@ const y7 = ls("Laptop", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const YZ = ls("Link2", [ +const JZ = ls("Link2", [ ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }], ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }], ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }] @@ -31576,7 +31586,7 @@ const Sc = ls("LoaderCircle", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const JZ = ls("Mail", [ +const XZ = ls("Mail", [ ["rect", { width: "20", height: "16", x: "2", y: "4", rx: "2", key: "18n3k1" }], ["path", { d: "m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7", key: "1ocrg3" }] ]); @@ -31596,7 +31606,7 @@ const w7 = ls("Search", [ * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ -const XZ = ls("UserRoundCheck", [ +const ZZ = ls("UserRoundCheck", [ ["path", { d: "M2 21a8 8 0 0 1 13.292-6", key: "bjp14o" }], ["circle", { cx: "10", cy: "8", r: "5", key: "o932ke" }], ["path", { d: "m16 19 2 2 4-4", key: "1b14m6" }] @@ -31604,7 +31614,7 @@ const XZ = ls("UserRoundCheck", [ function Rp(t, e, r) { t || c6.has(e) || (console.warn(e), c6.add(e)); } -function ZZ(t) { +function QZ(t) { if (typeof Proxy > "u") return t; const e = /* @__PURE__ */ new Map(), r = (...n) => (process.env.NODE_ENV !== "production" && Rp(!1, "motion() is deprecated. Use motion.create() instead."), t(...n)); @@ -31682,36 +31692,36 @@ const zb = [ "skew", "skewX", "skewY" -], Lc = new Set(mh), Js = (t) => t * 1e3, No = (t) => t / 1e3, QZ = { +], Lc = new Set(mh), Js = (t) => t * 1e3, No = (t) => t / 1e3, eQ = { type: "spring", stiffness: 500, damping: 25, restSpeed: 10 -}, eQ = (t) => ({ +}, tQ = (t) => ({ type: "spring", stiffness: 550, damping: t === 0 ? 2 * Math.sqrt(550) : 30, restSpeed: 10 -}), tQ = { +}), rQ = { type: "keyframes", duration: 0.8 -}, rQ = { +}, nQ = { type: "keyframes", ease: [0.25, 0.1, 0.35, 1], duration: 0.3 -}, nQ = (t, { keyframes: e }) => e.length > 2 ? tQ : Lc.has(t) ? t.startsWith("scale") ? eQ(e[1]) : QZ : rQ; +}, iQ = (t, { keyframes: e }) => e.length > 2 ? rQ : Lc.has(t) ? t.startsWith("scale") ? tQ(e[1]) : eQ : nQ; function Hb(t, e) { return t ? t[e] || t.default || t : void 0; } -const iQ = { +const sQ = { useManualTiming: !1 -}, sQ = (t) => t !== null; +}, oQ = (t) => t !== null; function Np(t, { repeat: e, repeatType: r = "loop" }, n) { - const i = t.filter(sQ), s = e && r !== "loop" && e % 2 === 1 ? 0 : i.length - 1; + const i = t.filter(oQ), s = e && r !== "loop" && e % 2 === 1 ? 0 : i.length - 1; return !s || n === void 0 ? i[s] : n; } const Un = (t) => t; -function oQ(t) { +function aQ(t) { let e = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), n = !1, i = !1; const s = /* @__PURE__ */ new WeakSet(); let o = { @@ -31762,67 +31772,67 @@ const Pd = [ // Write "postRender" // Compute -], aQ = 40; +], cQ = 40; function _7(t, e) { let r = !1, n = !0; const i = { delta: 0, timestamp: 0, isProcessing: !1 - }, s = () => r = !0, o = Pd.reduce((B, k) => (B[k] = oQ(s), B), {}), { read: a, resolveKeyframes: u, update: l, preRender: d, render: p, postRender: w } = o, _ = () => { + }, s = () => r = !0, o = Pd.reduce((B, k) => (B[k] = aQ(s), B), {}), { read: a, resolveKeyframes: u, update: l, preRender: d, render: p, postRender: w } = o, _ = () => { const B = performance.now(); - r = !1, i.delta = n ? 1e3 / 60 : Math.max(Math.min(B - i.timestamp, aQ), 1), i.timestamp = B, i.isProcessing = !0, a.process(i), u.process(i), l.process(i), d.process(i), p.process(i), w.process(i), i.isProcessing = !1, r && e && (n = !1, t(_)); + r = !1, i.delta = n ? 1e3 / 60 : Math.max(Math.min(B - i.timestamp, cQ), 1), i.timestamp = B, i.isProcessing = !0, a.process(i), u.process(i), l.process(i), d.process(i), p.process(i), w.process(i), i.isProcessing = !1, r && e && (n = !1, t(_)); }, P = () => { r = !0, n = !0, i.isProcessing || t(_); }; return { schedule: Pd.reduce((B, k) => { - const q = o[k]; - return B[k] = (U, V = !1, Q = !1) => (r || P(), q.schedule(U, V, Q)), B; + const W = o[k]; + return B[k] = (U, V = !1, Q = !1) => (r || P(), W.schedule(U, V, Q)), B; }, {}), cancel: (B) => { for (let k = 0; k < Pd.length; k++) o[Pd[k]].cancel(B); }, state: i, steps: o }; } -const { schedule: Lr, cancel: Pa, state: Fn, steps: Km } = _7(typeof requestAnimationFrame < "u" ? requestAnimationFrame : Un, !0), E7 = (t, e, r) => (((1 - 3 * r + 3 * e) * t + (3 * r - 6 * e)) * t + 3 * e) * t, cQ = 1e-7, uQ = 12; -function fQ(t, e, r, n, i) { +const { schedule: Lr, cancel: Pa, state: Fn, steps: Km } = _7(typeof requestAnimationFrame < "u" ? requestAnimationFrame : Un, !0), E7 = (t, e, r) => (((1 - 3 * r + 3 * e) * t + (3 * r - 6 * e)) * t + 3 * e) * t, uQ = 1e-7, fQ = 12; +function lQ(t, e, r, n, i) { let s, o, a = 0; do o = e + (r - e) / 2, s = E7(o, n, i) - t, s > 0 ? r = o : e = o; - while (Math.abs(s) > cQ && ++a < uQ); + while (Math.abs(s) > uQ && ++a < fQ); return o; } function vh(t, e, r, n) { if (t === e && r === n) return Un; - const i = (s) => fQ(s, 0, 1, t, r); + const i = (s) => lQ(s, 0, 1, t, r); return (s) => s === 0 || s === 1 ? s : E7(i(s), e, n); } const S7 = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, A7 = (t) => (e) => 1 - t(1 - e), P7 = /* @__PURE__ */ vh(0.33, 1.53, 0.69, 0.99), Kb = /* @__PURE__ */ A7(P7), M7 = /* @__PURE__ */ S7(Kb), I7 = (t) => (t *= 2) < 1 ? 0.5 * Kb(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Vb = (t) => 1 - Math.sin(Math.acos(t)), C7 = A7(Vb), T7 = S7(Vb), R7 = (t) => /^0[^.\s]+$/u.test(t); -function lQ(t) { +function hQ(t) { return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || R7(t) : !0; } -let Qu = Un, Wo = Un; -process.env.NODE_ENV !== "production" && (Qu = (t, e) => { +let ef = Un, Wo = Un; +process.env.NODE_ENV !== "production" && (ef = (t, e) => { !t && typeof console < "u" && console.warn(e); }, Wo = (t, e) => { if (!t) throw new Error(e); }); -const D7 = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), O7 = (t) => (e) => typeof e == "string" && e.startsWith(t), N7 = /* @__PURE__ */ O7("--"), hQ = /* @__PURE__ */ O7("var(--"), Gb = (t) => hQ(t) ? dQ.test(t.split("/*")[0].trim()) : !1, dQ = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, pQ = ( +const D7 = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), O7 = (t) => (e) => typeof e == "string" && e.startsWith(t), N7 = /* @__PURE__ */ O7("--"), dQ = /* @__PURE__ */ O7("var(--"), Gb = (t) => dQ(t) ? pQ.test(t.split("/*")[0].trim()) : !1, pQ = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, gQ = ( // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u ); -function gQ(t) { - const e = pQ.exec(t); +function mQ(t) { + const e = gQ.exec(t); if (!e) return [,]; const [, r, n, i] = e; return [`--${r ?? n}`, i]; } -const mQ = 4; +const vQ = 4; function L7(t, e, r = 1) { - Wo(r <= mQ, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`); - const [n, i] = gQ(t); + Wo(r <= vQ, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`); + const [n, i] = mQ(t); if (!n) return; const s = window.getComputedStyle(e).getPropertyValue(n); @@ -31832,25 +31842,25 @@ function L7(t, e, r = 1) { } return Gb(i) ? L7(i, e, r + 1) : i; } -const Ma = (t, e, r) => r > e ? e : r < t ? t : r, ef = { +const Ma = (t, e, r) => r > e ? e : r < t ? t : r, tf = { test: (t) => typeof t == "number", parse: parseFloat, transform: (t) => t }, jl = { - ...ef, + ...tf, transform: (t) => Ma(0, 1, t) }, Md = { - ...ef, + ...tf, default: 1 }, bh = (t) => ({ test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1, parse: parseFloat, transform: (e) => `${e}${t}` -}), ca = /* @__PURE__ */ bh("deg"), Xs = /* @__PURE__ */ bh("%"), Vt = /* @__PURE__ */ bh("px"), vQ = /* @__PURE__ */ bh("vh"), bQ = /* @__PURE__ */ bh("vw"), f6 = { +}), ca = /* @__PURE__ */ bh("deg"), Xs = /* @__PURE__ */ bh("%"), Vt = /* @__PURE__ */ bh("px"), bQ = /* @__PURE__ */ bh("vh"), yQ = /* @__PURE__ */ bh("vw"), f6 = { ...Xs, parse: (t) => Xs.parse(t) / 100, transform: (t) => Xs.transform(t * 100) -}, yQ = /* @__PURE__ */ new Set([ +}, wQ = /* @__PURE__ */ new Set([ "width", "height", "top", @@ -31861,7 +31871,7 @@ const Ma = (t, e, r) => r > e ? e : r < t ? t : r, ef = { "y", "translateX", "translateY" -]), l6 = (t) => t === ef || t === Vt, h6 = (t, e) => parseFloat(t.split(", ")[e]), d6 = (t, e) => (r, { transform: n }) => { +]), l6 = (t) => t === tf || t === Vt, h6 = (t, e) => parseFloat(t.split(", ")[e]), d6 = (t, e) => (r, { transform: n }) => { if (n === "none" || !n) return 0; const i = n.match(/^matrix3d\((.+)\)$/u); @@ -31871,15 +31881,15 @@ const Ma = (t, e, r) => r > e ? e : r < t ? t : r, ef = { const s = n.match(/^matrix\((.+)\)$/u); return s ? h6(s[1], t) : 0; } -}, wQ = /* @__PURE__ */ new Set(["x", "y", "z"]), xQ = mh.filter((t) => !wQ.has(t)); -function _Q(t) { +}, xQ = /* @__PURE__ */ new Set(["x", "y", "z"]), _Q = mh.filter((t) => !xQ.has(t)); +function EQ(t) { const e = []; - return xQ.forEach((r) => { + return _Q.forEach((r) => { const n = t.getValue(r); n !== void 0 && (e.push([r, n.get()]), n.set(r.startsWith("scale") ? 1 : 0)); }), e; } -const ku = { +const $u = { // Dimensions width: ({ x: t }, { paddingLeft: e = "0", paddingRight: r = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(r), height: ({ y: t }, { paddingTop: e = "0", paddingBottom: r = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(r), @@ -31891,18 +31901,18 @@ const ku = { x: d6(4, 13), y: d6(5, 14) }; -ku.translateX = ku.x; -ku.translateY = ku.y; -const k7 = (t) => (e) => e.test(t), EQ = { +$u.translateX = $u.x; +$u.translateY = $u.y; +const k7 = (t) => (e) => e.test(t), SQ = { test: (t) => t === "auto", parse: (t) => t -}, $7 = [ef, Vt, Xs, ca, bQ, vQ, EQ], p6 = (t) => $7.find(k7(t)), gc = /* @__PURE__ */ new Set(); +}, $7 = [tf, Vt, Xs, ca, yQ, bQ, SQ], p6 = (t) => $7.find(k7(t)), gc = /* @__PURE__ */ new Set(); let pv = !1, gv = !1; function B7() { if (gv) { const t = Array.from(gc).filter((n) => n.needsMeasurement), e = new Set(t.map((n) => n.element)), r = /* @__PURE__ */ new Map(); e.forEach((n) => { - const i = _Q(n); + const i = EQ(n); i.length && (r.set(n, i), n.render()); }), t.forEach((n) => n.measureInitialState()), e.forEach((n) => { n.render(); @@ -31922,7 +31932,7 @@ function F7() { t.readKeyframes(), t.needsMeasurement && (gv = !0); }); } -function SQ() { +function AQ() { F7(), B7(); } class Yb { @@ -31966,11 +31976,11 @@ class Yb { this.isComplete || this.scheduleResolve(); } } -const rl = (t) => Math.round(t * 1e5) / 1e5, Jb = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; -function AQ(t) { +const nl = (t) => Math.round(t * 1e5) / 1e5, Jb = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; +function PQ(t) { return t == null; } -const PQ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, Xb = (t, e) => (r) => !!(typeof r == "string" && PQ.test(r) && r.startsWith(t) || e && !AQ(r) && Object.prototype.hasOwnProperty.call(r, e)), j7 = (t, e, r) => (n) => { +const MQ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, Xb = (t, e) => (r) => !!(typeof r == "string" && MQ.test(r) && r.startsWith(t) || e && !PQ(r) && Object.prototype.hasOwnProperty.call(r, e)), j7 = (t, e, r) => (n) => { if (typeof n != "string") return n; const [i, s, o, a] = n.match(Jb); @@ -31980,15 +31990,15 @@ const PQ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s [r]: parseFloat(o), alpha: a !== void 0 ? parseFloat(a) : 1 }; -}, MQ = (t) => Ma(0, 255, t), Vm = { - ...ef, - transform: (t) => Math.round(MQ(t)) +}, IQ = (t) => Ma(0, 255, t), Vm = { + ...tf, + transform: (t) => Math.round(IQ(t)) }, hc = { test: /* @__PURE__ */ Xb("rgb", "red"), parse: /* @__PURE__ */ j7("red", "green", "blue"), - transform: ({ red: t, green: e, blue: r, alpha: n = 1 }) => "rgba(" + Vm.transform(t) + ", " + Vm.transform(e) + ", " + Vm.transform(r) + ", " + rl(jl.transform(n)) + ")" + transform: ({ red: t, green: e, blue: r, alpha: n = 1 }) => "rgba(" + Vm.transform(t) + ", " + Vm.transform(e) + ", " + Vm.transform(r) + ", " + nl(jl.transform(n)) + ")" }; -function IQ(t) { +function CQ(t) { let e = "", r = "", n = "", i = ""; return t.length > 5 ? (e = t.substring(1, 3), r = t.substring(3, 5), n = t.substring(5, 7), i = t.substring(7, 9)) : (e = t.substring(1, 2), r = t.substring(2, 3), n = t.substring(3, 4), i = t.substring(4, 5), e += e, r += r, n += n, i += i), { red: parseInt(e, 16), @@ -31999,22 +32009,22 @@ function IQ(t) { } const mv = { test: /* @__PURE__ */ Xb("#"), - parse: IQ, + parse: CQ, transform: hc.transform }, fu = { test: /* @__PURE__ */ Xb("hsl", "hue"), parse: /* @__PURE__ */ j7("hue", "saturation", "lightness"), - transform: ({ hue: t, saturation: e, lightness: r, alpha: n = 1 }) => "hsla(" + Math.round(t) + ", " + Xs.transform(rl(e)) + ", " + Xs.transform(rl(r)) + ", " + rl(jl.transform(n)) + ")" + transform: ({ hue: t, saturation: e, lightness: r, alpha: n = 1 }) => "hsla(" + Math.round(t) + ", " + Xs.transform(nl(e)) + ", " + Xs.transform(nl(r)) + ", " + nl(jl.transform(n)) + ")" }, Yn = { test: (t) => hc.test(t) || mv.test(t) || fu.test(t), parse: (t) => hc.test(t) ? hc.parse(t) : fu.test(t) ? fu.parse(t) : mv.parse(t), transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? hc.transform(t) : fu.transform(t) -}, CQ = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu; -function TQ(t) { +}, TQ = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu; +function RQ(t) { var e, r; - return isNaN(t) && typeof t == "string" && (((e = t.match(Jb)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match(CQ)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; + return isNaN(t) && typeof t == "string" && (((e = t.match(Jb)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match(TQ)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; } -const U7 = "number", q7 = "color", RQ = "var", DQ = "var(", g6 = "${}", OQ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; +const U7 = "number", q7 = "color", DQ = "var", OQ = "var(", g6 = "${}", NQ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; function Ul(t) { const e = t.toString(), r = [], n = { color: [], @@ -32022,7 +32032,7 @@ function Ul(t) { var: [] }, i = []; let s = 0; - const a = e.replace(OQ, (u) => (Yn.test(u) ? (n.color.push(s), i.push(q7), r.push(Yn.parse(u))) : u.startsWith(DQ) ? (n.var.push(s), i.push(RQ), r.push(u)) : (n.number.push(s), i.push(U7), r.push(parseFloat(u))), ++s, g6)).split(g6); + const a = e.replace(NQ, (u) => (Yn.test(u) ? (n.color.push(s), i.push(q7), r.push(Yn.parse(u))) : u.startsWith(OQ) ? (n.var.push(s), i.push(DQ), r.push(u)) : (n.number.push(s), i.push(U7), r.push(parseFloat(u))), ++s, g6)).split(g6); return { values: r, split: a, indexes: n, types: i }; } function z7(t) { @@ -32035,23 +32045,23 @@ function W7(t) { for (let o = 0; o < n; o++) if (s += e[o], i[o] !== void 0) { const a = r[o]; - a === U7 ? s += rl(i[o]) : a === q7 ? s += Yn.transform(i[o]) : s += i[o]; + a === U7 ? s += nl(i[o]) : a === q7 ? s += Yn.transform(i[o]) : s += i[o]; } return s; }; } -const NQ = (t) => typeof t == "number" ? 0 : t; -function LQ(t) { +const LQ = (t) => typeof t == "number" ? 0 : t; +function kQ(t) { const e = z7(t); - return W7(t)(e.map(NQ)); + return W7(t)(e.map(LQ)); } const Ia = { - test: TQ, + test: RQ, parse: z7, createTransformer: W7, - getAnimatableNone: LQ -}, kQ = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]); -function $Q(t) { + getAnimatableNone: kQ +}, $Q = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]); +function BQ(t) { const [e, r] = t.slice(0, -1).split("("); if (e === "drop-shadow") return t; @@ -32059,16 +32069,16 @@ function $Q(t) { if (!n) return t; const i = r.replace(n, ""); - let s = kQ.has(e) ? 1 : 0; + let s = $Q.has(e) ? 1 : 0; return n !== r && (s *= 100), e + "(" + s + i + ")"; } -const BQ = /\b([a-z-]*)\(.*?\)/gu, vv = { +const FQ = /\b([a-z-]*)\(.*?\)/gu, vv = { ...Ia, getAnimatableNone: (t) => { - const e = t.match(BQ); - return e ? e.map($Q).join(" ") : t; + const e = t.match(FQ); + return e ? e.map(BQ).join(" ") : t; } -}, FQ = { +}, jQ = { // Border props borderWidth: Vt, borderTopWidth: Vt, @@ -32104,7 +32114,7 @@ const BQ = /\b([a-z-]*)\(.*?\)/gu, vv = { // Misc backgroundPositionX: Vt, backgroundPositionY: Vt -}, jQ = { +}, UQ = { rotate: ca, rotateX: ca, rotateY: ca, @@ -32130,18 +32140,18 @@ const BQ = /\b([a-z-]*)\(.*?\)/gu, vv = { originY: f6, originZ: Vt }, m6 = { - ...ef, + ...tf, transform: Math.round }, Zb = { - ...FQ, ...jQ, + ...UQ, zIndex: m6, size: Vt, // SVG fillOpacity: jl, strokeOpacity: jl, numOctaves: m6 -}, UQ = { +}, qQ = { ...Zb, // Color props color: Yn, @@ -32157,17 +32167,17 @@ const BQ = /\b([a-z-]*)\(.*?\)/gu, vv = { borderLeftColor: Yn, filter: vv, WebkitFilter: vv -}, Qb = (t) => UQ[t]; +}, Qb = (t) => qQ[t]; function H7(t, e) { let r = Qb(t); return r !== vv && (r = Ia), r.getAnimatableNone ? r.getAnimatableNone(e) : void 0; } -const qQ = /* @__PURE__ */ new Set(["auto", "none", "0"]); -function zQ(t, e, r) { +const zQ = /* @__PURE__ */ new Set(["auto", "none", "0"]); +function WQ(t, e, r) { let n = 0, i; for (; n < t.length && !i; ) { const s = t[n]; - typeof s == "string" && !qQ.has(s) && Ul(s).values.length && (i = t[n]), n++; + typeof s == "string" && !zQ.has(s) && Ul(s).values.length && (i = t[n]), n++; } if (i && r) for (const s of e) @@ -32189,7 +32199,7 @@ class K7 extends Yb { d !== void 0 && (e[u] = d), u === e.length - 1 && (this.finalKeyframe = l); } } - if (this.resolveNoneKeyframes(), !yQ.has(n) || e.length !== 2) + if (this.resolveNoneKeyframes(), !wQ.has(n) || e.length !== 2) return; const [i, s] = e, o = p6(i), a = p6(s); if (o !== a) @@ -32204,14 +32214,14 @@ class K7 extends Yb { resolveNoneKeyframes() { const { unresolvedKeyframes: e, name: r } = this, n = []; for (let i = 0; i < e.length; i++) - lQ(e[i]) && n.push(i); - n.length && zQ(e, n, r); + hQ(e[i]) && n.push(i); + n.length && WQ(e, n, r); } measureInitialState() { const { element: e, unresolvedKeyframes: r, name: n } = this; if (!e || !e.current) return; - n === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = ku[n](e.measureViewportBox(), window.getComputedStyle(e.current)), r[0] = this.measuredOrigin; + n === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = $u[n](e.measureViewportBox(), window.getComputedStyle(e.current)), r[0] = this.measuredOrigin; const i = r[r.length - 1]; i !== void 0 && e.getValue(n, i).jump(i, !1); } @@ -32223,7 +32233,7 @@ class K7 extends Yb { const s = r.getValue(n); s && s.jump(this.measuredOrigin, !1); const o = i.length - 1, a = i[o]; - i[o] = ku[n](r.measureViewportBox(), window.getComputedStyle(r.current)), a !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = a), !((e = this.removedTransforms) === null || e === void 0) && e.length && this.removedTransforms.forEach(([u, l]) => { + i[o] = $u[n](r.measureViewportBox(), window.getComputedStyle(r.current)), a !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = a), !((e = this.removedTransforms) === null || e === void 0) && e.length && this.removedTransforms.forEach(([u, l]) => { r.getValue(u).set(l); }), this.resolveNoneKeyframes(); } @@ -32232,18 +32242,18 @@ function ey(t) { return typeof t == "function"; } let Xd; -function WQ() { +function HQ() { Xd = void 0; } const Zs = { - now: () => (Xd === void 0 && Zs.set(Fn.isProcessing || iQ.useManualTiming ? Fn.timestamp : performance.now()), Xd), + now: () => (Xd === void 0 && Zs.set(Fn.isProcessing || sQ.useManualTiming ? Fn.timestamp : performance.now()), Xd), set: (t) => { - Xd = t, queueMicrotask(WQ); + Xd = t, queueMicrotask(HQ); } }, v6 = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string (Ia.test(t) || t === "0") && // And it contains numbers and/or colors !t.startsWith("url(")); -function HQ(t) { +function KQ(t) { const e = t[0]; if (t.length === 1) return !0; @@ -32251,16 +32261,16 @@ function HQ(t) { if (t[r] !== e) return !0; } -function KQ(t, e, r, n) { +function VQ(t, e, r, n) { const i = t[0]; if (i === null) return !1; if (e === "display" || e === "visibility") return !0; const s = t[t.length - 1], o = v6(i, e), a = v6(s, e); - return Qu(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : HQ(t) || (r === "spring" || ey(r)) && n; + return ef(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : KQ(t) || (r === "spring" || ey(r)) && n; } -const VQ = 40; +const GQ = 40; class V7 { constructor({ autoplay: e = !0, delay: r = 0, type: n = "keyframes", repeat: i = 0, repeatDelay: s = 0, repeatType: o = "loop", ...a }) { this.isStopped = !1, this.hasAttemptedResolve = !1, this.createdAt = Zs.now(), this.options = { @@ -32284,7 +32294,7 @@ class V7 { * to avoid a sudden jump into the animation. */ calcStartTime() { - return this.resolvedAt ? this.resolvedAt - this.createdAt > VQ ? this.resolvedAt : this.createdAt : this.createdAt; + return this.resolvedAt ? this.resolvedAt - this.createdAt > GQ ? this.resolvedAt : this.createdAt : this.createdAt; } /** * A getter for resolved data. If keyframes are not yet resolved, accessing @@ -32292,7 +32302,7 @@ class V7 { * This is a deoptimisation, but at its worst still batches read/writes. */ get resolved() { - return !this._resolved && !this.hasAttemptedResolve && SQ(), this._resolved; + return !this._resolved && !this.hasAttemptedResolve && AQ(), this._resolved; } /** * A method to be called when the keyframes resolver completes. This method @@ -32302,7 +32312,7 @@ class V7 { onKeyframesResolved(e, r) { this.resolvedAt = Zs.now(), this.hasAttemptedResolve = !0; const { name: n, type: i, velocity: s, delay: o, onComplete: a, onUpdate: u, isGenerator: l } = this.options; - if (!l && !KQ(e, n, i, s)) + if (!l && !VQ(e, n, i, s)) if (o) this.options.duration = 0; else { @@ -32338,17 +32348,17 @@ class V7 { function G7(t, e) { return e ? t * (1e3 / e) : 0; } -const GQ = 5; +const YQ = 5; function Y7(t, e, r) { - const n = Math.max(e - GQ, 0); + const n = Math.max(e - YQ, 0); return G7(r - t(n), e - n); } -const Gm = 1e-3, YQ = 0.01, b6 = 10, JQ = 0.05, XQ = 1; -function ZQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }) { +const Gm = 1e-3, JQ = 0.01, b6 = 10, XQ = 0.05, ZQ = 1; +function QQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }) { let i, s; - Qu(t <= Js(b6), "Spring duration must be 10 seconds or less"); + ef(t <= Js(b6), "Spring duration must be 10 seconds or less"); let o = 1 - e; - o = Ma(JQ, XQ, o), t = Ma(YQ, b6, No(t)), o < 1 ? (i = (l) => { + o = Ma(XQ, ZQ, o), t = Ma(JQ, b6, No(t)), o < 1 ? (i = (l) => { const d = l * o, p = d * t, w = d - r, _ = bv(l, o), P = Math.exp(-p); return Gm - w / _ * P; }, s = (l) => { @@ -32361,7 +32371,7 @@ function ZQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 const d = Math.exp(-l * t), p = (r - l) * (t * t); return d * p; }); - const a = 5 / t, u = eee(i, s, a); + const a = 5 / t, u = tee(i, s, a); if (t = Js(t), isNaN(u)) return { stiffness: 100, @@ -32377,21 +32387,21 @@ function ZQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }; } } -const QQ = 12; -function eee(t, e, r) { +const eee = 12; +function tee(t, e, r) { let n = r; - for (let i = 1; i < QQ; i++) + for (let i = 1; i < eee; i++) n = n - t(n) / e(n); return n; } function bv(t, e) { return t * Math.sqrt(1 - e * e); } -const tee = ["duration", "bounce"], ree = ["stiffness", "damping", "mass"]; +const ree = ["duration", "bounce"], nee = ["stiffness", "damping", "mass"]; function y6(t, e) { return e.some((r) => t[r] !== void 0); } -function nee(t) { +function iee(t) { let e = { velocity: 0, stiffness: 100, @@ -32400,8 +32410,8 @@ function nee(t) { isResolvedFromDuration: !1, ...t }; - if (!y6(t, ree) && y6(t, tee)) { - const r = ZQ(t); + if (!y6(t, nee) && y6(t, ree)) { + const r = QQ(t); e = { ...e, ...r, @@ -32411,36 +32421,36 @@ function nee(t) { return e; } function J7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { - const i = t[0], s = t[t.length - 1], o = { done: !1, value: i }, { stiffness: a, damping: u, mass: l, duration: d, velocity: p, isResolvedFromDuration: w } = nee({ + const i = t[0], s = t[t.length - 1], o = { done: !1, value: i }, { stiffness: a, damping: u, mass: l, duration: d, velocity: p, isResolvedFromDuration: w } = iee({ ...n, velocity: -No(n.velocity || 0) }), _ = p || 0, P = u / (2 * Math.sqrt(a * l)), O = s - i, L = No(Math.sqrt(a / l)), B = Math.abs(O) < 5; r || (r = B ? 0.01 : 2), e || (e = B ? 5e-3 : 0.5); let k; if (P < 1) { - const q = bv(L, P); + const W = bv(L, P); k = (U) => { const V = Math.exp(-P * L * U); - return s - V * ((_ + P * L * O) / q * Math.sin(q * U) + O * Math.cos(q * U)); + return s - V * ((_ + P * L * O) / W * Math.sin(W * U) + O * Math.cos(W * U)); }; } else if (P === 1) - k = (q) => s - Math.exp(-L * q) * (O + (_ + L * O) * q); + k = (W) => s - Math.exp(-L * W) * (O + (_ + L * O) * W); else { - const q = L * Math.sqrt(P * P - 1); + const W = L * Math.sqrt(P * P - 1); k = (U) => { - const V = Math.exp(-P * L * U), Q = Math.min(q * U, 300); - return s - V * ((_ + P * L * O) * Math.sinh(Q) + q * O * Math.cosh(Q)) / q; + const V = Math.exp(-P * L * U), Q = Math.min(W * U, 300); + return s - V * ((_ + P * L * O) * Math.sinh(Q) + W * O * Math.cosh(Q)) / W; }; } return { calculatedDuration: w && d || null, - next: (q) => { - const U = k(q); + next: (W) => { + const U = k(W); if (w) - o.done = q >= d; + o.done = W >= d; else { let V = 0; - P < 1 && (V = q === 0 ? Js(_) : Y7(k, q, U)); + P < 1 && (V = W === 0 ? Js(_) : Y7(k, W, U)); const Q = Math.abs(V) <= r, R = Math.abs(s - U) <= e; o.done = Q && R; } @@ -32456,15 +32466,15 @@ function w6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 3 let O = r * e; const L = p + O, B = o === void 0 ? L : o(L); B !== L && (O = B - p); - const k = (K) => -O * Math.exp(-K / n), q = (K) => B + k(K), U = (K) => { - const ge = k(K), Ee = q(K); + const k = (K) => -O * Math.exp(-K / n), W = (K) => B + k(K), U = (K) => { + const ge = k(K), Ee = W(K); w.done = Math.abs(ge) <= l, w.value = w.done ? B : Ee; }; let V, Q; const R = (K) => { _(w.value) && (V = K, Q = J7({ keyframes: [w.value, P(w.value)], - velocity: Y7(q, K, w.value), + velocity: Y7(W, K, w.value), // TODO: This should be passing * 1000 damping: i, stiffness: s, @@ -32480,11 +32490,11 @@ function w6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 3 } }; } -const iee = /* @__PURE__ */ vh(0.42, 0, 1, 1), see = /* @__PURE__ */ vh(0, 0, 0.58, 1), X7 = /* @__PURE__ */ vh(0.42, 0, 0.58, 1), oee = (t) => Array.isArray(t) && typeof t[0] != "number", ty = (t) => Array.isArray(t) && typeof t[0] == "number", x6 = { +const see = /* @__PURE__ */ vh(0.42, 0, 1, 1), oee = /* @__PURE__ */ vh(0, 0, 0.58, 1), X7 = /* @__PURE__ */ vh(0.42, 0, 0.58, 1), aee = (t) => Array.isArray(t) && typeof t[0] != "number", ty = (t) => Array.isArray(t) && typeof t[0] == "number", x6 = { linear: Un, - easeIn: iee, + easeIn: see, easeInOut: X7, - easeOut: see, + easeOut: oee, circIn: Vb, circInOut: T7, circOut: C7, @@ -32500,14 +32510,14 @@ const iee = /* @__PURE__ */ vh(0.42, 0, 1, 1), see = /* @__PURE__ */ vh(0, 0, 0. } else if (typeof t == "string") return Wo(x6[t] !== void 0, `Invalid easing type '${t}'`), x6[t]; return t; -}, aee = (t, e) => (r) => e(t(r)), Lo = (...t) => t.reduce(aee), $u = (t, e, r) => { +}, cee = (t, e) => (r) => e(t(r)), Lo = (...t) => t.reduce(cee), Bu = (t, e, r) => { const n = e - t; return n === 0 ? 1 : (r - t) / n; }, Qr = (t, e, r) => t + (e - t) * r; function Ym(t, e, r) { return r < 0 && (r += 1), r > 1 && (r -= 1), r < 1 / 6 ? t + (e - t) * 6 * r : r < 1 / 2 ? e : r < 2 / 3 ? t + (e - t) * (2 / 3 - r) * 6 : t; } -function cee({ hue: t, saturation: e, lightness: r, alpha: n }) { +function uee({ hue: t, saturation: e, lightness: r, alpha: n }) { t /= 360, e /= 100, r /= 100; let i = 0, s = 0, o = 0; if (!e) @@ -32529,13 +32539,13 @@ function C0(t, e) { const Jm = (t, e, r) => { const n = t * t, i = r * (e * e - n) + n; return i < 0 ? 0 : Math.sqrt(i); -}, uee = [mv, hc, fu], fee = (t) => uee.find((e) => e.test(t)); +}, fee = [mv, hc, fu], lee = (t) => fee.find((e) => e.test(t)); function E6(t) { - const e = fee(t); - if (Qu(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e) + const e = lee(t); + if (ef(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e) return !1; let r = e.parse(t); - return e === fu && (r = cee(r)), r; + return e === fu && (r = uee(r)), r; } const S6 = (t, e) => { const r = E6(t), n = E6(e); @@ -32544,14 +32554,14 @@ const S6 = (t, e) => { const i = { ...r }; return (s) => (i.red = Jm(r.red, n.red, s), i.green = Jm(r.green, n.green, s), i.blue = Jm(r.blue, n.blue, s), i.alpha = Qr(r.alpha, n.alpha, s), hc.transform(i)); }, yv = /* @__PURE__ */ new Set(["none", "hidden"]); -function lee(t, e) { +function hee(t, e) { return yv.has(t) ? (r) => r <= 0 ? t : e : (r) => r >= 1 ? e : t; } -function hee(t, e) { +function dee(t, e) { return (r) => Qr(t, e, r); } function ry(t) { - return typeof t == "number" ? hee : typeof t == "string" ? Gb(t) ? C0 : Yn.test(t) ? S6 : gee : Array.isArray(t) ? Z7 : typeof t == "object" ? Yn.test(t) ? S6 : dee : C0; + return typeof t == "number" ? dee : typeof t == "string" ? Gb(t) ? C0 : Yn.test(t) ? S6 : mee : Array.isArray(t) ? Z7 : typeof t == "object" ? Yn.test(t) ? S6 : pee : C0; } function Z7(t, e) { const r = [...t], n = r.length, i = t.map((s, o) => ry(s)(s, e[o])); @@ -32561,7 +32571,7 @@ function Z7(t, e) { return r; }; } -function dee(t, e) { +function pee(t, e) { const r = { ...t, ...e }, n = {}; for (const i in r) t[i] !== void 0 && e[i] !== void 0 && (n[i] = ry(t[i])(t[i], e[i])); @@ -32571,7 +32581,7 @@ function dee(t, e) { return r; }; } -function pee(t, e) { +function gee(t, e) { var r; const n = [], i = { color: 0, var: 0, number: 0 }; for (let s = 0; s < e.values.length; s++) { @@ -32580,14 +32590,14 @@ function pee(t, e) { } return n; } -const gee = (t, e) => { +const mee = (t, e) => { const r = Ia.createTransformer(e), n = Ul(t), i = Ul(e); - return n.indexes.var.length === i.indexes.var.length && n.indexes.color.length === i.indexes.color.length && n.indexes.number.length >= i.indexes.number.length ? yv.has(t) && !i.values.length || yv.has(e) && !n.values.length ? lee(t, e) : Lo(Z7(pee(n, i), i.values), r) : (Qu(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), C0(t, e)); + return n.indexes.var.length === i.indexes.var.length && n.indexes.color.length === i.indexes.color.length && n.indexes.number.length >= i.indexes.number.length ? yv.has(t) && !i.values.length || yv.has(e) && !n.values.length ? hee(t, e) : Lo(Z7(gee(n, i), i.values), r) : (ef(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), C0(t, e)); }; function Q7(t, e, r) { return typeof t == "number" && typeof e == "number" && typeof r == "number" ? Qr(t, e, r) : ry(t)(t, e); } -function mee(t, e, r) { +function vee(t, e, r) { const n = [], i = r || Q7, s = t.length - 1; for (let o = 0; o < s; o++) { let a = i(t[o], t[o + 1]); @@ -32599,51 +32609,51 @@ function mee(t, e, r) { } return n; } -function vee(t, e, { clamp: r = !0, ease: n, mixer: i } = {}) { +function bee(t, e, { clamp: r = !0, ease: n, mixer: i } = {}) { const s = t.length; if (Wo(s === e.length, "Both input and output ranges must be the same length"), s === 1) return () => e[0]; if (s === 2 && t[0] === t[1]) return () => e[1]; t[0] > t[s - 1] && (t = [...t].reverse(), e = [...e].reverse()); - const o = mee(e, n, i), a = o.length, u = (l) => { + const o = vee(e, n, i), a = o.length, u = (l) => { let d = 0; if (a > 1) for (; d < t.length - 2 && !(l < t[d + 1]); d++) ; - const p = $u(t[d], t[d + 1], l); + const p = Bu(t[d], t[d + 1], l); return o[d](p); }; return r ? (l) => u(Ma(t[0], t[s - 1], l)) : u; } -function bee(t, e) { +function yee(t, e) { const r = t[t.length - 1]; for (let n = 1; n <= e; n++) { - const i = $u(0, e, n); + const i = Bu(0, e, n); t.push(Qr(r, 1, i)); } } -function yee(t) { +function wee(t) { const e = [0]; - return bee(e, t.length - 1), e; + return yee(e, t.length - 1), e; } -function wee(t, e) { +function xee(t, e) { return t.map((r) => r * e); } -function xee(t, e) { +function _ee(t, e) { return t.map(() => e || X7).splice(0, t.length - 1); } function T0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" }) { - const i = oee(n) ? n.map(_6) : _6(n), s = { + const i = aee(n) ? n.map(_6) : _6(n), s = { done: !1, value: e[0] - }, o = wee( + }, o = xee( // Only use the provided offsets if they're the correct length // TODO Maybe we should warn here if there's a length mismatch - r && r.length === e.length ? r : yee(e), + r && r.length === e.length ? r : wee(e), t - ), a = vee(o, e, { - ease: Array.isArray(i) ? i : xee(e, i) + ), a = bee(o, e, { + ease: Array.isArray(i) ? i : _ee(e, i) }); return { calculatedDuration: t, @@ -32651,7 +32661,7 @@ function T0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" } }; } const A6 = 2e4; -function _ee(t) { +function Eee(t) { let e = 0; const r = 50; let n = t.next(e); @@ -32659,7 +32669,7 @@ function _ee(t) { e += r, n = t.next(e); return e >= A6 ? 1 / 0 : e; } -const Eee = (t) => { +const See = (t) => { const e = ({ timestamp: r }) => t(r); return { start: () => Lr.update(e, !0), @@ -32670,13 +32680,13 @@ const Eee = (t) => { */ now: () => Fn.isProcessing ? Fn.timestamp : Zs.now() }; -}, See = { +}, Aee = { decay: w6, inertia: w6, tween: T0, keyframes: T0, spring: J7 -}, Aee = (t) => t / 100; +}, Pee = (t) => t / 100; class ny extends V7 { constructor(e) { super(e), this.holdTime = null, this.cancelTime = null, this.currentTime = 0, this.playbackSpeed = 1, this.pendingPlayState = "running", this.startTime = null, this.state = "idle", this.stop = () => { @@ -32693,15 +32703,15 @@ class ny extends V7 { super.flatten(), this._resolved && Object.assign(this._resolved, this.initPlayback(this._resolved.keyframes)); } initPlayback(e) { - const { type: r = "keyframes", repeat: n = 0, repeatDelay: i = 0, repeatType: s, velocity: o = 0 } = this.options, a = ey(r) ? r : See[r] || T0; + const { type: r = "keyframes", repeat: n = 0, repeatDelay: i = 0, repeatType: s, velocity: o = 0 } = this.options, a = ey(r) ? r : Aee[r] || T0; let u, l; - a !== T0 && typeof e[0] != "number" && (process.env.NODE_ENV !== "production" && Wo(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), u = Lo(Aee, Q7(e[0], e[1])), e = [0, 100]); + a !== T0 && typeof e[0] != "number" && (process.env.NODE_ENV !== "production" && Wo(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), u = Lo(Pee, Q7(e[0], e[1])), e = [0, 100]); const d = a({ ...this.options, keyframes: e }); s === "mirror" && (l = a({ ...this.options, keyframes: [...e].reverse(), velocity: -o - })), d.calculatedDuration === null && (d.calculatedDuration = _ee(d)); + })), d.calculatedDuration === null && (d.calculatedDuration = Eee(d)); const { calculatedDuration: p } = d, w = p + i, _ = w * (n + 1) - i; return { generator: d, @@ -32729,13 +32739,13 @@ class ny extends V7 { this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - d / this.speed, this.startTime)), r ? this.currentTime = e : this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = Math.round(e - this.startTime) * this.speed; const B = this.currentTime - w * (this.speed >= 0 ? 1 : -1), k = this.speed >= 0 ? B < 0 : B > d; this.currentTime = Math.max(B, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = d); - let q = this.currentTime, U = s; + let W = this.currentTime, U = s; if (_) { const K = Math.min(this.currentTime, d) / p; let ge = Math.floor(K), Ee = K % 1; - !Ee && K >= 1 && (Ee = 1), Ee === 1 && ge--, ge = Math.min(ge, _ + 1), !!(ge % 2) && (P === "reverse" ? (Ee = 1 - Ee, O && (Ee -= O / p)) : P === "mirror" && (U = o)), q = Ma(0, 1, Ee) * p; + !Ee && K >= 1 && (Ee = 1), Ee === 1 && ge--, ge = Math.min(ge, _ + 1), !!(ge % 2) && (P === "reverse" ? (Ee = 1 - Ee, O && (Ee -= O / p)) : P === "mirror" && (U = o)), W = Ma(0, 1, Ee) * p; } - const V = k ? { done: !1, value: u[0] } : U.next(q); + const V = k ? { done: !1, value: u[0] } : U.next(W); a && (V.value = a(V.value)); let { done: Q } = V; !k && l !== null && (Q = this.speed >= 0 ? this.currentTime >= d : this.currentTime <= 0); @@ -32766,7 +32776,7 @@ class ny extends V7 { } if (this.isStopped) return; - const { driver: e = Eee, onPlay: r, startTime: n } = this.options; + const { driver: e = See, onPlay: r, startTime: n } = this.options; this.driver || (this.driver = e((s) => this.tick(s))), r && r(); const i = this.driver.now(); this.holdTime !== null ? this.startTime = i - this.holdTime : this.startTime ? this.state === "finished" && (this.startTime = i) : this.startTime = n ?? this.calcStartTime(), this.state === "finished" && this.updateFinishedPromise(), this.cancelTime = this.startTime, this.holdTime = null, this.state = "running", this.driver.start(); @@ -32800,7 +32810,7 @@ class ny extends V7 { return this.startTime = 0, this.tick(e, !0); } } -const Pee = /* @__PURE__ */ new Set([ +const Mee = /* @__PURE__ */ new Set([ "opacity", "clipPath", "filter", @@ -32808,28 +32818,28 @@ const Pee = /* @__PURE__ */ new Set([ // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved // or until we implement support for linear() easing. // "background-color" -]), Mee = 10, Iee = (t, e) => { +]), Iee = 10, Cee = (t, e) => { let r = ""; - const n = Math.max(Math.round(e / Mee), 2); + const n = Math.max(Math.round(e / Iee), 2); for (let i = 0; i < n; i++) - r += t($u(0, n - 1, i)) + ", "; + r += t(Bu(0, n - 1, i)) + ", "; return `linear(${r.substring(0, r.length - 2)})`; }; function iy(t) { let e; return () => (e === void 0 && (e = t()), e); } -const Cee = { +const Tee = { linearEasing: void 0 }; -function Tee(t, e) { +function Ree(t, e) { const r = iy(t); return () => { var n; - return (n = Cee[e]) !== null && n !== void 0 ? n : r(); + return (n = Tee[e]) !== null && n !== void 0 ? n : r(); }; } -const R0 = /* @__PURE__ */ Tee(() => { +const R0 = /* @__PURE__ */ Ree(() => { try { document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" }); } catch { @@ -32840,22 +32850,22 @@ const R0 = /* @__PURE__ */ Tee(() => { function e9(t) { return !!(typeof t == "function" && R0() || !t || typeof t == "string" && (t in wv || R0()) || ty(t) || Array.isArray(t) && t.every(e9)); } -const Vf = ([t, e, r, n]) => `cubic-bezier(${t}, ${e}, ${r}, ${n})`, wv = { +const Gf = ([t, e, r, n]) => `cubic-bezier(${t}, ${e}, ${r}, ${n})`, wv = { linear: "linear", ease: "ease", easeIn: "ease-in", easeOut: "ease-out", easeInOut: "ease-in-out", - circIn: /* @__PURE__ */ Vf([0, 0.65, 0.55, 1]), - circOut: /* @__PURE__ */ Vf([0.55, 0, 1, 0.45]), - backIn: /* @__PURE__ */ Vf([0.31, 0.01, 0.66, -0.59]), - backOut: /* @__PURE__ */ Vf([0.33, 1.53, 0.69, 0.99]) + circIn: /* @__PURE__ */ Gf([0, 0.65, 0.55, 1]), + circOut: /* @__PURE__ */ Gf([0.55, 0, 1, 0.45]), + backIn: /* @__PURE__ */ Gf([0.31, 0.01, 0.66, -0.59]), + backOut: /* @__PURE__ */ Gf([0.33, 1.53, 0.69, 0.99]) }; function t9(t, e) { if (t) - return typeof t == "function" && R0() ? Iee(t, e) : ty(t) ? Vf(t) : Array.isArray(t) ? t.map((r) => t9(r, e) || wv.easeOut) : wv[t]; + return typeof t == "function" && R0() ? Cee(t, e) : ty(t) ? Gf(t) : Array.isArray(t) ? t.map((r) => t9(r, e) || wv.easeOut) : wv[t]; } -function Ree(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatType: o = "loop", ease: a = "easeInOut", times: u } = {}) { +function Dee(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatType: o = "loop", ease: a = "easeInOut", times: u } = {}) { const l = { [e]: r }; u && (l.offset = u); const d = t9(a, i); @@ -32871,11 +32881,11 @@ function Ree(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatTy function P6(t, e) { t.timeline = e, t.onfinish = null; } -const Dee = /* @__PURE__ */ iy(() => Object.hasOwnProperty.call(Element.prototype, "animate")), D0 = 10, Oee = 2e4; -function Nee(t) { +const Oee = /* @__PURE__ */ iy(() => Object.hasOwnProperty.call(Element.prototype, "animate")), D0 = 10, Nee = 2e4; +function Lee(t) { return ey(t.type) || t.type === "spring" || !e9(t.ease); } -function Lee(t, e) { +function kee(t, e) { const r = new ny({ ...e, keyframes: t, @@ -32886,7 +32896,7 @@ function Lee(t, e) { let n = { done: !1, value: t[0] }; const i = []; let s = 0; - for (; !n.done && s < Oee; ) + for (; !n.done && s < Nee; ) n = r.sample(s), i.push(n.value), s += D0; return { times: void 0, @@ -32900,7 +32910,7 @@ const r9 = { backInOut: M7, circInOut: T7 }; -function kee(t) { +function $ee(t) { return t in r9; } class M6 extends V7 { @@ -32914,11 +32924,11 @@ class M6 extends V7 { let { duration: i = 300, times: s, ease: o, type: a, motionValue: u, name: l, startTime: d } = this.options; if (!(!((n = u.owner) === null || n === void 0) && n.current)) return !1; - if (typeof o == "string" && R0() && kee(o) && (o = r9[o]), Nee(this.options)) { - const { onComplete: w, onUpdate: _, motionValue: P, element: O, ...L } = this.options, B = Lee(e, L); + if (typeof o == "string" && R0() && $ee(o) && (o = r9[o]), Lee(this.options)) { + const { onComplete: w, onUpdate: _, motionValue: P, element: O, ...L } = this.options, B = kee(e, L); e = B.keyframes, e.length === 1 && (e[1] = e[0]), i = B.duration, s = B.times, o = B.ease, a = "keyframes"; } - const p = Ree(u.owner.current, l, e, { ...this.options, duration: i, times: s, ease: o }); + const p = Dee(u.owner.current, l, e, { ...this.options, duration: i, times: s, ease: o }); return p.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (P6(p, this.pendingTimeline), this.pendingTimeline = void 0) : p.onfinish = () => { const { onComplete: w } = this.options; u.set(Np(e, this.options, r)), w && w(), this.cancel(), this.resolveFinishedPromise(); @@ -33047,15 +33057,15 @@ class M6 extends V7 { } static supports(e) { const { motionValue: r, name: n, repeatDelay: i, repeatType: s, damping: o, type: a } = e; - return Dee() && n && Pee.has(n) && r && r.owner && r.owner.current instanceof HTMLElement && /** + return Oee() && n && Mee.has(n) && r && r.owner && r.owner.current instanceof HTMLElement && /** * If we're outputting values to onUpdate then we can't use WAAPI as there's * no way to read the value from WAAPI every frame. */ !r.owner.getProps().onUpdate && !i && s !== "mirror" && o !== 0 && a !== "inertia"; } } -const $ee = iy(() => window.ScrollTimeline !== void 0); -class Bee { +const Bee = iy(() => window.ScrollTimeline !== void 0); +class Fee { constructor(e) { this.stop = () => this.runAll("stop"), this.animations = e.filter(Boolean); } @@ -33073,7 +33083,7 @@ class Bee { this.animations[n][e] = r; } attachTimeline(e, r) { - const n = this.animations.map((i) => $ee() && i.attachTimeline ? i.attachTimeline(e) : r(i)); + const n = this.animations.map((i) => Bee() && i.attachTimeline ? i.attachTimeline(e) : r(i)); return () => { n.forEach((i, s) => { i && i(), this.animations[s].stop(); @@ -33120,7 +33130,7 @@ class Bee { this.runAll("complete"); } } -function Fee({ when: t, delay: e, delayChildren: r, staggerChildren: n, staggerDirection: i, repeat: s, repeatType: o, repeatDelay: a, from: u, elapsed: l, ...d }) { +function jee({ when: t, delay: e, delayChildren: r, staggerChildren: n, staggerDirection: i, repeat: s, repeatType: o, repeatDelay: a, from: u, elapsed: l, ...d }) { return !!Object.keys(d).length; } const sy = (t, e, r, n = {}, i, s) => (o) => { @@ -33143,9 +33153,9 @@ const sy = (t, e, r, n = {}, i, s) => (o) => { motionValue: e, element: s ? void 0 : i }; - Fee(a) || (d = { + jee(a) || (d = { ...d, - ...nQ(t, d) + ...iQ(t, d) }), d.duration && (d.duration = Js(d.duration)), d.repeatDelay && (d.repeatDelay = Js(d.repeatDelay)), d.from !== void 0 && (d.keyframes[0] = d.from); let p = !1; if ((d.type === !1 || d.duration === 0 && !d.repeatDelay) && (d.duration = 0, d.delay === 0 && (p = !0)), p && !s && e.get() !== void 0) { @@ -33153,10 +33163,10 @@ const sy = (t, e, r, n = {}, i, s) => (o) => { if (w !== void 0) return Lr.update(() => { d.onUpdate(w), d.onComplete(); - }), new Bee([]); + }), new Fee([]); } return !s && M6.supports(d) ? new M6(d) : new ny(d); -}, jee = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), Uee = (t) => dv(t) ? t[t.length - 1] || 0 : t; +}, Uee = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), qee = (t) => dv(t) ? t[t.length - 1] || 0 : t; function oy(t, e) { t.indexOf(e) === -1 && t.push(e); } @@ -33189,8 +33199,8 @@ class cy { this.subscriptions.length = 0; } } -const I6 = 30, qee = (t) => !isNaN(parseFloat(t)); -class zee { +const I6 = 30, zee = (t) => !isNaN(parseFloat(t)); +class Wee { /** * @param init - The initiating value * @param config - Optional configuration options @@ -33206,7 +33216,7 @@ class zee { }, this.hasAnimated = !1, this.setCurrent(e), this.owner = r.owner; } setCurrent(e) { - this.current = e, this.updatedAt = Zs.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = qee(this.current)); + this.current = e, this.updatedAt = Zs.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = zee(this.current)); } setPrevFrameValue(e = this.current) { this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt; @@ -33385,34 +33395,34 @@ class zee { } } function ql(t, e) { - return new zee(t, e); + return new Wee(t, e); } -function Wee(t, e, r) { +function Hee(t, e, r) { t.hasValue(e) ? t.getValue(e).set(r) : t.addValue(e, ql(r)); } -function Hee(t, e) { +function Kee(t, e) { const r = Op(t, e); let { transitionEnd: n = {}, transition: i = {}, ...s } = r || {}; s = { ...s, ...n }; for (const o in s) { - const a = Uee(s[o]); - Wee(t, o, a); + const a = qee(s[o]); + Hee(t, o, a); } } -const uy = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), Kee = "framerAppearId", n9 = "data-" + uy(Kee); +const uy = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), Vee = "framerAppearId", n9 = "data-" + uy(Vee); function i9(t) { return t.props[n9]; } const Zn = (t) => !!(t && t.getVelocity); -function Vee(t) { +function Gee(t) { return !!(Zn(t) && t.add); } function xv(t, e) { const r = t.getValue("willChange"); - if (Vee(r)) + if (Gee(r)) return r.add(e); } -function Gee({ protectedKeys: t, needsAnimating: e }, r) { +function Yee({ protectedKeys: t, needsAnimating: e }, r) { const n = t.hasOwnProperty(r) && e[r] !== !0; return e[r] = !1, n; } @@ -33423,7 +33433,7 @@ function s9(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { const l = [], d = i && t.animationState && t.animationState.getState()[i]; for (const p in u) { const w = t.getValue(p, (s = t.latestValues[p]) !== null && s !== void 0 ? s : null), _ = u[p]; - if (_ === void 0 || d && Gee(d, p)) + if (_ === void 0 || d && Yee(d, p)) continue; const P = { delay: r, @@ -33443,7 +33453,7 @@ function s9(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { } return a && Promise.all(l).then(() => { Lr.update(() => { - a && Hee(t, a); + a && Kee(t, a); }); }), l; } @@ -33454,7 +33464,7 @@ function _v(t, e, r = {}) { r.transitionOverride && (s = r.transitionOverride); const o = i ? () => Promise.all(s9(t, i, r)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (l = 0) => { const { delayChildren: d = 0, staggerChildren: p, staggerDirection: w } = s; - return Yee(t, e, d + l, p, w, r); + return Jee(t, e, d + l, p, w, r); } : () => Promise.resolve(), { when: u } = s; if (u) { const [l, d] = u === "beforeChildren" ? [o, a] : [a, o]; @@ -33462,19 +33472,19 @@ function _v(t, e, r = {}) { } else return Promise.all([o(), a(r.delay)]); } -function Yee(t, e, r = 0, n = 0, i = 1, s) { +function Jee(t, e, r = 0, n = 0, i = 1, s) { const o = [], a = (t.variantChildren.size - 1) * n, u = i === 1 ? (l = 0) => l * n : (l = 0) => a - l * n; - return Array.from(t.variantChildren).sort(Jee).forEach((l, d) => { + return Array.from(t.variantChildren).sort(Xee).forEach((l, d) => { l.notify("AnimationStart", e), o.push(_v(l, e, { ...s, delay: r + u(d) }).then(() => l.notify("AnimationComplete", e))); }), Promise.all(o); } -function Jee(t, e) { +function Xee(t, e) { return t.sortNodePosition(e); } -function Xee(t, e, r = {}) { +function Zee(t, e, r = {}) { t.notify("AnimationStart", e); let n; if (Array.isArray(e)) { @@ -33490,7 +33500,7 @@ function Xee(t, e, r = {}) { t.notify("AnimationComplete", e); }); } -const Zee = Wb.length; +const Qee = Wb.length; function o9(t) { if (!t) return; @@ -33499,18 +33509,18 @@ function o9(t) { return t.props.initial !== void 0 && (r.initial = t.props.initial), r; } const e = {}; - for (let r = 0; r < Zee; r++) { + for (let r = 0; r < Qee; r++) { const n = Wb[r], i = t.props[n]; (Fl(i) || i === !1) && (e[n] = i); } return e; } -const Qee = [...zb].reverse(), ete = zb.length; -function tte(t) { - return (e) => Promise.all(e.map(({ animation: r, options: n }) => Xee(t, r, n))); -} +const ete = [...zb].reverse(), tte = zb.length; function rte(t) { - let e = tte(t), r = C6(), n = !0; + return (e) => Promise.all(e.map(({ animation: r, options: n }) => Zee(t, r, n))); +} +function nte(t) { + let e = rte(t), r = C6(), n = !0; const i = (u) => (l, d) => { var p; const w = Op(t, d, u === "exit" ? (p = t.presenceContext) === null || p === void 0 ? void 0 : p.custom : void 0); @@ -33526,20 +33536,20 @@ function rte(t) { function o(u) { const { props: l } = t, d = o9(t.parent) || {}, p = [], w = /* @__PURE__ */ new Set(); let _ = {}, P = 1 / 0; - for (let L = 0; L < ete; L++) { - const B = Qee[L], k = r[B], q = l[B] !== void 0 ? l[B] : d[B], U = Fl(q), V = B === u ? k.isActive : null; + for (let L = 0; L < tte; L++) { + const B = ete[L], k = r[B], W = l[B] !== void 0 ? l[B] : d[B], U = Fl(W), V = B === u ? k.isActive : null; V === !1 && (P = L); - let Q = q === d[B] && q !== l[B] && U; + let Q = W === d[B] && W !== l[B] && U; if (Q && n && t.manuallyAnimateOnMount && (Q = !1), k.protectedKeys = { ..._ }, // If it isn't active and hasn't *just* been set as inactive !k.isActive && V === null || // If we didn't and don't have any defined prop for this animation type - !q && !k.prevProp || // Or if the prop doesn't define an animation - Dp(q) || typeof q == "boolean") + !W && !k.prevProp || // Or if the prop doesn't define an animation + Dp(W) || typeof W == "boolean") continue; - const R = nte(k.prevProp, q); + const R = ite(k.prevProp, W); let K = R || // If we're making this variant active, we want to always make it active B === u && k.isActive && !Q && U || // If we removed a higher-priority variant (i is in reverse order) L > P && U, ge = !1; - const Ee = Array.isArray(q) ? q : [q]; + const Ee = Array.isArray(W) ? W : [W]; let Y = Ee.reduce(i(B), {}); V === !1 && (Y = {}); const { prevResolvedValues: A = {} } = k, m = { @@ -33557,7 +33567,7 @@ function rte(t) { let v = !1; dv(E) && dv(S) ? v = !x7(E, S) : v = E !== S, v ? E != null ? f(x) : w.add(x) : E !== void 0 && w.has(x) ? f(x) : k.protectedKeys[x] = !0; } - k.prevProp = q, k.prevResolvedValues = Y, k.isActive && (_ = { ..._, ...Y }), n && t.blockInitialAnimation && (K = !1), K && (!(Q && R) || ge) && p.push(...Ee.map((x) => ({ + k.prevProp = W, k.prevResolvedValues = Y, k.isActive && (_ = { ..._, ...Y }), n && t.blockInitialAnimation && (K = !1), K && (!(Q && R) || ge) && p.push(...Ee.map((x) => ({ animation: x, options: { type: B } }))); @@ -33565,8 +33575,8 @@ function rte(t) { if (w.size) { const L = {}; w.forEach((B) => { - const k = t.getBaseTarget(B), q = t.getValue(B); - q && (q.liveStyle = !0), L[B] = k ?? null; + const k = t.getBaseTarget(B), W = t.getValue(B); + W && (W.liveStyle = !0), L[B] = k ?? null; }), p.push({ animation: L }); } let O = !!p.length; @@ -33595,7 +33605,7 @@ function rte(t) { } }; } -function nte(t, e) { +function ite(t, e) { return typeof e == "string" ? e !== t : Array.isArray(e) ? !x7(e, t) : !1; } function Qa(t = !1) { @@ -33624,14 +33634,14 @@ class $a { update() { } } -class ite extends $a { +class ste extends $a { /** * We dynamically generate the AnimationState manager as it contains a reference * to the underlying animation library. We only want to load that if we load this, * so people can optionally code split it out using the `m` component. */ constructor(e) { - super(e), e.animationState || (e.animationState = rte(e)); + super(e), e.animationState || (e.animationState = nte(e)); } updateAnimationControlsSubscription() { const { animate: e } = this.node.getProps(); @@ -33652,10 +33662,10 @@ class ite extends $a { this.node.animationState.reset(), (e = this.unmountControls) === null || e === void 0 || e.call(this); } } -let ste = 0; -class ote extends $a { +let ote = 0; +class ate extends $a { constructor() { - super(...arguments), this.id = ste++; + super(...arguments), this.id = ote++; } update() { if (!this.node.presenceContext) @@ -33673,12 +33683,12 @@ class ote extends $a { unmount() { } } -const ate = { +const cte = { animation: { - Feature: ite + Feature: ste }, exit: { - Feature: ote + Feature: ate } }, a9 = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1; function Lp(t, e = "page") { @@ -33689,15 +33699,15 @@ function Lp(t, e = "page") { } }; } -const cte = (t) => (e) => a9(e) && t(e, Lp(e)); +const ute = (t) => (e) => a9(e) && t(e, Lp(e)); function Ro(t, e, r, n = { passive: !0 }) { return t.addEventListener(e, r, n), () => t.removeEventListener(e, r); } function ko(t, e, r, n) { - return Ro(t, e, cte(r), n); + return Ro(t, e, ute(r), n); } const T6 = (t, e) => Math.abs(t - e); -function ute(t, e) { +function fte(t, e) { const r = T6(t.x, e.x), n = T6(t.y, e.y); return Math.sqrt(r ** 2 + n ** 2); } @@ -33706,7 +33716,7 @@ class c9 { if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.updatePoint = () => { if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return; - const p = Zm(this.lastMoveEventInfo, this.history), w = this.startEvent !== null, _ = ute(p.offset, { x: 0, y: 0 }) >= 3; + const p = Zm(this.lastMoveEventInfo, this.history), w = this.startEvent !== null, _ = fte(p.offset, { x: 0, y: 0 }) >= 3; if (!w && !_) return; const { point: P } = p, { timestamp: O } = Fn; @@ -33747,17 +33757,17 @@ function Zm({ point: t }, e) { return { point: t, delta: R6(t, u9(e)), - offset: R6(t, fte(e)), - velocity: lte(e, 0.1) + offset: R6(t, lte(e)), + velocity: hte(e, 0.1) }; } -function fte(t) { +function lte(t) { return t[0]; } function u9(t) { return t[t.length - 1]; } -function lte(t, e) { +function hte(t, e) { if (t.length < 2) return { x: 0, y: 0 }; let r = t.length - 1, n = null; @@ -33806,32 +33816,32 @@ function h9() { function lu(t) { return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current"); } -const d9 = 1e-4, hte = 1 - d9, dte = 1 + d9, p9 = 0.01, pte = 0 - p9, gte = 0 + p9; +const d9 = 1e-4, dte = 1 - d9, pte = 1 + d9, p9 = 0.01, gte = 0 - p9, mte = 0 + p9; function ki(t) { return t.max - t.min; } -function mte(t, e, r) { +function vte(t, e, r) { return Math.abs(t - e) <= r; } function N6(t, e, r, n = 0.5) { - t.origin = n, t.originPoint = Qr(e.min, e.max, t.origin), t.scale = ki(r) / ki(e), t.translate = Qr(r.min, r.max, t.origin) - t.originPoint, (t.scale >= hte && t.scale <= dte || isNaN(t.scale)) && (t.scale = 1), (t.translate >= pte && t.translate <= gte || isNaN(t.translate)) && (t.translate = 0); + t.origin = n, t.originPoint = Qr(e.min, e.max, t.origin), t.scale = ki(r) / ki(e), t.translate = Qr(r.min, r.max, t.origin) - t.originPoint, (t.scale >= dte && t.scale <= pte || isNaN(t.scale)) && (t.scale = 1), (t.translate >= gte && t.translate <= mte || isNaN(t.translate)) && (t.translate = 0); } -function nl(t, e, r, n) { +function il(t, e, r, n) { N6(t.x, e.x, r.x, n ? n.originX : void 0), N6(t.y, e.y, r.y, n ? n.originY : void 0); } function L6(t, e, r) { t.min = r.min + e.min, t.max = t.min + ki(e); } -function vte(t, e, r) { +function bte(t, e, r) { L6(t.x, e.x, r.x), L6(t.y, e.y, r.y); } function k6(t, e, r) { t.min = e.min - r.min, t.max = t.min + ki(e); } -function il(t, e, r) { +function sl(t, e, r) { k6(t.x, e.x, r.x), k6(t.y, e.y, r.y); } -function bte(t, { min: e, max: r }, n) { +function yte(t, { min: e, max: r }, n) { return e !== void 0 && t < e ? t = n ? Qr(e, t, n.min) : Math.max(t, e) : r !== void 0 && t > r && (t = n ? Qr(r, t, n.max) : Math.min(t, r)), t; } function $6(t, e, r) { @@ -33840,7 +33850,7 @@ function $6(t, e, r) { max: r !== void 0 ? t.max + r - (t.max - t.min) : void 0 }; } -function yte(t, { top: e, left: r, bottom: n, right: i }) { +function wte(t, { top: e, left: r, bottom: n, right: i }) { return { x: $6(t.x, r, i), y: $6(t.y, e, n) @@ -33850,23 +33860,23 @@ function B6(t, e) { let r = e.min - t.min, n = e.max - t.max; return e.max - e.min < t.max - t.min && ([r, n] = [n, r]), { min: r, max: n }; } -function wte(t, e) { +function xte(t, e) { return { x: B6(t.x, e.x), y: B6(t.y, e.y) }; } -function xte(t, e) { +function _te(t, e) { let r = 0.5; const n = ki(t), i = ki(e); - return i > n ? r = $u(e.min, e.max - n, t.min) : n > i && (r = $u(t.min, t.max - i, e.min)), Ma(0, 1, r); + return i > n ? r = Bu(e.min, e.max - n, t.min) : n > i && (r = Bu(t.min, t.max - i, e.min)), Ma(0, 1, r); } -function _te(t, e) { +function Ete(t, e) { const r = {}; return e.min !== void 0 && (r.min = e.min - t.min), e.max !== void 0 && (r.max = e.max - t.min), r; } const Ev = 0.35; -function Ete(t = Ev) { +function Ste(t = Ev) { return t === !1 ? t = 0 : t === !0 && (t = Ev), { x: F6(t, "left", "right"), y: F6(t, "top", "bottom") @@ -33902,10 +33912,10 @@ function g9({ top: t, left: e, right: r, bottom: n }) { y: { min: t, max: n } }; } -function Ste({ x: t, y: e }) { +function Ate({ x: t, y: e }) { return { top: e.min, right: t.max, bottom: e.max, left: t.min }; } -function Ate(t, e) { +function Pte(t, e) { if (!e) return t; const r = e({ x: t.left, y: t.top }), n = e({ x: t.right, y: t.bottom }); @@ -33945,7 +33955,7 @@ function v9(t, { x: e, y: r }) { Av(t.x, e.translate, e.scale, e.originPoint), Av(t.y, r.translate, r.scale, r.originPoint); } const H6 = 0.999999999999, K6 = 1.0000000000001; -function Pte(t, e, r, n = !1) { +function Mte(t, e, r, n = !1) { const i = r.length; if (!i) return; @@ -33972,14 +33982,14 @@ function pu(t, e) { V6(t.x, e.x, e.scaleX, e.scale, e.originX), V6(t.y, e.y, e.scaleY, e.scale, e.originY); } function b9(t, e) { - return g9(Ate(t.getBoundingClientRect(), e)); + return g9(Pte(t.getBoundingClientRect(), e)); } -function Mte(t, e, r) { +function Ite(t, e, r) { const n = b9(t, r), { scroll: i } = e; return i && (du(n.x, i.offset.x), du(n.y, i.offset.y)), n; } -const y9 = ({ current: t }) => t ? t.ownerDocument.defaultView : null, Ite = /* @__PURE__ */ new WeakMap(); -class Cte { +const y9 = ({ current: t }) => t ? t.ownerDocument.defaultView : null, Cte = /* @__PURE__ */ new WeakMap(); +class Tte { constructor(e) { this.openGlobalLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = ln(), this.visualElement = e; } @@ -33999,8 +34009,8 @@ class Cte { if (Xs.test(B)) { const { projection: k } = this.visualElement; if (k && k.layout) { - const q = k.layout.layoutBox[L]; - q && (B = ki(q) * (parseFloat(B) / 100)); + const W = k.layout.layoutBox[L]; + W && (B = ki(W) * (parseFloat(B) / 100)); } } this.originPoint[L] = B; @@ -34013,7 +34023,7 @@ class Cte { return; const { offset: L } = p; if (_ && this.currentDirection === null) { - this.currentDirection = Tte(L), this.currentDirection !== null && P && P(this.currentDirection); + this.currentDirection = Rte(L), this.currentDirection !== null && P && P(this.currentDirection); return; } this.updateAxis("x", p.point, L), this.updateAxis("y", p.point, L), this.visualElement.render(), O && O(d, p); @@ -34055,13 +34065,13 @@ class Cte { return; const s = this.getAxisMotionValue(e); let o = this.originPoint[e] + n[e]; - this.constraints && this.constraints[e] && (o = bte(o, this.constraints[e], this.elastic[e])), s.set(o); + this.constraints && this.constraints[e] && (o = yte(o, this.constraints[e], this.elastic[e])), s.set(o); } resolveConstraints() { var e; const { dragConstraints: r, dragElastic: n } = this.getProps(), i = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : (e = this.visualElement.projection) === null || e === void 0 ? void 0 : e.layout, s = this.constraints; - r && lu(r) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : r && i ? this.constraints = yte(i.layoutBox, r) : this.constraints = !1, this.elastic = Ete(n), s !== this.constraints && i && this.constraints && !this.hasMutatedConstraints && Qi((o) => { - this.constraints !== !1 && this.getAxisMotionValue(o) && (this.constraints[o] = _te(i.layoutBox[o], this.constraints[o])); + r && lu(r) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : r && i ? this.constraints = wte(i.layoutBox, r) : this.constraints = !1, this.elastic = Ste(n), s !== this.constraints && i && this.constraints && !this.hasMutatedConstraints && Qi((o) => { + this.constraints !== !1 && this.getAxisMotionValue(o) && (this.constraints[o] = Ete(i.layoutBox[o], this.constraints[o])); }); } resolveRefConstraints() { @@ -34073,10 +34083,10 @@ class Cte { const { projection: i } = this.visualElement; if (!i || !i.layout) return !1; - const s = Mte(n, i.root, this.visualElement.getTransformPagePoint()); - let o = wte(i.layout.layoutBox, s); + const s = Ite(n, i.root, this.visualElement.getTransformPagePoint()); + let o = xte(i.layout.layoutBox, s); if (r) { - const a = r(Ste(o)); + const a = r(Ate(o)); this.hasMutatedConstraints = !!a, a && (o = g9(a)); } return o; @@ -34158,7 +34168,7 @@ class Cte { const a = this.getAxisMotionValue(o); if (a && this.constraints !== !1) { const u = a.get(); - i[o] = xte({ min: u, max: u }, this.constraints[o]); + i[o] = _te({ min: u, max: u }, this.constraints[o]); } }); const { transformTemplate: s } = this.visualElement.getProps(); @@ -34172,7 +34182,7 @@ class Cte { addListeners() { if (!this.visualElement.current) return; - Ite.set(this.visualElement, this); + Cte.set(this.visualElement, this); const e = this.visualElement.current, r = ko(e, "pointerdown", (u) => { const { drag: l, dragListener: d = !0 } = this.getProps(); l && d && this.start(u); @@ -34207,13 +34217,13 @@ class Cte { function Id(t, e, r) { return (e === !0 || e === t) && (r === null || r === t); } -function Tte(t, e = 10) { +function Rte(t, e = 10) { let r = null; return Math.abs(t.y) > e ? r = "y" : Math.abs(t.x) > e && (r = "x"), r; } -class Rte extends $a { +class Dte extends $a { constructor(e) { - super(e), this.removeGroupControls = Un, this.removeListeners = Un, this.controls = new Cte(e); + super(e), this.removeGroupControls = Un, this.removeListeners = Un, this.controls = new Tte(e); } mount() { const { dragControls: e } = this.node.getProps(); @@ -34226,7 +34236,7 @@ class Rte extends $a { const G6 = (t) => (e, r) => { t && Lr.postRender(() => t(e, r)); }; -class Dte extends $a { +class Ote extends $a { constructor() { super(...arguments), this.removePointerDownListener = Un; } @@ -34258,7 +34268,7 @@ class Dte extends $a { } } const kp = Ta(null); -function Ote() { +function Nte() { const t = Tn(kp); if (t === null) return [!0, null]; @@ -34282,7 +34292,7 @@ const fy = Ta({}), w9 = Ta({}), Zd = { function Y6(t, e) { return e.max === e.min ? 0 : t / (e.max - e.min) * 100; } -const jf = { +const Uf = { correct: (t, e) => { if (!e.target) return t; @@ -34294,7 +34304,7 @@ const jf = { const r = Y6(t, e.target.x), n = Y6(t, e.target.y); return `${r}% ${n}%`; } -}, Nte = { +}, Lte = { correct: (t, { treeScale: e, projectionDelta: r }) => { const n = t, i = Ia.parse(t); if (i.length > 5) @@ -34305,11 +34315,11 @@ const jf = { return typeof i[2 + o] == "number" && (i[2 + o] /= l), typeof i[3 + o] == "number" && (i[3 + o] /= l), s(i); } }, N0 = {}; -function Lte(t) { +function kte(t) { Object.assign(N0, t); } const { schedule: ly } = _7(queueMicrotask, !1); -class kte extends fD { +class $te extends fD { /** * This only mounts projection nodes for components that * need measuring, we might want to do it for all components @@ -34317,7 +34327,7 @@ class kte extends fD { */ componentDidMount() { const { visualElement: e, layoutGroup: r, switchLayoutGroup: n, layoutId: i } = this.props, { projection: s } = e; - Lte($te), s && (r.group && r.group.add(s), n && n.register && i && n.register(s), s.root.didUpdate(), s.addEventListener("animationComplete", () => { + kte(Bte), s && (r.group && r.group.add(s), n && n.register && i && n.register(s), s.root.didUpdate(), s.addEventListener("animationComplete", () => { this.safeToRemove(); }), s.setOptions({ ...s.options, @@ -34350,12 +34360,12 @@ class kte extends fD { } } function x9(t) { - const [e, r] = Ote(), n = Tn(fy); - return le.jsx(kte, { ...t, layoutGroup: n, switchLayoutGroup: Tn(w9), isPresent: e, safeToRemove: r }); + const [e, r] = Nte(), n = Tn(fy); + return le.jsx($te, { ...t, layoutGroup: n, switchLayoutGroup: Tn(w9), isPresent: e, safeToRemove: r }); } -const $te = { +const Bte = { borderRadius: { - ...jf, + ...Uf, applyTo: [ "borderTopLeftRadius", "borderTopRightRadius", @@ -34363,20 +34373,20 @@ const $te = { "borderBottomRightRadius" ] }, - borderTopLeftRadius: jf, - borderTopRightRadius: jf, - borderBottomLeftRadius: jf, - borderBottomRightRadius: jf, - boxShadow: Nte -}, _9 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], Bte = _9.length, J6 = (t) => typeof t == "string" ? parseFloat(t) : t, X6 = (t) => typeof t == "number" || Vt.test(t); -function Fte(t, e, r, n, i, s) { + borderTopLeftRadius: Uf, + borderTopRightRadius: Uf, + borderBottomLeftRadius: Uf, + borderBottomRightRadius: Uf, + boxShadow: Lte +}, _9 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], Fte = _9.length, J6 = (t) => typeof t == "string" ? parseFloat(t) : t, X6 = (t) => typeof t == "number" || Vt.test(t); +function jte(t, e, r, n, i, s) { i ? (t.opacity = Qr( 0, // TODO Reinstate this if only child r.opacity !== void 0 ? r.opacity : 1, - jte(n) - ), t.opacityExit = Qr(e.opacity !== void 0 ? e.opacity : 1, 0, Ute(n))) : s && (t.opacity = Qr(e.opacity !== void 0 ? e.opacity : 1, r.opacity !== void 0 ? r.opacity : 1, n)); - for (let o = 0; o < Bte; o++) { + Ute(n) + ), t.opacityExit = Qr(e.opacity !== void 0 ? e.opacity : 1, 0, qte(n))) : s && (t.opacity = Qr(e.opacity !== void 0 ? e.opacity : 1, r.opacity !== void 0 ? r.opacity : 1, n)); + for (let o = 0; o < Fte; o++) { const a = `border${_9[o]}Radius`; let u = Z6(e, a), l = Z6(r, a); if (u === void 0 && l === void 0) @@ -34388,9 +34398,9 @@ function Fte(t, e, r, n, i, s) { function Z6(t, e) { return t[e] !== void 0 ? t[e] : t.borderRadius; } -const jte = /* @__PURE__ */ E9(0, 0.5, C7), Ute = /* @__PURE__ */ E9(0.5, 0.95, Un); +const Ute = /* @__PURE__ */ E9(0, 0.5, C7), qte = /* @__PURE__ */ E9(0.5, 0.95, Un); function E9(t, e, r) { - return (n) => n < t ? 0 : n > e ? 1 : r($u(t, e, n)); + return (n) => n < t ? 0 : n > e ? 1 : r(Bu(t, e, n)); } function Q6(t, e) { t.min = e.min, t.max = e.max; @@ -34404,18 +34414,18 @@ function e5(t, e) { function t5(t, e, r, n, i) { return t -= e, t = O0(t, 1 / r, n), i !== void 0 && (t = O0(t, 1 / i, n)), t; } -function qte(t, e = 0, r = 1, n = 0.5, i, s = t, o = t) { +function zte(t, e = 0, r = 1, n = 0.5, i, s = t, o = t) { if (Xs.test(e) && (e = parseFloat(e), e = Qr(o.min, o.max, e / 100) - o.min), typeof e != "number") return; let a = Qr(s.min, s.max, n); t === s && (a -= e), t.min = t5(t.min, e, r, a, i), t.max = t5(t.max, e, r, a, i); } function r5(t, e, [r, n, i], s, o) { - qte(t, e[r], e[n], e[i], e.scale, s, o); + zte(t, e[r], e[n], e[i], e.scale, s, o); } -const zte = ["x", "scaleX", "originX"], Wte = ["y", "scaleY", "originY"]; +const Wte = ["x", "scaleX", "originX"], Hte = ["y", "scaleY", "originY"]; function n5(t, e, r, n) { - r5(t.x, e, zte, r ? r.x : void 0, n ? n.x : void 0), r5(t.y, e, Wte, r ? r.y : void 0, n ? n.y : void 0); + r5(t.x, e, Wte, r ? r.x : void 0, n ? n.x : void 0), r5(t.y, e, Hte, r ? r.y : void 0, n ? n.y : void 0); } function i5(t) { return t.translate === 0 && t.scale === 1; @@ -34426,7 +34436,7 @@ function S9(t) { function s5(t, e) { return t.min === e.min && t.max === e.max; } -function Hte(t, e) { +function Kte(t, e) { return s5(t.x, e.x) && s5(t.y, e.y); } function o5(t, e) { @@ -34441,7 +34451,7 @@ function a5(t) { function c5(t, e) { return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint; } -class Kte { +class Vte { constructor() { this.members = []; } @@ -34495,7 +34505,7 @@ class Kte { this.lead && this.lead.snapshot && (this.lead.snapshot = void 0); } } -function Vte(t, e, r) { +function Gte(t, e, r) { let n = ""; const i = t.x.translate / e.x, s = t.y.translate / e.y, o = (r == null ? void 0 : r.z) || 0; if ((i || s || o) && (n = `translate3d(${i}px, ${s}px, ${o}px) `), (e.x !== 1 || e.y !== 1) && (n += `scale(${1 / e.x}, ${1 / e.y}) `), r) { @@ -34505,8 +34515,8 @@ function Vte(t, e, r) { const a = t.x.scale * e.x, u = t.y.scale * e.y; return (a !== 1 || u !== 1) && (n += `scale(${a}, ${u})`), n || "none"; } -const Gte = (t, e) => t.depth - e.depth; -class Yte { +const Yte = (t, e) => t.depth - e.depth; +class Jte { constructor() { this.children = [], this.isDirty = !1; } @@ -34517,24 +34527,24 @@ class Yte { ay(this.children, e), this.isDirty = !0; } forEach(e) { - this.isDirty && this.children.sort(Gte), this.isDirty = !1, this.children.forEach(e); + this.isDirty && this.children.sort(Yte), this.isDirty = !1, this.children.forEach(e); } } function Qd(t) { const e = Zn(t) ? t.get() : t; - return jee(e) ? e.toValue() : e; + return Uee(e) ? e.toValue() : e; } -function Jte(t, e) { +function Xte(t, e) { const r = Zs.now(), n = ({ timestamp: i }) => { const s = i - r; s >= e && (Pa(n), t(s - e)); }; return Lr.read(n, !0), () => Pa(n); } -function Xte(t) { +function Zte(t) { return t instanceof SVGElement && t.tagName !== "svg"; } -function Zte(t, e, r) { +function Qte(t, e, r) { const n = Zn(t) ? t : ql(t); return n.start(sy("", n, e, r)), n.animation; } @@ -34543,8 +34553,8 @@ const rc = { totalNodes: 0, resolvedTargetDeltas: 0, recalculatedProjection: 0 -}, Gf = typeof window < "u" && window.MotionDebug !== void 0, e1 = ["", "X", "Y", "Z"], Qte = { visibility: "hidden" }, u5 = 1e3; -let ere = 0; +}, Yf = typeof window < "u" && window.MotionDebug !== void 0, e1 = ["", "X", "Y", "Z"], ere = { visibility: "hidden" }, u5 = 1e3; +let tre = 0; function t1(t, e, r, n) { const { latestValues: i } = e; i[t] && (r[t] = i[t], e.setStaticValue(t, 0), n && (n[t] = 0)); @@ -34566,14 +34576,14 @@ function P9(t) { function M9({ attachResizeListener: t, defaultParent: e, measureScroll: r, checkIsScrollRoot: n, resetTransform: i }) { return class { constructor(o = {}, a = e == null ? void 0 : e()) { - this.id = ere++, this.animationId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => { + this.id = tre++, this.animationId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => { this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots()); }, this.updateProjection = () => { - this.projectionUpdateScheduled = !1, Gf && (rc.totalNodes = rc.resolvedTargetDeltas = rc.recalculatedProjection = 0), this.nodes.forEach(nre), this.nodes.forEach(cre), this.nodes.forEach(ure), this.nodes.forEach(ire), Gf && window.MotionDebug.record(rc); + this.projectionUpdateScheduled = !1, Yf && (rc.totalNodes = rc.resolvedTargetDeltas = rc.recalculatedProjection = 0), this.nodes.forEach(ire), this.nodes.forEach(ure), this.nodes.forEach(fre), this.nodes.forEach(sre), Yf && window.MotionDebug.record(rc); }, this.resolvedRelativeTargetAt = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = o, this.root = a ? a.root || a : this, this.path = a ? [...a.path, a] : [], this.parent = a, this.depth = a ? a.depth + 1 : 0; for (let u = 0; u < this.path.length; u++) this.path[u].shouldResetTransform = !0; - this.root === this && (this.nodes = new Yte()); + this.root === this && (this.nodes = new Jte()); } addEventListener(o, a) { return this.eventHandlers.has(o) || this.eventHandlers.set(o, new cy()), this.eventHandlers.get(o).add(a); @@ -34591,13 +34601,13 @@ function M9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check mount(o, a = this.root.hasTreeAnimated) { if (this.instance) return; - this.isSVG = Xte(o), this.instance = o; + this.isSVG = Zte(o), this.instance = o; const { layoutId: u, layout: l, visualElement: d } = this.options; if (d && !d.current && d.mount(o), this.root.nodes.add(this), this.parent && this.parent.children.add(this), a && (l || u) && (this.isLayoutDirty = !0), t) { let p; const w = () => this.root.updateBlockedByResize = !1; t(o, () => { - this.root.updateBlockedByResize = !0, p && p(), p = Jte(w, 250), Zd.hasAnimatedSinceResize && (Zd.hasAnimatedSinceResize = !1, this.nodes.forEach(l5)); + this.root.updateBlockedByResize = !0, p && p(), p = Xte(w, 250), Zd.hasAnimatedSinceResize && (Zd.hasAnimatedSinceResize = !1, this.nodes.forEach(l5)); }); } u && this.root.registerSharedNode(u, this), this.options.animate !== !1 && d && (u || l) && this.addEventListener("didUpdate", ({ delta: p, hasLayoutChanged: w, hasRelativeTargetChanged: _, layout: P }) => { @@ -34605,9 +34615,9 @@ function M9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.target = void 0, this.relativeTarget = void 0; return; } - const O = this.options.transition || d.getDefaultTransition() || pre, { onLayoutAnimationStart: L, onLayoutAnimationComplete: B } = d.getProps(), k = !this.targetLayout || !A9(this.targetLayout, P) || _, q = !w && _; - if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || q || w && (k || !this.currentAnimation)) { - this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0), this.setAnimationOrigin(p, q); + const O = this.options.transition || d.getDefaultTransition() || gre, { onLayoutAnimationStart: L, onLayoutAnimationComplete: B } = d.getProps(), k = !this.targetLayout || !A9(this.targetLayout, P) || _, W = !w && _; + if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || W || w && (k || !this.currentAnimation)) { + this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0), this.setAnimationOrigin(p, W); const U = { ...Hb(O, "layout"), onPlay: L, @@ -34639,7 +34649,7 @@ function M9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check } // Note: currently only running on root node startUpdate() { - this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(fre), this.animationId++); + this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(lre), this.animationId++); } getTransformTemplate() { const { visualElement: o } = this.options; @@ -34668,7 +34678,7 @@ function M9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(f5); return; } - this.isUpdating || this.nodes.forEach(ore), this.isUpdating = !1, this.nodes.forEach(are), this.nodes.forEach(tre), this.nodes.forEach(rre), this.clearAllSnapshots(); + this.isUpdating || this.nodes.forEach(are), this.isUpdating = !1, this.nodes.forEach(cre), this.nodes.forEach(rre), this.nodes.forEach(nre), this.clearAllSnapshots(); const a = Zs.now(); Fn.delta = Ma(0, 1e3 / 60, a - Fn.timestamp), Fn.timestamp = a, Fn.isProcessing = !0, Km.update.process(Fn), Km.preRender.process(Fn), Km.render.process(Fn), Fn.isProcessing = !1; } @@ -34676,7 +34686,7 @@ function M9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.updateScheduled || (this.updateScheduled = !0, ly.read(this.scheduleUpdate)); } clearAllSnapshots() { - this.nodes.forEach(sre), this.sharedNodes.forEach(lre); + this.nodes.forEach(ore), this.sharedNodes.forEach(hre); } scheduleUpdateProjection() { this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, Lr.preRender(this.updateProjection, !1, !0)); @@ -34725,7 +34735,7 @@ function M9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check measure(o = !0) { const a = this.measurePageBox(); let u = this.removeElementScroll(a); - return o && (u = this.removeTransform(u)), gre(u), { + return o && (u = this.removeTransform(u)), mre(u), { animationId: this.root.animationId, measuredBox: a, layoutBox: u, @@ -34739,7 +34749,7 @@ function M9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check if (!a) return ln(); const u = a.measureViewportBox(); - if (!(((o = this.scroll) === null || o === void 0 ? void 0 : o.wasRoot) || this.path.some(mre))) { + if (!(((o = this.scroll) === null || o === void 0 ? void 0 : o.wasRoot) || this.path.some(vre))) { const { scroll: d } = this.root; d && (du(u.x, d.offset.x), du(u.y, d.offset.y)); } @@ -34808,15 +34818,15 @@ function M9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check if (!(!this.layout || !(p || w))) { if (this.resolvedRelativeTargetAt = Fn.timestamp, !this.targetDelta && !this.relativeTarget) { const _ = this.getClosestProjectingParent(); - _ && _.layout && this.animationProgress !== 1 ? (this.relativeParent = _, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), il(this.relativeTargetOrigin, this.layout.layoutBox, _.layout.layoutBox), Xi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; + _ && _.layout && this.animationProgress !== 1 ? (this.relativeParent = _, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), sl(this.relativeTargetOrigin, this.layout.layoutBox, _.layout.layoutBox), Xi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; } if (!(!this.relativeTarget && !this.targetDelta)) { - if (this.target || (this.target = ln(), this.targetWithTransforms = ln()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), vte(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : Xi(this.target, this.layout.layoutBox), v9(this.target, this.targetDelta)) : Xi(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget) { + if (this.target || (this.target = ln(), this.targetWithTransforms = ln()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), bte(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : Xi(this.target, this.layout.layoutBox), v9(this.target, this.targetDelta)) : Xi(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget) { this.attemptToResolveRelativeTarget = !1; const _ = this.getClosestProjectingParent(); - _ && !!_.resumingFrom == !!this.resumingFrom && !_.options.layoutScroll && _.target && this.animationProgress !== 1 ? (this.relativeParent = _, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), il(this.relativeTargetOrigin, this.target, _.target), Xi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; + _ && !!_.resumingFrom == !!this.resumingFrom && !_.options.layoutScroll && _.target && this.animationProgress !== 1 ? (this.relativeParent = _, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), sl(this.relativeTargetOrigin, this.target, _.target), Xi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; } - Gf && rc.resolvedTargetDeltas++; + Yf && rc.resolvedTargetDeltas++; } } } @@ -34838,13 +34848,13 @@ function M9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check return; Xi(this.layoutCorrected, this.layout.layoutBox); const w = this.treeScale.x, _ = this.treeScale.y; - Pte(this.layoutCorrected, this.treeScale, this.path, u), a.layout && !a.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (a.target = a.layout.layoutBox, a.targetWithTransforms = ln()); + Mte(this.layoutCorrected, this.treeScale, this.path, u), a.layout && !a.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (a.target = a.layout.layoutBox, a.targetWithTransforms = ln()); const { target: P } = a; if (!P) { this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender()); return; } - !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (e5(this.prevProjectionDelta.x, this.projectionDelta.x), e5(this.prevProjectionDelta.y, this.projectionDelta.y)), nl(this.projectionDelta, this.layoutCorrected, P, this.latestValues), (this.treeScale.x !== w || this.treeScale.y !== _ || !c5(this.projectionDelta.x, this.prevProjectionDelta.x) || !c5(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", P)), Gf && rc.recalculatedProjection++; + !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (e5(this.prevProjectionDelta.x, this.projectionDelta.x), e5(this.prevProjectionDelta.y, this.projectionDelta.y)), il(this.projectionDelta, this.layoutCorrected, P, this.latestValues), (this.treeScale.x !== w || this.treeScale.y !== _ || !c5(this.projectionDelta.x, this.prevProjectionDelta.x) || !c5(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", P)), Yf && rc.recalculatedProjection++; } hide() { this.isVisible = !1; @@ -34866,17 +34876,17 @@ function M9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check setAnimationOrigin(o, a = !1) { const u = this.snapshot, l = u ? u.latestValues : {}, d = { ...this.latestValues }, p = hu(); (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !a; - const w = ln(), _ = u ? u.source : void 0, P = this.layout ? this.layout.source : void 0, O = _ !== P, L = this.getStack(), B = !L || L.members.length <= 1, k = !!(O && !B && this.options.crossfade === !0 && !this.path.some(dre)); + const w = ln(), _ = u ? u.source : void 0, P = this.layout ? this.layout.source : void 0, O = _ !== P, L = this.getStack(), B = !L || L.members.length <= 1, k = !!(O && !B && this.options.crossfade === !0 && !this.path.some(pre)); this.animationProgress = 0; - let q; + let W; this.mixTargetDelta = (U) => { const V = U / 1e3; - h5(p.x, o.x, V), h5(p.y, o.y, V), this.setTargetDelta(p), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (il(w, this.layout.layoutBox, this.relativeParent.layout.layoutBox), hre(this.relativeTarget, this.relativeTargetOrigin, w, V), q && Hte(this.relativeTarget, q) && (this.isProjectionDirty = !1), q || (q = ln()), Xi(q, this.relativeTarget)), O && (this.animationValues = d, Fte(d, l, this.latestValues, V, k, B)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V; + h5(p.x, o.x, V), h5(p.y, o.y, V), this.setTargetDelta(p), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (sl(w, this.layout.layoutBox, this.relativeParent.layout.layoutBox), dre(this.relativeTarget, this.relativeTargetOrigin, w, V), W && Kte(this.relativeTarget, W) && (this.isProjectionDirty = !1), W || (W = ln()), Xi(W, this.relativeTarget)), O && (this.animationValues = d, jte(d, l, this.latestValues, V, k, B)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V; }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0); } startAnimation(o) { this.notifyListeners("animationStart"), this.currentAnimation && this.currentAnimation.stop(), this.resumingFrom && this.resumingFrom.currentAnimation && this.resumingFrom.currentAnimation.stop(), this.pendingAnimation && (Pa(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = Lr.update(() => { - Zd.hasAnimatedSinceResize = !0, this.currentAnimation = Zte(0, u5, { + Zd.hasAnimatedSinceResize = !0, this.currentAnimation = Qte(0, u5, { ...o, onUpdate: (a) => { this.mixTargetDelta(a), o.onUpdate && o.onUpdate(a); @@ -34906,11 +34916,11 @@ function M9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check const w = ki(this.layout.layoutBox.y); u.y.min = o.target.y.min, u.y.max = u.y.min + w; } - Xi(a, u), pu(a, d), nl(this.projectionDeltaWithTransform, this.layoutCorrected, a, d); + Xi(a, u), pu(a, d), il(this.projectionDeltaWithTransform, this.layoutCorrected, a, d); } } registerSharedNode(o, a) { - this.sharedNodes.has(o) || this.sharedNodes.set(o, new Kte()), this.sharedNodes.get(o).add(a); + this.sharedNodes.has(o) || this.sharedNodes.set(o, new Vte()), this.sharedNodes.get(o).add(a); const l = a.options.initialPromotionConfig; a.promote({ transition: l ? l.transition : void 0, @@ -34966,7 +34976,7 @@ function M9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check if (!this.instance || this.isSVG) return; if (!this.isVisible) - return Qte; + return ere; const l = { visibility: "" }, d = this.getTransformTemplate(); @@ -34978,7 +34988,7 @@ function M9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check return this.options.layoutId && (O.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, O.pointerEvents = Qd(o == null ? void 0 : o.pointerEvents) || ""), this.hasProjected && !tc(this.latestValues) && (O.transform = d ? d({}, "") : "none", this.hasProjected = !1), O; } const w = p.animationValues || p.latestValues; - this.applyTransformsToTarget(), l.transform = Vte(this.projectionDeltaWithTransform, this.treeScale, w), d && (l.transform = d(w, l.transform)); + this.applyTransformsToTarget(), l.transform = Gte(this.projectionDeltaWithTransform, this.treeScale, w), d && (l.transform = d(w, l.transform)); const { x: _, y: P } = this.projectionDelta; l.transformOrigin = `${_.origin * 100}% ${P.origin * 100}% 0`, p.animationValues ? l.opacity = p === this ? (u = (a = w.opacity) !== null && a !== void 0 ? a : this.latestValues.opacity) !== null && u !== void 0 ? u : 1 : this.preserveOpacity ? this.latestValues.opacity : w.opacityExit : l.opacity = p === this ? w.opacity !== void 0 ? w.opacity : "" : w.opacityExit !== void 0 ? w.opacityExit : 0; for (const O in N0) { @@ -34986,8 +34996,8 @@ function M9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check continue; const { correct: L, applyTo: B } = N0[O], k = l.transform === "none" ? w[O] : L(w[O], p); if (B) { - const q = B.length; - for (let U = 0; U < q; U++) + const W = B.length; + for (let U = 0; U < W; U++) l[B[U]] = k; } else l[O] = k; @@ -35006,10 +35016,10 @@ function M9({ attachResizeListener: t, defaultParent: e, measureScroll: r, check } }; } -function tre(t) { +function rre(t) { t.updateLayout(); } -function rre(t) { +function nre(t) { var e; const r = ((e = t.resumeFrom) === null || e === void 0 ? void 0 : e.snapshot) || t.snapshot; if (t.isLead() && t.layout && r && t.hasListeners("didUpdate")) { @@ -35022,9 +35032,9 @@ function rre(t) { w.max = w.min + _, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[p].max = t.relativeTarget[p].min + _); }); const a = hu(); - nl(a, n, r.layoutBox); + il(a, n, r.layoutBox); const u = hu(); - o ? nl(u, t.applyTransform(i, !0), r.measuredBox) : nl(u, n, r.layoutBox); + o ? il(u, t.applyTransform(i, !0), r.measuredBox) : il(u, n, r.layoutBox); const l = !S9(a); let d = !1; if (!t.resumeFrom) { @@ -35033,9 +35043,9 @@ function rre(t) { const { snapshot: w, layout: _ } = p; if (w && _) { const P = ln(); - il(P, r.layoutBox, w.layoutBox); + sl(P, r.layoutBox, w.layoutBox); const O = ln(); - il(O, n, _.layoutBox), A9(P, O) || (d = !0), p.options.layoutRoot && (t.relativeTarget = O, t.relativeTargetOrigin = P, t.relativeParent = p); + sl(O, n, _.layoutBox), A9(P, O) || (d = !0), p.options.layoutRoot && (t.relativeTarget = O, t.relativeTargetOrigin = P, t.relativeParent = p); } } } @@ -35053,38 +35063,38 @@ function rre(t) { } t.options.transition = void 0; } -function nre(t) { - Gf && rc.totalNodes++, t.parent && (t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty), t.isSharedProjectionDirty || (t.isSharedProjectionDirty = !!(t.isProjectionDirty || t.parent.isProjectionDirty || t.parent.isSharedProjectionDirty)), t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty)); -} function ire(t) { - t.isProjectionDirty = t.isSharedProjectionDirty = t.isTransformDirty = !1; + Yf && rc.totalNodes++, t.parent && (t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty), t.isSharedProjectionDirty || (t.isSharedProjectionDirty = !!(t.isProjectionDirty || t.parent.isProjectionDirty || t.parent.isSharedProjectionDirty)), t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty)); } function sre(t) { + t.isProjectionDirty = t.isSharedProjectionDirty = t.isTransformDirty = !1; +} +function ore(t) { t.clearSnapshot(); } function f5(t) { t.clearMeasurements(); } -function ore(t) { +function are(t) { t.isLayoutDirty = !1; } -function are(t) { +function cre(t) { const { visualElement: e } = t.options; e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform(); } function l5(t) { t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0; } -function cre(t) { +function ure(t) { t.resolveTargetDelta(); } -function ure(t) { +function fre(t) { t.calcProjection(); } -function fre(t) { +function lre(t) { t.resetSkewAndRotation(); } -function lre(t) { +function hre(t) { t.removeLeadSnapshot(); } function h5(t, e, r) { @@ -35093,30 +35103,30 @@ function h5(t, e, r) { function d5(t, e, r, n) { t.min = Qr(e.min, r.min, n), t.max = Qr(e.max, r.max, n); } -function hre(t, e, r, n) { +function dre(t, e, r, n) { d5(t.x, e.x, r.x, n), d5(t.y, e.y, r.y, n); } -function dre(t) { +function pre(t) { return t.animationValues && t.animationValues.opacityExit !== void 0; } -const pre = { +const gre = { duration: 0.45, ease: [0.4, 0, 0.1, 1] }, p5 = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), g5 = p5("applewebkit/") && !p5("chrome/") ? Math.round : Un; function m5(t) { t.min = g5(t.min), t.max = g5(t.max); } -function gre(t) { +function mre(t) { m5(t.x), m5(t.y); } function I9(t, e, r) { - return t === "position" || t === "preserve-aspect" && !mte(a5(e), a5(r), 0.2); + return t === "position" || t === "preserve-aspect" && !vte(a5(e), a5(r), 0.2); } -function mre(t) { +function vre(t) { var e; return t !== t.root && ((e = t.scroll) === null || e === void 0 ? void 0 : e.wasRoot); } -const vre = M9({ +const bre = M9({ attachResizeListener: (t, e) => Ro(t, "resize", e), measureScroll: () => ({ x: document.documentElement.scrollLeft || document.body.scrollLeft, @@ -35132,7 +35142,7 @@ const vre = M9({ }), defaultParent: () => { if (!r1.current) { - const t = new vre({}); + const t = new bre({}); t.mount(window), t.setOptions({ layoutScroll: !0 }), r1.current = t; } return r1.current; @@ -35141,12 +35151,12 @@ const vre = M9({ t.style.transform = e !== void 0 ? e : "none"; }, checkIsScrollRoot: (t) => window.getComputedStyle(t).position === "fixed" -}), bre = { +}), yre = { pan: { - Feature: Dte + Feature: Ote }, drag: { - Feature: Rte, + Feature: Dte, ProjectionNode: C9, MeasureLayout: x9 } @@ -35164,14 +35174,14 @@ function v5(t, e) { passive: !t.getProps()[n] }); } -class yre extends $a { +class wre extends $a { mount() { this.unmount = Lo(v5(this.node, !0), v5(this.node, !1)); } unmount() { } } -class wre extends $a { +class xre extends $a { constructor() { super(...arguments), this.isActive = !1; } @@ -35200,7 +35210,7 @@ function n1(t, e) { const r = new PointerEvent("pointer" + t); e(r, Lp(r)); } -class xre extends $a { +class _re extends $a { constructor() { super(...arguments), this.removeStartListeners = Un, this.removeEndListeners = Un, this.removeAccessibleListeners = Un, this.startPointerPress = (e, r) => { if (this.isPressing) @@ -35260,29 +35270,29 @@ class xre extends $a { this.removeStartListeners(), this.removeEndListeners(), this.removeAccessibleListeners(); } } -const Pv = /* @__PURE__ */ new WeakMap(), i1 = /* @__PURE__ */ new WeakMap(), _re = (t) => { +const Pv = /* @__PURE__ */ new WeakMap(), i1 = /* @__PURE__ */ new WeakMap(), Ere = (t) => { const e = Pv.get(t.target); e && e(t); -}, Ere = (t) => { - t.forEach(_re); +}, Sre = (t) => { + t.forEach(Ere); }; -function Sre({ root: t, ...e }) { +function Are({ root: t, ...e }) { const r = t || document; i1.has(r) || i1.set(r, {}); const n = i1.get(r), i = JSON.stringify(e); - return n[i] || (n[i] = new IntersectionObserver(Ere, { root: t, ...e })), n[i]; + return n[i] || (n[i] = new IntersectionObserver(Sre, { root: t, ...e })), n[i]; } -function Are(t, e, r) { - const n = Sre(e); +function Pre(t, e, r) { + const n = Are(e); return Pv.set(t, r), n.observe(t), () => { Pv.delete(t), n.unobserve(t); }; } -const Pre = { +const Mre = { some: 0, all: 1 }; -class Mre extends $a { +class Ire extends $a { constructor() { super(...arguments), this.hasEnteredView = !1, this.isInView = !1; } @@ -35291,7 +35301,7 @@ class Mre extends $a { const { viewport: e = {} } = this.node.getProps(), { root: r, margin: n, amount: i = "some", once: s } = e, o = { root: r ? r.current : void 0, rootMargin: n, - threshold: typeof i == "number" ? i : Pre[i] + threshold: typeof i == "number" ? i : Mre[i] }, a = (u) => { const { isIntersecting: l } = u; if (this.isInView === l || (this.isInView = l, s && !l && this.hasEnteredView)) @@ -35300,7 +35310,7 @@ class Mre extends $a { const { onViewportEnter: d, onViewportLeave: p } = this.node.getProps(), w = l ? d : p; w && w(u); }; - return Are(this.node.current, o, a); + return Pre(this.node.current, o, a); } mount() { this.startObserver(); @@ -35309,28 +35319,28 @@ class Mre extends $a { if (typeof IntersectionObserver > "u") return; const { props: e, prevProps: r } = this.node; - ["amount", "margin", "root"].some(Ire(e, r)) && this.startObserver(); + ["amount", "margin", "root"].some(Cre(e, r)) && this.startObserver(); } unmount() { } } -function Ire({ viewport: t = {} }, { viewport: e = {} } = {}) { +function Cre({ viewport: t = {} }, { viewport: e = {} } = {}) { return (r) => t[r] !== e[r]; } -const Cre = { +const Tre = { inView: { - Feature: Mre + Feature: Ire }, tap: { - Feature: xre + Feature: _re }, focus: { - Feature: wre + Feature: xre }, hover: { - Feature: yre + Feature: wre } -}, Tre = { +}, Rre = { layout: { ProjectionNode: C9, MeasureLayout: x9 @@ -35340,7 +35350,7 @@ const Cre = { isStatic: !1, reducedMotion: "never" }), $p = Ta({}), dy = typeof window < "u", R9 = dy ? lD : Dn, D9 = Ta({ strict: !1 }); -function Rre(t, e, r, n, i) { +function Dre(t, e, r, n, i) { var s, o; const { visualElement: a } = Tn($p), u = Tn(D9), l = Tn(kp), d = Tn(hy).reducedMotion, p = Qn(); n = n || u.renderer, !p.current && n && (p.current = n(t, { @@ -35352,7 +35362,7 @@ function Rre(t, e, r, n, i) { reducedMotionConfig: d })); const w = p.current, _ = Tn(w9); - w && !w.projection && i && (w.type === "html" || w.type === "svg") && Dre(p.current, r, i, _); + w && !w.projection && i && (w.type === "html" || w.type === "svg") && Ore(p.current, r, i, _); const P = Qn(!1); L5(() => { w && P.current && w.update(r, l); @@ -35367,7 +35377,7 @@ function Rre(t, e, r, n, i) { }), L.current = !1)); }), w; } -function Dre(t, e, r, n) { +function Ore(t, e, r, n) { const { layoutId: i, layout: s, drag: o, dragConstraints: a, layoutScroll: u, layoutRoot: l } = e; t.projection = new r(t.latestValues, e["data-framer-portal-id"] ? void 0 : O9(t.parent)), t.projection.setOptions({ layoutId: i, @@ -35391,7 +35401,7 @@ function O9(t) { if (t) return t.options.allowProjection !== !1 ? t.projection : O9(t.parent); } -function Ore(t, e, r) { +function Nre(t, e, r) { return Nv( (n) => { n && t.mount && t.mount(n), e && (n ? e.mount(n) : e.unmount()), r && (typeof r == "function" ? r(n) : lu(r) && (r.current = n)); @@ -35410,7 +35420,7 @@ function Bp(t) { function N9(t) { return !!(Bp(t) || t.variants); } -function Nre(t, e) { +function Lre(t, e) { if (Bp(t)) { const { initial: r, animate: n } = t; return { @@ -35420,8 +35430,8 @@ function Nre(t, e) { } return t.inherit !== !1 ? e : {}; } -function Lre(t) { - const { initial: e, animate: r } = Nre(t, Tn($p)); +function kre(t) { + const { initial: e, animate: r } = Lre(t, Tn($p)); return wi(() => ({ initial: e, animate: r }), [b5(e), b5(r)]); } function b5(t) { @@ -35446,51 +35456,51 @@ const y5 = { pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"], inView: ["whileInView", "onViewportEnter", "onViewportLeave"], layout: ["layout", "layoutId"] -}, Bu = {}; +}, Fu = {}; for (const t in y5) - Bu[t] = { + Fu[t] = { isEnabled: (e) => y5[t].some((r) => !!e[r]) }; -function kre(t) { +function $re(t) { for (const e in t) - Bu[e] = { - ...Bu[e], + Fu[e] = { + ...Fu[e], ...t[e] }; } -const $re = Symbol.for("motionComponentSymbol"); -function Bre({ preloadedFeatures: t, createVisualElement: e, useRender: r, useVisualState: n, Component: i }) { - t && kre(t); +const Bre = Symbol.for("motionComponentSymbol"); +function Fre({ preloadedFeatures: t, createVisualElement: e, useRender: r, useVisualState: n, Component: i }) { + t && $re(t); function s(a, u) { let l; const d = { ...Tn(hy), ...a, - layoutId: Fre(a) - }, { isStatic: p } = d, w = Lre(a), _ = n(a, p); + layoutId: jre(a) + }, { isStatic: p } = d, w = kre(a), _ = n(a, p); if (!p && dy) { - jre(d, t); - const P = Ure(d); - l = P.MeasureLayout, w.visualElement = Rre(i, _, d, e, P.ProjectionNode); + Ure(d, t); + const P = qre(d); + l = P.MeasureLayout, w.visualElement = Dre(i, _, d, e, P.ProjectionNode); } - return le.jsxs($p.Provider, { value: w, children: [l && w.visualElement ? le.jsx(l, { visualElement: w.visualElement, ...d }) : null, r(i, a, Ore(_, w.visualElement, u), _, p, w.visualElement)] }); + return le.jsxs($p.Provider, { value: w, children: [l && w.visualElement ? le.jsx(l, { visualElement: w.visualElement, ...d }) : null, r(i, a, Nre(_, w.visualElement, u), _, p, w.visualElement)] }); } const o = Dv(s); - return o[$re] = i, o; + return o[Bre] = i, o; } -function Fre({ layoutId: t }) { +function jre({ layoutId: t }) { const e = Tn(fy).id; return e && t !== void 0 ? e + "-" + t : t; } -function jre(t, e) { +function Ure(t, e) { const r = Tn(D9).strict; if (process.env.NODE_ENV !== "production" && e && r) { const n = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead."; - t.ignoreStrict ? Qu(!1, n) : Wo(!1, n); + t.ignoreStrict ? ef(!1, n) : Wo(!1, n); } } -function Ure(t) { - const { drag: e, layout: r } = Bu; +function qre(t) { + const { drag: e, layout: r } = Fu; if (!e && !r) return {}; const n = { ...e, ...r }; @@ -35499,7 +35509,7 @@ function Ure(t) { ProjectionNode: n.ProjectionNode }; } -const qre = [ +const zre = [ "animate", "circle", "defs", @@ -35539,7 +35549,7 @@ function py(t) { /** * If it's in our list of lowercase SVG tags, it's an SVG component */ - !!(qre.indexOf(t) > -1 || /** + !!(zre.indexOf(t) > -1 || /** * If it contains a capital letter, it's an SVG component */ /[A-Z]/u.test(t)) @@ -35604,18 +35614,18 @@ function my(t) { const e = Qn(null); return e.current === null && (e.current = t()), e.current; } -function zre({ scrapeMotionValuesFromProps: t, createRenderState: e, onMount: r }, n, i, s) { +function Wre({ scrapeMotionValuesFromProps: t, createRenderState: e, onMount: r }, n, i, s) { const o = { - latestValues: Wre(n, i, s, t), + latestValues: Hre(n, i, s, t), renderState: e() }; return r && (o.mount = (a) => r(n, a, o)), o; } const j9 = (t) => (e, r) => { - const n = Tn($p), i = Tn(kp), s = () => zre(t, e, n, i); + const n = Tn($p), i = Tn(kp), s = () => Wre(t, e, n, i); return r ? s() : my(s); }; -function Wre(t, e, r, n) { +function Hre(t, e, r, n) { const i = {}, s = n(t, {}); for (const w in s) i[w] = Qd(s[w]); @@ -35632,12 +35642,12 @@ function Wre(t, e, r, n) { if (P) { const { transitionEnd: O, transition: L, ...B } = P; for (const k in B) { - let q = B[k]; - if (Array.isArray(q)) { - const U = d ? q.length - 1 : 0; - q = q[U]; + let W = B[k]; + if (Array.isArray(W)) { + const U = d ? W.length - 1 : 0; + W = W[U]; } - q !== null && (i[k] = q); + W !== null && (i[k] = W); } for (const k in O) i[k] = O[k]; @@ -35654,15 +35664,15 @@ const vy = () => ({ }), U9 = () => ({ ...vy(), attrs: {} -}), q9 = (t, e) => e && typeof t == "number" ? e.transform(t) : t, Hre = { +}), q9 = (t, e) => e && typeof t == "number" ? e.transform(t) : t, Kre = { x: "translateX", y: "translateY", z: "translateZ", transformPerspective: "perspective" -}, Kre = mh.length; -function Vre(t, e, r) { +}, Vre = mh.length; +function Gre(t, e, r) { let n = "", i = !0; - for (let s = 0; s < Kre; s++) { + for (let s = 0; s < Vre; s++) { const o = mh[s], a = t[o]; if (a === void 0) continue; @@ -35671,7 +35681,7 @@ function Vre(t, e, r) { const l = q9(a, Zb[o]); if (!u) { i = !1; - const d = Hre[o] || o; + const d = Kre[o] || o; n += `${d}(${l}) `; } r && (e[o] = l); @@ -35695,7 +35705,7 @@ function by(t, e, r) { u.startsWith("origin") ? (a = !0, s[u] = d) : n[u] = d; } } - if (e.transform || (o || r ? n.transform = Vre(e, t.transform, r) : n.transform && (n.transform = "none")), a) { + if (e.transform || (o || r ? n.transform = Gre(e, t.transform, r) : n.transform && (n.transform = "none")), a) { const { originX: u = "50%", originY: l = "50%", originZ: d = 0 } = s; n.transformOrigin = `${u} ${l} ${d}`; } @@ -35703,20 +35713,20 @@ function by(t, e, r) { function w5(t, e, r) { return typeof t == "string" ? t : Vt.transform(e + r * t); } -function Gre(t, e, r) { +function Yre(t, e, r) { const n = w5(e, t.x, t.width), i = w5(r, t.y, t.height); return `${n} ${i}`; } -const Yre = { +const Jre = { offset: "stroke-dashoffset", array: "stroke-dasharray" -}, Jre = { +}, Xre = { offset: "strokeDashoffset", array: "strokeDasharray" }; -function Xre(t, e, r = 1, n = 0, i = !0) { +function Zre(t, e, r = 1, n = 0, i = !0) { t.pathLength = 1; - const s = i ? Yre : Jre; + const s = i ? Jre : Xre; t[s.offset] = Vt.transform(-n); const o = Vt.transform(e), a = Vt.transform(r); t[s.array] = `${o} ${a}`; @@ -35739,9 +35749,9 @@ function yy(t, { } t.attrs = t.style, t.style = {}; const { attrs: w, style: _, dimensions: P } = t; - w.transform && (P && (_.transform = w.transform), delete w.transform), P && (i !== void 0 || s !== void 0 || _.transform) && (_.transformOrigin = Gre(P, i !== void 0 ? i : 0.5, s !== void 0 ? s : 0.5)), e !== void 0 && (w.x = e), r !== void 0 && (w.y = r), n !== void 0 && (w.scale = n), o !== void 0 && Xre(w, o, a, u, !1); + w.transform && (P && (_.transform = w.transform), delete w.transform), P && (i !== void 0 || s !== void 0 || _.transform) && (_.transformOrigin = Yre(P, i !== void 0 ? i : 0.5, s !== void 0 ? s : 0.5)), e !== void 0 && (w.x = e), r !== void 0 && (w.y = r), n !== void 0 && (w.scale = n), o !== void 0 && Zre(w, o, a, u, !1); } -const wy = (t) => typeof t == "string" && t.toLowerCase() === "svg", Zre = { +const wy = (t) => typeof t == "string" && t.toLowerCase() === "svg", Qre = { useVisualState: j9({ scrapeMotionValuesFromProps: F9, createRenderState: U9, @@ -35762,7 +35772,7 @@ const wy = (t) => typeof t == "string" && t.toLowerCase() === "svg", Zre = { }); } }) -}, Qre = { +}, ene = { useVisualState: j9({ scrapeMotionValuesFromProps: gy, createRenderState: vy @@ -35772,21 +35782,21 @@ function z9(t, e, r) { for (const n in e) !Zn(e[n]) && !B9(n, r) && (t[n] = e[n]); } -function ene({ transformTemplate: t }, e) { +function tne({ transformTemplate: t }, e) { return wi(() => { const r = vy(); return by(r, e, t), Object.assign({}, r.vars, r.style); }, [e]); } -function tne(t, e) { +function rne(t, e) { const r = t.style || {}, n = {}; - return z9(n, r, t), Object.assign(n, ene(t, e)), n; + return z9(n, r, t), Object.assign(n, tne(t, e)), n; } -function rne(t, e) { - const r = {}, n = tne(t, e); +function nne(t, e) { + const r = {}, n = rne(t, e); return t.drag && t.dragListener !== !1 && (r.draggable = !1, n.userSelect = n.WebkitUserSelect = n.WebkitTouchCallout = "none", n.touchAction = t.drag === !0 ? "none" : `pan-${t.drag === "x" ? "y" : "x"}`), t.tabIndex === void 0 && (t.onTap || t.onTapStart || t.whileTap) && (r.tabIndex = 0), r.style = n, r; } -const nne = /* @__PURE__ */ new Set([ +const ine = /* @__PURE__ */ new Set([ "animate", "exit", "variants", @@ -35819,24 +35829,24 @@ const nne = /* @__PURE__ */ new Set([ "viewport" ]); function L0(t) { - return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || nne.has(t); + return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || ine.has(t); } let W9 = (t) => !L0(t); -function ine(t) { +function sne(t) { t && (W9 = (e) => e.startsWith("on") ? !L0(e) : t(e)); } try { - ine(require("@emotion/is-prop-valid").default); + sne(require("@emotion/is-prop-valid").default); } catch { } -function sne(t, e, r) { +function one(t, e, r) { const n = {}; for (const i in t) i === "values" && typeof t.values == "object" || (W9(i) || r === !0 && L0(i) || !e && !L0(i) || // If trying to use native HTML drag events, forward drag listeners t.draggable && i.startsWith("onDrag")) && (n[i] = t[i]); return n; } -function one(t, e, r, n) { +function ane(t, e, r, n) { const i = wi(() => { const s = U9(); return yy(s, e, wy(n), t.transformTemplate), { @@ -35850,29 +35860,29 @@ function one(t, e, r, n) { } return i; } -function ane(t = !1) { +function cne(t = !1) { return (r, n, i, { latestValues: s }, o) => { - const u = (py(r) ? one : rne)(n, s, o, r), l = sne(n, typeof r == "string", t), d = r !== k5 ? { ...l, ...u, ref: i } : {}, { children: p } = n, w = wi(() => Zn(p) ? p.get() : p, [p]); + const u = (py(r) ? ane : nne)(n, s, o, r), l = one(n, typeof r == "string", t), d = r !== k5 ? { ...l, ...u, ref: i } : {}, { children: p } = n, w = wi(() => Zn(p) ? p.get() : p, [p]); return e0(r, { ...d, children: w }); }; } -function cne(t, e) { +function une(t, e) { return function(n, { forwardMotionProps: i } = { forwardMotionProps: !1 }) { const o = { - ...py(n) ? Zre : Qre, + ...py(n) ? Qre : ene, preloadedFeatures: t, - useRender: ane(i), + useRender: cne(i), createVisualElement: e, Component: n }; - return Bre(o); + return Fre(o); }; } const Mv = { current: null }, H9 = { current: !1 }; -function une() { +function fne() { if (H9.current = !0, !!dy) if (window.matchMedia) { const t = window.matchMedia("(prefers-reduced-motion)"), e = () => Mv.current = t.matches; @@ -35880,7 +35890,7 @@ function une() { } else Mv.current = !1; } -function fne(t, e, r) { +function lne(t, e, r) { for (const n in e) { const i = e[n], s = r[n]; if (Zn(i)) @@ -35900,7 +35910,7 @@ function fne(t, e, r) { e[n] === void 0 && t.removeValue(n); return e; } -const x5 = /* @__PURE__ */ new WeakMap(), lne = [...$7, Yn, Ia], hne = (t) => lne.find(k7(t)), _5 = [ +const x5 = /* @__PURE__ */ new WeakMap(), hne = [...$7, Yn, Ia], dne = (t) => hne.find(k7(t)), _5 = [ "AnimationStart", "AnimationComplete", "Update", @@ -35909,7 +35919,7 @@ const x5 = /* @__PURE__ */ new WeakMap(), lne = [...$7, Yn, Ia], hne = (t) => ln "LayoutAnimationStart", "LayoutAnimationComplete" ]; -class dne { +class pne { /** * This method takes React props and returns found MotionValues. For example, HTML * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays. @@ -35936,7 +35946,7 @@ class dne { } } mount(e) { - this.current = e, x5.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((r, n) => this.bindToMotionValue(n, r)), H9.current || une(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : Mv.current, process.env.NODE_ENV !== "production" && Rp(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext); + this.current = e, x5.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((r, n) => this.bindToMotionValue(n, r)), H9.current || fne(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : Mv.current, process.env.NODE_ENV !== "production" && Rp(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext); } unmount() { x5.delete(this.current), this.projection && this.projection.unmount(), Pa(this.notifyUpdate), Pa(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this); @@ -35963,8 +35973,8 @@ class dne { } updateFeatures() { let e = "animation"; - for (e in Bu) { - const r = Bu[e]; + for (e in Fu) { + const r = Fu[e]; if (!r) continue; const { isEnabled: n, Feature: i } = r; @@ -36003,7 +36013,7 @@ class dne { const s = "on" + i, o = e[s]; o && (this.propEventSubscriptions[i] = this.on(i, o)); } - this.prevMotionValues = fne(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue(); + this.prevMotionValues = lne(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue(); } getProps() { return this.props; @@ -36069,7 +36079,7 @@ class dne { readValue(e, r) { var n; let i = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : (n = this.getBaseTargetFromProps(this.props, e)) !== null && n !== void 0 ? n : this.readValueFromInstance(this.current, e, this.options); - return i != null && (typeof i == "string" && (D7(i) || R7(i)) ? i = parseFloat(i) : !hne(i) && Ia.test(r) && (i = H7(e, r)), this.setBaseTarget(e, Zn(i) ? i.get() : i)), Zn(i) ? i.get() : i; + return i != null && (typeof i == "string" && (D7(i) || R7(i)) ? i = parseFloat(i) : !dne(i) && Ia.test(r) && (i = H7(e, r)), this.setBaseTarget(e, Zn(i) ? i.get() : i)), Zn(i) ? i.get() : i; } /** * Set the base target to later animate back to. This is currently @@ -36102,7 +36112,7 @@ class dne { this.events[e] && this.events[e].notify(...r); } } -class K9 extends dne { +class K9 extends pne { constructor() { super(...arguments), this.KeyframeResolver = K7; } @@ -36116,10 +36126,10 @@ class K9 extends dne { delete r[e], delete n[e]; } } -function pne(t) { +function gne(t) { return window.getComputedStyle(t); } -class gne extends K9 { +class mne extends K9 { constructor() { super(...arguments), this.type = "html", this.renderInstance = L9; } @@ -36128,7 +36138,7 @@ class gne extends K9 { const n = Qb(r); return n && n.default || 0; } else { - const n = pne(e), i = (N7(r) ? n.getPropertyValue(r) : n[r]) || 0; + const n = gne(e), i = (N7(r) ? n.getPropertyValue(r) : n[r]) || 0; return typeof i == "string" ? i.trim() : i; } } @@ -36149,7 +36159,7 @@ class gne extends K9 { })); } } -class mne extends K9 { +class vne extends K9 { constructor() { super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = ln; } @@ -36176,15 +36186,15 @@ class mne extends K9 { this.isSVGTag = wy(e.tagName), super.mount(e); } } -const vne = (t, e) => py(t) ? new mne(e) : new gne(e, { +const bne = (t, e) => py(t) ? new vne(e) : new mne(e, { allowProjection: t !== k5 -}), bne = /* @__PURE__ */ cne({ - ...ate, - ...Cre, - ...bre, - ...Tre -}, vne), yne = /* @__PURE__ */ ZZ(bne); -class wne extends Gt.Component { +}), yne = /* @__PURE__ */ une({ + ...cte, + ...Tre, + ...yre, + ...Rre +}, bne), wne = /* @__PURE__ */ QZ(yne); +class xne extends Gt.Component { getSnapshotBeforeUpdate(e) { const r = this.props.childRef.current; if (r && e.isPresent && !this.props.isPresent) { @@ -36202,7 +36212,7 @@ class wne extends Gt.Component { return this.props.children; } } -function xne({ children: t, isPresent: e }) { +function _ne({ children: t, isPresent: e }) { const r = Ov(), n = Qn(null), i = Qn({ width: 0, height: 0, @@ -36226,10 +36236,10 @@ function xne({ children: t, isPresent: e }) { `), () => { document.head.removeChild(d); }; - }, [e]), le.jsx(wne, { isPresent: e, childRef: n, sizeRef: i, children: Gt.cloneElement(t, { ref: n }) }); + }, [e]), le.jsx(xne, { isPresent: e, childRef: n, sizeRef: i, children: Gt.cloneElement(t, { ref: n }) }); } -const _ne = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: i, presenceAffectsLayout: s, mode: o }) => { - const a = my(Ene), u = Ov(), l = Nv((p) => { +const Ene = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: i, presenceAffectsLayout: s, mode: o }) => { + const a = my(Sne), u = Ov(), l = Nv((p) => { a.set(p, !0); for (const w of a.values()) if (!w) @@ -36255,9 +36265,9 @@ const _ne = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: a.forEach((p, w) => a.set(w, !1)); }, [r]), Gt.useEffect(() => { !r && !a.size && n && n(); - }, [r]), o === "popLayout" && (t = le.jsx(xne, { isPresent: r, children: t })), le.jsx(kp.Provider, { value: d, children: t }); + }, [r]), o === "popLayout" && (t = le.jsx(_ne, { isPresent: r, children: t })), le.jsx(kp.Provider, { value: d, children: t }); }; -function Ene() { +function Sne() { return /* @__PURE__ */ new Map(); } const Cd = (t) => t.key || ""; @@ -36267,22 +36277,22 @@ function E5(t) { dD(r) && e.push(r); }), e; } -const Sne = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExitComplete: i, presenceAffectsLayout: s = !0, mode: o = "sync" }) => { +const Ane = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExitComplete: i, presenceAffectsLayout: s = !0, mode: o = "sync" }) => { Wo(!e, "Replace exitBeforeEnter with mode='wait'"); const a = wi(() => E5(t), [t]), u = a.map(Cd), l = Qn(!0), d = Qn(a), p = my(() => /* @__PURE__ */ new Map()), [w, _] = Yt(a), [P, O] = Yt(a); R9(() => { l.current = !1, d.current = a; for (let k = 0; k < P.length; k++) { - const q = Cd(P[k]); - u.includes(q) ? p.delete(q) : p.get(q) !== !0 && p.set(q, !1); + const W = Cd(P[k]); + u.includes(W) ? p.delete(W) : p.get(W) !== !0 && p.set(W, !1); } }, [P, u.length, u.join("-")]); const L = []; if (a !== w) { let k = [...a]; - for (let q = 0; q < P.length; q++) { - const U = P[q], V = Cd(U); - u.includes(V) || (k.splice(q, 0, U), L.push(U)); + for (let W = 0; W < P.length; W++) { + const U = P[W], V = Cd(U); + u.includes(V) || (k.splice(W, 0, U), L.push(U)); } o === "wait" && L.length && (k = L), O(E5(k)), _(a); return; @@ -36290,9 +36300,9 @@ const Sne = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onEx process.env.NODE_ENV !== "production" && o === "wait" && P.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`); const { forceRender: B } = Tn(fy); return le.jsx(le.Fragment, { children: P.map((k) => { - const q = Cd(k), U = a === P || u.includes(q), V = () => { - if (p.has(q)) - p.set(q, !0); + const W = Cd(k), U = a === P || u.includes(W), V = () => { + if (p.has(W)) + p.set(W, !0); else return; let Q = !0; @@ -36300,10 +36310,10 @@ const Sne = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onEx R || (Q = !1); }), Q && (B == null || B(), O(d.current), i && i()); }; - return le.jsx(_ne, { isPresent: U, initial: !l.current || n ? void 0 : !1, custom: U ? void 0 : r, presenceAffectsLayout: s, mode: o, onExitComplete: U ? void 0 : V, children: k }, q); + return le.jsx(Ene, { isPresent: U, initial: !l.current || n ? void 0 : !1, custom: U ? void 0 : r, presenceAffectsLayout: s, mode: o, onExitComplete: U ? void 0 : V, children: k }, W); }) }); -}, Rs = (t) => /* @__PURE__ */ le.jsx(Sne, { children: /* @__PURE__ */ le.jsx( - yne.div, +}, Rs = (t) => /* @__PURE__ */ le.jsx(Ane, { children: /* @__PURE__ */ le.jsx( + wne.div, { initial: { x: 0, opacity: 0 }, animate: { x: 0, opacity: 1 }, @@ -36328,13 +36338,13 @@ function xy(t) { r, /* @__PURE__ */ le.jsxs("div", { className: "xc-relative xc-ml-auto xc-h-6", children: [ /* @__PURE__ */ le.jsx("div", { className: "xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0", children: n }), - /* @__PURE__ */ le.jsx("div", { className: "xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100", children: /* @__PURE__ */ le.jsx(HZ, {}) }) + /* @__PURE__ */ le.jsx("div", { className: "xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100", children: /* @__PURE__ */ le.jsx(KZ, {}) }) ] }) ] } ); } -function Ane(t) { +function Pne(t) { return t.lastUsed ? /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500", children: [ /* @__PURE__ */ le.jsx("div", { className: "xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]" }), "Last Used" @@ -36345,7 +36355,7 @@ function Ane(t) { } function V9(t) { var o, a; - const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: (o = e.config) == null ? void 0 : o.image }), i = ((a = e.config) == null ? void 0 : a.name) || "", s = wi(() => Ane(e), [e]); + const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: (o = e.config) == null ? void 0 : o.image }), i = ((a = e.config) == null ? void 0 : a.name) || "", s = wi(() => Pne(e), [e]); return /* @__PURE__ */ le.jsx(xy, { icon: n, title: i, extra: s, onClick: () => r(e) }); } function G9(t) { @@ -36357,19 +36367,19 @@ function G9(t) { } else for (r in t) t[r] && (n && (n += " "), n += r); return n; } -function Pne() { +function Mne() { for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++) (t = arguments[r]) && (e = G9(t)) && (n && (n += " "), n += e); return n; } -const Mne = Pne, _y = "-", Ine = (t) => { - const e = Tne(t), { +const Ine = Mne, _y = "-", Cne = (t) => { + const e = Rne(t), { conflictingClassGroups: r, conflictingClassGroupModifiers: n } = t; return { getClassGroupId: (o) => { const a = o.split(_y); - return a[0] === "" && a.length !== 1 && a.shift(), Y9(a, e) || Cne(o); + return a[0] === "" && a.length !== 1 && a.shift(), Y9(a, e) || Tne(o); }, getConflictingClassGroupIds: (o, a) => { const u = r[o] || []; @@ -36389,13 +36399,13 @@ const Mne = Pne, _y = "-", Ine = (t) => { return (o = e.validators.find(({ validator: a }) => a(s))) == null ? void 0 : o.classGroupId; -}, S5 = /^\[(.+)\]$/, Cne = (t) => { +}, S5 = /^\[(.+)\]$/, Tne = (t) => { if (S5.test(t)) { const e = S5.exec(t)[1], r = e == null ? void 0 : e.substring(0, e.indexOf(":")); if (r) return "arbitrary.." + r; } -}, Tne = (t) => { +}, Rne = (t) => { const { theme: e, prefix: r @@ -36403,7 +36413,7 @@ const Mne = Pne, _y = "-", Ine = (t) => { nextPart: /* @__PURE__ */ new Map(), validators: [] }; - return Dne(Object.entries(t.classGroups), r).forEach(([s, o]) => { + return One(Object.entries(t.classGroups), r).forEach(([s, o]) => { Iv(o, n, s, e); }), n; }, Iv = (t, e, r, n) => { @@ -36414,7 +36424,7 @@ const Mne = Pne, _y = "-", Ine = (t) => { return; } if (typeof i == "function") { - if (Rne(i)) { + if (Dne(i)) { Iv(i(n), e, r, n); return; } @@ -36436,10 +36446,10 @@ const Mne = Pne, _y = "-", Ine = (t) => { validators: [] }), r = r.nextPart.get(n); }), r; -}, Rne = (t) => t.isThemeGetter, Dne = (t, e) => e ? t.map(([r, n]) => { +}, Dne = (t) => t.isThemeGetter, One = (t, e) => e ? t.map(([r, n]) => { const i = n.map((s) => typeof s == "string" ? e + s : typeof s == "object" ? Object.fromEntries(Object.entries(s).map(([o, a]) => [e + o, a])) : s); return [r, i]; -}) : t, One = (t) => { +}) : t, Nne = (t) => { if (t < 1) return { get: () => { @@ -36463,7 +36473,7 @@ const Mne = Pne, _y = "-", Ine = (t) => { r.has(s) ? r.set(s, o) : i(s, o); } }; -}, J9 = "!", Nne = (t) => { +}, J9 = "!", Lne = (t) => { const { separator: e, experimentalParseClassName: r @@ -36496,7 +36506,7 @@ const Mne = Pne, _y = "-", Ine = (t) => { className: a, parseClassName: o }) : o; -}, Lne = (t) => { +}, kne = (t) => { if (t.length <= 1) return t; const e = []; @@ -36504,16 +36514,16 @@ const Mne = Pne, _y = "-", Ine = (t) => { return t.forEach((n) => { n[0] === "[" ? (e.push(...r.sort(), n), r = []) : r.push(n); }), e.push(...r.sort()), e; -}, kne = (t) => ({ - cache: One(t.cacheSize), - parseClassName: Nne(t), - ...Ine(t) -}), $ne = /\s+/, Bne = (t, e) => { +}, $ne = (t) => ({ + cache: Nne(t.cacheSize), + parseClassName: Lne(t), + ...Cne(t) +}), Bne = /\s+/, Fne = (t, e) => { const { parseClassName: r, getClassGroupId: n, getConflictingClassGroupIds: i - } = e, s = [], o = t.trim().split($ne); + } = e, s = [], o = t.trim().split(Bne); let a = ""; for (let u = o.length - 1; u >= 0; u -= 1) { const l = o[u], { @@ -36534,20 +36544,20 @@ const Mne = Pne, _y = "-", Ine = (t) => { } P = !1; } - const L = Lne(d).join(":"), B = p ? L + J9 : L, k = B + O; + const L = kne(d).join(":"), B = p ? L + J9 : L, k = B + O; if (s.includes(k)) continue; s.push(k); - const q = i(O, P); - for (let U = 0; U < q.length; ++U) { - const V = q[U]; + const W = i(O, P); + for (let U = 0; U < W.length; ++U) { + const V = W[U]; s.push(B + V); } a = l + (a.length > 0 ? " " + a : a); } return a; }; -function Fne() { +function jne() { let t = 0, e, r, n = ""; for (; t < arguments.length; ) (e = arguments[t++]) && (r = X9(e)) && (n && (n += " "), n += r); @@ -36561,41 +36571,41 @@ const X9 = (t) => { t[n] && (e = X9(t[n])) && (r && (r += " "), r += e); return r; }; -function jne(t, ...e) { +function Une(t, ...e) { let r, n, i, s = o; function o(u) { const l = e.reduce((d, p) => p(d), t()); - return r = kne(l), n = r.cache.get, i = r.cache.set, s = a, a(u); + return r = $ne(l), n = r.cache.get, i = r.cache.set, s = a, a(u); } function a(u) { const l = n(u); if (l) return l; - const d = Bne(u, r); + const d = Fne(u, r); return i(u, d), d; } return function() { - return s(Fne.apply(null, arguments)); + return s(jne.apply(null, arguments)); }; } const Gr = (t) => { const e = (r) => r[t] || []; return e.isThemeGetter = !0, e; -}, Z9 = /^\[(?:([a-z-]+):)?(.+)\]$/i, Une = /^\d+\/\d+$/, qne = /* @__PURE__ */ new Set(["px", "full", "screen"]), zne = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, Wne = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, Hne = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, Kne = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, Vne = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, _o = (t) => Pu(t) || qne.has(t) || Une.test(t), sa = (t) => tf(t, "length", tie), Pu = (t) => !!t && !Number.isNaN(Number(t)), s1 = (t) => tf(t, "number", Pu), Uf = (t) => !!t && Number.isInteger(Number(t)), Gne = (t) => t.endsWith("%") && Pu(t.slice(0, -1)), ur = (t) => Z9.test(t), oa = (t) => zne.test(t), Yne = /* @__PURE__ */ new Set(["length", "size", "percentage"]), Jne = (t) => tf(t, Yne, Q9), Xne = (t) => tf(t, "position", Q9), Zne = /* @__PURE__ */ new Set(["image", "url"]), Qne = (t) => tf(t, Zne, nie), eie = (t) => tf(t, "", rie), qf = () => !0, tf = (t, e, r) => { +}, Z9 = /^\[(?:([a-z-]+):)?(.+)\]$/i, qne = /^\d+\/\d+$/, zne = /* @__PURE__ */ new Set(["px", "full", "screen"]), Wne = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, Hne = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, Kne = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, Vne = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, Gne = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, _o = (t) => Mu(t) || zne.has(t) || qne.test(t), sa = (t) => rf(t, "length", rie), Mu = (t) => !!t && !Number.isNaN(Number(t)), s1 = (t) => rf(t, "number", Mu), qf = (t) => !!t && Number.isInteger(Number(t)), Yne = (t) => t.endsWith("%") && Mu(t.slice(0, -1)), ur = (t) => Z9.test(t), oa = (t) => Wne.test(t), Jne = /* @__PURE__ */ new Set(["length", "size", "percentage"]), Xne = (t) => rf(t, Jne, Q9), Zne = (t) => rf(t, "position", Q9), Qne = /* @__PURE__ */ new Set(["image", "url"]), eie = (t) => rf(t, Qne, iie), tie = (t) => rf(t, "", nie), zf = () => !0, rf = (t, e, r) => { const n = Z9.exec(t); return n ? n[1] ? typeof e == "string" ? n[1] === e : e.has(n[1]) : r(n[2]) : !1; -}, tie = (t) => ( +}, rie = (t) => ( // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths. // For example, `hsl(0 0% 0%)` would be classified as a length without this check. // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough. - Wne.test(t) && !Hne.test(t) -), Q9 = () => !1, rie = (t) => Kne.test(t), nie = (t) => Vne.test(t), iie = () => { - const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), u = Gr("contrast"), l = Gr("grayscale"), d = Gr("hueRotate"), p = Gr("invert"), w = Gr("gap"), _ = Gr("gradientColorStops"), P = Gr("gradientColorStopPositions"), O = Gr("inset"), L = Gr("margin"), B = Gr("opacity"), k = Gr("padding"), q = Gr("saturate"), U = Gr("scale"), V = Gr("sepia"), Q = Gr("skew"), R = Gr("space"), K = Gr("translate"), ge = () => ["auto", "contain", "none"], Ee = () => ["auto", "hidden", "clip", "visible", "scroll"], Y = () => ["auto", ur, e], A = () => [ur, e], m = () => ["", _o, sa], f = () => ["auto", Pu, ur], g = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], b = () => ["solid", "dashed", "dotted", "double", "none"], x = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], E = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], S = () => ["", "0", ur], v = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], M = () => [Pu, ur]; + Hne.test(t) && !Kne.test(t) +), Q9 = () => !1, nie = (t) => Vne.test(t), iie = (t) => Gne.test(t), sie = () => { + const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), u = Gr("contrast"), l = Gr("grayscale"), d = Gr("hueRotate"), p = Gr("invert"), w = Gr("gap"), _ = Gr("gradientColorStops"), P = Gr("gradientColorStopPositions"), O = Gr("inset"), L = Gr("margin"), B = Gr("opacity"), k = Gr("padding"), W = Gr("saturate"), U = Gr("scale"), V = Gr("sepia"), Q = Gr("skew"), R = Gr("space"), K = Gr("translate"), ge = () => ["auto", "contain", "none"], Ee = () => ["auto", "hidden", "clip", "visible", "scroll"], Y = () => ["auto", ur, e], A = () => [ur, e], m = () => ["", _o, sa], f = () => ["auto", Mu, ur], g = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], b = () => ["solid", "dashed", "dotted", "double", "none"], x = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], E = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], S = () => ["", "0", ur], v = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], M = () => [Mu, ur]; return { cacheSize: 500, separator: ":", theme: { - colors: [qf], + colors: [zf], spacing: [_o, sa], blur: ["none", "", oa, ur], brightness: M(), @@ -36609,7 +36619,7 @@ const Gr = (t) => { invert: S(), gap: A(), gradientColorStops: [t], - gradientColorStopPositions: [Gne, sa], + gradientColorStopPositions: [Yne, sa], inset: Y(), margin: Y(), opacity: M(), @@ -36835,7 +36845,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/z-index */ z: [{ - z: ["auto", Uf, ur] + z: ["auto", qf, ur] }], // Flexbox and Grid /** @@ -36885,14 +36895,14 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/order */ order: [{ - order: ["first", "last", "none", Uf, ur] + order: ["first", "last", "none", qf, ur] }], /** * Grid Template Columns * @see https://tailwindcss.com/docs/grid-template-columns */ "grid-cols": [{ - "grid-cols": [qf] + "grid-cols": [zf] }], /** * Grid Column Start / End @@ -36900,7 +36910,7 @@ const Gr = (t) => { */ "col-start-end": [{ col: ["auto", { - span: ["full", Uf, ur] + span: ["full", qf, ur] }, ur] }], /** @@ -36922,7 +36932,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/grid-template-rows */ "grid-rows": [{ - "grid-rows": [qf] + "grid-rows": [zf] }], /** * Grid Row Start / End @@ -36930,7 +36940,7 @@ const Gr = (t) => { */ "row-start-end": [{ row: ["auto", { - span: [Uf, ur] + span: [qf, ur] }, ur] }], /** @@ -37285,7 +37295,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/font-family */ "font-family": [{ - font: [qf] + font: [zf] }], /** * Font Variant Numeric @@ -37329,7 +37339,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/line-clamp */ "line-clamp": [{ - "line-clamp": ["none", Pu, s1] + "line-clamp": ["none", Mu, s1] }], /** * Line Height @@ -37522,7 +37532,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/background-position */ "bg-position": [{ - bg: [...g(), Xne] + bg: [...g(), Zne] }], /** * Background Repeat @@ -37538,7 +37548,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/background-size */ "bg-size": [{ - bg: ["auto", "cover", "contain", Jne] + bg: ["auto", "cover", "contain", Xne] }], /** * Background Image @@ -37547,7 +37557,7 @@ const Gr = (t) => { "bg-image": [{ bg: ["none", { "gradient-to": ["t", "tr", "r", "br", "b", "bl", "l", "tl"] - }, Qne] + }, eie] }], /** * Background Color @@ -37963,14 +37973,14 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/box-shadow */ shadow: [{ - shadow: ["", "inner", "none", oa, eie] + shadow: ["", "inner", "none", oa, tie] }], /** * Box Shadow Color * @see https://tailwindcss.com/docs/box-shadow-color */ "shadow-color": [{ - shadow: [qf] + shadow: [zf] }], /** * Opacity @@ -38056,7 +38066,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/saturate */ saturate: [{ - saturate: [q] + saturate: [W] }], /** * Sepia @@ -38127,7 +38137,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/backdrop-saturate */ "backdrop-saturate": [{ - "backdrop-saturate": [q] + "backdrop-saturate": [W] }], /** * Backdrop Sepia @@ -38249,7 +38259,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/rotate */ rotate: [{ - rotate: [Uf, ur] + rotate: [qf, ur] }], /** * Translate X @@ -38618,9 +38628,9 @@ const Gr = (t) => { "font-size": ["leading"] } }; -}, sie = /* @__PURE__ */ jne(iie); +}, oie = /* @__PURE__ */ Une(sie); function $o(...t) { - return sie(Mne(t)); + return oie(Ine(t)); } function eA(t) { const { className: e } = t; @@ -38630,7 +38640,7 @@ function eA(t) { /* @__PURE__ */ le.jsx("hr", { className: $o("xc-flex-1 xc-border-gray-200", e) }) ] }); } -function oie(t) { +function aie(t) { var n, i; const { wallet: e, onClick: r } = t; return /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4", children: [ @@ -38644,8 +38654,8 @@ function oie(t) { ] }) ] }); } -const aie = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton"; -function cie(t) { +const cie = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton"; +function uie(t) { const { onClick: e } = t; function r() { e && e(); @@ -38675,7 +38685,7 @@ function tA(t) { return /* @__PURE__ */ le.jsx(Rs, { children: i && /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ t.header || /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6 xc-text-xl xc-font-bold", children: "Log in or sign up" }), n.length === 1 && /* @__PURE__ */ le.jsx("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: n.map((O) => /* @__PURE__ */ le.jsx( - oie, + aie, { wallet: O, onClick: p @@ -38696,13 +38706,13 @@ function tA(t) { l.showTonConnect && /* @__PURE__ */ le.jsx( xy, { - icon: /* @__PURE__ */ le.jsx("img", { className: "xc-h-5 xc-w-5", src: aie }), + icon: /* @__PURE__ */ le.jsx("img", { className: "xc-h-5 xc-w-5", src: cie }), title: "TON Connect", onClick: u } ) ] }), - l.showMoreWallets && /* @__PURE__ */ le.jsx(cie, { onClick: a }) + l.showMoreWallets && /* @__PURE__ */ le.jsx(uie, { onClick: a }) ] }), l.showEmailSignIn && (l.showFeaturedWallets || l.showTonConnect) && /* @__PURE__ */ le.jsx("div", { className: "xc-mb-4 xc-mt-4", children: /* @__PURE__ */ le.jsxs(eA, { className: "xc-opacity-20", children: [ " ", @@ -38718,7 +38728,7 @@ function tA(t) { function kc(t) { const { title: e } = t; return /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2", children: [ - /* @__PURE__ */ le.jsx(WZ, { onClick: t.onBack, size: 20, className: "xc-cursor-pointer" }), + /* @__PURE__ */ le.jsx(HZ, { onClick: t.onBack, size: 20, className: "xc-cursor-pointer" }), /* @__PURE__ */ le.jsx("span", { children: e }) ] }); } @@ -38732,7 +38742,7 @@ const rA = Ta({ function Ey() { return Tn(rA); } -function uie(t) { +function fie(t) { const { config: e } = t, [r, n] = Yt(e.channel), [i, s] = Yt(e.device), [o, a] = Yt(e.app), [u, l] = Yt(e.role || "C"), [d, p] = Yt(e.inviterCode); return Dn(() => { n(e.channel), s(e.device), a(e.app), p(e.inviterCode), l(e.role || "C"); @@ -38750,33 +38760,33 @@ function uie(t) { } ); } -var fie = Object.defineProperty, lie = Object.defineProperties, hie = Object.getOwnPropertyDescriptors, k0 = Object.getOwnPropertySymbols, nA = Object.prototype.hasOwnProperty, iA = Object.prototype.propertyIsEnumerable, P5 = (t, e, r) => e in t ? fie(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, die = (t, e) => { +var lie = Object.defineProperty, hie = Object.defineProperties, die = Object.getOwnPropertyDescriptors, k0 = Object.getOwnPropertySymbols, nA = Object.prototype.hasOwnProperty, iA = Object.prototype.propertyIsEnumerable, P5 = (t, e, r) => e in t ? lie(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, pie = (t, e) => { for (var r in e || (e = {})) nA.call(e, r) && P5(t, r, e[r]); if (k0) for (var r of k0(e)) iA.call(e, r) && P5(t, r, e[r]); return t; -}, pie = (t, e) => lie(t, hie(e)), gie = (t, e) => { +}, gie = (t, e) => hie(t, die(e)), mie = (t, e) => { var r = {}; for (var n in t) nA.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); if (t != null && k0) for (var n of k0(t)) e.indexOf(n) < 0 && iA.call(t, n) && (r[n] = t[n]); return r; }; -function mie(t) { +function vie(t) { let e = setTimeout(t, 0), r = setTimeout(t, 10), n = setTimeout(t, 50); return [e, r, n]; } -function vie(t) { +function bie(t) { let e = Gt.useRef(); return Gt.useEffect(() => { e.current = t; }), e.current; } -var bie = 18, sA = 40, yie = `${sA}px`, wie = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(","); -function xie({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isFocused: n }) { +var yie = 18, sA = 40, wie = `${sA}px`, xie = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(","); +function _ie({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isFocused: n }) { let [i, s] = Gt.useState(!1), [o, a] = Gt.useState(!1), [u, l] = Gt.useState(!1), d = Gt.useMemo(() => r === "none" ? !1 : (r === "increase-width" || r === "experimental-no-flickering") && i && o, [i, o, r]), p = Gt.useCallback(() => { let w = t.current, _ = e.current; if (!w || !_ || u || r === "none") return; - let P = w, O = P.getBoundingClientRect().left + P.offsetWidth, L = P.getBoundingClientRect().top + P.offsetHeight / 2, B = O - bie, k = L; - document.querySelectorAll(wie).length === 0 && document.elementFromPoint(B, k) === w || (s(!0), l(!0)); + let P = w, O = P.getBoundingClientRect().left + P.offsetWidth, L = P.getBoundingClientRect().top + P.offsetHeight / 2, B = O - yie, k = L; + document.querySelectorAll(xie).length === 0 && document.elementFromPoint(B, k) === w || (s(!0), l(!0)); }, [t, e, u, r]); return Gt.useEffect(() => { let w = t.current; @@ -38799,13 +38809,13 @@ function xie({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isF return () => { clearTimeout(_), clearTimeout(P), clearTimeout(O), clearTimeout(L); }; - }, [e, n, r, p]), { hasPWMBadge: i, willPushPWMBadge: d, PWM_BADGE_SPACE_WIDTH: yie }; + }, [e, n, r, p]), { hasPWMBadge: i, willPushPWMBadge: d, PWM_BADGE_SPACE_WIDTH: wie }; } var oA = Gt.createContext({}), aA = Gt.forwardRef((t, e) => { - var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: u, inputMode: l = "numeric", onComplete: d, pushPasswordManagerStrategy: p = "increase-width", pasteTransformer: w, containerClassName: _, noScriptCSSFallback: P = _ie, render: O, children: L } = r, B = gie(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), k, q, U, V, Q; - let [R, K] = Gt.useState(typeof B.defaultValue == "string" ? B.defaultValue : ""), ge = n ?? R, Ee = vie(ge), Y = Gt.useCallback((ie) => { + var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: u, inputMode: l = "numeric", onComplete: d, pushPasswordManagerStrategy: p = "increase-width", pasteTransformer: w, containerClassName: _, noScriptCSSFallback: P = Eie, render: O, children: L } = r, B = mie(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), k, W, U, V, Q; + let [R, K] = Gt.useState(typeof B.defaultValue == "string" ? B.defaultValue : ""), ge = n ?? R, Ee = bie(ge), Y = Gt.useCallback((ie) => { i == null || i(ie), K(ie); - }, [i]), A = Gt.useMemo(() => a ? typeof a == "string" ? new RegExp(a) : a : null, [a]), m = Gt.useRef(null), f = Gt.useRef(null), g = Gt.useRef({ value: ge, onChange: Y, isIOS: typeof window < "u" && ((q = (k = window == null ? void 0 : window.CSS) == null ? void 0 : k.supports) == null ? void 0 : q.call(k, "-webkit-touch-callout", "none")) }), b = Gt.useRef({ prev: [(U = m.current) == null ? void 0 : U.selectionStart, (V = m.current) == null ? void 0 : V.selectionEnd, (Q = m.current) == null ? void 0 : Q.selectionDirection] }); + }, [i]), A = Gt.useMemo(() => a ? typeof a == "string" ? new RegExp(a) : a : null, [a]), m = Gt.useRef(null), f = Gt.useRef(null), g = Gt.useRef({ value: ge, onChange: Y, isIOS: typeof window < "u" && ((W = (k = window == null ? void 0 : window.CSS) == null ? void 0 : k.supports) == null ? void 0 : W.call(k, "-webkit-touch-callout", "none")) }), b = Gt.useRef({ prev: [(U = m.current) == null ? void 0 : U.selectionStart, (V = m.current) == null ? void 0 : V.selectionEnd, (Q = m.current) == null ? void 0 : Q.selectionDirection] }); Gt.useImperativeHandle(e, () => m.current, []), Gt.useEffect(() => { let ie = m.current, ue = f.current; if (!ie || !ue) return; @@ -38841,7 +38851,7 @@ var oA = Gt.createContext({}), aA = Gt.forwardRef((t, e) => { let Ce = document.createElement("style"); if (Ce.id = "input-otp-style", document.head.appendChild(Ce), Ce.sheet) { let $e = "background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;"; - zf(Ce.sheet, "[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"), zf(Ce.sheet, `[data-input-otp]:autofill { ${$e} }`), zf(Ce.sheet, `[data-input-otp]:-webkit-autofill { ${$e} }`), zf(Ce.sheet, "@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"), zf(Ce.sheet, "[data-input-otp] + * { pointer-events: all !important; }"); + Wf(Ce.sheet, "[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"), Wf(Ce.sheet, `[data-input-otp]:autofill { ${$e} }`), Wf(Ce.sheet, `[data-input-otp]:-webkit-autofill { ${$e} }`), Wf(Ce.sheet, "@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"), Wf(Ce.sheet, "[data-input-otp] + * { pointer-events: all !important; }"); } } let Pe = () => { @@ -38855,7 +38865,7 @@ var oA = Gt.createContext({}), aA = Gt.forwardRef((t, e) => { }, []); let [x, E] = Gt.useState(!1), [S, v] = Gt.useState(!1), [M, I] = Gt.useState(null), [F, ce] = Gt.useState(null); Gt.useEffect(() => { - mie(() => { + vie(() => { var ie, ue, ve, Pe; (ie = m.current) == null || ie.dispatchEvent(new Event("input")); let De = (ue = m.current) == null ? void 0 : ue.selectionStart, Ce = (ve = m.current) == null ? void 0 : ve.selectionEnd, $e = (Pe = m.current) == null ? void 0 : Pe.selectionDirection; @@ -38864,7 +38874,7 @@ var oA = Gt.createContext({}), aA = Gt.forwardRef((t, e) => { }, [ge, S]), Gt.useEffect(() => { Ee !== void 0 && ge !== Ee && Ee.length < s && ge.length === s && (d == null || d(ge)); }, [s, d, Ee, ge]); - let D = xie({ containerRef: f, inputRef: m, pushPasswordManagerStrategy: p, isFocused: S }), oe = Gt.useCallback((ie) => { + let D = _ie({ containerRef: f, inputRef: m, pushPasswordManagerStrategy: p, isFocused: S }), oe = Gt.useCallback((ie) => { let ue = ie.currentTarget.value.slice(0, s); if (ue.length > 0 && A && !A.test(ue)) { ie.preventDefault(); @@ -38889,7 +38899,7 @@ var oA = Gt.createContext({}), aA = Gt.forwardRef((t, e) => { Pe.value = Ne, Y(Ne); let Ke = Math.min(Ne.length, s - 1), Le = Ne.length; Pe.setSelectionRange(Ke, Le), I(Ke), ce(Le); - }, [s, Y, A, ge]), ee = Gt.useMemo(() => ({ position: "relative", cursor: B.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [B.disabled]), T = Gt.useMemo(() => ({ position: "absolute", inset: 0, width: D.willPushPWMBadge ? `calc(100% + ${D.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: D.willPushPWMBadge ? `inset(0 ${D.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: o, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [D.PWM_BADGE_SPACE_WIDTH, D.willPushPWMBadge, o]), X = Gt.useMemo(() => Gt.createElement("input", pie(die({ autoComplete: B.autoComplete || "one-time-code" }, B), { "data-input-otp": !0, "data-input-otp-placeholder-shown": ge.length === 0 || void 0, "data-input-otp-mss": M, "data-input-otp-mse": F, inputMode: l, pattern: A == null ? void 0 : A.source, "aria-placeholder": u, style: T, maxLength: s, value: ge, ref: m, onPaste: (ie) => { + }, [s, Y, A, ge]), ee = Gt.useMemo(() => ({ position: "relative", cursor: B.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [B.disabled]), T = Gt.useMemo(() => ({ position: "absolute", inset: 0, width: D.willPushPWMBadge ? `calc(100% + ${D.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: D.willPushPWMBadge ? `inset(0 ${D.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: o, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [D.PWM_BADGE_SPACE_WIDTH, D.willPushPWMBadge, o]), X = Gt.useMemo(() => Gt.createElement("input", gie(pie({ autoComplete: B.autoComplete || "one-time-code" }, B), { "data-input-otp": !0, "data-input-otp-placeholder-shown": ge.length === 0 || void 0, "data-input-otp-mss": M, "data-input-otp-mse": F, inputMode: l, pattern: A == null ? void 0 : A.source, "aria-placeholder": u, style: T, maxLength: s, value: ge, ref: m, onPaste: (ie) => { var ue; J(ie), (ue = B.onPaste) == null || ue.call(B, ie); }, onChange: oe, onMouseOver: (ie) => { @@ -38912,14 +38922,14 @@ var oA = Gt.createContext({}), aA = Gt.forwardRef((t, e) => { return Gt.createElement(Gt.Fragment, null, P !== null && Gt.createElement("noscript", null, Gt.createElement("style", null, P)), Gt.createElement("div", { ref: f, "data-input-otp-container": !0, style: ee, className: _ }, pe, Gt.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, X))); }); aA.displayName = "Input"; -function zf(t, e) { +function Wf(t, e) { try { t.insertRule(e); } catch { console.error("input-otp could not insert CSS rule:", e); } } -var _ie = ` +var Eie = ` [data-input-otp] { --nojs-bg: white !important; --nojs-fg: black !important; @@ -38974,7 +38984,7 @@ const nc = Gt.forwardRef(({ index: t, className: e, ...r }, n) => { ); }); nc.displayName = "InputOTPSlot"; -function Eie(t) { +function Sie(t) { const { spinning: e, children: r, className: n } = t; return /* @__PURE__ */ le.jsxs("div", { className: "xc-inline-block xc-relative", children: [ r, @@ -39004,12 +39014,12 @@ function fA(t) { u(); }, []), /* @__PURE__ */ le.jsxs(Rs, { children: [ /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ - /* @__PURE__ */ le.jsx(JZ, { className: "xc-mb-4", size: 60 }), + /* @__PURE__ */ le.jsx(XZ, { className: "xc-mb-4", size: 60 }), /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16", children: [ /* @__PURE__ */ le.jsx("p", { className: "xc-text-lg xc-mb-1", children: "We’ve sent a verification code to" }), /* @__PURE__ */ le.jsx("p", { className: "xc-font-bold xc-text-center", children: e }) ] }), - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-2 xc-h-12", children: /* @__PURE__ */ le.jsx(Eie, { spinning: i, className: "xc-rounded-xl", children: /* @__PURE__ */ le.jsx(cA, { maxLength: 6, onChange: l, disabled: i, className: "disabled:xc-opacity-20", children: /* @__PURE__ */ le.jsx(uA, { children: /* @__PURE__ */ le.jsxs("div", { className: $o("xc-flex xc-gap-2", i ? "xc-opacity-20" : ""), children: [ + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-2 xc-h-12", children: /* @__PURE__ */ le.jsx(Sie, { spinning: i, className: "xc-rounded-xl", children: /* @__PURE__ */ le.jsx(cA, { maxLength: 6, onChange: l, disabled: i, className: "disabled:xc-opacity-20", children: /* @__PURE__ */ le.jsx(uA, { children: /* @__PURE__ */ le.jsxs("div", { className: $o("xc-flex xc-gap-2", i ? "xc-opacity-20" : ""), children: [ /* @__PURE__ */ le.jsx(nc, { index: 0 }), /* @__PURE__ */ le.jsx(nc, { index: 1 }), /* @__PURE__ */ le.jsx(nc, { index: 2 }), @@ -39068,13 +39078,13 @@ function lA(t) { }; }, [e]), /* @__PURE__ */ le.jsxs(Rs, { children: [ /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ - /* @__PURE__ */ le.jsx(XZ, { className: "xc-mb-4", size: 60 }), + /* @__PURE__ */ le.jsx(ZZ, { className: "xc-mb-4", size: 60 }), /* @__PURE__ */ le.jsx("button", { className: "xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2", id: o, children: r ? /* @__PURE__ */ le.jsx(Sc, { className: "xc-animate-spin" }) : "I'm not a robot" }) ] }), i && /* @__PURE__ */ le.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ le.jsx("p", { children: i }) }) ] }); } -function Sie(t) { +function Aie(t) { const { email: e } = t, r = Ey(), [n, i] = Yt("captcha"); async function s(o, a) { const u = await ka.emailLogin({ @@ -39382,7 +39392,7 @@ var hA = { exports: {} }; throw "bad maskPattern:" + f; } }, O.getErrorCorrectPolynomial = function(f) { - for (var g = U([1], 0), b = 0; b < f; b += 1) g = g.multiply(U([1, q.gexp(b)], 0)); + for (var g = U([1], 0), b = 0; b < f; b += 1) g = g.multiply(U([1, W.gexp(b)], 0)); return g; }, O.getLengthInBits = function(f, g) { if (1 <= g && g < 10) switch (f) { @@ -39437,7 +39447,7 @@ var hA = { exports: {} }; var ce = 0; for (E = 0; E < g; E += 1) for (x = 0; x < g; x += 1) f.isDark(x, E) && (ce += 1); return b + Math.abs(100 * ce / g / g - 50) / 5 * 10; - }, O), q = function() { + }, O), W = function() { for (var f = new Array(256), g = new Array(256), b = 0; b < 8; b += 1) f[b] = 1 << b; for (b = 8; b < 256; b += 1) f[b] = f[b - 4] ^ f[b - 5] ^ f[b - 6] ^ f[b - 8]; for (b = 0; b < 255; b += 1) g[f[b]] = b; @@ -39461,12 +39471,12 @@ var hA = { exports: {} }; }, getLength: function() { return b.length; }, multiply: function(E) { - for (var S = new Array(x.getLength() + E.getLength() - 1), v = 0; v < x.getLength(); v += 1) for (var M = 0; M < E.getLength(); M += 1) S[v + M] ^= q.gexp(q.glog(x.getAt(v)) + q.glog(E.getAt(M))); + for (var S = new Array(x.getLength() + E.getLength() - 1), v = 0; v < x.getLength(); v += 1) for (var M = 0; M < E.getLength(); M += 1) S[v + M] ^= W.gexp(W.glog(x.getAt(v)) + W.glog(E.getAt(M))); return U(S, 0); }, mod: function(E) { if (x.getLength() - E.getLength() < 0) return x; - for (var S = q.glog(x.getAt(0)) - q.glog(E.getAt(0)), v = new Array(x.getLength()), M = 0; M < x.getLength(); M += 1) v[M] = x.getAt(M); - for (M = 0; M < E.getLength(); M += 1) v[M] ^= q.gexp(q.glog(E.getAt(M)) + S); + for (var S = W.glog(x.getAt(0)) - W.glog(E.getAt(0)), v = new Array(x.getLength()), M = 0; M < x.getLength(); M += 1) v[M] = x.getAt(M); + for (M = 0; M < E.getLength(); M += 1) v[M] ^= W.gexp(W.glog(E.getAt(M)) + S); return U(v, 0).mod(E); } }; return x; @@ -40090,9 +40100,9 @@ var hA = { exports: {} }; } } L.instanceCount = 0; - const B = L, k = "canvas", q = {}; - for (let A = 0; A <= 40; A++) q[A] = A; - const U = { type: k, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: q[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: !0, hideBackgroundDots: !0, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: !0 }, backgroundOptions: { round: 0, color: "#fff" } }; + const B = L, k = "canvas", W = {}; + for (let A = 0; A <= 40; A++) W[A] = A; + const U = { type: k, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: W[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: !0, hideBackgroundDots: !0, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: !0 }, backgroundOptions: { round: 0, color: "#fff" } }; function V(A) { const m = Object.assign({}, A); if (!m.colorStops || !m.colorStops.length) throw "Field 'colorStops' is required in gradient"; @@ -40212,8 +40222,8 @@ ${new this._window.XMLSerializer().serializeToString(f)}`; })(), s.default; })()); })(hA); -var Aie = hA.exports; -const dA = /* @__PURE__ */ ns(Aie); +var Pie = hA.exports; +const dA = /* @__PURE__ */ ns(Pie); class aa extends gt { constructor(e) { const { docsPath: r, field: n, metaMessages: i } = e; @@ -40227,7 +40237,7 @@ class aa extends gt { function M5(t) { if (/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t) || /%[^0-9a-f]/i.test(t) || /%[0-9a-f](:?[^0-9a-f]|$)/i.test(t)) return !1; - const e = Pie(t), r = e[1], n = e[2], i = e[3], s = e[4], o = e[5]; + const e = Mie(t), r = e[1], n = e[2], i = e[3], s = e[4], o = e[5]; if (!(r != null && r.length && i.length >= 0)) return !1; if (n != null && n.length) { @@ -40240,7 +40250,7 @@ function M5(t) { let a = ""; return a += `${r}:`, n != null && n.length && (a += `//${n}`), a += i, s != null && s.length && (a += `?${s}`), o != null && o.length && (a += `#${o}`), a; } -function Pie(t) { +function Mie(t) { return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/); } function pA(t) { @@ -40256,7 +40266,7 @@ function pA(t) { `Provided value: ${e}` ] }); - if (!(Mie.test(r) || Iie.test(r) || Cie.test(r))) + if (!(Iie.test(r) || Cie.test(r) || Tie.test(r))) throw new aa({ field: "domain", metaMessages: [ @@ -40266,7 +40276,7 @@ function pA(t) { `Provided value: ${r}` ] }); - if (!Tie.test(s)) + if (!Rie.test(s)) throw new aa({ field: "nonce", metaMessages: [ @@ -40295,7 +40305,7 @@ function pA(t) { `Provided value: ${p}` ] }); - if (l && !Rie.test(l)) + if (l && !Die.test(l)) throw new aa({ field: "scheme", metaMessages: [ @@ -40352,7 +40362,7 @@ Resources:`; return `${O} ${L}`; } -const Mie = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/, Iie = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/, Cie = /^localhost(:[0-9]{1,5})?$/, Tie = /^[a-zA-Z0-9]{8,}$/, Rie = /^([a-zA-Z][a-zA-Z0-9+-.]*)$/, gA = "7a4434fefbcc9af474fb5c995e47d286", Die = { +const Iie = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/, Cie = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/, Tie = /^localhost(:[0-9]{1,5})?$/, Rie = /^[a-zA-Z0-9]{8,}$/, Die = /^([a-zA-Z][a-zA-Z0-9+-.]*)$/, gA = "7a4434fefbcc9af474fb5c995e47d286", Oie = { projectId: gA, metadata: { name: "codatta", @@ -40360,7 +40370,7 @@ const Mie = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0- url: "https://codatta.io/", icons: ["https://avatars.githubusercontent.com/u/171659315"] } -}, Oie = { +}, Nie = { namespaces: { eip155: { methods: [ @@ -40379,7 +40389,7 @@ const Mie = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0- }, skipPairing: !1 }; -function Nie(t, e) { +function Lie(t, e) { const r = window.location.host, n = window.location.href; return pA({ address: t, @@ -40393,10 +40403,10 @@ function Nie(t, e) { function mA(t) { var ge, Ee, Y; const e = Qn(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Yt(""), [a, u] = Yt(!1), [l, d] = Yt(""), [p, w] = Yt("scan"), _ = Qn(), [P, O] = Yt((ge = r.config) == null ? void 0 : ge.image), [L, B] = Yt(!1), { saveLastUsedWallet: k } = Tp(); - async function q(A) { + async function W(A) { var f, g, b, x; u(!0); - const m = await yY.init(Die); + const m = await wY.init(Oie); m.session && await m.disconnect(); try { if (w("scan"), m.on("display_uri", (ce) => { @@ -40405,12 +40415,12 @@ function mA(t) { console.log(ce); }), m.on("session_update", (ce) => { console.log("session_update", ce); - }), !await m.connect(Oie)) throw new Error("Walletconnect init failed"); - const S = new Il(m); + }), !await m.connect(Nie)) throw new Error("Walletconnect init failed"); + const S = new yu(m); O(((f = S.config) == null ? void 0 : f.image) || ((g = A.config) == null ? void 0 : g.image)); const v = await S.getAddress(), M = await ka.getNonce({ account_type: "block_chain" }); console.log("get nonce", M); - const I = Nie(v, M); + const I = Lie(v, M); w("sign"); const F = await S.signMessage(I, v); w("waiting"), await i(S, { @@ -40419,7 +40429,7 @@ function mA(t) { signature: F, address: v, wallet_name: ((b = S.config) == null ? void 0 : b.name) || ((x = A.config) == null ? void 0 : x.name) || "" - }), k(S); + }), console.log("save wallet connect wallet!"), k(S); } catch (E) { console.log("err", E), d(E.details || E.message); } @@ -40452,12 +40462,12 @@ function mA(t) { Dn(() => { s && V(s); }, [s]), Dn(() => { - q(r); + W(r); }, [r]), Dn(() => { U(); }, []); function Q() { - d(""), V(""), q(r); + d(""), V(""), W(r); } function R() { B(!0), navigator.clipboard.writeText(s), setTimeout(() => { @@ -40485,10 +40495,10 @@ function mA(t) { className: "xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent", children: L ? /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ " ", - /* @__PURE__ */ le.jsx(KZ, {}), + /* @__PURE__ */ le.jsx(VZ, {}), " Copied!" ] }) : /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ - /* @__PURE__ */ le.jsx(YZ, {}), + /* @__PURE__ */ le.jsx(JZ, {}), "Copy QR URL" ] }) } @@ -40499,7 +40509,7 @@ function mA(t) { className: "xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black", onClick: n, children: [ - /* @__PURE__ */ le.jsx(VZ, {}), + /* @__PURE__ */ le.jsx(GZ, {}), "Get Extension" ] } @@ -40528,8 +40538,37 @@ function mA(t) { ] }) }) ] }); } -const Lie = "Accept connection request in the wallet", kie = "Accept sign-in request in your wallet"; -function $ie(t, e, r) { +const kie = /* @__PURE__ */ bL({ + id: 1, + name: "Ethereum", + nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }, + rpcUrls: { + default: { + http: ["https://eth.merkle.io"] + } + }, + blockExplorers: { + default: { + name: "Etherscan", + url: "https://etherscan.io", + apiUrl: "https://api.etherscan.io/api" + } + }, + contracts: { + ensRegistry: { + address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + }, + ensUniversalResolver: { + address: "0xce01f8eee7E479C928F8919abD53E553a36CeF67", + blockCreated: 19258213 + }, + multicall3: { + address: "0xca11bde05977b3631167028862be2a173976ca11", + blockCreated: 14353601 + } + } +}), $ie = "Accept connection request in the wallet", Bie = "Accept sign-in request in your wallet"; +function Fie(t, e, r) { const n = window.location.host, i = window.location.href; return pA({ address: t, @@ -40550,14 +40589,14 @@ function vA(t) { const O = await n.connect(); if (!O || O.length === 0) throw new Error("Wallet connect error"); - const L = await n.getChain(), B = l.find((Q) => Q.id === L), k = l[0]; - B || (console.log("switch chain", l[0]), a("switch-chain"), await n.switchChain(l[0])); - const q = Fv(O[0]), U = $ie(q, _, k.id); + const L = await n.getChain(), B = l.find((Q) => Q.id === L), k = B || l[0] || kie; + !B && l.length > 0 && (a("switch-chain"), await n.switchChain(k)); + const W = Fv(O[0]), U = Fie(W, _, k.id); a("sign"); - const V = await n.signMessage(U, q); + const V = await n.signMessage(U, W); if (!V || V.length === 0) throw new Error("user sign error"); - a("waiting"), await i(n, { address: q, signature: V, message: U, nonce: _, wallet_name: ((P = n.config) == null ? void 0 : P.name) || "" }), u(n); + a("waiting"), await i(n, { address: W, signature: V, message: U, nonce: _, wallet_name: ((P = n.config) == null ? void 0 : P.name) || "" }), u(n); } catch (O) { console.log("walletSignin error", O.stack), console.log(O.details || O.message), r(O.details || O.message); } @@ -40580,8 +40619,8 @@ function vA(t) { /* @__PURE__ */ le.jsx("div", { className: "xc-flex xc-gap-2", children: /* @__PURE__ */ le.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: p, children: "Retry" }) }) ] }), !e && /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ - o === "connect" && /* @__PURE__ */ le.jsx("span", { className: "xc-text-center", children: Lie }), - o === "sign" && /* @__PURE__ */ le.jsx("span", { className: "xc-text-center", children: kie }), + o === "connect" && /* @__PURE__ */ le.jsx("span", { className: "xc-text-center", children: $ie }), + o === "sign" && /* @__PURE__ */ le.jsx("span", { className: "xc-text-center", children: Bie }), o === "waiting" && /* @__PURE__ */ le.jsx("span", { className: "xc-text-center", children: /* @__PURE__ */ le.jsx(Sc, { className: "xc-animate-spin" }) }), o === "switch-chain" && /* @__PURE__ */ le.jsxs("span", { className: "xc-text-center", children: [ "Switch to ", @@ -40590,7 +40629,7 @@ function vA(t) { ] }) ] }); } -const iu = "https://static.codatta.io/codatta-connect/wallet-icons.svg", Bie = "https://itunes.apple.com/app/", Fie = "https://play.google.com/store/apps/details?id=", jie = "https://chromewebstore.google.com/detail/", Uie = "https://chromewebstore.google.com/detail/", qie = "https://addons.mozilla.org/en-US/firefox/addon/", zie = "https://microsoftedge.microsoft.com/addons/detail/"; +const iu = "https://static.codatta.io/codatta-connect/wallet-icons.svg", jie = "https://itunes.apple.com/app/", Uie = "https://play.google.com/store/apps/details?id=", qie = "https://chromewebstore.google.com/detail/", zie = "https://chromewebstore.google.com/detail/", Wie = "https://addons.mozilla.org/en-US/firefox/addon/", Hie = "https://microsoftedge.microsoft.com/addons/detail/"; function su(t) { const { icon: e, title: r, link: n } = t; return /* @__PURE__ */ le.jsxs( @@ -40607,7 +40646,7 @@ function su(t) { } ); } -function Wie(t) { +function Kie(t) { const e = { appStoreLink: "", playStoreLink: "", @@ -40616,11 +40655,11 @@ function Wie(t) { firefoxStoreLink: "", edgeStoreLink: "" }; - return t != null && t.app_store_id && (e.appStoreLink = `${Bie}${t.app_store_id}`), t != null && t.play_store_id && (e.playStoreLink = `${Fie}${t.play_store_id}`), t != null && t.chrome_store_id && (e.chromeStoreLink = `${jie}${t.chrome_store_id}`), t != null && t.brave_store_id && (e.braveStoreLink = `${Uie}${t.brave_store_id}`), t != null && t.firefox_addon_id && (e.firefoxStoreLink = `${qie}${t.firefox_addon_id}`), t != null && t.edge_addon_id && (e.edgeStoreLink = `${zie}${t.edge_addon_id}`), e; + return t != null && t.app_store_id && (e.appStoreLink = `${jie}${t.app_store_id}`), t != null && t.play_store_id && (e.playStoreLink = `${Uie}${t.play_store_id}`), t != null && t.chrome_store_id && (e.chromeStoreLink = `${qie}${t.chrome_store_id}`), t != null && t.brave_store_id && (e.braveStoreLink = `${zie}${t.brave_store_id}`), t != null && t.firefox_addon_id && (e.firefoxStoreLink = `${Wie}${t.firefox_addon_id}`), t != null && t.edge_addon_id && (e.edgeStoreLink = `${Hie}${t.edge_addon_id}`), e; } function bA(t) { var i, s, o; - const { wallet: e } = t, r = (i = e.config) == null ? void 0 : i.getWallet, n = Wie(r); + const { wallet: e } = t, r = (i = e.config) == null ? void 0 : i.getWallet, n = Kie(r); return /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-mb-2 xc-h-12 xc-w-12", src: (s = e.config) == null ? void 0 : s.image, alt: "" }), /* @__PURE__ */ le.jsxs("p", { className: "xc-text-lg xc-font-bold", children: [ @@ -40681,7 +40720,7 @@ function bA(t) { ] }) ] }); } -function Hie(t) { +function Vie(t) { const { wallet: e } = t, [r, n] = Yt(e.installed ? "connect" : "qr"), i = Ey(); async function s(o, a) { var l; @@ -40725,7 +40764,7 @@ function Hie(t) { r === "get-extension" && /* @__PURE__ */ le.jsx(bA, { wallet: e }) ] }); } -function Kie(t) { +function Gie(t) { const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: e.imageUrl }), i = e.name || ""; return /* @__PURE__ */ le.jsx(xy, { icon: n, title: i, onClick: () => r(e) }); } @@ -40750,7 +40789,7 @@ function yA(t) { /* @__PURE__ */ le.jsx(w7, { className: "xc-shrink-0 xc-opacity-50" }), /* @__PURE__ */ le.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: a }) ] }), - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: o == null ? void 0 : o.map((d) => /* @__PURE__ */ le.jsx(Kie, { wallet: d, onClick: l }, d.name)) }) + /* @__PURE__ */ le.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: o == null ? void 0 : o.map((d) => /* @__PURE__ */ le.jsx(Gie, { wallet: d, onClick: l }, d.name)) }) ] }); } var wA = { exports: {} }; @@ -40792,101 +40831,101 @@ var wA = { exports: {} }; }), e; }); })(wA); -var Vie = wA.exports; -const zl = /* @__PURE__ */ ns(Vie); +var Yie = wA.exports; +const zl = /* @__PURE__ */ ns(Yie); var xA = { exports: {} }; (function(t) { (function(e) { var r = function($) { - var z, H = new Float64Array(16); - if ($) for (z = 0; z < $.length; z++) H[z] = $[z]; + var q, H = new Float64Array(16); + if ($) for (q = 0; q < $.length; q++) H[q] = $[q]; return H; }, n = function() { throw new Error("no PRNG"); }, i = new Uint8Array(16), s = new Uint8Array(32); s[0] = 9; var o = r(), a = r([1]), u = r([56129, 1]), l = r([30883, 4953, 19914, 30187, 55467, 16705, 2637, 112, 59544, 30585, 16505, 36039, 65139, 11119, 27886, 20995]), d = r([61785, 9906, 39828, 60374, 45398, 33411, 5274, 224, 53552, 61171, 33010, 6542, 64743, 22239, 55772, 9222]), p = r([54554, 36645, 11616, 51542, 42930, 38181, 51040, 26924, 56412, 64982, 57905, 49316, 21502, 52590, 14035, 8553]), w = r([26200, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214]), _ = r([41136, 18958, 6951, 50414, 58488, 44335, 6150, 12099, 55207, 15867, 153, 11085, 57099, 20417, 9344, 11139]); - function P($, z, H, C) { - $[z] = H >> 24 & 255, $[z + 1] = H >> 16 & 255, $[z + 2] = H >> 8 & 255, $[z + 3] = H & 255, $[z + 4] = C >> 24 & 255, $[z + 5] = C >> 16 & 255, $[z + 6] = C >> 8 & 255, $[z + 7] = C & 255; + function P($, q, H, C) { + $[q] = H >> 24 & 255, $[q + 1] = H >> 16 & 255, $[q + 2] = H >> 8 & 255, $[q + 3] = H & 255, $[q + 4] = C >> 24 & 255, $[q + 5] = C >> 16 & 255, $[q + 6] = C >> 8 & 255, $[q + 7] = C & 255; } - function O($, z, H, C, G) { + function O($, q, H, C, G) { var j, se = 0; - for (j = 0; j < G; j++) se |= $[z + j] ^ H[C + j]; + for (j = 0; j < G; j++) se |= $[q + j] ^ H[C + j]; return (1 & se - 1 >>> 8) - 1; } - function L($, z, H, C) { - return O($, z, H, C, 16); + function L($, q, H, C) { + return O($, q, H, C, 16); } - function B($, z, H, C) { - return O($, z, H, C, 32); + function B($, q, H, C) { + return O($, q, H, C, 32); } - function k($, z, H, C) { - for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = H[0] & 255 | (H[1] & 255) << 8 | (H[2] & 255) << 16 | (H[3] & 255) << 24, se = H[4] & 255 | (H[5] & 255) << 8 | (H[6] & 255) << 16 | (H[7] & 255) << 24, de = H[8] & 255 | (H[9] & 255) << 8 | (H[10] & 255) << 16 | (H[11] & 255) << 24, xe = H[12] & 255 | (H[13] & 255) << 8 | (H[14] & 255) << 16 | (H[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = z[0] & 255 | (z[1] & 255) << 8 | (z[2] & 255) << 16 | (z[3] & 255) << 24, nt = z[4] & 255 | (z[5] & 255) << 8 | (z[6] & 255) << 16 | (z[7] & 255) << 24, je = z[8] & 255 | (z[9] & 255) << 8 | (z[10] & 255) << 16 | (z[11] & 255) << 24, pt = z[12] & 255 | (z[13] & 255) << 8 | (z[14] & 255) << 16 | (z[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = H[16] & 255 | (H[17] & 255) << 8 | (H[18] & 255) << 16 | (H[19] & 255) << 24, St = H[20] & 255 | (H[21] & 255) << 8 | (H[22] & 255) << 16 | (H[23] & 255) << 24, Tt = H[24] & 255 | (H[25] & 255) << 8 | (H[26] & 255) << 16 | (H[27] & 255) << 24, At = H[28] & 255 | (H[29] & 255) << 8 | (H[30] & 255) << 16 | (H[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, yt = de, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, he, rr = 0; rr < 20; rr += 2) + function k($, q, H, C) { + for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = H[0] & 255 | (H[1] & 255) << 8 | (H[2] & 255) << 16 | (H[3] & 255) << 24, se = H[4] & 255 | (H[5] & 255) << 8 | (H[6] & 255) << 16 | (H[7] & 255) << 24, de = H[8] & 255 | (H[9] & 255) << 8 | (H[10] & 255) << 16 | (H[11] & 255) << 24, xe = H[12] & 255 | (H[13] & 255) << 8 | (H[14] & 255) << 16 | (H[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = q[0] & 255 | (q[1] & 255) << 8 | (q[2] & 255) << 16 | (q[3] & 255) << 24, nt = q[4] & 255 | (q[5] & 255) << 8 | (q[6] & 255) << 16 | (q[7] & 255) << 24, je = q[8] & 255 | (q[9] & 255) << 8 | (q[10] & 255) << 16 | (q[11] & 255) << 24, pt = q[12] & 255 | (q[13] & 255) << 8 | (q[14] & 255) << 16 | (q[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = H[16] & 255 | (H[17] & 255) << 8 | (H[18] & 255) << 16 | (H[19] & 255) << 24, St = H[20] & 255 | (H[21] & 255) << 8 | (H[22] & 255) << 16 | (H[23] & 255) << 24, Tt = H[24] & 255 | (H[25] & 255) << 8 | (H[26] & 255) << 16 | (H[27] & 255) << 24, At = H[28] & 255 | (H[29] & 255) << 8 | (H[30] & 255) << 16 | (H[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, yt = de, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, he, rr = 0; rr < 20; rr += 2) he = ht + Lt | 0, ut ^= he << 7 | he >>> 25, he = ut + ht | 0, Ve ^= he << 9 | he >>> 23, he = Ve + ut | 0, Lt ^= he << 13 | he >>> 19, he = Lt + Ve | 0, ht ^= he << 18 | he >>> 14, he = ot + xt | 0, Fe ^= he << 7 | he >>> 25, he = Fe + ot | 0, zt ^= he << 9 | he >>> 23, he = zt + Fe | 0, xt ^= he << 13 | he >>> 19, he = xt + zt | 0, ot ^= he << 18 | he >>> 14, he = Ue + Se | 0, Zt ^= he << 7 | he >>> 25, he = Zt + Ue | 0, st ^= he << 9 | he >>> 23, he = st + Zt | 0, Se ^= he << 13 | he >>> 19, he = Se + st | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Je | 0, yt ^= he << 7 | he >>> 25, he = yt + Wt | 0, Ae ^= he << 9 | he >>> 23, he = Ae + yt | 0, Je ^= he << 13 | he >>> 19, he = Je + Ae | 0, Wt ^= he << 18 | he >>> 14, he = ht + yt | 0, xt ^= he << 7 | he >>> 25, he = xt + ht | 0, st ^= he << 9 | he >>> 23, he = st + xt | 0, yt ^= he << 13 | he >>> 19, he = yt + st | 0, ht ^= he << 18 | he >>> 14, he = ot + ut | 0, Se ^= he << 7 | he >>> 25, he = Se + ot | 0, Ae ^= he << 9 | he >>> 23, he = Ae + Se | 0, ut ^= he << 13 | he >>> 19, he = ut + Ae | 0, ot ^= he << 18 | he >>> 14, he = Ue + Fe | 0, Je ^= he << 7 | he >>> 25, he = Je + Ue | 0, Ve ^= he << 9 | he >>> 23, he = Ve + Je | 0, Fe ^= he << 13 | he >>> 19, he = Fe + Ve | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Zt | 0, Lt ^= he << 7 | he >>> 25, he = Lt + Wt | 0, zt ^= he << 9 | he >>> 23, he = zt + Lt | 0, Zt ^= he << 13 | he >>> 19, he = Zt + zt | 0, Wt ^= he << 18 | he >>> 14; ht = ht + G | 0, xt = xt + j | 0, st = st + se | 0, yt = yt + de | 0, ut = ut + xe | 0, ot = ot + Te | 0, Se = Se + Re | 0, Ae = Ae + nt | 0, Ve = Ve + je | 0, Fe = Fe + pt | 0, Ue = Ue + it | 0, Je = Je + et | 0, Lt = Lt + St | 0, zt = zt + Tt | 0, Zt = Zt + At | 0, Wt = Wt + _t | 0, $[0] = ht >>> 0 & 255, $[1] = ht >>> 8 & 255, $[2] = ht >>> 16 & 255, $[3] = ht >>> 24 & 255, $[4] = xt >>> 0 & 255, $[5] = xt >>> 8 & 255, $[6] = xt >>> 16 & 255, $[7] = xt >>> 24 & 255, $[8] = st >>> 0 & 255, $[9] = st >>> 8 & 255, $[10] = st >>> 16 & 255, $[11] = st >>> 24 & 255, $[12] = yt >>> 0 & 255, $[13] = yt >>> 8 & 255, $[14] = yt >>> 16 & 255, $[15] = yt >>> 24 & 255, $[16] = ut >>> 0 & 255, $[17] = ut >>> 8 & 255, $[18] = ut >>> 16 & 255, $[19] = ut >>> 24 & 255, $[20] = ot >>> 0 & 255, $[21] = ot >>> 8 & 255, $[22] = ot >>> 16 & 255, $[23] = ot >>> 24 & 255, $[24] = Se >>> 0 & 255, $[25] = Se >>> 8 & 255, $[26] = Se >>> 16 & 255, $[27] = Se >>> 24 & 255, $[28] = Ae >>> 0 & 255, $[29] = Ae >>> 8 & 255, $[30] = Ae >>> 16 & 255, $[31] = Ae >>> 24 & 255, $[32] = Ve >>> 0 & 255, $[33] = Ve >>> 8 & 255, $[34] = Ve >>> 16 & 255, $[35] = Ve >>> 24 & 255, $[36] = Fe >>> 0 & 255, $[37] = Fe >>> 8 & 255, $[38] = Fe >>> 16 & 255, $[39] = Fe >>> 24 & 255, $[40] = Ue >>> 0 & 255, $[41] = Ue >>> 8 & 255, $[42] = Ue >>> 16 & 255, $[43] = Ue >>> 24 & 255, $[44] = Je >>> 0 & 255, $[45] = Je >>> 8 & 255, $[46] = Je >>> 16 & 255, $[47] = Je >>> 24 & 255, $[48] = Lt >>> 0 & 255, $[49] = Lt >>> 8 & 255, $[50] = Lt >>> 16 & 255, $[51] = Lt >>> 24 & 255, $[52] = zt >>> 0 & 255, $[53] = zt >>> 8 & 255, $[54] = zt >>> 16 & 255, $[55] = zt >>> 24 & 255, $[56] = Zt >>> 0 & 255, $[57] = Zt >>> 8 & 255, $[58] = Zt >>> 16 & 255, $[59] = Zt >>> 24 & 255, $[60] = Wt >>> 0 & 255, $[61] = Wt >>> 8 & 255, $[62] = Wt >>> 16 & 255, $[63] = Wt >>> 24 & 255; } - function q($, z, H, C) { - for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = H[0] & 255 | (H[1] & 255) << 8 | (H[2] & 255) << 16 | (H[3] & 255) << 24, se = H[4] & 255 | (H[5] & 255) << 8 | (H[6] & 255) << 16 | (H[7] & 255) << 24, de = H[8] & 255 | (H[9] & 255) << 8 | (H[10] & 255) << 16 | (H[11] & 255) << 24, xe = H[12] & 255 | (H[13] & 255) << 8 | (H[14] & 255) << 16 | (H[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = z[0] & 255 | (z[1] & 255) << 8 | (z[2] & 255) << 16 | (z[3] & 255) << 24, nt = z[4] & 255 | (z[5] & 255) << 8 | (z[6] & 255) << 16 | (z[7] & 255) << 24, je = z[8] & 255 | (z[9] & 255) << 8 | (z[10] & 255) << 16 | (z[11] & 255) << 24, pt = z[12] & 255 | (z[13] & 255) << 8 | (z[14] & 255) << 16 | (z[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = H[16] & 255 | (H[17] & 255) << 8 | (H[18] & 255) << 16 | (H[19] & 255) << 24, St = H[20] & 255 | (H[21] & 255) << 8 | (H[22] & 255) << 16 | (H[23] & 255) << 24, Tt = H[24] & 255 | (H[25] & 255) << 8 | (H[26] & 255) << 16 | (H[27] & 255) << 24, At = H[28] & 255 | (H[29] & 255) << 8 | (H[30] & 255) << 16 | (H[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, yt = de, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, he, rr = 0; rr < 20; rr += 2) + function W($, q, H, C) { + for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = H[0] & 255 | (H[1] & 255) << 8 | (H[2] & 255) << 16 | (H[3] & 255) << 24, se = H[4] & 255 | (H[5] & 255) << 8 | (H[6] & 255) << 16 | (H[7] & 255) << 24, de = H[8] & 255 | (H[9] & 255) << 8 | (H[10] & 255) << 16 | (H[11] & 255) << 24, xe = H[12] & 255 | (H[13] & 255) << 8 | (H[14] & 255) << 16 | (H[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = q[0] & 255 | (q[1] & 255) << 8 | (q[2] & 255) << 16 | (q[3] & 255) << 24, nt = q[4] & 255 | (q[5] & 255) << 8 | (q[6] & 255) << 16 | (q[7] & 255) << 24, je = q[8] & 255 | (q[9] & 255) << 8 | (q[10] & 255) << 16 | (q[11] & 255) << 24, pt = q[12] & 255 | (q[13] & 255) << 8 | (q[14] & 255) << 16 | (q[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = H[16] & 255 | (H[17] & 255) << 8 | (H[18] & 255) << 16 | (H[19] & 255) << 24, St = H[20] & 255 | (H[21] & 255) << 8 | (H[22] & 255) << 16 | (H[23] & 255) << 24, Tt = H[24] & 255 | (H[25] & 255) << 8 | (H[26] & 255) << 16 | (H[27] & 255) << 24, At = H[28] & 255 | (H[29] & 255) << 8 | (H[30] & 255) << 16 | (H[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, yt = de, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, he, rr = 0; rr < 20; rr += 2) he = ht + Lt | 0, ut ^= he << 7 | he >>> 25, he = ut + ht | 0, Ve ^= he << 9 | he >>> 23, he = Ve + ut | 0, Lt ^= he << 13 | he >>> 19, he = Lt + Ve | 0, ht ^= he << 18 | he >>> 14, he = ot + xt | 0, Fe ^= he << 7 | he >>> 25, he = Fe + ot | 0, zt ^= he << 9 | he >>> 23, he = zt + Fe | 0, xt ^= he << 13 | he >>> 19, he = xt + zt | 0, ot ^= he << 18 | he >>> 14, he = Ue + Se | 0, Zt ^= he << 7 | he >>> 25, he = Zt + Ue | 0, st ^= he << 9 | he >>> 23, he = st + Zt | 0, Se ^= he << 13 | he >>> 19, he = Se + st | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Je | 0, yt ^= he << 7 | he >>> 25, he = yt + Wt | 0, Ae ^= he << 9 | he >>> 23, he = Ae + yt | 0, Je ^= he << 13 | he >>> 19, he = Je + Ae | 0, Wt ^= he << 18 | he >>> 14, he = ht + yt | 0, xt ^= he << 7 | he >>> 25, he = xt + ht | 0, st ^= he << 9 | he >>> 23, he = st + xt | 0, yt ^= he << 13 | he >>> 19, he = yt + st | 0, ht ^= he << 18 | he >>> 14, he = ot + ut | 0, Se ^= he << 7 | he >>> 25, he = Se + ot | 0, Ae ^= he << 9 | he >>> 23, he = Ae + Se | 0, ut ^= he << 13 | he >>> 19, he = ut + Ae | 0, ot ^= he << 18 | he >>> 14, he = Ue + Fe | 0, Je ^= he << 7 | he >>> 25, he = Je + Ue | 0, Ve ^= he << 9 | he >>> 23, he = Ve + Je | 0, Fe ^= he << 13 | he >>> 19, he = Fe + Ve | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Zt | 0, Lt ^= he << 7 | he >>> 25, he = Lt + Wt | 0, zt ^= he << 9 | he >>> 23, he = zt + Lt | 0, Zt ^= he << 13 | he >>> 19, he = Zt + zt | 0, Wt ^= he << 18 | he >>> 14; $[0] = ht >>> 0 & 255, $[1] = ht >>> 8 & 255, $[2] = ht >>> 16 & 255, $[3] = ht >>> 24 & 255, $[4] = ot >>> 0 & 255, $[5] = ot >>> 8 & 255, $[6] = ot >>> 16 & 255, $[7] = ot >>> 24 & 255, $[8] = Ue >>> 0 & 255, $[9] = Ue >>> 8 & 255, $[10] = Ue >>> 16 & 255, $[11] = Ue >>> 24 & 255, $[12] = Wt >>> 0 & 255, $[13] = Wt >>> 8 & 255, $[14] = Wt >>> 16 & 255, $[15] = Wt >>> 24 & 255, $[16] = Se >>> 0 & 255, $[17] = Se >>> 8 & 255, $[18] = Se >>> 16 & 255, $[19] = Se >>> 24 & 255, $[20] = Ae >>> 0 & 255, $[21] = Ae >>> 8 & 255, $[22] = Ae >>> 16 & 255, $[23] = Ae >>> 24 & 255, $[24] = Ve >>> 0 & 255, $[25] = Ve >>> 8 & 255, $[26] = Ve >>> 16 & 255, $[27] = Ve >>> 24 & 255, $[28] = Fe >>> 0 & 255, $[29] = Fe >>> 8 & 255, $[30] = Fe >>> 16 & 255, $[31] = Fe >>> 24 & 255; } - function U($, z, H, C) { - k($, z, H, C); + function U($, q, H, C) { + k($, q, H, C); } - function V($, z, H, C) { - q($, z, H, C); + function V($, q, H, C) { + W($, q, H, C); } var Q = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); - function R($, z, H, C, G, j, se) { + function R($, q, H, C, G, j, se) { var de = new Uint8Array(16), xe = new Uint8Array(64), Te, Re; for (Re = 0; Re < 16; Re++) de[Re] = 0; for (Re = 0; Re < 8; Re++) de[Re] = j[Re]; for (; G >= 64; ) { - for (U(xe, de, se, Q), Re = 0; Re < 64; Re++) $[z + Re] = H[C + Re] ^ xe[Re]; + for (U(xe, de, se, Q), Re = 0; Re < 64; Re++) $[q + Re] = H[C + Re] ^ xe[Re]; for (Te = 1, Re = 8; Re < 16; Re++) Te = Te + (de[Re] & 255) | 0, de[Re] = Te & 255, Te >>>= 8; - G -= 64, z += 64, C += 64; + G -= 64, q += 64, C += 64; } if (G > 0) - for (U(xe, de, se, Q), Re = 0; Re < G; Re++) $[z + Re] = H[C + Re] ^ xe[Re]; + for (U(xe, de, se, Q), Re = 0; Re < G; Re++) $[q + Re] = H[C + Re] ^ xe[Re]; return 0; } - function K($, z, H, C, G) { + function K($, q, H, C, G) { var j = new Uint8Array(16), se = new Uint8Array(64), de, xe; for (xe = 0; xe < 16; xe++) j[xe] = 0; for (xe = 0; xe < 8; xe++) j[xe] = C[xe]; for (; H >= 64; ) { - for (U(se, j, G, Q), xe = 0; xe < 64; xe++) $[z + xe] = se[xe]; + for (U(se, j, G, Q), xe = 0; xe < 64; xe++) $[q + xe] = se[xe]; for (de = 1, xe = 8; xe < 16; xe++) de = de + (j[xe] & 255) | 0, j[xe] = de & 255, de >>>= 8; - H -= 64, z += 64; + H -= 64, q += 64; } if (H > 0) - for (U(se, j, G, Q), xe = 0; xe < H; xe++) $[z + xe] = se[xe]; + for (U(se, j, G, Q), xe = 0; xe < H; xe++) $[q + xe] = se[xe]; return 0; } - function ge($, z, H, C, G) { + function ge($, q, H, C, G) { var j = new Uint8Array(32); V(j, C, G, Q); for (var se = new Uint8Array(8), de = 0; de < 8; de++) se[de] = C[de + 16]; - return K($, z, H, se, j); + return K($, q, H, se, j); } - function Ee($, z, H, C, G, j, se) { + function Ee($, q, H, C, G, j, se) { var de = new Uint8Array(32); V(de, j, se, Q); for (var xe = new Uint8Array(8), Te = 0; Te < 8; Te++) xe[Te] = j[Te + 16]; - return R($, z, H, C, G, xe, de); + return R($, q, H, C, G, xe, de); } var Y = function($) { this.buffer = new Uint8Array(16), this.r = new Uint16Array(10), this.h = new Uint16Array(10), this.pad = new Uint16Array(8), this.leftover = 0, this.fin = 0; - var z, H, C, G, j, se, de, xe; - z = $[0] & 255 | ($[1] & 255) << 8, this.r[0] = z & 8191, H = $[2] & 255 | ($[3] & 255) << 8, this.r[1] = (z >>> 13 | H << 3) & 8191, C = $[4] & 255 | ($[5] & 255) << 8, this.r[2] = (H >>> 10 | C << 6) & 7939, G = $[6] & 255 | ($[7] & 255) << 8, this.r[3] = (C >>> 7 | G << 9) & 8191, j = $[8] & 255 | ($[9] & 255) << 8, this.r[4] = (G >>> 4 | j << 12) & 255, this.r[5] = j >>> 1 & 8190, se = $[10] & 255 | ($[11] & 255) << 8, this.r[6] = (j >>> 14 | se << 2) & 8191, de = $[12] & 255 | ($[13] & 255) << 8, this.r[7] = (se >>> 11 | de << 5) & 8065, xe = $[14] & 255 | ($[15] & 255) << 8, this.r[8] = (de >>> 8 | xe << 8) & 8191, this.r[9] = xe >>> 5 & 127, this.pad[0] = $[16] & 255 | ($[17] & 255) << 8, this.pad[1] = $[18] & 255 | ($[19] & 255) << 8, this.pad[2] = $[20] & 255 | ($[21] & 255) << 8, this.pad[3] = $[22] & 255 | ($[23] & 255) << 8, this.pad[4] = $[24] & 255 | ($[25] & 255) << 8, this.pad[5] = $[26] & 255 | ($[27] & 255) << 8, this.pad[6] = $[28] & 255 | ($[29] & 255) << 8, this.pad[7] = $[30] & 255 | ($[31] & 255) << 8; + var q, H, C, G, j, se, de, xe; + q = $[0] & 255 | ($[1] & 255) << 8, this.r[0] = q & 8191, H = $[2] & 255 | ($[3] & 255) << 8, this.r[1] = (q >>> 13 | H << 3) & 8191, C = $[4] & 255 | ($[5] & 255) << 8, this.r[2] = (H >>> 10 | C << 6) & 7939, G = $[6] & 255 | ($[7] & 255) << 8, this.r[3] = (C >>> 7 | G << 9) & 8191, j = $[8] & 255 | ($[9] & 255) << 8, this.r[4] = (G >>> 4 | j << 12) & 255, this.r[5] = j >>> 1 & 8190, se = $[10] & 255 | ($[11] & 255) << 8, this.r[6] = (j >>> 14 | se << 2) & 8191, de = $[12] & 255 | ($[13] & 255) << 8, this.r[7] = (se >>> 11 | de << 5) & 8065, xe = $[14] & 255 | ($[15] & 255) << 8, this.r[8] = (de >>> 8 | xe << 8) & 8191, this.r[9] = xe >>> 5 & 127, this.pad[0] = $[16] & 255 | ($[17] & 255) << 8, this.pad[1] = $[18] & 255 | ($[19] & 255) << 8, this.pad[2] = $[20] & 255 | ($[21] & 255) << 8, this.pad[3] = $[22] & 255 | ($[23] & 255) << 8, this.pad[4] = $[24] & 255 | ($[25] & 255) << 8, this.pad[5] = $[26] & 255 | ($[27] & 255) << 8, this.pad[6] = $[28] & 255 | ($[29] & 255) << 8, this.pad[7] = $[30] & 255 | ($[31] & 255) << 8; }; - Y.prototype.blocks = function($, z, H) { + Y.prototype.blocks = function($, q, H) { for (var C = this.fin ? 0 : 2048, G, j, se, de, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, yt = this.h[0], ut = this.h[1], ot = this.h[2], Se = this.h[3], Ae = this.h[4], Ve = this.h[5], Fe = this.h[6], Ue = this.h[7], Je = this.h[8], Lt = this.h[9], zt = this.r[0], Zt = this.r[1], Wt = this.r[2], he = this.r[3], rr = this.r[4], dr = this.r[5], pr = this.r[6], Qt = this.r[7], gr = this.r[8], lr = this.r[9]; H >= 16; ) - G = $[z + 0] & 255 | ($[z + 1] & 255) << 8, yt += G & 8191, j = $[z + 2] & 255 | ($[z + 3] & 255) << 8, ut += (G >>> 13 | j << 3) & 8191, se = $[z + 4] & 255 | ($[z + 5] & 255) << 8, ot += (j >>> 10 | se << 6) & 8191, de = $[z + 6] & 255 | ($[z + 7] & 255) << 8, Se += (se >>> 7 | de << 9) & 8191, xe = $[z + 8] & 255 | ($[z + 9] & 255) << 8, Ae += (de >>> 4 | xe << 12) & 8191, Ve += xe >>> 1 & 8191, Te = $[z + 10] & 255 | ($[z + 11] & 255) << 8, Fe += (xe >>> 14 | Te << 2) & 8191, Re = $[z + 12] & 255 | ($[z + 13] & 255) << 8, Ue += (Te >>> 11 | Re << 5) & 8191, nt = $[z + 14] & 255 | ($[z + 15] & 255) << 8, Je += (Re >>> 8 | nt << 8) & 8191, Lt += nt >>> 5 | C, je = 0, pt = je, pt += yt * zt, pt += ut * (5 * lr), pt += ot * (5 * gr), pt += Se * (5 * Qt), pt += Ae * (5 * pr), je = pt >>> 13, pt &= 8191, pt += Ve * (5 * dr), pt += Fe * (5 * rr), pt += Ue * (5 * he), pt += Je * (5 * Wt), pt += Lt * (5 * Zt), je += pt >>> 13, pt &= 8191, it = je, it += yt * Zt, it += ut * zt, it += ot * (5 * lr), it += Se * (5 * gr), it += Ae * (5 * Qt), je = it >>> 13, it &= 8191, it += Ve * (5 * pr), it += Fe * (5 * dr), it += Ue * (5 * rr), it += Je * (5 * he), it += Lt * (5 * Wt), je += it >>> 13, it &= 8191, et = je, et += yt * Wt, et += ut * Zt, et += ot * zt, et += Se * (5 * lr), et += Ae * (5 * gr), je = et >>> 13, et &= 8191, et += Ve * (5 * Qt), et += Fe * (5 * pr), et += Ue * (5 * dr), et += Je * (5 * rr), et += Lt * (5 * he), je += et >>> 13, et &= 8191, St = je, St += yt * he, St += ut * Wt, St += ot * Zt, St += Se * zt, St += Ae * (5 * lr), je = St >>> 13, St &= 8191, St += Ve * (5 * gr), St += Fe * (5 * Qt), St += Ue * (5 * pr), St += Je * (5 * dr), St += Lt * (5 * rr), je += St >>> 13, St &= 8191, Tt = je, Tt += yt * rr, Tt += ut * he, Tt += ot * Wt, Tt += Se * Zt, Tt += Ae * zt, je = Tt >>> 13, Tt &= 8191, Tt += Ve * (5 * lr), Tt += Fe * (5 * gr), Tt += Ue * (5 * Qt), Tt += Je * (5 * pr), Tt += Lt * (5 * dr), je += Tt >>> 13, Tt &= 8191, At = je, At += yt * dr, At += ut * rr, At += ot * he, At += Se * Wt, At += Ae * Zt, je = At >>> 13, At &= 8191, At += Ve * zt, At += Fe * (5 * lr), At += Ue * (5 * gr), At += Je * (5 * Qt), At += Lt * (5 * pr), je += At >>> 13, At &= 8191, _t = je, _t += yt * pr, _t += ut * dr, _t += ot * rr, _t += Se * he, _t += Ae * Wt, je = _t >>> 13, _t &= 8191, _t += Ve * Zt, _t += Fe * zt, _t += Ue * (5 * lr), _t += Je * (5 * gr), _t += Lt * (5 * Qt), je += _t >>> 13, _t &= 8191, ht = je, ht += yt * Qt, ht += ut * pr, ht += ot * dr, ht += Se * rr, ht += Ae * he, je = ht >>> 13, ht &= 8191, ht += Ve * Wt, ht += Fe * Zt, ht += Ue * zt, ht += Je * (5 * lr), ht += Lt * (5 * gr), je += ht >>> 13, ht &= 8191, xt = je, xt += yt * gr, xt += ut * Qt, xt += ot * pr, xt += Se * dr, xt += Ae * rr, je = xt >>> 13, xt &= 8191, xt += Ve * he, xt += Fe * Wt, xt += Ue * Zt, xt += Je * zt, xt += Lt * (5 * lr), je += xt >>> 13, xt &= 8191, st = je, st += yt * lr, st += ut * gr, st += ot * Qt, st += Se * pr, st += Ae * dr, je = st >>> 13, st &= 8191, st += Ve * rr, st += Fe * he, st += Ue * Wt, st += Je * Zt, st += Lt * zt, je += st >>> 13, st &= 8191, je = (je << 2) + je | 0, je = je + pt | 0, pt = je & 8191, je = je >>> 13, it += je, yt = pt, ut = it, ot = et, Se = St, Ae = Tt, Ve = At, Fe = _t, Ue = ht, Je = xt, Lt = st, z += 16, H -= 16; + G = $[q + 0] & 255 | ($[q + 1] & 255) << 8, yt += G & 8191, j = $[q + 2] & 255 | ($[q + 3] & 255) << 8, ut += (G >>> 13 | j << 3) & 8191, se = $[q + 4] & 255 | ($[q + 5] & 255) << 8, ot += (j >>> 10 | se << 6) & 8191, de = $[q + 6] & 255 | ($[q + 7] & 255) << 8, Se += (se >>> 7 | de << 9) & 8191, xe = $[q + 8] & 255 | ($[q + 9] & 255) << 8, Ae += (de >>> 4 | xe << 12) & 8191, Ve += xe >>> 1 & 8191, Te = $[q + 10] & 255 | ($[q + 11] & 255) << 8, Fe += (xe >>> 14 | Te << 2) & 8191, Re = $[q + 12] & 255 | ($[q + 13] & 255) << 8, Ue += (Te >>> 11 | Re << 5) & 8191, nt = $[q + 14] & 255 | ($[q + 15] & 255) << 8, Je += (Re >>> 8 | nt << 8) & 8191, Lt += nt >>> 5 | C, je = 0, pt = je, pt += yt * zt, pt += ut * (5 * lr), pt += ot * (5 * gr), pt += Se * (5 * Qt), pt += Ae * (5 * pr), je = pt >>> 13, pt &= 8191, pt += Ve * (5 * dr), pt += Fe * (5 * rr), pt += Ue * (5 * he), pt += Je * (5 * Wt), pt += Lt * (5 * Zt), je += pt >>> 13, pt &= 8191, it = je, it += yt * Zt, it += ut * zt, it += ot * (5 * lr), it += Se * (5 * gr), it += Ae * (5 * Qt), je = it >>> 13, it &= 8191, it += Ve * (5 * pr), it += Fe * (5 * dr), it += Ue * (5 * rr), it += Je * (5 * he), it += Lt * (5 * Wt), je += it >>> 13, it &= 8191, et = je, et += yt * Wt, et += ut * Zt, et += ot * zt, et += Se * (5 * lr), et += Ae * (5 * gr), je = et >>> 13, et &= 8191, et += Ve * (5 * Qt), et += Fe * (5 * pr), et += Ue * (5 * dr), et += Je * (5 * rr), et += Lt * (5 * he), je += et >>> 13, et &= 8191, St = je, St += yt * he, St += ut * Wt, St += ot * Zt, St += Se * zt, St += Ae * (5 * lr), je = St >>> 13, St &= 8191, St += Ve * (5 * gr), St += Fe * (5 * Qt), St += Ue * (5 * pr), St += Je * (5 * dr), St += Lt * (5 * rr), je += St >>> 13, St &= 8191, Tt = je, Tt += yt * rr, Tt += ut * he, Tt += ot * Wt, Tt += Se * Zt, Tt += Ae * zt, je = Tt >>> 13, Tt &= 8191, Tt += Ve * (5 * lr), Tt += Fe * (5 * gr), Tt += Ue * (5 * Qt), Tt += Je * (5 * pr), Tt += Lt * (5 * dr), je += Tt >>> 13, Tt &= 8191, At = je, At += yt * dr, At += ut * rr, At += ot * he, At += Se * Wt, At += Ae * Zt, je = At >>> 13, At &= 8191, At += Ve * zt, At += Fe * (5 * lr), At += Ue * (5 * gr), At += Je * (5 * Qt), At += Lt * (5 * pr), je += At >>> 13, At &= 8191, _t = je, _t += yt * pr, _t += ut * dr, _t += ot * rr, _t += Se * he, _t += Ae * Wt, je = _t >>> 13, _t &= 8191, _t += Ve * Zt, _t += Fe * zt, _t += Ue * (5 * lr), _t += Je * (5 * gr), _t += Lt * (5 * Qt), je += _t >>> 13, _t &= 8191, ht = je, ht += yt * Qt, ht += ut * pr, ht += ot * dr, ht += Se * rr, ht += Ae * he, je = ht >>> 13, ht &= 8191, ht += Ve * Wt, ht += Fe * Zt, ht += Ue * zt, ht += Je * (5 * lr), ht += Lt * (5 * gr), je += ht >>> 13, ht &= 8191, xt = je, xt += yt * gr, xt += ut * Qt, xt += ot * pr, xt += Se * dr, xt += Ae * rr, je = xt >>> 13, xt &= 8191, xt += Ve * he, xt += Fe * Wt, xt += Ue * Zt, xt += Je * zt, xt += Lt * (5 * lr), je += xt >>> 13, xt &= 8191, st = je, st += yt * lr, st += ut * gr, st += ot * Qt, st += Se * pr, st += Ae * dr, je = st >>> 13, st &= 8191, st += Ve * rr, st += Fe * he, st += Ue * Wt, st += Je * Zt, st += Lt * zt, je += st >>> 13, st &= 8191, je = (je << 2) + je | 0, je = je + pt | 0, pt = je & 8191, je = je >>> 13, it += je, yt = pt, ut = it, ot = et, Se = St, Ae = Tt, Ve = At, Fe = _t, Ue = ht, Je = xt, Lt = st, q += 16, H -= 16; this.h[0] = yt, this.h[1] = ut, this.h[2] = ot, this.h[3] = Se, this.h[4] = Ae, this.h[5] = Ve, this.h[6] = Fe, this.h[7] = Ue, this.h[8] = Je, this.h[9] = Lt; - }, Y.prototype.finish = function($, z) { + }, Y.prototype.finish = function($, q) { var H = new Uint16Array(10), C, G, j, se; if (this.leftover) { for (se = this.leftover, this.buffer[se++] = 1; se < 16; se++) this.buffer[se] = 0; @@ -40900,59 +40939,59 @@ var xA = { exports: {} }; for (G = ~G, se = 0; se < 10; se++) this.h[se] = this.h[se] & G | H[se]; for (this.h[0] = (this.h[0] | this.h[1] << 13) & 65535, this.h[1] = (this.h[1] >>> 3 | this.h[2] << 10) & 65535, this.h[2] = (this.h[2] >>> 6 | this.h[3] << 7) & 65535, this.h[3] = (this.h[3] >>> 9 | this.h[4] << 4) & 65535, this.h[4] = (this.h[4] >>> 12 | this.h[5] << 1 | this.h[6] << 14) & 65535, this.h[5] = (this.h[6] >>> 2 | this.h[7] << 11) & 65535, this.h[6] = (this.h[7] >>> 5 | this.h[8] << 8) & 65535, this.h[7] = (this.h[8] >>> 8 | this.h[9] << 5) & 65535, j = this.h[0] + this.pad[0], this.h[0] = j & 65535, se = 1; se < 8; se++) j = (this.h[se] + this.pad[se] | 0) + (j >>> 16) | 0, this.h[se] = j & 65535; - $[z + 0] = this.h[0] >>> 0 & 255, $[z + 1] = this.h[0] >>> 8 & 255, $[z + 2] = this.h[1] >>> 0 & 255, $[z + 3] = this.h[1] >>> 8 & 255, $[z + 4] = this.h[2] >>> 0 & 255, $[z + 5] = this.h[2] >>> 8 & 255, $[z + 6] = this.h[3] >>> 0 & 255, $[z + 7] = this.h[3] >>> 8 & 255, $[z + 8] = this.h[4] >>> 0 & 255, $[z + 9] = this.h[4] >>> 8 & 255, $[z + 10] = this.h[5] >>> 0 & 255, $[z + 11] = this.h[5] >>> 8 & 255, $[z + 12] = this.h[6] >>> 0 & 255, $[z + 13] = this.h[6] >>> 8 & 255, $[z + 14] = this.h[7] >>> 0 & 255, $[z + 15] = this.h[7] >>> 8 & 255; - }, Y.prototype.update = function($, z, H) { + $[q + 0] = this.h[0] >>> 0 & 255, $[q + 1] = this.h[0] >>> 8 & 255, $[q + 2] = this.h[1] >>> 0 & 255, $[q + 3] = this.h[1] >>> 8 & 255, $[q + 4] = this.h[2] >>> 0 & 255, $[q + 5] = this.h[2] >>> 8 & 255, $[q + 6] = this.h[3] >>> 0 & 255, $[q + 7] = this.h[3] >>> 8 & 255, $[q + 8] = this.h[4] >>> 0 & 255, $[q + 9] = this.h[4] >>> 8 & 255, $[q + 10] = this.h[5] >>> 0 & 255, $[q + 11] = this.h[5] >>> 8 & 255, $[q + 12] = this.h[6] >>> 0 & 255, $[q + 13] = this.h[6] >>> 8 & 255, $[q + 14] = this.h[7] >>> 0 & 255, $[q + 15] = this.h[7] >>> 8 & 255; + }, Y.prototype.update = function($, q, H) { var C, G; if (this.leftover) { for (G = 16 - this.leftover, G > H && (G = H), C = 0; C < G; C++) - this.buffer[this.leftover + C] = $[z + C]; - if (H -= G, z += G, this.leftover += G, this.leftover < 16) + this.buffer[this.leftover + C] = $[q + C]; + if (H -= G, q += G, this.leftover += G, this.leftover < 16) return; this.blocks(this.buffer, 0, 16), this.leftover = 0; } - if (H >= 16 && (G = H - H % 16, this.blocks($, z, G), z += G, H -= G), H) { + if (H >= 16 && (G = H - H % 16, this.blocks($, q, G), q += G, H -= G), H) { for (C = 0; C < H; C++) - this.buffer[this.leftover + C] = $[z + C]; + this.buffer[this.leftover + C] = $[q + C]; this.leftover += H; } }; - function A($, z, H, C, G, j) { + function A($, q, H, C, G, j) { var se = new Y(j); - return se.update(H, C, G), se.finish($, z), 0; + return se.update(H, C, G), se.finish($, q), 0; } - function m($, z, H, C, G, j) { + function m($, q, H, C, G, j) { var se = new Uint8Array(16); - return A(se, 0, H, C, G, j), L($, z, se, 0); + return A(se, 0, H, C, G, j), L($, q, se, 0); } - function f($, z, H, C, G) { + function f($, q, H, C, G) { var j; if (H < 32) return -1; - for (Ee($, 0, z, 0, H, C, G), A($, 16, $, 32, H - 32, $), j = 0; j < 16; j++) $[j] = 0; + for (Ee($, 0, q, 0, H, C, G), A($, 16, $, 32, H - 32, $), j = 0; j < 16; j++) $[j] = 0; return 0; } - function g($, z, H, C, G) { + function g($, q, H, C, G) { var j, se = new Uint8Array(32); - if (H < 32 || (ge(se, 0, 32, C, G), m(z, 16, z, 32, H - 32, se) !== 0)) return -1; - for (Ee($, 0, z, 0, H, C, G), j = 0; j < 32; j++) $[j] = 0; + if (H < 32 || (ge(se, 0, 32, C, G), m(q, 16, q, 32, H - 32, se) !== 0)) return -1; + for (Ee($, 0, q, 0, H, C, G), j = 0; j < 32; j++) $[j] = 0; return 0; } - function b($, z) { + function b($, q) { var H; - for (H = 0; H < 16; H++) $[H] = z[H] | 0; + for (H = 0; H < 16; H++) $[H] = q[H] | 0; } function x($) { - var z, H, C = 1; - for (z = 0; z < 16; z++) - H = $[z] + C + 65535, C = Math.floor(H / 65536), $[z] = H - C * 65536; + var q, H, C = 1; + for (q = 0; q < 16; q++) + H = $[q] + C + 65535, C = Math.floor(H / 65536), $[q] = H - C * 65536; $[0] += C - 1 + 37 * (C - 1); } - function E($, z, H) { + function E($, q, H) { for (var C, G = ~(H - 1), j = 0; j < 16; j++) - C = G & ($[j] ^ z[j]), $[j] ^= C, z[j] ^= C; + C = G & ($[j] ^ q[j]), $[j] ^= C, q[j] ^= C; } - function S($, z) { + function S($, q) { var H, C, G, j = r(), se = r(); - for (H = 0; H < 16; H++) se[H] = z[H]; + for (H = 0; H < 16; H++) se[H] = q[H]; for (x(se), x(se), x(se), C = 0; C < 2; C++) { for (j[0] = se[0] - 65517, H = 1; H < 15; H++) j[H] = se[H] - 65535 - (j[H - 1] >> 16 & 1), j[H - 1] &= 65535; @@ -40961,50 +41000,50 @@ var xA = { exports: {} }; for (H = 0; H < 16; H++) $[2 * H] = se[H] & 255, $[2 * H + 1] = se[H] >> 8; } - function v($, z) { + function v($, q) { var H = new Uint8Array(32), C = new Uint8Array(32); - return S(H, $), S(C, z), B(H, 0, C, 0); + return S(H, $), S(C, q), B(H, 0, C, 0); } function M($) { - var z = new Uint8Array(32); - return S(z, $), z[0] & 1; + var q = new Uint8Array(32); + return S(q, $), q[0] & 1; } - function I($, z) { + function I($, q) { var H; - for (H = 0; H < 16; H++) $[H] = z[2 * H] + (z[2 * H + 1] << 8); + for (H = 0; H < 16; H++) $[H] = q[2 * H] + (q[2 * H + 1] << 8); $[15] &= 32767; } - function F($, z, H) { - for (var C = 0; C < 16; C++) $[C] = z[C] + H[C]; + function F($, q, H) { + for (var C = 0; C < 16; C++) $[C] = q[C] + H[C]; } - function ce($, z, H) { - for (var C = 0; C < 16; C++) $[C] = z[C] - H[C]; + function ce($, q, H) { + for (var C = 0; C < 16; C++) $[C] = q[C] - H[C]; } - function D($, z, H) { + function D($, q, H) { var C, G, j = 0, se = 0, de = 0, xe = 0, Te = 0, Re = 0, nt = 0, je = 0, pt = 0, it = 0, et = 0, St = 0, Tt = 0, At = 0, _t = 0, ht = 0, xt = 0, st = 0, yt = 0, ut = 0, ot = 0, Se = 0, Ae = 0, Ve = 0, Fe = 0, Ue = 0, Je = 0, Lt = 0, zt = 0, Zt = 0, Wt = 0, he = H[0], rr = H[1], dr = H[2], pr = H[3], Qt = H[4], gr = H[5], lr = H[6], Rr = H[7], mr = H[8], wr = H[9], $r = H[10], Br = H[11], Ir = H[12], nn = H[13], sn = H[14], on = H[15]; - C = z[0], j += C * he, se += C * rr, de += C * dr, xe += C * pr, Te += C * Qt, Re += C * gr, nt += C * lr, je += C * Rr, pt += C * mr, it += C * wr, et += C * $r, St += C * Br, Tt += C * Ir, At += C * nn, _t += C * sn, ht += C * on, C = z[1], se += C * he, de += C * rr, xe += C * dr, Te += C * pr, Re += C * Qt, nt += C * gr, je += C * lr, pt += C * Rr, it += C * mr, et += C * wr, St += C * $r, Tt += C * Br, At += C * Ir, _t += C * nn, ht += C * sn, xt += C * on, C = z[2], de += C * he, xe += C * rr, Te += C * dr, Re += C * pr, nt += C * Qt, je += C * gr, pt += C * lr, it += C * Rr, et += C * mr, St += C * wr, Tt += C * $r, At += C * Br, _t += C * Ir, ht += C * nn, xt += C * sn, st += C * on, C = z[3], xe += C * he, Te += C * rr, Re += C * dr, nt += C * pr, je += C * Qt, pt += C * gr, it += C * lr, et += C * Rr, St += C * mr, Tt += C * wr, At += C * $r, _t += C * Br, ht += C * Ir, xt += C * nn, st += C * sn, yt += C * on, C = z[4], Te += C * he, Re += C * rr, nt += C * dr, je += C * pr, pt += C * Qt, it += C * gr, et += C * lr, St += C * Rr, Tt += C * mr, At += C * wr, _t += C * $r, ht += C * Br, xt += C * Ir, st += C * nn, yt += C * sn, ut += C * on, C = z[5], Re += C * he, nt += C * rr, je += C * dr, pt += C * pr, it += C * Qt, et += C * gr, St += C * lr, Tt += C * Rr, At += C * mr, _t += C * wr, ht += C * $r, xt += C * Br, st += C * Ir, yt += C * nn, ut += C * sn, ot += C * on, C = z[6], nt += C * he, je += C * rr, pt += C * dr, it += C * pr, et += C * Qt, St += C * gr, Tt += C * lr, At += C * Rr, _t += C * mr, ht += C * wr, xt += C * $r, st += C * Br, yt += C * Ir, ut += C * nn, ot += C * sn, Se += C * on, C = z[7], je += C * he, pt += C * rr, it += C * dr, et += C * pr, St += C * Qt, Tt += C * gr, At += C * lr, _t += C * Rr, ht += C * mr, xt += C * wr, st += C * $r, yt += C * Br, ut += C * Ir, ot += C * nn, Se += C * sn, Ae += C * on, C = z[8], pt += C * he, it += C * rr, et += C * dr, St += C * pr, Tt += C * Qt, At += C * gr, _t += C * lr, ht += C * Rr, xt += C * mr, st += C * wr, yt += C * $r, ut += C * Br, ot += C * Ir, Se += C * nn, Ae += C * sn, Ve += C * on, C = z[9], it += C * he, et += C * rr, St += C * dr, Tt += C * pr, At += C * Qt, _t += C * gr, ht += C * lr, xt += C * Rr, st += C * mr, yt += C * wr, ut += C * $r, ot += C * Br, Se += C * Ir, Ae += C * nn, Ve += C * sn, Fe += C * on, C = z[10], et += C * he, St += C * rr, Tt += C * dr, At += C * pr, _t += C * Qt, ht += C * gr, xt += C * lr, st += C * Rr, yt += C * mr, ut += C * wr, ot += C * $r, Se += C * Br, Ae += C * Ir, Ve += C * nn, Fe += C * sn, Ue += C * on, C = z[11], St += C * he, Tt += C * rr, At += C * dr, _t += C * pr, ht += C * Qt, xt += C * gr, st += C * lr, yt += C * Rr, ut += C * mr, ot += C * wr, Se += C * $r, Ae += C * Br, Ve += C * Ir, Fe += C * nn, Ue += C * sn, Je += C * on, C = z[12], Tt += C * he, At += C * rr, _t += C * dr, ht += C * pr, xt += C * Qt, st += C * gr, yt += C * lr, ut += C * Rr, ot += C * mr, Se += C * wr, Ae += C * $r, Ve += C * Br, Fe += C * Ir, Ue += C * nn, Je += C * sn, Lt += C * on, C = z[13], At += C * he, _t += C * rr, ht += C * dr, xt += C * pr, st += C * Qt, yt += C * gr, ut += C * lr, ot += C * Rr, Se += C * mr, Ae += C * wr, Ve += C * $r, Fe += C * Br, Ue += C * Ir, Je += C * nn, Lt += C * sn, zt += C * on, C = z[14], _t += C * he, ht += C * rr, xt += C * dr, st += C * pr, yt += C * Qt, ut += C * gr, ot += C * lr, Se += C * Rr, Ae += C * mr, Ve += C * wr, Fe += C * $r, Ue += C * Br, Je += C * Ir, Lt += C * nn, zt += C * sn, Zt += C * on, C = z[15], ht += C * he, xt += C * rr, st += C * dr, yt += C * pr, ut += C * Qt, ot += C * gr, Se += C * lr, Ae += C * Rr, Ve += C * mr, Fe += C * wr, Ue += C * $r, Je += C * Br, Lt += C * Ir, zt += C * nn, Zt += C * sn, Wt += C * on, j += 38 * xt, se += 38 * st, de += 38 * yt, xe += 38 * ut, Te += 38 * ot, Re += 38 * Se, nt += 38 * Ae, je += 38 * Ve, pt += 38 * Fe, it += 38 * Ue, et += 38 * Je, St += 38 * Lt, Tt += 38 * zt, At += 38 * Zt, _t += 38 * Wt, G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = de + G + 65535, G = Math.floor(C / 65536), de = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = de + G + 65535, G = Math.floor(C / 65536), de = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), $[0] = j, $[1] = se, $[2] = de, $[3] = xe, $[4] = Te, $[5] = Re, $[6] = nt, $[7] = je, $[8] = pt, $[9] = it, $[10] = et, $[11] = St, $[12] = Tt, $[13] = At, $[14] = _t, $[15] = ht; + C = q[0], j += C * he, se += C * rr, de += C * dr, xe += C * pr, Te += C * Qt, Re += C * gr, nt += C * lr, je += C * Rr, pt += C * mr, it += C * wr, et += C * $r, St += C * Br, Tt += C * Ir, At += C * nn, _t += C * sn, ht += C * on, C = q[1], se += C * he, de += C * rr, xe += C * dr, Te += C * pr, Re += C * Qt, nt += C * gr, je += C * lr, pt += C * Rr, it += C * mr, et += C * wr, St += C * $r, Tt += C * Br, At += C * Ir, _t += C * nn, ht += C * sn, xt += C * on, C = q[2], de += C * he, xe += C * rr, Te += C * dr, Re += C * pr, nt += C * Qt, je += C * gr, pt += C * lr, it += C * Rr, et += C * mr, St += C * wr, Tt += C * $r, At += C * Br, _t += C * Ir, ht += C * nn, xt += C * sn, st += C * on, C = q[3], xe += C * he, Te += C * rr, Re += C * dr, nt += C * pr, je += C * Qt, pt += C * gr, it += C * lr, et += C * Rr, St += C * mr, Tt += C * wr, At += C * $r, _t += C * Br, ht += C * Ir, xt += C * nn, st += C * sn, yt += C * on, C = q[4], Te += C * he, Re += C * rr, nt += C * dr, je += C * pr, pt += C * Qt, it += C * gr, et += C * lr, St += C * Rr, Tt += C * mr, At += C * wr, _t += C * $r, ht += C * Br, xt += C * Ir, st += C * nn, yt += C * sn, ut += C * on, C = q[5], Re += C * he, nt += C * rr, je += C * dr, pt += C * pr, it += C * Qt, et += C * gr, St += C * lr, Tt += C * Rr, At += C * mr, _t += C * wr, ht += C * $r, xt += C * Br, st += C * Ir, yt += C * nn, ut += C * sn, ot += C * on, C = q[6], nt += C * he, je += C * rr, pt += C * dr, it += C * pr, et += C * Qt, St += C * gr, Tt += C * lr, At += C * Rr, _t += C * mr, ht += C * wr, xt += C * $r, st += C * Br, yt += C * Ir, ut += C * nn, ot += C * sn, Se += C * on, C = q[7], je += C * he, pt += C * rr, it += C * dr, et += C * pr, St += C * Qt, Tt += C * gr, At += C * lr, _t += C * Rr, ht += C * mr, xt += C * wr, st += C * $r, yt += C * Br, ut += C * Ir, ot += C * nn, Se += C * sn, Ae += C * on, C = q[8], pt += C * he, it += C * rr, et += C * dr, St += C * pr, Tt += C * Qt, At += C * gr, _t += C * lr, ht += C * Rr, xt += C * mr, st += C * wr, yt += C * $r, ut += C * Br, ot += C * Ir, Se += C * nn, Ae += C * sn, Ve += C * on, C = q[9], it += C * he, et += C * rr, St += C * dr, Tt += C * pr, At += C * Qt, _t += C * gr, ht += C * lr, xt += C * Rr, st += C * mr, yt += C * wr, ut += C * $r, ot += C * Br, Se += C * Ir, Ae += C * nn, Ve += C * sn, Fe += C * on, C = q[10], et += C * he, St += C * rr, Tt += C * dr, At += C * pr, _t += C * Qt, ht += C * gr, xt += C * lr, st += C * Rr, yt += C * mr, ut += C * wr, ot += C * $r, Se += C * Br, Ae += C * Ir, Ve += C * nn, Fe += C * sn, Ue += C * on, C = q[11], St += C * he, Tt += C * rr, At += C * dr, _t += C * pr, ht += C * Qt, xt += C * gr, st += C * lr, yt += C * Rr, ut += C * mr, ot += C * wr, Se += C * $r, Ae += C * Br, Ve += C * Ir, Fe += C * nn, Ue += C * sn, Je += C * on, C = q[12], Tt += C * he, At += C * rr, _t += C * dr, ht += C * pr, xt += C * Qt, st += C * gr, yt += C * lr, ut += C * Rr, ot += C * mr, Se += C * wr, Ae += C * $r, Ve += C * Br, Fe += C * Ir, Ue += C * nn, Je += C * sn, Lt += C * on, C = q[13], At += C * he, _t += C * rr, ht += C * dr, xt += C * pr, st += C * Qt, yt += C * gr, ut += C * lr, ot += C * Rr, Se += C * mr, Ae += C * wr, Ve += C * $r, Fe += C * Br, Ue += C * Ir, Je += C * nn, Lt += C * sn, zt += C * on, C = q[14], _t += C * he, ht += C * rr, xt += C * dr, st += C * pr, yt += C * Qt, ut += C * gr, ot += C * lr, Se += C * Rr, Ae += C * mr, Ve += C * wr, Fe += C * $r, Ue += C * Br, Je += C * Ir, Lt += C * nn, zt += C * sn, Zt += C * on, C = q[15], ht += C * he, xt += C * rr, st += C * dr, yt += C * pr, ut += C * Qt, ot += C * gr, Se += C * lr, Ae += C * Rr, Ve += C * mr, Fe += C * wr, Ue += C * $r, Je += C * Br, Lt += C * Ir, zt += C * nn, Zt += C * sn, Wt += C * on, j += 38 * xt, se += 38 * st, de += 38 * yt, xe += 38 * ut, Te += 38 * ot, Re += 38 * Se, nt += 38 * Ae, je += 38 * Ve, pt += 38 * Fe, it += 38 * Ue, et += 38 * Je, St += 38 * Lt, Tt += 38 * zt, At += 38 * Zt, _t += 38 * Wt, G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = de + G + 65535, G = Math.floor(C / 65536), de = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = de + G + 65535, G = Math.floor(C / 65536), de = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), $[0] = j, $[1] = se, $[2] = de, $[3] = xe, $[4] = Te, $[5] = Re, $[6] = nt, $[7] = je, $[8] = pt, $[9] = it, $[10] = et, $[11] = St, $[12] = Tt, $[13] = At, $[14] = _t, $[15] = ht; } - function oe($, z) { - D($, z, z); + function oe($, q) { + D($, q, q); } - function Z($, z) { + function Z($, q) { var H = r(), C; - for (C = 0; C < 16; C++) H[C] = z[C]; + for (C = 0; C < 16; C++) H[C] = q[C]; for (C = 253; C >= 0; C--) - oe(H, H), C !== 2 && C !== 4 && D(H, H, z); + oe(H, H), C !== 2 && C !== 4 && D(H, H, q); for (C = 0; C < 16; C++) $[C] = H[C]; } - function J($, z) { + function J($, q) { var H = r(), C; - for (C = 0; C < 16; C++) H[C] = z[C]; + for (C = 0; C < 16; C++) H[C] = q[C]; for (C = 250; C >= 0; C--) - oe(H, H), C !== 1 && D(H, H, z); + oe(H, H), C !== 1 && D(H, H, q); for (C = 0; C < 16; C++) $[C] = H[C]; } - function ee($, z, H) { + function ee($, q, H) { var C = new Uint8Array(32), G = new Float64Array(80), j, se, de = r(), xe = r(), Te = r(), Re = r(), nt = r(), je = r(); - for (se = 0; se < 31; se++) C[se] = z[se]; - for (C[31] = z[31] & 127 | 64, C[0] &= 248, I(G, H), se = 0; se < 16; se++) + for (se = 0; se < 31; se++) C[se] = q[se]; + for (C[31] = q[31] & 127 | 64, C[0] &= 248, I(G, H), se = 0; se < 16; se++) xe[se] = G[se], Re[se] = de[se] = Te[se] = 0; for (de[0] = Re[0] = 1, se = 254; se >= 0; --se) j = C[se >>> 3] >>> (se & 7) & 1, E(de, xe, j), E(Te, Re, j), F(nt, de, Te), ce(de, de, Te), F(Te, xe, Re), ce(xe, xe, Re), oe(Re, nt), oe(je, de), D(de, Te, de), D(Te, xe, nt), F(nt, de, Te), ce(de, de, Te), oe(xe, de), ce(Te, Re, je), D(de, Te, u), F(de, de, Re), D(Te, Te, de), D(de, Re, je), D(Re, xe, G), oe(xe, nt), E(de, xe, j), E(Te, Re, j); @@ -41013,24 +41052,24 @@ var xA = { exports: {} }; var pt = G.subarray(32), it = G.subarray(16); return Z(pt, pt), D(it, it, pt), S($, it), 0; } - function T($, z) { - return ee($, z, s); + function T($, q) { + return ee($, q, s); } - function X($, z) { - return n(z, 32), T($, z); + function X($, q) { + return n(q, 32), T($, q); } - function re($, z, H) { + function re($, q, H) { var C = new Uint8Array(32); - return ee(C, H, z), V($, i, C, Q); + return ee(C, H, q), V($, i, C, Q); } var pe = f, ie = g; - function ue($, z, H, C, G, j) { + function ue($, q, H, C, G, j) { var se = new Uint8Array(32); - return re(se, G, j), pe($, z, H, C, se); + return re(se, G, j), pe($, q, H, C, se); } - function ve($, z, H, C, G, j) { + function ve($, q, H, C, G, j) { var se = new Uint8Array(32); - return re(se, G, j), ie($, z, H, C, se); + return re(se, G, j), ie($, q, H, C, se); } var Pe = [ 1116352408, @@ -41194,76 +41233,76 @@ var xA = { exports: {} }; 1816402316, 1246189591 ]; - function De($, z, H, C) { - for (var G = new Int32Array(16), j = new Int32Array(16), se, de, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, yt, ut, ot, Se, Ae, Ve, Fe, Ue, Je, Lt = $[0], zt = $[1], Zt = $[2], Wt = $[3], he = $[4], rr = $[5], dr = $[6], pr = $[7], Qt = z[0], gr = z[1], lr = z[2], Rr = z[3], mr = z[4], wr = z[5], $r = z[6], Br = z[7], Ir = 0; C >= 128; ) { + function De($, q, H, C) { + for (var G = new Int32Array(16), j = new Int32Array(16), se, de, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, yt, ut, ot, Se, Ae, Ve, Fe, Ue, Je, Lt = $[0], zt = $[1], Zt = $[2], Wt = $[3], he = $[4], rr = $[5], dr = $[6], pr = $[7], Qt = q[0], gr = q[1], lr = q[2], Rr = q[3], mr = q[4], wr = q[5], $r = q[6], Br = q[7], Ir = 0; C >= 128; ) { for (ut = 0; ut < 16; ut++) ot = 8 * ut + Ir, G[ut] = H[ot + 0] << 24 | H[ot + 1] << 16 | H[ot + 2] << 8 | H[ot + 3], j[ut] = H[ot + 4] << 24 | H[ot + 5] << 16 | H[ot + 6] << 8 | H[ot + 7]; for (ut = 0; ut < 80; ut++) if (se = Lt, de = zt, xe = Zt, Te = Wt, Re = he, nt = rr, je = dr, pt = pr, it = Qt, et = gr, St = lr, Tt = Rr, At = mr, _t = wr, ht = $r, xt = Br, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (he >>> 14 | mr << 18) ^ (he >>> 18 | mr << 14) ^ (mr >>> 9 | he << 23), Ae = (mr >>> 14 | he << 18) ^ (mr >>> 18 | he << 14) ^ (he >>> 9 | mr << 23), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = he & rr ^ ~he & dr, Ae = mr & wr ^ ~mr & $r, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Pe[ut * 2], Ae = Pe[ut * 2 + 1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = G[ut % 16], Ae = j[ut % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, st = Ue & 65535 | Je << 16, yt = Ve & 65535 | Fe << 16, Se = st, Ae = yt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (Lt >>> 28 | Qt << 4) ^ (Qt >>> 2 | Lt << 30) ^ (Qt >>> 7 | Lt << 25), Ae = (Qt >>> 28 | Lt << 4) ^ (Lt >>> 2 | Qt << 30) ^ (Lt >>> 7 | Qt << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Lt & zt ^ Lt & Zt ^ zt & Zt, Ae = Qt & gr ^ Qt & lr ^ gr & lr, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, pt = Ue & 65535 | Je << 16, xt = Ve & 65535 | Fe << 16, Se = Te, Ae = Tt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = st, Ae = yt, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, Te = Ue & 65535 | Je << 16, Tt = Ve & 65535 | Fe << 16, zt = se, Zt = de, Wt = xe, he = Te, rr = Re, dr = nt, pr = je, Lt = pt, gr = it, lr = et, Rr = St, mr = Tt, wr = At, $r = _t, Br = ht, Qt = xt, ut % 16 === 15) for (ot = 0; ot < 16; ot++) Se = G[ot], Ae = j[ot], Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = G[(ot + 9) % 16], Ae = j[(ot + 9) % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, st = G[(ot + 1) % 16], yt = j[(ot + 1) % 16], Se = (st >>> 1 | yt << 31) ^ (st >>> 8 | yt << 24) ^ st >>> 7, Ae = (yt >>> 1 | st << 31) ^ (yt >>> 8 | st << 24) ^ (yt >>> 7 | st << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, st = G[(ot + 14) % 16], yt = j[(ot + 14) % 16], Se = (st >>> 19 | yt << 13) ^ (yt >>> 29 | st << 3) ^ st >>> 6, Ae = (yt >>> 19 | st << 13) ^ (st >>> 29 | yt << 3) ^ (yt >>> 6 | st << 26), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, G[ot] = Ue & 65535 | Je << 16, j[ot] = Ve & 65535 | Fe << 16; - Se = Lt, Ae = Qt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[0], Ae = z[0], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[0] = Lt = Ue & 65535 | Je << 16, z[0] = Qt = Ve & 65535 | Fe << 16, Se = zt, Ae = gr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[1], Ae = z[1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[1] = zt = Ue & 65535 | Je << 16, z[1] = gr = Ve & 65535 | Fe << 16, Se = Zt, Ae = lr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[2], Ae = z[2], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[2] = Zt = Ue & 65535 | Je << 16, z[2] = lr = Ve & 65535 | Fe << 16, Se = Wt, Ae = Rr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[3], Ae = z[3], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[3] = Wt = Ue & 65535 | Je << 16, z[3] = Rr = Ve & 65535 | Fe << 16, Se = he, Ae = mr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[4], Ae = z[4], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[4] = he = Ue & 65535 | Je << 16, z[4] = mr = Ve & 65535 | Fe << 16, Se = rr, Ae = wr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[5], Ae = z[5], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[5] = rr = Ue & 65535 | Je << 16, z[5] = wr = Ve & 65535 | Fe << 16, Se = dr, Ae = $r, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[6], Ae = z[6], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[6] = dr = Ue & 65535 | Je << 16, z[6] = $r = Ve & 65535 | Fe << 16, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[7], Ae = z[7], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[7] = pr = Ue & 65535 | Je << 16, z[7] = Br = Ve & 65535 | Fe << 16, Ir += 128, C -= 128; + Se = Lt, Ae = Qt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[0], Ae = q[0], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[0] = Lt = Ue & 65535 | Je << 16, q[0] = Qt = Ve & 65535 | Fe << 16, Se = zt, Ae = gr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[1], Ae = q[1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[1] = zt = Ue & 65535 | Je << 16, q[1] = gr = Ve & 65535 | Fe << 16, Se = Zt, Ae = lr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[2], Ae = q[2], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[2] = Zt = Ue & 65535 | Je << 16, q[2] = lr = Ve & 65535 | Fe << 16, Se = Wt, Ae = Rr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[3], Ae = q[3], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[3] = Wt = Ue & 65535 | Je << 16, q[3] = Rr = Ve & 65535 | Fe << 16, Se = he, Ae = mr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[4], Ae = q[4], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[4] = he = Ue & 65535 | Je << 16, q[4] = mr = Ve & 65535 | Fe << 16, Se = rr, Ae = wr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[5], Ae = q[5], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[5] = rr = Ue & 65535 | Je << 16, q[5] = wr = Ve & 65535 | Fe << 16, Se = dr, Ae = $r, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[6], Ae = q[6], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[6] = dr = Ue & 65535 | Je << 16, q[6] = $r = Ve & 65535 | Fe << 16, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[7], Ae = q[7], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[7] = pr = Ue & 65535 | Je << 16, q[7] = Br = Ve & 65535 | Fe << 16, Ir += 128, C -= 128; } return C; } - function Ce($, z, H) { + function Ce($, q, H) { var C = new Int32Array(8), G = new Int32Array(8), j = new Uint8Array(256), se, de = H; - for (C[0] = 1779033703, C[1] = 3144134277, C[2] = 1013904242, C[3] = 2773480762, C[4] = 1359893119, C[5] = 2600822924, C[6] = 528734635, C[7] = 1541459225, G[0] = 4089235720, G[1] = 2227873595, G[2] = 4271175723, G[3] = 1595750129, G[4] = 2917565137, G[5] = 725511199, G[6] = 4215389547, G[7] = 327033209, De(C, G, z, H), H %= 128, se = 0; se < H; se++) j[se] = z[de - H + se]; + for (C[0] = 1779033703, C[1] = 3144134277, C[2] = 1013904242, C[3] = 2773480762, C[4] = 1359893119, C[5] = 2600822924, C[6] = 528734635, C[7] = 1541459225, G[0] = 4089235720, G[1] = 2227873595, G[2] = 4271175723, G[3] = 1595750129, G[4] = 2917565137, G[5] = 725511199, G[6] = 4215389547, G[7] = 327033209, De(C, G, q, H), H %= 128, se = 0; se < H; se++) j[se] = q[de - H + se]; for (j[H] = 128, H = 256 - 128 * (H < 112 ? 1 : 0), j[H - 9] = 0, P(j, H - 8, de / 536870912 | 0, de << 3), De(C, G, j, H), se = 0; se < 8; se++) P($, 8 * se, C[se], G[se]); return 0; } - function $e($, z) { + function $e($, q) { var H = r(), C = r(), G = r(), j = r(), se = r(), de = r(), xe = r(), Te = r(), Re = r(); - ce(H, $[1], $[0]), ce(Re, z[1], z[0]), D(H, H, Re), F(C, $[0], $[1]), F(Re, z[0], z[1]), D(C, C, Re), D(G, $[3], z[3]), D(G, G, d), D(j, $[2], z[2]), F(j, j, j), ce(se, C, H), ce(de, j, G), F(xe, j, G), F(Te, C, H), D($[0], se, de), D($[1], Te, xe), D($[2], xe, de), D($[3], se, Te); + ce(H, $[1], $[0]), ce(Re, q[1], q[0]), D(H, H, Re), F(C, $[0], $[1]), F(Re, q[0], q[1]), D(C, C, Re), D(G, $[3], q[3]), D(G, G, d), D(j, $[2], q[2]), F(j, j, j), ce(se, C, H), ce(de, j, G), F(xe, j, G), F(Te, C, H), D($[0], se, de), D($[1], Te, xe), D($[2], xe, de), D($[3], se, Te); } - function Me($, z, H) { + function Me($, q, H) { var C; for (C = 0; C < 4; C++) - E($[C], z[C], H); + E($[C], q[C], H); } - function Ne($, z) { + function Ne($, q) { var H = r(), C = r(), G = r(); - Z(G, z[2]), D(H, z[0], G), D(C, z[1], G), S($, C), $[31] ^= M(H) << 7; + Z(G, q[2]), D(H, q[0], G), D(C, q[1], G), S($, C), $[31] ^= M(H) << 7; } - function Ke($, z, H) { + function Ke($, q, H) { var C, G; for (b($[0], o), b($[1], a), b($[2], a), b($[3], o), G = 255; G >= 0; --G) - C = H[G / 8 | 0] >> (G & 7) & 1, Me($, z, C), $e(z, $), $e($, $), Me($, z, C); + C = H[G / 8 | 0] >> (G & 7) & 1, Me($, q, C), $e(q, $), $e($, $), Me($, q, C); } - function Le($, z) { + function Le($, q) { var H = [r(), r(), r(), r()]; - b(H[0], p), b(H[1], w), b(H[2], a), D(H[3], p, w), Ke($, H, z); + b(H[0], p), b(H[1], w), b(H[2], a), D(H[3], p, w), Ke($, H, q); } - function qe($, z, H) { + function qe($, q, H) { var C = new Uint8Array(64), G = [r(), r(), r(), r()], j; - for (H || n(z, 32), Ce(C, z, 32), C[0] &= 248, C[31] &= 127, C[31] |= 64, Le(G, C), Ne($, G), j = 0; j < 32; j++) z[j + 32] = $[j]; + for (H || n(q, 32), Ce(C, q, 32), C[0] &= 248, C[31] &= 127, C[31] |= 64, Le(G, C), Ne($, G), j = 0; j < 32; j++) q[j + 32] = $[j]; return 0; } var ze = new Float64Array([237, 211, 245, 92, 26, 99, 18, 88, 214, 156, 247, 162, 222, 249, 222, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16]); - function _e($, z) { + function _e($, q) { var H, C, G, j; for (C = 63; C >= 32; --C) { for (H = 0, G = C - 32, j = C - 12; G < j; ++G) - z[G] += H - 16 * z[C] * ze[G - (C - 32)], H = Math.floor((z[G] + 128) / 256), z[G] -= H * 256; - z[G] += H, z[C] = 0; + q[G] += H - 16 * q[C] * ze[G - (C - 32)], H = Math.floor((q[G] + 128) / 256), q[G] -= H * 256; + q[G] += H, q[C] = 0; } for (H = 0, G = 0; G < 32; G++) - z[G] += H - (z[31] >> 4) * ze[G], H = z[G] >> 8, z[G] &= 255; - for (G = 0; G < 32; G++) z[G] -= H * ze[G]; + q[G] += H - (q[31] >> 4) * ze[G], H = q[G] >> 8, q[G] &= 255; + for (G = 0; G < 32; G++) q[G] -= H * ze[G]; for (C = 0; C < 32; C++) - z[C + 1] += z[C] >> 8, $[C] = z[C] & 255; + q[C + 1] += q[C] >> 8, $[C] = q[C] & 255; } function Ze($) { - var z = new Float64Array(64), H; - for (H = 0; H < 64; H++) z[H] = $[H]; + var q = new Float64Array(64), H; + for (H = 0; H < 64; H++) q[H] = $[H]; for (H = 0; H < 64; H++) $[H] = 0; - _e($, z); + _e($, q); } - function at($, z, H, C) { + function at($, q, H, C) { var G = new Uint8Array(64), j = new Uint8Array(64), se = new Uint8Array(64), de, xe, Te = new Float64Array(64), Re = [r(), r(), r(), r()]; Ce(G, C, 32), G[0] &= 248, G[31] &= 127, G[31] |= 64; var nt = H + 64; - for (de = 0; de < H; de++) $[64 + de] = z[de]; + for (de = 0; de < H; de++) $[64 + de] = q[de]; for (de = 0; de < 32; de++) $[32 + de] = G[32 + de]; for (Ce(se, $.subarray(32), H + 32), Ze(se), Le(Re, se), Ne($, Re), de = 32; de < 64; de++) $[de] = C[de]; for (Ce(j, $, H + 64), Ze(j), de = 0; de < 64; de++) Te[de] = 0; @@ -41273,20 +41312,20 @@ var xA = { exports: {} }; Te[de + xe] += j[de] * G[xe]; return _e($.subarray(32), Te), nt; } - function ke($, z) { + function ke($, q) { var H = r(), C = r(), G = r(), j = r(), se = r(), de = r(), xe = r(); - return b($[2], a), I($[1], z), oe(G, $[1]), D(j, G, l), ce(G, G, $[2]), F(j, $[2], j), oe(se, j), oe(de, se), D(xe, de, se), D(H, xe, G), D(H, H, j), J(H, H), D(H, H, G), D(H, H, j), D(H, H, j), D($[0], H, j), oe(C, $[0]), D(C, C, j), v(C, G) && D($[0], $[0], _), oe(C, $[0]), D(C, C, j), v(C, G) ? -1 : (M($[0]) === z[31] >> 7 && ce($[0], o, $[0]), D($[3], $[0], $[1]), 0); + return b($[2], a), I($[1], q), oe(G, $[1]), D(j, G, l), ce(G, G, $[2]), F(j, $[2], j), oe(se, j), oe(de, se), D(xe, de, se), D(H, xe, G), D(H, H, j), J(H, H), D(H, H, G), D(H, H, j), D(H, H, j), D($[0], H, j), oe(C, $[0]), D(C, C, j), v(C, G) && D($[0], $[0], _), oe(C, $[0]), D(C, C, j), v(C, G) ? -1 : (M($[0]) === q[31] >> 7 && ce($[0], o, $[0]), D($[3], $[0], $[1]), 0); } - function Qe($, z, H, C) { + function Qe($, q, H, C) { var G, j = new Uint8Array(32), se = new Uint8Array(64), de = [r(), r(), r(), r()], xe = [r(), r(), r(), r()]; if (H < 64 || ke(xe, C)) return -1; - for (G = 0; G < H; G++) $[G] = z[G]; + for (G = 0; G < H; G++) $[G] = q[G]; for (G = 0; G < 32; G++) $[G + 32] = C[G]; - if (Ce(se, $, H), Ze(se), Ke(de, xe, se), Le(xe, z.subarray(32)), $e(de, xe), Ne(j, de), H -= 64, B(z, 0, j, 0)) { + if (Ce(se, $, H), Ze(se), Ke(de, xe, se), Le(xe, q.subarray(32)), $e(de, xe), Ne(j, de), H -= 64, B(q, 0, j, 0)) { for (G = 0; G < H; G++) $[G] = 0; return -1; } - for (G = 0; G < H; G++) $[G] = z[G + 64]; + for (G = 0; G < H; G++) $[G] = q[G + 64]; return H; } var tt = 32, Ye = 24, dt = 32, lt = 16, ct = 32, qt = 32, Jt = 32, Et = 32, er = 32, Xt = Ye, Dt = dt, kt = lt, Ct = 64, mt = 32, Rt = 64, Nt = 32, bt = 64; @@ -41346,13 +41385,13 @@ var xA = { exports: {} }; scalarmult: Ke, scalarbase: Le }; - function $t($, z) { + function $t($, q) { if ($.length !== tt) throw new Error("bad key size"); - if (z.length !== Ye) throw new Error("bad nonce size"); + if (q.length !== Ye) throw new Error("bad nonce size"); } - function Ft($, z) { + function Ft($, q) { if ($.length !== Jt) throw new Error("bad public key size"); - if (z.length !== Et) throw new Error("bad secret key size"); + if (q.length !== Et) throw new Error("bad secret key size"); } function rt() { for (var $ = 0; $ < arguments.length; $++) @@ -41360,99 +41399,99 @@ var xA = { exports: {} }; throw new TypeError("unexpected type, use Uint8Array"); } function Bt($) { - for (var z = 0; z < $.length; z++) $[z] = 0; + for (var q = 0; q < $.length; q++) $[q] = 0; } e.randomBytes = function($) { - var z = new Uint8Array($); - return n(z, $), z; - }, e.secretbox = function($, z, H) { - rt($, z, H), $t(H, z); + var q = new Uint8Array($); + return n(q, $), q; + }, e.secretbox = function($, q, H) { + rt($, q, H), $t(H, q); for (var C = new Uint8Array(dt + $.length), G = new Uint8Array(C.length), j = 0; j < $.length; j++) C[j + dt] = $[j]; - return f(G, C, C.length, z, H), G.subarray(lt); - }, e.secretbox.open = function($, z, H) { - rt($, z, H), $t(H, z); + return f(G, C, C.length, q, H), G.subarray(lt); + }, e.secretbox.open = function($, q, H) { + rt($, q, H), $t(H, q); for (var C = new Uint8Array(lt + $.length), G = new Uint8Array(C.length), j = 0; j < $.length; j++) C[j + lt] = $[j]; - return C.length < 32 || g(G, C, C.length, z, H) !== 0 ? null : G.subarray(dt); - }, e.secretbox.keyLength = tt, e.secretbox.nonceLength = Ye, e.secretbox.overheadLength = lt, e.scalarMult = function($, z) { - if (rt($, z), $.length !== qt) throw new Error("bad n size"); - if (z.length !== ct) throw new Error("bad p size"); + return C.length < 32 || g(G, C, C.length, q, H) !== 0 ? null : G.subarray(dt); + }, e.secretbox.keyLength = tt, e.secretbox.nonceLength = Ye, e.secretbox.overheadLength = lt, e.scalarMult = function($, q) { + if (rt($, q), $.length !== qt) throw new Error("bad n size"); + if (q.length !== ct) throw new Error("bad p size"); var H = new Uint8Array(ct); - return ee(H, $, z), H; + return ee(H, $, q), H; }, e.scalarMult.base = function($) { if (rt($), $.length !== qt) throw new Error("bad n size"); - var z = new Uint8Array(ct); - return T(z, $), z; - }, e.scalarMult.scalarLength = qt, e.scalarMult.groupElementLength = ct, e.box = function($, z, H, C) { + var q = new Uint8Array(ct); + return T(q, $), q; + }, e.scalarMult.scalarLength = qt, e.scalarMult.groupElementLength = ct, e.box = function($, q, H, C) { var G = e.box.before(H, C); - return e.secretbox($, z, G); - }, e.box.before = function($, z) { - rt($, z), Ft($, z); + return e.secretbox($, q, G); + }, e.box.before = function($, q) { + rt($, q), Ft($, q); var H = new Uint8Array(er); - return re(H, $, z), H; - }, e.box.after = e.secretbox, e.box.open = function($, z, H, C) { + return re(H, $, q), H; + }, e.box.after = e.secretbox, e.box.open = function($, q, H, C) { var G = e.box.before(H, C); - return e.secretbox.open($, z, G); + return e.secretbox.open($, q, G); }, e.box.open.after = e.secretbox.open, e.box.keyPair = function() { - var $ = new Uint8Array(Jt), z = new Uint8Array(Et); - return X($, z), { publicKey: $, secretKey: z }; + var $ = new Uint8Array(Jt), q = new Uint8Array(Et); + return X($, q), { publicKey: $, secretKey: q }; }, e.box.keyPair.fromSecretKey = function($) { if (rt($), $.length !== Et) throw new Error("bad secret key size"); - var z = new Uint8Array(Jt); - return T(z, $), { publicKey: z, secretKey: new Uint8Array($) }; - }, e.box.publicKeyLength = Jt, e.box.secretKeyLength = Et, e.box.sharedKeyLength = er, e.box.nonceLength = Xt, e.box.overheadLength = e.secretbox.overheadLength, e.sign = function($, z) { - if (rt($, z), z.length !== Rt) + var q = new Uint8Array(Jt); + return T(q, $), { publicKey: q, secretKey: new Uint8Array($) }; + }, e.box.publicKeyLength = Jt, e.box.secretKeyLength = Et, e.box.sharedKeyLength = er, e.box.nonceLength = Xt, e.box.overheadLength = e.secretbox.overheadLength, e.sign = function($, q) { + if (rt($, q), q.length !== Rt) throw new Error("bad secret key size"); var H = new Uint8Array(Ct + $.length); - return at(H, $, $.length, z), H; - }, e.sign.open = function($, z) { - if (rt($, z), z.length !== mt) + return at(H, $, $.length, q), H; + }, e.sign.open = function($, q) { + if (rt($, q), q.length !== mt) throw new Error("bad public key size"); - var H = new Uint8Array($.length), C = Qe(H, $, $.length, z); + var H = new Uint8Array($.length), C = Qe(H, $, $.length, q); if (C < 0) return null; for (var G = new Uint8Array(C), j = 0; j < G.length; j++) G[j] = H[j]; return G; - }, e.sign.detached = function($, z) { - for (var H = e.sign($, z), C = new Uint8Array(Ct), G = 0; G < C.length; G++) C[G] = H[G]; + }, e.sign.detached = function($, q) { + for (var H = e.sign($, q), C = new Uint8Array(Ct), G = 0; G < C.length; G++) C[G] = H[G]; return C; - }, e.sign.detached.verify = function($, z, H) { - if (rt($, z, H), z.length !== Ct) + }, e.sign.detached.verify = function($, q, H) { + if (rt($, q, H), q.length !== Ct) throw new Error("bad signature size"); if (H.length !== mt) throw new Error("bad public key size"); var C = new Uint8Array(Ct + $.length), G = new Uint8Array(Ct + $.length), j; - for (j = 0; j < Ct; j++) C[j] = z[j]; + for (j = 0; j < Ct; j++) C[j] = q[j]; for (j = 0; j < $.length; j++) C[j + Ct] = $[j]; return Qe(G, C, C.length, H) >= 0; }, e.sign.keyPair = function() { - var $ = new Uint8Array(mt), z = new Uint8Array(Rt); - return qe($, z), { publicKey: $, secretKey: z }; + var $ = new Uint8Array(mt), q = new Uint8Array(Rt); + return qe($, q), { publicKey: $, secretKey: q }; }, e.sign.keyPair.fromSecretKey = function($) { if (rt($), $.length !== Rt) throw new Error("bad secret key size"); - for (var z = new Uint8Array(mt), H = 0; H < z.length; H++) z[H] = $[32 + H]; - return { publicKey: z, secretKey: new Uint8Array($) }; + for (var q = new Uint8Array(mt), H = 0; H < q.length; H++) q[H] = $[32 + H]; + return { publicKey: q, secretKey: new Uint8Array($) }; }, e.sign.keyPair.fromSeed = function($) { if (rt($), $.length !== Nt) throw new Error("bad seed size"); - for (var z = new Uint8Array(mt), H = new Uint8Array(Rt), C = 0; C < 32; C++) H[C] = $[C]; - return qe(z, H, !0), { publicKey: z, secretKey: H }; + for (var q = new Uint8Array(mt), H = new Uint8Array(Rt), C = 0; C < 32; C++) H[C] = $[C]; + return qe(q, H, !0), { publicKey: q, secretKey: H }; }, e.sign.publicKeyLength = mt, e.sign.secretKeyLength = Rt, e.sign.seedLength = Nt, e.sign.signatureLength = Ct, e.hash = function($) { rt($); - var z = new Uint8Array(bt); - return Ce(z, $, $.length), z; - }, e.hash.hashLength = bt, e.verify = function($, z) { - return rt($, z), $.length === 0 || z.length === 0 || $.length !== z.length ? !1 : O($, 0, z, 0, $.length) === 0; + var q = new Uint8Array(bt); + return Ce(q, $, $.length), q; + }, e.hash.hashLength = bt, e.verify = function($, q) { + return rt($, q), $.length === 0 || q.length === 0 || $.length !== q.length ? !1 : O($, 0, q, 0, $.length) === 0; }, e.setPRNG = function($) { n = $; }, function() { var $ = typeof self < "u" ? self.crypto || self.msCrypto : null; if ($ && $.getRandomValues) { - var z = 65536; + var q = 65536; e.setPRNG(function(H, C) { var G, j = new Uint8Array(C); - for (G = 0; G < C; G += z) - $.getRandomValues(j.subarray(G, G + Math.min(C - G, z))); + for (G = 0; G < C; G += q) + $.getRandomValues(j.subarray(G, G + Math.min(C - G, q))); for (G = 0; G < C; G++) H[G] = j[G]; Bt(j); }); @@ -41464,8 +41503,8 @@ var xA = { exports: {} }; }(); })(t.exports ? t.exports : self.nacl = self.nacl || {}); })(xA); -var Gie = xA.exports; -const Td = /* @__PURE__ */ ns(Gie); +var Jie = xA.exports; +const Td = /* @__PURE__ */ ns(Jie); var ha; (function(t) { t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.MANIFEST_NOT_FOUND_ERROR = 2] = "MANIFEST_NOT_FOUND_ERROR", t[t.MANIFEST_CONTENT_ERROR = 3] = "MANIFEST_CONTENT_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; @@ -41490,19 +41529,19 @@ var R5; (function(t) { t.MAINNET = "-239", t.TESTNET = "-3"; })(R5 || (R5 = {})); -function Yie(t, e) { +function Xie(t, e) { const r = zl.encodeBase64(t); return e ? encodeURIComponent(r) : r; } -function Jie(t, e) { +function Zie(t, e) { return e && (t = decodeURIComponent(t)), zl.decodeBase64(t); } -function Xie(t, e = !1) { +function Qie(t, e = !1) { let r; - return t instanceof Uint8Array ? r = t : (typeof t != "string" && (t = JSON.stringify(t)), r = zl.decodeUTF8(t)), Yie(r, e); + return t instanceof Uint8Array ? r = t : (typeof t != "string" && (t = JSON.stringify(t)), r = zl.decodeUTF8(t)), Xie(r, e); } -function Zie(t, e = !1) { - const r = Jie(t, e); +function ese(t, e = !1) { + const r = Zie(t, e); return { toString() { return zl.encodeUTF8(r); @@ -41520,14 +41559,14 @@ function Zie(t, e = !1) { }; } const _A = { - encode: Xie, - decode: Zie + encode: Qie, + decode: ese }; -function Qie(t, e) { +function tse(t, e) { const r = new Uint8Array(t.length + e.length); return r.set(t), r.set(e, t.length), r; } -function ese(t, e) { +function rse(t, e) { if (e >= t.length) throw new Error("Index is out of buffer"); const r = t.slice(0, e), n = t.slice(e); @@ -41565,10 +41604,10 @@ class Cv { } encrypt(e, r) { const n = new TextEncoder().encode(e), i = this.createNonce(), s = Td.box(n, i, r, this.keyPair.secretKey); - return Qie(i, s); + return tse(i, s); } decrypt(e, r) { - const [n, i] = ese(e, this.nonceLength), s = Td.box.open(i, n, r, this.keyPair.secretKey); + const [n, i] = rse(e, this.nonceLength), s = Td.box.open(i, n, r, this.keyPair.secretKey); if (!s) throw new Error(`Decryption error: message: ${e.toString()} @@ -41598,7 +41637,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ -function tse(t, e) { +function nse(t, e) { var r = {}; for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); if (t != null && typeof Object.getOwnPropertySymbols == "function") @@ -41683,7 +41722,7 @@ class B0 extends jt { super(...e), Object.setPrototypeOf(this, B0.prototype); } } -function rse(t) { +function ise(t) { return "jsBridgeKey" in t; } class Up extends jt { @@ -41739,14 +41778,14 @@ const D5 = { [ha.MANIFEST_NOT_FOUND_ERROR]: jp, [ha.MANIFEST_CONTENT_ERROR]: Fp }; -class nse { +class sse { parseError(e) { let r = Ca; return e.code in D5 && (r = D5[e.code] || Ca), new r(e.message); } } -const ise = new nse(); -class sse { +const ose = new sse(); +class ase { isError(e) { return "error" in e; } @@ -41757,7 +41796,7 @@ const O5 = { [gu.BAD_REQUEST_ERROR]: qp, [gu.UNKNOWN_APP_ERROR]: zp }; -class ose extends sse { +class cse extends ase { convertToRpcRequest(e) { return { method: "sendTransaction", @@ -41774,8 +41813,8 @@ class ose extends sse { }; } } -const Rd = new ose(); -class ase { +const Rd = new cse(); +class use { constructor(e, r) { this.storage = e, this.storeKey = "ton-connect-storage_http-bridge-gateway::" + r; } @@ -41796,19 +41835,19 @@ class ase { }); } } -function cse(t) { +function fse(t) { return t.slice(-1) === "/" ? t.slice(0, -1) : t; } function EA(t, e) { - return cse(t) + "/" + e; + return fse(t) + "/" + e; } -function use(t) { +function lse(t) { if (!t) return !1; const e = new URL(t); return e.protocol === "tg:" || e.hostname === "t.me"; } -function fse(t) { +function hse(t) { return t.replaceAll(".", "%2E").replaceAll("-", "%2D").replaceAll("_", "%5F").replaceAll("&", "-").replaceAll("=", "__").replaceAll("%", "--"); } function SA(t, e) { @@ -41830,7 +41869,7 @@ function As(t) { const e = new AbortController(); return t != null && t.aborted ? e.abort() : t == null || t.addEventListener("abort", () => e.abort(), { once: !0 }), e; } -function sl(t, e) { +function ol(t, e) { var r, n; return Mt(this, void 0, void 0, function* () { const i = (r = e == null ? void 0 : e.attempts) !== null && r !== void 0 ? r : 10, s = (n = e == null ? void 0 : e.delayMs) !== null && n !== void 0 ? n : 200, o = As(e == null ? void 0 : e.signal); @@ -41861,13 +41900,13 @@ function Bo(...t) { } catch { } } -function lse(...t) { +function dse(...t) { try { console.warn("[TON_CONNECT_SDK]", ...t); } catch { } } -function hse(t, e) { +function pse(t, e) { let r = null, n = null, i = null, s = null, o = null; const a = (p, ...w) => Mt(this, void 0, void 0, function* () { if (s = p ?? null, o == null || o.abort(), o = As(p), o.signal.aborted) @@ -41908,7 +41947,7 @@ function hse(t, e) { }) }; } -function dse(t, e) { +function gse(t, e) { const r = e == null ? void 0 : e.timeout, n = e == null ? void 0 : e.signal, i = As(n); return new Promise((s, o) => Mt(this, void 0, void 0, function* () { if (i.signal.aborted) { @@ -41931,7 +41970,7 @@ function dse(t, e) { } class a1 { constructor(e, r, n, i, s) { - this.bridgeUrl = r, this.sessionId = n, this.listener = i, this.errorsListener = s, this.ssePath = "events", this.postPath = "message", this.heartbeatMessage = "heartbeat", this.defaultTtl = 300, this.defaultReconnectDelay = 2e3, this.defaultResendDelay = 5e3, this.eventSource = hse((o, a) => Mt(this, void 0, void 0, function* () { + this.bridgeUrl = r, this.sessionId = n, this.listener = i, this.errorsListener = s, this.ssePath = "events", this.postPath = "message", this.heartbeatMessage = "heartbeat", this.defaultTtl = 300, this.defaultReconnectDelay = 2e3, this.defaultResendDelay = 5e3, this.eventSource = pse((o, a) => Mt(this, void 0, void 0, function* () { const u = { bridgeUrl: this.bridgeUrl, ssePath: this.ssePath, @@ -41942,10 +41981,10 @@ class a1 { signal: o, openingDeadlineMS: a }; - return yield pse(u); + return yield mse(u); }), (o) => Mt(this, void 0, void 0, function* () { o.close(); - })), this.bridgeGatewayStorage = new ase(e, r); + })), this.bridgeGatewayStorage = new use(e, r); } get isReady() { const e = this.eventSource.current(); @@ -41972,7 +42011,7 @@ class a1 { const a = new URL(EA(this.bridgeUrl, this.postPath)); a.searchParams.append("client_id", this.sessionId), a.searchParams.append("to", r), a.searchParams.append("ttl", ((o == null ? void 0 : o.ttl) || this.defaultTtl).toString()), a.searchParams.append("topic", n); const u = _A.encode(e); - yield sl((l) => Mt(this, void 0, void 0, function* () { + yield ol((l) => Mt(this, void 0, void 0, function* () { const d = yield this.post(a, u, l.signal); if (!d.ok) throw new jt(`Bridge send failed, status ${d.status}`); @@ -42044,9 +42083,9 @@ class a1 { }); } } -function pse(t) { +function mse(t) { return Mt(this, void 0, void 0, function* () { - return yield dse((e, r, n) => Mt(this, void 0, void 0, function* () { + return yield gse((e, r, n) => Mt(this, void 0, void 0, function* () { var i; const o = As(n.signal).signal; if (o.aborted) { @@ -42090,7 +42129,7 @@ function pse(t) { }), { timeout: t.openingDeadlineMS, signal: t.signal }); }); } -function ol(t) { +function al(t) { return !("connectEvent" in t); } class Wl { @@ -42101,7 +42140,7 @@ class Wl { return Mt(this, void 0, void 0, function* () { if (e.type === "injected") return this.storage.setItem(this.storeKey, JSON.stringify(e)); - if (!ol(e)) { + if (!al(e)) { const n = { sessionKeyPair: e.session.sessionCrypto.stringifyKeypair(), walletPublicKey: e.session.walletPublicKey, @@ -42174,7 +42213,7 @@ class Wl { throw new jt("Trying to read HTTP connection source while nothing is stored"); if (e.type === "injected") throw new jt("Trying to read HTTP connection source while injected connection is stored"); - if (!ol(e)) + if (!al(e)) throw new jt("Trying to read HTTP-pending connection while http connection is stored"); return e; }); @@ -42198,7 +42237,7 @@ class Wl { storeLastWalletEventId(e) { return Mt(this, void 0, void 0, function* () { const r = yield this.getConnection(); - if (r && r.type === "http" && !ol(r)) + if (r && r.type === "http" && !al(r)) return r.lastWalletEventId = e, this.storeConnection(r); }); } @@ -42233,7 +42272,7 @@ class Hl { static fromStorage(e) { return Mt(this, void 0, void 0, function* () { const n = yield new Wl(e).getHttpConnection(); - return ol(n) ? new Hl(e, n.connectionSource) : new Hl(e, { bridgeUrl: n.session.bridgeUrl }); + return al(n) ? new Hl(e, n.connectionSource) : new Hl(e, { bridgeUrl: n.session.bridgeUrl }); }); } connect(e, r) { @@ -42249,7 +42288,7 @@ class Hl { connectionSource: this.walletConnectionSource, sessionCrypto: s }).then(() => Mt(this, void 0, void 0, function* () { - i.signal.aborted || (yield sl((a) => { + i.signal.aborted || (yield ol((a) => { var u; return this.openGateways(s, { openingDeadlineMS: (u = r == null ? void 0 : r.openingDeadlineMS) !== null && u !== void 0 ? u : this.defaultOpeningDeadlineMS, @@ -42275,7 +42314,7 @@ class Hl { if (!s || i.signal.aborted) return; const o = (n = e == null ? void 0 : e.openingDeadlineMS) !== null && n !== void 0 ? n : this.defaultOpeningDeadlineMS; - if (ol(s)) + if (al(s)) return this.session = { sessionCrypto: s.sessionCrypto, bridgeUrl: "bridgeUrl" in this.walletConnectionSource ? this.walletConnectionSource.bridgeUrl : "" @@ -42288,7 +42327,7 @@ class Hl { if (this.session = s.session, this.gateway && (An("Gateway is already opened, closing previous gateway"), yield this.gateway.close()), this.gateway = new a1(this.storage, this.walletConnectionSource.bridgeUrl, s.session.sessionCrypto.sessionId, this.gatewayListener.bind(this), this.gatewayErrorsListener.bind(this)), !i.signal.aborted) { this.listeners.forEach((a) => a(s.connectEvent)); try { - yield sl((a) => this.gateway.registerSession({ + yield ol((a) => this.gateway.registerSession({ openingDeadlineMS: o, signal: a.signal }), { @@ -42417,14 +42456,14 @@ class Hl { }); } generateUniversalLink(e, r) { - return use(e) ? this.generateTGUniversalLink(e, r) : this.generateRegularUniversalLink(e, r); + return lse(e) ? this.generateTGUniversalLink(e, r) : this.generateRegularUniversalLink(e, r); } generateRegularUniversalLink(e, r) { const n = new URL(e); return n.searchParams.append("v", AA.toString()), n.searchParams.append("id", this.session.sessionCrypto.sessionId), n.searchParams.append("r", JSON.stringify(r)), n.toString(); } generateTGUniversalLink(e, r) { - const i = this.generateRegularUniversalLink("about:blank", r).split("?")[1], s = "tonconnect-" + fse(i), o = this.convertToDirectLink(e), a = new URL(o); + const i = this.generateRegularUniversalLink("about:blank", r).split("?")[1], s = "tonconnect-" + hse(i), o = this.convertToDirectLink(e), a = new URL(o); return a.searchParams.append("startapp", s), a.toString(); } // TODO: Remove this method after all dApps and the wallets-list.json have been updated @@ -42440,7 +42479,7 @@ class Hl { }, () => { }); return i.setListener((s) => this.pendingGatewaysListener(i, n.bridgeUrl, s)), i; - }), yield Promise.allSettled(this.pendingGateways.map((n) => sl((i) => { + }), yield Promise.allSettled(this.pendingGateways.map((n) => ol((i) => { var s; return this.pendingGateways.some((o) => o === n) ? n.registerSession({ openingDeadlineMS: (s = r == null ? void 0 : r.openingDeadlineMS) !== null && s !== void 0 ? s : this.defaultOpeningDeadlineMS, @@ -42470,7 +42509,7 @@ function N5(t, e) { function PA(t, e) { return !t || typeof t != "object" ? !1 : e.every((r) => r in t); } -function gse(t) { +function vse(t) { try { return !N5(t, "tonconnect") || !N5(t.tonconnect, "walletInfo") ? !1 : PA(t.tonconnect.walletInfo, [ "name", @@ -42516,7 +42555,7 @@ function Wp() { if (!(typeof window > "u")) return window; } -function mse() { +function bse() { const t = Wp(); if (!t) return []; @@ -42526,30 +42565,30 @@ function mse() { return []; } } -function vse() { +function yse() { if (!(typeof document > "u")) return document; } -function bse() { +function wse() { var t; const e = (t = Wp()) === null || t === void 0 ? void 0 : t.location.origin; return e ? e + "/tonconnect-manifest.json" : ""; } -function yse() { - if (wse()) +function xse() { + if (_se()) return localStorage; - if (xse()) + if (Ese()) throw new jt("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector"); return mu.getInstance(); } -function wse() { +function _se() { try { return typeof localStorage < "u"; } catch { return !1; } } -function xse() { +function Ese() { return typeof process < "u" && process.versions != null && process.versions.node != null; } class bi { @@ -42573,7 +42612,7 @@ class bi { return bi.isWindowContainsWallet(this.window, e) ? this.window[e].tonconnect.isWalletBrowser : !1; } static getCurrentlyInjectedWallets() { - return this.window ? mse().filter(([n, i]) => gse(i)).map(([n, i]) => ({ + return this.window ? bse().filter(([n, i]) => vse(i)).map(([n, i]) => ({ name: i.tonconnect.walletInfo.name, appName: i.tonconnect.walletInfo.app_name, aboutUrl: i.tonconnect.walletInfo.about_url, @@ -42673,9 +42712,9 @@ class bi { } } bi.window = Wp(); -class _se { +class Sse { constructor() { - this.localStorage = yse(); + this.localStorage = xse(); } getItem(e) { return Mt(this, void 0, void 0, function* () { @@ -42694,15 +42733,15 @@ class _se { } } function MA(t) { - return Sse(t) && t.injected; + return Pse(t) && t.injected; } -function Ese(t) { +function Ase(t) { return MA(t) && t.embedded; } -function Sse(t) { +function Pse(t) { return "jsBridgeKey" in t; } -const Ase = [ +const Mse = [ { app_name: "telegram-wallet", name: "Wallet", @@ -42917,7 +42956,7 @@ class Tv { } getEmbeddedWallet() { return Mt(this, void 0, void 0, function* () { - const r = (yield this.getWallets()).filter(Ese); + const r = (yield this.getWallets()).filter(Ase); return r.length !== 1 ? null : r[0]; }); } @@ -42930,7 +42969,7 @@ class Tv { const i = e.filter((s) => !this.isCorrectWalletConfigDTO(s)); i.length && (Bo(`Wallet(s) ${i.map((s) => s.name).join(", ")} config format is wrong. They were removed from the wallets list.`), e = e.filter((s) => this.isCorrectWalletConfigDTO(s))); } catch (n) { - Bo(n), e = Ase; + Bo(n), e = Mse; } let r = []; try { @@ -42990,7 +43029,7 @@ class F0 extends jt { super(...e), Object.setPrototypeOf(this, F0.prototype); } } -function Pse(t, e) { +function Ise(t, e) { const r = t.includes("SendTransaction"), n = t.find((i) => i && typeof i == "object" && i.name === "SendTransaction"); if (!r && !n) throw new F0("Wallet doesn't support SendTransaction feature."); @@ -42999,26 +43038,26 @@ function Pse(t, e) { throw new F0(`Wallet is not able to handle such SendTransaction request. Max support messages number is ${n.maxMessages}, but ${e.requiredMessagesNumber} is required.`); return; } - lse("Connected wallet didn't provide information about max allowed messages in the SendTransaction request. Request may be rejected by the wallet."); + dse("Connected wallet didn't provide information about max allowed messages in the SendTransaction request. Request may be rejected by the wallet."); } -function Mse() { +function Cse() { return { type: "request-version" }; } -function Ise(t) { +function Tse(t) { return { type: "response-version", version: t }; } -function rf(t) { +function nf(t) { return { ton_connect_sdk_lib: t.ton_connect_sdk_lib, ton_connect_ui_lib: t.ton_connect_ui_lib }; } -function nf(t, e) { +function sf(t, e) { var r, n, i, s, o, a, u, l; const p = ((r = e == null ? void 0 : e.connectItems) === null || r === void 0 ? void 0 : r.tonProof) && "proof" in e.connectItems.tonProof ? "ton_proof" : "ton_addr"; return { @@ -43026,42 +43065,42 @@ function nf(t, e) { wallet_type: (s = e == null ? void 0 : e.device.appName) !== null && s !== void 0 ? s : null, wallet_version: (o = e == null ? void 0 : e.device.appVersion) !== null && o !== void 0 ? o : null, auth_type: p, - custom_data: Object.assign({ chain_id: (u = (a = e == null ? void 0 : e.account) === null || a === void 0 ? void 0 : a.chain) !== null && u !== void 0 ? u : null, provider: (l = e == null ? void 0 : e.provider) !== null && l !== void 0 ? l : null }, rf(t)) + custom_data: Object.assign({ chain_id: (u = (a = e == null ? void 0 : e.account) === null || a === void 0 ? void 0 : a.chain) !== null && u !== void 0 ? u : null, provider: (l = e == null ? void 0 : e.provider) !== null && l !== void 0 ? l : null }, nf(t)) }; } -function Cse(t) { +function Rse(t) { return { type: "connection-started", - custom_data: rf(t) + custom_data: nf(t) }; } -function Tse(t, e) { - return Object.assign({ type: "connection-completed", is_success: !0 }, nf(t, e)); +function Dse(t, e) { + return Object.assign({ type: "connection-completed", is_success: !0 }, sf(t, e)); } -function Rse(t, e, r) { +function Ose(t, e, r) { return { type: "connection-error", is_success: !1, error_message: e, error_code: r ?? null, - custom_data: rf(t) + custom_data: nf(t) }; } -function Dse(t) { +function Nse(t) { return { type: "connection-restoring-started", - custom_data: rf(t) + custom_data: nf(t) }; } -function Ose(t, e) { - return Object.assign({ type: "connection-restoring-completed", is_success: !0 }, nf(t, e)); +function Lse(t, e) { + return Object.assign({ type: "connection-restoring-completed", is_success: !0 }, sf(t, e)); } -function Nse(t, e) { +function kse(t, e) { return { type: "connection-restoring-error", is_success: !1, error_message: e, - custom_data: rf(t) + custom_data: nf(t) }; } function Iy(t, e) { @@ -43078,19 +43117,19 @@ function Iy(t, e) { }) }; } -function Lse(t, e, r) { - return Object.assign(Object.assign({ type: "transaction-sent-for-signature" }, nf(t, e)), Iy(e, r)); +function $se(t, e, r) { + return Object.assign(Object.assign({ type: "transaction-sent-for-signature" }, sf(t, e)), Iy(e, r)); } -function kse(t, e, r, n) { - return Object.assign(Object.assign({ type: "transaction-signed", is_success: !0, signed_transaction: n.boc }, nf(t, e)), Iy(e, r)); +function Bse(t, e, r, n) { + return Object.assign(Object.assign({ type: "transaction-signed", is_success: !0, signed_transaction: n.boc }, sf(t, e)), Iy(e, r)); } -function $se(t, e, r, n, i) { - return Object.assign(Object.assign({ type: "transaction-signing-failed", is_success: !1, error_message: n, error_code: i ?? null }, nf(t, e)), Iy(e, r)); +function Fse(t, e, r, n, i) { + return Object.assign(Object.assign({ type: "transaction-signing-failed", is_success: !1, error_message: n, error_code: i ?? null }, sf(t, e)), Iy(e, r)); } -function Bse(t, e, r) { - return Object.assign({ type: "disconnection", scope: r }, nf(t, e)); +function jse(t, e, r) { + return Object.assign({ type: "disconnection", scope: r }, sf(t, e)); } -class Fse { +class Use { constructor() { this.window = Wp(); } @@ -43124,16 +43163,16 @@ class Fse { }); } } -class jse { +class qse { constructor(e) { var r; - this.eventPrefix = "ton-connect-", this.tonConnectUiVersion = null, this.eventDispatcher = (r = e == null ? void 0 : e.eventDispatcher) !== null && r !== void 0 ? r : new Fse(), this.tonConnectSdkVersion = e.tonConnectSdkVersion, this.init().catch(); + this.eventPrefix = "ton-connect-", this.tonConnectUiVersion = null, this.eventDispatcher = (r = e == null ? void 0 : e.eventDispatcher) !== null && r !== void 0 ? r : new Use(), this.tonConnectSdkVersion = e.tonConnectSdkVersion, this.init().catch(); } /** * Version of the library. */ get version() { - return rf({ + return nf({ ton_connect_sdk_lib: this.tonConnectSdkVersion, ton_connect_ui_lib: this.tonConnectUiVersion }); @@ -43156,7 +43195,7 @@ class jse { setRequestVersionHandler() { return Mt(this, void 0, void 0, function* () { yield this.eventDispatcher.addEventListener("ton-connect-request-version", () => Mt(this, void 0, void 0, function* () { - yield this.eventDispatcher.dispatchEvent("ton-connect-response-version", Ise(this.tonConnectSdkVersion)); + yield this.eventDispatcher.dispatchEvent("ton-connect-response-version", Tse(this.tonConnectSdkVersion)); })); }); } @@ -43170,7 +43209,7 @@ class jse { try { yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version", (n) => { e(n.detail.version); - }, { once: !0 }), yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version", Mse()); + }, { once: !0 }), yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version", Cse()); } catch (n) { r(n); } @@ -43194,7 +43233,7 @@ class jse { */ trackConnectionStarted(...e) { try { - const r = Cse(this.version, ...e); + const r = Rse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -43205,7 +43244,7 @@ class jse { */ trackConnectionCompleted(...e) { try { - const r = Tse(this.version, ...e); + const r = Dse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -43216,7 +43255,7 @@ class jse { */ trackConnectionError(...e) { try { - const r = Rse(this.version, ...e); + const r = Ose(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -43227,7 +43266,7 @@ class jse { */ trackConnectionRestoringStarted(...e) { try { - const r = Dse(this.version, ...e); + const r = Nse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -43238,7 +43277,7 @@ class jse { */ trackConnectionRestoringCompleted(...e) { try { - const r = Ose(this.version, ...e); + const r = Lse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -43249,7 +43288,7 @@ class jse { */ trackConnectionRestoringError(...e) { try { - const r = Nse(this.version, ...e); + const r = kse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -43260,7 +43299,7 @@ class jse { */ trackDisconnection(...e) { try { - const r = Bse(this.version, ...e); + const r = jse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -43271,7 +43310,7 @@ class jse { */ trackTransactionSentForSignature(...e) { try { - const r = Lse(this.version, ...e); + const r = $se(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -43282,7 +43321,7 @@ class jse { */ trackTransactionSigned(...e) { try { - const r = kse(this.version, ...e); + const r = Bse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } @@ -43293,24 +43332,24 @@ class jse { */ trackTransactionSigningFailed(...e) { try { - const r = $se(this.version, ...e); + const r = Fse(this.version, ...e); this.dispatchUserActionEvent(r); } catch { } } } -const Use = "3.0.5"; +const zse = "3.0.5"; class yh { constructor(e) { if (this.walletsList = new Tv(), this._wallet = null, this.provider = null, this.statusChangeSubscriptions = [], this.statusChangeErrorSubscriptions = [], this.dappSettings = { - manifestUrl: (e == null ? void 0 : e.manifestUrl) || bse(), - storage: (e == null ? void 0 : e.storage) || new _se() + manifestUrl: (e == null ? void 0 : e.manifestUrl) || wse(), + storage: (e == null ? void 0 : e.storage) || new Sse() }, this.walletsList = new Tv({ walletsListSource: e == null ? void 0 : e.walletsListSource, cacheTTLMs: e == null ? void 0 : e.walletsListCacheTTLMs - }), this.tracker = new jse({ + }), this.tracker = new qse({ eventDispatcher: e == null ? void 0 : e.eventDispatcher, - tonConnectSdkVersion: Use + tonConnectSdkVersion: zse }), !this.dappSettings.manifestUrl) throw new Sy("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"); this.bridgeConnectionStorage = new Wl(this.dappSettings.storage), e != null && e.disableAutoPauseConnection || this.addWindowFocusAndBlurSubscriptions(); @@ -43428,7 +43467,7 @@ class yh { this.tracker.trackConnectionRestoringError("Connection restoring was aborted"), a == null || a.closeConnection(), a = null; }; i.signal.addEventListener("abort", u); - const l = sl((p) => Mt(this, void 0, void 0, function* () { + const l = ol((p) => Mt(this, void 0, void 0, function* () { yield a == null ? void 0 : a.restoreConnection({ openingDeadlineMS: e == null ? void 0 : e.openingDeadlineMS, signal: p.signal @@ -43451,10 +43490,10 @@ class yh { const i = As(n == null ? void 0 : n.signal); if (i.signal.aborted) throw new jt("Transaction sending was aborted"); - this.checkConnection(), Pse(this.wallet.device.features, { + this.checkConnection(), Ise(this.wallet.device.features, { requiredMessagesNumber: e.messages.length }), this.tracker.trackTransactionSentForSignature(this.wallet, e); - const { validUntil: s } = e, o = tse(e, ["validUntil"]), a = e.from || this.account.address, u = e.network || this.account.chain, l = yield this.provider.sendRequest(Rd.convertToRpcRequest(Object.assign(Object.assign({}, o), { + const { validUntil: s } = e, o = nse(e, ["validUntil"]), a = e.from || this.account.address, u = e.network || this.account.chain, l = yield this.provider.sendRequest(Rd.convertToRpcRequest(Object.assign(Object.assign({}, o), { valid_until: s, from: a, network: u @@ -43497,7 +43536,7 @@ class yh { return ((e = this.provider) === null || e === void 0 ? void 0 : e.type) !== "http" ? Promise.resolve() : this.provider.unPause(); } addWindowFocusAndBlurSubscriptions() { - const e = vse(); + const e = yse(); if (e) try { e.addEventListener("visibilitychange", () => { @@ -43509,7 +43548,7 @@ class yh { } createProvider(e) { let r; - return !Array.isArray(e) && rse(e) ? r = new bi(this.dappSettings.storage, e.jsBridgeKey) : r = new Hl(this.dappSettings.storage, e), r.listen(this.walletEventsListener.bind(this)), r; + return !Array.isArray(e) && ise(e) ? r = new bi(this.dappSettings.storage, e.jsBridgeKey) : r = new Hl(this.dappSettings.storage, e), r.listen(this.walletEventsListener.bind(this)), r; } walletEventsListener(e) { switch (e.event) { @@ -43542,7 +43581,7 @@ class yh { }), this.wallet = i, this.tracker.trackConnectionCompleted(i); } onWalletConnectError(e) { - const r = ise.parseError(e); + const r = ose.parseError(e); if (this.statusChangeErrorSubscriptions.forEach((n) => n(r)), An(r), this.tracker.trackConnectionError(e.message, e.code), r instanceof jp || r instanceof Fp) throw Bo(r), r; } @@ -43625,7 +43664,7 @@ function IA(t) { } }), s.current.append(i.current); } - function q() { + function W() { r.connect(e, { request: { tonProof: u } }); @@ -43655,8 +43694,8 @@ function IA(t) { /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-justify-center xc-gap-2", children: [ n && /* @__PURE__ */ le.jsx(Sc, { className: "xc-animate-spin" }), !w && !n && /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ - MA(e) && /* @__PURE__ */ le.jsxs(c1, { onClick: q, children: [ - /* @__PURE__ */ le.jsx(GZ, { className: "xc-opacity-80" }), + MA(e) && /* @__PURE__ */ le.jsxs(c1, { onClick: W, children: [ + /* @__PURE__ */ le.jsx(YZ, { className: "xc-opacity-80" }), "Extension" ] }), Q && /* @__PURE__ */ le.jsxs(c1, { onClick: U, children: [ @@ -43668,7 +43707,7 @@ function IA(t) { ] }) ] }); } -function qse(t) { +function Wse(t) { const [e, r] = Yt(""), [n, i] = Yt(), [s, o] = Yt(), a = Ey(), [u, l] = Yt(!1); async function d(w) { var P, O; @@ -43756,7 +43795,7 @@ function CA(t) { } ); } -function zse() { +function Hse() { return /* @__PURE__ */ le.jsxs("svg", { width: "121", height: "120", viewBox: "0 0 121 120", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [ /* @__PURE__ */ le.jsx("rect", { x: "0.5", width: "120", height: "120", rx: "60", fill: "#404049" }), /* @__PURE__ */ le.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z", fill: "#252532" }), @@ -43787,10 +43826,10 @@ function TA(t) { onClick: s }, `feature-${a.key}` - )) : /* @__PURE__ */ le.jsx(zse, {}) }) + )) : /* @__PURE__ */ le.jsx(Hse, {}) }) ] }); } -function tae(t) { +function nae(t) { const { onLogin: e, header: r, showEmailSignIn: n = !0, showMoreWallets: i = !0, showTonConnect: s = !0, showFeaturedWallets: o = !0 } = t, [a, u] = Yt(""), [l, d] = Yt(null), [p, w] = Yt(""); function _(B) { d(B), u("evm-wallet"); @@ -43806,9 +43845,9 @@ function tae(t) { } return Dn(() => { u("index"); - }, []), /* @__PURE__ */ le.jsx(uie, { config: t.config, children: /* @__PURE__ */ le.jsxs(CA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ + }, []), /* @__PURE__ */ le.jsx(fie, { config: t.config, children: /* @__PURE__ */ le.jsxs(CA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ a === "evm-wallet" && /* @__PURE__ */ le.jsx( - Hie, + Vie, { onBack: () => u("index"), onLogin: O, @@ -43816,13 +43855,13 @@ function tae(t) { } ), a === "ton-wallet" && /* @__PURE__ */ le.jsx( - qse, + Wse, { onBack: () => u("index"), onLogin: O } ), - a === "email" && /* @__PURE__ */ le.jsx(Sie, { email: p, onBack: () => u("index"), onLogin: O }), + a === "email" && /* @__PURE__ */ le.jsx(Aie, { email: p, onBack: () => u("index"), onLogin: O }), a === "index" && /* @__PURE__ */ le.jsx( tA, { @@ -43850,7 +43889,7 @@ function tae(t) { ) ] }) }); } -function Wse(t) { +function Kse(t) { const { wallet: e, onConnect: r } = t, [n, i] = Yt(e.installed ? "connect" : "qr"); async function s(o, a) { await r(o, a); @@ -43876,7 +43915,7 @@ function Wse(t) { n === "get-extension" && /* @__PURE__ */ le.jsx(bA, { wallet: e }) ] }); } -function Hse(t) { +function Vse(t) { const { email: e } = t, [r, n] = Yt("captcha"); return /* @__PURE__ */ le.jsxs(Rs, { children: [ /* @__PURE__ */ le.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ le.jsx(kc, { title: "Sign in with email", onBack: t.onBack }) }), @@ -43884,7 +43923,7 @@ function Hse(t) { r === "verify-email" && /* @__PURE__ */ le.jsx(fA, { email: e, onInputCode: t.onInputCode, onResendCode: () => n("captcha") }) ] }); } -function rae(t) { +function iae(t) { const { onEvmWalletConnect: e, onTonWalletConnect: r, onEmailConnect: n, config: i = { showEmailSignIn: !1, showFeaturedWallets: !0, @@ -43911,7 +43950,7 @@ function rae(t) { function k(U) { d(U), o("ton-wallet-connect"); } - async function q(U) { + async function W(U) { U && await (r == null ? void 0 : r({ chain_type: "ton", client: p.current, @@ -43923,7 +43962,7 @@ function rae(t) { p.current = new yh({ manifestUrl: "https://static.codatta.io/static/tonconnect-manifest.json?v=2" }); - const U = p.current.onStatusChange(q); + const U = p.current.onStatusChange(W); return o("index"), U; }, []), /* @__PURE__ */ le.jsxs(CA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ s === "evm-wallet-select" && /* @__PURE__ */ le.jsx( @@ -43934,7 +43973,7 @@ function rae(t) { } ), s === "evm-wallet-connect" && /* @__PURE__ */ le.jsx( - Wse, + Kse, { onBack: () => o("index"), onConnect: L, @@ -43957,7 +43996,7 @@ function rae(t) { onBack: () => o("index") } ), - s === "email-connect" && /* @__PURE__ */ le.jsx(Hse, { email: w, onBack: () => o("index"), onInputCode: B }), + s === "email-connect" && /* @__PURE__ */ le.jsx(Vse, { email: w, onBack: () => o("index"), onInputCode: B }), s === "index" && /* @__PURE__ */ le.jsx( tA, { @@ -43971,22 +44010,22 @@ function rae(t) { ] }); } export { - Qoe as C, + tae as C, V5 as H, - Il as W, + yu as W, mc as a, XD as b, - Xse as c, - Yse as d, - al as e, + Qse as c, + Xse as d, + cl as e, n0 as f, r0 as g, - Jse as h, + Zse as h, HD as i, - jZ as j, - tae as k, - rae as l, - Zse as r, + UZ as j, + nae as k, + iae as l, + eoe as r, qN as s, q0 as t, Tp as u diff --git a/dist/secp256k1-D5_JzNmG.js b/dist/secp256k1-BeAu1v7B.js similarity index 99% rename from dist/secp256k1-D5_JzNmG.js rename to dist/secp256k1-BeAu1v7B.js index 3a4292e..e3bb459 100644 --- a/dist/secp256k1-D5_JzNmG.js +++ b/dist/secp256k1-BeAu1v7B.js @@ -1,4 +1,4 @@ -import { a as at, b as st, h as xt, i as Tt, c as F, H as Jt, d as te, t as ee, e as ne, f as qt, g as re, r as oe, s as ie } from "./main-D7TyRk7o.js"; +import { a as at, b as st, h as xt, i as Tt, c as F, H as Jt, d as te, t as ee, e as ne, f as qt, g as re, r as oe, s as ie } from "./main-bMMpd4wM.js"; /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const St = /* @__PURE__ */ BigInt(0), Et = /* @__PURE__ */ BigInt(1); function lt(e, n) { diff --git a/lib/codatta-connect-context-provider.tsx b/lib/codatta-connect-context-provider.tsx index c6e4316..a58e00b 100644 --- a/lib/codatta-connect-context-provider.tsx +++ b/lib/codatta-connect-context-provider.tsx @@ -133,23 +133,15 @@ export function CodattaConnectContextProvider(props: CodattaConnectContextProvid try { const lastUsedInfo = JSON.parse(localStorage.getItem('xn-last-used-info') || '{}') as LastUsedWalletInfo const lastUsedWallet = walletMap.get(lastUsedInfo.key) - if (lastUsedWallet) { - lastUsedWallet.lastUsed = true - - // Restore provider based on the saved provider type - if (lastUsedInfo.provider === 'UniversalProvider') { - const provider = await UniversalProvider.init(walletConnectConfig) - if (provider.session) { - lastUsedWallet.setUniversalProvider(provider) - console.log('Restored UniversalProvider for wallet:', lastUsedWallet.key) - } - } else if (lastUsedInfo.provider === 'EIP1193Provider' && lastUsedWallet.installed) { - // For EIP1193 providers, if the wallet is installed, it should already have the provider - // from the EIP6963 detection process above - console.log('Using detected EIP1193Provider for wallet:', lastUsedWallet.key) - } - + if (lastUsedWallet && lastUsedInfo.provider === 'EIP1193Provider' && lastUsedWallet.installed) { setLastUsedWallet(lastUsedWallet) + } else if (lastUsedInfo.provider === 'UniversalProvider') { + const provider = await UniversalProvider.init(walletConnectConfig) + if (provider.session) { + const universalWallet = new WalletItem(provider) + setLastUsedWallet(universalWallet) + console.log('Restored UniversalProvider for wallet:', universalWallet.key) + } } } catch (err) { console.log(err) diff --git a/lib/components/wallet-qr.tsx b/lib/components/wallet-qr.tsx index a8c73df..51a5322 100644 --- a/lib/components/wallet-qr.tsx +++ b/lib/components/wallet-qr.tsx @@ -111,6 +111,7 @@ export default function WalletQr(props: { address, wallet_name: newWallet.config?.name || wallet.config?.name || '' }) + console.log('save wallet connect wallet!') saveLastUsedWallet(newWallet) } catch (err: any) { console.log('err', err) diff --git a/lib/types/wallet-item.class.ts b/lib/types/wallet-item.class.ts index 6b099cc..610b70d 100644 --- a/lib/types/wallet-item.class.ts +++ b/lib/types/wallet-item.class.ts @@ -73,6 +73,7 @@ export class WalletItem { image: params.session.peer.metadata.icons[0], featured: false, } + this.testConnect() } else if ('info' in params) { // eip6963 this._key = params.info.name diff --git a/package.json b/package.json index 38f9958..7fd70f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codatta-connect", - "version": "2.5.3", + "version": "2.5.6", "type": "module", "main": "./dist/index.umd.js", "module": "./dist/index.es.js", From 103e343b51181d9a4b468c0e6dea7edbd829cb3d Mon Sep 17 00:00:00 2001 From: Meow Lord Date: Thu, 14 Aug 2025 21:21:21 +0800 Subject: [PATCH 20/25] change chain to bian --- dist/index.es.js | 2 +- dist/index.umd.js | 2 +- dist/{main-bMMpd4wM.js => main-L4HtPONr.js} | 468 +++++++++--------- ...56k1-BeAu1v7B.js => secp256k1-BScNrxtE.js} | 2 +- lib/components/wallet-qr.tsx | 4 +- package.json | 2 +- 6 files changed, 240 insertions(+), 240 deletions(-) rename dist/{main-bMMpd4wM.js => main-L4HtPONr.js} (99%) rename dist/{secp256k1-BeAu1v7B.js => secp256k1-BScNrxtE.js} (99%) diff --git a/dist/index.es.js b/dist/index.es.js index 73d7ffc..bf70baa 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -1,4 +1,4 @@ -import { l as o, C as e, k as n, W as C, j as s, u as d } from "./main-bMMpd4wM.js"; +import { l as o, C as e, k as n, W as C, j as s, u as d } from "./main-L4HtPONr.js"; export { o as CodattaConnect, e as CodattaConnectContextProvider, diff --git a/dist/index.umd.js b/dist/index.umd.js index 61882f2..3250d1f 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -237,7 +237,7 @@ Not Before: ${o.toISOString()}`),a&&(L+=` Request ID: ${a}`),u){let B=` Resources:`;for(const k of u){if(!Q7(k))throw new Ca({field:"resources",metaMessages:["- Every resource must be a RFC 3986 URI.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${k}`]});B+=` - ${k}`}L+=B}return`${O} -${L}`}const HZ=/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/,WZ=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/,KZ=/^localhost(:[0-9]{1,5})?$/,VZ=/^[a-zA-Z0-9]{8,}$/,GZ=/^([a-zA-Z][a-zA-Z0-9+-.]*)$/,t9="7a4434fefbcc9af474fb5c995e47d286",YZ={projectId:t9,metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},JZ={namespaces:{eip155:{methods:["eth_sendTransaction","eth_signTransaction","eth_sign","personal_sign","eth_signTypedData"],chains:["eip155:1"],events:["chainChanged","accountsChanged","disconnect"],rpcMap:{1:`https://rpc.walletconnect.com?chainId=eip155:1&projectId=${t9}`}}},skipPairing:!1};function XZ(t,e){const r=window.location.host,n=window.location.href;return e9({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function r9(t){var ie,me,j;const e=Ee.useRef(null),{wallet:r,onGetExtension:n,onSignFinish:i}=t,[s,o]=Ee.useState(""),[a,u]=Ee.useState(!1),[l,d]=Ee.useState(""),[p,y]=Ee.useState("scan"),_=Ee.useRef(),[M,O]=Ee.useState((ie=r.config)==null?void 0:ie.image),[L,B]=Ee.useState(!1),{saveLastUsedWallet:k}=Yl();async function H(E){var f,g,v,x;u(!0);const m=await Wz.init(YZ);m.session&&await m.disconnect();try{if(y("scan"),m.on("display_uri",ce=>{o(ce),u(!1),y("scan")}),m.on("error",ce=>{console.log(ce)}),m.on("session_update",ce=>{console.log("session_update",ce)}),!await m.connect(JZ))throw new Error("Walletconnect init failed");const A=new Ga(m);O(((f=A.config)==null?void 0:f.image)||((g=E.config)==null?void 0:g.image));const b=await A.getAddress(),P=await xa.getNonce({account_type:"block_chain"});console.log("get nonce",P);const I=XZ(b,P);y("sign");const F=await A.signMessage(I,b);y("waiting"),await i(A,{message:I,nonce:P,signature:F,address:b,wallet_name:((v=A.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),console.log("save wallet connect wallet!"),k(A)}catch(S){console.log("err",S),d(S.details||S.message)}}function U(){_.current=new Z7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),_.current.append(e.current)}function z(E){var m;console.log(_.current),(m=_.current)==null||m.update({data:E})}Ee.useEffect(()=>{s&&z(s)},[s]),Ee.useEffect(()=>{H(r)},[r]),Ee.useEffect(()=>{U()},[]);function Z(){d(""),z(""),H(r)}function R(){B(!0),navigator.clipboard.writeText(s),setTimeout(()=>{B(!1)},2500)}function W(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return le.jsxs("div",{children:[le.jsx("div",{className:"xc-text-center",children:le.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[le.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),le.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?le.jsx(Sc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):le.jsx("img",{className:"xc-h-10 xc-w-10",src:M})})]})}),le.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[le.jsx("button",{disabled:!s,onClick:R,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:L?le.jsxs(le.Fragment,{children:[" ",le.jsx(hV,{})," Copied!"]}):le.jsxs(le.Fragment,{children:[le.jsx(gV,{}),"Copy QR URL"]})}),((me=r.config)==null?void 0:me.getWallet)&&le.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[le.jsx(dV,{}),"Get Extension"]}),((j=r.config)==null?void 0:j.desktop_link)&&le.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:W,children:[le.jsx(F8,{}),"Desktop"]})]}),le.jsx("div",{className:"xc-text-center",children:l?le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),le.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:Z,children:"Retry"})]}):le.jsxs(le.Fragment,{children:[p==="scan"&&le.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),p==="connect"&&le.jsx("p",{children:"Click connect in your wallet app"}),p==="sign"&&le.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),p==="waiting"&&le.jsx("div",{className:"xc-text-center",children:le.jsx(Sc,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const ZZ=RC({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),QZ="Accept connection request in the wallet",eQ="Accept sign-in request in your wallet";function tQ(t,e,r){const n=window.location.host,i=window.location.href;return e9({address:t,chainId:r,domain:n,nonce:e,uri:i,version:"1"})}function n9(t){var y;const[e,r]=Ee.useState(),{wallet:n,onSignFinish:i}=t,s=Ee.useRef(),[o,a]=Ee.useState("connect"),{saveLastUsedWallet:u,chains:l}=Yl();async function d(_){var M;try{a("connect");const O=await n.connect();if(!O||O.length===0)throw new Error("Wallet connect error");const L=await n.getChain(),B=l.find(Z=>Z.id===L),k=B||l[0]||ZZ;!B&&l.length>0&&(a("switch-chain"),await n.switchChain(k));const H=yg(O[0]),U=tQ(H,_,k.id);a("sign");const z=await n.signMessage(U,H);if(!z||z.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:H,signature:z,message:U,nonce:_,wallet_name:((M=n.config)==null?void 0:M.name)||""}),u(n)}catch(O){console.log("walletSignin error",O.stack),console.log(O.details||O.message),r(O.details||O.message)}}async function p(){try{r("");const _=await xa.getNonce({account_type:"block_chain"});s.current=_,d(s.current)}catch(_){console.log(_.details),r(_.message)}}return Ee.useEffect(()=>{p()},[]),le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[le.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(y=n.config)==null?void 0:y.image,alt:""}),e&&le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),le.jsx("div",{className:"xc-flex xc-gap-2",children:le.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:p,children:"Retry"})})]}),!e&&le.jsxs(le.Fragment,{children:[o==="connect"&&le.jsx("span",{className:"xc-text-center",children:QZ}),o==="sign"&&le.jsx("span",{className:"xc-text-center",children:eQ}),o==="waiting"&&le.jsx("span",{className:"xc-text-center",children:le.jsx(Sc,{className:"xc-animate-spin"})}),o==="switch-chain"&&le.jsxs("span",{className:"xc-text-center",children:["Switch to ",l[0].name]})]})]})}const Gu="https://static.codatta.io/codatta-connect/wallet-icons.svg",rQ="https://itunes.apple.com/app/",nQ="https://play.google.com/store/apps/details?id=",iQ="https://chromewebstore.google.com/detail/",sQ="https://chromewebstore.google.com/detail/",oQ="https://addons.mozilla.org/en-US/firefox/addon/",aQ="https://microsoftedge.microsoft.com/addons/detail/";function Yu(t){const{icon:e,title:r,link:n}=t;return le.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[le.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,le.jsx($8,{className:"xc-ml-auto xc-text-gray-400"})]})}function cQ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${rQ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${nQ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${iQ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${sQ}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${oQ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${aQ}${t.edge_addon_id}`),e}function i9(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=cQ(r);return le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),le.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),le.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),le.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&le.jsx(Yu,{link:n.chromeStoreLink,icon:`${Gu}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&le.jsx(Yu,{link:n.appStoreLink,icon:`${Gu}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&le.jsx(Yu,{link:n.playStoreLink,icon:`${Gu}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&le.jsx(Yu,{link:n.edgeStoreLink,icon:`${Gu}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&le.jsx(Yu,{link:n.braveStoreLink,icon:`${Gu}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&le.jsx(Yu,{link:n.firefoxStoreLink,icon:`${Gu}#firefox`,title:"Mozilla Firefox"})]})]})}function uQ(t){const{wallet:e}=t,[r,n]=Ee.useState(e.installed?"connect":"qr"),i=Bb();async function s(o,a){var l;const u=await xa.walletLogin({account_type:"block_chain",account_enum:i.role,connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Rc,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&le.jsx(r9,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&le.jsx(n9,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&le.jsx(i9,{wallet:e})]})}function fQ(t){const{wallet:e,onClick:r}=t,n=le.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return le.jsx(Ob,{icon:n,title:i,onClick:()=>r(e)})}function s9(t){const{connector:e}=t,[r,n]=Ee.useState(),[i,s]=Ee.useState([]),o=Ee.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d)}Ee.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Rc,{title:"Select wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[le.jsx(j8,{className:"xc-shrink-0 xc-opacity-50"}),le.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),le.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>le.jsx(fQ,{wallet:d,onClick:l},d.name))})]})}var o9={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,$[K+1]=G>>16&255,$[K+2]=G>>8&255,$[K+3]=G&255,$[K+4]=C>>24&255,$[K+5]=C>>16&255,$[K+6]=C>>8&255,$[K+7]=C&255}function O($,K,G,C,Y){var q,ae=0;for(q=0;q>>8)-1}function L($,K,G,C){return O($,K,G,C,16)}function B($,K,G,C){return O($,K,G,C,32)}function k($,K,G,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=G[0]&255|(G[1]&255)<<8|(G[2]&255)<<16|(G[3]&255)<<24,ae=G[4]&255|(G[5]&255)<<8|(G[6]&255)<<16|(G[7]&255)<<24,pe=G[8]&255|(G[9]&255)<<8|(G[10]&255)<<16|(G[11]&255)<<24,_e=G[12]&255|(G[13]&255)<<8|(G[14]&255)<<16|(G[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=K[0]&255|(K[1]&255)<<8|(K[2]&255)<<16|(K[3]&255)<<24,it=K[4]&255|(K[5]&255)<<8|(K[6]&255)<<16|(K[7]&255)<<24,Ue=K[8]&255|(K[9]&255)<<8|(K[10]&255)<<16|(K[11]&255)<<24,mt=K[12]&255|(K[13]&255)<<8|(K[14]&255)<<16|(K[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=G[16]&255|(G[17]&255)<<8|(G[18]&255)<<16|(G[19]&255)<<24,At=G[20]&255|(G[21]&255)<<8|(G[22]&255)<<16|(G[23]&255)<<24,Rt=G[24]&255|(G[25]&255)<<8|(G[26]&255)<<16|(G[27]&255)<<24,Mt=G[28]&255|(G[29]&255)<<8|(G[30]&255)<<16|(G[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=ae,wt=pe,lt=_e,at=Re,Ae=De,Pe=it,Ge=Ue,je=mt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;dt=dt+Y|0,_t=_t+q|0,ot=ot+ae|0,wt=wt+pe|0,lt=lt+_e|0,at=at+Re|0,Ae=Ae+De|0,Pe=Pe+it|0,Ge=Ge+Ue|0,je=je+mt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=_t>>>0&255,$[5]=_t>>>8&255,$[6]=_t>>>16&255,$[7]=_t>>>24&255,$[8]=ot>>>0&255,$[9]=ot>>>8&255,$[10]=ot>>>16&255,$[11]=ot>>>24&255,$[12]=wt>>>0&255,$[13]=wt>>>8&255,$[14]=wt>>>16&255,$[15]=wt>>>24&255,$[16]=lt>>>0&255,$[17]=lt>>>8&255,$[18]=lt>>>16&255,$[19]=lt>>>24&255,$[20]=at>>>0&255,$[21]=at>>>8&255,$[22]=at>>>16&255,$[23]=at>>>24&255,$[24]=Ae>>>0&255,$[25]=Ae>>>8&255,$[26]=Ae>>>16&255,$[27]=Ae>>>24&255,$[28]=Pe>>>0&255,$[29]=Pe>>>8&255,$[30]=Pe>>>16&255,$[31]=Pe>>>24&255,$[32]=Ge>>>0&255,$[33]=Ge>>>8&255,$[34]=Ge>>>16&255,$[35]=Ge>>>24&255,$[36]=je>>>0&255,$[37]=je>>>8&255,$[38]=je>>>16&255,$[39]=je>>>24&255,$[40]=qe>>>0&255,$[41]=qe>>>8&255,$[42]=qe>>>16&255,$[43]=qe>>>24&255,$[44]=Xe>>>0&255,$[45]=Xe>>>8&255,$[46]=Xe>>>16&255,$[47]=Xe>>>24&255,$[48]=kt>>>0&255,$[49]=kt>>>8&255,$[50]=kt>>>16&255,$[51]=kt>>>24&255,$[52]=Wt>>>0&255,$[53]=Wt>>>8&255,$[54]=Wt>>>16&255,$[55]=Wt>>>24&255,$[56]=Zt>>>0&255,$[57]=Zt>>>8&255,$[58]=Zt>>>16&255,$[59]=Zt>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255}function H($,K,G,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=G[0]&255|(G[1]&255)<<8|(G[2]&255)<<16|(G[3]&255)<<24,ae=G[4]&255|(G[5]&255)<<8|(G[6]&255)<<16|(G[7]&255)<<24,pe=G[8]&255|(G[9]&255)<<8|(G[10]&255)<<16|(G[11]&255)<<24,_e=G[12]&255|(G[13]&255)<<8|(G[14]&255)<<16|(G[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=K[0]&255|(K[1]&255)<<8|(K[2]&255)<<16|(K[3]&255)<<24,it=K[4]&255|(K[5]&255)<<8|(K[6]&255)<<16|(K[7]&255)<<24,Ue=K[8]&255|(K[9]&255)<<8|(K[10]&255)<<16|(K[11]&255)<<24,mt=K[12]&255|(K[13]&255)<<8|(K[14]&255)<<16|(K[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=G[16]&255|(G[17]&255)<<8|(G[18]&255)<<16|(G[19]&255)<<24,At=G[20]&255|(G[21]&255)<<8|(G[22]&255)<<16|(G[23]&255)<<24,Rt=G[24]&255|(G[25]&255)<<8|(G[26]&255)<<16|(G[27]&255)<<24,Mt=G[28]&255|(G[29]&255)<<8|(G[30]&255)<<16|(G[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=ae,wt=pe,lt=_e,at=Re,Ae=De,Pe=it,Ge=Ue,je=mt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=at>>>0&255,$[5]=at>>>8&255,$[6]=at>>>16&255,$[7]=at>>>24&255,$[8]=qe>>>0&255,$[9]=qe>>>8&255,$[10]=qe>>>16&255,$[11]=qe>>>24&255,$[12]=Kt>>>0&255,$[13]=Kt>>>8&255,$[14]=Kt>>>16&255,$[15]=Kt>>>24&255,$[16]=Ae>>>0&255,$[17]=Ae>>>8&255,$[18]=Ae>>>16&255,$[19]=Ae>>>24&255,$[20]=Pe>>>0&255,$[21]=Pe>>>8&255,$[22]=Pe>>>16&255,$[23]=Pe>>>24&255,$[24]=Ge>>>0&255,$[25]=Ge>>>8&255,$[26]=Ge>>>16&255,$[27]=Ge>>>24&255,$[28]=je>>>0&255,$[29]=je>>>8&255,$[30]=je>>>16&255,$[31]=je>>>24&255}function U($,K,G,C){k($,K,G,C)}function z($,K,G,C){H($,K,G,C)}var Z=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function R($,K,G,C,Y,q,ae){var pe=new Uint8Array(16),_e=new Uint8Array(64),Re,De;for(De=0;De<16;De++)pe[De]=0;for(De=0;De<8;De++)pe[De]=q[De];for(;Y>=64;){for(U(_e,pe,ae,Z),De=0;De<64;De++)$[K+De]=G[C+De]^_e[De];for(Re=1,De=8;De<16;De++)Re=Re+(pe[De]&255)|0,pe[De]=Re&255,Re>>>=8;Y-=64,K+=64,C+=64}if(Y>0)for(U(_e,pe,ae,Z),De=0;De=64;){for(U(ae,q,Y,Z),_e=0;_e<64;_e++)$[K+_e]=ae[_e];for(pe=1,_e=8;_e<16;_e++)pe=pe+(q[_e]&255)|0,q[_e]=pe&255,pe>>>=8;G-=64,K+=64}if(G>0)for(U(ae,q,Y,Z),_e=0;_e>>13|G<<3)&8191,C=$[4]&255|($[5]&255)<<8,this.r[2]=(G>>>10|C<<6)&7939,Y=$[6]&255|($[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,q=$[8]&255|($[9]&255)<<8,this.r[4]=(Y>>>4|q<<12)&255,this.r[5]=q>>>1&8190,ae=$[10]&255|($[11]&255)<<8,this.r[6]=(q>>>14|ae<<2)&8191,pe=$[12]&255|($[13]&255)<<8,this.r[7]=(ae>>>11|pe<<5)&8065,_e=$[14]&255|($[15]&255)<<8,this.r[8]=(pe>>>8|_e<<8)&8191,this.r[9]=_e>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};j.prototype.blocks=function($,K,G){for(var C=this.fin?0:2048,Y,q,ae,pe,_e,Re,De,it,Ue,mt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Ae=this.h[3],Pe=this.h[4],Ge=this.h[5],je=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],de=this.r[3],nr=this.r[4],pr=this.r[5],gr=this.r[6],Qt=this.r[7],mr=this.r[8],lr=this.r[9];G>=16;)Y=$[K+0]&255|($[K+1]&255)<<8,wt+=Y&8191,q=$[K+2]&255|($[K+3]&255)<<8,lt+=(Y>>>13|q<<3)&8191,ae=$[K+4]&255|($[K+5]&255)<<8,at+=(q>>>10|ae<<6)&8191,pe=$[K+6]&255|($[K+7]&255)<<8,Ae+=(ae>>>7|pe<<9)&8191,_e=$[K+8]&255|($[K+9]&255)<<8,Pe+=(pe>>>4|_e<<12)&8191,Ge+=_e>>>1&8191,Re=$[K+10]&255|($[K+11]&255)<<8,je+=(_e>>>14|Re<<2)&8191,De=$[K+12]&255|($[K+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=$[K+14]&255|($[K+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,Ue=0,mt=Ue,mt+=wt*Wt,mt+=lt*(5*lr),mt+=at*(5*mr),mt+=Ae*(5*Qt),mt+=Pe*(5*gr),Ue=mt>>>13,mt&=8191,mt+=Ge*(5*pr),mt+=je*(5*nr),mt+=qe*(5*de),mt+=Xe*(5*Kt),mt+=kt*(5*Zt),Ue+=mt>>>13,mt&=8191,st=Ue,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Ae*(5*mr),st+=Pe*(5*Qt),Ue=st>>>13,st&=8191,st+=Ge*(5*gr),st+=je*(5*pr),st+=qe*(5*nr),st+=Xe*(5*de),st+=kt*(5*Kt),Ue+=st>>>13,st&=8191,tt=Ue,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Ae*(5*lr),tt+=Pe*(5*mr),Ue=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=je*(5*gr),tt+=qe*(5*pr),tt+=Xe*(5*nr),tt+=kt*(5*de),Ue+=tt>>>13,tt&=8191,At=Ue,At+=wt*de,At+=lt*Kt,At+=at*Zt,At+=Ae*Wt,At+=Pe*(5*lr),Ue=At>>>13,At&=8191,At+=Ge*(5*mr),At+=je*(5*Qt),At+=qe*(5*gr),At+=Xe*(5*pr),At+=kt*(5*nr),Ue+=At>>>13,At&=8191,Rt=Ue,Rt+=wt*nr,Rt+=lt*de,Rt+=at*Kt,Rt+=Ae*Zt,Rt+=Pe*Wt,Ue=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=je*(5*mr),Rt+=qe*(5*Qt),Rt+=Xe*(5*gr),Rt+=kt*(5*pr),Ue+=Rt>>>13,Rt&=8191,Mt=Ue,Mt+=wt*pr,Mt+=lt*nr,Mt+=at*de,Mt+=Ae*Kt,Mt+=Pe*Zt,Ue=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=je*(5*lr),Mt+=qe*(5*mr),Mt+=Xe*(5*Qt),Mt+=kt*(5*gr),Ue+=Mt>>>13,Mt&=8191,Et=Ue,Et+=wt*gr,Et+=lt*pr,Et+=at*nr,Et+=Ae*de,Et+=Pe*Kt,Ue=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=je*Wt,Et+=qe*(5*lr),Et+=Xe*(5*mr),Et+=kt*(5*Qt),Ue+=Et>>>13,Et&=8191,dt=Ue,dt+=wt*Qt,dt+=lt*gr,dt+=at*pr,dt+=Ae*nr,dt+=Pe*de,Ue=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=je*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*mr),Ue+=dt>>>13,dt&=8191,_t=Ue,_t+=wt*mr,_t+=lt*Qt,_t+=at*gr,_t+=Ae*pr,_t+=Pe*nr,Ue=_t>>>13,_t&=8191,_t+=Ge*de,_t+=je*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),Ue+=_t>>>13,_t&=8191,ot=Ue,ot+=wt*lr,ot+=lt*mr,ot+=at*Qt,ot+=Ae*gr,ot+=Pe*pr,Ue=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=je*de,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,Ue+=ot>>>13,ot&=8191,Ue=(Ue<<2)+Ue|0,Ue=Ue+mt|0,mt=Ue&8191,Ue=Ue>>>13,st+=Ue,wt=mt,lt=st,at=tt,Ae=At,Pe=Rt,Ge=Mt,je=Et,qe=dt,Xe=_t,kt=ot,K+=16,G-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Ae,this.h[4]=Pe,this.h[5]=Ge,this.h[6]=je,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},j.prototype.finish=function($,K){var G=new Uint16Array(10),C,Y,q,ae;if(this.leftover){for(ae=this.leftover,this.buffer[ae++]=1;ae<16;ae++)this.buffer[ae]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,ae=2;ae<10;ae++)this.h[ae]+=C,C=this.h[ae]>>>13,this.h[ae]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,G[0]=this.h[0]+5,C=G[0]>>>13,G[0]&=8191,ae=1;ae<10;ae++)G[ae]=this.h[ae]+C,C=G[ae]>>>13,G[ae]&=8191;for(G[9]-=8192,Y=(C^1)-1,ae=0;ae<10;ae++)G[ae]&=Y;for(Y=~Y,ae=0;ae<10;ae++)this.h[ae]=this.h[ae]&Y|G[ae];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,q=this.h[0]+this.pad[0],this.h[0]=q&65535,ae=1;ae<8;ae++)q=(this.h[ae]+this.pad[ae]|0)+(q>>>16)|0,this.h[ae]=q&65535;$[K+0]=this.h[0]>>>0&255,$[K+1]=this.h[0]>>>8&255,$[K+2]=this.h[1]>>>0&255,$[K+3]=this.h[1]>>>8&255,$[K+4]=this.h[2]>>>0&255,$[K+5]=this.h[2]>>>8&255,$[K+6]=this.h[3]>>>0&255,$[K+7]=this.h[3]>>>8&255,$[K+8]=this.h[4]>>>0&255,$[K+9]=this.h[4]>>>8&255,$[K+10]=this.h[5]>>>0&255,$[K+11]=this.h[5]>>>8&255,$[K+12]=this.h[6]>>>0&255,$[K+13]=this.h[6]>>>8&255,$[K+14]=this.h[7]>>>0&255,$[K+15]=this.h[7]>>>8&255},j.prototype.update=function($,K,G){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>G&&(Y=G),C=0;C=16&&(Y=G-G%16,this.blocks($,K,Y),K+=Y,G-=Y),G){for(C=0;C>16&1),q[G-1]&=65535;q[15]=ae[15]-32767-(q[14]>>16&1),Y=q[15]>>16&1,q[14]&=65535,S(ae,q,1-Y)}for(G=0;G<16;G++)$[2*G]=ae[G]&255,$[2*G+1]=ae[G]>>8}function b($,K){var G=new Uint8Array(32),C=new Uint8Array(32);return A(G,$),A(C,K),B(G,0,C,0)}function P($){var K=new Uint8Array(32);return A(K,$),K[0]&1}function I($,K){var G;for(G=0;G<16;G++)$[G]=K[2*G]+(K[2*G+1]<<8);$[15]&=32767}function F($,K,G){for(var C=0;C<16;C++)$[C]=K[C]+G[C]}function ce($,K,G){for(var C=0;C<16;C++)$[C]=K[C]-G[C]}function D($,K,G){var C,Y,q=0,ae=0,pe=0,_e=0,Re=0,De=0,it=0,Ue=0,mt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Ae=0,Pe=0,Ge=0,je=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,de=G[0],nr=G[1],pr=G[2],gr=G[3],Qt=G[4],mr=G[5],lr=G[6],Lr=G[7],vr=G[8],xr=G[9],Br=G[10],$r=G[11],Ir=G[12],ln=G[13],hn=G[14],dn=G[15];C=K[0],q+=C*de,ae+=C*nr,pe+=C*pr,_e+=C*gr,Re+=C*Qt,De+=C*mr,it+=C*lr,Ue+=C*Lr,mt+=C*vr,st+=C*xr,tt+=C*Br,At+=C*$r,Rt+=C*Ir,Mt+=C*ln,Et+=C*hn,dt+=C*dn,C=K[1],ae+=C*de,pe+=C*nr,_e+=C*pr,Re+=C*gr,De+=C*Qt,it+=C*mr,Ue+=C*lr,mt+=C*Lr,st+=C*vr,tt+=C*xr,At+=C*Br,Rt+=C*$r,Mt+=C*Ir,Et+=C*ln,dt+=C*hn,_t+=C*dn,C=K[2],pe+=C*de,_e+=C*nr,Re+=C*pr,De+=C*gr,it+=C*Qt,Ue+=C*mr,mt+=C*lr,st+=C*Lr,tt+=C*vr,At+=C*xr,Rt+=C*Br,Mt+=C*$r,Et+=C*Ir,dt+=C*ln,_t+=C*hn,ot+=C*dn,C=K[3],_e+=C*de,Re+=C*nr,De+=C*pr,it+=C*gr,Ue+=C*Qt,mt+=C*mr,st+=C*lr,tt+=C*Lr,At+=C*vr,Rt+=C*xr,Mt+=C*Br,Et+=C*$r,dt+=C*Ir,_t+=C*ln,ot+=C*hn,wt+=C*dn,C=K[4],Re+=C*de,De+=C*nr,it+=C*pr,Ue+=C*gr,mt+=C*Qt,st+=C*mr,tt+=C*lr,At+=C*Lr,Rt+=C*vr,Mt+=C*xr,Et+=C*Br,dt+=C*$r,_t+=C*Ir,ot+=C*ln,wt+=C*hn,lt+=C*dn,C=K[5],De+=C*de,it+=C*nr,Ue+=C*pr,mt+=C*gr,st+=C*Qt,tt+=C*mr,At+=C*lr,Rt+=C*Lr,Mt+=C*vr,Et+=C*xr,dt+=C*Br,_t+=C*$r,ot+=C*Ir,wt+=C*ln,lt+=C*hn,at+=C*dn,C=K[6],it+=C*de,Ue+=C*nr,mt+=C*pr,st+=C*gr,tt+=C*Qt,At+=C*mr,Rt+=C*lr,Mt+=C*Lr,Et+=C*vr,dt+=C*xr,_t+=C*Br,ot+=C*$r,wt+=C*Ir,lt+=C*ln,at+=C*hn,Ae+=C*dn,C=K[7],Ue+=C*de,mt+=C*nr,st+=C*pr,tt+=C*gr,At+=C*Qt,Rt+=C*mr,Mt+=C*lr,Et+=C*Lr,dt+=C*vr,_t+=C*xr,ot+=C*Br,wt+=C*$r,lt+=C*Ir,at+=C*ln,Ae+=C*hn,Pe+=C*dn,C=K[8],mt+=C*de,st+=C*nr,tt+=C*pr,At+=C*gr,Rt+=C*Qt,Mt+=C*mr,Et+=C*lr,dt+=C*Lr,_t+=C*vr,ot+=C*xr,wt+=C*Br,lt+=C*$r,at+=C*Ir,Ae+=C*ln,Pe+=C*hn,Ge+=C*dn,C=K[9],st+=C*de,tt+=C*nr,At+=C*pr,Rt+=C*gr,Mt+=C*Qt,Et+=C*mr,dt+=C*lr,_t+=C*Lr,ot+=C*vr,wt+=C*xr,lt+=C*Br,at+=C*$r,Ae+=C*Ir,Pe+=C*ln,Ge+=C*hn,je+=C*dn,C=K[10],tt+=C*de,At+=C*nr,Rt+=C*pr,Mt+=C*gr,Et+=C*Qt,dt+=C*mr,_t+=C*lr,ot+=C*Lr,wt+=C*vr,lt+=C*xr,at+=C*Br,Ae+=C*$r,Pe+=C*Ir,Ge+=C*ln,je+=C*hn,qe+=C*dn,C=K[11],At+=C*de,Rt+=C*nr,Mt+=C*pr,Et+=C*gr,dt+=C*Qt,_t+=C*mr,ot+=C*lr,wt+=C*Lr,lt+=C*vr,at+=C*xr,Ae+=C*Br,Pe+=C*$r,Ge+=C*Ir,je+=C*ln,qe+=C*hn,Xe+=C*dn,C=K[12],Rt+=C*de,Mt+=C*nr,Et+=C*pr,dt+=C*gr,_t+=C*Qt,ot+=C*mr,wt+=C*lr,lt+=C*Lr,at+=C*vr,Ae+=C*xr,Pe+=C*Br,Ge+=C*$r,je+=C*Ir,qe+=C*ln,Xe+=C*hn,kt+=C*dn,C=K[13],Mt+=C*de,Et+=C*nr,dt+=C*pr,_t+=C*gr,ot+=C*Qt,wt+=C*mr,lt+=C*lr,at+=C*Lr,Ae+=C*vr,Pe+=C*xr,Ge+=C*Br,je+=C*$r,qe+=C*Ir,Xe+=C*ln,kt+=C*hn,Wt+=C*dn,C=K[14],Et+=C*de,dt+=C*nr,_t+=C*pr,ot+=C*gr,wt+=C*Qt,lt+=C*mr,at+=C*lr,Ae+=C*Lr,Pe+=C*vr,Ge+=C*xr,je+=C*Br,qe+=C*$r,Xe+=C*Ir,kt+=C*ln,Wt+=C*hn,Zt+=C*dn,C=K[15],dt+=C*de,_t+=C*nr,ot+=C*pr,wt+=C*gr,lt+=C*Qt,at+=C*mr,Ae+=C*lr,Pe+=C*Lr,Ge+=C*vr,je+=C*xr,qe+=C*Br,Xe+=C*$r,kt+=C*Ir,Wt+=C*ln,Zt+=C*hn,Kt+=C*dn,q+=38*_t,ae+=38*ot,pe+=38*wt,_e+=38*lt,Re+=38*at,De+=38*Ae,it+=38*Pe,Ue+=38*Ge,mt+=38*je,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=ae+Y+65535,Y=Math.floor(C/65536),ae=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=_e+Y+65535,Y=Math.floor(C/65536),_e=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=mt+Y+65535,Y=Math.floor(C/65536),mt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=ae+Y+65535,Y=Math.floor(C/65536),ae=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=_e+Y+65535,Y=Math.floor(C/65536),_e=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=mt+Y+65535,Y=Math.floor(C/65536),mt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),$[0]=q,$[1]=ae,$[2]=pe,$[3]=_e,$[4]=Re,$[5]=De,$[6]=it,$[7]=Ue,$[8]=mt,$[9]=st,$[10]=tt,$[11]=At,$[12]=Rt,$[13]=Mt,$[14]=Et,$[15]=dt}function se($,K){D($,K,K)}function ee($,K){var G=r(),C;for(C=0;C<16;C++)G[C]=K[C];for(C=253;C>=0;C--)se(G,G),C!==2&&C!==4&&D(G,G,K);for(C=0;C<16;C++)$[C]=G[C]}function J($,K){var G=r(),C;for(C=0;C<16;C++)G[C]=K[C];for(C=250;C>=0;C--)se(G,G),C!==1&&D(G,G,K);for(C=0;C<16;C++)$[C]=G[C]}function Q($,K,G){var C=new Uint8Array(32),Y=new Float64Array(80),q,ae,pe=r(),_e=r(),Re=r(),De=r(),it=r(),Ue=r();for(ae=0;ae<31;ae++)C[ae]=K[ae];for(C[31]=K[31]&127|64,C[0]&=248,I(Y,G),ae=0;ae<16;ae++)_e[ae]=Y[ae],De[ae]=pe[ae]=Re[ae]=0;for(pe[0]=De[0]=1,ae=254;ae>=0;--ae)q=C[ae>>>3]>>>(ae&7)&1,S(pe,_e,q),S(Re,De,q),F(it,pe,Re),ce(pe,pe,Re),F(Re,_e,De),ce(_e,_e,De),se(De,it),se(Ue,pe),D(pe,Re,pe),D(Re,_e,it),F(it,pe,Re),ce(pe,pe,Re),se(_e,pe),ce(Re,De,Ue),D(pe,Re,u),F(pe,pe,De),D(Re,Re,pe),D(pe,De,Ue),D(De,_e,Y),se(_e,it),S(pe,_e,q),S(Re,De,q);for(ae=0;ae<16;ae++)Y[ae+16]=pe[ae],Y[ae+32]=Re[ae],Y[ae+48]=_e[ae],Y[ae+64]=De[ae];var mt=Y.subarray(32),st=Y.subarray(16);return ee(mt,mt),D(st,st,mt),A($,st),0}function T($,K){return Q($,K,s)}function X($,K){return n(K,32),T($,K)}function re($,K,G){var C=new Uint8Array(32);return Q(C,G,K),z($,i,C,Z)}var ge=f,oe=g;function fe($,K,G,C,Y,q){var ae=new Uint8Array(32);return re(ae,Y,q),ge($,K,G,C,ae)}function be($,K,G,C,Y,q){var ae=new Uint8Array(32);return re(ae,Y,q),oe($,K,G,C,ae)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne($,K,G,C){for(var Y=new Int32Array(16),q=new Int32Array(16),ae,pe,_e,Re,De,it,Ue,mt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Ae,Pe,Ge,je,qe,Xe,kt=$[0],Wt=$[1],Zt=$[2],Kt=$[3],de=$[4],nr=$[5],pr=$[6],gr=$[7],Qt=K[0],mr=K[1],lr=K[2],Lr=K[3],vr=K[4],xr=K[5],Br=K[6],$r=K[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=G[at+0]<<24|G[at+1]<<16|G[at+2]<<8|G[at+3],q[lt]=G[at+4]<<24|G[at+5]<<16|G[at+6]<<8|G[at+7];for(lt=0;lt<80;lt++)if(ae=kt,pe=Wt,_e=Zt,Re=Kt,De=de,it=nr,Ue=pr,mt=gr,st=Qt,tt=mr,At=lr,Rt=Lr,Mt=vr,Et=xr,dt=Br,_t=$r,Ae=gr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(de>>>14|vr<<18)^(de>>>18|vr<<14)^(vr>>>9|de<<23),Pe=(vr>>>14|de<<18)^(vr>>>18|de<<14)^(de>>>9|vr<<23),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=de&nr^~de&pr,Pe=vr&xr^~vr&Br,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Me[lt*2],Pe=Me[lt*2+1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Y[lt%16],Pe=q[lt%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|je<<16,Ae=ot,Pe=wt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Pe=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=kt&Wt^kt&Zt^Wt&Zt,Pe=Qt&mr^Qt&lr^mr&lr,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,mt=qe&65535|Xe<<16,_t=Ge&65535|je<<16,Ae=Re,Pe=Rt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=ot,Pe=wt,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|je<<16,Wt=ae,Zt=pe,Kt=_e,de=Re,nr=De,pr=it,gr=Ue,kt=mt,mr=st,lr=tt,Lr=At,vr=Rt,xr=Mt,Br=Et,$r=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Ae=Y[at],Pe=q[at],Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=Y[(at+9)%16],Pe=q[(at+9)%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+1)%16],wt=q[(at+1)%16],Ae=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Pe=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+14)%16],wt=q[(at+14)%16],Ae=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Pe=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,q[at]=Ge&65535|je<<16;Ae=kt,Pe=Qt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[0],Pe=K[0],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[0]=kt=qe&65535|Xe<<16,K[0]=Qt=Ge&65535|je<<16,Ae=Wt,Pe=mr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[1],Pe=K[1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[1]=Wt=qe&65535|Xe<<16,K[1]=mr=Ge&65535|je<<16,Ae=Zt,Pe=lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[2],Pe=K[2],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[2]=Zt=qe&65535|Xe<<16,K[2]=lr=Ge&65535|je<<16,Ae=Kt,Pe=Lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[3],Pe=K[3],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[3]=Kt=qe&65535|Xe<<16,K[3]=Lr=Ge&65535|je<<16,Ae=de,Pe=vr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[4],Pe=K[4],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[4]=de=qe&65535|Xe<<16,K[4]=vr=Ge&65535|je<<16,Ae=nr,Pe=xr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[5],Pe=K[5],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[5]=nr=qe&65535|Xe<<16,K[5]=xr=Ge&65535|je<<16,Ae=pr,Pe=Br,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[6],Pe=K[6],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[6]=pr=qe&65535|Xe<<16,K[6]=Br=Ge&65535|je<<16,Ae=gr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[7],Pe=K[7],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[7]=gr=qe&65535|Xe<<16,K[7]=$r=Ge&65535|je<<16,Ir+=128,C-=128}return C}function Te($,K,G){var C=new Int32Array(8),Y=new Int32Array(8),q=new Uint8Array(256),ae,pe=G;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,K,G),G%=128,ae=0;ae=0;--Y)C=G[Y/8|0]>>(Y&7)&1,Ie($,K,C),$e(K,$),$e($,$),Ie($,K,C)}function ke($,K){var G=[r(),r(),r(),r()];v(G[0],p),v(G[1],y),v(G[2],a),D(G[3],p,y),Ve($,G,K)}function ze($,K,G){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],q;for(G||n(K,32),Te(C,K,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le($,Y),q=0;q<32;q++)K[q+32]=$[q];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Se($,K){var G,C,Y,q;for(C=63;C>=32;--C){for(G=0,Y=C-32,q=C-12;Y>4)*He[Y],G=K[Y]>>8,K[Y]&=255;for(Y=0;Y<32;Y++)K[Y]-=G*He[Y];for(C=0;C<32;C++)K[C+1]+=K[C]>>8,$[C]=K[C]&255}function Qe($){var K=new Float64Array(64),G;for(G=0;G<64;G++)K[G]=$[G];for(G=0;G<64;G++)$[G]=0;Se($,K)}function ct($,K,G,C){var Y=new Uint8Array(64),q=new Uint8Array(64),ae=new Uint8Array(64),pe,_e,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=G+64;for(pe=0;pe>7&&ce($[0],o,$[0]),D($[3],$[0],$[1]),0)}function et($,K,G,C){var Y,q=new Uint8Array(32),ae=new Uint8Array(64),pe=[r(),r(),r(),r()],_e=[r(),r(),r(),r()];if(G<64||Be(_e,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var $=new Uint8Array(bt),K=new Uint8Array(Dt);return ze($,K),{publicKey:$,secretKey:K}},e.sign.keyPair.fromSecretKey=function($){if(nt($),$.length!==Dt)throw new Error("bad secret key size");for(var K=new Uint8Array(bt),G=0;G=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function $b(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function ap(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{o(ce),u(!1),y("scan")}),m.on("error",ce=>{console.log(ce)}),m.on("session_update",ce=>{console.log("session_update",ce)}),!await m.connect(JZ))throw new Error("Walletconnect init failed");const A=new Ga(m);O(((f=A.config)==null?void 0:f.image)||((g=E.config)==null?void 0:g.image));const b=await A.getAddress(),P=await xa.getNonce({account_type:"block_chain"});console.log("get nonce",P);const I=XZ(b,P);y("sign");const F=await A.signMessage(I,b);y("waiting"),await i(A,{message:I,nonce:P,signature:F,address:b,wallet_name:((v=A.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),console.log("save wallet connect wallet!"),k(A)}catch(S){console.log("err",S),d(S.details||S.message)}}function U(){_.current=new Z7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),_.current.append(e.current)}function z(E){var m;console.log(_.current),(m=_.current)==null||m.update({data:E})}Ee.useEffect(()=>{s&&z(s)},[s]),Ee.useEffect(()=>{H(r)},[r]),Ee.useEffect(()=>{U()},[]);function Z(){d(""),z(""),H(r)}function R(){B(!0),navigator.clipboard.writeText(s),setTimeout(()=>{B(!1)},2500)}function W(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return le.jsxs("div",{children:[le.jsx("div",{className:"xc-text-center",children:le.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[le.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),le.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?le.jsx(Sc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):le.jsx("img",{className:"xc-h-10 xc-w-10",src:M})})]})}),le.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[le.jsx("button",{disabled:!s,onClick:R,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:L?le.jsxs(le.Fragment,{children:[" ",le.jsx(hV,{})," Copied!"]}):le.jsxs(le.Fragment,{children:[le.jsx(gV,{}),"Copy QR URL"]})}),((me=r.config)==null?void 0:me.getWallet)&&le.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[le.jsx(dV,{}),"Get Extension"]}),((j=r.config)==null?void 0:j.desktop_link)&&le.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:W,children:[le.jsx(F8,{}),"Desktop"]})]}),le.jsx("div",{className:"xc-text-center",children:l?le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),le.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:Z,children:"Retry"})]}):le.jsxs(le.Fragment,{children:[p==="scan"&&le.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),p==="connect"&&le.jsx("p",{children:"Click connect in your wallet app"}),p==="sign"&&le.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),p==="waiting"&&le.jsx("div",{className:"xc-text-center",children:le.jsx(Sc,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const ZZ=RC({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),QZ="Accept connection request in the wallet",eQ="Accept sign-in request in your wallet";function tQ(t,e,r){const n=window.location.host,i=window.location.href;return e9({address:t,chainId:r,domain:n,nonce:e,uri:i,version:"1"})}function n9(t){var y;const[e,r]=Ee.useState(),{wallet:n,onSignFinish:i}=t,s=Ee.useRef(),[o,a]=Ee.useState("connect"),{saveLastUsedWallet:u,chains:l}=Yl();async function d(_){var M;try{a("connect");const O=await n.connect();if(!O||O.length===0)throw new Error("Wallet connect error");const L=await n.getChain(),B=l.find(Z=>Z.id===L),k=B||l[0]||ZZ;!B&&l.length>0&&(a("switch-chain"),await n.switchChain(k));const H=yg(O[0]),U=tQ(H,_,k.id);a("sign");const z=await n.signMessage(U,H);if(!z||z.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:H,signature:z,message:U,nonce:_,wallet_name:((M=n.config)==null?void 0:M.name)||""}),u(n)}catch(O){console.log("walletSignin error",O.stack),console.log(O.details||O.message),r(O.details||O.message)}}async function p(){try{r("");const _=await xa.getNonce({account_type:"block_chain"});s.current=_,d(s.current)}catch(_){console.log(_.details),r(_.message)}}return Ee.useEffect(()=>{p()},[]),le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[le.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(y=n.config)==null?void 0:y.image,alt:""}),e&&le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),le.jsx("div",{className:"xc-flex xc-gap-2",children:le.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:p,children:"Retry"})})]}),!e&&le.jsxs(le.Fragment,{children:[o==="connect"&&le.jsx("span",{className:"xc-text-center",children:QZ}),o==="sign"&&le.jsx("span",{className:"xc-text-center",children:eQ}),o==="waiting"&&le.jsx("span",{className:"xc-text-center",children:le.jsx(Sc,{className:"xc-animate-spin"})}),o==="switch-chain"&&le.jsxs("span",{className:"xc-text-center",children:["Switch to ",l[0].name]})]})]})}const Gu="https://static.codatta.io/codatta-connect/wallet-icons.svg",rQ="https://itunes.apple.com/app/",nQ="https://play.google.com/store/apps/details?id=",iQ="https://chromewebstore.google.com/detail/",sQ="https://chromewebstore.google.com/detail/",oQ="https://addons.mozilla.org/en-US/firefox/addon/",aQ="https://microsoftedge.microsoft.com/addons/detail/";function Yu(t){const{icon:e,title:r,link:n}=t;return le.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[le.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,le.jsx($8,{className:"xc-ml-auto xc-text-gray-400"})]})}function cQ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${rQ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${nQ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${iQ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${sQ}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${oQ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${aQ}${t.edge_addon_id}`),e}function i9(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=cQ(r);return le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),le.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),le.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),le.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&le.jsx(Yu,{link:n.chromeStoreLink,icon:`${Gu}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&le.jsx(Yu,{link:n.appStoreLink,icon:`${Gu}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&le.jsx(Yu,{link:n.playStoreLink,icon:`${Gu}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&le.jsx(Yu,{link:n.edgeStoreLink,icon:`${Gu}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&le.jsx(Yu,{link:n.braveStoreLink,icon:`${Gu}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&le.jsx(Yu,{link:n.firefoxStoreLink,icon:`${Gu}#firefox`,title:"Mozilla Firefox"})]})]})}function uQ(t){const{wallet:e}=t,[r,n]=Ee.useState(e.installed?"connect":"qr"),i=Bb();async function s(o,a){var l;const u=await xa.walletLogin({account_type:"block_chain",account_enum:i.role,connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Rc,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&le.jsx(r9,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&le.jsx(n9,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&le.jsx(i9,{wallet:e})]})}function fQ(t){const{wallet:e,onClick:r}=t,n=le.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return le.jsx(Ob,{icon:n,title:i,onClick:()=>r(e)})}function s9(t){const{connector:e}=t,[r,n]=Ee.useState(),[i,s]=Ee.useState([]),o=Ee.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d)}Ee.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Rc,{title:"Select wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[le.jsx(j8,{className:"xc-shrink-0 xc-opacity-50"}),le.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),le.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>le.jsx(fQ,{wallet:d,onClick:l},d.name))})]})}var o9={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,$[K+1]=G>>16&255,$[K+2]=G>>8&255,$[K+3]=G&255,$[K+4]=C>>24&255,$[K+5]=C>>16&255,$[K+6]=C>>8&255,$[K+7]=C&255}function O($,K,G,C,Y){var q,ae=0;for(q=0;q>>8)-1}function L($,K,G,C){return O($,K,G,C,16)}function B($,K,G,C){return O($,K,G,C,32)}function k($,K,G,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=G[0]&255|(G[1]&255)<<8|(G[2]&255)<<16|(G[3]&255)<<24,ae=G[4]&255|(G[5]&255)<<8|(G[6]&255)<<16|(G[7]&255)<<24,pe=G[8]&255|(G[9]&255)<<8|(G[10]&255)<<16|(G[11]&255)<<24,_e=G[12]&255|(G[13]&255)<<8|(G[14]&255)<<16|(G[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=K[0]&255|(K[1]&255)<<8|(K[2]&255)<<16|(K[3]&255)<<24,it=K[4]&255|(K[5]&255)<<8|(K[6]&255)<<16|(K[7]&255)<<24,Ue=K[8]&255|(K[9]&255)<<8|(K[10]&255)<<16|(K[11]&255)<<24,mt=K[12]&255|(K[13]&255)<<8|(K[14]&255)<<16|(K[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=G[16]&255|(G[17]&255)<<8|(G[18]&255)<<16|(G[19]&255)<<24,At=G[20]&255|(G[21]&255)<<8|(G[22]&255)<<16|(G[23]&255)<<24,Rt=G[24]&255|(G[25]&255)<<8|(G[26]&255)<<16|(G[27]&255)<<24,Mt=G[28]&255|(G[29]&255)<<8|(G[30]&255)<<16|(G[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=ae,wt=pe,lt=_e,at=Re,Ae=De,Pe=it,Ge=Ue,je=mt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;dt=dt+Y|0,_t=_t+q|0,ot=ot+ae|0,wt=wt+pe|0,lt=lt+_e|0,at=at+Re|0,Ae=Ae+De|0,Pe=Pe+it|0,Ge=Ge+Ue|0,je=je+mt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=_t>>>0&255,$[5]=_t>>>8&255,$[6]=_t>>>16&255,$[7]=_t>>>24&255,$[8]=ot>>>0&255,$[9]=ot>>>8&255,$[10]=ot>>>16&255,$[11]=ot>>>24&255,$[12]=wt>>>0&255,$[13]=wt>>>8&255,$[14]=wt>>>16&255,$[15]=wt>>>24&255,$[16]=lt>>>0&255,$[17]=lt>>>8&255,$[18]=lt>>>16&255,$[19]=lt>>>24&255,$[20]=at>>>0&255,$[21]=at>>>8&255,$[22]=at>>>16&255,$[23]=at>>>24&255,$[24]=Ae>>>0&255,$[25]=Ae>>>8&255,$[26]=Ae>>>16&255,$[27]=Ae>>>24&255,$[28]=Pe>>>0&255,$[29]=Pe>>>8&255,$[30]=Pe>>>16&255,$[31]=Pe>>>24&255,$[32]=Ge>>>0&255,$[33]=Ge>>>8&255,$[34]=Ge>>>16&255,$[35]=Ge>>>24&255,$[36]=je>>>0&255,$[37]=je>>>8&255,$[38]=je>>>16&255,$[39]=je>>>24&255,$[40]=qe>>>0&255,$[41]=qe>>>8&255,$[42]=qe>>>16&255,$[43]=qe>>>24&255,$[44]=Xe>>>0&255,$[45]=Xe>>>8&255,$[46]=Xe>>>16&255,$[47]=Xe>>>24&255,$[48]=kt>>>0&255,$[49]=kt>>>8&255,$[50]=kt>>>16&255,$[51]=kt>>>24&255,$[52]=Wt>>>0&255,$[53]=Wt>>>8&255,$[54]=Wt>>>16&255,$[55]=Wt>>>24&255,$[56]=Zt>>>0&255,$[57]=Zt>>>8&255,$[58]=Zt>>>16&255,$[59]=Zt>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255}function H($,K,G,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=G[0]&255|(G[1]&255)<<8|(G[2]&255)<<16|(G[3]&255)<<24,ae=G[4]&255|(G[5]&255)<<8|(G[6]&255)<<16|(G[7]&255)<<24,pe=G[8]&255|(G[9]&255)<<8|(G[10]&255)<<16|(G[11]&255)<<24,_e=G[12]&255|(G[13]&255)<<8|(G[14]&255)<<16|(G[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=K[0]&255|(K[1]&255)<<8|(K[2]&255)<<16|(K[3]&255)<<24,it=K[4]&255|(K[5]&255)<<8|(K[6]&255)<<16|(K[7]&255)<<24,Ue=K[8]&255|(K[9]&255)<<8|(K[10]&255)<<16|(K[11]&255)<<24,mt=K[12]&255|(K[13]&255)<<8|(K[14]&255)<<16|(K[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=G[16]&255|(G[17]&255)<<8|(G[18]&255)<<16|(G[19]&255)<<24,At=G[20]&255|(G[21]&255)<<8|(G[22]&255)<<16|(G[23]&255)<<24,Rt=G[24]&255|(G[25]&255)<<8|(G[26]&255)<<16|(G[27]&255)<<24,Mt=G[28]&255|(G[29]&255)<<8|(G[30]&255)<<16|(G[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=ae,wt=pe,lt=_e,at=Re,Ae=De,Pe=it,Ge=Ue,je=mt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=at>>>0&255,$[5]=at>>>8&255,$[6]=at>>>16&255,$[7]=at>>>24&255,$[8]=qe>>>0&255,$[9]=qe>>>8&255,$[10]=qe>>>16&255,$[11]=qe>>>24&255,$[12]=Kt>>>0&255,$[13]=Kt>>>8&255,$[14]=Kt>>>16&255,$[15]=Kt>>>24&255,$[16]=Ae>>>0&255,$[17]=Ae>>>8&255,$[18]=Ae>>>16&255,$[19]=Ae>>>24&255,$[20]=Pe>>>0&255,$[21]=Pe>>>8&255,$[22]=Pe>>>16&255,$[23]=Pe>>>24&255,$[24]=Ge>>>0&255,$[25]=Ge>>>8&255,$[26]=Ge>>>16&255,$[27]=Ge>>>24&255,$[28]=je>>>0&255,$[29]=je>>>8&255,$[30]=je>>>16&255,$[31]=je>>>24&255}function U($,K,G,C){k($,K,G,C)}function z($,K,G,C){H($,K,G,C)}var Z=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function R($,K,G,C,Y,q,ae){var pe=new Uint8Array(16),_e=new Uint8Array(64),Re,De;for(De=0;De<16;De++)pe[De]=0;for(De=0;De<8;De++)pe[De]=q[De];for(;Y>=64;){for(U(_e,pe,ae,Z),De=0;De<64;De++)$[K+De]=G[C+De]^_e[De];for(Re=1,De=8;De<16;De++)Re=Re+(pe[De]&255)|0,pe[De]=Re&255,Re>>>=8;Y-=64,K+=64,C+=64}if(Y>0)for(U(_e,pe,ae,Z),De=0;De=64;){for(U(ae,q,Y,Z),_e=0;_e<64;_e++)$[K+_e]=ae[_e];for(pe=1,_e=8;_e<16;_e++)pe=pe+(q[_e]&255)|0,q[_e]=pe&255,pe>>>=8;G-=64,K+=64}if(G>0)for(U(ae,q,Y,Z),_e=0;_e>>13|G<<3)&8191,C=$[4]&255|($[5]&255)<<8,this.r[2]=(G>>>10|C<<6)&7939,Y=$[6]&255|($[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,q=$[8]&255|($[9]&255)<<8,this.r[4]=(Y>>>4|q<<12)&255,this.r[5]=q>>>1&8190,ae=$[10]&255|($[11]&255)<<8,this.r[6]=(q>>>14|ae<<2)&8191,pe=$[12]&255|($[13]&255)<<8,this.r[7]=(ae>>>11|pe<<5)&8065,_e=$[14]&255|($[15]&255)<<8,this.r[8]=(pe>>>8|_e<<8)&8191,this.r[9]=_e>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};j.prototype.blocks=function($,K,G){for(var C=this.fin?0:2048,Y,q,ae,pe,_e,Re,De,it,Ue,mt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Ae=this.h[3],Pe=this.h[4],Ge=this.h[5],je=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],de=this.r[3],nr=this.r[4],pr=this.r[5],gr=this.r[6],Qt=this.r[7],mr=this.r[8],lr=this.r[9];G>=16;)Y=$[K+0]&255|($[K+1]&255)<<8,wt+=Y&8191,q=$[K+2]&255|($[K+3]&255)<<8,lt+=(Y>>>13|q<<3)&8191,ae=$[K+4]&255|($[K+5]&255)<<8,at+=(q>>>10|ae<<6)&8191,pe=$[K+6]&255|($[K+7]&255)<<8,Ae+=(ae>>>7|pe<<9)&8191,_e=$[K+8]&255|($[K+9]&255)<<8,Pe+=(pe>>>4|_e<<12)&8191,Ge+=_e>>>1&8191,Re=$[K+10]&255|($[K+11]&255)<<8,je+=(_e>>>14|Re<<2)&8191,De=$[K+12]&255|($[K+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=$[K+14]&255|($[K+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,Ue=0,mt=Ue,mt+=wt*Wt,mt+=lt*(5*lr),mt+=at*(5*mr),mt+=Ae*(5*Qt),mt+=Pe*(5*gr),Ue=mt>>>13,mt&=8191,mt+=Ge*(5*pr),mt+=je*(5*nr),mt+=qe*(5*de),mt+=Xe*(5*Kt),mt+=kt*(5*Zt),Ue+=mt>>>13,mt&=8191,st=Ue,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Ae*(5*mr),st+=Pe*(5*Qt),Ue=st>>>13,st&=8191,st+=Ge*(5*gr),st+=je*(5*pr),st+=qe*(5*nr),st+=Xe*(5*de),st+=kt*(5*Kt),Ue+=st>>>13,st&=8191,tt=Ue,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Ae*(5*lr),tt+=Pe*(5*mr),Ue=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=je*(5*gr),tt+=qe*(5*pr),tt+=Xe*(5*nr),tt+=kt*(5*de),Ue+=tt>>>13,tt&=8191,At=Ue,At+=wt*de,At+=lt*Kt,At+=at*Zt,At+=Ae*Wt,At+=Pe*(5*lr),Ue=At>>>13,At&=8191,At+=Ge*(5*mr),At+=je*(5*Qt),At+=qe*(5*gr),At+=Xe*(5*pr),At+=kt*(5*nr),Ue+=At>>>13,At&=8191,Rt=Ue,Rt+=wt*nr,Rt+=lt*de,Rt+=at*Kt,Rt+=Ae*Zt,Rt+=Pe*Wt,Ue=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=je*(5*mr),Rt+=qe*(5*Qt),Rt+=Xe*(5*gr),Rt+=kt*(5*pr),Ue+=Rt>>>13,Rt&=8191,Mt=Ue,Mt+=wt*pr,Mt+=lt*nr,Mt+=at*de,Mt+=Ae*Kt,Mt+=Pe*Zt,Ue=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=je*(5*lr),Mt+=qe*(5*mr),Mt+=Xe*(5*Qt),Mt+=kt*(5*gr),Ue+=Mt>>>13,Mt&=8191,Et=Ue,Et+=wt*gr,Et+=lt*pr,Et+=at*nr,Et+=Ae*de,Et+=Pe*Kt,Ue=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=je*Wt,Et+=qe*(5*lr),Et+=Xe*(5*mr),Et+=kt*(5*Qt),Ue+=Et>>>13,Et&=8191,dt=Ue,dt+=wt*Qt,dt+=lt*gr,dt+=at*pr,dt+=Ae*nr,dt+=Pe*de,Ue=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=je*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*mr),Ue+=dt>>>13,dt&=8191,_t=Ue,_t+=wt*mr,_t+=lt*Qt,_t+=at*gr,_t+=Ae*pr,_t+=Pe*nr,Ue=_t>>>13,_t&=8191,_t+=Ge*de,_t+=je*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),Ue+=_t>>>13,_t&=8191,ot=Ue,ot+=wt*lr,ot+=lt*mr,ot+=at*Qt,ot+=Ae*gr,ot+=Pe*pr,Ue=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=je*de,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,Ue+=ot>>>13,ot&=8191,Ue=(Ue<<2)+Ue|0,Ue=Ue+mt|0,mt=Ue&8191,Ue=Ue>>>13,st+=Ue,wt=mt,lt=st,at=tt,Ae=At,Pe=Rt,Ge=Mt,je=Et,qe=dt,Xe=_t,kt=ot,K+=16,G-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Ae,this.h[4]=Pe,this.h[5]=Ge,this.h[6]=je,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},j.prototype.finish=function($,K){var G=new Uint16Array(10),C,Y,q,ae;if(this.leftover){for(ae=this.leftover,this.buffer[ae++]=1;ae<16;ae++)this.buffer[ae]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,ae=2;ae<10;ae++)this.h[ae]+=C,C=this.h[ae]>>>13,this.h[ae]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,G[0]=this.h[0]+5,C=G[0]>>>13,G[0]&=8191,ae=1;ae<10;ae++)G[ae]=this.h[ae]+C,C=G[ae]>>>13,G[ae]&=8191;for(G[9]-=8192,Y=(C^1)-1,ae=0;ae<10;ae++)G[ae]&=Y;for(Y=~Y,ae=0;ae<10;ae++)this.h[ae]=this.h[ae]&Y|G[ae];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,q=this.h[0]+this.pad[0],this.h[0]=q&65535,ae=1;ae<8;ae++)q=(this.h[ae]+this.pad[ae]|0)+(q>>>16)|0,this.h[ae]=q&65535;$[K+0]=this.h[0]>>>0&255,$[K+1]=this.h[0]>>>8&255,$[K+2]=this.h[1]>>>0&255,$[K+3]=this.h[1]>>>8&255,$[K+4]=this.h[2]>>>0&255,$[K+5]=this.h[2]>>>8&255,$[K+6]=this.h[3]>>>0&255,$[K+7]=this.h[3]>>>8&255,$[K+8]=this.h[4]>>>0&255,$[K+9]=this.h[4]>>>8&255,$[K+10]=this.h[5]>>>0&255,$[K+11]=this.h[5]>>>8&255,$[K+12]=this.h[6]>>>0&255,$[K+13]=this.h[6]>>>8&255,$[K+14]=this.h[7]>>>0&255,$[K+15]=this.h[7]>>>8&255},j.prototype.update=function($,K,G){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>G&&(Y=G),C=0;C=16&&(Y=G-G%16,this.blocks($,K,Y),K+=Y,G-=Y),G){for(C=0;C>16&1),q[G-1]&=65535;q[15]=ae[15]-32767-(q[14]>>16&1),Y=q[15]>>16&1,q[14]&=65535,S(ae,q,1-Y)}for(G=0;G<16;G++)$[2*G]=ae[G]&255,$[2*G+1]=ae[G]>>8}function b($,K){var G=new Uint8Array(32),C=new Uint8Array(32);return A(G,$),A(C,K),B(G,0,C,0)}function P($){var K=new Uint8Array(32);return A(K,$),K[0]&1}function I($,K){var G;for(G=0;G<16;G++)$[G]=K[2*G]+(K[2*G+1]<<8);$[15]&=32767}function F($,K,G){for(var C=0;C<16;C++)$[C]=K[C]+G[C]}function ce($,K,G){for(var C=0;C<16;C++)$[C]=K[C]-G[C]}function D($,K,G){var C,Y,q=0,ae=0,pe=0,_e=0,Re=0,De=0,it=0,Ue=0,mt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Ae=0,Pe=0,Ge=0,je=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,de=G[0],nr=G[1],pr=G[2],gr=G[3],Qt=G[4],mr=G[5],lr=G[6],Lr=G[7],vr=G[8],xr=G[9],Br=G[10],$r=G[11],Ir=G[12],ln=G[13],hn=G[14],dn=G[15];C=K[0],q+=C*de,ae+=C*nr,pe+=C*pr,_e+=C*gr,Re+=C*Qt,De+=C*mr,it+=C*lr,Ue+=C*Lr,mt+=C*vr,st+=C*xr,tt+=C*Br,At+=C*$r,Rt+=C*Ir,Mt+=C*ln,Et+=C*hn,dt+=C*dn,C=K[1],ae+=C*de,pe+=C*nr,_e+=C*pr,Re+=C*gr,De+=C*Qt,it+=C*mr,Ue+=C*lr,mt+=C*Lr,st+=C*vr,tt+=C*xr,At+=C*Br,Rt+=C*$r,Mt+=C*Ir,Et+=C*ln,dt+=C*hn,_t+=C*dn,C=K[2],pe+=C*de,_e+=C*nr,Re+=C*pr,De+=C*gr,it+=C*Qt,Ue+=C*mr,mt+=C*lr,st+=C*Lr,tt+=C*vr,At+=C*xr,Rt+=C*Br,Mt+=C*$r,Et+=C*Ir,dt+=C*ln,_t+=C*hn,ot+=C*dn,C=K[3],_e+=C*de,Re+=C*nr,De+=C*pr,it+=C*gr,Ue+=C*Qt,mt+=C*mr,st+=C*lr,tt+=C*Lr,At+=C*vr,Rt+=C*xr,Mt+=C*Br,Et+=C*$r,dt+=C*Ir,_t+=C*ln,ot+=C*hn,wt+=C*dn,C=K[4],Re+=C*de,De+=C*nr,it+=C*pr,Ue+=C*gr,mt+=C*Qt,st+=C*mr,tt+=C*lr,At+=C*Lr,Rt+=C*vr,Mt+=C*xr,Et+=C*Br,dt+=C*$r,_t+=C*Ir,ot+=C*ln,wt+=C*hn,lt+=C*dn,C=K[5],De+=C*de,it+=C*nr,Ue+=C*pr,mt+=C*gr,st+=C*Qt,tt+=C*mr,At+=C*lr,Rt+=C*Lr,Mt+=C*vr,Et+=C*xr,dt+=C*Br,_t+=C*$r,ot+=C*Ir,wt+=C*ln,lt+=C*hn,at+=C*dn,C=K[6],it+=C*de,Ue+=C*nr,mt+=C*pr,st+=C*gr,tt+=C*Qt,At+=C*mr,Rt+=C*lr,Mt+=C*Lr,Et+=C*vr,dt+=C*xr,_t+=C*Br,ot+=C*$r,wt+=C*Ir,lt+=C*ln,at+=C*hn,Ae+=C*dn,C=K[7],Ue+=C*de,mt+=C*nr,st+=C*pr,tt+=C*gr,At+=C*Qt,Rt+=C*mr,Mt+=C*lr,Et+=C*Lr,dt+=C*vr,_t+=C*xr,ot+=C*Br,wt+=C*$r,lt+=C*Ir,at+=C*ln,Ae+=C*hn,Pe+=C*dn,C=K[8],mt+=C*de,st+=C*nr,tt+=C*pr,At+=C*gr,Rt+=C*Qt,Mt+=C*mr,Et+=C*lr,dt+=C*Lr,_t+=C*vr,ot+=C*xr,wt+=C*Br,lt+=C*$r,at+=C*Ir,Ae+=C*ln,Pe+=C*hn,Ge+=C*dn,C=K[9],st+=C*de,tt+=C*nr,At+=C*pr,Rt+=C*gr,Mt+=C*Qt,Et+=C*mr,dt+=C*lr,_t+=C*Lr,ot+=C*vr,wt+=C*xr,lt+=C*Br,at+=C*$r,Ae+=C*Ir,Pe+=C*ln,Ge+=C*hn,je+=C*dn,C=K[10],tt+=C*de,At+=C*nr,Rt+=C*pr,Mt+=C*gr,Et+=C*Qt,dt+=C*mr,_t+=C*lr,ot+=C*Lr,wt+=C*vr,lt+=C*xr,at+=C*Br,Ae+=C*$r,Pe+=C*Ir,Ge+=C*ln,je+=C*hn,qe+=C*dn,C=K[11],At+=C*de,Rt+=C*nr,Mt+=C*pr,Et+=C*gr,dt+=C*Qt,_t+=C*mr,ot+=C*lr,wt+=C*Lr,lt+=C*vr,at+=C*xr,Ae+=C*Br,Pe+=C*$r,Ge+=C*Ir,je+=C*ln,qe+=C*hn,Xe+=C*dn,C=K[12],Rt+=C*de,Mt+=C*nr,Et+=C*pr,dt+=C*gr,_t+=C*Qt,ot+=C*mr,wt+=C*lr,lt+=C*Lr,at+=C*vr,Ae+=C*xr,Pe+=C*Br,Ge+=C*$r,je+=C*Ir,qe+=C*ln,Xe+=C*hn,kt+=C*dn,C=K[13],Mt+=C*de,Et+=C*nr,dt+=C*pr,_t+=C*gr,ot+=C*Qt,wt+=C*mr,lt+=C*lr,at+=C*Lr,Ae+=C*vr,Pe+=C*xr,Ge+=C*Br,je+=C*$r,qe+=C*Ir,Xe+=C*ln,kt+=C*hn,Wt+=C*dn,C=K[14],Et+=C*de,dt+=C*nr,_t+=C*pr,ot+=C*gr,wt+=C*Qt,lt+=C*mr,at+=C*lr,Ae+=C*Lr,Pe+=C*vr,Ge+=C*xr,je+=C*Br,qe+=C*$r,Xe+=C*Ir,kt+=C*ln,Wt+=C*hn,Zt+=C*dn,C=K[15],dt+=C*de,_t+=C*nr,ot+=C*pr,wt+=C*gr,lt+=C*Qt,at+=C*mr,Ae+=C*lr,Pe+=C*Lr,Ge+=C*vr,je+=C*xr,qe+=C*Br,Xe+=C*$r,kt+=C*Ir,Wt+=C*ln,Zt+=C*hn,Kt+=C*dn,q+=38*_t,ae+=38*ot,pe+=38*wt,_e+=38*lt,Re+=38*at,De+=38*Ae,it+=38*Pe,Ue+=38*Ge,mt+=38*je,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=ae+Y+65535,Y=Math.floor(C/65536),ae=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=_e+Y+65535,Y=Math.floor(C/65536),_e=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=mt+Y+65535,Y=Math.floor(C/65536),mt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=ae+Y+65535,Y=Math.floor(C/65536),ae=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=_e+Y+65535,Y=Math.floor(C/65536),_e=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=mt+Y+65535,Y=Math.floor(C/65536),mt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),$[0]=q,$[1]=ae,$[2]=pe,$[3]=_e,$[4]=Re,$[5]=De,$[6]=it,$[7]=Ue,$[8]=mt,$[9]=st,$[10]=tt,$[11]=At,$[12]=Rt,$[13]=Mt,$[14]=Et,$[15]=dt}function se($,K){D($,K,K)}function ee($,K){var G=r(),C;for(C=0;C<16;C++)G[C]=K[C];for(C=253;C>=0;C--)se(G,G),C!==2&&C!==4&&D(G,G,K);for(C=0;C<16;C++)$[C]=G[C]}function J($,K){var G=r(),C;for(C=0;C<16;C++)G[C]=K[C];for(C=250;C>=0;C--)se(G,G),C!==1&&D(G,G,K);for(C=0;C<16;C++)$[C]=G[C]}function Q($,K,G){var C=new Uint8Array(32),Y=new Float64Array(80),q,ae,pe=r(),_e=r(),Re=r(),De=r(),it=r(),Ue=r();for(ae=0;ae<31;ae++)C[ae]=K[ae];for(C[31]=K[31]&127|64,C[0]&=248,I(Y,G),ae=0;ae<16;ae++)_e[ae]=Y[ae],De[ae]=pe[ae]=Re[ae]=0;for(pe[0]=De[0]=1,ae=254;ae>=0;--ae)q=C[ae>>>3]>>>(ae&7)&1,S(pe,_e,q),S(Re,De,q),F(it,pe,Re),ce(pe,pe,Re),F(Re,_e,De),ce(_e,_e,De),se(De,it),se(Ue,pe),D(pe,Re,pe),D(Re,_e,it),F(it,pe,Re),ce(pe,pe,Re),se(_e,pe),ce(Re,De,Ue),D(pe,Re,u),F(pe,pe,De),D(Re,Re,pe),D(pe,De,Ue),D(De,_e,Y),se(_e,it),S(pe,_e,q),S(Re,De,q);for(ae=0;ae<16;ae++)Y[ae+16]=pe[ae],Y[ae+32]=Re[ae],Y[ae+48]=_e[ae],Y[ae+64]=De[ae];var mt=Y.subarray(32),st=Y.subarray(16);return ee(mt,mt),D(st,st,mt),A($,st),0}function T($,K){return Q($,K,s)}function X($,K){return n(K,32),T($,K)}function re($,K,G){var C=new Uint8Array(32);return Q(C,G,K),z($,i,C,Z)}var ge=f,oe=g;function fe($,K,G,C,Y,q){var ae=new Uint8Array(32);return re(ae,Y,q),ge($,K,G,C,ae)}function be($,K,G,C,Y,q){var ae=new Uint8Array(32);return re(ae,Y,q),oe($,K,G,C,ae)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne($,K,G,C){for(var Y=new Int32Array(16),q=new Int32Array(16),ae,pe,_e,Re,De,it,Ue,mt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Ae,Pe,Ge,je,qe,Xe,kt=$[0],Wt=$[1],Zt=$[2],Kt=$[3],de=$[4],nr=$[5],pr=$[6],gr=$[7],Qt=K[0],mr=K[1],lr=K[2],Lr=K[3],vr=K[4],xr=K[5],Br=K[6],$r=K[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=G[at+0]<<24|G[at+1]<<16|G[at+2]<<8|G[at+3],q[lt]=G[at+4]<<24|G[at+5]<<16|G[at+6]<<8|G[at+7];for(lt=0;lt<80;lt++)if(ae=kt,pe=Wt,_e=Zt,Re=Kt,De=de,it=nr,Ue=pr,mt=gr,st=Qt,tt=mr,At=lr,Rt=Lr,Mt=vr,Et=xr,dt=Br,_t=$r,Ae=gr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(de>>>14|vr<<18)^(de>>>18|vr<<14)^(vr>>>9|de<<23),Pe=(vr>>>14|de<<18)^(vr>>>18|de<<14)^(de>>>9|vr<<23),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=de&nr^~de&pr,Pe=vr&xr^~vr&Br,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Me[lt*2],Pe=Me[lt*2+1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Y[lt%16],Pe=q[lt%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|je<<16,Ae=ot,Pe=wt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Pe=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=kt&Wt^kt&Zt^Wt&Zt,Pe=Qt&mr^Qt&lr^mr&lr,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,mt=qe&65535|Xe<<16,_t=Ge&65535|je<<16,Ae=Re,Pe=Rt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=ot,Pe=wt,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|je<<16,Wt=ae,Zt=pe,Kt=_e,de=Re,nr=De,pr=it,gr=Ue,kt=mt,mr=st,lr=tt,Lr=At,vr=Rt,xr=Mt,Br=Et,$r=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Ae=Y[at],Pe=q[at],Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=Y[(at+9)%16],Pe=q[(at+9)%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+1)%16],wt=q[(at+1)%16],Ae=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Pe=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+14)%16],wt=q[(at+14)%16],Ae=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Pe=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,q[at]=Ge&65535|je<<16;Ae=kt,Pe=Qt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[0],Pe=K[0],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[0]=kt=qe&65535|Xe<<16,K[0]=Qt=Ge&65535|je<<16,Ae=Wt,Pe=mr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[1],Pe=K[1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[1]=Wt=qe&65535|Xe<<16,K[1]=mr=Ge&65535|je<<16,Ae=Zt,Pe=lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[2],Pe=K[2],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[2]=Zt=qe&65535|Xe<<16,K[2]=lr=Ge&65535|je<<16,Ae=Kt,Pe=Lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[3],Pe=K[3],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[3]=Kt=qe&65535|Xe<<16,K[3]=Lr=Ge&65535|je<<16,Ae=de,Pe=vr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[4],Pe=K[4],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[4]=de=qe&65535|Xe<<16,K[4]=vr=Ge&65535|je<<16,Ae=nr,Pe=xr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[5],Pe=K[5],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[5]=nr=qe&65535|Xe<<16,K[5]=xr=Ge&65535|je<<16,Ae=pr,Pe=Br,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[6],Pe=K[6],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[6]=pr=qe&65535|Xe<<16,K[6]=Br=Ge&65535|je<<16,Ae=gr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[7],Pe=K[7],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[7]=gr=qe&65535|Xe<<16,K[7]=$r=Ge&65535|je<<16,Ir+=128,C-=128}return C}function Te($,K,G){var C=new Int32Array(8),Y=new Int32Array(8),q=new Uint8Array(256),ae,pe=G;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,K,G),G%=128,ae=0;ae=0;--Y)C=G[Y/8|0]>>(Y&7)&1,Ie($,K,C),$e(K,$),$e($,$),Ie($,K,C)}function ke($,K){var G=[r(),r(),r(),r()];v(G[0],p),v(G[1],y),v(G[2],a),D(G[3],p,y),Ve($,G,K)}function ze($,K,G){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],q;for(G||n(K,32),Te(C,K,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le($,Y),q=0;q<32;q++)K[q+32]=$[q];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Se($,K){var G,C,Y,q;for(C=63;C>=32;--C){for(G=0,Y=C-32,q=C-12;Y>4)*He[Y],G=K[Y]>>8,K[Y]&=255;for(Y=0;Y<32;Y++)K[Y]-=G*He[Y];for(C=0;C<32;C++)K[C+1]+=K[C]>>8,$[C]=K[C]&255}function Qe($){var K=new Float64Array(64),G;for(G=0;G<64;G++)K[G]=$[G];for(G=0;G<64;G++)$[G]=0;Se($,K)}function ct($,K,G,C){var Y=new Uint8Array(64),q=new Uint8Array(64),ae=new Uint8Array(64),pe,_e,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=G+64;for(pe=0;pe>7&&ce($[0],o,$[0]),D($[3],$[0],$[1]),0)}function et($,K,G,C){var Y,q=new Uint8Array(32),ae=new Uint8Array(64),pe=[r(),r(),r(),r()],_e=[r(),r(),r(),r()];if(G<64||Be(_e,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var $=new Uint8Array(bt),K=new Uint8Array(Dt);return ze($,K),{publicKey:$,secretKey:K}},e.sign.keyPair.fromSecretKey=function($){if(nt($),$.length!==Dt)throw new Error("bad secret key size");for(var K=new Uint8Array(bt),G=0;G=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function $b(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function ap(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r { if (typeof e == "object" && "r" in e && "s" in e) { const { r: l, s: d, v: p, yParity: w } = e, _ = Number(w ?? p), P = z2(_); @@ -25510,12 +25510,12 @@ var DG = S0.exports, Y1 = { exports: {} }; })(Y1, Y1.exports); var OG = Y1.exports; const Q3 = /* @__PURE__ */ ns(OG); -var NG = Object.defineProperty, LG = Object.defineProperties, kG = Object.getOwnPropertyDescriptors, e_ = Object.getOwnPropertySymbols, $G = Object.prototype.hasOwnProperty, BG = Object.prototype.propertyIsEnumerable, t_ = (t, e, r) => e in t ? NG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, r_ = (t, e) => { - for (var r in e || (e = {})) $G.call(e, r) && t_(t, r, e[r]); - if (e_) for (var r of e_(e)) BG.call(e, r) && t_(t, r, e[r]); +var NG = Object.defineProperty, LG = Object.defineProperties, kG = Object.getOwnPropertyDescriptors, e6 = Object.getOwnPropertySymbols, $G = Object.prototype.hasOwnProperty, BG = Object.prototype.propertyIsEnumerable, t6 = (t, e, r) => e in t ? NG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, r6 = (t, e) => { + for (var r in e || (e = {})) $G.call(e, r) && t6(t, r, e[r]); + if (e6) for (var r of e6(e)) BG.call(e, r) && t6(t, r, e[r]); return t; -}, n_ = (t, e) => LG(t, kG(e)); -const FG = { Accept: "application/json", "Content-Type": "application/json" }, jG = "POST", i_ = { headers: FG, method: jG }, s_ = 10; +}, n6 = (t, e) => LG(t, kG(e)); +const FG = { Accept: "application/json", "Content-Type": "application/json" }, jG = "POST", i6 = { headers: FG, method: jG }, s6 = 10; let Cs = class { constructor(e, r = !1) { if (this.url = e, this.disableProviderPing = r, this.events = new is.EventEmitter(), this.isAvailable = !1, this.registering = !1, !A3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); @@ -25549,7 +25549,7 @@ let Cs = class { async send(e) { this.isAvailable || await this.register(); try { - const r = jo(e), n = await (await Q3(this.url, n_(r_({}, i_), { body: r }))).json(); + const r = jo(e), n = await (await Q3(this.url, n6(r6({}, i6), { body: r }))).json(); this.onPayload({ data: n }); } catch (r) { this.onError(e.id, r); @@ -25572,7 +25572,7 @@ let Cs = class { try { if (!this.disableProviderPing) { const r = jo({ id: 1, jsonrpc: "2.0", method: "test", params: [] }); - await Q3(e, n_(r_({}, i_), { body: r })); + await Q3(e, n6(r6({}, i6), { body: r })); } this.onOpen(); } catch (r) { @@ -25599,13 +25599,13 @@ let Cs = class { return AE(e, r, "HTTP"); } resetMaxListeners() { - this.events.getMaxListeners() > s_ && this.events.setMaxListeners(s_); + this.events.getMaxListeners() > s6 && this.events.setMaxListeners(s6); } }; -const o_ = "error", UG = "wss://relay.walletconnect.org", qG = "wc", zG = "universal_provider", a_ = `${qG}@2:${zG}:`, YE = "https://rpc.walletconnect.org/v1/", au = "generic", WG = `${YE}bundler`, fs = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; -var HG = Object.defineProperty, KG = Object.defineProperties, VG = Object.getOwnPropertyDescriptors, c_ = Object.getOwnPropertySymbols, GG = Object.prototype.hasOwnProperty, YG = Object.prototype.propertyIsEnumerable, u_ = (t, e, r) => e in t ? HG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, _d = (t, e) => { - for (var r in e || (e = {})) GG.call(e, r) && u_(t, r, e[r]); - if (c_) for (var r of c_(e)) YG.call(e, r) && u_(t, r, e[r]); +const o6 = "error", UG = "wss://relay.walletconnect.org", qG = "wc", zG = "universal_provider", a6 = `${qG}@2:${zG}:`, YE = "https://rpc.walletconnect.org/v1/", au = "generic", WG = `${YE}bundler`, fs = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; +var HG = Object.defineProperty, KG = Object.defineProperties, VG = Object.getOwnPropertyDescriptors, c6 = Object.getOwnPropertySymbols, GG = Object.prototype.hasOwnProperty, YG = Object.prototype.propertyIsEnumerable, u6 = (t, e, r) => e in t ? HG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, _d = (t, e) => { + for (var r in e || (e = {})) GG.call(e, r) && u6(t, r, e[r]); + if (c6) for (var r of c6(e)) YG.call(e, r) && u6(t, r, e[r]); return t; }, JG = (t, e) => KG(t, VG(e)); function Li(t, e, r) { @@ -25629,10 +25629,10 @@ function XG(t, e) { }), n; } function Dm(t = {}, e = {}) { - const r = f_(t), n = f_(e); + const r = f6(t), n = f6(e); return DG.merge(r, n); } -function f_(t) { +function f6(t) { var e, r, n, i; const s = {}; if (!Ll(t)) return s; @@ -25645,7 +25645,7 @@ function f_(t) { function ZG(t) { return t.includes(":") ? t.split(":")[2] : t; } -function l_(t) { +function l6(t) { const e = {}; for (const [r, n] of Object.entries(t)) { const i = n.methods || [], s = n.events || [], o = n.accounts || [], a = _b(r) ? [r] : n.chains ? n.chains : JE(n.accounts); @@ -25709,11 +25709,11 @@ class QG { return new us(new Cs(n, Pr("disableProviderPing"))); } } -var eY = Object.defineProperty, tY = Object.defineProperties, rY = Object.getOwnPropertyDescriptors, h_ = Object.getOwnPropertySymbols, nY = Object.prototype.hasOwnProperty, iY = Object.prototype.propertyIsEnumerable, d_ = (t, e, r) => e in t ? eY(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, p_ = (t, e) => { - for (var r in e || (e = {})) nY.call(e, r) && d_(t, r, e[r]); - if (h_) for (var r of h_(e)) iY.call(e, r) && d_(t, r, e[r]); +var eY = Object.defineProperty, tY = Object.defineProperties, rY = Object.getOwnPropertyDescriptors, h6 = Object.getOwnPropertySymbols, nY = Object.prototype.hasOwnProperty, iY = Object.prototype.propertyIsEnumerable, d6 = (t, e, r) => e in t ? eY(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, p6 = (t, e) => { + for (var r in e || (e = {})) nY.call(e, r) && d6(t, r, e[r]); + if (h6) for (var r of h6(e)) iY.call(e, r) && d6(t, r, e[r]); return t; -}, g_ = (t, e) => tY(t, rY(e)); +}, g6 = (t, e) => tY(t, rY(e)); class sY { constructor(e) { this.name = "eip155", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.httpProviders = this.createHttpProviders(), this.chainId = parseInt(this.getDefaultChain()); @@ -25798,7 +25798,7 @@ class sY { if (a != null && a[s]) return a == null ? void 0 : a[s]; const u = await this.client.request(e); try { - await this.client.session.update(e.topic, { sessionProperties: g_(p_({}, o.sessionProperties || {}), { capabilities: g_(p_({}, a || {}), { [s]: u }) }) }); + await this.client.session.update(e.topic, { sessionProperties: g6(p6({}, o.sessionProperties || {}), { capabilities: g6(p6({}, a || {}), { [s]: u }) }) }); } catch (l) { console.warn("Failed to update session with capabilities", l); } @@ -26292,14 +26292,14 @@ class pY { return new us(new Cs(n, Pr("disableProviderPing"))); } } -var gY = Object.defineProperty, mY = Object.defineProperties, vY = Object.getOwnPropertyDescriptors, m_ = Object.getOwnPropertySymbols, bY = Object.prototype.hasOwnProperty, yY = Object.prototype.propertyIsEnumerable, v_ = (t, e, r) => e in t ? gY(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Ed = (t, e) => { - for (var r in e || (e = {})) bY.call(e, r) && v_(t, r, e[r]); - if (m_) for (var r of m_(e)) yY.call(e, r) && v_(t, r, e[r]); +var gY = Object.defineProperty, mY = Object.defineProperties, vY = Object.getOwnPropertyDescriptors, m6 = Object.getOwnPropertySymbols, bY = Object.prototype.hasOwnProperty, yY = Object.prototype.propertyIsEnumerable, v6 = (t, e, r) => e in t ? gY(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Ed = (t, e) => { + for (var r in e || (e = {})) bY.call(e, r) && v6(t, r, e[r]); + if (m6) for (var r of m6(e)) yY.call(e, r) && v6(t, r, e[r]); return t; }, Lm = (t, e) => mY(t, vY(e)); let J1 = class ZE { constructor(e) { - this.events = new Xv(), this.rpcProviders = {}, this.shouldAbortPairingAttempt = !1, this.maxPairingAttempts = 10, this.disableProviderPing = !1, this.providerOpts = e, this.logger = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : Xl(X0({ level: (e == null ? void 0 : e.logger) || o_ })), this.disableProviderPing = (e == null ? void 0 : e.disableProviderPing) || !1; + this.events = new Xv(), this.rpcProviders = {}, this.shouldAbortPairingAttempt = !1, this.maxPairingAttempts = 10, this.disableProviderPing = !1, this.providerOpts = e, this.logger = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : Xl(X0({ level: (e == null ? void 0 : e.logger) || o6 })), this.disableProviderPing = (e == null ? void 0 : e.disableProviderPing) || !1; } static async init(e) { const r = new ZE(e); @@ -26334,7 +26334,7 @@ let J1 = class ZE { n && (this.uri = n, this.events.emit("display_uri", n)); const s = await i(); if (this.session = s.session, this.session) { - const o = l_(this.session.namespaces); + const o = l6(this.session.namespaces); this.namespaces = Dm(this.namespaces, o), this.persist("namespaces", this.namespaces), this.onConnect(); } return s; @@ -26363,7 +26363,7 @@ let J1 = class ZE { const { uri: n, approval: i } = await this.client.connect({ pairingTopic: e, requiredNamespaces: this.namespaces, optionalNamespaces: this.optionalNamespaces, sessionProperties: this.sessionProperties }); n && (this.uri = n, this.events.emit("display_uri", n)), await i().then((s) => { this.session = s; - const o = l_(s.namespaces); + const o = l6(s.namespaces); this.namespaces = Dm(this.namespaces, o), this.persist("namespaces", this.namespaces); }).catch((s) => { if (s.message !== GE) throw s; @@ -26402,7 +26402,7 @@ let J1 = class ZE { this.logger.trace("Initialized"), await this.createClient(), await this.checkStorage(), this.registerEventListeners(); } async createClient() { - this.client = this.providerOpts.client || await Ib.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || o_, relayUrl: this.providerOpts.relayUrl || UG, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); + this.client = this.providerOpts.client || await Ib.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || o6, relayUrl: this.providerOpts.relayUrl || UG, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); } createProviders() { if (!this.client) throw new Error("Sign Client not initialized"); @@ -26508,10 +26508,10 @@ let J1 = class ZE { this.session = void 0, this.namespaces = void 0, this.optionalNamespaces = void 0, this.sessionProperties = void 0, this.persist("namespaces", void 0), this.persist("optionalNamespaces", void 0), this.persist("sessionProperties", void 0), await this.cleanupPendingPairings({ deletePairings: !0 }); } persist(e, r) { - this.client.core.storage.setItem(`${a_}/${e}`, r); + this.client.core.storage.setItem(`${a6}/${e}`, r); } async getFromStore(e) { - return await this.client.core.storage.getItem(`${a_}/${e}`); + return await this.client.core.storage.getItem(`${a6}/${e}`); } }; const wY = J1; @@ -26672,21 +26672,21 @@ function SY(t, { shouldIncludeStack: e = !1 } = {}) { const r = {}; if (t && typeof t == "object" && !Array.isArray(t) && Z1(t, "code") && EY(t.code)) { const n = t; - r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, Z1(n, "data") && (r.data = n.data)) : (r.message = Cb(r.code), r.data = { originalError: b_(t) }); + r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, Z1(n, "data") && (r.data = n.data)) : (r.message = Cb(r.code), r.data = { originalError: b6(t) }); } else - r.code = fn.rpc.internal, r.message = y_(t, "message") ? t.message : QE, r.data = { originalError: b_(t) }; - return e && (r.stack = y_(t, "stack") ? t.stack : void 0), r; + r.code = fn.rpc.internal, r.message = y6(t, "message") ? t.message : QE, r.data = { originalError: b6(t) }; + return e && (r.stack = y6(t, "stack") ? t.stack : void 0), r; } function eS(t) { return t >= -32099 && t <= -32e3; } -function b_(t) { +function b6(t) { return t && typeof t == "object" && !Array.isArray(t) ? Object.assign({}, t) : t; } function Z1(t, e) { return Object.prototype.hasOwnProperty.call(t, e); } -function y_(t, e) { +function y6(t, e) { return typeof t == "object" && t !== null && e in t && typeof t[e] == "string"; } const Ar = { @@ -27059,11 +27059,11 @@ function UY(t) { throw Ar.provider.unsupportedMethod(); } } -const w_ = "accounts", x_ = "activeChain", __ = "availableChains", E_ = "walletCapabilities"; +const w6 = "accounts", x6 = "activeChain", _6 = "availableChains", E6 = "walletCapabilities"; class qY { constructor(e) { var r, n, i; - this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new $Y(), this.storage = new no("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(w_)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(x_) || { + this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new $Y(), this.storage = new no("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(w6)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(x6) || { id: (i = (n = e.metadata.appChainIds) === null || n === void 0 ? void 0 : n[0]) !== null && i !== void 0 ? i : 1 }, this.handshake = this.handshake.bind(this), this.request = this.request.bind(this), this.createRequestMessage = this.createRequestMessage.bind(this), this.decryptResponseMessage = this.decryptResponseMessage.bind(this); } @@ -27083,7 +27083,7 @@ class qY { if ("error" in u) throw u.error; const l = u.value; - this.accounts = l, this.storage.storeObject(w_, l), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", l); + this.accounts = l, this.storage.storeObject(w6, l), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", l); } async request(e) { var r; @@ -27101,7 +27101,7 @@ class qY { case "eth_chainId": return ma(this.chain.id); case "wallet_getCapabilities": - return this.storage.loadObject(E_); + return this.storage.loadObject(E6); case "wallet_switchEthereumChain": return this.handleSwitchChainRequest(e); case "eth_ecRecover": @@ -27187,15 +27187,15 @@ class qY { id: Number(d), rpcUrl: p })); - this.storage.storeObject(__, l), this.updateChain(this.chain.id, l); + this.storage.storeObject(_6, l), this.updateChain(this.chain.id, l); } const u = (n = o.data) === null || n === void 0 ? void 0 : n.capabilities; - return u && this.storage.storeObject(E_, u), o; + return u && this.storage.storeObject(E6, u), o; } updateChain(e, r) { var n; - const i = r ?? this.storage.loadObject(__), s = i == null ? void 0 : i.find((o) => o.id === e); - return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(x_, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", ma(s.id))), !0) : !1; + const i = r ?? this.storage.loadObject(_6), s = i == null ? void 0 : i.find((o) => o.id === e); + return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(x6, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", ma(s.id))), !0) : !1; } } const zY = /* @__PURE__ */ Lv(mO), { keccak_256: WY } = zY; @@ -27285,7 +27285,7 @@ function yS(t) { function Au(t) { return Number.parseInt(/^\D+(\d+)$/.exec(t)[1], 10); } -function S_(t) { +function S6(t) { var e = /^\D+(\d+)x(\d+)$/.exec(t); return [Number.parseInt(e[1], 10), Number.parseInt(e[2], 10)]; } @@ -27349,11 +27349,11 @@ function Hs(t, e) { const u = oi.twosFromBigInt(n, 256); return oi.bufferBEFromBigInt(u, 32); } else if (t.startsWith("ufixed")) { - if (r = S_(t), n = oc(e), n < 0) + if (r = S6(t), n = oc(e), n < 0) throw new Error("Supplied ufixed is negative"); return Hs("uint256", n * BigInt(2) ** BigInt(r[1])); } else if (t.startsWith("fixed")) - return r = S_(t), Hs("int256", oc(e) * BigInt(2) ** BigInt(r[1])); + return r = S6(t), Hs("int256", oc(e) * BigInt(2) ** BigInt(r[1])); } throw new Error("Unsupported or invalid type: " + t); } @@ -27778,7 +27778,7 @@ class cJ { e && (this.webSocket = null, e.onclose = null, e.onerror = null, e.onmessage = null, e.onopen = null); } } -const A_ = 1e4, uJ = 6e4; +const A6 = 1e4, uJ = 6e4; class fJ { /** * Constructor @@ -27842,7 +27842,7 @@ class fJ { case To.CONNECTED: o = await this.handleConnected(), this.updateLastHeartbeat(), setInterval(() => { this.heartbeat(); - }, A_), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); + }, A6), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); break; case To.CONNECTING: break; @@ -27968,7 +27968,7 @@ class fJ { this.lastHeartbeatResponse = Date.now(); } heartbeat() { - if (Date.now() - this.lastHeartbeatResponse > A_ * 2) { + if (Date.now() - this.lastHeartbeatResponse > A6 * 2) { this.ws.disconnect(); return; } @@ -28021,7 +28021,7 @@ class lJ { return this.callbacks.get(r) && this.callbacks.delete(r), e; } } -const P_ = "session:id", M_ = "session:secret", I_ = "session:linked"; +const P6 = "session:id", M6 = "session:secret", I6 = "session:linked"; class Pu { constructor(e, r, n, i = !1) { this.storage = e, this.id = r, this.secret = n, this.key = XD(P4(`${r}, ${n} WalletLink`)), this._linked = !!i; @@ -28031,7 +28031,7 @@ class Pu { return new Pu(e, r, n).save(); } static load(e) { - const r = e.getItem(P_), n = e.getItem(I_), i = e.getItem(M_); + const r = e.getItem(P6), n = e.getItem(I6), i = e.getItem(M6); return r && i ? new Pu(e, r, i, n === "1") : null; } get linked() { @@ -28041,10 +28041,10 @@ class Pu { this._linked = e, this.persistLinked(); } save() { - return this.storage.setItem(P_, this.id), this.storage.setItem(M_, this.secret), this.persistLinked(), this; + return this.storage.setItem(P6, this.id), this.storage.setItem(M6, this.secret), this.persistLinked(), this; } persistLinked() { - this.storage.setItem(I_, this._linked ? "1" : "0"); + this.storage.setItem(I6, this._linked ? "1" : "0"); } } function hJ() { @@ -28085,7 +28085,7 @@ function rl() { for (var t, e, r = 0, n = ""; r < arguments.length; ) (t = arguments[r++]) && (e = AS(t)) && (n && (n += " "), n += e); return n; } -var Ep, Jr, PS, ac, C_, MS, tv, IS, Nb, rv, nv, $l = {}, CS = [], mJ = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Lb = Array.isArray; +var Ep, Jr, PS, ac, C6, MS, tv, IS, Nb, rv, nv, $l = {}, CS = [], mJ = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Lb = Array.isArray; function va(t, e) { for (var r in e) t[r] = e[r]; return t; @@ -28124,8 +28124,8 @@ function TS(t) { return TS(t); } } -function T_(t) { - (!t.__d && (t.__d = !0) && ac.push(t) && !A0.__r++ || C_ !== Jr.debounceRendering) && ((C_ = Jr.debounceRendering) || MS)(A0); +function T6(t) { + (!t.__d && (t.__d = !0) && ac.push(t) && !A0.__r++ || C6 !== Jr.debounceRendering) && ((C6 = Jr.debounceRendering) || MS)(A0); } function A0() { var t, e, r, n, i, s, o, a; @@ -28170,15 +28170,15 @@ function bJ(t, e, r, n) { } return -1; } -function R_(t, e, r) { +function R6(t, e, r) { e[0] === "-" ? t.setProperty(e, r ?? "") : t[e] = r == null ? "" : typeof r != "number" || mJ.test(e) ? r : r + "px"; } function Ad(t, e, r, n, i) { var s; e: if (e === "style") if (typeof r == "string") t.style.cssText = r; else { - if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || R_(t.style, e, ""); - if (r) for (e in r) n && r[e] === n[e] || R_(t.style, e, r[e]); + if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || R6(t.style, e, ""); + if (r) for (e in r) n && r[e] === n[e] || R6(t.style, e, r[e]); } else if (e[0] === "o" && e[1] === "n") s = e !== (e = e.replace(IS, "$1")), e = e.toLowerCase() in t || e === "onFocusOut" || e === "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = Nb, t.addEventListener(e, s ? nv : rv, s)) : t.removeEventListener(e, s ? nv : rv, s); else { @@ -28191,7 +28191,7 @@ function Ad(t, e, r, n, i) { typeof r == "function" || (r == null || r === !1 && e[4] !== "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && r == 1 ? "" : r)); } } -function D_(t) { +function D6(t) { return function(e) { if (this.l) { var r = this.l[e.type + t]; @@ -28317,19 +28317,19 @@ Ep = CS.slice, Jr = { __e: function(t, e, r, n) { throw t; } }, PS = 0, Kd.prototype.setState = function(t, e) { var r; - r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = va({}, this.state), typeof t == "function" && (t = t(va({}, r), this.props)), t && va(r, t), t != null && this.__v && (e && this._sb.push(e), T_(this)); + r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = va({}, this.state), typeof t == "function" && (t = t(va({}, r), this.props)), t && va(r, t), t != null && this.__v && (e && this._sb.push(e), T6(this)); }, Kd.prototype.forceUpdate = function(t) { - this.__v && (this.__e = !0, t && this.__h.push(t), T_(this)); + this.__v && (this.__e = !0, t && this.__h.push(t), T6(this)); }, Kd.prototype.render = dh, ac = [], MS = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, tv = function(t, e) { return t.__v.__b - e.__v.__b; -}, A0.__r = 0, IS = /(PointerCapture)$|Capture$/i, Nb = 0, rv = D_(!1), nv = D_(!0); -var P0, pn, Um, O_, sv = 0, LS = [], yn = Jr, N_ = yn.__b, L_ = yn.__r, k_ = yn.diffed, $_ = yn.__c, B_ = yn.unmount, F_ = yn.__; +}, A0.__r = 0, IS = /(PointerCapture)$|Capture$/i, Nb = 0, rv = D6(!1), nv = D6(!0); +var P0, pn, Um, O6, sv = 0, LS = [], yn = Jr, N6 = yn.__b, L6 = yn.__r, k6 = yn.diffed, $6 = yn.__c, B6 = yn.unmount, F6 = yn.__; function kS(t, e) { yn.__h && yn.__h(pn, t, sv || e), sv = 0; var r = pn.__H || (pn.__H = { __: [], __h: [] }); return t >= r.__.length && r.__.push({}), r.__[t]; } -function j_(t) { +function j6(t) { return sv = 1, xJ($S, t); } function xJ(t, e, r) { @@ -28378,19 +28378,19 @@ function EJ() { } } yn.__b = function(t) { - pn = null, N_ && N_(t); + pn = null, N6 && N6(t); }, yn.__ = function(t, e) { - t && e.__k && e.__k.__m && (t.__m = e.__k.__m), F_ && F_(t, e); + t && e.__k && e.__k.__m && (t.__m = e.__k.__m), F6 && F6(t, e); }, yn.__r = function(t) { - L_ && L_(t), P0 = 0; + L6 && L6(t), P0 = 0; var e = (pn = t.__c).__H; e && (Um === pn ? (e.__h = [], pn.__h = [], e.__.forEach(function(r) { r.__N && (r.__ = r.__N), r.i = r.__N = void 0; })) : (e.__h.forEach(Vd), e.__h.forEach(ov), e.__h = [], P0 = 0)), Um = pn; }, yn.diffed = function(t) { - k_ && k_(t); + k6 && k6(t); var e = t.__c; - e && e.__H && (e.__H.__h.length && (LS.push(e) !== 1 && O_ === yn.requestAnimationFrame || ((O_ = yn.requestAnimationFrame) || SJ)(EJ)), e.__H.__.forEach(function(r) { + e && e.__H && (e.__H.__h.length && (LS.push(e) !== 1 && O6 === yn.requestAnimationFrame || ((O6 = yn.requestAnimationFrame) || SJ)(EJ)), e.__H.__.forEach(function(r) { r.i && (r.__H = r.i), r.i = void 0; })), Um = pn = null; }, yn.__c = function(t, e) { @@ -28404,9 +28404,9 @@ yn.__b = function(t) { i.__h && (i.__h = []); }), e = [], yn.__e(n, r.__v); } - }), $_ && $_(t, e); + }), $6 && $6(t, e); }, yn.unmount = function(t) { - B_ && B_(t); + B6 && B6(t); var e, r = t.__c; r && r.__H && (r.__H.__.forEach(function(n) { try { @@ -28416,12 +28416,12 @@ yn.__b = function(t) { } }), r.__H = void 0, e && yn.__e(e, r.__v)); }; -var U_ = typeof requestAnimationFrame == "function"; +var U6 = typeof requestAnimationFrame == "function"; function SJ(t) { var e, r = function() { - clearTimeout(n), U_ && cancelAnimationFrame(e), setTimeout(t); + clearTimeout(n), U6 && cancelAnimationFrame(e), setTimeout(t); }, n = setTimeout(r, 100); - U_ && (e = requestAnimationFrame(r)); + U6 && (e = requestAnimationFrame(r)); } function Vd(t) { var e = pn, r = t.__c; @@ -28470,7 +28470,7 @@ const BS = (t) => Nr( Nr("style", null, PJ), Nr("div", { class: "-cbwsdk-snackbar" }, t.children) ), TJ = ({ autoExpand: t, message: e, menuItems: r }) => { - const [n, i] = j_(!0), [s, o] = j_(t ?? !1); + const [n, i] = j6(!0), [s, o] = j6(t ?? !1); _J(() => { const u = [ window.setTimeout(() => { @@ -28612,8 +28612,8 @@ const NJ = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: ) ) ); -}, LJ = "https://keys.coinbase.com/connect", q_ = "https://www.walletlink.org", kJ = "https://go.cb-w.com/walletlink"; -class z_ { +}, LJ = "https://keys.coinbase.com/connect", q6 = "https://www.walletlink.org", kJ = "https://go.cb-w.com/walletlink"; +class z6 { constructor() { this.attached = !1, this.redirectDialog = new OJ(); } @@ -28677,7 +28677,7 @@ class Mo { session: e, linkAPIUrl: r, listener: this - }), i = this.isMobileWeb ? new z_() : new RJ(); + }), i = this.isMobileWeb ? new z6() : new RJ(); return n.connect(), { session: e, ui: i, connection: n }; } resetAndReload() { @@ -28765,7 +28765,7 @@ class Mo { } // copied from MobileRelay openCoinbaseWalletDeeplink(e) { - if (this.ui instanceof z_) + if (this.ui instanceof z6) switch (e) { case "requestEthereumAccounts": case "switchEthereumChain": @@ -28913,10 +28913,10 @@ class Mo { } } Mo.accountRequestCallbackIds = /* @__PURE__ */ new Set(); -const W_ = "DefaultChainId", H_ = "DefaultJsonRpcUrl"; +const W6 = "DefaultChainId", H6 = "DefaultJsonRpcUrl"; class FS { constructor(e) { - this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new no("walletlink", q_), this.callback = e.callback || null; + this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new no("walletlink", q6), this.callback = e.callback || null; const r = this._storage.getItem(ev); if (r) { const n = r.split(" "); @@ -28936,16 +28936,16 @@ class FS { } get jsonRpcUrl() { var e; - return (e = this._storage.getItem(H_)) !== null && e !== void 0 ? e : void 0; + return (e = this._storage.getItem(H6)) !== null && e !== void 0 ? e : void 0; } set jsonRpcUrl(e) { - this._storage.setItem(H_, e); + this._storage.setItem(H6, e); } updateProviderInfo(e, r) { var n; this.jsonRpcUrl = e; const i = this.getChainId(); - this._storage.setItem(W_, r.toString(10)), el(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", ma(r))); + this._storage.setItem(W6, r.toString(10)), el(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", ma(r))); } async watchAsset(e) { const r = Array.isArray(e) ? e[0] : e; @@ -29079,7 +29079,7 @@ class FS { } getChainId() { var e; - return Number.parseInt((e = this._storage.getItem(W_)) !== null && e !== void 0 ? e : "1", 10); + return Number.parseInt((e = this._storage.getItem(W6)) !== null && e !== void 0 ? e : "1", 10); } async _eth_requestAccounts() { var e, r; @@ -29159,7 +29159,7 @@ class FS { } initializeRelay() { return this._relay || (this._relay = new Mo({ - linkAPIUrl: q_, + linkAPIUrl: q6, storage: this._storage, metadata: this.metadata, accountsCallback: this._setAddresses.bind(this), @@ -29239,11 +29239,11 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene } } }; -}, { checkCrossOriginOpenerPolicy: WJ, getCrossOriginOpenerPolicy: HJ } = zJ(), K_ = 420, V_ = 540; +}, { checkCrossOriginOpenerPolicy: WJ, getCrossOriginOpenerPolicy: HJ } = zJ(), K6 = 420, V6 = 540; function KJ(t) { - const e = (window.innerWidth - K_) / 2 + window.screenX, r = (window.innerHeight - V_) / 2 + window.screenY; + const e = (window.innerWidth - K6) / 2 + window.screenX, r = (window.innerHeight - V6) / 2 + window.screenY; GJ(t); - const n = window.open(t, "Smart Wallet", `width=${K_}, height=${V_}, left=${e}, top=${r}`); + const n = window.open(t, "Smart Wallet", `width=${K6}, height=${V6}, left=${e}, top=${r}`); if (n == null || n.focus(), !n) throw Ar.rpc.internal("Pop up window failed to open"); return n; @@ -29642,7 +29642,7 @@ const SX = (t, e, r, { allOwnKeys: n } = {}) => (ph(e, (i, s) => { function(r, n, i) { return n.toUpperCase() + i; } -), G_ = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), LX = Ts("RegExp"), GS = (t, e) => { +), G6 = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), LX = Ts("RegExp"), GS = (t, e) => { const r = Object.getOwnPropertyDescriptors(t), n = {}; ph(r, (i, s) => { let o; @@ -29671,10 +29671,10 @@ const SX = (t, e, r, { allOwnKeys: n } = {}) => (ph(e, (i, s) => { }; return Zu(t) ? n(t) : n(String(t).split(e)), r; }, BX = () => { -}, FX = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, qm = "abcdefghijklmnopqrstuvwxyz", Y_ = "0123456789", YS = { - DIGIT: Y_, +}, FX = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, qm = "abcdefghijklmnopqrstuvwxyz", Y6 = "0123456789", YS = { + DIGIT: Y6, ALPHA: qm, - ALPHA_DIGIT: qm + qm.toUpperCase() + Y_ + ALPHA_DIGIT: qm + qm.toUpperCase() + Y6 }, jX = (t = 16, e = YS.ALPHA_DIGIT) => { let r = ""; const { length: n } = e; @@ -29748,8 +29748,8 @@ const qX = (t) => { forEachEntry: RX, matchAll: DX, isHTMLForm: OX, - hasOwnProperty: G_, - hasOwnProp: G_, + hasOwnProperty: G6, + hasOwnProp: G6, // an alias to avoid ESLint no-prototype-builtins detection reduceDescriptors: GS, freezeMethods: kX, @@ -29826,7 +29826,7 @@ function cv(t) { function QS(t) { return Oe.endsWith(t, "[]") ? t.slice(0, -2) : t; } -function J_(t, e, r) { +function J6(t, e, r) { return t ? t.concat(e).map(function(i, s) { return i = QS(i), !r && s ? "[" + i + "]" : i; }).join(r ? "." : "") : e; @@ -29867,12 +29867,12 @@ function Mp(t, e, r) { return O = QS(O), B.forEach(function(W, U) { !(Oe.isUndefined(W) || W === null) && e.append( // eslint-disable-next-line no-nested-ternary - o === !0 ? J_([O], U, s) : o === null ? O : O + "[]", + o === !0 ? J6([O], U, s) : o === null ? O : O + "[]", l(W) ); }), !1; } - return cv(P) ? !0 : (e.append(J_(L, O, s), l(P)), !1); + return cv(P) ? !0 : (e.append(J6(L, O, s), l(P)), !1); } const p = [], w = Object.assign(GX, { defaultVisitor: d, @@ -29898,7 +29898,7 @@ function Mp(t, e, r) { throw new TypeError("data must be an object"); return _(t), e; } -function X_(t) { +function X6(t) { const e = { "!": "%21", "'": "%27", @@ -29921,8 +29921,8 @@ e7.append = function(e, r) { }; e7.toString = function(e) { const r = e ? function(n) { - return e.call(this, n, X_); - } : X_; + return e.call(this, n, X6); + } : X6; return this._pairs.map(function(i) { return r(i[0]) + "=" + r(i[1]); }, "").join("&"); @@ -29945,7 +29945,7 @@ function t7(t, e, r) { } return t; } -class Z_ { +class Z6 { constructor() { this.handlers = []; } @@ -30161,7 +30161,7 @@ const cZ = Oe.toObjectSet([ `).forEach(function(o) { i = o.indexOf(":"), r = o.substring(0, i).trim().toLowerCase(), n = o.substring(i + 1).trim(), !(!r || e[r] && cZ[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n); }), e; -}, Q_ = Symbol("internals"); +}, Q6 = Symbol("internals"); function jf(t) { return t && String(t).trim().toLowerCase(); } @@ -30308,7 +30308,7 @@ let yi = class { return r.forEach((i) => n.set(i)), n; } static accessor(e) { - const n = (this[Q_] = this[Q_] = { + const n = (this[Q6] = this[Q6] = { accessors: {} }).accessors, i = this.prototype; function s(o) { @@ -30406,14 +30406,14 @@ const M0 = (t, e, r = 3) => { }; t(p); }, r); -}, e6 = (t, e) => { +}, e_ = (t, e) => { const r = t != null; return [(n) => e[0]({ lengthComputable: r, total: t, loaded: n }), e[1]]; -}, t6 = (t) => (...e) => Oe.asap(() => t(...e)), vZ = Jn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Jn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( +}, t_ = (t) => (...e) => Oe.asap(() => t(...e)), vZ = Jn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Jn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( new URL(Jn.origin), Jn.navigator && /(msie|trident)/i.test(Jn.navigator.userAgent) ) : () => !0, bZ = Jn.hasStandardBrowserEnv ? ( @@ -30452,7 +30452,7 @@ function wZ(t, e) { function o7(t, e) { return t && !yZ(e) ? wZ(t, e) : e; } -const r6 = (t) => t instanceof yi ? { ...t } : t; +const r_ = (t) => t instanceof yi ? { ...t } : t; function Ec(t, e) { e = e || {}; const r = {}; @@ -30510,7 +30510,7 @@ function Ec(t, e) { socketPath: o, responseEncoding: o, validateStatus: a, - headers: (l, d, p) => i(r6(l), r6(d), p, !0) + headers: (l, d, p) => i(r_(l), r_(d), p, !0) }; return Oe.forEach(Object.keys(Object.assign({}, t, e)), function(d) { const p = u[d] || i, w = p(t[d], e[d], d); @@ -30646,7 +30646,7 @@ const a7 = (t) => { } finally { await e.cancel(); } -}, n6 = (t, e, r, n) => { +}, n_ = (t, e, r, n) => { const i = AZ(t, e); let s = 0, o, a = (u) => { o || (o = !0, n && n(u)); @@ -30691,7 +30691,7 @@ const a7 = (t) => { } }).headers.has("Content-Type"); return t && !e; -}), i6 = 64 * 1024, fv = c7 && u7(() => Oe.isReadableStream(new Response("").body)), I0 = { +}), i_ = 64 * 1024, fv = c7 && u7(() => Oe.isReadableStream(new Response("").body)), I0 = { stream: fv && ((t) => t.body) }; Ip && ((t) => { @@ -30747,11 +30747,11 @@ const CZ = async (t) => { duplex: "half" }), Q; if (Oe.isFormData(n) && (Q = V.headers.get("content-type")) && d.setContentType(Q), V.body) { - const [R, K] = e6( + const [R, K] = e_( L, - M0(t6(u)) + M0(t_(u)) ); - n = n6(V.body, i6, R, K); + n = n_(V.body, i_, R, K); } } Oe.isString(p) || (p = p ? "include" : "omit"); @@ -30772,12 +30772,12 @@ const CZ = async (t) => { ["status", "statusText", "headers"].forEach((ge) => { V[ge] = k[ge]; }); - const Q = Oe.toFiniteNumber(k.headers.get("content-length")), [R, K] = a && e6( + const Q = Oe.toFiniteNumber(k.headers.get("content-length")), [R, K] = a && e_( Q, - M0(t6(a), !0) + M0(t_(a), !0) ) || []; k = new Response( - n6(k.body, i6, R, () => { + n_(k.body, i_, R, () => { K && K(), O && O(); }), V @@ -30817,7 +30817,7 @@ Oe.forEach(lv, (t, e) => { Object.defineProperty(t, "adapterName", { value: e }); } }); -const s6 = (t) => `- ${t}`, DZ = (t) => Oe.isFunction(t) || t === null || t === !1, f7 = { +const s_ = (t) => `- ${t}`, DZ = (t) => Oe.isFunction(t) || t === null || t === !1, f7 = { getAdapter: (t) => { t = Oe.isArray(t) ? t : [t]; const { length: e } = t; @@ -30837,8 +30837,8 @@ const s6 = (t) => `- ${t}`, DZ = (t) => Oe.isFunction(t) || t === null || t === ([a, u]) => `adapter ${a} ` + (u === !1 ? "is not supported by the environment" : "is not available in the build") ); let o = e ? s.length > 1 ? `since : -` + s.map(s6).join(` -`) : " " + s6(s[0]) : "as no adapter specified"; +` + s.map(s_).join(` +`) : " " + s_(s[0]) : "as no adapter specified"; throw new or( "There is no suitable adapter to dispatch the request " + o, "ERR_NOT_SUPPORT" @@ -30852,7 +30852,7 @@ function Hm(t) { if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted) throw new Qu(null, t); } -function o6(t) { +function o_(t) { return Hm(t), t.headers = yi.from(t.headers), t.data = Wm.call( t, t.transformRequest @@ -30876,7 +30876,7 @@ const l7 = "1.7.8", Cp = {}; return typeof n === t || "a" + (e < 1 ? "n " : " ") + t; }; }); -const a6 = {}; +const a_ = {}; Cp.transitional = function(e, r, n) { function i(s, o) { return "[Axios v" + l7 + "] Transitional option '" + s + "'" + o + (n ? ". " + n : ""); @@ -30887,7 +30887,7 @@ Cp.transitional = function(e, r, n) { i(o, " has been removed" + (r ? " in " + r : "")), or.ERR_DEPRECATED ); - return r && !a6[o] && (a6[o] = !0, console.warn( + return r && !a_[o] && (a_[o] = !0, console.warn( i( o, " has been deprecated since v" + r + " and will be removed in the near future" @@ -30922,8 +30922,8 @@ const Jd = { let pc = class { constructor(e) { this.defaults = e, this.interceptors = { - request: new Z_(), - response: new Z_() + request: new Z6(), + response: new Z6() }; } /** @@ -30988,7 +30988,7 @@ let pc = class { }); let d, p = 0, w; if (!u) { - const P = [o6.bind(this), void 0]; + const P = [o_.bind(this), void 0]; for (P.unshift.apply(P, a), P.push.apply(P, l), w = P.length, d = Promise.resolve(r); p < w; ) d = d.then(P[p++], P[p++]); return d; @@ -31005,7 +31005,7 @@ let pc = class { } } try { - d = o6.call(this, _); + d = o_.call(this, _); } catch (P) { return Promise.reject(P); } @@ -31610,9 +31610,9 @@ const ZZ = ls("UserRoundCheck", [ ["path", { d: "M2 21a8 8 0 0 1 13.292-6", key: "bjp14o" }], ["circle", { cx: "10", cy: "8", r: "5", key: "o932ke" }], ["path", { d: "m16 19 2 2 4-4", key: "1b14m6" }] -]), c6 = /* @__PURE__ */ new Set(); +]), c_ = /* @__PURE__ */ new Set(); function Rp(t, e, r) { - t || c6.has(e) || (console.warn(e), c6.add(e)); + t || c_.has(e) || (console.warn(e), c_.add(e)); } function QZ(t) { if (typeof Proxy > "u") @@ -31645,7 +31645,7 @@ function x7(t, e) { function Fl(t) { return typeof t == "string" || Array.isArray(t); } -function u6(t) { +function u_(t) { const e = [{}, {}]; return t == null || t.values.forEach((r, n) => { e[0][n] = r.get(), e[1][n] = r.getVelocity(); @@ -31653,11 +31653,11 @@ function u6(t) { } function qb(t, e, r, n) { if (typeof e == "function") { - const [i, s] = u6(n); + const [i, s] = u_(n); e = e(r !== void 0 ? r : t.custom, i, s); } if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") { - const [i, s] = u6(n); + const [i, s] = u_(n); e = e(r !== void 0 ? r : t.custom, i, s); } return e; @@ -31856,7 +31856,7 @@ const Ma = (t, e, r) => r > e ? e : r < t ? t : r, tf = { test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1, parse: parseFloat, transform: (e) => `${e}${t}` -}), ca = /* @__PURE__ */ bh("deg"), Xs = /* @__PURE__ */ bh("%"), Vt = /* @__PURE__ */ bh("px"), bQ = /* @__PURE__ */ bh("vh"), yQ = /* @__PURE__ */ bh("vw"), f6 = { +}), ca = /* @__PURE__ */ bh("deg"), Xs = /* @__PURE__ */ bh("%"), Vt = /* @__PURE__ */ bh("px"), bQ = /* @__PURE__ */ bh("vh"), yQ = /* @__PURE__ */ bh("vw"), f_ = { ...Xs, parse: (t) => Xs.parse(t) / 100, transform: (t) => Xs.transform(t * 100) @@ -31871,15 +31871,15 @@ const Ma = (t, e, r) => r > e ? e : r < t ? t : r, tf = { "y", "translateX", "translateY" -]), l6 = (t) => t === tf || t === Vt, h6 = (t, e) => parseFloat(t.split(", ")[e]), d6 = (t, e) => (r, { transform: n }) => { +]), l_ = (t) => t === tf || t === Vt, h_ = (t, e) => parseFloat(t.split(", ")[e]), d_ = (t, e) => (r, { transform: n }) => { if (n === "none" || !n) return 0; const i = n.match(/^matrix3d\((.+)\)$/u); if (i) - return h6(i[1], e); + return h_(i[1], e); { const s = n.match(/^matrix\((.+)\)$/u); - return s ? h6(s[1], t) : 0; + return s ? h_(s[1], t) : 0; } }, xQ = /* @__PURE__ */ new Set(["x", "y", "z"]), _Q = mh.filter((t) => !xQ.has(t)); function EQ(t) { @@ -31898,15 +31898,15 @@ const $u = { bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min), right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min), // Transform - x: d6(4, 13), - y: d6(5, 14) + x: d_(4, 13), + y: d_(5, 14) }; $u.translateX = $u.x; $u.translateY = $u.y; const k7 = (t) => (e) => e.test(t), SQ = { test: (t) => t === "auto", parse: (t) => t -}, $7 = [tf, Vt, Xs, ca, yQ, bQ, SQ], p6 = (t) => $7.find(k7(t)), gc = /* @__PURE__ */ new Set(); +}, $7 = [tf, Vt, Xs, ca, yQ, bQ, SQ], p_ = (t) => $7.find(k7(t)), gc = /* @__PURE__ */ new Set(); let pv = !1, gv = !1; function B7() { if (gv) { @@ -32024,7 +32024,7 @@ function RQ(t) { var e, r; return isNaN(t) && typeof t == "string" && (((e = t.match(Jb)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match(TQ)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; } -const U7 = "number", q7 = "color", DQ = "var", OQ = "var(", g6 = "${}", NQ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; +const U7 = "number", q7 = "color", DQ = "var", OQ = "var(", g_ = "${}", NQ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; function Ul(t) { const e = t.toString(), r = [], n = { color: [], @@ -32032,7 +32032,7 @@ function Ul(t) { var: [] }, i = []; let s = 0; - const a = e.replace(NQ, (u) => (Yn.test(u) ? (n.color.push(s), i.push(q7), r.push(Yn.parse(u))) : u.startsWith(OQ) ? (n.var.push(s), i.push(DQ), r.push(u)) : (n.number.push(s), i.push(U7), r.push(parseFloat(u))), ++s, g6)).split(g6); + const a = e.replace(NQ, (u) => (Yn.test(u) ? (n.color.push(s), i.push(q7), r.push(Yn.parse(u))) : u.startsWith(OQ) ? (n.var.push(s), i.push(DQ), r.push(u)) : (n.number.push(s), i.push(U7), r.push(parseFloat(u))), ++s, g_)).split(g_); return { values: r, split: a, indexes: n, types: i }; } function z7(t) { @@ -32136,21 +32136,21 @@ const FQ = /\b([a-z-]*)\(.*?\)/gu, vv = { perspective: Vt, transformPerspective: Vt, opacity: jl, - originX: f6, - originY: f6, + originX: f_, + originY: f_, originZ: Vt -}, m6 = { +}, m_ = { ...tf, transform: Math.round }, Zb = { ...jQ, ...UQ, - zIndex: m6, + zIndex: m_, size: Vt, // SVG fillOpacity: jl, strokeOpacity: jl, - numOctaves: m6 + numOctaves: m_ }, qQ = { ...Zb, // Color props @@ -32201,9 +32201,9 @@ class K7 extends Yb { } if (this.resolveNoneKeyframes(), !wQ.has(n) || e.length !== 2) return; - const [i, s] = e, o = p6(i), a = p6(s); + const [i, s] = e, o = p_(i), a = p_(s); if (o !== a) - if (l6(o) && l6(a)) + if (l_(o) && l_(a)) for (let u = 0; u < e.length; u++) { const l = e[u]; typeof l == "string" && (e[u] = parseFloat(l)); @@ -32250,7 +32250,7 @@ const Zs = { set: (t) => { Xd = t, queueMicrotask(HQ); } -}, v6 = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string +}, v_ = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string (Ia.test(t) || t === "0") && // And it contains numbers and/or colors !t.startsWith("url(")); function KQ(t) { @@ -32267,7 +32267,7 @@ function VQ(t, e, r, n) { return !1; if (e === "display" || e === "visibility") return !0; - const s = t[t.length - 1], o = v6(i, e), a = v6(s, e); + const s = t[t.length - 1], o = v_(i, e), a = v_(s, e); return ef(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : KQ(t) || (r === "spring" || ey(r)) && n; } const GQ = 40; @@ -32353,12 +32353,12 @@ function Y7(t, e, r) { const n = Math.max(e - YQ, 0); return G7(r - t(n), e - n); } -const Gm = 1e-3, JQ = 0.01, b6 = 10, XQ = 0.05, ZQ = 1; +const Gm = 1e-3, JQ = 0.01, b_ = 10, XQ = 0.05, ZQ = 1; function QQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }) { let i, s; - ef(t <= Js(b6), "Spring duration must be 10 seconds or less"); + ef(t <= Js(b_), "Spring duration must be 10 seconds or less"); let o = 1 - e; - o = Ma(XQ, ZQ, o), t = Ma(JQ, b6, No(t)), o < 1 ? (i = (l) => { + o = Ma(XQ, ZQ, o), t = Ma(JQ, b_, No(t)), o < 1 ? (i = (l) => { const d = l * o, p = d * t, w = d - r, _ = bv(l, o), P = Math.exp(-p); return Gm - w / _ * P; }, s = (l) => { @@ -32398,7 +32398,7 @@ function bv(t, e) { return t * Math.sqrt(1 - e * e); } const ree = ["duration", "bounce"], nee = ["stiffness", "damping", "mass"]; -function y6(t, e) { +function y_(t, e) { return e.some((r) => t[r] !== void 0); } function iee(t) { @@ -32410,7 +32410,7 @@ function iee(t) { isResolvedFromDuration: !1, ...t }; - if (!y6(t, nee) && y6(t, ree)) { + if (!y_(t, nee) && y_(t, ree)) { const r = QQ(t); e = { ...e, @@ -32458,7 +32458,7 @@ function J7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { } }; } -function w6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: u, restDelta: l = 0.5, restSpeed: d }) { +function w_({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: u, restDelta: l = 0.5, restSpeed: d }) { const p = t[0], w = { done: !1, value: p @@ -32490,7 +32490,7 @@ function w6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 3 } }; } -const see = /* @__PURE__ */ vh(0.42, 0, 1, 1), oee = /* @__PURE__ */ vh(0, 0, 0.58, 1), X7 = /* @__PURE__ */ vh(0.42, 0, 0.58, 1), aee = (t) => Array.isArray(t) && typeof t[0] != "number", ty = (t) => Array.isArray(t) && typeof t[0] == "number", x6 = { +const see = /* @__PURE__ */ vh(0.42, 0, 1, 1), oee = /* @__PURE__ */ vh(0, 0, 0.58, 1), X7 = /* @__PURE__ */ vh(0.42, 0, 0.58, 1), aee = (t) => Array.isArray(t) && typeof t[0] != "number", ty = (t) => Array.isArray(t) && typeof t[0] == "number", x_ = { linear: Un, easeIn: see, easeInOut: X7, @@ -32502,13 +32502,13 @@ const see = /* @__PURE__ */ vh(0.42, 0, 1, 1), oee = /* @__PURE__ */ vh(0, 0, 0. backInOut: M7, backOut: P7, anticipate: I7 -}, _6 = (t) => { +}, __ = (t) => { if (ty(t)) { Wo(t.length === 4, "Cubic bezier arrays must contain four numerical values."); const [e, r, n, i] = t; return vh(e, r, n, i); } else if (typeof t == "string") - return Wo(x6[t] !== void 0, `Invalid easing type '${t}'`), x6[t]; + return Wo(x_[t] !== void 0, `Invalid easing type '${t}'`), x_[t]; return t; }, cee = (t, e) => (r) => e(t(r)), Lo = (...t) => t.reduce(cee), Bu = (t, e, r) => { const n = e - t; @@ -32540,15 +32540,15 @@ const Jm = (t, e, r) => { const n = t * t, i = r * (e * e - n) + n; return i < 0 ? 0 : Math.sqrt(i); }, fee = [mv, hc, fu], lee = (t) => fee.find((e) => e.test(t)); -function E6(t) { +function E_(t) { const e = lee(t); if (ef(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e) return !1; let r = e.parse(t); return e === fu && (r = uee(r)), r; } -const S6 = (t, e) => { - const r = E6(t), n = E6(e); +const S_ = (t, e) => { + const r = E_(t), n = E_(e); if (!r || !n) return C0(t, e); const i = { ...r }; @@ -32561,7 +32561,7 @@ function dee(t, e) { return (r) => Qr(t, e, r); } function ry(t) { - return typeof t == "number" ? dee : typeof t == "string" ? Gb(t) ? C0 : Yn.test(t) ? S6 : mee : Array.isArray(t) ? Z7 : typeof t == "object" ? Yn.test(t) ? S6 : pee : C0; + return typeof t == "number" ? dee : typeof t == "string" ? Gb(t) ? C0 : Yn.test(t) ? S_ : mee : Array.isArray(t) ? Z7 : typeof t == "object" ? Yn.test(t) ? S_ : pee : C0; } function Z7(t, e) { const r = [...t], n = r.length, i = t.map((s, o) => ry(s)(s, e[o])); @@ -32644,7 +32644,7 @@ function _ee(t, e) { return t.map(() => e || X7).splice(0, t.length - 1); } function T0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" }) { - const i = aee(n) ? n.map(_6) : _6(n), s = { + const i = aee(n) ? n.map(__) : __(n), s = { done: !1, value: e[0] }, o = xee( @@ -32660,14 +32660,14 @@ function T0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" } next: (u) => (s.value = a(u), s.done = u >= t, s) }; } -const A6 = 2e4; +const A_ = 2e4; function Eee(t) { let e = 0; const r = 50; let n = t.next(e); - for (; !n.done && e < A6; ) + for (; !n.done && e < A_; ) e += r, n = t.next(e); - return e >= A6 ? 1 / 0 : e; + return e >= A_ ? 1 / 0 : e; } const See = (t) => { const e = ({ timestamp: r }) => t(r); @@ -32681,8 +32681,8 @@ const See = (t) => { now: () => Fn.isProcessing ? Fn.timestamp : Zs.now() }; }, Aee = { - decay: w6, - inertia: w6, + decay: w_, + inertia: w_, tween: T0, keyframes: T0, spring: J7 @@ -32878,7 +32878,7 @@ function Dee(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatTy direction: o === "reverse" ? "alternate" : "normal" }); } -function P6(t, e) { +function P_(t, e) { t.timeline = e, t.onfinish = null; } const Oee = /* @__PURE__ */ iy(() => Object.hasOwnProperty.call(Element.prototype, "animate")), D0 = 10, Nee = 2e4; @@ -32913,7 +32913,7 @@ const r9 = { function $ee(t) { return t in r9; } -class M6 extends V7 { +class M_ extends V7 { constructor(e) { super(e); const { name: r, motionValue: n, element: i, keyframes: s } = this.options; @@ -32929,7 +32929,7 @@ class M6 extends V7 { e = B.keyframes, e.length === 1 && (e[1] = e[0]), i = B.duration, s = B.times, o = B.ease, a = "keyframes"; } const p = Dee(u.owner.current, l, e, { ...this.options, duration: i, times: s, ease: o }); - return p.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (P6(p, this.pendingTimeline), this.pendingTimeline = void 0) : p.onfinish = () => { + return p.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (P_(p, this.pendingTimeline), this.pendingTimeline = void 0) : p.onfinish = () => { const { onComplete: w } = this.options; u.set(Np(e, this.options, r)), w && w(), this.cancel(), this.resolveFinishedPromise(); }, { @@ -33002,7 +33002,7 @@ class M6 extends V7 { if (!r) return Un; const { animation: n } = r; - P6(n, e); + P_(n, e); } return Un; } @@ -33165,7 +33165,7 @@ const sy = (t, e, r, n = {}, i, s) => (o) => { d.onUpdate(w), d.onComplete(); }), new Fee([]); } - return !s && M6.supports(d) ? new M6(d) : new ny(d); + return !s && M_.supports(d) ? new M_(d) : new ny(d); }, Uee = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), qee = (t) => dv(t) ? t[t.length - 1] || 0 : t; function oy(t, e) { t.indexOf(e) === -1 && t.push(e); @@ -33199,7 +33199,7 @@ class cy { this.subscriptions.length = 0; } } -const I6 = 30, zee = (t) => !isNaN(parseFloat(t)); +const I_ = 30, zee = (t) => !isNaN(parseFloat(t)); class Wee { /** * @param init - The initiating value @@ -33338,9 +33338,9 @@ class Wee { */ getVelocity() { const e = Zs.now(); - if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > I6) + if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > I_) return 0; - const r = Math.min(this.updatedAt - this.prevUpdatedAt, I6); + const r = Math.min(this.updatedAt - this.prevUpdatedAt, I_); return G7(parseFloat(this.current) - parseFloat(this.prevFrameValue), r); } /** @@ -33520,7 +33520,7 @@ function rte(t) { return (e) => Promise.all(e.map(({ animation: r, options: n }) => Zee(t, r, n))); } function nte(t) { - let e = rte(t), r = C6(), n = !0; + let e = rte(t), r = C_(), n = !0; const i = (u) => (l, d) => { var p; const w = Op(t, d, u === "exit" ? (p = t.presenceContext) === null || p === void 0 ? void 0 : p.custom : void 0); @@ -33601,7 +33601,7 @@ function nte(t) { setAnimateFunction: s, getState: () => r, reset: () => { - r = C6(), n = !0; + r = C_(), n = !0; } }; } @@ -33616,7 +33616,7 @@ function Qa(t = !1) { prevResolvedValues: {} }; } -function C6() { +function C_() { return { animate: Qa(!0), whileInView: Qa(), @@ -33706,9 +33706,9 @@ function Ro(t, e, r, n = { passive: !0 }) { function ko(t, e, r, n) { return Ro(t, e, ute(r), n); } -const T6 = (t, e) => Math.abs(t - e); +const T_ = (t, e) => Math.abs(t - e); function fte(t, e) { - const r = T6(t.x, e.x), n = T6(t.y, e.y); + const r = T_(t.x, e.x), n = T_(t.y, e.y); return Math.sqrt(r ** 2 + n ** 2); } class c9 { @@ -33750,14 +33750,14 @@ class c9 { function Xm(t, e) { return e ? { point: e(t.point) } : t; } -function R6(t, e) { +function R_(t, e) { return { x: t.x - e.x, y: t.y - e.y }; } function Zm({ point: t }, e) { return { point: t, - delta: R6(t, u9(e)), - offset: R6(t, lte(e)), + delta: R_(t, u9(e)), + offset: R_(t, lte(e)), velocity: hte(e, 0.1) }; } @@ -33794,15 +33794,15 @@ function f9(t) { return e === null ? (e = t, r) : !1; }; } -const D6 = f9("dragHorizontal"), O6 = f9("dragVertical"); +const D_ = f9("dragHorizontal"), O_ = f9("dragVertical"); function l9(t) { let e = !1; if (t === "y") - e = O6(); + e = O_(); else if (t === "x") - e = D6(); + e = D_(); else { - const r = D6(), n = O6(); + const r = D_(), n = O_(); r && n ? e = () => { r(), n(); } : (r && r(), n && n()); @@ -33823,28 +33823,28 @@ function ki(t) { function vte(t, e, r) { return Math.abs(t - e) <= r; } -function N6(t, e, r, n = 0.5) { +function N_(t, e, r, n = 0.5) { t.origin = n, t.originPoint = Qr(e.min, e.max, t.origin), t.scale = ki(r) / ki(e), t.translate = Qr(r.min, r.max, t.origin) - t.originPoint, (t.scale >= dte && t.scale <= pte || isNaN(t.scale)) && (t.scale = 1), (t.translate >= gte && t.translate <= mte || isNaN(t.translate)) && (t.translate = 0); } function il(t, e, r, n) { - N6(t.x, e.x, r.x, n ? n.originX : void 0), N6(t.y, e.y, r.y, n ? n.originY : void 0); + N_(t.x, e.x, r.x, n ? n.originX : void 0), N_(t.y, e.y, r.y, n ? n.originY : void 0); } -function L6(t, e, r) { +function L_(t, e, r) { t.min = r.min + e.min, t.max = t.min + ki(e); } function bte(t, e, r) { - L6(t.x, e.x, r.x), L6(t.y, e.y, r.y); + L_(t.x, e.x, r.x), L_(t.y, e.y, r.y); } -function k6(t, e, r) { +function k_(t, e, r) { t.min = e.min - r.min, t.max = t.min + ki(e); } function sl(t, e, r) { - k6(t.x, e.x, r.x), k6(t.y, e.y, r.y); + k_(t.x, e.x, r.x), k_(t.y, e.y, r.y); } function yte(t, { min: e, max: r }, n) { return e !== void 0 && t < e ? t = n ? Qr(e, t, n.min) : Math.max(t, e) : r !== void 0 && t > r && (t = n ? Qr(r, t, n.max) : Math.min(t, r)), t; } -function $6(t, e, r) { +function $_(t, e, r) { return { min: e !== void 0 ? t.min + e : void 0, max: r !== void 0 ? t.max + r - (t.max - t.min) : void 0 @@ -33852,18 +33852,18 @@ function $6(t, e, r) { } function wte(t, { top: e, left: r, bottom: n, right: i }) { return { - x: $6(t.x, r, i), - y: $6(t.y, e, n) + x: $_(t.x, r, i), + y: $_(t.y, e, n) }; } -function B6(t, e) { +function B_(t, e) { let r = e.min - t.min, n = e.max - t.max; return e.max - e.min < t.max - t.min && ([r, n] = [n, r]), { min: r, max: n }; } function xte(t, e) { return { - x: B6(t.x, e.x), - y: B6(t.y, e.y) + x: B_(t.x, e.x), + y: B_(t.y, e.y) }; } function _te(t, e) { @@ -33878,30 +33878,30 @@ function Ete(t, e) { const Ev = 0.35; function Ste(t = Ev) { return t === !1 ? t = 0 : t === !0 && (t = Ev), { - x: F6(t, "left", "right"), - y: F6(t, "top", "bottom") + x: F_(t, "left", "right"), + y: F_(t, "top", "bottom") }; } -function F6(t, e, r) { +function F_(t, e, r) { return { - min: j6(t, e), - max: j6(t, r) + min: j_(t, e), + max: j_(t, r) }; } -function j6(t, e) { +function j_(t, e) { return typeof t == "number" ? t : t[e] || 0; } -const U6 = () => ({ +const U_ = () => ({ translate: 0, scale: 1, origin: 0, originPoint: 0 }), hu = () => ({ - x: U6(), - y: U6() -}), q6 = () => ({ min: 0, max: 0 }), ln = () => ({ - x: q6(), - y: q6() + x: U_(), + y: U_() +}), q_ = () => ({ min: 0, max: 0 }), ln = () => ({ + x: q_(), + y: q_() }); function Qi(t) { return [t("x"), t("y")]; @@ -33936,25 +33936,25 @@ function tc(t) { return Sv(t) || m9(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY; } function m9(t) { - return z6(t.x) || z6(t.y); + return z_(t.x) || z_(t.y); } -function z6(t) { +function z_(t) { return t && t !== "0%"; } function O0(t, e, r) { const n = t - r, i = e * n; return r + i; } -function W6(t, e, r, n, i) { +function W_(t, e, r, n, i) { return i !== void 0 && (t = O0(t, i, n)), O0(t, r, n) + e; } function Av(t, e = 0, r = 1, n, i) { - t.min = W6(t.min, e, r, n, i), t.max = W6(t.max, e, r, n, i); + t.min = W_(t.min, e, r, n, i), t.max = W_(t.max, e, r, n, i); } function v9(t, { x: e, y: r }) { Av(t.x, e.translate, e.scale, e.originPoint), Av(t.y, r.translate, r.scale, r.originPoint); } -const H6 = 0.999999999999, K6 = 1.0000000000001; +const H_ = 0.999999999999, K_ = 1.0000000000001; function Mte(t, e, r, n = !1) { const i = r.length; if (!i) @@ -33969,17 +33969,17 @@ function Mte(t, e, r, n = !1) { y: -s.scroll.offset.y }), o && (e.x *= o.x.scale, e.y *= o.y.scale, v9(t, o)), n && tc(s.latestValues) && pu(t, s.latestValues)); } - e.x < K6 && e.x > H6 && (e.x = 1), e.y < K6 && e.y > H6 && (e.y = 1); + e.x < K_ && e.x > H_ && (e.x = 1), e.y < K_ && e.y > H_ && (e.y = 1); } function du(t, e) { t.min = t.min + e, t.max = t.max + e; } -function V6(t, e, r, n, i = 0.5) { +function V_(t, e, r, n, i = 0.5) { const s = Qr(t.min, t.max, i); Av(t, e, r, s, n); } function pu(t, e) { - V6(t.x, e.x, e.scaleX, e.scale, e.originX), V6(t.y, e.y, e.scaleY, e.scale, e.originY); + V_(t.x, e.x, e.scaleX, e.scale, e.originX), V_(t.y, e.y, e.scaleY, e.scale, e.originY); } function b9(t, e) { return g9(Pte(t.getBoundingClientRect(), e)); @@ -34233,7 +34233,7 @@ class Dte extends $a { this.removeGroupControls(), this.removeListeners(); } } -const G6 = (t) => (e, r) => { +const G_ = (t) => (e, r) => { t && Lr.postRender(() => t(e, r)); }; class Ote extends $a { @@ -34249,8 +34249,8 @@ class Ote extends $a { createPanHandlers() { const { onPanSessionStart: e, onPanStart: r, onPan: n, onPanEnd: i } = this.node.getProps(); return { - onSessionStart: G6(e), - onStart: G6(r), + onSessionStart: G_(e), + onStart: G_(r), onMove: n, onEnd: (s, o) => { delete this.session, i && Lr.postRender(() => i(s, o)); @@ -34289,7 +34289,7 @@ const fy = Ta({}), w9 = Ta({}), Zd = { */ hasEverUpdated: !1 }; -function Y6(t, e) { +function Y_(t, e) { return e.max === e.min ? 0 : t / (e.max - e.min) * 100; } const Uf = { @@ -34301,7 +34301,7 @@ const Uf = { t = parseFloat(t); else return t; - const r = Y6(t, e.target.x), n = Y6(t, e.target.y); + const r = Y_(t, e.target.x), n = Y_(t, e.target.y); return `${r}% ${n}%`; } }, Lte = { @@ -34378,7 +34378,7 @@ const Bte = { borderBottomLeftRadius: Uf, borderBottomRightRadius: Uf, boxShadow: Lte -}, _9 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], Fte = _9.length, J6 = (t) => typeof t == "string" ? parseFloat(t) : t, X6 = (t) => typeof t == "number" || Vt.test(t); +}, _9 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], Fte = _9.length, J_ = (t) => typeof t == "string" ? parseFloat(t) : t, X_ = (t) => typeof t == "number" || Vt.test(t); function jte(t, e, r, n, i, s) { i ? (t.opacity = Qr( 0, @@ -34388,25 +34388,25 @@ function jte(t, e, r, n, i, s) { ), t.opacityExit = Qr(e.opacity !== void 0 ? e.opacity : 1, 0, qte(n))) : s && (t.opacity = Qr(e.opacity !== void 0 ? e.opacity : 1, r.opacity !== void 0 ? r.opacity : 1, n)); for (let o = 0; o < Fte; o++) { const a = `border${_9[o]}Radius`; - let u = Z6(e, a), l = Z6(r, a); + let u = Z_(e, a), l = Z_(r, a); if (u === void 0 && l === void 0) continue; - u || (u = 0), l || (l = 0), u === 0 || l === 0 || X6(u) === X6(l) ? (t[a] = Math.max(Qr(J6(u), J6(l), n), 0), (Xs.test(l) || Xs.test(u)) && (t[a] += "%")) : t[a] = l; + u || (u = 0), l || (l = 0), u === 0 || l === 0 || X_(u) === X_(l) ? (t[a] = Math.max(Qr(J_(u), J_(l), n), 0), (Xs.test(l) || Xs.test(u)) && (t[a] += "%")) : t[a] = l; } (e.rotate || r.rotate) && (t.rotate = Qr(e.rotate || 0, r.rotate || 0, n)); } -function Z6(t, e) { +function Z_(t, e) { return t[e] !== void 0 ? t[e] : t.borderRadius; } const Ute = /* @__PURE__ */ E9(0, 0.5, C7), qte = /* @__PURE__ */ E9(0.5, 0.95, Un); function E9(t, e, r) { return (n) => n < t ? 0 : n > e ? 1 : r(Bu(t, e, n)); } -function Q6(t, e) { +function Q_(t, e) { t.min = e.min, t.max = e.max; } function Xi(t, e) { - Q6(t.x, e.x), Q6(t.y, e.y); + Q_(t.x, e.x), Q_(t.y, e.y); } function e5(t, e) { t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin; @@ -40380,10 +40380,10 @@ const Iie = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0- "personal_sign", "eth_signTypedData" ], - chains: ["eip155:1"], + chains: ["eip155:56"], events: ["chainChanged", "accountsChanged", "disconnect"], rpcMap: { - 1: `https://rpc.walletconnect.com?chainId=eip155:1&projectId=${gA}` + 1: `https://rpc.walletconnect.com?chainId=eip155:56&projectId=${gA}` } } }, diff --git a/dist/secp256k1-BeAu1v7B.js b/dist/secp256k1-BScNrxtE.js similarity index 99% rename from dist/secp256k1-BeAu1v7B.js rename to dist/secp256k1-BScNrxtE.js index e3bb459..310528c 100644 --- a/dist/secp256k1-BeAu1v7B.js +++ b/dist/secp256k1-BScNrxtE.js @@ -1,4 +1,4 @@ -import { a as at, b as st, h as xt, i as Tt, c as F, H as Jt, d as te, t as ee, e as ne, f as qt, g as re, r as oe, s as ie } from "./main-bMMpd4wM.js"; +import { a as at, b as st, h as xt, i as Tt, c as F, H as Jt, d as te, t as ee, e as ne, f as qt, g as re, r as oe, s as ie } from "./main-L4HtPONr.js"; /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const St = /* @__PURE__ */ BigInt(0), Et = /* @__PURE__ */ BigInt(1); function lt(e, n) { diff --git a/lib/components/wallet-qr.tsx b/lib/components/wallet-qr.tsx index 51a5322..9c22c90 100644 --- a/lib/components/wallet-qr.tsx +++ b/lib/components/wallet-qr.tsx @@ -29,10 +29,10 @@ const walletProviderConnectConfig = { 'personal_sign', 'eth_signTypedData', ], - chains: ['eip155:1'], + chains: ['eip155:56'], events: ['chainChanged', 'accountsChanged', 'disconnect'], rpcMap: { - 1: `https://rpc.walletconnect.com?chainId=eip155:1&projectId=${WALLETCONNECT_PROJECT_ID}`, + 1: `https://rpc.walletconnect.com?chainId=eip155:56&projectId=${WALLETCONNECT_PROJECT_ID}`, }, }, }, diff --git a/package.json b/package.json index 7fd70f3..5c8be74 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codatta-connect", - "version": "2.5.6", + "version": "2.5.8", "type": "module", "main": "./dist/index.umd.js", "module": "./dist/index.es.js", From 1b3f6818ff71c9bf760f74338160142d4e6d9b2f Mon Sep 17 00:00:00 2001 From: Meow Lord Date: Fri, 19 Sep 2025 11:07:22 +0800 Subject: [PATCH 21/25] feat: change binance wallet order --- lib/constant/wallet-book.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/constant/wallet-book.ts b/lib/constant/wallet-book.ts index c25f902..3f31812 100644 --- a/lib/constant/wallet-book.ts +++ b/lib/constant/wallet-book.ts @@ -53,6 +53,15 @@ export const WalletBook: WalletConfig[] = [ deep_link: 'metamask://wc', universal_link: 'https://metamask.app.link/wc', }, + { + name: 'Binance Wallet', + featured: true, + image: `${walletIconsImage}#ebac7b39-688c-41e3-7912-a4fefba74600`, + getWallet: { + play_store_id: 'com.binance.dev', + app_store_id: 'id1436799971', + } + }, { featured: true, @@ -129,14 +138,6 @@ export const WalletBook: WalletConfig[] = [ play_store_id: "com.debank.rabbymobile", app_store_id: "id6474381673", } - },{ - name: 'Binance Web3 Wallet', - featured: false, - image: `${walletIconsImage}#ebac7b39-688c-41e3-7912-a4fefba74600`, - getWallet: { - play_store_id: 'com.binance.dev', - app_store_id: 'id1436799971', - } }, { name: 'Rainbow Wallet', From 6cc76ae3c845a89bdcc682e5483a766233192686 Mon Sep 17 00:00:00 2001 From: Meow Lord Date: Fri, 19 Sep 2025 12:41:01 +0800 Subject: [PATCH 22/25] relase: 2.6.9 --- dist/codatta-connect.css | 1 + dist/index.es.js | 2 +- dist/index.umd.js | 202 +- dist/main-D60MaR66.js | 44351 ++++++++++++++++ dist/main-L4HtPONr.js | 44032 --------------- ...56k1-BScNrxtE.js => secp256k1-DbKZjSuc.js} | 2 +- dist/style.css | 1 - lib/components/get-wallet.tsx | 2 +- lib/constant/wallet-book.ts | 1 + package-lock.json | 691 +- package.json | 4 +- src/views/login-view.tsx | 5 +- ....timestamp-1750323952300-797e593ea1f06.mjs | 41 - vite.config.dev.ts | 3 +- 14 files changed, 44925 insertions(+), 44413 deletions(-) create mode 100644 dist/codatta-connect.css create mode 100644 dist/main-D60MaR66.js delete mode 100644 dist/main-L4HtPONr.js rename dist/{secp256k1-BScNrxtE.js => secp256k1-DbKZjSuc.js} (99%) delete mode 100644 dist/style.css delete mode 100644 vite.config.build.ts.timestamp-1750323952300-797e593ea1f06.mjs diff --git a/dist/codatta-connect.css b/dist/codatta-connect.css new file mode 100644 index 0000000..fd83dcb --- /dev/null +++ b/dist/codatta-connect.css @@ -0,0 +1 @@ +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.xc-pointer-events-none{pointer-events:none}.xc-absolute{position:absolute}.xc-relative{position:relative}.xc-inset-0{inset:0}.xc-left-0{left:0}.xc-right-2{right:.5rem}.xc-top-0{top:0}.xc-z-10{z-index:10}.xc-m-auto{margin:auto}.xc-mx-auto{margin-left:auto;margin-right:auto}.xc-mb-1{margin-bottom:.25rem}.xc-mb-12{margin-bottom:3rem}.xc-mb-2{margin-bottom:.5rem}.xc-mb-3{margin-bottom:.75rem}.xc-mb-4{margin-bottom:1rem}.xc-mb-6{margin-bottom:1.5rem}.xc-mb-8{margin-bottom:2rem}.xc-ml-auto{margin-left:auto}.xc-mt-4{margin-top:1rem}.xc-box-content{box-sizing:content-box}.xc-block{display:block}.xc-inline-block{display:inline-block}.xc-flex{display:flex}.xc-grid{display:grid}.xc-aspect-\[1\/1\]{aspect-ratio:1/1}.xc-h-1{height:.25rem}.xc-h-10{height:2.5rem}.xc-h-12{height:3rem}.xc-h-16{height:4rem}.xc-h-4{height:1rem}.xc-h-5{height:1.25rem}.xc-h-6{height:1.5rem}.xc-h-\[309px\]{height:309px}.xc-h-full{height:100%}.xc-h-screen{height:100vh}.xc-max-h-\[272px\]{max-height:272px}.xc-max-h-\[309px\]{max-height:309px}.xc-w-1{width:.25rem}.xc-w-10{width:2.5rem}.xc-w-12{width:3rem}.xc-w-16{width:4rem}.xc-w-5{width:1.25rem}.xc-w-6{width:1.5rem}.xc-w-full{width:100%}.xc-w-px{width:1px}.xc-min-w-\[160px\]{min-width:160px}.xc-min-w-\[277px\]{min-width:277px}.xc-max-w-\[272px\]{max-width:272px}.xc-max-w-\[400px\]{max-width:400px}.xc-max-w-\[420px\]{max-width:420px}.xc-flex-1{flex:1 1 0%}.xc-shrink-0{flex-shrink:0}@keyframes xc-caret-blink{0%,70%,to{opacity:1}20%,50%{opacity:0}}.xc-animate-caret-blink{animation:xc-caret-blink 1.25s ease-out infinite}@keyframes xc-spin{to{transform:rotate(360deg)}}.xc-animate-spin{animation:xc-spin 1s linear infinite}.xc-cursor-pointer{cursor:pointer}.xc-appearance-none{appearance:none}.xc-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.xc-flex-col{flex-direction:column}.xc-flex-wrap{flex-wrap:wrap}.xc-items-center{align-items:center}.xc-justify-center{justify-content:center}.xc-justify-between{justify-content:space-between}.xc-gap-2{gap:.5rem}.xc-gap-3{gap:.75rem}.xc-gap-4{gap:1rem}.xc-overflow-hidden{overflow:hidden}.xc-overflow-scroll{overflow:scroll}.xc-rounded-2xl{border-radius:1rem}.xc-rounded-full{border-radius:9999px}.xc-rounded-lg{border-radius:.5rem}.xc-rounded-md{border-radius:.375rem}.xc-rounded-xl{border-radius:.75rem}.xc-border{border-width:1px}.xc-border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.xc-border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.xc-border-opacity-15{--tw-border-opacity: .15}.xc-border-opacity-20{--tw-border-opacity: .2}.xc-bg-\[\#009E8C\]{--tw-bg-opacity: 1;background-color:rgb(0 158 140 / var(--tw-bg-opacity, 1))}.xc-bg-\[\#2596FF\]{--tw-bg-opacity: 1;background-color:rgb(37 150 255 / var(--tw-bg-opacity, 1))}.xc-bg-\[rgb\(135\,93\,255\)\]{--tw-bg-opacity: 1;background-color:rgb(135 93 255 / var(--tw-bg-opacity, 1))}.xc-bg-\[rgb\(28\,28\,38\)\]{--tw-bg-opacity: 1;background-color:rgb(28 28 38 / var(--tw-bg-opacity, 1))}.xc-bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.xc-bg-transparent{background-color:transparent}.xc-bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.xc-bg-opacity-10{--tw-bg-opacity: .1}.xc-p-1{padding:.25rem}.xc-p-6{padding:1.5rem}.xc-px-3{padding-left:.75rem;padding-right:.75rem}.xc-px-4{padding-left:1rem;padding-right:1rem}.xc-px-6{padding-left:1.5rem;padding-right:1.5rem}.xc-px-8{padding-left:2rem;padding-right:2rem}.xc-py-1{padding-top:.25rem;padding-bottom:.25rem}.xc-py-2{padding-top:.5rem;padding-bottom:.5rem}.xc-py-3{padding-top:.75rem;padding-bottom:.75rem}.xc-text-center{text-align:center}.xc-text-2xl{font-size:1.5rem;line-height:2rem}.xc-text-lg{font-size:1.125rem;line-height:1.75rem}.xc-text-sm{font-size:.875rem;line-height:1.25rem}.xc-text-xl{font-size:1.25rem;line-height:1.75rem}.xc-text-xs{font-size:.75rem;line-height:1rem}.xc-font-bold{font-weight:700}.xc-text-\[\#ff0000\]{--tw-text-opacity: 1;color:rgb(255 0 0 / var(--tw-text-opacity, 1))}.xc-text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.xc-text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.xc-text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.xc-text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.xc-opacity-0{opacity:0}.xc-opacity-100{opacity:1}.xc-opacity-20{opacity:.2}.xc-opacity-50{opacity:.5}.xc-opacity-80{opacity:.8}.xc-outline-none{outline:2px solid transparent;outline-offset:2px}.xc-ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.xc-ring-\[rgb\(135\,93\,255\)\]{--tw-ring-opacity: 1;--tw-ring-color: rgb(135 93 255 / var(--tw-ring-opacity, 1))}.xc-transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.xc-duration-1000{transition-duration:1s}.no-scrollbar::-webkit-scrollbar{display:none}.\[key\:string\]{key:string}.focus-within\:xc-border-opacity-40:focus-within{--tw-border-opacity: .4}.hover\:xc-shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.disabled\:xc-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:xc-bg-white:disabled{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.disabled\:xc-bg-opacity-10:disabled{--tw-bg-opacity: .1}.disabled\:xc-text-opacity-50:disabled{--tw-text-opacity: .5}.disabled\:xc-opacity-20:disabled{opacity:.2}.xc-group:hover .group-hover\:xc-left-2{left:.5rem}.xc-group:hover .group-hover\:xc-right-0{right:0}.xc-group:hover .group-hover\:xc-opacity-0{opacity:0}.xc-group:hover .group-hover\:xc-opacity-100{opacity:1} diff --git a/dist/index.es.js b/dist/index.es.js index bf70baa..d8ac4cd 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -1,4 +1,4 @@ -import { l as o, C as e, k as n, W as C, j as s, u as d } from "./main-L4HtPONr.js"; +import { l as o, C as e, k as n, W as C, j as s, u as d } from "./main-D60MaR66.js"; export { o as CodattaConnect, e as CodattaConnectContextProvider, diff --git a/dist/index.umd.js b/dist/index.umd.js index 3250d1f..b0da385 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -1,4 +1,4 @@ -(function(Pn,Ee){typeof exports=="object"&&typeof module<"u"?Ee(exports,require("react"),require("https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js")):typeof define=="function"&&define.amd?define(["exports","react","https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"],Ee):(Pn=typeof globalThis<"u"?globalThis:Pn||self,Ee(Pn["xny-connect"]={},Pn.React))})(this,function(Pn,Ee){"use strict";var zoe=Object.defineProperty;var Hoe=(Pn,Ee,zc)=>Ee in Pn?zoe(Pn,Ee,{enumerable:!0,configurable:!0,writable:!0,value:zc}):Pn[Ee]=zc;var Ns=(Pn,Ee,zc)=>Hoe(Pn,typeof Ee!="symbol"?Ee+"":Ee,zc);function zc(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const Yt=zc(Ee);var nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ji(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function cg(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var ug={exports:{}},mf={};/** +(function(Ii,Se){typeof exports=="object"&&typeof module<"u"?Se(exports,require("react"),require("https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js")):typeof define=="function"&&define.amd?define(["exports","react","https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"],Se):(Ii=typeof globalThis<"u"?globalThis:Ii||self,Se(Ii["xny-connect"]={},Ii.React))})(this,(function(Ii,Se){"use strict";function MA(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const Yt=MA(Se);var Wn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Mi(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ny(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var r=function n(){var i=!1;try{i=this instanceof n}catch{}return i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Rl={exports:{}},du={};/** * @license React * react-jsx-runtime.production.min.js * @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var tw;function PP(){if(tw)return mf;tw=1;var t=Ee,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,u,l){var d,p={},y=null,_=null;l!==void 0&&(y=""+l),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(_=u.ref);for(d in u)n.call(u,d)&&!s.hasOwnProperty(d)&&(p[d]=u[d]);if(a&&a.defaultProps)for(d in u=a.defaultProps,u)p[d]===void 0&&(p[d]=u[d]);return{$$typeof:e,type:a,key:y,ref:_,props:p,_owner:i.current}}return mf.Fragment=r,mf.jsx=o,mf.jsxs=o,mf}var vf={};/** + */var iy;function CA(){if(iy)return du;iy=1;var t=Se,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,f,u){var h,g={},b=null,x=null;u!==void 0&&(b=""+u),f.key!==void 0&&(b=""+f.key),f.ref!==void 0&&(x=f.ref);for(h in f)n.call(f,h)&&!s.hasOwnProperty(h)&&(g[h]=f[h]);if(a&&a.defaultProps)for(h in f=a.defaultProps,f)g[h]===void 0&&(g[h]=f[h]);return{$$typeof:e,type:a,key:b,ref:x,props:g,_owner:i.current}}return du.Fragment=r,du.jsx=o,du.jsxs=o,du}var pu={};/** * @license React * react-jsx-runtime.development.js * @@ -14,42 +14,42 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var rw;function MP(){return rw||(rw=1,process.env.NODE_ENV!=="production"&&function(){var t=Ee,e=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),_=Symbol.for("react.offscreen"),M=Symbol.iterator,O="@@iterator";function L(q){if(q===null||typeof q!="object")return null;var ae=M&&q[M]||q[O];return typeof ae=="function"?ae:null}var B=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function k(q){{for(var ae=arguments.length,pe=new Array(ae>1?ae-1:0),_e=1;_e=1&&tt>=0&&Ue[st]!==mt[tt];)tt--;for(;st>=1&&tt>=0;st--,tt--)if(Ue[st]!==mt[tt]){if(st!==1||tt!==1)do if(st--,tt--,tt<0||Ue[st]!==mt[tt]){var At=` -`+Ue[st].replace(" at new "," at ");return q.displayName&&At.includes("")&&(At=At.replace("",q.displayName)),typeof q=="function"&&T.set(q,At),At}while(st>=1&&tt>=0);break}}}finally{Q=!1,se.current=De,D(),Error.prepareStackTrace=Re}var Rt=q?q.displayName||q.name:"",Mt=Rt?J(Rt):"";return typeof q=="function"&&T.set(q,Mt),Mt}function ge(q,ae,pe){return re(q,!1)}function oe(q){var ae=q.prototype;return!!(ae&&ae.isReactComponent)}function fe(q,ae,pe){if(q==null)return"";if(typeof q=="function")return re(q,oe(q));if(typeof q=="string")return J(q);switch(q){case l:return J("Suspense");case d:return J("SuspenseList")}if(typeof q=="object")switch(q.$$typeof){case u:return ge(q.render);case p:return fe(q.type,ae,pe);case y:{var _e=q,Re=_e._payload,De=_e._init;try{return fe(De(Re),ae,pe)}catch{}}}return""}var be=Object.prototype.hasOwnProperty,Me={},Ne=B.ReactDebugCurrentFrame;function Te(q){if(q){var ae=q._owner,pe=fe(q.type,q._source,ae?ae.type:null);Ne.setExtraStackFrame(pe)}else Ne.setExtraStackFrame(null)}function $e(q,ae,pe,_e,Re){{var De=Function.call.bind(be);for(var it in q)if(De(q,it)){var Ue=void 0;try{if(typeof q[it]!="function"){var mt=Error((_e||"React class")+": "+pe+" type `"+it+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof q[it]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw mt.name="Invariant Violation",mt}Ue=q[it](ae,it,_e,pe,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(st){Ue=st}Ue&&!(Ue instanceof Error)&&(Te(Re),k("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",_e||"React class",pe,it,typeof Ue),Te(null)),Ue instanceof Error&&!(Ue.message in Me)&&(Me[Ue.message]=!0,Te(Re),k("Failed %s type: %s",pe,Ue.message),Te(null))}}}var Ie=Array.isArray;function Le(q){return Ie(q)}function Ve(q){{var ae=typeof Symbol=="function"&&Symbol.toStringTag,pe=ae&&q[Symbol.toStringTag]||q.constructor.name||"Object";return pe}}function ke(q){try{return ze(q),!1}catch{return!0}}function ze(q){return""+q}function He(q){if(ke(q))return k("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ve(q)),ze(q)}var Se=B.ReactCurrentOwner,Qe={key:!0,ref:!0,__self:!0,__source:!0},ct,Be,et;et={};function rt(q){if(be.call(q,"ref")){var ae=Object.getOwnPropertyDescriptor(q,"ref").get;if(ae&&ae.isReactWarning)return!1}return q.ref!==void 0}function Je(q){if(be.call(q,"key")){var ae=Object.getOwnPropertyDescriptor(q,"key").get;if(ae&&ae.isReactWarning)return!1}return q.key!==void 0}function gt(q,ae){if(typeof q.ref=="string"&&Se.current&&ae&&Se.current.stateNode!==ae){var pe=m(Se.current.type);et[pe]||(k('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',m(Se.current.type),q.ref),et[pe]=!0)}}function ht(q,ae){{var pe=function(){ct||(ct=!0,k("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ae))};pe.isReactWarning=!0,Object.defineProperty(q,"key",{get:pe,configurable:!0})}}function ft(q,ae){{var pe=function(){Be||(Be=!0,k("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ae))};pe.isReactWarning=!0,Object.defineProperty(q,"ref",{get:pe,configurable:!0})}}var Ht=function(q,ae,pe,_e,Re,De,it){var Ue={$$typeof:e,type:q,key:ae,ref:pe,props:it,_owner:De};return Ue._store={},Object.defineProperty(Ue._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ue,"_self",{configurable:!1,enumerable:!1,writable:!1,value:_e}),Object.defineProperty(Ue,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Re}),Object.freeze&&(Object.freeze(Ue.props),Object.freeze(Ue)),Ue};function Jt(q,ae,pe,_e,Re){{var De,it={},Ue=null,mt=null;pe!==void 0&&(He(pe),Ue=""+pe),Je(ae)&&(He(ae.key),Ue=""+ae.key),rt(ae)&&(mt=ae.ref,gt(ae,Re));for(De in ae)be.call(ae,De)&&!Qe.hasOwnProperty(De)&&(it[De]=ae[De]);if(q&&q.defaultProps){var st=q.defaultProps;for(De in st)it[De]===void 0&&(it[De]=st[De])}if(Ue||mt){var tt=typeof q=="function"?q.displayName||q.name||"Unknown":q;Ue&&ht(it,tt),mt&&ft(it,tt)}return Ht(q,Ue,mt,Re,_e,Se.current,it)}}var St=B.ReactCurrentOwner,er=B.ReactDebugCurrentFrame;function Xt(q){if(q){var ae=q._owner,pe=fe(q.type,q._source,ae?ae.type:null);er.setExtraStackFrame(pe)}else er.setExtraStackFrame(null)}var Ot;Ot=!1;function Bt(q){return typeof q=="object"&&q!==null&&q.$$typeof===e}function Tt(){{if(St.current){var q=m(St.current.type);if(q)return` + */var sy;function RA(){return sy||(sy=1,process.env.NODE_ENV!=="production"&&(function(){var t=Se,e=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),S=Symbol.iterator,C="@@iterator";function D(j){if(j===null||typeof j!="object")return null;var oe=S&&j[S]||j[C];return typeof oe=="function"?oe:null}var B=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function L(j){{for(var oe=arguments.length,le=new Array(oe>1?oe-1:0),me=1;me=1&&ot>=0&&et[rt]!==Ze[ot];)ot--;for(;rt>=1&&ot>=0;rt--,ot--)if(et[rt]!==Ze[ot]){if(rt!==1||ot!==1)do if(rt--,ot--,ot<0||et[rt]!==Ze[ot]){var yt=` +`+et[rt].replace(" at new "," at ");return j.displayName&&yt.includes("")&&(yt=yt.replace("",j.displayName)),typeof j=="function"&&N.set(j,yt),yt}while(rt>=1&&ot>=0);break}}}finally{te=!1,ie.current=ke,O(),Error.prepareStackTrace=Ee}var Rt=j?j.displayName||j.name:"",Mt=Rt?Z(Rt):"";return typeof j=="function"&&N.set(j,Mt),Mt}function de(j,oe,le){return ne(j,!1)}function ce(j){var oe=j.prototype;return!!(oe&&oe.isReactComponent)}function fe(j,oe,le){if(j==null)return"";if(typeof j=="function")return ne(j,ce(j));if(typeof j=="string")return Z(j);switch(j){case u:return Z("Suspense");case h:return Z("SuspenseList")}if(typeof j=="object")switch(j.$$typeof){case f:return de(j.render);case g:return fe(j.type,oe,le);case b:{var me=j,Ee=me._payload,ke=me._init;try{return fe(ke(Ee),oe,le)}catch{}}}return""}var be=Object.prototype.hasOwnProperty,Pe={},De=B.ReactDebugCurrentFrame;function Te(j){if(j){var oe=j._owner,le=fe(j.type,j._source,oe?oe.type:null);De.setExtraStackFrame(le)}else De.setExtraStackFrame(null)}function Fe(j,oe,le,me,Ee){{var ke=Function.call.bind(be);for(var Ce in j)if(ke(j,Ce)){var et=void 0;try{if(typeof j[Ce]!="function"){var Ze=Error((me||"React class")+": "+le+" type `"+Ce+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof j[Ce]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ze.name="Invariant Violation",Ze}et=j[Ce](oe,Ce,me,le,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(rt){et=rt}et&&!(et instanceof Error)&&(Te(Ee),L("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",me||"React class",le,Ce,typeof et),Te(null)),et instanceof Error&&!(et.message in Pe)&&(Pe[et.message]=!0,Te(Ee),L("Failed %s type: %s",le,et.message),Te(null))}}}var Me=Array.isArray;function Ne(j){return Me(j)}function He(j){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,le=oe&&j[Symbol.toStringTag]||j.constructor.name||"Object";return le}}function Oe(j){try{return $e(j),!1}catch{return!0}}function $e(j){return""+j}function qe(j){if(Oe(j))return L("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",He(j)),$e(j)}var _e=B.ReactCurrentOwner,Qe={key:!0,ref:!0,__self:!0,__source:!0},at,Be;function nt(j){if(be.call(j,"ref")){var oe=Object.getOwnPropertyDescriptor(j,"ref").get;if(oe&&oe.isReactWarning)return!1}return j.ref!==void 0}function it(j){if(be.call(j,"key")){var oe=Object.getOwnPropertyDescriptor(j,"key").get;if(oe&&oe.isReactWarning)return!1}return j.key!==void 0}function Ye(j,oe){typeof j.ref=="string"&&_e.current}function pt(j,oe){{var le=function(){at||(at=!0,L("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};le.isReactWarning=!0,Object.defineProperty(j,"key",{get:le,configurable:!0})}}function ht(j,oe){{var le=function(){Be||(Be=!0,L("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};le.isReactWarning=!0,Object.defineProperty(j,"ref",{get:le,configurable:!0})}}var ft=function(j,oe,le,me,Ee,ke,Ce){var et={$$typeof:e,type:j,key:oe,ref:le,props:Ce,_owner:ke};return et._store={},Object.defineProperty(et._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(et,"_self",{configurable:!1,enumerable:!1,writable:!1,value:me}),Object.defineProperty(et,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Ee}),Object.freeze&&(Object.freeze(et.props),Object.freeze(et)),et};function Ht(j,oe,le,me,Ee){{var ke,Ce={},et=null,Ze=null;le!==void 0&&(qe(le),et=""+le),it(oe)&&(qe(oe.key),et=""+oe.key),nt(oe)&&(Ze=oe.ref,Ye(oe,Ee));for(ke in oe)be.call(oe,ke)&&!Qe.hasOwnProperty(ke)&&(Ce[ke]=oe[ke]);if(j&&j.defaultProps){var rt=j.defaultProps;for(ke in rt)Ce[ke]===void 0&&(Ce[ke]=rt[ke])}if(et||Ze){var ot=typeof j=="function"?j.displayName||j.name||"Unknown":j;et&&pt(Ce,ot),Ze&&ht(Ce,ot)}return ft(j,et,Ze,Ee,me,_e.current,Ce)}}var Jt=B.ReactCurrentOwner,St=B.ReactDebugCurrentFrame;function Xt(j){if(j){var oe=j._owner,le=fe(j.type,j._source,oe?oe.type:null);St.setExtraStackFrame(le)}else St.setExtraStackFrame(null)}var tr;tr=!1;function Dt(j){return typeof j=="object"&&j!==null&&j.$$typeof===e}function Bt(){{if(Jt.current){var j=v(Jt.current.type);if(j)return` -Check the render method of \``+q+"`."}return""}}function bt(q){return""}var Dt={};function Lt(q){{var ae=Tt();if(!ae){var pe=typeof q=="string"?q:q.displayName||q.name;pe&&(ae=` +Check the render method of \``+j+"`."}return""}}function Ct(j){return""}var gt={};function Ot(j){{var oe=Bt();if(!oe){var le=typeof j=="string"?j:j.displayName||j.name;le&&(oe=` -Check the top-level render call using <`+pe+">.")}return ae}}function yt(q,ae){{if(!q._store||q._store.validated||q.key!=null)return;q._store.validated=!0;var pe=Lt(ae);if(Dt[pe])return;Dt[pe]=!0;var _e="";q&&q._owner&&q._owner!==St.current&&(_e=" It was passed a child from "+m(q._owner.type)+"."),Xt(q),k('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',pe,_e),Xt(null)}}function $t(q,ae){{if(typeof q!="object")return;if(Le(q))for(var pe=0;pe",Ue=" Did you accidentally export a JSX literal instead of a component?"):st=typeof q,k("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",st,Ue)}var tt=Jt(q,ae,pe,Re,De);if(tt==null)return tt;if(it){var At=ae.children;if(At!==void 0)if(_e)if(Le(At)){for(var Rt=0;Rt0?"{key: someKey, "+Et.join(": ..., ")+": ...}":"{key: someKey}";if(!Ft[Mt+dt]){var _t=Et.length>0?"{"+Et.join(": ..., ")+": ...}":"{}";k(`A props object containing a "key" prop is being spread into JSX: +Check the top-level render call using <`+le+">.")}return oe}}function Lt(j,oe){{if(!j._store||j._store.validated||j.key!=null)return;j._store.validated=!0;var le=Ot(oe);if(gt[le])return;gt[le]=!0;var me="";j&&j._owner&&j._owner!==Jt.current&&(me=" It was passed a child from "+v(j._owner.type)+"."),Xt(j),L('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',le,me),Xt(null)}}function bt(j,oe){{if(typeof j!="object")return;if(Ne(j))for(var le=0;le",et=" Did you accidentally export a JSX literal instead of a component?"):rt=typeof j,L("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",rt,et)}var ot=Ht(j,oe,le,Ee,ke);if(ot==null)return ot;if(Ce){var yt=oe.children;if(yt!==void 0)if(me)if(Ne(yt)){for(var Rt=0;Rt0?"{key: someKey, "+xt.join(": ..., ")+": ...}":"{key: someKey}";if(!tt[Mt+Tt]){var mt=xt.length>0?"{"+xt.join(": ..., ")+": ...}":"{}";L(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; - <%s key={someKey} {...props} />`,dt,Mt,_t,Mt),Ft[Mt+dt]=!0}}return q===n?nt(tt):jt(tt),tt}}function K(q,ae,pe){return $(q,ae,pe,!0)}function G(q,ae,pe){return $(q,ae,pe,!1)}var C=G,Y=K;vf.Fragment=n,vf.jsx=C,vf.jsxs=Y}()),vf}process.env.NODE_ENV==="production"?ug.exports=PP():ug.exports=MP();var le=ug.exports;const Ls="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2",IP=[{featured:!0,name:"MetaMask",rdns:"io.metamask",image:`${Ls}#metamask`,getWallet:{chrome_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",brave_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",edge_addon_id:"ejbalbakoplchlghecdalmeeeajnimhm",firefox_addon_id:"ether-metamask",play_store_id:"io.metamask",app_store_id:"id1438144202"},deep_link:"metamask://wc",universal_link:"https://metamask.app.link/wc"},{featured:!0,name:"OKX Wallet",rdns:"com.okex.wallet",image:`${Ls}#okx`,getWallet:{chrome_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",brave_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",edge_addon_id:"pbpjkcldjiffchgbbndmhojiacbgflha",play_store_id:"com.okinc.okex.gp",app_store_id:"id1327268470"},deep_link:"okex://main/wc",universal_link:"okex://main/wc"},{featured:!0,name:"WalletConnect",image:`${Ls}#walletconnect`},{featured:!1,name:"Coinbase Wallet",image:`${Ls}#coinbase`},{featured:!1,name:"GateWallet",rdns:"io.gate.wallet",image:`${Ls}#6e528abf-7a7d-47bd-d84d-481f169b1200`,getWallet:{chrome_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",brave_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",play_store_id:"com.gateio.gateio",app_store_id:"id1294998195",mac_app_store_id:"id1609559473"},deep_link:"https://www.gate.io/mobileapp",universal_link:"https://www.gate.io/mobileapp"},{featured:!1,name:"Onekey",rdns:"so.onekey.app.wallet",image:`${Ls}#onekey`,getWallet:{chrome_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",brave_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",play_store_id:"so.onekey.app.wallet",app_store_id:"id1609559473"},deep_link:"onekey-wallet://",universal_link:"onekey://wc"},{featured:!1,name:"Infinity Wallet",image:`${Ls}#9f259366-0bcd-4817-0af9-f78773e41900`,desktop_link:"infinity://wc"},{name:"Rabby Wallet",rdns:"io.rabby",featured:!1,image:`${Ls}#rabby`,getWallet:{chrome_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",brave_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",play_store_id:"com.debank.rabbymobile",app_store_id:"id6474381673"}},{name:"Binance Web3 Wallet",featured:!1,image:`${Ls}#ebac7b39-688c-41e3-7912-a4fefba74600`,getWallet:{play_store_id:"com.binance.dev",app_store_id:"id1436799971"}},{name:"Rainbow Wallet",rdns:"me.rainbow",featured:!1,image:`${Ls}#rainbow`,getWallet:{chrome_store_id:"opfgelmcmbiajamepnmloijbpoleiama",edge_addon_id:"cpojfbodiccabbabgimdeohkkpjfpbnf",firefox_addon_id:"rainbow-extension",app_store_id:"id1457119021",play_store_id:"me.rainbow"}}];function CP(t,e){const r=t.exec(e);return r==null?void 0:r.groups}const nw=/^tuple(?(\[(\d*)\])*)$/;function fg(t){let e=t.type;if(nw.test(t.type)&&"components"in t){e="(";const r=t.components.length;for(let i=0;ie(t,s)}function Hc(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new qP(t.type);return`${t.name}(${lg(t.inputs,{includeName:e})})`}function lg(t,{includeName:e=!1}={}){return t?t.map(r=>RP(r,{includeName:e})).join(e?", ":","):""}function RP(t,{includeName:e}){return t.type.startsWith("tuple")?`(${lg(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}function Jo(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function vn(t){return Jo(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const iw="2.31.3";let yf={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${iw}`};class pt extends Error{constructor(e,r={}){var a;const n=(()=>{var u;return r.cause instanceof pt?r.cause.details:(u=r.cause)!=null&&u.message?r.cause.message:r.details})(),i=r.cause instanceof pt&&r.cause.docsPath||r.docsPath,s=(a=yf.getDocsUrl)==null?void 0:a.call(yf,{...r,docsPath:i}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...yf.version?[`Version: ${yf.version}`]:[]].join(` -`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=iw}walk(e){return sw(this,e)}}function sw(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?sw(t.cause,e):e?null:t}class DP extends pt{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` -`),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class ow extends pt{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` -`),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class OP extends pt{constructor({data:e,params:r,size:n}){super([`Data size of ${n} bytes is too small for given parameters.`].join(` -`),{metaMessages:[`Params: (${lg(r,{includeName:!0})})`,`Data: ${e} (${n} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=r,this.size=n}}class hg extends pt{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class NP extends pt{constructor({expectedLength:e,givenLength:r,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${e}`,`Given length: ${r}`].join(` -`),{name:"AbiEncodingArrayLengthMismatchError"})}}class LP extends pt{constructor({expectedSize:e,value:r}){super(`Size of bytes "${r}" (bytes${vn(r)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class kP extends pt{constructor({expectedLength:e,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${r}`].join(` -`),{name:"AbiEncodingLengthMismatchError"})}}class aw extends pt{constructor(e,{docsPath:r}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(` -`),{docsPath:r,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class cw extends pt{constructor(e,{docsPath:r}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` -`),{docsPath:r,name:"AbiFunctionNotFoundError"})}}class BP extends pt{constructor(e,r){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${Hc(e.abiItem)}\`, and`,`\`${r.type}\` in \`${Hc(r.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class $P extends pt{constructor({expectedSize:e,givenSize:r}){super(`Expected bytes${e}, got bytes${r}.`,{name:"BytesSizeMismatchError"})}}class FP extends pt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(` -`),{docsPath:r,name:"InvalidAbiEncodingType"})}}class jP extends pt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` -`),{docsPath:r,name:"InvalidAbiDecodingType"})}}class UP extends pt{constructor(e){super([`Value "${e}" is not a valid array.`].join(` -`),{name:"InvalidArrayError"})}}class qP extends pt{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` -`),{name:"InvalidDefinitionTypeError"})}}class uw extends pt{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}class fw extends pt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}class lw extends pt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function Wc(t,{dir:e,size:r=32}={}){return typeof t=="string"?Xo(t,{dir:e,size:r}):zP(t,{dir:e,size:r})}function Xo(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new fw({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function zP(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new fw({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie)throw new WP({givenSize:vn(t),maxSize:e})}function Zo(t,e={}){const{signed:r}=e;e.size&&ks(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<e.toString(16).padStart(2,"0"));function kh(t,e={}){return typeof t=="number"||typeof t=="bigint"?dr(t,e):typeof t=="string"?Bh(t,e):typeof t=="boolean"?dw(t,e):ui(t,e)}function dw(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(ks(r,{size:e.size}),Wc(r,{size:e.size})):r}function ui(t,e={}){let r="";for(let i=0;is||i=fo.zero&&t<=fo.nine)return t-fo.zero;if(t>=fo.A&&t<=fo.F)return t-(fo.A-10);if(t>=fo.a&&t<=fo.f)return t-(fo.a-10)}function lo(t,e={}){let r=t;e.size&&(ks(r,{size:e.size}),r=Wc(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o>mw&$h)}:{h:Number(t>>mw&$h)|0,l:Number(t&$h)|0}}function ZP(t,e=!1){const r=t.length;let n=new Uint32Array(r),i=new Uint32Array(r);for(let s=0;st<>>32-r,eM=(t,e,r)=>e<>>32-r,tM=(t,e,r)=>e<>>64-r,rM=(t,e,r)=>t<>>64-r,Kc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function pg(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function wf(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function ps(t,...e){if(!pg(t))throw new Error("Uint8Array expected");e.length>0}function nM(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");wf(t.outputLen),wf(t.blockLen)}function Vc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function vw(t,e){ps(t);const r=e.outputLen;if(t.length>>e}const sM=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function oM(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function aM(t){for(let e=0;et:aM,yw=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",cM=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Yc(t){if(ps(t),yw)return t.toHex();let e="";for(let r=0;r=ho._0&&t<=ho._9)return t-ho._0;if(t>=ho.A&&t<=ho.F)return t-(ho.A-10);if(t>=ho.a&&t<=ho.f)return t-(ho.a-10)}function mg(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(yw)return Uint8Array.fromHex(t);const e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;it().update(xf(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function fM(t){const e=(n,i)=>t(i).update(xf(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function lM(t=32){if(Kc&&typeof Kc.getRandomValues=="function")return Kc.getRandomValues(new Uint8Array(t));if(Kc&&typeof Kc.randomBytes=="function")return Uint8Array.from(Kc.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}const hM=BigInt(0),_f=BigInt(1),dM=BigInt(2),pM=BigInt(7),gM=BigInt(256),mM=BigInt(113),_w=[],Ew=[],Sw=[];for(let t=0,e=_f,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],_w.push(2*(5*n+r)),Ew.push((t+1)*(t+2)/2%64);let i=hM;for(let s=0;s<7;s++)e=(e<<_f^(e>>pM)*mM)%gM,e&dM&&(i^=_f<<(_f<r>32?tM(t,e,r):QP(t,e,r),Mw=(t,e,r)=>r>32?rM(t,e,r):eM(t,e,r);function Iw(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,u=(o+2)%10,l=r[u],d=r[u+1],p=Pw(l,d,1)^r[a],y=Mw(l,d,1)^r[a+1];for(let _=0;_<50;_+=10)t[o+_]^=p,t[o+_+1]^=y}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=Ew[o],u=Pw(i,s,a),l=Mw(i,s,a),d=_w[o];i=t[d],s=t[d+1],t[d]=u,t[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=vM[n],t[1]^=bM[n]}Gc(r)}class Ef extends vg{constructor(e,r,n,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,wf(n),!(0=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return wf(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(vw(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Gc(this.state)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new Ef(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const ea=(t,e,r)=>xw(()=>new Ef(e,t,r)),yM=ea(6,144,224/8),wM=ea(6,136,256/8),xM=ea(6,104,384/8),_M=ea(6,72,512/8),EM=ea(1,144,224/8),Cw=ea(1,136,256/8),SM=ea(1,104,384/8),AM=ea(1,72,512/8),Tw=(t,e,r)=>fM((n={})=>new Ef(e,t,n.dkLen===void 0?r:n.dkLen,!0)),PM=Object.freeze(Object.defineProperty({__proto__:null,Keccak:Ef,keccakP:Iw,keccak_224:EM,keccak_256:Cw,keccak_384:SM,keccak_512:AM,sha3_224:yM,sha3_256:wM,sha3_384:xM,sha3_512:_M,shake128:Tw(31,168,128/8),shake256:Tw(31,136,256/8)},Symbol.toStringTag,{value:"Module"}));function Fh(t,e){const r=e||"hex",n=Cw(Jo(t,{strict:!1})?dg(t):t);return r==="bytes"?n:kh(n)}const MM=t=>Fh(dg(t));function IM(t){return MM(t)}function CM(t){let e=!0,r="",n=0,i="",s=!1;for(let o=0;o{const e=typeof t=="string"?t:TP(t);return CM(e)};function Rw(t){return IM(TM(t))}const RM=Rw;class ta extends pt{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class jh extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const bg=new jh(8192);function Sf(t,e){if(bg.has(`${t}.${e}`))return bg.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=Fh(gw(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return bg.set(`${t}.${e}`,s),s}function yg(t,e){if(!gs(t,{strict:!1}))throw new ta({address:t});return Sf(t,e)}const DM=/^0x[a-fA-F0-9]{40}$/,wg=new jh(8192);function gs(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(wg.has(n))return wg.get(n);const i=DM.test(t)?t.toLowerCase()===t?!0:r?Sf(t)===t:!0:!1;return wg.set(n,i),i}function ra(t){return typeof t[0]=="string"?Uh(t):OM(t)}function OM(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function Uh(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}function qh(t,e,r,{strict:n}={}){return Jo(t,{strict:!1})?xg(t,e,r,{strict:n}):Nw(t,e,r,{strict:n})}function Dw(t,e){if(typeof e=="number"&&e>0&&e>vn(t)-1)throw new uw({offset:e,position:"start",size:vn(t)})}function Ow(t,e,r){if(typeof e=="number"&&typeof r=="number"&&vn(t)!==r-e)throw new uw({offset:r,position:"end",size:vn(t)})}function Nw(t,e,r,{strict:n}={}){Dw(t,e);const i=t.slice(e,r);return n&&Ow(i,e,r),i}function xg(t,e,r,{strict:n}={}){Dw(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&Ow(i,e,r),i}const NM=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Lw=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function kw(t,e){if(t.length!==e.length)throw new kP({expectedLength:t.length,givenLength:e.length});const r=LM({params:t,values:e}),n=Eg(r);return n.length===0?"0x":n}function LM({params:t,values:e}){const r=[];for(let n=0;n0?ra([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:ra(s.map(({encoded:o})=>o))}}function $M(t,{param:e}){const[,r]=e.type.split("bytes"),n=vn(t);if(!r){let i=t;return n%32!==0&&(i=Xo(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:ra([Xo(dr(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new LP({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:Xo(t,{dir:"right"})}}function FM(t){if(typeof t!="boolean")throw new pt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Xo(dw(t))}}function jM(t,{signed:e,size:r=256}){if(typeof r=="number"){const n=2n**(BigInt(r)-(e?1n:0n))-1n,i=e?-n-1n:0n;if(t>n||ti))}}function Sg(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const Ag=t=>qh(Rw(t),0,4);function Bw(t){const{abi:e,args:r=[],name:n}=t,i=Jo(n,{strict:!1}),s=e.filter(a=>i?a.type==="function"?Ag(a)===n:a.type==="event"?RM(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((l,d)=>{const p="inputs"in a&&a.inputs[d];return p?Pg(l,p):!1})){if(o&&"inputs"in o&&o.inputs){const l=$w(a.inputs,o.inputs,r);if(l)throw new BP({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||s[0]}function Pg(t,e){const r=typeof t,n=e.type;switch(n){case"address":return gs(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>Pg(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>Pg(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function $w(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return $w(i.components,s.components,r[n]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?gs(r[n],{strict:!1}):o.includes("address")&&o.includes("bytes")?gs(r[n],{strict:!1}):!1)return o}}function fi(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const Fw="/docs/contract/encodeFunctionData";function zM(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=Bw({abi:e,args:r,name:n});if(!s)throw new cw(n,{docsPath:Fw});i=s}if(i.type!=="function")throw new cw(void 0,{docsPath:Fw});return{abi:[i],functionName:Ag(Hc(i))}}function jw(t){const{args:e}=t,{abi:r,functionName:n}=(()=>{var a;return t.abi.length===1&&((a=t.functionName)!=null&&a.startsWith("0x"))?t:zM(t)})(),i=r[0],s=n,o="inputs"in i&&i.inputs?kw(i.inputs,e??[]):void 0;return Uh([s,o??"0x"])}const HM={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},WM={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},KM={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Uw extends pt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class VM extends pt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class GM extends pt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const YM={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new GM({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new VM({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Uw({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Uw({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function Mg(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(YM);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function JM(t,e={}){typeof e.size<"u"&&ks(t,{size:e.size});const r=ui(t,e);return Zo(r,e)}function XM(t,e={}){let r=t;if(typeof e.size<"u"&&(ks(r,{size:e.size}),r=Lh(r)),r.length>1||r[0]>1)throw new HP(r);return!!r[0]}function po(t,e={}){typeof e.size<"u"&&ks(t,{size:e.size});const r=ui(t,e);return Qo(r,e)}function ZM(t,e={}){let r=t;return typeof e.size<"u"&&(ks(r,{size:e.size}),r=Lh(r,{dir:"right"})),new TextDecoder().decode(r)}function QM(t,e){const r=typeof e=="string"?lo(e):e,n=Mg(r);if(vn(r)===0&&t.length>0)throw new hg;if(vn(e)&&vn(e)<32)throw new OP({data:typeof e=="string"?e:ui(e),params:t,size:vn(e)});let i=0;const s=[];for(let o=0;o48?JM(i,{signed:r}):po(i,{signed:r}),32]}function sI(t,e,{staticPosition:r}){const n=e.components.length===0||e.components.some(({name:o})=>!o),i=n?[]:{};let s=0;if(Af(e)){const o=po(t.readBytes(Ig)),a=r+o;for(let u=0;uo.type==="error"&&n===Ag(Hc(o)));if(!s)throw new aw(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?QM(s.inputs,qh(r,4)):void 0,errorName:s.name}}const qa=(t,e,r)=>JSON.stringify(t,(n,i)=>typeof i=="bigint"?i.toString():i,r);function zw({abiItem:t,args:e,includeFunctionName:r=!0,includeName:n=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${r?t.name:""}(${t.inputs.map((i,s)=>`${n&&i.name?`${i.name}: `:""}${typeof e[s]=="object"?qa(e[s]):e[s]}`).join(", ")})`}const cI={gwei:9,wei:18},uI={ether:-9,wei:9};function Hw(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}function Ww(t,e="wei"){return Hw(t,cI[e])}function ms(t,e="wei"){return Hw(t,uI[e])}class fI extends pt{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class lI extends pt{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function zh(t){const e=Object.entries(t).map(([n,i])=>i===void 0||i===!1?null:[n,i]).filter(Boolean),r=e.reduce((n,[i])=>Math.max(n,i.length),0);return e.map(([n,i])=>` ${`${n}:`.padEnd(r+1)} ${i}`).join(` -`)}class hI extends pt{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(` -`),{name:"FeeConflictError"})}}class dI extends pt{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",zh(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class pI extends pt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var M;const _=zh({chain:i&&`${i==null?void 0:i.name} (id: ${i==null?void 0:i.id})`,from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Ww(y)} ${((M=i==null?void 0:i.nativeCurrency)==null?void 0:M.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${ms(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${ms(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ms(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",_].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const gI=t=>t,Kw=t=>t;class mI extends pt{constructor(e,{abi:r,args:n,contractAddress:i,docsPath:s,functionName:o,sender:a}){const u=Bw({abi:r,args:n,name:o}),l=u?zw({abiItem:u,args:n,includeFunctionName:!1,includeName:!1}):void 0,d=u?Hc(u,{includeName:!0}):void 0,p=zh({address:i&&gI(i),function:d,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:s,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],p&&"Contract Call:",p].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=e,this.contractAddress=i,this.functionName=o,this.sender=a}}class vI extends pt{constructor({abi:e,data:r,functionName:n,message:i}){let s,o,a,u;if(r&&r!=="0x")try{o=aI({abi:e,data:r});const{abiItem:d,errorName:p,args:y}=o;if(p==="Error")u=y[0];else if(p==="Panic"){const[_]=y;u=HM[_]}else{const _=d?Hc(d,{includeName:!0}):void 0,M=d&&y?zw({abiItem:d,args:y,includeFunctionName:!1,includeName:!1}):void 0;a=[_?`Error: ${_}`:"",M&&M!=="()"?` ${[...Array((p==null?void 0:p.length)??0).keys()].map(()=>" ").join("")}${M}`:""]}}catch(d){s=d}else i&&(u=i);let l;s instanceof aw&&(l=s.signature,a=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(u&&u!=="execution reverted"||l?[`The contract function "${n}" reverted with the following ${l?"signature":"reason"}:`,u||l].join(` -`):`The contract function "${n}" reverted.`,{cause:s,metaMessages:a,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.raw=r,this.reason=u,this.signature=l}}class bI extends pt{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class yI extends pt{constructor({data:e,message:r}){super(r||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}class Vw extends pt{constructor({body:e,cause:r,details:n,headers:i,status:s,url:o}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${Kw(o)}`,e&&`Request body: ${qa(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=i,this.status=s,this.url=o}}class Gw extends pt{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${Kw(n)}`,`Request body: ${qa(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code,this.data=r.data}}const wI=-1;class li extends pt{constructor(e,{code:r,docsPath:n,metaMessages:i,name:s,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:i||(e==null?void 0:e.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||e.name,this.code=e instanceof Gw?e.code:r??wI}}class Pi extends li{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class Pf extends li{constructor(e){super(e,{code:Pf.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Pf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Mf extends li{constructor(e){super(e,{code:Mf.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Mf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class If extends li{constructor(e,{method:r}={}){super(e,{code:If.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(If,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Cf extends li{constructor(e){super(e,{code:Cf.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` -`)})}}Object.defineProperty(Cf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class za extends li{constructor(e){super(e,{code:za.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(za,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Tf extends li{constructor(e){super(e,{code:Tf.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` -`)})}}Object.defineProperty(Tf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Rf extends li{constructor(e){super(e,{code:Rf.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Rf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Df extends li{constructor(e){super(e,{code:Df.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Df,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Of extends li{constructor(e){super(e,{code:Of.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Of,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Ha extends li{constructor(e,{method:r}={}){super(e,{code:Ha.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not supported.`})}}Object.defineProperty(Ha,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Xc extends li{constructor(e){super(e,{code:Xc.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Xc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Nf extends li{constructor(e){super(e,{code:Nf.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Nf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Zc extends Pi{constructor(e){super(e,{code:Zc.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Zc,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Lf extends Pi{constructor(e){super(e,{code:Lf.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Lf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class kf extends Pi{constructor(e,{method:r}={}){super(e,{code:kf.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(kf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Bf extends Pi{constructor(e){super(e,{code:Bf.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Bf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class $f extends Pi{constructor(e){super(e,{code:$f.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty($f,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Ff extends Pi{constructor(e){super(e,{code:Ff.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Ff,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class Qc extends Pi{constructor(e){super(e,{code:Qc.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(Qc,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class jf extends Pi{constructor(e){super(e,{code:jf.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(jf,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class Uf extends Pi{constructor(e){super(e,{code:Uf.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(Uf,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class qf extends Pi{constructor(e){super(e,{code:qf.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(qf,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class zf extends Pi{constructor(e){super(e,{code:zf.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(zf,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class Hf extends Pi{constructor(e){super(e,{code:Hf.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(Hf,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class eu extends Pi{constructor(e){super(e,{code:eu.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(eu,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class xI extends li{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const _I=3;function EI(t,{abi:e,address:r,args:n,docsPath:i,functionName:s,sender:o}){const a=t instanceof yI?t:t instanceof pt?t.walk(M=>"data"in M)||t.walk():{},{code:u,data:l,details:d,message:p,shortMessage:y}=a,_=t instanceof hg?new bI({functionName:s}):[_I,za.code].includes(u)&&(l||d||p||y)?new vI({abi:e,data:typeof l=="object"?l.data:l,functionName:s,message:a instanceof Gw?d:y??p}):t;return new mI(_,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:o})}function SI(t){const e=Fh(`0x${t.substring(4)}`).substring(26);return Sf(`0x${e}`)}async function AI({hash:t,signature:e}){const r=Jo(t)?t:kh(t),{secp256k1:n}=await Promise.resolve().then(()=>gT);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:d,v:p,yParity:y}=e,_=Number(y??p),M=Yw(_);return new n.Signature(Zo(l),Zo(d)).addRecoveryBit(M)}const o=Jo(e)?e:kh(e);if(vn(o)!==65)throw new Error("invalid signature length");const a=Qo(`0x${o.slice(130)}`),u=Yw(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Yw(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function PI({hash:t,signature:e}){return SI(await AI({hash:t,signature:e}))}function MI(t,e="hex"){const r=Jw(t),n=Mg(new Uint8Array(r.length));return r.encode(n),e==="hex"?ui(n.bytes):n.bytes}function Jw(t){return Array.isArray(t)?II(t.map(e=>Jw(e))):CI(t)}function II(t){const e=t.reduce((i,s)=>i+s.length,0),r=Xw(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function CI(t){const e=typeof t=="string"?lo(t):t,r=Xw(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function Xw(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new pt("Length is too large.")}function TI(t){const{chainId:e,nonce:r,to:n}=t,i=t.contractAddress??t.address,s=Fh(Uh(["0x05",MI([e?dr(e):"0x",i,r?dr(r):"0x"])]));return n==="bytes"?lo(s):s}async function Zw(t){const{authorization:e,signature:r}=t;return PI({hash:TI(e),signature:r??e})}class RI extends pt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:d,to:p,value:y}){var M;const _=zh({from:r==null?void 0:r.address,to:p,value:typeof y<"u"&&`${Ww(y)} ${((M=i==null?void 0:i.nativeCurrency)==null?void 0:M.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${ms(a)} gwei`,maxFeePerGas:typeof u<"u"&&`${ms(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ms(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",_].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class tu extends pt{constructor({cause:e,message:r}={}){var i;const n=(i=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(tu,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(tu,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Hh extends pt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${ms(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(Hh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class Cg extends pt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${ms(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(Cg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class Tg extends pt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(Tg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Rg extends pt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` -`),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(Rg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Dg extends pt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(Dg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Og extends pt{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` -`),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(Og,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Ng extends pt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(Ng,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Lg extends pt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(Lg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class kg extends pt{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(kg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Wh extends pt{constructor({cause:e,maxPriorityFeePerGas:r,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${r?` = ${ms(r)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${ms(n)} gwei`:""}).`].join(` -`),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(Wh,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Bg extends pt{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function Qw(t,e){const r=(t.details||"").toLowerCase(),n=t instanceof pt?t.walk(i=>(i==null?void 0:i.code)===tu.code):t;return n instanceof pt?new tu({cause:t,message:n.details}):tu.nodeMessage.test(r)?new tu({cause:t,message:t.details}):Hh.nodeMessage.test(r)?new Hh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):Cg.nodeMessage.test(r)?new Cg({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):Tg.nodeMessage.test(r)?new Tg({cause:t,nonce:e==null?void 0:e.nonce}):Rg.nodeMessage.test(r)?new Rg({cause:t,nonce:e==null?void 0:e.nonce}):Dg.nodeMessage.test(r)?new Dg({cause:t,nonce:e==null?void 0:e.nonce}):Og.nodeMessage.test(r)?new Og({cause:t}):Ng.nodeMessage.test(r)?new Ng({cause:t,gas:e==null?void 0:e.gas}):Lg.nodeMessage.test(r)?new Lg({cause:t,gas:e==null?void 0:e.gas}):kg.nodeMessage.test(r)?new kg({cause:t}):Wh.nodeMessage.test(r)?new Wh({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new Bg({cause:t})}function DI(t,{docsPath:e,...r}){const n=(()=>{const i=Qw(t,r);return i instanceof Bg?t:i})();return new RI(n,{docsPath:e,...r})}function e2(t,{format:e}){if(!e)return{};const r={};function n(s){const o=Object.keys(s);for(const a of o)a in t&&(r[a]=t[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}const i=e(t||{});return n(i),r}const OI={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function $g(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=NI(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(r=>ui(r)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=dr(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=dr(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=dr(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=dr(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=dr(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=dr(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=OI[t.type]),typeof t.value<"u"&&(e.value=dr(t.value)),e}function NI(t){return t.map(e=>({address:e.address,r:e.r?dr(BigInt(e.r)):e.r,s:e.s?dr(BigInt(e.s)):e.s,chainId:dr(e.chainId),nonce:dr(e.nonce),...typeof e.yParity<"u"?{yParity:dr(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:dr(e.v)}:{}}))}function t2(t){if(!(!t||t.length===0))return t.reduce((e,{slot:r,value:n})=>{if(r.length!==66)throw new lw({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new lw({size:n.length,targetSize:66,type:"hex"});return e[r]=n,e},{})}function LI(t){const{balance:e,nonce:r,state:n,stateDiff:i,code:s}=t,o={};if(s!==void 0&&(o.code=s),e!==void 0&&(o.balance=dr(e)),r!==void 0&&(o.nonce=dr(r)),n!==void 0&&(o.state=t2(n)),i!==void 0){if(o.state)throw new lI;o.stateDiff=t2(i)}return o}function kI(t){if(!t)return;const e={};for(const{address:r,...n}of t){if(!gs(r,{strict:!1}))throw new ta({address:r});if(e[r])throw new fI({address:r});e[r]=LI(n)}return e}const BI=2n**256n-1n;function Kh(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?fi(e):void 0;if(o&&!gs(o.address))throw new ta({address:o.address});if(s&&!gs(s))throw new ta({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new hI;if(n&&n>BI)throw new Hh({maxFeePerGas:n});if(i&&n&&i>n)throw new Wh({maxFeePerGas:n,maxPriorityFeePerGas:i})}class $I extends pt{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Fg extends pt{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class FI extends pt{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${ms(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class jI extends pt{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}const UI={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function qI(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?Qo(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?Qo(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?UI[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=zI(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function zI(t){return t.map(e=>({address:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function HI(t){const e=(t.transactions??[]).map(r=>typeof r=="string"?r:qI(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function Vh(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){var d,p,y;const s=n??"latest",o=i??!1,a=r!==void 0?dr(r):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,o]},{dedupe:!0}):u=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]},{dedupe:!!a}),!u)throw new jI({blockHash:e,blockNumber:r});return(((y=(p=(d=t.chain)==null?void 0:d.formatters)==null?void 0:p.block)==null?void 0:y.format)||HI)(u)}async function r2(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function WI(t,e){var s,o;const{block:r,chain:n=t.chain,request:i}=e||{};try{const a=((s=n==null?void 0:n.fees)==null?void 0:s.maxPriorityFeePerGas)??((o=n==null?void 0:n.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=r||await Wn(t,Vh,"getBlock")({}),d=await a({block:l,client:t,request:i});if(d===null)throw new Error;return d}if(typeof a<"u")return a;const u=await t.request({method:"eth_maxPriorityFeePerGas"});return Zo(u)}catch{const[a,u]=await Promise.all([r?Promise.resolve(r):Wn(t,Vh,"getBlock")({}),Wn(t,r2,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new Fg;const l=u-a.baseFeePerGas;return l<0n?0n:l}}async function n2(t,e){var y,_;const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>{var M,O;return typeof((M=n==null?void 0:n.fees)==null?void 0:M.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):((O=n==null?void 0:n.fees)==null?void 0:O.baseFeeMultiplier)??1.2})();if(o<1)throw new $I;const u=10**(((y=o.toString().split(".")[1])==null?void 0:y.length)??0),l=M=>M*BigInt(Math.ceil(o*u))/BigInt(u),d=r||await Wn(t,Vh,"getBlock")({});if(typeof((_=n==null?void 0:n.fees)==null?void 0:_.estimateFeesPerGas)=="function"){const M=await n.fees.estimateFeesPerGas({block:r,client:t,multiply:l,request:i,type:s});if(M!==null)return M}if(s==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new Fg;const M=typeof(i==null?void 0:i.maxPriorityFeePerGas)=="bigint"?i.maxPriorityFeePerGas:await WI(t,{block:d,chain:n,request:i}),O=l(d.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??O+M,maxPriorityFeePerGas:M}}return{gasPrice:(i==null?void 0:i.gasPrice)??l(await Wn(t,r2,"getGasPrice")({}))}}async function i2(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,typeof n=="bigint"?dr(n):r]},{dedupe:!!n});return Qo(i)}function s2(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(s=>lo(s)):t.blobs,i=[];for(const s of n)i.push(Uint8Array.from(e.blobToKzgCommitment(s)));return r==="bytes"?i:i.map(s=>ui(s))}function o2(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>lo(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>lo(o)):t.commitments,s=[];for(let o=0;oui(o))}function KI(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),u=n?4:0,l=n?0:4;t.setUint32(e+u,o,n),t.setUint32(e+l,a,n)}function VI(t,e,r){return t&e^~t&r}function GI(t,e,r){return t&e^t&r^e&r}class YI extends vg{constructor(e,r,n,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(e),this.view=gg(this.buffer)}update(e){Vc(this),e=xf(e),ps(e);const{view:r,buffer:n,blockLen:i}=this,s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let p=o;pd.length)throw new Error("_sha2: outputLen bigger than state");for(let p=0;p>>3,O=Bs(_,17)^Bs(_,19)^_>>>10;ia[p]=O+ia[p-7]+M+ia[p-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:u,G:l,H:d}=this;for(let p=0;p<64;p++){const y=Bs(a,6)^Bs(a,11)^Bs(a,25),_=d+y+VI(a,u,l)+JI[p]+ia[p]|0,O=(Bs(n,2)^Bs(n,13)^Bs(n,22))+GI(n,i,s)|0;d=l,l=u,u=a,a=o+_|0,o=s,s=i,i=n,n=_+O|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(n,i,s,o,a,u,l,d)}roundClean(){Gc(ia)}destroy(){this.set(0,0,0,0,0,0,0,0),Gc(this.buffer)}};const a2=xw(()=>new XI),c2=a2;function ZI(t,e){return c2(Jo(t,{strict:!1})?dg(t):t)}function QI(t){const{commitment:e,version:r=1}=t,n=t.to??(typeof e=="string"?"hex":"bytes"),i=ZI(e);return i.set([r],0),n==="bytes"?i:ui(i)}function eC(t){const{commitments:e,version:r}=t,n=t.to??(typeof e[0]=="string"?"hex":"bytes"),i=[];for(const s of e)i.push(QI({commitment:s,to:n,version:r}));return i}const u2=6,f2=32,jg=4096,l2=f2*jg,h2=l2*u2-1-1*jg*u2;class tC extends pt{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class rC extends pt{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function nC(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),r=typeof t.data=="string"?lo(t.data):t.data,n=vn(r);if(!n)throw new rC;if(n>h2)throw new tC({maxSize:h2,size:n});const i=[];let s=!0,o=0;for(;s;){const a=Mg(new Uint8Array(l2));let u=0;for(;ua.bytes):i.map(a=>ui(a.bytes))}function iC(t){const{data:e,kzg:r,to:n}=t,i=t.blobs??nC({data:e,to:n}),s=t.commitments??s2({blobs:i,kzg:r,to:n}),o=t.proofs??o2({blobs:i,commitments:s,kzg:r,to:n}),a=[];for(let u=0;u"u"&&p)if(u){const B=await L();y.nonce=await u.consume({address:p.address,chainId:B,client:t})}else y.nonce=await Wn(t,i2,"getTransactionCount")({address:p.address,blockTag:"pending"});if((l.includes("blobVersionedHashes")||l.includes("sidecars"))&&n&&o){const B=s2({blobs:n,kzg:o});if(l.includes("blobVersionedHashes")){const k=eC({commitments:B,to:"hex"});y.blobVersionedHashes=k}if(l.includes("sidecars")){const k=o2({blobs:n,commitments:B,kzg:o}),H=iC({blobs:n,commitments:B,proofs:k,to:"hex"});y.sidecars=H}}if(l.includes("chainId")&&(y.chainId=await L()),(l.includes("fees")||l.includes("type"))&&typeof d>"u")try{y.type=sC(y)}catch{let B=p2.get(t.uid);if(typeof B>"u"){const k=await M();B=typeof(k==null?void 0:k.baseFeePerGas)=="bigint",p2.set(t.uid,B)}y.type=B?"eip1559":"legacy"}if(l.includes("fees"))if(y.type!=="legacy"&&y.type!=="eip2930"){if(typeof y.maxFeePerGas>"u"||typeof y.maxPriorityFeePerGas>"u"){const B=await M(),{maxFeePerGas:k,maxPriorityFeePerGas:H}=await n2(t,{block:B,chain:i,request:y});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"){const B=await M(),{gasPrice:k}=await n2(t,{block:B,chain:i,request:y,type:"legacy"});y.gasPrice=k}}return l.includes("gas")&&typeof s>"u"&&(y.gas=await Wn(t,aC,"estimateGas")({...y,account:p&&{address:p.address,type:"json-rpc"}})),Kh(y),delete y.parameters,y}async function oC(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=typeof r=="bigint"?dr(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function aC(t,e){var i,s,o;const{account:r=t.account}=e,n=r?fi(r):void 0;try{let f=function(v){const{block:x,request:S,rpcStateOverride:A}=v;return t.request({method:"eth_estimateGas",params:A?[S,x??"latest",A]:x?[S,x]:[S]})};const{accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,blockNumber:p,blockTag:y,data:_,gas:M,gasPrice:O,maxFeePerBlobGas:L,maxFeePerGas:B,maxPriorityFeePerGas:k,nonce:H,value:U,stateOverride:z,...Z}=await Ug(t,{...e,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),W=(typeof p=="bigint"?dr(p):void 0)||y,ie=kI(z),me=await(async()=>{if(Z.to)return Z.to;if(u&&u.length>0)return await Zw({authorization:u[0]}).catch(()=>{throw new pt("`to` is required. Could not infer from `authorizationList`")})})();Kh(e);const j=(o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:o.format,m=(j||$g)({...e2(Z,{format:j}),from:n==null?void 0:n.address,accessList:a,authorizationList:u,blobs:l,blobVersionedHashes:d,data:_,gas:M,gasPrice:O,maxFeePerBlobGas:L,maxFeePerGas:B,maxPriorityFeePerGas:k,nonce:H,to:me,value:U});let g=BigInt(await f({block:W,request:m,rpcStateOverride:ie}));if(u){const v=await oC(t,{address:m.from}),x=await Promise.all(u.map(async S=>{const{address:A}=S,b=await f({block:W,request:{authorizationList:void 0,data:_,from:n==null?void 0:n.address,to:A,value:dr(v)},rpcStateOverride:ie}).catch(()=>100000n);return 2n*BigInt(b)}));g+=x.reduce((S,A)=>S+A,0n)}return g}catch(a){throw DI(a,{...e,account:n,chain:t.chain})}}function cC(t,e){if(!gs(t,{strict:!1}))throw new ta({address:t});if(!gs(e,{strict:!1}))throw new ta({address:e});return t.toLowerCase()===e.toLowerCase()}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const qg=BigInt(0),zg=BigInt(1);function Gh(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}function Yh(t){const e=t.toString(16);return e.length&1?"0"+e:e}function g2(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?qg:BigInt("0x"+t)}function Jh(t){return g2(Yc(t))}function m2(t){return ps(t),g2(Yc(Uint8Array.from(t).reverse()))}function Hg(t,e){return mg(t.toString(16).padStart(e*2,"0"))}function v2(t,e){return Hg(t,e).reverse()}function Ui(t,e,r){let n;if(typeof e=="string")try{n=mg(e)}catch(s){throw new Error(t+" must be hex string or Uint8Array, cause: "+s)}else if(pg(e))n=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const i=n.length;if(typeof r=="number"&&i!==r)throw new Error(t+" of length "+r+" expected, got "+i);return n}const Wg=t=>typeof t=="bigint"&&qg<=t;function uC(t,e,r){return Wg(t)&&Wg(e)&&Wg(r)&&e<=t&&tqg;t>>=zg,e+=1);return e}const Xh=t=>(zg<new Uint8Array(_),i=_=>Uint8Array.of(_);let s=n(t),o=n(t),a=0;const u=()=>{s.fill(1),o.fill(0),a=0},l=(..._)=>r(o,s,..._),d=(_=n(0))=>{o=l(i(0),_),s=l(),_.length!==0&&(o=l(i(1),_),s=l())},p=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let _=0;const M=[];for(;_{u(),d(_);let O;for(;!(O=M(p()));)d();return u(),O}}function Kg(t,e,r={}){if(!t||typeof t!="object")throw new Error("expected valid options object");function n(i,s,o){const a=t[i];if(o&&a===void 0)return;const u=typeof a;if(u!==s||a===null)throw new Error(`param "${i}" is invalid: expected ${s}, got ${u}`)}Object.entries(e).forEach(([i,s])=>n(i,s,!1)),Object.entries(r).forEach(([i,s])=>n(i,s,!0))}function b2(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}class dC extends pt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class pC extends pt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` -`),{name:"ChainNotFoundError"})}}const Vg="/docs/contract/encodeDeployData";function gC(t){const{abi:e,args:r,bytecode:n}=t;if(!r||r.length===0)return n;const i=e.find(o=>"type"in o&&o.type==="constructor");if(!i)throw new DP({docsPath:Vg});if(!("inputs"in i))throw new ow({docsPath:Vg});if(!i.inputs||i.inputs.length===0)throw new ow({docsPath:Vg});const s=kw(i.inputs,r);return Uh([n,s])}function mC(){let t=()=>{},e=()=>{};return{promise:new Promise((n,i)=>{t=n,e=i}),resolve:t,reject:e}}const Gg=new Map,y2=new Map;let vC=0;function bC(t,e,r){const n=++vC,i=()=>Gg.get(t)||[],s=()=>{const d=i();Gg.set(t,d.filter(p=>p.id!==n))},o=()=>{const d=i();if(!d.some(y=>y.id===n))return;const p=y2.get(t);if(d.length===1&&p){const y=p();y instanceof Promise&&y.catch(()=>{})}s()},a=i();if(Gg.set(t,[...a,{id:n,fns:e}]),a&&a.length>0)return o;const u={};for(const d in e)u[d]=(...p)=>{var _,M;const y=i();if(y.length!==0)for(const O of y)(M=(_=O.fns)[d])==null||M.call(_,...p)};const l=r(u);return typeof l=="function"&&y2.set(t,l),o}async function Yg(t){return new Promise(e=>setTimeout(e,t))}function yC(t,{emitOnBegin:e,initialWaitTime:r,interval:n}){let i=!0;const s=()=>i=!1;return(async()=>{let a;a=await t({unpoll:s});const u=await(r==null?void 0:r(a))??n;await Yg(u);const l=async()=>{i&&(await t({unpoll:s}),await Yg(n),l())};l()})(),s}class Wa extends pt{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` -`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class Zh extends pt{constructor({docsPath:e,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:e,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function w2({chain:t,currentChainId:e}){if(!t)throw new pC;if(e!==t.id)throw new dC({chain:t,currentChainId:e})}function x2(t,{docsPath:e,...r}){const n=(()=>{const i=Qw(t,r);return i instanceof Bg?t:i})();return new pI(n,{docsPath:e,...r})}async function _2(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const Jg=new jh(128);async function Qh(t,e){var k,H,U,z;const{account:r=t.account,chain:n=t.chain,accessList:i,authorizationList:s,blobs:o,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:_,type:M,value:O,...L}=e;if(typeof r>"u")throw new Wa({docsPath:"/docs/actions/wallet/sendTransaction"});const B=r?fi(r):null;try{Kh(e);const Z=await(async()=>{if(e.to)return e.to;if(e.to!==null&&s&&s.length>0)return await Zw({authorization:s[0]}).catch(()=>{throw new pt("`to` is required. Could not infer from `authorizationList`.")})})();if((B==null?void 0:B.type)==="json-rpc"||B===null){let R;n!==null&&(R=await Wn(t,Wf,"getChainId")({}),w2({currentChainId:R,chain:n}));const W=(U=(H=(k=t.chain)==null?void 0:k.formatters)==null?void 0:H.transactionRequest)==null?void 0:U.format,me=(W||$g)({...e2(L,{format:W}),accessList:i,authorizationList:s,blobs:o,chainId:R,data:a,from:B==null?void 0:B.address,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:_,to:Z,type:M,value:O}),j=Jg.get(t.uid),E=j?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:E,params:[me]},{retryCount:0})}catch(m){if(j===!1)throw m;const f=m;if(f.name==="InvalidInputRpcError"||f.name==="InvalidParamsRpcError"||f.name==="MethodNotFoundRpcError"||f.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[me]},{retryCount:0}).then(g=>(Jg.set(t.uid,!0),g)).catch(g=>{const v=g;throw v.name==="MethodNotFoundRpcError"||v.name==="MethodNotSupportedRpcError"?(Jg.set(t.uid,!1),f):v});throw f}}if((B==null?void 0:B.type)==="local"){const R=await Wn(t,Ug,"prepareTransactionRequest")({account:B,accessList:i,authorizationList:s,blobs:o,chain:n,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:y,nonce:_,nonceManager:B.nonceManager,parameters:[...d2,"sidecars"],type:M,value:O,...L,to:Z}),W=(z=n==null?void 0:n.serializers)==null?void 0:z.transaction,ie=await B.signTransaction(R,{serializer:W});return await Wn(t,_2,"sendRawTransaction")({serializedTransaction:ie})}throw(B==null?void 0:B.type)==="smart"?new Zh({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Zh({docsPath:"/docs/actions/wallet/sendTransaction",type:B==null?void 0:B.type})}catch(Z){throw Z instanceof Zh?Z:x2(Z,{...e,account:B,chain:e.chain||void 0})}}async function wC(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:o,functionName:a,...u}=e;if(typeof n>"u")throw new Wa({docsPath:"/docs/contract/writeContract"});const l=n?fi(n):null,d=jw({abi:r,args:s,functionName:a});try{return await Wn(t,Qh,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:i,account:l,...u})}catch(p){throw EI(p,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:a,sender:l==null?void 0:l.address})}}const xC={"0x0":"reverted","0x1":"success"},E2="0x5792579257925792579257925792579257925792579257925792579257925792",S2=dr(0,{size:32});async function _C(t,e){const{account:r=t.account,capabilities:n,chain:i=t.chain,experimental_fallback:s,experimental_fallbackDelay:o=32,forceAtomic:a=!1,id:u,version:l="2.0.0"}=e,d=r?fi(r):null,p=e.calls.map(y=>{const _=y,M=_.abi?jw({abi:_.abi,functionName:_.functionName,args:_.args}):_.data;return{data:_.dataSuffix&&M?ra([M,_.dataSuffix]):M,to:_.to,value:_.value?dr(_.value):void 0}});try{const y=await t.request({method:"wallet_sendCalls",params:[{atomicRequired:a,calls:p,capabilities:n,chainId:dr(i.id),from:d==null?void 0:d.address,id:u,version:l}]},{retryCount:0});return typeof y=="string"?{id:y}:y}catch(y){const _=y;if(s&&(_.name==="MethodNotFoundRpcError"||_.name==="MethodNotSupportedRpcError"||_.name==="UnknownRpcError"||_.details.toLowerCase().includes("does not exist / is not available")||_.details.toLowerCase().includes("missing or invalid. request()")||_.details.toLowerCase().includes("did not match any variant of untagged enum")||_.details.toLowerCase().includes("account upgraded to unsupported contract")||_.details.toLowerCase().includes("eip-7702 not supported")||_.details.toLowerCase().includes("unsupported wc_ method"))){if(n&&Object.values(n).some(k=>!k.optional)){const k="non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";throw new Qc(new pt(k,{details:k}))}if(a&&p.length>1){const B="`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";throw new eu(new pt(B,{details:B}))}const M=[];for(const B of p){const k=Qh(t,{account:d,chain:i,data:B.data,to:B.to,value:B.value?Zo(B.value):void 0});M.push(k),o>0&&await new Promise(H=>setTimeout(H,o))}const O=await Promise.allSettled(M);if(O.every(B=>B.status==="rejected"))throw O[0].reason;const L=O.map(B=>B.status==="fulfilled"?B.value:S2);return{id:ra([...L,dr(i.id,{size:32}),E2])}}throw x2(y,{...e,account:d,chain:e.chain})}}async function A2(t,e){async function r(d){if(d.endsWith(E2.slice(2))){const y=Lh(xg(d,-64,-32)),_=xg(d,0,-64).slice(2).match(/.{1,64}/g),M=await Promise.all(_.map(L=>S2.slice(2)!==L?t.request({method:"eth_getTransactionReceipt",params:[`0x${L}`]},{dedupe:!0}):void 0)),O=M.some(L=>L===null)?100:M.every(L=>(L==null?void 0:L.status)==="0x1")?200:M.every(L=>(L==null?void 0:L.status)==="0x0")?500:600;return{atomic:!1,chainId:Qo(y),receipts:M.filter(Boolean),status:O,version:"2.0.0"}}return t.request({method:"wallet_getCallsStatus",params:[d]})}const{atomic:n=!1,chainId:i,receipts:s,version:o="2.0.0",...a}=await r(e.id),[u,l]=(()=>{const d=a.status;return d>=100&&d<200?["pending",d]:d>=200&&d<300?["success",d]:d>=300&&d<700?["failure",d]:d==="CONFIRMED"?["success",200]:d==="PENDING"?["pending",100]:[void 0,d]})();return{...a,atomic:n,chainId:i?Qo(i):void 0,receipts:(s==null?void 0:s.map(d=>({...d,blockNumber:Zo(d.blockNumber),gasUsed:Zo(d.gasUsed),status:xC[d.status]})))??[],statusCode:l,status:u,version:o}}async function EC(t,e){const{id:r,pollingInterval:n=t.pollingInterval,status:i=({statusCode:y})=>y>=200,timeout:s=6e4}=e,o=qa(["waitForCallsStatus",t.uid,r]),{promise:a,resolve:u,reject:l}=mC();let d;const p=bC(o,{resolve:u,reject:l},y=>{const _=yC(async()=>{const M=O=>{clearTimeout(d),_(),O(),p()};try{const O=await A2(t,{id:r});if(!i(O))return;M(()=>y.resolve(O))}catch(O){M(()=>y.reject(O))}},{interval:n,emitOnBegin:!0});return _});return d=s?setTimeout(()=>{p(),clearTimeout(d),l(new SC({id:r}))},s):void 0,await a}class SC extends pt{constructor({id:e}){super(`Timed out while waiting for call bundle with id "${e}" to be confirmed.`,{name:"WaitForCallsStatusTimeoutError"})}}const Xg=256;let ed=Xg,td;function P2(t=11){if(!td||ed+t>Xg*2){td="",ed=0;for(let e=0;e{const U=H(k);for(const Z in L)delete U[Z];const z={...k,...U};return Object.assign(z,{extend:B(z)})}}return Object.assign(L,{extend:B(L)})}const rd=new jh(8192);function PC(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(rd.get(r))return rd.get(r);const n=t().finally(()=>rd.delete(r));return rd.set(r,n),n}function MC(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const u=async({error:l})=>{const d=typeof e=="function"?e({count:a,error:l}):e;d&&await Yg(d),o({count:a+1})};try{const l=await t();i(l)}catch(l){if(a{var p;const{dedupe:i=!1,methods:s,retryDelay:o=150,retryCount:a=3,uid:u}={...e,...n},{method:l}=r;if((p=s==null?void 0:s.exclude)!=null&&p.includes(l))throw new Ha(new Error("method not supported"),{method:l});if(s!=null&&s.include&&!s.include.includes(l))throw new Ha(new Error("method not supported"),{method:l});const d=i?Bh(`${u}.${qa(r)}`):void 0;return PC(()=>MC(async()=>{try{return await t(r)}catch(y){const _=y;switch(_.code){case Pf.code:throw new Pf(_);case Mf.code:throw new Mf(_);case If.code:throw new If(_,{method:r.method});case Cf.code:throw new Cf(_);case za.code:throw new za(_);case Tf.code:throw new Tf(_);case Rf.code:throw new Rf(_);case Df.code:throw new Df(_);case Of.code:throw new Of(_);case Ha.code:throw new Ha(_,{method:r.method});case Xc.code:throw new Xc(_);case Nf.code:throw new Nf(_);case Zc.code:throw new Zc(_);case Lf.code:throw new Lf(_);case kf.code:throw new kf(_);case Bf.code:throw new Bf(_);case $f.code:throw new $f(_);case Ff.code:throw new Ff(_);case Qc.code:throw new Qc(_);case jf.code:throw new jf(_);case Uf.code:throw new Uf(_);case qf.code:throw new qf(_);case zf.code:throw new zf(_);case Hf.code:throw new Hf(_);case eu.code:throw new eu(_);case 5e3:throw new Zc(_);default:throw y instanceof pt?y:new xI(_)}}},{delay:({count:y,error:_})=>{var M;if(_&&_ instanceof Vw){const O=(M=_==null?void 0:_.headers)==null?void 0:M.get("Retry-After");if(O!=null&&O.match(/\d/))return Number.parseInt(O)*1e3}return~~(1<CC(y)}),{enabled:i,id:d})}}function CC(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Xc.code||t.code===za.code:t instanceof Vw&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function TC({key:t,methods:e,name:r,request:n,retryCount:i=3,retryDelay:s=150,timeout:o,type:a},u){const l=P2();return{config:{key:t,methods:e,name:r,request:n,retryCount:i,retryDelay:s,timeout:o,type:a},request:IC(n,{methods:e,retryCount:i,retryDelay:s,uid:l}),value:u}}function nd(t,e={}){const{key:r="custom",methods:n,name:i="Custom Provider",retryDelay:s}=e;return({retryCount:o})=>TC({key:r,methods:n,name:i,request:t.request.bind(t),retryCount:e.retryCount??o,retryDelay:s,type:"custom"})}function RC(t){return{formatters:void 0,fees:void 0,serializers:void 0,...t}}class DC extends pt{constructor({domain:e}){super(`Invalid domain "${qa(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class OC extends pt{constructor({primaryType:e,types:r}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class NC extends pt{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function LC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(u,l)=>{const d={...l};for(const p of u){const{name:y,type:_}=p;_==="address"&&(d[y]=d[y].toLowerCase())}return d},o=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return qa({domain:o,message:a,primaryType:n,types:i})}function kC(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(o,a)=>{for(const u of o){const{name:l,type:d}=u,p=a[l],y=d.match(Lw);if(y&&(typeof p=="number"||typeof p=="bigint")){const[O,L,B]=y;dr(p,{signed:L==="int",size:Number.parseInt(B)/8})}if(d==="address"&&typeof p=="string"&&!gs(p))throw new ta({address:p});const _=d.match(NM);if(_){const[O,L]=_;if(L&&vn(p)!==Number.parseInt(L))throw new $P({expectedSize:Number.parseInt(L),givenSize:vn(p)})}const M=i[d];M&&($C(d),s(M,p))}};if(i.EIP712Domain&&e){if(typeof e!="object")throw new DC({domain:e});s(i.EIP712Domain,e)}if(n!=="EIP712Domain")if(i[n])s(i[n],r);else throw new OC({primaryType:n,types:i})}function BC({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},(typeof(t==null?void 0:t.chainId)=="number"||typeof(t==null?void 0:t.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function $C(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new NC({type:t})}let M2=class extends vg{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,nM(e);const n=xf(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew M2(t,e).update(r).digest();I2.create=(t,e)=>new M2(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const hi=BigInt(0),ei=BigInt(1),Ka=BigInt(2),FC=BigInt(3),C2=BigInt(4),T2=BigInt(5),R2=BigInt(8);function qi(t,e){const r=t%e;return r>=hi?r:e+r}function zi(t,e,r){let n=t;for(;e-- >hi;)n*=n,n%=r;return n}function D2(t,e){if(t===hi)throw new Error("invert: expected non-zero number");if(e<=hi)throw new Error("invert: expected positive modulus, got "+e);let r=qi(t,e),n=e,i=hi,s=ei;for(;r!==hi;){const a=n/r,u=n%r,l=i-s*a;n=r,r=u,i=s,s=l}if(n!==ei)throw new Error("invert: does not exist");return qi(i,e)}function O2(t,e){const r=(t.ORDER+ei)/C2,n=t.pow(e,r);if(!t.eql(t.sqr(n),e))throw new Error("Cannot find square root");return n}function jC(t,e){const r=(t.ORDER-T2)/R2,n=t.mul(e,Ka),i=t.pow(n,r),s=t.mul(e,i),o=t.mul(t.mul(s,Ka),i),a=t.mul(s,t.sub(o,t.ONE));if(!t.eql(t.sqr(a),e))throw new Error("Cannot find square root");return a}function UC(t){if(t1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return O2;let s=i.pow(n,e);const o=(e+ei)/Ka;return function(u,l){if(u.is0(l))return l;if(L2(u,l)!==1)throw new Error("Cannot find square root");let d=r,p=u.mul(u.ONE,s),y=u.pow(l,e),_=u.pow(l,o);for(;!u.eql(y,u.ONE);){if(u.is0(y))return u.ZERO;let M=1,O=u.sqr(y);for(;!u.eql(O,u.ONE);)if(M++,O=u.sqr(O),M===d)throw new Error("Cannot find square root");const L=ei<(n[i]="function",n),e);return Kg(t,r),t}function WC(t,e,r){if(rhi;)r&ei&&(n=t.mul(n,i)),i=t.sqr(i),r>>=ei;return n}function N2(t,e,r=!1){const n=new Array(e.length).fill(r?t.ZERO:void 0),i=e.reduce((o,a,u)=>t.is0(a)?o:(n[u]=o,t.mul(o,a)),t.ONE),s=t.inv(i);return e.reduceRight((o,a,u)=>t.is0(a)?o:(n[u]=t.mul(o,n[u]),t.mul(o,a)),s),n}function L2(t,e){const r=(t.ORDER-ei)/Ka,n=t.pow(e,r),i=t.eql(n,t.ONE),s=t.eql(n,t.ZERO),o=t.eql(n,t.neg(t.ONE));if(!i&&!s&&!o)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function KC(t,e){e!==void 0&&wf(e);const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function id(t,e,r=!1,n={}){if(t<=hi)throw new Error("invalid field: expected ORDER > 0, got "+t);let i,s;if(typeof e=="object"&&e!=null){if(n.sqrt||r)throw new Error("cannot specify opts in two arguments");const d=e;d.BITS&&(i=d.BITS),d.sqrt&&(s=d.sqrt),typeof d.isLE=="boolean"&&(r=d.isLE)}else typeof e=="number"&&(i=e),n.sqrt&&(s=n.sqrt);const{nBitLength:o,nByteLength:a}=KC(t,i);if(a>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let u;const l=Object.freeze({ORDER:t,isLE:r,BITS:o,BYTES:a,MASK:Xh(o),ZERO:hi,ONE:ei,create:d=>qi(d,t),isValid:d=>{if(typeof d!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof d);return hi<=d&&dd===hi,isValidNot0:d=>!l.is0(d)&&l.isValid(d),isOdd:d=>(d&ei)===ei,neg:d=>qi(-d,t),eql:(d,p)=>d===p,sqr:d=>qi(d*d,t),add:(d,p)=>qi(d+p,t),sub:(d,p)=>qi(d-p,t),mul:(d,p)=>qi(d*p,t),pow:(d,p)=>WC(l,d,p),div:(d,p)=>qi(d*D2(p,t),t),sqrN:d=>d*d,addN:(d,p)=>d+p,subN:(d,p)=>d-p,mulN:(d,p)=>d*p,inv:d=>D2(d,t),sqrt:s||(d=>(u||(u=qC(t)),u(l,d))),toBytes:d=>r?v2(d,a):Hg(d,a),fromBytes:d=>{if(d.length!==a)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+d.length);return r?m2(d):Jh(d)},invertBatch:d=>N2(l,d),cmov:(d,p,y)=>y?p:d});return Object.freeze(l)}function k2(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function B2(t){const e=k2(t);return e+Math.ceil(e/2)}function VC(t,e,r=!1){const n=t.length,i=k2(e),s=B2(e);if(n<16||n1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);const o=r?m2(t):Jh(t),a=qi(o,e-ei)+ei;return r?v2(a,i):Hg(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ru=BigInt(0),Va=BigInt(1);function Kf(t,e){const r=e.negate();return t?r:e}function GC(t,e,r){const n=o=>o.pz,i=N2(t.Fp,r.map(n));return r.map((o,a)=>o.toAffine(i[a])).map(t.fromAffine)}function $2(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function Zg(t,e){$2(t,e);const r=Math.ceil(e/t)+1,n=2**(t-1),i=2**t,s=Xh(t),o=BigInt(t);return{windows:r,windowSize:n,mask:s,maxNumber:i,shiftBy:o}}function F2(t,e,r){const{windowSize:n,mask:i,maxNumber:s,shiftBy:o}=r;let a=Number(t&i),u=t>>o;a>n&&(a-=s,u+=Va);const l=e*n,d=l+Math.abs(a)-1,p=a===0,y=a<0,_=e%2!==0;return{nextN:u,offset:d,isZero:p,isNeg:y,isNegF:_,offsetF:l}}function YC(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function JC(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}const Qg=new WeakMap,j2=new WeakMap;function em(t){return j2.get(t)||1}function U2(t){if(t!==ru)throw new Error("invalid wNAF")}function XC(t,e){return{constTimeNegate:Kf,hasPrecomputes(r){return em(r)!==1},unsafeLadder(r,n,i=t.ZERO){let s=r;for(;n>ru;)n&Va&&(i=i.add(s)),s=s.double(),n>>=Va;return i},precomputeWindow(r,n){const{windows:i,windowSize:s}=Zg(n,e),o=[];let a=r,u=a;for(let l=0;lru||n>ru;)r&Va&&(s=s.add(i)),n&Va&&(o=o.add(i)),i=i.double(),r>>=Va,n>>=Va;return{p1:s,p2:o}}function QC(t,e,r,n){YC(r,t),JC(n,e);const i=r.length,s=n.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");const o=t.ZERO,a=lC(BigInt(i));let u=1;a>12?u=a-3:a>4?u=a-2:a>0&&(u=2);const l=Xh(u),d=new Array(Number(l)+1).fill(o),p=Math.floor((e.BITS-1)/u)*u;let y=o;for(let _=p;_>=0;_-=u){d.fill(o);for(let O=0;O>BigInt(_)&l);d[B]=d[B].add(r[O])}let M=o;for(let O=d.length-1,L=o;O>0;O--)L=L.add(d[O]),M=M.add(L);if(y=y.add(M),_!==0)for(let O=0;Oru))throw new Error(`CURVE.${a} must be positive bigint`)}const n=q2(e.p,r.Fp),i=q2(e.n,r.Fn),o=["Gx","Gy","a","b"];for(const a of o)if(!n.isValid(e[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return{Fp:n,Fn:i}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function z2(t){t.lowS!==void 0&&Gh("lowS",t.lowS),t.prehash!==void 0&&Gh("prehash",t.prehash)}class tT extends Error{constructor(e=""){super(e)}}const go={Err:tT,_tlv:{encode:(t,e)=>{const{Err:r}=go;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=Yh(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?Yh(i.length/2|128):"";return Yh(t)+s+i+e},decode(t,e){const{Err:r}=go;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");const l=e.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const d of l)o=o<<8|d;if(n+=u,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=go;if(t{const{px:me,py:j,pz:E}=W;if(r.eql(E,r.ONE))return{x:me,y:j};const m=W.is0();ie==null&&(ie=m?r.ONE:r.inv(E));const f=r.mul(me,ie),g=r.mul(j,ie),v=r.mul(E,ie);if(m)return{x:r.ZERO,y:r.ZERO};if(!r.eql(v,r.ONE))throw new Error("invZ was invalid");return{x:f,y:g}}),H=b2(W=>{if(W.is0()){if(e.allowInfinityPoint&&!r.is0(W.py))return;throw new Error("bad point: ZERO")}const{x:ie,y:me}=W.toAffine();if(!r.isValid(ie)||!r.isValid(me))throw new Error("bad point: x or y not field elements");if(!_(ie,me))throw new Error("bad point: equation left != right");if(!W.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function U(W,ie,me,j,E){return me=new z(r.mul(me.px,W),me.py,me.pz),ie=Kf(j,ie),me=Kf(E,me),ie.add(me)}class z{constructor(ie,me,j){this.px=L("x",ie),this.py=L("y",me,!0),this.pz=L("z",j),Object.freeze(this)}static fromAffine(ie){const{x:me,y:j}=ie||{};if(!ie||!r.isValid(me)||!r.isValid(j))throw new Error("invalid affine point");if(ie instanceof z)throw new Error("projective point not allowed");return r.is0(me)&&r.is0(j)?z.ZERO:new z(me,j,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(ie){return GC(z,"pz",ie)}static fromBytes(ie){return ps(ie),z.fromHex(ie)}static fromHex(ie){const me=z.fromAffine(p(Ui("pointHex",ie)));return me.assertValidity(),me}static fromPrivateKey(ie){const me=H2(n,e.allowedPrivateKeyLengths,e.wrapPrivateKey);return z.BASE.multiply(me(ie))}static msm(ie,me){return QC(z,n,ie,me)}precompute(ie=8,me=!0){return R.setWindowSize(this,ie),me||this.multiply(sd),this}_setWindowSize(ie){this.precompute(ie)}assertValidity(){H(this)}hasEvenY(){const{y:ie}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(ie)}equals(ie){B(ie);const{px:me,py:j,pz:E}=this,{px:m,py:f,pz:g}=ie,v=r.eql(r.mul(me,g),r.mul(m,E)),x=r.eql(r.mul(j,g),r.mul(f,E));return v&&x}negate(){return new z(this.px,r.neg(this.py),this.pz)}double(){const{a:ie,b:me}=t,j=r.mul(me,sd),{px:E,py:m,pz:f}=this;let g=r.ZERO,v=r.ZERO,x=r.ZERO,S=r.mul(E,E),A=r.mul(m,m),b=r.mul(f,f),P=r.mul(E,m);return P=r.add(P,P),x=r.mul(E,f),x=r.add(x,x),g=r.mul(ie,x),v=r.mul(j,b),v=r.add(g,v),g=r.sub(A,v),v=r.add(A,v),v=r.mul(g,v),g=r.mul(P,g),x=r.mul(j,x),b=r.mul(ie,b),P=r.sub(S,b),P=r.mul(ie,P),P=r.add(P,x),x=r.add(S,S),S=r.add(x,S),S=r.add(S,b),S=r.mul(S,P),v=r.add(v,S),b=r.mul(m,f),b=r.add(b,b),S=r.mul(b,P),g=r.sub(g,S),x=r.mul(b,A),x=r.add(x,x),x=r.add(x,x),new z(g,v,x)}add(ie){B(ie);const{px:me,py:j,pz:E}=this,{px:m,py:f,pz:g}=ie;let v=r.ZERO,x=r.ZERO,S=r.ZERO;const A=t.a,b=r.mul(t.b,sd);let P=r.mul(me,m),I=r.mul(j,f),F=r.mul(E,g),ce=r.add(me,j),D=r.add(m,f);ce=r.mul(ce,D),D=r.add(P,I),ce=r.sub(ce,D),D=r.add(me,E);let se=r.add(m,g);return D=r.mul(D,se),se=r.add(P,F),D=r.sub(D,se),se=r.add(j,E),v=r.add(f,g),se=r.mul(se,v),v=r.add(I,F),se=r.sub(se,v),S=r.mul(A,D),v=r.mul(b,F),S=r.add(v,S),v=r.sub(I,S),S=r.add(I,S),x=r.mul(v,S),I=r.add(P,P),I=r.add(I,P),F=r.mul(A,F),D=r.mul(b,D),I=r.add(I,F),F=r.sub(P,F),F=r.mul(A,F),D=r.add(D,F),P=r.mul(I,D),x=r.add(x,P),P=r.mul(se,D),v=r.mul(ce,v),v=r.sub(v,P),P=r.mul(ce,I),S=r.mul(se,S),S=r.add(S,P),new z(v,x,S)}subtract(ie){return this.add(ie.negate())}is0(){return this.equals(z.ZERO)}multiply(ie){const{endo:me}=e;if(!n.isValidNot0(ie))throw new Error("invalid scalar: out of range");let j,E;const m=f=>R.wNAFCached(this,f,z.normalizeZ);if(me){const{k1neg:f,k1:g,k2neg:v,k2:x}=me.splitScalar(ie),{p:S,f:A}=m(g),{p:b,f:P}=m(x);E=A.add(P),j=U(me.beta,S,b,f,v)}else{const{p:f,f:g}=m(ie);j=f,E=g}return z.normalizeZ([j,E])[0]}multiplyUnsafe(ie){const{endo:me}=e,j=this;if(!n.isValid(ie))throw new Error("invalid scalar: out of range");if(ie===Vf||j.is0())return z.ZERO;if(ie===Gf)return j;if(R.hasPrecomputes(this))return this.multiply(ie);if(me){const{k1neg:E,k1:m,k2neg:f,k2:g}=me.splitScalar(ie),{p1:v,p2:x}=ZC(z,j,m,g);return U(me.beta,v,x,E,f)}else return R.wNAFCachedUnsafe(j,ie)}multiplyAndAddUnsafe(ie,me,j){const E=this.multiplyUnsafe(me).add(ie.multiplyUnsafe(j));return E.is0()?void 0:E}toAffine(ie){return k(this,ie)}isTorsionFree(){const{isTorsionFree:ie}=e;return i===Gf?!0:ie?ie(z,this):R.wNAFCachedUnsafe(this,s).is0()}clearCofactor(){const{clearCofactor:ie}=e;return i===Gf?this:ie?ie(z,this):this.multiplyUnsafe(i)}toBytes(ie=!0){return Gh("isCompressed",ie),this.assertValidity(),d(z,this,ie)}toRawBytes(ie=!0){return this.toBytes(ie)}toHex(ie=!0){return Yc(this.toBytes(ie))}toString(){return``}}z.BASE=new z(t.Gx,t.Gy,r.ONE),z.ZERO=new z(r.ZERO,r.ONE,r.ZERO),z.Fp=r,z.Fn=n;const Z=n.BITS,R=XC(z,e.endo?Math.ceil(Z/2):Z);return z}function W2(t){return Uint8Array.of(t?2:3)}function oT(t,e,r={}){Kg(e,{hash:"function"},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const n=e.randomBytes||lM,i=e.hmac||((j,...E)=>I2(e.hash,j,Ua(...E))),{Fp:s,Fn:o}=t,{ORDER:a,BITS:u}=o;function l(j){const E=a>>Gf;return j>E}function d(j){return l(j)?o.neg(j):j}function p(j,E){if(!o.isValidNot0(E))throw new Error(`invalid signature ${j}: out of range 1..CURVE.n`)}class y{constructor(E,m,f){p("r",E),p("s",m),this.r=E,this.s=m,f!=null&&(this.recovery=f),Object.freeze(this)}static fromCompact(E){const m=o.BYTES,f=Ui("compactSignature",E,m*2);return new y(o.fromBytes(f.subarray(0,m)),o.fromBytes(f.subarray(m,m*2)))}static fromDER(E){const{r:m,s:f}=go.toSig(Ui("DER",E));return new y(m,f)}assertValidity(){}addRecoveryBit(E){return new y(this.r,this.s,E)}recoverPublicKey(E){const m=s.ORDER,{r:f,s:g,recovery:v}=this;if(v==null||![0,1,2,3].includes(v))throw new Error("recovery id invalid");if(a*rT1)throw new Error("recovery id is ambiguous for h>1 curve");const S=v===2||v===3?f+a:f;if(!s.isValid(S))throw new Error("recovery id 2 or 3 invalid");const A=s.toBytes(S),b=t.fromHex(Ua(W2((v&1)===0),A)),P=o.inv(S),I=H(Ui("msgHash",E)),F=o.create(-I*P),ce=o.create(g*P),D=t.BASE.multiplyUnsafe(F).add(b.multiplyUnsafe(ce));if(D.is0())throw new Error("point at infinify");return D.assertValidity(),D}hasHighS(){return l(this.s)}normalizeS(){return this.hasHighS()?new y(this.r,o.neg(this.s),this.recovery):this}toBytes(E){if(E==="compact")return Ua(o.toBytes(this.r),o.toBytes(this.s));if(E==="der")return mg(go.hexFromSig(this));throw new Error("invalid format")}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return Yc(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return Yc(this.toBytes("compact"))}}const _=H2(o,r.allowedPrivateKeyLengths,r.wrapPrivateKey),M={isValidPrivateKey(j){try{return _(j),!0}catch{return!1}},normPrivateKeyToScalar:_,randomPrivateKey:()=>{const j=a;return VC(n(B2(j)),j)},precompute(j=8,E=t.BASE){return E.precompute(j,!1)}};function O(j,E=!0){return t.fromPrivateKey(j).toBytes(E)}function L(j){if(typeof j=="bigint")return!1;if(j instanceof t)return!0;const m=Ui("key",j).length,f=s.BYTES,g=f+1,v=2*f+1;if(!(r.allowedPrivateKeyLengths||o.BYTES===g))return m===g||m===v}function B(j,E,m=!0){if(L(j)===!0)throw new Error("first arg must be private key");if(L(E)===!1)throw new Error("second arg must be public key");return t.fromHex(E).multiply(_(j)).toBytes(m)}const k=e.bits2int||function(j){if(j.length>8192)throw new Error("input is too large");const E=Jh(j),m=j.length*8-u;return m>0?E>>BigInt(m):E},H=e.bits2int_modN||function(j){return o.create(k(j))},U=Xh(u);function z(j){return fC("num < 2^"+u,j,Vf,U),o.toBytes(j)}function Z(j,E,m=R){if(["recovered","canonical"].some(ce=>ce in m))throw new Error("sign() legacy options not supported");const{hash:f}=e;let{lowS:g,prehash:v,extraEntropy:x}=m;g==null&&(g=!0),j=Ui("msgHash",j),z2(m),v&&(j=Ui("prehashed msgHash",f(j)));const S=H(j),A=_(E),b=[z(A),z(S)];if(x!=null&&x!==!1){const ce=x===!0?n(s.BYTES):x;b.push(Ui("extraEntropy",ce))}const P=Ua(...b),I=S;function F(ce){const D=k(ce);if(!o.isValidNot0(D))return;const se=o.inv(D),ee=t.BASE.multiply(D).toAffine(),J=o.create(ee.x);if(J===Vf)return;const Q=o.create(se*o.create(I+J*A));if(Q===Vf)return;let T=(ee.x===J?0:2)|Number(ee.y&Gf),X=Q;return g&&l(Q)&&(X=d(Q),T^=1),new y(J,X,T)}return{seed:P,k2sig:F}}const R={lowS:e.lowS,prehash:!1},W={lowS:e.lowS,prehash:!1};function ie(j,E,m=R){const{seed:f,k2sig:g}=Z(j,E,m);return hC(e.hash.outputLen,o.BYTES,i)(f,g)}t.BASE.precompute(8);function me(j,E,m,f=W){const g=j;E=Ui("msgHash",E),m=Ui("publicKey",m),z2(f);const{lowS:v,prehash:x,format:S}=f;if("strict"in f)throw new Error("options.strict was renamed to lowS");if(S!==void 0&&!["compact","der","js"].includes(S))throw new Error('format must be "compact", "der" or "js"');const A=typeof g=="string"||pg(g),b=!A&&!S&&typeof g=="object"&&g!==null&&typeof g.r=="bigint"&&typeof g.s=="bigint";if(!A&&!b)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let P,I;try{if(b)if(S===void 0||S==="js")P=new y(g.r,g.s);else throw new Error("invalid format");if(A){try{S!=="compact"&&(P=y.fromDER(g))}catch(X){if(!(X instanceof go.Err))throw X}!P&&S!=="der"&&(P=y.fromCompact(g))}I=t.fromHex(m)}catch{return!1}if(!P||v&&P.hasHighS())return!1;x&&(E=e.hash(E));const{r:F,s:ce}=P,D=H(E),se=o.inv(ce),ee=o.create(D*se),J=o.create(F*se),Q=t.BASE.multiplyUnsafe(ee).add(I.multiplyUnsafe(J));return Q.is0()?!1:o.create(Q.x)===F}return Object.freeze({getPublicKey:O,getSharedSecret:B,sign:ie,verify:me,utils:M,Point:t,Signature:y})}function aT(t){const e={a:t.a,b:t.b,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r=t.Fp,n=id(e.n,t.nBitLength),i={Fp:r,Fn:n,allowedPrivateKeyLengths:t.allowedPrivateKeyLengths,allowInfinityPoint:t.allowInfinityPoint,endo:t.endo,wrapPrivateKey:t.wrapPrivateKey,isTorsionFree:t.isTorsionFree,clearCofactor:t.clearCofactor,fromBytes:t.fromBytes,toBytes:t.toBytes};return{CURVE:e,curveOpts:i}}function cT(t){const{CURVE:e,curveOpts:r}=aT(t),n={hash:t.hash,hmac:t.hmac,randomBytes:t.randomBytes,lowS:t.lowS,bits2int:t.bits2int,bits2int_modN:t.bits2int_modN};return{CURVE:e,curveOpts:r,ecdsaOpts:n}}function uT(t,e){return Object.assign({},e,{ProjectivePoint:e.Point,CURVE:t})}function fT(t){const{CURVE:e,curveOpts:r,ecdsaOpts:n}=cT(t),i=sT(e,r),s=oT(i,n,r);return uT(t,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function lT(t,e){const r=n=>fT({...t,hash:n});return{...r(e),create:r}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const od={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")};BigInt(0);const hT=BigInt(1),tm=BigInt(2),K2=(t,e)=>(t+e/tm)/e;function dT(t){const e=od.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),u=BigInt(88),l=t*t*t%e,d=l*l*t%e,p=zi(d,r,e)*d%e,y=zi(p,r,e)*d%e,_=zi(y,tm,e)*l%e,M=zi(_,i,e)*_%e,O=zi(M,s,e)*M%e,L=zi(O,a,e)*O%e,B=zi(L,u,e)*L%e,k=zi(B,a,e)*O%e,H=zi(k,r,e)*d%e,U=zi(H,o,e)*M%e,z=zi(U,n,e)*l%e,Z=zi(z,tm,e);if(!rm.eql(rm.sqr(Z),t))throw new Error("Cannot find square root");return Z}const rm=id(od.p,void 0,void 0,{sqrt:dT}),pT=lT({...od,Fp:rm,lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=od.n,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-hT*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=K2(s*t,e),u=K2(-n*t,e);let l=qi(t-a*r-u*i,e),d=qi(-a*n-u*s,e);const p=l>o,y=d>o;if(p&&(l=e-l),y&&(d=e-d),l>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:p,k1:l,k2neg:y,k2:d}}}},a2),gT=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:pT},Symbol.toStringTag,{value:"Module"}));async function mT(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:dr(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}function vT(t,e){const{abi:r,args:n,bytecode:i,...s}=e,o=gC({abi:r,args:n,bytecode:i});return Qh(t,{...s,...s.authorizationList?{to:null}:{},data:o})}async function bT(t){var r;return((r=t.account)==null?void 0:r.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(n=>Sf(n))}async function yT(t,e={}){const{account:r=t.account,chainId:n}=e,i=r?fi(r):void 0,s=n?[i==null?void 0:i.address,[dr(n)]]:[i==null?void 0:i.address],o=await t.request({method:"wallet_getCapabilities",params:s}),a={};for(const[u,l]of Object.entries(o)){a[Number(u)]={};for(let[d,p]of Object.entries(l))d==="addSubAccount"&&(d="unstable_addSubAccount"),a[Number(u)][d]=p}return typeof n=="number"?a[n]:a}async function wT(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}async function V2(t,e){var u;const{account:r=t.account,chainId:n,nonce:i}=e;if(!r)throw new Wa({docsPath:"/docs/eip7702/prepareAuthorization"});const s=fi(r),o=(()=>{if(e.executor)return e.executor==="self"?e.executor:fi(e.executor)})(),a={address:e.contractAddress??e.address,chainId:n,nonce:i};return typeof a.chainId>"u"&&(a.chainId=((u=t.chain)==null?void 0:u.id)??await Wn(t,Wf,"getChainId")({})),typeof a.nonce>"u"&&(a.nonce=await Wn(t,i2,"getTransactionCount")({address:s.address,blockTag:"pending"}),(o==="self"||o!=null&&o.address&&cC(o.address,s.address))&&(a.nonce+=1)),a}async function xT(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>yg(r))}async function _T(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function ET(t,e){const{id:r}=e;await t.request({method:"wallet_showCallsStatus",params:[r]})}async function ST(t,e){const{account:r=t.account}=e;if(!r)throw new Wa({docsPath:"/docs/eip7702/signAuthorization"});const n=fi(r);if(!n.signAuthorization)throw new Zh({docsPath:"/docs/eip7702/signAuthorization",metaMessages:["The `signAuthorization` Action does not support JSON-RPC Accounts."],type:n.type});const i=await V2(t,e);return n.signAuthorization(i)}async function AT(t,{account:e=t.account,message:r}){if(!e)throw new Wa({docsPath:"/docs/actions/wallet/signMessage"});const n=fi(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Bh(r):r.raw instanceof Uint8Array?kh(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function PT(t,e){var l,d,p,y;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new Wa({docsPath:"/docs/actions/wallet/signTransaction"});const s=fi(r);Kh({account:s,...e});const o=await Wn(t,Wf,"getChainId")({});n!==null&&w2({currentChainId:o,chain:n});const a=(n==null?void 0:n.formatters)||((l=t.chain)==null?void 0:l.formatters),u=((d=a==null?void 0:a.transactionRequest)==null?void 0:d.format)||$g;return s.signTransaction?s.signTransaction({...i,chainId:o},{serializer:(y=(p=t.chain)==null?void 0:p.serializers)==null?void 0:y.transaction}):await t.request({method:"eth_signTransaction",params:[{...u(i),chainId:dr(o),from:s.address}]},{retryCount:0})}async function MT(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new Wa({docsPath:"/docs/actions/wallet/signTypedData"});const o=fi(r),a={EIP712Domain:BC({domain:n}),...e.types};if(kC({domain:n,message:i,primaryType:s,types:a}),o.signTypedData)return o.signTypedData({domain:n,message:i,primaryType:s,types:a});const u=LC({domain:n,message:i,primaryType:s,types:a});return t.request({method:"eth_signTypedData_v4",params:[o.address,u]},{retryCount:0})}async function IT(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:dr(e)}]},{retryCount:0})}async function CT(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}function TT(t){return{addChain:e=>mT(t,e),deployContract:e=>vT(t,e),getAddresses:()=>bT(t),getCallsStatus:e=>A2(t,e),getCapabilities:e=>yT(t,e),getChainId:()=>Wf(t),getPermissions:()=>wT(t),prepareAuthorization:e=>V2(t,e),prepareTransactionRequest:e=>Ug(t,e),requestAddresses:()=>xT(t),requestPermissions:e=>_T(t,e),sendCalls:e=>_C(t,e),sendRawTransaction:e=>_2(t,e),sendTransaction:e=>Qh(t,e),showCallsStatus:e=>ET(t,e),signAuthorization:e=>ST(t,e),signMessage:e=>AT(t,e),signTransaction:e=>PT(t,e),signTypedData:e=>MT(t,e),switchChain:e=>IT(t,e),waitForCallsStatus:e=>EC(t,e),watchAsset:e=>CT(t,e),writeContract:e=>wC(t,e)}}function ad(t){const{key:e="wallet",name:r="Wallet Client",transport:n}=t;return AC({...t,key:e,name:r,transport:n,type:"walletClient"}).extend(TT)}class Ga{constructor(e){Ns(this,"_key");Ns(this,"_config",null);Ns(this,"_provider",null);Ns(this,"_connected",!1);Ns(this,"_address",null);Ns(this,"_fatured",!1);Ns(this,"_installed",!1);Ns(this,"lastUsed",!1);Ns(this,"_client",null);var r;if("name"in e&&"image"in e)this._key=e.name,this._config=e,this._fatured=e.featured;else if("session"in e){if(!e.session)throw new Error("session is null");this._key=(r=e.session)==null?void 0:r.peer.metadata.name,this._provider=e,this._client=ad({transport:nd(this._provider)}),this._config={name:e.session.peer.metadata.name,image:e.session.peer.metadata.icons[0],featured:!1},this.testConnect()}else if("info"in e)this._key=e.info.name,this._provider=e.provider,this._installed=!0,this._client=ad({transport:nd(this._provider)}),this._config={name:e.info.name,image:e.info.icon,featured:!1},this.testConnect();else throw new Error("unknown params")}get address(){return this._address}get connected(){return this._connected}get featured(){return this._fatured}get key(){return this._key}get installed(){return this._installed}get provider(){return this._provider}get client(){return this._client?this._client:null}get config(){return this._config}static fromWalletConfig(e){return new Ga(e)}EIP6963Detected(e){this._provider=e.provider,this._client=ad({transport:nd(this._provider)}),this._installed=!0,this._provider.on("disconnect",this.disconnect),this._provider.on("accountsChanged",r=>{this._address=r[0],this._connected=!0}),this.testConnect()}setUniversalProvider(e){this._provider=e,this._client=ad({transport:nd(this._provider)}),this.testConnect()}async switchChain(e){var r,n,i,s;try{return await((r=this.client)==null?void 0:r.getChainId())===e.id||await((n=this.client)==null?void 0:n.switchChain(e)),!0}catch(o){if(o.code===4902)return await((i=this.client)==null?void 0:i.addChain({chain:e})),await((s=this.client)==null?void 0:s.switchChain(e)),!0;throw o}}async testConnect(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());e&&e.length>0?(this._address=e[0],this._connected=!0):(this._address=null,this._connected=!1)}async connect(){var r;const e=await((r=this.client)==null?void 0:r.requestAddresses());if(!e)throw new Error("connect failed");return e}async getAddress(){var r;const e=await((r=this.client)==null?void 0:r.getAddresses());if(!e)throw new Error("get address failed");return e[0]}async getChain(){var r;const e=await((r=this.client)==null?void 0:r.getChainId());if(!e)throw new Error("get chain failed");return e}async signMessage(e,r){var i;return await((i=this.client)==null?void 0:i.signMessage({message:e,account:r}))}async disconnect(){this._provider&&"session"in this._provider&&await this._provider.disconnect(),this._connected=!1,this._address=null}}var nm={exports:{}},nu=typeof Reflect=="object"?Reflect:null,G2=nu&&typeof nu.apply=="function"?nu.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},cd;nu&&typeof nu.ownKeys=="function"?cd=nu.ownKeys:Object.getOwnPropertySymbols?cd=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:cd=function(e){return Object.getOwnPropertyNames(e)};function RT(t){console&&console.warn&&console.warn(t)}var Y2=Number.isNaN||function(e){return e!==e};function Rr(){Rr.init.call(this)}nm.exports=Rr,nm.exports.once=LT,Rr.EventEmitter=Rr,Rr.prototype._events=void 0,Rr.prototype._eventsCount=0,Rr.prototype._maxListeners=void 0;var J2=10;function ud(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Rr,"defaultMaxListeners",{enumerable:!0,get:function(){return J2},set:function(t){if(typeof t!="number"||t<0||Y2(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");J2=t}}),Rr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Rr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Y2(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function X2(t){return t._maxListeners===void 0?Rr.defaultMaxListeners:t._maxListeners}Rr.prototype.getMaxListeners=function(){return X2(this)},Rr.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")G2(u,this,r);else for(var l=u.length,d=rx(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,RT(a)}return t}Rr.prototype.addListener=function(e,r){return Z2(this,e,r,!1)},Rr.prototype.on=Rr.prototype.addListener,Rr.prototype.prependListener=function(e,r){return Z2(this,e,r,!0)};function DT(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Q2(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=DT.bind(n);return i.listener=r,n.wrapFn=i,i}Rr.prototype.once=function(e,r){return ud(r),this.on(e,Q2(this,e,r)),this},Rr.prototype.prependOnceListener=function(e,r){return ud(r),this.prependListener(e,Q2(this,e,r)),this},Rr.prototype.removeListener=function(e,r){var n,i,s,o,a;if(ud(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():OT(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Rr.prototype.off=Rr.prototype.removeListener,Rr.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function ex(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?NT(i):rx(i,i.length)}Rr.prototype.listeners=function(e){return ex(this,e,!0)},Rr.prototype.rawListeners=function(e){return ex(this,e,!1)},Rr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):tx.call(t,e)},Rr.prototype.listenerCount=tx;function tx(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Rr.prototype.eventNames=function(){return this._eventsCount>0?cd(this._events):[]};function rx(t,e){for(var r=new Array(e),n=0;n`,Tt,Mt,mt,Mt),tt[Mt+Tt]=!0}}return j===n?Ut(ot):jt(ot),ot}}function K(j,oe,le){return Ft(j,oe,le,!0)}function G(j,oe,le){return Ft(j,oe,le,!1)}var J=G,T=K;pu.Fragment=n,pu.jsx=J,pu.jsxs=T})()),pu}var oy;function TA(){return oy||(oy=1,process.env.NODE_ENV==="production"?Rl.exports=CA():Rl.exports=RA()),Rl.exports}var he=TA();const bs="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2",DA=[{featured:!0,name:"MetaMask",rdns:"io.metamask",image:`${bs}#metamask`,getWallet:{chrome_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",brave_store_id:"nkbihfbeogaeaoehlefnkodbefgpgknn",edge_addon_id:"ejbalbakoplchlghecdalmeeeajnimhm",firefox_addon_id:"ether-metamask",play_store_id:"io.metamask",app_store_id:"id1438144202"},deep_link:"metamask://wc",universal_link:"https://metamask.app.link/wc"},{name:"Binance Wallet",featured:!0,image:`${bs}#ebac7b39-688c-41e3-7912-a4fefba74600`,getWallet:{chrome_store_id:"cadiboklkpojfamcoggejbbdjcoiljjk",play_store_id:"com.binance.dev",app_store_id:"id1436799971"}},{featured:!0,name:"OKX Wallet",rdns:"com.okex.wallet",image:`${bs}#okx`,getWallet:{chrome_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",brave_store_id:"mcohilncbfahbmgdjkbpemcciiolgcge",edge_addon_id:"pbpjkcldjiffchgbbndmhojiacbgflha",play_store_id:"com.okinc.okex.gp",app_store_id:"id1327268470"},deep_link:"okex://main/wc",universal_link:"okex://main/wc"},{featured:!0,name:"WalletConnect",image:`${bs}#walletconnect`},{featured:!1,name:"Coinbase Wallet",image:`${bs}#coinbase`},{featured:!1,name:"GateWallet",rdns:"io.gate.wallet",image:`${bs}#6e528abf-7a7d-47bd-d84d-481f169b1200`,getWallet:{chrome_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",brave_store_id:"cpmkedoipcpimgecpmgpldfpohjplkpp",play_store_id:"com.gateio.gateio",app_store_id:"id1294998195",mac_app_store_id:"id1609559473"},deep_link:"https://www.gate.io/mobileapp",universal_link:"https://www.gate.io/mobileapp"},{featured:!1,name:"Onekey",rdns:"so.onekey.app.wallet",image:`${bs}#onekey`,getWallet:{chrome_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",brave_store_id:"jnmbobjmhlngoefaiojfljckilhhlhcj",play_store_id:"so.onekey.app.wallet",app_store_id:"id1609559473"},deep_link:"onekey-wallet://",universal_link:"onekey://wc"},{featured:!1,name:"Infinity Wallet",image:`${bs}#9f259366-0bcd-4817-0af9-f78773e41900`,desktop_link:"infinity://wc"},{name:"Rabby Wallet",rdns:"io.rabby",featured:!1,image:`${bs}#rabby`,getWallet:{chrome_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",brave_store_id:"acmacodkjbdgmoleebolmdjonilkdbch",play_store_id:"com.debank.rabbymobile",app_store_id:"id6474381673"}},{name:"Rainbow Wallet",rdns:"me.rainbow",featured:!1,image:`${bs}#rainbow`,getWallet:{chrome_store_id:"opfgelmcmbiajamepnmloijbpoleiama",edge_addon_id:"cpojfbodiccabbabgimdeohkkpjfpbnf",firefox_addon_id:"rainbow-extension",app_store_id:"id1457119021",play_store_id:"me.rainbow"}}];function OA(t,e){return t.exec(e)?.groups}const ay=/^tuple(?(\[(\d*)\])*)$/;function V0(t){let e=t.type;if(ay.test(t.type)&&"components"in t){e="(";const r=t.components.length;for(let i=0;ie(t,s)}function nc(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new KA(t.type);return`${t.name}(${G0(t.inputs,{includeName:e})})`}function G0(t,{includeName:e=!1}={}){return t?t.map(r=>LA(r,{includeName:e})).join(e?", ":","):""}function LA(t,{includeName:e}){return t.type.startsWith("tuple")?`(${G0(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}function wo(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function gn(t){return wo(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const cy="2.31.3";let Y0={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${cy}`};class dt extends Error{constructor(e,r={}){const n=r.cause instanceof dt?r.cause.details:r.cause?.message?r.cause.message:r.details,i=r.cause instanceof dt&&r.cause.docsPath||r.docsPath,s=Y0.getDocsUrl?.({...r,docsPath:i}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...Y0.version?[`Version: ${Y0.version}`]:[]].join(` +`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=cy}walk(e){return uy(this,e)}}function uy(t,e){return e?.(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?uy(t.cause,e):e?null:t}class kA extends dt{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` +`),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class fy extends dt{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` +`),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class BA extends dt{constructor({data:e,params:r,size:n}){super([`Data size of ${n} bytes is too small for given parameters.`].join(` +`),{metaMessages:[`Params: (${G0(r,{includeName:!0})})`,`Data: ${e} (${n} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=r,this.size=n}}class J0 extends dt{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class FA extends dt{constructor({expectedLength:e,givenLength:r,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${e}`,`Given length: ${r}`].join(` +`),{name:"AbiEncodingArrayLengthMismatchError"})}}class jA extends dt{constructor({expectedSize:e,value:r}){super(`Size of bytes "${r}" (bytes${gn(r)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class UA extends dt{constructor({expectedLength:e,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${r}`].join(` +`),{name:"AbiEncodingLengthMismatchError"})}}class ly extends dt{constructor(e,{docsPath:r}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(` +`),{docsPath:r,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class hy extends dt{constructor(e,{docsPath:r}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` +`),{docsPath:r,name:"AbiFunctionNotFoundError"})}}class $A extends dt{constructor(e,r){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${nc(e.abiItem)}\`, and`,`\`${r.type}\` in \`${nc(r.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class qA extends dt{constructor({expectedSize:e,givenSize:r}){super(`Expected bytes${e}, got bytes${r}.`,{name:"BytesSizeMismatchError"})}}class zA extends dt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(` +`),{docsPath:r,name:"InvalidAbiEncodingType"})}}class HA extends dt{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` +`),{docsPath:r,name:"InvalidAbiDecodingType"})}}class WA extends dt{constructor(e){super([`Value "${e}" is not a valid array.`].join(` +`),{name:"InvalidArrayError"})}}class KA extends dt{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` +`),{name:"InvalidDefinitionTypeError"})}}class dy extends dt{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}class py extends dt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}class gy extends dt{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function ic(t,{dir:e,size:r=32}={}){return typeof t=="string"?xo(t,{dir:e,size:r}):VA(t,{dir:e,size:r})}function xo(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new py({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function VA(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new py({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie)throw new YA({givenSize:gn(t),maxSize:e})}function _o(t,e={}){const{signed:r}=e;e.size&&ys(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<e.toString(16).padStart(2,"0"));function Dl(t,e={}){return typeof t=="number"||typeof t=="bigint"?pr(t,e):typeof t=="string"?Ol(t,e):typeof t=="boolean"?vy(t,e):ti(t,e)}function vy(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(ys(r,{size:e.size}),ic(r,{size:e.size})):r}function ti(t,e={}){let r="";for(let i=0;is||i=js.zero&&t<=js.nine)return t-js.zero;if(t>=js.A&&t<=js.F)return t-(js.A-10);if(t>=js.a&&t<=js.f)return t-(js.a-10)}function Us(t,e={}){let r=t;e.size&&(ys(r,{size:e.size}),r=ic(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o>wy&Nl)}:{h:Number(t>>wy&Nl)|0,l:Number(t&Nl)|0}}function rP(t,e=!1){const r=t.length;let n=new Uint32Array(r),i=new Uint32Array(r);for(let s=0;st<>>32-r,iP=(t,e,r)=>e<>>32-r,sP=(t,e,r)=>e<>>64-r,oP=(t,e,r)=>t<>>64-r,sc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Z0(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function mu(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function es(t,...e){if(!Z0(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function aP(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");mu(t.outputLen),mu(t.blockLen)}function oc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function xy(t,e){es(t);const r=e.outputLen;if(t.length>>e}const uP=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function fP(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function lP(t){for(let e=0;et:lP,Ey=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",hP=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function cc(t){if(es(t),Ey)return t.toHex();let e="";for(let r=0;r=$s._0&&t<=$s._9)return t-$s._0;if(t>=$s.A&&t<=$s.F)return t-($s.A-10);if(t>=$s.a&&t<=$s.f)return t-($s.a-10)}function ep(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(Ey)return Uint8Array.fromHex(t);const e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;it().update(Ll(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function pP(t=32){if(sc&&typeof sc.getRandomValues=="function")return sc.getRandomValues(new Uint8Array(t));if(sc&&typeof sc.randomBytes=="function")return Uint8Array.from(sc.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}const gP=BigInt(0),vu=BigInt(1),mP=BigInt(2),vP=BigInt(7),bP=BigInt(256),yP=BigInt(113),Py=[],Iy=[],My=[];for(let t=0,e=vu,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],Py.push(2*(5*n+r)),Iy.push((t+1)*(t+2)/2%64);let i=gP;for(let s=0;s<7;s++)e=(e<>vP)*yP)%bP,e&mP&&(i^=vu<<(vu<r>32?sP(t,e,r):nP(t,e,r),Ty=(t,e,r)=>r>32?oP(t,e,r):iP(t,e,r);function _P(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,f=(o+2)%10,u=r[f],h=r[f+1],g=Ry(u,h,1)^r[a],b=Ty(u,h,1)^r[a+1];for(let x=0;x<50;x+=10)t[o+x]^=g,t[o+x+1]^=b}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=Iy[o],f=Ry(i,s,a),u=Ty(i,s,a),h=Py[o];i=t[h],s=t[h+1],t[h]=f,t[h+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=wP[n],t[1]^=xP[n]}ac(r)}class rp extends tp{constructor(e,r,n,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,mu(n),!(0=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return mu(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(xy(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,ac(this.state)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new rp(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const EP=(t,e,r)=>Ay(()=>new rp(e,t,r)),SP=EP(1,136,256/8);function kl(t,e){const r=e||"hex",n=SP(wo(t,{strict:!1})?X0(t):t);return r==="bytes"?n:Dl(n)}const AP=t=>kl(X0(t));function PP(t){return AP(t)}function IP(t){let e=!0,r="",n=0,i="",s=!1;for(let o=0;o{const e=typeof t=="string"?t:NA(t);return IP(e)};function Dy(t){return PP(MP(t))}const CP=Dy;class So extends dt{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class Bl extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const np=new Bl(8192);function bu(t,e){if(np.has(`${t}.${e}`))return np.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=kl(yy(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return np.set(`${t}.${e}`,s),s}function ip(t,e){if(!ts(t,{strict:!1}))throw new So({address:t});return bu(t,e)}const RP=/^0x[a-fA-F0-9]{40}$/,sp=new Bl(8192);function ts(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(sp.has(n))return sp.get(n);const i=RP.test(t)?t.toLowerCase()===t?!0:r?bu(t)===t:!0:!1;return sp.set(n,i),i}function Ao(t){return typeof t[0]=="string"?Fl(t):TP(t)}function TP(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function Fl(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}function jl(t,e,r,{strict:n}={}){return wo(t,{strict:!1})?op(t,e,r,{strict:n}):Ly(t,e,r,{strict:n})}function Oy(t,e){if(typeof e=="number"&&e>0&&e>gn(t)-1)throw new dy({offset:e,position:"start",size:gn(t)})}function Ny(t,e,r){if(typeof e=="number"&&typeof r=="number"&&gn(t)!==r-e)throw new dy({offset:r,position:"end",size:gn(t)})}function Ly(t,e,r,{strict:n}={}){Oy(t,e);const i=t.slice(e,r);return n&&Ny(i,e,r),i}function op(t,e,r,{strict:n}={}){Oy(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&Ny(i,e,r),i}const DP=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ky=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function By(t,e){if(t.length!==e.length)throw new UA({expectedLength:t.length,givenLength:e.length});const r=OP({params:t,values:e}),n=cp(r);return n.length===0?"0x":n}function OP({params:t,values:e}){const r=[];for(let n=0;n0?Ao([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:Ao(s.map(({encoded:o})=>o))}}function kP(t,{param:e}){const[,r]=e.type.split("bytes"),n=gn(t);if(!r){let i=t;return n%32!==0&&(i=xo(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:Ao([xo(pr(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new jA({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:xo(t,{dir:"right"})}}function BP(t){if(typeof t!="boolean")throw new dt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:xo(vy(t))}}function FP(t,{signed:e,size:r=256}){if(typeof r=="number"){const n=2n**(BigInt(r)-(e?1n:0n))-1n,i=e?-n-1n:0n;if(t>n||ti))}}function up(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const fp=t=>jl(Dy(t),0,4);function Fy(t){const{abi:e,args:r=[],name:n}=t,i=wo(n,{strict:!1}),s=e.filter(a=>i?a.type==="function"?fp(a)===n:a.type==="event"?CP(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((u,h)=>{const g="inputs"in a&&a.inputs[h];return g?lp(u,g):!1})){if(o&&"inputs"in o&&o.inputs){const u=jy(a.inputs,o.inputs,r);if(u)throw new $A({abiItem:a,type:u[0]},{abiItem:o,type:u[1]})}o=a}}return o||s[0]}function lp(t,e){const r=typeof t,n=e.type;switch(n){case"address":return ts(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>lp(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>lp(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function jy(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return jy(i.components,s.components,r[n]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?ts(r[n],{strict:!1}):o.includes("address")&&o.includes("bytes")?ts(r[n],{strict:!1}):!1)return o}}function ri(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const Uy="/docs/contract/encodeFunctionData";function $P(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=Fy({abi:e,args:r,name:n});if(!s)throw new hy(n,{docsPath:Uy});i=s}if(i.type!=="function")throw new hy(void 0,{docsPath:Uy});return{abi:[i],functionName:fp(nc(i))}}function $y(t){const{args:e}=t,{abi:r,functionName:n}=t.abi.length===1&&t.functionName?.startsWith("0x")?t:$P(t),i=r[0],s=n,o="inputs"in i&&i.inputs?By(i.inputs,e??[]):void 0;return Fl([s,o??"0x"])}const qP={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},zP={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},HP={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class qy extends dt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class WP extends dt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class KP extends dt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const VP={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new KP({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new WP({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new qy({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new qy({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function hp(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(VP);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function GP(t,e={}){typeof e.size<"u"&&ys(t,{size:e.size});const r=ti(t,e);return _o(r,e)}function YP(t,e={}){let r=t;if(typeof e.size<"u"&&(ys(r,{size:e.size}),r=Tl(r)),r.length>1||r[0]>1)throw new GA(r);return!!r[0]}function qs(t,e={}){typeof e.size<"u"&&ys(t,{size:e.size});const r=ti(t,e);return Eo(r,e)}function JP(t,e={}){let r=t;return typeof e.size<"u"&&(ys(r,{size:e.size}),r=Tl(r,{dir:"right"})),new TextDecoder().decode(r)}function XP(t,e){const r=typeof e=="string"?Us(e):e,n=hp(r);if(gn(r)===0&&t.length>0)throw new J0;if(gn(e)&&gn(e)<32)throw new BA({data:typeof e=="string"?e:ti(e),params:t,size:gn(e)});let i=0;const s=[];for(let o=0;o48?GP(i,{signed:r}):qs(i,{signed:r}),32]}function nI(t,e,{staticPosition:r}){const n=e.components.length===0||e.components.some(({name:o})=>!o),i=n?[]:{};let s=0;if(yu(e)){const o=qs(t.readBytes(dp)),a=r+o;for(let f=0;fo.type==="error"&&n===fp(nc(o)));if(!s)throw new ly(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?XP(s.inputs,jl(r,4)):void 0,errorName:s.name}}const sa=(t,e,r)=>JSON.stringify(t,(n,i)=>typeof i=="bigint"?i.toString():i,r);function Hy({abiItem:t,args:e,includeFunctionName:r=!0,includeName:n=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${r?t.name:""}(${t.inputs.map((i,s)=>`${n&&i.name?`${i.name}: `:""}${typeof e[s]=="object"?sa(e[s]):e[s]}`).join(", ")})`}const oI={gwei:9,wei:18},aI={ether:-9,wei:9};function Wy(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}function Ky(t,e="wei"){return Wy(t,oI[e])}function rs(t,e="wei"){return Wy(t,aI[e])}class cI extends dt{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class uI extends dt{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Ul(t){const e=Object.entries(t).map(([n,i])=>i===void 0||i===!1?null:[n,i]).filter(Boolean),r=e.reduce((n,[i])=>Math.max(n,i.length),0);return e.map(([n,i])=>` ${`${n}:`.padEnd(r+1)} ${i}`).join(` +`)}class fI extends dt{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(` +`),{name:"FeeConflictError"})}}class lI extends dt{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Ul(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class hI extends dt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:f,maxPriorityFeePerGas:u,nonce:h,to:g,value:b}){const x=Ul({chain:i&&`${i?.name} (id: ${i?.id})`,from:r?.address,to:g,value:typeof b<"u"&&`${Ky(b)} ${i?.nativeCurrency?.symbol||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${rs(a)} gwei`,maxFeePerGas:typeof f<"u"&&`${rs(f)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${rs(u)} gwei`,nonce:h});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",x].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const dI=t=>t,Vy=t=>t;class pI extends dt{constructor(e,{abi:r,args:n,contractAddress:i,docsPath:s,functionName:o,sender:a}){const f=Fy({abi:r,args:n,name:o}),u=f?Hy({abiItem:f,args:n,includeFunctionName:!1,includeName:!1}):void 0,h=f?nc(f,{includeName:!0}):void 0,g=Ul({address:i&&dI(i),function:h,args:u&&u!=="()"&&`${[...Array(o?.length??0).keys()].map(()=>" ").join("")}${u}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:s,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],g&&"Contract Call:",g].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=e,this.contractAddress=i,this.functionName=o,this.sender=a}}class gI extends dt{constructor({abi:e,data:r,functionName:n,message:i}){let s,o,a,f;if(r&&r!=="0x")try{o=sI({abi:e,data:r});const{abiItem:h,errorName:g,args:b}=o;if(g==="Error")f=b[0];else if(g==="Panic"){const[x]=b;f=qP[x]}else{const x=h?nc(h,{includeName:!0}):void 0,S=h&&b?Hy({abiItem:h,args:b,includeFunctionName:!1,includeName:!1}):void 0;a=[x?`Error: ${x}`:"",S&&S!=="()"?` ${[...Array(g?.length??0).keys()].map(()=>" ").join("")}${S}`:""]}}catch(h){s=h}else i&&(f=i);let u;s instanceof ly&&(u=s.signature,a=[`Unable to decode signature "${u}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${u}.`]),super(f&&f!=="execution reverted"||u?[`The contract function "${n}" reverted with the following ${u?"signature":"reason"}:`,f||u].join(` +`):`The contract function "${n}" reverted.`,{cause:s,metaMessages:a,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.raw=r,this.reason=f,this.signature=u}}class mI extends dt{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class vI extends dt{constructor({data:e,message:r}){super(r||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}class Gy extends dt{constructor({body:e,cause:r,details:n,headers:i,status:s,url:o}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${Vy(o)}`,e&&`Request body: ${sa(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=i,this.status=s,this.url=o}}class Yy extends dt{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${Vy(n)}`,`Request body: ${sa(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code,this.data=r.data}}const bI=-1;class ni extends dt{constructor(e,{code:r,docsPath:n,metaMessages:i,name:s,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:i||e?.metaMessages,name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||e.name,this.code=e instanceof Yy?e.code:r??bI}}class gi extends ni{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class wu extends ni{constructor(e){super(e,{code:wu.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(wu,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class xu extends ni{constructor(e){super(e,{code:xu.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(xu,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class _u extends ni{constructor(e,{method:r}={}){super(e,{code:_u.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(_u,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Eu extends ni{constructor(e){super(e,{code:Eu.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` +`)})}}Object.defineProperty(Eu,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class oa extends ni{constructor(e){super(e,{code:oa.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(oa,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Su extends ni{constructor(e){super(e,{code:Su.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` +`)})}}Object.defineProperty(Su,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Au extends ni{constructor(e){super(e,{code:Au.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Au,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Pu extends ni{constructor(e){super(e,{code:Pu.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Pu,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Iu extends ni{constructor(e){super(e,{code:Iu.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Iu,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class aa extends ni{constructor(e,{method:r}={}){super(e,{code:aa.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not supported.`})}}Object.defineProperty(aa,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class fc extends ni{constructor(e){super(e,{code:fc.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(fc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Mu extends ni{constructor(e){super(e,{code:Mu.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Mu,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class lc extends gi{constructor(e){super(e,{code:lc.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(lc,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Cu extends gi{constructor(e){super(e,{code:Cu.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Cu,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Ru extends gi{constructor(e,{method:r}={}){super(e,{code:Ru.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(Ru,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Tu extends gi{constructor(e){super(e,{code:Tu.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Tu,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Du extends gi{constructor(e){super(e,{code:Du.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Du,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Ou extends gi{constructor(e){super(e,{code:Ou.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Ou,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class hc extends gi{constructor(e){super(e,{code:hc.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(hc,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class Nu extends gi{constructor(e){super(e,{code:Nu.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(Nu,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class Lu extends gi{constructor(e){super(e,{code:Lu.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(Lu,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class ku extends gi{constructor(e){super(e,{code:ku.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(ku,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class Bu extends gi{constructor(e){super(e,{code:Bu.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(Bu,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class Fu extends gi{constructor(e){super(e,{code:Fu.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(Fu,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class dc extends gi{constructor(e){super(e,{code:dc.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(dc,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class yI extends ni{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const wI=3;function xI(t,{abi:e,address:r,args:n,docsPath:i,functionName:s,sender:o}){const a=t instanceof vI?t:t instanceof dt?t.walk(S=>"data"in S)||t.walk():{},{code:f,data:u,details:h,message:g,shortMessage:b}=a,x=t instanceof J0?new mI({functionName:s}):[wI,oa.code].includes(f)&&(u||h||g||b)?new gI({abi:e,data:typeof u=="object"?u.data:u,functionName:s,message:a instanceof Yy?h:b??g}):t;return new pI(x,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:o})}function _I(t){const e=kl(`0x${t.substring(4)}`).substring(26);return bu(`0x${e}`)}async function EI({hash:t,signature:e}){const r=wo(t)?t:Dl(t),{secp256k1:n}=await Promise.resolve().then(()=>dC);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:u,s:h,v:g,yParity:b}=e,x=Number(b??g),S=Jy(x);return new n.Signature(_o(u),_o(h)).addRecoveryBit(S)}const o=wo(e)?e:Dl(e);if(gn(o)!==65)throw new Error("invalid signature length");const a=Eo(`0x${o.slice(130)}`),f=Jy(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(f)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Jy(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function SI({hash:t,signature:e}){return _I(await EI({hash:t,signature:e}))}function AI(t,e="hex"){const r=Xy(t),n=hp(new Uint8Array(r.length));return r.encode(n),e==="hex"?ti(n.bytes):n.bytes}function Xy(t){return Array.isArray(t)?PI(t.map(e=>Xy(e))):II(t)}function PI(t){const e=t.reduce((i,s)=>i+s.length,0),r=Zy(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function II(t){const e=typeof t=="string"?Us(t):t,r=Zy(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function Zy(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new dt("Length is too large.")}function MI(t){const{chainId:e,nonce:r,to:n}=t,i=t.contractAddress??t.address,s=kl(Fl(["0x05",AI([e?pr(e):"0x",i,r?pr(r):"0x"])]));return n==="bytes"?Us(s):s}async function Qy(t){const{authorization:e,signature:r}=t;return SI({hash:MI(e),signature:r??e})}class CI extends dt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:f,maxPriorityFeePerGas:u,nonce:h,to:g,value:b}){const x=Ul({from:r?.address,to:g,value:typeof b<"u"&&`${Ky(b)} ${i?.nativeCurrency?.symbol||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${rs(a)} gwei`,maxFeePerGas:typeof f<"u"&&`${rs(f)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${rs(u)} gwei`,nonce:h});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",x].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class pc extends dt{constructor({cause:e,message:r}={}){const n=r?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(pc,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(pc,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class $l extends dt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${rs(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty($l,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class pp extends dt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${rs(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(pp,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class gp extends dt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(gp,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class mp extends dt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` +`),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(mp,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class vp extends dt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(vp,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class bp extends dt{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` +`),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(bp,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class yp extends dt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(yp,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class wp extends dt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(wp,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class xp extends dt{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(xp,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class ql extends dt{constructor({cause:e,maxPriorityFeePerGas:r,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${r?` = ${rs(r)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${rs(n)} gwei`:""}).`].join(` +`),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(ql,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class _p extends dt{constructor({cause:e}){super(`An error occurred while executing: ${e?.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function ew(t,e){const r=(t.details||"").toLowerCase(),n=t instanceof dt?t.walk(i=>i?.code===pc.code):t;return n instanceof dt?new pc({cause:t,message:n.details}):pc.nodeMessage.test(r)?new pc({cause:t,message:t.details}):$l.nodeMessage.test(r)?new $l({cause:t,maxFeePerGas:e?.maxFeePerGas}):pp.nodeMessage.test(r)?new pp({cause:t,maxFeePerGas:e?.maxFeePerGas}):gp.nodeMessage.test(r)?new gp({cause:t,nonce:e?.nonce}):mp.nodeMessage.test(r)?new mp({cause:t,nonce:e?.nonce}):vp.nodeMessage.test(r)?new vp({cause:t,nonce:e?.nonce}):bp.nodeMessage.test(r)?new bp({cause:t}):yp.nodeMessage.test(r)?new yp({cause:t,gas:e?.gas}):wp.nodeMessage.test(r)?new wp({cause:t,gas:e?.gas}):xp.nodeMessage.test(r)?new xp({cause:t}):ql.nodeMessage.test(r)?new ql({cause:t,maxFeePerGas:e?.maxFeePerGas,maxPriorityFeePerGas:e?.maxPriorityFeePerGas}):new _p({cause:t})}function RI(t,{docsPath:e,...r}){const n=(()=>{const i=ew(t,r);return i instanceof _p?t:i})();return new CI(n,{docsPath:e,...r})}function tw(t,{format:e}){if(!e)return{};const r={};function n(s){const o=Object.keys(s);for(const a of o)a in t&&(r[a]=t[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}const i=e(t||{});return n(i),r}const TI={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Ep(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=DI(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(r=>ti(r)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=pr(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=pr(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=pr(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=pr(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=pr(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=pr(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=TI[t.type]),typeof t.value<"u"&&(e.value=pr(t.value)),e}function DI(t){return t.map(e=>({address:e.address,r:e.r?pr(BigInt(e.r)):e.r,s:e.s?pr(BigInt(e.s)):e.s,chainId:pr(e.chainId),nonce:pr(e.nonce),...typeof e.yParity<"u"?{yParity:pr(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:pr(e.v)}:{}}))}function rw(t){if(!(!t||t.length===0))return t.reduce((e,{slot:r,value:n})=>{if(r.length!==66)throw new gy({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new gy({size:n.length,targetSize:66,type:"hex"});return e[r]=n,e},{})}function OI(t){const{balance:e,nonce:r,state:n,stateDiff:i,code:s}=t,o={};if(s!==void 0&&(o.code=s),e!==void 0&&(o.balance=pr(e)),r!==void 0&&(o.nonce=pr(r)),n!==void 0&&(o.state=rw(n)),i!==void 0){if(o.state)throw new uI;o.stateDiff=rw(i)}return o}function NI(t){if(!t)return;const e={};for(const{address:r,...n}of t){if(!ts(r,{strict:!1}))throw new So({address:r});if(e[r])throw new cI({address:r});e[r]=OI(n)}return e}const LI=2n**256n-1n;function zl(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?ri(e):void 0;if(o&&!ts(o.address))throw new So({address:o.address});if(s&&!ts(s))throw new So({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new fI;if(n&&n>LI)throw new $l({maxFeePerGas:n});if(i&&n&&i>n)throw new ql({maxFeePerGas:n,maxPriorityFeePerGas:i})}class kI extends dt{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Sp extends dt{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class BI extends dt{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${rs(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class FI extends dt{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}const jI={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function UI(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?Eo(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?Eo(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?jI[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=$I(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function $I(t){return t.map(e=>({address:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function qI(t){const e=(t.transactions??[]).map(r=>typeof r=="string"?r:UI(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function Hl(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){const s=n??"latest",o=i??!1,a=r!==void 0?pr(r):void 0;let f=null;if(e?f=await t.request({method:"eth_getBlockByHash",params:[e,o]},{dedupe:!0}):f=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]},{dedupe:!!a}),!f)throw new FI({blockHash:e,blockNumber:r});return(t.chain?.formatters?.block?.format||qI)(f)}async function nw(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function zI(t,e){const{block:r,chain:n=t.chain,request:i}=e||{};try{const s=n?.fees?.maxPriorityFeePerGas??n?.fees?.defaultPriorityFee;if(typeof s=="function"){const a=r||await Fn(t,Hl,"getBlock")({}),f=await s({block:a,client:t,request:i});if(f===null)throw new Error;return f}if(typeof s<"u")return s;const o=await t.request({method:"eth_maxPriorityFeePerGas"});return _o(o)}catch{const[s,o]=await Promise.all([r?Promise.resolve(r):Fn(t,Hl,"getBlock")({}),Fn(t,nw,"getGasPrice")({})]);if(typeof s.baseFeePerGas!="bigint")throw new Sp;const a=o-s.baseFeePerGas;return a<0n?0n:a}}async function iw(t,e){const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>typeof n?.fees?.baseFeeMultiplier=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):n?.fees?.baseFeeMultiplier??1.2)();if(o<1)throw new kI;const f=10**(o.toString().split(".")[1]?.length??0),u=b=>b*BigInt(Math.ceil(o*f))/BigInt(f),h=r||await Fn(t,Hl,"getBlock")({});if(typeof n?.fees?.estimateFeesPerGas=="function"){const b=await n.fees.estimateFeesPerGas({block:r,client:t,multiply:u,request:i,type:s});if(b!==null)return b}if(s==="eip1559"){if(typeof h.baseFeePerGas!="bigint")throw new Sp;const b=typeof i?.maxPriorityFeePerGas=="bigint"?i.maxPriorityFeePerGas:await zI(t,{block:h,chain:n,request:i}),x=u(h.baseFeePerGas);return{maxFeePerGas:i?.maxFeePerGas??x+b,maxPriorityFeePerGas:b}}return{gasPrice:i?.gasPrice??u(await Fn(t,nw,"getGasPrice")({}))}}async function sw(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,typeof n=="bigint"?pr(n):r]},{dedupe:!!n});return Eo(i)}function ow(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(s=>Us(s)):t.blobs,i=[];for(const s of n)i.push(Uint8Array.from(e.blobToKzgCommitment(s)));return r==="bytes"?i:i.map(s=>ti(s))}function aw(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>Us(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>Us(o)):t.commitments,s=[];for(let o=0;oti(o))}function HI(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),f=n?4:0,u=n?0:4;t.setUint32(e+f,o,n),t.setUint32(e+u,a,n)}function WI(t,e,r){return t&e^~t&r}function KI(t,e,r){return t&e^t&r^e&r}class VI extends tp{constructor(e,r,n,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(e),this.view=Q0(this.buffer)}update(e){oc(this),e=Ll(e),es(e);const{view:r,buffer:n,blockLen:i}=this,s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let g=o;gh.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g>>3,C=ws(x,17)^ws(x,19)^x>>>10;Io[g]=C+Io[g-7]+S+Io[g-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:f,G:u,H:h}=this;for(let g=0;g<64;g++){const b=ws(a,6)^ws(a,11)^ws(a,25),x=h+b+WI(a,f,u)+GI[g]+Io[g]|0,C=(ws(n,2)^ws(n,13)^ws(n,22))+KI(n,i,s)|0;h=u,u=f,f=a,a=o+x|0,o=s,s=i,i=n,n=x+C|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,f=f+this.F|0,u=u+this.G|0,h=h+this.H|0,this.set(n,i,s,o,a,f,u,h)}roundClean(){ac(Io)}destroy(){this.set(0,0,0,0,0,0,0,0),ac(this.buffer)}}const cw=Ay(()=>new YI),uw=cw;function JI(t,e){return uw(wo(t,{strict:!1})?X0(t):t)}function XI(t){const{commitment:e,version:r=1}=t,n=t.to??(typeof e=="string"?"hex":"bytes"),i=JI(e);return i.set([r],0),n==="bytes"?i:ti(i)}function ZI(t){const{commitments:e,version:r}=t,n=t.to,i=[];for(const s of e)i.push(XI({commitment:s,to:n,version:r}));return i}const fw=6,lw=32,Ap=4096,hw=lw*Ap,dw=hw*fw-1-1*Ap*fw;class QI extends dt{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class eM extends dt{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function tM(t){const e=typeof t.data=="string"?Us(t.data):t.data,r=gn(e);if(!r)throw new eM;if(r>dw)throw new QI({maxSize:dw,size:r});const n=[];let i=!0,s=0;for(;i;){const o=hp(new Uint8Array(hw));let a=0;for(;ati(o.bytes))}function rM(t){const{data:e,kzg:r,to:n}=t,i=t.blobs??tM({data:e}),s=t.commitments??ow({blobs:i,kzg:r,to:n}),o=t.proofs??aw({blobs:i,commitments:s,kzg:r,to:n}),a=[];for(let f=0;f"u"&&g)if(f){const B=await D();b.nonce=await f.consume({address:g.address,chainId:B,client:t})}else b.nonce=await Fn(t,sw,"getTransactionCount")({address:g.address,blockTag:"pending"});if((u.includes("blobVersionedHashes")||u.includes("sidecars"))&&n&&o){const B=ow({blobs:n,kzg:o});if(u.includes("blobVersionedHashes")){const L=ZI({commitments:B,to:"hex"});b.blobVersionedHashes=L}if(u.includes("sidecars")){const L=aw({blobs:n,commitments:B,kzg:o}),H=rM({blobs:n,commitments:B,proofs:L,to:"hex"});b.sidecars=H}}if(u.includes("chainId")&&(b.chainId=await D()),(u.includes("fees")||u.includes("type"))&&typeof h>"u")try{b.type=nM(b)}catch{let B=gw.get(t.uid);typeof B>"u"&&(B=typeof(await S())?.baseFeePerGas=="bigint",gw.set(t.uid,B)),b.type=B?"eip1559":"legacy"}if(u.includes("fees"))if(b.type!=="legacy"&&b.type!=="eip2930"){if(typeof b.maxFeePerGas>"u"||typeof b.maxPriorityFeePerGas>"u"){const B=await S(),{maxFeePerGas:L,maxPriorityFeePerGas:H}=await iw(t,{block:B,chain:i,request:b});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"){const B=await S(),{gasPrice:L}=await iw(t,{block:B,chain:i,request:b,type:"legacy"});b.gasPrice=L}}return u.includes("gas")&&typeof s>"u"&&(b.gas=await Fn(t,sM,"estimateGas")({...b,account:g&&{address:g.address,type:"json-rpc"}})),zl(b),delete b.parameters,b}async function iM(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=typeof r=="bigint"?pr(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function sM(t,e){const{account:r=t.account}=e,n=r?ri(r):void 0;try{let q=function(v){const{block:l,request:p,rpcStateOverride:m}=v;return t.request({method:"eth_estimateGas",params:m?[p,l??"latest",m]:l?[p,l]:[p]})};const{accessList:i,authorizationList:s,blobs:o,blobVersionedHashes:a,blockNumber:f,blockTag:u,data:h,gas:g,gasPrice:b,maxFeePerBlobGas:x,maxFeePerGas:S,maxPriorityFeePerGas:C,nonce:D,value:B,stateOverride:L,...H}=await Pp(t,{...e,parameters:n?.type==="local"?void 0:["blobVersionedHashes"]}),k=(typeof f=="bigint"?pr(f):void 0)||u,$=NI(L),R=await(async()=>{if(H.to)return H.to;if(s&&s.length>0)return await Qy({authorization:s[0]}).catch(()=>{throw new dt("`to` is required. Could not infer from `authorizationList`")})})();zl(e);const W=t.chain?.formatters?.transactionRequest?.format,X=(W||Ep)({...tw(H,{format:W}),from:n?.address,accessList:i,authorizationList:s,blobs:o,blobVersionedHashes:a,data:h,gas:g,gasPrice:b,maxFeePerBlobGas:x,maxFeePerGas:S,maxPriorityFeePerGas:C,nonce:D,to:R,value:B});let _=BigInt(await q({block:k,request:X,rpcStateOverride:$}));if(s){const v=await iM(t,{address:X.from}),l=await Promise.all(s.map(async p=>{const{address:m}=p,y=await q({block:k,request:{authorizationList:void 0,data:h,from:n?.address,to:m,value:pr(v)},rpcStateOverride:$}).catch(()=>100000n);return 2n*BigInt(y)}));_+=l.reduce((p,m)=>p+m,0n)}return _}catch(i){throw RI(i,{...e,account:n,chain:t.chain})}}function oM(t,e){if(!ts(t,{strict:!1}))throw new So({address:t});if(!ts(e,{strict:!1}))throw new So({address:e});return t.toLowerCase()===e.toLowerCase()}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ip=BigInt(0),Mp=BigInt(1);function Wl(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}function Kl(t){const e=t.toString(16);return e.length&1?"0"+e:e}function mw(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?Ip:BigInt("0x"+t)}function Vl(t){return mw(cc(t))}function vw(t){return es(t),mw(cc(Uint8Array.from(t).reverse()))}function Cp(t,e){return ep(t.toString(16).padStart(e*2,"0"))}function bw(t,e){return Cp(t,e).reverse()}function Ci(t,e,r){let n;if(typeof e=="string")try{n=ep(e)}catch(s){throw new Error(t+" must be hex string or Uint8Array, cause: "+s)}else if(Z0(e))n=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const i=n.length;if(typeof r=="number"&&i!==r)throw new Error(t+" of length "+r+" expected, got "+i);return n}const Rp=t=>typeof t=="bigint"&&Ip<=t;function aM(t,e,r){return Rp(t)&&Rp(e)&&Rp(r)&&e<=t&&tIp;t>>=Mp,e+=1);return e}const Gl=t=>(Mp<new Uint8Array(x),i=x=>Uint8Array.of(x);let s=n(t),o=n(t),a=0;const f=()=>{s.fill(1),o.fill(0),a=0},u=(...x)=>r(o,s,...x),h=(x=n(0))=>{o=u(i(0),x),s=u(),x.length!==0&&(o=u(i(1),x),s=u())},g=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let x=0;const S=[];for(;x{f(),h(x);let C;for(;!(C=S(g()));)h();return f(),C}}function Tp(t,e,r={}){if(!t||typeof t!="object")throw new Error("expected valid options object");function n(i,s,o){const a=t[i];if(o&&a===void 0)return;const f=typeof a;if(f!==s||a===null)throw new Error(`param "${i}" is invalid: expected ${s}, got ${f}`)}Object.entries(e).forEach(([i,s])=>n(i,s,!1)),Object.entries(r).forEach(([i,s])=>n(i,s,!0))}function yw(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}class lM extends dt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class hM extends dt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` +`),{name:"ChainNotFoundError"})}}const Dp="/docs/contract/encodeDeployData";function dM(t){const{abi:e,args:r,bytecode:n}=t;if(!r||r.length===0)return n;const i=e.find(o=>"type"in o&&o.type==="constructor");if(!i)throw new kA({docsPath:Dp});if(!("inputs"in i))throw new fy({docsPath:Dp});if(!i.inputs||i.inputs.length===0)throw new fy({docsPath:Dp});const s=By(i.inputs,r);return Fl([n,s])}function pM(){let t=()=>{},e=()=>{};return{promise:new Promise((n,i)=>{t=n,e=i}),resolve:t,reject:e}}const Op=new Map,ww=new Map;let gM=0;function mM(t,e,r){const n=++gM,i=()=>Op.get(t)||[],s=()=>{const h=i();Op.set(t,h.filter(g=>g.id!==n))},o=()=>{const h=i();if(!h.some(b=>b.id===n))return;const g=ww.get(t);if(h.length===1&&g){const b=g();b instanceof Promise&&b.catch(()=>{})}s()},a=i();if(Op.set(t,[...a,{id:n,fns:e}]),a&&a.length>0)return o;const f={};for(const h in e)f[h]=((...g)=>{const b=i();if(b.length!==0)for(const x of b)x.fns[h]?.(...g)});const u=r(f);return typeof u=="function"&&ww.set(t,u),o}async function Np(t){return new Promise(e=>setTimeout(e,t))}function vM(t,{emitOnBegin:e,initialWaitTime:r,interval:n}){let i=!0;const s=()=>i=!1;return(async()=>{let a;a=await t({unpoll:s});const f=await r?.(a)??n;await Np(f);const u=async()=>{i&&(await t({unpoll:s}),await Np(n),u())};u()})(),s}class ca extends dt{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` +`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class Yl extends dt{constructor({docsPath:e,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:e,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function xw({chain:t,currentChainId:e}){if(!t)throw new hM;if(e!==t.id)throw new lM({chain:t,currentChainId:e})}function _w(t,{docsPath:e,...r}){const n=(()=>{const i=ew(t,r);return i instanceof _p?t:i})();return new hI(n,{docsPath:e,...r})}async function Ew(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const Lp=new Bl(128);async function Jl(t,e){const{account:r=t.account,chain:n=t.chain,accessList:i,authorizationList:s,blobs:o,data:a,gas:f,gasPrice:u,maxFeePerBlobGas:h,maxFeePerGas:g,maxPriorityFeePerGas:b,nonce:x,type:S,value:C,...D}=e;if(typeof r>"u")throw new ca({docsPath:"/docs/actions/wallet/sendTransaction"});const B=r?ri(r):null;try{zl(e);const L=await(async()=>{if(e.to)return e.to;if(e.to!==null&&s&&s.length>0)return await Qy({authorization:s[0]}).catch(()=>{throw new dt("`to` is required. Could not infer from `authorizationList`.")})})();if(B?.type==="json-rpc"||B===null){let H;n!==null&&(H=await Fn(t,ju,"getChainId")({}),xw({currentChainId:H,chain:n}));const F=t.chain?.formatters?.transactionRequest?.format,$=(F||Ep)({...tw(D,{format:F}),accessList:i,authorizationList:s,blobs:o,chainId:H,data:a,from:B?.address,gas:f,gasPrice:u,maxFeePerBlobGas:h,maxFeePerGas:g,maxPriorityFeePerGas:b,nonce:x,to:L,type:S,value:C}),R=Lp.get(t.uid),W=R?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:W,params:[$]},{retryCount:0})}catch(V){if(R===!1)throw V;const X=V;if(X.name==="InvalidInputRpcError"||X.name==="InvalidParamsRpcError"||X.name==="MethodNotFoundRpcError"||X.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[$]},{retryCount:0}).then(q=>(Lp.set(t.uid,!0),q)).catch(q=>{const _=q;throw _.name==="MethodNotFoundRpcError"||_.name==="MethodNotSupportedRpcError"?(Lp.set(t.uid,!1),X):_});throw X}}if(B?.type==="local"){const H=await Fn(t,Pp,"prepareTransactionRequest")({account:B,accessList:i,authorizationList:s,blobs:o,chain:n,data:a,gas:f,gasPrice:u,maxFeePerBlobGas:h,maxFeePerGas:g,maxPriorityFeePerGas:b,nonce:x,nonceManager:B.nonceManager,parameters:[...pw,"sidecars"],type:S,value:C,...D,to:L}),F=n?.serializers?.transaction,k=await B.signTransaction(H,{serializer:F});return await Fn(t,Ew,"sendRawTransaction")({serializedTransaction:k})}throw B?.type==="smart"?new Yl({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Yl({docsPath:"/docs/actions/wallet/sendTransaction",type:B?.type})}catch(L){throw L instanceof Yl?L:_w(L,{...e,account:B,chain:e.chain||void 0})}}async function bM(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:o,functionName:a,...f}=e;if(typeof n>"u")throw new ca({docsPath:"/docs/contract/writeContract"});const u=n?ri(n):null,h=$y({abi:r,args:s,functionName:a});try{return await Fn(t,Jl,"sendTransaction")({data:`${h}${o?o.replace("0x",""):""}`,to:i,account:u,...f})}catch(g){throw xI(g,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:a,sender:u?.address})}}const yM={"0x0":"reverted","0x1":"success"},Sw="0x5792579257925792579257925792579257925792579257925792579257925792",Aw=pr(0,{size:32});async function wM(t,e){const{account:r=t.account,capabilities:n,chain:i=t.chain,experimental_fallback:s,experimental_fallbackDelay:o=32,forceAtomic:a=!1,id:f,version:u="2.0.0"}=e,h=r?ri(r):null,g=e.calls.map(b=>{const x=b,S=x.abi?$y({abi:x.abi,functionName:x.functionName,args:x.args}):x.data;return{data:x.dataSuffix&&S?Ao([S,x.dataSuffix]):S,to:x.to,value:x.value?pr(x.value):void 0}});try{const b=await t.request({method:"wallet_sendCalls",params:[{atomicRequired:a,calls:g,capabilities:n,chainId:pr(i.id),from:h?.address,id:f,version:u}]},{retryCount:0});return typeof b=="string"?{id:b}:b}catch(b){const x=b;if(s&&(x.name==="MethodNotFoundRpcError"||x.name==="MethodNotSupportedRpcError"||x.name==="UnknownRpcError"||x.details.toLowerCase().includes("does not exist / is not available")||x.details.toLowerCase().includes("missing or invalid. request()")||x.details.toLowerCase().includes("did not match any variant of untagged enum")||x.details.toLowerCase().includes("account upgraded to unsupported contract")||x.details.toLowerCase().includes("eip-7702 not supported")||x.details.toLowerCase().includes("unsupported wc_ method"))){if(n&&Object.values(n).some(L=>!L.optional)){const L="non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";throw new hc(new dt(L,{details:L}))}if(a&&g.length>1){const B="`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";throw new dc(new dt(B,{details:B}))}const S=[];for(const B of g){const L=Jl(t,{account:h,chain:i,data:B.data,to:B.to,value:B.value?_o(B.value):void 0});S.push(L),o>0&&await new Promise(H=>setTimeout(H,o))}const C=await Promise.allSettled(S);if(C.every(B=>B.status==="rejected"))throw C[0].reason;const D=C.map(B=>B.status==="fulfilled"?B.value:Aw);return{id:Ao([...D,pr(i.id,{size:32}),Sw])}}throw _w(b,{...e,account:h,chain:e.chain})}}async function Pw(t,e){async function r(h){if(h.endsWith(Sw.slice(2))){const b=Tl(op(h,-64,-32)),x=op(h,0,-64).slice(2).match(/.{1,64}/g),S=await Promise.all(x.map(D=>Aw.slice(2)!==D?t.request({method:"eth_getTransactionReceipt",params:[`0x${D}`]},{dedupe:!0}):void 0)),C=S.some(D=>D===null)?100:S.every(D=>D?.status==="0x1")?200:S.every(D=>D?.status==="0x0")?500:600;return{atomic:!1,chainId:Eo(b),receipts:S.filter(Boolean),status:C,version:"2.0.0"}}return t.request({method:"wallet_getCallsStatus",params:[h]})}const{atomic:n=!1,chainId:i,receipts:s,version:o="2.0.0",...a}=await r(e.id),[f,u]=(()=>{const h=a.status;return h>=100&&h<200?["pending",h]:h>=200&&h<300?["success",h]:h>=300&&h<700?["failure",h]:h==="CONFIRMED"?["success",200]:h==="PENDING"?["pending",100]:[void 0,h]})();return{...a,atomic:n,chainId:i?Eo(i):void 0,receipts:s?.map(h=>({...h,blockNumber:_o(h.blockNumber),gasUsed:_o(h.gasUsed),status:yM[h.status]}))??[],statusCode:u,status:f,version:o}}async function xM(t,e){const{id:r,pollingInterval:n=t.pollingInterval,status:i=({statusCode:b})=>b>=200,timeout:s=6e4}=e,o=sa(["waitForCallsStatus",t.uid,r]),{promise:a,resolve:f,reject:u}=pM();let h;const g=mM(o,{resolve:f,reject:u},b=>{const x=vM(async()=>{const S=C=>{clearTimeout(h),x(),C(),g()};try{const C=await Pw(t,{id:r});if(!i(C))return;S(()=>b.resolve(C))}catch(C){S(()=>b.reject(C))}},{interval:n,emitOnBegin:!0});return x});return h=s?setTimeout(()=>{g(),clearTimeout(h),u(new _M({id:r}))},s):void 0,await a}class _M extends dt{constructor({id:e}){super(`Timed out while waiting for call bundle with id "${e}" to be confirmed.`,{name:"WaitForCallsStatusTimeoutError"})}}const kp=256;let Xl=kp,Zl;function Iw(t=11){if(!Zl||Xl+t>kp*2){Zl="",Xl=0;for(let e=0;e{const F=H(L);for(const $ in D)delete F[$];const k={...L,...F};return Object.assign(k,{extend:B(k)})}}return Object.assign(D,{extend:B(D)})}const Ql=new Bl(8192);function SM(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(Ql.get(r))return Ql.get(r);const n=t().finally(()=>Ql.delete(r));return Ql.set(r,n),n}function AM(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const f=async({error:u})=>{const h=typeof e=="function"?e({count:a,error:u}):e;h&&await Np(h),o({count:a+1})};try{const u=await t();i(u)}catch(u){if(a{const{dedupe:i=!1,methods:s,retryDelay:o=150,retryCount:a=3,uid:f}={...e,...n},{method:u}=r;if(s?.exclude?.includes(u))throw new aa(new Error("method not supported"),{method:u});if(s?.include&&!s.include.includes(u))throw new aa(new Error("method not supported"),{method:u});const h=i?Ol(`${f}.${sa(r)}`):void 0;return SM(()=>AM(async()=>{try{return await t(r)}catch(g){const b=g;switch(b.code){case wu.code:throw new wu(b);case xu.code:throw new xu(b);case _u.code:throw new _u(b,{method:r.method});case Eu.code:throw new Eu(b);case oa.code:throw new oa(b);case Su.code:throw new Su(b);case Au.code:throw new Au(b);case Pu.code:throw new Pu(b);case Iu.code:throw new Iu(b);case aa.code:throw new aa(b,{method:r.method});case fc.code:throw new fc(b);case Mu.code:throw new Mu(b);case lc.code:throw new lc(b);case Cu.code:throw new Cu(b);case Ru.code:throw new Ru(b);case Tu.code:throw new Tu(b);case Du.code:throw new Du(b);case Ou.code:throw new Ou(b);case hc.code:throw new hc(b);case Nu.code:throw new Nu(b);case Lu.code:throw new Lu(b);case ku.code:throw new ku(b);case Bu.code:throw new Bu(b);case Fu.code:throw new Fu(b);case dc.code:throw new dc(b);case 5e3:throw new lc(b);default:throw g instanceof dt?g:new yI(b)}}},{delay:({count:g,error:b})=>{if(b&&b instanceof Gy){const x=b?.headers?.get("Retry-After");if(x?.match(/\d/))return Number.parseInt(x)*1e3}return~~(1<IM(g)}),{enabled:i,id:h})}}function IM(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===fc.code||t.code===oa.code:t instanceof Gy&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function MM({key:t,methods:e,name:r,request:n,retryCount:i=3,retryDelay:s=150,timeout:o,type:a},f){const u=Iw();return{config:{key:t,methods:e,name:r,request:n,retryCount:i,retryDelay:s,timeout:o,type:a},request:PM(n,{methods:e,retryCount:i,retryDelay:s,uid:u}),value:f}}function eh(t,e={}){const{key:r="custom",methods:n,name:i="Custom Provider",retryDelay:s}=e;return({retryCount:o})=>MM({key:r,methods:n,name:i,request:t.request.bind(t),retryCount:e.retryCount??o,retryDelay:s,type:"custom"})}function CM(t){return{formatters:void 0,fees:void 0,serializers:void 0,...t}}class RM extends dt{constructor({domain:e}){super(`Invalid domain "${sa(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class TM extends dt{constructor({primaryType:e,types:r}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class DM extends dt{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function OM(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(f,u)=>{const h={...u};for(const g of f){const{name:b,type:x}=g;x==="address"&&(h[b]=h[b].toLowerCase())}return h},o=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return sa({domain:o,message:a,primaryType:n,types:i})}function NM(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(o,a)=>{for(const f of o){const{name:u,type:h}=f,g=a[u],b=h.match(ky);if(b&&(typeof g=="number"||typeof g=="bigint")){const[C,D,B]=b;pr(g,{signed:D==="int",size:Number.parseInt(B)/8})}if(h==="address"&&typeof g=="string"&&!ts(g))throw new So({address:g});const x=h.match(DP);if(x){const[C,D]=x;if(D&&gn(g)!==Number.parseInt(D))throw new qA({expectedSize:Number.parseInt(D),givenSize:gn(g)})}const S=i[h];S&&(kM(h),s(S,g))}};if(i.EIP712Domain&&e){if(typeof e!="object")throw new RM({domain:e});s(i.EIP712Domain,e)}if(n!=="EIP712Domain")if(i[n])s(i[n],r);else throw new TM({primaryType:n,types:i})}function LM({domain:t}){return[typeof t?.name=="string"&&{name:"name",type:"string"},t?.version&&{name:"version",type:"string"},(typeof t?.chainId=="number"||typeof t?.chainId=="bigint")&&{name:"chainId",type:"uint256"},t?.verifyingContract&&{name:"verifyingContract",type:"address"},t?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}function kM(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new DM({type:t})}class Mw extends tp{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,aP(e);const n=Ll(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew Mw(t,e).update(r).digest();Cw.create=(t,e)=>new Mw(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ii=BigInt(0),Kn=BigInt(1),ua=BigInt(2),BM=BigInt(3),Rw=BigInt(4),Tw=BigInt(5),Dw=BigInt(8);function Ri(t,e){const r=t%e;return r>=ii?r:e+r}function Ti(t,e,r){let n=t;for(;e-- >ii;)n*=n,n%=r;return n}function Ow(t,e){if(t===ii)throw new Error("invert: expected non-zero number");if(e<=ii)throw new Error("invert: expected positive modulus, got "+e);let r=Ri(t,e),n=e,i=ii,s=Kn;for(;r!==ii;){const a=n/r,f=n%r,u=i-s*a;n=r,r=f,i=s,s=u}if(n!==Kn)throw new Error("invert: does not exist");return Ri(i,e)}function Nw(t,e){const r=(t.ORDER+Kn)/Rw,n=t.pow(e,r);if(!t.eql(t.sqr(n),e))throw new Error("Cannot find square root");return n}function FM(t,e){const r=(t.ORDER-Tw)/Dw,n=t.mul(e,ua),i=t.pow(n,r),s=t.mul(e,i),o=t.mul(t.mul(s,ua),i),a=t.mul(s,t.sub(o,t.ONE));if(!t.eql(t.sqr(a),e))throw new Error("Cannot find square root");return a}function jM(t){if(t1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return Nw;let s=i.pow(n,e);const o=(e+Kn)/ua;return function(f,u){if(f.is0(u))return u;if(kw(f,u)!==1)throw new Error("Cannot find square root");let h=r,g=f.mul(f.ONE,s),b=f.pow(u,e),x=f.pow(u,o);for(;!f.eql(b,f.ONE);){if(f.is0(b))return f.ZERO;let S=1,C=f.sqr(b);for(;!f.eql(C,f.ONE);)if(S++,C=f.sqr(C),S===h)throw new Error("Cannot find square root");const D=Kn<(n[i]="function",n),e);return Tp(t,r),t}function zM(t,e,r){if(rii;)r&Kn&&(n=t.mul(n,i)),i=t.sqr(i),r>>=Kn;return n}function Lw(t,e,r=!1){const n=new Array(e.length).fill(r?t.ZERO:void 0),i=e.reduce((o,a,f)=>t.is0(a)?o:(n[f]=o,t.mul(o,a)),t.ONE),s=t.inv(i);return e.reduceRight((o,a,f)=>t.is0(a)?o:(n[f]=t.mul(o,n[f]),t.mul(o,a)),s),n}function kw(t,e){const r=(t.ORDER-Kn)/ua,n=t.pow(e,r),i=t.eql(n,t.ONE),s=t.eql(n,t.ZERO),o=t.eql(n,t.neg(t.ONE));if(!i&&!s&&!o)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function HM(t,e){e!==void 0&&mu(e);const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function th(t,e,r=!1,n={}){if(t<=ii)throw new Error("invalid field: expected ORDER > 0, got "+t);let i,s;if(typeof e=="object"&&e!=null){if(n.sqrt||r)throw new Error("cannot specify opts in two arguments");const h=e;h.BITS&&(i=h.BITS),h.sqrt&&(s=h.sqrt),typeof h.isLE=="boolean"&&(r=h.isLE)}else typeof e=="number"&&(i=e),n.sqrt&&(s=n.sqrt);const{nBitLength:o,nByteLength:a}=HM(t,i);if(a>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let f;const u=Object.freeze({ORDER:t,isLE:r,BITS:o,BYTES:a,MASK:Gl(o),ZERO:ii,ONE:Kn,create:h=>Ri(h,t),isValid:h=>{if(typeof h!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof h);return ii<=h&&hh===ii,isValidNot0:h=>!u.is0(h)&&u.isValid(h),isOdd:h=>(h&Kn)===Kn,neg:h=>Ri(-h,t),eql:(h,g)=>h===g,sqr:h=>Ri(h*h,t),add:(h,g)=>Ri(h+g,t),sub:(h,g)=>Ri(h-g,t),mul:(h,g)=>Ri(h*g,t),pow:(h,g)=>zM(u,h,g),div:(h,g)=>Ri(h*Ow(g,t),t),sqrN:h=>h*h,addN:(h,g)=>h+g,subN:(h,g)=>h-g,mulN:(h,g)=>h*g,inv:h=>Ow(h,t),sqrt:s||(h=>(f||(f=UM(t)),f(u,h))),toBytes:h=>r?bw(h,a):Cp(h,a),fromBytes:h=>{if(h.length!==a)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+h.length);return r?vw(h):Vl(h)},invertBatch:h=>Lw(u,h),cmov:(h,g,b)=>b?g:h});return Object.freeze(u)}function Bw(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function Fw(t){const e=Bw(t);return e+Math.ceil(e/2)}function WM(t,e,r=!1){const n=t.length,i=Bw(e),s=Fw(e);if(n<16||n1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);const o=r?vw(t):Vl(t),a=Ri(o,e-Kn)+Kn;return r?bw(a,i):Cp(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const gc=BigInt(0),fa=BigInt(1);function Uu(t,e){const r=e.negate();return t?r:e}function KM(t,e,r){const n=o=>o.pz,i=Lw(t.Fp,r.map(n));return r.map((o,a)=>o.toAffine(i[a])).map(t.fromAffine)}function jw(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function Bp(t,e){jw(t,e);const r=Math.ceil(e/t)+1,n=2**(t-1),i=2**t,s=Gl(t),o=BigInt(t);return{windows:r,windowSize:n,mask:s,maxNumber:i,shiftBy:o}}function Uw(t,e,r){const{windowSize:n,mask:i,maxNumber:s,shiftBy:o}=r;let a=Number(t&i),f=t>>o;a>n&&(a-=s,f+=fa);const u=e*n,h=u+Math.abs(a)-1,g=a===0,b=a<0,x=e%2!==0;return{nextN:f,offset:h,isZero:g,isNeg:b,isNegF:x,offsetF:u}}function VM(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function GM(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}const Fp=new WeakMap,$w=new WeakMap;function jp(t){return $w.get(t)||1}function qw(t){if(t!==gc)throw new Error("invalid wNAF")}function YM(t,e){return{constTimeNegate:Uu,hasPrecomputes(r){return jp(r)!==1},unsafeLadder(r,n,i=t.ZERO){let s=r;for(;n>gc;)n&fa&&(i=i.add(s)),s=s.double(),n>>=fa;return i},precomputeWindow(r,n){const{windows:i,windowSize:s}=Bp(n,e),o=[];let a=r,f=a;for(let u=0;ugc||n>gc;)r&fa&&(s=s.add(i)),n&fa&&(o=o.add(i)),i=i.double(),r>>=fa,n>>=fa;return{p1:s,p2:o}}function XM(t,e,r,n){VM(r,t),GM(n,e);const i=r.length,s=n.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");const o=t.ZERO,a=uM(BigInt(i));let f=1;a>12?f=a-3:a>4?f=a-2:a>0&&(f=2);const u=Gl(f),h=new Array(Number(u)+1).fill(o),g=Math.floor((e.BITS-1)/f)*f;let b=o;for(let x=g;x>=0;x-=f){h.fill(o);for(let C=0;C>BigInt(x)&u);h[B]=h[B].add(r[C])}let S=o;for(let C=h.length-1,D=o;C>0;C--)D=D.add(h[C]),S=S.add(D);if(b=b.add(S),x!==0)for(let C=0;Cgc))throw new Error(`CURVE.${a} must be positive bigint`)}const n=zw(e.p,r.Fp),i=zw(e.n,r.Fn),o=["Gx","Gy","a","b"];for(const a of o)if(!n.isValid(e[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return{Fp:n,Fn:i}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Hw(t){t.lowS!==void 0&&Wl("lowS",t.lowS),t.prehash!==void 0&&Wl("prehash",t.prehash)}class QM extends Error{constructor(e=""){super(e)}}const zs={Err:QM,_tlv:{encode:(t,e)=>{const{Err:r}=zs;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=Kl(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?Kl(i.length/2|128):"";return Kl(t)+s+i+e},decode(t,e){const{Err:r}=zs;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const f=i&127;if(!f)throw new r("tlv.decode(long): indefinite length not supported");if(f>4)throw new r("tlv.decode(long): byte length is too big");const u=e.subarray(n,n+f);if(u.length!==f)throw new r("tlv.decode: length bytes not complete");if(u[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const h of u)o=o<<8|h;if(n+=f,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=zs;if(t<$u)throw new e("integer: negative integers are not allowed");let r=Kl(t);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return r},decode(t){const{Err:e}=zs;if(t[0]&128)throw new e("invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return Vl(t)}},toSig(t){const{Err:e,_int:r,_tlv:n}=zs,i=Ci("signature",t),{v:s,l:o}=n.decode(48,i);if(o.length)throw new e("invalid signature: left bytes after parsing");const{v:a,l:f}=n.decode(2,s),{v:u,l:h}=n.decode(2,f);if(h.length)throw new e("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(u)}},hexFromSig(t){const{_tlv:e,_int:r}=zs,n=e.encode(2,r.encode(t.r)),i=e.encode(2,r.encode(t.s)),s=n+i;return e.encode(48,s)}},$u=BigInt(0),qu=BigInt(1),eC=BigInt(2),rh=BigInt(3),tC=BigInt(4);function rC(t,e,r){function n(i){const s=t.sqr(i),o=t.mul(s,i);return t.add(t.add(o,t.mul(i,e)),r)}return n}function Ww(t,e,r){const{BYTES:n}=t;function i(s){let o;if(typeof s=="bigint")o=s;else{let a=Ci("private key",s);if(e){if(!e.includes(a.length*2))throw new Error("invalid private key");const f=new Uint8Array(n);f.set(a,f.length-a.length),a=f}try{o=t.fromBytes(a)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof s}`)}}if(r&&(o=t.create(o)),!t.isValidNot0(o))throw new Error("invalid private key: out of range [1..N-1]");return o}return i}function nC(t,e={}){const{Fp:r,Fn:n}=ZM("weierstrass",t,e),{h:i,n:s}=t;Tp(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:o}=e;if(o&&(!r.is0(t.a)||typeof o.beta!="bigint"||typeof o.splitScalar!="function"))throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function');function a(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function f(W,V,X){const{x:q,y:_}=V.toAffine(),v=r.toBytes(q);if(Wl("isCompressed",X),X){a();const l=!r.isOdd(_);return ia(Kw(l),v)}else return ia(Uint8Array.of(4),v,r.toBytes(_))}function u(W){es(W);const V=r.BYTES,X=V+1,q=2*V+1,_=W.length,v=W[0],l=W.subarray(1);if(_===X&&(v===2||v===3)){const p=r.fromBytes(l);if(!r.isValid(p))throw new Error("bad point: is not on curve, wrong x");const m=b(p);let y;try{y=r.sqrt(m)}catch(w){const I=w instanceof Error?": "+w.message:"";throw new Error("bad point: is not on curve, sqrt error"+I)}a();const A=r.isOdd(y);return(v&1)===1!==A&&(y=r.neg(y)),{x:p,y}}else if(_===q&&v===4){const p=r.fromBytes(l.subarray(V*0,V*1)),m=r.fromBytes(l.subarray(V*1,V*2));if(!x(p,m))throw new Error("bad point: is not on curve");return{x:p,y:m}}else throw new Error(`bad point: got length ${_}, expected compressed=${X} or uncompressed=${q}`)}const h=e.toBytes||f,g=e.fromBytes||u,b=rC(r,t.a,t.b);function x(W,V){const X=r.sqr(V),q=b(W);return r.eql(X,q)}if(!x(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const S=r.mul(r.pow(t.a,rh),tC),C=r.mul(r.sqr(t.b),BigInt(27));if(r.is0(r.add(S,C)))throw new Error("bad curve params: a or b");function D(W,V,X=!1){if(!r.isValid(V)||X&&r.is0(V))throw new Error(`bad point coordinate ${W}`);return V}function B(W){if(!(W instanceof k))throw new Error("ProjectivePoint expected")}const L=yw((W,V)=>{const{px:X,py:q,pz:_}=W;if(r.eql(_,r.ONE))return{x:X,y:q};const v=W.is0();V==null&&(V=v?r.ONE:r.inv(_));const l=r.mul(X,V),p=r.mul(q,V),m=r.mul(_,V);if(v)return{x:r.ZERO,y:r.ZERO};if(!r.eql(m,r.ONE))throw new Error("invZ was invalid");return{x:l,y:p}}),H=yw(W=>{if(W.is0()){if(e.allowInfinityPoint&&!r.is0(W.py))return;throw new Error("bad point: ZERO")}const{x:V,y:X}=W.toAffine();if(!r.isValid(V)||!r.isValid(X))throw new Error("bad point: x or y not field elements");if(!x(V,X))throw new Error("bad point: equation left != right");if(!W.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function F(W,V,X,q,_){return X=new k(r.mul(X.px,W),X.py,X.pz),V=Uu(q,V),X=Uu(_,X),V.add(X)}class k{constructor(V,X,q){this.px=D("x",V),this.py=D("y",X,!0),this.pz=D("z",q),Object.freeze(this)}static fromAffine(V){const{x:X,y:q}=V||{};if(!V||!r.isValid(X)||!r.isValid(q))throw new Error("invalid affine point");if(V instanceof k)throw new Error("projective point not allowed");return r.is0(X)&&r.is0(q)?k.ZERO:new k(X,q,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(V){return KM(k,"pz",V)}static fromBytes(V){return es(V),k.fromHex(V)}static fromHex(V){const X=k.fromAffine(g(Ci("pointHex",V)));return X.assertValidity(),X}static fromPrivateKey(V){const X=Ww(n,e.allowedPrivateKeyLengths,e.wrapPrivateKey);return k.BASE.multiply(X(V))}static msm(V,X){return XM(k,n,V,X)}precompute(V=8,X=!0){return R.setWindowSize(this,V),X||this.multiply(rh),this}_setWindowSize(V){this.precompute(V)}assertValidity(){H(this)}hasEvenY(){const{y:V}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(V)}equals(V){B(V);const{px:X,py:q,pz:_}=this,{px:v,py:l,pz:p}=V,m=r.eql(r.mul(X,p),r.mul(v,_)),y=r.eql(r.mul(q,p),r.mul(l,_));return m&&y}negate(){return new k(this.px,r.neg(this.py),this.pz)}double(){const{a:V,b:X}=t,q=r.mul(X,rh),{px:_,py:v,pz:l}=this;let p=r.ZERO,m=r.ZERO,y=r.ZERO,A=r.mul(_,_),E=r.mul(v,v),w=r.mul(l,l),I=r.mul(_,v);return I=r.add(I,I),y=r.mul(_,l),y=r.add(y,y),p=r.mul(V,y),m=r.mul(q,w),m=r.add(p,m),p=r.sub(E,m),m=r.add(E,m),m=r.mul(p,m),p=r.mul(I,p),y=r.mul(q,y),w=r.mul(V,w),I=r.sub(A,w),I=r.mul(V,I),I=r.add(I,y),y=r.add(A,A),A=r.add(y,A),A=r.add(A,w),A=r.mul(A,I),m=r.add(m,A),w=r.mul(v,l),w=r.add(w,w),A=r.mul(w,I),p=r.sub(p,A),y=r.mul(w,E),y=r.add(y,y),y=r.add(y,y),new k(p,m,y)}add(V){B(V);const{px:X,py:q,pz:_}=this,{px:v,py:l,pz:p}=V;let m=r.ZERO,y=r.ZERO,A=r.ZERO;const E=t.a,w=r.mul(t.b,rh);let I=r.mul(X,v),M=r.mul(q,l),z=r.mul(_,p),se=r.add(X,q),O=r.add(v,l);se=r.mul(se,O),O=r.add(I,M),se=r.sub(se,O),O=r.add(X,_);let ie=r.add(v,p);return O=r.mul(O,ie),ie=r.add(I,z),O=r.sub(O,ie),ie=r.add(q,_),m=r.add(l,p),ie=r.mul(ie,m),m=r.add(M,z),ie=r.sub(ie,m),A=r.mul(E,O),m=r.mul(w,z),A=r.add(m,A),m=r.sub(M,A),A=r.add(M,A),y=r.mul(m,A),M=r.add(I,I),M=r.add(M,I),z=r.mul(E,z),O=r.mul(w,O),M=r.add(M,z),z=r.sub(I,z),z=r.mul(E,z),O=r.add(O,z),I=r.mul(M,O),y=r.add(y,I),I=r.mul(ie,O),m=r.mul(se,m),m=r.sub(m,I),I=r.mul(se,M),A=r.mul(ie,A),A=r.add(A,I),new k(m,y,A)}subtract(V){return this.add(V.negate())}is0(){return this.equals(k.ZERO)}multiply(V){const{endo:X}=e;if(!n.isValidNot0(V))throw new Error("invalid scalar: out of range");let q,_;const v=l=>R.wNAFCached(this,l,k.normalizeZ);if(X){const{k1neg:l,k1:p,k2neg:m,k2:y}=X.splitScalar(V),{p:A,f:E}=v(p),{p:w,f:I}=v(y);_=E.add(I),q=F(X.beta,A,w,l,m)}else{const{p:l,f:p}=v(V);q=l,_=p}return k.normalizeZ([q,_])[0]}multiplyUnsafe(V){const{endo:X}=e,q=this;if(!n.isValid(V))throw new Error("invalid scalar: out of range");if(V===$u||q.is0())return k.ZERO;if(V===qu)return q;if(R.hasPrecomputes(this))return this.multiply(V);if(X){const{k1neg:_,k1:v,k2neg:l,k2:p}=X.splitScalar(V),{p1:m,p2:y}=JM(k,q,v,p);return F(X.beta,m,y,_,l)}else return R.wNAFCachedUnsafe(q,V)}multiplyAndAddUnsafe(V,X,q){const _=this.multiplyUnsafe(X).add(V.multiplyUnsafe(q));return _.is0()?void 0:_}toAffine(V){return L(this,V)}isTorsionFree(){const{isTorsionFree:V}=e;return i===qu?!0:V?V(k,this):R.wNAFCachedUnsafe(this,s).is0()}clearCofactor(){const{clearCofactor:V}=e;return i===qu?this:V?V(k,this):this.multiplyUnsafe(i)}toBytes(V=!0){return Wl("isCompressed",V),this.assertValidity(),h(k,this,V)}toRawBytes(V=!0){return this.toBytes(V)}toHex(V=!0){return cc(this.toBytes(V))}toString(){return``}}k.BASE=new k(t.Gx,t.Gy,r.ONE),k.ZERO=new k(r.ZERO,r.ONE,r.ZERO),k.Fp=r,k.Fn=n;const $=n.BITS,R=YM(k,e.endo?Math.ceil($/2):$);return k}function Kw(t){return Uint8Array.of(t?2:3)}function iC(t,e,r={}){Tp(e,{hash:"function"},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const n=e.randomBytes||pP,i=e.hmac||((q,..._)=>Cw(e.hash,q,ia(..._))),{Fp:s,Fn:o}=t,{ORDER:a,BITS:f}=o;function u(q){const _=a>>qu;return q>_}function h(q){return u(q)?o.neg(q):q}function g(q,_){if(!o.isValidNot0(_))throw new Error(`invalid signature ${q}: out of range 1..CURVE.n`)}class b{constructor(_,v,l){g("r",_),g("s",v),this.r=_,this.s=v,l!=null&&(this.recovery=l),Object.freeze(this)}static fromCompact(_){const v=o.BYTES,l=Ci("compactSignature",_,v*2);return new b(o.fromBytes(l.subarray(0,v)),o.fromBytes(l.subarray(v,v*2)))}static fromDER(_){const{r:v,s:l}=zs.toSig(Ci("DER",_));return new b(v,l)}assertValidity(){}addRecoveryBit(_){return new b(this.r,this.s,_)}recoverPublicKey(_){const v=s.ORDER,{r:l,s:p,recovery:m}=this;if(m==null||![0,1,2,3].includes(m))throw new Error("recovery id invalid");if(a*eC1)throw new Error("recovery id is ambiguous for h>1 curve");const A=m===2||m===3?l+a:l;if(!s.isValid(A))throw new Error("recovery id 2 or 3 invalid");const E=s.toBytes(A),w=t.fromHex(ia(Kw((m&1)===0),E)),I=o.inv(A),M=H(Ci("msgHash",_)),z=o.create(-M*I),se=o.create(p*I),O=t.BASE.multiplyUnsafe(z).add(w.multiplyUnsafe(se));if(O.is0())throw new Error("point at infinify");return O.assertValidity(),O}hasHighS(){return u(this.s)}normalizeS(){return this.hasHighS()?new b(this.r,o.neg(this.s),this.recovery):this}toBytes(_){if(_==="compact")return ia(o.toBytes(this.r),o.toBytes(this.s));if(_==="der")return ep(zs.hexFromSig(this));throw new Error("invalid format")}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return cc(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return cc(this.toBytes("compact"))}}const x=Ww(o,r.allowedPrivateKeyLengths,r.wrapPrivateKey),S={isValidPrivateKey(q){try{return x(q),!0}catch{return!1}},normPrivateKeyToScalar:x,randomPrivateKey:()=>{const q=a;return WM(n(Fw(q)),q)},precompute(q=8,_=t.BASE){return _.precompute(q,!1)}};function C(q,_=!0){return t.fromPrivateKey(q).toBytes(_)}function D(q){if(typeof q=="bigint")return!1;if(q instanceof t)return!0;const v=Ci("key",q).length,l=s.BYTES,p=l+1,m=2*l+1;if(!(r.allowedPrivateKeyLengths||o.BYTES===p))return v===p||v===m}function B(q,_,v=!0){if(D(q)===!0)throw new Error("first arg must be private key");if(D(_)===!1)throw new Error("second arg must be public key");return t.fromHex(_).multiply(x(q)).toBytes(v)}const L=e.bits2int||function(q){if(q.length>8192)throw new Error("input is too large");const _=Vl(q),v=q.length*8-f;return v>0?_>>BigInt(v):_},H=e.bits2int_modN||function(q){return o.create(L(q))},F=Gl(f);function k(q){return cM("num < 2^"+f,q,$u,F),o.toBytes(q)}function $(q,_,v=R){if(["recovered","canonical"].some(se=>se in v))throw new Error("sign() legacy options not supported");const{hash:l}=e;let{lowS:p,prehash:m,extraEntropy:y}=v;p==null&&(p=!0),q=Ci("msgHash",q),Hw(v),m&&(q=Ci("prehashed msgHash",l(q)));const A=H(q),E=x(_),w=[k(E),k(A)];if(y!=null&&y!==!1){const se=y===!0?n(s.BYTES):y;w.push(Ci("extraEntropy",se))}const I=ia(...w),M=A;function z(se){const O=L(se);if(!o.isValidNot0(O))return;const ie=o.inv(O),ee=t.BASE.multiply(O).toAffine(),Z=o.create(ee.x);if(Z===$u)return;const te=o.create(ie*o.create(M+Z*E));if(te===$u)return;let N=(ee.x===Z?0:2)|Number(ee.y&qu),Q=te;return p&&u(te)&&(Q=h(te),N^=1),new b(Z,Q,N)}return{seed:I,k2sig:z}}const R={lowS:e.lowS,prehash:!1},W={lowS:e.lowS,prehash:!1};function V(q,_,v=R){const{seed:l,k2sig:p}=$(q,_,v);return fM(e.hash.outputLen,o.BYTES,i)(l,p)}t.BASE.precompute(8);function X(q,_,v,l=W){const p=q;_=Ci("msgHash",_),v=Ci("publicKey",v),Hw(l);const{lowS:m,prehash:y,format:A}=l;if("strict"in l)throw new Error("options.strict was renamed to lowS");if(A!==void 0&&!["compact","der","js"].includes(A))throw new Error('format must be "compact", "der" or "js"');const E=typeof p=="string"||Z0(p),w=!E&&!A&&typeof p=="object"&&p!==null&&typeof p.r=="bigint"&&typeof p.s=="bigint";if(!E&&!w)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let I,M;try{if(w)if(A===void 0||A==="js")I=new b(p.r,p.s);else throw new Error("invalid format");if(E){try{A!=="compact"&&(I=b.fromDER(p))}catch(Q){if(!(Q instanceof zs.Err))throw Q}!I&&A!=="der"&&(I=b.fromCompact(p))}M=t.fromHex(v)}catch{return!1}if(!I||m&&I.hasHighS())return!1;y&&(_=e.hash(_));const{r:z,s:se}=I,O=H(_),ie=o.inv(se),ee=o.create(O*ie),Z=o.create(z*ie),te=t.BASE.multiplyUnsafe(ee).add(M.multiplyUnsafe(Z));return te.is0()?!1:o.create(te.x)===z}return Object.freeze({getPublicKey:C,getSharedSecret:B,sign:V,verify:X,utils:S,Point:t,Signature:b})}function sC(t){const e={a:t.a,b:t.b,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r=t.Fp,n=th(e.n,t.nBitLength),i={Fp:r,Fn:n,allowedPrivateKeyLengths:t.allowedPrivateKeyLengths,allowInfinityPoint:t.allowInfinityPoint,endo:t.endo,wrapPrivateKey:t.wrapPrivateKey,isTorsionFree:t.isTorsionFree,clearCofactor:t.clearCofactor,fromBytes:t.fromBytes,toBytes:t.toBytes};return{CURVE:e,curveOpts:i}}function oC(t){const{CURVE:e,curveOpts:r}=sC(t),n={hash:t.hash,hmac:t.hmac,randomBytes:t.randomBytes,lowS:t.lowS,bits2int:t.bits2int,bits2int_modN:t.bits2int_modN};return{CURVE:e,curveOpts:r,ecdsaOpts:n}}function aC(t,e){return Object.assign({},e,{ProjectivePoint:e.Point,CURVE:t})}function cC(t){const{CURVE:e,curveOpts:r,ecdsaOpts:n}=oC(t),i=nC(e,r),s=iC(i,n,r);return aC(t,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function uC(t,e){const r=n=>cC({...t,hash:n});return{...r(e),create:r}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const nh={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")};BigInt(0);const fC=BigInt(1),Up=BigInt(2),Vw=(t,e)=>(t+e/Up)/e;function lC(t){const e=nh.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),f=BigInt(88),u=t*t*t%e,h=u*u*t%e,g=Ti(h,r,e)*h%e,b=Ti(g,r,e)*h%e,x=Ti(b,Up,e)*u%e,S=Ti(x,i,e)*x%e,C=Ti(S,s,e)*S%e,D=Ti(C,a,e)*C%e,B=Ti(D,f,e)*D%e,L=Ti(B,a,e)*C%e,H=Ti(L,r,e)*h%e,F=Ti(H,o,e)*S%e,k=Ti(F,n,e)*u%e,$=Ti(k,Up,e);if(!$p.eql($p.sqr($),t))throw new Error("Cannot find square root");return $}const $p=th(nh.p,void 0,void 0,{sqrt:lC}),hC=uC({...nh,Fp:$p,lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=nh.n,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-fC*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=Vw(s*t,e),f=Vw(-n*t,e);let u=Ri(t-a*r-f*i,e),h=Ri(-a*n-f*s,e);const g=u>o,b=h>o;if(g&&(u=e-u),b&&(h=e-h),u>o||h>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:g,k1:u,k2neg:b,k2:h}}}},cw),dC=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:hC},Symbol.toStringTag,{value:"Module"}));async function pC(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:pr(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}function gC(t,e){const{abi:r,args:n,bytecode:i,...s}=e,o=dM({abi:r,args:n,bytecode:i});return Jl(t,{...s,...s.authorizationList?{to:null}:{},data:o})}async function mC(t){return t.account?.type==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(r=>bu(r))}async function vC(t,e={}){const{account:r=t.account,chainId:n}=e,i=r?ri(r):void 0,s=n?[i?.address,[pr(n)]]:[i?.address],o=await t.request({method:"wallet_getCapabilities",params:s}),a={};for(const[f,u]of Object.entries(o)){a[Number(f)]={};for(let[h,g]of Object.entries(u))h==="addSubAccount"&&(h="unstable_addSubAccount"),a[Number(f)][h]=g}return typeof n=="number"?a[n]:a}async function bC(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}async function Gw(t,e){const{account:r=t.account,chainId:n,nonce:i}=e;if(!r)throw new ca({docsPath:"/docs/eip7702/prepareAuthorization"});const s=ri(r),o=(()=>{if(e.executor)return e.executor==="self"?e.executor:ri(e.executor)})(),a={address:e.contractAddress??e.address,chainId:n,nonce:i};return typeof a.chainId>"u"&&(a.chainId=t.chain?.id??await Fn(t,ju,"getChainId")({})),typeof a.nonce>"u"&&(a.nonce=await Fn(t,sw,"getTransactionCount")({address:s.address,blockTag:"pending"}),(o==="self"||o?.address&&oM(o.address,s.address))&&(a.nonce+=1)),a}async function yC(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>ip(r))}async function wC(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function xC(t,e){const{id:r}=e;await t.request({method:"wallet_showCallsStatus",params:[r]})}async function _C(t,e){const{account:r=t.account}=e;if(!r)throw new ca({docsPath:"/docs/eip7702/signAuthorization"});const n=ri(r);if(!n.signAuthorization)throw new Yl({docsPath:"/docs/eip7702/signAuthorization",metaMessages:["The `signAuthorization` Action does not support JSON-RPC Accounts."],type:n.type});const i=await Gw(t,e);return n.signAuthorization(i)}async function EC(t,{account:e=t.account,message:r}){if(!e)throw new ca({docsPath:"/docs/actions/wallet/signMessage"});const n=ri(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Ol(r):r.raw instanceof Uint8Array?Dl(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function SC(t,e){const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new ca({docsPath:"/docs/actions/wallet/signTransaction"});const s=ri(r);zl({account:s,...e});const o=await Fn(t,ju,"getChainId")({});n!==null&&xw({currentChainId:o,chain:n});const f=(n?.formatters||t.chain?.formatters)?.transactionRequest?.format||Ep;return s.signTransaction?s.signTransaction({...i,chainId:o},{serializer:t.chain?.serializers?.transaction}):await t.request({method:"eth_signTransaction",params:[{...f(i),chainId:pr(o),from:s.address}]},{retryCount:0})}async function AC(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new ca({docsPath:"/docs/actions/wallet/signTypedData"});const o=ri(r),a={EIP712Domain:LM({domain:n}),...e.types};if(NM({domain:n,message:i,primaryType:s,types:a}),o.signTypedData)return o.signTypedData({domain:n,message:i,primaryType:s,types:a});const f=OM({domain:n,message:i,primaryType:s,types:a});return t.request({method:"eth_signTypedData_v4",params:[o.address,f]},{retryCount:0})}async function PC(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:pr(e)}]},{retryCount:0})}async function IC(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}function MC(t){return{addChain:e=>pC(t,e),deployContract:e=>gC(t,e),getAddresses:()=>mC(t),getCallsStatus:e=>Pw(t,e),getCapabilities:e=>vC(t,e),getChainId:()=>ju(t),getPermissions:()=>bC(t),prepareAuthorization:e=>Gw(t,e),prepareTransactionRequest:e=>Pp(t,e),requestAddresses:()=>yC(t),requestPermissions:e=>wC(t,e),sendCalls:e=>wM(t,e),sendRawTransaction:e=>Ew(t,e),sendTransaction:e=>Jl(t,e),showCallsStatus:e=>xC(t,e),signAuthorization:e=>_C(t,e),signMessage:e=>EC(t,e),signTransaction:e=>SC(t,e),signTypedData:e=>AC(t,e),switchChain:e=>PC(t,e),waitForCallsStatus:e=>xM(t,e),watchAsset:e=>IC(t,e),writeContract:e=>bM(t,e)}}function ih(t){const{key:e="wallet",name:r="Wallet Client",transport:n}=t;return EM({...t,key:e,name:r,transport:n,type:"walletClient"}).extend(MC)}class la{_key;_config=null;_provider=null;_connected=!1;_address=null;_fatured=!1;_installed=!1;lastUsed=!1;_client=null;get address(){return this._address}get connected(){return this._connected}get featured(){return this._fatured}get key(){return this._key}get installed(){return this._installed}get provider(){return this._provider}get client(){return this._client?this._client:null}get config(){return this._config}static fromWalletConfig(e){return new la(e)}constructor(e){if("name"in e&&"image"in e)this._key=e.name,this._config=e,this._fatured=e.featured;else if("session"in e){if(!e.session)throw new Error("session is null");this._key=e.session?.peer.metadata.name,this._provider=e,this._client=ih({transport:eh(this._provider)}),this._config={name:e.session.peer.metadata.name,image:e.session.peer.metadata.icons[0],featured:!1},this.testConnect()}else if("info"in e)this._key=e.info.name,this._provider=e.provider,this._installed=!0,this._client=ih({transport:eh(this._provider)}),this._config={name:e.info.name,image:e.info.icon,featured:!1},this.testConnect();else throw new Error("unknown params")}EIP6963Detected(e){this._provider=e.provider,this._client=ih({transport:eh(this._provider)}),this._installed=!0,this._provider.on("disconnect",this.disconnect),this._provider.on("accountsChanged",r=>{this._address=r[0],this._connected=!0}),this.testConnect()}setUniversalProvider(e){this._provider=e,this._client=ih({transport:eh(this._provider)}),this.testConnect()}async switchChain(e){try{return await this.client?.getChainId()===e.id||await this.client?.switchChain(e),!0}catch(r){if(r.code===4902)return await this.client?.addChain({chain:e}),await this.client?.switchChain(e),!0;throw r}}async testConnect(){const e=await this.client?.getAddresses();e&&e.length>0?(this._address=e[0],this._connected=!0):(this._address=null,this._connected=!1)}async connect(){const e=await this.client?.requestAddresses();if(!e)throw new Error("connect failed");return e}async getAddress(){const e=await this.client?.getAddresses();if(!e)throw new Error("get address failed");return e[0]}async getChain(){const e=await this.client?.getChainId();if(!e)throw new Error("get chain failed");return e}async signMessage(e,r){return await this.client?.signMessage({message:e,account:r})}async disconnect(){this._provider&&"session"in this._provider&&await this._provider.disconnect(),this._connected=!1,this._address=null}}var sh={exports:{}},Yw;function CC(){if(Yw)return sh.exports;Yw=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(k,$,R){return Function.prototype.apply.call(k,$,R)},r;t&&typeof t.ownKeys=="function"?r=t.ownKeys:Object.getOwnPropertySymbols?r=function(k){return Object.getOwnPropertyNames(k).concat(Object.getOwnPropertySymbols(k))}:r=function(k){return Object.getOwnPropertyNames(k)};function n(F){console&&console.warn&&console.warn(F)}var i=Number.isNaN||function(k){return k!==k};function s(){s.init.call(this)}sh.exports=s,sh.exports.once=B,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(F){if(typeof F!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof F)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(F){if(typeof F!="number"||F<0||i(F))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+F+".");o=F}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(k){if(typeof k!="number"||k<0||i(k))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+k+".");return this._maxListeners=k,this};function f(F){return F._maxListeners===void 0?s.defaultMaxListeners:F._maxListeners}s.prototype.getMaxListeners=function(){return f(this)},s.prototype.emit=function(k){for(var $=[],R=1;R0&&(X=$[0]),X instanceof Error)throw X;var q=new Error("Unhandled error."+(X?" ("+X.message+")":""));throw q.context=X,q}var _=V[k];if(_===void 0)return!1;if(typeof _=="function")e(_,this,$);else for(var v=_.length,l=S(_,v),R=0;R0&&X.length>W&&!X.warned){X.warned=!0;var q=new Error("Possible EventEmitter memory leak detected. "+X.length+" "+String(k)+" listeners added. Use emitter.setMaxListeners() to increase limit");q.name="MaxListenersExceededWarning",q.emitter=F,q.type=k,q.count=X.length,n(q)}return F}s.prototype.addListener=function(k,$){return u(this,k,$,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(k,$){return u(this,k,$,!0)};function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function g(F,k,$){var R={fired:!1,wrapFn:void 0,target:F,type:k,listener:$},W=h.bind(R);return W.listener=$,R.wrapFn=W,W}s.prototype.once=function(k,$){return a($),this.on(k,g(this,k,$)),this},s.prototype.prependOnceListener=function(k,$){return a($),this.prependListener(k,g(this,k,$)),this},s.prototype.removeListener=function(k,$){var R,W,V,X,q;if(a($),W=this._events,W===void 0)return this;if(R=W[k],R===void 0)return this;if(R===$||R.listener===$)--this._eventsCount===0?this._events=Object.create(null):(delete W[k],W.removeListener&&this.emit("removeListener",k,R.listener||$));else if(typeof R!="function"){for(V=-1,X=R.length-1;X>=0;X--)if(R[X]===$||R[X].listener===$){q=R[X].listener,V=X;break}if(V<0)return this;V===0?R.shift():C(R,V),R.length===1&&(W[k]=R[0]),W.removeListener!==void 0&&this.emit("removeListener",k,q||$)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(k){var $,R,W;if(R=this._events,R===void 0)return this;if(R.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):R[k]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete R[k]),this;if(arguments.length===0){var V=Object.keys(R),X;for(W=0;W=0;W--)this.removeListener(k,$[W]);return this};function b(F,k,$){var R=F._events;if(R===void 0)return[];var W=R[k];return W===void 0?[]:typeof W=="function"?$?[W.listener||W]:[W]:$?D(W):S(W,W.length)}s.prototype.listeners=function(k){return b(this,k,!0)},s.prototype.rawListeners=function(k){return b(this,k,!1)},s.listenerCount=function(F,k){return typeof F.listenerCount=="function"?F.listenerCount(k):x.call(F,k)},s.prototype.listenerCount=x;function x(F){var k=this._events;if(k!==void 0){var $=k[F];if(typeof $=="function")return 1;if($!==void 0)return $.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function S(F,k){for(var $=new Array(k),R=0;R=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function jT(t,e){return function(r,n){e(r,n,t)}}function UT(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function qT(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(d){try{l(n.next(d))}catch(p){o(p)}}function u(d){try{l(n.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):i(d.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function zT(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return u([l,d])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ix(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function KT(){for(var t=[],e=0;e1||a(y,_)})})}function a(y,_){try{u(n[y](_))}catch(M){p(s[0][3],M)}}function u(y){y.value instanceof Yf?Promise.resolve(y.value.v).then(l,d):p(s[0][2],y)}function l(y){a("next",y)}function d(y){a("throw",y)}function p(y,_){y(_),s.shift(),s.length&&a(s[0][0],s[0][1])}}function YT(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Yf(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function JT(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof am=="function"?am(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function XT(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function ZT(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function QT(t){return t&&t.__esModule?t:{default:t}}function eR(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function tR(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const Jf=cg(Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return om},__asyncDelegator:YT,__asyncGenerator:GT,__asyncValues:JT,__await:Yf,__awaiter:qT,__classPrivateFieldGet:eR,__classPrivateFieldSet:tR,__createBinding:HT,__decorate:FT,__exportStar:WT,__extends:BT,__generator:zT,__importDefault:QT,__importStar:ZT,__makeTemplateObject:XT,__metadata:UT,__param:jT,__read:ix,__rest:$T,__spread:KT,__spreadArrays:VT,__values:am},Symbol.toStringTag,{value:"Module"})));var cm={},Xf={},sx;function rR(){if(sx)return Xf;sx=1,Object.defineProperty(Xf,"__esModule",{value:!0}),Xf.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Xf.delay=t,Xf}var Ya={},um={},Ja={},ox;function nR(){return ox||(ox=1,Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.ONE_THOUSAND=Ja.ONE_HUNDRED=void 0,Ja.ONE_HUNDRED=100,Ja.ONE_THOUSAND=1e3),Ja}var fm={},ax;function iR(){return ax||(ax=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(fm)),fm}var cx;function ux(){return cx||(cx=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Jf;e.__exportStar(nR(),t),e.__exportStar(iR(),t)}(um)),um}var fx;function sR(){if(fx)return Ya;fx=1,Object.defineProperty(Ya,"__esModule",{value:!0}),Ya.fromMiliseconds=Ya.toMiliseconds=void 0;const t=ux();function e(n){return n*t.ONE_THOUSAND}Ya.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return Ya.fromMiliseconds=r,Ya}var lx;function oR(){return lx||(lx=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Jf;e.__exportStar(rR(),t),e.__exportStar(sR(),t)}(cm)),cm}var iu={},hx;function aR(){if(hx)return iu;hx=1,Object.defineProperty(iu,"__esModule",{value:!0}),iu.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return iu.Watch=t,iu.default=t,iu}var lm={},Zf={},dx;function cR(){if(dx)return Zf;dx=1,Object.defineProperty(Zf,"__esModule",{value:!0}),Zf.IWatch=void 0;class t{}return Zf.IWatch=t,Zf}var px;function uR(){return px||(px=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Jf.__exportStar(cR(),t)}(lm)),lm}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Jf;e.__exportStar(oR(),t),e.__exportStar(aR(),t),e.__exportStar(uR(),t),e.__exportStar(ux(),t)})(vt);class Xa{}let fR=class extends Xa{constructor(e){super()}};const gx=vt.FIVE_SECONDS,su={pulse:"heartbeat_pulse"};let lR=class EP extends fR{constructor(e){super(e),this.events=new Hi.EventEmitter,this.interval=gx,this.interval=(e==null?void 0:e.interval)||gx}static async init(e){const r=new EP(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),vt.toMiliseconds(this.interval))}pulse(){this.events.emit(su.pulse)}};const hR=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,dR=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,pR=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function gR(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){mR(t);return}return e}function mR(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function fd(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!pR.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(hR.test(t)||dR.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,gR)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function vR(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Mn(t,...e){try{return vR(t(...e))}catch(r){return Promise.reject(r)}}function bR(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function yR(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function ld(t){if(bR(t))return String(t);if(yR(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return ld(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function mx(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const hm="base64:";function wR(t){if(typeof t=="string")return t;mx();const e=Buffer.from(t).toString("base64");return hm+e}function xR(t){return typeof t!="string"||!t.startsWith(hm)?t:(mx(),Buffer.from(t.slice(hm.length),"base64"))}function di(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function _R(...t){return di(t.join(":"))}function hd(t){return t=di(t),t?t+":":""}function Goe(t){return t}const ER="memory",SR=()=>{const t=new Map;return{name:ER,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function AR(t={}){const e={mounts:{"":t.driver||SR()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const d of e.mountpoints)if(l.startsWith(d))return{base:d,relativeKey:l.slice(d.length),driver:e.mounts[d]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,d)=>e.mountpoints.filter(p=>p.startsWith(l)||d&&l.startsWith(p)).map(p=>({relativeBase:l.length>p.length?l.slice(p.length):void 0,mountpoint:p,driver:e.mounts[p]})),i=(l,d)=>{if(e.watching){d=di(d);for(const p of e.watchListeners)p(l,d)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await vx(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,d,p)=>{const y=new Map,_=M=>{let O=y.get(M.base);return O||(O={driver:M.driver,base:M.base,items:[]},y.set(M.base,O)),O};for(const M of l){const O=typeof M=="string",L=di(O?M:M.key),B=O?void 0:M.value,k=O||!M.options?d:{...d,...M.options},H=r(L);_(H).items.push({key:L,value:B,relativeKey:H.relativeKey,options:k})}return Promise.all([...y.values()].map(M=>p(M))).then(M=>M.flat())},u={hasItem(l,d={}){l=di(l);const{relativeKey:p,driver:y}=r(l);return Mn(y.hasItem,p,d)},getItem(l,d={}){l=di(l);const{relativeKey:p,driver:y}=r(l);return Mn(y.getItem,p,d).then(_=>fd(_))},getItems(l,d){return a(l,d,p=>p.driver.getItems?Mn(p.driver.getItems,p.items.map(y=>({key:y.relativeKey,options:y.options})),d).then(y=>y.map(_=>({key:_R(p.base,_.key),value:fd(_.value)}))):Promise.all(p.items.map(y=>Mn(p.driver.getItem,y.relativeKey,y.options).then(_=>({key:y.key,value:fd(_)})))))},getItemRaw(l,d={}){l=di(l);const{relativeKey:p,driver:y}=r(l);return y.getItemRaw?Mn(y.getItemRaw,p,d):Mn(y.getItem,p,d).then(_=>xR(_))},async setItem(l,d,p={}){if(d===void 0)return u.removeItem(l);l=di(l);const{relativeKey:y,driver:_}=r(l);_.setItem&&(await Mn(_.setItem,y,ld(d),p),_.watch||i("update",l))},async setItems(l,d){await a(l,d,async p=>{if(p.driver.setItems)return Mn(p.driver.setItems,p.items.map(y=>({key:y.relativeKey,value:ld(y.value),options:y.options})),d);p.driver.setItem&&await Promise.all(p.items.map(y=>Mn(p.driver.setItem,y.relativeKey,ld(y.value),y.options)))})},async setItemRaw(l,d,p={}){if(d===void 0)return u.removeItem(l,p);l=di(l);const{relativeKey:y,driver:_}=r(l);if(_.setItemRaw)await Mn(_.setItemRaw,y,d,p);else if(_.setItem)await Mn(_.setItem,y,wR(d),p);else return;_.watch||i("update",l)},async removeItem(l,d={}){typeof d=="boolean"&&(d={removeMeta:d}),l=di(l);const{relativeKey:p,driver:y}=r(l);y.removeItem&&(await Mn(y.removeItem,p,d),(d.removeMeta||d.removeMata)&&await Mn(y.removeItem,p+"$",d),y.watch||i("remove",l))},async getMeta(l,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),l=di(l);const{relativeKey:p,driver:y}=r(l),_=Object.create(null);if(y.getMeta&&Object.assign(_,await Mn(y.getMeta,p,d)),!d.nativeOnly){const M=await Mn(y.getItem,p+"$",d).then(O=>fd(O));M&&typeof M=="object"&&(typeof M.atime=="string"&&(M.atime=new Date(M.atime)),typeof M.mtime=="string"&&(M.mtime=new Date(M.mtime)),Object.assign(_,M))}return _},setMeta(l,d,p={}){return this.setItem(l+"$",d,p)},removeMeta(l,d={}){return this.removeItem(l+"$",d)},async getKeys(l,d={}){l=hd(l);const p=n(l,!0);let y=[];const _=[];for(const M of p){const O=await Mn(M.driver.getKeys,M.relativeBase,d);for(const L of O){const B=M.mountpoint+di(L);y.some(k=>B.startsWith(k))||_.push(B)}y=[M.mountpoint,...y.filter(L=>!L.startsWith(M.mountpoint))]}return l?_.filter(M=>M.startsWith(l)&&M[M.length-1]!=="$"):_.filter(M=>M[M.length-1]!=="$")},async clear(l,d={}){l=hd(l),await Promise.all(n(l,!1).map(async p=>{if(p.driver.clear)return Mn(p.driver.clear,p.relativeBase,d);if(p.driver.removeItem){const y=await p.driver.getKeys(p.relativeBase||"",d);return Promise.all(y.map(_=>p.driver.removeItem(_,d)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>bx(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(d=>d!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,d){if(l=hd(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((p,y)=>y.length-p.length)),e.mounts[l]=d,e.watching&&Promise.resolve(vx(d,i,l)).then(p=>{e.unwatch[l]=p}).catch(console.error),u},async unmount(l,d=!0){l=hd(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),d&&await bx(e.mounts[l]),e.mountpoints=e.mountpoints.filter(p=>p!==l),delete e.mounts[l])},getMount(l=""){l=di(l)+":";const d=r(l);return{driver:d.driver,base:d.base}},getMounts(l="",d={}){return l=di(l),n(l,d.parents).map(y=>({driver:y.driver,base:y.mountpoint}))},keys:(l,d={})=>u.getKeys(l,d),get:(l,d={})=>u.getItem(l,d),set:(l,d,p={})=>u.setItem(l,d,p),has:(l,d={})=>u.hasItem(l,d),del:(l,d={})=>u.removeItem(l,d),remove:(l,d={})=>u.removeItem(l,d)};return u}function vx(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function bx(t){typeof t.dispose=="function"&&await Mn(t.dispose)}function Za(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function yx(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Za(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let dm;function Qf(){return dm||(dm=yx("keyval-store","keyval")),dm}function wx(t,e=Qf()){return e("readonly",r=>Za(r.get(t)))}function PR(t,e,r=Qf()){return r("readwrite",n=>(n.put(e,t),Za(n.transaction)))}function MR(t,e=Qf()){return e("readwrite",r=>(r.delete(t),Za(r.transaction)))}function IR(t=Qf()){return t("readwrite",e=>(e.clear(),Za(e.transaction)))}function CR(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Za(t.transaction)}function TR(t=Qf()){return t("readonly",e=>{if(e.getAllKeys)return Za(e.getAllKeys());const r=[];return CR(e,n=>r.push(n.key)).then(()=>r)})}const RR=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),DR=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Qa(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return DR(t)}catch{return t}}function mo(t){return typeof t=="string"?t:RR(t)||""}const OR="idb-keyval";var NR=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=yx(t.dbName,t.storeName)),{name:OR,options:t,async hasItem(i){return!(typeof await wx(r(i),n)>"u")},async getItem(i){return await wx(r(i),n)??null},setItem(i,s){return PR(r(i),s,n)},removeItem(i){return MR(r(i),n)},getKeys(){return TR(n)},clear(){return IR(n)}}};const LR="WALLET_CONNECT_V2_INDEXED_DB",kR="keyvaluestorage";let BR=class{constructor(){this.indexedDb=AR({driver:NR({dbName:LR,storeName:kR})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,mo(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var pm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},dd={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof pm<"u"&&pm.localStorage?dd.exports=pm.localStorage:typeof window<"u"&&window.localStorage?dd.exports=window.localStorage:dd.exports=new e})();function $R(t){var e;return[t[0],Qa((e=t[1])!=null?e:"")]}let FR=class{constructor(){this.localStorage=dd.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map($R)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Qa(r)}async setItem(e,r){this.localStorage.setItem(e,mo(r))}async removeItem(e){this.localStorage.removeItem(e)}};const jR="wc_storage_version",xx=1,UR=async(t,e,r)=>{const n=jR,i=await e.getItem(n);if(i&&i>=xx){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,xx),r(e),qR(t,o)},qR=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let zR=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new FR;this.storage=e;try{const r=new BR;UR(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function HR(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var WR=KR;function KR(t,e,r){var n=r&&r.stringify||HR,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?p:0,t.charCodeAt(_+1)){case 100:case 102:if(d>=u||e[d]==null)break;p<_&&(l+=t.slice(p,_)),l+=Number(e[d]),p=_+2,_++;break;case 105:if(d>=u||e[d]==null)break;p<_&&(l+=t.slice(p,_)),l+=Math.floor(Number(e[d])),p=_+2,_++;break;case 79:case 111:case 106:if(d>=u||e[d]===void 0)break;p<_&&(l+=t.slice(p,_));var M=typeof e[d];if(M==="string"){l+="'"+e[d]+"'",p=_+2,_++;break}if(M==="function"){l+=e[d].name||"",p=_+2,_++;break}l+=n(e[d]),p=_+2,_++;break;case 115:if(d>=u)break;p<_&&(l+=t.slice(p,_)),l+=String(e[d]),p=_+2,_++;break;case 37:p<_&&(l+=t.slice(p,_)),l+="%",p=_+2,_++,d--;break}++d}++_}return p===-1?t:(p-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",u=Object.create(r);u.log||(u.log=tl),Object.defineProperty(u,"levelVal",{get:d}),Object.defineProperty(u,"level",{get:p,set:y});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:QR(t)};u.levels=vo.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=tl,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=_,e&&(u._logEvent=gm());function d(){return this.level==="silent"?1/0:this.levels.values[this.level]}function p(){return this._level}function y(M){if(M!=="silent"&&!this.levels.values[M])throw Error("unknown level "+M);this._level=M,au(l,u,"error","log"),au(l,u,"fatal","error"),au(l,u,"warn","error"),au(l,u,"info","log"),au(l,u,"debug","log"),au(l,u,"trace","log")}function _(M,O){if(!M)throw new Error("missing bindings for child Pino");O=O||{},i&&M.serializers&&(O.serializers=M.serializers);const L=O.serializers;if(i&&L){var B=Object.assign({},n,L),k=t.browser.serialize===!0?Object.keys(B):i;delete M.serializers,pd([M],k,B,this._stdErrSerialize)}function H(U){this._childLevel=(U._childLevel|0)+1,this.error=cu(U,M,"error"),this.fatal=cu(U,M,"fatal"),this.warn=cu(U,M,"warn"),this.info=cu(U,M,"info"),this.debug=cu(U,M,"debug"),this.trace=cu(U,M,"trace"),B&&(this.serializers=B,this._serialize=k),e&&(this._logEvent=gm([].concat(U._logEvent.bindings,M)))}return H.prototype=this,new H(this)}return u}vo.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},vo.stdSerializers=VR,vo.stdTimeFunctions=Object.assign({},{nullTime:Ex,epochTime:Sx,unixTime:eD,isoTime:tD});function au(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?tl:i[r]?i[r]:el[r]||el[n]||tl,YR(t,e,r)}function YR(t,e,r){!t.transmit&&e[r]===tl||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===el?el:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function cu(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},Px=class{constructor(e,r=vm){this.level=e??"error",this.levelValue=ou.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Ax(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===ou.levels.values.error?console.error(e):r===ou.levels.values.warn?console.warn(e):r===ou.levels.values.debug?console.debug(e):r===ou.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(mo({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new Ax(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(mo({extraMetadata:e})),new Blob(r,{type:"application/json"})}},sD=class{constructor(e,r=vm){this.baseChunkLogger=new Px(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},oD=class{constructor(e,r=vm){this.baseChunkLogger=new Px(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var aD=Object.defineProperty,cD=Object.defineProperties,uD=Object.getOwnPropertyDescriptors,Mx=Object.getOwnPropertySymbols,fD=Object.prototype.hasOwnProperty,lD=Object.prototype.propertyIsEnumerable,Ix=(t,e,r)=>e in t?aD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,md=(t,e)=>{for(var r in e||(e={}))fD.call(e,r)&&Ix(t,r,e[r]);if(Mx)for(var r of Mx(e))lD.call(e,r)&&Ix(t,r,e[r]);return t},vd=(t,e)=>cD(t,uD(e));function bd(t){return vd(md({},t),{level:(t==null?void 0:t.level)||nD.level})}function hD(t,e=nl){return t[e]||""}function dD(t,e,r=nl){return t[r]=e,t}function pi(t,e=nl){let r="";return typeof t.bindings>"u"?r=hD(t,e):r=t.bindings().context||"",r}function pD(t,e,r=nl){const n=pi(t,r);return n.trim()?`${n}/${e}`:e}function ti(t,e,r=nl){const n=pD(t,e,r),i=t.child({context:n});return dD(i,n,r)}function gD(t){var e,r;const n=new sD((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:rl(vd(md({},t.opts),{level:"trace",browser:vd(md({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function mD(t){var e;const r=new oD((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:rl(vd(md({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function vD(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?gD(t):mD(t)}let bD=class extends Xa{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},yD=class extends Xa{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},wD=class{constructor(e,r){this.logger=e,this.core=r}},xD=class extends Xa{constructor(e,r){super(),this.relayer=e,this.logger=r}},_D=class extends Xa{constructor(e){super()}},ED=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},SD=class extends Xa{constructor(e,r){super(),this.relayer=e,this.logger=r}},AD=class extends Xa{constructor(e,r){super(),this.core=e,this.logger=r}},PD=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},MD=class{constructor(e,r){this.projectId=e,this.logger=r}},ID=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},CD=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},TD=class{constructor(e){this.client=e}};var bm={},sa={},yd={},wd={};Object.defineProperty(wd,"__esModule",{value:!0}),wd.BrowserRandomSource=void 0;const Cx=65536;class RD{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let n=0;n>>16&65535,d=a&65535,p=u>>>16&65535,y=u&65535;return d*y+(l*y+d*p<<16>>>0)|0}t.mul=Math.imul||e;function r(a,u){return a+u|0}t.add=r;function n(a,u){return a-u|0}t.sub=n;function i(a,u){return a<>>32-u}t.rotl=i;function s(a,u){return a<<32-u|a>>>u}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(Rx),Object.defineProperty(or,"__esModule",{value:!0});var Dx=Rx;function $D(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}or.readInt16BE=$D;function FD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}or.readUint16BE=FD;function jD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}or.readInt16LE=jD;function UD(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}or.readUint16LE=UD;function Ox(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}or.writeUint16BE=Ox,or.writeInt16BE=Ox;function Nx(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}or.writeUint16LE=Nx,or.writeInt16LE=Nx;function ym(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}or.readInt32BE=ym;function wm(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}or.readUint32BE=wm;function xm(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}or.readInt32LE=xm;function _m(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}or.readUint32LE=_m;function _d(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}or.writeUint32BE=_d,or.writeInt32BE=_d;function Ed(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}or.writeUint32LE=Ed,or.writeInt32LE=Ed;function qD(t,e){e===void 0&&(e=0);var r=ym(t,e),n=ym(t,e+4);return r*4294967296+n-(n>>31)*4294967296}or.readInt64BE=qD;function zD(t,e){e===void 0&&(e=0);var r=wm(t,e),n=wm(t,e+4);return r*4294967296+n}or.readUint64BE=zD;function HD(t,e){e===void 0&&(e=0);var r=xm(t,e),n=xm(t,e+4);return n*4294967296+r-(r>>31)*4294967296}or.readInt64LE=HD;function WD(t,e){e===void 0&&(e=0);var r=_m(t,e),n=_m(t,e+4);return n*4294967296+r}or.readUint64LE=WD;function Lx(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),_d(t/4294967296>>>0,e,r),_d(t>>>0,e,r+4),e}or.writeUint64BE=Lx,or.writeInt64BE=Lx;function kx(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Ed(t>>>0,e,r),Ed(t/4294967296>>>0,e,r+4),e}or.writeUint64LE=kx,or.writeInt64LE=kx;function KD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}or.readUintBE=KD;function VD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}or.writeUintBE=GD;function YD(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Dx.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s256)throw new Error("randomString charset is too long");let y="";const _=d.length,M=256-256%_;for(;l>0;){const O=i(Math.ceil(l*256/M),p);for(let L=0;L0;L++){const B=O[L];B0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,_=l%128<112?128:256;this._buffer[d]=128;for(var M=d+1;M<_-8;M++)this._buffer[M]=0;e.writeUint32BE(p,this._buffer,_-8),e.writeUint32BE(y,this._buffer,_-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,_),this._finished=!0}for(var M=0;M0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._stateHi.set(u.stateHi),this._stateLo.set(u.stateLo),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.stateHi),r.wipe(u.stateLo),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,u,l,d,p,y,_){for(var M=l[0],O=l[1],L=l[2],B=l[3],k=l[4],H=l[5],U=l[6],z=l[7],Z=d[0],R=d[1],W=d[2],ie=d[3],me=d[4],j=d[5],E=d[6],m=d[7],f,g,v,x,S,A,b,P;_>=128;){for(var I=0;I<16;I++){var F=8*I+y;a[I]=e.readUint32BE(p,F),u[I]=e.readUint32BE(p,F+4)}for(var I=0;I<80;I++){var ce=M,D=O,se=L,ee=B,J=k,Q=H,T=U,X=z,re=Z,ge=R,oe=W,fe=ie,be=me,Me=j,Ne=E,Te=m;if(f=z,g=m,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=(k>>>14|me<<18)^(k>>>18|me<<14)^(me>>>9|k<<23),g=(me>>>14|k<<18)^(me>>>18|k<<14)^(k>>>9|me<<23),S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,f=k&H^~k&U,g=me&j^~me&E,S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,f=i[I*2],g=i[I*2+1],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,f=a[I%16],g=u[I%16],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,v=b&65535|P<<16,x=S&65535|A<<16,f=v,g=x,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=(M>>>28|Z<<4)^(Z>>>2|M<<30)^(Z>>>7|M<<25),g=(Z>>>28|M<<4)^(M>>>2|Z<<30)^(M>>>7|Z<<25),S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,f=M&O^M&L^O&L,g=Z&R^Z&W^R&W,S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,X=b&65535|P<<16,Te=S&65535|A<<16,f=ee,g=fe,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=v,g=x,S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,ee=b&65535|P<<16,fe=S&65535|A<<16,O=ce,L=D,B=se,k=ee,H=J,U=Q,z=T,M=X,R=re,W=ge,ie=oe,me=fe,j=be,E=Me,m=Ne,Z=Te,I%16===15)for(var F=0;F<16;F++)f=a[F],g=u[F],S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=a[(F+9)%16],g=u[(F+9)%16],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,v=a[(F+1)%16],x=u[(F+1)%16],f=(v>>>1|x<<31)^(v>>>8|x<<24)^v>>>7,g=(x>>>1|v<<31)^(x>>>8|v<<24)^(x>>>7|v<<25),S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,v=a[(F+14)%16],x=u[(F+14)%16],f=(v>>>19|x<<13)^(x>>>29|v<<3)^v>>>6,g=(x>>>19|v<<13)^(v>>>29|x<<3)^(x>>>6|v<<26),S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,a[F]=b&65535|P<<16,u[F]=S&65535|A<<16}f=M,g=Z,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[0],g=d[0],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[0]=M=b&65535|P<<16,d[0]=Z=S&65535|A<<16,f=O,g=R,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[1],g=d[1],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[1]=O=b&65535|P<<16,d[1]=R=S&65535|A<<16,f=L,g=W,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[2],g=d[2],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[2]=L=b&65535|P<<16,d[2]=W=S&65535|A<<16,f=B,g=ie,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[3],g=d[3],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[3]=B=b&65535|P<<16,d[3]=ie=S&65535|A<<16,f=k,g=me,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[4],g=d[4],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[4]=k=b&65535|P<<16,d[4]=me=S&65535|A<<16,f=H,g=j,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[5],g=d[5],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[5]=H=b&65535|P<<16,d[5]=j=S&65535|A<<16,f=U,g=E,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[6],g=d[6],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[6]=U=b&65535|P<<16,d[6]=E=S&65535|A<<16,f=z,g=m,S=g&65535,A=g>>>16,b=f&65535,P=f>>>16,f=l[7],g=d[7],S+=g&65535,A+=g>>>16,b+=f&65535,P+=f>>>16,A+=S>>>16,b+=A>>>16,P+=b>>>16,l[7]=z=b&65535|P<<16,d[7]=m=S&65535|A<<16,y+=128,_-=128}return y}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(Bx),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=sa,r=Bx,n=Mi;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(ee){const J=new Float64Array(16);if(ee)for(let Q=0;Q>16&1),Q[ge-1]&=65535;Q[15]=T[15]-32767-(Q[14]>>16&1);const re=Q[15]>>16&1;Q[14]&=65535,O(T,Q,1-re)}for(let X=0;X<16;X++)ee[2*X]=T[X]&255,ee[2*X+1]=T[X]>>8}function B(ee,J){let Q=0;for(let T=0;T<32;T++)Q|=ee[T]^J[T];return(1&Q-1>>>8)-1}function k(ee,J){const Q=new Uint8Array(32),T=new Uint8Array(32);return L(Q,ee),L(T,J),B(Q,T)}function H(ee){const J=new Uint8Array(32);return L(J,ee),J[0]&1}function U(ee,J){for(let Q=0;Q<16;Q++)ee[Q]=J[2*Q]+(J[2*Q+1]<<8);ee[15]&=32767}function z(ee,J,Q){for(let T=0;T<16;T++)ee[T]=J[T]+Q[T]}function Z(ee,J,Q){for(let T=0;T<16;T++)ee[T]=J[T]-Q[T]}function R(ee,J,Q){let T,X,re=0,ge=0,oe=0,fe=0,be=0,Me=0,Ne=0,Te=0,$e=0,Ie=0,Le=0,Ve=0,ke=0,ze=0,He=0,Se=0,Qe=0,ct=0,Be=0,et=0,rt=0,Je=0,gt=0,ht=0,ft=0,Ht=0,Jt=0,St=0,er=0,Xt=0,Ot=0,Bt=Q[0],Tt=Q[1],bt=Q[2],Dt=Q[3],Lt=Q[4],yt=Q[5],$t=Q[6],jt=Q[7],nt=Q[8],Ft=Q[9],$=Q[10],K=Q[11],G=Q[12],C=Q[13],Y=Q[14],q=Q[15];T=J[0],re+=T*Bt,ge+=T*Tt,oe+=T*bt,fe+=T*Dt,be+=T*Lt,Me+=T*yt,Ne+=T*$t,Te+=T*jt,$e+=T*nt,Ie+=T*Ft,Le+=T*$,Ve+=T*K,ke+=T*G,ze+=T*C,He+=T*Y,Se+=T*q,T=J[1],ge+=T*Bt,oe+=T*Tt,fe+=T*bt,be+=T*Dt,Me+=T*Lt,Ne+=T*yt,Te+=T*$t,$e+=T*jt,Ie+=T*nt,Le+=T*Ft,Ve+=T*$,ke+=T*K,ze+=T*G,He+=T*C,Se+=T*Y,Qe+=T*q,T=J[2],oe+=T*Bt,fe+=T*Tt,be+=T*bt,Me+=T*Dt,Ne+=T*Lt,Te+=T*yt,$e+=T*$t,Ie+=T*jt,Le+=T*nt,Ve+=T*Ft,ke+=T*$,ze+=T*K,He+=T*G,Se+=T*C,Qe+=T*Y,ct+=T*q,T=J[3],fe+=T*Bt,be+=T*Tt,Me+=T*bt,Ne+=T*Dt,Te+=T*Lt,$e+=T*yt,Ie+=T*$t,Le+=T*jt,Ve+=T*nt,ke+=T*Ft,ze+=T*$,He+=T*K,Se+=T*G,Qe+=T*C,ct+=T*Y,Be+=T*q,T=J[4],be+=T*Bt,Me+=T*Tt,Ne+=T*bt,Te+=T*Dt,$e+=T*Lt,Ie+=T*yt,Le+=T*$t,Ve+=T*jt,ke+=T*nt,ze+=T*Ft,He+=T*$,Se+=T*K,Qe+=T*G,ct+=T*C,Be+=T*Y,et+=T*q,T=J[5],Me+=T*Bt,Ne+=T*Tt,Te+=T*bt,$e+=T*Dt,Ie+=T*Lt,Le+=T*yt,Ve+=T*$t,ke+=T*jt,ze+=T*nt,He+=T*Ft,Se+=T*$,Qe+=T*K,ct+=T*G,Be+=T*C,et+=T*Y,rt+=T*q,T=J[6],Ne+=T*Bt,Te+=T*Tt,$e+=T*bt,Ie+=T*Dt,Le+=T*Lt,Ve+=T*yt,ke+=T*$t,ze+=T*jt,He+=T*nt,Se+=T*Ft,Qe+=T*$,ct+=T*K,Be+=T*G,et+=T*C,rt+=T*Y,Je+=T*q,T=J[7],Te+=T*Bt,$e+=T*Tt,Ie+=T*bt,Le+=T*Dt,Ve+=T*Lt,ke+=T*yt,ze+=T*$t,He+=T*jt,Se+=T*nt,Qe+=T*Ft,ct+=T*$,Be+=T*K,et+=T*G,rt+=T*C,Je+=T*Y,gt+=T*q,T=J[8],$e+=T*Bt,Ie+=T*Tt,Le+=T*bt,Ve+=T*Dt,ke+=T*Lt,ze+=T*yt,He+=T*$t,Se+=T*jt,Qe+=T*nt,ct+=T*Ft,Be+=T*$,et+=T*K,rt+=T*G,Je+=T*C,gt+=T*Y,ht+=T*q,T=J[9],Ie+=T*Bt,Le+=T*Tt,Ve+=T*bt,ke+=T*Dt,ze+=T*Lt,He+=T*yt,Se+=T*$t,Qe+=T*jt,ct+=T*nt,Be+=T*Ft,et+=T*$,rt+=T*K,Je+=T*G,gt+=T*C,ht+=T*Y,ft+=T*q,T=J[10],Le+=T*Bt,Ve+=T*Tt,ke+=T*bt,ze+=T*Dt,He+=T*Lt,Se+=T*yt,Qe+=T*$t,ct+=T*jt,Be+=T*nt,et+=T*Ft,rt+=T*$,Je+=T*K,gt+=T*G,ht+=T*C,ft+=T*Y,Ht+=T*q,T=J[11],Ve+=T*Bt,ke+=T*Tt,ze+=T*bt,He+=T*Dt,Se+=T*Lt,Qe+=T*yt,ct+=T*$t,Be+=T*jt,et+=T*nt,rt+=T*Ft,Je+=T*$,gt+=T*K,ht+=T*G,ft+=T*C,Ht+=T*Y,Jt+=T*q,T=J[12],ke+=T*Bt,ze+=T*Tt,He+=T*bt,Se+=T*Dt,Qe+=T*Lt,ct+=T*yt,Be+=T*$t,et+=T*jt,rt+=T*nt,Je+=T*Ft,gt+=T*$,ht+=T*K,ft+=T*G,Ht+=T*C,Jt+=T*Y,St+=T*q,T=J[13],ze+=T*Bt,He+=T*Tt,Se+=T*bt,Qe+=T*Dt,ct+=T*Lt,Be+=T*yt,et+=T*$t,rt+=T*jt,Je+=T*nt,gt+=T*Ft,ht+=T*$,ft+=T*K,Ht+=T*G,Jt+=T*C,St+=T*Y,er+=T*q,T=J[14],He+=T*Bt,Se+=T*Tt,Qe+=T*bt,ct+=T*Dt,Be+=T*Lt,et+=T*yt,rt+=T*$t,Je+=T*jt,gt+=T*nt,ht+=T*Ft,ft+=T*$,Ht+=T*K,Jt+=T*G,St+=T*C,er+=T*Y,Xt+=T*q,T=J[15],Se+=T*Bt,Qe+=T*Tt,ct+=T*bt,Be+=T*Dt,et+=T*Lt,rt+=T*yt,Je+=T*$t,gt+=T*jt,ht+=T*nt,ft+=T*Ft,Ht+=T*$,Jt+=T*K,St+=T*G,er+=T*C,Xt+=T*Y,Ot+=T*q,re+=38*Qe,ge+=38*ct,oe+=38*Be,fe+=38*et,be+=38*rt,Me+=38*Je,Ne+=38*gt,Te+=38*ht,$e+=38*ft,Ie+=38*Ht,Le+=38*Jt,Ve+=38*St,ke+=38*er,ze+=38*Xt,He+=38*Ot,X=1,T=re+X+65535,X=Math.floor(T/65536),re=T-X*65536,T=ge+X+65535,X=Math.floor(T/65536),ge=T-X*65536,T=oe+X+65535,X=Math.floor(T/65536),oe=T-X*65536,T=fe+X+65535,X=Math.floor(T/65536),fe=T-X*65536,T=be+X+65535,X=Math.floor(T/65536),be=T-X*65536,T=Me+X+65535,X=Math.floor(T/65536),Me=T-X*65536,T=Ne+X+65535,X=Math.floor(T/65536),Ne=T-X*65536,T=Te+X+65535,X=Math.floor(T/65536),Te=T-X*65536,T=$e+X+65535,X=Math.floor(T/65536),$e=T-X*65536,T=Ie+X+65535,X=Math.floor(T/65536),Ie=T-X*65536,T=Le+X+65535,X=Math.floor(T/65536),Le=T-X*65536,T=Ve+X+65535,X=Math.floor(T/65536),Ve=T-X*65536,T=ke+X+65535,X=Math.floor(T/65536),ke=T-X*65536,T=ze+X+65535,X=Math.floor(T/65536),ze=T-X*65536,T=He+X+65535,X=Math.floor(T/65536),He=T-X*65536,T=Se+X+65535,X=Math.floor(T/65536),Se=T-X*65536,re+=X-1+37*(X-1),X=1,T=re+X+65535,X=Math.floor(T/65536),re=T-X*65536,T=ge+X+65535,X=Math.floor(T/65536),ge=T-X*65536,T=oe+X+65535,X=Math.floor(T/65536),oe=T-X*65536,T=fe+X+65535,X=Math.floor(T/65536),fe=T-X*65536,T=be+X+65535,X=Math.floor(T/65536),be=T-X*65536,T=Me+X+65535,X=Math.floor(T/65536),Me=T-X*65536,T=Ne+X+65535,X=Math.floor(T/65536),Ne=T-X*65536,T=Te+X+65535,X=Math.floor(T/65536),Te=T-X*65536,T=$e+X+65535,X=Math.floor(T/65536),$e=T-X*65536,T=Ie+X+65535,X=Math.floor(T/65536),Ie=T-X*65536,T=Le+X+65535,X=Math.floor(T/65536),Le=T-X*65536,T=Ve+X+65535,X=Math.floor(T/65536),Ve=T-X*65536,T=ke+X+65535,X=Math.floor(T/65536),ke=T-X*65536,T=ze+X+65535,X=Math.floor(T/65536),ze=T-X*65536,T=He+X+65535,X=Math.floor(T/65536),He=T-X*65536,T=Se+X+65535,X=Math.floor(T/65536),Se=T-X*65536,re+=X-1+37*(X-1),ee[0]=re,ee[1]=ge,ee[2]=oe,ee[3]=fe,ee[4]=be,ee[5]=Me,ee[6]=Ne,ee[7]=Te,ee[8]=$e,ee[9]=Ie,ee[10]=Le,ee[11]=Ve,ee[12]=ke,ee[13]=ze,ee[14]=He,ee[15]=Se}function W(ee,J){R(ee,J,J)}function ie(ee,J){const Q=i();let T;for(T=0;T<16;T++)Q[T]=J[T];for(T=253;T>=0;T--)W(Q,Q),T!==2&&T!==4&&R(Q,Q,J);for(T=0;T<16;T++)ee[T]=Q[T]}function me(ee,J){const Q=i();let T;for(T=0;T<16;T++)Q[T]=J[T];for(T=250;T>=0;T--)W(Q,Q),T!==1&&R(Q,Q,J);for(T=0;T<16;T++)ee[T]=Q[T]}function j(ee,J){const Q=i(),T=i(),X=i(),re=i(),ge=i(),oe=i(),fe=i(),be=i(),Me=i();Z(Q,ee[1],ee[0]),Z(Me,J[1],J[0]),R(Q,Q,Me),z(T,ee[0],ee[1]),z(Me,J[0],J[1]),R(T,T,Me),R(X,ee[3],J[3]),R(X,X,l),R(re,ee[2],J[2]),z(re,re,re),Z(ge,T,Q),Z(oe,re,X),z(fe,re,X),z(be,T,Q),R(ee[0],ge,oe),R(ee[1],be,fe),R(ee[2],fe,oe),R(ee[3],ge,be)}function E(ee,J,Q){for(let T=0;T<4;T++)O(ee[T],J[T],Q)}function m(ee,J){const Q=i(),T=i(),X=i();ie(X,J[2]),R(Q,J[0],X),R(T,J[1],X),L(ee,T),ee[31]^=H(Q)<<7}function f(ee,J,Q){_(ee[0],o),_(ee[1],a),_(ee[2],a),_(ee[3],o);for(let T=255;T>=0;--T){const X=Q[T/8|0]>>(T&7)&1;E(ee,J,X),j(J,ee),j(ee,ee),E(ee,J,X)}}function g(ee,J){const Q=[i(),i(),i(),i()];_(Q[0],d),_(Q[1],p),_(Q[2],a),R(Q[3],d,p),f(ee,Q,J)}function v(ee){if(ee.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const J=(0,r.hash)(ee);J[0]&=248,J[31]&=127,J[31]|=64;const Q=new Uint8Array(32),T=[i(),i(),i(),i()];g(T,J),m(Q,T);const X=new Uint8Array(64);return X.set(ee),X.set(Q,32),{publicKey:Q,secretKey:X}}t.generateKeyPairFromSeed=v;function x(ee){const J=(0,e.randomBytes)(32,ee),Q=v(J);return(0,n.wipe)(J),Q}t.generateKeyPair=x;function S(ee){if(ee.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(ee.subarray(32))}t.extractPublicKeyFromSecretKey=S;const A=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function b(ee,J){let Q,T,X,re;for(T=63;T>=32;--T){for(Q=0,X=T-32,re=T-12;X>4)*A[X],Q=J[X]>>8,J[X]&=255;for(X=0;X<32;X++)J[X]-=Q*A[X];for(T=0;T<32;T++)J[T+1]+=J[T]>>8,ee[T]=J[T]&255}function P(ee){const J=new Float64Array(64);for(let Q=0;Q<64;Q++)J[Q]=ee[Q];for(let Q=0;Q<64;Q++)ee[Q]=0;b(ee,J)}function I(ee,J){const Q=new Float64Array(64),T=[i(),i(),i(),i()],X=(0,r.hash)(ee.subarray(0,32));X[0]&=248,X[31]&=127,X[31]|=64;const re=new Uint8Array(64);re.set(X.subarray(32),32);const ge=new r.SHA512;ge.update(re.subarray(32)),ge.update(J);const oe=ge.digest();ge.clean(),P(oe),g(T,oe),m(re,T),ge.reset(),ge.update(re.subarray(0,32)),ge.update(ee.subarray(32)),ge.update(J);const fe=ge.digest();P(fe);for(let be=0;be<32;be++)Q[be]=oe[be];for(let be=0;be<32;be++)for(let Me=0;Me<32;Me++)Q[be+Me]+=fe[be]*X[Me];return b(re.subarray(32),Q),re}t.sign=I;function F(ee,J){const Q=i(),T=i(),X=i(),re=i(),ge=i(),oe=i(),fe=i();return _(ee[2],a),U(ee[1],J),W(X,ee[1]),R(re,X,u),Z(X,X,ee[2]),z(re,ee[2],re),W(ge,re),W(oe,ge),R(fe,oe,ge),R(Q,fe,X),R(Q,Q,re),me(Q,Q),R(Q,Q,X),R(Q,Q,re),R(Q,Q,re),R(ee[0],Q,re),W(T,ee[0]),R(T,T,re),k(T,X)&&R(ee[0],ee[0],y),W(T,ee[0]),R(T,T,re),k(T,X)?-1:(H(ee[0])===J[31]>>7&&Z(ee[0],o,ee[0]),R(ee[3],ee[0],ee[1]),0)}function ce(ee,J,Q){const T=new Uint8Array(32),X=[i(),i(),i(),i()],re=[i(),i(),i(),i()];if(Q.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(F(re,ee))return!1;const ge=new r.SHA512;ge.update(Q.subarray(0,32)),ge.update(ee),ge.update(J);const oe=ge.digest();return P(oe),f(X,re,oe),g(re,Q.subarray(32)),j(X,re),m(T,X),!B(Q,T)}t.verify=ce;function D(ee){let J=[i(),i(),i(),i()];if(F(J,ee))throw new Error("Ed25519: invalid public key");let Q=i(),T=i(),X=J[1];z(Q,a,X),Z(T,a,X),ie(T,T),R(Q,Q,T);let re=new Uint8Array(32);return L(re,Q),re}t.convertPublicKeyToX25519=D;function se(ee){const J=(0,r.hash)(ee.subarray(0,32));J[0]&=248,J[31]&=127,J[31]|=64;const Q=new Uint8Array(J.subarray(0,32));return(0,n.wipe)(J),Q}t.convertSecretKeyToX25519=se}(bm);const iO="EdDSA",sO="JWT",Sd=".",Ad="base64url",$x="utf8",Fx="utf8",oO=":",aO="did",cO="key",jx="base58btc",uO="z",fO="K36",lO=32;function Ux(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Pd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=Ux(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function hO(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(H);B!==k;){for(var z=M[B],Z=0,R=H-1;(z!==0||Z>>0,U[R]=z%a>>>0,z=z/a>>>0;if(z!==0)throw new Error("Non-zero carry");L=Z,B++}for(var W=H-L;W!==H&&U[W]===0;)W++;for(var ie=u.repeat(O);W>>0,H=new Uint8Array(k);M[O];){var U=r[M.charCodeAt(O)];if(U===255)return;for(var z=0,Z=k-1;(U!==0||z>>0,H[Z]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");B=z,O++}if(M[O]!==" "){for(var R=k-B;R!==k&&H[R]===0;)R++;for(var W=new Uint8Array(L+(k-R)),ie=L;R!==k;)W[ie++]=H[R++];return W}}}function _(M){var O=y(M);if(O)return O;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:_}}var dO=hO,pO=dO;const gO=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},mO=t=>new TextEncoder().encode(t),vO=t=>new TextDecoder().decode(t);class bO{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class yO{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return qx(this,e)}}class wO{constructor(e){this.decoders=e}or(e){return qx(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const qx=(t,e)=>new wO({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class xO{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new bO(e,r,n),this.decoder=new yO(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Md=({name:t,prefix:e,encode:r,decode:n})=>new xO(t,e,r,n),sl=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=pO(r,e);return Md({prefix:t,name:e,encode:n,decode:s=>gO(i(s))})},_O=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},EO=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Md({prefix:e,name:t,encode(i){return EO(i,n,r)},decode(i){return _O(i,n,r,t)}}),SO=Md({prefix:"\0",name:"identity",encode:t=>vO(t),decode:t=>mO(t)}),AO=Object.freeze(Object.defineProperty({__proto__:null,identity:SO},Symbol.toStringTag,{value:"Module"})),PO=Bn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),MO=Object.freeze(Object.defineProperty({__proto__:null,base2:PO},Symbol.toStringTag,{value:"Module"})),IO=Bn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),CO=Object.freeze(Object.defineProperty({__proto__:null,base8:IO},Symbol.toStringTag,{value:"Module"})),TO=sl({prefix:"9",name:"base10",alphabet:"0123456789"}),RO=Object.freeze(Object.defineProperty({__proto__:null,base10:TO},Symbol.toStringTag,{value:"Module"})),DO=Bn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),OO=Bn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),NO=Object.freeze(Object.defineProperty({__proto__:null,base16:DO,base16upper:OO},Symbol.toStringTag,{value:"Module"})),LO=Bn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),kO=Bn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),BO=Bn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),$O=Bn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),FO=Bn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),jO=Bn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),UO=Bn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),qO=Bn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),zO=Bn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),HO=Object.freeze(Object.defineProperty({__proto__:null,base32:LO,base32hex:FO,base32hexpad:UO,base32hexpadupper:qO,base32hexupper:jO,base32pad:BO,base32padupper:$O,base32upper:kO,base32z:zO},Symbol.toStringTag,{value:"Module"})),WO=sl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),KO=sl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),VO=Object.freeze(Object.defineProperty({__proto__:null,base36:WO,base36upper:KO},Symbol.toStringTag,{value:"Module"})),GO=sl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),YO=sl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),JO=Object.freeze(Object.defineProperty({__proto__:null,base58btc:GO,base58flickr:YO},Symbol.toStringTag,{value:"Module"})),XO=Bn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ZO=Bn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),QO=Bn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),eN=Bn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),tN=Object.freeze(Object.defineProperty({__proto__:null,base64:XO,base64pad:ZO,base64url:QO,base64urlpad:eN},Symbol.toStringTag,{value:"Module"})),zx=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),rN=zx.reduce((t,e,r)=>(t[r]=e,t),[]),nN=zx.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function iN(t){return t.reduce((e,r)=>(e+=rN[r],e),"")}function sN(t){const e=[];for(const r of t){const n=nN[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const oN=Md({prefix:"🚀",name:"base256emoji",encode:iN,decode:sN}),aN=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:oN},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const Hx={...AO,...MO,...CO,...RO,...NO,...HO,...VO,...JO,...tN,...aN};function Wx(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const Kx=Wx("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Em=Wx("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=Ux(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new vN:typeof navigator<"u"?EN(navigator.userAgent):AN()}function _N(t){return t!==""&&wN.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function EN(t){var e=_N(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new mN;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length-1){const L=M.getAttribute("href");if(L)if(L.toLowerCase().indexOf("https:")===-1&&L.toLowerCase().indexOf("http:")===-1&&L.indexOf("//")!==0){let B=e.protocol+"//"+e.host;if(L.indexOf("/")===0)B+=L;else{const k=e.pathname.split("/");k.pop();const H=k.join("/");B+=H+"/"+L}y.push(B)}else if(L.indexOf("//")===0){const B=e.protocol+L;y.push(B)}else y.push(L)}}return y}function n(...p){const y=t.getElementsByTagName("meta");for(let _=0;_M.getAttribute(L)).filter(L=>L?p.includes(L):!1);if(O.length&&O){const L=M.getAttribute("content");if(L)return L}}return""}function i(){let p=n("name","og:site_name","og:title","twitter:title");return p||(p=t.title),p}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}t3=Pm.getWindowMetadata=BN;var al={},$N=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),n3="%[a-f0-9]{2}",i3=new RegExp("("+n3+")|([^%]+?)","gi"),s3=new RegExp("("+n3+")+","gi");function Mm(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],Mm(r),Mm(n))}function FN(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(i3)||[],r=1;r{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},zN=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;sk==null,o=Symbol("encodeFragmentIdentifier");function a(k){switch(k.arrayFormat){case"index":return H=>(U,z)=>{const Z=U.length;return z===void 0||k.skipNull&&z===null||k.skipEmptyString&&z===""?U:z===null?[...U,[d(H,k),"[",Z,"]"].join("")]:[...U,[d(H,k),"[",d(Z,k),"]=",d(z,k)].join("")]};case"bracket":return H=>(U,z)=>z===void 0||k.skipNull&&z===null||k.skipEmptyString&&z===""?U:z===null?[...U,[d(H,k),"[]"].join("")]:[...U,[d(H,k),"[]=",d(z,k)].join("")];case"colon-list-separator":return H=>(U,z)=>z===void 0||k.skipNull&&z===null||k.skipEmptyString&&z===""?U:z===null?[...U,[d(H,k),":list="].join("")]:[...U,[d(H,k),":list=",d(z,k)].join("")];case"comma":case"separator":case"bracket-separator":{const H=k.arrayFormat==="bracket-separator"?"[]=":"=";return U=>(z,Z)=>Z===void 0||k.skipNull&&Z===null||k.skipEmptyString&&Z===""?z:(Z=Z===null?"":Z,z.length===0?[[d(U,k),H,d(Z,k)].join("")]:[[z,d(Z,k)].join(k.arrayFormatSeparator)])}default:return H=>(U,z)=>z===void 0||k.skipNull&&z===null||k.skipEmptyString&&z===""?U:z===null?[...U,d(H,k)]:[...U,[d(H,k),"=",d(z,k)].join("")]}}function u(k){let H;switch(k.arrayFormat){case"index":return(U,z,Z)=>{if(H=/\[(\d*)\]$/.exec(U),U=U.replace(/\[\d*\]$/,""),!H){Z[U]=z;return}Z[U]===void 0&&(Z[U]={}),Z[U][H[1]]=z};case"bracket":return(U,z,Z)=>{if(H=/(\[\])$/.exec(U),U=U.replace(/\[\]$/,""),!H){Z[U]=z;return}if(Z[U]===void 0){Z[U]=[z];return}Z[U]=[].concat(Z[U],z)};case"colon-list-separator":return(U,z,Z)=>{if(H=/(:list)$/.exec(U),U=U.replace(/:list$/,""),!H){Z[U]=z;return}if(Z[U]===void 0){Z[U]=[z];return}Z[U]=[].concat(Z[U],z)};case"comma":case"separator":return(U,z,Z)=>{const R=typeof z=="string"&&z.includes(k.arrayFormatSeparator),W=typeof z=="string"&&!R&&p(z,k).includes(k.arrayFormatSeparator);z=W?p(z,k):z;const ie=R||W?z.split(k.arrayFormatSeparator).map(me=>p(me,k)):z===null?z:p(z,k);Z[U]=ie};case"bracket-separator":return(U,z,Z)=>{const R=/(\[\])$/.test(U);if(U=U.replace(/\[\]$/,""),!R){Z[U]=z&&p(z,k);return}const W=z===null?[]:z.split(k.arrayFormatSeparator).map(ie=>p(ie,k));if(Z[U]===void 0){Z[U]=W;return}Z[U]=[].concat(Z[U],W)};default:return(U,z,Z)=>{if(Z[U]===void 0){Z[U]=z;return}Z[U]=[].concat(Z[U],z)}}}function l(k){if(typeof k!="string"||k.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function d(k,H){return H.encode?H.strict?e(k):encodeURIComponent(k):k}function p(k,H){return H.decode?r(k):k}function y(k){return Array.isArray(k)?k.sort():typeof k=="object"?y(Object.keys(k)).sort((H,U)=>Number(H)-Number(U)).map(H=>k[H]):k}function _(k){const H=k.indexOf("#");return H!==-1&&(k=k.slice(0,H)),k}function M(k){let H="";const U=k.indexOf("#");return U!==-1&&(H=k.slice(U)),H}function O(k){k=_(k);const H=k.indexOf("?");return H===-1?"":k.slice(H+1)}function L(k,H){return H.parseNumbers&&!Number.isNaN(Number(k))&&typeof k=="string"&&k.trim()!==""?k=Number(k):H.parseBooleans&&k!==null&&(k.toLowerCase()==="true"||k.toLowerCase()==="false")&&(k=k.toLowerCase()==="true"),k}function B(k,H){H=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},H),l(H.arrayFormatSeparator);const U=u(H),z=Object.create(null);if(typeof k!="string"||(k=k.trim().replace(/^[?#&]/,""),!k))return z;for(const Z of k.split("&")){if(Z==="")continue;let[R,W]=n(H.decode?Z.replace(/\+/g," "):Z,"=");W=W===void 0?null:["comma","separator","bracket-separator"].includes(H.arrayFormat)?W:p(W,H),U(p(R,H),W,z)}for(const Z of Object.keys(z)){const R=z[Z];if(typeof R=="object"&&R!==null)for(const W of Object.keys(R))R[W]=L(R[W],H);else z[Z]=L(R,H)}return H.sort===!1?z:(H.sort===!0?Object.keys(z).sort():Object.keys(z).sort(H.sort)).reduce((Z,R)=>{const W=z[R];return W&&typeof W=="object"&&!Array.isArray(W)?Z[R]=y(W):Z[R]=W,Z},Object.create(null))}t.extract=O,t.parse=B,t.stringify=(k,H)=>{if(!k)return"";H=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},H),l(H.arrayFormatSeparator);const U=W=>H.skipNull&&s(k[W])||H.skipEmptyString&&k[W]==="",z=a(H),Z={};for(const W of Object.keys(k))U(W)||(Z[W]=k[W]);const R=Object.keys(Z);return H.sort!==!1&&R.sort(H.sort),R.map(W=>{const ie=k[W];return ie===void 0?"":ie===null?d(W,H):Array.isArray(ie)?ie.length===0&&H.arrayFormat==="bracket-separator"?d(W,H)+"[]":ie.reduce(z(W),[]).join("&"):d(W,H)+"="+d(ie,H)}).filter(W=>W.length>0).join("&")},t.parseUrl=(k,H)=>{H=Object.assign({decode:!0},H);const[U,z]=n(k,"#");return Object.assign({url:U.split("?")[0]||"",query:B(O(k),H)},H&&H.parseFragmentIdentifier&&z?{fragmentIdentifier:p(z,H)}:{})},t.stringifyUrl=(k,H)=>{H=Object.assign({encode:!0,strict:!0,[o]:!0},H);const U=_(k.url).split("?")[0]||"",z=t.extract(k.url),Z=t.parse(z,{sort:!1}),R=Object.assign(Z,k.query);let W=t.stringify(R,H);W&&(W=`?${W}`);let ie=M(k.url);return k.fragmentIdentifier&&(ie=`#${H[o]?d(k.fragmentIdentifier,H):k.fragmentIdentifier}`),`${U}${W}${ie}`},t.pick=(k,H,U)=>{U=Object.assign({parseFragmentIdentifier:!0,[o]:!1},U);const{url:z,query:Z,fragmentIdentifier:R}=t.parseUrl(k,U);return t.stringifyUrl({url:z,query:i(Z,H),fragmentIdentifier:R},U)},t.exclude=(k,H,U)=>{const z=Array.isArray(H)?Z=>!H.includes(Z):(Z,R)=>!H(Z,R);return t.pick(k,z,U)}})(al);var o3={exports:{}};/** + ***************************************************************************** */var Hp=function(t,e){return Hp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Hp(t,e)};function RC(t,e){Hp(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Wp=function(){return Wp=Object.assign||function(e){for(var r,n=1,i=arguments.length;n=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function OC(t,e){return function(r,n){e(r,n,t)}}function NC(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function LC(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(h){try{u(n.next(h))}catch(g){o(g)}}function f(h){try{u(n.throw(h))}catch(g){o(g)}}function u(h){h.done?s(h.value):i(h.value).then(a,f)}u((n=n.apply(t,e||[])).next())})}function kC(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(h){return f([u,h])}}function f(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Jw(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function jC(){for(var t=[],e=0;e1||a(b,x)})})}function a(b,x){try{f(n[b](x))}catch(S){g(s[0][3],S)}}function f(b){b.value instanceof zu?Promise.resolve(b.value.v).then(u,h):g(s[0][2],b)}function u(b){a("next",b)}function h(b){a("throw",b)}function g(b,x){b(x),s.shift(),s.length&&a(s[0][0],s[0][1])}}function qC(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:zu(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function zC(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Kp=="function"?Kp(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,f){o=t[s](o),i(a,f,o.done,o.value)})}}function i(s,o,a,f){Promise.resolve(f).then(function(u){s({value:u,done:a})},o)}}function HC(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function WC(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function KC(t){return t&&t.__esModule?t:{default:t}}function VC(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function GC(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const Hu=ny(Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Wp},__asyncDelegator:qC,__asyncGenerator:$C,__asyncValues:zC,__await:zu,__awaiter:LC,__classPrivateFieldGet:VC,__classPrivateFieldSet:GC,__createBinding:BC,__decorate:DC,__exportStar:FC,__extends:RC,__generator:kC,__importDefault:KC,__importStar:WC,__makeTemplateObject:HC,__metadata:NC,__param:OC,__read:Jw,__rest:TC,__spread:jC,__spreadArrays:UC,__values:Kp},Symbol.toStringTag,{value:"Module"})));var Vp={},Wu={},Xw;function YC(){if(Xw)return Wu;Xw=1,Object.defineProperty(Wu,"__esModule",{value:!0}),Wu.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Wu.delay=t,Wu}var ha={},Gp={},da={},Zw;function JC(){return Zw||(Zw=1,Object.defineProperty(da,"__esModule",{value:!0}),da.ONE_THOUSAND=da.ONE_HUNDRED=void 0,da.ONE_HUNDRED=100,da.ONE_THOUSAND=1e3),da}var Yp={},Qw;function XC(){return Qw||(Qw=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365})(Yp)),Yp}var e2;function t2(){return e2||(e2=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Hu;e.__exportStar(JC(),t),e.__exportStar(XC(),t)})(Gp)),Gp}var r2;function ZC(){if(r2)return ha;r2=1,Object.defineProperty(ha,"__esModule",{value:!0}),ha.fromMiliseconds=ha.toMiliseconds=void 0;const t=t2();function e(n){return n*t.ONE_THOUSAND}ha.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return ha.fromMiliseconds=r,ha}var n2;function QC(){return n2||(n2=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Hu;e.__exportStar(YC(),t),e.__exportStar(ZC(),t)})(Vp)),Vp}var mc={},i2;function eR(){if(i2)return mc;i2=1,Object.defineProperty(mc,"__esModule",{value:!0}),mc.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return mc.Watch=t,mc.default=t,mc}var Jp={},Ku={},s2;function tR(){if(s2)return Ku;s2=1,Object.defineProperty(Ku,"__esModule",{value:!0}),Ku.IWatch=void 0;class t{}return Ku.IWatch=t,Ku}var o2;function rR(){return o2||(o2=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Hu.__exportStar(tR(),t)})(Jp)),Jp}var a2;function nR(){return a2||(a2=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Hu;e.__exportStar(QC(),t),e.__exportStar(eR(),t),e.__exportStar(rR(),t),e.__exportStar(t2(),t)})(zp)),zp}var vt=nR();class pa{}let iR=class extends pa{constructor(e){super()}};const c2=vt.FIVE_SECONDS,vc={pulse:"heartbeat_pulse"};let sR=class AA extends iR{constructor(e){super(e),this.events=new Di.EventEmitter,this.interval=c2,this.interval=e?.interval||c2}static async init(e){const r=new AA(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),vt.toMiliseconds(this.interval))}pulse(){this.events.emit(vc.pulse)}};const oR=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,aR=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,cR=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function uR(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){fR(t);return}return e}function fR(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function oh(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!cR.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(oR.test(t)||aR.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,uR)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function lR(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Sn(t,...e){try{return lR(t(...e))}catch(r){return Promise.reject(r)}}function hR(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function dR(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function ah(t){if(hR(t))return String(t);if(dR(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return ah(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function u2(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const Xp="base64:";function pR(t){if(typeof t=="string")return t;u2();const e=Buffer.from(t).toString("base64");return Xp+e}function gR(t){return typeof t!="string"||!t.startsWith(Xp)?t:(u2(),Buffer.from(t.slice(Xp.length),"base64"))}function si(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function mR(...t){return si(t.join(":"))}function ch(t){return t=si(t),t?t+":":""}function yne(t){return t}const vR="memory",bR=()=>{const t=new Map;return{name:vR,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function yR(t={}){const e={mounts:{"":t.driver||bR()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=u=>{for(const h of e.mountpoints)if(u.startsWith(h))return{base:h,relativeKey:u.slice(h.length),driver:e.mounts[h]};return{base:"",relativeKey:u,driver:e.mounts[""]}},n=(u,h)=>e.mountpoints.filter(g=>g.startsWith(u)||h&&u.startsWith(g)).map(g=>({relativeBase:u.length>g.length?u.slice(g.length):void 0,mountpoint:g,driver:e.mounts[g]})),i=(u,h)=>{if(e.watching){h=si(h);for(const g of e.watchListeners)g(u,h)}},s=async()=>{if(!e.watching){e.watching=!0;for(const u in e.mounts)e.unwatch[u]=await f2(e.mounts[u],i,u)}},o=async()=>{if(e.watching){for(const u in e.unwatch)await e.unwatch[u]();e.unwatch={},e.watching=!1}},a=(u,h,g)=>{const b=new Map,x=S=>{let C=b.get(S.base);return C||(C={driver:S.driver,base:S.base,items:[]},b.set(S.base,C)),C};for(const S of u){const C=typeof S=="string",D=si(C?S:S.key),B=C?void 0:S.value,L=C||!S.options?h:{...h,...S.options},H=r(D);x(H).items.push({key:D,value:B,relativeKey:H.relativeKey,options:L})}return Promise.all([...b.values()].map(S=>g(S))).then(S=>S.flat())},f={hasItem(u,h={}){u=si(u);const{relativeKey:g,driver:b}=r(u);return Sn(b.hasItem,g,h)},getItem(u,h={}){u=si(u);const{relativeKey:g,driver:b}=r(u);return Sn(b.getItem,g,h).then(x=>oh(x))},getItems(u,h){return a(u,h,g=>g.driver.getItems?Sn(g.driver.getItems,g.items.map(b=>({key:b.relativeKey,options:b.options})),h).then(b=>b.map(x=>({key:mR(g.base,x.key),value:oh(x.value)}))):Promise.all(g.items.map(b=>Sn(g.driver.getItem,b.relativeKey,b.options).then(x=>({key:b.key,value:oh(x)})))))},getItemRaw(u,h={}){u=si(u);const{relativeKey:g,driver:b}=r(u);return b.getItemRaw?Sn(b.getItemRaw,g,h):Sn(b.getItem,g,h).then(x=>gR(x))},async setItem(u,h,g={}){if(h===void 0)return f.removeItem(u);u=si(u);const{relativeKey:b,driver:x}=r(u);x.setItem&&(await Sn(x.setItem,b,ah(h),g),x.watch||i("update",u))},async setItems(u,h){await a(u,h,async g=>{if(g.driver.setItems)return Sn(g.driver.setItems,g.items.map(b=>({key:b.relativeKey,value:ah(b.value),options:b.options})),h);g.driver.setItem&&await Promise.all(g.items.map(b=>Sn(g.driver.setItem,b.relativeKey,ah(b.value),b.options)))})},async setItemRaw(u,h,g={}){if(h===void 0)return f.removeItem(u,g);u=si(u);const{relativeKey:b,driver:x}=r(u);if(x.setItemRaw)await Sn(x.setItemRaw,b,h,g);else if(x.setItem)await Sn(x.setItem,b,pR(h),g);else return;x.watch||i("update",u)},async removeItem(u,h={}){typeof h=="boolean"&&(h={removeMeta:h}),u=si(u);const{relativeKey:g,driver:b}=r(u);b.removeItem&&(await Sn(b.removeItem,g,h),(h.removeMeta||h.removeMata)&&await Sn(b.removeItem,g+"$",h),b.watch||i("remove",u))},async getMeta(u,h={}){typeof h=="boolean"&&(h={nativeOnly:h}),u=si(u);const{relativeKey:g,driver:b}=r(u),x=Object.create(null);if(b.getMeta&&Object.assign(x,await Sn(b.getMeta,g,h)),!h.nativeOnly){const S=await Sn(b.getItem,g+"$",h).then(C=>oh(C));S&&typeof S=="object"&&(typeof S.atime=="string"&&(S.atime=new Date(S.atime)),typeof S.mtime=="string"&&(S.mtime=new Date(S.mtime)),Object.assign(x,S))}return x},setMeta(u,h,g={}){return this.setItem(u+"$",h,g)},removeMeta(u,h={}){return this.removeItem(u+"$",h)},async getKeys(u,h={}){u=ch(u);const g=n(u,!0);let b=[];const x=[];for(const S of g){const C=await Sn(S.driver.getKeys,S.relativeBase,h);for(const D of C){const B=S.mountpoint+si(D);b.some(L=>B.startsWith(L))||x.push(B)}b=[S.mountpoint,...b.filter(D=>!D.startsWith(S.mountpoint))]}return u?x.filter(S=>S.startsWith(u)&&S[S.length-1]!=="$"):x.filter(S=>S[S.length-1]!=="$")},async clear(u,h={}){u=ch(u),await Promise.all(n(u,!1).map(async g=>{if(g.driver.clear)return Sn(g.driver.clear,g.relativeBase,h);if(g.driver.removeItem){const b=await g.driver.getKeys(g.relativeBase||"",h);return Promise.all(b.map(x=>g.driver.removeItem(x,h)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(u=>l2(u)))},async watch(u){return await s(),e.watchListeners.push(u),async()=>{e.watchListeners=e.watchListeners.filter(h=>h!==u),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(u,h){if(u=ch(u),u&&e.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(e.mountpoints.push(u),e.mountpoints.sort((g,b)=>b.length-g.length)),e.mounts[u]=h,e.watching&&Promise.resolve(f2(h,i,u)).then(g=>{e.unwatch[u]=g}).catch(console.error),f},async unmount(u,h=!0){u=ch(u),!(!u||!e.mounts[u])&&(e.watching&&u in e.unwatch&&(e.unwatch[u](),delete e.unwatch[u]),h&&await l2(e.mounts[u]),e.mountpoints=e.mountpoints.filter(g=>g!==u),delete e.mounts[u])},getMount(u=""){u=si(u)+":";const h=r(u);return{driver:h.driver,base:h.base}},getMounts(u="",h={}){return u=si(u),n(u,h.parents).map(b=>({driver:b.driver,base:b.mountpoint}))},keys:(u,h={})=>f.getKeys(u,h),get:(u,h={})=>f.getItem(u,h),set:(u,h,g={})=>f.setItem(u,h,g),has:(u,h={})=>f.hasItem(u,h),del:(u,h={})=>f.removeItem(u,h),remove:(u,h={})=>f.removeItem(u,h)};return f}function f2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function l2(t){typeof t.dispose=="function"&&await Sn(t.dispose)}function ga(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function h2(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=ga(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let Zp;function Vu(){return Zp||(Zp=h2("keyval-store","keyval")),Zp}function d2(t,e=Vu()){return e("readonly",r=>ga(r.get(t)))}function wR(t,e,r=Vu()){return r("readwrite",n=>(n.put(e,t),ga(n.transaction)))}function xR(t,e=Vu()){return e("readwrite",r=>(r.delete(t),ga(r.transaction)))}function _R(t=Vu()){return t("readwrite",e=>(e.clear(),ga(e.transaction)))}function ER(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},ga(t.transaction)}function SR(t=Vu()){return t("readonly",e=>{if(e.getAllKeys)return ga(e.getAllKeys());const r=[];return ER(e,n=>r.push(n.key)).then(()=>r)})}const AR=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),PR=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function ma(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return PR(t)}catch{return t}}function Hs(t){return typeof t=="string"?t:AR(t)||""}const IR="idb-keyval";var MR=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=h2(t.dbName,t.storeName)),{name:IR,options:t,async hasItem(i){return!(typeof await d2(r(i),n)>"u")},async getItem(i){return await d2(r(i),n)??null},setItem(i,s){return wR(r(i),s,n)},removeItem(i){return xR(r(i),n)},getKeys(){return SR(n)},clear(){return _R(n)}}};const CR="WALLET_CONNECT_V2_INDEXED_DB",RR="keyvaluestorage";let TR=class{constructor(){this.indexedDb=yR({driver:MR({dbName:CR,storeName:RR})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Hs(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var Qp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},uh={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Qp<"u"&&Qp.localStorage?uh.exports=Qp.localStorage:typeof window<"u"&&window.localStorage?uh.exports=window.localStorage:uh.exports=new e})();function DR(t){var e;return[t[0],ma((e=t[1])!=null?e:"")]}let OR=class{constructor(){this.localStorage=uh.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(DR)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return ma(r)}async setItem(e,r){this.localStorage.setItem(e,Hs(r))}async removeItem(e){this.localStorage.removeItem(e)}};const NR="wc_storage_version",p2=1,LR=async(t,e,r)=>{const n=NR,i=await e.getItem(n);if(i&&i>=p2){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const f=a.toLowerCase();if(f.includes("wc@")||f.includes("walletconnect")||f.includes("wc_")||f.includes("wallet_connect")){const u=await t.getItem(a);await e.setItem(a,u),o.push(a)}}await e.setItem(n,p2),r(e),kR(t,o)},kR=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let BR=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new OR;this.storage=e;try{const r=new TR;LR(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};var eg,g2;function FR(){if(g2)return eg;g2=1;function t(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}eg=e;function e(r,n,i){var s=i&&i.stringify||t,o=1;if(typeof r=="object"&&r!==null){var a=n.length+o;if(a===1)return r;var f=new Array(a);f[0]=s(r);for(var u=1;u-1?x:0,r.charCodeAt(C+1)){case 100:case 102:if(b>=h||n[b]==null)break;x=h||n[b]==null)break;x=h||n[b]===void 0)break;x",x=C+2,C++;break}g+=s(n[b]),x=C+2,C++;break;case 115:if(b>=h)break;x-1&&(q=!1);const _=["error","fatal","warn","info","debug","trace"];typeof W=="function"&&(W.error=W.fatal=W.warn=W.info=W.debug=W.trace=W),$.enabled===!1&&($.level="silent");const v=$.level||"info",l=Object.create(W);l.log||(l.log=D),Object.defineProperty(l,"levelVal",{get:m}),Object.defineProperty(l,"level",{get:y,set:A});const p={transmit:R,serialize:X,asObject:$.browser.asObject,levels:_,timestamp:x($)};l.levels=i.levels,l.level=v,l.setMaxListeners=l.getMaxListeners=l.emit=l.addListener=l.on=l.prependListener=l.once=l.prependOnceListener=l.removeListener=l.removeAllListeners=l.listeners=l.listenerCount=l.eventNames=l.write=l.flush=D,l.serializers=V,l._serialize=X,l._stdErrSerialize=q,l.child=E,R&&(l._logEvent=g());function m(){return this.level==="silent"?1/0:this.levels.values[this.level]}function y(){return this._level}function A(w){if(w!=="silent"&&!this.levels.values[w])throw Error("unknown level "+w);this._level=w,s(p,l,"error","log"),s(p,l,"fatal","error"),s(p,l,"warn","error"),s(p,l,"info","log"),s(p,l,"debug","log"),s(p,l,"trace","log")}function E(w,I){if(!w)throw new Error("missing bindings for child Pino");I=I||{},X&&w.serializers&&(I.serializers=w.serializers);const M=I.serializers;if(X&&M){var z=Object.assign({},V,M),se=$.browser.serialize===!0?Object.keys(z):X;delete w.serializers,f([w],se,z,this._stdErrSerialize)}function O(ie){this._childLevel=(ie._childLevel|0)+1,this.error=u(ie,w,"error"),this.fatal=u(ie,w,"fatal"),this.warn=u(ie,w,"warn"),this.info=u(ie,w,"info"),this.debug=u(ie,w,"debug"),this.trace=u(ie,w,"trace"),z&&(this.serializers=z,this._serialize=se),R&&(this._logEvent=g([].concat(ie._logEvent.bindings,w)))}return O.prototype=this,new O(this)}return l}i.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},i.stdSerializers=r,i.stdTimeFunctions=Object.assign({},{nullTime:B,epochTime:L,unixTime:H,isoTime:F});function s($,R,W,V){const X=Object.getPrototypeOf(R);R[W]=R.levelVal>R.levels.values[W]?D:X[W]?X[W]:e[W]||e[V]||D,o($,R,W)}function o($,R,W){!$.transmit&&R[W]===D||(R[W]=(function(V){return function(){const q=$.timestamp(),_=new Array(arguments.length),v=Object.getPrototypeOf&&Object.getPrototypeOf(this)===e?e:this;for(var l=0;l<_.length;l++)_[l]=arguments[l];if($.serialize&&!$.asObject&&f(_,this._serialize,this.serializers,this._stdErrSerialize),$.asObject?V.call(v,a(this,W,_,q)):V.apply(v,_),$.transmit){const p=$.transmit.level||R.level,m=i.levels.values[p],y=i.levels.values[W];if(y-1&&q in W&&($[X][q]=W[q]($[X][q]))}function u($,R,W){return function(){const V=new Array(1+arguments.length);V[0]=R;for(var X=1;Xthis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},b2=class{constructor(e,r=rg){this.level=e??"error",this.levelValue=bc.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new v2(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===bc.levels.values.error?console.error(e):r===bc.levels.values.warn?console.warn(e):r===bc.levels.values.debug?console.debug(e):r===bc.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Hs({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new v2(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(Hs({extraMetadata:e})),new Blob(r,{type:"application/json"})}},qR=class{constructor(e,r=rg){this.baseChunkLogger=new b2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},zR=class{constructor(e,r=rg){this.baseChunkLogger=new b2(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var HR=Object.defineProperty,WR=Object.defineProperties,KR=Object.getOwnPropertyDescriptors,y2=Object.getOwnPropertySymbols,VR=Object.prototype.hasOwnProperty,GR=Object.prototype.propertyIsEnumerable,w2=(t,e,r)=>e in t?HR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fh=(t,e)=>{for(var r in e||(e={}))VR.call(e,r)&&w2(t,r,e[r]);if(y2)for(var r of y2(e))GR.call(e,r)&&w2(t,r,e[r]);return t},lh=(t,e)=>WR(t,KR(e));function hh(t){return lh(fh({},t),{level:t?.level||UR.level})}function YR(t,e=Yu){return t[e]||""}function JR(t,e,r=Yu){return t[r]=e,t}function oi(t,e=Yu){let r="";return typeof t.bindings>"u"?r=YR(t,e):r=t.bindings().context||"",r}function XR(t,e,r=Yu){const n=oi(t,r);return n.trim()?`${n}/${e}`:e}function Vn(t,e,r=Yu){const n=XR(t,e,r),i=t.child({context:n});return JR(i,n,r)}function ZR(t){var e,r;const n=new qR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Gu(lh(fh({},t.opts),{level:"trace",browser:lh(fh({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function QR(t){var e;const r=new zR((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Gu(lh(fh({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function eT(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?ZR(t):QR(t)}let tT=class extends pa{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},rT=class extends pa{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},nT=class{constructor(e,r){this.logger=e,this.core=r}},iT=class extends pa{constructor(e,r){super(),this.relayer=e,this.logger=r}},sT=class extends pa{constructor(e){super()}},oT=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},aT=class extends pa{constructor(e,r){super(),this.relayer=e,this.logger=r}},cT=class extends pa{constructor(e,r){super(),this.core=e,this.logger=r}},uT=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},fT=class{constructor(e,r){this.projectId=e,this.logger=r}},lT=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},hT=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},dT=class{constructor(e){this.client=e}};var ng={},ig={},Ju={},Xu={},x2;function pT(){if(x2)return Xu;x2=1,Object.defineProperty(Xu,"__esModule",{value:!0}),Xu.BrowserRandomSource=void 0;const t=65536;class e{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const n=typeof self<"u"?self.crypto||self.msCrypto:null;n&&n.getRandomValues!==void 0&&(this._crypto=n,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(n){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const i=new Uint8Array(n);for(let s=0;s>>16&65535,h=a&65535,g=f>>>16&65535,b=f&65535;return h*b+(u*b+h*g<<16>>>0)|0}t.mul=Math.imul||e;function r(a,f){return a+f|0}t.add=r;function n(a,f){return a-f|0}t.sub=n;function i(a,f){return a<>>32-f}t.rotl=i;function s(a,f){return a<<32-f|a>>>f}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(sg)),sg}var I2;function ef(){if(I2)return lr;I2=1,Object.defineProperty(lr,"__esModule",{value:!0});var t=vT();function e(p,m){return m===void 0&&(m=0),(p[m+0]<<8|p[m+1])<<16>>16}lr.readInt16BE=e;function r(p,m){return m===void 0&&(m=0),(p[m+0]<<8|p[m+1])>>>0}lr.readUint16BE=r;function n(p,m){return m===void 0&&(m=0),(p[m+1]<<8|p[m])<<16>>16}lr.readInt16LE=n;function i(p,m){return m===void 0&&(m=0),(p[m+1]<<8|p[m])>>>0}lr.readUint16LE=i;function s(p,m,y){return m===void 0&&(m=new Uint8Array(2)),y===void 0&&(y=0),m[y+0]=p>>>8,m[y+1]=p>>>0,m}lr.writeUint16BE=s,lr.writeInt16BE=s;function o(p,m,y){return m===void 0&&(m=new Uint8Array(2)),y===void 0&&(y=0),m[y+0]=p>>>0,m[y+1]=p>>>8,m}lr.writeUint16LE=o,lr.writeInt16LE=o;function a(p,m){return m===void 0&&(m=0),p[m]<<24|p[m+1]<<16|p[m+2]<<8|p[m+3]}lr.readInt32BE=a;function f(p,m){return m===void 0&&(m=0),(p[m]<<24|p[m+1]<<16|p[m+2]<<8|p[m+3])>>>0}lr.readUint32BE=f;function u(p,m){return m===void 0&&(m=0),p[m+3]<<24|p[m+2]<<16|p[m+1]<<8|p[m]}lr.readInt32LE=u;function h(p,m){return m===void 0&&(m=0),(p[m+3]<<24|p[m+2]<<16|p[m+1]<<8|p[m])>>>0}lr.readUint32LE=h;function g(p,m,y){return m===void 0&&(m=new Uint8Array(4)),y===void 0&&(y=0),m[y+0]=p>>>24,m[y+1]=p>>>16,m[y+2]=p>>>8,m[y+3]=p>>>0,m}lr.writeUint32BE=g,lr.writeInt32BE=g;function b(p,m,y){return m===void 0&&(m=new Uint8Array(4)),y===void 0&&(y=0),m[y+0]=p>>>0,m[y+1]=p>>>8,m[y+2]=p>>>16,m[y+3]=p>>>24,m}lr.writeUint32LE=b,lr.writeInt32LE=b;function x(p,m){m===void 0&&(m=0);var y=a(p,m),A=a(p,m+4);return y*4294967296+A-(A>>31)*4294967296}lr.readInt64BE=x;function S(p,m){m===void 0&&(m=0);var y=f(p,m),A=f(p,m+4);return y*4294967296+A}lr.readUint64BE=S;function C(p,m){m===void 0&&(m=0);var y=u(p,m),A=u(p,m+4);return A*4294967296+y-(y>>31)*4294967296}lr.readInt64LE=C;function D(p,m){m===void 0&&(m=0);var y=h(p,m),A=h(p,m+4);return A*4294967296+y}lr.readUint64LE=D;function B(p,m,y){return m===void 0&&(m=new Uint8Array(8)),y===void 0&&(y=0),g(p/4294967296>>>0,m,y),g(p>>>0,m,y+4),m}lr.writeUint64BE=B,lr.writeInt64BE=B;function L(p,m,y){return m===void 0&&(m=new Uint8Array(8)),y===void 0&&(y=0),b(p>>>0,m,y),b(p/4294967296>>>0,m,y+4),m}lr.writeUint64LE=L,lr.writeInt64LE=L;function H(p,m,y){if(y===void 0&&(y=0),p%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(p/8>m.length-y)throw new Error("readUintBE: array is too short for the given bitLength");for(var A=0,E=1,w=p/8+y-1;w>=y;w--)A+=m[w]*E,E*=256;return A}lr.readUintBE=H;function F(p,m,y){if(y===void 0&&(y=0),p%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(p/8>m.length-y)throw new Error("readUintLE: array is too short for the given bitLength");for(var A=0,E=1,w=y;w=A;w--)y[w]=m/E&255,E*=256;return y}lr.writeUintBE=k;function $(p,m,y,A){if(y===void 0&&(y=new Uint8Array(p/8)),A===void 0&&(A=0),p%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!t.isSafeInteger(m))throw new Error("writeUintLE value must be an integer");for(var E=1,w=A;w256)throw new Error("randomString charset is too long");let b="";const x=h.length,S=256-256%x;for(;u>0;){const C=i(Math.ceil(u*256/S),g);for(let D=0;D0;D++){const B=C[D];B0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=f[h++],u--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(u>=this.blockSize&&(h=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,f,h,u),u%=this.blockSize);u>0;)this._buffer[this._bufferLength++]=f[h++],u--;return this},a.prototype.finish=function(f){if(!this._finished){var u=this._bytesHashed,h=this._bufferLength,g=u/536870912|0,b=u<<3,x=u%128<112?128:256;this._buffer[h]=128;for(var S=h+1;S0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(f){return this._stateHi.set(f.stateHi),this._stateLo.set(f.stateLo),this._bufferLength=f.bufferLength,f.buffer&&this._buffer.set(f.buffer),this._bytesHashed=f.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(f){r.wipe(f.stateHi),r.wipe(f.stateLo),f.buffer&&r.wipe(f.buffer),f.bufferLength=0,f.bytesHashed=0},a})();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,f,u,h,g,b,x){for(var S=u[0],C=u[1],D=u[2],B=u[3],L=u[4],H=u[5],F=u[6],k=u[7],$=h[0],R=h[1],W=h[2],V=h[3],X=h[4],q=h[5],_=h[6],v=h[7],l,p,m,y,A,E,w,I;x>=128;){for(var M=0;M<16;M++){var z=8*M+b;a[M]=e.readUint32BE(g,z),f[M]=e.readUint32BE(g,z+4)}for(var M=0;M<80;M++){var se=S,O=C,ie=D,ee=B,Z=L,te=H,N=F,Q=k,ne=$,de=R,ce=W,fe=V,be=X,Pe=q,De=_,Te=v;if(l=k,p=v,A=p&65535,E=p>>>16,w=l&65535,I=l>>>16,l=(L>>>14|X<<18)^(L>>>18|X<<14)^(X>>>9|L<<23),p=(X>>>14|L<<18)^(X>>>18|L<<14)^(L>>>9|X<<23),A+=p&65535,E+=p>>>16,w+=l&65535,I+=l>>>16,l=L&H^~L&F,p=X&q^~X&_,A+=p&65535,E+=p>>>16,w+=l&65535,I+=l>>>16,l=i[M*2],p=i[M*2+1],A+=p&65535,E+=p>>>16,w+=l&65535,I+=l>>>16,l=a[M%16],p=f[M%16],A+=p&65535,E+=p>>>16,w+=l&65535,I+=l>>>16,E+=A>>>16,w+=E>>>16,I+=w>>>16,m=w&65535|I<<16,y=A&65535|E<<16,l=m,p=y,A=p&65535,E=p>>>16,w=l&65535,I=l>>>16,l=(S>>>28|$<<4)^($>>>2|S<<30)^($>>>7|S<<25),p=($>>>28|S<<4)^(S>>>2|$<<30)^(S>>>7|$<<25),A+=p&65535,E+=p>>>16,w+=l&65535,I+=l>>>16,l=S&C^S&D^C&D,p=$&R^$&W^R&W,A+=p&65535,E+=p>>>16,w+=l&65535,I+=l>>>16,E+=A>>>16,w+=E>>>16,I+=w>>>16,Q=w&65535|I<<16,Te=A&65535|E<<16,l=ee,p=fe,A=p&65535,E=p>>>16,w=l&65535,I=l>>>16,l=m,p=y,A+=p&65535,E+=p>>>16,w+=l&65535,I+=l>>>16,E+=A>>>16,w+=E>>>16,I+=w>>>16,ee=w&65535|I<<16,fe=A&65535|E<<16,C=se,D=O,B=ie,L=ee,H=Z,F=te,k=N,S=Q,R=ne,W=de,V=ce,X=fe,q=be,_=Pe,v=De,$=Te,M%16===15)for(var z=0;z<16;z++)l=a[z],p=f[z],A=p&65535,E=p>>>16,w=l&65535,I=l>>>16,l=a[(z+9)%16],p=f[(z+9)%16],A+=p&65535,E+=p>>>16,w+=l&65535,I+=l>>>16,m=a[(z+1)%16],y=f[(z+1)%16],l=(m>>>1|y<<31)^(m>>>8|y<<24)^m>>>7,p=(y>>>1|m<<31)^(y>>>8|m<<24)^(y>>>7|m<<25),A+=p&65535,E+=p>>>16,w+=l&65535,I+=l>>>16,m=a[(z+14)%16],y=f[(z+14)%16],l=(m>>>19|y<<13)^(y>>>29|m<<3)^m>>>6,p=(y>>>19|m<<13)^(m>>>29|y<<3)^(y>>>6|m<<26),A+=p&65535,E+=p>>>16,w+=l&65535,I+=l>>>16,E+=A>>>16,w+=E>>>16,I+=w>>>16,a[z]=w&65535|I<<16,f[z]=A&65535|E<<16}l=S,p=$,A=p&65535,E=p>>>16,w=l&65535,I=l>>>16,l=u[0],p=h[0],A+=p&65535,E+=p>>>16,w+=l&65535,I+=l>>>16,E+=A>>>16,w+=E>>>16,I+=w>>>16,u[0]=S=w&65535|I<<16,h[0]=$=A&65535|E<<16,l=C,p=R,A=p&65535,E=p>>>16,w=l&65535,I=l>>>16,l=u[1],p=h[1],A+=p&65535,E+=p>>>16,w+=l&65535,I+=l>>>16,E+=A>>>16,w+=E>>>16,I+=w>>>16,u[1]=C=w&65535|I<<16,h[1]=R=A&65535|E<<16,l=D,p=W,A=p&65535,E=p>>>16,w=l&65535,I=l>>>16,l=u[2],p=h[2],A+=p&65535,E+=p>>>16,w+=l&65535,I+=l>>>16,E+=A>>>16,w+=E>>>16,I+=w>>>16,u[2]=D=w&65535|I<<16,h[2]=W=A&65535|E<<16,l=B,p=V,A=p&65535,E=p>>>16,w=l&65535,I=l>>>16,l=u[3],p=h[3],A+=p&65535,E+=p>>>16,w+=l&65535,I+=l>>>16,E+=A>>>16,w+=E>>>16,I+=w>>>16,u[3]=B=w&65535|I<<16,h[3]=V=A&65535|E<<16,l=L,p=X,A=p&65535,E=p>>>16,w=l&65535,I=l>>>16,l=u[4],p=h[4],A+=p&65535,E+=p>>>16,w+=l&65535,I+=l>>>16,E+=A>>>16,w+=E>>>16,I+=w>>>16,u[4]=L=w&65535|I<<16,h[4]=X=A&65535|E<<16,l=H,p=q,A=p&65535,E=p>>>16,w=l&65535,I=l>>>16,l=u[5],p=h[5],A+=p&65535,E+=p>>>16,w+=l&65535,I+=l>>>16,E+=A>>>16,w+=E>>>16,I+=w>>>16,u[5]=H=w&65535|I<<16,h[5]=q=A&65535|E<<16,l=F,p=_,A=p&65535,E=p>>>16,w=l&65535,I=l>>>16,l=u[6],p=h[6],A+=p&65535,E+=p>>>16,w+=l&65535,I+=l>>>16,E+=A>>>16,w+=E>>>16,I+=w>>>16,u[6]=F=w&65535|I<<16,h[6]=_=A&65535|E<<16,l=k,p=v,A=p&65535,E=p>>>16,w=l&65535,I=l>>>16,l=u[7],p=h[7],A+=p&65535,E+=p>>>16,w+=l&65535,I+=l>>>16,E+=A>>>16,w+=E>>>16,I+=w>>>16,u[7]=k=w&65535|I<<16,h[7]=v=A&65535|E<<16,b+=128,x-=128}return b}function o(a){var f=new n;f.update(a);var u=f.digest();return f.clean(),u}t.hash=o})(ag)),ag}var R2;function yT(){return R2||(R2=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=og(),r=bT(),n=ns();t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(ee){const Z=new Float64Array(16);if(ee)for(let te=0;te>16&1),te[de-1]&=65535;te[15]=N[15]-32767-(te[14]>>16&1);const ne=te[15]>>16&1;te[14]&=65535,C(N,te,1-ne)}for(let Q=0;Q<16;Q++)ee[2*Q]=N[Q]&255,ee[2*Q+1]=N[Q]>>8}function B(ee,Z){let te=0;for(let N=0;N<32;N++)te|=ee[N]^Z[N];return(1&te-1>>>8)-1}function L(ee,Z){const te=new Uint8Array(32),N=new Uint8Array(32);return D(te,ee),D(N,Z),B(te,N)}function H(ee){const Z=new Uint8Array(32);return D(Z,ee),Z[0]&1}function F(ee,Z){for(let te=0;te<16;te++)ee[te]=Z[2*te]+(Z[2*te+1]<<8);ee[15]&=32767}function k(ee,Z,te){for(let N=0;N<16;N++)ee[N]=Z[N]+te[N]}function $(ee,Z,te){for(let N=0;N<16;N++)ee[N]=Z[N]-te[N]}function R(ee,Z,te){let N,Q,ne=0,de=0,ce=0,fe=0,be=0,Pe=0,De=0,Te=0,Fe=0,Me=0,Ne=0,He=0,Oe=0,$e=0,qe=0,_e=0,Qe=0,at=0,Be=0,nt=0,it=0,Ye=0,pt=0,ht=0,ft=0,Ht=0,Jt=0,St=0,Xt=0,tr=0,Dt=0,Bt=te[0],Ct=te[1],gt=te[2],Ot=te[3],Lt=te[4],bt=te[5],jt=te[6],Ut=te[7],tt=te[8],Ft=te[9],K=te[10],G=te[11],J=te[12],T=te[13],j=te[14],oe=te[15];N=Z[0],ne+=N*Bt,de+=N*Ct,ce+=N*gt,fe+=N*Ot,be+=N*Lt,Pe+=N*bt,De+=N*jt,Te+=N*Ut,Fe+=N*tt,Me+=N*Ft,Ne+=N*K,He+=N*G,Oe+=N*J,$e+=N*T,qe+=N*j,_e+=N*oe,N=Z[1],de+=N*Bt,ce+=N*Ct,fe+=N*gt,be+=N*Ot,Pe+=N*Lt,De+=N*bt,Te+=N*jt,Fe+=N*Ut,Me+=N*tt,Ne+=N*Ft,He+=N*K,Oe+=N*G,$e+=N*J,qe+=N*T,_e+=N*j,Qe+=N*oe,N=Z[2],ce+=N*Bt,fe+=N*Ct,be+=N*gt,Pe+=N*Ot,De+=N*Lt,Te+=N*bt,Fe+=N*jt,Me+=N*Ut,Ne+=N*tt,He+=N*Ft,Oe+=N*K,$e+=N*G,qe+=N*J,_e+=N*T,Qe+=N*j,at+=N*oe,N=Z[3],fe+=N*Bt,be+=N*Ct,Pe+=N*gt,De+=N*Ot,Te+=N*Lt,Fe+=N*bt,Me+=N*jt,Ne+=N*Ut,He+=N*tt,Oe+=N*Ft,$e+=N*K,qe+=N*G,_e+=N*J,Qe+=N*T,at+=N*j,Be+=N*oe,N=Z[4],be+=N*Bt,Pe+=N*Ct,De+=N*gt,Te+=N*Ot,Fe+=N*Lt,Me+=N*bt,Ne+=N*jt,He+=N*Ut,Oe+=N*tt,$e+=N*Ft,qe+=N*K,_e+=N*G,Qe+=N*J,at+=N*T,Be+=N*j,nt+=N*oe,N=Z[5],Pe+=N*Bt,De+=N*Ct,Te+=N*gt,Fe+=N*Ot,Me+=N*Lt,Ne+=N*bt,He+=N*jt,Oe+=N*Ut,$e+=N*tt,qe+=N*Ft,_e+=N*K,Qe+=N*G,at+=N*J,Be+=N*T,nt+=N*j,it+=N*oe,N=Z[6],De+=N*Bt,Te+=N*Ct,Fe+=N*gt,Me+=N*Ot,Ne+=N*Lt,He+=N*bt,Oe+=N*jt,$e+=N*Ut,qe+=N*tt,_e+=N*Ft,Qe+=N*K,at+=N*G,Be+=N*J,nt+=N*T,it+=N*j,Ye+=N*oe,N=Z[7],Te+=N*Bt,Fe+=N*Ct,Me+=N*gt,Ne+=N*Ot,He+=N*Lt,Oe+=N*bt,$e+=N*jt,qe+=N*Ut,_e+=N*tt,Qe+=N*Ft,at+=N*K,Be+=N*G,nt+=N*J,it+=N*T,Ye+=N*j,pt+=N*oe,N=Z[8],Fe+=N*Bt,Me+=N*Ct,Ne+=N*gt,He+=N*Ot,Oe+=N*Lt,$e+=N*bt,qe+=N*jt,_e+=N*Ut,Qe+=N*tt,at+=N*Ft,Be+=N*K,nt+=N*G,it+=N*J,Ye+=N*T,pt+=N*j,ht+=N*oe,N=Z[9],Me+=N*Bt,Ne+=N*Ct,He+=N*gt,Oe+=N*Ot,$e+=N*Lt,qe+=N*bt,_e+=N*jt,Qe+=N*Ut,at+=N*tt,Be+=N*Ft,nt+=N*K,it+=N*G,Ye+=N*J,pt+=N*T,ht+=N*j,ft+=N*oe,N=Z[10],Ne+=N*Bt,He+=N*Ct,Oe+=N*gt,$e+=N*Ot,qe+=N*Lt,_e+=N*bt,Qe+=N*jt,at+=N*Ut,Be+=N*tt,nt+=N*Ft,it+=N*K,Ye+=N*G,pt+=N*J,ht+=N*T,ft+=N*j,Ht+=N*oe,N=Z[11],He+=N*Bt,Oe+=N*Ct,$e+=N*gt,qe+=N*Ot,_e+=N*Lt,Qe+=N*bt,at+=N*jt,Be+=N*Ut,nt+=N*tt,it+=N*Ft,Ye+=N*K,pt+=N*G,ht+=N*J,ft+=N*T,Ht+=N*j,Jt+=N*oe,N=Z[12],Oe+=N*Bt,$e+=N*Ct,qe+=N*gt,_e+=N*Ot,Qe+=N*Lt,at+=N*bt,Be+=N*jt,nt+=N*Ut,it+=N*tt,Ye+=N*Ft,pt+=N*K,ht+=N*G,ft+=N*J,Ht+=N*T,Jt+=N*j,St+=N*oe,N=Z[13],$e+=N*Bt,qe+=N*Ct,_e+=N*gt,Qe+=N*Ot,at+=N*Lt,Be+=N*bt,nt+=N*jt,it+=N*Ut,Ye+=N*tt,pt+=N*Ft,ht+=N*K,ft+=N*G,Ht+=N*J,Jt+=N*T,St+=N*j,Xt+=N*oe,N=Z[14],qe+=N*Bt,_e+=N*Ct,Qe+=N*gt,at+=N*Ot,Be+=N*Lt,nt+=N*bt,it+=N*jt,Ye+=N*Ut,pt+=N*tt,ht+=N*Ft,ft+=N*K,Ht+=N*G,Jt+=N*J,St+=N*T,Xt+=N*j,tr+=N*oe,N=Z[15],_e+=N*Bt,Qe+=N*Ct,at+=N*gt,Be+=N*Ot,nt+=N*Lt,it+=N*bt,Ye+=N*jt,pt+=N*Ut,ht+=N*tt,ft+=N*Ft,Ht+=N*K,Jt+=N*G,St+=N*J,Xt+=N*T,tr+=N*j,Dt+=N*oe,ne+=38*Qe,de+=38*at,ce+=38*Be,fe+=38*nt,be+=38*it,Pe+=38*Ye,De+=38*pt,Te+=38*ht,Fe+=38*ft,Me+=38*Ht,Ne+=38*Jt,He+=38*St,Oe+=38*Xt,$e+=38*tr,qe+=38*Dt,Q=1,N=ne+Q+65535,Q=Math.floor(N/65536),ne=N-Q*65536,N=de+Q+65535,Q=Math.floor(N/65536),de=N-Q*65536,N=ce+Q+65535,Q=Math.floor(N/65536),ce=N-Q*65536,N=fe+Q+65535,Q=Math.floor(N/65536),fe=N-Q*65536,N=be+Q+65535,Q=Math.floor(N/65536),be=N-Q*65536,N=Pe+Q+65535,Q=Math.floor(N/65536),Pe=N-Q*65536,N=De+Q+65535,Q=Math.floor(N/65536),De=N-Q*65536,N=Te+Q+65535,Q=Math.floor(N/65536),Te=N-Q*65536,N=Fe+Q+65535,Q=Math.floor(N/65536),Fe=N-Q*65536,N=Me+Q+65535,Q=Math.floor(N/65536),Me=N-Q*65536,N=Ne+Q+65535,Q=Math.floor(N/65536),Ne=N-Q*65536,N=He+Q+65535,Q=Math.floor(N/65536),He=N-Q*65536,N=Oe+Q+65535,Q=Math.floor(N/65536),Oe=N-Q*65536,N=$e+Q+65535,Q=Math.floor(N/65536),$e=N-Q*65536,N=qe+Q+65535,Q=Math.floor(N/65536),qe=N-Q*65536,N=_e+Q+65535,Q=Math.floor(N/65536),_e=N-Q*65536,ne+=Q-1+37*(Q-1),Q=1,N=ne+Q+65535,Q=Math.floor(N/65536),ne=N-Q*65536,N=de+Q+65535,Q=Math.floor(N/65536),de=N-Q*65536,N=ce+Q+65535,Q=Math.floor(N/65536),ce=N-Q*65536,N=fe+Q+65535,Q=Math.floor(N/65536),fe=N-Q*65536,N=be+Q+65535,Q=Math.floor(N/65536),be=N-Q*65536,N=Pe+Q+65535,Q=Math.floor(N/65536),Pe=N-Q*65536,N=De+Q+65535,Q=Math.floor(N/65536),De=N-Q*65536,N=Te+Q+65535,Q=Math.floor(N/65536),Te=N-Q*65536,N=Fe+Q+65535,Q=Math.floor(N/65536),Fe=N-Q*65536,N=Me+Q+65535,Q=Math.floor(N/65536),Me=N-Q*65536,N=Ne+Q+65535,Q=Math.floor(N/65536),Ne=N-Q*65536,N=He+Q+65535,Q=Math.floor(N/65536),He=N-Q*65536,N=Oe+Q+65535,Q=Math.floor(N/65536),Oe=N-Q*65536,N=$e+Q+65535,Q=Math.floor(N/65536),$e=N-Q*65536,N=qe+Q+65535,Q=Math.floor(N/65536),qe=N-Q*65536,N=_e+Q+65535,Q=Math.floor(N/65536),_e=N-Q*65536,ne+=Q-1+37*(Q-1),ee[0]=ne,ee[1]=de,ee[2]=ce,ee[3]=fe,ee[4]=be,ee[5]=Pe,ee[6]=De,ee[7]=Te,ee[8]=Fe,ee[9]=Me,ee[10]=Ne,ee[11]=He,ee[12]=Oe,ee[13]=$e,ee[14]=qe,ee[15]=_e}function W(ee,Z){R(ee,Z,Z)}function V(ee,Z){const te=i();let N;for(N=0;N<16;N++)te[N]=Z[N];for(N=253;N>=0;N--)W(te,te),N!==2&&N!==4&&R(te,te,Z);for(N=0;N<16;N++)ee[N]=te[N]}function X(ee,Z){const te=i();let N;for(N=0;N<16;N++)te[N]=Z[N];for(N=250;N>=0;N--)W(te,te),N!==1&&R(te,te,Z);for(N=0;N<16;N++)ee[N]=te[N]}function q(ee,Z){const te=i(),N=i(),Q=i(),ne=i(),de=i(),ce=i(),fe=i(),be=i(),Pe=i();$(te,ee[1],ee[0]),$(Pe,Z[1],Z[0]),R(te,te,Pe),k(N,ee[0],ee[1]),k(Pe,Z[0],Z[1]),R(N,N,Pe),R(Q,ee[3],Z[3]),R(Q,Q,u),R(ne,ee[2],Z[2]),k(ne,ne,ne),$(de,N,te),$(ce,ne,Q),k(fe,ne,Q),k(be,N,te),R(ee[0],de,ce),R(ee[1],be,fe),R(ee[2],fe,ce),R(ee[3],de,be)}function _(ee,Z,te){for(let N=0;N<4;N++)C(ee[N],Z[N],te)}function v(ee,Z){const te=i(),N=i(),Q=i();V(Q,Z[2]),R(te,Z[0],Q),R(N,Z[1],Q),D(ee,N),ee[31]^=H(te)<<7}function l(ee,Z,te){x(ee[0],o),x(ee[1],a),x(ee[2],a),x(ee[3],o);for(let N=255;N>=0;--N){const Q=te[N/8|0]>>(N&7)&1;_(ee,Z,Q),q(Z,ee),q(ee,ee),_(ee,Z,Q)}}function p(ee,Z){const te=[i(),i(),i(),i()];x(te[0],h),x(te[1],g),x(te[2],a),R(te[3],h,g),l(ee,te,Z)}function m(ee){if(ee.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const Z=(0,r.hash)(ee);Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(32),N=[i(),i(),i(),i()];p(N,Z),v(te,N);const Q=new Uint8Array(64);return Q.set(ee),Q.set(te,32),{publicKey:te,secretKey:Q}}t.generateKeyPairFromSeed=m;function y(ee){const Z=(0,e.randomBytes)(32,ee),te=m(Z);return(0,n.wipe)(Z),te}t.generateKeyPair=y;function A(ee){if(ee.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(ee.subarray(32))}t.extractPublicKeyFromSecretKey=A;const E=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function w(ee,Z){let te,N,Q,ne;for(N=63;N>=32;--N){for(te=0,Q=N-32,ne=N-12;Q>4)*E[Q],te=Z[Q]>>8,Z[Q]&=255;for(Q=0;Q<32;Q++)Z[Q]-=te*E[Q];for(N=0;N<32;N++)Z[N+1]+=Z[N]>>8,ee[N]=Z[N]&255}function I(ee){const Z=new Float64Array(64);for(let te=0;te<64;te++)Z[te]=ee[te];for(let te=0;te<64;te++)ee[te]=0;w(ee,Z)}function M(ee,Z){const te=new Float64Array(64),N=[i(),i(),i(),i()],Q=(0,r.hash)(ee.subarray(0,32));Q[0]&=248,Q[31]&=127,Q[31]|=64;const ne=new Uint8Array(64);ne.set(Q.subarray(32),32);const de=new r.SHA512;de.update(ne.subarray(32)),de.update(Z);const ce=de.digest();de.clean(),I(ce),p(N,ce),v(ne,N),de.reset(),de.update(ne.subarray(0,32)),de.update(ee.subarray(32)),de.update(Z);const fe=de.digest();I(fe);for(let be=0;be<32;be++)te[be]=ce[be];for(let be=0;be<32;be++)for(let Pe=0;Pe<32;Pe++)te[be+Pe]+=fe[be]*Q[Pe];return w(ne.subarray(32),te),ne}t.sign=M;function z(ee,Z){const te=i(),N=i(),Q=i(),ne=i(),de=i(),ce=i(),fe=i();return x(ee[2],a),F(ee[1],Z),W(Q,ee[1]),R(ne,Q,f),$(Q,Q,ee[2]),k(ne,ee[2],ne),W(de,ne),W(ce,de),R(fe,ce,de),R(te,fe,Q),R(te,te,ne),X(te,te),R(te,te,Q),R(te,te,ne),R(te,te,ne),R(ee[0],te,ne),W(N,ee[0]),R(N,N,ne),L(N,Q)&&R(ee[0],ee[0],b),W(N,ee[0]),R(N,N,ne),L(N,Q)?-1:(H(ee[0])===Z[31]>>7&&$(ee[0],o,ee[0]),R(ee[3],ee[0],ee[1]),0)}function se(ee,Z,te){const N=new Uint8Array(32),Q=[i(),i(),i(),i()],ne=[i(),i(),i(),i()];if(te.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(z(ne,ee))return!1;const de=new r.SHA512;de.update(te.subarray(0,32)),de.update(ee),de.update(Z);const ce=de.digest();return I(ce),l(Q,ne,ce),p(ne,te.subarray(32)),q(Q,ne),v(N,Q),!B(te,N)}t.verify=se;function O(ee){let Z=[i(),i(),i(),i()];if(z(Z,ee))throw new Error("Ed25519: invalid public key");let te=i(),N=i(),Q=Z[1];k(te,a,Q),$(N,a,Q),V(N,N),R(te,te,N);let ne=new Uint8Array(32);return D(ne,te),ne}t.convertPublicKeyToX25519=O;function ie(ee){const Z=(0,r.hash)(ee.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(Z.subarray(0,32));return(0,n.wipe)(Z),te}t.convertSecretKeyToX25519=ie})(ng)),ng}var T2=yT(),tf=og();const wT="EdDSA",xT="JWT",ph=".",gh="base64url",D2="utf8",O2="utf8",_T=":",ET="did",ST="key",N2="base58btc",AT="z",PT="K36",IT=32;function L2(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function mh(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=L2(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function MT(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,F=new Uint8Array(H);B!==L;){for(var k=S[B],$=0,R=H-1;(k!==0||$>>0,F[R]=k%a>>>0,k=k/a>>>0;if(k!==0)throw new Error("Non-zero carry");D=$,B++}for(var W=H-D;W!==H&&F[W]===0;)W++;for(var V=f.repeat(C);W>>0,H=new Uint8Array(L);S[C];){var F=r[S.charCodeAt(C)];if(F===255)return;for(var k=0,$=L-1;(F!==0||k>>0,H[$]=F%256>>>0,F=F/256>>>0;if(F!==0)throw new Error("Non-zero carry");B=k,C++}if(S[C]!==" "){for(var R=L-B;R!==L&&H[R]===0;)R++;for(var W=new Uint8Array(D+(L-R)),V=D;R!==L;)W[V++]=H[R++];return W}}}function x(S){var C=b(S);if(C)return C;throw new Error(`Non-${e} character`)}return{encode:g,decodeUnsafe:b,decode:x}}var CT=MT,RT=CT;const TT=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},DT=t=>new TextEncoder().encode(t),OT=t=>new TextDecoder().decode(t);class NT{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class LT{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return k2(this,e)}}class kT{constructor(e){this.decoders=e}or(e){return k2(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const k2=(t,e)=>new kT({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class BT{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new NT(e,r,n),this.decoder=new LT(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const vh=({name:t,prefix:e,encode:r,decode:n})=>new BT(t,e,r,n),rf=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=RT(r,e);return vh({prefix:t,name:e,encode:n,decode:s=>TT(i(s))})},FT=(t,e,r,n)=>{const i={};for(let h=0;h=8&&(a-=8,o[u++]=255&f>>a)}if(a>=r||255&f<<8-a)throw new SyntaxError("Unexpected end of data");return o},jT=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<vh({prefix:e,name:t,encode(i){return jT(i,n,r)},decode(i){return FT(i,n,r,t)}}),UT=vh({prefix:"\0",name:"identity",encode:t=>OT(t),decode:t=>DT(t)}),$T=Object.freeze(Object.defineProperty({__proto__:null,identity:UT},Symbol.toStringTag,{value:"Module"})),qT=Tn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),zT=Object.freeze(Object.defineProperty({__proto__:null,base2:qT},Symbol.toStringTag,{value:"Module"})),HT=Tn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),WT=Object.freeze(Object.defineProperty({__proto__:null,base8:HT},Symbol.toStringTag,{value:"Module"})),KT=rf({prefix:"9",name:"base10",alphabet:"0123456789"}),VT=Object.freeze(Object.defineProperty({__proto__:null,base10:KT},Symbol.toStringTag,{value:"Module"})),GT=Tn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),YT=Tn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),JT=Object.freeze(Object.defineProperty({__proto__:null,base16:GT,base16upper:YT},Symbol.toStringTag,{value:"Module"})),XT=Tn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ZT=Tn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),QT=Tn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),eD=Tn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),tD=Tn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),rD=Tn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),nD=Tn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),iD=Tn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),sD=Tn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),oD=Object.freeze(Object.defineProperty({__proto__:null,base32:XT,base32hex:tD,base32hexpad:nD,base32hexpadupper:iD,base32hexupper:rD,base32pad:QT,base32padupper:eD,base32upper:ZT,base32z:sD},Symbol.toStringTag,{value:"Module"})),aD=rf({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),cD=rf({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),uD=Object.freeze(Object.defineProperty({__proto__:null,base36:aD,base36upper:cD},Symbol.toStringTag,{value:"Module"})),fD=rf({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),lD=rf({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),hD=Object.freeze(Object.defineProperty({__proto__:null,base58btc:fD,base58flickr:lD},Symbol.toStringTag,{value:"Module"})),dD=Tn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),pD=Tn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),gD=Tn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),mD=Tn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),vD=Object.freeze(Object.defineProperty({__proto__:null,base64:dD,base64pad:pD,base64url:gD,base64urlpad:mD},Symbol.toStringTag,{value:"Module"})),B2=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),bD=B2.reduce((t,e,r)=>(t[r]=e,t),[]),yD=B2.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function wD(t){return t.reduce((e,r)=>(e+=bD[r],e),"")}function xD(t){const e=[];for(const r of t){const n=yD[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const _D=vh({prefix:"🚀",name:"base256emoji",encode:wD,decode:xD}),ED=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:_D},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const F2={...$T,...zT,...WT,...VT,...JT,...oD,...uD,...hD,...vD,...ED};function j2(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const U2=j2("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),cg=j2("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=L2(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new OD:typeof navigator<"u"?jD(navigator.userAgent):$D()}function FD(t){return t!==""&&kD.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function jD(t){var e=FD(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new DD;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length-1){const L=D.getAttribute("href");if(L)if(L.toLowerCase().indexOf("https:")===-1&&L.toLowerCase().indexOf("http:")===-1&&L.indexOf("//")!==0){let H=n.protocol+"//"+n.host;if(L.indexOf("/")===0)H+=L;else{const F=n.pathname.split("/");F.pop();const k=F.join("/");H+=k+"/"+L}S.push(H)}else if(L.indexOf("//")===0){const H=n.protocol+L;S.push(H)}else S.push(L)}}return S}function s(...x){const S=r.getElementsByTagName("meta");for(let C=0;CD.getAttribute(L)).filter(L=>L?x.includes(L):!1);if(B.length&&B){const L=D.getAttribute("content");if(L)return L}}return""}function o(){let x=s("name","og:site_name","og:title","twitter:title");return x||(x=r.title),x}function a(){return s("description","og:description","twitter:description","keywords")}const f=o(),u=a(),h=n.origin,g=i();return{description:u,url:h,icons:g,name:f}}return nf.getWindowMetadata=e,nf}var HD=zD(),fg={},lg,X2;function WD(){return X2||(X2=1,lg=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)),lg}var hg,Z2;function KD(){if(Z2)return hg;Z2=1;var t="%[a-f0-9]{2}",e=new RegExp("("+t+")|([^%]+?)","gi"),r=new RegExp("("+t+")+","gi");function n(o,a){try{return[decodeURIComponent(o.join(""))]}catch{}if(o.length===1)return o;a=a||1;var f=o.slice(0,a),u=o.slice(a);return Array.prototype.concat.call([],n(f),n(u))}function i(o){try{return decodeURIComponent(o)}catch{for(var a=o.match(e)||[],f=1;f{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]}),dg}var pg,ex;function GD(){return ex||(ex=1,pg=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;sL==null,o=Symbol("encodeFragmentIdentifier");function a(L){switch(L.arrayFormat){case"index":return H=>(F,k)=>{const $=F.length;return k===void 0||L.skipNull&&k===null||L.skipEmptyString&&k===""?F:k===null?[...F,[h(H,L),"[",$,"]"].join("")]:[...F,[h(H,L),"[",h($,L),"]=",h(k,L)].join("")]};case"bracket":return H=>(F,k)=>k===void 0||L.skipNull&&k===null||L.skipEmptyString&&k===""?F:k===null?[...F,[h(H,L),"[]"].join("")]:[...F,[h(H,L),"[]=",h(k,L)].join("")];case"colon-list-separator":return H=>(F,k)=>k===void 0||L.skipNull&&k===null||L.skipEmptyString&&k===""?F:k===null?[...F,[h(H,L),":list="].join("")]:[...F,[h(H,L),":list=",h(k,L)].join("")];case"comma":case"separator":case"bracket-separator":{const H=L.arrayFormat==="bracket-separator"?"[]=":"=";return F=>(k,$)=>$===void 0||L.skipNull&&$===null||L.skipEmptyString&&$===""?k:($=$===null?"":$,k.length===0?[[h(F,L),H,h($,L)].join("")]:[[k,h($,L)].join(L.arrayFormatSeparator)])}default:return H=>(F,k)=>k===void 0||L.skipNull&&k===null||L.skipEmptyString&&k===""?F:k===null?[...F,h(H,L)]:[...F,[h(H,L),"=",h(k,L)].join("")]}}function f(L){let H;switch(L.arrayFormat){case"index":return(F,k,$)=>{if(H=/\[(\d*)\]$/.exec(F),F=F.replace(/\[\d*\]$/,""),!H){$[F]=k;return}$[F]===void 0&&($[F]={}),$[F][H[1]]=k};case"bracket":return(F,k,$)=>{if(H=/(\[\])$/.exec(F),F=F.replace(/\[\]$/,""),!H){$[F]=k;return}if($[F]===void 0){$[F]=[k];return}$[F]=[].concat($[F],k)};case"colon-list-separator":return(F,k,$)=>{if(H=/(:list)$/.exec(F),F=F.replace(/:list$/,""),!H){$[F]=k;return}if($[F]===void 0){$[F]=[k];return}$[F]=[].concat($[F],k)};case"comma":case"separator":return(F,k,$)=>{const R=typeof k=="string"&&k.includes(L.arrayFormatSeparator),W=typeof k=="string"&&!R&&g(k,L).includes(L.arrayFormatSeparator);k=W?g(k,L):k;const V=R||W?k.split(L.arrayFormatSeparator).map(X=>g(X,L)):k===null?k:g(k,L);$[F]=V};case"bracket-separator":return(F,k,$)=>{const R=/(\[\])$/.test(F);if(F=F.replace(/\[\]$/,""),!R){$[F]=k&&g(k,L);return}const W=k===null?[]:k.split(L.arrayFormatSeparator).map(V=>g(V,L));if($[F]===void 0){$[F]=W;return}$[F]=[].concat($[F],W)};default:return(F,k,$)=>{if($[F]===void 0){$[F]=k;return}$[F]=[].concat($[F],k)}}}function u(L){if(typeof L!="string"||L.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function h(L,H){return H.encode?H.strict?e(L):encodeURIComponent(L):L}function g(L,H){return H.decode?r(L):L}function b(L){return Array.isArray(L)?L.sort():typeof L=="object"?b(Object.keys(L)).sort((H,F)=>Number(H)-Number(F)).map(H=>L[H]):L}function x(L){const H=L.indexOf("#");return H!==-1&&(L=L.slice(0,H)),L}function S(L){let H="";const F=L.indexOf("#");return F!==-1&&(H=L.slice(F)),H}function C(L){L=x(L);const H=L.indexOf("?");return H===-1?"":L.slice(H+1)}function D(L,H){return H.parseNumbers&&!Number.isNaN(Number(L))&&typeof L=="string"&&L.trim()!==""?L=Number(L):H.parseBooleans&&L!==null&&(L.toLowerCase()==="true"||L.toLowerCase()==="false")&&(L=L.toLowerCase()==="true"),L}function B(L,H){H=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},H),u(H.arrayFormatSeparator);const F=f(H),k=Object.create(null);if(typeof L!="string"||(L=L.trim().replace(/^[?#&]/,""),!L))return k;for(const $ of L.split("&")){if($==="")continue;let[R,W]=n(H.decode?$.replace(/\+/g," "):$,"=");W=W===void 0?null:["comma","separator","bracket-separator"].includes(H.arrayFormat)?W:g(W,H),F(g(R,H),W,k)}for(const $ of Object.keys(k)){const R=k[$];if(typeof R=="object"&&R!==null)for(const W of Object.keys(R))R[W]=D(R[W],H);else k[$]=D(R,H)}return H.sort===!1?k:(H.sort===!0?Object.keys(k).sort():Object.keys(k).sort(H.sort)).reduce(($,R)=>{const W=k[R];return W&&typeof W=="object"&&!Array.isArray(W)?$[R]=b(W):$[R]=W,$},Object.create(null))}t.extract=C,t.parse=B,t.stringify=(L,H)=>{if(!L)return"";H=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},H),u(H.arrayFormatSeparator);const F=W=>H.skipNull&&s(L[W])||H.skipEmptyString&&L[W]==="",k=a(H),$={};for(const W of Object.keys(L))F(W)||($[W]=L[W]);const R=Object.keys($);return H.sort!==!1&&R.sort(H.sort),R.map(W=>{const V=L[W];return V===void 0?"":V===null?h(W,H):Array.isArray(V)?V.length===0&&H.arrayFormat==="bracket-separator"?h(W,H)+"[]":V.reduce(k(W),[]).join("&"):h(W,H)+"="+h(V,H)}).filter(W=>W.length>0).join("&")},t.parseUrl=(L,H)=>{H=Object.assign({decode:!0},H);const[F,k]=n(L,"#");return Object.assign({url:F.split("?")[0]||"",query:B(C(L),H)},H&&H.parseFragmentIdentifier&&k?{fragmentIdentifier:g(k,H)}:{})},t.stringifyUrl=(L,H)=>{H=Object.assign({encode:!0,strict:!0,[o]:!0},H);const F=x(L.url).split("?")[0]||"",k=t.extract(L.url),$=t.parse(k,{sort:!1}),R=Object.assign($,L.query);let W=t.stringify(R,H);W&&(W=`?${W}`);let V=S(L.url);return L.fragmentIdentifier&&(V=`#${H[o]?h(L.fragmentIdentifier,H):L.fragmentIdentifier}`),`${F}${W}${V}`},t.pick=(L,H,F)=>{F=Object.assign({parseFragmentIdentifier:!0,[o]:!1},F);const{url:k,query:$,fragmentIdentifier:R}=t.parseUrl(L,F);return t.stringifyUrl({url:k,query:i($,H),fragmentIdentifier:R},F)},t.exclude=(L,H,F)=>{const k=Array.isArray(H)?$=>!H.includes($):($,R)=>!H($,R);return t.pick(L,k,F)}})(fg)),fg}var yh=YD(),gg={exports:{}};/** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.8.0 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT - */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=nn:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],p=[4,1024,262144,67108864],y=[1,256,65536,16777216],_=[6,1536,393216,100663296],M=[0,8,16,24],O=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],L=[224,256,384,512],B=[128,256],k=["hex","buffer","arrayBuffer","array","digest"],H={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(D){return Object.prototype.toString.call(D)==="[object Array]"}),u&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(D){return typeof D=="object"&&D.buffer&&D.buffer.constructor===ArrayBuffer});for(var U=function(D,se,ee){return function(J){return new I(D,se,D).update(J)[ee]()}},z=function(D,se,ee){return function(J,Q){return new I(D,se,Q).update(J)[ee]()}},Z=function(D,se,ee){return function(J,Q,T,X){return f["cshake"+D].update(J,Q,T,X)[ee]()}},R=function(D,se,ee){return function(J,Q,T,X){return f["kmac"+D].update(J,Q,T,X)[ee]()}},W=function(D,se,ee,J){for(var Q=0;Q>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ee>>5,this.extraBytes=(ee&31)>>3;for(var J=0;J<50;++J)this.s[J]=0}I.prototype.update=function(D){if(this.finalized)throw new Error(r);var se,ee=typeof D;if(ee!=="string"){if(ee==="object"){if(D===null)throw new Error(e);if(u&&D.constructor===ArrayBuffer)D=new Uint8Array(D);else if(!Array.isArray(D)&&(!u||!ArrayBuffer.isView(D)))throw new Error(e)}else throw new Error(e);se=!0}for(var J=this.blocks,Q=this.byteCount,T=D.length,X=this.blockCount,re=0,ge=this.s,oe,fe;re>2]|=D[re]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(J[oe>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=Q){for(this.start=oe-Q,this.block=J[X],oe=0;oe>8,ee=D&255;ee>0;)Q.unshift(ee),D=D>>8,ee=D&255,++J;return se?Q.push(J):Q.unshift(J),this.update(Q),Q.length},I.prototype.encodeString=function(D){var se,ee=typeof D;if(ee!=="string"){if(ee==="object"){if(D===null)throw new Error(e);if(u&&D.constructor===ArrayBuffer)D=new Uint8Array(D);else if(!Array.isArray(D)&&(!u||!ArrayBuffer.isView(D)))throw new Error(e)}else throw new Error(e);se=!0}var J=0,Q=D.length;if(se)J=Q;else for(var T=0;T=57344?J+=3:(X=65536+((X&1023)<<10|D.charCodeAt(++T)&1023),J+=4)}return J+=this.encode(J*8),this.update(D),J},I.prototype.bytepad=function(D,se){for(var ee=this.encode(se),J=0;J>2]|=this.padding[se&3],this.lastByteIndex===this.byteCount)for(D[0]=D[ee],se=1;se>4&15]+l[re&15]+l[re>>12&15]+l[re>>8&15]+l[re>>20&15]+l[re>>16&15]+l[re>>28&15]+l[re>>24&15];T%D===0&&(ce(se),Q=0)}return J&&(re=se[Q],X+=l[re>>4&15]+l[re&15],J>1&&(X+=l[re>>12&15]+l[re>>8&15]),J>2&&(X+=l[re>>20&15]+l[re>>16&15])),X},I.prototype.arrayBuffer=function(){this.finalize();var D=this.blockCount,se=this.s,ee=this.outputBlocks,J=this.extraBytes,Q=0,T=0,X=this.outputBits>>3,re;J?re=new ArrayBuffer(ee+1<<2):re=new ArrayBuffer(X);for(var ge=new Uint32Array(re);T>8&255,X[re+2]=ge>>16&255,X[re+3]=ge>>24&255;T%D===0&&ce(se)}return J&&(re=T<<2,ge=se[Q],X[re]=ge&255,J>1&&(X[re+1]=ge>>8&255),J>2&&(X[re+2]=ge>>16&255)),X};function F(D,se,ee){I.call(this,D,se,ee)}F.prototype=new I,F.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var ce=function(D){var se,ee,J,Q,T,X,re,ge,oe,fe,be,Me,Ne,Te,$e,Ie,Le,Ve,ke,ze,He,Se,Qe,ct,Be,et,rt,Je,gt,ht,ft,Ht,Jt,St,er,Xt,Ot,Bt,Tt,bt,Dt,Lt,yt,$t,jt,nt,Ft,$,K,G,C,Y,q,ae,pe,_e,Re,De,it,Ue,mt,st,tt;for(J=0;J<48;J+=2)Q=D[0]^D[10]^D[20]^D[30]^D[40],T=D[1]^D[11]^D[21]^D[31]^D[41],X=D[2]^D[12]^D[22]^D[32]^D[42],re=D[3]^D[13]^D[23]^D[33]^D[43],ge=D[4]^D[14]^D[24]^D[34]^D[44],oe=D[5]^D[15]^D[25]^D[35]^D[45],fe=D[6]^D[16]^D[26]^D[36]^D[46],be=D[7]^D[17]^D[27]^D[37]^D[47],Me=D[8]^D[18]^D[28]^D[38]^D[48],Ne=D[9]^D[19]^D[29]^D[39]^D[49],se=Me^(X<<1|re>>>31),ee=Ne^(re<<1|X>>>31),D[0]^=se,D[1]^=ee,D[10]^=se,D[11]^=ee,D[20]^=se,D[21]^=ee,D[30]^=se,D[31]^=ee,D[40]^=se,D[41]^=ee,se=Q^(ge<<1|oe>>>31),ee=T^(oe<<1|ge>>>31),D[2]^=se,D[3]^=ee,D[12]^=se,D[13]^=ee,D[22]^=se,D[23]^=ee,D[32]^=se,D[33]^=ee,D[42]^=se,D[43]^=ee,se=X^(fe<<1|be>>>31),ee=re^(be<<1|fe>>>31),D[4]^=se,D[5]^=ee,D[14]^=se,D[15]^=ee,D[24]^=se,D[25]^=ee,D[34]^=se,D[35]^=ee,D[44]^=se,D[45]^=ee,se=ge^(Me<<1|Ne>>>31),ee=oe^(Ne<<1|Me>>>31),D[6]^=se,D[7]^=ee,D[16]^=se,D[17]^=ee,D[26]^=se,D[27]^=ee,D[36]^=se,D[37]^=ee,D[46]^=se,D[47]^=ee,se=fe^(Q<<1|T>>>31),ee=be^(T<<1|Q>>>31),D[8]^=se,D[9]^=ee,D[18]^=se,D[19]^=ee,D[28]^=se,D[29]^=ee,D[38]^=se,D[39]^=ee,D[48]^=se,D[49]^=ee,Te=D[0],$e=D[1],nt=D[11]<<4|D[10]>>>28,Ft=D[10]<<4|D[11]>>>28,Je=D[20]<<3|D[21]>>>29,gt=D[21]<<3|D[20]>>>29,Ue=D[31]<<9|D[30]>>>23,mt=D[30]<<9|D[31]>>>23,Lt=D[40]<<18|D[41]>>>14,yt=D[41]<<18|D[40]>>>14,St=D[2]<<1|D[3]>>>31,er=D[3]<<1|D[2]>>>31,Ie=D[13]<<12|D[12]>>>20,Le=D[12]<<12|D[13]>>>20,$=D[22]<<10|D[23]>>>22,K=D[23]<<10|D[22]>>>22,ht=D[33]<<13|D[32]>>>19,ft=D[32]<<13|D[33]>>>19,st=D[42]<<2|D[43]>>>30,tt=D[43]<<2|D[42]>>>30,ae=D[5]<<30|D[4]>>>2,pe=D[4]<<30|D[5]>>>2,Xt=D[14]<<6|D[15]>>>26,Ot=D[15]<<6|D[14]>>>26,Ve=D[25]<<11|D[24]>>>21,ke=D[24]<<11|D[25]>>>21,G=D[34]<<15|D[35]>>>17,C=D[35]<<15|D[34]>>>17,Ht=D[45]<<29|D[44]>>>3,Jt=D[44]<<29|D[45]>>>3,ct=D[6]<<28|D[7]>>>4,Be=D[7]<<28|D[6]>>>4,_e=D[17]<<23|D[16]>>>9,Re=D[16]<<23|D[17]>>>9,Bt=D[26]<<25|D[27]>>>7,Tt=D[27]<<25|D[26]>>>7,ze=D[36]<<21|D[37]>>>11,He=D[37]<<21|D[36]>>>11,Y=D[47]<<24|D[46]>>>8,q=D[46]<<24|D[47]>>>8,$t=D[8]<<27|D[9]>>>5,jt=D[9]<<27|D[8]>>>5,et=D[18]<<20|D[19]>>>12,rt=D[19]<<20|D[18]>>>12,De=D[29]<<7|D[28]>>>25,it=D[28]<<7|D[29]>>>25,bt=D[38]<<8|D[39]>>>24,Dt=D[39]<<8|D[38]>>>24,Se=D[48]<<14|D[49]>>>18,Qe=D[49]<<14|D[48]>>>18,D[0]=Te^~Ie&Ve,D[1]=$e^~Le&ke,D[10]=ct^~et&Je,D[11]=Be^~rt>,D[20]=St^~Xt&Bt,D[21]=er^~Ot&Tt,D[30]=$t^~nt&$,D[31]=jt^~Ft&K,D[40]=ae^~_e&De,D[41]=pe^~Re&it,D[2]=Ie^~Ve&ze,D[3]=Le^~ke&He,D[12]=et^~Je&ht,D[13]=rt^~gt&ft,D[22]=Xt^~Bt&bt,D[23]=Ot^~Tt&Dt,D[32]=nt^~$&G,D[33]=Ft^~K&C,D[42]=_e^~De&Ue,D[43]=Re^~it&mt,D[4]=Ve^~ze&Se,D[5]=ke^~He&Qe,D[14]=Je^~ht&Ht,D[15]=gt^~ft&Jt,D[24]=Bt^~bt&Lt,D[25]=Tt^~Dt&yt,D[34]=$^~G&Y,D[35]=K^~C&q,D[44]=De^~Ue&st,D[45]=it^~mt&tt,D[6]=ze^~Se&Te,D[7]=He^~Qe&$e,D[16]=ht^~Ht&ct,D[17]=ft^~Jt&Be,D[26]=bt^~Lt&St,D[27]=Dt^~yt&er,D[36]=G^~Y&$t,D[37]=C^~q&jt,D[46]=Ue^~st&ae,D[47]=mt^~tt&pe,D[8]=Se^~Te&Ie,D[9]=Qe^~$e&Le,D[18]=Ht^~ct&et,D[19]=Jt^~Be&rt,D[28]=Lt^~St&Xt,D[29]=yt^~er&Ot,D[38]=Y^~$t&nt,D[39]=q^~jt&Ft,D[48]=st^~ae&_e,D[49]=tt^~pe&Re,D[0]^=O[J],D[1]^=O[J+1]};if(a)t.exports=f;else for(v=0;v{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const f3=VN();var Cm;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(Cm||(Cm={}));var vs;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(vs||(vs={}));const l3="0123456789abcdef";class Kr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();Cd[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(u3>Cd[n])&&console.log.apply(console,r)}debug(...e){this._log(Kr.levels.DEBUG,e)}info(...e){this._log(Kr.levels.INFO,e)}warn(...e){this._log(Kr.levels.WARNING,e)}makeError(e,r,n){if(c3)return this.makeError("censored error",r,{});r||(r=Kr.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(u=>{const l=n[u];try{if(l instanceof Uint8Array){let d="";for(let p=0;p>4],d+=l3[l[p]&15];i.push(u+"=Uint8Array(0x"+d+")")}else i.push(u+"="+JSON.stringify(l))}catch{i.push(u+"="+JSON.stringify(n[u].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case vs.NUMERIC_FAULT:{o="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case vs.CALL_EXCEPTION:case vs.INSUFFICIENT_FUNDS:case vs.MISSING_NEW:case vs.NONCE_EXPIRED:case vs.REPLACEMENT_UNDERPRICED:case vs.TRANSACTION_REPLACED:case vs.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(u){a[u]=n[u]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Kr.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){f3&&this.throwError("platform missing String.prototype.normalize",Kr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:f3})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Kr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Kr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return Im||(Im=new Kr(KN)),Im}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),a3){if(!e)return;this.globalLogger().throwError("error censorship permanent",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}c3=!!e,a3=!!r}static setLogLevel(e){const r=Cd[e.toLowerCase()];if(r==null){Kr.globalLogger().warn("invalid log level - "+e);return}u3=r}static from(e){return new Kr(e)}}Kr.errors=vs,Kr.levels=Cm;const GN="bytes/5.7.0",sn=new Kr(GN);function h3(t){return!!t.toHexString}function fu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return fu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function YN(t){return $s(t)&&!(t.length%2)||Tm(t)}function d3(t){return typeof t=="number"&&t==t&&t%1===0}function Tm(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!d3(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function bn(t,e){if(e||(e={}),typeof t=="number"){sn.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),fu(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),h3(t)&&(t=t.toHexString()),$s(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":sn.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ibn(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),fu(n)}function XN(t,e){t=bn(t),t.length>e&&sn.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),fu(r)}function $s(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Rm="0123456789abcdef";function Ii(t,e){if(e||(e={}),typeof t=="number"){sn.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=Rm[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),h3(t))return t.toHexString();if($s(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":sn.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Tm(t)){let r="0x";for(let n=0;n>4]+Rm[i&15]}return r}return sn.throwArgumentError("invalid hexlify value","value",t)}function ZN(t){if(typeof t!="string")t=Ii(t);else if(!$s(t)||t.length%2)return null;return(t.length-2)/2}function p3(t,e,r){return typeof t!="string"?t=Ii(t):(!$s(t)||t.length%2)&&sn.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function lu(t,e){for(typeof t!="string"?t=Ii(t):$s(t)||sn.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&sn.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function g3(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(YN(t)){let r=bn(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64))):r.length===65?(e.r=Ii(r.slice(0,32)),e.s=Ii(r.slice(32,64)),e.v=r[64]):sn.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:sn.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Ii(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=XN(bn(e._vs),32);e._vs=Ii(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&sn.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=Ii(i);e.s==null?e.s=o:e.s!==o&&sn.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?sn.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&sn.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!$s(e.r)?sn.throwArgumentError("signature missing or invalid r","signature",t):e.r=lu(e.r,32),e.s==null||!$s(e.s)?sn.throwArgumentError("signature missing or invalid s","signature",t):e.s=lu(e.s,32);const r=bn(e.s);r[0]>=128&&sn.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=Ii(r);e._vs&&($s(e._vs)||sn.throwArgumentError("signature invalid _vs","signature",t),e._vs=lu(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&sn.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Dm(t){return"0x"+WN.keccak_256(bn(t))}var Om={exports:{}};Om.exports,function(t){(function(e,r){function n(m,f){if(!m)throw new Error(f||"Assertion failed")}function i(m,f){m.super_=f;var g=function(){};g.prototype=f.prototype,m.prototype=new g,m.prototype.constructor=m}function s(m,f,g){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((f==="le"||f==="be")&&(g=f,f=10),this._init(m||0,f||10,g||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=il.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,g){return f.cmp(g)>0?f:g},s.min=function(f,g){return f.cmp(g)<0?f:g},s.prototype._init=function(f,g,v){if(typeof f=="number")return this._initNumber(f,g,v);if(typeof f=="object")return this._initArray(f,g,v);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),f=f.toString().replace(/\s+/g,"");var x=0;f[0]==="-"&&(x++,this.negative=1),x=0;x-=3)A=f[x]|f[x-1]<<8|f[x-2]<<16,this.words[S]|=A<>>26-b&67108863,b+=24,b>=26&&(b-=26,S++);else if(v==="le")for(x=0,S=0;x>>26-b&67108863,b+=24,b>=26&&(b-=26,S++);return this._strip()};function a(m,f){var g=m.charCodeAt(f);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+m)}function u(m,f,g){var v=a(m,g);return g-1>=f&&(v|=a(m,g-1)<<4),v}s.prototype._parseHex=function(f,g,v){this.length=Math.ceil((f.length-g)/6),this.words=new Array(this.length);for(var x=0;x=g;x-=2)b=u(f,g,x)<=18?(S-=18,A+=1,this.words[A]|=b>>>26):S+=8;else{var P=f.length-g;for(x=P%2===0?g+1:g;x=18?(S-=18,A+=1,this.words[A]|=b>>>26):S+=8}this._strip()};function l(m,f,g,v){for(var x=0,S=0,A=Math.min(m.length,g),b=f;b=49?S=P-49+10:P>=17?S=P-17+10:S=P,n(P>=0&&S1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{s.prototype.inspect=p}else s.prototype.inspect=p;function p(){return(this.red?""}var y=["","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"],_=[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],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(f,g){f=f||10,g=g|0||1;var v;if(f===16||f==="hex"){v="";for(var x=0,S=0,A=0;A>>24-x&16777215,x+=2,x>=26&&(x-=26,A--),S!==0||A!==this.length-1?v=y[6-P.length]+P+v:v=P+v}for(S!==0&&(v=S.toString(16)+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(f===(f|0)&&f>=2&&f<=36){var I=_[f],F=M[f];v="";var ce=this.clone();for(ce.negative=0;!ce.isZero();){var D=ce.modrn(F).toString(f);ce=ce.idivn(F),ce.isZero()?v=D+v:v=y[I-D.length]+D+v}for(this.isZero()&&(v="0"+v);v.length%g!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,g){return this.toArrayLike(o,f,g)}),s.prototype.toArray=function(f,g){return this.toArrayLike(Array,f,g)};var O=function(f,g){return f.allocUnsafe?f.allocUnsafe(g):new f(g)};s.prototype.toArrayLike=function(f,g,v){this._strip();var x=this.byteLength(),S=v||Math.max(1,x);n(x<=S,"byte array longer than desired length"),n(S>0,"Requested array length <= 0");var A=O(f,S),b=g==="le"?"LE":"BE";return this["_toArrayLike"+b](A,x),A},s.prototype._toArrayLikeLE=function(f,g){for(var v=0,x=0,S=0,A=0;S>8&255),v>16&255),A===6?(v>24&255),x=0,A=0):(x=b>>>24,A+=2)}if(v=0&&(f[v--]=b>>8&255),v>=0&&(f[v--]=b>>16&255),A===6?(v>=0&&(f[v--]=b>>24&255),x=0,A=0):(x=b>>>24,A+=2)}if(v>=0)for(f[v--]=x;v>=0;)f[v--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var g=f,v=0;return g>=4096&&(v+=13,g>>>=13),g>=64&&(v+=7,g>>>=7),g>=8&&(v+=4,g>>>=4),g>=2&&(v+=2,g>>>=2),v+g},s.prototype._zeroBits=function(f){if(f===0)return 26;var g=f,v=0;return g&8191||(v+=13,g>>>=13),g&127||(v+=7,g>>>=7),g&15||(v+=4,g>>>=4),g&3||(v+=2,g>>>=2),g&1||v++,v},s.prototype.bitLength=function(){var f=this.words[this.length-1],g=this._countBits(f);return(this.length-1)*26+g};function L(m){for(var f=new Array(m.bitLength()),g=0;g>>x&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,g=0;gf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var g;this.length>f.length?g=f:g=this;for(var v=0;vf.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var g,v;this.length>f.length?(g=this,v=f):(g=f,v=this);for(var x=0;xf.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var g=Math.ceil(f/26)|0,v=f%26;this._expand(g),v>0&&g--;for(var x=0;x0&&(this.words[x]=~this.words[x]&67108863>>26-v),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,g){n(typeof f=="number"&&f>=0);var v=f/26|0,x=f%26;return this._expand(v+1),g?this.words[v]=this.words[v]|1<f.length?(v=this,x=f):(v=f,x=this);for(var S=0,A=0;A>>26;for(;S!==0&&A>>26;if(this.length=v.length,S!==0)this.words[this.length]=S,this.length++;else if(v!==this)for(;Af.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var g=this.iadd(f);return f.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var v=this.cmp(f);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,S;v>0?(x=this,S=f):(x=f,S=this);for(var A=0,b=0;b>26,this.words[b]=g&67108863;for(;A!==0&&b>26,this.words[b]=g&67108863;if(A===0&&b>>26,ce=P&67108863,D=Math.min(I,f.length-1),se=Math.max(0,I-m.length+1);se<=D;se++){var ee=I-se|0;x=m.words[ee]|0,S=f.words[se]|0,A=x*S+ce,F+=A/67108864|0,ce=A&67108863}g.words[I]=ce|0,P=F|0}return P!==0?g.words[I]=P|0:g.length--,g._strip()}var k=function(f,g,v){var x=f.words,S=g.words,A=v.words,b=0,P,I,F,ce=x[0]|0,D=ce&8191,se=ce>>>13,ee=x[1]|0,J=ee&8191,Q=ee>>>13,T=x[2]|0,X=T&8191,re=T>>>13,ge=x[3]|0,oe=ge&8191,fe=ge>>>13,be=x[4]|0,Me=be&8191,Ne=be>>>13,Te=x[5]|0,$e=Te&8191,Ie=Te>>>13,Le=x[6]|0,Ve=Le&8191,ke=Le>>>13,ze=x[7]|0,He=ze&8191,Se=ze>>>13,Qe=x[8]|0,ct=Qe&8191,Be=Qe>>>13,et=x[9]|0,rt=et&8191,Je=et>>>13,gt=S[0]|0,ht=gt&8191,ft=gt>>>13,Ht=S[1]|0,Jt=Ht&8191,St=Ht>>>13,er=S[2]|0,Xt=er&8191,Ot=er>>>13,Bt=S[3]|0,Tt=Bt&8191,bt=Bt>>>13,Dt=S[4]|0,Lt=Dt&8191,yt=Dt>>>13,$t=S[5]|0,jt=$t&8191,nt=$t>>>13,Ft=S[6]|0,$=Ft&8191,K=Ft>>>13,G=S[7]|0,C=G&8191,Y=G>>>13,q=S[8]|0,ae=q&8191,pe=q>>>13,_e=S[9]|0,Re=_e&8191,De=_e>>>13;v.negative=f.negative^g.negative,v.length=19,P=Math.imul(D,ht),I=Math.imul(D,ft),I=I+Math.imul(se,ht)|0,F=Math.imul(se,ft);var it=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(it>>>26)|0,it&=67108863,P=Math.imul(J,ht),I=Math.imul(J,ft),I=I+Math.imul(Q,ht)|0,F=Math.imul(Q,ft),P=P+Math.imul(D,Jt)|0,I=I+Math.imul(D,St)|0,I=I+Math.imul(se,Jt)|0,F=F+Math.imul(se,St)|0;var Ue=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,P=Math.imul(X,ht),I=Math.imul(X,ft),I=I+Math.imul(re,ht)|0,F=Math.imul(re,ft),P=P+Math.imul(J,Jt)|0,I=I+Math.imul(J,St)|0,I=I+Math.imul(Q,Jt)|0,F=F+Math.imul(Q,St)|0,P=P+Math.imul(D,Xt)|0,I=I+Math.imul(D,Ot)|0,I=I+Math.imul(se,Xt)|0,F=F+Math.imul(se,Ot)|0;var mt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(mt>>>26)|0,mt&=67108863,P=Math.imul(oe,ht),I=Math.imul(oe,ft),I=I+Math.imul(fe,ht)|0,F=Math.imul(fe,ft),P=P+Math.imul(X,Jt)|0,I=I+Math.imul(X,St)|0,I=I+Math.imul(re,Jt)|0,F=F+Math.imul(re,St)|0,P=P+Math.imul(J,Xt)|0,I=I+Math.imul(J,Ot)|0,I=I+Math.imul(Q,Xt)|0,F=F+Math.imul(Q,Ot)|0,P=P+Math.imul(D,Tt)|0,I=I+Math.imul(D,bt)|0,I=I+Math.imul(se,Tt)|0,F=F+Math.imul(se,bt)|0;var st=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(st>>>26)|0,st&=67108863,P=Math.imul(Me,ht),I=Math.imul(Me,ft),I=I+Math.imul(Ne,ht)|0,F=Math.imul(Ne,ft),P=P+Math.imul(oe,Jt)|0,I=I+Math.imul(oe,St)|0,I=I+Math.imul(fe,Jt)|0,F=F+Math.imul(fe,St)|0,P=P+Math.imul(X,Xt)|0,I=I+Math.imul(X,Ot)|0,I=I+Math.imul(re,Xt)|0,F=F+Math.imul(re,Ot)|0,P=P+Math.imul(J,Tt)|0,I=I+Math.imul(J,bt)|0,I=I+Math.imul(Q,Tt)|0,F=F+Math.imul(Q,bt)|0,P=P+Math.imul(D,Lt)|0,I=I+Math.imul(D,yt)|0,I=I+Math.imul(se,Lt)|0,F=F+Math.imul(se,yt)|0;var tt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(tt>>>26)|0,tt&=67108863,P=Math.imul($e,ht),I=Math.imul($e,ft),I=I+Math.imul(Ie,ht)|0,F=Math.imul(Ie,ft),P=P+Math.imul(Me,Jt)|0,I=I+Math.imul(Me,St)|0,I=I+Math.imul(Ne,Jt)|0,F=F+Math.imul(Ne,St)|0,P=P+Math.imul(oe,Xt)|0,I=I+Math.imul(oe,Ot)|0,I=I+Math.imul(fe,Xt)|0,F=F+Math.imul(fe,Ot)|0,P=P+Math.imul(X,Tt)|0,I=I+Math.imul(X,bt)|0,I=I+Math.imul(re,Tt)|0,F=F+Math.imul(re,bt)|0,P=P+Math.imul(J,Lt)|0,I=I+Math.imul(J,yt)|0,I=I+Math.imul(Q,Lt)|0,F=F+Math.imul(Q,yt)|0,P=P+Math.imul(D,jt)|0,I=I+Math.imul(D,nt)|0,I=I+Math.imul(se,jt)|0,F=F+Math.imul(se,nt)|0;var At=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(At>>>26)|0,At&=67108863,P=Math.imul(Ve,ht),I=Math.imul(Ve,ft),I=I+Math.imul(ke,ht)|0,F=Math.imul(ke,ft),P=P+Math.imul($e,Jt)|0,I=I+Math.imul($e,St)|0,I=I+Math.imul(Ie,Jt)|0,F=F+Math.imul(Ie,St)|0,P=P+Math.imul(Me,Xt)|0,I=I+Math.imul(Me,Ot)|0,I=I+Math.imul(Ne,Xt)|0,F=F+Math.imul(Ne,Ot)|0,P=P+Math.imul(oe,Tt)|0,I=I+Math.imul(oe,bt)|0,I=I+Math.imul(fe,Tt)|0,F=F+Math.imul(fe,bt)|0,P=P+Math.imul(X,Lt)|0,I=I+Math.imul(X,yt)|0,I=I+Math.imul(re,Lt)|0,F=F+Math.imul(re,yt)|0,P=P+Math.imul(J,jt)|0,I=I+Math.imul(J,nt)|0,I=I+Math.imul(Q,jt)|0,F=F+Math.imul(Q,nt)|0,P=P+Math.imul(D,$)|0,I=I+Math.imul(D,K)|0,I=I+Math.imul(se,$)|0,F=F+Math.imul(se,K)|0;var Rt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,P=Math.imul(He,ht),I=Math.imul(He,ft),I=I+Math.imul(Se,ht)|0,F=Math.imul(Se,ft),P=P+Math.imul(Ve,Jt)|0,I=I+Math.imul(Ve,St)|0,I=I+Math.imul(ke,Jt)|0,F=F+Math.imul(ke,St)|0,P=P+Math.imul($e,Xt)|0,I=I+Math.imul($e,Ot)|0,I=I+Math.imul(Ie,Xt)|0,F=F+Math.imul(Ie,Ot)|0,P=P+Math.imul(Me,Tt)|0,I=I+Math.imul(Me,bt)|0,I=I+Math.imul(Ne,Tt)|0,F=F+Math.imul(Ne,bt)|0,P=P+Math.imul(oe,Lt)|0,I=I+Math.imul(oe,yt)|0,I=I+Math.imul(fe,Lt)|0,F=F+Math.imul(fe,yt)|0,P=P+Math.imul(X,jt)|0,I=I+Math.imul(X,nt)|0,I=I+Math.imul(re,jt)|0,F=F+Math.imul(re,nt)|0,P=P+Math.imul(J,$)|0,I=I+Math.imul(J,K)|0,I=I+Math.imul(Q,$)|0,F=F+Math.imul(Q,K)|0,P=P+Math.imul(D,C)|0,I=I+Math.imul(D,Y)|0,I=I+Math.imul(se,C)|0,F=F+Math.imul(se,Y)|0;var Mt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,P=Math.imul(ct,ht),I=Math.imul(ct,ft),I=I+Math.imul(Be,ht)|0,F=Math.imul(Be,ft),P=P+Math.imul(He,Jt)|0,I=I+Math.imul(He,St)|0,I=I+Math.imul(Se,Jt)|0,F=F+Math.imul(Se,St)|0,P=P+Math.imul(Ve,Xt)|0,I=I+Math.imul(Ve,Ot)|0,I=I+Math.imul(ke,Xt)|0,F=F+Math.imul(ke,Ot)|0,P=P+Math.imul($e,Tt)|0,I=I+Math.imul($e,bt)|0,I=I+Math.imul(Ie,Tt)|0,F=F+Math.imul(Ie,bt)|0,P=P+Math.imul(Me,Lt)|0,I=I+Math.imul(Me,yt)|0,I=I+Math.imul(Ne,Lt)|0,F=F+Math.imul(Ne,yt)|0,P=P+Math.imul(oe,jt)|0,I=I+Math.imul(oe,nt)|0,I=I+Math.imul(fe,jt)|0,F=F+Math.imul(fe,nt)|0,P=P+Math.imul(X,$)|0,I=I+Math.imul(X,K)|0,I=I+Math.imul(re,$)|0,F=F+Math.imul(re,K)|0,P=P+Math.imul(J,C)|0,I=I+Math.imul(J,Y)|0,I=I+Math.imul(Q,C)|0,F=F+Math.imul(Q,Y)|0,P=P+Math.imul(D,ae)|0,I=I+Math.imul(D,pe)|0,I=I+Math.imul(se,ae)|0,F=F+Math.imul(se,pe)|0;var Et=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Et>>>26)|0,Et&=67108863,P=Math.imul(rt,ht),I=Math.imul(rt,ft),I=I+Math.imul(Je,ht)|0,F=Math.imul(Je,ft),P=P+Math.imul(ct,Jt)|0,I=I+Math.imul(ct,St)|0,I=I+Math.imul(Be,Jt)|0,F=F+Math.imul(Be,St)|0,P=P+Math.imul(He,Xt)|0,I=I+Math.imul(He,Ot)|0,I=I+Math.imul(Se,Xt)|0,F=F+Math.imul(Se,Ot)|0,P=P+Math.imul(Ve,Tt)|0,I=I+Math.imul(Ve,bt)|0,I=I+Math.imul(ke,Tt)|0,F=F+Math.imul(ke,bt)|0,P=P+Math.imul($e,Lt)|0,I=I+Math.imul($e,yt)|0,I=I+Math.imul(Ie,Lt)|0,F=F+Math.imul(Ie,yt)|0,P=P+Math.imul(Me,jt)|0,I=I+Math.imul(Me,nt)|0,I=I+Math.imul(Ne,jt)|0,F=F+Math.imul(Ne,nt)|0,P=P+Math.imul(oe,$)|0,I=I+Math.imul(oe,K)|0,I=I+Math.imul(fe,$)|0,F=F+Math.imul(fe,K)|0,P=P+Math.imul(X,C)|0,I=I+Math.imul(X,Y)|0,I=I+Math.imul(re,C)|0,F=F+Math.imul(re,Y)|0,P=P+Math.imul(J,ae)|0,I=I+Math.imul(J,pe)|0,I=I+Math.imul(Q,ae)|0,F=F+Math.imul(Q,pe)|0,P=P+Math.imul(D,Re)|0,I=I+Math.imul(D,De)|0,I=I+Math.imul(se,Re)|0,F=F+Math.imul(se,De)|0;var dt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(dt>>>26)|0,dt&=67108863,P=Math.imul(rt,Jt),I=Math.imul(rt,St),I=I+Math.imul(Je,Jt)|0,F=Math.imul(Je,St),P=P+Math.imul(ct,Xt)|0,I=I+Math.imul(ct,Ot)|0,I=I+Math.imul(Be,Xt)|0,F=F+Math.imul(Be,Ot)|0,P=P+Math.imul(He,Tt)|0,I=I+Math.imul(He,bt)|0,I=I+Math.imul(Se,Tt)|0,F=F+Math.imul(Se,bt)|0,P=P+Math.imul(Ve,Lt)|0,I=I+Math.imul(Ve,yt)|0,I=I+Math.imul(ke,Lt)|0,F=F+Math.imul(ke,yt)|0,P=P+Math.imul($e,jt)|0,I=I+Math.imul($e,nt)|0,I=I+Math.imul(Ie,jt)|0,F=F+Math.imul(Ie,nt)|0,P=P+Math.imul(Me,$)|0,I=I+Math.imul(Me,K)|0,I=I+Math.imul(Ne,$)|0,F=F+Math.imul(Ne,K)|0,P=P+Math.imul(oe,C)|0,I=I+Math.imul(oe,Y)|0,I=I+Math.imul(fe,C)|0,F=F+Math.imul(fe,Y)|0,P=P+Math.imul(X,ae)|0,I=I+Math.imul(X,pe)|0,I=I+Math.imul(re,ae)|0,F=F+Math.imul(re,pe)|0,P=P+Math.imul(J,Re)|0,I=I+Math.imul(J,De)|0,I=I+Math.imul(Q,Re)|0,F=F+Math.imul(Q,De)|0;var _t=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(_t>>>26)|0,_t&=67108863,P=Math.imul(rt,Xt),I=Math.imul(rt,Ot),I=I+Math.imul(Je,Xt)|0,F=Math.imul(Je,Ot),P=P+Math.imul(ct,Tt)|0,I=I+Math.imul(ct,bt)|0,I=I+Math.imul(Be,Tt)|0,F=F+Math.imul(Be,bt)|0,P=P+Math.imul(He,Lt)|0,I=I+Math.imul(He,yt)|0,I=I+Math.imul(Se,Lt)|0,F=F+Math.imul(Se,yt)|0,P=P+Math.imul(Ve,jt)|0,I=I+Math.imul(Ve,nt)|0,I=I+Math.imul(ke,jt)|0,F=F+Math.imul(ke,nt)|0,P=P+Math.imul($e,$)|0,I=I+Math.imul($e,K)|0,I=I+Math.imul(Ie,$)|0,F=F+Math.imul(Ie,K)|0,P=P+Math.imul(Me,C)|0,I=I+Math.imul(Me,Y)|0,I=I+Math.imul(Ne,C)|0,F=F+Math.imul(Ne,Y)|0,P=P+Math.imul(oe,ae)|0,I=I+Math.imul(oe,pe)|0,I=I+Math.imul(fe,ae)|0,F=F+Math.imul(fe,pe)|0,P=P+Math.imul(X,Re)|0,I=I+Math.imul(X,De)|0,I=I+Math.imul(re,Re)|0,F=F+Math.imul(re,De)|0;var ot=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(ot>>>26)|0,ot&=67108863,P=Math.imul(rt,Tt),I=Math.imul(rt,bt),I=I+Math.imul(Je,Tt)|0,F=Math.imul(Je,bt),P=P+Math.imul(ct,Lt)|0,I=I+Math.imul(ct,yt)|0,I=I+Math.imul(Be,Lt)|0,F=F+Math.imul(Be,yt)|0,P=P+Math.imul(He,jt)|0,I=I+Math.imul(He,nt)|0,I=I+Math.imul(Se,jt)|0,F=F+Math.imul(Se,nt)|0,P=P+Math.imul(Ve,$)|0,I=I+Math.imul(Ve,K)|0,I=I+Math.imul(ke,$)|0,F=F+Math.imul(ke,K)|0,P=P+Math.imul($e,C)|0,I=I+Math.imul($e,Y)|0,I=I+Math.imul(Ie,C)|0,F=F+Math.imul(Ie,Y)|0,P=P+Math.imul(Me,ae)|0,I=I+Math.imul(Me,pe)|0,I=I+Math.imul(Ne,ae)|0,F=F+Math.imul(Ne,pe)|0,P=P+Math.imul(oe,Re)|0,I=I+Math.imul(oe,De)|0,I=I+Math.imul(fe,Re)|0,F=F+Math.imul(fe,De)|0;var wt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(wt>>>26)|0,wt&=67108863,P=Math.imul(rt,Lt),I=Math.imul(rt,yt),I=I+Math.imul(Je,Lt)|0,F=Math.imul(Je,yt),P=P+Math.imul(ct,jt)|0,I=I+Math.imul(ct,nt)|0,I=I+Math.imul(Be,jt)|0,F=F+Math.imul(Be,nt)|0,P=P+Math.imul(He,$)|0,I=I+Math.imul(He,K)|0,I=I+Math.imul(Se,$)|0,F=F+Math.imul(Se,K)|0,P=P+Math.imul(Ve,C)|0,I=I+Math.imul(Ve,Y)|0,I=I+Math.imul(ke,C)|0,F=F+Math.imul(ke,Y)|0,P=P+Math.imul($e,ae)|0,I=I+Math.imul($e,pe)|0,I=I+Math.imul(Ie,ae)|0,F=F+Math.imul(Ie,pe)|0,P=P+Math.imul(Me,Re)|0,I=I+Math.imul(Me,De)|0,I=I+Math.imul(Ne,Re)|0,F=F+Math.imul(Ne,De)|0;var lt=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(lt>>>26)|0,lt&=67108863,P=Math.imul(rt,jt),I=Math.imul(rt,nt),I=I+Math.imul(Je,jt)|0,F=Math.imul(Je,nt),P=P+Math.imul(ct,$)|0,I=I+Math.imul(ct,K)|0,I=I+Math.imul(Be,$)|0,F=F+Math.imul(Be,K)|0,P=P+Math.imul(He,C)|0,I=I+Math.imul(He,Y)|0,I=I+Math.imul(Se,C)|0,F=F+Math.imul(Se,Y)|0,P=P+Math.imul(Ve,ae)|0,I=I+Math.imul(Ve,pe)|0,I=I+Math.imul(ke,ae)|0,F=F+Math.imul(ke,pe)|0,P=P+Math.imul($e,Re)|0,I=I+Math.imul($e,De)|0,I=I+Math.imul(Ie,Re)|0,F=F+Math.imul(Ie,De)|0;var at=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(at>>>26)|0,at&=67108863,P=Math.imul(rt,$),I=Math.imul(rt,K),I=I+Math.imul(Je,$)|0,F=Math.imul(Je,K),P=P+Math.imul(ct,C)|0,I=I+Math.imul(ct,Y)|0,I=I+Math.imul(Be,C)|0,F=F+Math.imul(Be,Y)|0,P=P+Math.imul(He,ae)|0,I=I+Math.imul(He,pe)|0,I=I+Math.imul(Se,ae)|0,F=F+Math.imul(Se,pe)|0,P=P+Math.imul(Ve,Re)|0,I=I+Math.imul(Ve,De)|0,I=I+Math.imul(ke,Re)|0,F=F+Math.imul(ke,De)|0;var Ae=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,P=Math.imul(rt,C),I=Math.imul(rt,Y),I=I+Math.imul(Je,C)|0,F=Math.imul(Je,Y),P=P+Math.imul(ct,ae)|0,I=I+Math.imul(ct,pe)|0,I=I+Math.imul(Be,ae)|0,F=F+Math.imul(Be,pe)|0,P=P+Math.imul(He,Re)|0,I=I+Math.imul(He,De)|0,I=I+Math.imul(Se,Re)|0,F=F+Math.imul(Se,De)|0;var Pe=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,P=Math.imul(rt,ae),I=Math.imul(rt,pe),I=I+Math.imul(Je,ae)|0,F=Math.imul(Je,pe),P=P+Math.imul(ct,Re)|0,I=I+Math.imul(ct,De)|0,I=I+Math.imul(Be,Re)|0,F=F+Math.imul(Be,De)|0;var Ge=(b+P|0)+((I&8191)<<13)|0;b=(F+(I>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,P=Math.imul(rt,Re),I=Math.imul(rt,De),I=I+Math.imul(Je,Re)|0,F=Math.imul(Je,De);var je=(b+P|0)+((I&8191)<<13)|0;return b=(F+(I>>>13)|0)+(je>>>26)|0,je&=67108863,A[0]=it,A[1]=Ue,A[2]=mt,A[3]=st,A[4]=tt,A[5]=At,A[6]=Rt,A[7]=Mt,A[8]=Et,A[9]=dt,A[10]=_t,A[11]=ot,A[12]=wt,A[13]=lt,A[14]=at,A[15]=Ae,A[16]=Pe,A[17]=Ge,A[18]=je,b!==0&&(A[19]=b,v.length++),v};Math.imul||(k=B);function H(m,f,g){g.negative=f.negative^m.negative,g.length=m.length+f.length;for(var v=0,x=0,S=0;S>>26)|0,x+=A>>>26,A&=67108863}g.words[S]=b,v=A,A=x}return v!==0?g.words[S]=v:g.length--,g._strip()}function U(m,f,g){return H(m,f,g)}s.prototype.mulTo=function(f,g){var v,x=this.length+f.length;return this.length===10&&f.length===10?v=k(this,f,g):x<63?v=B(this,f,g):x<1024?v=H(this,f,g):v=U(this,f,g),v},s.prototype.mul=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),this.mulTo(f,g)},s.prototype.mulf=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),U(this,f,g)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var g=f<0;g&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var v=0,x=0;x>=26,v+=S/67108864|0,v+=A>>>26,this.words[x]=A&67108863}return v!==0&&(this.words[x]=v,this.length++),g?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var g=L(f);if(g.length===0)return new s(1);for(var v=this,x=0;x=0);var g=f%26,v=(f-g)/26,x=67108863>>>26-g<<26-g,S;if(g!==0){var A=0;for(S=0;S>>26-g}A&&(this.words[S]=A,this.length++)}if(v!==0){for(S=this.length-1;S>=0;S--)this.words[S+v]=this.words[S];for(S=0;S=0);var x;g?x=(g-g%26)/26:x=0;var S=f%26,A=Math.min((f-S)/26,this.length),b=67108863^67108863>>>S<A)for(this.length-=A,I=0;I=0&&(F!==0||I>=x);I--){var ce=this.words[I]|0;this.words[I]=F<<26-S|ce>>>S,F=ce&b}return P&&F!==0&&(P.words[P.length++]=F),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,g,v){return n(this.negative===0),this.iushrn(f,g,v)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var g=f%26,v=(f-g)/26,x=1<=0);var g=f%26,v=(f-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(g!==0&&v++,this.length=Math.min(v,this.length),g!==0){var x=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(P/67108864|0),this.words[S+v]=A&67108863}for(;S>26,this.words[S+v]=A&67108863;if(b===0)return this._strip();for(n(b===-1),b=0,S=0;S>26,this.words[S]=A&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,g){var v=this.length-f.length,x=this.clone(),S=f,A=S.words[S.length-1]|0,b=this._countBits(A);v=26-b,v!==0&&(S=S.ushln(v),x.iushln(v),A=S.words[S.length-1]|0);var P=x.length-S.length,I;if(g!=="mod"){I=new s(null),I.length=P+1,I.words=new Array(I.length);for(var F=0;F=0;D--){var se=(x.words[S.length+D]|0)*67108864+(x.words[S.length+D-1]|0);for(se=Math.min(se/A|0,67108863),x._ishlnsubmul(S,se,D);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(S,1,D),x.isZero()||(x.negative^=1);I&&(I.words[D]=se)}return I&&I._strip(),x._strip(),g!=="div"&&v!==0&&x.iushrn(v),{div:I||null,mod:x}},s.prototype.divmod=function(f,g,v){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,S,A;return this.negative!==0&&f.negative===0?(A=this.neg().divmod(f,g),g!=="mod"&&(x=A.div.neg()),g!=="div"&&(S=A.mod.neg(),v&&S.negative!==0&&S.iadd(f)),{div:x,mod:S}):this.negative===0&&f.negative!==0?(A=this.divmod(f.neg(),g),g!=="mod"&&(x=A.div.neg()),{div:x,mod:A.mod}):this.negative&f.negative?(A=this.neg().divmod(f.neg(),g),g!=="div"&&(S=A.mod.neg(),v&&S.negative!==0&&S.isub(f)),{div:A.div,mod:S}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?g==="div"?{div:this.divn(f.words[0]),mod:null}:g==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,g)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var g=this.divmod(f);if(g.mod.isZero())return g.div;var v=g.div.negative!==0?g.mod.isub(f):g.mod,x=f.ushrn(1),S=f.andln(1),A=v.cmp(x);return A<0||S===1&&A===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},s.prototype.modrn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=(1<<26)%f,x=0,S=this.length-1;S>=0;S--)x=(v*x+(this.words[S]|0))%f;return g?-x:x},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var v=0,x=this.length-1;x>=0;x--){var S=(this.words[x]|0)+v*67108864;this.words[x]=S/f|0,v=S%f}return this._strip(),g?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),S=new s(0),A=new s(0),b=new s(1),P=0;g.isEven()&&v.isEven();)g.iushrn(1),v.iushrn(1),++P;for(var I=v.clone(),F=g.clone();!g.isZero();){for(var ce=0,D=1;!(g.words[0]&D)&&ce<26;++ce,D<<=1);if(ce>0)for(g.iushrn(ce);ce-- >0;)(x.isOdd()||S.isOdd())&&(x.iadd(I),S.isub(F)),x.iushrn(1),S.iushrn(1);for(var se=0,ee=1;!(v.words[0]&ee)&&se<26;++se,ee<<=1);if(se>0)for(v.iushrn(se);se-- >0;)(A.isOdd()||b.isOdd())&&(A.iadd(I),b.isub(F)),A.iushrn(1),b.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(A),S.isub(b)):(v.isub(g),A.isub(x),b.isub(S))}return{a:A,b,gcd:v.iushln(P)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var g=this,v=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var x=new s(1),S=new s(0),A=v.clone();g.cmpn(1)>0&&v.cmpn(1)>0;){for(var b=0,P=1;!(g.words[0]&P)&&b<26;++b,P<<=1);if(b>0)for(g.iushrn(b);b-- >0;)x.isOdd()&&x.iadd(A),x.iushrn(1);for(var I=0,F=1;!(v.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(v.iushrn(I);I-- >0;)S.isOdd()&&S.iadd(A),S.iushrn(1);g.cmp(v)>=0?(g.isub(v),x.isub(S)):(v.isub(g),S.isub(x))}var ce;return g.cmpn(1)===0?ce=x:ce=S,ce.cmpn(0)<0&&ce.iadd(f),ce},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var g=this.clone(),v=f.clone();g.negative=0,v.negative=0;for(var x=0;g.isEven()&&v.isEven();x++)g.iushrn(1),v.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;v.isEven();)v.iushrn(1);var S=g.cmp(v);if(S<0){var A=g;g=v,v=A}else if(S===0||v.cmpn(1)===0)break;g.isub(v)}while(!0);return v.iushln(x)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var g=f%26,v=(f-g)/26,x=1<>>26,b&=67108863,this.words[A]=b}return S!==0&&(this.words[A]=S,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var g=f<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var v;if(this.length>1)v=1;else{g&&(f=-f),n(f<=67108863,"Number is too big");var x=this.words[0]|0;v=x===f?0:xf.length)return 1;if(this.length=0;v--){var x=this.words[v]|0,S=f.words[v]|0;if(x!==S){xS&&(g=1);break}}return g},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new j(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var z={k256:null,p224:null,p192:null,p25519:null};function Z(m,f){this.name=m,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Z.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},Z.prototype.ireduce=function(f){var g=f,v;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),v=g.bitLength();while(v>this.n);var x=v0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},Z.prototype.split=function(f,g){f.iushrn(this.n,0,g)},Z.prototype.imulK=function(f){return f.imul(this.k)};function R(){Z.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(R,Z),R.prototype.split=function(f,g){for(var v=4194303,x=Math.min(f.length,9),S=0;S>>22,A=b}A>>>=22,f.words[S-10]=A,A===0&&f.length>10?f.length-=10:f.length-=9},R.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var g=0,v=0;v>>=26,f.words[v]=S,g=x}return g!==0&&(f.words[f.length++]=g),f},s._prime=function(f){if(z[f])return z[f];var g;if(f==="k256")g=new R;else if(f==="p224")g=new W;else if(f==="p192")g=new ie;else if(f==="p25519")g=new me;else throw new Error("Unknown prime "+f);return z[f]=g,g};function j(m){if(typeof m=="string"){var f=s._prime(m);this.m=f.p,this.prime=f}else n(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}j.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},j.prototype._verify2=function(f,g){n((f.negative|g.negative)===0,"red works only with positives"),n(f.red&&f.red===g.red,"red works only with red numbers")},j.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(d(f,f.umod(this.m)._forceRed(this)),f)},j.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},j.prototype.add=function(f,g){this._verify2(f,g);var v=f.add(g);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},j.prototype.iadd=function(f,g){this._verify2(f,g);var v=f.iadd(g);return v.cmp(this.m)>=0&&v.isub(this.m),v},j.prototype.sub=function(f,g){this._verify2(f,g);var v=f.sub(g);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},j.prototype.isub=function(f,g){this._verify2(f,g);var v=f.isub(g);return v.cmpn(0)<0&&v.iadd(this.m),v},j.prototype.shl=function(f,g){return this._verify1(f),this.imod(f.ushln(g))},j.prototype.imul=function(f,g){return this._verify2(f,g),this.imod(f.imul(g))},j.prototype.mul=function(f,g){return this._verify2(f,g),this.imod(f.mul(g))},j.prototype.isqr=function(f){return this.imul(f,f.clone())},j.prototype.sqr=function(f){return this.mul(f,f)},j.prototype.sqrt=function(f){if(f.isZero())return f.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(f,v)}for(var x=this.m.subn(1),S=0;!x.isZero()&&x.andln(1)===0;)S++,x.iushrn(1);n(!x.isZero());var A=new s(1).toRed(this),b=A.redNeg(),P=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,P).cmp(b)!==0;)I.redIAdd(b);for(var F=this.pow(I,x),ce=this.pow(f,x.addn(1).iushrn(1)),D=this.pow(f,x),se=S;D.cmp(A)!==0;){for(var ee=D,J=0;ee.cmp(A)!==0;J++)ee=ee.redSqr();n(J=0;S--){for(var F=g.words[S],ce=I-1;ce>=0;ce--){var D=F>>ce&1;if(A!==x[0]&&(A=this.sqr(A)),D===0&&b===0){P=0;continue}b<<=1,b|=D,P++,!(P!==v&&(S!==0||ce!==0))&&(A=this.mul(A,x[b]),P=0,b=0)}I=26}return A},j.prototype.convertTo=function(f){var g=f.umod(this.m);return g===f?g.clone():g},j.prototype.convertFrom=function(f){var g=f.clone();return g.red=null,g},s.mont=function(f){return new E(f)};function E(m){j.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(E,j),E.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},E.prototype.convertFrom=function(f){var g=this.imod(f.mul(this.rinv));return g.red=null,g},E.prototype.imul=function(f,g){if(f.isZero()||g.isZero())return f.words[0]=0,f.length=1,f;var v=f.imul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=v.isub(x).iushrn(this.shift),A=S;return S.cmp(this.m)>=0?A=S.isub(this.m):S.cmpn(0)<0&&(A=S.iadd(this.m)),A._forceRed(this)},E.prototype.mul=function(f,g){if(f.isZero()||g.isZero())return new s(0)._forceRed(this);var v=f.mul(g),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=v.isub(x).iushrn(this.shift),A=S;return S.cmp(this.m)>=0?A=S.isub(this.m):S.cmpn(0)<0&&(A=S.iadd(this.m)),A._forceRed(this)},E.prototype.invm=function(f){var g=this.imod(f._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,nn)}(Om);var QN=Om.exports;const rr=ji(QN);var eL=rr.BN;function tL(t){return new eL(t,36).toString(16)}const rL="strings/5.7.0",nL=new Kr(rL);var Td;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(Td||(Td={}));var m3;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(m3||(m3={}));function Nm(t,e=Td.current){e!=Td.current&&(nL.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return bn(r)}const iL=`Ethereum Signed Message: -`;function v3(t){return typeof t=="string"&&(t=Nm(t)),Dm(JN([Nm(iL),Nm(String(t.length)),t]))}const sL="address/5.7.0",cl=new Kr(sL);function b3(t){$s(t,20)||cl.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=bn(Dm(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const oL=9007199254740991;function aL(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const Lm={};for(let t=0;t<10;t++)Lm[String(t)]=String(t);for(let t=0;t<26;t++)Lm[String.fromCharCode(65+t)]=String(10+t);const y3=Math.floor(aL(oL));function cL(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Lm[n]).join("");for(;e.length>=y3;){let n=e.substring(0,y3);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function uL(t){let e=null;if(typeof t!="string"&&cl.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=b3(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&cl.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==cL(t)&&cl.throwArgumentError("bad icap checksum","address",t),e=tL(t.substring(4));e.length<40;)e="0"+e;e=b3("0x"+e)}else cl.throwArgumentError("invalid address","address",t);return e}function ul(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var fl={},wr={},tc=w3;function w3(t,e){if(!t)throw new Error(e||"Assertion failed")}w3.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var km={exports:{}};typeof Object.create=="function"?km.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:km.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var Rd=km.exports,fL=tc,lL=Rd;wr.inherits=lL;function hL(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function dL(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):hL(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}wr.htonl=x3;function gL(t,e){for(var r="",n=0;n>>0}return s}wr.join32=mL;function vL(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}wr.split32=vL;function bL(t,e){return t>>>e|t<<32-e}wr.rotr32=bL;function yL(t,e){return t<>>32-e}wr.rotl32=yL;function wL(t,e){return t+e>>>0}wr.sum32=wL;function xL(t,e,r){return t+e+r>>>0}wr.sum32_3=xL;function _L(t,e,r,n){return t+e+r+n>>>0}wr.sum32_4=_L;function EL(t,e,r,n,i){return t+e+r+n+i>>>0}wr.sum32_5=EL;function SL(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}wr.sum64=SL;function AL(t,e,r,n){var i=e+n>>>0,s=(i>>0}wr.sum64_hi=AL;function PL(t,e,r,n){var i=e+n;return i>>>0}wr.sum64_lo=PL;function ML(t,e,r,n,i,s,o,a){var u=0,l=e;l=l+n>>>0,u+=l>>0,u+=l>>0,u+=l>>0}wr.sum64_4_hi=ML;function IL(t,e,r,n,i,s,o,a){var u=e+n+s+a;return u>>>0}wr.sum64_4_lo=IL;function CL(t,e,r,n,i,s,o,a,u,l){var d=0,p=e;p=p+n>>>0,d+=p>>0,d+=p>>0,d+=p>>0,d+=p>>0}wr.sum64_5_hi=CL;function TL(t,e,r,n,i,s,o,a,u,l){var d=e+n+s+a+l;return d>>>0}wr.sum64_5_lo=TL;function RL(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}wr.rotr64_hi=RL;function DL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}wr.rotr64_lo=DL;function OL(t,e,r){return t>>>r}wr.shr64_hi=OL;function NL(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}wr.shr64_lo=NL;var hu={},S3=wr,LL=tc;function Dd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}hu.BlockHash=Dd,Dd.prototype.update=function(e,r){if(e=S3.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=S3.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}Fs.g0_256=jL;function UL(t){return js(t,17)^js(t,19)^t>>>10}Fs.g1_256=UL;var pu=wr,qL=hu,zL=Fs,Bm=pu.rotl32,ll=pu.sum32,HL=pu.sum32_5,WL=zL.ft_1,I3=qL.BlockHash,KL=[1518500249,1859775393,2400959708,3395469782];function Us(){if(!(this instanceof Us))return new Us;I3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}pu.inherits(Us,I3);var VL=Us;Us.blockSize=512,Us.outSize=160,Us.hmacStrength=80,Us.padLength=64,Us.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),Nk(e.length<=this.blockSize);for(var r=e.length;r>8,y=d&255;p?u.push(p,y):u.push(y)}return u}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",u=0;u(y>>1)-1?O=(y>>1)-L:O=L,_.isubn(O)):O=0,p[M]=O,_.iushrn(1)}return p}r.getNAF=n;function i(u,l){var d=[[],[]];u=u.clone(),l=l.clone();for(var p=0,y=0,_;u.cmpn(-p)>0||l.cmpn(-y)>0;){var M=u.andln(3)+p&3,O=l.andln(3)+y&3;M===3&&(M=-1),O===3&&(O=-1);var L;M&1?(_=u.andln(7)+p&7,(_===3||_===5)&&O===2?L=-M:L=M):L=0,d[0].push(L);var B;O&1?(_=l.andln(7)+y&7,(_===3||_===5)&&M===2?B=-O:B=O):B=0,d[1].push(B),2*p===L+1&&(p=1-p),2*y===B+1&&(y=1-y),u.iushrn(1),l.iushrn(1)}return d}r.getJSF=i;function s(u,l,d){var p="_"+l;u.prototype[l]=function(){return this[p]!==void 0?this[p]:this[p]=d.call(this)}}r.cachedProperty=s;function o(u){return typeof u=="string"?r.toArray(u,"hex"):u}r.parseBytes=o;function a(u){return new rr(u,"hex","le")}r.intFromLE=a}),Nd=Ci.getNAF,Bk=Ci.getJSF,Ld=Ci.assert;function aa(t,e){this.type=t,this.p=new rr(e.p,16),this.red=e.prime?rr.red(e.prime):rr.mont(this.p),this.zero=new rr(0).toRed(this.red),this.one=new rr(1).toRed(this.red),this.two=new rr(2).toRed(this.red),this.n=e.n&&new rr(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var nc=aa;aa.prototype.point=function(){throw new Error("Not implemented")},aa.prototype.validate=function(){throw new Error("Not implemented")},aa.prototype._fixedNafMul=function(e,r){Ld(e.precomputed);var n=e._getDoubles(),i=Nd(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];Ld(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},aa.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var M=d-1,O=d;if(o[M]!==1||o[O]!==1){u[M]=Nd(n[M],o[M],this._bitLength),u[O]=Nd(n[O],o[O],this._bitLength),l=Math.max(u[M].length,l),l=Math.max(u[O].length,l);continue}var L=[r[M],null,null,r[O]];r[M].y.cmp(r[O].y)===0?(L[1]=r[M].add(r[O]),L[2]=r[M].toJ().mixedAdd(r[O].neg())):r[M].y.cmp(r[O].y.redNeg())===0?(L[1]=r[M].toJ().mixedAdd(r[O]),L[2]=r[M].add(r[O].neg())):(L[1]=r[M].toJ().mixedAdd(r[O]),L[2]=r[M].toJ().mixedAdd(r[O].neg()));var B=[-3,-1,-5,-7,0,7,5,1,3],k=Bk(n[M],n[O]);for(l=Math.max(k[0].length,l),u[M]=new Array(l),u[O]=new Array(l),p=0;p=0;d--){for(var R=0;d>=0;){var W=!0;for(p=0;p=0&&R++,z=z.dblp(R),d<0)break;for(p=0;p0?y=a[p][ie-1>>1]:ie<0&&(y=a[p][-ie-1>>1].neg()),y.type==="affine"?z=z.mixedAdd(y):z=z.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Wi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(_=l,M=d),p.negative&&(p=p.neg(),y=y.neg()),_.negative&&(_=_.neg(),M=M.neg()),[{a:p,b:y},{a:_,b:M}]},Ki.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Ki.prototype.pointFromX=function(e,r){e=new rr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Ki.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Ki.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Tn.prototype.isInfinity=function(){return this.inf},Tn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Tn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Tn.prototype.getX=function(){return this.x.fromRed()},Tn.prototype.getY=function(){return this.y.fromRed()},Tn.prototype.mul=function(e){return e=new rr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Tn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Tn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Tn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Tn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Tn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function $n(t,e,r,n){nc.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new rr(0)):(this.x=new rr(e,16),this.y=new rr(r,16),this.z=new rr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}zm($n,nc.BasePoint),Ki.prototype.jpoint=function(e,r,n){return new $n(this,e,r,n)},$n.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},$n.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},$n.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),_=l.redSqr().redIAdd(p).redISub(y).redISub(y),M=l.redMul(y.redISub(_)).redISub(o.redMul(p)),O=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(_,M,O)},$n.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),_=u.redMul(p.redISub(y)).redISub(s.redMul(d)),M=this.z.redMul(a);return this.curve.jpoint(y,_,M)},$n.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},$n.prototype.inspect=function(){return this.isInfinity()?"":""},$n.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var kd=bu(function(t,e){var r=e;r.base=nc,r.short=Fk,r.mont=null,r.edwards=null}),Bd=bu(function(t,e){var r=e,n=Ci.assert;function i(a){a.type==="short"?this.curve=new kd.short(a):a.type==="edwards"?this.curve=new kd.edwards(a):this.curve=new kd.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,u){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(u);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:wo.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:wo.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:wo.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:wo.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:wo.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wo.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:wo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function ca(t){if(!(this instanceof ca))return new ca(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ws.toArray(t.entropy,t.entropyEnc||"hex"),r=ws.toArray(t.nonce,t.nonceEnc||"hex"),n=ws.toArray(t.pers,t.persEnc||"hex");qm(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var z3=ca;ca.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ca.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=ws.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var jk=Ci.assert;function $d(t,e){if(t instanceof $d)return t;this._importDER(t,e)||(jk(t.r&&t.s,"Signature without r or s"),this.r=new rr(t.r,16),this.s=new rr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Fd=$d;function Uk(){this.place=0}function Km(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function H3(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}$d.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=H3(r),n=H3(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Vm(i,r.length),i=i.concat(r),i.push(2),Vm(i,n.length);var s=i.concat(n),o=[48];return Vm(o,s.length),o=o.concat(s),Ci.encode(o,e)};var qk=function(){throw new Error("unsupported")},W3=Ci.assert;function Vi(t){if(!(this instanceof Vi))return new Vi(t);typeof t=="string"&&(W3(Object.prototype.hasOwnProperty.call(Bd,t),"Unknown curve "+t),t=Bd[t]),t instanceof Bd.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var zk=Vi;Vi.prototype.keyPair=function(e){return new Wm(this,e)},Vi.prototype.keyFromPrivate=function(e,r){return Wm.fromPrivate(this,e,r)},Vi.prototype.keyFromPublic=function(e,r){return Wm.fromPublic(this,e,r)},Vi.prototype.genKeyPair=function(e){e||(e={});for(var r=new z3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||qk(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new rr(2));;){var s=new rr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Vi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Vi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new rr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new z3({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new rr(1)),d=0;;d++){var p=i.k?i.k(d):new rr(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var _=y.getX(),M=_.umod(this.n);if(M.cmpn(0)!==0){var O=p.invm(this.n).mul(M.mul(r.getPrivate()).iadd(e));if(O=O.umod(this.n),O.cmpn(0)!==0){var L=(y.getY().isOdd()?1:0)|(_.cmp(M)!==0?2:0);return i.canonical&&O.cmp(this.nh)>0&&(O=this.n.sub(O),L^=1),new Fd({r:M,s:O,recoveryParam:L})}}}}}},Vi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new rr(e,16)),n=this.keyFromPublic(n,i),r=new Fd(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),u=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.eqXToP(s)):(d=this.g.mulAdd(u,n.getPublic(),l),d.isInfinity()?!1:d.getX().umod(this.n).cmp(s)===0)},Vi.prototype.recoverPubKey=function(t,e,r,n){W3((3&r)===r,"The recovery param is more than two bits"),e=new Fd(e,n);var i=this.n,s=new rr(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Vi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Fd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var Hk=bu(function(t,e){var r=e;r.version="6.5.4",r.utils=Ci,r.rand=function(){throw new Error("unsupported")},r.curve=kd,r.curves=Bd,r.ec=zk,r.eddsa=null}),Wk=Hk.ec;const Kk="signing-key/5.7.0",Gm=new Kr(Kk);let Ym=null;function ua(){return Ym||(Ym=new Wk("secp256k1")),Ym}class Vk{constructor(e){ul(this,"curve","secp256k1"),ul(this,"privateKey",Ii(e)),ZN(this.privateKey)!==32&&Gm.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=ua().keyFromPrivate(bn(this.privateKey));ul(this,"publicKey","0x"+r.getPublic(!1,"hex")),ul(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ul(this,"_isSigningKey",!0)}_addPoint(e){const r=ua().keyFromPublic(bn(this.publicKey)),n=ua().keyFromPublic(bn(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=ua().keyFromPrivate(bn(this.privateKey)),n=bn(e);n.length!==32&&Gm.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return g3({recoveryParam:i.recoveryParam,r:lu("0x"+i.r.toString(16),32),s:lu("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=ua().keyFromPrivate(bn(this.privateKey)),n=ua().keyFromPublic(bn(K3(e)));return lu("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function Gk(t,e){const r=g3(e),n={r:bn(r.r),s:bn(r.s)};return"0x"+ua().recoverPubKey(bn(t),n,r.recoveryParam).encode("hex",!1)}function K3(t,e){const r=bn(t);return r.length===32?new Vk(r).publicKey:r.length===33?"0x"+ua().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?Ii(r):Gm.throwArgumentError("invalid public or private key","key","[REDACTED]")}var V3;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(V3||(V3={}));function Yk(t){const e=K3(t);return uL(p3(Dm(p3(e,1)),12))}function Jk(t,e){return Yk(Gk(bn(t),e))}var Jm={},jd={};Object.defineProperty(jd,"__esModule",{value:!0});var Vn=or,Xm=Mi,Xk=20;function Zk(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],p=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],_=r[27]<<24|r[26]<<16|r[25]<<8|r[24],M=r[31]<<24|r[30]<<16|r[29]<<8|r[28],O=e[3]<<24|e[2]<<16|e[1]<<8|e[0],L=e[7]<<24|e[6]<<16|e[5]<<8|e[4],B=e[11]<<24|e[10]<<16|e[9]<<8|e[8],k=e[15]<<24|e[14]<<16|e[13]<<8|e[12],H=n,U=i,z=s,Z=o,R=a,W=u,ie=l,me=d,j=p,E=y,m=_,f=M,g=O,v=L,x=B,S=k,A=0;A>>16|g<<16,j=j+g|0,R^=j,R=R>>>20|R<<12,U=U+W|0,v^=U,v=v>>>16|v<<16,E=E+v|0,W^=E,W=W>>>20|W<<12,z=z+ie|0,x^=z,x=x>>>16|x<<16,m=m+x|0,ie^=m,ie=ie>>>20|ie<<12,Z=Z+me|0,S^=Z,S=S>>>16|S<<16,f=f+S|0,me^=f,me=me>>>20|me<<12,z=z+ie|0,x^=z,x=x>>>24|x<<8,m=m+x|0,ie^=m,ie=ie>>>25|ie<<7,Z=Z+me|0,S^=Z,S=S>>>24|S<<8,f=f+S|0,me^=f,me=me>>>25|me<<7,U=U+W|0,v^=U,v=v>>>24|v<<8,E=E+v|0,W^=E,W=W>>>25|W<<7,H=H+R|0,g^=H,g=g>>>24|g<<8,j=j+g|0,R^=j,R=R>>>25|R<<7,H=H+W|0,S^=H,S=S>>>16|S<<16,m=m+S|0,W^=m,W=W>>>20|W<<12,U=U+ie|0,g^=U,g=g>>>16|g<<16,f=f+g|0,ie^=f,ie=ie>>>20|ie<<12,z=z+me|0,v^=z,v=v>>>16|v<<16,j=j+v|0,me^=j,me=me>>>20|me<<12,Z=Z+R|0,x^=Z,x=x>>>16|x<<16,E=E+x|0,R^=E,R=R>>>20|R<<12,z=z+me|0,v^=z,v=v>>>24|v<<8,j=j+v|0,me^=j,me=me>>>25|me<<7,Z=Z+R|0,x^=Z,x=x>>>24|x<<8,E=E+x|0,R^=E,R=R>>>25|R<<7,U=U+ie|0,g^=U,g=g>>>24|g<<8,f=f+g|0,ie^=f,ie=ie>>>25|ie<<7,H=H+W|0,S^=H,S=S>>>24|S<<8,m=m+S|0,W^=m,W=W>>>25|W<<7;Vn.writeUint32LE(H+n|0,t,0),Vn.writeUint32LE(U+i|0,t,4),Vn.writeUint32LE(z+s|0,t,8),Vn.writeUint32LE(Z+o|0,t,12),Vn.writeUint32LE(R+a|0,t,16),Vn.writeUint32LE(W+u|0,t,20),Vn.writeUint32LE(ie+l|0,t,24),Vn.writeUint32LE(me+d|0,t,28),Vn.writeUint32LE(j+p|0,t,32),Vn.writeUint32LE(E+y|0,t,36),Vn.writeUint32LE(m+_|0,t,40),Vn.writeUint32LE(f+M|0,t,44),Vn.writeUint32LE(g+O|0,t,48),Vn.writeUint32LE(v+L|0,t,52),Vn.writeUint32LE(x+B|0,t,56),Vn.writeUint32LE(S+k|0,t,60)}function G3(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var Y3={},fa={};Object.defineProperty(fa,"__esModule",{value:!0});function tB(t,e,r){return~(t-1)&e|t-1&r}fa.select=tB;function rB(t,e){return(t|0)-(e|0)-1>>>31&1}fa.lessOrEqual=rB;function J3(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}fa.compare=J3;function nB(t,e){return t.length===0||e.length===0?!1:J3(t,e)!==0}fa.equal=nB,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=fa,r=Mi;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var u=a[0]|a[1]<<8;this._r[0]=u&8191;var l=a[2]|a[3]<<8;this._r[1]=(u>>>13|l<<3)&8191;var d=a[4]|a[5]<<8;this._r[2]=(l>>>10|d<<6)&7939;var p=a[6]|a[7]<<8;this._r[3]=(d>>>7|p<<9)&8191;var y=a[8]|a[9]<<8;this._r[4]=(p>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var _=a[10]|a[11]<<8;this._r[6]=(y>>>14|_<<2)&8191;var M=a[12]|a[13]<<8;this._r[7]=(_>>>11|M<<5)&8065;var O=a[14]|a[15]<<8;this._r[8]=(M>>>8|O<<8)&8191,this._r[9]=O>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,u,l){for(var d=this._fin?0:2048,p=this._h[0],y=this._h[1],_=this._h[2],M=this._h[3],O=this._h[4],L=this._h[5],B=this._h[6],k=this._h[7],H=this._h[8],U=this._h[9],z=this._r[0],Z=this._r[1],R=this._r[2],W=this._r[3],ie=this._r[4],me=this._r[5],j=this._r[6],E=this._r[7],m=this._r[8],f=this._r[9];l>=16;){var g=a[u+0]|a[u+1]<<8;p+=g&8191;var v=a[u+2]|a[u+3]<<8;y+=(g>>>13|v<<3)&8191;var x=a[u+4]|a[u+5]<<8;_+=(v>>>10|x<<6)&8191;var S=a[u+6]|a[u+7]<<8;M+=(x>>>7|S<<9)&8191;var A=a[u+8]|a[u+9]<<8;O+=(S>>>4|A<<12)&8191,L+=A>>>1&8191;var b=a[u+10]|a[u+11]<<8;B+=(A>>>14|b<<2)&8191;var P=a[u+12]|a[u+13]<<8;k+=(b>>>11|P<<5)&8191;var I=a[u+14]|a[u+15]<<8;H+=(P>>>8|I<<8)&8191,U+=I>>>5|d;var F=0,ce=F;ce+=p*z,ce+=y*(5*f),ce+=_*(5*m),ce+=M*(5*E),ce+=O*(5*j),F=ce>>>13,ce&=8191,ce+=L*(5*me),ce+=B*(5*ie),ce+=k*(5*W),ce+=H*(5*R),ce+=U*(5*Z),F+=ce>>>13,ce&=8191;var D=F;D+=p*Z,D+=y*z,D+=_*(5*f),D+=M*(5*m),D+=O*(5*E),F=D>>>13,D&=8191,D+=L*(5*j),D+=B*(5*me),D+=k*(5*ie),D+=H*(5*W),D+=U*(5*R),F+=D>>>13,D&=8191;var se=F;se+=p*R,se+=y*Z,se+=_*z,se+=M*(5*f),se+=O*(5*m),F=se>>>13,se&=8191,se+=L*(5*E),se+=B*(5*j),se+=k*(5*me),se+=H*(5*ie),se+=U*(5*W),F+=se>>>13,se&=8191;var ee=F;ee+=p*W,ee+=y*R,ee+=_*Z,ee+=M*z,ee+=O*(5*f),F=ee>>>13,ee&=8191,ee+=L*(5*m),ee+=B*(5*E),ee+=k*(5*j),ee+=H*(5*me),ee+=U*(5*ie),F+=ee>>>13,ee&=8191;var J=F;J+=p*ie,J+=y*W,J+=_*R,J+=M*Z,J+=O*z,F=J>>>13,J&=8191,J+=L*(5*f),J+=B*(5*m),J+=k*(5*E),J+=H*(5*j),J+=U*(5*me),F+=J>>>13,J&=8191;var Q=F;Q+=p*me,Q+=y*ie,Q+=_*W,Q+=M*R,Q+=O*Z,F=Q>>>13,Q&=8191,Q+=L*z,Q+=B*(5*f),Q+=k*(5*m),Q+=H*(5*E),Q+=U*(5*j),F+=Q>>>13,Q&=8191;var T=F;T+=p*j,T+=y*me,T+=_*ie,T+=M*W,T+=O*R,F=T>>>13,T&=8191,T+=L*Z,T+=B*z,T+=k*(5*f),T+=H*(5*m),T+=U*(5*E),F+=T>>>13,T&=8191;var X=F;X+=p*E,X+=y*j,X+=_*me,X+=M*ie,X+=O*W,F=X>>>13,X&=8191,X+=L*R,X+=B*Z,X+=k*z,X+=H*(5*f),X+=U*(5*m),F+=X>>>13,X&=8191;var re=F;re+=p*m,re+=y*E,re+=_*j,re+=M*me,re+=O*ie,F=re>>>13,re&=8191,re+=L*W,re+=B*R,re+=k*Z,re+=H*z,re+=U*(5*f),F+=re>>>13,re&=8191;var ge=F;ge+=p*f,ge+=y*m,ge+=_*E,ge+=M*j,ge+=O*me,F=ge>>>13,ge&=8191,ge+=L*ie,ge+=B*W,ge+=k*R,ge+=H*Z,ge+=U*z,F+=ge>>>13,ge&=8191,F=(F<<2)+F|0,F=F+ce|0,ce=F&8191,F=F>>>13,D+=F,p=ce,y=D,_=se,M=ee,O=J,L=Q,B=T,k=X,H=re,U=ge,u+=16,l-=16}this._h[0]=p,this._h[1]=y,this._h[2]=_,this._h[3]=M,this._h[4]=O,this._h[5]=L,this._h[6]=B,this._h[7]=k,this._h[8]=H,this._h[9]=U},o.prototype.finish=function(a,u){u===void 0&&(u=0);var l=new Uint16Array(10),d,p,y,_;if(this._leftover){for(_=this._leftover,this._buffer[_++]=1;_<16;_++)this._buffer[_]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(d=this._h[1]>>>13,this._h[1]&=8191,_=2;_<10;_++)this._h[_]+=d,d=this._h[_]>>>13,this._h[_]&=8191;for(this._h[0]+=d*5,d=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=d,d=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=d,l[0]=this._h[0]+5,d=l[0]>>>13,l[0]&=8191,_=1;_<10;_++)l[_]=this._h[_]+d,d=l[_]>>>13,l[_]&=8191;for(l[9]-=8192,p=(d^1)-1,_=0;_<10;_++)l[_]&=p;for(p=~p,_=0;_<10;_++)this._h[_]=this._h[_]&p|l[_];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,y=this._h[0]+this._pad[0],this._h[0]=y&65535,_=1;_<8;_++)y=(this._h[_]+this._pad[_]|0)+(y>>>16)|0,this._h[_]=y&65535;return a[u+0]=this._h[0]>>>0,a[u+1]=this._h[0]>>>8,a[u+2]=this._h[1]>>>0,a[u+3]=this._h[1]>>>8,a[u+4]=this._h[2]>>>0,a[u+5]=this._h[2]>>>8,a[u+6]=this._h[3]>>>0,a[u+7]=this._h[3]>>>8,a[u+8]=this._h[4]>>>0,a[u+9]=this._h[4]>>>8,a[u+10]=this._h[5]>>>0,a[u+11]=this._h[5]>>>8,a[u+12]=this._h[6]>>>0,a[u+13]=this._h[6]>>>8,a[u+14]=this._h[7]>>>0,a[u+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var u=0,l=a.length,d;if(this._leftover){d=16-this._leftover,d>l&&(d=l);for(var p=0;p=16&&(d=l-l%16,this._blocks(a,u,d),u+=d,l-=d),l){for(var p=0;p16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var _=new Uint8Array(16);_.set(l,_.length-l.length);var M=new Uint8Array(32);e.stream(this._key,_,M,4);var O=d.length+this.tagLength,L;if(y){if(y.length!==O)throw new Error("ChaCha20Poly1305: incorrect destination length");L=y}else L=new Uint8Array(O);return e.streamXOR(this._key,_,d,L,4),this._authenticate(L.subarray(L.length-this.tagLength,L.length),M,L.subarray(0,L.length-this.tagLength),p),n.wipe(_),L},u.prototype.open=function(l,d,p,y){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(d.length0&&_.update(o.subarray(y.length%16))),_.update(p),p.length%16>0&&_.update(o.subarray(p.length%16));var M=new Uint8Array(8);y&&i.writeUint64LE(y.length,M),_.update(M),i.writeUint64LE(p.length,M),_.update(M);for(var O=_.digest(),L=0;Lthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=u[d++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(d=s(this._temp,this._state,u,d,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=u[d++],l--;return this},a.prototype.finish=function(u){if(!this._finished){var l=this._bytesHashed,d=this._bufferLength,p=l/536870912|0,y=l<<3,_=l%64<56?64:128;this._buffer[d]=128;for(var M=d+1;M<_-8;M++)this._buffer[M]=0;e.writeUint32BE(p,this._buffer,_-8),e.writeUint32BE(y,this._buffer,_-4),s(this._temp,this._state,this._buffer,0,_),this._finished=!0}for(var M=0;M0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(u){return this._state.set(u.state),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(u){r.wipe(u.state),u.buffer&&r.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,u,l,d,p){for(;p>=64;){for(var y=u[0],_=u[1],M=u[2],O=u[3],L=u[4],B=u[5],k=u[6],H=u[7],U=0;U<16;U++){var z=d+U*4;a[U]=e.readUint32BE(l,z)}for(var U=16;U<64;U++){var Z=a[U-2],R=(Z>>>17|Z<<15)^(Z>>>19|Z<<13)^Z>>>10;Z=a[U-15];var W=(Z>>>7|Z<<25)^(Z>>>18|Z<<14)^Z>>>3;a[U]=(R+a[U-7]|0)+(W+a[U-16]|0)}for(var U=0;U<64;U++){var R=(((L>>>6|L<<26)^(L>>>11|L<<21)^(L>>>25|L<<7))+(L&B^~L&k)|0)+(H+(i[U]+a[U]|0)|0)|0,W=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&_^y&M^_&M)|0;H=k,k=B,B=L,L=O+R|0,O=M,M=_,_=y,y=R+W|0}u[0]+=y,u[1]+=_,u[2]+=M,u[3]+=O,u[4]+=L,u[5]+=B,u[6]+=k,u[7]+=H,d+=64,p-=64}return d}function o(a){var u=new n;u.update(a);var l=u.digest();return u.clean(),l}t.hash=o})(pl);var Qm={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=sa,r=Mi;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(U){const z=new Float64Array(16);if(U)for(let Z=0;Z>16&1),Z[me-1]&=65535;Z[15]=R[15]-32767-(Z[14]>>16&1);const ie=Z[15]>>16&1;Z[14]&=65535,a(R,Z,1-ie)}for(let W=0;W<16;W++)U[2*W]=R[W]&255,U[2*W+1]=R[W]>>8}function l(U,z){for(let Z=0;Z<16;Z++)U[Z]=z[2*Z]+(z[2*Z+1]<<8);U[15]&=32767}function d(U,z,Z){for(let R=0;R<16;R++)U[R]=z[R]+Z[R]}function p(U,z,Z){for(let R=0;R<16;R++)U[R]=z[R]-Z[R]}function y(U,z,Z){let R,W,ie=0,me=0,j=0,E=0,m=0,f=0,g=0,v=0,x=0,S=0,A=0,b=0,P=0,I=0,F=0,ce=0,D=0,se=0,ee=0,J=0,Q=0,T=0,X=0,re=0,ge=0,oe=0,fe=0,be=0,Me=0,Ne=0,Te=0,$e=Z[0],Ie=Z[1],Le=Z[2],Ve=Z[3],ke=Z[4],ze=Z[5],He=Z[6],Se=Z[7],Qe=Z[8],ct=Z[9],Be=Z[10],et=Z[11],rt=Z[12],Je=Z[13],gt=Z[14],ht=Z[15];R=z[0],ie+=R*$e,me+=R*Ie,j+=R*Le,E+=R*Ve,m+=R*ke,f+=R*ze,g+=R*He,v+=R*Se,x+=R*Qe,S+=R*ct,A+=R*Be,b+=R*et,P+=R*rt,I+=R*Je,F+=R*gt,ce+=R*ht,R=z[1],me+=R*$e,j+=R*Ie,E+=R*Le,m+=R*Ve,f+=R*ke,g+=R*ze,v+=R*He,x+=R*Se,S+=R*Qe,A+=R*ct,b+=R*Be,P+=R*et,I+=R*rt,F+=R*Je,ce+=R*gt,D+=R*ht,R=z[2],j+=R*$e,E+=R*Ie,m+=R*Le,f+=R*Ve,g+=R*ke,v+=R*ze,x+=R*He,S+=R*Se,A+=R*Qe,b+=R*ct,P+=R*Be,I+=R*et,F+=R*rt,ce+=R*Je,D+=R*gt,se+=R*ht,R=z[3],E+=R*$e,m+=R*Ie,f+=R*Le,g+=R*Ve,v+=R*ke,x+=R*ze,S+=R*He,A+=R*Se,b+=R*Qe,P+=R*ct,I+=R*Be,F+=R*et,ce+=R*rt,D+=R*Je,se+=R*gt,ee+=R*ht,R=z[4],m+=R*$e,f+=R*Ie,g+=R*Le,v+=R*Ve,x+=R*ke,S+=R*ze,A+=R*He,b+=R*Se,P+=R*Qe,I+=R*ct,F+=R*Be,ce+=R*et,D+=R*rt,se+=R*Je,ee+=R*gt,J+=R*ht,R=z[5],f+=R*$e,g+=R*Ie,v+=R*Le,x+=R*Ve,S+=R*ke,A+=R*ze,b+=R*He,P+=R*Se,I+=R*Qe,F+=R*ct,ce+=R*Be,D+=R*et,se+=R*rt,ee+=R*Je,J+=R*gt,Q+=R*ht,R=z[6],g+=R*$e,v+=R*Ie,x+=R*Le,S+=R*Ve,A+=R*ke,b+=R*ze,P+=R*He,I+=R*Se,F+=R*Qe,ce+=R*ct,D+=R*Be,se+=R*et,ee+=R*rt,J+=R*Je,Q+=R*gt,T+=R*ht,R=z[7],v+=R*$e,x+=R*Ie,S+=R*Le,A+=R*Ve,b+=R*ke,P+=R*ze,I+=R*He,F+=R*Se,ce+=R*Qe,D+=R*ct,se+=R*Be,ee+=R*et,J+=R*rt,Q+=R*Je,T+=R*gt,X+=R*ht,R=z[8],x+=R*$e,S+=R*Ie,A+=R*Le,b+=R*Ve,P+=R*ke,I+=R*ze,F+=R*He,ce+=R*Se,D+=R*Qe,se+=R*ct,ee+=R*Be,J+=R*et,Q+=R*rt,T+=R*Je,X+=R*gt,re+=R*ht,R=z[9],S+=R*$e,A+=R*Ie,b+=R*Le,P+=R*Ve,I+=R*ke,F+=R*ze,ce+=R*He,D+=R*Se,se+=R*Qe,ee+=R*ct,J+=R*Be,Q+=R*et,T+=R*rt,X+=R*Je,re+=R*gt,ge+=R*ht,R=z[10],A+=R*$e,b+=R*Ie,P+=R*Le,I+=R*Ve,F+=R*ke,ce+=R*ze,D+=R*He,se+=R*Se,ee+=R*Qe,J+=R*ct,Q+=R*Be,T+=R*et,X+=R*rt,re+=R*Je,ge+=R*gt,oe+=R*ht,R=z[11],b+=R*$e,P+=R*Ie,I+=R*Le,F+=R*Ve,ce+=R*ke,D+=R*ze,se+=R*He,ee+=R*Se,J+=R*Qe,Q+=R*ct,T+=R*Be,X+=R*et,re+=R*rt,ge+=R*Je,oe+=R*gt,fe+=R*ht,R=z[12],P+=R*$e,I+=R*Ie,F+=R*Le,ce+=R*Ve,D+=R*ke,se+=R*ze,ee+=R*He,J+=R*Se,Q+=R*Qe,T+=R*ct,X+=R*Be,re+=R*et,ge+=R*rt,oe+=R*Je,fe+=R*gt,be+=R*ht,R=z[13],I+=R*$e,F+=R*Ie,ce+=R*Le,D+=R*Ve,se+=R*ke,ee+=R*ze,J+=R*He,Q+=R*Se,T+=R*Qe,X+=R*ct,re+=R*Be,ge+=R*et,oe+=R*rt,fe+=R*Je,be+=R*gt,Me+=R*ht,R=z[14],F+=R*$e,ce+=R*Ie,D+=R*Le,se+=R*Ve,ee+=R*ke,J+=R*ze,Q+=R*He,T+=R*Se,X+=R*Qe,re+=R*ct,ge+=R*Be,oe+=R*et,fe+=R*rt,be+=R*Je,Me+=R*gt,Ne+=R*ht,R=z[15],ce+=R*$e,D+=R*Ie,se+=R*Le,ee+=R*Ve,J+=R*ke,Q+=R*ze,T+=R*He,X+=R*Se,re+=R*Qe,ge+=R*ct,oe+=R*Be,fe+=R*et,be+=R*rt,Me+=R*Je,Ne+=R*gt,Te+=R*ht,ie+=38*D,me+=38*se,j+=38*ee,E+=38*J,m+=38*Q,f+=38*T,g+=38*X,v+=38*re,x+=38*ge,S+=38*oe,A+=38*fe,b+=38*be,P+=38*Me,I+=38*Ne,F+=38*Te,W=1,R=ie+W+65535,W=Math.floor(R/65536),ie=R-W*65536,R=me+W+65535,W=Math.floor(R/65536),me=R-W*65536,R=j+W+65535,W=Math.floor(R/65536),j=R-W*65536,R=E+W+65535,W=Math.floor(R/65536),E=R-W*65536,R=m+W+65535,W=Math.floor(R/65536),m=R-W*65536,R=f+W+65535,W=Math.floor(R/65536),f=R-W*65536,R=g+W+65535,W=Math.floor(R/65536),g=R-W*65536,R=v+W+65535,W=Math.floor(R/65536),v=R-W*65536,R=x+W+65535,W=Math.floor(R/65536),x=R-W*65536,R=S+W+65535,W=Math.floor(R/65536),S=R-W*65536,R=A+W+65535,W=Math.floor(R/65536),A=R-W*65536,R=b+W+65535,W=Math.floor(R/65536),b=R-W*65536,R=P+W+65535,W=Math.floor(R/65536),P=R-W*65536,R=I+W+65535,W=Math.floor(R/65536),I=R-W*65536,R=F+W+65535,W=Math.floor(R/65536),F=R-W*65536,R=ce+W+65535,W=Math.floor(R/65536),ce=R-W*65536,ie+=W-1+37*(W-1),W=1,R=ie+W+65535,W=Math.floor(R/65536),ie=R-W*65536,R=me+W+65535,W=Math.floor(R/65536),me=R-W*65536,R=j+W+65535,W=Math.floor(R/65536),j=R-W*65536,R=E+W+65535,W=Math.floor(R/65536),E=R-W*65536,R=m+W+65535,W=Math.floor(R/65536),m=R-W*65536,R=f+W+65535,W=Math.floor(R/65536),f=R-W*65536,R=g+W+65535,W=Math.floor(R/65536),g=R-W*65536,R=v+W+65535,W=Math.floor(R/65536),v=R-W*65536,R=x+W+65535,W=Math.floor(R/65536),x=R-W*65536,R=S+W+65535,W=Math.floor(R/65536),S=R-W*65536,R=A+W+65535,W=Math.floor(R/65536),A=R-W*65536,R=b+W+65535,W=Math.floor(R/65536),b=R-W*65536,R=P+W+65535,W=Math.floor(R/65536),P=R-W*65536,R=I+W+65535,W=Math.floor(R/65536),I=R-W*65536,R=F+W+65535,W=Math.floor(R/65536),F=R-W*65536,R=ce+W+65535,W=Math.floor(R/65536),ce=R-W*65536,ie+=W-1+37*(W-1),U[0]=ie,U[1]=me,U[2]=j,U[3]=E,U[4]=m,U[5]=f,U[6]=g,U[7]=v,U[8]=x,U[9]=S,U[10]=A,U[11]=b,U[12]=P,U[13]=I,U[14]=F,U[15]=ce}function _(U,z){y(U,z,z)}function M(U,z){const Z=n();for(let R=0;R<16;R++)Z[R]=z[R];for(let R=253;R>=0;R--)_(Z,Z),R!==2&&R!==4&&y(Z,Z,z);for(let R=0;R<16;R++)U[R]=Z[R]}function O(U,z){const Z=new Uint8Array(32),R=new Float64Array(80),W=n(),ie=n(),me=n(),j=n(),E=n(),m=n();for(let x=0;x<31;x++)Z[x]=U[x];Z[31]=U[31]&127|64,Z[0]&=248,l(R,z);for(let x=0;x<16;x++)ie[x]=R[x];W[0]=j[0]=1;for(let x=254;x>=0;--x){const S=Z[x>>>3]>>>(x&7)&1;a(W,ie,S),a(me,j,S),d(E,W,me),p(W,W,me),d(me,ie,j),p(ie,ie,j),_(j,E),_(m,W),y(W,me,W),y(me,ie,E),d(E,W,me),p(W,W,me),_(ie,W),p(me,j,m),y(W,me,s),d(W,W,j),y(me,me,W),y(W,j,m),y(j,ie,R),_(ie,E),a(W,ie,S),a(me,j,S)}for(let x=0;x<16;x++)R[x+16]=W[x],R[x+32]=me[x],R[x+48]=ie[x],R[x+64]=j[x];const f=R.subarray(32),g=R.subarray(16);M(f,f),y(g,g,f);const v=new Uint8Array(32);return u(v,g),v}t.scalarMult=O;function L(U){return O(U,i)}t.scalarMultBase=L;function B(U){if(U.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const z=new Uint8Array(U);return{publicKey:L(z),secretKey:z}}t.generateKeyPairFromSeed=B;function k(U){const z=(0,e.randomBytes)(32,U),Z=B(z);return(0,r.wipe)(z),Z}t.generateKeyPair=k;function H(U,z,Z=!1){if(U.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(z.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const R=O(U,z);if(Z){let W=0;for(let ie=0;ie",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}};var Ti={},e1={exports:{}};e1.exports,function(t){(function(e,r){function n(j,E){if(!j)throw new Error(E||"Assertion failed")}function i(j,E){j.super_=E;var m=function(){};m.prototype=E.prototype,j.prototype=new m,j.prototype.constructor=j}function s(j,E,m){if(s.isBN(j))return j;this.negative=0,this.words=null,this.length=0,this.red=null,j!==null&&((E==="le"||E==="be")&&(m=E,E=10),this._init(j||0,E||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=il.Buffer}catch{}s.isBN=function(E){return E instanceof s?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===s.wordSize&&Array.isArray(E.words)},s.max=function(E,m){return E.cmp(m)>0?E:m},s.min=function(E,m){return E.cmp(m)<0?E:m},s.prototype._init=function(E,m,f){if(typeof E=="number")return this._initNumber(E,m,f);if(typeof E=="object")return this._initArray(E,m,f);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),E=E.toString().replace(/\s+/g,"");var g=0;E[0]==="-"&&(g++,this.negative=1),g=0;g-=3)x=E[g]|E[g-1]<<8|E[g-2]<<16,this.words[v]|=x<>>26-S&67108863,S+=24,S>=26&&(S-=26,v++);else if(f==="le")for(g=0,v=0;g>>26-S&67108863,S+=24,S>=26&&(S-=26,v++);return this.strip()};function a(j,E){var m=j.charCodeAt(E);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function u(j,E,m){var f=a(j,m);return m-1>=E&&(f|=a(j,m-1)<<4),f}s.prototype._parseHex=function(E,m,f){this.length=Math.ceil((E.length-m)/6),this.words=new Array(this.length);for(var g=0;g=m;g-=2)S=u(E,m,g)<=18?(v-=18,x+=1,this.words[x]|=S>>>26):v+=8;else{var A=E.length-m;for(g=A%2===0?m+1:m;g=18?(v-=18,x+=1,this.words[x]|=S>>>26):v+=8}this.strip()};function l(j,E,m,f){for(var g=0,v=Math.min(j.length,m),x=E;x=49?g+=S-49+10:S>=17?g+=S-17+10:g+=S}return g}s.prototype._parseBase=function(E,m,f){this.words=[0],this.length=1;for(var g=0,v=1;v<=67108863;v*=m)g++;g--,v=v/m|0;for(var x=E.length-f,S=x%g,A=Math.min(x,x-S)+f,b=0,P=f;P1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var d=["","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"],p=[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],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(E,m){E=E||10,m=m|0||1;var f;if(E===16||E==="hex"){f="";for(var g=0,v=0,x=0;x>>24-g&16777215,g+=2,g>=26&&(g-=26,x--),v!==0||x!==this.length-1?f=d[6-A.length]+A+f:f=A+f}for(v!==0&&(f=v.toString(16)+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(E===(E|0)&&E>=2&&E<=36){var b=p[E],P=y[E];f="";var I=this.clone();for(I.negative=0;!I.isZero();){var F=I.modn(P).toString(E);I=I.idivn(P),I.isZero()?f=F+f:f=d[b-F.length]+F+f}for(this.isZero()&&(f="0"+f);f.length%m!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(E,m){return n(typeof o<"u"),this.toArrayLike(o,E,m)},s.prototype.toArray=function(E,m){return this.toArrayLike(Array,E,m)},s.prototype.toArrayLike=function(E,m,f){var g=this.byteLength(),v=f||Math.max(1,g);n(g<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var x=m==="le",S=new E(v),A,b,P=this.clone();if(x){for(b=0;!P.isZero();b++)A=P.andln(255),P.iushrn(8),S[b]=A;for(;b=4096&&(f+=13,m>>>=13),m>=64&&(f+=7,m>>>=7),m>=8&&(f+=4,m>>>=4),m>=2&&(f+=2,m>>>=2),f+m},s.prototype._zeroBits=function(E){if(E===0)return 26;var m=E,f=0;return m&8191||(f+=13,m>>>=13),m&127||(f+=7,m>>>=7),m&15||(f+=4,m>>>=4),m&3||(f+=2,m>>>=2),m&1||f++,f},s.prototype.bitLength=function(){var E=this.words[this.length-1],m=this._countBits(E);return(this.length-1)*26+m};function _(j){for(var E=new Array(j.bitLength()),m=0;m>>g}return E}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,m=0;mE.length?this.clone().ior(E):E.clone().ior(this)},s.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},s.prototype.iuand=function(E){var m;this.length>E.length?m=E:m=this;for(var f=0;fE.length?this.clone().iand(E):E.clone().iand(this)},s.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},s.prototype.iuxor=function(E){var m,f;this.length>E.length?(m=this,f=E):(m=E,f=this);for(var g=0;gE.length?this.clone().ixor(E):E.clone().ixor(this)},s.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},s.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var m=Math.ceil(E/26)|0,f=E%26;this._expand(m),f>0&&m--;for(var g=0;g0&&(this.words[g]=~this.words[g]&67108863>>26-f),this.strip()},s.prototype.notn=function(E){return this.clone().inotn(E)},s.prototype.setn=function(E,m){n(typeof E=="number"&&E>=0);var f=E/26|0,g=E%26;return this._expand(f+1),m?this.words[f]=this.words[f]|1<E.length?(f=this,g=E):(f=E,g=this);for(var v=0,x=0;x>>26;for(;v!==0&&x>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;xE.length?this.clone().iadd(E):E.clone().iadd(this)},s.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var m=this.iadd(E);return E.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var f=this.cmp(E);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var g,v;f>0?(g=this,v=E):(g=E,v=this);for(var x=0,S=0;S>26,this.words[S]=m&67108863;for(;x!==0&&S>26,this.words[S]=m&67108863;if(x===0&&S>>26,I=A&67108863,F=Math.min(b,E.length-1),ce=Math.max(0,b-j.length+1);ce<=F;ce++){var D=b-ce|0;g=j.words[D]|0,v=E.words[ce]|0,x=g*v+I,P+=x/67108864|0,I=x&67108863}m.words[b]=I|0,A=P|0}return A!==0?m.words[b]=A|0:m.length--,m.strip()}var O=function(E,m,f){var g=E.words,v=m.words,x=f.words,S=0,A,b,P,I=g[0]|0,F=I&8191,ce=I>>>13,D=g[1]|0,se=D&8191,ee=D>>>13,J=g[2]|0,Q=J&8191,T=J>>>13,X=g[3]|0,re=X&8191,ge=X>>>13,oe=g[4]|0,fe=oe&8191,be=oe>>>13,Me=g[5]|0,Ne=Me&8191,Te=Me>>>13,$e=g[6]|0,Ie=$e&8191,Le=$e>>>13,Ve=g[7]|0,ke=Ve&8191,ze=Ve>>>13,He=g[8]|0,Se=He&8191,Qe=He>>>13,ct=g[9]|0,Be=ct&8191,et=ct>>>13,rt=v[0]|0,Je=rt&8191,gt=rt>>>13,ht=v[1]|0,ft=ht&8191,Ht=ht>>>13,Jt=v[2]|0,St=Jt&8191,er=Jt>>>13,Xt=v[3]|0,Ot=Xt&8191,Bt=Xt>>>13,Tt=v[4]|0,bt=Tt&8191,Dt=Tt>>>13,Lt=v[5]|0,yt=Lt&8191,$t=Lt>>>13,jt=v[6]|0,nt=jt&8191,Ft=jt>>>13,$=v[7]|0,K=$&8191,G=$>>>13,C=v[8]|0,Y=C&8191,q=C>>>13,ae=v[9]|0,pe=ae&8191,_e=ae>>>13;f.negative=E.negative^m.negative,f.length=19,A=Math.imul(F,Je),b=Math.imul(F,gt),b=b+Math.imul(ce,Je)|0,P=Math.imul(ce,gt);var Re=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(Re>>>26)|0,Re&=67108863,A=Math.imul(se,Je),b=Math.imul(se,gt),b=b+Math.imul(ee,Je)|0,P=Math.imul(ee,gt),A=A+Math.imul(F,ft)|0,b=b+Math.imul(F,Ht)|0,b=b+Math.imul(ce,ft)|0,P=P+Math.imul(ce,Ht)|0;var De=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(De>>>26)|0,De&=67108863,A=Math.imul(Q,Je),b=Math.imul(Q,gt),b=b+Math.imul(T,Je)|0,P=Math.imul(T,gt),A=A+Math.imul(se,ft)|0,b=b+Math.imul(se,Ht)|0,b=b+Math.imul(ee,ft)|0,P=P+Math.imul(ee,Ht)|0,A=A+Math.imul(F,St)|0,b=b+Math.imul(F,er)|0,b=b+Math.imul(ce,St)|0,P=P+Math.imul(ce,er)|0;var it=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(it>>>26)|0,it&=67108863,A=Math.imul(re,Je),b=Math.imul(re,gt),b=b+Math.imul(ge,Je)|0,P=Math.imul(ge,gt),A=A+Math.imul(Q,ft)|0,b=b+Math.imul(Q,Ht)|0,b=b+Math.imul(T,ft)|0,P=P+Math.imul(T,Ht)|0,A=A+Math.imul(se,St)|0,b=b+Math.imul(se,er)|0,b=b+Math.imul(ee,St)|0,P=P+Math.imul(ee,er)|0,A=A+Math.imul(F,Ot)|0,b=b+Math.imul(F,Bt)|0,b=b+Math.imul(ce,Ot)|0,P=P+Math.imul(ce,Bt)|0;var Ue=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,A=Math.imul(fe,Je),b=Math.imul(fe,gt),b=b+Math.imul(be,Je)|0,P=Math.imul(be,gt),A=A+Math.imul(re,ft)|0,b=b+Math.imul(re,Ht)|0,b=b+Math.imul(ge,ft)|0,P=P+Math.imul(ge,Ht)|0,A=A+Math.imul(Q,St)|0,b=b+Math.imul(Q,er)|0,b=b+Math.imul(T,St)|0,P=P+Math.imul(T,er)|0,A=A+Math.imul(se,Ot)|0,b=b+Math.imul(se,Bt)|0,b=b+Math.imul(ee,Ot)|0,P=P+Math.imul(ee,Bt)|0,A=A+Math.imul(F,bt)|0,b=b+Math.imul(F,Dt)|0,b=b+Math.imul(ce,bt)|0,P=P+Math.imul(ce,Dt)|0;var mt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(mt>>>26)|0,mt&=67108863,A=Math.imul(Ne,Je),b=Math.imul(Ne,gt),b=b+Math.imul(Te,Je)|0,P=Math.imul(Te,gt),A=A+Math.imul(fe,ft)|0,b=b+Math.imul(fe,Ht)|0,b=b+Math.imul(be,ft)|0,P=P+Math.imul(be,Ht)|0,A=A+Math.imul(re,St)|0,b=b+Math.imul(re,er)|0,b=b+Math.imul(ge,St)|0,P=P+Math.imul(ge,er)|0,A=A+Math.imul(Q,Ot)|0,b=b+Math.imul(Q,Bt)|0,b=b+Math.imul(T,Ot)|0,P=P+Math.imul(T,Bt)|0,A=A+Math.imul(se,bt)|0,b=b+Math.imul(se,Dt)|0,b=b+Math.imul(ee,bt)|0,P=P+Math.imul(ee,Dt)|0,A=A+Math.imul(F,yt)|0,b=b+Math.imul(F,$t)|0,b=b+Math.imul(ce,yt)|0,P=P+Math.imul(ce,$t)|0;var st=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(st>>>26)|0,st&=67108863,A=Math.imul(Ie,Je),b=Math.imul(Ie,gt),b=b+Math.imul(Le,Je)|0,P=Math.imul(Le,gt),A=A+Math.imul(Ne,ft)|0,b=b+Math.imul(Ne,Ht)|0,b=b+Math.imul(Te,ft)|0,P=P+Math.imul(Te,Ht)|0,A=A+Math.imul(fe,St)|0,b=b+Math.imul(fe,er)|0,b=b+Math.imul(be,St)|0,P=P+Math.imul(be,er)|0,A=A+Math.imul(re,Ot)|0,b=b+Math.imul(re,Bt)|0,b=b+Math.imul(ge,Ot)|0,P=P+Math.imul(ge,Bt)|0,A=A+Math.imul(Q,bt)|0,b=b+Math.imul(Q,Dt)|0,b=b+Math.imul(T,bt)|0,P=P+Math.imul(T,Dt)|0,A=A+Math.imul(se,yt)|0,b=b+Math.imul(se,$t)|0,b=b+Math.imul(ee,yt)|0,P=P+Math.imul(ee,$t)|0,A=A+Math.imul(F,nt)|0,b=b+Math.imul(F,Ft)|0,b=b+Math.imul(ce,nt)|0,P=P+Math.imul(ce,Ft)|0;var tt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(tt>>>26)|0,tt&=67108863,A=Math.imul(ke,Je),b=Math.imul(ke,gt),b=b+Math.imul(ze,Je)|0,P=Math.imul(ze,gt),A=A+Math.imul(Ie,ft)|0,b=b+Math.imul(Ie,Ht)|0,b=b+Math.imul(Le,ft)|0,P=P+Math.imul(Le,Ht)|0,A=A+Math.imul(Ne,St)|0,b=b+Math.imul(Ne,er)|0,b=b+Math.imul(Te,St)|0,P=P+Math.imul(Te,er)|0,A=A+Math.imul(fe,Ot)|0,b=b+Math.imul(fe,Bt)|0,b=b+Math.imul(be,Ot)|0,P=P+Math.imul(be,Bt)|0,A=A+Math.imul(re,bt)|0,b=b+Math.imul(re,Dt)|0,b=b+Math.imul(ge,bt)|0,P=P+Math.imul(ge,Dt)|0,A=A+Math.imul(Q,yt)|0,b=b+Math.imul(Q,$t)|0,b=b+Math.imul(T,yt)|0,P=P+Math.imul(T,$t)|0,A=A+Math.imul(se,nt)|0,b=b+Math.imul(se,Ft)|0,b=b+Math.imul(ee,nt)|0,P=P+Math.imul(ee,Ft)|0,A=A+Math.imul(F,K)|0,b=b+Math.imul(F,G)|0,b=b+Math.imul(ce,K)|0,P=P+Math.imul(ce,G)|0;var At=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(At>>>26)|0,At&=67108863,A=Math.imul(Se,Je),b=Math.imul(Se,gt),b=b+Math.imul(Qe,Je)|0,P=Math.imul(Qe,gt),A=A+Math.imul(ke,ft)|0,b=b+Math.imul(ke,Ht)|0,b=b+Math.imul(ze,ft)|0,P=P+Math.imul(ze,Ht)|0,A=A+Math.imul(Ie,St)|0,b=b+Math.imul(Ie,er)|0,b=b+Math.imul(Le,St)|0,P=P+Math.imul(Le,er)|0,A=A+Math.imul(Ne,Ot)|0,b=b+Math.imul(Ne,Bt)|0,b=b+Math.imul(Te,Ot)|0,P=P+Math.imul(Te,Bt)|0,A=A+Math.imul(fe,bt)|0,b=b+Math.imul(fe,Dt)|0,b=b+Math.imul(be,bt)|0,P=P+Math.imul(be,Dt)|0,A=A+Math.imul(re,yt)|0,b=b+Math.imul(re,$t)|0,b=b+Math.imul(ge,yt)|0,P=P+Math.imul(ge,$t)|0,A=A+Math.imul(Q,nt)|0,b=b+Math.imul(Q,Ft)|0,b=b+Math.imul(T,nt)|0,P=P+Math.imul(T,Ft)|0,A=A+Math.imul(se,K)|0,b=b+Math.imul(se,G)|0,b=b+Math.imul(ee,K)|0,P=P+Math.imul(ee,G)|0,A=A+Math.imul(F,Y)|0,b=b+Math.imul(F,q)|0,b=b+Math.imul(ce,Y)|0,P=P+Math.imul(ce,q)|0;var Rt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,A=Math.imul(Be,Je),b=Math.imul(Be,gt),b=b+Math.imul(et,Je)|0,P=Math.imul(et,gt),A=A+Math.imul(Se,ft)|0,b=b+Math.imul(Se,Ht)|0,b=b+Math.imul(Qe,ft)|0,P=P+Math.imul(Qe,Ht)|0,A=A+Math.imul(ke,St)|0,b=b+Math.imul(ke,er)|0,b=b+Math.imul(ze,St)|0,P=P+Math.imul(ze,er)|0,A=A+Math.imul(Ie,Ot)|0,b=b+Math.imul(Ie,Bt)|0,b=b+Math.imul(Le,Ot)|0,P=P+Math.imul(Le,Bt)|0,A=A+Math.imul(Ne,bt)|0,b=b+Math.imul(Ne,Dt)|0,b=b+Math.imul(Te,bt)|0,P=P+Math.imul(Te,Dt)|0,A=A+Math.imul(fe,yt)|0,b=b+Math.imul(fe,$t)|0,b=b+Math.imul(be,yt)|0,P=P+Math.imul(be,$t)|0,A=A+Math.imul(re,nt)|0,b=b+Math.imul(re,Ft)|0,b=b+Math.imul(ge,nt)|0,P=P+Math.imul(ge,Ft)|0,A=A+Math.imul(Q,K)|0,b=b+Math.imul(Q,G)|0,b=b+Math.imul(T,K)|0,P=P+Math.imul(T,G)|0,A=A+Math.imul(se,Y)|0,b=b+Math.imul(se,q)|0,b=b+Math.imul(ee,Y)|0,P=P+Math.imul(ee,q)|0,A=A+Math.imul(F,pe)|0,b=b+Math.imul(F,_e)|0,b=b+Math.imul(ce,pe)|0,P=P+Math.imul(ce,_e)|0;var Mt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,A=Math.imul(Be,ft),b=Math.imul(Be,Ht),b=b+Math.imul(et,ft)|0,P=Math.imul(et,Ht),A=A+Math.imul(Se,St)|0,b=b+Math.imul(Se,er)|0,b=b+Math.imul(Qe,St)|0,P=P+Math.imul(Qe,er)|0,A=A+Math.imul(ke,Ot)|0,b=b+Math.imul(ke,Bt)|0,b=b+Math.imul(ze,Ot)|0,P=P+Math.imul(ze,Bt)|0,A=A+Math.imul(Ie,bt)|0,b=b+Math.imul(Ie,Dt)|0,b=b+Math.imul(Le,bt)|0,P=P+Math.imul(Le,Dt)|0,A=A+Math.imul(Ne,yt)|0,b=b+Math.imul(Ne,$t)|0,b=b+Math.imul(Te,yt)|0,P=P+Math.imul(Te,$t)|0,A=A+Math.imul(fe,nt)|0,b=b+Math.imul(fe,Ft)|0,b=b+Math.imul(be,nt)|0,P=P+Math.imul(be,Ft)|0,A=A+Math.imul(re,K)|0,b=b+Math.imul(re,G)|0,b=b+Math.imul(ge,K)|0,P=P+Math.imul(ge,G)|0,A=A+Math.imul(Q,Y)|0,b=b+Math.imul(Q,q)|0,b=b+Math.imul(T,Y)|0,P=P+Math.imul(T,q)|0,A=A+Math.imul(se,pe)|0,b=b+Math.imul(se,_e)|0,b=b+Math.imul(ee,pe)|0,P=P+Math.imul(ee,_e)|0;var Et=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(Et>>>26)|0,Et&=67108863,A=Math.imul(Be,St),b=Math.imul(Be,er),b=b+Math.imul(et,St)|0,P=Math.imul(et,er),A=A+Math.imul(Se,Ot)|0,b=b+Math.imul(Se,Bt)|0,b=b+Math.imul(Qe,Ot)|0,P=P+Math.imul(Qe,Bt)|0,A=A+Math.imul(ke,bt)|0,b=b+Math.imul(ke,Dt)|0,b=b+Math.imul(ze,bt)|0,P=P+Math.imul(ze,Dt)|0,A=A+Math.imul(Ie,yt)|0,b=b+Math.imul(Ie,$t)|0,b=b+Math.imul(Le,yt)|0,P=P+Math.imul(Le,$t)|0,A=A+Math.imul(Ne,nt)|0,b=b+Math.imul(Ne,Ft)|0,b=b+Math.imul(Te,nt)|0,P=P+Math.imul(Te,Ft)|0,A=A+Math.imul(fe,K)|0,b=b+Math.imul(fe,G)|0,b=b+Math.imul(be,K)|0,P=P+Math.imul(be,G)|0,A=A+Math.imul(re,Y)|0,b=b+Math.imul(re,q)|0,b=b+Math.imul(ge,Y)|0,P=P+Math.imul(ge,q)|0,A=A+Math.imul(Q,pe)|0,b=b+Math.imul(Q,_e)|0,b=b+Math.imul(T,pe)|0,P=P+Math.imul(T,_e)|0;var dt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(dt>>>26)|0,dt&=67108863,A=Math.imul(Be,Ot),b=Math.imul(Be,Bt),b=b+Math.imul(et,Ot)|0,P=Math.imul(et,Bt),A=A+Math.imul(Se,bt)|0,b=b+Math.imul(Se,Dt)|0,b=b+Math.imul(Qe,bt)|0,P=P+Math.imul(Qe,Dt)|0,A=A+Math.imul(ke,yt)|0,b=b+Math.imul(ke,$t)|0,b=b+Math.imul(ze,yt)|0,P=P+Math.imul(ze,$t)|0,A=A+Math.imul(Ie,nt)|0,b=b+Math.imul(Ie,Ft)|0,b=b+Math.imul(Le,nt)|0,P=P+Math.imul(Le,Ft)|0,A=A+Math.imul(Ne,K)|0,b=b+Math.imul(Ne,G)|0,b=b+Math.imul(Te,K)|0,P=P+Math.imul(Te,G)|0,A=A+Math.imul(fe,Y)|0,b=b+Math.imul(fe,q)|0,b=b+Math.imul(be,Y)|0,P=P+Math.imul(be,q)|0,A=A+Math.imul(re,pe)|0,b=b+Math.imul(re,_e)|0,b=b+Math.imul(ge,pe)|0,P=P+Math.imul(ge,_e)|0;var _t=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(_t>>>26)|0,_t&=67108863,A=Math.imul(Be,bt),b=Math.imul(Be,Dt),b=b+Math.imul(et,bt)|0,P=Math.imul(et,Dt),A=A+Math.imul(Se,yt)|0,b=b+Math.imul(Se,$t)|0,b=b+Math.imul(Qe,yt)|0,P=P+Math.imul(Qe,$t)|0,A=A+Math.imul(ke,nt)|0,b=b+Math.imul(ke,Ft)|0,b=b+Math.imul(ze,nt)|0,P=P+Math.imul(ze,Ft)|0,A=A+Math.imul(Ie,K)|0,b=b+Math.imul(Ie,G)|0,b=b+Math.imul(Le,K)|0,P=P+Math.imul(Le,G)|0,A=A+Math.imul(Ne,Y)|0,b=b+Math.imul(Ne,q)|0,b=b+Math.imul(Te,Y)|0,P=P+Math.imul(Te,q)|0,A=A+Math.imul(fe,pe)|0,b=b+Math.imul(fe,_e)|0,b=b+Math.imul(be,pe)|0,P=P+Math.imul(be,_e)|0;var ot=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(ot>>>26)|0,ot&=67108863,A=Math.imul(Be,yt),b=Math.imul(Be,$t),b=b+Math.imul(et,yt)|0,P=Math.imul(et,$t),A=A+Math.imul(Se,nt)|0,b=b+Math.imul(Se,Ft)|0,b=b+Math.imul(Qe,nt)|0,P=P+Math.imul(Qe,Ft)|0,A=A+Math.imul(ke,K)|0,b=b+Math.imul(ke,G)|0,b=b+Math.imul(ze,K)|0,P=P+Math.imul(ze,G)|0,A=A+Math.imul(Ie,Y)|0,b=b+Math.imul(Ie,q)|0,b=b+Math.imul(Le,Y)|0,P=P+Math.imul(Le,q)|0,A=A+Math.imul(Ne,pe)|0,b=b+Math.imul(Ne,_e)|0,b=b+Math.imul(Te,pe)|0,P=P+Math.imul(Te,_e)|0;var wt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(wt>>>26)|0,wt&=67108863,A=Math.imul(Be,nt),b=Math.imul(Be,Ft),b=b+Math.imul(et,nt)|0,P=Math.imul(et,Ft),A=A+Math.imul(Se,K)|0,b=b+Math.imul(Se,G)|0,b=b+Math.imul(Qe,K)|0,P=P+Math.imul(Qe,G)|0,A=A+Math.imul(ke,Y)|0,b=b+Math.imul(ke,q)|0,b=b+Math.imul(ze,Y)|0,P=P+Math.imul(ze,q)|0,A=A+Math.imul(Ie,pe)|0,b=b+Math.imul(Ie,_e)|0,b=b+Math.imul(Le,pe)|0,P=P+Math.imul(Le,_e)|0;var lt=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(lt>>>26)|0,lt&=67108863,A=Math.imul(Be,K),b=Math.imul(Be,G),b=b+Math.imul(et,K)|0,P=Math.imul(et,G),A=A+Math.imul(Se,Y)|0,b=b+Math.imul(Se,q)|0,b=b+Math.imul(Qe,Y)|0,P=P+Math.imul(Qe,q)|0,A=A+Math.imul(ke,pe)|0,b=b+Math.imul(ke,_e)|0,b=b+Math.imul(ze,pe)|0,P=P+Math.imul(ze,_e)|0;var at=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(at>>>26)|0,at&=67108863,A=Math.imul(Be,Y),b=Math.imul(Be,q),b=b+Math.imul(et,Y)|0,P=Math.imul(et,q),A=A+Math.imul(Se,pe)|0,b=b+Math.imul(Se,_e)|0,b=b+Math.imul(Qe,pe)|0,P=P+Math.imul(Qe,_e)|0;var Ae=(S+A|0)+((b&8191)<<13)|0;S=(P+(b>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,A=Math.imul(Be,pe),b=Math.imul(Be,_e),b=b+Math.imul(et,pe)|0,P=Math.imul(et,_e);var Pe=(S+A|0)+((b&8191)<<13)|0;return S=(P+(b>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,x[0]=Re,x[1]=De,x[2]=it,x[3]=Ue,x[4]=mt,x[5]=st,x[6]=tt,x[7]=At,x[8]=Rt,x[9]=Mt,x[10]=Et,x[11]=dt,x[12]=_t,x[13]=ot,x[14]=wt,x[15]=lt,x[16]=at,x[17]=Ae,x[18]=Pe,S!==0&&(x[19]=S,f.length++),f};Math.imul||(O=M);function L(j,E,m){m.negative=E.negative^j.negative,m.length=j.length+E.length;for(var f=0,g=0,v=0;v>>26)|0,g+=x>>>26,x&=67108863}m.words[v]=S,f=x,x=g}return f!==0?m.words[v]=f:m.length--,m.strip()}function B(j,E,m){var f=new k;return f.mulp(j,E,m)}s.prototype.mulTo=function(E,m){var f,g=this.length+E.length;return this.length===10&&E.length===10?f=O(this,E,m):g<63?f=M(this,E,m):g<1024?f=L(this,E,m):f=B(this,E,m),f};function k(j,E){this.x=j,this.y=E}k.prototype.makeRBT=function(E){for(var m=new Array(E),f=s.prototype._countBits(E)-1,g=0;g>=1;return g},k.prototype.permute=function(E,m,f,g,v,x){for(var S=0;S>>1)v++;return 1<>>13,f[2*x+1]=v&8191,v=v>>>13;for(x=2*m;x>=26,m+=g/67108864|0,m+=v>>>26,this.words[f]=v&67108863}return m!==0&&(this.words[f]=m,this.length++),this},s.prototype.muln=function(E){return this.clone().imuln(E)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(E){var m=_(E);if(m.length===0)return new s(1);for(var f=this,g=0;g=0);var m=E%26,f=(E-m)/26,g=67108863>>>26-m<<26-m,v;if(m!==0){var x=0;for(v=0;v>>26-m}x&&(this.words[v]=x,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var g;m?g=(m-m%26)/26:g=0;var v=E%26,x=Math.min((E-v)/26,this.length),S=67108863^67108863>>>v<x)for(this.length-=x,b=0;b=0&&(P!==0||b>=g);b--){var I=this.words[b]|0;this.words[b]=P<<26-v|I>>>v,P=I&S}return A&&P!==0&&(A.words[A.length++]=P),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(E,m,f){return n(this.negative===0),this.iushrn(E,m,f)},s.prototype.shln=function(E){return this.clone().ishln(E)},s.prototype.ushln=function(E){return this.clone().iushln(E)},s.prototype.shrn=function(E){return this.clone().ishrn(E)},s.prototype.ushrn=function(E){return this.clone().iushrn(E)},s.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var m=E%26,f=(E-m)/26,g=1<=0);var m=E%26,f=(E-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(m!==0&&f++,this.length=Math.min(f,this.length),m!==0){var g=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(A/67108864|0),this.words[v+f]=x&67108863}for(;v>26,this.words[v+f]=x&67108863;if(S===0)return this.strip();for(n(S===-1),S=0,v=0;v>26,this.words[v]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(E,m){var f=this.length-E.length,g=this.clone(),v=E,x=v.words[v.length-1]|0,S=this._countBits(x);f=26-S,f!==0&&(v=v.ushln(f),g.iushln(f),x=v.words[v.length-1]|0);var A=g.length-v.length,b;if(m!=="mod"){b=new s(null),b.length=A+1,b.words=new Array(b.length);for(var P=0;P=0;F--){var ce=(g.words[v.length+F]|0)*67108864+(g.words[v.length+F-1]|0);for(ce=Math.min(ce/x|0,67108863),g._ishlnsubmul(v,ce,F);g.negative!==0;)ce--,g.negative=0,g._ishlnsubmul(v,1,F),g.isZero()||(g.negative^=1);b&&(b.words[F]=ce)}return b&&b.strip(),g.strip(),m!=="div"&&f!==0&&g.iushrn(f),{div:b||null,mod:g}},s.prototype.divmod=function(E,m,f){if(n(!E.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var g,v,x;return this.negative!==0&&E.negative===0?(x=this.neg().divmod(E,m),m!=="mod"&&(g=x.div.neg()),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.iadd(E)),{div:g,mod:v}):this.negative===0&&E.negative!==0?(x=this.divmod(E.neg(),m),m!=="mod"&&(g=x.div.neg()),{div:g,mod:x.mod}):this.negative&E.negative?(x=this.neg().divmod(E.neg(),m),m!=="div"&&(v=x.mod.neg(),f&&v.negative!==0&&v.isub(E)),{div:x.div,mod:v}):E.length>this.length||this.cmp(E)<0?{div:new s(0),mod:this}:E.length===1?m==="div"?{div:this.divn(E.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new s(this.modn(E.words[0]))}:this._wordDiv(E,m)},s.prototype.div=function(E){return this.divmod(E,"div",!1).div},s.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},s.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},s.prototype.divRound=function(E){var m=this.divmod(E);if(m.mod.isZero())return m.div;var f=m.div.negative!==0?m.mod.isub(E):m.mod,g=E.ushrn(1),v=E.andln(1),x=f.cmp(g);return x<0||v===1&&x===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(E){n(E<=67108863);for(var m=(1<<26)%E,f=0,g=this.length-1;g>=0;g--)f=(m*f+(this.words[g]|0))%E;return f},s.prototype.idivn=function(E){n(E<=67108863);for(var m=0,f=this.length-1;f>=0;f--){var g=(this.words[f]|0)+m*67108864;this.words[f]=g/E|0,m=g%E}return this.strip()},s.prototype.divn=function(E){return this.clone().idivn(E)},s.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=new s(0),S=new s(1),A=0;m.isEven()&&f.isEven();)m.iushrn(1),f.iushrn(1),++A;for(var b=f.clone(),P=m.clone();!m.isZero();){for(var I=0,F=1;!(m.words[0]&F)&&I<26;++I,F<<=1);if(I>0)for(m.iushrn(I);I-- >0;)(g.isOdd()||v.isOdd())&&(g.iadd(b),v.isub(P)),g.iushrn(1),v.iushrn(1);for(var ce=0,D=1;!(f.words[0]&D)&&ce<26;++ce,D<<=1);if(ce>0)for(f.iushrn(ce);ce-- >0;)(x.isOdd()||S.isOdd())&&(x.iadd(b),S.isub(P)),x.iushrn(1),S.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(x),v.isub(S)):(f.isub(m),x.isub(g),S.isub(v))}return{a:x,b:S,gcd:f.iushln(A)}},s.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var m=this,f=E.clone();m.negative!==0?m=m.umod(E):m=m.clone();for(var g=new s(1),v=new s(0),x=f.clone();m.cmpn(1)>0&&f.cmpn(1)>0;){for(var S=0,A=1;!(m.words[0]&A)&&S<26;++S,A<<=1);if(S>0)for(m.iushrn(S);S-- >0;)g.isOdd()&&g.iadd(x),g.iushrn(1);for(var b=0,P=1;!(f.words[0]&P)&&b<26;++b,P<<=1);if(b>0)for(f.iushrn(b);b-- >0;)v.isOdd()&&v.iadd(x),v.iushrn(1);m.cmp(f)>=0?(m.isub(f),g.isub(v)):(f.isub(m),v.isub(g))}var I;return m.cmpn(1)===0?I=g:I=v,I.cmpn(0)<0&&I.iadd(E),I},s.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var m=this.clone(),f=E.clone();m.negative=0,f.negative=0;for(var g=0;m.isEven()&&f.isEven();g++)m.iushrn(1),f.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=m.cmp(f);if(v<0){var x=m;m=f,f=x}else if(v===0||f.cmpn(1)===0)break;m.isub(f)}while(!0);return f.iushln(g)},s.prototype.invm=function(E){return this.egcd(E).a.umod(E)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(E){return this.words[0]&E},s.prototype.bincn=function(E){n(typeof E=="number");var m=E%26,f=(E-m)/26,g=1<>>26,S&=67108863,this.words[x]=S}return v!==0&&(this.words[x]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(E){var m=E<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var f;if(this.length>1)f=1;else{m&&(E=-E),n(E<=67108863,"Number is too big");var g=this.words[0]|0;f=g===E?0:gE.length)return 1;if(this.length=0;f--){var g=this.words[f]|0,v=E.words[f]|0;if(g!==v){gv&&(m=1);break}}return m},s.prototype.gtn=function(E){return this.cmpn(E)===1},s.prototype.gt=function(E){return this.cmp(E)===1},s.prototype.gten=function(E){return this.cmpn(E)>=0},s.prototype.gte=function(E){return this.cmp(E)>=0},s.prototype.ltn=function(E){return this.cmpn(E)===-1},s.prototype.lt=function(E){return this.cmp(E)===-1},s.prototype.lten=function(E){return this.cmpn(E)<=0},s.prototype.lte=function(E){return this.cmp(E)<=0},s.prototype.eqn=function(E){return this.cmpn(E)===0},s.prototype.eq=function(E){return this.cmp(E)===0},s.red=function(E){return new ie(E)},s.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(E){return this.red=E,this},s.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},s.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},s.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},s.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},s.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},s.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},s.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},s.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var H={k256:null,p224:null,p192:null,p25519:null};function U(j,E){this.name=j,this.p=new s(E,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var E=new s(null);return E.words=new Array(Math.ceil(this.n/13)),E},U.prototype.ireduce=function(E){var m=E,f;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),f=m.bitLength();while(f>this.n);var g=f0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},U.prototype.split=function(E,m){E.iushrn(this.n,0,m)},U.prototype.imulK=function(E){return E.imul(this.k)};function z(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(z,U),z.prototype.split=function(E,m){for(var f=4194303,g=Math.min(E.length,9),v=0;v>>22,x=S}x>>>=22,E.words[v-10]=x,x===0&&E.length>10?E.length-=10:E.length-=9},z.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var m=0,f=0;f>>=26,E.words[f]=v,m=g}return m!==0&&(E.words[E.length++]=m),E},s._prime=function(E){if(H[E])return H[E];var m;if(E==="k256")m=new z;else if(E==="p224")m=new Z;else if(E==="p192")m=new R;else if(E==="p25519")m=new W;else throw new Error("Unknown prime "+E);return H[E]=m,m};function ie(j){if(typeof j=="string"){var E=s._prime(j);this.m=E.p,this.prime=E}else n(j.gtn(1),"modulus must be greater than 1"),this.m=j,this.prime=null}ie.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},ie.prototype._verify2=function(E,m){n((E.negative|m.negative)===0,"red works only with positives"),n(E.red&&E.red===m.red,"red works only with red numbers")},ie.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},ie.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},ie.prototype.add=function(E,m){this._verify2(E,m);var f=E.add(m);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},ie.prototype.iadd=function(E,m){this._verify2(E,m);var f=E.iadd(m);return f.cmp(this.m)>=0&&f.isub(this.m),f},ie.prototype.sub=function(E,m){this._verify2(E,m);var f=E.sub(m);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},ie.prototype.isub=function(E,m){this._verify2(E,m);var f=E.isub(m);return f.cmpn(0)<0&&f.iadd(this.m),f},ie.prototype.shl=function(E,m){return this._verify1(E),this.imod(E.ushln(m))},ie.prototype.imul=function(E,m){return this._verify2(E,m),this.imod(E.imul(m))},ie.prototype.mul=function(E,m){return this._verify2(E,m),this.imod(E.mul(m))},ie.prototype.isqr=function(E){return this.imul(E,E.clone())},ie.prototype.sqr=function(E){return this.mul(E,E)},ie.prototype.sqrt=function(E){if(E.isZero())return E.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(E,f)}for(var g=this.m.subn(1),v=0;!g.isZero()&&g.andln(1)===0;)v++,g.iushrn(1);n(!g.isZero());var x=new s(1).toRed(this),S=x.redNeg(),A=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new s(2*b*b).toRed(this);this.pow(b,A).cmp(S)!==0;)b.redIAdd(S);for(var P=this.pow(b,g),I=this.pow(E,g.addn(1).iushrn(1)),F=this.pow(E,g),ce=v;F.cmp(x)!==0;){for(var D=F,se=0;D.cmp(x)!==0;se++)D=D.redSqr();n(se=0;v--){for(var P=m.words[v],I=b-1;I>=0;I--){var F=P>>I&1;if(x!==g[0]&&(x=this.sqr(x)),F===0&&S===0){A=0;continue}S<<=1,S|=F,A++,!(A!==f&&(v!==0||I!==0))&&(x=this.mul(x,g[S]),A=0,S=0)}b=26}return x},ie.prototype.convertTo=function(E){var m=E.umod(this.m);return m===E?m.clone():m},ie.prototype.convertFrom=function(E){var m=E.clone();return m.red=null,m},s.mont=function(E){return new me(E)};function me(j){ie.call(this,j),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(me,ie),me.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},me.prototype.convertFrom=function(E){var m=this.imod(E.mul(this.rinv));return m.red=null,m},me.prototype.imul=function(E,m){if(E.isZero()||m.isZero())return E.words[0]=0,E.length=1,E;var f=E.imul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},me.prototype.mul=function(E,m){if(E.isZero()||m.isZero())return new s(0)._forceRed(this);var f=E.mul(m),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(g).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},me.prototype.invm=function(E){var m=this.imod(E._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,nn)}(e1);var xo=e1.exports,t1={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var u=0;u>8,p=l&255;d?a.push(d,p):a.push(p)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(O>>1)-1?B=(O>>1)-k:B=k,L.isubn(B)):B=0,_[M]=B,L.iushrn(1)}return _}e.getNAF=s;function o(d,p){var y=[[],[]];d=d.clone(),p=p.clone();for(var _=0,M=0,O;d.cmpn(-_)>0||p.cmpn(-M)>0;){var L=d.andln(3)+_&3,B=p.andln(3)+M&3;L===3&&(L=-1),B===3&&(B=-1);var k;L&1?(O=d.andln(7)+_&7,(O===3||O===5)&&B===2?k=-L:k=L):k=0,y[0].push(k);var H;B&1?(O=p.andln(7)+M&7,(O===3||O===5)&&L===2?H=-B:H=B):H=0,y[1].push(H),2*_===k+1&&(_=1-_),2*M===H+1&&(M=1-M),d.iushrn(1),p.iushrn(1)}return y}e.getJSF=o;function a(d,p,y){var _="_"+p;d.prototype[p]=function(){return this[_]!==void 0?this[_]:this[_]=y.call(this)}}e.cachedProperty=a;function u(d){return typeof d=="string"?e.toArray(d,"hex"):d}e.parseBytes=u;function l(d){return new r(d,"hex","le")}e.intFromLE=l}(Ti);var r1={exports:{}},n1;r1.exports=function(e){return n1||(n1=new la(null)),n1.generate(e)};function la(t){this.rand=t}if(r1.exports.Rand=la,la.prototype.generate=function(e){return this._rand(e)},la.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var zd=ha;ha.prototype.point=function(){throw new Error("Not implemented")},ha.prototype.validate=function(){throw new Error("Not implemented")},ha.prototype._fixedNafMul=function(e,r){qd(e.precomputed);var n=e._getDoubles(),i=Ud(r,1,this._bitLength),s=(1<=a;l--)u=(u<<1)+i[l];o.push(u)}for(var d=this.jpoint(null,null,null),p=this.jpoint(null,null,null),y=s;y>0;y--){for(a=0;a=0;u--){for(var l=0;u>=0&&o[u]===0;u--)l++;if(u>=0&&l++,a=a.dblp(l),u<0)break;var d=o[u];qd(d!==0),e.type==="affine"?d>0?a=a.mixedAdd(s[d-1>>1]):a=a.mixedAdd(s[-d-1>>1].neg()):d>0?a=a.add(s[d-1>>1]):a=a.add(s[-d-1>>1].neg())}return e.type==="affine"?a.toP():a},ha.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,u=this._wnafT3,l=0,d,p,y;for(d=0;d=1;d-=2){var M=d-1,O=d;if(o[M]!==1||o[O]!==1){u[M]=Ud(n[M],o[M],this._bitLength),u[O]=Ud(n[O],o[O],this._bitLength),l=Math.max(u[M].length,l),l=Math.max(u[O].length,l);continue}var L=[r[M],null,null,r[O]];r[M].y.cmp(r[O].y)===0?(L[1]=r[M].add(r[O]),L[2]=r[M].toJ().mixedAdd(r[O].neg())):r[M].y.cmp(r[O].y.redNeg())===0?(L[1]=r[M].toJ().mixedAdd(r[O]),L[2]=r[M].add(r[O].neg())):(L[1]=r[M].toJ().mixedAdd(r[O]),L[2]=r[M].toJ().mixedAdd(r[O].neg()));var B=[-3,-1,-5,-7,0,7,5,1,3],k=lB(n[M],n[O]);for(l=Math.max(k[0].length,l),u[M]=new Array(l),u[O]=new Array(l),p=0;p=0;d--){for(var R=0;d>=0;){var W=!0;for(p=0;p=0&&R++,z=z.dblp(R),d<0)break;for(p=0;p0?y=a[p][ie-1>>1]:ie<0&&(y=a[p][-ie-1>>1].neg()),y.type==="affine"?z=z.mixedAdd(y):z=z.add(y))}}for(d=0;d=Math.ceil((e.bitLength()+1)/r.step):!1},Gi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(_=l,M=d),p.negative&&(p=p.neg(),y=y.neg()),_.negative&&(_=_.neg(),M=M.neg()),[{a:p,b:y},{a:_,b:M}]},Yi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),u=o.mul(i.a),l=s.mul(n.b),d=o.mul(i.b),p=e.sub(a).sub(u),y=l.add(d).neg();return{k1:p,k2:y}},Yi.prototype.pointFromX=function(e,r){e=new en(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Yi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Yi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},Rn.prototype.isInfinity=function(){return this.inf},Rn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},Rn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Rn.prototype.getX=function(){return this.x.fromRed()},Rn.prototype.getY=function(){return this.y.fromRed()},Rn.prototype.mul=function(e){return e=new en(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Rn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},Rn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},Rn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Rn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},Rn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Fn(t,e,r,n){yu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new en(0)):(this.x=new en(e,16),this.y=new en(r,16),this.z=new en(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}s1(Fn,yu.BasePoint),Yi.prototype.jpoint=function(e,r,n){return new Fn(this,e,r,n)},Fn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},Fn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Fn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),u=i.redSub(s),l=o.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),p=d.redMul(u),y=i.redMul(d),_=l.redSqr().redIAdd(p).redISub(y).redISub(y),M=l.redMul(y.redISub(_)).redISub(o.redMul(p)),O=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(_,M,O)},Fn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),u=s.redSub(o);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),d=l.redMul(a),p=n.redMul(l),y=u.redSqr().redIAdd(d).redISub(p).redISub(p),_=u.redMul(p.redISub(y)).redISub(s.redMul(d)),M=this.z.redMul(a);return this.curve.jpoint(y,_,M)},Fn.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},Fn.prototype.inspect=function(){return this.isInfinity()?"":""},Fn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var wu=xo,i_=Rd,Hd=zd,gB=Ti;function xu(t){Hd.call(this,"mont",t),this.a=new wu(t.a,16).toRed(this.red),this.b=new wu(t.b,16).toRed(this.red),this.i4=new wu(4).toRed(this.red).redInvm(),this.two=new wu(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}i_(xu,Hd);var mB=xu;xu.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function Dn(t,e,r){Hd.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new wu(e,16),this.z=new wu(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i_(Dn,Hd.BasePoint),xu.prototype.decodePoint=function(e,r){return this.point(gB.toArray(e,r),1)},xu.prototype.point=function(e,r){return new Dn(this,e,r)},xu.prototype.pointFromJSON=function(e){return Dn.fromJSON(this,e)},Dn.prototype.precompute=function(){},Dn.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Dn.fromJSON=function(e,r){return new Dn(e,r[0],r[1]||e.one)},Dn.prototype.inspect=function(){return this.isInfinity()?"":""},Dn.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Dn.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)},Dn.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Dn.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),u=s.redMul(i),l=r.z.redMul(a.redAdd(u).redSqr()),d=r.x.redMul(a.redISub(u).redSqr());return this.curve.point(l,d)},Dn.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i},Dn.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Dn.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Dn.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Dn.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Dn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var vB=Ti,_o=xo,s_=Rd,Wd=zd,bB=vB.assert;function Vs(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Wd.call(this,"edwards",t),this.a=new _o(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new _o(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new _o(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),bB(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}s_(Vs,Wd);var yB=Vs;Vs.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},Vs.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},Vs.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)},Vs.prototype.pointFromX=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var u=a.fromRed().isOdd();return(r&&!u||!r&&u)&&(a=a.redNeg()),this.point(e,a)},Vs.prototype.pointFromY=function(e,r){e=new _o(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)},Vs.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function Hr(t,e,r,n,i){Wd.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new _o(e,16),this.y=new _o(r,16),this.z=n?new _o(n,16):this.curve.one,this.t=i&&new _o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}s_(Hr,Wd.BasePoint),Vs.prototype.pointFromJSON=function(e){return Hr.fromJSON(this,e)},Vs.prototype.point=function(e,r,n,i){return new Hr(this,e,r,n,i)},Hr.fromJSON=function(e,r){return new Hr(e,r[0],r[1],r[2])},Hr.prototype.inspect=function(){return this.isInfinity()?"":""},Hr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Hr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),u=i.redSub(r),l=s.redMul(a),d=o.redMul(u),p=s.redMul(u),y=a.redMul(o);return this.curve.point(l,d,y,p)},Hr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,u,l;if(this.curve.twisted){a=this.curve._mulA(r);var d=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(d.redSub(this.curve.two)),s=d.redMul(a.redSub(n)),o=d.redSqr().redSub(d).redSub(d)):(u=this.z.redSqr(),l=d.redSub(u).redISub(u),i=e.redSub(r).redISub(n).redMul(l),s=d.redMul(a.redSub(n)),o=d.redMul(l))}else a=r.redAdd(n),u=this.curve._mulC(this.z).redSqr(),l=a.redSub(u).redSub(u),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)},Hr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Hr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),u=s.redAdd(i),l=n.redAdd(r),d=o.redMul(a),p=u.redMul(l),y=o.redMul(l),_=a.redMul(u);return this.curve.point(d,p,_,y)},Hr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),u=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),d=r.redMul(a).redMul(l),p,y;return this.curve.twisted?(p=r.redMul(u).redMul(s.redSub(this.curve._mulA(i))),y=a.redMul(u)):(p=r.redMul(u).redMul(s.redSub(i)),y=this.curve._mulC(a).redMul(u)),this.curve.point(d,p,y)},Hr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Hr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Hr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)},Hr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)},Hr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Hr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Hr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Hr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Hr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Hr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Hr.prototype.toP=Hr.prototype.normalize,Hr.prototype.mixedAdd=Hr.prototype.add,function(t){var e=t;e.base=zd,e.short=pB,e.mont=mB,e.edwards=yB}(i1);var Kd={},o1,o_;function wB(){return o_||(o_=1,o1={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),o1}(function(t){var e=t,r=fl,n=i1,i=Ti,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,d){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var p=new o(d);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:p}),p}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=wB()}catch{u=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})})(Kd);var xB=fl,sc=t1,a_=tc;function da(t){if(!(this instanceof da))return new da(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=sc.toArray(t.entropy,t.entropyEnc||"hex"),r=sc.toArray(t.nonce,t.nonceEnc||"hex"),n=sc.toArray(t.pers,t.persEnc||"hex");a_(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var _B=da;da.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},da.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=sc.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var Vd=xo,c1=Ti,PB=c1.assert;function Gd(t,e){if(t instanceof Gd)return t;this._importDER(t,e)||(PB(t.r&&t.s,"Signature without r or s"),this.r=new Vd(t.r,16),this.s=new Vd(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var MB=Gd;function IB(){this.place=0}function u1(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function c_(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Gd.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=c_(r),n=c_(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];f1(i,r.length),i=i.concat(r),i.push(2),f1(i,n.length);var s=i.concat(n),o=[48];return f1(o,s.length),o=o.concat(s),c1.encode(o,e)};var Eo=xo,u_=_B,CB=Ti,l1=Kd,TB=n_,f_=CB.assert,h1=AB,Yd=MB;function Ji(t){if(!(this instanceof Ji))return new Ji(t);typeof t=="string"&&(f_(Object.prototype.hasOwnProperty.call(l1,t),"Unknown curve "+t),t=l1[t]),t instanceof l1.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var RB=Ji;Ji.prototype.keyPair=function(e){return new h1(this,e)},Ji.prototype.keyFromPrivate=function(e,r){return h1.fromPrivate(this,e,r)},Ji.prototype.keyFromPublic=function(e,r){return h1.fromPublic(this,e,r)},Ji.prototype.genKeyPair=function(e){e||(e={});for(var r=new u_({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||TB(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new Eo(2));;){var s=new Eo(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Ji.prototype._truncateToN=function(e,r,n){var i;if(Eo.isBN(e)||typeof e=="number")e=new Eo(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new Eo(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new Eo(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Ji.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),u=new u_({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new Eo(1)),d=0;;d++){var p=i.k?i.k(d):new Eo(u.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(l)>=0)){var y=this.g.mul(p);if(!y.isInfinity()){var _=y.getX(),M=_.umod(this.n);if(M.cmpn(0)!==0){var O=p.invm(this.n).mul(M.mul(r.getPrivate()).iadd(e));if(O=O.umod(this.n),O.cmpn(0)!==0){var L=(y.getY().isOdd()?1:0)|(_.cmp(M)!==0?2:0);return i.canonical&&O.cmp(this.nh)>0&&(O=this.n.sub(O),L^=1),new Yd({r:M,s:O,recoveryParam:L})}}}}}},Ji.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new Yd(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),l=u.mul(e).umod(this.n),d=u.mul(o).umod(this.n),p;return this.curve._maxwellTrick?(p=this.g.jmulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.eqXToP(o)):(p=this.g.mulAdd(l,n.getPublic(),d),p.isInfinity()?!1:p.getX().umod(this.n).cmp(o)===0)},Ji.prototype.recoverPubKey=function(t,e,r,n){f_((3&r)===r,"The recovery param is more than two bits"),e=new Yd(e,n);var i=this.n,s=new Eo(t),o=e.r,a=e.s,u=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),y=a.mul(d).umod(i);return this.g.mulAdd(p,o,y)},Ji.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Yd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var ml=Ti,l_=ml.assert,h_=ml.parseBytes,_u=ml.cachedProperty;function On(t,e){this.eddsa=t,this._secret=h_(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=h_(e.pub)}On.fromPublic=function(e,r){return r instanceof On?r:new On(e,{pub:r})},On.fromSecret=function(e,r){return r instanceof On?r:new On(e,{secret:r})},On.prototype.secret=function(){return this._secret},_u(On,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),_u(On,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),_u(On,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i}),_u(On,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),_u(On,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),_u(On,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),On.prototype.sign=function(e){return l_(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},On.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},On.prototype.getSecret=function(e){return l_(this._secret,"KeyPair is public only"),ml.encode(this.secret(),e)},On.prototype.getPublic=function(e){return ml.encode(this.pubBytes(),e)};var DB=On,OB=xo,Jd=Ti,d_=Jd.assert,Xd=Jd.cachedProperty,NB=Jd.parseBytes;function oc(t,e){this.eddsa=t,typeof e!="object"&&(e=NB(e)),Array.isArray(e)&&(d_(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),d_(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof OB&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Xd(oc,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Xd(oc,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Xd(oc,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Xd(oc,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),oc.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},oc.prototype.toHex=function(){return Jd.encode(this.toBytes(),"hex").toUpperCase()};var LB=oc,kB=fl,BB=Kd,Eu=Ti,$B=Eu.assert,p_=Eu.parseBytes,g_=DB,m_=LB;function mi(t){if($B(t==="ed25519","only tested with ed25519 so far"),!(this instanceof mi))return new mi(t);t=BB[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=kB.sha512}var FB=mi;mi.prototype.sign=function(e,r){e=p_(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),u=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:u,Rencoded:o})},mi.prototype.verify=function(e,r,n){if(e=p_(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)},mi.prototype.hashInt=function(){for(var e=this.hash(),r=0;re in t?qB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,w_=(t,e)=>{for(var r in e||(e={}))zB.call(e,r)&&y_(t,r,e[r]);if(b_)for(var r of b_(e))HB.call(e,r)&&y_(t,r,e[r]);return t};const WB="ReactNative",Ri={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},KB="js";function Zd(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Au(){return!ol()&&!!Am()&&navigator.product===WB}function vl(){return!Zd()&&!!Am()&&!!ol()}function bl(){return Au()?Ri.reactNative:Zd()?Ri.node:vl()?Ri.browser:Ri.unknown}function VB(){var t;try{return Au()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function GB(t,e){let r=al.parse(t);return r=w_(w_({},r),e),t=al.stringify(r),t}function x_(){return t3()||{name:"",description:"",url:"",icons:[""]}}function YB(){if(bl()===Ri.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=xN();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function JB(){var t;const e=bl();return e===Ri.browser?[e,((t=e3())==null?void 0:t.host)||"unknown"].join(":"):e}function __(t,e,r){const n=YB(),i=JB();return[[t,e].join("-"),[KB,r].join("-"),n,i].join("/")}function XB({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const u=r.split("?"),l=__(t,e,n),d={auth:i,ua:l,projectId:s,useOnCloseEvent:o,origin:a||void 0},p=GB(u[1]||"",d);return u[0]+"?"+p}function ac(t,e){return t.filter(r=>e.includes(r)).length===t.length}function E_(t){return Object.fromEntries(t.entries())}function S_(t){return new Map(Object.entries(t))}function cc(t=vt.FIVE_MINUTES,e){const r=vt.toMiliseconds(t||vt.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Pu(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function A_(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function ZB(t){return A_("topic",t)}function QB(t){return A_("id",t)}function P_(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function _n(t,e){return vt.fromMiliseconds(Date.now()+vt.toMiliseconds(t))}function pa(t){return Date.now()>=vt.toMiliseconds(t)}function br(t,e){return`${t}${e?`:${e}`:""}`}function Qd(t=[],e=[]){return[...new Set([...t,...e])]}async function e$({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=t$(s,t,e),a=bl();if(a===Ri.browser){if(!((n=ol())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,n$()?"_blank":"_self","noreferrer noopener")}else a===Ri.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function t$(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${i$(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function r$(t,e){let r="";try{if(vl()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function M_(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function I_(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function d1(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function n$(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function i$(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function C_(t){return Buffer.from(t,"base64").toString("utf-8")}const s$="https://rpc.walletconnect.org/v1";async function o$(t,e,r,n,i,s){switch(r.t){case"eip191":return a$(t,e,r.s);case"eip1271":return await c$(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function a$(t,e,r){return Jk(v3(e),r).toLowerCase()===t.toLowerCase()}async function c$(t,e,r,n,i,s){const o=Su(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",d=r.substring(2),p=v3(e).substring(2),y=a+p+u+l+d,_=await fetch(`${s||s$}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:u$(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:y},"latest"]})}),{result:M}=await _.json();return M?M.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function u$(){return Date.now()+Math.floor(Math.random()*1e3)}var f$=Object.defineProperty,l$=Object.defineProperties,h$=Object.getOwnPropertyDescriptors,T_=Object.getOwnPropertySymbols,d$=Object.prototype.hasOwnProperty,p$=Object.prototype.propertyIsEnumerable,R_=(t,e,r)=>e in t?f$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,g$=(t,e)=>{for(var r in e||(e={}))d$.call(e,r)&&R_(t,r,e[r]);if(T_)for(var r of T_(e))p$.call(e,r)&&R_(t,r,e[r]);return t},m$=(t,e)=>l$(t,h$(e));const v$="did:pkh:",p1=t=>t==null?void 0:t.split(":"),b$=t=>{const e=t&&p1(t);if(e)return t.includes(v$)?e[3]:e[1]},g1=t=>{const e=t&&p1(t);if(e)return e[2]+":"+e[3]},e0=t=>{const e=t&&p1(t);if(e)return e.pop()};async function D_(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=O_(i,i.iss),o=e0(i.iss);return await o$(o,s,n,g1(i.iss),r)}const O_=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=e0(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${b$(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,d=t.exp?`Expiration Time: ${t.exp}`:void 0,p=t.nbf?`Not Before: ${t.nbf}`:void 0,y=t.requestId?`Request ID: ${t.requestId}`:void 0,_=t.resources?`Resources:${t.resources.map(O=>` -- ${O}`).join("")}`:void 0,M=t0(t.resources);if(M){const O=yl(M);i=M$(i,O)}return[r,n,"",i,"",s,o,a,u,l,d,p,y,_].filter(O=>O!=null).join(` -`)};function y$(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function w$(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function uc(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function x$(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:_$(e,r,n)}}}function _$(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function N_(t){return uc(t),`urn:recap:${y$(t).replace(/=/g,"")}`}function yl(t){const e=w$(t.replace("urn:recap:",""));return uc(e),e}function E$(t,e,r){const n=x$(t,e,r);return N_(n)}function S$(t){return t&&t.includes("urn:recap:")}function A$(t,e){const r=yl(t),n=yl(e),i=P$(r,n);return N_(i)}function P$(t,e){uc(t),uc(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,u)=>a.localeCompare(u)).forEach(a=>{var u,l;n.att[i]=m$(g$({},n.att[i]),{[a]:((u=t.att[i])==null?void 0:u[a])||((l=e.att[i])==null?void 0:l[a])})})}),n}function M$(t="",e){uc(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const u=Object.keys(e.att[a]).map(p=>({ability:p.split("/")[0],action:p.split("/")[1]}));u.sort((p,y)=>p.action.localeCompare(y.action));const l={};u.forEach(p=>{l[p.ability]||(l[p.ability]=[]),l[p.ability].push(p.action)});const d=Object.keys(l).map(p=>(i++,`(${i}) '${p}': '${l[p].join("', '")}' for '${a}'.`));n.push(d.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function L_(t){var e;const r=yl(t);uc(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function k_(t){const e=yl(t);uc(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function t0(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return S$(e)?e:void 0}const B_="base10",ri="base16",ga="base64pad",wl="base64url",xl="utf8",$_=0,So=1,_l=2,I$=0,F_=1,El=12,m1=32;function C$(){const t=Qm.generateKeyPair();return{privateKey:In(t.secretKey,ri),publicKey:In(t.publicKey,ri)}}function v1(){const t=sa.randomBytes(m1);return In(t,ri)}function T$(t,e){const r=Qm.sharedKey(Cn(t,ri),Cn(e,ri),!0),n=new uB(pl.SHA256,r).expand(m1);return In(n,ri)}function r0(t){const e=pl.hash(Cn(t,ri));return In(e,ri)}function Ao(t){const e=pl.hash(Cn(t,xl));return In(e,ri)}function j_(t){return Cn(`${t}`,B_)}function fc(t){return Number(In(t,B_))}function R$(t){const e=j_(typeof t.type<"u"?t.type:$_);if(fc(e)===So&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Cn(t.senderPublicKey,ri):void 0,n=typeof t.iv<"u"?Cn(t.iv,ri):sa.randomBytes(El),i=new Jm.ChaCha20Poly1305(Cn(t.symKey,ri)).seal(n,Cn(t.message,xl));return U_({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function D$(t,e){const r=j_(_l),n=sa.randomBytes(El),i=Cn(t,xl);return U_({type:r,sealed:i,iv:n,encoding:e})}function O$(t){const e=new Jm.ChaCha20Poly1305(Cn(t.symKey,ri)),{sealed:r,iv:n}=Sl({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return In(i,xl)}function N$(t,e){const{sealed:r}=Sl({encoded:t,encoding:e});return In(r,xl)}function U_(t){const{encoding:e=ga}=t;if(fc(t.type)===_l)return In(Pd([t.type,t.sealed]),e);if(fc(t.type)===So){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return In(Pd([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return In(Pd([t.type,t.iv,t.sealed]),e)}function Sl(t){const{encoded:e,encoding:r=ga}=t,n=Cn(e,r),i=n.slice(I$,F_),s=F_;if(fc(i)===So){const l=s+m1,d=l+El,p=n.slice(s,l),y=n.slice(l,d),_=n.slice(d);return{type:i,sealed:_,iv:y,senderPublicKey:p}}if(fc(i)===_l){const l=n.slice(s),d=sa.randomBytes(El);return{type:i,sealed:l,iv:d}}const o=s+El,a=n.slice(s,o),u=n.slice(o);return{type:i,sealed:u,iv:a}}function L$(t,e){const r=Sl({encoded:t,encoding:e==null?void 0:e.encoding});return q_({type:fc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?In(r.senderPublicKey,ri):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function q_(t){const e=(t==null?void 0:t.type)||$_;if(e===So){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function z_(t){return t.type===So&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function H_(t){return t.type===_l}function k$(t){return new t_.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function B$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function $$(t){return Buffer.from(B$(t),"base64")}function F$(t,e){const[r,n,i]=t.split("."),s=$$(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),u=`${r}.${n}`,l=new pl.SHA256().update(Buffer.from(u)).digest(),d=k$(e),p=Buffer.from(l).toString("hex");if(!d.verify(p,{r:o,s:a}))throw new Error("Invalid signature");return Sm(t).payload}const j$="irn";function b1(t){return(t==null?void 0:t.relay)||{protocol:j$}}function Al(t){const e=jB[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var U$=Object.defineProperty,q$=Object.defineProperties,z$=Object.getOwnPropertyDescriptors,W_=Object.getOwnPropertySymbols,H$=Object.prototype.hasOwnProperty,W$=Object.prototype.propertyIsEnumerable,K_=(t,e,r)=>e in t?U$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,V_=(t,e)=>{for(var r in e||(e={}))H$.call(e,r)&&K_(t,r,e[r]);if(W_)for(var r of W_(e))W$.call(e,r)&&K_(t,r,e[r]);return t},K$=(t,e)=>q$(t,z$(e));function V$(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function G_(t){if(!t.includes("wc:")){const u=C_(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=al.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:G$(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:V$(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function G$(t){return t.startsWith("//")?t.substring(2):t}function Y$(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function Y_(t){return`${t.protocol}:${t.topic}@${t.version}?`+al.stringify(V_(K$(V_({symKey:t.symKey},Y$(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function n0(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Mu(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function J$(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Mu(r.accounts))}),e}function X$(t,e){const r=[];return Object.values(t).forEach(n=>{Mu(n.accounts).includes(e)&&r.push(...n.methods)}),r}function Z$(t,e){const r=[];return Object.values(t).forEach(n=>{Mu(n.accounts).includes(e)&&r.push(...n.events)}),r}function y1(t){return t.includes(":")}function Pl(t){return y1(t)?t.split(":")[0]:t}function Q$(t){const e={};return t==null||t.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function J_(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=Q$(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=Qd(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const eF={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},tF={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ut(t,e){const{message:r,code:n}=tF[t];return{message:e?`${r} ${e}`:r,code:n}}function Dr(t,e){const{message:r,code:n}=eF[t];return{message:e?`${r} ${e}`:r,code:n}}function lc(t,e){return!!Array.isArray(t)}function Ml(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function vi(t){return typeof t>"u"}function on(t,e){return e&&vi(t)?!0:typeof t=="string"&&!!t.trim().length}function w1(t,e){return typeof t=="number"&&!isNaN(t)}function rF(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return ac(i,n)?(n.forEach(o=>{const{accounts:a,methods:u,events:l}=t.namespaces[o],d=Mu(a),p=r[o];(!ac(v_(o,p),d)||!ac(p.methods,u)||!ac(p.events,l))&&(s=!1)}),s):!1}function i0(t){return on(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function nF(t){if(on(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&i0(r)}}return!1}function iF(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(on(t,!1)){if(e(t))return!0;const r=C_(t);return e(r)}}catch{}return!1}function sF(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function oF(t){return t==null?void 0:t.topic}function aF(t,e){let r=null;return on(t==null?void 0:t.publicKey,!1)||(r=ut("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function X_(t){let e=!0;return lc(t)?t.length&&(e=t.every(r=>on(r,!1))):e=!1,e}function cF(t,e,r){let n=null;return lc(e)&&e.length?e.forEach(i=>{n||i0(i)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):i0(t)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function uF(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=cF(i,v_(i,s),`${e} ${r}`);o&&(n=o)}),n}function fF(t,e){let r=null;return lc(t)?t.forEach(n=>{r||nF(n)||(r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function lF(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=fF(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function hF(t,e){let r=null;return X_(t==null?void 0:t.methods)?X_(t==null?void 0:t.events)||(r=Dr("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Dr("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function Z_(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=hF(n,`${e}, namespace`);i&&(r=i)}),r}function dF(t,e,r){let n=null;if(t&&Ml(t)){const i=Z_(t,e);i&&(n=i);const s=uF(t,e,r);s&&(n=s)}else n=ut("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function x1(t,e){let r=null;if(t&&Ml(t)){const n=Z_(t,e);n&&(r=n);const i=lF(t,e);i&&(r=i)}else r=ut("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function Q_(t){return on(t.protocol,!0)}function pF(t,e){let r=!1;return t?t&&lc(t)&&t.length&&t.forEach(n=>{r=Q_(n)}):r=!0,r}function gF(t){return typeof t=="number"}function bi(t){return typeof t<"u"&&typeof t!==null}function mF(t){return!(!t||typeof t!="object"||!t.code||!w1(t.code)||!t.message||!on(t.message,!1))}function vF(t){return!(vi(t)||!on(t.method,!1))}function bF(t){return!(vi(t)||vi(t.result)&&vi(t.error)||!w1(t.id)||!on(t.jsonrpc,!1))}function yF(t){return!(vi(t)||!on(t.name,!1))}function e6(t,e){return!(!i0(e)||!J$(t).includes(e))}function wF(t,e,r){return on(r,!1)?X$(t,e).includes(r):!1}function xF(t,e,r){return on(r,!1)?Z$(t,e).includes(r):!1}function t6(t,e,r){let n=null;const i=_F(t),s=EF(e),o=Object.keys(i),a=Object.keys(s),u=r6(Object.keys(t)),l=r6(Object.keys(e)),d=u.filter(p=>!l.includes(p));return d.length&&(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. - Required: ${d.toString()} - Received: ${Object.keys(e).toString()}`)),ac(o,a)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. + */var rx;function JD(){return rx||(rx=1,(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=Wn:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,f=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),h=[31,7936,2031616,520093696],g=[4,1024,262144,67108864],b=[1,256,65536,16777216],x=[6,1536,393216,100663296],S=[0,8,16,24],C=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],D=[224,256,384,512],B=[128,256],L=["hex","buffer","arrayBuffer","array","digest"],H={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(O){return Object.prototype.toString.call(O)==="[object Array]"}),f&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(O){return typeof O=="object"&&O.buffer&&O.buffer.constructor===ArrayBuffer});for(var F=function(O,ie,ee){return function(Z){return new M(O,ie,O).update(Z)[ee]()}},k=function(O,ie,ee){return function(Z,te){return new M(O,ie,te).update(Z)[ee]()}},$=function(O,ie,ee){return function(Z,te,N,Q){return l["cshake"+O].update(Z,te,N,Q)[ee]()}},R=function(O,ie,ee){return function(Z,te,N,Q){return l["kmac"+O].update(Z,te,N,Q)[ee]()}},W=function(O,ie,ee,Z){for(var te=0;te>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ee>>5,this.extraBytes=(ee&31)>>3;for(var Z=0;Z<50;++Z)this.s[Z]=0}M.prototype.update=function(O){if(this.finalized)throw new Error(r);var ie,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(f&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!f||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);ie=!0}for(var Z=this.blocks,te=this.byteCount,N=O.length,Q=this.blockCount,ne=0,de=this.s,ce,fe;ne>2]|=O[ne]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(Z[ce>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=te){for(this.start=ce-te,this.block=Z[Q],ce=0;ce>8,ee=O&255;ee>0;)te.unshift(ee),O=O>>8,ee=O&255,++Z;return ie?te.push(Z):te.unshift(Z),this.update(te),te.length},M.prototype.encodeString=function(O){var ie,ee=typeof O;if(ee!=="string"){if(ee==="object"){if(O===null)throw new Error(e);if(f&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!Array.isArray(O)&&(!f||!ArrayBuffer.isView(O)))throw new Error(e)}else throw new Error(e);ie=!0}var Z=0,te=O.length;if(ie)Z=te;else for(var N=0;N=57344?Z+=3:(Q=65536+((Q&1023)<<10|O.charCodeAt(++N)&1023),Z+=4)}return Z+=this.encode(Z*8),this.update(O),Z},M.prototype.bytepad=function(O,ie){for(var ee=this.encode(ie),Z=0;Z>2]|=this.padding[ie&3],this.lastByteIndex===this.byteCount)for(O[0]=O[ee],ie=1;ie>4&15]+u[ne&15]+u[ne>>12&15]+u[ne>>8&15]+u[ne>>20&15]+u[ne>>16&15]+u[ne>>28&15]+u[ne>>24&15];N%O===0&&(se(ie),te=0)}return Z&&(ne=ie[te],Q+=u[ne>>4&15]+u[ne&15],Z>1&&(Q+=u[ne>>12&15]+u[ne>>8&15]),Z>2&&(Q+=u[ne>>20&15]+u[ne>>16&15])),Q},M.prototype.arrayBuffer=function(){this.finalize();var O=this.blockCount,ie=this.s,ee=this.outputBlocks,Z=this.extraBytes,te=0,N=0,Q=this.outputBits>>3,ne;Z?ne=new ArrayBuffer(ee+1<<2):ne=new ArrayBuffer(Q);for(var de=new Uint32Array(ne);N>8&255,Q[ne+2]=de>>16&255,Q[ne+3]=de>>24&255;N%O===0&&se(ie)}return Z&&(ne=N<<2,de=ie[te],Q[ne]=de&255,Z>1&&(Q[ne+1]=de>>8&255),Z>2&&(Q[ne+2]=de>>16&255)),Q};function z(O,ie,ee){M.call(this,O,ie,ee)}z.prototype=new M,z.prototype.finalize=function(){return this.encode(this.outputBits,!0),M.prototype.finalize.call(this)};var se=function(O){var ie,ee,Z,te,N,Q,ne,de,ce,fe,be,Pe,De,Te,Fe,Me,Ne,He,Oe,$e,qe,_e,Qe,at,Be,nt,it,Ye,pt,ht,ft,Ht,Jt,St,Xt,tr,Dt,Bt,Ct,gt,Ot,Lt,bt,jt,Ut,tt,Ft,K,G,J,T,j,oe,le,me,Ee,ke,Ce,et,Ze,rt,ot,yt;for(Z=0;Z<48;Z+=2)te=O[0]^O[10]^O[20]^O[30]^O[40],N=O[1]^O[11]^O[21]^O[31]^O[41],Q=O[2]^O[12]^O[22]^O[32]^O[42],ne=O[3]^O[13]^O[23]^O[33]^O[43],de=O[4]^O[14]^O[24]^O[34]^O[44],ce=O[5]^O[15]^O[25]^O[35]^O[45],fe=O[6]^O[16]^O[26]^O[36]^O[46],be=O[7]^O[17]^O[27]^O[37]^O[47],Pe=O[8]^O[18]^O[28]^O[38]^O[48],De=O[9]^O[19]^O[29]^O[39]^O[49],ie=Pe^(Q<<1|ne>>>31),ee=De^(ne<<1|Q>>>31),O[0]^=ie,O[1]^=ee,O[10]^=ie,O[11]^=ee,O[20]^=ie,O[21]^=ee,O[30]^=ie,O[31]^=ee,O[40]^=ie,O[41]^=ee,ie=te^(de<<1|ce>>>31),ee=N^(ce<<1|de>>>31),O[2]^=ie,O[3]^=ee,O[12]^=ie,O[13]^=ee,O[22]^=ie,O[23]^=ee,O[32]^=ie,O[33]^=ee,O[42]^=ie,O[43]^=ee,ie=Q^(fe<<1|be>>>31),ee=ne^(be<<1|fe>>>31),O[4]^=ie,O[5]^=ee,O[14]^=ie,O[15]^=ee,O[24]^=ie,O[25]^=ee,O[34]^=ie,O[35]^=ee,O[44]^=ie,O[45]^=ee,ie=de^(Pe<<1|De>>>31),ee=ce^(De<<1|Pe>>>31),O[6]^=ie,O[7]^=ee,O[16]^=ie,O[17]^=ee,O[26]^=ie,O[27]^=ee,O[36]^=ie,O[37]^=ee,O[46]^=ie,O[47]^=ee,ie=fe^(te<<1|N>>>31),ee=be^(N<<1|te>>>31),O[8]^=ie,O[9]^=ee,O[18]^=ie,O[19]^=ee,O[28]^=ie,O[29]^=ee,O[38]^=ie,O[39]^=ee,O[48]^=ie,O[49]^=ee,Te=O[0],Fe=O[1],tt=O[11]<<4|O[10]>>>28,Ft=O[10]<<4|O[11]>>>28,Ye=O[20]<<3|O[21]>>>29,pt=O[21]<<3|O[20]>>>29,Ze=O[31]<<9|O[30]>>>23,rt=O[30]<<9|O[31]>>>23,Lt=O[40]<<18|O[41]>>>14,bt=O[41]<<18|O[40]>>>14,St=O[2]<<1|O[3]>>>31,Xt=O[3]<<1|O[2]>>>31,Me=O[13]<<12|O[12]>>>20,Ne=O[12]<<12|O[13]>>>20,K=O[22]<<10|O[23]>>>22,G=O[23]<<10|O[22]>>>22,ht=O[33]<<13|O[32]>>>19,ft=O[32]<<13|O[33]>>>19,ot=O[42]<<2|O[43]>>>30,yt=O[43]<<2|O[42]>>>30,le=O[5]<<30|O[4]>>>2,me=O[4]<<30|O[5]>>>2,tr=O[14]<<6|O[15]>>>26,Dt=O[15]<<6|O[14]>>>26,He=O[25]<<11|O[24]>>>21,Oe=O[24]<<11|O[25]>>>21,J=O[34]<<15|O[35]>>>17,T=O[35]<<15|O[34]>>>17,Ht=O[45]<<29|O[44]>>>3,Jt=O[44]<<29|O[45]>>>3,at=O[6]<<28|O[7]>>>4,Be=O[7]<<28|O[6]>>>4,Ee=O[17]<<23|O[16]>>>9,ke=O[16]<<23|O[17]>>>9,Bt=O[26]<<25|O[27]>>>7,Ct=O[27]<<25|O[26]>>>7,$e=O[36]<<21|O[37]>>>11,qe=O[37]<<21|O[36]>>>11,j=O[47]<<24|O[46]>>>8,oe=O[46]<<24|O[47]>>>8,jt=O[8]<<27|O[9]>>>5,Ut=O[9]<<27|O[8]>>>5,nt=O[18]<<20|O[19]>>>12,it=O[19]<<20|O[18]>>>12,Ce=O[29]<<7|O[28]>>>25,et=O[28]<<7|O[29]>>>25,gt=O[38]<<8|O[39]>>>24,Ot=O[39]<<8|O[38]>>>24,_e=O[48]<<14|O[49]>>>18,Qe=O[49]<<14|O[48]>>>18,O[0]=Te^~Me&He,O[1]=Fe^~Ne&Oe,O[10]=at^~nt&Ye,O[11]=Be^~it&pt,O[20]=St^~tr&Bt,O[21]=Xt^~Dt&Ct,O[30]=jt^~tt&K,O[31]=Ut^~Ft&G,O[40]=le^~Ee&Ce,O[41]=me^~ke&et,O[2]=Me^~He&$e,O[3]=Ne^~Oe&qe,O[12]=nt^~Ye&ht,O[13]=it^~pt&ft,O[22]=tr^~Bt>,O[23]=Dt^~Ct&Ot,O[32]=tt^~K&J,O[33]=Ft^~G&T,O[42]=Ee^~Ce&Ze,O[43]=ke^~et&rt,O[4]=He^~$e&_e,O[5]=Oe^~qe&Qe,O[14]=Ye^~ht&Ht,O[15]=pt^~ft&Jt,O[24]=Bt^~gt&Lt,O[25]=Ct^~Ot&bt,O[34]=K^~J&j,O[35]=G^~T&oe,O[44]=Ce^~Ze&ot,O[45]=et^~rt&yt,O[6]=$e^~_e&Te,O[7]=qe^~Qe&Fe,O[16]=ht^~Ht&at,O[17]=ft^~Jt&Be,O[26]=gt^~Lt&St,O[27]=Ot^~bt&Xt,O[36]=J^~j&jt,O[37]=T^~oe&Ut,O[46]=Ze^~ot&le,O[47]=rt^~yt&me,O[8]=_e^~Te&Me,O[9]=Qe^~Fe&Ne,O[18]=Ht^~at&nt,O[19]=Jt^~Be&it,O[28]=Lt^~St&tr,O[29]=bt^~Xt&Dt,O[38]=j^~jt&tt,O[39]=oe^~Ut&Ft,O[48]=ot^~le&Ee,O[49]=yt^~me&ke,O[0]^=C[Z],O[1]^=C[Z+1]};if(a)t.exports=l;else for(m=0;m{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const ox=eO();var vg;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(vg||(vg={}));var is;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(is||(is={}));const ax="0123456789abcdef";class Kr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();wh[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(sx>wh[n])&&console.log.apply(console,r)}debug(...e){this._log(Kr.levels.DEBUG,e)}info(...e){this._log(Kr.levels.INFO,e)}warn(...e){this._log(Kr.levels.WARNING,e)}makeError(e,r,n){if(ix)return this.makeError("censored error",r,{});r||(r=Kr.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(f=>{const u=n[f];try{if(u instanceof Uint8Array){let h="";for(let g=0;g>4],h+=ax[u[g]&15];i.push(f+"=Uint8Array(0x"+h+")")}else i.push(f+"="+JSON.stringify(u))}catch{i.push(f+"="+JSON.stringify(n[f].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case is.NUMERIC_FAULT:{o="NUMERIC_FAULT";const f=e;switch(f){case"overflow":case"underflow":case"division-by-zero":o+="-"+f;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case is.CALL_EXCEPTION:case is.INSUFFICIENT_FUNDS:case is.MISSING_NEW:case is.NONCE_EXPIRED:case is.REPLACEMENT_UNDERPRICED:case is.TRANSACTION_REPLACED:case is.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(f){a[f]=n[f]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Kr.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){ox&&this.throwError("platform missing String.prototype.normalize",Kr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ox})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Kr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Kr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Kr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Kr.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return mg||(mg=new Kr(QD)),mg}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),nx){if(!e)return;this.globalLogger().throwError("error censorship permanent",Kr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ix=!!e,nx=!!r}static setLogLevel(e){const r=wh[e.toLowerCase()];if(r==null){Kr.globalLogger().warn("invalid log level - "+e);return}sx=r}static from(e){return new Kr(e)}}Kr.errors=is,Kr.levels=vg;const tO="bytes/5.7.0",rn=new Kr(tO);function cx(t){return!!t.toHexString}function yc(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return yc(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function rO(t){return xs(t)&&!(t.length%2)||bg(t)}function ux(t){return typeof t=="number"&&t==t&&t%1===0}function bg(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!ux(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function mn(t,e){if(e||(e={}),typeof t=="number"){rn.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),yc(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),cx(t)&&(t=t.toHexString()),xs(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":rn.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;imn(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),yc(n)}function iO(t,e){t=mn(t),t.length>e&&rn.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),yc(r)}function xs(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const yg="0123456789abcdef";function mi(t,e){if(e||(e={}),typeof t=="number"){rn.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=yg[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),cx(t))return t.toHexString();if(xs(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":rn.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(bg(t)){let r="0x";for(let n=0;n>4]+yg[i&15]}return r}return rn.throwArgumentError("invalid hexlify value","value",t)}function sO(t){if(typeof t!="string")t=mi(t);else if(!xs(t)||t.length%2)return null;return(t.length-2)/2}function fx(t,e,r){return typeof t!="string"?t=mi(t):(!xs(t)||t.length%2)&&rn.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function wc(t,e){for(typeof t!="string"?t=mi(t):xs(t)||rn.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&rn.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function lx(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(rO(t)){let r=mn(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=mi(r.slice(0,32)),e.s=mi(r.slice(32,64))):r.length===65?(e.r=mi(r.slice(0,32)),e.s=mi(r.slice(32,64)),e.v=r[64]):rn.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:rn.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=mi(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=iO(mn(e._vs),32);e._vs=mi(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&rn.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=mi(i);e.s==null?e.s=o:e.s!==o&&rn.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?rn.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&rn.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!xs(e.r)?rn.throwArgumentError("signature missing or invalid r","signature",t):e.r=wc(e.r,32),e.s==null||!xs(e.s)?rn.throwArgumentError("signature missing or invalid s","signature",t):e.s=wc(e.s,32);const r=mn(e.s);r[0]>=128&&rn.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=mi(r);e._vs&&(xs(e._vs)||rn.throwArgumentError("signature invalid _vs","signature",t),e._vs=wc(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&rn.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function wg(t){return"0x"+ZD.keccak_256(mn(t))}var xh={exports:{}},oO=xh.exports,hx;function aO(){return hx||(hx=1,(function(t){(function(e,r){function n(v,l){if(!v)throw new Error(l||"Assertion failed")}function i(v,l){v.super_=l;var p=function(){};p.prototype=l.prototype,v.prototype=new p,v.prototype.constructor=v}function s(v,l,p){if(s.isBN(v))return v;this.negative=0,this.words=null,this.length=0,this.red=null,v!==null&&((l==="le"||l==="be")&&(p=l,l=10),this._init(v||0,l||10,p||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=Qu.Buffer}catch{}s.isBN=function(l){return l instanceof s?!0:l!==null&&typeof l=="object"&&l.constructor.wordSize===s.wordSize&&Array.isArray(l.words)},s.max=function(l,p){return l.cmp(p)>0?l:p},s.min=function(l,p){return l.cmp(p)<0?l:p},s.prototype._init=function(l,p,m){if(typeof l=="number")return this._initNumber(l,p,m);if(typeof l=="object")return this._initArray(l,p,m);p==="hex"&&(p=16),n(p===(p|0)&&p>=2&&p<=36),l=l.toString().replace(/\s+/g,"");var y=0;l[0]==="-"&&(y++,this.negative=1),y=0;y-=3)E=l[y]|l[y-1]<<8|l[y-2]<<16,this.words[A]|=E<>>26-w&67108863,w+=24,w>=26&&(w-=26,A++);else if(m==="le")for(y=0,A=0;y>>26-w&67108863,w+=24,w>=26&&(w-=26,A++);return this._strip()};function a(v,l){var p=v.charCodeAt(l);if(p>=48&&p<=57)return p-48;if(p>=65&&p<=70)return p-55;if(p>=97&&p<=102)return p-87;n(!1,"Invalid character in "+v)}function f(v,l,p){var m=a(v,p);return p-1>=l&&(m|=a(v,p-1)<<4),m}s.prototype._parseHex=function(l,p,m){this.length=Math.ceil((l.length-p)/6),this.words=new Array(this.length);for(var y=0;y=p;y-=2)w=f(l,p,y)<=18?(A-=18,E+=1,this.words[E]|=w>>>26):A+=8;else{var I=l.length-p;for(y=I%2===0?p+1:p;y=18?(A-=18,E+=1,this.words[E]|=w>>>26):A+=8}this._strip()};function u(v,l,p,m){for(var y=0,A=0,E=Math.min(v.length,p),w=l;w=49?A=I-49+10:I>=17?A=I-17+10:A=I,n(I>=0&&A1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=g}catch{s.prototype.inspect=g}else s.prototype.inspect=g;function g(){return(this.red?""}var b=["","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"],x=[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],S=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(l,p){l=l||10,p=p|0||1;var m;if(l===16||l==="hex"){m="";for(var y=0,A=0,E=0;E>>24-y&16777215,y+=2,y>=26&&(y-=26,E--),A!==0||E!==this.length-1?m=b[6-I.length]+I+m:m=I+m}for(A!==0&&(m=A.toString(16)+m);m.length%p!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(l===(l|0)&&l>=2&&l<=36){var M=x[l],z=S[l];m="";var se=this.clone();for(se.negative=0;!se.isZero();){var O=se.modrn(z).toString(l);se=se.idivn(z),se.isZero()?m=O+m:m=b[M-O.length]+O+m}for(this.isZero()&&(m="0"+m);m.length%p!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var l=this.words[0];return this.length===2?l+=this.words[1]*67108864:this.length===3&&this.words[2]===1?l+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-l:l},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(l,p){return this.toArrayLike(o,l,p)}),s.prototype.toArray=function(l,p){return this.toArrayLike(Array,l,p)};var C=function(l,p){return l.allocUnsafe?l.allocUnsafe(p):new l(p)};s.prototype.toArrayLike=function(l,p,m){this._strip();var y=this.byteLength(),A=m||Math.max(1,y);n(y<=A,"byte array longer than desired length"),n(A>0,"Requested array length <= 0");var E=C(l,A),w=p==="le"?"LE":"BE";return this["_toArrayLike"+w](E,y),E},s.prototype._toArrayLikeLE=function(l,p){for(var m=0,y=0,A=0,E=0;A>8&255),m>16&255),E===6?(m>24&255),y=0,E=0):(y=w>>>24,E+=2)}if(m=0&&(l[m--]=w>>8&255),m>=0&&(l[m--]=w>>16&255),E===6?(m>=0&&(l[m--]=w>>24&255),y=0,E=0):(y=w>>>24,E+=2)}if(m>=0)for(l[m--]=y;m>=0;)l[m--]=0},Math.clz32?s.prototype._countBits=function(l){return 32-Math.clz32(l)}:s.prototype._countBits=function(l){var p=l,m=0;return p>=4096&&(m+=13,p>>>=13),p>=64&&(m+=7,p>>>=7),p>=8&&(m+=4,p>>>=4),p>=2&&(m+=2,p>>>=2),m+p},s.prototype._zeroBits=function(l){if(l===0)return 26;var p=l,m=0;return(p&8191)===0&&(m+=13,p>>>=13),(p&127)===0&&(m+=7,p>>>=7),(p&15)===0&&(m+=4,p>>>=4),(p&3)===0&&(m+=2,p>>>=2),(p&1)===0&&m++,m},s.prototype.bitLength=function(){var l=this.words[this.length-1],p=this._countBits(l);return(this.length-1)*26+p};function D(v){for(var l=new Array(v.bitLength()),p=0;p>>y&1}return l}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var l=0,p=0;pl.length?this.clone().ior(l):l.clone().ior(this)},s.prototype.uor=function(l){return this.length>l.length?this.clone().iuor(l):l.clone().iuor(this)},s.prototype.iuand=function(l){var p;this.length>l.length?p=l:p=this;for(var m=0;ml.length?this.clone().iand(l):l.clone().iand(this)},s.prototype.uand=function(l){return this.length>l.length?this.clone().iuand(l):l.clone().iuand(this)},s.prototype.iuxor=function(l){var p,m;this.length>l.length?(p=this,m=l):(p=l,m=this);for(var y=0;yl.length?this.clone().ixor(l):l.clone().ixor(this)},s.prototype.uxor=function(l){return this.length>l.length?this.clone().iuxor(l):l.clone().iuxor(this)},s.prototype.inotn=function(l){n(typeof l=="number"&&l>=0);var p=Math.ceil(l/26)|0,m=l%26;this._expand(p),m>0&&p--;for(var y=0;y0&&(this.words[y]=~this.words[y]&67108863>>26-m),this._strip()},s.prototype.notn=function(l){return this.clone().inotn(l)},s.prototype.setn=function(l,p){n(typeof l=="number"&&l>=0);var m=l/26|0,y=l%26;return this._expand(m+1),p?this.words[m]=this.words[m]|1<l.length?(m=this,y=l):(m=l,y=this);for(var A=0,E=0;E>>26;for(;A!==0&&E>>26;if(this.length=m.length,A!==0)this.words[this.length]=A,this.length++;else if(m!==this)for(;El.length?this.clone().iadd(l):l.clone().iadd(this)},s.prototype.isub=function(l){if(l.negative!==0){l.negative=0;var p=this.iadd(l);return l.negative=1,p._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(l),this.negative=1,this._normSign();var m=this.cmp(l);if(m===0)return this.negative=0,this.length=1,this.words[0]=0,this;var y,A;m>0?(y=this,A=l):(y=l,A=this);for(var E=0,w=0;w>26,this.words[w]=p&67108863;for(;E!==0&&w>26,this.words[w]=p&67108863;if(E===0&&w>>26,se=I&67108863,O=Math.min(M,l.length-1),ie=Math.max(0,M-v.length+1);ie<=O;ie++){var ee=M-ie|0;y=v.words[ee]|0,A=l.words[ie]|0,E=y*A+se,z+=E/67108864|0,se=E&67108863}p.words[M]=se|0,I=z|0}return I!==0?p.words[M]=I|0:p.length--,p._strip()}var L=function(l,p,m){var y=l.words,A=p.words,E=m.words,w=0,I,M,z,se=y[0]|0,O=se&8191,ie=se>>>13,ee=y[1]|0,Z=ee&8191,te=ee>>>13,N=y[2]|0,Q=N&8191,ne=N>>>13,de=y[3]|0,ce=de&8191,fe=de>>>13,be=y[4]|0,Pe=be&8191,De=be>>>13,Te=y[5]|0,Fe=Te&8191,Me=Te>>>13,Ne=y[6]|0,He=Ne&8191,Oe=Ne>>>13,$e=y[7]|0,qe=$e&8191,_e=$e>>>13,Qe=y[8]|0,at=Qe&8191,Be=Qe>>>13,nt=y[9]|0,it=nt&8191,Ye=nt>>>13,pt=A[0]|0,ht=pt&8191,ft=pt>>>13,Ht=A[1]|0,Jt=Ht&8191,St=Ht>>>13,Xt=A[2]|0,tr=Xt&8191,Dt=Xt>>>13,Bt=A[3]|0,Ct=Bt&8191,gt=Bt>>>13,Ot=A[4]|0,Lt=Ot&8191,bt=Ot>>>13,jt=A[5]|0,Ut=jt&8191,tt=jt>>>13,Ft=A[6]|0,K=Ft&8191,G=Ft>>>13,J=A[7]|0,T=J&8191,j=J>>>13,oe=A[8]|0,le=oe&8191,me=oe>>>13,Ee=A[9]|0,ke=Ee&8191,Ce=Ee>>>13;m.negative=l.negative^p.negative,m.length=19,I=Math.imul(O,ht),M=Math.imul(O,ft),M=M+Math.imul(ie,ht)|0,z=Math.imul(ie,ft);var et=(w+I|0)+((M&8191)<<13)|0;w=(z+(M>>>13)|0)+(et>>>26)|0,et&=67108863,I=Math.imul(Z,ht),M=Math.imul(Z,ft),M=M+Math.imul(te,ht)|0,z=Math.imul(te,ft),I=I+Math.imul(O,Jt)|0,M=M+Math.imul(O,St)|0,M=M+Math.imul(ie,Jt)|0,z=z+Math.imul(ie,St)|0;var Ze=(w+I|0)+((M&8191)<<13)|0;w=(z+(M>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,I=Math.imul(Q,ht),M=Math.imul(Q,ft),M=M+Math.imul(ne,ht)|0,z=Math.imul(ne,ft),I=I+Math.imul(Z,Jt)|0,M=M+Math.imul(Z,St)|0,M=M+Math.imul(te,Jt)|0,z=z+Math.imul(te,St)|0,I=I+Math.imul(O,tr)|0,M=M+Math.imul(O,Dt)|0,M=M+Math.imul(ie,tr)|0,z=z+Math.imul(ie,Dt)|0;var rt=(w+I|0)+((M&8191)<<13)|0;w=(z+(M>>>13)|0)+(rt>>>26)|0,rt&=67108863,I=Math.imul(ce,ht),M=Math.imul(ce,ft),M=M+Math.imul(fe,ht)|0,z=Math.imul(fe,ft),I=I+Math.imul(Q,Jt)|0,M=M+Math.imul(Q,St)|0,M=M+Math.imul(ne,Jt)|0,z=z+Math.imul(ne,St)|0,I=I+Math.imul(Z,tr)|0,M=M+Math.imul(Z,Dt)|0,M=M+Math.imul(te,tr)|0,z=z+Math.imul(te,Dt)|0,I=I+Math.imul(O,Ct)|0,M=M+Math.imul(O,gt)|0,M=M+Math.imul(ie,Ct)|0,z=z+Math.imul(ie,gt)|0;var ot=(w+I|0)+((M&8191)<<13)|0;w=(z+(M>>>13)|0)+(ot>>>26)|0,ot&=67108863,I=Math.imul(Pe,ht),M=Math.imul(Pe,ft),M=M+Math.imul(De,ht)|0,z=Math.imul(De,ft),I=I+Math.imul(ce,Jt)|0,M=M+Math.imul(ce,St)|0,M=M+Math.imul(fe,Jt)|0,z=z+Math.imul(fe,St)|0,I=I+Math.imul(Q,tr)|0,M=M+Math.imul(Q,Dt)|0,M=M+Math.imul(ne,tr)|0,z=z+Math.imul(ne,Dt)|0,I=I+Math.imul(Z,Ct)|0,M=M+Math.imul(Z,gt)|0,M=M+Math.imul(te,Ct)|0,z=z+Math.imul(te,gt)|0,I=I+Math.imul(O,Lt)|0,M=M+Math.imul(O,bt)|0,M=M+Math.imul(ie,Lt)|0,z=z+Math.imul(ie,bt)|0;var yt=(w+I|0)+((M&8191)<<13)|0;w=(z+(M>>>13)|0)+(yt>>>26)|0,yt&=67108863,I=Math.imul(Fe,ht),M=Math.imul(Fe,ft),M=M+Math.imul(Me,ht)|0,z=Math.imul(Me,ft),I=I+Math.imul(Pe,Jt)|0,M=M+Math.imul(Pe,St)|0,M=M+Math.imul(De,Jt)|0,z=z+Math.imul(De,St)|0,I=I+Math.imul(ce,tr)|0,M=M+Math.imul(ce,Dt)|0,M=M+Math.imul(fe,tr)|0,z=z+Math.imul(fe,Dt)|0,I=I+Math.imul(Q,Ct)|0,M=M+Math.imul(Q,gt)|0,M=M+Math.imul(ne,Ct)|0,z=z+Math.imul(ne,gt)|0,I=I+Math.imul(Z,Lt)|0,M=M+Math.imul(Z,bt)|0,M=M+Math.imul(te,Lt)|0,z=z+Math.imul(te,bt)|0,I=I+Math.imul(O,Ut)|0,M=M+Math.imul(O,tt)|0,M=M+Math.imul(ie,Ut)|0,z=z+Math.imul(ie,tt)|0;var Rt=(w+I|0)+((M&8191)<<13)|0;w=(z+(M>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,I=Math.imul(He,ht),M=Math.imul(He,ft),M=M+Math.imul(Oe,ht)|0,z=Math.imul(Oe,ft),I=I+Math.imul(Fe,Jt)|0,M=M+Math.imul(Fe,St)|0,M=M+Math.imul(Me,Jt)|0,z=z+Math.imul(Me,St)|0,I=I+Math.imul(Pe,tr)|0,M=M+Math.imul(Pe,Dt)|0,M=M+Math.imul(De,tr)|0,z=z+Math.imul(De,Dt)|0,I=I+Math.imul(ce,Ct)|0,M=M+Math.imul(ce,gt)|0,M=M+Math.imul(fe,Ct)|0,z=z+Math.imul(fe,gt)|0,I=I+Math.imul(Q,Lt)|0,M=M+Math.imul(Q,bt)|0,M=M+Math.imul(ne,Lt)|0,z=z+Math.imul(ne,bt)|0,I=I+Math.imul(Z,Ut)|0,M=M+Math.imul(Z,tt)|0,M=M+Math.imul(te,Ut)|0,z=z+Math.imul(te,tt)|0,I=I+Math.imul(O,K)|0,M=M+Math.imul(O,G)|0,M=M+Math.imul(ie,K)|0,z=z+Math.imul(ie,G)|0;var Mt=(w+I|0)+((M&8191)<<13)|0;w=(z+(M>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,I=Math.imul(qe,ht),M=Math.imul(qe,ft),M=M+Math.imul(_e,ht)|0,z=Math.imul(_e,ft),I=I+Math.imul(He,Jt)|0,M=M+Math.imul(He,St)|0,M=M+Math.imul(Oe,Jt)|0,z=z+Math.imul(Oe,St)|0,I=I+Math.imul(Fe,tr)|0,M=M+Math.imul(Fe,Dt)|0,M=M+Math.imul(Me,tr)|0,z=z+Math.imul(Me,Dt)|0,I=I+Math.imul(Pe,Ct)|0,M=M+Math.imul(Pe,gt)|0,M=M+Math.imul(De,Ct)|0,z=z+Math.imul(De,gt)|0,I=I+Math.imul(ce,Lt)|0,M=M+Math.imul(ce,bt)|0,M=M+Math.imul(fe,Lt)|0,z=z+Math.imul(fe,bt)|0,I=I+Math.imul(Q,Ut)|0,M=M+Math.imul(Q,tt)|0,M=M+Math.imul(ne,Ut)|0,z=z+Math.imul(ne,tt)|0,I=I+Math.imul(Z,K)|0,M=M+Math.imul(Z,G)|0,M=M+Math.imul(te,K)|0,z=z+Math.imul(te,G)|0,I=I+Math.imul(O,T)|0,M=M+Math.imul(O,j)|0,M=M+Math.imul(ie,T)|0,z=z+Math.imul(ie,j)|0;var xt=(w+I|0)+((M&8191)<<13)|0;w=(z+(M>>>13)|0)+(xt>>>26)|0,xt&=67108863,I=Math.imul(at,ht),M=Math.imul(at,ft),M=M+Math.imul(Be,ht)|0,z=Math.imul(Be,ft),I=I+Math.imul(qe,Jt)|0,M=M+Math.imul(qe,St)|0,M=M+Math.imul(_e,Jt)|0,z=z+Math.imul(_e,St)|0,I=I+Math.imul(He,tr)|0,M=M+Math.imul(He,Dt)|0,M=M+Math.imul(Oe,tr)|0,z=z+Math.imul(Oe,Dt)|0,I=I+Math.imul(Fe,Ct)|0,M=M+Math.imul(Fe,gt)|0,M=M+Math.imul(Me,Ct)|0,z=z+Math.imul(Me,gt)|0,I=I+Math.imul(Pe,Lt)|0,M=M+Math.imul(Pe,bt)|0,M=M+Math.imul(De,Lt)|0,z=z+Math.imul(De,bt)|0,I=I+Math.imul(ce,Ut)|0,M=M+Math.imul(ce,tt)|0,M=M+Math.imul(fe,Ut)|0,z=z+Math.imul(fe,tt)|0,I=I+Math.imul(Q,K)|0,M=M+Math.imul(Q,G)|0,M=M+Math.imul(ne,K)|0,z=z+Math.imul(ne,G)|0,I=I+Math.imul(Z,T)|0,M=M+Math.imul(Z,j)|0,M=M+Math.imul(te,T)|0,z=z+Math.imul(te,j)|0,I=I+Math.imul(O,le)|0,M=M+Math.imul(O,me)|0,M=M+Math.imul(ie,le)|0,z=z+Math.imul(ie,me)|0;var Tt=(w+I|0)+((M&8191)<<13)|0;w=(z+(M>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,I=Math.imul(it,ht),M=Math.imul(it,ft),M=M+Math.imul(Ye,ht)|0,z=Math.imul(Ye,ft),I=I+Math.imul(at,Jt)|0,M=M+Math.imul(at,St)|0,M=M+Math.imul(Be,Jt)|0,z=z+Math.imul(Be,St)|0,I=I+Math.imul(qe,tr)|0,M=M+Math.imul(qe,Dt)|0,M=M+Math.imul(_e,tr)|0,z=z+Math.imul(_e,Dt)|0,I=I+Math.imul(He,Ct)|0,M=M+Math.imul(He,gt)|0,M=M+Math.imul(Oe,Ct)|0,z=z+Math.imul(Oe,gt)|0,I=I+Math.imul(Fe,Lt)|0,M=M+Math.imul(Fe,bt)|0,M=M+Math.imul(Me,Lt)|0,z=z+Math.imul(Me,bt)|0,I=I+Math.imul(Pe,Ut)|0,M=M+Math.imul(Pe,tt)|0,M=M+Math.imul(De,Ut)|0,z=z+Math.imul(De,tt)|0,I=I+Math.imul(ce,K)|0,M=M+Math.imul(ce,G)|0,M=M+Math.imul(fe,K)|0,z=z+Math.imul(fe,G)|0,I=I+Math.imul(Q,T)|0,M=M+Math.imul(Q,j)|0,M=M+Math.imul(ne,T)|0,z=z+Math.imul(ne,j)|0,I=I+Math.imul(Z,le)|0,M=M+Math.imul(Z,me)|0,M=M+Math.imul(te,le)|0,z=z+Math.imul(te,me)|0,I=I+Math.imul(O,ke)|0,M=M+Math.imul(O,Ce)|0,M=M+Math.imul(ie,ke)|0,z=z+Math.imul(ie,Ce)|0;var mt=(w+I|0)+((M&8191)<<13)|0;w=(z+(M>>>13)|0)+(mt>>>26)|0,mt&=67108863,I=Math.imul(it,Jt),M=Math.imul(it,St),M=M+Math.imul(Ye,Jt)|0,z=Math.imul(Ye,St),I=I+Math.imul(at,tr)|0,M=M+Math.imul(at,Dt)|0,M=M+Math.imul(Be,tr)|0,z=z+Math.imul(Be,Dt)|0,I=I+Math.imul(qe,Ct)|0,M=M+Math.imul(qe,gt)|0,M=M+Math.imul(_e,Ct)|0,z=z+Math.imul(_e,gt)|0,I=I+Math.imul(He,Lt)|0,M=M+Math.imul(He,bt)|0,M=M+Math.imul(Oe,Lt)|0,z=z+Math.imul(Oe,bt)|0,I=I+Math.imul(Fe,Ut)|0,M=M+Math.imul(Fe,tt)|0,M=M+Math.imul(Me,Ut)|0,z=z+Math.imul(Me,tt)|0,I=I+Math.imul(Pe,K)|0,M=M+Math.imul(Pe,G)|0,M=M+Math.imul(De,K)|0,z=z+Math.imul(De,G)|0,I=I+Math.imul(ce,T)|0,M=M+Math.imul(ce,j)|0,M=M+Math.imul(fe,T)|0,z=z+Math.imul(fe,j)|0,I=I+Math.imul(Q,le)|0,M=M+Math.imul(Q,me)|0,M=M+Math.imul(ne,le)|0,z=z+Math.imul(ne,me)|0,I=I+Math.imul(Z,ke)|0,M=M+Math.imul(Z,Ce)|0,M=M+Math.imul(te,ke)|0,z=z+Math.imul(te,Ce)|0;var Et=(w+I|0)+((M&8191)<<13)|0;w=(z+(M>>>13)|0)+(Et>>>26)|0,Et&=67108863,I=Math.imul(it,tr),M=Math.imul(it,Dt),M=M+Math.imul(Ye,tr)|0,z=Math.imul(Ye,Dt),I=I+Math.imul(at,Ct)|0,M=M+Math.imul(at,gt)|0,M=M+Math.imul(Be,Ct)|0,z=z+Math.imul(Be,gt)|0,I=I+Math.imul(qe,Lt)|0,M=M+Math.imul(qe,bt)|0,M=M+Math.imul(_e,Lt)|0,z=z+Math.imul(_e,bt)|0,I=I+Math.imul(He,Ut)|0,M=M+Math.imul(He,tt)|0,M=M+Math.imul(Oe,Ut)|0,z=z+Math.imul(Oe,tt)|0,I=I+Math.imul(Fe,K)|0,M=M+Math.imul(Fe,G)|0,M=M+Math.imul(Me,K)|0,z=z+Math.imul(Me,G)|0,I=I+Math.imul(Pe,T)|0,M=M+Math.imul(Pe,j)|0,M=M+Math.imul(De,T)|0,z=z+Math.imul(De,j)|0,I=I+Math.imul(ce,le)|0,M=M+Math.imul(ce,me)|0,M=M+Math.imul(fe,le)|0,z=z+Math.imul(fe,me)|0,I=I+Math.imul(Q,ke)|0,M=M+Math.imul(Q,Ce)|0,M=M+Math.imul(ne,ke)|0,z=z+Math.imul(ne,Ce)|0;var ct=(w+I|0)+((M&8191)<<13)|0;w=(z+(M>>>13)|0)+(ct>>>26)|0,ct&=67108863,I=Math.imul(it,Ct),M=Math.imul(it,gt),M=M+Math.imul(Ye,Ct)|0,z=Math.imul(Ye,gt),I=I+Math.imul(at,Lt)|0,M=M+Math.imul(at,bt)|0,M=M+Math.imul(Be,Lt)|0,z=z+Math.imul(Be,bt)|0,I=I+Math.imul(qe,Ut)|0,M=M+Math.imul(qe,tt)|0,M=M+Math.imul(_e,Ut)|0,z=z+Math.imul(_e,tt)|0,I=I+Math.imul(He,K)|0,M=M+Math.imul(He,G)|0,M=M+Math.imul(Oe,K)|0,z=z+Math.imul(Oe,G)|0,I=I+Math.imul(Fe,T)|0,M=M+Math.imul(Fe,j)|0,M=M+Math.imul(Me,T)|0,z=z+Math.imul(Me,j)|0,I=I+Math.imul(Pe,le)|0,M=M+Math.imul(Pe,me)|0,M=M+Math.imul(De,le)|0,z=z+Math.imul(De,me)|0,I=I+Math.imul(ce,ke)|0,M=M+Math.imul(ce,Ce)|0,M=M+Math.imul(fe,ke)|0,z=z+Math.imul(fe,Ce)|0;var wt=(w+I|0)+((M&8191)<<13)|0;w=(z+(M>>>13)|0)+(wt>>>26)|0,wt&=67108863,I=Math.imul(it,Lt),M=Math.imul(it,bt),M=M+Math.imul(Ye,Lt)|0,z=Math.imul(Ye,bt),I=I+Math.imul(at,Ut)|0,M=M+Math.imul(at,tt)|0,M=M+Math.imul(Be,Ut)|0,z=z+Math.imul(Be,tt)|0,I=I+Math.imul(qe,K)|0,M=M+Math.imul(qe,G)|0,M=M+Math.imul(_e,K)|0,z=z+Math.imul(_e,G)|0,I=I+Math.imul(He,T)|0,M=M+Math.imul(He,j)|0,M=M+Math.imul(Oe,T)|0,z=z+Math.imul(Oe,j)|0,I=I+Math.imul(Fe,le)|0,M=M+Math.imul(Fe,me)|0,M=M+Math.imul(Me,le)|0,z=z+Math.imul(Me,me)|0,I=I+Math.imul(Pe,ke)|0,M=M+Math.imul(Pe,Ce)|0,M=M+Math.imul(De,ke)|0,z=z+Math.imul(De,Ce)|0;var lt=(w+I|0)+((M&8191)<<13)|0;w=(z+(M>>>13)|0)+(lt>>>26)|0,lt&=67108863,I=Math.imul(it,Ut),M=Math.imul(it,tt),M=M+Math.imul(Ye,Ut)|0,z=Math.imul(Ye,tt),I=I+Math.imul(at,K)|0,M=M+Math.imul(at,G)|0,M=M+Math.imul(Be,K)|0,z=z+Math.imul(Be,G)|0,I=I+Math.imul(qe,T)|0,M=M+Math.imul(qe,j)|0,M=M+Math.imul(_e,T)|0,z=z+Math.imul(_e,j)|0,I=I+Math.imul(He,le)|0,M=M+Math.imul(He,me)|0,M=M+Math.imul(Oe,le)|0,z=z+Math.imul(Oe,me)|0,I=I+Math.imul(Fe,ke)|0,M=M+Math.imul(Fe,Ce)|0,M=M+Math.imul(Me,ke)|0,z=z+Math.imul(Me,Ce)|0;var st=(w+I|0)+((M&8191)<<13)|0;w=(z+(M>>>13)|0)+(st>>>26)|0,st&=67108863,I=Math.imul(it,K),M=Math.imul(it,G),M=M+Math.imul(Ye,K)|0,z=Math.imul(Ye,G),I=I+Math.imul(at,T)|0,M=M+Math.imul(at,j)|0,M=M+Math.imul(Be,T)|0,z=z+Math.imul(Be,j)|0,I=I+Math.imul(qe,le)|0,M=M+Math.imul(qe,me)|0,M=M+Math.imul(_e,le)|0,z=z+Math.imul(_e,me)|0,I=I+Math.imul(He,ke)|0,M=M+Math.imul(He,Ce)|0,M=M+Math.imul(Oe,ke)|0,z=z+Math.imul(Oe,Ce)|0;var Ae=(w+I|0)+((M&8191)<<13)|0;w=(z+(M>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,I=Math.imul(it,T),M=Math.imul(it,j),M=M+Math.imul(Ye,T)|0,z=Math.imul(Ye,j),I=I+Math.imul(at,le)|0,M=M+Math.imul(at,me)|0,M=M+Math.imul(Be,le)|0,z=z+Math.imul(Be,me)|0,I=I+Math.imul(qe,ke)|0,M=M+Math.imul(qe,Ce)|0,M=M+Math.imul(_e,ke)|0,z=z+Math.imul(_e,Ce)|0;var Ie=(w+I|0)+((M&8191)<<13)|0;w=(z+(M>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,I=Math.imul(it,le),M=Math.imul(it,me),M=M+Math.imul(Ye,le)|0,z=Math.imul(Ye,me),I=I+Math.imul(at,ke)|0,M=M+Math.imul(at,Ce)|0,M=M+Math.imul(Be,ke)|0,z=z+Math.imul(Be,Ce)|0;var Ve=(w+I|0)+((M&8191)<<13)|0;w=(z+(M>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,I=Math.imul(it,ke),M=Math.imul(it,Ce),M=M+Math.imul(Ye,ke)|0,z=Math.imul(Ye,Ce);var Ue=(w+I|0)+((M&8191)<<13)|0;return w=(z+(M>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,E[0]=et,E[1]=Ze,E[2]=rt,E[3]=ot,E[4]=yt,E[5]=Rt,E[6]=Mt,E[7]=xt,E[8]=Tt,E[9]=mt,E[10]=Et,E[11]=ct,E[12]=wt,E[13]=lt,E[14]=st,E[15]=Ae,E[16]=Ie,E[17]=Ve,E[18]=Ue,w!==0&&(E[19]=w,m.length++),m};Math.imul||(L=B);function H(v,l,p){p.negative=l.negative^v.negative,p.length=v.length+l.length;for(var m=0,y=0,A=0;A>>26)|0,y+=E>>>26,E&=67108863}p.words[A]=w,m=E,E=y}return m!==0?p.words[A]=m:p.length--,p._strip()}function F(v,l,p){return H(v,l,p)}s.prototype.mulTo=function(l,p){var m,y=this.length+l.length;return this.length===10&&l.length===10?m=L(this,l,p):y<63?m=B(this,l,p):y<1024?m=H(this,l,p):m=F(this,l,p),m},s.prototype.mul=function(l){var p=new s(null);return p.words=new Array(this.length+l.length),this.mulTo(l,p)},s.prototype.mulf=function(l){var p=new s(null);return p.words=new Array(this.length+l.length),F(this,l,p)},s.prototype.imul=function(l){return this.clone().mulTo(l,this)},s.prototype.imuln=function(l){var p=l<0;p&&(l=-l),n(typeof l=="number"),n(l<67108864);for(var m=0,y=0;y>=26,m+=A/67108864|0,m+=E>>>26,this.words[y]=E&67108863}return m!==0&&(this.words[y]=m,this.length++),p?this.ineg():this},s.prototype.muln=function(l){return this.clone().imuln(l)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(l){var p=D(l);if(p.length===0)return new s(1);for(var m=this,y=0;y=0);var p=l%26,m=(l-p)/26,y=67108863>>>26-p<<26-p,A;if(p!==0){var E=0;for(A=0;A>>26-p}E&&(this.words[A]=E,this.length++)}if(m!==0){for(A=this.length-1;A>=0;A--)this.words[A+m]=this.words[A];for(A=0;A=0);var y;p?y=(p-p%26)/26:y=0;var A=l%26,E=Math.min((l-A)/26,this.length),w=67108863^67108863>>>A<E)for(this.length-=E,M=0;M=0&&(z!==0||M>=y);M--){var se=this.words[M]|0;this.words[M]=z<<26-A|se>>>A,z=se&w}return I&&z!==0&&(I.words[I.length++]=z),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(l,p,m){return n(this.negative===0),this.iushrn(l,p,m)},s.prototype.shln=function(l){return this.clone().ishln(l)},s.prototype.ushln=function(l){return this.clone().iushln(l)},s.prototype.shrn=function(l){return this.clone().ishrn(l)},s.prototype.ushrn=function(l){return this.clone().iushrn(l)},s.prototype.testn=function(l){n(typeof l=="number"&&l>=0);var p=l%26,m=(l-p)/26,y=1<=0);var p=l%26,m=(l-p)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=m)return this;if(p!==0&&m++,this.length=Math.min(m,this.length),p!==0){var y=67108863^67108863>>>p<=67108864;p++)this.words[p]-=67108864,p===this.length-1?this.words[p+1]=1:this.words[p+1]++;return this.length=Math.max(this.length,p+1),this},s.prototype.isubn=function(l){if(n(typeof l=="number"),n(l<67108864),l<0)return this.iaddn(-l);if(this.negative!==0)return this.negative=0,this.iaddn(l),this.negative=1,this;if(this.words[0]-=l,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var p=0;p>26)-(I/67108864|0),this.words[A+m]=E&67108863}for(;A>26,this.words[A+m]=E&67108863;if(w===0)return this._strip();for(n(w===-1),w=0,A=0;A>26,this.words[A]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(l,p){var m=this.length-l.length,y=this.clone(),A=l,E=A.words[A.length-1]|0,w=this._countBits(E);m=26-w,m!==0&&(A=A.ushln(m),y.iushln(m),E=A.words[A.length-1]|0);var I=y.length-A.length,M;if(p!=="mod"){M=new s(null),M.length=I+1,M.words=new Array(M.length);for(var z=0;z=0;O--){var ie=(y.words[A.length+O]|0)*67108864+(y.words[A.length+O-1]|0);for(ie=Math.min(ie/E|0,67108863),y._ishlnsubmul(A,ie,O);y.negative!==0;)ie--,y.negative=0,y._ishlnsubmul(A,1,O),y.isZero()||(y.negative^=1);M&&(M.words[O]=ie)}return M&&M._strip(),y._strip(),p!=="div"&&m!==0&&y.iushrn(m),{div:M||null,mod:y}},s.prototype.divmod=function(l,p,m){if(n(!l.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var y,A,E;return this.negative!==0&&l.negative===0?(E=this.neg().divmod(l,p),p!=="mod"&&(y=E.div.neg()),p!=="div"&&(A=E.mod.neg(),m&&A.negative!==0&&A.iadd(l)),{div:y,mod:A}):this.negative===0&&l.negative!==0?(E=this.divmod(l.neg(),p),p!=="mod"&&(y=E.div.neg()),{div:y,mod:E.mod}):(this.negative&l.negative)!==0?(E=this.neg().divmod(l.neg(),p),p!=="div"&&(A=E.mod.neg(),m&&A.negative!==0&&A.isub(l)),{div:E.div,mod:A}):l.length>this.length||this.cmp(l)<0?{div:new s(0),mod:this}:l.length===1?p==="div"?{div:this.divn(l.words[0]),mod:null}:p==="mod"?{div:null,mod:new s(this.modrn(l.words[0]))}:{div:this.divn(l.words[0]),mod:new s(this.modrn(l.words[0]))}:this._wordDiv(l,p)},s.prototype.div=function(l){return this.divmod(l,"div",!1).div},s.prototype.mod=function(l){return this.divmod(l,"mod",!1).mod},s.prototype.umod=function(l){return this.divmod(l,"mod",!0).mod},s.prototype.divRound=function(l){var p=this.divmod(l);if(p.mod.isZero())return p.div;var m=p.div.negative!==0?p.mod.isub(l):p.mod,y=l.ushrn(1),A=l.andln(1),E=m.cmp(y);return E<0||A===1&&E===0?p.div:p.div.negative!==0?p.div.isubn(1):p.div.iaddn(1)},s.prototype.modrn=function(l){var p=l<0;p&&(l=-l),n(l<=67108863);for(var m=(1<<26)%l,y=0,A=this.length-1;A>=0;A--)y=(m*y+(this.words[A]|0))%l;return p?-y:y},s.prototype.modn=function(l){return this.modrn(l)},s.prototype.idivn=function(l){var p=l<0;p&&(l=-l),n(l<=67108863);for(var m=0,y=this.length-1;y>=0;y--){var A=(this.words[y]|0)+m*67108864;this.words[y]=A/l|0,m=A%l}return this._strip(),p?this.ineg():this},s.prototype.divn=function(l){return this.clone().idivn(l)},s.prototype.egcd=function(l){n(l.negative===0),n(!l.isZero());var p=this,m=l.clone();p.negative!==0?p=p.umod(l):p=p.clone();for(var y=new s(1),A=new s(0),E=new s(0),w=new s(1),I=0;p.isEven()&&m.isEven();)p.iushrn(1),m.iushrn(1),++I;for(var M=m.clone(),z=p.clone();!p.isZero();){for(var se=0,O=1;(p.words[0]&O)===0&&se<26;++se,O<<=1);if(se>0)for(p.iushrn(se);se-- >0;)(y.isOdd()||A.isOdd())&&(y.iadd(M),A.isub(z)),y.iushrn(1),A.iushrn(1);for(var ie=0,ee=1;(m.words[0]&ee)===0&&ie<26;++ie,ee<<=1);if(ie>0)for(m.iushrn(ie);ie-- >0;)(E.isOdd()||w.isOdd())&&(E.iadd(M),w.isub(z)),E.iushrn(1),w.iushrn(1);p.cmp(m)>=0?(p.isub(m),y.isub(E),A.isub(w)):(m.isub(p),E.isub(y),w.isub(A))}return{a:E,b:w,gcd:m.iushln(I)}},s.prototype._invmp=function(l){n(l.negative===0),n(!l.isZero());var p=this,m=l.clone();p.negative!==0?p=p.umod(l):p=p.clone();for(var y=new s(1),A=new s(0),E=m.clone();p.cmpn(1)>0&&m.cmpn(1)>0;){for(var w=0,I=1;(p.words[0]&I)===0&&w<26;++w,I<<=1);if(w>0)for(p.iushrn(w);w-- >0;)y.isOdd()&&y.iadd(E),y.iushrn(1);for(var M=0,z=1;(m.words[0]&z)===0&&M<26;++M,z<<=1);if(M>0)for(m.iushrn(M);M-- >0;)A.isOdd()&&A.iadd(E),A.iushrn(1);p.cmp(m)>=0?(p.isub(m),y.isub(A)):(m.isub(p),A.isub(y))}var se;return p.cmpn(1)===0?se=y:se=A,se.cmpn(0)<0&&se.iadd(l),se},s.prototype.gcd=function(l){if(this.isZero())return l.abs();if(l.isZero())return this.abs();var p=this.clone(),m=l.clone();p.negative=0,m.negative=0;for(var y=0;p.isEven()&&m.isEven();y++)p.iushrn(1),m.iushrn(1);do{for(;p.isEven();)p.iushrn(1);for(;m.isEven();)m.iushrn(1);var A=p.cmp(m);if(A<0){var E=p;p=m,m=E}else if(A===0||m.cmpn(1)===0)break;p.isub(m)}while(!0);return m.iushln(y)},s.prototype.invm=function(l){return this.egcd(l).a.umod(l)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(l){return this.words[0]&l},s.prototype.bincn=function(l){n(typeof l=="number");var p=l%26,m=(l-p)/26,y=1<>>26,w&=67108863,this.words[E]=w}return A!==0&&(this.words[E]=A,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(l){var p=l<0;if(this.negative!==0&&!p)return-1;if(this.negative===0&&p)return 1;this._strip();var m;if(this.length>1)m=1;else{p&&(l=-l),n(l<=67108863,"Number is too big");var y=this.words[0]|0;m=y===l?0:yl.length)return 1;if(this.length=0;m--){var y=this.words[m]|0,A=l.words[m]|0;if(y!==A){yA&&(p=1);break}}return p},s.prototype.gtn=function(l){return this.cmpn(l)===1},s.prototype.gt=function(l){return this.cmp(l)===1},s.prototype.gten=function(l){return this.cmpn(l)>=0},s.prototype.gte=function(l){return this.cmp(l)>=0},s.prototype.ltn=function(l){return this.cmpn(l)===-1},s.prototype.lt=function(l){return this.cmp(l)===-1},s.prototype.lten=function(l){return this.cmpn(l)<=0},s.prototype.lte=function(l){return this.cmp(l)<=0},s.prototype.eqn=function(l){return this.cmpn(l)===0},s.prototype.eq=function(l){return this.cmp(l)===0},s.red=function(l){return new q(l)},s.prototype.toRed=function(l){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),l.convertTo(this)._forceRed(l)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(l){return this.red=l,this},s.prototype.forceRed=function(l){return n(!this.red,"Already a number in reduction context"),this._forceRed(l)},s.prototype.redAdd=function(l){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,l)},s.prototype.redIAdd=function(l){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,l)},s.prototype.redSub=function(l){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,l)},s.prototype.redISub=function(l){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,l)},s.prototype.redShl=function(l){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,l)},s.prototype.redMul=function(l){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.mul(this,l)},s.prototype.redIMul=function(l){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.imul(this,l)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(l){return n(this.red&&!l.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,l)};var k={k256:null,p224:null,p192:null,p25519:null};function $(v,l){this.name=v,this.p=new s(l,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}$.prototype._tmp=function(){var l=new s(null);return l.words=new Array(Math.ceil(this.n/13)),l},$.prototype.ireduce=function(l){var p=l,m;do this.split(p,this.tmp),p=this.imulK(p),p=p.iadd(this.tmp),m=p.bitLength();while(m>this.n);var y=m0?p.isub(this.p):p.strip!==void 0?p.strip():p._strip(),p},$.prototype.split=function(l,p){l.iushrn(this.n,0,p)},$.prototype.imulK=function(l){return l.imul(this.k)};function R(){$.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(R,$),R.prototype.split=function(l,p){for(var m=4194303,y=Math.min(l.length,9),A=0;A>>22,E=w}E>>>=22,l.words[A-10]=E,E===0&&l.length>10?l.length-=10:l.length-=9},R.prototype.imulK=function(l){l.words[l.length]=0,l.words[l.length+1]=0,l.length+=2;for(var p=0,m=0;m>>=26,l.words[m]=A,p=y}return p!==0&&(l.words[l.length++]=p),l},s._prime=function(l){if(k[l])return k[l];var p;if(l==="k256")p=new R;else if(l==="p224")p=new W;else if(l==="p192")p=new V;else if(l==="p25519")p=new X;else throw new Error("Unknown prime "+l);return k[l]=p,p};function q(v){if(typeof v=="string"){var l=s._prime(v);this.m=l.p,this.prime=l}else n(v.gtn(1),"modulus must be greater than 1"),this.m=v,this.prime=null}q.prototype._verify1=function(l){n(l.negative===0,"red works only with positives"),n(l.red,"red works only with red numbers")},q.prototype._verify2=function(l,p){n((l.negative|p.negative)===0,"red works only with positives"),n(l.red&&l.red===p.red,"red works only with red numbers")},q.prototype.imod=function(l){return this.prime?this.prime.ireduce(l)._forceRed(this):(h(l,l.umod(this.m)._forceRed(this)),l)},q.prototype.neg=function(l){return l.isZero()?l.clone():this.m.sub(l)._forceRed(this)},q.prototype.add=function(l,p){this._verify2(l,p);var m=l.add(p);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},q.prototype.iadd=function(l,p){this._verify2(l,p);var m=l.iadd(p);return m.cmp(this.m)>=0&&m.isub(this.m),m},q.prototype.sub=function(l,p){this._verify2(l,p);var m=l.sub(p);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},q.prototype.isub=function(l,p){this._verify2(l,p);var m=l.isub(p);return m.cmpn(0)<0&&m.iadd(this.m),m},q.prototype.shl=function(l,p){return this._verify1(l),this.imod(l.ushln(p))},q.prototype.imul=function(l,p){return this._verify2(l,p),this.imod(l.imul(p))},q.prototype.mul=function(l,p){return this._verify2(l,p),this.imod(l.mul(p))},q.prototype.isqr=function(l){return this.imul(l,l.clone())},q.prototype.sqr=function(l){return this.mul(l,l)},q.prototype.sqrt=function(l){if(l.isZero())return l.clone();var p=this.m.andln(3);if(n(p%2===1),p===3){var m=this.m.add(new s(1)).iushrn(2);return this.pow(l,m)}for(var y=this.m.subn(1),A=0;!y.isZero()&&y.andln(1)===0;)A++,y.iushrn(1);n(!y.isZero());var E=new s(1).toRed(this),w=E.redNeg(),I=this.m.subn(1).iushrn(1),M=this.m.bitLength();for(M=new s(2*M*M).toRed(this);this.pow(M,I).cmp(w)!==0;)M.redIAdd(w);for(var z=this.pow(M,y),se=this.pow(l,y.addn(1).iushrn(1)),O=this.pow(l,y),ie=A;O.cmp(E)!==0;){for(var ee=O,Z=0;ee.cmp(E)!==0;Z++)ee=ee.redSqr();n(Z=0;A--){for(var z=p.words[A],se=M-1;se>=0;se--){var O=z>>se&1;if(E!==y[0]&&(E=this.sqr(E)),O===0&&w===0){I=0;continue}w<<=1,w|=O,I++,!(I!==m&&(A!==0||se!==0))&&(E=this.mul(E,y[w]),I=0,w=0)}M=26}return E},q.prototype.convertTo=function(l){var p=l.umod(this.m);return p===l?p.clone():p},q.prototype.convertFrom=function(l){var p=l.clone();return p.red=null,p},s.mont=function(l){return new _(l)};function _(v){q.call(this,v),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(_,q),_.prototype.convertTo=function(l){return this.imod(l.ushln(this.shift))},_.prototype.convertFrom=function(l){var p=this.imod(l.mul(this.rinv));return p.red=null,p},_.prototype.imul=function(l,p){if(l.isZero()||p.isZero())return l.words[0]=0,l.length=1,l;var m=l.imul(p),y=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),A=m.isub(y).iushrn(this.shift),E=A;return A.cmp(this.m)>=0?E=A.isub(this.m):A.cmpn(0)<0&&(E=A.iadd(this.m)),E._forceRed(this)},_.prototype.mul=function(l,p){if(l.isZero()||p.isZero())return new s(0)._forceRed(this);var m=l.mul(p),y=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),A=m.isub(y).iushrn(this.shift),E=A;return A.cmp(this.m)>=0?E=A.isub(this.m):A.cmpn(0)<0&&(E=A.iadd(this.m)),E._forceRed(this)},_.prototype.invm=function(l){var p=this.imod(l._invmp(this.m).mul(this.r2));return p._forceRed(this)}})(t,oO)})(xh)),xh.exports}var cO=aO();const nr=Mi(cO);var uO=nr.BN;function fO(t){return new uO(t,36).toString(16)}const lO="strings/5.7.0",hO=new Kr(lO);var _h;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(_h||(_h={}));var dx;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(dx||(dx={}));function xg(t,e=_h.current){e!=_h.current&&(hO.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return mn(r)}const dO=`Ethereum Signed Message: +`;function px(t){return typeof t=="string"&&(t=xg(t)),wg(nO([xg(dO),xg(String(t.length)),t]))}const pO="address/5.7.0",sf=new Kr(pO);function gx(t){xs(t,20)||sf.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=mn(wg(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const gO=9007199254740991;function mO(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const _g={};for(let t=0;t<10;t++)_g[String(t)]=String(t);for(let t=0;t<26;t++)_g[String.fromCharCode(65+t)]=String(10+t);const mx=Math.floor(mO(gO));function vO(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>_g[n]).join("");for(;e.length>=mx;){let n=e.substring(0,mx);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function bO(t){let e=null;if(typeof t!="string"&&sf.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=gx(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&sf.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==vO(t)&&sf.throwArgumentError("bad icap checksum","address",t),e=fO(t.substring(4));e.length<40;)e="0"+e;e=gx("0x"+e)}else sf.throwArgumentError("invalid address","address",t);return e}function of(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var Eg={},Tr={},Sg,vx;function ba(){if(vx)return Sg;vx=1,Sg=t;function t(e,r){if(!e)throw new Error(r||"Assertion failed")}return t.equal=function(r,n,i){if(r!=n)throw new Error(i||"Assertion failed: "+r+" != "+n)},Sg}var Eh={exports:{}},bx;function Sh(){return bx||(bx=1,typeof Object.create=="function"?Eh.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Eh.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}),Eh.exports}var yx;function _s(){if(yx)return Tr;yx=1;var t=ba(),e=Sh();Tr.inherits=e;function r(_,v){return(_.charCodeAt(v)&64512)!==55296||v<0||v+1>=_.length?!1:(_.charCodeAt(v+1)&64512)===56320}function n(_,v){if(Array.isArray(_))return _.slice();if(!_)return[];var l=[];if(typeof _=="string")if(v){if(v==="hex")for(_=_.replace(/[^a-z0-9]+/ig,""),_.length%2!==0&&(_="0"+_),m=0;m<_.length;m+=2)l.push(parseInt(_[m]+_[m+1],16))}else for(var p=0,m=0;m<_.length;m++){var y=_.charCodeAt(m);y<128?l[p++]=y:y<2048?(l[p++]=y>>6|192,l[p++]=y&63|128):r(_,m)?(y=65536+((y&1023)<<10)+(_.charCodeAt(++m)&1023),l[p++]=y>>18|240,l[p++]=y>>12&63|128,l[p++]=y>>6&63|128,l[p++]=y&63|128):(l[p++]=y>>12|224,l[p++]=y>>6&63|128,l[p++]=y&63|128)}else for(m=0;m<_.length;m++)l[m]=_[m]|0;return l}Tr.toArray=n;function i(_){for(var v="",l=0;l<_.length;l++)v+=a(_[l].toString(16));return v}Tr.toHex=i;function s(_){var v=_>>>24|_>>>8&65280|_<<8&16711680|(_&255)<<24;return v>>>0}Tr.htonl=s;function o(_,v){for(var l="",p=0;p<_.length;p++){var m=_[p];v==="little"&&(m=s(m)),l+=f(m.toString(16))}return l}Tr.toHex32=o;function a(_){return _.length===1?"0"+_:_}Tr.zero2=a;function f(_){return _.length===7?"0"+_:_.length===6?"00"+_:_.length===5?"000"+_:_.length===4?"0000"+_:_.length===3?"00000"+_:_.length===2?"000000"+_:_.length===1?"0000000"+_:_}Tr.zero8=f;function u(_,v,l,p){var m=l-v;t(m%4===0);for(var y=new Array(m/4),A=0,E=v;A>>0}return y}Tr.join32=u;function h(_,v){for(var l=new Array(_.length*4),p=0,m=0;p<_.length;p++,m+=4){var y=_[p];v==="big"?(l[m]=y>>>24,l[m+1]=y>>>16&255,l[m+2]=y>>>8&255,l[m+3]=y&255):(l[m+3]=y>>>24,l[m+2]=y>>>16&255,l[m+1]=y>>>8&255,l[m]=y&255)}return l}Tr.split32=h;function g(_,v){return _>>>v|_<<32-v}Tr.rotr32=g;function b(_,v){return _<>>32-v}Tr.rotl32=b;function x(_,v){return _+v>>>0}Tr.sum32=x;function S(_,v,l){return _+v+l>>>0}Tr.sum32_3=S;function C(_,v,l,p){return _+v+l+p>>>0}Tr.sum32_4=C;function D(_,v,l,p,m){return _+v+l+p+m>>>0}Tr.sum32_5=D;function B(_,v,l,p){var m=_[v],y=_[v+1],A=p+y>>>0,E=(A>>0,_[v+1]=A}Tr.sum64=B;function L(_,v,l,p){var m=v+p>>>0,y=(m>>0}Tr.sum64_hi=L;function H(_,v,l,p){var m=v+p;return m>>>0}Tr.sum64_lo=H;function F(_,v,l,p,m,y,A,E){var w=0,I=v;I=I+p>>>0,w+=I>>0,w+=I>>0,w+=I>>0}Tr.sum64_4_hi=F;function k(_,v,l,p,m,y,A,E){var w=v+p+y+E;return w>>>0}Tr.sum64_4_lo=k;function $(_,v,l,p,m,y,A,E,w,I){var M=0,z=v;z=z+p>>>0,M+=z>>0,M+=z>>0,M+=z>>0,M+=z>>0}Tr.sum64_5_hi=$;function R(_,v,l,p,m,y,A,E,w,I){var M=v+p+y+E+I;return M>>>0}Tr.sum64_5_lo=R;function W(_,v,l){var p=v<<32-l|_>>>l;return p>>>0}Tr.rotr64_hi=W;function V(_,v,l){var p=_<<32-l|v>>>l;return p>>>0}Tr.rotr64_lo=V;function X(_,v,l){return _>>>l}Tr.shr64_hi=X;function q(_,v,l){var p=_<<32-l|v>>>l;return p>>>0}return Tr.shr64_lo=q,Tr}var Ag={},wx;function af(){if(wx)return Ag;wx=1;var t=_s(),e=ba();function r(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}return Ag.BlockHash=r,r.prototype.update=function(i,s){if(i=t.toArray(i,s),this.pending?this.pending=this.pending.concat(i):this.pending=i,this.pendingTotal+=i.length,this.pending.length>=this._delta8){i=this.pending;var o=i.length%this._delta8;this.pending=i.slice(i.length-o,i.length),this.pending.length===0&&(this.pending=null),i=t.join32(i,0,i.length-o,this.endian);for(var a=0;a>>24&255,a[f++]=i>>>16&255,a[f++]=i>>>8&255,a[f++]=i&255}else for(a[f++]=i&255,a[f++]=i>>>8&255,a[f++]=i>>>16&255,a[f++]=i>>>24&255,a[f++]=0,a[f++]=0,a[f++]=0,a[f++]=0,u=8;u>>3}Es.g0_256=f;function u(h){return e(h,17)^e(h,19)^h>>>10}return Es.g1_256=u,Es}var Pg,Ex;function yO(){if(Ex)return Pg;Ex=1;var t=_s(),e=af(),r=_x(),n=t.rotl32,i=t.sum32,s=t.sum32_5,o=r.ft_1,a=e.BlockHash,f=[1518500249,1859775393,2400959708,3395469782];function u(){if(!(this instanceof u))return new u;a.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}return t.inherits(u,a),Pg=u,u.blockSize=512,u.outSize=160,u.hmacStrength=80,u.padLength=64,u.prototype._update=function(g,b){for(var x=this.W,S=0;S<16;S++)x[S]=g[b+S];for(;Sthis.blockSize&&(i=new this.Hash().update(i).digest()),e(i.length<=this.blockSize);for(var s=i.length;s>8,b=h&255;g?f.push(g,b):f.push(b)}return f}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",f=0;f(b>>1)-1?C=(b>>1)-D:C=D,x.isubn(C)):C=0,g[S]=C,x.iushrn(1)}return g}r.getNAF=n;function i(f,u){var h=[[],[]];f=f.clone(),u=u.clone();for(var g=0,b=0,x;f.cmpn(-g)>0||u.cmpn(-b)>0;){var S=f.andln(3)+g&3,C=u.andln(3)+b&3;S===3&&(S=-1),C===3&&(C=-1);var D;(S&1)===0?D=0:(x=f.andln(7)+g&7,(x===3||x===5)&&C===2?D=-S:D=S),h[0].push(D);var B;(C&1)===0?B=0:(x=u.andln(7)+b&7,(x===3||x===5)&&S===2?B=-C:B=C),h[1].push(B),2*g===D+1&&(g=1-g),2*b===B+1&&(b=1-b),f.iushrn(1),u.iushrn(1)}return h}r.getJSF=i;function s(f,u,h){var g="_"+u;f.prototype[u]=function(){return this[g]!==void 0?this[g]:this[g]=h.call(this)}}r.cachedProperty=s;function o(f){return typeof f=="string"?r.toArray(f,"hex"):f}r.parseBytes=o;function a(f){return new nr(f,"hex","le")}r.intFromLE=a}),Ph=vi.getNAF,IO=vi.getJSF,Ih=vi.assert;function Mo(t,e){this.type=t,this.p=new nr(e.p,16),this.red=e.prime?nr.red(e.prime):nr.mont(this.p),this.zero=new nr(0).toRed(this.red),this.one=new nr(1).toRed(this.red),this.two=new nr(2).toRed(this.red),this.n=e.n&&new nr(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var wa=Mo;Mo.prototype.point=function(){throw new Error("Not implemented")},Mo.prototype.validate=function(){throw new Error("Not implemented")},Mo.prototype._fixedNafMul=function(e,r){Ih(e.precomputed);var n=e._getDoubles(),i=Ph(r,1,this._bitLength),s=(1<=a;u--)f=(f<<1)+i[u];o.push(f)}for(var h=this.jpoint(null,null,null),g=this.jpoint(null,null,null),b=s;b>0;b--){for(a=0;a=0;f--){for(var u=0;f>=0&&o[f]===0;f--)u++;if(f>=0&&u++,a=a.dblp(u),f<0)break;var h=o[f];Ih(h!==0),e.type==="affine"?h>0?a=a.mixedAdd(s[h-1>>1]):a=a.mixedAdd(s[-h-1>>1].neg()):h>0?a=a.add(s[h-1>>1]):a=a.add(s[-h-1>>1].neg())}return e.type==="affine"?a.toP():a},Mo.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,f=this._wnafT3,u=0,h,g,b;for(h=0;h=1;h-=2){var S=h-1,C=h;if(o[S]!==1||o[C]!==1){f[S]=Ph(n[S],o[S],this._bitLength),f[C]=Ph(n[C],o[C],this._bitLength),u=Math.max(f[S].length,u),u=Math.max(f[C].length,u);continue}var D=[r[S],null,null,r[C]];r[S].y.cmp(r[C].y)===0?(D[1]=r[S].add(r[C]),D[2]=r[S].toJ().mixedAdd(r[C].neg())):r[S].y.cmp(r[C].y.redNeg())===0?(D[1]=r[S].toJ().mixedAdd(r[C]),D[2]=r[S].add(r[C].neg())):(D[1]=r[S].toJ().mixedAdd(r[C]),D[2]=r[S].toJ().mixedAdd(r[C].neg()));var B=[-3,-1,-5,-7,0,7,5,1,3],L=IO(n[S],n[C]);for(u=Math.max(L[0].length,u),f[S]=new Array(u),f[C]=new Array(u),g=0;g=0;h--){for(var R=0;h>=0;){var W=!0;for(g=0;g=0&&R++,k=k.dblp(R),h<0)break;for(g=0;g0?b=a[g][V-1>>1]:V<0&&(b=a[g][-V-1>>1].neg()),b.type==="affine"?k=k.mixedAdd(b):k=k.add(b))}}for(h=0;h=Math.ceil((e.bitLength()+1)/r.step):!1},Oi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(x=u,S=h),g.negative&&(g=g.neg(),b=b.neg()),x.negative&&(x=x.neg(),S=S.neg()),[{a:g,b},{a:x,b:S}]},Ni.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),f=o.mul(i.a),u=s.mul(n.b),h=o.mul(i.b),g=e.sub(a).sub(f),b=u.add(h).neg();return{k1:g,k2:b}},Ni.prototype.pointFromX=function(e,r){e=new nr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)},Ni.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},Ni.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""},In.prototype.isInfinity=function(){return this.inf},In.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},In.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},In.prototype.getX=function(){return this.x.fromRed()},In.prototype.getY=function(){return this.y.fromRed()},In.prototype.mul=function(e){return e=new nr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},In.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},In.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},In.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},In.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r},In.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Dn(t,e,r,n){wa.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new nr(0)):(this.x=new nr(e,16),this.y=new nr(r,16),this.z=new nr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Ng(Dn,wa.BasePoint),Ni.prototype.jpoint=function(e,r,n){return new Dn(this,e,r,n)},Dn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)},Dn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Dn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),f=i.redSub(s),u=o.redSub(a);if(f.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var h=f.redSqr(),g=h.redMul(f),b=i.redMul(h),x=u.redSqr().redIAdd(g).redISub(b).redISub(b),S=u.redMul(b.redISub(x)).redISub(o.redMul(g)),C=this.z.redMul(e.z).redMul(f);return this.curve.jpoint(x,S,C)},Dn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),f=s.redSub(o);if(a.cmpn(0)===0)return f.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),h=u.redMul(a),g=n.redMul(u),b=f.redSqr().redIAdd(h).redISub(g).redISub(g),x=f.redMul(g.redISub(b)).redISub(s.redMul(h)),S=this.z.redMul(a);return this.curve.jpoint(b,x,S)},Dn.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},Dn.prototype.inspect=function(){return this.isInfinity()?"":""},Dn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Mh=xc(function(t,e){var r=e;r.base=wa,r.short=CO,r.mont=null,r.edwards=null}),Ch=xc(function(t,e){var r=e,n=vi.assert;function i(a){a.type==="short"?this.curve=new Mh.short(a):a.type==="edwards"?this.curve=new Mh.edwards(a):this.curve=new Mh.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,f){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var u=new i(f);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:u}),u}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Ws.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Ws.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Ws.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Ws.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Ws.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ws.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ws.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Ws.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function Co(t){if(!(this instanceof Co))return new Co(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ss.toArray(t.entropy,t.entropyEnc||"hex"),r=ss.toArray(t.nonce,t.nonceEnc||"hex"),n=ss.toArray(t.pers,t.persEnc||"hex");Og(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Lx=Co;Co.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},Co.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=ss.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var RO=vi.assert;function Rh(t,e){if(t instanceof Rh)return t;this._importDER(t,e)||(RO(t.r&&t.s,"Signature without r or s"),this.r=new nr(t.r,16),this.s=new nr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Th=Rh;function TO(){this.place=0}function Bg(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function kx(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Rh.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=kx(r),n=kx(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Fg(i,r.length),i=i.concat(r),i.push(2),Fg(i,n.length);var s=i.concat(n),o=[48];return Fg(o,s.length),o=o.concat(s),vi.encode(o,e)};var DO=(function(){throw new Error("unsupported")}),Bx=vi.assert;function Li(t){if(!(this instanceof Li))return new Li(t);typeof t=="string"&&(Bx(Object.prototype.hasOwnProperty.call(Ch,t),"Unknown curve "+t),t=Ch[t]),t instanceof Ch.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var OO=Li;Li.prototype.keyPair=function(e){return new kg(this,e)},Li.prototype.keyFromPrivate=function(e,r){return kg.fromPrivate(this,e,r)},Li.prototype.keyFromPublic=function(e,r){return kg.fromPublic(this,e,r)},Li.prototype.genKeyPair=function(e){e||(e={});for(var r=new Lx({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||DO(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new nr(2));;){var s=new nr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Li.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Li.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new nr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),f=new Lx({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new nr(1)),h=0;;h++){var g=i.k?i.k(h):new nr(f.generate(this.n.byteLength()));if(g=this._truncateToN(g,!0),!(g.cmpn(1)<=0||g.cmp(u)>=0)){var b=this.g.mul(g);if(!b.isInfinity()){var x=b.getX(),S=x.umod(this.n);if(S.cmpn(0)!==0){var C=g.invm(this.n).mul(S.mul(r.getPrivate()).iadd(e));if(C=C.umod(this.n),C.cmpn(0)!==0){var D=(b.getY().isOdd()?1:0)|(x.cmp(S)!==0?2:0);return i.canonical&&C.cmp(this.nh)>0&&(C=this.n.sub(C),D^=1),new Th({r:S,s:C,recoveryParam:D})}}}}}},Li.prototype.verify=function(e,r,n,i){e=this._truncateToN(new nr(e,16)),n=this.keyFromPublic(n,i),r=new Th(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),f=a.mul(e).umod(this.n),u=a.mul(s).umod(this.n),h;return this.curve._maxwellTrick?(h=this.g.jmulAdd(f,n.getPublic(),u),h.isInfinity()?!1:h.eqXToP(s)):(h=this.g.mulAdd(f,n.getPublic(),u),h.isInfinity()?!1:h.getX().umod(this.n).cmp(s)===0)},Li.prototype.recoverPubKey=function(t,e,r,n){Bx((3&r)===r,"The recovery param is more than two bits"),e=new Th(e,n);var i=this.n,s=new nr(t),o=e.r,a=e.s,f=r&1,u=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?o=this.curve.pointFromX(o.add(this.curve.n),f):o=this.curve.pointFromX(o,f);var h=e.r.invm(i),g=i.sub(s).mul(h).umod(i),b=a.mul(h).umod(i);return this.g.mulAdd(g,o,b)},Li.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Th(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var NO=xc(function(t,e){var r=e;r.version="6.5.4",r.utils=vi,r.rand=(function(){throw new Error("unsupported")}),r.curve=Mh,r.curves=Ch,r.ec=OO,r.eddsa=null}),LO=NO.ec;const kO="signing-key/5.7.0",jg=new Kr(kO);let Ug=null;function Ro(){return Ug||(Ug=new LO("secp256k1")),Ug}class BO{constructor(e){of(this,"curve","secp256k1"),of(this,"privateKey",mi(e)),sO(this.privateKey)!==32&&jg.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=Ro().keyFromPrivate(mn(this.privateKey));of(this,"publicKey","0x"+r.getPublic(!1,"hex")),of(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),of(this,"_isSigningKey",!0)}_addPoint(e){const r=Ro().keyFromPublic(mn(this.publicKey)),n=Ro().keyFromPublic(mn(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=Ro().keyFromPrivate(mn(this.privateKey)),n=mn(e);n.length!==32&&jg.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return lx({recoveryParam:i.recoveryParam,r:wc("0x"+i.r.toString(16),32),s:wc("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=Ro().keyFromPrivate(mn(this.privateKey)),n=Ro().keyFromPublic(mn(Fx(e)));return wc("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function FO(t,e){const r=lx(e),n={r:mn(r.r),s:mn(r.s)};return"0x"+Ro().recoverPubKey(mn(t),n,r.recoveryParam).encode("hex",!1)}function Fx(t,e){const r=mn(t);return r.length===32?new BO(r).publicKey:r.length===33?"0x"+Ro().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?mi(r):jg.throwArgumentError("invalid public or private key","key","[REDACTED]")}var jx;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(jx||(jx={}));function jO(t){const e=Fx(t);return bO(fx(wg(fx(e,1)),12))}function UO(t,e){return jO(FO(mn(t),e))}var $g={},cf={},Ux;function $O(){if(Ux)return cf;Ux=1,Object.defineProperty(cf,"__esModule",{value:!0});var t=ef(),e=ns(),r=20;function n(a,f,u){for(var h=1634760805,g=857760878,b=2036477234,x=1797285236,S=u[3]<<24|u[2]<<16|u[1]<<8|u[0],C=u[7]<<24|u[6]<<16|u[5]<<8|u[4],D=u[11]<<24|u[10]<<16|u[9]<<8|u[8],B=u[15]<<24|u[14]<<16|u[13]<<8|u[12],L=u[19]<<24|u[18]<<16|u[17]<<8|u[16],H=u[23]<<24|u[22]<<16|u[21]<<8|u[20],F=u[27]<<24|u[26]<<16|u[25]<<8|u[24],k=u[31]<<24|u[30]<<16|u[29]<<8|u[28],$=f[3]<<24|f[2]<<16|f[1]<<8|f[0],R=f[7]<<24|f[6]<<16|f[5]<<8|f[4],W=f[11]<<24|f[10]<<16|f[9]<<8|f[8],V=f[15]<<24|f[14]<<16|f[13]<<8|f[12],X=h,q=g,_=b,v=x,l=S,p=C,m=D,y=B,A=L,E=H,w=F,I=k,M=$,z=R,se=W,O=V,ie=0;ie>>16|M<<16,A=A+M|0,l^=A,l=l>>>20|l<<12,q=q+p|0,z^=q,z=z>>>16|z<<16,E=E+z|0,p^=E,p=p>>>20|p<<12,_=_+m|0,se^=_,se=se>>>16|se<<16,w=w+se|0,m^=w,m=m>>>20|m<<12,v=v+y|0,O^=v,O=O>>>16|O<<16,I=I+O|0,y^=I,y=y>>>20|y<<12,_=_+m|0,se^=_,se=se>>>24|se<<8,w=w+se|0,m^=w,m=m>>>25|m<<7,v=v+y|0,O^=v,O=O>>>24|O<<8,I=I+O|0,y^=I,y=y>>>25|y<<7,q=q+p|0,z^=q,z=z>>>24|z<<8,E=E+z|0,p^=E,p=p>>>25|p<<7,X=X+l|0,M^=X,M=M>>>24|M<<8,A=A+M|0,l^=A,l=l>>>25|l<<7,X=X+p|0,O^=X,O=O>>>16|O<<16,w=w+O|0,p^=w,p=p>>>20|p<<12,q=q+m|0,M^=q,M=M>>>16|M<<16,I=I+M|0,m^=I,m=m>>>20|m<<12,_=_+y|0,z^=_,z=z>>>16|z<<16,A=A+z|0,y^=A,y=y>>>20|y<<12,v=v+l|0,se^=v,se=se>>>16|se<<16,E=E+se|0,l^=E,l=l>>>20|l<<12,_=_+y|0,z^=_,z=z>>>24|z<<8,A=A+z|0,y^=A,y=y>>>25|y<<7,v=v+l|0,se^=v,se=se>>>24|se<<8,E=E+se|0,l^=E,l=l>>>25|l<<7,q=q+m|0,M^=q,M=M>>>24|M<<8,I=I+M|0,m^=I,m=m>>>25|m<<7,X=X+p|0,O^=X,O=O>>>24|O<<8,w=w+O|0,p^=w,p=p>>>25|p<<7;t.writeUint32LE(X+h|0,a,0),t.writeUint32LE(q+g|0,a,4),t.writeUint32LE(_+b|0,a,8),t.writeUint32LE(v+x|0,a,12),t.writeUint32LE(l+S|0,a,16),t.writeUint32LE(p+C|0,a,20),t.writeUint32LE(m+D|0,a,24),t.writeUint32LE(y+B|0,a,28),t.writeUint32LE(A+L|0,a,32),t.writeUint32LE(E+H|0,a,36),t.writeUint32LE(w+F|0,a,40),t.writeUint32LE(I+k|0,a,44),t.writeUint32LE(M+$|0,a,48),t.writeUint32LE(z+R|0,a,52),t.writeUint32LE(se+W|0,a,56),t.writeUint32LE(O+V|0,a,60)}function i(a,f,u,h,g){if(g===void 0&&(g=0),a.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(h.length>>=8,f++;if(h>0)throw new Error("ChaCha: counter overflow")}return cf}var qg={},xa={},$x;function zg(){if($x)return xa;$x=1,Object.defineProperty(xa,"__esModule",{value:!0});function t(i,s,o){return~(i-1)&s|i-1&o}xa.select=t;function e(i,s){return(i|0)-(s|0)-1>>>31&1}xa.lessOrEqual=e;function r(i,s){if(i.length!==s.length)return 0;for(var o=0,a=0;a>>8}xa.compare=r;function n(i,s){return i.length===0||s.length===0?!1:r(i,s)!==0}return xa.equal=n,xa}var qx;function qO(){return qx||(qx=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=zg(),r=ns();t.DIGEST_LENGTH=16;var n=(function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var f=a[0]|a[1]<<8;this._r[0]=f&8191;var u=a[2]|a[3]<<8;this._r[1]=(f>>>13|u<<3)&8191;var h=a[4]|a[5]<<8;this._r[2]=(u>>>10|h<<6)&7939;var g=a[6]|a[7]<<8;this._r[3]=(h>>>7|g<<9)&8191;var b=a[8]|a[9]<<8;this._r[4]=(g>>>4|b<<12)&255,this._r[5]=b>>>1&8190;var x=a[10]|a[11]<<8;this._r[6]=(b>>>14|x<<2)&8191;var S=a[12]|a[13]<<8;this._r[7]=(x>>>11|S<<5)&8065;var C=a[14]|a[15]<<8;this._r[8]=(S>>>8|C<<8)&8191,this._r[9]=C>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,f,u){for(var h=this._fin?0:2048,g=this._h[0],b=this._h[1],x=this._h[2],S=this._h[3],C=this._h[4],D=this._h[5],B=this._h[6],L=this._h[7],H=this._h[8],F=this._h[9],k=this._r[0],$=this._r[1],R=this._r[2],W=this._r[3],V=this._r[4],X=this._r[5],q=this._r[6],_=this._r[7],v=this._r[8],l=this._r[9];u>=16;){var p=a[f+0]|a[f+1]<<8;g+=p&8191;var m=a[f+2]|a[f+3]<<8;b+=(p>>>13|m<<3)&8191;var y=a[f+4]|a[f+5]<<8;x+=(m>>>10|y<<6)&8191;var A=a[f+6]|a[f+7]<<8;S+=(y>>>7|A<<9)&8191;var E=a[f+8]|a[f+9]<<8;C+=(A>>>4|E<<12)&8191,D+=E>>>1&8191;var w=a[f+10]|a[f+11]<<8;B+=(E>>>14|w<<2)&8191;var I=a[f+12]|a[f+13]<<8;L+=(w>>>11|I<<5)&8191;var M=a[f+14]|a[f+15]<<8;H+=(I>>>8|M<<8)&8191,F+=M>>>5|h;var z=0,se=z;se+=g*k,se+=b*(5*l),se+=x*(5*v),se+=S*(5*_),se+=C*(5*q),z=se>>>13,se&=8191,se+=D*(5*X),se+=B*(5*V),se+=L*(5*W),se+=H*(5*R),se+=F*(5*$),z+=se>>>13,se&=8191;var O=z;O+=g*$,O+=b*k,O+=x*(5*l),O+=S*(5*v),O+=C*(5*_),z=O>>>13,O&=8191,O+=D*(5*q),O+=B*(5*X),O+=L*(5*V),O+=H*(5*W),O+=F*(5*R),z+=O>>>13,O&=8191;var ie=z;ie+=g*R,ie+=b*$,ie+=x*k,ie+=S*(5*l),ie+=C*(5*v),z=ie>>>13,ie&=8191,ie+=D*(5*_),ie+=B*(5*q),ie+=L*(5*X),ie+=H*(5*V),ie+=F*(5*W),z+=ie>>>13,ie&=8191;var ee=z;ee+=g*W,ee+=b*R,ee+=x*$,ee+=S*k,ee+=C*(5*l),z=ee>>>13,ee&=8191,ee+=D*(5*v),ee+=B*(5*_),ee+=L*(5*q),ee+=H*(5*X),ee+=F*(5*V),z+=ee>>>13,ee&=8191;var Z=z;Z+=g*V,Z+=b*W,Z+=x*R,Z+=S*$,Z+=C*k,z=Z>>>13,Z&=8191,Z+=D*(5*l),Z+=B*(5*v),Z+=L*(5*_),Z+=H*(5*q),Z+=F*(5*X),z+=Z>>>13,Z&=8191;var te=z;te+=g*X,te+=b*V,te+=x*W,te+=S*R,te+=C*$,z=te>>>13,te&=8191,te+=D*k,te+=B*(5*l),te+=L*(5*v),te+=H*(5*_),te+=F*(5*q),z+=te>>>13,te&=8191;var N=z;N+=g*q,N+=b*X,N+=x*V,N+=S*W,N+=C*R,z=N>>>13,N&=8191,N+=D*$,N+=B*k,N+=L*(5*l),N+=H*(5*v),N+=F*(5*_),z+=N>>>13,N&=8191;var Q=z;Q+=g*_,Q+=b*q,Q+=x*X,Q+=S*V,Q+=C*W,z=Q>>>13,Q&=8191,Q+=D*R,Q+=B*$,Q+=L*k,Q+=H*(5*l),Q+=F*(5*v),z+=Q>>>13,Q&=8191;var ne=z;ne+=g*v,ne+=b*_,ne+=x*q,ne+=S*X,ne+=C*V,z=ne>>>13,ne&=8191,ne+=D*W,ne+=B*R,ne+=L*$,ne+=H*k,ne+=F*(5*l),z+=ne>>>13,ne&=8191;var de=z;de+=g*l,de+=b*v,de+=x*_,de+=S*q,de+=C*X,z=de>>>13,de&=8191,de+=D*V,de+=B*W,de+=L*R,de+=H*$,de+=F*k,z+=de>>>13,de&=8191,z=(z<<2)+z|0,z=z+se|0,se=z&8191,z=z>>>13,O+=z,g=se,b=O,x=ie,S=ee,C=Z,D=te,B=N,L=Q,H=ne,F=de,f+=16,u-=16}this._h[0]=g,this._h[1]=b,this._h[2]=x,this._h[3]=S,this._h[4]=C,this._h[5]=D,this._h[6]=B,this._h[7]=L,this._h[8]=H,this._h[9]=F},o.prototype.finish=function(a,f){f===void 0&&(f=0);var u=new Uint16Array(10),h,g,b,x;if(this._leftover){for(x=this._leftover,this._buffer[x++]=1;x<16;x++)this._buffer[x]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(h=this._h[1]>>>13,this._h[1]&=8191,x=2;x<10;x++)this._h[x]+=h,h=this._h[x]>>>13,this._h[x]&=8191;for(this._h[0]+=h*5,h=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=h,h=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=h,u[0]=this._h[0]+5,h=u[0]>>>13,u[0]&=8191,x=1;x<10;x++)u[x]=this._h[x]+h,h=u[x]>>>13,u[x]&=8191;for(u[9]-=8192,g=(h^1)-1,x=0;x<10;x++)u[x]&=g;for(g=~g,x=0;x<10;x++)this._h[x]=this._h[x]&g|u[x];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,b=this._h[0]+this._pad[0],this._h[0]=b&65535,x=1;x<8;x++)b=(this._h[x]+this._pad[x]|0)+(b>>>16)|0,this._h[x]=b&65535;return a[f+0]=this._h[0]>>>0,a[f+1]=this._h[0]>>>8,a[f+2]=this._h[1]>>>0,a[f+3]=this._h[1]>>>8,a[f+4]=this._h[2]>>>0,a[f+5]=this._h[2]>>>8,a[f+6]=this._h[3]>>>0,a[f+7]=this._h[3]>>>8,a[f+8]=this._h[4]>>>0,a[f+9]=this._h[4]>>>8,a[f+10]=this._h[5]>>>0,a[f+11]=this._h[5]>>>8,a[f+12]=this._h[6]>>>0,a[f+13]=this._h[6]>>>8,a[f+14]=this._h[7]>>>0,a[f+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var f=0,u=a.length,h;if(this._leftover){h=16-this._leftover,h>u&&(h=u);for(var g=0;g=16&&(h=u-u%16,this._blocks(a,f,h),f+=h,u-=h),u){for(var g=0;g16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var x=new Uint8Array(16);x.set(u,x.length-u.length);var S=new Uint8Array(32);e.stream(this._key,x,S,4);var C=h.length+this.tagLength,D;if(b){if(b.length!==C)throw new Error("ChaCha20Poly1305: incorrect destination length");D=b}else D=new Uint8Array(C);return e.streamXOR(this._key,x,h,D,4),this._authenticate(D.subarray(D.length-this.tagLength,D.length),S,D.subarray(0,D.length-this.tagLength),g),n.wipe(x),D},f.prototype.open=function(u,h,g,b){if(u.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(h.length0&&x.update(o.subarray(b.length%16))),x.update(g),g.length%16>0&&x.update(o.subarray(g.length%16));var S=new Uint8Array(8);b&&i.writeUint64LE(b.length,S),x.update(S),i.writeUint64LE(g.length,S),x.update(S);for(var C=x.digest(),D=0;Dthis.blockSize?this._inner.update(a).finish(f).clean():f.set(a);for(var u=0;u1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},n.prototype.expand=function(i){for(var s=new Uint8Array(i),o=0;o0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=f[h++],u--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(u>=this.blockSize&&(h=s(this._temp,this._state,f,h,u),u%=this.blockSize);u>0;)this._buffer[this._bufferLength++]=f[h++],u--;return this},a.prototype.finish=function(f){if(!this._finished){var u=this._bytesHashed,h=this._bufferLength,g=u/536870912|0,b=u<<3,x=u%64<56?64:128;this._buffer[h]=128;for(var S=h+1;S0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(f){return this._state.set(f.state),this._bufferLength=f.bufferLength,f.buffer&&this._buffer.set(f.buffer),this._bytesHashed=f.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(f){r.wipe(f.state),f.buffer&&r.wipe(f.buffer),f.bufferLength=0,f.bytesHashed=0},a})();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,f,u,h,g){for(;g>=64;){for(var b=f[0],x=f[1],S=f[2],C=f[3],D=f[4],B=f[5],L=f[6],H=f[7],F=0;F<16;F++){var k=h+F*4;a[F]=e.readUint32BE(u,k)}for(var F=16;F<64;F++){var $=a[F-2],R=($>>>17|$<<15)^($>>>19|$<<13)^$>>>10;$=a[F-15];var W=($>>>7|$<<25)^($>>>18|$<<14)^$>>>3;a[F]=(R+a[F-7]|0)+(W+a[F-16]|0)}for(var F=0;F<64;F++){var R=(((D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7))+(D&B^~D&L)|0)+(H+(i[F]+a[F]|0)|0)|0,W=((b>>>2|b<<30)^(b>>>13|b<<19)^(b>>>22|b<<10))+(b&x^b&S^x&S)|0;H=L,L=B,B=D,D=C+R|0,C=S,S=x,x=b,b=R+W|0}f[0]+=b,f[1]+=x,f[2]+=S,f[3]+=C,f[4]+=D,f[5]+=B,f[6]+=L,f[7]+=H,h+=64,g-=64}return h}function o(a){var f=new n;f.update(a);var u=f.digest();return f.clean(),u}t.hash=o})(Hg)),Hg}var Nh=GO(),Wg={},Yx;function YO(){return Yx||(Yx=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=og(),r=ns();t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(F){const k=new Float64Array(16);if(F)for(let $=0;$>16&1),$[X-1]&=65535;$[15]=R[15]-32767-($[14]>>16&1);const V=$[15]>>16&1;$[14]&=65535,a(R,$,1-V)}for(let W=0;W<16;W++)F[2*W]=R[W]&255,F[2*W+1]=R[W]>>8}function u(F,k){for(let $=0;$<16;$++)F[$]=k[2*$]+(k[2*$+1]<<8);F[15]&=32767}function h(F,k,$){for(let R=0;R<16;R++)F[R]=k[R]+$[R]}function g(F,k,$){for(let R=0;R<16;R++)F[R]=k[R]-$[R]}function b(F,k,$){let R,W,V=0,X=0,q=0,_=0,v=0,l=0,p=0,m=0,y=0,A=0,E=0,w=0,I=0,M=0,z=0,se=0,O=0,ie=0,ee=0,Z=0,te=0,N=0,Q=0,ne=0,de=0,ce=0,fe=0,be=0,Pe=0,De=0,Te=0,Fe=$[0],Me=$[1],Ne=$[2],He=$[3],Oe=$[4],$e=$[5],qe=$[6],_e=$[7],Qe=$[8],at=$[9],Be=$[10],nt=$[11],it=$[12],Ye=$[13],pt=$[14],ht=$[15];R=k[0],V+=R*Fe,X+=R*Me,q+=R*Ne,_+=R*He,v+=R*Oe,l+=R*$e,p+=R*qe,m+=R*_e,y+=R*Qe,A+=R*at,E+=R*Be,w+=R*nt,I+=R*it,M+=R*Ye,z+=R*pt,se+=R*ht,R=k[1],X+=R*Fe,q+=R*Me,_+=R*Ne,v+=R*He,l+=R*Oe,p+=R*$e,m+=R*qe,y+=R*_e,A+=R*Qe,E+=R*at,w+=R*Be,I+=R*nt,M+=R*it,z+=R*Ye,se+=R*pt,O+=R*ht,R=k[2],q+=R*Fe,_+=R*Me,v+=R*Ne,l+=R*He,p+=R*Oe,m+=R*$e,y+=R*qe,A+=R*_e,E+=R*Qe,w+=R*at,I+=R*Be,M+=R*nt,z+=R*it,se+=R*Ye,O+=R*pt,ie+=R*ht,R=k[3],_+=R*Fe,v+=R*Me,l+=R*Ne,p+=R*He,m+=R*Oe,y+=R*$e,A+=R*qe,E+=R*_e,w+=R*Qe,I+=R*at,M+=R*Be,z+=R*nt,se+=R*it,O+=R*Ye,ie+=R*pt,ee+=R*ht,R=k[4],v+=R*Fe,l+=R*Me,p+=R*Ne,m+=R*He,y+=R*Oe,A+=R*$e,E+=R*qe,w+=R*_e,I+=R*Qe,M+=R*at,z+=R*Be,se+=R*nt,O+=R*it,ie+=R*Ye,ee+=R*pt,Z+=R*ht,R=k[5],l+=R*Fe,p+=R*Me,m+=R*Ne,y+=R*He,A+=R*Oe,E+=R*$e,w+=R*qe,I+=R*_e,M+=R*Qe,z+=R*at,se+=R*Be,O+=R*nt,ie+=R*it,ee+=R*Ye,Z+=R*pt,te+=R*ht,R=k[6],p+=R*Fe,m+=R*Me,y+=R*Ne,A+=R*He,E+=R*Oe,w+=R*$e,I+=R*qe,M+=R*_e,z+=R*Qe,se+=R*at,O+=R*Be,ie+=R*nt,ee+=R*it,Z+=R*Ye,te+=R*pt,N+=R*ht,R=k[7],m+=R*Fe,y+=R*Me,A+=R*Ne,E+=R*He,w+=R*Oe,I+=R*$e,M+=R*qe,z+=R*_e,se+=R*Qe,O+=R*at,ie+=R*Be,ee+=R*nt,Z+=R*it,te+=R*Ye,N+=R*pt,Q+=R*ht,R=k[8],y+=R*Fe,A+=R*Me,E+=R*Ne,w+=R*He,I+=R*Oe,M+=R*$e,z+=R*qe,se+=R*_e,O+=R*Qe,ie+=R*at,ee+=R*Be,Z+=R*nt,te+=R*it,N+=R*Ye,Q+=R*pt,ne+=R*ht,R=k[9],A+=R*Fe,E+=R*Me,w+=R*Ne,I+=R*He,M+=R*Oe,z+=R*$e,se+=R*qe,O+=R*_e,ie+=R*Qe,ee+=R*at,Z+=R*Be,te+=R*nt,N+=R*it,Q+=R*Ye,ne+=R*pt,de+=R*ht,R=k[10],E+=R*Fe,w+=R*Me,I+=R*Ne,M+=R*He,z+=R*Oe,se+=R*$e,O+=R*qe,ie+=R*_e,ee+=R*Qe,Z+=R*at,te+=R*Be,N+=R*nt,Q+=R*it,ne+=R*Ye,de+=R*pt,ce+=R*ht,R=k[11],w+=R*Fe,I+=R*Me,M+=R*Ne,z+=R*He,se+=R*Oe,O+=R*$e,ie+=R*qe,ee+=R*_e,Z+=R*Qe,te+=R*at,N+=R*Be,Q+=R*nt,ne+=R*it,de+=R*Ye,ce+=R*pt,fe+=R*ht,R=k[12],I+=R*Fe,M+=R*Me,z+=R*Ne,se+=R*He,O+=R*Oe,ie+=R*$e,ee+=R*qe,Z+=R*_e,te+=R*Qe,N+=R*at,Q+=R*Be,ne+=R*nt,de+=R*it,ce+=R*Ye,fe+=R*pt,be+=R*ht,R=k[13],M+=R*Fe,z+=R*Me,se+=R*Ne,O+=R*He,ie+=R*Oe,ee+=R*$e,Z+=R*qe,te+=R*_e,N+=R*Qe,Q+=R*at,ne+=R*Be,de+=R*nt,ce+=R*it,fe+=R*Ye,be+=R*pt,Pe+=R*ht,R=k[14],z+=R*Fe,se+=R*Me,O+=R*Ne,ie+=R*He,ee+=R*Oe,Z+=R*$e,te+=R*qe,N+=R*_e,Q+=R*Qe,ne+=R*at,de+=R*Be,ce+=R*nt,fe+=R*it,be+=R*Ye,Pe+=R*pt,De+=R*ht,R=k[15],se+=R*Fe,O+=R*Me,ie+=R*Ne,ee+=R*He,Z+=R*Oe,te+=R*$e,N+=R*qe,Q+=R*_e,ne+=R*Qe,de+=R*at,ce+=R*Be,fe+=R*nt,be+=R*it,Pe+=R*Ye,De+=R*pt,Te+=R*ht,V+=38*O,X+=38*ie,q+=38*ee,_+=38*Z,v+=38*te,l+=38*N,p+=38*Q,m+=38*ne,y+=38*de,A+=38*ce,E+=38*fe,w+=38*be,I+=38*Pe,M+=38*De,z+=38*Te,W=1,R=V+W+65535,W=Math.floor(R/65536),V=R-W*65536,R=X+W+65535,W=Math.floor(R/65536),X=R-W*65536,R=q+W+65535,W=Math.floor(R/65536),q=R-W*65536,R=_+W+65535,W=Math.floor(R/65536),_=R-W*65536,R=v+W+65535,W=Math.floor(R/65536),v=R-W*65536,R=l+W+65535,W=Math.floor(R/65536),l=R-W*65536,R=p+W+65535,W=Math.floor(R/65536),p=R-W*65536,R=m+W+65535,W=Math.floor(R/65536),m=R-W*65536,R=y+W+65535,W=Math.floor(R/65536),y=R-W*65536,R=A+W+65535,W=Math.floor(R/65536),A=R-W*65536,R=E+W+65535,W=Math.floor(R/65536),E=R-W*65536,R=w+W+65535,W=Math.floor(R/65536),w=R-W*65536,R=I+W+65535,W=Math.floor(R/65536),I=R-W*65536,R=M+W+65535,W=Math.floor(R/65536),M=R-W*65536,R=z+W+65535,W=Math.floor(R/65536),z=R-W*65536,R=se+W+65535,W=Math.floor(R/65536),se=R-W*65536,V+=W-1+37*(W-1),W=1,R=V+W+65535,W=Math.floor(R/65536),V=R-W*65536,R=X+W+65535,W=Math.floor(R/65536),X=R-W*65536,R=q+W+65535,W=Math.floor(R/65536),q=R-W*65536,R=_+W+65535,W=Math.floor(R/65536),_=R-W*65536,R=v+W+65535,W=Math.floor(R/65536),v=R-W*65536,R=l+W+65535,W=Math.floor(R/65536),l=R-W*65536,R=p+W+65535,W=Math.floor(R/65536),p=R-W*65536,R=m+W+65535,W=Math.floor(R/65536),m=R-W*65536,R=y+W+65535,W=Math.floor(R/65536),y=R-W*65536,R=A+W+65535,W=Math.floor(R/65536),A=R-W*65536,R=E+W+65535,W=Math.floor(R/65536),E=R-W*65536,R=w+W+65535,W=Math.floor(R/65536),w=R-W*65536,R=I+W+65535,W=Math.floor(R/65536),I=R-W*65536,R=M+W+65535,W=Math.floor(R/65536),M=R-W*65536,R=z+W+65535,W=Math.floor(R/65536),z=R-W*65536,R=se+W+65535,W=Math.floor(R/65536),se=R-W*65536,V+=W-1+37*(W-1),F[0]=V,F[1]=X,F[2]=q,F[3]=_,F[4]=v,F[5]=l,F[6]=p,F[7]=m,F[8]=y,F[9]=A,F[10]=E,F[11]=w,F[12]=I,F[13]=M,F[14]=z,F[15]=se}function x(F,k){b(F,k,k)}function S(F,k){const $=n();for(let R=0;R<16;R++)$[R]=k[R];for(let R=253;R>=0;R--)x($,$),R!==2&&R!==4&&b($,$,k);for(let R=0;R<16;R++)F[R]=$[R]}function C(F,k){const $=new Uint8Array(32),R=new Float64Array(80),W=n(),V=n(),X=n(),q=n(),_=n(),v=n();for(let y=0;y<31;y++)$[y]=F[y];$[31]=F[31]&127|64,$[0]&=248,u(R,k);for(let y=0;y<16;y++)V[y]=R[y];W[0]=q[0]=1;for(let y=254;y>=0;--y){const A=$[y>>>3]>>>(y&7)&1;a(W,V,A),a(X,q,A),h(_,W,X),g(W,W,X),h(X,V,q),g(V,V,q),x(q,_),x(v,W),b(W,X,W),b(X,V,_),h(_,W,X),g(W,W,X),x(V,W),g(X,q,v),b(W,X,s),h(W,W,q),b(X,X,W),b(W,q,v),b(q,V,R),x(V,_),a(W,V,A),a(X,q,A)}for(let y=0;y<16;y++)R[y+16]=W[y],R[y+32]=X[y],R[y+48]=V[y],R[y+64]=q[y];const l=R.subarray(32),p=R.subarray(16);S(l,l),b(p,p,l);const m=new Uint8Array(32);return f(m,p),m}t.scalarMult=C;function D(F){return C(F,i)}t.scalarMultBase=D;function B(F){if(F.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const k=new Uint8Array(F);return{publicKey:D(k),secretKey:k}}t.generateKeyPairFromSeed=B;function L(F){const k=(0,e.randomBytes)(32,F),$=B(k);return(0,r.wipe)(k),$}t.generateKeyPair=L;function H(F,k,$=!1){if(F.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(k.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const R=C(F,k);if($){let W=0;for(let V=0;V0?_:v},s.min=function(_,v){return _.cmp(v)<0?_:v},s.prototype._init=function(_,v,l){if(typeof _=="number")return this._initNumber(_,v,l);if(typeof _=="object")return this._initArray(_,v,l);v==="hex"&&(v=16),n(v===(v|0)&&v>=2&&v<=36),_=_.toString().replace(/\s+/g,"");var p=0;_[0]==="-"&&(p++,this.negative=1),p<_.length&&(v===16?this._parseHex(_,p,l):(this._parseBase(_,v,p),l==="le"&&this._initArray(this.toArray(),v,l)))},s.prototype._initNumber=function(_,v,l){_<0&&(this.negative=1,_=-_),_<67108864?(this.words=[_&67108863],this.length=1):_<4503599627370496?(this.words=[_&67108863,_/67108864&67108863],this.length=2):(n(_<9007199254740992),this.words=[_&67108863,_/67108864&67108863,1],this.length=3),l==="le"&&this._initArray(this.toArray(),v,l)},s.prototype._initArray=function(_,v,l){if(n(typeof _.length=="number"),_.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(_.length/3),this.words=new Array(this.length);for(var p=0;p=0;p-=3)y=_[p]|_[p-1]<<8|_[p-2]<<16,this.words[m]|=y<>>26-A&67108863,A+=24,A>=26&&(A-=26,m++);else if(l==="le")for(p=0,m=0;p<_.length;p+=3)y=_[p]|_[p+1]<<8|_[p+2]<<16,this.words[m]|=y<>>26-A&67108863,A+=24,A>=26&&(A-=26,m++);return this.strip()};function a(q,_){var v=q.charCodeAt(_);return v>=65&&v<=70?v-55:v>=97&&v<=102?v-87:v-48&15}function f(q,_,v){var l=a(q,v);return v-1>=_&&(l|=a(q,v-1)<<4),l}s.prototype._parseHex=function(_,v,l){this.length=Math.ceil((_.length-v)/6),this.words=new Array(this.length);for(var p=0;p=v;p-=2)A=f(_,v,p)<=18?(m-=18,y+=1,this.words[y]|=A>>>26):m+=8;else{var E=_.length-v;for(p=E%2===0?v+1:v;p<_.length;p+=2)A=f(_,v,p)<=18?(m-=18,y+=1,this.words[y]|=A>>>26):m+=8}this.strip()};function u(q,_,v,l){for(var p=0,m=Math.min(q.length,v),y=_;y=49?p+=A-49+10:A>=17?p+=A-17+10:p+=A}return p}s.prototype._parseBase=function(_,v,l){this.words=[0],this.length=1;for(var p=0,m=1;m<=67108863;m*=v)p++;p--,m=m/v|0;for(var y=_.length-l,A=y%p,E=Math.min(y,y-A)+l,w=0,I=l;I1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var h=["","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"],g=[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],b=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(_,v){_=_||10,v=v|0||1;var l;if(_===16||_==="hex"){l="";for(var p=0,m=0,y=0;y>>24-p&16777215,p+=2,p>=26&&(p-=26,y--),m!==0||y!==this.length-1?l=h[6-E.length]+E+l:l=E+l}for(m!==0&&(l=m.toString(16)+l);l.length%v!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(_===(_|0)&&_>=2&&_<=36){var w=g[_],I=b[_];l="";var M=this.clone();for(M.negative=0;!M.isZero();){var z=M.modn(I).toString(_);M=M.idivn(I),M.isZero()?l=z+l:l=h[w-z.length]+z+l}for(this.isZero()&&(l="0"+l);l.length%v!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var _=this.words[0];return this.length===2?_+=this.words[1]*67108864:this.length===3&&this.words[2]===1?_+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-_:_},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(_,v){return n(typeof o<"u"),this.toArrayLike(o,_,v)},s.prototype.toArray=function(_,v){return this.toArrayLike(Array,_,v)},s.prototype.toArrayLike=function(_,v,l){var p=this.byteLength(),m=l||Math.max(1,p);n(p<=m,"byte array longer than desired length"),n(m>0,"Requested array length <= 0"),this.strip();var y=v==="le",A=new _(m),E,w,I=this.clone();if(y){for(w=0;!I.isZero();w++)E=I.andln(255),I.iushrn(8),A[w]=E;for(;w=4096&&(l+=13,v>>>=13),v>=64&&(l+=7,v>>>=7),v>=8&&(l+=4,v>>>=4),v>=2&&(l+=2,v>>>=2),l+v},s.prototype._zeroBits=function(_){if(_===0)return 26;var v=_,l=0;return(v&8191)===0&&(l+=13,v>>>=13),(v&127)===0&&(l+=7,v>>>=7),(v&15)===0&&(l+=4,v>>>=4),(v&3)===0&&(l+=2,v>>>=2),(v&1)===0&&l++,l},s.prototype.bitLength=function(){var _=this.words[this.length-1],v=this._countBits(_);return(this.length-1)*26+v};function x(q){for(var _=new Array(q.bitLength()),v=0;v<_.length;v++){var l=v/26|0,p=v%26;_[v]=(q.words[l]&1<>>p}return _}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var _=0,v=0;v_.length?this.clone().ior(_):_.clone().ior(this)},s.prototype.uor=function(_){return this.length>_.length?this.clone().iuor(_):_.clone().iuor(this)},s.prototype.iuand=function(_){var v;this.length>_.length?v=_:v=this;for(var l=0;l_.length?this.clone().iand(_):_.clone().iand(this)},s.prototype.uand=function(_){return this.length>_.length?this.clone().iuand(_):_.clone().iuand(this)},s.prototype.iuxor=function(_){var v,l;this.length>_.length?(v=this,l=_):(v=_,l=this);for(var p=0;p_.length?this.clone().ixor(_):_.clone().ixor(this)},s.prototype.uxor=function(_){return this.length>_.length?this.clone().iuxor(_):_.clone().iuxor(this)},s.prototype.inotn=function(_){n(typeof _=="number"&&_>=0);var v=Math.ceil(_/26)|0,l=_%26;this._expand(v),l>0&&v--;for(var p=0;p0&&(this.words[p]=~this.words[p]&67108863>>26-l),this.strip()},s.prototype.notn=function(_){return this.clone().inotn(_)},s.prototype.setn=function(_,v){n(typeof _=="number"&&_>=0);var l=_/26|0,p=_%26;return this._expand(l+1),v?this.words[l]=this.words[l]|1<_.length?(l=this,p=_):(l=_,p=this);for(var m=0,y=0;y>>26;for(;m!==0&&y>>26;if(this.length=l.length,m!==0)this.words[this.length]=m,this.length++;else if(l!==this)for(;y_.length?this.clone().iadd(_):_.clone().iadd(this)},s.prototype.isub=function(_){if(_.negative!==0){_.negative=0;var v=this.iadd(_);return _.negative=1,v._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(_),this.negative=1,this._normSign();var l=this.cmp(_);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,m;l>0?(p=this,m=_):(p=_,m=this);for(var y=0,A=0;A>26,this.words[A]=v&67108863;for(;y!==0&&A>26,this.words[A]=v&67108863;if(y===0&&A>>26,M=E&67108863,z=Math.min(w,_.length-1),se=Math.max(0,w-q.length+1);se<=z;se++){var O=w-se|0;p=q.words[O]|0,m=_.words[se]|0,y=p*m+M,I+=y/67108864|0,M=y&67108863}v.words[w]=M|0,E=I|0}return E!==0?v.words[w]=E|0:v.length--,v.strip()}var C=function(_,v,l){var p=_.words,m=v.words,y=l.words,A=0,E,w,I,M=p[0]|0,z=M&8191,se=M>>>13,O=p[1]|0,ie=O&8191,ee=O>>>13,Z=p[2]|0,te=Z&8191,N=Z>>>13,Q=p[3]|0,ne=Q&8191,de=Q>>>13,ce=p[4]|0,fe=ce&8191,be=ce>>>13,Pe=p[5]|0,De=Pe&8191,Te=Pe>>>13,Fe=p[6]|0,Me=Fe&8191,Ne=Fe>>>13,He=p[7]|0,Oe=He&8191,$e=He>>>13,qe=p[8]|0,_e=qe&8191,Qe=qe>>>13,at=p[9]|0,Be=at&8191,nt=at>>>13,it=m[0]|0,Ye=it&8191,pt=it>>>13,ht=m[1]|0,ft=ht&8191,Ht=ht>>>13,Jt=m[2]|0,St=Jt&8191,Xt=Jt>>>13,tr=m[3]|0,Dt=tr&8191,Bt=tr>>>13,Ct=m[4]|0,gt=Ct&8191,Ot=Ct>>>13,Lt=m[5]|0,bt=Lt&8191,jt=Lt>>>13,Ut=m[6]|0,tt=Ut&8191,Ft=Ut>>>13,K=m[7]|0,G=K&8191,J=K>>>13,T=m[8]|0,j=T&8191,oe=T>>>13,le=m[9]|0,me=le&8191,Ee=le>>>13;l.negative=_.negative^v.negative,l.length=19,E=Math.imul(z,Ye),w=Math.imul(z,pt),w=w+Math.imul(se,Ye)|0,I=Math.imul(se,pt);var ke=(A+E|0)+((w&8191)<<13)|0;A=(I+(w>>>13)|0)+(ke>>>26)|0,ke&=67108863,E=Math.imul(ie,Ye),w=Math.imul(ie,pt),w=w+Math.imul(ee,Ye)|0,I=Math.imul(ee,pt),E=E+Math.imul(z,ft)|0,w=w+Math.imul(z,Ht)|0,w=w+Math.imul(se,ft)|0,I=I+Math.imul(se,Ht)|0;var Ce=(A+E|0)+((w&8191)<<13)|0;A=(I+(w>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,E=Math.imul(te,Ye),w=Math.imul(te,pt),w=w+Math.imul(N,Ye)|0,I=Math.imul(N,pt),E=E+Math.imul(ie,ft)|0,w=w+Math.imul(ie,Ht)|0,w=w+Math.imul(ee,ft)|0,I=I+Math.imul(ee,Ht)|0,E=E+Math.imul(z,St)|0,w=w+Math.imul(z,Xt)|0,w=w+Math.imul(se,St)|0,I=I+Math.imul(se,Xt)|0;var et=(A+E|0)+((w&8191)<<13)|0;A=(I+(w>>>13)|0)+(et>>>26)|0,et&=67108863,E=Math.imul(ne,Ye),w=Math.imul(ne,pt),w=w+Math.imul(de,Ye)|0,I=Math.imul(de,pt),E=E+Math.imul(te,ft)|0,w=w+Math.imul(te,Ht)|0,w=w+Math.imul(N,ft)|0,I=I+Math.imul(N,Ht)|0,E=E+Math.imul(ie,St)|0,w=w+Math.imul(ie,Xt)|0,w=w+Math.imul(ee,St)|0,I=I+Math.imul(ee,Xt)|0,E=E+Math.imul(z,Dt)|0,w=w+Math.imul(z,Bt)|0,w=w+Math.imul(se,Dt)|0,I=I+Math.imul(se,Bt)|0;var Ze=(A+E|0)+((w&8191)<<13)|0;A=(I+(w>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,E=Math.imul(fe,Ye),w=Math.imul(fe,pt),w=w+Math.imul(be,Ye)|0,I=Math.imul(be,pt),E=E+Math.imul(ne,ft)|0,w=w+Math.imul(ne,Ht)|0,w=w+Math.imul(de,ft)|0,I=I+Math.imul(de,Ht)|0,E=E+Math.imul(te,St)|0,w=w+Math.imul(te,Xt)|0,w=w+Math.imul(N,St)|0,I=I+Math.imul(N,Xt)|0,E=E+Math.imul(ie,Dt)|0,w=w+Math.imul(ie,Bt)|0,w=w+Math.imul(ee,Dt)|0,I=I+Math.imul(ee,Bt)|0,E=E+Math.imul(z,gt)|0,w=w+Math.imul(z,Ot)|0,w=w+Math.imul(se,gt)|0,I=I+Math.imul(se,Ot)|0;var rt=(A+E|0)+((w&8191)<<13)|0;A=(I+(w>>>13)|0)+(rt>>>26)|0,rt&=67108863,E=Math.imul(De,Ye),w=Math.imul(De,pt),w=w+Math.imul(Te,Ye)|0,I=Math.imul(Te,pt),E=E+Math.imul(fe,ft)|0,w=w+Math.imul(fe,Ht)|0,w=w+Math.imul(be,ft)|0,I=I+Math.imul(be,Ht)|0,E=E+Math.imul(ne,St)|0,w=w+Math.imul(ne,Xt)|0,w=w+Math.imul(de,St)|0,I=I+Math.imul(de,Xt)|0,E=E+Math.imul(te,Dt)|0,w=w+Math.imul(te,Bt)|0,w=w+Math.imul(N,Dt)|0,I=I+Math.imul(N,Bt)|0,E=E+Math.imul(ie,gt)|0,w=w+Math.imul(ie,Ot)|0,w=w+Math.imul(ee,gt)|0,I=I+Math.imul(ee,Ot)|0,E=E+Math.imul(z,bt)|0,w=w+Math.imul(z,jt)|0,w=w+Math.imul(se,bt)|0,I=I+Math.imul(se,jt)|0;var ot=(A+E|0)+((w&8191)<<13)|0;A=(I+(w>>>13)|0)+(ot>>>26)|0,ot&=67108863,E=Math.imul(Me,Ye),w=Math.imul(Me,pt),w=w+Math.imul(Ne,Ye)|0,I=Math.imul(Ne,pt),E=E+Math.imul(De,ft)|0,w=w+Math.imul(De,Ht)|0,w=w+Math.imul(Te,ft)|0,I=I+Math.imul(Te,Ht)|0,E=E+Math.imul(fe,St)|0,w=w+Math.imul(fe,Xt)|0,w=w+Math.imul(be,St)|0,I=I+Math.imul(be,Xt)|0,E=E+Math.imul(ne,Dt)|0,w=w+Math.imul(ne,Bt)|0,w=w+Math.imul(de,Dt)|0,I=I+Math.imul(de,Bt)|0,E=E+Math.imul(te,gt)|0,w=w+Math.imul(te,Ot)|0,w=w+Math.imul(N,gt)|0,I=I+Math.imul(N,Ot)|0,E=E+Math.imul(ie,bt)|0,w=w+Math.imul(ie,jt)|0,w=w+Math.imul(ee,bt)|0,I=I+Math.imul(ee,jt)|0,E=E+Math.imul(z,tt)|0,w=w+Math.imul(z,Ft)|0,w=w+Math.imul(se,tt)|0,I=I+Math.imul(se,Ft)|0;var yt=(A+E|0)+((w&8191)<<13)|0;A=(I+(w>>>13)|0)+(yt>>>26)|0,yt&=67108863,E=Math.imul(Oe,Ye),w=Math.imul(Oe,pt),w=w+Math.imul($e,Ye)|0,I=Math.imul($e,pt),E=E+Math.imul(Me,ft)|0,w=w+Math.imul(Me,Ht)|0,w=w+Math.imul(Ne,ft)|0,I=I+Math.imul(Ne,Ht)|0,E=E+Math.imul(De,St)|0,w=w+Math.imul(De,Xt)|0,w=w+Math.imul(Te,St)|0,I=I+Math.imul(Te,Xt)|0,E=E+Math.imul(fe,Dt)|0,w=w+Math.imul(fe,Bt)|0,w=w+Math.imul(be,Dt)|0,I=I+Math.imul(be,Bt)|0,E=E+Math.imul(ne,gt)|0,w=w+Math.imul(ne,Ot)|0,w=w+Math.imul(de,gt)|0,I=I+Math.imul(de,Ot)|0,E=E+Math.imul(te,bt)|0,w=w+Math.imul(te,jt)|0,w=w+Math.imul(N,bt)|0,I=I+Math.imul(N,jt)|0,E=E+Math.imul(ie,tt)|0,w=w+Math.imul(ie,Ft)|0,w=w+Math.imul(ee,tt)|0,I=I+Math.imul(ee,Ft)|0,E=E+Math.imul(z,G)|0,w=w+Math.imul(z,J)|0,w=w+Math.imul(se,G)|0,I=I+Math.imul(se,J)|0;var Rt=(A+E|0)+((w&8191)<<13)|0;A=(I+(w>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,E=Math.imul(_e,Ye),w=Math.imul(_e,pt),w=w+Math.imul(Qe,Ye)|0,I=Math.imul(Qe,pt),E=E+Math.imul(Oe,ft)|0,w=w+Math.imul(Oe,Ht)|0,w=w+Math.imul($e,ft)|0,I=I+Math.imul($e,Ht)|0,E=E+Math.imul(Me,St)|0,w=w+Math.imul(Me,Xt)|0,w=w+Math.imul(Ne,St)|0,I=I+Math.imul(Ne,Xt)|0,E=E+Math.imul(De,Dt)|0,w=w+Math.imul(De,Bt)|0,w=w+Math.imul(Te,Dt)|0,I=I+Math.imul(Te,Bt)|0,E=E+Math.imul(fe,gt)|0,w=w+Math.imul(fe,Ot)|0,w=w+Math.imul(be,gt)|0,I=I+Math.imul(be,Ot)|0,E=E+Math.imul(ne,bt)|0,w=w+Math.imul(ne,jt)|0,w=w+Math.imul(de,bt)|0,I=I+Math.imul(de,jt)|0,E=E+Math.imul(te,tt)|0,w=w+Math.imul(te,Ft)|0,w=w+Math.imul(N,tt)|0,I=I+Math.imul(N,Ft)|0,E=E+Math.imul(ie,G)|0,w=w+Math.imul(ie,J)|0,w=w+Math.imul(ee,G)|0,I=I+Math.imul(ee,J)|0,E=E+Math.imul(z,j)|0,w=w+Math.imul(z,oe)|0,w=w+Math.imul(se,j)|0,I=I+Math.imul(se,oe)|0;var Mt=(A+E|0)+((w&8191)<<13)|0;A=(I+(w>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,E=Math.imul(Be,Ye),w=Math.imul(Be,pt),w=w+Math.imul(nt,Ye)|0,I=Math.imul(nt,pt),E=E+Math.imul(_e,ft)|0,w=w+Math.imul(_e,Ht)|0,w=w+Math.imul(Qe,ft)|0,I=I+Math.imul(Qe,Ht)|0,E=E+Math.imul(Oe,St)|0,w=w+Math.imul(Oe,Xt)|0,w=w+Math.imul($e,St)|0,I=I+Math.imul($e,Xt)|0,E=E+Math.imul(Me,Dt)|0,w=w+Math.imul(Me,Bt)|0,w=w+Math.imul(Ne,Dt)|0,I=I+Math.imul(Ne,Bt)|0,E=E+Math.imul(De,gt)|0,w=w+Math.imul(De,Ot)|0,w=w+Math.imul(Te,gt)|0,I=I+Math.imul(Te,Ot)|0,E=E+Math.imul(fe,bt)|0,w=w+Math.imul(fe,jt)|0,w=w+Math.imul(be,bt)|0,I=I+Math.imul(be,jt)|0,E=E+Math.imul(ne,tt)|0,w=w+Math.imul(ne,Ft)|0,w=w+Math.imul(de,tt)|0,I=I+Math.imul(de,Ft)|0,E=E+Math.imul(te,G)|0,w=w+Math.imul(te,J)|0,w=w+Math.imul(N,G)|0,I=I+Math.imul(N,J)|0,E=E+Math.imul(ie,j)|0,w=w+Math.imul(ie,oe)|0,w=w+Math.imul(ee,j)|0,I=I+Math.imul(ee,oe)|0,E=E+Math.imul(z,me)|0,w=w+Math.imul(z,Ee)|0,w=w+Math.imul(se,me)|0,I=I+Math.imul(se,Ee)|0;var xt=(A+E|0)+((w&8191)<<13)|0;A=(I+(w>>>13)|0)+(xt>>>26)|0,xt&=67108863,E=Math.imul(Be,ft),w=Math.imul(Be,Ht),w=w+Math.imul(nt,ft)|0,I=Math.imul(nt,Ht),E=E+Math.imul(_e,St)|0,w=w+Math.imul(_e,Xt)|0,w=w+Math.imul(Qe,St)|0,I=I+Math.imul(Qe,Xt)|0,E=E+Math.imul(Oe,Dt)|0,w=w+Math.imul(Oe,Bt)|0,w=w+Math.imul($e,Dt)|0,I=I+Math.imul($e,Bt)|0,E=E+Math.imul(Me,gt)|0,w=w+Math.imul(Me,Ot)|0,w=w+Math.imul(Ne,gt)|0,I=I+Math.imul(Ne,Ot)|0,E=E+Math.imul(De,bt)|0,w=w+Math.imul(De,jt)|0,w=w+Math.imul(Te,bt)|0,I=I+Math.imul(Te,jt)|0,E=E+Math.imul(fe,tt)|0,w=w+Math.imul(fe,Ft)|0,w=w+Math.imul(be,tt)|0,I=I+Math.imul(be,Ft)|0,E=E+Math.imul(ne,G)|0,w=w+Math.imul(ne,J)|0,w=w+Math.imul(de,G)|0,I=I+Math.imul(de,J)|0,E=E+Math.imul(te,j)|0,w=w+Math.imul(te,oe)|0,w=w+Math.imul(N,j)|0,I=I+Math.imul(N,oe)|0,E=E+Math.imul(ie,me)|0,w=w+Math.imul(ie,Ee)|0,w=w+Math.imul(ee,me)|0,I=I+Math.imul(ee,Ee)|0;var Tt=(A+E|0)+((w&8191)<<13)|0;A=(I+(w>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,E=Math.imul(Be,St),w=Math.imul(Be,Xt),w=w+Math.imul(nt,St)|0,I=Math.imul(nt,Xt),E=E+Math.imul(_e,Dt)|0,w=w+Math.imul(_e,Bt)|0,w=w+Math.imul(Qe,Dt)|0,I=I+Math.imul(Qe,Bt)|0,E=E+Math.imul(Oe,gt)|0,w=w+Math.imul(Oe,Ot)|0,w=w+Math.imul($e,gt)|0,I=I+Math.imul($e,Ot)|0,E=E+Math.imul(Me,bt)|0,w=w+Math.imul(Me,jt)|0,w=w+Math.imul(Ne,bt)|0,I=I+Math.imul(Ne,jt)|0,E=E+Math.imul(De,tt)|0,w=w+Math.imul(De,Ft)|0,w=w+Math.imul(Te,tt)|0,I=I+Math.imul(Te,Ft)|0,E=E+Math.imul(fe,G)|0,w=w+Math.imul(fe,J)|0,w=w+Math.imul(be,G)|0,I=I+Math.imul(be,J)|0,E=E+Math.imul(ne,j)|0,w=w+Math.imul(ne,oe)|0,w=w+Math.imul(de,j)|0,I=I+Math.imul(de,oe)|0,E=E+Math.imul(te,me)|0,w=w+Math.imul(te,Ee)|0,w=w+Math.imul(N,me)|0,I=I+Math.imul(N,Ee)|0;var mt=(A+E|0)+((w&8191)<<13)|0;A=(I+(w>>>13)|0)+(mt>>>26)|0,mt&=67108863,E=Math.imul(Be,Dt),w=Math.imul(Be,Bt),w=w+Math.imul(nt,Dt)|0,I=Math.imul(nt,Bt),E=E+Math.imul(_e,gt)|0,w=w+Math.imul(_e,Ot)|0,w=w+Math.imul(Qe,gt)|0,I=I+Math.imul(Qe,Ot)|0,E=E+Math.imul(Oe,bt)|0,w=w+Math.imul(Oe,jt)|0,w=w+Math.imul($e,bt)|0,I=I+Math.imul($e,jt)|0,E=E+Math.imul(Me,tt)|0,w=w+Math.imul(Me,Ft)|0,w=w+Math.imul(Ne,tt)|0,I=I+Math.imul(Ne,Ft)|0,E=E+Math.imul(De,G)|0,w=w+Math.imul(De,J)|0,w=w+Math.imul(Te,G)|0,I=I+Math.imul(Te,J)|0,E=E+Math.imul(fe,j)|0,w=w+Math.imul(fe,oe)|0,w=w+Math.imul(be,j)|0,I=I+Math.imul(be,oe)|0,E=E+Math.imul(ne,me)|0,w=w+Math.imul(ne,Ee)|0,w=w+Math.imul(de,me)|0,I=I+Math.imul(de,Ee)|0;var Et=(A+E|0)+((w&8191)<<13)|0;A=(I+(w>>>13)|0)+(Et>>>26)|0,Et&=67108863,E=Math.imul(Be,gt),w=Math.imul(Be,Ot),w=w+Math.imul(nt,gt)|0,I=Math.imul(nt,Ot),E=E+Math.imul(_e,bt)|0,w=w+Math.imul(_e,jt)|0,w=w+Math.imul(Qe,bt)|0,I=I+Math.imul(Qe,jt)|0,E=E+Math.imul(Oe,tt)|0,w=w+Math.imul(Oe,Ft)|0,w=w+Math.imul($e,tt)|0,I=I+Math.imul($e,Ft)|0,E=E+Math.imul(Me,G)|0,w=w+Math.imul(Me,J)|0,w=w+Math.imul(Ne,G)|0,I=I+Math.imul(Ne,J)|0,E=E+Math.imul(De,j)|0,w=w+Math.imul(De,oe)|0,w=w+Math.imul(Te,j)|0,I=I+Math.imul(Te,oe)|0,E=E+Math.imul(fe,me)|0,w=w+Math.imul(fe,Ee)|0,w=w+Math.imul(be,me)|0,I=I+Math.imul(be,Ee)|0;var ct=(A+E|0)+((w&8191)<<13)|0;A=(I+(w>>>13)|0)+(ct>>>26)|0,ct&=67108863,E=Math.imul(Be,bt),w=Math.imul(Be,jt),w=w+Math.imul(nt,bt)|0,I=Math.imul(nt,jt),E=E+Math.imul(_e,tt)|0,w=w+Math.imul(_e,Ft)|0,w=w+Math.imul(Qe,tt)|0,I=I+Math.imul(Qe,Ft)|0,E=E+Math.imul(Oe,G)|0,w=w+Math.imul(Oe,J)|0,w=w+Math.imul($e,G)|0,I=I+Math.imul($e,J)|0,E=E+Math.imul(Me,j)|0,w=w+Math.imul(Me,oe)|0,w=w+Math.imul(Ne,j)|0,I=I+Math.imul(Ne,oe)|0,E=E+Math.imul(De,me)|0,w=w+Math.imul(De,Ee)|0,w=w+Math.imul(Te,me)|0,I=I+Math.imul(Te,Ee)|0;var wt=(A+E|0)+((w&8191)<<13)|0;A=(I+(w>>>13)|0)+(wt>>>26)|0,wt&=67108863,E=Math.imul(Be,tt),w=Math.imul(Be,Ft),w=w+Math.imul(nt,tt)|0,I=Math.imul(nt,Ft),E=E+Math.imul(_e,G)|0,w=w+Math.imul(_e,J)|0,w=w+Math.imul(Qe,G)|0,I=I+Math.imul(Qe,J)|0,E=E+Math.imul(Oe,j)|0,w=w+Math.imul(Oe,oe)|0,w=w+Math.imul($e,j)|0,I=I+Math.imul($e,oe)|0,E=E+Math.imul(Me,me)|0,w=w+Math.imul(Me,Ee)|0,w=w+Math.imul(Ne,me)|0,I=I+Math.imul(Ne,Ee)|0;var lt=(A+E|0)+((w&8191)<<13)|0;A=(I+(w>>>13)|0)+(lt>>>26)|0,lt&=67108863,E=Math.imul(Be,G),w=Math.imul(Be,J),w=w+Math.imul(nt,G)|0,I=Math.imul(nt,J),E=E+Math.imul(_e,j)|0,w=w+Math.imul(_e,oe)|0,w=w+Math.imul(Qe,j)|0,I=I+Math.imul(Qe,oe)|0,E=E+Math.imul(Oe,me)|0,w=w+Math.imul(Oe,Ee)|0,w=w+Math.imul($e,me)|0,I=I+Math.imul($e,Ee)|0;var st=(A+E|0)+((w&8191)<<13)|0;A=(I+(w>>>13)|0)+(st>>>26)|0,st&=67108863,E=Math.imul(Be,j),w=Math.imul(Be,oe),w=w+Math.imul(nt,j)|0,I=Math.imul(nt,oe),E=E+Math.imul(_e,me)|0,w=w+Math.imul(_e,Ee)|0,w=w+Math.imul(Qe,me)|0,I=I+Math.imul(Qe,Ee)|0;var Ae=(A+E|0)+((w&8191)<<13)|0;A=(I+(w>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,E=Math.imul(Be,me),w=Math.imul(Be,Ee),w=w+Math.imul(nt,me)|0,I=Math.imul(nt,Ee);var Ie=(A+E|0)+((w&8191)<<13)|0;return A=(I+(w>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,y[0]=ke,y[1]=Ce,y[2]=et,y[3]=Ze,y[4]=rt,y[5]=ot,y[6]=yt,y[7]=Rt,y[8]=Mt,y[9]=xt,y[10]=Tt,y[11]=mt,y[12]=Et,y[13]=ct,y[14]=wt,y[15]=lt,y[16]=st,y[17]=Ae,y[18]=Ie,A!==0&&(y[19]=A,l.length++),l};Math.imul||(C=S);function D(q,_,v){v.negative=_.negative^q.negative,v.length=q.length+_.length;for(var l=0,p=0,m=0;m>>26)|0,p+=y>>>26,y&=67108863}v.words[m]=A,l=y,y=p}return l!==0?v.words[m]=l:v.length--,v.strip()}function B(q,_,v){var l=new L;return l.mulp(q,_,v)}s.prototype.mulTo=function(_,v){var l,p=this.length+_.length;return this.length===10&&_.length===10?l=C(this,_,v):p<63?l=S(this,_,v):p<1024?l=D(this,_,v):l=B(this,_,v),l};function L(q,_){this.x=q,this.y=_}L.prototype.makeRBT=function(_){for(var v=new Array(_),l=s.prototype._countBits(_)-1,p=0;p<_;p++)v[p]=this.revBin(p,l,_);return v},L.prototype.revBin=function(_,v,l){if(_===0||_===l-1)return _;for(var p=0,m=0;m>=1;return p},L.prototype.permute=function(_,v,l,p,m,y){for(var A=0;A>>1)m++;return 1<>>13,l[2*y+1]=m&8191,m=m>>>13;for(y=2*v;y>=26,v+=p/67108864|0,v+=m>>>26,this.words[l]=m&67108863}return v!==0&&(this.words[l]=v,this.length++),this},s.prototype.muln=function(_){return this.clone().imuln(_)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(_){var v=x(_);if(v.length===0)return new s(1);for(var l=this,p=0;p=0);var v=_%26,l=(_-v)/26,p=67108863>>>26-v<<26-v,m;if(v!==0){var y=0;for(m=0;m>>26-v}y&&(this.words[m]=y,this.length++)}if(l!==0){for(m=this.length-1;m>=0;m--)this.words[m+l]=this.words[m];for(m=0;m=0);var p;v?p=(v-v%26)/26:p=0;var m=_%26,y=Math.min((_-m)/26,this.length),A=67108863^67108863>>>m<y)for(this.length-=y,w=0;w=0&&(I!==0||w>=p);w--){var M=this.words[w]|0;this.words[w]=I<<26-m|M>>>m,I=M&A}return E&&I!==0&&(E.words[E.length++]=I),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(_,v,l){return n(this.negative===0),this.iushrn(_,v,l)},s.prototype.shln=function(_){return this.clone().ishln(_)},s.prototype.ushln=function(_){return this.clone().iushln(_)},s.prototype.shrn=function(_){return this.clone().ishrn(_)},s.prototype.ushrn=function(_){return this.clone().iushrn(_)},s.prototype.testn=function(_){n(typeof _=="number"&&_>=0);var v=_%26,l=(_-v)/26,p=1<=0);var v=_%26,l=(_-v)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(v!==0&&l++,this.length=Math.min(l,this.length),v!==0){var p=67108863^67108863>>>v<=67108864;v++)this.words[v]-=67108864,v===this.length-1?this.words[v+1]=1:this.words[v+1]++;return this.length=Math.max(this.length,v+1),this},s.prototype.isubn=function(_){if(n(typeof _=="number"),n(_<67108864),_<0)return this.iaddn(-_);if(this.negative!==0)return this.negative=0,this.iaddn(_),this.negative=1,this;if(this.words[0]-=_,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var v=0;v>26)-(E/67108864|0),this.words[m+l]=y&67108863}for(;m>26,this.words[m+l]=y&67108863;if(A===0)return this.strip();for(n(A===-1),A=0,m=0;m>26,this.words[m]=y&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(_,v){var l=this.length-_.length,p=this.clone(),m=_,y=m.words[m.length-1]|0,A=this._countBits(y);l=26-A,l!==0&&(m=m.ushln(l),p.iushln(l),y=m.words[m.length-1]|0);var E=p.length-m.length,w;if(v!=="mod"){w=new s(null),w.length=E+1,w.words=new Array(w.length);for(var I=0;I=0;z--){var se=(p.words[m.length+z]|0)*67108864+(p.words[m.length+z-1]|0);for(se=Math.min(se/y|0,67108863),p._ishlnsubmul(m,se,z);p.negative!==0;)se--,p.negative=0,p._ishlnsubmul(m,1,z),p.isZero()||(p.negative^=1);w&&(w.words[z]=se)}return w&&w.strip(),p.strip(),v!=="div"&&l!==0&&p.iushrn(l),{div:w||null,mod:p}},s.prototype.divmod=function(_,v,l){if(n(!_.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var p,m,y;return this.negative!==0&&_.negative===0?(y=this.neg().divmod(_,v),v!=="mod"&&(p=y.div.neg()),v!=="div"&&(m=y.mod.neg(),l&&m.negative!==0&&m.iadd(_)),{div:p,mod:m}):this.negative===0&&_.negative!==0?(y=this.divmod(_.neg(),v),v!=="mod"&&(p=y.div.neg()),{div:p,mod:y.mod}):(this.negative&_.negative)!==0?(y=this.neg().divmod(_.neg(),v),v!=="div"&&(m=y.mod.neg(),l&&m.negative!==0&&m.isub(_)),{div:y.div,mod:m}):_.length>this.length||this.cmp(_)<0?{div:new s(0),mod:this}:_.length===1?v==="div"?{div:this.divn(_.words[0]),mod:null}:v==="mod"?{div:null,mod:new s(this.modn(_.words[0]))}:{div:this.divn(_.words[0]),mod:new s(this.modn(_.words[0]))}:this._wordDiv(_,v)},s.prototype.div=function(_){return this.divmod(_,"div",!1).div},s.prototype.mod=function(_){return this.divmod(_,"mod",!1).mod},s.prototype.umod=function(_){return this.divmod(_,"mod",!0).mod},s.prototype.divRound=function(_){var v=this.divmod(_);if(v.mod.isZero())return v.div;var l=v.div.negative!==0?v.mod.isub(_):v.mod,p=_.ushrn(1),m=_.andln(1),y=l.cmp(p);return y<0||m===1&&y===0?v.div:v.div.negative!==0?v.div.isubn(1):v.div.iaddn(1)},s.prototype.modn=function(_){n(_<=67108863);for(var v=(1<<26)%_,l=0,p=this.length-1;p>=0;p--)l=(v*l+(this.words[p]|0))%_;return l},s.prototype.idivn=function(_){n(_<=67108863);for(var v=0,l=this.length-1;l>=0;l--){var p=(this.words[l]|0)+v*67108864;this.words[l]=p/_|0,v=p%_}return this.strip()},s.prototype.divn=function(_){return this.clone().idivn(_)},s.prototype.egcd=function(_){n(_.negative===0),n(!_.isZero());var v=this,l=_.clone();v.negative!==0?v=v.umod(_):v=v.clone();for(var p=new s(1),m=new s(0),y=new s(0),A=new s(1),E=0;v.isEven()&&l.isEven();)v.iushrn(1),l.iushrn(1),++E;for(var w=l.clone(),I=v.clone();!v.isZero();){for(var M=0,z=1;(v.words[0]&z)===0&&M<26;++M,z<<=1);if(M>0)for(v.iushrn(M);M-- >0;)(p.isOdd()||m.isOdd())&&(p.iadd(w),m.isub(I)),p.iushrn(1),m.iushrn(1);for(var se=0,O=1;(l.words[0]&O)===0&&se<26;++se,O<<=1);if(se>0)for(l.iushrn(se);se-- >0;)(y.isOdd()||A.isOdd())&&(y.iadd(w),A.isub(I)),y.iushrn(1),A.iushrn(1);v.cmp(l)>=0?(v.isub(l),p.isub(y),m.isub(A)):(l.isub(v),y.isub(p),A.isub(m))}return{a:y,b:A,gcd:l.iushln(E)}},s.prototype._invmp=function(_){n(_.negative===0),n(!_.isZero());var v=this,l=_.clone();v.negative!==0?v=v.umod(_):v=v.clone();for(var p=new s(1),m=new s(0),y=l.clone();v.cmpn(1)>0&&l.cmpn(1)>0;){for(var A=0,E=1;(v.words[0]&E)===0&&A<26;++A,E<<=1);if(A>0)for(v.iushrn(A);A-- >0;)p.isOdd()&&p.iadd(y),p.iushrn(1);for(var w=0,I=1;(l.words[0]&I)===0&&w<26;++w,I<<=1);if(w>0)for(l.iushrn(w);w-- >0;)m.isOdd()&&m.iadd(y),m.iushrn(1);v.cmp(l)>=0?(v.isub(l),p.isub(m)):(l.isub(v),m.isub(p))}var M;return v.cmpn(1)===0?M=p:M=m,M.cmpn(0)<0&&M.iadd(_),M},s.prototype.gcd=function(_){if(this.isZero())return _.abs();if(_.isZero())return this.abs();var v=this.clone(),l=_.clone();v.negative=0,l.negative=0;for(var p=0;v.isEven()&&l.isEven();p++)v.iushrn(1),l.iushrn(1);do{for(;v.isEven();)v.iushrn(1);for(;l.isEven();)l.iushrn(1);var m=v.cmp(l);if(m<0){var y=v;v=l,l=y}else if(m===0||l.cmpn(1)===0)break;v.isub(l)}while(!0);return l.iushln(p)},s.prototype.invm=function(_){return this.egcd(_).a.umod(_)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(_){return this.words[0]&_},s.prototype.bincn=function(_){n(typeof _=="number");var v=_%26,l=(_-v)/26,p=1<>>26,A&=67108863,this.words[y]=A}return m!==0&&(this.words[y]=m,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(_){var v=_<0;if(this.negative!==0&&!v)return-1;if(this.negative===0&&v)return 1;this.strip();var l;if(this.length>1)l=1;else{v&&(_=-_),n(_<=67108863,"Number is too big");var p=this.words[0]|0;l=p===_?0:p<_?-1:1}return this.negative!==0?-l|0:l},s.prototype.cmp=function(_){if(this.negative!==0&&_.negative===0)return-1;if(this.negative===0&&_.negative!==0)return 1;var v=this.ucmp(_);return this.negative!==0?-v|0:v},s.prototype.ucmp=function(_){if(this.length>_.length)return 1;if(this.length<_.length)return-1;for(var v=0,l=this.length-1;l>=0;l--){var p=this.words[l]|0,m=_.words[l]|0;if(p!==m){pm&&(v=1);break}}return v},s.prototype.gtn=function(_){return this.cmpn(_)===1},s.prototype.gt=function(_){return this.cmp(_)===1},s.prototype.gten=function(_){return this.cmpn(_)>=0},s.prototype.gte=function(_){return this.cmp(_)>=0},s.prototype.ltn=function(_){return this.cmpn(_)===-1},s.prototype.lt=function(_){return this.cmp(_)===-1},s.prototype.lten=function(_){return this.cmpn(_)<=0},s.prototype.lte=function(_){return this.cmp(_)<=0},s.prototype.eqn=function(_){return this.cmpn(_)===0},s.prototype.eq=function(_){return this.cmp(_)===0},s.red=function(_){return new V(_)},s.prototype.toRed=function(_){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),_.convertTo(this)._forceRed(_)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(_){return this.red=_,this},s.prototype.forceRed=function(_){return n(!this.red,"Already a number in reduction context"),this._forceRed(_)},s.prototype.redAdd=function(_){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,_)},s.prototype.redIAdd=function(_){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,_)},s.prototype.redSub=function(_){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,_)},s.prototype.redISub=function(_){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,_)},s.prototype.redShl=function(_){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,_)},s.prototype.redMul=function(_){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,_),this.red.mul(this,_)},s.prototype.redIMul=function(_){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,_),this.red.imul(this,_)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(_){return n(this.red&&!_.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,_)};var H={k256:null,p224:null,p192:null,p25519:null};function F(q,_){this.name=q,this.p=new s(_,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}F.prototype._tmp=function(){var _=new s(null);return _.words=new Array(Math.ceil(this.n/13)),_},F.prototype.ireduce=function(_){var v=_,l;do this.split(v,this.tmp),v=this.imulK(v),v=v.iadd(this.tmp),l=v.bitLength();while(l>this.n);var p=l0?v.isub(this.p):v.strip!==void 0?v.strip():v._strip(),v},F.prototype.split=function(_,v){_.iushrn(this.n,0,v)},F.prototype.imulK=function(_){return _.imul(this.k)};function k(){F.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(k,F),k.prototype.split=function(_,v){for(var l=4194303,p=Math.min(_.length,9),m=0;m>>22,y=A}y>>>=22,_.words[m-10]=y,y===0&&_.length>10?_.length-=10:_.length-=9},k.prototype.imulK=function(_){_.words[_.length]=0,_.words[_.length+1]=0,_.length+=2;for(var v=0,l=0;l<_.length;l++){var p=_.words[l]|0;v+=p*977,_.words[l]=v&67108863,v=p*64+(v/67108864|0)}return _.words[_.length-1]===0&&(_.length--,_.words[_.length-1]===0&&_.length--),_};function $(){F.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i($,F);function R(){F.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(R,F);function W(){F.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(W,F),W.prototype.imulK=function(_){for(var v=0,l=0;l<_.length;l++){var p=(_.words[l]|0)*19+v,m=p&67108863;p>>>=26,_.words[l]=m,v=p}return v!==0&&(_.words[_.length++]=v),_},s._prime=function(_){if(H[_])return H[_];var v;if(_==="k256")v=new k;else if(_==="p224")v=new $;else if(_==="p192")v=new R;else if(_==="p25519")v=new W;else throw new Error("Unknown prime "+_);return H[_]=v,v};function V(q){if(typeof q=="string"){var _=s._prime(q);this.m=_.p,this.prime=_}else n(q.gtn(1),"modulus must be greater than 1"),this.m=q,this.prime=null}V.prototype._verify1=function(_){n(_.negative===0,"red works only with positives"),n(_.red,"red works only with red numbers")},V.prototype._verify2=function(_,v){n((_.negative|v.negative)===0,"red works only with positives"),n(_.red&&_.red===v.red,"red works only with red numbers")},V.prototype.imod=function(_){return this.prime?this.prime.ireduce(_)._forceRed(this):_.umod(this.m)._forceRed(this)},V.prototype.neg=function(_){return _.isZero()?_.clone():this.m.sub(_)._forceRed(this)},V.prototype.add=function(_,v){this._verify2(_,v);var l=_.add(v);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},V.prototype.iadd=function(_,v){this._verify2(_,v);var l=_.iadd(v);return l.cmp(this.m)>=0&&l.isub(this.m),l},V.prototype.sub=function(_,v){this._verify2(_,v);var l=_.sub(v);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},V.prototype.isub=function(_,v){this._verify2(_,v);var l=_.isub(v);return l.cmpn(0)<0&&l.iadd(this.m),l},V.prototype.shl=function(_,v){return this._verify1(_),this.imod(_.ushln(v))},V.prototype.imul=function(_,v){return this._verify2(_,v),this.imod(_.imul(v))},V.prototype.mul=function(_,v){return this._verify2(_,v),this.imod(_.mul(v))},V.prototype.isqr=function(_){return this.imul(_,_.clone())},V.prototype.sqr=function(_){return this.mul(_,_)},V.prototype.sqrt=function(_){if(_.isZero())return _.clone();var v=this.m.andln(3);if(n(v%2===1),v===3){var l=this.m.add(new s(1)).iushrn(2);return this.pow(_,l)}for(var p=this.m.subn(1),m=0;!p.isZero()&&p.andln(1)===0;)m++,p.iushrn(1);n(!p.isZero());var y=new s(1).toRed(this),A=y.redNeg(),E=this.m.subn(1).iushrn(1),w=this.m.bitLength();for(w=new s(2*w*w).toRed(this);this.pow(w,E).cmp(A)!==0;)w.redIAdd(A);for(var I=this.pow(w,p),M=this.pow(_,p.addn(1).iushrn(1)),z=this.pow(_,p),se=m;z.cmp(y)!==0;){for(var O=z,ie=0;O.cmp(y)!==0;ie++)O=O.redSqr();n(ie=0;m--){for(var I=v.words[m],M=w-1;M>=0;M--){var z=I>>M&1;if(y!==p[0]&&(y=this.sqr(y)),z===0&&A===0){E=0;continue}A<<=1,A|=z,E++,!(E!==l&&(m!==0||M!==0))&&(y=this.mul(y,p[A]),E=0,A=0)}w=26}return y},V.prototype.convertTo=function(_){var v=_.umod(this.m);return v===_?v.clone():v},V.prototype.convertFrom=function(_){var v=_.clone();return v.red=null,v},s.mont=function(_){return new X(_)};function X(q){V.call(this,q),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(X,V),X.prototype.convertTo=function(_){return this.imod(_.ushln(this.shift))},X.prototype.convertFrom=function(_){var v=this.imod(_.mul(this.rinv));return v.red=null,v},X.prototype.imul=function(_,v){if(_.isZero()||v.isZero())return _.words[0]=0,_.length=1,_;var l=_.imul(v),p=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=l.isub(p).iushrn(this.shift),y=m;return m.cmp(this.m)>=0?y=m.isub(this.m):m.cmpn(0)<0&&(y=m.iadd(this.m)),y._forceRed(this)},X.prototype.mul=function(_,v){if(_.isZero()||v.isZero())return new s(0)._forceRed(this);var l=_.mul(v),p=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=l.isub(p).iushrn(this.shift),y=m;return m.cmp(this.m)>=0?y=m.isub(this.m):m.cmpn(0)<0&&(y=m.iadd(this.m)),y._forceRed(this)},X.prototype.invm=function(_){var v=this.imod(_._invmp(this.m).mul(this.r2));return v._forceRed(this)}})(t,XO)})(Lh)),Lh.exports}var Gg={},Zx;function Qx(){return Zx||(Zx=1,(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var f=0;f>8,g=u&255;h?a.push(h,g):a.push(g)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(C>>1)-1?B=(C>>1)-L:B=L,D.isubn(B)):B=0,x[S]=B,D.iushrn(1)}return x}e.getNAF=s;function o(h,g){var b=[[],[]];h=h.clone(),g=g.clone();for(var x=0,S=0,C;h.cmpn(-x)>0||g.cmpn(-S)>0;){var D=h.andln(3)+x&3,B=g.andln(3)+S&3;D===3&&(D=-1),B===3&&(B=-1);var L;(D&1)===0?L=0:(C=h.andln(7)+x&7,(C===3||C===5)&&B===2?L=-D:L=D),b[0].push(L);var H;(B&1)===0?H=0:(C=g.andln(7)+S&7,(C===3||C===5)&&D===2?H=-B:H=B),b[1].push(H),2*x===L+1&&(x=1-x),2*S===H+1&&(S=1-S),h.iushrn(1),g.iushrn(1)}return b}e.getJSF=o;function a(h,g,b){var x="_"+g;h.prototype[g]=function(){return this[x]!==void 0?this[x]:this[x]=b.call(this)}}e.cachedProperty=a;function f(h){return typeof h=="string"?e.toArray(h,"hex"):h}e.parseBytes=f;function u(h){return new r(h,"hex","le")}e.intFromLE=u})(Vg)),Vg}var kh={exports:{}},t3;function r3(){if(t3)return kh.exports;t3=1;var t;kh.exports=function(i){return t||(t=new e(null)),t.generate(i)};function e(n){this.rand=n}if(kh.exports.Rand=e,e.prototype.generate=function(i){return this._rand(i)},e.prototype._rand=function(i){if(this.rand.getBytes)return this.rand.getBytes(i);for(var s=new Uint8Array(i),o=0;o0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}Jg=s,s.prototype.point=function(){throw new Error("Not implemented")},s.prototype.validate=function(){throw new Error("Not implemented")},s.prototype._fixedNafMul=function(f,u){i(f.precomputed);var h=f._getDoubles(),g=r(u,1,this._bitLength),b=(1<=S;D--)C=(C<<1)+g[D];x.push(C)}for(var B=this.jpoint(null,null,null),L=this.jpoint(null,null,null),H=b;H>0;H--){for(S=0;S=0;C--){for(var D=0;C>=0&&x[C]===0;C--)D++;if(C>=0&&D++,S=S.dblp(D),C<0)break;var B=x[C];i(B!==0),f.type==="affine"?B>0?S=S.mixedAdd(b[B-1>>1]):S=S.mixedAdd(b[-B-1>>1].neg()):B>0?S=S.add(b[B-1>>1]):S=S.add(b[-B-1>>1].neg())}return f.type==="affine"?S.toP():S},s.prototype._wnafMulAdd=function(f,u,h,g,b){var x=this._wnafT1,S=this._wnafT2,C=this._wnafT3,D=0,B,L,H;for(B=0;B=1;B-=2){var k=B-1,$=B;if(x[k]!==1||x[$]!==1){C[k]=r(h[k],x[k],this._bitLength),C[$]=r(h[$],x[$],this._bitLength),D=Math.max(C[k].length,D),D=Math.max(C[$].length,D);continue}var R=[u[k],null,null,u[$]];u[k].y.cmp(u[$].y)===0?(R[1]=u[k].add(u[$]),R[2]=u[k].toJ().mixedAdd(u[$].neg())):u[k].y.cmp(u[$].y.redNeg())===0?(R[1]=u[k].toJ().mixedAdd(u[$]),R[2]=u[k].add(u[$].neg())):(R[1]=u[k].toJ().mixedAdd(u[$]),R[2]=u[k].toJ().mixedAdd(u[$].neg()));var W=[-3,-1,-5,-7,0,7,5,1,3],V=n(h[k],h[$]);for(D=Math.max(V[0].length,D),C[k]=new Array(D),C[$]=new Array(D),L=0;L=0;B--){for(var l=0;B>=0;){var p=!0;for(L=0;L=0&&l++,_=_.dblp(l),B<0)break;for(L=0;L0?H=S[L][m-1>>1]:m<0&&(H=S[L][-m-1>>1].neg()),H.type==="affine"?_=_.mixedAdd(H):_=_.add(H))}}for(B=0;B=Math.ceil((f.bitLength()+1)/u.step):!1},o.prototype._getDoubles=function(f,u){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var h=[this],g=this,b=0;b=0&&(k=B,$=L),H.negative&&(H=H.neg(),F=F.neg()),k.negative&&(k=k.neg(),$=$.neg()),[{a:H,b:F},{a:k,b:$}]},s.prototype._endoSplit=function(u){var h=this.endo.basis,g=h[0],b=h[1],x=b.b.mul(u).divRound(this.n),S=g.b.neg().mul(u).divRound(this.n),C=x.mul(g.a),D=S.mul(b.a),B=x.mul(g.b),L=S.mul(b.b),H=u.sub(C).sub(D),F=B.add(L).neg();return{k1:H,k2:F}},s.prototype.pointFromX=function(u,h){u=new e(u,16),u.red||(u=u.toRed(this.red));var g=u.redSqr().redMul(u).redIAdd(u.redMul(this.a)).redIAdd(this.b),b=g.redSqrt();if(b.redSqr().redSub(g).cmp(this.zero)!==0)throw new Error("invalid point");var x=b.fromRed().isOdd();return(h&&!x||!h&&x)&&(b=b.redNeg()),this.point(u,b)},s.prototype.validate=function(u){if(u.inf)return!0;var h=u.x,g=u.y,b=this.a.redMul(h),x=h.redSqr().redMul(h).redIAdd(b).redIAdd(this.b);return g.redSqr().redISub(x).cmpn(0)===0},s.prototype._endoWnafMulAdd=function(u,h,g){for(var b=this._endoWnafT1,x=this._endoWnafT2,S=0;S":""},o.prototype.isInfinity=function(){return this.inf},o.prototype.add=function(u){if(this.inf)return u;if(u.inf)return this;if(this.eq(u))return this.dbl();if(this.neg().eq(u))return this.curve.point(null,null);if(this.x.cmp(u.x)===0)return this.curve.point(null,null);var h=this.y.redSub(u.y);h.cmpn(0)!==0&&(h=h.redMul(this.x.redSub(u.x).redInvm()));var g=h.redSqr().redISub(this.x).redISub(u.x),b=h.redMul(this.x.redSub(g)).redISub(this.y);return this.curve.point(g,b)},o.prototype.dbl=function(){if(this.inf)return this;var u=this.y.redAdd(this.y);if(u.cmpn(0)===0)return this.curve.point(null,null);var h=this.curve.a,g=this.x.redSqr(),b=u.redInvm(),x=g.redAdd(g).redIAdd(g).redIAdd(h).redMul(b),S=x.redSqr().redISub(this.x.redAdd(this.x)),C=x.redMul(this.x.redSub(S)).redISub(this.y);return this.curve.point(S,C)},o.prototype.getX=function(){return this.x.fromRed()},o.prototype.getY=function(){return this.y.fromRed()},o.prototype.mul=function(u){return u=new e(u,16),this.isInfinity()?this:this._hasDoubles(u)?this.curve._fixedNafMul(this,u):this.curve.endo?this.curve._endoWnafMulAdd([this],[u]):this.curve._wnafMul(this,u)},o.prototype.mulAdd=function(u,h,g){var b=[this,h],x=[u,g];return this.curve.endo?this.curve._endoWnafMulAdd(b,x):this.curve._wnafMulAdd(1,b,x,2)},o.prototype.jmulAdd=function(u,h,g){var b=[this,h],x=[u,g];return this.curve.endo?this.curve._endoWnafMulAdd(b,x,!0):this.curve._wnafMulAdd(1,b,x,2,!0)},o.prototype.eq=function(u){return this===u||this.inf===u.inf&&(this.inf||this.x.cmp(u.x)===0&&this.y.cmp(u.y)===0)},o.prototype.neg=function(u){if(this.inf)return this;var h=this.curve.point(this.x,this.y.redNeg());if(u&&this.precomputed){var g=this.precomputed,b=function(x){return x.neg()};h.precomputed={naf:g.naf&&{wnd:g.naf.wnd,points:g.naf.points.map(b)},doubles:g.doubles&&{step:g.doubles.step,points:g.doubles.points.map(b)}}}return h},o.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var u=this.curve.jpoint(this.x,this.y,this.curve.one);return u};function a(f,u,h,g){n.BasePoint.call(this,f,"jacobian"),u===null&&h===null&&g===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new e(0)):(this.x=new e(u,16),this.y=new e(h,16),this.z=new e(g,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}return r(a,n.BasePoint),s.prototype.jpoint=function(u,h,g){return new a(this,u,h,g)},a.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var u=this.z.redInvm(),h=u.redSqr(),g=this.x.redMul(h),b=this.y.redMul(h).redMul(u);return this.curve.point(g,b)},a.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},a.prototype.add=function(u){if(this.isInfinity())return u;if(u.isInfinity())return this;var h=u.z.redSqr(),g=this.z.redSqr(),b=this.x.redMul(h),x=u.x.redMul(g),S=this.y.redMul(h.redMul(u.z)),C=u.y.redMul(g.redMul(this.z)),D=b.redSub(x),B=S.redSub(C);if(D.cmpn(0)===0)return B.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var L=D.redSqr(),H=L.redMul(D),F=b.redMul(L),k=B.redSqr().redIAdd(H).redISub(F).redISub(F),$=B.redMul(F.redISub(k)).redISub(S.redMul(H)),R=this.z.redMul(u.z).redMul(D);return this.curve.jpoint(k,$,R)},a.prototype.mixedAdd=function(u){if(this.isInfinity())return u.toJ();if(u.isInfinity())return this;var h=this.z.redSqr(),g=this.x,b=u.x.redMul(h),x=this.y,S=u.y.redMul(h).redMul(this.z),C=g.redSub(b),D=x.redSub(S);if(C.cmpn(0)===0)return D.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var B=C.redSqr(),L=B.redMul(C),H=g.redMul(B),F=D.redSqr().redIAdd(L).redISub(H).redISub(H),k=D.redMul(H.redISub(F)).redISub(x.redMul(L)),$=this.z.redMul(C);return this.curve.jpoint(F,k,$)},a.prototype.dblp=function(u){if(u===0)return this;if(this.isInfinity())return this;if(!u)return this.dbl();var h;if(this.curve.zeroA||this.curve.threeA){var g=this;for(h=0;h=0)return!1;if(g.redIAdd(x),this.x.cmp(g)===0)return!0}},a.prototype.inspect=function(){return this.isInfinity()?"":""},a.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Xg}var Zg,s3;function QO(){if(s3)return Zg;s3=1;var t=Ks(),e=Sh(),r=Bh(),n=ki();function i(o){r.call(this,"mont",o),this.a=new t(o.a,16).toRed(this.red),this.b=new t(o.b,16).toRed(this.red),this.i4=new t(4).toRed(this.red).redInvm(),this.two=new t(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}e(i,r),Zg=i,i.prototype.validate=function(a){var f=a.normalize().x,u=f.redSqr(),h=u.redMul(f).redAdd(u.redMul(this.a)).redAdd(f),g=h.redSqrt();return g.redSqr().cmp(h)===0};function s(o,a,f){r.BasePoint.call(this,o,"projective"),a===null&&f===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new t(a,16),this.z=new t(f,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}return e(s,r.BasePoint),i.prototype.decodePoint=function(a,f){return this.point(n.toArray(a,f),1)},i.prototype.point=function(a,f){return new s(this,a,f)},i.prototype.pointFromJSON=function(a){return s.fromJSON(this,a)},s.prototype.precompute=function(){},s.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},s.fromJSON=function(a,f){return new s(a,f[0],f[1]||a.one)},s.prototype.inspect=function(){return this.isInfinity()?"":""},s.prototype.isInfinity=function(){return this.z.cmpn(0)===0},s.prototype.dbl=function(){var a=this.x.redAdd(this.z),f=a.redSqr(),u=this.x.redSub(this.z),h=u.redSqr(),g=f.redSub(h),b=f.redMul(h),x=g.redMul(h.redAdd(this.curve.a24.redMul(g)));return this.curve.point(b,x)},s.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},s.prototype.diffAdd=function(a,f){var u=this.x.redAdd(this.z),h=this.x.redSub(this.z),g=a.x.redAdd(a.z),b=a.x.redSub(a.z),x=b.redMul(u),S=g.redMul(h),C=f.z.redMul(x.redAdd(S).redSqr()),D=f.x.redMul(x.redISub(S).redSqr());return this.curve.point(C,D)},s.prototype.mul=function(a){for(var f=a.clone(),u=this,h=this.curve.point(null,null),g=this,b=[];f.cmpn(0)!==0;f.iushrn(1))b.push(f.andln(1));for(var x=b.length-1;x>=0;x--)b[x]===0?(u=u.diffAdd(h,g),h=h.dbl()):(h=u.diffAdd(h,g),u=u.dbl());return h},s.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},s.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},s.prototype.eq=function(a){return this.getX().cmp(a.getX())===0},s.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},s.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Zg}var Qg,o3;function eN(){if(o3)return Qg;o3=1;var t=ki(),e=Ks(),r=Sh(),n=Bh(),i=t.assert;function s(a){this.twisted=(a.a|0)!==1,this.mOneA=this.twisted&&(a.a|0)===-1,this.extended=this.mOneA,n.call(this,"edwards",a),this.a=new e(a.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new e(a.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new e(a.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),i(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(a.c|0)===1}r(s,n),Qg=s,s.prototype._mulA=function(f){return this.mOneA?f.redNeg():this.a.redMul(f)},s.prototype._mulC=function(f){return this.oneC?f:this.c.redMul(f)},s.prototype.jpoint=function(f,u,h,g){return this.point(f,u,h,g)},s.prototype.pointFromX=function(f,u){f=new e(f,16),f.red||(f=f.toRed(this.red));var h=f.redSqr(),g=this.c2.redSub(this.a.redMul(h)),b=this.one.redSub(this.c2.redMul(this.d).redMul(h)),x=g.redMul(b.redInvm()),S=x.redSqrt();if(S.redSqr().redSub(x).cmp(this.zero)!==0)throw new Error("invalid point");var C=S.fromRed().isOdd();return(u&&!C||!u&&C)&&(S=S.redNeg()),this.point(f,S)},s.prototype.pointFromY=function(f,u){f=new e(f,16),f.red||(f=f.toRed(this.red));var h=f.redSqr(),g=h.redSub(this.c2),b=h.redMul(this.d).redMul(this.c2).redSub(this.a),x=g.redMul(b.redInvm());if(x.cmp(this.zero)===0){if(u)throw new Error("invalid point");return this.point(this.zero,f)}var S=x.redSqrt();if(S.redSqr().redSub(x).cmp(this.zero)!==0)throw new Error("invalid point");return S.fromRed().isOdd()!==u&&(S=S.redNeg()),this.point(S,f)},s.prototype.validate=function(f){if(f.isInfinity())return!0;f.normalize();var u=f.x.redSqr(),h=f.y.redSqr(),g=u.redMul(this.a).redAdd(h),b=this.c2.redMul(this.one.redAdd(this.d.redMul(u).redMul(h)));return g.cmp(b)===0};function o(a,f,u,h,g){n.BasePoint.call(this,a,"projective"),f===null&&u===null&&h===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new e(f,16),this.y=new e(u,16),this.z=h?new e(h,16):this.curve.one,this.t=g&&new e(g,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}return r(o,n.BasePoint),s.prototype.pointFromJSON=function(f){return o.fromJSON(this,f)},s.prototype.point=function(f,u,h,g){return new o(this,f,u,h,g)},o.fromJSON=function(f,u){return new o(f,u[0],u[1],u[2])},o.prototype.inspect=function(){return this.isInfinity()?"":""},o.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},o.prototype._extDbl=function(){var f=this.x.redSqr(),u=this.y.redSqr(),h=this.z.redSqr();h=h.redIAdd(h);var g=this.curve._mulA(f),b=this.x.redAdd(this.y).redSqr().redISub(f).redISub(u),x=g.redAdd(u),S=x.redSub(h),C=g.redSub(u),D=b.redMul(S),B=x.redMul(C),L=b.redMul(C),H=S.redMul(x);return this.curve.point(D,B,H,L)},o.prototype._projDbl=function(){var f=this.x.redAdd(this.y).redSqr(),u=this.x.redSqr(),h=this.y.redSqr(),g,b,x,S,C,D;if(this.curve.twisted){S=this.curve._mulA(u);var B=S.redAdd(h);this.zOne?(g=f.redSub(u).redSub(h).redMul(B.redSub(this.curve.two)),b=B.redMul(S.redSub(h)),x=B.redSqr().redSub(B).redSub(B)):(C=this.z.redSqr(),D=B.redSub(C).redISub(C),g=f.redSub(u).redISub(h).redMul(D),b=B.redMul(S.redSub(h)),x=B.redMul(D))}else S=u.redAdd(h),C=this.curve._mulC(this.z).redSqr(),D=S.redSub(C).redSub(C),g=this.curve._mulC(f.redISub(S)).redMul(D),b=this.curve._mulC(S).redMul(u.redISub(h)),x=S.redMul(D);return this.curve.point(g,b,x)},o.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},o.prototype._extAdd=function(f){var u=this.y.redSub(this.x).redMul(f.y.redSub(f.x)),h=this.y.redAdd(this.x).redMul(f.y.redAdd(f.x)),g=this.t.redMul(this.curve.dd).redMul(f.t),b=this.z.redMul(f.z.redAdd(f.z)),x=h.redSub(u),S=b.redSub(g),C=b.redAdd(g),D=h.redAdd(u),B=x.redMul(S),L=C.redMul(D),H=x.redMul(D),F=S.redMul(C);return this.curve.point(B,L,F,H)},o.prototype._projAdd=function(f){var u=this.z.redMul(f.z),h=u.redSqr(),g=this.x.redMul(f.x),b=this.y.redMul(f.y),x=this.curve.d.redMul(g).redMul(b),S=h.redSub(x),C=h.redAdd(x),D=this.x.redAdd(this.y).redMul(f.x.redAdd(f.y)).redISub(g).redISub(b),B=u.redMul(S).redMul(D),L,H;return this.curve.twisted?(L=u.redMul(C).redMul(b.redSub(this.curve._mulA(g))),H=S.redMul(C)):(L=u.redMul(C).redMul(b.redSub(g)),H=this.curve._mulC(S).redMul(C)),this.curve.point(B,L,H)},o.prototype.add=function(f){return this.isInfinity()?f:f.isInfinity()?this:this.curve.extended?this._extAdd(f):this._projAdd(f)},o.prototype.mul=function(f){return this._hasDoubles(f)?this.curve._fixedNafMul(this,f):this.curve._wnafMul(this,f)},o.prototype.mulAdd=function(f,u,h){return this.curve._wnafMulAdd(1,[this,u],[f,h],2,!1)},o.prototype.jmulAdd=function(f,u,h){return this.curve._wnafMulAdd(1,[this,u],[f,h],2,!0)},o.prototype.normalize=function(){if(this.zOne)return this;var f=this.z.redInvm();return this.x=this.x.redMul(f),this.y=this.y.redMul(f),this.t&&(this.t=this.t.redMul(f)),this.z=this.curve.one,this.zOne=!0,this},o.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},o.prototype.getX=function(){return this.normalize(),this.x.fromRed()},o.prototype.getY=function(){return this.normalize(),this.y.fromRed()},o.prototype.eq=function(f){return this===f||this.getX().cmp(f.getX())===0&&this.getY().cmp(f.getY())===0},o.prototype.eqXToP=function(f){var u=f.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(u)===0)return!0;for(var h=f.clone(),g=this.curve.redN.redMul(this.z);;){if(h.iadd(this.curve.n),h.cmp(this.curve.p)>=0)return!1;if(u.redIAdd(g),this.x.cmp(u)===0)return!0}},o.prototype.toP=o.prototype.normalize,o.prototype.mixedAdd=o.prototype.add,Qg}var a3;function c3(){return a3||(a3=1,(function(t){var e=t;e.base=Bh(),e.short=ZO(),e.mont=QO(),e.edwards=eN()})(Yg)),Yg}var em={},tm,u3;function tN(){return u3||(u3=1,tm={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),tm}var f3;function rm(){return f3||(f3=1,(function(t){var e=t,r=Ah(),n=c3(),i=ki(),s=i.assert;function o(u){u.type==="short"?this.curve=new n.short(u):u.type==="edwards"?this.curve=new n.edwards(u):this.curve=new n.mont(u),this.g=this.curve.g,this.n=this.curve.n,this.hash=u.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(u,h){Object.defineProperty(e,u,{configurable:!0,enumerable:!0,get:function(){var g=new o(h);return Object.defineProperty(e,u,{configurable:!0,enumerable:!0,value:g}),g}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var f;try{f=tN()}catch{f=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",f]})})(em)),em}var nm,l3;function rN(){if(l3)return nm;l3=1;var t=Ah(),e=Qx(),r=ba();function n(i){if(!(this instanceof n))return new n(i);this.hash=i.hash,this.predResist=!!i.predResist,this.outLen=this.hash.outSize,this.minEntropy=i.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var s=e.toArray(i.entropy,i.entropyEnc||"hex"),o=e.toArray(i.nonce,i.nonceEnc||"hex"),a=e.toArray(i.pers,i.persEnc||"hex");r(s.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(s,o,a)}return nm=n,n.prototype._init=function(s,o,a){var f=s.concat(o).concat(a);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var u=0;u=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(s.concat(a||[])),this._reseed=1},n.prototype.generate=function(s,o,a,f){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof o!="string"&&(f=a,a=o,o=null),a&&(a=e.toArray(a,f||"hex"),this._update(a));for(var u=[];u.length"},im}var sm,d3;function iN(){if(d3)return sm;d3=1;var t=Ks(),e=ki(),r=e.assert;function n(f,u){if(f instanceof n)return f;this._importDER(f,u)||(r(f.r&&f.s,"Signature without r or s"),this.r=new t(f.r,16),this.s=new t(f.s,16),f.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=f.recoveryParam)}sm=n;function i(){this.place=0}function s(f,u){var h=f[u.place++];if(!(h&128))return h;var g=h&15;if(g===0||g>4||f[u.place]===0)return!1;for(var b=0,x=0,S=u.place;x>>=0;return b<=127?!1:(u.place=S,b)}function o(f){for(var u=0,h=f.length-1;!f[u]&&!(f[u+1]&128)&&u>>3);for(f.push(h|128);--h;)f.push(u>>>(h<<3)&255);f.push(u)}return n.prototype.toDER=function(u){var h=this.r.toArray(),g=this.s.toArray();for(h[0]&128&&(h=[0].concat(h)),g[0]&128&&(g=[0].concat(g)),h=o(h),g=o(g);!g[0]&&!(g[1]&128);)g=g.slice(1);var b=[2];a(b,h.length),b=b.concat(h),b.push(2),a(b,g.length);var x=b.concat(g),S=[48];return a(S,x.length),S=S.concat(x),e.encode(S,u)},sm}var om,p3;function sN(){if(p3)return om;p3=1;var t=Ks(),e=rN(),r=ki(),n=rm(),i=r3(),s=r.assert,o=nN(),a=iN();function f(u){if(!(this instanceof f))return new f(u);typeof u=="string"&&(s(Object.prototype.hasOwnProperty.call(n,u),"Unknown curve "+u),u=n[u]),u instanceof n.PresetCurve&&(u={curve:u}),this.curve=u.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=u.curve.g,this.g.precompute(u.curve.n.bitLength()+1),this.hash=u.hash||u.curve.hash}return om=f,f.prototype.keyPair=function(h){return new o(this,h)},f.prototype.keyFromPrivate=function(h,g){return o.fromPrivate(this,h,g)},f.prototype.keyFromPublic=function(h,g){return o.fromPublic(this,h,g)},f.prototype.genKeyPair=function(h){h||(h={});for(var g=new e({hash:this.hash,pers:h.pers,persEnc:h.persEnc||"utf8",entropy:h.entropy||i(this.hash.hmacStrength),entropyEnc:h.entropy&&h.entropyEnc||"utf8",nonce:this.n.toArray()}),b=this.n.byteLength(),x=this.n.sub(new t(2));;){var S=new t(g.generate(b));if(!(S.cmp(x)>0))return S.iaddn(1),this.keyFromPrivate(S)}},f.prototype._truncateToN=function(h,g,b){var x;if(t.isBN(h)||typeof h=="number")h=new t(h,16),x=h.byteLength();else if(typeof h=="object")x=h.length,h=new t(h,16);else{var S=h.toString();x=S.length+1>>>1,h=new t(S,16)}typeof b!="number"&&(b=x*8);var C=b-this.n.bitLength();return C>0&&(h=h.ushrn(C)),!g&&h.cmp(this.n)>=0?h.sub(this.n):h},f.prototype.sign=function(h,g,b,x){typeof b=="object"&&(x=b,b=null),x||(x={}),g=this.keyFromPrivate(g,b),h=this._truncateToN(h,!1,x.msgBitLength);for(var S=this.n.byteLength(),C=g.getPrivate().toArray("be",S),D=h.toArray("be",S),B=new e({hash:this.hash,entropy:C,nonce:D,pers:x.pers,persEnc:x.persEnc||"utf8"}),L=this.n.sub(new t(1)),H=0;;H++){var F=x.k?x.k(H):new t(B.generate(this.n.byteLength()));if(F=this._truncateToN(F,!0),!(F.cmpn(1)<=0||F.cmp(L)>=0)){var k=this.g.mul(F);if(!k.isInfinity()){var $=k.getX(),R=$.umod(this.n);if(R.cmpn(0)!==0){var W=F.invm(this.n).mul(R.mul(g.getPrivate()).iadd(h));if(W=W.umod(this.n),W.cmpn(0)!==0){var V=(k.getY().isOdd()?1:0)|($.cmp(R)!==0?2:0);return x.canonical&&W.cmp(this.nh)>0&&(W=this.n.sub(W),V^=1),new a({r:R,s:W,recoveryParam:V})}}}}}},f.prototype.verify=function(h,g,b,x,S){S||(S={}),h=this._truncateToN(h,!1,S.msgBitLength),b=this.keyFromPublic(b,x),g=new a(g,"hex");var C=g.r,D=g.s;if(C.cmpn(1)<0||C.cmp(this.n)>=0||D.cmpn(1)<0||D.cmp(this.n)>=0)return!1;var B=D.invm(this.n),L=B.mul(h).umod(this.n),H=B.mul(C).umod(this.n),F;return this.curve._maxwellTrick?(F=this.g.jmulAdd(L,b.getPublic(),H),F.isInfinity()?!1:F.eqXToP(C)):(F=this.g.mulAdd(L,b.getPublic(),H),F.isInfinity()?!1:F.getX().umod(this.n).cmp(C)===0)},f.prototype.recoverPubKey=function(u,h,g,b){s((3&g)===g,"The recovery param is more than two bits"),h=new a(h,b);var x=this.n,S=new t(u),C=h.r,D=h.s,B=g&1,L=g>>1;if(C.cmp(this.curve.p.umod(this.curve.n))>=0&&L)throw new Error("Unable to find sencond key candinate");L?C=this.curve.pointFromX(C.add(this.curve.n),B):C=this.curve.pointFromX(C,B);var H=h.r.invm(x),F=x.sub(S).mul(H).umod(x),k=D.mul(H).umod(x);return this.g.mulAdd(F,C,k)},f.prototype.getKeyRecoveryParam=function(u,h,g,b){if(h=new a(h,b),h.recoveryParam!==null)return h.recoveryParam;for(var x=0;x<4;x++){var S;try{S=this.recoverPubKey(u,h,x)}catch{continue}if(S.eq(g))return x}throw new Error("Unable to find valid recovery factor")},om}var am,g3;function oN(){if(g3)return am;g3=1;var t=ki(),e=t.assert,r=t.parseBytes,n=t.cachedProperty;function i(s,o){this.eddsa=s,this._secret=r(o.secret),s.isPoint(o.pub)?this._pub=o.pub:this._pubBytes=r(o.pub)}return i.fromPublic=function(o,a){return a instanceof i?a:new i(o,{pub:a})},i.fromSecret=function(o,a){return a instanceof i?a:new i(o,{secret:a})},i.prototype.secret=function(){return this._secret},n(i,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),n(i,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),n(i,"privBytes",function(){var o=this.eddsa,a=this.hash(),f=o.encodingLength-1,u=a.slice(0,o.encodingLength);return u[0]&=248,u[f]&=127,u[f]|=64,u}),n(i,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),n(i,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),n(i,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),i.prototype.sign=function(o){return e(this._secret,"KeyPair can only verify"),this.eddsa.sign(o,this)},i.prototype.verify=function(o,a){return this.eddsa.verify(o,a,this)},i.prototype.getSecret=function(o){return e(this._secret,"KeyPair is public only"),t.encode(this.secret(),o)},i.prototype.getPublic=function(o){return t.encode(this.pubBytes(),o)},am=i,am}var cm,m3;function aN(){if(m3)return cm;m3=1;var t=Ks(),e=ki(),r=e.assert,n=e.cachedProperty,i=e.parseBytes;function s(o,a){this.eddsa=o,typeof a!="object"&&(a=i(a)),Array.isArray(a)&&(r(a.length===o.encodingLength*2,"Signature has invalid size"),a={R:a.slice(0,o.encodingLength),S:a.slice(o.encodingLength)}),r(a.R&&a.S,"Signature without R or S"),o.isPoint(a.R)&&(this._R=a.R),a.S instanceof t&&(this._S=a.S),this._Rencoded=Array.isArray(a.R)?a.R:a.Rencoded,this._Sencoded=Array.isArray(a.S)?a.S:a.Sencoded}return n(s,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),n(s,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),n(s,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),n(s,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),s.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},s.prototype.toHex=function(){return e.encode(this.toBytes(),"hex").toUpperCase()},cm=s,cm}var um,v3;function cN(){if(v3)return um;v3=1;var t=Ah(),e=rm(),r=ki(),n=r.assert,i=r.parseBytes,s=oN(),o=aN();function a(f){if(n(f==="ed25519","only tested with ed25519 so far"),!(this instanceof a))return new a(f);f=e[f].curve,this.curve=f,this.g=f.g,this.g.precompute(f.n.bitLength()+1),this.pointClass=f.point().constructor,this.encodingLength=Math.ceil(f.n.bitLength()/8),this.hash=t.sha512}return um=a,a.prototype.sign=function(u,h){u=i(u);var g=this.keyFromSecret(h),b=this.hashInt(g.messagePrefix(),u),x=this.g.mul(b),S=this.encodePoint(x),C=this.hashInt(S,g.pubBytes(),u).mul(g.priv()),D=b.add(C).umod(this.curve.n);return this.makeSignature({R:x,S:D,Rencoded:S})},a.prototype.verify=function(u,h,g){if(u=i(u),h=this.makeSignature(h),h.S().gte(h.eddsa.curve.n)||h.S().isNeg())return!1;var b=this.keyFromPublic(g),x=this.hashInt(h.Rencoded(),b.pubBytes(),u),S=this.g.mul(h.S()),C=h.R().add(b.pub().mul(x));return C.eq(S)},a.prototype.hashInt=function(){for(var u=this.hash(),h=0;he in t?dN(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_3=(t,e)=>{for(var r in e||(e={}))pN.call(e,r)&&x3(t,r,e[r]);if(w3)for(var r of w3(e))gN.call(e,r)&&x3(t,r,e[r]);return t};const mN="ReactNative",bi={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},vN="js";function Fh(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Sc(){return!va.getDocument()&&!!va.getNavigator()&&navigator.product===mN}function uf(){return!Fh()&&!!va.getNavigator()&&!!va.getDocument()}function ff(){return Sc()?bi.reactNative:Fh()?bi.node:uf()?bi.browser:bi.unknown}function bN(){var t;try{return Sc()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function yN(t,e){let r=yh.parse(t);return r=_3(_3({},r),e),t=yh.stringify(r),t}function E3(){return HD.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function wN(){if(ff()===bi.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=BD();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function xN(){var t;const e=ff();return e===bi.browser?[e,((t=va.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function S3(t,e,r){const n=wN(),i=xN();return[[t,e].join("-"),[vN,r].join("-"),n,i].join("/")}function _N({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const f=r.split("?"),u=S3(t,e,n),h={auth:i,ua:u,projectId:s,useOnCloseEvent:o,origin:a||void 0},g=yN(f[1]||"",h);return f[0]+"?"+g}function _a(t,e){return t.filter(r=>e.includes(r)).length===t.length}function A3(t){return Object.fromEntries(t.entries())}function P3(t){return new Map(Object.entries(t))}function Ea(t=vt.FIVE_MINUTES,e){const r=vt.toMiliseconds(t||vt.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Ac(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function I3(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function EN(t){return I3("topic",t)}function SN(t){return I3("id",t)}function M3(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function wn(t,e){return vt.fromMiliseconds(Date.now()+vt.toMiliseconds(t))}function To(t){return Date.now()>=vt.toMiliseconds(t)}function yr(t,e){return`${t}${e?`:${e}`:""}`}function jh(t=[],e=[]){return[...new Set([...t,...e])]}async function AN({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i?.href;if(typeof s!="string")return;const o=PN(s,t,e),a=ff();if(a===bi.browser){if(!((n=va.getDocument())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,MN()?"_blank":"_self","noreferrer noopener")}else a===bi.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function PN(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${CN(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function IN(t,e){let r="";try{if(uf()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function C3(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function R3(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function fm(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function MN(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function CN(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function T3(t){return Buffer.from(t,"base64").toString("utf-8")}const RN="https://rpc.walletconnect.org/v1";async function TN(t,e,r,n,i,s){switch(r.t){case"eip191":return DN(t,e,r.s);case"eip1271":return await ON(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function DN(t,e,r){return UO(px(e),r).toLowerCase()===t.toLowerCase()}async function ON(t,e,r,n,i,s){const o=Ec(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",f="0000000000000000000000000000000000000000000000000000000000000040",u="0000000000000000000000000000000000000000000000000000000000000041",h=r.substring(2),g=px(e).substring(2),b=a+g+f+u+h,x=await fetch(`${s||RN}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:NN(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:b},"latest"]})}),{result:S}=await x.json();return S?S.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function NN(){return Date.now()+Math.floor(Math.random()*1e3)}var LN=Object.defineProperty,kN=Object.defineProperties,BN=Object.getOwnPropertyDescriptors,D3=Object.getOwnPropertySymbols,FN=Object.prototype.hasOwnProperty,jN=Object.prototype.propertyIsEnumerable,O3=(t,e,r)=>e in t?LN(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,UN=(t,e)=>{for(var r in e||(e={}))FN.call(e,r)&&O3(t,r,e[r]);if(D3)for(var r of D3(e))jN.call(e,r)&&O3(t,r,e[r]);return t},$N=(t,e)=>kN(t,BN(e));const qN="did:pkh:",lm=t=>t?.split(":"),zN=t=>{const e=t&&lm(t);if(e)return t.includes(qN)?e[3]:e[1]},hm=t=>{const e=t&&lm(t);if(e)return e[2]+":"+e[3]},Uh=t=>{const e=t&&lm(t);if(e)return e.pop()};async function N3(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=L3(i,i.iss),o=Uh(i.iss);return await TN(o,s,n,hm(i.iss),r)}const L3=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=Uh(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${zN(e)}`,f=`Nonce: ${t.nonce}`,u=`Issued At: ${t.iat}`,h=t.exp?`Expiration Time: ${t.exp}`:void 0,g=t.nbf?`Not Before: ${t.nbf}`:void 0,b=t.requestId?`Request ID: ${t.requestId}`:void 0,x=t.resources?`Resources:${t.resources.map(C=>` +- ${C}`).join("")}`:void 0,S=$h(t.resources);if(S){const C=lf(S);i=ZN(i,C)}return[r,n,"",i,"",s,o,a,f,u,h,g,b,x].filter(C=>C!=null).join(` +`)};function HN(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function WN(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function Sa(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function KN(t,e,r,n={}){return r?.sort((i,s)=>i.localeCompare(s)),{att:{[t]:VN(e,r,n)}}}function VN(t,e,r={}){e=e?.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function k3(t){return Sa(t),`urn:recap:${HN(t).replace(/=/g,"")}`}function lf(t){const e=WN(t.replace("urn:recap:",""));return Sa(e),e}function GN(t,e,r){const n=KN(t,e,r);return k3(n)}function YN(t){return t&&t.includes("urn:recap:")}function JN(t,e){const r=lf(t),n=lf(e),i=XN(r,n);return k3(i)}function XN(t,e){Sa(t),Sa(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,f)=>a.localeCompare(f)).forEach(a=>{var f,u;n.att[i]=$N(UN({},n.att[i]),{[a]:((f=t.att[i])==null?void 0:f[a])||((u=e.att[i])==null?void 0:u[a])})})}),n}function ZN(t="",e){Sa(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const f=Object.keys(e.att[a]).map(g=>({ability:g.split("/")[0],action:g.split("/")[1]}));f.sort((g,b)=>g.action.localeCompare(b.action));const u={};f.forEach(g=>{u[g.ability]||(u[g.ability]=[]),u[g.ability].push(g.action)});const h=Object.keys(u).map(g=>(i++,`(${i}) '${g}': '${u[g].join("', '")}' for '${a}'.`));n.push(h.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function B3(t){var e;const r=lf(t);Sa(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function F3(t){const e=lf(t);Sa(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i?.[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function $h(t){if(!t)return;const e=t?.[t.length-1];return YN(e)?e:void 0}const j3="base10",Gn="base16",Do="base64pad",hf="base64url",df="utf8",U3=0,Vs=1,pf=2,QN=0,$3=1,gf=12,dm=32;function eL(){const t=Jx.generateKeyPair();return{privateKey:An(t.secretKey,Gn),publicKey:An(t.publicKey,Gn)}}function pm(){const t=tf.randomBytes(dm);return An(t,Gn)}function tL(t,e){const r=Jx.sharedKey(Pn(t,Gn),Pn(e,Gn),!0),n=new VO.HKDF(Nh.SHA256,r).expand(dm);return An(n,Gn)}function qh(t){const e=Nh.hash(Pn(t,Gn));return An(e,Gn)}function Gs(t){const e=Nh.hash(Pn(t,df));return An(e,Gn)}function q3(t){return Pn(`${t}`,j3)}function Aa(t){return Number(An(t,j3))}function rL(t){const e=q3(typeof t.type<"u"?t.type:U3);if(Aa(e)===Vs&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Pn(t.senderPublicKey,Gn):void 0,n=typeof t.iv<"u"?Pn(t.iv,Gn):tf.randomBytes(gf),i=new Hx.ChaCha20Poly1305(Pn(t.symKey,Gn)).seal(n,Pn(t.message,df));return z3({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function nL(t,e){const r=q3(pf),n=tf.randomBytes(gf),i=Pn(t,df);return z3({type:r,sealed:i,iv:n,encoding:e})}function iL(t){const e=new Hx.ChaCha20Poly1305(Pn(t.symKey,Gn)),{sealed:r,iv:n}=mf({encoded:t.encoded,encoding:t?.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return An(i,df)}function sL(t,e){const{sealed:r}=mf({encoded:t,encoding:e});return An(r,df)}function z3(t){const{encoding:e=Do}=t;if(Aa(t.type)===pf)return An(mh([t.type,t.sealed]),e);if(Aa(t.type)===Vs){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return An(mh([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return An(mh([t.type,t.iv,t.sealed]),e)}function mf(t){const{encoded:e,encoding:r=Do}=t,n=Pn(e,r),i=n.slice(QN,$3),s=$3;if(Aa(i)===Vs){const u=s+dm,h=u+gf,g=n.slice(s,u),b=n.slice(u,h),x=n.slice(h);return{type:i,sealed:x,iv:b,senderPublicKey:g}}if(Aa(i)===pf){const u=n.slice(s),h=tf.randomBytes(gf);return{type:i,sealed:u,iv:h}}const o=s+gf,a=n.slice(s,o),f=n.slice(o);return{type:i,sealed:f,iv:a}}function oL(t,e){const r=mf({encoded:t,encoding:e?.encoding});return H3({type:Aa(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?An(r.senderPublicKey,Gn):void 0,receiverPublicKey:e?.receiverPublicKey})}function H3(t){const e=t?.type||U3;if(e===Vs){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function W3(t){return t.type===Vs&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function K3(t){return t.type===pf}function aL(t){return new fN.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function cL(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function uL(t){return Buffer.from(cL(t),"base64")}function fL(t,e){const[r,n,i]=t.split("."),s=uL(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),f=`${r}.${n}`,u=new Nh.SHA256().update(Buffer.from(f)).digest(),h=aL(e),g=Buffer.from(u).toString("hex");if(!h.verify(g,{r:o,s:a}))throw new Error("Invalid signature");return ug(t).payload}const lL="irn";function gm(t){return t?.relay||{protocol:lL}}function vf(t){const e=lN[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var hL=Object.defineProperty,dL=Object.defineProperties,pL=Object.getOwnPropertyDescriptors,V3=Object.getOwnPropertySymbols,gL=Object.prototype.hasOwnProperty,mL=Object.prototype.propertyIsEnumerable,G3=(t,e,r)=>e in t?hL(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Y3=(t,e)=>{for(var r in e||(e={}))gL.call(e,r)&&G3(t,r,e[r]);if(V3)for(var r of V3(e))mL.call(e,r)&&G3(t,r,e[r]);return t},vL=(t,e)=>dL(t,pL(e));function bL(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function J3(t){if(!t.includes("wc:")){const f=T3(t);f!=null&&f.includes("wc:")&&(t=f)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=yh.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:yL(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:bL(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function yL(t){return t.startsWith("//")?t.substring(2):t}function wL(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function X3(t){return`${t.protocol}:${t.topic}@${t.version}?`+yh.stringify(Y3(vL(Y3({symKey:t.symKey},wL(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function zh(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Pc(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function xL(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Pc(r.accounts))}),e}function _L(t,e){const r=[];return Object.values(t).forEach(n=>{Pc(n.accounts).includes(e)&&r.push(...n.methods)}),r}function EL(t,e){const r=[];return Object.values(t).forEach(n=>{Pc(n.accounts).includes(e)&&r.push(...n.events)}),r}function mm(t){return t.includes(":")}function bf(t){return mm(t)?t.split(":")[0]:t}function SL(t){const e={};return t?.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function Z3(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=SL(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=jh(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const AL={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},PL={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ut(t,e){const{message:r,code:n}=PL[t];return{message:e?`${r} ${e}`:r,code:n}}function Dr(t,e){const{message:r,code:n}=AL[t];return{message:e?`${r} ${e}`:r,code:n}}function Pa(t,e){return!!Array.isArray(t)}function yf(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Yn(t){return typeof t>"u"}function nn(t,e){return e&&Yn(t)?!0:typeof t=="string"&&!!t.trim().length}function vm(t,e){return e&&Yn(t)?!0:typeof t=="number"&&!isNaN(t)}function IL(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return _a(i,n)?(n.forEach(o=>{const{accounts:a,methods:f,events:u}=t.namespaces[o],h=Pc(a),g=r[o];(!_a(y3(o,g),h)||!_a(g.methods,f)||!_a(g.events,u))&&(s=!1)}),s):!1}function Hh(t){return nn(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function ML(t){if(nn(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Hh(r)}}return!1}function CL(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(nn(t,!1)){if(e(t))return!0;const r=T3(t);return e(r)}}catch{}return!1}function RL(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function TL(t){return t?.topic}function DL(t,e){let r=null;return nn(t?.publicKey,!1)||(r=ut("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function Q3(t){let e=!0;return Pa(t)?t.length&&(e=t.every(r=>nn(r,!1))):e=!1,e}function OL(t,e,r){let n=null;return Pa(e)&&e.length?e.forEach(i=>{n||Hh(i)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Hh(t)||(n=Dr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function NL(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=OL(i,y3(i,s),`${e} ${r}`);o&&(n=o)}),n}function LL(t,e){let r=null;return Pa(t)?t.forEach(n=>{r||ML(n)||(r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Dr("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function kL(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=LL(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function BL(t,e){let r=null;return Q3(t?.methods)?Q3(t?.events)||(r=Dr("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Dr("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function e_(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=BL(n,`${e}, namespace`);i&&(r=i)}),r}function FL(t,e,r){let n=null;if(t&&yf(t)){const i=e_(t,e);i&&(n=i);const s=NL(t,e,r);s&&(n=s)}else n=ut("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function bm(t,e){let r=null;if(t&&yf(t)){const n=e_(t,e);n&&(r=n);const i=kL(t,e);i&&(r=i)}else r=ut("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function t_(t){return nn(t.protocol,!0)}function jL(t,e){let r=!1;return t?t&&Pa(t)&&t.length&&t.forEach(n=>{r=t_(n)}):r=!0,r}function UL(t){return typeof t=="number"}function ai(t){return typeof t<"u"&&typeof t!==null}function $L(t){return!(!t||typeof t!="object"||!t.code||!vm(t.code,!1)||!t.message||!nn(t.message,!1))}function qL(t){return!(Yn(t)||!nn(t.method,!1))}function zL(t){return!(Yn(t)||Yn(t.result)&&Yn(t.error)||!vm(t.id,!1)||!nn(t.jsonrpc,!1))}function HL(t){return!(Yn(t)||!nn(t.name,!1))}function r_(t,e){return!(!Hh(e)||!xL(t).includes(e))}function WL(t,e,r){return nn(r,!1)?_L(t,e).includes(r):!1}function KL(t,e,r){return nn(r,!1)?EL(t,e).includes(r):!1}function n_(t,e,r){let n=null;const i=VL(t),s=GL(e),o=Object.keys(i),a=Object.keys(s),f=i_(Object.keys(t)),u=i_(Object.keys(e)),h=f.filter(g=>!u.includes(g));return h.length&&(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. + Required: ${h.toString()} + Received: ${Object.keys(e).toString()}`)),_a(o,a)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} - Approved: ${a.toString()}`)),Object.keys(e).forEach(p=>{if(!p.includes(":")||n)return;const y=Mu(e[p].accounts);y.includes(p)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${p} - Required: ${p} - Approved: ${y.toString()}`))}),o.forEach(p=>{n||(ac(i[p].methods,s[p].methods)?ac(i[p].events,s[p].events)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${p}`)):n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${p}`))}),n}function _F(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function r6(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function EF(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Mu(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function SF(t,e){return w1(t)&&t<=e.max&&t>=e.min}function n6(){const t=bl();return new Promise(e=>{switch(t){case Ri.browser:e(AF());break;case Ri.reactNative:e(PF());break;case Ri.node:e(MF());break;default:e(!0)}})}function AF(){return vl()&&(navigator==null?void 0:navigator.onLine)}async function PF(){if(Au()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function MF(){return!0}function IF(t){switch(bl()){case Ri.browser:CF(t);break;case Ri.reactNative:TF(t);break}}function CF(t){!Au()&&vl()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function TF(t){Au()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const _1={};class Il{static get(e){return _1[e]}static set(e,r){_1[e]=r}static delete(e){delete _1[e]}}const RF="PARSE_ERROR",DF="INVALID_REQUEST",OF="METHOD_NOT_FOUND",NF="INVALID_PARAMS",i6="INTERNAL_ERROR",E1="SERVER_ERROR",LF=[-32700,-32600,-32601,-32602,-32603],Cl={[RF]:{code:-32700,message:"Parse error"},[DF]:{code:-32600,message:"Invalid Request"},[OF]:{code:-32601,message:"Method not found"},[NF]:{code:-32602,message:"Invalid params"},[i6]:{code:-32603,message:"Internal error"},[E1]:{code:-32e3,message:"Server error"}},s6=E1;function kF(t){return LF.includes(t)}function o6(t){return Object.keys(Cl).includes(t)?Cl[t]:Cl[s6]}function BF(t){const e=Object.values(Cl).find(r=>r.code===t);return e||Cl[s6]}function a6(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var c6={},Po={},u6;function $F(){if(u6)return Po;u6=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.isBrowserCryptoAvailable=Po.getSubtleCrypto=Po.getBrowerCrypto=void 0;function t(){return(nn==null?void 0:nn.crypto)||(nn==null?void 0:nn.msCrypto)||{}}Po.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Po.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Po.isBrowserCryptoAvailable=r,Po}var Mo={},f6;function FF(){if(f6)return Mo;f6=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.isBrowser=Mo.isNode=Mo.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Mo.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Mo.isNode=e;function r(){return!t()&&!e()}return Mo.isBrowser=r,Mo}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Jf;e.__exportStar($F(),t),e.__exportStar(FF(),t)})(c6);function ma(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function hc(t=6){return BigInt(ma(t))}function va(t,e,r){return{id:r||ma(),jsonrpc:"2.0",method:t,params:e}}function s0(t,e){return{id:t,jsonrpc:"2.0",result:e}}function o0(t,e,r){return{id:t,jsonrpc:"2.0",error:jF(e)}}function jF(t,e){return typeof t>"u"?o6(i6):(typeof t=="string"&&(t=Object.assign(Object.assign({},o6(E1)),{message:t})),kF(t.code)&&(t=BF(t.code)),t)}let UF=class{},qF=class extends UF{constructor(){super()}},zF=class extends qF{constructor(e){super()}};const HF="^https?:",WF="^wss?:";function KF(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function l6(t,e){const r=KF(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function h6(t){return l6(t,HF)}function d6(t){return l6(t,WF)}function VF(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function p6(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function S1(t){return p6(t)&&"method"in t}function a0(t){return p6(t)&&(Gs(t)||Xi(t))}function Gs(t){return"result"in t}function Xi(t){return"error"in t}let Zi=class extends zF{constructor(e){super(e),this.events=new Hi.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(va(e.method,e.params||[],e.id||hc().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Xi(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),a0(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const GF=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),YF=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",g6=t=>t.split("?")[0],m6=10,JF=GF();let XF=class{constructor(e){if(this.url=e,this.events=new Hi.EventEmitter,this.registering=!1,!d6(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(mo(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!d6(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=c6.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!VF(e)},o=new JF(e,[],s);YF()?o.onerror=a=>{const u=a;n(this.emitError(u.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Qa(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=o0(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return a6(e,g6(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>m6&&this.events.setMaxListeners(m6)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${g6(this.url)}`));return this.events.emit("register_error",r),r}};var c0={exports:{}};c0.exports,function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",u="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",p="[object Date]",y="[object Error]",_="[object Function]",M="[object GeneratorFunction]",O="[object Map]",L="[object Number]",B="[object Null]",k="[object Object]",H="[object Promise]",U="[object Proxy]",z="[object RegExp]",Z="[object Set]",R="[object String]",W="[object Symbol]",ie="[object Undefined]",me="[object WeakMap]",j="[object ArrayBuffer]",E="[object DataView]",m="[object Float32Array]",f="[object Float64Array]",g="[object Int8Array]",v="[object Int16Array]",x="[object Int32Array]",S="[object Uint8Array]",A="[object Uint8ClampedArray]",b="[object Uint16Array]",P="[object Uint32Array]",I=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,ce=/^(?:0|[1-9]\d*)$/,D={};D[m]=D[f]=D[g]=D[v]=D[x]=D[S]=D[A]=D[b]=D[P]=!0,D[a]=D[u]=D[j]=D[d]=D[E]=D[p]=D[y]=D[_]=D[O]=D[L]=D[k]=D[z]=D[Z]=D[R]=D[me]=!1;var se=typeof nn=="object"&&nn&&nn.Object===Object&&nn,ee=typeof self=="object"&&self&&self.Object===Object&&self,J=se||ee||Function("return this")(),Q=e&&!e.nodeType&&e,T=Q&&!0&&t&&!t.nodeType&&t,X=T&&T.exports===Q,re=X&&se.process,ge=function(){try{return re&&re.binding&&re.binding("util")}catch{}}(),oe=ge&&ge.isTypedArray;function fe(ue,we){for(var Ye=-1,It=ue==null?0:ue.length,jr=0,ir=[];++Ye-1}function st(ue,we){var Ye=this.__data__,It=Xe(Ye,ue);return It<0?(++this.size,Ye.push([ue,we])):Ye[It][1]=we,this}Re.prototype.clear=De,Re.prototype.delete=it,Re.prototype.get=Ue,Re.prototype.has=mt,Re.prototype.set=st;function tt(ue){var we=-1,Ye=ue==null?0:ue.length;for(this.clear();++wewn))return!1;var Ur=ir.get(ue);if(Ur&&ir.get(we))return Ur==we;var pn=-1,xi=!0,xn=Ye&s?new _t:void 0;for(ir.set(ue,we),ir.set(we,ue);++pn-1&&ue%1==0&&ue-1&&ue%1==0&&ue<=o}function xp(ue){var we=typeof ue;return ue!=null&&(we=="object"||we=="function")}function Oc(ue){return ue!=null&&typeof ue=="object"}var _p=oe?Te(oe):pr;function Xb(ue){return Yb(ue)?qe(ue):gr(ue)}function Fr(){return[]}function kr(){return!1}t.exports=Jb}(c0,c0.exports);var ZF=c0.exports;const QF=ji(ZF),v6="wc",b6=2,y6="core",Ys=`${v6}@2:${y6}:`,ej={logger:"error"},tj={database:":memory:"},rj="crypto",w6="client_ed25519_seed",nj=vt.ONE_DAY,ij="keychain",sj="0.3",oj="messages",aj="0.3",cj=vt.SIX_HOURS,uj="publisher",x6="irn",fj="error",_6="wss://relay.walletconnect.org",lj="relayer",ni={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},hj="_subscription",Qi={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},dj=.1,A1="2.17.2",Wr={link_mode:"link_mode",relay:"relay"},pj="0.3",gj="WALLETCONNECT_CLIENT_ID",E6="WALLETCONNECT_LINK_MODE_APPS",Js={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},mj="subscription",vj="0.3",bj=vt.FIVE_SECONDS*1e3,yj="pairing",wj="0.3",Tl={wc_pairingDelete:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:vt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:vt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:0},res:{ttl:vt.ONE_DAY,prompt:!1,tag:0}}},dc={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},xs={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},xj="history",_j="0.3",Ej="expirer",es={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},Sj="0.3",Aj="verify-api",Pj="https://verify.walletconnect.com",S6="https://verify.walletconnect.org",Rl=S6,Mj=`${Rl}/v3`,Ij=[Pj,S6],Cj="echo",Tj="https://echo.walletconnect.com",Xs={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},Io={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},_s={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},pc={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},gc={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Dl={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},Rj=.1,Dj="event-client",Oj=86400,Nj="https://pulse.walletconnect.org/batch";function Lj(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,U=new Uint8Array(H);B!==k;){for(var z=M[B],Z=0,R=H-1;(z!==0||Z>>0,U[R]=z%a>>>0,z=z/a>>>0;if(z!==0)throw new Error("Non-zero carry");L=Z,B++}for(var W=H-L;W!==H&&U[W]===0;)W++;for(var ie=u.repeat(O);W>>0,H=new Uint8Array(k);M[O];){var U=r[M.charCodeAt(O)];if(U===255)return;for(var z=0,Z=k-1;(U!==0||z>>0,H[Z]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");B=z,O++}if(M[O]!==" "){for(var R=k-B;R!==k&&H[R]===0;)R++;for(var W=new Uint8Array(L+(k-R)),ie=L;R!==k;)W[ie++]=H[R++];return W}}}function _(M){var O=y(M);if(O)return O;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:_}}var kj=Lj,Bj=kj;const A6=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},$j=t=>new TextEncoder().encode(t),Fj=t=>new TextDecoder().decode(t);class jj{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Uj{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return P6(this,e)}}class qj{constructor(e){this.decoders=e}or(e){return P6(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const P6=(t,e)=>new qj({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class zj{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new jj(e,r,n),this.decoder=new Uj(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const u0=({name:t,prefix:e,encode:r,decode:n})=>new zj(t,e,r,n),Ol=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=Bj(r,e);return u0({prefix:t,name:e,encode:n,decode:s=>A6(i(s))})},Hj=(t,e,r,n)=>{const i={};for(let d=0;d=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},Wj=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<u0({prefix:e,name:t,encode(i){return Wj(i,n,r)},decode(i){return Hj(i,n,r,t)}}),Kj=u0({prefix:"\0",name:"identity",encode:t=>Fj(t),decode:t=>$j(t)});var Vj=Object.freeze({__proto__:null,identity:Kj});const Gj=jn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Yj=Object.freeze({__proto__:null,base2:Gj});const Jj=jn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Xj=Object.freeze({__proto__:null,base8:Jj});const Zj=Ol({prefix:"9",name:"base10",alphabet:"0123456789"});var Qj=Object.freeze({__proto__:null,base10:Zj});const eU=jn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),tU=jn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var rU=Object.freeze({__proto__:null,base16:eU,base16upper:tU});const nU=jn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),iU=jn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),sU=jn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),oU=jn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),aU=jn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),cU=jn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),uU=jn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),fU=jn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),lU=jn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var hU=Object.freeze({__proto__:null,base32:nU,base32upper:iU,base32pad:sU,base32padupper:oU,base32hex:aU,base32hexupper:cU,base32hexpad:uU,base32hexpadupper:fU,base32z:lU});const dU=Ol({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),pU=Ol({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var gU=Object.freeze({__proto__:null,base36:dU,base36upper:pU});const mU=Ol({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),vU=Ol({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var bU=Object.freeze({__proto__:null,base58btc:mU,base58flickr:vU});const yU=jn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),wU=jn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),xU=jn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),_U=jn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var EU=Object.freeze({__proto__:null,base64:yU,base64pad:wU,base64url:xU,base64urlpad:_U});const M6=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),SU=M6.reduce((t,e,r)=>(t[r]=e,t),[]),AU=M6.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function PU(t){return t.reduce((e,r)=>(e+=SU[r],e),"")}function MU(t){const e=[];for(const r of t){const n=AU[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const IU=u0({prefix:"🚀",name:"base256emoji",encode:PU,decode:MU});var CU=Object.freeze({__proto__:null,base256emoji:IU}),TU=C6,I6=128,RU=127,DU=~RU,OU=Math.pow(2,31);function C6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=OU;)e[r++]=t&255|I6,t/=128;for(;t&DU;)e[r++]=t&255|I6,t>>>=7;return e[r]=t|0,C6.bytes=r-n+1,e}var NU=P1,LU=128,T6=127;function P1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw P1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&T6)<=LU);return P1.bytes=s-n,r}var kU=Math.pow(2,7),BU=Math.pow(2,14),$U=Math.pow(2,21),FU=Math.pow(2,28),jU=Math.pow(2,35),UU=Math.pow(2,42),qU=Math.pow(2,49),zU=Math.pow(2,56),HU=Math.pow(2,63),WU=function(t){return t(R6.encode(t,e,r),e),O6=t=>R6.encodingLength(t),M1=(t,e)=>{const r=e.byteLength,n=O6(t),i=n+O6(r),s=new Uint8Array(i+r);return D6(t,s,0),D6(r,s,n),s.set(e,i),new VU(t,r,e,s)};class VU{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const N6=({name:t,code:e,encode:r})=>new GU(t,e,r);class GU{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?M1(this.code,r):r.then(n=>M1(this.code,n))}else throw Error("Unknown type, must be binary type")}}const L6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),YU=N6({name:"sha2-256",code:18,encode:L6("SHA-256")}),JU=N6({name:"sha2-512",code:19,encode:L6("SHA-512")});var XU=Object.freeze({__proto__:null,sha256:YU,sha512:JU});const k6=0,ZU="identity",B6=A6;var QU=Object.freeze({__proto__:null,identity:{code:k6,name:ZU,encode:B6,digest:t=>M1(k6,B6(t))}});new TextEncoder,new TextDecoder;const $6={...Vj,...Yj,...Xj,...Qj,...rU,...hU,...gU,...bU,...EU,...CU};({...XU,...QU});function eq(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function F6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const j6=F6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),I1=F6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=eq(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=ut("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=ti(r,this.name)}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,E_(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?S_(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}},iq=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=rj,this.randomSessionIdentifier=v1(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=Jx(i);return Yx(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=C$();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=Jx(s),a=this.randomSessionIdentifier;return await hN(a,i,nj,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),u=T$(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||r0(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=q_(o),u=mo(s);if(H_(a))return D$(u,o==null?void 0:o.encoding);if(z_(a)){const y=a.senderPublicKey,_=a.receiverPublicKey;i=await this.generateSharedKey(y,_)}const l=this.getSymKey(i),{type:d,senderPublicKey:p}=a;return R$({type:d,symKey:l,message:u,senderPublicKey:p,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=L$(s,o);if(H_(a)){const u=N$(s,o==null?void 0:o.encoding);return Qa(u)}if(z_(a)){const u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{const u=this.getSymKey(i),l=O$({symKey:u,encoded:s,encoding:o==null?void 0:o.encoding});return Qa(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=(i,s=ga)=>{const o=Sl({encoded:i,encoding:s});return fc(o.type)},this.getPayloadSenderPublicKey=(i,s=ga)=>{const o=Sl({encoded:i,encoding:s});return o.senderPublicKey?In(o.senderPublicKey,ri):void 0},this.core=e,this.logger=ti(r,this.name),this.keychain=n||new nq(this.core,this.logger)}get context(){return pi(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(w6)}catch{e=v1(),await this.keychain.set(w6,e)}return rq(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}};class sq extends wD{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=oj,this.version=aj,this.initialized=!1,this.storagePrefix=Ys,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Ao(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Ao(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=ti(e,this.name),this.core=r}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,E_(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?S_(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class oq extends xD{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new Hi.EventEmitter,this.name=uj,this.queue=new Map,this.publishTimeout=vt.toMiliseconds(vt.ONE_MINUTE),this.failedPublishTimeout=vt.toMiliseconds(vt.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||cj,u=b1(s),l=(s==null?void 0:s.prompt)||!1,d=(s==null?void 0:s.tag)||0,p=(s==null?void 0:s.id)||hc().toString(),y={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:d,id:p,attestation:s==null?void 0:s.attestation}},_=`Failed to publish payload, please try again. id:${p} tag:${d}`,M=Date.now();let O,L=1;try{for(;O===void 0;){if(Date.now()-M>this.publishTimeout)throw new Error(_);this.logger.trace({id:p,attempts:L},`publisher.publish - attempt ${L}`),O=await await Pu(this.rpcPublish(n,i,a,u,l,d,p,s==null?void 0:s.attestation).catch(B=>this.logger.warn(B)),this.publishTimeout,_),L++,O||await new Promise(B=>setTimeout(B,this.failedPublishTimeout))}this.relayer.events.emit(ni.publish,y),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:p,topic:n,message:i,opts:s}})}catch(B){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(B),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw B;this.queue.set(p,y)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=ti(r,this.name),this.registerEventListeners()}get context(){return pi(this.logger)}rpcPublish(e,r,n,i,s,o,a,u){var l,d,p,y;const _={method:Al(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:u},id:a};return vi((l=_.params)==null?void 0:l.prompt)&&((d=_.params)==null||delete d.prompt),vi((p=_.params)==null?void 0:p.tag)&&((y=_.params)==null||delete y.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:_}),this.relayer.request(_)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(su.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ni.connection_stalled);return}this.checkQueue()}),this.relayer.on(ni.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class aq{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var cq=Object.defineProperty,uq=Object.defineProperties,fq=Object.getOwnPropertyDescriptors,U6=Object.getOwnPropertySymbols,lq=Object.prototype.hasOwnProperty,hq=Object.prototype.propertyIsEnumerable,q6=(t,e,r)=>e in t?cq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Nl=(t,e)=>{for(var r in e||(e={}))lq.call(e,r)&&q6(t,r,e[r]);if(U6)for(var r of U6(e))hq.call(e,r)&&q6(t,r,e[r]);return t},C1=(t,e)=>uq(t,fq(e));class dq extends SD{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new aq,this.events=new Hi.EventEmitter,this.name=mj,this.version=vj,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Ys,this.subscribeTimeout=vt.toMiliseconds(vt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=b1(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new vt.Watch;a.start(i);const u=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(u),a.stop(i),s(!0)),a.elapsed(i)>=bj&&(clearInterval(u),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ti(r,this.name),this.clientId=""}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=b1(n);await this.rpcUnsubscribe(e,r,i);const s=Dr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===Wr.relay&&await this.restartToComplete();const s={method:Al(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=Ao(e+this.clientId);if((n==null?void 0:n.transportType)===Wr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},vt.toMiliseconds(vt.ONE_SECOND)),a;const u=await Pu(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return u?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ni.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:Al(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Pu(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(ni.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:Al(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Pu(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(ni.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:Al(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,C1(Nl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Nl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Nl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Js.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Js.deleted,C1(Nl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Js.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);lc(r)&&this.onBatchSubscribe(r.map((n,i)=>C1(Nl({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(su.pulse,async()=>{await this.checkPending()}),this.events.on(Js.created,async e=>{const r=Js.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Js.deleted,async e=>{const r=Js.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var pq=Object.defineProperty,z6=Object.getOwnPropertySymbols,gq=Object.prototype.hasOwnProperty,mq=Object.prototype.propertyIsEnumerable,H6=(t,e,r)=>e in t?pq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,W6=(t,e)=>{for(var r in e||(e={}))gq.call(e,r)&&H6(t,r,e[r]);if(z6)for(var r of z6(e))mq.call(e,r)&&H6(t,r,e[r]);return t};class vq extends _D{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Hi.EventEmitter,this.name=lj,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=vt.toMiliseconds(vt.THIRTY_SECONDS+vt.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||hc().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(u,l)=>{const d=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Qi.disconnect,d);const p=await o;this.provider.off(Qi.disconnect,d),u(p)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(Zd())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(ni.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(ni.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Qi.payload,this.onPayloadHandler),this.provider.on(Qi.connect,this.onConnectHandler),this.provider.on(Qi.disconnect,this.onDisconnectHandler),this.provider.on(Qi.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ti(e.logger,this.name):rl(bd({level:e.logger||fj})),this.messages=new sq(this.logger,e.core),this.subscriber=new dq(this,this.logger),this.publisher=new oq(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||_6,this.projectId=e.projectId,this.bundleId=VB(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return pi(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Wr.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",u;const l=d=>{d.topic===e&&(this.subscriber.off(Js.created,l),u())};return await Promise.all([new Promise(d=>{u=d,this.subscriber.on(Js.created,l)}),new Promise(async(d,p)=>{a=await this.subscriber.subscribe(e,W6({internal:{throwOnFailedPublish:o}},r)).catch(y=>{o&&p(y)})||a,d()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Pu(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Qi.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Qi.disconnect,i),await Pu(this.provider.connect(),vt.toMiliseconds(vt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await n6())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=_n(vt.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(ni.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(Zd())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Zi(new XF(XB({sdkVersion:A1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),S1(e)){if(!e.method.endsWith(hj))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:Wr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(W6({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else a0(e)&&this.events.emit(ni.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(ni.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=s0(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Qi.payload,this.onPayloadHandler),this.provider.off(Qi.connect,this.onConnectHandler),this.provider.off(Qi.disconnect,this.onDisconnectHandler),this.provider.off(Qi.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await n6();IF(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(ni.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},vt.toMiliseconds(dj))))}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var bq=Object.defineProperty,K6=Object.getOwnPropertySymbols,yq=Object.prototype.hasOwnProperty,wq=Object.prototype.propertyIsEnumerable,V6=(t,e,r)=>e in t?bq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,G6=(t,e)=>{for(var r in e||(e={}))yq.call(e,r)&&V6(t,r,e[r]);if(K6)for(var r of K6(e))wq.call(e,r)&&V6(t,r,e[r]);return t};class mc extends ED{constructor(e,r,n,i=Ys,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=pj,this.cached=[],this.initialized=!1,this.storagePrefix=Ys,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!vi(o)?this.map.set(this.getKey(o),o):sF(o)?this.map.set(o.id,o):oF(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>QF(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const u=G6(G6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=ti(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class xq{constructor(e,r){this.core=e,this.logger=r,this.name=yj,this.version=wj,this.events=new im,this.initialized=!1,this.storagePrefix=Ys,this.ignoredPayloadTypes=[So],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=v1(),s=await this.core.crypto.setSymKey(i),o=_n(vt.FIVE_MINUTES),a={protocol:x6},u={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=Y_({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(dc.create,u),this.core.expirer.set(s,o),await this.pairings.set(s,u),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Xs.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:u,methods:l}=G_(n.uri);i.props.properties.topic=s,i.addTrace(Xs.pairing_uri_validation_success),i.addTrace(Xs.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(Xs.existing_pairing),d.active)throw i.setError(Io.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Xs.pairing_not_expired)}const p=u||_n(vt.FIVE_MINUTES),y={topic:s,relay:a,expiry:p,active:!1,methods:l};this.core.expirer.set(s,p),await this.pairings.set(s,y),i.addTrace(Xs.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(dc.create,y),i.addTrace(Xs.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Xs.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Io.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(_){throw i.setError(Io.subscribe_pairing_topic_failure),_}return i.addTrace(Xs.subscribe_pairing_topic_success),y},this.activate=async({topic:n})=>{this.isInitialized();const i=_n(vt.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=cc();this.events.once(br("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Dr("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,u=this.core.crypto.keychain.get(i);return Y_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:u,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=va(i,s),a=await this.core.crypto.encode(n,o),u=Tl[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{const o=s0(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Tl[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=o0(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Tl[u.request.method]?Tl[u.request.method].res:Tl.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Dr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>pa(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(dc.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{Gs(i)?this.events.emit(br("pairing_ping",s),{}):Xi(i)&&this.events.emit(br("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(dc.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Dr("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Dr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!bi(n)){const{message:a}=ut("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!iF(n.uri)){const{message:a}=ut("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Io.malformed_pairing_uri),new Error(a)}const o=G_(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Io.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&vt.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!bi(n)){const{message:s}=ut("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!bi(n)){const{message:s}=ut("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!on(n,!1)){const{message:i}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(pa(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ut("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=ti(r,this.name),this.pairings=new mc(this.core,this.logger,this.name,this.storagePrefix)}get context(){return pi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(ni.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===Wr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{S1(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):a0(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(es.expired,async e=>{const{topic:r}=P_(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(dc.expire,{topic:r}))})}}class _q extends yD{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new Hi.EventEmitter,this.name=xj,this.version=_j,this.cached=[],this.initialized=!1,this.storagePrefix=Ys,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:_n(vt.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(xs.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Xi(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(xs.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(xs.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ti(r,this.name)}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:va(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(xs.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(xs.created,e=>{const r=xs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(xs.updated,e=>{const r=xs.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(xs.deleted,e=>{const r=xs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(su.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{vt.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(xs.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Eq extends AD{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new Hi.EventEmitter,this.name=Ej,this.version=Sj,this.cached=[],this.initialized=!1,this.storagePrefix=Ys,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(es.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(es.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=ti(r,this.name)}get context(){return pi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return ZB(e);if(typeof e=="number")return QB(e);const{message:r}=ut("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(es.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;vt.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(es.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(su.pulse,()=>this.checkExpirations()),this.events.on(es.created,e=>{const r=es.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(es.expired,e=>{const r=es.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(es.deleted,e=>{const r=es.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Sq extends PD{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=Aj,this.verifyUrlV3=Mj,this.storagePrefix=Ys,this.version=b6,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&vt.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!vl()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,u=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=ol(),d=this.startAbortTimer(vt.ONE_SECOND*5),p=await new Promise((y,_)=>{const M=()=>{window.removeEventListener("message",L),l.body.removeChild(O),_("attestation aborted")};this.abortController.signal.addEventListener("abort",M);const O=l.createElement("iframe");O.src=u,O.style.display="none",O.addEventListener("error",M,{signal:this.abortController.signal});const L=B=>{if(B.data&&typeof B.data=="string")try{const k=JSON.parse(B.data);if(k.type==="verify_attestation"){if(Sm(k.attestation).payload.id!==o)return;clearInterval(d),l.body.removeChild(O),this.abortController.signal.removeEventListener("abort",M),window.removeEventListener("message",L),y(k.attestation===null?"":k.attestation)}}catch(k){this.logger.warn(k)}};l.body.appendChild(O),window.addEventListener("message",L,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",p),p}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(Sm(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const u=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,u)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(vt.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Rl;return Ij.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Rl}`),s=Rl),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(vt.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=F$(i,s.publicKey),a={hasExpired:vt.toMiliseconds(o.exp)this.abortController.abort(),vt.toMiliseconds(e))}}class Aq extends MD{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=Cj,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,u=`${Tj}/${this.projectId}/clients`;await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=ti(r,this.context)}}var Pq=Object.defineProperty,Y6=Object.getOwnPropertySymbols,Mq=Object.prototype.hasOwnProperty,Iq=Object.prototype.propertyIsEnumerable,J6=(t,e,r)=>e in t?Pq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ll=(t,e)=>{for(var r in e||(e={}))Mq.call(e,r)&&J6(t,r,e[r]);if(Y6)for(var r of Y6(e))Iq.call(e,r)&&J6(t,r,e[r]);return t};class Cq extends ID{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=Dj,this.storagePrefix=Ys,this.storageVersion=Rj,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!d1())try{const i={eventId:I_(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:__(this.core.relayer.protocol,this.core.relayer.version,A1)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:u}}=i,l=I_(),d=this.core.projectId||"",p=Date.now(),y=Ll({eventId:l,timestamp:p,props:{event:s,type:o,properties:{topic:a,trace:u}},bundleId:d,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,y),this.shouldPersist=!0),y},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(u=>u.props.properties.topic===o);if(a)return Ll(Ll({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(su.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{vt.fromMiliseconds(Date.now())-vt.fromMiliseconds(i.timestamp)>Oj&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Ll(Ll({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${Nj}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${A1}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>x_().url,this.logger=ti(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var Tq=Object.defineProperty,X6=Object.getOwnPropertySymbols,Rq=Object.prototype.hasOwnProperty,Dq=Object.prototype.propertyIsEnumerable,Z6=(t,e,r)=>e in t?Tq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Q6=(t,e)=>{for(var r in e||(e={}))Rq.call(e,r)&&Z6(t,r,e[r]);if(X6)for(var r of X6(e))Dq.call(e,r)&&Z6(t,r,e[r]);return t};class T1 extends bD{constructor(e){var r;super(e),this.protocol=v6,this.version=b6,this.name=y6,this.events=new Hi.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:u})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:Wr.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||_6,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=bd({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:ej.logger}),{logger:i,chunkLoggerController:s}=vD({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ti(i,this.name),this.heartbeat=new lR,this.crypto=new iq(this,this.logger,e==null?void 0:e.keychain),this.history=new _q(this,this.logger),this.expirer=new Eq(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new zR(Q6(Q6({},tj),e==null?void 0:e.storageOptions)),this.relayer=new vq({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new xq(this,this.logger),this.verify=new Sq(this,this.logger,this.storage),this.echoClient=new Aq(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new Cq(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new T1(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(gj,n),r}get context(){return pi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(E6,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(E6)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const Oq=T1,e5="wc",t5=2,r5="client",R1=`${e5}@${t5}:${r5}:`,D1={name:r5,logger:"error"},n5="WALLETCONNECT_DEEPLINK_CHOICE",Nq="proposal",i5="Proposal expired",Lq="session",Iu=vt.SEVEN_DAYS,kq="engine",Nn={wc_sessionPropose:{req:{ttl:vt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:vt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:vt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:vt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:vt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1119}}},O1={min:vt.FIVE_MINUTES,max:vt.SEVEN_DAYS},Zs={idle:"IDLE",active:"ACTIVE"},Bq="request",$q=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],Fq="wc",jq="auth",Uq="authKeys",qq="pairingTopics",zq="requests",f0=`${Fq}@${1.5}:${jq}:`,l0=`${f0}:PUB_KEY`;var Hq=Object.defineProperty,Wq=Object.defineProperties,Kq=Object.getOwnPropertyDescriptors,s5=Object.getOwnPropertySymbols,Vq=Object.prototype.hasOwnProperty,Gq=Object.prototype.propertyIsEnumerable,o5=(t,e,r)=>e in t?Hq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))Vq.call(e,r)&&o5(t,r,e[r]);if(s5)for(var r of s5(e))Gq.call(e,r)&&o5(t,r,e[r]);return t},Es=(t,e)=>Wq(t,Kq(e));class Yq extends TD{constructor(e){super(e),this.name=kq,this.events=new im,this.initialized=!1,this.requestQueue={state:Zs.idle,queue:[]},this.sessionRequestQueue={state:Zs.idle,queue:[]},this.requestQueueDelay=vt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Nn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},vt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=Es(tn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n;let l=i,d,p=!1;try{l&&(p=this.client.core.pairing.pairings.get(l).active)}catch(U){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),U}if(!l||!p){const{topic:U,uri:z}=await this.client.core.pairing.create();l=U,d=z}if(!l){const{message:U}=ut("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(U)}const y=await this.client.core.crypto.generateKeyPair(),_=Nn.wc_sessionPropose.req.ttl||vt.FIVE_MINUTES,M=_n(_),O=tn({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:x6}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:M,pairingTopic:l},a&&{sessionProperties:a}),{reject:L,resolve:B,done:k}=cc(_,i5);this.events.once(br("session_connect"),async({error:U,session:z})=>{if(U)L(U);else if(z){z.self.publicKey=y;const Z=Es(tn({},z),{pairingTopic:O.pairingTopic,requiredNamespaces:O.requiredNamespaces,optionalNamespaces:O.optionalNamespaces,transportType:Wr.relay});await this.client.session.set(z.topic,Z),await this.setExpiry(z.topic,z.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:z.peer.metadata}),this.cleanupDuplicatePairings(Z),B(Z)}});const H=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:O,throwOnFailedPublish:!0});return await this.setProposal(H,tn({id:H},O)),{uri:d,approval:k}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[_s.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(W){throw o.setError(pc.no_internet_connection),W}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(W){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(pc.proposal_not_found),W}try{await this.isValidApprove(r)}catch(W){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(pc.session_approve_namespace_validation_failure),W}const{id:a,relayProtocol:u,namespaces:l,sessionProperties:d,sessionConfig:p}=r,y=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:_,proposer:M,requiredNamespaces:O,optionalNamespaces:L}=y;let B=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:_});B||(B=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:_s.session_approve_started,properties:{topic:_,trace:[_s.session_approve_started,_s.session_namespaces_validation_success]}}));const k=await this.client.core.crypto.generateKeyPair(),H=M.publicKey,U=await this.client.core.crypto.generateSharedKey(k,H),z=tn(tn({relay:{protocol:u??"irn"},namespaces:l,controller:{publicKey:k,metadata:this.client.metadata},expiry:_n(Iu)},d&&{sessionProperties:d}),p&&{sessionConfig:p}),Z=Wr.relay;B.addTrace(_s.subscribing_session_topic);try{await this.client.core.relayer.subscribe(U,{transportType:Z})}catch(W){throw B.setError(pc.subscribe_session_topic_failure),W}B.addTrace(_s.subscribe_session_topic_success);const R=Es(tn({},z),{topic:U,requiredNamespaces:O,optionalNamespaces:L,pairingTopic:_,acknowledged:!1,self:z.controller,peer:{publicKey:M.publicKey,metadata:M.metadata},controller:k,transportType:Wr.relay});await this.client.session.set(U,R),B.addTrace(_s.store_session);try{B.addTrace(_s.publishing_session_settle),await this.sendRequest({topic:U,method:"wc_sessionSettle",params:z,throwOnFailedPublish:!0}).catch(W=>{throw B==null||B.setError(pc.session_settle_publish_failure),W}),B.addTrace(_s.session_settle_publish_success),B.addTrace(_s.publishing_session_approve),await this.sendResult({id:a,topic:_,result:{relay:{protocol:u??"irn"},responderPublicKey:k},throwOnFailedPublish:!0}).catch(W=>{throw B==null||B.setError(pc.session_approve_publish_failure),W}),B.addTrace(_s.session_approve_publish_success)}catch(W){throw this.client.logger.error(W),this.client.session.delete(U,Dr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(U),W}return this.client.core.eventClient.deleteEvent({eventId:B.eventId}),await this.client.core.pairing.updateMetadata({topic:_,metadata:M.metadata}),await this.client.proposal.delete(a,Dr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:_}),await this.setExpiry(U,_n(Iu)),{topic:U,acknowledged:()=>Promise.resolve(this.client.session.get(U))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:Nn.wc_sessionPropose.reject}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(p){throw this.client.logger.error("update() -> isValidUpdate() failed"),p}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=cc(),u=ma(),l=hc().toString(),d=this.client.session.get(n).namespaces;return this.events.once(br("session_update",u),({error:p})=>{p?a(p):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:u,relayRpcId:l}).catch(p=>{this.client.logger.error(p),this.client.session.update(n,{namespaces:d}),a(p)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(u){throw this.client.logger.error("extend() -> isValidExtend() failed"),u}const{topic:n}=r,i=ma(),{done:s,resolve:o,reject:a}=cc();return this.events.once(br("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,_n(Iu)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(u=>{a(u)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(M){throw this.client.logger.error("request() -> isValidRequest() failed"),M}const{chainId:n,request:i,topic:s,expiry:o=Nn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=ma(),l=hc().toString(),{done:d,resolve:p,reject:y}=cc(o,"Request expired. Please try again.");this.events.once(br("session_request",u),({error:M,result:O})=>{M?y(M):p(O)});const _=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return _?(await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:Es(tn({},i),{expiryTimestamp:_n(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:_}).catch(M=>y(M)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),await d()):await Promise.all([new Promise(async M=>{await this.sendRequest({clientRpcId:u,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:Es(tn({},i),{expiryTimestamp:_n(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(O=>y(O)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:u}),M()}),new Promise(async M=>{var O;if(!((O=a.sessionConfig)!=null&&O.disableDeepLink)){const L=await r$(this.client.core.storage,n5);await e$({id:u,topic:s,wcDeepLink:L})}M()}),d()]).then(M=>M[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);Gs(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Xi(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=ma(),s=hc().toString(),{done:o,resolve:a,reject:u}=cc();this.events.once(br("session_ping",i),({error:l})=>{l?u(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=hc().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Dr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ut("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>rF(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?Wr.link_mode:Wr.relay;o===Wr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:u="",uri:l,domain:d,nonce:p,type:y,exp:_,nbf:M,methods:O=[],expiry:L}=r,B=[...r.resources||[]],{topic:k,uri:H}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:k,uri:H}});const U=await this.client.core.crypto.generateKeyPair(),z=r0(U);if(await Promise.all([this.client.auth.authKeys.set(l0,{responseTopic:z,publicKey:U}),this.client.auth.pairingTopics.set(z,{topic:z,pairingTopic:k})]),await this.client.core.relayer.subscribe(z,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${k}`),O.length>0){const{namespace:S}=Su(a[0]);let A=E$(S,"request",O);t0(B)&&(A=A$(A,B.pop())),B.push(A)}const Z=L&&L>Nn.wc_sessionAuthenticate.req.ttl?L:Nn.wc_sessionAuthenticate.req.ttl,R={authPayload:{type:y??"caip122",chains:a,statement:u,aud:l,domain:d,version:"1",nonce:p,iat:new Date().toISOString(),exp:_,nbf:M,resources:B},requester:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:_n(Z)},W={eip155:{chains:a,methods:[...new Set(["personal_sign",...O])],events:["chainChanged","accountsChanged"]}},ie={requiredNamespaces:{},optionalNamespaces:W,relays:[{protocol:"irn"}],pairingTopic:k,proposer:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:_n(Nn.wc_sessionPropose.req.ttl)},{done:me,resolve:j,reject:E}=cc(Z,"Request expired"),m=async({error:S,session:A})=>{if(this.events.off(br("session_request",g),f),S)E(S);else if(A){A.self.publicKey=U,await this.client.session.set(A.topic,A),await this.setExpiry(A.topic,A.expiry),k&&await this.client.core.pairing.updateMetadata({topic:k,metadata:A.peer.metadata});const b=this.client.session.get(A.topic);await this.deleteProposal(v),j({session:b})}},f=async S=>{var A,b,P;if(await this.deletePendingAuthRequest(g,{message:"fulfilled",code:0}),S.error){const J=Dr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return S.error.code===J.code?void 0:(this.events.off(br("session_connect"),m),E(S.error.message))}await this.deleteProposal(v),this.events.off(br("session_connect"),m);const{cacaos:I,responder:F}=S.result,ce=[],D=[];for(const J of I){await D_({cacao:J,projectId:this.client.core.projectId})||(this.client.logger.error(J,"Signature verification failed"),E(Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Q}=J,T=t0(Q.resources),X=[g1(Q.iss)],re=e0(Q.iss);if(T){const ge=L_(T),oe=k_(T);ce.push(...ge),X.push(...oe)}for(const ge of X)D.push(`${ge}:${re}`)}const se=await this.client.core.crypto.generateSharedKey(U,F.publicKey);let ee;ce.length>0&&(ee={topic:se,acknowledged:!0,self:{publicKey:U,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:_n(Iu),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:k,namespaces:J_([...new Set(ce)],[...new Set(D)]),transportType:o},await this.client.core.relayer.subscribe(se,{transportType:o}),await this.client.session.set(se,ee),k&&await this.client.core.pairing.updateMetadata({topic:k,metadata:F.metadata}),ee=this.client.session.get(se)),(A=this.client.metadata.redirect)!=null&&A.linkMode&&(b=F.metadata.redirect)!=null&&b.linkMode&&(P=F.metadata.redirect)!=null&&P.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(se,{transportType:Wr.link_mode})),j({auths:I,session:ee})},g=ma(),v=ma();this.events.once(br("session_connect"),m),this.events.once(br("session_request",g),f);let x;try{if(s){const S=va("wc_sessionAuthenticate",R,g);this.client.core.history.set(k,S);const A=await this.client.core.crypto.encode("",S,{type:_l,encoding:wl});x=n0(n,k,A)}else await Promise.all([this.sendRequest({topic:k,method:"wc_sessionAuthenticate",params:R,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:g}),this.sendRequest({topic:k,method:"wc_sessionPropose",params:ie,expiry:Nn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:v})])}catch(S){throw this.events.off(br("session_connect"),m),this.events.off(br("session_request",g),f),S}return await this.setProposal(v,tn({id:v},ie)),await this.setAuthRequest(g,{request:Es(tn({},R),{verifyContext:{}}),pairingTopic:k,transportType:o}),{uri:x??H,response:me}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[gc.authenticated_session_approve_started]}});try{this.isInitialized()}catch(L){throw s.setError(Dl.no_internet_connection),L}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Dl.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||Wr.relay;a===Wr.relay&&await this.confirmOnlineStateOrThrow();const u=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=r0(u),p={type:So,receiverPublicKey:u,senderPublicKey:l},y=[],_=[];for(const L of i){if(!await D_({cacao:L,projectId:this.client.core.projectId})){s.setError(Dl.invalid_cacao);const z=Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:z,encodeOpts:p}),new Error(z.message)}s.addTrace(gc.cacaos_verified);const{p:B}=L,k=t0(B.resources),H=[g1(B.iss)],U=e0(B.iss);if(k){const z=L_(k),Z=k_(k);y.push(...z),H.push(...Z)}for(const z of H)_.push(`${z}:${U}`)}const M=await this.client.core.crypto.generateSharedKey(l,u);s.addTrace(gc.create_authenticated_session_topic);let O;if((y==null?void 0:y.length)>0){O={topic:M,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:u,metadata:o.requester.metadata},controller:u,expiry:_n(Iu),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:J_([...new Set(y)],[...new Set(_)]),transportType:a},s.addTrace(gc.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(M,{transportType:a})}catch(L){throw s.setError(Dl.subscribe_authenticated_session_topic_failure),L}s.addTrace(gc.subscribe_authenticated_session_topic_success),await this.client.session.set(M,O),s.addTrace(gc.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(gc.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:p,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(L){throw s.setError(Dl.authenticated_session_approve_publish_failure),L}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:O}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===Wr.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),u=r0(o),l={type:So,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:u,error:i,encodeOpts:l,rpcOpts:Nn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return O_(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:u}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Dr("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(n5).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,Dr("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Zs.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(pc.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Dr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Zs.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,_n(Nn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=Wr.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||_n(Nn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l,appLink:d}=r,p=va(i,s,u);let y;const _=!!d;try{const L=_?wl:ga;y=await this.client.core.crypto.encode(n,p,{encoding:L})}catch(L){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),L}let M;if($q.includes(i)){const L=Ao(JSON.stringify(p)),B=Ao(y);M=await this.client.core.verify.register({id:B,decryptedId:L})}const O=Nn[i].req;if(O.attestation=M,o&&(O.ttl=o),a&&(O.id=a),this.client.core.history.set(n,p),_){const L=n0(d,n,y);await global.Linking.openURL(L,this.client.name)}else{const L=Nn[i].req;o&&(L.ttl=o),a&&(L.id=a),l?(L.internal=Es(tn({},L.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,y,L)):this.client.core.relayer.publish(n,y,L).catch(B=>this.client.logger.error(B))}return p.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:u}=r,l=s0(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const _=p?wl:ga;d=await this.client.core.crypto.encode(i,l,Es(tn({},a||{}),{encoding:_}))}catch(_){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),_}let y;try{y=await this.client.core.history.get(i,n)}catch(_){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),_}if(p){const _=n0(u,i,d);await global.Linking.openURL(_,this.client.name)}else{const _=Nn[y.request.method].res;o?(_.internal=Es(tn({},_.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,_)):this.client.core.relayer.publish(i,d,_).catch(M=>this.client.logger.error(M))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:u}=r,l=o0(n,s);let d;const p=u&&typeof(global==null?void 0:global.Linking)<"u";try{const _=p?wl:ga;d=await this.client.core.crypto.encode(i,l,Es(tn({},o||{}),{encoding:_}))}catch(_){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),_}let y;try{y=await this.client.core.history.get(i,n)}catch(_){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),_}if(p){const _=n0(u,i,d);await global.Linking.openURL(_,this.client.name)}else{const _=a||Nn[y.request.method].res;this.client.core.relayer.publish(i,d,_)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;pa(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{pa(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Zs.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Zs.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Zs.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,u=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:u}))switch(u){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=ut("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:u}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(tn({},i.params));const d=a.expiryTimestamp||_n(Nn.wc_sessionPropose.req.ttl),p=tn({id:u,pairingTopic:n,expiryTimestamp:d},a);await this.setProposal(u,p);const y=await this.getVerifyContext({attestationId:s,hash:Ao(JSON.stringify(i)),encryptedId:o,metadata:p.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(Io.proposal_listener_not_found)),l==null||l.addTrace(Xs.emit_session_proposal),this.client.events.emit("session_proposal",{id:u,params:p,verifyContext:y})}catch(l){await this.sendError({id:u,topic:n,error:l,rpcOpts:Nn.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(Gs(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const u=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const d=await this.client.core.crypto.generateSharedKey(u,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:d});const p=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:p}),await this.client.core.pairing.activate({topic:r})}else if(Xi(n)){await this.client.proposal.delete(s,Dr("USER_DISCONNECTED"));const o=br("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(br("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:u,namespaces:l,sessionProperties:d,sessionConfig:p}=n.params,y=Es(tn(tn({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},d&&{sessionProperties:d}),p&&{sessionConfig:p}),{transportType:Wr.relay}),_=br("session_connect");if(this.events.listenerCount(_)===0)throw new Error(`emitting ${_} without any listeners 997`);this.events.emit(br("session_connect"),{session:y}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;Gs(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(br("session_approve",i),{})):Xi(n)&&(await this.client.session.delete(r,Dr("USER_DISCONNECTED")),this.events.emit(br("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Il.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Dr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(tn({topic:r},i));try{Il.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(u){throw Il.delete(o),u}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=br("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Gs(n)?this.events.emit(br("session_update",i),{}):Xi(n)&&this.events.emit(br("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,_n(Iu)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=br("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Gs(n)?this.events.emit(br("session_extend",i),{}):Xi(n)&&this.events.emit(br("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=br("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{Gs(n)?this.events.emit(br("session_ping",i),{}):Xi(n)&&this.events.emit(br("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(ni.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Dr("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:u,encryptedId:l,transportType:d}=r,{id:p,params:y}=a;try{await this.isValidRequest(tn({topic:o},y));const _=this.client.session.get(o),M=await this.getVerifyContext({attestationId:u,hash:Ao(JSON.stringify(va("wc_sessionRequest",y,p))),encryptedId:l,metadata:_.peer.metadata,transportType:d}),O={id:p,topic:o,params:y,verifyContext:M};await this.setPendingSessionRequest(O),d===Wr.link_mode&&(n=_.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=_.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(O):(this.addSessionRequestToSessionRequestQueue(O),this.processSessionRequestQueue())}catch(_){await this.sendError({id:p,topic:o,error:_}),this.client.logger.error(_)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=br("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Gs(n)?this.events.emit(br("session_request",i),{result:n.result}):Xi(n)&&this.events.emit(br("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Il.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(tn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Il.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),Gs(n)?this.events.emit(br("session_request",i),{result:n.result}):Xi(n)&&this.events.emit(br("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:u}=r;try{const{requester:l,authPayload:d,expiryTimestamp:p}=s.params,y=await this.getVerifyContext({attestationId:o,hash:Ao(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:u}),_={requester:l,pairingTopic:i,id:s.id,authPayload:d,verifyContext:y,expiryTimestamp:p};await this.setAuthRequest(s.id,{request:_,pairingTopic:i,transportType:u}),u===Wr.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:y})}catch(l){this.client.logger.error(l);const d=s.params.requester.publicKey,p=await this.client.core.crypto.generateKeyPair(),y=this.getAppLinkIfEnabled(s.params.requester.metadata,u),_={type:So,receiverPublicKey:d,senderPublicKey:p};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:_,rpcOpts:Nn.wc_sessionAuthenticate.autoReject,appLink:y})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Zs.idle,this.processSessionRequestQueue()},vt.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=br("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(br("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Zs.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Zs.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:va("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!bi(r)){const{message:u}=ut("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(vi(n)||await this.isValidPairingTopic(n),!pF(a)){const{message:u}=ut("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!vi(i)&&Ml(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!vi(s)&&Ml(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),vi(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=dF(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!bi(r))throw new Error(ut("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),u=x1(i,"approve()");if(u)throw new Error(u.message);const l=t6(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!on(s,!0)){const{message:d}=ut("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}vi(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!bi(r)){const{message:s}=ut("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!mF(i)){const{message:s}=ut("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!bi(r)){const{message:l}=ut("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!Q_(n)){const{message:l}=ut("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=aF(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const u=x1(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(pa(o)){const{message:l}=ut("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!bi(r)){const{message:u}=ut("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=x1(i,"update()");if(o)throw new Error(o.message);const a=t6(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!bi(r)){const{message:i}=ut("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!bi(r)){const{message:u}=ut("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!e6(a,s)){const{message:u}=ut("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!vF(i)){const{message:u}=ut("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!wF(a,s,i.method)){const{message:u}=ut("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!SF(o,O1)){const{message:u}=ut("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${O1.min} and ${O1.max}`);throw new Error(u)}},this.isValidRespond=async r=>{var n;if(!bi(r)){const{message:o}=ut("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!bF(s)){const{message:o}=ut("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!bi(r)){const{message:i}=ut("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!bi(r)){const{message:a}=ut("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!e6(o,s)){const{message:a}=ut("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!yF(i)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!xF(o,s,i.name)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!bi(r)){const{message:i}=ut("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!on(i,!1))throw new Error("uri is required parameter");if(!on(s,!1))throw new Error("domain is required parameter");if(!on(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(u=>Su(u).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Su(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,u={verified:{verifyUrl:o.verifyUrl||Rl,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Wr.link_mode){const d=this.getAppLinkIfEnabled(o,a);return u.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",u}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(u.verified.origin=l.origin,u.verified.isScam=l.isScam,u.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(u)}`),u},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!on(i,!1)){const{message:s}=ut("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,u,l,d,p,y;return!r||n!==Wr.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(u=this.client.metadata)==null?void 0:u.redirect)==null?void 0:l.universal)!==""&&((d=r==null?void 0:r.redirect)==null?void 0:d.universal)!==void 0&&((p=r==null?void 0:r.redirect)==null?void 0:p.universal)!==""&&((y=r==null?void 0:r.redirect)==null?void 0:y.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=M_(r,"topic")||"",i=decodeURIComponent(M_(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:Wr.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(d1()||Au()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ni.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(l0)?this.client.auth.authKeys.get(l0):{publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===Wr.link_mode?wl:ga});try{S1(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:Ao(n)})):a0(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(u){this.client.logger.error(u)}}registerExpirerEvents(){this.client.core.expirer.on(es.expired,async e=>{const{topic:r,id:n}=P_(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ut("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,ut("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(dc.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(dc.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!on(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(pa(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=ut("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!on(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(pa(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=ut("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=ut("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(on(e,!1)){const{message:r}=ut("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=ut("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!gF(e)){const{message:r}=ut("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(pa(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=ut("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class Jq extends mc{constructor(e,r){super(e,r,Nq,R1),this.core=e,this.logger=r}}let Xq=class extends mc{constructor(e,r){super(e,r,Lq,R1),this.core=e,this.logger=r}};class Zq extends mc{constructor(e,r){super(e,r,Bq,R1,n=>n.id),this.core=e,this.logger=r}}class Qq extends mc{constructor(e,r){super(e,r,Uq,f0,()=>l0),this.core=e,this.logger=r}}class ez extends mc{constructor(e,r){super(e,r,qq,f0),this.core=e,this.logger=r}}class tz extends mc{constructor(e,r){super(e,r,zq,f0,n=>n.id),this.core=e,this.logger=r}}class rz{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new Qq(this.core,this.logger),this.pairingTopics=new ez(this.core,this.logger),this.requests=new tz(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class N1 extends CD{constructor(e){super(e),this.protocol=e5,this.version=t5,this.name=D1.name,this.events=new Hi.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||D1.name,this.metadata=(e==null?void 0:e.metadata)||x_(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:rl(bd({level:(e==null?void 0:e.logger)||D1.logger}));this.core=(e==null?void 0:e.core)||new Oq(e),this.logger=ti(r,this.name),this.session=new Xq(this.core,this.logger),this.proposal=new Jq(this.core,this.logger),this.pendingRequest=new Zq(this.core,this.logger),this.engine=new Yq(this),this.auth=new rz(this.core,this.logger)}static async init(e){const r=new N1(e);return await r.initialize(),r}get context(){return pi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var h0={exports:{}};/** + Approved: ${a.toString()}`)),Object.keys(e).forEach(g=>{if(!g.includes(":")||n)return;const b=Pc(e[g].accounts);b.includes(g)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${g} + Required: ${g} + Approved: ${b.toString()}`))}),o.forEach(g=>{n||(_a(i[g].methods,s[g].methods)?_a(i[g].events,s[g].events)||(n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${g}`)):n=ut("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${g}`))}),n}function VL(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function i_(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function GL(t){const e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:Pc(t[r].accounts)?.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}),e}function YL(t,e){return vm(t,!1)&&t<=e.max&&t>=e.min}function s_(){const t=ff();return new Promise(e=>{switch(t){case bi.browser:e(JL());break;case bi.reactNative:e(XL());break;case bi.node:e(ZL());break;default:e(!0)}})}function JL(){return uf()&&navigator?.onLine}async function XL(){return Sc()&&typeof global<"u"&&global!=null&&global.NetInfo?(await(global==null?void 0:global.NetInfo.fetch()))?.isConnected:!0}function ZL(){return!0}function QL(t){switch(ff()){case bi.browser:ek(t);break;case bi.reactNative:tk(t);break}}function ek(t){!Sc()&&uf()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function tk(t){Sc()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}const ym={};class wf{static get(e){return ym[e]}static set(e,r){ym[e]=r}static delete(e){delete ym[e]}}const rk="PARSE_ERROR",nk="INVALID_REQUEST",ik="METHOD_NOT_FOUND",sk="INVALID_PARAMS",o_="INTERNAL_ERROR",wm="SERVER_ERROR",ok=[-32700,-32600,-32601,-32602,-32603],xf={[rk]:{code:-32700,message:"Parse error"},[nk]:{code:-32600,message:"Invalid Request"},[ik]:{code:-32601,message:"Method not found"},[sk]:{code:-32602,message:"Invalid params"},[o_]:{code:-32603,message:"Internal error"},[wm]:{code:-32e3,message:"Server error"}},a_=wm;function ak(t){return ok.includes(t)}function c_(t){return Object.keys(xf).includes(t)?xf[t]:xf[a_]}function ck(t){const e=Object.values(xf).find(r=>r.code===t);return e||xf[a_]}function u_(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var xm={},Ys={},f_;function uk(){if(f_)return Ys;f_=1,Object.defineProperty(Ys,"__esModule",{value:!0}),Ys.isBrowserCryptoAvailable=Ys.getSubtleCrypto=Ys.getBrowerCrypto=void 0;function t(){return Wn?.crypto||Wn?.msCrypto||{}}Ys.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Ys.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Ys.isBrowserCryptoAvailable=r,Ys}var Js={},l_;function fk(){if(l_)return Js;l_=1,Object.defineProperty(Js,"__esModule",{value:!0}),Js.isBrowser=Js.isNode=Js.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Js.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Js.isNode=e;function r(){return!t()&&!e()}return Js.isBrowser=r,Js}var h_;function lk(){return h_||(h_=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Hu;e.__exportStar(uk(),t),e.__exportStar(fk(),t)})(xm)),xm}var hk=lk();function Oo(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function Ia(t=6){return BigInt(Oo(t))}function No(t,e,r){return{id:r||Oo(),jsonrpc:"2.0",method:t,params:e}}function Wh(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Kh(t,e,r){return{id:t,jsonrpc:"2.0",error:dk(e)}}function dk(t,e){return typeof t>"u"?c_(o_):(typeof t=="string"&&(t=Object.assign(Object.assign({},c_(wm)),{message:t})),ak(t.code)&&(t=ck(t.code)),t)}let pk=class{},gk=class extends pk{constructor(){super()}},mk=class extends gk{constructor(e){super()}};const vk="^https?:",bk="^wss?:";function yk(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function d_(t,e){const r=yk(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function p_(t){return d_(t,vk)}function g_(t){return d_(t,bk)}function wk(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function m_(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function _m(t){return m_(t)&&"method"in t}function Vh(t){return m_(t)&&(Ss(t)||Bi(t))}function Ss(t){return"result"in t}function Bi(t){return"error"in t}let Fi=class extends mk{constructor(e){super(e),this.events=new Di.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(No(e.method,e.params||[],e.id||Ia().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Bi(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Vh(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const xk=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),_k=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",v_=t=>t.split("?")[0],b_=10,Ek=xk();let Sk=class{constructor(e){if(this.url=e,this.events=new Di.EventEmitter,this.registering=!1,!g_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Hs(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!g_(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=hk.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!wk(e)},o=new Ek(e,[],s);_k()?o.onerror=a=>{const f=a;n(this.emitError(f.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?ma(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Kh(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return u_(e,v_(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>b_&&this.events.setMaxListeners(b_)}emitError(e){const r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${v_(this.url)}`));return this.events.emit("register_error",r),r}};var _f={exports:{}};_f.exports;var y_;function Ak(){return y_||(y_=1,(function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",f="[object Array]",u="[object AsyncFunction]",h="[object Boolean]",g="[object Date]",b="[object Error]",x="[object Function]",S="[object GeneratorFunction]",C="[object Map]",D="[object Number]",B="[object Null]",L="[object Object]",H="[object Promise]",F="[object Proxy]",k="[object RegExp]",$="[object Set]",R="[object String]",W="[object Symbol]",V="[object Undefined]",X="[object WeakMap]",q="[object ArrayBuffer]",_="[object DataView]",v="[object Float32Array]",l="[object Float64Array]",p="[object Int8Array]",m="[object Int16Array]",y="[object Int32Array]",A="[object Uint8Array]",E="[object Uint8ClampedArray]",w="[object Uint16Array]",I="[object Uint32Array]",M=/[\\^$.*+?()[\]{}|]/g,z=/^\[object .+?Constructor\]$/,se=/^(?:0|[1-9]\d*)$/,O={};O[v]=O[l]=O[p]=O[m]=O[y]=O[A]=O[E]=O[w]=O[I]=!0,O[a]=O[f]=O[q]=O[h]=O[_]=O[g]=O[b]=O[x]=O[C]=O[D]=O[L]=O[k]=O[$]=O[R]=O[X]=!1;var ie=typeof Wn=="object"&&Wn&&Wn.Object===Object&&Wn,ee=typeof self=="object"&&self&&self.Object===Object&&self,Z=ie||ee||Function("return this")(),te=e&&!e.nodeType&&e,N=te&&!0&&t&&!t.nodeType&&t,Q=N&&N.exports===te,ne=Q&&ie.process,de=(function(){try{return ne&&ne.binding&&ne.binding("util")}catch{}})(),ce=de&&de.isTypedArray;function fe(ue,we){for(var Ge=-1,Pt=ue==null?0:ue.length,$r=0,sr=[];++Ge-1}function ot(ue,we){var Ge=this.__data__,Pt=Je(Ge,ue);return Pt<0?(++this.size,Ge.push([ue,we])):Ge[Pt][1]=we,this}ke.prototype.clear=Ce,ke.prototype.delete=et,ke.prototype.get=Ze,ke.prototype.has=rt,ke.prototype.set=ot;function yt(ue){var we=-1,Ge=ue==null?0:ue.length;for(this.clear();++webn))return!1;var qr=sr.get(ue);if(qr&&sr.get(we))return qr==we;var hn=-1,fi=!0,yn=Ge&s?new Et:void 0;for(sr.set(ue,we),sr.set(we,ue);++hn-1&&ue%1==0&&ue-1&&ue%1==0&&ue<=o}function o0(ue){var we=typeof ue;return ue!=null&&(we=="object"||we=="function")}function Va(ue){return ue!=null&&typeof ue=="object"}var a0=ce?Te(ce):gr;function Q1(ue){return X1(ue)?ze(ue):mr(ue)}function Ur(){return[]}function kr(){return!1}t.exports=Z1})(_f,_f.exports)),_f.exports}var Pk=Ak();const Ik=Mi(Pk),w_="wc",x_=2,__="core",As=`${w_}@2:${__}:`,Mk={logger:"error"},Ck={database:":memory:"},Rk="crypto",E_="client_ed25519_seed",Tk=vt.ONE_DAY,Dk="keychain",Ok="0.3",Nk="messages",Lk="0.3",kk=vt.SIX_HOURS,Bk="publisher",S_="irn",Fk="error",A_="wss://relay.walletconnect.org",jk="relayer",Jn={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},Uk="_subscription",ji={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},$k=.1,Em="2.17.2",Hr={link_mode:"link_mode",relay:"relay"},qk="0.3",zk="WALLETCONNECT_CLIENT_ID",P_="WALLETCONNECT_LINK_MODE_APPS",Ps={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},Hk="subscription",Wk="0.3",Kk=vt.FIVE_SECONDS*1e3,Vk="pairing",Gk="0.3",Ef={wc_pairingDelete:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:vt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:vt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:0},res:{ttl:vt.ONE_DAY,prompt:!1,tag:0}}},Ma={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},os={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},Yk="history",Jk="0.3",Xk="expirer",Ui={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},Zk="0.3",Qk="verify-api",eB="https://verify.walletconnect.com",I_="https://verify.walletconnect.org",Sf=I_,tB=`${Sf}/v3`,rB=[eB,I_],nB="echo",iB="https://echo.walletconnect.com",Is={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},Xs={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},as={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},Ca={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},Ra={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Af={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},sB=.1,oB="event-client",aB=86400,cB="https://pulse.walletconnect.org/batch";function uB(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,F=new Uint8Array(H);B!==L;){for(var k=S[B],$=0,R=H-1;(k!==0||$>>0,F[R]=k%a>>>0,k=k/a>>>0;if(k!==0)throw new Error("Non-zero carry");D=$,B++}for(var W=H-D;W!==H&&F[W]===0;)W++;for(var V=f.repeat(C);W>>0,H=new Uint8Array(L);S[C];){var F=r[S.charCodeAt(C)];if(F===255)return;for(var k=0,$=L-1;(F!==0||k>>0,H[$]=F%256>>>0,F=F/256>>>0;if(F!==0)throw new Error("Non-zero carry");B=k,C++}if(S[C]!==" "){for(var R=L-B;R!==L&&H[R]===0;)R++;for(var W=new Uint8Array(D+(L-R)),V=D;R!==L;)W[V++]=H[R++];return W}}}function x(S){var C=b(S);if(C)return C;throw new Error(`Non-${e} character`)}return{encode:g,decodeUnsafe:b,decode:x}}var fB=uB,lB=fB;const M_=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},hB=t=>new TextEncoder().encode(t),dB=t=>new TextDecoder().decode(t);class pB{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class gB{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return C_(this,e)}}class mB{constructor(e){this.decoders=e}or(e){return C_(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const C_=(t,e)=>new mB({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class vB{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new pB(e,r,n),this.decoder=new gB(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Gh=({name:t,prefix:e,encode:r,decode:n})=>new vB(t,e,r,n),Pf=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=lB(r,e);return Gh({prefix:t,name:e,encode:n,decode:s=>M_(i(s))})},bB=(t,e,r,n)=>{const i={};for(let h=0;h=8&&(a-=8,o[u++]=255&f>>a)}if(a>=r||255&f<<8-a)throw new SyntaxError("Unexpected end of data");return o},yB=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Gh({prefix:e,name:t,encode(i){return yB(i,n,r)},decode(i){return bB(i,n,r,t)}}),wB=Gh({prefix:"\0",name:"identity",encode:t=>dB(t),decode:t=>hB(t)});var xB=Object.freeze({__proto__:null,identity:wB});const _B=On({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var EB=Object.freeze({__proto__:null,base2:_B});const SB=On({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var AB=Object.freeze({__proto__:null,base8:SB});const PB=Pf({prefix:"9",name:"base10",alphabet:"0123456789"});var IB=Object.freeze({__proto__:null,base10:PB});const MB=On({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),CB=On({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var RB=Object.freeze({__proto__:null,base16:MB,base16upper:CB});const TB=On({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),DB=On({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),OB=On({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),NB=On({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),LB=On({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),kB=On({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),BB=On({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),FB=On({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),jB=On({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var UB=Object.freeze({__proto__:null,base32:TB,base32upper:DB,base32pad:OB,base32padupper:NB,base32hex:LB,base32hexupper:kB,base32hexpad:BB,base32hexpadupper:FB,base32z:jB});const $B=Pf({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),qB=Pf({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var zB=Object.freeze({__proto__:null,base36:$B,base36upper:qB});const HB=Pf({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),WB=Pf({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var KB=Object.freeze({__proto__:null,base58btc:HB,base58flickr:WB});const VB=On({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),GB=On({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),YB=On({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),JB=On({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var XB=Object.freeze({__proto__:null,base64:VB,base64pad:GB,base64url:YB,base64urlpad:JB});const R_=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),ZB=R_.reduce((t,e,r)=>(t[r]=e,t),[]),QB=R_.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function eF(t){return t.reduce((e,r)=>(e+=ZB[r],e),"")}function tF(t){const e=[];for(const r of t){const n=QB[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const rF=Gh({prefix:"🚀",name:"base256emoji",encode:eF,decode:tF});var nF=Object.freeze({__proto__:null,base256emoji:rF}),iF=D_,T_=128,sF=-128,oF=Math.pow(2,31);function D_(t,e,r){e=e||[],r=r||0;for(var n=r;t>=oF;)e[r++]=t&255|T_,t/=128;for(;t&sF;)e[r++]=t&255|T_,t>>>=7;return e[r]=t|0,D_.bytes=r-n+1,e}var aF=Sm,cF=128,O_=127;function Sm(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw Sm.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&O_)<=cF);return Sm.bytes=s-n,r}var uF=Math.pow(2,7),fF=Math.pow(2,14),lF=Math.pow(2,21),hF=Math.pow(2,28),dF=Math.pow(2,35),pF=Math.pow(2,42),gF=Math.pow(2,49),mF=Math.pow(2,56),vF=Math.pow(2,63),bF=function(t){return t(N_.encode(t,e,r),e),k_=t=>N_.encodingLength(t),Am=(t,e)=>{const r=e.byteLength,n=k_(t),i=n+k_(r),s=new Uint8Array(i+r);return L_(t,s,0),L_(r,s,n),s.set(e,i),new wF(t,r,e,s)};class wF{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const B_=({name:t,code:e,encode:r})=>new xF(t,e,r);class xF{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?Am(this.code,r):r.then(n=>Am(this.code,n))}else throw Error("Unknown type, must be binary type")}}const F_=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),_F=B_({name:"sha2-256",code:18,encode:F_("SHA-256")}),EF=B_({name:"sha2-512",code:19,encode:F_("SHA-512")});var SF=Object.freeze({__proto__:null,sha256:_F,sha512:EF});const j_=0,AF="identity",U_=M_;var PF=Object.freeze({__proto__:null,identity:{code:j_,name:AF,encode:U_,digest:t=>Am(j_,U_(t))}});new TextEncoder,new TextDecoder;const $_={...xB,...EB,...AB,...IB,...RB,...UB,...zB,...KB,...XB,...nF};({...SF,...PF});function IF(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function q_(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const z_=q_("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Pm=q_("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=IF(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=ut("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=Vn(r,this.name)}get context(){return oi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,A3(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?P3(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}},TF=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=Rk,this.randomSessionIdentifier=pm(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=H2(i);return z2(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=eL();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=H2(s),a=this.randomSessionIdentifier;return await MD(a,i,Tk,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),f=tL(a,s);return this.setSymKey(f,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||qh(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=H3(o),f=Hs(s);if(K3(a))return nL(f,o?.encoding);if(W3(a)){const b=a.senderPublicKey,x=a.receiverPublicKey;i=await this.generateSharedKey(b,x)}const u=this.getSymKey(i),{type:h,senderPublicKey:g}=a;return rL({type:h,symKey:u,message:f,senderPublicKey:g,encoding:o?.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=oL(s,o);if(K3(a)){const f=sL(s,o?.encoding);return ma(f)}if(W3(a)){const f=a.receiverPublicKey,u=a.senderPublicKey;i=await this.generateSharedKey(f,u)}try{const f=this.getSymKey(i),u=iL({symKey:f,encoded:s,encoding:o?.encoding});return ma(u)}catch(f){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(f)}},this.getPayloadType=(i,s=Do)=>{const o=mf({encoded:i,encoding:s});return Aa(o.type)},this.getPayloadSenderPublicKey=(i,s=Do)=>{const o=mf({encoded:i,encoding:s});return o.senderPublicKey?An(o.senderPublicKey,Gn):void 0},this.core=e,this.logger=Vn(r,this.name),this.keychain=n||new RF(this.core,this.logger)}get context(){return oi(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(E_)}catch{e=pm(),await this.keychain.set(E_,e)}return CF(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}};class DF extends nT{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=Nk,this.version=Lk,this.initialized=!1,this.storagePrefix=As,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Gs(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Gs(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Vn(e,this.name),this.core=r}get context(){return oi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,A3(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?P3(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class OF extends iT{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new Di.EventEmitter,this.name=Bk,this.queue=new Map,this.publishTimeout=vt.toMiliseconds(vt.ONE_MINUTE),this.failedPublishTimeout=vt.toMiliseconds(vt.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=s?.ttl||kk,f=gm(s),u=s?.prompt||!1,h=s?.tag||0,g=s?.id||Ia().toString(),b={topic:n,message:i,opts:{ttl:a,relay:f,prompt:u,tag:h,id:g,attestation:s?.attestation}},x=`Failed to publish payload, please try again. id:${g} tag:${h}`,S=Date.now();let C,D=1;try{for(;C===void 0;){if(Date.now()-S>this.publishTimeout)throw new Error(x);this.logger.trace({id:g,attempts:D},`publisher.publish - attempt ${D}`),C=await await Ac(this.rpcPublish(n,i,a,f,u,h,g,s?.attestation).catch(B=>this.logger.warn(B)),this.publishTimeout,x),D++,C||await new Promise(B=>setTimeout(B,this.failedPublishTimeout))}this.relayer.events.emit(Jn.publish,b),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:g,topic:n,message:i,opts:s}})}catch(B){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(B),(o=s?.internal)!=null&&o.throwOnFailedPublish)throw B;this.queue.set(g,b)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=Vn(r,this.name),this.registerEventListeners()}get context(){return oi(this.logger)}rpcPublish(e,r,n,i,s,o,a,f){var u,h,g,b;const x={method:vf(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:f},id:a};return Yn((u=x.params)==null?void 0:u.prompt)&&((h=x.params)==null||delete h.prompt),Yn((g=x.params)==null?void 0:g.tag)&&((b=x.params)==null||delete b.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:x}),this.relayer.request(x)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(vc.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Jn.connection_stalled);return}this.checkQueue()}),this.relayer.on(Jn.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class NF{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var LF=Object.defineProperty,kF=Object.defineProperties,BF=Object.getOwnPropertyDescriptors,H_=Object.getOwnPropertySymbols,FF=Object.prototype.hasOwnProperty,jF=Object.prototype.propertyIsEnumerable,W_=(t,e,r)=>e in t?LF(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,If=(t,e)=>{for(var r in e||(e={}))FF.call(e,r)&&W_(t,r,e[r]);if(H_)for(var r of H_(e))jF.call(e,r)&&W_(t,r,e[r]);return t},Im=(t,e)=>kF(t,BF(e));class UF extends aT{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new NF,this.events=new Di.EventEmitter,this.name=Hk,this.version=Wk,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=As,this.subscribeTimeout=vt.toMiliseconds(vt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=gm(i),o={topic:n,relay:s,transportType:i?.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new vt.Watch;a.start(i);const f=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(f),a.stop(i),s(!0)),a.elapsed(i)>=Kk&&(clearInterval(f),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Vn(r,this.name),this.clientId=""}get context(){return oi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=gm(n);await this.rpcUnsubscribe(e,r,i);const s=Dr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;n?.transportType===Hr.relay&&await this.restartToComplete();const s={method:vf(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n?.internal)==null?void 0:i.throwOnFailedPublish;try{const a=Gs(e+this.clientId);if(n?.transportType===Hr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(u=>this.logger.warn(u))},vt.toMiliseconds(vt.ONE_SECOND)),a;const f=await Ac(this.relayer.request(s).catch(u=>this.logger.warn(u)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!f&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return f?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Jn.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:vf(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Ac(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(Jn.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:vf(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Ac(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(Jn.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:vf(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,Im(If({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,If({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,If({},r)),this.topicMap.set(r.topic,e),this.events.emit(Ps.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Ps.deleted,Im(If({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Ps.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);Pa(r)&&this.onBatchSubscribe(r.map((n,i)=>Im(If({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(vc.pulse,async()=>{await this.checkPending()}),this.events.on(Ps.created,async e=>{const r=Ps.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Ps.deleted,async e=>{const r=Ps.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var $F=Object.defineProperty,K_=Object.getOwnPropertySymbols,qF=Object.prototype.hasOwnProperty,zF=Object.prototype.propertyIsEnumerable,V_=(t,e,r)=>e in t?$F(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,G_=(t,e)=>{for(var r in e||(e={}))qF.call(e,r)&&V_(t,r,e[r]);if(K_)for(var r of K_(e))zF.call(e,r)&&V_(t,r,e[r]);return t};class HF extends sT{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Di.EventEmitter,this.name=jk,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=vt.toMiliseconds(vt.THIRTY_SECONDS+vt.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||Ia().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(f,u)=>{const h=()=>{u(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(ji.disconnect,h);const g=await o;this.provider.off(ji.disconnect,h),f(g)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(Fh())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(Jn.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(Jn.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(ji.payload,this.onPayloadHandler),this.provider.on(ji.connect,this.onConnectHandler),this.provider.on(ji.disconnect,this.onDisconnectHandler),this.provider.on(ji.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Vn(e.logger,this.name):Gu(hh({level:e.logger||Fk})),this.messages=new DF(this.logger,e.core),this.subscriber=new UF(this,this.logger),this.publisher=new OF(this,this.logger),this.relayUrl=e?.relayUrl||A_,this.projectId=e.projectId,this.bundleId=bN(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return oi(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Hr.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),r?.transportType==="relay"&&await this.toEstablishConnection();const o=typeof((n=r?.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r?.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",f;const u=h=>{h.topic===e&&(this.subscriber.off(Ps.created,u),f())};return await Promise.all([new Promise(h=>{f=h,this.subscriber.on(Ps.created,u)}),new Promise(async(h,g)=>{a=await this.subscriber.subscribe(e,G_({internal:{throwOnFailedPublish:o}},r)).catch(b=>{o&&g(b)})||a,h()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Ac(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(ji.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(ji.disconnect,i),await Ac(this.provider.connect(),vt.toMiliseconds(vt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await s_())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(e?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=wn(vt.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(Jn.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(Fh())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Fi(new Sk(_N({sdkVersion:Em,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),_m(e)){if(!e.method.endsWith(Uk))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:Hr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(G_({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else Vh(e)&&this.events.emit(Jn.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Jn.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Wh(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(ji.payload,this.onPayloadHandler),this.provider.off(ji.connect,this.onConnectHandler),this.provider.off(ji.disconnect,this.onDisconnectHandler),this.provider.off(ji.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await s_();QL(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(Jn.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},vt.toMiliseconds($k))))}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var WF=Object.defineProperty,Y_=Object.getOwnPropertySymbols,KF=Object.prototype.hasOwnProperty,VF=Object.prototype.propertyIsEnumerable,J_=(t,e,r)=>e in t?WF(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,X_=(t,e)=>{for(var r in e||(e={}))KF.call(e,r)&&J_(t,r,e[r]);if(Y_)for(var r of Y_(e))VF.call(e,r)&&J_(t,r,e[r]);return t};class Ta extends oT{constructor(e,r,n,i=As,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=qk,this.cached=[],this.initialized=!1,this.storagePrefix=As,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!Yn(o)?this.map.set(this.getKey(o),o):RL(o)?this.map.set(o.id,o):TL(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(f=>Ik(a[f],o[f]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const f=X_(X_({},this.getData(o)),a);this.map.set(o,f),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=Vn(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return oi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class GF{constructor(e,r){this.core=e,this.logger=r,this.name=Vk,this.version=Gk,this.events=new qp,this.initialized=!1,this.storagePrefix=As,this.ignoredPayloadTypes=[Vs],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=pm(),s=await this.core.crypto.setSymKey(i),o=wn(vt.FIVE_MINUTES),a={protocol:S_},f={topic:s,expiry:o,relay:a,active:!1,methods:n?.methods},u=X3({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n?.methods});return this.events.emit(Ma.create,f),this.core.expirer.set(s,o),await this.pairings.set(s,f),await this.core.relayer.subscribe(s,{transportType:n?.transportType}),{topic:s,uri:u}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n?.uri,trace:[Is.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:f,methods:u}=J3(n.uri);i.props.properties.topic=s,i.addTrace(Is.pairing_uri_validation_success),i.addTrace(Is.pairing_uri_not_expired);let h;if(this.pairings.keys.includes(s)){if(h=this.pairings.get(s),i.addTrace(Is.existing_pairing),h.active)throw i.setError(Xs.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Is.pairing_not_expired)}const g=f||wn(vt.FIVE_MINUTES),b={topic:s,relay:a,expiry:g,active:!1,methods:u};this.core.expirer.set(s,g),await this.pairings.set(s,b),i.addTrace(Is.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(Ma.create,b),i.addTrace(Is.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Is.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Xs.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(x){throw i.setError(Xs.subscribe_pairing_topic_failure),x}return i.addTrace(Is.subscribe_pairing_topic_success),b},this.activate=async({topic:n})=>{this.isInitialized();const i=wn(vt.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:f}=Ea();this.events.once(yr("pairing_ping",s),({error:u})=>{u?f(u):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Dr("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,f=this.core.crypto.keychain.get(i);return X3({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:f,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=No(i,s),a=await this.core.crypto.encode(n,o),f=Ef[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,f),o.id},this.sendResult=async(n,i,s)=>{const o=Wh(n,s),a=await this.core.crypto.encode(i,o),f=await this.core.history.get(i,n),u=Ef[f.request.method].res;await this.core.relayer.publish(i,a,u),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=Kh(n,s),a=await this.core.crypto.encode(i,o),f=await this.core.history.get(i,n),u=Ef[f.request.method]?Ef[f.request.method].res:Ef.unregistered_method.res;await this.core.relayer.publish(i,a,u),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Dr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>To(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(Ma.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{Ss(i)?this.events.emit(yr("pairing_ping",s),{}):Bi(i)&&this.events.emit(yr("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(Ma.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Dr("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Dr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!ai(n)){const{message:a}=ut("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Xs.malformed_pairing_uri),new Error(a)}if(!CL(n.uri)){const{message:a}=ut("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Xs.malformed_pairing_uri),new Error(a)}const o=J3(n?.uri);if(!((s=o?.relay)!=null&&s.protocol)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Xs.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=ut("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Xs.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&vt.toMiliseconds(o?.expiryTimestamp){if(!ai(n)){const{message:s}=ut("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!ai(n)){const{message:s}=ut("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!nn(n,!1)){const{message:i}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(To(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ut("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=Vn(r,this.name),this.pairings=new Ta(this.core,this.logger,this.name,this.storagePrefix)}get context(){return oi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Jn.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===Hr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{_m(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):Vh(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Ui.expired,async e=>{const{topic:r}=M3(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(Ma.expire,{topic:r}))})}}class YF extends rT{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new Di.EventEmitter,this.name=Yk,this.version=Jk,this.cached=[],this.initialized=!1,this.storagePrefix=As,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:wn(vt.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(os.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Bi(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(os.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(os.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Vn(r,this.name)}get context(){return oi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:No(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(os.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(os.created,e=>{const r=os.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(os.updated,e=>{const r=os.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(os.deleted,e=>{const r=os.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(vc.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{vt.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(os.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class JF extends cT{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new Di.EventEmitter,this.name=Xk,this.version=Zk,this.cached=[],this.initialized=!1,this.storagePrefix=As,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Ui.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Ui.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Vn(r,this.name)}get context(){return oi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return EN(e);if(typeof e=="number")return SN(e);const{message:r}=ut("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Ui.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=ut("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=ut("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;vt.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Ui.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(vc.pulse,()=>this.checkExpirations()),this.events.on(Ui.created,e=>{const r=Ui.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Ui.expired,e=>{const r=Ui.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Ui.deleted,e=>{const r=Ui.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}}class XF extends uT{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=Qk,this.verifyUrlV3=tB,this.storagePrefix=As,this.version=x_,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&vt.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!uf()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,f=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const u=va.getDocument(),h=this.startAbortTimer(vt.ONE_SECOND*5),g=await new Promise((b,x)=>{const S=()=>{window.removeEventListener("message",D),u.body.removeChild(C),x("attestation aborted")};this.abortController.signal.addEventListener("abort",S);const C=u.createElement("iframe");C.src=f,C.style.display="none",C.addEventListener("error",S,{signal:this.abortController.signal});const D=B=>{if(B.data&&typeof B.data=="string")try{const L=JSON.parse(B.data);if(L.type==="verify_attestation"){if(ug(L.attestation).payload.id!==o)return;clearInterval(h),u.body.removeChild(C),this.abortController.signal.removeEventListener("abort",S),window.removeEventListener("message",D),b(L.attestation===null?"":L.attestation)}}catch(L){this.logger.warn(L)}};u.body.appendChild(C),window.addEventListener("message",D,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",g),g}catch(u){this.logger.warn(u)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(ug(s).payload.id!==a)return;const u=await this.isValidJwtAttestation(s);if(u){if(!u.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return u}}if(!o)return;const f=this.getVerifyUrl(i?.verifyUrl);return this.fetchAttestation(o,f)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(vt.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Sf;return rB.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Sf}`),s=Sf),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(vt.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=fL(i,s.publicKey),a={hasExpired:vt.toMiliseconds(o.exp)this.abortController.abort(),vt.toMiliseconds(e))}}class ZF extends fT{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=nB,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,f=`${iB}/${this.projectId}/clients`;await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=Vn(r,this.context)}}var QF=Object.defineProperty,Z_=Object.getOwnPropertySymbols,ej=Object.prototype.hasOwnProperty,tj=Object.prototype.propertyIsEnumerable,Q_=(t,e,r)=>e in t?QF(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Mf=(t,e)=>{for(var r in e||(e={}))ej.call(e,r)&&Q_(t,r,e[r]);if(Z_)for(var r of Z_(e))tj.call(e,r)&&Q_(t,r,e[r]);return t};class rj extends lT{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=oB,this.storagePrefix=As,this.storageVersion=sB,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!fm())try{const i={eventId:R3(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:S3(this.core.relayer.protocol,this.core.relayer.version,Em)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:f}}=i,u=R3(),h=this.core.projectId||"",g=Date.now(),b=Mf({eventId:u,timestamp:g,props:{event:s,type:o,properties:{topic:a,trace:f}},bundleId:h,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,b),this.shouldPersist=!0),b},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(f=>f.props.properties.topic===o);if(a)return Mf(Mf({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(vc.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{vt.fromMiliseconds(Date.now())-vt.fromMiliseconds(i.timestamp)>aB&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Mf(Mf({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${cB}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${Em}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>E3().url,this.logger=Vn(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var nj=Object.defineProperty,e6=Object.getOwnPropertySymbols,ij=Object.prototype.hasOwnProperty,sj=Object.prototype.propertyIsEnumerable,t6=(t,e,r)=>e in t?nj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,r6=(t,e)=>{for(var r in e||(e={}))ij.call(e,r)&&t6(t,r,e[r]);if(e6)for(var r of e6(e))sj.call(e,r)&&t6(t,r,e[r]);return t};class Mm extends tT{constructor(e){var r;super(e),this.protocol=w_,this.version=x_,this.name=__,this.events=new Di.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:f})=>{if(!o||!a)return;const u={topic:o,message:a,publishedAt:Date.now(),transportType:Hr.link_mode};this.relayer.onLinkMessageEvent(u,{sessionExists:f})},this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||A_,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=hh({level:typeof e?.logger=="string"&&e.logger?e.logger:Mk.logger}),{logger:i,chunkLoggerController:s}=eT({opts:n,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Vn(i,this.name),this.heartbeat=new sR,this.crypto=new TF(this,this.logger,e?.keychain),this.history=new YF(this,this.logger),this.expirer=new JF(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new BR(r6(r6({},Ck),e?.storageOptions)),this.relayer=new HF({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new GF(this,this.logger),this.verify=new XF(this,this.logger,this.storage),this.echoClient=new ZF(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new rj(this,this.logger,e?.telemetryEnabled)}static async init(e){const r=new Mm(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(zk,n),r}get context(){return oi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(P_,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(P_)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const oj=Mm,n6="wc",i6=2,s6="client",Cm=`${n6}@${i6}:${s6}:`,Rm={name:s6,logger:"error"},o6="WALLETCONNECT_DEEPLINK_CHOICE",aj="proposal",a6="Proposal expired",cj="session",Ic=vt.SEVEN_DAYS,uj="engine",Mn={wc_sessionPropose:{req:{ttl:vt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:vt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:vt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:vt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:vt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:vt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:vt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:vt.FIVE_MINUTES,prompt:!1,tag:1119}}},Tm={min:vt.FIVE_MINUTES,max:vt.SEVEN_DAYS},Ms={idle:"IDLE",active:"ACTIVE"},fj="request",lj=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],hj="wc",dj="auth",pj="authKeys",gj="pairingTopics",mj="requests",Yh=`${hj}@${1.5}:${dj}:`,Jh=`${Yh}:PUB_KEY`;var vj=Object.defineProperty,bj=Object.defineProperties,yj=Object.getOwnPropertyDescriptors,c6=Object.getOwnPropertySymbols,wj=Object.prototype.hasOwnProperty,xj=Object.prototype.propertyIsEnumerable,u6=(t,e,r)=>e in t?vj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,en=(t,e)=>{for(var r in e||(e={}))wj.call(e,r)&&u6(t,r,e[r]);if(c6)for(var r of c6(e))xj.call(e,r)&&u6(t,r,e[r]);return t},cs=(t,e)=>bj(t,yj(e));class _j extends dT{constructor(e){super(e),this.name=uj,this.events=new qp,this.initialized=!1,this.requestQueue={state:Ms.idle,queue:[]},this.sessionRequestQueue={state:Ms.idle,queue:[]},this.requestQueueDelay=vt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Mn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},vt.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=cs(en({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:f}=n;let u=i,h,g=!1;try{u&&(g=this.client.core.pairing.pairings.get(u).active)}catch(F){throw this.client.logger.error(`connect() -> pairing.get(${u}) failed`),F}if(!u||!g){const{topic:F,uri:k}=await this.client.core.pairing.create();u=F,h=k}if(!u){const{message:F}=ut("NO_MATCHING_KEY",`connect() pairing topic: ${u}`);throw new Error(F)}const b=await this.client.core.crypto.generateKeyPair(),x=Mn.wc_sessionPropose.req.ttl||vt.FIVE_MINUTES,S=wn(x),C=en({requiredNamespaces:s,optionalNamespaces:o,relays:f??[{protocol:S_}],proposer:{publicKey:b,metadata:this.client.metadata},expiryTimestamp:S,pairingTopic:u},a&&{sessionProperties:a}),{reject:D,resolve:B,done:L}=Ea(x,a6);this.events.once(yr("session_connect"),async({error:F,session:k})=>{if(F)D(F);else if(k){k.self.publicKey=b;const $=cs(en({},k),{pairingTopic:C.pairingTopic,requiredNamespaces:C.requiredNamespaces,optionalNamespaces:C.optionalNamespaces,transportType:Hr.relay});await this.client.session.set(k.topic,$),await this.setExpiry(k.topic,k.expiry),u&&await this.client.core.pairing.updateMetadata({topic:u,metadata:k.peer.metadata}),this.cleanupDuplicatePairings($),B($)}});const H=await this.sendRequest({topic:u,method:"wc_sessionPropose",params:C,throwOnFailedPublish:!0});return await this.setProposal(H,en({id:H},C)),{uri:h,approval:L}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r?.id)==null?void 0:n.toString(),trace:[as.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(W){throw o.setError(Ca.no_internet_connection),W}try{await this.isValidProposalId(r?.id)}catch(W){throw this.client.logger.error(`approve() -> proposal.get(${r?.id}) failed`),o.setError(Ca.proposal_not_found),W}try{await this.isValidApprove(r)}catch(W){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(Ca.session_approve_namespace_validation_failure),W}const{id:a,relayProtocol:f,namespaces:u,sessionProperties:h,sessionConfig:g}=r,b=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:x,proposer:S,requiredNamespaces:C,optionalNamespaces:D}=b;let B=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:x});B||(B=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:as.session_approve_started,properties:{topic:x,trace:[as.session_approve_started,as.session_namespaces_validation_success]}}));const L=await this.client.core.crypto.generateKeyPair(),H=S.publicKey,F=await this.client.core.crypto.generateSharedKey(L,H),k=en(en({relay:{protocol:f??"irn"},namespaces:u,controller:{publicKey:L,metadata:this.client.metadata},expiry:wn(Ic)},h&&{sessionProperties:h}),g&&{sessionConfig:g}),$=Hr.relay;B.addTrace(as.subscribing_session_topic);try{await this.client.core.relayer.subscribe(F,{transportType:$})}catch(W){throw B.setError(Ca.subscribe_session_topic_failure),W}B.addTrace(as.subscribe_session_topic_success);const R=cs(en({},k),{topic:F,requiredNamespaces:C,optionalNamespaces:D,pairingTopic:x,acknowledged:!1,self:k.controller,peer:{publicKey:S.publicKey,metadata:S.metadata},controller:L,transportType:Hr.relay});await this.client.session.set(F,R),B.addTrace(as.store_session);try{B.addTrace(as.publishing_session_settle),await this.sendRequest({topic:F,method:"wc_sessionSettle",params:k,throwOnFailedPublish:!0}).catch(W=>{throw B?.setError(Ca.session_settle_publish_failure),W}),B.addTrace(as.session_settle_publish_success),B.addTrace(as.publishing_session_approve),await this.sendResult({id:a,topic:x,result:{relay:{protocol:f??"irn"},responderPublicKey:L},throwOnFailedPublish:!0}).catch(W=>{throw B?.setError(Ca.session_approve_publish_failure),W}),B.addTrace(as.session_approve_publish_success)}catch(W){throw this.client.logger.error(W),this.client.session.delete(F,Dr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(F),W}return this.client.core.eventClient.deleteEvent({eventId:B.eventId}),await this.client.core.pairing.updateMetadata({topic:x,metadata:S.metadata}),await this.client.proposal.delete(a,Dr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:x}),await this.setExpiry(F,wn(Ic)),{topic:F,acknowledged:()=>Promise.resolve(this.client.session.get(F))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:Mn.wc_sessionPropose.reject}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(g){throw this.client.logger.error("update() -> isValidUpdate() failed"),g}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=Ea(),f=Oo(),u=Ia().toString(),h=this.client.session.get(n).namespaces;return this.events.once(yr("session_update",f),({error:g})=>{g?a(g):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:f,relayRpcId:u}).catch(g=>{this.client.logger.error(g),this.client.session.update(n,{namespaces:h}),a(g)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(f){throw this.client.logger.error("extend() -> isValidExtend() failed"),f}const{topic:n}=r,i=Oo(),{done:s,resolve:o,reject:a}=Ea();return this.events.once(yr("session_extend",i),({error:f})=>{f?a(f):o()}),await this.setExpiry(n,wn(Ic)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(f=>{a(f)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(S){throw this.client.logger.error("request() -> isValidRequest() failed"),S}const{chainId:n,request:i,topic:s,expiry:o=Mn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);a?.transportType===Hr.relay&&await this.confirmOnlineStateOrThrow();const f=Oo(),u=Ia().toString(),{done:h,resolve:g,reject:b}=Ea(o,"Request expired. Please try again.");this.events.once(yr("session_request",f),({error:S,result:C})=>{S?b(S):g(C)});const x=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return x?(await this.sendRequest({clientRpcId:f,relayRpcId:u,topic:s,method:"wc_sessionRequest",params:{request:cs(en({},i),{expiryTimestamp:wn(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:x}).catch(S=>b(S)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:f}),await h()):await Promise.all([new Promise(async S=>{await this.sendRequest({clientRpcId:f,relayRpcId:u,topic:s,method:"wc_sessionRequest",params:{request:cs(en({},i),{expiryTimestamp:wn(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(C=>b(C)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:f}),S()}),new Promise(async S=>{var C;if(!((C=a.sessionConfig)!=null&&C.disableDeepLink)){const D=await IN(this.client.core.storage,o6);await AN({id:f,topic:s,wcDeepLink:D})}S()}),h()]).then(S=>S[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===Hr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);Ss(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Bi(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=Oo(),s=Ia().toString(),{done:o,resolve:a,reject:f}=Ea();this.events.once(yr("session_ping",i),({error:u})=>{u?f(u):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=Ia().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Dr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ut("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>IL(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?Hr.link_mode:Hr.relay;o===Hr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:f="",uri:u,domain:h,nonce:g,type:b,exp:x,nbf:S,methods:C=[],expiry:D}=r,B=[...r.resources||[]],{topic:L,uri:H}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:L,uri:H}});const F=await this.client.core.crypto.generateKeyPair(),k=qh(F);if(await Promise.all([this.client.auth.authKeys.set(Jh,{responseTopic:k,publicKey:F}),this.client.auth.pairingTopics.set(k,{topic:k,pairingTopic:L})]),await this.client.core.relayer.subscribe(k,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${L}`),C.length>0){const{namespace:A}=Ec(a[0]);let E=GN(A,"request",C);$h(B)&&(E=JN(E,B.pop())),B.push(E)}const $=D&&D>Mn.wc_sessionAuthenticate.req.ttl?D:Mn.wc_sessionAuthenticate.req.ttl,R={authPayload:{type:b??"caip122",chains:a,statement:f,aud:u,domain:h,version:"1",nonce:g,iat:new Date().toISOString(),exp:x,nbf:S,resources:B},requester:{publicKey:F,metadata:this.client.metadata},expiryTimestamp:wn($)},W={eip155:{chains:a,methods:[...new Set(["personal_sign",...C])],events:["chainChanged","accountsChanged"]}},V={requiredNamespaces:{},optionalNamespaces:W,relays:[{protocol:"irn"}],pairingTopic:L,proposer:{publicKey:F,metadata:this.client.metadata},expiryTimestamp:wn(Mn.wc_sessionPropose.req.ttl)},{done:X,resolve:q,reject:_}=Ea($,"Request expired"),v=async({error:A,session:E})=>{if(this.events.off(yr("session_request",p),l),A)_(A);else if(E){E.self.publicKey=F,await this.client.session.set(E.topic,E),await this.setExpiry(E.topic,E.expiry),L&&await this.client.core.pairing.updateMetadata({topic:L,metadata:E.peer.metadata});const w=this.client.session.get(E.topic);await this.deleteProposal(m),q({session:w})}},l=async A=>{var E,w,I;if(await this.deletePendingAuthRequest(p,{message:"fulfilled",code:0}),A.error){const Z=Dr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return A.error.code===Z.code?void 0:(this.events.off(yr("session_connect"),v),_(A.error.message))}await this.deleteProposal(m),this.events.off(yr("session_connect"),v);const{cacaos:M,responder:z}=A.result,se=[],O=[];for(const Z of M){await N3({cacao:Z,projectId:this.client.core.projectId})||(this.client.logger.error(Z,"Signature verification failed"),_(Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:te}=Z,N=$h(te.resources),Q=[hm(te.iss)],ne=Uh(te.iss);if(N){const de=B3(N),ce=F3(N);se.push(...de),Q.push(...ce)}for(const de of Q)O.push(`${de}:${ne}`)}const ie=await this.client.core.crypto.generateSharedKey(F,z.publicKey);let ee;se.length>0&&(ee={topic:ie,acknowledged:!0,self:{publicKey:F,metadata:this.client.metadata},peer:z,controller:z.publicKey,expiry:wn(Ic),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:L,namespaces:Z3([...new Set(se)],[...new Set(O)]),transportType:o},await this.client.core.relayer.subscribe(ie,{transportType:o}),await this.client.session.set(ie,ee),L&&await this.client.core.pairing.updateMetadata({topic:L,metadata:z.metadata}),ee=this.client.session.get(ie)),(E=this.client.metadata.redirect)!=null&&E.linkMode&&(w=z.metadata.redirect)!=null&&w.linkMode&&(I=z.metadata.redirect)!=null&&I.universal&&n&&(this.client.core.addLinkModeSupportedApp(z.metadata.redirect.universal),this.client.session.update(ie,{transportType:Hr.link_mode})),q({auths:M,session:ee})},p=Oo(),m=Oo();this.events.once(yr("session_connect"),v),this.events.once(yr("session_request",p),l);let y;try{if(s){const A=No("wc_sessionAuthenticate",R,p);this.client.core.history.set(L,A);const E=await this.client.core.crypto.encode("",A,{type:pf,encoding:hf});y=zh(n,L,E)}else await Promise.all([this.sendRequest({topic:L,method:"wc_sessionAuthenticate",params:R,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:p}),this.sendRequest({topic:L,method:"wc_sessionPropose",params:V,expiry:Mn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:m})])}catch(A){throw this.events.off(yr("session_connect"),v),this.events.off(yr("session_request",p),l),A}return await this.setProposal(m,en({id:m},V)),await this.setAuthRequest(p,{request:cs(en({},R),{verifyContext:{}}),pairingTopic:L,transportType:o}),{uri:y??H,response:X}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[Ra.authenticated_session_approve_started]}});try{this.isInitialized()}catch(D){throw s.setError(Af.no_internet_connection),D}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Af.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||Hr.relay;a===Hr.relay&&await this.confirmOnlineStateOrThrow();const f=o.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),h=qh(f),g={type:Vs,receiverPublicKey:f,senderPublicKey:u},b=[],x=[];for(const D of i){if(!await N3({cacao:D,projectId:this.client.core.projectId})){s.setError(Af.invalid_cacao);const k=Dr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:h,error:k,encodeOpts:g}),new Error(k.message)}s.addTrace(Ra.cacaos_verified);const{p:B}=D,L=$h(B.resources),H=[hm(B.iss)],F=Uh(B.iss);if(L){const k=B3(L),$=F3(L);b.push(...k),H.push(...$)}for(const k of H)x.push(`${k}:${F}`)}const S=await this.client.core.crypto.generateSharedKey(u,f);s.addTrace(Ra.create_authenticated_session_topic);let C;if(b?.length>0){C={topic:S,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:f,metadata:o.requester.metadata},controller:f,expiry:wn(Ic),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Z3([...new Set(b)],[...new Set(x)]),transportType:a},s.addTrace(Ra.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(S,{transportType:a})}catch(D){throw s.setError(Af.subscribe_authenticated_session_topic_failure),D}s.addTrace(Ra.subscribe_authenticated_session_topic_success),await this.client.session.set(S,C),s.addTrace(Ra.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(Ra.publishing_authenticated_session_approve);try{await this.sendResult({topic:h,id:n,result:{cacaos:i,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:g,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(D){throw s.setError(Af.authenticated_session_approve_publish_failure),D}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:C}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===Hr.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),f=qh(o),u={type:Vs,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:f,error:i,encodeOpts:u,rpcOpts:Mn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Dr("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return L3(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:f}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,Dr("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(f.publicKey)&&await this.client.core.crypto.deleteKeyPair(f.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(o6).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===i&&this.deletePendingSessionRequest(u.id,Dr("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Ms.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r);this.client.core.eventClient.getEvent({topic:i.pairingTopic})?.setError(Ca.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Dr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Ms.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,wn(Mn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=Hr.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||wn(Mn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:f,throwOnFailedPublish:u,appLink:h}=r,g=No(i,s,f);let b;const x=!!h;try{const D=x?hf:Do;b=await this.client.core.crypto.encode(n,g,{encoding:D})}catch(D){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),D}let S;if(lj.includes(i)){const D=Gs(JSON.stringify(g)),B=Gs(b);S=await this.client.core.verify.register({id:B,decryptedId:D})}const C=Mn[i].req;if(C.attestation=S,o&&(C.ttl=o),a&&(C.id=a),this.client.core.history.set(n,g),x){const D=zh(h,n,b);await global.Linking.openURL(D,this.client.name)}else{const D=Mn[i].req;o&&(D.ttl=o),a&&(D.id=a),u?(D.internal=cs(en({},D.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,b,D)):this.client.core.relayer.publish(n,b,D).catch(B=>this.client.logger.error(B))}return g.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:f}=r,u=Wh(n,s);let h;const g=f&&typeof(global==null?void 0:global.Linking)<"u";try{const x=g?hf:Do;h=await this.client.core.crypto.encode(i,u,cs(en({},a||{}),{encoding:x}))}catch(x){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),x}let b;try{b=await this.client.core.history.get(i,n)}catch(x){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),x}if(g){const x=zh(f,i,h);await global.Linking.openURL(x,this.client.name)}else{const x=Mn[b.request.method].res;o?(x.internal=cs(en({},x.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,h,x)):this.client.core.relayer.publish(i,h,x).catch(S=>this.client.logger.error(S))}await this.client.core.history.resolve(u)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:f}=r,u=Kh(n,s);let h;const g=f&&typeof(global==null?void 0:global.Linking)<"u";try{const x=g?hf:Do;h=await this.client.core.crypto.encode(i,u,cs(en({},o||{}),{encoding:x}))}catch(x){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),x}let b;try{b=await this.client.core.history.get(i,n)}catch(x){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),x}if(g){const x=zh(f,i,h);await global.Linking.openURL(x,this.client.name)}else{const x=a||Mn[b.request.method].res;this.client.core.relayer.publish(i,h,x)}await this.client.core.history.resolve(u)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;To(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{To(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Ms.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Ms.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Ms.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,f=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:f}))switch(f){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${f}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=ut("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:f}=i;try{const u=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(en({},i.params));const h=a.expiryTimestamp||wn(Mn.wc_sessionPropose.req.ttl),g=en({id:f,pairingTopic:n,expiryTimestamp:h},a);await this.setProposal(f,g);const b=await this.getVerifyContext({attestationId:s,hash:Gs(JSON.stringify(i)),encryptedId:o,metadata:g.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),u?.setError(Xs.proposal_listener_not_found)),u?.addTrace(Is.emit_session_proposal),this.client.events.emit("session_proposal",{id:f,params:g,verifyContext:b})}catch(u){await this.sendError({id:f,topic:n,error:u,rpcOpts:Mn.wc_sessionPropose.autoReject}),this.client.logger.error(u)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(Ss(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const f=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:f});const u=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});const h=await this.client.core.crypto.generateSharedKey(f,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:h});const g=await this.client.core.relayer.subscribe(h,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:g}),await this.client.core.pairing.activate({topic:r})}else if(Bi(n)){await this.client.proposal.delete(s,Dr("USER_DISCONNECTED"));const o=yr("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(yr("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:f,namespaces:u,sessionProperties:h,sessionConfig:g}=n.params,b=cs(en(en({topic:r,relay:o,expiry:f,namespaces:u,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},h&&{sessionProperties:h}),g&&{sessionConfig:g}),{transportType:Hr.relay}),x=yr("session_connect");if(this.events.listenerCount(x)===0)throw new Error(`emitting ${x} without any listeners 997`);this.events.emit(yr("session_connect"),{session:b}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;Ss(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(yr("session_approve",i),{})):Bi(n)&&(await this.client.session.delete(r,Dr("USER_DISCONNECTED")),this.events.emit(yr("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=wf.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Dr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(en({topic:r},i));try{wf.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(f){throw wf.delete(o),f}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=yr("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Ss(n)?this.events.emit(yr("session_update",i),{}):Bi(n)&&this.events.emit(yr("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,wn(Ic)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=yr("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Ss(n)?this.events.emit(yr("session_extend",i),{}):Bi(n)&&this.events.emit(yr("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=yr("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{Ss(n)?this.events.emit(yr("session_ping",i),{}):Bi(n)&&this.events.emit(yr("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(Jn.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Dr("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:f,encryptedId:u,transportType:h}=r,{id:g,params:b}=a;try{await this.isValidRequest(en({topic:o},b));const x=this.client.session.get(o),S=await this.getVerifyContext({attestationId:f,hash:Gs(JSON.stringify(No("wc_sessionRequest",b,g))),encryptedId:u,metadata:x.peer.metadata,transportType:h}),C={id:g,topic:o,params:b,verifyContext:S};await this.setPendingSessionRequest(C),h===Hr.link_mode&&(n=x.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=x.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(C):(this.addSessionRequestToSessionRequestQueue(C),this.processSessionRequestQueue())}catch(x){await this.sendError({id:g,topic:o,error:x}),this.client.logger.error(x)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=yr("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Ss(n)?this.events.emit(yr("session_request",i),{result:n.result}):Bi(n)&&this.events.emit(yr("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=wf.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(en({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),wf.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),Ss(n)?this.events.emit(yr("session_request",i),{result:n.result}):Bi(n)&&this.events.emit(yr("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:f}=r;try{const{requester:u,authPayload:h,expiryTimestamp:g}=s.params,b=await this.getVerifyContext({attestationId:o,hash:Gs(JSON.stringify(s)),encryptedId:a,metadata:u.metadata,transportType:f}),x={requester:u,pairingTopic:i,id:s.id,authPayload:h,verifyContext:b,expiryTimestamp:g};await this.setAuthRequest(s.id,{request:x,pairingTopic:i,transportType:f}),f===Hr.link_mode&&(n=u.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:b})}catch(u){this.client.logger.error(u);const h=s.params.requester.publicKey,g=await this.client.core.crypto.generateKeyPair(),b=this.getAppLinkIfEnabled(s.params.requester.metadata,f),x={type:Vs,receiverPublicKey:h,senderPublicKey:g};await this.sendError({id:s.id,topic:i,error:u,encodeOpts:x,rpcOpts:Mn.wc_sessionAuthenticate.autoReject,appLink:b})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Ms.idle,this.processSessionRequestQueue()},vt.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=yr("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(yr("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Ms.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Ms.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:No("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!ai(r)){const{message:f}=ut("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(f)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(Yn(n)||await this.isValidPairingTopic(n),!jL(a)){const{message:f}=ut("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(f)}!Yn(i)&&yf(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!Yn(s)&&yf(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),Yn(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=FL(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!ai(r))throw new Error(ut("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),f=bm(i,"approve()");if(f)throw new Error(f.message);const u=n_(a.requiredNamespaces,i,"approve()");if(u)throw new Error(u.message);if(!nn(s,!0)){const{message:h}=ut("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(h)}Yn(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!ai(r)){const{message:s}=ut("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!$L(i)){const{message:s}=ut("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!ai(r)){const{message:u}=ut("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(u)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!t_(n)){const{message:u}=ut("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}const a=DL(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const f=bm(s,"onSessionSettleRequest()");if(f)throw new Error(f.message);if(To(o)){const{message:u}=ut("EXPIRED","onSessionSettleRequest()");throw new Error(u)}},this.isValidUpdate=async r=>{if(!ai(r)){const{message:f}=ut("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(f)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=bm(i,"update()");if(o)throw new Error(o.message);const a=n_(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!ai(r)){const{message:i}=ut("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!ai(r)){const{message:f}=ut("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(f)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!r_(a,s)){const{message:f}=ut("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(f)}if(!qL(i)){const{message:f}=ut("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(f)}if(!WL(a,s,i.method)){const{message:f}=ut("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(f)}if(o&&!YL(o,Tm)){const{message:f}=ut("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Tm.min} and ${Tm.max}`);throw new Error(f)}},this.isValidRespond=async r=>{var n;if(!ai(r)){const{message:o}=ut("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r?.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!zL(s)){const{message:o}=ut("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!ai(r)){const{message:i}=ut("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!ai(r)){const{message:a}=ut("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!r_(o,s)){const{message:a}=ut("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!HL(i)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!KL(o,s,i.name)){const{message:a}=ut("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!ai(r)){const{message:i}=ut("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!nn(i,!1))throw new Error("uri is required parameter");if(!nn(s,!1))throw new Error("domain is required parameter");if(!nn(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(f=>Ec(f).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Ec(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,f={verified:{verifyUrl:o.verifyUrl||Sf,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Hr.link_mode){const h=this.getAppLinkIfEnabled(o,a);return f.verified.validation=h&&new URL(h).origin===new URL(o.url).origin?"VALID":"INVALID",f}const u=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});u&&(f.verified.origin=u.origin,f.verified.isScam=u.isScam,f.verified.validation=u.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(u){this.client.logger.warn(u)}return this.client.logger.debug(`Verify context: ${JSON.stringify(f)}`),f},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!nn(i,!1)){const{message:s}=ut("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=ut("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,f,u,h,g,b;return!r||n!==Hr.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((u=(f=this.client.metadata)==null?void 0:f.redirect)==null?void 0:u.universal)!==""&&((h=r?.redirect)==null?void 0:h.universal)!==void 0&&((g=r?.redirect)==null?void 0:g.universal)!==""&&((b=r?.redirect)==null?void 0:b.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r?.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=C3(r,"topic")||"",i=decodeURIComponent(C3(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:Hr.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(fm()||Sc()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ut("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Jn.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(Jh)?this.client.auth.authKeys.get(Jh):{publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===Hr.link_mode?hf:Do});try{_m(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:Gs(n)})):Vh(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(f){this.client.logger.error(f)}}registerExpirerEvents(){this.client.core.expirer.on(Ui.expired,async e=>{const{topic:r,id:n}=M3(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ut("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,ut("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(Ma.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(Ma.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!nn(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(To(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=ut("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!nn(e,!1)){const{message:r}=ut("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(To(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=ut("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=ut("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(nn(e,!1)){const{message:r}=ut("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=ut("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!UL(e)){const{message:r}=ut("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=ut("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(To(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=ut("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class Ej extends Ta{constructor(e,r){super(e,r,aj,Cm),this.core=e,this.logger=r}}let Sj=class extends Ta{constructor(e,r){super(e,r,cj,Cm),this.core=e,this.logger=r}};class Aj extends Ta{constructor(e,r){super(e,r,fj,Cm,n=>n.id),this.core=e,this.logger=r}}class Pj extends Ta{constructor(e,r){super(e,r,pj,Yh,()=>Jh),this.core=e,this.logger=r}}class Ij extends Ta{constructor(e,r){super(e,r,gj,Yh),this.core=e,this.logger=r}}class Mj extends Ta{constructor(e,r){super(e,r,mj,Yh,n=>n.id),this.core=e,this.logger=r}}class Cj{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new Pj(this.core,this.logger),this.pairingTopics=new Ij(this.core,this.logger),this.requests=new Mj(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class Dm extends hT{constructor(e){super(e),this.protocol=n6,this.version=i6,this.name=Rm.name,this.events=new Di.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=e?.name||Rm.name,this.metadata=e?.metadata||E3(),this.signConfig=e?.signConfig;const r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Gu(hh({level:e?.logger||Rm.logger}));this.core=e?.core||new oj(e),this.logger=Vn(r,this.name),this.session=new Sj(this.core,this.logger),this.proposal=new Ej(this.core,this.logger),this.pendingRequest=new Aj(this.core,this.logger),this.engine=new _j(this),this.auth=new Cj(this.core,this.logger)}static async init(e){const r=new Dm(e);return await r.initialize(),r}get context(){return oi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var Cf={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */h0.exports,function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",l=500,d="__lodash_placeholder__",p=1,y=2,_=4,M=1,O=2,L=1,B=2,k=4,H=8,U=16,z=32,Z=64,R=128,W=256,ie=512,me=30,j="...",E=800,m=16,f=1,g=2,v=3,x=1/0,S=9007199254740991,A=17976931348623157e292,b=NaN,P=4294967295,I=P-1,F=P>>>1,ce=[["ary",R],["bind",L],["bindKey",B],["curry",H],["curryRight",U],["flip",ie],["partial",z],["partialRight",Z],["rearg",W]],D="[object Arguments]",se="[object Array]",ee="[object AsyncFunction]",J="[object Boolean]",Q="[object Date]",T="[object DOMException]",X="[object Error]",re="[object Function]",ge="[object GeneratorFunction]",oe="[object Map]",fe="[object Number]",be="[object Null]",Me="[object Object]",Ne="[object Promise]",Te="[object Proxy]",$e="[object RegExp]",Ie="[object Set]",Le="[object String]",Ve="[object Symbol]",ke="[object Undefined]",ze="[object WeakMap]",He="[object WeakSet]",Se="[object ArrayBuffer]",Qe="[object DataView]",ct="[object Float32Array]",Be="[object Float64Array]",et="[object Int8Array]",rt="[object Int16Array]",Je="[object Int32Array]",gt="[object Uint8Array]",ht="[object Uint8ClampedArray]",ft="[object Uint16Array]",Ht="[object Uint32Array]",Jt=/\b__p \+= '';/g,St=/\b(__p \+=) '' \+/g,er=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Xt=/&(?:amp|lt|gt|quot|#39);/g,Ot=/[&<>"']/g,Bt=RegExp(Xt.source),Tt=RegExp(Ot.source),bt=/<%-([\s\S]+?)%>/g,Dt=/<%([\s\S]+?)%>/g,Lt=/<%=([\s\S]+?)%>/g,yt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$t=/^\w*$/,jt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(nt.source),$=/^\s+/,K=/\s/,G=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C=/\{\n\/\* \[wrapped with (.+)\] \*/,Y=/,? & /,q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ae=/[()=,{}\[\]\/\s]/,pe=/\\(\\)?/g,_e=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Re=/\w*$/,De=/^[-+]0x[0-9a-f]+$/i,it=/^0b[01]+$/i,Ue=/^\[object .+?Constructor\]$/,mt=/^0o[0-7]+$/i,st=/^(?:0|[1-9]\d*)$/,tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,Rt=/['\n\r\u2028\u2029\\]/g,Mt="\\ud800-\\udfff",Et="\\u0300-\\u036f",dt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",ot=Et+dt+_t,wt="\\u2700-\\u27bf",lt="a-z\\xdf-\\xf6\\xf8-\\xff",at="\\xac\\xb1\\xd7\\xf7",Ae="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Pe="\\u2000-\\u206f",Ge=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="A-Z\\xc0-\\xd6\\xd8-\\xde",qe="\\ufe0e\\ufe0f",Xe=at+Ae+Pe+Ge,kt="['’]",Wt="["+Mt+"]",Zt="["+Xe+"]",Kt="["+ot+"]",de="\\d+",nr="["+wt+"]",pr="["+lt+"]",gr="[^"+Mt+Xe+de+wt+lt+je+"]",Qt="\\ud83c[\\udffb-\\udfff]",mr="(?:"+Kt+"|"+Qt+")",lr="[^"+Mt+"]",Lr="(?:\\ud83c[\\udde6-\\uddff]){2}",vr="[\\ud800-\\udbff][\\udc00-\\udfff]",xr="["+je+"]",Br="\\u200d",$r="(?:"+pr+"|"+gr+")",Ir="(?:"+xr+"|"+gr+")",ln="(?:"+kt+"(?:d|ll|m|re|s|t|ve))?",hn="(?:"+kt+"(?:D|LL|M|RE|S|T|VE))?",dn=mr+"?",vp="["+qe+"]?",Gb="(?:"+Br+"(?:"+[lr,Lr,vr].join("|")+")"+vp+dn+")*",jo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",bp="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",yp=vp+dn+Gb,ef="(?:"+[nr,Lr,vr].join("|")+")"+yp,Yb="(?:"+[lr+Kt+"?",Kt,Lr,vr,Wt].join("|")+")",bh=RegExp(kt,"g"),Jb=RegExp(Kt,"g"),tf=RegExp(Qt+"(?="+Qt+")|"+Yb+yp,"g"),wp=RegExp([xr+"?"+pr+"+"+ln+"(?="+[Zt,xr,"$"].join("|")+")",Ir+"+"+hn+"(?="+[Zt,xr+$r,"$"].join("|")+")",xr+"?"+$r+"+"+ln,xr+"+"+hn,bp,jo,de,ef].join("|"),"g"),xp=RegExp("["+Br+Mt+ot+qe+"]"),Oc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,_p=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Xb=-1,Fr={};Fr[ct]=Fr[Be]=Fr[et]=Fr[rt]=Fr[Je]=Fr[gt]=Fr[ht]=Fr[ft]=Fr[Ht]=!0,Fr[D]=Fr[se]=Fr[Se]=Fr[J]=Fr[Qe]=Fr[Q]=Fr[X]=Fr[re]=Fr[oe]=Fr[fe]=Fr[Me]=Fr[$e]=Fr[Ie]=Fr[Le]=Fr[ze]=!1;var kr={};kr[D]=kr[se]=kr[Se]=kr[Qe]=kr[J]=kr[Q]=kr[ct]=kr[Be]=kr[et]=kr[rt]=kr[Je]=kr[oe]=kr[fe]=kr[Me]=kr[$e]=kr[Ie]=kr[Le]=kr[Ve]=kr[gt]=kr[ht]=kr[ft]=kr[Ht]=!0,kr[X]=kr[re]=kr[ze]=!1;var ue={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},we={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye={"&":"&","<":"<",">":">",""":'"',"'":"'"},It={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},jr=parseFloat,ir=parseInt,Yr=typeof nn=="object"&&nn&&nn.Object===Object&&nn,wn=typeof self=="object"&&self&&self.Object===Object&&self,Er=Yr||wn||Function("return this")(),Ur=e&&!e.nodeType&&e,pn=Ur&&!0&&t&&!t.nodeType&&t,xi=pn&&pn.exports===Ur,xn=xi&&Yr.process,Jr=function(){try{var ye=pn&&pn.require&&pn.require("util").types;return ye||xn&&xn.binding&&xn.binding("util")}catch{}}(),si=Jr&&Jr.isArrayBuffer,Cs=Jr&&Jr.isDate,os=Jr&&Jr.isMap,oo=Jr&&Jr.isRegExp,yh=Jr&&Jr.isSet,Nc=Jr&&Jr.isTypedArray;function Ln(ye,Fe,Ce){switch(Ce.length){case 0:return ye.call(Fe);case 1:return ye.call(Fe,Ce[0]);case 2:return ye.call(Fe,Ce[0],Ce[1]);case 3:return ye.call(Fe,Ce[0],Ce[1],Ce[2])}return ye.apply(Fe,Ce)}function hee(ye,Fe,Ce,Ct){for(var tr=-1,Mr=ye==null?0:ye.length;++tr-1}function Zb(ye,Fe,Ce){for(var Ct=-1,tr=ye==null?0:ye.length;++Ct-1;);return Ce}function R9(ye,Fe){for(var Ce=ye.length;Ce--&&rf(Fe,ye[Ce],0)>-1;);return Ce}function xee(ye,Fe){for(var Ce=ye.length,Ct=0;Ce--;)ye[Ce]===Fe&&++Ct;return Ct}var _ee=ry(ue),Eee=ry(we);function See(ye){return"\\"+It[ye]}function Aee(ye,Fe){return ye==null?r:ye[Fe]}function nf(ye){return xp.test(ye)}function Pee(ye){return Oc.test(ye)}function Mee(ye){for(var Fe,Ce=[];!(Fe=ye.next()).done;)Ce.push(Fe.value);return Ce}function oy(ye){var Fe=-1,Ce=Array(ye.size);return ye.forEach(function(Ct,tr){Ce[++Fe]=[tr,Ct]}),Ce}function D9(ye,Fe){return function(Ce){return ye(Fe(Ce))}}function Na(ye,Fe){for(var Ce=-1,Ct=ye.length,tr=0,Mr=[];++Ce-1}function pte(c,h){var w=this.__data__,N=jp(w,c);return N<0?(++this.size,w.push([c,h])):w[N][1]=h,this}Uo.prototype.clear=fte,Uo.prototype.delete=lte,Uo.prototype.get=hte,Uo.prototype.has=dte,Uo.prototype.set=pte;function qo(c){var h=-1,w=c==null?0:c.length;for(this.clear();++h=h?c:h)),c}function fs(c,h,w,N,V,ne){var he,ve=h&p,xe=h&y,We=h&_;if(w&&(he=V?w(c,N,V,ne):w(c)),he!==r)return he;if(!Qr(c))return c;var Ke=sr(c);if(Ke){if(he=bre(c),!ve)return _i(c,he)}else{var Ze=Qn(c),xt=Ze==re||Ze==ge;if(ja(c))return pA(c,ve);if(Ze==Me||Ze==D||xt&&!V){if(he=xe||xt?{}:OA(c),!ve)return xe?are(c,Tte(he,c)):ore(c,H9(he,c))}else{if(!kr[Ze])return V?c:{};he=yre(c,Ze,ve)}}ne||(ne=new Rs);var Nt=ne.get(c);if(Nt)return Nt;ne.set(c,he),cP(c)?c.forEach(function(Gt){he.add(fs(Gt,h,w,Gt,c,ne))}):oP(c)&&c.forEach(function(Gt,yr){he.set(yr,fs(Gt,h,w,yr,c,ne))});var Vt=We?xe?Dy:Ry:xe?Si:kn,fr=Ke?r:Vt(c);return as(fr||c,function(Gt,yr){fr&&(yr=Gt,Gt=c[yr]),Ph(he,yr,fs(Gt,h,w,yr,c,ne))}),he}function Rte(c){var h=kn(c);return function(w){return W9(w,c,h)}}function W9(c,h,w){var N=w.length;if(c==null)return!N;for(c=qr(c);N--;){var V=w[N],ne=h[V],he=c[V];if(he===r&&!(V in c)||!ne(he))return!1}return!0}function K9(c,h,w){if(typeof c!="function")throw new cs(o);return Oh(function(){c.apply(r,w)},h)}function Mh(c,h,w,N){var V=-1,ne=Ep,he=!0,ve=c.length,xe=[],We=h.length;if(!ve)return xe;w&&(h=Xr(h,Li(w))),N?(ne=Zb,he=!1):h.length>=i&&(ne=wh,he=!1,h=new Bc(h));e:for(;++VV?0:V+w),N=N===r||N>V?V:ur(N),N<0&&(N+=V),N=w>N?0:fP(N);w0&&w(ve)?h>1?Hn(ve,h-1,w,N,V):Oa(V,ve):N||(V[V.length]=ve)}return V}var dy=wA(),Y9=wA(!0);function ao(c,h){return c&&dy(c,h,kn)}function py(c,h){return c&&Y9(c,h,kn)}function qp(c,h){return Da(h,function(w){return Vo(c[w])})}function Fc(c,h){h=$a(h,c);for(var w=0,N=h.length;c!=null&&wh}function Nte(c,h){return c!=null&&Tr.call(c,h)}function Lte(c,h){return c!=null&&h in qr(c)}function kte(c,h,w){return c>=Zn(h,w)&&c=120&&Ke.length>=120)?new Bc(he&&Ke):r}Ke=c[0];var Ze=-1,xt=ve[0];e:for(;++Ze-1;)ve!==c&&Op.call(ve,xe,1),Op.call(c,xe,1);return c}function oA(c,h){for(var w=c?h.length:0,N=w-1;w--;){var V=h[w];if(w==N||V!==ne){var ne=V;Ko(V)?Op.call(c,V,1):Sy(c,V)}}return c}function xy(c,h){return c+kp(j9()*(h-c+1))}function Yte(c,h,w,N){for(var V=-1,ne=An(Lp((h-c)/(w||1)),0),he=Ce(ne);ne--;)he[N?ne:++V]=c,c+=w;return he}function _y(c,h){var w="";if(!c||h<1||h>S)return w;do h%2&&(w+=c),h=kp(h/2),h&&(c+=c);while(h);return w}function hr(c,h){return Fy(kA(c,h,Ai),c+"")}function Jte(c){return z9(gf(c))}function Xte(c,h){var w=gf(c);return Qp(w,$c(h,0,w.length))}function Th(c,h,w,N){if(!Qr(c))return c;h=$a(h,c);for(var V=-1,ne=h.length,he=ne-1,ve=c;ve!=null&&++VV?0:V+h),w=w>V?V:w,w<0&&(w+=V),V=h>w?0:w-h>>>0,h>>>=0;for(var ne=Ce(V);++N>>1,he=c[ne];he!==null&&!Bi(he)&&(w?he<=h:he=i){var We=h?null:lre(c);if(We)return Ap(We);he=!1,V=wh,xe=new Bc}else xe=h?[]:ve;e:for(;++N=N?c:ls(c,h,w)}var dA=qee||function(c){return Er.clearTimeout(c)};function pA(c,h){if(h)return c.slice();var w=c.length,N=L9?L9(w):new c.constructor(w);return c.copy(N),N}function Iy(c){var h=new c.constructor(c.byteLength);return new Rp(h).set(new Rp(c)),h}function rre(c,h){var w=h?Iy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.byteLength)}function nre(c){var h=new c.constructor(c.source,Re.exec(c));return h.lastIndex=c.lastIndex,h}function ire(c){return Ah?qr(Ah.call(c)):{}}function gA(c,h){var w=h?Iy(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.length)}function mA(c,h){if(c!==h){var w=c!==r,N=c===null,V=c===c,ne=Bi(c),he=h!==r,ve=h===null,xe=h===h,We=Bi(h);if(!ve&&!We&&!ne&&c>h||ne&&he&&xe&&!ve&&!We||N&&he&&xe||!w&&xe||!V)return 1;if(!N&&!ne&&!We&&c=ve)return xe;var We=w[N];return xe*(We=="desc"?-1:1)}}return c.index-h.index}function vA(c,h,w,N){for(var V=-1,ne=c.length,he=w.length,ve=-1,xe=h.length,We=An(ne-he,0),Ke=Ce(xe+We),Ze=!N;++ve1?w[V-1]:r,he=V>2?w[2]:r;for(ne=c.length>3&&typeof ne=="function"?(V--,ne):r,he&&ai(w[0],w[1],he)&&(ne=V<3?r:ne,V=1),h=qr(h);++N-1?V[ne?h[he]:he]:r}}function EA(c){return Wo(function(h){var w=h.length,N=w,V=us.prototype.thru;for(c&&h.reverse();N--;){var ne=h[N];if(typeof ne!="function")throw new cs(o);if(V&&!he&&Xp(ne)=="wrapper")var he=new us([],!0)}for(N=he?N:w;++N1&&Sr.reverse(),Ke&&xeve))return!1;var We=ne.get(c),Ke=ne.get(h);if(We&&Ke)return We==h&&Ke==c;var Ze=-1,xt=!0,Nt=w&O?new Bc:r;for(ne.set(c,h),ne.set(h,c);++Ze1?"& ":"")+h[N],h=h.join(w>2?", ":" "),c.replace(G,`{ -/* [wrapped with `+h+`] */ -`)}function xre(c){return sr(c)||qc(c)||!!($9&&c&&c[$9])}function Ko(c,h){var w=typeof c;return h=h??S,!!h&&(w=="number"||w!="symbol"&&st.test(c))&&c>-1&&c%1==0&&c0){if(++h>=E)return arguments[0]}else h=0;return c.apply(r,arguments)}}function Qp(c,h){var w=-1,N=c.length,V=N-1;for(h=h===r?N:h;++w1?c[h-1]:r;return w=typeof w=="function"?(c.pop(),w):r,GA(c,w)});function YA(c){var h=te(c);return h.__chain__=!0,h}function Dne(c,h){return h(c),c}function eg(c,h){return h(c)}var One=Wo(function(c){var h=c.length,w=h?c[0]:0,N=this.__wrapped__,V=function(ne){return hy(ne,c)};return h>1||this.__actions__.length||!(N instanceof _r)||!Ko(w)?this.thru(V):(N=N.slice(w,+w+(h?1:0)),N.__actions__.push({func:eg,args:[V],thisArg:r}),new us(N,this.__chain__).thru(function(ne){return h&&!ne.length&&ne.push(r),ne}))});function Nne(){return YA(this)}function Lne(){return new us(this.value(),this.__chain__)}function kne(){this.__values__===r&&(this.__values__=uP(this.value()));var c=this.__index__>=this.__values__.length,h=c?r:this.__values__[this.__index__++];return{done:c,value:h}}function Bne(){return this}function $ne(c){for(var h,w=this;w instanceof Fp;){var N=qA(w);N.__index__=0,N.__values__=r,h?V.__wrapped__=N:h=N;var V=N;w=w.__wrapped__}return V.__wrapped__=c,h}function Fne(){var c=this.__wrapped__;if(c instanceof _r){var h=c;return this.__actions__.length&&(h=new _r(this)),h=h.reverse(),h.__actions__.push({func:eg,args:[jy],thisArg:r}),new us(h,this.__chain__)}return this.thru(jy)}function jne(){return lA(this.__wrapped__,this.__actions__)}var Une=Kp(function(c,h,w){Tr.call(c,w)?++c[w]:zo(c,w,1)});function qne(c,h,w){var N=sr(c)?S9:Dte;return w&&ai(c,h,w)&&(h=r),N(c,qt(h,3))}function zne(c,h){var w=sr(c)?Da:G9;return w(c,qt(h,3))}var Hne=_A(zA),Wne=_A(HA);function Kne(c,h){return Hn(tg(c,h),1)}function Vne(c,h){return Hn(tg(c,h),x)}function Gne(c,h,w){return w=w===r?1:ur(w),Hn(tg(c,h),w)}function JA(c,h){var w=sr(c)?as:ka;return w(c,qt(h,3))}function XA(c,h){var w=sr(c)?dee:V9;return w(c,qt(h,3))}var Yne=Kp(function(c,h,w){Tr.call(c,w)?c[w].push(h):zo(c,w,[h])});function Jne(c,h,w,N){c=Ei(c)?c:gf(c),w=w&&!N?ur(w):0;var V=c.length;return w<0&&(w=An(V+w,0)),og(c)?w<=V&&c.indexOf(h,w)>-1:!!V&&rf(c,h,w)>-1}var Xne=hr(function(c,h,w){var N=-1,V=typeof h=="function",ne=Ei(c)?Ce(c.length):[];return ka(c,function(he){ne[++N]=V?Ln(h,he,w):Ih(he,h,w)}),ne}),Zne=Kp(function(c,h,w){zo(c,w,h)});function tg(c,h){var w=sr(c)?Xr:eA;return w(c,qt(h,3))}function Qne(c,h,w,N){return c==null?[]:(sr(h)||(h=h==null?[]:[h]),w=N?r:w,sr(w)||(w=w==null?[]:[w]),iA(c,h,w))}var eie=Kp(function(c,h,w){c[w?0:1].push(h)},function(){return[[],[]]});function tie(c,h,w){var N=sr(c)?Qb:I9,V=arguments.length<3;return N(c,qt(h,4),w,V,ka)}function rie(c,h,w){var N=sr(c)?pee:I9,V=arguments.length<3;return N(c,qt(h,4),w,V,V9)}function nie(c,h){var w=sr(c)?Da:G9;return w(c,ig(qt(h,3)))}function iie(c){var h=sr(c)?z9:Jte;return h(c)}function sie(c,h,w){(w?ai(c,h,w):h===r)?h=1:h=ur(h);var N=sr(c)?Mte:Xte;return N(c,h)}function oie(c){var h=sr(c)?Ite:Qte;return h(c)}function aie(c){if(c==null)return 0;if(Ei(c))return og(c)?sf(c):c.length;var h=Qn(c);return h==oe||h==Ie?c.size:by(c).length}function cie(c,h,w){var N=sr(c)?ey:ere;return w&&ai(c,h,w)&&(h=r),N(c,qt(h,3))}var uie=hr(function(c,h){if(c==null)return[];var w=h.length;return w>1&&ai(c,h[0],h[1])?h=[]:w>2&&ai(h[0],h[1],h[2])&&(h=[h[0]]),iA(c,Hn(h,1),[])}),rg=zee||function(){return Er.Date.now()};function fie(c,h){if(typeof h!="function")throw new cs(o);return c=ur(c),function(){if(--c<1)return h.apply(this,arguments)}}function ZA(c,h,w){return h=w?r:h,h=c&&h==null?c.length:h,Ho(c,R,r,r,r,r,h)}function QA(c,h){var w;if(typeof h!="function")throw new cs(o);return c=ur(c),function(){return--c>0&&(w=h.apply(this,arguments)),c<=1&&(h=r),w}}var qy=hr(function(c,h,w){var N=L;if(w.length){var V=Na(w,df(qy));N|=z}return Ho(c,N,h,w,V)}),eP=hr(function(c,h,w){var N=L|B;if(w.length){var V=Na(w,df(eP));N|=z}return Ho(h,N,c,w,V)});function tP(c,h,w){h=w?r:h;var N=Ho(c,H,r,r,r,r,r,h);return N.placeholder=tP.placeholder,N}function rP(c,h,w){h=w?r:h;var N=Ho(c,U,r,r,r,r,r,h);return N.placeholder=rP.placeholder,N}function nP(c,h,w){var N,V,ne,he,ve,xe,We=0,Ke=!1,Ze=!1,xt=!0;if(typeof c!="function")throw new cs(o);h=ds(h)||0,Qr(w)&&(Ke=!!w.leading,Ze="maxWait"in w,ne=Ze?An(ds(w.maxWait)||0,h):ne,xt="trailing"in w?!!w.trailing:xt);function Nt(mn){var Os=N,Yo=V;return N=V=r,We=mn,he=c.apply(Yo,Os),he}function Vt(mn){return We=mn,ve=Oh(yr,h),Ke?Nt(mn):he}function fr(mn){var Os=mn-xe,Yo=mn-We,_P=h-Os;return Ze?Zn(_P,ne-Yo):_P}function Gt(mn){var Os=mn-xe,Yo=mn-We;return xe===r||Os>=h||Os<0||Ze&&Yo>=ne}function yr(){var mn=rg();if(Gt(mn))return Sr(mn);ve=Oh(yr,fr(mn))}function Sr(mn){return ve=r,xt&&N?Nt(mn):(N=V=r,he)}function $i(){ve!==r&&dA(ve),We=0,N=xe=V=ve=r}function ci(){return ve===r?he:Sr(rg())}function Fi(){var mn=rg(),Os=Gt(mn);if(N=arguments,V=this,xe=mn,Os){if(ve===r)return Vt(xe);if(Ze)return dA(ve),ve=Oh(yr,h),Nt(xe)}return ve===r&&(ve=Oh(yr,h)),he}return Fi.cancel=$i,Fi.flush=ci,Fi}var lie=hr(function(c,h){return K9(c,1,h)}),hie=hr(function(c,h,w){return K9(c,ds(h)||0,w)});function die(c){return Ho(c,ie)}function ng(c,h){if(typeof c!="function"||h!=null&&typeof h!="function")throw new cs(o);var w=function(){var N=arguments,V=h?h.apply(this,N):N[0],ne=w.cache;if(ne.has(V))return ne.get(V);var he=c.apply(this,N);return w.cache=ne.set(V,he)||ne,he};return w.cache=new(ng.Cache||qo),w}ng.Cache=qo;function ig(c){if(typeof c!="function")throw new cs(o);return function(){var h=arguments;switch(h.length){case 0:return!c.call(this);case 1:return!c.call(this,h[0]);case 2:return!c.call(this,h[0],h[1]);case 3:return!c.call(this,h[0],h[1],h[2])}return!c.apply(this,h)}}function pie(c){return QA(2,c)}var gie=tre(function(c,h){h=h.length==1&&sr(h[0])?Xr(h[0],Li(qt())):Xr(Hn(h,1),Li(qt()));var w=h.length;return hr(function(N){for(var V=-1,ne=Zn(N.length,w);++V=h}),qc=X9(function(){return arguments}())?X9:function(c){return rn(c)&&Tr.call(c,"callee")&&!B9.call(c,"callee")},sr=Ce.isArray,Tie=si?Li(si):$te;function Ei(c){return c!=null&&sg(c.length)&&!Vo(c)}function gn(c){return rn(c)&&Ei(c)}function Rie(c){return c===!0||c===!1||rn(c)&&oi(c)==J}var ja=Wee||ew,Die=Cs?Li(Cs):Fte;function Oie(c){return rn(c)&&c.nodeType===1&&!Nh(c)}function Nie(c){if(c==null)return!0;if(Ei(c)&&(sr(c)||typeof c=="string"||typeof c.splice=="function"||ja(c)||pf(c)||qc(c)))return!c.length;var h=Qn(c);if(h==oe||h==Ie)return!c.size;if(Dh(c))return!by(c).length;for(var w in c)if(Tr.call(c,w))return!1;return!0}function Lie(c,h){return Ch(c,h)}function kie(c,h,w){w=typeof w=="function"?w:r;var N=w?w(c,h):r;return N===r?Ch(c,h,r,w):!!N}function Hy(c){if(!rn(c))return!1;var h=oi(c);return h==X||h==T||typeof c.message=="string"&&typeof c.name=="string"&&!Nh(c)}function Bie(c){return typeof c=="number"&&F9(c)}function Vo(c){if(!Qr(c))return!1;var h=oi(c);return h==re||h==ge||h==ee||h==Te}function sP(c){return typeof c=="number"&&c==ur(c)}function sg(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=S}function Qr(c){var h=typeof c;return c!=null&&(h=="object"||h=="function")}function rn(c){return c!=null&&typeof c=="object"}var oP=os?Li(os):Ute;function $ie(c,h){return c===h||vy(c,h,Ny(h))}function Fie(c,h,w){return w=typeof w=="function"?w:r,vy(c,h,Ny(h),w)}function jie(c){return aP(c)&&c!=+c}function Uie(c){if(Sre(c))throw new tr(s);return Z9(c)}function qie(c){return c===null}function zie(c){return c==null}function aP(c){return typeof c=="number"||rn(c)&&oi(c)==fe}function Nh(c){if(!rn(c)||oi(c)!=Me)return!1;var h=Dp(c);if(h===null)return!0;var w=Tr.call(h,"constructor")&&h.constructor;return typeof w=="function"&&w instanceof w&&Ip.call(w)==Fee}var Wy=oo?Li(oo):qte;function Hie(c){return sP(c)&&c>=-S&&c<=S}var cP=yh?Li(yh):zte;function og(c){return typeof c=="string"||!sr(c)&&rn(c)&&oi(c)==Le}function Bi(c){return typeof c=="symbol"||rn(c)&&oi(c)==Ve}var pf=Nc?Li(Nc):Hte;function Wie(c){return c===r}function Kie(c){return rn(c)&&Qn(c)==ze}function Vie(c){return rn(c)&&oi(c)==He}var Gie=Jp(yy),Yie=Jp(function(c,h){return c<=h});function uP(c){if(!c)return[];if(Ei(c))return og(c)?Ts(c):_i(c);if(xh&&c[xh])return Mee(c[xh]());var h=Qn(c),w=h==oe?oy:h==Ie?Ap:gf;return w(c)}function Go(c){if(!c)return c===0?c:0;if(c=ds(c),c===x||c===-x){var h=c<0?-1:1;return h*A}return c===c?c:0}function ur(c){var h=Go(c),w=h%1;return h===h?w?h-w:h:0}function fP(c){return c?$c(ur(c),0,P):0}function ds(c){if(typeof c=="number")return c;if(Bi(c))return b;if(Qr(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=Qr(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=C9(c);var w=it.test(c);return w||mt.test(c)?ir(c.slice(2),w?2:8):De.test(c)?b:+c}function lP(c){return co(c,Si(c))}function Jie(c){return c?$c(ur(c),-S,S):c===0?c:0}function Cr(c){return c==null?"":ki(c)}var Xie=lf(function(c,h){if(Dh(h)||Ei(h)){co(h,kn(h),c);return}for(var w in h)Tr.call(h,w)&&Ph(c,w,h[w])}),hP=lf(function(c,h){co(h,Si(h),c)}),ag=lf(function(c,h,w,N){co(h,Si(h),c,N)}),Zie=lf(function(c,h,w,N){co(h,kn(h),c,N)}),Qie=Wo(hy);function ese(c,h){var w=ff(c);return h==null?w:H9(w,h)}var tse=hr(function(c,h){c=qr(c);var w=-1,N=h.length,V=N>2?h[2]:r;for(V&&ai(h[0],h[1],V)&&(N=1);++w1),ne}),co(c,Dy(c),w),N&&(w=fs(w,p|y|_,hre));for(var V=h.length;V--;)Sy(w,h[V]);return w});function yse(c,h){return pP(c,ig(qt(h)))}var wse=Wo(function(c,h){return c==null?{}:Vte(c,h)});function pP(c,h){if(c==null)return{};var w=Xr(Dy(c),function(N){return[N]});return h=qt(h),sA(c,w,function(N,V){return h(N,V[0])})}function xse(c,h,w){h=$a(h,c);var N=-1,V=h.length;for(V||(V=1,c=r);++Nh){var N=c;c=h,h=N}if(w||c%1||h%1){var V=j9();return Zn(c+V*(h-c+jr("1e-"+((V+"").length-1))),h)}return xy(c,h)}var Dse=hf(function(c,h,w){return h=h.toLowerCase(),c+(w?vP(h):h)});function vP(c){return Gy(Cr(c).toLowerCase())}function bP(c){return c=Cr(c),c&&c.replace(tt,_ee).replace(Jb,"")}function Ose(c,h,w){c=Cr(c),h=ki(h);var N=c.length;w=w===r?N:$c(ur(w),0,N);var V=w;return w-=h.length,w>=0&&c.slice(w,V)==h}function Nse(c){return c=Cr(c),c&&Tt.test(c)?c.replace(Ot,Eee):c}function Lse(c){return c=Cr(c),c&&Ft.test(c)?c.replace(nt,"\\$&"):c}var kse=hf(function(c,h,w){return c+(w?"-":"")+h.toLowerCase()}),Bse=hf(function(c,h,w){return c+(w?" ":"")+h.toLowerCase()}),$se=xA("toLowerCase");function Fse(c,h,w){c=Cr(c),h=ur(h);var N=h?sf(c):0;if(!h||N>=h)return c;var V=(h-N)/2;return Yp(kp(V),w)+c+Yp(Lp(V),w)}function jse(c,h,w){c=Cr(c),h=ur(h);var N=h?sf(c):0;return h&&N>>0,w?(c=Cr(c),c&&(typeof h=="string"||h!=null&&!Wy(h))&&(h=ki(h),!h&&nf(c))?Fa(Ts(c),0,w):c.split(h,w)):[]}var Vse=hf(function(c,h,w){return c+(w?" ":"")+Gy(h)});function Gse(c,h,w){return c=Cr(c),w=w==null?0:$c(ur(w),0,c.length),h=ki(h),c.slice(w,w+h.length)==h}function Yse(c,h,w){var N=te.templateSettings;w&&ai(c,h,w)&&(h=r),c=Cr(c),h=ag({},h,N,IA);var V=ag({},h.imports,N.imports,IA),ne=kn(V),he=sy(V,ne),ve,xe,We=0,Ke=h.interpolate||At,Ze="__p += '",xt=ay((h.escape||At).source+"|"+Ke.source+"|"+(Ke===Lt?_e:At).source+"|"+(h.evaluate||At).source+"|$","g"),Nt="//# sourceURL="+(Tr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Xb+"]")+` -`;c.replace(xt,function(Gt,yr,Sr,$i,ci,Fi){return Sr||(Sr=$i),Ze+=c.slice(We,Fi).replace(Rt,See),yr&&(ve=!0,Ze+=`' + -__e(`+yr+`) + -'`),ci&&(xe=!0,Ze+=`'; -`+ci+`; -__p += '`),Sr&&(Ze+=`' + + */var Rj=Cf.exports,f6;function Tj(){return f6||(f6=1,(function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",u=500,h="__lodash_placeholder__",g=1,b=2,x=4,S=1,C=2,D=1,B=2,L=4,H=8,F=16,k=32,$=64,R=128,W=256,V=512,X=30,q="...",_=800,v=16,l=1,p=2,m=3,y=1/0,A=9007199254740991,E=17976931348623157e292,w=NaN,I=4294967295,M=I-1,z=I>>>1,se=[["ary",R],["bind",D],["bindKey",B],["curry",H],["curryRight",F],["flip",V],["partial",k],["partialRight",$],["rearg",W]],O="[object Arguments]",ie="[object Array]",ee="[object AsyncFunction]",Z="[object Boolean]",te="[object Date]",N="[object DOMException]",Q="[object Error]",ne="[object Function]",de="[object GeneratorFunction]",ce="[object Map]",fe="[object Number]",be="[object Null]",Pe="[object Object]",De="[object Promise]",Te="[object Proxy]",Fe="[object RegExp]",Me="[object Set]",Ne="[object String]",He="[object Symbol]",Oe="[object Undefined]",$e="[object WeakMap]",qe="[object WeakSet]",_e="[object ArrayBuffer]",Qe="[object DataView]",at="[object Float32Array]",Be="[object Float64Array]",nt="[object Int8Array]",it="[object Int16Array]",Ye="[object Int32Array]",pt="[object Uint8Array]",ht="[object Uint8ClampedArray]",ft="[object Uint16Array]",Ht="[object Uint32Array]",Jt=/\b__p \+= '';/g,St=/\b(__p \+=) '' \+/g,Xt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,tr=/&(?:amp|lt|gt|quot|#39);/g,Dt=/[&<>"']/g,Bt=RegExp(tr.source),Ct=RegExp(Dt.source),gt=/<%-([\s\S]+?)%>/g,Ot=/<%([\s\S]+?)%>/g,Lt=/<%=([\s\S]+?)%>/g,bt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,jt=/^\w*$/,Ut=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tt=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(tt.source),K=/^\s+/,G=/\s/,J=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,T=/\{\n\/\* \[wrapped with (.+)\] \*/,j=/,? & /,oe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,me=/\\(\\)?/g,Ee=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ke=/\w*$/,Ce=/^[-+]0x[0-9a-f]+$/i,et=/^0b[01]+$/i,Ze=/^\[object .+?Constructor\]$/,rt=/^0o[0-7]+$/i,ot=/^(?:0|[1-9]\d*)$/,yt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Rt=/($^)/,Mt=/['\n\r\u2028\u2029\\]/g,xt="\\ud800-\\udfff",Tt="\\u0300-\\u036f",mt="\\ufe20-\\ufe2f",Et="\\u20d0-\\u20ff",ct=Tt+mt+Et,wt="\\u2700-\\u27bf",lt="a-z\\xdf-\\xf6\\xf8-\\xff",st="\\xac\\xb1\\xd7\\xf7",Ae="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ie="\\u2000-\\u206f",Ve=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ue="A-Z\\xc0-\\xd6\\xd8-\\xde",ze="\\ufe0e\\ufe0f",Je=st+Ae+Ie+Ve,kt="['’]",Wt="["+xt+"]",Zt="["+Je+"]",Kt="["+ct+"]",ge="\\d+",ir="["+wt+"]",gr="["+lt+"]",mr="[^"+xt+Je+ge+wt+lt+Ue+"]",Qt="\\ud83c[\\udffb-\\udfff]",vr="(?:"+Kt+"|"+Qt+")",hr="[^"+xt+"]",Lr="(?:\\ud83c[\\udde6-\\uddff]){2}",br="[\\ud800-\\udbff][\\udc00-\\udfff]",xr="["+Ue+"]",Fr="\\u200d",jr="(?:"+gr+"|"+mr+")",Mr="(?:"+xr+"|"+mr+")",un="(?:"+kt+"(?:d|ll|m|re|s|t|ve))?",fn="(?:"+kt+"(?:D|LL|M|RE|S|T|VE))?",ln=vr+"?",r0="["+ze+"]?",J1="(?:"+Fr+"(?:"+[hr,Lr,br].join("|")+")"+r0+ln+")*",uo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",n0="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",i0=r0+ln+J1,Zc="(?:"+[ir,Lr,br].join("|")+")"+i0,X1="(?:"+[hr+Kt+"?",Kt,Lr,br,Wt].join("|")+")",dl=RegExp(kt,"g"),Z1=RegExp(Kt,"g"),Qc=RegExp(Qt+"(?="+Qt+")|"+X1+i0,"g"),s0=RegExp([xr+"?"+gr+"+"+un+"(?="+[Zt,xr,"$"].join("|")+")",Mr+"+"+fn+"(?="+[Zt,xr+jr,"$"].join("|")+")",xr+"?"+jr+"+"+un,xr+"+"+fn,n0,uo,ge,Zc].join("|"),"g"),o0=RegExp("["+Fr+xt+ct+ze+"]"),Va=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,a0=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Q1=-1,Ur={};Ur[at]=Ur[Be]=Ur[nt]=Ur[it]=Ur[Ye]=Ur[pt]=Ur[ht]=Ur[ft]=Ur[Ht]=!0,Ur[O]=Ur[ie]=Ur[_e]=Ur[Z]=Ur[Qe]=Ur[te]=Ur[Q]=Ur[ne]=Ur[ce]=Ur[fe]=Ur[Pe]=Ur[Fe]=Ur[Me]=Ur[Ne]=Ur[$e]=!1;var kr={};kr[O]=kr[ie]=kr[_e]=kr[Qe]=kr[Z]=kr[te]=kr[at]=kr[Be]=kr[nt]=kr[it]=kr[Ye]=kr[ce]=kr[fe]=kr[Pe]=kr[Fe]=kr[Me]=kr[Ne]=kr[He]=kr[pt]=kr[ht]=kr[ft]=kr[Ht]=!0,kr[Q]=kr[ne]=kr[$e]=!1;var ue={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},we={"&":"&","<":"<",">":">",'"':""","'":"'"},Ge={"&":"&","<":"<",">":">",""":'"',"'":"'"},Pt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$r=parseFloat,sr=parseInt,Yr=typeof Wn=="object"&&Wn&&Wn.Object===Object&&Wn,bn=typeof self=="object"&&self&&self.Object===Object&&self,Er=Yr||bn||Function("return this")(),qr=e&&!e.nodeType&&e,hn=qr&&!0&&t&&!t.nodeType&&t,fi=hn&&hn.exports===qr,yn=fi&&Yr.process,Jr=(function(){try{var ye=hn&&hn.require&&hn.require("util").types;return ye||yn&&yn.binding&&yn.binding("util")}catch{}})(),Xn=Jr&&Jr.isArrayBuffer,ds=Jr&&Jr.isDate,Ki=Jr&&Jr.isMap,Ls=Jr&&Jr.isRegExp,pl=Jr&&Jr.isSet,Ga=Jr&&Jr.isTypedArray;function Cn(ye,je,Re){switch(Re.length){case 0:return ye.call(je);case 1:return ye.call(je,Re[0]);case 2:return ye.call(je,Re[0],Re[1]);case 3:return ye.call(je,Re[0],Re[1],Re[2])}return ye.apply(je,Re)}function $J(ye,je,Re,It){for(var rr=-1,Ir=ye==null?0:ye.length;++rr-1}function eb(ye,je,Re){for(var It=-1,rr=ye==null?0:ye.length;++It-1;);return Re}function O7(ye,je){for(var Re=ye.length;Re--&&eu(je,ye[Re],0)>-1;);return Re}function JJ(ye,je){for(var Re=ye.length,It=0;Re--;)ye[Re]===je&&++It;return It}var XJ=ib(ue),ZJ=ib(we);function QJ(ye){return"\\"+Pt[ye]}function eX(ye,je){return ye==null?r:ye[je]}function tu(ye){return o0.test(ye)}function tX(ye){return Va.test(ye)}function rX(ye){for(var je,Re=[];!(je=ye.next()).done;)Re.push(je.value);return Re}function cb(ye){var je=-1,Re=Array(ye.size);return ye.forEach(function(It,rr){Re[++je]=[rr,It]}),Re}function N7(ye,je){return function(Re){return ye(je(Re))}}function Xo(ye,je){for(var Re=-1,It=ye.length,rr=0,Ir=[];++Re-1}function zX(c,d){var P=this.__data__,U=A0(P,c);return U<0?(++this.size,P.push([c,d])):P[U][1]=d,this}fo.prototype.clear=jX,fo.prototype.delete=UX,fo.prototype.get=$X,fo.prototype.has=qX,fo.prototype.set=zX;function lo(c){var d=-1,P=c==null?0:c.length;for(this.clear();++d=d?c:d)),c}function Ji(c,d,P,U,Y,ae){var pe,ve=d&g,xe=d&b,We=d&x;if(P&&(pe=Y?P(c,U,Y,ae):P(c)),pe!==r)return pe;if(!Qr(c))return c;var Ke=or(c);if(Ke){if(pe=VZ(c),!ve)return li(c,pe)}else{var Xe=Hn(c),_t=Xe==ne||Xe==de;if(na(c))return m9(c,ve);if(Xe==Pe||Xe==O||_t&&!Y){if(pe=xe||_t?{}:L9(c),!ve)return xe?kZ(c,sZ(pe,c)):LZ(c,K7(pe,c))}else{if(!kr[Xe])return Y?c:{};pe=GZ(c,Xe,ve)}}ae||(ae=new gs);var Nt=ae.get(c);if(Nt)return Nt;ae.set(c,pe),fA(c)?c.forEach(function(Gt){pe.add(Ji(Gt,d,P,Gt,c,ae))}):cA(c)&&c.forEach(function(Gt,wr){pe.set(wr,Ji(Gt,d,P,wr,c,ae))});var Vt=We?xe?Nb:Ob:xe?di:Rn,fr=Ke?r:Vt(c);return Vi(fr||c,function(Gt,wr){fr&&(wr=Gt,Gt=c[wr]),xl(pe,wr,Ji(Gt,d,P,wr,c,ae))}),pe}function oZ(c){var d=Rn(c);return function(P){return V7(P,c,d)}}function V7(c,d,P){var U=P.length;if(c==null)return!U;for(c=zr(c);U--;){var Y=P[U],ae=d[Y],pe=c[Y];if(pe===r&&!(Y in c)||!ae(pe))return!1}return!0}function G7(c,d,P){if(typeof c!="function")throw new Gi(o);return Ml(function(){c.apply(r,P)},d)}function _l(c,d,P,U){var Y=-1,ae=c0,pe=!0,ve=c.length,xe=[],We=d.length;if(!ve)return xe;P&&(d=Xr(d,_i(P))),U?(ae=eb,pe=!1):d.length>=i&&(ae=gl,pe=!1,d=new Xa(d));e:for(;++YY?0:Y+P),U=U===r||U>Y?Y:ur(U),U<0&&(U+=Y),U=P>U?0:hA(U);P0&&P(ve)?d>1?Bn(ve,d-1,P,U,Y):Jo(Y,ve):U||(Y[Y.length]=ve)}return Y}var gb=_9(),X7=_9(!0);function ks(c,d){return c&&gb(c,d,Rn)}function mb(c,d){return c&&X7(c,d,Rn)}function I0(c,d){return Yo(d,function(P){return vo(c[P])})}function Qa(c,d){d=ta(d,c);for(var P=0,U=d.length;c!=null&&Pd}function uZ(c,d){return c!=null&&Rr.call(c,d)}function fZ(c,d){return c!=null&&d in zr(c)}function lZ(c,d,P){return c>=zn(d,P)&&c=120&&Ke.length>=120)?new Xa(pe&&Ke):r}Ke=c[0];var Xe=-1,_t=ve[0];e:for(;++Xe-1;)ve!==c&&b0.call(ve,xe,1),b0.call(c,xe,1);return c}function c9(c,d){for(var P=c?d.length:0,U=P-1;P--;){var Y=d[P];if(P==U||Y!==ae){var ae=Y;mo(Y)?b0.call(c,Y,1):Pb(c,Y)}}return c}function Eb(c,d){return c+x0(q7()*(d-c+1))}function SZ(c,d,P,U){for(var Y=-1,ae=En(w0((d-c)/(P||1)),0),pe=Re(ae);ae--;)pe[U?ae:++Y]=c,c+=P;return pe}function Sb(c,d){var P="";if(!c||d<1||d>A)return P;do d%2&&(P+=c),d=x0(d/2),d&&(c+=c);while(d);return P}function dr(c,d){return $b(F9(c,d,pi),c+"")}function AZ(c){return W7(hu(c))}function PZ(c,d){var P=hu(c);return F0(P,Za(d,0,P.length))}function Al(c,d,P,U){if(!Qr(c))return c;d=ta(d,c);for(var Y=-1,ae=d.length,pe=ae-1,ve=c;ve!=null&&++YY?0:Y+d),P=P>Y?Y:P,P<0&&(P+=Y),Y=d>P?0:P-d>>>0,d>>>=0;for(var ae=Re(Y);++U>>1,pe=c[ae];pe!==null&&!Si(pe)&&(P?pe<=d:pe=i){var We=d?null:UZ(c);if(We)return f0(We);pe=!1,Y=gl,xe=new Xa}else xe=d?[]:ve;e:for(;++U=U?c:Xi(c,d,P)}var g9=vX||function(c){return Er.clearTimeout(c)};function m9(c,d){if(d)return c.slice();var P=c.length,U=B7?B7(P):new c.constructor(P);return c.copy(U),U}function Rb(c){var d=new c.constructor(c.byteLength);return new m0(d).set(new m0(c)),d}function TZ(c,d){var P=d?Rb(c.buffer):c.buffer;return new c.constructor(P,c.byteOffset,c.byteLength)}function DZ(c){var d=new c.constructor(c.source,ke.exec(c));return d.lastIndex=c.lastIndex,d}function OZ(c){return wl?zr(wl.call(c)):{}}function v9(c,d){var P=d?Rb(c.buffer):c.buffer;return new c.constructor(P,c.byteOffset,c.length)}function b9(c,d){if(c!==d){var P=c!==r,U=c===null,Y=c===c,ae=Si(c),pe=d!==r,ve=d===null,xe=d===d,We=Si(d);if(!ve&&!We&&!ae&&c>d||ae&&pe&&xe&&!ve&&!We||U&&pe&&xe||!P&&xe||!Y)return 1;if(!U&&!ae&&!We&&c=ve)return xe;var We=P[U];return xe*(We=="desc"?-1:1)}}return c.index-d.index}function y9(c,d,P,U){for(var Y=-1,ae=c.length,pe=P.length,ve=-1,xe=d.length,We=En(ae-pe,0),Ke=Re(xe+We),Xe=!U;++ve1?P[Y-1]:r,pe=Y>2?P[2]:r;for(ae=c.length>3&&typeof ae=="function"?(Y--,ae):r,pe&&Qn(P[0],P[1],pe)&&(ae=Y<3?r:ae,Y=1),d=zr(d);++U-1?Y[ae?d[pe]:pe]:r}}function A9(c){return go(function(d){var P=d.length,U=P,Y=Yi.prototype.thru;for(c&&d.reverse();U--;){var ae=d[U];if(typeof ae!="function")throw new Gi(o);if(Y&&!pe&&k0(ae)=="wrapper")var pe=new Yi([],!0)}for(U=pe?U:P;++U1&&Sr.reverse(),Ke&&xeve))return!1;var We=ae.get(c),Ke=ae.get(d);if(We&&Ke)return We==d&&Ke==c;var Xe=-1,_t=!0,Nt=P&C?new Xa:r;for(ae.set(c,d),ae.set(d,c);++Xe1?"& ":"")+d[U],d=d.join(P>2?", ":" "),c.replace(J,`{ +/* [wrapped with `+d+`] */ +`)}function JZ(c){return or(c)||rc(c)||!!(U7&&c&&c[U7])}function mo(c,d){var P=typeof c;return d=d??A,!!d&&(P=="number"||P!="symbol"&&ot.test(c))&&c>-1&&c%1==0&&c0){if(++d>=_)return arguments[0]}else d=0;return c.apply(r,arguments)}}function F0(c,d){var P=-1,U=c.length,Y=U-1;for(d=d===r?U:d;++P1?c[d-1]:r;return P=typeof P=="function"?(c.pop(),P):r,J9(c,P)});function X9(c){var d=re(c);return d.__chain__=!0,d}function aee(c,d){return d(c),c}function j0(c,d){return d(c)}var cee=go(function(c){var d=c.length,P=d?c[0]:0,U=this.__wrapped__,Y=function(ae){return pb(ae,c)};return d>1||this.__actions__.length||!(U instanceof _r)||!mo(P)?this.thru(Y):(U=U.slice(P,+P+(d?1:0)),U.__actions__.push({func:j0,args:[Y],thisArg:r}),new Yi(U,this.__chain__).thru(function(ae){return d&&!ae.length&&ae.push(r),ae}))});function uee(){return X9(this)}function fee(){return new Yi(this.value(),this.__chain__)}function lee(){this.__values__===r&&(this.__values__=lA(this.value()));var c=this.__index__>=this.__values__.length,d=c?r:this.__values__[this.__index__++];return{done:c,value:d}}function hee(){return this}function dee(c){for(var d,P=this;P instanceof S0;){var U=H9(P);U.__index__=0,U.__values__=r,d?Y.__wrapped__=U:d=U;var Y=U;P=P.__wrapped__}return Y.__wrapped__=c,d}function pee(){var c=this.__wrapped__;if(c instanceof _r){var d=c;return this.__actions__.length&&(d=new _r(this)),d=d.reverse(),d.__actions__.push({func:j0,args:[qb],thisArg:r}),new Yi(d,this.__chain__)}return this.thru(qb)}function gee(){return d9(this.__wrapped__,this.__actions__)}var mee=T0(function(c,d,P){Rr.call(c,P)?++c[P]:ho(c,P,1)});function vee(c,d,P){var U=or(c)?P7:aZ;return P&&Qn(c,d,P)&&(d=r),U(c,qt(d,3))}function bee(c,d){var P=or(c)?Yo:J7;return P(c,qt(d,3))}var yee=S9(W9),wee=S9(K9);function xee(c,d){return Bn(U0(c,d),1)}function _ee(c,d){return Bn(U0(c,d),y)}function Eee(c,d,P){return P=P===r?1:ur(P),Bn(U0(c,d),P)}function Z9(c,d){var P=or(c)?Vi:Qo;return P(c,qt(d,3))}function Q9(c,d){var P=or(c)?qJ:Y7;return P(c,qt(d,3))}var See=T0(function(c,d,P){Rr.call(c,P)?c[P].push(d):ho(c,P,[d])});function Aee(c,d,P,U){c=hi(c)?c:hu(c),P=P&&!U?ur(P):0;var Y=c.length;return P<0&&(P=En(Y+P,0)),W0(c)?P<=Y&&c.indexOf(d,P)>-1:!!Y&&eu(c,d,P)>-1}var Pee=dr(function(c,d,P){var U=-1,Y=typeof d=="function",ae=hi(c)?Re(c.length):[];return Qo(c,function(pe){ae[++U]=Y?Cn(d,pe,P):El(pe,d,P)}),ae}),Iee=T0(function(c,d,P){ho(c,P,d)});function U0(c,d){var P=or(c)?Xr:r9;return P(c,qt(d,3))}function Mee(c,d,P,U){return c==null?[]:(or(d)||(d=d==null?[]:[d]),P=U?r:P,or(P)||(P=P==null?[]:[P]),o9(c,d,P))}var Cee=T0(function(c,d,P){c[P?0:1].push(d)},function(){return[[],[]]});function Ree(c,d,P){var U=or(c)?tb:R7,Y=arguments.length<3;return U(c,qt(d,4),P,Y,Qo)}function Tee(c,d,P){var U=or(c)?zJ:R7,Y=arguments.length<3;return U(c,qt(d,4),P,Y,Y7)}function Dee(c,d){var P=or(c)?Yo:J7;return P(c,z0(qt(d,3)))}function Oee(c){var d=or(c)?W7:AZ;return d(c)}function Nee(c,d,P){(P?Qn(c,d,P):d===r)?d=1:d=ur(d);var U=or(c)?rZ:PZ;return U(c,d)}function Lee(c){var d=or(c)?nZ:MZ;return d(c)}function kee(c){if(c==null)return 0;if(hi(c))return W0(c)?ru(c):c.length;var d=Hn(c);return d==ce||d==Me?c.size:wb(c).length}function Bee(c,d,P){var U=or(c)?rb:CZ;return P&&Qn(c,d,P)&&(d=r),U(c,qt(d,3))}var Fee=dr(function(c,d){if(c==null)return[];var P=d.length;return P>1&&Qn(c,d[0],d[1])?d=[]:P>2&&Qn(d[0],d[1],d[2])&&(d=[d[0]]),o9(c,Bn(d,1),[])}),$0=bX||function(){return Er.Date.now()};function jee(c,d){if(typeof d!="function")throw new Gi(o);return c=ur(c),function(){if(--c<1)return d.apply(this,arguments)}}function eA(c,d,P){return d=P?r:d,d=c&&d==null?c.length:d,po(c,R,r,r,r,r,d)}function tA(c,d){var P;if(typeof d!="function")throw new Gi(o);return c=ur(c),function(){return--c>0&&(P=d.apply(this,arguments)),c<=1&&(d=r),P}}var Hb=dr(function(c,d,P){var U=D;if(P.length){var Y=Xo(P,fu(Hb));U|=k}return po(c,U,d,P,Y)}),rA=dr(function(c,d,P){var U=D|B;if(P.length){var Y=Xo(P,fu(rA));U|=k}return po(d,U,c,P,Y)});function nA(c,d,P){d=P?r:d;var U=po(c,H,r,r,r,r,r,d);return U.placeholder=nA.placeholder,U}function iA(c,d,P){d=P?r:d;var U=po(c,F,r,r,r,r,r,d);return U.placeholder=iA.placeholder,U}function sA(c,d,P){var U,Y,ae,pe,ve,xe,We=0,Ke=!1,Xe=!1,_t=!0;if(typeof c!="function")throw new Gi(o);d=Qi(d)||0,Qr(P)&&(Ke=!!P.leading,Xe="maxWait"in P,ae=Xe?En(Qi(P.maxWait)||0,d):ae,_t="trailing"in P?!!P.trailing:_t);function Nt(pn){var vs=U,yo=Y;return U=Y=r,We=pn,pe=c.apply(yo,vs),pe}function Vt(pn){return We=pn,ve=Ml(wr,d),Ke?Nt(pn):pe}function fr(pn){var vs=pn-xe,yo=pn-We,SA=d-vs;return Xe?zn(SA,ae-yo):SA}function Gt(pn){var vs=pn-xe,yo=pn-We;return xe===r||vs>=d||vs<0||Xe&&yo>=ae}function wr(){var pn=$0();if(Gt(pn))return Sr(pn);ve=Ml(wr,fr(pn))}function Sr(pn){return ve=r,_t&&U?Nt(pn):(U=Y=r,pe)}function Ai(){ve!==r&&g9(ve),We=0,U=xe=Y=ve=r}function ei(){return ve===r?pe:Sr($0())}function Pi(){var pn=$0(),vs=Gt(pn);if(U=arguments,Y=this,xe=pn,vs){if(ve===r)return Vt(xe);if(Xe)return g9(ve),ve=Ml(wr,d),Nt(xe)}return ve===r&&(ve=Ml(wr,d)),pe}return Pi.cancel=Ai,Pi.flush=ei,Pi}var Uee=dr(function(c,d){return G7(c,1,d)}),$ee=dr(function(c,d,P){return G7(c,Qi(d)||0,P)});function qee(c){return po(c,V)}function q0(c,d){if(typeof c!="function"||d!=null&&typeof d!="function")throw new Gi(o);var P=function(){var U=arguments,Y=d?d.apply(this,U):U[0],ae=P.cache;if(ae.has(Y))return ae.get(Y);var pe=c.apply(this,U);return P.cache=ae.set(Y,pe)||ae,pe};return P.cache=new(q0.Cache||lo),P}q0.Cache=lo;function z0(c){if(typeof c!="function")throw new Gi(o);return function(){var d=arguments;switch(d.length){case 0:return!c.call(this);case 1:return!c.call(this,d[0]);case 2:return!c.call(this,d[0],d[1]);case 3:return!c.call(this,d[0],d[1],d[2])}return!c.apply(this,d)}}function zee(c){return tA(2,c)}var Hee=RZ(function(c,d){d=d.length==1&&or(d[0])?Xr(d[0],_i(qt())):Xr(Bn(d,1),_i(qt()));var P=d.length;return dr(function(U){for(var Y=-1,ae=zn(U.length,P);++Y=d}),rc=Q7((function(){return arguments})())?Q7:function(c){return tn(c)&&Rr.call(c,"callee")&&!j7.call(c,"callee")},or=Re.isArray,ste=Xn?_i(Xn):dZ;function hi(c){return c!=null&&H0(c.length)&&!vo(c)}function dn(c){return tn(c)&&hi(c)}function ote(c){return c===!0||c===!1||tn(c)&&Zn(c)==Z}var na=wX||ry,ate=ds?_i(ds):pZ;function cte(c){return tn(c)&&c.nodeType===1&&!Cl(c)}function ute(c){if(c==null)return!0;if(hi(c)&&(or(c)||typeof c=="string"||typeof c.splice=="function"||na(c)||lu(c)||rc(c)))return!c.length;var d=Hn(c);if(d==ce||d==Me)return!c.size;if(Il(c))return!wb(c).length;for(var P in c)if(Rr.call(c,P))return!1;return!0}function fte(c,d){return Sl(c,d)}function lte(c,d,P){P=typeof P=="function"?P:r;var U=P?P(c,d):r;return U===r?Sl(c,d,r,P):!!U}function Kb(c){if(!tn(c))return!1;var d=Zn(c);return d==Q||d==N||typeof c.message=="string"&&typeof c.name=="string"&&!Cl(c)}function hte(c){return typeof c=="number"&&$7(c)}function vo(c){if(!Qr(c))return!1;var d=Zn(c);return d==ne||d==de||d==ee||d==Te}function aA(c){return typeof c=="number"&&c==ur(c)}function H0(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=A}function Qr(c){var d=typeof c;return c!=null&&(d=="object"||d=="function")}function tn(c){return c!=null&&typeof c=="object"}var cA=Ki?_i(Ki):mZ;function dte(c,d){return c===d||yb(c,d,kb(d))}function pte(c,d,P){return P=typeof P=="function"?P:r,yb(c,d,kb(d),P)}function gte(c){return uA(c)&&c!=+c}function mte(c){if(QZ(c))throw new rr(s);return e9(c)}function vte(c){return c===null}function bte(c){return c==null}function uA(c){return typeof c=="number"||tn(c)&&Zn(c)==fe}function Cl(c){if(!tn(c)||Zn(c)!=Pe)return!1;var d=v0(c);if(d===null)return!0;var P=Rr.call(d,"constructor")&&d.constructor;return typeof P=="function"&&P instanceof P&&d0.call(P)==pX}var Vb=Ls?_i(Ls):vZ;function yte(c){return aA(c)&&c>=-A&&c<=A}var fA=pl?_i(pl):bZ;function W0(c){return typeof c=="string"||!or(c)&&tn(c)&&Zn(c)==Ne}function Si(c){return typeof c=="symbol"||tn(c)&&Zn(c)==He}var lu=Ga?_i(Ga):yZ;function wte(c){return c===r}function xte(c){return tn(c)&&Hn(c)==$e}function _te(c){return tn(c)&&Zn(c)==qe}var Ete=L0(xb),Ste=L0(function(c,d){return c<=d});function lA(c){if(!c)return[];if(hi(c))return W0(c)?ps(c):li(c);if(ml&&c[ml])return rX(c[ml]());var d=Hn(c),P=d==ce?cb:d==Me?f0:hu;return P(c)}function bo(c){if(!c)return c===0?c:0;if(c=Qi(c),c===y||c===-y){var d=c<0?-1:1;return d*E}return c===c?c:0}function ur(c){var d=bo(c),P=d%1;return d===d?P?d-P:d:0}function hA(c){return c?Za(ur(c),0,I):0}function Qi(c){if(typeof c=="number")return c;if(Si(c))return w;if(Qr(c)){var d=typeof c.valueOf=="function"?c.valueOf():c;c=Qr(d)?d+"":d}if(typeof c!="string")return c===0?c:+c;c=T7(c);var P=et.test(c);return P||rt.test(c)?sr(c.slice(2),P?2:8):Ce.test(c)?w:+c}function dA(c){return Bs(c,di(c))}function Ate(c){return c?Za(ur(c),-A,A):c===0?c:0}function Cr(c){return c==null?"":Ei(c)}var Pte=cu(function(c,d){if(Il(d)||hi(d)){Bs(d,Rn(d),c);return}for(var P in d)Rr.call(d,P)&&xl(c,P,d[P])}),pA=cu(function(c,d){Bs(d,di(d),c)}),K0=cu(function(c,d,P,U){Bs(d,di(d),c,U)}),Ite=cu(function(c,d,P,U){Bs(d,Rn(d),c,U)}),Mte=go(pb);function Cte(c,d){var P=au(c);return d==null?P:K7(P,d)}var Rte=dr(function(c,d){c=zr(c);var P=-1,U=d.length,Y=U>2?d[2]:r;for(Y&&Qn(d[0],d[1],Y)&&(U=1);++P1),ae}),Bs(c,Nb(c),P),U&&(P=Ji(P,g|b|x,$Z));for(var Y=d.length;Y--;)Pb(P,d[Y]);return P});function Gte(c,d){return mA(c,z0(qt(d)))}var Yte=go(function(c,d){return c==null?{}:_Z(c,d)});function mA(c,d){if(c==null)return{};var P=Xr(Nb(c),function(U){return[U]});return d=qt(d),a9(c,P,function(U,Y){return d(U,Y[0])})}function Jte(c,d,P){d=ta(d,c);var U=-1,Y=d.length;for(Y||(Y=1,c=r);++Ud){var U=c;c=d,d=U}if(P||c%1||d%1){var Y=q7();return zn(c+Y*(d-c+$r("1e-"+((Y+"").length-1))),d)}return Eb(c,d)}var are=uu(function(c,d,P){return d=d.toLowerCase(),c+(P?yA(d):d)});function yA(c){return Jb(Cr(c).toLowerCase())}function wA(c){return c=Cr(c),c&&c.replace(yt,XJ).replace(Z1,"")}function cre(c,d,P){c=Cr(c),d=Ei(d);var U=c.length;P=P===r?U:Za(ur(P),0,U);var Y=P;return P-=d.length,P>=0&&c.slice(P,Y)==d}function ure(c){return c=Cr(c),c&&Ct.test(c)?c.replace(Dt,ZJ):c}function fre(c){return c=Cr(c),c&&Ft.test(c)?c.replace(tt,"\\$&"):c}var lre=uu(function(c,d,P){return c+(P?"-":"")+d.toLowerCase()}),hre=uu(function(c,d,P){return c+(P?" ":"")+d.toLowerCase()}),dre=E9("toLowerCase");function pre(c,d,P){c=Cr(c),d=ur(d);var U=d?ru(c):0;if(!d||U>=d)return c;var Y=(d-U)/2;return N0(x0(Y),P)+c+N0(w0(Y),P)}function gre(c,d,P){c=Cr(c),d=ur(d);var U=d?ru(c):0;return d&&U>>0,P?(c=Cr(c),c&&(typeof d=="string"||d!=null&&!Vb(d))&&(d=Ei(d),!d&&tu(c))?ra(ps(c),0,P):c.split(d,P)):[]}var _re=uu(function(c,d,P){return c+(P?" ":"")+Jb(d)});function Ere(c,d,P){return c=Cr(c),P=P==null?0:Za(ur(P),0,c.length),d=Ei(d),c.slice(P,P+d.length)==d}function Sre(c,d,P){var U=re.templateSettings;P&&Qn(c,d,P)&&(d=r),c=Cr(c),d=K0({},d,U,R9);var Y=K0({},d.imports,U.imports,R9),ae=Rn(Y),pe=ab(Y,ae),ve,xe,We=0,Ke=d.interpolate||Rt,Xe="__p += '",_t=ub((d.escape||Rt).source+"|"+Ke.source+"|"+(Ke===Lt?Ee:Rt).source+"|"+(d.evaluate||Rt).source+"|$","g"),Nt="//# sourceURL="+(Rr.call(d,"sourceURL")?(d.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Q1+"]")+` +`;c.replace(_t,function(Gt,wr,Sr,Ai,ei,Pi){return Sr||(Sr=Ai),Xe+=c.slice(We,Pi).replace(Mt,QJ),wr&&(ve=!0,Xe+=`' + +__e(`+wr+`) + +'`),ei&&(xe=!0,Xe+=`'; +`+ei+`; +__p += '`),Sr&&(Xe+=`' + ((__t = (`+Sr+`)) == null ? '' : __t) + -'`),We=Fi+Gt.length,Gt}),Ze+=`'; -`;var Vt=Tr.call(h,"variable")&&h.variable;if(!Vt)Ze=`with (obj) { -`+Ze+` +'`),We=Pi+Gt.length,Gt}),Xe+=`'; +`;var Vt=Rr.call(d,"variable")&&d.variable;if(!Vt)Xe=`with (obj) { +`+Xe+` } -`;else if(ae.test(Vt))throw new tr(a);Ze=(xe?Ze.replace(Jt,""):Ze).replace(St,"$1").replace(er,"$1;"),Ze="function("+(Vt||"obj")+`) { +`;else if(le.test(Vt))throw new rr(a);Xe=(xe?Xe.replace(Jt,""):Xe).replace(St,"$1").replace(Xt,"$1;"),Xe="function("+(Vt||"obj")+`) { `+(Vt?"":`obj || (obj = {}); `)+"var __t, __p = ''"+(ve?", __e = _.escape":"")+(xe?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; -`)+Ze+`return __p -}`;var fr=wP(function(){return Mr(ne,Nt+"return "+Ze).apply(r,he)});if(fr.source=Ze,Hy(fr))throw fr;return fr}function Jse(c){return Cr(c).toLowerCase()}function Xse(c){return Cr(c).toUpperCase()}function Zse(c,h,w){if(c=Cr(c),c&&(w||h===r))return C9(c);if(!c||!(h=ki(h)))return c;var N=Ts(c),V=Ts(h),ne=T9(N,V),he=R9(N,V)+1;return Fa(N,ne,he).join("")}function Qse(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.slice(0,O9(c)+1);if(!c||!(h=ki(h)))return c;var N=Ts(c),V=R9(N,Ts(h))+1;return Fa(N,0,V).join("")}function eoe(c,h,w){if(c=Cr(c),c&&(w||h===r))return c.replace($,"");if(!c||!(h=ki(h)))return c;var N=Ts(c),V=T9(N,Ts(h));return Fa(N,V).join("")}function toe(c,h){var w=me,N=j;if(Qr(h)){var V="separator"in h?h.separator:V;w="length"in h?ur(h.length):w,N="omission"in h?ki(h.omission):N}c=Cr(c);var ne=c.length;if(nf(c)){var he=Ts(c);ne=he.length}if(w>=ne)return c;var ve=w-sf(N);if(ve<1)return N;var xe=he?Fa(he,0,ve).join(""):c.slice(0,ve);if(V===r)return xe+N;if(he&&(ve+=xe.length-ve),Wy(V)){if(c.slice(ve).search(V)){var We,Ke=xe;for(V.global||(V=ay(V.source,Cr(Re.exec(V))+"g")),V.lastIndex=0;We=V.exec(Ke);)var Ze=We.index;xe=xe.slice(0,Ze===r?ve:Ze)}}else if(c.indexOf(ki(V),ve)!=ve){var xt=xe.lastIndexOf(V);xt>-1&&(xe=xe.slice(0,xt))}return xe+N}function roe(c){return c=Cr(c),c&&Bt.test(c)?c.replace(Xt,Ree):c}var noe=hf(function(c,h,w){return c+(w?" ":"")+h.toUpperCase()}),Gy=xA("toUpperCase");function yP(c,h,w){return c=Cr(c),h=w?r:h,h===r?Pee(c)?Nee(c):vee(c):c.match(h)||[]}var wP=hr(function(c,h){try{return Ln(c,r,h)}catch(w){return Hy(w)?w:new tr(w)}}),ioe=Wo(function(c,h){return as(h,function(w){w=uo(w),zo(c,w,qy(c[w],c))}),c});function soe(c){var h=c==null?0:c.length,w=qt();return c=h?Xr(c,function(N){if(typeof N[1]!="function")throw new cs(o);return[w(N[0]),N[1]]}):[],hr(function(N){for(var V=-1;++VS)return[];var w=P,N=Zn(c,P);h=qt(h),c-=P;for(var V=iy(N,h);++w0||h<0)?new _r(w):(c<0?w=w.takeRight(-c):c&&(w=w.drop(c)),h!==r&&(h=ur(h),w=h<0?w.dropRight(-h):w.take(h-c)),w)},_r.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},_r.prototype.toArray=function(){return this.take(P)},ao(_r.prototype,function(c,h){var w=/^(?:filter|find|map|reject)|While$/.test(h),N=/^(?:head|last)$/.test(h),V=te[N?"take"+(h=="last"?"Right":""):h],ne=N||/^find/.test(h);V&&(te.prototype[h]=function(){var he=this.__wrapped__,ve=N?[1]:arguments,xe=he instanceof _r,We=ve[0],Ke=xe||sr(he),Ze=function(yr){var Sr=V.apply(te,Oa([yr],ve));return N&&xt?Sr[0]:Sr};Ke&&w&&typeof We=="function"&&We.length!=1&&(xe=Ke=!1);var xt=this.__chain__,Nt=!!this.__actions__.length,Vt=ne&&!xt,fr=xe&&!Nt;if(!ne&&Ke){he=fr?he:new _r(this);var Gt=c.apply(he,ve);return Gt.__actions__.push({func:eg,args:[Ze],thisArg:r}),new us(Gt,xt)}return Vt&&fr?c.apply(this,ve):(Gt=this.thru(Ze),Vt?N?Gt.value()[0]:Gt.value():Gt)})}),as(["pop","push","shift","sort","splice","unshift"],function(c){var h=Pp[c],w=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",N=/^(?:pop|shift)$/.test(c);te.prototype[c]=function(){var V=arguments;if(N&&!this.__chain__){var ne=this.value();return h.apply(sr(ne)?ne:[],V)}return this[w](function(he){return h.apply(sr(he)?he:[],V)})}}),ao(_r.prototype,function(c,h){var w=te[h];if(w){var N=w.name+"";Tr.call(uf,N)||(uf[N]=[]),uf[N].push({name:h,func:w})}}),uf[Vp(r,B).name]=[{name:"wrapper",func:r}],_r.prototype.clone=rte,_r.prototype.reverse=nte,_r.prototype.value=ite,te.prototype.at=One,te.prototype.chain=Nne,te.prototype.commit=Lne,te.prototype.next=kne,te.prototype.plant=$ne,te.prototype.reverse=Fne,te.prototype.toJSON=te.prototype.valueOf=te.prototype.value=jne,te.prototype.first=te.prototype.head,xh&&(te.prototype[xh]=Bne),te},of=Lee();pn?((pn.exports=of)._=of,Ur._=of):Er._=of}).call(nn)}(h0,h0.exports);var nz=h0.exports,L1={exports:{}};(function(t,e){var r=typeof self<"u"?self:nn,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function u(f){return f&&DataView.prototype.isPrototypeOf(f)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(f){return f&&l.indexOf(Object.prototype.toString.call(f))>-1};function p(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function y(f){return typeof f!="string"&&(f=String(f)),f}function _(f){var g={next:function(){var v=f.shift();return{done:v===void 0,value:v}}};return a.iterable&&(g[Symbol.iterator]=function(){return g}),g}function M(f){this.map={},f instanceof M?f.forEach(function(g,v){this.append(v,g)},this):Array.isArray(f)?f.forEach(function(g){this.append(g[0],g[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(g){this.append(g,f[g])},this)}M.prototype.append=function(f,g){f=p(f),g=y(g);var v=this.map[f];this.map[f]=v?v+", "+g:g},M.prototype.delete=function(f){delete this.map[p(f)]},M.prototype.get=function(f){return f=p(f),this.has(f)?this.map[f]:null},M.prototype.has=function(f){return this.map.hasOwnProperty(p(f))},M.prototype.set=function(f,g){this.map[p(f)]=y(g)},M.prototype.forEach=function(f,g){for(var v in this.map)this.map.hasOwnProperty(v)&&f.call(g,this.map[v],v,this)},M.prototype.keys=function(){var f=[];return this.forEach(function(g,v){f.push(v)}),_(f)},M.prototype.values=function(){var f=[];return this.forEach(function(g){f.push(g)}),_(f)},M.prototype.entries=function(){var f=[];return this.forEach(function(g,v){f.push([v,g])}),_(f)},a.iterable&&(M.prototype[Symbol.iterator]=M.prototype.entries);function O(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function L(f){return new Promise(function(g,v){f.onload=function(){g(f.result)},f.onerror=function(){v(f.error)}})}function B(f){var g=new FileReader,v=L(g);return g.readAsArrayBuffer(f),v}function k(f){var g=new FileReader,v=L(g);return g.readAsText(f),v}function H(f){for(var g=new Uint8Array(f),v=new Array(g.length),x=0;x-1?g:f}function W(f,g){g=g||{};var v=g.body;if(f instanceof W){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,g.headers||(this.headers=new M(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!v&&f._bodyInit!=null&&(v=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=g.credentials||this.credentials||"same-origin",(g.headers||!this.headers)&&(this.headers=new M(g.headers)),this.method=R(g.method||this.method||"GET"),this.mode=g.mode||this.mode||null,this.signal=g.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(v)}W.prototype.clone=function(){return new W(this,{body:this._bodyInit})};function ie(f){var g=new FormData;return f.trim().split("&").forEach(function(v){if(v){var x=v.split("="),S=x.shift().replace(/\+/g," "),A=x.join("=").replace(/\+/g," ");g.append(decodeURIComponent(S),decodeURIComponent(A))}}),g}function me(f){var g=new M,v=f.replace(/\r?\n[\t ]+/g," ");return v.split(/\r?\n/).forEach(function(x){var S=x.split(":"),A=S.shift().trim();if(A){var b=S.join(":").trim();g.append(A,b)}}),g}z.call(W.prototype);function j(f,g){g||(g={}),this.type="default",this.status=g.status===void 0?200:g.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in g?g.statusText:"OK",this.headers=new M(g.headers),this.url=g.url||"",this._initBody(f)}z.call(j.prototype),j.prototype.clone=function(){return new j(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new M(this.headers),url:this.url})},j.error=function(){var f=new j(null,{status:0,statusText:""});return f.type="error",f};var E=[301,302,303,307,308];j.redirect=function(f,g){if(E.indexOf(g)===-1)throw new RangeError("Invalid status code");return new j(null,{status:g,headers:{location:f}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(g,v){this.message=g,this.name=v;var x=Error(g);this.stack=x.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function m(f,g){return new Promise(function(v,x){var S=new W(f,g);if(S.signal&&S.signal.aborted)return x(new o.DOMException("Aborted","AbortError"));var A=new XMLHttpRequest;function b(){A.abort()}A.onload=function(){var P={status:A.status,statusText:A.statusText,headers:me(A.getAllResponseHeaders()||"")};P.url="responseURL"in A?A.responseURL:P.headers.get("X-Request-URL");var I="response"in A?A.response:A.responseText;v(new j(I,P))},A.onerror=function(){x(new TypeError("Network request failed"))},A.ontimeout=function(){x(new TypeError("Network request failed"))},A.onabort=function(){x(new o.DOMException("Aborted","AbortError"))},A.open(S.method,S.url,!0),S.credentials==="include"?A.withCredentials=!0:S.credentials==="omit"&&(A.withCredentials=!1),"responseType"in A&&a.blob&&(A.responseType="blob"),S.headers.forEach(function(P,I){A.setRequestHeader(I,P)}),S.signal&&(S.signal.addEventListener("abort",b),A.onreadystatechange=function(){A.readyState===4&&S.signal.removeEventListener("abort",b)}),A.send(typeof S._bodyInit>"u"?null:S._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=M,s.Request=W,s.Response=j),o.Headers=M,o.Request=W,o.Response=j,o.fetch=m,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(L1,L1.exports);var iz=L1.exports;const a5=ji(iz);var sz=Object.defineProperty,oz=Object.defineProperties,az=Object.getOwnPropertyDescriptors,c5=Object.getOwnPropertySymbols,cz=Object.prototype.hasOwnProperty,uz=Object.prototype.propertyIsEnumerable,u5=(t,e,r)=>e in t?sz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,f5=(t,e)=>{for(var r in e||(e={}))cz.call(e,r)&&u5(t,r,e[r]);if(c5)for(var r of c5(e))uz.call(e,r)&&u5(t,r,e[r]);return t},l5=(t,e)=>oz(t,az(e));const fz={Accept:"application/json","Content-Type":"application/json"},lz="POST",h5={headers:fz,method:lz},d5=10;let Ss=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new Hi.EventEmitter,this.isAvailable=!1,this.registering=!1,!h6(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=mo(e),n=await(await a5(this.url,l5(f5({},h5),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!h6(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=mo({id:1,jsonrpc:"2.0",method:"test",params:[]});await a5(e,l5(f5({},h5),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Qa(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=o0(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return a6(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>d5&&this.events.setMaxListeners(d5)}};const p5="error",hz="wss://relay.walletconnect.org",dz="wc",pz="universal_provider",g5=`${dz}@2:${pz}:`,m5="https://rpc.walletconnect.org/v1/",Cu="generic",gz=`${m5}bundler`,ts={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var mz=Object.defineProperty,vz=Object.defineProperties,bz=Object.getOwnPropertyDescriptors,v5=Object.getOwnPropertySymbols,yz=Object.prototype.hasOwnProperty,wz=Object.prototype.propertyIsEnumerable,b5=(t,e,r)=>e in t?mz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,d0=(t,e)=>{for(var r in e||(e={}))yz.call(e,r)&&b5(t,r,e[r]);if(v5)for(var r of v5(e))wz.call(e,r)&&b5(t,r,e[r]);return t},xz=(t,e)=>vz(t,bz(e));function Di(t,e,r){var n;const i=Su(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${m5}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function vc(t){return t.includes(":")?t.split(":")[1]:t}function y5(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function _z(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function k1(t={},e={}){const r=w5(t),n=w5(e);return nz.merge(r,n)}function w5(t){var e,r,n,i;const s={};if(!Ml(t))return s;for(const[o,a]of Object.entries(t)){const u=y1(o)?[o]:a.chains,l=a.methods||[],d=a.events||[],p=a.rpcMap||{},y=Pl(o);s[y]=xz(d0(d0({},s[y]),a),{chains:Qd(u,(e=s[y])==null?void 0:e.chains),methods:Qd(l,(r=s[y])==null?void 0:r.methods),events:Qd(d,(n=s[y])==null?void 0:n.events),rpcMap:d0(d0({},p),(i=s[y])==null?void 0:i.rpcMap)})}return s}function Ez(t){return t.includes(":")?t.split(":")[2]:t}function x5(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=y1(r)?[r]:n.chains?n.chains:y5(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function B1(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const _5={},Pr=t=>_5[t],$1=(t,e)=>{_5[t]=e};class Sz{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=vc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}}var Az=Object.defineProperty,Pz=Object.defineProperties,Mz=Object.getOwnPropertyDescriptors,E5=Object.getOwnPropertySymbols,Iz=Object.prototype.hasOwnProperty,Cz=Object.prototype.propertyIsEnumerable,S5=(t,e,r)=>e in t?Az(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A5=(t,e)=>{for(var r in e||(e={}))Iz.call(e,r)&&S5(t,r,e[r]);if(E5)for(var r of E5(e))Cz.call(e,r)&&S5(t,r,e[r]);return t},P5=(t,e)=>Pz(t,Mz(e));class Tz{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(vc(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const u=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:P5(A5({},o.sessionProperties||{}),{capabilities:P5(A5({},a||{}),{[s]:u})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return u}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(va("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${gz}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class Rz{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=vc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}}let Dz=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=vc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}},Oz=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Zi(new Ss(n,Pr("disableProviderPing")))}},Nz=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=vc(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}},Lz=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=vc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}};class kz{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=vc(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}}let Bz=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Zi(new Ss(n,Pr("disableProviderPing")))}};class $z{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Di(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace);return typeof n>"u"?void 0:new Zi(new Ss(n))}}class Fz{constructor(e){this.name=Cu,this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ts.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=Su(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Di(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Zi(new Ss(n,Pr("disableProviderPing")))}}var jz=Object.defineProperty,Uz=Object.defineProperties,qz=Object.getOwnPropertyDescriptors,M5=Object.getOwnPropertySymbols,zz=Object.prototype.hasOwnProperty,Hz=Object.prototype.propertyIsEnumerable,I5=(t,e,r)=>e in t?jz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,p0=(t,e)=>{for(var r in e||(e={}))zz.call(e,r)&&I5(t,r,e[r]);if(M5)for(var r of M5(e))Hz.call(e,r)&&I5(t,r,e[r]);return t},F1=(t,e)=>Uz(t,qz(e));let j1=class SP{constructor(e){this.events=new im,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:rl(bd({level:(e==null?void 0:e.logger)||p5})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new SP(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:p0({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,s0(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Dr("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=x5(this.session.namespaces);this.namespaces=k1(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=x5(s.namespaces);this.namespaces=k1(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==i5)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Cu?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(lc(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await N1.init({core:this.providerOpts.core,logger:this.providerOpts.logger||p5,relayUrl:this.providerOpts.relayUrl||hz,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>Pl(r)))];$1("client",this.client),$1("events",this.events),$1("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=_z(r,this.session),i=y5(n),s=k1(this.namespaces,this.optionalNamespaces),o=F1(p0({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new Tz({namespace:o});break;case"algorand":this.rpcProviders[r]=new Oz({namespace:o});break;case"solana":this.rpcProviders[r]=new Rz({namespace:o});break;case"cosmos":this.rpcProviders[r]=new Dz({namespace:o});break;case"polkadot":this.rpcProviders[r]=new Sz({namespace:o});break;case"cip34":this.rpcProviders[r]=new Nz({namespace:o});break;case"elrond":this.rpcProviders[r]=new Lz({namespace:o});break;case"multiversx":this.rpcProviders[r]=new kz({namespace:o});break;case"near":this.rpcProviders[r]=new Bz({namespace:o});break;case"tezos":this.rpcProviders[r]=new $z({namespace:o});break;default:this.rpcProviders[Cu]?this.rpcProviders[Cu].updateNamespace(o):this.rpcProviders[Cu]=new Fz({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&lc(i)&&this.events.emit("accountsChanged",i.map(Ez))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=Pl(i),a=B1(i)!==B1(s)?`${o}:${B1(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=F1(p0({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",F1(p0({},Dr("USER_DISCONNECTED")),{data:e.topic}))}),this.on(ts.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Cu]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>Pl(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=Pl(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${g5}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${g5}/${e}`)}};const Wz=j1;function Kz(){return new Promise(t=>{const e=[];let r;window.addEventListener("eip6963:announceProvider",n=>{const{detail:i}=n;r&&clearTimeout(r),e.push(i),r=setTimeout(()=>t(e),200)}),r=setTimeout(()=>t(e),200),window.dispatchEvent(new Event("eip6963:requestProvider"))})}class Qs{constructor(e,r){this.scope=e,this.module=r}storeObject(e,r){this.setItem(e,JSON.stringify(r))}loadObject(e){const r=this.getItem(e);return r?JSON.parse(r):void 0}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new Qs("CBWSDK").clear(),new Qs("walletlink").clear()}}const an={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},U1={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},C5="Unspecified error message.",Vz="Unspecified server error.";function q1(t,e=C5){if(t&&Number.isInteger(t)){const r=t.toString();if(z1(U1,r))return U1[r].message;if(T5(t))return Vz}return e}function Gz(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(U1[e]||T5(t))}function Yz(t,{shouldIncludeStack:e=!1}={}){const r={};if(t&&typeof t=="object"&&!Array.isArray(t)&&z1(t,"code")&&Gz(t.code)){const n=t;r.code=n.code,n.message&&typeof n.message=="string"?(r.message=n.message,z1(n,"data")&&(r.data=n.data)):(r.message=q1(r.code),r.data={originalError:R5(t)})}else r.code=an.rpc.internal,r.message=D5(t,"message")?t.message:C5,r.data={originalError:R5(t)};return e&&(r.stack=D5(t,"stack")?t.stack:void 0),r}function T5(t){return t>=-32099&&t<=-32e3}function R5(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function z1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function D5(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const Ar={rpc:{parse:t=>rs(an.rpc.parse,t),invalidRequest:t=>rs(an.rpc.invalidRequest,t),invalidParams:t=>rs(an.rpc.invalidParams,t),methodNotFound:t=>rs(an.rpc.methodNotFound,t),internal:t=>rs(an.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return rs(e,t)},invalidInput:t=>rs(an.rpc.invalidInput,t),resourceNotFound:t=>rs(an.rpc.resourceNotFound,t),resourceUnavailable:t=>rs(an.rpc.resourceUnavailable,t),transactionRejected:t=>rs(an.rpc.transactionRejected,t),methodNotSupported:t=>rs(an.rpc.methodNotSupported,t),limitExceeded:t=>rs(an.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Tu(an.provider.userRejectedRequest,t),unauthorized:t=>Tu(an.provider.unauthorized,t),unsupportedMethod:t=>Tu(an.provider.unsupportedMethod,t),disconnected:t=>Tu(an.provider.disconnected,t),chainDisconnected:t=>Tu(an.provider.chainDisconnected,t),unsupportedChain:t=>Tu(an.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new L5(e,r,n)}}};function rs(t,e){const[r,n]=O5(e);return new N5(t,r||q1(t),n)}function Tu(t,e){const[r,n]=O5(e);return new L5(t,r||q1(t),n)}function O5(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}class N5 extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}}class L5 extends N5{constructor(e,r,n){if(!Jz(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}function Jz(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function H1(){return t=>t}const kl=H1(),Xz=H1(),Zz=H1();function Co(t){return Math.floor(t)}const k5=/^[0-9]*$/,B5=/^[a-f0-9]*$/;function bc(t){return W1(crypto.getRandomValues(new Uint8Array(t)))}function W1(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function g0(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function Bl(t,e=!1){const r=t.toString("hex");return kl(e?`0x${r}`:r)}function K1(t){return Bl(Y1(t),!0)}function eo(t){return Zz(t.toString(10))}function ba(t){return kl(`0x${BigInt(t).toString(16)}`)}function $5(t){return t.startsWith("0x")||t.startsWith("0X")}function V1(t){return $5(t)?t.slice(2):t}function F5(t){return $5(t)?`0x${t.slice(2)}`:`0x${t}`}function m0(t){if(typeof t!="string")return!1;const e=V1(t).toLowerCase();return B5.test(e)}function Qz(t,e=!1){if(typeof t=="string"){const r=V1(t).toLowerCase();if(B5.test(r))return kl(e?`0x${r}`:r)}throw Ar.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function G1(t,e=!1){let r=Qz(t,!1);return r.length%2===1&&(r=kl(`0${r}`)),e?kl(`0x${r}`):r}function ya(t){if(typeof t=="string"){const e=V1(t).toLowerCase();if(m0(e)&&e.length===40)return Xz(F5(e))}throw Ar.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function Y1(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(m0(t)){const e=G1(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Ar.rpc.invalidParams(`Not binary data: ${String(t)}`)}function $l(t){if(typeof t=="number"&&Number.isInteger(t))return Co(t);if(typeof t=="string"){if(k5.test(t))return Co(Number(t));if(m0(t))return Co(Number(BigInt(G1(t,!0))))}throw Ar.rpc.invalidParams(`Not an integer: ${String(t)}`)}function Fl(t){if(t!==null&&(typeof t=="bigint"||tH(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt($l(t));if(typeof t=="string"){if(k5.test(t))return BigInt(t);if(m0(t))return BigInt(G1(t,!0))}throw Ar.rpc.invalidParams(`Not an integer: ${String(t)}`)}function eH(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Ar.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function tH(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function rH(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function nH(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function iH(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,new TextEncoder().encode(e));return{iv:r,cipherText:n}}async function sH(t,{iv:e,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return new TextDecoder().decode(n)}function j5(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function U5(t,e){const r=j5(t),n=await crypto.subtle.exportKey(r,e);return W1(new Uint8Array(n))}async function q5(t,e){const r=j5(t),n=g0(e).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function oH(t,e){const r=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return iH(e,r)}async function aH(t,e){return JSON.parse(await sH(e,t))}const J1={storageKey:"ownPrivateKey",keyType:"private"},X1={storageKey:"ownPublicKey",keyType:"public"},Z1={storageKey:"peerPublicKey",keyType:"public"};class cH{constructor(){this.storage=new Qs("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(Z1,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(X1.storageKey),this.storage.removeItem(J1.storageKey),this.storage.removeItem(Z1.storageKey)}async generateKeyPair(){const e=await rH();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(J1,e.privateKey),await this.storeKey(X1,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(J1)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(X1)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(Z1)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await nH(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const r=this.storage.getItem(e.storageKey);return r?q5(e.keyType,r):null}async storeKey(e,r){const n=await U5(e.keyType,r);this.storage.setItem(e.storageKey,n)}}const jl="4.2.4",z5="@coinbase/wallet-sdk";async function H5(t,e){const r=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":jl,"X-Cbw-Sdk-Platform":z5}}),{result:i,error:s}=await n.json();if(s)throw s;return i}function uH(){return globalThis.coinbaseWalletExtension}function fH(){var t,e;try{const r=globalThis;return(t=r.ethereum)!==null&&t!==void 0?t:(e=r.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function lH({metadata:t,preference:e}){var r,n;const{appName:i,appLogoUrl:s,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const u=uH();if(u)return(r=u.setAppInfo)===null||r===void 0||r.call(u,i,s,o,e),u}const a=fH();if(a!=null&&a.isCoinbaseBrowser)return(n=a.setAppInfo)===null||n===void 0||n.call(a,i,s,o,e),a}function hH(t){if(!t||typeof t!="object"||Array.isArray(t))throw Ar.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:r}=t;if(typeof e!="string"||e.length===0)throw Ar.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Ar.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw Ar.provider.unsupportedMethod()}}const W5="accounts",K5="activeChain",V5="availableChains",G5="walletCapabilities";class dH{constructor(e){var r,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new cH,this.storage=new Qs("CBWSDK","SCWStateManager"),this.accounts=(r=this.storage.loadObject(W5))!==null&&r!==void 0?r:[],this.chain=this.storage.loadObject(K5)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var r,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(r=e.params)!==null&&r!==void 0?r:{})}}),s=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in s.content)throw s.content.failure;const o=await q5("public",s.sender);await this.keyManager.setPeerPublicKey(o);const u=(await this.decryptResponseMessage(s)).result;if("error"in u)throw u.error;const l=u.value;this.accounts=l,this.storage.storeObject(W5,l),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",l)}async request(e){var r;if(this.accounts.length===0)throw Ar.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:ba(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return ba(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(G5);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw Ar.rpc.internal("No RPC URL set for chain");return H5(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var r,n;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const i=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(i)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,r;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(r=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&r!==void 0?r:1}}async handleSwitchChainRequest(e){var r;const n=e.params;if(!n||!(!((r=n[0])===null||r===void 0)&&r.chainId))throw Ar.rpc.invalidParams();const i=$l(n[0].chainId);if(this.updateChain(i))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(i),o}async sendEncryptedRequest(e){const r=await this.keyManager.getSharedSecret();if(!r)throw Ar.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await oH({action:e,chainId:this.chain.id},r),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const r=await U5("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:r,content:e,timestamp:new Date}}async decryptResponseMessage(e){var r,n;const i=e.content;if("failure"in i)throw i.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw Ar.provider.unauthorized("Invalid session");const o=await aH(i.encrypted,s),a=(r=o.data)===null||r===void 0?void 0:r.chains;if(a){const l=Object.entries(a).map(([d,p])=>({id:Number(d),rpcUrl:p}));this.storage.storeObject(V5,l),this.updateChain(this.chain.id,l)}const u=(n=o.data)===null||n===void 0?void 0:n.capabilities;return u&&this.storage.storeObject(G5,u),o}updateChain(e,r){var n;const i=r??this.storage.loadObject(V5),s=i==null?void 0:i.find(o=>o.id===e);return s?(s!==this.chain&&(this.chain=s,this.storage.storeObject(K5,s),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",ba(s.id))),!0):!1}}const pH=cg(PM),{keccak_256:gH}=pH;function Y5(t){return Buffer.allocUnsafe(t).fill(0)}function mH(t){return t.toString(2).length}function J5(t,e){let r=t.toString(16);r.length%2!==0&&(r="0"+r);const n=r.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(r=n4(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(to(t,e[s]));if(r==="dynamic"){var o=to("uint256",e.length);i.unshift(o)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([to("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,ii.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Ru(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return ii.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Ru(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=yc(e);const a=ii.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+a);if(n<0)throw new Error("Supplied uint is negative");return ii.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(r=Ru(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=yc(e);const a=ii.bitLengthFromBigInt(n);if(a>r)throw new Error("Supplied int exceeds width: "+r+" vs "+a);const u=ii.twosFromBigInt(n,256);return ii.bufferBEFromBigInt(u,32)}else if(t.startsWith("ufixed")){if(r=r4(t),n=yc(e),n<0)throw new Error("Supplied ufixed is negative");return to("uint256",n*BigInt(2)**BigInt(r[1]))}else if(t.startsWith("fixed"))return r=r4(t),to("int256",yc(e)*BigInt(2)**BigInt(r[1]))}throw new Error("Unsupported or invalid type: "+t)}function _H(t){return t==="string"||t==="bytes"||n4(t)==="dynamic"}function EH(t){return t.lastIndexOf("]")===t.length-1}function SH(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var o=t4(t[s]),a=e[s],u=to(o,a);_H(o)?(r.push(to("uint256",i)),n.push(u),i+=u.length):r.push(u)}return Buffer.concat(r.concat(n))}function i4(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(ii.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=Ru(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);n=yc(a);const u=ii.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+u);i.push(ii.bufferBEFromBigInt(n,r/8))}else if(o.startsWith("int")){if(r=Ru(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);n=yc(a);const u=ii.bitLengthFromBigInt(n);if(u>r)throw new Error("Supplied int exceeds width: "+r+" vs "+u);const l=ii.twosFromBigInt(n,r);i.push(ii.bufferBEFromBigInt(l,r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function AH(t,e){return ii.keccak(i4(t,e))}var PH={rawEncode:SH,solidityPack:i4,soliditySHA3:AH};const As=e4,Ul=PH,s4={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},Q1={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const o=(a,u,l)=>{if(r[u]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":As.keccak(this.encodeData(u,l,r,n))];if(l===void 0)throw new Error(`missing value for field ${a} of type ${u}`);if(u==="bytes")return["bytes32",As.keccak(l)];if(u==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",As.keccak(l)];if(u.lastIndexOf("]")===u.length-1){const d=u.slice(0,u.lastIndexOf("[")),p=l.map(y=>o(a,d,y));return["bytes32",As.keccak(Ul.rawEncode(p.map(([y])=>y),p.map(([,y])=>y)))]}return[u,l]};for(const a of r[t]){const[u,l]=o(a.name,a.type,e[a.name]);i.push(u),s.push(l)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=As.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=As.keccak(a),s.push(a);else if(r[o.type]!==void 0)i.push("bytes32"),a=As.keccak(this.encodeData(o.type,a,r,n)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return Ul.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return As.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return As.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in s4.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),As.keccak(Buffer.concat(n))}};var MH={TYPED_MESSAGE_SCHEMA:s4,TypedDataUtils:Q1,hashForSignTypedDataLegacy:function(t){return IH(t.data)},hashForSignTypedData_v3:function(t){return Q1.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return Q1.hash(t.data)}};function IH(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?As.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return Ul.soliditySHA3(["bytes32","bytes32"],[Ul.soliditySHA3(new Array(t.length).fill("string"),i),Ul.soliditySHA3(n,r)])}const b0=ji(MH),CH="walletUsername",ev="Addresses",TH="AppVersion";function Un(t){return t.errorMessage!==void 0}class RH{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",g0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),a=16,u=o.slice(o.byteLength-a),l=o.slice(0,o.byteLength-a),d=new Uint8Array(u),p=new Uint8Array(l),y=new Uint8Array([...n,...d,...p]);return W1(y)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",g0(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=g0(e),a=o.slice(0,12),u=o.slice(12,28),l=o.slice(28),d=new Uint8Array([...l,...u]),p={name:"AES-GCM",iv:new Uint8Array(a)};try{const y=await window.crypto.subtle.decrypt(p,s,d),_=new TextDecoder;n(_.decode(y))}catch(y){i(y)}})()})}}class DH{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}var To;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(To||(To={}));class OH{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,To.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.DISCONNECTED)},i.onopen=s=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,To.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(u=>this.sendData(u)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const u=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,u)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,To.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const o4=1e4,NH=6e4;class LH{constructor({session:e,linkAPIUrl:r,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Co(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,u)=>{const l=s[u];l!==void 0&&a(l)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,u)},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(CH,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(TH,s)},this.handleChainUpdated=async(s,o)=>{var a;const u=await this.cipher.decrypt(s),l=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(u,l)},this.session=e,this.cipher=new RH(e.secret),this.listener=n;const i=new OH(`${r}/rpc`,WebSocket);i.setConnectionStateListener(async s=>{let o=!1;switch(s){case To.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(u=>setTimeout(u,5e3)),this.destroyed||i.connect().catch(()=>{a()})};a()}break;case To.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},o4),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case To.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(s=>{var o;switch(s.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=s.type==="IsLinkedOK"?s.linked:void 0;this.linked=a||s.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(s.metadata);break}case"Event":{this.handleIncomingEvent(s);break}}s.id!==void 0&&((o=this.requestResolutions.get(s.id))===null||o===void 0||o(s))}),this.ws=i,this.http=new DH(r,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:s,response:o}=i;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s,o)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Co(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>o4*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r={timeout:NH}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r.timeout)}),new Promise(s=>{this.requestResolutions.set(n,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Co(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Co(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Co(this.nextReqId++),sessionId:this.session.id}),!0)}}class kH{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=F5(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}const a4="session:id",c4="session:secret",u4="session:linked";class Du{constructor(e,r,n,i=!1){this.storage=e,this.id=r,this.secret=n,this.key=Yc(c2(`${r}, ${n} WalletLink`)),this._linked=!!i}static create(e){const r=bc(16),n=bc(32);return new Du(e,r,n).save()}static load(e){const r=e.getItem(a4),n=e.getItem(u4),i=e.getItem(c4);return r&&i?new Du(e,r,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(a4,this.id),this.storage.setItem(c4,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(u4,this._linked?"1":"0")}}function BH(){try{return window.frameElement!==null}catch{return!1}}function $H(){try{return BH()&&window.top?window.top.location:window.location}catch{return window.location}}function FH(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function f4(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const jH='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function l4(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(jH)),document.documentElement.appendChild(t)}function h4(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e2&&(o.children=arguments.length>3?y0.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return w0(t,o,n,i,null)}function w0(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++d4,__i:-1,__u:0};return i==null&&Vr.vnode!=null&&Vr.vnode(s),s}function Hl(t){return t.children}function x0(t,e){this.props=t,this.context=e}function Ou(t,e){if(e==null)return t.__?Ou(t.__,t.__i+1):null;for(var r;ee&&wc.sort(tv));_0.__r=0}function w4(t,e,r,n,i,s,o,a,u,l,d){var p,y,_,M,O,L,B=n&&n.__k||v4,k=e.length;for(u=qH(r,e,B,u),p=0;p0?w0(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,(u=s.__i=zH(s,r,a,p))!==-1&&(p--,(o=r[u])&&(o.__u|=2)),o==null||o.__v===null?(u==-1&&y--,typeof s.type!="function"&&(s.__u|=4)):u!==a&&(u==a-1?y--:u==a+1?y++:(u>a?y--:y++,s.__u|=4))):s=t.__k[i]=null;if(p)for(i=0;i(u!=null&&!(2&u.__u)?1:0))for(;o>=0||a=0){if((u=e[o])&&!(2&u.__u)&&i==u.key&&s===u.type)return o;o--}if(a=r.__.length&&r.__.push({}),r.__[t]}function L4(t){return lv=1,KH(B4,t)}function KH(t,e,r){var n=N4(S0++,2);if(n.t=t,!n.__c&&(n.__=[B4(void 0,e),function(a){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,a);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=cn,!cn.u)){var i=function(a,u,l){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(y){return!!y.__c});if(d.every(function(y){return!y.__N}))return!s||s.call(this,a,u,l);var p=n.__c.props!==a;return d.forEach(function(y){if(y.__N){var _=y.__[0];y.__=y.__N,y.__N=void 0,_!==y.__[0]&&(p=!0)}}),s&&s.call(this,a,u,l)||p};cn.u=!0;var s=cn.shouldComponentUpdate,o=cn.componentWillUpdate;cn.componentWillUpdate=function(a,u,l){if(this.__e){var d=s;s=void 0,i(a,u,l),s=d}o&&o.call(this,a,u,l)},cn.shouldComponentUpdate=i}return n.__N||n.__}function VH(t,e){var r=N4(S0++,3);!yn.__s&&JH(r.__H,e)&&(r.__=t,r.i=e,cn.__H.__h.push(r))}function GH(){for(var t;t=M4.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(A0),t.__H.__h.forEach(hv),t.__H.__h=[]}catch(e){t.__H.__h=[],yn.__e(e,t.__v)}}yn.__b=function(t){cn=null,I4&&I4(t)},yn.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),O4&&O4(t,e)},yn.__r=function(t){C4&&C4(t),S0=0;var e=(cn=t.__c).__H;e&&(fv===cn?(e.__h=[],cn.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(A0),e.__h.forEach(hv),e.__h=[],S0=0)),fv=cn},yn.diffed=function(t){T4&&T4(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(M4.push(e)!==1&&P4===yn.requestAnimationFrame||((P4=yn.requestAnimationFrame)||YH)(GH)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),fv=cn=null},yn.__c=function(t,e){e.some(function(r){try{r.__h.forEach(A0),r.__h=r.__h.filter(function(n){return!n.__||hv(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],yn.__e(n,r.__v)}}),R4&&R4(t,e)},yn.unmount=function(t){D4&&D4(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{A0(n)}catch(i){e=i}}),r.__H=void 0,e&&yn.__e(e,r.__v))};var k4=typeof requestAnimationFrame=="function";function YH(t){var e,r=function(){clearTimeout(n),k4&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);k4&&(e=requestAnimationFrame(r))}function A0(t){var e=cn,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),cn=e}function hv(t){var e=cn;t.__c=t.__(),cn=e}function JH(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function B4(t,e){return typeof e=="function"?e(t):e}const XH=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",ZH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",QH="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class eW{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=f4()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const r=this.nextItemKey++;return this.items.set(r,e),this.render(),()=>{this.items.delete(r),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&uv(Or("div",null,Or($4,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,r])=>Or(tW,Object.assign({},r,{key:e}))))),this.root)}}const $4=t=>Or("div",{class:ql("-cbwsdk-snackbar-container")},Or("style",null,XH),Or("div",{class:"-cbwsdk-snackbar"},t.children)),tW=({autoExpand:t,message:e,menuItems:r})=>{const[n,i]=L4(!0),[s,o]=L4(t??!1);VH(()=>{const u=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{u.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return Or("div",{class:ql("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},Or("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},Or("img",{src:ZH,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",Or("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),Or("div",{class:"-gear-container"},!s&&Or("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),Or("img",{src:QH,class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&Or("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((u,l)=>Or("div",{class:ql("-cbwsdk-snackbar-instance-menu-item",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:u.onClick,key:l},Or("svg",{width:u.svgWidth,height:u.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("path",{"fill-rule":u.defaultFillRule,"clip-rule":u.defaultClipRule,d:u.path,fill:"#AAAAAA"})),Or("span",{class:ql("-cbwsdk-snackbar-instance-menu-item-info",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},u.info)))))};class rW{constructor(){this.attached=!1,this.snackbar=new eW}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.snackbar.attach(r),this.attached=!0,l4()}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}}const nW=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class iW{constructor(){this.root=null,this.darkMode=f4()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),l4()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(uv(null,this.root),e&&uv(Or(sW,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const sW=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return Or($4,{darkMode:r},Or("div",{class:"-cbwsdk-redirect-dialog"},Or("style",null,nW),Or("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),Or("div",{class:ql("-cbwsdk-redirect-dialog-box",s)},Or("p",null,t),Or("button",{onClick:n},e))))},oW="https://keys.coinbase.com/connect",F4="https://www.walletlink.org",aW="https://go.cb-w.com/walletlink";class j4{constructor(){this.attached=!1,this.redirectDialog=new iW}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const r=new URL(aW);r.searchParams.append("redirect_url",$H().href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class Ro{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=FH(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(ev);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!u&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),Ro.accountRequestCallbackIds.size>0&&(Array.from(Ro.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),Ro.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new kH,this.ui=n,this.ui.attach()}subscribe(){const e=Du.load(this.storage)||Du.create(this.storage),{linkAPIUrl:r}=this,n=new LH({session:e,linkAPIUrl:r,listener:this}),i=this.isMobileWeb?new j4:new rW;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=Du.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Qs.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:eo(e.weiValue),data:Bl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?eo(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?eo(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?eo(e.gasPriceInWei):null,gasLimit:e.gasLimit?eo(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:eo(e.weiValue),data:Bl(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?eo(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?eo(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?eo(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?eo(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Bl(e,!0),chainId:r}})}getWalletLinkSession(){return this._session}sendRequest(e){let r=null;const n=bc(8),i=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,s),r==null||r()};return new Promise((s,o)=>{r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,a=>{if(r==null||r(),Un(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,r){const n={type:"WEB3_REQUEST",id:e,request:r};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:r.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(r.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof j4)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e,r){if(r.method==="requestEthereumAccounts"){Ro.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,r)),Ro.accountRequestCallbackIds.clear();return}this.invokeCallback(e,r)}handleErrorResponse(e,r,n){var i;const s=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:r,errorMessage:s})}invokeCallback(e,r){const n=this.relayEventManager.callbacks.get(e);n&&(n(r),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:r}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:r}},i=bc(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(Un(a))return o(new Error(a.errorMessage));s(a)}),Ro.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,r,n,i,s,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:o}};let u=null;const l=bc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,_=>{if(u==null||u(),Un(_))return y(new Error(_.errorMessage));p(_)}),this.publishWeb3RequestEvent(l,a)})}addEthereumChain(e,r,n,i,s,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:o}};let u=null;const l=bc(8),d=p=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,p),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((p,y)=>{this.relayEventManager.callbacks.set(l,_=>{if(u==null||u(),Un(_))return y(new Error(_.errorMessage));p(_)}),this.publishWeb3RequestEvent(l,a)})}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})};let i=null;const s=bc(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,u)=>{this.relayEventManager.callbacks.set(s,l=>{if(i==null||i(),Un(l)&&l.errorCode)return u(Ar.provider.custom({code:l.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(Un(l))return u(new Error(l.errorMessage));a(l)}),this.publishWeb3RequestEvent(s,n)})}}Ro.accountRequestCallbackIds=new Set;const U4="DefaultChainId",q4="DefaultJsonRpcUrl";class z4{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new Qs("walletlink",F4),this.callback=e.callback||null;const r=this._storage.getItem(ev);if(r){const n=r.split(" ");n[0]!==""&&(this._addresses=n.map(i=>ya(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:r,secret:n}=e.getWalletLinkSession();return{id:r,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(q4))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(q4,e)}updateProviderInfo(e,r){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(U4,r.toString(10)),$l(r)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",ba(r)))}async watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw Ar.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw Ar.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw Ar.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw Ar.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=r.options,l=await this.initializeRelay().watchAsset(r.type,i,s,a,o,n==null?void 0:n.toString());return Un(l)?!1:!!l.result}async addEthereumChain(e){var r,n;const i=e[0];if(((r=i.rpcUrls)===null||r===void 0?void 0:r.length)===0)throw Ar.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw Ar.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw Ar.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:u=[],chainName:l,iconUrls:d=[],nativeCurrency:p}=i,y=await o.addEthereumChain(s.toString(),a,d,u,l,p);if(Un(y))return!1;if(((n=y.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw Ar.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const r=e[0],n=Number.parseInt(r.chainId,16),s=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(Un(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,r){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(s=>ya(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(ev,i.join(" ")))}async request(e){const r=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return ba(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(r);case"wallet_switchEthereumChain":return this.switchEthereumChain(r);case"wallet_watchAsset":return this.watchAsset(r);default:if(!this.jsonRpcUrl)throw Ar.rpc.internal("No RPC URL set for chain");return H5(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const r=ya(e);if(!this._addresses.map(i=>ya(i)).includes(r))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?ya(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?ya(e.to):null,i=e.value!=null?Fl(e.value):BigInt(0),s=e.data?Y1(e.data):Buffer.alloc(0),o=e.nonce!=null?$l(e.nonce):null,a=e.gasPrice!=null?Fl(e.gasPrice):null,u=e.maxFeePerGas!=null?Fl(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?Fl(e.maxPriorityFeePerGas):null,d=e.gas!=null?Fl(e.gas):null,p=e.chainId?$l(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:u,maxPriorityFeePerGas:l,gasLimit:d,chainId:p}}async ecRecover(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Ar.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:K1(n[0]),signature:K1(n[1]),addPrefix:r==="personal_ecRecover"}});if(Un(s))throw s;return s.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(U4))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,r;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:ba(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(Un(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:ba(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw Ar.rpc.invalidParams();const r=e[1],n=e[0];this._ensureKnownAddress(r);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ya(r),message:K1(n),addPrefix:!0,typedDataJson:null}});if(Un(s))throw s;return s.result}async _eth_signTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(r);if(Un(i))throw i;return i.result}async _eth_sendRawTransaction(e){const r=Y1(e[0]),i=await this.initializeRelay().submitEthereumTransaction(r,this.getChainId());if(Un(i))throw i;return i.result}async _eth_sendTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(r);if(Un(i))throw i;return i.result}async signTypedData(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Ar.rpc.invalidParams();const i=l=>{const d={eth_signTypedData_v1:b0.hashForSignTypedDataLegacy,eth_signTypedData_v3:b0.hashForSignTypedData_v3,eth_signTypedData_v4:b0.hashForSignTypedData_v4,eth_signTypedData:b0.hashForSignTypedData_v4};return Bl(d[r]({data:eH(l)}),!0)},s=n[r==="eth_signTypedData_v1"?1:0],o=n[r==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const u=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ya(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(Un(u))throw u;return u.result}initializeRelay(){return this._relay||(this._relay=new Ro({linkAPIUrl:F4,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const H4="SignerType",W4=new Qs("CBWSDK","SignerConfigurator");function cW(){return W4.getItem(H4)}function uW(t){W4.setItem(H4,t)}async function fW(t){const{communicator:e,metadata:r,handshakeRequest:n,callback:i}=t;hW(e,r,i).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:o}=await e.postRequestAndWaitForResponse(s);return o}function lW(t){const{signerType:e,metadata:r,communicator:n,callback:i}=t;switch(e){case"scw":return new dH({metadata:r,callback:i,communicator:n});case"walletlink":return new z4({metadata:r,callback:i})}}async function hW(t,e,r){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new z4({metadata:e,callback:r});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const dW=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. +`)+Xe+`return __p +}`;var fr=_A(function(){return Ir(ae,Nt+"return "+Xe).apply(r,pe)});if(fr.source=Xe,Kb(fr))throw fr;return fr}function Are(c){return Cr(c).toLowerCase()}function Pre(c){return Cr(c).toUpperCase()}function Ire(c,d,P){if(c=Cr(c),c&&(P||d===r))return T7(c);if(!c||!(d=Ei(d)))return c;var U=ps(c),Y=ps(d),ae=D7(U,Y),pe=O7(U,Y)+1;return ra(U,ae,pe).join("")}function Mre(c,d,P){if(c=Cr(c),c&&(P||d===r))return c.slice(0,L7(c)+1);if(!c||!(d=Ei(d)))return c;var U=ps(c),Y=O7(U,ps(d))+1;return ra(U,0,Y).join("")}function Cre(c,d,P){if(c=Cr(c),c&&(P||d===r))return c.replace(K,"");if(!c||!(d=Ei(d)))return c;var U=ps(c),Y=D7(U,ps(d));return ra(U,Y).join("")}function Rre(c,d){var P=X,U=q;if(Qr(d)){var Y="separator"in d?d.separator:Y;P="length"in d?ur(d.length):P,U="omission"in d?Ei(d.omission):U}c=Cr(c);var ae=c.length;if(tu(c)){var pe=ps(c);ae=pe.length}if(P>=ae)return c;var ve=P-ru(U);if(ve<1)return U;var xe=pe?ra(pe,0,ve).join(""):c.slice(0,ve);if(Y===r)return xe+U;if(pe&&(ve+=xe.length-ve),Vb(Y)){if(c.slice(ve).search(Y)){var We,Ke=xe;for(Y.global||(Y=ub(Y.source,Cr(ke.exec(Y))+"g")),Y.lastIndex=0;We=Y.exec(Ke);)var Xe=We.index;xe=xe.slice(0,Xe===r?ve:Xe)}}else if(c.indexOf(Ei(Y),ve)!=ve){var _t=xe.lastIndexOf(Y);_t>-1&&(xe=xe.slice(0,_t))}return xe+U}function Tre(c){return c=Cr(c),c&&Bt.test(c)?c.replace(tr,oX):c}var Dre=uu(function(c,d,P){return c+(P?" ":"")+d.toUpperCase()}),Jb=E9("toUpperCase");function xA(c,d,P){return c=Cr(c),d=P?r:d,d===r?tX(c)?uX(c):KJ(c):c.match(d)||[]}var _A=dr(function(c,d){try{return Cn(c,r,d)}catch(P){return Kb(P)?P:new rr(P)}}),Ore=go(function(c,d){return Vi(d,function(P){P=Fs(P),ho(c,P,Hb(c[P],c))}),c});function Nre(c){var d=c==null?0:c.length,P=qt();return c=d?Xr(c,function(U){if(typeof U[1]!="function")throw new Gi(o);return[P(U[0]),U[1]]}):[],dr(function(U){for(var Y=-1;++YA)return[];var P=I,U=zn(c,I);d=qt(d),c-=I;for(var Y=ob(U,d);++P0||d<0)?new _r(P):(c<0?P=P.takeRight(-c):c&&(P=P.drop(c)),d!==r&&(d=ur(d),P=d<0?P.dropRight(-d):P.take(d-c)),P)},_r.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},_r.prototype.toArray=function(){return this.take(I)},ks(_r.prototype,function(c,d){var P=/^(?:filter|find|map|reject)|While$/.test(d),U=/^(?:head|last)$/.test(d),Y=re[U?"take"+(d=="last"?"Right":""):d],ae=U||/^find/.test(d);Y&&(re.prototype[d]=function(){var pe=this.__wrapped__,ve=U?[1]:arguments,xe=pe instanceof _r,We=ve[0],Ke=xe||or(pe),Xe=function(wr){var Sr=Y.apply(re,Jo([wr],ve));return U&&_t?Sr[0]:Sr};Ke&&P&&typeof We=="function"&&We.length!=1&&(xe=Ke=!1);var _t=this.__chain__,Nt=!!this.__actions__.length,Vt=ae&&!_t,fr=xe&&!Nt;if(!ae&&Ke){pe=fr?pe:new _r(this);var Gt=c.apply(pe,ve);return Gt.__actions__.push({func:j0,args:[Xe],thisArg:r}),new Yi(Gt,_t)}return Vt&&fr?c.apply(this,ve):(Gt=this.thru(Xe),Vt?U?Gt.value()[0]:Gt.value():Gt)})}),Vi(["pop","push","shift","sort","splice","unshift"],function(c){var d=l0[c],P=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",U=/^(?:pop|shift)$/.test(c);re.prototype[c]=function(){var Y=arguments;if(U&&!this.__chain__){var ae=this.value();return d.apply(or(ae)?ae:[],Y)}return this[P](function(pe){return d.apply(or(pe)?pe:[],Y)})}}),ks(_r.prototype,function(c,d){var P=re[d];if(P){var U=P.name+"";Rr.call(ou,U)||(ou[U]=[]),ou[U].push({name:d,func:P})}}),ou[D0(r,B).name]=[{name:"wrapper",func:r}],_r.prototype.clone=TX,_r.prototype.reverse=DX,_r.prototype.value=OX,re.prototype.at=cee,re.prototype.chain=uee,re.prototype.commit=fee,re.prototype.next=lee,re.prototype.plant=dee,re.prototype.reverse=pee,re.prototype.toJSON=re.prototype.valueOf=re.prototype.value=gee,re.prototype.first=re.prototype.head,ml&&(re.prototype[ml]=hee),re}),nu=fX();hn?((hn.exports=nu)._=nu,qr._=nu):Er._=nu}).call(Rj)})(Cf,Cf.exports)),Cf.exports}var Dj=Tj(),Rf={exports:{}},Oj=Rf.exports,l6;function Nj(){return l6||(l6=1,(function(t,e){var r=typeof self<"u"?self:Oj,n=(function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s})();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function f(l){return l&&DataView.prototype.isPrototypeOf(l)}if(a.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(l){return l&&u.indexOf(Object.prototype.toString.call(l))>-1};function g(l){if(typeof l!="string"&&(l=String(l)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(l))throw new TypeError("Invalid character in header field name");return l.toLowerCase()}function b(l){return typeof l!="string"&&(l=String(l)),l}function x(l){var p={next:function(){var m=l.shift();return{done:m===void 0,value:m}}};return a.iterable&&(p[Symbol.iterator]=function(){return p}),p}function S(l){this.map={},l instanceof S?l.forEach(function(p,m){this.append(m,p)},this):Array.isArray(l)?l.forEach(function(p){this.append(p[0],p[1])},this):l&&Object.getOwnPropertyNames(l).forEach(function(p){this.append(p,l[p])},this)}S.prototype.append=function(l,p){l=g(l),p=b(p);var m=this.map[l];this.map[l]=m?m+", "+p:p},S.prototype.delete=function(l){delete this.map[g(l)]},S.prototype.get=function(l){return l=g(l),this.has(l)?this.map[l]:null},S.prototype.has=function(l){return this.map.hasOwnProperty(g(l))},S.prototype.set=function(l,p){this.map[g(l)]=b(p)},S.prototype.forEach=function(l,p){for(var m in this.map)this.map.hasOwnProperty(m)&&l.call(p,this.map[m],m,this)},S.prototype.keys=function(){var l=[];return this.forEach(function(p,m){l.push(m)}),x(l)},S.prototype.values=function(){var l=[];return this.forEach(function(p){l.push(p)}),x(l)},S.prototype.entries=function(){var l=[];return this.forEach(function(p,m){l.push([m,p])}),x(l)},a.iterable&&(S.prototype[Symbol.iterator]=S.prototype.entries);function C(l){if(l.bodyUsed)return Promise.reject(new TypeError("Already read"));l.bodyUsed=!0}function D(l){return new Promise(function(p,m){l.onload=function(){p(l.result)},l.onerror=function(){m(l.error)}})}function B(l){var p=new FileReader,m=D(p);return p.readAsArrayBuffer(l),m}function L(l){var p=new FileReader,m=D(p);return p.readAsText(l),m}function H(l){for(var p=new Uint8Array(l),m=new Array(p.length),y=0;y-1?p:l}function W(l,p){p=p||{};var m=p.body;if(l instanceof W){if(l.bodyUsed)throw new TypeError("Already read");this.url=l.url,this.credentials=l.credentials,p.headers||(this.headers=new S(l.headers)),this.method=l.method,this.mode=l.mode,this.signal=l.signal,!m&&l._bodyInit!=null&&(m=l._bodyInit,l.bodyUsed=!0)}else this.url=String(l);if(this.credentials=p.credentials||this.credentials||"same-origin",(p.headers||!this.headers)&&(this.headers=new S(p.headers)),this.method=R(p.method||this.method||"GET"),this.mode=p.mode||this.mode||null,this.signal=p.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&m)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(m)}W.prototype.clone=function(){return new W(this,{body:this._bodyInit})};function V(l){var p=new FormData;return l.trim().split("&").forEach(function(m){if(m){var y=m.split("="),A=y.shift().replace(/\+/g," "),E=y.join("=").replace(/\+/g," ");p.append(decodeURIComponent(A),decodeURIComponent(E))}}),p}function X(l){var p=new S,m=l.replace(/\r?\n[\t ]+/g," ");return m.split(/\r?\n/).forEach(function(y){var A=y.split(":"),E=A.shift().trim();if(E){var w=A.join(":").trim();p.append(E,w)}}),p}k.call(W.prototype);function q(l,p){p||(p={}),this.type="default",this.status=p.status===void 0?200:p.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in p?p.statusText:"OK",this.headers=new S(p.headers),this.url=p.url||"",this._initBody(l)}k.call(q.prototype),q.prototype.clone=function(){return new q(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new S(this.headers),url:this.url})},q.error=function(){var l=new q(null,{status:0,statusText:""});return l.type="error",l};var _=[301,302,303,307,308];q.redirect=function(l,p){if(_.indexOf(p)===-1)throw new RangeError("Invalid status code");return new q(null,{status:p,headers:{location:l}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(p,m){this.message=p,this.name=m;var y=Error(p);this.stack=y.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function v(l,p){return new Promise(function(m,y){var A=new W(l,p);if(A.signal&&A.signal.aborted)return y(new o.DOMException("Aborted","AbortError"));var E=new XMLHttpRequest;function w(){E.abort()}E.onload=function(){var I={status:E.status,statusText:E.statusText,headers:X(E.getAllResponseHeaders()||"")};I.url="responseURL"in E?E.responseURL:I.headers.get("X-Request-URL");var M="response"in E?E.response:E.responseText;m(new q(M,I))},E.onerror=function(){y(new TypeError("Network request failed"))},E.ontimeout=function(){y(new TypeError("Network request failed"))},E.onabort=function(){y(new o.DOMException("Aborted","AbortError"))},E.open(A.method,A.url,!0),A.credentials==="include"?E.withCredentials=!0:A.credentials==="omit"&&(E.withCredentials=!1),"responseType"in E&&a.blob&&(E.responseType="blob"),A.headers.forEach(function(I,M){E.setRequestHeader(M,I)}),A.signal&&(A.signal.addEventListener("abort",w),E.onreadystatechange=function(){E.readyState===4&&A.signal.removeEventListener("abort",w)}),E.send(typeof A._bodyInit>"u"?null:A._bodyInit)})}return v.polyfill=!0,s.fetch||(s.fetch=v,s.Headers=S,s.Request=W,s.Response=q),o.Headers=S,o.Request=W,o.Response=q,o.fetch=v,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(Rf,Rf.exports)),Rf.exports}var Lj=Nj();const h6=Mi(Lj);var kj=Object.defineProperty,Bj=Object.defineProperties,Fj=Object.getOwnPropertyDescriptors,d6=Object.getOwnPropertySymbols,jj=Object.prototype.hasOwnProperty,Uj=Object.prototype.propertyIsEnumerable,p6=(t,e,r)=>e in t?kj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,g6=(t,e)=>{for(var r in e||(e={}))jj.call(e,r)&&p6(t,r,e[r]);if(d6)for(var r of d6(e))Uj.call(e,r)&&p6(t,r,e[r]);return t},m6=(t,e)=>Bj(t,Fj(e));const $j={Accept:"application/json","Content-Type":"application/json"},qj="POST",v6={headers:$j,method:qj},b6=10;let us=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new Di.EventEmitter,this.isAvailable=!1,this.registering=!1,!p_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=Hs(e),n=await(await h6(this.url,m6(g6({},v6),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!p_(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=Hs({id:1,jsonrpc:"2.0",method:"test",params:[]});await h6(e,m6(g6({},v6),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?ma(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Kh(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return u_(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>b6&&this.events.setMaxListeners(b6)}};const y6="error",zj="wss://relay.walletconnect.org",Hj="wc",Wj="universal_provider",w6=`${Hj}@2:${Wj}:`,x6="https://rpc.walletconnect.org/v1/",Mc="generic",Kj=`${x6}bundler`,$i={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Vj=Object.defineProperty,Gj=Object.defineProperties,Yj=Object.getOwnPropertyDescriptors,_6=Object.getOwnPropertySymbols,Jj=Object.prototype.hasOwnProperty,Xj=Object.prototype.propertyIsEnumerable,E6=(t,e,r)=>e in t?Vj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Xh=(t,e)=>{for(var r in e||(e={}))Jj.call(e,r)&&E6(t,r,e[r]);if(_6)for(var r of _6(e))Xj.call(e,r)&&E6(t,r,e[r]);return t},Zj=(t,e)=>Gj(t,Yj(e));function yi(t,e,r){var n;const i=Ec(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${x6}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function Da(t){return t.includes(":")?t.split(":")[1]:t}function S6(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Qj(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function Om(t={},e={}){const r=A6(t),n=A6(e);return Dj.merge(r,n)}function A6(t){var e,r,n,i;const s={};if(!yf(t))return s;for(const[o,a]of Object.entries(t)){const f=mm(o)?[o]:a.chains,u=a.methods||[],h=a.events||[],g=a.rpcMap||{},b=bf(o);s[b]=Zj(Xh(Xh({},s[b]),a),{chains:jh(f,(e=s[b])==null?void 0:e.chains),methods:jh(u,(r=s[b])==null?void 0:r.methods),events:jh(h,(n=s[b])==null?void 0:n.events),rpcMap:Xh(Xh({},g),(i=s[b])==null?void 0:i.rpcMap)})}return s}function eU(t){return t.includes(":")?t.split(":")[2]:t}function P6(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=mm(r)?[r]:n.chains?n.chains:S6(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function Nm(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const I6={},Pr=t=>I6[t],Lm=(t,e)=>{I6[t]=e};class tU{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit($i.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Da(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||yi(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Fi(new us(n,Pr("disableProviderPing")))}}var rU=Object.defineProperty,nU=Object.defineProperties,iU=Object.getOwnPropertyDescriptors,M6=Object.getOwnPropertySymbols,sU=Object.prototype.hasOwnProperty,oU=Object.prototype.propertyIsEnumerable,C6=(t,e,r)=>e in t?rU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,R6=(t,e)=>{for(var r in e||(e={}))sU.call(e,r)&&C6(t,r,e[r]);if(M6)for(var r of M6(e))oU.call(e,r)&&C6(t,r,e[r]);return t},T6=(t,e)=>nU(t,iU(e));class aU{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit($i.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||yi(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Fi(new us(n,Pr("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(Da(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o?.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a?.[s];const f=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:T6(R6({},o.sessionProperties||{}),{capabilities:T6(R6({},a||{}),{[s]:f})})})}catch(u){console.warn("Failed to update session with capabilities",u)}return f}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(f){console.warn("Failed to fetch call status from bundler",f,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(No("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${Kj}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class cU{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit($i.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Da(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||yi(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Fi(new us(n,Pr("disableProviderPing")))}}let uU=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit($i.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Da(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||yi(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Fi(new us(n,Pr("disableProviderPing")))}},fU=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||yi(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit($i.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||yi(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Fi(new us(n,Pr("disableProviderPing")))}},lU=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit($i.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=Da(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Fi(new us(n,Pr("disableProviderPing")))}},hU=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit($i.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Da(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||yi(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Fi(new us(n,Pr("disableProviderPing")))}};class dU{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit($i.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Da(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||yi(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Fi(new us(n,Pr("disableProviderPing")))}}let pU=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||yi(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit($i.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||yi(e,this.namespace);return typeof n>"u"?void 0:new Fi(new us(n,Pr("disableProviderPing")))}};class gU{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||yi(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit($i.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||yi(e,this.namespace);return typeof n>"u"?void 0:new Fi(new us(n))}}class mU{constructor(e){this.name=Mc,this.namespace=e.namespace,this.events=Pr("events"),this.client=Pr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit($i.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=Ec(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||yi(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Fi(new us(n,Pr("disableProviderPing")))}}var vU=Object.defineProperty,bU=Object.defineProperties,yU=Object.getOwnPropertyDescriptors,D6=Object.getOwnPropertySymbols,wU=Object.prototype.hasOwnProperty,xU=Object.prototype.propertyIsEnumerable,O6=(t,e,r)=>e in t?vU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Zh=(t,e)=>{for(var r in e||(e={}))wU.call(e,r)&&O6(t,r,e[r]);if(D6)for(var r of D6(e))xU.call(e,r)&&O6(t,r,e[r]);return t},km=(t,e)=>bU(t,yU(e));let Bm=class PA{constructor(e){this.events=new qp,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Gu(hh({level:e?.logger||y6})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const r=new PA(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:Zh({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,Wh(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Dr("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=P6(this.session.namespaces);this.namespaces=Om(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=P6(s.namespaces);this.namespaces=Om(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==a6)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Mc?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(Pa(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await Dm.init({core:this.providerOpts.core,logger:this.providerOpts.logger||y6,relayUrl:this.providerOpts.relayUrl||zj,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>bf(r)))];Lm("client",this.client),Lm("events",this.events),Lm("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Qj(r,this.session),i=S6(n),s=Om(this.namespaces,this.optionalNamespaces),o=km(Zh({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new aU({namespace:o});break;case"algorand":this.rpcProviders[r]=new fU({namespace:o});break;case"solana":this.rpcProviders[r]=new cU({namespace:o});break;case"cosmos":this.rpcProviders[r]=new uU({namespace:o});break;case"polkadot":this.rpcProviders[r]=new tU({namespace:o});break;case"cip34":this.rpcProviders[r]=new lU({namespace:o});break;case"elrond":this.rpcProviders[r]=new hU({namespace:o});break;case"multiversx":this.rpcProviders[r]=new dU({namespace:o});break;case"near":this.rpcProviders[r]=new pU({namespace:o});break;case"tezos":this.rpcProviders[r]=new gU({namespace:o});break;default:this.rpcProviders[Mc]?this.rpcProviders[Mc].updateNamespace(o):this.rpcProviders[Mc]=new mU({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&Pa(i)&&this.events.emit("accountsChanged",i.map(eU))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=bf(i),a=Nm(i)!==Nm(s)?`${o}:${Nm(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=km(Zh({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",km(Zh({},Dr("USER_DISCONNECTED")),{data:e.topic}))}),this.on($i.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Mc]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>bf(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=bf(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${w6}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${w6}/${e}`)}};const _U=Bm;function EU(){return new Promise(t=>{const e=[];let r;window.addEventListener("eip6963:announceProvider",n=>{const{detail:i}=n;r&&clearTimeout(r),e.push(i),r=setTimeout(()=>t(e),200)}),r=setTimeout(()=>t(e),200),window.dispatchEvent(new Event("eip6963:requestProvider"))})}class Cs{constructor(e,r){this.scope=e,this.module=r}storeObject(e,r){this.setItem(e,JSON.stringify(r))}loadObject(e){const r=this.getItem(e);return r?JSON.parse(r):void 0}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new Cs("CBWSDK").clear(),new Cs("walletlink").clear()}}const sn={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},Fm={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},N6="Unspecified error message.",SU="Unspecified server error.";function jm(t,e=N6){if(t&&Number.isInteger(t)){const r=t.toString();if(Um(Fm,r))return Fm[r].message;if(L6(t))return SU}return e}function AU(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(Fm[e]||L6(t))}function PU(t,{shouldIncludeStack:e=!1}={}){const r={};if(t&&typeof t=="object"&&!Array.isArray(t)&&Um(t,"code")&&AU(t.code)){const n=t;r.code=n.code,n.message&&typeof n.message=="string"?(r.message=n.message,Um(n,"data")&&(r.data=n.data)):(r.message=jm(r.code),r.data={originalError:k6(t)})}else r.code=sn.rpc.internal,r.message=B6(t,"message")?t.message:N6,r.data={originalError:k6(t)};return e&&(r.stack=B6(t,"stack")?t.stack:void 0),r}function L6(t){return t>=-32099&&t<=-32e3}function k6(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function Um(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function B6(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const Ar={rpc:{parse:t=>qi(sn.rpc.parse,t),invalidRequest:t=>qi(sn.rpc.invalidRequest,t),invalidParams:t=>qi(sn.rpc.invalidParams,t),methodNotFound:t=>qi(sn.rpc.methodNotFound,t),internal:t=>qi(sn.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return qi(e,t)},invalidInput:t=>qi(sn.rpc.invalidInput,t),resourceNotFound:t=>qi(sn.rpc.resourceNotFound,t),resourceUnavailable:t=>qi(sn.rpc.resourceUnavailable,t),transactionRejected:t=>qi(sn.rpc.transactionRejected,t),methodNotSupported:t=>qi(sn.rpc.methodNotSupported,t),limitExceeded:t=>qi(sn.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Cc(sn.provider.userRejectedRequest,t),unauthorized:t=>Cc(sn.provider.unauthorized,t),unsupportedMethod:t=>Cc(sn.provider.unsupportedMethod,t),disconnected:t=>Cc(sn.provider.disconnected,t),chainDisconnected:t=>Cc(sn.provider.chainDisconnected,t),unsupportedChain:t=>Cc(sn.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new U6(e,r,n)}}};function qi(t,e){const[r,n]=F6(e);return new j6(t,r||jm(t),n)}function Cc(t,e){const[r,n]=F6(e);return new U6(t,r||jm(t),n)}function F6(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}class j6 extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}}class U6 extends j6{constructor(e,r,n){if(!IU(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}function IU(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function $m(){return t=>t}const Tf=$m(),MU=$m(),CU=$m();function Zs(t){return Math.floor(t)}const $6=/^[0-9]*$/,q6=/^[a-f0-9]*$/;function Oa(t){return qm(crypto.getRandomValues(new Uint8Array(t)))}function qm(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function Qh(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function Df(t,e=!1){const r=t.toString("hex");return Tf(e?`0x${r}`:r)}function zm(t){return Df(Km(t),!0)}function Rs(t){return CU(t.toString(10))}function Lo(t){return Tf(`0x${BigInt(t).toString(16)}`)}function z6(t){return t.startsWith("0x")||t.startsWith("0X")}function Hm(t){return z6(t)?t.slice(2):t}function H6(t){return z6(t)?`0x${t.slice(2)}`:`0x${t}`}function ed(t){if(typeof t!="string")return!1;const e=Hm(t).toLowerCase();return q6.test(e)}function RU(t,e=!1){if(typeof t=="string"){const r=Hm(t).toLowerCase();if(q6.test(r))return Tf(e?`0x${r}`:r)}throw Ar.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function Wm(t,e=!1){let r=RU(t,!1);return r.length%2===1&&(r=Tf(`0${r}`)),e?Tf(`0x${r}`):r}function ko(t){if(typeof t=="string"){const e=Hm(t).toLowerCase();if(ed(e)&&e.length===40)return MU(H6(e))}throw Ar.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function Km(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(ed(t)){const e=Wm(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Ar.rpc.invalidParams(`Not binary data: ${String(t)}`)}function Of(t){if(typeof t=="number"&&Number.isInteger(t))return Zs(t);if(typeof t=="string"){if($6.test(t))return Zs(Number(t));if(ed(t))return Zs(Number(BigInt(Wm(t,!0))))}throw Ar.rpc.invalidParams(`Not an integer: ${String(t)}`)}function Nf(t){if(t!==null&&(typeof t=="bigint"||DU(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(Of(t));if(typeof t=="string"){if($6.test(t))return BigInt(t);if(ed(t))return BigInt(Wm(t,!0))}throw Ar.rpc.invalidParams(`Not an integer: ${String(t)}`)}function TU(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Ar.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function DU(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function OU(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function NU(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function LU(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,new TextEncoder().encode(e));return{iv:r,cipherText:n}}async function kU(t,{iv:e,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return new TextDecoder().decode(n)}function W6(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function K6(t,e){const r=W6(t),n=await crypto.subtle.exportKey(r,e);return qm(new Uint8Array(n))}async function V6(t,e){const r=W6(t),n=Qh(e).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function BU(t,e){const r=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return LU(e,r)}async function FU(t,e){return JSON.parse(await kU(e,t))}const Vm={storageKey:"ownPrivateKey",keyType:"private"},Gm={storageKey:"ownPublicKey",keyType:"public"},Ym={storageKey:"peerPublicKey",keyType:"public"};class jU{constructor(){this.storage=new Cs("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(Ym,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(Gm.storageKey),this.storage.removeItem(Vm.storageKey),this.storage.removeItem(Ym.storageKey)}async generateKeyPair(){const e=await OU();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(Vm,e.privateKey),await this.storeKey(Gm,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(Vm)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(Gm)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(Ym)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await NU(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const r=this.storage.getItem(e.storageKey);return r?V6(e.keyType,r):null}async storeKey(e,r){const n=await K6(e.keyType,r);this.storage.setItem(e.storageKey,n)}}const Lf="4.2.4",G6="@coinbase/wallet-sdk";async function Y6(t,e){const r=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":Lf,"X-Cbw-Sdk-Platform":G6}}),{result:i,error:s}=await n.json();if(s)throw s;return i}function UU(){return globalThis.coinbaseWalletExtension}function $U(){var t,e;try{const r=globalThis;return(t=r.ethereum)!==null&&t!==void 0?t:(e=r.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function qU({metadata:t,preference:e}){var r,n;const{appName:i,appLogoUrl:s,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const f=UU();if(f)return(r=f.setAppInfo)===null||r===void 0||r.call(f,i,s,o,e),f}const a=$U();if(a?.isCoinbaseBrowser)return(n=a.setAppInfo)===null||n===void 0||n.call(a,i,s,o,e),a}function zU(t){if(!t||typeof t!="object"||Array.isArray(t))throw Ar.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:r}=t;if(typeof e!="string"||e.length===0)throw Ar.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Ar.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw Ar.provider.unsupportedMethod()}}const J6="accounts",X6="activeChain",Z6="availableChains",Q6="walletCapabilities";class HU{constructor(e){var r,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new jU,this.storage=new Cs("CBWSDK","SCWStateManager"),this.accounts=(r=this.storage.loadObject(J6))!==null&&r!==void 0?r:[],this.chain=this.storage.loadObject(X6)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var r,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(r=e.params)!==null&&r!==void 0?r:{})}}),s=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in s.content)throw s.content.failure;const o=await V6("public",s.sender);await this.keyManager.setPeerPublicKey(o);const f=(await this.decryptResponseMessage(s)).result;if("error"in f)throw f.error;const u=f.value;this.accounts=u,this.storage.storeObject(J6,u),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",u)}async request(e){var r;if(this.accounts.length===0)throw Ar.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:Lo(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return Lo(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(Q6);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw Ar.rpc.internal("No RPC URL set for chain");return Y6(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var r,n;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const i=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(i)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,r;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(r=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&r!==void 0?r:1}}async handleSwitchChainRequest(e){var r;const n=e.params;if(!n||!(!((r=n[0])===null||r===void 0)&&r.chainId))throw Ar.rpc.invalidParams();const i=Of(n[0].chainId);if(this.updateChain(i))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(i),o}async sendEncryptedRequest(e){const r=await this.keyManager.getSharedSecret();if(!r)throw Ar.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await BU({action:e,chainId:this.chain.id},r),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const r=await K6("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:r,content:e,timestamp:new Date}}async decryptResponseMessage(e){var r,n;const i=e.content;if("failure"in i)throw i.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw Ar.provider.unauthorized("Invalid session");const o=await FU(i.encrypted,s),a=(r=o.data)===null||r===void 0?void 0:r.chains;if(a){const u=Object.entries(a).map(([h,g])=>({id:Number(h),rpcUrl:g}));this.storage.storeObject(Z6,u),this.updateChain(this.chain.id,u)}const f=(n=o.data)===null||n===void 0?void 0:n.capabilities;return f&&this.storage.storeObject(Q6,f),o}updateChain(e,r){var n;const i=r??this.storage.loadObject(Z6),s=i?.find(o=>o.id===e);return s?(s!==this.chain&&(this.chain=s,this.storage.storeObject(X6,s),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",Lo(s.id))),!0):!1}}var Wr={},er={},e5;function WU(){if(e5)return er;e5=1,Object.defineProperty(er,"__esModule",{value:!0}),er.toBig=er.shrSL=er.shrSH=er.rotrSL=er.rotrSH=er.rotrBL=er.rotrBH=er.rotr32L=er.rotr32H=er.rotlSL=er.rotlSH=er.rotlBL=er.rotlBH=er.add5L=er.add5H=er.add4L=er.add4H=er.add3L=er.add3H=void 0,er.add=B,er.fromBig=r,er.split=n;const t=BigInt(2**32-1),e=BigInt(32);function r(V,X=!1){return X?{h:Number(V&t),l:Number(V>>e&t)}:{h:Number(V>>e&t)|0,l:Number(V&t)|0}}function n(V,X=!1){const q=V.length;let _=new Uint32Array(q),v=new Uint32Array(q);for(let l=0;lBigInt(V>>>0)<>>0);er.toBig=i;const s=(V,X,q)=>V>>>q;er.shrSH=s;const o=(V,X,q)=>V<<32-q|X>>>q;er.shrSL=o;const a=(V,X,q)=>V>>>q|X<<32-q;er.rotrSH=a;const f=(V,X,q)=>V<<32-q|X>>>q;er.rotrSL=f;const u=(V,X,q)=>V<<64-q|X>>>q-32;er.rotrBH=u;const h=(V,X,q)=>V>>>q-32|X<<64-q;er.rotrBL=h;const g=(V,X)=>X;er.rotr32H=g;const b=(V,X)=>V;er.rotr32L=b;const x=(V,X,q)=>V<>>32-q;er.rotlSH=x;const S=(V,X,q)=>X<>>32-q;er.rotlSL=S;const C=(V,X,q)=>X<>>64-q;er.rotlBH=C;const D=(V,X,q)=>V<>>64-q;er.rotlBL=D;function B(V,X,q,_){const v=(X>>>0)+(_>>>0);return{h:V+q+(v/2**32|0)|0,l:v|0}}const L=(V,X,q)=>(V>>>0)+(X>>>0)+(q>>>0);er.add3L=L;const H=(V,X,q,_)=>X+q+_+(V/2**32|0)|0;er.add3H=H;const F=(V,X,q,_)=>(V>>>0)+(X>>>0)+(q>>>0)+(_>>>0);er.add4L=F;const k=(V,X,q,_,v)=>X+q+_+v+(V/2**32|0)|0;er.add4H=k;const $=(V,X,q,_,v)=>(V>>>0)+(X>>>0)+(q>>>0)+(_>>>0)+(v>>>0);er.add5L=$;const R=(V,X,q,_,v,l)=>X+q+_+v+l+(V/2**32|0)|0;er.add5H=R;const W={fromBig:r,split:n,toBig:i,shrSH:s,shrSL:o,rotrSH:a,rotrSL:f,rotrBH:u,rotrBL:h,rotr32H:g,rotr32L:b,rotlSH:x,rotlSL:S,rotlBH:C,rotlBL:D,add:B,add3L:L,add3H:H,add4L:F,add4H:k,add5H:R,add5L:$};return er.default=W,er}var Jm={},kf={},t5;function KU(){return t5||(t5=1,Object.defineProperty(kf,"__esModule",{value:!0}),kf.crypto=void 0,kf.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),kf}var r5;function VU(){return r5||(r5=1,(function(t){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(t,"__esModule",{value:!0}),t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.Hash=t.nextTick=t.swap32IfBE=t.byteSwapIfBE=t.swap8IfBE=t.isLE=void 0,t.isBytes=r,t.anumber=n,t.abytes=i,t.ahash=s,t.aexists=o,t.aoutput=a,t.u8=f,t.u32=u,t.clean=h,t.createView=g,t.rotr=b,t.rotl=x,t.byteSwap=S,t.byteSwap32=C,t.bytesToHex=L,t.hexToBytes=k,t.asyncLoop=R,t.utf8ToBytes=W,t.bytesToUtf8=V,t.toBytes=X,t.kdfInputToBytes=q,t.concatBytes=_,t.checkOpts=v,t.createHasher=p,t.createOptHasher=m,t.createXOFer=y,t.randomBytes=A;const e=KU();function r(E){return E instanceof Uint8Array||ArrayBuffer.isView(E)&&E.constructor.name==="Uint8Array"}function n(E){if(!Number.isSafeInteger(E)||E<0)throw new Error("positive integer expected, got "+E)}function i(E,...w){if(!r(E))throw new Error("Uint8Array expected");if(w.length>0&&!w.includes(E.length))throw new Error("Uint8Array expected of length "+w+", got length="+E.length)}function s(E){if(typeof E!="function"||typeof E.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");n(E.outputLen),n(E.blockLen)}function o(E,w=!0){if(E.destroyed)throw new Error("Hash instance has been destroyed");if(w&&E.finished)throw new Error("Hash#digest() has already been called")}function a(E,w){i(E);const I=w.outputLen;if(E.length>>w}function x(E,w){return E<>>32-w>>>0}t.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function S(E){return E<<24&4278190080|E<<8&16711680|E>>>8&65280|E>>>24&255}t.swap8IfBE=t.isLE?E=>E:E=>S(E),t.byteSwapIfBE=t.swap8IfBE;function C(E){for(let w=0;wE:C;const D=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",B=Array.from({length:256},(E,w)=>w.toString(16).padStart(2,"0"));function L(E){if(i(E),D)return E.toHex();let w="";for(let I=0;I=H._0&&E<=H._9)return E-H._0;if(E>=H.A&&E<=H.F)return E-(H.A-10);if(E>=H.a&&E<=H.f)return E-(H.a-10)}function k(E){if(typeof E!="string")throw new Error("hex string expected, got "+typeof E);if(D)return Uint8Array.fromHex(E);const w=E.length,I=w/2;if(w%2)throw new Error("hex string expected, got unpadded hex of length "+w);const M=new Uint8Array(I);for(let z=0,se=0;z{};t.nextTick=$;async function R(E,w,I){let M=Date.now();for(let z=0;z=0&&seE().update(X(M)).digest(),I=E();return w.outputLen=I.outputLen,w.blockLen=I.blockLen,w.create=()=>E(),w}function m(E){const w=(M,z)=>E(z).update(X(M)).digest(),I=E({});return w.outputLen=I.outputLen,w.blockLen=I.blockLen,w.create=M=>E(M),w}function y(E){const w=(M,z)=>E(z).update(X(M)).digest(),I=E({});return w.outputLen=I.outputLen,w.blockLen=I.blockLen,w.create=M=>E(M),w}t.wrapConstructor=p,t.wrapConstructorWithOpts=m,t.wrapXOFConstructorWithOpts=y;function A(E=32){if(e.crypto&&typeof e.crypto.getRandomValues=="function")return e.crypto.getRandomValues(new Uint8Array(E));if(e.crypto&&typeof e.crypto.randomBytes=="function")return Uint8Array.from(e.crypto.randomBytes(E));throw new Error("crypto.getRandomValues must be defined")}})(Jm)),Jm}var n5;function GU(){if(n5)return Wr;n5=1,Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.shake256=Wr.shake128=Wr.keccak_512=Wr.keccak_384=Wr.keccak_256=Wr.keccak_224=Wr.sha3_512=Wr.sha3_384=Wr.sha3_256=Wr.sha3_224=Wr.Keccak=void 0,Wr.keccakP=D;const t=WU(),e=VU(),r=BigInt(0),n=BigInt(1),i=BigInt(2),s=BigInt(7),o=BigInt(256),a=BigInt(113),f=[],u=[],h=[];for(let F=0,k=n,$=1,R=0;F<24;F++){[$,R]=[R,(2*$+3*R)%5],f.push(2*(5*R+$)),u.push((F+1)*(F+2)/2%64);let W=r;for(let V=0;V<7;V++)k=(k<>s)*a)%o,k&i&&(W^=n<<(n<$>32?(0,t.rotlBH)(F,k,$):(0,t.rotlSH)(F,k,$),C=(F,k,$)=>$>32?(0,t.rotlBL)(F,k,$):(0,t.rotlSL)(F,k,$);function D(F,k=24){const $=new Uint32Array(10);for(let R=24-k;R<24;R++){for(let X=0;X<10;X++)$[X]=F[X]^F[X+10]^F[X+20]^F[X+30]^F[X+40];for(let X=0;X<10;X+=2){const q=(X+8)%10,_=(X+2)%10,v=$[_],l=$[_+1],p=S(v,l,1)^$[q],m=C(v,l,1)^$[q+1];for(let y=0;y<50;y+=10)F[X+y]^=p,F[X+y+1]^=m}let W=F[2],V=F[3];for(let X=0;X<24;X++){const q=u[X],_=S(W,V,q),v=C(W,V,q),l=f[X];W=F[l],V=F[l+1],F[l]=_,F[l+1]=v}for(let X=0;X<50;X+=10){for(let q=0;q<10;q++)$[q]=F[X+q];for(let q=0;q<10;q++)F[X+q]^=~$[(q+2)%10]&$[(q+4)%10]}F[0]^=b[R],F[1]^=x[R]}(0,e.clean)($)}class B extends e.Hash{constructor(k,$,R,W=!1,V=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=k,this.suffix=$,this.outputLen=R,this.enableXOF=W,this.rounds=V,(0,e.anumber)(R),!(0=R&&this.keccak();const X=Math.min(R-this.posOut,V-W);k.set($.subarray(this.posOut,this.posOut+X),W),this.posOut+=X,W+=X}return k}xofInto(k){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(k)}xof(k){return(0,e.anumber)(k),this.xofInto(new Uint8Array(k))}digestInto(k){if((0,e.aoutput)(k,this),this.finished)throw new Error("digest() was already called");return this.writeInto(k),this.destroy(),k}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,(0,e.clean)(this.state)}_cloneInto(k){const{blockLen:$,suffix:R,outputLen:W,rounds:V,enableXOF:X}=this;return k||(k=new B($,R,W,X,V)),k.state32.set(this.state32),k.pos=this.pos,k.posOut=this.posOut,k.finished=this.finished,k.rounds=V,k.suffix=R,k.outputLen=W,k.enableXOF=X,k.destroyed=this.destroyed,k}}Wr.Keccak=B;const L=(F,k,$)=>(0,e.createHasher)(()=>new B(k,F,$));Wr.sha3_224=L(6,144,224/8),Wr.sha3_256=L(6,136,256/8),Wr.sha3_384=L(6,104,384/8),Wr.sha3_512=L(6,72,512/8),Wr.keccak_224=L(1,144,224/8),Wr.keccak_256=L(1,136,256/8),Wr.keccak_384=L(1,104,384/8),Wr.keccak_512=L(1,72,512/8);const H=(F,k,$)=>(0,e.createXOFer)((R={})=>new B(k,F,R.dkLen===void 0?$:R.dkLen,!0));return Wr.shake128=H(31,168,128/8),Wr.shake256=H(31,136,256/8),Wr}var Xm,i5;function s5(){if(i5)return Xm;i5=1;const{keccak_256:t}=GU();function e(x){return Buffer.allocUnsafe(x).fill(0)}function r(x){return x.toString(2).length}function n(x,S){let C=x.toString(16);C.length%2!==0&&(C="0"+C);const D=C.match(/.{1,2}/g).map(B=>parseInt(B,16));for(;D.length"u")throw new Error("Not an array?");if(S=i(b),S!=="dynamic"&&S!==0&&x.length>S)throw new Error("Elements exceed array size: "+S);D=[],b=b.slice(0,b.lastIndexOf("[")),typeof x=="string"&&(x=JSON.parse(x));for(B in x)D.push(o(b,x[B]));if(S==="dynamic"){var L=o("uint256",x.length);D.unshift(L)}return Buffer.concat(D)}else{if(b==="bytes")return x=new Buffer(x),D=Buffer.concat([o("uint256",x.length),x]),x.length%32!==0&&(D=Buffer.concat([D,t.zeros(32-x.length%32)])),D;if(b.startsWith("bytes")){if(S=r(b),S<1||S>32)throw new Error("Invalid bytes width: "+S);return t.setLengthRight(x,32)}else if(b.startsWith("uint")){if(S=r(b),S%8||S<8||S>256)throw new Error("Invalid uint width: "+S);C=s(x);const H=t.bitLengthFromBigInt(C);if(H>S)throw new Error("Supplied uint exceeds width: "+S+" vs "+H);if(C<0)throw new Error("Supplied uint is negative");return t.bufferBEFromBigInt(C,32)}else if(b.startsWith("int")){if(S=r(b),S%8||S<8||S>256)throw new Error("Invalid int width: "+S);C=s(x);const H=t.bitLengthFromBigInt(C);if(H>S)throw new Error("Supplied int exceeds width: "+S+" vs "+H);const F=t.twosFromBigInt(C,256);return t.bufferBEFromBigInt(F,32)}else if(b.startsWith("ufixed")){if(S=n(b),C=s(x),C<0)throw new Error("Supplied ufixed is negative");return o("uint256",C*BigInt(2)**BigInt(S[1]))}else if(b.startsWith("fixed"))return S=n(b),o("int256",s(x)*BigInt(2)**BigInt(S[1]))}throw new Error("Unsupported or invalid type: "+b)}function a(b){return b==="string"||b==="bytes"||i(b)==="dynamic"}function f(b){return b.lastIndexOf("]")===b.length-1}function u(b,x){var S=[],C=[],D=32*b.length;for(var B in b){var L=e(b[B]),H=x[B],F=o(L,H);a(L)?(S.push(o("uint256",D)),C.push(F),D+=F.length):S.push(F)}return Buffer.concat(S.concat(C))}function h(b,x){if(b.length!==x.length)throw new Error("Number of types are not matching the values");for(var S,C,D=[],B=0;B32)throw new Error("Invalid bytes width: "+S);D.push(t.setLengthRight(H,S))}else if(L.startsWith("uint")){if(S=r(L),S%8||S<8||S>256)throw new Error("Invalid uint width: "+S);C=s(H);const F=t.bitLengthFromBigInt(C);if(F>S)throw new Error("Supplied uint exceeds width: "+S+" vs "+F);D.push(t.bufferBEFromBigInt(C,S/8))}else if(L.startsWith("int")){if(S=r(L),S%8||S<8||S>256)throw new Error("Invalid int width: "+S);C=s(H);const F=t.bitLengthFromBigInt(C);if(F>S)throw new Error("Supplied int exceeds width: "+S+" vs "+F);const k=t.twosFromBigInt(C,S);D.push(t.bufferBEFromBigInt(k,S/8))}else throw new Error("Unsupported or invalid type: "+L)}return Buffer.concat(D)}function g(b,x){return t.keccak(h(b,x))}return Zm={rawEncode:u,solidityPack:h,soliditySHA3:g},Zm}var Qm,a5;function JU(){if(a5)return Qm;a5=1;const t=s5(),e=YU(),r={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},n={encodeData(s,o,a,f=!0){const u=["bytes32"],h=[this.hashType(s,a)];if(f){const g=(b,x,S)=>{if(a[x]!==void 0)return["bytes32",S==null?"0x0000000000000000000000000000000000000000000000000000000000000000":t.keccak(this.encodeData(x,S,a,f))];if(S===void 0)throw new Error(`missing value for field ${b} of type ${x}`);if(x==="bytes")return["bytes32",t.keccak(S)];if(x==="string")return typeof S=="string"&&(S=Buffer.from(S,"utf8")),["bytes32",t.keccak(S)];if(x.lastIndexOf("]")===x.length-1){const C=x.slice(0,x.lastIndexOf("[")),D=S.map(B=>g(b,C,B));return["bytes32",t.keccak(e.rawEncode(D.map(([B])=>B),D.map(([,B])=>B)))]}return[x,S]};for(const b of a[s]){const[x,S]=g(b.name,b.type,o[b.name]);u.push(x),h.push(S)}}else for(const g of a[s]){let b=o[g.name];if(b!==void 0)if(g.type==="bytes")u.push("bytes32"),b=t.keccak(b),h.push(b);else if(g.type==="string")u.push("bytes32"),typeof b=="string"&&(b=Buffer.from(b,"utf8")),b=t.keccak(b),h.push(b);else if(a[g.type]!==void 0)u.push("bytes32"),b=t.keccak(this.encodeData(g.type,b,a,f)),h.push(b);else{if(g.type.lastIndexOf("]")===g.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");u.push(g.type),h.push(b)}}return e.rawEncode(u,h)},encodeType(s,o){let a="",f=this.findTypeDependencies(s,o).filter(u=>u!==s);f=[s].concat(f.sort());for(const u of f){if(!o[u])throw new Error("No type definition specified: "+u);a+=u+"("+o[u].map(({name:g,type:b})=>b+" "+g).join(",")+")"}return a},findTypeDependencies(s,o,a=[]){if(s=s.match(/^\w*/)[0],a.includes(s)||o[s]===void 0)return a;a.push(s);for(const f of o[s])for(const u of this.findTypeDependencies(f.type,o,a))!a.includes(u)&&a.push(u);return a},hashStruct(s,o,a,f=!0){return t.keccak(this.encodeData(s,o,a,f))},hashType(s,o){return t.keccak(this.encodeType(s,o))},sanitizeData(s){const o={};for(const a in r.properties)s[a]&&(o[a]=s[a]);return o.types&&(o.types=Object.assign({EIP712Domain:[]},o.types)),o},hash(s,o=!0){const a=this.sanitizeData(s),f=[Buffer.from("1901","hex")];return f.push(this.hashStruct("EIP712Domain",a.domain,a.types,o)),a.primaryType!=="EIP712Domain"&&f.push(this.hashStruct(a.primaryType,a.message,a.types,o)),t.keccak(Buffer.concat(f))}};Qm={TYPED_MESSAGE_SCHEMA:r,TypedDataUtils:n,hashForSignTypedDataLegacy:function(s){return i(s.data)},hashForSignTypedData_v3:function(s){return n.hash(s.data,!1)},hashForSignTypedData_v4:function(s){return n.hash(s.data)}};function i(s){const o=new Error("Expect argument to be non-empty array");if(typeof s!="object"||!s.length)throw o;const a=s.map(function(h){return h.type==="bytes"?t.toBuffer(h.value):h.value}),f=s.map(function(h){return h.type}),u=s.map(function(h){if(!h.name)throw o;return h.type+" "+h.name});return e.soliditySHA3(["bytes32","bytes32"],[e.soliditySHA3(new Array(s.length).fill("string"),u),e.soliditySHA3(f,a)])}return Qm}var XU=JU();const td=Mi(XU),ZU="walletUsername",ev="Addresses",QU="AppVersion";function Nn(t){return t.errorMessage!==void 0}class e${constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",Qh(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),a=16,f=o.slice(o.byteLength-a),u=o.slice(0,o.byteLength-a),h=new Uint8Array(f),g=new Uint8Array(u),b=new Uint8Array([...n,...h,...g]);return qm(b)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",Qh(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=Qh(e),a=o.slice(0,12),f=o.slice(12,28),u=o.slice(28),h=new Uint8Array([...u,...f]),g={name:"AES-GCM",iv:new Uint8Array(a)};try{const b=await window.crypto.subtle.decrypt(g,s,h),x=new TextDecoder;n(x.decode(b))}catch(b){i(b)}})()})}}class t${constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n?.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}var Qs;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(Qs||(Qs={}));class r${setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,Qs.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,Qs.DISCONNECTED)},i.onopen=s=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,Qs.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(f=>this.sendData(f)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const f=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,f)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,Qs.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const c5=1e4,n$=6e4;class i${constructor({session:e,linkAPIUrl:r,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Zs(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,f)=>{const u=s[f];u!==void 0&&a(u)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(s,o)=>{var a;const f=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,f)},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(ZU,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(QU,s)},this.handleChainUpdated=async(s,o)=>{var a;const f=await this.cipher.decrypt(s),u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(f,u)},this.session=e,this.cipher=new e$(e.secret),this.listener=n;const i=new r$(`${r}/rpc`,WebSocket);i.setConnectionStateListener(async s=>{let o=!1;switch(s){case Qs.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(f=>setTimeout(f,5e3)),this.destroyed||i.connect().catch(()=>{a()})};a()}break;case Qs.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},c5),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case Qs.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(s=>{var o;switch(s.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=s.type==="IsLinkedOK"?s.linked:void 0;this.linked=a||s.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(s.metadata);break}case"Event":{this.handleIncomingEvent(s);break}}s.id!==void 0&&((o=this.requestResolutions.get(s.id))===null||o===void 0||o(s))}),this.ws=i,this.http=new t$(r,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Zs(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:s,response:o}=i;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s,o)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Zs(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>c5*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r={timeout:n$}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r.timeout)}),new Promise(s=>{this.requestResolutions.set(n,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Zs(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Zs(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Zs(this.nextReqId++),sessionId:this.session.id}),!0)}}class s${constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=H6(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}const u5="session:id",f5="session:secret",l5="session:linked";class Rc{constructor(e,r,n,i=!1){this.storage=e,this.id=r,this.secret=n,this.key=cc(uw(`${r}, ${n} WalletLink`)),this._linked=!!i}static create(e){const r=Oa(16),n=Oa(32);return new Rc(e,r,n).save()}static load(e){const r=e.getItem(u5),n=e.getItem(l5),i=e.getItem(f5);return r&&i?new Rc(e,r,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(u5,this.id),this.storage.setItem(f5,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(l5,this._linked?"1":"0")}}function o$(){try{return window.frameElement!==null}catch{return!1}}function a$(){try{return o$()&&window.top?window.top.location:window.location}catch{return window.location}}function c$(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window?.navigator)===null||t===void 0?void 0:t.userAgent)}function h5(){var t,e;return(e=(t=window?.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const u$='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function d5(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(u$)),document.documentElement.appendChild(t)}function p5(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e2&&(o.children=arguments.length>3?rd.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return nd(t,o,n,i,null)}function nd(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++g5,__i:-1,__u:0};return i==null&&Vr.vnode!=null&&Vr.vnode(s),s}function jf(t){return t.children}function id(t,e){this.props=t,this.context=e}function Tc(t,e){if(e==null)return t.__?Tc(t.__,t.__i+1):null;for(var r;ee&&Na.sort(tv));sd.__r=0}function _5(t,e,r,n,i,s,o,a,f,u,h){var g,b,x,S,C,D,B=n&&n.__k||y5,L=e.length;for(f=l$(r,e,B,f),g=0;g0?nd(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,(f=s.__i=h$(s,r,a,g))!==-1&&(g--,(o=r[f])&&(o.__u|=2)),o==null||o.__v===null?(f==-1&&b--,typeof s.type!="function"&&(s.__u|=4)):f!==a&&(f==a-1?b--:f==a+1?b++:(f>a?b--:b++,s.__u|=4))):s=t.__k[i]=null;if(g)for(i=0;i(f!=null&&(2&f.__u)==0?1:0))for(;o>=0||a=0){if((f=e[o])&&(2&f.__u)==0&&i==f.key&&s===f.type)return o;o--}if(a=r.__.length&&r.__.push({}),r.__[t]}function B5(t){return lv=1,g$(j5,t)}function g$(t,e,r){var n=k5(ad++,2);if(n.t=t,!n.__c&&(n.__=[j5(void 0,e),function(a){var f=n.__N?n.__N[0]:n.__[0],u=n.t(f,a);f!==u&&(n.__N=[u,n.__[1]],n.__c.setState({}))}],n.__c=on,!on.u)){var i=function(a,f,u){if(!n.__c.__H)return!0;var h=n.__c.__H.__.filter(function(b){return!!b.__c});if(h.every(function(b){return!b.__N}))return!s||s.call(this,a,f,u);var g=n.__c.props!==a;return h.forEach(function(b){if(b.__N){var x=b.__[0];b.__=b.__N,b.__N=void 0,x!==b.__[0]&&(g=!0)}}),s&&s.call(this,a,f,u)||g};on.u=!0;var s=on.shouldComponentUpdate,o=on.componentWillUpdate;on.componentWillUpdate=function(a,f,u){if(this.__e){var h=s;s=void 0,i(a,f,u),s=h}o&&o.call(this,a,f,u)},on.shouldComponentUpdate=i}return n.__N||n.__}function m$(t,e){var r=k5(ad++,3);!vn.__s&&y$(r.__H,e)&&(r.__=t,r.i=e,on.__H.__h.push(r))}function v$(){for(var t;t=C5.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(cd),t.__H.__h.forEach(hv),t.__H.__h=[]}catch(e){t.__H.__h=[],vn.__e(e,t.__v)}}vn.__b=function(t){on=null,R5&&R5(t)},vn.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),L5&&L5(t,e)},vn.__r=function(t){T5&&T5(t),ad=0;var e=(on=t.__c).__H;e&&(fv===on?(e.__h=[],on.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(cd),e.__h.forEach(hv),e.__h=[],ad=0)),fv=on},vn.diffed=function(t){D5&&D5(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(C5.push(e)!==1&&M5===vn.requestAnimationFrame||((M5=vn.requestAnimationFrame)||b$)(v$)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),fv=on=null},vn.__c=function(t,e){e.some(function(r){try{r.__h.forEach(cd),r.__h=r.__h.filter(function(n){return!n.__||hv(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],vn.__e(n,r.__v)}}),O5&&O5(t,e)},vn.unmount=function(t){N5&&N5(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{cd(n)}catch(i){e=i}}),r.__H=void 0,e&&vn.__e(e,r.__v))};var F5=typeof requestAnimationFrame=="function";function b$(t){var e,r=function(){clearTimeout(n),F5&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);F5&&(e=requestAnimationFrame(r))}function cd(t){var e=on,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),on=e}function hv(t){var e=on;t.__c=t.__(),on=e}function y$(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function j5(t,e){return typeof e=="function"?e(t):e}const w$=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",x$="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",_$="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class E${constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=h5()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const r=this.nextItemKey++;return this.items.set(r,e),this.render(),()=>{this.items.delete(r),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&uv(Or("div",null,Or(U5,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,r])=>Or(S$,Object.assign({},r,{key:e}))))),this.root)}}const U5=t=>Or("div",{class:Bf("-cbwsdk-snackbar-container")},Or("style",null,w$),Or("div",{class:"-cbwsdk-snackbar"},t.children)),S$=({autoExpand:t,message:e,menuItems:r})=>{const[n,i]=B5(!0),[s,o]=B5(t??!1);m$(()=>{const f=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{f.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return Or("div",{class:Bf("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},Or("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},Or("img",{src:x$,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",Or("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),Or("div",{class:"-gear-container"},!s&&Or("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),Or("img",{src:_$,class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&Or("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((f,u)=>Or("div",{class:Bf("-cbwsdk-snackbar-instance-menu-item",f.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:f.onClick,key:u},Or("svg",{width:f.svgWidth,height:f.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Or("path",{"fill-rule":f.defaultFillRule,"clip-rule":f.defaultClipRule,d:f.path,fill:"#AAAAAA"})),Or("span",{class:Bf("-cbwsdk-snackbar-instance-menu-item-info",f.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},f.info)))))};class A${constructor(){this.attached=!1,this.snackbar=new E$}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.snackbar.attach(r),this.attached=!0,d5()}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}}const P$=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class I${constructor(){this.root=null,this.darkMode=h5()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),d5()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(uv(null,this.root),e&&uv(Or(M$,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const M$=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return Or(U5,{darkMode:r},Or("div",{class:"-cbwsdk-redirect-dialog"},Or("style",null,P$),Or("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),Or("div",{class:Bf("-cbwsdk-redirect-dialog-box",s)},Or("p",null,t),Or("button",{onClick:n},e))))},C$="https://keys.coinbase.com/connect",$5="https://www.walletlink.org",R$="https://go.cb-w.com/walletlink";class q5{constructor(){this.attached=!1,this.redirectDialog=new I$}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const r=new URL(R$);r.searchParams.append("redirect_url",a$().href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class eo{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=c$(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(ev);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),f=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!f&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),eo.accountRequestCallbackIds.size>0&&(Array.from(eo.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),eo.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new s$,this.ui=n,this.ui.attach()}subscribe(){const e=Rc.load(this.storage)||Rc.create(this.storage),{linkAPIUrl:r}=this,n=new i$({session:e,linkAPIUrl:r,listener:this}),i=this.isMobileWeb?new q5:new A$;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=Rc.load(this.storage);e?.id===this._session.id&&Cs.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Rs(e.weiValue),data:Df(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Rs(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?Rs(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?Rs(e.gasPriceInWei):null,gasLimit:e.gasLimit?Rs(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:Rs(e.weiValue),data:Df(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?Rs(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?Rs(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?Rs(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?Rs(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Df(e,!0),chainId:r}})}getWalletLinkSession(){return this._session}sendRequest(e){let r=null;const n=Oa(8),i=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,s),r?.()};return new Promise((s,o)=>{r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,a=>{if(r?.(),Nn(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,r){const n={type:"WEB3_REQUEST",id:e,request:r};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:r.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(r.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof q5)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e,r){if(r.method==="requestEthereumAccounts"){eo.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,r)),eo.accountRequestCallbackIds.clear();return}this.invokeCallback(e,r)}handleErrorResponse(e,r,n){var i;const s=(i=n?.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:r,errorMessage:s})}invokeCallback(e,r){const n=this.relayEventManager.callbacks.get(e);n&&(n(r),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:r}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:r}},i=Oa(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(Nn(a))return o(new Error(a.errorMessage));s(a)}),eo.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,r,n,i,s,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:o}};let f=null;const u=Oa(8),h=g=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,a.method,g),f?.()};return f=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:h,onResetConnection:this.resetAndReload}),new Promise((g,b)=>{this.relayEventManager.callbacks.set(u,x=>{if(f?.(),Nn(x))return b(new Error(x.errorMessage));g(x)}),this.publishWeb3RequestEvent(u,a)})}addEthereumChain(e,r,n,i,s,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:o}};let f=null;const u=Oa(8),h=g=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,a.method,g),f?.()};return f=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:h,onResetConnection:this.resetAndReload}),new Promise((g,b)=>{this.relayEventManager.callbacks.set(u,x=>{if(f?.(),Nn(x))return b(new Error(x.errorMessage));g(x)}),this.publishWeb3RequestEvent(u,a)})}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})};let i=null;const s=Oa(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a),i?.()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,f)=>{this.relayEventManager.callbacks.set(s,u=>{if(i?.(),Nn(u)&&u.errorCode)return f(Ar.provider.custom({code:u.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(Nn(u))return f(new Error(u.errorMessage));a(u)}),this.publishWeb3RequestEvent(s,n)})}}eo.accountRequestCallbackIds=new Set;const z5="DefaultChainId",H5="DefaultJsonRpcUrl";class W5{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new Cs("walletlink",$5),this.callback=e.callback||null;const r=this._storage.getItem(ev);if(r){const n=r.split(" ");n[0]!==""&&(this._addresses=n.map(i=>ko(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:r,secret:n}=e.getWalletLinkSession();return{id:r,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(H5))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(H5,e)}updateProviderInfo(e,r){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(z5,r.toString(10)),Of(r)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",Lo(r)))}async watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw Ar.rpc.invalidParams("Type is required");if(r?.type!=="ERC20")throw Ar.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!r?.options)throw Ar.rpc.invalidParams("Options are required");if(!r?.options.address)throw Ar.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=r.options,u=await this.initializeRelay().watchAsset(r.type,i,s,a,o,n?.toString());return Nn(u)?!1:!!u.result}async addEthereumChain(e){var r,n;const i=e[0];if(((r=i.rpcUrls)===null||r===void 0?void 0:r.length)===0)throw Ar.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw Ar.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw Ar.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:f=[],chainName:u,iconUrls:h=[],nativeCurrency:g}=i,b=await o.addEthereumChain(s.toString(),a,h,f,u,g);if(Nn(b))return!1;if(((n=b.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw Ar.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const r=e[0],n=Number.parseInt(r.chainId,16),s=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(Nn(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,r){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(s=>ko(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(ev,i.join(" ")))}async request(e){const r=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return Lo(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(r);case"wallet_switchEthereumChain":return this.switchEthereumChain(r);case"wallet_watchAsset":return this.watchAsset(r);default:if(!this.jsonRpcUrl)throw Ar.rpc.internal("No RPC URL set for chain");return Y6(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const r=ko(e);if(!this._addresses.map(i=>ko(i)).includes(r))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?ko(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?ko(e.to):null,i=e.value!=null?Nf(e.value):BigInt(0),s=e.data?Km(e.data):Buffer.alloc(0),o=e.nonce!=null?Of(e.nonce):null,a=e.gasPrice!=null?Nf(e.gasPrice):null,f=e.maxFeePerGas!=null?Nf(e.maxFeePerGas):null,u=e.maxPriorityFeePerGas!=null?Nf(e.maxPriorityFeePerGas):null,h=e.gas!=null?Nf(e.gas):null,g=e.chainId?Of(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:f,maxPriorityFeePerGas:u,gasLimit:h,chainId:g}}async ecRecover(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Ar.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:zm(n[0]),signature:zm(n[1]),addPrefix:r==="personal_ecRecover"}});if(Nn(s))throw s;return s.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(z5))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,r;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:Lo(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(Nn(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:Lo(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw Ar.rpc.invalidParams();const r=e[1],n=e[0];this._ensureKnownAddress(r);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ko(r),message:zm(n),addPrefix:!0,typedDataJson:null}});if(Nn(s))throw s;return s.result}async _eth_signTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(r);if(Nn(i))throw i;return i.result}async _eth_sendRawTransaction(e){const r=Km(e[0]),i=await this.initializeRelay().submitEthereumTransaction(r,this.getChainId());if(Nn(i))throw i;return i.result}async _eth_sendTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(r);if(Nn(i))throw i;return i.result}async signTypedData(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Ar.rpc.invalidParams();const i=u=>{const h={eth_signTypedData_v1:td.hashForSignTypedDataLegacy,eth_signTypedData_v3:td.hashForSignTypedData_v3,eth_signTypedData_v4:td.hashForSignTypedData_v4,eth_signTypedData:td.hashForSignTypedData_v4};return Df(h[r]({data:TU(u)}),!0)},s=n[r==="eth_signTypedData_v1"?1:0],o=n[r==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const f=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ko(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(Nn(f))throw f;return f.result}initializeRelay(){return this._relay||(this._relay=new eo({linkAPIUrl:$5,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const K5="SignerType",V5=new Cs("CBWSDK","SignerConfigurator");function T$(){return V5.getItem(K5)}function D$(t){V5.setItem(K5,t)}async function O$(t){const{communicator:e,metadata:r,handshakeRequest:n,callback:i}=t;L$(e,r,i).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:o}=await e.postRequestAndWaitForResponse(s);return o}function N$(t){const{signerType:e,metadata:r,communicator:n,callback:i}=t;switch(e){case"scw":return new HU({metadata:r,callback:i,communicator:n});case"walletlink":return new W5({metadata:r,callback:i})}}async function L$(t,e,r){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new W5({metadata:e,callback:r});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const k$=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. -Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,pW=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,r=await fetch(e,{method:"HEAD"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const n=r.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(dW)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:gW,getCrossOriginOpenerPolicy:mW}=pW(),K4=420,V4=540;function vW(t){const e=(window.innerWidth-K4)/2+window.screenX,r=(window.innerHeight-V4)/2+window.screenY;yW(t);const n=window.open(t,"Smart Wallet",`width=${K4}, height=${V4}, left=${e}, top=${r}`);if(n==null||n.focus(),!n)throw Ar.rpc.internal("Pop up window failed to open");return n}function bW(t){t&&!t.closed&&t.close()}function yW(t){const e={sdkName:z5,sdkVersion:jl,origin:window.location.origin,coop:mW()};for(const[r,n]of Object.entries(e))t.searchParams.append(r,n.toString())}class wW{constructor({url:e=oW,metadata:r,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=u=>{if(u.origin!==this.url.origin)return;const l=u.data;i(l)&&(s(l),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{bW(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(Ar.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=vW(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:jl,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw Ar.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=r,this.preference=n}}function xW(t){const e=Yz(_W(t),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",jl),r.searchParams.set("code",e.code.toString()),r.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:r.href})}function _W(t){var e;if(typeof t=="string")return{message:t,code:an.rpc.internal};if(Un(t)){const r=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:r.match(/(denied|rejected)/i)?an.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:r,code:n,data:{method:t.method}})}return t}var G4={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,l,d){this.fn=u,this.context=l,this.once=d||!1}function s(u,l,d,p,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var _=new i(d,p||u,y),M=r?r+l:l;return u._events[M]?u._events[M].fn?u._events[M]=[u._events[M],_]:u._events[M].push(_):(u._events[M]=_,u._eventsCount++),u}function o(u,l){--u._eventsCount===0?u._events=new n:delete u._events[l]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,p;if(this._eventsCount===0)return l;for(p in d=this._events)e.call(d,p)&&l.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=r?r+l:l,p=this._events[d];if(!p)return[];if(p.fn)return[p.fn];for(var y=0,_=p.length,M=new Array(_);y<_;y++)M[y]=p[y].fn;return M},a.prototype.listenerCount=function(l){var d=r?r+l:l,p=this._events[d];return p?p.fn?1:p.length:0},a.prototype.emit=function(l,d,p,y,_,M){var O=r?r+l:l;if(!this._events[O])return!1;var L=this._events[O],B=arguments.length,k,H;if(L.fn){switch(L.once&&this.removeListener(l,L.fn,void 0,!0),B){case 1:return L.fn.call(L.context),!0;case 2:return L.fn.call(L.context,d),!0;case 3:return L.fn.call(L.context,d,p),!0;case 4:return L.fn.call(L.context,d,p,y),!0;case 5:return L.fn.call(L.context,d,p,y,_),!0;case 6:return L.fn.call(L.context,d,p,y,_,M),!0}for(H=1,k=new Array(B-1);H(i||(i=CW(n)),i)}}function Y4(t,e){return function(){return t.apply(e,arguments)}}const{toString:DW}=Object.prototype,{getPrototypeOf:dv}=Object,P0=(t=>e=>{const r=DW.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Ps=t=>(t=t.toLowerCase(),e=>P0(e)===t),M0=t=>e=>typeof e===t,{isArray:Nu}=Array,Wl=M0("undefined");function OW(t){return t!==null&&!Wl(t)&&t.constructor!==null&&!Wl(t.constructor)&&Oi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const J4=Ps("ArrayBuffer");function NW(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&J4(t.buffer),e}const LW=M0("string"),Oi=M0("function"),X4=M0("number"),I0=t=>t!==null&&typeof t=="object",kW=t=>t===!0||t===!1,C0=t=>{if(P0(t)!=="object")return!1;const e=dv(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},BW=Ps("Date"),$W=Ps("File"),FW=Ps("Blob"),jW=Ps("FileList"),UW=t=>I0(t)&&Oi(t.pipe),qW=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Oi(t.append)&&((e=P0(t))==="formdata"||e==="object"&&Oi(t.toString)&&t.toString()==="[object FormData]"))},zW=Ps("URLSearchParams"),[HW,WW,KW,VW]=["ReadableStream","Request","Response","Headers"].map(Ps),GW=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Kl(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Nu(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const xc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Q4=t=>!Wl(t)&&t!==xc;function pv(){const{caseless:t}=Q4(this)&&this||{},e={},r=(n,i)=>{const s=t&&Z4(e,i)||i;C0(e[s])&&C0(n)?e[s]=pv(e[s],n):C0(n)?e[s]=pv({},n):Nu(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(Kl(e,(i,s)=>{r&&Oi(i)?t[s]=Y4(i,r):t[s]=i},{allOwnKeys:n}),t),JW=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),XW=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},ZW=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&dv(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},QW=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},eK=t=>{if(!t)return null;if(Nu(t))return t;let e=t.length;if(!X4(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},tK=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&dv(Uint8Array)),rK=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},nK=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},iK=Ps("HTMLFormElement"),sK=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),e8=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),oK=Ps("RegExp"),t8=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};Kl(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},aK=t=>{t8(t,(e,r)=>{if(Oi(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Oi(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},cK=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Nu(t)?n(t):n(String(t).split(e)),r},uK=()=>{},fK=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,gv="abcdefghijklmnopqrstuvwxyz",r8="0123456789",n8={DIGIT:r8,ALPHA:gv,ALPHA_DIGIT:gv+gv.toUpperCase()+r8},lK=(t=16,e=n8.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function hK(t){return!!(t&&Oi(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const dK=t=>{const e=new Array(10),r=(n,i)=>{if(I0(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Nu(n)?[]:{};return Kl(n,(o,a)=>{const u=r(o,i+1);!Wl(u)&&(s[a]=u)}),e[i]=void 0,s}}return n};return r(t,0)},pK=Ps("AsyncFunction"),gK=t=>t&&(I0(t)||Oi(t))&&Oi(t.then)&&Oi(t.catch),i8=((t,e)=>t?setImmediate:e?((r,n)=>(xc.addEventListener("message",({source:i,data:s})=>{i===xc&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),xc.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Oi(xc.postMessage)),mK=typeof queueMicrotask<"u"?queueMicrotask.bind(xc):typeof process<"u"&&process.nextTick||i8,Oe={isArray:Nu,isArrayBuffer:J4,isBuffer:OW,isFormData:qW,isArrayBufferView:NW,isString:LW,isNumber:X4,isBoolean:kW,isObject:I0,isPlainObject:C0,isReadableStream:HW,isRequest:WW,isResponse:KW,isHeaders:VW,isUndefined:Wl,isDate:BW,isFile:$W,isBlob:FW,isRegExp:oK,isFunction:Oi,isStream:UW,isURLSearchParams:zW,isTypedArray:tK,isFileList:jW,forEach:Kl,merge:pv,extend:YW,trim:GW,stripBOM:JW,inherits:XW,toFlatObject:ZW,kindOf:P0,kindOfTest:Ps,endsWith:QW,toArray:eK,forEachEntry:rK,matchAll:nK,isHTMLForm:iK,hasOwnProperty:e8,hasOwnProp:e8,reduceDescriptors:t8,freezeMethods:aK,toObjectSet:cK,toCamelCase:sK,noop:uK,toFiniteNumber:fK,findKey:Z4,global:xc,isContextDefined:Q4,ALPHABET:n8,generateString:lK,isSpecCompliantForm:hK,toJSONObject:dK,isAsyncFn:pK,isThenable:gK,setImmediate:i8,asap:mK};function ar(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Oe.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const s8=ar.prototype,o8={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{o8[t]={value:t}}),Object.defineProperties(ar,o8),Object.defineProperty(s8,"isAxiosError",{value:!0}),ar.from=(t,e,r,n,i,s)=>{const o=Object.create(s8);return Oe.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),ar.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const vK=null;function mv(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function a8(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function c8(t,e,r){return t?t.concat(e).map(function(i,s){return i=a8(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function bK(t){return Oe.isArray(t)&&!t.some(mv)}const yK=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function T0(t,e,r){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Oe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(O,L){return!Oe.isUndefined(L[O])});const n=r.metaTokens,i=r.visitor||d,s=r.dots,o=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(i))throw new TypeError("visitor must be a function");function l(M){if(M===null)return"";if(Oe.isDate(M))return M.toISOString();if(!u&&Oe.isBlob(M))throw new ar("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(M)||Oe.isTypedArray(M)?u&&typeof Blob=="function"?new Blob([M]):Buffer.from(M):M}function d(M,O,L){let B=M;if(M&&!L&&typeof M=="object"){if(Oe.endsWith(O,"{}"))O=n?O:O.slice(0,-2),M=JSON.stringify(M);else if(Oe.isArray(M)&&bK(M)||(Oe.isFileList(M)||Oe.endsWith(O,"[]"))&&(B=Oe.toArray(M)))return O=a8(O),B.forEach(function(H,U){!(Oe.isUndefined(H)||H===null)&&e.append(o===!0?c8([O],U,s):o===null?O:O+"[]",l(H))}),!1}return mv(M)?!0:(e.append(c8(L,O,s),l(M)),!1)}const p=[],y=Object.assign(yK,{defaultVisitor:d,convertValue:l,isVisitable:mv});function _(M,O){if(!Oe.isUndefined(M)){if(p.indexOf(M)!==-1)throw Error("Circular reference detected in "+O.join("."));p.push(M),Oe.forEach(M,function(B,k){(!(Oe.isUndefined(B)||B===null)&&i.call(e,B,Oe.isString(k)?k.trim():k,O,y))===!0&&_(B,O?O.concat(k):[k])}),p.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return _(t),e}function u8(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function vv(t,e){this._pairs=[],t&&T0(t,this,e)}const f8=vv.prototype;f8.append=function(e,r){this._pairs.push([e,r])},f8.toString=function(e){const r=e?function(n){return e.call(this,n,u8)}:u8;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function wK(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function l8(t,e,r){if(!e)return t;const n=r&&r.encode||wK;Oe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(e,r):s=Oe.isURLSearchParams(e)?e.toString():new vv(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class h8{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(n){n!==null&&e(n)})}}const d8={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},xK={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:vv,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},bv=typeof window<"u"&&typeof document<"u",yv=typeof navigator=="object"&&navigator||void 0,_K=bv&&(!yv||["ReactNative","NativeScript","NS"].indexOf(yv.product)<0),EK=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",SK=bv&&window.location.href||"http://localhost",Yn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:bv,hasStandardBrowserEnv:_K,hasStandardBrowserWebWorkerEnv:EK,navigator:yv,origin:SK},Symbol.toStringTag,{value:"Module"})),...xK};function AK(t,e){return T0(t,new Yn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Yn.isNode&&Oe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function PK(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function MK(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&Oe.isArray(i)?i.length:o,u?(Oe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Oe.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Oe.isArray(i[o])&&(i[o]=MK(i[o])),!a)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const r={};return Oe.forEachEntry(t,(n,i)=>{e(PK(n),i,r,0)}),r}return null}function IK(t,e,r){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const Vl={transitional:d8,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Oe.isObject(e);if(s&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return i?JSON.stringify(p8(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return AK(e,this.formSerializer).toString();if((a=Oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return T0(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),IK(e)):e}],transformResponse:[function(e){const r=this.transitional||Vl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ar.from(a,ar.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Yn.classes.FormData,Blob:Yn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{Vl.headers[t]={}});const CK=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),TK=t=>{const e={};let r,n,i;return t&&t.split(` -`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&CK[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},g8=Symbol("internals");function Gl(t){return t&&String(t).trim().toLowerCase()}function R0(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(R0):String(t)}function RK(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const DK=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function wv(t,e,r,n,i){if(Oe.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Oe.isString(e)){if(Oe.isString(n))return e.indexOf(n)!==-1;if(Oe.isRegExp(n))return n.test(e)}}function OK(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function NK(t,e){const r=Oe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}let yi=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,u,l){const d=Gl(u);if(!d)throw new Error("header name must be a non-empty string");const p=Oe.findKey(i,d);(!p||i[p]===void 0||l===!0||l===void 0&&i[p]!==!1)&&(i[p||u]=R0(a))}const o=(a,u)=>Oe.forEach(a,(l,d)=>s(l,d,u));if(Oe.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(Oe.isString(e)&&(e=e.trim())&&!DK(e))o(TK(e),r);else if(Oe.isHeaders(e))for(const[a,u]of e.entries())s(u,a,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=Gl(e),e){const n=Oe.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return RK(i);if(Oe.isFunction(r))return r.call(this,i,n);if(Oe.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Gl(e),e){const n=Oe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||wv(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=Gl(o),o){const a=Oe.findKey(n,o);a&&(!r||wv(n,n[a],a,r))&&(delete n[a],i=!0)}}return Oe.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||wv(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Oe.forEach(this,(i,s)=>{const o=Oe.findKey(n,s);if(o){r[o]=R0(i),delete r[s];return}const a=e?OK(s):String(s).trim();a!==s&&delete r[s],r[a]=R0(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Oe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Oe.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[g8]=this[g8]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Gl(o);n[a]||(NK(i,o),n[a]=!0)}return Oe.isArray(e)?e.forEach(s):s(e),this}};yi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Oe.reduceDescriptors(yi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),Oe.freezeMethods(yi);function xv(t,e){const r=this||Vl,n=e||r,i=yi.from(n.headers);let s=n.data;return Oe.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function m8(t){return!!(t&&t.__CANCEL__)}function Lu(t,e,r){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,r),this.name="CanceledError"}Oe.inherits(Lu,ar,{__CANCEL__:!0});function v8(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new ar("Request failed with status code "+r.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function LK(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function kK(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),d=n[s];o||(o=l),r[i]=u,n[i]=l;let p=s,y=0;for(;p!==i;)y+=r[p++],p=p%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),l-o{r=d,i=null,s&&(clearTimeout(s),s=null),t.apply(null,l)};return[(...l)=>{const d=Date.now(),p=d-r;p>=n?o(l,d):(i=l,s||(s=setTimeout(()=>{s=null,o(i)},n-p)))},()=>i&&o(i)]}const D0=(t,e,r=3)=>{let n=0;const i=kK(50,250);return BK(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,u=o-n,l=i(u),d=o<=a;n=o;const p={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:l||void 0,estimated:l&&a&&d?(a-o)/l:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(p)},r)},b8=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},y8=t=>(...e)=>Oe.asap(()=>t(...e)),$K=Yn.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Yn.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Yn.origin),Yn.navigator&&/(msie|trident)/i.test(Yn.navigator.userAgent)):()=>!0,FK=Yn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];Oe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Oe.isString(n)&&o.push("path="+n),Oe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function jK(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function UK(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function w8(t,e){return t&&!jK(e)?UK(t,e):e}const x8=t=>t instanceof yi?{...t}:t;function _c(t,e){e=e||{};const r={};function n(l,d,p,y){return Oe.isPlainObject(l)&&Oe.isPlainObject(d)?Oe.merge.call({caseless:y},l,d):Oe.isPlainObject(d)?Oe.merge({},d):Oe.isArray(d)?d.slice():d}function i(l,d,p,y){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l,p,y)}else return n(l,d,p,y)}function s(l,d){if(!Oe.isUndefined(d))return n(void 0,d)}function o(l,d){if(Oe.isUndefined(d)){if(!Oe.isUndefined(l))return n(void 0,l)}else return n(void 0,d)}function a(l,d,p){if(p in e)return n(l,d);if(p in t)return n(void 0,l)}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,d,p)=>i(x8(l),x8(d),p,!0)};return Oe.forEach(Object.keys(Object.assign({},t,e)),function(d){const p=u[d]||i,y=p(t[d],e[d],d);Oe.isUndefined(y)&&p!==a||(r[d]=y)}),r}const _8=t=>{const e=_c({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=yi.from(o),e.url=l8(w8(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(Oe.isFormData(r)){if(Yn.hasStandardBrowserEnv||Yn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[l,...d]=u?u.split(";").map(p=>p.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...d].join("; "))}}if(Yn.hasStandardBrowserEnv&&(n&&Oe.isFunction(n)&&(n=n(e)),n||n!==!1&&$K(e.url))){const l=i&&s&&FK.read(s);l&&o.set(i,l)}return e},qK=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=_8(t);let s=i.data;const o=yi.from(i.headers).normalize();let{responseType:a,onUploadProgress:u,onDownloadProgress:l}=i,d,p,y,_,M;function O(){_&&_(),M&&M(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let L=new XMLHttpRequest;L.open(i.method.toUpperCase(),i.url,!0),L.timeout=i.timeout;function B(){if(!L)return;const H=yi.from("getAllResponseHeaders"in L&&L.getAllResponseHeaders()),z={data:!a||a==="text"||a==="json"?L.responseText:L.response,status:L.status,statusText:L.statusText,headers:H,config:t,request:L};v8(function(R){r(R),O()},function(R){n(R),O()},z),L=null}"onloadend"in L?L.onloadend=B:L.onreadystatechange=function(){!L||L.readyState!==4||L.status===0&&!(L.responseURL&&L.responseURL.indexOf("file:")===0)||setTimeout(B)},L.onabort=function(){L&&(n(new ar("Request aborted",ar.ECONNABORTED,t,L)),L=null)},L.onerror=function(){n(new ar("Network Error",ar.ERR_NETWORK,t,L)),L=null},L.ontimeout=function(){let U=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const z=i.transitional||d8;i.timeoutErrorMessage&&(U=i.timeoutErrorMessage),n(new ar(U,z.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,L)),L=null},s===void 0&&o.setContentType(null),"setRequestHeader"in L&&Oe.forEach(o.toJSON(),function(U,z){L.setRequestHeader(z,U)}),Oe.isUndefined(i.withCredentials)||(L.withCredentials=!!i.withCredentials),a&&a!=="json"&&(L.responseType=i.responseType),l&&([y,M]=D0(l,!0),L.addEventListener("progress",y)),u&&L.upload&&([p,_]=D0(u),L.upload.addEventListener("progress",p),L.upload.addEventListener("loadend",_)),(i.cancelToken||i.signal)&&(d=H=>{L&&(n(!H||H.type?new Lu(null,t,L):H),L.abort(),L=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const k=LK(i.url);if(k&&Yn.protocols.indexOf(k)===-1){n(new ar("Unsupported protocol "+k+":",ar.ERR_BAD_REQUEST,t));return}L.send(s||null)})},zK=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i;const s=function(l){if(!i){i=!0,a();const d=l instanceof Error?l:this.reason;n.abort(d instanceof ar?d:new Lu(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,s(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),t=null)};t.forEach(l=>l.addEventListener("abort",s));const{signal:u}=n;return u.unsubscribe=()=>Oe.asap(a),u}},HK=function*(t,e){let r=t.byteLength;if(r{const i=WK(t,e);let s=0,o,a=u=>{o||(o=!0,n&&n(u))};return new ReadableStream({async pull(u){try{const{done:l,value:d}=await i.next();if(l){a(),u.close();return}let p=d.byteLength;if(r){let y=s+=p;r(y)}u.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(u){return a(u),i.return()}},{highWaterMark:2})},O0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",S8=O0&&typeof ReadableStream=="function",VK=O0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),A8=(t,...e)=>{try{return!!t(...e)}catch{return!1}},GK=S8&&A8(()=>{let t=!1;const e=new Request(Yn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),P8=64*1024,_v=S8&&A8(()=>Oe.isReadableStream(new Response("").body)),N0={stream:_v&&(t=>t.body)};O0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!N0[e]&&(N0[e]=Oe.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,n)})})})(new Response);const YK=async t=>{if(t==null)return 0;if(Oe.isBlob(t))return t.size;if(Oe.isSpecCompliantForm(t))return(await new Request(Yn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(t)||Oe.isArrayBuffer(t))return t.byteLength;if(Oe.isURLSearchParams(t)&&(t=t+""),Oe.isString(t))return(await VK(t)).byteLength},JK=async(t,e)=>{const r=Oe.toFiniteNumber(t.getContentLength());return r??YK(e)},Ev={http:vK,xhr:qK,fetch:O0&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:l,headers:d,withCredentials:p="same-origin",fetchOptions:y}=_8(t);l=l?(l+"").toLowerCase():"text";let _=zK([i,s&&s.toAbortSignal()],o),M;const O=_&&_.unsubscribe&&(()=>{_.unsubscribe()});let L;try{if(u&&GK&&r!=="get"&&r!=="head"&&(L=await JK(d,n))!==0){let z=new Request(e,{method:"POST",body:n,duplex:"half"}),Z;if(Oe.isFormData(n)&&(Z=z.headers.get("content-type"))&&d.setContentType(Z),z.body){const[R,W]=b8(L,D0(y8(u)));n=E8(z.body,P8,R,W)}}Oe.isString(p)||(p=p?"include":"omit");const B="credentials"in Request.prototype;M=new Request(e,{...y,signal:_,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:B?p:void 0});let k=await fetch(M);const H=_v&&(l==="stream"||l==="response");if(_v&&(a||H&&O)){const z={};["status","statusText","headers"].forEach(ie=>{z[ie]=k[ie]});const Z=Oe.toFiniteNumber(k.headers.get("content-length")),[R,W]=a&&b8(Z,D0(y8(a),!0))||[];k=new Response(E8(k.body,P8,R,()=>{W&&W(),O&&O()}),z)}l=l||"text";let U=await N0[Oe.findKey(N0,l)||"text"](k,t);return!H&&O&&O(),await new Promise((z,Z)=>{v8(z,Z,{data:U,headers:yi.from(k.headers),status:k.status,statusText:k.statusText,config:t,request:M})})}catch(B){throw O&&O(),B&&B.name==="TypeError"&&/fetch/i.test(B.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,M),{cause:B.cause||B}):ar.from(B,B&&B.code,t,M)}})};Oe.forEach(Ev,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const M8=t=>`- ${t}`,XK=t=>Oe.isFunction(t)||t===null||t===!1,I8={getAdapter:t=>{t=Oe.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : -`+s.map(M8).join(` -`):" "+M8(s[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:Ev};function Sv(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Lu(null,t)}function C8(t){return Sv(t),t.headers=yi.from(t.headers),t.data=xv.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),I8.getAdapter(t.adapter||Vl.adapter)(t).then(function(n){return Sv(t),n.data=xv.call(t,t.transformResponse,n),n.headers=yi.from(n.headers),n},function(n){return m8(n)||(Sv(t),n&&n.response&&(n.response.data=xv.call(t,t.transformResponse,n.response),n.response.headers=yi.from(n.response.headers))),Promise.reject(n)})}const T8="1.7.8",L0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{L0[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const R8={};L0.transitional=function(e,r,n){function i(s,o){return"[Axios v"+T8+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new ar(i(o," has been removed"+(r?" in "+r:"")),ar.ERR_DEPRECATED);return r&&!R8[o]&&(R8[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}},L0.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function ZK(t,e,r){if(typeof t!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new ar("option "+s+" must be "+u,ar.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ar("Unknown option "+s,ar.ERR_BAD_OPTION)}}const k0={assertOptions:ZK,validators:L0},ro=k0.validators;let Ec=class{constructor(e){this.defaults=e,this.interceptors={request:new h8,response:new h8}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` -`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=_c(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&k0.assertOptions(n,{silentJSONParsing:ro.transitional(ro.boolean),forcedJSONParsing:ro.transitional(ro.boolean),clarifyTimeoutError:ro.transitional(ro.boolean)},!1),i!=null&&(Oe.isFunction(i)?r.paramsSerializer={serialize:i}:k0.assertOptions(i,{encode:ro.function,serialize:ro.function},!0)),k0.assertOptions(r,{baseUrl:ro.spelling("baseURL"),withXsrfToken:ro.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Oe.merge(s.common,s[r.method]);s&&Oe.forEach(["delete","get","head","post","put","patch","common"],M=>{delete s[M]}),r.headers=yi.concat(o,s);const a=[];let u=!0;this.interceptors.request.forEach(function(O){typeof O.runWhen=="function"&&O.runWhen(r)===!1||(u=u&&O.synchronous,a.unshift(O.fulfilled,O.rejected))});const l=[];this.interceptors.response.forEach(function(O){l.push(O.fulfilled,O.rejected)});let d,p=0,y;if(!u){const M=[C8.bind(this),void 0];for(M.unshift.apply(M,a),M.push.apply(M,l),y=M.length,d=Promise.resolve(r);p{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new Lu(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new AP(function(i){e=i}),cancel:e}}};function eV(t){return function(r){return t.apply(null,r)}}function tV(t){return Oe.isObject(t)&&t.isAxiosError===!0}const Av={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Av).forEach(([t,e])=>{Av[e]=t});function D8(t){const e=new Ec(t),r=Y4(Ec.prototype.request,e);return Oe.extend(r,Ec.prototype,e,{allOwnKeys:!0}),Oe.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return D8(_c(t,i))},r}const un=D8(Vl);un.Axios=Ec,un.CanceledError=Lu,un.CancelToken=QK,un.isCancel=m8,un.VERSION=T8,un.toFormData=T0,un.AxiosError=ar,un.Cancel=un.CanceledError,un.all=function(e){return Promise.all(e)},un.spread=eV,un.isAxiosError=tV,un.mergeConfig=_c,un.AxiosHeaders=yi,un.formToJSON=t=>p8(Oe.isHTMLForm(t)?new FormData(t):t),un.getAdapter=I8.getAdapter,un.HttpStatusCode=Av,un.default=un;const{Axios:yae,AxiosError:O8,CanceledError:wae,isCancel:xae,CancelToken:_ae,VERSION:Eae,all:Sae,Cancel:Aae,isAxiosError:Pae,spread:Mae,toFormData:Iae,AxiosHeaders:Cae,HttpStatusCode:Tae,formToJSON:Rae,getAdapter:Dae,mergeConfig:Oae}=un,N8=un.create({timeout:6e4,headers:{"Content-Type":"application/json",token:localStorage.getItem("auth")}});function rV(t){var e,r,n;if(((e=t.data)==null?void 0:e.success)!==!0){const i=new O8((r=t.data)==null?void 0:r.errorMessage,(n=t.data)==null?void 0:n.errorCode,t.config,t.request,t);return Promise.reject(i)}else return t}function nV(t){var r;console.log(t);const e=(r=t.response)==null?void 0:r.data;if(e){console.log(e,"responseData");const n=new O8(e.errorMessage,t.code,t.config,t.request,t.response);return Promise.reject(n)}else return Promise.reject(t)}N8.interceptors.response.use(rV,nV);class iV{constructor(e){Ns(this,"_apiBase","");this.request=e}setApiBase(e){this._apiBase=e||""}async getNonce(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/nonce`,e);return r.data}async getEmailCode(e,r){const{data:n}=await this.request.post(`${this._apiBase}/api/v2/user/get_code`,e,{headers:{"Captcha-Param":r}});return n.data}async emailLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async walletLogin(e){return e.account_enum==="C"?(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data:(await this.request.post(`${this._apiBase}/api/v2/business/login`,e)).data}async tonLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async bindEmail(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindTonWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindEvmWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}}const xa=new iV(N8),sV={projectId:"7a4434fefbcc9af474fb5c995e47d286",metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},L8=RW({appName:"codatta",appLogoUrl:"https://avatars.githubusercontent.com/u/171659315"}),k8=Ee.createContext({saveLastUsedWallet:()=>{},lastUsedWallet:null,wallets:[],initialized:!1,featuredWallets:[],chains:[]});function Yl(){return Ee.useContext(k8)}function oV(t){const{apiBaseUrl:e}=t,[r,n]=Ee.useState([]),[i,s]=Ee.useState([]),[o,a]=Ee.useState(null),[u,l]=Ee.useState(!1),[d,p]=Ee.useState([]),y=O=>{a(O);const B={provider:O.provider instanceof j1?"UniversalProvider":"EIP1193Provider",key:O.key,timestamp:Date.now()};localStorage.setItem("xn-last-used-info",JSON.stringify(B))};function _(O){const L=O.find(B=>{var k;return((k=B.config)==null?void 0:k.name)===t.singleWalletName});if(L)s([L]);else{const B=O.filter(U=>U.featured||U.installed),k=O.filter(U=>!U.featured&&!U.installed),H=[...B,...k];n(H),s(B)}}async function M(){const O=[],L=new Map;IP.forEach(k=>{const H=new Ga(k);k.name==="Coinbase Wallet"&&H.EIP6963Detected({info:{name:"Coinbase Wallet",uuid:"coinbase",icon:k.image,rdns:"coinbase"},provider:L8.getProvider()}),L.set(H.key,H),O.push(H)}),(await Kz()).forEach(k=>{const H=L.get(k.info.name);if(H)H.EIP6963Detected(k);else{const U=new Ga(k);L.set(U.key,U),O.push(U)}});try{const k=JSON.parse(localStorage.getItem("xn-last-used-info")||"{}"),H=L.get(k.key);if(H&&k.provider==="EIP1193Provider"&&H.installed)a(H);else if(k.provider==="UniversalProvider"){const U=await j1.init(sV);if(U.session){const z=new Ga(U);a(z),console.log("Restored UniversalProvider for wallet:",z.key)}}}catch(k){console.log(k)}t.chains&&p(t.chains),_(O),l(!0)}return Ee.useEffect(()=>{M(),xa.setApiBase(e)},[]),le.jsx(k8.Provider,{value:{saveLastUsedWallet:y,wallets:r,initialized:u,lastUsedWallet:o,featuredWallets:i,chains:d},children:t.children})}/** +Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,B$=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,r=await fetch(e,{method:"HEAD"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const n=r.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(k$)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:F$,getCrossOriginOpenerPolicy:j$}=B$(),G5=420,Y5=540;function U$(t){const e=(window.innerWidth-G5)/2+window.screenX,r=(window.innerHeight-Y5)/2+window.screenY;q$(t);const n=window.open(t,"Smart Wallet",`width=${G5}, height=${Y5}, left=${e}, top=${r}`);if(n?.focus(),!n)throw Ar.rpc.internal("Pop up window failed to open");return n}function $$(t){t&&!t.closed&&t.close()}function q$(t){const e={sdkName:G6,sdkVersion:Lf,origin:window.location.origin,coop:j$()};for(const[r,n]of Object.entries(e))t.searchParams.append(r,n.toString())}class z${constructor({url:e=C$,metadata:r,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=f=>{if(f.origin!==this.url.origin)return;const u=f.data;i(u)&&(s(u),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{$$(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(Ar.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=U$(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:Lf,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw Ar.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=r,this.preference=n}}function H$(t){const e=PU(W$(t),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",Lf),r.searchParams.set("code",e.code.toString()),r.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:r.href})}function W$(t){var e;if(typeof t=="string")return{message:t,code:sn.rpc.internal};if(Nn(t)){const r=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:r.match(/(denied|rejected)/i)?sn.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:r,code:n,data:{method:t.method}})}return t}var dv={exports:{}},J5;function K$(){return J5||(J5=1,(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(f,u,h){this.fn=f,this.context=u,this.once=h||!1}function s(f,u,h,g,b){if(typeof h!="function")throw new TypeError("The listener must be a function");var x=new i(h,g||f,b),S=r?r+u:u;return f._events[S]?f._events[S].fn?f._events[S]=[f._events[S],x]:f._events[S].push(x):(f._events[S]=x,f._eventsCount++),f}function o(f,u){--f._eventsCount===0?f._events=new n:delete f._events[u]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],h,g;if(this._eventsCount===0)return u;for(g in h=this._events)e.call(h,g)&&u.push(r?g.slice(1):g);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(h)):u},a.prototype.listeners=function(u){var h=r?r+u:u,g=this._events[h];if(!g)return[];if(g.fn)return[g.fn];for(var b=0,x=g.length,S=new Array(x);b(i||(i=Q$(n)),i)}}function X5(t,e){return function(){return t.apply(e,arguments)}}const{toString:rq}=Object.prototype,{getPrototypeOf:pv}=Object,ud=(t=>e=>{const r=rq.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),fs=t=>(t=t.toLowerCase(),e=>ud(e)===t),fd=t=>e=>typeof e===t,{isArray:Dc}=Array,Uf=fd("undefined");function nq(t){return t!==null&&!Uf(t)&&t.constructor!==null&&!Uf(t.constructor)&&wi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Z5=fs("ArrayBuffer");function iq(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Z5(t.buffer),e}const sq=fd("string"),wi=fd("function"),Q5=fd("number"),ld=t=>t!==null&&typeof t=="object",oq=t=>t===!0||t===!1,hd=t=>{if(ud(t)!=="object")return!1;const e=pv(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},aq=fs("Date"),cq=fs("File"),uq=fs("Blob"),fq=fs("FileList"),lq=t=>ld(t)&&wi(t.pipe),hq=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||wi(t.append)&&((e=ud(t))==="formdata"||e==="object"&&wi(t.toString)&&t.toString()==="[object FormData]"))},dq=fs("URLSearchParams"),[pq,gq,mq,vq]=["ReadableStream","Request","Response","Headers"].map(fs),bq=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function $f(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Dc(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const La=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,t4=t=>!Uf(t)&&t!==La;function gv(){const{caseless:t}=t4(this)&&this||{},e={},r=(n,i)=>{const s=t&&e4(e,i)||i;hd(e[s])&&hd(n)?e[s]=gv(e[s],n):hd(n)?e[s]=gv({},n):Dc(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n($f(e,(i,s)=>{r&&wi(i)?t[s]=X5(i,r):t[s]=i},{allOwnKeys:n}),t),wq=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),xq=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},_q=(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&pv(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},Eq=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},Sq=t=>{if(!t)return null;if(Dc(t))return t;let e=t.length;if(!Q5(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},Aq=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&pv(Uint8Array)),Pq=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},Iq=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},Mq=fs("HTMLFormElement"),Cq=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),r4=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Rq=fs("RegExp"),n4=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};$f(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},Tq=t=>{n4(t,(e,r)=>{if(wi(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(wi(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Dq=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Dc(t)?n(t):n(String(t).split(e)),r},Oq=()=>{},Nq=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,mv="abcdefghijklmnopqrstuvwxyz",i4="0123456789",s4={DIGIT:i4,ALPHA:mv,ALPHA_DIGIT:mv+mv.toUpperCase()+i4},Lq=(t=16,e=s4.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function kq(t){return!!(t&&wi(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const Bq=t=>{const e=new Array(10),r=(n,i)=>{if(ld(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Dc(n)?[]:{};return $f(n,(o,a)=>{const f=r(o,i+1);!Uf(f)&&(s[a]=f)}),e[i]=void 0,s}}return n};return r(t,0)},Fq=fs("AsyncFunction"),jq=t=>t&&(ld(t)||wi(t))&&wi(t.then)&&wi(t.catch),o4=((t,e)=>t?setImmediate:e?((r,n)=>(La.addEventListener("message",({source:i,data:s})=>{i===La&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),La.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",wi(La.postMessage)),Uq=typeof queueMicrotask<"u"?queueMicrotask.bind(La):typeof process<"u"&&process.nextTick||o4,Le={isArray:Dc,isArrayBuffer:Z5,isBuffer:nq,isFormData:hq,isArrayBufferView:iq,isString:sq,isNumber:Q5,isBoolean:oq,isObject:ld,isPlainObject:hd,isReadableStream:pq,isRequest:gq,isResponse:mq,isHeaders:vq,isUndefined:Uf,isDate:aq,isFile:cq,isBlob:uq,isRegExp:Rq,isFunction:wi,isStream:lq,isURLSearchParams:dq,isTypedArray:Aq,isFileList:fq,forEach:$f,merge:gv,extend:yq,trim:bq,stripBOM:wq,inherits:xq,toFlatObject:_q,kindOf:ud,kindOfTest:fs,endsWith:Eq,toArray:Sq,forEachEntry:Pq,matchAll:Iq,isHTMLForm:Mq,hasOwnProperty:r4,hasOwnProp:r4,reduceDescriptors:n4,freezeMethods:Tq,toObjectSet:Dq,toCamelCase:Cq,noop:Oq,toFiniteNumber:Nq,findKey:e4,global:La,isContextDefined:t4,ALPHABET:s4,generateString:Lq,isSpecCompliantForm:kq,toJSONObject:Bq,isAsyncFn:Fq,isThenable:jq,setImmediate:o4,asap:Uq};function ar(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Le.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Le.toJSONObject(this.config),code:this.code,status:this.status}}});const a4=ar.prototype,c4={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{c4[t]={value:t}}),Object.defineProperties(ar,c4),Object.defineProperty(a4,"isAxiosError",{value:!0}),ar.from=(t,e,r,n,i,s)=>{const o=Object.create(a4);return Le.toFlatObject(t,o,function(f){return f!==Error.prototype},a=>a!=="isAxiosError"),ar.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const $q=null;function vv(t){return Le.isPlainObject(t)||Le.isArray(t)}function u4(t){return Le.endsWith(t,"[]")?t.slice(0,-2):t}function f4(t,e,r){return t?t.concat(e).map(function(i,s){return i=u4(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function qq(t){return Le.isArray(t)&&!t.some(vv)}const zq=Le.toFlatObject(Le,{},null,function(e){return/^is[A-Z]/.test(e)});function dd(t,e,r){if(!Le.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Le.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,D){return!Le.isUndefined(D[C])});const n=r.metaTokens,i=r.visitor||h,s=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&Le.isSpecCompliantForm(e);if(!Le.isFunction(i))throw new TypeError("visitor must be a function");function u(S){if(S===null)return"";if(Le.isDate(S))return S.toISOString();if(!f&&Le.isBlob(S))throw new ar("Blob is not supported. Use a Buffer instead.");return Le.isArrayBuffer(S)||Le.isTypedArray(S)?f&&typeof Blob=="function"?new Blob([S]):Buffer.from(S):S}function h(S,C,D){let B=S;if(S&&!D&&typeof S=="object"){if(Le.endsWith(C,"{}"))C=n?C:C.slice(0,-2),S=JSON.stringify(S);else if(Le.isArray(S)&&qq(S)||(Le.isFileList(S)||Le.endsWith(C,"[]"))&&(B=Le.toArray(S)))return C=u4(C),B.forEach(function(H,F){!(Le.isUndefined(H)||H===null)&&e.append(o===!0?f4([C],F,s):o===null?C:C+"[]",u(H))}),!1}return vv(S)?!0:(e.append(f4(D,C,s),u(S)),!1)}const g=[],b=Object.assign(zq,{defaultVisitor:h,convertValue:u,isVisitable:vv});function x(S,C){if(!Le.isUndefined(S)){if(g.indexOf(S)!==-1)throw Error("Circular reference detected in "+C.join("."));g.push(S),Le.forEach(S,function(B,L){(!(Le.isUndefined(B)||B===null)&&i.call(e,B,Le.isString(L)?L.trim():L,C,b))===!0&&x(B,C?C.concat(L):[L])}),g.pop()}}if(!Le.isObject(t))throw new TypeError("data must be an object");return x(t),e}function l4(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function bv(t,e){this._pairs=[],t&&dd(t,this,e)}const h4=bv.prototype;h4.append=function(e,r){this._pairs.push([e,r])},h4.toString=function(e){const r=e?function(n){return e.call(this,n,l4)}:l4;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function Hq(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function d4(t,e,r){if(!e)return t;const n=r&&r.encode||Hq;Le.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(e,r):s=Le.isURLSearchParams(e)?e.toString():new bv(e,r).toString(n),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class p4{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Le.forEach(this.handlers,function(n){n!==null&&e(n)})}}const g4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Wq={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:bv,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},yv=typeof window<"u"&&typeof document<"u",wv=typeof navigator=="object"&&navigator||void 0,Kq=yv&&(!wv||["ReactNative","NativeScript","NS"].indexOf(wv.product)<0),Vq=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Gq=yv&&window.location.href||"http://localhost",Un={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:yv,hasStandardBrowserEnv:Kq,hasStandardBrowserWebWorkerEnv:Vq,navigator:wv,origin:Gq},Symbol.toStringTag,{value:"Module"})),...Wq};function Yq(t,e){return dd(t,new Un.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Un.isNode&&Le.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function Jq(t){return Le.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Xq(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return o=!o&&Le.isArray(i)?i.length:o,f?(Le.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!Le.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&Le.isArray(i[o])&&(i[o]=Xq(i[o])),!a)}if(Le.isFormData(t)&&Le.isFunction(t.entries)){const r={};return Le.forEachEntry(t,(n,i)=>{e(Jq(n),i,r,0)}),r}return null}function Zq(t,e,r){if(Le.isString(t))try{return(e||JSON.parse)(t),Le.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const qf={transitional:g4,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Le.isObject(e);if(s&&Le.isHTMLForm(e)&&(e=new FormData(e)),Le.isFormData(e))return i?JSON.stringify(m4(e)):e;if(Le.isArrayBuffer(e)||Le.isBuffer(e)||Le.isStream(e)||Le.isFile(e)||Le.isBlob(e)||Le.isReadableStream(e))return e;if(Le.isArrayBufferView(e))return e.buffer;if(Le.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Yq(e,this.formSerializer).toString();if((a=Le.isFileList(e))||n.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return dd(a?{"files[]":e}:e,f&&new f,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),Zq(e)):e}],transformResponse:[function(e){const r=this.transitional||qf.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Le.isResponse(e)||Le.isReadableStream(e))return e;if(e&&Le.isString(e)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ar.from(a,ar.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Un.classes.FormData,Blob:Un.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Le.forEach(["delete","get","head","post","put","patch"],t=>{qf.headers[t]={}});const Qq=Le.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ez=t=>{const e={};let r,n,i;return t&&t.split(` +`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&Qq[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},v4=Symbol("internals");function zf(t){return t&&String(t).trim().toLowerCase()}function pd(t){return t===!1||t==null?t:Le.isArray(t)?t.map(pd):String(t)}function tz(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const rz=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function xv(t,e,r,n,i){if(Le.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Le.isString(e)){if(Le.isString(n))return e.indexOf(n)!==-1;if(Le.isRegExp(n))return n.test(e)}}function nz(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function iz(t,e){const r=Le.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}let ci=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(a,f,u){const h=zf(f);if(!h)throw new Error("header name must be a non-empty string");const g=Le.findKey(i,h);(!g||i[g]===void 0||u===!0||u===void 0&&i[g]!==!1)&&(i[g||f]=pd(a))}const o=(a,f)=>Le.forEach(a,(u,h)=>s(u,h,f));if(Le.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(Le.isString(e)&&(e=e.trim())&&!rz(e))o(ez(e),r);else if(Le.isHeaders(e))for(const[a,f]of e.entries())s(f,a,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=zf(e),e){const n=Le.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return tz(i);if(Le.isFunction(r))return r.call(this,i,n);if(Le.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=zf(e),e){const n=Le.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||xv(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(o){if(o=zf(o),o){const a=Le.findKey(n,o);a&&(!r||xv(n,n[a],a,r))&&(delete n[a],i=!0)}}return Le.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||xv(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Le.forEach(this,(i,s)=>{const o=Le.findKey(n,s);if(o){r[o]=pd(i),delete r[s];return}const a=e?nz(s):String(s).trim();a!==s&&delete r[s],r[a]=pd(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Le.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Le.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[v4]=this[v4]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=zf(o);n[a]||(iz(i,o),n[a]=!0)}return Le.isArray(e)?e.forEach(s):s(e),this}};ci.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Le.reduceDescriptors(ci.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),Le.freezeMethods(ci);function _v(t,e){const r=this||qf,n=e||r,i=ci.from(n.headers);let s=n.data;return Le.forEach(t,function(a){s=a.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function b4(t){return!!(t&&t.__CANCEL__)}function Oc(t,e,r){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,r),this.name="CanceledError"}Le.inherits(Oc,ar,{__CANCEL__:!0});function y4(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new ar("Request failed with status code "+r.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function sz(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function oz(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(f){const u=Date.now(),h=n[s];o||(o=u),r[i]=f,n[i]=u;let g=s,b=0;for(;g!==i;)b+=r[g++],g=g%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),u-o{r=h,i=null,s&&(clearTimeout(s),s=null),t.apply(null,u)};return[(...u)=>{const h=Date.now(),g=h-r;g>=n?o(u,h):(i=u,s||(s=setTimeout(()=>{s=null,o(i)},n-g)))},()=>i&&o(i)]}const gd=(t,e,r=3)=>{let n=0;const i=oz(50,250);return az(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,f=o-n,u=i(f),h=o<=a;n=o;const g={loaded:o,total:a,progress:a?o/a:void 0,bytes:f,rate:u||void 0,estimated:u&&a&&h?(a-o)/u:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(g)},r)},w4=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},x4=t=>(...e)=>Le.asap(()=>t(...e)),cz=Un.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,Un.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(Un.origin),Un.navigator&&/(msie|trident)/i.test(Un.navigator.userAgent)):()=>!0,uz=Un.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];Le.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Le.isString(n)&&o.push("path="+n),Le.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function fz(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function lz(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function _4(t,e){return t&&!fz(e)?lz(t,e):e}const E4=t=>t instanceof ci?{...t}:t;function ka(t,e){e=e||{};const r={};function n(u,h,g,b){return Le.isPlainObject(u)&&Le.isPlainObject(h)?Le.merge.call({caseless:b},u,h):Le.isPlainObject(h)?Le.merge({},h):Le.isArray(h)?h.slice():h}function i(u,h,g,b){if(Le.isUndefined(h)){if(!Le.isUndefined(u))return n(void 0,u,g,b)}else return n(u,h,g,b)}function s(u,h){if(!Le.isUndefined(h))return n(void 0,h)}function o(u,h){if(Le.isUndefined(h)){if(!Le.isUndefined(u))return n(void 0,u)}else return n(void 0,h)}function a(u,h,g){if(g in e)return n(u,h);if(g in t)return n(void 0,u)}const f={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(u,h,g)=>i(E4(u),E4(h),g,!0)};return Le.forEach(Object.keys(Object.assign({},t,e)),function(h){const g=f[h]||i,b=g(t[h],e[h],h);Le.isUndefined(b)&&g!==a||(r[h]=b)}),r}const S4=t=>{const e=ka({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=ci.from(o),e.url=d4(_4(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let f;if(Le.isFormData(r)){if(Un.hasStandardBrowserEnv||Un.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((f=o.getContentType())!==!1){const[u,...h]=f?f.split(";").map(g=>g.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...h].join("; "))}}if(Un.hasStandardBrowserEnv&&(n&&Le.isFunction(n)&&(n=n(e)),n||n!==!1&&cz(e.url))){const u=i&&s&&uz.read(s);u&&o.set(i,u)}return e},hz=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=S4(t);let s=i.data;const o=ci.from(i.headers).normalize();let{responseType:a,onUploadProgress:f,onDownloadProgress:u}=i,h,g,b,x,S;function C(){x&&x(),S&&S(),i.cancelToken&&i.cancelToken.unsubscribe(h),i.signal&&i.signal.removeEventListener("abort",h)}let D=new XMLHttpRequest;D.open(i.method.toUpperCase(),i.url,!0),D.timeout=i.timeout;function B(){if(!D)return;const H=ci.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),k={data:!a||a==="text"||a==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:H,config:t,request:D};y4(function(R){r(R),C()},function(R){n(R),C()},k),D=null}"onloadend"in D?D.onloadend=B:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(B)},D.onabort=function(){D&&(n(new ar("Request aborted",ar.ECONNABORTED,t,D)),D=null)},D.onerror=function(){n(new ar("Network Error",ar.ERR_NETWORK,t,D)),D=null},D.ontimeout=function(){let F=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const k=i.transitional||g4;i.timeoutErrorMessage&&(F=i.timeoutErrorMessage),n(new ar(F,k.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,D)),D=null},s===void 0&&o.setContentType(null),"setRequestHeader"in D&&Le.forEach(o.toJSON(),function(F,k){D.setRequestHeader(k,F)}),Le.isUndefined(i.withCredentials)||(D.withCredentials=!!i.withCredentials),a&&a!=="json"&&(D.responseType=i.responseType),u&&([b,S]=gd(u,!0),D.addEventListener("progress",b)),f&&D.upload&&([g,x]=gd(f),D.upload.addEventListener("progress",g),D.upload.addEventListener("loadend",x)),(i.cancelToken||i.signal)&&(h=H=>{D&&(n(!H||H.type?new Oc(null,t,D):H),D.abort(),D=null)},i.cancelToken&&i.cancelToken.subscribe(h),i.signal&&(i.signal.aborted?h():i.signal.addEventListener("abort",h)));const L=sz(i.url);if(L&&Un.protocols.indexOf(L)===-1){n(new ar("Unsupported protocol "+L+":",ar.ERR_BAD_REQUEST,t));return}D.send(s||null)})},dz=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i;const s=function(u){if(!i){i=!0,a();const h=u instanceof Error?u:this.reason;n.abort(h instanceof ar?h:new Oc(h instanceof Error?h.message:h))}};let o=e&&setTimeout(()=>{o=null,s(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),t=null)};t.forEach(u=>u.addEventListener("abort",s));const{signal:f}=n;return f.unsubscribe=()=>Le.asap(a),f}},pz=function*(t,e){let r=t.byteLength;if(r{const i=gz(t,e);let s=0,o,a=f=>{o||(o=!0,n&&n(f))};return new ReadableStream({async pull(f){try{const{done:u,value:h}=await i.next();if(u){a(),f.close();return}let g=h.byteLength;if(r){let b=s+=g;r(b)}f.enqueue(new Uint8Array(h))}catch(u){throw a(u),u}},cancel(f){return a(f),i.return()}},{highWaterMark:2})},md=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",P4=md&&typeof ReadableStream=="function",vz=md&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),I4=(t,...e)=>{try{return!!t(...e)}catch{return!1}},bz=P4&&I4(()=>{let t=!1;const e=new Request(Un.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),M4=64*1024,Ev=P4&&I4(()=>Le.isReadableStream(new Response("").body)),vd={stream:Ev&&(t=>t.body)};md&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!vd[e]&&(vd[e]=Le.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,n)})})})(new Response);const yz=async t=>{if(t==null)return 0;if(Le.isBlob(t))return t.size;if(Le.isSpecCompliantForm(t))return(await new Request(Un.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Le.isArrayBufferView(t)||Le.isArrayBuffer(t))return t.byteLength;if(Le.isURLSearchParams(t)&&(t=t+""),Le.isString(t))return(await vz(t)).byteLength},wz=async(t,e)=>{const r=Le.toFiniteNumber(t.getContentLength());return r??yz(e)},Sv={http:$q,xhr:hz,fetch:md&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:f,responseType:u,headers:h,withCredentials:g="same-origin",fetchOptions:b}=S4(t);u=u?(u+"").toLowerCase():"text";let x=dz([i,s&&s.toAbortSignal()],o),S;const C=x&&x.unsubscribe&&(()=>{x.unsubscribe()});let D;try{if(f&&bz&&r!=="get"&&r!=="head"&&(D=await wz(h,n))!==0){let k=new Request(e,{method:"POST",body:n,duplex:"half"}),$;if(Le.isFormData(n)&&($=k.headers.get("content-type"))&&h.setContentType($),k.body){const[R,W]=w4(D,gd(x4(f)));n=A4(k.body,M4,R,W)}}Le.isString(g)||(g=g?"include":"omit");const B="credentials"in Request.prototype;S=new Request(e,{...b,signal:x,method:r.toUpperCase(),headers:h.normalize().toJSON(),body:n,duplex:"half",credentials:B?g:void 0});let L=await fetch(S);const H=Ev&&(u==="stream"||u==="response");if(Ev&&(a||H&&C)){const k={};["status","statusText","headers"].forEach(V=>{k[V]=L[V]});const $=Le.toFiniteNumber(L.headers.get("content-length")),[R,W]=a&&w4($,gd(x4(a),!0))||[];L=new Response(A4(L.body,M4,R,()=>{W&&W(),C&&C()}),k)}u=u||"text";let F=await vd[Le.findKey(vd,u)||"text"](L,t);return!H&&C&&C(),await new Promise((k,$)=>{y4(k,$,{data:F,headers:ci.from(L.headers),status:L.status,statusText:L.statusText,config:t,request:S})})}catch(B){throw C&&C(),B&&B.name==="TypeError"&&/fetch/i.test(B.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,S),{cause:B.cause||B}):ar.from(B,B&&B.code,t,S)}})};Le.forEach(Sv,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const C4=t=>`- ${t}`,xz=t=>Le.isFunction(t)||t===null||t===!1,R4={getAdapter:t=>{t=Le.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${a} `+(f===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : +`+s.map(C4).join(` +`):" "+C4(s[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:Sv};function Av(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Oc(null,t)}function T4(t){return Av(t),t.headers=ci.from(t.headers),t.data=_v.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),R4.getAdapter(t.adapter||qf.adapter)(t).then(function(n){return Av(t),n.data=_v.call(t,t.transformResponse,n),n.headers=ci.from(n.headers),n},function(n){return b4(n)||(Av(t),n&&n.response&&(n.response.data=_v.call(t,t.transformResponse,n.response),n.response.headers=ci.from(n.response.headers))),Promise.reject(n)})}const D4="1.7.8",bd={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{bd[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const O4={};bd.transitional=function(e,r,n){function i(s,o){return"[Axios v"+D4+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(e===!1)throw new ar(i(o," has been removed"+(r?" in "+r:"")),ar.ERR_DEPRECATED);return r&&!O4[o]&&(O4[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}},bd.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function _z(t,e,r){if(typeof t!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const a=t[s],f=a===void 0||o(a,s,t);if(f!==!0)throw new ar("option "+s+" must be "+f,ar.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ar("Unknown option "+s,ar.ERR_BAD_OPTION)}}const yd={assertOptions:_z,validators:bd},Ts=yd.validators;let Ba=class{constructor(e){this.defaults=e,this.interceptors={request:new p4,response:new p4}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` +`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=ka(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&yd.assertOptions(n,{silentJSONParsing:Ts.transitional(Ts.boolean),forcedJSONParsing:Ts.transitional(Ts.boolean),clarifyTimeoutError:Ts.transitional(Ts.boolean)},!1),i!=null&&(Le.isFunction(i)?r.paramsSerializer={serialize:i}:yd.assertOptions(i,{encode:Ts.function,serialize:Ts.function},!0)),yd.assertOptions(r,{baseUrl:Ts.spelling("baseURL"),withXsrfToken:Ts.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Le.merge(s.common,s[r.method]);s&&Le.forEach(["delete","get","head","post","put","patch","common"],S=>{delete s[S]}),r.headers=ci.concat(o,s);const a=[];let f=!0;this.interceptors.request.forEach(function(C){typeof C.runWhen=="function"&&C.runWhen(r)===!1||(f=f&&C.synchronous,a.unshift(C.fulfilled,C.rejected))});const u=[];this.interceptors.response.forEach(function(C){u.push(C.fulfilled,C.rejected)});let h,g=0,b;if(!f){const S=[T4.bind(this),void 0];for(S.unshift.apply(S,a),S.push.apply(S,u),b=S.length,h=Promise.resolve(r);g{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new Oc(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new IA(function(i){e=i}),cancel:e}}};function Sz(t){return function(r){return t.apply(null,r)}}function Az(t){return Le.isObject(t)&&t.isAxiosError===!0}const Pv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Pv).forEach(([t,e])=>{Pv[e]=t});function N4(t){const e=new Ba(t),r=X5(Ba.prototype.request,e);return Le.extend(r,Ba.prototype,e,{allOwnKeys:!0}),Le.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return N4(ka(t,i))},r}const an=N4(qf);an.Axios=Ba,an.CanceledError=Oc,an.CancelToken=Ez,an.isCancel=b4,an.VERSION=D4,an.toFormData=dd,an.AxiosError=ar,an.Cancel=an.CanceledError,an.all=function(e){return Promise.all(e)},an.spread=Sz,an.isAxiosError=Az,an.mergeConfig=ka,an.AxiosHeaders=ci,an.formToJSON=t=>m4(Le.isHTMLForm(t)?new FormData(t):t),an.getAdapter=R4.getAdapter,an.HttpStatusCode=Pv,an.default=an;const{Axios:Tne,AxiosError:L4,CanceledError:Dne,isCancel:One,CancelToken:Nne,VERSION:Lne,all:kne,Cancel:Bne,isAxiosError:Fne,spread:jne,toFormData:Une,AxiosHeaders:$ne,HttpStatusCode:qne,formToJSON:zne,getAdapter:Hne,mergeConfig:Wne}=an,k4=an.create({timeout:6e4,headers:{"Content-Type":"application/json",token:localStorage.getItem("auth")}});function Pz(t){if(t.data?.success!==!0){const e=new L4(t.data?.errorMessage,t.data?.errorCode,t.config,t.request,t);return Promise.reject(e)}else return t}function Iz(t){console.log(t);const e=t.response?.data;if(e){console.log(e,"responseData");const r=new L4(e.errorMessage,t.code,t.config,t.request,t.response);return Promise.reject(r)}else return Promise.reject(t)}k4.interceptors.response.use(Pz,Iz);class Mz{constructor(e){this.request=e}_apiBase="";setApiBase(e){this._apiBase=e||""}async getNonce(e){const{data:r}=await this.request.post(`${this._apiBase}/api/v2/user/nonce`,e);return r.data}async getEmailCode(e,r){const{data:n}=await this.request.post(`${this._apiBase}/api/v2/user/get_code`,e,{headers:{"Captcha-Param":r}});return n.data}async emailLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async walletLogin(e){return e.account_enum==="C"?(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data:(await this.request.post(`${this._apiBase}/api/v2/business/login`,e)).data}async tonLogin(e){return(await this.request.post(`${this._apiBase}/api/v2/user/login`,e)).data}async bindEmail(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindTonWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}async bindEvmWallet(e){return(await this.request.post("/api/v2/user/account/bind",e)).data}}const Fo=new Mz(k4),Cz={projectId:"7a4434fefbcc9af474fb5c995e47d286",metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},B4=tq({appName:"codatta",appLogoUrl:"https://avatars.githubusercontent.com/u/171659315"}),F4=Se.createContext({saveLastUsedWallet:()=>{},lastUsedWallet:null,wallets:[],initialized:!1,featuredWallets:[],chains:[]});function Hf(){return Se.useContext(F4)}function Rz(t){const{apiBaseUrl:e}=t,[r,n]=Se.useState([]),[i,s]=Se.useState([]),[o,a]=Se.useState(null),[f,u]=Se.useState(!1),[h,g]=Se.useState([]),b=C=>{a(C);const B={provider:C.provider instanceof Bm?"UniversalProvider":"EIP1193Provider",key:C.key,timestamp:Date.now()};localStorage.setItem("xn-last-used-info",JSON.stringify(B))};function x(C){const D=C.find(B=>B.config?.name===t.singleWalletName);if(D)s([D]);else{const B=C.filter(F=>F.featured||F.installed),L=C.filter(F=>!F.featured&&!F.installed),H=[...B,...L];n(H),s(B)}}async function S(){const C=[],D=new Map;DA.forEach(L=>{const H=new la(L);L.name==="Coinbase Wallet"&&H.EIP6963Detected({info:{name:"Coinbase Wallet",uuid:"coinbase",icon:L.image,rdns:"coinbase"},provider:B4.getProvider()}),D.set(H.key,H),C.push(H)}),(await EU()).forEach(L=>{const H=D.get(L.info.name);if(H)H.EIP6963Detected(L);else{const F=new la(L);D.set(F.key,F),C.push(F)}});try{const L=JSON.parse(localStorage.getItem("xn-last-used-info")||"{}"),H=D.get(L.key);if(H&&L.provider==="EIP1193Provider"&&H.installed)a(H);else if(L.provider==="UniversalProvider"){const F=await Bm.init(Cz);if(F.session){const k=new la(F);a(k),console.log("Restored UniversalProvider for wallet:",k.key)}}}catch(L){console.log(L)}t.chains&&g(t.chains),x(C),u(!0)}return Se.useEffect(()=>{S(),Fo.setApiBase(e)},[]),he.jsx(F4.Provider,{value:{saveLastUsedWallet:b,wallets:r,initialized:f,lastUsedWallet:o,featuredWallets:i,chains:h},children:t.children})}/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const aV=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),B8=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/** + */const Tz=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),j4=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */var cV={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + */var Dz={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const uV=Ee.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:s,iconNode:o,...a},u)=>Ee.createElement("svg",{ref:u,...cV,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:B8("lucide",i),...a},[...o.map(([l,d])=>Ee.createElement(l,d)),...Array.isArray(s)?s:[s]]));/** + */const Oz=Se.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:s,iconNode:o,...a},f)=>Se.createElement("svg",{ref:f,...Dz,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:j4("lucide",i),...a},[...o.map(([u,h])=>Se.createElement(u,h)),...Array.isArray(s)?s:[s]]));/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ns=(t,e)=>{const r=Ee.forwardRef(({className:n,...i},s)=>Ee.createElement(uV,{ref:s,iconNode:e,className:B8(`lucide-${aV(t)}`,n),...i}));return r.displayName=`${t}`,r};/** + */const zi=(t,e)=>{const r=Se.forwardRef(({className:n,...i},s)=>Se.createElement(Oz,{ref:s,iconNode:e,className:j4(`lucide-${Tz(t)}`,n),...i}));return r.displayName=`${t}`,r};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fV=ns("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + */const Nz=zi("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $8=ns("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + */const U4=zi("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lV=ns("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const Lz=zi("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hV=ns("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** + */const kz=zi("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dV=ns("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + */const Bz=zi("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const pV=ns("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** + */const Fz=zi("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const F8=ns("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** + */const $4=zi("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gV=ns("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** + */const jz=zi("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Sc=ns("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + */const Fa=zi("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mV=ns("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** + */const Uz=zi("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const j8=ns("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + */const q4=zi("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vV=ns("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]),U8=new Set;function B0(t,e,r){t||U8.has(e)||(console.warn(e),U8.add(e))}function bV(t){if(typeof Proxy>"u")return t;const e=new Map,r=(...n)=>(process.env.NODE_ENV!=="production"&&B0(!1,"motion() is deprecated. Use motion.create() instead."),t(...n));return new Proxy(r,{get:(n,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}function $0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const Pv=t=>Array.isArray(t);function q8(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function Mv(t,e,r,n){if(typeof e=="function"){const[i,s]=z8(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=z8(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function F0(t,e,r){const n=t.getProps();return Mv(n,e,r!==void 0?r:n.custom,t)}const Iv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Cv=["initial",...Iv],Xl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ac=new Set(Xl),no=t=>t*1e3,Do=t=>t/1e3,yV={type:"spring",stiffness:500,damping:25,restSpeed:10},wV=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),xV={type:"keyframes",duration:.8},_V={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},EV=(t,{keyframes:e})=>e.length>2?xV:Ac.has(t)?t.startsWith("scale")?wV(e[1]):yV:_V;function Tv(t,e){return t?t[e]||t.default||t:void 0}const SV={useManualTiming:!1},AV=t=>t!==null;function j0(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(AV),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const qn=t=>t;function PV(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){s.has(l)&&(u.schedule(l),t()),l(o)}const u={schedule:(l,d=!1,p=!1)=>{const _=p&&n?e:r;return d&&s.add(l),_.has(l)||_.add(l),l},cancel:l=>{r.delete(l),s.delete(l)},process:l=>{if(o=l,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,u.process(l))}};return u}const U0=["read","resolveKeyframes","update","preRender","render","postRender"],MV=40;function H8(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=U0.reduce((B,k)=>(B[k]=PV(s),B),{}),{read:a,resolveKeyframes:u,update:l,preRender:d,render:p,postRender:y}=o,_=()=>{const B=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(B-i.timestamp,MV),1),i.timestamp=B,i.isProcessing=!0,a.process(i),u.process(i),l.process(i),d.process(i),p.process(i),y.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(_))},M=()=>{r=!0,n=!0,i.isProcessing||t(_)};return{schedule:U0.reduce((B,k)=>{const H=o[k];return B[k]=(U,z=!1,Z=!1)=>(r||M(),H.schedule(U,z,Z)),B},{}),cancel:B=>{for(let k=0;k(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,IV=1e-7,CV=12;function TV(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=W8(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>IV&&++aTV(s,0,1,t,r);return s=>s===0||s===1?s:W8(i(s),e,n)}const K8=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,V8=t=>e=>1-t(1-e),G8=Zl(.33,1.53,.69,.99),Dv=V8(G8),Y8=K8(Dv),J8=t=>(t*=2)<1?.5*Dv(t):.5*(2-Math.pow(2,-10*(t-1))),Ov=t=>1-Math.sin(Math.acos(t)),X8=V8(Ov),Z8=K8(Ov),Q8=t=>/^0[^.\s]+$/u.test(t);function RV(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Q8(t):!0}let ku=qn,Oo=qn;process.env.NODE_ENV!=="production"&&(ku=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},Oo=(t,e)=>{if(!t)throw new Error(e)});const eE=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),tE=t=>e=>typeof e=="string"&&e.startsWith(t),rE=tE("--"),DV=tE("var(--"),Nv=t=>DV(t)?OV.test(t.split("/*")[0].trim()):!1,OV=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,NV=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function LV(t){const e=NV.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}const kV=4;function nE(t,e,r=1){Oo(r<=kV,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[n,i]=LV(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return eE(o)?parseFloat(o):o}return Nv(i)?nE(i,e,r+1):i}const Ea=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},Ql={...Bu,transform:t=>Ea(0,1,t)},q0={...Bu,default:1},eh=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Sa=eh("deg"),io=eh("%"),zt=eh("px"),BV=eh("vh"),$V=eh("vw"),iE={...io,parse:t=>io.parse(t)/100,transform:t=>io.transform(t*100)},FV=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),sE=t=>t===Bu||t===zt,oE=(t,e)=>parseFloat(t.split(", ")[e]),aE=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return oE(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?oE(s[1],t):0}},jV=new Set(["x","y","z"]),UV=Xl.filter(t=>!jV.has(t));function qV(t){const e=[];return UV.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const $u={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:aE(4,13),y:aE(5,14)};$u.translateX=$u.x,$u.translateY=$u.y;const cE=t=>e=>e.test(t),uE=[Bu,zt,io,Sa,$V,BV,{test:t=>t==="auto",parse:t=>t}],fE=t=>uE.find(cE(t)),Pc=new Set;let Lv=!1,kv=!1;function lE(){if(kv){const t=Array.from(Pc).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=qV(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}kv=!1,Lv=!1,Pc.forEach(t=>t.complete()),Pc.clear()}function hE(){Pc.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(kv=!0)})}function zV(){hE(),lE()}class Bv{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Pc.add(this),Lv||(Lv=!0,Nr.read(hE),Nr.resolveKeyframes(lE))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sMath.round(t*1e5)/1e5,$v=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function HV(t){return t==null}const WV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Fv=(t,e)=>r=>!!(typeof r=="string"&&WV.test(r)&&r.startsWith(t)||e&&!HV(r)&&Object.prototype.hasOwnProperty.call(r,e)),dE=(t,e,r)=>n=>{if(typeof n!="string")return n;const[i,s,o,a]=n.match($v);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},KV=t=>Ea(0,255,t),jv={...Bu,transform:t=>Math.round(KV(t))},Mc={test:Fv("rgb","red"),parse:dE("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+jv.transform(t)+", "+jv.transform(e)+", "+jv.transform(r)+", "+th(Ql.transform(n))+")"};function VV(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const Uv={test:Fv("#"),parse:VV,transform:Mc.transform},Fu={test:Fv("hsl","hue"),parse:dE("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+io.transform(th(e))+", "+io.transform(th(r))+", "+th(Ql.transform(n))+")"},Jn={test:t=>Mc.test(t)||Uv.test(t)||Fu.test(t),parse:t=>Mc.test(t)?Mc.parse(t):Fu.test(t)?Fu.parse(t):Uv.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Mc.transform(t):Fu.transform(t)},GV=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function YV(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match($v))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(GV))===null||r===void 0?void 0:r.length)||0)>0}const pE="number",gE="color",JV="var",XV="var(",mE="${}",ZV=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function rh(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(ZV,u=>(Jn.test(u)?(n.color.push(s),i.push(gE),r.push(Jn.parse(u))):u.startsWith(XV)?(n.var.push(s),i.push(JV),r.push(u)):(n.number.push(s),i.push(pE),r.push(parseFloat(u))),++s,mE)).split(mE);return{values:r,split:a,indexes:n,types:i}}function vE(t){return rh(t).values}function bE(t){const{split:e,types:r}=rh(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function eG(t){const e=vE(t);return bE(t)(e.map(QV))}const Aa={test:YV,parse:vE,createTransformer:bE,getAnimatableNone:eG},tG=new Set(["brightness","contrast","saturate","opacity"]);function rG(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match($v)||[];if(!n)return t;const i=r.replace(n,"");let s=tG.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const nG=/\b([a-z-]*)\(.*?\)/gu,qv={...Aa,getAnimatableNone:t=>{const e=t.match(nG);return e?e.map(rG).join(" "):t}},iG={borderWidth:zt,borderTopWidth:zt,borderRightWidth:zt,borderBottomWidth:zt,borderLeftWidth:zt,borderRadius:zt,radius:zt,borderTopLeftRadius:zt,borderTopRightRadius:zt,borderBottomRightRadius:zt,borderBottomLeftRadius:zt,width:zt,maxWidth:zt,height:zt,maxHeight:zt,top:zt,right:zt,bottom:zt,left:zt,padding:zt,paddingTop:zt,paddingRight:zt,paddingBottom:zt,paddingLeft:zt,margin:zt,marginTop:zt,marginRight:zt,marginBottom:zt,marginLeft:zt,backgroundPositionX:zt,backgroundPositionY:zt},sG={rotate:Sa,rotateX:Sa,rotateY:Sa,rotateZ:Sa,scale:q0,scaleX:q0,scaleY:q0,scaleZ:q0,skew:Sa,skewX:Sa,skewY:Sa,distance:zt,translateX:zt,translateY:zt,translateZ:zt,x:zt,y:zt,z:zt,perspective:zt,transformPerspective:zt,opacity:Ql,originX:iE,originY:iE,originZ:zt},yE={...Bu,transform:Math.round},zv={...iG,...sG,zIndex:yE,size:zt,fillOpacity:Ql,strokeOpacity:Ql,numOctaves:yE},oG={...zv,color:Jn,backgroundColor:Jn,outlineColor:Jn,fill:Jn,stroke:Jn,borderColor:Jn,borderTopColor:Jn,borderRightColor:Jn,borderBottomColor:Jn,borderLeftColor:Jn,filter:qv,WebkitFilter:qv},Hv=t=>oG[t];function wE(t,e){let r=Hv(t);return r!==qv&&(r=Aa),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const aG=new Set(["auto","none","0"]);function cG(t,e,r){let n=0,i;for(;n{r.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function Wv(t){return typeof t=="function"}let z0;function uG(){z0=void 0}const so={now:()=>(z0===void 0&&so.set(zn.isProcessing||SV.useManualTiming?zn.timestamp:performance.now()),z0),set:t=>{z0=t,queueMicrotask(uG)}},_E=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Aa.test(t)||t==="0")&&!t.startsWith("url("));function fG(t){const e=t[0];if(t.length===1)return!0;for(let r=0;rhG?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&zV(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=so.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:u,isGenerator:l}=this.options;if(!l&&!lG(e,n,i,s))if(o)this.options.duration=0;else{u==null||u(j0(e,this.options,r)),a==null||a(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,r);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...d},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function SE(t,e){return e?t*(1e3/e):0}const dG=5;function AE(t,e,r){const n=Math.max(e-dG,0);return SE(r-t(n),e-n)}const Kv=.001,pG=.01,PE=10,gG=.05,mG=1;function vG({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;ku(t<=no(PE),"Spring duration must be 10 seconds or less");let o=1-e;o=Ea(gG,mG,o),t=Ea(pG,PE,Do(t)),o<1?(i=l=>{const d=l*o,p=d*t,y=d-r,_=Vv(l,o),M=Math.exp(-p);return Kv-y/_*M},s=l=>{const p=l*o*t,y=p*r+r,_=Math.pow(o,2)*Math.pow(l,2)*t,M=Math.exp(-p),O=Vv(Math.pow(l,2),o);return(-i(l)+Kv>0?-1:1)*((y-_)*M)/O}):(i=l=>{const d=Math.exp(-l*t),p=(l-r)*t+1;return-Kv+d*p},s=l=>{const d=Math.exp(-l*t),p=(r-l)*(t*t);return d*p});const a=5/t,u=yG(i,s,a);if(t=no(t),isNaN(u))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(u,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:t}}}const bG=12;function yG(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function _G(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!ME(t,xG)&&ME(t,wG)){const r=vG(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function IE({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:u,mass:l,duration:d,velocity:p,isResolvedFromDuration:y}=_G({...n,velocity:-Do(n.velocity||0)}),_=p||0,M=u/(2*Math.sqrt(a*l)),O=s-i,L=Do(Math.sqrt(a/l)),B=Math.abs(O)<5;r||(r=B?.01:2),e||(e=B?.005:.5);let k;if(M<1){const H=Vv(L,M);k=U=>{const z=Math.exp(-M*L*U);return s-z*((_+M*L*O)/H*Math.sin(H*U)+O*Math.cos(H*U))}}else if(M===1)k=H=>s-Math.exp(-L*H)*(O+(_+L*O)*H);else{const H=L*Math.sqrt(M*M-1);k=U=>{const z=Math.exp(-M*L*U),Z=Math.min(H*U,300);return s-z*((_+M*L*O)*Math.sinh(Z)+H*O*Math.cosh(Z))/H}}return{calculatedDuration:y&&d||null,next:H=>{const U=k(H);if(y)o.done=H>=d;else{let z=0;M<1&&(z=H===0?no(_):AE(k,H,U));const Z=Math.abs(z)<=r,R=Math.abs(s-U)<=e;o.done=Z&&R}return o.value=o.done?s:U,o}}}function CE({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:d}){const p=t[0],y={done:!1,value:p},_=W=>a!==void 0&&Wu,M=W=>a===void 0?u:u===void 0||Math.abs(a-W)-O*Math.exp(-W/n),H=W=>B+k(W),U=W=>{const ie=k(W),me=H(W);y.done=Math.abs(ie)<=l,y.value=y.done?B:me};let z,Z;const R=W=>{_(y.value)&&(z=W,Z=IE({keyframes:[y.value,M(y.value)],velocity:AE(H,W,y.value),damping:i,stiffness:s,restDelta:l,restSpeed:d}))};return R(0),{calculatedDuration:null,next:W=>{let ie=!1;return!Z&&z===void 0&&(ie=!0,U(W),R(W)),z!==void 0&&W>=z?Z.next(W-z):(!ie&&U(W),y)}}}const EG=Zl(.42,0,1,1),SG=Zl(0,0,.58,1),TE=Zl(.42,0,.58,1),AG=t=>Array.isArray(t)&&typeof t[0]!="number",Gv=t=>Array.isArray(t)&&typeof t[0]=="number",RE={linear:qn,easeIn:EG,easeInOut:TE,easeOut:SG,circIn:Ov,circInOut:Z8,circOut:X8,backIn:Dv,backInOut:Y8,backOut:G8,anticipate:J8},DE=t=>{if(Gv(t)){Oo(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,r,n,i]=t;return Zl(e,r,n,i)}else if(typeof t=="string")return Oo(RE[t]!==void 0,`Invalid easing type '${t}'`),RE[t];return t},PG=(t,e)=>r=>e(t(r)),No=(...t)=>t.reduce(PG),ju=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},Zr=(t,e,r)=>t+(e-t)*r;function Yv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function MG({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,u=2*r-a;i=Yv(u,a,t+1/3),s=Yv(u,a,t),o=Yv(u,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function H0(t,e){return r=>r>0?e:t}const Jv=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},IG=[Uv,Mc,Fu],CG=t=>IG.find(e=>e.test(t));function OE(t){const e=CG(t);if(ku(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let r=e.parse(t);return e===Fu&&(r=MG(r)),r}const NE=(t,e)=>{const r=OE(t),n=OE(e);if(!r||!n)return H0(t,e);const i={...r};return s=>(i.red=Jv(r.red,n.red,s),i.green=Jv(r.green,n.green,s),i.blue=Jv(r.blue,n.blue,s),i.alpha=Zr(r.alpha,n.alpha,s),Mc.transform(i))},Xv=new Set(["none","hidden"]);function TG(t,e){return Xv.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function RG(t,e){return r=>Zr(t,e,r)}function Zv(t){return typeof t=="number"?RG:typeof t=="string"?Nv(t)?H0:Jn.test(t)?NE:NG:Array.isArray(t)?LE:typeof t=="object"?Jn.test(t)?NE:DG:H0}function LE(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>Zv(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function OG(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=Aa.createTransformer(e),n=rh(t),i=rh(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?Xv.has(t)&&!i.values.length||Xv.has(e)&&!n.values.length?TG(t,e):No(LE(OG(n,i),i.values),r):(ku(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),H0(t,e))};function kE(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Zr(t,e,r):Zv(t)(t,e)}function LG(t,e,r){const n=[],i=r||kE,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=LG(e,n,i),a=o.length,u=l=>{let d=0;if(a>1)for(;du(Ea(t[0],t[s-1],l)):u}function BG(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=ju(0,e,n);t.push(Zr(r,1,i))}}function $G(t){const e=[0];return BG(e,t.length-1),e}function FG(t,e){return t.map(r=>r*e)}function jG(t,e){return t.map(()=>e||TE).splice(0,t.length-1)}function W0({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=AG(n)?n.map(DE):DE(n),s={done:!1,value:e[0]},o=FG(r&&r.length===e.length?r:$G(e),t),a=kG(o,e,{ease:Array.isArray(i)?i:jG(e,i)});return{calculatedDuration:t,next:u=>(s.value=a(u),s.done=u>=t,s)}}const BE=2e4;function UG(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=BE?1/0:e}const qG=t=>{const e=({timestamp:r})=>t(r);return{start:()=>Nr.update(e,!0),stop:()=>_a(e),now:()=>zn.isProcessing?zn.timestamp:so.now()}},zG={decay:CE,inertia:CE,tween:W0,keyframes:W0,spring:IE},HG=t=>t/100;class Qv extends EE{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:u}=this.options;u&&u()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Bv,a=(u,l)=>this.onKeyframesResolved(u,l);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=Wv(r)?r:zG[r]||W0;let u,l;a!==W0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&Oo(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),u=No(HG,kE(e[0],e[1])),e=[0,100]);const d=a({...this.options,keyframes:e});s==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=UG(d));const{calculatedDuration:p}=d,y=p+i,_=y*(n+1)-i;return{generator:d,mirroredGenerator:l,mapPercentToKeyframes:u,calculatedDuration:p,resolvedDuration:y,totalDuration:_}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:W}=this.options;return{done:!0,value:W[W.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:u,calculatedDuration:l,totalDuration:d,resolvedDuration:p}=n;if(this.startTime===null)return s.next(0);const{delay:y,repeat:_,repeatType:M,repeatDelay:O,onUpdate:L}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const B=this.currentTime-y*(this.speed>=0?1:-1),k=this.speed>=0?B<0:B>d;this.currentTime=Math.max(B,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let H=this.currentTime,U=s;if(_){const W=Math.min(this.currentTime,d)/p;let ie=Math.floor(W),me=W%1;!me&&W>=1&&(me=1),me===1&&ie--,ie=Math.min(ie,_+1),!!(ie%2)&&(M==="reverse"?(me=1-me,O&&(me-=O/p)):M==="mirror"&&(U=o)),H=Ea(0,1,me)*p}const z=k?{done:!1,value:u[0]}:U.next(H);a&&(z.value=a(z.value));let{done:Z}=z;!k&&l!==null&&(Z=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const R=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&Z);return R&&i!==void 0&&(z.value=j0(u,this.options,i)),L&&L(z.value),R&&this.finish(),z}get duration(){const{resolved:e}=this;return e?Do(e.calculatedDuration):0}get time(){return Do(this.currentTime)}set time(e){e=no(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=Do(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=qG,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const WG=new Set(["opacity","clipPath","filter","transform"]),KG=10,VG=(t,e)=>{let r="";const n=Math.max(Math.round(e/KG),2);for(let i=0;i(e===void 0&&(e=t()),e)}const GG={linearEasing:void 0};function YG(t,e){const r=eb(t);return()=>{var n;return(n=GG[e])!==null&&n!==void 0?n:r()}}const K0=YG(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function $E(t){return!!(typeof t=="function"&&K0()||!t||typeof t=="string"&&(t in tb||K0())||Gv(t)||Array.isArray(t)&&t.every($E))}const nh=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,tb={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:nh([0,.65,.55,1]),circOut:nh([.55,0,1,.45]),backIn:nh([.31,.01,.66,-.59]),backOut:nh([.33,1.53,.69,.99])};function FE(t,e){if(t)return typeof t=="function"&&K0()?VG(t,e):Gv(t)?nh(t):Array.isArray(t)?t.map(r=>FE(r,e)||tb.easeOut):tb[t]}function JG(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:u}={}){const l={[e]:r};u&&(l.offset=u);const d=FE(a,i);return Array.isArray(d)&&(l.easing=d),t.animate(l,{delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function jE(t,e){t.timeline=e,t.onfinish=null}const XG=eb(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),V0=10,ZG=2e4;function QG(t){return Wv(t.type)||t.type==="spring"||!$E(t.ease)}function eY(t,e){const r=new Qv({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&sthis.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:u,name:l,startTime:d}=this.options;if(!(!((n=u.owner)===null||n===void 0)&&n.current))return!1;if(typeof o=="string"&&K0()&&tY(o)&&(o=UE[o]),QG(this.options)){const{onComplete:y,onUpdate:_,motionValue:M,element:O,...L}=this.options,B=eY(e,L);e=B.keyframes,e.length===1&&(e[1]=e[0]),i=B.duration,s=B.times,o=B.ease,a="keyframes"}const p=JG(u.owner.current,l,e,{...this.options,duration:i,times:s,ease:o});return p.startTime=d??this.calcStartTime(),this.pendingTimeline?(jE(p,this.pendingTimeline),this.pendingTimeline=void 0):p.onfinish=()=>{const{onComplete:y}=this.options;u.set(j0(e,this.options,r)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:p,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return Do(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return Do(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=no(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return qn;const{animation:n}=r;jE(n,e)}return qn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:d,onComplete:p,element:y,..._}=this.options,M=new Qv({..._,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),O=no(this.time);l.setWithVelocity(M.sample(O-V0).value,M.sample(O).value,V0)}const{onStop:u}=this.options;u&&u(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return XG()&&n&&WG.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}const rY=eb(()=>window.ScrollTimeline!==void 0);class nY{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;nrY()&&i.attachTimeline?i.attachTimeline(e):r(i));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function iY({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:u,elapsed:l,...d}){return!!Object.keys(d).length}const rb=(t,e,r,n={},i,s)=>o=>{const a=Tv(n,t)||{},u=a.delay||n.delay||0;let{elapsed:l=0}=n;l=l-no(u);let d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:y=>{e.set(y),a.onUpdate&&a.onUpdate(y)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:i};iY(a)||(d={...d,...EV(t,d)}),d.duration&&(d.duration=no(d.duration)),d.repeatDelay&&(d.repeatDelay=no(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let p=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(p=!0)),p&&!s&&e.get()!==void 0){const y=j0(d.keyframes,a);if(y!==void 0)return Nr.update(()=>{d.onUpdate(y),d.onComplete()}),new nY([])}return!s&&qE.supports(d)?new qE(d):new Qv(d)},sY=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),oY=t=>Pv(t)?t[t.length-1]||0:t;function nb(t,e){t.indexOf(e)===-1&&t.push(e)}function ib(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class sb{constructor(){this.subscriptions=[]}add(e){return nb(this.subscriptions,e),()=>ib(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class cY{constructor(e,r={}){this.version="11.11.17",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=so.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=so.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=aY(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&B0(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new sb);const n=this.events[e].add(r);return e==="change"?()=>{n(),Nr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=so.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>zE)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,zE);return SE(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ih(t,e){return new cY(t,e)}function uY(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,ih(r))}function fY(t,e){const r=F0(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=oY(s[o]);uY(t,o,a)}}const ob=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),HE="data-"+ob("framerAppearId");function WE(t){return t.props[HE]}const Xn=t=>!!(t&&t.getVelocity);function lY(t){return!!(Xn(t)&&t.add)}function ab(t,e){const r=t.getValue("willChange");if(lY(r))return r.add(e)}function hY({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function KE(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...u}=e;n&&(o=n);const l=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const p in u){const y=t.getValue(p,(s=t.latestValues[p])!==null&&s!==void 0?s:null),_=u[p];if(_===void 0||d&&hY(d,p))continue;const M={delay:r,...Tv(o||{},p)};let O=!1;if(window.MotionHandoffAnimation){const B=WE(t);if(B){const k=window.MotionHandoffAnimation(B,p,Nr);k!==null&&(M.startTime=k,O=!0)}}ab(t,p),y.start(rb(p,y,_,t.shouldReduceMotion&&Ac.has(p)?{type:!1}:M,t,O));const L=y.animation;L&&l.push(L)}return a&&Promise.all(l).then(()=>{Nr.update(()=>{a&&fY(t,a)})}),l}function cb(t,e,r={}){var n;const i=F0(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(KE(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:y}=s;return dY(t,e,d+l,p,y,r)}:()=>Promise.resolve(),{when:u}=s;if(u){const[l,d]=u==="beforeChildren"?[o,a]:[a,o];return l().then(()=>d())}else return Promise.all([o(),a(r.delay)])}function dY(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,u=i===1?(l=0)=>l*n:(l=0)=>a-l*n;return Array.from(t.variantChildren).sort(pY).forEach((l,d)=>{l.notify("AnimationStart",e),o.push(cb(l,e,{...s,delay:r+u(d)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function pY(t,e){return t.sortNodePosition(e)}function gY(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>cb(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=cb(t,e,r);else{const i=typeof e=="function"?F0(t,e,r.custom):e;n=Promise.all(KE(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const mY=Cv.length;function VE(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?VE(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;rPromise.all(e.map(({animation:r,options:n})=>gY(t,r,n)))}function wY(t){let e=yY(t),r=GE(),n=!0;const i=u=>(l,d)=>{var p;const y=F0(t,d,u==="exit"?(p=t.presenceContext)===null||p===void 0?void 0:p.custom:void 0);if(y){const{transition:_,transitionEnd:M,...O}=y;l={...l,...O,...M}}return l};function s(u){e=u(t)}function o(u){const{props:l}=t,d=VE(t.parent)||{},p=[],y=new Set;let _={},M=1/0;for(let L=0;LM&&U,ie=!1;const me=Array.isArray(H)?H:[H];let j=me.reduce(i(B),{});z===!1&&(j={});const{prevResolvedValues:E={}}=k,m={...E,...j},f=x=>{W=!0,y.has(x)&&(ie=!0,y.delete(x)),k.needsAnimating[x]=!0;const S=t.getValue(x);S&&(S.liveStyle=!1)};for(const x in m){const S=j[x],A=E[x];if(_.hasOwnProperty(x))continue;let b=!1;Pv(S)&&Pv(A)?b=!q8(S,A):b=S!==A,b?S!=null?f(x):y.add(x):S!==void 0&&y.has(x)?f(x):k.protectedKeys[x]=!0}k.prevProp=H,k.prevResolvedValues=j,k.isActive&&(_={..._,...j}),n&&t.blockInitialAnimation&&(W=!1),W&&(!(Z&&R)||ie)&&p.push(...me.map(x=>({animation:x,options:{type:B}})))}if(y.size){const L={};y.forEach(B=>{const k=t.getBaseTarget(B),H=t.getValue(B);H&&(H.liveStyle=!0),L[B]=k??null}),p.push({animation:L})}let O=!!p.length;return n&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(O=!1),n=!1,O?e(p):Promise.resolve()}function a(u,l){var d;if(r[u].isActive===l)return Promise.resolve();(d=t.variantChildren)===null||d===void 0||d.forEach(y=>{var _;return(_=y.animationState)===null||_===void 0?void 0:_.setActive(u,l)}),r[u].isActive=l;const p=o(u);for(const y in r)r[y].protectedKeys={};return p}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=GE(),n=!0}}}function xY(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!q8(e,t):!1}function Ic(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function GE(){return{animate:Ic(!0),whileInView:Ic(),whileHover:Ic(),whileTap:Ic(),whileDrag:Ic(),whileFocus:Ic(),exit:Ic()}}class Pa{constructor(e){this.isMounted=!1,this.node=e}update(){}}class _Y extends Pa{constructor(e){super(e),e.animationState||(e.animationState=wY(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();$0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let EY=0;class SY extends Pa{constructor(){super(...arguments),this.id=EY++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const AY={animation:{Feature:_Y},exit:{Feature:SY}},YE=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function G0(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const PY=t=>e=>YE(e)&&t(e,G0(e));function Lo(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function ko(t,e,r,n){return Lo(t,e,PY(r),n)}const JE=(t,e)=>Math.abs(t-e);function MY(t,e){const r=JE(t.x,e.x),n=JE(t.y,e.y);return Math.sqrt(r**2+n**2)}class XE{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=fb(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,_=MY(p.offset,{x:0,y:0})>=3;if(!y&&!_)return;const{point:M}=p,{timestamp:O}=zn;this.history.push({...M,timestamp:O});const{onStart:L,onMove:B}=this.handlers;y||(L&&L(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),B&&B(this.lastMoveEvent,p)},this.handlePointerMove=(p,y)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=ub(y,this.transformPagePoint),Nr.update(this.updatePoint,!0)},this.handlePointerUp=(p,y)=>{this.end();const{onEnd:_,onSessionEnd:M,resumeAnimation:O}=this.handlers;if(this.dragSnapToOrigin&&O&&O(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const L=fb(p.type==="pointercancel"?this.lastMoveEventInfo:ub(y,this.transformPagePoint),this.history);this.startEvent&&_&&_(p,L),M&&M(p,L)},!YE(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=G0(e),a=ub(o,this.transformPagePoint),{point:u}=a,{timestamp:l}=zn;this.history=[{...u,timestamp:l}];const{onSessionStart:d}=r;d&&d(e,fb(a,this.history)),this.removeListeners=No(ko(this.contextWindow,"pointermove",this.handlePointerMove),ko(this.contextWindow,"pointerup",this.handlePointerUp),ko(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),_a(this.updatePoint)}}function ub(t,e){return e?{point:e(t.point)}:t}function ZE(t,e){return{x:t.x-e.x,y:t.y-e.y}}function fb({point:t},e){return{point:t,delta:ZE(t,QE(e)),offset:ZE(t,IY(e)),velocity:CY(e,.1)}}function IY(t){return t[0]}function QE(t){return t[t.length-1]}function CY(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=QE(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>no(e)));)r--;if(!n)return{x:0,y:0};const s=Do(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function eS(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const tS=eS("dragHorizontal"),rS=eS("dragVertical");function nS(t){let e=!1;if(t==="y")e=rS();else if(t==="x")e=tS();else{const r=tS(),n=rS();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function iS(){const t=nS(!0);return t?(t(),!1):!0}function Uu(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const sS=1e-4,TY=1-sS,RY=1+sS,oS=.01,DY=0-oS,OY=0+oS;function Ni(t){return t.max-t.min}function NY(t,e,r){return Math.abs(t-e)<=r}function aS(t,e,r,n=.5){t.origin=n,t.originPoint=Zr(e.min,e.max,t.origin),t.scale=Ni(r)/Ni(e),t.translate=Zr(r.min,r.max,t.origin)-t.originPoint,(t.scale>=TY&&t.scale<=RY||isNaN(t.scale))&&(t.scale=1),(t.translate>=DY&&t.translate<=OY||isNaN(t.translate))&&(t.translate=0)}function sh(t,e,r,n){aS(t.x,e.x,r.x,n?n.originX:void 0),aS(t.y,e.y,r.y,n?n.originY:void 0)}function cS(t,e,r){t.min=r.min+e.min,t.max=t.min+Ni(e)}function LY(t,e,r){cS(t.x,e.x,r.x),cS(t.y,e.y,r.y)}function uS(t,e,r){t.min=e.min-r.min,t.max=t.min+Ni(e)}function oh(t,e,r){uS(t.x,e.x,r.x),uS(t.y,e.y,r.y)}function kY(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?Zr(r,t,n.max):Math.min(t,r)),t}function fS(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function BY(t,{top:e,left:r,bottom:n,right:i}){return{x:fS(t.x,r,i),y:fS(t.y,e,n)}}function lS(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=ju(e.min,e.max-n,t.min):n>i&&(r=ju(t.min,t.max-i,e.min)),Ea(0,1,r)}function jY(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const lb=.35;function UY(t=lb){return t===!1?t=0:t===!0&&(t=lb),{x:hS(t,"left","right"),y:hS(t,"top","bottom")}}function hS(t,e,r){return{min:dS(t,e),max:dS(t,r)}}function dS(t,e){return typeof t=="number"?t:t[e]||0}const pS=()=>({translate:0,scale:1,origin:0,originPoint:0}),qu=()=>({x:pS(),y:pS()}),gS=()=>({min:0,max:0}),fn=()=>({x:gS(),y:gS()});function is(t){return[t("x"),t("y")]}function mS({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function qY({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function zY(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function hb(t){return t===void 0||t===1}function db({scale:t,scaleX:e,scaleY:r}){return!hb(t)||!hb(e)||!hb(r)}function Cc(t){return db(t)||vS(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function vS(t){return bS(t.x)||bS(t.y)}function bS(t){return t&&t!=="0%"}function Y0(t,e,r){const n=t-r,i=e*n;return r+i}function yS(t,e,r,n,i){return i!==void 0&&(t=Y0(t,i,n)),Y0(t,r,n)+e}function pb(t,e=0,r=1,n,i){t.min=yS(t.min,e,r,n,i),t.max=yS(t.max,e,r,n,i)}function wS(t,{x:e,y:r}){pb(t.x,e.translate,e.scale,e.originPoint),pb(t.y,r.translate,r.scale,r.originPoint)}const xS=.999999999999,_S=1.0000000000001;function HY(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;axS&&(e.x=1),e.y<_S&&e.y>xS&&(e.y=1)}function zu(t,e){t.min=t.min+e,t.max=t.max+e}function ES(t,e,r,n,i=.5){const s=Zr(t.min,t.max,i);pb(t,e,r,s,n)}function Hu(t,e){ES(t.x,e.x,e.scaleX,e.scale,e.originX),ES(t.y,e.y,e.scaleY,e.scale,e.originY)}function SS(t,e){return mS(zY(t.getBoundingClientRect(),e))}function WY(t,e,r){const n=SS(t,r),{scroll:i}=e;return i&&(zu(n.x,i.offset.x),zu(n.y,i.offset.y)),n}const AS=({current:t})=>t?t.ownerDocument.defaultView:null,KY=new WeakMap;class VY{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=fn(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:p}=this.getProps();p?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(G0(d,"page").point)},s=(d,p)=>{const{drag:y,dragPropagation:_,onDragStart:M}=this.getProps();if(y&&!_&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=nS(y),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),is(L=>{let B=this.getAxisMotionValue(L).get()||0;if(io.test(B)){const{projection:k}=this.visualElement;if(k&&k.layout){const H=k.layout.layoutBox[L];H&&(B=Ni(H)*(parseFloat(B)/100))}}this.originPoint[L]=B}),M&&Nr.postRender(()=>M(d,p)),ab(this.visualElement,"transform");const{animationState:O}=this.visualElement;O&&O.setActive("whileDrag",!0)},o=(d,p)=>{const{dragPropagation:y,dragDirectionLock:_,onDirectionLock:M,onDrag:O}=this.getProps();if(!y&&!this.openGlobalLock)return;const{offset:L}=p;if(_&&this.currentDirection===null){this.currentDirection=GY(L),this.currentDirection!==null&&M&&M(this.currentDirection);return}this.updateAxis("x",p.point,L),this.updateAxis("y",p.point,L),this.visualElement.render(),O&&O(d,p)},a=(d,p)=>this.stop(d,p),u=()=>is(d=>{var p;return this.getAnimationState(d)==="paused"&&((p=this.getAxisMotionValue(d).animation)===null||p===void 0?void 0:p.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new XE(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:AS(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Nr.postRender(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!J0(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=kY(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&Uu(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=BY(i.layoutBox,r):this.constraints=!1,this.elastic=UY(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&is(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=jY(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!Uu(e))return!1;const n=e.current;Oo(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=WY(n,i.root,this.visualElement.getTransformPagePoint());let o=$Y(i.layout.layoutBox,s);if(r){const a=r(qY(o));this.hasMutatedConstraints=!!a,a&&(o=mS(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),u=this.constraints||{},l=is(d=>{if(!J0(d,r,this.currentDirection))return;let p=u&&u[d]||{};o&&(p={min:0,max:0});const y=i?200:1e6,_=i?40:1e7,M={type:"inertia",velocity:n?e[d]:0,bounceStiffness:y,bounceDamping:_,timeConstant:750,restDelta:1,restSpeed:10,...s,...p};return this.startAxisValueAnimation(d,M)});return Promise.all(l).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return ab(this.visualElement,e),n.start(rb(e,n,0,r,this.visualElement,!1))}stopAnimation(){is(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){is(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){is(r=>{const{drag:n}=this.getProps();if(!J0(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-Zr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!Uu(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};is(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const u=a.get();i[o]=FY({min:u,max:u},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),is(o=>{if(!J0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:u,max:l}=this.constraints[o];a.set(Zr(u,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;KY.set(this.visualElement,this);const e=this.visualElement.current,r=ko(e,"pointerdown",u=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();Uu(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Nr.read(n);const o=Lo(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(is(d=>{const p=this.getAxisMotionValue(d);p&&(this.originPoint[d]+=u[d].translate,p.set(p.get()+u[d].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=lb,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function J0(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function GY(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class YY extends Pa{constructor(e){super(e),this.removeGroupControls=qn,this.removeListeners=qn,this.controls=new VY(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||qn}unmount(){this.removeGroupControls(),this.removeListeners()}}const PS=t=>(e,r)=>{t&&Nr.postRender(()=>t(e,r))};class JY extends Pa{constructor(){super(...arguments),this.removePointerDownListener=qn}onPointerDown(e){this.session=new XE(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:AS(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:PS(e),onStart:PS(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&Nr.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=ko(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const X0=Ee.createContext(null);function XY(){const t=Ee.useContext(X0);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=Ee.useId();Ee.useEffect(()=>n(i),[]);const s=Ee.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const gb=Ee.createContext({}),MS=Ee.createContext({}),Z0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function IS(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ah={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(zt.test(t))t=parseFloat(t);else return t;const r=IS(t,e.target.x),n=IS(t,e.target.y);return`${r}% ${n}%`}},ZY={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=Aa.parse(t);if(i.length>5)return n;const s=Aa.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,u=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=u;const l=Zr(a,u,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),s(i)}},Q0={};function QY(t){Object.assign(Q0,t)}const{schedule:mb}=H8(queueMicrotask,!1);class eJ extends Ee.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;QY(tJ),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),Z0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Nr.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),mb.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function CS(t){const[e,r]=XY(),n=Ee.useContext(gb);return le.jsx(eJ,{...t,layoutGroup:n,switchLayoutGroup:Ee.useContext(MS),isPresent:e,safeToRemove:r})}const tJ={borderRadius:{...ah,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ah,borderTopRightRadius:ah,borderBottomLeftRadius:ah,borderBottomRightRadius:ah,boxShadow:ZY},TS=["TopLeft","TopRight","BottomLeft","BottomRight"],rJ=TS.length,RS=t=>typeof t=="string"?parseFloat(t):t,DS=t=>typeof t=="number"||zt.test(t);function nJ(t,e,r,n,i,s){i?(t.opacity=Zr(0,r.opacity!==void 0?r.opacity:1,iJ(n)),t.opacityExit=Zr(e.opacity!==void 0?e.opacity:1,0,sJ(n))):s&&(t.opacity=Zr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(ju(t,e,n))}function LS(t,e){t.min=e.min,t.max=e.max}function ss(t,e){LS(t.x,e.x),LS(t.y,e.y)}function kS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function BS(t,e,r,n,i){return t-=e,t=Y0(t,1/r,n),i!==void 0&&(t=Y0(t,1/i,n)),t}function oJ(t,e=0,r=1,n=.5,i,s=t,o=t){if(io.test(e)&&(e=parseFloat(e),e=Zr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Zr(s.min,s.max,n);t===s&&(a-=e),t.min=BS(t.min,e,r,a,i),t.max=BS(t.max,e,r,a,i)}function $S(t,e,[r,n,i],s,o){oJ(t,e[r],e[n],e[i],e.scale,s,o)}const aJ=["x","scaleX","originX"],cJ=["y","scaleY","originY"];function FS(t,e,r,n){$S(t.x,e,aJ,r?r.x:void 0,n?n.x:void 0),$S(t.y,e,cJ,r?r.y:void 0,n?n.y:void 0)}function jS(t){return t.translate===0&&t.scale===1}function US(t){return jS(t.x)&&jS(t.y)}function qS(t,e){return t.min===e.min&&t.max===e.max}function uJ(t,e){return qS(t.x,e.x)&&qS(t.y,e.y)}function zS(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function HS(t,e){return zS(t.x,e.x)&&zS(t.y,e.y)}function WS(t){return Ni(t.x)/Ni(t.y)}function KS(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class fJ{constructor(){this.members=[]}add(e){nb(this.members,e),e.scheduleRender()}remove(e){if(ib(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function lJ(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:l,rotate:d,rotateX:p,rotateY:y,skewX:_,skewY:M}=r;l&&(n=`perspective(${l}px) ${n}`),d&&(n+=`rotate(${d}deg) `),p&&(n+=`rotateX(${p}deg) `),y&&(n+=`rotateY(${y}deg) `),_&&(n+=`skewX(${_}deg) `),M&&(n+=`skewY(${M}deg) `)}const a=t.x.scale*e.x,u=t.y.scale*e.y;return(a!==1||u!==1)&&(n+=`scale(${a}, ${u})`),n||"none"}const hJ=(t,e)=>t.depth-e.depth;class dJ{constructor(){this.children=[],this.isDirty=!1}add(e){nb(this.children,e),this.isDirty=!0}remove(e){ib(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(hJ),this.isDirty=!1,this.children.forEach(e)}}function ep(t){const e=Xn(t)?t.get():t;return sY(e)?e.toValue():e}function pJ(t,e){const r=so.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(_a(n),t(s-e))};return Nr.read(n,!0),()=>_a(n)}function gJ(t){return t instanceof SVGElement&&t.tagName!=="svg"}function mJ(t,e,r){const n=Xn(t)?t:ih(t);return n.start(rb("",n,e,r)),n.animation}const Tc={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},ch=typeof window<"u"&&window.MotionDebug!==void 0,vb=["","X","Y","Z"],vJ={visibility:"hidden"},VS=1e3;let bJ=0;function bb(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function GS(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=WE(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Nr,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&GS(n)}function YS({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=bJ++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,ch&&(Tc.totalNodes=Tc.resolvedTargetDeltas=Tc.recalculatedProjection=0),this.nodes.forEach(xJ),this.nodes.forEach(PJ),this.nodes.forEach(MJ),this.nodes.forEach(_J),ch&&window.MotionDebug.record(Tc)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let u=0;uthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,p&&p(),p=pJ(y,250),Z0.hasAnimatedSinceResize&&(Z0.hasAnimatedSinceResize=!1,this.nodes.forEach(XS))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&d&&(u||l)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:y,hasRelativeTargetChanged:_,layout:M})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const O=this.options.transition||d.getDefaultTransition()||DJ,{onLayoutAnimationStart:L,onLayoutAnimationComplete:B}=d.getProps(),k=!this.targetLayout||!HS(this.targetLayout,M)||_,H=!y&&_;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||H||y&&(k||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(p,H);const U={...Tv(O,"layout"),onPlay:L,onComplete:B};(d.shouldReduceMotion||this.options.layoutRoot)&&(U.delay=0,U.type=!1),this.startAnimation(U)}else y||XS(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=M})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,_a(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(IJ),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&GS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u{const z=U/1e3;ZS(p.x,o.x,z),ZS(p.y,o.y,z),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(oh(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),TJ(this.relativeTarget,this.relativeTargetOrigin,y,z),H&&uJ(this.relativeTarget,H)&&(this.isProjectionDirty=!1),H||(H=fn()),ss(H,this.relativeTarget)),O&&(this.animationValues=d,nJ(d,l,this.latestValues,z,k,B)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=z},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(_a(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nr.update(()=>{Z0.hasAnimatedSinceResize=!0,this.currentAnimation=mJ(0,VS,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(VS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:u,layout:l,latestValues:d}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&n7(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||fn();const p=Ni(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+p;const y=Ni(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+y}ss(a,u),Hu(a,d),sh(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new fJ),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(a=!0),!a)return;const l={};u.z&&bb("z",o,l,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(JS),this.root.sharedNodes.clear()}}}function yJ(t){t.updateLayout()}function wJ(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?is(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],_=Ni(y);y.min=n[p].min,y.max=y.min+_}):n7(s,r.layoutBox,n)&&is(p=>{const y=o?r.measuredBox[p]:r.layoutBox[p],_=Ni(n[p]);y.max=y.min+_,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[p].max=t.relativeTarget[p].min+_)});const a=qu();sh(a,n,r.layoutBox);const u=qu();o?sh(u,t.applyTransform(i,!0),r.measuredBox):sh(u,n,r.layoutBox);const l=!US(a);let d=!1;if(!t.resumeFrom){const p=t.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:y,layout:_}=p;if(y&&_){const M=fn();oh(M,r.layoutBox,y.layoutBox);const O=fn();oh(O,n,_.layoutBox),HS(M,O)||(d=!0),p.options.layoutRoot&&(t.relativeTarget=O,t.relativeTargetOrigin=M,t.relativeParent=p)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:u,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function xJ(t){ch&&Tc.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function _J(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function EJ(t){t.clearSnapshot()}function JS(t){t.clearMeasurements()}function SJ(t){t.isLayoutDirty=!1}function AJ(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function XS(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function PJ(t){t.resolveTargetDelta()}function MJ(t){t.calcProjection()}function IJ(t){t.resetSkewAndRotation()}function CJ(t){t.removeLeadSnapshot()}function ZS(t,e,r){t.translate=Zr(e.translate,0,r),t.scale=Zr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function QS(t,e,r,n){t.min=Zr(e.min,r.min,n),t.max=Zr(e.max,r.max,n)}function TJ(t,e,r,n){QS(t.x,e.x,r.x,n),QS(t.y,e.y,r.y,n)}function RJ(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const DJ={duration:.45,ease:[.4,0,.1,1]},e7=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),t7=e7("applewebkit/")&&!e7("chrome/")?Math.round:qn;function r7(t){t.min=t7(t.min),t.max=t7(t.max)}function OJ(t){r7(t.x),r7(t.y)}function n7(t,e,r){return t==="position"||t==="preserve-aspect"&&!NY(WS(e),WS(r),.2)}function NJ(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const LJ=YS({attachResizeListener:(t,e)=>Lo(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),yb={current:void 0},i7=YS({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!yb.current){const t=new LJ({});t.mount(window),t.setOptions({layoutScroll:!0}),yb.current=t}return yb.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),kJ={pan:{Feature:JY},drag:{Feature:YY,ProjectionNode:i7,MeasureLayout:CS}};function s7(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||iS())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const u=a[n];u&&Nr.postRender(()=>u(s,o))};return ko(t.current,r,i,{passive:!t.getProps()[n]})}class BJ extends Pa{mount(){this.unmount=No(s7(this.node,!0),s7(this.node,!1))}unmount(){}}class $J extends Pa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=No(Lo(this.node.current,"focus",()=>this.onFocus()),Lo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const o7=(t,e)=>e?t===e?!0:o7(t,e.parentElement):!1;function wb(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,G0(r))}class FJ extends Pa{constructor(){super(...arguments),this.removeStartListeners=qn,this.removeEndListeners=qn,this.removeAccessibleListeners=qn,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=ko(window,"pointerup",(a,u)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:d,globalTapTarget:p}=this.node.getProps(),y=!p&&!o7(this.node.current,a.target)?d:l;y&&Nr.update(()=>y(a,u))},{passive:!(n.onTap||n.onPointerUp)}),o=ko(window,"pointercancel",(a,u)=>this.cancelPress(a,u),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=No(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||wb("up",(u,l)=>{const{onTap:d}=this.node.getProps();d&&Nr.postRender(()=>d(u,l))})};this.removeEndListeners(),this.removeEndListeners=Lo(this.node.current,"keyup",o),wb("down",(a,u)=>{this.startPress(a,u)})},r=Lo(this.node.current,"keydown",e),n=()=>{this.isPressing&&wb("cancel",(s,o)=>this.cancelPress(s,o))},i=Lo(this.node.current,"blur",n);this.removeAccessibleListeners=No(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Nr.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!iS()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Nr.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=ko(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=Lo(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=No(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const xb=new WeakMap,_b=new WeakMap,jJ=t=>{const e=xb.get(t.target);e&&e(t)},UJ=t=>{t.forEach(jJ)};function qJ({root:t,...e}){const r=t||document;_b.has(r)||_b.set(r,{});const n=_b.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(UJ,{root:t,...e})),n[i]}function zJ(t,e,r){const n=qJ(e);return xb.set(t,r),n.observe(t),()=>{xb.delete(t),n.unobserve(t)}}const HJ={some:0,all:1};class WJ extends Pa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:HJ[i]},a=u=>{const{isIntersecting:l}=u;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:p}=this.node.getProps(),y=l?d:p;y&&y(u)};return zJ(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(KJ(e,r))&&this.startObserver()}unmount(){}}function KJ({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const VJ={inView:{Feature:WJ},tap:{Feature:FJ},focus:{Feature:$J},hover:{Feature:BJ}},GJ={layout:{ProjectionNode:i7,MeasureLayout:CS}},Eb=Ee.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),tp=Ee.createContext({}),Sb=typeof window<"u",a7=Sb?Ee.useLayoutEffect:Ee.useEffect,c7=Ee.createContext({strict:!1});function YJ(t,e,r,n,i){var s,o;const{visualElement:a}=Ee.useContext(tp),u=Ee.useContext(c7),l=Ee.useContext(X0),d=Ee.useContext(Eb).reducedMotion,p=Ee.useRef();n=n||u.renderer,!p.current&&n&&(p.current=n(t,{visualState:e,parent:a,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d}));const y=p.current,_=Ee.useContext(MS);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&JJ(p.current,r,i,_);const M=Ee.useRef(!1);Ee.useInsertionEffect(()=>{y&&M.current&&y.update(r,l)});const O=r[HE],L=Ee.useRef(!!O&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,O))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,O)));return a7(()=>{y&&(M.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),mb.render(y.render),L.current&&y.animationState&&y.animationState.animateChanges())}),Ee.useEffect(()=>{y&&(!L.current&&y.animationState&&y.animationState.animateChanges(),L.current&&(queueMicrotask(()=>{var B;(B=window.MotionHandoffMarkAsComplete)===null||B===void 0||B.call(window,O)}),L.current=!1))}),y}function JJ(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:u,layoutRoot:l}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:u7(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&Uu(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:u,layoutRoot:l})}function u7(t){if(t)return t.options.allowProjection!==!1?t.projection:u7(t.parent)}function XJ(t,e,r){return Ee.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):Uu(r)&&(r.current=n))},[e])}function rp(t){return $0(t.animate)||Cv.some(e=>Jl(t[e]))}function f7(t){return!!(rp(t)||t.variants)}function ZJ(t,e){if(rp(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Jl(r)?r:void 0,animate:Jl(n)?n:void 0}}return t.inherit!==!1?e:{}}function QJ(t){const{initial:e,animate:r}=ZJ(t,Ee.useContext(tp));return Ee.useMemo(()=>({initial:e,animate:r}),[l7(e),l7(r)])}function l7(t){return Array.isArray(t)?t.join(" "):t}const h7={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Wu={};for(const t in h7)Wu[t]={isEnabled:e=>h7[t].some(r=>!!e[r])};function eX(t){for(const e in t)Wu[e]={...Wu[e],...t[e]}}const tX=Symbol.for("motionComponentSymbol");function rX({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&eX(t);function s(a,u){let l;const d={...Ee.useContext(Eb),...a,layoutId:nX(a)},{isStatic:p}=d,y=QJ(a),_=n(a,p);if(!p&&Sb){iX(d,t);const M=sX(d);l=M.MeasureLayout,y.visualElement=YJ(i,_,d,e,M.ProjectionNode)}return le.jsxs(tp.Provider,{value:y,children:[l&&y.visualElement?le.jsx(l,{visualElement:y.visualElement,...d}):null,r(i,a,XJ(_,y.visualElement,u),_,p,y.visualElement)]})}const o=Ee.forwardRef(s);return o[tX]=i,o}function nX({layoutId:t}){const e=Ee.useContext(gb).id;return e&&t!==void 0?e+"-"+t:t}function iX(t,e){const r=Ee.useContext(c7).strict;if(process.env.NODE_ENV!=="production"&&e&&r){const n="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?ku(!1,n):Oo(!1,n)}}function sX(t){const{drag:e,layout:r}=Wu;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const oX=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Ab(t){return typeof t!="string"||t.includes("-")?!1:!!(oX.indexOf(t)>-1||/[A-Z]/u.test(t))}function d7(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const p7=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function g7(t,e,r,n){d7(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(p7.has(i)?i:ob(i),e.attrs[i])}function m7(t,{layout:e,layoutId:r}){return Ac.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!Q0[t]||t==="opacity")}function Pb(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(Xn(i[o])||e.style&&Xn(e.style[o])||m7(o,t)||((n=r==null?void 0:r.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function v7(t,e,r){const n=Pb(t,e,r);for(const i in t)if(Xn(t[i])||Xn(e[i])){const s=Xl.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function Mb(t){const e=Ee.useRef(null);return e.current===null&&(e.current=t()),e.current}function aX({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:cX(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const b7=t=>(e,r)=>{const n=Ee.useContext(tp),i=Ee.useContext(X0),s=()=>aX(t,e,n,i);return r?s():Mb(s)};function cX(t,e,r,n){const i={},s=n(t,{});for(const y in s)i[y]=ep(s[y]);let{initial:o,animate:a}=t;const u=rp(t),l=f7(t);e&&l&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const p=d?a:o;if(p&&typeof p!="boolean"&&!$0(p)){const y=Array.isArray(p)?p:[p];for(let _=0;_({style:{},transform:{},transformOrigin:{},vars:{}}),y7=()=>({...Ib(),attrs:{}}),w7=(t,e)=>e&&typeof t=="number"?e.transform(t):t,uX={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},fX=Xl.length;function lX(t,e,r){let n="",i=!0;for(let s=0;stypeof t=="string"&&t.toLowerCase()==="svg",mX={useVisualState:b7({scrapeMotionValuesFromProps:v7,createRenderState:y7,onMount:(t,e,{renderState:r,latestValues:n})=>{Nr.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),Nr.render(()=>{Tb(r,n,Rb(e.tagName),t.transformTemplate),g7(e,r)})}})},vX={useVisualState:b7({scrapeMotionValuesFromProps:Pb,createRenderState:Ib})};function _7(t,e,r){for(const n in e)!Xn(e[n])&&!m7(n,r)&&(t[n]=e[n])}function bX({transformTemplate:t},e){return Ee.useMemo(()=>{const r=Ib();return Cb(r,e,t),Object.assign({},r.vars,r.style)},[e])}function yX(t,e){const r=t.style||{},n={};return _7(n,r,t),Object.assign(n,bX(t,e)),n}function wX(t,e){const r={},n=yX(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const xX=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function np(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||xX.has(t)}let E7=t=>!np(t);function _X(t){t&&(E7=e=>e.startsWith("on")?!np(e):t(e))}try{_X(require("@emotion/is-prop-valid").default)}catch{}function EX(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(E7(i)||r===!0&&np(i)||!e&&!np(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function SX(t,e,r,n){const i=Ee.useMemo(()=>{const s=y7();return Tb(s,e,Rb(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};_7(s,t.style,t),i.style={...s,...i.style}}return i}function AX(t=!1){return(r,n,i,{latestValues:s},o)=>{const u=(Ab(r)?SX:wX)(n,s,o,r),l=EX(n,typeof r=="string",t),d=r!==Ee.Fragment?{...l,...u,ref:i}:{},{children:p}=n,y=Ee.useMemo(()=>Xn(p)?p.get():p,[p]);return Ee.createElement(r,{...d,children:y})}}function PX(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...Ab(n)?mX:vX,preloadedFeatures:t,useRender:AX(i),createVisualElement:e,Component:n};return rX(o)}}const Db={current:null},S7={current:!1};function MX(){if(S7.current=!0,!!Sb)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Db.current=t.matches;t.addListener(e),e()}else Db.current=!1}function IX(t,e,r){for(const n in e){const i=e[n],s=r[n];if(Xn(i))t.addValue(n,i),process.env.NODE_ENV==="development"&&B0(i.version==="11.11.17",`Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`);else if(Xn(s))t.addValue(n,ih(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,ih(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const A7=new WeakMap,CX=[...uE,Jn,Aa],TX=t=>CX.find(cE(t)),P7=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class RX{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Bv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=so.now();this.renderScheduledAtthis.bindToMotionValue(n,r)),S7.current||MX(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Db.current,process.env.NODE_ENV!=="production"&&B0(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){A7.delete(this.current),this.projection&&this.projection.unmount(),_a(this.notifyUpdate),_a(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=Ac.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Nr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Wu){const r=Wu[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):fn()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=ih(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(eE(i)||Q8(i))?i=parseFloat(i):!TX(i)&&Aa.test(r)&&(i=wE(e,r)),this.setBaseTarget(e,Xn(i)?i.get():i)),Xn(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=Mv(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Xn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new sb),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class M7 extends RX{constructor(){super(...arguments),this.KeyframeResolver=xE}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function DX(t){return window.getComputedStyle(t)}class OX extends M7{constructor(){super(...arguments),this.type="html",this.renderInstance=d7}readValueFromInstance(e,r){if(Ac.has(r)){const n=Hv(r);return n&&n.default||0}else{const n=DX(e),i=(rE(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return SS(e,r)}build(e,r,n){Cb(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return Pb(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Xn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class NX extends M7{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=fn}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(Ac.has(r)){const n=Hv(r);return n&&n.default||0}return r=p7.has(r)?r:ob(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return v7(e,r,n)}build(e,r,n){Tb(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){g7(e,r,n,i)}mount(e){this.isSVGTag=Rb(e.tagName),super.mount(e)}}const LX=(t,e)=>Ab(t)?new NX(e):new OX(e,{allowProjection:t!==Ee.Fragment}),kX=PX({...AY,...VJ,...kJ,...GJ},LX),BX=bV(kX);class $X extends Yt.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function FX({children:t,isPresent:e}){const r=Ee.useId(),n=Ee.useRef(null),i=Ee.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=Ee.useContext(Eb);return Ee.useInsertionEffect(()=>{const{width:o,height:a,top:u,left:l}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` + */const $z=zi("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]),z4=new Set;function wd(t,e,r){t||z4.has(e)||(console.warn(e),z4.add(e))}function qz(t){if(typeof Proxy>"u")return t;const e=new Map,r=(...n)=>(process.env.NODE_ENV!=="production"&&wd(!1,"motion() is deprecated. Use motion.create() instead."),t(...n));return new Proxy(r,{get:(n,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}function xd(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const Iv=t=>Array.isArray(t);function H4(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function Mv(t,e,r,n){if(typeof e=="function"){const[i,s]=W4(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=W4(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function _d(t,e,r){const n=t.getProps();return Mv(n,e,r!==void 0?r:n.custom,t)}const Cv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Rv=["initial",...Cv],Kf=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ja=new Set(Kf),Ds=t=>t*1e3,to=t=>t/1e3,zz={type:"spring",stiffness:500,damping:25,restSpeed:10},Hz=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Wz={type:"keyframes",duration:.8},Kz={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Vz=(t,{keyframes:e})=>e.length>2?Wz:ja.has(t)?t.startsWith("scale")?Hz(e[1]):zz:Kz;function Tv(t,e){return t?t[e]||t.default||t:void 0}const Gz={useManualTiming:!1},Yz=t=>t!==null;function Ed(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(Yz),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const Ln=t=>t;function Jz(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(u){s.has(u)&&(f.schedule(u),t()),u(o)}const f={schedule:(u,h=!1,g=!1)=>{const x=g&&n?e:r;return h&&s.add(u),x.has(u)||x.add(u),u},cancel:u=>{r.delete(u),s.delete(u)},process:u=>{if(o=u,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,f.process(u))}};return f}const Sd=["read","resolveKeyframes","update","preRender","render","postRender"],Xz=40;function K4(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=Sd.reduce((B,L)=>(B[L]=Jz(s),B),{}),{read:a,resolveKeyframes:f,update:u,preRender:h,render:g,postRender:b}=o,x=()=>{const B=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(B-i.timestamp,Xz),1),i.timestamp=B,i.isProcessing=!0,a.process(i),f.process(i),u.process(i),h.process(i),g.process(i),b.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(x))},S=()=>{r=!0,n=!0,i.isProcessing||t(x)};return{schedule:Sd.reduce((B,L)=>{const H=o[L];return B[L]=(F,k=!1,$=!1)=>(r||S(),H.schedule(F,k,$)),B},{}),cancel:B=>{for(let L=0;L(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,Zz=1e-7,Qz=12;function eH(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=V4(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>Zz&&++aeH(s,0,1,t,r);return s=>s===0||s===1?s:V4(i(s),e,n)}const G4=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Y4=t=>e=>1-t(1-e),J4=Vf(.33,1.53,.69,.99),Ov=Y4(J4),X4=G4(Ov),Z4=t=>(t*=2)<1?.5*Ov(t):.5*(2-Math.pow(2,-10*(t-1))),Nv=t=>1-Math.sin(Math.acos(t)),Q4=Y4(Nv),e8=G4(Nv),t8=t=>/^0[^.\s]+$/u.test(t);function tH(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||t8(t):!0}let Nc=Ln,ro=Ln;process.env.NODE_ENV!=="production"&&(Nc=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},ro=(t,e)=>{if(!t)throw new Error(e)});const r8=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),n8=t=>e=>typeof e=="string"&&e.startsWith(t),i8=n8("--"),rH=n8("var(--"),Lv=t=>rH(t)?nH.test(t.split("/*")[0].trim()):!1,nH=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,iH=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function sH(t){const e=iH.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}const oH=4;function s8(t,e,r=1){ro(r<=oH,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[n,i]=sH(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return r8(o)?parseFloat(o):o}return Lv(i)?s8(i,e,r+1):i}const Uo=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},Gf={...Lc,transform:t=>Uo(0,1,t)},Ad={...Lc,default:1},Yf=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),$o=Yf("deg"),Os=Yf("%"),zt=Yf("px"),aH=Yf("vh"),cH=Yf("vw"),o8={...Os,parse:t=>Os.parse(t)/100,transform:t=>Os.transform(t*100)},uH=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),a8=t=>t===Lc||t===zt,c8=(t,e)=>parseFloat(t.split(", ")[e]),u8=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return c8(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?c8(s[1],t):0}},fH=new Set(["x","y","z"]),lH=Kf.filter(t=>!fH.has(t));function hH(t){const e=[];return lH.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const kc={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:u8(4,13),y:u8(5,14)};kc.translateX=kc.x,kc.translateY=kc.y;const f8=t=>e=>e.test(t),l8=[Lc,zt,Os,$o,cH,aH,{test:t=>t==="auto",parse:t=>t}],h8=t=>l8.find(f8(t)),Ua=new Set;let kv=!1,Bv=!1;function d8(){if(Bv){const t=Array.from(Ua).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=hH(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}Bv=!1,kv=!1,Ua.forEach(t=>t.complete()),Ua.clear()}function p8(){Ua.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Bv=!0)})}function dH(){p8(),d8()}class Fv{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Ua.add(this),kv||(kv=!0,Nr.read(p8),Nr.resolveKeyframes(d8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sMath.round(t*1e5)/1e5,jv=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function pH(t){return t==null}const gH=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Uv=(t,e)=>r=>!!(typeof r=="string"&&gH.test(r)&&r.startsWith(t)||e&&!pH(r)&&Object.prototype.hasOwnProperty.call(r,e)),g8=(t,e,r)=>n=>{if(typeof n!="string")return n;const[i,s,o,a]=n.match(jv);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},mH=t=>Uo(0,255,t),$v={...Lc,transform:t=>Math.round(mH(t))},$a={test:Uv("rgb","red"),parse:g8("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+$v.transform(t)+", "+$v.transform(e)+", "+$v.transform(r)+", "+Jf(Gf.transform(n))+")"};function vH(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const qv={test:Uv("#"),parse:vH,transform:$a.transform},Bc={test:Uv("hsl","hue"),parse:g8("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+Os.transform(Jf(e))+", "+Os.transform(Jf(r))+", "+Jf(Gf.transform(n))+")"},$n={test:t=>$a.test(t)||qv.test(t)||Bc.test(t),parse:t=>$a.test(t)?$a.parse(t):Bc.test(t)?Bc.parse(t):qv.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?$a.transform(t):Bc.transform(t)},bH=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function yH(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(jv))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(bH))===null||r===void 0?void 0:r.length)||0)>0}const m8="number",v8="color",wH="var",xH="var(",b8="${}",_H=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Xf(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(_H,f=>($n.test(f)?(n.color.push(s),i.push(v8),r.push($n.parse(f))):f.startsWith(xH)?(n.var.push(s),i.push(wH),r.push(f)):(n.number.push(s),i.push(m8),r.push(parseFloat(f))),++s,b8)).split(b8);return{values:r,split:a,indexes:n,types:i}}function y8(t){return Xf(t).values}function w8(t){const{split:e,types:r}=Xf(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function SH(t){const e=y8(t);return w8(t)(e.map(EH))}const qo={test:yH,parse:y8,createTransformer:w8,getAnimatableNone:SH},AH=new Set(["brightness","contrast","saturate","opacity"]);function PH(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(jv)||[];if(!n)return t;const i=r.replace(n,"");let s=AH.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const IH=/\b([a-z-]*)\(.*?\)/gu,zv={...qo,getAnimatableNone:t=>{const e=t.match(IH);return e?e.map(PH).join(" "):t}},MH={borderWidth:zt,borderTopWidth:zt,borderRightWidth:zt,borderBottomWidth:zt,borderLeftWidth:zt,borderRadius:zt,radius:zt,borderTopLeftRadius:zt,borderTopRightRadius:zt,borderBottomRightRadius:zt,borderBottomLeftRadius:zt,width:zt,maxWidth:zt,height:zt,maxHeight:zt,top:zt,right:zt,bottom:zt,left:zt,padding:zt,paddingTop:zt,paddingRight:zt,paddingBottom:zt,paddingLeft:zt,margin:zt,marginTop:zt,marginRight:zt,marginBottom:zt,marginLeft:zt,backgroundPositionX:zt,backgroundPositionY:zt},CH={rotate:$o,rotateX:$o,rotateY:$o,rotateZ:$o,scale:Ad,scaleX:Ad,scaleY:Ad,scaleZ:Ad,skew:$o,skewX:$o,skewY:$o,distance:zt,translateX:zt,translateY:zt,translateZ:zt,x:zt,y:zt,z:zt,perspective:zt,transformPerspective:zt,opacity:Gf,originX:o8,originY:o8,originZ:zt},x8={...Lc,transform:Math.round},Hv={...MH,...CH,zIndex:x8,size:zt,fillOpacity:Gf,strokeOpacity:Gf,numOctaves:x8},RH={...Hv,color:$n,backgroundColor:$n,outlineColor:$n,fill:$n,stroke:$n,borderColor:$n,borderTopColor:$n,borderRightColor:$n,borderBottomColor:$n,borderLeftColor:$n,filter:zv,WebkitFilter:zv},Wv=t=>RH[t];function _8(t,e){let r=Wv(t);return r!==zv&&(r=qo),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const TH=new Set(["auto","none","0"]);function DH(t,e,r){let n=0,i;for(;n{r.getValue(f).set(u)}),this.resolveNoneKeyframes()}}function Kv(t){return typeof t=="function"}let Pd;function OH(){Pd=void 0}const Ns={now:()=>(Pd===void 0&&Ns.set(kn.isProcessing||Gz.useManualTiming?kn.timestamp:performance.now()),Pd),set:t=>{Pd=t,queueMicrotask(OH)}},S8=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(qo.test(t)||t==="0")&&!t.startsWith("url("));function NH(t){const e=t[0];if(t.length===1)return!0;for(let r=0;rkH?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&dH(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=Ns.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:f,isGenerator:u}=this.options;if(!u&&!LH(e,n,i,s))if(o)this.options.duration=0;else{f?.(Ed(e,this.options,r)),a?.(),this.resolveFinishedPromise();return}const h=this.initPlayback(e,r);h!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...h},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function P8(t,e){return e?t*(1e3/e):0}const BH=5;function I8(t,e,r){const n=Math.max(e-BH,0);return P8(r-t(n),e-n)}const Vv=.001,FH=.01,M8=10,jH=.05,UH=1;function $H({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;Nc(t<=Ds(M8),"Spring duration must be 10 seconds or less");let o=1-e;o=Uo(jH,UH,o),t=Uo(FH,M8,to(t)),o<1?(i=u=>{const h=u*o,g=h*t,b=h-r,x=Gv(u,o),S=Math.exp(-g);return Vv-b/x*S},s=u=>{const g=u*o*t,b=g*r+r,x=Math.pow(o,2)*Math.pow(u,2)*t,S=Math.exp(-g),C=Gv(Math.pow(u,2),o);return(-i(u)+Vv>0?-1:1)*((b-x)*S)/C}):(i=u=>{const h=Math.exp(-u*t),g=(u-r)*t+1;return-Vv+h*g},s=u=>{const h=Math.exp(-u*t),g=(r-u)*(t*t);return h*g});const a=5/t,f=zH(i,s,a);if(t=Ds(t),isNaN(f))return{stiffness:100,damping:10,duration:t};{const u=Math.pow(f,2)*n;return{stiffness:u,damping:o*2*Math.sqrt(n*u),duration:t}}}const qH=12;function zH(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function KH(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!C8(t,WH)&&C8(t,HH)){const r=$H(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function R8({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:f,mass:u,duration:h,velocity:g,isResolvedFromDuration:b}=KH({...n,velocity:-to(n.velocity||0)}),x=g||0,S=f/(2*Math.sqrt(a*u)),C=s-i,D=to(Math.sqrt(a/u)),B=Math.abs(C)<5;r||(r=B?.01:2),e||(e=B?.005:.5);let L;if(S<1){const H=Gv(D,S);L=F=>{const k=Math.exp(-S*D*F);return s-k*((x+S*D*C)/H*Math.sin(H*F)+C*Math.cos(H*F))}}else if(S===1)L=H=>s-Math.exp(-D*H)*(C+(x+D*C)*H);else{const H=D*Math.sqrt(S*S-1);L=F=>{const k=Math.exp(-S*D*F),$=Math.min(H*F,300);return s-k*((x+S*D*C)*Math.sinh($)+H*C*Math.cosh($))/H}}return{calculatedDuration:b&&h||null,next:H=>{const F=L(H);if(b)o.done=H>=h;else{let k=0;S<1&&(k=H===0?Ds(x):I8(L,H,F));const $=Math.abs(k)<=r,R=Math.abs(s-F)<=e;o.done=$&&R}return o.value=o.done?s:F,o}}}function T8({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:f,restDelta:u=.5,restSpeed:h}){const g=t[0],b={done:!1,value:g},x=W=>a!==void 0&&Wf,S=W=>a===void 0?f:f===void 0||Math.abs(a-W)-C*Math.exp(-W/n),H=W=>B+L(W),F=W=>{const V=L(W),X=H(W);b.done=Math.abs(V)<=u,b.value=b.done?B:X};let k,$;const R=W=>{x(b.value)&&(k=W,$=R8({keyframes:[b.value,S(b.value)],velocity:I8(H,W,b.value),damping:i,stiffness:s,restDelta:u,restSpeed:h}))};return R(0),{calculatedDuration:null,next:W=>{let V=!1;return!$&&k===void 0&&(V=!0,F(W),R(W)),k!==void 0&&W>=k?$.next(W-k):(!V&&F(W),b)}}}const VH=Vf(.42,0,1,1),GH=Vf(0,0,.58,1),D8=Vf(.42,0,.58,1),YH=t=>Array.isArray(t)&&typeof t[0]!="number",Yv=t=>Array.isArray(t)&&typeof t[0]=="number",O8={linear:Ln,easeIn:VH,easeInOut:D8,easeOut:GH,circIn:Nv,circInOut:e8,circOut:Q4,backIn:Ov,backInOut:X4,backOut:J4,anticipate:Z4},N8=t=>{if(Yv(t)){ro(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,r,n,i]=t;return Vf(e,r,n,i)}else if(typeof t=="string")return ro(O8[t]!==void 0,`Invalid easing type '${t}'`),O8[t];return t},JH=(t,e)=>r=>e(t(r)),no=(...t)=>t.reduce(JH),Fc=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},Zr=(t,e,r)=>t+(e-t)*r;function Jv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function XH({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,f=2*r-a;i=Jv(f,a,t+1/3),s=Jv(f,a,t),o=Jv(f,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function Id(t,e){return r=>r>0?e:t}const Xv=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},ZH=[qv,$a,Bc],QH=t=>ZH.find(e=>e.test(t));function L8(t){const e=QH(t);if(Nc(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let r=e.parse(t);return e===Bc&&(r=XH(r)),r}const k8=(t,e)=>{const r=L8(t),n=L8(e);if(!r||!n)return Id(t,e);const i={...r};return s=>(i.red=Xv(r.red,n.red,s),i.green=Xv(r.green,n.green,s),i.blue=Xv(r.blue,n.blue,s),i.alpha=Zr(r.alpha,n.alpha,s),$a.transform(i))},Zv=new Set(["none","hidden"]);function eW(t,e){return Zv.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function tW(t,e){return r=>Zr(t,e,r)}function Qv(t){return typeof t=="number"?tW:typeof t=="string"?Lv(t)?Id:$n.test(t)?k8:iW:Array.isArray(t)?B8:typeof t=="object"?$n.test(t)?k8:rW:Id}function B8(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>Qv(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function nW(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=qo.createTransformer(e),n=Xf(t),i=Xf(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?Zv.has(t)&&!i.values.length||Zv.has(e)&&!n.values.length?eW(t,e):no(B8(nW(n,i),i.values),r):(Nc(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),Id(t,e))};function F8(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Zr(t,e,r):Qv(t)(t,e)}function sW(t,e,r){const n=[],i=r||F8,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=sW(e,n,i),a=o.length,f=u=>{let h=0;if(a>1)for(;hf(Uo(t[0],t[s-1],u)):f}function aW(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=Fc(0,e,n);t.push(Zr(r,1,i))}}function cW(t){const e=[0];return aW(e,t.length-1),e}function uW(t,e){return t.map(r=>r*e)}function fW(t,e){return t.map(()=>e||D8).splice(0,t.length-1)}function Md({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=YH(n)?n.map(N8):N8(n),s={done:!1,value:e[0]},o=uW(r&&r.length===e.length?r:cW(e),t),a=oW(o,e,{ease:Array.isArray(i)?i:fW(e,i)});return{calculatedDuration:t,next:f=>(s.value=a(f),s.done=f>=t,s)}}const j8=2e4;function lW(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=j8?1/0:e}const hW=t=>{const e=({timestamp:r})=>t(r);return{start:()=>Nr.update(e,!0),stop:()=>jo(e),now:()=>kn.isProcessing?kn.timestamp:Ns.now()}},dW={decay:T8,inertia:T8,tween:Md,keyframes:Md,spring:R8},pW=t=>t/100;class e1 extends A8{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:f}=this.options;f&&f()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=i?.KeyframeResolver||Fv,a=(f,u)=>this.onKeyframesResolved(f,u);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=Kv(r)?r:dW[r]||Md;let f,u;a!==Md&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&ro(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),f=no(pW,F8(e[0],e[1])),e=[0,100]);const h=a({...this.options,keyframes:e});s==="mirror"&&(u=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),h.calculatedDuration===null&&(h.calculatedDuration=lW(h));const{calculatedDuration:g}=h,b=g+i,x=b*(n+1)-i;return{generator:h,mirroredGenerator:u,mapPercentToKeyframes:f,calculatedDuration:g,resolvedDuration:b,totalDuration:x}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:W}=this.options;return{done:!0,value:W[W.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:f,calculatedDuration:u,totalDuration:h,resolvedDuration:g}=n;if(this.startTime===null)return s.next(0);const{delay:b,repeat:x,repeatType:S,repeatDelay:C,onUpdate:D}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-h/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const B=this.currentTime-b*(this.speed>=0?1:-1),L=this.speed>=0?B<0:B>h;this.currentTime=Math.max(B,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=h);let H=this.currentTime,F=s;if(x){const W=Math.min(this.currentTime,h)/g;let V=Math.floor(W),X=W%1;!X&&W>=1&&(X=1),X===1&&V--,V=Math.min(V,x+1),!!(V%2)&&(S==="reverse"?(X=1-X,C&&(X-=C/g)):S==="mirror"&&(F=o)),H=Uo(0,1,X)*g}const k=L?{done:!1,value:f[0]}:F.next(H);a&&(k.value=a(k.value));let{done:$}=k;!L&&u!==null&&($=this.speed>=0?this.currentTime>=h:this.currentTime<=0);const R=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&$);return R&&i!==void 0&&(k.value=Ed(f,this.options,i)),D&&D(k.value),R&&this.finish(),k}get duration(){const{resolved:e}=this;return e?to(e.calculatedDuration):0}get time(){return to(this.currentTime)}set time(e){e=Ds(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=to(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=hW,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const gW=new Set(["opacity","clipPath","filter","transform"]),mW=10,vW=(t,e)=>{let r="";const n=Math.max(Math.round(e/mW),2);for(let i=0;i(e===void 0&&(e=t()),e)}const bW={linearEasing:void 0};function yW(t,e){const r=t1(t);return()=>{var n;return(n=bW[e])!==null&&n!==void 0?n:r()}}const Cd=yW(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function U8(t){return!!(typeof t=="function"&&Cd()||!t||typeof t=="string"&&(t in r1||Cd())||Yv(t)||Array.isArray(t)&&t.every(U8))}const Zf=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,r1={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Zf([0,.65,.55,1]),circOut:Zf([.55,0,1,.45]),backIn:Zf([.31,.01,.66,-.59]),backOut:Zf([.33,1.53,.69,.99])};function $8(t,e){if(t)return typeof t=="function"&&Cd()?vW(t,e):Yv(t)?Zf(t):Array.isArray(t)?t.map(r=>$8(r,e)||r1.easeOut):r1[t]}function wW(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:f}={}){const u={[e]:r};f&&(u.offset=f);const h=$8(a,i);return Array.isArray(h)&&(u.easing=h),t.animate(u,{delay:n,duration:i,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function q8(t,e){t.timeline=e,t.onfinish=null}const xW=t1(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Rd=10,_W=2e4;function EW(t){return Kv(t.type)||t.type==="spring"||!U8(t.ease)}function SW(t,e){const r=new e1({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&s<_W;)n=r.sample(s),i.push(n.value),s+=Rd;return{times:void 0,keyframes:i,duration:s-Rd,ease:"linear"}}const z8={anticipate:Z4,backInOut:X4,circInOut:e8};function AW(t){return t in z8}class H8 extends A8{constructor(e){super(e);const{name:r,motionValue:n,element:i,keyframes:s}=this.options;this.resolver=new E8(s,(o,a)=>this.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:f,name:u,startTime:h}=this.options;if(!(!((n=f.owner)===null||n===void 0)&&n.current))return!1;if(typeof o=="string"&&Cd()&&AW(o)&&(o=z8[o]),EW(this.options)){const{onComplete:b,onUpdate:x,motionValue:S,element:C,...D}=this.options,B=SW(e,D);e=B.keyframes,e.length===1&&(e[1]=e[0]),i=B.duration,s=B.times,o=B.ease,a="keyframes"}const g=wW(f.owner.current,u,e,{...this.options,duration:i,times:s,ease:o});return g.startTime=h??this.calcStartTime(),this.pendingTimeline?(q8(g,this.pendingTimeline),this.pendingTimeline=void 0):g.onfinish=()=>{const{onComplete:b}=this.options;f.set(Ed(e,this.options,r)),b&&b(),this.cancel(),this.resolveFinishedPromise()},{animation:g,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return to(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return to(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=Ds(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return Ln;const{animation:n}=r;q8(n,e)}return Ln}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:h,onComplete:g,element:b,...x}=this.options,S=new e1({...x,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),C=Ds(this.time);u.setWithVelocity(S.sample(C-Rd).value,S.sample(C).value,Rd)}const{onStop:f}=this.options;f&&f(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return xW()&&n&&gW.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}const PW=t1(()=>window.ScrollTimeline!==void 0);class IW{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;nPW()&&i.attachTimeline?i.attachTimeline(e):r(i));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function MW({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:f,elapsed:u,...h}){return!!Object.keys(h).length}const n1=(t,e,r,n={},i,s)=>o=>{const a=Tv(n,t)||{},f=a.delay||n.delay||0;let{elapsed:u=0}=n;u=u-Ds(f);let h={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-u,onUpdate:b=>{e.set(b),a.onUpdate&&a.onUpdate(b)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:i};MW(a)||(h={...h,...Vz(t,h)}),h.duration&&(h.duration=Ds(h.duration)),h.repeatDelay&&(h.repeatDelay=Ds(h.repeatDelay)),h.from!==void 0&&(h.keyframes[0]=h.from);let g=!1;if((h.type===!1||h.duration===0&&!h.repeatDelay)&&(h.duration=0,h.delay===0&&(g=!0)),g&&!s&&e.get()!==void 0){const b=Ed(h.keyframes,a);if(b!==void 0)return Nr.update(()=>{h.onUpdate(b),h.onComplete()}),new IW([])}return!s&&H8.supports(h)?new H8(h):new e1(h)},CW=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),RW=t=>Iv(t)?t[t.length-1]||0:t;function i1(t,e){t.indexOf(e)===-1&&t.push(e)}function s1(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class o1{constructor(){this.subscriptions=[]}add(e){return i1(this.subscriptions,e),()=>s1(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class DW{constructor(e,r={}){this.version="11.11.17",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=Ns.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=Ns.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=TW(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&wd(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new o1);const n=this.events[e].add(r);return e==="change"?()=>{n(),Nr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Ns.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>W8)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,W8);return P8(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Qf(t,e){return new DW(t,e)}function OW(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,Qf(r))}function NW(t,e){const r=_d(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=RW(s[o]);OW(t,o,a)}}const a1=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),K8="data-"+a1("framerAppearId");function V8(t){return t.props[K8]}const qn=t=>!!(t&&t.getVelocity);function LW(t){return!!(qn(t)&&t.add)}function c1(t,e){const r=t.getValue("willChange");if(LW(r))return r.add(e)}function kW({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function G8(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...f}=e;n&&(o=n);const u=[],h=i&&t.animationState&&t.animationState.getState()[i];for(const g in f){const b=t.getValue(g,(s=t.latestValues[g])!==null&&s!==void 0?s:null),x=f[g];if(x===void 0||h&&kW(h,g))continue;const S={delay:r,...Tv(o||{},g)};let C=!1;if(window.MotionHandoffAnimation){const B=V8(t);if(B){const L=window.MotionHandoffAnimation(B,g,Nr);L!==null&&(S.startTime=L,C=!0)}}c1(t,g),b.start(n1(g,b,x,t.shouldReduceMotion&&ja.has(g)?{type:!1}:S,t,C));const D=b.animation;D&&u.push(D)}return a&&Promise.all(u).then(()=>{Nr.update(()=>{a&&NW(t,a)})}),u}function u1(t,e,r={}){var n;const i=_d(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(G8(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:h=0,staggerChildren:g,staggerDirection:b}=s;return BW(t,e,h+u,g,b,r)}:()=>Promise.resolve(),{when:f}=s;if(f){const[u,h]=f==="beforeChildren"?[o,a]:[a,o];return u().then(()=>h())}else return Promise.all([o(),a(r.delay)])}function BW(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,f=i===1?(u=0)=>u*n:(u=0)=>a-u*n;return Array.from(t.variantChildren).sort(FW).forEach((u,h)=>{u.notify("AnimationStart",e),o.push(u1(u,e,{...s,delay:r+f(h)}).then(()=>u.notify("AnimationComplete",e)))}),Promise.all(o)}function FW(t,e){return t.sortNodePosition(e)}function jW(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>u1(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=u1(t,e,r);else{const i=typeof e=="function"?_d(t,e,r.custom):e;n=Promise.all(G8(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const UW=Rv.length;function Y8(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?Y8(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;rPromise.all(e.map(({animation:r,options:n})=>jW(t,r,n)))}function HW(t){let e=zW(t),r=J8(),n=!0;const i=f=>(u,h)=>{var g;const b=_d(t,h,f==="exit"?(g=t.presenceContext)===null||g===void 0?void 0:g.custom:void 0);if(b){const{transition:x,transitionEnd:S,...C}=b;u={...u,...C,...S}}return u};function s(f){e=f(t)}function o(f){const{props:u}=t,h=Y8(t.parent)||{},g=[],b=new Set;let x={},S=1/0;for(let D=0;DS&&F,V=!1;const X=Array.isArray(H)?H:[H];let q=X.reduce(i(B),{});k===!1&&(q={});const{prevResolvedValues:_={}}=L,v={..._,...q},l=y=>{W=!0,b.has(y)&&(V=!0,b.delete(y)),L.needsAnimating[y]=!0;const A=t.getValue(y);A&&(A.liveStyle=!1)};for(const y in v){const A=q[y],E=_[y];if(x.hasOwnProperty(y))continue;let w=!1;Iv(A)&&Iv(E)?w=!H4(A,E):w=A!==E,w?A!=null?l(y):b.add(y):A!==void 0&&b.has(y)?l(y):L.protectedKeys[y]=!0}L.prevProp=H,L.prevResolvedValues=q,L.isActive&&(x={...x,...q}),n&&t.blockInitialAnimation&&(W=!1),W&&(!($&&R)||V)&&g.push(...X.map(y=>({animation:y,options:{type:B}})))}if(b.size){const D={};b.forEach(B=>{const L=t.getBaseTarget(B),H=t.getValue(B);H&&(H.liveStyle=!0),D[B]=L??null}),g.push({animation:D})}let C=!!g.length;return n&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(C=!1),n=!1,C?e(g):Promise.resolve()}function a(f,u){var h;if(r[f].isActive===u)return Promise.resolve();(h=t.variantChildren)===null||h===void 0||h.forEach(b=>{var x;return(x=b.animationState)===null||x===void 0?void 0:x.setActive(f,u)}),r[f].isActive=u;const g=o(f);for(const b in r)r[b].protectedKeys={};return g}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=J8(),n=!0}}}function WW(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!H4(e,t):!1}function qa(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function J8(){return{animate:qa(!0),whileInView:qa(),whileHover:qa(),whileTap:qa(),whileDrag:qa(),whileFocus:qa(),exit:qa()}}class zo{constructor(e){this.isMounted=!1,this.node=e}update(){}}class KW extends zo{constructor(e){super(e),e.animationState||(e.animationState=HW(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();xd(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let VW=0;class GW extends zo{constructor(){super(...arguments),this.id=VW++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const YW={animation:{Feature:KW},exit:{Feature:GW}},X8=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function Td(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const JW=t=>e=>X8(e)&&t(e,Td(e));function io(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function so(t,e,r,n){return io(t,e,JW(r),n)}const Z8=(t,e)=>Math.abs(t-e);function XW(t,e){const r=Z8(t.x,e.x),n=Z8(t.y,e.y);return Math.sqrt(r**2+n**2)}class Q8{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=l1(this.lastMoveEventInfo,this.history),b=this.startEvent!==null,x=XW(g.offset,{x:0,y:0})>=3;if(!b&&!x)return;const{point:S}=g,{timestamp:C}=kn;this.history.push({...S,timestamp:C});const{onStart:D,onMove:B}=this.handlers;b||(D&&D(this.lastMoveEvent,g),this.startEvent=this.lastMoveEvent),B&&B(this.lastMoveEvent,g)},this.handlePointerMove=(g,b)=>{this.lastMoveEvent=g,this.lastMoveEventInfo=f1(b,this.transformPagePoint),Nr.update(this.updatePoint,!0)},this.handlePointerUp=(g,b)=>{this.end();const{onEnd:x,onSessionEnd:S,resumeAnimation:C}=this.handlers;if(this.dragSnapToOrigin&&C&&C(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=l1(g.type==="pointercancel"?this.lastMoveEventInfo:f1(b,this.transformPagePoint),this.history);this.startEvent&&x&&x(g,D),S&&S(g,D)},!X8(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=Td(e),a=f1(o,this.transformPagePoint),{point:f}=a,{timestamp:u}=kn;this.history=[{...f,timestamp:u}];const{onSessionStart:h}=r;h&&h(e,l1(a,this.history)),this.removeListeners=no(so(this.contextWindow,"pointermove",this.handlePointerMove),so(this.contextWindow,"pointerup",this.handlePointerUp),so(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),jo(this.updatePoint)}}function f1(t,e){return e?{point:e(t.point)}:t}function eE(t,e){return{x:t.x-e.x,y:t.y-e.y}}function l1({point:t},e){return{point:t,delta:eE(t,tE(e)),offset:eE(t,ZW(e)),velocity:QW(e,.1)}}function ZW(t){return t[0]}function tE(t){return t[t.length-1]}function QW(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=tE(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>Ds(e)));)r--;if(!n)return{x:0,y:0};const s=to(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function rE(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const nE=rE("dragHorizontal"),iE=rE("dragVertical");function sE(t){let e=!1;if(t==="y")e=iE();else if(t==="x")e=nE();else{const r=nE(),n=iE();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function oE(){const t=sE(!0);return t?(t(),!1):!0}function jc(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const aE=1e-4,eK=1-aE,tK=1+aE,cE=.01,rK=0-cE,nK=0+cE;function xi(t){return t.max-t.min}function iK(t,e,r){return Math.abs(t-e)<=r}function uE(t,e,r,n=.5){t.origin=n,t.originPoint=Zr(e.min,e.max,t.origin),t.scale=xi(r)/xi(e),t.translate=Zr(r.min,r.max,t.origin)-t.originPoint,(t.scale>=eK&&t.scale<=tK||isNaN(t.scale))&&(t.scale=1),(t.translate>=rK&&t.translate<=nK||isNaN(t.translate))&&(t.translate=0)}function el(t,e,r,n){uE(t.x,e.x,r.x,n?n.originX:void 0),uE(t.y,e.y,r.y,n?n.originY:void 0)}function fE(t,e,r){t.min=r.min+e.min,t.max=t.min+xi(e)}function sK(t,e,r){fE(t.x,e.x,r.x),fE(t.y,e.y,r.y)}function lE(t,e,r){t.min=e.min-r.min,t.max=t.min+xi(e)}function tl(t,e,r){lE(t.x,e.x,r.x),lE(t.y,e.y,r.y)}function oK(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?Zr(r,t,n.max):Math.min(t,r)),t}function hE(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function aK(t,{top:e,left:r,bottom:n,right:i}){return{x:hE(t.x,r,i),y:hE(t.y,e,n)}}function dE(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=Fc(e.min,e.max-n,t.min):n>i&&(r=Fc(t.min,t.max-i,e.min)),Uo(0,1,r)}function fK(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const h1=.35;function lK(t=h1){return t===!1?t=0:t===!0&&(t=h1),{x:pE(t,"left","right"),y:pE(t,"top","bottom")}}function pE(t,e,r){return{min:gE(t,e),max:gE(t,r)}}function gE(t,e){return typeof t=="number"?t:t[e]||0}const mE=()=>({translate:0,scale:1,origin:0,originPoint:0}),Uc=()=>({x:mE(),y:mE()}),vE=()=>({min:0,max:0}),cn=()=>({x:vE(),y:vE()});function Hi(t){return[t("x"),t("y")]}function bE({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function hK({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function dK(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function d1(t){return t===void 0||t===1}function p1({scale:t,scaleX:e,scaleY:r}){return!d1(t)||!d1(e)||!d1(r)}function za(t){return p1(t)||yE(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function yE(t){return wE(t.x)||wE(t.y)}function wE(t){return t&&t!=="0%"}function Dd(t,e,r){const n=t-r,i=e*n;return r+i}function xE(t,e,r,n,i){return i!==void 0&&(t=Dd(t,i,n)),Dd(t,r,n)+e}function g1(t,e=0,r=1,n,i){t.min=xE(t.min,e,r,n,i),t.max=xE(t.max,e,r,n,i)}function _E(t,{x:e,y:r}){g1(t.x,e.translate,e.scale,e.originPoint),g1(t.y,r.translate,r.scale,r.originPoint)}const EE=.999999999999,SE=1.0000000000001;function pK(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;aEE&&(e.x=1),e.yEE&&(e.y=1)}function $c(t,e){t.min=t.min+e,t.max=t.max+e}function AE(t,e,r,n,i=.5){const s=Zr(t.min,t.max,i);g1(t,e,r,s,n)}function qc(t,e){AE(t.x,e.x,e.scaleX,e.scale,e.originX),AE(t.y,e.y,e.scaleY,e.scale,e.originY)}function PE(t,e){return bE(dK(t.getBoundingClientRect(),e))}function gK(t,e,r){const n=PE(t,r),{scroll:i}=e;return i&&($c(n.x,i.offset.x),$c(n.y,i.offset.y)),n}const IE=({current:t})=>t?t.ownerDocument.defaultView:null,mK=new WeakMap;class vK{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=cn(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=h=>{const{dragSnapToOrigin:g}=this.getProps();g?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(Td(h,"page").point)},s=(h,g)=>{const{drag:b,dragPropagation:x,onDragStart:S}=this.getProps();if(b&&!x&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=sE(b),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Hi(D=>{let B=this.getAxisMotionValue(D).get()||0;if(Os.test(B)){const{projection:L}=this.visualElement;if(L&&L.layout){const H=L.layout.layoutBox[D];H&&(B=xi(H)*(parseFloat(B)/100))}}this.originPoint[D]=B}),S&&Nr.postRender(()=>S(h,g)),c1(this.visualElement,"transform");const{animationState:C}=this.visualElement;C&&C.setActive("whileDrag",!0)},o=(h,g)=>{const{dragPropagation:b,dragDirectionLock:x,onDirectionLock:S,onDrag:C}=this.getProps();if(!b&&!this.openGlobalLock)return;const{offset:D}=g;if(x&&this.currentDirection===null){this.currentDirection=bK(D),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",g.point,D),this.updateAxis("y",g.point,D),this.visualElement.render(),C&&C(h,g)},a=(h,g)=>this.stop(h,g),f=()=>Hi(h=>{var g;return this.getAnimationState(h)==="paused"&&((g=this.getAxisMotionValue(h).animation)===null||g===void 0?void 0:g.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new Q8(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:f},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:IE(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Nr.postRender(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!Od(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=oK(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&jc(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=aK(i.layoutBox,r):this.constraints=!1,this.elastic=lK(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&Hi(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=fK(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!jc(e))return!1;const n=e.current;ro(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=gK(n,i.root,this.visualElement.getTransformPagePoint());let o=cK(i.layout.layoutBox,s);if(r){const a=r(hK(o));this.hasMutatedConstraints=!!a,a&&(o=bE(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),f=this.constraints||{},u=Hi(h=>{if(!Od(h,r,this.currentDirection))return;let g=f&&f[h]||{};o&&(g={min:0,max:0});const b=i?200:1e6,x=i?40:1e7,S={type:"inertia",velocity:n?e[h]:0,bounceStiffness:b,bounceDamping:x,timeConstant:750,restDelta:1,restSpeed:10,...s,...g};return this.startAxisValueAnimation(h,S)});return Promise.all(u).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return c1(this.visualElement,e),n.start(n1(e,n,0,r,this.visualElement,!1))}stopAnimation(){Hi(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Hi(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){Hi(r=>{const{drag:n}=this.getProps();if(!Od(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-Zr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!jc(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Hi(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const f=a.get();i[o]=uK({min:f,max:f},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),Hi(o=>{if(!Od(o,e,null))return;const a=this.getAxisMotionValue(o),{min:f,max:u}=this.constraints[o];a.set(Zr(f,u,i[o]))})}addListeners(){if(!this.visualElement.current)return;mK.set(this.visualElement,this);const e=this.visualElement.current,r=so(e,"pointerdown",f=>{const{drag:u,dragListener:h=!0}=this.getProps();u&&h&&this.start(f)}),n=()=>{const{dragConstraints:f}=this.getProps();jc(f)&&f.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Nr.read(n);const o=io(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",(({delta:f,hasLayoutChanged:u})=>{this.isDragging&&u&&(Hi(h=>{const g=this.getAxisMotionValue(h);g&&(this.originPoint[h]+=f[h].translate,g.set(g.get()+f[h].translate))}),this.visualElement.render())}));return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=h1,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function Od(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function bK(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class yK extends zo{constructor(e){super(e),this.removeGroupControls=Ln,this.removeListeners=Ln,this.controls=new vK(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ln}unmount(){this.removeGroupControls(),this.removeListeners()}}const ME=t=>(e,r)=>{t&&Nr.postRender(()=>t(e,r))};class wK extends zo{constructor(){super(...arguments),this.removePointerDownListener=Ln}onPointerDown(e){this.session=new Q8(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:IE(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:ME(e),onStart:ME(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&Nr.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=so(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Nd=Se.createContext(null);function xK(){const t=Se.useContext(Nd);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=Se.useId();Se.useEffect(()=>n(i),[]);const s=Se.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const m1=Se.createContext({}),CE=Se.createContext({}),Ld={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function RE(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const rl={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(zt.test(t))t=parseFloat(t);else return t;const r=RE(t,e.target.x),n=RE(t,e.target.y);return`${r}% ${n}%`}},_K={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=qo.parse(t);if(i.length>5)return n;const s=qo.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,f=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=f;const u=Zr(a,f,.5);return typeof i[2+o]=="number"&&(i[2+o]/=u),typeof i[3+o]=="number"&&(i[3+o]/=u),s(i)}},kd={};function EK(t){Object.assign(kd,t)}const{schedule:v1}=K4(queueMicrotask,!1);class SK extends Se.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;EK(AK),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),Ld.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Nr.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),v1.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function TE(t){const[e,r]=xK(),n=Se.useContext(m1);return he.jsx(SK,{...t,layoutGroup:n,switchLayoutGroup:Se.useContext(CE),isPresent:e,safeToRemove:r})}const AK={borderRadius:{...rl,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:rl,borderTopRightRadius:rl,borderBottomLeftRadius:rl,borderBottomRightRadius:rl,boxShadow:_K},DE=["TopLeft","TopRight","BottomLeft","BottomRight"],PK=DE.length,OE=t=>typeof t=="string"?parseFloat(t):t,NE=t=>typeof t=="number"||zt.test(t);function IK(t,e,r,n,i,s){i?(t.opacity=Zr(0,r.opacity!==void 0?r.opacity:1,MK(n)),t.opacityExit=Zr(e.opacity!==void 0?e.opacity:1,0,CK(n))):s&&(t.opacity=Zr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(Fc(t,e,n))}function BE(t,e){t.min=e.min,t.max=e.max}function Wi(t,e){BE(t.x,e.x),BE(t.y,e.y)}function FE(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function jE(t,e,r,n,i){return t-=e,t=Dd(t,1/r,n),i!==void 0&&(t=Dd(t,1/i,n)),t}function RK(t,e=0,r=1,n=.5,i,s=t,o=t){if(Os.test(e)&&(e=parseFloat(e),e=Zr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Zr(s.min,s.max,n);t===s&&(a-=e),t.min=jE(t.min,e,r,a,i),t.max=jE(t.max,e,r,a,i)}function UE(t,e,[r,n,i],s,o){RK(t,e[r],e[n],e[i],e.scale,s,o)}const TK=["x","scaleX","originX"],DK=["y","scaleY","originY"];function $E(t,e,r,n){UE(t.x,e,TK,r?r.x:void 0,n?n.x:void 0),UE(t.y,e,DK,r?r.y:void 0,n?n.y:void 0)}function qE(t){return t.translate===0&&t.scale===1}function zE(t){return qE(t.x)&&qE(t.y)}function HE(t,e){return t.min===e.min&&t.max===e.max}function OK(t,e){return HE(t.x,e.x)&&HE(t.y,e.y)}function WE(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function KE(t,e){return WE(t.x,e.x)&&WE(t.y,e.y)}function VE(t){return xi(t.x)/xi(t.y)}function GE(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class NK{constructor(){this.members=[]}add(e){i1(this.members,e),e.scheduleRender()}remove(e){if(s1(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function LK(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=r?.z||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:u,rotate:h,rotateX:g,rotateY:b,skewX:x,skewY:S}=r;u&&(n=`perspective(${u}px) ${n}`),h&&(n+=`rotate(${h}deg) `),g&&(n+=`rotateX(${g}deg) `),b&&(n+=`rotateY(${b}deg) `),x&&(n+=`skewX(${x}deg) `),S&&(n+=`skewY(${S}deg) `)}const a=t.x.scale*e.x,f=t.y.scale*e.y;return(a!==1||f!==1)&&(n+=`scale(${a}, ${f})`),n||"none"}const kK=(t,e)=>t.depth-e.depth;class BK{constructor(){this.children=[],this.isDirty=!1}add(e){i1(this.children,e),this.isDirty=!0}remove(e){s1(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(kK),this.isDirty=!1,this.children.forEach(e)}}function Bd(t){const e=qn(t)?t.get():t;return CW(e)?e.toValue():e}function FK(t,e){const r=Ns.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(jo(n),t(s-e))};return Nr.read(n,!0),()=>jo(n)}function jK(t){return t instanceof SVGElement&&t.tagName!=="svg"}function UK(t,e,r){const n=qn(t)?t:Qf(t);return n.start(n1("",n,e,r)),n.animation}const Ha={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},nl=typeof window<"u"&&window.MotionDebug!==void 0,b1=["","X","Y","Z"],$K={visibility:"hidden"},YE=1e3;let qK=0;function y1(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function JE(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=V8(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Nr,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&JE(n)}function XE({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e?.()){this.id=qK++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,nl&&(Ha.totalNodes=Ha.resolvedTargetDeltas=Ha.recalculatedProjection=0),this.nodes.forEach(WK),this.nodes.forEach(JK),this.nodes.forEach(XK),this.nodes.forEach(KK),nl&&window.MotionDebug.record(Ha)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let f=0;fthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,g&&g(),g=FK(b,250),Ld.hasAnimatedSinceResize&&(Ld.hasAnimatedSinceResize=!1,this.nodes.forEach(QE))})}f&&this.root.registerSharedNode(f,this),this.options.animate!==!1&&h&&(f||u)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:b,hasRelativeTargetChanged:x,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const C=this.options.transition||h.getDefaultTransition()||rV,{onLayoutAnimationStart:D,onLayoutAnimationComplete:B}=h.getProps(),L=!this.targetLayout||!KE(this.targetLayout,S)||x,H=!b&&x;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||H||b&&(L||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(g,H);const F={...Tv(C,"layout"),onPlay:D,onComplete:B};(h.shouldReduceMotion||this.options.layoutRoot)&&(F.delay=0,F.type=!1),this.startAnimation(F)}else b||QE(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,jo(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(ZK),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&JE(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let h=0;h{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let f=0;f{const k=F/1e3;eS(g.x,o.x,k),eS(g.y,o.y,k),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(tl(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox),eV(this.relativeTarget,this.relativeTargetOrigin,b,k),H&&OK(this.relativeTarget,H)&&(this.isProjectionDirty=!1),H||(H=cn()),Wi(H,this.relativeTarget)),C&&(this.animationValues=h,IK(h,u,this.latestValues,k,L,B)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=k},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(jo(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nr.update(()=>{Ld.hasAnimatedSinceResize=!0,this.currentAnimation=UK(0,YE,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(YE),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:f,layout:u,latestValues:h}=o;if(!(!a||!f||!u)){if(this!==o&&this.layout&&u&&sS(this.options.animationType,this.layout.layoutBox,u.layoutBox)){f=this.target||cn();const g=xi(this.layout.layoutBox.x);f.x.min=o.target.x.min,f.x.max=f.x.min+g;const b=xi(this.layout.layoutBox.y);f.y.min=o.target.y.min,f.y.max=f.y.min+b}Wi(a,f),qc(a,h),el(this.projectionDeltaWithTransform,this.layoutCorrected,a,h)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new NK),this.sharedNodes.get(o).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:f}={}){const u=this.getStack();u&&u.promote(this,f),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:f}=o;if((f.z||f.rotate||f.rotateX||f.rotateY||f.rotateZ||f.skewX||f.skewY)&&(a=!0),!a)return;const u={};f.z&&y1("z",o,u,this.animationValues);for(let h=0;h{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(ZE),this.root.sharedNodes.clear()}}}function zK(t){t.updateLayout()}function HK(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?Hi(g=>{const b=o?r.measuredBox[g]:r.layoutBox[g],x=xi(b);b.min=n[g].min,b.max=b.min+x}):sS(s,r.layoutBox,n)&&Hi(g=>{const b=o?r.measuredBox[g]:r.layoutBox[g],x=xi(n[g]);b.max=b.min+x,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[g].max=t.relativeTarget[g].min+x)});const a=Uc();el(a,n,r.layoutBox);const f=Uc();o?el(f,t.applyTransform(i,!0),r.measuredBox):el(f,n,r.layoutBox);const u=!zE(a);let h=!1;if(!t.resumeFrom){const g=t.getClosestProjectingParent();if(g&&!g.resumeFrom){const{snapshot:b,layout:x}=g;if(b&&x){const S=cn();tl(S,r.layoutBox,b.layoutBox);const C=cn();tl(C,n,x.layoutBox),KE(S,C)||(h=!0),g.options.layoutRoot&&(t.relativeTarget=C,t.relativeTargetOrigin=S,t.relativeParent=g)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:f,layoutDelta:a,hasLayoutChanged:u,hasRelativeTargetChanged:h})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function WK(t){nl&&Ha.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function KK(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function VK(t){t.clearSnapshot()}function ZE(t){t.clearMeasurements()}function GK(t){t.isLayoutDirty=!1}function YK(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function QE(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function JK(t){t.resolveTargetDelta()}function XK(t){t.calcProjection()}function ZK(t){t.resetSkewAndRotation()}function QK(t){t.removeLeadSnapshot()}function eS(t,e,r){t.translate=Zr(e.translate,0,r),t.scale=Zr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function tS(t,e,r,n){t.min=Zr(e.min,r.min,n),t.max=Zr(e.max,r.max,n)}function eV(t,e,r,n){tS(t.x,e.x,r.x,n),tS(t.y,e.y,r.y,n)}function tV(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const rV={duration:.45,ease:[.4,0,.1,1]},rS=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),nS=rS("applewebkit/")&&!rS("chrome/")?Math.round:Ln;function iS(t){t.min=nS(t.min),t.max=nS(t.max)}function nV(t){iS(t.x),iS(t.y)}function sS(t,e,r){return t==="position"||t==="preserve-aspect"&&!iK(VE(e),VE(r),.2)}function iV(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const sV=XE({attachResizeListener:(t,e)=>io(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),w1={current:void 0},oS=XE({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!w1.current){const t=new sV({});t.mount(window),t.setOptions({layoutScroll:!0}),w1.current=t}return w1.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),oV={pan:{Feature:wK},drag:{Feature:yK,ProjectionNode:oS,MeasureLayout:TE}};function aS(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||oE())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const f=a[n];f&&Nr.postRender(()=>f(s,o))};return so(t.current,r,i,{passive:!t.getProps()[n]})}class aV extends zo{mount(){this.unmount=no(aS(this.node,!0),aS(this.node,!1))}unmount(){}}class cV extends zo{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=no(io(this.node.current,"focus",()=>this.onFocus()),io(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const cS=(t,e)=>e?t===e?!0:cS(t,e.parentElement):!1;function x1(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,Td(r))}class uV extends zo{constructor(){super(...arguments),this.removeStartListeners=Ln,this.removeEndListeners=Ln,this.removeAccessibleListeners=Ln,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=so(window,"pointerup",(a,f)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:h,globalTapTarget:g}=this.node.getProps(),b=!g&&!cS(this.node.current,a.target)?h:u;b&&Nr.update(()=>b(a,f))},{passive:!(n.onTap||n.onPointerUp)}),o=so(window,"pointercancel",(a,f)=>this.cancelPress(a,f),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=no(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||x1("up",(f,u)=>{const{onTap:h}=this.node.getProps();h&&Nr.postRender(()=>h(f,u))})};this.removeEndListeners(),this.removeEndListeners=io(this.node.current,"keyup",o),x1("down",(a,f)=>{this.startPress(a,f)})},r=io(this.node.current,"keydown",e),n=()=>{this.isPressing&&x1("cancel",(s,o)=>this.cancelPress(s,o))},i=io(this.node.current,"blur",n);this.removeAccessibleListeners=no(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Nr.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!oE()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Nr.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=so(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=io(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=no(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const _1=new WeakMap,E1=new WeakMap,fV=t=>{const e=_1.get(t.target);e&&e(t)},lV=t=>{t.forEach(fV)};function hV({root:t,...e}){const r=t||document;E1.has(r)||E1.set(r,{});const n=E1.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(lV,{root:t,...e})),n[i]}function dV(t,e,r){const n=hV(e);return _1.set(t,r),n.observe(t),()=>{_1.delete(t),n.unobserve(t)}}const pV={some:0,all:1};class gV extends zo{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:pV[i]},a=f=>{const{isIntersecting:u}=f;if(this.isInView===u||(this.isInView=u,s&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:h,onViewportLeave:g}=this.node.getProps(),b=u?h:g;b&&b(f)};return dV(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(mV(e,r))&&this.startObserver()}unmount(){}}function mV({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const vV={inView:{Feature:gV},tap:{Feature:uV},focus:{Feature:cV},hover:{Feature:aV}},bV={layout:{ProjectionNode:oS,MeasureLayout:TE}},S1=Se.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Fd=Se.createContext({}),A1=typeof window<"u",uS=A1?Se.useLayoutEffect:Se.useEffect,fS=Se.createContext({strict:!1});function yV(t,e,r,n,i){var s,o;const{visualElement:a}=Se.useContext(Fd),f=Se.useContext(fS),u=Se.useContext(Nd),h=Se.useContext(S1).reducedMotion,g=Se.useRef();n=n||f.renderer,!g.current&&n&&(g.current=n(t,{visualState:e,parent:a,props:r,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:h}));const b=g.current,x=Se.useContext(CE);b&&!b.projection&&i&&(b.type==="html"||b.type==="svg")&&wV(g.current,r,i,x);const S=Se.useRef(!1);Se.useInsertionEffect(()=>{b&&S.current&&b.update(r,u)});const C=r[K8],D=Se.useRef(!!C&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,C))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,C)));return uS(()=>{b&&(S.current=!0,window.MotionIsMounted=!0,b.updateFeatures(),v1.render(b.render),D.current&&b.animationState&&b.animationState.animateChanges())}),Se.useEffect(()=>{b&&(!D.current&&b.animationState&&b.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{var B;(B=window.MotionHandoffMarkAsComplete)===null||B===void 0||B.call(window,C)}),D.current=!1))}),b}function wV(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:f,layoutRoot:u}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:lS(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&jc(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:f,layoutRoot:u})}function lS(t){if(t)return t.options.allowProjection!==!1?t.projection:lS(t.parent)}function xV(t,e,r){return Se.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):jc(r)&&(r.current=n))},[e])}function jd(t){return xd(t.animate)||Rv.some(e=>Wf(t[e]))}function hS(t){return!!(jd(t)||t.variants)}function _V(t,e){if(jd(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Wf(r)?r:void 0,animate:Wf(n)?n:void 0}}return t.inherit!==!1?e:{}}function EV(t){const{initial:e,animate:r}=_V(t,Se.useContext(Fd));return Se.useMemo(()=>({initial:e,animate:r}),[dS(e),dS(r)])}function dS(t){return Array.isArray(t)?t.join(" "):t}const pS={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},zc={};for(const t in pS)zc[t]={isEnabled:e=>pS[t].some(r=>!!e[r])};function SV(t){for(const e in t)zc[e]={...zc[e],...t[e]}}const AV=Symbol.for("motionComponentSymbol");function PV({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&SV(t);function s(a,f){let u;const h={...Se.useContext(S1),...a,layoutId:IV(a)},{isStatic:g}=h,b=EV(a),x=n(a,g);if(!g&&A1){MV(h,t);const S=CV(h);u=S.MeasureLayout,b.visualElement=yV(i,x,h,e,S.ProjectionNode)}return he.jsxs(Fd.Provider,{value:b,children:[u&&b.visualElement?he.jsx(u,{visualElement:b.visualElement,...h}):null,r(i,a,xV(x,b.visualElement,f),x,g,b.visualElement)]})}const o=Se.forwardRef(s);return o[AV]=i,o}function IV({layoutId:t}){const e=Se.useContext(m1).id;return e&&t!==void 0?e+"-"+t:t}function MV(t,e){const r=Se.useContext(fS).strict;if(process.env.NODE_ENV!=="production"&&e&&r){const n="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?Nc(!1,n):ro(!1,n)}}function CV(t){const{drag:e,layout:r}=zc;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e?.isEnabled(t)||r?.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const RV=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function P1(t){return typeof t!="string"||t.includes("-")?!1:!!(RV.indexOf(t)>-1||/[A-Z]/u.test(t))}function gS(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const mS=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function vS(t,e,r,n){gS(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(mS.has(i)?i:a1(i),e.attrs[i])}function bS(t,{layout:e,layoutId:r}){return ja.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!kd[t]||t==="opacity")}function I1(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(qn(i[o])||e.style&&qn(e.style[o])||bS(o,t)||((n=r?.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function yS(t,e,r){const n=I1(t,e,r);for(const i in t)if(qn(t[i])||qn(e[i])){const s=Kf.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function M1(t){const e=Se.useRef(null);return e.current===null&&(e.current=t()),e.current}function TV({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:DV(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const wS=t=>(e,r)=>{const n=Se.useContext(Fd),i=Se.useContext(Nd),s=()=>TV(t,e,n,i);return r?s():M1(s)};function DV(t,e,r,n){const i={},s=n(t,{});for(const b in s)i[b]=Bd(s[b]);let{initial:o,animate:a}=t;const f=jd(t),u=hS(t);e&&u&&!f&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let h=r?r.initial===!1:!1;h=h||o===!1;const g=h?a:o;if(g&&typeof g!="boolean"&&!xd(g)){const b=Array.isArray(g)?g:[g];for(let x=0;x({style:{},transform:{},transformOrigin:{},vars:{}}),xS=()=>({...C1(),attrs:{}}),_S=(t,e)=>e&&typeof t=="number"?e.transform(t):t,OV={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},NV=Kf.length;function LV(t,e,r){let n="",i=!0;for(let s=0;stypeof t=="string"&&t.toLowerCase()==="svg",UV={useVisualState:wS({scrapeMotionValuesFromProps:yS,createRenderState:xS,onMount:(t,e,{renderState:r,latestValues:n})=>{Nr.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),Nr.render(()=>{T1(r,n,D1(e.tagName),t.transformTemplate),vS(e,r)})}})},$V={useVisualState:wS({scrapeMotionValuesFromProps:I1,createRenderState:C1})};function SS(t,e,r){for(const n in e)!qn(e[n])&&!bS(n,r)&&(t[n]=e[n])}function qV({transformTemplate:t},e){return Se.useMemo(()=>{const r=C1();return R1(r,e,t),Object.assign({},r.vars,r.style)},[e])}function zV(t,e){const r=t.style||{},n={};return SS(n,r,t),Object.assign(n,qV(t,e)),n}function HV(t,e){const r={},n=zV(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const WV=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Ud(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||WV.has(t)}let AS=t=>!Ud(t);function KV(t){t&&(AS=e=>e.startsWith("on")?!Ud(e):t(e))}try{KV(require("@emotion/is-prop-valid").default)}catch{}function VV(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(AS(i)||r===!0&&Ud(i)||!e&&!Ud(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function GV(t,e,r,n){const i=Se.useMemo(()=>{const s=xS();return T1(s,e,D1(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};SS(s,t.style,t),i.style={...s,...i.style}}return i}function YV(t=!1){return(r,n,i,{latestValues:s},o)=>{const f=(P1(r)?GV:HV)(n,s,o,r),u=VV(n,typeof r=="string",t),h=r!==Se.Fragment?{...u,...f,ref:i}:{},{children:g}=n,b=Se.useMemo(()=>qn(g)?g.get():g,[g]);return Se.createElement(r,{...h,children:b})}}function JV(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...P1(n)?UV:$V,preloadedFeatures:t,useRender:YV(i),createVisualElement:e,Component:n};return PV(o)}}const O1={current:null},PS={current:!1};function XV(){if(PS.current=!0,!!A1)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>O1.current=t.matches;t.addListener(e),e()}else O1.current=!1}function ZV(t,e,r){for(const n in e){const i=e[n],s=r[n];if(qn(i))t.addValue(n,i),process.env.NODE_ENV==="development"&&wd(i.version==="11.11.17",`Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`);else if(qn(s))t.addValue(n,Qf(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,Qf(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const IS=new WeakMap,QV=[...l8,$n,qo],eG=t=>QV.find(f8(t)),MS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class tG{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Fv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const b=Ns.now();this.renderScheduledAtthis.bindToMotionValue(n,r)),PS.current||XV(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:O1.current,process.env.NODE_ENV!=="production"&&wd(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){IS.delete(this.current),this.projection&&this.projection.unmount(),jo(this.notifyUpdate),jo(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=ja.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Nr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in zc){const r=zc[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):cn()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=Qf(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(r8(i)||t8(i))?i=parseFloat(i):!eG(i)&&qo.test(r)&&(i=_8(e,r)),this.setBaseTarget(e,qn(i)?i.get():i)),qn(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=Mv(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!qn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new o1),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class CS extends tG{constructor(){super(...arguments),this.KeyframeResolver=E8}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function rG(t){return window.getComputedStyle(t)}class nG extends CS{constructor(){super(...arguments),this.type="html",this.renderInstance=gS}readValueFromInstance(e,r){if(ja.has(r)){const n=Wv(r);return n&&n.default||0}else{const n=rG(e),i=(i8(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return PE(e,r)}build(e,r,n){R1(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return I1(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;qn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class iG extends CS{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=cn}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(ja.has(r)){const n=Wv(r);return n&&n.default||0}return r=mS.has(r)?r:a1(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return yS(e,r,n)}build(e,r,n){T1(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){vS(e,r,n,i)}mount(e){this.isSVGTag=D1(e.tagName),super.mount(e)}}const sG=(t,e)=>P1(t)?new iG(e):new nG(e,{allowProjection:t!==Se.Fragment}),oG=JV({...YW,...vV,...oV,...bV},sG),aG=qz(oG);class cG extends Yt.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function uG({children:t,isPresent:e}){const r=Se.useId(),n=Se.useRef(null),i=Se.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=Se.useContext(S1);return Se.useInsertionEffect(()=>{const{width:o,height:a,top:f,left:u}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const h=document.createElement("style");return s&&(h.nonce=s),document.head.appendChild(h),h.sheet&&h.sheet.insertRule(` [data-motion-pop-id="${r}"] { position: absolute !important; width: ${o}px !important; height: ${a}px !important; - top: ${u}px !important; - left: ${l}px !important; + top: ${f}px !important; + left: ${u}px !important; } - `),()=>{document.head.removeChild(d)}},[e]),le.jsx($X,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const jX=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=Mb(UX),u=Ee.useId(),l=Ee.useCallback(p=>{a.set(p,!0);for(const y of a.values())if(!y)return;n&&n()},[a,n]),d=Ee.useMemo(()=>({id:u,initial:e,isPresent:r,custom:i,onExitComplete:l,register:p=>(a.set(p,!1),()=>a.delete(p))}),s?[Math.random(),l]:[r,l]);return Ee.useMemo(()=>{a.forEach((p,y)=>a.set(y,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=le.jsx(FX,{isPresent:r,children:t})),le.jsx(X0.Provider,{value:d,children:t})};function UX(){return new Map}const ip=t=>t.key||"";function I7(t){const e=[];return Ee.Children.forEach(t,r=>{Ee.isValidElement(r)&&e.push(r)}),e}const qX=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{Oo(!e,"Replace exitBeforeEnter with mode='wait'");const a=Ee.useMemo(()=>I7(t),[t]),u=a.map(ip),l=Ee.useRef(!0),d=Ee.useRef(a),p=Mb(()=>new Map),[y,_]=Ee.useState(a),[M,O]=Ee.useState(a);a7(()=>{l.current=!1,d.current=a;for(let k=0;k1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:B}=Ee.useContext(gb);return le.jsx(le.Fragment,{children:M.map(k=>{const H=ip(k),U=a===M||u.includes(H),z=()=>{if(p.has(H))p.set(H,!0);else return;let Z=!0;p.forEach(R=>{R||(Z=!1)}),Z&&(B==null||B(),O(d.current),i&&i())};return le.jsx(jX,{isPresent:U,initial:!l.current||n?void 0:!1,custom:U?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:U?void 0:z,children:k},H)})})},Ms=t=>le.jsx(qX,{children:le.jsx(BX.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function Ob(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return le.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,le.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[le.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),le.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:le.jsx(lV,{})})]})]})}function zX(t){return t.lastUsed?le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[le.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[le.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function C7(t){var o,a;const{wallet:e,onClick:r}=t,n=le.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:(o=e.config)==null?void 0:o.image}),i=((a=e.config)==null?void 0:a.name)||"",s=Ee.useMemo(()=>zX(e),[e]);return le.jsx(Ob,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function T7(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=GX(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(Nb);return a[0]===""&&a.length!==1&&a.shift(),R7(a,e)||VX(o)},getConflictingClassGroupIds:(o,a)=>{const u=r[o]||[];return a&&n[o]?[...u,...n[o]]:u}}},R7=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?R7(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Nb);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},D7=/^\[(.+)\]$/,VX=t=>{if(D7.test(t)){const e=D7.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},GX=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return JX(Object.entries(t.classGroups),r).forEach(([s,o])=>{Lb(o,n,s,e)}),n},Lb=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:O7(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(YX(i)){Lb(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{Lb(o,O7(e,s),r,n)})})},O7=(t,e)=>{let r=t;return e.split(Nb).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},YX=t=>t.isThemeGetter,JX=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,XX=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},N7="!",ZX=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let l=0,d=0,p;for(let L=0;Ld?p-d:void 0;return{modifiers:u,hasImportantModifier:_,baseClassName:M,maybePostfixModifierPosition:O}};return r?a=>r({className:a,parseClassName:o}):o},QX=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},eZ=t=>({cache:XX(t.cacheSize),parseClassName:ZX(t),...KX(t)}),tZ=/\s+/,rZ=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(tZ);let a="";for(let u=o.length-1;u>=0;u-=1){const l=o[u],{modifiers:d,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:_}=r(l);let M=!!_,O=n(M?y.substring(0,_):y);if(!O){if(!M){a=l+(a.length>0?" "+a:a);continue}if(O=n(y),!O){a=l+(a.length>0?" "+a:a);continue}M=!1}const L=QX(d).join(":"),B=p?L+N7:L,k=B+O;if(s.includes(k))continue;s.push(k);const H=i(O,M);for(let U=0;U0?" "+a:a)}return a};function nZ(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;np(d),t());return r=eZ(l),n=r.cache.get,i=r.cache.set,s=a,a(u)}function a(u){const l=n(u);if(l)return l;const d=rZ(u,r);return i(u,d),d}return function(){return s(nZ.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},k7=/^\[(?:([a-z-]+):)?(.+)\]$/i,sZ=/^\d+\/\d+$/,oZ=new Set(["px","full","screen"]),aZ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,cZ=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,uZ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,fZ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,lZ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bo=t=>Ku(t)||oZ.has(t)||sZ.test(t),Ma=t=>Vu(t,"length",yZ),Ku=t=>!!t&&!Number.isNaN(Number(t)),kb=t=>Vu(t,"number",Ku),uh=t=>!!t&&Number.isInteger(Number(t)),hZ=t=>t.endsWith("%")&&Ku(t.slice(0,-1)),cr=t=>k7.test(t),Ia=t=>aZ.test(t),dZ=new Set(["length","size","percentage"]),pZ=t=>Vu(t,dZ,B7),gZ=t=>Vu(t,"position",B7),mZ=new Set(["image","url"]),vZ=t=>Vu(t,mZ,xZ),bZ=t=>Vu(t,"",wZ),fh=()=>!0,Vu=(t,e,r)=>{const n=k7.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},yZ=t=>cZ.test(t)&&!uZ.test(t),B7=()=>!1,wZ=t=>fZ.test(t),xZ=t=>lZ.test(t),_Z=iZ(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),u=Gr("contrast"),l=Gr("grayscale"),d=Gr("hueRotate"),p=Gr("invert"),y=Gr("gap"),_=Gr("gradientColorStops"),M=Gr("gradientColorStopPositions"),O=Gr("inset"),L=Gr("margin"),B=Gr("opacity"),k=Gr("padding"),H=Gr("saturate"),U=Gr("scale"),z=Gr("sepia"),Z=Gr("skew"),R=Gr("space"),W=Gr("translate"),ie=()=>["auto","contain","none"],me=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",cr,e],E=()=>[cr,e],m=()=>["",Bo,Ma],f=()=>["auto",Ku,cr],g=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v=()=>["solid","dashed","dotted","double","none"],x=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],S=()=>["start","end","center","between","around","evenly","stretch"],A=()=>["","0",cr],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>[Ku,cr];return{cacheSize:500,separator:":",theme:{colors:[fh],spacing:[Bo,Ma],blur:["none","",Ia,cr],brightness:P(),borderColor:[t],borderRadius:["none","","full",Ia,cr],borderSpacing:E(),borderWidth:m(),contrast:P(),grayscale:A(),hueRotate:P(),invert:A(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[hZ,Ma],inset:j(),margin:j(),opacity:P(),padding:E(),saturate:P(),scale:P(),sepia:A(),skew:P(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Ia]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...g(),cr]}],overflow:[{overflow:me()}],"overflow-x":[{"overflow-x":me()}],"overflow-y":[{"overflow-y":me()}],overscroll:[{overscroll:ie()}],"overscroll-x":[{"overscroll-x":ie()}],"overscroll-y":[{"overscroll-y":ie()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[O]}],"inset-x":[{"inset-x":[O]}],"inset-y":[{"inset-y":[O]}],start:[{start:[O]}],end:[{end:[O]}],top:[{top:[O]}],right:[{right:[O]}],bottom:[{bottom:[O]}],left:[{left:[O]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",uh,cr]}],basis:[{basis:j()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:A()}],shrink:[{shrink:A()}],order:[{order:["first","last","none",uh,cr]}],"grid-cols":[{"grid-cols":[fh]}],"col-start-end":[{col:["auto",{span:["full",uh,cr]},cr]}],"col-start":[{"col-start":f()}],"col-end":[{"col-end":f()}],"grid-rows":[{"grid-rows":[fh]}],"row-start-end":[{row:["auto",{span:[uh,cr]},cr]}],"row-start":[{"row-start":f()}],"row-end":[{"row-end":f()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",...S()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...S(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...S(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[k]}],px:[{px:[k]}],py:[{py:[k]}],ps:[{ps:[k]}],pe:[{pe:[k]}],pt:[{pt:[k]}],pr:[{pr:[k]}],pb:[{pb:[k]}],pl:[{pl:[k]}],m:[{m:[L]}],mx:[{mx:[L]}],my:[{my:[L]}],ms:[{ms:[L]}],me:[{me:[L]}],mt:[{mt:[L]}],mr:[{mr:[L]}],mb:[{mb:[L]}],ml:[{ml:[L]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Ia]},Ia]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Ia,Ma]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",kb]}],"font-family":[{font:[fh]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Ku,kb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Bo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[B]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[B]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Bo,Ma]}],"underline-offset":[{"underline-offset":["auto",Bo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[B]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...g(),gZ]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",pZ]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},vZ]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[M]}],"gradient-via-pos":[{via:[M]}],"gradient-to-pos":[{to:[M]}],"gradient-from":[{from:[_]}],"gradient-via":[{via:[_]}],"gradient-to":[{to:[_]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[B]}],"border-style":[{border:[...v(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[B]}],"divide-style":[{divide:v()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...v()]}],"outline-offset":[{"outline-offset":[Bo,cr]}],"outline-w":[{outline:[Bo,Ma]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:m()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[B]}],"ring-offset-w":[{"ring-offset":[Bo,Ma]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Ia,bZ]}],"shadow-color":[{shadow:[fh]}],opacity:[{opacity:[B]}],"mix-blend":[{"mix-blend":[...x(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":x()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Ia,cr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[p]}],saturate:[{saturate:[H]}],sepia:[{sepia:[z]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[B]}],"backdrop-saturate":[{"backdrop-saturate":[H]}],"backdrop-sepia":[{"backdrop-sepia":[z]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:P()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:P()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[U]}],"scale-x":[{"scale-x":[U]}],"scale-y":[{"scale-y":[U]}],rotate:[{rotate:[uh,cr]}],"translate-x":[{"translate-x":[W]}],"translate-y":[{"translate-y":[W]}],"skew-x":[{"skew-x":[Z]}],"skew-y":[{"skew-y":[Z]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Bo,Ma,kb]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function $o(...t){return _Z(WX(t))}function $7(t){const{className:e}=t;return le.jsxs("div",{className:$o("xc-flex xc-items-center xc-gap-2"),children:[le.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)}),le.jsx("div",{className:"xc-shrink-0",children:t.children}),le.jsx("hr",{className:$o("xc-flex-1 xc-border-gray-200",e)})]})}function EZ(t){var n,i;const{wallet:e,onClick:r}=t;return le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[le.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(n=e.config)==null?void 0:n.image,alt:""}),le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsxs("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:["Connect to ",(i=e.config)==null?void 0:i.name]}),le.jsx("div",{className:"xc-flex xc-gap-2",children:le.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:()=>r(e),children:"Connect"})})]})]})}const SZ="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function AZ(t){const{onClick:e}=t;function r(){e&&e()}return le.jsx($7,{className:"xc-opacity-20",children:le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[le.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),le.jsx($8,{size:16})]})})}function F7(t){const[e,r]=Ee.useState(""),{featuredWallets:n,initialized:i}=Yl(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:u,config:l}=t,d=Ee.useMemo(()=>{const O=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,L=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!O.test(e)&&L.test(e)},[e]);function p(O){o(O)}function y(O){r(O.target.value)}async function _(){s(e)}function M(O){O.key==="Enter"&&d&&_()}return le.jsx(Ms,{children:i&&le.jsxs(le.Fragment,{children:[t.header||le.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),n.length===1&&le.jsx("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:n.map(O=>le.jsx(EZ,{wallet:O,onClick:p},`feature-${O.key}`))}),n.length>1&&le.jsxs(le.Fragment,{children:[le.jsxs("div",{children:[le.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[l.showFeaturedWallets&&n&&n.map(O=>le.jsx(C7,{wallet:O,onClick:p},`feature-${O.key}`)),l.showTonConnect&&le.jsx(Ob,{icon:le.jsx("img",{className:"xc-h-5 xc-w-5",src:SZ}),title:"TON Connect",onClick:u})]}),l.showMoreWallets&&le.jsx(AZ,{onClick:a})]}),l.showEmailSignIn&&(l.showFeaturedWallets||l.showTonConnect)&&le.jsx("div",{className:"xc-mb-4 xc-mt-4",children:le.jsxs($7,{className:"xc-opacity-20",children:[" ",le.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),l.showEmailSignIn&&le.jsxs("div",{className:"xc-mb-4",children:[le.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:y,onKeyDown:M}),le.jsx("button",{disabled:!d,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:_,children:"Continue"})]})]})]})})}function Rc(t){const{title:e}=t;return le.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[le.jsx(fV,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),le.jsx("span",{children:e})]})}const j7=Ee.createContext({channel:"",device:"WEB",app:"",inviterCode:"",role:"C"});function Bb(){return Ee.useContext(j7)}function PZ(t){const{config:e}=t,[r,n]=Ee.useState(e.channel),[i,s]=Ee.useState(e.device),[o,a]=Ee.useState(e.app),[u,l]=Ee.useState(e.role||"C"),[d,p]=Ee.useState(e.inviterCode);return Ee.useEffect(()=>{n(e.channel),s(e.device),a(e.app),p(e.inviterCode),l(e.role||"C")},[e]),le.jsx(j7.Provider,{value:{channel:r,device:i,app:o,inviterCode:d,role:u},children:t.children})}var MZ=Object.defineProperty,IZ=Object.defineProperties,CZ=Object.getOwnPropertyDescriptors,sp=Object.getOwnPropertySymbols,U7=Object.prototype.hasOwnProperty,q7=Object.prototype.propertyIsEnumerable,z7=(t,e,r)=>e in t?MZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,TZ=(t,e)=>{for(var r in e||(e={}))U7.call(e,r)&&z7(t,r,e[r]);if(sp)for(var r of sp(e))q7.call(e,r)&&z7(t,r,e[r]);return t},RZ=(t,e)=>IZ(t,CZ(e)),DZ=(t,e)=>{var r={};for(var n in t)U7.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&sp)for(var n of sp(t))e.indexOf(n)<0&&q7.call(t,n)&&(r[n]=t[n]);return r};function OZ(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function NZ(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var LZ=18,H7=40,kZ=`${H7}px`,BZ=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function $Z({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[u,l]=Yt.useState(!1),d=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),p=Yt.useCallback(()=>{let y=t.current,_=e.current;if(!y||!_||u||r==="none")return;let M=y,O=M.getBoundingClientRect().left+M.offsetWidth,L=M.getBoundingClientRect().top+M.offsetHeight/2,B=O-LZ,k=L;document.querySelectorAll(BZ).length===0&&document.elementFromPoint(B,k)===y||(s(!0),l(!0))},[t,e,u,r]);return Yt.useEffect(()=>{let y=t.current;if(!y||r==="none")return;function _(){let O=window.innerWidth-y.getBoundingClientRect().right;a(O>=H7)}_();let M=setInterval(_,1e3);return()=>{clearInterval(M)}},[t,r]),Yt.useEffect(()=>{let y=n||document.activeElement===e.current;if(r==="none"||!y)return;let _=setTimeout(p,0),M=setTimeout(p,2e3),O=setTimeout(p,5e3),L=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(_),clearTimeout(M),clearTimeout(O),clearTimeout(L)}},[e,n,r,p]),{hasPWMBadge:i,willPushPWMBadge:d,PWM_BADGE_SPACE_WIDTH:kZ}}var W7=Yt.createContext({}),K7=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:u,inputMode:l="numeric",onComplete:d,pushPasswordManagerStrategy:p="increase-width",pasteTransformer:y,containerClassName:_,noScriptCSSFallback:M=FZ,render:O,children:L}=r,B=DZ(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),k,H,U,z,Z;let[R,W]=Yt.useState(typeof B.defaultValue=="string"?B.defaultValue:""),ie=n??R,me=NZ(ie),j=Yt.useCallback(oe=>{i==null||i(oe),W(oe)},[i]),E=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),m=Yt.useRef(null),f=Yt.useRef(null),g=Yt.useRef({value:ie,onChange:j,isIOS:typeof window<"u"&&((H=(k=window==null?void 0:window.CSS)==null?void 0:k.supports)==null?void 0:H.call(k,"-webkit-touch-callout","none"))}),v=Yt.useRef({prev:[(U=m.current)==null?void 0:U.selectionStart,(z=m.current)==null?void 0:z.selectionEnd,(Z=m.current)==null?void 0:Z.selectionDirection]});Yt.useImperativeHandle(e,()=>m.current,[]),Yt.useEffect(()=>{let oe=m.current,fe=f.current;if(!oe||!fe)return;g.current.value!==oe.value&&g.current.onChange(oe.value),v.current.prev=[oe.selectionStart,oe.selectionEnd,oe.selectionDirection];function be(){if(document.activeElement!==oe){I(null),ce(null);return}let Te=oe.selectionStart,$e=oe.selectionEnd,Ie=oe.selectionDirection,Le=oe.maxLength,Ve=oe.value,ke=v.current.prev,ze=-1,He=-1,Se;if(Ve.length!==0&&Te!==null&&$e!==null){let et=Te===$e,rt=Te===Ve.length&&Ve.length1&&Ve.length>1){let gt=0;if(ke[0]!==null&&ke[1]!==null){Se=Je{fe&&fe.style.setProperty("--root-height",`${oe.clientHeight}px`)};Me();let Ne=new ResizeObserver(Me);return Ne.observe(oe),()=>{document.removeEventListener("selectionchange",be,{capture:!0}),Ne.disconnect()}},[]);let[x,S]=Yt.useState(!1),[A,b]=Yt.useState(!1),[P,I]=Yt.useState(null),[F,ce]=Yt.useState(null);Yt.useEffect(()=>{OZ(()=>{var oe,fe,be,Me;(oe=m.current)==null||oe.dispatchEvent(new Event("input"));let Ne=(fe=m.current)==null?void 0:fe.selectionStart,Te=(be=m.current)==null?void 0:be.selectionEnd,$e=(Me=m.current)==null?void 0:Me.selectionDirection;Ne!==null&&Te!==null&&(I(Ne),ce(Te),v.current.prev=[Ne,Te,$e])})},[ie,A]),Yt.useEffect(()=>{me!==void 0&&ie!==me&&me.length{let fe=oe.currentTarget.value.slice(0,s);if(fe.length>0&&E&&!E.test(fe)){oe.preventDefault();return}typeof me=="string"&&fe.length{var oe;if(m.current){let fe=Math.min(m.current.value.length,s-1),be=m.current.value.length;(oe=m.current)==null||oe.setSelectionRange(fe,be),I(fe),ce(be)}b(!0)},[s]),J=Yt.useCallback(oe=>{var fe,be;let Me=m.current;if(!y&&(!g.current.isIOS||!oe.clipboardData||!Me))return;let Ne=oe.clipboardData.getData("text/plain"),Te=y?y(Ne):Ne;console.log({_content:Ne,content:Te}),oe.preventDefault();let $e=(fe=m.current)==null?void 0:fe.selectionStart,Ie=(be=m.current)==null?void 0:be.selectionEnd,Le=($e!==Ie?ie.slice(0,$e)+Te+ie.slice(Ie):ie.slice(0,$e)+Te+ie.slice($e)).slice(0,s);if(Le.length>0&&E&&!E.test(Le))return;Me.value=Le,j(Le);let Ve=Math.min(Le.length,s-1),ke=Le.length;Me.setSelectionRange(Ve,ke),I(Ve),ce(ke)},[s,j,E,ie]),Q=Yt.useMemo(()=>({position:"relative",cursor:B.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[B.disabled]),T=Yt.useMemo(()=>({position:"absolute",inset:0,width:D.willPushPWMBadge?`calc(100% + ${D.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:D.willPushPWMBadge?`inset(0 ${D.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[D.PWM_BADGE_SPACE_WIDTH,D.willPushPWMBadge,o]),X=Yt.useMemo(()=>Yt.createElement("input",RZ(TZ({autoComplete:B.autoComplete||"one-time-code"},B),{"data-input-otp":!0,"data-input-otp-placeholder-shown":ie.length===0||void 0,"data-input-otp-mss":P,"data-input-otp-mse":F,inputMode:l,pattern:E==null?void 0:E.source,"aria-placeholder":u,style:T,maxLength:s,value:ie,ref:m,onPaste:oe=>{var fe;J(oe),(fe=B.onPaste)==null||fe.call(B,oe)},onChange:se,onMouseOver:oe=>{var fe;S(!0),(fe=B.onMouseOver)==null||fe.call(B,oe)},onMouseLeave:oe=>{var fe;S(!1),(fe=B.onMouseLeave)==null||fe.call(B,oe)},onFocus:oe=>{var fe;ee(),(fe=B.onFocus)==null||fe.call(B,oe)},onBlur:oe=>{var fe;b(!1),(fe=B.onBlur)==null||fe.call(B,oe)}})),[se,ee,J,l,T,s,F,P,B,E==null?void 0:E.source,ie]),re=Yt.useMemo(()=>({slots:Array.from({length:s}).map((oe,fe)=>{var be;let Me=A&&P!==null&&F!==null&&(P===F&&fe===P||fe>=P&&feO?O(re):Yt.createElement(W7.Provider,{value:re},L),[L,re,O]);return Yt.createElement(Yt.Fragment,null,M!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,M)),Yt.createElement("div",{ref:f,"data-input-otp-container":!0,style:Q,className:_},ge,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},X)))});K7.displayName="Input";function lh(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var FZ=` + `),()=>{document.head.removeChild(h)}},[e]),he.jsx(cG,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const fG=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=M1(lG),f=Se.useId(),u=Se.useCallback(g=>{a.set(g,!0);for(const b of a.values())if(!b)return;n&&n()},[a,n]),h=Se.useMemo(()=>({id:f,initial:e,isPresent:r,custom:i,onExitComplete:u,register:g=>(a.set(g,!1),()=>a.delete(g))}),s?[Math.random(),u]:[r,u]);return Se.useMemo(()=>{a.forEach((g,b)=>a.set(b,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=he.jsx(uG,{isPresent:r,children:t})),he.jsx(Nd.Provider,{value:h,children:t})};function lG(){return new Map}const $d=t=>t.key||"";function RS(t){const e=[];return Se.Children.forEach(t,r=>{Se.isValidElement(r)&&e.push(r)}),e}const hG=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{ro(!e,"Replace exitBeforeEnter with mode='wait'");const a=Se.useMemo(()=>RS(t),[t]),f=a.map($d),u=Se.useRef(!0),h=Se.useRef(a),g=M1(()=>new Map),[b,x]=Se.useState(a),[S,C]=Se.useState(a);uS(()=>{u.current=!1,h.current=a;for(let L=0;L1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:B}=Se.useContext(m1);return he.jsx(he.Fragment,{children:S.map(L=>{const H=$d(L),F=a===S||f.includes(H),k=()=>{if(g.has(H))g.set(H,!0);else return;let $=!0;g.forEach(R=>{R||($=!1)}),$&&(B?.(),C(h.current),i&&i())};return he.jsx(fG,{isPresent:F,initial:!u.current||n?void 0:!1,custom:F?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:F?void 0:k,children:L},H)})})},ls=t=>he.jsx(hG,{children:he.jsx(aG.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function N1(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return he.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,he.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[he.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),he.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:he.jsx(Lz,{})})]})]})}function dG(t){return t.lastUsed?he.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[he.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?he.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[he.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function TS(t){const{wallet:e,onClick:r}=t,n=he.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.config?.image}),i=e.config?.name||"",s=Se.useMemo(()=>dG(e),[e]);return he.jsx(N1,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function DS(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=bG(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(L1);return a[0]===""&&a.length!==1&&a.shift(),OS(a,e)||vG(o)},getConflictingClassGroupIds:(o,a)=>{const f=r[o]||[];return a&&n[o]?[...f,...n[o]]:f}}},OS=(t,e)=>{if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?OS(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(L1);return e.validators.find(({validator:o})=>o(s))?.classGroupId},NS=/^\[(.+)\]$/,vG=t=>{if(NS.test(t)){const e=NS.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},bG=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return wG(Object.entries(t.classGroups),r).forEach(([s,o])=>{k1(o,n,s,e)}),n},k1=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:LS(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(yG(i)){k1(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{k1(o,LS(e,s),r,n)})})},LS=(t,e)=>{let r=t;return e.split(L1).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},yG=t=>t.isThemeGetter,wG=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,xG=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},kS="!",_G=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const f=[];let u=0,h=0,g;for(let D=0;Dh?g-h:void 0;return{modifiers:f,hasImportantModifier:x,baseClassName:S,maybePostfixModifierPosition:C}};return r?a=>r({className:a,parseClassName:o}):o},EG=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},SG=t=>({cache:xG(t.cacheSize),parseClassName:_G(t),...mG(t)}),AG=/\s+/,PG=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(AG);let a="";for(let f=o.length-1;f>=0;f-=1){const u=o[f],{modifiers:h,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:x}=r(u);let S=!!x,C=n(S?b.substring(0,x):b);if(!C){if(!S){a=u+(a.length>0?" "+a:a);continue}if(C=n(b),!C){a=u+(a.length>0?" "+a:a);continue}S=!1}const D=EG(h).join(":"),B=g?D+kS:D,L=B+C;if(s.includes(L))continue;s.push(L);const H=i(C,S);for(let F=0;F0?" "+a:a)}return a};function IG(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;ng(h),t());return r=SG(u),n=r.cache.get,i=r.cache.set,s=a,a(f)}function a(f){const u=n(f);if(u)return u;const h=PG(f,r);return i(f,h),h}return function(){return s(IG.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},FS=/^\[(?:([a-z-]+):)?(.+)\]$/i,CG=/^\d+\/\d+$/,RG=new Set(["px","full","screen"]),TG=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,DG=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,OG=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,NG=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,LG=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,oo=t=>Hc(t)||RG.has(t)||CG.test(t),Ho=t=>Wc(t,"length",zG),Hc=t=>!!t&&!Number.isNaN(Number(t)),B1=t=>Wc(t,"number",Hc),il=t=>!!t&&Number.isInteger(Number(t)),kG=t=>t.endsWith("%")&&Hc(t.slice(0,-1)),cr=t=>FS.test(t),Wo=t=>TG.test(t),BG=new Set(["length","size","percentage"]),FG=t=>Wc(t,BG,jS),jG=t=>Wc(t,"position",jS),UG=new Set(["image","url"]),$G=t=>Wc(t,UG,WG),qG=t=>Wc(t,"",HG),sl=()=>!0,Wc=(t,e,r)=>{const n=FS.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},zG=t=>DG.test(t)&&!OG.test(t),jS=()=>!1,HG=t=>NG.test(t),WG=t=>LG.test(t),KG=MG(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),f=Gr("contrast"),u=Gr("grayscale"),h=Gr("hueRotate"),g=Gr("invert"),b=Gr("gap"),x=Gr("gradientColorStops"),S=Gr("gradientColorStopPositions"),C=Gr("inset"),D=Gr("margin"),B=Gr("opacity"),L=Gr("padding"),H=Gr("saturate"),F=Gr("scale"),k=Gr("sepia"),$=Gr("skew"),R=Gr("space"),W=Gr("translate"),V=()=>["auto","contain","none"],X=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto",cr,e],_=()=>[cr,e],v=()=>["",oo,Ho],l=()=>["auto",Hc,cr],p=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],m=()=>["solid","dashed","dotted","double","none"],y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],A=()=>["start","end","center","between","around","evenly","stretch"],E=()=>["","0",cr],w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>[Hc,cr];return{cacheSize:500,separator:":",theme:{colors:[sl],spacing:[oo,Ho],blur:["none","",Wo,cr],brightness:I(),borderColor:[t],borderRadius:["none","","full",Wo,cr],borderSpacing:_(),borderWidth:v(),contrast:I(),grayscale:E(),hueRotate:I(),invert:E(),gap:_(),gradientColorStops:[t],gradientColorStopPositions:[kG,Ho],inset:q(),margin:q(),opacity:I(),padding:_(),saturate:I(),scale:I(),sepia:E(),skew:I(),space:_(),translate:_()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Wo]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...p(),cr]}],overflow:[{overflow:X()}],"overflow-x":[{"overflow-x":X()}],"overflow-y":[{"overflow-y":X()}],overscroll:[{overscroll:V()}],"overscroll-x":[{"overscroll-x":V()}],"overscroll-y":[{"overscroll-y":V()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[C]}],"inset-x":[{"inset-x":[C]}],"inset-y":[{"inset-y":[C]}],start:[{start:[C]}],end:[{end:[C]}],top:[{top:[C]}],right:[{right:[C]}],bottom:[{bottom:[C]}],left:[{left:[C]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",il,cr]}],basis:[{basis:q()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:E()}],shrink:[{shrink:E()}],order:[{order:["first","last","none",il,cr]}],"grid-cols":[{"grid-cols":[sl]}],"col-start-end":[{col:["auto",{span:["full",il,cr]},cr]}],"col-start":[{"col-start":l()}],"col-end":[{"col-end":l()}],"grid-rows":[{"grid-rows":[sl]}],"row-start-end":[{row:["auto",{span:[il,cr]},cr]}],"row-start":[{"row-start":l()}],"row-end":[{"row-end":l()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[b]}],"gap-x":[{"gap-x":[b]}],"gap-y":[{"gap-y":[b]}],"justify-content":[{justify:["normal",...A()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...A(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...A(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[L]}],px:[{px:[L]}],py:[{py:[L]}],ps:[{ps:[L]}],pe:[{pe:[L]}],pt:[{pt:[L]}],pr:[{pr:[L]}],pb:[{pb:[L]}],pl:[{pl:[L]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Wo]},Wo]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Wo,Ho]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",B1]}],"font-family":[{font:[sl]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Hc,B1]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",oo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[B]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[B]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...m(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",oo,Ho]}],"underline-offset":[{"underline-offset":["auto",oo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[B]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...p(),jG]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",FG]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},$G]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[S]}],"gradient-via-pos":[{via:[S]}],"gradient-to-pos":[{to:[S]}],"gradient-from":[{from:[x]}],"gradient-via":[{via:[x]}],"gradient-to":[{to:[x]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[B]}],"border-style":[{border:[...m(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[B]}],"divide-style":[{divide:m()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...m()]}],"outline-offset":[{"outline-offset":[oo,cr]}],"outline-w":[{outline:[oo,Ho]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:v()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[B]}],"ring-offset-w":[{"ring-offset":[oo,Ho]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Wo,qG]}],"shadow-color":[{shadow:[sl]}],opacity:[{opacity:[B]}],"mix-blend":[{"mix-blend":[...y(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":y()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[f]}],"drop-shadow":[{"drop-shadow":["","none",Wo,cr]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[g]}],saturate:[{saturate:[H]}],sepia:[{sepia:[k]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[f]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[B]}],"backdrop-saturate":[{"backdrop-saturate":[H]}],"backdrop-sepia":[{"backdrop-sepia":[k]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:I()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:I()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[F]}],"scale-x":[{"scale-x":[F]}],"scale-y":[{"scale-y":[F]}],rotate:[{rotate:[il,cr]}],"translate-x":[{"translate-x":[W]}],"translate-y":[{"translate-y":[W]}],"skew-x":[{"skew-x":[$]}],"skew-y":[{"skew-y":[$]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[oo,Ho,B1]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function ao(...t){return KG(gG(t))}function US(t){const{className:e}=t;return he.jsxs("div",{className:ao("xc-flex xc-items-center xc-gap-2"),children:[he.jsx("hr",{className:ao("xc-flex-1 xc-border-gray-200",e)}),he.jsx("div",{className:"xc-shrink-0",children:t.children}),he.jsx("hr",{className:ao("xc-flex-1 xc-border-gray-200",e)})]})}function VG(t){const{wallet:e,onClick:r}=t;return he.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[he.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:e.config?.image,alt:""}),he.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[he.jsxs("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:["Connect to ",e.config?.name]}),he.jsx("div",{className:"xc-flex xc-gap-2",children:he.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:()=>r(e),children:"Connect"})})]})]})}const GG="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function YG(t){const{onClick:e}=t;function r(){e&&e()}return he.jsx(US,{className:"xc-opacity-20",children:he.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[he.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),he.jsx(U4,{size:16})]})})}function $S(t){const[e,r]=Se.useState(""),{featuredWallets:n,initialized:i}=Hf(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:f,config:u}=t,h=Se.useMemo(()=>{const C=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!C.test(e)&&D.test(e)},[e]);function g(C){o(C)}function b(C){r(C.target.value)}async function x(){s(e)}function S(C){C.key==="Enter"&&h&&x()}return he.jsx(ls,{children:i&&he.jsxs(he.Fragment,{children:[t.header||he.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),n.length===1&&he.jsx("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:n.map(C=>he.jsx(VG,{wallet:C,onClick:g},`feature-${C.key}`))}),n.length>1&&he.jsxs(he.Fragment,{children:[he.jsxs("div",{children:[he.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[u.showFeaturedWallets&&n&&n.map(C=>he.jsx(TS,{wallet:C,onClick:g},`feature-${C.key}`)),u.showTonConnect&&he.jsx(N1,{icon:he.jsx("img",{className:"xc-h-5 xc-w-5",src:GG}),title:"TON Connect",onClick:f})]}),u.showMoreWallets&&he.jsx(YG,{onClick:a})]}),u.showEmailSignIn&&(u.showFeaturedWallets||u.showTonConnect)&&he.jsx("div",{className:"xc-mb-4 xc-mt-4",children:he.jsxs(US,{className:"xc-opacity-20",children:[" ",he.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),u.showEmailSignIn&&he.jsxs("div",{className:"xc-mb-4",children:[he.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:b,onKeyDown:S}),he.jsx("button",{disabled:!h,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:x,children:"Continue"})]})]})]})})}function Wa(t){const{title:e}=t;return he.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[he.jsx(Nz,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),he.jsx("span",{children:e})]})}const qS=Se.createContext({channel:"",device:"WEB",app:"",inviterCode:"",role:"C"});function F1(){return Se.useContext(qS)}function JG(t){const{config:e}=t,[r,n]=Se.useState(e.channel),[i,s]=Se.useState(e.device),[o,a]=Se.useState(e.app),[f,u]=Se.useState(e.role||"C"),[h,g]=Se.useState(e.inviterCode);return Se.useEffect(()=>{n(e.channel),s(e.device),a(e.app),g(e.inviterCode),u(e.role||"C")},[e]),he.jsx(qS.Provider,{value:{channel:r,device:i,app:o,inviterCode:h,role:f},children:t.children})}var XG=Object.defineProperty,ZG=Object.defineProperties,QG=Object.getOwnPropertyDescriptors,qd=Object.getOwnPropertySymbols,zS=Object.prototype.hasOwnProperty,HS=Object.prototype.propertyIsEnumerable,WS=(t,e,r)=>e in t?XG(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,eY=(t,e)=>{for(var r in e||(e={}))zS.call(e,r)&&WS(t,r,e[r]);if(qd)for(var r of qd(e))HS.call(e,r)&&WS(t,r,e[r]);return t},tY=(t,e)=>ZG(t,QG(e)),rY=(t,e)=>{var r={};for(var n in t)zS.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&qd)for(var n of qd(t))e.indexOf(n)<0&&HS.call(t,n)&&(r[n]=t[n]);return r};function nY(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function iY(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var sY=18,KS=40,oY=`${KS}px`,aY=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function cY({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[f,u]=Yt.useState(!1),h=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),g=Yt.useCallback(()=>{let b=t.current,x=e.current;if(!b||!x||f||r==="none")return;let S=b,C=S.getBoundingClientRect().left+S.offsetWidth,D=S.getBoundingClientRect().top+S.offsetHeight/2,B=C-sY,L=D;document.querySelectorAll(aY).length===0&&document.elementFromPoint(B,L)===b||(s(!0),u(!0))},[t,e,f,r]);return Yt.useEffect(()=>{let b=t.current;if(!b||r==="none")return;function x(){let C=window.innerWidth-b.getBoundingClientRect().right;a(C>=KS)}x();let S=setInterval(x,1e3);return()=>{clearInterval(S)}},[t,r]),Yt.useEffect(()=>{let b=n||document.activeElement===e.current;if(r==="none"||!b)return;let x=setTimeout(g,0),S=setTimeout(g,2e3),C=setTimeout(g,5e3),D=setTimeout(()=>{u(!0)},6e3);return()=>{clearTimeout(x),clearTimeout(S),clearTimeout(C),clearTimeout(D)}},[e,n,r,g]),{hasPWMBadge:i,willPushPWMBadge:h,PWM_BADGE_SPACE_WIDTH:oY}}var VS=Yt.createContext({}),GS=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:f,inputMode:u="numeric",onComplete:h,pushPasswordManagerStrategy:g="increase-width",pasteTransformer:b,containerClassName:x,noScriptCSSFallback:S=uY,render:C,children:D}=r,B=rY(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),L,H,F,k,$;let[R,W]=Yt.useState(typeof B.defaultValue=="string"?B.defaultValue:""),V=n??R,X=iY(V),q=Yt.useCallback(ce=>{i?.(ce),W(ce)},[i]),_=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),v=Yt.useRef(null),l=Yt.useRef(null),p=Yt.useRef({value:V,onChange:q,isIOS:typeof window<"u"&&((H=(L=window?.CSS)==null?void 0:L.supports)==null?void 0:H.call(L,"-webkit-touch-callout","none"))}),m=Yt.useRef({prev:[(F=v.current)==null?void 0:F.selectionStart,(k=v.current)==null?void 0:k.selectionEnd,($=v.current)==null?void 0:$.selectionDirection]});Yt.useImperativeHandle(e,()=>v.current,[]),Yt.useEffect(()=>{let ce=v.current,fe=l.current;if(!ce||!fe)return;p.current.value!==ce.value&&p.current.onChange(ce.value),m.current.prev=[ce.selectionStart,ce.selectionEnd,ce.selectionDirection];function be(){if(document.activeElement!==ce){M(null),se(null);return}let Te=ce.selectionStart,Fe=ce.selectionEnd,Me=ce.selectionDirection,Ne=ce.maxLength,He=ce.value,Oe=m.current.prev,$e=-1,qe=-1,_e;if(He.length!==0&&Te!==null&&Fe!==null){let nt=Te===Fe,it=Te===He.length&&He.length1&&He.length>1){let pt=0;if(Oe[0]!==null&&Oe[1]!==null){_e=Ye{fe&&fe.style.setProperty("--root-height",`${ce.clientHeight}px`)};Pe();let De=new ResizeObserver(Pe);return De.observe(ce),()=>{document.removeEventListener("selectionchange",be,{capture:!0}),De.disconnect()}},[]);let[y,A]=Yt.useState(!1),[E,w]=Yt.useState(!1),[I,M]=Yt.useState(null),[z,se]=Yt.useState(null);Yt.useEffect(()=>{nY(()=>{var ce,fe,be,Pe;(ce=v.current)==null||ce.dispatchEvent(new Event("input"));let De=(fe=v.current)==null?void 0:fe.selectionStart,Te=(be=v.current)==null?void 0:be.selectionEnd,Fe=(Pe=v.current)==null?void 0:Pe.selectionDirection;De!==null&&Te!==null&&(M(De),se(Te),m.current.prev=[De,Te,Fe])})},[V,E]),Yt.useEffect(()=>{X!==void 0&&V!==X&&X.length{let fe=ce.currentTarget.value.slice(0,s);if(fe.length>0&&_&&!_.test(fe)){ce.preventDefault();return}typeof X=="string"&&fe.length{var ce;if(v.current){let fe=Math.min(v.current.value.length,s-1),be=v.current.value.length;(ce=v.current)==null||ce.setSelectionRange(fe,be),M(fe),se(be)}w(!0)},[s]),Z=Yt.useCallback(ce=>{var fe,be;let Pe=v.current;if(!b&&(!p.current.isIOS||!ce.clipboardData||!Pe))return;let De=ce.clipboardData.getData("text/plain"),Te=b?b(De):De;console.log({_content:De,content:Te}),ce.preventDefault();let Fe=(fe=v.current)==null?void 0:fe.selectionStart,Me=(be=v.current)==null?void 0:be.selectionEnd,Ne=(Fe!==Me?V.slice(0,Fe)+Te+V.slice(Me):V.slice(0,Fe)+Te+V.slice(Fe)).slice(0,s);if(Ne.length>0&&_&&!_.test(Ne))return;Pe.value=Ne,q(Ne);let He=Math.min(Ne.length,s-1),Oe=Ne.length;Pe.setSelectionRange(He,Oe),M(He),se(Oe)},[s,q,_,V]),te=Yt.useMemo(()=>({position:"relative",cursor:B.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[B.disabled]),N=Yt.useMemo(()=>({position:"absolute",inset:0,width:O.willPushPWMBadge?`calc(100% + ${O.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:O.willPushPWMBadge?`inset(0 ${O.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[O.PWM_BADGE_SPACE_WIDTH,O.willPushPWMBadge,o]),Q=Yt.useMemo(()=>Yt.createElement("input",tY(eY({autoComplete:B.autoComplete||"one-time-code"},B),{"data-input-otp":!0,"data-input-otp-placeholder-shown":V.length===0||void 0,"data-input-otp-mss":I,"data-input-otp-mse":z,inputMode:u,pattern:_?.source,"aria-placeholder":f,style:N,maxLength:s,value:V,ref:v,onPaste:ce=>{var fe;Z(ce),(fe=B.onPaste)==null||fe.call(B,ce)},onChange:ie,onMouseOver:ce=>{var fe;A(!0),(fe=B.onMouseOver)==null||fe.call(B,ce)},onMouseLeave:ce=>{var fe;A(!1),(fe=B.onMouseLeave)==null||fe.call(B,ce)},onFocus:ce=>{var fe;ee(),(fe=B.onFocus)==null||fe.call(B,ce)},onBlur:ce=>{var fe;w(!1),(fe=B.onBlur)==null||fe.call(B,ce)}})),[ie,ee,Z,u,N,s,z,I,B,_?.source,V]),ne=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ce,fe)=>{var be;let Pe=E&&I!==null&&z!==null&&(I===z&&fe===I||fe>=I&&feC?C(ne):Yt.createElement(VS.Provider,{value:ne},D),[D,ne,C]);return Yt.createElement(Yt.Fragment,null,S!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,S)),Yt.createElement("div",{ref:l,"data-input-otp-container":!0,style:te,className:x},de,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Q)))});GS.displayName="Input";function ol(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var uY=` [data-input-otp] { --nojs-bg: white !important; --nojs-fg: black !important; @@ -218,30 +218,30 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene --nojs-bg: black !important; --nojs-fg: white !important; } -}`;const V7=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>le.jsx(K7,{ref:n,containerClassName:$o("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:$o("disabled:xc-cursor-not-allowed",t),...r}));V7.displayName="InputOTP";const G7=Yt.forwardRef(({className:t,...e},r)=>le.jsx("div",{ref:r,className:$o("xc-flex xc-items-center",t),...e}));G7.displayName="InputOTPGroup";const Dc=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(W7),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return le.jsxs("div",{ref:n,className:$o("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&le.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:le.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Dc.displayName="InputOTPSlot";function jZ(t){const{spinning:e,children:r,className:n}=t;return le.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&le.jsx("div",{className:$o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:le.jsx(Sc,{className:"xc-animate-spin"})})]})}function Y7(t){const{email:e}=t,[r,n]=Ee.useState(0),[i,s]=Ee.useState(!1),[o,a]=Ee.useState("");async function u(){n(60);const d=setInterval(()=>{n(p=>p===0?(clearInterval(d),0):p-1)},1e3)}async function l(d){if(a(""),!(d.length<6)){s(!0);try{await t.onInputCode(e,d)}catch(p){a(p.message)}s(!1)}}return Ee.useEffect(()=>{u()},[]),le.jsxs(Ms,{children:[le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[le.jsx(mV,{className:"xc-mb-4",size:60}),le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:[le.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),le.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]}),le.jsx("div",{className:"xc-mb-2 xc-h-12",children:le.jsx(jZ,{spinning:i,className:"xc-rounded-xl",children:le.jsx(V7,{maxLength:6,onChange:l,disabled:i,className:"disabled:xc-opacity-20",children:le.jsx(G7,{children:le.jsxs("div",{className:$o("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[le.jsx(Dc,{index:0}),le.jsx(Dc,{index:1}),le.jsx(Dc,{index:2}),le.jsx(Dc,{index:3}),le.jsx(Dc,{index:4}),le.jsx(Dc,{index:5})]})})})})}),o&&le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{children:o})})]}),le.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Resend in ${r}s`:le.jsx("button",{id:"sendCodeButton",onClick:t.onResendCode,children:"Send again"})]}),le.jsx("div",{id:"captcha-element"})]})}function J7(t){const{email:e}=t,[r,n]=Ee.useState(!1),[i,s]=Ee.useState(""),o=Ee.useMemo(()=>`xn-btn-${new Date().getTime()}`,[e]);async function a(y,_){n(!0),s(""),await xa.getEmailCode({account_type:"email",email:y},_),n(!1)}async function u(y){try{return await a(e,JSON.stringify(y)),{captchaResult:!0,bizResult:!0}}catch(_){return s(_.message),{captchaResult:!1,bizResult:!1}}}async function l(y){y&&t.onCodeSend()}const d=Ee.useRef();function p(y){d.current=y}return Ee.useEffect(()=>{if(e)return window.initAliyunCaptcha({SceneId:"tqyu8129d",prefix:"1mfsn5f",mode:"popup",element:"#captcha-element",button:`#${o}`,captchaVerifyCallback:u,onBizResultCallback:l,getInstance:p,slideStyle:{width:360,height:40},language:"en",region:"cn"}),()=>{var y,_;(y=document.getElementById("aliyunCaptcha-mask"))==null||y.remove(),(_=document.getElementById("aliyunCaptcha-window-popup"))==null||_.remove()}},[e]),le.jsxs(Ms,{children:[le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[le.jsx(vV,{className:"xc-mb-4",size:60}),le.jsx("button",{className:"xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2",id:o,children:r?le.jsx(Sc,{className:"xc-animate-spin"}):"I'm not a robot"})]}),i&&le.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:le.jsx("p",{children:i})})]})}function UZ(t){const{email:e}=t,r=Bb(),[n,i]=Ee.useState("captcha");async function s(o,a){const u=await xa.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:a,email:o,inviter_code:r.inviterCode,source:{device:r.device,channel:r.channel,app:r.app}});t.onLogin(u.data)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-12",children:le.jsx(Rc,{title:"Sign in with email",onBack:t.onBack})}),n==="captcha"&&le.jsx(J7,{email:e,onCodeSend:()=>i("verify-email")}),n==="verify-email"&&le.jsx(Y7,{email:e,onInputCode:s,onResendCode:()=>i("captcha")})]})}var X7={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(nn,()=>(()=>{var r={873:(o,a)=>{var u,l,d=function(){var p=function(f,g){var v=f,x=B[g],S=null,A=0,b=null,P=[],I={},F=function(re,ge){S=function(oe){for(var fe=new Array(oe),be=0;be=7&&ee(re),b==null&&(b=T(v,x,P)),Q(b,ge)},ce=function(re,ge){for(var oe=-1;oe<=7;oe+=1)if(!(re+oe<=-1||A<=re+oe))for(var fe=-1;fe<=7;fe+=1)ge+fe<=-1||A<=ge+fe||(S[re+oe][ge+fe]=0<=oe&&oe<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(oe==0||oe==6)||2<=oe&&oe<=4&&2<=fe&&fe<=4)},D=function(){for(var re=8;re>oe&1)==1;S[Math.floor(oe/3)][oe%3+A-8-3]=fe}for(oe=0;oe<18;oe+=1)fe=!re&&(ge>>oe&1)==1,S[oe%3+A-8-3][Math.floor(oe/3)]=fe},J=function(re,ge){for(var oe=x<<3|ge,fe=k.getBCHTypeInfo(oe),be=0;be<15;be+=1){var Me=!re&&(fe>>be&1)==1;be<6?S[be][8]=Me:be<8?S[be+1][8]=Me:S[A-15+be][8]=Me}for(be=0;be<15;be+=1)Me=!re&&(fe>>be&1)==1,be<8?S[8][A-be-1]=Me:be<9?S[8][15-be-1+1]=Me:S[8][15-be-1]=Me;S[A-8][8]=!re},Q=function(re,ge){for(var oe=-1,fe=A-1,be=7,Me=0,Ne=k.getMaskFunction(ge),Te=A-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var $e=0;$e<2;$e+=1)if(S[fe][Te-$e]==null){var Ie=!1;Me>>be&1)==1),Ne(fe,Te-$e)&&(Ie=!Ie),S[fe][Te-$e]=Ie,(be-=1)==-1&&(Me+=1,be=7)}if((fe+=oe)<0||A<=fe){fe-=oe,oe=-oe;break}}},T=function(re,ge,oe){for(var fe=z.getRSBlocks(re,ge),be=Z(),Me=0;Me8*Te)throw"code length overflow. ("+be.getLengthInBits()+">"+8*Te+")";for(be.getLengthInBits()+4<=8*Te&&be.put(0,4);be.getLengthInBits()%8!=0;)be.putBit(!1);for(;!(be.getLengthInBits()>=8*Te||(be.put(236,8),be.getLengthInBits()>=8*Te));)be.put(17,8);return function($e,Ie){for(var Le=0,Ve=0,ke=0,ze=new Array(Ie.length),He=new Array(Ie.length),Se=0;Se=0?rt.getAt(Je):0}}var gt=0;for(Be=0;BeIe)&&(Ne=Ie,Te=$e)}return Te}())},I.createTableTag=function(re,ge){re=re||2;var oe="";oe+='";for(var be=0;be';oe+=""}return(oe+="")+"
"},I.createSvgTag=function(re,ge,oe,fe){var be={};typeof arguments[0]=="object"&&(re=(be=arguments[0]).cellSize,ge=be.margin,oe=be.alt,fe=be.title),re=re||2,ge=ge===void 0?4*re:ge,(oe=typeof oe=="string"?{text:oe}:oe||{}).text=oe.text||null,oe.id=oe.text?oe.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Me,Ne,Te,$e,Ie=I.getModuleCount()*re+2*ge,Le="";for($e="l"+re+",0 0,"+re+" -"+re+",0 0,-"+re+"z ",Le+=''+X(fe.text)+"":"",Le+=oe.text?''+X(oe.text)+"":"",Le+='',Le+='"},I.createDataURL=function(re,ge){re=re||2,ge=ge===void 0?4*re:ge;var oe=I.getModuleCount()*re+2*ge,fe=ge,be=oe-ge;return m(oe,oe,function(Me,Ne){if(fe<=Me&&Me"};var X=function(re){for(var ge="",oe=0;oe":ge+=">";break;case"&":ge+="&";break;case'"':ge+=""";break;default:ge+=fe}}return ge};return I.createASCII=function(re,ge){if((re=re||1)<2)return function(ze){ze=ze===void 0?2:ze;var He,Se,Qe,ct,Be,et=1*I.getModuleCount()+2*ze,rt=ze,Je=et-ze,gt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(He=0;He=Je?ht[Be]:gt[Be];ft+=` -`}return et%2&&ze>0?ft.substring(0,ft.length-et-1)+Array(et+1).join("▀"):ft.substring(0,ft.length-1)}(ge);re-=1,ge=ge===void 0?2*re:ge;var oe,fe,be,Me,Ne=I.getModuleCount()*re+2*ge,Te=ge,$e=Ne-ge,Ie=Array(re+1).join("██"),Le=Array(re+1).join(" "),Ve="",ke="";for(oe=0;oe>>8),A.push(255&I)):A.push(x)}}return A}};var y,_,M,O,L,B={L:1,M:0,Q:3,H:2},k=(y=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],_=1335,M=7973,L=function(f){for(var g=0;f!=0;)g+=1,f>>>=1;return g},(O={}).getBCHTypeInfo=function(f){for(var g=f<<10;L(g)-L(_)>=0;)g^=_<=0;)g^=M<5&&(v+=3+A-5)}for(x=0;x=256;)x-=255;return f[x]}}}();function U(f,g){if(f.length===void 0)throw f.length+"/"+g;var v=function(){for(var S=0;S>>7-x%8&1)==1},put:function(x,S){for(var A=0;A>>S-A-1&1)==1)},getLengthInBits:function(){return g},putBit:function(x){var S=Math.floor(g/8);f.length<=S&&f.push(0),x&&(f[S]|=128>>>g%8),g+=1}};return v},R=function(f){var g=f,v={getMode:function(){return 1},getLength:function(A){return g.length},write:function(A){for(var b=g,P=0;P+2>>8&255)+(255&P),S.put(P,13),b+=2}if(b>>8)},writeBytes:function(v,x,S){x=x||0,S=S||v.length;for(var A=0;A0&&(v+=","),v+=f[x];return v+"]"}};return g},E=function(f){var g=f,v=0,x=0,S=0,A={read:function(){for(;S<8;){if(v>=g.length){if(S==0)return-1;throw"unexpected end of file./"+S}var P=g.charAt(v);if(v+=1,P=="=")return S=0,-1;P.match(/^\s$/)||(x=x<<6|b(P.charCodeAt(0)),S+=6)}var I=x>>>S-8&255;return S-=8,I}},b=function(P){if(65<=P&&P<=90)return P-65;if(97<=P&&P<=122)return P-97+26;if(48<=P&&P<=57)return P-48+52;if(P==43)return 62;if(P==47)return 63;throw"c:"+P};return A},m=function(f,g,v){for(var x=function(ce,D){var se=ce,ee=D,J=new Array(ce*D),Q={setPixel:function(re,ge,oe){J[ge*se+re]=oe},write:function(re){re.writeString("GIF87a"),re.writeShort(se),re.writeShort(ee),re.writeByte(128),re.writeByte(0),re.writeByte(0),re.writeByte(0),re.writeByte(0),re.writeByte(0),re.writeByte(255),re.writeByte(255),re.writeByte(255),re.writeString(","),re.writeShort(0),re.writeShort(0),re.writeShort(se),re.writeShort(ee),re.writeByte(0);var ge=T(2);re.writeByte(2);for(var oe=0;ge.length-oe>255;)re.writeByte(255),re.writeBytes(ge,oe,255),oe+=255;re.writeByte(ge.length-oe),re.writeBytes(ge,oe,ge.length-oe),re.writeByte(0),re.writeString(";")}},T=function(re){for(var ge=1<>>Se)throw"length over";for(;Te+Se>=8;)Ne.writeByte(255&(He<>>=8-Te,$e=0,Te=0;$e|=He<0&&Ne.writeByte($e)}});Le.write(ge,fe);var Ve=0,ke=String.fromCharCode(J[Ve]);for(Ve+=1;Ve=6;)Q(ce>>>D-6),D-=6},J.flush=function(){if(D>0&&(Q(ce<<6-D),ce=0,D=0),se%3!=0)for(var X=3-se%3,re=0;re>6,128|63&O):O<55296||O>=57344?_.push(224|O>>12,128|O>>6&63,128|63&O):(M++,O=65536+((1023&O)<<10|1023&y.charCodeAt(M)),_.push(240|O>>18,128|O>>12&63,128|O>>6&63,128|63&O))}return _}(p)},(l=typeof(u=function(){return d})=="function"?u.apply(a,[]):u)===void 0||(o.exports=l)}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var u=n[o]={exports:{}};return r[o](u,u.exports,i),u.exports}i.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return i.d(a,{a}),a},i.d=(o,a)=>{for(var u in a)i.o(a,u)&&!i.o(o,u)&&Object.defineProperty(o,u,{enumerable:!0,get:a[u]})},i.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a);var s={};return(()=>{i.d(s,{default:()=>j});const o=E=>!!E&&typeof E=="object"&&!Array.isArray(E);function a(E,...m){if(!m.length)return E;const f=m.shift();return f!==void 0&&o(E)&&o(f)?(E=Object.assign({},E),Object.keys(f).forEach(g=>{const v=E[g],x=f[g];Array.isArray(v)&&Array.isArray(x)?E[g]=x:o(v)&&o(x)?E[g]=a(Object.assign({},v),x):E[g]=x}),a(E,...m)):E}function u(E,m){const f=document.createElement("a");f.download=m,f.href=E,document.body.appendChild(f),f.click(),document.body.removeChild(f)}const l={L:.07,M:.15,Q:.25,H:.3};class d{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"dots":x=this._drawDot;break;case"classy":x=this._drawClassy;break;case"classy-rounded":x=this._drawClassyRounded;break;case"rounded":x=this._drawRounded;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawSquare}x.call(this,{x:m,y:f,size:g,getNeighbor:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var S;const A=m+g/2,b=f+g/2;x(),(S=this._element)===null||S===void 0||S.setAttribute("transform",`rotate(${180*v/Math.PI},${A},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_basicSideRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, 0 ${-f}`)}}))}_basicCornerRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_basicCornerExtraRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`)}}))}_basicCornersRounded(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${g} ${v}v `+f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${f/2} ${f/2}h `+f/2+"v "+-f/2+`a ${f/2} ${f/2}, 0, 0, 0, ${-f/2} ${-f/2}`)}}))}_drawDot({x:m,y:f,size:g}){this._basicDot({x:m,y:f,size:g,rotation:0})}_drawSquare({x:m,y:f,size:g}){this._basicSquare({x:m,y:f,size:g,rotation:0})}_drawRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,S=v?+v(1,0):0,A=v?+v(0,-1):0,b=v?+v(0,1):0,P=x+S+A+b;if(P!==0)if(P>2||x&&S||A&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(P===2){let I=0;return x&&A?I=Math.PI/2:A&&S?I=Math.PI:S&&b&&(I=-Math.PI/2),void this._basicCornerRounded({x:m,y:f,size:g,rotation:I})}if(P===1){let I=0;return A?I=Math.PI/2:S?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawExtraRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,S=v?+v(1,0):0,A=v?+v(0,-1):0,b=v?+v(0,1):0,P=x+S+A+b;if(P!==0)if(P>2||x&&S||A&&b)this._basicSquare({x:m,y:f,size:g,rotation:0});else{if(P===2){let I=0;return x&&A?I=Math.PI/2:A&&S?I=Math.PI:S&&b&&(I=-Math.PI/2),void this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:I})}if(P===1){let I=0;return A?I=Math.PI/2:S?I=Math.PI:b&&(I=-Math.PI/2),void this._basicSideRounded({x:m,y:f,size:g,rotation:I})}}else this._basicDot({x:m,y:f,size:g,rotation:0})}_drawClassy({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,S=v?+v(1,0):0,A=v?+v(0,-1):0,b=v?+v(0,1):0;x+S+A+b!==0?x||A?S||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}_drawClassyRounded({x:m,y:f,size:g,getNeighbor:v}){const x=v?+v(-1,0):0,S=v?+v(1,0):0,A=v?+v(0,-1):0,b=v?+v(0,1):0;x+S+A+b!==0?x||A?S||b?this._basicSquare({x:m,y:f,size:g,rotation:0}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:m,y:f,size:g,rotation:-Math.PI/2}):this._basicCornersRounded({x:m,y:f,size:g,rotation:Math.PI/2})}}class p{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;switch(this._type){case"square":x=this._drawSquare;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawDot}x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var S;const A=m+g/2,b=f+g/2;x(),(S=this._element)===null||S===void 0||S.setAttribute("transform",`rotate(${180*v/Math.PI},${A},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g+f/2} ${v}a ${f/2} ${f/2} 0 1 0 0.1 0zm 0 ${x}a ${f/2-x} ${f/2-x} 0 1 1 -0.1 0Z`)}}))}_basicSquare(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v}v ${f}h ${f}v `+-f+`zM ${g+x} ${v+x}h `+(f-2*x)+"v "+(f-2*x)+"h "+(2*x-f)+"z")}}))}_basicExtraRounded(m){const{size:f,x:g,y:v}=m,x=f/7;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${g} ${v+2.5*x}v `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*x}h `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*-x}v `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*-x}h `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*x}M ${g+2.5*x} ${v+x}h `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*x}v `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*x}h `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*-x}v `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*-x}`)}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}_drawExtraRounded({x:m,y:f,size:g,rotation:v}){this._basicExtraRounded({x:m,y:f,size:g,rotation:v})}}class y{constructor({svg:m,type:f,window:g}){this._svg=m,this._type=f,this._window=g}draw(m,f,g,v){let x;x=this._type==="square"?this._drawSquare:this._drawDot,x.call(this,{x:m,y:f,size:g,rotation:v})}_rotateFigure({x:m,y:f,size:g,rotation:v=0,draw:x}){var S;const A=m+g/2,b=f+g/2;x(),(S=this._element)===null||S===void 0||S.setAttribute("transform",`rotate(${180*v/Math.PI},${A},${b})`)}_basicDot(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(g+f/2)),this._element.setAttribute("cy",String(v+f/2)),this._element.setAttribute("r",String(f/2))}}))}_basicSquare(m){const{size:f,x:g,y:v}=m;this._rotateFigure(Object.assign(Object.assign({},m),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(g)),this._element.setAttribute("y",String(v)),this._element.setAttribute("width",String(f)),this._element.setAttribute("height",String(f))}}))}_drawDot({x:m,y:f,size:g,rotation:v}){this._basicDot({x:m,y:f,size:g,rotation:v})}_drawSquare({x:m,y:f,size:g,rotation:v}){this._basicSquare({x:m,y:f,size:g,rotation:v})}}const _="circle",M=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],O=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class L{constructor(m,f){this._roundSize=g=>this._options.dotsOptions.roundSize?Math.floor(g):g,this._window=f,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(m.width)),this._element.setAttribute("height",String(m.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),m.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=m.image,this._instanceId=L.instanceCount++,this._options=m}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(m){const f=m.getModuleCount(),g=Math.min(this._options.width,this._options.height)-2*this._options.margin,v=this._options.shape===_?g/Math.sqrt(2):g,x=this._roundSize(v/f);let S={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=m,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:A,qrOptions:b}=this._options,P=A.imageSize*l[b.errorCorrectionLevel],I=Math.floor(P*f*f);S=function({originalHeight:F,originalWidth:ce,maxHiddenDots:D,maxHiddenAxisDots:se,dotSize:ee}){const J={x:0,y:0},Q={x:0,y:0};if(F<=0||ce<=0||D<=0||ee<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const T=F/ce;return J.x=Math.floor(Math.sqrt(D/T)),J.x<=0&&(J.x=1),se&&seD||se&&se{var P,I,F,ce,D,se;return!(this._options.imageOptions.hideBackgroundDots&&A>=(f-S.hideYDots)/2&&A<(f+S.hideYDots)/2&&b>=(f-S.hideXDots)/2&&b<(f+S.hideXDots)/2||!((P=M[A])===null||P===void 0)&&P[b]||!((I=M[A-f+7])===null||I===void 0)&&I[b]||!((F=M[A])===null||F===void 0)&&F[b-f+7]||!((ce=O[A])===null||ce===void 0)&&ce[b]||!((D=O[A-f+7])===null||D===void 0)&&D[b]||!((se=O[A])===null||se===void 0)&&se[b-f+7])}),this.drawCorners(),this._options.image&&await this.drawImage({width:S.width,height:S.height,count:f,dotSize:x})}drawBackground(){var m,f,g;const v=this._element,x=this._options;if(v){const S=(m=x.backgroundOptions)===null||m===void 0?void 0:m.gradient,A=(f=x.backgroundOptions)===null||f===void 0?void 0:f.color;let b=x.height,P=x.width;if(S||A){const I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((g=x.backgroundOptions)===null||g===void 0)&&g.round&&(b=P=Math.min(x.width,x.height),I.setAttribute("rx",String(b/2*x.backgroundOptions.round))),I.setAttribute("x",String(this._roundSize((x.width-P)/2))),I.setAttribute("y",String(this._roundSize((x.height-b)/2))),I.setAttribute("width",String(P)),I.setAttribute("height",String(b)),this._backgroundClipPath.appendChild(I),this._createColor({options:S,color:A,additionalRotation:0,x:0,y:0,height:x.height,width:x.width,name:`background-color-${this._instanceId}`})}}}drawDots(m){var f,g;if(!this._qr)throw"QR code is not defined";const v=this._options,x=this._qr.getModuleCount();if(x>v.width||x>v.height)throw"The canvas is too small.";const S=Math.min(v.width,v.height)-2*v.margin,A=v.shape===_?S/Math.sqrt(2):S,b=this._roundSize(A/x),P=this._roundSize((v.width-x*b)/2),I=this._roundSize((v.height-x*b)/2),F=new d({svg:this._element,type:v.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(f=v.dotsOptions)===null||f===void 0?void 0:f.gradient,color:v.dotsOptions.color,additionalRotation:0,x:0,y:0,height:v.height,width:v.width,name:`dot-color-${this._instanceId}`});for(let ce=0;ce!(D+se<0||ce+ee<0||D+se>=x||ce+ee>=x)&&!(m&&!m(ce+ee,D+se))&&!!this._qr&&this._qr.isDark(ce+ee,D+se)),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element));if(v.shape===_){const ce=this._roundSize((S/b-x)/2),D=x+2*ce,se=P-ce*b,ee=I-ce*b,J=[],Q=this._roundSize(D/2);for(let T=0;T=ce-1&&T<=D-ce&&X>=ce-1&&X<=D-ce||Math.sqrt((T-Q)*(T-Q)+(X-Q)*(X-Q))>Q?J[T][X]=0:J[T][X]=this._qr.isDark(X-2*ce<0?X:X>=x?X-2*ce:X-ce,T-2*ce<0?T:T>=x?T-2*ce:T-ce)?1:0}for(let T=0;T{var oe;return!!(!((oe=J[T+ge])===null||oe===void 0)&&oe[X+re])}),F._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(F._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const m=this._element,f=this._options;if(!m)throw"Element code is not defined";const g=this._qr.getModuleCount(),v=Math.min(f.width,f.height)-2*f.margin,x=f.shape===_?v/Math.sqrt(2):v,S=this._roundSize(x/g),A=7*S,b=3*S,P=this._roundSize((f.width-g*S)/2),I=this._roundSize((f.height-g*S)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([F,ce,D])=>{var se,ee,J,Q,T,X,re,ge,oe,fe,be,Me;const Ne=P+F*S*(g-7),Te=I+ce*S*(g-7);let $e=this._dotsClipPath,Ie=this._dotsClipPath;if((!((se=f.cornersSquareOptions)===null||se===void 0)&&se.gradient||!((ee=f.cornersSquareOptions)===null||ee===void 0)&&ee.color)&&($e=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),$e.setAttribute("id",`clip-path-corners-square-color-${F}-${ce}-${this._instanceId}`),this._defs.appendChild($e),this._cornersSquareClipPath=this._cornersDotClipPath=Ie=$e,this._createColor({options:(J=f.cornersSquareOptions)===null||J===void 0?void 0:J.gradient,color:(Q=f.cornersSquareOptions)===null||Q===void 0?void 0:Q.color,additionalRotation:D,x:Ne,y:Te,height:A,width:A,name:`corners-square-color-${F}-${ce}-${this._instanceId}`})),(T=f.cornersSquareOptions)===null||T===void 0?void 0:T.type){const Le=new p({svg:this._element,type:f.cornersSquareOptions.type,window:this._window});Le.draw(Ne,Te,A,D),Le._element&&$e&&$e.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Se;return!!(!((Se=M[Ve+He])===null||Se===void 0)&&Se[ke+ze])}),Le._element&&$e&&$e.appendChild(Le._element))}if((!((re=f.cornersDotOptions)===null||re===void 0)&&re.gradient||!((ge=f.cornersDotOptions)===null||ge===void 0)&&ge.color)&&(Ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Ie.setAttribute("id",`clip-path-corners-dot-color-${F}-${ce}-${this._instanceId}`),this._defs.appendChild(Ie),this._cornersDotClipPath=Ie,this._createColor({options:(oe=f.cornersDotOptions)===null||oe===void 0?void 0:oe.gradient,color:(fe=f.cornersDotOptions)===null||fe===void 0?void 0:fe.color,additionalRotation:D,x:Ne+2*S,y:Te+2*S,height:b,width:b,name:`corners-dot-color-${F}-${ce}-${this._instanceId}`})),(be=f.cornersDotOptions)===null||be===void 0?void 0:be.type){const Le=new y({svg:this._element,type:f.cornersDotOptions.type,window:this._window});Le.draw(Ne+2*S,Te+2*S,b,D),Le._element&&Ie&&Ie.appendChild(Le._element)}else{const Le=new d({svg:this._element,type:f.dotsOptions.type,window:this._window});for(let Ve=0;Ve{var Se;return!!(!((Se=O[Ve+He])===null||Se===void 0)&&Se[ke+ze])}),Le._element&&Ie&&Ie.appendChild(Le._element))}})}loadImage(){return new Promise((m,f)=>{var g;const v=this._options;if(!v.image)return f("Image is not defined");if(!((g=v.nodeCanvas)===null||g===void 0)&&g.loadImage)v.nodeCanvas.loadImage(v.image).then(x=>{var S,A;if(this._image=x,this._options.imageOptions.saveAsBlob){const b=(S=v.nodeCanvas)===null||S===void 0?void 0:S.createCanvas(this._image.width,this._image.height);(A=b==null?void 0:b.getContext("2d"))===null||A===void 0||A.drawImage(x,0,0),this._imageUri=b==null?void 0:b.toDataURL()}m()}).catch(f);else{const x=new this._window.Image;typeof v.imageOptions.crossOrigin=="string"&&(x.crossOrigin=v.imageOptions.crossOrigin),this._image=x,x.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await async function(S,A){return new Promise(b=>{const P=new A.XMLHttpRequest;P.onload=function(){const I=new A.FileReader;I.onloadend=function(){b(I.result)},I.readAsDataURL(P.response)},P.open("GET",S),P.responseType="blob",P.send()})}(v.image||"",this._window)),m()},x.src=v.image}})}async drawImage({width:m,height:f,count:g,dotSize:v}){const x=this._options,S=this._roundSize((x.width-g*v)/2),A=this._roundSize((x.height-g*v)/2),b=S+this._roundSize(x.imageOptions.margin+(g*v-m)/2),P=A+this._roundSize(x.imageOptions.margin+(g*v-f)/2),I=m-2*x.imageOptions.margin,F=f-2*x.imageOptions.margin,ce=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");ce.setAttribute("href",this._imageUri||""),ce.setAttribute("x",String(b)),ce.setAttribute("y",String(P)),ce.setAttribute("width",`${I}px`),ce.setAttribute("height",`${F}px`),this._element.appendChild(ce)}_createColor({options:m,color:f,additionalRotation:g,x:v,y:x,height:S,width:A,name:b}){const P=A>S?A:S,I=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(I.setAttribute("x",String(v)),I.setAttribute("y",String(x)),I.setAttribute("height",String(S)),I.setAttribute("width",String(A)),I.setAttribute("clip-path",`url('#clip-path-${b}')`),m){let F;if(m.type==="radial")F=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("fx",String(v+A/2)),F.setAttribute("fy",String(x+S/2)),F.setAttribute("cx",String(v+A/2)),F.setAttribute("cy",String(x+S/2)),F.setAttribute("r",String(P/2));else{const ce=((m.rotation||0)+g)%(2*Math.PI),D=(ce+2*Math.PI)%(2*Math.PI);let se=v+A/2,ee=x+S/2,J=v+A/2,Q=x+S/2;D>=0&&D<=.25*Math.PI||D>1.75*Math.PI&&D<=2*Math.PI?(se-=A/2,ee-=S/2*Math.tan(ce),J+=A/2,Q+=S/2*Math.tan(ce)):D>.25*Math.PI&&D<=.75*Math.PI?(ee-=S/2,se-=A/2/Math.tan(ce),Q+=S/2,J+=A/2/Math.tan(ce)):D>.75*Math.PI&&D<=1.25*Math.PI?(se+=A/2,ee+=S/2*Math.tan(ce),J-=A/2,Q-=S/2*Math.tan(ce)):D>1.25*Math.PI&&D<=1.75*Math.PI&&(ee+=S/2,se+=A/2/Math.tan(ce),Q-=S/2,J-=A/2/Math.tan(ce)),F=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),F.setAttribute("id",b),F.setAttribute("gradientUnits","userSpaceOnUse"),F.setAttribute("x1",String(Math.round(se))),F.setAttribute("y1",String(Math.round(ee))),F.setAttribute("x2",String(Math.round(J))),F.setAttribute("y2",String(Math.round(Q)))}m.colorStops.forEach(({offset:ce,color:D})=>{const se=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");se.setAttribute("offset",100*ce+"%"),se.setAttribute("stop-color",D),F.appendChild(se)}),I.setAttribute("fill",`url('#${b}')`),this._defs.appendChild(F)}else f&&I.setAttribute("fill",f);this._element.appendChild(I)}}L.instanceCount=0;const B=L,k="canvas",H={};for(let E=0;E<=40;E++)H[E]=E;const U={type:k,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:H[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function z(E){const m=Object.assign({},E);if(!m.colorStops||!m.colorStops.length)throw"Field 'colorStops' is required in gradient";return m.rotation?m.rotation=Number(m.rotation):m.rotation=0,m.colorStops=m.colorStops.map(f=>Object.assign(Object.assign({},f),{offset:Number(f.offset)})),m}function Z(E){const m=Object.assign({},E);return m.width=Number(m.width),m.height=Number(m.height),m.margin=Number(m.margin),m.imageOptions=Object.assign(Object.assign({},m.imageOptions),{hideBackgroundDots:!!m.imageOptions.hideBackgroundDots,imageSize:Number(m.imageOptions.imageSize),margin:Number(m.imageOptions.margin)}),m.margin>Math.min(m.width,m.height)&&(m.margin=Math.min(m.width,m.height)),m.dotsOptions=Object.assign({},m.dotsOptions),m.dotsOptions.gradient&&(m.dotsOptions.gradient=z(m.dotsOptions.gradient)),m.cornersSquareOptions&&(m.cornersSquareOptions=Object.assign({},m.cornersSquareOptions),m.cornersSquareOptions.gradient&&(m.cornersSquareOptions.gradient=z(m.cornersSquareOptions.gradient))),m.cornersDotOptions&&(m.cornersDotOptions=Object.assign({},m.cornersDotOptions),m.cornersDotOptions.gradient&&(m.cornersDotOptions.gradient=z(m.cornersDotOptions.gradient))),m.backgroundOptions&&(m.backgroundOptions=Object.assign({},m.backgroundOptions),m.backgroundOptions.gradient&&(m.backgroundOptions.gradient=z(m.backgroundOptions.gradient))),m}var R=i(873),W=i.n(R);function ie(E){if(!E)throw new Error("Extension must be defined");E[0]==="."&&(E=E.substring(1));const m={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[E.toLowerCase()];if(!m)throw new Error(`Extension "${E}" is not supported`);return m}class me{constructor(m){m!=null&&m.jsdom?this._window=new m.jsdom("",{resources:"usable"}).window:this._window=window,this._options=m?Z(a(U,m)):U,this.update()}static _clearContainer(m){m&&(m.innerHTML="")}_setupSvg(){if(!this._qr)return;const m=new B(this._options,this._window);this._svg=m.getElement(),this._svgDrawingPromise=m.drawQR(this._qr).then(()=>{var f;this._svg&&((f=this._extension)===null||f===void 0||f.call(this,m.getElement(),this._options))})}_setupCanvas(){var m,f;this._qr&&(!((m=this._options.nodeCanvas)===null||m===void 0)&&m.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(f=this._svgDrawingPromise)===null||f===void 0?void 0:f.then(()=>{var g;if(!this._svg)return;const v=this._svg,x=new this._window.XMLSerializer().serializeToString(v),S=btoa(x),A=`data:${ie("svg")};base64,${S}`;if(!((g=this._options.nodeCanvas)===null||g===void 0)&&g.loadImage)return this._options.nodeCanvas.loadImage(A).then(b=>{var P,I;b.width=this._options.width,b.height=this._options.height,(I=(P=this._nodeCanvas)===null||P===void 0?void 0:P.getContext("2d"))===null||I===void 0||I.drawImage(b,0,0)});{const b=new this._window.Image;return new Promise(P=>{b.onload=()=>{var I,F;(F=(I=this._domCanvas)===null||I===void 0?void 0:I.getContext("2d"))===null||F===void 0||F.drawImage(b,0,0),P()},b.src=A})}}))}async _getElement(m="png"){if(!this._qr)throw"QR code is empty";return m.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(m){me._clearContainer(this._container),this._options=m?Z(a(this._options,m)):this._options,this._options.data&&(this._qr=W()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(f){switch(!0){case/^[0-9]*$/.test(f):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(f):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===k?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(m){if(m){if(typeof m.appendChild!="function")throw"Container should be a single DOM node";this._options.type===k?this._domCanvas&&m.appendChild(this._domCanvas):this._svg&&m.appendChild(this._svg),this._container=m}}applyExtension(m){if(!m)throw"Extension function should be defined.";this._extension=m,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(m="png"){if(!this._qr)throw"QR code is empty";const f=await this._getElement(m),g=ie(m);if(!f)return null;if(m.toLowerCase()==="svg"){const v=`\r -${new this._window.XMLSerializer().serializeToString(f)}`;return typeof Blob>"u"||this._options.jsdom?Buffer.from(v):new Blob([v],{type:g})}return new Promise(v=>{const x=f;if("toBuffer"in x)if(g==="image/png")v(x.toBuffer(g));else if(g==="image/jpeg")v(x.toBuffer(g));else{if(g!=="application/pdf")throw Error("Unsupported extension");v(x.toBuffer(g))}else"toBlob"in x&&x.toBlob(v,g,1)})}async download(m){if(!this._qr)throw"QR code is empty";if(typeof Blob>"u")throw"Cannot download in Node.js, call getRawData instead.";let f="png",g="qr";typeof m=="string"?(f=m,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):typeof m=="object"&&m!==null&&(m.name&&(g=m.name),m.extension&&(f=m.extension));const v=await this._getElement(f);if(v)if(f.toLowerCase()==="svg"){let x=new XMLSerializer().serializeToString(v);x=`\r -`+x,u(`data:${ie(f)};charset=utf-8,${encodeURIComponent(x)}`,`${g}.svg`)}else u(v.toDataURL(ie(f)),`${g}.${f}`)}}const j=me})(),s.default})())})(X7);var qZ=X7.exports;const Z7=ji(qZ);class Ca extends pt{constructor(e){const{docsPath:r,field:n,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${n}".`,{docsPath:r,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}function Q7(t){if(/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t)||/%[^0-9a-f]/i.test(t)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(t))return!1;const e=zZ(t),r=e[1],n=e[2],i=e[3],s=e[4],o=e[5];if(!(r!=null&&r.length&&i.length>=0))return!1;if(n!=null&&n.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9\+\-\.]*$/.test(r.toLowerCase()))return!1;let a="";return a+=`${r}:`,n!=null&&n.length&&(a+=`//${n}`),a+=i,s!=null&&s.length&&(a+=`?${s}`),o!=null&&o.length&&(a+=`#${o}`),a}function zZ(t){return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}function e9(t){const{chainId:e,domain:r,expirationTime:n,issuedAt:i=new Date,nonce:s,notBefore:o,requestId:a,resources:u,scheme:l,uri:d,version:p}=t;{if(e!==Math.floor(e))throw new Ca({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${e}`]});if(!(HZ.test(r)||WZ.test(r)||KZ.test(r)))throw new Ca({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${r}`]});if(!VZ.test(s))throw new Ca({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${s}`]});if(!Q7(d))throw new Ca({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${d}`]});if(p!=="1")throw new Ca({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${p}`]});if(l&&!GZ.test(l))throw new Ca({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${l}`]});const B=t.statement;if(B!=null&&B.includes(` -`))throw new Ca({field:"statement",metaMessages:["- Statement must not include '\\n'.","",`Provided value: ${B}`]})}const y=yg(t.address),_=l?`${l}://${r}`:r,M=t.statement?`${t.statement} -`:"",O=`${_} wants you to sign in with your Ethereum account: -${y} +}`;const YS=Yt.forwardRef(({className:t,containerClassName:e,...r},n)=>he.jsx(GS,{ref:n,containerClassName:ao("xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50",e),className:ao("disabled:xc-cursor-not-allowed",t),...r}));YS.displayName="InputOTP";const JS=Yt.forwardRef(({className:t,...e},r)=>he.jsx("div",{ref:r,className:ao("xc-flex xc-items-center",t),...e}));JS.displayName="InputOTPGroup";const Ka=Yt.forwardRef(({index:t,className:e,...r},n)=>{const i=Yt.useContext(VS),{char:s,hasFakeCaret:o,isActive:a}=i.slots[t];return he.jsxs("div",{ref:n,className:ao("xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all",a&&"xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background",e),...r,children:[s,o&&he.jsx("div",{className:"xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center",children:he.jsx("div",{className:"xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000"})})]})});Ka.displayName="InputOTPSlot";function fY(t){const{spinning:e,children:r,className:n}=t;return he.jsxs("div",{className:"xc-inline-block xc-relative",children:[r,e&&he.jsx("div",{className:ao("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center",n),children:he.jsx(Fa,{className:"xc-animate-spin"})})]})}function XS(t){const{email:e}=t,[r,n]=Se.useState(0),[i,s]=Se.useState(!1),[o,a]=Se.useState("");async function f(){n(60);const h=setInterval(()=>{n(g=>g===0?(clearInterval(h),0):g-1)},1e3)}async function u(h){if(a(""),!(h.length<6)){s(!0);try{await t.onInputCode(e,h)}catch(g){a(g.message)}s(!1)}}return Se.useEffect(()=>{f()},[]),he.jsxs(ls,{children:[he.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[he.jsx(Uz,{className:"xc-mb-4",size:60}),he.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16",children:[he.jsx("p",{className:"xc-text-lg xc-mb-1",children:"We’ve sent a verification code to"}),he.jsx("p",{className:"xc-font-bold xc-text-center",children:e})]}),he.jsx("div",{className:"xc-mb-2 xc-h-12",children:he.jsx(fY,{spinning:i,className:"xc-rounded-xl",children:he.jsx(YS,{maxLength:6,onChange:u,disabled:i,className:"disabled:xc-opacity-20",children:he.jsx(JS,{children:he.jsxs("div",{className:ao("xc-flex xc-gap-2",i?"xc-opacity-20":""),children:[he.jsx(Ka,{index:0}),he.jsx(Ka,{index:1}),he.jsx(Ka,{index:2}),he.jsx(Ka,{index:3}),he.jsx(Ka,{index:4}),he.jsx(Ka,{index:5})]})})})})}),o&&he.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:he.jsx("p",{children:o})})]}),he.jsxs("div",{className:"xc-text-center xc-text-sm xc-text-gray-400",children:["Not get it? ",r?`Resend in ${r}s`:he.jsx("button",{id:"sendCodeButton",onClick:t.onResendCode,children:"Send again"})]}),he.jsx("div",{id:"captcha-element"})]})}function ZS(t){const{email:e}=t,[r,n]=Se.useState(!1),[i,s]=Se.useState(""),o=Se.useMemo(()=>`xn-btn-${new Date().getTime()}`,[e]);async function a(b,x){n(!0),s(""),await Fo.getEmailCode({account_type:"email",email:b},x),n(!1)}async function f(b){try{return await a(e,JSON.stringify(b)),{captchaResult:!0,bizResult:!0}}catch(x){return s(x.message),{captchaResult:!1,bizResult:!1}}}async function u(b){b&&t.onCodeSend()}const h=Se.useRef();function g(b){h.current=b}return Se.useEffect(()=>{if(e)return window.initAliyunCaptcha({SceneId:"tqyu8129d",prefix:"1mfsn5f",mode:"popup",element:"#captcha-element",button:`#${o}`,captchaVerifyCallback:f,onBizResultCallback:u,getInstance:g,slideStyle:{width:360,height:40},language:"en",region:"cn"}),()=>{document.getElementById("aliyunCaptcha-mask")?.remove(),document.getElementById("aliyunCaptcha-window-popup")?.remove()}},[e]),he.jsxs(ls,{children:[he.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12",children:[he.jsx($z,{className:"xc-mb-4",size:60}),he.jsx("button",{className:"xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2",id:o,children:r?he.jsx(Fa,{className:"xc-animate-spin"}):"I'm not a robot"})]}),i&&he.jsx("div",{className:"xc-text-[#ff0000] xc-text-center",children:he.jsx("p",{children:i})})]})}function lY(t){const{email:e}=t,r=F1(),[n,i]=Se.useState("captcha");async function s(o,a){const f=await Fo.emailLogin({account_type:"email",connector:"codatta_email",account_enum:"C",email_code:a,email:o,inviter_code:r.inviterCode,source:{device:r.device,channel:r.channel,app:r.app}});t.onLogin(f.data)}return he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-12",children:he.jsx(Wa,{title:"Sign in with email",onBack:t.onBack})}),n==="captcha"&&he.jsx(ZS,{email:e,onCodeSend:()=>i("verify-email")}),n==="verify-email"&&he.jsx(XS,{email:e,onInputCode:s,onResendCode:()=>i("captcha")})]})}var zd={exports:{}},hY=zd.exports,QS;function dY(){return QS||(QS=1,(function(t,e){(function(r,n){t.exports=n()})(hY,(()=>(()=>{var r={873:(o,a)=>{var f,u,h=(function(){var g=function(l,p){var m=l,y=B[p],A=null,E=0,w=null,I=[],M={},z=function(ne,de){A=(function(ce){for(var fe=new Array(ce),be=0;be=7&&ee(ne),w==null&&(w=N(m,y,I)),te(w,de)},se=function(ne,de){for(var ce=-1;ce<=7;ce+=1)if(!(ne+ce<=-1||E<=ne+ce))for(var fe=-1;fe<=7;fe+=1)de+fe<=-1||E<=de+fe||(A[ne+ce][de+fe]=0<=ce&&ce<=6&&(fe==0||fe==6)||0<=fe&&fe<=6&&(ce==0||ce==6)||2<=ce&&ce<=4&&2<=fe&&fe<=4)},O=function(){for(var ne=8;ne>ce&1)==1;A[Math.floor(ce/3)][ce%3+E-8-3]=fe}for(ce=0;ce<18;ce+=1)fe=!ne&&(de>>ce&1)==1,A[ce%3+E-8-3][Math.floor(ce/3)]=fe},Z=function(ne,de){for(var ce=y<<3|de,fe=L.getBCHTypeInfo(ce),be=0;be<15;be+=1){var Pe=!ne&&(fe>>be&1)==1;be<6?A[be][8]=Pe:be<8?A[be+1][8]=Pe:A[E-15+be][8]=Pe}for(be=0;be<15;be+=1)Pe=!ne&&(fe>>be&1)==1,be<8?A[8][E-be-1]=Pe:be<9?A[8][15-be-1+1]=Pe:A[8][15-be-1]=Pe;A[E-8][8]=!ne},te=function(ne,de){for(var ce=-1,fe=E-1,be=7,Pe=0,De=L.getMaskFunction(de),Te=E-1;Te>0;Te-=2)for(Te==6&&(Te-=1);;){for(var Fe=0;Fe<2;Fe+=1)if(A[fe][Te-Fe]==null){var Me=!1;Pe>>be&1)==1),De(fe,Te-Fe)&&(Me=!Me),A[fe][Te-Fe]=Me,(be-=1)==-1&&(Pe+=1,be=7)}if((fe+=ce)<0||E<=fe){fe-=ce,ce=-ce;break}}},N=function(ne,de,ce){for(var fe=k.getRSBlocks(ne,de),be=$(),Pe=0;Pe8*Te)throw"code length overflow. ("+be.getLengthInBits()+">"+8*Te+")";for(be.getLengthInBits()+4<=8*Te&&be.put(0,4);be.getLengthInBits()%8!=0;)be.putBit(!1);for(;!(be.getLengthInBits()>=8*Te||(be.put(236,8),be.getLengthInBits()>=8*Te));)be.put(17,8);return(function(Fe,Me){for(var Ne=0,He=0,Oe=0,$e=new Array(Me.length),qe=new Array(Me.length),_e=0;_e=0?it.getAt(Ye):0}}var pt=0;for(Be=0;BeMe)&&(De=Me,Te=Fe)}return Te})())},M.createTableTag=function(ne,de){ne=ne||2;var ce="";ce+='";for(var be=0;be';ce+=""}return(ce+="")+"
"},M.createSvgTag=function(ne,de,ce,fe){var be={};typeof arguments[0]=="object"&&(ne=(be=arguments[0]).cellSize,de=be.margin,ce=be.alt,fe=be.title),ne=ne||2,de=de===void 0?4*ne:de,(ce=typeof ce=="string"?{text:ce}:ce||{}).text=ce.text||null,ce.id=ce.text?ce.id||"qrcode-description":null,(fe=typeof fe=="string"?{text:fe}:fe||{}).text=fe.text||null,fe.id=fe.text?fe.id||"qrcode-title":null;var Pe,De,Te,Fe,Me=M.getModuleCount()*ne+2*de,Ne="";for(Fe="l"+ne+",0 0,"+ne+" -"+ne+",0 0,-"+ne+"z ",Ne+=''+Q(fe.text)+"":"",Ne+=ce.text?''+Q(ce.text)+"":"",Ne+='',Ne+='"},M.createDataURL=function(ne,de){ne=ne||2,de=de===void 0?4*ne:de;var ce=M.getModuleCount()*ne+2*de,fe=de,be=ce-de;return v(ce,ce,(function(Pe,De){if(fe<=Pe&&Pe"};var Q=function(ne){for(var de="",ce=0;ce":de+=">";break;case"&":de+="&";break;case'"':de+=""";break;default:de+=fe}}return de};return M.createASCII=function(ne,de){if((ne=ne||1)<2)return(function($e){$e=$e===void 0?2:$e;var qe,_e,Qe,at,Be,nt=1*M.getModuleCount()+2*$e,it=$e,Ye=nt-$e,pt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ht={"██":"▀","█ ":"▀"," █":" "," ":" "},ft="";for(qe=0;qe=Ye?ht[Be]:pt[Be];ft+=` +`}return nt%2&&$e>0?ft.substring(0,ft.length-nt-1)+Array(nt+1).join("▀"):ft.substring(0,ft.length-1)})(de);ne-=1,de=de===void 0?2*ne:de;var ce,fe,be,Pe,De=M.getModuleCount()*ne+2*de,Te=de,Fe=De-de,Me=Array(ne+1).join("██"),Ne=Array(ne+1).join(" "),He="",Oe="";for(ce=0;ce>>8),E.push(255&M)):E.push(y)}}return E}};var b,x,S,C,D,B={L:1,M:0,Q:3,H:2},L=(b=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],x=1335,S=7973,D=function(l){for(var p=0;l!=0;)p+=1,l>>>=1;return p},(C={}).getBCHTypeInfo=function(l){for(var p=l<<10;D(p)-D(x)>=0;)p^=x<=0;)p^=S<5&&(m+=3+E-5)}for(y=0;y=256;)y-=255;return l[y]}}})();function F(l,p){if(l.length===void 0)throw l.length+"/"+p;var m=(function(){for(var A=0;A>>7-y%8&1)==1},put:function(y,A){for(var E=0;E>>A-E-1&1)==1)},getLengthInBits:function(){return p},putBit:function(y){var A=Math.floor(p/8);l.length<=A&&l.push(0),y&&(l[A]|=128>>>p%8),p+=1}};return m},R=function(l){var p=l,m={getMode:function(){return 1},getLength:function(E){return p.length},write:function(E){for(var w=p,I=0;I+2>>8&255)+(255&I),A.put(I,13),w+=2}if(w>>8)},writeBytes:function(m,y,A){y=y||0,A=A||m.length;for(var E=0;E0&&(m+=","),m+=l[y];return m+"]"}};return p},_=function(l){var p=l,m=0,y=0,A=0,E={read:function(){for(;A<8;){if(m>=p.length){if(A==0)return-1;throw"unexpected end of file./"+A}var I=p.charAt(m);if(m+=1,I=="=")return A=0,-1;I.match(/^\s$/)||(y=y<<6|w(I.charCodeAt(0)),A+=6)}var M=y>>>A-8&255;return A-=8,M}},w=function(I){if(65<=I&&I<=90)return I-65;if(97<=I&&I<=122)return I-97+26;if(48<=I&&I<=57)return I-48+52;if(I==43)return 62;if(I==47)return 63;throw"c:"+I};return E},v=function(l,p,m){for(var y=(function(se,O){var ie=se,ee=O,Z=new Array(se*O),te={setPixel:function(ne,de,ce){Z[de*ie+ne]=ce},write:function(ne){ne.writeString("GIF87a"),ne.writeShort(ie),ne.writeShort(ee),ne.writeByte(128),ne.writeByte(0),ne.writeByte(0),ne.writeByte(0),ne.writeByte(0),ne.writeByte(0),ne.writeByte(255),ne.writeByte(255),ne.writeByte(255),ne.writeString(","),ne.writeShort(0),ne.writeShort(0),ne.writeShort(ie),ne.writeShort(ee),ne.writeByte(0);var de=N(2);ne.writeByte(2);for(var ce=0;de.length-ce>255;)ne.writeByte(255),ne.writeBytes(de,ce,255),ce+=255;ne.writeByte(de.length-ce),ne.writeBytes(de,ce,de.length-ce),ne.writeByte(0),ne.writeString(";")}},N=function(ne){for(var de=1<>>_e)throw"length over";for(;Te+_e>=8;)De.writeByte(255&(qe<>>=8-Te,Fe=0,Te=0;Fe|=qe<0&&De.writeByte(Fe)}});Ne.write(de,fe);var He=0,Oe=String.fromCharCode(Z[He]);for(He+=1;He=6;)te(se>>>O-6),O-=6},Z.flush=function(){if(O>0&&(te(se<<6-O),se=0,O=0),ie%3!=0)for(var Q=3-ie%3,ne=0;ne>6,128|63&C):C<55296||C>=57344?x.push(224|C>>12,128|C>>6&63,128|63&C):(S++,C=65536+((1023&C)<<10|1023&b.charCodeAt(S)),x.push(240|C>>18,128|C>>12&63,128|C>>6&63,128|63&C))}return x})(g)},(u=typeof(f=function(){return h})=="function"?f.apply(a,[]):f)===void 0||(o.exports=u)}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var f=n[o]={exports:{}};return r[o](f,f.exports,i),f.exports}i.n=o=>{var a=o&&o.__esModule?()=>o.default:()=>o;return i.d(a,{a}),a},i.d=(o,a)=>{for(var f in a)i.o(a,f)&&!i.o(o,f)&&Object.defineProperty(o,f,{enumerable:!0,get:a[f]})},i.o=(o,a)=>Object.prototype.hasOwnProperty.call(o,a);var s={};return(()=>{i.d(s,{default:()=>q});const o=_=>!!_&&typeof _=="object"&&!Array.isArray(_);function a(_,...v){if(!v.length)return _;const l=v.shift();return l!==void 0&&o(_)&&o(l)?(_=Object.assign({},_),Object.keys(l).forEach((p=>{const m=_[p],y=l[p];Array.isArray(m)&&Array.isArray(y)?_[p]=y:o(m)&&o(y)?_[p]=a(Object.assign({},m),y):_[p]=y})),a(_,...v)):_}function f(_,v){const l=document.createElement("a");l.download=v,l.href=_,document.body.appendChild(l),l.click(),document.body.removeChild(l)}const u={L:.07,M:.15,Q:.25,H:.3};class h{constructor({svg:v,type:l,window:p}){this._svg=v,this._type=l,this._window=p}draw(v,l,p,m){let y;switch(this._type){case"dots":y=this._drawDot;break;case"classy":y=this._drawClassy;break;case"classy-rounded":y=this._drawClassyRounded;break;case"rounded":y=this._drawRounded;break;case"extra-rounded":y=this._drawExtraRounded;break;default:y=this._drawSquare}y.call(this,{x:v,y:l,size:p,getNeighbor:m})}_rotateFigure({x:v,y:l,size:p,rotation:m=0,draw:y}){var A;const E=v+p/2,w=l+p/2;y(),(A=this._element)===null||A===void 0||A.setAttribute("transform",`rotate(${180*m/Math.PI},${E},${w})`)}_basicDot(v){const{size:l,x:p,y:m}=v;this._rotateFigure(Object.assign(Object.assign({},v),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(p+l/2)),this._element.setAttribute("cy",String(m+l/2)),this._element.setAttribute("r",String(l/2))}}))}_basicSquare(v){const{size:l,x:p,y:m}=v;this._rotateFigure(Object.assign(Object.assign({},v),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(p)),this._element.setAttribute("y",String(m)),this._element.setAttribute("width",String(l)),this._element.setAttribute("height",String(l))}}))}_basicSideRounded(v){const{size:l,x:p,y:m}=v;this._rotateFigure(Object.assign(Object.assign({},v),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${m}v ${l}h `+l/2+`a ${l/2} ${l/2}, 0, 0, 0, 0 ${-l}`)}}))}_basicCornerRounded(v){const{size:l,x:p,y:m}=v;this._rotateFigure(Object.assign(Object.assign({},v),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${m}v ${l}h ${l}v `+-l/2+`a ${l/2} ${l/2}, 0, 0, 0, ${-l/2} ${-l/2}`)}}))}_basicCornerExtraRounded(v){const{size:l,x:p,y:m}=v;this._rotateFigure(Object.assign(Object.assign({},v),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${m}v ${l}h ${l}a ${l} ${l}, 0, 0, 0, ${-l} ${-l}`)}}))}_basicCornersRounded(v){const{size:l,x:p,y:m}=v;this._rotateFigure(Object.assign(Object.assign({},v),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${p} ${m}v `+l/2+`a ${l/2} ${l/2}, 0, 0, 0, ${l/2} ${l/2}h `+l/2+"v "+-l/2+`a ${l/2} ${l/2}, 0, 0, 0, ${-l/2} ${-l/2}`)}}))}_drawDot({x:v,y:l,size:p}){this._basicDot({x:v,y:l,size:p,rotation:0})}_drawSquare({x:v,y:l,size:p}){this._basicSquare({x:v,y:l,size:p,rotation:0})}_drawRounded({x:v,y:l,size:p,getNeighbor:m}){const y=m?+m(-1,0):0,A=m?+m(1,0):0,E=m?+m(0,-1):0,w=m?+m(0,1):0,I=y+A+E+w;if(I!==0)if(I>2||y&&A||E&&w)this._basicSquare({x:v,y:l,size:p,rotation:0});else{if(I===2){let M=0;return y&&E?M=Math.PI/2:E&&A?M=Math.PI:A&&w&&(M=-Math.PI/2),void this._basicCornerRounded({x:v,y:l,size:p,rotation:M})}if(I===1){let M=0;return E?M=Math.PI/2:A?M=Math.PI:w&&(M=-Math.PI/2),void this._basicSideRounded({x:v,y:l,size:p,rotation:M})}}else this._basicDot({x:v,y:l,size:p,rotation:0})}_drawExtraRounded({x:v,y:l,size:p,getNeighbor:m}){const y=m?+m(-1,0):0,A=m?+m(1,0):0,E=m?+m(0,-1):0,w=m?+m(0,1):0,I=y+A+E+w;if(I!==0)if(I>2||y&&A||E&&w)this._basicSquare({x:v,y:l,size:p,rotation:0});else{if(I===2){let M=0;return y&&E?M=Math.PI/2:E&&A?M=Math.PI:A&&w&&(M=-Math.PI/2),void this._basicCornerExtraRounded({x:v,y:l,size:p,rotation:M})}if(I===1){let M=0;return E?M=Math.PI/2:A?M=Math.PI:w&&(M=-Math.PI/2),void this._basicSideRounded({x:v,y:l,size:p,rotation:M})}}else this._basicDot({x:v,y:l,size:p,rotation:0})}_drawClassy({x:v,y:l,size:p,getNeighbor:m}){const y=m?+m(-1,0):0,A=m?+m(1,0):0,E=m?+m(0,-1):0,w=m?+m(0,1):0;y+A+E+w!==0?y||E?A||w?this._basicSquare({x:v,y:l,size:p,rotation:0}):this._basicCornerRounded({x:v,y:l,size:p,rotation:Math.PI/2}):this._basicCornerRounded({x:v,y:l,size:p,rotation:-Math.PI/2}):this._basicCornersRounded({x:v,y:l,size:p,rotation:Math.PI/2})}_drawClassyRounded({x:v,y:l,size:p,getNeighbor:m}){const y=m?+m(-1,0):0,A=m?+m(1,0):0,E=m?+m(0,-1):0,w=m?+m(0,1):0;y+A+E+w!==0?y||E?A||w?this._basicSquare({x:v,y:l,size:p,rotation:0}):this._basicCornerExtraRounded({x:v,y:l,size:p,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:v,y:l,size:p,rotation:-Math.PI/2}):this._basicCornersRounded({x:v,y:l,size:p,rotation:Math.PI/2})}}class g{constructor({svg:v,type:l,window:p}){this._svg=v,this._type=l,this._window=p}draw(v,l,p,m){let y;switch(this._type){case"square":y=this._drawSquare;break;case"extra-rounded":y=this._drawExtraRounded;break;default:y=this._drawDot}y.call(this,{x:v,y:l,size:p,rotation:m})}_rotateFigure({x:v,y:l,size:p,rotation:m=0,draw:y}){var A;const E=v+p/2,w=l+p/2;y(),(A=this._element)===null||A===void 0||A.setAttribute("transform",`rotate(${180*m/Math.PI},${E},${w})`)}_basicDot(v){const{size:l,x:p,y:m}=v,y=l/7;this._rotateFigure(Object.assign(Object.assign({},v),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p+l/2} ${m}a ${l/2} ${l/2} 0 1 0 0.1 0zm 0 ${y}a ${l/2-y} ${l/2-y} 0 1 1 -0.1 0Z`)}}))}_basicSquare(v){const{size:l,x:p,y:m}=v,y=l/7;this._rotateFigure(Object.assign(Object.assign({},v),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p} ${m}v ${l}h ${l}v `+-l+`zM ${p+y} ${m+y}h `+(l-2*y)+"v "+(l-2*y)+"h "+(2*y-l)+"z")}}))}_basicExtraRounded(v){const{size:l,x:p,y:m}=v,y=l/7;this._rotateFigure(Object.assign(Object.assign({},v),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${p} ${m+2.5*y}v `+2*y+`a ${2.5*y} ${2.5*y}, 0, 0, 0, ${2.5*y} ${2.5*y}h `+2*y+`a ${2.5*y} ${2.5*y}, 0, 0, 0, ${2.5*y} ${2.5*-y}v `+-2*y+`a ${2.5*y} ${2.5*y}, 0, 0, 0, ${2.5*-y} ${2.5*-y}h `+-2*y+`a ${2.5*y} ${2.5*y}, 0, 0, 0, ${2.5*-y} ${2.5*y}M ${p+2.5*y} ${m+y}h `+2*y+`a ${1.5*y} ${1.5*y}, 0, 0, 1, ${1.5*y} ${1.5*y}v `+2*y+`a ${1.5*y} ${1.5*y}, 0, 0, 1, ${1.5*-y} ${1.5*y}h `+-2*y+`a ${1.5*y} ${1.5*y}, 0, 0, 1, ${1.5*-y} ${1.5*-y}v `+-2*y+`a ${1.5*y} ${1.5*y}, 0, 0, 1, ${1.5*y} ${1.5*-y}`)}}))}_drawDot({x:v,y:l,size:p,rotation:m}){this._basicDot({x:v,y:l,size:p,rotation:m})}_drawSquare({x:v,y:l,size:p,rotation:m}){this._basicSquare({x:v,y:l,size:p,rotation:m})}_drawExtraRounded({x:v,y:l,size:p,rotation:m}){this._basicExtraRounded({x:v,y:l,size:p,rotation:m})}}class b{constructor({svg:v,type:l,window:p}){this._svg=v,this._type=l,this._window=p}draw(v,l,p,m){let y;y=this._type==="square"?this._drawSquare:this._drawDot,y.call(this,{x:v,y:l,size:p,rotation:m})}_rotateFigure({x:v,y:l,size:p,rotation:m=0,draw:y}){var A;const E=v+p/2,w=l+p/2;y(),(A=this._element)===null||A===void 0||A.setAttribute("transform",`rotate(${180*m/Math.PI},${E},${w})`)}_basicDot(v){const{size:l,x:p,y:m}=v;this._rotateFigure(Object.assign(Object.assign({},v),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(p+l/2)),this._element.setAttribute("cy",String(m+l/2)),this._element.setAttribute("r",String(l/2))}}))}_basicSquare(v){const{size:l,x:p,y:m}=v;this._rotateFigure(Object.assign(Object.assign({},v),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(p)),this._element.setAttribute("y",String(m)),this._element.setAttribute("width",String(l)),this._element.setAttribute("height",String(l))}}))}_drawDot({x:v,y:l,size:p,rotation:m}){this._basicDot({x:v,y:l,size:p,rotation:m})}_drawSquare({x:v,y:l,size:p,rotation:m}){this._basicSquare({x:v,y:l,size:p,rotation:m})}}const x="circle",S=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],C=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class D{constructor(v,l){this._roundSize=p=>this._options.dotsOptions.roundSize?Math.floor(p):p,this._window=l,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(v.width)),this._element.setAttribute("height",String(v.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),v.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${v.width} ${v.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=v.image,this._instanceId=D.instanceCount++,this._options=v}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(v){const l=v.getModuleCount(),p=Math.min(this._options.width,this._options.height)-2*this._options.margin,m=this._options.shape===x?p/Math.sqrt(2):p,y=this._roundSize(m/l);let A={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=v,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:E,qrOptions:w}=this._options,I=E.imageSize*u[w.errorCorrectionLevel],M=Math.floor(I*l*l);A=(function({originalHeight:z,originalWidth:se,maxHiddenDots:O,maxHiddenAxisDots:ie,dotSize:ee}){const Z={x:0,y:0},te={x:0,y:0};if(z<=0||se<=0||O<=0||ee<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const N=z/se;return Z.x=Math.floor(Math.sqrt(O/N)),Z.x<=0&&(Z.x=1),ie&&ieO||ie&&ie{var I,M,z,se,O,ie;return!(this._options.imageOptions.hideBackgroundDots&&E>=(l-A.hideYDots)/2&&E<(l+A.hideYDots)/2&&w>=(l-A.hideXDots)/2&&w<(l+A.hideXDots)/2||!((I=S[E])===null||I===void 0)&&I[w]||!((M=S[E-l+7])===null||M===void 0)&&M[w]||!((z=S[E])===null||z===void 0)&&z[w-l+7]||!((se=C[E])===null||se===void 0)&&se[w]||!((O=C[E-l+7])===null||O===void 0)&&O[w]||!((ie=C[E])===null||ie===void 0)&&ie[w-l+7])})),this.drawCorners(),this._options.image&&await this.drawImage({width:A.width,height:A.height,count:l,dotSize:y})}drawBackground(){var v,l,p;const m=this._element,y=this._options;if(m){const A=(v=y.backgroundOptions)===null||v===void 0?void 0:v.gradient,E=(l=y.backgroundOptions)===null||l===void 0?void 0:l.color;let w=y.height,I=y.width;if(A||E){const M=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((p=y.backgroundOptions)===null||p===void 0)&&p.round&&(w=I=Math.min(y.width,y.height),M.setAttribute("rx",String(w/2*y.backgroundOptions.round))),M.setAttribute("x",String(this._roundSize((y.width-I)/2))),M.setAttribute("y",String(this._roundSize((y.height-w)/2))),M.setAttribute("width",String(I)),M.setAttribute("height",String(w)),this._backgroundClipPath.appendChild(M),this._createColor({options:A,color:E,additionalRotation:0,x:0,y:0,height:y.height,width:y.width,name:`background-color-${this._instanceId}`})}}}drawDots(v){var l,p;if(!this._qr)throw"QR code is not defined";const m=this._options,y=this._qr.getModuleCount();if(y>m.width||y>m.height)throw"The canvas is too small.";const A=Math.min(m.width,m.height)-2*m.margin,E=m.shape===x?A/Math.sqrt(2):A,w=this._roundSize(E/y),I=this._roundSize((m.width-y*w)/2),M=this._roundSize((m.height-y*w)/2),z=new h({svg:this._element,type:m.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(l=m.dotsOptions)===null||l===void 0?void 0:l.gradient,color:m.dotsOptions.color,additionalRotation:0,x:0,y:0,height:m.height,width:m.width,name:`dot-color-${this._instanceId}`});for(let se=0;se!(O+ie<0||se+ee<0||O+ie>=y||se+ee>=y)&&!(v&&!v(se+ee,O+ie))&&!!this._qr&&this._qr.isDark(se+ee,O+ie))),z._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(z._element));if(m.shape===x){const se=this._roundSize((A/w-y)/2),O=y+2*se,ie=I-se*w,ee=M-se*w,Z=[],te=this._roundSize(O/2);for(let N=0;N=se-1&&N<=O-se&&Q>=se-1&&Q<=O-se||Math.sqrt((N-te)*(N-te)+(Q-te)*(Q-te))>te?Z[N][Q]=0:Z[N][Q]=this._qr.isDark(Q-2*se<0?Q:Q>=y?Q-2*se:Q-se,N-2*se<0?N:N>=y?N-2*se:N-se)?1:0}for(let N=0;N{var ce;return!!(!((ce=Z[N+de])===null||ce===void 0)&&ce[Q+ne])})),z._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(z._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const v=this._element,l=this._options;if(!v)throw"Element code is not defined";const p=this._qr.getModuleCount(),m=Math.min(l.width,l.height)-2*l.margin,y=l.shape===x?m/Math.sqrt(2):m,A=this._roundSize(y/p),E=7*A,w=3*A,I=this._roundSize((l.width-p*A)/2),M=this._roundSize((l.height-p*A)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach((([z,se,O])=>{var ie,ee,Z,te,N,Q,ne,de,ce,fe,be,Pe;const De=I+z*A*(p-7),Te=M+se*A*(p-7);let Fe=this._dotsClipPath,Me=this._dotsClipPath;if((!((ie=l.cornersSquareOptions)===null||ie===void 0)&&ie.gradient||!((ee=l.cornersSquareOptions)===null||ee===void 0)&&ee.color)&&(Fe=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Fe.setAttribute("id",`clip-path-corners-square-color-${z}-${se}-${this._instanceId}`),this._defs.appendChild(Fe),this._cornersSquareClipPath=this._cornersDotClipPath=Me=Fe,this._createColor({options:(Z=l.cornersSquareOptions)===null||Z===void 0?void 0:Z.gradient,color:(te=l.cornersSquareOptions)===null||te===void 0?void 0:te.color,additionalRotation:O,x:De,y:Te,height:E,width:E,name:`corners-square-color-${z}-${se}-${this._instanceId}`})),(N=l.cornersSquareOptions)===null||N===void 0?void 0:N.type){const Ne=new g({svg:this._element,type:l.cornersSquareOptions.type,window:this._window});Ne.draw(De,Te,E,O),Ne._element&&Fe&&Fe.appendChild(Ne._element)}else{const Ne=new h({svg:this._element,type:l.dotsOptions.type,window:this._window});for(let He=0;He{var _e;return!!(!((_e=S[He+qe])===null||_e===void 0)&&_e[Oe+$e])})),Ne._element&&Fe&&Fe.appendChild(Ne._element))}if((!((ne=l.cornersDotOptions)===null||ne===void 0)&&ne.gradient||!((de=l.cornersDotOptions)===null||de===void 0)&&de.color)&&(Me=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Me.setAttribute("id",`clip-path-corners-dot-color-${z}-${se}-${this._instanceId}`),this._defs.appendChild(Me),this._cornersDotClipPath=Me,this._createColor({options:(ce=l.cornersDotOptions)===null||ce===void 0?void 0:ce.gradient,color:(fe=l.cornersDotOptions)===null||fe===void 0?void 0:fe.color,additionalRotation:O,x:De+2*A,y:Te+2*A,height:w,width:w,name:`corners-dot-color-${z}-${se}-${this._instanceId}`})),(be=l.cornersDotOptions)===null||be===void 0?void 0:be.type){const Ne=new b({svg:this._element,type:l.cornersDotOptions.type,window:this._window});Ne.draw(De+2*A,Te+2*A,w,O),Ne._element&&Me&&Me.appendChild(Ne._element)}else{const Ne=new h({svg:this._element,type:l.dotsOptions.type,window:this._window});for(let He=0;He{var _e;return!!(!((_e=C[He+qe])===null||_e===void 0)&&_e[Oe+$e])})),Ne._element&&Me&&Me.appendChild(Ne._element))}}))}loadImage(){return new Promise(((v,l)=>{var p;const m=this._options;if(!m.image)return l("Image is not defined");if(!((p=m.nodeCanvas)===null||p===void 0)&&p.loadImage)m.nodeCanvas.loadImage(m.image).then((y=>{var A,E;if(this._image=y,this._options.imageOptions.saveAsBlob){const w=(A=m.nodeCanvas)===null||A===void 0?void 0:A.createCanvas(this._image.width,this._image.height);(E=w?.getContext("2d"))===null||E===void 0||E.drawImage(y,0,0),this._imageUri=w?.toDataURL()}v()})).catch(l);else{const y=new this._window.Image;typeof m.imageOptions.crossOrigin=="string"&&(y.crossOrigin=m.imageOptions.crossOrigin),this._image=y,y.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await(async function(A,E){return new Promise((w=>{const I=new E.XMLHttpRequest;I.onload=function(){const M=new E.FileReader;M.onloadend=function(){w(M.result)},M.readAsDataURL(I.response)},I.open("GET",A),I.responseType="blob",I.send()}))})(m.image||"",this._window)),v()},y.src=m.image}}))}async drawImage({width:v,height:l,count:p,dotSize:m}){const y=this._options,A=this._roundSize((y.width-p*m)/2),E=this._roundSize((y.height-p*m)/2),w=A+this._roundSize(y.imageOptions.margin+(p*m-v)/2),I=E+this._roundSize(y.imageOptions.margin+(p*m-l)/2),M=v-2*y.imageOptions.margin,z=l-2*y.imageOptions.margin,se=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");se.setAttribute("href",this._imageUri||""),se.setAttribute("x",String(w)),se.setAttribute("y",String(I)),se.setAttribute("width",`${M}px`),se.setAttribute("height",`${z}px`),this._element.appendChild(se)}_createColor({options:v,color:l,additionalRotation:p,x:m,y,height:A,width:E,name:w}){const I=E>A?E:A,M=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(M.setAttribute("x",String(m)),M.setAttribute("y",String(y)),M.setAttribute("height",String(A)),M.setAttribute("width",String(E)),M.setAttribute("clip-path",`url('#clip-path-${w}')`),v){let z;if(v.type==="radial")z=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),z.setAttribute("id",w),z.setAttribute("gradientUnits","userSpaceOnUse"),z.setAttribute("fx",String(m+E/2)),z.setAttribute("fy",String(y+A/2)),z.setAttribute("cx",String(m+E/2)),z.setAttribute("cy",String(y+A/2)),z.setAttribute("r",String(I/2));else{const se=((v.rotation||0)+p)%(2*Math.PI),O=(se+2*Math.PI)%(2*Math.PI);let ie=m+E/2,ee=y+A/2,Z=m+E/2,te=y+A/2;O>=0&&O<=.25*Math.PI||O>1.75*Math.PI&&O<=2*Math.PI?(ie-=E/2,ee-=A/2*Math.tan(se),Z+=E/2,te+=A/2*Math.tan(se)):O>.25*Math.PI&&O<=.75*Math.PI?(ee-=A/2,ie-=E/2/Math.tan(se),te+=A/2,Z+=E/2/Math.tan(se)):O>.75*Math.PI&&O<=1.25*Math.PI?(ie+=E/2,ee+=A/2*Math.tan(se),Z-=E/2,te-=A/2*Math.tan(se)):O>1.25*Math.PI&&O<=1.75*Math.PI&&(ee+=A/2,ie+=E/2/Math.tan(se),te-=A/2,Z-=E/2/Math.tan(se)),z=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),z.setAttribute("id",w),z.setAttribute("gradientUnits","userSpaceOnUse"),z.setAttribute("x1",String(Math.round(ie))),z.setAttribute("y1",String(Math.round(ee))),z.setAttribute("x2",String(Math.round(Z))),z.setAttribute("y2",String(Math.round(te)))}v.colorStops.forEach((({offset:se,color:O})=>{const ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");ie.setAttribute("offset",100*se+"%"),ie.setAttribute("stop-color",O),z.appendChild(ie)})),M.setAttribute("fill",`url('#${w}')`),this._defs.appendChild(z)}else l&&M.setAttribute("fill",l);this._element.appendChild(M)}}D.instanceCount=0;const B=D,L="canvas",H={};for(let _=0;_<=40;_++)H[_]=_;const F={type:L,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:H[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function k(_){const v=Object.assign({},_);if(!v.colorStops||!v.colorStops.length)throw"Field 'colorStops' is required in gradient";return v.rotation?v.rotation=Number(v.rotation):v.rotation=0,v.colorStops=v.colorStops.map((l=>Object.assign(Object.assign({},l),{offset:Number(l.offset)}))),v}function $(_){const v=Object.assign({},_);return v.width=Number(v.width),v.height=Number(v.height),v.margin=Number(v.margin),v.imageOptions=Object.assign(Object.assign({},v.imageOptions),{hideBackgroundDots:!!v.imageOptions.hideBackgroundDots,imageSize:Number(v.imageOptions.imageSize),margin:Number(v.imageOptions.margin)}),v.margin>Math.min(v.width,v.height)&&(v.margin=Math.min(v.width,v.height)),v.dotsOptions=Object.assign({},v.dotsOptions),v.dotsOptions.gradient&&(v.dotsOptions.gradient=k(v.dotsOptions.gradient)),v.cornersSquareOptions&&(v.cornersSquareOptions=Object.assign({},v.cornersSquareOptions),v.cornersSquareOptions.gradient&&(v.cornersSquareOptions.gradient=k(v.cornersSquareOptions.gradient))),v.cornersDotOptions&&(v.cornersDotOptions=Object.assign({},v.cornersDotOptions),v.cornersDotOptions.gradient&&(v.cornersDotOptions.gradient=k(v.cornersDotOptions.gradient))),v.backgroundOptions&&(v.backgroundOptions=Object.assign({},v.backgroundOptions),v.backgroundOptions.gradient&&(v.backgroundOptions.gradient=k(v.backgroundOptions.gradient))),v}var R=i(873),W=i.n(R);function V(_){if(!_)throw new Error("Extension must be defined");_[0]==="."&&(_=_.substring(1));const v={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[_.toLowerCase()];if(!v)throw new Error(`Extension "${_}" is not supported`);return v}class X{constructor(v){v?.jsdom?this._window=new v.jsdom("",{resources:"usable"}).window:this._window=window,this._options=v?$(a(F,v)):F,this.update()}static _clearContainer(v){v&&(v.innerHTML="")}_setupSvg(){if(!this._qr)return;const v=new B(this._options,this._window);this._svg=v.getElement(),this._svgDrawingPromise=v.drawQR(this._qr).then((()=>{var l;this._svg&&((l=this._extension)===null||l===void 0||l.call(this,v.getElement(),this._options))}))}_setupCanvas(){var v,l;this._qr&&(!((v=this._options.nodeCanvas)===null||v===void 0)&&v.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(l=this._svgDrawingPromise)===null||l===void 0?void 0:l.then((()=>{var p;if(!this._svg)return;const m=this._svg,y=new this._window.XMLSerializer().serializeToString(m),A=btoa(y),E=`data:${V("svg")};base64,${A}`;if(!((p=this._options.nodeCanvas)===null||p===void 0)&&p.loadImage)return this._options.nodeCanvas.loadImage(E).then((w=>{var I,M;w.width=this._options.width,w.height=this._options.height,(M=(I=this._nodeCanvas)===null||I===void 0?void 0:I.getContext("2d"))===null||M===void 0||M.drawImage(w,0,0)}));{const w=new this._window.Image;return new Promise((I=>{w.onload=()=>{var M,z;(z=(M=this._domCanvas)===null||M===void 0?void 0:M.getContext("2d"))===null||z===void 0||z.drawImage(w,0,0),I()},w.src=E}))}})))}async _getElement(v="png"){if(!this._qr)throw"QR code is empty";return v.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(v){X._clearContainer(this._container),this._options=v?$(a(this._options,v)):this._options,this._options.data&&(this._qr=W()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||(function(l){switch(!0){case/^[0-9]*$/.test(l):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(l):return"Alphanumeric";default:return"Byte"}})(this._options.data)),this._qr.make(),this._options.type===L?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(v){if(v){if(typeof v.appendChild!="function")throw"Container should be a single DOM node";this._options.type===L?this._domCanvas&&v.appendChild(this._domCanvas):this._svg&&v.appendChild(this._svg),this._container=v}}applyExtension(v){if(!v)throw"Extension function should be defined.";this._extension=v,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(v="png"){if(!this._qr)throw"QR code is empty";const l=await this._getElement(v),p=V(v);if(!l)return null;if(v.toLowerCase()==="svg"){const m=`\r +${new this._window.XMLSerializer().serializeToString(l)}`;return typeof Blob>"u"||this._options.jsdom?Buffer.from(m):new Blob([m],{type:p})}return new Promise((m=>{const y=l;if("toBuffer"in y)if(p==="image/png")m(y.toBuffer(p));else if(p==="image/jpeg")m(y.toBuffer(p));else{if(p!=="application/pdf")throw Error("Unsupported extension");m(y.toBuffer(p))}else"toBlob"in y&&y.toBlob(m,p,1)}))}async download(v){if(!this._qr)throw"QR code is empty";if(typeof Blob>"u")throw"Cannot download in Node.js, call getRawData instead.";let l="png",p="qr";typeof v=="string"?(l=v,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):typeof v=="object"&&v!==null&&(v.name&&(p=v.name),v.extension&&(l=v.extension));const m=await this._getElement(l);if(m)if(l.toLowerCase()==="svg"){let y=new XMLSerializer().serializeToString(m);y=`\r +`+y,f(`data:${V(l)};charset=utf-8,${encodeURIComponent(y)}`,`${p}.svg`)}else f(m.toDataURL(V(l)),`${p}.${l}`)}}const q=X})(),s.default})()))})(zd)),zd.exports}var pY=dY();const e7=Mi(pY);class Ko extends dt{constructor(e){const{docsPath:r,field:n,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${n}".`,{docsPath:r,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}function t7(t){if(/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t)||/%[^0-9a-f]/i.test(t)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(t))return!1;const e=gY(t),r=e[1],n=e[2],i=e[3],s=e[4],o=e[5];if(!(r?.length&&i.length>=0))return!1;if(n?.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9\+\-\.]*$/.test(r.toLowerCase()))return!1;let a="";return a+=`${r}:`,n?.length&&(a+=`//${n}`),a+=i,s?.length&&(a+=`?${s}`),o?.length&&(a+=`#${o}`),a}function gY(t){return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}function r7(t){const{chainId:e,domain:r,expirationTime:n,issuedAt:i=new Date,nonce:s,notBefore:o,requestId:a,resources:f,scheme:u,uri:h,version:g}=t;{if(e!==Math.floor(e))throw new Ko({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${e}`]});if(!(mY.test(r)||vY.test(r)||bY.test(r)))throw new Ko({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${r}`]});if(!yY.test(s))throw new Ko({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${s}`]});if(!t7(h))throw new Ko({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${h}`]});if(g!=="1")throw new Ko({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${g}`]});if(u&&!wY.test(u))throw new Ko({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${u}`]});const B=t.statement;if(B?.includes(` +`))throw new Ko({field:"statement",metaMessages:["- Statement must not include '\\n'.","",`Provided value: ${B}`]})}const b=ip(t.address),x=u?`${u}://${r}`:r,S=t.statement?`${t.statement} +`:"",C=`${x} wants you to sign in with your Ethereum account: +${b} -${M}`;let L=`URI: ${d} -Version: ${p} +${S}`;let D=`URI: ${h} +Version: ${g} Chain ID: ${e} Nonce: ${s} -Issued At: ${i.toISOString()}`;if(n&&(L+=` -Expiration Time: ${n.toISOString()}`),o&&(L+=` -Not Before: ${o.toISOString()}`),a&&(L+=` -Request ID: ${a}`),u){let B=` -Resources:`;for(const k of u){if(!Q7(k))throw new Ca({field:"resources",metaMessages:["- Every resource must be a RFC 3986 URI.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${k}`]});B+=` -- ${k}`}L+=B}return`${O} -${L}`}const HZ=/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/,WZ=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/,KZ=/^localhost(:[0-9]{1,5})?$/,VZ=/^[a-zA-Z0-9]{8,}$/,GZ=/^([a-zA-Z][a-zA-Z0-9+-.]*)$/,t9="7a4434fefbcc9af474fb5c995e47d286",YZ={projectId:t9,metadata:{name:"codatta",description:"codatta",url:"https://codatta.io/",icons:["https://avatars.githubusercontent.com/u/171659315"]}},JZ={namespaces:{eip155:{methods:["eth_sendTransaction","eth_signTransaction","eth_sign","personal_sign","eth_signTypedData"],chains:["eip155:56"],events:["chainChanged","accountsChanged","disconnect"],rpcMap:{1:`https://rpc.walletconnect.com?chainId=eip155:56&projectId=${t9}`}}},skipPairing:!1};function XZ(t,e){const r=window.location.host,n=window.location.href;return e9({address:t,chainId:1,domain:r,nonce:e,uri:n,version:"1"})}function r9(t){var ie,me,j;const e=Ee.useRef(null),{wallet:r,onGetExtension:n,onSignFinish:i}=t,[s,o]=Ee.useState(""),[a,u]=Ee.useState(!1),[l,d]=Ee.useState(""),[p,y]=Ee.useState("scan"),_=Ee.useRef(),[M,O]=Ee.useState((ie=r.config)==null?void 0:ie.image),[L,B]=Ee.useState(!1),{saveLastUsedWallet:k}=Yl();async function H(E){var f,g,v,x;u(!0);const m=await Wz.init(YZ);m.session&&await m.disconnect();try{if(y("scan"),m.on("display_uri",ce=>{o(ce),u(!1),y("scan")}),m.on("error",ce=>{console.log(ce)}),m.on("session_update",ce=>{console.log("session_update",ce)}),!await m.connect(JZ))throw new Error("Walletconnect init failed");const A=new Ga(m);O(((f=A.config)==null?void 0:f.image)||((g=E.config)==null?void 0:g.image));const b=await A.getAddress(),P=await xa.getNonce({account_type:"block_chain"});console.log("get nonce",P);const I=XZ(b,P);y("sign");const F=await A.signMessage(I,b);y("waiting"),await i(A,{message:I,nonce:P,signature:F,address:b,wallet_name:((v=A.config)==null?void 0:v.name)||((x=E.config)==null?void 0:x.name)||""}),console.log("save wallet connect wallet!"),k(A)}catch(S){console.log("err",S),d(S.details||S.message)}}function U(){_.current=new Z7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),_.current.append(e.current)}function z(E){var m;console.log(_.current),(m=_.current)==null||m.update({data:E})}Ee.useEffect(()=>{s&&z(s)},[s]),Ee.useEffect(()=>{H(r)},[r]),Ee.useEffect(()=>{U()},[]);function Z(){d(""),z(""),H(r)}function R(){B(!0),navigator.clipboard.writeText(s),setTimeout(()=>{B(!1)},2500)}function W(){var f;const E=(f=r.config)==null?void 0:f.desktop_link;if(!E)return;const m=`${E}?uri=${encodeURIComponent(s)}`;window.open(m,"_blank")}return le.jsxs("div",{children:[le.jsx("div",{className:"xc-text-center",children:le.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[le.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),le.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?le.jsx(Sc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):le.jsx("img",{className:"xc-h-10 xc-w-10",src:M})})]})}),le.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[le.jsx("button",{disabled:!s,onClick:R,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:L?le.jsxs(le.Fragment,{children:[" ",le.jsx(hV,{})," Copied!"]}):le.jsxs(le.Fragment,{children:[le.jsx(gV,{}),"Copy QR URL"]})}),((me=r.config)==null?void 0:me.getWallet)&&le.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[le.jsx(dV,{}),"Get Extension"]}),((j=r.config)==null?void 0:j.desktop_link)&&le.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:W,children:[le.jsx(F8,{}),"Desktop"]})]}),le.jsx("div",{className:"xc-text-center",children:l?le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:l}),le.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:Z,children:"Retry"})]}):le.jsxs(le.Fragment,{children:[p==="scan"&&le.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),p==="connect"&&le.jsx("p",{children:"Click connect in your wallet app"}),p==="sign"&&le.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),p==="waiting"&&le.jsx("div",{className:"xc-text-center",children:le.jsx(Sc,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const ZZ=RC({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),QZ="Accept connection request in the wallet",eQ="Accept sign-in request in your wallet";function tQ(t,e,r){const n=window.location.host,i=window.location.href;return e9({address:t,chainId:r,domain:n,nonce:e,uri:i,version:"1"})}function n9(t){var y;const[e,r]=Ee.useState(),{wallet:n,onSignFinish:i}=t,s=Ee.useRef(),[o,a]=Ee.useState("connect"),{saveLastUsedWallet:u,chains:l}=Yl();async function d(_){var M;try{a("connect");const O=await n.connect();if(!O||O.length===0)throw new Error("Wallet connect error");const L=await n.getChain(),B=l.find(Z=>Z.id===L),k=B||l[0]||ZZ;!B&&l.length>0&&(a("switch-chain"),await n.switchChain(k));const H=yg(O[0]),U=tQ(H,_,k.id);a("sign");const z=await n.signMessage(U,H);if(!z||z.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:H,signature:z,message:U,nonce:_,wallet_name:((M=n.config)==null?void 0:M.name)||""}),u(n)}catch(O){console.log("walletSignin error",O.stack),console.log(O.details||O.message),r(O.details||O.message)}}async function p(){try{r("");const _=await xa.getNonce({account_type:"block_chain"});s.current=_,d(s.current)}catch(_){console.log(_.details),r(_.message)}}return Ee.useEffect(()=>{p()},[]),le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[le.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:(y=n.config)==null?void 0:y.image,alt:""}),e&&le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),le.jsx("div",{className:"xc-flex xc-gap-2",children:le.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:p,children:"Retry"})})]}),!e&&le.jsxs(le.Fragment,{children:[o==="connect"&&le.jsx("span",{className:"xc-text-center",children:QZ}),o==="sign"&&le.jsx("span",{className:"xc-text-center",children:eQ}),o==="waiting"&&le.jsx("span",{className:"xc-text-center",children:le.jsx(Sc,{className:"xc-animate-spin"})}),o==="switch-chain"&&le.jsxs("span",{className:"xc-text-center",children:["Switch to ",l[0].name]})]})]})}const Gu="https://static.codatta.io/codatta-connect/wallet-icons.svg",rQ="https://itunes.apple.com/app/",nQ="https://play.google.com/store/apps/details?id=",iQ="https://chromewebstore.google.com/detail/",sQ="https://chromewebstore.google.com/detail/",oQ="https://addons.mozilla.org/en-US/firefox/addon/",aQ="https://microsoftedge.microsoft.com/addons/detail/";function Yu(t){const{icon:e,title:r,link:n}=t;return le.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[le.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,le.jsx($8,{className:"xc-ml-auto xc-text-gray-400"})]})}function cQ(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t!=null&&t.app_store_id&&(e.appStoreLink=`${rQ}${t.app_store_id}`),t!=null&&t.play_store_id&&(e.playStoreLink=`${nQ}${t.play_store_id}`),t!=null&&t.chrome_store_id&&(e.chromeStoreLink=`${iQ}${t.chrome_store_id}`),t!=null&&t.brave_store_id&&(e.braveStoreLink=`${sQ}${t.brave_store_id}`),t!=null&&t.firefox_addon_id&&(e.firefoxStoreLink=`${oQ}${t.firefox_addon_id}`),t!=null&&t.edge_addon_id&&(e.edgeStoreLink=`${aQ}${t.edge_addon_id}`),e}function i9(t){var i,s,o;const{wallet:e}=t,r=(i=e.config)==null?void 0:i.getWallet,n=cQ(r);return le.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[le.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:(s=e.config)==null?void 0:s.image,alt:""}),le.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",(o=e.config)==null?void 0:o.name," to connect"]}),le.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),le.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[(r==null?void 0:r.chrome_store_id)&&le.jsx(Yu,{link:n.chromeStoreLink,icon:`${Gu}#chrome`,title:"Google Play Store"}),(r==null?void 0:r.app_store_id)&&le.jsx(Yu,{link:n.appStoreLink,icon:`${Gu}#apple-dark`,title:"Apple App Store"}),(r==null?void 0:r.play_store_id)&&le.jsx(Yu,{link:n.playStoreLink,icon:`${Gu}#android`,title:"Google Play Store"}),(r==null?void 0:r.edge_addon_id)&&le.jsx(Yu,{link:n.edgeStoreLink,icon:`${Gu}#edge`,title:"Microsoft Edge"}),(r==null?void 0:r.brave_store_id)&&le.jsx(Yu,{link:n.braveStoreLink,icon:`${Gu}#brave`,title:"Brave extension"}),(r==null?void 0:r.firefox_addon_id)&&le.jsx(Yu,{link:n.firefoxStoreLink,icon:`${Gu}#firefox`,title:"Mozilla Firefox"})]})]})}function uQ(t){const{wallet:e}=t,[r,n]=Ee.useState(e.installed?"connect":"qr"),i=Bb();async function s(o,a){var l;const u=await xa.walletLogin({account_type:"block_chain",account_enum:i.role,connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:((l=o.config)==null?void 0:l.name)||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(u.data)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Rc,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&le.jsx(r9,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&le.jsx(n9,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&le.jsx(i9,{wallet:e})]})}function fQ(t){const{wallet:e,onClick:r}=t,n=le.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return le.jsx(Ob,{icon:n,title:i,onClick:()=>r(e)})}function s9(t){const{connector:e}=t,[r,n]=Ee.useState(),[i,s]=Ee.useState([]),o=Ee.useMemo(()=>r?i.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(d){n(d.target.value)}async function u(){const d=await e.getWallets();s(d)}Ee.useEffect(()=>{u()},[]);function l(d){t.onSelect(d)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Rc,{title:"Select wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[le.jsx(j8,{className:"xc-shrink-0 xc-opacity-50"}),le.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),le.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o==null?void 0:o.map(d=>le.jsx(fQ,{wallet:d,onClick:l},d.name))})]})}var o9={exports:{}};(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(nn,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,$[K+1]=G>>16&255,$[K+2]=G>>8&255,$[K+3]=G&255,$[K+4]=C>>24&255,$[K+5]=C>>16&255,$[K+6]=C>>8&255,$[K+7]=C&255}function O($,K,G,C,Y){var q,ae=0;for(q=0;q>>8)-1}function L($,K,G,C){return O($,K,G,C,16)}function B($,K,G,C){return O($,K,G,C,32)}function k($,K,G,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=G[0]&255|(G[1]&255)<<8|(G[2]&255)<<16|(G[3]&255)<<24,ae=G[4]&255|(G[5]&255)<<8|(G[6]&255)<<16|(G[7]&255)<<24,pe=G[8]&255|(G[9]&255)<<8|(G[10]&255)<<16|(G[11]&255)<<24,_e=G[12]&255|(G[13]&255)<<8|(G[14]&255)<<16|(G[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=K[0]&255|(K[1]&255)<<8|(K[2]&255)<<16|(K[3]&255)<<24,it=K[4]&255|(K[5]&255)<<8|(K[6]&255)<<16|(K[7]&255)<<24,Ue=K[8]&255|(K[9]&255)<<8|(K[10]&255)<<16|(K[11]&255)<<24,mt=K[12]&255|(K[13]&255)<<8|(K[14]&255)<<16|(K[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=G[16]&255|(G[17]&255)<<8|(G[18]&255)<<16|(G[19]&255)<<24,At=G[20]&255|(G[21]&255)<<8|(G[22]&255)<<16|(G[23]&255)<<24,Rt=G[24]&255|(G[25]&255)<<8|(G[26]&255)<<16|(G[27]&255)<<24,Mt=G[28]&255|(G[29]&255)<<8|(G[30]&255)<<16|(G[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=ae,wt=pe,lt=_e,at=Re,Ae=De,Pe=it,Ge=Ue,je=mt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;dt=dt+Y|0,_t=_t+q|0,ot=ot+ae|0,wt=wt+pe|0,lt=lt+_e|0,at=at+Re|0,Ae=Ae+De|0,Pe=Pe+it|0,Ge=Ge+Ue|0,je=je+mt|0,qe=qe+st|0,Xe=Xe+tt|0,kt=kt+At|0,Wt=Wt+Rt|0,Zt=Zt+Mt|0,Kt=Kt+Et|0,$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=_t>>>0&255,$[5]=_t>>>8&255,$[6]=_t>>>16&255,$[7]=_t>>>24&255,$[8]=ot>>>0&255,$[9]=ot>>>8&255,$[10]=ot>>>16&255,$[11]=ot>>>24&255,$[12]=wt>>>0&255,$[13]=wt>>>8&255,$[14]=wt>>>16&255,$[15]=wt>>>24&255,$[16]=lt>>>0&255,$[17]=lt>>>8&255,$[18]=lt>>>16&255,$[19]=lt>>>24&255,$[20]=at>>>0&255,$[21]=at>>>8&255,$[22]=at>>>16&255,$[23]=at>>>24&255,$[24]=Ae>>>0&255,$[25]=Ae>>>8&255,$[26]=Ae>>>16&255,$[27]=Ae>>>24&255,$[28]=Pe>>>0&255,$[29]=Pe>>>8&255,$[30]=Pe>>>16&255,$[31]=Pe>>>24&255,$[32]=Ge>>>0&255,$[33]=Ge>>>8&255,$[34]=Ge>>>16&255,$[35]=Ge>>>24&255,$[36]=je>>>0&255,$[37]=je>>>8&255,$[38]=je>>>16&255,$[39]=je>>>24&255,$[40]=qe>>>0&255,$[41]=qe>>>8&255,$[42]=qe>>>16&255,$[43]=qe>>>24&255,$[44]=Xe>>>0&255,$[45]=Xe>>>8&255,$[46]=Xe>>>16&255,$[47]=Xe>>>24&255,$[48]=kt>>>0&255,$[49]=kt>>>8&255,$[50]=kt>>>16&255,$[51]=kt>>>24&255,$[52]=Wt>>>0&255,$[53]=Wt>>>8&255,$[54]=Wt>>>16&255,$[55]=Wt>>>24&255,$[56]=Zt>>>0&255,$[57]=Zt>>>8&255,$[58]=Zt>>>16&255,$[59]=Zt>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255}function H($,K,G,C){for(var Y=C[0]&255|(C[1]&255)<<8|(C[2]&255)<<16|(C[3]&255)<<24,q=G[0]&255|(G[1]&255)<<8|(G[2]&255)<<16|(G[3]&255)<<24,ae=G[4]&255|(G[5]&255)<<8|(G[6]&255)<<16|(G[7]&255)<<24,pe=G[8]&255|(G[9]&255)<<8|(G[10]&255)<<16|(G[11]&255)<<24,_e=G[12]&255|(G[13]&255)<<8|(G[14]&255)<<16|(G[15]&255)<<24,Re=C[4]&255|(C[5]&255)<<8|(C[6]&255)<<16|(C[7]&255)<<24,De=K[0]&255|(K[1]&255)<<8|(K[2]&255)<<16|(K[3]&255)<<24,it=K[4]&255|(K[5]&255)<<8|(K[6]&255)<<16|(K[7]&255)<<24,Ue=K[8]&255|(K[9]&255)<<8|(K[10]&255)<<16|(K[11]&255)<<24,mt=K[12]&255|(K[13]&255)<<8|(K[14]&255)<<16|(K[15]&255)<<24,st=C[8]&255|(C[9]&255)<<8|(C[10]&255)<<16|(C[11]&255)<<24,tt=G[16]&255|(G[17]&255)<<8|(G[18]&255)<<16|(G[19]&255)<<24,At=G[20]&255|(G[21]&255)<<8|(G[22]&255)<<16|(G[23]&255)<<24,Rt=G[24]&255|(G[25]&255)<<8|(G[26]&255)<<16|(G[27]&255)<<24,Mt=G[28]&255|(G[29]&255)<<8|(G[30]&255)<<16|(G[31]&255)<<24,Et=C[12]&255|(C[13]&255)<<8|(C[14]&255)<<16|(C[15]&255)<<24,dt=Y,_t=q,ot=ae,wt=pe,lt=_e,at=Re,Ae=De,Pe=it,Ge=Ue,je=mt,qe=st,Xe=tt,kt=At,Wt=Rt,Zt=Mt,Kt=Et,de,nr=0;nr<20;nr+=2)de=dt+kt|0,lt^=de<<7|de>>>25,de=lt+dt|0,Ge^=de<<9|de>>>23,de=Ge+lt|0,kt^=de<<13|de>>>19,de=kt+Ge|0,dt^=de<<18|de>>>14,de=at+_t|0,je^=de<<7|de>>>25,de=je+at|0,Wt^=de<<9|de>>>23,de=Wt+je|0,_t^=de<<13|de>>>19,de=_t+Wt|0,at^=de<<18|de>>>14,de=qe+Ae|0,Zt^=de<<7|de>>>25,de=Zt+qe|0,ot^=de<<9|de>>>23,de=ot+Zt|0,Ae^=de<<13|de>>>19,de=Ae+ot|0,qe^=de<<18|de>>>14,de=Kt+Xe|0,wt^=de<<7|de>>>25,de=wt+Kt|0,Pe^=de<<9|de>>>23,de=Pe+wt|0,Xe^=de<<13|de>>>19,de=Xe+Pe|0,Kt^=de<<18|de>>>14,de=dt+wt|0,_t^=de<<7|de>>>25,de=_t+dt|0,ot^=de<<9|de>>>23,de=ot+_t|0,wt^=de<<13|de>>>19,de=wt+ot|0,dt^=de<<18|de>>>14,de=at+lt|0,Ae^=de<<7|de>>>25,de=Ae+at|0,Pe^=de<<9|de>>>23,de=Pe+Ae|0,lt^=de<<13|de>>>19,de=lt+Pe|0,at^=de<<18|de>>>14,de=qe+je|0,Xe^=de<<7|de>>>25,de=Xe+qe|0,Ge^=de<<9|de>>>23,de=Ge+Xe|0,je^=de<<13|de>>>19,de=je+Ge|0,qe^=de<<18|de>>>14,de=Kt+Zt|0,kt^=de<<7|de>>>25,de=kt+Kt|0,Wt^=de<<9|de>>>23,de=Wt+kt|0,Zt^=de<<13|de>>>19,de=Zt+Wt|0,Kt^=de<<18|de>>>14;$[0]=dt>>>0&255,$[1]=dt>>>8&255,$[2]=dt>>>16&255,$[3]=dt>>>24&255,$[4]=at>>>0&255,$[5]=at>>>8&255,$[6]=at>>>16&255,$[7]=at>>>24&255,$[8]=qe>>>0&255,$[9]=qe>>>8&255,$[10]=qe>>>16&255,$[11]=qe>>>24&255,$[12]=Kt>>>0&255,$[13]=Kt>>>8&255,$[14]=Kt>>>16&255,$[15]=Kt>>>24&255,$[16]=Ae>>>0&255,$[17]=Ae>>>8&255,$[18]=Ae>>>16&255,$[19]=Ae>>>24&255,$[20]=Pe>>>0&255,$[21]=Pe>>>8&255,$[22]=Pe>>>16&255,$[23]=Pe>>>24&255,$[24]=Ge>>>0&255,$[25]=Ge>>>8&255,$[26]=Ge>>>16&255,$[27]=Ge>>>24&255,$[28]=je>>>0&255,$[29]=je>>>8&255,$[30]=je>>>16&255,$[31]=je>>>24&255}function U($,K,G,C){k($,K,G,C)}function z($,K,G,C){H($,K,G,C)}var Z=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function R($,K,G,C,Y,q,ae){var pe=new Uint8Array(16),_e=new Uint8Array(64),Re,De;for(De=0;De<16;De++)pe[De]=0;for(De=0;De<8;De++)pe[De]=q[De];for(;Y>=64;){for(U(_e,pe,ae,Z),De=0;De<64;De++)$[K+De]=G[C+De]^_e[De];for(Re=1,De=8;De<16;De++)Re=Re+(pe[De]&255)|0,pe[De]=Re&255,Re>>>=8;Y-=64,K+=64,C+=64}if(Y>0)for(U(_e,pe,ae,Z),De=0;De=64;){for(U(ae,q,Y,Z),_e=0;_e<64;_e++)$[K+_e]=ae[_e];for(pe=1,_e=8;_e<16;_e++)pe=pe+(q[_e]&255)|0,q[_e]=pe&255,pe>>>=8;G-=64,K+=64}if(G>0)for(U(ae,q,Y,Z),_e=0;_e>>13|G<<3)&8191,C=$[4]&255|($[5]&255)<<8,this.r[2]=(G>>>10|C<<6)&7939,Y=$[6]&255|($[7]&255)<<8,this.r[3]=(C>>>7|Y<<9)&8191,q=$[8]&255|($[9]&255)<<8,this.r[4]=(Y>>>4|q<<12)&255,this.r[5]=q>>>1&8190,ae=$[10]&255|($[11]&255)<<8,this.r[6]=(q>>>14|ae<<2)&8191,pe=$[12]&255|($[13]&255)<<8,this.r[7]=(ae>>>11|pe<<5)&8065,_e=$[14]&255|($[15]&255)<<8,this.r[8]=(pe>>>8|_e<<8)&8191,this.r[9]=_e>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};j.prototype.blocks=function($,K,G){for(var C=this.fin?0:2048,Y,q,ae,pe,_e,Re,De,it,Ue,mt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt=this.h[0],lt=this.h[1],at=this.h[2],Ae=this.h[3],Pe=this.h[4],Ge=this.h[5],je=this.h[6],qe=this.h[7],Xe=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],de=this.r[3],nr=this.r[4],pr=this.r[5],gr=this.r[6],Qt=this.r[7],mr=this.r[8],lr=this.r[9];G>=16;)Y=$[K+0]&255|($[K+1]&255)<<8,wt+=Y&8191,q=$[K+2]&255|($[K+3]&255)<<8,lt+=(Y>>>13|q<<3)&8191,ae=$[K+4]&255|($[K+5]&255)<<8,at+=(q>>>10|ae<<6)&8191,pe=$[K+6]&255|($[K+7]&255)<<8,Ae+=(ae>>>7|pe<<9)&8191,_e=$[K+8]&255|($[K+9]&255)<<8,Pe+=(pe>>>4|_e<<12)&8191,Ge+=_e>>>1&8191,Re=$[K+10]&255|($[K+11]&255)<<8,je+=(_e>>>14|Re<<2)&8191,De=$[K+12]&255|($[K+13]&255)<<8,qe+=(Re>>>11|De<<5)&8191,it=$[K+14]&255|($[K+15]&255)<<8,Xe+=(De>>>8|it<<8)&8191,kt+=it>>>5|C,Ue=0,mt=Ue,mt+=wt*Wt,mt+=lt*(5*lr),mt+=at*(5*mr),mt+=Ae*(5*Qt),mt+=Pe*(5*gr),Ue=mt>>>13,mt&=8191,mt+=Ge*(5*pr),mt+=je*(5*nr),mt+=qe*(5*de),mt+=Xe*(5*Kt),mt+=kt*(5*Zt),Ue+=mt>>>13,mt&=8191,st=Ue,st+=wt*Zt,st+=lt*Wt,st+=at*(5*lr),st+=Ae*(5*mr),st+=Pe*(5*Qt),Ue=st>>>13,st&=8191,st+=Ge*(5*gr),st+=je*(5*pr),st+=qe*(5*nr),st+=Xe*(5*de),st+=kt*(5*Kt),Ue+=st>>>13,st&=8191,tt=Ue,tt+=wt*Kt,tt+=lt*Zt,tt+=at*Wt,tt+=Ae*(5*lr),tt+=Pe*(5*mr),Ue=tt>>>13,tt&=8191,tt+=Ge*(5*Qt),tt+=je*(5*gr),tt+=qe*(5*pr),tt+=Xe*(5*nr),tt+=kt*(5*de),Ue+=tt>>>13,tt&=8191,At=Ue,At+=wt*de,At+=lt*Kt,At+=at*Zt,At+=Ae*Wt,At+=Pe*(5*lr),Ue=At>>>13,At&=8191,At+=Ge*(5*mr),At+=je*(5*Qt),At+=qe*(5*gr),At+=Xe*(5*pr),At+=kt*(5*nr),Ue+=At>>>13,At&=8191,Rt=Ue,Rt+=wt*nr,Rt+=lt*de,Rt+=at*Kt,Rt+=Ae*Zt,Rt+=Pe*Wt,Ue=Rt>>>13,Rt&=8191,Rt+=Ge*(5*lr),Rt+=je*(5*mr),Rt+=qe*(5*Qt),Rt+=Xe*(5*gr),Rt+=kt*(5*pr),Ue+=Rt>>>13,Rt&=8191,Mt=Ue,Mt+=wt*pr,Mt+=lt*nr,Mt+=at*de,Mt+=Ae*Kt,Mt+=Pe*Zt,Ue=Mt>>>13,Mt&=8191,Mt+=Ge*Wt,Mt+=je*(5*lr),Mt+=qe*(5*mr),Mt+=Xe*(5*Qt),Mt+=kt*(5*gr),Ue+=Mt>>>13,Mt&=8191,Et=Ue,Et+=wt*gr,Et+=lt*pr,Et+=at*nr,Et+=Ae*de,Et+=Pe*Kt,Ue=Et>>>13,Et&=8191,Et+=Ge*Zt,Et+=je*Wt,Et+=qe*(5*lr),Et+=Xe*(5*mr),Et+=kt*(5*Qt),Ue+=Et>>>13,Et&=8191,dt=Ue,dt+=wt*Qt,dt+=lt*gr,dt+=at*pr,dt+=Ae*nr,dt+=Pe*de,Ue=dt>>>13,dt&=8191,dt+=Ge*Kt,dt+=je*Zt,dt+=qe*Wt,dt+=Xe*(5*lr),dt+=kt*(5*mr),Ue+=dt>>>13,dt&=8191,_t=Ue,_t+=wt*mr,_t+=lt*Qt,_t+=at*gr,_t+=Ae*pr,_t+=Pe*nr,Ue=_t>>>13,_t&=8191,_t+=Ge*de,_t+=je*Kt,_t+=qe*Zt,_t+=Xe*Wt,_t+=kt*(5*lr),Ue+=_t>>>13,_t&=8191,ot=Ue,ot+=wt*lr,ot+=lt*mr,ot+=at*Qt,ot+=Ae*gr,ot+=Pe*pr,Ue=ot>>>13,ot&=8191,ot+=Ge*nr,ot+=je*de,ot+=qe*Kt,ot+=Xe*Zt,ot+=kt*Wt,Ue+=ot>>>13,ot&=8191,Ue=(Ue<<2)+Ue|0,Ue=Ue+mt|0,mt=Ue&8191,Ue=Ue>>>13,st+=Ue,wt=mt,lt=st,at=tt,Ae=At,Pe=Rt,Ge=Mt,je=Et,qe=dt,Xe=_t,kt=ot,K+=16,G-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=at,this.h[3]=Ae,this.h[4]=Pe,this.h[5]=Ge,this.h[6]=je,this.h[7]=qe,this.h[8]=Xe,this.h[9]=kt},j.prototype.finish=function($,K){var G=new Uint16Array(10),C,Y,q,ae;if(this.leftover){for(ae=this.leftover,this.buffer[ae++]=1;ae<16;ae++)this.buffer[ae]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(C=this.h[1]>>>13,this.h[1]&=8191,ae=2;ae<10;ae++)this.h[ae]+=C,C=this.h[ae]>>>13,this.h[ae]&=8191;for(this.h[0]+=C*5,C=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=C,C=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=C,G[0]=this.h[0]+5,C=G[0]>>>13,G[0]&=8191,ae=1;ae<10;ae++)G[ae]=this.h[ae]+C,C=G[ae]>>>13,G[ae]&=8191;for(G[9]-=8192,Y=(C^1)-1,ae=0;ae<10;ae++)G[ae]&=Y;for(Y=~Y,ae=0;ae<10;ae++)this.h[ae]=this.h[ae]&Y|G[ae];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,q=this.h[0]+this.pad[0],this.h[0]=q&65535,ae=1;ae<8;ae++)q=(this.h[ae]+this.pad[ae]|0)+(q>>>16)|0,this.h[ae]=q&65535;$[K+0]=this.h[0]>>>0&255,$[K+1]=this.h[0]>>>8&255,$[K+2]=this.h[1]>>>0&255,$[K+3]=this.h[1]>>>8&255,$[K+4]=this.h[2]>>>0&255,$[K+5]=this.h[2]>>>8&255,$[K+6]=this.h[3]>>>0&255,$[K+7]=this.h[3]>>>8&255,$[K+8]=this.h[4]>>>0&255,$[K+9]=this.h[4]>>>8&255,$[K+10]=this.h[5]>>>0&255,$[K+11]=this.h[5]>>>8&255,$[K+12]=this.h[6]>>>0&255,$[K+13]=this.h[6]>>>8&255,$[K+14]=this.h[7]>>>0&255,$[K+15]=this.h[7]>>>8&255},j.prototype.update=function($,K,G){var C,Y;if(this.leftover){for(Y=16-this.leftover,Y>G&&(Y=G),C=0;C=16&&(Y=G-G%16,this.blocks($,K,Y),K+=Y,G-=Y),G){for(C=0;C>16&1),q[G-1]&=65535;q[15]=ae[15]-32767-(q[14]>>16&1),Y=q[15]>>16&1,q[14]&=65535,S(ae,q,1-Y)}for(G=0;G<16;G++)$[2*G]=ae[G]&255,$[2*G+1]=ae[G]>>8}function b($,K){var G=new Uint8Array(32),C=new Uint8Array(32);return A(G,$),A(C,K),B(G,0,C,0)}function P($){var K=new Uint8Array(32);return A(K,$),K[0]&1}function I($,K){var G;for(G=0;G<16;G++)$[G]=K[2*G]+(K[2*G+1]<<8);$[15]&=32767}function F($,K,G){for(var C=0;C<16;C++)$[C]=K[C]+G[C]}function ce($,K,G){for(var C=0;C<16;C++)$[C]=K[C]-G[C]}function D($,K,G){var C,Y,q=0,ae=0,pe=0,_e=0,Re=0,De=0,it=0,Ue=0,mt=0,st=0,tt=0,At=0,Rt=0,Mt=0,Et=0,dt=0,_t=0,ot=0,wt=0,lt=0,at=0,Ae=0,Pe=0,Ge=0,je=0,qe=0,Xe=0,kt=0,Wt=0,Zt=0,Kt=0,de=G[0],nr=G[1],pr=G[2],gr=G[3],Qt=G[4],mr=G[5],lr=G[6],Lr=G[7],vr=G[8],xr=G[9],Br=G[10],$r=G[11],Ir=G[12],ln=G[13],hn=G[14],dn=G[15];C=K[0],q+=C*de,ae+=C*nr,pe+=C*pr,_e+=C*gr,Re+=C*Qt,De+=C*mr,it+=C*lr,Ue+=C*Lr,mt+=C*vr,st+=C*xr,tt+=C*Br,At+=C*$r,Rt+=C*Ir,Mt+=C*ln,Et+=C*hn,dt+=C*dn,C=K[1],ae+=C*de,pe+=C*nr,_e+=C*pr,Re+=C*gr,De+=C*Qt,it+=C*mr,Ue+=C*lr,mt+=C*Lr,st+=C*vr,tt+=C*xr,At+=C*Br,Rt+=C*$r,Mt+=C*Ir,Et+=C*ln,dt+=C*hn,_t+=C*dn,C=K[2],pe+=C*de,_e+=C*nr,Re+=C*pr,De+=C*gr,it+=C*Qt,Ue+=C*mr,mt+=C*lr,st+=C*Lr,tt+=C*vr,At+=C*xr,Rt+=C*Br,Mt+=C*$r,Et+=C*Ir,dt+=C*ln,_t+=C*hn,ot+=C*dn,C=K[3],_e+=C*de,Re+=C*nr,De+=C*pr,it+=C*gr,Ue+=C*Qt,mt+=C*mr,st+=C*lr,tt+=C*Lr,At+=C*vr,Rt+=C*xr,Mt+=C*Br,Et+=C*$r,dt+=C*Ir,_t+=C*ln,ot+=C*hn,wt+=C*dn,C=K[4],Re+=C*de,De+=C*nr,it+=C*pr,Ue+=C*gr,mt+=C*Qt,st+=C*mr,tt+=C*lr,At+=C*Lr,Rt+=C*vr,Mt+=C*xr,Et+=C*Br,dt+=C*$r,_t+=C*Ir,ot+=C*ln,wt+=C*hn,lt+=C*dn,C=K[5],De+=C*de,it+=C*nr,Ue+=C*pr,mt+=C*gr,st+=C*Qt,tt+=C*mr,At+=C*lr,Rt+=C*Lr,Mt+=C*vr,Et+=C*xr,dt+=C*Br,_t+=C*$r,ot+=C*Ir,wt+=C*ln,lt+=C*hn,at+=C*dn,C=K[6],it+=C*de,Ue+=C*nr,mt+=C*pr,st+=C*gr,tt+=C*Qt,At+=C*mr,Rt+=C*lr,Mt+=C*Lr,Et+=C*vr,dt+=C*xr,_t+=C*Br,ot+=C*$r,wt+=C*Ir,lt+=C*ln,at+=C*hn,Ae+=C*dn,C=K[7],Ue+=C*de,mt+=C*nr,st+=C*pr,tt+=C*gr,At+=C*Qt,Rt+=C*mr,Mt+=C*lr,Et+=C*Lr,dt+=C*vr,_t+=C*xr,ot+=C*Br,wt+=C*$r,lt+=C*Ir,at+=C*ln,Ae+=C*hn,Pe+=C*dn,C=K[8],mt+=C*de,st+=C*nr,tt+=C*pr,At+=C*gr,Rt+=C*Qt,Mt+=C*mr,Et+=C*lr,dt+=C*Lr,_t+=C*vr,ot+=C*xr,wt+=C*Br,lt+=C*$r,at+=C*Ir,Ae+=C*ln,Pe+=C*hn,Ge+=C*dn,C=K[9],st+=C*de,tt+=C*nr,At+=C*pr,Rt+=C*gr,Mt+=C*Qt,Et+=C*mr,dt+=C*lr,_t+=C*Lr,ot+=C*vr,wt+=C*xr,lt+=C*Br,at+=C*$r,Ae+=C*Ir,Pe+=C*ln,Ge+=C*hn,je+=C*dn,C=K[10],tt+=C*de,At+=C*nr,Rt+=C*pr,Mt+=C*gr,Et+=C*Qt,dt+=C*mr,_t+=C*lr,ot+=C*Lr,wt+=C*vr,lt+=C*xr,at+=C*Br,Ae+=C*$r,Pe+=C*Ir,Ge+=C*ln,je+=C*hn,qe+=C*dn,C=K[11],At+=C*de,Rt+=C*nr,Mt+=C*pr,Et+=C*gr,dt+=C*Qt,_t+=C*mr,ot+=C*lr,wt+=C*Lr,lt+=C*vr,at+=C*xr,Ae+=C*Br,Pe+=C*$r,Ge+=C*Ir,je+=C*ln,qe+=C*hn,Xe+=C*dn,C=K[12],Rt+=C*de,Mt+=C*nr,Et+=C*pr,dt+=C*gr,_t+=C*Qt,ot+=C*mr,wt+=C*lr,lt+=C*Lr,at+=C*vr,Ae+=C*xr,Pe+=C*Br,Ge+=C*$r,je+=C*Ir,qe+=C*ln,Xe+=C*hn,kt+=C*dn,C=K[13],Mt+=C*de,Et+=C*nr,dt+=C*pr,_t+=C*gr,ot+=C*Qt,wt+=C*mr,lt+=C*lr,at+=C*Lr,Ae+=C*vr,Pe+=C*xr,Ge+=C*Br,je+=C*$r,qe+=C*Ir,Xe+=C*ln,kt+=C*hn,Wt+=C*dn,C=K[14],Et+=C*de,dt+=C*nr,_t+=C*pr,ot+=C*gr,wt+=C*Qt,lt+=C*mr,at+=C*lr,Ae+=C*Lr,Pe+=C*vr,Ge+=C*xr,je+=C*Br,qe+=C*$r,Xe+=C*Ir,kt+=C*ln,Wt+=C*hn,Zt+=C*dn,C=K[15],dt+=C*de,_t+=C*nr,ot+=C*pr,wt+=C*gr,lt+=C*Qt,at+=C*mr,Ae+=C*lr,Pe+=C*Lr,Ge+=C*vr,je+=C*xr,qe+=C*Br,Xe+=C*$r,kt+=C*Ir,Wt+=C*ln,Zt+=C*hn,Kt+=C*dn,q+=38*_t,ae+=38*ot,pe+=38*wt,_e+=38*lt,Re+=38*at,De+=38*Ae,it+=38*Pe,Ue+=38*Ge,mt+=38*je,st+=38*qe,tt+=38*Xe,At+=38*kt,Rt+=38*Wt,Mt+=38*Zt,Et+=38*Kt,Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=ae+Y+65535,Y=Math.floor(C/65536),ae=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=_e+Y+65535,Y=Math.floor(C/65536),_e=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=mt+Y+65535,Y=Math.floor(C/65536),mt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),Y=1,C=q+Y+65535,Y=Math.floor(C/65536),q=C-Y*65536,C=ae+Y+65535,Y=Math.floor(C/65536),ae=C-Y*65536,C=pe+Y+65535,Y=Math.floor(C/65536),pe=C-Y*65536,C=_e+Y+65535,Y=Math.floor(C/65536),_e=C-Y*65536,C=Re+Y+65535,Y=Math.floor(C/65536),Re=C-Y*65536,C=De+Y+65535,Y=Math.floor(C/65536),De=C-Y*65536,C=it+Y+65535,Y=Math.floor(C/65536),it=C-Y*65536,C=Ue+Y+65535,Y=Math.floor(C/65536),Ue=C-Y*65536,C=mt+Y+65535,Y=Math.floor(C/65536),mt=C-Y*65536,C=st+Y+65535,Y=Math.floor(C/65536),st=C-Y*65536,C=tt+Y+65535,Y=Math.floor(C/65536),tt=C-Y*65536,C=At+Y+65535,Y=Math.floor(C/65536),At=C-Y*65536,C=Rt+Y+65535,Y=Math.floor(C/65536),Rt=C-Y*65536,C=Mt+Y+65535,Y=Math.floor(C/65536),Mt=C-Y*65536,C=Et+Y+65535,Y=Math.floor(C/65536),Et=C-Y*65536,C=dt+Y+65535,Y=Math.floor(C/65536),dt=C-Y*65536,q+=Y-1+37*(Y-1),$[0]=q,$[1]=ae,$[2]=pe,$[3]=_e,$[4]=Re,$[5]=De,$[6]=it,$[7]=Ue,$[8]=mt,$[9]=st,$[10]=tt,$[11]=At,$[12]=Rt,$[13]=Mt,$[14]=Et,$[15]=dt}function se($,K){D($,K,K)}function ee($,K){var G=r(),C;for(C=0;C<16;C++)G[C]=K[C];for(C=253;C>=0;C--)se(G,G),C!==2&&C!==4&&D(G,G,K);for(C=0;C<16;C++)$[C]=G[C]}function J($,K){var G=r(),C;for(C=0;C<16;C++)G[C]=K[C];for(C=250;C>=0;C--)se(G,G),C!==1&&D(G,G,K);for(C=0;C<16;C++)$[C]=G[C]}function Q($,K,G){var C=new Uint8Array(32),Y=new Float64Array(80),q,ae,pe=r(),_e=r(),Re=r(),De=r(),it=r(),Ue=r();for(ae=0;ae<31;ae++)C[ae]=K[ae];for(C[31]=K[31]&127|64,C[0]&=248,I(Y,G),ae=0;ae<16;ae++)_e[ae]=Y[ae],De[ae]=pe[ae]=Re[ae]=0;for(pe[0]=De[0]=1,ae=254;ae>=0;--ae)q=C[ae>>>3]>>>(ae&7)&1,S(pe,_e,q),S(Re,De,q),F(it,pe,Re),ce(pe,pe,Re),F(Re,_e,De),ce(_e,_e,De),se(De,it),se(Ue,pe),D(pe,Re,pe),D(Re,_e,it),F(it,pe,Re),ce(pe,pe,Re),se(_e,pe),ce(Re,De,Ue),D(pe,Re,u),F(pe,pe,De),D(Re,Re,pe),D(pe,De,Ue),D(De,_e,Y),se(_e,it),S(pe,_e,q),S(Re,De,q);for(ae=0;ae<16;ae++)Y[ae+16]=pe[ae],Y[ae+32]=Re[ae],Y[ae+48]=_e[ae],Y[ae+64]=De[ae];var mt=Y.subarray(32),st=Y.subarray(16);return ee(mt,mt),D(st,st,mt),A($,st),0}function T($,K){return Q($,K,s)}function X($,K){return n(K,32),T($,K)}function re($,K,G){var C=new Uint8Array(32);return Q(C,G,K),z($,i,C,Z)}var ge=f,oe=g;function fe($,K,G,C,Y,q){var ae=new Uint8Array(32);return re(ae,Y,q),ge($,K,G,C,ae)}function be($,K,G,C,Y,q){var ae=new Uint8Array(32);return re(ae,Y,q),oe($,K,G,C,ae)}var Me=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ne($,K,G,C){for(var Y=new Int32Array(16),q=new Int32Array(16),ae,pe,_e,Re,De,it,Ue,mt,st,tt,At,Rt,Mt,Et,dt,_t,ot,wt,lt,at,Ae,Pe,Ge,je,qe,Xe,kt=$[0],Wt=$[1],Zt=$[2],Kt=$[3],de=$[4],nr=$[5],pr=$[6],gr=$[7],Qt=K[0],mr=K[1],lr=K[2],Lr=K[3],vr=K[4],xr=K[5],Br=K[6],$r=K[7],Ir=0;C>=128;){for(lt=0;lt<16;lt++)at=8*lt+Ir,Y[lt]=G[at+0]<<24|G[at+1]<<16|G[at+2]<<8|G[at+3],q[lt]=G[at+4]<<24|G[at+5]<<16|G[at+6]<<8|G[at+7];for(lt=0;lt<80;lt++)if(ae=kt,pe=Wt,_e=Zt,Re=Kt,De=de,it=nr,Ue=pr,mt=gr,st=Qt,tt=mr,At=lr,Rt=Lr,Mt=vr,Et=xr,dt=Br,_t=$r,Ae=gr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(de>>>14|vr<<18)^(de>>>18|vr<<14)^(vr>>>9|de<<23),Pe=(vr>>>14|de<<18)^(vr>>>18|de<<14)^(de>>>9|vr<<23),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=de&nr^~de&pr,Pe=vr&xr^~vr&Br,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Me[lt*2],Pe=Me[lt*2+1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=Y[lt%16],Pe=q[lt%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,ot=qe&65535|Xe<<16,wt=Ge&65535|je<<16,Ae=ot,Pe=wt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Pe=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,Ae=kt&Wt^kt&Zt^Wt&Zt,Pe=Qt&mr^Qt&lr^mr&lr,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,mt=qe&65535|Xe<<16,_t=Ge&65535|je<<16,Ae=Re,Pe=Rt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=ot,Pe=wt,Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Re=qe&65535|Xe<<16,Rt=Ge&65535|je<<16,Wt=ae,Zt=pe,Kt=_e,de=Re,nr=De,pr=it,gr=Ue,kt=mt,mr=st,lr=tt,Lr=At,vr=Rt,xr=Mt,Br=Et,$r=dt,Qt=_t,lt%16===15)for(at=0;at<16;at++)Ae=Y[at],Pe=q[at],Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=Y[(at+9)%16],Pe=q[(at+9)%16],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+1)%16],wt=q[(at+1)%16],Ae=(ot>>>1|wt<<31)^(ot>>>8|wt<<24)^ot>>>7,Pe=(wt>>>1|ot<<31)^(wt>>>8|ot<<24)^(wt>>>7|ot<<25),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,ot=Y[(at+14)%16],wt=q[(at+14)%16],Ae=(ot>>>19|wt<<13)^(wt>>>29|ot<<3)^ot>>>6,Pe=(wt>>>19|ot<<13)^(ot>>>29|wt<<3)^(wt>>>6|ot<<26),Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,Y[at]=qe&65535|Xe<<16,q[at]=Ge&65535|je<<16;Ae=kt,Pe=Qt,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[0],Pe=K[0],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[0]=kt=qe&65535|Xe<<16,K[0]=Qt=Ge&65535|je<<16,Ae=Wt,Pe=mr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[1],Pe=K[1],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[1]=Wt=qe&65535|Xe<<16,K[1]=mr=Ge&65535|je<<16,Ae=Zt,Pe=lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[2],Pe=K[2],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[2]=Zt=qe&65535|Xe<<16,K[2]=lr=Ge&65535|je<<16,Ae=Kt,Pe=Lr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[3],Pe=K[3],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[3]=Kt=qe&65535|Xe<<16,K[3]=Lr=Ge&65535|je<<16,Ae=de,Pe=vr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[4],Pe=K[4],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[4]=de=qe&65535|Xe<<16,K[4]=vr=Ge&65535|je<<16,Ae=nr,Pe=xr,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[5],Pe=K[5],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[5]=nr=qe&65535|Xe<<16,K[5]=xr=Ge&65535|je<<16,Ae=pr,Pe=Br,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[6],Pe=K[6],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[6]=pr=qe&65535|Xe<<16,K[6]=Br=Ge&65535|je<<16,Ae=gr,Pe=$r,Ge=Pe&65535,je=Pe>>>16,qe=Ae&65535,Xe=Ae>>>16,Ae=$[7],Pe=K[7],Ge+=Pe&65535,je+=Pe>>>16,qe+=Ae&65535,Xe+=Ae>>>16,je+=Ge>>>16,qe+=je>>>16,Xe+=qe>>>16,$[7]=gr=qe&65535|Xe<<16,K[7]=$r=Ge&65535|je<<16,Ir+=128,C-=128}return C}function Te($,K,G){var C=new Int32Array(8),Y=new Int32Array(8),q=new Uint8Array(256),ae,pe=G;for(C[0]=1779033703,C[1]=3144134277,C[2]=1013904242,C[3]=2773480762,C[4]=1359893119,C[5]=2600822924,C[6]=528734635,C[7]=1541459225,Y[0]=4089235720,Y[1]=2227873595,Y[2]=4271175723,Y[3]=1595750129,Y[4]=2917565137,Y[5]=725511199,Y[6]=4215389547,Y[7]=327033209,Ne(C,Y,K,G),G%=128,ae=0;ae=0;--Y)C=G[Y/8|0]>>(Y&7)&1,Ie($,K,C),$e(K,$),$e($,$),Ie($,K,C)}function ke($,K){var G=[r(),r(),r(),r()];v(G[0],p),v(G[1],y),v(G[2],a),D(G[3],p,y),Ve($,G,K)}function ze($,K,G){var C=new Uint8Array(64),Y=[r(),r(),r(),r()],q;for(G||n(K,32),Te(C,K,32),C[0]&=248,C[31]&=127,C[31]|=64,ke(Y,C),Le($,Y),q=0;q<32;q++)K[q+32]=$[q];return 0}var He=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Se($,K){var G,C,Y,q;for(C=63;C>=32;--C){for(G=0,Y=C-32,q=C-12;Y>4)*He[Y],G=K[Y]>>8,K[Y]&=255;for(Y=0;Y<32;Y++)K[Y]-=G*He[Y];for(C=0;C<32;C++)K[C+1]+=K[C]>>8,$[C]=K[C]&255}function Qe($){var K=new Float64Array(64),G;for(G=0;G<64;G++)K[G]=$[G];for(G=0;G<64;G++)$[G]=0;Se($,K)}function ct($,K,G,C){var Y=new Uint8Array(64),q=new Uint8Array(64),ae=new Uint8Array(64),pe,_e,Re=new Float64Array(64),De=[r(),r(),r(),r()];Te(Y,C,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var it=G+64;for(pe=0;pe>7&&ce($[0],o,$[0]),D($[3],$[0],$[1]),0)}function et($,K,G,C){var Y,q=new Uint8Array(32),ae=new Uint8Array(64),pe=[r(),r(),r(),r()],_e=[r(),r(),r(),r()];if(G<64||Be(_e,C))return-1;for(Y=0;Y=0},e.sign.keyPair=function(){var $=new Uint8Array(bt),K=new Uint8Array(Dt);return ze($,K),{publicKey:$,secretKey:K}},e.sign.keyPair.fromSecretKey=function($){if(nt($),$.length!==Dt)throw new Error("bad secret key size");for(var K=new Uint8Array(bt),G=0;G=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function $b(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function ap(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{o(y),f(!1),b("scan")}),X.on("error",y=>{console.log(y)}),X.on("session_update",y=>{console.log("session_update",y)}),!await X.connect(_Y))throw new Error("Walletconnect init failed");const _=new la(X);C(_.config?.image||V.config?.image);const v=await _.getAddress(),l=await Fo.getNonce({account_type:"block_chain"});console.log("get nonce",l);const p=EY(v,l);b("sign");const m=await _.signMessage(p,v);b("waiting"),await i(_,{message:p,nonce:l,signature:m,address:v,wallet_name:_.config?.name||V.config?.name||""}),console.log("save wallet connect wallet!"),L(_)}catch(q){console.log("err",q),h(q.details||q.message)}}function F(){x.current=new e7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),x.current.append(e.current)}function k(V){console.log(x.current),x.current?.update({data:V})}Se.useEffect(()=>{s&&k(s)},[s]),Se.useEffect(()=>{H(r)},[r]),Se.useEffect(()=>{F()},[]);function $(){h(""),k(""),H(r)}function R(){B(!0),navigator.clipboard.writeText(s),setTimeout(()=>{B(!1)},2500)}function W(){const V=r.config?.desktop_link;if(!V)return;const X=`${V}?uri=${encodeURIComponent(s)}`;window.open(X,"_blank")}return he.jsxs("div",{children:[he.jsx("div",{className:"xc-text-center",children:he.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[he.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:e}),he.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:a?he.jsx(Fa,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):he.jsx("img",{className:"xc-h-10 xc-w-10",src:S})})]})}),he.jsxs("div",{className:"xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3",children:[he.jsx("button",{disabled:!s,onClick:R,className:"xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent",children:D?he.jsxs(he.Fragment,{children:[" ",he.jsx(kz,{})," Copied!"]}):he.jsxs(he.Fragment,{children:[he.jsx(jz,{}),"Copy QR URL"]})}),r.config?.getWallet&&he.jsxs("button",{className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:n,children:[he.jsx(Bz,{}),"Get Extension"]}),r.config?.desktop_link&&he.jsxs("button",{disabled:!s,className:"xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black",onClick:W,children:[he.jsx($4,{}),"Desktop"]})]}),he.jsx("div",{className:"xc-text-center",children:u?he.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[he.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:u}),he.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:$,children:"Retry"})]}):he.jsxs(he.Fragment,{children:[g==="scan"&&he.jsx("p",{children:"Scan this QR code from your mobile wallet or phone's camera to connect."}),g==="connect"&&he.jsx("p",{children:"Click connect in your wallet app"}),g==="sign"&&he.jsx("p",{children:"Click sign-in in your wallet to confirm you own this wallet."}),g==="waiting"&&he.jsx("div",{className:"xc-text-center",children:he.jsx(Fa,{className:"xc-inline-block xc-animate-spin"})})]})})]})}const SY=CM({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),AY="Accept connection request in the wallet",PY="Accept sign-in request in your wallet";function IY(t,e,r){const n=window.location.host,i=window.location.href;return r7({address:t,chainId:r,domain:n,nonce:e,uri:i,version:"1"})}function s7(t){const[e,r]=Se.useState(),{wallet:n,onSignFinish:i}=t,s=Se.useRef(),[o,a]=Se.useState("connect"),{saveLastUsedWallet:f,chains:u}=Hf();async function h(b){try{a("connect");const x=await n.connect();if(!x||x.length===0)throw new Error("Wallet connect error");const S=await n.getChain(),C=u.find(F=>F.id===S),D=C||u[0]||SY;!C&&u.length>0&&(a("switch-chain"),await n.switchChain(D));const B=ip(x[0]),L=IY(B,b,D.id);a("sign");const H=await n.signMessage(L,B);if(!H||H.length===0)throw new Error("user sign error");a("waiting"),await i(n,{address:B,signature:H,message:L,nonce:b,wallet_name:n.config?.name||""}),f(n)}catch(x){console.log("walletSignin error",x.stack),console.log(x.details||x.message),r(x.details||x.message)}}async function g(){try{r("");const b=await Fo.getNonce({account_type:"block_chain"});s.current=b,h(s.current)}catch(b){console.log(b.details),r(b.message)}}return Se.useEffect(()=>{g()},[]),he.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[he.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:n.config?.image,alt:""}),e&&he.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[he.jsx("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:e}),he.jsx("div",{className:"xc-flex xc-gap-2",children:he.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:g,children:"Retry"})})]}),!e&&he.jsxs(he.Fragment,{children:[o==="connect"&&he.jsx("span",{className:"xc-text-center",children:AY}),o==="sign"&&he.jsx("span",{className:"xc-text-center",children:PY}),o==="waiting"&&he.jsx("span",{className:"xc-text-center",children:he.jsx(Fa,{className:"xc-animate-spin"})}),o==="switch-chain"&&he.jsxs("span",{className:"xc-text-center",children:["Switch to ",u[0].name]})]})]})}const Kc="https://static.codatta.io/codatta-connect/wallet-icons.svg",MY="https://itunes.apple.com/app/",CY="https://play.google.com/store/apps/details?id=",RY="https://chromewebstore.google.com/detail/",TY="https://chromewebstore.google.com/detail/",DY="https://addons.mozilla.org/en-US/firefox/addon/",OY="https://microsoftedge.microsoft.com/addons/detail/";function Vc(t){const{icon:e,title:r,link:n}=t;return he.jsxs("a",{href:n,target:"_blank",className:"xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5",children:[he.jsx("img",{className:"xc-rounded-1 xc-h-6 xc-w-6",src:e,alt:""}),r,he.jsx(U4,{className:"xc-ml-auto xc-text-gray-400"})]})}function NY(t){const e={appStoreLink:"",playStoreLink:"",chromeStoreLink:"",braveStoreLink:"",firefoxStoreLink:"",edgeStoreLink:""};return t?.app_store_id&&(e.appStoreLink=`${MY}${t.app_store_id}`),t?.play_store_id&&(e.playStoreLink=`${CY}${t.play_store_id}`),t?.chrome_store_id&&(e.chromeStoreLink=`${RY}${t.chrome_store_id}`),t?.brave_store_id&&(e.braveStoreLink=`${TY}${t.brave_store_id}`),t?.firefox_addon_id&&(e.firefoxStoreLink=`${DY}${t.firefox_addon_id}`),t?.edge_addon_id&&(e.edgeStoreLink=`${OY}${t.edge_addon_id}`),e}function o7(t){const{wallet:e}=t,r=e.config?.getWallet,n=NY(r);return he.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[he.jsx("img",{className:"xc-rounded-md xc-mb-2 xc-h-12 xc-w-12",src:e.config?.image,alt:""}),he.jsxs("p",{className:"xc-text-lg xc-font-bold",children:["Install ",e.config?.name," to connect"]}),he.jsx("p",{className:"xc-mb-6 xc-text-sm xc-text-gray-500",children:"Select from your preferred options below:"}),he.jsxs("div",{className:"xc-grid xc-w-full xc-grid-cols-1 xc-gap-3",children:[r?.chrome_store_id&&he.jsx(Vc,{link:n.chromeStoreLink,icon:`${Kc}#chrome`,title:"Chrome Web Store"}),r?.app_store_id&&he.jsx(Vc,{link:n.appStoreLink,icon:`${Kc}#apple-dark`,title:"Apple App Store"}),r?.play_store_id&&he.jsx(Vc,{link:n.playStoreLink,icon:`${Kc}#android`,title:"Google Play Store"}),r?.edge_addon_id&&he.jsx(Vc,{link:n.edgeStoreLink,icon:`${Kc}#edge`,title:"Microsoft Edge"}),r?.brave_store_id&&he.jsx(Vc,{link:n.braveStoreLink,icon:`${Kc}#brave`,title:"Brave extension"}),r?.firefox_addon_id&&he.jsx(Vc,{link:n.firefoxStoreLink,icon:`${Kc}#firefox`,title:"Mozilla Firefox"})]})]})}function LY(t){const{wallet:e}=t,[r,n]=Se.useState(e.installed?"connect":"qr"),i=F1();async function s(o,a){const f=await Fo.walletLogin({account_type:"block_chain",account_enum:i.role,connector:"codatta_wallet",inviter_code:i.inviterCode,wallet_name:o.config?.name||o.key,address:await o.getAddress(),chain:(await o.getChain()).toString(),nonce:a.nonce,signature:a.signature,message:a.message,source:{device:i.device,channel:i.channel,app:i.app}});await t.onLogin(f.data)}return he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-6",children:he.jsx(Wa,{title:"Connect wallet",onBack:t.onBack})}),r==="qr"&&he.jsx(i7,{wallet:e,onGetExtension:()=>n("get-extension"),onSignFinish:s}),r==="connect"&&he.jsx(s7,{onShowQrCode:()=>n("qr"),wallet:e,onSignFinish:s}),r==="get-extension"&&he.jsx(o7,{wallet:e})]})}function kY(t){const{wallet:e,onClick:r}=t,n=he.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.imageUrl}),i=e.name||"";return he.jsx(N1,{icon:n,title:i,onClick:()=>r(e)})}function a7(t){const{connector:e}=t,[r,n]=Se.useState(),[i,s]=Se.useState([]),o=Se.useMemo(()=>r?i.filter(h=>h.name.toLowerCase().includes(r.toLowerCase())):i,[r,i]);function a(h){n(h.target.value)}async function f(){const h=await e.getWallets();s(h)}Se.useEffect(()=>{f()},[]);function u(h){t.onSelect(h)}return he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-6",children:he.jsx(Wa,{title:"Select wallet",onBack:t.onBack})}),he.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[he.jsx(q4,{className:"xc-shrink-0 xc-opacity-50"}),he.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:a})]}),he.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:o?.map(h=>he.jsx(kY,{wallet:h,onClick:u},h.name))})]})}var Hd={exports:{}},BY=Hd.exports,c7;function FY(){return c7||(c7=1,(function(t){(function(e,r){t.exports?t.exports=r():(e.nacl||(e.nacl={}),e.nacl.util=r())})(BY,function(){var e={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var i,s=unescape(encodeURIComponent(n)),o=new Uint8Array(s.length);for(i=0;i"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(n){return Buffer.from(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(e.encodeBase64=function(n){return new Buffer(n).toString("base64")},e.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(e.encodeBase64=function(n){var i,s=[],o=n.length;for(i=0;i>24&255,K[G+1]=J>>16&255,K[G+2]=J>>8&255,K[G+3]=J&255,K[G+4]=T>>24&255,K[G+5]=T>>16&255,K[G+6]=T>>8&255,K[G+7]=T&255}function C(K,G,J,T,j){var oe,le=0;for(oe=0;oe>>8)-1}function D(K,G,J,T){return C(K,G,J,T,16)}function B(K,G,J,T){return C(K,G,J,T,32)}function L(K,G,J,T){for(var j=T[0]&255|(T[1]&255)<<8|(T[2]&255)<<16|(T[3]&255)<<24,oe=J[0]&255|(J[1]&255)<<8|(J[2]&255)<<16|(J[3]&255)<<24,le=J[4]&255|(J[5]&255)<<8|(J[6]&255)<<16|(J[7]&255)<<24,me=J[8]&255|(J[9]&255)<<8|(J[10]&255)<<16|(J[11]&255)<<24,Ee=J[12]&255|(J[13]&255)<<8|(J[14]&255)<<16|(J[15]&255)<<24,ke=T[4]&255|(T[5]&255)<<8|(T[6]&255)<<16|(T[7]&255)<<24,Ce=G[0]&255|(G[1]&255)<<8|(G[2]&255)<<16|(G[3]&255)<<24,et=G[4]&255|(G[5]&255)<<8|(G[6]&255)<<16|(G[7]&255)<<24,Ze=G[8]&255|(G[9]&255)<<8|(G[10]&255)<<16|(G[11]&255)<<24,rt=G[12]&255|(G[13]&255)<<8|(G[14]&255)<<16|(G[15]&255)<<24,ot=T[8]&255|(T[9]&255)<<8|(T[10]&255)<<16|(T[11]&255)<<24,yt=J[16]&255|(J[17]&255)<<8|(J[18]&255)<<16|(J[19]&255)<<24,Rt=J[20]&255|(J[21]&255)<<8|(J[22]&255)<<16|(J[23]&255)<<24,Mt=J[24]&255|(J[25]&255)<<8|(J[26]&255)<<16|(J[27]&255)<<24,xt=J[28]&255|(J[29]&255)<<8|(J[30]&255)<<16|(J[31]&255)<<24,Tt=T[12]&255|(T[13]&255)<<8|(T[14]&255)<<16|(T[15]&255)<<24,mt=j,Et=oe,ct=le,wt=me,lt=Ee,st=ke,Ae=Ce,Ie=et,Ve=Ze,Ue=rt,ze=ot,Je=yt,kt=Rt,Wt=Mt,Zt=xt,Kt=Tt,ge,ir=0;ir<20;ir+=2)ge=mt+kt|0,lt^=ge<<7|ge>>>25,ge=lt+mt|0,Ve^=ge<<9|ge>>>23,ge=Ve+lt|0,kt^=ge<<13|ge>>>19,ge=kt+Ve|0,mt^=ge<<18|ge>>>14,ge=st+Et|0,Ue^=ge<<7|ge>>>25,ge=Ue+st|0,Wt^=ge<<9|ge>>>23,ge=Wt+Ue|0,Et^=ge<<13|ge>>>19,ge=Et+Wt|0,st^=ge<<18|ge>>>14,ge=ze+Ae|0,Zt^=ge<<7|ge>>>25,ge=Zt+ze|0,ct^=ge<<9|ge>>>23,ge=ct+Zt|0,Ae^=ge<<13|ge>>>19,ge=Ae+ct|0,ze^=ge<<18|ge>>>14,ge=Kt+Je|0,wt^=ge<<7|ge>>>25,ge=wt+Kt|0,Ie^=ge<<9|ge>>>23,ge=Ie+wt|0,Je^=ge<<13|ge>>>19,ge=Je+Ie|0,Kt^=ge<<18|ge>>>14,ge=mt+wt|0,Et^=ge<<7|ge>>>25,ge=Et+mt|0,ct^=ge<<9|ge>>>23,ge=ct+Et|0,wt^=ge<<13|ge>>>19,ge=wt+ct|0,mt^=ge<<18|ge>>>14,ge=st+lt|0,Ae^=ge<<7|ge>>>25,ge=Ae+st|0,Ie^=ge<<9|ge>>>23,ge=Ie+Ae|0,lt^=ge<<13|ge>>>19,ge=lt+Ie|0,st^=ge<<18|ge>>>14,ge=ze+Ue|0,Je^=ge<<7|ge>>>25,ge=Je+ze|0,Ve^=ge<<9|ge>>>23,ge=Ve+Je|0,Ue^=ge<<13|ge>>>19,ge=Ue+Ve|0,ze^=ge<<18|ge>>>14,ge=Kt+Zt|0,kt^=ge<<7|ge>>>25,ge=kt+Kt|0,Wt^=ge<<9|ge>>>23,ge=Wt+kt|0,Zt^=ge<<13|ge>>>19,ge=Zt+Wt|0,Kt^=ge<<18|ge>>>14;mt=mt+j|0,Et=Et+oe|0,ct=ct+le|0,wt=wt+me|0,lt=lt+Ee|0,st=st+ke|0,Ae=Ae+Ce|0,Ie=Ie+et|0,Ve=Ve+Ze|0,Ue=Ue+rt|0,ze=ze+ot|0,Je=Je+yt|0,kt=kt+Rt|0,Wt=Wt+Mt|0,Zt=Zt+xt|0,Kt=Kt+Tt|0,K[0]=mt>>>0&255,K[1]=mt>>>8&255,K[2]=mt>>>16&255,K[3]=mt>>>24&255,K[4]=Et>>>0&255,K[5]=Et>>>8&255,K[6]=Et>>>16&255,K[7]=Et>>>24&255,K[8]=ct>>>0&255,K[9]=ct>>>8&255,K[10]=ct>>>16&255,K[11]=ct>>>24&255,K[12]=wt>>>0&255,K[13]=wt>>>8&255,K[14]=wt>>>16&255,K[15]=wt>>>24&255,K[16]=lt>>>0&255,K[17]=lt>>>8&255,K[18]=lt>>>16&255,K[19]=lt>>>24&255,K[20]=st>>>0&255,K[21]=st>>>8&255,K[22]=st>>>16&255,K[23]=st>>>24&255,K[24]=Ae>>>0&255,K[25]=Ae>>>8&255,K[26]=Ae>>>16&255,K[27]=Ae>>>24&255,K[28]=Ie>>>0&255,K[29]=Ie>>>8&255,K[30]=Ie>>>16&255,K[31]=Ie>>>24&255,K[32]=Ve>>>0&255,K[33]=Ve>>>8&255,K[34]=Ve>>>16&255,K[35]=Ve>>>24&255,K[36]=Ue>>>0&255,K[37]=Ue>>>8&255,K[38]=Ue>>>16&255,K[39]=Ue>>>24&255,K[40]=ze>>>0&255,K[41]=ze>>>8&255,K[42]=ze>>>16&255,K[43]=ze>>>24&255,K[44]=Je>>>0&255,K[45]=Je>>>8&255,K[46]=Je>>>16&255,K[47]=Je>>>24&255,K[48]=kt>>>0&255,K[49]=kt>>>8&255,K[50]=kt>>>16&255,K[51]=kt>>>24&255,K[52]=Wt>>>0&255,K[53]=Wt>>>8&255,K[54]=Wt>>>16&255,K[55]=Wt>>>24&255,K[56]=Zt>>>0&255,K[57]=Zt>>>8&255,K[58]=Zt>>>16&255,K[59]=Zt>>>24&255,K[60]=Kt>>>0&255,K[61]=Kt>>>8&255,K[62]=Kt>>>16&255,K[63]=Kt>>>24&255}function H(K,G,J,T){for(var j=T[0]&255|(T[1]&255)<<8|(T[2]&255)<<16|(T[3]&255)<<24,oe=J[0]&255|(J[1]&255)<<8|(J[2]&255)<<16|(J[3]&255)<<24,le=J[4]&255|(J[5]&255)<<8|(J[6]&255)<<16|(J[7]&255)<<24,me=J[8]&255|(J[9]&255)<<8|(J[10]&255)<<16|(J[11]&255)<<24,Ee=J[12]&255|(J[13]&255)<<8|(J[14]&255)<<16|(J[15]&255)<<24,ke=T[4]&255|(T[5]&255)<<8|(T[6]&255)<<16|(T[7]&255)<<24,Ce=G[0]&255|(G[1]&255)<<8|(G[2]&255)<<16|(G[3]&255)<<24,et=G[4]&255|(G[5]&255)<<8|(G[6]&255)<<16|(G[7]&255)<<24,Ze=G[8]&255|(G[9]&255)<<8|(G[10]&255)<<16|(G[11]&255)<<24,rt=G[12]&255|(G[13]&255)<<8|(G[14]&255)<<16|(G[15]&255)<<24,ot=T[8]&255|(T[9]&255)<<8|(T[10]&255)<<16|(T[11]&255)<<24,yt=J[16]&255|(J[17]&255)<<8|(J[18]&255)<<16|(J[19]&255)<<24,Rt=J[20]&255|(J[21]&255)<<8|(J[22]&255)<<16|(J[23]&255)<<24,Mt=J[24]&255|(J[25]&255)<<8|(J[26]&255)<<16|(J[27]&255)<<24,xt=J[28]&255|(J[29]&255)<<8|(J[30]&255)<<16|(J[31]&255)<<24,Tt=T[12]&255|(T[13]&255)<<8|(T[14]&255)<<16|(T[15]&255)<<24,mt=j,Et=oe,ct=le,wt=me,lt=Ee,st=ke,Ae=Ce,Ie=et,Ve=Ze,Ue=rt,ze=ot,Je=yt,kt=Rt,Wt=Mt,Zt=xt,Kt=Tt,ge,ir=0;ir<20;ir+=2)ge=mt+kt|0,lt^=ge<<7|ge>>>25,ge=lt+mt|0,Ve^=ge<<9|ge>>>23,ge=Ve+lt|0,kt^=ge<<13|ge>>>19,ge=kt+Ve|0,mt^=ge<<18|ge>>>14,ge=st+Et|0,Ue^=ge<<7|ge>>>25,ge=Ue+st|0,Wt^=ge<<9|ge>>>23,ge=Wt+Ue|0,Et^=ge<<13|ge>>>19,ge=Et+Wt|0,st^=ge<<18|ge>>>14,ge=ze+Ae|0,Zt^=ge<<7|ge>>>25,ge=Zt+ze|0,ct^=ge<<9|ge>>>23,ge=ct+Zt|0,Ae^=ge<<13|ge>>>19,ge=Ae+ct|0,ze^=ge<<18|ge>>>14,ge=Kt+Je|0,wt^=ge<<7|ge>>>25,ge=wt+Kt|0,Ie^=ge<<9|ge>>>23,ge=Ie+wt|0,Je^=ge<<13|ge>>>19,ge=Je+Ie|0,Kt^=ge<<18|ge>>>14,ge=mt+wt|0,Et^=ge<<7|ge>>>25,ge=Et+mt|0,ct^=ge<<9|ge>>>23,ge=ct+Et|0,wt^=ge<<13|ge>>>19,ge=wt+ct|0,mt^=ge<<18|ge>>>14,ge=st+lt|0,Ae^=ge<<7|ge>>>25,ge=Ae+st|0,Ie^=ge<<9|ge>>>23,ge=Ie+Ae|0,lt^=ge<<13|ge>>>19,ge=lt+Ie|0,st^=ge<<18|ge>>>14,ge=ze+Ue|0,Je^=ge<<7|ge>>>25,ge=Je+ze|0,Ve^=ge<<9|ge>>>23,ge=Ve+Je|0,Ue^=ge<<13|ge>>>19,ge=Ue+Ve|0,ze^=ge<<18|ge>>>14,ge=Kt+Zt|0,kt^=ge<<7|ge>>>25,ge=kt+Kt|0,Wt^=ge<<9|ge>>>23,ge=Wt+kt|0,Zt^=ge<<13|ge>>>19,ge=Zt+Wt|0,Kt^=ge<<18|ge>>>14;K[0]=mt>>>0&255,K[1]=mt>>>8&255,K[2]=mt>>>16&255,K[3]=mt>>>24&255,K[4]=st>>>0&255,K[5]=st>>>8&255,K[6]=st>>>16&255,K[7]=st>>>24&255,K[8]=ze>>>0&255,K[9]=ze>>>8&255,K[10]=ze>>>16&255,K[11]=ze>>>24&255,K[12]=Kt>>>0&255,K[13]=Kt>>>8&255,K[14]=Kt>>>16&255,K[15]=Kt>>>24&255,K[16]=Ae>>>0&255,K[17]=Ae>>>8&255,K[18]=Ae>>>16&255,K[19]=Ae>>>24&255,K[20]=Ie>>>0&255,K[21]=Ie>>>8&255,K[22]=Ie>>>16&255,K[23]=Ie>>>24&255,K[24]=Ve>>>0&255,K[25]=Ve>>>8&255,K[26]=Ve>>>16&255,K[27]=Ve>>>24&255,K[28]=Ue>>>0&255,K[29]=Ue>>>8&255,K[30]=Ue>>>16&255,K[31]=Ue>>>24&255}function F(K,G,J,T){L(K,G,J,T)}function k(K,G,J,T){H(K,G,J,T)}var $=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function R(K,G,J,T,j,oe,le){var me=new Uint8Array(16),Ee=new Uint8Array(64),ke,Ce;for(Ce=0;Ce<16;Ce++)me[Ce]=0;for(Ce=0;Ce<8;Ce++)me[Ce]=oe[Ce];for(;j>=64;){for(F(Ee,me,le,$),Ce=0;Ce<64;Ce++)K[G+Ce]=J[T+Ce]^Ee[Ce];for(ke=1,Ce=8;Ce<16;Ce++)ke=ke+(me[Ce]&255)|0,me[Ce]=ke&255,ke>>>=8;j-=64,G+=64,T+=64}if(j>0)for(F(Ee,me,le,$),Ce=0;Ce=64;){for(F(le,oe,j,$),Ee=0;Ee<64;Ee++)K[G+Ee]=le[Ee];for(me=1,Ee=8;Ee<16;Ee++)me=me+(oe[Ee]&255)|0,oe[Ee]=me&255,me>>>=8;J-=64,G+=64}if(J>0)for(F(le,oe,j,$),Ee=0;Ee>>13|J<<3)&8191,T=K[4]&255|(K[5]&255)<<8,this.r[2]=(J>>>10|T<<6)&7939,j=K[6]&255|(K[7]&255)<<8,this.r[3]=(T>>>7|j<<9)&8191,oe=K[8]&255|(K[9]&255)<<8,this.r[4]=(j>>>4|oe<<12)&255,this.r[5]=oe>>>1&8190,le=K[10]&255|(K[11]&255)<<8,this.r[6]=(oe>>>14|le<<2)&8191,me=K[12]&255|(K[13]&255)<<8,this.r[7]=(le>>>11|me<<5)&8065,Ee=K[14]&255|(K[15]&255)<<8,this.r[8]=(me>>>8|Ee<<8)&8191,this.r[9]=Ee>>>5&127,this.pad[0]=K[16]&255|(K[17]&255)<<8,this.pad[1]=K[18]&255|(K[19]&255)<<8,this.pad[2]=K[20]&255|(K[21]&255)<<8,this.pad[3]=K[22]&255|(K[23]&255)<<8,this.pad[4]=K[24]&255|(K[25]&255)<<8,this.pad[5]=K[26]&255|(K[27]&255)<<8,this.pad[6]=K[28]&255|(K[29]&255)<<8,this.pad[7]=K[30]&255|(K[31]&255)<<8};q.prototype.blocks=function(K,G,J){for(var T=this.fin?0:2048,j,oe,le,me,Ee,ke,Ce,et,Ze,rt,ot,yt,Rt,Mt,xt,Tt,mt,Et,ct,wt=this.h[0],lt=this.h[1],st=this.h[2],Ae=this.h[3],Ie=this.h[4],Ve=this.h[5],Ue=this.h[6],ze=this.h[7],Je=this.h[8],kt=this.h[9],Wt=this.r[0],Zt=this.r[1],Kt=this.r[2],ge=this.r[3],ir=this.r[4],gr=this.r[5],mr=this.r[6],Qt=this.r[7],vr=this.r[8],hr=this.r[9];J>=16;)j=K[G+0]&255|(K[G+1]&255)<<8,wt+=j&8191,oe=K[G+2]&255|(K[G+3]&255)<<8,lt+=(j>>>13|oe<<3)&8191,le=K[G+4]&255|(K[G+5]&255)<<8,st+=(oe>>>10|le<<6)&8191,me=K[G+6]&255|(K[G+7]&255)<<8,Ae+=(le>>>7|me<<9)&8191,Ee=K[G+8]&255|(K[G+9]&255)<<8,Ie+=(me>>>4|Ee<<12)&8191,Ve+=Ee>>>1&8191,ke=K[G+10]&255|(K[G+11]&255)<<8,Ue+=(Ee>>>14|ke<<2)&8191,Ce=K[G+12]&255|(K[G+13]&255)<<8,ze+=(ke>>>11|Ce<<5)&8191,et=K[G+14]&255|(K[G+15]&255)<<8,Je+=(Ce>>>8|et<<8)&8191,kt+=et>>>5|T,Ze=0,rt=Ze,rt+=wt*Wt,rt+=lt*(5*hr),rt+=st*(5*vr),rt+=Ae*(5*Qt),rt+=Ie*(5*mr),Ze=rt>>>13,rt&=8191,rt+=Ve*(5*gr),rt+=Ue*(5*ir),rt+=ze*(5*ge),rt+=Je*(5*Kt),rt+=kt*(5*Zt),Ze+=rt>>>13,rt&=8191,ot=Ze,ot+=wt*Zt,ot+=lt*Wt,ot+=st*(5*hr),ot+=Ae*(5*vr),ot+=Ie*(5*Qt),Ze=ot>>>13,ot&=8191,ot+=Ve*(5*mr),ot+=Ue*(5*gr),ot+=ze*(5*ir),ot+=Je*(5*ge),ot+=kt*(5*Kt),Ze+=ot>>>13,ot&=8191,yt=Ze,yt+=wt*Kt,yt+=lt*Zt,yt+=st*Wt,yt+=Ae*(5*hr),yt+=Ie*(5*vr),Ze=yt>>>13,yt&=8191,yt+=Ve*(5*Qt),yt+=Ue*(5*mr),yt+=ze*(5*gr),yt+=Je*(5*ir),yt+=kt*(5*ge),Ze+=yt>>>13,yt&=8191,Rt=Ze,Rt+=wt*ge,Rt+=lt*Kt,Rt+=st*Zt,Rt+=Ae*Wt,Rt+=Ie*(5*hr),Ze=Rt>>>13,Rt&=8191,Rt+=Ve*(5*vr),Rt+=Ue*(5*Qt),Rt+=ze*(5*mr),Rt+=Je*(5*gr),Rt+=kt*(5*ir),Ze+=Rt>>>13,Rt&=8191,Mt=Ze,Mt+=wt*ir,Mt+=lt*ge,Mt+=st*Kt,Mt+=Ae*Zt,Mt+=Ie*Wt,Ze=Mt>>>13,Mt&=8191,Mt+=Ve*(5*hr),Mt+=Ue*(5*vr),Mt+=ze*(5*Qt),Mt+=Je*(5*mr),Mt+=kt*(5*gr),Ze+=Mt>>>13,Mt&=8191,xt=Ze,xt+=wt*gr,xt+=lt*ir,xt+=st*ge,xt+=Ae*Kt,xt+=Ie*Zt,Ze=xt>>>13,xt&=8191,xt+=Ve*Wt,xt+=Ue*(5*hr),xt+=ze*(5*vr),xt+=Je*(5*Qt),xt+=kt*(5*mr),Ze+=xt>>>13,xt&=8191,Tt=Ze,Tt+=wt*mr,Tt+=lt*gr,Tt+=st*ir,Tt+=Ae*ge,Tt+=Ie*Kt,Ze=Tt>>>13,Tt&=8191,Tt+=Ve*Zt,Tt+=Ue*Wt,Tt+=ze*(5*hr),Tt+=Je*(5*vr),Tt+=kt*(5*Qt),Ze+=Tt>>>13,Tt&=8191,mt=Ze,mt+=wt*Qt,mt+=lt*mr,mt+=st*gr,mt+=Ae*ir,mt+=Ie*ge,Ze=mt>>>13,mt&=8191,mt+=Ve*Kt,mt+=Ue*Zt,mt+=ze*Wt,mt+=Je*(5*hr),mt+=kt*(5*vr),Ze+=mt>>>13,mt&=8191,Et=Ze,Et+=wt*vr,Et+=lt*Qt,Et+=st*mr,Et+=Ae*gr,Et+=Ie*ir,Ze=Et>>>13,Et&=8191,Et+=Ve*ge,Et+=Ue*Kt,Et+=ze*Zt,Et+=Je*Wt,Et+=kt*(5*hr),Ze+=Et>>>13,Et&=8191,ct=Ze,ct+=wt*hr,ct+=lt*vr,ct+=st*Qt,ct+=Ae*mr,ct+=Ie*gr,Ze=ct>>>13,ct&=8191,ct+=Ve*ir,ct+=Ue*ge,ct+=ze*Kt,ct+=Je*Zt,ct+=kt*Wt,Ze+=ct>>>13,ct&=8191,Ze=(Ze<<2)+Ze|0,Ze=Ze+rt|0,rt=Ze&8191,Ze=Ze>>>13,ot+=Ze,wt=rt,lt=ot,st=yt,Ae=Rt,Ie=Mt,Ve=xt,Ue=Tt,ze=mt,Je=Et,kt=ct,G+=16,J-=16;this.h[0]=wt,this.h[1]=lt,this.h[2]=st,this.h[3]=Ae,this.h[4]=Ie,this.h[5]=Ve,this.h[6]=Ue,this.h[7]=ze,this.h[8]=Je,this.h[9]=kt},q.prototype.finish=function(K,G){var J=new Uint16Array(10),T,j,oe,le;if(this.leftover){for(le=this.leftover,this.buffer[le++]=1;le<16;le++)this.buffer[le]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(T=this.h[1]>>>13,this.h[1]&=8191,le=2;le<10;le++)this.h[le]+=T,T=this.h[le]>>>13,this.h[le]&=8191;for(this.h[0]+=T*5,T=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=T,T=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=T,J[0]=this.h[0]+5,T=J[0]>>>13,J[0]&=8191,le=1;le<10;le++)J[le]=this.h[le]+T,T=J[le]>>>13,J[le]&=8191;for(J[9]-=8192,j=(T^1)-1,le=0;le<10;le++)J[le]&=j;for(j=~j,le=0;le<10;le++)this.h[le]=this.h[le]&j|J[le];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,oe=this.h[0]+this.pad[0],this.h[0]=oe&65535,le=1;le<8;le++)oe=(this.h[le]+this.pad[le]|0)+(oe>>>16)|0,this.h[le]=oe&65535;K[G+0]=this.h[0]>>>0&255,K[G+1]=this.h[0]>>>8&255,K[G+2]=this.h[1]>>>0&255,K[G+3]=this.h[1]>>>8&255,K[G+4]=this.h[2]>>>0&255,K[G+5]=this.h[2]>>>8&255,K[G+6]=this.h[3]>>>0&255,K[G+7]=this.h[3]>>>8&255,K[G+8]=this.h[4]>>>0&255,K[G+9]=this.h[4]>>>8&255,K[G+10]=this.h[5]>>>0&255,K[G+11]=this.h[5]>>>8&255,K[G+12]=this.h[6]>>>0&255,K[G+13]=this.h[6]>>>8&255,K[G+14]=this.h[7]>>>0&255,K[G+15]=this.h[7]>>>8&255},q.prototype.update=function(K,G,J){var T,j;if(this.leftover){for(j=16-this.leftover,j>J&&(j=J),T=0;T=16&&(j=J-J%16,this.blocks(K,G,j),G+=j,J-=j),J){for(T=0;T>16&1),oe[J-1]&=65535;oe[15]=le[15]-32767-(oe[14]>>16&1),j=oe[15]>>16&1,oe[14]&=65535,A(le,oe,1-j)}for(J=0;J<16;J++)K[2*J]=le[J]&255,K[2*J+1]=le[J]>>8}function w(K,G){var J=new Uint8Array(32),T=new Uint8Array(32);return E(J,K),E(T,G),B(J,0,T,0)}function I(K){var G=new Uint8Array(32);return E(G,K),G[0]&1}function M(K,G){var J;for(J=0;J<16;J++)K[J]=G[2*J]+(G[2*J+1]<<8);K[15]&=32767}function z(K,G,J){for(var T=0;T<16;T++)K[T]=G[T]+J[T]}function se(K,G,J){for(var T=0;T<16;T++)K[T]=G[T]-J[T]}function O(K,G,J){var T,j,oe=0,le=0,me=0,Ee=0,ke=0,Ce=0,et=0,Ze=0,rt=0,ot=0,yt=0,Rt=0,Mt=0,xt=0,Tt=0,mt=0,Et=0,ct=0,wt=0,lt=0,st=0,Ae=0,Ie=0,Ve=0,Ue=0,ze=0,Je=0,kt=0,Wt=0,Zt=0,Kt=0,ge=J[0],ir=J[1],gr=J[2],mr=J[3],Qt=J[4],vr=J[5],hr=J[6],Lr=J[7],br=J[8],xr=J[9],Fr=J[10],jr=J[11],Mr=J[12],un=J[13],fn=J[14],ln=J[15];T=G[0],oe+=T*ge,le+=T*ir,me+=T*gr,Ee+=T*mr,ke+=T*Qt,Ce+=T*vr,et+=T*hr,Ze+=T*Lr,rt+=T*br,ot+=T*xr,yt+=T*Fr,Rt+=T*jr,Mt+=T*Mr,xt+=T*un,Tt+=T*fn,mt+=T*ln,T=G[1],le+=T*ge,me+=T*ir,Ee+=T*gr,ke+=T*mr,Ce+=T*Qt,et+=T*vr,Ze+=T*hr,rt+=T*Lr,ot+=T*br,yt+=T*xr,Rt+=T*Fr,Mt+=T*jr,xt+=T*Mr,Tt+=T*un,mt+=T*fn,Et+=T*ln,T=G[2],me+=T*ge,Ee+=T*ir,ke+=T*gr,Ce+=T*mr,et+=T*Qt,Ze+=T*vr,rt+=T*hr,ot+=T*Lr,yt+=T*br,Rt+=T*xr,Mt+=T*Fr,xt+=T*jr,Tt+=T*Mr,mt+=T*un,Et+=T*fn,ct+=T*ln,T=G[3],Ee+=T*ge,ke+=T*ir,Ce+=T*gr,et+=T*mr,Ze+=T*Qt,rt+=T*vr,ot+=T*hr,yt+=T*Lr,Rt+=T*br,Mt+=T*xr,xt+=T*Fr,Tt+=T*jr,mt+=T*Mr,Et+=T*un,ct+=T*fn,wt+=T*ln,T=G[4],ke+=T*ge,Ce+=T*ir,et+=T*gr,Ze+=T*mr,rt+=T*Qt,ot+=T*vr,yt+=T*hr,Rt+=T*Lr,Mt+=T*br,xt+=T*xr,Tt+=T*Fr,mt+=T*jr,Et+=T*Mr,ct+=T*un,wt+=T*fn,lt+=T*ln,T=G[5],Ce+=T*ge,et+=T*ir,Ze+=T*gr,rt+=T*mr,ot+=T*Qt,yt+=T*vr,Rt+=T*hr,Mt+=T*Lr,xt+=T*br,Tt+=T*xr,mt+=T*Fr,Et+=T*jr,ct+=T*Mr,wt+=T*un,lt+=T*fn,st+=T*ln,T=G[6],et+=T*ge,Ze+=T*ir,rt+=T*gr,ot+=T*mr,yt+=T*Qt,Rt+=T*vr,Mt+=T*hr,xt+=T*Lr,Tt+=T*br,mt+=T*xr,Et+=T*Fr,ct+=T*jr,wt+=T*Mr,lt+=T*un,st+=T*fn,Ae+=T*ln,T=G[7],Ze+=T*ge,rt+=T*ir,ot+=T*gr,yt+=T*mr,Rt+=T*Qt,Mt+=T*vr,xt+=T*hr,Tt+=T*Lr,mt+=T*br,Et+=T*xr,ct+=T*Fr,wt+=T*jr,lt+=T*Mr,st+=T*un,Ae+=T*fn,Ie+=T*ln,T=G[8],rt+=T*ge,ot+=T*ir,yt+=T*gr,Rt+=T*mr,Mt+=T*Qt,xt+=T*vr,Tt+=T*hr,mt+=T*Lr,Et+=T*br,ct+=T*xr,wt+=T*Fr,lt+=T*jr,st+=T*Mr,Ae+=T*un,Ie+=T*fn,Ve+=T*ln,T=G[9],ot+=T*ge,yt+=T*ir,Rt+=T*gr,Mt+=T*mr,xt+=T*Qt,Tt+=T*vr,mt+=T*hr,Et+=T*Lr,ct+=T*br,wt+=T*xr,lt+=T*Fr,st+=T*jr,Ae+=T*Mr,Ie+=T*un,Ve+=T*fn,Ue+=T*ln,T=G[10],yt+=T*ge,Rt+=T*ir,Mt+=T*gr,xt+=T*mr,Tt+=T*Qt,mt+=T*vr,Et+=T*hr,ct+=T*Lr,wt+=T*br,lt+=T*xr,st+=T*Fr,Ae+=T*jr,Ie+=T*Mr,Ve+=T*un,Ue+=T*fn,ze+=T*ln,T=G[11],Rt+=T*ge,Mt+=T*ir,xt+=T*gr,Tt+=T*mr,mt+=T*Qt,Et+=T*vr,ct+=T*hr,wt+=T*Lr,lt+=T*br,st+=T*xr,Ae+=T*Fr,Ie+=T*jr,Ve+=T*Mr,Ue+=T*un,ze+=T*fn,Je+=T*ln,T=G[12],Mt+=T*ge,xt+=T*ir,Tt+=T*gr,mt+=T*mr,Et+=T*Qt,ct+=T*vr,wt+=T*hr,lt+=T*Lr,st+=T*br,Ae+=T*xr,Ie+=T*Fr,Ve+=T*jr,Ue+=T*Mr,ze+=T*un,Je+=T*fn,kt+=T*ln,T=G[13],xt+=T*ge,Tt+=T*ir,mt+=T*gr,Et+=T*mr,ct+=T*Qt,wt+=T*vr,lt+=T*hr,st+=T*Lr,Ae+=T*br,Ie+=T*xr,Ve+=T*Fr,Ue+=T*jr,ze+=T*Mr,Je+=T*un,kt+=T*fn,Wt+=T*ln,T=G[14],Tt+=T*ge,mt+=T*ir,Et+=T*gr,ct+=T*mr,wt+=T*Qt,lt+=T*vr,st+=T*hr,Ae+=T*Lr,Ie+=T*br,Ve+=T*xr,Ue+=T*Fr,ze+=T*jr,Je+=T*Mr,kt+=T*un,Wt+=T*fn,Zt+=T*ln,T=G[15],mt+=T*ge,Et+=T*ir,ct+=T*gr,wt+=T*mr,lt+=T*Qt,st+=T*vr,Ae+=T*hr,Ie+=T*Lr,Ve+=T*br,Ue+=T*xr,ze+=T*Fr,Je+=T*jr,kt+=T*Mr,Wt+=T*un,Zt+=T*fn,Kt+=T*ln,oe+=38*Et,le+=38*ct,me+=38*wt,Ee+=38*lt,ke+=38*st,Ce+=38*Ae,et+=38*Ie,Ze+=38*Ve,rt+=38*Ue,ot+=38*ze,yt+=38*Je,Rt+=38*kt,Mt+=38*Wt,xt+=38*Zt,Tt+=38*Kt,j=1,T=oe+j+65535,j=Math.floor(T/65536),oe=T-j*65536,T=le+j+65535,j=Math.floor(T/65536),le=T-j*65536,T=me+j+65535,j=Math.floor(T/65536),me=T-j*65536,T=Ee+j+65535,j=Math.floor(T/65536),Ee=T-j*65536,T=ke+j+65535,j=Math.floor(T/65536),ke=T-j*65536,T=Ce+j+65535,j=Math.floor(T/65536),Ce=T-j*65536,T=et+j+65535,j=Math.floor(T/65536),et=T-j*65536,T=Ze+j+65535,j=Math.floor(T/65536),Ze=T-j*65536,T=rt+j+65535,j=Math.floor(T/65536),rt=T-j*65536,T=ot+j+65535,j=Math.floor(T/65536),ot=T-j*65536,T=yt+j+65535,j=Math.floor(T/65536),yt=T-j*65536,T=Rt+j+65535,j=Math.floor(T/65536),Rt=T-j*65536,T=Mt+j+65535,j=Math.floor(T/65536),Mt=T-j*65536,T=xt+j+65535,j=Math.floor(T/65536),xt=T-j*65536,T=Tt+j+65535,j=Math.floor(T/65536),Tt=T-j*65536,T=mt+j+65535,j=Math.floor(T/65536),mt=T-j*65536,oe+=j-1+37*(j-1),j=1,T=oe+j+65535,j=Math.floor(T/65536),oe=T-j*65536,T=le+j+65535,j=Math.floor(T/65536),le=T-j*65536,T=me+j+65535,j=Math.floor(T/65536),me=T-j*65536,T=Ee+j+65535,j=Math.floor(T/65536),Ee=T-j*65536,T=ke+j+65535,j=Math.floor(T/65536),ke=T-j*65536,T=Ce+j+65535,j=Math.floor(T/65536),Ce=T-j*65536,T=et+j+65535,j=Math.floor(T/65536),et=T-j*65536,T=Ze+j+65535,j=Math.floor(T/65536),Ze=T-j*65536,T=rt+j+65535,j=Math.floor(T/65536),rt=T-j*65536,T=ot+j+65535,j=Math.floor(T/65536),ot=T-j*65536,T=yt+j+65535,j=Math.floor(T/65536),yt=T-j*65536,T=Rt+j+65535,j=Math.floor(T/65536),Rt=T-j*65536,T=Mt+j+65535,j=Math.floor(T/65536),Mt=T-j*65536,T=xt+j+65535,j=Math.floor(T/65536),xt=T-j*65536,T=Tt+j+65535,j=Math.floor(T/65536),Tt=T-j*65536,T=mt+j+65535,j=Math.floor(T/65536),mt=T-j*65536,oe+=j-1+37*(j-1),K[0]=oe,K[1]=le,K[2]=me,K[3]=Ee,K[4]=ke,K[5]=Ce,K[6]=et,K[7]=Ze,K[8]=rt,K[9]=ot,K[10]=yt,K[11]=Rt,K[12]=Mt,K[13]=xt,K[14]=Tt,K[15]=mt}function ie(K,G){O(K,G,G)}function ee(K,G){var J=r(),T;for(T=0;T<16;T++)J[T]=G[T];for(T=253;T>=0;T--)ie(J,J),T!==2&&T!==4&&O(J,J,G);for(T=0;T<16;T++)K[T]=J[T]}function Z(K,G){var J=r(),T;for(T=0;T<16;T++)J[T]=G[T];for(T=250;T>=0;T--)ie(J,J),T!==1&&O(J,J,G);for(T=0;T<16;T++)K[T]=J[T]}function te(K,G,J){var T=new Uint8Array(32),j=new Float64Array(80),oe,le,me=r(),Ee=r(),ke=r(),Ce=r(),et=r(),Ze=r();for(le=0;le<31;le++)T[le]=G[le];for(T[31]=G[31]&127|64,T[0]&=248,M(j,J),le=0;le<16;le++)Ee[le]=j[le],Ce[le]=me[le]=ke[le]=0;for(me[0]=Ce[0]=1,le=254;le>=0;--le)oe=T[le>>>3]>>>(le&7)&1,A(me,Ee,oe),A(ke,Ce,oe),z(et,me,ke),se(me,me,ke),z(ke,Ee,Ce),se(Ee,Ee,Ce),ie(Ce,et),ie(Ze,me),O(me,ke,me),O(ke,Ee,et),z(et,me,ke),se(me,me,ke),ie(Ee,me),se(ke,Ce,Ze),O(me,ke,f),z(me,me,Ce),O(ke,ke,me),O(me,Ce,Ze),O(Ce,Ee,j),ie(Ee,et),A(me,Ee,oe),A(ke,Ce,oe);for(le=0;le<16;le++)j[le+16]=me[le],j[le+32]=ke[le],j[le+48]=Ee[le],j[le+64]=Ce[le];var rt=j.subarray(32),ot=j.subarray(16);return ee(rt,rt),O(ot,ot,rt),E(K,ot),0}function N(K,G){return te(K,G,s)}function Q(K,G){return n(G,32),N(K,G)}function ne(K,G,J){var T=new Uint8Array(32);return te(T,J,G),k(K,i,T,$)}var de=l,ce=p;function fe(K,G,J,T,j,oe){var le=new Uint8Array(32);return ne(le,j,oe),de(K,G,J,T,le)}function be(K,G,J,T,j,oe){var le=new Uint8Array(32);return ne(le,j,oe),ce(K,G,J,T,le)}var Pe=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function De(K,G,J,T){for(var j=new Int32Array(16),oe=new Int32Array(16),le,me,Ee,ke,Ce,et,Ze,rt,ot,yt,Rt,Mt,xt,Tt,mt,Et,ct,wt,lt,st,Ae,Ie,Ve,Ue,ze,Je,kt=K[0],Wt=K[1],Zt=K[2],Kt=K[3],ge=K[4],ir=K[5],gr=K[6],mr=K[7],Qt=G[0],vr=G[1],hr=G[2],Lr=G[3],br=G[4],xr=G[5],Fr=G[6],jr=G[7],Mr=0;T>=128;){for(lt=0;lt<16;lt++)st=8*lt+Mr,j[lt]=J[st+0]<<24|J[st+1]<<16|J[st+2]<<8|J[st+3],oe[lt]=J[st+4]<<24|J[st+5]<<16|J[st+6]<<8|J[st+7];for(lt=0;lt<80;lt++)if(le=kt,me=Wt,Ee=Zt,ke=Kt,Ce=ge,et=ir,Ze=gr,rt=mr,ot=Qt,yt=vr,Rt=hr,Mt=Lr,xt=br,Tt=xr,mt=Fr,Et=jr,Ae=mr,Ie=jr,Ve=Ie&65535,Ue=Ie>>>16,ze=Ae&65535,Je=Ae>>>16,Ae=(ge>>>14|br<<18)^(ge>>>18|br<<14)^(br>>>9|ge<<23),Ie=(br>>>14|ge<<18)^(br>>>18|ge<<14)^(ge>>>9|br<<23),Ve+=Ie&65535,Ue+=Ie>>>16,ze+=Ae&65535,Je+=Ae>>>16,Ae=ge&ir^~ge&gr,Ie=br&xr^~br&Fr,Ve+=Ie&65535,Ue+=Ie>>>16,ze+=Ae&65535,Je+=Ae>>>16,Ae=Pe[lt*2],Ie=Pe[lt*2+1],Ve+=Ie&65535,Ue+=Ie>>>16,ze+=Ae&65535,Je+=Ae>>>16,Ae=j[lt%16],Ie=oe[lt%16],Ve+=Ie&65535,Ue+=Ie>>>16,ze+=Ae&65535,Je+=Ae>>>16,Ue+=Ve>>>16,ze+=Ue>>>16,Je+=ze>>>16,ct=ze&65535|Je<<16,wt=Ve&65535|Ue<<16,Ae=ct,Ie=wt,Ve=Ie&65535,Ue=Ie>>>16,ze=Ae&65535,Je=Ae>>>16,Ae=(kt>>>28|Qt<<4)^(Qt>>>2|kt<<30)^(Qt>>>7|kt<<25),Ie=(Qt>>>28|kt<<4)^(kt>>>2|Qt<<30)^(kt>>>7|Qt<<25),Ve+=Ie&65535,Ue+=Ie>>>16,ze+=Ae&65535,Je+=Ae>>>16,Ae=kt&Wt^kt&Zt^Wt&Zt,Ie=Qt&vr^Qt&hr^vr&hr,Ve+=Ie&65535,Ue+=Ie>>>16,ze+=Ae&65535,Je+=Ae>>>16,Ue+=Ve>>>16,ze+=Ue>>>16,Je+=ze>>>16,rt=ze&65535|Je<<16,Et=Ve&65535|Ue<<16,Ae=ke,Ie=Mt,Ve=Ie&65535,Ue=Ie>>>16,ze=Ae&65535,Je=Ae>>>16,Ae=ct,Ie=wt,Ve+=Ie&65535,Ue+=Ie>>>16,ze+=Ae&65535,Je+=Ae>>>16,Ue+=Ve>>>16,ze+=Ue>>>16,Je+=ze>>>16,ke=ze&65535|Je<<16,Mt=Ve&65535|Ue<<16,Wt=le,Zt=me,Kt=Ee,ge=ke,ir=Ce,gr=et,mr=Ze,kt=rt,vr=ot,hr=yt,Lr=Rt,br=Mt,xr=xt,Fr=Tt,jr=mt,Qt=Et,lt%16===15)for(st=0;st<16;st++)Ae=j[st],Ie=oe[st],Ve=Ie&65535,Ue=Ie>>>16,ze=Ae&65535,Je=Ae>>>16,Ae=j[(st+9)%16],Ie=oe[(st+9)%16],Ve+=Ie&65535,Ue+=Ie>>>16,ze+=Ae&65535,Je+=Ae>>>16,ct=j[(st+1)%16],wt=oe[(st+1)%16],Ae=(ct>>>1|wt<<31)^(ct>>>8|wt<<24)^ct>>>7,Ie=(wt>>>1|ct<<31)^(wt>>>8|ct<<24)^(wt>>>7|ct<<25),Ve+=Ie&65535,Ue+=Ie>>>16,ze+=Ae&65535,Je+=Ae>>>16,ct=j[(st+14)%16],wt=oe[(st+14)%16],Ae=(ct>>>19|wt<<13)^(wt>>>29|ct<<3)^ct>>>6,Ie=(wt>>>19|ct<<13)^(ct>>>29|wt<<3)^(wt>>>6|ct<<26),Ve+=Ie&65535,Ue+=Ie>>>16,ze+=Ae&65535,Je+=Ae>>>16,Ue+=Ve>>>16,ze+=Ue>>>16,Je+=ze>>>16,j[st]=ze&65535|Je<<16,oe[st]=Ve&65535|Ue<<16;Ae=kt,Ie=Qt,Ve=Ie&65535,Ue=Ie>>>16,ze=Ae&65535,Je=Ae>>>16,Ae=K[0],Ie=G[0],Ve+=Ie&65535,Ue+=Ie>>>16,ze+=Ae&65535,Je+=Ae>>>16,Ue+=Ve>>>16,ze+=Ue>>>16,Je+=ze>>>16,K[0]=kt=ze&65535|Je<<16,G[0]=Qt=Ve&65535|Ue<<16,Ae=Wt,Ie=vr,Ve=Ie&65535,Ue=Ie>>>16,ze=Ae&65535,Je=Ae>>>16,Ae=K[1],Ie=G[1],Ve+=Ie&65535,Ue+=Ie>>>16,ze+=Ae&65535,Je+=Ae>>>16,Ue+=Ve>>>16,ze+=Ue>>>16,Je+=ze>>>16,K[1]=Wt=ze&65535|Je<<16,G[1]=vr=Ve&65535|Ue<<16,Ae=Zt,Ie=hr,Ve=Ie&65535,Ue=Ie>>>16,ze=Ae&65535,Je=Ae>>>16,Ae=K[2],Ie=G[2],Ve+=Ie&65535,Ue+=Ie>>>16,ze+=Ae&65535,Je+=Ae>>>16,Ue+=Ve>>>16,ze+=Ue>>>16,Je+=ze>>>16,K[2]=Zt=ze&65535|Je<<16,G[2]=hr=Ve&65535|Ue<<16,Ae=Kt,Ie=Lr,Ve=Ie&65535,Ue=Ie>>>16,ze=Ae&65535,Je=Ae>>>16,Ae=K[3],Ie=G[3],Ve+=Ie&65535,Ue+=Ie>>>16,ze+=Ae&65535,Je+=Ae>>>16,Ue+=Ve>>>16,ze+=Ue>>>16,Je+=ze>>>16,K[3]=Kt=ze&65535|Je<<16,G[3]=Lr=Ve&65535|Ue<<16,Ae=ge,Ie=br,Ve=Ie&65535,Ue=Ie>>>16,ze=Ae&65535,Je=Ae>>>16,Ae=K[4],Ie=G[4],Ve+=Ie&65535,Ue+=Ie>>>16,ze+=Ae&65535,Je+=Ae>>>16,Ue+=Ve>>>16,ze+=Ue>>>16,Je+=ze>>>16,K[4]=ge=ze&65535|Je<<16,G[4]=br=Ve&65535|Ue<<16,Ae=ir,Ie=xr,Ve=Ie&65535,Ue=Ie>>>16,ze=Ae&65535,Je=Ae>>>16,Ae=K[5],Ie=G[5],Ve+=Ie&65535,Ue+=Ie>>>16,ze+=Ae&65535,Je+=Ae>>>16,Ue+=Ve>>>16,ze+=Ue>>>16,Je+=ze>>>16,K[5]=ir=ze&65535|Je<<16,G[5]=xr=Ve&65535|Ue<<16,Ae=gr,Ie=Fr,Ve=Ie&65535,Ue=Ie>>>16,ze=Ae&65535,Je=Ae>>>16,Ae=K[6],Ie=G[6],Ve+=Ie&65535,Ue+=Ie>>>16,ze+=Ae&65535,Je+=Ae>>>16,Ue+=Ve>>>16,ze+=Ue>>>16,Je+=ze>>>16,K[6]=gr=ze&65535|Je<<16,G[6]=Fr=Ve&65535|Ue<<16,Ae=mr,Ie=jr,Ve=Ie&65535,Ue=Ie>>>16,ze=Ae&65535,Je=Ae>>>16,Ae=K[7],Ie=G[7],Ve+=Ie&65535,Ue+=Ie>>>16,ze+=Ae&65535,Je+=Ae>>>16,Ue+=Ve>>>16,ze+=Ue>>>16,Je+=ze>>>16,K[7]=mr=ze&65535|Je<<16,G[7]=jr=Ve&65535|Ue<<16,Mr+=128,T-=128}return T}function Te(K,G,J){var T=new Int32Array(8),j=new Int32Array(8),oe=new Uint8Array(256),le,me=J;for(T[0]=1779033703,T[1]=3144134277,T[2]=1013904242,T[3]=2773480762,T[4]=1359893119,T[5]=2600822924,T[6]=528734635,T[7]=1541459225,j[0]=4089235720,j[1]=2227873595,j[2]=4271175723,j[3]=1595750129,j[4]=2917565137,j[5]=725511199,j[6]=4215389547,j[7]=327033209,De(T,j,G,J),J%=128,le=0;le=0;--j)T=J[j/8|0]>>(j&7)&1,Me(K,G,T),Fe(G,K),Fe(K,K),Me(K,G,T)}function Oe(K,G){var J=[r(),r(),r(),r()];m(J[0],g),m(J[1],b),m(J[2],a),O(J[3],g,b),He(K,J,G)}function $e(K,G,J){var T=new Uint8Array(64),j=[r(),r(),r(),r()],oe;for(J||n(G,32),Te(T,G,32),T[0]&=248,T[31]&=127,T[31]|=64,Oe(j,T),Ne(K,j),oe=0;oe<32;oe++)G[oe+32]=K[oe];return 0}var qe=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function _e(K,G){var J,T,j,oe;for(T=63;T>=32;--T){for(J=0,j=T-32,oe=T-12;j>4)*qe[j],J=G[j]>>8,G[j]&=255;for(j=0;j<32;j++)G[j]-=J*qe[j];for(T=0;T<32;T++)G[T+1]+=G[T]>>8,K[T]=G[T]&255}function Qe(K){var G=new Float64Array(64),J;for(J=0;J<64;J++)G[J]=K[J];for(J=0;J<64;J++)K[J]=0;_e(K,G)}function at(K,G,J,T){var j=new Uint8Array(64),oe=new Uint8Array(64),le=new Uint8Array(64),me,Ee,ke=new Float64Array(64),Ce=[r(),r(),r(),r()];Te(j,T,32),j[0]&=248,j[31]&=127,j[31]|=64;var et=J+64;for(me=0;me>7&&se(K[0],o,K[0]),O(K[3],K[0],K[1]),0)}function nt(K,G,J,T){var j,oe=new Uint8Array(32),le=new Uint8Array(64),me=[r(),r(),r(),r()],Ee=[r(),r(),r(),r()];if(J<64||Be(Ee,T))return-1;for(j=0;j=0},e.sign.keyPair=function(){var K=new Uint8Array(gt),G=new Uint8Array(Ot);return $e(K,G),{publicKey:K,secretKey:G}},e.sign.keyPair.fromSecretKey=function(K){if(tt(K),K.length!==Ot)throw new Error("bad secret key size");for(var G=new Uint8Array(gt),J=0;J=t.length)throw new Error("Index is out of buffer");const r=t.slice(0,e),n=t.slice(e);return[r,n]}function U1(t){let e="";return t.forEach(r=>{e+=("0"+(r&255).toString(16)).slice(-2)}),e}function Kd(t){if(t.length%2!==0)throw new Error(`Cannot convert ${t} to bytesArray`);const e=new Uint8Array(t.length/2);for(let r=0;r{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new Ut("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new Ut("Delay aborted"))})})})}function Is(t){const e=new AbortController;return t!=null&&t.aborted?e.abort():t==null||t.addEventListener("abort",()=>e.abort(),{once:!0}),e}function dh(t,e){var r,n;return Pt(this,void 0,void 0,function*(){const i=(r=e==null?void 0:e.attempts)!==null&&r!==void 0?r:10,s=(n=e==null?void 0:e.delayMs)!==null&&n!==void 0?n:200,o=Is(e==null?void 0:e.signal);if(typeof t!="function")throw new Ut(`Expected a function, got ${typeof t}`);let a=0,u;for(;aPt(this,void 0,void 0,function*(){if(s=p??null,o==null||o.abort(),o=Is(p),o.signal.aborted)throw new Ut("Resource creation was aborted");n=y??null;const _=t(o.signal,...y);i=_;const M=yield _;if(i!==_&&M!==r)throw yield e(M),new Ut("Resource creation was aborted by a new resource creation");return r=M,r});return{create:a,current:()=>r??null,dispose:()=>Pt(this,void 0,void 0,function*(){try{const p=r;r=null;const y=i;i=null;try{o==null||o.abort()}catch{}yield Promise.allSettled([p?e(p):Promise.resolve(),y?e(yield y):Promise.resolve()])}catch{}}),recreate:p=>Pt(this,void 0,void 0,function*(){const y=r,_=i,M=n,O=s;if(yield m9(p),y===r&&_===i&&M===n&&O===s)return yield a(s,...M??[]);throw new Ut("Resource recreation was aborted by a new resource creation")})}}function RQ(t,e){const r=e==null?void 0:e.timeout,n=e==null?void 0:e.signal,i=Is(n);return new Promise((s,o)=>Pt(this,void 0,void 0,function*(){if(i.signal.aborted){o(new Ut("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new Ut(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new Ut("Operation aborted"))},{once:!0});const u={timeout:r,abort:i.signal};yield t((...l)=>{clearTimeout(a),s(...l)},()=>{clearTimeout(a),o()},u)}))}class Hb{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=TQ((o,a)=>Pt(this,void 0,void 0,function*(){const u={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield DQ(u)}),o=>Pt(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new AQ(e,r)}get isReady(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return(e==null?void 0:e.readyState)===EventSource.CONNECTING}registerSession(e){return Pt(this,void 0,void 0,function*(){yield this.eventSource.create(e==null?void 0:e.signal,e==null?void 0:e.openingDeadlineMS)})}send(e,r,n,i){var s;return Pt(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i==null?void 0:i.ttl,o.signal=i==null?void 0:i.signal,o.attempts=i==null?void 0:i.attempts);const a=new URL(g9(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",((o==null?void 0:o.ttl)||this.defaultTtl).toString()),a.searchParams.append("topic",n);const u=h9.encode(e);yield dh(l=>Pt(this,void 0,void 0,function*(){const d=yield this.post(a,u,l.signal);if(!d.ok)throw new Ut(`Bridge send failed, status ${d.status}`)}),{attempts:(s=o==null?void 0:o.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o==null?void 0:o.signal})})}pause(){this.eventSource.dispose().catch(e=>Fo(`Bridge pause failed, ${e}`))}unPause(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return Pt(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>Fo(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return Pt(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new Ut(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return Pt(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new Ut("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),En(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new Ut("Bridge error, unknown state")})}messagesHandler(e){return Pt(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new Ut(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function DQ(t){return Pt(this,void 0,void 0,function*(){return yield RQ((e,r,n)=>Pt(this,void 0,void 0,function*(){var i;const o=Is(n.signal).signal;if(o.aborted){r(new Ut("Bridge connection aborted"));return}const a=new URL(g9(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const u=yield t.bridgeGatewayStorage.getLastEventId();if(u&&a.searchParams.append("last_event_id",u),o.aborted){r(new Ut("Bridge connection aborted"));return}const l=new EventSource(a.toString());l.onerror=d=>Pt(this,void 0,void 0,function*(){if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}try{const p=yield t.errorHandler(l,d);p!==l&&l.close(),p&&p!==l&&e(p)}catch(p){l.close(),r(p)}}),l.onopen=()=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}e(l)},l.onmessage=d=>{if(o.aborted){l.close(),r(new Ut("Bridge connection aborted"));return}t.messageHandler(d)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{l.close(),r(new Ut("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function ph(t){return!("connectEvent"in t)}class gh{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return Pt(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!ph(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return Pt(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new Fb(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new Fb(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new Ut("Trying to read HTTP connection source while injected connection is stored");if(!ph(e))throw new Ut("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new Ut("Trying to read Injected bridge connection source while nothing is stored");if((e==null?void 0:e.type)==="http")throw new Ut("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return Pt(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return Pt(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!ph(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return Pt(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const v9=2;class mh{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new gh(e)}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new gh(e).getHttpConnection();return ph(n)?new mh(e,n.connectionSource):new mh(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=Is(r==null?void 0:r.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new Fb;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>Pt(this,void 0,void 0,function*(){i.signal.aborted||(yield dh(a=>{var u;return this.openGateways(s,{openingDeadlineMS:(u=r==null?void 0:r.openingDeadlineMS)!==null&&u!==void 0?u:this.defaultOpeningDeadlineMS,signal:a==null?void 0:a.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){const i=Is(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e==null?void 0:e.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(ph(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i==null?void 0:i.signal});if(Array.isArray(this.walletConnectionSource))throw new Ut("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(En("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Hb(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield dh(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal,n.attempts=r==null?void 0:r.attempts),new Promise((i,s)=>Pt(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new Ut("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),En("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const u=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),ap(this.session.walletPublicKey));try{yield this.gateway.send(u,this.session.walletPublicKey,e.method,{attempts:n==null?void 0:n.attempts,signal:n==null?void 0:n.signal}),(o=n==null?void 0:n.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(l){s(l)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return Pt(this,void 0,void 0,function*(){return new Promise(r=>Pt(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=Is(e==null?void 0:e.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){En("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return Pt(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return Pt(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(En("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return Pt(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(h9.decode(e.message).toUint8Array(),ap(e.from)));if(En("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){En(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){Fo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(En("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return Pt(this,void 0,void 0,function*(){throw new Ut(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return Pt(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return Pt(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return MQ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",v9.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+IQ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return Pt(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new Hb(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>dh(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r==null?void 0:r.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r==null?void 0:r.signal})));return}else return this.gateway&&(En("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new Hb(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r==null?void 0:r.openingDeadlineMS,signal:r==null?void 0:r.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==(e==null?void 0:e.except)).forEach(n=>n.close()),this.pendingGateways=[]}}function b9(t,e){return y9(t,[e])}function y9(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function OQ(t){try{return!b9(t,"tonconnect")||!b9(t.tonconnect,"walletInfo")?!1:y9(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Xu{constructor(){this.storage={}}static getInstance(){return Xu.instance||(Xu.instance=new Xu),Xu.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function gp(){if(!(typeof window>"u"))return window}function NQ(){const t=gp();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function LQ(){if(!(typeof document>"u"))return document}function kQ(){var t;const e=(t=gp())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function BQ(){if($Q())return localStorage;if(FQ())throw new Ut("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Xu.getInstance()}function $Q(){try{return typeof localStorage<"u"}catch{return!1}}function FQ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class wi{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=wi.window;if(!wi.isWindowContainsWallet(n,r))throw new qb;this.connectionStorage=new gh(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return Pt(this,void 0,void 0,function*(){const n=yield new gh(e).getInjectedConnection();return new wi(e,n.jsBridgeKey)})}static isWalletInjected(e){return wi.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return wi.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?NQ().filter(([n,i])=>OQ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(v9,e)}restoreConnection(){return Pt(this,void 0,void 0,function*(){try{En("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();En("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return Pt(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){En(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return Pt(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r==null?void 0:r.onRequestSent,i.signal=r==null?void 0:r.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),En("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>En("Wallet message received:",a)),(n=i==null?void 0:i.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return Pt(this,void 0,void 0,function*(){try{En(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);En("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){En("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n==null?void 0:n.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{En("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}wi.window=gp();class jQ{constructor(){this.localStorage=BQ()}getItem(e){return Pt(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return Pt(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return Pt(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function w9(t){return qQ(t)&&t.injected}function UQ(t){return w9(t)&&t.embedded}function qQ(t){return"jsBridgeKey"in t}const zQ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class Wb{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e!=null&&e.walletsListSource&&(this.walletsListSource=e.walletsListSource),e!=null&&e.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return Pt(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return Pt(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(UQ);return r.length!==1?null:r[0]})}fetchWalletsList(){return Pt(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new zb("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(Fo(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){Fo(n),e=zQ}let r=[];try{r=wi.getCurrentlyInjectedWallets()}catch(n){Fo(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=wi.isWalletInjected(o),i.embedded=wi.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(d=>!d||typeof d!="object"||!("type"in d)))return!1;const u=a.find(d=>d.type==="sse");if(u&&(!("url"in u)||!u.url||!e.universal_url))return!1;const l=a.find(d=>d.type==="js");return!(l&&(!("key"in l)||!l.key))}}class mp extends Ut{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,mp.prototype)}}function HQ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new mp("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,u;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(u=o.amount)!==null&&u!==void 0?u:null}})}}function QQ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Qu(t,e)),Kb(e,r))}function eee(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Qu(t,e)),Kb(e,r))}function tee(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Qu(t,e)),Kb(e,r))}function ree(t,e,r){return Object.assign({type:"disconnection",scope:r},Qu(t,e))}class nee{constructor(){this.window=gp()}dispatchEvent(e,r){var n;return Pt(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return Pt(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class iee{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e==null?void 0:e.eventDispatcher)!==null&&r!==void 0?r:new nee,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Zu({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return Pt(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>Pt(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",KQ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return Pt(this,void 0,void 0,function*(){return new Promise((e,r)=>Pt(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",WQ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=VQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=GQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=YQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=JQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=XQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=ZQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=ree(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=QQ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=eee(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=tee(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const see="3.0.5";class vh{constructor(e){if(this.walletsList=new Wb,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(e==null?void 0:e.manifestUrl)||kQ(),storage:(e==null?void 0:e.storage)||new jQ},this.walletsList=new Wb({walletsListSource:e==null?void 0:e.walletsListSource,cacheTTLMs:e==null?void 0:e.walletsListCacheTTLMs}),this.tracker=new iee({eventDispatcher:e==null?void 0:e.eventDispatcher,tonConnectSdkVersion:see}),!this.dappSettings.manifestUrl)throw new jb("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new gh(this.dappSettings.storage),e!=null&&e.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r==null?void 0:r.request,s.openingDeadlineMS=r==null?void 0:r.openingDeadlineMS,s.signal=r==null?void 0:r.signal),this.connected)throw new Ub;const o=Is(s==null?void 0:s.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new Ut("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s==null?void 0:s.request),{openingDeadlineMS:s==null?void 0:s.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return Pt(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=Is(e==null?void 0:e.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield mh.fromStorage(this.dappSettings.storage);break;case"injected":a=yield wi.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a==null||a.closeConnection(),a=null;return}if(i.signal.aborted){a==null||a.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){Fo("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const u=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a==null||a.closeConnection(),a=null};i.signal.addEventListener("abort",u);const l=dh(p=>Pt(this,void 0,void 0,function*(){yield a==null?void 0:a.restoreConnection({openingDeadlineMS:e==null?void 0:e.openingDeadlineMS,signal:p.signal}),i.signal.removeEventListener("abort",u),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e==null?void 0:e.signal}),d=new Promise(p=>setTimeout(()=>p(),12e3));return Promise.race([l,d])})}sendTransaction(e,r){return Pt(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r==null?void 0:r.onRequestSent,n.signal=r==null?void 0:r.signal);const i=Is(n==null?void 0:n.signal);if(i.signal.aborted)throw new Ut("Transaction sending was aborted");this.checkConnection(),HQ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=yQ(e,["validUntil"]),a=e.from||this.account.address,u=e.network||this.account.chain,l=yield this.provider.sendRequest(pp.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:u})),{onRequestSent:n.onRequestSent,signal:i.signal});if(pp.isError(l))return this.tracker.trackTransactionSigningFailed(this.wallet,e,l.error.message,l.error.code),pp.parseAndThrowError(l);const d=pp.convertFromRpcResponse(l);return this.tracker.trackTransactionSigned(this.wallet,e,d),d})}disconnect(e){var r;return Pt(this,void 0,void 0,function*(){if(!this.connected)throw new fp;const n=Is(e==null?void 0:e.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new Ut("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i==null||i.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=LQ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){Fo("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&wQ(e)?r=new wi(this.dappSettings.storage,e.jsBridgeKey):r=new mh(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new Ut("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=_Q.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),En(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof up||r instanceof cp)throw Fo(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new fp}createConnectRequest(e){const r=[{name:"ton_addr"}];return e!=null&&e.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}vh.walletsList=new Wb,vh.isWalletInjected=t=>wi.isWalletInjected(t),vh.isInsideWalletBrowser=t=>wi.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function Vb(t){const{children:e,onClick:r}=t;return le.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function x9(t){const{wallet:e,connector:r,loading:n}=t,i=Ee.useRef(null),s=Ee.useRef(),[o,a]=Ee.useState(),[u,l]=Ee.useState(),[d,p]=Ee.useState("connect"),[y,_]=Ee.useState(!1),[M,O]=Ee.useState();function L(W){var ie;(ie=s.current)==null||ie.update({data:W})}async function B(){_(!0);try{a("");const W=await xa.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const ie=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:W}});if(!ie)return;O(ie),L(ie),l(W)}}catch(W){a(W.message)}_(!1)}function k(){s.current=new Z7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function H(){r.connect(e,{request:{tonProof:u}})}function U(){if("deepLink"in e){if(!e.deepLink||!M)return;const W=new URL(M),ie=`${e.deepLink}${W.search}`;window.open(ie)}}function z(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(M)}const Z=Ee.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),R=Ee.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Ee.useEffect(()=>{k(),B()},[]),le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Rc,{title:"Connect wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-text-center xc-mb-6",children:[le.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[le.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),le.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:y?le.jsx(Sc,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):le.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),le.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),le.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&le.jsx(Sc,{className:"xc-animate-spin"}),!y&&!n&&le.jsxs(le.Fragment,{children:[w9(e)&&le.jsxs(Vb,{onClick:H,children:[le.jsx(pV,{className:"xc-opacity-80"}),"Extension"]}),Z&&le.jsxs(Vb,{onClick:U,children:[le.jsx(F8,{className:"xc-opacity-80"}),"Desktop"]}),R&&le.jsx(Vb,{onClick:z,children:"Telegram Mini App"})]})]})]})}function oee(t){const[e,r]=Ee.useState(""),[n,i]=Ee.useState(),[s,o]=Ee.useState(),a=Bb(),[u,l]=Ee.useState(!1);async function d(y){var M,O;if(!y||!((M=y.connectItems)!=null&&M.tonProof))return;l(!0);const _=await xa.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:y==null?void 0:y.device.appName,inviter_code:a.inviterCode,address:y.account.address,chain:y.account.chain,connect_info:[{name:"ton_addr",network:y.account.chain,...y.account},(O=y.connectItems)==null?void 0:O.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(_.data),l(!1)}Ee.useEffect(()=>{const y=new vh({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),_=y.onStatusChange(d);return o(y),r("select"),_},[]);function p(y){r("connect"),i(y)}return le.jsxs(Ms,{children:[e==="select"&&le.jsx(s9,{connector:s,onSelect:p,onBack:t.onBack}),e==="connect"&&le.jsx(x9,{connector:s,wallet:n,onBack:t.onBack,loading:u})]})}function _9(t){const{children:e,className:r}=t,n=Ee.useRef(null),[i,s]=Ee.useState(0);function o(){var a;try{const u=((a=n.current)==null?void 0:a.children)||[];let l=0;for(let d=0;d{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Ee.useEffect(()=>{console.log("maxHeight",i)},[i]),le.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function aee(){return le.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[le.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),le.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),le.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function E9(t){const{wallets:e}=Yl(),[r,n]=Ee.useState(),i=Ee.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Rc,{title:"Select wallet",onBack:t.onBack})}),le.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[le.jsx(j8,{className:"xc-shrink-0 xc-opacity-50"}),le.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),le.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>le.jsx(C7,{wallet:a,onClick:s},`feature-${a.key}`)):le.jsx(aee,{})})]})}function cee(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,u]=Ee.useState(""),[l,d]=Ee.useState(null),[p,y]=Ee.useState("");function _(B){d(B),u("evm-wallet")}function M(B){u("email"),y(B)}async function O(B){await e(B)}function L(){u("ton-wallet")}return Ee.useEffect(()=>{u("index")},[]),le.jsx(PZ,{config:t.config,children:le.jsxs(_9,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&le.jsx(uQ,{onBack:()=>u("index"),onLogin:O,wallet:l}),a==="ton-wallet"&&le.jsx(oee,{onBack:()=>u("index"),onLogin:O}),a==="email"&&le.jsx(UZ,{email:p,onBack:()=>u("index"),onLogin:O}),a==="index"&&le.jsx(F7,{header:r,onEmailConfirm:M,onSelectWallet:_,onSelectMoreWallets:()=>{u("all-wallet")},onSelectTonConnect:L,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&le.jsx(E9,{onBack:()=>u("index"),onSelectWallet:_})]})})}function uee(t){const{wallet:e,onConnect:r}=t,[n,i]=Ee.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-6",children:le.jsx(Rc,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&le.jsx(r9,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&le.jsx(n9,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&le.jsx(i9,{wallet:e})]})}function fee(t){const{email:e}=t,[r,n]=Ee.useState("captcha");return le.jsxs(Ms,{children:[le.jsx("div",{className:"xc-mb-12",children:le.jsx(Rc,{title:"Sign in with email",onBack:t.onBack})}),r==="captcha"&&le.jsx(J7,{email:e,onCodeSend:()=>n("verify-email")}),r==="verify-email"&&le.jsx(Y7,{email:e,onInputCode:t.onInputCode,onResendCode:()=>n("captcha")})]})}function lee(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Ee.useState(""),[a,u]=Ee.useState(),[l,d]=Ee.useState(),p=Ee.useRef(),[y,_]=Ee.useState("");function M(U){u(U),o("evm-wallet-connect")}function O(U){_(U),o("email-connect")}async function L(U,z){await(e==null?void 0:e({chain_type:"eip155",client:U.client,connect_info:z,wallet:U})),o("index")}async function B(U,z){await(n==null?void 0:n(U,z))}function k(U){d(U),o("ton-wallet-connect")}async function H(U){U&&await(r==null?void 0:r({chain_type:"ton",client:p.current,connect_info:U,wallet:U}))}return Ee.useEffect(()=>{p.current=new vh({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const U=p.current.onStatusChange(H);return o("index"),U},[]),le.jsxs(_9,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&le.jsx(E9,{onBack:()=>o("index"),onSelectWallet:M}),s==="evm-wallet-connect"&&le.jsx(uee,{onBack:()=>o("index"),onConnect:L,wallet:a}),s==="ton-wallet-select"&&le.jsx(s9,{connector:p.current,onSelect:k,onBack:()=>o("index")}),s==="ton-wallet-connect"&&le.jsx(x9,{connector:p.current,wallet:l,onBack:()=>o("index")}),s==="email-connect"&&le.jsx(fee,{email:y,onBack:()=>o("index"),onInputCode:B}),s==="index"&&le.jsx(F7,{onEmailConfirm:O,onSelectWallet:M,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Pn.CodattaConnect=lee,Pn.CodattaConnectContextProvider=oV,Pn.CodattaSignin=cee,Pn.WalletItem=Ga,Pn.coinbaseWallet=L8,Pn.useCodattaConnectContext=Yl,Object.defineProperty(Pn,Symbol.toStringTag,{value:"Module"})}); + ***************************************************************************** */function GY(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new $t("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new $t("Delay aborted"))})})})}function hs(t){const e=new AbortController;return t?.aborted?e.abort():t?.addEventListener("abort",()=>e.abort(),{once:!0}),e}function cl(t,e){var r,n;return At(this,void 0,void 0,function*(){const i=(r=e?.attempts)!==null&&r!==void 0?r:10,s=(n=e?.delayMs)!==null&&n!==void 0?n:200,o=hs(e?.signal);if(typeof t!="function")throw new $t(`Expected a function, got ${typeof t}`);let a=0,f;for(;aAt(this,void 0,void 0,function*(){if(s=g??null,o?.abort(),o=hs(g),o.signal.aborted)throw new $t("Resource creation was aborted");n=b??null;const x=t(o.signal,...b);i=x;const S=yield x;if(i!==x&&S!==r)throw yield e(S),new $t("Resource creation was aborted by a new resource creation");return r=S,r});return{create:a,current:()=>r??null,dispose:()=>At(this,void 0,void 0,function*(){try{const g=r;r=null;const b=i;i=null;try{o?.abort()}catch{}yield Promise.allSettled([g?e(g):Promise.resolve(),b?e(yield b):Promise.resolve()])}catch{}}),recreate:g=>At(this,void 0,void 0,function*(){const b=r,x=i,S=n,C=s;if(yield b7(g),b===r&&x===i&&S===n&&C===s)return yield a(s,...S??[]);throw new $t("Resource recreation was aborted by a new resource creation")})}}function oJ(t,e){const r=e?.timeout,n=e?.signal,i=hs(n);return new Promise((s,o)=>At(this,void 0,void 0,function*(){if(i.signal.aborted){o(new $t("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new $t(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new $t("Operation aborted"))},{once:!0});const f={timeout:r,abort:i.signal};yield t((...u)=>{clearTimeout(a),s(...u)},()=>{clearTimeout(a),o()},f)}))}class K1{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=sJ((o,a)=>At(this,void 0,void 0,function*(){const f={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield aJ(f)}),o=>At(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new eJ(e,r)}get isReady(){const e=this.eventSource.current();return e?.readyState===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return e?.readyState!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return e?.readyState===EventSource.CONNECTING}registerSession(e){return At(this,void 0,void 0,function*(){yield this.eventSource.create(e?.signal,e?.openingDeadlineMS)})}send(e,r,n,i){var s;return At(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i?.ttl,o.signal=i?.signal,o.attempts=i?.attempts);const a=new URL(v7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",(o?.ttl||this.defaultTtl).toString()),a.searchParams.append("topic",n);const f=p7.encode(e);yield cl(u=>At(this,void 0,void 0,function*(){const h=yield this.post(a,f,u.signal);if(!h.ok)throw new $t(`Bridge send failed, status ${h.status}`)}),{attempts:(s=o?.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o?.signal})})}pause(){this.eventSource.dispose().catch(e=>co(`Bridge pause failed, ${e}`))}unPause(){return At(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return At(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>co(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return At(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new $t(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return At(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new $t("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),xn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new $t("Bridge error, unknown state")})}messagesHandler(e){return At(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new $t(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function aJ(t){return At(this,void 0,void 0,function*(){return yield oJ((e,r,n)=>At(this,void 0,void 0,function*(){var i;const o=hs(n.signal).signal;if(o.aborted){r(new $t("Bridge connection aborted"));return}const a=new URL(v7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const f=yield t.bridgeGatewayStorage.getLastEventId();if(f&&a.searchParams.append("last_event_id",f),o.aborted){r(new $t("Bridge connection aborted"));return}const u=new EventSource(a.toString());u.onerror=h=>At(this,void 0,void 0,function*(){if(o.aborted){u.close(),r(new $t("Bridge connection aborted"));return}try{const g=yield t.errorHandler(u,h);g!==u&&u.close(),g&&g!==u&&e(g)}catch(g){u.close(),r(g)}}),u.onopen=()=>{if(o.aborted){u.close(),r(new $t("Bridge connection aborted"));return}e(u)},u.onmessage=h=>{if(o.aborted){u.close(),r(new $t("Bridge connection aborted"));return}t.messageHandler(h)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{u.close(),r(new $t("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function ul(t){return!("connectEvent"in t)}class fl{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return At(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!ul(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return At(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return At(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new $1(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new $1(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new $t("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new $t("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new $t("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new $t("Trying to read HTTP connection source while injected connection is stored");if(!ul(e))throw new $t("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new $t("Trying to read Injected bridge connection source while nothing is stored");if(e?.type==="http")throw new $t("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return At(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return At(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!ul(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const y7=2;class ll{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new fl(e)}static fromStorage(e){return At(this,void 0,void 0,function*(){const n=yield new fl(e).getHttpConnection();return ul(n)?new ll(e,n.connectionSource):new ll(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=hs(r?.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new $1;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>At(this,void 0,void 0,function*(){i.signal.aborted||(yield cl(a=>{var f;return this.openGateways(s,{openingDeadlineMS:(f=r?.openingDeadlineMS)!==null&&f!==void 0?f:this.defaultOpeningDeadlineMS,signal:a?.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return At(this,void 0,void 0,function*(){const i=hs(e?.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e?.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(ul(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i?.signal});if(Array.isArray(this.walletConnectionSource))throw new $t("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(xn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new K1(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield cl(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r?.onRequestSent,n.signal=r?.signal,n.attempts=r?.attempts),new Promise((i,s)=>At(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new $t("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),xn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const f=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),Kd(this.session.walletPublicKey));try{yield this.gateway.send(f,this.session.walletPublicKey,e.method,{attempts:n?.attempts,signal:n?.signal}),(o=n?.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(u){s(u)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return At(this,void 0,void 0,function*(){return new Promise(r=>At(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=hs(e?.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){xn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return At(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return At(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(xn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return At(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(p7.decode(e.message).toUint8Array(),Kd(e.from)));if(xn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){xn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){co(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(xn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return At(this,void 0,void 0,function*(){throw new $t(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return At(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return At(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return rJ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",y7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+nJ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return At(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new K1(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>cl(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r?.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r?.signal})));return}else return this.gateway&&(xn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new K1(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r?.openingDeadlineMS,signal:r?.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==e?.except).forEach(n=>n.close()),this.pendingGateways=[]}}function w7(t,e){return x7(t,[e])}function x7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function cJ(t){try{return!w7(t,"tonconnect")||!w7(t.tonconnect,"walletInfo")?!1:x7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Yc{constructor(){this.storage={}}static getInstance(){return Yc.instance||(Yc.instance=new Yc),Yc.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function e0(){if(!(typeof window>"u"))return window}function uJ(){const t=e0();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function fJ(){if(!(typeof document>"u"))return document}function lJ(){var t;const e=(t=e0())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function hJ(){if(dJ())return localStorage;if(pJ())throw new $t("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Yc.getInstance()}function dJ(){try{return typeof localStorage<"u"}catch{return!1}}function pJ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class ui{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=ui.window;if(!ui.isWindowContainsWallet(n,r))throw new H1;this.connectionStorage=new fl(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return At(this,void 0,void 0,function*(){const n=yield new fl(e).getInjectedConnection();return new ui(e,n.jsBridgeKey)})}static isWalletInjected(e){return ui.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return ui.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?uJ().filter(([n,i])=>cJ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(y7,e)}restoreConnection(){return At(this,void 0,void 0,function*(){try{xn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();xn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return At(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){xn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return At(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r?.onRequestSent,i.signal=r?.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),xn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>xn("Wallet message received:",a)),(n=i?.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return At(this,void 0,void 0,function*(){try{xn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);xn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){xn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n?.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{xn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}ui.window=e0();class gJ{constructor(){this.localStorage=hJ()}getItem(e){return At(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return At(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return At(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function _7(t){return vJ(t)&&t.injected}function mJ(t){return _7(t)&&t.embedded}function vJ(t){return"jsBridgeKey"in t}const bJ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class V1{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e?.walletsListSource&&(this.walletsListSource=e.walletsListSource),e?.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return At(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return At(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(mJ);return r.length!==1?null:r[0]})}fetchWalletsList(){return At(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new W1("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(co(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){co(n),e=bJ}let r=[];try{r=ui.getCurrentlyInjectedWallets()}catch(n){co(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=ui.isWalletInjected(o),i.embedded=ui.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(h=>!h||typeof h!="object"||!("type"in h)))return!1;const f=a.find(h=>h.type==="sse");if(f&&(!("url"in f)||!f.url||!e.universal_url))return!1;const u=a.find(h=>h.type==="js");return!(u&&(!("key"in u)||!u.key))}}class t0 extends $t{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,t0.prototype)}}function yJ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new t0("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,f;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(f=o.amount)!==null&&f!==void 0?f:null}})}}function MJ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Xc(t,e)),G1(e,r))}function CJ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Xc(t,e)),G1(e,r))}function RJ(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Xc(t,e)),G1(e,r))}function TJ(t,e,r){return Object.assign({type:"disconnection",scope:r},Xc(t,e))}class DJ{constructor(){this.window=e0()}dispatchEvent(e,r){var n;return At(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return At(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class OJ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e?.eventDispatcher)!==null&&r!==void 0?r:new DJ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Jc({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return At(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return At(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>At(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",xJ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return At(this,void 0,void 0,function*(){return new Promise((e,r)=>At(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",wJ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=_J(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=EJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=SJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=AJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=PJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=IJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=TJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=MJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=CJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=RJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const NJ="3.0.5";class hl{constructor(e){if(this.walletsList=new V1,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:e?.manifestUrl||lJ(),storage:e?.storage||new gJ},this.walletsList=new V1({walletsListSource:e?.walletsListSource,cacheTTLMs:e?.walletsListCacheTTLMs}),this.tracker=new OJ({eventDispatcher:e?.eventDispatcher,tonConnectSdkVersion:NJ}),!this.dappSettings.manifestUrl)throw new q1("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new fl(this.dappSettings.storage),e?.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r?.request,s.openingDeadlineMS=r?.openingDeadlineMS,s.signal=r?.signal),this.connected)throw new z1;const o=hs(s?.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new $t("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s?.request),{openingDeadlineMS:s?.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return At(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=hs(e?.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield ll.fromStorage(this.dappSettings.storage);break;case"injected":a=yield ui.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a?.closeConnection(),a=null;return}if(i.signal.aborted){a?.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){co("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const f=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a?.closeConnection(),a=null};i.signal.addEventListener("abort",f);const u=cl(g=>At(this,void 0,void 0,function*(){yield a?.restoreConnection({openingDeadlineMS:e?.openingDeadlineMS,signal:g.signal}),i.signal.removeEventListener("abort",f),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e?.signal}),h=new Promise(g=>setTimeout(()=>g(),12e3));return Promise.race([u,h])})}sendTransaction(e,r){return At(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r?.onRequestSent,n.signal=r?.signal);const i=hs(n?.signal);if(i.signal.aborted)throw new $t("Transaction sending was aborted");this.checkConnection(),yJ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=GY(e,["validUntil"]),a=e.from||this.account.address,f=e.network||this.account.chain,u=yield this.provider.sendRequest(Qd.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:f})),{onRequestSent:n.onRequestSent,signal:i.signal});if(Qd.isError(u))return this.tracker.trackTransactionSigningFailed(this.wallet,e,u.error.message,u.error.code),Qd.parseAndThrowError(u);const h=Qd.convertFromRpcResponse(u);return this.tracker.trackTransactionSigned(this.wallet,e,h),h})}disconnect(e){var r;return At(this,void 0,void 0,function*(){if(!this.connected)throw new Yd;const n=hs(e?.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new $t("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i?.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=fJ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){co("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&YY(e)?r=new ui(this.dappSettings.storage,e.jsBridgeKey):r=new ll(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new $t("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=XY.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),xn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof Gd||r instanceof Vd)throw co(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new Yd}createConnectRequest(e){const r=[{name:"ton_addr"}];return e?.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}hl.walletsList=new V1,hl.isWalletInjected=t=>ui.isWalletInjected(t),hl.isInsideWalletBrowser=t=>ui.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function Y1(t){const{children:e,onClick:r}=t;return he.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function E7(t){const{wallet:e,connector:r,loading:n}=t,i=Se.useRef(null),s=Se.useRef(),[o,a]=Se.useState(),[f,u]=Se.useState(),[h,g]=Se.useState("connect"),[b,x]=Se.useState(!1),[S,C]=Se.useState();function D(W){s.current?.update({data:W})}async function B(){x(!0);try{a("");const W=await Fo.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const V=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:W}});if(!V)return;C(V),D(V),u(W)}}catch(W){a(W.message)}x(!1)}function L(){s.current=new e7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function H(){r.connect(e,{request:{tonProof:f}})}function F(){if("deepLink"in e){if(!e.deepLink||!S)return;const W=new URL(S),V=`${e.deepLink}${W.search}`;window.open(V)}}function k(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(S)}const $=Se.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),R=Se.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Se.useEffect(()=>{L(),B()},[]),he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-6",children:he.jsx(Wa,{title:"Connect wallet",onBack:t.onBack})}),he.jsxs("div",{className:"xc-text-center xc-mb-6",children:[he.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[he.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),he.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:b?he.jsx(Fa,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):he.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),he.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),he.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&he.jsx(Fa,{className:"xc-animate-spin"}),!b&&!n&&he.jsxs(he.Fragment,{children:[_7(e)&&he.jsxs(Y1,{onClick:H,children:[he.jsx(Fz,{className:"xc-opacity-80"}),"Extension"]}),$&&he.jsxs(Y1,{onClick:F,children:[he.jsx($4,{className:"xc-opacity-80"}),"Desktop"]}),R&&he.jsx(Y1,{onClick:k,children:"Telegram Mini App"})]})]})]})}function LJ(t){const[e,r]=Se.useState(""),[n,i]=Se.useState(),[s,o]=Se.useState(),a=F1(),[f,u]=Se.useState(!1);async function h(b){if(!b||!b.connectItems?.tonProof)return;u(!0);const x=await Fo.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:b?.device.appName,inviter_code:a.inviterCode,address:b.account.address,chain:b.account.chain,connect_info:[{name:"ton_addr",network:b.account.chain,...b.account},b.connectItems?.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(x.data),u(!1)}Se.useEffect(()=>{const b=new hl({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),x=b.onStatusChange(h);return o(b),r("select"),x},[]);function g(b){r("connect"),i(b)}return he.jsxs(ls,{children:[e==="select"&&he.jsx(a7,{connector:s,onSelect:g,onBack:t.onBack}),e==="connect"&&he.jsx(E7,{connector:s,wallet:n,onBack:t.onBack,loading:f})]})}function S7(t){const{children:e,className:r}=t,n=Se.useRef(null),[i,s]=Se.useState(0);function o(){try{const a=n.current?.children||[];let f=0;for(let u=0;u{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Se.useEffect(()=>{console.log("maxHeight",i)},[i]),he.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function kJ(){return he.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[he.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),he.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function A7(t){const{wallets:e}=Hf(),[r,n]=Se.useState(),i=Se.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-6",children:he.jsx(Wa,{title:"Select wallet",onBack:t.onBack})}),he.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[he.jsx(q4,{className:"xc-shrink-0 xc-opacity-50"}),he.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),he.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>he.jsx(TS,{wallet:a,onClick:s},`feature-${a.key}`)):he.jsx(kJ,{})})]})}function BJ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,f]=Se.useState(""),[u,h]=Se.useState(null),[g,b]=Se.useState("");function x(B){h(B),f("evm-wallet")}function S(B){f("email"),b(B)}async function C(B){await e(B)}function D(){f("ton-wallet")}return Se.useEffect(()=>{f("index")},[]),he.jsx(JG,{config:t.config,children:he.jsxs(S7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&he.jsx(LY,{onBack:()=>f("index"),onLogin:C,wallet:u}),a==="ton-wallet"&&he.jsx(LJ,{onBack:()=>f("index"),onLogin:C}),a==="email"&&he.jsx(lY,{email:g,onBack:()=>f("index"),onLogin:C}),a==="index"&&he.jsx($S,{header:r,onEmailConfirm:S,onSelectWallet:x,onSelectMoreWallets:()=>{f("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&he.jsx(A7,{onBack:()=>f("index"),onSelectWallet:x})]})})}function FJ(t){const{wallet:e,onConnect:r}=t,[n,i]=Se.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-6",children:he.jsx(Wa,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&he.jsx(i7,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&he.jsx(s7,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&he.jsx(o7,{wallet:e})]})}function jJ(t){const{email:e}=t,[r,n]=Se.useState("captcha");return he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-12",children:he.jsx(Wa,{title:"Sign in with email",onBack:t.onBack})}),r==="captcha"&&he.jsx(ZS,{email:e,onCodeSend:()=>n("verify-email")}),r==="verify-email"&&he.jsx(XS,{email:e,onInputCode:t.onInputCode,onResendCode:()=>n("captcha")})]})}function UJ(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Se.useState(""),[a,f]=Se.useState(),[u,h]=Se.useState(),g=Se.useRef(),[b,x]=Se.useState("");function S(F){f(F),o("evm-wallet-connect")}function C(F){x(F),o("email-connect")}async function D(F,k){await e?.({chain_type:"eip155",client:F.client,connect_info:k,wallet:F}),o("index")}async function B(F,k){await n?.(F,k)}function L(F){h(F),o("ton-wallet-connect")}async function H(F){F&&await r?.({chain_type:"ton",client:g.current,connect_info:F,wallet:F})}return Se.useEffect(()=>{g.current=new hl({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const F=g.current.onStatusChange(H);return o("index"),F},[]),he.jsxs(S7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&he.jsx(A7,{onBack:()=>o("index"),onSelectWallet:S}),s==="evm-wallet-connect"&&he.jsx(FJ,{onBack:()=>o("index"),onConnect:D,wallet:a}),s==="ton-wallet-select"&&he.jsx(a7,{connector:g.current,onSelect:L,onBack:()=>o("index")}),s==="ton-wallet-connect"&&he.jsx(E7,{connector:g.current,wallet:u,onBack:()=>o("index")}),s==="email-connect"&&he.jsx(jJ,{email:b,onBack:()=>o("index"),onInputCode:B}),s==="index"&&he.jsx($S,{onEmailConfirm:C,onSelectWallet:S,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Ii.CodattaConnect=UJ,Ii.CodattaConnectContextProvider=Rz,Ii.CodattaSignin=BJ,Ii.WalletItem=la,Ii.coinbaseWallet=B4,Ii.useCodattaConnectContext=Hf,Object.defineProperty(Ii,Symbol.toStringTag,{value:"Module"})})); diff --git a/dist/main-D60MaR66.js b/dist/main-D60MaR66.js new file mode 100644 index 0000000..9e1c534 --- /dev/null +++ b/dist/main-D60MaR66.js @@ -0,0 +1,44351 @@ +import * as Jt from "react"; +import Wv, { createContext as Xo, useContext as In, useState as Xt, useEffect as Rn, forwardRef as Kv, createElement as sd, useId as Vv, useCallback as Gv, Component as lT, useLayoutEffect as hT, useRef as Kn, useInsertionEffect as H5, useMemo as hi, Fragment as W5, Children as dT, isValidElement as pT } from "react"; +import "https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"; +var Zn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; +function Hi(t) { + return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; +} +function K5(t) { + if (Object.prototype.hasOwnProperty.call(t, "__esModule")) return t; + var e = t.default; + if (typeof e == "function") { + var r = function n() { + var i = !1; + try { + i = this instanceof n; + } catch { + } + return i ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments); + }; + r.prototype = e.prototype; + } else r = {}; + return Object.defineProperty(r, "__esModule", { value: !0 }), Object.keys(t).forEach(function(n) { + var i = Object.getOwnPropertyDescriptor(t, n); + Object.defineProperty(r, n, i.get ? i : { + enumerable: !0, + get: function() { + return t[n]; + } + }); + }), r; +} +var ch = { exports: {} }, xu = {}; +/** + * @license React + * react-jsx-runtime.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +var Tw; +function gT() { + if (Tw) return xu; + Tw = 1; + var t = Wv, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 }; + function o(a, f, u) { + var h, g = {}, v = null, x = null; + u !== void 0 && (v = "" + u), f.key !== void 0 && (v = "" + f.key), f.ref !== void 0 && (x = f.ref); + for (h in f) n.call(f, h) && !s.hasOwnProperty(h) && (g[h] = f[h]); + if (a && a.defaultProps) for (h in f = a.defaultProps, f) g[h] === void 0 && (g[h] = f[h]); + return { $$typeof: e, type: a, key: v, ref: x, props: g, _owner: i.current }; + } + return xu.Fragment = r, xu.jsx = o, xu.jsxs = o, xu; +} +var _u = {}; +/** + * @license React + * react-jsx-runtime.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +var Dw; +function mT() { + return Dw || (Dw = 1, process.env.NODE_ENV !== "production" && (function() { + var t = Wv, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), a = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), u = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), g = Symbol.for("react.memo"), v = Symbol.for("react.lazy"), x = Symbol.for("react.offscreen"), S = Symbol.iterator, C = "@@iterator"; + function D(F) { + if (F === null || typeof F != "object") + return null; + var ie = S && F[S] || F[C]; + return typeof ie == "function" ? ie : null; + } + var $ = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + function N(F) { + { + for (var ie = arguments.length, le = new Array(ie > 1 ? ie - 1 : 0), me = 1; me < ie; me++) + le[me - 1] = arguments[me]; + z("error", F, le); + } + } + function z(F, ie, le) { + { + var me = $.ReactDebugCurrentFrame, Ee = me.getStackAddendum(); + Ee !== "" && (ie += "%s", le = le.concat([Ee])); + var Le = le.map(function(Ie) { + return String(Ie); + }); + Le.unshift("Warning: " + ie), Function.prototype.apply.call(console[F], console, Le); + } + } + var k = !1, B = !1, U = !1, R = !1, W = !1, J; + J = Symbol.for("react.module.reference"); + function ne(F) { + return !!(typeof F == "string" || typeof F == "function" || F === n || F === s || W || F === i || F === u || F === h || R || F === x || k || B || U || typeof F == "object" && F !== null && (F.$$typeof === v || F.$$typeof === g || F.$$typeof === o || F.$$typeof === a || F.$$typeof === f || // This needs to include all possible module reference object + // types supported by any Flight configuration anywhere since + // we don't know which Flight build this will end up being used + // with. + F.$$typeof === J || F.getModuleId !== void 0)); + } + function K(F, ie, le) { + var me = F.displayName; + if (me) + return me; + var Ee = ie.displayName || ie.name || ""; + return Ee !== "" ? le + "(" + Ee + ")" : le; + } + function E(F) { + return F.displayName || "Context"; + } + function b(F) { + if (F == null) + return null; + if (typeof F.tag == "number" && N("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof F == "function") + return F.displayName || F.name || null; + if (typeof F == "string") + return F; + switch (F) { + case n: + return "Fragment"; + case r: + return "Portal"; + case s: + return "Profiler"; + case i: + return "StrictMode"; + case u: + return "Suspense"; + case h: + return "SuspenseList"; + } + if (typeof F == "object") + switch (F.$$typeof) { + case a: + var ie = F; + return E(ie) + ".Consumer"; + case o: + var le = F; + return E(le._context) + ".Provider"; + case f: + return K(F, F.render, "ForwardRef"); + case g: + var me = F.displayName || null; + return me !== null ? me : b(F.type) || "Memo"; + case v: { + var Ee = F, Le = Ee._payload, Ie = Ee._init; + try { + return b(Ie(Le)); + } catch { + return null; + } + } + } + return null; + } + var l = Object.assign, p = 0, m, w, P, _, y, M, I; + function q() { + } + q.__reactDisabledLog = !0; + function ce() { + { + if (p === 0) { + m = console.log, w = console.info, P = console.warn, _ = console.error, y = console.group, M = console.groupCollapsed, I = console.groupEnd; + var F = { + configurable: !0, + enumerable: !0, + value: q, + writable: !0 + }; + Object.defineProperties(console, { + info: F, + log: F, + warn: F, + error: F, + group: F, + groupCollapsed: F, + groupEnd: F + }); + } + p++; + } + } + function L() { + { + if (p--, p === 0) { + var F = { + configurable: !0, + enumerable: !0, + writable: !0 + }; + Object.defineProperties(console, { + log: l({}, F, { + value: m + }), + info: l({}, F, { + value: w + }), + warn: l({}, F, { + value: P + }), + error: l({}, F, { + value: _ + }), + group: l({}, F, { + value: y + }), + groupCollapsed: l({}, F, { + value: M + }), + groupEnd: l({}, F, { + value: I + }) + }); + } + p < 0 && N("disabledDepth fell below zero. This is a bug in React. Please file an issue."); + } + } + var oe = $.ReactCurrentDispatcher, Q; + function X(F, ie, le) { + { + if (Q === void 0) + try { + throw Error(); + } catch (Ee) { + var me = Ee.stack.trim().match(/\n( *(at )?)/); + Q = me && me[1] || ""; + } + return ` +` + Q + F; + } + } + var ee = !1, O; + { + var Z = typeof WeakMap == "function" ? WeakMap : Map; + O = new Z(); + } + function re(F, ie) { + if (!F || ee) + return ""; + { + var le = O.get(F); + if (le !== void 0) + return le; + } + var me; + ee = !0; + var Ee = Error.prepareStackTrace; + Error.prepareStackTrace = void 0; + var Le; + Le = oe.current, oe.current = null, ce(); + try { + if (ie) { + var Ie = function() { + throw Error(); + }; + if (Object.defineProperty(Ie.prototype, "props", { + set: function() { + throw Error(); + } + }), typeof Reflect == "object" && Reflect.construct) { + try { + Reflect.construct(Ie, []); + } catch (wt) { + me = wt; + } + Reflect.construct(F, [], Ie); + } else { + try { + Ie.call(); + } catch (wt) { + me = wt; + } + F.call(Ie.prototype); + } + } else { + try { + throw Error(); + } catch (wt) { + me = wt; + } + F(); + } + } catch (wt) { + if (wt && me && typeof wt.stack == "string") { + for (var Qe = wt.stack.split(` +`), Xe = me.stack.split(` +`), tt = Qe.length - 1, st = Xe.length - 1; tt >= 1 && st >= 0 && Qe[tt] !== Xe[st]; ) + st--; + for (; tt >= 1 && st >= 0; tt--, st--) + if (Qe[tt] !== Xe[st]) { + if (tt !== 1 || st !== 1) + do + if (tt--, st--, st < 0 || Qe[tt] !== Xe[st]) { + var vt = ` +` + Qe[tt].replace(" at new ", " at "); + return F.displayName && vt.includes("") && (vt = vt.replace("", F.displayName)), typeof F == "function" && O.set(F, vt), vt; + } + while (tt >= 1 && st >= 0); + break; + } + } + } finally { + ee = !1, oe.current = Le, L(), Error.prepareStackTrace = Ee; + } + var Ct = F ? F.displayName || F.name : "", Mt = Ct ? X(Ct) : ""; + return typeof F == "function" && O.set(F, Mt), Mt; + } + function he(F, ie, le) { + return re(F, !1); + } + function ae(F) { + var ie = F.prototype; + return !!(ie && ie.isReactComponent); + } + function fe(F, ie, le) { + if (F == null) + return ""; + if (typeof F == "function") + return re(F, ae(F)); + if (typeof F == "string") + return X(F); + switch (F) { + case u: + return X("Suspense"); + case h: + return X("SuspenseList"); + } + if (typeof F == "object") + switch (F.$$typeof) { + case f: + return he(F.render); + case g: + return fe(F.type, ie, le); + case v: { + var me = F, Ee = me._payload, Le = me._init; + try { + return fe(Le(Ee), ie, le); + } catch { + } + } + } + return ""; + } + var be = Object.prototype.hasOwnProperty, Ae = {}, Te = $.ReactDebugCurrentFrame; + function Re(F) { + if (F) { + var ie = F._owner, le = fe(F.type, F._source, ie ? ie.type : null); + Te.setExtraStackFrame(le); + } else + Te.setExtraStackFrame(null); + } + function $e(F, ie, le, me, Ee) { + { + var Le = Function.call.bind(be); + for (var Ie in F) + if (Le(F, Ie)) { + var Qe = void 0; + try { + if (typeof F[Ie] != "function") { + var Xe = Error((me || "React class") + ": " + le + " type `" + Ie + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof F[Ie] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); + throw Xe.name = "Invariant Violation", Xe; + } + Qe = F[Ie](ie, Ie, me, le, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); + } catch (tt) { + Qe = tt; + } + Qe && !(Qe instanceof Error) && (Re(Ee), N("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", me || "React class", le, Ie, typeof Qe), Re(null)), Qe instanceof Error && !(Qe.message in Ae) && (Ae[Qe.message] = !0, Re(Ee), N("Failed %s type: %s", le, Qe.message), Re(null)); + } + } + } + var Me = Array.isArray; + function Oe(F) { + return Me(F); + } + function ze(F) { + { + var ie = typeof Symbol == "function" && Symbol.toStringTag, le = ie && F[Symbol.toStringTag] || F.constructor.name || "Object"; + return le; + } + } + function De(F) { + try { + return je(F), !1; + } catch { + return !0; + } + } + function je(F) { + return "" + F; + } + function Ue(F) { + if (De(F)) + return N("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ze(F)), je(F); + } + var _e = $.ReactCurrentOwner, Ze = { + key: !0, + ref: !0, + __self: !0, + __source: !0 + }, ot, ke; + function rt(F) { + if (be.call(F, "ref")) { + var ie = Object.getOwnPropertyDescriptor(F, "ref").get; + if (ie && ie.isReactWarning) + return !1; + } + return F.ref !== void 0; + } + function nt(F) { + if (be.call(F, "key")) { + var ie = Object.getOwnPropertyDescriptor(F, "key").get; + if (ie && ie.isReactWarning) + return !1; + } + return F.key !== void 0; + } + function Ge(F, ie) { + typeof F.ref == "string" && _e.current; + } + function ht(F, ie) { + { + var le = function() { + ot || (ot = !0, N("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", ie)); + }; + le.isReactWarning = !0, Object.defineProperty(F, "key", { + get: le, + configurable: !0 + }); + } + } + function lt(F, ie) { + { + var le = function() { + ke || (ke = !0, N("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", ie)); + }; + le.isReactWarning = !0, Object.defineProperty(F, "ref", { + get: le, + configurable: !0 + }); + } + } + var ct = function(F, ie, le, me, Ee, Le, Ie) { + var Qe = { + // This tag allows us to uniquely identify this as a React Element + $$typeof: e, + // Built-in properties that belong on the element + type: F, + key: ie, + ref: le, + props: Ie, + // Record the component responsible for creating this element. + _owner: Le + }; + return Qe._store = {}, Object.defineProperty(Qe._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: !1 + }), Object.defineProperty(Qe, "_self", { + configurable: !1, + enumerable: !1, + writable: !1, + value: me + }), Object.defineProperty(Qe, "_source", { + configurable: !1, + enumerable: !1, + writable: !1, + value: Ee + }), Object.freeze && (Object.freeze(Qe.props), Object.freeze(Qe)), Qe; + }; + function qt(F, ie, le, me, Ee) { + { + var Le, Ie = {}, Qe = null, Xe = null; + le !== void 0 && (Ue(le), Qe = "" + le), nt(ie) && (Ue(ie.key), Qe = "" + ie.key), rt(ie) && (Xe = ie.ref, Ge(ie, Ee)); + for (Le in ie) + be.call(ie, Le) && !Ze.hasOwnProperty(Le) && (Ie[Le] = ie[Le]); + if (F && F.defaultProps) { + var tt = F.defaultProps; + for (Le in tt) + Ie[Le] === void 0 && (Ie[Le] = tt[Le]); + } + if (Qe || Xe) { + var st = typeof F == "function" ? F.displayName || F.name || "Unknown" : F; + Qe && ht(Ie, st), Xe && lt(Ie, st); + } + return ct(F, Qe, Xe, Ee, me, _e.current, Ie); + } + } + var Gt = $.ReactCurrentOwner, Et = $.ReactDebugCurrentFrame; + function Yt(F) { + if (F) { + var ie = F._owner, le = fe(F.type, F._source, ie ? ie.type : null); + Et.setExtraStackFrame(le); + } else + Et.setExtraStackFrame(null); + } + var tr; + tr = !1; + function Tt(F) { + return typeof F == "object" && F !== null && F.$$typeof === e; + } + function kt() { + { + if (Gt.current) { + var F = b(Gt.current.type); + if (F) + return ` + +Check the render method of \`` + F + "`."; + } + return ""; + } + } + function It(F) { + return ""; + } + var dt = {}; + function Dt(F) { + { + var ie = kt(); + if (!ie) { + var le = typeof F == "string" ? F : F.displayName || F.name; + le && (ie = ` + +Check the top-level render call using <` + le + ">."); + } + return ie; + } + } + function Nt(F, ie) { + { + if (!F._store || F._store.validated || F.key != null) + return; + F._store.validated = !0; + var le = Dt(ie); + if (dt[le]) + return; + dt[le] = !0; + var me = ""; + F && F._owner && F._owner !== Gt.current && (me = " It was passed a child from " + b(F._owner.type) + "."), Yt(F), N('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', le, me), Yt(null); + } + } + function mt(F, ie) { + { + if (typeof F != "object") + return; + if (Oe(F)) + for (var le = 0; le < F.length; le++) { + var me = F[le]; + Tt(me) && Nt(me, ie); + } + else if (Tt(F)) + F._store && (F._store.validated = !0); + else if (F) { + var Ee = D(F); + if (typeof Ee == "function" && Ee !== F.entries) + for (var Le = Ee.call(F), Ie; !(Ie = Le.next()).done; ) + Tt(Ie.value) && Nt(Ie.value, ie); + } + } + } + function Bt(F) { + { + var ie = F.type; + if (ie == null || typeof ie == "string") + return; + var le; + if (typeof ie == "function") + le = ie.propTypes; + else if (typeof ie == "object" && (ie.$$typeof === f || // Note: Memo only checks outer props here. + // Inner props are checked in the reconciler. + ie.$$typeof === g)) + le = ie.propTypes; + else + return; + if (le) { + var me = b(ie); + $e(le, F.props, "prop", me, F); + } else if (ie.PropTypes !== void 0 && !tr) { + tr = !0; + var Ee = b(ie); + N("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Ee || "Unknown"); + } + typeof ie.getDefaultProps == "function" && !ie.getDefaultProps.isReactClassApproved && N("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); + } + } + function Ft(F) { + { + for (var ie = Object.keys(F.props), le = 0; le < ie.length; le++) { + var me = ie[le]; + if (me !== "children" && me !== "key") { + Yt(F), N("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", me), Yt(null); + break; + } + } + F.ref !== null && (Yt(F), N("Invalid attribute `ref` supplied to `React.Fragment`."), Yt(null)); + } + } + var et = {}; + function $t(F, ie, le, me, Ee, Le) { + { + var Ie = ne(F); + if (!Ie) { + var Qe = ""; + (F === void 0 || typeof F == "object" && F !== null && Object.keys(F).length === 0) && (Qe += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); + var Xe = It(); + Xe ? Qe += Xe : Qe += kt(); + var tt; + F === null ? tt = "null" : Oe(F) ? tt = "array" : F !== void 0 && F.$$typeof === e ? (tt = "<" + (b(F.type) || "Unknown") + " />", Qe = " Did you accidentally export a JSX literal instead of a component?") : tt = typeof F, N("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", tt, Qe); + } + var st = qt(F, ie, le, Ee, Le); + if (st == null) + return st; + if (Ie) { + var vt = ie.children; + if (vt !== void 0) + if (me) + if (Oe(vt)) { + for (var Ct = 0; Ct < vt.length; Ct++) + mt(vt[Ct], F); + Object.freeze && Object.freeze(vt); + } else + N("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); + else + mt(vt, F); + } + if (be.call(ie, "key")) { + var Mt = b(F), wt = Object.keys(ie).filter(function(_t) { + return _t !== "key"; + }), Rt = wt.length > 0 ? "{key: someKey, " + wt.join(": ..., ") + ": ...}" : "{key: someKey}"; + if (!et[Mt + Rt]) { + var gt = wt.length > 0 ? "{" + wt.join(": ..., ") + ": ...}" : "{}"; + N(`A props object containing a "key" prop is being spread into JSX: + let props = %s; + <%s {...props} /> +React keys must be passed directly to JSX without using spread: + let props = %s; + <%s key={someKey} {...props} />`, Rt, Mt, gt, Mt), et[Mt + Rt] = !0; + } + } + return F === n ? Ft(st) : Bt(st), st; + } + } + function H(F, ie, le) { + return $t(F, ie, le, !0); + } + function V(F, ie, le) { + return $t(F, ie, le, !1); + } + var Y = V, T = H; + _u.Fragment = n, _u.jsx = Y, _u.jsxs = T; + })()), _u; +} +var Ow; +function vT() { + return Ow || (Ow = 1, process.env.NODE_ENV === "production" ? ch.exports = gT() : ch.exports = mT()), ch.exports; +} +var pe = vT(); +const ys = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", bT = [ + { + featured: !0, + name: "MetaMask", + rdns: "io.metamask", + image: `${ys}#metamask`, + getWallet: { + chrome_store_id: "nkbihfbeogaeaoehlefnkodbefgpgknn", + brave_store_id: "nkbihfbeogaeaoehlefnkodbefgpgknn", + edge_addon_id: "ejbalbakoplchlghecdalmeeeajnimhm", + firefox_addon_id: "ether-metamask", + play_store_id: "io.metamask", + app_store_id: "id1438144202" + }, + deep_link: "metamask://wc", + universal_link: "https://metamask.app.link/wc" + }, + { + name: "Binance Wallet", + featured: !0, + image: `${ys}#ebac7b39-688c-41e3-7912-a4fefba74600`, + getWallet: { + chrome_store_id: "cadiboklkpojfamcoggejbbdjcoiljjk", + play_store_id: "com.binance.dev", + app_store_id: "id1436799971" + } + }, + { + featured: !0, + name: "OKX Wallet", + rdns: "com.okex.wallet", + image: `${ys}#okx`, + getWallet: { + chrome_store_id: "mcohilncbfahbmgdjkbpemcciiolgcge", + brave_store_id: "mcohilncbfahbmgdjkbpemcciiolgcge", + edge_addon_id: "pbpjkcldjiffchgbbndmhojiacbgflha", + play_store_id: "com.okinc.okex.gp", + app_store_id: "id1327268470" + }, + deep_link: "okex://main/wc", + universal_link: "okex://main/wc" + }, + { + featured: !0, + name: "WalletConnect", + image: `${ys}#walletconnect` + }, + { + featured: !1, + name: "Coinbase Wallet", + image: `${ys}#coinbase` + }, + { + featured: !1, + name: "GateWallet", + rdns: "io.gate.wallet", + image: `${ys}#6e528abf-7a7d-47bd-d84d-481f169b1200`, + getWallet: { + chrome_store_id: "cpmkedoipcpimgecpmgpldfpohjplkpp", + brave_store_id: "cpmkedoipcpimgecpmgpldfpohjplkpp", + play_store_id: "com.gateio.gateio", + app_store_id: "id1294998195", + mac_app_store_id: "id1609559473" + }, + deep_link: "https://www.gate.io/mobileapp", + universal_link: "https://www.gate.io/mobileapp" + }, + { + featured: !1, + name: "Onekey", + rdns: "so.onekey.app.wallet", + image: `${ys}#onekey`, + getWallet: { + chrome_store_id: "jnmbobjmhlngoefaiojfljckilhhlhcj", + brave_store_id: "jnmbobjmhlngoefaiojfljckilhhlhcj", + play_store_id: "so.onekey.app.wallet", + app_store_id: "id1609559473" + }, + deep_link: "onekey-wallet://", + universal_link: "onekey://wc" + }, + { + featured: !1, + name: "Infinity Wallet", + image: `${ys}#9f259366-0bcd-4817-0af9-f78773e41900`, + desktop_link: "infinity://wc" + }, + { + name: "Rabby Wallet", + rdns: "io.rabby", + featured: !1, + image: `${ys}#rabby`, + getWallet: { + chrome_store_id: "acmacodkjbdgmoleebolmdjonilkdbch", + brave_store_id: "acmacodkjbdgmoleebolmdjonilkdbch", + play_store_id: "com.debank.rabbymobile", + app_store_id: "id6474381673" + } + }, + { + name: "Rainbow Wallet", + rdns: "me.rainbow", + featured: !1, + image: `${ys}#rainbow`, + getWallet: { + chrome_store_id: "opfgelmcmbiajamepnmloijbpoleiama", + edge_addon_id: "cpojfbodiccabbabgimdeohkkpjfpbnf", + firefox_addon_id: "rainbow-extension", + app_store_id: "id1457119021", + play_store_id: "me.rainbow" + } + } +]; +function yT(t, e) { + return t.exec(e)?.groups; +} +const Nw = /^tuple(?(\[(\d*)\])*)$/; +function km(t) { + let e = t.type; + if (Nw.test(t.type) && "components" in t) { + e = "("; + const r = t.components.length; + for (let i = 0; i < r; i++) { + const s = t.components[i]; + e += km(s), i < r - 1 && (e += ", "); + } + const n = yT(Nw, t.type); + return e += `)${n?.array ?? ""}`, km({ + ...t, + type: e + }); + } + return "indexed" in t && t.indexed && (e = `${e} indexed`), t.name ? `${e} ${t.name}` : e; +} +function Eu(t) { + let e = ""; + const r = t.length; + for (let n = 0; n < r; n++) { + const i = t[n]; + e += km(i), n !== r - 1 && (e += ", "); + } + return e; +} +function wT(t) { + return t.type === "function" ? `function ${t.name}(${Eu(t.inputs)})${t.stateMutability && t.stateMutability !== "nonpayable" ? ` ${t.stateMutability}` : ""}${t.outputs?.length ? ` returns (${Eu(t.outputs)})` : ""}` : t.type === "event" ? `event ${t.name}(${Eu(t.inputs)})` : t.type === "error" ? `error ${t.name}(${Eu(t.inputs)})` : t.type === "constructor" ? `constructor(${Eu(t.inputs)})${t.stateMutability === "payable" ? " payable" : ""}` : t.type === "fallback" ? `fallback() external${t.stateMutability === "payable" ? " payable" : ""}` : "receive() external payable"; +} +function Hn(t, e, r) { + const n = t[e.name]; + if (typeof n == "function") + return n; + const i = t[r]; + return typeof i == "function" ? i : (s) => e(t, s); +} +function Bc(t, { includeName: e = !1 } = {}) { + if (t.type !== "function" && t.type !== "event" && t.type !== "error") + throw new DT(t.type); + return `${t.name}(${Yv(t.inputs, { includeName: e })})`; +} +function Yv(t, { includeName: e = !1 } = {}) { + return t ? t.map((r) => xT(r, { includeName: e })).join(e ? ", " : ",") : ""; +} +function xT(t, { includeName: e }) { + return t.type.startsWith("tuple") ? `(${Yv(t.components, { includeName: e })})${t.type.slice(5)}` : t.type + (e && t.name ? ` ${t.name}` : ""); +} +function Uo(t, { strict: e = !0 } = {}) { + return !t || typeof t != "string" ? !1 : e ? /^0x[0-9a-fA-F]*$/.test(t) : t.startsWith("0x"); +} +function yn(t) { + return Uo(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length; +} +const V5 = "2.31.3"; +let $p = { + getDocsUrl: ({ docsBaseUrl: t, docsPath: e = "", docsSlug: r }) => e ? `${t ?? "https://viem.sh"}${e}${r ? `#${r}` : ""}` : void 0, + version: `viem@${V5}` +}; +class pt extends Error { + constructor(e, r = {}) { + const n = r.cause instanceof pt ? r.cause.details : r.cause?.message ? r.cause.message : r.details, i = r.cause instanceof pt && r.cause.docsPath || r.docsPath, s = $p.getDocsUrl?.({ ...r, docsPath: i }), o = [ + e || "An error occurred.", + "", + ...r.metaMessages ? [...r.metaMessages, ""] : [], + ...s ? [`Docs: ${s}`] : [], + ...n ? [`Details: ${n}`] : [], + ...$p.version ? [`Version: ${$p.version}`] : [] + ].join(` +`); + super(o, r.cause ? { cause: r.cause } : void 0), Object.defineProperty(this, "details", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "docsPath", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "metaMessages", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "shortMessage", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "version", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "name", { + enumerable: !0, + configurable: !0, + writable: !0, + value: "BaseError" + }), this.details = n, this.docsPath = i, this.metaMessages = r.metaMessages, this.name = r.name ?? this.name, this.shortMessage = e, this.version = V5; + } + walk(e) { + return G5(this, e); + } +} +function G5(t, e) { + return e?.(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ? G5(t.cause, e) : e ? null : t; +} +class _T extends pt { + constructor({ docsPath: e }) { + super([ + "A constructor was not found on the ABI.", + "Make sure you are using the correct ABI and that the constructor exists on it." + ].join(` +`), { + docsPath: e, + name: "AbiConstructorNotFoundError" + }); + } +} +class Lw extends pt { + constructor({ docsPath: e }) { + super([ + "Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.", + "Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists." + ].join(` +`), { + docsPath: e, + name: "AbiConstructorParamsNotFoundError" + }); + } +} +class ET extends pt { + constructor({ data: e, params: r, size: n }) { + super([`Data size of ${n} bytes is too small for given parameters.`].join(` +`), { + metaMessages: [ + `Params: (${Yv(r, { includeName: !0 })})`, + `Data: ${e} (${n} bytes)` + ], + name: "AbiDecodingDataSizeTooSmallError" + }), Object.defineProperty(this, "data", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "params", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "size", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), this.data = e, this.params = r, this.size = n; + } +} +class Jv extends pt { + constructor() { + super('Cannot decode zero data ("0x") with ABI parameters.', { + name: "AbiDecodingZeroDataError" + }); + } +} +class ST extends pt { + constructor({ expectedLength: e, givenLength: r, type: n }) { + super([ + `ABI encoding array length mismatch for type ${n}.`, + `Expected length: ${e}`, + `Given length: ${r}` + ].join(` +`), { name: "AbiEncodingArrayLengthMismatchError" }); + } +} +class AT extends pt { + constructor({ expectedSize: e, value: r }) { + super(`Size of bytes "${r}" (bytes${yn(r)}) does not match expected size (bytes${e}).`, { name: "AbiEncodingBytesSizeMismatchError" }); + } +} +class PT extends pt { + constructor({ expectedLength: e, givenLength: r }) { + super([ + "ABI encoding params/values length mismatch.", + `Expected length (params): ${e}`, + `Given length (values): ${r}` + ].join(` +`), { name: "AbiEncodingLengthMismatchError" }); + } +} +class Y5 extends pt { + constructor(e, { docsPath: r }) { + super([ + `Encoded error signature "${e}" not found on ABI.`, + "Make sure you are using the correct ABI and that the error exists on it.", + `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.` + ].join(` +`), { + docsPath: r, + name: "AbiErrorSignatureNotFoundError" + }), Object.defineProperty(this, "signature", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), this.signature = e; + } +} +class kw extends pt { + constructor(e, { docsPath: r } = {}) { + super([ + `Function ${e ? `"${e}" ` : ""}not found on ABI.`, + "Make sure you are using the correct ABI and that the function exists on it." + ].join(` +`), { + docsPath: r, + name: "AbiFunctionNotFoundError" + }); + } +} +class MT extends pt { + constructor(e, r) { + super("Found ambiguous types in overloaded ABI items.", { + metaMessages: [ + `\`${e.type}\` in \`${Bc(e.abiItem)}\`, and`, + `\`${r.type}\` in \`${Bc(r.abiItem)}\``, + "", + "These types encode differently and cannot be distinguished at runtime.", + "Remove one of the ambiguous items in the ABI." + ], + name: "AbiItemAmbiguityError" + }); + } +} +class IT extends pt { + constructor({ expectedSize: e, givenSize: r }) { + super(`Expected bytes${e}, got bytes${r}.`, { + name: "BytesSizeMismatchError" + }); + } +} +class CT extends pt { + constructor(e, { docsPath: r }) { + super([ + `Type "${e}" is not a valid encoding type.`, + "Please provide a valid ABI type." + ].join(` +`), { docsPath: r, name: "InvalidAbiEncodingType" }); + } +} +class RT extends pt { + constructor(e, { docsPath: r }) { + super([ + `Type "${e}" is not a valid decoding type.`, + "Please provide a valid ABI type." + ].join(` +`), { docsPath: r, name: "InvalidAbiDecodingType" }); + } +} +class TT extends pt { + constructor(e) { + super([`Value "${e}" is not a valid array.`].join(` +`), { + name: "InvalidArrayError" + }); + } +} +class DT extends pt { + constructor(e) { + super([ + `"${e}" is not a valid definition type.`, + 'Valid types: "function", "event", "error"' + ].join(` +`), { name: "InvalidDefinitionTypeError" }); + } +} +class J5 extends pt { + constructor({ offset: e, position: r, size: n }) { + super(`Slice ${r === "start" ? "starting" : "ending"} at offset "${e}" is out-of-bounds (size: ${n}).`, { name: "SliceOffsetOutOfBoundsError" }); + } +} +class X5 extends pt { + constructor({ size: e, targetSize: r, type: n }) { + super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`, { name: "SizeExceedsPaddingSizeError" }); + } +} +class $w extends pt { + constructor({ size: e, targetSize: r, type: n }) { + super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`, { name: "InvalidBytesLengthError" }); + } +} +function Kc(t, { dir: e, size: r = 32 } = {}) { + return typeof t == "string" ? jo(t, { dir: e, size: r }) : OT(t, { dir: e, size: r }); +} +function jo(t, { dir: e, size: r = 32 } = {}) { + if (r === null) + return t; + const n = t.replace("0x", ""); + if (n.length > r * 2) + throw new X5({ + size: Math.ceil(n.length / 2), + targetSize: r, + type: "hex" + }); + return `0x${n[e === "right" ? "padEnd" : "padStart"](r * 2, "0")}`; +} +function OT(t, { dir: e, size: r = 32 } = {}) { + if (r === null) + return t; + if (t.length > r) + throw new X5({ + size: t.length, + targetSize: r, + type: "bytes" + }); + const n = new Uint8Array(r); + for (let i = 0; i < r; i++) { + const s = e === "right"; + n[s ? i : r - i - 1] = t[s ? i : t.length - i - 1]; + } + return n; +} +class Z5 extends pt { + constructor({ max: e, min: r, signed: n, size: i, value: s }) { + super(`Number "${s}" is not in safe ${i ? `${i * 8}-bit ${n ? "signed" : "unsigned"} ` : ""}integer range ${e ? `(${r} to ${e})` : `(above ${r})`}`, { name: "IntegerOutOfRangeError" }); + } +} +class NT extends pt { + constructor(e) { + super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, { + name: "InvalidBytesBooleanError" + }); + } +} +class LT extends pt { + constructor({ givenSize: e, maxSize: r }) { + super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" }); + } +} +function Fd(t, { dir: e = "left" } = {}) { + let r = typeof t == "string" ? t.replace("0x", "") : t, n = 0; + for (let i = 0; i < r.length - 1 && r[e === "left" ? i : r.length - i - 1].toString() === "0"; i++) + n++; + return r = e === "left" ? r.slice(n) : r.slice(0, r.length - n), typeof t == "string" ? (r.length === 1 && e === "right" && (r = `${r}0`), `0x${r.length % 2 === 1 ? `0${r}` : r}`) : r; +} +function Ns(t, { size: e }) { + if (yn(t) > e) + throw new LT({ + givenSize: yn(t), + maxSize: e + }); +} +function qo(t, e = {}) { + const { signed: r } = e; + e.size && Ns(t, { size: e.size }); + const n = BigInt(t); + if (!r) + return n; + const i = (t.length - 2) / 2, s = (1n << BigInt(i) * 8n - 1n) - 1n; + return n <= s ? n : n - BigInt(`0x${"f".padStart(i * 2, "f")}`) - 1n; +} +function zo(t, e = {}) { + return Number(qo(t, e)); +} +const kT = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); +function od(t, e = {}) { + return typeof t == "number" || typeof t == "bigint" ? br(t, e) : typeof t == "string" ? jd(t, e) : typeof t == "boolean" ? Q5(t, e) : di(t, e); +} +function Q5(t, e = {}) { + const r = `0x${Number(t)}`; + return typeof e.size == "number" ? (Ns(r, { size: e.size }), Kc(r, { size: e.size })) : r; +} +function di(t, e = {}) { + let r = ""; + for (let i = 0; i < t.length; i++) + r += kT[t[i]]; + const n = `0x${r}`; + return typeof e.size == "number" ? (Ns(n, { size: e.size }), Kc(n, { dir: "right", size: e.size })) : n; +} +function br(t, e = {}) { + const { signed: r, size: n } = e, i = BigInt(t); + let s; + n ? r ? s = (1n << BigInt(n) * 8n - 1n) - 1n : s = 2n ** (BigInt(n) * 8n) - 1n : typeof t == "number" && (s = BigInt(Number.MAX_SAFE_INTEGER)); + const o = typeof s == "bigint" && r ? -s - 1n : 0; + if (s && i > s || i < o) { + const f = typeof t == "bigint" ? "n" : ""; + throw new Z5({ + max: s ? `${s}${f}` : void 0, + min: `${o}${f}`, + signed: r, + size: n, + value: `${t}${f}` + }); + } + const a = `0x${(r && i < 0 ? (1n << BigInt(n * 8)) + BigInt(i) : i).toString(16)}`; + return n ? Kc(a, { size: n }) : a; +} +const $T = /* @__PURE__ */ new TextEncoder(); +function jd(t, e = {}) { + const r = $T.encode(t); + return di(r, e); +} +const BT = /* @__PURE__ */ new TextEncoder(); +function Xv(t, e = {}) { + return typeof t == "number" || typeof t == "bigint" ? jT(t, e) : typeof t == "boolean" ? FT(t, e) : Uo(t) ? lo(t, e) : e4(t, e); +} +function FT(t, e = {}) { + const r = new Uint8Array(1); + return r[0] = Number(t), typeof e.size == "number" ? (Ns(r, { size: e.size }), Kc(r, { size: e.size })) : r; +} +const Ks = { + zero: 48, + nine: 57, + A: 65, + F: 70, + a: 97, + f: 102 +}; +function Bw(t) { + if (t >= Ks.zero && t <= Ks.nine) + return t - Ks.zero; + if (t >= Ks.A && t <= Ks.F) + return t - (Ks.A - 10); + if (t >= Ks.a && t <= Ks.f) + return t - (Ks.a - 10); +} +function lo(t, e = {}) { + let r = t; + e.size && (Ns(r, { size: e.size }), r = Kc(r, { dir: "right", size: e.size })); + let n = r.slice(2); + n.length % 2 && (n = `0${n}`); + const i = n.length / 2, s = new Uint8Array(i); + for (let o = 0, a = 0; o < i; o++) { + const f = Bw(n.charCodeAt(a++)), u = Bw(n.charCodeAt(a++)); + if (f === void 0 || u === void 0) + throw new pt(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`); + s[o] = f * 16 + u; + } + return s; +} +function jT(t, e) { + const r = br(t, e); + return lo(r); +} +function e4(t, e = {}) { + const r = BT.encode(t); + return typeof e.size == "number" ? (Ns(r, { size: e.size }), Kc(r, { dir: "right", size: e.size })) : r; +} +const uh = /* @__PURE__ */ BigInt(2 ** 32 - 1), Fw = /* @__PURE__ */ BigInt(32); +function UT(t, e = !1) { + return e ? { h: Number(t & uh), l: Number(t >> Fw & uh) } : { h: Number(t >> Fw & uh) | 0, l: Number(t & uh) | 0 }; +} +function qT(t, e = !1) { + const r = t.length; + let n = new Uint32Array(r), i = new Uint32Array(r); + for (let s = 0; s < r; s++) { + const { h: o, l: a } = UT(t[s], e); + [n[s], i[s]] = [o, a]; + } + return [n, i]; +} +const zT = (t, e, r) => t << r | e >>> 32 - r, HT = (t, e, r) => e << r | t >>> 32 - r, WT = (t, e, r) => e << r - 32 | t >>> 64 - r, KT = (t, e, r) => t << r - 32 | e >>> 64 - r, hc = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0; +/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +function VT(t) { + return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array"; +} +function ad(t) { + if (!Number.isSafeInteger(t) || t < 0) + throw new Error("positive integer expected, got " + t); +} +function Da(t, ...e) { + if (!VT(t)) + throw new Error("Uint8Array expected"); + if (e.length > 0 && !e.includes(t.length)) + throw new Error("Uint8Array expected of length " + e + ", got length=" + t.length); +} +function cre(t) { + if (typeof t != "function" || typeof t.create != "function") + throw new Error("Hash should be wrapped by utils.createHasher"); + ad(t.outputLen), ad(t.blockLen); +} +function cd(t, e = !0) { + if (t.destroyed) + throw new Error("Hash instance has been destroyed"); + if (e && t.finished) + throw new Error("Hash#digest() has already been called"); +} +function t4(t, e) { + Da(t); + const r = e.outputLen; + if (t.length < r) + throw new Error("digestInto() expects output buffer of length at least " + r); +} +function GT(t) { + return new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)); +} +function hf(...t) { + for (let e = 0; e < t.length; e++) + t[e].fill(0); +} +function Bp(t) { + return new DataView(t.buffer, t.byteOffset, t.byteLength); +} +function ws(t, e) { + return t << 32 - e | t >>> e; +} +const YT = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68; +function JT(t) { + return t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255; +} +function XT(t) { + for (let e = 0; e < t.length; e++) + t[e] = JT(t[e]); + return t; +} +const jw = YT ? (t) => t : XT, r4 = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", ZT = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); +function QT(t) { + if (Da(t), r4) + return t.toHex(); + let e = ""; + for (let r = 0; r < t.length; r++) + e += ZT[t[r]]; + return e; +} +const Vs = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 }; +function Uw(t) { + if (t >= Vs._0 && t <= Vs._9) + return t - Vs._0; + if (t >= Vs.A && t <= Vs.F) + return t - (Vs.A - 10); + if (t >= Vs.a && t <= Vs.f) + return t - (Vs.a - 10); +} +function ure(t) { + if (typeof t != "string") + throw new Error("hex string expected, got " + typeof t); + if (r4) + return Uint8Array.fromHex(t); + const e = t.length, r = e / 2; + if (e % 2) + throw new Error("hex string expected, got unpadded hex of length " + e); + const n = new Uint8Array(r); + for (let i = 0, s = 0; i < r; i++, s += 2) { + const o = Uw(t.charCodeAt(s)), a = Uw(t.charCodeAt(s + 1)); + if (o === void 0 || a === void 0) { + const f = t[s] + t[s + 1]; + throw new Error('hex string expected, got non-hex character "' + f + '" at index ' + s); + } + n[i] = o * 16 + a; + } + return n; +} +function eD(t) { + if (typeof t != "string") + throw new Error("string expected"); + return new Uint8Array(new TextEncoder().encode(t)); +} +function Zv(t) { + return typeof t == "string" && (t = eD(t)), Da(t), t; +} +function fre(...t) { + let e = 0; + for (let n = 0; n < t.length; n++) { + const i = t[n]; + Da(i), e += i.length; + } + const r = new Uint8Array(e); + for (let n = 0, i = 0; n < t.length; n++) { + const s = t[n]; + r.set(s, i), i += s.length; + } + return r; +} +class n4 { +} +function i4(t) { + const e = (n) => t().update(Zv(n)).digest(), r = t(); + return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = () => t(), e; +} +function lre(t = 32) { + if (hc && typeof hc.getRandomValues == "function") + return hc.getRandomValues(new Uint8Array(t)); + if (hc && typeof hc.randomBytes == "function") + return Uint8Array.from(hc.randomBytes(t)); + throw new Error("crypto.getRandomValues must be defined"); +} +const tD = BigInt(0), Su = BigInt(1), rD = BigInt(2), nD = BigInt(7), iD = BigInt(256), sD = BigInt(113), s4 = [], o4 = [], a4 = []; +for (let t = 0, e = Su, r = 1, n = 0; t < 24; t++) { + [r, n] = [n, (2 * r + 3 * n) % 5], s4.push(2 * (5 * n + r)), o4.push((t + 1) * (t + 2) / 2 % 64); + let i = tD; + for (let s = 0; s < 7; s++) + e = (e << Su ^ (e >> nD) * sD) % iD, e & rD && (i ^= Su << (Su << /* @__PURE__ */ BigInt(s)) - Su); + a4.push(i); +} +const c4 = qT(a4, !0), oD = c4[0], aD = c4[1], qw = (t, e, r) => r > 32 ? WT(t, e, r) : zT(t, e, r), zw = (t, e, r) => r > 32 ? KT(t, e, r) : HT(t, e, r); +function cD(t, e = 24) { + const r = new Uint32Array(10); + for (let n = 24 - e; n < 24; n++) { + for (let o = 0; o < 10; o++) + r[o] = t[o] ^ t[o + 10] ^ t[o + 20] ^ t[o + 30] ^ t[o + 40]; + for (let o = 0; o < 10; o += 2) { + const a = (o + 8) % 10, f = (o + 2) % 10, u = r[f], h = r[f + 1], g = qw(u, h, 1) ^ r[a], v = zw(u, h, 1) ^ r[a + 1]; + for (let x = 0; x < 50; x += 10) + t[o + x] ^= g, t[o + x + 1] ^= v; + } + let i = t[2], s = t[3]; + for (let o = 0; o < 24; o++) { + const a = o4[o], f = qw(i, s, a), u = zw(i, s, a), h = s4[o]; + i = t[h], s = t[h + 1], t[h] = f, t[h + 1] = u; + } + for (let o = 0; o < 50; o += 10) { + for (let a = 0; a < 10; a++) + r[a] = t[o + a]; + for (let a = 0; a < 10; a++) + t[o + a] ^= ~r[(a + 2) % 10] & r[(a + 4) % 10]; + } + t[0] ^= oD[n], t[1] ^= aD[n]; + } + hf(r); +} +class Qv extends n4 { + // NOTE: we accept arguments in bytes instead of bits here. + constructor(e, r, n, i = !1, s = 24) { + if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = r, this.outputLen = n, this.enableXOF = i, this.rounds = s, ad(n), !(0 < e && e < 200)) + throw new Error("only keccak-f1600 function is supported"); + this.state = new Uint8Array(200), this.state32 = GT(this.state); + } + clone() { + return this._cloneInto(); + } + keccak() { + jw(this.state32), cD(this.state32, this.rounds), jw(this.state32), this.posOut = 0, this.pos = 0; + } + update(e) { + cd(this), e = Zv(e), Da(e); + const { blockLen: r, state: n } = this, i = e.length; + for (let s = 0; s < i; ) { + const o = Math.min(r - this.pos, i - s); + for (let a = 0; a < o; a++) + n[this.pos++] ^= e[s++]; + this.pos === r && this.keccak(); + } + return this; + } + finish() { + if (this.finished) + return; + this.finished = !0; + const { state: e, suffix: r, pos: n, blockLen: i } = this; + e[n] ^= r, (r & 128) !== 0 && n === i - 1 && this.keccak(), e[i - 1] ^= 128, this.keccak(); + } + writeInto(e) { + cd(this, !1), Da(e), this.finish(); + const r = this.state, { blockLen: n } = this; + for (let i = 0, s = e.length; i < s; ) { + this.posOut >= n && this.keccak(); + const o = Math.min(n - this.posOut, s - i); + e.set(r.subarray(this.posOut, this.posOut + o), i), this.posOut += o, i += o; + } + return e; + } + xofInto(e) { + if (!this.enableXOF) + throw new Error("XOF is not possible for this instance"); + return this.writeInto(e); + } + xof(e) { + return ad(e), this.xofInto(new Uint8Array(e)); + } + digestInto(e) { + if (t4(e, this), this.finished) + throw new Error("digest() was already called"); + return this.writeInto(e), this.destroy(), e; + } + digest() { + return this.digestInto(new Uint8Array(this.outputLen)); + } + destroy() { + this.destroyed = !0, hf(this.state); + } + _cloneInto(e) { + const { blockLen: r, suffix: n, outputLen: i, rounds: s, enableXOF: o } = this; + return e || (e = new Qv(r, n, i, o, s)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = s, e.suffix = n, e.outputLen = i, e.enableXOF = o, e.destroyed = this.destroyed, e; + } +} +const uD = (t, e, r) => i4(() => new Qv(e, t, r)), fD = uD(1, 136, 256 / 8); +function Ud(t, e) { + const r = e || "hex", n = fD(Uo(t, { strict: !1 }) ? Xv(t) : t); + return r === "bytes" ? n : od(n); +} +const lD = (t) => Ud(Xv(t)); +function hD(t) { + return lD(t); +} +function dD(t) { + let e = !0, r = "", n = 0, i = "", s = !1; + for (let o = 0; o < t.length; o++) { + const a = t[o]; + if (["(", ")", ","].includes(a) && (e = !0), a === "(" && n++, a === ")" && n--, !!e) { + if (n === 0) { + if (a === " " && ["event", "function", ""].includes(i)) + i = ""; + else if (i += a, a === ")") { + s = !0; + break; + } + continue; + } + if (a === " ") { + t[o - 1] !== "," && r !== "," && r !== ",(" && (r = "", e = !1); + continue; + } + i += a, r += a; + } + } + if (!s) + throw new pt("Unable to normalize signature."); + return i; +} +const pD = (t) => { + const e = typeof t == "string" ? t : wT(t); + return dD(e); +}; +function u4(t) { + return hD(pD(t)); +} +const gD = u4; +class Ho extends pt { + constructor({ address: e }) { + super(`Address "${e}" is invalid.`, { + metaMessages: [ + "- Address must be a hex value of 20 bytes (40 hex characters).", + "- Address must match its checksum counterpart." + ], + name: "InvalidAddressError" + }); + } +} +class qd extends Map { + constructor(e) { + super(), Object.defineProperty(this, "maxSize", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), this.maxSize = e; + } + get(e) { + const r = super.get(e); + return super.has(e) && r !== void 0 && (this.delete(e), super.set(e, r)), r; + } + set(e, r) { + if (super.set(e, r), this.maxSize && this.size > this.maxSize) { + const n = this.keys().next().value; + n && this.delete(n); + } + return this; + } +} +const Fp = /* @__PURE__ */ new qd(8192); +function Vf(t, e) { + if (Fp.has(`${t}.${e}`)) + return Fp.get(`${t}.${e}`); + const r = t.substring(2).toLowerCase(), n = Ud(e4(r), "bytes"), i = r.split(""); + for (let o = 0; o < 40; o += 2) + n[o >> 1] >> 4 >= 8 && i[o] && (i[o] = i[o].toUpperCase()), (n[o >> 1] & 15) >= 8 && i[o + 1] && (i[o + 1] = i[o + 1].toUpperCase()); + const s = `0x${i.join("")}`; + return Fp.set(`${t}.${e}`, s), s; +} +function e1(t, e) { + if (!fs(t, { strict: !1 })) + throw new Ho({ address: t }); + return Vf(t, e); +} +const mD = /^0x[a-fA-F0-9]{40}$/, jp = /* @__PURE__ */ new qd(8192); +function fs(t, e) { + const { strict: r = !0 } = e ?? {}, n = `${t}.${r}`; + if (jp.has(n)) + return jp.get(n); + const i = mD.test(t) ? t.toLowerCase() === t ? !0 : r ? Vf(t) === t : !0 : !1; + return jp.set(n, i), i; +} +function Wo(t) { + return typeof t[0] == "string" ? zd(t) : vD(t); +} +function vD(t) { + let e = 0; + for (const i of t) + e += i.length; + const r = new Uint8Array(e); + let n = 0; + for (const i of t) + r.set(i, n), n += i.length; + return r; +} +function zd(t) { + return `0x${t.reduce((e, r) => e + r.replace("0x", ""), "")}`; +} +function ud(t, e, r, { strict: n } = {}) { + return Uo(t, { strict: !1 }) ? $m(t, e, r, { + strict: n + }) : h4(t, e, r, { + strict: n + }); +} +function f4(t, e) { + if (typeof e == "number" && e > 0 && e > yn(t) - 1) + throw new J5({ + offset: e, + position: "start", + size: yn(t) + }); +} +function l4(t, e, r) { + if (typeof e == "number" && typeof r == "number" && yn(t) !== r - e) + throw new J5({ + offset: r, + position: "end", + size: yn(t) + }); +} +function h4(t, e, r, { strict: n } = {}) { + f4(t, e); + const i = t.slice(e, r); + return n && l4(i, e, r), i; +} +function $m(t, e, r, { strict: n } = {}) { + f4(t, e); + const i = `0x${t.replace("0x", "").slice((e ?? 0) * 2, (r ?? t.length) * 2)}`; + return n && l4(i, e, r), i; +} +const bD = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, d4 = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/; +function p4(t, e) { + if (t.length !== e.length) + throw new PT({ + expectedLength: t.length, + givenLength: e.length + }); + const r = yD({ + params: t, + values: e + }), n = r1(r); + return n.length === 0 ? "0x" : n; +} +function yD({ params: t, values: e }) { + const r = []; + for (let n = 0; n < t.length; n++) + r.push(t1({ param: t[n], value: e[n] })); + return r; +} +function t1({ param: t, value: e }) { + const r = n1(t.type); + if (r) { + const [n, i] = r; + return xD(e, { length: n, param: { ...t, type: i } }); + } + if (t.type === "tuple") + return PD(e, { + param: t + }); + if (t.type === "address") + return wD(e); + if (t.type === "bool") + return ED(e); + if (t.type.startsWith("uint") || t.type.startsWith("int")) { + const n = t.type.startsWith("int"), [, , i = "256"] = d4.exec(t.type) ?? []; + return SD(e, { + signed: n, + size: Number(i) + }); + } + if (t.type.startsWith("bytes")) + return _D(e, { param: t }); + if (t.type === "string") + return AD(e); + throw new CT(t.type, { + docsPath: "/docs/contract/encodeAbiParameters" + }); +} +function r1(t) { + let e = 0; + for (let s = 0; s < t.length; s++) { + const { dynamic: o, encoded: a } = t[s]; + o ? e += 32 : e += yn(a); + } + const r = [], n = []; + let i = 0; + for (let s = 0; s < t.length; s++) { + const { dynamic: o, encoded: a } = t[s]; + o ? (r.push(br(e + i, { size: 32 })), n.push(a), i += yn(a)) : r.push(a); + } + return Wo([...r, ...n]); +} +function wD(t) { + if (!fs(t)) + throw new Ho({ address: t }); + return { dynamic: !1, encoded: jo(t.toLowerCase()) }; +} +function xD(t, { length: e, param: r }) { + const n = e === null; + if (!Array.isArray(t)) + throw new TT(t); + if (!n && t.length !== e) + throw new ST({ + expectedLength: e, + givenLength: t.length, + type: `${r.type}[${e}]` + }); + let i = !1; + const s = []; + for (let o = 0; o < t.length; o++) { + const a = t1({ param: r, value: t[o] }); + a.dynamic && (i = !0), s.push(a); + } + if (n || i) { + const o = r1(s); + if (n) { + const a = br(s.length, { size: 32 }); + return { + dynamic: !0, + encoded: s.length > 0 ? Wo([a, o]) : a + }; + } + if (i) + return { dynamic: !0, encoded: o }; + } + return { + dynamic: !1, + encoded: Wo(s.map(({ encoded: o }) => o)) + }; +} +function _D(t, { param: e }) { + const [, r] = e.type.split("bytes"), n = yn(t); + if (!r) { + let i = t; + return n % 32 !== 0 && (i = jo(i, { + dir: "right", + size: Math.ceil((t.length - 2) / 2 / 32) * 32 + })), { + dynamic: !0, + encoded: Wo([jo(br(n, { size: 32 })), i]) + }; + } + if (n !== Number.parseInt(r)) + throw new AT({ + expectedSize: Number.parseInt(r), + value: t + }); + return { dynamic: !1, encoded: jo(t, { dir: "right" }) }; +} +function ED(t) { + if (typeof t != "boolean") + throw new pt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`); + return { dynamic: !1, encoded: jo(Q5(t)) }; +} +function SD(t, { signed: e, size: r = 256 }) { + if (typeof r == "number") { + const n = 2n ** (BigInt(r) - (e ? 1n : 0n)) - 1n, i = e ? -n - 1n : 0n; + if (t > n || t < i) + throw new Z5({ + max: n.toString(), + min: i.toString(), + signed: e, + size: r / 8, + value: t.toString() + }); + } + return { + dynamic: !1, + encoded: br(t, { + size: 32, + signed: e + }) + }; +} +function AD(t) { + const e = jd(t), r = Math.ceil(yn(e) / 32), n = []; + for (let i = 0; i < r; i++) + n.push(jo(ud(e, i * 32, (i + 1) * 32), { + dir: "right" + })); + return { + dynamic: !0, + encoded: Wo([ + jo(br(yn(e), { size: 32 })), + ...n + ]) + }; +} +function PD(t, { param: e }) { + let r = !1; + const n = []; + for (let i = 0; i < e.components.length; i++) { + const s = e.components[i], o = Array.isArray(t) ? i : s.name, a = t1({ + param: s, + value: t[o] + }); + n.push(a), a.dynamic && (r = !0); + } + return { + dynamic: r, + encoded: r ? r1(n) : Wo(n.map(({ encoded: i }) => i)) + }; +} +function n1(t) { + const e = t.match(/^(.*)\[(\d+)?\]$/); + return e ? ( + // Return `null` if the array is dynamic. + [e[2] ? Number(e[2]) : null, e[1]] + ) : void 0; +} +const i1 = (t) => ud(u4(t), 0, 4); +function g4(t) { + const { abi: e, args: r = [], name: n } = t, i = Uo(n, { strict: !1 }), s = e.filter((a) => i ? a.type === "function" ? i1(a) === n : a.type === "event" ? gD(a) === n : !1 : "name" in a && a.name === n); + if (s.length === 0) + return; + if (s.length === 1) + return s[0]; + let o; + for (const a of s) { + if (!("inputs" in a)) + continue; + if (!r || r.length === 0) { + if (!a.inputs || a.inputs.length === 0) + return a; + continue; + } + if (!a.inputs || a.inputs.length === 0 || a.inputs.length !== r.length) + continue; + if (r.every((u, h) => { + const g = "inputs" in a && a.inputs[h]; + return g ? Bm(u, g) : !1; + })) { + if (o && "inputs" in o && o.inputs) { + const u = m4(a.inputs, o.inputs, r); + if (u) + throw new MT({ + abiItem: a, + type: u[0] + }, { + abiItem: o, + type: u[1] + }); + } + o = a; + } + } + return o || s[0]; +} +function Bm(t, e) { + const r = typeof t, n = e.type; + switch (n) { + case "address": + return fs(t, { strict: !1 }); + case "bool": + return r === "boolean"; + case "function": + return r === "string"; + case "string": + return r === "string"; + default: + return n === "tuple" && "components" in e ? Object.values(e.components).every((i, s) => Bm(Object.values(t)[s], i)) : /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n) ? r === "number" || r === "bigint" : /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n) ? r === "string" || t instanceof Uint8Array : /[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n) ? Array.isArray(t) && t.every((i) => Bm(i, { + ...e, + // Pop off `[]` or `[M]` from end of type + type: n.replace(/(\[[0-9]{0,}\])$/, "") + })) : !1; + } +} +function m4(t, e, r) { + for (const n in t) { + const i = t[n], s = e[n]; + if (i.type === "tuple" && s.type === "tuple" && "components" in i && "components" in s) + return m4(i.components, s.components, r[n]); + const o = [i.type, s.type]; + if (o.includes("address") && o.includes("bytes20") ? !0 : o.includes("address") && o.includes("string") ? fs(r[n], { strict: !1 }) : o.includes("address") && o.includes("bytes") ? fs(r[n], { strict: !1 }) : !1) + return o; + } +} +function pi(t) { + return typeof t == "string" ? { address: t, type: "json-rpc" } : t; +} +const Hw = "/docs/contract/encodeFunctionData"; +function MD(t) { + const { abi: e, args: r, functionName: n } = t; + let i = e[0]; + if (n) { + const s = g4({ + abi: e, + args: r, + name: n + }); + if (!s) + throw new kw(n, { docsPath: Hw }); + i = s; + } + if (i.type !== "function") + throw new kw(void 0, { docsPath: Hw }); + return { + abi: [i], + functionName: i1(Bc(i)) + }; +} +function v4(t) { + const { args: e } = t, { abi: r, functionName: n } = t.abi.length === 1 && t.functionName?.startsWith("0x") ? t : MD(t), i = r[0], s = n, o = "inputs" in i && i.inputs ? p4(i.inputs, e ?? []) : void 0; + return zd([s, o ?? "0x"]); +} +const ID = { + 1: "An `assert` condition failed.", + 17: "Arithmetic operation resulted in underflow or overflow.", + 18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).", + 33: "Attempted to convert to an invalid type.", + 34: "Attempted to access a storage byte array that is incorrectly encoded.", + 49: "Performed `.pop()` on an empty array", + 50: "Array index is out of bounds.", + 65: "Allocated too much memory or created an array which is too large.", + 81: "Attempted to call a zero-initialized variable of internal function type." +}, CD = { + inputs: [ + { + name: "message", + type: "string" + } + ], + name: "Error", + type: "error" +}, RD = { + inputs: [ + { + name: "reason", + type: "uint256" + } + ], + name: "Panic", + type: "error" +}; +class Ww extends pt { + constructor({ offset: e }) { + super(`Offset \`${e}\` cannot be negative.`, { + name: "NegativeOffsetError" + }); + } +} +class TD extends pt { + constructor({ length: e, position: r }) { + super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`, { name: "PositionOutOfBoundsError" }); + } +} +class DD extends pt { + constructor({ count: e, limit: r }) { + super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`, { name: "RecursiveReadLimitExceededError" }); + } +} +const OD = { + bytes: new Uint8Array(), + dataView: new DataView(new ArrayBuffer(0)), + position: 0, + positionReadCount: /* @__PURE__ */ new Map(), + recursiveReadCount: 0, + recursiveReadLimit: Number.POSITIVE_INFINITY, + assertReadLimit() { + if (this.recursiveReadCount >= this.recursiveReadLimit) + throw new DD({ + count: this.recursiveReadCount + 1, + limit: this.recursiveReadLimit + }); + }, + assertPosition(t) { + if (t < 0 || t > this.bytes.length - 1) + throw new TD({ + length: this.bytes.length, + position: t + }); + }, + decrementPosition(t) { + if (t < 0) + throw new Ww({ offset: t }); + const e = this.position - t; + this.assertPosition(e), this.position = e; + }, + getReadCount(t) { + return this.positionReadCount.get(t || this.position) || 0; + }, + incrementPosition(t) { + if (t < 0) + throw new Ww({ offset: t }); + const e = this.position + t; + this.assertPosition(e), this.position = e; + }, + inspectByte(t) { + const e = t ?? this.position; + return this.assertPosition(e), this.bytes[e]; + }, + inspectBytes(t, e) { + const r = e ?? this.position; + return this.assertPosition(r + t - 1), this.bytes.subarray(r, r + t); + }, + inspectUint8(t) { + const e = t ?? this.position; + return this.assertPosition(e), this.bytes[e]; + }, + inspectUint16(t) { + const e = t ?? this.position; + return this.assertPosition(e + 1), this.dataView.getUint16(e); + }, + inspectUint24(t) { + const e = t ?? this.position; + return this.assertPosition(e + 2), (this.dataView.getUint16(e) << 8) + this.dataView.getUint8(e + 2); + }, + inspectUint32(t) { + const e = t ?? this.position; + return this.assertPosition(e + 3), this.dataView.getUint32(e); + }, + pushByte(t) { + this.assertPosition(this.position), this.bytes[this.position] = t, this.position++; + }, + pushBytes(t) { + this.assertPosition(this.position + t.length - 1), this.bytes.set(t, this.position), this.position += t.length; + }, + pushUint8(t) { + this.assertPosition(this.position), this.bytes[this.position] = t, this.position++; + }, + pushUint16(t) { + this.assertPosition(this.position + 1), this.dataView.setUint16(this.position, t), this.position += 2; + }, + pushUint24(t) { + this.assertPosition(this.position + 2), this.dataView.setUint16(this.position, t >> 8), this.dataView.setUint8(this.position + 2, t & 255), this.position += 3; + }, + pushUint32(t) { + this.assertPosition(this.position + 3), this.dataView.setUint32(this.position, t), this.position += 4; + }, + readByte() { + this.assertReadLimit(), this._touch(); + const t = this.inspectByte(); + return this.position++, t; + }, + readBytes(t, e) { + this.assertReadLimit(), this._touch(); + const r = this.inspectBytes(t); + return this.position += e ?? t, r; + }, + readUint8() { + this.assertReadLimit(), this._touch(); + const t = this.inspectUint8(); + return this.position += 1, t; + }, + readUint16() { + this.assertReadLimit(), this._touch(); + const t = this.inspectUint16(); + return this.position += 2, t; + }, + readUint24() { + this.assertReadLimit(), this._touch(); + const t = this.inspectUint24(); + return this.position += 3, t; + }, + readUint32() { + this.assertReadLimit(), this._touch(); + const t = this.inspectUint32(); + return this.position += 4, t; + }, + get remaining() { + return this.bytes.length - this.position; + }, + setPosition(t) { + const e = this.position; + return this.assertPosition(t), this.position = t, () => this.position = e; + }, + _touch() { + if (this.recursiveReadLimit === Number.POSITIVE_INFINITY) + return; + const t = this.getReadCount(); + this.positionReadCount.set(this.position, t + 1), t > 0 && this.recursiveReadCount++; + } +}; +function s1(t, { recursiveReadLimit: e = 8192 } = {}) { + const r = Object.create(OD); + return r.bytes = t, r.dataView = new DataView(t.buffer, t.byteOffset, t.byteLength), r.positionReadCount = /* @__PURE__ */ new Map(), r.recursiveReadLimit = e, r; +} +function ND(t, e = {}) { + typeof e.size < "u" && Ns(t, { size: e.size }); + const r = di(t, e); + return qo(r, e); +} +function LD(t, e = {}) { + let r = t; + if (typeof e.size < "u" && (Ns(r, { size: e.size }), r = Fd(r)), r.length > 1 || r[0] > 1) + throw new NT(r); + return !!r[0]; +} +function io(t, e = {}) { + typeof e.size < "u" && Ns(t, { size: e.size }); + const r = di(t, e); + return zo(r, e); +} +function kD(t, e = {}) { + let r = t; + return typeof e.size < "u" && (Ns(r, { size: e.size }), r = Fd(r, { dir: "right" })), new TextDecoder().decode(r); +} +function $D(t, e) { + const r = typeof e == "string" ? lo(e) : e, n = s1(r); + if (yn(r) === 0 && t.length > 0) + throw new Jv(); + if (yn(e) && yn(e) < 32) + throw new ET({ + data: typeof e == "string" ? e : di(e), + params: t, + size: yn(e) + }); + let i = 0; + const s = []; + for (let o = 0; o < t.length; ++o) { + const a = t[o]; + n.setPosition(i); + const [f, u] = Cc(n, a, { + staticPosition: 0 + }); + i += u, s.push(f); + } + return s; +} +function Cc(t, e, { staticPosition: r }) { + const n = n1(e.type); + if (n) { + const [i, s] = n; + return FD(t, { ...e, type: s }, { length: i, staticPosition: r }); + } + if (e.type === "tuple") + return zD(t, e, { staticPosition: r }); + if (e.type === "address") + return BD(t); + if (e.type === "bool") + return jD(t); + if (e.type.startsWith("bytes")) + return UD(t, e, { staticPosition: r }); + if (e.type.startsWith("uint") || e.type.startsWith("int")) + return qD(t, e); + if (e.type === "string") + return HD(t, { staticPosition: r }); + throw new RT(e.type, { + docsPath: "/docs/contract/decodeAbiParameters" + }); +} +const Kw = 32, Fm = 32; +function BD(t) { + const e = t.readBytes(32); + return [Vf(di(h4(e, -20))), 32]; +} +function FD(t, e, { length: r, staticPosition: n }) { + if (!r) { + const o = io(t.readBytes(Fm)), a = n + o, f = a + Kw; + t.setPosition(a); + const u = io(t.readBytes(Kw)), h = df(e); + let g = 0; + const v = []; + for (let x = 0; x < u; ++x) { + t.setPosition(f + (h ? x * 32 : g)); + const [S, C] = Cc(t, e, { + staticPosition: f + }); + g += C, v.push(S); + } + return t.setPosition(n + 32), [v, 32]; + } + if (df(e)) { + const o = io(t.readBytes(Fm)), a = n + o, f = []; + for (let u = 0; u < r; ++u) { + t.setPosition(a + u * 32); + const [h] = Cc(t, e, { + staticPosition: a + }); + f.push(h); + } + return t.setPosition(n + 32), [f, 32]; + } + let i = 0; + const s = []; + for (let o = 0; o < r; ++o) { + const [a, f] = Cc(t, e, { + staticPosition: n + i + }); + i += f, s.push(a); + } + return [s, i]; +} +function jD(t) { + return [LD(t.readBytes(32), { size: 32 }), 32]; +} +function UD(t, e, { staticPosition: r }) { + const [n, i] = e.type.split("bytes"); + if (!i) { + const o = io(t.readBytes(32)); + t.setPosition(r + o); + const a = io(t.readBytes(32)); + if (a === 0) + return t.setPosition(r + 32), ["0x", 32]; + const f = t.readBytes(a); + return t.setPosition(r + 32), [di(f), 32]; + } + return [di(t.readBytes(Number.parseInt(i), 32)), 32]; +} +function qD(t, e) { + const r = e.type.startsWith("int"), n = Number.parseInt(e.type.split("int")[1] || "256"), i = t.readBytes(32); + return [ + n > 48 ? ND(i, { signed: r }) : io(i, { signed: r }), + 32 + ]; +} +function zD(t, e, { staticPosition: r }) { + const n = e.components.length === 0 || e.components.some(({ name: o }) => !o), i = n ? [] : {}; + let s = 0; + if (df(e)) { + const o = io(t.readBytes(Fm)), a = r + o; + for (let f = 0; f < e.components.length; ++f) { + const u = e.components[f]; + t.setPosition(a + s); + const [h, g] = Cc(t, u, { + staticPosition: a + }); + s += g, i[n ? f : u?.name] = h; + } + return t.setPosition(r + 32), [i, 32]; + } + for (let o = 0; o < e.components.length; ++o) { + const a = e.components[o], [f, u] = Cc(t, a, { + staticPosition: r + }); + i[n ? o : a?.name] = f, s += u; + } + return [i, s]; +} +function HD(t, { staticPosition: e }) { + const r = io(t.readBytes(32)), n = e + r; + t.setPosition(n); + const i = io(t.readBytes(32)); + if (i === 0) + return t.setPosition(e + 32), ["", 32]; + const s = t.readBytes(i, 32), o = kD(Fd(s)); + return t.setPosition(e + 32), [o, 32]; +} +function df(t) { + const { type: e } = t; + if (e === "string" || e === "bytes" || e.endsWith("[]")) + return !0; + if (e === "tuple") + return t.components?.some(df); + const r = n1(t.type); + return !!(r && df({ ...t, type: r[1] })); +} +function WD(t) { + const { abi: e, data: r } = t, n = ud(r, 0, 4); + if (n === "0x") + throw new Jv(); + const s = [...e || [], CD, RD].find((o) => o.type === "error" && n === i1(Bc(o))); + if (!s) + throw new Y5(n, { + docsPath: "/docs/contract/decodeErrorResult" + }); + return { + abiItem: s, + args: "inputs" in s && s.inputs && s.inputs.length > 0 ? $D(s.inputs, ud(r, 4)) : void 0, + errorName: s.name + }; +} +const Ua = (t, e, r) => JSON.stringify(t, (n, i) => typeof i == "bigint" ? i.toString() : i, r); +function b4({ abiItem: t, args: e, includeFunctionName: r = !0, includeName: n = !1 }) { + if ("name" in t && "inputs" in t && t.inputs) + return `${r ? t.name : ""}(${t.inputs.map((i, s) => `${n && i.name ? `${i.name}: ` : ""}${typeof e[s] == "object" ? Ua(e[s]) : e[s]}`).join(", ")})`; +} +const KD = { + gwei: 9, + wei: 18 +}, VD = { + ether: -9, + wei: 9 +}; +function y4(t, e) { + let r = t.toString(); + const n = r.startsWith("-"); + n && (r = r.slice(1)), r = r.padStart(e, "0"); + let [i, s] = [ + r.slice(0, r.length - e), + r.slice(r.length - e) + ]; + return s = s.replace(/(0+)$/, ""), `${n ? "-" : ""}${i || "0"}${s ? `.${s}` : ""}`; +} +function w4(t, e = "wei") { + return y4(t, KD[e]); +} +function us(t, e = "wei") { + return y4(t, VD[e]); +} +class GD extends pt { + constructor({ address: e }) { + super(`State for account "${e}" is set multiple times.`, { + name: "AccountStateConflictError" + }); + } +} +class YD extends pt { + constructor() { + super("state and stateDiff are set on the same account.", { + name: "StateAssignmentConflictError" + }); + } +} +function Hd(t) { + const e = Object.entries(t).map(([n, i]) => i === void 0 || i === !1 ? null : [n, i]).filter(Boolean), r = e.reduce((n, [i]) => Math.max(n, i.length), 0); + return e.map(([n, i]) => ` ${`${n}:`.padEnd(r + 1)} ${i}`).join(` +`); +} +class JD extends pt { + constructor() { + super([ + "Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.", + "Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others." + ].join(` +`), { name: "FeeConflictError" }); + } +} +class XD extends pt { + constructor({ transaction: e }) { + super("Cannot infer a transaction type from provided transaction.", { + metaMessages: [ + "Provided Transaction:", + "{", + Hd(e), + "}", + "", + "To infer the type, either provide:", + "- a `type` to the Transaction, or", + "- an EIP-1559 Transaction with `maxFeePerGas`, or", + "- an EIP-2930 Transaction with `gasPrice` & `accessList`, or", + "- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or", + "- an EIP-7702 Transaction with `authorizationList`, or", + "- a Legacy Transaction with `gasPrice`" + ], + name: "InvalidSerializableTransactionError" + }); + } +} +class ZD extends pt { + constructor(e, { account: r, docsPath: n, chain: i, data: s, gas: o, gasPrice: a, maxFeePerGas: f, maxPriorityFeePerGas: u, nonce: h, to: g, value: v }) { + const x = Hd({ + chain: i && `${i?.name} (id: ${i?.id})`, + from: r?.address, + to: g, + value: typeof v < "u" && `${w4(v)} ${i?.nativeCurrency?.symbol || "ETH"}`, + data: s, + gas: o, + gasPrice: typeof a < "u" && `${us(a)} gwei`, + maxFeePerGas: typeof f < "u" && `${us(f)} gwei`, + maxPriorityFeePerGas: typeof u < "u" && `${us(u)} gwei`, + nonce: h + }); + super(e.shortMessage, { + cause: e, + docsPath: n, + metaMessages: [ + ...e.metaMessages ? [...e.metaMessages, " "] : [], + "Request Arguments:", + x + ].filter(Boolean), + name: "TransactionExecutionError" + }), Object.defineProperty(this, "cause", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), this.cause = e; + } +} +const QD = (t) => t, x4 = (t) => t; +class eO extends pt { + constructor(e, { abi: r, args: n, contractAddress: i, docsPath: s, functionName: o, sender: a }) { + const f = g4({ abi: r, args: n, name: o }), u = f ? b4({ + abiItem: f, + args: n, + includeFunctionName: !1, + includeName: !1 + }) : void 0, h = f ? Bc(f, { includeName: !0 }) : void 0, g = Hd({ + address: i && QD(i), + function: h, + args: u && u !== "()" && `${[...Array(o?.length ?? 0).keys()].map(() => " ").join("")}${u}`, + sender: a + }); + super(e.shortMessage || `An unknown error occurred while executing the contract function "${o}".`, { + cause: e, + docsPath: s, + metaMessages: [ + ...e.metaMessages ? [...e.metaMessages, " "] : [], + g && "Contract Call:", + g + ].filter(Boolean), + name: "ContractFunctionExecutionError" + }), Object.defineProperty(this, "abi", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "args", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "cause", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "contractAddress", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "formattedArgs", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "functionName", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "sender", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), this.abi = r, this.args = n, this.cause = e, this.contractAddress = i, this.functionName = o, this.sender = a; + } +} +class tO extends pt { + constructor({ abi: e, data: r, functionName: n, message: i }) { + let s, o, a, f; + if (r && r !== "0x") + try { + o = WD({ abi: e, data: r }); + const { abiItem: h, errorName: g, args: v } = o; + if (g === "Error") + f = v[0]; + else if (g === "Panic") { + const [x] = v; + f = ID[x]; + } else { + const x = h ? Bc(h, { includeName: !0 }) : void 0, S = h && v ? b4({ + abiItem: h, + args: v, + includeFunctionName: !1, + includeName: !1 + }) : void 0; + a = [ + x ? `Error: ${x}` : "", + S && S !== "()" ? ` ${[...Array(g?.length ?? 0).keys()].map(() => " ").join("")}${S}` : "" + ]; + } + } catch (h) { + s = h; + } + else i && (f = i); + let u; + s instanceof Y5 && (u = s.signature, a = [ + `Unable to decode signature "${u}" as it was not found on the provided ABI.`, + "Make sure you are using the correct ABI and that the error exists on it.", + `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${u}.` + ]), super(f && f !== "execution reverted" || u ? [ + `The contract function "${n}" reverted with the following ${u ? "signature" : "reason"}:`, + f || u + ].join(` +`) : `The contract function "${n}" reverted.`, { + cause: s, + metaMessages: a, + name: "ContractFunctionRevertedError" + }), Object.defineProperty(this, "data", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "raw", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "reason", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "signature", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), this.data = o, this.raw = r, this.reason = f, this.signature = u; + } +} +class rO extends pt { + constructor({ functionName: e }) { + super(`The contract function "${e}" returned no data ("0x").`, { + metaMessages: [ + "This could be due to any of the following:", + ` - The contract does not have the function "${e}",`, + " - The parameters passed to the contract function may be invalid, or", + " - The address is not a contract." + ], + name: "ContractFunctionZeroDataError" + }); + } +} +class nO extends pt { + constructor({ data: e, message: r }) { + super(r || "", { name: "RawContractError" }), Object.defineProperty(this, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 3 + }), Object.defineProperty(this, "data", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), this.data = e; + } +} +class _4 extends pt { + constructor({ body: e, cause: r, details: n, headers: i, status: s, url: o }) { + super("HTTP request failed.", { + cause: r, + details: n, + metaMessages: [ + s && `Status: ${s}`, + `URL: ${x4(o)}`, + e && `Request body: ${Ua(e)}` + ].filter(Boolean), + name: "HttpRequestError" + }), Object.defineProperty(this, "body", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "headers", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "status", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "url", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), this.body = e, this.headers = i, this.status = s, this.url = o; + } +} +class E4 extends pt { + constructor({ body: e, error: r, url: n }) { + super("RPC Request failed.", { + cause: r, + details: r.message, + metaMessages: [`URL: ${x4(n)}`, `Request body: ${Ua(e)}`], + name: "RpcRequestError" + }), Object.defineProperty(this, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), Object.defineProperty(this, "data", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), this.code = r.code, this.data = r.data; + } +} +const iO = -1; +class gi extends pt { + constructor(e, { code: r, docsPath: n, metaMessages: i, name: s, shortMessage: o }) { + super(o, { + cause: e, + docsPath: n, + metaMessages: i || e?.metaMessages, + name: s || "RpcError" + }), Object.defineProperty(this, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), this.name = s || e.name, this.code = e instanceof E4 ? e.code : r ?? iO; + } +} +class Mi extends gi { + constructor(e, r) { + super(e, r), Object.defineProperty(this, "data", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), this.data = r.data; + } +} +class pf extends gi { + constructor(e) { + super(e, { + code: pf.code, + name: "ParseRpcError", + shortMessage: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text." + }); + } +} +Object.defineProperty(pf, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: -32700 +}); +class gf extends gi { + constructor(e) { + super(e, { + code: gf.code, + name: "InvalidRequestRpcError", + shortMessage: "JSON is not a valid request object." + }); + } +} +Object.defineProperty(gf, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: -32600 +}); +class mf extends gi { + constructor(e, { method: r } = {}) { + super(e, { + code: mf.code, + name: "MethodNotFoundRpcError", + shortMessage: `The method${r ? ` "${r}"` : ""} does not exist / is not available.` + }); + } +} +Object.defineProperty(mf, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: -32601 +}); +class vf extends gi { + constructor(e) { + super(e, { + code: vf.code, + name: "InvalidParamsRpcError", + shortMessage: [ + "Invalid parameters were provided to the RPC method.", + "Double check you have provided the correct parameters." + ].join(` +`) + }); + } +} +Object.defineProperty(vf, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: -32602 +}); +class Oa extends gi { + constructor(e) { + super(e, { + code: Oa.code, + name: "InternalRpcError", + shortMessage: "An internal error was received." + }); + } +} +Object.defineProperty(Oa, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: -32603 +}); +class bf extends gi { + constructor(e) { + super(e, { + code: bf.code, + name: "InvalidInputRpcError", + shortMessage: [ + "Missing or invalid parameters.", + "Double check you have provided the correct parameters." + ].join(` +`) + }); + } +} +Object.defineProperty(bf, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: -32e3 +}); +class yf extends gi { + constructor(e) { + super(e, { + code: yf.code, + name: "ResourceNotFoundRpcError", + shortMessage: "Requested resource not found." + }), Object.defineProperty(this, "name", { + enumerable: !0, + configurable: !0, + writable: !0, + value: "ResourceNotFoundRpcError" + }); + } +} +Object.defineProperty(yf, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: -32001 +}); +class wf extends gi { + constructor(e) { + super(e, { + code: wf.code, + name: "ResourceUnavailableRpcError", + shortMessage: "Requested resource not available." + }); + } +} +Object.defineProperty(wf, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: -32002 +}); +class xf extends gi { + constructor(e) { + super(e, { + code: xf.code, + name: "TransactionRejectedRpcError", + shortMessage: "Transaction creation failed." + }); + } +} +Object.defineProperty(xf, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: -32003 +}); +class Aa extends gi { + constructor(e, { method: r } = {}) { + super(e, { + code: Aa.code, + name: "MethodNotSupportedRpcError", + shortMessage: `Method${r ? ` "${r}"` : ""} is not supported.` + }); + } +} +Object.defineProperty(Aa, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: -32004 +}); +class Fc extends gi { + constructor(e) { + super(e, { + code: Fc.code, + name: "LimitExceededRpcError", + shortMessage: "Request exceeds defined limit." + }); + } +} +Object.defineProperty(Fc, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: -32005 +}); +class _f extends gi { + constructor(e) { + super(e, { + code: _f.code, + name: "JsonRpcVersionUnsupportedError", + shortMessage: "Version of JSON-RPC protocol is not supported." + }); + } +} +Object.defineProperty(_f, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: -32006 +}); +class Rc extends Mi { + constructor(e) { + super(e, { + code: Rc.code, + name: "UserRejectedRequestError", + shortMessage: "User rejected the request." + }); + } +} +Object.defineProperty(Rc, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 4001 +}); +class Ef extends Mi { + constructor(e) { + super(e, { + code: Ef.code, + name: "UnauthorizedProviderError", + shortMessage: "The requested method and/or account has not been authorized by the user." + }); + } +} +Object.defineProperty(Ef, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 4100 +}); +class Sf extends Mi { + constructor(e, { method: r } = {}) { + super(e, { + code: Sf.code, + name: "UnsupportedProviderMethodError", + shortMessage: `The Provider does not support the requested method${r ? ` " ${r}"` : ""}.` + }); + } +} +Object.defineProperty(Sf, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 4200 +}); +class Af extends Mi { + constructor(e) { + super(e, { + code: Af.code, + name: "ProviderDisconnectedError", + shortMessage: "The Provider is disconnected from all chains." + }); + } +} +Object.defineProperty(Af, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 4900 +}); +class Pf extends Mi { + constructor(e) { + super(e, { + code: Pf.code, + name: "ChainDisconnectedError", + shortMessage: "The Provider is not connected to the requested chain." + }); + } +} +Object.defineProperty(Pf, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 4901 +}); +class Mf extends Mi { + constructor(e) { + super(e, { + code: Mf.code, + name: "SwitchChainError", + shortMessage: "An error occurred when attempting to switch chain." + }); + } +} +Object.defineProperty(Mf, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 4902 +}); +class jc extends Mi { + constructor(e) { + super(e, { + code: jc.code, + name: "UnsupportedNonOptionalCapabilityError", + shortMessage: "This Wallet does not support a capability that was not marked as optional." + }); + } +} +Object.defineProperty(jc, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 5700 +}); +class If extends Mi { + constructor(e) { + super(e, { + code: If.code, + name: "UnsupportedChainIdError", + shortMessage: "This Wallet does not support the requested chain ID." + }); + } +} +Object.defineProperty(If, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 5710 +}); +class Cf extends Mi { + constructor(e) { + super(e, { + code: Cf.code, + name: "DuplicateIdError", + shortMessage: "There is already a bundle submitted with this ID." + }); + } +} +Object.defineProperty(Cf, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 5720 +}); +class Rf extends Mi { + constructor(e) { + super(e, { + code: Rf.code, + name: "UnknownBundleIdError", + shortMessage: "This bundle id is unknown / has not been submitted" + }); + } +} +Object.defineProperty(Rf, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 5730 +}); +class Tf extends Mi { + constructor(e) { + super(e, { + code: Tf.code, + name: "BundleTooLargeError", + shortMessage: "The call bundle is too large for the Wallet to process." + }); + } +} +Object.defineProperty(Tf, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 5740 +}); +class Df extends Mi { + constructor(e) { + super(e, { + code: Df.code, + name: "AtomicReadyWalletRejectedUpgradeError", + shortMessage: "The Wallet can support atomicity after an upgrade, but the user rejected the upgrade." + }); + } +} +Object.defineProperty(Df, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 5750 +}); +class Uc extends Mi { + constructor(e) { + super(e, { + code: Uc.code, + name: "AtomicityNotSupportedError", + shortMessage: "The wallet does not support atomic execution but the request requires it." + }); + } +} +Object.defineProperty(Uc, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 5760 +}); +class sO extends gi { + constructor(e) { + super(e, { + name: "UnknownRpcError", + shortMessage: "An unknown RPC error occurred." + }); + } +} +const oO = 3; +function aO(t, { abi: e, address: r, args: n, docsPath: i, functionName: s, sender: o }) { + const a = t instanceof nO ? t : t instanceof pt ? t.walk((S) => "data" in S) || t.walk() : {}, { code: f, data: u, details: h, message: g, shortMessage: v } = a, x = t instanceof Jv ? new rO({ functionName: s }) : [oO, Oa.code].includes(f) && (u || h || g || v) ? new tO({ + abi: e, + data: typeof u == "object" ? u.data : u, + functionName: s, + message: a instanceof E4 ? h : v ?? g + }) : t; + return new eO(x, { + abi: e, + args: n, + contractAddress: r, + docsPath: i, + functionName: s, + sender: o + }); +} +function cO(t) { + const e = Ud(`0x${t.substring(4)}`).substring(26); + return Vf(`0x${e}`); +} +async function uO({ hash: t, signature: e }) { + const r = Uo(t) ? t : od(t), { secp256k1: n } = await import("./secp256k1-DbKZjSuc.js"); + return `0x${(() => { + if (typeof e == "object" && "r" in e && "s" in e) { + const { r: u, s: h, v: g, yParity: v } = e, x = Number(v ?? g), S = Vw(x); + return new n.Signature(qo(u), qo(h)).addRecoveryBit(S); + } + const o = Uo(e) ? e : od(e); + if (yn(o) !== 65) + throw new Error("invalid signature length"); + const a = zo(`0x${o.slice(130)}`), f = Vw(a); + return n.Signature.fromCompact(o.substring(2, 130)).addRecoveryBit(f); + })().recoverPublicKey(r.substring(2)).toHex(!1)}`; +} +function Vw(t) { + if (t === 0 || t === 1) + return t; + if (t === 27) + return 0; + if (t === 28) + return 1; + throw new Error("Invalid yParityOrV value"); +} +async function fO({ hash: t, signature: e }) { + return cO(await uO({ hash: t, signature: e })); +} +function lO(t, e = "hex") { + const r = S4(t), n = s1(new Uint8Array(r.length)); + return r.encode(n), e === "hex" ? di(n.bytes) : n.bytes; +} +function S4(t) { + return Array.isArray(t) ? hO(t.map((e) => S4(e))) : dO(t); +} +function hO(t) { + const e = t.reduce((i, s) => i + s.length, 0), r = A4(e); + return { + length: e <= 55 ? 1 + e : 1 + r + e, + encode(i) { + e <= 55 ? i.pushByte(192 + e) : (i.pushByte(247 + r), r === 1 ? i.pushUint8(e) : r === 2 ? i.pushUint16(e) : r === 3 ? i.pushUint24(e) : i.pushUint32(e)); + for (const { encode: s } of t) + s(i); + } + }; +} +function dO(t) { + const e = typeof t == "string" ? lo(t) : t, r = A4(e.length); + return { + length: e.length === 1 && e[0] < 128 ? 1 : e.length <= 55 ? 1 + e.length : 1 + r + e.length, + encode(i) { + e.length === 1 && e[0] < 128 ? i.pushBytes(e) : e.length <= 55 ? (i.pushByte(128 + e.length), i.pushBytes(e)) : (i.pushByte(183 + r), r === 1 ? i.pushUint8(e.length) : r === 2 ? i.pushUint16(e.length) : r === 3 ? i.pushUint24(e.length) : i.pushUint32(e.length), i.pushBytes(e)); + } + }; +} +function A4(t) { + if (t < 2 ** 8) + return 1; + if (t < 2 ** 16) + return 2; + if (t < 2 ** 24) + return 3; + if (t < 2 ** 32) + return 4; + throw new pt("Length is too large."); +} +function pO(t) { + const { chainId: e, nonce: r, to: n } = t, i = t.contractAddress ?? t.address, s = Ud(zd([ + "0x05", + lO([ + e ? br(e) : "0x", + i, + r ? br(r) : "0x" + ]) + ])); + return n === "bytes" ? lo(s) : s; +} +async function P4(t) { + const { authorization: e, signature: r } = t; + return fO({ + hash: pO(e), + signature: r ?? e + }); +} +class gO extends pt { + constructor(e, { account: r, docsPath: n, chain: i, data: s, gas: o, gasPrice: a, maxFeePerGas: f, maxPriorityFeePerGas: u, nonce: h, to: g, value: v }) { + const x = Hd({ + from: r?.address, + to: g, + value: typeof v < "u" && `${w4(v)} ${i?.nativeCurrency?.symbol || "ETH"}`, + data: s, + gas: o, + gasPrice: typeof a < "u" && `${us(a)} gwei`, + maxFeePerGas: typeof f < "u" && `${us(f)} gwei`, + maxPriorityFeePerGas: typeof u < "u" && `${us(u)} gwei`, + nonce: h + }); + super(e.shortMessage, { + cause: e, + docsPath: n, + metaMessages: [ + ...e.metaMessages ? [...e.metaMessages, " "] : [], + "Estimate Gas Arguments:", + x + ].filter(Boolean), + name: "EstimateGasExecutionError" + }), Object.defineProperty(this, "cause", { + enumerable: !0, + configurable: !0, + writable: !0, + value: void 0 + }), this.cause = e; + } +} +class xc extends pt { + constructor({ cause: e, message: r } = {}) { + const n = r?.replace("execution reverted: ", "")?.replace("execution reverted", ""); + super(`Execution reverted ${n ? `with reason: ${n}` : "for an unknown reason"}.`, { + cause: e, + name: "ExecutionRevertedError" + }); + } +} +Object.defineProperty(xc, "code", { + enumerable: !0, + configurable: !0, + writable: !0, + value: 3 +}); +Object.defineProperty(xc, "nodeMessage", { + enumerable: !0, + configurable: !0, + writable: !0, + value: /execution reverted/ +}); +class fd extends pt { + constructor({ cause: e, maxFeePerGas: r } = {}) { + super(`The fee cap (\`maxFeePerGas\`${r ? ` = ${us(r)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, { + cause: e, + name: "FeeCapTooHighError" + }); + } +} +Object.defineProperty(fd, "nodeMessage", { + enumerable: !0, + configurable: !0, + writable: !0, + value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/ +}); +class jm extends pt { + constructor({ cause: e, maxFeePerGas: r } = {}) { + super(`The fee cap (\`maxFeePerGas\`${r ? ` = ${us(r)}` : ""} gwei) cannot be lower than the block base fee.`, { + cause: e, + name: "FeeCapTooLowError" + }); + } +} +Object.defineProperty(jm, "nodeMessage", { + enumerable: !0, + configurable: !0, + writable: !0, + value: /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/ +}); +class Um extends pt { + constructor({ cause: e, nonce: r } = {}) { + super(`Nonce provided for the transaction ${r ? `(${r}) ` : ""}is higher than the next one expected.`, { cause: e, name: "NonceTooHighError" }); + } +} +Object.defineProperty(Um, "nodeMessage", { + enumerable: !0, + configurable: !0, + writable: !0, + value: /nonce too high/ +}); +class qm extends pt { + constructor({ cause: e, nonce: r } = {}) { + super([ + `Nonce provided for the transaction ${r ? `(${r}) ` : ""}is lower than the current nonce of the account.`, + "Try increasing the nonce or find the latest nonce with `getTransactionCount`." + ].join(` +`), { cause: e, name: "NonceTooLowError" }); + } +} +Object.defineProperty(qm, "nodeMessage", { + enumerable: !0, + configurable: !0, + writable: !0, + value: /nonce too low|transaction already imported|already known/ +}); +class zm extends pt { + constructor({ cause: e, nonce: r } = {}) { + super(`Nonce provided for the transaction ${r ? `(${r}) ` : ""}exceeds the maximum allowed nonce.`, { cause: e, name: "NonceMaxValueError" }); + } +} +Object.defineProperty(zm, "nodeMessage", { + enumerable: !0, + configurable: !0, + writable: !0, + value: /nonce has max value/ +}); +class Hm extends pt { + constructor({ cause: e } = {}) { + super([ + "The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account." + ].join(` +`), { + cause: e, + metaMessages: [ + "This error could arise when the account does not have enough funds to:", + " - pay for the total gas fee,", + " - pay for the value to send.", + " ", + "The cost of the transaction is calculated as `gas * gas fee + value`, where:", + " - `gas` is the amount of gas needed for transaction to execute,", + " - `gas fee` is the gas fee,", + " - `value` is the amount of ether to send to the recipient." + ], + name: "InsufficientFundsError" + }); + } +} +Object.defineProperty(Hm, "nodeMessage", { + enumerable: !0, + configurable: !0, + writable: !0, + value: /insufficient funds|exceeds transaction sender account balance/ +}); +class Wm extends pt { + constructor({ cause: e, gas: r } = {}) { + super(`The amount of gas ${r ? `(${r}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`, { + cause: e, + name: "IntrinsicGasTooHighError" + }); + } +} +Object.defineProperty(Wm, "nodeMessage", { + enumerable: !0, + configurable: !0, + writable: !0, + value: /intrinsic gas too high|gas limit reached/ +}); +class Km extends pt { + constructor({ cause: e, gas: r } = {}) { + super(`The amount of gas ${r ? `(${r}) ` : ""}provided for the transaction is too low.`, { + cause: e, + name: "IntrinsicGasTooLowError" + }); + } +} +Object.defineProperty(Km, "nodeMessage", { + enumerable: !0, + configurable: !0, + writable: !0, + value: /intrinsic gas too low/ +}); +class Vm extends pt { + constructor({ cause: e }) { + super("The transaction type is not supported for this chain.", { + cause: e, + name: "TransactionTypeNotSupportedError" + }); + } +} +Object.defineProperty(Vm, "nodeMessage", { + enumerable: !0, + configurable: !0, + writable: !0, + value: /transaction type not valid/ +}); +class ld extends pt { + constructor({ cause: e, maxPriorityFeePerGas: r, maxFeePerGas: n } = {}) { + super([ + `The provided tip (\`maxPriorityFeePerGas\`${r ? ` = ${us(r)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n ? ` = ${us(n)} gwei` : ""}).` + ].join(` +`), { + cause: e, + name: "TipAboveFeeCapError" + }); + } +} +Object.defineProperty(ld, "nodeMessage", { + enumerable: !0, + configurable: !0, + writable: !0, + value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/ +}); +class o1 extends pt { + constructor({ cause: e }) { + super(`An error occurred while executing: ${e?.shortMessage}`, { + cause: e, + name: "UnknownNodeError" + }); + } +} +function M4(t, e) { + const r = (t.details || "").toLowerCase(), n = t instanceof pt ? t.walk((i) => i?.code === xc.code) : t; + return n instanceof pt ? new xc({ + cause: t, + message: n.details + }) : xc.nodeMessage.test(r) ? new xc({ + cause: t, + message: t.details + }) : fd.nodeMessage.test(r) ? new fd({ + cause: t, + maxFeePerGas: e?.maxFeePerGas + }) : jm.nodeMessage.test(r) ? new jm({ + cause: t, + maxFeePerGas: e?.maxFeePerGas + }) : Um.nodeMessage.test(r) ? new Um({ cause: t, nonce: e?.nonce }) : qm.nodeMessage.test(r) ? new qm({ cause: t, nonce: e?.nonce }) : zm.nodeMessage.test(r) ? new zm({ cause: t, nonce: e?.nonce }) : Hm.nodeMessage.test(r) ? new Hm({ cause: t }) : Wm.nodeMessage.test(r) ? new Wm({ cause: t, gas: e?.gas }) : Km.nodeMessage.test(r) ? new Km({ cause: t, gas: e?.gas }) : Vm.nodeMessage.test(r) ? new Vm({ cause: t }) : ld.nodeMessage.test(r) ? new ld({ + cause: t, + maxFeePerGas: e?.maxFeePerGas, + maxPriorityFeePerGas: e?.maxPriorityFeePerGas + }) : new o1({ + cause: t + }); +} +function mO(t, { docsPath: e, ...r }) { + const n = (() => { + const i = M4(t, r); + return i instanceof o1 ? t : i; + })(); + return new gO(n, { + docsPath: e, + ...r + }); +} +function I4(t, { format: e }) { + if (!e) + return {}; + const r = {}; + function n(s) { + const o = Object.keys(s); + for (const a of o) + a in t && (r[a] = t[a]), s[a] && typeof s[a] == "object" && !Array.isArray(s[a]) && n(s[a]); + } + const i = e(t || {}); + return n(i), r; +} +const vO = { + legacy: "0x0", + eip2930: "0x1", + eip1559: "0x2", + eip4844: "0x3", + eip7702: "0x4" +}; +function a1(t) { + const e = {}; + return typeof t.authorizationList < "u" && (e.authorizationList = bO(t.authorizationList)), typeof t.accessList < "u" && (e.accessList = t.accessList), typeof t.blobVersionedHashes < "u" && (e.blobVersionedHashes = t.blobVersionedHashes), typeof t.blobs < "u" && (typeof t.blobs[0] != "string" ? e.blobs = t.blobs.map((r) => di(r)) : e.blobs = t.blobs), typeof t.data < "u" && (e.data = t.data), typeof t.from < "u" && (e.from = t.from), typeof t.gas < "u" && (e.gas = br(t.gas)), typeof t.gasPrice < "u" && (e.gasPrice = br(t.gasPrice)), typeof t.maxFeePerBlobGas < "u" && (e.maxFeePerBlobGas = br(t.maxFeePerBlobGas)), typeof t.maxFeePerGas < "u" && (e.maxFeePerGas = br(t.maxFeePerGas)), typeof t.maxPriorityFeePerGas < "u" && (e.maxPriorityFeePerGas = br(t.maxPriorityFeePerGas)), typeof t.nonce < "u" && (e.nonce = br(t.nonce)), typeof t.to < "u" && (e.to = t.to), typeof t.type < "u" && (e.type = vO[t.type]), typeof t.value < "u" && (e.value = br(t.value)), e; +} +function bO(t) { + return t.map((e) => ({ + address: e.address, + r: e.r ? br(BigInt(e.r)) : e.r, + s: e.s ? br(BigInt(e.s)) : e.s, + chainId: br(e.chainId), + nonce: br(e.nonce), + ...typeof e.yParity < "u" ? { yParity: br(e.yParity) } : {}, + ...typeof e.v < "u" && typeof e.yParity > "u" ? { v: br(e.v) } : {} + })); +} +function Gw(t) { + if (!(!t || t.length === 0)) + return t.reduce((e, { slot: r, value: n }) => { + if (r.length !== 66) + throw new $w({ + size: r.length, + targetSize: 66, + type: "hex" + }); + if (n.length !== 66) + throw new $w({ + size: n.length, + targetSize: 66, + type: "hex" + }); + return e[r] = n, e; + }, {}); +} +function yO(t) { + const { balance: e, nonce: r, state: n, stateDiff: i, code: s } = t, o = {}; + if (s !== void 0 && (o.code = s), e !== void 0 && (o.balance = br(e)), r !== void 0 && (o.nonce = br(r)), n !== void 0 && (o.state = Gw(n)), i !== void 0) { + if (o.state) + throw new YD(); + o.stateDiff = Gw(i); + } + return o; +} +function wO(t) { + if (!t) + return; + const e = {}; + for (const { address: r, ...n } of t) { + if (!fs(r, { strict: !1 })) + throw new Ho({ address: r }); + if (e[r]) + throw new GD({ address: r }); + e[r] = yO(n); + } + return e; +} +const xO = 2n ** 256n - 1n; +function Wd(t) { + const { account: e, gasPrice: r, maxFeePerGas: n, maxPriorityFeePerGas: i, to: s } = t, o = e ? pi(e) : void 0; + if (o && !fs(o.address)) + throw new Ho({ address: o.address }); + if (s && !fs(s)) + throw new Ho({ address: s }); + if (typeof r < "u" && (typeof n < "u" || typeof i < "u")) + throw new JD(); + if (n && n > xO) + throw new fd({ maxFeePerGas: n }); + if (i && n && i > n) + throw new ld({ maxFeePerGas: n, maxPriorityFeePerGas: i }); +} +class _O extends pt { + constructor() { + super("`baseFeeMultiplier` must be greater than 1.", { + name: "BaseFeeScalarError" + }); + } +} +class c1 extends pt { + constructor() { + super("Chain does not support EIP-1559 fees.", { + name: "Eip1559FeesNotSupportedError" + }); + } +} +class EO extends pt { + constructor({ maxPriorityFeePerGas: e }) { + super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${us(e)} gwei).`, { name: "MaxFeePerGasTooLowError" }); + } +} +class SO extends pt { + constructor({ blockHash: e, blockNumber: r }) { + let n = "Block"; + e && (n = `Block at hash "${e}"`), r && (n = `Block at number "${r}"`), super(`${n} could not be found.`, { name: "BlockNotFoundError" }); + } +} +const AO = { + "0x0": "legacy", + "0x1": "eip2930", + "0x2": "eip1559", + "0x3": "eip4844", + "0x4": "eip7702" +}; +function PO(t) { + const e = { + ...t, + blockHash: t.blockHash ? t.blockHash : null, + blockNumber: t.blockNumber ? BigInt(t.blockNumber) : null, + chainId: t.chainId ? zo(t.chainId) : void 0, + gas: t.gas ? BigInt(t.gas) : void 0, + gasPrice: t.gasPrice ? BigInt(t.gasPrice) : void 0, + maxFeePerBlobGas: t.maxFeePerBlobGas ? BigInt(t.maxFeePerBlobGas) : void 0, + maxFeePerGas: t.maxFeePerGas ? BigInt(t.maxFeePerGas) : void 0, + maxPriorityFeePerGas: t.maxPriorityFeePerGas ? BigInt(t.maxPriorityFeePerGas) : void 0, + nonce: t.nonce ? zo(t.nonce) : void 0, + to: t.to ? t.to : null, + transactionIndex: t.transactionIndex ? Number(t.transactionIndex) : null, + type: t.type ? AO[t.type] : void 0, + typeHex: t.type ? t.type : void 0, + value: t.value ? BigInt(t.value) : void 0, + v: t.v ? BigInt(t.v) : void 0 + }; + return t.authorizationList && (e.authorizationList = MO(t.authorizationList)), e.yParity = (() => { + if (t.yParity) + return Number(t.yParity); + if (typeof e.v == "bigint") { + if (e.v === 0n || e.v === 27n) + return 0; + if (e.v === 1n || e.v === 28n) + return 1; + if (e.v >= 35n) + return e.v % 2n === 0n ? 1 : 0; + } + })(), e.type === "legacy" && (delete e.accessList, delete e.maxFeePerBlobGas, delete e.maxFeePerGas, delete e.maxPriorityFeePerGas, delete e.yParity), e.type === "eip2930" && (delete e.maxFeePerBlobGas, delete e.maxFeePerGas, delete e.maxPriorityFeePerGas), e.type === "eip1559" && delete e.maxFeePerBlobGas, e; +} +function MO(t) { + return t.map((e) => ({ + address: e.address, + chainId: Number(e.chainId), + nonce: Number(e.nonce), + r: e.r, + s: e.s, + yParity: Number(e.yParity) + })); +} +function IO(t) { + const e = (t.transactions ?? []).map((r) => typeof r == "string" ? r : PO(r)); + return { + ...t, + baseFeePerGas: t.baseFeePerGas ? BigInt(t.baseFeePerGas) : null, + blobGasUsed: t.blobGasUsed ? BigInt(t.blobGasUsed) : void 0, + difficulty: t.difficulty ? BigInt(t.difficulty) : void 0, + excessBlobGas: t.excessBlobGas ? BigInt(t.excessBlobGas) : void 0, + gasLimit: t.gasLimit ? BigInt(t.gasLimit) : void 0, + gasUsed: t.gasUsed ? BigInt(t.gasUsed) : void 0, + hash: t.hash ? t.hash : null, + logsBloom: t.logsBloom ? t.logsBloom : null, + nonce: t.nonce ? t.nonce : null, + number: t.number ? BigInt(t.number) : null, + size: t.size ? BigInt(t.size) : void 0, + timestamp: t.timestamp ? BigInt(t.timestamp) : void 0, + transactions: e, + totalDifficulty: t.totalDifficulty ? BigInt(t.totalDifficulty) : null + }; +} +async function hd(t, { blockHash: e, blockNumber: r, blockTag: n, includeTransactions: i } = {}) { + const s = n ?? "latest", o = i ?? !1, a = r !== void 0 ? br(r) : void 0; + let f = null; + if (e ? f = await t.request({ + method: "eth_getBlockByHash", + params: [e, o] + }, { dedupe: !0 }) : f = await t.request({ + method: "eth_getBlockByNumber", + params: [a || s, o] + }, { dedupe: !!a }), !f) + throw new SO({ blockHash: e, blockNumber: r }); + return (t.chain?.formatters?.block?.format || IO)(f); +} +async function C4(t) { + const e = await t.request({ + method: "eth_gasPrice" + }); + return BigInt(e); +} +async function CO(t, e) { + const { block: r, chain: n = t.chain, request: i } = e || {}; + try { + const s = n?.fees?.maxPriorityFeePerGas ?? n?.fees?.defaultPriorityFee; + if (typeof s == "function") { + const a = r || await Hn(t, hd, "getBlock")({}), f = await s({ + block: a, + client: t, + request: i + }); + if (f === null) + throw new Error(); + return f; + } + if (typeof s < "u") + return s; + const o = await t.request({ + method: "eth_maxPriorityFeePerGas" + }); + return qo(o); + } catch { + const [s, o] = await Promise.all([ + r ? Promise.resolve(r) : Hn(t, hd, "getBlock")({}), + Hn(t, C4, "getGasPrice")({}) + ]); + if (typeof s.baseFeePerGas != "bigint") + throw new c1(); + const a = o - s.baseFeePerGas; + return a < 0n ? 0n : a; + } +} +async function Yw(t, e) { + const { block: r, chain: n = t.chain, request: i, type: s = "eip1559" } = e || {}, o = await (async () => typeof n?.fees?.baseFeeMultiplier == "function" ? n.fees.baseFeeMultiplier({ + block: r, + client: t, + request: i + }) : n?.fees?.baseFeeMultiplier ?? 1.2)(); + if (o < 1) + throw new _O(); + const f = 10 ** (o.toString().split(".")[1]?.length ?? 0), u = (v) => v * BigInt(Math.ceil(o * f)) / BigInt(f), h = r || await Hn(t, hd, "getBlock")({}); + if (typeof n?.fees?.estimateFeesPerGas == "function") { + const v = await n.fees.estimateFeesPerGas({ + block: r, + client: t, + multiply: u, + request: i, + type: s + }); + if (v !== null) + return v; + } + if (s === "eip1559") { + if (typeof h.baseFeePerGas != "bigint") + throw new c1(); + const v = typeof i?.maxPriorityFeePerGas == "bigint" ? i.maxPriorityFeePerGas : await CO(t, { + block: h, + chain: n, + request: i + }), x = u(h.baseFeePerGas); + return { + maxFeePerGas: i?.maxFeePerGas ?? x + v, + maxPriorityFeePerGas: v + }; + } + return { + gasPrice: i?.gasPrice ?? u(await Hn(t, C4, "getGasPrice")({})) + }; +} +async function R4(t, { address: e, blockTag: r = "latest", blockNumber: n }) { + const i = await t.request({ + method: "eth_getTransactionCount", + params: [ + e, + typeof n == "bigint" ? br(n) : r + ] + }, { + dedupe: !!n + }); + return zo(i); +} +function T4(t) { + const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((s) => lo(s)) : t.blobs, i = []; + for (const s of n) + i.push(Uint8Array.from(e.blobToKzgCommitment(s))); + return r === "bytes" ? i : i.map((s) => di(s)); +} +function D4(t) { + const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((o) => lo(o)) : t.blobs, i = typeof t.commitments[0] == "string" ? t.commitments.map((o) => lo(o)) : t.commitments, s = []; + for (let o = 0; o < n.length; o++) { + const a = n[o], f = i[o]; + s.push(Uint8Array.from(e.computeBlobKzgProof(a, f))); + } + return r === "bytes" ? s : s.map((o) => di(o)); +} +function RO(t, e, r, n) { + if (typeof t.setBigUint64 == "function") + return t.setBigUint64(e, r, n); + const i = BigInt(32), s = BigInt(4294967295), o = Number(r >> i & s), a = Number(r & s), f = n ? 4 : 0, u = n ? 0 : 4; + t.setUint32(e + f, o, n), t.setUint32(e + u, a, n); +} +function TO(t, e, r) { + return t & e ^ ~t & r; +} +function DO(t, e, r) { + return t & e ^ t & r ^ e & r; +} +class OO extends n4 { + constructor(e, r, n, i) { + super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = e, this.outputLen = r, this.padOffset = n, this.isLE = i, this.buffer = new Uint8Array(e), this.view = Bp(this.buffer); + } + update(e) { + cd(this), e = Zv(e), Da(e); + const { view: r, buffer: n, blockLen: i } = this, s = e.length; + for (let o = 0; o < s; ) { + const a = Math.min(i - this.pos, s - o); + if (a === i) { + const f = Bp(e); + for (; i <= s - o; o += i) + this.process(f, o); + continue; + } + n.set(e.subarray(o, o + a), this.pos), this.pos += a, o += a, this.pos === i && (this.process(r, 0), this.pos = 0); + } + return this.length += e.length, this.roundClean(), this; + } + digestInto(e) { + cd(this), t4(e, this), this.finished = !0; + const { buffer: r, view: n, blockLen: i, isLE: s } = this; + let { pos: o } = this; + r[o++] = 128, hf(this.buffer.subarray(o)), this.padOffset > i - o && (this.process(n, 0), o = 0); + for (let g = o; g < i; g++) + r[g] = 0; + RO(n, i - 8, BigInt(this.length * 8), s), this.process(n, 0); + const a = Bp(e), f = this.outputLen; + if (f % 4) + throw new Error("_sha2: outputLen should be aligned to 32bit"); + const u = f / 4, h = this.get(); + if (u > h.length) + throw new Error("_sha2: outputLen bigger than state"); + for (let g = 0; g < u; g++) + a.setUint32(4 * g, h[g], s); + } + digest() { + const { buffer: e, outputLen: r } = this; + this.digestInto(e); + const n = e.slice(0, r); + return this.destroy(), n; + } + _cloneInto(e) { + e || (e = new this.constructor()), e.set(...this.get()); + const { blockLen: r, buffer: n, length: i, finished: s, destroyed: o, pos: a } = this; + return e.destroyed = o, e.finished = s, e.length = i, e.pos = a, i % r && e.buffer.set(n), e; + } + clone() { + return this._cloneInto(); + } +} +const Ao = /* @__PURE__ */ Uint32Array.from([ + 1779033703, + 3144134277, + 1013904242, + 2773480762, + 1359893119, + 2600822924, + 528734635, + 1541459225 +]), NO = /* @__PURE__ */ Uint32Array.from([ + 1116352408, + 1899447441, + 3049323471, + 3921009573, + 961987163, + 1508970993, + 2453635748, + 2870763221, + 3624381080, + 310598401, + 607225278, + 1426881987, + 1925078388, + 2162078206, + 2614888103, + 3248222580, + 3835390401, + 4022224774, + 264347078, + 604807628, + 770255983, + 1249150122, + 1555081692, + 1996064986, + 2554220882, + 2821834349, + 2952996808, + 3210313671, + 3336571891, + 3584528711, + 113926993, + 338241895, + 666307205, + 773529912, + 1294757372, + 1396182291, + 1695183700, + 1986661051, + 2177026350, + 2456956037, + 2730485921, + 2820302411, + 3259730800, + 3345764771, + 3516065817, + 3600352804, + 4094571909, + 275423344, + 430227734, + 506948616, + 659060556, + 883997877, + 958139571, + 1322822218, + 1537002063, + 1747873779, + 1955562222, + 2024104815, + 2227730452, + 2361852424, + 2428436474, + 2756734187, + 3204031479, + 3329325298 +]), Po = /* @__PURE__ */ new Uint32Array(64); +class LO extends OO { + constructor(e = 32) { + super(64, e, 8, !1), this.A = Ao[0] | 0, this.B = Ao[1] | 0, this.C = Ao[2] | 0, this.D = Ao[3] | 0, this.E = Ao[4] | 0, this.F = Ao[5] | 0, this.G = Ao[6] | 0, this.H = Ao[7] | 0; + } + get() { + const { A: e, B: r, C: n, D: i, E: s, F: o, G: a, H: f } = this; + return [e, r, n, i, s, o, a, f]; + } + // prettier-ignore + set(e, r, n, i, s, o, a, f) { + this.A = e | 0, this.B = r | 0, this.C = n | 0, this.D = i | 0, this.E = s | 0, this.F = o | 0, this.G = a | 0, this.H = f | 0; + } + process(e, r) { + for (let g = 0; g < 16; g++, r += 4) + Po[g] = e.getUint32(r, !1); + for (let g = 16; g < 64; g++) { + const v = Po[g - 15], x = Po[g - 2], S = ws(v, 7) ^ ws(v, 18) ^ v >>> 3, C = ws(x, 17) ^ ws(x, 19) ^ x >>> 10; + Po[g] = C + Po[g - 7] + S + Po[g - 16] | 0; + } + let { A: n, B: i, C: s, D: o, E: a, F: f, G: u, H: h } = this; + for (let g = 0; g < 64; g++) { + const v = ws(a, 6) ^ ws(a, 11) ^ ws(a, 25), x = h + v + TO(a, f, u) + NO[g] + Po[g] | 0, C = (ws(n, 2) ^ ws(n, 13) ^ ws(n, 22)) + DO(n, i, s) | 0; + h = u, u = f, f = a, a = o + x | 0, o = s, s = i, i = n, n = x + C | 0; + } + n = n + this.A | 0, i = i + this.B | 0, s = s + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, f = f + this.F | 0, u = u + this.G | 0, h = h + this.H | 0, this.set(n, i, s, o, a, f, u, h); + } + roundClean() { + hf(Po); + } + destroy() { + this.set(0, 0, 0, 0, 0, 0, 0, 0), hf(this.buffer); + } +} +const kO = /* @__PURE__ */ i4(() => new LO()), O4 = kO; +function $O(t, e) { + return O4(Uo(t, { strict: !1 }) ? Xv(t) : t); +} +function BO(t) { + const { commitment: e, version: r = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), i = $O(e); + return i.set([r], 0), n === "bytes" ? i : di(i); +} +function FO(t) { + const { commitments: e, version: r } = t, n = t.to, i = []; + for (const s of e) + i.push(BO({ + commitment: s, + to: n, + version: r + })); + return i; +} +const Jw = 6, N4 = 32, u1 = 4096, L4 = N4 * u1, Xw = L4 * Jw - // terminator byte (0x80). +1 - // zero byte (0x00) appended to each field element. +1 * u1 * Jw; +class jO extends pt { + constructor({ maxSize: e, size: r }) { + super("Blob size is too large.", { + metaMessages: [`Max: ${e} bytes`, `Given: ${r} bytes`], + name: "BlobSizeTooLargeError" + }); + } +} +class UO extends pt { + constructor() { + super("Blob data must not be empty.", { name: "EmptyBlobError" }); + } +} +function qO(t) { + const e = typeof t.data == "string" ? lo(t.data) : t.data, r = yn(e); + if (!r) + throw new UO(); + if (r > Xw) + throw new jO({ + maxSize: Xw, + size: r + }); + const n = []; + let i = !0, s = 0; + for (; i; ) { + const o = s1(new Uint8Array(L4)); + let a = 0; + for (; a < u1; ) { + const f = e.slice(s, s + (N4 - 1)); + if (o.pushByte(0), o.pushBytes(f), f.length < 31) { + o.pushByte(128), i = !1; + break; + } + a++, s += 31; + } + n.push(o); + } + return n.map((o) => di(o.bytes)); +} +function zO(t) { + const { data: e, kzg: r, to: n } = t, i = t.blobs ?? qO({ data: e }), s = t.commitments ?? T4({ blobs: i, kzg: r, to: n }), o = t.proofs ?? D4({ blobs: i, commitments: s, kzg: r, to: n }), a = []; + for (let f = 0; f < i.length; f++) + a.push({ + blob: i[f], + commitment: s[f], + proof: o[f] + }); + return a; +} +function HO(t) { + if (t.type) + return t.type; + if (typeof t.authorizationList < "u") + return "eip7702"; + if (typeof t.blobs < "u" || typeof t.blobVersionedHashes < "u" || typeof t.maxFeePerBlobGas < "u" || typeof t.sidecars < "u") + return "eip4844"; + if (typeof t.maxFeePerGas < "u" || typeof t.maxPriorityFeePerGas < "u") + return "eip1559"; + if (typeof t.gasPrice < "u") + return typeof t.accessList < "u" ? "eip2930" : "legacy"; + throw new XD({ transaction: t }); +} +async function Gf(t) { + const e = await t.request({ + method: "eth_chainId" + }, { dedupe: !0 }); + return zo(e); +} +const k4 = [ + "blobVersionedHashes", + "chainId", + "fees", + "gas", + "nonce", + "type" +], Zw = /* @__PURE__ */ new Map(); +async function f1(t, e) { + const { account: r = t.account, blobs: n, chain: i, gas: s, kzg: o, nonce: a, nonceManager: f, parameters: u = k4, type: h } = e, g = r && pi(r), v = { ...e, ...g ? { from: g?.address } : {} }; + let x; + async function S() { + return x || (x = await Hn(t, hd, "getBlock")({ blockTag: "latest" }), x); + } + let C; + async function D() { + return C || (i ? i.id : typeof e.chainId < "u" ? e.chainId : (C = await Hn(t, Gf, "getChainId")({}), C)); + } + if (u.includes("nonce") && typeof a > "u" && g) + if (f) { + const $ = await D(); + v.nonce = await f.consume({ + address: g.address, + chainId: $, + client: t + }); + } else + v.nonce = await Hn(t, R4, "getTransactionCount")({ + address: g.address, + blockTag: "pending" + }); + if ((u.includes("blobVersionedHashes") || u.includes("sidecars")) && n && o) { + const $ = T4({ blobs: n, kzg: o }); + if (u.includes("blobVersionedHashes")) { + const N = FO({ + commitments: $, + to: "hex" + }); + v.blobVersionedHashes = N; + } + if (u.includes("sidecars")) { + const N = D4({ blobs: n, commitments: $, kzg: o }), z = zO({ + blobs: n, + commitments: $, + proofs: N, + to: "hex" + }); + v.sidecars = z; + } + } + if (u.includes("chainId") && (v.chainId = await D()), (u.includes("fees") || u.includes("type")) && typeof h > "u") + try { + v.type = HO(v); + } catch { + let $ = Zw.get(t.uid); + typeof $ > "u" && ($ = typeof (await S())?.baseFeePerGas == "bigint", Zw.set(t.uid, $)), v.type = $ ? "eip1559" : "legacy"; + } + if (u.includes("fees")) + if (v.type !== "legacy" && v.type !== "eip2930") { + if (typeof v.maxFeePerGas > "u" || typeof v.maxPriorityFeePerGas > "u") { + const $ = await S(), { maxFeePerGas: N, maxPriorityFeePerGas: z } = await Yw(t, { + block: $, + chain: i, + request: v + }); + if (typeof e.maxPriorityFeePerGas > "u" && e.maxFeePerGas && e.maxFeePerGas < z) + throw new EO({ + maxPriorityFeePerGas: z + }); + v.maxPriorityFeePerGas = z, v.maxFeePerGas = N; + } + } else { + if (typeof e.maxFeePerGas < "u" || typeof e.maxPriorityFeePerGas < "u") + throw new c1(); + if (typeof e.gasPrice > "u") { + const $ = await S(), { gasPrice: N } = await Yw(t, { + block: $, + chain: i, + request: v, + type: "legacy" + }); + v.gasPrice = N; + } + } + return u.includes("gas") && typeof s > "u" && (v.gas = await Hn(t, KO, "estimateGas")({ + ...v, + account: g && { address: g.address, type: "json-rpc" } + })), Wd(v), delete v.parameters, v; +} +async function WO(t, { address: e, blockNumber: r, blockTag: n = "latest" }) { + const i = typeof r == "bigint" ? br(r) : void 0, s = await t.request({ + method: "eth_getBalance", + params: [e, i || n] + }); + return BigInt(s); +} +async function KO(t, e) { + const { account: r = t.account } = e, n = r ? pi(r) : void 0; + try { + let K = function(b) { + const { block: l, request: p, rpcStateOverride: m } = b; + return t.request({ + method: "eth_estimateGas", + params: m ? [p, l ?? "latest", m] : l ? [p, l] : [p] + }); + }; + const { accessList: i, authorizationList: s, blobs: o, blobVersionedHashes: a, blockNumber: f, blockTag: u, data: h, gas: g, gasPrice: v, maxFeePerBlobGas: x, maxFeePerGas: S, maxPriorityFeePerGas: C, nonce: D, value: $, stateOverride: N, ...z } = await f1(t, { + ...e, + parameters: ( + // Some RPC Providers do not compute versioned hashes from blobs. We will need + // to compute them. + n?.type === "local" ? void 0 : ["blobVersionedHashes"] + ) + }), B = (typeof f == "bigint" ? br(f) : void 0) || u, U = wO(N), R = await (async () => { + if (z.to) + return z.to; + if (s && s.length > 0) + return await P4({ + authorization: s[0] + }).catch(() => { + throw new pt("`to` is required. Could not infer from `authorizationList`"); + }); + })(); + Wd(e); + const W = t.chain?.formatters?.transactionRequest?.format, ne = (W || a1)({ + // Pick out extra data that might exist on the chain's transaction request type. + ...I4(z, { format: W }), + from: n?.address, + accessList: i, + authorizationList: s, + blobs: o, + blobVersionedHashes: a, + data: h, + gas: g, + gasPrice: v, + maxFeePerBlobGas: x, + maxFeePerGas: S, + maxPriorityFeePerGas: C, + nonce: D, + to: R, + value: $ + }); + let E = BigInt(await K({ block: B, request: ne, rpcStateOverride: U })); + if (s) { + const b = await WO(t, { address: ne.from }), l = await Promise.all(s.map(async (p) => { + const { address: m } = p, w = await K({ + block: B, + request: { + authorizationList: void 0, + data: h, + from: n?.address, + to: m, + value: br(b) + }, + rpcStateOverride: U + }).catch(() => 100000n); + return 2n * BigInt(w); + })); + E += l.reduce((p, m) => p + m, 0n); + } + return E; + } catch (i) { + throw mO(i, { + ...e, + account: n, + chain: t.chain + }); + } +} +function VO(t, e) { + if (!fs(t, { strict: !1 })) + throw new Ho({ address: t }); + if (!fs(e, { strict: !1 })) + throw new Ho({ address: e }); + return t.toLowerCase() === e.toLowerCase(); +} +class GO extends pt { + constructor({ chain: e, currentChainId: r }) { + super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`, { + metaMessages: [ + `Current Chain ID: ${r}`, + `Expected Chain ID: ${e.id} – ${e.name}` + ], + name: "ChainMismatchError" + }); + } +} +class YO extends pt { + constructor() { + super([ + "No chain was provided to the request.", + "Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient." + ].join(` +`), { + name: "ChainNotFoundError" + }); + } +} +const Up = "/docs/contract/encodeDeployData"; +function JO(t) { + const { abi: e, args: r, bytecode: n } = t; + if (!r || r.length === 0) + return n; + const i = e.find((o) => "type" in o && o.type === "constructor"); + if (!i) + throw new _T({ docsPath: Up }); + if (!("inputs" in i)) + throw new Lw({ docsPath: Up }); + if (!i.inputs || i.inputs.length === 0) + throw new Lw({ docsPath: Up }); + const s = p4(i.inputs, r); + return zd([n, s]); +} +function XO() { + let t = () => { + }, e = () => { + }; + return { promise: new Promise((n, i) => { + t = n, e = i; + }), resolve: t, reject: e }; +} +const qp = /* @__PURE__ */ new Map(), Qw = /* @__PURE__ */ new Map(); +let ZO = 0; +function QO(t, e, r) { + const n = ++ZO, i = () => qp.get(t) || [], s = () => { + const h = i(); + qp.set(t, h.filter((g) => g.id !== n)); + }, o = () => { + const h = i(); + if (!h.some((v) => v.id === n)) + return; + const g = Qw.get(t); + if (h.length === 1 && g) { + const v = g(); + v instanceof Promise && v.catch(() => { + }); + } + s(); + }, a = i(); + if (qp.set(t, [ + ...a, + { id: n, fns: e } + ]), a && a.length > 0) + return o; + const f = {}; + for (const h in e) + f[h] = ((...g) => { + const v = i(); + if (v.length !== 0) + for (const x of v) + x.fns[h]?.(...g); + }); + const u = r(f); + return typeof u == "function" && Qw.set(t, u), o; +} +async function Gm(t) { + return new Promise((e) => setTimeout(e, t)); +} +function eN(t, { emitOnBegin: e, initialWaitTime: r, interval: n }) { + let i = !0; + const s = () => i = !1; + return (async () => { + let a; + a = await t({ unpoll: s }); + const f = await r?.(a) ?? n; + await Gm(f); + const u = async () => { + i && (await t({ unpoll: s }), await Gm(n), u()); + }; + u(); + })(), s; +} +class qa extends pt { + constructor({ docsPath: e } = {}) { + super([ + "Could not find an Account to execute with this Action.", + "Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client." + ].join(` +`), { + docsPath: e, + docsSlug: "account", + name: "AccountNotFoundError" + }); + } +} +class Nh extends pt { + constructor({ docsPath: e, metaMessages: r, type: n }) { + super(`Account type "${n}" is not supported.`, { + docsPath: e, + metaMessages: r, + name: "AccountTypeNotSupportedError" + }); + } +} +function $4({ chain: t, currentChainId: e }) { + if (!t) + throw new YO(); + if (e !== t.id) + throw new GO({ chain: t, currentChainId: e }); +} +function B4(t, { docsPath: e, ...r }) { + const n = (() => { + const i = M4(t, r); + return i instanceof o1 ? t : i; + })(); + return new ZD(n, { + docsPath: e, + ...r + }); +} +async function F4(t, { serializedTransaction: e }) { + return t.request({ + method: "eth_sendRawTransaction", + params: [e] + }, { retryCount: 0 }); +} +const zp = new qd(128); +async function Kd(t, e) { + const { account: r = t.account, chain: n = t.chain, accessList: i, authorizationList: s, blobs: o, data: a, gas: f, gasPrice: u, maxFeePerBlobGas: h, maxFeePerGas: g, maxPriorityFeePerGas: v, nonce: x, type: S, value: C, ...D } = e; + if (typeof r > "u") + throw new qa({ + docsPath: "/docs/actions/wallet/sendTransaction" + }); + const $ = r ? pi(r) : null; + try { + Wd(e); + const N = await (async () => { + if (e.to) + return e.to; + if (e.to !== null && s && s.length > 0) + return await P4({ + authorization: s[0] + }).catch(() => { + throw new pt("`to` is required. Could not infer from `authorizationList`."); + }); + })(); + if ($?.type === "json-rpc" || $ === null) { + let z; + n !== null && (z = await Hn(t, Gf, "getChainId")({}), $4({ + currentChainId: z, + chain: n + })); + const k = t.chain?.formatters?.transactionRequest?.format, U = (k || a1)({ + // Pick out extra data that might exist on the chain's transaction request type. + ...I4(D, { format: k }), + accessList: i, + authorizationList: s, + blobs: o, + chainId: z, + data: a, + from: $?.address, + gas: f, + gasPrice: u, + maxFeePerBlobGas: h, + maxFeePerGas: g, + maxPriorityFeePerGas: v, + nonce: x, + to: N, + type: S, + value: C + }), R = zp.get(t.uid), W = R ? "wallet_sendTransaction" : "eth_sendTransaction"; + try { + return await t.request({ + method: W, + params: [U] + }, { retryCount: 0 }); + } catch (J) { + if (R === !1) + throw J; + const ne = J; + if (ne.name === "InvalidInputRpcError" || ne.name === "InvalidParamsRpcError" || ne.name === "MethodNotFoundRpcError" || ne.name === "MethodNotSupportedRpcError") + return await t.request({ + method: "wallet_sendTransaction", + params: [U] + }, { retryCount: 0 }).then((K) => (zp.set(t.uid, !0), K)).catch((K) => { + const E = K; + throw E.name === "MethodNotFoundRpcError" || E.name === "MethodNotSupportedRpcError" ? (zp.set(t.uid, !1), ne) : E; + }); + throw ne; + } + } + if ($?.type === "local") { + const z = await Hn(t, f1, "prepareTransactionRequest")({ + account: $, + accessList: i, + authorizationList: s, + blobs: o, + chain: n, + data: a, + gas: f, + gasPrice: u, + maxFeePerBlobGas: h, + maxFeePerGas: g, + maxPriorityFeePerGas: v, + nonce: x, + nonceManager: $.nonceManager, + parameters: [...k4, "sidecars"], + type: S, + value: C, + ...D, + to: N + }), k = n?.serializers?.transaction, B = await $.signTransaction(z, { + serializer: k + }); + return await Hn(t, F4, "sendRawTransaction")({ + serializedTransaction: B + }); + } + throw $?.type === "smart" ? new Nh({ + metaMessages: [ + "Consider using the `sendUserOperation` Action instead." + ], + docsPath: "/docs/actions/bundler/sendUserOperation", + type: "smart" + }) : new Nh({ + docsPath: "/docs/actions/wallet/sendTransaction", + type: $?.type + }); + } catch (N) { + throw N instanceof Nh ? N : B4(N, { + ...e, + account: $, + chain: e.chain || void 0 + }); + } +} +async function tN(t, e) { + const { abi: r, account: n = t.account, address: i, args: s, dataSuffix: o, functionName: a, ...f } = e; + if (typeof n > "u") + throw new qa({ + docsPath: "/docs/contract/writeContract" + }); + const u = n ? pi(n) : null, h = v4({ + abi: r, + args: s, + functionName: a + }); + try { + return await Hn(t, Kd, "sendTransaction")({ + data: `${h}${o ? o.replace("0x", "") : ""}`, + to: i, + account: u, + ...f + }); + } catch (g) { + throw aO(g, { + abi: r, + address: i, + args: s, + docsPath: "/docs/contract/writeContract", + functionName: a, + sender: u?.address + }); + } +} +const rN = { + "0x0": "reverted", + "0x1": "success" +}, j4 = "0x5792579257925792579257925792579257925792579257925792579257925792", U4 = br(0, { + size: 32 +}); +async function nN(t, e) { + const { account: r = t.account, capabilities: n, chain: i = t.chain, experimental_fallback: s, experimental_fallbackDelay: o = 32, forceAtomic: a = !1, id: f, version: u = "2.0.0" } = e, h = r ? pi(r) : null, g = e.calls.map((v) => { + const x = v, S = x.abi ? v4({ + abi: x.abi, + functionName: x.functionName, + args: x.args + }) : x.data; + return { + data: x.dataSuffix && S ? Wo([S, x.dataSuffix]) : S, + to: x.to, + value: x.value ? br(x.value) : void 0 + }; + }); + try { + const v = await t.request({ + method: "wallet_sendCalls", + params: [ + { + atomicRequired: a, + calls: g, + capabilities: n, + chainId: br(i.id), + from: h?.address, + id: f, + version: u + } + ] + }, { retryCount: 0 }); + return typeof v == "string" ? { id: v } : v; + } catch (v) { + const x = v; + if (s && (x.name === "MethodNotFoundRpcError" || x.name === "MethodNotSupportedRpcError" || x.name === "UnknownRpcError" || x.details.toLowerCase().includes("does not exist / is not available") || x.details.toLowerCase().includes("missing or invalid. request()") || x.details.toLowerCase().includes("did not match any variant of untagged enum") || x.details.toLowerCase().includes("account upgraded to unsupported contract") || x.details.toLowerCase().includes("eip-7702 not supported") || x.details.toLowerCase().includes("unsupported wc_ method"))) { + if (n && Object.values(n).some((N) => !N.optional)) { + const N = "non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`."; + throw new jc(new pt(N, { + details: N + })); + } + if (a && g.length > 1) { + const $ = "`forceAtomic` is not supported on fallback to `eth_sendTransaction`."; + throw new Uc(new pt($, { + details: $ + })); + } + const S = []; + for (const $ of g) { + const N = Kd(t, { + account: h, + chain: i, + data: $.data, + to: $.to, + value: $.value ? qo($.value) : void 0 + }); + S.push(N), o > 0 && await new Promise((z) => setTimeout(z, o)); + } + const C = await Promise.allSettled(S); + if (C.every(($) => $.status === "rejected")) + throw C[0].reason; + const D = C.map(($) => $.status === "fulfilled" ? $.value : U4); + return { + id: Wo([ + ...D, + br(i.id, { size: 32 }), + j4 + ]) + }; + } + throw B4(v, { + ...e, + account: h, + chain: e.chain + }); + } +} +async function q4(t, e) { + async function r(h) { + if (h.endsWith(j4.slice(2))) { + const v = Fd($m(h, -64, -32)), x = $m(h, 0, -64).slice(2).match(/.{1,64}/g), S = await Promise.all(x.map((D) => U4.slice(2) !== D ? t.request({ + method: "eth_getTransactionReceipt", + params: [`0x${D}`] + }, { dedupe: !0 }) : void 0)), C = S.some((D) => D === null) ? 100 : S.every((D) => D?.status === "0x1") ? 200 : S.every((D) => D?.status === "0x0") ? 500 : 600; + return { + atomic: !1, + chainId: zo(v), + receipts: S.filter(Boolean), + status: C, + version: "2.0.0" + }; + } + return t.request({ + method: "wallet_getCallsStatus", + params: [h] + }); + } + const { atomic: n = !1, chainId: i, receipts: s, version: o = "2.0.0", ...a } = await r(e.id), [f, u] = (() => { + const h = a.status; + return h >= 100 && h < 200 ? ["pending", h] : h >= 200 && h < 300 ? ["success", h] : h >= 300 && h < 700 ? ["failure", h] : h === "CONFIRMED" ? ["success", 200] : h === "PENDING" ? ["pending", 100] : [void 0, h]; + })(); + return { + ...a, + atomic: n, + // @ts-expect-error: for backwards compatibility + chainId: i ? zo(i) : void 0, + receipts: s?.map((h) => ({ + ...h, + blockNumber: qo(h.blockNumber), + gasUsed: qo(h.gasUsed), + status: rN[h.status] + })) ?? [], + statusCode: u, + status: f, + version: o + }; +} +async function iN(t, e) { + const { id: r, pollingInterval: n = t.pollingInterval, status: i = ({ statusCode: v }) => v >= 200, timeout: s = 6e4 } = e, o = Ua(["waitForCallsStatus", t.uid, r]), { promise: a, resolve: f, reject: u } = XO(); + let h; + const g = QO(o, { resolve: f, reject: u }, (v) => { + const x = eN(async () => { + const S = (C) => { + clearTimeout(h), x(), C(), g(); + }; + try { + const C = await q4(t, { id: r }); + if (!i(C)) + return; + S(() => v.resolve(C)); + } catch (C) { + S(() => v.reject(C)); + } + }, { + interval: n, + emitOnBegin: !0 + }); + return x; + }); + return h = s ? setTimeout(() => { + g(), clearTimeout(h), u(new sN({ id: r })); + }, s) : void 0, await a; +} +class sN extends pt { + constructor({ id: e }) { + super(`Timed out while waiting for call bundle with id "${e}" to be confirmed.`, { name: "WaitForCallsStatusTimeoutError" }); + } +} +const Ym = 256; +let fh = Ym, lh; +function z4(t = 11) { + if (!lh || fh + t > Ym * 2) { + lh = "", fh = 0; + for (let e = 0; e < Ym; e++) + lh += (256 + Math.random() * 256 | 0).toString(16).substring(1); + } + return lh.substring(fh, fh++ + t); +} +function oN(t) { + const { batch: e, chain: r, ccipRead: n, key: i = "base", name: s = "Base Client", type: o = "base" } = t, a = r?.blockTime ?? 12e3, f = Math.min(Math.max(Math.floor(a / 2), 500), 4e3), u = t.pollingInterval ?? f, h = t.cacheTime ?? u, g = t.account ? pi(t.account) : void 0, { config: v, request: x, value: S } = t.transport({ + chain: r, + pollingInterval: u + }), C = { ...v, ...S }, D = { + account: g, + batch: e, + cacheTime: h, + ccipRead: n, + chain: r, + key: i, + name: s, + pollingInterval: u, + request: x, + transport: C, + type: o, + uid: z4() + }; + function $(N) { + return (z) => { + const k = z(N); + for (const U in D) + delete k[U]; + const B = { ...N, ...k }; + return Object.assign(B, { extend: $(B) }); + }; + } + return Object.assign(D, { extend: $(D) }); +} +const hh = /* @__PURE__ */ new qd(8192); +function aN(t, { enabled: e = !0, id: r }) { + if (!e || !r) + return t(); + if (hh.get(r)) + return hh.get(r); + const n = t().finally(() => hh.delete(r)); + return hh.set(r, n), n; +} +function cN(t, { delay: e = 100, retryCount: r = 2, shouldRetry: n = () => !0 } = {}) { + return new Promise((i, s) => { + const o = async ({ count: a = 0 } = {}) => { + const f = async ({ error: u }) => { + const h = typeof e == "function" ? e({ count: a, error: u }) : e; + h && await Gm(h), o({ count: a + 1 }); + }; + try { + const u = await t(); + i(u); + } catch (u) { + if (a < r && await n({ count: a, error: u })) + return f({ error: u }); + s(u); + } + }; + o(); + }); +} +function uN(t, e = {}) { + return async (r, n = {}) => { + const { dedupe: i = !1, methods: s, retryDelay: o = 150, retryCount: a = 3, uid: f } = { + ...e, + ...n + }, { method: u } = r; + if (s?.exclude?.includes(u)) + throw new Aa(new Error("method not supported"), { + method: u + }); + if (s?.include && !s.include.includes(u)) + throw new Aa(new Error("method not supported"), { + method: u + }); + const h = i ? jd(`${f}.${Ua(r)}`) : void 0; + return aN(() => cN(async () => { + try { + return await t(r); + } catch (g) { + const v = g; + switch (v.code) { + // -32700 + case pf.code: + throw new pf(v); + // -32600 + case gf.code: + throw new gf(v); + // -32601 + case mf.code: + throw new mf(v, { method: r.method }); + // -32602 + case vf.code: + throw new vf(v); + // -32603 + case Oa.code: + throw new Oa(v); + // -32000 + case bf.code: + throw new bf(v); + // -32001 + case yf.code: + throw new yf(v); + // -32002 + case wf.code: + throw new wf(v); + // -32003 + case xf.code: + throw new xf(v); + // -32004 + case Aa.code: + throw new Aa(v, { + method: r.method + }); + // -32005 + case Fc.code: + throw new Fc(v); + // -32006 + case _f.code: + throw new _f(v); + // 4001 + case Rc.code: + throw new Rc(v); + // 4100 + case Ef.code: + throw new Ef(v); + // 4200 + case Sf.code: + throw new Sf(v); + // 4900 + case Af.code: + throw new Af(v); + // 4901 + case Pf.code: + throw new Pf(v); + // 4902 + case Mf.code: + throw new Mf(v); + // 5700 + case jc.code: + throw new jc(v); + // 5710 + case If.code: + throw new If(v); + // 5720 + case Cf.code: + throw new Cf(v); + // 5730 + case Rf.code: + throw new Rf(v); + // 5740 + case Tf.code: + throw new Tf(v); + // 5750 + case Df.code: + throw new Df(v); + // 5760 + case Uc.code: + throw new Uc(v); + // CAIP-25: User Rejected Error + // https://docs.walletconnect.com/2.0/specs/clients/sign/error-codes#rejected-caip-25 + case 5e3: + throw new Rc(v); + default: + throw g instanceof pt ? g : new sO(v); + } + } + }, { + delay: ({ count: g, error: v }) => { + if (v && v instanceof _4) { + const x = v?.headers?.get("Retry-After"); + if (x?.match(/\d/)) + return Number.parseInt(x) * 1e3; + } + return ~~(1 << g) * o; + }, + retryCount: a, + shouldRetry: ({ error: g }) => fN(g) + }), { enabled: i, id: h }); + }; +} +function fN(t) { + return "code" in t && typeof t.code == "number" ? t.code === -1 || t.code === Fc.code || t.code === Oa.code : t instanceof _4 && t.status ? t.status === 403 || t.status === 408 || t.status === 413 || t.status === 429 || t.status === 500 || t.status === 502 || t.status === 503 || t.status === 504 : !0; +} +function lN({ key: t, methods: e, name: r, request: n, retryCount: i = 3, retryDelay: s = 150, timeout: o, type: a }, f) { + const u = z4(); + return { + config: { + key: t, + methods: e, + name: r, + request: n, + retryCount: i, + retryDelay: s, + timeout: o, + type: a + }, + request: uN(n, { methods: e, retryCount: i, retryDelay: s, uid: u }), + value: f + }; +} +function dh(t, e = {}) { + const { key: r = "custom", methods: n, name: i = "Custom Provider", retryDelay: s } = e; + return ({ retryCount: o }) => lN({ + key: r, + methods: n, + name: i, + request: t.request.bind(t), + retryCount: e.retryCount ?? o, + retryDelay: s, + type: "custom" + }); +} +function hN(t) { + return { + formatters: void 0, + fees: void 0, + serializers: void 0, + ...t + }; +} +class dN extends pt { + constructor({ domain: e }) { + super(`Invalid domain "${Ua(e)}".`, { + metaMessages: ["Must be a valid EIP-712 domain."] + }); + } +} +class pN extends pt { + constructor({ primaryType: e, types: r }) { + super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`, { + docsPath: "/api/glossary/Errors#typeddatainvalidprimarytypeerror", + metaMessages: ["Check that the primary type is a key in `types`."] + }); + } +} +class gN extends pt { + constructor({ type: e }) { + super(`Struct type "${e}" is invalid.`, { + metaMessages: ["Struct type must not be a Solidity type."], + name: "InvalidStructTypeError" + }); + } +} +function mN(t) { + const { domain: e, message: r, primaryType: n, types: i } = t, s = (f, u) => { + const h = { ...u }; + for (const g of f) { + const { name: v, type: x } = g; + x === "address" && (h[v] = h[v].toLowerCase()); + } + return h; + }, o = i.EIP712Domain ? e ? s(i.EIP712Domain, e) : {} : {}, a = (() => { + if (n !== "EIP712Domain") + return s(i[n], r); + })(); + return Ua({ domain: o, message: a, primaryType: n, types: i }); +} +function vN(t) { + const { domain: e, message: r, primaryType: n, types: i } = t, s = (o, a) => { + for (const f of o) { + const { name: u, type: h } = f, g = a[u], v = h.match(d4); + if (v && (typeof g == "number" || typeof g == "bigint")) { + const [C, D, $] = v; + br(g, { + signed: D === "int", + size: Number.parseInt($) / 8 + }); + } + if (h === "address" && typeof g == "string" && !fs(g)) + throw new Ho({ address: g }); + const x = h.match(bD); + if (x) { + const [C, D] = x; + if (D && yn(g) !== Number.parseInt(D)) + throw new IT({ + expectedSize: Number.parseInt(D), + givenSize: yn(g) + }); + } + const S = i[h]; + S && (yN(h), s(S, g)); + } + }; + if (i.EIP712Domain && e) { + if (typeof e != "object") + throw new dN({ domain: e }); + s(i.EIP712Domain, e); + } + if (n !== "EIP712Domain") + if (i[n]) + s(i[n], r); + else + throw new pN({ primaryType: n, types: i }); +} +function bN({ domain: t }) { + return [ + typeof t?.name == "string" && { name: "name", type: "string" }, + t?.version && { name: "version", type: "string" }, + (typeof t?.chainId == "number" || typeof t?.chainId == "bigint") && { + name: "chainId", + type: "uint256" + }, + t?.verifyingContract && { + name: "verifyingContract", + type: "address" + }, + t?.salt && { name: "salt", type: "bytes32" } + ].filter(Boolean); +} +function yN(t) { + if (t === "address" || t === "bool" || t === "string" || t.startsWith("bytes") || t.startsWith("uint") || t.startsWith("int")) + throw new gN({ type: t }); +} +async function wN(t, { chain: e }) { + const { id: r, name: n, nativeCurrency: i, rpcUrls: s, blockExplorers: o } = e; + await t.request({ + method: "wallet_addEthereumChain", + params: [ + { + chainId: br(r), + chainName: n, + nativeCurrency: i, + rpcUrls: s.default.http, + blockExplorerUrls: o ? Object.values(o).map(({ url: a }) => a) : void 0 + } + ] + }, { dedupe: !0, retryCount: 0 }); +} +function xN(t, e) { + const { abi: r, args: n, bytecode: i, ...s } = e, o = JO({ abi: r, args: n, bytecode: i }); + return Kd(t, { + ...s, + ...s.authorizationList ? { to: null } : {}, + data: o + }); +} +async function _N(t) { + return t.account?.type === "local" ? [t.account.address] : (await t.request({ method: "eth_accounts" }, { dedupe: !0 })).map((r) => Vf(r)); +} +async function EN(t, e = {}) { + const { account: r = t.account, chainId: n } = e, i = r ? pi(r) : void 0, s = n ? [i?.address, [br(n)]] : [i?.address], o = await t.request({ + method: "wallet_getCapabilities", + params: s + }), a = {}; + for (const [f, u] of Object.entries(o)) { + a[Number(f)] = {}; + for (let [h, g] of Object.entries(u)) + h === "addSubAccount" && (h = "unstable_addSubAccount"), a[Number(f)][h] = g; + } + return typeof n == "number" ? a[n] : a; +} +async function SN(t) { + return await t.request({ method: "wallet_getPermissions" }, { dedupe: !0 }); +} +async function H4(t, e) { + const { account: r = t.account, chainId: n, nonce: i } = e; + if (!r) + throw new qa({ + docsPath: "/docs/eip7702/prepareAuthorization" + }); + const s = pi(r), o = (() => { + if (e.executor) + return e.executor === "self" ? e.executor : pi(e.executor); + })(), a = { + address: e.contractAddress ?? e.address, + chainId: n, + nonce: i + }; + return typeof a.chainId > "u" && (a.chainId = t.chain?.id ?? await Hn(t, Gf, "getChainId")({})), typeof a.nonce > "u" && (a.nonce = await Hn(t, R4, "getTransactionCount")({ + address: s.address, + blockTag: "pending" + }), (o === "self" || o?.address && VO(o.address, s.address)) && (a.nonce += 1)), a; +} +async function AN(t) { + return (await t.request({ method: "eth_requestAccounts" }, { dedupe: !0, retryCount: 0 })).map((r) => e1(r)); +} +async function PN(t, e) { + return t.request({ + method: "wallet_requestPermissions", + params: [e] + }, { retryCount: 0 }); +} +async function MN(t, e) { + const { id: r } = e; + await t.request({ + method: "wallet_showCallsStatus", + params: [r] + }); +} +async function IN(t, e) { + const { account: r = t.account } = e; + if (!r) + throw new qa({ + docsPath: "/docs/eip7702/signAuthorization" + }); + const n = pi(r); + if (!n.signAuthorization) + throw new Nh({ + docsPath: "/docs/eip7702/signAuthorization", + metaMessages: [ + "The `signAuthorization` Action does not support JSON-RPC Accounts." + ], + type: n.type + }); + const i = await H4(t, e); + return n.signAuthorization(i); +} +async function CN(t, { account: e = t.account, message: r }) { + if (!e) + throw new qa({ + docsPath: "/docs/actions/wallet/signMessage" + }); + const n = pi(e); + if (n.signMessage) + return n.signMessage({ message: r }); + const i = typeof r == "string" ? jd(r) : r.raw instanceof Uint8Array ? od(r.raw) : r.raw; + return t.request({ + method: "personal_sign", + params: [i, n.address] + }, { retryCount: 0 }); +} +async function RN(t, e) { + const { account: r = t.account, chain: n = t.chain, ...i } = e; + if (!r) + throw new qa({ + docsPath: "/docs/actions/wallet/signTransaction" + }); + const s = pi(r); + Wd({ + account: s, + ...e + }); + const o = await Hn(t, Gf, "getChainId")({}); + n !== null && $4({ + currentChainId: o, + chain: n + }); + const f = (n?.formatters || t.chain?.formatters)?.transactionRequest?.format || a1; + return s.signTransaction ? s.signTransaction({ + ...i, + chainId: o + }, { serializer: t.chain?.serializers?.transaction }) : await t.request({ + method: "eth_signTransaction", + params: [ + { + ...f(i), + chainId: br(o), + from: s.address + } + ] + }, { retryCount: 0 }); +} +async function TN(t, e) { + const { account: r = t.account, domain: n, message: i, primaryType: s } = e; + if (!r) + throw new qa({ + docsPath: "/docs/actions/wallet/signTypedData" + }); + const o = pi(r), a = { + EIP712Domain: bN({ domain: n }), + ...e.types + }; + if (vN({ domain: n, message: i, primaryType: s, types: a }), o.signTypedData) + return o.signTypedData({ domain: n, message: i, primaryType: s, types: a }); + const f = mN({ domain: n, message: i, primaryType: s, types: a }); + return t.request({ + method: "eth_signTypedData_v4", + params: [o.address, f] + }, { retryCount: 0 }); +} +async function DN(t, { id: e }) { + await t.request({ + method: "wallet_switchEthereumChain", + params: [ + { + chainId: br(e) + } + ] + }, { retryCount: 0 }); +} +async function ON(t, e) { + return await t.request({ + method: "wallet_watchAsset", + params: e + }, { retryCount: 0 }); +} +function NN(t) { + return { + addChain: (e) => wN(t, e), + deployContract: (e) => xN(t, e), + getAddresses: () => _N(t), + getCallsStatus: (e) => q4(t, e), + getCapabilities: (e) => EN(t, e), + getChainId: () => Gf(t), + getPermissions: () => SN(t), + prepareAuthorization: (e) => H4(t, e), + prepareTransactionRequest: (e) => f1(t, e), + requestAddresses: () => AN(t), + requestPermissions: (e) => PN(t, e), + sendCalls: (e) => nN(t, e), + sendRawTransaction: (e) => F4(t, e), + sendTransaction: (e) => Kd(t, e), + showCallsStatus: (e) => MN(t, e), + signAuthorization: (e) => IN(t, e), + signMessage: (e) => CN(t, e), + signTransaction: (e) => RN(t, e), + signTypedData: (e) => TN(t, e), + switchChain: (e) => DN(t, e), + waitForCallsStatus: (e) => iN(t, e), + watchAsset: (e) => ON(t, e), + writeContract: (e) => tN(t, e) + }; +} +function ph(t) { + const { key: e = "wallet", name: r = "Wallet Client", transport: n } = t; + return oN({ + ...t, + key: e, + name: r, + transport: n, + type: "walletClient" + }).extend(NN); +} +class Tc { + _key; + _config = null; + _provider = null; + _connected = !1; + _address = null; + _fatured = !1; + _installed = !1; + lastUsed = !1; + _client = null; + get address() { + return this._address; + } + get connected() { + return this._connected; + } + get featured() { + return this._fatured; + } + get key() { + return this._key; + } + get installed() { + return this._installed; + } + get provider() { + return this._provider; + } + get client() { + return this._client ? this._client : null; + } + get config() { + return this._config; + } + static fromWalletConfig(e) { + return new Tc(e); + } + constructor(e) { + if ("name" in e && "image" in e) + this._key = e.name, this._config = e, this._fatured = e.featured; + else if ("session" in e) { + if (!e.session) throw new Error("session is null"); + this._key = e.session?.peer.metadata.name, this._provider = e, this._client = ph({ transport: dh(this._provider) }), this._config = { + name: e.session.peer.metadata.name, + image: e.session.peer.metadata.icons[0], + featured: !1 + }, this.testConnect(); + } else if ("info" in e) + this._key = e.info.name, this._provider = e.provider, this._installed = !0, this._client = ph({ transport: dh(this._provider) }), this._config = { + name: e.info.name, + image: e.info.icon, + featured: !1 + }, this.testConnect(); + else + throw new Error("unknown params"); + } + EIP6963Detected(e) { + this._provider = e.provider, this._client = ph({ transport: dh(this._provider) }), this._installed = !0, this._provider.on("disconnect", this.disconnect), this._provider.on("accountsChanged", (r) => { + this._address = r[0], this._connected = !0; + }), this.testConnect(); + } + setUniversalProvider(e) { + this._provider = e, this._client = ph({ transport: dh(this._provider) }), this.testConnect(); + } + async switchChain(e) { + try { + return await this.client?.getChainId() === e.id || await this.client?.switchChain(e), !0; + } catch (r) { + if (r.code === 4902) + return await this.client?.addChain({ chain: e }), await this.client?.switchChain(e), !0; + throw r; + } + } + async testConnect() { + const e = await this.client?.getAddresses(); + e && e.length > 0 ? (this._address = e[0], this._connected = !0) : (this._address = null, this._connected = !1); + } + async connect() { + const e = await this.client?.requestAddresses(); + if (!e) throw new Error("connect failed"); + return e; + } + async getAddress() { + const e = await this.client?.getAddresses(); + if (!e) throw new Error("get address failed"); + return e[0]; + } + async getChain() { + const e = await this.client?.getChainId(); + if (!e) throw new Error("get chain failed"); + return e; + } + async signMessage(e, r) { + return await this.client?.signMessage({ message: e, account: r }); + } + async disconnect() { + this._provider && "session" in this._provider && await this._provider.disconnect(), this._connected = !1, this._address = null; + } +} +var gh = { exports: {} }, e2; +function LN() { + if (e2) return gh.exports; + e2 = 1; + var t = typeof Reflect == "object" ? Reflect : null, e = t && typeof t.apply == "function" ? t.apply : function(B, U, R) { + return Function.prototype.apply.call(B, U, R); + }, r; + t && typeof t.ownKeys == "function" ? r = t.ownKeys : Object.getOwnPropertySymbols ? r = function(B) { + return Object.getOwnPropertyNames(B).concat(Object.getOwnPropertySymbols(B)); + } : r = function(B) { + return Object.getOwnPropertyNames(B); + }; + function n(k) { + console && console.warn && console.warn(k); + } + var i = Number.isNaN || function(B) { + return B !== B; + }; + function s() { + s.init.call(this); + } + gh.exports = s, gh.exports.once = $, s.EventEmitter = s, s.prototype._events = void 0, s.prototype._eventsCount = 0, s.prototype._maxListeners = void 0; + var o = 10; + function a(k) { + if (typeof k != "function") + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof k); + } + Object.defineProperty(s, "defaultMaxListeners", { + enumerable: !0, + get: function() { + return o; + }, + set: function(k) { + if (typeof k != "number" || k < 0 || i(k)) + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + k + "."); + o = k; + } + }), s.init = function() { + (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0; + }, s.prototype.setMaxListeners = function(B) { + if (typeof B != "number" || B < 0 || i(B)) + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + B + "."); + return this._maxListeners = B, this; + }; + function f(k) { + return k._maxListeners === void 0 ? s.defaultMaxListeners : k._maxListeners; + } + s.prototype.getMaxListeners = function() { + return f(this); + }, s.prototype.emit = function(B) { + for (var U = [], R = 1; R < arguments.length; R++) U.push(arguments[R]); + var W = B === "error", J = this._events; + if (J !== void 0) + W = W && J.error === void 0; + else if (!W) + return !1; + if (W) { + var ne; + if (U.length > 0 && (ne = U[0]), ne instanceof Error) + throw ne; + var K = new Error("Unhandled error." + (ne ? " (" + ne.message + ")" : "")); + throw K.context = ne, K; + } + var E = J[B]; + if (E === void 0) + return !1; + if (typeof E == "function") + e(E, this, U); + else + for (var b = E.length, l = S(E, b), R = 0; R < b; ++R) + e(l[R], this, U); + return !0; + }; + function u(k, B, U, R) { + var W, J, ne; + if (a(U), J = k._events, J === void 0 ? (J = k._events = /* @__PURE__ */ Object.create(null), k._eventsCount = 0) : (J.newListener !== void 0 && (k.emit( + "newListener", + B, + U.listener ? U.listener : U + ), J = k._events), ne = J[B]), ne === void 0) + ne = J[B] = U, ++k._eventsCount; + else if (typeof ne == "function" ? ne = J[B] = R ? [U, ne] : [ne, U] : R ? ne.unshift(U) : ne.push(U), W = f(k), W > 0 && ne.length > W && !ne.warned) { + ne.warned = !0; + var K = new Error("Possible EventEmitter memory leak detected. " + ne.length + " " + String(B) + " listeners added. Use emitter.setMaxListeners() to increase limit"); + K.name = "MaxListenersExceededWarning", K.emitter = k, K.type = B, K.count = ne.length, n(K); + } + return k; + } + s.prototype.addListener = function(B, U) { + return u(this, B, U, !1); + }, s.prototype.on = s.prototype.addListener, s.prototype.prependListener = function(B, U) { + return u(this, B, U, !0); + }; + function h() { + if (!this.fired) + return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments); + } + function g(k, B, U) { + var R = { fired: !1, wrapFn: void 0, target: k, type: B, listener: U }, W = h.bind(R); + return W.listener = U, R.wrapFn = W, W; + } + s.prototype.once = function(B, U) { + return a(U), this.on(B, g(this, B, U)), this; + }, s.prototype.prependOnceListener = function(B, U) { + return a(U), this.prependListener(B, g(this, B, U)), this; + }, s.prototype.removeListener = function(B, U) { + var R, W, J, ne, K; + if (a(U), W = this._events, W === void 0) + return this; + if (R = W[B], R === void 0) + return this; + if (R === U || R.listener === U) + --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete W[B], W.removeListener && this.emit("removeListener", B, R.listener || U)); + else if (typeof R != "function") { + for (J = -1, ne = R.length - 1; ne >= 0; ne--) + if (R[ne] === U || R[ne].listener === U) { + K = R[ne].listener, J = ne; + break; + } + if (J < 0) + return this; + J === 0 ? R.shift() : C(R, J), R.length === 1 && (W[B] = R[0]), W.removeListener !== void 0 && this.emit("removeListener", B, K || U); + } + return this; + }, s.prototype.off = s.prototype.removeListener, s.prototype.removeAllListeners = function(B) { + var U, R, W; + if (R = this._events, R === void 0) + return this; + if (R.removeListener === void 0) + return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : R[B] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete R[B]), this; + if (arguments.length === 0) { + var J = Object.keys(R), ne; + for (W = 0; W < J.length; ++W) + ne = J[W], ne !== "removeListener" && this.removeAllListeners(ne); + return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this; + } + if (U = R[B], typeof U == "function") + this.removeListener(B, U); + else if (U !== void 0) + for (W = U.length - 1; W >= 0; W--) + this.removeListener(B, U[W]); + return this; + }; + function v(k, B, U) { + var R = k._events; + if (R === void 0) + return []; + var W = R[B]; + return W === void 0 ? [] : typeof W == "function" ? U ? [W.listener || W] : [W] : U ? D(W) : S(W, W.length); + } + s.prototype.listeners = function(B) { + return v(this, B, !0); + }, s.prototype.rawListeners = function(B) { + return v(this, B, !1); + }, s.listenerCount = function(k, B) { + return typeof k.listenerCount == "function" ? k.listenerCount(B) : x.call(k, B); + }, s.prototype.listenerCount = x; + function x(k) { + var B = this._events; + if (B !== void 0) { + var U = B[k]; + if (typeof U == "function") + return 1; + if (U !== void 0) + return U.length; + } + return 0; + } + s.prototype.eventNames = function() { + return this._eventsCount > 0 ? r(this._events) : []; + }; + function S(k, B) { + for (var U = new Array(B), R = 0; R < B; ++R) + U[R] = k[R]; + return U; + } + function C(k, B) { + for (; B + 1 < k.length; B++) + k[B] = k[B + 1]; + k.pop(); + } + function D(k) { + for (var B = new Array(k.length), U = 0; U < B.length; ++U) + B[U] = k[U].listener || k[U]; + return B; + } + function $(k, B) { + return new Promise(function(U, R) { + function W(ne) { + k.removeListener(B, J), R(ne); + } + function J() { + typeof k.removeListener == "function" && k.removeListener("error", W), U([].slice.call(arguments)); + } + z(k, B, J, { once: !0 }), B !== "error" && N(k, W, { once: !0 }); + }); + } + function N(k, B, U) { + typeof k.on == "function" && z(k, "error", B, U); + } + function z(k, B, U, R) { + if (typeof k.on == "function") + R.once ? k.once(B, U) : k.on(B, U); + else if (typeof k.addEventListener == "function") + k.addEventListener(B, function W(J) { + R.once && k.removeEventListener(B, W), U(J); + }); + else + throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof k); + } + return gh.exports; +} +var Wi = LN(); +const l1 = /* @__PURE__ */ Hi(Wi); +var Hp = {}; +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +var Jm = function(t, e) { + return Jm = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) { + r.__proto__ = n; + } || function(r, n) { + for (var i in n) n.hasOwnProperty(i) && (r[i] = n[i]); + }, Jm(t, e); +}; +function kN(t, e) { + Jm(t, e); + function r() { + this.constructor = t; + } + t.prototype = e === null ? Object.create(e) : (r.prototype = e.prototype, new r()); +} +var Xm = function() { + return Xm = Object.assign || function(e) { + for (var r, n = 1, i = arguments.length; n < i; n++) { + r = arguments[n]; + for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]); + } + return e; + }, Xm.apply(this, arguments); +}; +function $N(t, e) { + var r = {}; + for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); + if (t != null && typeof Object.getOwnPropertySymbols == "function") + for (var i = 0, n = Object.getOwnPropertySymbols(t); i < n.length; i++) + e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]); + return r; +} +function BN(t, e, r, n) { + var i = arguments.length, s = i < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, r) : n, o; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") s = Reflect.decorate(t, e, r, n); + else for (var a = t.length - 1; a >= 0; a--) (o = t[a]) && (s = (i < 3 ? o(s) : i > 3 ? o(e, r, s) : o(e, r)) || s); + return i > 3 && s && Object.defineProperty(e, r, s), s; +} +function FN(t, e) { + return function(r, n) { + e(r, n, t); + }; +} +function jN(t, e) { + if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(t, e); +} +function UN(t, e, r, n) { + function i(s) { + return s instanceof r ? s : new r(function(o) { + o(s); + }); + } + return new (r || (r = Promise))(function(s, o) { + function a(h) { + try { + u(n.next(h)); + } catch (g) { + o(g); + } + } + function f(h) { + try { + u(n.throw(h)); + } catch (g) { + o(g); + } + } + function u(h) { + h.done ? s(h.value) : i(h.value).then(a, f); + } + u((n = n.apply(t, e || [])).next()); + }); +} +function qN(t, e) { + var r = { label: 0, sent: function() { + if (s[0] & 1) throw s[1]; + return s[1]; + }, trys: [], ops: [] }, n, i, s, o; + return o = { next: a(0), throw: a(1), return: a(2) }, typeof Symbol == "function" && (o[Symbol.iterator] = function() { + return this; + }), o; + function a(u) { + return function(h) { + return f([u, h]); + }; + } + function f(u) { + if (n) throw new TypeError("Generator is already executing."); + for (; r; ) try { + if (n = 1, i && (s = u[0] & 2 ? i.return : u[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, u[1])).done) return s; + switch (i = 0, s && (u = [u[0] & 2, s.value]), u[0]) { + case 0: + case 1: + s = u; + break; + case 4: + return r.label++, { value: u[1], done: !1 }; + case 5: + r.label++, i = u[1], u = [0]; + continue; + case 7: + u = r.ops.pop(), r.trys.pop(); + continue; + default: + if (s = r.trys, !(s = s.length > 0 && s[s.length - 1]) && (u[0] === 6 || u[0] === 2)) { + r = 0; + continue; + } + if (u[0] === 3 && (!s || u[1] > s[0] && u[1] < s[3])) { + r.label = u[1]; + break; + } + if (u[0] === 6 && r.label < s[1]) { + r.label = s[1], s = u; + break; + } + if (s && r.label < s[2]) { + r.label = s[2], r.ops.push(u); + break; + } + s[2] && r.ops.pop(), r.trys.pop(); + continue; + } + u = e.call(t, r); + } catch (h) { + u = [6, h], i = 0; + } finally { + n = s = 0; + } + if (u[0] & 5) throw u[1]; + return { value: u[0] ? u[1] : void 0, done: !0 }; + } +} +function zN(t, e, r, n) { + n === void 0 && (n = r), t[n] = e[r]; +} +function HN(t, e) { + for (var r in t) r !== "default" && !e.hasOwnProperty(r) && (e[r] = t[r]); +} +function Zm(t) { + var e = typeof Symbol == "function" && Symbol.iterator, r = e && t[e], n = 0; + if (r) return r.call(t); + if (t && typeof t.length == "number") return { + next: function() { + return t && n >= t.length && (t = void 0), { value: t && t[n++], done: !t }; + } + }; + throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined."); +} +function W4(t, e) { + var r = typeof Symbol == "function" && t[Symbol.iterator]; + if (!r) return t; + var n = r.call(t), i, s = [], o; + try { + for (; (e === void 0 || e-- > 0) && !(i = n.next()).done; ) s.push(i.value); + } catch (a) { + o = { error: a }; + } finally { + try { + i && !i.done && (r = n.return) && r.call(n); + } finally { + if (o) throw o.error; + } + } + return s; +} +function WN() { + for (var t = [], e = 0; e < arguments.length; e++) + t = t.concat(W4(arguments[e])); + return t; +} +function KN() { + for (var t = 0, e = 0, r = arguments.length; e < r; e++) t += arguments[e].length; + for (var n = Array(t), i = 0, e = 0; e < r; e++) + for (var s = arguments[e], o = 0, a = s.length; o < a; o++, i++) + n[i] = s[o]; + return n; +} +function Of(t) { + return this instanceof Of ? (this.v = t, this) : new Of(t); +} +function VN(t, e, r) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var n = r.apply(t, e || []), i, s = []; + return i = {}, o("next"), o("throw"), o("return"), i[Symbol.asyncIterator] = function() { + return this; + }, i; + function o(v) { + n[v] && (i[v] = function(x) { + return new Promise(function(S, C) { + s.push([v, x, S, C]) > 1 || a(v, x); + }); + }); + } + function a(v, x) { + try { + f(n[v](x)); + } catch (S) { + g(s[0][3], S); + } + } + function f(v) { + v.value instanceof Of ? Promise.resolve(v.value.v).then(u, h) : g(s[0][2], v); + } + function u(v) { + a("next", v); + } + function h(v) { + a("throw", v); + } + function g(v, x) { + v(x), s.shift(), s.length && a(s[0][0], s[0][1]); + } +} +function GN(t) { + var e, r; + return e = {}, n("next"), n("throw", function(i) { + throw i; + }), n("return"), e[Symbol.iterator] = function() { + return this; + }, e; + function n(i, s) { + e[i] = t[i] ? function(o) { + return (r = !r) ? { value: Of(t[i](o)), done: i === "return" } : s ? s(o) : o; + } : s; + } +} +function YN(t) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var e = t[Symbol.asyncIterator], r; + return e ? e.call(t) : (t = typeof Zm == "function" ? Zm(t) : t[Symbol.iterator](), r = {}, n("next"), n("throw"), n("return"), r[Symbol.asyncIterator] = function() { + return this; + }, r); + function n(s) { + r[s] = t[s] && function(o) { + return new Promise(function(a, f) { + o = t[s](o), i(a, f, o.done, o.value); + }); + }; + } + function i(s, o, a, f) { + Promise.resolve(f).then(function(u) { + s({ value: u, done: a }); + }, o); + } +} +function JN(t, e) { + return Object.defineProperty ? Object.defineProperty(t, "raw", { value: e }) : t.raw = e, t; +} +function XN(t) { + if (t && t.__esModule) return t; + var e = {}; + if (t != null) for (var r in t) Object.hasOwnProperty.call(t, r) && (e[r] = t[r]); + return e.default = t, e; +} +function ZN(t) { + return t && t.__esModule ? t : { default: t }; +} +function QN(t, e) { + if (!e.has(t)) + throw new TypeError("attempted to get private field on non-instance"); + return e.get(t); +} +function eL(t, e, r) { + if (!e.has(t)) + throw new TypeError("attempted to set private field on non-instance"); + return e.set(t, r), r; +} +const tL = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + get __assign() { + return Xm; + }, + __asyncDelegator: GN, + __asyncGenerator: VN, + __asyncValues: YN, + __await: Of, + __awaiter: UN, + __classPrivateFieldGet: QN, + __classPrivateFieldSet: eL, + __createBinding: zN, + __decorate: BN, + __exportStar: HN, + __extends: kN, + __generator: qN, + __importDefault: ZN, + __importStar: XN, + __makeTemplateObject: JN, + __metadata: jN, + __param: FN, + __read: W4, + __rest: $N, + __spread: WN, + __spreadArrays: KN, + __values: Zm +}, Symbol.toStringTag, { value: "Module" })), Yf = /* @__PURE__ */ K5(tL); +var Wp = {}, Au = {}, t2; +function rL() { + if (t2) return Au; + t2 = 1, Object.defineProperty(Au, "__esModule", { value: !0 }), Au.delay = void 0; + function t(e) { + return new Promise((r) => { + setTimeout(() => { + r(!0); + }, e); + }); + } + return Au.delay = t, Au; +} +var la = {}, Kp = {}, ha = {}, r2; +function nL() { + return r2 || (r2 = 1, Object.defineProperty(ha, "__esModule", { value: !0 }), ha.ONE_THOUSAND = ha.ONE_HUNDRED = void 0, ha.ONE_HUNDRED = 100, ha.ONE_THOUSAND = 1e3), ha; +} +var Vp = {}, n2; +function iL() { + return n2 || (n2 = 1, (function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }), t.ONE_YEAR = t.FOUR_WEEKS = t.THREE_WEEKS = t.TWO_WEEKS = t.ONE_WEEK = t.THIRTY_DAYS = t.SEVEN_DAYS = t.FIVE_DAYS = t.THREE_DAYS = t.ONE_DAY = t.TWENTY_FOUR_HOURS = t.TWELVE_HOURS = t.SIX_HOURS = t.THREE_HOURS = t.ONE_HOUR = t.SIXTY_MINUTES = t.THIRTY_MINUTES = t.TEN_MINUTES = t.FIVE_MINUTES = t.ONE_MINUTE = t.SIXTY_SECONDS = t.THIRTY_SECONDS = t.TEN_SECONDS = t.FIVE_SECONDS = t.ONE_SECOND = void 0, t.ONE_SECOND = 1, t.FIVE_SECONDS = 5, t.TEN_SECONDS = 10, t.THIRTY_SECONDS = 30, t.SIXTY_SECONDS = 60, t.ONE_MINUTE = t.SIXTY_SECONDS, t.FIVE_MINUTES = t.ONE_MINUTE * 5, t.TEN_MINUTES = t.ONE_MINUTE * 10, t.THIRTY_MINUTES = t.ONE_MINUTE * 30, t.SIXTY_MINUTES = t.ONE_MINUTE * 60, t.ONE_HOUR = t.SIXTY_MINUTES, t.THREE_HOURS = t.ONE_HOUR * 3, t.SIX_HOURS = t.ONE_HOUR * 6, t.TWELVE_HOURS = t.ONE_HOUR * 12, t.TWENTY_FOUR_HOURS = t.ONE_HOUR * 24, t.ONE_DAY = t.TWENTY_FOUR_HOURS, t.THREE_DAYS = t.ONE_DAY * 3, t.FIVE_DAYS = t.ONE_DAY * 5, t.SEVEN_DAYS = t.ONE_DAY * 7, t.THIRTY_DAYS = t.ONE_DAY * 30, t.ONE_WEEK = t.SEVEN_DAYS, t.TWO_WEEKS = t.ONE_WEEK * 2, t.THREE_WEEKS = t.ONE_WEEK * 3, t.FOUR_WEEKS = t.ONE_WEEK * 4, t.ONE_YEAR = t.ONE_DAY * 365; + })(Vp)), Vp; +} +var i2; +function K4() { + return i2 || (i2 = 1, (function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }); + const e = Yf; + e.__exportStar(nL(), t), e.__exportStar(iL(), t); + })(Kp)), Kp; +} +var s2; +function sL() { + if (s2) return la; + s2 = 1, Object.defineProperty(la, "__esModule", { value: !0 }), la.fromMiliseconds = la.toMiliseconds = void 0; + const t = K4(); + function e(n) { + return n * t.ONE_THOUSAND; + } + la.toMiliseconds = e; + function r(n) { + return Math.floor(n / t.ONE_THOUSAND); + } + return la.fromMiliseconds = r, la; +} +var o2; +function oL() { + return o2 || (o2 = 1, (function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }); + const e = Yf; + e.__exportStar(rL(), t), e.__exportStar(sL(), t); + })(Wp)), Wp; +} +var dc = {}, a2; +function aL() { + if (a2) return dc; + a2 = 1, Object.defineProperty(dc, "__esModule", { value: !0 }), dc.Watch = void 0; + class t { + constructor() { + this.timestamps = /* @__PURE__ */ new Map(); + } + start(r) { + if (this.timestamps.has(r)) + throw new Error(`Watch already started for label: ${r}`); + this.timestamps.set(r, { started: Date.now() }); + } + stop(r) { + const n = this.get(r); + if (typeof n.elapsed < "u") + throw new Error(`Watch already stopped for label: ${r}`); + const i = Date.now() - n.started; + this.timestamps.set(r, { started: n.started, elapsed: i }); + } + get(r) { + const n = this.timestamps.get(r); + if (typeof n > "u") + throw new Error(`No timestamp found for label: ${r}`); + return n; + } + elapsed(r) { + const n = this.get(r); + return n.elapsed || Date.now() - n.started; + } + } + return dc.Watch = t, dc.default = t, dc; +} +var Gp = {}, Pu = {}, c2; +function cL() { + if (c2) return Pu; + c2 = 1, Object.defineProperty(Pu, "__esModule", { value: !0 }), Pu.IWatch = void 0; + class t { + } + return Pu.IWatch = t, Pu; +} +var u2; +function uL() { + return u2 || (u2 = 1, (function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }), Yf.__exportStar(cL(), t); + })(Gp)), Gp; +} +var f2; +function fL() { + return f2 || (f2 = 1, (function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }); + const e = Yf; + e.__exportStar(oL(), t), e.__exportStar(aL(), t), e.__exportStar(uL(), t), e.__exportStar(K4(), t); + })(Hp)), Hp; +} +var bt = fL(); +class za { +} +let lL = class extends za { + constructor(e) { + super(); + } +}; +const l2 = bt.FIVE_SECONDS, Vc = { pulse: "heartbeat_pulse" }; +let hL = class V4 extends lL { + constructor(e) { + super(e), this.events = new Wi.EventEmitter(), this.interval = l2, this.interval = e?.interval || l2; + } + static async init(e) { + const r = new V4(e); + return await r.init(), r; + } + async init() { + await this.initialize(); + } + stop() { + clearInterval(this.intervalRef); + } + on(e, r) { + this.events.on(e, r); + } + once(e, r) { + this.events.once(e, r); + } + off(e, r) { + this.events.off(e, r); + } + removeListener(e, r) { + this.events.removeListener(e, r); + } + async initialize() { + this.intervalRef = setInterval(() => this.pulse(), bt.toMiliseconds(this.interval)); + } + pulse() { + this.events.emit(Vc.pulse); + } +}; +const dL = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/, pL = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/, gL = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/; +function mL(t, e) { + if (t === "__proto__" || t === "constructor" && e && typeof e == "object" && "prototype" in e) { + vL(t); + return; + } + return e; +} +function vL(t) { + console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`); +} +function mh(t, e = {}) { + if (typeof t != "string") + return t; + const r = t.trim(); + if ( + // eslint-disable-next-line unicorn/prefer-at + t[0] === '"' && t.endsWith('"') && !t.includes("\\") + ) + return r.slice(1, -1); + if (r.length <= 9) { + const n = r.toLowerCase(); + if (n === "true") + return !0; + if (n === "false") + return !1; + if (n === "undefined") + return; + if (n === "null") + return null; + if (n === "nan") + return Number.NaN; + if (n === "infinity") + return Number.POSITIVE_INFINITY; + if (n === "-infinity") + return Number.NEGATIVE_INFINITY; + } + if (!gL.test(t)) { + if (e.strict) + throw new SyntaxError("[destr] Invalid JSON"); + return t; + } + try { + if (dL.test(t) || pL.test(t)) { + if (e.strict) + throw new Error("[destr] Possible prototype pollution"); + return JSON.parse(t, mL); + } + return JSON.parse(t); + } catch (n) { + if (e.strict) + throw n; + return t; + } +} +function bL(t) { + return !t || typeof t.then != "function" ? Promise.resolve(t) : t; +} +function Mn(t, ...e) { + try { + return bL(t(...e)); + } catch (r) { + return Promise.reject(r); + } +} +function yL(t) { + const e = typeof t; + return t === null || e !== "object" && e !== "function"; +} +function wL(t) { + const e = Object.getPrototypeOf(t); + return !e || e.isPrototypeOf(Object); +} +function Lh(t) { + if (yL(t)) + return String(t); + if (wL(t) || Array.isArray(t)) + return JSON.stringify(t); + if (typeof t.toJSON == "function") + return Lh(t.toJSON()); + throw new Error("[unstorage] Cannot stringify value!"); +} +function G4() { + if (typeof Buffer > "u") + throw new TypeError("[unstorage] Buffer is not supported!"); +} +const Qm = "base64:"; +function xL(t) { + if (typeof t == "string") + return t; + G4(); + const e = Buffer.from(t).toString("base64"); + return Qm + e; +} +function _L(t) { + return typeof t != "string" || !t.startsWith(Qm) ? t : (G4(), Buffer.from(t.slice(Qm.length), "base64")); +} +function ci(t) { + return t ? t.split("?")[0].replace(/[/\\]/g, ":").replace(/:+/g, ":").replace(/^:|:$/g, "") : ""; +} +function EL(...t) { + return ci(t.join(":")); +} +function vh(t) { + return t = ci(t), t ? t + ":" : ""; +} +const SL = "memory", AL = () => { + const t = /* @__PURE__ */ new Map(); + return { + name: SL, + getInstance: () => t, + hasItem(e) { + return t.has(e); + }, + getItem(e) { + return t.get(e) ?? null; + }, + getItemRaw(e) { + return t.get(e) ?? null; + }, + setItem(e, r) { + t.set(e, r); + }, + setItemRaw(e, r) { + t.set(e, r); + }, + removeItem(e) { + t.delete(e); + }, + getKeys() { + return [...t.keys()]; + }, + clear() { + t.clear(); + }, + dispose() { + t.clear(); + } + }; +}; +function PL(t = {}) { + const e = { + mounts: { "": t.driver || AL() }, + mountpoints: [""], + watching: !1, + watchListeners: [], + unwatch: {} + }, r = (u) => { + for (const h of e.mountpoints) + if (u.startsWith(h)) + return { + base: h, + relativeKey: u.slice(h.length), + driver: e.mounts[h] + }; + return { + base: "", + relativeKey: u, + driver: e.mounts[""] + }; + }, n = (u, h) => e.mountpoints.filter( + (g) => g.startsWith(u) || h && u.startsWith(g) + ).map((g) => ({ + relativeBase: u.length > g.length ? u.slice(g.length) : void 0, + mountpoint: g, + driver: e.mounts[g] + })), i = (u, h) => { + if (e.watching) { + h = ci(h); + for (const g of e.watchListeners) + g(u, h); + } + }, s = async () => { + if (!e.watching) { + e.watching = !0; + for (const u in e.mounts) + e.unwatch[u] = await h2( + e.mounts[u], + i, + u + ); + } + }, o = async () => { + if (e.watching) { + for (const u in e.unwatch) + await e.unwatch[u](); + e.unwatch = {}, e.watching = !1; + } + }, a = (u, h, g) => { + const v = /* @__PURE__ */ new Map(), x = (S) => { + let C = v.get(S.base); + return C || (C = { + driver: S.driver, + base: S.base, + items: [] + }, v.set(S.base, C)), C; + }; + for (const S of u) { + const C = typeof S == "string", D = ci(C ? S : S.key), $ = C ? void 0 : S.value, N = C || !S.options ? h : { ...h, ...S.options }, z = r(D); + x(z).items.push({ + key: D, + value: $, + relativeKey: z.relativeKey, + options: N + }); + } + return Promise.all([...v.values()].map((S) => g(S))).then( + (S) => S.flat() + ); + }, f = { + // Item + hasItem(u, h = {}) { + u = ci(u); + const { relativeKey: g, driver: v } = r(u); + return Mn(v.hasItem, g, h); + }, + getItem(u, h = {}) { + u = ci(u); + const { relativeKey: g, driver: v } = r(u); + return Mn(v.getItem, g, h).then( + (x) => mh(x) + ); + }, + getItems(u, h) { + return a(u, h, (g) => g.driver.getItems ? Mn( + g.driver.getItems, + g.items.map((v) => ({ + key: v.relativeKey, + options: v.options + })), + h + ).then( + (v) => v.map((x) => ({ + key: EL(g.base, x.key), + value: mh(x.value) + })) + ) : Promise.all( + g.items.map((v) => Mn( + g.driver.getItem, + v.relativeKey, + v.options + ).then((x) => ({ + key: v.key, + value: mh(x) + }))) + )); + }, + getItemRaw(u, h = {}) { + u = ci(u); + const { relativeKey: g, driver: v } = r(u); + return v.getItemRaw ? Mn(v.getItemRaw, g, h) : Mn(v.getItem, g, h).then( + (x) => _L(x) + ); + }, + async setItem(u, h, g = {}) { + if (h === void 0) + return f.removeItem(u); + u = ci(u); + const { relativeKey: v, driver: x } = r(u); + x.setItem && (await Mn(x.setItem, v, Lh(h), g), x.watch || i("update", u)); + }, + async setItems(u, h) { + await a(u, h, async (g) => { + if (g.driver.setItems) + return Mn( + g.driver.setItems, + g.items.map((v) => ({ + key: v.relativeKey, + value: Lh(v.value), + options: v.options + })), + h + ); + g.driver.setItem && await Promise.all( + g.items.map((v) => Mn( + g.driver.setItem, + v.relativeKey, + Lh(v.value), + v.options + )) + ); + }); + }, + async setItemRaw(u, h, g = {}) { + if (h === void 0) + return f.removeItem(u, g); + u = ci(u); + const { relativeKey: v, driver: x } = r(u); + if (x.setItemRaw) + await Mn(x.setItemRaw, v, h, g); + else if (x.setItem) + await Mn(x.setItem, v, xL(h), g); + else + return; + x.watch || i("update", u); + }, + async removeItem(u, h = {}) { + typeof h == "boolean" && (h = { removeMeta: h }), u = ci(u); + const { relativeKey: g, driver: v } = r(u); + v.removeItem && (await Mn(v.removeItem, g, h), (h.removeMeta || h.removeMata) && await Mn(v.removeItem, g + "$", h), v.watch || i("remove", u)); + }, + // Meta + async getMeta(u, h = {}) { + typeof h == "boolean" && (h = { nativeOnly: h }), u = ci(u); + const { relativeKey: g, driver: v } = r(u), x = /* @__PURE__ */ Object.create(null); + if (v.getMeta && Object.assign(x, await Mn(v.getMeta, g, h)), !h.nativeOnly) { + const S = await Mn( + v.getItem, + g + "$", + h + ).then((C) => mh(C)); + S && typeof S == "object" && (typeof S.atime == "string" && (S.atime = new Date(S.atime)), typeof S.mtime == "string" && (S.mtime = new Date(S.mtime)), Object.assign(x, S)); + } + return x; + }, + setMeta(u, h, g = {}) { + return this.setItem(u + "$", h, g); + }, + removeMeta(u, h = {}) { + return this.removeItem(u + "$", h); + }, + // Keys + async getKeys(u, h = {}) { + u = vh(u); + const g = n(u, !0); + let v = []; + const x = []; + for (const S of g) { + const C = await Mn( + S.driver.getKeys, + S.relativeBase, + h + ); + for (const D of C) { + const $ = S.mountpoint + ci(D); + v.some((N) => $.startsWith(N)) || x.push($); + } + v = [ + S.mountpoint, + ...v.filter((D) => !D.startsWith(S.mountpoint)) + ]; + } + return u ? x.filter( + (S) => S.startsWith(u) && S[S.length - 1] !== "$" + ) : x.filter((S) => S[S.length - 1] !== "$"); + }, + // Utils + async clear(u, h = {}) { + u = vh(u), await Promise.all( + n(u, !1).map(async (g) => { + if (g.driver.clear) + return Mn(g.driver.clear, g.relativeBase, h); + if (g.driver.removeItem) { + const v = await g.driver.getKeys(g.relativeBase || "", h); + return Promise.all( + v.map((x) => g.driver.removeItem(x, h)) + ); + } + }) + ); + }, + async dispose() { + await Promise.all( + Object.values(e.mounts).map((u) => d2(u)) + ); + }, + async watch(u) { + return await s(), e.watchListeners.push(u), async () => { + e.watchListeners = e.watchListeners.filter( + (h) => h !== u + ), e.watchListeners.length === 0 && await o(); + }; + }, + async unwatch() { + e.watchListeners = [], await o(); + }, + // Mount + mount(u, h) { + if (u = vh(u), u && e.mounts[u]) + throw new Error(`already mounted at ${u}`); + return u && (e.mountpoints.push(u), e.mountpoints.sort((g, v) => v.length - g.length)), e.mounts[u] = h, e.watching && Promise.resolve(h2(h, i, u)).then((g) => { + e.unwatch[u] = g; + }).catch(console.error), f; + }, + async unmount(u, h = !0) { + u = vh(u), !(!u || !e.mounts[u]) && (e.watching && u in e.unwatch && (e.unwatch[u](), delete e.unwatch[u]), h && await d2(e.mounts[u]), e.mountpoints = e.mountpoints.filter((g) => g !== u), delete e.mounts[u]); + }, + getMount(u = "") { + u = ci(u) + ":"; + const h = r(u); + return { + driver: h.driver, + base: h.base + }; + }, + getMounts(u = "", h = {}) { + return u = ci(u), n(u, h.parents).map((v) => ({ + driver: v.driver, + base: v.mountpoint + })); + }, + // Aliases + keys: (u, h = {}) => f.getKeys(u, h), + get: (u, h = {}) => f.getItem(u, h), + set: (u, h, g = {}) => f.setItem(u, h, g), + has: (u, h = {}) => f.hasItem(u, h), + del: (u, h = {}) => f.removeItem(u, h), + remove: (u, h = {}) => f.removeItem(u, h) + }; + return f; +} +function h2(t, e, r) { + return t.watch ? t.watch((n, i) => e(n, r + i)) : () => { + }; +} +async function d2(t) { + typeof t.dispose == "function" && await Mn(t.dispose); +} +function Ha(t) { + return new Promise((e, r) => { + t.oncomplete = t.onsuccess = () => e(t.result), t.onabort = t.onerror = () => r(t.error); + }); +} +function Y4(t, e) { + const r = indexedDB.open(t); + r.onupgradeneeded = () => r.result.createObjectStore(e); + const n = Ha(r); + return (i, s) => n.then((o) => s(o.transaction(e, i).objectStore(e))); +} +let Yp; +function Jf() { + return Yp || (Yp = Y4("keyval-store", "keyval")), Yp; +} +function p2(t, e = Jf()) { + return e("readonly", (r) => Ha(r.get(t))); +} +function ML(t, e, r = Jf()) { + return r("readwrite", (n) => (n.put(e, t), Ha(n.transaction))); +} +function IL(t, e = Jf()) { + return e("readwrite", (r) => (r.delete(t), Ha(r.transaction))); +} +function CL(t = Jf()) { + return t("readwrite", (e) => (e.clear(), Ha(e.transaction))); +} +function RL(t, e) { + return t.openCursor().onsuccess = function() { + this.result && (e(this.result), this.result.continue()); + }, Ha(t.transaction); +} +function TL(t = Jf()) { + return t("readonly", (e) => { + if (e.getAllKeys) + return Ha(e.getAllKeys()); + const r = []; + return RL(e, (n) => r.push(n.key)).then(() => r); + }); +} +const DL = (t) => JSON.stringify(t, (e, r) => typeof r == "bigint" ? r.toString() + "n" : r), OL = (t) => { + const e = /([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g, r = t.replace(e, '$1"$2n"$3'); + return JSON.parse(r, (n, i) => typeof i == "string" && i.match(/^\d+n$/) ? BigInt(i.substring(0, i.length - 1)) : i); +}; +function Na(t) { + if (typeof t != "string") + throw new Error(`Cannot safe json parse value of type ${typeof t}`); + try { + return OL(t); + } catch { + return t; + } +} +function ho(t) { + return typeof t == "string" ? t : DL(t) || ""; +} +const NL = "idb-keyval"; +var LL = (t = {}) => { + const e = t.base && t.base.length > 0 ? `${t.base}:` : "", r = (i) => e + i; + let n; + return t.dbName && t.storeName && (n = Y4(t.dbName, t.storeName)), { name: NL, options: t, async hasItem(i) { + return !(typeof await p2(r(i), n) > "u"); + }, async getItem(i) { + return await p2(r(i), n) ?? null; + }, setItem(i, s) { + return ML(r(i), s, n); + }, removeItem(i) { + return IL(r(i), n); + }, getKeys() { + return TL(n); + }, clear() { + return CL(n); + } }; +}; +const kL = "WALLET_CONNECT_V2_INDEXED_DB", $L = "keyvaluestorage"; +let BL = class { + constructor() { + this.indexedDb = PL({ driver: LL({ dbName: kL, storeName: $L }) }); + } + async getKeys() { + return this.indexedDb.getKeys(); + } + async getEntries() { + return (await this.indexedDb.getItems(await this.indexedDb.getKeys())).map((e) => [e.key, e.value]); + } + async getItem(e) { + const r = await this.indexedDb.getItem(e); + if (r !== null) return r; + } + async setItem(e, r) { + await this.indexedDb.setItem(e, ho(r)); + } + async removeItem(e) { + await this.indexedDb.removeItem(e); + } +}; +var Jp = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, kh = { exports: {} }; +(function() { + let t; + function e() { + } + t = e, t.prototype.getItem = function(r) { + return this.hasOwnProperty(r) ? String(this[r]) : null; + }, t.prototype.setItem = function(r, n) { + this[r] = String(n); + }, t.prototype.removeItem = function(r) { + delete this[r]; + }, t.prototype.clear = function() { + const r = this; + Object.keys(r).forEach(function(n) { + r[n] = void 0, delete r[n]; + }); + }, t.prototype.key = function(r) { + return r = r || 0, Object.keys(this)[r]; + }, t.prototype.__defineGetter__("length", function() { + return Object.keys(this).length; + }), typeof Jp < "u" && Jp.localStorage ? kh.exports = Jp.localStorage : typeof window < "u" && window.localStorage ? kh.exports = window.localStorage : kh.exports = new e(); +})(); +function FL(t) { + var e; + return [t[0], Na((e = t[1]) != null ? e : "")]; +} +let jL = class { + constructor() { + this.localStorage = kh.exports; + } + async getKeys() { + return Object.keys(this.localStorage); + } + async getEntries() { + return Object.entries(this.localStorage).map(FL); + } + async getItem(e) { + const r = this.localStorage.getItem(e); + if (r !== null) return Na(r); + } + async setItem(e, r) { + this.localStorage.setItem(e, ho(r)); + } + async removeItem(e) { + this.localStorage.removeItem(e); + } +}; +const UL = "wc_storage_version", g2 = 1, qL = async (t, e, r) => { + const n = UL, i = await e.getItem(n); + if (i && i >= g2) { + r(e); + return; + } + const s = await t.getKeys(); + if (!s.length) { + r(e); + return; + } + const o = []; + for (; s.length; ) { + const a = s.shift(); + if (!a) continue; + const f = a.toLowerCase(); + if (f.includes("wc@") || f.includes("walletconnect") || f.includes("wc_") || f.includes("wallet_connect")) { + const u = await t.getItem(a); + await e.setItem(a, u), o.push(a); + } + } + await e.setItem(n, g2), r(e), zL(t, o); +}, zL = async (t, e) => { + e.length && e.forEach(async (r) => { + await t.removeItem(r); + }); +}; +let HL = class { + constructor() { + this.initialized = !1, this.setInitialized = (r) => { + this.storage = r, this.initialized = !0; + }; + const e = new jL(); + this.storage = e; + try { + const r = new BL(); + qL(e, r, this.setInitialized); + } catch { + this.initialized = !0; + } + } + async getKeys() { + return await this.initialize(), this.storage.getKeys(); + } + async getEntries() { + return await this.initialize(), this.storage.getEntries(); + } + async getItem(e) { + return await this.initialize(), this.storage.getItem(e); + } + async setItem(e, r) { + return await this.initialize(), this.storage.setItem(e, r); + } + async removeItem(e) { + return await this.initialize(), this.storage.removeItem(e); + } + async initialize() { + this.initialized || await new Promise((e) => { + const r = setInterval(() => { + this.initialized && (clearInterval(r), e()); + }, 20); + }); + } +}; +var Xp, m2; +function WL() { + if (m2) return Xp; + m2 = 1; + function t(r) { + try { + return JSON.stringify(r); + } catch { + return '"[Circular]"'; + } + } + Xp = e; + function e(r, n, i) { + var s = i && i.stringify || t, o = 1; + if (typeof r == "object" && r !== null) { + var a = n.length + o; + if (a === 1) return r; + var f = new Array(a); + f[0] = s(r); + for (var u = 1; u < a; u++) + f[u] = s(n[u]); + return f.join(" "); + } + if (typeof r != "string") + return r; + var h = n.length; + if (h === 0) return r; + for (var g = "", v = 1 - o, x = -1, S = r && r.length || 0, C = 0; C < S; ) { + if (r.charCodeAt(C) === 37 && C + 1 < S) { + switch (x = x > -1 ? x : 0, r.charCodeAt(C + 1)) { + case 100: + // 'd' + case 102: + if (v >= h || n[v] == null) break; + x < C && (g += r.slice(x, C)), g += Number(n[v]), x = C + 2, C++; + break; + case 105: + if (v >= h || n[v] == null) break; + x < C && (g += r.slice(x, C)), g += Math.floor(Number(n[v])), x = C + 2, C++; + break; + case 79: + // 'O' + case 111: + // 'o' + case 106: + if (v >= h || n[v] === void 0) break; + x < C && (g += r.slice(x, C)); + var D = typeof n[v]; + if (D === "string") { + g += "'" + n[v] + "'", x = C + 2, C++; + break; + } + if (D === "function") { + g += n[v].name || "", x = C + 2, C++; + break; + } + g += s(n[v]), x = C + 2, C++; + break; + case 115: + if (v >= h) + break; + x < C && (g += r.slice(x, C)), g += String(n[v]), x = C + 2, C++; + break; + case 37: + x < C && (g += r.slice(x, C)), g += "%", x = C + 2, C++, v--; + break; + } + ++v; + } + ++C; + } + return x === -1 ? r : (x < S && (g += r.slice(x)), g); + } + return Xp; +} +var Zp, v2; +function KL() { + if (v2) return Zp; + v2 = 1; + const t = WL(); + Zp = i; + const e = B().console || {}, r = { + mapHttpRequest: S, + mapHttpResponse: S, + wrapRequestSerializer: C, + wrapResponseSerializer: C, + wrapErrorSerializer: C, + req: S, + res: S, + err: v + }; + function n(U, R) { + return Array.isArray(U) ? U.filter(function(J) { + return J !== "!stdSerializers.err"; + }) : U === !0 ? Object.keys(R) : !1; + } + function i(U) { + U = U || {}, U.browser = U.browser || {}; + const R = U.browser.transmit; + if (R && typeof R.send != "function") + throw Error("pino: transmit option must have a send function"); + const W = U.browser.write || e; + U.browser.write && (U.browser.asObject = !0); + const J = U.serializers || {}, ne = n(U.browser.serialize, J); + let K = U.browser.serialize; + Array.isArray(U.browser.serialize) && U.browser.serialize.indexOf("!stdSerializers.err") > -1 && (K = !1); + const E = ["error", "fatal", "warn", "info", "debug", "trace"]; + typeof W == "function" && (W.error = W.fatal = W.warn = W.info = W.debug = W.trace = W), U.enabled === !1 && (U.level = "silent"); + const b = U.level || "info", l = Object.create(W); + l.log || (l.log = D), Object.defineProperty(l, "levelVal", { + get: m + }), Object.defineProperty(l, "level", { + get: w, + set: P + }); + const p = { + transmit: R, + serialize: ne, + asObject: U.browser.asObject, + levels: E, + timestamp: x(U) + }; + l.levels = i.levels, l.level = b, l.setMaxListeners = l.getMaxListeners = l.emit = l.addListener = l.on = l.prependListener = l.once = l.prependOnceListener = l.removeListener = l.removeAllListeners = l.listeners = l.listenerCount = l.eventNames = l.write = l.flush = D, l.serializers = J, l._serialize = ne, l._stdErrSerialize = K, l.child = _, R && (l._logEvent = g()); + function m() { + return this.level === "silent" ? 1 / 0 : this.levels.values[this.level]; + } + function w() { + return this._level; + } + function P(y) { + if (y !== "silent" && !this.levels.values[y]) + throw Error("unknown level " + y); + this._level = y, s(p, l, "error", "log"), s(p, l, "fatal", "error"), s(p, l, "warn", "error"), s(p, l, "info", "log"), s(p, l, "debug", "log"), s(p, l, "trace", "log"); + } + function _(y, M) { + if (!y) + throw new Error("missing bindings for child Pino"); + M = M || {}, ne && y.serializers && (M.serializers = y.serializers); + const I = M.serializers; + if (ne && I) { + var q = Object.assign({}, J, I), ce = U.browser.serialize === !0 ? Object.keys(q) : ne; + delete y.serializers, f([y], ce, q, this._stdErrSerialize); + } + function L(oe) { + this._childLevel = (oe._childLevel | 0) + 1, this.error = u(oe, y, "error"), this.fatal = u(oe, y, "fatal"), this.warn = u(oe, y, "warn"), this.info = u(oe, y, "info"), this.debug = u(oe, y, "debug"), this.trace = u(oe, y, "trace"), q && (this.serializers = q, this._serialize = ce), R && (this._logEvent = g( + [].concat(oe._logEvent.bindings, y) + )); + } + return L.prototype = this, new L(this); + } + return l; + } + i.levels = { + values: { + fatal: 60, + error: 50, + warn: 40, + info: 30, + debug: 20, + trace: 10 + }, + labels: { + 10: "trace", + 20: "debug", + 30: "info", + 40: "warn", + 50: "error", + 60: "fatal" + } + }, i.stdSerializers = r, i.stdTimeFunctions = Object.assign({}, { nullTime: $, epochTime: N, unixTime: z, isoTime: k }); + function s(U, R, W, J) { + const ne = Object.getPrototypeOf(R); + R[W] = R.levelVal > R.levels.values[W] ? D : ne[W] ? ne[W] : e[W] || e[J] || D, o(U, R, W); + } + function o(U, R, W) { + !U.transmit && R[W] === D || (R[W] = /* @__PURE__ */ (function(J) { + return function() { + const K = U.timestamp(), E = new Array(arguments.length), b = Object.getPrototypeOf && Object.getPrototypeOf(this) === e ? e : this; + for (var l = 0; l < E.length; l++) E[l] = arguments[l]; + if (U.serialize && !U.asObject && f(E, this._serialize, this.serializers, this._stdErrSerialize), U.asObject ? J.call(b, a(this, W, E, K)) : J.apply(b, E), U.transmit) { + const p = U.transmit.level || R.level, m = i.levels.values[p], w = i.levels.values[W]; + if (w < m) return; + h(this, { + ts: K, + methodLevel: W, + methodValue: w, + transmitValue: i.levels.values[U.transmit.level || R.level], + send: U.transmit.send, + val: R.levelVal + }, E); + } + }; + })(R[W])); + } + function a(U, R, W, J) { + U._serialize && f(W, U._serialize, U.serializers, U._stdErrSerialize); + const ne = W.slice(); + let K = ne[0]; + const E = {}; + J && (E.time = J), E.level = i.levels.values[R]; + let b = (U._childLevel | 0) + 1; + if (b < 1 && (b = 1), K !== null && typeof K == "object") { + for (; b-- && typeof ne[0] == "object"; ) + Object.assign(E, ne.shift()); + K = ne.length ? t(ne.shift(), ne) : void 0; + } else typeof K == "string" && (K = t(ne.shift(), ne)); + return K !== void 0 && (E.msg = K), E; + } + function f(U, R, W, J) { + for (const ne in U) + if (J && U[ne] instanceof Error) + U[ne] = i.stdSerializers.err(U[ne]); + else if (typeof U[ne] == "object" && !Array.isArray(U[ne])) + for (const K in U[ne]) + R && R.indexOf(K) > -1 && K in W && (U[ne][K] = W[K](U[ne][K])); + } + function u(U, R, W) { + return function() { + const J = new Array(1 + arguments.length); + J[0] = R; + for (var ne = 1; ne < J.length; ne++) + J[ne] = arguments[ne - 1]; + return U[W].apply(this, J); + }; + } + function h(U, R, W) { + const J = R.send, ne = R.ts, K = R.methodLevel, E = R.methodValue, b = R.val, l = U._logEvent.bindings; + f( + W, + U._serialize || Object.keys(U.serializers), + U.serializers, + U._stdErrSerialize === void 0 ? !0 : U._stdErrSerialize + ), U._logEvent.ts = ne, U._logEvent.messages = W.filter(function(p) { + return l.indexOf(p) === -1; + }), U._logEvent.level.label = K, U._logEvent.level.value = E, J(K, U._logEvent, b), U._logEvent = g(l); + } + function g(U) { + return { + ts: 0, + messages: [], + bindings: U || [], + level: { label: "", value: 0 } + }; + } + function v(U) { + const R = { + type: U.constructor.name, + msg: U.message, + stack: U.stack + }; + for (const W in U) + R[W] === void 0 && (R[W] = U[W]); + return R; + } + function x(U) { + return typeof U.timestamp == "function" ? U.timestamp : U.timestamp === !1 ? $ : N; + } + function S() { + return {}; + } + function C(U) { + return U; + } + function D() { + } + function $() { + return !1; + } + function N() { + return Date.now(); + } + function z() { + return Math.round(Date.now() / 1e3); + } + function k() { + return new Date(Date.now()).toISOString(); + } + function B() { + function U(R) { + return typeof R < "u" && R; + } + try { + return typeof globalThis < "u" || Object.defineProperty(Object.prototype, "globalThis", { + get: function() { + return delete Object.prototype.globalThis, this.globalThis = this; + }, + configurable: !0 + }), globalThis; + } catch { + return U(self) || U(window) || U(this) || {}; + } + } + return Zp; +} +var yc = KL(); +const Xf = /* @__PURE__ */ Hi(yc), VL = { level: "info" }, Zf = "custom_context", h1 = 1e3 * 1024; +let GL = class { + constructor(e) { + this.nodeValue = e, this.sizeInBytes = new TextEncoder().encode(this.nodeValue).length, this.next = null; + } + get value() { + return this.nodeValue; + } + get size() { + return this.sizeInBytes; + } +}, b2 = class { + constructor(e) { + this.head = null, this.tail = null, this.lengthInNodes = 0, this.maxSizeInBytes = e, this.sizeInBytes = 0; + } + append(e) { + const r = new GL(e); + if (r.size > this.maxSizeInBytes) throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`); + for (; this.size + r.size > this.maxSizeInBytes; ) this.shift(); + this.head ? (this.tail && (this.tail.next = r), this.tail = r) : (this.head = r, this.tail = r), this.lengthInNodes++, this.sizeInBytes += r.size; + } + shift() { + if (!this.head) return; + const e = this.head; + this.head = this.head.next, this.head || (this.tail = null), this.lengthInNodes--, this.sizeInBytes -= e.size; + } + toArray() { + const e = []; + let r = this.head; + for (; r !== null; ) e.push(r.value), r = r.next; + return e; + } + get length() { + return this.lengthInNodes; + } + get size() { + return this.sizeInBytes; + } + toOrderedArray() { + return Array.from(this); + } + [Symbol.iterator]() { + let e = this.head; + return { next: () => { + if (!e) return { done: !0, value: null }; + const r = e.value; + return e = e.next, { done: !1, value: r }; + } }; + } +}, J4 = class { + constructor(e, r = h1) { + this.level = e ?? "error", this.levelValue = yc.levels.values[this.level], this.MAX_LOG_SIZE_IN_BYTES = r, this.logs = new b2(this.MAX_LOG_SIZE_IN_BYTES); + } + forwardToConsole(e, r) { + r === yc.levels.values.error ? console.error(e) : r === yc.levels.values.warn ? console.warn(e) : r === yc.levels.values.debug ? console.debug(e) : r === yc.levels.values.trace ? console.trace(e) : console.log(e); + } + appendToLogs(e) { + this.logs.append(ho({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), log: e })); + const r = typeof e == "string" ? JSON.parse(e).level : e.level; + r >= this.levelValue && this.forwardToConsole(e, r); + } + getLogs() { + return this.logs; + } + clearLogs() { + this.logs = new b2(this.MAX_LOG_SIZE_IN_BYTES); + } + getLogArray() { + return Array.from(this.logs); + } + logsToBlob(e) { + const r = this.getLogArray(); + return r.push(ho({ extraMetadata: e })), new Blob(r, { type: "application/json" }); + } +}, YL = class { + constructor(e, r = h1) { + this.baseChunkLogger = new J4(e, r); + } + write(e) { + this.baseChunkLogger.appendToLogs(e); + } + getLogs() { + return this.baseChunkLogger.getLogs(); + } + clearLogs() { + this.baseChunkLogger.clearLogs(); + } + getLogArray() { + return this.baseChunkLogger.getLogArray(); + } + logsToBlob(e) { + return this.baseChunkLogger.logsToBlob(e); + } + downloadLogsBlobInBrowser(e) { + const r = URL.createObjectURL(this.logsToBlob(e)), n = document.createElement("a"); + n.href = r, n.download = `walletconnect-logs-${(/* @__PURE__ */ new Date()).toISOString()}.txt`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(r); + } +}, JL = class { + constructor(e, r = h1) { + this.baseChunkLogger = new J4(e, r); + } + write(e) { + this.baseChunkLogger.appendToLogs(e); + } + getLogs() { + return this.baseChunkLogger.getLogs(); + } + clearLogs() { + this.baseChunkLogger.clearLogs(); + } + getLogArray() { + return this.baseChunkLogger.getLogArray(); + } + logsToBlob(e) { + return this.baseChunkLogger.logsToBlob(e); + } +}; +var XL = Object.defineProperty, ZL = Object.defineProperties, QL = Object.getOwnPropertyDescriptors, y2 = Object.getOwnPropertySymbols, ek = Object.prototype.hasOwnProperty, tk = Object.prototype.propertyIsEnumerable, w2 = (t, e, r) => e in t ? XL(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, dd = (t, e) => { + for (var r in e || (e = {})) ek.call(e, r) && w2(t, r, e[r]); + if (y2) for (var r of y2(e)) tk.call(e, r) && w2(t, r, e[r]); + return t; +}, pd = (t, e) => ZL(t, QL(e)); +function Vd(t) { + return pd(dd({}, t), { level: t?.level || VL.level }); +} +function rk(t, e = Zf) { + return t[e] || ""; +} +function nk(t, e, r = Zf) { + return t[r] = e, t; +} +function mi(t, e = Zf) { + let r = ""; + return typeof t.bindings > "u" ? r = rk(t, e) : r = t.bindings().context || "", r; +} +function ik(t, e, r = Zf) { + const n = mi(t, r); + return n.trim() ? `${n}/${e}` : e; +} +function ri(t, e, r = Zf) { + const n = ik(t, e, r), i = t.child({ context: n }); + return nk(i, n, r); +} +function sk(t) { + var e, r; + const n = new YL((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); + return { logger: Xf(pd(dd({}, t.opts), { level: "trace", browser: pd(dd({}, (r = t.opts) == null ? void 0 : r.browser), { write: (i) => n.write(i) }) })), chunkLoggerController: n }; +} +function ok(t) { + var e; + const r = new JL((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); + return { logger: Xf(pd(dd({}, t.opts), { level: "trace" }), r), chunkLoggerController: r }; +} +function ak(t) { + return typeof t.loggerOverride < "u" && typeof t.loggerOverride != "string" ? { logger: t.loggerOverride, chunkLoggerController: null } : typeof window < "u" ? sk(t) : ok(t); +} +let ck = class extends za { + constructor(e) { + super(), this.opts = e, this.protocol = "wc", this.version = 2; + } +}, uk = class extends za { + constructor(e, r) { + super(), this.core = e, this.logger = r, this.records = /* @__PURE__ */ new Map(); + } +}, fk = class { + constructor(e, r) { + this.logger = e, this.core = r; + } +}, lk = class extends za { + constructor(e, r) { + super(), this.relayer = e, this.logger = r; + } +}, hk = class extends za { + constructor(e) { + super(); + } +}, dk = class { + constructor(e, r, n, i) { + this.core = e, this.logger = r, this.name = n; + } +}, pk = class extends za { + constructor(e, r) { + super(), this.relayer = e, this.logger = r; + } +}, gk = class extends za { + constructor(e, r) { + super(), this.core = e, this.logger = r; + } +}, mk = class { + constructor(e, r, n) { + this.core = e, this.logger = r, this.store = n; + } +}, vk = class { + constructor(e, r) { + this.projectId = e, this.logger = r; + } +}, bk = class { + constructor(e, r, n) { + this.core = e, this.logger = r, this.telemetryEnabled = n; + } +}, yk = class { + constructor(e) { + this.opts = e, this.protocol = "wc", this.version = 2; + } +}, wk = class { + constructor(e) { + this.client = e; + } +}; +var Qp = {}, eg = {}, Mu = {}, Iu = {}, x2; +function xk() { + if (x2) return Iu; + x2 = 1, Object.defineProperty(Iu, "__esModule", { value: !0 }), Iu.BrowserRandomSource = void 0; + const t = 65536; + class e { + constructor() { + this.isAvailable = !1, this.isInstantiated = !1; + const n = typeof self < "u" ? self.crypto || self.msCrypto : null; + n && n.getRandomValues !== void 0 && (this._crypto = n, this.isAvailable = !0, this.isInstantiated = !0); + } + randomBytes(n) { + if (!this.isAvailable || !this._crypto) + throw new Error("Browser random byte generator is not available."); + const i = new Uint8Array(n); + for (let s = 0; s < i.length; s += t) + this._crypto.getRandomValues(i.subarray(s, s + Math.min(i.length - s, t))); + return i; + } + } + return Iu.BrowserRandomSource = e, Iu; +} +function X4(t) { + throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); +} +var Cu = {}, bh = {}, _2; +function ls() { + if (_2) return bh; + _2 = 1, Object.defineProperty(bh, "__esModule", { value: !0 }); + function t(e) { + for (var r = 0; r < e.length; r++) + e[r] = 0; + return e; + } + return bh.wipe = t, bh; +} +const _k = {}, Ek = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: _k +}, Symbol.toStringTag, { value: "Module" })), Qf = /* @__PURE__ */ K5(Ek); +var E2; +function Sk() { + if (E2) return Cu; + E2 = 1, Object.defineProperty(Cu, "__esModule", { value: !0 }), Cu.NodeRandomSource = void 0; + const t = ls(); + class e { + constructor() { + if (this.isAvailable = !1, this.isInstantiated = !1, typeof X4 < "u") { + const n = Qf; + n && n.randomBytes && (this._crypto = n, this.isAvailable = !0, this.isInstantiated = !0); + } + } + randomBytes(n) { + if (!this.isAvailable || !this._crypto) + throw new Error("Node.js random byte generator is not available."); + let i = this._crypto.randomBytes(n); + if (i.length !== n) + throw new Error("NodeRandomSource: got fewer bytes than requested"); + const s = new Uint8Array(n); + for (let o = 0; o < s.length; o++) + s[o] = i[o]; + return (0, t.wipe)(i), s; + } + } + return Cu.NodeRandomSource = e, Cu; +} +var S2; +function Ak() { + if (S2) return Mu; + S2 = 1, Object.defineProperty(Mu, "__esModule", { value: !0 }), Mu.SystemRandomSource = void 0; + const t = xk(), e = Sk(); + class r { + constructor() { + if (this.isAvailable = !1, this.name = "", this._source = new t.BrowserRandomSource(), this._source.isAvailable) { + this.isAvailable = !0, this.name = "Browser"; + return; + } + if (this._source = new e.NodeRandomSource(), this._source.isAvailable) { + this.isAvailable = !0, this.name = "Node"; + return; + } + } + randomBytes(i) { + if (!this.isAvailable) + throw new Error("System random byte generator is not available."); + return this._source.randomBytes(i); + } + } + return Mu.SystemRandomSource = r, Mu; +} +var dr = {}, tg = {}, A2; +function Pk() { + return A2 || (A2 = 1, (function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }); + function e(a, f) { + var u = a >>> 16 & 65535, h = a & 65535, g = f >>> 16 & 65535, v = f & 65535; + return h * v + (u * v + h * g << 16 >>> 0) | 0; + } + t.mul = Math.imul || e; + function r(a, f) { + return a + f | 0; + } + t.add = r; + function n(a, f) { + return a - f | 0; + } + t.sub = n; + function i(a, f) { + return a << f | a >>> 32 - f; + } + t.rotl = i; + function s(a, f) { + return a << 32 - f | a >>> f; + } + t.rotr = s; + function o(a) { + return typeof a == "number" && isFinite(a) && Math.floor(a) === a; + } + t.isInteger = Number.isInteger || o, t.MAX_SAFE_INTEGER = 9007199254740991, t.isSafeInteger = function(a) { + return t.isInteger(a) && a >= -t.MAX_SAFE_INTEGER && a <= t.MAX_SAFE_INTEGER; + }; + })(tg)), tg; +} +var P2; +function el() { + if (P2) return dr; + P2 = 1, Object.defineProperty(dr, "__esModule", { value: !0 }); + var t = Pk(); + function e(p, m) { + return m === void 0 && (m = 0), (p[m + 0] << 8 | p[m + 1]) << 16 >> 16; + } + dr.readInt16BE = e; + function r(p, m) { + return m === void 0 && (m = 0), (p[m + 0] << 8 | p[m + 1]) >>> 0; + } + dr.readUint16BE = r; + function n(p, m) { + return m === void 0 && (m = 0), (p[m + 1] << 8 | p[m]) << 16 >> 16; + } + dr.readInt16LE = n; + function i(p, m) { + return m === void 0 && (m = 0), (p[m + 1] << 8 | p[m]) >>> 0; + } + dr.readUint16LE = i; + function s(p, m, w) { + return m === void 0 && (m = new Uint8Array(2)), w === void 0 && (w = 0), m[w + 0] = p >>> 8, m[w + 1] = p >>> 0, m; + } + dr.writeUint16BE = s, dr.writeInt16BE = s; + function o(p, m, w) { + return m === void 0 && (m = new Uint8Array(2)), w === void 0 && (w = 0), m[w + 0] = p >>> 0, m[w + 1] = p >>> 8, m; + } + dr.writeUint16LE = o, dr.writeInt16LE = o; + function a(p, m) { + return m === void 0 && (m = 0), p[m] << 24 | p[m + 1] << 16 | p[m + 2] << 8 | p[m + 3]; + } + dr.readInt32BE = a; + function f(p, m) { + return m === void 0 && (m = 0), (p[m] << 24 | p[m + 1] << 16 | p[m + 2] << 8 | p[m + 3]) >>> 0; + } + dr.readUint32BE = f; + function u(p, m) { + return m === void 0 && (m = 0), p[m + 3] << 24 | p[m + 2] << 16 | p[m + 1] << 8 | p[m]; + } + dr.readInt32LE = u; + function h(p, m) { + return m === void 0 && (m = 0), (p[m + 3] << 24 | p[m + 2] << 16 | p[m + 1] << 8 | p[m]) >>> 0; + } + dr.readUint32LE = h; + function g(p, m, w) { + return m === void 0 && (m = new Uint8Array(4)), w === void 0 && (w = 0), m[w + 0] = p >>> 24, m[w + 1] = p >>> 16, m[w + 2] = p >>> 8, m[w + 3] = p >>> 0, m; + } + dr.writeUint32BE = g, dr.writeInt32BE = g; + function v(p, m, w) { + return m === void 0 && (m = new Uint8Array(4)), w === void 0 && (w = 0), m[w + 0] = p >>> 0, m[w + 1] = p >>> 8, m[w + 2] = p >>> 16, m[w + 3] = p >>> 24, m; + } + dr.writeUint32LE = v, dr.writeInt32LE = v; + function x(p, m) { + m === void 0 && (m = 0); + var w = a(p, m), P = a(p, m + 4); + return w * 4294967296 + P - (P >> 31) * 4294967296; + } + dr.readInt64BE = x; + function S(p, m) { + m === void 0 && (m = 0); + var w = f(p, m), P = f(p, m + 4); + return w * 4294967296 + P; + } + dr.readUint64BE = S; + function C(p, m) { + m === void 0 && (m = 0); + var w = u(p, m), P = u(p, m + 4); + return P * 4294967296 + w - (w >> 31) * 4294967296; + } + dr.readInt64LE = C; + function D(p, m) { + m === void 0 && (m = 0); + var w = h(p, m), P = h(p, m + 4); + return P * 4294967296 + w; + } + dr.readUint64LE = D; + function $(p, m, w) { + return m === void 0 && (m = new Uint8Array(8)), w === void 0 && (w = 0), g(p / 4294967296 >>> 0, m, w), g(p >>> 0, m, w + 4), m; + } + dr.writeUint64BE = $, dr.writeInt64BE = $; + function N(p, m, w) { + return m === void 0 && (m = new Uint8Array(8)), w === void 0 && (w = 0), v(p >>> 0, m, w), v(p / 4294967296 >>> 0, m, w + 4), m; + } + dr.writeUint64LE = N, dr.writeInt64LE = N; + function z(p, m, w) { + if (w === void 0 && (w = 0), p % 8 !== 0) + throw new Error("readUintBE supports only bitLengths divisible by 8"); + if (p / 8 > m.length - w) + throw new Error("readUintBE: array is too short for the given bitLength"); + for (var P = 0, _ = 1, y = p / 8 + w - 1; y >= w; y--) + P += m[y] * _, _ *= 256; + return P; + } + dr.readUintBE = z; + function k(p, m, w) { + if (w === void 0 && (w = 0), p % 8 !== 0) + throw new Error("readUintLE supports only bitLengths divisible by 8"); + if (p / 8 > m.length - w) + throw new Error("readUintLE: array is too short for the given bitLength"); + for (var P = 0, _ = 1, y = w; y < w + p / 8; y++) + P += m[y] * _, _ *= 256; + return P; + } + dr.readUintLE = k; + function B(p, m, w, P) { + if (w === void 0 && (w = new Uint8Array(p / 8)), P === void 0 && (P = 0), p % 8 !== 0) + throw new Error("writeUintBE supports only bitLengths divisible by 8"); + if (!t.isSafeInteger(m)) + throw new Error("writeUintBE value must be an integer"); + for (var _ = 1, y = p / 8 + P - 1; y >= P; y--) + w[y] = m / _ & 255, _ *= 256; + return w; + } + dr.writeUintBE = B; + function U(p, m, w, P) { + if (w === void 0 && (w = new Uint8Array(p / 8)), P === void 0 && (P = 0), p % 8 !== 0) + throw new Error("writeUintLE supports only bitLengths divisible by 8"); + if (!t.isSafeInteger(m)) + throw new Error("writeUintLE value must be an integer"); + for (var _ = 1, y = P; y < P + p / 8; y++) + w[y] = m / _ & 255, _ *= 256; + return w; + } + dr.writeUintLE = U; + function R(p, m) { + m === void 0 && (m = 0); + var w = new DataView(p.buffer, p.byteOffset, p.byteLength); + return w.getFloat32(m); + } + dr.readFloat32BE = R; + function W(p, m) { + m === void 0 && (m = 0); + var w = new DataView(p.buffer, p.byteOffset, p.byteLength); + return w.getFloat32(m, !0); + } + dr.readFloat32LE = W; + function J(p, m) { + m === void 0 && (m = 0); + var w = new DataView(p.buffer, p.byteOffset, p.byteLength); + return w.getFloat64(m); + } + dr.readFloat64BE = J; + function ne(p, m) { + m === void 0 && (m = 0); + var w = new DataView(p.buffer, p.byteOffset, p.byteLength); + return w.getFloat64(m, !0); + } + dr.readFloat64LE = ne; + function K(p, m, w) { + m === void 0 && (m = new Uint8Array(4)), w === void 0 && (w = 0); + var P = new DataView(m.buffer, m.byteOffset, m.byteLength); + return P.setFloat32(w, p), m; + } + dr.writeFloat32BE = K; + function E(p, m, w) { + m === void 0 && (m = new Uint8Array(4)), w === void 0 && (w = 0); + var P = new DataView(m.buffer, m.byteOffset, m.byteLength); + return P.setFloat32(w, p, !0), m; + } + dr.writeFloat32LE = E; + function b(p, m, w) { + m === void 0 && (m = new Uint8Array(8)), w === void 0 && (w = 0); + var P = new DataView(m.buffer, m.byteOffset, m.byteLength); + return P.setFloat64(w, p), m; + } + dr.writeFloat64BE = b; + function l(p, m, w) { + m === void 0 && (m = new Uint8Array(8)), w === void 0 && (w = 0); + var P = new DataView(m.buffer, m.byteOffset, m.byteLength); + return P.setFloat64(w, p, !0), m; + } + return dr.writeFloat64LE = l, dr; +} +var M2; +function d1() { + return M2 || (M2 = 1, (function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }), t.randomStringForEntropy = t.randomString = t.randomUint32 = t.randomBytes = t.defaultRandomSource = void 0; + const e = Ak(), r = el(), n = ls(); + t.defaultRandomSource = new e.SystemRandomSource(); + function i(u, h = t.defaultRandomSource) { + return h.randomBytes(u); + } + t.randomBytes = i; + function s(u = t.defaultRandomSource) { + const h = i(4, u), g = (0, r.readUint32LE)(h); + return (0, n.wipe)(h), g; + } + t.randomUint32 = s; + const o = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + function a(u, h = o, g = t.defaultRandomSource) { + if (h.length < 2) + throw new Error("randomString charset is too short"); + if (h.length > 256) + throw new Error("randomString charset is too long"); + let v = ""; + const x = h.length, S = 256 - 256 % x; + for (; u > 0; ) { + const C = i(Math.ceil(u * 256 / S), g); + for (let D = 0; D < C.length && u > 0; D++) { + const $ = C[D]; + $ < S && (v += h.charAt($ % x), u--); + } + (0, n.wipe)(C); + } + return v; + } + t.randomString = a; + function f(u, h = o, g = t.defaultRandomSource) { + const v = Math.ceil(u / (Math.log(h.length) / Math.LN2)); + return a(v, h, g); + } + t.randomStringForEntropy = f; + })(eg)), eg; +} +var rg = {}, I2; +function Mk() { + return I2 || (I2 = 1, (function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }); + var e = el(), r = ls(); + t.DIGEST_LENGTH = 64, t.BLOCK_SIZE = 128; + var n = ( + /** @class */ + (function() { + function a() { + this.digestLength = t.DIGEST_LENGTH, this.blockSize = t.BLOCK_SIZE, this._stateHi = new Int32Array(8), this._stateLo = new Int32Array(8), this._tempHi = new Int32Array(16), this._tempLo = new Int32Array(16), this._buffer = new Uint8Array(256), this._bufferLength = 0, this._bytesHashed = 0, this._finished = !1, this.reset(); + } + return a.prototype._initState = function() { + this._stateHi[0] = 1779033703, this._stateHi[1] = 3144134277, this._stateHi[2] = 1013904242, this._stateHi[3] = 2773480762, this._stateHi[4] = 1359893119, this._stateHi[5] = 2600822924, this._stateHi[6] = 528734635, this._stateHi[7] = 1541459225, this._stateLo[0] = 4089235720, this._stateLo[1] = 2227873595, this._stateLo[2] = 4271175723, this._stateLo[3] = 1595750129, this._stateLo[4] = 2917565137, this._stateLo[5] = 725511199, this._stateLo[6] = 4215389547, this._stateLo[7] = 327033209; + }, a.prototype.reset = function() { + return this._initState(), this._bufferLength = 0, this._bytesHashed = 0, this._finished = !1, this; + }, a.prototype.clean = function() { + r.wipe(this._buffer), r.wipe(this._tempHi), r.wipe(this._tempLo), this.reset(); + }, a.prototype.update = function(f, u) { + if (u === void 0 && (u = f.length), this._finished) + throw new Error("SHA512: can't update because hash was finished."); + var h = 0; + if (this._bytesHashed += u, this._bufferLength > 0) { + for (; this._bufferLength < t.BLOCK_SIZE && u > 0; ) + this._buffer[this._bufferLength++] = f[h++], u--; + this._bufferLength === this.blockSize && (s(this._tempHi, this._tempLo, this._stateHi, this._stateLo, this._buffer, 0, this.blockSize), this._bufferLength = 0); + } + for (u >= this.blockSize && (h = s(this._tempHi, this._tempLo, this._stateHi, this._stateLo, f, h, u), u %= this.blockSize); u > 0; ) + this._buffer[this._bufferLength++] = f[h++], u--; + return this; + }, a.prototype.finish = function(f) { + if (!this._finished) { + var u = this._bytesHashed, h = this._bufferLength, g = u / 536870912 | 0, v = u << 3, x = u % 128 < 112 ? 128 : 256; + this._buffer[h] = 128; + for (var S = h + 1; S < x - 8; S++) + this._buffer[S] = 0; + e.writeUint32BE(g, this._buffer, x - 8), e.writeUint32BE(v, this._buffer, x - 4), s(this._tempHi, this._tempLo, this._stateHi, this._stateLo, this._buffer, 0, x), this._finished = !0; + } + for (var S = 0; S < this.digestLength / 8; S++) + e.writeUint32BE(this._stateHi[S], f, S * 8), e.writeUint32BE(this._stateLo[S], f, S * 8 + 4); + return this; + }, a.prototype.digest = function() { + var f = new Uint8Array(this.digestLength); + return this.finish(f), f; + }, a.prototype.saveState = function() { + if (this._finished) + throw new Error("SHA256: cannot save finished state"); + return { + stateHi: new Int32Array(this._stateHi), + stateLo: new Int32Array(this._stateLo), + buffer: this._bufferLength > 0 ? new Uint8Array(this._buffer) : void 0, + bufferLength: this._bufferLength, + bytesHashed: this._bytesHashed + }; + }, a.prototype.restoreState = function(f) { + return this._stateHi.set(f.stateHi), this._stateLo.set(f.stateLo), this._bufferLength = f.bufferLength, f.buffer && this._buffer.set(f.buffer), this._bytesHashed = f.bytesHashed, this._finished = !1, this; + }, a.prototype.cleanSavedState = function(f) { + r.wipe(f.stateHi), r.wipe(f.stateLo), f.buffer && r.wipe(f.buffer), f.bufferLength = 0, f.bytesHashed = 0; + }, a; + })() + ); + t.SHA512 = n; + var i = new Int32Array([ + 1116352408, + 3609767458, + 1899447441, + 602891725, + 3049323471, + 3964484399, + 3921009573, + 2173295548, + 961987163, + 4081628472, + 1508970993, + 3053834265, + 2453635748, + 2937671579, + 2870763221, + 3664609560, + 3624381080, + 2734883394, + 310598401, + 1164996542, + 607225278, + 1323610764, + 1426881987, + 3590304994, + 1925078388, + 4068182383, + 2162078206, + 991336113, + 2614888103, + 633803317, + 3248222580, + 3479774868, + 3835390401, + 2666613458, + 4022224774, + 944711139, + 264347078, + 2341262773, + 604807628, + 2007800933, + 770255983, + 1495990901, + 1249150122, + 1856431235, + 1555081692, + 3175218132, + 1996064986, + 2198950837, + 2554220882, + 3999719339, + 2821834349, + 766784016, + 2952996808, + 2566594879, + 3210313671, + 3203337956, + 3336571891, + 1034457026, + 3584528711, + 2466948901, + 113926993, + 3758326383, + 338241895, + 168717936, + 666307205, + 1188179964, + 773529912, + 1546045734, + 1294757372, + 1522805485, + 1396182291, + 2643833823, + 1695183700, + 2343527390, + 1986661051, + 1014477480, + 2177026350, + 1206759142, + 2456956037, + 344077627, + 2730485921, + 1290863460, + 2820302411, + 3158454273, + 3259730800, + 3505952657, + 3345764771, + 106217008, + 3516065817, + 3606008344, + 3600352804, + 1432725776, + 4094571909, + 1467031594, + 275423344, + 851169720, + 430227734, + 3100823752, + 506948616, + 1363258195, + 659060556, + 3750685593, + 883997877, + 3785050280, + 958139571, + 3318307427, + 1322822218, + 3812723403, + 1537002063, + 2003034995, + 1747873779, + 3602036899, + 1955562222, + 1575990012, + 2024104815, + 1125592928, + 2227730452, + 2716904306, + 2361852424, + 442776044, + 2428436474, + 593698344, + 2756734187, + 3733110249, + 3204031479, + 2999351573, + 3329325298, + 3815920427, + 3391569614, + 3928383900, + 3515267271, + 566280711, + 3940187606, + 3454069534, + 4118630271, + 4000239992, + 116418474, + 1914138554, + 174292421, + 2731055270, + 289380356, + 3203993006, + 460393269, + 320620315, + 685471733, + 587496836, + 852142971, + 1086792851, + 1017036298, + 365543100, + 1126000580, + 2618297676, + 1288033470, + 3409855158, + 1501505948, + 4234509866, + 1607167915, + 987167468, + 1816402316, + 1246189591 + ]); + function s(a, f, u, h, g, v, x) { + for (var S = u[0], C = u[1], D = u[2], $ = u[3], N = u[4], z = u[5], k = u[6], B = u[7], U = h[0], R = h[1], W = h[2], J = h[3], ne = h[4], K = h[5], E = h[6], b = h[7], l, p, m, w, P, _, y, M; x >= 128; ) { + for (var I = 0; I < 16; I++) { + var q = 8 * I + v; + a[I] = e.readUint32BE(g, q), f[I] = e.readUint32BE(g, q + 4); + } + for (var I = 0; I < 80; I++) { + var ce = S, L = C, oe = D, Q = $, X = N, ee = z, O = k, Z = B, re = U, he = R, ae = W, fe = J, be = ne, Ae = K, Te = E, Re = b; + if (l = B, p = b, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = (N >>> 14 | ne << 18) ^ (N >>> 18 | ne << 14) ^ (ne >>> 9 | N << 23), p = (ne >>> 14 | N << 18) ^ (ne >>> 18 | N << 14) ^ (N >>> 9 | ne << 23), P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = N & z ^ ~N & k, p = ne & K ^ ~ne & E, P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = i[I * 2], p = i[I * 2 + 1], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = a[I % 16], p = f[I % 16], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, m = y & 65535 | M << 16, w = P & 65535 | _ << 16, l = m, p = w, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = (S >>> 28 | U << 4) ^ (U >>> 2 | S << 30) ^ (U >>> 7 | S << 25), p = (U >>> 28 | S << 4) ^ (S >>> 2 | U << 30) ^ (S >>> 7 | U << 25), P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = S & C ^ S & D ^ C & D, p = U & R ^ U & W ^ R & W, P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, Z = y & 65535 | M << 16, Re = P & 65535 | _ << 16, l = Q, p = fe, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = m, p = w, P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, Q = y & 65535 | M << 16, fe = P & 65535 | _ << 16, C = ce, D = L, $ = oe, N = Q, z = X, k = ee, B = O, S = Z, R = re, W = he, J = ae, ne = fe, K = be, E = Ae, b = Te, U = Re, I % 16 === 15) + for (var q = 0; q < 16; q++) + l = a[q], p = f[q], P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = a[(q + 9) % 16], p = f[(q + 9) % 16], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, m = a[(q + 1) % 16], w = f[(q + 1) % 16], l = (m >>> 1 | w << 31) ^ (m >>> 8 | w << 24) ^ m >>> 7, p = (w >>> 1 | m << 31) ^ (w >>> 8 | m << 24) ^ (w >>> 7 | m << 25), P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, m = a[(q + 14) % 16], w = f[(q + 14) % 16], l = (m >>> 19 | w << 13) ^ (w >>> 29 | m << 3) ^ m >>> 6, p = (w >>> 19 | m << 13) ^ (m >>> 29 | w << 3) ^ (w >>> 6 | m << 26), P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, a[q] = y & 65535 | M << 16, f[q] = P & 65535 | _ << 16; + } + l = S, p = U, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[0], p = h[0], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[0] = S = y & 65535 | M << 16, h[0] = U = P & 65535 | _ << 16, l = C, p = R, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[1], p = h[1], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[1] = C = y & 65535 | M << 16, h[1] = R = P & 65535 | _ << 16, l = D, p = W, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[2], p = h[2], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[2] = D = y & 65535 | M << 16, h[2] = W = P & 65535 | _ << 16, l = $, p = J, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[3], p = h[3], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[3] = $ = y & 65535 | M << 16, h[3] = J = P & 65535 | _ << 16, l = N, p = ne, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[4], p = h[4], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[4] = N = y & 65535 | M << 16, h[4] = ne = P & 65535 | _ << 16, l = z, p = K, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[5], p = h[5], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[5] = z = y & 65535 | M << 16, h[5] = K = P & 65535 | _ << 16, l = k, p = E, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[6], p = h[6], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[6] = k = y & 65535 | M << 16, h[6] = E = P & 65535 | _ << 16, l = B, p = b, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[7], p = h[7], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[7] = B = y & 65535 | M << 16, h[7] = b = P & 65535 | _ << 16, v += 128, x -= 128; + } + return v; + } + function o(a) { + var f = new n(); + f.update(a); + var u = f.digest(); + return f.clean(), u; + } + t.hash = o; + })(rg)), rg; +} +var C2; +function Ik() { + return C2 || (C2 = 1, (function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }), t.convertSecretKeyToX25519 = t.convertPublicKeyToX25519 = t.verify = t.sign = t.extractPublicKeyFromSecretKey = t.generateKeyPair = t.generateKeyPairFromSeed = t.SEED_LENGTH = t.SECRET_KEY_LENGTH = t.PUBLIC_KEY_LENGTH = t.SIGNATURE_LENGTH = void 0; + const e = d1(), r = Mk(), n = ls(); + t.SIGNATURE_LENGTH = 64, t.PUBLIC_KEY_LENGTH = 32, t.SECRET_KEY_LENGTH = 64, t.SEED_LENGTH = 32; + function i(Q) { + const X = new Float64Array(16); + if (Q) + for (let ee = 0; ee < Q.length; ee++) + X[ee] = Q[ee]; + return X; + } + const s = new Uint8Array(32); + s[0] = 9; + const o = i(), a = i([1]), f = i([ + 30883, + 4953, + 19914, + 30187, + 55467, + 16705, + 2637, + 112, + 59544, + 30585, + 16505, + 36039, + 65139, + 11119, + 27886, + 20995 + ]), u = i([ + 61785, + 9906, + 39828, + 60374, + 45398, + 33411, + 5274, + 224, + 53552, + 61171, + 33010, + 6542, + 64743, + 22239, + 55772, + 9222 + ]), h = i([ + 54554, + 36645, + 11616, + 51542, + 42930, + 38181, + 51040, + 26924, + 56412, + 64982, + 57905, + 49316, + 21502, + 52590, + 14035, + 8553 + ]), g = i([ + 26200, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214 + ]), v = i([ + 41136, + 18958, + 6951, + 50414, + 58488, + 44335, + 6150, + 12099, + 55207, + 15867, + 153, + 11085, + 57099, + 20417, + 9344, + 11139 + ]); + function x(Q, X) { + for (let ee = 0; ee < 16; ee++) + Q[ee] = X[ee] | 0; + } + function S(Q) { + let X = 1; + for (let ee = 0; ee < 16; ee++) { + let O = Q[ee] + X + 65535; + X = Math.floor(O / 65536), Q[ee] = O - X * 65536; + } + Q[0] += X - 1 + 37 * (X - 1); + } + function C(Q, X, ee) { + const O = ~(ee - 1); + for (let Z = 0; Z < 16; Z++) { + const re = O & (Q[Z] ^ X[Z]); + Q[Z] ^= re, X[Z] ^= re; + } + } + function D(Q, X) { + const ee = i(), O = i(); + for (let Z = 0; Z < 16; Z++) + O[Z] = X[Z]; + S(O), S(O), S(O); + for (let Z = 0; Z < 2; Z++) { + ee[0] = O[0] - 65517; + for (let he = 1; he < 15; he++) + ee[he] = O[he] - 65535 - (ee[he - 1] >> 16 & 1), ee[he - 1] &= 65535; + ee[15] = O[15] - 32767 - (ee[14] >> 16 & 1); + const re = ee[15] >> 16 & 1; + ee[14] &= 65535, C(O, ee, 1 - re); + } + for (let Z = 0; Z < 16; Z++) + Q[2 * Z] = O[Z] & 255, Q[2 * Z + 1] = O[Z] >> 8; + } + function $(Q, X) { + let ee = 0; + for (let O = 0; O < 32; O++) + ee |= Q[O] ^ X[O]; + return (1 & ee - 1 >>> 8) - 1; + } + function N(Q, X) { + const ee = new Uint8Array(32), O = new Uint8Array(32); + return D(ee, Q), D(O, X), $(ee, O); + } + function z(Q) { + const X = new Uint8Array(32); + return D(X, Q), X[0] & 1; + } + function k(Q, X) { + for (let ee = 0; ee < 16; ee++) + Q[ee] = X[2 * ee] + (X[2 * ee + 1] << 8); + Q[15] &= 32767; + } + function B(Q, X, ee) { + for (let O = 0; O < 16; O++) + Q[O] = X[O] + ee[O]; + } + function U(Q, X, ee) { + for (let O = 0; O < 16; O++) + Q[O] = X[O] - ee[O]; + } + function R(Q, X, ee) { + let O, Z, re = 0, he = 0, ae = 0, fe = 0, be = 0, Ae = 0, Te = 0, Re = 0, $e = 0, Me = 0, Oe = 0, ze = 0, De = 0, je = 0, Ue = 0, _e = 0, Ze = 0, ot = 0, ke = 0, rt = 0, nt = 0, Ge = 0, ht = 0, lt = 0, ct = 0, qt = 0, Gt = 0, Et = 0, Yt = 0, tr = 0, Tt = 0, kt = ee[0], It = ee[1], dt = ee[2], Dt = ee[3], Nt = ee[4], mt = ee[5], Bt = ee[6], Ft = ee[7], et = ee[8], $t = ee[9], H = ee[10], V = ee[11], Y = ee[12], T = ee[13], F = ee[14], ie = ee[15]; + O = X[0], re += O * kt, he += O * It, ae += O * dt, fe += O * Dt, be += O * Nt, Ae += O * mt, Te += O * Bt, Re += O * Ft, $e += O * et, Me += O * $t, Oe += O * H, ze += O * V, De += O * Y, je += O * T, Ue += O * F, _e += O * ie, O = X[1], he += O * kt, ae += O * It, fe += O * dt, be += O * Dt, Ae += O * Nt, Te += O * mt, Re += O * Bt, $e += O * Ft, Me += O * et, Oe += O * $t, ze += O * H, De += O * V, je += O * Y, Ue += O * T, _e += O * F, Ze += O * ie, O = X[2], ae += O * kt, fe += O * It, be += O * dt, Ae += O * Dt, Te += O * Nt, Re += O * mt, $e += O * Bt, Me += O * Ft, Oe += O * et, ze += O * $t, De += O * H, je += O * V, Ue += O * Y, _e += O * T, Ze += O * F, ot += O * ie, O = X[3], fe += O * kt, be += O * It, Ae += O * dt, Te += O * Dt, Re += O * Nt, $e += O * mt, Me += O * Bt, Oe += O * Ft, ze += O * et, De += O * $t, je += O * H, Ue += O * V, _e += O * Y, Ze += O * T, ot += O * F, ke += O * ie, O = X[4], be += O * kt, Ae += O * It, Te += O * dt, Re += O * Dt, $e += O * Nt, Me += O * mt, Oe += O * Bt, ze += O * Ft, De += O * et, je += O * $t, Ue += O * H, _e += O * V, Ze += O * Y, ot += O * T, ke += O * F, rt += O * ie, O = X[5], Ae += O * kt, Te += O * It, Re += O * dt, $e += O * Dt, Me += O * Nt, Oe += O * mt, ze += O * Bt, De += O * Ft, je += O * et, Ue += O * $t, _e += O * H, Ze += O * V, ot += O * Y, ke += O * T, rt += O * F, nt += O * ie, O = X[6], Te += O * kt, Re += O * It, $e += O * dt, Me += O * Dt, Oe += O * Nt, ze += O * mt, De += O * Bt, je += O * Ft, Ue += O * et, _e += O * $t, Ze += O * H, ot += O * V, ke += O * Y, rt += O * T, nt += O * F, Ge += O * ie, O = X[7], Re += O * kt, $e += O * It, Me += O * dt, Oe += O * Dt, ze += O * Nt, De += O * mt, je += O * Bt, Ue += O * Ft, _e += O * et, Ze += O * $t, ot += O * H, ke += O * V, rt += O * Y, nt += O * T, Ge += O * F, ht += O * ie, O = X[8], $e += O * kt, Me += O * It, Oe += O * dt, ze += O * Dt, De += O * Nt, je += O * mt, Ue += O * Bt, _e += O * Ft, Ze += O * et, ot += O * $t, ke += O * H, rt += O * V, nt += O * Y, Ge += O * T, ht += O * F, lt += O * ie, O = X[9], Me += O * kt, Oe += O * It, ze += O * dt, De += O * Dt, je += O * Nt, Ue += O * mt, _e += O * Bt, Ze += O * Ft, ot += O * et, ke += O * $t, rt += O * H, nt += O * V, Ge += O * Y, ht += O * T, lt += O * F, ct += O * ie, O = X[10], Oe += O * kt, ze += O * It, De += O * dt, je += O * Dt, Ue += O * Nt, _e += O * mt, Ze += O * Bt, ot += O * Ft, ke += O * et, rt += O * $t, nt += O * H, Ge += O * V, ht += O * Y, lt += O * T, ct += O * F, qt += O * ie, O = X[11], ze += O * kt, De += O * It, je += O * dt, Ue += O * Dt, _e += O * Nt, Ze += O * mt, ot += O * Bt, ke += O * Ft, rt += O * et, nt += O * $t, Ge += O * H, ht += O * V, lt += O * Y, ct += O * T, qt += O * F, Gt += O * ie, O = X[12], De += O * kt, je += O * It, Ue += O * dt, _e += O * Dt, Ze += O * Nt, ot += O * mt, ke += O * Bt, rt += O * Ft, nt += O * et, Ge += O * $t, ht += O * H, lt += O * V, ct += O * Y, qt += O * T, Gt += O * F, Et += O * ie, O = X[13], je += O * kt, Ue += O * It, _e += O * dt, Ze += O * Dt, ot += O * Nt, ke += O * mt, rt += O * Bt, nt += O * Ft, Ge += O * et, ht += O * $t, lt += O * H, ct += O * V, qt += O * Y, Gt += O * T, Et += O * F, Yt += O * ie, O = X[14], Ue += O * kt, _e += O * It, Ze += O * dt, ot += O * Dt, ke += O * Nt, rt += O * mt, nt += O * Bt, Ge += O * Ft, ht += O * et, lt += O * $t, ct += O * H, qt += O * V, Gt += O * Y, Et += O * T, Yt += O * F, tr += O * ie, O = X[15], _e += O * kt, Ze += O * It, ot += O * dt, ke += O * Dt, rt += O * Nt, nt += O * mt, Ge += O * Bt, ht += O * Ft, lt += O * et, ct += O * $t, qt += O * H, Gt += O * V, Et += O * Y, Yt += O * T, tr += O * F, Tt += O * ie, re += 38 * Ze, he += 38 * ot, ae += 38 * ke, fe += 38 * rt, be += 38 * nt, Ae += 38 * Ge, Te += 38 * ht, Re += 38 * lt, $e += 38 * ct, Me += 38 * qt, Oe += 38 * Gt, ze += 38 * Et, De += 38 * Yt, je += 38 * tr, Ue += 38 * Tt, Z = 1, O = re + Z + 65535, Z = Math.floor(O / 65536), re = O - Z * 65536, O = he + Z + 65535, Z = Math.floor(O / 65536), he = O - Z * 65536, O = ae + Z + 65535, Z = Math.floor(O / 65536), ae = O - Z * 65536, O = fe + Z + 65535, Z = Math.floor(O / 65536), fe = O - Z * 65536, O = be + Z + 65535, Z = Math.floor(O / 65536), be = O - Z * 65536, O = Ae + Z + 65535, Z = Math.floor(O / 65536), Ae = O - Z * 65536, O = Te + Z + 65535, Z = Math.floor(O / 65536), Te = O - Z * 65536, O = Re + Z + 65535, Z = Math.floor(O / 65536), Re = O - Z * 65536, O = $e + Z + 65535, Z = Math.floor(O / 65536), $e = O - Z * 65536, O = Me + Z + 65535, Z = Math.floor(O / 65536), Me = O - Z * 65536, O = Oe + Z + 65535, Z = Math.floor(O / 65536), Oe = O - Z * 65536, O = ze + Z + 65535, Z = Math.floor(O / 65536), ze = O - Z * 65536, O = De + Z + 65535, Z = Math.floor(O / 65536), De = O - Z * 65536, O = je + Z + 65535, Z = Math.floor(O / 65536), je = O - Z * 65536, O = Ue + Z + 65535, Z = Math.floor(O / 65536), Ue = O - Z * 65536, O = _e + Z + 65535, Z = Math.floor(O / 65536), _e = O - Z * 65536, re += Z - 1 + 37 * (Z - 1), Z = 1, O = re + Z + 65535, Z = Math.floor(O / 65536), re = O - Z * 65536, O = he + Z + 65535, Z = Math.floor(O / 65536), he = O - Z * 65536, O = ae + Z + 65535, Z = Math.floor(O / 65536), ae = O - Z * 65536, O = fe + Z + 65535, Z = Math.floor(O / 65536), fe = O - Z * 65536, O = be + Z + 65535, Z = Math.floor(O / 65536), be = O - Z * 65536, O = Ae + Z + 65535, Z = Math.floor(O / 65536), Ae = O - Z * 65536, O = Te + Z + 65535, Z = Math.floor(O / 65536), Te = O - Z * 65536, O = Re + Z + 65535, Z = Math.floor(O / 65536), Re = O - Z * 65536, O = $e + Z + 65535, Z = Math.floor(O / 65536), $e = O - Z * 65536, O = Me + Z + 65535, Z = Math.floor(O / 65536), Me = O - Z * 65536, O = Oe + Z + 65535, Z = Math.floor(O / 65536), Oe = O - Z * 65536, O = ze + Z + 65535, Z = Math.floor(O / 65536), ze = O - Z * 65536, O = De + Z + 65535, Z = Math.floor(O / 65536), De = O - Z * 65536, O = je + Z + 65535, Z = Math.floor(O / 65536), je = O - Z * 65536, O = Ue + Z + 65535, Z = Math.floor(O / 65536), Ue = O - Z * 65536, O = _e + Z + 65535, Z = Math.floor(O / 65536), _e = O - Z * 65536, re += Z - 1 + 37 * (Z - 1), Q[0] = re, Q[1] = he, Q[2] = ae, Q[3] = fe, Q[4] = be, Q[5] = Ae, Q[6] = Te, Q[7] = Re, Q[8] = $e, Q[9] = Me, Q[10] = Oe, Q[11] = ze, Q[12] = De, Q[13] = je, Q[14] = Ue, Q[15] = _e; + } + function W(Q, X) { + R(Q, X, X); + } + function J(Q, X) { + const ee = i(); + let O; + for (O = 0; O < 16; O++) + ee[O] = X[O]; + for (O = 253; O >= 0; O--) + W(ee, ee), O !== 2 && O !== 4 && R(ee, ee, X); + for (O = 0; O < 16; O++) + Q[O] = ee[O]; + } + function ne(Q, X) { + const ee = i(); + let O; + for (O = 0; O < 16; O++) + ee[O] = X[O]; + for (O = 250; O >= 0; O--) + W(ee, ee), O !== 1 && R(ee, ee, X); + for (O = 0; O < 16; O++) + Q[O] = ee[O]; + } + function K(Q, X) { + const ee = i(), O = i(), Z = i(), re = i(), he = i(), ae = i(), fe = i(), be = i(), Ae = i(); + U(ee, Q[1], Q[0]), U(Ae, X[1], X[0]), R(ee, ee, Ae), B(O, Q[0], Q[1]), B(Ae, X[0], X[1]), R(O, O, Ae), R(Z, Q[3], X[3]), R(Z, Z, u), R(re, Q[2], X[2]), B(re, re, re), U(he, O, ee), U(ae, re, Z), B(fe, re, Z), B(be, O, ee), R(Q[0], he, ae), R(Q[1], be, fe), R(Q[2], fe, ae), R(Q[3], he, be); + } + function E(Q, X, ee) { + for (let O = 0; O < 4; O++) + C(Q[O], X[O], ee); + } + function b(Q, X) { + const ee = i(), O = i(), Z = i(); + J(Z, X[2]), R(ee, X[0], Z), R(O, X[1], Z), D(Q, O), Q[31] ^= z(ee) << 7; + } + function l(Q, X, ee) { + x(Q[0], o), x(Q[1], a), x(Q[2], a), x(Q[3], o); + for (let O = 255; O >= 0; --O) { + const Z = ee[O / 8 | 0] >> (O & 7) & 1; + E(Q, X, Z), K(X, Q), K(Q, Q), E(Q, X, Z); + } + } + function p(Q, X) { + const ee = [i(), i(), i(), i()]; + x(ee[0], h), x(ee[1], g), x(ee[2], a), R(ee[3], h, g), l(Q, ee, X); + } + function m(Q) { + if (Q.length !== t.SEED_LENGTH) + throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`); + const X = (0, r.hash)(Q); + X[0] &= 248, X[31] &= 127, X[31] |= 64; + const ee = new Uint8Array(32), O = [i(), i(), i(), i()]; + p(O, X), b(ee, O); + const Z = new Uint8Array(64); + return Z.set(Q), Z.set(ee, 32), { + publicKey: ee, + secretKey: Z + }; + } + t.generateKeyPairFromSeed = m; + function w(Q) { + const X = (0, e.randomBytes)(32, Q), ee = m(X); + return (0, n.wipe)(X), ee; + } + t.generateKeyPair = w; + function P(Q) { + if (Q.length !== t.SECRET_KEY_LENGTH) + throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`); + return new Uint8Array(Q.subarray(32)); + } + t.extractPublicKeyFromSecretKey = P; + const _ = new Float64Array([ + 237, + 211, + 245, + 92, + 26, + 99, + 18, + 88, + 214, + 156, + 247, + 162, + 222, + 249, + 222, + 20, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 16 + ]); + function y(Q, X) { + let ee, O, Z, re; + for (O = 63; O >= 32; --O) { + for (ee = 0, Z = O - 32, re = O - 12; Z < re; ++Z) + X[Z] += ee - 16 * X[O] * _[Z - (O - 32)], ee = Math.floor((X[Z] + 128) / 256), X[Z] -= ee * 256; + X[Z] += ee, X[O] = 0; + } + for (ee = 0, Z = 0; Z < 32; Z++) + X[Z] += ee - (X[31] >> 4) * _[Z], ee = X[Z] >> 8, X[Z] &= 255; + for (Z = 0; Z < 32; Z++) + X[Z] -= ee * _[Z]; + for (O = 0; O < 32; O++) + X[O + 1] += X[O] >> 8, Q[O] = X[O] & 255; + } + function M(Q) { + const X = new Float64Array(64); + for (let ee = 0; ee < 64; ee++) + X[ee] = Q[ee]; + for (let ee = 0; ee < 64; ee++) + Q[ee] = 0; + y(Q, X); + } + function I(Q, X) { + const ee = new Float64Array(64), O = [i(), i(), i(), i()], Z = (0, r.hash)(Q.subarray(0, 32)); + Z[0] &= 248, Z[31] &= 127, Z[31] |= 64; + const re = new Uint8Array(64); + re.set(Z.subarray(32), 32); + const he = new r.SHA512(); + he.update(re.subarray(32)), he.update(X); + const ae = he.digest(); + he.clean(), M(ae), p(O, ae), b(re, O), he.reset(), he.update(re.subarray(0, 32)), he.update(Q.subarray(32)), he.update(X); + const fe = he.digest(); + M(fe); + for (let be = 0; be < 32; be++) + ee[be] = ae[be]; + for (let be = 0; be < 32; be++) + for (let Ae = 0; Ae < 32; Ae++) + ee[be + Ae] += fe[be] * Z[Ae]; + return y(re.subarray(32), ee), re; + } + t.sign = I; + function q(Q, X) { + const ee = i(), O = i(), Z = i(), re = i(), he = i(), ae = i(), fe = i(); + return x(Q[2], a), k(Q[1], X), W(Z, Q[1]), R(re, Z, f), U(Z, Z, Q[2]), B(re, Q[2], re), W(he, re), W(ae, he), R(fe, ae, he), R(ee, fe, Z), R(ee, ee, re), ne(ee, ee), R(ee, ee, Z), R(ee, ee, re), R(ee, ee, re), R(Q[0], ee, re), W(O, Q[0]), R(O, O, re), N(O, Z) && R(Q[0], Q[0], v), W(O, Q[0]), R(O, O, re), N(O, Z) ? -1 : (z(Q[0]) === X[31] >> 7 && U(Q[0], o, Q[0]), R(Q[3], Q[0], Q[1]), 0); + } + function ce(Q, X, ee) { + const O = new Uint8Array(32), Z = [i(), i(), i(), i()], re = [i(), i(), i(), i()]; + if (ee.length !== t.SIGNATURE_LENGTH) + throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`); + if (q(re, Q)) + return !1; + const he = new r.SHA512(); + he.update(ee.subarray(0, 32)), he.update(Q), he.update(X); + const ae = he.digest(); + return M(ae), l(Z, re, ae), p(re, ee.subarray(32)), K(Z, re), b(O, Z), !$(ee, O); + } + t.verify = ce; + function L(Q) { + let X = [i(), i(), i(), i()]; + if (q(X, Q)) + throw new Error("Ed25519: invalid public key"); + let ee = i(), O = i(), Z = X[1]; + B(ee, a, Z), U(O, a, Z), J(O, O), R(ee, ee, O); + let re = new Uint8Array(32); + return D(re, ee), re; + } + t.convertPublicKeyToX25519 = L; + function oe(Q) { + const X = (0, r.hash)(Q.subarray(0, 32)); + X[0] &= 248, X[31] &= 127, X[31] |= 64; + const ee = new Uint8Array(X.subarray(0, 32)); + return (0, n.wipe)(X), ee; + } + t.convertSecretKeyToX25519 = oe; + })(Qp)), Qp; +} +var Z4 = Ik(), tl = d1(); +const Ck = "EdDSA", Rk = "JWT", gd = ".", Gd = "base64url", Q4 = "utf8", e8 = "utf8", Tk = ":", Dk = "did", Ok = "key", R2 = "base58btc", Nk = "z", Lk = "K36", kk = 32; +function t8(t = 0) { + return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); +} +function $h(t, e) { + e || (e = t.reduce((i, s) => i + s.length, 0)); + const r = t8(e); + let n = 0; + for (const i of t) + r.set(i, n), n += i.length; + return r; +} +function $k(t, e) { + if (t.length >= 255) + throw new TypeError("Alphabet too long"); + for (var r = new Uint8Array(256), n = 0; n < r.length; n++) + r[n] = 255; + for (var i = 0; i < t.length; i++) { + var s = t.charAt(i), o = s.charCodeAt(0); + if (r[o] !== 255) + throw new TypeError(s + " is ambiguous"); + r[o] = i; + } + var a = t.length, f = t.charAt(0), u = Math.log(a) / Math.log(256), h = Math.log(256) / Math.log(a); + function g(S) { + if (S instanceof Uint8Array || (ArrayBuffer.isView(S) ? S = new Uint8Array(S.buffer, S.byteOffset, S.byteLength) : Array.isArray(S) && (S = Uint8Array.from(S))), !(S instanceof Uint8Array)) + throw new TypeError("Expected Uint8Array"); + if (S.length === 0) + return ""; + for (var C = 0, D = 0, $ = 0, N = S.length; $ !== N && S[$] === 0; ) + $++, C++; + for (var z = (N - $) * h + 1 >>> 0, k = new Uint8Array(z); $ !== N; ) { + for (var B = S[$], U = 0, R = z - 1; (B !== 0 || U < D) && R !== -1; R--, U++) + B += 256 * k[R] >>> 0, k[R] = B % a >>> 0, B = B / a >>> 0; + if (B !== 0) + throw new Error("Non-zero carry"); + D = U, $++; + } + for (var W = z - D; W !== z && k[W] === 0; ) + W++; + for (var J = f.repeat(C); W < z; ++W) + J += t.charAt(k[W]); + return J; + } + function v(S) { + if (typeof S != "string") + throw new TypeError("Expected String"); + if (S.length === 0) + return new Uint8Array(); + var C = 0; + if (S[C] !== " ") { + for (var D = 0, $ = 0; S[C] === f; ) + D++, C++; + for (var N = (S.length - C) * u + 1 >>> 0, z = new Uint8Array(N); S[C]; ) { + var k = r[S.charCodeAt(C)]; + if (k === 255) + return; + for (var B = 0, U = N - 1; (k !== 0 || B < $) && U !== -1; U--, B++) + k += a * z[U] >>> 0, z[U] = k % 256 >>> 0, k = k / 256 >>> 0; + if (k !== 0) + throw new Error("Non-zero carry"); + $ = B, C++; + } + if (S[C] !== " ") { + for (var R = N - $; R !== N && z[R] === 0; ) + R++; + for (var W = new Uint8Array(D + (N - R)), J = D; R !== N; ) + W[J++] = z[R++]; + return W; + } + } + } + function x(S) { + var C = v(S); + if (C) + return C; + throw new Error(`Non-${e} character`); + } + return { + encode: g, + decodeUnsafe: v, + decode: x + }; +} +var Bk = $k, Fk = Bk; +const jk = (t) => { + if (t instanceof Uint8Array && t.constructor.name === "Uint8Array") + return t; + if (t instanceof ArrayBuffer) + return new Uint8Array(t); + if (ArrayBuffer.isView(t)) + return new Uint8Array(t.buffer, t.byteOffset, t.byteLength); + throw new Error("Unknown type, must be binary type"); +}, Uk = (t) => new TextEncoder().encode(t), qk = (t) => new TextDecoder().decode(t); +class zk { + constructor(e, r, n) { + this.name = e, this.prefix = r, this.baseEncode = n; + } + encode(e) { + if (e instanceof Uint8Array) + return `${this.prefix}${this.baseEncode(e)}`; + throw Error("Unknown type, must be binary type"); + } +} +class Hk { + constructor(e, r, n) { + if (this.name = e, this.prefix = r, r.codePointAt(0) === void 0) + throw new Error("Invalid prefix character"); + this.prefixCodePoint = r.codePointAt(0), this.baseDecode = n; + } + decode(e) { + if (typeof e == "string") { + if (e.codePointAt(0) !== this.prefixCodePoint) + throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`); + return this.baseDecode(e.slice(this.prefix.length)); + } else + throw Error("Can only multibase decode strings"); + } + or(e) { + return r8(this, e); + } +} +class Wk { + constructor(e) { + this.decoders = e; + } + or(e) { + return r8(this, e); + } + decode(e) { + const r = e[0], n = this.decoders[r]; + if (n) + return n.decode(e); + throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`); + } +} +const r8 = (t, e) => new Wk({ + ...t.decoders || { [t.prefix]: t }, + ...e.decoders || { [e.prefix]: e } +}); +class Kk { + constructor(e, r, n, i) { + this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new zk(e, r, n), this.decoder = new Hk(e, r, i); + } + encode(e) { + return this.encoder.encode(e); + } + decode(e) { + return this.decoder.decode(e); + } +} +const Yd = ({ name: t, prefix: e, encode: r, decode: n }) => new Kk(t, e, r, n), rl = ({ prefix: t, name: e, alphabet: r }) => { + const { encode: n, decode: i } = Fk(r, e); + return Yd({ + prefix: t, + name: e, + encode: n, + decode: (s) => jk(i(s)) + }); +}, Vk = (t, e, r, n) => { + const i = {}; + for (let h = 0; h < e.length; ++h) + i[e[h]] = h; + let s = t.length; + for (; t[s - 1] === "="; ) + --s; + const o = new Uint8Array(s * r / 8 | 0); + let a = 0, f = 0, u = 0; + for (let h = 0; h < s; ++h) { + const g = i[t[h]]; + if (g === void 0) + throw new SyntaxError(`Non-${n} character`); + f = f << r | g, a += r, a >= 8 && (a -= 8, o[u++] = 255 & f >> a); + } + if (a >= r || 255 & f << 8 - a) + throw new SyntaxError("Unexpected end of data"); + return o; +}, Gk = (t, e, r) => { + const n = e[e.length - 1] === "=", i = (1 << r) - 1; + let s = "", o = 0, a = 0; + for (let f = 0; f < t.length; ++f) + for (a = a << 8 | t[f], o += 8; o > r; ) + o -= r, s += e[i & a >> o]; + if (o && (s += e[i & a << r - o]), n) + for (; s.length * r & 7; ) + s += "="; + return s; +}, $n = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => Yd({ + prefix: e, + name: t, + encode(i) { + return Gk(i, n, r); + }, + decode(i) { + return Vk(i, n, r, t); + } +}), Yk = Yd({ + prefix: "\0", + name: "identity", + encode: (t) => qk(t), + decode: (t) => Uk(t) +}), Jk = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + identity: Yk +}, Symbol.toStringTag, { value: "Module" })), Xk = $n({ + prefix: "0", + name: "base2", + alphabet: "01", + bitsPerChar: 1 +}), Zk = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + base2: Xk +}, Symbol.toStringTag, { value: "Module" })), Qk = $n({ + prefix: "7", + name: "base8", + alphabet: "01234567", + bitsPerChar: 3 +}), e$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + base8: Qk +}, Symbol.toStringTag, { value: "Module" })), t$ = rl({ + prefix: "9", + name: "base10", + alphabet: "0123456789" +}), r$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + base10: t$ +}, Symbol.toStringTag, { value: "Module" })), n$ = $n({ + prefix: "f", + name: "base16", + alphabet: "0123456789abcdef", + bitsPerChar: 4 +}), i$ = $n({ + prefix: "F", + name: "base16upper", + alphabet: "0123456789ABCDEF", + bitsPerChar: 4 +}), s$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + base16: n$, + base16upper: i$ +}, Symbol.toStringTag, { value: "Module" })), o$ = $n({ + prefix: "b", + name: "base32", + alphabet: "abcdefghijklmnopqrstuvwxyz234567", + bitsPerChar: 5 +}), a$ = $n({ + prefix: "B", + name: "base32upper", + alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", + bitsPerChar: 5 +}), c$ = $n({ + prefix: "c", + name: "base32pad", + alphabet: "abcdefghijklmnopqrstuvwxyz234567=", + bitsPerChar: 5 +}), u$ = $n({ + prefix: "C", + name: "base32padupper", + alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", + bitsPerChar: 5 +}), f$ = $n({ + prefix: "v", + name: "base32hex", + alphabet: "0123456789abcdefghijklmnopqrstuv", + bitsPerChar: 5 +}), l$ = $n({ + prefix: "V", + name: "base32hexupper", + alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", + bitsPerChar: 5 +}), h$ = $n({ + prefix: "t", + name: "base32hexpad", + alphabet: "0123456789abcdefghijklmnopqrstuv=", + bitsPerChar: 5 +}), d$ = $n({ + prefix: "T", + name: "base32hexpadupper", + alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=", + bitsPerChar: 5 +}), p$ = $n({ + prefix: "h", + name: "base32z", + alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769", + bitsPerChar: 5 +}), g$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + base32: o$, + base32hex: f$, + base32hexpad: h$, + base32hexpadupper: d$, + base32hexupper: l$, + base32pad: c$, + base32padupper: u$, + base32upper: a$, + base32z: p$ +}, Symbol.toStringTag, { value: "Module" })), m$ = rl({ + prefix: "k", + name: "base36", + alphabet: "0123456789abcdefghijklmnopqrstuvwxyz" +}), v$ = rl({ + prefix: "K", + name: "base36upper", + alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" +}), b$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + base36: m$, + base36upper: v$ +}, Symbol.toStringTag, { value: "Module" })), y$ = rl({ + name: "base58btc", + prefix: "z", + alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" +}), w$ = rl({ + name: "base58flickr", + prefix: "Z", + alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" +}), x$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + base58btc: y$, + base58flickr: w$ +}, Symbol.toStringTag, { value: "Module" })), _$ = $n({ + prefix: "m", + name: "base64", + alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", + bitsPerChar: 6 +}), E$ = $n({ + prefix: "M", + name: "base64pad", + alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", + bitsPerChar: 6 +}), S$ = $n({ + prefix: "u", + name: "base64url", + alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", + bitsPerChar: 6 +}), A$ = $n({ + prefix: "U", + name: "base64urlpad", + alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", + bitsPerChar: 6 +}), P$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + base64: _$, + base64pad: E$, + base64url: S$, + base64urlpad: A$ +}, Symbol.toStringTag, { value: "Module" })), n8 = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), M$ = n8.reduce((t, e, r) => (t[r] = e, t), []), I$ = n8.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); +function C$(t) { + return t.reduce((e, r) => (e += M$[r], e), ""); +} +function R$(t) { + const e = []; + for (const r of t) { + const n = I$[r.codePointAt(0)]; + if (n === void 0) + throw new Error(`Non-base256emoji character: ${r}`); + e.push(n); + } + return new Uint8Array(e); +} +const T$ = Yd({ + prefix: "🚀", + name: "base256emoji", + encode: C$, + decode: R$ +}), D$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + base256emoji: T$ +}, Symbol.toStringTag, { value: "Module" })); +new TextEncoder(); +new TextDecoder(); +const T2 = { + ...Jk, + ...Zk, + ...e$, + ...r$, + ...s$, + ...g$, + ...b$, + ...x$, + ...P$, + ...D$ +}; +function i8(t, e, r, n) { + return { + name: t, + prefix: e, + encoder: { + name: t, + prefix: e, + encode: r + }, + decoder: { decode: n } + }; +} +const D2 = i8("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), ng = i8("ascii", "a", (t) => { + let e = "a"; + for (let r = 0; r < t.length; r++) + e += String.fromCharCode(t[r]); + return e; +}, (t) => { + t = t.substring(1); + const e = t8(t.length); + for (let r = 0; r < t.length; r++) + e[r] = t.charCodeAt(r); + return e; +}), s8 = { + utf8: D2, + "utf-8": D2, + hex: T2.base16, + latin1: ng, + ascii: ng, + binary: ng, + ...T2 +}; +function Tn(t, e = "utf8") { + const r = s8[e]; + if (!r) + throw new Error(`Unsupported encoding "${e}"`); + return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t.buffer, t.byteOffset, t.byteLength).toString("utf8") : r.encoder.encode(t).substring(1); +} +function Cn(t, e = "utf8") { + const r = s8[e]; + if (!r) + throw new Error(`Unsupported encoding "${e}"`); + return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t, "utf8") : r.decoder.decode(`${r.prefix}${t}`); +} +function O2(t) { + return Na(Tn(Cn(t, Gd), Q4)); +} +function md(t) { + return Tn(Cn(ho(t), Q4), Gd); +} +function o8(t) { + const e = Cn(Lk, R2), r = Nk + Tn($h([e, t]), R2); + return [Dk, Ok, r].join(Tk); +} +function O$(t) { + return Tn(t, Gd); +} +function N$(t) { + return Cn(t, Gd); +} +function L$(t) { + return Cn([md(t.header), md(t.payload)].join(gd), e8); +} +function k$(t) { + return [ + md(t.header), + md(t.payload), + O$(t.signature) + ].join(gd); +} +function ev(t) { + const e = t.split(gd), r = O2(e[0]), n = O2(e[1]), i = N$(e[2]), s = Cn(e.slice(0, 2).join(gd), e8); + return { header: r, payload: n, signature: i, data: s }; +} +function N2(t = tl.randomBytes(kk)) { + return Z4.generateKeyPairFromSeed(t); +} +async function $$(t, e, r, n, i = bt.fromMiliseconds(Date.now())) { + const s = { alg: Ck, typ: Rk }, o = o8(n.publicKey), a = i + r, f = { iss: o, sub: t, aud: e, iat: i, exp: a }, u = L$({ header: s, payload: f }), h = Z4.sign(n.secretKey, u); + return k$({ header: s, payload: f, signature: h }); +} +var L2 = function(t, e, r) { + if (r || arguments.length === 2) for (var n = 0, i = e.length, s; n < i; n++) + (s || !(n in e)) && (s || (s = Array.prototype.slice.call(e, 0, n)), s[n] = e[n]); + return t.concat(s || Array.prototype.slice.call(e)); +}, B$ = ( + /** @class */ + /* @__PURE__ */ (function() { + function t(e, r, n) { + this.name = e, this.version = r, this.os = n, this.type = "browser"; + } + return t; + })() +), F$ = ( + /** @class */ + /* @__PURE__ */ (function() { + function t(e) { + this.version = e, this.type = "node", this.name = "node", this.os = process.platform; + } + return t; + })() +), j$ = ( + /** @class */ + /* @__PURE__ */ (function() { + function t(e, r, n, i) { + this.name = e, this.version = r, this.os = n, this.bot = i, this.type = "bot-device"; + } + return t; + })() +), U$ = ( + /** @class */ + /* @__PURE__ */ (function() { + function t() { + this.type = "bot", this.bot = !0, this.name = "bot", this.version = null, this.os = null; + } + return t; + })() +), q$ = ( + /** @class */ + /* @__PURE__ */ (function() { + function t() { + this.type = "react-native", this.name = "react-native", this.version = null, this.os = null; + } + return t; + })() +), z$ = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/, H$ = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, k2 = 3, W$ = [ + ["aol", /AOLShield\/([0-9\._]+)/], + ["edge", /Edge\/([0-9\._]+)/], + ["edge-ios", /EdgiOS\/([0-9\._]+)/], + ["yandexbrowser", /YaBrowser\/([0-9\._]+)/], + ["kakaotalk", /KAKAOTALK\s([0-9\.]+)/], + ["samsung", /SamsungBrowser\/([0-9\.]+)/], + ["silk", /\bSilk\/([0-9._-]+)\b/], + ["miui", /MiuiBrowser\/([0-9\.]+)$/], + ["beaker", /BeakerBrowser\/([0-9\.]+)/], + ["edge-chromium", /EdgA?\/([0-9\.]+)/], + [ + "chromium-webview", + /(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/ + ], + ["chrome", /(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/], + ["phantomjs", /PhantomJS\/([0-9\.]+)(:?\s|$)/], + ["crios", /CriOS\/([0-9\.]+)(:?\s|$)/], + ["firefox", /Firefox\/([0-9\.]+)(?:\s|$)/], + ["fxios", /FxiOS\/([0-9\.]+)/], + ["opera-mini", /Opera Mini.*Version\/([0-9\.]+)/], + ["opera", /Opera\/([0-9\.]+)(?:\s|$)/], + ["opera", /OPR\/([0-9\.]+)(:?\s|$)/], + ["pie", /^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/], + ["pie", /^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/], + ["netfront", /^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/], + ["ie", /Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/], + ["ie", /MSIE\s([0-9\.]+);.*Trident\/[4-7].0/], + ["ie", /MSIE\s(7\.0)/], + ["bb10", /BB10;\sTouch.*Version\/([0-9\.]+)/], + ["android", /Android\s([0-9\.]+)/], + ["ios", /Version\/([0-9\._]+).*Mobile.*Safari.*/], + ["safari", /Version\/([0-9\._]+).*Safari/], + ["facebook", /FB[AS]V\/([0-9\.]+)/], + ["instagram", /Instagram\s([0-9\.]+)/], + ["ios-webview", /AppleWebKit\/([0-9\.]+).*Mobile/], + ["ios-webview", /AppleWebKit\/([0-9\.]+).*Gecko\)$/], + ["curl", /^curl\/([0-9\.]+)$/], + ["searchbot", z$] +], $2 = [ + ["iOS", /iP(hone|od|ad)/], + ["Android OS", /Android/], + ["BlackBerry OS", /BlackBerry|BB10/], + ["Windows Mobile", /IEMobile/], + ["Amazon OS", /Kindle/], + ["Windows 3.11", /Win16/], + ["Windows 95", /(Windows 95)|(Win95)|(Windows_95)/], + ["Windows 98", /(Windows 98)|(Win98)/], + ["Windows 2000", /(Windows NT 5.0)|(Windows 2000)/], + ["Windows XP", /(Windows NT 5.1)|(Windows XP)/], + ["Windows Server 2003", /(Windows NT 5.2)/], + ["Windows Vista", /(Windows NT 6.0)/], + ["Windows 7", /(Windows NT 6.1)/], + ["Windows 8", /(Windows NT 6.2)/], + ["Windows 8.1", /(Windows NT 6.3)/], + ["Windows 10", /(Windows NT 10.0)/], + ["Windows ME", /Windows ME/], + ["Windows CE", /Windows CE|WinCE|Microsoft Pocket Internet Explorer/], + ["Open BSD", /OpenBSD/], + ["Sun OS", /SunOS/], + ["Chrome OS", /CrOS/], + ["Linux", /(Linux)|(X11)/], + ["Mac OS", /(Mac_PowerPC)|(Macintosh)/], + ["QNX", /QNX/], + ["BeOS", /BeOS/], + ["OS/2", /OS\/2/] +]; +function K$(t) { + return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative" ? new q$() : typeof navigator < "u" ? G$(navigator.userAgent) : J$(); +} +function V$(t) { + return t !== "" && W$.reduce(function(e, r) { + var n = r[0], i = r[1]; + if (e) + return e; + var s = i.exec(t); + return !!s && [n, s]; + }, !1); +} +function G$(t) { + var e = V$(t); + if (!e) + return null; + var r = e[0], n = e[1]; + if (r === "searchbot") + return new U$(); + var i = n[1] && n[1].split(".").join("_").split("_").slice(0, 3); + i ? i.length < k2 && (i = L2(L2([], i, !0), X$(k2 - i.length), !0)) : i = []; + var s = i.join("."), o = Y$(t), a = H$.exec(t); + return a && a[1] ? new j$(r, s, o, a[1]) : new B$(r, s, o); +} +function Y$(t) { + for (var e = 0, r = $2.length; e < r; e++) { + var n = $2[e], i = n[0], s = n[1], o = s.exec(t); + if (o) + return i; + } + return null; +} +function J$() { + var t = typeof process < "u" && process.version; + return t ? new F$(process.version.slice(1)) : null; +} +function X$(t) { + for (var e = [], r = 0; r < t; r++) + e.push("0"); + return e; +} +var zr = {}, B2; +function a8() { + if (B2) return zr; + B2 = 1, Object.defineProperty(zr, "__esModule", { value: !0 }), zr.getLocalStorage = zr.getLocalStorageOrThrow = zr.getCrypto = zr.getCryptoOrThrow = zr.getLocation = zr.getLocationOrThrow = zr.getNavigator = zr.getNavigatorOrThrow = zr.getDocument = zr.getDocumentOrThrow = zr.getFromWindowOrThrow = zr.getFromWindow = void 0; + function t(v) { + let x; + return typeof window < "u" && typeof window[v] < "u" && (x = window[v]), x; + } + zr.getFromWindow = t; + function e(v) { + const x = t(v); + if (!x) + throw new Error(`${v} is not defined in Window`); + return x; + } + zr.getFromWindowOrThrow = e; + function r() { + return e("document"); + } + zr.getDocumentOrThrow = r; + function n() { + return t("document"); + } + zr.getDocument = n; + function i() { + return e("navigator"); + } + zr.getNavigatorOrThrow = i; + function s() { + return t("navigator"); + } + zr.getNavigator = s; + function o() { + return e("location"); + } + zr.getLocationOrThrow = o; + function a() { + return t("location"); + } + zr.getLocation = a; + function f() { + return e("crypto"); + } + zr.getCryptoOrThrow = f; + function u() { + return t("crypto"); + } + zr.getCrypto = u; + function h() { + return e("localStorage"); + } + zr.getLocalStorageOrThrow = h; + function g() { + return t("localStorage"); + } + return zr.getLocalStorage = g, zr; +} +var La = a8(), Ru = {}, F2; +function Z$() { + if (F2) return Ru; + F2 = 1, Object.defineProperty(Ru, "__esModule", { value: !0 }), Ru.getWindowMetadata = void 0; + const t = a8(); + function e() { + let r, n; + try { + r = t.getDocumentOrThrow(), n = t.getLocationOrThrow(); + } catch { + return null; + } + function i() { + const x = r.getElementsByTagName("link"), S = []; + for (let C = 0; C < x.length; C++) { + const D = x[C], $ = D.getAttribute("rel"); + if ($ && $.toLowerCase().indexOf("icon") > -1) { + const N = D.getAttribute("href"); + if (N) + if (N.toLowerCase().indexOf("https:") === -1 && N.toLowerCase().indexOf("http:") === -1 && N.indexOf("//") !== 0) { + let z = n.protocol + "//" + n.host; + if (N.indexOf("/") === 0) + z += N; + else { + const k = n.pathname.split("/"); + k.pop(); + const B = k.join("/"); + z += B + "/" + N; + } + S.push(z); + } else if (N.indexOf("//") === 0) { + const z = n.protocol + N; + S.push(z); + } else + S.push(N); + } + } + return S; + } + function s(...x) { + const S = r.getElementsByTagName("meta"); + for (let C = 0; C < S.length; C++) { + const D = S[C], $ = ["itemprop", "property", "name"].map((N) => D.getAttribute(N)).filter((N) => N ? x.includes(N) : !1); + if ($.length && $) { + const N = D.getAttribute("content"); + if (N) + return N; + } + } + return ""; + } + function o() { + let x = s("name", "og:site_name", "og:title", "twitter:title"); + return x || (x = r.title), x; + } + function a() { + return s("description", "og:description", "twitter:description", "keywords"); + } + const f = o(), u = a(), h = n.origin, g = i(); + return { + description: u, + url: h, + icons: g, + name: f + }; + } + return Ru.getWindowMetadata = e, Ru; +} +var Q$ = Z$(), ig = {}, sg, j2; +function eB() { + return j2 || (j2 = 1, sg = (t) => encodeURIComponent(t).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`)), sg; +} +var og, U2; +function tB() { + if (U2) return og; + U2 = 1; + var t = "%[a-f0-9]{2}", e = new RegExp("(" + t + ")|([^%]+?)", "gi"), r = new RegExp("(" + t + ")+", "gi"); + function n(o, a) { + try { + return [decodeURIComponent(o.join(""))]; + } catch { + } + if (o.length === 1) + return o; + a = a || 1; + var f = o.slice(0, a), u = o.slice(a); + return Array.prototype.concat.call([], n(f), n(u)); + } + function i(o) { + try { + return decodeURIComponent(o); + } catch { + for (var a = o.match(e) || [], f = 1; f < a.length; f++) + o = n(a, f).join(""), a = o.match(e) || []; + return o; + } + } + function s(o) { + for (var a = { + "%FE%FF": "��", + "%FF%FE": "��" + }, f = r.exec(o); f; ) { + try { + a[f[0]] = decodeURIComponent(f[0]); + } catch { + var u = i(f[0]); + u !== f[0] && (a[f[0]] = u); + } + f = r.exec(o); + } + a["%C2"] = "�"; + for (var h = Object.keys(a), g = 0; g < h.length; g++) { + var v = h[g]; + o = o.replace(new RegExp(v, "g"), a[v]); + } + return o; + } + return og = function(o) { + if (typeof o != "string") + throw new TypeError("Expected `encodedURI` to be of type `string`, got `" + typeof o + "`"); + try { + return o = o.replace(/\+/g, " "), decodeURIComponent(o); + } catch { + return s(o); + } + }, og; +} +var ag, q2; +function rB() { + return q2 || (q2 = 1, ag = (t, e) => { + if (!(typeof t == "string" && typeof e == "string")) + throw new TypeError("Expected the arguments to be of type `string`"); + if (e === "") + return [t]; + const r = t.indexOf(e); + return r === -1 ? [t] : [ + t.slice(0, r), + t.slice(r + e.length) + ]; + }), ag; +} +var cg, z2; +function nB() { + return z2 || (z2 = 1, cg = function(t, e) { + for (var r = {}, n = Object.keys(t), i = Array.isArray(e), s = 0; s < n.length; s++) { + var o = n[s], a = t[o]; + (i ? e.indexOf(o) !== -1 : e(o, a, t)) && (r[o] = a); + } + return r; + }), cg; +} +var H2; +function iB() { + return H2 || (H2 = 1, (function(t) { + const e = eB(), r = tB(), n = rB(), i = nB(), s = (N) => N == null, o = Symbol("encodeFragmentIdentifier"); + function a(N) { + switch (N.arrayFormat) { + case "index": + return (z) => (k, B) => { + const U = k.length; + return B === void 0 || N.skipNull && B === null || N.skipEmptyString && B === "" ? k : B === null ? [...k, [h(z, N), "[", U, "]"].join("")] : [ + ...k, + [h(z, N), "[", h(U, N), "]=", h(B, N)].join("") + ]; + }; + case "bracket": + return (z) => (k, B) => B === void 0 || N.skipNull && B === null || N.skipEmptyString && B === "" ? k : B === null ? [...k, [h(z, N), "[]"].join("")] : [...k, [h(z, N), "[]=", h(B, N)].join("")]; + case "colon-list-separator": + return (z) => (k, B) => B === void 0 || N.skipNull && B === null || N.skipEmptyString && B === "" ? k : B === null ? [...k, [h(z, N), ":list="].join("")] : [...k, [h(z, N), ":list=", h(B, N)].join("")]; + case "comma": + case "separator": + case "bracket-separator": { + const z = N.arrayFormat === "bracket-separator" ? "[]=" : "="; + return (k) => (B, U) => U === void 0 || N.skipNull && U === null || N.skipEmptyString && U === "" ? B : (U = U === null ? "" : U, B.length === 0 ? [[h(k, N), z, h(U, N)].join("")] : [[B, h(U, N)].join(N.arrayFormatSeparator)]); + } + default: + return (z) => (k, B) => B === void 0 || N.skipNull && B === null || N.skipEmptyString && B === "" ? k : B === null ? [...k, h(z, N)] : [...k, [h(z, N), "=", h(B, N)].join("")]; + } + } + function f(N) { + let z; + switch (N.arrayFormat) { + case "index": + return (k, B, U) => { + if (z = /\[(\d*)\]$/.exec(k), k = k.replace(/\[\d*\]$/, ""), !z) { + U[k] = B; + return; + } + U[k] === void 0 && (U[k] = {}), U[k][z[1]] = B; + }; + case "bracket": + return (k, B, U) => { + if (z = /(\[\])$/.exec(k), k = k.replace(/\[\]$/, ""), !z) { + U[k] = B; + return; + } + if (U[k] === void 0) { + U[k] = [B]; + return; + } + U[k] = [].concat(U[k], B); + }; + case "colon-list-separator": + return (k, B, U) => { + if (z = /(:list)$/.exec(k), k = k.replace(/:list$/, ""), !z) { + U[k] = B; + return; + } + if (U[k] === void 0) { + U[k] = [B]; + return; + } + U[k] = [].concat(U[k], B); + }; + case "comma": + case "separator": + return (k, B, U) => { + const R = typeof B == "string" && B.includes(N.arrayFormatSeparator), W = typeof B == "string" && !R && g(B, N).includes(N.arrayFormatSeparator); + B = W ? g(B, N) : B; + const J = R || W ? B.split(N.arrayFormatSeparator).map((ne) => g(ne, N)) : B === null ? B : g(B, N); + U[k] = J; + }; + case "bracket-separator": + return (k, B, U) => { + const R = /(\[\])$/.test(k); + if (k = k.replace(/\[\]$/, ""), !R) { + U[k] = B && g(B, N); + return; + } + const W = B === null ? [] : B.split(N.arrayFormatSeparator).map((J) => g(J, N)); + if (U[k] === void 0) { + U[k] = W; + return; + } + U[k] = [].concat(U[k], W); + }; + default: + return (k, B, U) => { + if (U[k] === void 0) { + U[k] = B; + return; + } + U[k] = [].concat(U[k], B); + }; + } + } + function u(N) { + if (typeof N != "string" || N.length !== 1) + throw new TypeError("arrayFormatSeparator must be single character string"); + } + function h(N, z) { + return z.encode ? z.strict ? e(N) : encodeURIComponent(N) : N; + } + function g(N, z) { + return z.decode ? r(N) : N; + } + function v(N) { + return Array.isArray(N) ? N.sort() : typeof N == "object" ? v(Object.keys(N)).sort((z, k) => Number(z) - Number(k)).map((z) => N[z]) : N; + } + function x(N) { + const z = N.indexOf("#"); + return z !== -1 && (N = N.slice(0, z)), N; + } + function S(N) { + let z = ""; + const k = N.indexOf("#"); + return k !== -1 && (z = N.slice(k)), z; + } + function C(N) { + N = x(N); + const z = N.indexOf("?"); + return z === -1 ? "" : N.slice(z + 1); + } + function D(N, z) { + return z.parseNumbers && !Number.isNaN(Number(N)) && typeof N == "string" && N.trim() !== "" ? N = Number(N) : z.parseBooleans && N !== null && (N.toLowerCase() === "true" || N.toLowerCase() === "false") && (N = N.toLowerCase() === "true"), N; + } + function $(N, z) { + z = Object.assign({ + decode: !0, + sort: !0, + arrayFormat: "none", + arrayFormatSeparator: ",", + parseNumbers: !1, + parseBooleans: !1 + }, z), u(z.arrayFormatSeparator); + const k = f(z), B = /* @__PURE__ */ Object.create(null); + if (typeof N != "string" || (N = N.trim().replace(/^[?#&]/, ""), !N)) + return B; + for (const U of N.split("&")) { + if (U === "") + continue; + let [R, W] = n(z.decode ? U.replace(/\+/g, " ") : U, "="); + W = W === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(z.arrayFormat) ? W : g(W, z), k(g(R, z), W, B); + } + for (const U of Object.keys(B)) { + const R = B[U]; + if (typeof R == "object" && R !== null) + for (const W of Object.keys(R)) + R[W] = D(R[W], z); + else + B[U] = D(R, z); + } + return z.sort === !1 ? B : (z.sort === !0 ? Object.keys(B).sort() : Object.keys(B).sort(z.sort)).reduce((U, R) => { + const W = B[R]; + return W && typeof W == "object" && !Array.isArray(W) ? U[R] = v(W) : U[R] = W, U; + }, /* @__PURE__ */ Object.create(null)); + } + t.extract = C, t.parse = $, t.stringify = (N, z) => { + if (!N) + return ""; + z = Object.assign({ + encode: !0, + strict: !0, + arrayFormat: "none", + arrayFormatSeparator: "," + }, z), u(z.arrayFormatSeparator); + const k = (W) => z.skipNull && s(N[W]) || z.skipEmptyString && N[W] === "", B = a(z), U = {}; + for (const W of Object.keys(N)) + k(W) || (U[W] = N[W]); + const R = Object.keys(U); + return z.sort !== !1 && R.sort(z.sort), R.map((W) => { + const J = N[W]; + return J === void 0 ? "" : J === null ? h(W, z) : Array.isArray(J) ? J.length === 0 && z.arrayFormat === "bracket-separator" ? h(W, z) + "[]" : J.reduce(B(W), []).join("&") : h(W, z) + "=" + h(J, z); + }).filter((W) => W.length > 0).join("&"); + }, t.parseUrl = (N, z) => { + z = Object.assign({ + decode: !0 + }, z); + const [k, B] = n(N, "#"); + return Object.assign( + { + url: k.split("?")[0] || "", + query: $(C(N), z) + }, + z && z.parseFragmentIdentifier && B ? { fragmentIdentifier: g(B, z) } : {} + ); + }, t.stringifyUrl = (N, z) => { + z = Object.assign({ + encode: !0, + strict: !0, + [o]: !0 + }, z); + const k = x(N.url).split("?")[0] || "", B = t.extract(N.url), U = t.parse(B, { sort: !1 }), R = Object.assign(U, N.query); + let W = t.stringify(R, z); + W && (W = `?${W}`); + let J = S(N.url); + return N.fragmentIdentifier && (J = `#${z[o] ? h(N.fragmentIdentifier, z) : N.fragmentIdentifier}`), `${k}${W}${J}`; + }, t.pick = (N, z, k) => { + k = Object.assign({ + parseFragmentIdentifier: !0, + [o]: !1 + }, k); + const { url: B, query: U, fragmentIdentifier: R } = t.parseUrl(N, k); + return t.stringifyUrl({ + url: B, + query: i(U, z), + fragmentIdentifier: R + }, k); + }, t.exclude = (N, z, k) => { + const B = Array.isArray(z) ? (U) => !z.includes(U) : (U, R) => !z(U, R); + return t.pick(N, B, k); + }; + })(ig)), ig; +} +var vd = iB(), ug = { exports: {} }; +/** + * [js-sha3]{@link https://github.com/emn178/js-sha3} + * + * @version 0.8.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2018 + * @license MIT + */ +var W2; +function sB() { + return W2 || (W2 = 1, (function(t) { + (function() { + var e = "input is invalid type", r = "finalize already called", n = typeof window == "object", i = n ? window : {}; + i.JS_SHA3_NO_WINDOW && (n = !1); + var s = !n && typeof self == "object", o = !i.JS_SHA3_NO_NODE_JS && typeof process == "object" && process.versions && process.versions.node; + o ? i = Zn : s && (i = self); + var a = !i.JS_SHA3_NO_COMMON_JS && !0 && t.exports, f = !i.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", u = "0123456789abcdef".split(""), h = [31, 7936, 2031616, 520093696], g = [4, 1024, 262144, 67108864], v = [1, 256, 65536, 16777216], x = [6, 1536, 393216, 100663296], S = [0, 8, 16, 24], C = [ + 1, + 0, + 32898, + 0, + 32906, + 2147483648, + 2147516416, + 2147483648, + 32907, + 0, + 2147483649, + 0, + 2147516545, + 2147483648, + 32777, + 2147483648, + 138, + 0, + 136, + 0, + 2147516425, + 0, + 2147483658, + 0, + 2147516555, + 0, + 139, + 2147483648, + 32905, + 2147483648, + 32771, + 2147483648, + 32770, + 2147483648, + 128, + 2147483648, + 32778, + 0, + 2147483658, + 2147483648, + 2147516545, + 2147483648, + 32896, + 2147483648, + 2147483649, + 0, + 2147516424, + 2147483648 + ], D = [224, 256, 384, 512], $ = [128, 256], N = ["hex", "buffer", "arrayBuffer", "array", "digest"], z = { + 128: 168, + 256: 136 + }; + (i.JS_SHA3_NO_NODE_JS || !Array.isArray) && (Array.isArray = function(L) { + return Object.prototype.toString.call(L) === "[object Array]"; + }), f && (i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView) && (ArrayBuffer.isView = function(L) { + return typeof L == "object" && L.buffer && L.buffer.constructor === ArrayBuffer; + }); + for (var k = function(L, oe, Q) { + return function(X) { + return new I(L, oe, L).update(X)[Q](); + }; + }, B = function(L, oe, Q) { + return function(X, ee) { + return new I(L, oe, ee).update(X)[Q](); + }; + }, U = function(L, oe, Q) { + return function(X, ee, O, Z) { + return l["cshake" + L].update(X, ee, O, Z)[Q](); + }; + }, R = function(L, oe, Q) { + return function(X, ee, O, Z) { + return l["kmac" + L].update(X, ee, O, Z)[Q](); + }; + }, W = function(L, oe, Q, X) { + for (var ee = 0; ee < N.length; ++ee) { + var O = N[ee]; + L[O] = oe(Q, X, O); + } + return L; + }, J = function(L, oe) { + var Q = k(L, oe, "hex"); + return Q.create = function() { + return new I(L, oe, L); + }, Q.update = function(X) { + return Q.create().update(X); + }, W(Q, k, L, oe); + }, ne = function(L, oe) { + var Q = B(L, oe, "hex"); + return Q.create = function(X) { + return new I(L, oe, X); + }, Q.update = function(X, ee) { + return Q.create(ee).update(X); + }, W(Q, B, L, oe); + }, K = function(L, oe) { + var Q = z[L], X = U(L, oe, "hex"); + return X.create = function(ee, O, Z) { + return !O && !Z ? l["shake" + L].create(ee) : new I(L, oe, ee).bytepad([O, Z], Q); + }, X.update = function(ee, O, Z, re) { + return X.create(O, Z, re).update(ee); + }, W(X, U, L, oe); + }, E = function(L, oe) { + var Q = z[L], X = R(L, oe, "hex"); + return X.create = function(ee, O, Z) { + return new q(L, oe, O).bytepad(["KMAC", Z], Q).bytepad([ee], Q); + }, X.update = function(ee, O, Z, re) { + return X.create(ee, Z, re).update(O); + }, W(X, R, L, oe); + }, b = [ + { name: "keccak", padding: v, bits: D, createMethod: J }, + { name: "sha3", padding: x, bits: D, createMethod: J }, + { name: "shake", padding: h, bits: $, createMethod: ne }, + { name: "cshake", padding: g, bits: $, createMethod: K }, + { name: "kmac", padding: g, bits: $, createMethod: E } + ], l = {}, p = [], m = 0; m < b.length; ++m) + for (var w = b[m], P = w.bits, _ = 0; _ < P.length; ++_) { + var y = w.name + "_" + P[_]; + if (p.push(y), l[y] = w.createMethod(P[_], w.padding), w.name !== "sha3") { + var M = w.name + P[_]; + p.push(M), l[M] = l[y]; + } + } + function I(L, oe, Q) { + this.blocks = [], this.s = [], this.padding = oe, this.outputBits = Q, this.reset = !0, this.finalized = !1, this.block = 0, this.start = 0, this.blockCount = 1600 - (L << 1) >> 5, this.byteCount = this.blockCount << 2, this.outputBlocks = Q >> 5, this.extraBytes = (Q & 31) >> 3; + for (var X = 0; X < 50; ++X) + this.s[X] = 0; + } + I.prototype.update = function(L) { + if (this.finalized) + throw new Error(r); + var oe, Q = typeof L; + if (Q !== "string") { + if (Q === "object") { + if (L === null) + throw new Error(e); + if (f && L.constructor === ArrayBuffer) + L = new Uint8Array(L); + else if (!Array.isArray(L) && (!f || !ArrayBuffer.isView(L))) + throw new Error(e); + } else + throw new Error(e); + oe = !0; + } + for (var X = this.blocks, ee = this.byteCount, O = L.length, Z = this.blockCount, re = 0, he = this.s, ae, fe; re < O; ) { + if (this.reset) + for (this.reset = !1, X[0] = this.block, ae = 1; ae < Z + 1; ++ae) + X[ae] = 0; + if (oe) + for (ae = this.start; re < O && ae < ee; ++re) + X[ae >> 2] |= L[re] << S[ae++ & 3]; + else + for (ae = this.start; re < O && ae < ee; ++re) + fe = L.charCodeAt(re), fe < 128 ? X[ae >> 2] |= fe << S[ae++ & 3] : fe < 2048 ? (X[ae >> 2] |= (192 | fe >> 6) << S[ae++ & 3], X[ae >> 2] |= (128 | fe & 63) << S[ae++ & 3]) : fe < 55296 || fe >= 57344 ? (X[ae >> 2] |= (224 | fe >> 12) << S[ae++ & 3], X[ae >> 2] |= (128 | fe >> 6 & 63) << S[ae++ & 3], X[ae >> 2] |= (128 | fe & 63) << S[ae++ & 3]) : (fe = 65536 + ((fe & 1023) << 10 | L.charCodeAt(++re) & 1023), X[ae >> 2] |= (240 | fe >> 18) << S[ae++ & 3], X[ae >> 2] |= (128 | fe >> 12 & 63) << S[ae++ & 3], X[ae >> 2] |= (128 | fe >> 6 & 63) << S[ae++ & 3], X[ae >> 2] |= (128 | fe & 63) << S[ae++ & 3]); + if (this.lastByteIndex = ae, ae >= ee) { + for (this.start = ae - ee, this.block = X[Z], ae = 0; ae < Z; ++ae) + he[ae] ^= X[ae]; + ce(he), this.reset = !0; + } else + this.start = ae; + } + return this; + }, I.prototype.encode = function(L, oe) { + var Q = L & 255, X = 1, ee = [Q]; + for (L = L >> 8, Q = L & 255; Q > 0; ) + ee.unshift(Q), L = L >> 8, Q = L & 255, ++X; + return oe ? ee.push(X) : ee.unshift(X), this.update(ee), ee.length; + }, I.prototype.encodeString = function(L) { + var oe, Q = typeof L; + if (Q !== "string") { + if (Q === "object") { + if (L === null) + throw new Error(e); + if (f && L.constructor === ArrayBuffer) + L = new Uint8Array(L); + else if (!Array.isArray(L) && (!f || !ArrayBuffer.isView(L))) + throw new Error(e); + } else + throw new Error(e); + oe = !0; + } + var X = 0, ee = L.length; + if (oe) + X = ee; + else + for (var O = 0; O < L.length; ++O) { + var Z = L.charCodeAt(O); + Z < 128 ? X += 1 : Z < 2048 ? X += 2 : Z < 55296 || Z >= 57344 ? X += 3 : (Z = 65536 + ((Z & 1023) << 10 | L.charCodeAt(++O) & 1023), X += 4); + } + return X += this.encode(X * 8), this.update(L), X; + }, I.prototype.bytepad = function(L, oe) { + for (var Q = this.encode(oe), X = 0; X < L.length; ++X) + Q += this.encodeString(L[X]); + var ee = oe - Q % oe, O = []; + return O.length = ee, this.update(O), this; + }, I.prototype.finalize = function() { + if (!this.finalized) { + this.finalized = !0; + var L = this.blocks, oe = this.lastByteIndex, Q = this.blockCount, X = this.s; + if (L[oe >> 2] |= this.padding[oe & 3], this.lastByteIndex === this.byteCount) + for (L[0] = L[Q], oe = 1; oe < Q + 1; ++oe) + L[oe] = 0; + for (L[Q - 1] |= 2147483648, oe = 0; oe < Q; ++oe) + X[oe] ^= L[oe]; + ce(X); + } + }, I.prototype.toString = I.prototype.hex = function() { + this.finalize(); + for (var L = this.blockCount, oe = this.s, Q = this.outputBlocks, X = this.extraBytes, ee = 0, O = 0, Z = "", re; O < Q; ) { + for (ee = 0; ee < L && O < Q; ++ee, ++O) + re = oe[ee], Z += u[re >> 4 & 15] + u[re & 15] + u[re >> 12 & 15] + u[re >> 8 & 15] + u[re >> 20 & 15] + u[re >> 16 & 15] + u[re >> 28 & 15] + u[re >> 24 & 15]; + O % L === 0 && (ce(oe), ee = 0); + } + return X && (re = oe[ee], Z += u[re >> 4 & 15] + u[re & 15], X > 1 && (Z += u[re >> 12 & 15] + u[re >> 8 & 15]), X > 2 && (Z += u[re >> 20 & 15] + u[re >> 16 & 15])), Z; + }, I.prototype.arrayBuffer = function() { + this.finalize(); + var L = this.blockCount, oe = this.s, Q = this.outputBlocks, X = this.extraBytes, ee = 0, O = 0, Z = this.outputBits >> 3, re; + X ? re = new ArrayBuffer(Q + 1 << 2) : re = new ArrayBuffer(Z); + for (var he = new Uint32Array(re); O < Q; ) { + for (ee = 0; ee < L && O < Q; ++ee, ++O) + he[O] = oe[ee]; + O % L === 0 && ce(oe); + } + return X && (he[ee] = oe[ee], re = re.slice(0, Z)), re; + }, I.prototype.buffer = I.prototype.arrayBuffer, I.prototype.digest = I.prototype.array = function() { + this.finalize(); + for (var L = this.blockCount, oe = this.s, Q = this.outputBlocks, X = this.extraBytes, ee = 0, O = 0, Z = [], re, he; O < Q; ) { + for (ee = 0; ee < L && O < Q; ++ee, ++O) + re = O << 2, he = oe[ee], Z[re] = he & 255, Z[re + 1] = he >> 8 & 255, Z[re + 2] = he >> 16 & 255, Z[re + 3] = he >> 24 & 255; + O % L === 0 && ce(oe); + } + return X && (re = O << 2, he = oe[ee], Z[re] = he & 255, X > 1 && (Z[re + 1] = he >> 8 & 255), X > 2 && (Z[re + 2] = he >> 16 & 255)), Z; + }; + function q(L, oe, Q) { + I.call(this, L, oe, Q); + } + q.prototype = new I(), q.prototype.finalize = function() { + return this.encode(this.outputBits, !0), I.prototype.finalize.call(this); + }; + var ce = function(L) { + var oe, Q, X, ee, O, Z, re, he, ae, fe, be, Ae, Te, Re, $e, Me, Oe, ze, De, je, Ue, _e, Ze, ot, ke, rt, nt, Ge, ht, lt, ct, qt, Gt, Et, Yt, tr, Tt, kt, It, dt, Dt, Nt, mt, Bt, Ft, et, $t, H, V, Y, T, F, ie, le, me, Ee, Le, Ie, Qe, Xe, tt, st, vt; + for (X = 0; X < 48; X += 2) + ee = L[0] ^ L[10] ^ L[20] ^ L[30] ^ L[40], O = L[1] ^ L[11] ^ L[21] ^ L[31] ^ L[41], Z = L[2] ^ L[12] ^ L[22] ^ L[32] ^ L[42], re = L[3] ^ L[13] ^ L[23] ^ L[33] ^ L[43], he = L[4] ^ L[14] ^ L[24] ^ L[34] ^ L[44], ae = L[5] ^ L[15] ^ L[25] ^ L[35] ^ L[45], fe = L[6] ^ L[16] ^ L[26] ^ L[36] ^ L[46], be = L[7] ^ L[17] ^ L[27] ^ L[37] ^ L[47], Ae = L[8] ^ L[18] ^ L[28] ^ L[38] ^ L[48], Te = L[9] ^ L[19] ^ L[29] ^ L[39] ^ L[49], oe = Ae ^ (Z << 1 | re >>> 31), Q = Te ^ (re << 1 | Z >>> 31), L[0] ^= oe, L[1] ^= Q, L[10] ^= oe, L[11] ^= Q, L[20] ^= oe, L[21] ^= Q, L[30] ^= oe, L[31] ^= Q, L[40] ^= oe, L[41] ^= Q, oe = ee ^ (he << 1 | ae >>> 31), Q = O ^ (ae << 1 | he >>> 31), L[2] ^= oe, L[3] ^= Q, L[12] ^= oe, L[13] ^= Q, L[22] ^= oe, L[23] ^= Q, L[32] ^= oe, L[33] ^= Q, L[42] ^= oe, L[43] ^= Q, oe = Z ^ (fe << 1 | be >>> 31), Q = re ^ (be << 1 | fe >>> 31), L[4] ^= oe, L[5] ^= Q, L[14] ^= oe, L[15] ^= Q, L[24] ^= oe, L[25] ^= Q, L[34] ^= oe, L[35] ^= Q, L[44] ^= oe, L[45] ^= Q, oe = he ^ (Ae << 1 | Te >>> 31), Q = ae ^ (Te << 1 | Ae >>> 31), L[6] ^= oe, L[7] ^= Q, L[16] ^= oe, L[17] ^= Q, L[26] ^= oe, L[27] ^= Q, L[36] ^= oe, L[37] ^= Q, L[46] ^= oe, L[47] ^= Q, oe = fe ^ (ee << 1 | O >>> 31), Q = be ^ (O << 1 | ee >>> 31), L[8] ^= oe, L[9] ^= Q, L[18] ^= oe, L[19] ^= Q, L[28] ^= oe, L[29] ^= Q, L[38] ^= oe, L[39] ^= Q, L[48] ^= oe, L[49] ^= Q, Re = L[0], $e = L[1], et = L[11] << 4 | L[10] >>> 28, $t = L[10] << 4 | L[11] >>> 28, Ge = L[20] << 3 | L[21] >>> 29, ht = L[21] << 3 | L[20] >>> 29, Xe = L[31] << 9 | L[30] >>> 23, tt = L[30] << 9 | L[31] >>> 23, Nt = L[40] << 18 | L[41] >>> 14, mt = L[41] << 18 | L[40] >>> 14, Et = L[2] << 1 | L[3] >>> 31, Yt = L[3] << 1 | L[2] >>> 31, Me = L[13] << 12 | L[12] >>> 20, Oe = L[12] << 12 | L[13] >>> 20, H = L[22] << 10 | L[23] >>> 22, V = L[23] << 10 | L[22] >>> 22, lt = L[33] << 13 | L[32] >>> 19, ct = L[32] << 13 | L[33] >>> 19, st = L[42] << 2 | L[43] >>> 30, vt = L[43] << 2 | L[42] >>> 30, le = L[5] << 30 | L[4] >>> 2, me = L[4] << 30 | L[5] >>> 2, tr = L[14] << 6 | L[15] >>> 26, Tt = L[15] << 6 | L[14] >>> 26, ze = L[25] << 11 | L[24] >>> 21, De = L[24] << 11 | L[25] >>> 21, Y = L[34] << 15 | L[35] >>> 17, T = L[35] << 15 | L[34] >>> 17, qt = L[45] << 29 | L[44] >>> 3, Gt = L[44] << 29 | L[45] >>> 3, ot = L[6] << 28 | L[7] >>> 4, ke = L[7] << 28 | L[6] >>> 4, Ee = L[17] << 23 | L[16] >>> 9, Le = L[16] << 23 | L[17] >>> 9, kt = L[26] << 25 | L[27] >>> 7, It = L[27] << 25 | L[26] >>> 7, je = L[36] << 21 | L[37] >>> 11, Ue = L[37] << 21 | L[36] >>> 11, F = L[47] << 24 | L[46] >>> 8, ie = L[46] << 24 | L[47] >>> 8, Bt = L[8] << 27 | L[9] >>> 5, Ft = L[9] << 27 | L[8] >>> 5, rt = L[18] << 20 | L[19] >>> 12, nt = L[19] << 20 | L[18] >>> 12, Ie = L[29] << 7 | L[28] >>> 25, Qe = L[28] << 7 | L[29] >>> 25, dt = L[38] << 8 | L[39] >>> 24, Dt = L[39] << 8 | L[38] >>> 24, _e = L[48] << 14 | L[49] >>> 18, Ze = L[49] << 14 | L[48] >>> 18, L[0] = Re ^ ~Me & ze, L[1] = $e ^ ~Oe & De, L[10] = ot ^ ~rt & Ge, L[11] = ke ^ ~nt & ht, L[20] = Et ^ ~tr & kt, L[21] = Yt ^ ~Tt & It, L[30] = Bt ^ ~et & H, L[31] = Ft ^ ~$t & V, L[40] = le ^ ~Ee & Ie, L[41] = me ^ ~Le & Qe, L[2] = Me ^ ~ze & je, L[3] = Oe ^ ~De & Ue, L[12] = rt ^ ~Ge & lt, L[13] = nt ^ ~ht & ct, L[22] = tr ^ ~kt & dt, L[23] = Tt ^ ~It & Dt, L[32] = et ^ ~H & Y, L[33] = $t ^ ~V & T, L[42] = Ee ^ ~Ie & Xe, L[43] = Le ^ ~Qe & tt, L[4] = ze ^ ~je & _e, L[5] = De ^ ~Ue & Ze, L[14] = Ge ^ ~lt & qt, L[15] = ht ^ ~ct & Gt, L[24] = kt ^ ~dt & Nt, L[25] = It ^ ~Dt & mt, L[34] = H ^ ~Y & F, L[35] = V ^ ~T & ie, L[44] = Ie ^ ~Xe & st, L[45] = Qe ^ ~tt & vt, L[6] = je ^ ~_e & Re, L[7] = Ue ^ ~Ze & $e, L[16] = lt ^ ~qt & ot, L[17] = ct ^ ~Gt & ke, L[26] = dt ^ ~Nt & Et, L[27] = Dt ^ ~mt & Yt, L[36] = Y ^ ~F & Bt, L[37] = T ^ ~ie & Ft, L[46] = Xe ^ ~st & le, L[47] = tt ^ ~vt & me, L[8] = _e ^ ~Re & Me, L[9] = Ze ^ ~$e & Oe, L[18] = qt ^ ~ot & rt, L[19] = Gt ^ ~ke & nt, L[28] = Nt ^ ~Et & tr, L[29] = mt ^ ~Yt & Tt, L[38] = F ^ ~Bt & et, L[39] = ie ^ ~Ft & $t, L[48] = st ^ ~le & Ee, L[49] = vt ^ ~me & Le, L[0] ^= C[X], L[1] ^= C[X + 1]; + }; + if (a) + t.exports = l; + else + for (m = 0; m < p.length; ++m) + i[p[m]] = l[p[m]]; + })(); + })(ug)), ug.exports; +} +var oB = sB(); +const aB = /* @__PURE__ */ Hi(oB), cB = "logger/5.7.0"; +let K2 = !1, V2 = !1; +const Bh = { debug: 1, default: 2, info: 2, warning: 3, error: 4, off: 5 }; +let G2 = Bh.default, fg = null; +function uB() { + try { + const t = []; + if (["NFD", "NFC", "NFKD", "NFKC"].forEach((e) => { + try { + if ("test".normalize(e) !== "test") + throw new Error("bad normalize"); + } catch { + t.push(e); + } + }), t.length) + throw new Error("missing " + t.join(", ")); + if ("é".normalize("NFD") !== "é") + throw new Error("broken implementation"); + } catch (t) { + return t.message; + } + return null; +} +const Y2 = uB(); +var tv; +(function(t) { + t.DEBUG = "DEBUG", t.INFO = "INFO", t.WARNING = "WARNING", t.ERROR = "ERROR", t.OFF = "OFF"; +})(tv || (tv = {})); +var os; +(function(t) { + t.UNKNOWN_ERROR = "UNKNOWN_ERROR", t.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", t.UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION", t.NETWORK_ERROR = "NETWORK_ERROR", t.SERVER_ERROR = "SERVER_ERROR", t.TIMEOUT = "TIMEOUT", t.BUFFER_OVERRUN = "BUFFER_OVERRUN", t.NUMERIC_FAULT = "NUMERIC_FAULT", t.MISSING_NEW = "MISSING_NEW", t.INVALID_ARGUMENT = "INVALID_ARGUMENT", t.MISSING_ARGUMENT = "MISSING_ARGUMENT", t.UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT", t.CALL_EXCEPTION = "CALL_EXCEPTION", t.INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS", t.NONCE_EXPIRED = "NONCE_EXPIRED", t.REPLACEMENT_UNDERPRICED = "REPLACEMENT_UNDERPRICED", t.UNPREDICTABLE_GAS_LIMIT = "UNPREDICTABLE_GAS_LIMIT", t.TRANSACTION_REPLACED = "TRANSACTION_REPLACED", t.ACTION_REJECTED = "ACTION_REJECTED"; +})(os || (os = {})); +const J2 = "0123456789abcdef"; +class Yr { + constructor(e) { + Object.defineProperty(this, "version", { + enumerable: !0, + value: e, + writable: !1 + }); + } + _log(e, r) { + const n = e.toLowerCase(); + Bh[n] == null && this.throwArgumentError("invalid log level name", "logLevel", e), !(G2 > Bh[n]) && console.log.apply(console, r); + } + debug(...e) { + this._log(Yr.levels.DEBUG, e); + } + info(...e) { + this._log(Yr.levels.INFO, e); + } + warn(...e) { + this._log(Yr.levels.WARNING, e); + } + makeError(e, r, n) { + if (V2) + return this.makeError("censored error", r, {}); + r || (r = Yr.errors.UNKNOWN_ERROR), n || (n = {}); + const i = []; + Object.keys(n).forEach((f) => { + const u = n[f]; + try { + if (u instanceof Uint8Array) { + let h = ""; + for (let g = 0; g < u.length; g++) + h += J2[u[g] >> 4], h += J2[u[g] & 15]; + i.push(f + "=Uint8Array(0x" + h + ")"); + } else + i.push(f + "=" + JSON.stringify(u)); + } catch { + i.push(f + "=" + JSON.stringify(n[f].toString())); + } + }), i.push(`code=${r}`), i.push(`version=${this.version}`); + const s = e; + let o = ""; + switch (r) { + case os.NUMERIC_FAULT: { + o = "NUMERIC_FAULT"; + const f = e; + switch (f) { + case "overflow": + case "underflow": + case "division-by-zero": + o += "-" + f; + break; + case "negative-power": + case "negative-width": + o += "-unsupported"; + break; + case "unbound-bitwise-result": + o += "-unbound-result"; + break; + } + break; + } + case os.CALL_EXCEPTION: + case os.INSUFFICIENT_FUNDS: + case os.MISSING_NEW: + case os.NONCE_EXPIRED: + case os.REPLACEMENT_UNDERPRICED: + case os.TRANSACTION_REPLACED: + case os.UNPREDICTABLE_GAS_LIMIT: + o = r; + break; + } + o && (e += " [ See: https://links.ethers.org/v5-errors-" + o + " ]"), i.length && (e += " (" + i.join(", ") + ")"); + const a = new Error(e); + return a.reason = s, a.code = r, Object.keys(n).forEach(function(f) { + a[f] = n[f]; + }), a; + } + throwError(e, r, n) { + throw this.makeError(e, r, n); + } + throwArgumentError(e, r, n) { + return this.throwError(e, Yr.errors.INVALID_ARGUMENT, { + argument: r, + value: n + }); + } + assert(e, r, n, i) { + e || this.throwError(r, n, i); + } + assertArgument(e, r, n, i) { + e || this.throwArgumentError(r, n, i); + } + checkNormalize(e) { + Y2 && this.throwError("platform missing String.prototype.normalize", Yr.errors.UNSUPPORTED_OPERATION, { + operation: "String.prototype.normalize", + form: Y2 + }); + } + checkSafeUint53(e, r) { + typeof e == "number" && (r == null && (r = "value not safe"), (e < 0 || e >= 9007199254740991) && this.throwError(r, Yr.errors.NUMERIC_FAULT, { + operation: "checkSafeInteger", + fault: "out-of-safe-range", + value: e + }), e % 1 && this.throwError(r, Yr.errors.NUMERIC_FAULT, { + operation: "checkSafeInteger", + fault: "non-integer", + value: e + })); + } + checkArgumentCount(e, r, n) { + n ? n = ": " + n : n = "", e < r && this.throwError("missing argument" + n, Yr.errors.MISSING_ARGUMENT, { + count: e, + expectedCount: r + }), e > r && this.throwError("too many arguments" + n, Yr.errors.UNEXPECTED_ARGUMENT, { + count: e, + expectedCount: r + }); + } + checkNew(e, r) { + (e === Object || e == null) && this.throwError("missing new", Yr.errors.MISSING_NEW, { name: r.name }); + } + checkAbstract(e, r) { + e === r ? this.throwError("cannot instantiate abstract class " + JSON.stringify(r.name) + " directly; use a sub-class", Yr.errors.UNSUPPORTED_OPERATION, { name: e.name, operation: "new" }) : (e === Object || e == null) && this.throwError("missing new", Yr.errors.MISSING_NEW, { name: r.name }); + } + static globalLogger() { + return fg || (fg = new Yr(cB)), fg; + } + static setCensorship(e, r) { + if (!e && r && this.globalLogger().throwError("cannot permanently disable censorship", Yr.errors.UNSUPPORTED_OPERATION, { + operation: "setCensorship" + }), K2) { + if (!e) + return; + this.globalLogger().throwError("error censorship permanent", Yr.errors.UNSUPPORTED_OPERATION, { + operation: "setCensorship" + }); + } + V2 = !!e, K2 = !!r; + } + static setLogLevel(e) { + const r = Bh[e.toLowerCase()]; + if (r == null) { + Yr.globalLogger().warn("invalid log level - " + e); + return; + } + G2 = r; + } + static from(e) { + return new Yr(e); + } +} +Yr.errors = os; +Yr.levels = tv; +const fB = "bytes/5.7.0", ln = new Yr(fB); +function c8(t) { + return !!t.toHexString; +} +function Dc(t) { + return t.slice || (t.slice = function() { + const e = Array.prototype.slice.call(arguments); + return Dc(new Uint8Array(Array.prototype.slice.apply(t, e))); + }), t; +} +function lB(t) { + return Is(t) && !(t.length % 2) || p1(t); +} +function X2(t) { + return typeof t == "number" && t == t && t % 1 === 0; +} +function p1(t) { + if (t == null) + return !1; + if (t.constructor === Uint8Array) + return !0; + if (typeof t == "string" || !X2(t.length) || t.length < 0) + return !1; + for (let e = 0; e < t.length; e++) { + const r = t[e]; + if (!X2(r) || r < 0 || r >= 256) + return !1; + } + return !0; +} +function bn(t, e) { + if (e || (e = {}), typeof t == "number") { + ln.checkSafeUint53(t, "invalid arrayify value"); + const r = []; + for (; t; ) + r.unshift(t & 255), t = parseInt(String(t / 256)); + return r.length === 0 && r.push(0), Dc(new Uint8Array(r)); + } + if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), c8(t) && (t = t.toHexString()), Is(t)) { + let r = t.substring(2); + r.length % 2 && (e.hexPad === "left" ? r = "0" + r : e.hexPad === "right" ? r += "0" : ln.throwArgumentError("hex data is odd-length", "value", t)); + const n = []; + for (let i = 0; i < r.length; i += 2) + n.push(parseInt(r.substring(i, i + 2), 16)); + return Dc(new Uint8Array(n)); + } + return p1(t) ? Dc(new Uint8Array(t)) : ln.throwArgumentError("invalid arrayify value", "value", t); +} +function hB(t) { + const e = t.map((i) => bn(i)), r = e.reduce((i, s) => i + s.length, 0), n = new Uint8Array(r); + return e.reduce((i, s) => (n.set(s, i), i + s.length), 0), Dc(n); +} +function dB(t, e) { + t = bn(t), t.length > e && ln.throwArgumentError("value out of range", "value", arguments[0]); + const r = new Uint8Array(e); + return r.set(t, e - t.length), Dc(r); +} +function Is(t, e) { + return !(typeof t != "string" || !t.match(/^0x[0-9A-Fa-f]*$/) || e && t.length !== 2 + 2 * e); +} +const lg = "0123456789abcdef"; +function _i(t, e) { + if (e || (e = {}), typeof t == "number") { + ln.checkSafeUint53(t, "invalid hexlify value"); + let r = ""; + for (; t; ) + r = lg[t & 15] + r, t = Math.floor(t / 16); + return r.length ? (r.length % 2 && (r = "0" + r), "0x" + r) : "0x00"; + } + if (typeof t == "bigint") + return t = t.toString(16), t.length % 2 ? "0x0" + t : "0x" + t; + if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), c8(t)) + return t.toHexString(); + if (Is(t)) + return t.length % 2 && (e.hexPad === "left" ? t = "0x0" + t.substring(2) : e.hexPad === "right" ? t += "0" : ln.throwArgumentError("hex data is odd-length", "value", t)), t.toLowerCase(); + if (p1(t)) { + let r = "0x"; + for (let n = 0; n < t.length; n++) { + let i = t[n]; + r += lg[(i & 240) >> 4] + lg[i & 15]; + } + return r; + } + return ln.throwArgumentError("invalid hexlify value", "value", t); +} +function pB(t) { + if (typeof t != "string") + t = _i(t); + else if (!Is(t) || t.length % 2) + return null; + return (t.length - 2) / 2; +} +function Z2(t, e, r) { + return typeof t != "string" ? t = _i(t) : (!Is(t) || t.length % 2) && ln.throwArgumentError("invalid hexData", "value", t), e = 2 + 2 * e, "0x" + t.substring(e); +} +function Oc(t, e) { + for (typeof t != "string" ? t = _i(t) : Is(t) || ln.throwArgumentError("invalid hex string", "value", t), t.length > 2 * e + 2 && ln.throwArgumentError("value out of range", "value", arguments[1]); t.length < 2 * e + 2; ) + t = "0x0" + t.substring(2); + return t; +} +function u8(t) { + const e = { + r: "0x", + s: "0x", + _vs: "0x", + recoveryParam: 0, + v: 0, + yParityAndS: "0x", + compact: "0x" + }; + if (lB(t)) { + let r = bn(t); + r.length === 64 ? (e.v = 27 + (r[32] >> 7), r[32] &= 127, e.r = _i(r.slice(0, 32)), e.s = _i(r.slice(32, 64))) : r.length === 65 ? (e.r = _i(r.slice(0, 32)), e.s = _i(r.slice(32, 64)), e.v = r[64]) : ln.throwArgumentError("invalid signature string", "signature", t), e.v < 27 && (e.v === 0 || e.v === 1 ? e.v += 27 : ln.throwArgumentError("signature invalid v byte", "signature", t)), e.recoveryParam = 1 - e.v % 2, e.recoveryParam && (r[32] |= 128), e._vs = _i(r.slice(32, 64)); + } else { + if (e.r = t.r, e.s = t.s, e.v = t.v, e.recoveryParam = t.recoveryParam, e._vs = t._vs, e._vs != null) { + const i = dB(bn(e._vs), 32); + e._vs = _i(i); + const s = i[0] >= 128 ? 1 : 0; + e.recoveryParam == null ? e.recoveryParam = s : e.recoveryParam !== s && ln.throwArgumentError("signature recoveryParam mismatch _vs", "signature", t), i[0] &= 127; + const o = _i(i); + e.s == null ? e.s = o : e.s !== o && ln.throwArgumentError("signature v mismatch _vs", "signature", t); + } + if (e.recoveryParam == null) + e.v == null ? ln.throwArgumentError("signature missing v and recoveryParam", "signature", t) : e.v === 0 || e.v === 1 ? e.recoveryParam = e.v : e.recoveryParam = 1 - e.v % 2; + else if (e.v == null) + e.v = 27 + e.recoveryParam; + else { + const i = e.v === 0 || e.v === 1 ? e.v : 1 - e.v % 2; + e.recoveryParam !== i && ln.throwArgumentError("signature recoveryParam mismatch v", "signature", t); + } + e.r == null || !Is(e.r) ? ln.throwArgumentError("signature missing or invalid r", "signature", t) : e.r = Oc(e.r, 32), e.s == null || !Is(e.s) ? ln.throwArgumentError("signature missing or invalid s", "signature", t) : e.s = Oc(e.s, 32); + const r = bn(e.s); + r[0] >= 128 && ln.throwArgumentError("signature s out of range", "signature", t), e.recoveryParam && (r[0] |= 128); + const n = _i(r); + e._vs && (Is(e._vs) || ln.throwArgumentError("signature invalid _vs", "signature", t), e._vs = Oc(e._vs, 32)), e._vs == null ? e._vs = n : e._vs !== n && ln.throwArgumentError("signature _vs mismatch v and s", "signature", t); + } + return e.yParityAndS = e._vs, e.compact = e.r + e.yParityAndS.substring(2), e; +} +function g1(t) { + return "0x" + aB.keccak_256(bn(t)); +} +var Fh = { exports: {} }, gB = Fh.exports, Q2; +function mB() { + return Q2 || (Q2 = 1, (function(t) { + (function(e, r) { + function n(b, l) { + if (!b) throw new Error(l || "Assertion failed"); + } + function i(b, l) { + b.super_ = l; + var p = function() { + }; + p.prototype = l.prototype, b.prototype = new p(), b.prototype.constructor = b; + } + function s(b, l, p) { + if (s.isBN(b)) + return b; + this.negative = 0, this.words = null, this.length = 0, this.red = null, b !== null && ((l === "le" || l === "be") && (p = l, l = 10), this._init(b || 0, l || 10, p || "be")); + } + typeof e == "object" ? e.exports = s : r.BN = s, s.BN = s, s.wordSize = 26; + var o; + try { + typeof window < "u" && typeof window.Buffer < "u" ? o = window.Buffer : o = Qf.Buffer; + } catch { + } + s.isBN = function(l) { + return l instanceof s ? !0 : l !== null && typeof l == "object" && l.constructor.wordSize === s.wordSize && Array.isArray(l.words); + }, s.max = function(l, p) { + return l.cmp(p) > 0 ? l : p; + }, s.min = function(l, p) { + return l.cmp(p) < 0 ? l : p; + }, s.prototype._init = function(l, p, m) { + if (typeof l == "number") + return this._initNumber(l, p, m); + if (typeof l == "object") + return this._initArray(l, p, m); + p === "hex" && (p = 16), n(p === (p | 0) && p >= 2 && p <= 36), l = l.toString().replace(/\s+/g, ""); + var w = 0; + l[0] === "-" && (w++, this.negative = 1), w < l.length && (p === 16 ? this._parseHex(l, w, m) : (this._parseBase(l, p, w), m === "le" && this._initArray(this.toArray(), p, m))); + }, s.prototype._initNumber = function(l, p, m) { + l < 0 && (this.negative = 1, l = -l), l < 67108864 ? (this.words = [l & 67108863], this.length = 1) : l < 4503599627370496 ? (this.words = [ + l & 67108863, + l / 67108864 & 67108863 + ], this.length = 2) : (n(l < 9007199254740992), this.words = [ + l & 67108863, + l / 67108864 & 67108863, + 1 + ], this.length = 3), m === "le" && this._initArray(this.toArray(), p, m); + }, s.prototype._initArray = function(l, p, m) { + if (n(typeof l.length == "number"), l.length <= 0) + return this.words = [0], this.length = 1, this; + this.length = Math.ceil(l.length / 3), this.words = new Array(this.length); + for (var w = 0; w < this.length; w++) + this.words[w] = 0; + var P, _, y = 0; + if (m === "be") + for (w = l.length - 1, P = 0; w >= 0; w -= 3) + _ = l[w] | l[w - 1] << 8 | l[w - 2] << 16, this.words[P] |= _ << y & 67108863, this.words[P + 1] = _ >>> 26 - y & 67108863, y += 24, y >= 26 && (y -= 26, P++); + else if (m === "le") + for (w = 0, P = 0; w < l.length; w += 3) + _ = l[w] | l[w + 1] << 8 | l[w + 2] << 16, this.words[P] |= _ << y & 67108863, this.words[P + 1] = _ >>> 26 - y & 67108863, y += 24, y >= 26 && (y -= 26, P++); + return this._strip(); + }; + function a(b, l) { + var p = b.charCodeAt(l); + if (p >= 48 && p <= 57) + return p - 48; + if (p >= 65 && p <= 70) + return p - 55; + if (p >= 97 && p <= 102) + return p - 87; + n(!1, "Invalid character in " + b); + } + function f(b, l, p) { + var m = a(b, p); + return p - 1 >= l && (m |= a(b, p - 1) << 4), m; + } + s.prototype._parseHex = function(l, p, m) { + this.length = Math.ceil((l.length - p) / 6), this.words = new Array(this.length); + for (var w = 0; w < this.length; w++) + this.words[w] = 0; + var P = 0, _ = 0, y; + if (m === "be") + for (w = l.length - 1; w >= p; w -= 2) + y = f(l, p, w) << P, this.words[_] |= y & 67108863, P >= 18 ? (P -= 18, _ += 1, this.words[_] |= y >>> 26) : P += 8; + else { + var M = l.length - p; + for (w = M % 2 === 0 ? p + 1 : p; w < l.length; w += 2) + y = f(l, p, w) << P, this.words[_] |= y & 67108863, P >= 18 ? (P -= 18, _ += 1, this.words[_] |= y >>> 26) : P += 8; + } + this._strip(); + }; + function u(b, l, p, m) { + for (var w = 0, P = 0, _ = Math.min(b.length, p), y = l; y < _; y++) { + var M = b.charCodeAt(y) - 48; + w *= m, M >= 49 ? P = M - 49 + 10 : M >= 17 ? P = M - 17 + 10 : P = M, n(M >= 0 && P < m, "Invalid character"), w += P; + } + return w; + } + s.prototype._parseBase = function(l, p, m) { + this.words = [0], this.length = 1; + for (var w = 0, P = 1; P <= 67108863; P *= p) + w++; + w--, P = P / p | 0; + for (var _ = l.length - m, y = _ % w, M = Math.min(_, _ - y) + m, I = 0, q = m; q < M; q += w) + I = u(l, q, q + w, p), this.imuln(P), this.words[0] + I < 67108864 ? this.words[0] += I : this._iaddn(I); + if (y !== 0) { + var ce = 1; + for (I = u(l, q, l.length, p), q = 0; q < y; q++) + ce *= p; + this.imuln(ce), this.words[0] + I < 67108864 ? this.words[0] += I : this._iaddn(I); + } + this._strip(); + }, s.prototype.copy = function(l) { + l.words = new Array(this.length); + for (var p = 0; p < this.length; p++) + l.words[p] = this.words[p]; + l.length = this.length, l.negative = this.negative, l.red = this.red; + }; + function h(b, l) { + b.words = l.words, b.length = l.length, b.negative = l.negative, b.red = l.red; + } + if (s.prototype._move = function(l) { + h(l, this); + }, s.prototype.clone = function() { + var l = new s(null); + return this.copy(l), l; + }, s.prototype._expand = function(l) { + for (; this.length < l; ) + this.words[this.length++] = 0; + return this; + }, s.prototype._strip = function() { + for (; this.length > 1 && this.words[this.length - 1] === 0; ) + this.length--; + return this._normSign(); + }, s.prototype._normSign = function() { + return this.length === 1 && this.words[0] === 0 && (this.negative = 0), this; + }, typeof Symbol < "u" && typeof Symbol.for == "function") + try { + s.prototype[Symbol.for("nodejs.util.inspect.custom")] = g; + } catch { + s.prototype.inspect = g; + } + else + s.prototype.inspect = g; + function g() { + return (this.red ? ""; + } + var v = [ + "", + "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" + ], x = [ + 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 + ], S = [ + 0, + 0, + 33554432, + 43046721, + 16777216, + 48828125, + 60466176, + 40353607, + 16777216, + 43046721, + 1e7, + 19487171, + 35831808, + 62748517, + 7529536, + 11390625, + 16777216, + 24137569, + 34012224, + 47045881, + 64e6, + 4084101, + 5153632, + 6436343, + 7962624, + 9765625, + 11881376, + 14348907, + 17210368, + 20511149, + 243e5, + 28629151, + 33554432, + 39135393, + 45435424, + 52521875, + 60466176 + ]; + s.prototype.toString = function(l, p) { + l = l || 10, p = p | 0 || 1; + var m; + if (l === 16 || l === "hex") { + m = ""; + for (var w = 0, P = 0, _ = 0; _ < this.length; _++) { + var y = this.words[_], M = ((y << w | P) & 16777215).toString(16); + P = y >>> 24 - w & 16777215, w += 2, w >= 26 && (w -= 26, _--), P !== 0 || _ !== this.length - 1 ? m = v[6 - M.length] + M + m : m = M + m; + } + for (P !== 0 && (m = P.toString(16) + m); m.length % p !== 0; ) + m = "0" + m; + return this.negative !== 0 && (m = "-" + m), m; + } + if (l === (l | 0) && l >= 2 && l <= 36) { + var I = x[l], q = S[l]; + m = ""; + var ce = this.clone(); + for (ce.negative = 0; !ce.isZero(); ) { + var L = ce.modrn(q).toString(l); + ce = ce.idivn(q), ce.isZero() ? m = L + m : m = v[I - L.length] + L + m; + } + for (this.isZero() && (m = "0" + m); m.length % p !== 0; ) + m = "0" + m; + return this.negative !== 0 && (m = "-" + m), m; + } + n(!1, "Base should be between 2 and 36"); + }, s.prototype.toNumber = function() { + var l = this.words[0]; + return this.length === 2 ? l += this.words[1] * 67108864 : this.length === 3 && this.words[2] === 1 ? l += 4503599627370496 + this.words[1] * 67108864 : this.length > 2 && n(!1, "Number can only safely store up to 53 bits"), this.negative !== 0 ? -l : l; + }, s.prototype.toJSON = function() { + return this.toString(16, 2); + }, o && (s.prototype.toBuffer = function(l, p) { + return this.toArrayLike(o, l, p); + }), s.prototype.toArray = function(l, p) { + return this.toArrayLike(Array, l, p); + }; + var C = function(l, p) { + return l.allocUnsafe ? l.allocUnsafe(p) : new l(p); + }; + s.prototype.toArrayLike = function(l, p, m) { + this._strip(); + var w = this.byteLength(), P = m || Math.max(1, w); + n(w <= P, "byte array longer than desired length"), n(P > 0, "Requested array length <= 0"); + var _ = C(l, P), y = p === "le" ? "LE" : "BE"; + return this["_toArrayLike" + y](_, w), _; + }, s.prototype._toArrayLikeLE = function(l, p) { + for (var m = 0, w = 0, P = 0, _ = 0; P < this.length; P++) { + var y = this.words[P] << _ | w; + l[m++] = y & 255, m < l.length && (l[m++] = y >> 8 & 255), m < l.length && (l[m++] = y >> 16 & 255), _ === 6 ? (m < l.length && (l[m++] = y >> 24 & 255), w = 0, _ = 0) : (w = y >>> 24, _ += 2); + } + if (m < l.length) + for (l[m++] = w; m < l.length; ) + l[m++] = 0; + }, s.prototype._toArrayLikeBE = function(l, p) { + for (var m = l.length - 1, w = 0, P = 0, _ = 0; P < this.length; P++) { + var y = this.words[P] << _ | w; + l[m--] = y & 255, m >= 0 && (l[m--] = y >> 8 & 255), m >= 0 && (l[m--] = y >> 16 & 255), _ === 6 ? (m >= 0 && (l[m--] = y >> 24 & 255), w = 0, _ = 0) : (w = y >>> 24, _ += 2); + } + if (m >= 0) + for (l[m--] = w; m >= 0; ) + l[m--] = 0; + }, Math.clz32 ? s.prototype._countBits = function(l) { + return 32 - Math.clz32(l); + } : s.prototype._countBits = function(l) { + var p = l, m = 0; + return p >= 4096 && (m += 13, p >>>= 13), p >= 64 && (m += 7, p >>>= 7), p >= 8 && (m += 4, p >>>= 4), p >= 2 && (m += 2, p >>>= 2), m + p; + }, s.prototype._zeroBits = function(l) { + if (l === 0) return 26; + var p = l, m = 0; + return (p & 8191) === 0 && (m += 13, p >>>= 13), (p & 127) === 0 && (m += 7, p >>>= 7), (p & 15) === 0 && (m += 4, p >>>= 4), (p & 3) === 0 && (m += 2, p >>>= 2), (p & 1) === 0 && m++, m; + }, s.prototype.bitLength = function() { + var l = this.words[this.length - 1], p = this._countBits(l); + return (this.length - 1) * 26 + p; + }; + function D(b) { + for (var l = new Array(b.bitLength()), p = 0; p < l.length; p++) { + var m = p / 26 | 0, w = p % 26; + l[p] = b.words[m] >>> w & 1; + } + return l; + } + s.prototype.zeroBits = function() { + if (this.isZero()) return 0; + for (var l = 0, p = 0; p < this.length; p++) { + var m = this._zeroBits(this.words[p]); + if (l += m, m !== 26) break; + } + return l; + }, s.prototype.byteLength = function() { + return Math.ceil(this.bitLength() / 8); + }, s.prototype.toTwos = function(l) { + return this.negative !== 0 ? this.abs().inotn(l).iaddn(1) : this.clone(); + }, s.prototype.fromTwos = function(l) { + return this.testn(l - 1) ? this.notn(l).iaddn(1).ineg() : this.clone(); + }, s.prototype.isNeg = function() { + return this.negative !== 0; + }, s.prototype.neg = function() { + return this.clone().ineg(); + }, s.prototype.ineg = function() { + return this.isZero() || (this.negative ^= 1), this; + }, s.prototype.iuor = function(l) { + for (; this.length < l.length; ) + this.words[this.length++] = 0; + for (var p = 0; p < l.length; p++) + this.words[p] = this.words[p] | l.words[p]; + return this._strip(); + }, s.prototype.ior = function(l) { + return n((this.negative | l.negative) === 0), this.iuor(l); + }, s.prototype.or = function(l) { + return this.length > l.length ? this.clone().ior(l) : l.clone().ior(this); + }, s.prototype.uor = function(l) { + return this.length > l.length ? this.clone().iuor(l) : l.clone().iuor(this); + }, s.prototype.iuand = function(l) { + var p; + this.length > l.length ? p = l : p = this; + for (var m = 0; m < p.length; m++) + this.words[m] = this.words[m] & l.words[m]; + return this.length = p.length, this._strip(); + }, s.prototype.iand = function(l) { + return n((this.negative | l.negative) === 0), this.iuand(l); + }, s.prototype.and = function(l) { + return this.length > l.length ? this.clone().iand(l) : l.clone().iand(this); + }, s.prototype.uand = function(l) { + return this.length > l.length ? this.clone().iuand(l) : l.clone().iuand(this); + }, s.prototype.iuxor = function(l) { + var p, m; + this.length > l.length ? (p = this, m = l) : (p = l, m = this); + for (var w = 0; w < m.length; w++) + this.words[w] = p.words[w] ^ m.words[w]; + if (this !== p) + for (; w < p.length; w++) + this.words[w] = p.words[w]; + return this.length = p.length, this._strip(); + }, s.prototype.ixor = function(l) { + return n((this.negative | l.negative) === 0), this.iuxor(l); + }, s.prototype.xor = function(l) { + return this.length > l.length ? this.clone().ixor(l) : l.clone().ixor(this); + }, s.prototype.uxor = function(l) { + return this.length > l.length ? this.clone().iuxor(l) : l.clone().iuxor(this); + }, s.prototype.inotn = function(l) { + n(typeof l == "number" && l >= 0); + var p = Math.ceil(l / 26) | 0, m = l % 26; + this._expand(p), m > 0 && p--; + for (var w = 0; w < p; w++) + this.words[w] = ~this.words[w] & 67108863; + return m > 0 && (this.words[w] = ~this.words[w] & 67108863 >> 26 - m), this._strip(); + }, s.prototype.notn = function(l) { + return this.clone().inotn(l); + }, s.prototype.setn = function(l, p) { + n(typeof l == "number" && l >= 0); + var m = l / 26 | 0, w = l % 26; + return this._expand(m + 1), p ? this.words[m] = this.words[m] | 1 << w : this.words[m] = this.words[m] & ~(1 << w), this._strip(); + }, s.prototype.iadd = function(l) { + var p; + if (this.negative !== 0 && l.negative === 0) + return this.negative = 0, p = this.isub(l), this.negative ^= 1, this._normSign(); + if (this.negative === 0 && l.negative !== 0) + return l.negative = 0, p = this.isub(l), l.negative = 1, p._normSign(); + var m, w; + this.length > l.length ? (m = this, w = l) : (m = l, w = this); + for (var P = 0, _ = 0; _ < w.length; _++) + p = (m.words[_] | 0) + (w.words[_] | 0) + P, this.words[_] = p & 67108863, P = p >>> 26; + for (; P !== 0 && _ < m.length; _++) + p = (m.words[_] | 0) + P, this.words[_] = p & 67108863, P = p >>> 26; + if (this.length = m.length, P !== 0) + this.words[this.length] = P, this.length++; + else if (m !== this) + for (; _ < m.length; _++) + this.words[_] = m.words[_]; + return this; + }, s.prototype.add = function(l) { + var p; + return l.negative !== 0 && this.negative === 0 ? (l.negative = 0, p = this.sub(l), l.negative ^= 1, p) : l.negative === 0 && this.negative !== 0 ? (this.negative = 0, p = l.sub(this), this.negative = 1, p) : this.length > l.length ? this.clone().iadd(l) : l.clone().iadd(this); + }, s.prototype.isub = function(l) { + if (l.negative !== 0) { + l.negative = 0; + var p = this.iadd(l); + return l.negative = 1, p._normSign(); + } else if (this.negative !== 0) + return this.negative = 0, this.iadd(l), this.negative = 1, this._normSign(); + var m = this.cmp(l); + if (m === 0) + return this.negative = 0, this.length = 1, this.words[0] = 0, this; + var w, P; + m > 0 ? (w = this, P = l) : (w = l, P = this); + for (var _ = 0, y = 0; y < P.length; y++) + p = (w.words[y] | 0) - (P.words[y] | 0) + _, _ = p >> 26, this.words[y] = p & 67108863; + for (; _ !== 0 && y < w.length; y++) + p = (w.words[y] | 0) + _, _ = p >> 26, this.words[y] = p & 67108863; + if (_ === 0 && y < w.length && w !== this) + for (; y < w.length; y++) + this.words[y] = w.words[y]; + return this.length = Math.max(this.length, y), w !== this && (this.negative = 1), this._strip(); + }, s.prototype.sub = function(l) { + return this.clone().isub(l); + }; + function $(b, l, p) { + p.negative = l.negative ^ b.negative; + var m = b.length + l.length | 0; + p.length = m, m = m - 1 | 0; + var w = b.words[0] | 0, P = l.words[0] | 0, _ = w * P, y = _ & 67108863, M = _ / 67108864 | 0; + p.words[0] = y; + for (var I = 1; I < m; I++) { + for (var q = M >>> 26, ce = M & 67108863, L = Math.min(I, l.length - 1), oe = Math.max(0, I - b.length + 1); oe <= L; oe++) { + var Q = I - oe | 0; + w = b.words[Q] | 0, P = l.words[oe] | 0, _ = w * P + ce, q += _ / 67108864 | 0, ce = _ & 67108863; + } + p.words[I] = ce | 0, M = q | 0; + } + return M !== 0 ? p.words[I] = M | 0 : p.length--, p._strip(); + } + var N = function(l, p, m) { + var w = l.words, P = p.words, _ = m.words, y = 0, M, I, q, ce = w[0] | 0, L = ce & 8191, oe = ce >>> 13, Q = w[1] | 0, X = Q & 8191, ee = Q >>> 13, O = w[2] | 0, Z = O & 8191, re = O >>> 13, he = w[3] | 0, ae = he & 8191, fe = he >>> 13, be = w[4] | 0, Ae = be & 8191, Te = be >>> 13, Re = w[5] | 0, $e = Re & 8191, Me = Re >>> 13, Oe = w[6] | 0, ze = Oe & 8191, De = Oe >>> 13, je = w[7] | 0, Ue = je & 8191, _e = je >>> 13, Ze = w[8] | 0, ot = Ze & 8191, ke = Ze >>> 13, rt = w[9] | 0, nt = rt & 8191, Ge = rt >>> 13, ht = P[0] | 0, lt = ht & 8191, ct = ht >>> 13, qt = P[1] | 0, Gt = qt & 8191, Et = qt >>> 13, Yt = P[2] | 0, tr = Yt & 8191, Tt = Yt >>> 13, kt = P[3] | 0, It = kt & 8191, dt = kt >>> 13, Dt = P[4] | 0, Nt = Dt & 8191, mt = Dt >>> 13, Bt = P[5] | 0, Ft = Bt & 8191, et = Bt >>> 13, $t = P[6] | 0, H = $t & 8191, V = $t >>> 13, Y = P[7] | 0, T = Y & 8191, F = Y >>> 13, ie = P[8] | 0, le = ie & 8191, me = ie >>> 13, Ee = P[9] | 0, Le = Ee & 8191, Ie = Ee >>> 13; + m.negative = l.negative ^ p.negative, m.length = 19, M = Math.imul(L, lt), I = Math.imul(L, ct), I = I + Math.imul(oe, lt) | 0, q = Math.imul(oe, ct); + var Qe = (y + M | 0) + ((I & 8191) << 13) | 0; + y = (q + (I >>> 13) | 0) + (Qe >>> 26) | 0, Qe &= 67108863, M = Math.imul(X, lt), I = Math.imul(X, ct), I = I + Math.imul(ee, lt) | 0, q = Math.imul(ee, ct), M = M + Math.imul(L, Gt) | 0, I = I + Math.imul(L, Et) | 0, I = I + Math.imul(oe, Gt) | 0, q = q + Math.imul(oe, Et) | 0; + var Xe = (y + M | 0) + ((I & 8191) << 13) | 0; + y = (q + (I >>> 13) | 0) + (Xe >>> 26) | 0, Xe &= 67108863, M = Math.imul(Z, lt), I = Math.imul(Z, ct), I = I + Math.imul(re, lt) | 0, q = Math.imul(re, ct), M = M + Math.imul(X, Gt) | 0, I = I + Math.imul(X, Et) | 0, I = I + Math.imul(ee, Gt) | 0, q = q + Math.imul(ee, Et) | 0, M = M + Math.imul(L, tr) | 0, I = I + Math.imul(L, Tt) | 0, I = I + Math.imul(oe, tr) | 0, q = q + Math.imul(oe, Tt) | 0; + var tt = (y + M | 0) + ((I & 8191) << 13) | 0; + y = (q + (I >>> 13) | 0) + (tt >>> 26) | 0, tt &= 67108863, M = Math.imul(ae, lt), I = Math.imul(ae, ct), I = I + Math.imul(fe, lt) | 0, q = Math.imul(fe, ct), M = M + Math.imul(Z, Gt) | 0, I = I + Math.imul(Z, Et) | 0, I = I + Math.imul(re, Gt) | 0, q = q + Math.imul(re, Et) | 0, M = M + Math.imul(X, tr) | 0, I = I + Math.imul(X, Tt) | 0, I = I + Math.imul(ee, tr) | 0, q = q + Math.imul(ee, Tt) | 0, M = M + Math.imul(L, It) | 0, I = I + Math.imul(L, dt) | 0, I = I + Math.imul(oe, It) | 0, q = q + Math.imul(oe, dt) | 0; + var st = (y + M | 0) + ((I & 8191) << 13) | 0; + y = (q + (I >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, M = Math.imul(Ae, lt), I = Math.imul(Ae, ct), I = I + Math.imul(Te, lt) | 0, q = Math.imul(Te, ct), M = M + Math.imul(ae, Gt) | 0, I = I + Math.imul(ae, Et) | 0, I = I + Math.imul(fe, Gt) | 0, q = q + Math.imul(fe, Et) | 0, M = M + Math.imul(Z, tr) | 0, I = I + Math.imul(Z, Tt) | 0, I = I + Math.imul(re, tr) | 0, q = q + Math.imul(re, Tt) | 0, M = M + Math.imul(X, It) | 0, I = I + Math.imul(X, dt) | 0, I = I + Math.imul(ee, It) | 0, q = q + Math.imul(ee, dt) | 0, M = M + Math.imul(L, Nt) | 0, I = I + Math.imul(L, mt) | 0, I = I + Math.imul(oe, Nt) | 0, q = q + Math.imul(oe, mt) | 0; + var vt = (y + M | 0) + ((I & 8191) << 13) | 0; + y = (q + (I >>> 13) | 0) + (vt >>> 26) | 0, vt &= 67108863, M = Math.imul($e, lt), I = Math.imul($e, ct), I = I + Math.imul(Me, lt) | 0, q = Math.imul(Me, ct), M = M + Math.imul(Ae, Gt) | 0, I = I + Math.imul(Ae, Et) | 0, I = I + Math.imul(Te, Gt) | 0, q = q + Math.imul(Te, Et) | 0, M = M + Math.imul(ae, tr) | 0, I = I + Math.imul(ae, Tt) | 0, I = I + Math.imul(fe, tr) | 0, q = q + Math.imul(fe, Tt) | 0, M = M + Math.imul(Z, It) | 0, I = I + Math.imul(Z, dt) | 0, I = I + Math.imul(re, It) | 0, q = q + Math.imul(re, dt) | 0, M = M + Math.imul(X, Nt) | 0, I = I + Math.imul(X, mt) | 0, I = I + Math.imul(ee, Nt) | 0, q = q + Math.imul(ee, mt) | 0, M = M + Math.imul(L, Ft) | 0, I = I + Math.imul(L, et) | 0, I = I + Math.imul(oe, Ft) | 0, q = q + Math.imul(oe, et) | 0; + var Ct = (y + M | 0) + ((I & 8191) << 13) | 0; + y = (q + (I >>> 13) | 0) + (Ct >>> 26) | 0, Ct &= 67108863, M = Math.imul(ze, lt), I = Math.imul(ze, ct), I = I + Math.imul(De, lt) | 0, q = Math.imul(De, ct), M = M + Math.imul($e, Gt) | 0, I = I + Math.imul($e, Et) | 0, I = I + Math.imul(Me, Gt) | 0, q = q + Math.imul(Me, Et) | 0, M = M + Math.imul(Ae, tr) | 0, I = I + Math.imul(Ae, Tt) | 0, I = I + Math.imul(Te, tr) | 0, q = q + Math.imul(Te, Tt) | 0, M = M + Math.imul(ae, It) | 0, I = I + Math.imul(ae, dt) | 0, I = I + Math.imul(fe, It) | 0, q = q + Math.imul(fe, dt) | 0, M = M + Math.imul(Z, Nt) | 0, I = I + Math.imul(Z, mt) | 0, I = I + Math.imul(re, Nt) | 0, q = q + Math.imul(re, mt) | 0, M = M + Math.imul(X, Ft) | 0, I = I + Math.imul(X, et) | 0, I = I + Math.imul(ee, Ft) | 0, q = q + Math.imul(ee, et) | 0, M = M + Math.imul(L, H) | 0, I = I + Math.imul(L, V) | 0, I = I + Math.imul(oe, H) | 0, q = q + Math.imul(oe, V) | 0; + var Mt = (y + M | 0) + ((I & 8191) << 13) | 0; + y = (q + (I >>> 13) | 0) + (Mt >>> 26) | 0, Mt &= 67108863, M = Math.imul(Ue, lt), I = Math.imul(Ue, ct), I = I + Math.imul(_e, lt) | 0, q = Math.imul(_e, ct), M = M + Math.imul(ze, Gt) | 0, I = I + Math.imul(ze, Et) | 0, I = I + Math.imul(De, Gt) | 0, q = q + Math.imul(De, Et) | 0, M = M + Math.imul($e, tr) | 0, I = I + Math.imul($e, Tt) | 0, I = I + Math.imul(Me, tr) | 0, q = q + Math.imul(Me, Tt) | 0, M = M + Math.imul(Ae, It) | 0, I = I + Math.imul(Ae, dt) | 0, I = I + Math.imul(Te, It) | 0, q = q + Math.imul(Te, dt) | 0, M = M + Math.imul(ae, Nt) | 0, I = I + Math.imul(ae, mt) | 0, I = I + Math.imul(fe, Nt) | 0, q = q + Math.imul(fe, mt) | 0, M = M + Math.imul(Z, Ft) | 0, I = I + Math.imul(Z, et) | 0, I = I + Math.imul(re, Ft) | 0, q = q + Math.imul(re, et) | 0, M = M + Math.imul(X, H) | 0, I = I + Math.imul(X, V) | 0, I = I + Math.imul(ee, H) | 0, q = q + Math.imul(ee, V) | 0, M = M + Math.imul(L, T) | 0, I = I + Math.imul(L, F) | 0, I = I + Math.imul(oe, T) | 0, q = q + Math.imul(oe, F) | 0; + var wt = (y + M | 0) + ((I & 8191) << 13) | 0; + y = (q + (I >>> 13) | 0) + (wt >>> 26) | 0, wt &= 67108863, M = Math.imul(ot, lt), I = Math.imul(ot, ct), I = I + Math.imul(ke, lt) | 0, q = Math.imul(ke, ct), M = M + Math.imul(Ue, Gt) | 0, I = I + Math.imul(Ue, Et) | 0, I = I + Math.imul(_e, Gt) | 0, q = q + Math.imul(_e, Et) | 0, M = M + Math.imul(ze, tr) | 0, I = I + Math.imul(ze, Tt) | 0, I = I + Math.imul(De, tr) | 0, q = q + Math.imul(De, Tt) | 0, M = M + Math.imul($e, It) | 0, I = I + Math.imul($e, dt) | 0, I = I + Math.imul(Me, It) | 0, q = q + Math.imul(Me, dt) | 0, M = M + Math.imul(Ae, Nt) | 0, I = I + Math.imul(Ae, mt) | 0, I = I + Math.imul(Te, Nt) | 0, q = q + Math.imul(Te, mt) | 0, M = M + Math.imul(ae, Ft) | 0, I = I + Math.imul(ae, et) | 0, I = I + Math.imul(fe, Ft) | 0, q = q + Math.imul(fe, et) | 0, M = M + Math.imul(Z, H) | 0, I = I + Math.imul(Z, V) | 0, I = I + Math.imul(re, H) | 0, q = q + Math.imul(re, V) | 0, M = M + Math.imul(X, T) | 0, I = I + Math.imul(X, F) | 0, I = I + Math.imul(ee, T) | 0, q = q + Math.imul(ee, F) | 0, M = M + Math.imul(L, le) | 0, I = I + Math.imul(L, me) | 0, I = I + Math.imul(oe, le) | 0, q = q + Math.imul(oe, me) | 0; + var Rt = (y + M | 0) + ((I & 8191) << 13) | 0; + y = (q + (I >>> 13) | 0) + (Rt >>> 26) | 0, Rt &= 67108863, M = Math.imul(nt, lt), I = Math.imul(nt, ct), I = I + Math.imul(Ge, lt) | 0, q = Math.imul(Ge, ct), M = M + Math.imul(ot, Gt) | 0, I = I + Math.imul(ot, Et) | 0, I = I + Math.imul(ke, Gt) | 0, q = q + Math.imul(ke, Et) | 0, M = M + Math.imul(Ue, tr) | 0, I = I + Math.imul(Ue, Tt) | 0, I = I + Math.imul(_e, tr) | 0, q = q + Math.imul(_e, Tt) | 0, M = M + Math.imul(ze, It) | 0, I = I + Math.imul(ze, dt) | 0, I = I + Math.imul(De, It) | 0, q = q + Math.imul(De, dt) | 0, M = M + Math.imul($e, Nt) | 0, I = I + Math.imul($e, mt) | 0, I = I + Math.imul(Me, Nt) | 0, q = q + Math.imul(Me, mt) | 0, M = M + Math.imul(Ae, Ft) | 0, I = I + Math.imul(Ae, et) | 0, I = I + Math.imul(Te, Ft) | 0, q = q + Math.imul(Te, et) | 0, M = M + Math.imul(ae, H) | 0, I = I + Math.imul(ae, V) | 0, I = I + Math.imul(fe, H) | 0, q = q + Math.imul(fe, V) | 0, M = M + Math.imul(Z, T) | 0, I = I + Math.imul(Z, F) | 0, I = I + Math.imul(re, T) | 0, q = q + Math.imul(re, F) | 0, M = M + Math.imul(X, le) | 0, I = I + Math.imul(X, me) | 0, I = I + Math.imul(ee, le) | 0, q = q + Math.imul(ee, me) | 0, M = M + Math.imul(L, Le) | 0, I = I + Math.imul(L, Ie) | 0, I = I + Math.imul(oe, Le) | 0, q = q + Math.imul(oe, Ie) | 0; + var gt = (y + M | 0) + ((I & 8191) << 13) | 0; + y = (q + (I >>> 13) | 0) + (gt >>> 26) | 0, gt &= 67108863, M = Math.imul(nt, Gt), I = Math.imul(nt, Et), I = I + Math.imul(Ge, Gt) | 0, q = Math.imul(Ge, Et), M = M + Math.imul(ot, tr) | 0, I = I + Math.imul(ot, Tt) | 0, I = I + Math.imul(ke, tr) | 0, q = q + Math.imul(ke, Tt) | 0, M = M + Math.imul(Ue, It) | 0, I = I + Math.imul(Ue, dt) | 0, I = I + Math.imul(_e, It) | 0, q = q + Math.imul(_e, dt) | 0, M = M + Math.imul(ze, Nt) | 0, I = I + Math.imul(ze, mt) | 0, I = I + Math.imul(De, Nt) | 0, q = q + Math.imul(De, mt) | 0, M = M + Math.imul($e, Ft) | 0, I = I + Math.imul($e, et) | 0, I = I + Math.imul(Me, Ft) | 0, q = q + Math.imul(Me, et) | 0, M = M + Math.imul(Ae, H) | 0, I = I + Math.imul(Ae, V) | 0, I = I + Math.imul(Te, H) | 0, q = q + Math.imul(Te, V) | 0, M = M + Math.imul(ae, T) | 0, I = I + Math.imul(ae, F) | 0, I = I + Math.imul(fe, T) | 0, q = q + Math.imul(fe, F) | 0, M = M + Math.imul(Z, le) | 0, I = I + Math.imul(Z, me) | 0, I = I + Math.imul(re, le) | 0, q = q + Math.imul(re, me) | 0, M = M + Math.imul(X, Le) | 0, I = I + Math.imul(X, Ie) | 0, I = I + Math.imul(ee, Le) | 0, q = q + Math.imul(ee, Ie) | 0; + var _t = (y + M | 0) + ((I & 8191) << 13) | 0; + y = (q + (I >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, M = Math.imul(nt, tr), I = Math.imul(nt, Tt), I = I + Math.imul(Ge, tr) | 0, q = Math.imul(Ge, Tt), M = M + Math.imul(ot, It) | 0, I = I + Math.imul(ot, dt) | 0, I = I + Math.imul(ke, It) | 0, q = q + Math.imul(ke, dt) | 0, M = M + Math.imul(Ue, Nt) | 0, I = I + Math.imul(Ue, mt) | 0, I = I + Math.imul(_e, Nt) | 0, q = q + Math.imul(_e, mt) | 0, M = M + Math.imul(ze, Ft) | 0, I = I + Math.imul(ze, et) | 0, I = I + Math.imul(De, Ft) | 0, q = q + Math.imul(De, et) | 0, M = M + Math.imul($e, H) | 0, I = I + Math.imul($e, V) | 0, I = I + Math.imul(Me, H) | 0, q = q + Math.imul(Me, V) | 0, M = M + Math.imul(Ae, T) | 0, I = I + Math.imul(Ae, F) | 0, I = I + Math.imul(Te, T) | 0, q = q + Math.imul(Te, F) | 0, M = M + Math.imul(ae, le) | 0, I = I + Math.imul(ae, me) | 0, I = I + Math.imul(fe, le) | 0, q = q + Math.imul(fe, me) | 0, M = M + Math.imul(Z, Le) | 0, I = I + Math.imul(Z, Ie) | 0, I = I + Math.imul(re, Le) | 0, q = q + Math.imul(re, Ie) | 0; + var at = (y + M | 0) + ((I & 8191) << 13) | 0; + y = (q + (I >>> 13) | 0) + (at >>> 26) | 0, at &= 67108863, M = Math.imul(nt, It), I = Math.imul(nt, dt), I = I + Math.imul(Ge, It) | 0, q = Math.imul(Ge, dt), M = M + Math.imul(ot, Nt) | 0, I = I + Math.imul(ot, mt) | 0, I = I + Math.imul(ke, Nt) | 0, q = q + Math.imul(ke, mt) | 0, M = M + Math.imul(Ue, Ft) | 0, I = I + Math.imul(Ue, et) | 0, I = I + Math.imul(_e, Ft) | 0, q = q + Math.imul(_e, et) | 0, M = M + Math.imul(ze, H) | 0, I = I + Math.imul(ze, V) | 0, I = I + Math.imul(De, H) | 0, q = q + Math.imul(De, V) | 0, M = M + Math.imul($e, T) | 0, I = I + Math.imul($e, F) | 0, I = I + Math.imul(Me, T) | 0, q = q + Math.imul(Me, F) | 0, M = M + Math.imul(Ae, le) | 0, I = I + Math.imul(Ae, me) | 0, I = I + Math.imul(Te, le) | 0, q = q + Math.imul(Te, me) | 0, M = M + Math.imul(ae, Le) | 0, I = I + Math.imul(ae, Ie) | 0, I = I + Math.imul(fe, Le) | 0, q = q + Math.imul(fe, Ie) | 0; + var yt = (y + M | 0) + ((I & 8191) << 13) | 0; + y = (q + (I >>> 13) | 0) + (yt >>> 26) | 0, yt &= 67108863, M = Math.imul(nt, Nt), I = Math.imul(nt, mt), I = I + Math.imul(Ge, Nt) | 0, q = Math.imul(Ge, mt), M = M + Math.imul(ot, Ft) | 0, I = I + Math.imul(ot, et) | 0, I = I + Math.imul(ke, Ft) | 0, q = q + Math.imul(ke, et) | 0, M = M + Math.imul(Ue, H) | 0, I = I + Math.imul(Ue, V) | 0, I = I + Math.imul(_e, H) | 0, q = q + Math.imul(_e, V) | 0, M = M + Math.imul(ze, T) | 0, I = I + Math.imul(ze, F) | 0, I = I + Math.imul(De, T) | 0, q = q + Math.imul(De, F) | 0, M = M + Math.imul($e, le) | 0, I = I + Math.imul($e, me) | 0, I = I + Math.imul(Me, le) | 0, q = q + Math.imul(Me, me) | 0, M = M + Math.imul(Ae, Le) | 0, I = I + Math.imul(Ae, Ie) | 0, I = I + Math.imul(Te, Le) | 0, q = q + Math.imul(Te, Ie) | 0; + var ut = (y + M | 0) + ((I & 8191) << 13) | 0; + y = (q + (I >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, M = Math.imul(nt, Ft), I = Math.imul(nt, et), I = I + Math.imul(Ge, Ft) | 0, q = Math.imul(Ge, et), M = M + Math.imul(ot, H) | 0, I = I + Math.imul(ot, V) | 0, I = I + Math.imul(ke, H) | 0, q = q + Math.imul(ke, V) | 0, M = M + Math.imul(Ue, T) | 0, I = I + Math.imul(Ue, F) | 0, I = I + Math.imul(_e, T) | 0, q = q + Math.imul(_e, F) | 0, M = M + Math.imul(ze, le) | 0, I = I + Math.imul(ze, me) | 0, I = I + Math.imul(De, le) | 0, q = q + Math.imul(De, me) | 0, M = M + Math.imul($e, Le) | 0, I = I + Math.imul($e, Ie) | 0, I = I + Math.imul(Me, Le) | 0, q = q + Math.imul(Me, Ie) | 0; + var it = (y + M | 0) + ((I & 8191) << 13) | 0; + y = (q + (I >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, M = Math.imul(nt, H), I = Math.imul(nt, V), I = I + Math.imul(Ge, H) | 0, q = Math.imul(Ge, V), M = M + Math.imul(ot, T) | 0, I = I + Math.imul(ot, F) | 0, I = I + Math.imul(ke, T) | 0, q = q + Math.imul(ke, F) | 0, M = M + Math.imul(Ue, le) | 0, I = I + Math.imul(Ue, me) | 0, I = I + Math.imul(_e, le) | 0, q = q + Math.imul(_e, me) | 0, M = M + Math.imul(ze, Le) | 0, I = I + Math.imul(ze, Ie) | 0, I = I + Math.imul(De, Le) | 0, q = q + Math.imul(De, Ie) | 0; + var Se = (y + M | 0) + ((I & 8191) << 13) | 0; + y = (q + (I >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, M = Math.imul(nt, T), I = Math.imul(nt, F), I = I + Math.imul(Ge, T) | 0, q = Math.imul(Ge, F), M = M + Math.imul(ot, le) | 0, I = I + Math.imul(ot, me) | 0, I = I + Math.imul(ke, le) | 0, q = q + Math.imul(ke, me) | 0, M = M + Math.imul(Ue, Le) | 0, I = I + Math.imul(Ue, Ie) | 0, I = I + Math.imul(_e, Le) | 0, q = q + Math.imul(_e, Ie) | 0; + var Pe = (y + M | 0) + ((I & 8191) << 13) | 0; + y = (q + (I >>> 13) | 0) + (Pe >>> 26) | 0, Pe &= 67108863, M = Math.imul(nt, le), I = Math.imul(nt, me), I = I + Math.imul(Ge, le) | 0, q = Math.imul(Ge, me), M = M + Math.imul(ot, Le) | 0, I = I + Math.imul(ot, Ie) | 0, I = I + Math.imul(ke, Le) | 0, q = q + Math.imul(ke, Ie) | 0; + var Ke = (y + M | 0) + ((I & 8191) << 13) | 0; + y = (q + (I >>> 13) | 0) + (Ke >>> 26) | 0, Ke &= 67108863, M = Math.imul(nt, Le), I = Math.imul(nt, Ie), I = I + Math.imul(Ge, Le) | 0, q = Math.imul(Ge, Ie); + var Fe = (y + M | 0) + ((I & 8191) << 13) | 0; + return y = (q + (I >>> 13) | 0) + (Fe >>> 26) | 0, Fe &= 67108863, _[0] = Qe, _[1] = Xe, _[2] = tt, _[3] = st, _[4] = vt, _[5] = Ct, _[6] = Mt, _[7] = wt, _[8] = Rt, _[9] = gt, _[10] = _t, _[11] = at, _[12] = yt, _[13] = ut, _[14] = it, _[15] = Se, _[16] = Pe, _[17] = Ke, _[18] = Fe, y !== 0 && (_[19] = y, m.length++), m; + }; + Math.imul || (N = $); + function z(b, l, p) { + p.negative = l.negative ^ b.negative, p.length = b.length + l.length; + for (var m = 0, w = 0, P = 0; P < p.length - 1; P++) { + var _ = w; + w = 0; + for (var y = m & 67108863, M = Math.min(P, l.length - 1), I = Math.max(0, P - b.length + 1); I <= M; I++) { + var q = P - I, ce = b.words[q] | 0, L = l.words[I] | 0, oe = ce * L, Q = oe & 67108863; + _ = _ + (oe / 67108864 | 0) | 0, Q = Q + y | 0, y = Q & 67108863, _ = _ + (Q >>> 26) | 0, w += _ >>> 26, _ &= 67108863; + } + p.words[P] = y, m = _, _ = w; + } + return m !== 0 ? p.words[P] = m : p.length--, p._strip(); + } + function k(b, l, p) { + return z(b, l, p); + } + s.prototype.mulTo = function(l, p) { + var m, w = this.length + l.length; + return this.length === 10 && l.length === 10 ? m = N(this, l, p) : w < 63 ? m = $(this, l, p) : w < 1024 ? m = z(this, l, p) : m = k(this, l, p), m; + }, s.prototype.mul = function(l) { + var p = new s(null); + return p.words = new Array(this.length + l.length), this.mulTo(l, p); + }, s.prototype.mulf = function(l) { + var p = new s(null); + return p.words = new Array(this.length + l.length), k(this, l, p); + }, s.prototype.imul = function(l) { + return this.clone().mulTo(l, this); + }, s.prototype.imuln = function(l) { + var p = l < 0; + p && (l = -l), n(typeof l == "number"), n(l < 67108864); + for (var m = 0, w = 0; w < this.length; w++) { + var P = (this.words[w] | 0) * l, _ = (P & 67108863) + (m & 67108863); + m >>= 26, m += P / 67108864 | 0, m += _ >>> 26, this.words[w] = _ & 67108863; + } + return m !== 0 && (this.words[w] = m, this.length++), p ? this.ineg() : this; + }, s.prototype.muln = function(l) { + return this.clone().imuln(l); + }, s.prototype.sqr = function() { + return this.mul(this); + }, s.prototype.isqr = function() { + return this.imul(this.clone()); + }, s.prototype.pow = function(l) { + var p = D(l); + if (p.length === 0) return new s(1); + for (var m = this, w = 0; w < p.length && p[w] === 0; w++, m = m.sqr()) + ; + if (++w < p.length) + for (var P = m.sqr(); w < p.length; w++, P = P.sqr()) + p[w] !== 0 && (m = m.mul(P)); + return m; + }, s.prototype.iushln = function(l) { + n(typeof l == "number" && l >= 0); + var p = l % 26, m = (l - p) / 26, w = 67108863 >>> 26 - p << 26 - p, P; + if (p !== 0) { + var _ = 0; + for (P = 0; P < this.length; P++) { + var y = this.words[P] & w, M = (this.words[P] | 0) - y << p; + this.words[P] = M | _, _ = y >>> 26 - p; + } + _ && (this.words[P] = _, this.length++); + } + if (m !== 0) { + for (P = this.length - 1; P >= 0; P--) + this.words[P + m] = this.words[P]; + for (P = 0; P < m; P++) + this.words[P] = 0; + this.length += m; + } + return this._strip(); + }, s.prototype.ishln = function(l) { + return n(this.negative === 0), this.iushln(l); + }, s.prototype.iushrn = function(l, p, m) { + n(typeof l == "number" && l >= 0); + var w; + p ? w = (p - p % 26) / 26 : w = 0; + var P = l % 26, _ = Math.min((l - P) / 26, this.length), y = 67108863 ^ 67108863 >>> P << P, M = m; + if (w -= _, w = Math.max(0, w), M) { + for (var I = 0; I < _; I++) + M.words[I] = this.words[I]; + M.length = _; + } + if (_ !== 0) if (this.length > _) + for (this.length -= _, I = 0; I < this.length; I++) + this.words[I] = this.words[I + _]; + else + this.words[0] = 0, this.length = 1; + var q = 0; + for (I = this.length - 1; I >= 0 && (q !== 0 || I >= w); I--) { + var ce = this.words[I] | 0; + this.words[I] = q << 26 - P | ce >>> P, q = ce & y; + } + return M && q !== 0 && (M.words[M.length++] = q), this.length === 0 && (this.words[0] = 0, this.length = 1), this._strip(); + }, s.prototype.ishrn = function(l, p, m) { + return n(this.negative === 0), this.iushrn(l, p, m); + }, s.prototype.shln = function(l) { + return this.clone().ishln(l); + }, s.prototype.ushln = function(l) { + return this.clone().iushln(l); + }, s.prototype.shrn = function(l) { + return this.clone().ishrn(l); + }, s.prototype.ushrn = function(l) { + return this.clone().iushrn(l); + }, s.prototype.testn = function(l) { + n(typeof l == "number" && l >= 0); + var p = l % 26, m = (l - p) / 26, w = 1 << p; + if (this.length <= m) return !1; + var P = this.words[m]; + return !!(P & w); + }, s.prototype.imaskn = function(l) { + n(typeof l == "number" && l >= 0); + var p = l % 26, m = (l - p) / 26; + if (n(this.negative === 0, "imaskn works only with positive numbers"), this.length <= m) + return this; + if (p !== 0 && m++, this.length = Math.min(m, this.length), p !== 0) { + var w = 67108863 ^ 67108863 >>> p << p; + this.words[this.length - 1] &= w; + } + return this._strip(); + }, s.prototype.maskn = function(l) { + return this.clone().imaskn(l); + }, s.prototype.iaddn = function(l) { + return n(typeof l == "number"), n(l < 67108864), l < 0 ? this.isubn(-l) : this.negative !== 0 ? this.length === 1 && (this.words[0] | 0) <= l ? (this.words[0] = l - (this.words[0] | 0), this.negative = 0, this) : (this.negative = 0, this.isubn(l), this.negative = 1, this) : this._iaddn(l); + }, s.prototype._iaddn = function(l) { + this.words[0] += l; + for (var p = 0; p < this.length && this.words[p] >= 67108864; p++) + this.words[p] -= 67108864, p === this.length - 1 ? this.words[p + 1] = 1 : this.words[p + 1]++; + return this.length = Math.max(this.length, p + 1), this; + }, s.prototype.isubn = function(l) { + if (n(typeof l == "number"), n(l < 67108864), l < 0) return this.iaddn(-l); + if (this.negative !== 0) + return this.negative = 0, this.iaddn(l), this.negative = 1, this; + if (this.words[0] -= l, this.length === 1 && this.words[0] < 0) + this.words[0] = -this.words[0], this.negative = 1; + else + for (var p = 0; p < this.length && this.words[p] < 0; p++) + this.words[p] += 67108864, this.words[p + 1] -= 1; + return this._strip(); + }, s.prototype.addn = function(l) { + return this.clone().iaddn(l); + }, s.prototype.subn = function(l) { + return this.clone().isubn(l); + }, s.prototype.iabs = function() { + return this.negative = 0, this; + }, s.prototype.abs = function() { + return this.clone().iabs(); + }, s.prototype._ishlnsubmul = function(l, p, m) { + var w = l.length + m, P; + this._expand(w); + var _, y = 0; + for (P = 0; P < l.length; P++) { + _ = (this.words[P + m] | 0) + y; + var M = (l.words[P] | 0) * p; + _ -= M & 67108863, y = (_ >> 26) - (M / 67108864 | 0), this.words[P + m] = _ & 67108863; + } + for (; P < this.length - m; P++) + _ = (this.words[P + m] | 0) + y, y = _ >> 26, this.words[P + m] = _ & 67108863; + if (y === 0) return this._strip(); + for (n(y === -1), y = 0, P = 0; P < this.length; P++) + _ = -(this.words[P] | 0) + y, y = _ >> 26, this.words[P] = _ & 67108863; + return this.negative = 1, this._strip(); + }, s.prototype._wordDiv = function(l, p) { + var m = this.length - l.length, w = this.clone(), P = l, _ = P.words[P.length - 1] | 0, y = this._countBits(_); + m = 26 - y, m !== 0 && (P = P.ushln(m), w.iushln(m), _ = P.words[P.length - 1] | 0); + var M = w.length - P.length, I; + if (p !== "mod") { + I = new s(null), I.length = M + 1, I.words = new Array(I.length); + for (var q = 0; q < I.length; q++) + I.words[q] = 0; + } + var ce = w.clone()._ishlnsubmul(P, 1, M); + ce.negative === 0 && (w = ce, I && (I.words[M] = 1)); + for (var L = M - 1; L >= 0; L--) { + var oe = (w.words[P.length + L] | 0) * 67108864 + (w.words[P.length + L - 1] | 0); + for (oe = Math.min(oe / _ | 0, 67108863), w._ishlnsubmul(P, oe, L); w.negative !== 0; ) + oe--, w.negative = 0, w._ishlnsubmul(P, 1, L), w.isZero() || (w.negative ^= 1); + I && (I.words[L] = oe); + } + return I && I._strip(), w._strip(), p !== "div" && m !== 0 && w.iushrn(m), { + div: I || null, + mod: w + }; + }, s.prototype.divmod = function(l, p, m) { + if (n(!l.isZero()), this.isZero()) + return { + div: new s(0), + mod: new s(0) + }; + var w, P, _; + return this.negative !== 0 && l.negative === 0 ? (_ = this.neg().divmod(l, p), p !== "mod" && (w = _.div.neg()), p !== "div" && (P = _.mod.neg(), m && P.negative !== 0 && P.iadd(l)), { + div: w, + mod: P + }) : this.negative === 0 && l.negative !== 0 ? (_ = this.divmod(l.neg(), p), p !== "mod" && (w = _.div.neg()), { + div: w, + mod: _.mod + }) : (this.negative & l.negative) !== 0 ? (_ = this.neg().divmod(l.neg(), p), p !== "div" && (P = _.mod.neg(), m && P.negative !== 0 && P.isub(l)), { + div: _.div, + mod: P + }) : l.length > this.length || this.cmp(l) < 0 ? { + div: new s(0), + mod: this + } : l.length === 1 ? p === "div" ? { + div: this.divn(l.words[0]), + mod: null + } : p === "mod" ? { + div: null, + mod: new s(this.modrn(l.words[0])) + } : { + div: this.divn(l.words[0]), + mod: new s(this.modrn(l.words[0])) + } : this._wordDiv(l, p); + }, s.prototype.div = function(l) { + return this.divmod(l, "div", !1).div; + }, s.prototype.mod = function(l) { + return this.divmod(l, "mod", !1).mod; + }, s.prototype.umod = function(l) { + return this.divmod(l, "mod", !0).mod; + }, s.prototype.divRound = function(l) { + var p = this.divmod(l); + if (p.mod.isZero()) return p.div; + var m = p.div.negative !== 0 ? p.mod.isub(l) : p.mod, w = l.ushrn(1), P = l.andln(1), _ = m.cmp(w); + return _ < 0 || P === 1 && _ === 0 ? p.div : p.div.negative !== 0 ? p.div.isubn(1) : p.div.iaddn(1); + }, s.prototype.modrn = function(l) { + var p = l < 0; + p && (l = -l), n(l <= 67108863); + for (var m = (1 << 26) % l, w = 0, P = this.length - 1; P >= 0; P--) + w = (m * w + (this.words[P] | 0)) % l; + return p ? -w : w; + }, s.prototype.modn = function(l) { + return this.modrn(l); + }, s.prototype.idivn = function(l) { + var p = l < 0; + p && (l = -l), n(l <= 67108863); + for (var m = 0, w = this.length - 1; w >= 0; w--) { + var P = (this.words[w] | 0) + m * 67108864; + this.words[w] = P / l | 0, m = P % l; + } + return this._strip(), p ? this.ineg() : this; + }, s.prototype.divn = function(l) { + return this.clone().idivn(l); + }, s.prototype.egcd = function(l) { + n(l.negative === 0), n(!l.isZero()); + var p = this, m = l.clone(); + p.negative !== 0 ? p = p.umod(l) : p = p.clone(); + for (var w = new s(1), P = new s(0), _ = new s(0), y = new s(1), M = 0; p.isEven() && m.isEven(); ) + p.iushrn(1), m.iushrn(1), ++M; + for (var I = m.clone(), q = p.clone(); !p.isZero(); ) { + for (var ce = 0, L = 1; (p.words[0] & L) === 0 && ce < 26; ++ce, L <<= 1) ; + if (ce > 0) + for (p.iushrn(ce); ce-- > 0; ) + (w.isOdd() || P.isOdd()) && (w.iadd(I), P.isub(q)), w.iushrn(1), P.iushrn(1); + for (var oe = 0, Q = 1; (m.words[0] & Q) === 0 && oe < 26; ++oe, Q <<= 1) ; + if (oe > 0) + for (m.iushrn(oe); oe-- > 0; ) + (_.isOdd() || y.isOdd()) && (_.iadd(I), y.isub(q)), _.iushrn(1), y.iushrn(1); + p.cmp(m) >= 0 ? (p.isub(m), w.isub(_), P.isub(y)) : (m.isub(p), _.isub(w), y.isub(P)); + } + return { + a: _, + b: y, + gcd: m.iushln(M) + }; + }, s.prototype._invmp = function(l) { + n(l.negative === 0), n(!l.isZero()); + var p = this, m = l.clone(); + p.negative !== 0 ? p = p.umod(l) : p = p.clone(); + for (var w = new s(1), P = new s(0), _ = m.clone(); p.cmpn(1) > 0 && m.cmpn(1) > 0; ) { + for (var y = 0, M = 1; (p.words[0] & M) === 0 && y < 26; ++y, M <<= 1) ; + if (y > 0) + for (p.iushrn(y); y-- > 0; ) + w.isOdd() && w.iadd(_), w.iushrn(1); + for (var I = 0, q = 1; (m.words[0] & q) === 0 && I < 26; ++I, q <<= 1) ; + if (I > 0) + for (m.iushrn(I); I-- > 0; ) + P.isOdd() && P.iadd(_), P.iushrn(1); + p.cmp(m) >= 0 ? (p.isub(m), w.isub(P)) : (m.isub(p), P.isub(w)); + } + var ce; + return p.cmpn(1) === 0 ? ce = w : ce = P, ce.cmpn(0) < 0 && ce.iadd(l), ce; + }, s.prototype.gcd = function(l) { + if (this.isZero()) return l.abs(); + if (l.isZero()) return this.abs(); + var p = this.clone(), m = l.clone(); + p.negative = 0, m.negative = 0; + for (var w = 0; p.isEven() && m.isEven(); w++) + p.iushrn(1), m.iushrn(1); + do { + for (; p.isEven(); ) + p.iushrn(1); + for (; m.isEven(); ) + m.iushrn(1); + var P = p.cmp(m); + if (P < 0) { + var _ = p; + p = m, m = _; + } else if (P === 0 || m.cmpn(1) === 0) + break; + p.isub(m); + } while (!0); + return m.iushln(w); + }, s.prototype.invm = function(l) { + return this.egcd(l).a.umod(l); + }, s.prototype.isEven = function() { + return (this.words[0] & 1) === 0; + }, s.prototype.isOdd = function() { + return (this.words[0] & 1) === 1; + }, s.prototype.andln = function(l) { + return this.words[0] & l; + }, s.prototype.bincn = function(l) { + n(typeof l == "number"); + var p = l % 26, m = (l - p) / 26, w = 1 << p; + if (this.length <= m) + return this._expand(m + 1), this.words[m] |= w, this; + for (var P = w, _ = m; P !== 0 && _ < this.length; _++) { + var y = this.words[_] | 0; + y += P, P = y >>> 26, y &= 67108863, this.words[_] = y; + } + return P !== 0 && (this.words[_] = P, this.length++), this; + }, s.prototype.isZero = function() { + return this.length === 1 && this.words[0] === 0; + }, s.prototype.cmpn = function(l) { + var p = l < 0; + if (this.negative !== 0 && !p) return -1; + if (this.negative === 0 && p) return 1; + this._strip(); + var m; + if (this.length > 1) + m = 1; + else { + p && (l = -l), n(l <= 67108863, "Number is too big"); + var w = this.words[0] | 0; + m = w === l ? 0 : w < l ? -1 : 1; + } + return this.negative !== 0 ? -m | 0 : m; + }, s.prototype.cmp = function(l) { + if (this.negative !== 0 && l.negative === 0) return -1; + if (this.negative === 0 && l.negative !== 0) return 1; + var p = this.ucmp(l); + return this.negative !== 0 ? -p | 0 : p; + }, s.prototype.ucmp = function(l) { + if (this.length > l.length) return 1; + if (this.length < l.length) return -1; + for (var p = 0, m = this.length - 1; m >= 0; m--) { + var w = this.words[m] | 0, P = l.words[m] | 0; + if (w !== P) { + w < P ? p = -1 : w > P && (p = 1); + break; + } + } + return p; + }, s.prototype.gtn = function(l) { + return this.cmpn(l) === 1; + }, s.prototype.gt = function(l) { + return this.cmp(l) === 1; + }, s.prototype.gten = function(l) { + return this.cmpn(l) >= 0; + }, s.prototype.gte = function(l) { + return this.cmp(l) >= 0; + }, s.prototype.ltn = function(l) { + return this.cmpn(l) === -1; + }, s.prototype.lt = function(l) { + return this.cmp(l) === -1; + }, s.prototype.lten = function(l) { + return this.cmpn(l) <= 0; + }, s.prototype.lte = function(l) { + return this.cmp(l) <= 0; + }, s.prototype.eqn = function(l) { + return this.cmpn(l) === 0; + }, s.prototype.eq = function(l) { + return this.cmp(l) === 0; + }, s.red = function(l) { + return new K(l); + }, s.prototype.toRed = function(l) { + return n(!this.red, "Already a number in reduction context"), n(this.negative === 0, "red works only with positives"), l.convertTo(this)._forceRed(l); + }, s.prototype.fromRed = function() { + return n(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom(this); + }, s.prototype._forceRed = function(l) { + return this.red = l, this; + }, s.prototype.forceRed = function(l) { + return n(!this.red, "Already a number in reduction context"), this._forceRed(l); + }, s.prototype.redAdd = function(l) { + return n(this.red, "redAdd works only with red numbers"), this.red.add(this, l); + }, s.prototype.redIAdd = function(l) { + return n(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, l); + }, s.prototype.redSub = function(l) { + return n(this.red, "redSub works only with red numbers"), this.red.sub(this, l); + }, s.prototype.redISub = function(l) { + return n(this.red, "redISub works only with red numbers"), this.red.isub(this, l); + }, s.prototype.redShl = function(l) { + return n(this.red, "redShl works only with red numbers"), this.red.shl(this, l); + }, s.prototype.redMul = function(l) { + return n(this.red, "redMul works only with red numbers"), this.red._verify2(this, l), this.red.mul(this, l); + }, s.prototype.redIMul = function(l) { + return n(this.red, "redMul works only with red numbers"), this.red._verify2(this, l), this.red.imul(this, l); + }, s.prototype.redSqr = function() { + return n(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr(this); + }, s.prototype.redISqr = function() { + return n(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr(this); + }, s.prototype.redSqrt = function() { + return n(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt(this); + }, s.prototype.redInvm = function() { + return n(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm(this); + }, s.prototype.redNeg = function() { + return n(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg(this); + }, s.prototype.redPow = function(l) { + return n(this.red && !l.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, l); + }; + var B = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + function U(b, l) { + this.name = b, this.p = new s(l, 16), this.n = this.p.bitLength(), this.k = new s(1).iushln(this.n).isub(this.p), this.tmp = this._tmp(); + } + U.prototype._tmp = function() { + var l = new s(null); + return l.words = new Array(Math.ceil(this.n / 13)), l; + }, U.prototype.ireduce = function(l) { + var p = l, m; + do + this.split(p, this.tmp), p = this.imulK(p), p = p.iadd(this.tmp), m = p.bitLength(); + while (m > this.n); + var w = m < this.n ? -1 : p.ucmp(this.p); + return w === 0 ? (p.words[0] = 0, p.length = 1) : w > 0 ? p.isub(this.p) : p.strip !== void 0 ? p.strip() : p._strip(), p; + }, U.prototype.split = function(l, p) { + l.iushrn(this.n, 0, p); + }, U.prototype.imulK = function(l) { + return l.imul(this.k); + }; + function R() { + U.call( + this, + "k256", + "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f" + ); + } + i(R, U), R.prototype.split = function(l, p) { + for (var m = 4194303, w = Math.min(l.length, 9), P = 0; P < w; P++) + p.words[P] = l.words[P]; + if (p.length = w, l.length <= 9) { + l.words[0] = 0, l.length = 1; + return; + } + var _ = l.words[9]; + for (p.words[p.length++] = _ & m, P = 10; P < l.length; P++) { + var y = l.words[P] | 0; + l.words[P - 10] = (y & m) << 4 | _ >>> 22, _ = y; + } + _ >>>= 22, l.words[P - 10] = _, _ === 0 && l.length > 10 ? l.length -= 10 : l.length -= 9; + }, R.prototype.imulK = function(l) { + l.words[l.length] = 0, l.words[l.length + 1] = 0, l.length += 2; + for (var p = 0, m = 0; m < l.length; m++) { + var w = l.words[m] | 0; + p += w * 977, l.words[m] = p & 67108863, p = w * 64 + (p / 67108864 | 0); + } + return l.words[l.length - 1] === 0 && (l.length--, l.words[l.length - 1] === 0 && l.length--), l; + }; + function W() { + U.call( + this, + "p224", + "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001" + ); + } + i(W, U); + function J() { + U.call( + this, + "p192", + "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff" + ); + } + i(J, U); + function ne() { + U.call( + this, + "25519", + "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed" + ); + } + i(ne, U), ne.prototype.imulK = function(l) { + for (var p = 0, m = 0; m < l.length; m++) { + var w = (l.words[m] | 0) * 19 + p, P = w & 67108863; + w >>>= 26, l.words[m] = P, p = w; + } + return p !== 0 && (l.words[l.length++] = p), l; + }, s._prime = function(l) { + if (B[l]) return B[l]; + var p; + if (l === "k256") + p = new R(); + else if (l === "p224") + p = new W(); + else if (l === "p192") + p = new J(); + else if (l === "p25519") + p = new ne(); + else + throw new Error("Unknown prime " + l); + return B[l] = p, p; + }; + function K(b) { + if (typeof b == "string") { + var l = s._prime(b); + this.m = l.p, this.prime = l; + } else + n(b.gtn(1), "modulus must be greater than 1"), this.m = b, this.prime = null; + } + K.prototype._verify1 = function(l) { + n(l.negative === 0, "red works only with positives"), n(l.red, "red works only with red numbers"); + }, K.prototype._verify2 = function(l, p) { + n((l.negative | p.negative) === 0, "red works only with positives"), n( + l.red && l.red === p.red, + "red works only with red numbers" + ); + }, K.prototype.imod = function(l) { + return this.prime ? this.prime.ireduce(l)._forceRed(this) : (h(l, l.umod(this.m)._forceRed(this)), l); + }, K.prototype.neg = function(l) { + return l.isZero() ? l.clone() : this.m.sub(l)._forceRed(this); + }, K.prototype.add = function(l, p) { + this._verify2(l, p); + var m = l.add(p); + return m.cmp(this.m) >= 0 && m.isub(this.m), m._forceRed(this); + }, K.prototype.iadd = function(l, p) { + this._verify2(l, p); + var m = l.iadd(p); + return m.cmp(this.m) >= 0 && m.isub(this.m), m; + }, K.prototype.sub = function(l, p) { + this._verify2(l, p); + var m = l.sub(p); + return m.cmpn(0) < 0 && m.iadd(this.m), m._forceRed(this); + }, K.prototype.isub = function(l, p) { + this._verify2(l, p); + var m = l.isub(p); + return m.cmpn(0) < 0 && m.iadd(this.m), m; + }, K.prototype.shl = function(l, p) { + return this._verify1(l), this.imod(l.ushln(p)); + }, K.prototype.imul = function(l, p) { + return this._verify2(l, p), this.imod(l.imul(p)); + }, K.prototype.mul = function(l, p) { + return this._verify2(l, p), this.imod(l.mul(p)); + }, K.prototype.isqr = function(l) { + return this.imul(l, l.clone()); + }, K.prototype.sqr = function(l) { + return this.mul(l, l); + }, K.prototype.sqrt = function(l) { + if (l.isZero()) return l.clone(); + var p = this.m.andln(3); + if (n(p % 2 === 1), p === 3) { + var m = this.m.add(new s(1)).iushrn(2); + return this.pow(l, m); + } + for (var w = this.m.subn(1), P = 0; !w.isZero() && w.andln(1) === 0; ) + P++, w.iushrn(1); + n(!w.isZero()); + var _ = new s(1).toRed(this), y = _.redNeg(), M = this.m.subn(1).iushrn(1), I = this.m.bitLength(); + for (I = new s(2 * I * I).toRed(this); this.pow(I, M).cmp(y) !== 0; ) + I.redIAdd(y); + for (var q = this.pow(I, w), ce = this.pow(l, w.addn(1).iushrn(1)), L = this.pow(l, w), oe = P; L.cmp(_) !== 0; ) { + for (var Q = L, X = 0; Q.cmp(_) !== 0; X++) + Q = Q.redSqr(); + n(X < oe); + var ee = this.pow(q, new s(1).iushln(oe - X - 1)); + ce = ce.redMul(ee), q = ee.redSqr(), L = L.redMul(q), oe = X; + } + return ce; + }, K.prototype.invm = function(l) { + var p = l._invmp(this.m); + return p.negative !== 0 ? (p.negative = 0, this.imod(p).redNeg()) : this.imod(p); + }, K.prototype.pow = function(l, p) { + if (p.isZero()) return new s(1).toRed(this); + if (p.cmpn(1) === 0) return l.clone(); + var m = 4, w = new Array(1 << m); + w[0] = new s(1).toRed(this), w[1] = l; + for (var P = 2; P < w.length; P++) + w[P] = this.mul(w[P - 1], l); + var _ = w[0], y = 0, M = 0, I = p.bitLength() % 26; + for (I === 0 && (I = 26), P = p.length - 1; P >= 0; P--) { + for (var q = p.words[P], ce = I - 1; ce >= 0; ce--) { + var L = q >> ce & 1; + if (_ !== w[0] && (_ = this.sqr(_)), L === 0 && y === 0) { + M = 0; + continue; + } + y <<= 1, y |= L, M++, !(M !== m && (P !== 0 || ce !== 0)) && (_ = this.mul(_, w[y]), M = 0, y = 0); + } + I = 26; + } + return _; + }, K.prototype.convertTo = function(l) { + var p = l.umod(this.m); + return p === l ? p.clone() : p; + }, K.prototype.convertFrom = function(l) { + var p = l.clone(); + return p.red = null, p; + }, s.mont = function(l) { + return new E(l); + }; + function E(b) { + K.call(this, b), this.shift = this.m.bitLength(), this.shift % 26 !== 0 && (this.shift += 26 - this.shift % 26), this.r = new s(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this.rinv = this.r._invmp(this.m), this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv = this.minv.umod(this.r), this.minv = this.r.sub(this.minv); + } + i(E, K), E.prototype.convertTo = function(l) { + return this.imod(l.ushln(this.shift)); + }, E.prototype.convertFrom = function(l) { + var p = this.imod(l.mul(this.rinv)); + return p.red = null, p; + }, E.prototype.imul = function(l, p) { + if (l.isZero() || p.isZero()) + return l.words[0] = 0, l.length = 1, l; + var m = l.imul(p), w = m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), P = m.isub(w).iushrn(this.shift), _ = P; + return P.cmp(this.m) >= 0 ? _ = P.isub(this.m) : P.cmpn(0) < 0 && (_ = P.iadd(this.m)), _._forceRed(this); + }, E.prototype.mul = function(l, p) { + if (l.isZero() || p.isZero()) return new s(0)._forceRed(this); + var m = l.mul(p), w = m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), P = m.isub(w).iushrn(this.shift), _ = P; + return P.cmp(this.m) >= 0 ? _ = P.isub(this.m) : P.cmpn(0) < 0 && (_ = P.iadd(this.m)), _._forceRed(this); + }, E.prototype.invm = function(l) { + var p = this.imod(l._invmp(this.m).mul(this.r2)); + return p._forceRed(this); + }; + })(t, gB); + })(Fh)), Fh.exports; +} +var vB = mB(); +const or = /* @__PURE__ */ Hi(vB); +var bB = or.BN; +function yB(t) { + return new bB(t, 36).toString(16); +} +const wB = "strings/5.7.0", xB = new Yr(wB); +var bd; +(function(t) { + t.current = "", t.NFC = "NFC", t.NFD = "NFD", t.NFKC = "NFKC", t.NFKD = "NFKD"; +})(bd || (bd = {})); +var ex; +(function(t) { + t.UNEXPECTED_CONTINUE = "unexpected continuation byte", t.BAD_PREFIX = "bad codepoint prefix", t.OVERRUN = "string overrun", t.MISSING_CONTINUE = "missing continuation byte", t.OUT_OF_RANGE = "out of UTF-8 range", t.UTF16_SURROGATE = "UTF-16 surrogate", t.OVERLONG = "overlong representation"; +})(ex || (ex = {})); +function hg(t, e = bd.current) { + e != bd.current && (xB.checkNormalize(), t = t.normalize(e)); + let r = []; + for (let n = 0; n < t.length; n++) { + const i = t.charCodeAt(n); + if (i < 128) + r.push(i); + else if (i < 2048) + r.push(i >> 6 | 192), r.push(i & 63 | 128); + else if ((i & 64512) == 55296) { + n++; + const s = t.charCodeAt(n); + if (n >= t.length || (s & 64512) !== 56320) + throw new Error("invalid utf-8 string"); + const o = 65536 + ((i & 1023) << 10) + (s & 1023); + r.push(o >> 18 | 240), r.push(o >> 12 & 63 | 128), r.push(o >> 6 & 63 | 128), r.push(o & 63 | 128); + } else + r.push(i >> 12 | 224), r.push(i >> 6 & 63 | 128), r.push(i & 63 | 128); + } + return bn(r); +} +const _B = `Ethereum Signed Message: +`; +function f8(t) { + return typeof t == "string" && (t = hg(t)), g1(hB([ + hg(_B), + hg(String(t.length)), + t + ])); +} +const EB = "address/5.7.0", Ku = new Yr(EB); +function tx(t) { + Is(t, 20) || Ku.throwArgumentError("invalid address", "address", t), t = t.toLowerCase(); + const e = t.substring(2).split(""), r = new Uint8Array(40); + for (let i = 0; i < 40; i++) + r[i] = e[i].charCodeAt(0); + const n = bn(g1(r)); + for (let i = 0; i < 40; i += 2) + n[i >> 1] >> 4 >= 8 && (e[i] = e[i].toUpperCase()), (n[i >> 1] & 15) >= 8 && (e[i + 1] = e[i + 1].toUpperCase()); + return "0x" + e.join(""); +} +const SB = 9007199254740991; +function AB(t) { + return Math.log10 ? Math.log10(t) : Math.log(t) / Math.LN10; +} +const m1 = {}; +for (let t = 0; t < 10; t++) + m1[String(t)] = String(t); +for (let t = 0; t < 26; t++) + m1[String.fromCharCode(65 + t)] = String(10 + t); +const rx = Math.floor(AB(SB)); +function PB(t) { + t = t.toUpperCase(), t = t.substring(4) + t.substring(0, 2) + "00"; + let e = t.split("").map((n) => m1[n]).join(""); + for (; e.length >= rx; ) { + let n = e.substring(0, rx); + e = parseInt(n, 10) % 97 + e.substring(n.length); + } + let r = String(98 - parseInt(e, 10) % 97); + for (; r.length < 2; ) + r = "0" + r; + return r; +} +function MB(t) { + let e = null; + if (typeof t != "string" && Ku.throwArgumentError("invalid address", "address", t), t.match(/^(0x)?[0-9a-fA-F]{40}$/)) + t.substring(0, 2) !== "0x" && (t = "0x" + t), e = tx(t), t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && e !== t && Ku.throwArgumentError("bad address checksum", "address", t); + else if (t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { + for (t.substring(2, 4) !== PB(t) && Ku.throwArgumentError("bad icap checksum", "address", t), e = yB(t.substring(4)); e.length < 40; ) + e = "0" + e; + e = tx("0x" + e); + } else + Ku.throwArgumentError("invalid address", "address", t); + return e; +} +function Tu(t, e, r) { + Object.defineProperty(t, e, { + enumerable: !0, + value: r, + writable: !1 + }); +} +var dg = {}, Or = {}, pg, nx; +function Wa() { + if (nx) return pg; + nx = 1, pg = t; + function t(e, r) { + if (!e) + throw new Error(r || "Assertion failed"); + } + return t.equal = function(r, n, i) { + if (r != n) + throw new Error(i || "Assertion failed: " + r + " != " + n); + }, pg; +} +var yh = { exports: {} }, ix; +function Jd() { + return ix || (ix = 1, typeof Object.create == "function" ? yh.exports = function(e, r) { + r && (e.super_ = r, e.prototype = Object.create(r.prototype, { + constructor: { + value: e, + enumerable: !1, + writable: !0, + configurable: !0 + } + })); + } : yh.exports = function(e, r) { + if (r) { + e.super_ = r; + var n = function() { + }; + n.prototype = r.prototype, e.prototype = new n(), e.prototype.constructor = e; + } + }), yh.exports; +} +var sx; +function Ls() { + if (sx) return Or; + sx = 1; + var t = Wa(), e = Jd(); + Or.inherits = e; + function r(E, b) { + return (E.charCodeAt(b) & 64512) !== 55296 || b < 0 || b + 1 >= E.length ? !1 : (E.charCodeAt(b + 1) & 64512) === 56320; + } + function n(E, b) { + if (Array.isArray(E)) + return E.slice(); + if (!E) + return []; + var l = []; + if (typeof E == "string") + if (b) { + if (b === "hex") + for (E = E.replace(/[^a-z0-9]+/ig, ""), E.length % 2 !== 0 && (E = "0" + E), m = 0; m < E.length; m += 2) + l.push(parseInt(E[m] + E[m + 1], 16)); + } else for (var p = 0, m = 0; m < E.length; m++) { + var w = E.charCodeAt(m); + w < 128 ? l[p++] = w : w < 2048 ? (l[p++] = w >> 6 | 192, l[p++] = w & 63 | 128) : r(E, m) ? (w = 65536 + ((w & 1023) << 10) + (E.charCodeAt(++m) & 1023), l[p++] = w >> 18 | 240, l[p++] = w >> 12 & 63 | 128, l[p++] = w >> 6 & 63 | 128, l[p++] = w & 63 | 128) : (l[p++] = w >> 12 | 224, l[p++] = w >> 6 & 63 | 128, l[p++] = w & 63 | 128); + } + else + for (m = 0; m < E.length; m++) + l[m] = E[m] | 0; + return l; + } + Or.toArray = n; + function i(E) { + for (var b = "", l = 0; l < E.length; l++) + b += a(E[l].toString(16)); + return b; + } + Or.toHex = i; + function s(E) { + var b = E >>> 24 | E >>> 8 & 65280 | E << 8 & 16711680 | (E & 255) << 24; + return b >>> 0; + } + Or.htonl = s; + function o(E, b) { + for (var l = "", p = 0; p < E.length; p++) { + var m = E[p]; + b === "little" && (m = s(m)), l += f(m.toString(16)); + } + return l; + } + Or.toHex32 = o; + function a(E) { + return E.length === 1 ? "0" + E : E; + } + Or.zero2 = a; + function f(E) { + return E.length === 7 ? "0" + E : E.length === 6 ? "00" + E : E.length === 5 ? "000" + E : E.length === 4 ? "0000" + E : E.length === 3 ? "00000" + E : E.length === 2 ? "000000" + E : E.length === 1 ? "0000000" + E : E; + } + Or.zero8 = f; + function u(E, b, l, p) { + var m = l - b; + t(m % 4 === 0); + for (var w = new Array(m / 4), P = 0, _ = b; P < w.length; P++, _ += 4) { + var y; + p === "big" ? y = E[_] << 24 | E[_ + 1] << 16 | E[_ + 2] << 8 | E[_ + 3] : y = E[_ + 3] << 24 | E[_ + 2] << 16 | E[_ + 1] << 8 | E[_], w[P] = y >>> 0; + } + return w; + } + Or.join32 = u; + function h(E, b) { + for (var l = new Array(E.length * 4), p = 0, m = 0; p < E.length; p++, m += 4) { + var w = E[p]; + b === "big" ? (l[m] = w >>> 24, l[m + 1] = w >>> 16 & 255, l[m + 2] = w >>> 8 & 255, l[m + 3] = w & 255) : (l[m + 3] = w >>> 24, l[m + 2] = w >>> 16 & 255, l[m + 1] = w >>> 8 & 255, l[m] = w & 255); + } + return l; + } + Or.split32 = h; + function g(E, b) { + return E >>> b | E << 32 - b; + } + Or.rotr32 = g; + function v(E, b) { + return E << b | E >>> 32 - b; + } + Or.rotl32 = v; + function x(E, b) { + return E + b >>> 0; + } + Or.sum32 = x; + function S(E, b, l) { + return E + b + l >>> 0; + } + Or.sum32_3 = S; + function C(E, b, l, p) { + return E + b + l + p >>> 0; + } + Or.sum32_4 = C; + function D(E, b, l, p, m) { + return E + b + l + p + m >>> 0; + } + Or.sum32_5 = D; + function $(E, b, l, p) { + var m = E[b], w = E[b + 1], P = p + w >>> 0, _ = (P < p ? 1 : 0) + l + m; + E[b] = _ >>> 0, E[b + 1] = P; + } + Or.sum64 = $; + function N(E, b, l, p) { + var m = b + p >>> 0, w = (m < b ? 1 : 0) + E + l; + return w >>> 0; + } + Or.sum64_hi = N; + function z(E, b, l, p) { + var m = b + p; + return m >>> 0; + } + Or.sum64_lo = z; + function k(E, b, l, p, m, w, P, _) { + var y = 0, M = b; + M = M + p >>> 0, y += M < b ? 1 : 0, M = M + w >>> 0, y += M < w ? 1 : 0, M = M + _ >>> 0, y += M < _ ? 1 : 0; + var I = E + l + m + P + y; + return I >>> 0; + } + Or.sum64_4_hi = k; + function B(E, b, l, p, m, w, P, _) { + var y = b + p + w + _; + return y >>> 0; + } + Or.sum64_4_lo = B; + function U(E, b, l, p, m, w, P, _, y, M) { + var I = 0, q = b; + q = q + p >>> 0, I += q < b ? 1 : 0, q = q + w >>> 0, I += q < w ? 1 : 0, q = q + _ >>> 0, I += q < _ ? 1 : 0, q = q + M >>> 0, I += q < M ? 1 : 0; + var ce = E + l + m + P + y + I; + return ce >>> 0; + } + Or.sum64_5_hi = U; + function R(E, b, l, p, m, w, P, _, y, M) { + var I = b + p + w + _ + M; + return I >>> 0; + } + Or.sum64_5_lo = R; + function W(E, b, l) { + var p = b << 32 - l | E >>> l; + return p >>> 0; + } + Or.rotr64_hi = W; + function J(E, b, l) { + var p = E << 32 - l | b >>> l; + return p >>> 0; + } + Or.rotr64_lo = J; + function ne(E, b, l) { + return E >>> l; + } + Or.shr64_hi = ne; + function K(E, b, l) { + var p = E << 32 - l | b >>> l; + return p >>> 0; + } + return Or.shr64_lo = K, Or; +} +var gg = {}, ox; +function nl() { + if (ox) return gg; + ox = 1; + var t = Ls(), e = Wa(); + function r() { + this.pending = null, this.pendingTotal = 0, this.blockSize = this.constructor.blockSize, this.outSize = this.constructor.outSize, this.hmacStrength = this.constructor.hmacStrength, this.padLength = this.constructor.padLength / 8, this.endian = "big", this._delta8 = this.blockSize / 8, this._delta32 = this.blockSize / 32; + } + return gg.BlockHash = r, r.prototype.update = function(i, s) { + if (i = t.toArray(i, s), this.pending ? this.pending = this.pending.concat(i) : this.pending = i, this.pendingTotal += i.length, this.pending.length >= this._delta8) { + i = this.pending; + var o = i.length % this._delta8; + this.pending = i.slice(i.length - o, i.length), this.pending.length === 0 && (this.pending = null), i = t.join32(i, 0, i.length - o, this.endian); + for (var a = 0; a < i.length; a += this._delta32) + this._update(i, a, a + this._delta32); + } + return this; + }, r.prototype.digest = function(i) { + return this.update(this._pad()), e(this.pending === null), this._digest(i); + }, r.prototype._pad = function() { + var i = this.pendingTotal, s = this._delta8, o = s - (i + this.padLength) % s, a = new Array(o + this.padLength); + a[0] = 128; + for (var f = 1; f < o; f++) + a[f] = 0; + if (i <<= 3, this.endian === "big") { + for (var u = 8; u < this.padLength; u++) + a[f++] = 0; + a[f++] = 0, a[f++] = 0, a[f++] = 0, a[f++] = 0, a[f++] = i >>> 24 & 255, a[f++] = i >>> 16 & 255, a[f++] = i >>> 8 & 255, a[f++] = i & 255; + } else + for (a[f++] = i & 255, a[f++] = i >>> 8 & 255, a[f++] = i >>> 16 & 255, a[f++] = i >>> 24 & 255, a[f++] = 0, a[f++] = 0, a[f++] = 0, a[f++] = 0, u = 8; u < this.padLength; u++) + a[f++] = 0; + return a; + }, gg; +} +var da = {}, xs = {}, ax; +function l8() { + if (ax) return xs; + ax = 1; + var t = Ls(), e = t.rotr32; + function r(h, g, v, x) { + if (h === 0) + return n(g, v, x); + if (h === 1 || h === 3) + return s(g, v, x); + if (h === 2) + return i(g, v, x); + } + xs.ft_1 = r; + function n(h, g, v) { + return h & g ^ ~h & v; + } + xs.ch32 = n; + function i(h, g, v) { + return h & g ^ h & v ^ g & v; + } + xs.maj32 = i; + function s(h, g, v) { + return h ^ g ^ v; + } + xs.p32 = s; + function o(h) { + return e(h, 2) ^ e(h, 13) ^ e(h, 22); + } + xs.s0_256 = o; + function a(h) { + return e(h, 6) ^ e(h, 11) ^ e(h, 25); + } + xs.s1_256 = a; + function f(h) { + return e(h, 7) ^ e(h, 18) ^ h >>> 3; + } + xs.g0_256 = f; + function u(h) { + return e(h, 17) ^ e(h, 19) ^ h >>> 10; + } + return xs.g1_256 = u, xs; +} +var mg, cx; +function IB() { + if (cx) return mg; + cx = 1; + var t = Ls(), e = nl(), r = l8(), n = t.rotl32, i = t.sum32, s = t.sum32_5, o = r.ft_1, a = e.BlockHash, f = [ + 1518500249, + 1859775393, + 2400959708, + 3395469782 + ]; + function u() { + if (!(this instanceof u)) + return new u(); + a.call(this), this.h = [ + 1732584193, + 4023233417, + 2562383102, + 271733878, + 3285377520 + ], this.W = new Array(80); + } + return t.inherits(u, a), mg = u, u.blockSize = 512, u.outSize = 160, u.hmacStrength = 80, u.padLength = 64, u.prototype._update = function(g, v) { + for (var x = this.W, S = 0; S < 16; S++) + x[S] = g[v + S]; + for (; S < x.length; S++) + x[S] = n(x[S - 3] ^ x[S - 8] ^ x[S - 14] ^ x[S - 16], 1); + var C = this.h[0], D = this.h[1], $ = this.h[2], N = this.h[3], z = this.h[4]; + for (S = 0; S < x.length; S++) { + var k = ~~(S / 20), B = s(n(C, 5), o(k, D, $, N), z, x[S], f[k]); + z = N, N = $, $ = n(D, 30), D = C, C = B; + } + this.h[0] = i(this.h[0], C), this.h[1] = i(this.h[1], D), this.h[2] = i(this.h[2], $), this.h[3] = i(this.h[3], N), this.h[4] = i(this.h[4], z); + }, u.prototype._digest = function(g) { + return g === "hex" ? t.toHex32(this.h, "big") : t.split32(this.h, "big"); + }, mg; +} +var vg, ux; +function h8() { + if (ux) return vg; + ux = 1; + var t = Ls(), e = nl(), r = l8(), n = Wa(), i = t.sum32, s = t.sum32_4, o = t.sum32_5, a = r.ch32, f = r.maj32, u = r.s0_256, h = r.s1_256, g = r.g0_256, v = r.g1_256, x = e.BlockHash, S = [ + 1116352408, + 1899447441, + 3049323471, + 3921009573, + 961987163, + 1508970993, + 2453635748, + 2870763221, + 3624381080, + 310598401, + 607225278, + 1426881987, + 1925078388, + 2162078206, + 2614888103, + 3248222580, + 3835390401, + 4022224774, + 264347078, + 604807628, + 770255983, + 1249150122, + 1555081692, + 1996064986, + 2554220882, + 2821834349, + 2952996808, + 3210313671, + 3336571891, + 3584528711, + 113926993, + 338241895, + 666307205, + 773529912, + 1294757372, + 1396182291, + 1695183700, + 1986661051, + 2177026350, + 2456956037, + 2730485921, + 2820302411, + 3259730800, + 3345764771, + 3516065817, + 3600352804, + 4094571909, + 275423344, + 430227734, + 506948616, + 659060556, + 883997877, + 958139571, + 1322822218, + 1537002063, + 1747873779, + 1955562222, + 2024104815, + 2227730452, + 2361852424, + 2428436474, + 2756734187, + 3204031479, + 3329325298 + ]; + function C() { + if (!(this instanceof C)) + return new C(); + x.call(this), this.h = [ + 1779033703, + 3144134277, + 1013904242, + 2773480762, + 1359893119, + 2600822924, + 528734635, + 1541459225 + ], this.k = S, this.W = new Array(64); + } + return t.inherits(C, x), vg = C, C.blockSize = 512, C.outSize = 256, C.hmacStrength = 192, C.padLength = 64, C.prototype._update = function($, N) { + for (var z = this.W, k = 0; k < 16; k++) + z[k] = $[N + k]; + for (; k < z.length; k++) + z[k] = s(v(z[k - 2]), z[k - 7], g(z[k - 15]), z[k - 16]); + var B = this.h[0], U = this.h[1], R = this.h[2], W = this.h[3], J = this.h[4], ne = this.h[5], K = this.h[6], E = this.h[7]; + for (n(this.k.length === z.length), k = 0; k < z.length; k++) { + var b = o(E, h(J), a(J, ne, K), this.k[k], z[k]), l = i(u(B), f(B, U, R)); + E = K, K = ne, ne = J, J = i(W, b), W = R, R = U, U = B, B = i(b, l); + } + this.h[0] = i(this.h[0], B), this.h[1] = i(this.h[1], U), this.h[2] = i(this.h[2], R), this.h[3] = i(this.h[3], W), this.h[4] = i(this.h[4], J), this.h[5] = i(this.h[5], ne), this.h[6] = i(this.h[6], K), this.h[7] = i(this.h[7], E); + }, C.prototype._digest = function($) { + return $ === "hex" ? t.toHex32(this.h, "big") : t.split32(this.h, "big"); + }, vg; +} +var bg, fx; +function CB() { + if (fx) return bg; + fx = 1; + var t = Ls(), e = h8(); + function r() { + if (!(this instanceof r)) + return new r(); + e.call(this), this.h = [ + 3238371032, + 914150663, + 812702999, + 4144912697, + 4290775857, + 1750603025, + 1694076839, + 3204075428 + ]; + } + return t.inherits(r, e), bg = r, r.blockSize = 512, r.outSize = 224, r.hmacStrength = 192, r.padLength = 64, r.prototype._digest = function(i) { + return i === "hex" ? t.toHex32(this.h.slice(0, 7), "big") : t.split32(this.h.slice(0, 7), "big"); + }, bg; +} +var yg, lx; +function d8() { + if (lx) return yg; + lx = 1; + var t = Ls(), e = nl(), r = Wa(), n = t.rotr64_hi, i = t.rotr64_lo, s = t.shr64_hi, o = t.shr64_lo, a = t.sum64, f = t.sum64_hi, u = t.sum64_lo, h = t.sum64_4_hi, g = t.sum64_4_lo, v = t.sum64_5_hi, x = t.sum64_5_lo, S = e.BlockHash, C = [ + 1116352408, + 3609767458, + 1899447441, + 602891725, + 3049323471, + 3964484399, + 3921009573, + 2173295548, + 961987163, + 4081628472, + 1508970993, + 3053834265, + 2453635748, + 2937671579, + 2870763221, + 3664609560, + 3624381080, + 2734883394, + 310598401, + 1164996542, + 607225278, + 1323610764, + 1426881987, + 3590304994, + 1925078388, + 4068182383, + 2162078206, + 991336113, + 2614888103, + 633803317, + 3248222580, + 3479774868, + 3835390401, + 2666613458, + 4022224774, + 944711139, + 264347078, + 2341262773, + 604807628, + 2007800933, + 770255983, + 1495990901, + 1249150122, + 1856431235, + 1555081692, + 3175218132, + 1996064986, + 2198950837, + 2554220882, + 3999719339, + 2821834349, + 766784016, + 2952996808, + 2566594879, + 3210313671, + 3203337956, + 3336571891, + 1034457026, + 3584528711, + 2466948901, + 113926993, + 3758326383, + 338241895, + 168717936, + 666307205, + 1188179964, + 773529912, + 1546045734, + 1294757372, + 1522805485, + 1396182291, + 2643833823, + 1695183700, + 2343527390, + 1986661051, + 1014477480, + 2177026350, + 1206759142, + 2456956037, + 344077627, + 2730485921, + 1290863460, + 2820302411, + 3158454273, + 3259730800, + 3505952657, + 3345764771, + 106217008, + 3516065817, + 3606008344, + 3600352804, + 1432725776, + 4094571909, + 1467031594, + 275423344, + 851169720, + 430227734, + 3100823752, + 506948616, + 1363258195, + 659060556, + 3750685593, + 883997877, + 3785050280, + 958139571, + 3318307427, + 1322822218, + 3812723403, + 1537002063, + 2003034995, + 1747873779, + 3602036899, + 1955562222, + 1575990012, + 2024104815, + 1125592928, + 2227730452, + 2716904306, + 2361852424, + 442776044, + 2428436474, + 593698344, + 2756734187, + 3733110249, + 3204031479, + 2999351573, + 3329325298, + 3815920427, + 3391569614, + 3928383900, + 3515267271, + 566280711, + 3940187606, + 3454069534, + 4118630271, + 4000239992, + 116418474, + 1914138554, + 174292421, + 2731055270, + 289380356, + 3203993006, + 460393269, + 320620315, + 685471733, + 587496836, + 852142971, + 1086792851, + 1017036298, + 365543100, + 1126000580, + 2618297676, + 1288033470, + 3409855158, + 1501505948, + 4234509866, + 1607167915, + 987167468, + 1816402316, + 1246189591 + ]; + function D() { + if (!(this instanceof D)) + return new D(); + S.call(this), this.h = [ + 1779033703, + 4089235720, + 3144134277, + 2227873595, + 1013904242, + 4271175723, + 2773480762, + 1595750129, + 1359893119, + 2917565137, + 2600822924, + 725511199, + 528734635, + 4215389547, + 1541459225, + 327033209 + ], this.k = C, this.W = new Array(160); + } + t.inherits(D, S), yg = D, D.blockSize = 1024, D.outSize = 512, D.hmacStrength = 192, D.padLength = 128, D.prototype._prepareBlock = function(l, p) { + for (var m = this.W, w = 0; w < 32; w++) + m[w] = l[p + w]; + for (; w < m.length; w += 2) { + var P = K(m[w - 4], m[w - 3]), _ = E(m[w - 4], m[w - 3]), y = m[w - 14], M = m[w - 13], I = J(m[w - 30], m[w - 29]), q = ne(m[w - 30], m[w - 29]), ce = m[w - 32], L = m[w - 31]; + m[w] = h( + P, + _, + y, + M, + I, + q, + ce, + L + ), m[w + 1] = g( + P, + _, + y, + M, + I, + q, + ce, + L + ); + } + }, D.prototype._update = function(l, p) { + this._prepareBlock(l, p); + var m = this.W, w = this.h[0], P = this.h[1], _ = this.h[2], y = this.h[3], M = this.h[4], I = this.h[5], q = this.h[6], ce = this.h[7], L = this.h[8], oe = this.h[9], Q = this.h[10], X = this.h[11], ee = this.h[12], O = this.h[13], Z = this.h[14], re = this.h[15]; + r(this.k.length === m.length); + for (var he = 0; he < m.length; he += 2) { + var ae = Z, fe = re, be = R(L, oe), Ae = W(L, oe), Te = $(L, oe, Q, X, ee), Re = N(L, oe, Q, X, ee, O), $e = this.k[he], Me = this.k[he + 1], Oe = m[he], ze = m[he + 1], De = v( + ae, + fe, + be, + Ae, + Te, + Re, + $e, + Me, + Oe, + ze + ), je = x( + ae, + fe, + be, + Ae, + Te, + Re, + $e, + Me, + Oe, + ze + ); + ae = B(w, P), fe = U(w, P), be = z(w, P, _, y, M), Ae = k(w, P, _, y, M, I); + var Ue = f(ae, fe, be, Ae), _e = u(ae, fe, be, Ae); + Z = ee, re = O, ee = Q, O = X, Q = L, X = oe, L = f(q, ce, De, je), oe = u(ce, ce, De, je), q = M, ce = I, M = _, I = y, _ = w, y = P, w = f(De, je, Ue, _e), P = u(De, je, Ue, _e); + } + a(this.h, 0, w, P), a(this.h, 2, _, y), a(this.h, 4, M, I), a(this.h, 6, q, ce), a(this.h, 8, L, oe), a(this.h, 10, Q, X), a(this.h, 12, ee, O), a(this.h, 14, Z, re); + }, D.prototype._digest = function(l) { + return l === "hex" ? t.toHex32(this.h, "big") : t.split32(this.h, "big"); + }; + function $(b, l, p, m, w) { + var P = b & p ^ ~b & w; + return P < 0 && (P += 4294967296), P; + } + function N(b, l, p, m, w, P) { + var _ = l & m ^ ~l & P; + return _ < 0 && (_ += 4294967296), _; + } + function z(b, l, p, m, w) { + var P = b & p ^ b & w ^ p & w; + return P < 0 && (P += 4294967296), P; + } + function k(b, l, p, m, w, P) { + var _ = l & m ^ l & P ^ m & P; + return _ < 0 && (_ += 4294967296), _; + } + function B(b, l) { + var p = n(b, l, 28), m = n(l, b, 2), w = n(l, b, 7), P = p ^ m ^ w; + return P < 0 && (P += 4294967296), P; + } + function U(b, l) { + var p = i(b, l, 28), m = i(l, b, 2), w = i(l, b, 7), P = p ^ m ^ w; + return P < 0 && (P += 4294967296), P; + } + function R(b, l) { + var p = n(b, l, 14), m = n(b, l, 18), w = n(l, b, 9), P = p ^ m ^ w; + return P < 0 && (P += 4294967296), P; + } + function W(b, l) { + var p = i(b, l, 14), m = i(b, l, 18), w = i(l, b, 9), P = p ^ m ^ w; + return P < 0 && (P += 4294967296), P; + } + function J(b, l) { + var p = n(b, l, 1), m = n(b, l, 8), w = s(b, l, 7), P = p ^ m ^ w; + return P < 0 && (P += 4294967296), P; + } + function ne(b, l) { + var p = i(b, l, 1), m = i(b, l, 8), w = o(b, l, 7), P = p ^ m ^ w; + return P < 0 && (P += 4294967296), P; + } + function K(b, l) { + var p = n(b, l, 19), m = n(l, b, 29), w = s(b, l, 6), P = p ^ m ^ w; + return P < 0 && (P += 4294967296), P; + } + function E(b, l) { + var p = i(b, l, 19), m = i(l, b, 29), w = o(b, l, 6), P = p ^ m ^ w; + return P < 0 && (P += 4294967296), P; + } + return yg; +} +var wg, hx; +function RB() { + if (hx) return wg; + hx = 1; + var t = Ls(), e = d8(); + function r() { + if (!(this instanceof r)) + return new r(); + e.call(this), this.h = [ + 3418070365, + 3238371032, + 1654270250, + 914150663, + 2438529370, + 812702999, + 355462360, + 4144912697, + 1731405415, + 4290775857, + 2394180231, + 1750603025, + 3675008525, + 1694076839, + 1203062813, + 3204075428 + ]; + } + return t.inherits(r, e), wg = r, r.blockSize = 1024, r.outSize = 384, r.hmacStrength = 192, r.padLength = 128, r.prototype._digest = function(i) { + return i === "hex" ? t.toHex32(this.h.slice(0, 12), "big") : t.split32(this.h.slice(0, 12), "big"); + }, wg; +} +var dx; +function TB() { + return dx || (dx = 1, da.sha1 = IB(), da.sha224 = CB(), da.sha256 = h8(), da.sha384 = RB(), da.sha512 = d8()), da; +} +var xg = {}, px; +function DB() { + if (px) return xg; + px = 1; + var t = Ls(), e = nl(), r = t.rotl32, n = t.sum32, i = t.sum32_3, s = t.sum32_4, o = e.BlockHash; + function a() { + if (!(this instanceof a)) + return new a(); + o.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = "little"; + } + t.inherits(a, o), xg.ripemd160 = a, a.blockSize = 512, a.outSize = 160, a.hmacStrength = 192, a.padLength = 64, a.prototype._update = function(D, $) { + for (var N = this.h[0], z = this.h[1], k = this.h[2], B = this.h[3], U = this.h[4], R = N, W = z, J = k, ne = B, K = U, E = 0; E < 80; E++) { + var b = n( + r( + s(N, f(E, z, k, B), D[g[E] + $], u(E)), + x[E] + ), + U + ); + N = U, U = B, B = r(k, 10), k = z, z = b, b = n( + r( + s(R, f(79 - E, W, J, ne), D[v[E] + $], h(E)), + S[E] + ), + K + ), R = K, K = ne, ne = r(J, 10), J = W, W = b; + } + b = i(this.h[1], k, ne), this.h[1] = i(this.h[2], B, K), this.h[2] = i(this.h[3], U, R), this.h[3] = i(this.h[4], N, W), this.h[4] = i(this.h[0], z, J), this.h[0] = b; + }, a.prototype._digest = function(D) { + return D === "hex" ? t.toHex32(this.h, "little") : t.split32(this.h, "little"); + }; + function f(C, D, $, N) { + return C <= 15 ? D ^ $ ^ N : C <= 31 ? D & $ | ~D & N : C <= 47 ? (D | ~$) ^ N : C <= 63 ? D & N | $ & ~N : D ^ ($ | ~N); + } + function u(C) { + return C <= 15 ? 0 : C <= 31 ? 1518500249 : C <= 47 ? 1859775393 : C <= 63 ? 2400959708 : 2840853838; + } + function h(C) { + return C <= 15 ? 1352829926 : C <= 31 ? 1548603684 : C <= 47 ? 1836072691 : C <= 63 ? 2053994217 : 0; + } + var g = [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 7, + 4, + 13, + 1, + 10, + 6, + 15, + 3, + 12, + 0, + 9, + 5, + 2, + 14, + 11, + 8, + 3, + 10, + 14, + 4, + 9, + 15, + 8, + 1, + 2, + 7, + 0, + 6, + 13, + 11, + 5, + 12, + 1, + 9, + 11, + 10, + 0, + 8, + 12, + 4, + 13, + 3, + 7, + 15, + 14, + 5, + 6, + 2, + 4, + 0, + 5, + 9, + 7, + 12, + 2, + 10, + 14, + 1, + 3, + 8, + 11, + 6, + 15, + 13 + ], v = [ + 5, + 14, + 7, + 0, + 9, + 2, + 11, + 4, + 13, + 6, + 15, + 8, + 1, + 10, + 3, + 12, + 6, + 11, + 3, + 7, + 0, + 13, + 5, + 10, + 14, + 15, + 8, + 12, + 4, + 9, + 1, + 2, + 15, + 5, + 1, + 3, + 7, + 14, + 6, + 9, + 11, + 8, + 12, + 2, + 10, + 0, + 4, + 13, + 8, + 6, + 4, + 1, + 3, + 11, + 15, + 0, + 5, + 12, + 2, + 13, + 9, + 7, + 10, + 14, + 12, + 15, + 10, + 4, + 1, + 5, + 8, + 7, + 6, + 2, + 13, + 14, + 0, + 3, + 9, + 11 + ], x = [ + 11, + 14, + 15, + 12, + 5, + 8, + 7, + 9, + 11, + 13, + 14, + 15, + 6, + 7, + 9, + 8, + 7, + 6, + 8, + 13, + 11, + 9, + 7, + 15, + 7, + 12, + 15, + 9, + 11, + 7, + 13, + 12, + 11, + 13, + 6, + 7, + 14, + 9, + 13, + 15, + 14, + 8, + 13, + 6, + 5, + 12, + 7, + 5, + 11, + 12, + 14, + 15, + 14, + 15, + 9, + 8, + 9, + 14, + 5, + 6, + 8, + 6, + 5, + 12, + 9, + 15, + 5, + 11, + 6, + 8, + 13, + 12, + 5, + 12, + 13, + 14, + 11, + 8, + 5, + 6 + ], S = [ + 8, + 9, + 9, + 11, + 13, + 15, + 15, + 5, + 7, + 7, + 8, + 11, + 14, + 14, + 12, + 6, + 9, + 13, + 15, + 7, + 12, + 8, + 9, + 11, + 7, + 7, + 12, + 7, + 6, + 15, + 13, + 11, + 9, + 7, + 15, + 11, + 8, + 6, + 6, + 14, + 12, + 13, + 5, + 14, + 13, + 13, + 7, + 5, + 15, + 5, + 8, + 11, + 14, + 14, + 6, + 14, + 6, + 9, + 12, + 9, + 12, + 5, + 15, + 8, + 8, + 5, + 12, + 9, + 12, + 5, + 14, + 6, + 8, + 13, + 6, + 5, + 15, + 13, + 11, + 11 + ]; + return xg; +} +var _g, gx; +function OB() { + if (gx) return _g; + gx = 1; + var t = Ls(), e = Wa(); + function r(n, i, s) { + if (!(this instanceof r)) + return new r(n, i, s); + this.Hash = n, this.blockSize = n.blockSize / 8, this.outSize = n.outSize / 8, this.inner = null, this.outer = null, this._init(t.toArray(i, s)); + } + return _g = r, r.prototype._init = function(i) { + i.length > this.blockSize && (i = new this.Hash().update(i).digest()), e(i.length <= this.blockSize); + for (var s = i.length; s < this.blockSize; s++) + i.push(0); + for (s = 0; s < i.length; s++) + i[s] ^= 54; + for (this.inner = new this.Hash().update(i), s = 0; s < i.length; s++) + i[s] ^= 106; + this.outer = new this.Hash().update(i); + }, r.prototype.update = function(i, s) { + return this.inner.update(i, s), this; + }, r.prototype.digest = function(i) { + return this.outer.update(this.inner.digest()), this.outer.digest(i); + }, _g; +} +var mx; +function Xd() { + return mx || (mx = 1, (function(t) { + var e = t; + e.utils = Ls(), e.common = nl(), e.sha = TB(), e.ripemd = DB(), e.hmac = OB(), e.sha1 = e.sha.sha1, e.sha256 = e.sha.sha256, e.sha224 = e.sha.sha224, e.sha384 = e.sha.sha384, e.sha512 = e.sha.sha512, e.ripemd160 = e.ripemd.ripemd160; + })(dg)), dg; +} +var NB = Xd(); +const Xs = /* @__PURE__ */ Hi(NB); +function Gc(t, e, r) { + return r = { + path: e, + exports: {}, + require: function(n, i) { + return LB(n, i ?? r.path); + } + }, t(r, r.exports), r.exports; +} +function LB() { + throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs"); +} +var v1 = p8; +function p8(t, e) { + if (!t) + throw new Error(e || "Assertion failed"); +} +p8.equal = function(e, r, n) { + if (e != r) + throw new Error(n || "Assertion failed: " + e + " != " + r); +}; +var as = Gc(function(t, e) { + var r = e; + function n(o, a) { + if (Array.isArray(o)) + return o.slice(); + if (!o) + return []; + var f = []; + if (typeof o != "string") { + for (var u = 0; u < o.length; u++) + f[u] = o[u] | 0; + return f; + } + if (a === "hex") { + o = o.replace(/[^a-z0-9]+/ig, ""), o.length % 2 !== 0 && (o = "0" + o); + for (var u = 0; u < o.length; u += 2) + f.push(parseInt(o[u] + o[u + 1], 16)); + } else + for (var u = 0; u < o.length; u++) { + var h = o.charCodeAt(u), g = h >> 8, v = h & 255; + g ? f.push(g, v) : f.push(v); + } + return f; + } + r.toArray = n; + function i(o) { + return o.length === 1 ? "0" + o : o; + } + r.zero2 = i; + function s(o) { + for (var a = "", f = 0; f < o.length; f++) + a += i(o[f].toString(16)); + return a; + } + r.toHex = s, r.encode = function(a, f) { + return f === "hex" ? s(a) : a; + }; +}), Ii = Gc(function(t, e) { + var r = e; + r.assert = v1, r.toArray = as.toArray, r.zero2 = as.zero2, r.toHex = as.toHex, r.encode = as.encode; + function n(f, u, h) { + var g = new Array(Math.max(f.bitLength(), h) + 1); + g.fill(0); + for (var v = 1 << u + 1, x = f.clone(), S = 0; S < g.length; S++) { + var C, D = x.andln(v - 1); + x.isOdd() ? (D > (v >> 1) - 1 ? C = (v >> 1) - D : C = D, x.isubn(C)) : C = 0, g[S] = C, x.iushrn(1); + } + return g; + } + r.getNAF = n; + function i(f, u) { + var h = [ + [], + [] + ]; + f = f.clone(), u = u.clone(); + for (var g = 0, v = 0, x; f.cmpn(-g) > 0 || u.cmpn(-v) > 0; ) { + var S = f.andln(3) + g & 3, C = u.andln(3) + v & 3; + S === 3 && (S = -1), C === 3 && (C = -1); + var D; + (S & 1) === 0 ? D = 0 : (x = f.andln(7) + g & 7, (x === 3 || x === 5) && C === 2 ? D = -S : D = S), h[0].push(D); + var $; + (C & 1) === 0 ? $ = 0 : (x = u.andln(7) + v & 7, (x === 3 || x === 5) && S === 2 ? $ = -C : $ = C), h[1].push($), 2 * g === D + 1 && (g = 1 - g), 2 * v === $ + 1 && (v = 1 - v), f.iushrn(1), u.iushrn(1); + } + return h; + } + r.getJSF = i; + function s(f, u, h) { + var g = "_" + u; + f.prototype[u] = function() { + return this[g] !== void 0 ? this[g] : this[g] = h.call(this); + }; + } + r.cachedProperty = s; + function o(f) { + return typeof f == "string" ? r.toArray(f, "hex") : f; + } + r.parseBytes = o; + function a(f) { + return new or(f, "hex", "le"); + } + r.intFromLE = a; +}), yd = Ii.getNAF, kB = Ii.getJSF, wd = Ii.assert; +function Zo(t, e) { + this.type = t, this.p = new or(e.p, 16), this.red = e.prime ? or.red(e.prime) : or.mont(this.p), this.zero = new or(0).toRed(this.red), this.one = new or(1).toRed(this.red), this.two = new or(2).toRed(this.red), this.n = e.n && new or(e.n, 16), this.g = e.g && this.pointFromJSON(e.g, e.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; + var r = this.n && this.p.div(this.n); + !r || r.cmpn(100) > 0 ? this.redN = null : (this._maxwellTrick = !0, this.redN = this.n.toRed(this.red)); +} +var Ka = Zo; +Zo.prototype.point = function() { + throw new Error("Not implemented"); +}; +Zo.prototype.validate = function() { + throw new Error("Not implemented"); +}; +Zo.prototype._fixedNafMul = function(e, r) { + wd(e.precomputed); + var n = e._getDoubles(), i = yd(r, 1, this._bitLength), s = (1 << n.step + 1) - (n.step % 2 === 0 ? 2 : 1); + s /= 3; + var o = [], a, f; + for (a = 0; a < i.length; a += n.step) { + f = 0; + for (var u = a + n.step - 1; u >= a; u--) + f = (f << 1) + i[u]; + o.push(f); + } + for (var h = this.jpoint(null, null, null), g = this.jpoint(null, null, null), v = s; v > 0; v--) { + for (a = 0; a < o.length; a++) + f = o[a], f === v ? g = g.mixedAdd(n.points[a]) : f === -v && (g = g.mixedAdd(n.points[a].neg())); + h = h.add(g); + } + return h.toP(); +}; +Zo.prototype._wnafMul = function(e, r) { + var n = 4, i = e._getNAFPoints(n); + n = i.wnd; + for (var s = i.points, o = yd(r, n, this._bitLength), a = this.jpoint(null, null, null), f = o.length - 1; f >= 0; f--) { + for (var u = 0; f >= 0 && o[f] === 0; f--) + u++; + if (f >= 0 && u++, a = a.dblp(u), f < 0) + break; + var h = o[f]; + wd(h !== 0), e.type === "affine" ? h > 0 ? a = a.mixedAdd(s[h - 1 >> 1]) : a = a.mixedAdd(s[-h - 1 >> 1].neg()) : h > 0 ? a = a.add(s[h - 1 >> 1]) : a = a.add(s[-h - 1 >> 1].neg()); + } + return e.type === "affine" ? a.toP() : a; +}; +Zo.prototype._wnafMulAdd = function(e, r, n, i, s) { + var o = this._wnafT1, a = this._wnafT2, f = this._wnafT3, u = 0, h, g, v; + for (h = 0; h < i; h++) { + v = r[h]; + var x = v._getNAFPoints(e); + o[h] = x.wnd, a[h] = x.points; + } + for (h = i - 1; h >= 1; h -= 2) { + var S = h - 1, C = h; + if (o[S] !== 1 || o[C] !== 1) { + f[S] = yd(n[S], o[S], this._bitLength), f[C] = yd(n[C], o[C], this._bitLength), u = Math.max(f[S].length, u), u = Math.max(f[C].length, u); + continue; + } + var D = [ + r[S], + /* 1 */ + null, + /* 3 */ + null, + /* 5 */ + r[C] + /* 7 */ + ]; + r[S].y.cmp(r[C].y) === 0 ? (D[1] = r[S].add(r[C]), D[2] = r[S].toJ().mixedAdd(r[C].neg())) : r[S].y.cmp(r[C].y.redNeg()) === 0 ? (D[1] = r[S].toJ().mixedAdd(r[C]), D[2] = r[S].add(r[C].neg())) : (D[1] = r[S].toJ().mixedAdd(r[C]), D[2] = r[S].toJ().mixedAdd(r[C].neg())); + var $ = [ + -3, + /* -1 -1 */ + -1, + /* -1 0 */ + -5, + /* -1 1 */ + -7, + /* 0 -1 */ + 0, + /* 0 0 */ + 7, + /* 0 1 */ + 5, + /* 1 -1 */ + 1, + /* 1 0 */ + 3 + /* 1 1 */ + ], N = kB(n[S], n[C]); + for (u = Math.max(N[0].length, u), f[S] = new Array(u), f[C] = new Array(u), g = 0; g < u; g++) { + var z = N[0][g] | 0, k = N[1][g] | 0; + f[S][g] = $[(z + 1) * 3 + (k + 1)], f[C][g] = 0, a[S] = D; + } + } + var B = this.jpoint(null, null, null), U = this._wnafT4; + for (h = u; h >= 0; h--) { + for (var R = 0; h >= 0; ) { + var W = !0; + for (g = 0; g < i; g++) + U[g] = f[g][h] | 0, U[g] !== 0 && (W = !1); + if (!W) + break; + R++, h--; + } + if (h >= 0 && R++, B = B.dblp(R), h < 0) + break; + for (g = 0; g < i; g++) { + var J = U[g]; + J !== 0 && (J > 0 ? v = a[g][J - 1 >> 1] : J < 0 && (v = a[g][-J - 1 >> 1].neg()), v.type === "affine" ? B = B.mixedAdd(v) : B = B.add(v)); + } + } + for (h = 0; h < i; h++) + a[h] = null; + return s ? B : B.toP(); +}; +function Ki(t, e) { + this.curve = t, this.type = e, this.precomputed = null; +} +Zo.BasePoint = Ki; +Ki.prototype.eq = function() { + throw new Error("Not implemented"); +}; +Ki.prototype.validate = function() { + return this.curve.validate(this); +}; +Zo.prototype.decodePoint = function(e, r) { + e = Ii.toArray(e, r); + var n = this.p.byteLength(); + if ((e[0] === 4 || e[0] === 6 || e[0] === 7) && e.length - 1 === 2 * n) { + e[0] === 6 ? wd(e[e.length - 1] % 2 === 0) : e[0] === 7 && wd(e[e.length - 1] % 2 === 1); + var i = this.point( + e.slice(1, 1 + n), + e.slice(1 + n, 1 + 2 * n) + ); + return i; + } else if ((e[0] === 2 || e[0] === 3) && e.length - 1 === n) + return this.pointFromX(e.slice(1, 1 + n), e[0] === 3); + throw new Error("Unknown point format"); +}; +Ki.prototype.encodeCompressed = function(e) { + return this.encode(e, !0); +}; +Ki.prototype._encode = function(e) { + var r = this.curve.p.byteLength(), n = this.getX().toArray("be", r); + return e ? [this.getY().isEven() ? 2 : 3].concat(n) : [4].concat(n, this.getY().toArray("be", r)); +}; +Ki.prototype.encode = function(e, r) { + return Ii.encode(this._encode(r), e); +}; +Ki.prototype.precompute = function(e) { + if (this.precomputed) + return this; + var r = { + doubles: null, + naf: null, + beta: null + }; + return r.naf = this._getNAFPoints(8), r.doubles = this._getDoubles(4, e), r.beta = this._getBeta(), this.precomputed = r, this; +}; +Ki.prototype._hasDoubles = function(e) { + if (!this.precomputed) + return !1; + var r = this.precomputed.doubles; + return r ? r.points.length >= Math.ceil((e.bitLength() + 1) / r.step) : !1; +}; +Ki.prototype._getDoubles = function(e, r) { + if (this.precomputed && this.precomputed.doubles) + return this.precomputed.doubles; + for (var n = [this], i = this, s = 0; s < r; s += e) { + for (var o = 0; o < e; o++) + i = i.dbl(); + n.push(i); + } + return { + step: e, + points: n + }; +}; +Ki.prototype._getNAFPoints = function(e) { + if (this.precomputed && this.precomputed.naf) + return this.precomputed.naf; + for (var r = [this], n = (1 << e) - 1, i = n === 1 ? null : this.dbl(), s = 1; s < n; s++) + r[s] = r[s - 1].add(i); + return { + wnd: e, + points: r + }; +}; +Ki.prototype._getBeta = function() { + return null; +}; +Ki.prototype.dblp = function(e) { + for (var r = this, n = 0; n < e; n++) + r = r.dbl(); + return r; +}; +var b1 = Gc(function(t) { + typeof Object.create == "function" ? t.exports = function(r, n) { + n && (r.super_ = n, r.prototype = Object.create(n.prototype, { + constructor: { + value: r, + enumerable: !1, + writable: !0, + configurable: !0 + } + })); + } : t.exports = function(r, n) { + if (n) { + r.super_ = n; + var i = function() { + }; + i.prototype = n.prototype, r.prototype = new i(), r.prototype.constructor = r; + } + }; +}), $B = Ii.assert; +function Vi(t) { + Ka.call(this, "short", t), this.a = new or(t.a, 16).toRed(this.red), this.b = new or(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); +} +b1(Vi, Ka); +var BB = Vi; +Vi.prototype._getEndomorphism = function(e) { + if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { + var r, n; + if (e.beta) + r = new or(e.beta, 16).toRed(this.red); + else { + var i = this._getEndoRoots(this.p); + r = i[0].cmp(i[1]) < 0 ? i[0] : i[1], r = r.toRed(this.red); + } + if (e.lambda) + n = new or(e.lambda, 16); + else { + var s = this._getEndoRoots(this.n); + this.g.mul(s[0]).x.cmp(this.g.x.redMul(r)) === 0 ? n = s[0] : (n = s[1], $B(this.g.mul(n).x.cmp(this.g.x.redMul(r)) === 0)); + } + var o; + return e.basis ? o = e.basis.map(function(a) { + return { + a: new or(a.a, 16), + b: new or(a.b, 16) + }; + }) : o = this._getEndoBasis(n), { + beta: r, + lambda: n, + basis: o + }; + } +}; +Vi.prototype._getEndoRoots = function(e) { + var r = e === this.p ? this.red : or.mont(e), n = new or(2).toRed(r).redInvm(), i = n.redNeg(), s = new or(3).toRed(r).redNeg().redSqrt().redMul(n), o = i.redAdd(s).fromRed(), a = i.redSub(s).fromRed(); + return [o, a]; +}; +Vi.prototype._getEndoBasis = function(e) { + for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new or(1), o = new or(0), a = new or(0), f = new or(1), u, h, g, v, x, S, C, D = 0, $, N; n.cmpn(0) !== 0; ) { + var z = i.div(n); + $ = i.sub(z.mul(n)), N = a.sub(z.mul(s)); + var k = f.sub(z.mul(o)); + if (!g && $.cmp(r) < 0) + u = C.neg(), h = s, g = $.neg(), v = N; + else if (g && ++D === 2) + break; + C = $, i = n, n = $, a = s, s = N, f = o, o = k; + } + x = $.neg(), S = N; + var B = g.sqr().add(v.sqr()), U = x.sqr().add(S.sqr()); + return U.cmp(B) >= 0 && (x = u, S = h), g.negative && (g = g.neg(), v = v.neg()), x.negative && (x = x.neg(), S = S.neg()), [ + { a: g, b: v }, + { a: x, b: S } + ]; +}; +Vi.prototype._endoSplit = function(e) { + var r = this.endo.basis, n = r[0], i = r[1], s = i.b.mul(e).divRound(this.n), o = n.b.neg().mul(e).divRound(this.n), a = s.mul(n.a), f = o.mul(i.a), u = s.mul(n.b), h = o.mul(i.b), g = e.sub(a).sub(f), v = u.add(h).neg(); + return { k1: g, k2: v }; +}; +Vi.prototype.pointFromX = function(e, r) { + e = new or(e, 16), e.red || (e = e.toRed(this.red)); + var n = e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b), i = n.redSqrt(); + if (i.redSqr().redSub(n).cmp(this.zero) !== 0) + throw new Error("invalid point"); + var s = i.fromRed().isOdd(); + return (r && !s || !r && s) && (i = i.redNeg()), this.point(e, i); +}; +Vi.prototype.validate = function(e) { + if (e.inf) + return !0; + var r = e.x, n = e.y, i = this.a.redMul(r), s = r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b); + return n.redSqr().redISub(s).cmpn(0) === 0; +}; +Vi.prototype._endoWnafMulAdd = function(e, r, n) { + for (var i = this._endoWnafT1, s = this._endoWnafT2, o = 0; o < e.length; o++) { + var a = this._endoSplit(r[o]), f = e[o], u = f._getBeta(); + a.k1.negative && (a.k1.ineg(), f = f.neg(!0)), a.k2.negative && (a.k2.ineg(), u = u.neg(!0)), i[o * 2] = f, i[o * 2 + 1] = u, s[o * 2] = a.k1, s[o * 2 + 1] = a.k2; + } + for (var h = this._wnafMulAdd(1, i, s, o * 2, n), g = 0; g < o * 2; g++) + i[g] = null, s[g] = null; + return h; +}; +function Dn(t, e, r, n) { + Ka.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new or(e, 16), this.y = new or(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); +} +b1(Dn, Ka.BasePoint); +Vi.prototype.point = function(e, r, n) { + return new Dn(this, e, r, n); +}; +Vi.prototype.pointFromJSON = function(e, r) { + return Dn.fromJSON(this, e, r); +}; +Dn.prototype._getBeta = function() { + if (this.curve.endo) { + var e = this.precomputed; + if (e && e.beta) + return e.beta; + var r = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y); + if (e) { + var n = this.curve, i = function(s) { + return n.point(s.x.redMul(n.endo.beta), s.y); + }; + e.beta = r, r.precomputed = { + beta: null, + naf: e.naf && { + wnd: e.naf.wnd, + points: e.naf.points.map(i) + }, + doubles: e.doubles && { + step: e.doubles.step, + points: e.doubles.points.map(i) + } + }; + } + return r; + } +}; +Dn.prototype.toJSON = function() { + return this.precomputed ? [this.x, this.y, this.precomputed && { + doubles: this.precomputed.doubles && { + step: this.precomputed.doubles.step, + points: this.precomputed.doubles.points.slice(1) + }, + naf: this.precomputed.naf && { + wnd: this.precomputed.naf.wnd, + points: this.precomputed.naf.points.slice(1) + } + }] : [this.x, this.y]; +}; +Dn.fromJSON = function(e, r, n) { + typeof r == "string" && (r = JSON.parse(r)); + var i = e.point(r[0], r[1], n); + if (!r[2]) + return i; + function s(a) { + return e.point(a[0], a[1], n); + } + var o = r[2]; + return i.precomputed = { + beta: null, + doubles: o.doubles && { + step: o.doubles.step, + points: [i].concat(o.doubles.points.map(s)) + }, + naf: o.naf && { + wnd: o.naf.wnd, + points: [i].concat(o.naf.points.map(s)) + } + }, i; +}; +Dn.prototype.inspect = function() { + return this.isInfinity() ? "" : ""; +}; +Dn.prototype.isInfinity = function() { + return this.inf; +}; +Dn.prototype.add = function(e) { + if (this.inf) + return e; + if (e.inf) + return this; + if (this.eq(e)) + return this.dbl(); + if (this.neg().eq(e)) + return this.curve.point(null, null); + if (this.x.cmp(e.x) === 0) + return this.curve.point(null, null); + var r = this.y.redSub(e.y); + r.cmpn(0) !== 0 && (r = r.redMul(this.x.redSub(e.x).redInvm())); + var n = r.redSqr().redISub(this.x).redISub(e.x), i = r.redMul(this.x.redSub(n)).redISub(this.y); + return this.curve.point(n, i); +}; +Dn.prototype.dbl = function() { + if (this.inf) + return this; + var e = this.y.redAdd(this.y); + if (e.cmpn(0) === 0) + return this.curve.point(null, null); + var r = this.curve.a, n = this.x.redSqr(), i = e.redInvm(), s = n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i), o = s.redSqr().redISub(this.x.redAdd(this.x)), a = s.redMul(this.x.redSub(o)).redISub(this.y); + return this.curve.point(o, a); +}; +Dn.prototype.getX = function() { + return this.x.fromRed(); +}; +Dn.prototype.getY = function() { + return this.y.fromRed(); +}; +Dn.prototype.mul = function(e) { + return e = new or(e, 16), this.isInfinity() ? this : this._hasDoubles(e) ? this.curve._fixedNafMul(this, e) : this.curve.endo ? this.curve._endoWnafMulAdd([this], [e]) : this.curve._wnafMul(this, e); +}; +Dn.prototype.mulAdd = function(e, r, n) { + var i = [this, r], s = [e, n]; + return this.curve.endo ? this.curve._endoWnafMulAdd(i, s) : this.curve._wnafMulAdd(1, i, s, 2); +}; +Dn.prototype.jmulAdd = function(e, r, n) { + var i = [this, r], s = [e, n]; + return this.curve.endo ? this.curve._endoWnafMulAdd(i, s, !0) : this.curve._wnafMulAdd(1, i, s, 2, !0); +}; +Dn.prototype.eq = function(e) { + return this === e || this.inf === e.inf && (this.inf || this.x.cmp(e.x) === 0 && this.y.cmp(e.y) === 0); +}; +Dn.prototype.neg = function(e) { + if (this.inf) + return this; + var r = this.curve.point(this.x, this.y.redNeg()); + if (e && this.precomputed) { + var n = this.precomputed, i = function(s) { + return s.neg(); + }; + r.precomputed = { + naf: n.naf && { + wnd: n.naf.wnd, + points: n.naf.points.map(i) + }, + doubles: n.doubles && { + step: n.doubles.step, + points: n.doubles.points.map(i) + } + }; + } + return r; +}; +Dn.prototype.toJ = function() { + if (this.inf) + return this.curve.jpoint(null, null, null); + var e = this.curve.jpoint(this.x, this.y, this.curve.one); + return e; +}; +function Bn(t, e, r, n) { + Ka.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new or(0)) : (this.x = new or(e, 16), this.y = new or(r, 16), this.z = new or(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; +} +b1(Bn, Ka.BasePoint); +Vi.prototype.jpoint = function(e, r, n) { + return new Bn(this, e, r, n); +}; +Bn.prototype.toP = function() { + if (this.isInfinity()) + return this.curve.point(null, null); + var e = this.z.redInvm(), r = e.redSqr(), n = this.x.redMul(r), i = this.y.redMul(r).redMul(e); + return this.curve.point(n, i); +}; +Bn.prototype.neg = function() { + return this.curve.jpoint(this.x, this.y.redNeg(), this.z); +}; +Bn.prototype.add = function(e) { + if (this.isInfinity()) + return e; + if (e.isInfinity()) + return this; + var r = e.z.redSqr(), n = this.z.redSqr(), i = this.x.redMul(r), s = e.x.redMul(n), o = this.y.redMul(r.redMul(e.z)), a = e.y.redMul(n.redMul(this.z)), f = i.redSub(s), u = o.redSub(a); + if (f.cmpn(0) === 0) + return u.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); + var h = f.redSqr(), g = h.redMul(f), v = i.redMul(h), x = u.redSqr().redIAdd(g).redISub(v).redISub(v), S = u.redMul(v.redISub(x)).redISub(o.redMul(g)), C = this.z.redMul(e.z).redMul(f); + return this.curve.jpoint(x, S, C); +}; +Bn.prototype.mixedAdd = function(e) { + if (this.isInfinity()) + return e.toJ(); + if (e.isInfinity()) + return this; + var r = this.z.redSqr(), n = this.x, i = e.x.redMul(r), s = this.y, o = e.y.redMul(r).redMul(this.z), a = n.redSub(i), f = s.redSub(o); + if (a.cmpn(0) === 0) + return f.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); + var u = a.redSqr(), h = u.redMul(a), g = n.redMul(u), v = f.redSqr().redIAdd(h).redISub(g).redISub(g), x = f.redMul(g.redISub(v)).redISub(s.redMul(h)), S = this.z.redMul(a); + return this.curve.jpoint(v, x, S); +}; +Bn.prototype.dblp = function(e) { + if (e === 0) + return this; + if (this.isInfinity()) + return this; + if (!e) + return this.dbl(); + var r; + if (this.curve.zeroA || this.curve.threeA) { + var n = this; + for (r = 0; r < e; r++) + n = n.dbl(); + return n; + } + var i = this.curve.a, s = this.curve.tinv, o = this.x, a = this.y, f = this.z, u = f.redSqr().redSqr(), h = a.redAdd(a); + for (r = 0; r < e; r++) { + var g = o.redSqr(), v = h.redSqr(), x = v.redSqr(), S = g.redAdd(g).redIAdd(g).redIAdd(i.redMul(u)), C = o.redMul(v), D = S.redSqr().redISub(C.redAdd(C)), $ = C.redISub(D), N = S.redMul($); + N = N.redIAdd(N).redISub(x); + var z = h.redMul(f); + r + 1 < e && (u = u.redMul(x)), o = D, f = z, h = N; + } + return this.curve.jpoint(o, h.redMul(s), f); +}; +Bn.prototype.dbl = function() { + return this.isInfinity() ? this : this.curve.zeroA ? this._zeroDbl() : this.curve.threeA ? this._threeDbl() : this._dbl(); +}; +Bn.prototype._zeroDbl = function() { + var e, r, n; + if (this.zOne) { + var i = this.x.redSqr(), s = this.y.redSqr(), o = s.redSqr(), a = this.x.redAdd(s).redSqr().redISub(i).redISub(o); + a = a.redIAdd(a); + var f = i.redAdd(i).redIAdd(i), u = f.redSqr().redISub(a).redISub(a), h = o.redIAdd(o); + h = h.redIAdd(h), h = h.redIAdd(h), e = u, r = f.redMul(a.redISub(u)).redISub(h), n = this.y.redAdd(this.y); + } else { + var g = this.x.redSqr(), v = this.y.redSqr(), x = v.redSqr(), S = this.x.redAdd(v).redSqr().redISub(g).redISub(x); + S = S.redIAdd(S); + var C = g.redAdd(g).redIAdd(g), D = C.redSqr(), $ = x.redIAdd(x); + $ = $.redIAdd($), $ = $.redIAdd($), e = D.redISub(S).redISub(S), r = C.redMul(S.redISub(e)).redISub($), n = this.y.redMul(this.z), n = n.redIAdd(n); + } + return this.curve.jpoint(e, r, n); +}; +Bn.prototype._threeDbl = function() { + var e, r, n; + if (this.zOne) { + var i = this.x.redSqr(), s = this.y.redSqr(), o = s.redSqr(), a = this.x.redAdd(s).redSqr().redISub(i).redISub(o); + a = a.redIAdd(a); + var f = i.redAdd(i).redIAdd(i).redIAdd(this.curve.a), u = f.redSqr().redISub(a).redISub(a); + e = u; + var h = o.redIAdd(o); + h = h.redIAdd(h), h = h.redIAdd(h), r = f.redMul(a.redISub(u)).redISub(h), n = this.y.redAdd(this.y); + } else { + var g = this.z.redSqr(), v = this.y.redSqr(), x = this.x.redMul(v), S = this.x.redSub(g).redMul(this.x.redAdd(g)); + S = S.redAdd(S).redIAdd(S); + var C = x.redIAdd(x); + C = C.redIAdd(C); + var D = C.redAdd(C); + e = S.redSqr().redISub(D), n = this.y.redAdd(this.z).redSqr().redISub(v).redISub(g); + var $ = v.redSqr(); + $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($), r = S.redMul(C.redISub(e)).redISub($); + } + return this.curve.jpoint(e, r, n); +}; +Bn.prototype._dbl = function() { + var e = this.curve.a, r = this.x, n = this.y, i = this.z, s = i.redSqr().redSqr(), o = r.redSqr(), a = n.redSqr(), f = o.redAdd(o).redIAdd(o).redIAdd(e.redMul(s)), u = r.redAdd(r); + u = u.redIAdd(u); + var h = u.redMul(a), g = f.redSqr().redISub(h.redAdd(h)), v = h.redISub(g), x = a.redSqr(); + x = x.redIAdd(x), x = x.redIAdd(x), x = x.redIAdd(x); + var S = f.redMul(v).redISub(x), C = n.redAdd(n).redMul(i); + return this.curve.jpoint(g, S, C); +}; +Bn.prototype.trpl = function() { + if (!this.curve.zeroA) + return this.dbl().add(this); + var e = this.x.redSqr(), r = this.y.redSqr(), n = this.z.redSqr(), i = r.redSqr(), s = e.redAdd(e).redIAdd(e), o = s.redSqr(), a = this.x.redAdd(r).redSqr().redISub(e).redISub(i); + a = a.redIAdd(a), a = a.redAdd(a).redIAdd(a), a = a.redISub(o); + var f = a.redSqr(), u = i.redIAdd(i); + u = u.redIAdd(u), u = u.redIAdd(u), u = u.redIAdd(u); + var h = s.redIAdd(a).redSqr().redISub(o).redISub(f).redISub(u), g = r.redMul(h); + g = g.redIAdd(g), g = g.redIAdd(g); + var v = this.x.redMul(f).redISub(g); + v = v.redIAdd(v), v = v.redIAdd(v); + var x = this.y.redMul(h.redMul(u.redISub(h)).redISub(a.redMul(f))); + x = x.redIAdd(x), x = x.redIAdd(x), x = x.redIAdd(x); + var S = this.z.redAdd(a).redSqr().redISub(n).redISub(f); + return this.curve.jpoint(v, x, S); +}; +Bn.prototype.mul = function(e, r) { + return e = new or(e, r), this.curve._wnafMul(this, e); +}; +Bn.prototype.eq = function(e) { + if (e.type === "affine") + return this.eq(e.toJ()); + if (this === e) + return !0; + var r = this.z.redSqr(), n = e.z.redSqr(); + if (this.x.redMul(n).redISub(e.x.redMul(r)).cmpn(0) !== 0) + return !1; + var i = r.redMul(this.z), s = n.redMul(e.z); + return this.y.redMul(s).redISub(e.y.redMul(i)).cmpn(0) === 0; +}; +Bn.prototype.eqXToP = function(e) { + var r = this.z.redSqr(), n = e.toRed(this.curve.red).redMul(r); + if (this.x.cmp(n) === 0) + return !0; + for (var i = e.clone(), s = this.curve.redN.redMul(r); ; ) { + if (i.iadd(this.curve.n), i.cmp(this.curve.p) >= 0) + return !1; + if (n.redIAdd(s), this.x.cmp(n) === 0) + return !0; + } +}; +Bn.prototype.inspect = function() { + return this.isInfinity() ? "" : ""; +}; +Bn.prototype.isInfinity = function() { + return this.z.cmpn(0) === 0; +}; +var jh = Gc(function(t, e) { + var r = e; + r.base = Ka, r.short = BB, r.mont = /*RicMoo:ethers:require(./mont)*/ + null, r.edwards = /*RicMoo:ethers:require(./edwards)*/ + null; +}), Uh = Gc(function(t, e) { + var r = e, n = Ii.assert; + function i(a) { + a.type === "short" ? this.curve = new jh.short(a) : a.type === "edwards" ? this.curve = new jh.edwards(a) : this.curve = new jh.mont(a), this.g = this.curve.g, this.n = this.curve.n, this.hash = a.hash, n(this.g.validate(), "Invalid curve"), n(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); + } + r.PresetCurve = i; + function s(a, f) { + Object.defineProperty(r, a, { + configurable: !0, + enumerable: !0, + get: function() { + var u = new i(f); + return Object.defineProperty(r, a, { + configurable: !0, + enumerable: !0, + value: u + }), u; + } + }); + } + s("p192", { + type: "short", + prime: "p192", + p: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff", + a: "ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc", + b: "64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1", + n: "ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831", + hash: Xs.sha256, + gRed: !1, + g: [ + "188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012", + "07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811" + ] + }), s("p224", { + type: "short", + prime: "p224", + p: "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001", + a: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe", + b: "b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4", + n: "ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d", + hash: Xs.sha256, + gRed: !1, + g: [ + "b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21", + "bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34" + ] + }), s("p256", { + type: "short", + prime: null, + p: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff", + a: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc", + b: "5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b", + n: "ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551", + hash: Xs.sha256, + gRed: !1, + g: [ + "6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296", + "4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5" + ] + }), s("p384", { + type: "short", + prime: null, + p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff", + a: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc", + b: "b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef", + n: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973", + hash: Xs.sha384, + gRed: !1, + g: [ + "aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7", + "3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f" + ] + }), s("p521", { + type: "short", + prime: null, + p: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff", + a: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc", + b: "00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00", + n: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409", + hash: Xs.sha512, + gRed: !1, + g: [ + "000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66", + "00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650" + ] + }), s("curve25519", { + type: "mont", + prime: "p25519", + p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed", + a: "76d06", + b: "1", + n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", + hash: Xs.sha256, + gRed: !1, + g: [ + "9" + ] + }), s("ed25519", { + type: "edwards", + prime: "p25519", + p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed", + a: "-1", + c: "1", + // -121665 * (121666^(-1)) (mod P) + d: "52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3", + n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", + hash: Xs.sha256, + gRed: !1, + g: [ + "216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a", + // 4/5 + "6666666666666666666666666666666666666666666666666666666666666658" + ] + }); + var o; + try { + o = /*RicMoo:ethers:require(./precomputed/secp256k1)*/ + null.crash(); + } catch { + o = void 0; + } + s("secp256k1", { + type: "short", + prime: "k256", + p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f", + a: "0", + b: "7", + n: "ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141", + h: "1", + hash: Xs.sha256, + // Precomputed endomorphism + beta: "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee", + lambda: "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72", + basis: [ + { + a: "3086d221a7d46bcde86c90e49284eb15", + b: "-e4437ed6010e88286f547fa90abfe4c3" + }, + { + a: "114ca50f7a8e2f3f657c1108d9d44cfd8", + b: "3086d221a7d46bcde86c90e49284eb15" + } + ], + gRed: !1, + g: [ + "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", + "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", + o + ] + }); +}); +function Ko(t) { + if (!(this instanceof Ko)) + return new Ko(t); + this.hash = t.hash, this.predResist = !!t.predResist, this.outLen = this.hash.outSize, this.minEntropy = t.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null; + var e = as.toArray(t.entropy, t.entropyEnc || "hex"), r = as.toArray(t.nonce, t.nonceEnc || "hex"), n = as.toArray(t.pers, t.persEnc || "hex"); + v1( + e.length >= this.minEntropy / 8, + "Not enough entropy. Minimum is: " + this.minEntropy + " bits" + ), this._init(e, r, n); +} +var g8 = Ko; +Ko.prototype._init = function(e, r, n) { + var i = e.concat(r).concat(n); + this.K = new Array(this.outLen / 8), this.V = new Array(this.outLen / 8); + for (var s = 0; s < this.V.length; s++) + this.K[s] = 0, this.V[s] = 1; + this._update(i), this._reseed = 1, this.reseedInterval = 281474976710656; +}; +Ko.prototype._hmac = function() { + return new Xs.hmac(this.hash, this.K); +}; +Ko.prototype._update = function(e) { + var r = this._hmac().update(this.V).update([0]); + e && (r = r.update(e)), this.K = r.digest(), this.V = this._hmac().update(this.V).digest(), e && (this.K = this._hmac().update(this.V).update([1]).update(e).digest(), this.V = this._hmac().update(this.V).digest()); +}; +Ko.prototype.reseed = function(e, r, n, i) { + typeof r != "string" && (i = n, n = r, r = null), e = as.toArray(e, r), n = as.toArray(n, i), v1( + e.length >= this.minEntropy / 8, + "Not enough entropy. Minimum is: " + this.minEntropy + " bits" + ), this._update(e.concat(n || [])), this._reseed = 1; +}; +Ko.prototype.generate = function(e, r, n, i) { + if (this._reseed > this.reseedInterval) + throw new Error("Reseed is required"); + typeof r != "string" && (i = n, n = r, r = null), n && (n = as.toArray(n, i || "hex"), this._update(n)); + for (var s = []; s.length < e; ) + this.V = this._hmac().update(this.V).digest(), s = s.concat(this.V); + var o = s.slice(0, e); + return this._update(n), this._reseed++, as.encode(o, r); +}; +var rv = Ii.assert; +function Vn(t, e) { + this.ec = t, this.priv = null, this.pub = null, e.priv && this._importPrivate(e.priv, e.privEnc), e.pub && this._importPublic(e.pub, e.pubEnc); +} +var y1 = Vn; +Vn.fromPublic = function(e, r, n) { + return r instanceof Vn ? r : new Vn(e, { + pub: r, + pubEnc: n + }); +}; +Vn.fromPrivate = function(e, r, n) { + return r instanceof Vn ? r : new Vn(e, { + priv: r, + privEnc: n + }); +}; +Vn.prototype.validate = function() { + var e = this.getPublic(); + return e.isInfinity() ? { result: !1, reason: "Invalid public key" } : e.validate() ? e.mul(this.ec.curve.n).isInfinity() ? { result: !0, reason: null } : { result: !1, reason: "Public key * N != O" } : { result: !1, reason: "Public key is not a point" }; +}; +Vn.prototype.getPublic = function(e, r) { + return typeof e == "string" && (r = e, e = null), this.pub || (this.pub = this.ec.g.mul(this.priv)), r ? this.pub.encode(r, e) : this.pub; +}; +Vn.prototype.getPrivate = function(e) { + return e === "hex" ? this.priv.toString(16, 2) : this.priv; +}; +Vn.prototype._importPrivate = function(e, r) { + this.priv = new or(e, r || 16), this.priv = this.priv.umod(this.ec.curve.n); +}; +Vn.prototype._importPublic = function(e, r) { + if (e.x || e.y) { + this.ec.curve.type === "mont" ? rv(e.x, "Need x coordinate") : (this.ec.curve.type === "short" || this.ec.curve.type === "edwards") && rv(e.x && e.y, "Need both x and y coordinate"), this.pub = this.ec.curve.point(e.x, e.y); + return; + } + this.pub = this.ec.curve.decodePoint(e, r); +}; +Vn.prototype.derive = function(e) { + return e.validate() || rv(e.validate(), "public point not validated"), e.mul(this.priv).getX(); +}; +Vn.prototype.sign = function(e, r, n) { + return this.ec.sign(e, this, r, n); +}; +Vn.prototype.verify = function(e, r) { + return this.ec.verify(e, r, this); +}; +Vn.prototype.inspect = function() { + return ""; +}; +var FB = Ii.assert; +function Zd(t, e) { + if (t instanceof Zd) + return t; + this._importDER(t, e) || (FB(t.r && t.s, "Signature without r or s"), this.r = new or(t.r, 16), this.s = new or(t.s, 16), t.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = t.recoveryParam); +} +var Qd = Zd; +function jB() { + this.place = 0; +} +function Eg(t, e) { + var r = t[e.place++]; + if (!(r & 128)) + return r; + var n = r & 15; + if (n === 0 || n > 4) + return !1; + for (var i = 0, s = 0, o = e.place; s < n; s++, o++) + i <<= 8, i |= t[o], i >>>= 0; + return i <= 127 ? !1 : (e.place = o, i); +} +function vx(t) { + for (var e = 0, r = t.length - 1; !t[e] && !(t[e + 1] & 128) && e < r; ) + e++; + return e === 0 ? t : t.slice(e); +} +Zd.prototype._importDER = function(e, r) { + e = Ii.toArray(e, r); + var n = new jB(); + if (e[n.place++] !== 48) + return !1; + var i = Eg(e, n); + if (i === !1 || i + n.place !== e.length || e[n.place++] !== 2) + return !1; + var s = Eg(e, n); + if (s === !1) + return !1; + var o = e.slice(n.place, s + n.place); + if (n.place += s, e[n.place++] !== 2) + return !1; + var a = Eg(e, n); + if (a === !1 || e.length !== a + n.place) + return !1; + var f = e.slice(n.place, a + n.place); + if (o[0] === 0) + if (o[1] & 128) + o = o.slice(1); + else + return !1; + if (f[0] === 0) + if (f[1] & 128) + f = f.slice(1); + else + return !1; + return this.r = new or(o), this.s = new or(f), this.recoveryParam = null, !0; +}; +function Sg(t, e) { + if (e < 128) { + t.push(e); + return; + } + var r = 1 + (Math.log(e) / Math.LN2 >>> 3); + for (t.push(r | 128); --r; ) + t.push(e >>> (r << 3) & 255); + t.push(e); +} +Zd.prototype.toDER = function(e) { + var r = this.r.toArray(), n = this.s.toArray(); + for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = vx(r), n = vx(n); !n[0] && !(n[1] & 128); ) + n = n.slice(1); + var i = [2]; + Sg(i, r.length), i = i.concat(r), i.push(2), Sg(i, n.length); + var s = i.concat(n), o = [48]; + return Sg(o, s.length), o = o.concat(s), Ii.encode(o, e); +}; +var UB = ( + /*RicMoo:ethers:require(brorand)*/ + (function() { + throw new Error("unsupported"); + }) +), m8 = Ii.assert; +function zi(t) { + if (!(this instanceof zi)) + return new zi(t); + typeof t == "string" && (m8( + Object.prototype.hasOwnProperty.call(Uh, t), + "Unknown curve " + t + ), t = Uh[t]), t instanceof Uh.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; +} +var qB = zi; +zi.prototype.keyPair = function(e) { + return new y1(this, e); +}; +zi.prototype.keyFromPrivate = function(e, r) { + return y1.fromPrivate(this, e, r); +}; +zi.prototype.keyFromPublic = function(e, r) { + return y1.fromPublic(this, e, r); +}; +zi.prototype.genKeyPair = function(e) { + e || (e = {}); + for (var r = new g8({ + hash: this.hash, + pers: e.pers, + persEnc: e.persEnc || "utf8", + entropy: e.entropy || UB(this.hash.hmacStrength), + entropyEnc: e.entropy && e.entropyEnc || "utf8", + nonce: this.n.toArray() + }), n = this.n.byteLength(), i = this.n.sub(new or(2)); ; ) { + var s = new or(r.generate(n)); + if (!(s.cmp(i) > 0)) + return s.iaddn(1), this.keyFromPrivate(s); + } +}; +zi.prototype._truncateToN = function(e, r) { + var n = e.byteLength() * 8 - this.n.bitLength(); + return n > 0 && (e = e.ushrn(n)), !r && e.cmp(this.n) >= 0 ? e.sub(this.n) : e; +}; +zi.prototype.sign = function(e, r, n, i) { + typeof n == "object" && (i = n, n = null), i || (i = {}), r = this.keyFromPrivate(r, n), e = this._truncateToN(new or(e, 16)); + for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), f = new g8({ + hash: this.hash, + entropy: o, + nonce: a, + pers: i.pers, + persEnc: i.persEnc || "utf8" + }), u = this.n.sub(new or(1)), h = 0; ; h++) { + var g = i.k ? i.k(h) : new or(f.generate(this.n.byteLength())); + if (g = this._truncateToN(g, !0), !(g.cmpn(1) <= 0 || g.cmp(u) >= 0)) { + var v = this.g.mul(g); + if (!v.isInfinity()) { + var x = v.getX(), S = x.umod(this.n); + if (S.cmpn(0) !== 0) { + var C = g.invm(this.n).mul(S.mul(r.getPrivate()).iadd(e)); + if (C = C.umod(this.n), C.cmpn(0) !== 0) { + var D = (v.getY().isOdd() ? 1 : 0) | (x.cmp(S) !== 0 ? 2 : 0); + return i.canonical && C.cmp(this.nh) > 0 && (C = this.n.sub(C), D ^= 1), new Qd({ r: S, s: C, recoveryParam: D }); + } + } + } + } + } +}; +zi.prototype.verify = function(e, r, n, i) { + e = this._truncateToN(new or(e, 16)), n = this.keyFromPublic(n, i), r = new Qd(r, "hex"); + var s = r.r, o = r.s; + if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0 || o.cmpn(1) < 0 || o.cmp(this.n) >= 0) + return !1; + var a = o.invm(this.n), f = a.mul(e).umod(this.n), u = a.mul(s).umod(this.n), h; + return this.curve._maxwellTrick ? (h = this.g.jmulAdd(f, n.getPublic(), u), h.isInfinity() ? !1 : h.eqXToP(s)) : (h = this.g.mulAdd(f, n.getPublic(), u), h.isInfinity() ? !1 : h.getX().umod(this.n).cmp(s) === 0); +}; +zi.prototype.recoverPubKey = function(t, e, r, n) { + m8((3 & r) === r, "The recovery param is more than two bits"), e = new Qd(e, n); + var i = this.n, s = new or(t), o = e.r, a = e.s, f = r & 1, u = r >> 1; + if (o.cmp(this.curve.p.umod(this.curve.n)) >= 0 && u) + throw new Error("Unable to find sencond key candinate"); + u ? o = this.curve.pointFromX(o.add(this.curve.n), f) : o = this.curve.pointFromX(o, f); + var h = e.r.invm(i), g = i.sub(s).mul(h).umod(i), v = a.mul(h).umod(i); + return this.g.mulAdd(g, o, v); +}; +zi.prototype.getKeyRecoveryParam = function(t, e, r, n) { + if (e = new Qd(e, n), e.recoveryParam !== null) + return e.recoveryParam; + for (var i = 0; i < 4; i++) { + var s; + try { + s = this.recoverPubKey(t, e, i); + } catch { + continue; + } + if (s.eq(r)) + return i; + } + throw new Error("Unable to find valid recovery factor"); +}; +var zB = Gc(function(t, e) { + var r = e; + r.version = "6.5.4", r.utils = Ii, r.rand = /*RicMoo:ethers:require(brorand)*/ + (function() { + throw new Error("unsupported"); + }), r.curve = jh, r.curves = Uh, r.ec = qB, r.eddsa = /*RicMoo:ethers:require(./elliptic/eddsa)*/ + null; +}), HB = zB.ec; +const WB = "signing-key/5.7.0", nv = new Yr(WB); +let Ag = null; +function Do() { + return Ag || (Ag = new HB("secp256k1")), Ag; +} +class KB { + constructor(e) { + Tu(this, "curve", "secp256k1"), Tu(this, "privateKey", _i(e)), pB(this.privateKey) !== 32 && nv.throwArgumentError("invalid private key", "privateKey", "[[ REDACTED ]]"); + const r = Do().keyFromPrivate(bn(this.privateKey)); + Tu(this, "publicKey", "0x" + r.getPublic(!1, "hex")), Tu(this, "compressedPublicKey", "0x" + r.getPublic(!0, "hex")), Tu(this, "_isSigningKey", !0); + } + _addPoint(e) { + const r = Do().keyFromPublic(bn(this.publicKey)), n = Do().keyFromPublic(bn(e)); + return "0x" + r.pub.add(n.pub).encodeCompressed("hex"); + } + signDigest(e) { + const r = Do().keyFromPrivate(bn(this.privateKey)), n = bn(e); + n.length !== 32 && nv.throwArgumentError("bad digest length", "digest", e); + const i = r.sign(n, { canonical: !0 }); + return u8({ + recoveryParam: i.recoveryParam, + r: Oc("0x" + i.r.toString(16), 32), + s: Oc("0x" + i.s.toString(16), 32) + }); + } + computeSharedSecret(e) { + const r = Do().keyFromPrivate(bn(this.privateKey)), n = Do().keyFromPublic(bn(v8(e))); + return Oc("0x" + r.derive(n.getPublic()).toString(16), 32); + } + static isSigningKey(e) { + return !!(e && e._isSigningKey); + } +} +function VB(t, e) { + const r = u8(e), n = { r: bn(r.r), s: bn(r.s) }; + return "0x" + Do().recoverPubKey(bn(t), n, r.recoveryParam).encode("hex", !1); +} +function v8(t, e) { + const r = bn(t); + return r.length === 32 ? new KB(r).publicKey : r.length === 33 ? "0x" + Do().keyFromPublic(r).getPublic(!1, "hex") : r.length === 65 ? _i(r) : nv.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); +} +var bx; +(function(t) { + t[t.legacy = 0] = "legacy", t[t.eip2930 = 1] = "eip2930", t[t.eip1559 = 2] = "eip1559"; +})(bx || (bx = {})); +function GB(t) { + const e = v8(t); + return MB(Z2(g1(Z2(e, 1)), 12)); +} +function YB(t, e) { + return GB(VB(bn(t), e)); +} +var Pg = {}, Du = {}, yx; +function JB() { + if (yx) return Du; + yx = 1, Object.defineProperty(Du, "__esModule", { value: !0 }); + var t = el(), e = ls(), r = 20; + function n(a, f, u) { + for (var h = 1634760805, g = 857760878, v = 2036477234, x = 1797285236, S = u[3] << 24 | u[2] << 16 | u[1] << 8 | u[0], C = u[7] << 24 | u[6] << 16 | u[5] << 8 | u[4], D = u[11] << 24 | u[10] << 16 | u[9] << 8 | u[8], $ = u[15] << 24 | u[14] << 16 | u[13] << 8 | u[12], N = u[19] << 24 | u[18] << 16 | u[17] << 8 | u[16], z = u[23] << 24 | u[22] << 16 | u[21] << 8 | u[20], k = u[27] << 24 | u[26] << 16 | u[25] << 8 | u[24], B = u[31] << 24 | u[30] << 16 | u[29] << 8 | u[28], U = f[3] << 24 | f[2] << 16 | f[1] << 8 | f[0], R = f[7] << 24 | f[6] << 16 | f[5] << 8 | f[4], W = f[11] << 24 | f[10] << 16 | f[9] << 8 | f[8], J = f[15] << 24 | f[14] << 16 | f[13] << 8 | f[12], ne = h, K = g, E = v, b = x, l = S, p = C, m = D, w = $, P = N, _ = z, y = k, M = B, I = U, q = R, ce = W, L = J, oe = 0; oe < r; oe += 2) + ne = ne + l | 0, I ^= ne, I = I >>> 16 | I << 16, P = P + I | 0, l ^= P, l = l >>> 20 | l << 12, K = K + p | 0, q ^= K, q = q >>> 16 | q << 16, _ = _ + q | 0, p ^= _, p = p >>> 20 | p << 12, E = E + m | 0, ce ^= E, ce = ce >>> 16 | ce << 16, y = y + ce | 0, m ^= y, m = m >>> 20 | m << 12, b = b + w | 0, L ^= b, L = L >>> 16 | L << 16, M = M + L | 0, w ^= M, w = w >>> 20 | w << 12, E = E + m | 0, ce ^= E, ce = ce >>> 24 | ce << 8, y = y + ce | 0, m ^= y, m = m >>> 25 | m << 7, b = b + w | 0, L ^= b, L = L >>> 24 | L << 8, M = M + L | 0, w ^= M, w = w >>> 25 | w << 7, K = K + p | 0, q ^= K, q = q >>> 24 | q << 8, _ = _ + q | 0, p ^= _, p = p >>> 25 | p << 7, ne = ne + l | 0, I ^= ne, I = I >>> 24 | I << 8, P = P + I | 0, l ^= P, l = l >>> 25 | l << 7, ne = ne + p | 0, L ^= ne, L = L >>> 16 | L << 16, y = y + L | 0, p ^= y, p = p >>> 20 | p << 12, K = K + m | 0, I ^= K, I = I >>> 16 | I << 16, M = M + I | 0, m ^= M, m = m >>> 20 | m << 12, E = E + w | 0, q ^= E, q = q >>> 16 | q << 16, P = P + q | 0, w ^= P, w = w >>> 20 | w << 12, b = b + l | 0, ce ^= b, ce = ce >>> 16 | ce << 16, _ = _ + ce | 0, l ^= _, l = l >>> 20 | l << 12, E = E + w | 0, q ^= E, q = q >>> 24 | q << 8, P = P + q | 0, w ^= P, w = w >>> 25 | w << 7, b = b + l | 0, ce ^= b, ce = ce >>> 24 | ce << 8, _ = _ + ce | 0, l ^= _, l = l >>> 25 | l << 7, K = K + m | 0, I ^= K, I = I >>> 24 | I << 8, M = M + I | 0, m ^= M, m = m >>> 25 | m << 7, ne = ne + p | 0, L ^= ne, L = L >>> 24 | L << 8, y = y + L | 0, p ^= y, p = p >>> 25 | p << 7; + t.writeUint32LE(ne + h | 0, a, 0), t.writeUint32LE(K + g | 0, a, 4), t.writeUint32LE(E + v | 0, a, 8), t.writeUint32LE(b + x | 0, a, 12), t.writeUint32LE(l + S | 0, a, 16), t.writeUint32LE(p + C | 0, a, 20), t.writeUint32LE(m + D | 0, a, 24), t.writeUint32LE(w + $ | 0, a, 28), t.writeUint32LE(P + N | 0, a, 32), t.writeUint32LE(_ + z | 0, a, 36), t.writeUint32LE(y + k | 0, a, 40), t.writeUint32LE(M + B | 0, a, 44), t.writeUint32LE(I + U | 0, a, 48), t.writeUint32LE(q + R | 0, a, 52), t.writeUint32LE(ce + W | 0, a, 56), t.writeUint32LE(L + J | 0, a, 60); + } + function i(a, f, u, h, g) { + if (g === void 0 && (g = 0), a.length !== 32) + throw new Error("ChaCha: key size must be 32 bytes"); + if (h.length < u.length) + throw new Error("ChaCha: destination is shorter than source"); + var v, x; + if (g === 0) { + if (f.length !== 8 && f.length !== 12) + throw new Error("ChaCha nonce must be 8 or 12 bytes"); + v = new Uint8Array(16), x = v.length - f.length, v.set(f, x); + } else { + if (f.length !== 16) + throw new Error("ChaCha nonce with counter must be 16 bytes"); + v = f, x = g; + } + for (var S = new Uint8Array(64), C = 0; C < u.length; C += 64) { + n(S, v, a); + for (var D = C; D < C + 64 && D < u.length; D++) + h[D] = u[D] ^ S[D - C]; + o(v, 0, x); + } + return e.wipe(S), g === 0 && e.wipe(v), h; + } + Du.streamXOR = i; + function s(a, f, u, h) { + return h === void 0 && (h = 0), e.wipe(u), i(a, f, u, u, h); + } + Du.stream = s; + function o(a, f, u) { + for (var h = 1; u--; ) + h = h + (a[f] & 255) | 0, a[f] = h & 255, h >>>= 8, f++; + if (h > 0) + throw new Error("ChaCha: counter overflow"); + } + return Du; +} +var Mg = {}, pa = {}, wx; +function w1() { + if (wx) return pa; + wx = 1, Object.defineProperty(pa, "__esModule", { value: !0 }); + function t(i, s, o) { + return ~(i - 1) & s | i - 1 & o; + } + pa.select = t; + function e(i, s) { + return (i | 0) - (s | 0) - 1 >>> 31 & 1; + } + pa.lessOrEqual = e; + function r(i, s) { + if (i.length !== s.length) + return 0; + for (var o = 0, a = 0; a < i.length; a++) + o |= i[a] ^ s[a]; + return 1 & o - 1 >>> 8; + } + pa.compare = r; + function n(i, s) { + return i.length === 0 || s.length === 0 ? !1 : r(i, s) !== 0; + } + return pa.equal = n, pa; +} +var xx; +function XB() { + return xx || (xx = 1, (function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }); + var e = w1(), r = ls(); + t.DIGEST_LENGTH = 16; + var n = ( + /** @class */ + (function() { + function o(a) { + this.digestLength = t.DIGEST_LENGTH, this._buffer = new Uint8Array(16), this._r = new Uint16Array(10), this._h = new Uint16Array(10), this._pad = new Uint16Array(8), this._leftover = 0, this._fin = 0, this._finished = !1; + var f = a[0] | a[1] << 8; + this._r[0] = f & 8191; + var u = a[2] | a[3] << 8; + this._r[1] = (f >>> 13 | u << 3) & 8191; + var h = a[4] | a[5] << 8; + this._r[2] = (u >>> 10 | h << 6) & 7939; + var g = a[6] | a[7] << 8; + this._r[3] = (h >>> 7 | g << 9) & 8191; + var v = a[8] | a[9] << 8; + this._r[4] = (g >>> 4 | v << 12) & 255, this._r[5] = v >>> 1 & 8190; + var x = a[10] | a[11] << 8; + this._r[6] = (v >>> 14 | x << 2) & 8191; + var S = a[12] | a[13] << 8; + this._r[7] = (x >>> 11 | S << 5) & 8065; + var C = a[14] | a[15] << 8; + this._r[8] = (S >>> 8 | C << 8) & 8191, this._r[9] = C >>> 5 & 127, this._pad[0] = a[16] | a[17] << 8, this._pad[1] = a[18] | a[19] << 8, this._pad[2] = a[20] | a[21] << 8, this._pad[3] = a[22] | a[23] << 8, this._pad[4] = a[24] | a[25] << 8, this._pad[5] = a[26] | a[27] << 8, this._pad[6] = a[28] | a[29] << 8, this._pad[7] = a[30] | a[31] << 8; + } + return o.prototype._blocks = function(a, f, u) { + for (var h = this._fin ? 0 : 2048, g = this._h[0], v = this._h[1], x = this._h[2], S = this._h[3], C = this._h[4], D = this._h[5], $ = this._h[6], N = this._h[7], z = this._h[8], k = this._h[9], B = this._r[0], U = this._r[1], R = this._r[2], W = this._r[3], J = this._r[4], ne = this._r[5], K = this._r[6], E = this._r[7], b = this._r[8], l = this._r[9]; u >= 16; ) { + var p = a[f + 0] | a[f + 1] << 8; + g += p & 8191; + var m = a[f + 2] | a[f + 3] << 8; + v += (p >>> 13 | m << 3) & 8191; + var w = a[f + 4] | a[f + 5] << 8; + x += (m >>> 10 | w << 6) & 8191; + var P = a[f + 6] | a[f + 7] << 8; + S += (w >>> 7 | P << 9) & 8191; + var _ = a[f + 8] | a[f + 9] << 8; + C += (P >>> 4 | _ << 12) & 8191, D += _ >>> 1 & 8191; + var y = a[f + 10] | a[f + 11] << 8; + $ += (_ >>> 14 | y << 2) & 8191; + var M = a[f + 12] | a[f + 13] << 8; + N += (y >>> 11 | M << 5) & 8191; + var I = a[f + 14] | a[f + 15] << 8; + z += (M >>> 8 | I << 8) & 8191, k += I >>> 5 | h; + var q = 0, ce = q; + ce += g * B, ce += v * (5 * l), ce += x * (5 * b), ce += S * (5 * E), ce += C * (5 * K), q = ce >>> 13, ce &= 8191, ce += D * (5 * ne), ce += $ * (5 * J), ce += N * (5 * W), ce += z * (5 * R), ce += k * (5 * U), q += ce >>> 13, ce &= 8191; + var L = q; + L += g * U, L += v * B, L += x * (5 * l), L += S * (5 * b), L += C * (5 * E), q = L >>> 13, L &= 8191, L += D * (5 * K), L += $ * (5 * ne), L += N * (5 * J), L += z * (5 * W), L += k * (5 * R), q += L >>> 13, L &= 8191; + var oe = q; + oe += g * R, oe += v * U, oe += x * B, oe += S * (5 * l), oe += C * (5 * b), q = oe >>> 13, oe &= 8191, oe += D * (5 * E), oe += $ * (5 * K), oe += N * (5 * ne), oe += z * (5 * J), oe += k * (5 * W), q += oe >>> 13, oe &= 8191; + var Q = q; + Q += g * W, Q += v * R, Q += x * U, Q += S * B, Q += C * (5 * l), q = Q >>> 13, Q &= 8191, Q += D * (5 * b), Q += $ * (5 * E), Q += N * (5 * K), Q += z * (5 * ne), Q += k * (5 * J), q += Q >>> 13, Q &= 8191; + var X = q; + X += g * J, X += v * W, X += x * R, X += S * U, X += C * B, q = X >>> 13, X &= 8191, X += D * (5 * l), X += $ * (5 * b), X += N * (5 * E), X += z * (5 * K), X += k * (5 * ne), q += X >>> 13, X &= 8191; + var ee = q; + ee += g * ne, ee += v * J, ee += x * W, ee += S * R, ee += C * U, q = ee >>> 13, ee &= 8191, ee += D * B, ee += $ * (5 * l), ee += N * (5 * b), ee += z * (5 * E), ee += k * (5 * K), q += ee >>> 13, ee &= 8191; + var O = q; + O += g * K, O += v * ne, O += x * J, O += S * W, O += C * R, q = O >>> 13, O &= 8191, O += D * U, O += $ * B, O += N * (5 * l), O += z * (5 * b), O += k * (5 * E), q += O >>> 13, O &= 8191; + var Z = q; + Z += g * E, Z += v * K, Z += x * ne, Z += S * J, Z += C * W, q = Z >>> 13, Z &= 8191, Z += D * R, Z += $ * U, Z += N * B, Z += z * (5 * l), Z += k * (5 * b), q += Z >>> 13, Z &= 8191; + var re = q; + re += g * b, re += v * E, re += x * K, re += S * ne, re += C * J, q = re >>> 13, re &= 8191, re += D * W, re += $ * R, re += N * U, re += z * B, re += k * (5 * l), q += re >>> 13, re &= 8191; + var he = q; + he += g * l, he += v * b, he += x * E, he += S * K, he += C * ne, q = he >>> 13, he &= 8191, he += D * J, he += $ * W, he += N * R, he += z * U, he += k * B, q += he >>> 13, he &= 8191, q = (q << 2) + q | 0, q = q + ce | 0, ce = q & 8191, q = q >>> 13, L += q, g = ce, v = L, x = oe, S = Q, C = X, D = ee, $ = O, N = Z, z = re, k = he, f += 16, u -= 16; + } + this._h[0] = g, this._h[1] = v, this._h[2] = x, this._h[3] = S, this._h[4] = C, this._h[5] = D, this._h[6] = $, this._h[7] = N, this._h[8] = z, this._h[9] = k; + }, o.prototype.finish = function(a, f) { + f === void 0 && (f = 0); + var u = new Uint16Array(10), h, g, v, x; + if (this._leftover) { + for (x = this._leftover, this._buffer[x++] = 1; x < 16; x++) + this._buffer[x] = 0; + this._fin = 1, this._blocks(this._buffer, 0, 16); + } + for (h = this._h[1] >>> 13, this._h[1] &= 8191, x = 2; x < 10; x++) + this._h[x] += h, h = this._h[x] >>> 13, this._h[x] &= 8191; + for (this._h[0] += h * 5, h = this._h[0] >>> 13, this._h[0] &= 8191, this._h[1] += h, h = this._h[1] >>> 13, this._h[1] &= 8191, this._h[2] += h, u[0] = this._h[0] + 5, h = u[0] >>> 13, u[0] &= 8191, x = 1; x < 10; x++) + u[x] = this._h[x] + h, h = u[x] >>> 13, u[x] &= 8191; + for (u[9] -= 8192, g = (h ^ 1) - 1, x = 0; x < 10; x++) + u[x] &= g; + for (g = ~g, x = 0; x < 10; x++) + this._h[x] = this._h[x] & g | u[x]; + for (this._h[0] = (this._h[0] | this._h[1] << 13) & 65535, this._h[1] = (this._h[1] >>> 3 | this._h[2] << 10) & 65535, this._h[2] = (this._h[2] >>> 6 | this._h[3] << 7) & 65535, this._h[3] = (this._h[3] >>> 9 | this._h[4] << 4) & 65535, this._h[4] = (this._h[4] >>> 12 | this._h[5] << 1 | this._h[6] << 14) & 65535, this._h[5] = (this._h[6] >>> 2 | this._h[7] << 11) & 65535, this._h[6] = (this._h[7] >>> 5 | this._h[8] << 8) & 65535, this._h[7] = (this._h[8] >>> 8 | this._h[9] << 5) & 65535, v = this._h[0] + this._pad[0], this._h[0] = v & 65535, x = 1; x < 8; x++) + v = (this._h[x] + this._pad[x] | 0) + (v >>> 16) | 0, this._h[x] = v & 65535; + return a[f + 0] = this._h[0] >>> 0, a[f + 1] = this._h[0] >>> 8, a[f + 2] = this._h[1] >>> 0, a[f + 3] = this._h[1] >>> 8, a[f + 4] = this._h[2] >>> 0, a[f + 5] = this._h[2] >>> 8, a[f + 6] = this._h[3] >>> 0, a[f + 7] = this._h[3] >>> 8, a[f + 8] = this._h[4] >>> 0, a[f + 9] = this._h[4] >>> 8, a[f + 10] = this._h[5] >>> 0, a[f + 11] = this._h[5] >>> 8, a[f + 12] = this._h[6] >>> 0, a[f + 13] = this._h[6] >>> 8, a[f + 14] = this._h[7] >>> 0, a[f + 15] = this._h[7] >>> 8, this._finished = !0, this; + }, o.prototype.update = function(a) { + var f = 0, u = a.length, h; + if (this._leftover) { + h = 16 - this._leftover, h > u && (h = u); + for (var g = 0; g < h; g++) + this._buffer[this._leftover + g] = a[f + g]; + if (u -= h, f += h, this._leftover += h, this._leftover < 16) + return this; + this._blocks(this._buffer, 0, 16), this._leftover = 0; + } + if (u >= 16 && (h = u - u % 16, this._blocks(a, f, h), f += h, u -= h), u) { + for (var g = 0; g < u; g++) + this._buffer[this._leftover + g] = a[f + g]; + this._leftover += u; + } + return this; + }, o.prototype.digest = function() { + if (this._finished) + throw new Error("Poly1305 was finished"); + var a = new Uint8Array(16); + return this.finish(a), a; + }, o.prototype.clean = function() { + return r.wipe(this._buffer), r.wipe(this._r), r.wipe(this._h), r.wipe(this._pad), this._leftover = 0, this._fin = 0, this._finished = !0, this; + }, o; + })() + ); + t.Poly1305 = n; + function i(o, a) { + var f = new n(o); + f.update(a); + var u = f.digest(); + return f.clean(), u; + } + t.oneTimeAuth = i; + function s(o, a) { + return o.length !== t.DIGEST_LENGTH || a.length !== t.DIGEST_LENGTH ? !1 : e.equal(o, a); + } + t.equal = s; + })(Mg)), Mg; +} +var _x; +function ZB() { + return _x || (_x = 1, (function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }); + var e = JB(), r = XB(), n = ls(), i = el(), s = w1(); + t.KEY_LENGTH = 32, t.NONCE_LENGTH = 12, t.TAG_LENGTH = 16; + var o = new Uint8Array(16), a = ( + /** @class */ + (function() { + function f(u) { + if (this.nonceLength = t.NONCE_LENGTH, this.tagLength = t.TAG_LENGTH, u.length !== t.KEY_LENGTH) + throw new Error("ChaCha20Poly1305 needs 32-byte key"); + this._key = new Uint8Array(u); + } + return f.prototype.seal = function(u, h, g, v) { + if (u.length > 16) + throw new Error("ChaCha20Poly1305: incorrect nonce length"); + var x = new Uint8Array(16); + x.set(u, x.length - u.length); + var S = new Uint8Array(32); + e.stream(this._key, x, S, 4); + var C = h.length + this.tagLength, D; + if (v) { + if (v.length !== C) + throw new Error("ChaCha20Poly1305: incorrect destination length"); + D = v; + } else + D = new Uint8Array(C); + return e.streamXOR(this._key, x, h, D, 4), this._authenticate(D.subarray(D.length - this.tagLength, D.length), S, D.subarray(0, D.length - this.tagLength), g), n.wipe(x), D; + }, f.prototype.open = function(u, h, g, v) { + if (u.length > 16) + throw new Error("ChaCha20Poly1305: incorrect nonce length"); + if (h.length < this.tagLength) + return null; + var x = new Uint8Array(16); + x.set(u, x.length - u.length); + var S = new Uint8Array(32); + e.stream(this._key, x, S, 4); + var C = new Uint8Array(this.tagLength); + if (this._authenticate(C, S, h.subarray(0, h.length - this.tagLength), g), !s.equal(C, h.subarray(h.length - this.tagLength, h.length))) + return null; + var D = h.length - this.tagLength, $; + if (v) { + if (v.length !== D) + throw new Error("ChaCha20Poly1305: incorrect destination length"); + $ = v; + } else + $ = new Uint8Array(D); + return e.streamXOR(this._key, x, h.subarray(0, h.length - this.tagLength), $, 4), n.wipe(x), $; + }, f.prototype.clean = function() { + return n.wipe(this._key), this; + }, f.prototype._authenticate = function(u, h, g, v) { + var x = new r.Poly1305(h); + v && (x.update(v), v.length % 16 > 0 && x.update(o.subarray(v.length % 16))), x.update(g), g.length % 16 > 0 && x.update(o.subarray(g.length % 16)); + var S = new Uint8Array(8); + v && i.writeUint64LE(v.length, S), x.update(S), i.writeUint64LE(g.length, S), x.update(S); + for (var C = x.digest(), D = 0; D < C.length; D++) + u[D] = C[D]; + x.clean(), n.wipe(C), n.wipe(S); + }, f; + })() + ); + t.ChaCha20Poly1305 = a; + })(Pg)), Pg; +} +var b8 = ZB(), wh = {}, pc = {}, xh = {}, Ex; +function QB() { + if (Ex) return xh; + Ex = 1, Object.defineProperty(xh, "__esModule", { value: !0 }); + function t(e) { + return typeof e.saveState < "u" && typeof e.restoreState < "u" && typeof e.cleanSavedState < "u"; + } + return xh.isSerializableHash = t, xh; +} +var Sx; +function eF() { + if (Sx) return pc; + Sx = 1, Object.defineProperty(pc, "__esModule", { value: !0 }); + var t = QB(), e = w1(), r = ls(), n = ( + /** @class */ + (function() { + function s(o, a) { + this._finished = !1, this._inner = new o(), this._outer = new o(), this.blockSize = this._outer.blockSize, this.digestLength = this._outer.digestLength; + var f = new Uint8Array(this.blockSize); + a.length > this.blockSize ? this._inner.update(a).finish(f).clean() : f.set(a); + for (var u = 0; u < f.length; u++) + f[u] ^= 54; + this._inner.update(f); + for (var u = 0; u < f.length; u++) + f[u] ^= 106; + this._outer.update(f), t.isSerializableHash(this._inner) && t.isSerializableHash(this._outer) && (this._innerKeyedState = this._inner.saveState(), this._outerKeyedState = this._outer.saveState()), r.wipe(f); + } + return s.prototype.reset = function() { + if (!t.isSerializableHash(this._inner) || !t.isSerializableHash(this._outer)) + throw new Error("hmac: can't reset() because hash doesn't implement restoreState()"); + return this._inner.restoreState(this._innerKeyedState), this._outer.restoreState(this._outerKeyedState), this._finished = !1, this; + }, s.prototype.clean = function() { + t.isSerializableHash(this._inner) && this._inner.cleanSavedState(this._innerKeyedState), t.isSerializableHash(this._outer) && this._outer.cleanSavedState(this._outerKeyedState), this._inner.clean(), this._outer.clean(); + }, s.prototype.update = function(o) { + return this._inner.update(o), this; + }, s.prototype.finish = function(o) { + return this._finished ? (this._outer.finish(o), this) : (this._inner.finish(o), this._outer.update(o.subarray(0, this.digestLength)).finish(o), this._finished = !0, this); + }, s.prototype.digest = function() { + var o = new Uint8Array(this.digestLength); + return this.finish(o), o; + }, s.prototype.saveState = function() { + if (!t.isSerializableHash(this._inner)) + throw new Error("hmac: can't saveState() because hash doesn't implement it"); + return this._inner.saveState(); + }, s.prototype.restoreState = function(o) { + if (!t.isSerializableHash(this._inner) || !t.isSerializableHash(this._outer)) + throw new Error("hmac: can't restoreState() because hash doesn't implement it"); + return this._inner.restoreState(o), this._outer.restoreState(this._outerKeyedState), this._finished = !1, this; + }, s.prototype.cleanSavedState = function(o) { + if (!t.isSerializableHash(this._inner)) + throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it"); + this._inner.cleanSavedState(o); + }, s; + })() + ); + pc.HMAC = n; + function i(s, o, a) { + var f = new n(s, o); + f.update(a); + var u = f.digest(); + return f.clean(), u; + } + return pc.hmac = i, pc.equal = e.equal, pc; +} +var Ax; +function tF() { + if (Ax) return wh; + Ax = 1, Object.defineProperty(wh, "__esModule", { value: !0 }); + var t = eF(), e = ls(), r = ( + /** @class */ + (function() { + function n(i, s, o, a) { + o === void 0 && (o = new Uint8Array(0)), this._counter = new Uint8Array(1), this._hash = i, this._info = a; + var f = t.hmac(this._hash, o, s); + this._hmac = new t.HMAC(i, f), this._buffer = new Uint8Array(this._hmac.digestLength), this._bufpos = this._buffer.length; + } + return n.prototype._fillBuffer = function() { + this._counter[0]++; + var i = this._counter[0]; + if (i === 0) + throw new Error("hkdf: cannot expand more"); + this._hmac.reset(), i > 1 && this._hmac.update(this._buffer), this._info && this._hmac.update(this._info), this._hmac.update(this._counter), this._hmac.finish(this._buffer), this._bufpos = 0; + }, n.prototype.expand = function(i) { + for (var s = new Uint8Array(i), o = 0; o < s.length; o++) + this._bufpos === this._buffer.length && this._fillBuffer(), s[o] = this._buffer[this._bufpos++]; + return s; + }, n.prototype.clean = function() { + this._hmac.clean(), e.wipe(this._buffer), e.wipe(this._counter), this._bufpos = 0; + }, n; + })() + ); + return wh.HKDF = r, wh; +} +var rF = tF(), Ig = {}, Px; +function nF() { + return Px || (Px = 1, (function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }); + var e = el(), r = ls(); + t.DIGEST_LENGTH = 32, t.BLOCK_SIZE = 64; + var n = ( + /** @class */ + (function() { + function a() { + this.digestLength = t.DIGEST_LENGTH, this.blockSize = t.BLOCK_SIZE, this._state = new Int32Array(8), this._temp = new Int32Array(64), this._buffer = new Uint8Array(128), this._bufferLength = 0, this._bytesHashed = 0, this._finished = !1, this.reset(); + } + return a.prototype._initState = function() { + this._state[0] = 1779033703, this._state[1] = 3144134277, this._state[2] = 1013904242, this._state[3] = 2773480762, this._state[4] = 1359893119, this._state[5] = 2600822924, this._state[6] = 528734635, this._state[7] = 1541459225; + }, a.prototype.reset = function() { + return this._initState(), this._bufferLength = 0, this._bytesHashed = 0, this._finished = !1, this; + }, a.prototype.clean = function() { + r.wipe(this._buffer), r.wipe(this._temp), this.reset(); + }, a.prototype.update = function(f, u) { + if (u === void 0 && (u = f.length), this._finished) + throw new Error("SHA256: can't update because hash was finished."); + var h = 0; + if (this._bytesHashed += u, this._bufferLength > 0) { + for (; this._bufferLength < this.blockSize && u > 0; ) + this._buffer[this._bufferLength++] = f[h++], u--; + this._bufferLength === this.blockSize && (s(this._temp, this._state, this._buffer, 0, this.blockSize), this._bufferLength = 0); + } + for (u >= this.blockSize && (h = s(this._temp, this._state, f, h, u), u %= this.blockSize); u > 0; ) + this._buffer[this._bufferLength++] = f[h++], u--; + return this; + }, a.prototype.finish = function(f) { + if (!this._finished) { + var u = this._bytesHashed, h = this._bufferLength, g = u / 536870912 | 0, v = u << 3, x = u % 64 < 56 ? 64 : 128; + this._buffer[h] = 128; + for (var S = h + 1; S < x - 8; S++) + this._buffer[S] = 0; + e.writeUint32BE(g, this._buffer, x - 8), e.writeUint32BE(v, this._buffer, x - 4), s(this._temp, this._state, this._buffer, 0, x), this._finished = !0; + } + for (var S = 0; S < this.digestLength / 4; S++) + e.writeUint32BE(this._state[S], f, S * 4); + return this; + }, a.prototype.digest = function() { + var f = new Uint8Array(this.digestLength); + return this.finish(f), f; + }, a.prototype.saveState = function() { + if (this._finished) + throw new Error("SHA256: cannot save finished state"); + return { + state: new Int32Array(this._state), + buffer: this._bufferLength > 0 ? new Uint8Array(this._buffer) : void 0, + bufferLength: this._bufferLength, + bytesHashed: this._bytesHashed + }; + }, a.prototype.restoreState = function(f) { + return this._state.set(f.state), this._bufferLength = f.bufferLength, f.buffer && this._buffer.set(f.buffer), this._bytesHashed = f.bytesHashed, this._finished = !1, this; + }, a.prototype.cleanSavedState = function(f) { + r.wipe(f.state), f.buffer && r.wipe(f.buffer), f.bufferLength = 0, f.bytesHashed = 0; + }, a; + })() + ); + t.SHA256 = n; + var i = new Int32Array([ + 1116352408, + 1899447441, + 3049323471, + 3921009573, + 961987163, + 1508970993, + 2453635748, + 2870763221, + 3624381080, + 310598401, + 607225278, + 1426881987, + 1925078388, + 2162078206, + 2614888103, + 3248222580, + 3835390401, + 4022224774, + 264347078, + 604807628, + 770255983, + 1249150122, + 1555081692, + 1996064986, + 2554220882, + 2821834349, + 2952996808, + 3210313671, + 3336571891, + 3584528711, + 113926993, + 338241895, + 666307205, + 773529912, + 1294757372, + 1396182291, + 1695183700, + 1986661051, + 2177026350, + 2456956037, + 2730485921, + 2820302411, + 3259730800, + 3345764771, + 3516065817, + 3600352804, + 4094571909, + 275423344, + 430227734, + 506948616, + 659060556, + 883997877, + 958139571, + 1322822218, + 1537002063, + 1747873779, + 1955562222, + 2024104815, + 2227730452, + 2361852424, + 2428436474, + 2756734187, + 3204031479, + 3329325298 + ]); + function s(a, f, u, h, g) { + for (; g >= 64; ) { + for (var v = f[0], x = f[1], S = f[2], C = f[3], D = f[4], $ = f[5], N = f[6], z = f[7], k = 0; k < 16; k++) { + var B = h + k * 4; + a[k] = e.readUint32BE(u, B); + } + for (var k = 16; k < 64; k++) { + var U = a[k - 2], R = (U >>> 17 | U << 15) ^ (U >>> 19 | U << 13) ^ U >>> 10; + U = a[k - 15]; + var W = (U >>> 7 | U << 25) ^ (U >>> 18 | U << 14) ^ U >>> 3; + a[k] = (R + a[k - 7] | 0) + (W + a[k - 16] | 0); + } + for (var k = 0; k < 64; k++) { + var R = (((D >>> 6 | D << 26) ^ (D >>> 11 | D << 21) ^ (D >>> 25 | D << 7)) + (D & $ ^ ~D & N) | 0) + (z + (i[k] + a[k] | 0) | 0) | 0, W = ((v >>> 2 | v << 30) ^ (v >>> 13 | v << 19) ^ (v >>> 22 | v << 10)) + (v & x ^ v & S ^ x & S) | 0; + z = N, N = $, $ = D, D = C + R | 0, C = S, S = x, x = v, v = R + W | 0; + } + f[0] += v, f[1] += x, f[2] += S, f[3] += C, f[4] += D, f[5] += $, f[6] += N, f[7] += z, h += 64, g -= 64; + } + return h; + } + function o(a) { + var f = new n(); + f.update(a); + var u = f.digest(); + return f.clean(), u; + } + t.hash = o; + })(Ig)), Ig; +} +var e0 = nF(), Cg = {}, Mx; +function iF() { + return Mx || (Mx = 1, (function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }), t.sharedKey = t.generateKeyPair = t.generateKeyPairFromSeed = t.scalarMultBase = t.scalarMult = t.SHARED_KEY_LENGTH = t.SECRET_KEY_LENGTH = t.PUBLIC_KEY_LENGTH = void 0; + const e = d1(), r = ls(); + t.PUBLIC_KEY_LENGTH = 32, t.SECRET_KEY_LENGTH = 32, t.SHARED_KEY_LENGTH = 32; + function n(k) { + const B = new Float64Array(16); + if (k) + for (let U = 0; U < k.length; U++) + B[U] = k[U]; + return B; + } + const i = new Uint8Array(32); + i[0] = 9; + const s = n([56129, 1]); + function o(k) { + let B = 1; + for (let U = 0; U < 16; U++) { + let R = k[U] + B + 65535; + B = Math.floor(R / 65536), k[U] = R - B * 65536; + } + k[0] += B - 1 + 37 * (B - 1); + } + function a(k, B, U) { + const R = ~(U - 1); + for (let W = 0; W < 16; W++) { + const J = R & (k[W] ^ B[W]); + k[W] ^= J, B[W] ^= J; + } + } + function f(k, B) { + const U = n(), R = n(); + for (let W = 0; W < 16; W++) + R[W] = B[W]; + o(R), o(R), o(R); + for (let W = 0; W < 2; W++) { + U[0] = R[0] - 65517; + for (let ne = 1; ne < 15; ne++) + U[ne] = R[ne] - 65535 - (U[ne - 1] >> 16 & 1), U[ne - 1] &= 65535; + U[15] = R[15] - 32767 - (U[14] >> 16 & 1); + const J = U[15] >> 16 & 1; + U[14] &= 65535, a(R, U, 1 - J); + } + for (let W = 0; W < 16; W++) + k[2 * W] = R[W] & 255, k[2 * W + 1] = R[W] >> 8; + } + function u(k, B) { + for (let U = 0; U < 16; U++) + k[U] = B[2 * U] + (B[2 * U + 1] << 8); + k[15] &= 32767; + } + function h(k, B, U) { + for (let R = 0; R < 16; R++) + k[R] = B[R] + U[R]; + } + function g(k, B, U) { + for (let R = 0; R < 16; R++) + k[R] = B[R] - U[R]; + } + function v(k, B, U) { + let R, W, J = 0, ne = 0, K = 0, E = 0, b = 0, l = 0, p = 0, m = 0, w = 0, P = 0, _ = 0, y = 0, M = 0, I = 0, q = 0, ce = 0, L = 0, oe = 0, Q = 0, X = 0, ee = 0, O = 0, Z = 0, re = 0, he = 0, ae = 0, fe = 0, be = 0, Ae = 0, Te = 0, Re = 0, $e = U[0], Me = U[1], Oe = U[2], ze = U[3], De = U[4], je = U[5], Ue = U[6], _e = U[7], Ze = U[8], ot = U[9], ke = U[10], rt = U[11], nt = U[12], Ge = U[13], ht = U[14], lt = U[15]; + R = B[0], J += R * $e, ne += R * Me, K += R * Oe, E += R * ze, b += R * De, l += R * je, p += R * Ue, m += R * _e, w += R * Ze, P += R * ot, _ += R * ke, y += R * rt, M += R * nt, I += R * Ge, q += R * ht, ce += R * lt, R = B[1], ne += R * $e, K += R * Me, E += R * Oe, b += R * ze, l += R * De, p += R * je, m += R * Ue, w += R * _e, P += R * Ze, _ += R * ot, y += R * ke, M += R * rt, I += R * nt, q += R * Ge, ce += R * ht, L += R * lt, R = B[2], K += R * $e, E += R * Me, b += R * Oe, l += R * ze, p += R * De, m += R * je, w += R * Ue, P += R * _e, _ += R * Ze, y += R * ot, M += R * ke, I += R * rt, q += R * nt, ce += R * Ge, L += R * ht, oe += R * lt, R = B[3], E += R * $e, b += R * Me, l += R * Oe, p += R * ze, m += R * De, w += R * je, P += R * Ue, _ += R * _e, y += R * Ze, M += R * ot, I += R * ke, q += R * rt, ce += R * nt, L += R * Ge, oe += R * ht, Q += R * lt, R = B[4], b += R * $e, l += R * Me, p += R * Oe, m += R * ze, w += R * De, P += R * je, _ += R * Ue, y += R * _e, M += R * Ze, I += R * ot, q += R * ke, ce += R * rt, L += R * nt, oe += R * Ge, Q += R * ht, X += R * lt, R = B[5], l += R * $e, p += R * Me, m += R * Oe, w += R * ze, P += R * De, _ += R * je, y += R * Ue, M += R * _e, I += R * Ze, q += R * ot, ce += R * ke, L += R * rt, oe += R * nt, Q += R * Ge, X += R * ht, ee += R * lt, R = B[6], p += R * $e, m += R * Me, w += R * Oe, P += R * ze, _ += R * De, y += R * je, M += R * Ue, I += R * _e, q += R * Ze, ce += R * ot, L += R * ke, oe += R * rt, Q += R * nt, X += R * Ge, ee += R * ht, O += R * lt, R = B[7], m += R * $e, w += R * Me, P += R * Oe, _ += R * ze, y += R * De, M += R * je, I += R * Ue, q += R * _e, ce += R * Ze, L += R * ot, oe += R * ke, Q += R * rt, X += R * nt, ee += R * Ge, O += R * ht, Z += R * lt, R = B[8], w += R * $e, P += R * Me, _ += R * Oe, y += R * ze, M += R * De, I += R * je, q += R * Ue, ce += R * _e, L += R * Ze, oe += R * ot, Q += R * ke, X += R * rt, ee += R * nt, O += R * Ge, Z += R * ht, re += R * lt, R = B[9], P += R * $e, _ += R * Me, y += R * Oe, M += R * ze, I += R * De, q += R * je, ce += R * Ue, L += R * _e, oe += R * Ze, Q += R * ot, X += R * ke, ee += R * rt, O += R * nt, Z += R * Ge, re += R * ht, he += R * lt, R = B[10], _ += R * $e, y += R * Me, M += R * Oe, I += R * ze, q += R * De, ce += R * je, L += R * Ue, oe += R * _e, Q += R * Ze, X += R * ot, ee += R * ke, O += R * rt, Z += R * nt, re += R * Ge, he += R * ht, ae += R * lt, R = B[11], y += R * $e, M += R * Me, I += R * Oe, q += R * ze, ce += R * De, L += R * je, oe += R * Ue, Q += R * _e, X += R * Ze, ee += R * ot, O += R * ke, Z += R * rt, re += R * nt, he += R * Ge, ae += R * ht, fe += R * lt, R = B[12], M += R * $e, I += R * Me, q += R * Oe, ce += R * ze, L += R * De, oe += R * je, Q += R * Ue, X += R * _e, ee += R * Ze, O += R * ot, Z += R * ke, re += R * rt, he += R * nt, ae += R * Ge, fe += R * ht, be += R * lt, R = B[13], I += R * $e, q += R * Me, ce += R * Oe, L += R * ze, oe += R * De, Q += R * je, X += R * Ue, ee += R * _e, O += R * Ze, Z += R * ot, re += R * ke, he += R * rt, ae += R * nt, fe += R * Ge, be += R * ht, Ae += R * lt, R = B[14], q += R * $e, ce += R * Me, L += R * Oe, oe += R * ze, Q += R * De, X += R * je, ee += R * Ue, O += R * _e, Z += R * Ze, re += R * ot, he += R * ke, ae += R * rt, fe += R * nt, be += R * Ge, Ae += R * ht, Te += R * lt, R = B[15], ce += R * $e, L += R * Me, oe += R * Oe, Q += R * ze, X += R * De, ee += R * je, O += R * Ue, Z += R * _e, re += R * Ze, he += R * ot, ae += R * ke, fe += R * rt, be += R * nt, Ae += R * Ge, Te += R * ht, Re += R * lt, J += 38 * L, ne += 38 * oe, K += 38 * Q, E += 38 * X, b += 38 * ee, l += 38 * O, p += 38 * Z, m += 38 * re, w += 38 * he, P += 38 * ae, _ += 38 * fe, y += 38 * be, M += 38 * Ae, I += 38 * Te, q += 38 * Re, W = 1, R = J + W + 65535, W = Math.floor(R / 65536), J = R - W * 65536, R = ne + W + 65535, W = Math.floor(R / 65536), ne = R - W * 65536, R = K + W + 65535, W = Math.floor(R / 65536), K = R - W * 65536, R = E + W + 65535, W = Math.floor(R / 65536), E = R - W * 65536, R = b + W + 65535, W = Math.floor(R / 65536), b = R - W * 65536, R = l + W + 65535, W = Math.floor(R / 65536), l = R - W * 65536, R = p + W + 65535, W = Math.floor(R / 65536), p = R - W * 65536, R = m + W + 65535, W = Math.floor(R / 65536), m = R - W * 65536, R = w + W + 65535, W = Math.floor(R / 65536), w = R - W * 65536, R = P + W + 65535, W = Math.floor(R / 65536), P = R - W * 65536, R = _ + W + 65535, W = Math.floor(R / 65536), _ = R - W * 65536, R = y + W + 65535, W = Math.floor(R / 65536), y = R - W * 65536, R = M + W + 65535, W = Math.floor(R / 65536), M = R - W * 65536, R = I + W + 65535, W = Math.floor(R / 65536), I = R - W * 65536, R = q + W + 65535, W = Math.floor(R / 65536), q = R - W * 65536, R = ce + W + 65535, W = Math.floor(R / 65536), ce = R - W * 65536, J += W - 1 + 37 * (W - 1), W = 1, R = J + W + 65535, W = Math.floor(R / 65536), J = R - W * 65536, R = ne + W + 65535, W = Math.floor(R / 65536), ne = R - W * 65536, R = K + W + 65535, W = Math.floor(R / 65536), K = R - W * 65536, R = E + W + 65535, W = Math.floor(R / 65536), E = R - W * 65536, R = b + W + 65535, W = Math.floor(R / 65536), b = R - W * 65536, R = l + W + 65535, W = Math.floor(R / 65536), l = R - W * 65536, R = p + W + 65535, W = Math.floor(R / 65536), p = R - W * 65536, R = m + W + 65535, W = Math.floor(R / 65536), m = R - W * 65536, R = w + W + 65535, W = Math.floor(R / 65536), w = R - W * 65536, R = P + W + 65535, W = Math.floor(R / 65536), P = R - W * 65536, R = _ + W + 65535, W = Math.floor(R / 65536), _ = R - W * 65536, R = y + W + 65535, W = Math.floor(R / 65536), y = R - W * 65536, R = M + W + 65535, W = Math.floor(R / 65536), M = R - W * 65536, R = I + W + 65535, W = Math.floor(R / 65536), I = R - W * 65536, R = q + W + 65535, W = Math.floor(R / 65536), q = R - W * 65536, R = ce + W + 65535, W = Math.floor(R / 65536), ce = R - W * 65536, J += W - 1 + 37 * (W - 1), k[0] = J, k[1] = ne, k[2] = K, k[3] = E, k[4] = b, k[5] = l, k[6] = p, k[7] = m, k[8] = w, k[9] = P, k[10] = _, k[11] = y, k[12] = M, k[13] = I, k[14] = q, k[15] = ce; + } + function x(k, B) { + v(k, B, B); + } + function S(k, B) { + const U = n(); + for (let R = 0; R < 16; R++) + U[R] = B[R]; + for (let R = 253; R >= 0; R--) + x(U, U), R !== 2 && R !== 4 && v(U, U, B); + for (let R = 0; R < 16; R++) + k[R] = U[R]; + } + function C(k, B) { + const U = new Uint8Array(32), R = new Float64Array(80), W = n(), J = n(), ne = n(), K = n(), E = n(), b = n(); + for (let w = 0; w < 31; w++) + U[w] = k[w]; + U[31] = k[31] & 127 | 64, U[0] &= 248, u(R, B); + for (let w = 0; w < 16; w++) + J[w] = R[w]; + W[0] = K[0] = 1; + for (let w = 254; w >= 0; --w) { + const P = U[w >>> 3] >>> (w & 7) & 1; + a(W, J, P), a(ne, K, P), h(E, W, ne), g(W, W, ne), h(ne, J, K), g(J, J, K), x(K, E), x(b, W), v(W, ne, W), v(ne, J, E), h(E, W, ne), g(W, W, ne), x(J, W), g(ne, K, b), v(W, ne, s), h(W, W, K), v(ne, ne, W), v(W, K, b), v(K, J, R), x(J, E), a(W, J, P), a(ne, K, P); + } + for (let w = 0; w < 16; w++) + R[w + 16] = W[w], R[w + 32] = ne[w], R[w + 48] = J[w], R[w + 64] = K[w]; + const l = R.subarray(32), p = R.subarray(16); + S(l, l), v(p, p, l); + const m = new Uint8Array(32); + return f(m, p), m; + } + t.scalarMult = C; + function D(k) { + return C(k, i); + } + t.scalarMultBase = D; + function $(k) { + if (k.length !== t.SECRET_KEY_LENGTH) + throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`); + const B = new Uint8Array(k); + return { + publicKey: D(B), + secretKey: B + }; + } + t.generateKeyPairFromSeed = $; + function N(k) { + const B = (0, e.randomBytes)(32, k), U = $(B); + return (0, r.wipe)(B), U; + } + t.generateKeyPair = N; + function z(k, B, U = !1) { + if (k.length !== t.PUBLIC_KEY_LENGTH) + throw new Error("X25519: incorrect secret key length"); + if (B.length !== t.PUBLIC_KEY_LENGTH) + throw new Error("X25519: incorrect public key length"); + const R = C(k, B); + if (U) { + let W = 0; + for (let J = 0; J < R.length; J++) + W |= R[J]; + if (W === 0) + throw new Error("X25519: invalid shared key"); + } + return R; + } + t.sharedKey = z; + })(Cg)), Cg; +} +var y8 = iF(), Rg = {}; +const sF = "6.6.0", oF = { + version: sF +}; +var Tg = {}, qh = { exports: {} }, aF = qh.exports, Ix; +function go() { + return Ix || (Ix = 1, (function(t) { + (function(e, r) { + function n(K, E) { + if (!K) throw new Error(E || "Assertion failed"); + } + function i(K, E) { + K.super_ = E; + var b = function() { + }; + b.prototype = E.prototype, K.prototype = new b(), K.prototype.constructor = K; + } + function s(K, E, b) { + if (s.isBN(K)) + return K; + this.negative = 0, this.words = null, this.length = 0, this.red = null, K !== null && ((E === "le" || E === "be") && (b = E, E = 10), this._init(K || 0, E || 10, b || "be")); + } + typeof e == "object" ? e.exports = s : r.BN = s, s.BN = s, s.wordSize = 26; + var o; + try { + typeof window < "u" && typeof window.Buffer < "u" ? o = window.Buffer : o = Qf.Buffer; + } catch { + } + s.isBN = function(E) { + return E instanceof s ? !0 : E !== null && typeof E == "object" && E.constructor.wordSize === s.wordSize && Array.isArray(E.words); + }, s.max = function(E, b) { + return E.cmp(b) > 0 ? E : b; + }, s.min = function(E, b) { + return E.cmp(b) < 0 ? E : b; + }, s.prototype._init = function(E, b, l) { + if (typeof E == "number") + return this._initNumber(E, b, l); + if (typeof E == "object") + return this._initArray(E, b, l); + b === "hex" && (b = 16), n(b === (b | 0) && b >= 2 && b <= 36), E = E.toString().replace(/\s+/g, ""); + var p = 0; + E[0] === "-" && (p++, this.negative = 1), p < E.length && (b === 16 ? this._parseHex(E, p, l) : (this._parseBase(E, b, p), l === "le" && this._initArray(this.toArray(), b, l))); + }, s.prototype._initNumber = function(E, b, l) { + E < 0 && (this.negative = 1, E = -E), E < 67108864 ? (this.words = [E & 67108863], this.length = 1) : E < 4503599627370496 ? (this.words = [ + E & 67108863, + E / 67108864 & 67108863 + ], this.length = 2) : (n(E < 9007199254740992), this.words = [ + E & 67108863, + E / 67108864 & 67108863, + 1 + ], this.length = 3), l === "le" && this._initArray(this.toArray(), b, l); + }, s.prototype._initArray = function(E, b, l) { + if (n(typeof E.length == "number"), E.length <= 0) + return this.words = [0], this.length = 1, this; + this.length = Math.ceil(E.length / 3), this.words = new Array(this.length); + for (var p = 0; p < this.length; p++) + this.words[p] = 0; + var m, w, P = 0; + if (l === "be") + for (p = E.length - 1, m = 0; p >= 0; p -= 3) + w = E[p] | E[p - 1] << 8 | E[p - 2] << 16, this.words[m] |= w << P & 67108863, this.words[m + 1] = w >>> 26 - P & 67108863, P += 24, P >= 26 && (P -= 26, m++); + else if (l === "le") + for (p = 0, m = 0; p < E.length; p += 3) + w = E[p] | E[p + 1] << 8 | E[p + 2] << 16, this.words[m] |= w << P & 67108863, this.words[m + 1] = w >>> 26 - P & 67108863, P += 24, P >= 26 && (P -= 26, m++); + return this.strip(); + }; + function a(K, E) { + var b = K.charCodeAt(E); + return b >= 65 && b <= 70 ? b - 55 : b >= 97 && b <= 102 ? b - 87 : b - 48 & 15; + } + function f(K, E, b) { + var l = a(K, b); + return b - 1 >= E && (l |= a(K, b - 1) << 4), l; + } + s.prototype._parseHex = function(E, b, l) { + this.length = Math.ceil((E.length - b) / 6), this.words = new Array(this.length); + for (var p = 0; p < this.length; p++) + this.words[p] = 0; + var m = 0, w = 0, P; + if (l === "be") + for (p = E.length - 1; p >= b; p -= 2) + P = f(E, b, p) << m, this.words[w] |= P & 67108863, m >= 18 ? (m -= 18, w += 1, this.words[w] |= P >>> 26) : m += 8; + else { + var _ = E.length - b; + for (p = _ % 2 === 0 ? b + 1 : b; p < E.length; p += 2) + P = f(E, b, p) << m, this.words[w] |= P & 67108863, m >= 18 ? (m -= 18, w += 1, this.words[w] |= P >>> 26) : m += 8; + } + this.strip(); + }; + function u(K, E, b, l) { + for (var p = 0, m = Math.min(K.length, b), w = E; w < m; w++) { + var P = K.charCodeAt(w) - 48; + p *= l, P >= 49 ? p += P - 49 + 10 : P >= 17 ? p += P - 17 + 10 : p += P; + } + return p; + } + s.prototype._parseBase = function(E, b, l) { + this.words = [0], this.length = 1; + for (var p = 0, m = 1; m <= 67108863; m *= b) + p++; + p--, m = m / b | 0; + for (var w = E.length - l, P = w % p, _ = Math.min(w, w - P) + l, y = 0, M = l; M < _; M += p) + y = u(E, M, M + p, b), this.imuln(m), this.words[0] + y < 67108864 ? this.words[0] += y : this._iaddn(y); + if (P !== 0) { + var I = 1; + for (y = u(E, M, E.length, b), M = 0; M < P; M++) + I *= b; + this.imuln(I), this.words[0] + y < 67108864 ? this.words[0] += y : this._iaddn(y); + } + this.strip(); + }, s.prototype.copy = function(E) { + E.words = new Array(this.length); + for (var b = 0; b < this.length; b++) + E.words[b] = this.words[b]; + E.length = this.length, E.negative = this.negative, E.red = this.red; + }, s.prototype.clone = function() { + var E = new s(null); + return this.copy(E), E; + }, s.prototype._expand = function(E) { + for (; this.length < E; ) + this.words[this.length++] = 0; + return this; + }, s.prototype.strip = function() { + for (; this.length > 1 && this.words[this.length - 1] === 0; ) + this.length--; + return this._normSign(); + }, s.prototype._normSign = function() { + return this.length === 1 && this.words[0] === 0 && (this.negative = 0), this; + }, s.prototype.inspect = function() { + return (this.red ? ""; + }; + var h = [ + "", + "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" + ], g = [ + 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 + ], v = [ + 0, + 0, + 33554432, + 43046721, + 16777216, + 48828125, + 60466176, + 40353607, + 16777216, + 43046721, + 1e7, + 19487171, + 35831808, + 62748517, + 7529536, + 11390625, + 16777216, + 24137569, + 34012224, + 47045881, + 64e6, + 4084101, + 5153632, + 6436343, + 7962624, + 9765625, + 11881376, + 14348907, + 17210368, + 20511149, + 243e5, + 28629151, + 33554432, + 39135393, + 45435424, + 52521875, + 60466176 + ]; + s.prototype.toString = function(E, b) { + E = E || 10, b = b | 0 || 1; + var l; + if (E === 16 || E === "hex") { + l = ""; + for (var p = 0, m = 0, w = 0; w < this.length; w++) { + var P = this.words[w], _ = ((P << p | m) & 16777215).toString(16); + m = P >>> 24 - p & 16777215, p += 2, p >= 26 && (p -= 26, w--), m !== 0 || w !== this.length - 1 ? l = h[6 - _.length] + _ + l : l = _ + l; + } + for (m !== 0 && (l = m.toString(16) + l); l.length % b !== 0; ) + l = "0" + l; + return this.negative !== 0 && (l = "-" + l), l; + } + if (E === (E | 0) && E >= 2 && E <= 36) { + var y = g[E], M = v[E]; + l = ""; + var I = this.clone(); + for (I.negative = 0; !I.isZero(); ) { + var q = I.modn(M).toString(E); + I = I.idivn(M), I.isZero() ? l = q + l : l = h[y - q.length] + q + l; + } + for (this.isZero() && (l = "0" + l); l.length % b !== 0; ) + l = "0" + l; + return this.negative !== 0 && (l = "-" + l), l; + } + n(!1, "Base should be between 2 and 36"); + }, s.prototype.toNumber = function() { + var E = this.words[0]; + return this.length === 2 ? E += this.words[1] * 67108864 : this.length === 3 && this.words[2] === 1 ? E += 4503599627370496 + this.words[1] * 67108864 : this.length > 2 && n(!1, "Number can only safely store up to 53 bits"), this.negative !== 0 ? -E : E; + }, s.prototype.toJSON = function() { + return this.toString(16); + }, s.prototype.toBuffer = function(E, b) { + return n(typeof o < "u"), this.toArrayLike(o, E, b); + }, s.prototype.toArray = function(E, b) { + return this.toArrayLike(Array, E, b); + }, s.prototype.toArrayLike = function(E, b, l) { + var p = this.byteLength(), m = l || Math.max(1, p); + n(p <= m, "byte array longer than desired length"), n(m > 0, "Requested array length <= 0"), this.strip(); + var w = b === "le", P = new E(m), _, y, M = this.clone(); + if (w) { + for (y = 0; !M.isZero(); y++) + _ = M.andln(255), M.iushrn(8), P[y] = _; + for (; y < m; y++) + P[y] = 0; + } else { + for (y = 0; y < m - p; y++) + P[y] = 0; + for (y = 0; !M.isZero(); y++) + _ = M.andln(255), M.iushrn(8), P[m - y - 1] = _; + } + return P; + }, Math.clz32 ? s.prototype._countBits = function(E) { + return 32 - Math.clz32(E); + } : s.prototype._countBits = function(E) { + var b = E, l = 0; + return b >= 4096 && (l += 13, b >>>= 13), b >= 64 && (l += 7, b >>>= 7), b >= 8 && (l += 4, b >>>= 4), b >= 2 && (l += 2, b >>>= 2), l + b; + }, s.prototype._zeroBits = function(E) { + if (E === 0) return 26; + var b = E, l = 0; + return (b & 8191) === 0 && (l += 13, b >>>= 13), (b & 127) === 0 && (l += 7, b >>>= 7), (b & 15) === 0 && (l += 4, b >>>= 4), (b & 3) === 0 && (l += 2, b >>>= 2), (b & 1) === 0 && l++, l; + }, s.prototype.bitLength = function() { + var E = this.words[this.length - 1], b = this._countBits(E); + return (this.length - 1) * 26 + b; + }; + function x(K) { + for (var E = new Array(K.bitLength()), b = 0; b < E.length; b++) { + var l = b / 26 | 0, p = b % 26; + E[b] = (K.words[l] & 1 << p) >>> p; + } + return E; + } + s.prototype.zeroBits = function() { + if (this.isZero()) return 0; + for (var E = 0, b = 0; b < this.length; b++) { + var l = this._zeroBits(this.words[b]); + if (E += l, l !== 26) break; + } + return E; + }, s.prototype.byteLength = function() { + return Math.ceil(this.bitLength() / 8); + }, s.prototype.toTwos = function(E) { + return this.negative !== 0 ? this.abs().inotn(E).iaddn(1) : this.clone(); + }, s.prototype.fromTwos = function(E) { + return this.testn(E - 1) ? this.notn(E).iaddn(1).ineg() : this.clone(); + }, s.prototype.isNeg = function() { + return this.negative !== 0; + }, s.prototype.neg = function() { + return this.clone().ineg(); + }, s.prototype.ineg = function() { + return this.isZero() || (this.negative ^= 1), this; + }, s.prototype.iuor = function(E) { + for (; this.length < E.length; ) + this.words[this.length++] = 0; + for (var b = 0; b < E.length; b++) + this.words[b] = this.words[b] | E.words[b]; + return this.strip(); + }, s.prototype.ior = function(E) { + return n((this.negative | E.negative) === 0), this.iuor(E); + }, s.prototype.or = function(E) { + return this.length > E.length ? this.clone().ior(E) : E.clone().ior(this); + }, s.prototype.uor = function(E) { + return this.length > E.length ? this.clone().iuor(E) : E.clone().iuor(this); + }, s.prototype.iuand = function(E) { + var b; + this.length > E.length ? b = E : b = this; + for (var l = 0; l < b.length; l++) + this.words[l] = this.words[l] & E.words[l]; + return this.length = b.length, this.strip(); + }, s.prototype.iand = function(E) { + return n((this.negative | E.negative) === 0), this.iuand(E); + }, s.prototype.and = function(E) { + return this.length > E.length ? this.clone().iand(E) : E.clone().iand(this); + }, s.prototype.uand = function(E) { + return this.length > E.length ? this.clone().iuand(E) : E.clone().iuand(this); + }, s.prototype.iuxor = function(E) { + var b, l; + this.length > E.length ? (b = this, l = E) : (b = E, l = this); + for (var p = 0; p < l.length; p++) + this.words[p] = b.words[p] ^ l.words[p]; + if (this !== b) + for (; p < b.length; p++) + this.words[p] = b.words[p]; + return this.length = b.length, this.strip(); + }, s.prototype.ixor = function(E) { + return n((this.negative | E.negative) === 0), this.iuxor(E); + }, s.prototype.xor = function(E) { + return this.length > E.length ? this.clone().ixor(E) : E.clone().ixor(this); + }, s.prototype.uxor = function(E) { + return this.length > E.length ? this.clone().iuxor(E) : E.clone().iuxor(this); + }, s.prototype.inotn = function(E) { + n(typeof E == "number" && E >= 0); + var b = Math.ceil(E / 26) | 0, l = E % 26; + this._expand(b), l > 0 && b--; + for (var p = 0; p < b; p++) + this.words[p] = ~this.words[p] & 67108863; + return l > 0 && (this.words[p] = ~this.words[p] & 67108863 >> 26 - l), this.strip(); + }, s.prototype.notn = function(E) { + return this.clone().inotn(E); + }, s.prototype.setn = function(E, b) { + n(typeof E == "number" && E >= 0); + var l = E / 26 | 0, p = E % 26; + return this._expand(l + 1), b ? this.words[l] = this.words[l] | 1 << p : this.words[l] = this.words[l] & ~(1 << p), this.strip(); + }, s.prototype.iadd = function(E) { + var b; + if (this.negative !== 0 && E.negative === 0) + return this.negative = 0, b = this.isub(E), this.negative ^= 1, this._normSign(); + if (this.negative === 0 && E.negative !== 0) + return E.negative = 0, b = this.isub(E), E.negative = 1, b._normSign(); + var l, p; + this.length > E.length ? (l = this, p = E) : (l = E, p = this); + for (var m = 0, w = 0; w < p.length; w++) + b = (l.words[w] | 0) + (p.words[w] | 0) + m, this.words[w] = b & 67108863, m = b >>> 26; + for (; m !== 0 && w < l.length; w++) + b = (l.words[w] | 0) + m, this.words[w] = b & 67108863, m = b >>> 26; + if (this.length = l.length, m !== 0) + this.words[this.length] = m, this.length++; + else if (l !== this) + for (; w < l.length; w++) + this.words[w] = l.words[w]; + return this; + }, s.prototype.add = function(E) { + var b; + return E.negative !== 0 && this.negative === 0 ? (E.negative = 0, b = this.sub(E), E.negative ^= 1, b) : E.negative === 0 && this.negative !== 0 ? (this.negative = 0, b = E.sub(this), this.negative = 1, b) : this.length > E.length ? this.clone().iadd(E) : E.clone().iadd(this); + }, s.prototype.isub = function(E) { + if (E.negative !== 0) { + E.negative = 0; + var b = this.iadd(E); + return E.negative = 1, b._normSign(); + } else if (this.negative !== 0) + return this.negative = 0, this.iadd(E), this.negative = 1, this._normSign(); + var l = this.cmp(E); + if (l === 0) + return this.negative = 0, this.length = 1, this.words[0] = 0, this; + var p, m; + l > 0 ? (p = this, m = E) : (p = E, m = this); + for (var w = 0, P = 0; P < m.length; P++) + b = (p.words[P] | 0) - (m.words[P] | 0) + w, w = b >> 26, this.words[P] = b & 67108863; + for (; w !== 0 && P < p.length; P++) + b = (p.words[P] | 0) + w, w = b >> 26, this.words[P] = b & 67108863; + if (w === 0 && P < p.length && p !== this) + for (; P < p.length; P++) + this.words[P] = p.words[P]; + return this.length = Math.max(this.length, P), p !== this && (this.negative = 1), this.strip(); + }, s.prototype.sub = function(E) { + return this.clone().isub(E); + }; + function S(K, E, b) { + b.negative = E.negative ^ K.negative; + var l = K.length + E.length | 0; + b.length = l, l = l - 1 | 0; + var p = K.words[0] | 0, m = E.words[0] | 0, w = p * m, P = w & 67108863, _ = w / 67108864 | 0; + b.words[0] = P; + for (var y = 1; y < l; y++) { + for (var M = _ >>> 26, I = _ & 67108863, q = Math.min(y, E.length - 1), ce = Math.max(0, y - K.length + 1); ce <= q; ce++) { + var L = y - ce | 0; + p = K.words[L] | 0, m = E.words[ce] | 0, w = p * m + I, M += w / 67108864 | 0, I = w & 67108863; + } + b.words[y] = I | 0, _ = M | 0; + } + return _ !== 0 ? b.words[y] = _ | 0 : b.length--, b.strip(); + } + var C = function(E, b, l) { + var p = E.words, m = b.words, w = l.words, P = 0, _, y, M, I = p[0] | 0, q = I & 8191, ce = I >>> 13, L = p[1] | 0, oe = L & 8191, Q = L >>> 13, X = p[2] | 0, ee = X & 8191, O = X >>> 13, Z = p[3] | 0, re = Z & 8191, he = Z >>> 13, ae = p[4] | 0, fe = ae & 8191, be = ae >>> 13, Ae = p[5] | 0, Te = Ae & 8191, Re = Ae >>> 13, $e = p[6] | 0, Me = $e & 8191, Oe = $e >>> 13, ze = p[7] | 0, De = ze & 8191, je = ze >>> 13, Ue = p[8] | 0, _e = Ue & 8191, Ze = Ue >>> 13, ot = p[9] | 0, ke = ot & 8191, rt = ot >>> 13, nt = m[0] | 0, Ge = nt & 8191, ht = nt >>> 13, lt = m[1] | 0, ct = lt & 8191, qt = lt >>> 13, Gt = m[2] | 0, Et = Gt & 8191, Yt = Gt >>> 13, tr = m[3] | 0, Tt = tr & 8191, kt = tr >>> 13, It = m[4] | 0, dt = It & 8191, Dt = It >>> 13, Nt = m[5] | 0, mt = Nt & 8191, Bt = Nt >>> 13, Ft = m[6] | 0, et = Ft & 8191, $t = Ft >>> 13, H = m[7] | 0, V = H & 8191, Y = H >>> 13, T = m[8] | 0, F = T & 8191, ie = T >>> 13, le = m[9] | 0, me = le & 8191, Ee = le >>> 13; + l.negative = E.negative ^ b.negative, l.length = 19, _ = Math.imul(q, Ge), y = Math.imul(q, ht), y = y + Math.imul(ce, Ge) | 0, M = Math.imul(ce, ht); + var Le = (P + _ | 0) + ((y & 8191) << 13) | 0; + P = (M + (y >>> 13) | 0) + (Le >>> 26) | 0, Le &= 67108863, _ = Math.imul(oe, Ge), y = Math.imul(oe, ht), y = y + Math.imul(Q, Ge) | 0, M = Math.imul(Q, ht), _ = _ + Math.imul(q, ct) | 0, y = y + Math.imul(q, qt) | 0, y = y + Math.imul(ce, ct) | 0, M = M + Math.imul(ce, qt) | 0; + var Ie = (P + _ | 0) + ((y & 8191) << 13) | 0; + P = (M + (y >>> 13) | 0) + (Ie >>> 26) | 0, Ie &= 67108863, _ = Math.imul(ee, Ge), y = Math.imul(ee, ht), y = y + Math.imul(O, Ge) | 0, M = Math.imul(O, ht), _ = _ + Math.imul(oe, ct) | 0, y = y + Math.imul(oe, qt) | 0, y = y + Math.imul(Q, ct) | 0, M = M + Math.imul(Q, qt) | 0, _ = _ + Math.imul(q, Et) | 0, y = y + Math.imul(q, Yt) | 0, y = y + Math.imul(ce, Et) | 0, M = M + Math.imul(ce, Yt) | 0; + var Qe = (P + _ | 0) + ((y & 8191) << 13) | 0; + P = (M + (y >>> 13) | 0) + (Qe >>> 26) | 0, Qe &= 67108863, _ = Math.imul(re, Ge), y = Math.imul(re, ht), y = y + Math.imul(he, Ge) | 0, M = Math.imul(he, ht), _ = _ + Math.imul(ee, ct) | 0, y = y + Math.imul(ee, qt) | 0, y = y + Math.imul(O, ct) | 0, M = M + Math.imul(O, qt) | 0, _ = _ + Math.imul(oe, Et) | 0, y = y + Math.imul(oe, Yt) | 0, y = y + Math.imul(Q, Et) | 0, M = M + Math.imul(Q, Yt) | 0, _ = _ + Math.imul(q, Tt) | 0, y = y + Math.imul(q, kt) | 0, y = y + Math.imul(ce, Tt) | 0, M = M + Math.imul(ce, kt) | 0; + var Xe = (P + _ | 0) + ((y & 8191) << 13) | 0; + P = (M + (y >>> 13) | 0) + (Xe >>> 26) | 0, Xe &= 67108863, _ = Math.imul(fe, Ge), y = Math.imul(fe, ht), y = y + Math.imul(be, Ge) | 0, M = Math.imul(be, ht), _ = _ + Math.imul(re, ct) | 0, y = y + Math.imul(re, qt) | 0, y = y + Math.imul(he, ct) | 0, M = M + Math.imul(he, qt) | 0, _ = _ + Math.imul(ee, Et) | 0, y = y + Math.imul(ee, Yt) | 0, y = y + Math.imul(O, Et) | 0, M = M + Math.imul(O, Yt) | 0, _ = _ + Math.imul(oe, Tt) | 0, y = y + Math.imul(oe, kt) | 0, y = y + Math.imul(Q, Tt) | 0, M = M + Math.imul(Q, kt) | 0, _ = _ + Math.imul(q, dt) | 0, y = y + Math.imul(q, Dt) | 0, y = y + Math.imul(ce, dt) | 0, M = M + Math.imul(ce, Dt) | 0; + var tt = (P + _ | 0) + ((y & 8191) << 13) | 0; + P = (M + (y >>> 13) | 0) + (tt >>> 26) | 0, tt &= 67108863, _ = Math.imul(Te, Ge), y = Math.imul(Te, ht), y = y + Math.imul(Re, Ge) | 0, M = Math.imul(Re, ht), _ = _ + Math.imul(fe, ct) | 0, y = y + Math.imul(fe, qt) | 0, y = y + Math.imul(be, ct) | 0, M = M + Math.imul(be, qt) | 0, _ = _ + Math.imul(re, Et) | 0, y = y + Math.imul(re, Yt) | 0, y = y + Math.imul(he, Et) | 0, M = M + Math.imul(he, Yt) | 0, _ = _ + Math.imul(ee, Tt) | 0, y = y + Math.imul(ee, kt) | 0, y = y + Math.imul(O, Tt) | 0, M = M + Math.imul(O, kt) | 0, _ = _ + Math.imul(oe, dt) | 0, y = y + Math.imul(oe, Dt) | 0, y = y + Math.imul(Q, dt) | 0, M = M + Math.imul(Q, Dt) | 0, _ = _ + Math.imul(q, mt) | 0, y = y + Math.imul(q, Bt) | 0, y = y + Math.imul(ce, mt) | 0, M = M + Math.imul(ce, Bt) | 0; + var st = (P + _ | 0) + ((y & 8191) << 13) | 0; + P = (M + (y >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, _ = Math.imul(Me, Ge), y = Math.imul(Me, ht), y = y + Math.imul(Oe, Ge) | 0, M = Math.imul(Oe, ht), _ = _ + Math.imul(Te, ct) | 0, y = y + Math.imul(Te, qt) | 0, y = y + Math.imul(Re, ct) | 0, M = M + Math.imul(Re, qt) | 0, _ = _ + Math.imul(fe, Et) | 0, y = y + Math.imul(fe, Yt) | 0, y = y + Math.imul(be, Et) | 0, M = M + Math.imul(be, Yt) | 0, _ = _ + Math.imul(re, Tt) | 0, y = y + Math.imul(re, kt) | 0, y = y + Math.imul(he, Tt) | 0, M = M + Math.imul(he, kt) | 0, _ = _ + Math.imul(ee, dt) | 0, y = y + Math.imul(ee, Dt) | 0, y = y + Math.imul(O, dt) | 0, M = M + Math.imul(O, Dt) | 0, _ = _ + Math.imul(oe, mt) | 0, y = y + Math.imul(oe, Bt) | 0, y = y + Math.imul(Q, mt) | 0, M = M + Math.imul(Q, Bt) | 0, _ = _ + Math.imul(q, et) | 0, y = y + Math.imul(q, $t) | 0, y = y + Math.imul(ce, et) | 0, M = M + Math.imul(ce, $t) | 0; + var vt = (P + _ | 0) + ((y & 8191) << 13) | 0; + P = (M + (y >>> 13) | 0) + (vt >>> 26) | 0, vt &= 67108863, _ = Math.imul(De, Ge), y = Math.imul(De, ht), y = y + Math.imul(je, Ge) | 0, M = Math.imul(je, ht), _ = _ + Math.imul(Me, ct) | 0, y = y + Math.imul(Me, qt) | 0, y = y + Math.imul(Oe, ct) | 0, M = M + Math.imul(Oe, qt) | 0, _ = _ + Math.imul(Te, Et) | 0, y = y + Math.imul(Te, Yt) | 0, y = y + Math.imul(Re, Et) | 0, M = M + Math.imul(Re, Yt) | 0, _ = _ + Math.imul(fe, Tt) | 0, y = y + Math.imul(fe, kt) | 0, y = y + Math.imul(be, Tt) | 0, M = M + Math.imul(be, kt) | 0, _ = _ + Math.imul(re, dt) | 0, y = y + Math.imul(re, Dt) | 0, y = y + Math.imul(he, dt) | 0, M = M + Math.imul(he, Dt) | 0, _ = _ + Math.imul(ee, mt) | 0, y = y + Math.imul(ee, Bt) | 0, y = y + Math.imul(O, mt) | 0, M = M + Math.imul(O, Bt) | 0, _ = _ + Math.imul(oe, et) | 0, y = y + Math.imul(oe, $t) | 0, y = y + Math.imul(Q, et) | 0, M = M + Math.imul(Q, $t) | 0, _ = _ + Math.imul(q, V) | 0, y = y + Math.imul(q, Y) | 0, y = y + Math.imul(ce, V) | 0, M = M + Math.imul(ce, Y) | 0; + var Ct = (P + _ | 0) + ((y & 8191) << 13) | 0; + P = (M + (y >>> 13) | 0) + (Ct >>> 26) | 0, Ct &= 67108863, _ = Math.imul(_e, Ge), y = Math.imul(_e, ht), y = y + Math.imul(Ze, Ge) | 0, M = Math.imul(Ze, ht), _ = _ + Math.imul(De, ct) | 0, y = y + Math.imul(De, qt) | 0, y = y + Math.imul(je, ct) | 0, M = M + Math.imul(je, qt) | 0, _ = _ + Math.imul(Me, Et) | 0, y = y + Math.imul(Me, Yt) | 0, y = y + Math.imul(Oe, Et) | 0, M = M + Math.imul(Oe, Yt) | 0, _ = _ + Math.imul(Te, Tt) | 0, y = y + Math.imul(Te, kt) | 0, y = y + Math.imul(Re, Tt) | 0, M = M + Math.imul(Re, kt) | 0, _ = _ + Math.imul(fe, dt) | 0, y = y + Math.imul(fe, Dt) | 0, y = y + Math.imul(be, dt) | 0, M = M + Math.imul(be, Dt) | 0, _ = _ + Math.imul(re, mt) | 0, y = y + Math.imul(re, Bt) | 0, y = y + Math.imul(he, mt) | 0, M = M + Math.imul(he, Bt) | 0, _ = _ + Math.imul(ee, et) | 0, y = y + Math.imul(ee, $t) | 0, y = y + Math.imul(O, et) | 0, M = M + Math.imul(O, $t) | 0, _ = _ + Math.imul(oe, V) | 0, y = y + Math.imul(oe, Y) | 0, y = y + Math.imul(Q, V) | 0, M = M + Math.imul(Q, Y) | 0, _ = _ + Math.imul(q, F) | 0, y = y + Math.imul(q, ie) | 0, y = y + Math.imul(ce, F) | 0, M = M + Math.imul(ce, ie) | 0; + var Mt = (P + _ | 0) + ((y & 8191) << 13) | 0; + P = (M + (y >>> 13) | 0) + (Mt >>> 26) | 0, Mt &= 67108863, _ = Math.imul(ke, Ge), y = Math.imul(ke, ht), y = y + Math.imul(rt, Ge) | 0, M = Math.imul(rt, ht), _ = _ + Math.imul(_e, ct) | 0, y = y + Math.imul(_e, qt) | 0, y = y + Math.imul(Ze, ct) | 0, M = M + Math.imul(Ze, qt) | 0, _ = _ + Math.imul(De, Et) | 0, y = y + Math.imul(De, Yt) | 0, y = y + Math.imul(je, Et) | 0, M = M + Math.imul(je, Yt) | 0, _ = _ + Math.imul(Me, Tt) | 0, y = y + Math.imul(Me, kt) | 0, y = y + Math.imul(Oe, Tt) | 0, M = M + Math.imul(Oe, kt) | 0, _ = _ + Math.imul(Te, dt) | 0, y = y + Math.imul(Te, Dt) | 0, y = y + Math.imul(Re, dt) | 0, M = M + Math.imul(Re, Dt) | 0, _ = _ + Math.imul(fe, mt) | 0, y = y + Math.imul(fe, Bt) | 0, y = y + Math.imul(be, mt) | 0, M = M + Math.imul(be, Bt) | 0, _ = _ + Math.imul(re, et) | 0, y = y + Math.imul(re, $t) | 0, y = y + Math.imul(he, et) | 0, M = M + Math.imul(he, $t) | 0, _ = _ + Math.imul(ee, V) | 0, y = y + Math.imul(ee, Y) | 0, y = y + Math.imul(O, V) | 0, M = M + Math.imul(O, Y) | 0, _ = _ + Math.imul(oe, F) | 0, y = y + Math.imul(oe, ie) | 0, y = y + Math.imul(Q, F) | 0, M = M + Math.imul(Q, ie) | 0, _ = _ + Math.imul(q, me) | 0, y = y + Math.imul(q, Ee) | 0, y = y + Math.imul(ce, me) | 0, M = M + Math.imul(ce, Ee) | 0; + var wt = (P + _ | 0) + ((y & 8191) << 13) | 0; + P = (M + (y >>> 13) | 0) + (wt >>> 26) | 0, wt &= 67108863, _ = Math.imul(ke, ct), y = Math.imul(ke, qt), y = y + Math.imul(rt, ct) | 0, M = Math.imul(rt, qt), _ = _ + Math.imul(_e, Et) | 0, y = y + Math.imul(_e, Yt) | 0, y = y + Math.imul(Ze, Et) | 0, M = M + Math.imul(Ze, Yt) | 0, _ = _ + Math.imul(De, Tt) | 0, y = y + Math.imul(De, kt) | 0, y = y + Math.imul(je, Tt) | 0, M = M + Math.imul(je, kt) | 0, _ = _ + Math.imul(Me, dt) | 0, y = y + Math.imul(Me, Dt) | 0, y = y + Math.imul(Oe, dt) | 0, M = M + Math.imul(Oe, Dt) | 0, _ = _ + Math.imul(Te, mt) | 0, y = y + Math.imul(Te, Bt) | 0, y = y + Math.imul(Re, mt) | 0, M = M + Math.imul(Re, Bt) | 0, _ = _ + Math.imul(fe, et) | 0, y = y + Math.imul(fe, $t) | 0, y = y + Math.imul(be, et) | 0, M = M + Math.imul(be, $t) | 0, _ = _ + Math.imul(re, V) | 0, y = y + Math.imul(re, Y) | 0, y = y + Math.imul(he, V) | 0, M = M + Math.imul(he, Y) | 0, _ = _ + Math.imul(ee, F) | 0, y = y + Math.imul(ee, ie) | 0, y = y + Math.imul(O, F) | 0, M = M + Math.imul(O, ie) | 0, _ = _ + Math.imul(oe, me) | 0, y = y + Math.imul(oe, Ee) | 0, y = y + Math.imul(Q, me) | 0, M = M + Math.imul(Q, Ee) | 0; + var Rt = (P + _ | 0) + ((y & 8191) << 13) | 0; + P = (M + (y >>> 13) | 0) + (Rt >>> 26) | 0, Rt &= 67108863, _ = Math.imul(ke, Et), y = Math.imul(ke, Yt), y = y + Math.imul(rt, Et) | 0, M = Math.imul(rt, Yt), _ = _ + Math.imul(_e, Tt) | 0, y = y + Math.imul(_e, kt) | 0, y = y + Math.imul(Ze, Tt) | 0, M = M + Math.imul(Ze, kt) | 0, _ = _ + Math.imul(De, dt) | 0, y = y + Math.imul(De, Dt) | 0, y = y + Math.imul(je, dt) | 0, M = M + Math.imul(je, Dt) | 0, _ = _ + Math.imul(Me, mt) | 0, y = y + Math.imul(Me, Bt) | 0, y = y + Math.imul(Oe, mt) | 0, M = M + Math.imul(Oe, Bt) | 0, _ = _ + Math.imul(Te, et) | 0, y = y + Math.imul(Te, $t) | 0, y = y + Math.imul(Re, et) | 0, M = M + Math.imul(Re, $t) | 0, _ = _ + Math.imul(fe, V) | 0, y = y + Math.imul(fe, Y) | 0, y = y + Math.imul(be, V) | 0, M = M + Math.imul(be, Y) | 0, _ = _ + Math.imul(re, F) | 0, y = y + Math.imul(re, ie) | 0, y = y + Math.imul(he, F) | 0, M = M + Math.imul(he, ie) | 0, _ = _ + Math.imul(ee, me) | 0, y = y + Math.imul(ee, Ee) | 0, y = y + Math.imul(O, me) | 0, M = M + Math.imul(O, Ee) | 0; + var gt = (P + _ | 0) + ((y & 8191) << 13) | 0; + P = (M + (y >>> 13) | 0) + (gt >>> 26) | 0, gt &= 67108863, _ = Math.imul(ke, Tt), y = Math.imul(ke, kt), y = y + Math.imul(rt, Tt) | 0, M = Math.imul(rt, kt), _ = _ + Math.imul(_e, dt) | 0, y = y + Math.imul(_e, Dt) | 0, y = y + Math.imul(Ze, dt) | 0, M = M + Math.imul(Ze, Dt) | 0, _ = _ + Math.imul(De, mt) | 0, y = y + Math.imul(De, Bt) | 0, y = y + Math.imul(je, mt) | 0, M = M + Math.imul(je, Bt) | 0, _ = _ + Math.imul(Me, et) | 0, y = y + Math.imul(Me, $t) | 0, y = y + Math.imul(Oe, et) | 0, M = M + Math.imul(Oe, $t) | 0, _ = _ + Math.imul(Te, V) | 0, y = y + Math.imul(Te, Y) | 0, y = y + Math.imul(Re, V) | 0, M = M + Math.imul(Re, Y) | 0, _ = _ + Math.imul(fe, F) | 0, y = y + Math.imul(fe, ie) | 0, y = y + Math.imul(be, F) | 0, M = M + Math.imul(be, ie) | 0, _ = _ + Math.imul(re, me) | 0, y = y + Math.imul(re, Ee) | 0, y = y + Math.imul(he, me) | 0, M = M + Math.imul(he, Ee) | 0; + var _t = (P + _ | 0) + ((y & 8191) << 13) | 0; + P = (M + (y >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, _ = Math.imul(ke, dt), y = Math.imul(ke, Dt), y = y + Math.imul(rt, dt) | 0, M = Math.imul(rt, Dt), _ = _ + Math.imul(_e, mt) | 0, y = y + Math.imul(_e, Bt) | 0, y = y + Math.imul(Ze, mt) | 0, M = M + Math.imul(Ze, Bt) | 0, _ = _ + Math.imul(De, et) | 0, y = y + Math.imul(De, $t) | 0, y = y + Math.imul(je, et) | 0, M = M + Math.imul(je, $t) | 0, _ = _ + Math.imul(Me, V) | 0, y = y + Math.imul(Me, Y) | 0, y = y + Math.imul(Oe, V) | 0, M = M + Math.imul(Oe, Y) | 0, _ = _ + Math.imul(Te, F) | 0, y = y + Math.imul(Te, ie) | 0, y = y + Math.imul(Re, F) | 0, M = M + Math.imul(Re, ie) | 0, _ = _ + Math.imul(fe, me) | 0, y = y + Math.imul(fe, Ee) | 0, y = y + Math.imul(be, me) | 0, M = M + Math.imul(be, Ee) | 0; + var at = (P + _ | 0) + ((y & 8191) << 13) | 0; + P = (M + (y >>> 13) | 0) + (at >>> 26) | 0, at &= 67108863, _ = Math.imul(ke, mt), y = Math.imul(ke, Bt), y = y + Math.imul(rt, mt) | 0, M = Math.imul(rt, Bt), _ = _ + Math.imul(_e, et) | 0, y = y + Math.imul(_e, $t) | 0, y = y + Math.imul(Ze, et) | 0, M = M + Math.imul(Ze, $t) | 0, _ = _ + Math.imul(De, V) | 0, y = y + Math.imul(De, Y) | 0, y = y + Math.imul(je, V) | 0, M = M + Math.imul(je, Y) | 0, _ = _ + Math.imul(Me, F) | 0, y = y + Math.imul(Me, ie) | 0, y = y + Math.imul(Oe, F) | 0, M = M + Math.imul(Oe, ie) | 0, _ = _ + Math.imul(Te, me) | 0, y = y + Math.imul(Te, Ee) | 0, y = y + Math.imul(Re, me) | 0, M = M + Math.imul(Re, Ee) | 0; + var yt = (P + _ | 0) + ((y & 8191) << 13) | 0; + P = (M + (y >>> 13) | 0) + (yt >>> 26) | 0, yt &= 67108863, _ = Math.imul(ke, et), y = Math.imul(ke, $t), y = y + Math.imul(rt, et) | 0, M = Math.imul(rt, $t), _ = _ + Math.imul(_e, V) | 0, y = y + Math.imul(_e, Y) | 0, y = y + Math.imul(Ze, V) | 0, M = M + Math.imul(Ze, Y) | 0, _ = _ + Math.imul(De, F) | 0, y = y + Math.imul(De, ie) | 0, y = y + Math.imul(je, F) | 0, M = M + Math.imul(je, ie) | 0, _ = _ + Math.imul(Me, me) | 0, y = y + Math.imul(Me, Ee) | 0, y = y + Math.imul(Oe, me) | 0, M = M + Math.imul(Oe, Ee) | 0; + var ut = (P + _ | 0) + ((y & 8191) << 13) | 0; + P = (M + (y >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, _ = Math.imul(ke, V), y = Math.imul(ke, Y), y = y + Math.imul(rt, V) | 0, M = Math.imul(rt, Y), _ = _ + Math.imul(_e, F) | 0, y = y + Math.imul(_e, ie) | 0, y = y + Math.imul(Ze, F) | 0, M = M + Math.imul(Ze, ie) | 0, _ = _ + Math.imul(De, me) | 0, y = y + Math.imul(De, Ee) | 0, y = y + Math.imul(je, me) | 0, M = M + Math.imul(je, Ee) | 0; + var it = (P + _ | 0) + ((y & 8191) << 13) | 0; + P = (M + (y >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, _ = Math.imul(ke, F), y = Math.imul(ke, ie), y = y + Math.imul(rt, F) | 0, M = Math.imul(rt, ie), _ = _ + Math.imul(_e, me) | 0, y = y + Math.imul(_e, Ee) | 0, y = y + Math.imul(Ze, me) | 0, M = M + Math.imul(Ze, Ee) | 0; + var Se = (P + _ | 0) + ((y & 8191) << 13) | 0; + P = (M + (y >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, _ = Math.imul(ke, me), y = Math.imul(ke, Ee), y = y + Math.imul(rt, me) | 0, M = Math.imul(rt, Ee); + var Pe = (P + _ | 0) + ((y & 8191) << 13) | 0; + return P = (M + (y >>> 13) | 0) + (Pe >>> 26) | 0, Pe &= 67108863, w[0] = Le, w[1] = Ie, w[2] = Qe, w[3] = Xe, w[4] = tt, w[5] = st, w[6] = vt, w[7] = Ct, w[8] = Mt, w[9] = wt, w[10] = Rt, w[11] = gt, w[12] = _t, w[13] = at, w[14] = yt, w[15] = ut, w[16] = it, w[17] = Se, w[18] = Pe, P !== 0 && (w[19] = P, l.length++), l; + }; + Math.imul || (C = S); + function D(K, E, b) { + b.negative = E.negative ^ K.negative, b.length = K.length + E.length; + for (var l = 0, p = 0, m = 0; m < b.length - 1; m++) { + var w = p; + p = 0; + for (var P = l & 67108863, _ = Math.min(m, E.length - 1), y = Math.max(0, m - K.length + 1); y <= _; y++) { + var M = m - y, I = K.words[M] | 0, q = E.words[y] | 0, ce = I * q, L = ce & 67108863; + w = w + (ce / 67108864 | 0) | 0, L = L + P | 0, P = L & 67108863, w = w + (L >>> 26) | 0, p += w >>> 26, w &= 67108863; + } + b.words[m] = P, l = w, w = p; + } + return l !== 0 ? b.words[m] = l : b.length--, b.strip(); + } + function $(K, E, b) { + var l = new N(); + return l.mulp(K, E, b); + } + s.prototype.mulTo = function(E, b) { + var l, p = this.length + E.length; + return this.length === 10 && E.length === 10 ? l = C(this, E, b) : p < 63 ? l = S(this, E, b) : p < 1024 ? l = D(this, E, b) : l = $(this, E, b), l; + }; + function N(K, E) { + this.x = K, this.y = E; + } + N.prototype.makeRBT = function(E) { + for (var b = new Array(E), l = s.prototype._countBits(E) - 1, p = 0; p < E; p++) + b[p] = this.revBin(p, l, E); + return b; + }, N.prototype.revBin = function(E, b, l) { + if (E === 0 || E === l - 1) return E; + for (var p = 0, m = 0; m < b; m++) + p |= (E & 1) << b - m - 1, E >>= 1; + return p; + }, N.prototype.permute = function(E, b, l, p, m, w) { + for (var P = 0; P < w; P++) + p[P] = b[E[P]], m[P] = l[E[P]]; + }, N.prototype.transform = function(E, b, l, p, m, w) { + this.permute(w, E, b, l, p, m); + for (var P = 1; P < m; P <<= 1) + for (var _ = P << 1, y = Math.cos(2 * Math.PI / _), M = Math.sin(2 * Math.PI / _), I = 0; I < m; I += _) + for (var q = y, ce = M, L = 0; L < P; L++) { + var oe = l[I + L], Q = p[I + L], X = l[I + L + P], ee = p[I + L + P], O = q * X - ce * ee; + ee = q * ee + ce * X, X = O, l[I + L] = oe + X, p[I + L] = Q + ee, l[I + L + P] = oe - X, p[I + L + P] = Q - ee, L !== _ && (O = y * q - M * ce, ce = y * ce + M * q, q = O); + } + }, N.prototype.guessLen13b = function(E, b) { + var l = Math.max(b, E) | 1, p = l & 1, m = 0; + for (l = l / 2 | 0; l; l = l >>> 1) + m++; + return 1 << m + 1 + p; + }, N.prototype.conjugate = function(E, b, l) { + if (!(l <= 1)) + for (var p = 0; p < l / 2; p++) { + var m = E[p]; + E[p] = E[l - p - 1], E[l - p - 1] = m, m = b[p], b[p] = -b[l - p - 1], b[l - p - 1] = -m; + } + }, N.prototype.normalize13b = function(E, b) { + for (var l = 0, p = 0; p < b / 2; p++) { + var m = Math.round(E[2 * p + 1] / b) * 8192 + Math.round(E[2 * p] / b) + l; + E[p] = m & 67108863, m < 67108864 ? l = 0 : l = m / 67108864 | 0; + } + return E; + }, N.prototype.convert13b = function(E, b, l, p) { + for (var m = 0, w = 0; w < b; w++) + m = m + (E[w] | 0), l[2 * w] = m & 8191, m = m >>> 13, l[2 * w + 1] = m & 8191, m = m >>> 13; + for (w = 2 * b; w < p; ++w) + l[w] = 0; + n(m === 0), n((m & -8192) === 0); + }, N.prototype.stub = function(E) { + for (var b = new Array(E), l = 0; l < E; l++) + b[l] = 0; + return b; + }, N.prototype.mulp = function(E, b, l) { + var p = 2 * this.guessLen13b(E.length, b.length), m = this.makeRBT(p), w = this.stub(p), P = new Array(p), _ = new Array(p), y = new Array(p), M = new Array(p), I = new Array(p), q = new Array(p), ce = l.words; + ce.length = p, this.convert13b(E.words, E.length, P, p), this.convert13b(b.words, b.length, M, p), this.transform(P, w, _, y, p, m), this.transform(M, w, I, q, p, m); + for (var L = 0; L < p; L++) { + var oe = _[L] * I[L] - y[L] * q[L]; + y[L] = _[L] * q[L] + y[L] * I[L], _[L] = oe; + } + return this.conjugate(_, y, p), this.transform(_, y, ce, w, p, m), this.conjugate(ce, w, p), this.normalize13b(ce, p), l.negative = E.negative ^ b.negative, l.length = E.length + b.length, l.strip(); + }, s.prototype.mul = function(E) { + var b = new s(null); + return b.words = new Array(this.length + E.length), this.mulTo(E, b); + }, s.prototype.mulf = function(E) { + var b = new s(null); + return b.words = new Array(this.length + E.length), $(this, E, b); + }, s.prototype.imul = function(E) { + return this.clone().mulTo(E, this); + }, s.prototype.imuln = function(E) { + n(typeof E == "number"), n(E < 67108864); + for (var b = 0, l = 0; l < this.length; l++) { + var p = (this.words[l] | 0) * E, m = (p & 67108863) + (b & 67108863); + b >>= 26, b += p / 67108864 | 0, b += m >>> 26, this.words[l] = m & 67108863; + } + return b !== 0 && (this.words[l] = b, this.length++), this; + }, s.prototype.muln = function(E) { + return this.clone().imuln(E); + }, s.prototype.sqr = function() { + return this.mul(this); + }, s.prototype.isqr = function() { + return this.imul(this.clone()); + }, s.prototype.pow = function(E) { + var b = x(E); + if (b.length === 0) return new s(1); + for (var l = this, p = 0; p < b.length && b[p] === 0; p++, l = l.sqr()) + ; + if (++p < b.length) + for (var m = l.sqr(); p < b.length; p++, m = m.sqr()) + b[p] !== 0 && (l = l.mul(m)); + return l; + }, s.prototype.iushln = function(E) { + n(typeof E == "number" && E >= 0); + var b = E % 26, l = (E - b) / 26, p = 67108863 >>> 26 - b << 26 - b, m; + if (b !== 0) { + var w = 0; + for (m = 0; m < this.length; m++) { + var P = this.words[m] & p, _ = (this.words[m] | 0) - P << b; + this.words[m] = _ | w, w = P >>> 26 - b; + } + w && (this.words[m] = w, this.length++); + } + if (l !== 0) { + for (m = this.length - 1; m >= 0; m--) + this.words[m + l] = this.words[m]; + for (m = 0; m < l; m++) + this.words[m] = 0; + this.length += l; + } + return this.strip(); + }, s.prototype.ishln = function(E) { + return n(this.negative === 0), this.iushln(E); + }, s.prototype.iushrn = function(E, b, l) { + n(typeof E == "number" && E >= 0); + var p; + b ? p = (b - b % 26) / 26 : p = 0; + var m = E % 26, w = Math.min((E - m) / 26, this.length), P = 67108863 ^ 67108863 >>> m << m, _ = l; + if (p -= w, p = Math.max(0, p), _) { + for (var y = 0; y < w; y++) + _.words[y] = this.words[y]; + _.length = w; + } + if (w !== 0) if (this.length > w) + for (this.length -= w, y = 0; y < this.length; y++) + this.words[y] = this.words[y + w]; + else + this.words[0] = 0, this.length = 1; + var M = 0; + for (y = this.length - 1; y >= 0 && (M !== 0 || y >= p); y--) { + var I = this.words[y] | 0; + this.words[y] = M << 26 - m | I >>> m, M = I & P; + } + return _ && M !== 0 && (_.words[_.length++] = M), this.length === 0 && (this.words[0] = 0, this.length = 1), this.strip(); + }, s.prototype.ishrn = function(E, b, l) { + return n(this.negative === 0), this.iushrn(E, b, l); + }, s.prototype.shln = function(E) { + return this.clone().ishln(E); + }, s.prototype.ushln = function(E) { + return this.clone().iushln(E); + }, s.prototype.shrn = function(E) { + return this.clone().ishrn(E); + }, s.prototype.ushrn = function(E) { + return this.clone().iushrn(E); + }, s.prototype.testn = function(E) { + n(typeof E == "number" && E >= 0); + var b = E % 26, l = (E - b) / 26, p = 1 << b; + if (this.length <= l) return !1; + var m = this.words[l]; + return !!(m & p); + }, s.prototype.imaskn = function(E) { + n(typeof E == "number" && E >= 0); + var b = E % 26, l = (E - b) / 26; + if (n(this.negative === 0, "imaskn works only with positive numbers"), this.length <= l) + return this; + if (b !== 0 && l++, this.length = Math.min(l, this.length), b !== 0) { + var p = 67108863 ^ 67108863 >>> b << b; + this.words[this.length - 1] &= p; + } + return this.strip(); + }, s.prototype.maskn = function(E) { + return this.clone().imaskn(E); + }, s.prototype.iaddn = function(E) { + return n(typeof E == "number"), n(E < 67108864), E < 0 ? this.isubn(-E) : this.negative !== 0 ? this.length === 1 && (this.words[0] | 0) < E ? (this.words[0] = E - (this.words[0] | 0), this.negative = 0, this) : (this.negative = 0, this.isubn(E), this.negative = 1, this) : this._iaddn(E); + }, s.prototype._iaddn = function(E) { + this.words[0] += E; + for (var b = 0; b < this.length && this.words[b] >= 67108864; b++) + this.words[b] -= 67108864, b === this.length - 1 ? this.words[b + 1] = 1 : this.words[b + 1]++; + return this.length = Math.max(this.length, b + 1), this; + }, s.prototype.isubn = function(E) { + if (n(typeof E == "number"), n(E < 67108864), E < 0) return this.iaddn(-E); + if (this.negative !== 0) + return this.negative = 0, this.iaddn(E), this.negative = 1, this; + if (this.words[0] -= E, this.length === 1 && this.words[0] < 0) + this.words[0] = -this.words[0], this.negative = 1; + else + for (var b = 0; b < this.length && this.words[b] < 0; b++) + this.words[b] += 67108864, this.words[b + 1] -= 1; + return this.strip(); + }, s.prototype.addn = function(E) { + return this.clone().iaddn(E); + }, s.prototype.subn = function(E) { + return this.clone().isubn(E); + }, s.prototype.iabs = function() { + return this.negative = 0, this; + }, s.prototype.abs = function() { + return this.clone().iabs(); + }, s.prototype._ishlnsubmul = function(E, b, l) { + var p = E.length + l, m; + this._expand(p); + var w, P = 0; + for (m = 0; m < E.length; m++) { + w = (this.words[m + l] | 0) + P; + var _ = (E.words[m] | 0) * b; + w -= _ & 67108863, P = (w >> 26) - (_ / 67108864 | 0), this.words[m + l] = w & 67108863; + } + for (; m < this.length - l; m++) + w = (this.words[m + l] | 0) + P, P = w >> 26, this.words[m + l] = w & 67108863; + if (P === 0) return this.strip(); + for (n(P === -1), P = 0, m = 0; m < this.length; m++) + w = -(this.words[m] | 0) + P, P = w >> 26, this.words[m] = w & 67108863; + return this.negative = 1, this.strip(); + }, s.prototype._wordDiv = function(E, b) { + var l = this.length - E.length, p = this.clone(), m = E, w = m.words[m.length - 1] | 0, P = this._countBits(w); + l = 26 - P, l !== 0 && (m = m.ushln(l), p.iushln(l), w = m.words[m.length - 1] | 0); + var _ = p.length - m.length, y; + if (b !== "mod") { + y = new s(null), y.length = _ + 1, y.words = new Array(y.length); + for (var M = 0; M < y.length; M++) + y.words[M] = 0; + } + var I = p.clone()._ishlnsubmul(m, 1, _); + I.negative === 0 && (p = I, y && (y.words[_] = 1)); + for (var q = _ - 1; q >= 0; q--) { + var ce = (p.words[m.length + q] | 0) * 67108864 + (p.words[m.length + q - 1] | 0); + for (ce = Math.min(ce / w | 0, 67108863), p._ishlnsubmul(m, ce, q); p.negative !== 0; ) + ce--, p.negative = 0, p._ishlnsubmul(m, 1, q), p.isZero() || (p.negative ^= 1); + y && (y.words[q] = ce); + } + return y && y.strip(), p.strip(), b !== "div" && l !== 0 && p.iushrn(l), { + div: y || null, + mod: p + }; + }, s.prototype.divmod = function(E, b, l) { + if (n(!E.isZero()), this.isZero()) + return { + div: new s(0), + mod: new s(0) + }; + var p, m, w; + return this.negative !== 0 && E.negative === 0 ? (w = this.neg().divmod(E, b), b !== "mod" && (p = w.div.neg()), b !== "div" && (m = w.mod.neg(), l && m.negative !== 0 && m.iadd(E)), { + div: p, + mod: m + }) : this.negative === 0 && E.negative !== 0 ? (w = this.divmod(E.neg(), b), b !== "mod" && (p = w.div.neg()), { + div: p, + mod: w.mod + }) : (this.negative & E.negative) !== 0 ? (w = this.neg().divmod(E.neg(), b), b !== "div" && (m = w.mod.neg(), l && m.negative !== 0 && m.isub(E)), { + div: w.div, + mod: m + }) : E.length > this.length || this.cmp(E) < 0 ? { + div: new s(0), + mod: this + } : E.length === 1 ? b === "div" ? { + div: this.divn(E.words[0]), + mod: null + } : b === "mod" ? { + div: null, + mod: new s(this.modn(E.words[0])) + } : { + div: this.divn(E.words[0]), + mod: new s(this.modn(E.words[0])) + } : this._wordDiv(E, b); + }, s.prototype.div = function(E) { + return this.divmod(E, "div", !1).div; + }, s.prototype.mod = function(E) { + return this.divmod(E, "mod", !1).mod; + }, s.prototype.umod = function(E) { + return this.divmod(E, "mod", !0).mod; + }, s.prototype.divRound = function(E) { + var b = this.divmod(E); + if (b.mod.isZero()) return b.div; + var l = b.div.negative !== 0 ? b.mod.isub(E) : b.mod, p = E.ushrn(1), m = E.andln(1), w = l.cmp(p); + return w < 0 || m === 1 && w === 0 ? b.div : b.div.negative !== 0 ? b.div.isubn(1) : b.div.iaddn(1); + }, s.prototype.modn = function(E) { + n(E <= 67108863); + for (var b = (1 << 26) % E, l = 0, p = this.length - 1; p >= 0; p--) + l = (b * l + (this.words[p] | 0)) % E; + return l; + }, s.prototype.idivn = function(E) { + n(E <= 67108863); + for (var b = 0, l = this.length - 1; l >= 0; l--) { + var p = (this.words[l] | 0) + b * 67108864; + this.words[l] = p / E | 0, b = p % E; + } + return this.strip(); + }, s.prototype.divn = function(E) { + return this.clone().idivn(E); + }, s.prototype.egcd = function(E) { + n(E.negative === 0), n(!E.isZero()); + var b = this, l = E.clone(); + b.negative !== 0 ? b = b.umod(E) : b = b.clone(); + for (var p = new s(1), m = new s(0), w = new s(0), P = new s(1), _ = 0; b.isEven() && l.isEven(); ) + b.iushrn(1), l.iushrn(1), ++_; + for (var y = l.clone(), M = b.clone(); !b.isZero(); ) { + for (var I = 0, q = 1; (b.words[0] & q) === 0 && I < 26; ++I, q <<= 1) ; + if (I > 0) + for (b.iushrn(I); I-- > 0; ) + (p.isOdd() || m.isOdd()) && (p.iadd(y), m.isub(M)), p.iushrn(1), m.iushrn(1); + for (var ce = 0, L = 1; (l.words[0] & L) === 0 && ce < 26; ++ce, L <<= 1) ; + if (ce > 0) + for (l.iushrn(ce); ce-- > 0; ) + (w.isOdd() || P.isOdd()) && (w.iadd(y), P.isub(M)), w.iushrn(1), P.iushrn(1); + b.cmp(l) >= 0 ? (b.isub(l), p.isub(w), m.isub(P)) : (l.isub(b), w.isub(p), P.isub(m)); + } + return { + a: w, + b: P, + gcd: l.iushln(_) + }; + }, s.prototype._invmp = function(E) { + n(E.negative === 0), n(!E.isZero()); + var b = this, l = E.clone(); + b.negative !== 0 ? b = b.umod(E) : b = b.clone(); + for (var p = new s(1), m = new s(0), w = l.clone(); b.cmpn(1) > 0 && l.cmpn(1) > 0; ) { + for (var P = 0, _ = 1; (b.words[0] & _) === 0 && P < 26; ++P, _ <<= 1) ; + if (P > 0) + for (b.iushrn(P); P-- > 0; ) + p.isOdd() && p.iadd(w), p.iushrn(1); + for (var y = 0, M = 1; (l.words[0] & M) === 0 && y < 26; ++y, M <<= 1) ; + if (y > 0) + for (l.iushrn(y); y-- > 0; ) + m.isOdd() && m.iadd(w), m.iushrn(1); + b.cmp(l) >= 0 ? (b.isub(l), p.isub(m)) : (l.isub(b), m.isub(p)); + } + var I; + return b.cmpn(1) === 0 ? I = p : I = m, I.cmpn(0) < 0 && I.iadd(E), I; + }, s.prototype.gcd = function(E) { + if (this.isZero()) return E.abs(); + if (E.isZero()) return this.abs(); + var b = this.clone(), l = E.clone(); + b.negative = 0, l.negative = 0; + for (var p = 0; b.isEven() && l.isEven(); p++) + b.iushrn(1), l.iushrn(1); + do { + for (; b.isEven(); ) + b.iushrn(1); + for (; l.isEven(); ) + l.iushrn(1); + var m = b.cmp(l); + if (m < 0) { + var w = b; + b = l, l = w; + } else if (m === 0 || l.cmpn(1) === 0) + break; + b.isub(l); + } while (!0); + return l.iushln(p); + }, s.prototype.invm = function(E) { + return this.egcd(E).a.umod(E); + }, s.prototype.isEven = function() { + return (this.words[0] & 1) === 0; + }, s.prototype.isOdd = function() { + return (this.words[0] & 1) === 1; + }, s.prototype.andln = function(E) { + return this.words[0] & E; + }, s.prototype.bincn = function(E) { + n(typeof E == "number"); + var b = E % 26, l = (E - b) / 26, p = 1 << b; + if (this.length <= l) + return this._expand(l + 1), this.words[l] |= p, this; + for (var m = p, w = l; m !== 0 && w < this.length; w++) { + var P = this.words[w] | 0; + P += m, m = P >>> 26, P &= 67108863, this.words[w] = P; + } + return m !== 0 && (this.words[w] = m, this.length++), this; + }, s.prototype.isZero = function() { + return this.length === 1 && this.words[0] === 0; + }, s.prototype.cmpn = function(E) { + var b = E < 0; + if (this.negative !== 0 && !b) return -1; + if (this.negative === 0 && b) return 1; + this.strip(); + var l; + if (this.length > 1) + l = 1; + else { + b && (E = -E), n(E <= 67108863, "Number is too big"); + var p = this.words[0] | 0; + l = p === E ? 0 : p < E ? -1 : 1; + } + return this.negative !== 0 ? -l | 0 : l; + }, s.prototype.cmp = function(E) { + if (this.negative !== 0 && E.negative === 0) return -1; + if (this.negative === 0 && E.negative !== 0) return 1; + var b = this.ucmp(E); + return this.negative !== 0 ? -b | 0 : b; + }, s.prototype.ucmp = function(E) { + if (this.length > E.length) return 1; + if (this.length < E.length) return -1; + for (var b = 0, l = this.length - 1; l >= 0; l--) { + var p = this.words[l] | 0, m = E.words[l] | 0; + if (p !== m) { + p < m ? b = -1 : p > m && (b = 1); + break; + } + } + return b; + }, s.prototype.gtn = function(E) { + return this.cmpn(E) === 1; + }, s.prototype.gt = function(E) { + return this.cmp(E) === 1; + }, s.prototype.gten = function(E) { + return this.cmpn(E) >= 0; + }, s.prototype.gte = function(E) { + return this.cmp(E) >= 0; + }, s.prototype.ltn = function(E) { + return this.cmpn(E) === -1; + }, s.prototype.lt = function(E) { + return this.cmp(E) === -1; + }, s.prototype.lten = function(E) { + return this.cmpn(E) <= 0; + }, s.prototype.lte = function(E) { + return this.cmp(E) <= 0; + }, s.prototype.eqn = function(E) { + return this.cmpn(E) === 0; + }, s.prototype.eq = function(E) { + return this.cmp(E) === 0; + }, s.red = function(E) { + return new J(E); + }, s.prototype.toRed = function(E) { + return n(!this.red, "Already a number in reduction context"), n(this.negative === 0, "red works only with positives"), E.convertTo(this)._forceRed(E); + }, s.prototype.fromRed = function() { + return n(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom(this); + }, s.prototype._forceRed = function(E) { + return this.red = E, this; + }, s.prototype.forceRed = function(E) { + return n(!this.red, "Already a number in reduction context"), this._forceRed(E); + }, s.prototype.redAdd = function(E) { + return n(this.red, "redAdd works only with red numbers"), this.red.add(this, E); + }, s.prototype.redIAdd = function(E) { + return n(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, E); + }, s.prototype.redSub = function(E) { + return n(this.red, "redSub works only with red numbers"), this.red.sub(this, E); + }, s.prototype.redISub = function(E) { + return n(this.red, "redISub works only with red numbers"), this.red.isub(this, E); + }, s.prototype.redShl = function(E) { + return n(this.red, "redShl works only with red numbers"), this.red.shl(this, E); + }, s.prototype.redMul = function(E) { + return n(this.red, "redMul works only with red numbers"), this.red._verify2(this, E), this.red.mul(this, E); + }, s.prototype.redIMul = function(E) { + return n(this.red, "redMul works only with red numbers"), this.red._verify2(this, E), this.red.imul(this, E); + }, s.prototype.redSqr = function() { + return n(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr(this); + }, s.prototype.redISqr = function() { + return n(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr(this); + }, s.prototype.redSqrt = function() { + return n(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt(this); + }, s.prototype.redInvm = function() { + return n(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm(this); + }, s.prototype.redNeg = function() { + return n(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg(this); + }, s.prototype.redPow = function(E) { + return n(this.red && !E.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, E); + }; + var z = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + function k(K, E) { + this.name = K, this.p = new s(E, 16), this.n = this.p.bitLength(), this.k = new s(1).iushln(this.n).isub(this.p), this.tmp = this._tmp(); + } + k.prototype._tmp = function() { + var E = new s(null); + return E.words = new Array(Math.ceil(this.n / 13)), E; + }, k.prototype.ireduce = function(E) { + var b = E, l; + do + this.split(b, this.tmp), b = this.imulK(b), b = b.iadd(this.tmp), l = b.bitLength(); + while (l > this.n); + var p = l < this.n ? -1 : b.ucmp(this.p); + return p === 0 ? (b.words[0] = 0, b.length = 1) : p > 0 ? b.isub(this.p) : b.strip !== void 0 ? b.strip() : b._strip(), b; + }, k.prototype.split = function(E, b) { + E.iushrn(this.n, 0, b); + }, k.prototype.imulK = function(E) { + return E.imul(this.k); + }; + function B() { + k.call( + this, + "k256", + "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f" + ); + } + i(B, k), B.prototype.split = function(E, b) { + for (var l = 4194303, p = Math.min(E.length, 9), m = 0; m < p; m++) + b.words[m] = E.words[m]; + if (b.length = p, E.length <= 9) { + E.words[0] = 0, E.length = 1; + return; + } + var w = E.words[9]; + for (b.words[b.length++] = w & l, m = 10; m < E.length; m++) { + var P = E.words[m] | 0; + E.words[m - 10] = (P & l) << 4 | w >>> 22, w = P; + } + w >>>= 22, E.words[m - 10] = w, w === 0 && E.length > 10 ? E.length -= 10 : E.length -= 9; + }, B.prototype.imulK = function(E) { + E.words[E.length] = 0, E.words[E.length + 1] = 0, E.length += 2; + for (var b = 0, l = 0; l < E.length; l++) { + var p = E.words[l] | 0; + b += p * 977, E.words[l] = b & 67108863, b = p * 64 + (b / 67108864 | 0); + } + return E.words[E.length - 1] === 0 && (E.length--, E.words[E.length - 1] === 0 && E.length--), E; + }; + function U() { + k.call( + this, + "p224", + "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001" + ); + } + i(U, k); + function R() { + k.call( + this, + "p192", + "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff" + ); + } + i(R, k); + function W() { + k.call( + this, + "25519", + "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed" + ); + } + i(W, k), W.prototype.imulK = function(E) { + for (var b = 0, l = 0; l < E.length; l++) { + var p = (E.words[l] | 0) * 19 + b, m = p & 67108863; + p >>>= 26, E.words[l] = m, b = p; + } + return b !== 0 && (E.words[E.length++] = b), E; + }, s._prime = function(E) { + if (z[E]) return z[E]; + var b; + if (E === "k256") + b = new B(); + else if (E === "p224") + b = new U(); + else if (E === "p192") + b = new R(); + else if (E === "p25519") + b = new W(); + else + throw new Error("Unknown prime " + E); + return z[E] = b, b; + }; + function J(K) { + if (typeof K == "string") { + var E = s._prime(K); + this.m = E.p, this.prime = E; + } else + n(K.gtn(1), "modulus must be greater than 1"), this.m = K, this.prime = null; + } + J.prototype._verify1 = function(E) { + n(E.negative === 0, "red works only with positives"), n(E.red, "red works only with red numbers"); + }, J.prototype._verify2 = function(E, b) { + n((E.negative | b.negative) === 0, "red works only with positives"), n( + E.red && E.red === b.red, + "red works only with red numbers" + ); + }, J.prototype.imod = function(E) { + return this.prime ? this.prime.ireduce(E)._forceRed(this) : E.umod(this.m)._forceRed(this); + }, J.prototype.neg = function(E) { + return E.isZero() ? E.clone() : this.m.sub(E)._forceRed(this); + }, J.prototype.add = function(E, b) { + this._verify2(E, b); + var l = E.add(b); + return l.cmp(this.m) >= 0 && l.isub(this.m), l._forceRed(this); + }, J.prototype.iadd = function(E, b) { + this._verify2(E, b); + var l = E.iadd(b); + return l.cmp(this.m) >= 0 && l.isub(this.m), l; + }, J.prototype.sub = function(E, b) { + this._verify2(E, b); + var l = E.sub(b); + return l.cmpn(0) < 0 && l.iadd(this.m), l._forceRed(this); + }, J.prototype.isub = function(E, b) { + this._verify2(E, b); + var l = E.isub(b); + return l.cmpn(0) < 0 && l.iadd(this.m), l; + }, J.prototype.shl = function(E, b) { + return this._verify1(E), this.imod(E.ushln(b)); + }, J.prototype.imul = function(E, b) { + return this._verify2(E, b), this.imod(E.imul(b)); + }, J.prototype.mul = function(E, b) { + return this._verify2(E, b), this.imod(E.mul(b)); + }, J.prototype.isqr = function(E) { + return this.imul(E, E.clone()); + }, J.prototype.sqr = function(E) { + return this.mul(E, E); + }, J.prototype.sqrt = function(E) { + if (E.isZero()) return E.clone(); + var b = this.m.andln(3); + if (n(b % 2 === 1), b === 3) { + var l = this.m.add(new s(1)).iushrn(2); + return this.pow(E, l); + } + for (var p = this.m.subn(1), m = 0; !p.isZero() && p.andln(1) === 0; ) + m++, p.iushrn(1); + n(!p.isZero()); + var w = new s(1).toRed(this), P = w.redNeg(), _ = this.m.subn(1).iushrn(1), y = this.m.bitLength(); + for (y = new s(2 * y * y).toRed(this); this.pow(y, _).cmp(P) !== 0; ) + y.redIAdd(P); + for (var M = this.pow(y, p), I = this.pow(E, p.addn(1).iushrn(1)), q = this.pow(E, p), ce = m; q.cmp(w) !== 0; ) { + for (var L = q, oe = 0; L.cmp(w) !== 0; oe++) + L = L.redSqr(); + n(oe < ce); + var Q = this.pow(M, new s(1).iushln(ce - oe - 1)); + I = I.redMul(Q), M = Q.redSqr(), q = q.redMul(M), ce = oe; + } + return I; + }, J.prototype.invm = function(E) { + var b = E._invmp(this.m); + return b.negative !== 0 ? (b.negative = 0, this.imod(b).redNeg()) : this.imod(b); + }, J.prototype.pow = function(E, b) { + if (b.isZero()) return new s(1).toRed(this); + if (b.cmpn(1) === 0) return E.clone(); + var l = 4, p = new Array(1 << l); + p[0] = new s(1).toRed(this), p[1] = E; + for (var m = 2; m < p.length; m++) + p[m] = this.mul(p[m - 1], E); + var w = p[0], P = 0, _ = 0, y = b.bitLength() % 26; + for (y === 0 && (y = 26), m = b.length - 1; m >= 0; m--) { + for (var M = b.words[m], I = y - 1; I >= 0; I--) { + var q = M >> I & 1; + if (w !== p[0] && (w = this.sqr(w)), q === 0 && P === 0) { + _ = 0; + continue; + } + P <<= 1, P |= q, _++, !(_ !== l && (m !== 0 || I !== 0)) && (w = this.mul(w, p[P]), _ = 0, P = 0); + } + y = 26; + } + return w; + }, J.prototype.convertTo = function(E) { + var b = E.umod(this.m); + return b === E ? b.clone() : b; + }, J.prototype.convertFrom = function(E) { + var b = E.clone(); + return b.red = null, b; + }, s.mont = function(E) { + return new ne(E); + }; + function ne(K) { + J.call(this, K), this.shift = this.m.bitLength(), this.shift % 26 !== 0 && (this.shift += 26 - this.shift % 26), this.r = new s(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this.rinv = this.r._invmp(this.m), this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv = this.minv.umod(this.r), this.minv = this.r.sub(this.minv); + } + i(ne, J), ne.prototype.convertTo = function(E) { + return this.imod(E.ushln(this.shift)); + }, ne.prototype.convertFrom = function(E) { + var b = this.imod(E.mul(this.rinv)); + return b.red = null, b; + }, ne.prototype.imul = function(E, b) { + if (E.isZero() || b.isZero()) + return E.words[0] = 0, E.length = 1, E; + var l = E.imul(b), p = l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), m = l.isub(p).iushrn(this.shift), w = m; + return m.cmp(this.m) >= 0 ? w = m.isub(this.m) : m.cmpn(0) < 0 && (w = m.iadd(this.m)), w._forceRed(this); + }, ne.prototype.mul = function(E, b) { + if (E.isZero() || b.isZero()) return new s(0)._forceRed(this); + var l = E.mul(b), p = l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), m = l.isub(p).iushrn(this.shift), w = m; + return m.cmp(this.m) >= 0 ? w = m.isub(this.m) : m.cmpn(0) < 0 && (w = m.iadd(this.m)), w._forceRed(this); + }, ne.prototype.invm = function(E) { + var b = this.imod(E._invmp(this.m).mul(this.r2)); + return b._forceRed(this); + }; + })(t, aF); + })(qh)), qh.exports; +} +var Dg = {}, Cx; +function w8() { + return Cx || (Cx = 1, (function(t) { + var e = t; + function r(s, o) { + if (Array.isArray(s)) + return s.slice(); + if (!s) + return []; + var a = []; + if (typeof s != "string") { + for (var f = 0; f < s.length; f++) + a[f] = s[f] | 0; + return a; + } + if (o === "hex") { + s = s.replace(/[^a-z0-9]+/ig, ""), s.length % 2 !== 0 && (s = "0" + s); + for (var f = 0; f < s.length; f += 2) + a.push(parseInt(s[f] + s[f + 1], 16)); + } else + for (var f = 0; f < s.length; f++) { + var u = s.charCodeAt(f), h = u >> 8, g = u & 255; + h ? a.push(h, g) : a.push(g); + } + return a; + } + e.toArray = r; + function n(s) { + return s.length === 1 ? "0" + s : s; + } + e.zero2 = n; + function i(s) { + for (var o = "", a = 0; a < s.length; a++) + o += n(s[a].toString(16)); + return o; + } + e.toHex = i, e.encode = function(o, a) { + return a === "hex" ? i(o) : o; + }; + })(Dg)), Dg; +} +var Rx; +function Gi() { + return Rx || (Rx = 1, (function(t) { + var e = t, r = go(), n = Wa(), i = w8(); + e.assert = n, e.toArray = i.toArray, e.zero2 = i.zero2, e.toHex = i.toHex, e.encode = i.encode; + function s(h, g, v) { + var x = new Array(Math.max(h.bitLength(), v) + 1), S; + for (S = 0; S < x.length; S += 1) + x[S] = 0; + var C = 1 << g + 1, D = h.clone(); + for (S = 0; S < x.length; S++) { + var $, N = D.andln(C - 1); + D.isOdd() ? (N > (C >> 1) - 1 ? $ = (C >> 1) - N : $ = N, D.isubn($)) : $ = 0, x[S] = $, D.iushrn(1); + } + return x; + } + e.getNAF = s; + function o(h, g) { + var v = [ + [], + [] + ]; + h = h.clone(), g = g.clone(); + for (var x = 0, S = 0, C; h.cmpn(-x) > 0 || g.cmpn(-S) > 0; ) { + var D = h.andln(3) + x & 3, $ = g.andln(3) + S & 3; + D === 3 && (D = -1), $ === 3 && ($ = -1); + var N; + (D & 1) === 0 ? N = 0 : (C = h.andln(7) + x & 7, (C === 3 || C === 5) && $ === 2 ? N = -D : N = D), v[0].push(N); + var z; + ($ & 1) === 0 ? z = 0 : (C = g.andln(7) + S & 7, (C === 3 || C === 5) && D === 2 ? z = -$ : z = $), v[1].push(z), 2 * x === N + 1 && (x = 1 - x), 2 * S === z + 1 && (S = 1 - S), h.iushrn(1), g.iushrn(1); + } + return v; + } + e.getJSF = o; + function a(h, g, v) { + var x = "_" + g; + h.prototype[g] = function() { + return this[x] !== void 0 ? this[x] : this[x] = v.call(this); + }; + } + e.cachedProperty = a; + function f(h) { + return typeof h == "string" ? e.toArray(h, "hex") : h; + } + e.parseBytes = f; + function u(h) { + return new r(h, "hex", "le"); + } + e.intFromLE = u; + })(Tg)), Tg; +} +var _h = { exports: {} }, Tx; +function x8() { + if (Tx) return _h.exports; + Tx = 1; + var t; + _h.exports = function(i) { + return t || (t = new e(null)), t.generate(i); + }; + function e(n) { + this.rand = n; + } + if (_h.exports.Rand = e, e.prototype.generate = function(i) { + return this._rand(i); + }, e.prototype._rand = function(i) { + if (this.rand.getBytes) + return this.rand.getBytes(i); + for (var s = new Uint8Array(i), o = 0; o < s.length; o++) + s[o] = this.rand.getByte(); + return s; + }, typeof self == "object") + self.crypto && self.crypto.getRandomValues ? e.prototype._rand = function(i) { + var s = new Uint8Array(i); + return self.crypto.getRandomValues(s), s; + } : self.msCrypto && self.msCrypto.getRandomValues ? e.prototype._rand = function(i) { + var s = new Uint8Array(i); + return self.msCrypto.getRandomValues(s), s; + } : typeof window == "object" && (e.prototype._rand = function() { + throw new Error("Not implemented yet"); + }); + else + try { + var r = Qf; + if (typeof r.randomBytes != "function") + throw new Error("Not supported"); + e.prototype._rand = function(i) { + return r.randomBytes(i); + }; + } catch { + } + return _h.exports; +} +var Og = {}, Ng, Dx; +function t0() { + if (Dx) return Ng; + Dx = 1; + var t = go(), e = Gi(), r = e.getNAF, n = e.getJSF, i = e.assert; + function s(a, f) { + this.type = a, this.p = new t(f.p, 16), this.red = f.prime ? t.red(f.prime) : t.mont(this.p), this.zero = new t(0).toRed(this.red), this.one = new t(1).toRed(this.red), this.two = new t(2).toRed(this.red), this.n = f.n && new t(f.n, 16), this.g = f.g && this.pointFromJSON(f.g, f.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; + var u = this.n && this.p.div(this.n); + !u || u.cmpn(100) > 0 ? this.redN = null : (this._maxwellTrick = !0, this.redN = this.n.toRed(this.red)); + } + Ng = s, s.prototype.point = function() { + throw new Error("Not implemented"); + }, s.prototype.validate = function() { + throw new Error("Not implemented"); + }, s.prototype._fixedNafMul = function(f, u) { + i(f.precomputed); + var h = f._getDoubles(), g = r(u, 1, this._bitLength), v = (1 << h.step + 1) - (h.step % 2 === 0 ? 2 : 1); + v /= 3; + var x = [], S, C; + for (S = 0; S < g.length; S += h.step) { + C = 0; + for (var D = S + h.step - 1; D >= S; D--) + C = (C << 1) + g[D]; + x.push(C); + } + for (var $ = this.jpoint(null, null, null), N = this.jpoint(null, null, null), z = v; z > 0; z--) { + for (S = 0; S < x.length; S++) + C = x[S], C === z ? N = N.mixedAdd(h.points[S]) : C === -z && (N = N.mixedAdd(h.points[S].neg())); + $ = $.add(N); + } + return $.toP(); + }, s.prototype._wnafMul = function(f, u) { + var h = 4, g = f._getNAFPoints(h); + h = g.wnd; + for (var v = g.points, x = r(u, h, this._bitLength), S = this.jpoint(null, null, null), C = x.length - 1; C >= 0; C--) { + for (var D = 0; C >= 0 && x[C] === 0; C--) + D++; + if (C >= 0 && D++, S = S.dblp(D), C < 0) + break; + var $ = x[C]; + i($ !== 0), f.type === "affine" ? $ > 0 ? S = S.mixedAdd(v[$ - 1 >> 1]) : S = S.mixedAdd(v[-$ - 1 >> 1].neg()) : $ > 0 ? S = S.add(v[$ - 1 >> 1]) : S = S.add(v[-$ - 1 >> 1].neg()); + } + return f.type === "affine" ? S.toP() : S; + }, s.prototype._wnafMulAdd = function(f, u, h, g, v) { + var x = this._wnafT1, S = this._wnafT2, C = this._wnafT3, D = 0, $, N, z; + for ($ = 0; $ < g; $++) { + z = u[$]; + var k = z._getNAFPoints(f); + x[$] = k.wnd, S[$] = k.points; + } + for ($ = g - 1; $ >= 1; $ -= 2) { + var B = $ - 1, U = $; + if (x[B] !== 1 || x[U] !== 1) { + C[B] = r(h[B], x[B], this._bitLength), C[U] = r(h[U], x[U], this._bitLength), D = Math.max(C[B].length, D), D = Math.max(C[U].length, D); + continue; + } + var R = [ + u[B], + /* 1 */ + null, + /* 3 */ + null, + /* 5 */ + u[U] + /* 7 */ + ]; + u[B].y.cmp(u[U].y) === 0 ? (R[1] = u[B].add(u[U]), R[2] = u[B].toJ().mixedAdd(u[U].neg())) : u[B].y.cmp(u[U].y.redNeg()) === 0 ? (R[1] = u[B].toJ().mixedAdd(u[U]), R[2] = u[B].add(u[U].neg())) : (R[1] = u[B].toJ().mixedAdd(u[U]), R[2] = u[B].toJ().mixedAdd(u[U].neg())); + var W = [ + -3, + /* -1 -1 */ + -1, + /* -1 0 */ + -5, + /* -1 1 */ + -7, + /* 0 -1 */ + 0, + /* 0 0 */ + 7, + /* 0 1 */ + 5, + /* 1 -1 */ + 1, + /* 1 0 */ + 3 + /* 1 1 */ + ], J = n(h[B], h[U]); + for (D = Math.max(J[0].length, D), C[B] = new Array(D), C[U] = new Array(D), N = 0; N < D; N++) { + var ne = J[0][N] | 0, K = J[1][N] | 0; + C[B][N] = W[(ne + 1) * 3 + (K + 1)], C[U][N] = 0, S[B] = R; + } + } + var E = this.jpoint(null, null, null), b = this._wnafT4; + for ($ = D; $ >= 0; $--) { + for (var l = 0; $ >= 0; ) { + var p = !0; + for (N = 0; N < g; N++) + b[N] = C[N][$] | 0, b[N] !== 0 && (p = !1); + if (!p) + break; + l++, $--; + } + if ($ >= 0 && l++, E = E.dblp(l), $ < 0) + break; + for (N = 0; N < g; N++) { + var m = b[N]; + m !== 0 && (m > 0 ? z = S[N][m - 1 >> 1] : m < 0 && (z = S[N][-m - 1 >> 1].neg()), z.type === "affine" ? E = E.mixedAdd(z) : E = E.add(z)); + } + } + for ($ = 0; $ < g; $++) + S[$] = null; + return v ? E : E.toP(); + }; + function o(a, f) { + this.curve = a, this.type = f, this.precomputed = null; + } + return s.BasePoint = o, o.prototype.eq = function() { + throw new Error("Not implemented"); + }, o.prototype.validate = function() { + return this.curve.validate(this); + }, s.prototype.decodePoint = function(f, u) { + f = e.toArray(f, u); + var h = this.p.byteLength(); + if ((f[0] === 4 || f[0] === 6 || f[0] === 7) && f.length - 1 === 2 * h) { + f[0] === 6 ? i(f[f.length - 1] % 2 === 0) : f[0] === 7 && i(f[f.length - 1] % 2 === 1); + var g = this.point( + f.slice(1, 1 + h), + f.slice(1 + h, 1 + 2 * h) + ); + return g; + } else if ((f[0] === 2 || f[0] === 3) && f.length - 1 === h) + return this.pointFromX(f.slice(1, 1 + h), f[0] === 3); + throw new Error("Unknown point format"); + }, o.prototype.encodeCompressed = function(f) { + return this.encode(f, !0); + }, o.prototype._encode = function(f) { + var u = this.curve.p.byteLength(), h = this.getX().toArray("be", u); + return f ? [this.getY().isEven() ? 2 : 3].concat(h) : [4].concat(h, this.getY().toArray("be", u)); + }, o.prototype.encode = function(f, u) { + return e.encode(this._encode(u), f); + }, o.prototype.precompute = function(f) { + if (this.precomputed) + return this; + var u = { + doubles: null, + naf: null, + beta: null + }; + return u.naf = this._getNAFPoints(8), u.doubles = this._getDoubles(4, f), u.beta = this._getBeta(), this.precomputed = u, this; + }, o.prototype._hasDoubles = function(f) { + if (!this.precomputed) + return !1; + var u = this.precomputed.doubles; + return u ? u.points.length >= Math.ceil((f.bitLength() + 1) / u.step) : !1; + }, o.prototype._getDoubles = function(f, u) { + if (this.precomputed && this.precomputed.doubles) + return this.precomputed.doubles; + for (var h = [this], g = this, v = 0; v < u; v += f) { + for (var x = 0; x < f; x++) + g = g.dbl(); + h.push(g); + } + return { + step: f, + points: h + }; + }, o.prototype._getNAFPoints = function(f) { + if (this.precomputed && this.precomputed.naf) + return this.precomputed.naf; + for (var u = [this], h = (1 << f) - 1, g = h === 1 ? null : this.dbl(), v = 1; v < h; v++) + u[v] = u[v - 1].add(g); + return { + wnd: f, + points: u + }; + }, o.prototype._getBeta = function() { + return null; + }, o.prototype.dblp = function(f) { + for (var u = this, h = 0; h < f; h++) + u = u.dbl(); + return u; + }, Ng; +} +var Lg, Ox; +function cF() { + if (Ox) return Lg; + Ox = 1; + var t = Gi(), e = go(), r = Jd(), n = t0(), i = t.assert; + function s(f) { + n.call(this, "short", f), this.a = new e(f.a, 16).toRed(this.red), this.b = new e(f.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(f), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); + } + r(s, n), Lg = s, s.prototype._getEndomorphism = function(u) { + if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { + var h, g; + if (u.beta) + h = new e(u.beta, 16).toRed(this.red); + else { + var v = this._getEndoRoots(this.p); + h = v[0].cmp(v[1]) < 0 ? v[0] : v[1], h = h.toRed(this.red); + } + if (u.lambda) + g = new e(u.lambda, 16); + else { + var x = this._getEndoRoots(this.n); + this.g.mul(x[0]).x.cmp(this.g.x.redMul(h)) === 0 ? g = x[0] : (g = x[1], i(this.g.mul(g).x.cmp(this.g.x.redMul(h)) === 0)); + } + var S; + return u.basis ? S = u.basis.map(function(C) { + return { + a: new e(C.a, 16), + b: new e(C.b, 16) + }; + }) : S = this._getEndoBasis(g), { + beta: h, + lambda: g, + basis: S + }; + } + }, s.prototype._getEndoRoots = function(u) { + var h = u === this.p ? this.red : e.mont(u), g = new e(2).toRed(h).redInvm(), v = g.redNeg(), x = new e(3).toRed(h).redNeg().redSqrt().redMul(g), S = v.redAdd(x).fromRed(), C = v.redSub(x).fromRed(); + return [S, C]; + }, s.prototype._getEndoBasis = function(u) { + for (var h = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), g = u, v = this.n.clone(), x = new e(1), S = new e(0), C = new e(0), D = new e(1), $, N, z, k, B, U, R, W = 0, J, ne; g.cmpn(0) !== 0; ) { + var K = v.div(g); + J = v.sub(K.mul(g)), ne = C.sub(K.mul(x)); + var E = D.sub(K.mul(S)); + if (!z && J.cmp(h) < 0) + $ = R.neg(), N = x, z = J.neg(), k = ne; + else if (z && ++W === 2) + break; + R = J, v = g, g = J, C = x, x = ne, D = S, S = E; + } + B = J.neg(), U = ne; + var b = z.sqr().add(k.sqr()), l = B.sqr().add(U.sqr()); + return l.cmp(b) >= 0 && (B = $, U = N), z.negative && (z = z.neg(), k = k.neg()), B.negative && (B = B.neg(), U = U.neg()), [ + { a: z, b: k }, + { a: B, b: U } + ]; + }, s.prototype._endoSplit = function(u) { + var h = this.endo.basis, g = h[0], v = h[1], x = v.b.mul(u).divRound(this.n), S = g.b.neg().mul(u).divRound(this.n), C = x.mul(g.a), D = S.mul(v.a), $ = x.mul(g.b), N = S.mul(v.b), z = u.sub(C).sub(D), k = $.add(N).neg(); + return { k1: z, k2: k }; + }, s.prototype.pointFromX = function(u, h) { + u = new e(u, 16), u.red || (u = u.toRed(this.red)); + var g = u.redSqr().redMul(u).redIAdd(u.redMul(this.a)).redIAdd(this.b), v = g.redSqrt(); + if (v.redSqr().redSub(g).cmp(this.zero) !== 0) + throw new Error("invalid point"); + var x = v.fromRed().isOdd(); + return (h && !x || !h && x) && (v = v.redNeg()), this.point(u, v); + }, s.prototype.validate = function(u) { + if (u.inf) + return !0; + var h = u.x, g = u.y, v = this.a.redMul(h), x = h.redSqr().redMul(h).redIAdd(v).redIAdd(this.b); + return g.redSqr().redISub(x).cmpn(0) === 0; + }, s.prototype._endoWnafMulAdd = function(u, h, g) { + for (var v = this._endoWnafT1, x = this._endoWnafT2, S = 0; S < u.length; S++) { + var C = this._endoSplit(h[S]), D = u[S], $ = D._getBeta(); + C.k1.negative && (C.k1.ineg(), D = D.neg(!0)), C.k2.negative && (C.k2.ineg(), $ = $.neg(!0)), v[S * 2] = D, v[S * 2 + 1] = $, x[S * 2] = C.k1, x[S * 2 + 1] = C.k2; + } + for (var N = this._wnafMulAdd(1, v, x, S * 2, g), z = 0; z < S * 2; z++) + v[z] = null, x[z] = null; + return N; + }; + function o(f, u, h, g) { + n.BasePoint.call(this, f, "affine"), u === null && h === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new e(u, 16), this.y = new e(h, 16), g && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); + } + r(o, n.BasePoint), s.prototype.point = function(u, h, g) { + return new o(this, u, h, g); + }, s.prototype.pointFromJSON = function(u, h) { + return o.fromJSON(this, u, h); + }, o.prototype._getBeta = function() { + if (this.curve.endo) { + var u = this.precomputed; + if (u && u.beta) + return u.beta; + var h = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y); + if (u) { + var g = this.curve, v = function(x) { + return g.point(x.x.redMul(g.endo.beta), x.y); + }; + u.beta = h, h.precomputed = { + beta: null, + naf: u.naf && { + wnd: u.naf.wnd, + points: u.naf.points.map(v) + }, + doubles: u.doubles && { + step: u.doubles.step, + points: u.doubles.points.map(v) + } + }; + } + return h; + } + }, o.prototype.toJSON = function() { + return this.precomputed ? [this.x, this.y, this.precomputed && { + doubles: this.precomputed.doubles && { + step: this.precomputed.doubles.step, + points: this.precomputed.doubles.points.slice(1) + }, + naf: this.precomputed.naf && { + wnd: this.precomputed.naf.wnd, + points: this.precomputed.naf.points.slice(1) + } + }] : [this.x, this.y]; + }, o.fromJSON = function(u, h, g) { + typeof h == "string" && (h = JSON.parse(h)); + var v = u.point(h[0], h[1], g); + if (!h[2]) + return v; + function x(C) { + return u.point(C[0], C[1], g); + } + var S = h[2]; + return v.precomputed = { + beta: null, + doubles: S.doubles && { + step: S.doubles.step, + points: [v].concat(S.doubles.points.map(x)) + }, + naf: S.naf && { + wnd: S.naf.wnd, + points: [v].concat(S.naf.points.map(x)) + } + }, v; + }, o.prototype.inspect = function() { + return this.isInfinity() ? "" : ""; + }, o.prototype.isInfinity = function() { + return this.inf; + }, o.prototype.add = function(u) { + if (this.inf) + return u; + if (u.inf) + return this; + if (this.eq(u)) + return this.dbl(); + if (this.neg().eq(u)) + return this.curve.point(null, null); + if (this.x.cmp(u.x) === 0) + return this.curve.point(null, null); + var h = this.y.redSub(u.y); + h.cmpn(0) !== 0 && (h = h.redMul(this.x.redSub(u.x).redInvm())); + var g = h.redSqr().redISub(this.x).redISub(u.x), v = h.redMul(this.x.redSub(g)).redISub(this.y); + return this.curve.point(g, v); + }, o.prototype.dbl = function() { + if (this.inf) + return this; + var u = this.y.redAdd(this.y); + if (u.cmpn(0) === 0) + return this.curve.point(null, null); + var h = this.curve.a, g = this.x.redSqr(), v = u.redInvm(), x = g.redAdd(g).redIAdd(g).redIAdd(h).redMul(v), S = x.redSqr().redISub(this.x.redAdd(this.x)), C = x.redMul(this.x.redSub(S)).redISub(this.y); + return this.curve.point(S, C); + }, o.prototype.getX = function() { + return this.x.fromRed(); + }, o.prototype.getY = function() { + return this.y.fromRed(); + }, o.prototype.mul = function(u) { + return u = new e(u, 16), this.isInfinity() ? this : this._hasDoubles(u) ? this.curve._fixedNafMul(this, u) : this.curve.endo ? this.curve._endoWnafMulAdd([this], [u]) : this.curve._wnafMul(this, u); + }, o.prototype.mulAdd = function(u, h, g) { + var v = [this, h], x = [u, g]; + return this.curve.endo ? this.curve._endoWnafMulAdd(v, x) : this.curve._wnafMulAdd(1, v, x, 2); + }, o.prototype.jmulAdd = function(u, h, g) { + var v = [this, h], x = [u, g]; + return this.curve.endo ? this.curve._endoWnafMulAdd(v, x, !0) : this.curve._wnafMulAdd(1, v, x, 2, !0); + }, o.prototype.eq = function(u) { + return this === u || this.inf === u.inf && (this.inf || this.x.cmp(u.x) === 0 && this.y.cmp(u.y) === 0); + }, o.prototype.neg = function(u) { + if (this.inf) + return this; + var h = this.curve.point(this.x, this.y.redNeg()); + if (u && this.precomputed) { + var g = this.precomputed, v = function(x) { + return x.neg(); + }; + h.precomputed = { + naf: g.naf && { + wnd: g.naf.wnd, + points: g.naf.points.map(v) + }, + doubles: g.doubles && { + step: g.doubles.step, + points: g.doubles.points.map(v) + } + }; + } + return h; + }, o.prototype.toJ = function() { + if (this.inf) + return this.curve.jpoint(null, null, null); + var u = this.curve.jpoint(this.x, this.y, this.curve.one); + return u; + }; + function a(f, u, h, g) { + n.BasePoint.call(this, f, "jacobian"), u === null && h === null && g === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new e(0)) : (this.x = new e(u, 16), this.y = new e(h, 16), this.z = new e(g, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; + } + return r(a, n.BasePoint), s.prototype.jpoint = function(u, h, g) { + return new a(this, u, h, g); + }, a.prototype.toP = function() { + if (this.isInfinity()) + return this.curve.point(null, null); + var u = this.z.redInvm(), h = u.redSqr(), g = this.x.redMul(h), v = this.y.redMul(h).redMul(u); + return this.curve.point(g, v); + }, a.prototype.neg = function() { + return this.curve.jpoint(this.x, this.y.redNeg(), this.z); + }, a.prototype.add = function(u) { + if (this.isInfinity()) + return u; + if (u.isInfinity()) + return this; + var h = u.z.redSqr(), g = this.z.redSqr(), v = this.x.redMul(h), x = u.x.redMul(g), S = this.y.redMul(h.redMul(u.z)), C = u.y.redMul(g.redMul(this.z)), D = v.redSub(x), $ = S.redSub(C); + if (D.cmpn(0) === 0) + return $.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); + var N = D.redSqr(), z = N.redMul(D), k = v.redMul(N), B = $.redSqr().redIAdd(z).redISub(k).redISub(k), U = $.redMul(k.redISub(B)).redISub(S.redMul(z)), R = this.z.redMul(u.z).redMul(D); + return this.curve.jpoint(B, U, R); + }, a.prototype.mixedAdd = function(u) { + if (this.isInfinity()) + return u.toJ(); + if (u.isInfinity()) + return this; + var h = this.z.redSqr(), g = this.x, v = u.x.redMul(h), x = this.y, S = u.y.redMul(h).redMul(this.z), C = g.redSub(v), D = x.redSub(S); + if (C.cmpn(0) === 0) + return D.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); + var $ = C.redSqr(), N = $.redMul(C), z = g.redMul($), k = D.redSqr().redIAdd(N).redISub(z).redISub(z), B = D.redMul(z.redISub(k)).redISub(x.redMul(N)), U = this.z.redMul(C); + return this.curve.jpoint(k, B, U); + }, a.prototype.dblp = function(u) { + if (u === 0) + return this; + if (this.isInfinity()) + return this; + if (!u) + return this.dbl(); + var h; + if (this.curve.zeroA || this.curve.threeA) { + var g = this; + for (h = 0; h < u; h++) + g = g.dbl(); + return g; + } + var v = this.curve.a, x = this.curve.tinv, S = this.x, C = this.y, D = this.z, $ = D.redSqr().redSqr(), N = C.redAdd(C); + for (h = 0; h < u; h++) { + var z = S.redSqr(), k = N.redSqr(), B = k.redSqr(), U = z.redAdd(z).redIAdd(z).redIAdd(v.redMul($)), R = S.redMul(k), W = U.redSqr().redISub(R.redAdd(R)), J = R.redISub(W), ne = U.redMul(J); + ne = ne.redIAdd(ne).redISub(B); + var K = N.redMul(D); + h + 1 < u && ($ = $.redMul(B)), S = W, D = K, N = ne; + } + return this.curve.jpoint(S, N.redMul(x), D); + }, a.prototype.dbl = function() { + return this.isInfinity() ? this : this.curve.zeroA ? this._zeroDbl() : this.curve.threeA ? this._threeDbl() : this._dbl(); + }, a.prototype._zeroDbl = function() { + var u, h, g; + if (this.zOne) { + var v = this.x.redSqr(), x = this.y.redSqr(), S = x.redSqr(), C = this.x.redAdd(x).redSqr().redISub(v).redISub(S); + C = C.redIAdd(C); + var D = v.redAdd(v).redIAdd(v), $ = D.redSqr().redISub(C).redISub(C), N = S.redIAdd(S); + N = N.redIAdd(N), N = N.redIAdd(N), u = $, h = D.redMul(C.redISub($)).redISub(N), g = this.y.redAdd(this.y); + } else { + var z = this.x.redSqr(), k = this.y.redSqr(), B = k.redSqr(), U = this.x.redAdd(k).redSqr().redISub(z).redISub(B); + U = U.redIAdd(U); + var R = z.redAdd(z).redIAdd(z), W = R.redSqr(), J = B.redIAdd(B); + J = J.redIAdd(J), J = J.redIAdd(J), u = W.redISub(U).redISub(U), h = R.redMul(U.redISub(u)).redISub(J), g = this.y.redMul(this.z), g = g.redIAdd(g); + } + return this.curve.jpoint(u, h, g); + }, a.prototype._threeDbl = function() { + var u, h, g; + if (this.zOne) { + var v = this.x.redSqr(), x = this.y.redSqr(), S = x.redSqr(), C = this.x.redAdd(x).redSqr().redISub(v).redISub(S); + C = C.redIAdd(C); + var D = v.redAdd(v).redIAdd(v).redIAdd(this.curve.a), $ = D.redSqr().redISub(C).redISub(C); + u = $; + var N = S.redIAdd(S); + N = N.redIAdd(N), N = N.redIAdd(N), h = D.redMul(C.redISub($)).redISub(N), g = this.y.redAdd(this.y); + } else { + var z = this.z.redSqr(), k = this.y.redSqr(), B = this.x.redMul(k), U = this.x.redSub(z).redMul(this.x.redAdd(z)); + U = U.redAdd(U).redIAdd(U); + var R = B.redIAdd(B); + R = R.redIAdd(R); + var W = R.redAdd(R); + u = U.redSqr().redISub(W), g = this.y.redAdd(this.z).redSqr().redISub(k).redISub(z); + var J = k.redSqr(); + J = J.redIAdd(J), J = J.redIAdd(J), J = J.redIAdd(J), h = U.redMul(R.redISub(u)).redISub(J); + } + return this.curve.jpoint(u, h, g); + }, a.prototype._dbl = function() { + var u = this.curve.a, h = this.x, g = this.y, v = this.z, x = v.redSqr().redSqr(), S = h.redSqr(), C = g.redSqr(), D = S.redAdd(S).redIAdd(S).redIAdd(u.redMul(x)), $ = h.redAdd(h); + $ = $.redIAdd($); + var N = $.redMul(C), z = D.redSqr().redISub(N.redAdd(N)), k = N.redISub(z), B = C.redSqr(); + B = B.redIAdd(B), B = B.redIAdd(B), B = B.redIAdd(B); + var U = D.redMul(k).redISub(B), R = g.redAdd(g).redMul(v); + return this.curve.jpoint(z, U, R); + }, a.prototype.trpl = function() { + if (!this.curve.zeroA) + return this.dbl().add(this); + var u = this.x.redSqr(), h = this.y.redSqr(), g = this.z.redSqr(), v = h.redSqr(), x = u.redAdd(u).redIAdd(u), S = x.redSqr(), C = this.x.redAdd(h).redSqr().redISub(u).redISub(v); + C = C.redIAdd(C), C = C.redAdd(C).redIAdd(C), C = C.redISub(S); + var D = C.redSqr(), $ = v.redIAdd(v); + $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($); + var N = x.redIAdd(C).redSqr().redISub(S).redISub(D).redISub($), z = h.redMul(N); + z = z.redIAdd(z), z = z.redIAdd(z); + var k = this.x.redMul(D).redISub(z); + k = k.redIAdd(k), k = k.redIAdd(k); + var B = this.y.redMul(N.redMul($.redISub(N)).redISub(C.redMul(D))); + B = B.redIAdd(B), B = B.redIAdd(B), B = B.redIAdd(B); + var U = this.z.redAdd(C).redSqr().redISub(g).redISub(D); + return this.curve.jpoint(k, B, U); + }, a.prototype.mul = function(u, h) { + return u = new e(u, h), this.curve._wnafMul(this, u); + }, a.prototype.eq = function(u) { + if (u.type === "affine") + return this.eq(u.toJ()); + if (this === u) + return !0; + var h = this.z.redSqr(), g = u.z.redSqr(); + if (this.x.redMul(g).redISub(u.x.redMul(h)).cmpn(0) !== 0) + return !1; + var v = h.redMul(this.z), x = g.redMul(u.z); + return this.y.redMul(x).redISub(u.y.redMul(v)).cmpn(0) === 0; + }, a.prototype.eqXToP = function(u) { + var h = this.z.redSqr(), g = u.toRed(this.curve.red).redMul(h); + if (this.x.cmp(g) === 0) + return !0; + for (var v = u.clone(), x = this.curve.redN.redMul(h); ; ) { + if (v.iadd(this.curve.n), v.cmp(this.curve.p) >= 0) + return !1; + if (g.redIAdd(x), this.x.cmp(g) === 0) + return !0; + } + }, a.prototype.inspect = function() { + return this.isInfinity() ? "" : ""; + }, a.prototype.isInfinity = function() { + return this.z.cmpn(0) === 0; + }, Lg; +} +var kg, Nx; +function uF() { + if (Nx) return kg; + Nx = 1; + var t = go(), e = Jd(), r = t0(), n = Gi(); + function i(o) { + r.call(this, "mont", o), this.a = new t(o.a, 16).toRed(this.red), this.b = new t(o.b, 16).toRed(this.red), this.i4 = new t(4).toRed(this.red).redInvm(), this.two = new t(2).toRed(this.red), this.a24 = this.i4.redMul(this.a.redAdd(this.two)); + } + e(i, r), kg = i, i.prototype.validate = function(a) { + var f = a.normalize().x, u = f.redSqr(), h = u.redMul(f).redAdd(u.redMul(this.a)).redAdd(f), g = h.redSqrt(); + return g.redSqr().cmp(h) === 0; + }; + function s(o, a, f) { + r.BasePoint.call(this, o, "projective"), a === null && f === null ? (this.x = this.curve.one, this.z = this.curve.zero) : (this.x = new t(a, 16), this.z = new t(f, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red))); + } + return e(s, r.BasePoint), i.prototype.decodePoint = function(a, f) { + return this.point(n.toArray(a, f), 1); + }, i.prototype.point = function(a, f) { + return new s(this, a, f); + }, i.prototype.pointFromJSON = function(a) { + return s.fromJSON(this, a); + }, s.prototype.precompute = function() { + }, s.prototype._encode = function() { + return this.getX().toArray("be", this.curve.p.byteLength()); + }, s.fromJSON = function(a, f) { + return new s(a, f[0], f[1] || a.one); + }, s.prototype.inspect = function() { + return this.isInfinity() ? "" : ""; + }, s.prototype.isInfinity = function() { + return this.z.cmpn(0) === 0; + }, s.prototype.dbl = function() { + var a = this.x.redAdd(this.z), f = a.redSqr(), u = this.x.redSub(this.z), h = u.redSqr(), g = f.redSub(h), v = f.redMul(h), x = g.redMul(h.redAdd(this.curve.a24.redMul(g))); + return this.curve.point(v, x); + }, s.prototype.add = function() { + throw new Error("Not supported on Montgomery curve"); + }, s.prototype.diffAdd = function(a, f) { + var u = this.x.redAdd(this.z), h = this.x.redSub(this.z), g = a.x.redAdd(a.z), v = a.x.redSub(a.z), x = v.redMul(u), S = g.redMul(h), C = f.z.redMul(x.redAdd(S).redSqr()), D = f.x.redMul(x.redISub(S).redSqr()); + return this.curve.point(C, D); + }, s.prototype.mul = function(a) { + for (var f = a.clone(), u = this, h = this.curve.point(null, null), g = this, v = []; f.cmpn(0) !== 0; f.iushrn(1)) + v.push(f.andln(1)); + for (var x = v.length - 1; x >= 0; x--) + v[x] === 0 ? (u = u.diffAdd(h, g), h = h.dbl()) : (h = u.diffAdd(h, g), u = u.dbl()); + return h; + }, s.prototype.mulAdd = function() { + throw new Error("Not supported on Montgomery curve"); + }, s.prototype.jumlAdd = function() { + throw new Error("Not supported on Montgomery curve"); + }, s.prototype.eq = function(a) { + return this.getX().cmp(a.getX()) === 0; + }, s.prototype.normalize = function() { + return this.x = this.x.redMul(this.z.redInvm()), this.z = this.curve.one, this; + }, s.prototype.getX = function() { + return this.normalize(), this.x.fromRed(); + }, kg; +} +var $g, Lx; +function fF() { + if (Lx) return $g; + Lx = 1; + var t = Gi(), e = go(), r = Jd(), n = t0(), i = t.assert; + function s(a) { + this.twisted = (a.a | 0) !== 1, this.mOneA = this.twisted && (a.a | 0) === -1, this.extended = this.mOneA, n.call(this, "edwards", a), this.a = new e(a.a, 16).umod(this.red.m), this.a = this.a.toRed(this.red), this.c = new e(a.c, 16).toRed(this.red), this.c2 = this.c.redSqr(), this.d = new e(a.d, 16).toRed(this.red), this.dd = this.d.redAdd(this.d), i(!this.twisted || this.c.fromRed().cmpn(1) === 0), this.oneC = (a.c | 0) === 1; + } + r(s, n), $g = s, s.prototype._mulA = function(f) { + return this.mOneA ? f.redNeg() : this.a.redMul(f); + }, s.prototype._mulC = function(f) { + return this.oneC ? f : this.c.redMul(f); + }, s.prototype.jpoint = function(f, u, h, g) { + return this.point(f, u, h, g); + }, s.prototype.pointFromX = function(f, u) { + f = new e(f, 16), f.red || (f = f.toRed(this.red)); + var h = f.redSqr(), g = this.c2.redSub(this.a.redMul(h)), v = this.one.redSub(this.c2.redMul(this.d).redMul(h)), x = g.redMul(v.redInvm()), S = x.redSqrt(); + if (S.redSqr().redSub(x).cmp(this.zero) !== 0) + throw new Error("invalid point"); + var C = S.fromRed().isOdd(); + return (u && !C || !u && C) && (S = S.redNeg()), this.point(f, S); + }, s.prototype.pointFromY = function(f, u) { + f = new e(f, 16), f.red || (f = f.toRed(this.red)); + var h = f.redSqr(), g = h.redSub(this.c2), v = h.redMul(this.d).redMul(this.c2).redSub(this.a), x = g.redMul(v.redInvm()); + if (x.cmp(this.zero) === 0) { + if (u) + throw new Error("invalid point"); + return this.point(this.zero, f); + } + var S = x.redSqrt(); + if (S.redSqr().redSub(x).cmp(this.zero) !== 0) + throw new Error("invalid point"); + return S.fromRed().isOdd() !== u && (S = S.redNeg()), this.point(S, f); + }, s.prototype.validate = function(f) { + if (f.isInfinity()) + return !0; + f.normalize(); + var u = f.x.redSqr(), h = f.y.redSqr(), g = u.redMul(this.a).redAdd(h), v = this.c2.redMul(this.one.redAdd(this.d.redMul(u).redMul(h))); + return g.cmp(v) === 0; + }; + function o(a, f, u, h, g) { + n.BasePoint.call(this, a, "projective"), f === null && u === null && h === null ? (this.x = this.curve.zero, this.y = this.curve.one, this.z = this.curve.one, this.t = this.curve.zero, this.zOne = !0) : (this.x = new e(f, 16), this.y = new e(u, 16), this.z = h ? new e(h, 16) : this.curve.one, this.t = g && new e(g, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.t && !this.t.red && (this.t = this.t.toRed(this.curve.red)), this.zOne = this.z === this.curve.one, this.curve.extended && !this.t && (this.t = this.x.redMul(this.y), this.zOne || (this.t = this.t.redMul(this.z.redInvm())))); + } + return r(o, n.BasePoint), s.prototype.pointFromJSON = function(f) { + return o.fromJSON(this, f); + }, s.prototype.point = function(f, u, h, g) { + return new o(this, f, u, h, g); + }, o.fromJSON = function(f, u) { + return new o(f, u[0], u[1], u[2]); + }, o.prototype.inspect = function() { + return this.isInfinity() ? "" : ""; + }, o.prototype.isInfinity = function() { + return this.x.cmpn(0) === 0 && (this.y.cmp(this.z) === 0 || this.zOne && this.y.cmp(this.curve.c) === 0); + }, o.prototype._extDbl = function() { + var f = this.x.redSqr(), u = this.y.redSqr(), h = this.z.redSqr(); + h = h.redIAdd(h); + var g = this.curve._mulA(f), v = this.x.redAdd(this.y).redSqr().redISub(f).redISub(u), x = g.redAdd(u), S = x.redSub(h), C = g.redSub(u), D = v.redMul(S), $ = x.redMul(C), N = v.redMul(C), z = S.redMul(x); + return this.curve.point(D, $, z, N); + }, o.prototype._projDbl = function() { + var f = this.x.redAdd(this.y).redSqr(), u = this.x.redSqr(), h = this.y.redSqr(), g, v, x, S, C, D; + if (this.curve.twisted) { + S = this.curve._mulA(u); + var $ = S.redAdd(h); + this.zOne ? (g = f.redSub(u).redSub(h).redMul($.redSub(this.curve.two)), v = $.redMul(S.redSub(h)), x = $.redSqr().redSub($).redSub($)) : (C = this.z.redSqr(), D = $.redSub(C).redISub(C), g = f.redSub(u).redISub(h).redMul(D), v = $.redMul(S.redSub(h)), x = $.redMul(D)); + } else + S = u.redAdd(h), C = this.curve._mulC(this.z).redSqr(), D = S.redSub(C).redSub(C), g = this.curve._mulC(f.redISub(S)).redMul(D), v = this.curve._mulC(S).redMul(u.redISub(h)), x = S.redMul(D); + return this.curve.point(g, v, x); + }, o.prototype.dbl = function() { + return this.isInfinity() ? this : this.curve.extended ? this._extDbl() : this._projDbl(); + }, o.prototype._extAdd = function(f) { + var u = this.y.redSub(this.x).redMul(f.y.redSub(f.x)), h = this.y.redAdd(this.x).redMul(f.y.redAdd(f.x)), g = this.t.redMul(this.curve.dd).redMul(f.t), v = this.z.redMul(f.z.redAdd(f.z)), x = h.redSub(u), S = v.redSub(g), C = v.redAdd(g), D = h.redAdd(u), $ = x.redMul(S), N = C.redMul(D), z = x.redMul(D), k = S.redMul(C); + return this.curve.point($, N, k, z); + }, o.prototype._projAdd = function(f) { + var u = this.z.redMul(f.z), h = u.redSqr(), g = this.x.redMul(f.x), v = this.y.redMul(f.y), x = this.curve.d.redMul(g).redMul(v), S = h.redSub(x), C = h.redAdd(x), D = this.x.redAdd(this.y).redMul(f.x.redAdd(f.y)).redISub(g).redISub(v), $ = u.redMul(S).redMul(D), N, z; + return this.curve.twisted ? (N = u.redMul(C).redMul(v.redSub(this.curve._mulA(g))), z = S.redMul(C)) : (N = u.redMul(C).redMul(v.redSub(g)), z = this.curve._mulC(S).redMul(C)), this.curve.point($, N, z); + }, o.prototype.add = function(f) { + return this.isInfinity() ? f : f.isInfinity() ? this : this.curve.extended ? this._extAdd(f) : this._projAdd(f); + }, o.prototype.mul = function(f) { + return this._hasDoubles(f) ? this.curve._fixedNafMul(this, f) : this.curve._wnafMul(this, f); + }, o.prototype.mulAdd = function(f, u, h) { + return this.curve._wnafMulAdd(1, [this, u], [f, h], 2, !1); + }, o.prototype.jmulAdd = function(f, u, h) { + return this.curve._wnafMulAdd(1, [this, u], [f, h], 2, !0); + }, o.prototype.normalize = function() { + if (this.zOne) + return this; + var f = this.z.redInvm(); + return this.x = this.x.redMul(f), this.y = this.y.redMul(f), this.t && (this.t = this.t.redMul(f)), this.z = this.curve.one, this.zOne = !0, this; + }, o.prototype.neg = function() { + return this.curve.point( + this.x.redNeg(), + this.y, + this.z, + this.t && this.t.redNeg() + ); + }, o.prototype.getX = function() { + return this.normalize(), this.x.fromRed(); + }, o.prototype.getY = function() { + return this.normalize(), this.y.fromRed(); + }, o.prototype.eq = function(f) { + return this === f || this.getX().cmp(f.getX()) === 0 && this.getY().cmp(f.getY()) === 0; + }, o.prototype.eqXToP = function(f) { + var u = f.toRed(this.curve.red).redMul(this.z); + if (this.x.cmp(u) === 0) + return !0; + for (var h = f.clone(), g = this.curve.redN.redMul(this.z); ; ) { + if (h.iadd(this.curve.n), h.cmp(this.curve.p) >= 0) + return !1; + if (u.redIAdd(g), this.x.cmp(u) === 0) + return !0; + } + }, o.prototype.toP = o.prototype.normalize, o.prototype.mixedAdd = o.prototype.add, $g; +} +var kx; +function _8() { + return kx || (kx = 1, (function(t) { + var e = t; + e.base = t0(), e.short = cF(), e.mont = uF(), e.edwards = fF(); + })(Og)), Og; +} +var Bg = {}, Fg, $x; +function lF() { + return $x || ($x = 1, Fg = { + doubles: { + step: 4, + points: [ + [ + "e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a", + "f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821" + ], + [ + "8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508", + "11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf" + ], + [ + "175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739", + "d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695" + ], + [ + "363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640", + "4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9" + ], + [ + "8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c", + "4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36" + ], + [ + "723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda", + "96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f" + ], + [ + "eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa", + "5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999" + ], + [ + "100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0", + "cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09" + ], + [ + "e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d", + "9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d" + ], + [ + "feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d", + "e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088" + ], + [ + "da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1", + "9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d" + ], + [ + "53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0", + "5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8" + ], + [ + "8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047", + "10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a" + ], + [ + "385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862", + "283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453" + ], + [ + "6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7", + "7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160" + ], + [ + "3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd", + "56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0" + ], + [ + "85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83", + "7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6" + ], + [ + "948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a", + "53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589" + ], + [ + "6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8", + "bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17" + ], + [ + "e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d", + "4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda" + ], + [ + "e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725", + "7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd" + ], + [ + "213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754", + "4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2" + ], + [ + "4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c", + "17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6" + ], + [ + "fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6", + "6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f" + ], + [ + "76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39", + "c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01" + ], + [ + "c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891", + "893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3" + ], + [ + "d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b", + "febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f" + ], + [ + "b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03", + "2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7" + ], + [ + "e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d", + "eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78" + ], + [ + "a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070", + "7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1" + ], + [ + "90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4", + "e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150" + ], + [ + "8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da", + "662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82" + ], + [ + "e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11", + "1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc" + ], + [ + "8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e", + "efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b" + ], + [ + "e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41", + "2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51" + ], + [ + "b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef", + "67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45" + ], + [ + "d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8", + "db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120" + ], + [ + "324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d", + "648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84" + ], + [ + "4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96", + "35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d" + ], + [ + "9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd", + "ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d" + ], + [ + "6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5", + "9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8" + ], + [ + "a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266", + "40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8" + ], + [ + "7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71", + "34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac" + ], + [ + "928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac", + "c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f" + ], + [ + "85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751", + "1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962" + ], + [ + "ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e", + "493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907" + ], + [ + "827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241", + "c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec" + ], + [ + "eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3", + "be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d" + ], + [ + "e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f", + "4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414" + ], + [ + "1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19", + "aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd" + ], + [ + "146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be", + "b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0" + ], + [ + "fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9", + "6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811" + ], + [ + "da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2", + "8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1" + ], + [ + "a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13", + "7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c" + ], + [ + "174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c", + "ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73" + ], + [ + "959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba", + "2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd" + ], + [ + "d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151", + "e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405" + ], + [ + "64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073", + "d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589" + ], + [ + "8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458", + "38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e" + ], + [ + "13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b", + "69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27" + ], + [ + "bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366", + "d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1" + ], + [ + "8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa", + "40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482" + ], + [ + "8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0", + "620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945" + ], + [ + "dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787", + "7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573" + ], + [ + "f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e", + "ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82" + ] + ] + }, + naf: { + wnd: 7, + points: [ + [ + "f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9", + "388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672" + ], + [ + "2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4", + "d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6" + ], + [ + "5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc", + "6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da" + ], + [ + "acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe", + "cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37" + ], + [ + "774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb", + "d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b" + ], + [ + "f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8", + "ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81" + ], + [ + "d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e", + "581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58" + ], + [ + "defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34", + "4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77" + ], + [ + "2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c", + "85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a" + ], + [ + "352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5", + "321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c" + ], + [ + "2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f", + "2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67" + ], + [ + "9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714", + "73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402" + ], + [ + "daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729", + "a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55" + ], + [ + "c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db", + "2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482" + ], + [ + "6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4", + "e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82" + ], + [ + "1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5", + "b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396" + ], + [ + "605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479", + "2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49" + ], + [ + "62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d", + "80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf" + ], + [ + "80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f", + "1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a" + ], + [ + "7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb", + "d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7" + ], + [ + "d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9", + "eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933" + ], + [ + "49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963", + "758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a" + ], + [ + "77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74", + "958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6" + ], + [ + "f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530", + "e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37" + ], + [ + "463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b", + "5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e" + ], + [ + "f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247", + "cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6" + ], + [ + "caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1", + "cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476" + ], + [ + "2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120", + "4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40" + ], + [ + "7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435", + "91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61" + ], + [ + "754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18", + "673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683" + ], + [ + "e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8", + "59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5" + ], + [ + "186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb", + "3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b" + ], + [ + "df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f", + "55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417" + ], + [ + "5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143", + "efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868" + ], + [ + "290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba", + "e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a" + ], + [ + "af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45", + "f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6" + ], + [ + "766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a", + "744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996" + ], + [ + "59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e", + "c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e" + ], + [ + "f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8", + "e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d" + ], + [ + "7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c", + "30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2" + ], + [ + "948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519", + "e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e" + ], + [ + "7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab", + "100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437" + ], + [ + "3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca", + "ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311" + ], + [ + "d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf", + "8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4" + ], + [ + "1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610", + "68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575" + ], + [ + "733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4", + "f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d" + ], + [ + "15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c", + "d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d" + ], + [ + "a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940", + "edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629" + ], + [ + "e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980", + "a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06" + ], + [ + "311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3", + "66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374" + ], + [ + "34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf", + "9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee" + ], + [ + "f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63", + "4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1" + ], + [ + "d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448", + "fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b" + ], + [ + "32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf", + "5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661" + ], + [ + "7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5", + "8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6" + ], + [ + "ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6", + "8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e" + ], + [ + "16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5", + "5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d" + ], + [ + "eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99", + "f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc" + ], + [ + "78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51", + "f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4" + ], + [ + "494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5", + "42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c" + ], + [ + "a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5", + "204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b" + ], + [ + "c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997", + "4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913" + ], + [ + "841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881", + "73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154" + ], + [ + "5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5", + "39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865" + ], + [ + "36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66", + "d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc" + ], + [ + "336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726", + "ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224" + ], + [ + "8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede", + "6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e" + ], + [ + "1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94", + "60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6" + ], + [ + "85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31", + "3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511" + ], + [ + "29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51", + "b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b" + ], + [ + "a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252", + "ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2" + ], + [ + "4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5", + "cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c" + ], + [ + "d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b", + "6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3" + ], + [ + "ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4", + "322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d" + ], + [ + "af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f", + "6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700" + ], + [ + "e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889", + "2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4" + ], + [ + "591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246", + "b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196" + ], + [ + "11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984", + "998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4" + ], + [ + "3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a", + "b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257" + ], + [ + "cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030", + "bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13" + ], + [ + "c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197", + "6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096" + ], + [ + "c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593", + "c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38" + ], + [ + "a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef", + "21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f" + ], + [ + "347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38", + "60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448" + ], + [ + "da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a", + "49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a" + ], + [ + "c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111", + "5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4" + ], + [ + "4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502", + "7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437" + ], + [ + "3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea", + "be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7" + ], + [ + "cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26", + "8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d" + ], + [ + "b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986", + "39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a" + ], + [ + "d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e", + "62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54" + ], + [ + "48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4", + "25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77" + ], + [ + "dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda", + "ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517" + ], + [ + "6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859", + "cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10" + ], + [ + "e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f", + "f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125" + ], + [ + "eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c", + "6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e" + ], + [ + "13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942", + "fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1" + ], + [ + "ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a", + "1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2" + ], + [ + "b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80", + "5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423" + ], + [ + "ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d", + "438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8" + ], + [ + "8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1", + "cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758" + ], + [ + "52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63", + "c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375" + ], + [ + "e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352", + "6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d" + ], + [ + "7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193", + "ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec" + ], + [ + "5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00", + "9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0" + ], + [ + "32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58", + "ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c" + ], + [ + "e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7", + "d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4" + ], + [ + "8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8", + "c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f" + ], + [ + "4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e", + "67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649" + ], + [ + "3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d", + "cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826" + ], + [ + "674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b", + "299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5" + ], + [ + "d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f", + "f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87" + ], + [ + "30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6", + "462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b" + ], + [ + "be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297", + "62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc" + ], + [ + "93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a", + "7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c" + ], + [ + "b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c", + "ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f" + ], + [ + "d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52", + "4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a" + ], + [ + "d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb", + "bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46" + ], + [ + "463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065", + "bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f" + ], + [ + "7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917", + "603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03" + ], + [ + "74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9", + "cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08" + ], + [ + "30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3", + "553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8" + ], + [ + "9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57", + "712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373" + ], + [ + "176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66", + "ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3" + ], + [ + "75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8", + "9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8" + ], + [ + "809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721", + "9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1" + ], + [ + "1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180", + "4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9" + ] + ] + } + }), Fg; +} +var Bx; +function x1() { + return Bx || (Bx = 1, (function(t) { + var e = t, r = Xd(), n = _8(), i = Gi(), s = i.assert; + function o(u) { + u.type === "short" ? this.curve = new n.short(u) : u.type === "edwards" ? this.curve = new n.edwards(u) : this.curve = new n.mont(u), this.g = this.curve.g, this.n = this.curve.n, this.hash = u.hash, s(this.g.validate(), "Invalid curve"), s(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); + } + e.PresetCurve = o; + function a(u, h) { + Object.defineProperty(e, u, { + configurable: !0, + enumerable: !0, + get: function() { + var g = new o(h); + return Object.defineProperty(e, u, { + configurable: !0, + enumerable: !0, + value: g + }), g; + } + }); + } + a("p192", { + type: "short", + prime: "p192", + p: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff", + a: "ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc", + b: "64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1", + n: "ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831", + hash: r.sha256, + gRed: !1, + g: [ + "188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012", + "07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811" + ] + }), a("p224", { + type: "short", + prime: "p224", + p: "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001", + a: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe", + b: "b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4", + n: "ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d", + hash: r.sha256, + gRed: !1, + g: [ + "b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21", + "bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34" + ] + }), a("p256", { + type: "short", + prime: null, + p: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff", + a: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc", + b: "5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b", + n: "ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551", + hash: r.sha256, + gRed: !1, + g: [ + "6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296", + "4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5" + ] + }), a("p384", { + type: "short", + prime: null, + p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff", + a: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc", + b: "b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef", + n: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973", + hash: r.sha384, + gRed: !1, + g: [ + "aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7", + "3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f" + ] + }), a("p521", { + type: "short", + prime: null, + p: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff", + a: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc", + b: "00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00", + n: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409", + hash: r.sha512, + gRed: !1, + g: [ + "000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66", + "00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650" + ] + }), a("curve25519", { + type: "mont", + prime: "p25519", + p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed", + a: "76d06", + b: "1", + n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", + hash: r.sha256, + gRed: !1, + g: [ + "9" + ] + }), a("ed25519", { + type: "edwards", + prime: "p25519", + p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed", + a: "-1", + c: "1", + // -121665 * (121666^(-1)) (mod P) + d: "52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3", + n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", + hash: r.sha256, + gRed: !1, + g: [ + "216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a", + // 4/5 + "6666666666666666666666666666666666666666666666666666666666666658" + ] + }); + var f; + try { + f = lF(); + } catch { + f = void 0; + } + a("secp256k1", { + type: "short", + prime: "k256", + p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f", + a: "0", + b: "7", + n: "ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141", + h: "1", + hash: r.sha256, + // Precomputed endomorphism + beta: "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee", + lambda: "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72", + basis: [ + { + a: "3086d221a7d46bcde86c90e49284eb15", + b: "-e4437ed6010e88286f547fa90abfe4c3" + }, + { + a: "114ca50f7a8e2f3f657c1108d9d44cfd8", + b: "3086d221a7d46bcde86c90e49284eb15" + } + ], + gRed: !1, + g: [ + "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", + "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", + f + ] + }); + })(Bg)), Bg; +} +var jg, Fx; +function hF() { + if (Fx) return jg; + Fx = 1; + var t = Xd(), e = w8(), r = Wa(); + function n(i) { + if (!(this instanceof n)) + return new n(i); + this.hash = i.hash, this.predResist = !!i.predResist, this.outLen = this.hash.outSize, this.minEntropy = i.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null; + var s = e.toArray(i.entropy, i.entropyEnc || "hex"), o = e.toArray(i.nonce, i.nonceEnc || "hex"), a = e.toArray(i.pers, i.persEnc || "hex"); + r( + s.length >= this.minEntropy / 8, + "Not enough entropy. Minimum is: " + this.minEntropy + " bits" + ), this._init(s, o, a); + } + return jg = n, n.prototype._init = function(s, o, a) { + var f = s.concat(o).concat(a); + this.K = new Array(this.outLen / 8), this.V = new Array(this.outLen / 8); + for (var u = 0; u < this.V.length; u++) + this.K[u] = 0, this.V[u] = 1; + this._update(f), this._reseed = 1, this.reseedInterval = 281474976710656; + }, n.prototype._hmac = function() { + return new t.hmac(this.hash, this.K); + }, n.prototype._update = function(s) { + var o = this._hmac().update(this.V).update([0]); + s && (o = o.update(s)), this.K = o.digest(), this.V = this._hmac().update(this.V).digest(), s && (this.K = this._hmac().update(this.V).update([1]).update(s).digest(), this.V = this._hmac().update(this.V).digest()); + }, n.prototype.reseed = function(s, o, a, f) { + typeof o != "string" && (f = a, a = o, o = null), s = e.toArray(s, o), a = e.toArray(a, f), r( + s.length >= this.minEntropy / 8, + "Not enough entropy. Minimum is: " + this.minEntropy + " bits" + ), this._update(s.concat(a || [])), this._reseed = 1; + }, n.prototype.generate = function(s, o, a, f) { + if (this._reseed > this.reseedInterval) + throw new Error("Reseed is required"); + typeof o != "string" && (f = a, a = o, o = null), a && (a = e.toArray(a, f || "hex"), this._update(a)); + for (var u = []; u.length < s; ) + this.V = this._hmac().update(this.V).digest(), u = u.concat(this.V); + var h = u.slice(0, s); + return this._update(a), this._reseed++, e.encode(h, o); + }, jg; +} +var Ug, jx; +function dF() { + if (jx) return Ug; + jx = 1; + var t = go(), e = Gi(), r = e.assert; + function n(i, s) { + this.ec = i, this.priv = null, this.pub = null, s.priv && this._importPrivate(s.priv, s.privEnc), s.pub && this._importPublic(s.pub, s.pubEnc); + } + return Ug = n, n.fromPublic = function(s, o, a) { + return o instanceof n ? o : new n(s, { + pub: o, + pubEnc: a + }); + }, n.fromPrivate = function(s, o, a) { + return o instanceof n ? o : new n(s, { + priv: o, + privEnc: a + }); + }, n.prototype.validate = function() { + var s = this.getPublic(); + return s.isInfinity() ? { result: !1, reason: "Invalid public key" } : s.validate() ? s.mul(this.ec.curve.n).isInfinity() ? { result: !0, reason: null } : { result: !1, reason: "Public key * N != O" } : { result: !1, reason: "Public key is not a point" }; + }, n.prototype.getPublic = function(s, o) { + return typeof s == "string" && (o = s, s = null), this.pub || (this.pub = this.ec.g.mul(this.priv)), o ? this.pub.encode(o, s) : this.pub; + }, n.prototype.getPrivate = function(s) { + return s === "hex" ? this.priv.toString(16, 2) : this.priv; + }, n.prototype._importPrivate = function(s, o) { + this.priv = new t(s, o || 16), this.priv = this.priv.umod(this.ec.curve.n); + }, n.prototype._importPublic = function(s, o) { + if (s.x || s.y) { + this.ec.curve.type === "mont" ? r(s.x, "Need x coordinate") : (this.ec.curve.type === "short" || this.ec.curve.type === "edwards") && r(s.x && s.y, "Need both x and y coordinate"), this.pub = this.ec.curve.point(s.x, s.y); + return; + } + this.pub = this.ec.curve.decodePoint(s, o); + }, n.prototype.derive = function(s) { + return s.validate() || r(s.validate(), "public point not validated"), s.mul(this.priv).getX(); + }, n.prototype.sign = function(s, o, a) { + return this.ec.sign(s, this, o, a); + }, n.prototype.verify = function(s, o, a) { + return this.ec.verify(s, o, this, void 0, a); + }, n.prototype.inspect = function() { + return ""; + }, Ug; +} +var qg, Ux; +function pF() { + if (Ux) return qg; + Ux = 1; + var t = go(), e = Gi(), r = e.assert; + function n(f, u) { + if (f instanceof n) + return f; + this._importDER(f, u) || (r(f.r && f.s, "Signature without r or s"), this.r = new t(f.r, 16), this.s = new t(f.s, 16), f.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = f.recoveryParam); + } + qg = n; + function i() { + this.place = 0; + } + function s(f, u) { + var h = f[u.place++]; + if (!(h & 128)) + return h; + var g = h & 15; + if (g === 0 || g > 4 || f[u.place] === 0) + return !1; + for (var v = 0, x = 0, S = u.place; x < g; x++, S++) + v <<= 8, v |= f[S], v >>>= 0; + return v <= 127 ? !1 : (u.place = S, v); + } + function o(f) { + for (var u = 0, h = f.length - 1; !f[u] && !(f[u + 1] & 128) && u < h; ) + u++; + return u === 0 ? f : f.slice(u); + } + n.prototype._importDER = function(u, h) { + u = e.toArray(u, h); + var g = new i(); + if (u[g.place++] !== 48) + return !1; + var v = s(u, g); + if (v === !1 || v + g.place !== u.length || u[g.place++] !== 2) + return !1; + var x = s(u, g); + if (x === !1 || (u[g.place] & 128) !== 0) + return !1; + var S = u.slice(g.place, x + g.place); + if (g.place += x, u[g.place++] !== 2) + return !1; + var C = s(u, g); + if (C === !1 || u.length !== C + g.place || (u[g.place] & 128) !== 0) + return !1; + var D = u.slice(g.place, C + g.place); + if (S[0] === 0) + if (S[1] & 128) + S = S.slice(1); + else + return !1; + if (D[0] === 0) + if (D[1] & 128) + D = D.slice(1); + else + return !1; + return this.r = new t(S), this.s = new t(D), this.recoveryParam = null, !0; + }; + function a(f, u) { + if (u < 128) { + f.push(u); + return; + } + var h = 1 + (Math.log(u) / Math.LN2 >>> 3); + for (f.push(h | 128); --h; ) + f.push(u >>> (h << 3) & 255); + f.push(u); + } + return n.prototype.toDER = function(u) { + var h = this.r.toArray(), g = this.s.toArray(); + for (h[0] & 128 && (h = [0].concat(h)), g[0] & 128 && (g = [0].concat(g)), h = o(h), g = o(g); !g[0] && !(g[1] & 128); ) + g = g.slice(1); + var v = [2]; + a(v, h.length), v = v.concat(h), v.push(2), a(v, g.length); + var x = v.concat(g), S = [48]; + return a(S, x.length), S = S.concat(x), e.encode(S, u); + }, qg; +} +var zg, qx; +function gF() { + if (qx) return zg; + qx = 1; + var t = go(), e = hF(), r = Gi(), n = x1(), i = x8(), s = r.assert, o = dF(), a = pF(); + function f(u) { + if (!(this instanceof f)) + return new f(u); + typeof u == "string" && (s( + Object.prototype.hasOwnProperty.call(n, u), + "Unknown curve " + u + ), u = n[u]), u instanceof n.PresetCurve && (u = { curve: u }), this.curve = u.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = u.curve.g, this.g.precompute(u.curve.n.bitLength() + 1), this.hash = u.hash || u.curve.hash; + } + return zg = f, f.prototype.keyPair = function(h) { + return new o(this, h); + }, f.prototype.keyFromPrivate = function(h, g) { + return o.fromPrivate(this, h, g); + }, f.prototype.keyFromPublic = function(h, g) { + return o.fromPublic(this, h, g); + }, f.prototype.genKeyPair = function(h) { + h || (h = {}); + for (var g = new e({ + hash: this.hash, + pers: h.pers, + persEnc: h.persEnc || "utf8", + entropy: h.entropy || i(this.hash.hmacStrength), + entropyEnc: h.entropy && h.entropyEnc || "utf8", + nonce: this.n.toArray() + }), v = this.n.byteLength(), x = this.n.sub(new t(2)); ; ) { + var S = new t(g.generate(v)); + if (!(S.cmp(x) > 0)) + return S.iaddn(1), this.keyFromPrivate(S); + } + }, f.prototype._truncateToN = function(h, g, v) { + var x; + if (t.isBN(h) || typeof h == "number") + h = new t(h, 16), x = h.byteLength(); + else if (typeof h == "object") + x = h.length, h = new t(h, 16); + else { + var S = h.toString(); + x = S.length + 1 >>> 1, h = new t(S, 16); + } + typeof v != "number" && (v = x * 8); + var C = v - this.n.bitLength(); + return C > 0 && (h = h.ushrn(C)), !g && h.cmp(this.n) >= 0 ? h.sub(this.n) : h; + }, f.prototype.sign = function(h, g, v, x) { + typeof v == "object" && (x = v, v = null), x || (x = {}), g = this.keyFromPrivate(g, v), h = this._truncateToN(h, !1, x.msgBitLength); + for (var S = this.n.byteLength(), C = g.getPrivate().toArray("be", S), D = h.toArray("be", S), $ = new e({ + hash: this.hash, + entropy: C, + nonce: D, + pers: x.pers, + persEnc: x.persEnc || "utf8" + }), N = this.n.sub(new t(1)), z = 0; ; z++) { + var k = x.k ? x.k(z) : new t($.generate(this.n.byteLength())); + if (k = this._truncateToN(k, !0), !(k.cmpn(1) <= 0 || k.cmp(N) >= 0)) { + var B = this.g.mul(k); + if (!B.isInfinity()) { + var U = B.getX(), R = U.umod(this.n); + if (R.cmpn(0) !== 0) { + var W = k.invm(this.n).mul(R.mul(g.getPrivate()).iadd(h)); + if (W = W.umod(this.n), W.cmpn(0) !== 0) { + var J = (B.getY().isOdd() ? 1 : 0) | (U.cmp(R) !== 0 ? 2 : 0); + return x.canonical && W.cmp(this.nh) > 0 && (W = this.n.sub(W), J ^= 1), new a({ r: R, s: W, recoveryParam: J }); + } + } + } + } + } + }, f.prototype.verify = function(h, g, v, x, S) { + S || (S = {}), h = this._truncateToN(h, !1, S.msgBitLength), v = this.keyFromPublic(v, x), g = new a(g, "hex"); + var C = g.r, D = g.s; + if (C.cmpn(1) < 0 || C.cmp(this.n) >= 0 || D.cmpn(1) < 0 || D.cmp(this.n) >= 0) + return !1; + var $ = D.invm(this.n), N = $.mul(h).umod(this.n), z = $.mul(C).umod(this.n), k; + return this.curve._maxwellTrick ? (k = this.g.jmulAdd(N, v.getPublic(), z), k.isInfinity() ? !1 : k.eqXToP(C)) : (k = this.g.mulAdd(N, v.getPublic(), z), k.isInfinity() ? !1 : k.getX().umod(this.n).cmp(C) === 0); + }, f.prototype.recoverPubKey = function(u, h, g, v) { + s((3 & g) === g, "The recovery param is more than two bits"), h = new a(h, v); + var x = this.n, S = new t(u), C = h.r, D = h.s, $ = g & 1, N = g >> 1; + if (C.cmp(this.curve.p.umod(this.curve.n)) >= 0 && N) + throw new Error("Unable to find sencond key candinate"); + N ? C = this.curve.pointFromX(C.add(this.curve.n), $) : C = this.curve.pointFromX(C, $); + var z = h.r.invm(x), k = x.sub(S).mul(z).umod(x), B = D.mul(z).umod(x); + return this.g.mulAdd(k, C, B); + }, f.prototype.getKeyRecoveryParam = function(u, h, g, v) { + if (h = new a(h, v), h.recoveryParam !== null) + return h.recoveryParam; + for (var x = 0; x < 4; x++) { + var S; + try { + S = this.recoverPubKey(u, h, x); + } catch { + continue; + } + if (S.eq(g)) + return x; + } + throw new Error("Unable to find valid recovery factor"); + }, zg; +} +var Hg, zx; +function mF() { + if (zx) return Hg; + zx = 1; + var t = Gi(), e = t.assert, r = t.parseBytes, n = t.cachedProperty; + function i(s, o) { + this.eddsa = s, this._secret = r(o.secret), s.isPoint(o.pub) ? this._pub = o.pub : this._pubBytes = r(o.pub); + } + return i.fromPublic = function(o, a) { + return a instanceof i ? a : new i(o, { pub: a }); + }, i.fromSecret = function(o, a) { + return a instanceof i ? a : new i(o, { secret: a }); + }, i.prototype.secret = function() { + return this._secret; + }, n(i, "pubBytes", function() { + return this.eddsa.encodePoint(this.pub()); + }), n(i, "pub", function() { + return this._pubBytes ? this.eddsa.decodePoint(this._pubBytes) : this.eddsa.g.mul(this.priv()); + }), n(i, "privBytes", function() { + var o = this.eddsa, a = this.hash(), f = o.encodingLength - 1, u = a.slice(0, o.encodingLength); + return u[0] &= 248, u[f] &= 127, u[f] |= 64, u; + }), n(i, "priv", function() { + return this.eddsa.decodeInt(this.privBytes()); + }), n(i, "hash", function() { + return this.eddsa.hash().update(this.secret()).digest(); + }), n(i, "messagePrefix", function() { + return this.hash().slice(this.eddsa.encodingLength); + }), i.prototype.sign = function(o) { + return e(this._secret, "KeyPair can only verify"), this.eddsa.sign(o, this); + }, i.prototype.verify = function(o, a) { + return this.eddsa.verify(o, a, this); + }, i.prototype.getSecret = function(o) { + return e(this._secret, "KeyPair is public only"), t.encode(this.secret(), o); + }, i.prototype.getPublic = function(o) { + return t.encode(this.pubBytes(), o); + }, Hg = i, Hg; +} +var Wg, Hx; +function vF() { + if (Hx) return Wg; + Hx = 1; + var t = go(), e = Gi(), r = e.assert, n = e.cachedProperty, i = e.parseBytes; + function s(o, a) { + this.eddsa = o, typeof a != "object" && (a = i(a)), Array.isArray(a) && (r(a.length === o.encodingLength * 2, "Signature has invalid size"), a = { + R: a.slice(0, o.encodingLength), + S: a.slice(o.encodingLength) + }), r(a.R && a.S, "Signature without R or S"), o.isPoint(a.R) && (this._R = a.R), a.S instanceof t && (this._S = a.S), this._Rencoded = Array.isArray(a.R) ? a.R : a.Rencoded, this._Sencoded = Array.isArray(a.S) ? a.S : a.Sencoded; + } + return n(s, "S", function() { + return this.eddsa.decodeInt(this.Sencoded()); + }), n(s, "R", function() { + return this.eddsa.decodePoint(this.Rencoded()); + }), n(s, "Rencoded", function() { + return this.eddsa.encodePoint(this.R()); + }), n(s, "Sencoded", function() { + return this.eddsa.encodeInt(this.S()); + }), s.prototype.toBytes = function() { + return this.Rencoded().concat(this.Sencoded()); + }, s.prototype.toHex = function() { + return e.encode(this.toBytes(), "hex").toUpperCase(); + }, Wg = s, Wg; +} +var Kg, Wx; +function bF() { + if (Wx) return Kg; + Wx = 1; + var t = Xd(), e = x1(), r = Gi(), n = r.assert, i = r.parseBytes, s = mF(), o = vF(); + function a(f) { + if (n(f === "ed25519", "only tested with ed25519 so far"), !(this instanceof a)) + return new a(f); + f = e[f].curve, this.curve = f, this.g = f.g, this.g.precompute(f.n.bitLength() + 1), this.pointClass = f.point().constructor, this.encodingLength = Math.ceil(f.n.bitLength() / 8), this.hash = t.sha512; + } + return Kg = a, a.prototype.sign = function(u, h) { + u = i(u); + var g = this.keyFromSecret(h), v = this.hashInt(g.messagePrefix(), u), x = this.g.mul(v), S = this.encodePoint(x), C = this.hashInt(S, g.pubBytes(), u).mul(g.priv()), D = v.add(C).umod(this.curve.n); + return this.makeSignature({ R: x, S: D, Rencoded: S }); + }, a.prototype.verify = function(u, h, g) { + if (u = i(u), h = this.makeSignature(h), h.S().gte(h.eddsa.curve.n) || h.S().isNeg()) + return !1; + var v = this.keyFromPublic(g), x = this.hashInt(h.Rencoded(), v.pubBytes(), u), S = this.g.mul(h.S()), C = h.R().add(v.pub().mul(x)); + return C.eq(S); + }, a.prototype.hashInt = function() { + for (var u = this.hash(), h = 0; h < arguments.length; h++) + u.update(arguments[h]); + return r.intFromLE(u.digest()).umod(this.curve.n); + }, a.prototype.keyFromPublic = function(u) { + return s.fromPublic(this, u); + }, a.prototype.keyFromSecret = function(u) { + return s.fromSecret(this, u); + }, a.prototype.makeSignature = function(u) { + return u instanceof o ? u : new o(this, u); + }, a.prototype.encodePoint = function(u) { + var h = u.getY().toArray("le", this.encodingLength); + return h[this.encodingLength - 1] |= u.getX().isOdd() ? 128 : 0, h; + }, a.prototype.decodePoint = function(u) { + u = r.parseBytes(u); + var h = u.length - 1, g = u.slice(0, h).concat(u[h] & -129), v = (u[h] & 128) !== 0, x = r.intFromLE(g); + return this.curve.pointFromY(x, v); + }, a.prototype.encodeInt = function(u) { + return u.toArray("le", this.encodingLength); + }, a.prototype.decodeInt = function(u) { + return r.intFromLE(u); + }, a.prototype.isPoint = function(u) { + return u instanceof this.pointClass; + }, Kg; +} +var Kx; +function yF() { + return Kx || (Kx = 1, (function(t) { + var e = t; + e.version = oF.version, e.utils = Gi(), e.rand = x8(), e.curve = _8(), e.curves = x1(), e.ec = gF(), e.eddsa = bF(); + })(Rg)), Rg; +} +var wF = yF(); +const xF = { waku: { publish: "waku_publish", batchPublish: "waku_batchPublish", subscribe: "waku_subscribe", batchSubscribe: "waku_batchSubscribe", subscription: "waku_subscription", unsubscribe: "waku_unsubscribe", batchUnsubscribe: "waku_batchUnsubscribe", batchFetchMessages: "waku_batchFetchMessages" }, irn: { publish: "irn_publish", batchPublish: "irn_batchPublish", subscribe: "irn_subscribe", batchSubscribe: "irn_batchSubscribe", subscription: "irn_subscription", unsubscribe: "irn_unsubscribe", batchUnsubscribe: "irn_batchUnsubscribe", batchFetchMessages: "irn_batchFetchMessages" }, iridium: { publish: "iridium_publish", batchPublish: "iridium_batchPublish", subscribe: "iridium_subscribe", batchSubscribe: "iridium_batchSubscribe", subscription: "iridium_subscription", unsubscribe: "iridium_unsubscribe", batchUnsubscribe: "iridium_batchUnsubscribe", batchFetchMessages: "iridium_batchFetchMessages" } }, _F = ":"; +function Nc(t) { + const [e, r] = t.split(_F); + return { namespace: e, reference: r }; +} +function E8(t, e) { + return t.includes(":") ? [t] : e.chains || []; +} +var EF = Object.defineProperty, Vx = Object.getOwnPropertySymbols, SF = Object.prototype.hasOwnProperty, AF = Object.prototype.propertyIsEnumerable, Gx = (t, e, r) => e in t ? EF(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Yx = (t, e) => { + for (var r in e || (e = {})) SF.call(e, r) && Gx(t, r, e[r]); + if (Vx) for (var r of Vx(e)) AF.call(e, r) && Gx(t, r, e[r]); + return t; +}; +const PF = "ReactNative", Ei = { reactNative: "react-native", node: "node", browser: "browser", unknown: "unknown" }, MF = "js"; +function xd() { + return typeof process < "u" && typeof process.versions < "u" && typeof process.versions.node < "u"; +} +function Yc() { + return !La.getDocument() && !!La.getNavigator() && navigator.product === PF; +} +function il() { + return !xd() && !!La.getNavigator() && !!La.getDocument(); +} +function sl() { + return Yc() ? Ei.reactNative : xd() ? Ei.node : il() ? Ei.browser : Ei.unknown; +} +function IF() { + var t; + try { + return Yc() && typeof global < "u" && typeof (global == null ? void 0 : global.Application) < "u" ? (t = global.Application) == null ? void 0 : t.applicationId : void 0; + } catch { + return; + } +} +function CF(t, e) { + let r = vd.parse(t); + return r = Yx(Yx({}, r), e), t = vd.stringify(r), t; +} +function S8() { + return Q$.getWindowMetadata() || { name: "", description: "", url: "", icons: [""] }; +} +function RF() { + if (sl() === Ei.reactNative && typeof global < "u" && typeof (global == null ? void 0 : global.Platform) < "u") { + const { OS: r, Version: n } = global.Platform; + return [r, n].join("-"); + } + const t = K$(); + if (t === null) return "unknown"; + const e = t.os ? t.os.replace(" ", "").toLowerCase() : "unknown"; + return t.type === "browser" ? [e, t.name, t.version].join("-") : [e, t.version].join("-"); +} +function TF() { + var t; + const e = sl(); + return e === Ei.browser ? [e, ((t = La.getLocation()) == null ? void 0 : t.host) || "unknown"].join(":") : e; +} +function A8(t, e, r) { + const n = RF(), i = TF(); + return [[t, e].join("-"), [MF, r].join("-"), n, i].join("/"); +} +function DF({ protocol: t, version: e, relayUrl: r, sdkVersion: n, auth: i, projectId: s, useOnCloseEvent: o, bundleId: a }) { + const f = r.split("?"), u = A8(t, e, n), h = { auth: i, ua: u, projectId: s, useOnCloseEvent: o, origin: a || void 0 }, g = CF(f[1] || "", h); + return f[0] + "?" + g; +} +function Pa(t, e) { + return t.filter((r) => e.includes(r)).length === t.length; +} +function P8(t) { + return Object.fromEntries(t.entries()); +} +function M8(t) { + return new Map(Object.entries(t)); +} +function ba(t = bt.FIVE_MINUTES, e) { + const r = bt.toMiliseconds(t || bt.FIVE_MINUTES); + let n, i, s; + return { resolve: (o) => { + s && n && (clearTimeout(s), n(o)); + }, reject: (o) => { + s && i && (clearTimeout(s), i(o)); + }, done: () => new Promise((o, a) => { + s = setTimeout(() => { + a(new Error(e)); + }, r), n = o, i = a; + }) }; +} +function Lc(t, e, r) { + return new Promise(async (n, i) => { + const s = setTimeout(() => i(new Error(r)), e); + try { + const o = await t; + n(o); + } catch (o) { + i(o); + } + clearTimeout(s); + }); +} +function I8(t, e) { + if (typeof e == "string" && e.startsWith(`${t}:`)) return e; + if (t.toLowerCase() === "topic") { + if (typeof e != "string") throw new Error('Value must be "string" for expirer target type: topic'); + return `topic:${e}`; + } else if (t.toLowerCase() === "id") { + if (typeof e != "number") throw new Error('Value must be "number" for expirer target type: id'); + return `id:${e}`; + } + throw new Error(`Unknown expirer target type: ${t}`); +} +function OF(t) { + return I8("topic", t); +} +function NF(t) { + return I8("id", t); +} +function C8(t) { + const [e, r] = t.split(":"), n = { id: void 0, topic: void 0 }; + if (e === "topic" && typeof r == "string") n.topic = r; + else if (e === "id" && Number.isInteger(Number(r))) n.id = Number(r); + else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`); + return n; +} +function _n(t, e) { + return bt.fromMiliseconds(Date.now() + bt.toMiliseconds(t)); +} +function Oo(t) { + return Date.now() >= bt.toMiliseconds(t); +} +function wr(t, e) { + return `${t}${e ? `:${e}` : ""}`; +} +function zh(t = [], e = []) { + return [.../* @__PURE__ */ new Set([...t, ...e])]; +} +async function LF({ id: t, topic: e, wcDeepLink: r }) { + var n; + try { + if (!r) return; + const i = typeof r == "string" ? JSON.parse(r) : r, s = i?.href; + if (typeof s != "string") return; + const o = kF(s, t, e), a = sl(); + if (a === Ei.browser) { + if (!((n = La.getDocument()) != null && n.hasFocus())) { + console.warn("Document does not have focus, skipping deeplink."); + return; + } + o.startsWith("https://") || o.startsWith("http://") ? window.open(o, "_blank", "noreferrer noopener") : window.open(o, BF() ? "_blank" : "_self", "noreferrer noopener"); + } else a === Ei.reactNative && typeof (global == null ? void 0 : global.Linking) < "u" && await global.Linking.openURL(o); + } catch (i) { + console.error(i); + } +} +function kF(t, e, r) { + const n = `requestId=${e}&sessionTopic=${r}`; + t.endsWith("/") && (t = t.slice(0, -1)); + let i = `${t}`; + if (t.startsWith("https://t.me")) { + const s = t.includes("?") ? "&startapp=" : "?startapp="; + i = `${i}${s}${FF(n, !0)}`; + } else i = `${i}/wc?${n}`; + return i; +} +async function $F(t, e) { + let r = ""; + try { + if (il() && (r = localStorage.getItem(e), r)) return r; + r = await t.getItem(e); + } catch (n) { + console.error(n); + } + return r; +} +function Jx(t, e) { + if (!t.includes(e)) return null; + const r = t.split(/([&,?,=])/), n = r.indexOf(e); + return r[n + 2]; +} +function Xx() { + return typeof crypto < "u" && crypto != null && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu, (t) => { + const e = Math.random() * 16 | 0; + return (t === "x" ? e : e & 3 | 8).toString(16); + }); +} +function _1() { + return typeof process < "u" && process.env.IS_VITEST === "true"; +} +function BF() { + return typeof window < "u" && (!!window.TelegramWebviewProxy || !!window.Telegram || !!window.TelegramWebviewProxyProto); +} +function FF(t, e = !1) { + const r = Buffer.from(t).toString("base64"); + return e ? r.replace(/[=]/g, "") : r; +} +function R8(t) { + return Buffer.from(t, "base64").toString("utf-8"); +} +const jF = "https://rpc.walletconnect.org/v1"; +async function UF(t, e, r, n, i, s) { + switch (r.t) { + case "eip191": + return qF(t, e, r.s); + case "eip1271": + return await zF(t, e, r.s, n, i, s); + default: + throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`); + } +} +function qF(t, e, r) { + return YB(f8(e), r).toLowerCase() === t.toLowerCase(); +} +async function zF(t, e, r, n, i, s) { + const o = Nc(n); + if (!o.namespace || !o.reference) throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`); + try { + const a = "0x1626ba7e", f = "0000000000000000000000000000000000000000000000000000000000000040", u = "0000000000000000000000000000000000000000000000000000000000000041", h = r.substring(2), g = f8(e).substring(2), v = a + g + f + u + h, x = await fetch(`${s || jF}/?chainId=${n}&projectId=${i}`, { method: "POST", body: JSON.stringify({ id: HF(), jsonrpc: "2.0", method: "eth_call", params: [{ to: t, data: v }, "latest"] }) }), { result: S } = await x.json(); + return S ? S.slice(0, a.length).toLowerCase() === a.toLowerCase() : !1; + } catch (a) { + return console.error("isValidEip1271Signature: ", a), !1; + } +} +function HF() { + return Date.now() + Math.floor(Math.random() * 1e3); +} +var WF = Object.defineProperty, KF = Object.defineProperties, VF = Object.getOwnPropertyDescriptors, Zx = Object.getOwnPropertySymbols, GF = Object.prototype.hasOwnProperty, YF = Object.prototype.propertyIsEnumerable, Qx = (t, e, r) => e in t ? WF(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, JF = (t, e) => { + for (var r in e || (e = {})) GF.call(e, r) && Qx(t, r, e[r]); + if (Zx) for (var r of Zx(e)) YF.call(e, r) && Qx(t, r, e[r]); + return t; +}, XF = (t, e) => KF(t, VF(e)); +const ZF = "did:pkh:", E1 = (t) => t?.split(":"), QF = (t) => { + const e = t && E1(t); + if (e) return t.includes(ZF) ? e[3] : e[1]; +}, iv = (t) => { + const e = t && E1(t); + if (e) return e[2] + ":" + e[3]; +}, _d = (t) => { + const e = t && E1(t); + if (e) return e.pop(); +}; +async function e3(t) { + const { cacao: e, projectId: r } = t, { s: n, p: i } = e, s = T8(i, i.iss), o = _d(i.iss); + return await UF(o, s, n, iv(i.iss), r); +} +const T8 = (t, e) => { + const r = `${t.domain} wants you to sign in with your Ethereum account:`, n = _d(e); + if (!t.aud && !t.uri) throw new Error("Either `aud` or `uri` is required to construct the message"); + let i = t.statement || void 0; + const s = `URI: ${t.aud || t.uri}`, o = `Version: ${t.version}`, a = `Chain ID: ${QF(e)}`, f = `Nonce: ${t.nonce}`, u = `Issued At: ${t.iat}`, h = t.exp ? `Expiration Time: ${t.exp}` : void 0, g = t.nbf ? `Not Before: ${t.nbf}` : void 0, v = t.requestId ? `Request ID: ${t.requestId}` : void 0, x = t.resources ? `Resources:${t.resources.map((C) => ` +- ${C}`).join("")}` : void 0, S = Hh(t.resources); + if (S) { + const C = Nf(S); + i = cj(i, C); + } + return [r, n, "", i, "", s, o, a, f, u, h, g, v, x].filter((C) => C != null).join(` +`); +}; +function ej(t) { + return Buffer.from(JSON.stringify(t)).toString("base64"); +} +function tj(t) { + return JSON.parse(Buffer.from(t, "base64").toString("utf-8")); +} +function ka(t) { + if (!t) throw new Error("No recap provided, value is undefined"); + if (!t.att) throw new Error("No `att` property found"); + const e = Object.keys(t.att); + if (!(e != null && e.length)) throw new Error("No resources found in `att` property"); + e.forEach((r) => { + const n = t.att[r]; + if (Array.isArray(n)) throw new Error(`Resource must be an object: ${r}`); + if (typeof n != "object") throw new Error(`Resource must be an object: ${r}`); + if (!Object.keys(n).length) throw new Error(`Resource object is empty: ${r}`); + Object.keys(n).forEach((i) => { + const s = n[i]; + if (!Array.isArray(s)) throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`); + if (!s.length) throw new Error(`Value of ${i} is empty array, must be an array with objects`); + s.forEach((o) => { + if (typeof o != "object") throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`); + }); + }); + }); +} +function rj(t, e, r, n = {}) { + return r?.sort((i, s) => i.localeCompare(s)), { att: { [t]: nj(e, r, n) } }; +} +function nj(t, e, r = {}) { + e = e?.sort((i, s) => i.localeCompare(s)); + const n = e.map((i) => ({ [`${t}/${i}`]: [r] })); + return Object.assign({}, ...n); +} +function D8(t) { + return ka(t), `urn:recap:${ej(t).replace(/=/g, "")}`; +} +function Nf(t) { + const e = tj(t.replace("urn:recap:", "")); + return ka(e), e; +} +function ij(t, e, r) { + const n = rj(t, e, r); + return D8(n); +} +function sj(t) { + return t && t.includes("urn:recap:"); +} +function oj(t, e) { + const r = Nf(t), n = Nf(e), i = aj(r, n); + return D8(i); +} +function aj(t, e) { + ka(t), ka(e); + const r = Object.keys(t.att).concat(Object.keys(e.att)).sort((i, s) => i.localeCompare(s)), n = { att: {} }; + return r.forEach((i) => { + var s, o; + Object.keys(((s = t.att) == null ? void 0 : s[i]) || {}).concat(Object.keys(((o = e.att) == null ? void 0 : o[i]) || {})).sort((a, f) => a.localeCompare(f)).forEach((a) => { + var f, u; + n.att[i] = XF(JF({}, n.att[i]), { [a]: ((f = t.att[i]) == null ? void 0 : f[a]) || ((u = e.att[i]) == null ? void 0 : u[a]) }); + }); + }), n; +} +function cj(t = "", e) { + ka(e); + const r = "I further authorize the stated URI to perform the following actions on my behalf: "; + if (t.includes(r)) return t; + const n = []; + let i = 0; + Object.keys(e.att).forEach((a) => { + const f = Object.keys(e.att[a]).map((g) => ({ ability: g.split("/")[0], action: g.split("/")[1] })); + f.sort((g, v) => g.action.localeCompare(v.action)); + const u = {}; + f.forEach((g) => { + u[g.ability] || (u[g.ability] = []), u[g.ability].push(g.action); + }); + const h = Object.keys(u).map((g) => (i++, `(${i}) '${g}': '${u[g].join("', '")}' for '${a}'.`)); + n.push(h.join(", ").replace(".,", ".")); + }); + const s = n.join(" "), o = `${r}${s}`; + return `${t ? t + " " : ""}${o}`; +} +function t3(t) { + var e; + const r = Nf(t); + ka(r); + const n = (e = r.att) == null ? void 0 : e.eip155; + return n ? Object.keys(n).map((i) => i.split("/")[1]) : []; +} +function r3(t) { + const e = Nf(t); + ka(e); + const r = []; + return Object.values(e.att).forEach((n) => { + Object.values(n).forEach((i) => { + var s; + (s = i?.[0]) != null && s.chains && r.push(i[0].chains); + }); + }), [...new Set(r.flat())]; +} +function Hh(t) { + if (!t) return; + const e = t?.[t.length - 1]; + return sj(e) ? e : void 0; +} +const O8 = "base10", ti = "base16", ko = "base64pad", Ou = "base64url", ol = "utf8", N8 = 0, so = 1, al = 2, uj = 0, n3 = 1, ef = 12, S1 = 32; +function fj() { + const t = y8.generateKeyPair(); + return { privateKey: Tn(t.secretKey, ti), publicKey: Tn(t.publicKey, ti) }; +} +function sv() { + const t = tl.randomBytes(S1); + return Tn(t, ti); +} +function lj(t, e) { + const r = y8.sharedKey(Cn(t, ti), Cn(e, ti), !0), n = new rF.HKDF(e0.SHA256, r).expand(S1); + return Tn(n, ti); +} +function Wh(t) { + const e = e0.hash(Cn(t, ti)); + return Tn(e, ti); +} +function Qs(t) { + const e = e0.hash(Cn(t, ol)); + return Tn(e, ti); +} +function L8(t) { + return Cn(`${t}`, O8); +} +function $a(t) { + return Number(Tn(t, O8)); +} +function hj(t) { + const e = L8(typeof t.type < "u" ? t.type : N8); + if ($a(e) === so && typeof t.senderPublicKey > "u") throw new Error("Missing sender public key for type 1 envelope"); + const r = typeof t.senderPublicKey < "u" ? Cn(t.senderPublicKey, ti) : void 0, n = typeof t.iv < "u" ? Cn(t.iv, ti) : tl.randomBytes(ef), i = new b8.ChaCha20Poly1305(Cn(t.symKey, ti)).seal(n, Cn(t.message, ol)); + return k8({ type: e, sealed: i, iv: n, senderPublicKey: r, encoding: t.encoding }); +} +function dj(t, e) { + const r = L8(al), n = tl.randomBytes(ef), i = Cn(t, ol); + return k8({ type: r, sealed: i, iv: n, encoding: e }); +} +function pj(t) { + const e = new b8.ChaCha20Poly1305(Cn(t.symKey, ti)), { sealed: r, iv: n } = Lf({ encoded: t.encoded, encoding: t?.encoding }), i = e.open(n, r); + if (i === null) throw new Error("Failed to decrypt"); + return Tn(i, ol); +} +function gj(t, e) { + const { sealed: r } = Lf({ encoded: t, encoding: e }); + return Tn(r, ol); +} +function k8(t) { + const { encoding: e = ko } = t; + if ($a(t.type) === al) return Tn($h([t.type, t.sealed]), e); + if ($a(t.type) === so) { + if (typeof t.senderPublicKey > "u") throw new Error("Missing sender public key for type 1 envelope"); + return Tn($h([t.type, t.senderPublicKey, t.iv, t.sealed]), e); + } + return Tn($h([t.type, t.iv, t.sealed]), e); +} +function Lf(t) { + const { encoded: e, encoding: r = ko } = t, n = Cn(e, r), i = n.slice(uj, n3), s = n3; + if ($a(i) === so) { + const u = s + S1, h = u + ef, g = n.slice(s, u), v = n.slice(u, h), x = n.slice(h); + return { type: i, sealed: x, iv: v, senderPublicKey: g }; + } + if ($a(i) === al) { + const u = n.slice(s), h = tl.randomBytes(ef); + return { type: i, sealed: u, iv: h }; + } + const o = s + ef, a = n.slice(s, o), f = n.slice(o); + return { type: i, sealed: f, iv: a }; +} +function mj(t, e) { + const r = Lf({ encoded: t, encoding: e?.encoding }); + return $8({ type: $a(r.type), senderPublicKey: typeof r.senderPublicKey < "u" ? Tn(r.senderPublicKey, ti) : void 0, receiverPublicKey: e?.receiverPublicKey }); +} +function $8(t) { + const e = t?.type || N8; + if (e === so) { + if (typeof t?.senderPublicKey > "u") throw new Error("missing sender public key"); + if (typeof t?.receiverPublicKey > "u") throw new Error("missing receiver public key"); + } + return { type: e, senderPublicKey: t?.senderPublicKey, receiverPublicKey: t?.receiverPublicKey }; +} +function i3(t) { + return t.type === so && typeof t.senderPublicKey == "string" && typeof t.receiverPublicKey == "string"; +} +function s3(t) { + return t.type === al; +} +function vj(t) { + return new wF.ec("p256").keyFromPublic({ x: Buffer.from(t.x, "base64").toString("hex"), y: Buffer.from(t.y, "base64").toString("hex") }, "hex"); +} +function bj(t) { + let e = t.replace(/-/g, "+").replace(/_/g, "/"); + const r = e.length % 4; + return r > 0 && (e += "=".repeat(4 - r)), e; +} +function yj(t) { + return Buffer.from(bj(t), "base64"); +} +function wj(t, e) { + const [r, n, i] = t.split("."), s = yj(i); + if (s.length !== 64) throw new Error("Invalid signature length"); + const o = s.slice(0, 32).toString("hex"), a = s.slice(32, 64).toString("hex"), f = `${r}.${n}`, u = new e0.SHA256().update(Buffer.from(f)).digest(), h = vj(e), g = Buffer.from(u).toString("hex"); + if (!h.verify(g, { r: o, s: a })) throw new Error("Invalid signature"); + return ev(t).payload; +} +const xj = "irn"; +function ov(t) { + return t?.relay || { protocol: xj }; +} +function Vu(t) { + const e = xF[t]; + if (typeof e > "u") throw new Error(`Relay Protocol not supported: ${t}`); + return e; +} +var _j = Object.defineProperty, Ej = Object.defineProperties, Sj = Object.getOwnPropertyDescriptors, o3 = Object.getOwnPropertySymbols, Aj = Object.prototype.hasOwnProperty, Pj = Object.prototype.propertyIsEnumerable, a3 = (t, e, r) => e in t ? _j(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, c3 = (t, e) => { + for (var r in e || (e = {})) Aj.call(e, r) && a3(t, r, e[r]); + if (o3) for (var r of o3(e)) Pj.call(e, r) && a3(t, r, e[r]); + return t; +}, Mj = (t, e) => Ej(t, Sj(e)); +function Ij(t, e = "-") { + const r = {}, n = "relay" + e; + return Object.keys(t).forEach((i) => { + if (i.startsWith(n)) { + const s = i.replace(n, ""), o = t[i]; + r[s] = o; + } + }), r; +} +function u3(t) { + if (!t.includes("wc:")) { + const f = R8(t); + f != null && f.includes("wc:") && (t = f); + } + t = t.includes("wc://") ? t.replace("wc://", "") : t, t = t.includes("wc:") ? t.replace("wc:", "") : t; + const e = t.indexOf(":"), r = t.indexOf("?") !== -1 ? t.indexOf("?") : void 0, n = t.substring(0, e), i = t.substring(e + 1, r).split("@"), s = typeof r < "u" ? t.substring(r) : "", o = vd.parse(s), a = typeof o.methods == "string" ? o.methods.split(",") : void 0; + return { protocol: n, topic: Cj(i[0]), version: parseInt(i[1], 10), symKey: o.symKey, relay: Ij(o), methods: a, expiryTimestamp: o.expiryTimestamp ? parseInt(o.expiryTimestamp, 10) : void 0 }; +} +function Cj(t) { + return t.startsWith("//") ? t.substring(2) : t; +} +function Rj(t, e = "-") { + const r = "relay", n = {}; + return Object.keys(t).forEach((i) => { + const s = r + e + i; + t[i] && (n[s] = t[i]); + }), n; +} +function f3(t) { + return `${t.protocol}:${t.topic}@${t.version}?` + vd.stringify(c3(Mj(c3({ symKey: t.symKey }, Rj(t.relay)), { expiryTimestamp: t.expiryTimestamp }), t.methods ? { methods: t.methods.join(",") } : {})); +} +function Eh(t, e, r) { + return `${t}?wc_ev=${r}&topic=${e}`; +} +function Jc(t) { + const e = []; + return t.forEach((r) => { + const [n, i] = r.split(":"); + e.push(`${n}:${i}`); + }), e; +} +function Tj(t) { + const e = []; + return Object.values(t).forEach((r) => { + e.push(...Jc(r.accounts)); + }), e; +} +function Dj(t, e) { + const r = []; + return Object.values(t).forEach((n) => { + Jc(n.accounts).includes(e) && r.push(...n.methods); + }), r; +} +function Oj(t, e) { + const r = []; + return Object.values(t).forEach((n) => { + Jc(n.accounts).includes(e) && r.push(...n.events); + }), r; +} +function A1(t) { + return t.includes(":"); +} +function Gu(t) { + return A1(t) ? t.split(":")[0] : t; +} +function Nj(t) { + const e = {}; + return t?.forEach((r) => { + const [n, i] = r.split(":"); + e[n] || (e[n] = { accounts: [], chains: [], events: [] }), e[n].accounts.push(r), e[n].chains.push(`${n}:${i}`); + }), e; +} +function l3(t, e) { + e = e.map((n) => n.replace("did:pkh:", "")); + const r = Nj(e); + for (const [n, i] of Object.entries(r)) i.methods ? i.methods = zh(i.methods, t) : i.methods = t, i.events = ["chainChanged", "accountsChanged"]; + return r; +} +const Lj = { INVALID_METHOD: { message: "Invalid method.", code: 1001 }, INVALID_EVENT: { message: "Invalid event.", code: 1002 }, INVALID_UPDATE_REQUEST: { message: "Invalid update request.", code: 1003 }, INVALID_EXTEND_REQUEST: { message: "Invalid extend request.", code: 1004 }, INVALID_SESSION_SETTLE_REQUEST: { message: "Invalid session settle request.", code: 1005 }, UNAUTHORIZED_METHOD: { message: "Unauthorized method.", code: 3001 }, UNAUTHORIZED_EVENT: { message: "Unauthorized event.", code: 3002 }, UNAUTHORIZED_UPDATE_REQUEST: { message: "Unauthorized update request.", code: 3003 }, UNAUTHORIZED_EXTEND_REQUEST: { message: "Unauthorized extend request.", code: 3004 }, USER_REJECTED: { message: "User rejected.", code: 5e3 }, USER_REJECTED_CHAINS: { message: "User rejected chains.", code: 5001 }, USER_REJECTED_METHODS: { message: "User rejected methods.", code: 5002 }, USER_REJECTED_EVENTS: { message: "User rejected events.", code: 5003 }, UNSUPPORTED_CHAINS: { message: "Unsupported chains.", code: 5100 }, UNSUPPORTED_METHODS: { message: "Unsupported methods.", code: 5101 }, UNSUPPORTED_EVENTS: { message: "Unsupported events.", code: 5102 }, UNSUPPORTED_ACCOUNTS: { message: "Unsupported accounts.", code: 5103 }, UNSUPPORTED_NAMESPACE_KEY: { message: "Unsupported namespace key.", code: 5104 }, USER_DISCONNECTED: { message: "User disconnected.", code: 6e3 }, SESSION_SETTLEMENT_FAILED: { message: "Session settlement failed.", code: 7e3 }, WC_METHOD_UNSUPPORTED: { message: "Unsupported wc_ method.", code: 10001 } }, kj = { NOT_INITIALIZED: { message: "Not initialized.", code: 1 }, NO_MATCHING_KEY: { message: "No matching key.", code: 2 }, RESTORE_WILL_OVERRIDE: { message: "Restore will override.", code: 3 }, RESUBSCRIBED: { message: "Resubscribed.", code: 4 }, MISSING_OR_INVALID: { message: "Missing or invalid.", code: 5 }, EXPIRED: { message: "Expired.", code: 6 }, UNKNOWN_TYPE: { message: "Unknown type.", code: 7 }, MISMATCHED_TOPIC: { message: "Mismatched topic.", code: 8 }, NON_CONFORMING_NAMESPACES: { message: "Non conforming namespaces.", code: 9 } }; +function ft(t, e) { + const { message: r, code: n } = kj[t]; + return { message: e ? `${r} ${e}` : r, code: n }; +} +function Nr(t, e) { + const { message: r, code: n } = Lj[t]; + return { message: e ? `${r} ${e}` : r, code: n }; +} +function Ba(t, e) { + return !!Array.isArray(t); +} +function kf(t) { + return Object.getPrototypeOf(t) === Object.prototype && Object.keys(t).length; +} +function ei(t) { + return typeof t > "u"; +} +function hn(t, e) { + return e && ei(t) ? !0 : typeof t == "string" && !!t.trim().length; +} +function P1(t, e) { + return e && ei(t) ? !0 : typeof t == "number" && !isNaN(t); +} +function $j(t, e) { + const { requiredNamespaces: r } = e, n = Object.keys(t.namespaces), i = Object.keys(r); + let s = !0; + return Pa(i, n) ? (n.forEach((o) => { + const { accounts: a, methods: f, events: u } = t.namespaces[o], h = Jc(a), g = r[o]; + (!Pa(E8(o, g), h) || !Pa(g.methods, f) || !Pa(g.events, u)) && (s = !1); + }), s) : !1; +} +function Ed(t) { + return hn(t, !1) && t.includes(":") ? t.split(":").length === 2 : !1; +} +function Bj(t) { + if (hn(t, !1) && t.includes(":")) { + const e = t.split(":"); + if (e.length === 3) { + const r = e[0] + ":" + e[1]; + return !!e[2] && Ed(r); + } + } + return !1; +} +function Fj(t) { + function e(r) { + try { + return typeof new URL(r) < "u"; + } catch { + return !1; + } + } + try { + if (hn(t, !1)) { + if (e(t)) return !0; + const r = R8(t); + return e(r); + } + } catch { + } + return !1; +} +function jj(t) { + var e; + return (e = t?.proposer) == null ? void 0 : e.publicKey; +} +function Uj(t) { + return t?.topic; +} +function qj(t, e) { + let r = null; + return hn(t?.publicKey, !1) || (r = ft("MISSING_OR_INVALID", `${e} controller public key should be a string`)), r; +} +function h3(t) { + let e = !0; + return Ba(t) ? t.length && (e = t.every((r) => hn(r, !1))) : e = !1, e; +} +function zj(t, e, r) { + let n = null; + return Ba(e) && e.length ? e.forEach((i) => { + n || Ed(i) || (n = Nr("UNSUPPORTED_CHAINS", `${r}, chain ${i} should be a string and conform to "namespace:chainId" format`)); + }) : Ed(t) || (n = Nr("UNSUPPORTED_CHAINS", `${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)), n; +} +function Hj(t, e, r) { + let n = null; + return Object.entries(t).forEach(([i, s]) => { + if (n) return; + const o = zj(i, E8(i, s), `${e} ${r}`); + o && (n = o); + }), n; +} +function Wj(t, e) { + let r = null; + return Ba(t) ? t.forEach((n) => { + r || Bj(n) || (r = Nr("UNSUPPORTED_ACCOUNTS", `${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`)); + }) : r = Nr("UNSUPPORTED_ACCOUNTS", `${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`), r; +} +function Kj(t, e) { + let r = null; + return Object.values(t).forEach((n) => { + if (r) return; + const i = Wj(n?.accounts, `${e} namespace`); + i && (r = i); + }), r; +} +function Vj(t, e) { + let r = null; + return h3(t?.methods) ? h3(t?.events) || (r = Nr("UNSUPPORTED_EVENTS", `${e}, events should be an array of strings or empty array for no events`)) : r = Nr("UNSUPPORTED_METHODS", `${e}, methods should be an array of strings or empty array for no methods`), r; +} +function B8(t, e) { + let r = null; + return Object.values(t).forEach((n) => { + if (r) return; + const i = Vj(n, `${e}, namespace`); + i && (r = i); + }), r; +} +function Gj(t, e, r) { + let n = null; + if (t && kf(t)) { + const i = B8(t, e); + i && (n = i); + const s = Hj(t, e, r); + s && (n = s); + } else n = ft("MISSING_OR_INVALID", `${e}, ${r} should be an object with data`); + return n; +} +function Vg(t, e) { + let r = null; + if (t && kf(t)) { + const n = B8(t, e); + n && (r = n); + const i = Kj(t, e); + i && (r = i); + } else r = ft("MISSING_OR_INVALID", `${e}, namespaces should be an object with data`); + return r; +} +function F8(t) { + return hn(t.protocol, !0); +} +function Yj(t, e) { + let r = !1; + return t ? t && Ba(t) && t.length && t.forEach((n) => { + r = F8(n); + }) : r = !0, r; +} +function Jj(t) { + return typeof t == "number"; +} +function ui(t) { + return typeof t < "u" && typeof t !== null; +} +function Xj(t) { + return !(!t || typeof t != "object" || !t.code || !P1(t.code, !1) || !t.message || !hn(t.message, !1)); +} +function Zj(t) { + return !(ei(t) || !hn(t.method, !1)); +} +function Qj(t) { + return !(ei(t) || ei(t.result) && ei(t.error) || !P1(t.id, !1) || !hn(t.jsonrpc, !1)); +} +function eU(t) { + return !(ei(t) || !hn(t.name, !1)); +} +function d3(t, e) { + return !(!Ed(e) || !Tj(t).includes(e)); +} +function tU(t, e, r) { + return hn(r, !1) ? Dj(t, e).includes(r) : !1; +} +function rU(t, e, r) { + return hn(r, !1) ? Oj(t, e).includes(r) : !1; +} +function p3(t, e, r) { + let n = null; + const i = nU(t), s = iU(e), o = Object.keys(i), a = Object.keys(s), f = g3(Object.keys(t)), u = g3(Object.keys(e)), h = f.filter((g) => !u.includes(g)); + return h.length && (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces keys don't satisfy requiredNamespaces. + Required: ${h.toString()} + Received: ${Object.keys(e).toString()}`)), Pa(o, a) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces chains don't satisfy required namespaces. + Required: ${o.toString()} + Approved: ${a.toString()}`)), Object.keys(e).forEach((g) => { + if (!g.includes(":") || n) return; + const v = Jc(e[g].accounts); + v.includes(g) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces accounts don't satisfy namespace accounts for ${g} + Required: ${g} + Approved: ${v.toString()}`)); + }), o.forEach((g) => { + n || (Pa(i[g].methods, s[g].methods) ? Pa(i[g].events, s[g].events) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces events don't satisfy namespace events for ${g}`)) : n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces methods don't satisfy namespace methods for ${g}`)); + }), n; +} +function nU(t) { + const e = {}; + return Object.keys(t).forEach((r) => { + var n; + r.includes(":") ? e[r] = t[r] : (n = t[r].chains) == null || n.forEach((i) => { + e[i] = { methods: t[r].methods, events: t[r].events }; + }); + }), e; +} +function g3(t) { + return [...new Set(t.map((e) => e.includes(":") ? e.split(":")[0] : e))]; +} +function iU(t) { + const e = {}; + return Object.keys(t).forEach((r) => { + r.includes(":") ? e[r] = t[r] : Jc(t[r].accounts)?.forEach((i) => { + e[i] = { accounts: t[r].accounts.filter((s) => s.includes(`${i}:`)), methods: t[r].methods, events: t[r].events }; + }); + }), e; +} +function sU(t, e) { + return P1(t, !1) && t <= e.max && t >= e.min; +} +function m3() { + const t = sl(); + return new Promise((e) => { + switch (t) { + case Ei.browser: + e(oU()); + break; + case Ei.reactNative: + e(aU()); + break; + case Ei.node: + e(cU()); + break; + default: + e(!0); + } + }); +} +function oU() { + return il() && navigator?.onLine; +} +async function aU() { + return Yc() && typeof global < "u" && global != null && global.NetInfo ? (await (global == null ? void 0 : global.NetInfo.fetch()))?.isConnected : !0; +} +function cU() { + return !0; +} +function uU(t) { + switch (sl()) { + case Ei.browser: + fU(t); + break; + case Ei.reactNative: + lU(t); + break; + } +} +function fU(t) { + !Yc() && il() && (window.addEventListener("online", () => t(!0)), window.addEventListener("offline", () => t(!1))); +} +function lU(t) { + Yc() && typeof global < "u" && global != null && global.NetInfo && global?.NetInfo.addEventListener((e) => t(e?.isConnected)); +} +const Gg = {}; +class Nu { + static get(e) { + return Gg[e]; + } + static set(e, r) { + Gg[e] = r; + } + static delete(e) { + delete Gg[e]; + } +} +const hU = "PARSE_ERROR", dU = "INVALID_REQUEST", pU = "METHOD_NOT_FOUND", gU = "INVALID_PARAMS", j8 = "INTERNAL_ERROR", M1 = "SERVER_ERROR", mU = [-32700, -32600, -32601, -32602, -32603], tf = { + [hU]: { code: -32700, message: "Parse error" }, + [dU]: { code: -32600, message: "Invalid Request" }, + [pU]: { code: -32601, message: "Method not found" }, + [gU]: { code: -32602, message: "Invalid params" }, + [j8]: { code: -32603, message: "Internal error" }, + [M1]: { code: -32e3, message: "Server error" } +}, U8 = M1; +function vU(t) { + return mU.includes(t); +} +function v3(t) { + return Object.keys(tf).includes(t) ? tf[t] : tf[U8]; +} +function bU(t) { + const e = Object.values(tf).find((r) => r.code === t); + return e || tf[U8]; +} +function q8(t, e, r) { + return t.message.includes("getaddrinfo ENOTFOUND") || t.message.includes("connect ECONNREFUSED") ? new Error(`Unavailable ${r} RPC url at ${e}`) : t; +} +var Yg = {}, Gs = {}, b3; +function yU() { + if (b3) return Gs; + b3 = 1, Object.defineProperty(Gs, "__esModule", { value: !0 }), Gs.isBrowserCryptoAvailable = Gs.getSubtleCrypto = Gs.getBrowerCrypto = void 0; + function t() { + return Zn?.crypto || Zn?.msCrypto || {}; + } + Gs.getBrowerCrypto = t; + function e() { + const n = t(); + return n.subtle || n.webkitSubtle; + } + Gs.getSubtleCrypto = e; + function r() { + return !!t() && !!e(); + } + return Gs.isBrowserCryptoAvailable = r, Gs; +} +var Ys = {}, y3; +function wU() { + if (y3) return Ys; + y3 = 1, Object.defineProperty(Ys, "__esModule", { value: !0 }), Ys.isBrowser = Ys.isNode = Ys.isReactNative = void 0; + function t() { + return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative"; + } + Ys.isReactNative = t; + function e() { + return typeof process < "u" && typeof process.versions < "u" && typeof process.versions.node < "u"; + } + Ys.isNode = e; + function r() { + return !t() && !e(); + } + return Ys.isBrowser = r, Ys; +} +var w3; +function xU() { + return w3 || (w3 = 1, (function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }); + const e = Yf; + e.__exportStar(yU(), t), e.__exportStar(wU(), t); + })(Yg)), Yg; +} +var _U = xU(); +function No(t = 3) { + const e = Date.now() * Math.pow(10, t), r = Math.floor(Math.random() * Math.pow(10, t)); + return e + r; +} +function Ma(t = 6) { + return BigInt(No(t)); +} +function $o(t, e, r) { + return { + id: r || No(), + jsonrpc: "2.0", + method: t, + params: e + }; +} +function r0(t, e) { + return { + id: t, + jsonrpc: "2.0", + result: e + }; +} +function n0(t, e, r) { + return { + id: t, + jsonrpc: "2.0", + error: EU(e) + }; +} +function EU(t, e) { + return typeof t > "u" ? v3(j8) : (typeof t == "string" && (t = Object.assign(Object.assign({}, v3(M1)), { message: t })), vU(t.code) && (t = bU(t.code)), t); +} +let SU = class { +}, AU = class extends SU { + constructor() { + super(); + } +}, PU = class extends AU { + constructor(e) { + super(); + } +}; +const MU = "^https?:", IU = "^wss?:"; +function CU(t) { + const e = t.match(new RegExp(/^\w+:/, "gi")); + if (!(!e || !e.length)) + return e[0]; +} +function z8(t, e) { + const r = CU(t); + return typeof r > "u" ? !1 : new RegExp(e).test(r); +} +function x3(t) { + return z8(t, MU); +} +function _3(t) { + return z8(t, IU); +} +function RU(t) { + return new RegExp("wss?://localhost(:d{2,5})?").test(t); +} +function H8(t) { + return typeof t == "object" && "id" in t && "jsonrpc" in t && t.jsonrpc === "2.0"; +} +function I1(t) { + return H8(t) && "method" in t; +} +function i0(t) { + return H8(t) && (Ps(t) || qi(t)); +} +function Ps(t) { + return "result" in t; +} +function qi(t) { + return "error" in t; +} +let Yi = class extends PU { + constructor(e) { + super(e), this.events = new Wi.EventEmitter(), this.hasRegisteredEventListeners = !1, this.connection = this.setConnection(e), this.connection.connected && this.registerEventListeners(); + } + async connect(e = this.connection) { + await this.open(e); + } + async disconnect() { + await this.close(); + } + on(e, r) { + this.events.on(e, r); + } + once(e, r) { + this.events.once(e, r); + } + off(e, r) { + this.events.off(e, r); + } + removeListener(e, r) { + this.events.removeListener(e, r); + } + async request(e, r) { + return this.requestStrict($o(e.method, e.params || [], e.id || Ma().toString()), r); + } + async requestStrict(e, r) { + return new Promise(async (n, i) => { + if (!this.connection.connected) try { + await this.open(); + } catch (s) { + i(s); + } + this.events.on(`${e.id}`, (s) => { + qi(s) ? i(s.error) : n(s.result); + }); + try { + await this.connection.send(e, r); + } catch (s) { + i(s); + } + }); + } + setConnection(e = this.connection) { + return e; + } + onPayload(e) { + this.events.emit("payload", e), i0(e) ? this.events.emit(`${e.id}`, e) : this.events.emit("message", { type: e.method, data: e.params }); + } + onClose(e) { + e && e.code === 3e3 && this.events.emit("error", new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason ? `(${e.reason})` : ""}`)), this.events.emit("disconnect"); + } + async open(e = this.connection) { + this.connection === e && this.connection.connected || (this.connection.connected && this.close(), typeof e == "string" && (await this.connection.open(e), e = this.connection), this.connection = this.setConnection(e), await this.connection.open(), this.registerEventListeners(), this.events.emit("connect")); + } + async close() { + await this.connection.close(); + } + registerEventListeners() { + this.hasRegisteredEventListeners || (this.connection.on("payload", (e) => this.onPayload(e)), this.connection.on("close", (e) => this.onClose(e)), this.connection.on("error", (e) => this.events.emit("error", e)), this.connection.on("register_error", (e) => this.onClose()), this.hasRegisteredEventListeners = !0); + } +}; +const TU = () => typeof WebSocket < "u" ? WebSocket : typeof global < "u" && typeof global.WebSocket < "u" ? global.WebSocket : typeof window < "u" && typeof window.WebSocket < "u" ? window.WebSocket : typeof self < "u" && typeof self.WebSocket < "u" ? self.WebSocket : require("ws"), DU = () => typeof WebSocket < "u" || typeof global < "u" && typeof global.WebSocket < "u" || typeof window < "u" && typeof window.WebSocket < "u" || typeof self < "u" && typeof self.WebSocket < "u", E3 = (t) => t.split("?")[0], S3 = 10, OU = TU(); +let NU = class { + constructor(e) { + if (this.url = e, this.events = new Wi.EventEmitter(), this.registering = !1, !_3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); + this.url = e; + } + get connected() { + return typeof this.socket < "u"; + } + get connecting() { + return this.registering; + } + on(e, r) { + this.events.on(e, r); + } + once(e, r) { + this.events.once(e, r); + } + off(e, r) { + this.events.off(e, r); + } + removeListener(e, r) { + this.events.removeListener(e, r); + } + async open(e = this.url) { + await this.register(e); + } + async close() { + return new Promise((e, r) => { + if (typeof this.socket > "u") { + r(new Error("Connection already closed")); + return; + } + this.socket.onclose = (n) => { + this.onClose(n), e(); + }, this.socket.close(); + }); + } + async send(e) { + typeof this.socket > "u" && (this.socket = await this.register()); + try { + this.socket.send(ho(e)); + } catch (r) { + this.onError(e.id, r); + } + } + register(e = this.url) { + if (!_3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); + if (this.registering) { + const r = this.events.getMaxListeners(); + return (this.events.listenerCount("register_error") >= r || this.events.listenerCount("open") >= r) && this.events.setMaxListeners(r + 1), new Promise((n, i) => { + this.events.once("register_error", (s) => { + this.resetMaxListeners(), i(s); + }), this.events.once("open", () => { + if (this.resetMaxListeners(), typeof this.socket > "u") return i(new Error("WebSocket connection is missing or invalid")); + n(this.socket); + }); + }); + } + return this.url = e, this.registering = !0, new Promise((r, n) => { + const i = new URLSearchParams(e).get("origin"), s = _U.isReactNative() ? { headers: { origin: i } } : { rejectUnauthorized: !RU(e) }, o = new OU(e, [], s); + DU() ? o.onerror = (a) => { + const f = a; + n(this.emitError(f.error)); + } : o.on("error", (a) => { + n(this.emitError(a)); + }), o.onopen = () => { + this.onOpen(o), r(o); + }; + }); + } + onOpen(e) { + e.onmessage = (r) => this.onPayload(r), e.onclose = (r) => this.onClose(r), this.socket = e, this.registering = !1, this.events.emit("open"); + } + onClose(e) { + this.socket = void 0, this.registering = !1, this.events.emit("close", e); + } + onPayload(e) { + if (typeof e.data > "u") return; + const r = typeof e.data == "string" ? Na(e.data) : e.data; + this.events.emit("payload", r); + } + onError(e, r) { + const n = this.parseError(r), i = n.message || n.toString(), s = n0(e, i); + this.events.emit("payload", s); + } + parseError(e, r = this.url) { + return q8(e, E3(r), "WS"); + } + resetMaxListeners() { + this.events.getMaxListeners() > S3 && this.events.setMaxListeners(S3); + } + emitError(e) { + const r = this.parseError(new Error(e?.message || `WebSocket connection failed for host: ${E3(this.url)}`)); + return this.events.emit("register_error", r), r; + } +}; +var Yu = { exports: {} }; +Yu.exports; +var A3; +function LU() { + return A3 || (A3 = 1, (function(t, e) { + var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", f = "[object Array]", u = "[object AsyncFunction]", h = "[object Boolean]", g = "[object Date]", v = "[object Error]", x = "[object Function]", S = "[object GeneratorFunction]", C = "[object Map]", D = "[object Number]", $ = "[object Null]", N = "[object Object]", z = "[object Promise]", k = "[object Proxy]", B = "[object RegExp]", U = "[object Set]", R = "[object String]", W = "[object Symbol]", J = "[object Undefined]", ne = "[object WeakMap]", K = "[object ArrayBuffer]", E = "[object DataView]", b = "[object Float32Array]", l = "[object Float64Array]", p = "[object Int8Array]", m = "[object Int16Array]", w = "[object Int32Array]", P = "[object Uint8Array]", _ = "[object Uint8ClampedArray]", y = "[object Uint16Array]", M = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, q = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, L = {}; + L[b] = L[l] = L[p] = L[m] = L[w] = L[P] = L[_] = L[y] = L[M] = !0, L[a] = L[f] = L[K] = L[h] = L[E] = L[g] = L[v] = L[x] = L[C] = L[D] = L[N] = L[B] = L[U] = L[R] = L[ne] = !1; + var oe = typeof Zn == "object" && Zn && Zn.Object === Object && Zn, Q = typeof self == "object" && self && self.Object === Object && self, X = oe || Q || Function("return this")(), ee = e && !e.nodeType && e, O = ee && !0 && t && !t.nodeType && t, Z = O && O.exports === ee, re = Z && oe.process, he = (function() { + try { + return re && re.binding && re.binding("util"); + } catch { + } + })(), ae = he && he.isTypedArray; + function fe(ue, we) { + for (var Ve = -1, St = ue == null ? 0 : ue.length, jr = 0, ir = []; ++Ve < St; ) { + var Kr = ue[Ve]; + we(Kr, Ve, ue) && (ir[jr++] = Kr); + } + return ir; + } + function be(ue, we) { + for (var Ve = -1, St = we.length, jr = ue.length; ++Ve < St; ) + ue[jr + Ve] = we[Ve]; + return ue; + } + function Ae(ue, we) { + for (var Ve = -1, St = ue == null ? 0 : ue.length; ++Ve < St; ) + if (we(ue[Ve], Ve, ue)) + return !0; + return !1; + } + function Te(ue, we) { + for (var Ve = -1, St = Array(ue); ++Ve < ue; ) + St[Ve] = we(Ve); + return St; + } + function Re(ue) { + return function(we) { + return ue(we); + }; + } + function $e(ue, we) { + return ue.has(we); + } + function Me(ue, we) { + return ue?.[we]; + } + function Oe(ue) { + var we = -1, Ve = Array(ue.size); + return ue.forEach(function(St, jr) { + Ve[++we] = [jr, St]; + }), Ve; + } + function ze(ue, we) { + return function(Ve) { + return ue(we(Ve)); + }; + } + function De(ue) { + var we = -1, Ve = Array(ue.size); + return ue.forEach(function(St) { + Ve[++we] = St; + }), Ve; + } + var je = Array.prototype, Ue = Function.prototype, _e = Object.prototype, Ze = X["__core-js_shared__"], ot = Ue.toString, ke = _e.hasOwnProperty, rt = (function() { + var ue = /[^.]+$/.exec(Ze && Ze.keys && Ze.keys.IE_PROTO || ""); + return ue ? "Symbol(src)_1." + ue : ""; + })(), nt = _e.toString, Ge = RegExp( + "^" + ot.call(ke).replace(I, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" + ), ht = Z ? X.Buffer : void 0, lt = X.Symbol, ct = X.Uint8Array, qt = _e.propertyIsEnumerable, Gt = je.splice, Et = lt ? lt.toStringTag : void 0, Yt = Object.getOwnPropertySymbols, tr = ht ? ht.isBuffer : void 0, Tt = ze(Object.keys, Object), kt = xr(X, "DataView"), It = xr(X, "Map"), dt = xr(X, "Promise"), Dt = xr(X, "Set"), Nt = xr(X, "WeakMap"), mt = xr(Object, "create"), Bt = ks(kt), Ft = ks(It), et = ks(dt), $t = ks(Dt), H = ks(Nt), V = lt ? lt.prototype : void 0, Y = V ? V.valueOf : void 0; + function T(ue) { + var we = -1, Ve = ue == null ? 0 : ue.length; + for (this.clear(); ++we < Ve; ) { + var St = ue[we]; + this.set(St[0], St[1]); + } + } + function F() { + this.__data__ = mt ? mt(null) : {}, this.size = 0; + } + function ie(ue) { + var we = this.has(ue) && delete this.__data__[ue]; + return this.size -= we ? 1 : 0, we; + } + function le(ue) { + var we = this.__data__; + if (mt) { + var Ve = we[ue]; + return Ve === n ? void 0 : Ve; + } + return ke.call(we, ue) ? we[ue] : void 0; + } + function me(ue) { + var we = this.__data__; + return mt ? we[ue] !== void 0 : ke.call(we, ue); + } + function Ee(ue, we) { + var Ve = this.__data__; + return this.size += this.has(ue) ? 0 : 1, Ve[ue] = mt && we === void 0 ? n : we, this; + } + T.prototype.clear = F, T.prototype.delete = ie, T.prototype.get = le, T.prototype.has = me, T.prototype.set = Ee; + function Le(ue) { + var we = -1, Ve = ue == null ? 0 : ue.length; + for (this.clear(); ++we < Ve; ) { + var St = ue[we]; + this.set(St[0], St[1]); + } + } + function Ie() { + this.__data__ = [], this.size = 0; + } + function Qe(ue) { + var we = this.__data__, Ve = Ye(we, ue); + if (Ve < 0) + return !1; + var St = we.length - 1; + return Ve == St ? we.pop() : Gt.call(we, Ve, 1), --this.size, !0; + } + function Xe(ue) { + var we = this.__data__, Ve = Ye(we, ue); + return Ve < 0 ? void 0 : we[Ve][1]; + } + function tt(ue) { + return Ye(this.__data__, ue) > -1; + } + function st(ue, we) { + var Ve = this.__data__, St = Ye(Ve, ue); + return St < 0 ? (++this.size, Ve.push([ue, we])) : Ve[St][1] = we, this; + } + Le.prototype.clear = Ie, Le.prototype.delete = Qe, Le.prototype.get = Xe, Le.prototype.has = tt, Le.prototype.set = st; + function vt(ue) { + var we = -1, Ve = ue == null ? 0 : ue.length; + for (this.clear(); ++we < Ve; ) { + var St = ue[we]; + this.set(St[0], St[1]); + } + } + function Ct() { + this.size = 0, this.__data__ = { + hash: new T(), + map: new (It || Le)(), + string: new T() + }; + } + function Mt(ue) { + var we = vr(this, ue).delete(ue); + return this.size -= we ? 1 : 0, we; + } + function wt(ue) { + return vr(this, ue).get(ue); + } + function Rt(ue) { + return vr(this, ue).has(ue); + } + function gt(ue, we) { + var Ve = vr(this, ue), St = Ve.size; + return Ve.set(ue, we), this.size += Ve.size == St ? 0 : 1, this; + } + vt.prototype.clear = Ct, vt.prototype.delete = Mt, vt.prototype.get = wt, vt.prototype.has = Rt, vt.prototype.set = gt; + function _t(ue) { + var we = -1, Ve = ue == null ? 0 : ue.length; + for (this.__data__ = new vt(); ++we < Ve; ) + this.add(ue[we]); + } + function at(ue) { + return this.__data__.set(ue, n), this; + } + function yt(ue) { + return this.__data__.has(ue); + } + _t.prototype.add = _t.prototype.push = at, _t.prototype.has = yt; + function ut(ue) { + var we = this.__data__ = new Le(ue); + this.size = we.size; + } + function it() { + this.__data__ = new Le(), this.size = 0; + } + function Se(ue) { + var we = this.__data__, Ve = we.delete(ue); + return this.size = we.size, Ve; + } + function Pe(ue) { + return this.__data__.get(ue); + } + function Ke(ue) { + return this.__data__.has(ue); + } + function Fe(ue, we) { + var Ve = this.__data__; + if (Ve instanceof Le) { + var St = Ve.__data__; + if (!It || St.length < r - 1) + return St.push([ue, we]), this.size = ++Ve.size, this; + Ve = this.__data__ = new vt(St); + } + return Ve.set(ue, we), this.size = Ve.size, this; + } + ut.prototype.clear = it, ut.prototype.delete = Se, ut.prototype.get = Pe, ut.prototype.has = Ke, ut.prototype.set = Fe; + function qe(ue, we) { + var Ve = Xa(ue), St = !Ve && yl(ue), jr = !Ve && !St && iu(ue), ir = !Ve && !St && !jr && _l(ue), Kr = Ve || St || jr || ir, gn = Kr ? Te(ue.length, String) : [], Er = gn.length; + for (var Ur in ue) + ke.call(ue, Ur) && !(Kr && // Safari 9 has enumerable `arguments.length` in strict mode. + (Ur == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. + jr && (Ur == "offset" || Ur == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. + ir && (Ur == "buffer" || Ur == "byteLength" || Ur == "byteOffset") || // Skip index properties. + rn(Ur, Er))) && gn.push(Ur); + return gn; + } + function Ye(ue, we) { + for (var Ve = ue.length; Ve--; ) + if (bl(ue[Ve][0], we)) + return Ve; + return -1; + } + function Lt(ue, we, Ve) { + var St = we(ue); + return Xa(ue) ? St : be(St, Ve(ue)); + } + function zt(ue) { + return ue == null ? ue === void 0 ? J : $ : Et && Et in Object(ue) ? $r(ue) : R0(ue); + } + function Zt(ue) { + return ta(ue) && zt(ue) == a; + } + function Ht(ue, we, Ve, St, jr) { + return ue === we ? !0 : ue == null || we == null || !ta(ue) && !ta(we) ? ue !== ue && we !== we : ge(ue, we, Ve, St, Ht, jr); + } + function ge(ue, we, Ve, St, jr, ir) { + var Kr = Xa(ue), gn = Xa(we), Er = Kr ? f : Ir(ue), Ur = gn ? f : Ir(we); + Er = Er == a ? N : Er, Ur = Ur == a ? N : Ur; + var on = Er == N, ni = Ur == N, mn = Er == Ur; + if (mn && iu(ue)) { + if (!iu(we)) + return !1; + Kr = !0, on = !1; + } + if (mn && !on) + return ir || (ir = new ut()), Kr || _l(ue) ? Qt(ue, we, Ve, St, jr, ir) : mr(ue, we, Er, Ve, St, jr, ir); + if (!(Ve & i)) { + var Vr = on && ke.call(ue, "__wrapped__"), Gn = ni && ke.call(we, "__wrapped__"); + if (Vr || Gn) { + var Zi = Vr ? ue.value() : ue, Ci = Gn ? we.value() : we; + return ir || (ir = new ut()), jr(Zi, Ci, Ve, St, ir); + } + } + return mn ? (ir || (ir = new ut()), lr(ue, we, Ve, St, jr, ir)) : !1; + } + function nr(ue) { + if (!xl(ue) || sn(ue)) + return !1; + var we = Za(ue) ? Ge : q; + return we.test(ks(ue)); + } + function pr(ue) { + return ta(ue) && wl(ue.length) && !!L[zt(ue)]; + } + function gr(ue) { + if (!vl(ue)) + return Tt(ue); + var we = []; + for (var Ve in Object(ue)) + ke.call(ue, Ve) && Ve != "constructor" && we.push(Ve); + return we; + } + function Qt(ue, we, Ve, St, jr, ir) { + var Kr = Ve & i, gn = ue.length, Er = we.length; + if (gn != Er && !(Kr && Er > gn)) + return !1; + var Ur = ir.get(ue); + if (Ur && ir.get(we)) + return Ur == we; + var on = -1, ni = !0, mn = Ve & s ? new _t() : void 0; + for (ir.set(ue, we), ir.set(we, ue); ++on < gn; ) { + var Vr = ue[on], Gn = we[on]; + if (St) + var Zi = Kr ? St(Gn, Vr, on, we, ue, ir) : St(Vr, Gn, on, ue, we, ir); + if (Zi !== void 0) { + if (Zi) + continue; + ni = !1; + break; + } + if (mn) { + if (!Ae(we, function(Ci, gs) { + if (!$e(mn, gs) && (Vr === Ci || jr(Vr, Ci, Ve, St, ir))) + return mn.push(gs); + })) { + ni = !1; + break; + } + } else if (!(Vr === Gn || jr(Vr, Gn, Ve, St, ir))) { + ni = !1; + break; + } + } + return ir.delete(ue), ir.delete(we), ni; + } + function mr(ue, we, Ve, St, jr, ir, Kr) { + switch (Ve) { + case E: + if (ue.byteLength != we.byteLength || ue.byteOffset != we.byteOffset) + return !1; + ue = ue.buffer, we = we.buffer; + case K: + return !(ue.byteLength != we.byteLength || !ir(new ct(ue), new ct(we))); + case h: + case g: + case D: + return bl(+ue, +we); + case v: + return ue.name == we.name && ue.message == we.message; + case B: + case R: + return ue == we + ""; + case C: + var gn = Oe; + case U: + var Er = St & i; + if (gn || (gn = De), ue.size != we.size && !Er) + return !1; + var Ur = Kr.get(ue); + if (Ur) + return Ur == we; + St |= s, Kr.set(ue, we); + var on = Qt(gn(ue), gn(we), St, jr, ir, Kr); + return Kr.delete(ue), on; + case W: + if (Y) + return Y.call(ue) == Y.call(we); + } + return !1; + } + function lr(ue, we, Ve, St, jr, ir) { + var Kr = Ve & i, gn = Tr(ue), Er = gn.length, Ur = Tr(we), on = Ur.length; + if (Er != on && !Kr) + return !1; + for (var ni = Er; ni--; ) { + var mn = gn[ni]; + if (!(Kr ? mn in we : ke.call(we, mn))) + return !1; + } + var Vr = ir.get(ue); + if (Vr && ir.get(we)) + return Vr == we; + var Gn = !0; + ir.set(ue, we), ir.set(we, ue); + for (var Zi = Kr; ++ni < Er; ) { + mn = gn[ni]; + var Ci = ue[mn], gs = we[mn]; + if (St) + var su = Kr ? St(gs, Ci, mn, we, ue, ir) : St(Ci, gs, mn, ue, we, ir); + if (!(su === void 0 ? Ci === gs || jr(Ci, gs, Ve, St, ir) : su)) { + Gn = !1; + break; + } + Zi || (Zi = mn == "constructor"); + } + if (Gn && !Zi) { + var ra = ue.constructor, Sn = we.constructor; + ra != Sn && "constructor" in ue && "constructor" in we && !(typeof ra == "function" && ra instanceof ra && typeof Sn == "function" && Sn instanceof Sn) && (Gn = !1); + } + return ir.delete(ue), ir.delete(we), Gn; + } + function Tr(ue) { + return Lt(ue, O0, Br); + } + function vr(ue, we) { + var Ve = ue.__data__; + return nn(we) ? Ve[typeof we == "string" ? "string" : "hash"] : Ve.map; + } + function xr(ue, we) { + var Ve = Me(ue, we); + return nr(Ve) ? Ve : void 0; + } + function $r(ue) { + var we = ke.call(ue, Et), Ve = ue[Et]; + try { + ue[Et] = void 0; + var St = !0; + } catch { + } + var jr = nt.call(ue); + return St && (we ? ue[Et] = Ve : delete ue[Et]), jr; + } + var Br = Yt ? function(ue) { + return ue == null ? [] : (ue = Object(ue), fe(Yt(ue), function(we) { + return qt.call(ue, we); + })); + } : Fr, Ir = zt; + (kt && Ir(new kt(new ArrayBuffer(1))) != E || It && Ir(new It()) != C || dt && Ir(dt.resolve()) != z || Dt && Ir(new Dt()) != U || Nt && Ir(new Nt()) != ne) && (Ir = function(ue) { + var we = zt(ue), Ve = we == N ? ue.constructor : void 0, St = Ve ? ks(Ve) : ""; + if (St) + switch (St) { + case Bt: + return E; + case Ft: + return C; + case et: + return z; + case $t: + return U; + case H: + return ne; + } + return we; + }); + function rn(ue, we) { + return we = we ?? o, !!we && (typeof ue == "number" || ce.test(ue)) && ue > -1 && ue % 1 == 0 && ue < we; + } + function nn(ue) { + var we = typeof ue; + return we == "string" || we == "number" || we == "symbol" || we == "boolean" ? ue !== "__proto__" : ue === null; + } + function sn(ue) { + return !!rt && rt in ue; + } + function vl(ue) { + var we = ue && ue.constructor, Ve = typeof we == "function" && we.prototype || _e; + return ue === Ve; + } + function R0(ue) { + return nt.call(ue); + } + function ks(ue) { + if (ue != null) { + try { + return ot.call(ue); + } catch { + } + try { + return ue + ""; + } catch { + } + } + return ""; + } + function bl(ue, we) { + return ue === we || ue !== ue && we !== we; + } + var yl = Zt(/* @__PURE__ */ (function() { + return arguments; + })()) ? Zt : function(ue) { + return ta(ue) && ke.call(ue, "callee") && !qt.call(ue, "callee"); + }, Xa = Array.isArray; + function T0(ue) { + return ue != null && wl(ue.length) && !Za(ue); + } + var iu = tr || Dr; + function D0(ue, we) { + return Ht(ue, we); + } + function Za(ue) { + if (!xl(ue)) + return !1; + var we = zt(ue); + return we == x || we == S || we == u || we == k; + } + function wl(ue) { + return typeof ue == "number" && ue > -1 && ue % 1 == 0 && ue <= o; + } + function xl(ue) { + var we = typeof ue; + return ue != null && (we == "object" || we == "function"); + } + function ta(ue) { + return ue != null && typeof ue == "object"; + } + var _l = ae ? Re(ae) : pr; + function O0(ue) { + return T0(ue) ? qe(ue) : gr(ue); + } + function Fr() { + return []; + } + function Dr() { + return !1; + } + t.exports = D0; + })(Yu, Yu.exports)), Yu.exports; +} +var kU = LU(); +const $U = /* @__PURE__ */ Hi(kU), W8 = "wc", K8 = 2, V8 = "core", Ds = `${W8}@2:${V8}:`, BU = { logger: "error" }, FU = { database: ":memory:" }, jU = "crypto", P3 = "client_ed25519_seed", UU = bt.ONE_DAY, qU = "keychain", zU = "0.3", HU = "messages", WU = "0.3", KU = bt.SIX_HOURS, VU = "publisher", G8 = "irn", GU = "error", Y8 = "wss://relay.walletconnect.org", YU = "relayer", Qn = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", transport_closed: "relayer_transport_closed", publish: "relayer_publish" }, JU = "_subscription", $i = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, XU = 0.1, av = "2.17.2", Wr = { link_mode: "link_mode", relay: "relay" }, ZU = "0.3", QU = "WALLETCONNECT_CLIENT_ID", M3 = "WALLETCONNECT_LINK_MODE_APPS", Ms = { created: "subscription_created", deleted: "subscription_deleted", sync: "subscription_sync", resubscribed: "subscription_resubscribed" }, eq = "subscription", tq = "0.3", rq = bt.FIVE_SECONDS * 1e3, nq = "pairing", iq = "0.3", Lu = { wc_pairingDelete: { req: { ttl: bt.ONE_DAY, prompt: !1, tag: 1e3 }, res: { ttl: bt.ONE_DAY, prompt: !1, tag: 1001 } }, wc_pairingPing: { req: { ttl: bt.THIRTY_SECONDS, prompt: !1, tag: 1002 }, res: { ttl: bt.THIRTY_SECONDS, prompt: !1, tag: 1003 } }, unregistered_method: { req: { ttl: bt.ONE_DAY, prompt: !1, tag: 0 }, res: { ttl: bt.ONE_DAY, prompt: !1, tag: 0 } } }, _a = { create: "pairing_create", expire: "pairing_expire", delete: "pairing_delete", ping: "pairing_ping" }, ns = { created: "history_created", updated: "history_updated", deleted: "history_deleted", sync: "history_sync" }, sq = "history", oq = "0.3", aq = "expirer", ji = { created: "expirer_created", deleted: "expirer_deleted", expired: "expirer_expired", sync: "expirer_sync" }, cq = "0.3", uq = "verify-api", fq = "https://verify.walletconnect.com", J8 = "https://verify.walletconnect.org", rf = J8, lq = `${rf}/v3`, hq = [fq, J8], dq = "echo", pq = "https://echo.walletconnect.com", As = { pairing_started: "pairing_started", pairing_uri_validation_success: "pairing_uri_validation_success", pairing_uri_not_expired: "pairing_uri_not_expired", store_new_pairing: "store_new_pairing", subscribing_pairing_topic: "subscribing_pairing_topic", subscribe_pairing_topic_success: "subscribe_pairing_topic_success", existing_pairing: "existing_pairing", pairing_not_expired: "pairing_not_expired", emit_inactive_pairing: "emit_inactive_pairing", emit_session_proposal: "emit_session_proposal", subscribing_to_pairing_topic: "subscribing_to_pairing_topic" }, Zs = { no_wss_connection: "no_wss_connection", no_internet_connection: "no_internet_connection", malformed_pairing_uri: "malformed_pairing_uri", active_pairing_already_exists: "active_pairing_already_exists", subscribe_pairing_topic_failure: "subscribe_pairing_topic_failure", pairing_expired: "pairing_expired", proposal_expired: "proposal_expired", proposal_listener_not_found: "proposal_listener_not_found" }, is = { session_approve_started: "session_approve_started", proposal_not_expired: "proposal_not_expired", session_namespaces_validation_success: "session_namespaces_validation_success", create_session_topic: "create_session_topic", subscribing_session_topic: "subscribing_session_topic", subscribe_session_topic_success: "subscribe_session_topic_success", publishing_session_approve: "publishing_session_approve", session_approve_publish_success: "session_approve_publish_success", store_session: "store_session", publishing_session_settle: "publishing_session_settle", session_settle_publish_success: "session_settle_publish_success" }, ga = { no_internet_connection: "no_internet_connection", no_wss_connection: "no_wss_connection", proposal_expired: "proposal_expired", subscribe_session_topic_failure: "subscribe_session_topic_failure", session_approve_publish_failure: "session_approve_publish_failure", session_settle_publish_failure: "session_settle_publish_failure", session_approve_namespace_validation_failure: "session_approve_namespace_validation_failure", proposal_not_found: "proposal_not_found" }, ma = { authenticated_session_approve_started: "authenticated_session_approve_started", create_authenticated_session_topic: "create_authenticated_session_topic", cacaos_verified: "cacaos_verified", store_authenticated_session: "store_authenticated_session", subscribing_authenticated_session_topic: "subscribing_authenticated_session_topic", subscribe_authenticated_session_topic_success: "subscribe_authenticated_session_topic_success", publishing_authenticated_session_approve: "publishing_authenticated_session_approve" }, ku = { no_internet_connection: "no_internet_connection", invalid_cacao: "invalid_cacao", subscribe_authenticated_session_topic_failure: "subscribe_authenticated_session_topic_failure", authenticated_session_approve_publish_failure: "authenticated_session_approve_publish_failure", authenticated_session_pending_request_not_found: "authenticated_session_pending_request_not_found" }, gq = 0.1, mq = "event-client", vq = 86400, bq = "https://pulse.walletconnect.org/batch"; +function yq(t, e) { + if (t.length >= 255) throw new TypeError("Alphabet too long"); + for (var r = new Uint8Array(256), n = 0; n < r.length; n++) r[n] = 255; + for (var i = 0; i < t.length; i++) { + var s = t.charAt(i), o = s.charCodeAt(0); + if (r[o] !== 255) throw new TypeError(s + " is ambiguous"); + r[o] = i; + } + var a = t.length, f = t.charAt(0), u = Math.log(a) / Math.log(256), h = Math.log(256) / Math.log(a); + function g(S) { + if (S instanceof Uint8Array || (ArrayBuffer.isView(S) ? S = new Uint8Array(S.buffer, S.byteOffset, S.byteLength) : Array.isArray(S) && (S = Uint8Array.from(S))), !(S instanceof Uint8Array)) throw new TypeError("Expected Uint8Array"); + if (S.length === 0) return ""; + for (var C = 0, D = 0, $ = 0, N = S.length; $ !== N && S[$] === 0; ) $++, C++; + for (var z = (N - $) * h + 1 >>> 0, k = new Uint8Array(z); $ !== N; ) { + for (var B = S[$], U = 0, R = z - 1; (B !== 0 || U < D) && R !== -1; R--, U++) B += 256 * k[R] >>> 0, k[R] = B % a >>> 0, B = B / a >>> 0; + if (B !== 0) throw new Error("Non-zero carry"); + D = U, $++; + } + for (var W = z - D; W !== z && k[W] === 0; ) W++; + for (var J = f.repeat(C); W < z; ++W) J += t.charAt(k[W]); + return J; + } + function v(S) { + if (typeof S != "string") throw new TypeError("Expected String"); + if (S.length === 0) return new Uint8Array(); + var C = 0; + if (S[C] !== " ") { + for (var D = 0, $ = 0; S[C] === f; ) D++, C++; + for (var N = (S.length - C) * u + 1 >>> 0, z = new Uint8Array(N); S[C]; ) { + var k = r[S.charCodeAt(C)]; + if (k === 255) return; + for (var B = 0, U = N - 1; (k !== 0 || B < $) && U !== -1; U--, B++) k += a * z[U] >>> 0, z[U] = k % 256 >>> 0, k = k / 256 >>> 0; + if (k !== 0) throw new Error("Non-zero carry"); + $ = B, C++; + } + if (S[C] !== " ") { + for (var R = N - $; R !== N && z[R] === 0; ) R++; + for (var W = new Uint8Array(D + (N - R)), J = D; R !== N; ) W[J++] = z[R++]; + return W; + } + } + } + function x(S) { + var C = v(S); + if (C) return C; + throw new Error(`Non-${e} character`); + } + return { encode: g, decodeUnsafe: v, decode: x }; +} +var wq = yq, xq = wq; +const X8 = (t) => { + if (t instanceof Uint8Array && t.constructor.name === "Uint8Array") return t; + if (t instanceof ArrayBuffer) return new Uint8Array(t); + if (ArrayBuffer.isView(t)) return new Uint8Array(t.buffer, t.byteOffset, t.byteLength); + throw new Error("Unknown type, must be binary type"); +}, _q = (t) => new TextEncoder().encode(t), Eq = (t) => new TextDecoder().decode(t); +class Sq { + constructor(e, r, n) { + this.name = e, this.prefix = r, this.baseEncode = n; + } + encode(e) { + if (e instanceof Uint8Array) return `${this.prefix}${this.baseEncode(e)}`; + throw Error("Unknown type, must be binary type"); + } +} +class Aq { + constructor(e, r, n) { + if (this.name = e, this.prefix = r, r.codePointAt(0) === void 0) throw new Error("Invalid prefix character"); + this.prefixCodePoint = r.codePointAt(0), this.baseDecode = n; + } + decode(e) { + if (typeof e == "string") { + if (e.codePointAt(0) !== this.prefixCodePoint) throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`); + return this.baseDecode(e.slice(this.prefix.length)); + } else throw Error("Can only multibase decode strings"); + } + or(e) { + return Z8(this, e); + } +} +class Pq { + constructor(e) { + this.decoders = e; + } + or(e) { + return Z8(this, e); + } + decode(e) { + const r = e[0], n = this.decoders[r]; + if (n) return n.decode(e); + throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`); + } +} +const Z8 = (t, e) => new Pq({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); +class Mq { + constructor(e, r, n, i) { + this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new Sq(e, r, n), this.decoder = new Aq(e, r, i); + } + encode(e) { + return this.encoder.encode(e); + } + decode(e) { + return this.decoder.decode(e); + } +} +const s0 = ({ name: t, prefix: e, encode: r, decode: n }) => new Mq(t, e, r, n), cl = ({ prefix: t, name: e, alphabet: r }) => { + const { encode: n, decode: i } = xq(r, e); + return s0({ prefix: t, name: e, encode: n, decode: (s) => X8(i(s)) }); +}, Iq = (t, e, r, n) => { + const i = {}; + for (let h = 0; h < e.length; ++h) i[e[h]] = h; + let s = t.length; + for (; t[s - 1] === "="; ) --s; + const o = new Uint8Array(s * r / 8 | 0); + let a = 0, f = 0, u = 0; + for (let h = 0; h < s; ++h) { + const g = i[t[h]]; + if (g === void 0) throw new SyntaxError(`Non-${n} character`); + f = f << r | g, a += r, a >= 8 && (a -= 8, o[u++] = 255 & f >> a); + } + if (a >= r || 255 & f << 8 - a) throw new SyntaxError("Unexpected end of data"); + return o; +}, Cq = (t, e, r) => { + const n = e[e.length - 1] === "=", i = (1 << r) - 1; + let s = "", o = 0, a = 0; + for (let f = 0; f < t.length; ++f) for (a = a << 8 | t[f], o += 8; o > r; ) o -= r, s += e[i & a >> o]; + if (o && (s += e[i & a << r - o]), n) for (; s.length * r & 7; ) s += "="; + return s; +}, Fn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => s0({ prefix: e, name: t, encode(i) { + return Cq(i, n, r); +}, decode(i) { + return Iq(i, n, r, t); +} }), Rq = s0({ prefix: "\0", name: "identity", encode: (t) => Eq(t), decode: (t) => _q(t) }); +var Tq = Object.freeze({ __proto__: null, identity: Rq }); +const Dq = Fn({ prefix: "0", name: "base2", alphabet: "01", bitsPerChar: 1 }); +var Oq = Object.freeze({ __proto__: null, base2: Dq }); +const Nq = Fn({ prefix: "7", name: "base8", alphabet: "01234567", bitsPerChar: 3 }); +var Lq = Object.freeze({ __proto__: null, base8: Nq }); +const kq = cl({ prefix: "9", name: "base10", alphabet: "0123456789" }); +var $q = Object.freeze({ __proto__: null, base10: kq }); +const Bq = Fn({ prefix: "f", name: "base16", alphabet: "0123456789abcdef", bitsPerChar: 4 }), Fq = Fn({ prefix: "F", name: "base16upper", alphabet: "0123456789ABCDEF", bitsPerChar: 4 }); +var jq = Object.freeze({ __proto__: null, base16: Bq, base16upper: Fq }); +const Uq = Fn({ prefix: "b", name: "base32", alphabet: "abcdefghijklmnopqrstuvwxyz234567", bitsPerChar: 5 }), qq = Fn({ prefix: "B", name: "base32upper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", bitsPerChar: 5 }), zq = Fn({ prefix: "c", name: "base32pad", alphabet: "abcdefghijklmnopqrstuvwxyz234567=", bitsPerChar: 5 }), Hq = Fn({ prefix: "C", name: "base32padupper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", bitsPerChar: 5 }), Wq = Fn({ prefix: "v", name: "base32hex", alphabet: "0123456789abcdefghijklmnopqrstuv", bitsPerChar: 5 }), Kq = Fn({ prefix: "V", name: "base32hexupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", bitsPerChar: 5 }), Vq = Fn({ prefix: "t", name: "base32hexpad", alphabet: "0123456789abcdefghijklmnopqrstuv=", bitsPerChar: 5 }), Gq = Fn({ prefix: "T", name: "base32hexpadupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=", bitsPerChar: 5 }), Yq = Fn({ prefix: "h", name: "base32z", alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769", bitsPerChar: 5 }); +var Jq = Object.freeze({ __proto__: null, base32: Uq, base32upper: qq, base32pad: zq, base32padupper: Hq, base32hex: Wq, base32hexupper: Kq, base32hexpad: Vq, base32hexpadupper: Gq, base32z: Yq }); +const Xq = cl({ prefix: "k", name: "base36", alphabet: "0123456789abcdefghijklmnopqrstuvwxyz" }), Zq = cl({ prefix: "K", name: "base36upper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" }); +var Qq = Object.freeze({ __proto__: null, base36: Xq, base36upper: Zq }); +const ez = cl({ name: "base58btc", prefix: "z", alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" }), tz = cl({ name: "base58flickr", prefix: "Z", alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" }); +var rz = Object.freeze({ __proto__: null, base58btc: ez, base58flickr: tz }); +const nz = Fn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 }), iz = Fn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 }), sz = Fn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 }), oz = Fn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", bitsPerChar: 6 }); +var az = Object.freeze({ __proto__: null, base64: nz, base64pad: iz, base64url: sz, base64urlpad: oz }); +const Q8 = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), cz = Q8.reduce((t, e, r) => (t[r] = e, t), []), uz = Q8.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); +function fz(t) { + return t.reduce((e, r) => (e += cz[r], e), ""); +} +function lz(t) { + const e = []; + for (const r of t) { + const n = uz[r.codePointAt(0)]; + if (n === void 0) throw new Error(`Non-base256emoji character: ${r}`); + e.push(n); + } + return new Uint8Array(e); +} +const hz = s0({ prefix: "🚀", name: "base256emoji", encode: fz, decode: lz }); +var dz = Object.freeze({ __proto__: null, base256emoji: hz }), pz = eE, I3 = 128, gz = -128, mz = Math.pow(2, 31); +function eE(t, e, r) { + e = e || [], r = r || 0; + for (var n = r; t >= mz; ) e[r++] = t & 255 | I3, t /= 128; + for (; t & gz; ) e[r++] = t & 255 | I3, t >>>= 7; + return e[r] = t | 0, eE.bytes = r - n + 1, e; +} +var vz = cv, bz = 128, C3 = 127; +function cv(t, n) { + var r = 0, n = n || 0, i = 0, s = n, o, a = t.length; + do { + if (s >= a) throw cv.bytes = 0, new RangeError("Could not decode varint"); + o = t[s++], r += i < 28 ? (o & C3) << i : (o & C3) * Math.pow(2, i), i += 7; + } while (o >= bz); + return cv.bytes = s - n, r; +} +var yz = Math.pow(2, 7), wz = Math.pow(2, 14), xz = Math.pow(2, 21), _z = Math.pow(2, 28), Ez = Math.pow(2, 35), Sz = Math.pow(2, 42), Az = Math.pow(2, 49), Pz = Math.pow(2, 56), Mz = Math.pow(2, 63), Iz = function(t) { + return t < yz ? 1 : t < wz ? 2 : t < xz ? 3 : t < _z ? 4 : t < Ez ? 5 : t < Sz ? 6 : t < Az ? 7 : t < Pz ? 8 : t < Mz ? 9 : 10; +}, Cz = { encode: pz, decode: vz, encodingLength: Iz }, tE = Cz; +const R3 = (t, e, r = 0) => (tE.encode(t, e, r), e), T3 = (t) => tE.encodingLength(t), uv = (t, e) => { + const r = e.byteLength, n = T3(t), i = n + T3(r), s = new Uint8Array(i + r); + return R3(t, s, 0), R3(r, s, n), s.set(e, i), new Rz(t, r, e, s); +}; +class Rz { + constructor(e, r, n, i) { + this.code = e, this.size = r, this.digest = n, this.bytes = i; + } +} +const rE = ({ name: t, code: e, encode: r }) => new Tz(t, e, r); +class Tz { + constructor(e, r, n) { + this.name = e, this.code = r, this.encode = n; + } + digest(e) { + if (e instanceof Uint8Array) { + const r = this.encode(e); + return r instanceof Uint8Array ? uv(this.code, r) : r.then((n) => uv(this.code, n)); + } else throw Error("Unknown type, must be binary type"); + } +} +const nE = (t) => async (e) => new Uint8Array(await crypto.subtle.digest(t, e)), Dz = rE({ name: "sha2-256", code: 18, encode: nE("SHA-256") }), Oz = rE({ name: "sha2-512", code: 19, encode: nE("SHA-512") }); +var Nz = Object.freeze({ __proto__: null, sha256: Dz, sha512: Oz }); +const iE = 0, Lz = "identity", sE = X8, kz = (t) => uv(iE, sE(t)), $z = { code: iE, name: Lz, encode: sE, digest: kz }; +var Bz = Object.freeze({ __proto__: null, identity: $z }); +new TextEncoder(), new TextDecoder(); +const D3 = { ...Tq, ...Oq, ...Lq, ...$q, ...jq, ...Jq, ...Qq, ...rz, ...az, ...dz }; +({ ...Nz, ...Bz }); +function Fz(t = 0) { + return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); +} +function oE(t, e, r, n) { + return { name: t, prefix: e, encoder: { name: t, prefix: e, encode: r }, decoder: { decode: n } }; +} +const O3 = oE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), Jg = oE("ascii", "a", (t) => { + let e = "a"; + for (let r = 0; r < t.length; r++) e += String.fromCharCode(t[r]); + return e; +}, (t) => { + t = t.substring(1); + const e = Fz(t.length); + for (let r = 0; r < t.length; r++) e[r] = t.charCodeAt(r); + return e; +}), jz = { utf8: O3, "utf-8": O3, hex: D3.base16, latin1: Jg, ascii: Jg, binary: Jg, ...D3 }; +function Uz(t, e = "utf8") { + const r = jz[e]; + if (!r) throw new Error(`Unsupported encoding "${e}"`); + return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t, "utf8") : r.decoder.decode(`${r.prefix}${t}`); +} +let qz = class { + constructor(e, r) { + this.core = e, this.logger = r, this.keychain = /* @__PURE__ */ new Map(), this.name = qU, this.version = zU, this.initialized = !1, this.storagePrefix = Ds, this.init = async () => { + if (!this.initialized) { + const n = await this.getKeyChain(); + typeof n < "u" && (this.keychain = n), this.initialized = !0; + } + }, this.has = (n) => (this.isInitialized(), this.keychain.has(n)), this.set = async (n, i) => { + this.isInitialized(), this.keychain.set(n, i), await this.persist(); + }, this.get = (n) => { + this.isInitialized(); + const i = this.keychain.get(n); + if (typeof i > "u") { + const { message: s } = ft("NO_MATCHING_KEY", `${this.name}: ${n}`); + throw new Error(s); + } + return i; + }, this.del = async (n) => { + this.isInitialized(), this.keychain.delete(n), await this.persist(); + }, this.core = e, this.logger = ri(r, this.name); + } + get context() { + return mi(this.logger); + } + get storageKey() { + return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; + } + async setKeyChain(e) { + await this.core.storage.setItem(this.storageKey, P8(e)); + } + async getKeyChain() { + const e = await this.core.storage.getItem(this.storageKey); + return typeof e < "u" ? M8(e) : void 0; + } + async persist() { + await this.setKeyChain(this.keychain); + } + isInitialized() { + if (!this.initialized) { + const { message: e } = ft("NOT_INITIALIZED", this.name); + throw new Error(e); + } + } +}, zz = class { + constructor(e, r, n) { + this.core = e, this.logger = r, this.name = jU, this.randomSessionIdentifier = sv(), this.initialized = !1, this.init = async () => { + this.initialized || (await this.keychain.init(), this.initialized = !0); + }, this.hasKeys = (i) => (this.isInitialized(), this.keychain.has(i)), this.getClientId = async () => { + this.isInitialized(); + const i = await this.getClientSeed(), s = N2(i); + return o8(s.publicKey); + }, this.generateKeyPair = () => { + this.isInitialized(); + const i = fj(); + return this.setPrivateKey(i.publicKey, i.privateKey); + }, this.signJWT = async (i) => { + this.isInitialized(); + const s = await this.getClientSeed(), o = N2(s), a = this.randomSessionIdentifier; + return await $$(a, i, UU, o); + }, this.generateSharedKey = (i, s, o) => { + this.isInitialized(); + const a = this.getPrivateKey(i), f = lj(a, s); + return this.setSymKey(f, o); + }, this.setSymKey = async (i, s) => { + this.isInitialized(); + const o = s || Wh(i); + return await this.keychain.set(o, i), o; + }, this.deleteKeyPair = async (i) => { + this.isInitialized(), await this.keychain.del(i); + }, this.deleteSymKey = async (i) => { + this.isInitialized(), await this.keychain.del(i); + }, this.encode = async (i, s, o) => { + this.isInitialized(); + const a = $8(o), f = ho(s); + if (s3(a)) return dj(f, o?.encoding); + if (i3(a)) { + const v = a.senderPublicKey, x = a.receiverPublicKey; + i = await this.generateSharedKey(v, x); + } + const u = this.getSymKey(i), { type: h, senderPublicKey: g } = a; + return hj({ type: h, symKey: u, message: f, senderPublicKey: g, encoding: o?.encoding }); + }, this.decode = async (i, s, o) => { + this.isInitialized(); + const a = mj(s, o); + if (s3(a)) { + const f = gj(s, o?.encoding); + return Na(f); + } + if (i3(a)) { + const f = a.receiverPublicKey, u = a.senderPublicKey; + i = await this.generateSharedKey(f, u); + } + try { + const f = this.getSymKey(i), u = pj({ symKey: f, encoded: s, encoding: o?.encoding }); + return Na(u); + } catch (f) { + this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`), this.logger.error(f); + } + }, this.getPayloadType = (i, s = ko) => { + const o = Lf({ encoded: i, encoding: s }); + return $a(o.type); + }, this.getPayloadSenderPublicKey = (i, s = ko) => { + const o = Lf({ encoded: i, encoding: s }); + return o.senderPublicKey ? Tn(o.senderPublicKey, ti) : void 0; + }, this.core = e, this.logger = ri(r, this.name), this.keychain = n || new qz(this.core, this.logger); + } + get context() { + return mi(this.logger); + } + async setPrivateKey(e, r) { + return await this.keychain.set(e, r), e; + } + getPrivateKey(e) { + return this.keychain.get(e); + } + async getClientSeed() { + let e = ""; + try { + e = this.keychain.get(P3); + } catch { + e = sv(), await this.keychain.set(P3, e); + } + return Uz(e, "base16"); + } + getSymKey(e) { + return this.keychain.get(e); + } + isInitialized() { + if (!this.initialized) { + const { message: e } = ft("NOT_INITIALIZED", this.name); + throw new Error(e); + } + } +}; +class Hz extends fk { + constructor(e, r) { + super(e, r), this.logger = e, this.core = r, this.messages = /* @__PURE__ */ new Map(), this.name = HU, this.version = WU, this.initialized = !1, this.storagePrefix = Ds, this.init = async () => { + if (!this.initialized) { + this.logger.trace("Initialized"); + try { + const n = await this.getRelayerMessages(); + typeof n < "u" && (this.messages = n), this.logger.debug(`Successfully Restored records for ${this.name}`), this.logger.trace({ type: "method", method: "restore", size: this.messages.size }); + } catch (n) { + this.logger.debug(`Failed to Restore records for ${this.name}`), this.logger.error(n); + } finally { + this.initialized = !0; + } + } + }, this.set = async (n, i) => { + this.isInitialized(); + const s = Qs(i); + let o = this.messages.get(n); + return typeof o > "u" && (o = {}), typeof o[s] < "u" || (o[s] = i, this.messages.set(n, o), await this.persist()), s; + }, this.get = (n) => { + this.isInitialized(); + let i = this.messages.get(n); + return typeof i > "u" && (i = {}), i; + }, this.has = (n, i) => { + this.isInitialized(); + const s = this.get(n), o = Qs(i); + return typeof s[o] < "u"; + }, this.del = async (n) => { + this.isInitialized(), this.messages.delete(n), await this.persist(); + }, this.logger = ri(e, this.name), this.core = r; + } + get context() { + return mi(this.logger); + } + get storageKey() { + return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; + } + async setRelayerMessages(e) { + await this.core.storage.setItem(this.storageKey, P8(e)); + } + async getRelayerMessages() { + const e = await this.core.storage.getItem(this.storageKey); + return typeof e < "u" ? M8(e) : void 0; + } + async persist() { + await this.setRelayerMessages(this.messages); + } + isInitialized() { + if (!this.initialized) { + const { message: e } = ft("NOT_INITIALIZED", this.name); + throw new Error(e); + } + } +} +class Wz extends lk { + constructor(e, r) { + super(e, r), this.relayer = e, this.logger = r, this.events = new Wi.EventEmitter(), this.name = VU, this.queue = /* @__PURE__ */ new Map(), this.publishTimeout = bt.toMiliseconds(bt.ONE_MINUTE), this.failedPublishTimeout = bt.toMiliseconds(bt.ONE_SECOND), this.needsTransportRestart = !1, this.publish = async (n, i, s) => { + var o; + this.logger.debug("Publishing Payload"), this.logger.trace({ type: "method", method: "publish", params: { topic: n, message: i, opts: s } }); + const a = s?.ttl || KU, f = ov(s), u = s?.prompt || !1, h = s?.tag || 0, g = s?.id || Ma().toString(), v = { topic: n, message: i, opts: { ttl: a, relay: f, prompt: u, tag: h, id: g, attestation: s?.attestation } }, x = `Failed to publish payload, please try again. id:${g} tag:${h}`, S = Date.now(); + let C, D = 1; + try { + for (; C === void 0; ) { + if (Date.now() - S > this.publishTimeout) throw new Error(x); + this.logger.trace({ id: g, attempts: D }, `publisher.publish - attempt ${D}`), C = await await Lc(this.rpcPublish(n, i, a, f, u, h, g, s?.attestation).catch(($) => this.logger.warn($)), this.publishTimeout, x), D++, C || await new Promise(($) => setTimeout($, this.failedPublishTimeout)); + } + this.relayer.events.emit(Qn.publish, v), this.logger.debug("Successfully Published Payload"), this.logger.trace({ type: "method", method: "publish", params: { id: g, topic: n, message: i, opts: s } }); + } catch ($) { + if (this.logger.debug("Failed to Publish Payload"), this.logger.error($), (o = s?.internal) != null && o.throwOnFailedPublish) throw $; + this.queue.set(g, v); + } + }, this.on = (n, i) => { + this.events.on(n, i); + }, this.once = (n, i) => { + this.events.once(n, i); + }, this.off = (n, i) => { + this.events.off(n, i); + }, this.removeListener = (n, i) => { + this.events.removeListener(n, i); + }, this.relayer = e, this.logger = ri(r, this.name), this.registerEventListeners(); + } + get context() { + return mi(this.logger); + } + rpcPublish(e, r, n, i, s, o, a, f) { + var u, h, g, v; + const x = { method: Vu(i.protocol).publish, params: { topic: e, message: r, ttl: n, prompt: s, tag: o, attestation: f }, id: a }; + return ei((u = x.params) == null ? void 0 : u.prompt) && ((h = x.params) == null || delete h.prompt), ei((g = x.params) == null ? void 0 : g.tag) && ((v = x.params) == null || delete v.tag), this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "message", direction: "outgoing", request: x }), this.relayer.request(x); + } + removeRequestFromQueue(e) { + this.queue.delete(e); + } + checkQueue() { + this.queue.forEach(async (e) => { + const { topic: r, message: n, opts: i } = e; + await this.publish(r, n, i); + }); + } + registerEventListeners() { + this.relayer.core.heartbeat.on(Vc.pulse, () => { + if (this.needsTransportRestart) { + this.needsTransportRestart = !1, this.relayer.events.emit(Qn.connection_stalled); + return; + } + this.checkQueue(); + }), this.relayer.on(Qn.message_ack, (e) => { + this.removeRequestFromQueue(e.id.toString()); + }); + } +} +class Kz { + constructor() { + this.map = /* @__PURE__ */ new Map(), this.set = (e, r) => { + const n = this.get(e); + this.exists(e, r) || this.map.set(e, [...n, r]); + }, this.get = (e) => this.map.get(e) || [], this.exists = (e, r) => this.get(e).includes(r), this.delete = (e, r) => { + if (typeof r > "u") { + this.map.delete(e); + return; + } + if (!this.map.has(e)) return; + const n = this.get(e); + if (!this.exists(e, r)) return; + const i = n.filter((s) => s !== r); + if (!i.length) { + this.map.delete(e); + return; + } + this.map.set(e, i); + }, this.clear = () => { + this.map.clear(); + }; + } + get topics() { + return Array.from(this.map.keys()); + } +} +var Vz = Object.defineProperty, Gz = Object.defineProperties, Yz = Object.getOwnPropertyDescriptors, N3 = Object.getOwnPropertySymbols, Jz = Object.prototype.hasOwnProperty, Xz = Object.prototype.propertyIsEnumerable, L3 = (t, e, r) => e in t ? Vz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, $u = (t, e) => { + for (var r in e || (e = {})) Jz.call(e, r) && L3(t, r, e[r]); + if (N3) for (var r of N3(e)) Xz.call(e, r) && L3(t, r, e[r]); + return t; +}, Xg = (t, e) => Gz(t, Yz(e)); +class Zz extends pk { + constructor(e, r) { + super(e, r), this.relayer = e, this.logger = r, this.subscriptions = /* @__PURE__ */ new Map(), this.topicMap = new Kz(), this.events = new Wi.EventEmitter(), this.name = eq, this.version = tq, this.pending = /* @__PURE__ */ new Map(), this.cached = [], this.initialized = !1, this.pendingSubscriptionWatchLabel = "pending_sub_watch_label", this.pollingInterval = 20, this.storagePrefix = Ds, this.subscribeTimeout = bt.toMiliseconds(bt.ONE_MINUTE), this.restartInProgress = !1, this.batchSubscribeTopicsLimit = 500, this.pendingBatchMessages = [], this.init = async () => { + this.initialized || (this.logger.trace("Initialized"), this.registerEventListeners(), this.clientId = await this.relayer.core.crypto.getClientId(), await this.restore()), this.initialized = !0; + }, this.subscribe = async (n, i) => { + this.isInitialized(), this.logger.debug("Subscribing Topic"), this.logger.trace({ type: "method", method: "subscribe", params: { topic: n, opts: i } }); + try { + const s = ov(i), o = { topic: n, relay: s, transportType: i?.transportType }; + this.pending.set(n, o); + const a = await this.rpcSubscribe(n, s, i); + return typeof a == "string" && (this.onSubscribe(a, o), this.logger.debug("Successfully Subscribed Topic"), this.logger.trace({ type: "method", method: "subscribe", params: { topic: n, opts: i } })), a; + } catch (s) { + throw this.logger.debug("Failed to Subscribe Topic"), this.logger.error(s), s; + } + }, this.unsubscribe = async (n, i) => { + await this.restartToComplete(), this.isInitialized(), typeof i?.id < "u" ? await this.unsubscribeById(n, i.id, i) : await this.unsubscribeByTopic(n, i); + }, this.isSubscribed = async (n) => { + if (this.topics.includes(n)) return !0; + const i = `${this.pendingSubscriptionWatchLabel}_${n}`; + return await new Promise((s, o) => { + const a = new bt.Watch(); + a.start(i); + const f = setInterval(() => { + !this.pending.has(n) && this.topics.includes(n) && (clearInterval(f), a.stop(i), s(!0)), a.elapsed(i) >= rq && (clearInterval(f), a.stop(i), o(new Error("Subscription resolution timeout"))); + }, this.pollingInterval); + }).catch(() => !1); + }, this.on = (n, i) => { + this.events.on(n, i); + }, this.once = (n, i) => { + this.events.once(n, i); + }, this.off = (n, i) => { + this.events.off(n, i); + }, this.removeListener = (n, i) => { + this.events.removeListener(n, i); + }, this.start = async () => { + await this.onConnect(); + }, this.stop = async () => { + await this.onDisconnect(); + }, this.restart = async () => { + this.restartInProgress = !0, await this.restore(), await this.reset(), this.restartInProgress = !1; + }, this.relayer = e, this.logger = ri(r, this.name), this.clientId = ""; + } + get context() { + return mi(this.logger); + } + get storageKey() { + return this.storagePrefix + this.version + this.relayer.core.customStoragePrefix + "//" + this.name; + } + get length() { + return this.subscriptions.size; + } + get ids() { + return Array.from(this.subscriptions.keys()); + } + get values() { + return Array.from(this.subscriptions.values()); + } + get topics() { + return this.topicMap.topics; + } + hasSubscription(e, r) { + let n = !1; + try { + n = this.getSubscription(e).topic === r; + } catch { + } + return n; + } + onEnable() { + this.cached = [], this.initialized = !0; + } + onDisable() { + this.cached = this.values, this.subscriptions.clear(), this.topicMap.clear(); + } + async unsubscribeByTopic(e, r) { + const n = this.topicMap.get(e); + await Promise.all(n.map(async (i) => await this.unsubscribeById(e, i, r))); + } + async unsubscribeById(e, r, n) { + this.logger.debug("Unsubscribing Topic"), this.logger.trace({ type: "method", method: "unsubscribe", params: { topic: e, id: r, opts: n } }); + try { + const i = ov(n); + await this.rpcUnsubscribe(e, r, i); + const s = Nr("USER_DISCONNECTED", `${this.name}, ${e}`); + await this.onUnsubscribe(e, r, s), this.logger.debug("Successfully Unsubscribed Topic"), this.logger.trace({ type: "method", method: "unsubscribe", params: { topic: e, id: r, opts: n } }); + } catch (i) { + throw this.logger.debug("Failed to Unsubscribe Topic"), this.logger.error(i), i; + } + } + async rpcSubscribe(e, r, n) { + var i; + n?.transportType === Wr.relay && await this.restartToComplete(); + const s = { method: Vu(r.protocol).subscribe, params: { topic: e } }; + this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: s }); + const o = (i = n?.internal) == null ? void 0 : i.throwOnFailedPublish; + try { + const a = Qs(e + this.clientId); + if (n?.transportType === Wr.link_mode) return setTimeout(() => { + (this.relayer.connected || this.relayer.connecting) && this.relayer.request(s).catch((u) => this.logger.warn(u)); + }, bt.toMiliseconds(bt.ONE_SECOND)), a; + const f = await Lc(this.relayer.request(s).catch((u) => this.logger.warn(u)), this.subscribeTimeout, `Subscribing to ${e} failed, please try again`); + if (!f && o) throw new Error(`Subscribing to ${e} failed, please try again`); + return f ? a : null; + } catch (a) { + if (this.logger.debug("Outgoing Relay Subscribe Payload stalled"), this.relayer.events.emit(Qn.connection_stalled), o) throw a; + } + return null; + } + async rpcBatchSubscribe(e) { + if (!e.length) return; + const r = e[0].relay, n = { method: Vu(r.protocol).batchSubscribe, params: { topics: e.map((i) => i.topic) } }; + this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: n }); + try { + return await await Lc(this.relayer.request(n).catch((i) => this.logger.warn(i)), this.subscribeTimeout); + } catch { + this.relayer.events.emit(Qn.connection_stalled); + } + } + async rpcBatchFetchMessages(e) { + if (!e.length) return; + const r = e[0].relay, n = { method: Vu(r.protocol).batchFetchMessages, params: { topics: e.map((s) => s.topic) } }; + this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: n }); + let i; + try { + i = await await Lc(this.relayer.request(n).catch((s) => this.logger.warn(s)), this.subscribeTimeout); + } catch { + this.relayer.events.emit(Qn.connection_stalled); + } + return i; + } + rpcUnsubscribe(e, r, n) { + const i = { method: Vu(n.protocol).unsubscribe, params: { topic: e, id: r } }; + return this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: i }), this.relayer.request(i); + } + onSubscribe(e, r) { + this.setSubscription(e, Xg($u({}, r), { id: e })), this.pending.delete(r.topic); + } + onBatchSubscribe(e) { + e.length && e.forEach((r) => { + this.setSubscription(r.id, $u({}, r)), this.pending.delete(r.topic); + }); + } + async onUnsubscribe(e, r, n) { + this.events.removeAllListeners(r), this.hasSubscription(r, e) && this.deleteSubscription(r, n), await this.relayer.messages.del(e); + } + async setRelayerSubscriptions(e) { + await this.relayer.core.storage.setItem(this.storageKey, e); + } + async getRelayerSubscriptions() { + return await this.relayer.core.storage.getItem(this.storageKey); + } + setSubscription(e, r) { + this.logger.debug("Setting subscription"), this.logger.trace({ type: "method", method: "setSubscription", id: e, subscription: r }), this.addSubscription(e, r); + } + addSubscription(e, r) { + this.subscriptions.set(e, $u({}, r)), this.topicMap.set(r.topic, e), this.events.emit(Ms.created, r); + } + getSubscription(e) { + this.logger.debug("Getting subscription"), this.logger.trace({ type: "method", method: "getSubscription", id: e }); + const r = this.subscriptions.get(e); + if (!r) { + const { message: n } = ft("NO_MATCHING_KEY", `${this.name}: ${e}`); + throw new Error(n); + } + return r; + } + deleteSubscription(e, r) { + this.logger.debug("Deleting subscription"), this.logger.trace({ type: "method", method: "deleteSubscription", id: e, reason: r }); + const n = this.getSubscription(e); + this.subscriptions.delete(e), this.topicMap.delete(n.topic, e), this.events.emit(Ms.deleted, Xg($u({}, n), { reason: r })); + } + async persist() { + await this.setRelayerSubscriptions(this.values), this.events.emit(Ms.sync); + } + async reset() { + if (this.cached.length) { + const e = Math.ceil(this.cached.length / this.batchSubscribeTopicsLimit); + for (let r = 0; r < e; r++) { + const n = this.cached.splice(0, this.batchSubscribeTopicsLimit); + await this.batchFetchMessages(n), await this.batchSubscribe(n); + } + } + this.events.emit(Ms.resubscribed); + } + async restore() { + try { + const e = await this.getRelayerSubscriptions(); + if (typeof e > "u" || !e.length) return; + if (this.subscriptions.size) { + const { message: r } = ft("RESTORE_WILL_OVERRIDE", this.name); + throw this.logger.error(r), this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`), new Error(r); + } + this.cached = e, this.logger.debug(`Successfully Restored subscriptions for ${this.name}`), this.logger.trace({ type: "method", method: "restore", subscriptions: this.values }); + } catch (e) { + this.logger.debug(`Failed to Restore subscriptions for ${this.name}`), this.logger.error(e); + } + } + async batchSubscribe(e) { + if (!e.length) return; + const r = await this.rpcBatchSubscribe(e); + Ba(r) && this.onBatchSubscribe(r.map((n, i) => Xg($u({}, e[i]), { id: n }))); + } + async batchFetchMessages(e) { + if (!e.length) return; + this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`); + const r = await this.rpcBatchFetchMessages(e); + r && r.messages && (this.pendingBatchMessages = this.pendingBatchMessages.concat(r.messages)); + } + async onConnect() { + await this.restart(), this.onEnable(); + } + onDisconnect() { + this.onDisable(); + } + async checkPending() { + if (!this.initialized || !this.relayer.connected) return; + const e = []; + this.pending.forEach((r) => { + e.push(r); + }), await this.batchSubscribe(e), this.pendingBatchMessages.length && (await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages), this.pendingBatchMessages = []); + } + registerEventListeners() { + this.relayer.core.heartbeat.on(Vc.pulse, async () => { + await this.checkPending(); + }), this.events.on(Ms.created, async (e) => { + const r = Ms.created; + this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), await this.persist(); + }), this.events.on(Ms.deleted, async (e) => { + const r = Ms.deleted; + this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), await this.persist(); + }); + } + isInitialized() { + if (!this.initialized) { + const { message: e } = ft("NOT_INITIALIZED", this.name); + throw new Error(e); + } + } + async restartToComplete() { + !this.relayer.connected && !this.relayer.connecting && await this.relayer.transportOpen(), this.restartInProgress && await new Promise((e) => { + const r = setInterval(() => { + this.restartInProgress || (clearInterval(r), e()); + }, this.pollingInterval); + }); + } +} +var Qz = Object.defineProperty, k3 = Object.getOwnPropertySymbols, eH = Object.prototype.hasOwnProperty, tH = Object.prototype.propertyIsEnumerable, $3 = (t, e, r) => e in t ? Qz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, B3 = (t, e) => { + for (var r in e || (e = {})) eH.call(e, r) && $3(t, r, e[r]); + if (k3) for (var r of k3(e)) tH.call(e, r) && $3(t, r, e[r]); + return t; +}; +class rH extends hk { + constructor(e) { + super(e), this.protocol = "wc", this.version = 2, this.events = new Wi.EventEmitter(), this.name = YU, this.transportExplicitlyClosed = !1, this.initialized = !1, this.connectionAttemptInProgress = !1, this.connectionStatusPollingInterval = 20, this.staleConnectionErrors = ["socket hang up", "stalled", "interrupted"], this.hasExperiencedNetworkDisruption = !1, this.requestsInFlight = /* @__PURE__ */ new Map(), this.heartBeatTimeout = bt.toMiliseconds(bt.THIRTY_SECONDS + bt.ONE_SECOND), this.request = async (r) => { + var n, i; + this.logger.debug("Publishing Request Payload"); + const s = r.id || Ma().toString(); + await this.toEstablishConnection(); + try { + const o = this.provider.request(r); + this.requestsInFlight.set(s, { promise: o, request: r }), this.logger.trace({ id: s, method: r.method, topic: (n = r.params) == null ? void 0 : n.topic }, "relayer.request - attempt to publish..."); + const a = await new Promise(async (f, u) => { + const h = () => { + u(new Error(`relayer.request - publish interrupted, id: ${s}`)); + }; + this.provider.on($i.disconnect, h); + const g = await o; + this.provider.off($i.disconnect, h), f(g); + }); + return this.logger.trace({ id: s, method: r.method, topic: (i = r.params) == null ? void 0 : i.topic }, "relayer.request - published"), a; + } catch (o) { + throw this.logger.debug(`Failed to Publish Request: ${s}`), o; + } finally { + this.requestsInFlight.delete(s); + } + }, this.resetPingTimeout = () => { + if (xd()) try { + clearTimeout(this.pingTimeout), this.pingTimeout = setTimeout(() => { + var r, n, i; + (i = (n = (r = this.provider) == null ? void 0 : r.connection) == null ? void 0 : n.socket) == null || i.terminate(); + }, this.heartBeatTimeout); + } catch (r) { + this.logger.warn(r); + } + }, this.onPayloadHandler = (r) => { + this.onProviderPayload(r), this.resetPingTimeout(); + }, this.onConnectHandler = () => { + this.logger.trace("relayer connected"), this.startPingTimeout(), this.events.emit(Qn.connect); + }, this.onDisconnectHandler = () => { + this.logger.trace("relayer disconnected"), this.onProviderDisconnect(); + }, this.onProviderErrorHandler = (r) => { + this.logger.error(r), this.events.emit(Qn.error, r), this.logger.info("Fatal socket error received, closing transport"), this.transportClose(); + }, this.registerProviderListeners = () => { + this.provider.on($i.payload, this.onPayloadHandler), this.provider.on($i.connect, this.onConnectHandler), this.provider.on($i.disconnect, this.onDisconnectHandler), this.provider.on($i.error, this.onProviderErrorHandler); + }, this.core = e.core, this.logger = typeof e.logger < "u" && typeof e.logger != "string" ? ri(e.logger, this.name) : Xf(Vd({ level: e.logger || GU })), this.messages = new Hz(this.logger, e.core), this.subscriber = new Zz(this, this.logger), this.publisher = new Wz(this, this.logger), this.relayUrl = e?.relayUrl || Y8, this.projectId = e.projectId, this.bundleId = IF(), this.provider = {}; + } + async init() { + if (this.logger.trace("Initialized"), this.registerEventListeners(), await Promise.all([this.messages.init(), this.subscriber.init()]), this.initialized = !0, this.subscriber.cached.length > 0) try { + await this.transportOpen(); + } catch (e) { + this.logger.warn(e); + } + } + get context() { + return mi(this.logger); + } + get connected() { + var e, r, n; + return ((n = (r = (e = this.provider) == null ? void 0 : e.connection) == null ? void 0 : r.socket) == null ? void 0 : n.readyState) === 1; + } + get connecting() { + var e, r, n; + return ((n = (r = (e = this.provider) == null ? void 0 : e.connection) == null ? void 0 : r.socket) == null ? void 0 : n.readyState) === 0; + } + async publish(e, r, n) { + this.isInitialized(), await this.publisher.publish(e, r, n), await this.recordMessageEvent({ topic: e, message: r, publishedAt: Date.now(), transportType: Wr.relay }); + } + async subscribe(e, r) { + var n, i, s; + this.isInitialized(), r?.transportType === "relay" && await this.toEstablishConnection(); + const o = typeof ((n = r?.internal) == null ? void 0 : n.throwOnFailedPublish) > "u" ? !0 : (i = r?.internal) == null ? void 0 : i.throwOnFailedPublish; + let a = ((s = this.subscriber.topicMap.get(e)) == null ? void 0 : s[0]) || "", f; + const u = (h) => { + h.topic === e && (this.subscriber.off(Ms.created, u), f()); + }; + return await Promise.all([new Promise((h) => { + f = h, this.subscriber.on(Ms.created, u); + }), new Promise(async (h, g) => { + a = await this.subscriber.subscribe(e, B3({ internal: { throwOnFailedPublish: o } }, r)).catch((v) => { + o && g(v); + }) || a, h(); + })]), a; + } + async unsubscribe(e, r) { + this.isInitialized(), await this.subscriber.unsubscribe(e, r); + } + on(e, r) { + this.events.on(e, r); + } + once(e, r) { + this.events.once(e, r); + } + off(e, r) { + this.events.off(e, r); + } + removeListener(e, r) { + this.events.removeListener(e, r); + } + async transportDisconnect() { + if (!this.hasExperiencedNetworkDisruption && this.connected && this.requestsInFlight.size > 0) try { + await Promise.all(Array.from(this.requestsInFlight.values()).map((e) => e.promise)); + } catch (e) { + this.logger.warn(e); + } + this.provider.disconnect && (this.hasExperiencedNetworkDisruption || this.connected) ? await Lc(this.provider.disconnect(), 2e3, "provider.disconnect()").catch(() => this.onProviderDisconnect()) : this.onProviderDisconnect(); + } + async transportClose() { + this.transportExplicitlyClosed = !0, await this.transportDisconnect(); + } + async transportOpen(e) { + await this.confirmOnlineStateOrThrow(), e && e !== this.relayUrl && (this.relayUrl = e, await this.transportDisconnect()), await this.createProvider(), this.connectionAttemptInProgress = !0, this.transportExplicitlyClosed = !1; + try { + await new Promise(async (r, n) => { + const i = () => { + this.provider.off($i.disconnect, i), n(new Error("Connection interrupted while trying to subscribe")); + }; + this.provider.on($i.disconnect, i), await Lc(this.provider.connect(), bt.toMiliseconds(bt.ONE_MINUTE), `Socket stalled when trying to connect to ${this.relayUrl}`).catch((s) => { + n(s); + }).finally(() => { + clearTimeout(this.reconnectTimeout), this.reconnectTimeout = void 0; + }), this.subscriber.start().catch((s) => { + this.logger.error(s), this.onDisconnectHandler(); + }), this.hasExperiencedNetworkDisruption = !1, r(); + }); + } catch (r) { + this.logger.error(r); + const n = r; + if (this.hasExperiencedNetworkDisruption = !0, !this.isConnectionStalled(n.message)) throw r; + } finally { + this.connectionAttemptInProgress = !1; + } + } + async restartTransport(e) { + this.connectionAttemptInProgress || (this.relayUrl = e || this.relayUrl, await this.confirmOnlineStateOrThrow(), await this.transportClose(), await this.transportOpen()); + } + async confirmOnlineStateOrThrow() { + if (!await m3()) throw new Error("No internet connection detected. Please restart your network and try again."); + } + async handleBatchMessageEvents(e) { + if (e?.length === 0) { + this.logger.trace("Batch message events is empty. Ignoring..."); + return; + } + const r = e.sort((n, i) => n.publishedAt - i.publishedAt); + this.logger.trace(`Batch of ${r.length} message events sorted`); + for (const n of r) try { + await this.onMessageEvent(n); + } catch (i) { + this.logger.warn(i); + } + this.logger.trace(`Batch of ${r.length} message events processed`); + } + async onLinkMessageEvent(e, r) { + const { topic: n } = e; + if (!r.sessionExists) { + const i = _n(bt.FIVE_MINUTES), s = { topic: n, expiry: i, relay: { protocol: "irn" }, active: !1 }; + await this.core.pairing.pairings.set(n, s); + } + this.events.emit(Qn.message, e), await this.recordMessageEvent(e); + } + startPingTimeout() { + var e, r, n, i, s; + if (xd()) try { + (r = (e = this.provider) == null ? void 0 : e.connection) != null && r.socket && ((s = (i = (n = this.provider) == null ? void 0 : n.connection) == null ? void 0 : i.socket) == null || s.once("ping", () => { + this.resetPingTimeout(); + })), this.resetPingTimeout(); + } catch (o) { + this.logger.warn(o); + } + } + isConnectionStalled(e) { + return this.staleConnectionErrors.some((r) => e.includes(r)); + } + async createProvider() { + this.provider.connection && this.unregisterProviderListeners(); + const e = await this.core.crypto.signJWT(this.relayUrl); + this.provider = new Yi(new NU(DF({ sdkVersion: av, protocol: this.protocol, version: this.version, relayUrl: this.relayUrl, projectId: this.projectId, auth: e, useOnCloseEvent: !0, bundleId: this.bundleId }))), this.registerProviderListeners(); + } + async recordMessageEvent(e) { + const { topic: r, message: n } = e; + await this.messages.set(r, n); + } + async shouldIgnoreMessageEvent(e) { + const { topic: r, message: n } = e; + if (!n || n.length === 0) return this.logger.debug(`Ignoring invalid/empty message: ${n}`), !0; + if (!await this.subscriber.isSubscribed(r)) return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`), !0; + const i = this.messages.has(r, n); + return i && this.logger.debug(`Ignoring duplicate message: ${n}`), i; + } + async onProviderPayload(e) { + if (this.logger.debug("Incoming Relay Payload"), this.logger.trace({ type: "payload", direction: "incoming", payload: e }), I1(e)) { + if (!e.method.endsWith(JU)) return; + const r = e.params, { topic: n, message: i, publishedAt: s, attestation: o } = r.data, a = { topic: n, message: i, publishedAt: s, transportType: Wr.relay, attestation: o }; + this.logger.debug("Emitting Relayer Payload"), this.logger.trace(B3({ type: "event", event: r.id }, a)), this.events.emit(r.id, a), await this.acknowledgePayload(e), await this.onMessageEvent(a); + } else i0(e) && this.events.emit(Qn.message_ack, e); + } + async onMessageEvent(e) { + await this.shouldIgnoreMessageEvent(e) || (this.events.emit(Qn.message, e), await this.recordMessageEvent(e)); + } + async acknowledgePayload(e) { + const r = r0(e.id, !0); + await this.provider.connection.send(r); + } + unregisterProviderListeners() { + this.provider.off($i.payload, this.onPayloadHandler), this.provider.off($i.connect, this.onConnectHandler), this.provider.off($i.disconnect, this.onDisconnectHandler), this.provider.off($i.error, this.onProviderErrorHandler), clearTimeout(this.pingTimeout); + } + async registerEventListeners() { + let e = await m3(); + uU(async (r) => { + e !== r && (e = r, r ? await this.restartTransport().catch((n) => this.logger.error(n)) : (this.hasExperiencedNetworkDisruption = !0, await this.transportDisconnect(), this.transportExplicitlyClosed = !1)); + }); + } + async onProviderDisconnect() { + await this.subscriber.stop(), this.requestsInFlight.clear(), clearTimeout(this.pingTimeout), this.events.emit(Qn.disconnect), this.connectionAttemptInProgress = !1, !this.transportExplicitlyClosed && (this.reconnectTimeout || (this.reconnectTimeout = setTimeout(async () => { + await this.transportOpen().catch((e) => this.logger.error(e)); + }, bt.toMiliseconds(XU)))); + } + isInitialized() { + if (!this.initialized) { + const { message: e } = ft("NOT_INITIALIZED", this.name); + throw new Error(e); + } + } + async toEstablishConnection() { + await this.confirmOnlineStateOrThrow(), !this.connected && (this.connectionAttemptInProgress && await new Promise((e) => { + const r = setInterval(() => { + this.connected && (clearInterval(r), e()); + }, this.connectionStatusPollingInterval); + }), await this.transportOpen()); + } +} +var nH = Object.defineProperty, F3 = Object.getOwnPropertySymbols, iH = Object.prototype.hasOwnProperty, sH = Object.prototype.propertyIsEnumerable, j3 = (t, e, r) => e in t ? nH(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, U3 = (t, e) => { + for (var r in e || (e = {})) iH.call(e, r) && j3(t, r, e[r]); + if (F3) for (var r of F3(e)) sH.call(e, r) && j3(t, r, e[r]); + return t; +}; +class Va extends dk { + constructor(e, r, n, i = Ds, s = void 0) { + super(e, r, n, i), this.core = e, this.logger = r, this.name = n, this.map = /* @__PURE__ */ new Map(), this.version = ZU, this.cached = [], this.initialized = !1, this.storagePrefix = Ds, this.recentlyDeleted = [], this.recentlyDeletedLimit = 200, this.init = async () => { + this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((o) => { + this.getKey && o !== null && !ei(o) ? this.map.set(this.getKey(o), o) : jj(o) ? this.map.set(o.id, o) : Uj(o) && this.map.set(o.topic, o); + }), this.cached = [], this.initialized = !0); + }, this.set = async (o, a) => { + this.isInitialized(), this.map.has(o) ? await this.update(o, a) : (this.logger.debug("Setting value"), this.logger.trace({ type: "method", method: "set", key: o, value: a }), this.map.set(o, a), await this.persist()); + }, this.get = (o) => (this.isInitialized(), this.logger.debug("Getting value"), this.logger.trace({ type: "method", method: "get", key: o }), this.getData(o)), this.getAll = (o) => (this.isInitialized(), o ? this.values.filter((a) => Object.keys(o).every((f) => $U(a[f], o[f]))) : this.values), this.update = async (o, a) => { + this.isInitialized(), this.logger.debug("Updating value"), this.logger.trace({ type: "method", method: "update", key: o, update: a }); + const f = U3(U3({}, this.getData(o)), a); + this.map.set(o, f), await this.persist(); + }, this.delete = async (o, a) => { + this.isInitialized(), this.map.has(o) && (this.logger.debug("Deleting value"), this.logger.trace({ type: "method", method: "delete", key: o, reason: a }), this.map.delete(o), this.addToRecentlyDeleted(o), await this.persist()); + }, this.logger = ri(r, this.name), this.storagePrefix = i, this.getKey = s; + } + get context() { + return mi(this.logger); + } + get storageKey() { + return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; + } + get length() { + return this.map.size; + } + get keys() { + return Array.from(this.map.keys()); + } + get values() { + return Array.from(this.map.values()); + } + addToRecentlyDeleted(e) { + this.recentlyDeleted.push(e), this.recentlyDeleted.length >= this.recentlyDeletedLimit && this.recentlyDeleted.splice(0, this.recentlyDeletedLimit / 2); + } + async setDataStore(e) { + await this.core.storage.setItem(this.storageKey, e); + } + async getDataStore() { + return await this.core.storage.getItem(this.storageKey); + } + getData(e) { + const r = this.map.get(e); + if (!r) { + if (this.recentlyDeleted.includes(e)) { + const { message: i } = ft("MISSING_OR_INVALID", `Record was recently deleted - ${this.name}: ${e}`); + throw this.logger.error(i), new Error(i); + } + const { message: n } = ft("NO_MATCHING_KEY", `${this.name}: ${e}`); + throw this.logger.error(n), new Error(n); + } + return r; + } + async persist() { + await this.setDataStore(this.values); + } + async restore() { + try { + const e = await this.getDataStore(); + if (typeof e > "u" || !e.length) return; + if (this.map.size) { + const { message: r } = ft("RESTORE_WILL_OVERRIDE", this.name); + throw this.logger.error(r), new Error(r); + } + this.cached = e, this.logger.debug(`Successfully Restored value for ${this.name}`), this.logger.trace({ type: "method", method: "restore", value: this.values }); + } catch (e) { + this.logger.debug(`Failed to Restore value for ${this.name}`), this.logger.error(e); + } + } + isInitialized() { + if (!this.initialized) { + const { message: e } = ft("NOT_INITIALIZED", this.name); + throw new Error(e); + } + } +} +class oH { + constructor(e, r) { + this.core = e, this.logger = r, this.name = nq, this.version = iq, this.events = new l1(), this.initialized = !1, this.storagePrefix = Ds, this.ignoredPayloadTypes = [so], this.registeredMethods = [], this.init = async () => { + this.initialized || (await this.pairings.init(), await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.initialized = !0, this.logger.trace("Initialized")); + }, this.register = ({ methods: n }) => { + this.isInitialized(), this.registeredMethods = [.../* @__PURE__ */ new Set([...this.registeredMethods, ...n])]; + }, this.create = async (n) => { + this.isInitialized(); + const i = sv(), s = await this.core.crypto.setSymKey(i), o = _n(bt.FIVE_MINUTES), a = { protocol: G8 }, f = { topic: s, expiry: o, relay: a, active: !1, methods: n?.methods }, u = f3({ protocol: this.core.protocol, version: this.core.version, topic: s, symKey: i, relay: a, expiryTimestamp: o, methods: n?.methods }); + return this.events.emit(_a.create, f), this.core.expirer.set(s, o), await this.pairings.set(s, f), await this.core.relayer.subscribe(s, { transportType: n?.transportType }), { topic: s, uri: u }; + }, this.pair = async (n) => { + this.isInitialized(); + const i = this.core.eventClient.createEvent({ properties: { topic: n?.uri, trace: [As.pairing_started] } }); + this.isValidPair(n, i); + const { topic: s, symKey: o, relay: a, expiryTimestamp: f, methods: u } = u3(n.uri); + i.props.properties.topic = s, i.addTrace(As.pairing_uri_validation_success), i.addTrace(As.pairing_uri_not_expired); + let h; + if (this.pairings.keys.includes(s)) { + if (h = this.pairings.get(s), i.addTrace(As.existing_pairing), h.active) throw i.setError(Zs.active_pairing_already_exists), new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`); + i.addTrace(As.pairing_not_expired); + } + const g = f || _n(bt.FIVE_MINUTES), v = { topic: s, relay: a, expiry: g, active: !1, methods: u }; + this.core.expirer.set(s, g), await this.pairings.set(s, v), i.addTrace(As.store_new_pairing), n.activatePairing && await this.activate({ topic: s }), this.events.emit(_a.create, v), i.addTrace(As.emit_inactive_pairing), this.core.crypto.keychain.has(s) || await this.core.crypto.setSymKey(o, s), i.addTrace(As.subscribing_pairing_topic); + try { + await this.core.relayer.confirmOnlineStateOrThrow(); + } catch { + i.setError(Zs.no_internet_connection); + } + try { + await this.core.relayer.subscribe(s, { relay: a }); + } catch (x) { + throw i.setError(Zs.subscribe_pairing_topic_failure), x; + } + return i.addTrace(As.subscribe_pairing_topic_success), v; + }, this.activate = async ({ topic: n }) => { + this.isInitialized(); + const i = _n(bt.THIRTY_DAYS); + this.core.expirer.set(n, i), await this.pairings.update(n, { active: !0, expiry: i }); + }, this.ping = async (n) => { + this.isInitialized(), await this.isValidPing(n); + const { topic: i } = n; + if (this.pairings.keys.includes(i)) { + const s = await this.sendRequest(i, "wc_pairingPing", {}), { done: o, resolve: a, reject: f } = ba(); + this.events.once(wr("pairing_ping", s), ({ error: u }) => { + u ? f(u) : a(); + }), await o(); + } + }, this.updateExpiry = async ({ topic: n, expiry: i }) => { + this.isInitialized(), await this.pairings.update(n, { expiry: i }); + }, this.updateMetadata = async ({ topic: n, metadata: i }) => { + this.isInitialized(), await this.pairings.update(n, { peerMetadata: i }); + }, this.getPairings = () => (this.isInitialized(), this.pairings.values), this.disconnect = async (n) => { + this.isInitialized(), await this.isValidDisconnect(n); + const { topic: i } = n; + this.pairings.keys.includes(i) && (await this.sendRequest(i, "wc_pairingDelete", Nr("USER_DISCONNECTED")), await this.deletePairing(i)); + }, this.formatUriFromPairing = (n) => { + this.isInitialized(); + const { topic: i, relay: s, expiry: o, methods: a } = n, f = this.core.crypto.keychain.get(i); + return f3({ protocol: this.core.protocol, version: this.core.version, topic: i, symKey: f, relay: s, expiryTimestamp: o, methods: a }); + }, this.sendRequest = async (n, i, s) => { + const o = $o(i, s), a = await this.core.crypto.encode(n, o), f = Lu[i].req; + return this.core.history.set(n, o), this.core.relayer.publish(n, a, f), o.id; + }, this.sendResult = async (n, i, s) => { + const o = r0(n, s), a = await this.core.crypto.encode(i, o), f = await this.core.history.get(i, n), u = Lu[f.request.method].res; + await this.core.relayer.publish(i, a, u), await this.core.history.resolve(o); + }, this.sendError = async (n, i, s) => { + const o = n0(n, s), a = await this.core.crypto.encode(i, o), f = await this.core.history.get(i, n), u = Lu[f.request.method] ? Lu[f.request.method].res : Lu.unregistered_method.res; + await this.core.relayer.publish(i, a, u), await this.core.history.resolve(o); + }, this.deletePairing = async (n, i) => { + await this.core.relayer.unsubscribe(n), await Promise.all([this.pairings.delete(n, Nr("USER_DISCONNECTED")), this.core.crypto.deleteSymKey(n), i ? Promise.resolve() : this.core.expirer.del(n)]); + }, this.cleanup = async () => { + const n = this.pairings.getAll().filter((i) => Oo(i.expiry)); + await Promise.all(n.map((i) => this.deletePairing(i.topic))); + }, this.onRelayEventRequest = (n) => { + const { topic: i, payload: s } = n; + switch (s.method) { + case "wc_pairingPing": + return this.onPairingPingRequest(i, s); + case "wc_pairingDelete": + return this.onPairingDeleteRequest(i, s); + default: + return this.onUnknownRpcMethodRequest(i, s); + } + }, this.onRelayEventResponse = async (n) => { + const { topic: i, payload: s } = n, o = (await this.core.history.get(i, s.id)).request.method; + switch (o) { + case "wc_pairingPing": + return this.onPairingPingResponse(i, s); + default: + return this.onUnknownRpcMethodResponse(o); + } + }, this.onPairingPingRequest = async (n, i) => { + const { id: s } = i; + try { + this.isValidPing({ topic: n }), await this.sendResult(s, n, !0), this.events.emit(_a.ping, { id: s, topic: n }); + } catch (o) { + await this.sendError(s, n, o), this.logger.error(o); + } + }, this.onPairingPingResponse = (n, i) => { + const { id: s } = i; + setTimeout(() => { + Ps(i) ? this.events.emit(wr("pairing_ping", s), {}) : qi(i) && this.events.emit(wr("pairing_ping", s), { error: i.error }); + }, 500); + }, this.onPairingDeleteRequest = async (n, i) => { + const { id: s } = i; + try { + this.isValidDisconnect({ topic: n }), await this.deletePairing(n), this.events.emit(_a.delete, { id: s, topic: n }); + } catch (o) { + await this.sendError(s, n, o), this.logger.error(o); + } + }, this.onUnknownRpcMethodRequest = async (n, i) => { + const { id: s, method: o } = i; + try { + if (this.registeredMethods.includes(o)) return; + const a = Nr("WC_METHOD_UNSUPPORTED", o); + await this.sendError(s, n, a), this.logger.error(a); + } catch (a) { + await this.sendError(s, n, a), this.logger.error(a); + } + }, this.onUnknownRpcMethodResponse = (n) => { + this.registeredMethods.includes(n) || this.logger.error(Nr("WC_METHOD_UNSUPPORTED", n)); + }, this.isValidPair = (n, i) => { + var s; + if (!ui(n)) { + const { message: a } = ft("MISSING_OR_INVALID", `pair() params: ${n}`); + throw i.setError(Zs.malformed_pairing_uri), new Error(a); + } + if (!Fj(n.uri)) { + const { message: a } = ft("MISSING_OR_INVALID", `pair() uri: ${n.uri}`); + throw i.setError(Zs.malformed_pairing_uri), new Error(a); + } + const o = u3(n?.uri); + if (!((s = o?.relay) != null && s.protocol)) { + const { message: a } = ft("MISSING_OR_INVALID", "pair() uri#relay-protocol"); + throw i.setError(Zs.malformed_pairing_uri), new Error(a); + } + if (!(o != null && o.symKey)) { + const { message: a } = ft("MISSING_OR_INVALID", "pair() uri#symKey"); + throw i.setError(Zs.malformed_pairing_uri), new Error(a); + } + if (o != null && o.expiryTimestamp && bt.toMiliseconds(o?.expiryTimestamp) < Date.now()) { + i.setError(Zs.pairing_expired); + const { message: a } = ft("EXPIRED", "pair() URI has expired. Please try again with a new connection URI."); + throw new Error(a); + } + }, this.isValidPing = async (n) => { + if (!ui(n)) { + const { message: s } = ft("MISSING_OR_INVALID", `ping() params: ${n}`); + throw new Error(s); + } + const { topic: i } = n; + await this.isValidPairingTopic(i); + }, this.isValidDisconnect = async (n) => { + if (!ui(n)) { + const { message: s } = ft("MISSING_OR_INVALID", `disconnect() params: ${n}`); + throw new Error(s); + } + const { topic: i } = n; + await this.isValidPairingTopic(i); + }, this.isValidPairingTopic = async (n) => { + if (!hn(n, !1)) { + const { message: i } = ft("MISSING_OR_INVALID", `pairing topic should be a string: ${n}`); + throw new Error(i); + } + if (!this.pairings.keys.includes(n)) { + const { message: i } = ft("NO_MATCHING_KEY", `pairing topic doesn't exist: ${n}`); + throw new Error(i); + } + if (Oo(this.pairings.get(n).expiry)) { + await this.deletePairing(n); + const { message: i } = ft("EXPIRED", `pairing topic: ${n}`); + throw new Error(i); + } + }, this.core = e, this.logger = ri(r, this.name), this.pairings = new Va(this.core, this.logger, this.name, this.storagePrefix); + } + get context() { + return mi(this.logger); + } + isInitialized() { + if (!this.initialized) { + const { message: e } = ft("NOT_INITIALIZED", this.name); + throw new Error(e); + } + } + registerRelayerEvents() { + this.core.relayer.on(Qn.message, async (e) => { + const { topic: r, message: n, transportType: i } = e; + if (!this.pairings.keys.includes(r) || i === Wr.link_mode || this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n))) return; + const s = await this.core.crypto.decode(r, n); + try { + I1(s) ? (this.core.history.set(r, s), this.onRelayEventRequest({ topic: r, payload: s })) : i0(s) && (await this.core.history.resolve(s), await this.onRelayEventResponse({ topic: r, payload: s }), this.core.history.delete(r, s.id)); + } catch (o) { + this.logger.error(o); + } + }); + } + registerExpirerEvents() { + this.core.expirer.on(ji.expired, async (e) => { + const { topic: r } = C8(e.target); + r && this.pairings.keys.includes(r) && (await this.deletePairing(r, !0), this.events.emit(_a.expire, { topic: r })); + }); + } +} +class aH extends uk { + constructor(e, r) { + super(e, r), this.core = e, this.logger = r, this.records = /* @__PURE__ */ new Map(), this.events = new Wi.EventEmitter(), this.name = sq, this.version = oq, this.cached = [], this.initialized = !1, this.storagePrefix = Ds, this.init = async () => { + this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((n) => this.records.set(n.id, n)), this.cached = [], this.registerEventListeners(), this.initialized = !0); + }, this.set = (n, i, s) => { + if (this.isInitialized(), this.logger.debug("Setting JSON-RPC request history record"), this.logger.trace({ type: "method", method: "set", topic: n, request: i, chainId: s }), this.records.has(i.id)) return; + const o = { id: i.id, topic: n, request: { method: i.method, params: i.params || null }, chainId: s, expiry: _n(bt.THIRTY_DAYS) }; + this.records.set(o.id, o), this.persist(), this.events.emit(ns.created, o); + }, this.resolve = async (n) => { + if (this.isInitialized(), this.logger.debug("Updating JSON-RPC response history record"), this.logger.trace({ type: "method", method: "update", response: n }), !this.records.has(n.id)) return; + const i = await this.getRecord(n.id); + typeof i.response > "u" && (i.response = qi(n) ? { error: n.error } : { result: n.result }, this.records.set(i.id, i), this.persist(), this.events.emit(ns.updated, i)); + }, this.get = async (n, i) => (this.isInitialized(), this.logger.debug("Getting record"), this.logger.trace({ type: "method", method: "get", topic: n, id: i }), await this.getRecord(i)), this.delete = (n, i) => { + this.isInitialized(), this.logger.debug("Deleting record"), this.logger.trace({ type: "method", method: "delete", id: i }), this.values.forEach((s) => { + if (s.topic === n) { + if (typeof i < "u" && s.id !== i) return; + this.records.delete(s.id), this.events.emit(ns.deleted, s); + } + }), this.persist(); + }, this.exists = async (n, i) => (this.isInitialized(), this.records.has(i) ? (await this.getRecord(i)).topic === n : !1), this.on = (n, i) => { + this.events.on(n, i); + }, this.once = (n, i) => { + this.events.once(n, i); + }, this.off = (n, i) => { + this.events.off(n, i); + }, this.removeListener = (n, i) => { + this.events.removeListener(n, i); + }, this.logger = ri(r, this.name); + } + get context() { + return mi(this.logger); + } + get storageKey() { + return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; + } + get size() { + return this.records.size; + } + get keys() { + return Array.from(this.records.keys()); + } + get values() { + return Array.from(this.records.values()); + } + get pending() { + const e = []; + return this.values.forEach((r) => { + if (typeof r.response < "u") return; + const n = { topic: r.topic, request: $o(r.request.method, r.request.params, r.id), chainId: r.chainId }; + return e.push(n); + }), e; + } + async setJsonRpcRecords(e) { + await this.core.storage.setItem(this.storageKey, e); + } + async getJsonRpcRecords() { + return await this.core.storage.getItem(this.storageKey); + } + getRecord(e) { + this.isInitialized(); + const r = this.records.get(e); + if (!r) { + const { message: n } = ft("NO_MATCHING_KEY", `${this.name}: ${e}`); + throw new Error(n); + } + return r; + } + async persist() { + await this.setJsonRpcRecords(this.values), this.events.emit(ns.sync); + } + async restore() { + try { + const e = await this.getJsonRpcRecords(); + if (typeof e > "u" || !e.length) return; + if (this.records.size) { + const { message: r } = ft("RESTORE_WILL_OVERRIDE", this.name); + throw this.logger.error(r), new Error(r); + } + this.cached = e, this.logger.debug(`Successfully Restored records for ${this.name}`), this.logger.trace({ type: "method", method: "restore", records: this.values }); + } catch (e) { + this.logger.debug(`Failed to Restore records for ${this.name}`), this.logger.error(e); + } + } + registerEventListeners() { + this.events.on(ns.created, (e) => { + const r = ns.created; + this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, record: e }); + }), this.events.on(ns.updated, (e) => { + const r = ns.updated; + this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, record: e }); + }), this.events.on(ns.deleted, (e) => { + const r = ns.deleted; + this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, record: e }); + }), this.core.heartbeat.on(Vc.pulse, () => { + this.cleanup(); + }); + } + cleanup() { + try { + this.isInitialized(); + let e = !1; + this.records.forEach((r) => { + bt.toMiliseconds(r.expiry || 0) - Date.now() <= 0 && (this.logger.info(`Deleting expired history log: ${r.id}`), this.records.delete(r.id), this.events.emit(ns.deleted, r, !1), e = !0); + }), e && this.persist(); + } catch (e) { + this.logger.warn(e); + } + } + isInitialized() { + if (!this.initialized) { + const { message: e } = ft("NOT_INITIALIZED", this.name); + throw new Error(e); + } + } +} +class cH extends gk { + constructor(e, r) { + super(e, r), this.core = e, this.logger = r, this.expirations = /* @__PURE__ */ new Map(), this.events = new Wi.EventEmitter(), this.name = aq, this.version = cq, this.cached = [], this.initialized = !1, this.storagePrefix = Ds, this.init = async () => { + this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((n) => this.expirations.set(n.target, n)), this.cached = [], this.registerEventListeners(), this.initialized = !0); + }, this.has = (n) => { + try { + const i = this.formatTarget(n); + return typeof this.getExpiration(i) < "u"; + } catch { + return !1; + } + }, this.set = (n, i) => { + this.isInitialized(); + const s = this.formatTarget(n), o = { target: s, expiry: i }; + this.expirations.set(s, o), this.checkExpiry(s, o), this.events.emit(ji.created, { target: s, expiration: o }); + }, this.get = (n) => { + this.isInitialized(); + const i = this.formatTarget(n); + return this.getExpiration(i); + }, this.del = (n) => { + if (this.isInitialized(), this.has(n)) { + const i = this.formatTarget(n), s = this.getExpiration(i); + this.expirations.delete(i), this.events.emit(ji.deleted, { target: i, expiration: s }); + } + }, this.on = (n, i) => { + this.events.on(n, i); + }, this.once = (n, i) => { + this.events.once(n, i); + }, this.off = (n, i) => { + this.events.off(n, i); + }, this.removeListener = (n, i) => { + this.events.removeListener(n, i); + }, this.logger = ri(r, this.name); + } + get context() { + return mi(this.logger); + } + get storageKey() { + return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; + } + get length() { + return this.expirations.size; + } + get keys() { + return Array.from(this.expirations.keys()); + } + get values() { + return Array.from(this.expirations.values()); + } + formatTarget(e) { + if (typeof e == "string") return OF(e); + if (typeof e == "number") return NF(e); + const { message: r } = ft("UNKNOWN_TYPE", `Target type: ${typeof e}`); + throw new Error(r); + } + async setExpirations(e) { + await this.core.storage.setItem(this.storageKey, e); + } + async getExpirations() { + return await this.core.storage.getItem(this.storageKey); + } + async persist() { + await this.setExpirations(this.values), this.events.emit(ji.sync); + } + async restore() { + try { + const e = await this.getExpirations(); + if (typeof e > "u" || !e.length) return; + if (this.expirations.size) { + const { message: r } = ft("RESTORE_WILL_OVERRIDE", this.name); + throw this.logger.error(r), new Error(r); + } + this.cached = e, this.logger.debug(`Successfully Restored expirations for ${this.name}`), this.logger.trace({ type: "method", method: "restore", expirations: this.values }); + } catch (e) { + this.logger.debug(`Failed to Restore expirations for ${this.name}`), this.logger.error(e); + } + } + getExpiration(e) { + const r = this.expirations.get(e); + if (!r) { + const { message: n } = ft("NO_MATCHING_KEY", `${this.name}: ${e}`); + throw this.logger.warn(n), new Error(n); + } + return r; + } + checkExpiry(e, r) { + const { expiry: n } = r; + bt.toMiliseconds(n) - Date.now() <= 0 && this.expire(e, r); + } + expire(e, r) { + this.expirations.delete(e), this.events.emit(ji.expired, { target: e, expiration: r }); + } + checkExpirations() { + this.core.relayer.connected && this.expirations.forEach((e, r) => this.checkExpiry(r, e)); + } + registerEventListeners() { + this.core.heartbeat.on(Vc.pulse, () => this.checkExpirations()), this.events.on(ji.created, (e) => { + const r = ji.created; + this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), this.persist(); + }), this.events.on(ji.expired, (e) => { + const r = ji.expired; + this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), this.persist(); + }), this.events.on(ji.deleted, (e) => { + const r = ji.deleted; + this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), this.persist(); + }); + } + isInitialized() { + if (!this.initialized) { + const { message: e } = ft("NOT_INITIALIZED", this.name); + throw new Error(e); + } + } +} +class uH extends mk { + constructor(e, r, n) { + super(e, r, n), this.core = e, this.logger = r, this.store = n, this.name = uq, this.verifyUrlV3 = lq, this.storagePrefix = Ds, this.version = K8, this.init = async () => { + var i; + this.isDevEnv || (this.publicKey = await this.store.getItem(this.storeKey), this.publicKey && bt.toMiliseconds((i = this.publicKey) == null ? void 0 : i.expiresAt) < Date.now() && (this.logger.debug("verify v2 public key expired"), await this.removePublicKey())); + }, this.register = async (i) => { + if (!il() || this.isDevEnv) return; + const s = window.location.origin, { id: o, decryptedId: a } = i, f = `${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`; + try { + const u = La.getDocument(), h = this.startAbortTimer(bt.ONE_SECOND * 5), g = await new Promise((v, x) => { + const S = () => { + window.removeEventListener("message", D), u.body.removeChild(C), x("attestation aborted"); + }; + this.abortController.signal.addEventListener("abort", S); + const C = u.createElement("iframe"); + C.src = f, C.style.display = "none", C.addEventListener("error", S, { signal: this.abortController.signal }); + const D = ($) => { + if ($.data && typeof $.data == "string") try { + const N = JSON.parse($.data); + if (N.type === "verify_attestation") { + if (ev(N.attestation).payload.id !== o) return; + clearInterval(h), u.body.removeChild(C), this.abortController.signal.removeEventListener("abort", S), window.removeEventListener("message", D), v(N.attestation === null ? "" : N.attestation); + } + } catch (N) { + this.logger.warn(N); + } + }; + u.body.appendChild(C), window.addEventListener("message", D, { signal: this.abortController.signal }); + }); + return this.logger.debug("jwt attestation", g), g; + } catch (u) { + this.logger.warn(u); + } + return ""; + }, this.resolve = async (i) => { + if (this.isDevEnv) return ""; + const { attestationId: s, hash: o, encryptedId: a } = i; + if (s === "") { + this.logger.debug("resolve: attestationId is empty, skipping"); + return; + } + if (s) { + if (ev(s).payload.id !== a) return; + const u = await this.isValidJwtAttestation(s); + if (u) { + if (!u.isVerified) { + this.logger.warn("resolve: jwt attestation: origin url not verified"); + return; + } + return u; + } + } + if (!o) return; + const f = this.getVerifyUrl(i?.verifyUrl); + return this.fetchAttestation(o, f); + }, this.fetchAttestation = async (i, s) => { + this.logger.debug(`resolving attestation: ${i} from url: ${s}`); + const o = this.startAbortTimer(bt.ONE_SECOND * 5), a = await fetch(`${s}/attestation/${i}?v2Supported=true`, { signal: this.abortController.signal }); + return clearTimeout(o), a.status === 200 ? await a.json() : void 0; + }, this.getVerifyUrl = (i) => { + let s = i || rf; + return hq.includes(s) || (this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${rf}`), s = rf), s; + }, this.fetchPublicKey = async () => { + try { + this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`); + const i = this.startAbortTimer(bt.FIVE_SECONDS), s = await fetch(`${this.verifyUrlV3}/public-key`, { signal: this.abortController.signal }); + return clearTimeout(i), await s.json(); + } catch (i) { + this.logger.warn(i); + } + }, this.persistPublicKey = async (i) => { + this.logger.debug("persisting public key to local storage", i), await this.store.setItem(this.storeKey, i), this.publicKey = i; + }, this.removePublicKey = async () => { + this.logger.debug("removing verify v2 public key from storage"), await this.store.removeItem(this.storeKey), this.publicKey = void 0; + }, this.isValidJwtAttestation = async (i) => { + const s = await this.getPublicKey(); + try { + if (s) return this.validateAttestation(i, s); + } catch (a) { + this.logger.error(a), this.logger.warn("error validating attestation"); + } + const o = await this.fetchAndPersistPublicKey(); + try { + if (o) return this.validateAttestation(i, o); + } catch (a) { + this.logger.error(a), this.logger.warn("error validating attestation"); + } + }, this.getPublicKey = async () => this.publicKey ? this.publicKey : await this.fetchAndPersistPublicKey(), this.fetchAndPersistPublicKey = async () => { + if (this.fetchPromise) return await this.fetchPromise, this.publicKey; + this.fetchPromise = new Promise(async (s) => { + const o = await this.fetchPublicKey(); + o && (await this.persistPublicKey(o), s(o)); + }); + const i = await this.fetchPromise; + return this.fetchPromise = void 0, i; + }, this.validateAttestation = (i, s) => { + const o = wj(i, s.publicKey), a = { hasExpired: bt.toMiliseconds(o.exp) < Date.now(), payload: o }; + if (a.hasExpired) throw this.logger.warn("resolve: jwt attestation expired"), new Error("JWT attestation expired"); + return { origin: a.payload.origin, isScam: a.payload.isScam, isVerified: a.payload.isVerified }; + }, this.logger = ri(r, this.name), this.abortController = new AbortController(), this.isDevEnv = _1(), this.init(); + } + get storeKey() { + return this.storagePrefix + this.version + this.core.customStoragePrefix + "//verify:public:key"; + } + get context() { + return mi(this.logger); + } + startAbortTimer(e) { + return this.abortController = new AbortController(), setTimeout(() => this.abortController.abort(), bt.toMiliseconds(e)); + } +} +class fH extends vk { + constructor(e, r) { + super(e, r), this.projectId = e, this.logger = r, this.context = dq, this.registerDeviceToken = async (n) => { + const { clientId: i, token: s, notificationType: o, enableEncrypted: a = !1 } = n, f = `${pq}/${this.projectId}/clients`; + await fetch(f, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ client_id: i, type: o, token: s, always_raw: a }) }); + }, this.logger = ri(r, this.context); + } +} +var lH = Object.defineProperty, q3 = Object.getOwnPropertySymbols, hH = Object.prototype.hasOwnProperty, dH = Object.prototype.propertyIsEnumerable, z3 = (t, e, r) => e in t ? lH(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Bu = (t, e) => { + for (var r in e || (e = {})) hH.call(e, r) && z3(t, r, e[r]); + if (q3) for (var r of q3(e)) dH.call(e, r) && z3(t, r, e[r]); + return t; +}; +class pH extends bk { + constructor(e, r, n = !0) { + super(e, r, n), this.core = e, this.logger = r, this.context = mq, this.storagePrefix = Ds, this.storageVersion = gq, this.events = /* @__PURE__ */ new Map(), this.shouldPersist = !1, this.init = async () => { + if (!_1()) try { + const i = { eventId: Xx(), timestamp: Date.now(), domain: this.getAppDomain(), props: { event: "INIT", type: "", properties: { client_id: await this.core.crypto.getClientId(), user_agent: A8(this.core.relayer.protocol, this.core.relayer.version, av) } } }; + await this.sendEvent([i]); + } catch (i) { + this.logger.warn(i); + } + }, this.createEvent = (i) => { + const { event: s = "ERROR", type: o = "", properties: { topic: a, trace: f } } = i, u = Xx(), h = this.core.projectId || "", g = Date.now(), v = Bu({ eventId: u, timestamp: g, props: { event: s, type: o, properties: { topic: a, trace: f } }, bundleId: h, domain: this.getAppDomain() }, this.setMethods(u)); + return this.telemetryEnabled && (this.events.set(u, v), this.shouldPersist = !0), v; + }, this.getEvent = (i) => { + const { eventId: s, topic: o } = i; + if (s) return this.events.get(s); + const a = Array.from(this.events.values()).find((f) => f.props.properties.topic === o); + if (a) return Bu(Bu({}, a), this.setMethods(a.eventId)); + }, this.deleteEvent = (i) => { + const { eventId: s } = i; + this.events.delete(s), this.shouldPersist = !0; + }, this.setEventListeners = () => { + this.core.heartbeat.on(Vc.pulse, async () => { + this.shouldPersist && await this.persist(), this.events.forEach((i) => { + bt.fromMiliseconds(Date.now()) - bt.fromMiliseconds(i.timestamp) > vq && (this.events.delete(i.eventId), this.shouldPersist = !0); + }); + }); + }, this.setMethods = (i) => ({ addTrace: (s) => this.addTrace(i, s), setError: (s) => this.setError(i, s) }), this.addTrace = (i, s) => { + const o = this.events.get(i); + o && (o.props.properties.trace.push(s), this.events.set(i, o), this.shouldPersist = !0); + }, this.setError = (i, s) => { + const o = this.events.get(i); + o && (o.props.type = s, o.timestamp = Date.now(), this.events.set(i, o), this.shouldPersist = !0); + }, this.persist = async () => { + await this.core.storage.setItem(this.storageKey, Array.from(this.events.values())), this.shouldPersist = !1; + }, this.restore = async () => { + try { + const i = await this.core.storage.getItem(this.storageKey) || []; + if (!i.length) return; + i.forEach((s) => { + this.events.set(s.eventId, Bu(Bu({}, s), this.setMethods(s.eventId))); + }); + } catch (i) { + this.logger.warn(i); + } + }, this.submit = async () => { + if (!this.telemetryEnabled || this.events.size === 0) return; + const i = []; + for (const [s, o] of this.events) o.props.type && i.push(o); + if (i.length !== 0) try { + if ((await this.sendEvent(i)).ok) for (const s of i) this.events.delete(s.eventId), this.shouldPersist = !0; + } catch (s) { + this.logger.warn(s); + } + }, this.sendEvent = async (i) => { + const s = this.getAppDomain() ? "" : "&sp=desktop"; + return await fetch(`${bq}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${av}${s}`, { method: "POST", body: JSON.stringify(i) }); + }, this.getAppDomain = () => S8().url, this.logger = ri(r, this.context), this.telemetryEnabled = n, n ? this.restore().then(async () => { + await this.submit(), this.setEventListeners(); + }) : this.persist(); + } + get storageKey() { + return this.storagePrefix + this.storageVersion + this.core.customStoragePrefix + "//" + this.context; + } +} +var gH = Object.defineProperty, H3 = Object.getOwnPropertySymbols, mH = Object.prototype.hasOwnProperty, vH = Object.prototype.propertyIsEnumerable, W3 = (t, e, r) => e in t ? gH(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, K3 = (t, e) => { + for (var r in e || (e = {})) mH.call(e, r) && W3(t, r, e[r]); + if (H3) for (var r of H3(e)) vH.call(e, r) && W3(t, r, e[r]); + return t; +}; +class C1 extends ck { + constructor(e) { + var r; + super(e), this.protocol = W8, this.version = K8, this.name = V8, this.events = new Wi.EventEmitter(), this.initialized = !1, this.on = (o, a) => this.events.on(o, a), this.once = (o, a) => this.events.once(o, a), this.off = (o, a) => this.events.off(o, a), this.removeListener = (o, a) => this.events.removeListener(o, a), this.dispatchEnvelope = ({ topic: o, message: a, sessionExists: f }) => { + if (!o || !a) return; + const u = { topic: o, message: a, publishedAt: Date.now(), transportType: Wr.link_mode }; + this.relayer.onLinkMessageEvent(u, { sessionExists: f }); + }, this.projectId = e?.projectId, this.relayUrl = e?.relayUrl || Y8, this.customStoragePrefix = e != null && e.customStoragePrefix ? `:${e.customStoragePrefix}` : ""; + const n = Vd({ level: typeof e?.logger == "string" && e.logger ? e.logger : BU.logger }), { logger: i, chunkLoggerController: s } = ak({ opts: n, maxSizeInBytes: e?.maxLogBlobSizeInBytes, loggerOverride: e?.logger }); + this.logChunkController = s, (r = this.logChunkController) != null && r.downloadLogsBlobInBrowser && (window.downloadLogsBlobInBrowser = async () => { + var o, a; + (o = this.logChunkController) != null && o.downloadLogsBlobInBrowser && ((a = this.logChunkController) == null || a.downloadLogsBlobInBrowser({ clientId: await this.crypto.getClientId() })); + }), this.logger = ri(i, this.name), this.heartbeat = new hL(), this.crypto = new zz(this, this.logger, e?.keychain), this.history = new aH(this, this.logger), this.expirer = new cH(this, this.logger), this.storage = e != null && e.storage ? e.storage : new HL(K3(K3({}, FU), e?.storageOptions)), this.relayer = new rH({ core: this, logger: this.logger, relayUrl: this.relayUrl, projectId: this.projectId }), this.pairing = new oH(this, this.logger), this.verify = new uH(this, this.logger, this.storage), this.echoClient = new fH(this.projectId || "", this.logger), this.linkModeSupportedApps = [], this.eventClient = new pH(this, this.logger, e?.telemetryEnabled); + } + static async init(e) { + const r = new C1(e); + await r.initialize(); + const n = await r.crypto.getClientId(); + return await r.storage.setItem(QU, n), r; + } + get context() { + return mi(this.logger); + } + async start() { + this.initialized || await this.initialize(); + } + async getLogsBlob() { + var e; + return (e = this.logChunkController) == null ? void 0 : e.logsToBlob({ clientId: await this.crypto.getClientId() }); + } + async addLinkModeSupportedApp(e) { + this.linkModeSupportedApps.includes(e) || (this.linkModeSupportedApps.push(e), await this.storage.setItem(M3, this.linkModeSupportedApps)); + } + async initialize() { + this.logger.trace("Initialized"); + try { + await this.crypto.init(), await this.history.init(), await this.expirer.init(), await this.relayer.init(), await this.heartbeat.init(), await this.pairing.init(), this.eventClient.init(), this.linkModeSupportedApps = await this.storage.getItem(M3) || [], this.initialized = !0, this.logger.info("Core Initialization Success"); + } catch (e) { + throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`, e), this.logger.error(e.message), e; + } + } +} +const bH = C1, aE = "wc", cE = 2, uE = "client", R1 = `${aE}@${cE}:${uE}:`, Zg = { name: uE, logger: "error" }, V3 = "WALLETCONNECT_DEEPLINK_CHOICE", yH = "proposal", fE = "Proposal expired", wH = "session", gc = bt.SEVEN_DAYS, xH = "engine", Pn = { wc_sessionPropose: { req: { ttl: bt.FIVE_MINUTES, prompt: !0, tag: 1100 }, res: { ttl: bt.FIVE_MINUTES, prompt: !1, tag: 1101 }, reject: { ttl: bt.FIVE_MINUTES, prompt: !1, tag: 1120 }, autoReject: { ttl: bt.FIVE_MINUTES, prompt: !1, tag: 1121 } }, wc_sessionSettle: { req: { ttl: bt.FIVE_MINUTES, prompt: !1, tag: 1102 }, res: { ttl: bt.FIVE_MINUTES, prompt: !1, tag: 1103 } }, wc_sessionUpdate: { req: { ttl: bt.ONE_DAY, prompt: !1, tag: 1104 }, res: { ttl: bt.ONE_DAY, prompt: !1, tag: 1105 } }, wc_sessionExtend: { req: { ttl: bt.ONE_DAY, prompt: !1, tag: 1106 }, res: { ttl: bt.ONE_DAY, prompt: !1, tag: 1107 } }, wc_sessionRequest: { req: { ttl: bt.FIVE_MINUTES, prompt: !0, tag: 1108 }, res: { ttl: bt.FIVE_MINUTES, prompt: !1, tag: 1109 } }, wc_sessionEvent: { req: { ttl: bt.FIVE_MINUTES, prompt: !0, tag: 1110 }, res: { ttl: bt.FIVE_MINUTES, prompt: !1, tag: 1111 } }, wc_sessionDelete: { req: { ttl: bt.ONE_DAY, prompt: !1, tag: 1112 }, res: { ttl: bt.ONE_DAY, prompt: !1, tag: 1113 } }, wc_sessionPing: { req: { ttl: bt.ONE_DAY, prompt: !1, tag: 1114 }, res: { ttl: bt.ONE_DAY, prompt: !1, tag: 1115 } }, wc_sessionAuthenticate: { req: { ttl: bt.ONE_HOUR, prompt: !0, tag: 1116 }, res: { ttl: bt.ONE_HOUR, prompt: !1, tag: 1117 }, reject: { ttl: bt.FIVE_MINUTES, prompt: !1, tag: 1118 }, autoReject: { ttl: bt.FIVE_MINUTES, prompt: !1, tag: 1119 } } }, Qg = { min: bt.FIVE_MINUTES, max: bt.SEVEN_DAYS }, _s = { idle: "IDLE", active: "ACTIVE" }, _H = "request", EH = ["wc_sessionPropose", "wc_sessionRequest", "wc_authRequest", "wc_sessionAuthenticate"], SH = "wc", AH = "auth", PH = "authKeys", MH = "pairingTopics", IH = "requests", o0 = `${SH}@${1.5}:${AH}:`, Kh = `${o0}:PUB_KEY`; +var CH = Object.defineProperty, RH = Object.defineProperties, TH = Object.getOwnPropertyDescriptors, G3 = Object.getOwnPropertySymbols, DH = Object.prototype.hasOwnProperty, OH = Object.prototype.propertyIsEnumerable, Y3 = (t, e, r) => e in t ? CH(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, tn = (t, e) => { + for (var r in e || (e = {})) DH.call(e, r) && Y3(t, r, e[r]); + if (G3) for (var r of G3(e)) OH.call(e, r) && Y3(t, r, e[r]); + return t; +}, ss = (t, e) => RH(t, TH(e)); +class NH extends wk { + constructor(e) { + super(e), this.name = xH, this.events = new l1(), this.initialized = !1, this.requestQueue = { state: _s.idle, queue: [] }, this.sessionRequestQueue = { state: _s.idle, queue: [] }, this.requestQueueDelay = bt.ONE_SECOND, this.expectedPairingMethodMap = /* @__PURE__ */ new Map(), this.recentlyDeletedMap = /* @__PURE__ */ new Map(), this.recentlyDeletedLimit = 200, this.relayMessageCache = [], this.init = async () => { + this.initialized || (await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.registerPairingEvents(), await this.registerLinkModeListeners(), this.client.core.pairing.register({ methods: Object.keys(Pn) }), this.initialized = !0, setTimeout(() => { + this.sessionRequestQueue.queue = this.getPendingSessionRequests(), this.processSessionRequestQueue(); + }, bt.toMiliseconds(this.requestQueueDelay))); + }, this.connect = async (r) => { + this.isInitialized(), await this.confirmOnlineStateOrThrow(); + const n = ss(tn({}, r), { requiredNamespaces: r.requiredNamespaces || {}, optionalNamespaces: r.optionalNamespaces || {} }); + await this.isValidConnect(n); + const { pairingTopic: i, requiredNamespaces: s, optionalNamespaces: o, sessionProperties: a, relays: f } = n; + let u = i, h, g = !1; + try { + u && (g = this.client.core.pairing.pairings.get(u).active); + } catch (k) { + throw this.client.logger.error(`connect() -> pairing.get(${u}) failed`), k; + } + if (!u || !g) { + const { topic: k, uri: B } = await this.client.core.pairing.create(); + u = k, h = B; + } + if (!u) { + const { message: k } = ft("NO_MATCHING_KEY", `connect() pairing topic: ${u}`); + throw new Error(k); + } + const v = await this.client.core.crypto.generateKeyPair(), x = Pn.wc_sessionPropose.req.ttl || bt.FIVE_MINUTES, S = _n(x), C = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: f ?? [{ protocol: G8 }], proposer: { publicKey: v, metadata: this.client.metadata }, expiryTimestamp: S, pairingTopic: u }, a && { sessionProperties: a }), { reject: D, resolve: $, done: N } = ba(x, fE); + this.events.once(wr("session_connect"), async ({ error: k, session: B }) => { + if (k) D(k); + else if (B) { + B.self.publicKey = v; + const U = ss(tn({}, B), { pairingTopic: C.pairingTopic, requiredNamespaces: C.requiredNamespaces, optionalNamespaces: C.optionalNamespaces, transportType: Wr.relay }); + await this.client.session.set(B.topic, U), await this.setExpiry(B.topic, B.expiry), u && await this.client.core.pairing.updateMetadata({ topic: u, metadata: B.peer.metadata }), this.cleanupDuplicatePairings(U), $(U); + } + }); + const z = await this.sendRequest({ topic: u, method: "wc_sessionPropose", params: C, throwOnFailedPublish: !0 }); + return await this.setProposal(z, tn({ id: z }, C)), { uri: h, approval: N }; + }, this.pair = async (r) => { + this.isInitialized(), await this.confirmOnlineStateOrThrow(); + try { + return await this.client.core.pairing.pair(r); + } catch (n) { + throw this.client.logger.error("pair() failed"), n; + } + }, this.approve = async (r) => { + var n, i, s; + const o = this.client.core.eventClient.createEvent({ properties: { topic: (n = r?.id) == null ? void 0 : n.toString(), trace: [is.session_approve_started] } }); + try { + this.isInitialized(), await this.confirmOnlineStateOrThrow(); + } catch (W) { + throw o.setError(ga.no_internet_connection), W; + } + try { + await this.isValidProposalId(r?.id); + } catch (W) { + throw this.client.logger.error(`approve() -> proposal.get(${r?.id}) failed`), o.setError(ga.proposal_not_found), W; + } + try { + await this.isValidApprove(r); + } catch (W) { + throw this.client.logger.error("approve() -> isValidApprove() failed"), o.setError(ga.session_approve_namespace_validation_failure), W; + } + const { id: a, relayProtocol: f, namespaces: u, sessionProperties: h, sessionConfig: g } = r, v = this.client.proposal.get(a); + this.client.core.eventClient.deleteEvent({ eventId: o.eventId }); + const { pairingTopic: x, proposer: S, requiredNamespaces: C, optionalNamespaces: D } = v; + let $ = (i = this.client.core.eventClient) == null ? void 0 : i.getEvent({ topic: x }); + $ || ($ = (s = this.client.core.eventClient) == null ? void 0 : s.createEvent({ type: is.session_approve_started, properties: { topic: x, trace: [is.session_approve_started, is.session_namespaces_validation_success] } })); + const N = await this.client.core.crypto.generateKeyPair(), z = S.publicKey, k = await this.client.core.crypto.generateSharedKey(N, z), B = tn(tn({ relay: { protocol: f ?? "irn" }, namespaces: u, controller: { publicKey: N, metadata: this.client.metadata }, expiry: _n(gc) }, h && { sessionProperties: h }), g && { sessionConfig: g }), U = Wr.relay; + $.addTrace(is.subscribing_session_topic); + try { + await this.client.core.relayer.subscribe(k, { transportType: U }); + } catch (W) { + throw $.setError(ga.subscribe_session_topic_failure), W; + } + $.addTrace(is.subscribe_session_topic_success); + const R = ss(tn({}, B), { topic: k, requiredNamespaces: C, optionalNamespaces: D, pairingTopic: x, acknowledged: !1, self: B.controller, peer: { publicKey: S.publicKey, metadata: S.metadata }, controller: N, transportType: Wr.relay }); + await this.client.session.set(k, R), $.addTrace(is.store_session); + try { + $.addTrace(is.publishing_session_settle), await this.sendRequest({ topic: k, method: "wc_sessionSettle", params: B, throwOnFailedPublish: !0 }).catch((W) => { + throw $?.setError(ga.session_settle_publish_failure), W; + }), $.addTrace(is.session_settle_publish_success), $.addTrace(is.publishing_session_approve), await this.sendResult({ id: a, topic: x, result: { relay: { protocol: f ?? "irn" }, responderPublicKey: N }, throwOnFailedPublish: !0 }).catch((W) => { + throw $?.setError(ga.session_approve_publish_failure), W; + }), $.addTrace(is.session_approve_publish_success); + } catch (W) { + throw this.client.logger.error(W), this.client.session.delete(k, Nr("USER_DISCONNECTED")), await this.client.core.relayer.unsubscribe(k), W; + } + return this.client.core.eventClient.deleteEvent({ eventId: $.eventId }), await this.client.core.pairing.updateMetadata({ topic: x, metadata: S.metadata }), await this.client.proposal.delete(a, Nr("USER_DISCONNECTED")), await this.client.core.pairing.activate({ topic: x }), await this.setExpiry(k, _n(gc)), { topic: k, acknowledged: () => Promise.resolve(this.client.session.get(k)) }; + }, this.reject = async (r) => { + this.isInitialized(), await this.confirmOnlineStateOrThrow(); + try { + await this.isValidReject(r); + } catch (o) { + throw this.client.logger.error("reject() -> isValidReject() failed"), o; + } + const { id: n, reason: i } = r; + let s; + try { + s = this.client.proposal.get(n).pairingTopic; + } catch (o) { + throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`), o; + } + s && (await this.sendError({ id: n, topic: s, error: i, rpcOpts: Pn.wc_sessionPropose.reject }), await this.client.proposal.delete(n, Nr("USER_DISCONNECTED"))); + }, this.update = async (r) => { + this.isInitialized(), await this.confirmOnlineStateOrThrow(); + try { + await this.isValidUpdate(r); + } catch (g) { + throw this.client.logger.error("update() -> isValidUpdate() failed"), g; + } + const { topic: n, namespaces: i } = r, { done: s, resolve: o, reject: a } = ba(), f = No(), u = Ma().toString(), h = this.client.session.get(n).namespaces; + return this.events.once(wr("session_update", f), ({ error: g }) => { + g ? a(g) : o(); + }), await this.client.session.update(n, { namespaces: i }), await this.sendRequest({ topic: n, method: "wc_sessionUpdate", params: { namespaces: i }, throwOnFailedPublish: !0, clientRpcId: f, relayRpcId: u }).catch((g) => { + this.client.logger.error(g), this.client.session.update(n, { namespaces: h }), a(g); + }), { acknowledged: s }; + }, this.extend = async (r) => { + this.isInitialized(), await this.confirmOnlineStateOrThrow(); + try { + await this.isValidExtend(r); + } catch (f) { + throw this.client.logger.error("extend() -> isValidExtend() failed"), f; + } + const { topic: n } = r, i = No(), { done: s, resolve: o, reject: a } = ba(); + return this.events.once(wr("session_extend", i), ({ error: f }) => { + f ? a(f) : o(); + }), await this.setExpiry(n, _n(gc)), this.sendRequest({ topic: n, method: "wc_sessionExtend", params: {}, clientRpcId: i, throwOnFailedPublish: !0 }).catch((f) => { + a(f); + }), { acknowledged: s }; + }, this.request = async (r) => { + this.isInitialized(); + try { + await this.isValidRequest(r); + } catch (S) { + throw this.client.logger.error("request() -> isValidRequest() failed"), S; + } + const { chainId: n, request: i, topic: s, expiry: o = Pn.wc_sessionRequest.req.ttl } = r, a = this.client.session.get(s); + a?.transportType === Wr.relay && await this.confirmOnlineStateOrThrow(); + const f = No(), u = Ma().toString(), { done: h, resolve: g, reject: v } = ba(o, "Request expired. Please try again."); + this.events.once(wr("session_request", f), ({ error: S, result: C }) => { + S ? v(S) : g(C); + }); + const x = this.getAppLinkIfEnabled(a.peer.metadata, a.transportType); + return x ? (await this.sendRequest({ clientRpcId: f, relayRpcId: u, topic: s, method: "wc_sessionRequest", params: { request: ss(tn({}, i), { expiryTimestamp: _n(o) }), chainId: n }, expiry: o, throwOnFailedPublish: !0, appLink: x }).catch((S) => v(S)), this.client.events.emit("session_request_sent", { topic: s, request: i, chainId: n, id: f }), await h()) : await Promise.all([new Promise(async (S) => { + await this.sendRequest({ clientRpcId: f, relayRpcId: u, topic: s, method: "wc_sessionRequest", params: { request: ss(tn({}, i), { expiryTimestamp: _n(o) }), chainId: n }, expiry: o, throwOnFailedPublish: !0 }).catch((C) => v(C)), this.client.events.emit("session_request_sent", { topic: s, request: i, chainId: n, id: f }), S(); + }), new Promise(async (S) => { + var C; + if (!((C = a.sessionConfig) != null && C.disableDeepLink)) { + const D = await $F(this.client.core.storage, V3); + await LF({ id: f, topic: s, wcDeepLink: D }); + } + S(); + }), h()]).then((S) => S[2]); + }, this.respond = async (r) => { + this.isInitialized(), await this.isValidRespond(r); + const { topic: n, response: i } = r, { id: s } = i, o = this.client.session.get(n); + o.transportType === Wr.relay && await this.confirmOnlineStateOrThrow(); + const a = this.getAppLinkIfEnabled(o.peer.metadata, o.transportType); + Ps(i) ? await this.sendResult({ id: s, topic: n, result: i.result, throwOnFailedPublish: !0, appLink: a }) : qi(i) && await this.sendError({ id: s, topic: n, error: i.error, appLink: a }), this.cleanupAfterResponse(r); + }, this.ping = async (r) => { + this.isInitialized(), await this.confirmOnlineStateOrThrow(); + try { + await this.isValidPing(r); + } catch (i) { + throw this.client.logger.error("ping() -> isValidPing() failed"), i; + } + const { topic: n } = r; + if (this.client.session.keys.includes(n)) { + const i = No(), s = Ma().toString(), { done: o, resolve: a, reject: f } = ba(); + this.events.once(wr("session_ping", i), ({ error: u }) => { + u ? f(u) : a(); + }), await Promise.all([this.sendRequest({ topic: n, method: "wc_sessionPing", params: {}, throwOnFailedPublish: !0, clientRpcId: i, relayRpcId: s }), o()]); + } else this.client.core.pairing.pairings.keys.includes(n) && await this.client.core.pairing.ping({ topic: n }); + }, this.emit = async (r) => { + this.isInitialized(), await this.confirmOnlineStateOrThrow(), await this.isValidEmit(r); + const { topic: n, event: i, chainId: s } = r, o = Ma().toString(); + await this.sendRequest({ topic: n, method: "wc_sessionEvent", params: { event: i, chainId: s }, throwOnFailedPublish: !0, relayRpcId: o }); + }, this.disconnect = async (r) => { + this.isInitialized(), await this.confirmOnlineStateOrThrow(), await this.isValidDisconnect(r); + const { topic: n } = r; + if (this.client.session.keys.includes(n)) await this.sendRequest({ topic: n, method: "wc_sessionDelete", params: Nr("USER_DISCONNECTED"), throwOnFailedPublish: !0 }), await this.deleteSession({ topic: n, emitEvent: !1 }); + else if (this.client.core.pairing.pairings.keys.includes(n)) await this.client.core.pairing.disconnect({ topic: n }); + else { + const { message: i } = ft("MISMATCHED_TOPIC", `Session or pairing topic not found: ${n}`); + throw new Error(i); + } + }, this.find = (r) => (this.isInitialized(), this.client.session.getAll().filter((n) => $j(n, r))), this.getPendingSessionRequests = () => this.client.pendingRequest.getAll(), this.authenticate = async (r, n) => { + var i; + this.isInitialized(), this.isValidAuthenticate(r); + const s = n && this.client.core.linkModeSupportedApps.includes(n) && ((i = this.client.metadata.redirect) == null ? void 0 : i.linkMode), o = s ? Wr.link_mode : Wr.relay; + o === Wr.relay && await this.confirmOnlineStateOrThrow(); + const { chains: a, statement: f = "", uri: u, domain: h, nonce: g, type: v, exp: x, nbf: S, methods: C = [], expiry: D } = r, $ = [...r.resources || []], { topic: N, uri: z } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); + this.client.logger.info({ message: "Generated new pairing", pairing: { topic: N, uri: z } }); + const k = await this.client.core.crypto.generateKeyPair(), B = Wh(k); + if (await Promise.all([this.client.auth.authKeys.set(Kh, { responseTopic: B, publicKey: k }), this.client.auth.pairingTopics.set(B, { topic: B, pairingTopic: N })]), await this.client.core.relayer.subscribe(B, { transportType: o }), this.client.logger.info(`sending request to new pairing topic: ${N}`), C.length > 0) { + const { namespace: P } = Nc(a[0]); + let _ = ij(P, "request", C); + Hh($) && (_ = oj(_, $.pop())), $.push(_); + } + const U = D && D > Pn.wc_sessionAuthenticate.req.ttl ? D : Pn.wc_sessionAuthenticate.req.ttl, R = { authPayload: { type: v ?? "caip122", chains: a, statement: f, aud: u, domain: h, version: "1", nonce: g, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: x, nbf: S, resources: $ }, requester: { publicKey: k, metadata: this.client.metadata }, expiryTimestamp: _n(U) }, W = { eip155: { chains: a, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...C])], events: ["chainChanged", "accountsChanged"] } }, J = { requiredNamespaces: {}, optionalNamespaces: W, relays: [{ protocol: "irn" }], pairingTopic: N, proposer: { publicKey: k, metadata: this.client.metadata }, expiryTimestamp: _n(Pn.wc_sessionPropose.req.ttl) }, { done: ne, resolve: K, reject: E } = ba(U, "Request expired"), b = async ({ error: P, session: _ }) => { + if (this.events.off(wr("session_request", p), l), P) E(P); + else if (_) { + _.self.publicKey = k, await this.client.session.set(_.topic, _), await this.setExpiry(_.topic, _.expiry), N && await this.client.core.pairing.updateMetadata({ topic: N, metadata: _.peer.metadata }); + const y = this.client.session.get(_.topic); + await this.deleteProposal(m), K({ session: y }); + } + }, l = async (P) => { + var _, y, M; + if (await this.deletePendingAuthRequest(p, { message: "fulfilled", code: 0 }), P.error) { + const X = Nr("WC_METHOD_UNSUPPORTED", "wc_sessionAuthenticate"); + return P.error.code === X.code ? void 0 : (this.events.off(wr("session_connect"), b), E(P.error.message)); + } + await this.deleteProposal(m), this.events.off(wr("session_connect"), b); + const { cacaos: I, responder: q } = P.result, ce = [], L = []; + for (const X of I) { + await e3({ cacao: X, projectId: this.client.core.projectId }) || (this.client.logger.error(X, "Signature verification failed"), E(Nr("SESSION_SETTLEMENT_FAILED", "Signature verification failed"))); + const { p: ee } = X, O = Hh(ee.resources), Z = [iv(ee.iss)], re = _d(ee.iss); + if (O) { + const he = t3(O), ae = r3(O); + ce.push(...he), Z.push(...ae); + } + for (const he of Z) L.push(`${he}:${re}`); + } + const oe = await this.client.core.crypto.generateSharedKey(k, q.publicKey); + let Q; + ce.length > 0 && (Q = { topic: oe, acknowledged: !0, self: { publicKey: k, metadata: this.client.metadata }, peer: q, controller: q.publicKey, expiry: _n(gc), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: N, namespaces: l3([...new Set(ce)], [...new Set(L)]), transportType: o }, await this.client.core.relayer.subscribe(oe, { transportType: o }), await this.client.session.set(oe, Q), N && await this.client.core.pairing.updateMetadata({ topic: N, metadata: q.metadata }), Q = this.client.session.get(oe)), (_ = this.client.metadata.redirect) != null && _.linkMode && (y = q.metadata.redirect) != null && y.linkMode && (M = q.metadata.redirect) != null && M.universal && n && (this.client.core.addLinkModeSupportedApp(q.metadata.redirect.universal), this.client.session.update(oe, { transportType: Wr.link_mode })), K({ auths: I, session: Q }); + }, p = No(), m = No(); + this.events.once(wr("session_connect"), b), this.events.once(wr("session_request", p), l); + let w; + try { + if (s) { + const P = $o("wc_sessionAuthenticate", R, p); + this.client.core.history.set(N, P); + const _ = await this.client.core.crypto.encode("", P, { type: al, encoding: Ou }); + w = Eh(n, N, _); + } else await Promise.all([this.sendRequest({ topic: N, method: "wc_sessionAuthenticate", params: R, expiry: r.expiry, throwOnFailedPublish: !0, clientRpcId: p }), this.sendRequest({ topic: N, method: "wc_sessionPropose", params: J, expiry: Pn.wc_sessionPropose.req.ttl, throwOnFailedPublish: !0, clientRpcId: m })]); + } catch (P) { + throw this.events.off(wr("session_connect"), b), this.events.off(wr("session_request", p), l), P; + } + return await this.setProposal(m, tn({ id: m }, J)), await this.setAuthRequest(p, { request: ss(tn({}, R), { verifyContext: {} }), pairingTopic: N, transportType: o }), { uri: w ?? z, response: ne }; + }, this.approveSessionAuthenticate = async (r) => { + const { id: n, auths: i } = r, s = this.client.core.eventClient.createEvent({ properties: { topic: n.toString(), trace: [ma.authenticated_session_approve_started] } }); + try { + this.isInitialized(); + } catch (D) { + throw s.setError(ku.no_internet_connection), D; + } + const o = this.getPendingAuthRequest(n); + if (!o) throw s.setError(ku.authenticated_session_pending_request_not_found), new Error(`Could not find pending auth request with id ${n}`); + const a = o.transportType || Wr.relay; + a === Wr.relay && await this.confirmOnlineStateOrThrow(); + const f = o.requester.publicKey, u = await this.client.core.crypto.generateKeyPair(), h = Wh(f), g = { type: so, receiverPublicKey: f, senderPublicKey: u }, v = [], x = []; + for (const D of i) { + if (!await e3({ cacao: D, projectId: this.client.core.projectId })) { + s.setError(ku.invalid_cacao); + const B = Nr("SESSION_SETTLEMENT_FAILED", "Signature verification failed"); + throw await this.sendError({ id: n, topic: h, error: B, encodeOpts: g }), new Error(B.message); + } + s.addTrace(ma.cacaos_verified); + const { p: $ } = D, N = Hh($.resources), z = [iv($.iss)], k = _d($.iss); + if (N) { + const B = t3(N), U = r3(N); + v.push(...B), z.push(...U); + } + for (const B of z) x.push(`${B}:${k}`); + } + const S = await this.client.core.crypto.generateSharedKey(u, f); + s.addTrace(ma.create_authenticated_session_topic); + let C; + if (v?.length > 0) { + C = { topic: S, acknowledged: !0, self: { publicKey: u, metadata: this.client.metadata }, peer: { publicKey: f, metadata: o.requester.metadata }, controller: f, expiry: _n(gc), authentication: i, requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: o.pairingTopic, namespaces: l3([...new Set(v)], [...new Set(x)]), transportType: a }, s.addTrace(ma.subscribing_authenticated_session_topic); + try { + await this.client.core.relayer.subscribe(S, { transportType: a }); + } catch (D) { + throw s.setError(ku.subscribe_authenticated_session_topic_failure), D; + } + s.addTrace(ma.subscribe_authenticated_session_topic_success), await this.client.session.set(S, C), s.addTrace(ma.store_authenticated_session), await this.client.core.pairing.updateMetadata({ topic: o.pairingTopic, metadata: o.requester.metadata }); + } + s.addTrace(ma.publishing_authenticated_session_approve); + try { + await this.sendResult({ topic: h, id: n, result: { cacaos: i, responder: { publicKey: u, metadata: this.client.metadata } }, encodeOpts: g, throwOnFailedPublish: !0, appLink: this.getAppLinkIfEnabled(o.requester.metadata, a) }); + } catch (D) { + throw s.setError(ku.authenticated_session_approve_publish_failure), D; + } + return await this.client.auth.requests.delete(n, { message: "fulfilled", code: 0 }), await this.client.core.pairing.activate({ topic: o.pairingTopic }), this.client.core.eventClient.deleteEvent({ eventId: s.eventId }), { session: C }; + }, this.rejectSessionAuthenticate = async (r) => { + this.isInitialized(); + const { id: n, reason: i } = r, s = this.getPendingAuthRequest(n); + if (!s) throw new Error(`Could not find pending auth request with id ${n}`); + s.transportType === Wr.relay && await this.confirmOnlineStateOrThrow(); + const o = s.requester.publicKey, a = await this.client.core.crypto.generateKeyPair(), f = Wh(o), u = { type: so, receiverPublicKey: o, senderPublicKey: a }; + await this.sendError({ id: n, topic: f, error: i, encodeOpts: u, rpcOpts: Pn.wc_sessionAuthenticate.reject, appLink: this.getAppLinkIfEnabled(s.requester.metadata, s.transportType) }), await this.client.auth.requests.delete(n, { message: "rejected", code: 0 }), await this.client.proposal.delete(n, Nr("USER_DISCONNECTED")); + }, this.formatAuthMessage = (r) => { + this.isInitialized(); + const { request: n, iss: i } = r; + return T8(n, i); + }, this.processRelayMessageCache = () => { + setTimeout(async () => { + if (this.relayMessageCache.length !== 0) for (; this.relayMessageCache.length > 0; ) try { + const r = this.relayMessageCache.shift(); + r && await this.onRelayMessage(r); + } catch (r) { + this.client.logger.error(r); + } + }, 50); + }, this.cleanupDuplicatePairings = async (r) => { + if (r.pairingTopic) try { + const n = this.client.core.pairing.pairings.get(r.pairingTopic), i = this.client.core.pairing.pairings.getAll().filter((s) => { + var o, a; + return ((o = s.peerMetadata) == null ? void 0 : o.url) && ((a = s.peerMetadata) == null ? void 0 : a.url) === r.peer.metadata.url && s.topic && s.topic !== n.topic; + }); + if (i.length === 0) return; + this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`), await Promise.all(i.map((s) => this.client.core.pairing.disconnect({ topic: s.topic }))), this.client.logger.info("Duplicate pairings clean up finished"); + } catch (n) { + this.client.logger.error(n); + } + }, this.deleteSession = async (r) => { + var n; + const { topic: i, expirerHasDeleted: s = !1, emitEvent: o = !0, id: a = 0 } = r, { self: f } = this.client.session.get(i); + await this.client.core.relayer.unsubscribe(i), await this.client.session.delete(i, Nr("USER_DISCONNECTED")), this.addToRecentlyDeleted(i, "session"), this.client.core.crypto.keychain.has(f.publicKey) && await this.client.core.crypto.deleteKeyPair(f.publicKey), this.client.core.crypto.keychain.has(i) && await this.client.core.crypto.deleteSymKey(i), s || this.client.core.expirer.del(i), this.client.core.storage.removeItem(V3).catch((u) => this.client.logger.warn(u)), this.getPendingSessionRequests().forEach((u) => { + u.topic === i && this.deletePendingSessionRequest(u.id, Nr("USER_DISCONNECTED")); + }), i === ((n = this.sessionRequestQueue.queue[0]) == null ? void 0 : n.topic) && (this.sessionRequestQueue.state = _s.idle), o && this.client.events.emit("session_delete", { id: a, topic: i }); + }, this.deleteProposal = async (r, n) => { + if (n) try { + const i = this.client.proposal.get(r); + this.client.core.eventClient.getEvent({ topic: i.pairingTopic })?.setError(ga.proposal_expired); + } catch { + } + await Promise.all([this.client.proposal.delete(r, Nr("USER_DISCONNECTED")), n ? Promise.resolve() : this.client.core.expirer.del(r)]), this.addToRecentlyDeleted(r, "proposal"); + }, this.deletePendingSessionRequest = async (r, n, i = !1) => { + await Promise.all([this.client.pendingRequest.delete(r, n), i ? Promise.resolve() : this.client.core.expirer.del(r)]), this.addToRecentlyDeleted(r, "request"), this.sessionRequestQueue.queue = this.sessionRequestQueue.queue.filter((s) => s.id !== r), i && (this.sessionRequestQueue.state = _s.idle, this.client.events.emit("session_request_expire", { id: r })); + }, this.deletePendingAuthRequest = async (r, n, i = !1) => { + await Promise.all([this.client.auth.requests.delete(r, n), i ? Promise.resolve() : this.client.core.expirer.del(r)]); + }, this.setExpiry = async (r, n) => { + this.client.session.keys.includes(r) && (this.client.core.expirer.set(r, n), await this.client.session.update(r, { expiry: n })); + }, this.setProposal = async (r, n) => { + this.client.core.expirer.set(r, _n(Pn.wc_sessionPropose.req.ttl)), await this.client.proposal.set(r, n); + }, this.setAuthRequest = async (r, n) => { + const { request: i, pairingTopic: s, transportType: o = Wr.relay } = n; + this.client.core.expirer.set(r, i.expiryTimestamp), await this.client.auth.requests.set(r, { authPayload: i.authPayload, requester: i.requester, expiryTimestamp: i.expiryTimestamp, id: r, pairingTopic: s, verifyContext: i.verifyContext, transportType: o }); + }, this.setPendingSessionRequest = async (r) => { + const { id: n, topic: i, params: s, verifyContext: o } = r, a = s.request.expiryTimestamp || _n(Pn.wc_sessionRequest.req.ttl); + this.client.core.expirer.set(n, a), await this.client.pendingRequest.set(n, { id: n, topic: i, params: s, verifyContext: o }); + }, this.sendRequest = async (r) => { + const { topic: n, method: i, params: s, expiry: o, relayRpcId: a, clientRpcId: f, throwOnFailedPublish: u, appLink: h } = r, g = $o(i, s, f); + let v; + const x = !!h; + try { + const D = x ? Ou : ko; + v = await this.client.core.crypto.encode(n, g, { encoding: D }); + } catch (D) { + throw await this.cleanup(), this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`), D; + } + let S; + if (EH.includes(i)) { + const D = Qs(JSON.stringify(g)), $ = Qs(v); + S = await this.client.core.verify.register({ id: $, decryptedId: D }); + } + const C = Pn[i].req; + if (C.attestation = S, o && (C.ttl = o), a && (C.id = a), this.client.core.history.set(n, g), x) { + const D = Eh(h, n, v); + await global.Linking.openURL(D, this.client.name); + } else { + const D = Pn[i].req; + o && (D.ttl = o), a && (D.id = a), u ? (D.internal = ss(tn({}, D.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(n, v, D)) : this.client.core.relayer.publish(n, v, D).catch(($) => this.client.logger.error($)); + } + return g.id; + }, this.sendResult = async (r) => { + const { id: n, topic: i, result: s, throwOnFailedPublish: o, encodeOpts: a, appLink: f } = r, u = r0(n, s); + let h; + const g = f && typeof (global == null ? void 0 : global.Linking) < "u"; + try { + const x = g ? Ou : ko; + h = await this.client.core.crypto.encode(i, u, ss(tn({}, a || {}), { encoding: x })); + } catch (x) { + throw await this.cleanup(), this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`), x; + } + let v; + try { + v = await this.client.core.history.get(i, n); + } catch (x) { + throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`), x; + } + if (g) { + const x = Eh(f, i, h); + await global.Linking.openURL(x, this.client.name); + } else { + const x = Pn[v.request.method].res; + o ? (x.internal = ss(tn({}, x.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(i, h, x)) : this.client.core.relayer.publish(i, h, x).catch((S) => this.client.logger.error(S)); + } + await this.client.core.history.resolve(u); + }, this.sendError = async (r) => { + const { id: n, topic: i, error: s, encodeOpts: o, rpcOpts: a, appLink: f } = r, u = n0(n, s); + let h; + const g = f && typeof (global == null ? void 0 : global.Linking) < "u"; + try { + const x = g ? Ou : ko; + h = await this.client.core.crypto.encode(i, u, ss(tn({}, o || {}), { encoding: x })); + } catch (x) { + throw await this.cleanup(), this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`), x; + } + let v; + try { + v = await this.client.core.history.get(i, n); + } catch (x) { + throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`), x; + } + if (g) { + const x = Eh(f, i, h); + await global.Linking.openURL(x, this.client.name); + } else { + const x = a || Pn[v.request.method].res; + this.client.core.relayer.publish(i, h, x); + } + await this.client.core.history.resolve(u); + }, this.cleanup = async () => { + const r = [], n = []; + this.client.session.getAll().forEach((i) => { + let s = !1; + Oo(i.expiry) && (s = !0), this.client.core.crypto.keychain.has(i.topic) || (s = !0), s && r.push(i.topic); + }), this.client.proposal.getAll().forEach((i) => { + Oo(i.expiryTimestamp) && n.push(i.id); + }), await Promise.all([...r.map((i) => this.deleteSession({ topic: i })), ...n.map((i) => this.deleteProposal(i))]); + }, this.onRelayEventRequest = async (r) => { + this.requestQueue.queue.push(r), await this.processRequestsQueue(); + }, this.processRequestsQueue = async () => { + if (this.requestQueue.state === _s.active) { + this.client.logger.info("Request queue already active, skipping..."); + return; + } + for (this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`); this.requestQueue.queue.length > 0; ) { + this.requestQueue.state = _s.active; + const r = this.requestQueue.queue.shift(); + if (r) try { + await this.processRequest(r); + } catch (n) { + this.client.logger.warn(n); + } + } + this.requestQueue.state = _s.idle; + }, this.processRequest = async (r) => { + const { topic: n, payload: i, attestation: s, transportType: o, encryptedId: a } = r, f = i.method; + if (!this.shouldIgnorePairingRequest({ topic: n, requestMethod: f })) switch (f) { + case "wc_sessionPropose": + return await this.onSessionProposeRequest({ topic: n, payload: i, attestation: s, encryptedId: a }); + case "wc_sessionSettle": + return await this.onSessionSettleRequest(n, i); + case "wc_sessionUpdate": + return await this.onSessionUpdateRequest(n, i); + case "wc_sessionExtend": + return await this.onSessionExtendRequest(n, i); + case "wc_sessionPing": + return await this.onSessionPingRequest(n, i); + case "wc_sessionDelete": + return await this.onSessionDeleteRequest(n, i); + case "wc_sessionRequest": + return await this.onSessionRequest({ topic: n, payload: i, attestation: s, encryptedId: a, transportType: o }); + case "wc_sessionEvent": + return await this.onSessionEventRequest(n, i); + case "wc_sessionAuthenticate": + return await this.onSessionAuthenticateRequest({ topic: n, payload: i, attestation: s, encryptedId: a, transportType: o }); + default: + return this.client.logger.info(`Unsupported request method ${f}`); + } + }, this.onRelayEventResponse = async (r) => { + const { topic: n, payload: i, transportType: s } = r, o = (await this.client.core.history.get(n, i.id)).request.method; + switch (o) { + case "wc_sessionPropose": + return this.onSessionProposeResponse(n, i, s); + case "wc_sessionSettle": + return this.onSessionSettleResponse(n, i); + case "wc_sessionUpdate": + return this.onSessionUpdateResponse(n, i); + case "wc_sessionExtend": + return this.onSessionExtendResponse(n, i); + case "wc_sessionPing": + return this.onSessionPingResponse(n, i); + case "wc_sessionRequest": + return this.onSessionRequestResponse(n, i); + case "wc_sessionAuthenticate": + return this.onSessionAuthenticateResponse(n, i); + default: + return this.client.logger.info(`Unsupported response method ${o}`); + } + }, this.onRelayEventUnknownPayload = (r) => { + const { topic: n } = r, { message: i } = ft("MISSING_OR_INVALID", `Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`); + throw new Error(i); + }, this.shouldIgnorePairingRequest = (r) => { + const { topic: n, requestMethod: i } = r, s = this.expectedPairingMethodMap.get(n); + return !s || s.includes(i) ? !1 : !!(s.includes("wc_sessionAuthenticate") && this.client.events.listenerCount("session_authenticate") > 0); + }, this.onSessionProposeRequest = async (r) => { + const { topic: n, payload: i, attestation: s, encryptedId: o } = r, { params: a, id: f } = i; + try { + const u = this.client.core.eventClient.getEvent({ topic: n }); + this.isValidConnect(tn({}, i.params)); + const h = a.expiryTimestamp || _n(Pn.wc_sessionPropose.req.ttl), g = tn({ id: f, pairingTopic: n, expiryTimestamp: h }, a); + await this.setProposal(f, g); + const v = await this.getVerifyContext({ attestationId: s, hash: Qs(JSON.stringify(i)), encryptedId: o, metadata: g.proposer.metadata }); + this.client.events.listenerCount("session_proposal") === 0 && (console.warn("No listener for session_proposal event"), u?.setError(Zs.proposal_listener_not_found)), u?.addTrace(As.emit_session_proposal), this.client.events.emit("session_proposal", { id: f, params: g, verifyContext: v }); + } catch (u) { + await this.sendError({ id: f, topic: n, error: u, rpcOpts: Pn.wc_sessionPropose.autoReject }), this.client.logger.error(u); + } + }, this.onSessionProposeResponse = async (r, n, i) => { + const { id: s } = n; + if (Ps(n)) { + const { result: o } = n; + this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", result: o }); + const a = this.client.proposal.get(s); + this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", proposal: a }); + const f = a.proposer.publicKey; + this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", selfPublicKey: f }); + const u = o.responderPublicKey; + this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", peerPublicKey: u }); + const h = await this.client.core.crypto.generateSharedKey(f, u); + this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", sessionTopic: h }); + const g = await this.client.core.relayer.subscribe(h, { transportType: i }); + this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", subscriptionId: g }), await this.client.core.pairing.activate({ topic: r }); + } else if (qi(n)) { + await this.client.proposal.delete(s, Nr("USER_DISCONNECTED")); + const o = wr("session_connect"); + if (this.events.listenerCount(o) === 0) throw new Error(`emitting ${o} without any listeners, 954`); + this.events.emit(wr("session_connect"), { error: n.error }); + } + }, this.onSessionSettleRequest = async (r, n) => { + const { id: i, params: s } = n; + try { + this.isValidSessionSettleRequest(s); + const { relay: o, controller: a, expiry: f, namespaces: u, sessionProperties: h, sessionConfig: g } = n.params, v = ss(tn(tn({ topic: r, relay: o, expiry: f, namespaces: u, acknowledged: !0, pairingTopic: "", requiredNamespaces: {}, optionalNamespaces: {}, controller: a.publicKey, self: { publicKey: "", metadata: this.client.metadata }, peer: { publicKey: a.publicKey, metadata: a.metadata } }, h && { sessionProperties: h }), g && { sessionConfig: g }), { transportType: Wr.relay }), x = wr("session_connect"); + if (this.events.listenerCount(x) === 0) throw new Error(`emitting ${x} without any listeners 997`); + this.events.emit(wr("session_connect"), { session: v }), await this.sendResult({ id: n.id, topic: r, result: !0, throwOnFailedPublish: !0 }); + } catch (o) { + await this.sendError({ id: i, topic: r, error: o }), this.client.logger.error(o); + } + }, this.onSessionSettleResponse = async (r, n) => { + const { id: i } = n; + Ps(n) ? (await this.client.session.update(r, { acknowledged: !0 }), this.events.emit(wr("session_approve", i), {})) : qi(n) && (await this.client.session.delete(r, Nr("USER_DISCONNECTED")), this.events.emit(wr("session_approve", i), { error: n.error })); + }, this.onSessionUpdateRequest = async (r, n) => { + const { params: i, id: s } = n; + try { + const o = `${r}_session_update`, a = Nu.get(o); + if (a && this.isRequestOutOfSync(a, s)) { + this.client.logger.info(`Discarding out of sync request - ${s}`), this.sendError({ id: s, topic: r, error: Nr("INVALID_UPDATE_REQUEST") }); + return; + } + this.isValidUpdate(tn({ topic: r }, i)); + try { + Nu.set(o, s), await this.client.session.update(r, { namespaces: i.namespaces }), await this.sendResult({ id: s, topic: r, result: !0, throwOnFailedPublish: !0 }); + } catch (f) { + throw Nu.delete(o), f; + } + this.client.events.emit("session_update", { id: s, topic: r, params: i }); + } catch (o) { + await this.sendError({ id: s, topic: r, error: o }), this.client.logger.error(o); + } + }, this.isRequestOutOfSync = (r, n) => parseInt(n.toString().slice(0, -3)) <= parseInt(r.toString().slice(0, -3)), this.onSessionUpdateResponse = (r, n) => { + const { id: i } = n, s = wr("session_update", i); + if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); + Ps(n) ? this.events.emit(wr("session_update", i), {}) : qi(n) && this.events.emit(wr("session_update", i), { error: n.error }); + }, this.onSessionExtendRequest = async (r, n) => { + const { id: i } = n; + try { + this.isValidExtend({ topic: r }), await this.setExpiry(r, _n(gc)), await this.sendResult({ id: i, topic: r, result: !0, throwOnFailedPublish: !0 }), this.client.events.emit("session_extend", { id: i, topic: r }); + } catch (s) { + await this.sendError({ id: i, topic: r, error: s }), this.client.logger.error(s); + } + }, this.onSessionExtendResponse = (r, n) => { + const { id: i } = n, s = wr("session_extend", i); + if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); + Ps(n) ? this.events.emit(wr("session_extend", i), {}) : qi(n) && this.events.emit(wr("session_extend", i), { error: n.error }); + }, this.onSessionPingRequest = async (r, n) => { + const { id: i } = n; + try { + this.isValidPing({ topic: r }), await this.sendResult({ id: i, topic: r, result: !0, throwOnFailedPublish: !0 }), this.client.events.emit("session_ping", { id: i, topic: r }); + } catch (s) { + await this.sendError({ id: i, topic: r, error: s }), this.client.logger.error(s); + } + }, this.onSessionPingResponse = (r, n) => { + const { id: i } = n, s = wr("session_ping", i); + if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); + setTimeout(() => { + Ps(n) ? this.events.emit(wr("session_ping", i), {}) : qi(n) && this.events.emit(wr("session_ping", i), { error: n.error }); + }, 500); + }, this.onSessionDeleteRequest = async (r, n) => { + const { id: i } = n; + try { + this.isValidDisconnect({ topic: r, reason: n.params }), Promise.all([new Promise((s) => { + this.client.core.relayer.once(Qn.publish, async () => { + s(await this.deleteSession({ topic: r, id: i })); + }); + }), this.sendResult({ id: i, topic: r, result: !0, throwOnFailedPublish: !0 }), this.cleanupPendingSentRequestsForTopic({ topic: r, error: Nr("USER_DISCONNECTED") })]).catch((s) => this.client.logger.error(s)); + } catch (s) { + this.client.logger.error(s); + } + }, this.onSessionRequest = async (r) => { + var n, i, s; + const { topic: o, payload: a, attestation: f, encryptedId: u, transportType: h } = r, { id: g, params: v } = a; + try { + await this.isValidRequest(tn({ topic: o }, v)); + const x = this.client.session.get(o), S = await this.getVerifyContext({ attestationId: f, hash: Qs(JSON.stringify($o("wc_sessionRequest", v, g))), encryptedId: u, metadata: x.peer.metadata, transportType: h }), C = { id: g, topic: o, params: v, verifyContext: S }; + await this.setPendingSessionRequest(C), h === Wr.link_mode && (n = x.peer.metadata.redirect) != null && n.universal && this.client.core.addLinkModeSupportedApp((i = x.peer.metadata.redirect) == null ? void 0 : i.universal), (s = this.client.signConfig) != null && s.disableRequestQueue ? this.emitSessionRequest(C) : (this.addSessionRequestToSessionRequestQueue(C), this.processSessionRequestQueue()); + } catch (x) { + await this.sendError({ id: g, topic: o, error: x }), this.client.logger.error(x); + } + }, this.onSessionRequestResponse = (r, n) => { + const { id: i } = n, s = wr("session_request", i); + if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); + Ps(n) ? this.events.emit(wr("session_request", i), { result: n.result }) : qi(n) && this.events.emit(wr("session_request", i), { error: n.error }); + }, this.onSessionEventRequest = async (r, n) => { + const { id: i, params: s } = n; + try { + const o = `${r}_session_event_${s.event.name}`, a = Nu.get(o); + if (a && this.isRequestOutOfSync(a, i)) { + this.client.logger.info(`Discarding out of sync request - ${i}`); + return; + } + this.isValidEmit(tn({ topic: r }, s)), this.client.events.emit("session_event", { id: i, topic: r, params: s }), Nu.set(o, i); + } catch (o) { + await this.sendError({ id: i, topic: r, error: o }), this.client.logger.error(o); + } + }, this.onSessionAuthenticateResponse = (r, n) => { + const { id: i } = n; + this.client.logger.trace({ type: "method", method: "onSessionAuthenticateResponse", topic: r, payload: n }), Ps(n) ? this.events.emit(wr("session_request", i), { result: n.result }) : qi(n) && this.events.emit(wr("session_request", i), { error: n.error }); + }, this.onSessionAuthenticateRequest = async (r) => { + var n; + const { topic: i, payload: s, attestation: o, encryptedId: a, transportType: f } = r; + try { + const { requester: u, authPayload: h, expiryTimestamp: g } = s.params, v = await this.getVerifyContext({ attestationId: o, hash: Qs(JSON.stringify(s)), encryptedId: a, metadata: u.metadata, transportType: f }), x = { requester: u, pairingTopic: i, id: s.id, authPayload: h, verifyContext: v, expiryTimestamp: g }; + await this.setAuthRequest(s.id, { request: x, pairingTopic: i, transportType: f }), f === Wr.link_mode && (n = u.metadata.redirect) != null && n.universal && this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal), this.client.events.emit("session_authenticate", { topic: i, params: s.params, id: s.id, verifyContext: v }); + } catch (u) { + this.client.logger.error(u); + const h = s.params.requester.publicKey, g = await this.client.core.crypto.generateKeyPair(), v = this.getAppLinkIfEnabled(s.params.requester.metadata, f), x = { type: so, receiverPublicKey: h, senderPublicKey: g }; + await this.sendError({ id: s.id, topic: i, error: u, encodeOpts: x, rpcOpts: Pn.wc_sessionAuthenticate.autoReject, appLink: v }); + } + }, this.addSessionRequestToSessionRequestQueue = (r) => { + this.sessionRequestQueue.queue.push(r); + }, this.cleanupAfterResponse = (r) => { + this.deletePendingSessionRequest(r.response.id, { message: "fulfilled", code: 0 }), setTimeout(() => { + this.sessionRequestQueue.state = _s.idle, this.processSessionRequestQueue(); + }, bt.toMiliseconds(this.requestQueueDelay)); + }, this.cleanupPendingSentRequestsForTopic = ({ topic: r, error: n }) => { + const i = this.client.core.history.pending; + i.length > 0 && i.filter((s) => s.topic === r && s.request.method === "wc_sessionRequest").forEach((s) => { + const o = s.request.id, a = wr("session_request", o); + if (this.events.listenerCount(a) === 0) throw new Error(`emitting ${a} without any listeners`); + this.events.emit(wr("session_request", s.request.id), { error: n }); + }); + }, this.processSessionRequestQueue = () => { + if (this.sessionRequestQueue.state === _s.active) { + this.client.logger.info("session request queue is already active."); + return; + } + const r = this.sessionRequestQueue.queue[0]; + if (!r) { + this.client.logger.info("session request queue is empty."); + return; + } + try { + this.sessionRequestQueue.state = _s.active, this.emitSessionRequest(r); + } catch (n) { + this.client.logger.error(n); + } + }, this.emitSessionRequest = (r) => { + this.client.events.emit("session_request", r); + }, this.onPairingCreated = (r) => { + if (r.methods && this.expectedPairingMethodMap.set(r.topic, r.methods), r.active) return; + const n = this.client.proposal.getAll().find((i) => i.pairingTopic === r.topic); + n && this.onSessionProposeRequest({ topic: r.topic, payload: $o("wc_sessionPropose", { requiredNamespaces: n.requiredNamespaces, optionalNamespaces: n.optionalNamespaces, relays: n.relays, proposer: n.proposer, sessionProperties: n.sessionProperties }, n.id) }); + }, this.isValidConnect = async (r) => { + if (!ui(r)) { + const { message: f } = ft("MISSING_OR_INVALID", `connect() params: ${JSON.stringify(r)}`); + throw new Error(f); + } + const { pairingTopic: n, requiredNamespaces: i, optionalNamespaces: s, sessionProperties: o, relays: a } = r; + if (ei(n) || await this.isValidPairingTopic(n), !Yj(a)) { + const { message: f } = ft("MISSING_OR_INVALID", `connect() relays: ${a}`); + throw new Error(f); + } + !ei(i) && kf(i) !== 0 && this.validateNamespaces(i, "requiredNamespaces"), !ei(s) && kf(s) !== 0 && this.validateNamespaces(s, "optionalNamespaces"), ei(o) || this.validateSessionProps(o, "sessionProperties"); + }, this.validateNamespaces = (r, n) => { + const i = Gj(r, "connect()", n); + if (i) throw new Error(i.message); + }, this.isValidApprove = async (r) => { + if (!ui(r)) throw new Error(ft("MISSING_OR_INVALID", `approve() params: ${r}`).message); + const { id: n, namespaces: i, relayProtocol: s, sessionProperties: o } = r; + this.checkRecentlyDeleted(n), await this.isValidProposalId(n); + const a = this.client.proposal.get(n), f = Vg(i, "approve()"); + if (f) throw new Error(f.message); + const u = p3(a.requiredNamespaces, i, "approve()"); + if (u) throw new Error(u.message); + if (!hn(s, !0)) { + const { message: h } = ft("MISSING_OR_INVALID", `approve() relayProtocol: ${s}`); + throw new Error(h); + } + ei(o) || this.validateSessionProps(o, "sessionProperties"); + }, this.isValidReject = async (r) => { + if (!ui(r)) { + const { message: s } = ft("MISSING_OR_INVALID", `reject() params: ${r}`); + throw new Error(s); + } + const { id: n, reason: i } = r; + if (this.checkRecentlyDeleted(n), await this.isValidProposalId(n), !Xj(i)) { + const { message: s } = ft("MISSING_OR_INVALID", `reject() reason: ${JSON.stringify(i)}`); + throw new Error(s); + } + }, this.isValidSessionSettleRequest = (r) => { + if (!ui(r)) { + const { message: u } = ft("MISSING_OR_INVALID", `onSessionSettleRequest() params: ${r}`); + throw new Error(u); + } + const { relay: n, controller: i, namespaces: s, expiry: o } = r; + if (!F8(n)) { + const { message: u } = ft("MISSING_OR_INVALID", "onSessionSettleRequest() relay protocol should be a string"); + throw new Error(u); + } + const a = qj(i, "onSessionSettleRequest()"); + if (a) throw new Error(a.message); + const f = Vg(s, "onSessionSettleRequest()"); + if (f) throw new Error(f.message); + if (Oo(o)) { + const { message: u } = ft("EXPIRED", "onSessionSettleRequest()"); + throw new Error(u); + } + }, this.isValidUpdate = async (r) => { + if (!ui(r)) { + const { message: f } = ft("MISSING_OR_INVALID", `update() params: ${r}`); + throw new Error(f); + } + const { topic: n, namespaces: i } = r; + this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); + const s = this.client.session.get(n), o = Vg(i, "update()"); + if (o) throw new Error(o.message); + const a = p3(s.requiredNamespaces, i, "update()"); + if (a) throw new Error(a.message); + }, this.isValidExtend = async (r) => { + if (!ui(r)) { + const { message: i } = ft("MISSING_OR_INVALID", `extend() params: ${r}`); + throw new Error(i); + } + const { topic: n } = r; + this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); + }, this.isValidRequest = async (r) => { + if (!ui(r)) { + const { message: f } = ft("MISSING_OR_INVALID", `request() params: ${r}`); + throw new Error(f); + } + const { topic: n, request: i, chainId: s, expiry: o } = r; + this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); + const { namespaces: a } = this.client.session.get(n); + if (!d3(a, s)) { + const { message: f } = ft("MISSING_OR_INVALID", `request() chainId: ${s}`); + throw new Error(f); + } + if (!Zj(i)) { + const { message: f } = ft("MISSING_OR_INVALID", `request() ${JSON.stringify(i)}`); + throw new Error(f); + } + if (!tU(a, s, i.method)) { + const { message: f } = ft("MISSING_OR_INVALID", `request() method: ${i.method}`); + throw new Error(f); + } + if (o && !sU(o, Qg)) { + const { message: f } = ft("MISSING_OR_INVALID", `request() expiry: ${o}. Expiry must be a number (in seconds) between ${Qg.min} and ${Qg.max}`); + throw new Error(f); + } + }, this.isValidRespond = async (r) => { + var n; + if (!ui(r)) { + const { message: o } = ft("MISSING_OR_INVALID", `respond() params: ${r}`); + throw new Error(o); + } + const { topic: i, response: s } = r; + try { + await this.isValidSessionTopic(i); + } catch (o) { + throw (n = r?.response) != null && n.id && this.cleanupAfterResponse(r), o; + } + if (!Qj(s)) { + const { message: o } = ft("MISSING_OR_INVALID", `respond() response: ${JSON.stringify(s)}`); + throw new Error(o); + } + }, this.isValidPing = async (r) => { + if (!ui(r)) { + const { message: i } = ft("MISSING_OR_INVALID", `ping() params: ${r}`); + throw new Error(i); + } + const { topic: n } = r; + await this.isValidSessionOrPairingTopic(n); + }, this.isValidEmit = async (r) => { + if (!ui(r)) { + const { message: a } = ft("MISSING_OR_INVALID", `emit() params: ${r}`); + throw new Error(a); + } + const { topic: n, event: i, chainId: s } = r; + await this.isValidSessionTopic(n); + const { namespaces: o } = this.client.session.get(n); + if (!d3(o, s)) { + const { message: a } = ft("MISSING_OR_INVALID", `emit() chainId: ${s}`); + throw new Error(a); + } + if (!eU(i)) { + const { message: a } = ft("MISSING_OR_INVALID", `emit() event: ${JSON.stringify(i)}`); + throw new Error(a); + } + if (!rU(o, s, i.name)) { + const { message: a } = ft("MISSING_OR_INVALID", `emit() event: ${JSON.stringify(i)}`); + throw new Error(a); + } + }, this.isValidDisconnect = async (r) => { + if (!ui(r)) { + const { message: i } = ft("MISSING_OR_INVALID", `disconnect() params: ${r}`); + throw new Error(i); + } + const { topic: n } = r; + await this.isValidSessionOrPairingTopic(n); + }, this.isValidAuthenticate = (r) => { + const { chains: n, uri: i, domain: s, nonce: o } = r; + if (!Array.isArray(n) || n.length === 0) throw new Error("chains is required and must be a non-empty array"); + if (!hn(i, !1)) throw new Error("uri is required parameter"); + if (!hn(s, !1)) throw new Error("domain is required parameter"); + if (!hn(o, !1)) throw new Error("nonce is required parameter"); + if ([...new Set(n.map((f) => Nc(f).namespace))].length > 1) throw new Error("Multi-namespace requests are not supported. Please request single namespace only."); + const { namespace: a } = Nc(n[0]); + if (a !== "eip155") throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains."); + }, this.getVerifyContext = async (r) => { + const { attestationId: n, hash: i, encryptedId: s, metadata: o, transportType: a } = r, f = { verified: { verifyUrl: o.verifyUrl || rf, validation: "UNKNOWN", origin: o.url || "" } }; + try { + if (a === Wr.link_mode) { + const h = this.getAppLinkIfEnabled(o, a); + return f.verified.validation = h && new URL(h).origin === new URL(o.url).origin ? "VALID" : "INVALID", f; + } + const u = await this.client.core.verify.resolve({ attestationId: n, hash: i, encryptedId: s, verifyUrl: o.verifyUrl }); + u && (f.verified.origin = u.origin, f.verified.isScam = u.isScam, f.verified.validation = u.origin === new URL(o.url).origin ? "VALID" : "INVALID"); + } catch (u) { + this.client.logger.warn(u); + } + return this.client.logger.debug(`Verify context: ${JSON.stringify(f)}`), f; + }, this.validateSessionProps = (r, n) => { + Object.values(r).forEach((i) => { + if (!hn(i, !1)) { + const { message: s } = ft("MISSING_OR_INVALID", `${n} must be in Record format. Received: ${JSON.stringify(i)}`); + throw new Error(s); + } + }); + }, this.getPendingAuthRequest = (r) => { + const n = this.client.auth.requests.get(r); + return typeof n == "object" ? n : void 0; + }, this.addToRecentlyDeleted = (r, n) => { + if (this.recentlyDeletedMap.set(r, n), this.recentlyDeletedMap.size >= this.recentlyDeletedLimit) { + let i = 0; + const s = this.recentlyDeletedLimit / 2; + for (const o of this.recentlyDeletedMap.keys()) { + if (i++ >= s) break; + this.recentlyDeletedMap.delete(o); + } + } + }, this.checkRecentlyDeleted = (r) => { + const n = this.recentlyDeletedMap.get(r); + if (n) { + const { message: i } = ft("MISSING_OR_INVALID", `Record was recently deleted - ${n}: ${r}`); + throw new Error(i); + } + }, this.isLinkModeEnabled = (r, n) => { + var i, s, o, a, f, u, h, g, v; + return !r || n !== Wr.link_mode ? !1 : ((s = (i = this.client.metadata) == null ? void 0 : i.redirect) == null ? void 0 : s.linkMode) === !0 && ((a = (o = this.client.metadata) == null ? void 0 : o.redirect) == null ? void 0 : a.universal) !== void 0 && ((u = (f = this.client.metadata) == null ? void 0 : f.redirect) == null ? void 0 : u.universal) !== "" && ((h = r?.redirect) == null ? void 0 : h.universal) !== void 0 && ((g = r?.redirect) == null ? void 0 : g.universal) !== "" && ((v = r?.redirect) == null ? void 0 : v.linkMode) === !0 && this.client.core.linkModeSupportedApps.includes(r.redirect.universal) && typeof (global == null ? void 0 : global.Linking) < "u"; + }, this.getAppLinkIfEnabled = (r, n) => { + var i; + return this.isLinkModeEnabled(r, n) ? (i = r?.redirect) == null ? void 0 : i.universal : void 0; + }, this.handleLinkModeMessage = ({ url: r }) => { + if (!r || !r.includes("wc_ev") || !r.includes("topic")) return; + const n = Jx(r, "topic") || "", i = decodeURIComponent(Jx(r, "wc_ev") || ""), s = this.client.session.keys.includes(n); + s && this.client.session.update(n, { transportType: Wr.link_mode }), this.client.core.dispatchEnvelope({ topic: n, message: i, sessionExists: s }); + }, this.registerLinkModeListeners = async () => { + var r; + if (_1() || Yc() && (r = this.client.metadata.redirect) != null && r.linkMode) { + const n = global == null ? void 0 : global.Linking; + if (typeof n < "u") { + n.addEventListener("url", this.handleLinkModeMessage, this.client.name); + const i = await n.getInitialURL(); + i && setTimeout(() => { + this.handleLinkModeMessage({ url: i }); + }, 50); + } + } + }; + } + isInitialized() { + if (!this.initialized) { + const { message: e } = ft("NOT_INITIALIZED", this.name); + throw new Error(e); + } + } + async confirmOnlineStateOrThrow() { + await this.client.core.relayer.confirmOnlineStateOrThrow(); + } + registerRelayerEvents() { + this.client.core.relayer.on(Qn.message, (e) => { + !this.initialized || this.relayMessageCache.length > 0 ? this.relayMessageCache.push(e) : this.onRelayMessage(e); + }); + } + async onRelayMessage(e) { + const { topic: r, message: n, attestation: i, transportType: s } = e, { publicKey: o } = this.client.auth.authKeys.keys.includes(Kh) ? this.client.auth.authKeys.get(Kh) : { publicKey: void 0 }, a = await this.client.core.crypto.decode(r, n, { receiverPublicKey: o, encoding: s === Wr.link_mode ? Ou : ko }); + try { + I1(a) ? (this.client.core.history.set(r, a), this.onRelayEventRequest({ topic: r, payload: a, attestation: i, transportType: s, encryptedId: Qs(n) })) : i0(a) ? (await this.client.core.history.resolve(a), await this.onRelayEventResponse({ topic: r, payload: a, transportType: s }), this.client.core.history.delete(r, a.id)) : this.onRelayEventUnknownPayload({ topic: r, payload: a, transportType: s }); + } catch (f) { + this.client.logger.error(f); + } + } + registerExpirerEvents() { + this.client.core.expirer.on(ji.expired, async (e) => { + const { topic: r, id: n } = C8(e.target); + if (n && this.client.pendingRequest.keys.includes(n)) return await this.deletePendingSessionRequest(n, ft("EXPIRED"), !0); + if (n && this.client.auth.requests.keys.includes(n)) return await this.deletePendingAuthRequest(n, ft("EXPIRED"), !0); + r ? this.client.session.keys.includes(r) && (await this.deleteSession({ topic: r, expirerHasDeleted: !0 }), this.client.events.emit("session_expire", { topic: r })) : n && (await this.deleteProposal(n, !0), this.client.events.emit("proposal_expire", { id: n })); + }); + } + registerPairingEvents() { + this.client.core.pairing.events.on(_a.create, (e) => this.onPairingCreated(e)), this.client.core.pairing.events.on(_a.delete, (e) => { + this.addToRecentlyDeleted(e.topic, "pairing"); + }); + } + isValidPairingTopic(e) { + if (!hn(e, !1)) { + const { message: r } = ft("MISSING_OR_INVALID", `pairing topic should be a string: ${e}`); + throw new Error(r); + } + if (!this.client.core.pairing.pairings.keys.includes(e)) { + const { message: r } = ft("NO_MATCHING_KEY", `pairing topic doesn't exist: ${e}`); + throw new Error(r); + } + if (Oo(this.client.core.pairing.pairings.get(e).expiry)) { + const { message: r } = ft("EXPIRED", `pairing topic: ${e}`); + throw new Error(r); + } + } + async isValidSessionTopic(e) { + if (!hn(e, !1)) { + const { message: r } = ft("MISSING_OR_INVALID", `session topic should be a string: ${e}`); + throw new Error(r); + } + if (this.checkRecentlyDeleted(e), !this.client.session.keys.includes(e)) { + const { message: r } = ft("NO_MATCHING_KEY", `session topic doesn't exist: ${e}`); + throw new Error(r); + } + if (Oo(this.client.session.get(e).expiry)) { + await this.deleteSession({ topic: e }); + const { message: r } = ft("EXPIRED", `session topic: ${e}`); + throw new Error(r); + } + if (!this.client.core.crypto.keychain.has(e)) { + const { message: r } = ft("MISSING_OR_INVALID", `session topic does not exist in keychain: ${e}`); + throw await this.deleteSession({ topic: e }), new Error(r); + } + } + async isValidSessionOrPairingTopic(e) { + if (this.checkRecentlyDeleted(e), this.client.session.keys.includes(e)) await this.isValidSessionTopic(e); + else if (this.client.core.pairing.pairings.keys.includes(e)) this.isValidPairingTopic(e); + else if (hn(e, !1)) { + const { message: r } = ft("NO_MATCHING_KEY", `session or pairing topic doesn't exist: ${e}`); + throw new Error(r); + } else { + const { message: r } = ft("MISSING_OR_INVALID", `session or pairing topic should be a string: ${e}`); + throw new Error(r); + } + } + async isValidProposalId(e) { + if (!Jj(e)) { + const { message: r } = ft("MISSING_OR_INVALID", `proposal id should be a number: ${e}`); + throw new Error(r); + } + if (!this.client.proposal.keys.includes(e)) { + const { message: r } = ft("NO_MATCHING_KEY", `proposal id doesn't exist: ${e}`); + throw new Error(r); + } + if (Oo(this.client.proposal.get(e).expiryTimestamp)) { + await this.deleteProposal(e); + const { message: r } = ft("EXPIRED", `proposal id: ${e}`); + throw new Error(r); + } + } +} +class LH extends Va { + constructor(e, r) { + super(e, r, yH, R1), this.core = e, this.logger = r; + } +} +let kH = class extends Va { + constructor(e, r) { + super(e, r, wH, R1), this.core = e, this.logger = r; + } +}; +class $H extends Va { + constructor(e, r) { + super(e, r, _H, R1, (n) => n.id), this.core = e, this.logger = r; + } +} +class BH extends Va { + constructor(e, r) { + super(e, r, PH, o0, () => Kh), this.core = e, this.logger = r; + } +} +class FH extends Va { + constructor(e, r) { + super(e, r, MH, o0), this.core = e, this.logger = r; + } +} +class jH extends Va { + constructor(e, r) { + super(e, r, IH, o0, (n) => n.id), this.core = e, this.logger = r; + } +} +class UH { + constructor(e, r) { + this.core = e, this.logger = r, this.authKeys = new BH(this.core, this.logger), this.pairingTopics = new FH(this.core, this.logger), this.requests = new jH(this.core, this.logger); + } + async init() { + await this.authKeys.init(), await this.pairingTopics.init(), await this.requests.init(); + } +} +class T1 extends yk { + constructor(e) { + super(e), this.protocol = aE, this.version = cE, this.name = Zg.name, this.events = new Wi.EventEmitter(), this.on = (n, i) => this.events.on(n, i), this.once = (n, i) => this.events.once(n, i), this.off = (n, i) => this.events.off(n, i), this.removeListener = (n, i) => this.events.removeListener(n, i), this.removeAllListeners = (n) => this.events.removeAllListeners(n), this.connect = async (n) => { + try { + return await this.engine.connect(n); + } catch (i) { + throw this.logger.error(i.message), i; + } + }, this.pair = async (n) => { + try { + return await this.engine.pair(n); + } catch (i) { + throw this.logger.error(i.message), i; + } + }, this.approve = async (n) => { + try { + return await this.engine.approve(n); + } catch (i) { + throw this.logger.error(i.message), i; + } + }, this.reject = async (n) => { + try { + return await this.engine.reject(n); + } catch (i) { + throw this.logger.error(i.message), i; + } + }, this.update = async (n) => { + try { + return await this.engine.update(n); + } catch (i) { + throw this.logger.error(i.message), i; + } + }, this.extend = async (n) => { + try { + return await this.engine.extend(n); + } catch (i) { + throw this.logger.error(i.message), i; + } + }, this.request = async (n) => { + try { + return await this.engine.request(n); + } catch (i) { + throw this.logger.error(i.message), i; + } + }, this.respond = async (n) => { + try { + return await this.engine.respond(n); + } catch (i) { + throw this.logger.error(i.message), i; + } + }, this.ping = async (n) => { + try { + return await this.engine.ping(n); + } catch (i) { + throw this.logger.error(i.message), i; + } + }, this.emit = async (n) => { + try { + return await this.engine.emit(n); + } catch (i) { + throw this.logger.error(i.message), i; + } + }, this.disconnect = async (n) => { + try { + return await this.engine.disconnect(n); + } catch (i) { + throw this.logger.error(i.message), i; + } + }, this.find = (n) => { + try { + return this.engine.find(n); + } catch (i) { + throw this.logger.error(i.message), i; + } + }, this.getPendingSessionRequests = () => { + try { + return this.engine.getPendingSessionRequests(); + } catch (n) { + throw this.logger.error(n.message), n; + } + }, this.authenticate = async (n, i) => { + try { + return await this.engine.authenticate(n, i); + } catch (s) { + throw this.logger.error(s.message), s; + } + }, this.formatAuthMessage = (n) => { + try { + return this.engine.formatAuthMessage(n); + } catch (i) { + throw this.logger.error(i.message), i; + } + }, this.approveSessionAuthenticate = async (n) => { + try { + return await this.engine.approveSessionAuthenticate(n); + } catch (i) { + throw this.logger.error(i.message), i; + } + }, this.rejectSessionAuthenticate = async (n) => { + try { + return await this.engine.rejectSessionAuthenticate(n); + } catch (i) { + throw this.logger.error(i.message), i; + } + }, this.name = e?.name || Zg.name, this.metadata = e?.metadata || S8(), this.signConfig = e?.signConfig; + const r = typeof e?.logger < "u" && typeof e?.logger != "string" ? e.logger : Xf(Vd({ level: e?.logger || Zg.logger })); + this.core = e?.core || new bH(e), this.logger = ri(r, this.name), this.session = new kH(this.core, this.logger), this.proposal = new LH(this.core, this.logger), this.pendingRequest = new $H(this.core, this.logger), this.engine = new NH(this), this.auth = new UH(this.core, this.logger); + } + static async init(e) { + const r = new T1(e); + return await r.initialize(), r; + } + get context() { + return mi(this.logger); + } + get pairing() { + return this.core.pairing.pairings; + } + async initialize() { + this.logger.trace("Initialized"); + try { + await this.core.start(), await this.session.init(), await this.proposal.init(), await this.pendingRequest.init(), await this.auth.init(), await this.engine.init(), this.logger.info("SignClient Initialization Success"), this.engine.processRelayMessageCache(); + } catch (e) { + throw this.logger.info("SignClient Initialization Failure"), this.logger.error(e.message), e; + } + } +} +var Ju = { exports: {} }; +/** + * @license + * Lodash + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ +var qH = Ju.exports, J3; +function zH() { + return J3 || (J3 = 1, (function(t, e) { + (function() { + var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", f = "__lodash_hash_undefined__", u = 500, h = "__lodash_placeholder__", g = 1, v = 2, x = 4, S = 1, C = 2, D = 1, $ = 2, N = 4, z = 8, k = 16, B = 32, U = 64, R = 128, W = 256, J = 512, ne = 30, K = "...", E = 800, b = 16, l = 1, p = 2, m = 3, w = 1 / 0, P = 9007199254740991, _ = 17976931348623157e292, y = NaN, M = 4294967295, I = M - 1, q = M >>> 1, ce = [ + ["ary", R], + ["bind", D], + ["bindKey", $], + ["curry", z], + ["curryRight", k], + ["flip", J], + ["partial", B], + ["partialRight", U], + ["rearg", W] + ], L = "[object Arguments]", oe = "[object Array]", Q = "[object AsyncFunction]", X = "[object Boolean]", ee = "[object Date]", O = "[object DOMException]", Z = "[object Error]", re = "[object Function]", he = "[object GeneratorFunction]", ae = "[object Map]", fe = "[object Number]", be = "[object Null]", Ae = "[object Object]", Te = "[object Promise]", Re = "[object Proxy]", $e = "[object RegExp]", Me = "[object Set]", Oe = "[object String]", ze = "[object Symbol]", De = "[object Undefined]", je = "[object WeakMap]", Ue = "[object WeakSet]", _e = "[object ArrayBuffer]", Ze = "[object DataView]", ot = "[object Float32Array]", ke = "[object Float64Array]", rt = "[object Int8Array]", nt = "[object Int16Array]", Ge = "[object Int32Array]", ht = "[object Uint8Array]", lt = "[object Uint8ClampedArray]", ct = "[object Uint16Array]", qt = "[object Uint32Array]", Gt = /\b__p \+= '';/g, Et = /\b(__p \+=) '' \+/g, Yt = /(__e\(.*?\)|\b__t\)) \+\n'';/g, tr = /&(?:amp|lt|gt|quot|#39);/g, Tt = /[&<>"']/g, kt = RegExp(tr.source), It = RegExp(Tt.source), dt = /<%-([\s\S]+?)%>/g, Dt = /<%([\s\S]+?)%>/g, Nt = /<%=([\s\S]+?)%>/g, mt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Bt = /^\w*$/, Ft = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, et = /[\\^$.*+?()[\]{}|]/g, $t = RegExp(et.source), H = /^\s+/, V = /\s/, Y = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, T = /\{\n\/\* \[wrapped with (.+)\] \*/, F = /,? & /, ie = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, le = /[()=,{}\[\]\/\s]/, me = /\\(\\)?/g, Ee = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Le = /\w*$/, Ie = /^[-+]0x[0-9a-f]+$/i, Qe = /^0b[01]+$/i, Xe = /^\[object .+?Constructor\]$/, tt = /^0o[0-7]+$/i, st = /^(?:0|[1-9]\d*)$/, vt = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, Ct = /($^)/, Mt = /['\n\r\u2028\u2029\\]/g, wt = "\\ud800-\\udfff", Rt = "\\u0300-\\u036f", gt = "\\ufe20-\\ufe2f", _t = "\\u20d0-\\u20ff", at = Rt + gt + _t, yt = "\\u2700-\\u27bf", ut = "a-z\\xdf-\\xf6\\xf8-\\xff", it = "\\xac\\xb1\\xd7\\xf7", Se = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Pe = "\\u2000-\\u206f", Ke = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Fe = "A-Z\\xc0-\\xd6\\xd8-\\xde", qe = "\\ufe0e\\ufe0f", Ye = it + Se + Pe + Ke, Lt = "['’]", zt = "[" + wt + "]", Zt = "[" + Ye + "]", Ht = "[" + at + "]", ge = "\\d+", nr = "[" + yt + "]", pr = "[" + ut + "]", gr = "[^" + wt + Ye + ge + yt + ut + Fe + "]", Qt = "\\ud83c[\\udffb-\\udfff]", mr = "(?:" + Ht + "|" + Qt + ")", lr = "[^" + wt + "]", Tr = "(?:\\ud83c[\\udde6-\\uddff]){2}", vr = "[\\ud800-\\udbff][\\udc00-\\udfff]", xr = "[" + Fe + "]", $r = "\\u200d", Br = "(?:" + pr + "|" + gr + ")", Ir = "(?:" + xr + "|" + gr + ")", rn = "(?:" + Lt + "(?:d|ll|m|re|s|t|ve))?", nn = "(?:" + Lt + "(?:D|LL|M|RE|S|T|VE))?", sn = mr + "?", vl = "[" + qe + "]?", R0 = "(?:" + $r + "(?:" + [lr, Tr, vr].join("|") + ")" + vl + sn + ")*", ks = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", bl = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", yl = vl + sn + R0, Xa = "(?:" + [nr, Tr, vr].join("|") + ")" + yl, T0 = "(?:" + [lr + Ht + "?", Ht, Tr, vr, zt].join("|") + ")", iu = RegExp(Lt, "g"), D0 = RegExp(Ht, "g"), Za = RegExp(Qt + "(?=" + Qt + ")|" + T0 + yl, "g"), wl = RegExp([ + xr + "?" + pr + "+" + rn + "(?=" + [Zt, xr, "$"].join("|") + ")", + Ir + "+" + nn + "(?=" + [Zt, xr + Br, "$"].join("|") + ")", + xr + "?" + Br + "+" + rn, + xr + "+" + nn, + bl, + ks, + ge, + Xa + ].join("|"), "g"), xl = RegExp("[" + $r + wt + at + qe + "]"), ta = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, _l = [ + "Array", + "Buffer", + "DataView", + "Date", + "Error", + "Float32Array", + "Float64Array", + "Function", + "Int8Array", + "Int16Array", + "Int32Array", + "Map", + "Math", + "Object", + "Promise", + "RegExp", + "Set", + "String", + "Symbol", + "TypeError", + "Uint8Array", + "Uint8ClampedArray", + "Uint16Array", + "Uint32Array", + "WeakMap", + "_", + "clearTimeout", + "isFinite", + "parseInt", + "setTimeout" + ], O0 = -1, Fr = {}; + Fr[ot] = Fr[ke] = Fr[rt] = Fr[nt] = Fr[Ge] = Fr[ht] = Fr[lt] = Fr[ct] = Fr[qt] = !0, Fr[L] = Fr[oe] = Fr[_e] = Fr[X] = Fr[Ze] = Fr[ee] = Fr[Z] = Fr[re] = Fr[ae] = Fr[fe] = Fr[Ae] = Fr[$e] = Fr[Me] = Fr[Oe] = Fr[je] = !1; + var Dr = {}; + Dr[L] = Dr[oe] = Dr[_e] = Dr[Ze] = Dr[X] = Dr[ee] = Dr[ot] = Dr[ke] = Dr[rt] = Dr[nt] = Dr[Ge] = Dr[ae] = Dr[fe] = Dr[Ae] = Dr[$e] = Dr[Me] = Dr[Oe] = Dr[ze] = Dr[ht] = Dr[lt] = Dr[ct] = Dr[qt] = !0, Dr[Z] = Dr[re] = Dr[je] = !1; + var ue = { + // Latin-1 Supplement block. + À: "A", + Á: "A", + Â: "A", + Ã: "A", + Ä: "A", + Å: "A", + à: "a", + á: "a", + â: "a", + ã: "a", + ä: "a", + å: "a", + Ç: "C", + ç: "c", + Ð: "D", + ð: "d", + È: "E", + É: "E", + Ê: "E", + Ë: "E", + è: "e", + é: "e", + ê: "e", + ë: "e", + Ì: "I", + Í: "I", + Î: "I", + Ï: "I", + ì: "i", + í: "i", + î: "i", + ï: "i", + Ñ: "N", + ñ: "n", + Ò: "O", + Ó: "O", + Ô: "O", + Õ: "O", + Ö: "O", + Ø: "O", + ò: "o", + ó: "o", + ô: "o", + õ: "o", + ö: "o", + ø: "o", + Ù: "U", + Ú: "U", + Û: "U", + Ü: "U", + ù: "u", + ú: "u", + û: "u", + ü: "u", + Ý: "Y", + ý: "y", + ÿ: "y", + Æ: "Ae", + æ: "ae", + Þ: "Th", + þ: "th", + ß: "ss", + // Latin Extended-A block. + Ā: "A", + Ă: "A", + Ą: "A", + ā: "a", + ă: "a", + ą: "a", + Ć: "C", + Ĉ: "C", + Ċ: "C", + Č: "C", + ć: "c", + ĉ: "c", + ċ: "c", + č: "c", + Ď: "D", + Đ: "D", + ď: "d", + đ: "d", + Ē: "E", + Ĕ: "E", + Ė: "E", + Ę: "E", + Ě: "E", + ē: "e", + ĕ: "e", + ė: "e", + ę: "e", + ě: "e", + Ĝ: "G", + Ğ: "G", + Ġ: "G", + Ģ: "G", + ĝ: "g", + ğ: "g", + ġ: "g", + ģ: "g", + Ĥ: "H", + Ħ: "H", + ĥ: "h", + ħ: "h", + Ĩ: "I", + Ī: "I", + Ĭ: "I", + Į: "I", + İ: "I", + ĩ: "i", + ī: "i", + ĭ: "i", + į: "i", + ı: "i", + Ĵ: "J", + ĵ: "j", + Ķ: "K", + ķ: "k", + ĸ: "k", + Ĺ: "L", + Ļ: "L", + Ľ: "L", + Ŀ: "L", + Ł: "L", + ĺ: "l", + ļ: "l", + ľ: "l", + ŀ: "l", + ł: "l", + Ń: "N", + Ņ: "N", + Ň: "N", + Ŋ: "N", + ń: "n", + ņ: "n", + ň: "n", + ŋ: "n", + Ō: "O", + Ŏ: "O", + Ő: "O", + ō: "o", + ŏ: "o", + ő: "o", + Ŕ: "R", + Ŗ: "R", + Ř: "R", + ŕ: "r", + ŗ: "r", + ř: "r", + Ś: "S", + Ŝ: "S", + Ş: "S", + Š: "S", + ś: "s", + ŝ: "s", + ş: "s", + š: "s", + Ţ: "T", + Ť: "T", + Ŧ: "T", + ţ: "t", + ť: "t", + ŧ: "t", + Ũ: "U", + Ū: "U", + Ŭ: "U", + Ů: "U", + Ű: "U", + Ų: "U", + ũ: "u", + ū: "u", + ŭ: "u", + ů: "u", + ű: "u", + ų: "u", + Ŵ: "W", + ŵ: "w", + Ŷ: "Y", + ŷ: "y", + Ÿ: "Y", + Ź: "Z", + Ż: "Z", + Ž: "Z", + ź: "z", + ż: "z", + ž: "z", + IJ: "IJ", + ij: "ij", + Œ: "Oe", + œ: "oe", + ʼn: "'n", + ſ: "s" + }, we = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'" + }, Ve = { + "&": "&", + "<": "<", + ">": ">", + """: '"', + "'": "'" + }, St = { + "\\": "\\", + "'": "'", + "\n": "n", + "\r": "r", + "\u2028": "u2028", + "\u2029": "u2029" + }, jr = parseFloat, ir = parseInt, Kr = typeof Zn == "object" && Zn && Zn.Object === Object && Zn, gn = typeof self == "object" && self && self.Object === Object && self, Er = Kr || gn || Function("return this")(), Ur = e && !e.nodeType && e, on = Ur && !0 && t && !t.nodeType && t, ni = on && on.exports === Ur, mn = ni && Kr.process, Vr = (function() { + try { + var ye = on && on.require && on.require("util").types; + return ye || mn && mn.binding && mn.binding("util"); + } catch { + } + })(), Gn = Vr && Vr.isArrayBuffer, Zi = Vr && Vr.isDate, Ci = Vr && Vr.isMap, gs = Vr && Vr.isRegExp, su = Vr && Vr.isSet, ra = Vr && Vr.isTypedArray; + function Sn(ye, Be, Ce) { + switch (Ce.length) { + case 0: + return ye.call(Be); + case 1: + return ye.call(Be, Ce[0]); + case 2: + return ye.call(Be, Ce[0], Ce[1]); + case 3: + return ye.call(Be, Ce[0], Ce[1], Ce[2]); + } + return ye.apply(Be, Ce); + } + function N9(ye, Be, Ce, Pt) { + for (var rr = -1, Mr = ye == null ? 0 : ye.length; ++rr < Mr; ) { + var wn = ye[rr]; + Be(Pt, wn, Ce(wn), ye); + } + return Pt; + } + function Ri(ye, Be) { + for (var Ce = -1, Pt = ye == null ? 0 : ye.length; ++Ce < Pt && Be(ye[Ce], Ce, ye) !== !1; ) + ; + return ye; + } + function L9(ye, Be) { + for (var Ce = ye == null ? 0 : ye.length; Ce-- && Be(ye[Ce], Ce, ye) !== !1; ) + ; + return ye; + } + function Db(ye, Be) { + for (var Ce = -1, Pt = ye == null ? 0 : ye.length; ++Ce < Pt; ) + if (!Be(ye[Ce], Ce, ye)) + return !1; + return !0; + } + function mo(ye, Be) { + for (var Ce = -1, Pt = ye == null ? 0 : ye.length, rr = 0, Mr = []; ++Ce < Pt; ) { + var wn = ye[Ce]; + Be(wn, Ce, ye) && (Mr[rr++] = wn); + } + return Mr; + } + function El(ye, Be) { + var Ce = ye == null ? 0 : ye.length; + return !!Ce && Qa(ye, Be, 0) > -1; + } + function N0(ye, Be, Ce) { + for (var Pt = -1, rr = ye == null ? 0 : ye.length; ++Pt < rr; ) + if (Ce(Be, ye[Pt])) + return !0; + return !1; + } + function Xr(ye, Be) { + for (var Ce = -1, Pt = ye == null ? 0 : ye.length, rr = Array(Pt); ++Ce < Pt; ) + rr[Ce] = Be(ye[Ce], Ce, ye); + return rr; + } + function vo(ye, Be) { + for (var Ce = -1, Pt = Be.length, rr = ye.length; ++Ce < Pt; ) + ye[rr + Ce] = Be[Ce]; + return ye; + } + function L0(ye, Be, Ce, Pt) { + var rr = -1, Mr = ye == null ? 0 : ye.length; + for (Pt && Mr && (Ce = ye[++rr]); ++rr < Mr; ) + Ce = Be(Ce, ye[rr], rr, ye); + return Ce; + } + function k9(ye, Be, Ce, Pt) { + var rr = ye == null ? 0 : ye.length; + for (Pt && rr && (Ce = ye[--rr]); rr--; ) + Ce = Be(Ce, ye[rr], rr, ye); + return Ce; + } + function k0(ye, Be) { + for (var Ce = -1, Pt = ye == null ? 0 : ye.length; ++Ce < Pt; ) + if (Be(ye[Ce], Ce, ye)) + return !0; + return !1; + } + var $9 = $0("length"); + function B9(ye) { + return ye.split(""); + } + function F9(ye) { + return ye.match(ie) || []; + } + function Ob(ye, Be, Ce) { + var Pt; + return Ce(ye, function(rr, Mr, wn) { + if (Be(rr, Mr, wn)) + return Pt = Mr, !1; + }), Pt; + } + function Sl(ye, Be, Ce, Pt) { + for (var rr = ye.length, Mr = Ce + (Pt ? 1 : -1); Pt ? Mr-- : ++Mr < rr; ) + if (Be(ye[Mr], Mr, ye)) + return Mr; + return -1; + } + function Qa(ye, Be, Ce) { + return Be === Be ? X9(ye, Be, Ce) : Sl(ye, Nb, Ce); + } + function j9(ye, Be, Ce, Pt) { + for (var rr = Ce - 1, Mr = ye.length; ++rr < Mr; ) + if (Pt(ye[rr], Be)) + return rr; + return -1; + } + function Nb(ye) { + return ye !== ye; + } + function Lb(ye, Be) { + var Ce = ye == null ? 0 : ye.length; + return Ce ? F0(ye, Be) / Ce : y; + } + function $0(ye) { + return function(Be) { + return Be == null ? r : Be[ye]; + }; + } + function B0(ye) { + return function(Be) { + return ye == null ? r : ye[Be]; + }; + } + function kb(ye, Be, Ce, Pt, rr) { + return rr(ye, function(Mr, wn, qr) { + Ce = Pt ? (Pt = !1, Mr) : Be(Ce, Mr, wn, qr); + }), Ce; + } + function U9(ye, Be) { + var Ce = ye.length; + for (ye.sort(Be); Ce--; ) + ye[Ce] = ye[Ce].value; + return ye; + } + function F0(ye, Be) { + for (var Ce, Pt = -1, rr = ye.length; ++Pt < rr; ) { + var Mr = Be(ye[Pt]); + Mr !== r && (Ce = Ce === r ? Mr : Ce + Mr); + } + return Ce; + } + function j0(ye, Be) { + for (var Ce = -1, Pt = Array(ye); ++Ce < ye; ) + Pt[Ce] = Be(Ce); + return Pt; + } + function q9(ye, Be) { + return Xr(Be, function(Ce) { + return [Ce, ye[Ce]]; + }); + } + function $b(ye) { + return ye && ye.slice(0, Ub(ye) + 1).replace(H, ""); + } + function vi(ye) { + return function(Be) { + return ye(Be); + }; + } + function U0(ye, Be) { + return Xr(Be, function(Ce) { + return ye[Ce]; + }); + } + function ou(ye, Be) { + return ye.has(Be); + } + function Bb(ye, Be) { + for (var Ce = -1, Pt = ye.length; ++Ce < Pt && Qa(Be, ye[Ce], 0) > -1; ) + ; + return Ce; + } + function Fb(ye, Be) { + for (var Ce = ye.length; Ce-- && Qa(Be, ye[Ce], 0) > -1; ) + ; + return Ce; + } + function z9(ye, Be) { + for (var Ce = ye.length, Pt = 0; Ce--; ) + ye[Ce] === Be && ++Pt; + return Pt; + } + var H9 = B0(ue), W9 = B0(we); + function K9(ye) { + return "\\" + St[ye]; + } + function V9(ye, Be) { + return ye == null ? r : ye[Be]; + } + function ec(ye) { + return xl.test(ye); + } + function G9(ye) { + return ta.test(ye); + } + function Y9(ye) { + for (var Be, Ce = []; !(Be = ye.next()).done; ) + Ce.push(Be.value); + return Ce; + } + function q0(ye) { + var Be = -1, Ce = Array(ye.size); + return ye.forEach(function(Pt, rr) { + Ce[++Be] = [rr, Pt]; + }), Ce; + } + function jb(ye, Be) { + return function(Ce) { + return ye(Be(Ce)); + }; + } + function bo(ye, Be) { + for (var Ce = -1, Pt = ye.length, rr = 0, Mr = []; ++Ce < Pt; ) { + var wn = ye[Ce]; + (wn === Be || wn === h) && (ye[Ce] = h, Mr[rr++] = Ce); + } + return Mr; + } + function Al(ye) { + var Be = -1, Ce = Array(ye.size); + return ye.forEach(function(Pt) { + Ce[++Be] = Pt; + }), Ce; + } + function J9(ye) { + var Be = -1, Ce = Array(ye.size); + return ye.forEach(function(Pt) { + Ce[++Be] = [Pt, Pt]; + }), Ce; + } + function X9(ye, Be, Ce) { + for (var Pt = Ce - 1, rr = ye.length; ++Pt < rr; ) + if (ye[Pt] === Be) + return Pt; + return -1; + } + function Z9(ye, Be, Ce) { + for (var Pt = Ce + 1; Pt--; ) + if (ye[Pt] === Be) + return Pt; + return Pt; + } + function tc(ye) { + return ec(ye) ? eA(ye) : $9(ye); + } + function Qi(ye) { + return ec(ye) ? tA(ye) : B9(ye); + } + function Ub(ye) { + for (var Be = ye.length; Be-- && V.test(ye.charAt(Be)); ) + ; + return Be; + } + var Q9 = B0(Ve); + function eA(ye) { + for (var Be = Za.lastIndex = 0; Za.test(ye); ) + ++Be; + return Be; + } + function tA(ye) { + return ye.match(Za) || []; + } + function rA(ye) { + return ye.match(wl) || []; + } + var nA = (function ye(Be) { + Be = Be == null ? Er : rc.defaults(Er.Object(), Be, rc.pick(Er, _l)); + var Ce = Be.Array, Pt = Be.Date, rr = Be.Error, Mr = Be.Function, wn = Be.Math, qr = Be.Object, z0 = Be.RegExp, iA = Be.String, Ti = Be.TypeError, Pl = Ce.prototype, sA = Mr.prototype, nc = qr.prototype, Ml = Be["__core-js_shared__"], Il = sA.toString, Rr = nc.hasOwnProperty, oA = 0, qb = (function() { + var c = /[^.]+$/.exec(Ml && Ml.keys && Ml.keys.IE_PROTO || ""); + return c ? "Symbol(src)_1." + c : ""; + })(), Cl = nc.toString, aA = Il.call(qr), cA = Er._, uA = z0( + "^" + Il.call(Rr).replace(et, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" + ), Rl = ni ? Be.Buffer : r, yo = Be.Symbol, Tl = Be.Uint8Array, zb = Rl ? Rl.allocUnsafe : r, Dl = jb(qr.getPrototypeOf, qr), Hb = qr.create, Wb = nc.propertyIsEnumerable, Ol = Pl.splice, Kb = yo ? yo.isConcatSpreadable : r, au = yo ? yo.iterator : r, na = yo ? yo.toStringTag : r, Nl = (function() { + try { + var c = ca(qr, "defineProperty"); + return c({}, "", {}), c; + } catch { + } + })(), fA = Be.clearTimeout !== Er.clearTimeout && Be.clearTimeout, lA = Pt && Pt.now !== Er.Date.now && Pt.now, hA = Be.setTimeout !== Er.setTimeout && Be.setTimeout, Ll = wn.ceil, kl = wn.floor, H0 = qr.getOwnPropertySymbols, dA = Rl ? Rl.isBuffer : r, Vb = Be.isFinite, pA = Pl.join, gA = jb(qr.keys, qr), xn = wn.max, jn = wn.min, mA = Pt.now, vA = Be.parseInt, Gb = wn.random, bA = Pl.reverse, W0 = ca(Be, "DataView"), cu = ca(Be, "Map"), K0 = ca(Be, "Promise"), ic = ca(Be, "Set"), uu = ca(Be, "WeakMap"), fu = ca(qr, "create"), $l = uu && new uu(), sc = {}, yA = ua(W0), wA = ua(cu), xA = ua(K0), _A = ua(ic), EA = ua(uu), Bl = yo ? yo.prototype : r, lu = Bl ? Bl.valueOf : r, Yb = Bl ? Bl.toString : r; + function te(c) { + if (en(c) && !sr(c) && !(c instanceof _r)) { + if (c instanceof Di) + return c; + if (Rr.call(c, "__wrapped__")) + return Jy(c); + } + return new Di(c); + } + var oc = /* @__PURE__ */ (function() { + function c() { + } + return function(d) { + if (!Zr(d)) + return {}; + if (Hb) + return Hb(d); + c.prototype = d; + var A = new c(); + return c.prototype = r, A; + }; + })(); + function Fl() { + } + function Di(c, d) { + this.__wrapped__ = c, this.__actions__ = [], this.__chain__ = !!d, this.__index__ = 0, this.__values__ = r; + } + te.templateSettings = { + /** + * Used to detect `data` property values to be HTML-escaped. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + escape: dt, + /** + * Used to detect code to be evaluated. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + evaluate: Dt, + /** + * Used to detect `data` property values to inject. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + interpolate: Nt, + /** + * Used to reference the data object in the template text. + * + * @memberOf _.templateSettings + * @type {string} + */ + variable: "", + /** + * Used to import variables into the compiled template. + * + * @memberOf _.templateSettings + * @type {Object} + */ + imports: { + /** + * A reference to the `lodash` function. + * + * @memberOf _.templateSettings.imports + * @type {Function} + */ + _: te + } + }, te.prototype = Fl.prototype, te.prototype.constructor = te, Di.prototype = oc(Fl.prototype), Di.prototype.constructor = Di; + function _r(c) { + this.__wrapped__ = c, this.__actions__ = [], this.__dir__ = 1, this.__filtered__ = !1, this.__iteratees__ = [], this.__takeCount__ = M, this.__views__ = []; + } + function SA() { + var c = new _r(this.__wrapped__); + return c.__actions__ = ii(this.__actions__), c.__dir__ = this.__dir__, c.__filtered__ = this.__filtered__, c.__iteratees__ = ii(this.__iteratees__), c.__takeCount__ = this.__takeCount__, c.__views__ = ii(this.__views__), c; + } + function AA() { + if (this.__filtered__) { + var c = new _r(this); + c.__dir__ = -1, c.__filtered__ = !0; + } else + c = this.clone(), c.__dir__ *= -1; + return c; + } + function PA() { + var c = this.__wrapped__.value(), d = this.__dir__, A = sr(c), j = d < 0, G = A ? c.length : 0, se = BP(0, G, this.__views__), de = se.start, ve = se.end, xe = ve - de, He = j ? ve : de - 1, We = this.__iteratees__, Je = We.length, xt = 0, Ot = jn(xe, this.__takeCount__); + if (!A || !j && G == xe && Ot == xe) + return yy(c, this.__actions__); + var Wt = []; + e: + for (; xe-- && xt < Ot; ) { + He += d; + for (var fr = -1, Kt = c[He]; ++fr < Je; ) { + var yr = We[fr], Sr = yr.iteratee, wi = yr.type, Xn = Sr(Kt); + if (wi == p) + Kt = Xn; + else if (!Xn) { + if (wi == l) + continue e; + break e; + } + } + Wt[xt++] = Kt; + } + return Wt; + } + _r.prototype = oc(Fl.prototype), _r.prototype.constructor = _r; + function ia(c) { + var d = -1, A = c == null ? 0 : c.length; + for (this.clear(); ++d < A; ) { + var j = c[d]; + this.set(j[0], j[1]); + } + } + function MA() { + this.__data__ = fu ? fu(null) : {}, this.size = 0; + } + function IA(c) { + var d = this.has(c) && delete this.__data__[c]; + return this.size -= d ? 1 : 0, d; + } + function CA(c) { + var d = this.__data__; + if (fu) { + var A = d[c]; + return A === f ? r : A; + } + return Rr.call(d, c) ? d[c] : r; + } + function RA(c) { + var d = this.__data__; + return fu ? d[c] !== r : Rr.call(d, c); + } + function TA(c, d) { + var A = this.__data__; + return this.size += this.has(c) ? 0 : 1, A[c] = fu && d === r ? f : d, this; + } + ia.prototype.clear = MA, ia.prototype.delete = IA, ia.prototype.get = CA, ia.prototype.has = RA, ia.prototype.set = TA; + function $s(c) { + var d = -1, A = c == null ? 0 : c.length; + for (this.clear(); ++d < A; ) { + var j = c[d]; + this.set(j[0], j[1]); + } + } + function DA() { + this.__data__ = [], this.size = 0; + } + function OA(c) { + var d = this.__data__, A = jl(d, c); + if (A < 0) + return !1; + var j = d.length - 1; + return A == j ? d.pop() : Ol.call(d, A, 1), --this.size, !0; + } + function NA(c) { + var d = this.__data__, A = jl(d, c); + return A < 0 ? r : d[A][1]; + } + function LA(c) { + return jl(this.__data__, c) > -1; + } + function kA(c, d) { + var A = this.__data__, j = jl(A, c); + return j < 0 ? (++this.size, A.push([c, d])) : A[j][1] = d, this; + } + $s.prototype.clear = DA, $s.prototype.delete = OA, $s.prototype.get = NA, $s.prototype.has = LA, $s.prototype.set = kA; + function Bs(c) { + var d = -1, A = c == null ? 0 : c.length; + for (this.clear(); ++d < A; ) { + var j = c[d]; + this.set(j[0], j[1]); + } + } + function $A() { + this.size = 0, this.__data__ = { + hash: new ia(), + map: new (cu || $s)(), + string: new ia() + }; + } + function BA(c) { + var d = Zl(this, c).delete(c); + return this.size -= d ? 1 : 0, d; + } + function FA(c) { + return Zl(this, c).get(c); + } + function jA(c) { + return Zl(this, c).has(c); + } + function UA(c, d) { + var A = Zl(this, c), j = A.size; + return A.set(c, d), this.size += A.size == j ? 0 : 1, this; + } + Bs.prototype.clear = $A, Bs.prototype.delete = BA, Bs.prototype.get = FA, Bs.prototype.has = jA, Bs.prototype.set = UA; + function sa(c) { + var d = -1, A = c == null ? 0 : c.length; + for (this.__data__ = new Bs(); ++d < A; ) + this.add(c[d]); + } + function qA(c) { + return this.__data__.set(c, f), this; + } + function zA(c) { + return this.__data__.has(c); + } + sa.prototype.add = sa.prototype.push = qA, sa.prototype.has = zA; + function es(c) { + var d = this.__data__ = new $s(c); + this.size = d.size; + } + function HA() { + this.__data__ = new $s(), this.size = 0; + } + function WA(c) { + var d = this.__data__, A = d.delete(c); + return this.size = d.size, A; + } + function KA(c) { + return this.__data__.get(c); + } + function VA(c) { + return this.__data__.has(c); + } + function GA(c, d) { + var A = this.__data__; + if (A instanceof $s) { + var j = A.__data__; + if (!cu || j.length < i - 1) + return j.push([c, d]), this.size = ++A.size, this; + A = this.__data__ = new Bs(j); + } + return A.set(c, d), this.size = A.size, this; + } + es.prototype.clear = HA, es.prototype.delete = WA, es.prototype.get = KA, es.prototype.has = VA, es.prototype.set = GA; + function Jb(c, d) { + var A = sr(c), j = !A && fa(c), G = !A && !j && So(c), se = !A && !j && !G && fc(c), de = A || j || G || se, ve = de ? j0(c.length, iA) : [], xe = ve.length; + for (var He in c) + (d || Rr.call(c, He)) && !(de && // Safari 9 has enumerable `arguments.length` in strict mode. + (He == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. + G && (He == "offset" || He == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. + se && (He == "buffer" || He == "byteLength" || He == "byteOffset") || // Skip index properties. + qs(He, xe))) && ve.push(He); + return ve; + } + function Xb(c) { + var d = c.length; + return d ? c[np(0, d - 1)] : r; + } + function YA(c, d) { + return Ql(ii(c), oa(d, 0, c.length)); + } + function JA(c) { + return Ql(ii(c)); + } + function V0(c, d, A) { + (A !== r && !ts(c[d], A) || A === r && !(d in c)) && Fs(c, d, A); + } + function hu(c, d, A) { + var j = c[d]; + (!(Rr.call(c, d) && ts(j, A)) || A === r && !(d in c)) && Fs(c, d, A); + } + function jl(c, d) { + for (var A = c.length; A--; ) + if (ts(c[A][0], d)) + return A; + return -1; + } + function XA(c, d, A, j) { + return wo(c, function(G, se, de) { + d(j, G, A(G), de); + }), j; + } + function Zb(c, d) { + return c && vs(d, An(d), c); + } + function ZA(c, d) { + return c && vs(d, oi(d), c); + } + function Fs(c, d, A) { + d == "__proto__" && Nl ? Nl(c, d, { + configurable: !0, + enumerable: !0, + value: A, + writable: !0 + }) : c[d] = A; + } + function G0(c, d) { + for (var A = -1, j = d.length, G = Ce(j), se = c == null; ++A < j; ) + G[A] = se ? r : Ip(c, d[A]); + return G; + } + function oa(c, d, A) { + return c === c && (A !== r && (c = c <= A ? c : A), d !== r && (c = c >= d ? c : d)), c; + } + function Oi(c, d, A, j, G, se) { + var de, ve = d & g, xe = d & v, He = d & x; + if (A && (de = G ? A(c, j, G, se) : A(c)), de !== r) + return de; + if (!Zr(c)) + return c; + var We = sr(c); + if (We) { + if (de = jP(c), !ve) + return ii(c, de); + } else { + var Je = Un(c), xt = Je == re || Je == he; + if (So(c)) + return _y(c, ve); + if (Je == Ae || Je == L || xt && !G) { + if (de = xe || xt ? {} : Uy(c), !ve) + return xe ? CP(c, ZA(de, c)) : IP(c, Zb(de, c)); + } else { + if (!Dr[Je]) + return G ? c : {}; + de = UP(c, Je, ve); + } + } + se || (se = new es()); + var Ot = se.get(c); + if (Ot) + return Ot; + se.set(c, de), mw(c) ? c.forEach(function(Kt) { + de.add(Oi(Kt, d, A, Kt, c, se)); + }) : pw(c) && c.forEach(function(Kt, yr) { + de.set(yr, Oi(Kt, d, A, yr, c, se)); + }); + var Wt = He ? xe ? pp : dp : xe ? oi : An, fr = We ? r : Wt(c); + return Ri(fr || c, function(Kt, yr) { + fr && (yr = Kt, Kt = c[yr]), hu(de, yr, Oi(Kt, d, A, yr, c, se)); + }), de; + } + function QA(c) { + var d = An(c); + return function(A) { + return Qb(A, c, d); + }; + } + function Qb(c, d, A) { + var j = A.length; + if (c == null) + return !j; + for (c = qr(c); j--; ) { + var G = A[j], se = d[G], de = c[G]; + if (de === r && !(G in c) || !se(de)) + return !1; + } + return !0; + } + function ey(c, d, A) { + if (typeof c != "function") + throw new Ti(o); + return yu(function() { + c.apply(r, A); + }, d); + } + function du(c, d, A, j) { + var G = -1, se = El, de = !0, ve = c.length, xe = [], He = d.length; + if (!ve) + return xe; + A && (d = Xr(d, vi(A))), j ? (se = N0, de = !1) : d.length >= i && (se = ou, de = !1, d = new sa(d)); + e: + for (; ++G < ve; ) { + var We = c[G], Je = A == null ? We : A(We); + if (We = j || We !== 0 ? We : 0, de && Je === Je) { + for (var xt = He; xt--; ) + if (d[xt] === Je) + continue e; + xe.push(We); + } else se(d, Je, j) || xe.push(We); + } + return xe; + } + var wo = My(ms), ty = My(J0, !0); + function eP(c, d) { + var A = !0; + return wo(c, function(j, G, se) { + return A = !!d(j, G, se), A; + }), A; + } + function Ul(c, d, A) { + for (var j = -1, G = c.length; ++j < G; ) { + var se = c[j], de = d(se); + if (de != null && (ve === r ? de === de && !yi(de) : A(de, ve))) + var ve = de, xe = se; + } + return xe; + } + function tP(c, d, A, j) { + var G = c.length; + for (A = cr(A), A < 0 && (A = -A > G ? 0 : G + A), j = j === r || j > G ? G : cr(j), j < 0 && (j += G), j = A > j ? 0 : bw(j); A < j; ) + c[A++] = d; + return c; + } + function ry(c, d) { + var A = []; + return wo(c, function(j, G, se) { + d(j, G, se) && A.push(j); + }), A; + } + function On(c, d, A, j, G) { + var se = -1, de = c.length; + for (A || (A = zP), G || (G = []); ++se < de; ) { + var ve = c[se]; + d > 0 && A(ve) ? d > 1 ? On(ve, d - 1, A, j, G) : vo(G, ve) : j || (G[G.length] = ve); + } + return G; + } + var Y0 = Iy(), ny = Iy(!0); + function ms(c, d) { + return c && Y0(c, d, An); + } + function J0(c, d) { + return c && ny(c, d, An); + } + function ql(c, d) { + return mo(d, function(A) { + return zs(c[A]); + }); + } + function aa(c, d) { + d = _o(d, c); + for (var A = 0, j = d.length; c != null && A < j; ) + c = c[bs(d[A++])]; + return A && A == j ? c : r; + } + function iy(c, d, A) { + var j = d(c); + return sr(c) ? j : vo(j, A(c)); + } + function Yn(c) { + return c == null ? c === r ? De : be : na && na in qr(c) ? $P(c) : JP(c); + } + function X0(c, d) { + return c > d; + } + function rP(c, d) { + return c != null && Rr.call(c, d); + } + function nP(c, d) { + return c != null && d in qr(c); + } + function iP(c, d, A) { + return c >= jn(d, A) && c < xn(d, A); + } + function Z0(c, d, A) { + for (var j = A ? N0 : El, G = c[0].length, se = c.length, de = se, ve = Ce(se), xe = 1 / 0, He = []; de--; ) { + var We = c[de]; + de && d && (We = Xr(We, vi(d))), xe = jn(We.length, xe), ve[de] = !A && (d || G >= 120 && We.length >= 120) ? new sa(de && We) : r; + } + We = c[0]; + var Je = -1, xt = ve[0]; + e: + for (; ++Je < G && He.length < xe; ) { + var Ot = We[Je], Wt = d ? d(Ot) : Ot; + if (Ot = A || Ot !== 0 ? Ot : 0, !(xt ? ou(xt, Wt) : j(He, Wt, A))) { + for (de = se; --de; ) { + var fr = ve[de]; + if (!(fr ? ou(fr, Wt) : j(c[de], Wt, A))) + continue e; + } + xt && xt.push(Wt), He.push(Ot); + } + } + return He; + } + function sP(c, d, A, j) { + return ms(c, function(G, se, de) { + d(j, A(G), se, de); + }), j; + } + function pu(c, d, A) { + d = _o(d, c), c = Wy(c, d); + var j = c == null ? c : c[bs(Li(d))]; + return j == null ? r : Sn(j, c, A); + } + function sy(c) { + return en(c) && Yn(c) == L; + } + function oP(c) { + return en(c) && Yn(c) == _e; + } + function aP(c) { + return en(c) && Yn(c) == ee; + } + function gu(c, d, A, j, G) { + return c === d ? !0 : c == null || d == null || !en(c) && !en(d) ? c !== c && d !== d : cP(c, d, A, j, gu, G); + } + function cP(c, d, A, j, G, se) { + var de = sr(c), ve = sr(d), xe = de ? oe : Un(c), He = ve ? oe : Un(d); + xe = xe == L ? Ae : xe, He = He == L ? Ae : He; + var We = xe == Ae, Je = He == Ae, xt = xe == He; + if (xt && So(c)) { + if (!So(d)) + return !1; + de = !0, We = !1; + } + if (xt && !We) + return se || (se = new es()), de || fc(c) ? By(c, d, A, j, G, se) : LP(c, d, xe, A, j, G, se); + if (!(A & S)) { + var Ot = We && Rr.call(c, "__wrapped__"), Wt = Je && Rr.call(d, "__wrapped__"); + if (Ot || Wt) { + var fr = Ot ? c.value() : c, Kt = Wt ? d.value() : d; + return se || (se = new es()), G(fr, Kt, A, j, se); + } + } + return xt ? (se || (se = new es()), kP(c, d, A, j, G, se)) : !1; + } + function uP(c) { + return en(c) && Un(c) == ae; + } + function Q0(c, d, A, j) { + var G = A.length, se = G, de = !j; + if (c == null) + return !se; + for (c = qr(c); G--; ) { + var ve = A[G]; + if (de && ve[2] ? ve[1] !== c[ve[0]] : !(ve[0] in c)) + return !1; + } + for (; ++G < se; ) { + ve = A[G]; + var xe = ve[0], He = c[xe], We = ve[1]; + if (de && ve[2]) { + if (He === r && !(xe in c)) + return !1; + } else { + var Je = new es(); + if (j) + var xt = j(He, We, xe, c, d, Je); + if (!(xt === r ? gu(We, He, S | C, j, Je) : xt)) + return !1; + } + } + return !0; + } + function oy(c) { + if (!Zr(c) || WP(c)) + return !1; + var d = zs(c) ? uA : Xe; + return d.test(ua(c)); + } + function fP(c) { + return en(c) && Yn(c) == $e; + } + function lP(c) { + return en(c) && Un(c) == Me; + } + function hP(c) { + return en(c) && sh(c.length) && !!Fr[Yn(c)]; + } + function ay(c) { + return typeof c == "function" ? c : c == null ? ai : typeof c == "object" ? sr(c) ? fy(c[0], c[1]) : uy(c) : Cw(c); + } + function ep(c) { + if (!bu(c)) + return gA(c); + var d = []; + for (var A in qr(c)) + Rr.call(c, A) && A != "constructor" && d.push(A); + return d; + } + function dP(c) { + if (!Zr(c)) + return YP(c); + var d = bu(c), A = []; + for (var j in c) + j == "constructor" && (d || !Rr.call(c, j)) || A.push(j); + return A; + } + function tp(c, d) { + return c < d; + } + function cy(c, d) { + var A = -1, j = si(c) ? Ce(c.length) : []; + return wo(c, function(G, se, de) { + j[++A] = d(G, se, de); + }), j; + } + function uy(c) { + var d = mp(c); + return d.length == 1 && d[0][2] ? zy(d[0][0], d[0][1]) : function(A) { + return A === c || Q0(A, c, d); + }; + } + function fy(c, d) { + return bp(c) && qy(d) ? zy(bs(c), d) : function(A) { + var j = Ip(A, c); + return j === r && j === d ? Cp(A, c) : gu(d, j, S | C); + }; + } + function zl(c, d, A, j, G) { + c !== d && Y0(d, function(se, de) { + if (G || (G = new es()), Zr(se)) + pP(c, d, de, A, zl, j, G); + else { + var ve = j ? j(wp(c, de), se, de + "", c, d, G) : r; + ve === r && (ve = se), V0(c, de, ve); + } + }, oi); + } + function pP(c, d, A, j, G, se, de) { + var ve = wp(c, A), xe = wp(d, A), He = de.get(xe); + if (He) { + V0(c, A, He); + return; + } + var We = se ? se(ve, xe, A + "", c, d, de) : r, Je = We === r; + if (Je) { + var xt = sr(xe), Ot = !xt && So(xe), Wt = !xt && !Ot && fc(xe); + We = xe, xt || Ot || Wt ? sr(ve) ? We = ve : an(ve) ? We = ii(ve) : Ot ? (Je = !1, We = _y(xe, !0)) : Wt ? (Je = !1, We = Ey(xe, !0)) : We = [] : wu(xe) || fa(xe) ? (We = ve, fa(ve) ? We = yw(ve) : (!Zr(ve) || zs(ve)) && (We = Uy(xe))) : Je = !1; + } + Je && (de.set(xe, We), G(We, xe, j, se, de), de.delete(xe)), V0(c, A, We); + } + function ly(c, d) { + var A = c.length; + if (A) + return d += d < 0 ? A : 0, qs(d, A) ? c[d] : r; + } + function hy(c, d, A) { + d.length ? d = Xr(d, function(se) { + return sr(se) ? function(de) { + return aa(de, se.length === 1 ? se[0] : se); + } : se; + }) : d = [ai]; + var j = -1; + d = Xr(d, vi(Ut())); + var G = cy(c, function(se, de, ve) { + var xe = Xr(d, function(He) { + return He(se); + }); + return { criteria: xe, index: ++j, value: se }; + }); + return U9(G, function(se, de) { + return MP(se, de, A); + }); + } + function gP(c, d) { + return dy(c, d, function(A, j) { + return Cp(c, j); + }); + } + function dy(c, d, A) { + for (var j = -1, G = d.length, se = {}; ++j < G; ) { + var de = d[j], ve = aa(c, de); + A(ve, de) && mu(se, _o(de, c), ve); + } + return se; + } + function mP(c) { + return function(d) { + return aa(d, c); + }; + } + function rp(c, d, A, j) { + var G = j ? j9 : Qa, se = -1, de = d.length, ve = c; + for (c === d && (d = ii(d)), A && (ve = Xr(c, vi(A))); ++se < de; ) + for (var xe = 0, He = d[se], We = A ? A(He) : He; (xe = G(ve, We, xe, j)) > -1; ) + ve !== c && Ol.call(ve, xe, 1), Ol.call(c, xe, 1); + return c; + } + function py(c, d) { + for (var A = c ? d.length : 0, j = A - 1; A--; ) { + var G = d[A]; + if (A == j || G !== se) { + var se = G; + qs(G) ? Ol.call(c, G, 1) : op(c, G); + } + } + return c; + } + function np(c, d) { + return c + kl(Gb() * (d - c + 1)); + } + function vP(c, d, A, j) { + for (var G = -1, se = xn(Ll((d - c) / (A || 1)), 0), de = Ce(se); se--; ) + de[j ? se : ++G] = c, c += A; + return de; + } + function ip(c, d) { + var A = ""; + if (!c || d < 1 || d > P) + return A; + do + d % 2 && (A += c), d = kl(d / 2), d && (c += c); + while (d); + return A; + } + function hr(c, d) { + return xp(Hy(c, d, ai), c + ""); + } + function bP(c) { + return Xb(lc(c)); + } + function yP(c, d) { + var A = lc(c); + return Ql(A, oa(d, 0, A.length)); + } + function mu(c, d, A, j) { + if (!Zr(c)) + return c; + d = _o(d, c); + for (var G = -1, se = d.length, de = se - 1, ve = c; ve != null && ++G < se; ) { + var xe = bs(d[G]), He = A; + if (xe === "__proto__" || xe === "constructor" || xe === "prototype") + return c; + if (G != de) { + var We = ve[xe]; + He = j ? j(We, xe, ve) : r, He === r && (He = Zr(We) ? We : qs(d[G + 1]) ? [] : {}); + } + hu(ve, xe, He), ve = ve[xe]; + } + return c; + } + var gy = $l ? function(c, d) { + return $l.set(c, d), c; + } : ai, wP = Nl ? function(c, d) { + return Nl(c, "toString", { + configurable: !0, + enumerable: !1, + value: Tp(d), + writable: !0 + }); + } : ai; + function xP(c) { + return Ql(lc(c)); + } + function Ni(c, d, A) { + var j = -1, G = c.length; + d < 0 && (d = -d > G ? 0 : G + d), A = A > G ? G : A, A < 0 && (A += G), G = d > A ? 0 : A - d >>> 0, d >>>= 0; + for (var se = Ce(G); ++j < G; ) + se[j] = c[j + d]; + return se; + } + function _P(c, d) { + var A; + return wo(c, function(j, G, se) { + return A = d(j, G, se), !A; + }), !!A; + } + function Hl(c, d, A) { + var j = 0, G = c == null ? j : c.length; + if (typeof d == "number" && d === d && G <= q) { + for (; j < G; ) { + var se = j + G >>> 1, de = c[se]; + de !== null && !yi(de) && (A ? de <= d : de < d) ? j = se + 1 : G = se; + } + return G; + } + return sp(c, d, ai, A); + } + function sp(c, d, A, j) { + var G = 0, se = c == null ? 0 : c.length; + if (se === 0) + return 0; + d = A(d); + for (var de = d !== d, ve = d === null, xe = yi(d), He = d === r; G < se; ) { + var We = kl((G + se) / 2), Je = A(c[We]), xt = Je !== r, Ot = Je === null, Wt = Je === Je, fr = yi(Je); + if (de) + var Kt = j || Wt; + else He ? Kt = Wt && (j || xt) : ve ? Kt = Wt && xt && (j || !Ot) : xe ? Kt = Wt && xt && !Ot && (j || !fr) : Ot || fr ? Kt = !1 : Kt = j ? Je <= d : Je < d; + Kt ? G = We + 1 : se = We; + } + return jn(se, I); + } + function my(c, d) { + for (var A = -1, j = c.length, G = 0, se = []; ++A < j; ) { + var de = c[A], ve = d ? d(de) : de; + if (!A || !ts(ve, xe)) { + var xe = ve; + se[G++] = de === 0 ? 0 : de; + } + } + return se; + } + function vy(c) { + return typeof c == "number" ? c : yi(c) ? y : +c; + } + function bi(c) { + if (typeof c == "string") + return c; + if (sr(c)) + return Xr(c, bi) + ""; + if (yi(c)) + return Yb ? Yb.call(c) : ""; + var d = c + ""; + return d == "0" && 1 / c == -w ? "-0" : d; + } + function xo(c, d, A) { + var j = -1, G = El, se = c.length, de = !0, ve = [], xe = ve; + if (A) + de = !1, G = N0; + else if (se >= i) { + var He = d ? null : OP(c); + if (He) + return Al(He); + de = !1, G = ou, xe = new sa(); + } else + xe = d ? [] : ve; + e: + for (; ++j < se; ) { + var We = c[j], Je = d ? d(We) : We; + if (We = A || We !== 0 ? We : 0, de && Je === Je) { + for (var xt = xe.length; xt--; ) + if (xe[xt] === Je) + continue e; + d && xe.push(Je), ve.push(We); + } else G(xe, Je, A) || (xe !== ve && xe.push(Je), ve.push(We)); + } + return ve; + } + function op(c, d) { + return d = _o(d, c), c = Wy(c, d), c == null || delete c[bs(Li(d))]; + } + function by(c, d, A, j) { + return mu(c, d, A(aa(c, d)), j); + } + function Wl(c, d, A, j) { + for (var G = c.length, se = j ? G : -1; (j ? se-- : ++se < G) && d(c[se], se, c); ) + ; + return A ? Ni(c, j ? 0 : se, j ? se + 1 : G) : Ni(c, j ? se + 1 : 0, j ? G : se); + } + function yy(c, d) { + var A = c; + return A instanceof _r && (A = A.value()), L0(d, function(j, G) { + return G.func.apply(G.thisArg, vo([j], G.args)); + }, A); + } + function ap(c, d, A) { + var j = c.length; + if (j < 2) + return j ? xo(c[0]) : []; + for (var G = -1, se = Ce(j); ++G < j; ) + for (var de = c[G], ve = -1; ++ve < j; ) + ve != G && (se[G] = du(se[G] || de, c[ve], d, A)); + return xo(On(se, 1), d, A); + } + function wy(c, d, A) { + for (var j = -1, G = c.length, se = d.length, de = {}; ++j < G; ) { + var ve = j < se ? d[j] : r; + A(de, c[j], ve); + } + return de; + } + function cp(c) { + return an(c) ? c : []; + } + function up(c) { + return typeof c == "function" ? c : ai; + } + function _o(c, d) { + return sr(c) ? c : bp(c, d) ? [c] : Yy(Cr(c)); + } + var EP = hr; + function Eo(c, d, A) { + var j = c.length; + return A = A === r ? j : A, !d && A >= j ? c : Ni(c, d, A); + } + var xy = fA || function(c) { + return Er.clearTimeout(c); + }; + function _y(c, d) { + if (d) + return c.slice(); + var A = c.length, j = zb ? zb(A) : new c.constructor(A); + return c.copy(j), j; + } + function fp(c) { + var d = new c.constructor(c.byteLength); + return new Tl(d).set(new Tl(c)), d; + } + function SP(c, d) { + var A = d ? fp(c.buffer) : c.buffer; + return new c.constructor(A, c.byteOffset, c.byteLength); + } + function AP(c) { + var d = new c.constructor(c.source, Le.exec(c)); + return d.lastIndex = c.lastIndex, d; + } + function PP(c) { + return lu ? qr(lu.call(c)) : {}; + } + function Ey(c, d) { + var A = d ? fp(c.buffer) : c.buffer; + return new c.constructor(A, c.byteOffset, c.length); + } + function Sy(c, d) { + if (c !== d) { + var A = c !== r, j = c === null, G = c === c, se = yi(c), de = d !== r, ve = d === null, xe = d === d, He = yi(d); + if (!ve && !He && !se && c > d || se && de && xe && !ve && !He || j && de && xe || !A && xe || !G) + return 1; + if (!j && !se && !He && c < d || He && A && G && !j && !se || ve && A && G || !de && G || !xe) + return -1; + } + return 0; + } + function MP(c, d, A) { + for (var j = -1, G = c.criteria, se = d.criteria, de = G.length, ve = A.length; ++j < de; ) { + var xe = Sy(G[j], se[j]); + if (xe) { + if (j >= ve) + return xe; + var He = A[j]; + return xe * (He == "desc" ? -1 : 1); + } + } + return c.index - d.index; + } + function Ay(c, d, A, j) { + for (var G = -1, se = c.length, de = A.length, ve = -1, xe = d.length, He = xn(se - de, 0), We = Ce(xe + He), Je = !j; ++ve < xe; ) + We[ve] = d[ve]; + for (; ++G < de; ) + (Je || G < se) && (We[A[G]] = c[G]); + for (; He--; ) + We[ve++] = c[G++]; + return We; + } + function Py(c, d, A, j) { + for (var G = -1, se = c.length, de = -1, ve = A.length, xe = -1, He = d.length, We = xn(se - ve, 0), Je = Ce(We + He), xt = !j; ++G < We; ) + Je[G] = c[G]; + for (var Ot = G; ++xe < He; ) + Je[Ot + xe] = d[xe]; + for (; ++de < ve; ) + (xt || G < se) && (Je[Ot + A[de]] = c[G++]); + return Je; + } + function ii(c, d) { + var A = -1, j = c.length; + for (d || (d = Ce(j)); ++A < j; ) + d[A] = c[A]; + return d; + } + function vs(c, d, A, j) { + var G = !A; + A || (A = {}); + for (var se = -1, de = d.length; ++se < de; ) { + var ve = d[se], xe = j ? j(A[ve], c[ve], ve, A, c) : r; + xe === r && (xe = c[ve]), G ? Fs(A, ve, xe) : hu(A, ve, xe); + } + return A; + } + function IP(c, d) { + return vs(c, vp(c), d); + } + function CP(c, d) { + return vs(c, Fy(c), d); + } + function Kl(c, d) { + return function(A, j) { + var G = sr(A) ? N9 : XA, se = d ? d() : {}; + return G(A, c, Ut(j, 2), se); + }; + } + function ac(c) { + return hr(function(d, A) { + var j = -1, G = A.length, se = G > 1 ? A[G - 1] : r, de = G > 2 ? A[2] : r; + for (se = c.length > 3 && typeof se == "function" ? (G--, se) : r, de && Jn(A[0], A[1], de) && (se = G < 3 ? r : se, G = 1), d = qr(d); ++j < G; ) { + var ve = A[j]; + ve && c(d, ve, j, se); + } + return d; + }); + } + function My(c, d) { + return function(A, j) { + if (A == null) + return A; + if (!si(A)) + return c(A, j); + for (var G = A.length, se = d ? G : -1, de = qr(A); (d ? se-- : ++se < G) && j(de[se], se, de) !== !1; ) + ; + return A; + }; + } + function Iy(c) { + return function(d, A, j) { + for (var G = -1, se = qr(d), de = j(d), ve = de.length; ve--; ) { + var xe = de[c ? ve : ++G]; + if (A(se[xe], xe, se) === !1) + break; + } + return d; + }; + } + function RP(c, d, A) { + var j = d & D, G = vu(c); + function se() { + var de = this && this !== Er && this instanceof se ? G : c; + return de.apply(j ? A : this, arguments); + } + return se; + } + function Cy(c) { + return function(d) { + d = Cr(d); + var A = ec(d) ? Qi(d) : r, j = A ? A[0] : d.charAt(0), G = A ? Eo(A, 1).join("") : d.slice(1); + return j[c]() + G; + }; + } + function cc(c) { + return function(d) { + return L0(Mw(Pw(d).replace(iu, "")), c, ""); + }; + } + function vu(c) { + return function() { + var d = arguments; + switch (d.length) { + case 0: + return new c(); + case 1: + return new c(d[0]); + case 2: + return new c(d[0], d[1]); + case 3: + return new c(d[0], d[1], d[2]); + case 4: + return new c(d[0], d[1], d[2], d[3]); + case 5: + return new c(d[0], d[1], d[2], d[3], d[4]); + case 6: + return new c(d[0], d[1], d[2], d[3], d[4], d[5]); + case 7: + return new c(d[0], d[1], d[2], d[3], d[4], d[5], d[6]); + } + var A = oc(c.prototype), j = c.apply(A, d); + return Zr(j) ? j : A; + }; + } + function TP(c, d, A) { + var j = vu(c); + function G() { + for (var se = arguments.length, de = Ce(se), ve = se, xe = uc(G); ve--; ) + de[ve] = arguments[ve]; + var He = se < 3 && de[0] !== xe && de[se - 1] !== xe ? [] : bo(de, xe); + if (se -= He.length, se < A) + return Ny( + c, + d, + Vl, + G.placeholder, + r, + de, + He, + r, + r, + A - se + ); + var We = this && this !== Er && this instanceof G ? j : c; + return Sn(We, this, de); + } + return G; + } + function Ry(c) { + return function(d, A, j) { + var G = qr(d); + if (!si(d)) { + var se = Ut(A, 3); + d = An(d), A = function(ve) { + return se(G[ve], ve, G); + }; + } + var de = c(d, A, j); + return de > -1 ? G[se ? d[de] : de] : r; + }; + } + function Ty(c) { + return Us(function(d) { + var A = d.length, j = A, G = Di.prototype.thru; + for (c && d.reverse(); j--; ) { + var se = d[j]; + if (typeof se != "function") + throw new Ti(o); + if (G && !de && Xl(se) == "wrapper") + var de = new Di([], !0); + } + for (j = de ? j : A; ++j < A; ) { + se = d[j]; + var ve = Xl(se), xe = ve == "wrapper" ? gp(se) : r; + xe && yp(xe[0]) && xe[1] == (R | z | B | W) && !xe[4].length && xe[9] == 1 ? de = de[Xl(xe[0])].apply(de, xe[3]) : de = se.length == 1 && yp(se) ? de[ve]() : de.thru(se); + } + return function() { + var He = arguments, We = He[0]; + if (de && He.length == 1 && sr(We)) + return de.plant(We).value(); + for (var Je = 0, xt = A ? d[Je].apply(this, He) : We; ++Je < A; ) + xt = d[Je].call(this, xt); + return xt; + }; + }); + } + function Vl(c, d, A, j, G, se, de, ve, xe, He) { + var We = d & R, Je = d & D, xt = d & $, Ot = d & (z | k), Wt = d & J, fr = xt ? r : vu(c); + function Kt() { + for (var yr = arguments.length, Sr = Ce(yr), wi = yr; wi--; ) + Sr[wi] = arguments[wi]; + if (Ot) + var Xn = uc(Kt), xi = z9(Sr, Xn); + if (j && (Sr = Ay(Sr, j, G, Ot)), se && (Sr = Py(Sr, se, de, Ot)), yr -= xi, Ot && yr < He) { + var cn = bo(Sr, Xn); + return Ny( + c, + d, + Vl, + Kt.placeholder, + A, + Sr, + cn, + ve, + xe, + He - yr + ); + } + var rs = Je ? A : this, Ws = xt ? rs[c] : c; + return yr = Sr.length, ve ? Sr = XP(Sr, ve) : Wt && yr > 1 && Sr.reverse(), We && xe < yr && (Sr.length = xe), this && this !== Er && this instanceof Kt && (Ws = fr || vu(Ws)), Ws.apply(rs, Sr); + } + return Kt; + } + function Dy(c, d) { + return function(A, j) { + return sP(A, c, d(j), {}); + }; + } + function Gl(c, d) { + return function(A, j) { + var G; + if (A === r && j === r) + return d; + if (A !== r && (G = A), j !== r) { + if (G === r) + return j; + typeof A == "string" || typeof j == "string" ? (A = bi(A), j = bi(j)) : (A = vy(A), j = vy(j)), G = c(A, j); + } + return G; + }; + } + function lp(c) { + return Us(function(d) { + return d = Xr(d, vi(Ut())), hr(function(A) { + var j = this; + return c(d, function(G) { + return Sn(G, j, A); + }); + }); + }); + } + function Yl(c, d) { + d = d === r ? " " : bi(d); + var A = d.length; + if (A < 2) + return A ? ip(d, c) : d; + var j = ip(d, Ll(c / tc(d))); + return ec(d) ? Eo(Qi(j), 0, c).join("") : j.slice(0, c); + } + function DP(c, d, A, j) { + var G = d & D, se = vu(c); + function de() { + for (var ve = -1, xe = arguments.length, He = -1, We = j.length, Je = Ce(We + xe), xt = this && this !== Er && this instanceof de ? se : c; ++He < We; ) + Je[He] = j[He]; + for (; xe--; ) + Je[He++] = arguments[++ve]; + return Sn(xt, G ? A : this, Je); + } + return de; + } + function Oy(c) { + return function(d, A, j) { + return j && typeof j != "number" && Jn(d, A, j) && (A = j = r), d = Hs(d), A === r ? (A = d, d = 0) : A = Hs(A), j = j === r ? d < A ? 1 : -1 : Hs(j), vP(d, A, j, c); + }; + } + function Jl(c) { + return function(d, A) { + return typeof d == "string" && typeof A == "string" || (d = ki(d), A = ki(A)), c(d, A); + }; + } + function Ny(c, d, A, j, G, se, de, ve, xe, He) { + var We = d & z, Je = We ? de : r, xt = We ? r : de, Ot = We ? se : r, Wt = We ? r : se; + d |= We ? B : U, d &= ~(We ? U : B), d & N || (d &= -4); + var fr = [ + c, + d, + G, + Ot, + Je, + Wt, + xt, + ve, + xe, + He + ], Kt = A.apply(r, fr); + return yp(c) && Ky(Kt, fr), Kt.placeholder = j, Vy(Kt, c, d); + } + function hp(c) { + var d = wn[c]; + return function(A, j) { + if (A = ki(A), j = j == null ? 0 : jn(cr(j), 292), j && Vb(A)) { + var G = (Cr(A) + "e").split("e"), se = d(G[0] + "e" + (+G[1] + j)); + return G = (Cr(se) + "e").split("e"), +(G[0] + "e" + (+G[1] - j)); + } + return d(A); + }; + } + var OP = ic && 1 / Al(new ic([, -0]))[1] == w ? function(c) { + return new ic(c); + } : Np; + function Ly(c) { + return function(d) { + var A = Un(d); + return A == ae ? q0(d) : A == Me ? J9(d) : q9(d, c(d)); + }; + } + function js(c, d, A, j, G, se, de, ve) { + var xe = d & $; + if (!xe && typeof c != "function") + throw new Ti(o); + var He = j ? j.length : 0; + if (He || (d &= -97, j = G = r), de = de === r ? de : xn(cr(de), 0), ve = ve === r ? ve : cr(ve), He -= G ? G.length : 0, d & U) { + var We = j, Je = G; + j = G = r; + } + var xt = xe ? r : gp(c), Ot = [ + c, + d, + A, + j, + G, + We, + Je, + se, + de, + ve + ]; + if (xt && GP(Ot, xt), c = Ot[0], d = Ot[1], A = Ot[2], j = Ot[3], G = Ot[4], ve = Ot[9] = Ot[9] === r ? xe ? 0 : c.length : xn(Ot[9] - He, 0), !ve && d & (z | k) && (d &= -25), !d || d == D) + var Wt = RP(c, d, A); + else d == z || d == k ? Wt = TP(c, d, ve) : (d == B || d == (D | B)) && !G.length ? Wt = DP(c, d, A, j) : Wt = Vl.apply(r, Ot); + var fr = xt ? gy : Ky; + return Vy(fr(Wt, Ot), c, d); + } + function ky(c, d, A, j) { + return c === r || ts(c, nc[A]) && !Rr.call(j, A) ? d : c; + } + function $y(c, d, A, j, G, se) { + return Zr(c) && Zr(d) && (se.set(d, c), zl(c, d, r, $y, se), se.delete(d)), c; + } + function NP(c) { + return wu(c) ? r : c; + } + function By(c, d, A, j, G, se) { + var de = A & S, ve = c.length, xe = d.length; + if (ve != xe && !(de && xe > ve)) + return !1; + var He = se.get(c), We = se.get(d); + if (He && We) + return He == d && We == c; + var Je = -1, xt = !0, Ot = A & C ? new sa() : r; + for (se.set(c, d), se.set(d, c); ++Je < ve; ) { + var Wt = c[Je], fr = d[Je]; + if (j) + var Kt = de ? j(fr, Wt, Je, d, c, se) : j(Wt, fr, Je, c, d, se); + if (Kt !== r) { + if (Kt) + continue; + xt = !1; + break; + } + if (Ot) { + if (!k0(d, function(yr, Sr) { + if (!ou(Ot, Sr) && (Wt === yr || G(Wt, yr, A, j, se))) + return Ot.push(Sr); + })) { + xt = !1; + break; + } + } else if (!(Wt === fr || G(Wt, fr, A, j, se))) { + xt = !1; + break; + } + } + return se.delete(c), se.delete(d), xt; + } + function LP(c, d, A, j, G, se, de) { + switch (A) { + case Ze: + if (c.byteLength != d.byteLength || c.byteOffset != d.byteOffset) + return !1; + c = c.buffer, d = d.buffer; + case _e: + return !(c.byteLength != d.byteLength || !se(new Tl(c), new Tl(d))); + case X: + case ee: + case fe: + return ts(+c, +d); + case Z: + return c.name == d.name && c.message == d.message; + case $e: + case Oe: + return c == d + ""; + case ae: + var ve = q0; + case Me: + var xe = j & S; + if (ve || (ve = Al), c.size != d.size && !xe) + return !1; + var He = de.get(c); + if (He) + return He == d; + j |= C, de.set(c, d); + var We = By(ve(c), ve(d), j, G, se, de); + return de.delete(c), We; + case ze: + if (lu) + return lu.call(c) == lu.call(d); + } + return !1; + } + function kP(c, d, A, j, G, se) { + var de = A & S, ve = dp(c), xe = ve.length, He = dp(d), We = He.length; + if (xe != We && !de) + return !1; + for (var Je = xe; Je--; ) { + var xt = ve[Je]; + if (!(de ? xt in d : Rr.call(d, xt))) + return !1; + } + var Ot = se.get(c), Wt = se.get(d); + if (Ot && Wt) + return Ot == d && Wt == c; + var fr = !0; + se.set(c, d), se.set(d, c); + for (var Kt = de; ++Je < xe; ) { + xt = ve[Je]; + var yr = c[xt], Sr = d[xt]; + if (j) + var wi = de ? j(Sr, yr, xt, d, c, se) : j(yr, Sr, xt, c, d, se); + if (!(wi === r ? yr === Sr || G(yr, Sr, A, j, se) : wi)) { + fr = !1; + break; + } + Kt || (Kt = xt == "constructor"); + } + if (fr && !Kt) { + var Xn = c.constructor, xi = d.constructor; + Xn != xi && "constructor" in c && "constructor" in d && !(typeof Xn == "function" && Xn instanceof Xn && typeof xi == "function" && xi instanceof xi) && (fr = !1); + } + return se.delete(c), se.delete(d), fr; + } + function Us(c) { + return xp(Hy(c, r, Qy), c + ""); + } + function dp(c) { + return iy(c, An, vp); + } + function pp(c) { + return iy(c, oi, Fy); + } + var gp = $l ? function(c) { + return $l.get(c); + } : Np; + function Xl(c) { + for (var d = c.name + "", A = sc[d], j = Rr.call(sc, d) ? A.length : 0; j--; ) { + var G = A[j], se = G.func; + if (se == null || se == c) + return G.name; + } + return d; + } + function uc(c) { + var d = Rr.call(te, "placeholder") ? te : c; + return d.placeholder; + } + function Ut() { + var c = te.iteratee || Dp; + return c = c === Dp ? ay : c, arguments.length ? c(arguments[0], arguments[1]) : c; + } + function Zl(c, d) { + var A = c.__data__; + return HP(d) ? A[typeof d == "string" ? "string" : "hash"] : A.map; + } + function mp(c) { + for (var d = An(c), A = d.length; A--; ) { + var j = d[A], G = c[j]; + d[A] = [j, G, qy(G)]; + } + return d; + } + function ca(c, d) { + var A = V9(c, d); + return oy(A) ? A : r; + } + function $P(c) { + var d = Rr.call(c, na), A = c[na]; + try { + c[na] = r; + var j = !0; + } catch { + } + var G = Cl.call(c); + return j && (d ? c[na] = A : delete c[na]), G; + } + var vp = H0 ? function(c) { + return c == null ? [] : (c = qr(c), mo(H0(c), function(d) { + return Wb.call(c, d); + })); + } : Lp, Fy = H0 ? function(c) { + for (var d = []; c; ) + vo(d, vp(c)), c = Dl(c); + return d; + } : Lp, Un = Yn; + (W0 && Un(new W0(new ArrayBuffer(1))) != Ze || cu && Un(new cu()) != ae || K0 && Un(K0.resolve()) != Te || ic && Un(new ic()) != Me || uu && Un(new uu()) != je) && (Un = function(c) { + var d = Yn(c), A = d == Ae ? c.constructor : r, j = A ? ua(A) : ""; + if (j) + switch (j) { + case yA: + return Ze; + case wA: + return ae; + case xA: + return Te; + case _A: + return Me; + case EA: + return je; + } + return d; + }); + function BP(c, d, A) { + for (var j = -1, G = A.length; ++j < G; ) { + var se = A[j], de = se.size; + switch (se.type) { + case "drop": + c += de; + break; + case "dropRight": + d -= de; + break; + case "take": + d = jn(d, c + de); + break; + case "takeRight": + c = xn(c, d - de); + break; + } + } + return { start: c, end: d }; + } + function FP(c) { + var d = c.match(T); + return d ? d[1].split(F) : []; + } + function jy(c, d, A) { + d = _o(d, c); + for (var j = -1, G = d.length, se = !1; ++j < G; ) { + var de = bs(d[j]); + if (!(se = c != null && A(c, de))) + break; + c = c[de]; + } + return se || ++j != G ? se : (G = c == null ? 0 : c.length, !!G && sh(G) && qs(de, G) && (sr(c) || fa(c))); + } + function jP(c) { + var d = c.length, A = new c.constructor(d); + return d && typeof c[0] == "string" && Rr.call(c, "index") && (A.index = c.index, A.input = c.input), A; + } + function Uy(c) { + return typeof c.constructor == "function" && !bu(c) ? oc(Dl(c)) : {}; + } + function UP(c, d, A) { + var j = c.constructor; + switch (d) { + case _e: + return fp(c); + case X: + case ee: + return new j(+c); + case Ze: + return SP(c, A); + case ot: + case ke: + case rt: + case nt: + case Ge: + case ht: + case lt: + case ct: + case qt: + return Ey(c, A); + case ae: + return new j(); + case fe: + case Oe: + return new j(c); + case $e: + return AP(c); + case Me: + return new j(); + case ze: + return PP(c); + } + } + function qP(c, d) { + var A = d.length; + if (!A) + return c; + var j = A - 1; + return d[j] = (A > 1 ? "& " : "") + d[j], d = d.join(A > 2 ? ", " : " "), c.replace(Y, `{ +/* [wrapped with ` + d + `] */ +`); + } + function zP(c) { + return sr(c) || fa(c) || !!(Kb && c && c[Kb]); + } + function qs(c, d) { + var A = typeof c; + return d = d ?? P, !!d && (A == "number" || A != "symbol" && st.test(c)) && c > -1 && c % 1 == 0 && c < d; + } + function Jn(c, d, A) { + if (!Zr(A)) + return !1; + var j = typeof d; + return (j == "number" ? si(A) && qs(d, A.length) : j == "string" && d in A) ? ts(A[d], c) : !1; + } + function bp(c, d) { + if (sr(c)) + return !1; + var A = typeof c; + return A == "number" || A == "symbol" || A == "boolean" || c == null || yi(c) ? !0 : Bt.test(c) || !mt.test(c) || d != null && c in qr(d); + } + function HP(c) { + var d = typeof c; + return d == "string" || d == "number" || d == "symbol" || d == "boolean" ? c !== "__proto__" : c === null; + } + function yp(c) { + var d = Xl(c), A = te[d]; + if (typeof A != "function" || !(d in _r.prototype)) + return !1; + if (c === A) + return !0; + var j = gp(A); + return !!j && c === j[0]; + } + function WP(c) { + return !!qb && qb in c; + } + var KP = Ml ? zs : kp; + function bu(c) { + var d = c && c.constructor, A = typeof d == "function" && d.prototype || nc; + return c === A; + } + function qy(c) { + return c === c && !Zr(c); + } + function zy(c, d) { + return function(A) { + return A == null ? !1 : A[c] === d && (d !== r || c in qr(A)); + }; + } + function VP(c) { + var d = nh(c, function(j) { + return A.size === u && A.clear(), j; + }), A = d.cache; + return d; + } + function GP(c, d) { + var A = c[1], j = d[1], G = A | j, se = G < (D | $ | R), de = j == R && A == z || j == R && A == W && c[7].length <= d[8] || j == (R | W) && d[7].length <= d[8] && A == z; + if (!(se || de)) + return c; + j & D && (c[2] = d[2], G |= A & D ? 0 : N); + var ve = d[3]; + if (ve) { + var xe = c[3]; + c[3] = xe ? Ay(xe, ve, d[4]) : ve, c[4] = xe ? bo(c[3], h) : d[4]; + } + return ve = d[5], ve && (xe = c[5], c[5] = xe ? Py(xe, ve, d[6]) : ve, c[6] = xe ? bo(c[5], h) : d[6]), ve = d[7], ve && (c[7] = ve), j & R && (c[8] = c[8] == null ? d[8] : jn(c[8], d[8])), c[9] == null && (c[9] = d[9]), c[0] = d[0], c[1] = G, c; + } + function YP(c) { + var d = []; + if (c != null) + for (var A in qr(c)) + d.push(A); + return d; + } + function JP(c) { + return Cl.call(c); + } + function Hy(c, d, A) { + return d = xn(d === r ? c.length - 1 : d, 0), function() { + for (var j = arguments, G = -1, se = xn(j.length - d, 0), de = Ce(se); ++G < se; ) + de[G] = j[d + G]; + G = -1; + for (var ve = Ce(d + 1); ++G < d; ) + ve[G] = j[G]; + return ve[d] = A(de), Sn(c, this, ve); + }; + } + function Wy(c, d) { + return d.length < 2 ? c : aa(c, Ni(d, 0, -1)); + } + function XP(c, d) { + for (var A = c.length, j = jn(d.length, A), G = ii(c); j--; ) { + var se = d[j]; + c[j] = qs(se, A) ? G[se] : r; + } + return c; + } + function wp(c, d) { + if (!(d === "constructor" && typeof c[d] == "function") && d != "__proto__") + return c[d]; + } + var Ky = Gy(gy), yu = hA || function(c, d) { + return Er.setTimeout(c, d); + }, xp = Gy(wP); + function Vy(c, d, A) { + var j = d + ""; + return xp(c, qP(j, ZP(FP(j), A))); + } + function Gy(c) { + var d = 0, A = 0; + return function() { + var j = mA(), G = b - (j - A); + if (A = j, G > 0) { + if (++d >= E) + return arguments[0]; + } else + d = 0; + return c.apply(r, arguments); + }; + } + function Ql(c, d) { + var A = -1, j = c.length, G = j - 1; + for (d = d === r ? j : d; ++A < d; ) { + var se = np(A, G), de = c[se]; + c[se] = c[A], c[A] = de; + } + return c.length = d, c; + } + var Yy = VP(function(c) { + var d = []; + return c.charCodeAt(0) === 46 && d.push(""), c.replace(Ft, function(A, j, G, se) { + d.push(G ? se.replace(me, "$1") : j || A); + }), d; + }); + function bs(c) { + if (typeof c == "string" || yi(c)) + return c; + var d = c + ""; + return d == "0" && 1 / c == -w ? "-0" : d; + } + function ua(c) { + if (c != null) { + try { + return Il.call(c); + } catch { + } + try { + return c + ""; + } catch { + } + } + return ""; + } + function ZP(c, d) { + return Ri(ce, function(A) { + var j = "_." + A[0]; + d & A[1] && !El(c, j) && c.push(j); + }), c.sort(); + } + function Jy(c) { + if (c instanceof _r) + return c.clone(); + var d = new Di(c.__wrapped__, c.__chain__); + return d.__actions__ = ii(c.__actions__), d.__index__ = c.__index__, d.__values__ = c.__values__, d; + } + function QP(c, d, A) { + (A ? Jn(c, d, A) : d === r) ? d = 1 : d = xn(cr(d), 0); + var j = c == null ? 0 : c.length; + if (!j || d < 1) + return []; + for (var G = 0, se = 0, de = Ce(Ll(j / d)); G < j; ) + de[se++] = Ni(c, G, G += d); + return de; + } + function eM(c) { + for (var d = -1, A = c == null ? 0 : c.length, j = 0, G = []; ++d < A; ) { + var se = c[d]; + se && (G[j++] = se); + } + return G; + } + function tM() { + var c = arguments.length; + if (!c) + return []; + for (var d = Ce(c - 1), A = arguments[0], j = c; j--; ) + d[j - 1] = arguments[j]; + return vo(sr(A) ? ii(A) : [A], On(d, 1)); + } + var rM = hr(function(c, d) { + return an(c) ? du(c, On(d, 1, an, !0)) : []; + }), nM = hr(function(c, d) { + var A = Li(d); + return an(A) && (A = r), an(c) ? du(c, On(d, 1, an, !0), Ut(A, 2)) : []; + }), iM = hr(function(c, d) { + var A = Li(d); + return an(A) && (A = r), an(c) ? du(c, On(d, 1, an, !0), r, A) : []; + }); + function sM(c, d, A) { + var j = c == null ? 0 : c.length; + return j ? (d = A || d === r ? 1 : cr(d), Ni(c, d < 0 ? 0 : d, j)) : []; + } + function oM(c, d, A) { + var j = c == null ? 0 : c.length; + return j ? (d = A || d === r ? 1 : cr(d), d = j - d, Ni(c, 0, d < 0 ? 0 : d)) : []; + } + function aM(c, d) { + return c && c.length ? Wl(c, Ut(d, 3), !0, !0) : []; + } + function cM(c, d) { + return c && c.length ? Wl(c, Ut(d, 3), !0) : []; + } + function uM(c, d, A, j) { + var G = c == null ? 0 : c.length; + return G ? (A && typeof A != "number" && Jn(c, d, A) && (A = 0, j = G), tP(c, d, A, j)) : []; + } + function Xy(c, d, A) { + var j = c == null ? 0 : c.length; + if (!j) + return -1; + var G = A == null ? 0 : cr(A); + return G < 0 && (G = xn(j + G, 0)), Sl(c, Ut(d, 3), G); + } + function Zy(c, d, A) { + var j = c == null ? 0 : c.length; + if (!j) + return -1; + var G = j - 1; + return A !== r && (G = cr(A), G = A < 0 ? xn(j + G, 0) : jn(G, j - 1)), Sl(c, Ut(d, 3), G, !0); + } + function Qy(c) { + var d = c == null ? 0 : c.length; + return d ? On(c, 1) : []; + } + function fM(c) { + var d = c == null ? 0 : c.length; + return d ? On(c, w) : []; + } + function lM(c, d) { + var A = c == null ? 0 : c.length; + return A ? (d = d === r ? 1 : cr(d), On(c, d)) : []; + } + function hM(c) { + for (var d = -1, A = c == null ? 0 : c.length, j = {}; ++d < A; ) { + var G = c[d]; + j[G[0]] = G[1]; + } + return j; + } + function ew(c) { + return c && c.length ? c[0] : r; + } + function dM(c, d, A) { + var j = c == null ? 0 : c.length; + if (!j) + return -1; + var G = A == null ? 0 : cr(A); + return G < 0 && (G = xn(j + G, 0)), Qa(c, d, G); + } + function pM(c) { + var d = c == null ? 0 : c.length; + return d ? Ni(c, 0, -1) : []; + } + var gM = hr(function(c) { + var d = Xr(c, cp); + return d.length && d[0] === c[0] ? Z0(d) : []; + }), mM = hr(function(c) { + var d = Li(c), A = Xr(c, cp); + return d === Li(A) ? d = r : A.pop(), A.length && A[0] === c[0] ? Z0(A, Ut(d, 2)) : []; + }), vM = hr(function(c) { + var d = Li(c), A = Xr(c, cp); + return d = typeof d == "function" ? d : r, d && A.pop(), A.length && A[0] === c[0] ? Z0(A, r, d) : []; + }); + function bM(c, d) { + return c == null ? "" : pA.call(c, d); + } + function Li(c) { + var d = c == null ? 0 : c.length; + return d ? c[d - 1] : r; + } + function yM(c, d, A) { + var j = c == null ? 0 : c.length; + if (!j) + return -1; + var G = j; + return A !== r && (G = cr(A), G = G < 0 ? xn(j + G, 0) : jn(G, j - 1)), d === d ? Z9(c, d, G) : Sl(c, Nb, G, !0); + } + function wM(c, d) { + return c && c.length ? ly(c, cr(d)) : r; + } + var xM = hr(tw); + function tw(c, d) { + return c && c.length && d && d.length ? rp(c, d) : c; + } + function _M(c, d, A) { + return c && c.length && d && d.length ? rp(c, d, Ut(A, 2)) : c; + } + function EM(c, d, A) { + return c && c.length && d && d.length ? rp(c, d, r, A) : c; + } + var SM = Us(function(c, d) { + var A = c == null ? 0 : c.length, j = G0(c, d); + return py(c, Xr(d, function(G) { + return qs(G, A) ? +G : G; + }).sort(Sy)), j; + }); + function AM(c, d) { + var A = []; + if (!(c && c.length)) + return A; + var j = -1, G = [], se = c.length; + for (d = Ut(d, 3); ++j < se; ) { + var de = c[j]; + d(de, j, c) && (A.push(de), G.push(j)); + } + return py(c, G), A; + } + function _p(c) { + return c == null ? c : bA.call(c); + } + function PM(c, d, A) { + var j = c == null ? 0 : c.length; + return j ? (A && typeof A != "number" && Jn(c, d, A) ? (d = 0, A = j) : (d = d == null ? 0 : cr(d), A = A === r ? j : cr(A)), Ni(c, d, A)) : []; + } + function MM(c, d) { + return Hl(c, d); + } + function IM(c, d, A) { + return sp(c, d, Ut(A, 2)); + } + function CM(c, d) { + var A = c == null ? 0 : c.length; + if (A) { + var j = Hl(c, d); + if (j < A && ts(c[j], d)) + return j; + } + return -1; + } + function RM(c, d) { + return Hl(c, d, !0); + } + function TM(c, d, A) { + return sp(c, d, Ut(A, 2), !0); + } + function DM(c, d) { + var A = c == null ? 0 : c.length; + if (A) { + var j = Hl(c, d, !0) - 1; + if (ts(c[j], d)) + return j; + } + return -1; + } + function OM(c) { + return c && c.length ? my(c) : []; + } + function NM(c, d) { + return c && c.length ? my(c, Ut(d, 2)) : []; + } + function LM(c) { + var d = c == null ? 0 : c.length; + return d ? Ni(c, 1, d) : []; + } + function kM(c, d, A) { + return c && c.length ? (d = A || d === r ? 1 : cr(d), Ni(c, 0, d < 0 ? 0 : d)) : []; + } + function $M(c, d, A) { + var j = c == null ? 0 : c.length; + return j ? (d = A || d === r ? 1 : cr(d), d = j - d, Ni(c, d < 0 ? 0 : d, j)) : []; + } + function BM(c, d) { + return c && c.length ? Wl(c, Ut(d, 3), !1, !0) : []; + } + function FM(c, d) { + return c && c.length ? Wl(c, Ut(d, 3)) : []; + } + var jM = hr(function(c) { + return xo(On(c, 1, an, !0)); + }), UM = hr(function(c) { + var d = Li(c); + return an(d) && (d = r), xo(On(c, 1, an, !0), Ut(d, 2)); + }), qM = hr(function(c) { + var d = Li(c); + return d = typeof d == "function" ? d : r, xo(On(c, 1, an, !0), r, d); + }); + function zM(c) { + return c && c.length ? xo(c) : []; + } + function HM(c, d) { + return c && c.length ? xo(c, Ut(d, 2)) : []; + } + function WM(c, d) { + return d = typeof d == "function" ? d : r, c && c.length ? xo(c, r, d) : []; + } + function Ep(c) { + if (!(c && c.length)) + return []; + var d = 0; + return c = mo(c, function(A) { + if (an(A)) + return d = xn(A.length, d), !0; + }), j0(d, function(A) { + return Xr(c, $0(A)); + }); + } + function rw(c, d) { + if (!(c && c.length)) + return []; + var A = Ep(c); + return d == null ? A : Xr(A, function(j) { + return Sn(d, r, j); + }); + } + var KM = hr(function(c, d) { + return an(c) ? du(c, d) : []; + }), VM = hr(function(c) { + return ap(mo(c, an)); + }), GM = hr(function(c) { + var d = Li(c); + return an(d) && (d = r), ap(mo(c, an), Ut(d, 2)); + }), YM = hr(function(c) { + var d = Li(c); + return d = typeof d == "function" ? d : r, ap(mo(c, an), r, d); + }), JM = hr(Ep); + function XM(c, d) { + return wy(c || [], d || [], hu); + } + function ZM(c, d) { + return wy(c || [], d || [], mu); + } + var QM = hr(function(c) { + var d = c.length, A = d > 1 ? c[d - 1] : r; + return A = typeof A == "function" ? (c.pop(), A) : r, rw(c, A); + }); + function nw(c) { + var d = te(c); + return d.__chain__ = !0, d; + } + function eI(c, d) { + return d(c), c; + } + function eh(c, d) { + return d(c); + } + var tI = Us(function(c) { + var d = c.length, A = d ? c[0] : 0, j = this.__wrapped__, G = function(se) { + return G0(se, c); + }; + return d > 1 || this.__actions__.length || !(j instanceof _r) || !qs(A) ? this.thru(G) : (j = j.slice(A, +A + (d ? 1 : 0)), j.__actions__.push({ + func: eh, + args: [G], + thisArg: r + }), new Di(j, this.__chain__).thru(function(se) { + return d && !se.length && se.push(r), se; + })); + }); + function rI() { + return nw(this); + } + function nI() { + return new Di(this.value(), this.__chain__); + } + function iI() { + this.__values__ === r && (this.__values__ = vw(this.value())); + var c = this.__index__ >= this.__values__.length, d = c ? r : this.__values__[this.__index__++]; + return { done: c, value: d }; + } + function sI() { + return this; + } + function oI(c) { + for (var d, A = this; A instanceof Fl; ) { + var j = Jy(A); + j.__index__ = 0, j.__values__ = r, d ? G.__wrapped__ = j : d = j; + var G = j; + A = A.__wrapped__; + } + return G.__wrapped__ = c, d; + } + function aI() { + var c = this.__wrapped__; + if (c instanceof _r) { + var d = c; + return this.__actions__.length && (d = new _r(this)), d = d.reverse(), d.__actions__.push({ + func: eh, + args: [_p], + thisArg: r + }), new Di(d, this.__chain__); + } + return this.thru(_p); + } + function cI() { + return yy(this.__wrapped__, this.__actions__); + } + var uI = Kl(function(c, d, A) { + Rr.call(c, A) ? ++c[A] : Fs(c, A, 1); + }); + function fI(c, d, A) { + var j = sr(c) ? Db : eP; + return A && Jn(c, d, A) && (d = r), j(c, Ut(d, 3)); + } + function lI(c, d) { + var A = sr(c) ? mo : ry; + return A(c, Ut(d, 3)); + } + var hI = Ry(Xy), dI = Ry(Zy); + function pI(c, d) { + return On(th(c, d), 1); + } + function gI(c, d) { + return On(th(c, d), w); + } + function mI(c, d, A) { + return A = A === r ? 1 : cr(A), On(th(c, d), A); + } + function iw(c, d) { + var A = sr(c) ? Ri : wo; + return A(c, Ut(d, 3)); + } + function sw(c, d) { + var A = sr(c) ? L9 : ty; + return A(c, Ut(d, 3)); + } + var vI = Kl(function(c, d, A) { + Rr.call(c, A) ? c[A].push(d) : Fs(c, A, [d]); + }); + function bI(c, d, A, j) { + c = si(c) ? c : lc(c), A = A && !j ? cr(A) : 0; + var G = c.length; + return A < 0 && (A = xn(G + A, 0)), oh(c) ? A <= G && c.indexOf(d, A) > -1 : !!G && Qa(c, d, A) > -1; + } + var yI = hr(function(c, d, A) { + var j = -1, G = typeof d == "function", se = si(c) ? Ce(c.length) : []; + return wo(c, function(de) { + se[++j] = G ? Sn(d, de, A) : pu(de, d, A); + }), se; + }), wI = Kl(function(c, d, A) { + Fs(c, A, d); + }); + function th(c, d) { + var A = sr(c) ? Xr : cy; + return A(c, Ut(d, 3)); + } + function xI(c, d, A, j) { + return c == null ? [] : (sr(d) || (d = d == null ? [] : [d]), A = j ? r : A, sr(A) || (A = A == null ? [] : [A]), hy(c, d, A)); + } + var _I = Kl(function(c, d, A) { + c[A ? 0 : 1].push(d); + }, function() { + return [[], []]; + }); + function EI(c, d, A) { + var j = sr(c) ? L0 : kb, G = arguments.length < 3; + return j(c, Ut(d, 4), A, G, wo); + } + function SI(c, d, A) { + var j = sr(c) ? k9 : kb, G = arguments.length < 3; + return j(c, Ut(d, 4), A, G, ty); + } + function AI(c, d) { + var A = sr(c) ? mo : ry; + return A(c, ih(Ut(d, 3))); + } + function PI(c) { + var d = sr(c) ? Xb : bP; + return d(c); + } + function MI(c, d, A) { + (A ? Jn(c, d, A) : d === r) ? d = 1 : d = cr(d); + var j = sr(c) ? YA : yP; + return j(c, d); + } + function II(c) { + var d = sr(c) ? JA : xP; + return d(c); + } + function CI(c) { + if (c == null) + return 0; + if (si(c)) + return oh(c) ? tc(c) : c.length; + var d = Un(c); + return d == ae || d == Me ? c.size : ep(c).length; + } + function RI(c, d, A) { + var j = sr(c) ? k0 : _P; + return A && Jn(c, d, A) && (d = r), j(c, Ut(d, 3)); + } + var TI = hr(function(c, d) { + if (c == null) + return []; + var A = d.length; + return A > 1 && Jn(c, d[0], d[1]) ? d = [] : A > 2 && Jn(d[0], d[1], d[2]) && (d = [d[0]]), hy(c, On(d, 1), []); + }), rh = lA || function() { + return Er.Date.now(); + }; + function DI(c, d) { + if (typeof d != "function") + throw new Ti(o); + return c = cr(c), function() { + if (--c < 1) + return d.apply(this, arguments); + }; + } + function ow(c, d, A) { + return d = A ? r : d, d = c && d == null ? c.length : d, js(c, R, r, r, r, r, d); + } + function aw(c, d) { + var A; + if (typeof d != "function") + throw new Ti(o); + return c = cr(c), function() { + return --c > 0 && (A = d.apply(this, arguments)), c <= 1 && (d = r), A; + }; + } + var Sp = hr(function(c, d, A) { + var j = D; + if (A.length) { + var G = bo(A, uc(Sp)); + j |= B; + } + return js(c, j, d, A, G); + }), cw = hr(function(c, d, A) { + var j = D | $; + if (A.length) { + var G = bo(A, uc(cw)); + j |= B; + } + return js(d, j, c, A, G); + }); + function uw(c, d, A) { + d = A ? r : d; + var j = js(c, z, r, r, r, r, r, d); + return j.placeholder = uw.placeholder, j; + } + function fw(c, d, A) { + d = A ? r : d; + var j = js(c, k, r, r, r, r, r, d); + return j.placeholder = fw.placeholder, j; + } + function lw(c, d, A) { + var j, G, se, de, ve, xe, He = 0, We = !1, Je = !1, xt = !0; + if (typeof c != "function") + throw new Ti(o); + d = ki(d) || 0, Zr(A) && (We = !!A.leading, Je = "maxWait" in A, se = Je ? xn(ki(A.maxWait) || 0, d) : se, xt = "trailing" in A ? !!A.trailing : xt); + function Ot(cn) { + var rs = j, Ws = G; + return j = G = r, He = cn, de = c.apply(Ws, rs), de; + } + function Wt(cn) { + return He = cn, ve = yu(yr, d), We ? Ot(cn) : de; + } + function fr(cn) { + var rs = cn - xe, Ws = cn - He, Rw = d - rs; + return Je ? jn(Rw, se - Ws) : Rw; + } + function Kt(cn) { + var rs = cn - xe, Ws = cn - He; + return xe === r || rs >= d || rs < 0 || Je && Ws >= se; + } + function yr() { + var cn = rh(); + if (Kt(cn)) + return Sr(cn); + ve = yu(yr, fr(cn)); + } + function Sr(cn) { + return ve = r, xt && j ? Ot(cn) : (j = G = r, de); + } + function wi() { + ve !== r && xy(ve), He = 0, j = xe = G = ve = r; + } + function Xn() { + return ve === r ? de : Sr(rh()); + } + function xi() { + var cn = rh(), rs = Kt(cn); + if (j = arguments, G = this, xe = cn, rs) { + if (ve === r) + return Wt(xe); + if (Je) + return xy(ve), ve = yu(yr, d), Ot(xe); + } + return ve === r && (ve = yu(yr, d)), de; + } + return xi.cancel = wi, xi.flush = Xn, xi; + } + var OI = hr(function(c, d) { + return ey(c, 1, d); + }), NI = hr(function(c, d, A) { + return ey(c, ki(d) || 0, A); + }); + function LI(c) { + return js(c, J); + } + function nh(c, d) { + if (typeof c != "function" || d != null && typeof d != "function") + throw new Ti(o); + var A = function() { + var j = arguments, G = d ? d.apply(this, j) : j[0], se = A.cache; + if (se.has(G)) + return se.get(G); + var de = c.apply(this, j); + return A.cache = se.set(G, de) || se, de; + }; + return A.cache = new (nh.Cache || Bs)(), A; + } + nh.Cache = Bs; + function ih(c) { + if (typeof c != "function") + throw new Ti(o); + return function() { + var d = arguments; + switch (d.length) { + case 0: + return !c.call(this); + case 1: + return !c.call(this, d[0]); + case 2: + return !c.call(this, d[0], d[1]); + case 3: + return !c.call(this, d[0], d[1], d[2]); + } + return !c.apply(this, d); + }; + } + function kI(c) { + return aw(2, c); + } + var $I = EP(function(c, d) { + d = d.length == 1 && sr(d[0]) ? Xr(d[0], vi(Ut())) : Xr(On(d, 1), vi(Ut())); + var A = d.length; + return hr(function(j) { + for (var G = -1, se = jn(j.length, A); ++G < se; ) + j[G] = d[G].call(this, j[G]); + return Sn(c, this, j); + }); + }), Ap = hr(function(c, d) { + var A = bo(d, uc(Ap)); + return js(c, B, r, d, A); + }), hw = hr(function(c, d) { + var A = bo(d, uc(hw)); + return js(c, U, r, d, A); + }), BI = Us(function(c, d) { + return js(c, W, r, r, r, d); + }); + function FI(c, d) { + if (typeof c != "function") + throw new Ti(o); + return d = d === r ? d : cr(d), hr(c, d); + } + function jI(c, d) { + if (typeof c != "function") + throw new Ti(o); + return d = d == null ? 0 : xn(cr(d), 0), hr(function(A) { + var j = A[d], G = Eo(A, 0, d); + return j && vo(G, j), Sn(c, this, G); + }); + } + function UI(c, d, A) { + var j = !0, G = !0; + if (typeof c != "function") + throw new Ti(o); + return Zr(A) && (j = "leading" in A ? !!A.leading : j, G = "trailing" in A ? !!A.trailing : G), lw(c, d, { + leading: j, + maxWait: d, + trailing: G + }); + } + function qI(c) { + return ow(c, 1); + } + function zI(c, d) { + return Ap(up(d), c); + } + function HI() { + if (!arguments.length) + return []; + var c = arguments[0]; + return sr(c) ? c : [c]; + } + function WI(c) { + return Oi(c, x); + } + function KI(c, d) { + return d = typeof d == "function" ? d : r, Oi(c, x, d); + } + function VI(c) { + return Oi(c, g | x); + } + function GI(c, d) { + return d = typeof d == "function" ? d : r, Oi(c, g | x, d); + } + function YI(c, d) { + return d == null || Qb(c, d, An(d)); + } + function ts(c, d) { + return c === d || c !== c && d !== d; + } + var JI = Jl(X0), XI = Jl(function(c, d) { + return c >= d; + }), fa = sy(/* @__PURE__ */ (function() { + return arguments; + })()) ? sy : function(c) { + return en(c) && Rr.call(c, "callee") && !Wb.call(c, "callee"); + }, sr = Ce.isArray, ZI = Gn ? vi(Gn) : oP; + function si(c) { + return c != null && sh(c.length) && !zs(c); + } + function an(c) { + return en(c) && si(c); + } + function QI(c) { + return c === !0 || c === !1 || en(c) && Yn(c) == X; + } + var So = dA || kp, eC = Zi ? vi(Zi) : aP; + function tC(c) { + return en(c) && c.nodeType === 1 && !wu(c); + } + function rC(c) { + if (c == null) + return !0; + if (si(c) && (sr(c) || typeof c == "string" || typeof c.splice == "function" || So(c) || fc(c) || fa(c))) + return !c.length; + var d = Un(c); + if (d == ae || d == Me) + return !c.size; + if (bu(c)) + return !ep(c).length; + for (var A in c) + if (Rr.call(c, A)) + return !1; + return !0; + } + function nC(c, d) { + return gu(c, d); + } + function iC(c, d, A) { + A = typeof A == "function" ? A : r; + var j = A ? A(c, d) : r; + return j === r ? gu(c, d, r, A) : !!j; + } + function Pp(c) { + if (!en(c)) + return !1; + var d = Yn(c); + return d == Z || d == O || typeof c.message == "string" && typeof c.name == "string" && !wu(c); + } + function sC(c) { + return typeof c == "number" && Vb(c); + } + function zs(c) { + if (!Zr(c)) + return !1; + var d = Yn(c); + return d == re || d == he || d == Q || d == Re; + } + function dw(c) { + return typeof c == "number" && c == cr(c); + } + function sh(c) { + return typeof c == "number" && c > -1 && c % 1 == 0 && c <= P; + } + function Zr(c) { + var d = typeof c; + return c != null && (d == "object" || d == "function"); + } + function en(c) { + return c != null && typeof c == "object"; + } + var pw = Ci ? vi(Ci) : uP; + function oC(c, d) { + return c === d || Q0(c, d, mp(d)); + } + function aC(c, d, A) { + return A = typeof A == "function" ? A : r, Q0(c, d, mp(d), A); + } + function cC(c) { + return gw(c) && c != +c; + } + function uC(c) { + if (KP(c)) + throw new rr(s); + return oy(c); + } + function fC(c) { + return c === null; + } + function lC(c) { + return c == null; + } + function gw(c) { + return typeof c == "number" || en(c) && Yn(c) == fe; + } + function wu(c) { + if (!en(c) || Yn(c) != Ae) + return !1; + var d = Dl(c); + if (d === null) + return !0; + var A = Rr.call(d, "constructor") && d.constructor; + return typeof A == "function" && A instanceof A && Il.call(A) == aA; + } + var Mp = gs ? vi(gs) : fP; + function hC(c) { + return dw(c) && c >= -P && c <= P; + } + var mw = su ? vi(su) : lP; + function oh(c) { + return typeof c == "string" || !sr(c) && en(c) && Yn(c) == Oe; + } + function yi(c) { + return typeof c == "symbol" || en(c) && Yn(c) == ze; + } + var fc = ra ? vi(ra) : hP; + function dC(c) { + return c === r; + } + function pC(c) { + return en(c) && Un(c) == je; + } + function gC(c) { + return en(c) && Yn(c) == Ue; + } + var mC = Jl(tp), vC = Jl(function(c, d) { + return c <= d; + }); + function vw(c) { + if (!c) + return []; + if (si(c)) + return oh(c) ? Qi(c) : ii(c); + if (au && c[au]) + return Y9(c[au]()); + var d = Un(c), A = d == ae ? q0 : d == Me ? Al : lc; + return A(c); + } + function Hs(c) { + if (!c) + return c === 0 ? c : 0; + if (c = ki(c), c === w || c === -w) { + var d = c < 0 ? -1 : 1; + return d * _; + } + return c === c ? c : 0; + } + function cr(c) { + var d = Hs(c), A = d % 1; + return d === d ? A ? d - A : d : 0; + } + function bw(c) { + return c ? oa(cr(c), 0, M) : 0; + } + function ki(c) { + if (typeof c == "number") + return c; + if (yi(c)) + return y; + if (Zr(c)) { + var d = typeof c.valueOf == "function" ? c.valueOf() : c; + c = Zr(d) ? d + "" : d; + } + if (typeof c != "string") + return c === 0 ? c : +c; + c = $b(c); + var A = Qe.test(c); + return A || tt.test(c) ? ir(c.slice(2), A ? 2 : 8) : Ie.test(c) ? y : +c; + } + function yw(c) { + return vs(c, oi(c)); + } + function bC(c) { + return c ? oa(cr(c), -P, P) : c === 0 ? c : 0; + } + function Cr(c) { + return c == null ? "" : bi(c); + } + var yC = ac(function(c, d) { + if (bu(d) || si(d)) { + vs(d, An(d), c); + return; + } + for (var A in d) + Rr.call(d, A) && hu(c, A, d[A]); + }), ww = ac(function(c, d) { + vs(d, oi(d), c); + }), ah = ac(function(c, d, A, j) { + vs(d, oi(d), c, j); + }), wC = ac(function(c, d, A, j) { + vs(d, An(d), c, j); + }), xC = Us(G0); + function _C(c, d) { + var A = oc(c); + return d == null ? A : Zb(A, d); + } + var EC = hr(function(c, d) { + c = qr(c); + var A = -1, j = d.length, G = j > 2 ? d[2] : r; + for (G && Jn(d[0], d[1], G) && (j = 1); ++A < j; ) + for (var se = d[A], de = oi(se), ve = -1, xe = de.length; ++ve < xe; ) { + var He = de[ve], We = c[He]; + (We === r || ts(We, nc[He]) && !Rr.call(c, He)) && (c[He] = se[He]); + } + return c; + }), SC = hr(function(c) { + return c.push(r, $y), Sn(xw, r, c); + }); + function AC(c, d) { + return Ob(c, Ut(d, 3), ms); + } + function PC(c, d) { + return Ob(c, Ut(d, 3), J0); + } + function MC(c, d) { + return c == null ? c : Y0(c, Ut(d, 3), oi); + } + function IC(c, d) { + return c == null ? c : ny(c, Ut(d, 3), oi); + } + function CC(c, d) { + return c && ms(c, Ut(d, 3)); + } + function RC(c, d) { + return c && J0(c, Ut(d, 3)); + } + function TC(c) { + return c == null ? [] : ql(c, An(c)); + } + function DC(c) { + return c == null ? [] : ql(c, oi(c)); + } + function Ip(c, d, A) { + var j = c == null ? r : aa(c, d); + return j === r ? A : j; + } + function OC(c, d) { + return c != null && jy(c, d, rP); + } + function Cp(c, d) { + return c != null && jy(c, d, nP); + } + var NC = Dy(function(c, d, A) { + d != null && typeof d.toString != "function" && (d = Cl.call(d)), c[d] = A; + }, Tp(ai)), LC = Dy(function(c, d, A) { + d != null && typeof d.toString != "function" && (d = Cl.call(d)), Rr.call(c, d) ? c[d].push(A) : c[d] = [A]; + }, Ut), kC = hr(pu); + function An(c) { + return si(c) ? Jb(c) : ep(c); + } + function oi(c) { + return si(c) ? Jb(c, !0) : dP(c); + } + function $C(c, d) { + var A = {}; + return d = Ut(d, 3), ms(c, function(j, G, se) { + Fs(A, d(j, G, se), j); + }), A; + } + function BC(c, d) { + var A = {}; + return d = Ut(d, 3), ms(c, function(j, G, se) { + Fs(A, G, d(j, G, se)); + }), A; + } + var FC = ac(function(c, d, A) { + zl(c, d, A); + }), xw = ac(function(c, d, A, j) { + zl(c, d, A, j); + }), jC = Us(function(c, d) { + var A = {}; + if (c == null) + return A; + var j = !1; + d = Xr(d, function(se) { + return se = _o(se, c), j || (j = se.length > 1), se; + }), vs(c, pp(c), A), j && (A = Oi(A, g | v | x, NP)); + for (var G = d.length; G--; ) + op(A, d[G]); + return A; + }); + function UC(c, d) { + return _w(c, ih(Ut(d))); + } + var qC = Us(function(c, d) { + return c == null ? {} : gP(c, d); + }); + function _w(c, d) { + if (c == null) + return {}; + var A = Xr(pp(c), function(j) { + return [j]; + }); + return d = Ut(d), dy(c, A, function(j, G) { + return d(j, G[0]); + }); + } + function zC(c, d, A) { + d = _o(d, c); + var j = -1, G = d.length; + for (G || (G = 1, c = r); ++j < G; ) { + var se = c == null ? r : c[bs(d[j])]; + se === r && (j = G, se = A), c = zs(se) ? se.call(c) : se; + } + return c; + } + function HC(c, d, A) { + return c == null ? c : mu(c, d, A); + } + function WC(c, d, A, j) { + return j = typeof j == "function" ? j : r, c == null ? c : mu(c, d, A, j); + } + var Ew = Ly(An), Sw = Ly(oi); + function KC(c, d, A) { + var j = sr(c), G = j || So(c) || fc(c); + if (d = Ut(d, 4), A == null) { + var se = c && c.constructor; + G ? A = j ? new se() : [] : Zr(c) ? A = zs(se) ? oc(Dl(c)) : {} : A = {}; + } + return (G ? Ri : ms)(c, function(de, ve, xe) { + return d(A, de, ve, xe); + }), A; + } + function VC(c, d) { + return c == null ? !0 : op(c, d); + } + function GC(c, d, A) { + return c == null ? c : by(c, d, up(A)); + } + function YC(c, d, A, j) { + return j = typeof j == "function" ? j : r, c == null ? c : by(c, d, up(A), j); + } + function lc(c) { + return c == null ? [] : U0(c, An(c)); + } + function JC(c) { + return c == null ? [] : U0(c, oi(c)); + } + function XC(c, d, A) { + return A === r && (A = d, d = r), A !== r && (A = ki(A), A = A === A ? A : 0), d !== r && (d = ki(d), d = d === d ? d : 0), oa(ki(c), d, A); + } + function ZC(c, d, A) { + return d = Hs(d), A === r ? (A = d, d = 0) : A = Hs(A), c = ki(c), iP(c, d, A); + } + function QC(c, d, A) { + if (A && typeof A != "boolean" && Jn(c, d, A) && (d = A = r), A === r && (typeof d == "boolean" ? (A = d, d = r) : typeof c == "boolean" && (A = c, c = r)), c === r && d === r ? (c = 0, d = 1) : (c = Hs(c), d === r ? (d = c, c = 0) : d = Hs(d)), c > d) { + var j = c; + c = d, d = j; + } + if (A || c % 1 || d % 1) { + var G = Gb(); + return jn(c + G * (d - c + jr("1e-" + ((G + "").length - 1))), d); + } + return np(c, d); + } + var eR = cc(function(c, d, A) { + return d = d.toLowerCase(), c + (A ? Aw(d) : d); + }); + function Aw(c) { + return Rp(Cr(c).toLowerCase()); + } + function Pw(c) { + return c = Cr(c), c && c.replace(vt, H9).replace(D0, ""); + } + function tR(c, d, A) { + c = Cr(c), d = bi(d); + var j = c.length; + A = A === r ? j : oa(cr(A), 0, j); + var G = A; + return A -= d.length, A >= 0 && c.slice(A, G) == d; + } + function rR(c) { + return c = Cr(c), c && It.test(c) ? c.replace(Tt, W9) : c; + } + function nR(c) { + return c = Cr(c), c && $t.test(c) ? c.replace(et, "\\$&") : c; + } + var iR = cc(function(c, d, A) { + return c + (A ? "-" : "") + d.toLowerCase(); + }), sR = cc(function(c, d, A) { + return c + (A ? " " : "") + d.toLowerCase(); + }), oR = Cy("toLowerCase"); + function aR(c, d, A) { + c = Cr(c), d = cr(d); + var j = d ? tc(c) : 0; + if (!d || j >= d) + return c; + var G = (d - j) / 2; + return Yl(kl(G), A) + c + Yl(Ll(G), A); + } + function cR(c, d, A) { + c = Cr(c), d = cr(d); + var j = d ? tc(c) : 0; + return d && j < d ? c + Yl(d - j, A) : c; + } + function uR(c, d, A) { + c = Cr(c), d = cr(d); + var j = d ? tc(c) : 0; + return d && j < d ? Yl(d - j, A) + c : c; + } + function fR(c, d, A) { + return A || d == null ? d = 0 : d && (d = +d), vA(Cr(c).replace(H, ""), d || 0); + } + function lR(c, d, A) { + return (A ? Jn(c, d, A) : d === r) ? d = 1 : d = cr(d), ip(Cr(c), d); + } + function hR() { + var c = arguments, d = Cr(c[0]); + return c.length < 3 ? d : d.replace(c[1], c[2]); + } + var dR = cc(function(c, d, A) { + return c + (A ? "_" : "") + d.toLowerCase(); + }); + function pR(c, d, A) { + return A && typeof A != "number" && Jn(c, d, A) && (d = A = r), A = A === r ? M : A >>> 0, A ? (c = Cr(c), c && (typeof d == "string" || d != null && !Mp(d)) && (d = bi(d), !d && ec(c)) ? Eo(Qi(c), 0, A) : c.split(d, A)) : []; + } + var gR = cc(function(c, d, A) { + return c + (A ? " " : "") + Rp(d); + }); + function mR(c, d, A) { + return c = Cr(c), A = A == null ? 0 : oa(cr(A), 0, c.length), d = bi(d), c.slice(A, A + d.length) == d; + } + function vR(c, d, A) { + var j = te.templateSettings; + A && Jn(c, d, A) && (d = r), c = Cr(c), d = ah({}, d, j, ky); + var G = ah({}, d.imports, j.imports, ky), se = An(G), de = U0(G, se), ve, xe, He = 0, We = d.interpolate || Ct, Je = "__p += '", xt = z0( + (d.escape || Ct).source + "|" + We.source + "|" + (We === Nt ? Ee : Ct).source + "|" + (d.evaluate || Ct).source + "|$", + "g" + ), Ot = "//# sourceURL=" + (Rr.call(d, "sourceURL") ? (d.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++O0 + "]") + ` +`; + c.replace(xt, function(Kt, yr, Sr, wi, Xn, xi) { + return Sr || (Sr = wi), Je += c.slice(He, xi).replace(Mt, K9), yr && (ve = !0, Je += `' + +__e(` + yr + `) + +'`), Xn && (xe = !0, Je += `'; +` + Xn + `; +__p += '`), Sr && (Je += `' + +((__t = (` + Sr + `)) == null ? '' : __t) + +'`), He = xi + Kt.length, Kt; + }), Je += `'; +`; + var Wt = Rr.call(d, "variable") && d.variable; + if (!Wt) + Je = `with (obj) { +` + Je + ` +} +`; + else if (le.test(Wt)) + throw new rr(a); + Je = (xe ? Je.replace(Gt, "") : Je).replace(Et, "$1").replace(Yt, "$1;"), Je = "function(" + (Wt || "obj") + `) { +` + (Wt ? "" : `obj || (obj = {}); +`) + "var __t, __p = ''" + (ve ? ", __e = _.escape" : "") + (xe ? `, __j = Array.prototype.join; +function print() { __p += __j.call(arguments, '') } +` : `; +`) + Je + `return __p +}`; + var fr = Iw(function() { + return Mr(se, Ot + "return " + Je).apply(r, de); + }); + if (fr.source = Je, Pp(fr)) + throw fr; + return fr; + } + function bR(c) { + return Cr(c).toLowerCase(); + } + function yR(c) { + return Cr(c).toUpperCase(); + } + function wR(c, d, A) { + if (c = Cr(c), c && (A || d === r)) + return $b(c); + if (!c || !(d = bi(d))) + return c; + var j = Qi(c), G = Qi(d), se = Bb(j, G), de = Fb(j, G) + 1; + return Eo(j, se, de).join(""); + } + function xR(c, d, A) { + if (c = Cr(c), c && (A || d === r)) + return c.slice(0, Ub(c) + 1); + if (!c || !(d = bi(d))) + return c; + var j = Qi(c), G = Fb(j, Qi(d)) + 1; + return Eo(j, 0, G).join(""); + } + function _R(c, d, A) { + if (c = Cr(c), c && (A || d === r)) + return c.replace(H, ""); + if (!c || !(d = bi(d))) + return c; + var j = Qi(c), G = Bb(j, Qi(d)); + return Eo(j, G).join(""); + } + function ER(c, d) { + var A = ne, j = K; + if (Zr(d)) { + var G = "separator" in d ? d.separator : G; + A = "length" in d ? cr(d.length) : A, j = "omission" in d ? bi(d.omission) : j; + } + c = Cr(c); + var se = c.length; + if (ec(c)) { + var de = Qi(c); + se = de.length; + } + if (A >= se) + return c; + var ve = A - tc(j); + if (ve < 1) + return j; + var xe = de ? Eo(de, 0, ve).join("") : c.slice(0, ve); + if (G === r) + return xe + j; + if (de && (ve += xe.length - ve), Mp(G)) { + if (c.slice(ve).search(G)) { + var He, We = xe; + for (G.global || (G = z0(G.source, Cr(Le.exec(G)) + "g")), G.lastIndex = 0; He = G.exec(We); ) + var Je = He.index; + xe = xe.slice(0, Je === r ? ve : Je); + } + } else if (c.indexOf(bi(G), ve) != ve) { + var xt = xe.lastIndexOf(G); + xt > -1 && (xe = xe.slice(0, xt)); + } + return xe + j; + } + function SR(c) { + return c = Cr(c), c && kt.test(c) ? c.replace(tr, Q9) : c; + } + var AR = cc(function(c, d, A) { + return c + (A ? " " : "") + d.toUpperCase(); + }), Rp = Cy("toUpperCase"); + function Mw(c, d, A) { + return c = Cr(c), d = A ? r : d, d === r ? G9(c) ? rA(c) : F9(c) : c.match(d) || []; + } + var Iw = hr(function(c, d) { + try { + return Sn(c, r, d); + } catch (A) { + return Pp(A) ? A : new rr(A); + } + }), PR = Us(function(c, d) { + return Ri(d, function(A) { + A = bs(A), Fs(c, A, Sp(c[A], c)); + }), c; + }); + function MR(c) { + var d = c == null ? 0 : c.length, A = Ut(); + return c = d ? Xr(c, function(j) { + if (typeof j[1] != "function") + throw new Ti(o); + return [A(j[0]), j[1]]; + }) : [], hr(function(j) { + for (var G = -1; ++G < d; ) { + var se = c[G]; + if (Sn(se[0], this, j)) + return Sn(se[1], this, j); + } + }); + } + function IR(c) { + return QA(Oi(c, g)); + } + function Tp(c) { + return function() { + return c; + }; + } + function CR(c, d) { + return c == null || c !== c ? d : c; + } + var RR = Ty(), TR = Ty(!0); + function ai(c) { + return c; + } + function Dp(c) { + return ay(typeof c == "function" ? c : Oi(c, g)); + } + function DR(c) { + return uy(Oi(c, g)); + } + function OR(c, d) { + return fy(c, Oi(d, g)); + } + var NR = hr(function(c, d) { + return function(A) { + return pu(A, c, d); + }; + }), LR = hr(function(c, d) { + return function(A) { + return pu(c, A, d); + }; + }); + function Op(c, d, A) { + var j = An(d), G = ql(d, j); + A == null && !(Zr(d) && (G.length || !j.length)) && (A = d, d = c, c = this, G = ql(d, An(d))); + var se = !(Zr(A) && "chain" in A) || !!A.chain, de = zs(c); + return Ri(G, function(ve) { + var xe = d[ve]; + c[ve] = xe, de && (c.prototype[ve] = function() { + var He = this.__chain__; + if (se || He) { + var We = c(this.__wrapped__), Je = We.__actions__ = ii(this.__actions__); + return Je.push({ func: xe, args: arguments, thisArg: c }), We.__chain__ = He, We; + } + return xe.apply(c, vo([this.value()], arguments)); + }); + }), c; + } + function kR() { + return Er._ === this && (Er._ = cA), this; + } + function Np() { + } + function $R(c) { + return c = cr(c), hr(function(d) { + return ly(d, c); + }); + } + var BR = lp(Xr), FR = lp(Db), jR = lp(k0); + function Cw(c) { + return bp(c) ? $0(bs(c)) : mP(c); + } + function UR(c) { + return function(d) { + return c == null ? r : aa(c, d); + }; + } + var qR = Oy(), zR = Oy(!0); + function Lp() { + return []; + } + function kp() { + return !1; + } + function HR() { + return {}; + } + function WR() { + return ""; + } + function KR() { + return !0; + } + function VR(c, d) { + if (c = cr(c), c < 1 || c > P) + return []; + var A = M, j = jn(c, M); + d = Ut(d), c -= M; + for (var G = j0(j, d); ++A < c; ) + d(A); + return G; + } + function GR(c) { + return sr(c) ? Xr(c, bs) : yi(c) ? [c] : ii(Yy(Cr(c))); + } + function YR(c) { + var d = ++oA; + return Cr(c) + d; + } + var JR = Gl(function(c, d) { + return c + d; + }, 0), XR = hp("ceil"), ZR = Gl(function(c, d) { + return c / d; + }, 1), QR = hp("floor"); + function eT(c) { + return c && c.length ? Ul(c, ai, X0) : r; + } + function tT(c, d) { + return c && c.length ? Ul(c, Ut(d, 2), X0) : r; + } + function rT(c) { + return Lb(c, ai); + } + function nT(c, d) { + return Lb(c, Ut(d, 2)); + } + function iT(c) { + return c && c.length ? Ul(c, ai, tp) : r; + } + function sT(c, d) { + return c && c.length ? Ul(c, Ut(d, 2), tp) : r; + } + var oT = Gl(function(c, d) { + return c * d; + }, 1), aT = hp("round"), cT = Gl(function(c, d) { + return c - d; + }, 0); + function uT(c) { + return c && c.length ? F0(c, ai) : 0; + } + function fT(c, d) { + return c && c.length ? F0(c, Ut(d, 2)) : 0; + } + return te.after = DI, te.ary = ow, te.assign = yC, te.assignIn = ww, te.assignInWith = ah, te.assignWith = wC, te.at = xC, te.before = aw, te.bind = Sp, te.bindAll = PR, te.bindKey = cw, te.castArray = HI, te.chain = nw, te.chunk = QP, te.compact = eM, te.concat = tM, te.cond = MR, te.conforms = IR, te.constant = Tp, te.countBy = uI, te.create = _C, te.curry = uw, te.curryRight = fw, te.debounce = lw, te.defaults = EC, te.defaultsDeep = SC, te.defer = OI, te.delay = NI, te.difference = rM, te.differenceBy = nM, te.differenceWith = iM, te.drop = sM, te.dropRight = oM, te.dropRightWhile = aM, te.dropWhile = cM, te.fill = uM, te.filter = lI, te.flatMap = pI, te.flatMapDeep = gI, te.flatMapDepth = mI, te.flatten = Qy, te.flattenDeep = fM, te.flattenDepth = lM, te.flip = LI, te.flow = RR, te.flowRight = TR, te.fromPairs = hM, te.functions = TC, te.functionsIn = DC, te.groupBy = vI, te.initial = pM, te.intersection = gM, te.intersectionBy = mM, te.intersectionWith = vM, te.invert = NC, te.invertBy = LC, te.invokeMap = yI, te.iteratee = Dp, te.keyBy = wI, te.keys = An, te.keysIn = oi, te.map = th, te.mapKeys = $C, te.mapValues = BC, te.matches = DR, te.matchesProperty = OR, te.memoize = nh, te.merge = FC, te.mergeWith = xw, te.method = NR, te.methodOf = LR, te.mixin = Op, te.negate = ih, te.nthArg = $R, te.omit = jC, te.omitBy = UC, te.once = kI, te.orderBy = xI, te.over = BR, te.overArgs = $I, te.overEvery = FR, te.overSome = jR, te.partial = Ap, te.partialRight = hw, te.partition = _I, te.pick = qC, te.pickBy = _w, te.property = Cw, te.propertyOf = UR, te.pull = xM, te.pullAll = tw, te.pullAllBy = _M, te.pullAllWith = EM, te.pullAt = SM, te.range = qR, te.rangeRight = zR, te.rearg = BI, te.reject = AI, te.remove = AM, te.rest = FI, te.reverse = _p, te.sampleSize = MI, te.set = HC, te.setWith = WC, te.shuffle = II, te.slice = PM, te.sortBy = TI, te.sortedUniq = OM, te.sortedUniqBy = NM, te.split = pR, te.spread = jI, te.tail = LM, te.take = kM, te.takeRight = $M, te.takeRightWhile = BM, te.takeWhile = FM, te.tap = eI, te.throttle = UI, te.thru = eh, te.toArray = vw, te.toPairs = Ew, te.toPairsIn = Sw, te.toPath = GR, te.toPlainObject = yw, te.transform = KC, te.unary = qI, te.union = jM, te.unionBy = UM, te.unionWith = qM, te.uniq = zM, te.uniqBy = HM, te.uniqWith = WM, te.unset = VC, te.unzip = Ep, te.unzipWith = rw, te.update = GC, te.updateWith = YC, te.values = lc, te.valuesIn = JC, te.without = KM, te.words = Mw, te.wrap = zI, te.xor = VM, te.xorBy = GM, te.xorWith = YM, te.zip = JM, te.zipObject = XM, te.zipObjectDeep = ZM, te.zipWith = QM, te.entries = Ew, te.entriesIn = Sw, te.extend = ww, te.extendWith = ah, Op(te, te), te.add = JR, te.attempt = Iw, te.camelCase = eR, te.capitalize = Aw, te.ceil = XR, te.clamp = XC, te.clone = WI, te.cloneDeep = VI, te.cloneDeepWith = GI, te.cloneWith = KI, te.conformsTo = YI, te.deburr = Pw, te.defaultTo = CR, te.divide = ZR, te.endsWith = tR, te.eq = ts, te.escape = rR, te.escapeRegExp = nR, te.every = fI, te.find = hI, te.findIndex = Xy, te.findKey = AC, te.findLast = dI, te.findLastIndex = Zy, te.findLastKey = PC, te.floor = QR, te.forEach = iw, te.forEachRight = sw, te.forIn = MC, te.forInRight = IC, te.forOwn = CC, te.forOwnRight = RC, te.get = Ip, te.gt = JI, te.gte = XI, te.has = OC, te.hasIn = Cp, te.head = ew, te.identity = ai, te.includes = bI, te.indexOf = dM, te.inRange = ZC, te.invoke = kC, te.isArguments = fa, te.isArray = sr, te.isArrayBuffer = ZI, te.isArrayLike = si, te.isArrayLikeObject = an, te.isBoolean = QI, te.isBuffer = So, te.isDate = eC, te.isElement = tC, te.isEmpty = rC, te.isEqual = nC, te.isEqualWith = iC, te.isError = Pp, te.isFinite = sC, te.isFunction = zs, te.isInteger = dw, te.isLength = sh, te.isMap = pw, te.isMatch = oC, te.isMatchWith = aC, te.isNaN = cC, te.isNative = uC, te.isNil = lC, te.isNull = fC, te.isNumber = gw, te.isObject = Zr, te.isObjectLike = en, te.isPlainObject = wu, te.isRegExp = Mp, te.isSafeInteger = hC, te.isSet = mw, te.isString = oh, te.isSymbol = yi, te.isTypedArray = fc, te.isUndefined = dC, te.isWeakMap = pC, te.isWeakSet = gC, te.join = bM, te.kebabCase = iR, te.last = Li, te.lastIndexOf = yM, te.lowerCase = sR, te.lowerFirst = oR, te.lt = mC, te.lte = vC, te.max = eT, te.maxBy = tT, te.mean = rT, te.meanBy = nT, te.min = iT, te.minBy = sT, te.stubArray = Lp, te.stubFalse = kp, te.stubObject = HR, te.stubString = WR, te.stubTrue = KR, te.multiply = oT, te.nth = wM, te.noConflict = kR, te.noop = Np, te.now = rh, te.pad = aR, te.padEnd = cR, te.padStart = uR, te.parseInt = fR, te.random = QC, te.reduce = EI, te.reduceRight = SI, te.repeat = lR, te.replace = hR, te.result = zC, te.round = aT, te.runInContext = ye, te.sample = PI, te.size = CI, te.snakeCase = dR, te.some = RI, te.sortedIndex = MM, te.sortedIndexBy = IM, te.sortedIndexOf = CM, te.sortedLastIndex = RM, te.sortedLastIndexBy = TM, te.sortedLastIndexOf = DM, te.startCase = gR, te.startsWith = mR, te.subtract = cT, te.sum = uT, te.sumBy = fT, te.template = vR, te.times = VR, te.toFinite = Hs, te.toInteger = cr, te.toLength = bw, te.toLower = bR, te.toNumber = ki, te.toSafeInteger = bC, te.toString = Cr, te.toUpper = yR, te.trim = wR, te.trimEnd = xR, te.trimStart = _R, te.truncate = ER, te.unescape = SR, te.uniqueId = YR, te.upperCase = AR, te.upperFirst = Rp, te.each = iw, te.eachRight = sw, te.first = ew, Op(te, (function() { + var c = {}; + return ms(te, function(d, A) { + Rr.call(te.prototype, A) || (c[A] = d); + }), c; + })(), { chain: !1 }), te.VERSION = n, Ri(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(c) { + te[c].placeholder = te; + }), Ri(["drop", "take"], function(c, d) { + _r.prototype[c] = function(A) { + A = A === r ? 1 : xn(cr(A), 0); + var j = this.__filtered__ && !d ? new _r(this) : this.clone(); + return j.__filtered__ ? j.__takeCount__ = jn(A, j.__takeCount__) : j.__views__.push({ + size: jn(A, M), + type: c + (j.__dir__ < 0 ? "Right" : "") + }), j; + }, _r.prototype[c + "Right"] = function(A) { + return this.reverse()[c](A).reverse(); + }; + }), Ri(["filter", "map", "takeWhile"], function(c, d) { + var A = d + 1, j = A == l || A == m; + _r.prototype[c] = function(G) { + var se = this.clone(); + return se.__iteratees__.push({ + iteratee: Ut(G, 3), + type: A + }), se.__filtered__ = se.__filtered__ || j, se; + }; + }), Ri(["head", "last"], function(c, d) { + var A = "take" + (d ? "Right" : ""); + _r.prototype[c] = function() { + return this[A](1).value()[0]; + }; + }), Ri(["initial", "tail"], function(c, d) { + var A = "drop" + (d ? "" : "Right"); + _r.prototype[c] = function() { + return this.__filtered__ ? new _r(this) : this[A](1); + }; + }), _r.prototype.compact = function() { + return this.filter(ai); + }, _r.prototype.find = function(c) { + return this.filter(c).head(); + }, _r.prototype.findLast = function(c) { + return this.reverse().find(c); + }, _r.prototype.invokeMap = hr(function(c, d) { + return typeof c == "function" ? new _r(this) : this.map(function(A) { + return pu(A, c, d); + }); + }), _r.prototype.reject = function(c) { + return this.filter(ih(Ut(c))); + }, _r.prototype.slice = function(c, d) { + c = cr(c); + var A = this; + return A.__filtered__ && (c > 0 || d < 0) ? new _r(A) : (c < 0 ? A = A.takeRight(-c) : c && (A = A.drop(c)), d !== r && (d = cr(d), A = d < 0 ? A.dropRight(-d) : A.take(d - c)), A); + }, _r.prototype.takeRightWhile = function(c) { + return this.reverse().takeWhile(c).reverse(); + }, _r.prototype.toArray = function() { + return this.take(M); + }, ms(_r.prototype, function(c, d) { + var A = /^(?:filter|find|map|reject)|While$/.test(d), j = /^(?:head|last)$/.test(d), G = te[j ? "take" + (d == "last" ? "Right" : "") : d], se = j || /^find/.test(d); + G && (te.prototype[d] = function() { + var de = this.__wrapped__, ve = j ? [1] : arguments, xe = de instanceof _r, He = ve[0], We = xe || sr(de), Je = function(yr) { + var Sr = G.apply(te, vo([yr], ve)); + return j && xt ? Sr[0] : Sr; + }; + We && A && typeof He == "function" && He.length != 1 && (xe = We = !1); + var xt = this.__chain__, Ot = !!this.__actions__.length, Wt = se && !xt, fr = xe && !Ot; + if (!se && We) { + de = fr ? de : new _r(this); + var Kt = c.apply(de, ve); + return Kt.__actions__.push({ func: eh, args: [Je], thisArg: r }), new Di(Kt, xt); + } + return Wt && fr ? c.apply(this, ve) : (Kt = this.thru(Je), Wt ? j ? Kt.value()[0] : Kt.value() : Kt); + }); + }), Ri(["pop", "push", "shift", "sort", "splice", "unshift"], function(c) { + var d = Pl[c], A = /^(?:push|sort|unshift)$/.test(c) ? "tap" : "thru", j = /^(?:pop|shift)$/.test(c); + te.prototype[c] = function() { + var G = arguments; + if (j && !this.__chain__) { + var se = this.value(); + return d.apply(sr(se) ? se : [], G); + } + return this[A](function(de) { + return d.apply(sr(de) ? de : [], G); + }); + }; + }), ms(_r.prototype, function(c, d) { + var A = te[d]; + if (A) { + var j = A.name + ""; + Rr.call(sc, j) || (sc[j] = []), sc[j].push({ name: d, func: A }); + } + }), sc[Vl(r, $).name] = [{ + name: "wrapper", + func: r + }], _r.prototype.clone = SA, _r.prototype.reverse = AA, _r.prototype.value = PA, te.prototype.at = tI, te.prototype.chain = rI, te.prototype.commit = nI, te.prototype.next = iI, te.prototype.plant = oI, te.prototype.reverse = aI, te.prototype.toJSON = te.prototype.valueOf = te.prototype.value = cI, te.prototype.first = te.prototype.head, au && (te.prototype[au] = sI), te; + }), rc = nA(); + on ? ((on.exports = rc)._ = rc, Ur._ = rc) : Er._ = rc; + }).call(qH); + })(Ju, Ju.exports)), Ju.exports; +} +var HH = zH(), Xu = { exports: {} }, WH = Xu.exports, X3; +function KH() { + return X3 || (X3 = 1, (function(t, e) { + var r = typeof self < "u" ? self : WH, n = (function() { + function s() { + this.fetch = !1, this.DOMException = r.DOMException; + } + return s.prototype = r, new s(); + })(); + (function(s) { + (function(o) { + var a = { + searchParams: "URLSearchParams" in s, + iterable: "Symbol" in s && "iterator" in Symbol, + blob: "FileReader" in s && "Blob" in s && (function() { + try { + return new Blob(), !0; + } catch { + return !1; + } + })(), + formData: "FormData" in s, + arrayBuffer: "ArrayBuffer" in s + }; + function f(l) { + return l && DataView.prototype.isPrototypeOf(l); + } + if (a.arrayBuffer) + var u = [ + "[object Int8Array]", + "[object Uint8Array]", + "[object Uint8ClampedArray]", + "[object Int16Array]", + "[object Uint16Array]", + "[object Int32Array]", + "[object Uint32Array]", + "[object Float32Array]", + "[object Float64Array]" + ], h = ArrayBuffer.isView || function(l) { + return l && u.indexOf(Object.prototype.toString.call(l)) > -1; + }; + function g(l) { + if (typeof l != "string" && (l = String(l)), /[^a-z0-9\-#$%&'*+.^_`|~]/i.test(l)) + throw new TypeError("Invalid character in header field name"); + return l.toLowerCase(); + } + function v(l) { + return typeof l != "string" && (l = String(l)), l; + } + function x(l) { + var p = { + next: function() { + var m = l.shift(); + return { done: m === void 0, value: m }; + } + }; + return a.iterable && (p[Symbol.iterator] = function() { + return p; + }), p; + } + function S(l) { + this.map = {}, l instanceof S ? l.forEach(function(p, m) { + this.append(m, p); + }, this) : Array.isArray(l) ? l.forEach(function(p) { + this.append(p[0], p[1]); + }, this) : l && Object.getOwnPropertyNames(l).forEach(function(p) { + this.append(p, l[p]); + }, this); + } + S.prototype.append = function(l, p) { + l = g(l), p = v(p); + var m = this.map[l]; + this.map[l] = m ? m + ", " + p : p; + }, S.prototype.delete = function(l) { + delete this.map[g(l)]; + }, S.prototype.get = function(l) { + return l = g(l), this.has(l) ? this.map[l] : null; + }, S.prototype.has = function(l) { + return this.map.hasOwnProperty(g(l)); + }, S.prototype.set = function(l, p) { + this.map[g(l)] = v(p); + }, S.prototype.forEach = function(l, p) { + for (var m in this.map) + this.map.hasOwnProperty(m) && l.call(p, this.map[m], m, this); + }, S.prototype.keys = function() { + var l = []; + return this.forEach(function(p, m) { + l.push(m); + }), x(l); + }, S.prototype.values = function() { + var l = []; + return this.forEach(function(p) { + l.push(p); + }), x(l); + }, S.prototype.entries = function() { + var l = []; + return this.forEach(function(p, m) { + l.push([m, p]); + }), x(l); + }, a.iterable && (S.prototype[Symbol.iterator] = S.prototype.entries); + function C(l) { + if (l.bodyUsed) + return Promise.reject(new TypeError("Already read")); + l.bodyUsed = !0; + } + function D(l) { + return new Promise(function(p, m) { + l.onload = function() { + p(l.result); + }, l.onerror = function() { + m(l.error); + }; + }); + } + function $(l) { + var p = new FileReader(), m = D(p); + return p.readAsArrayBuffer(l), m; + } + function N(l) { + var p = new FileReader(), m = D(p); + return p.readAsText(l), m; + } + function z(l) { + for (var p = new Uint8Array(l), m = new Array(p.length), w = 0; w < p.length; w++) + m[w] = String.fromCharCode(p[w]); + return m.join(""); + } + function k(l) { + if (l.slice) + return l.slice(0); + var p = new Uint8Array(l.byteLength); + return p.set(new Uint8Array(l)), p.buffer; + } + function B() { + return this.bodyUsed = !1, this._initBody = function(l) { + this._bodyInit = l, l ? typeof l == "string" ? this._bodyText = l : a.blob && Blob.prototype.isPrototypeOf(l) ? this._bodyBlob = l : a.formData && FormData.prototype.isPrototypeOf(l) ? this._bodyFormData = l : a.searchParams && URLSearchParams.prototype.isPrototypeOf(l) ? this._bodyText = l.toString() : a.arrayBuffer && a.blob && f(l) ? (this._bodyArrayBuffer = k(l.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(l) || h(l)) ? this._bodyArrayBuffer = k(l) : this._bodyText = l = Object.prototype.toString.call(l) : this._bodyText = "", this.headers.get("content-type") || (typeof l == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : a.searchParams && URLSearchParams.prototype.isPrototypeOf(l) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8")); + }, a.blob && (this.blob = function() { + var l = C(this); + if (l) + return l; + if (this._bodyBlob) + return Promise.resolve(this._bodyBlob); + if (this._bodyArrayBuffer) + return Promise.resolve(new Blob([this._bodyArrayBuffer])); + if (this._bodyFormData) + throw new Error("could not read FormData body as blob"); + return Promise.resolve(new Blob([this._bodyText])); + }, this.arrayBuffer = function() { + return this._bodyArrayBuffer ? C(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then($); + }), this.text = function() { + var l = C(this); + if (l) + return l; + if (this._bodyBlob) + return N(this._bodyBlob); + if (this._bodyArrayBuffer) + return Promise.resolve(z(this._bodyArrayBuffer)); + if (this._bodyFormData) + throw new Error("could not read FormData body as text"); + return Promise.resolve(this._bodyText); + }, a.formData && (this.formData = function() { + return this.text().then(J); + }), this.json = function() { + return this.text().then(JSON.parse); + }, this; + } + var U = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"]; + function R(l) { + var p = l.toUpperCase(); + return U.indexOf(p) > -1 ? p : l; + } + function W(l, p) { + p = p || {}; + var m = p.body; + if (l instanceof W) { + if (l.bodyUsed) + throw new TypeError("Already read"); + this.url = l.url, this.credentials = l.credentials, p.headers || (this.headers = new S(l.headers)), this.method = l.method, this.mode = l.mode, this.signal = l.signal, !m && l._bodyInit != null && (m = l._bodyInit, l.bodyUsed = !0); + } else + this.url = String(l); + if (this.credentials = p.credentials || this.credentials || "same-origin", (p.headers || !this.headers) && (this.headers = new S(p.headers)), this.method = R(p.method || this.method || "GET"), this.mode = p.mode || this.mode || null, this.signal = p.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && m) + throw new TypeError("Body not allowed for GET or HEAD requests"); + this._initBody(m); + } + W.prototype.clone = function() { + return new W(this, { body: this._bodyInit }); + }; + function J(l) { + var p = new FormData(); + return l.trim().split("&").forEach(function(m) { + if (m) { + var w = m.split("="), P = w.shift().replace(/\+/g, " "), _ = w.join("=").replace(/\+/g, " "); + p.append(decodeURIComponent(P), decodeURIComponent(_)); + } + }), p; + } + function ne(l) { + var p = new S(), m = l.replace(/\r?\n[\t ]+/g, " "); + return m.split(/\r?\n/).forEach(function(w) { + var P = w.split(":"), _ = P.shift().trim(); + if (_) { + var y = P.join(":").trim(); + p.append(_, y); + } + }), p; + } + B.call(W.prototype); + function K(l, p) { + p || (p = {}), this.type = "default", this.status = p.status === void 0 ? 200 : p.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in p ? p.statusText : "OK", this.headers = new S(p.headers), this.url = p.url || "", this._initBody(l); + } + B.call(K.prototype), K.prototype.clone = function() { + return new K(this._bodyInit, { + status: this.status, + statusText: this.statusText, + headers: new S(this.headers), + url: this.url + }); + }, K.error = function() { + var l = new K(null, { status: 0, statusText: "" }); + return l.type = "error", l; + }; + var E = [301, 302, 303, 307, 308]; + K.redirect = function(l, p) { + if (E.indexOf(p) === -1) + throw new RangeError("Invalid status code"); + return new K(null, { status: p, headers: { location: l } }); + }, o.DOMException = s.DOMException; + try { + new o.DOMException(); + } catch { + o.DOMException = function(p, m) { + this.message = p, this.name = m; + var w = Error(p); + this.stack = w.stack; + }, o.DOMException.prototype = Object.create(Error.prototype), o.DOMException.prototype.constructor = o.DOMException; + } + function b(l, p) { + return new Promise(function(m, w) { + var P = new W(l, p); + if (P.signal && P.signal.aborted) + return w(new o.DOMException("Aborted", "AbortError")); + var _ = new XMLHttpRequest(); + function y() { + _.abort(); + } + _.onload = function() { + var M = { + status: _.status, + statusText: _.statusText, + headers: ne(_.getAllResponseHeaders() || "") + }; + M.url = "responseURL" in _ ? _.responseURL : M.headers.get("X-Request-URL"); + var I = "response" in _ ? _.response : _.responseText; + m(new K(I, M)); + }, _.onerror = function() { + w(new TypeError("Network request failed")); + }, _.ontimeout = function() { + w(new TypeError("Network request failed")); + }, _.onabort = function() { + w(new o.DOMException("Aborted", "AbortError")); + }, _.open(P.method, P.url, !0), P.credentials === "include" ? _.withCredentials = !0 : P.credentials === "omit" && (_.withCredentials = !1), "responseType" in _ && a.blob && (_.responseType = "blob"), P.headers.forEach(function(M, I) { + _.setRequestHeader(I, M); + }), P.signal && (P.signal.addEventListener("abort", y), _.onreadystatechange = function() { + _.readyState === 4 && P.signal.removeEventListener("abort", y); + }), _.send(typeof P._bodyInit > "u" ? null : P._bodyInit); + }); + } + return b.polyfill = !0, s.fetch || (s.fetch = b, s.Headers = S, s.Request = W, s.Response = K), o.Headers = S, o.Request = W, o.Response = K, o.fetch = b, Object.defineProperty(o, "__esModule", { value: !0 }), o; + })({}); + })(n), n.fetch.ponyfill = !0, delete n.fetch.polyfill; + var i = n; + e = i.fetch, e.default = i.fetch, e.fetch = i.fetch, e.Headers = i.Headers, e.Request = i.Request, e.Response = i.Response, t.exports = e; + })(Xu, Xu.exports)), Xu.exports; +} +var VH = KH(); +const Z3 = /* @__PURE__ */ Hi(VH); +var GH = Object.defineProperty, YH = Object.defineProperties, JH = Object.getOwnPropertyDescriptors, Q3 = Object.getOwnPropertySymbols, XH = Object.prototype.hasOwnProperty, ZH = Object.prototype.propertyIsEnumerable, e_ = (t, e, r) => e in t ? GH(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, t_ = (t, e) => { + for (var r in e || (e = {})) XH.call(e, r) && e_(t, r, e[r]); + if (Q3) for (var r of Q3(e)) ZH.call(e, r) && e_(t, r, e[r]); + return t; +}, r_ = (t, e) => YH(t, JH(e)); +const QH = { Accept: "application/json", "Content-Type": "application/json" }, eW = "POST", n_ = { headers: QH, method: eW }, i_ = 10; +let hs = class { + constructor(e, r = !1) { + if (this.url = e, this.disableProviderPing = r, this.events = new Wi.EventEmitter(), this.isAvailable = !1, this.registering = !1, !x3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); + this.url = e, this.disableProviderPing = r; + } + get connected() { + return this.isAvailable; + } + get connecting() { + return this.registering; + } + on(e, r) { + this.events.on(e, r); + } + once(e, r) { + this.events.once(e, r); + } + off(e, r) { + this.events.off(e, r); + } + removeListener(e, r) { + this.events.removeListener(e, r); + } + async open(e = this.url) { + await this.register(e); + } + async close() { + if (!this.isAvailable) throw new Error("Connection already closed"); + this.onClose(); + } + async send(e) { + this.isAvailable || await this.register(); + try { + const r = ho(e), n = await (await Z3(this.url, r_(t_({}, n_), { body: r }))).json(); + this.onPayload({ data: n }); + } catch (r) { + this.onError(e.id, r); + } + } + async register(e = this.url) { + if (!x3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); + if (this.registering) { + const r = this.events.getMaxListeners(); + return (this.events.listenerCount("register_error") >= r || this.events.listenerCount("open") >= r) && this.events.setMaxListeners(r + 1), new Promise((n, i) => { + this.events.once("register_error", (s) => { + this.resetMaxListeners(), i(s); + }), this.events.once("open", () => { + if (this.resetMaxListeners(), typeof this.isAvailable > "u") return i(new Error("HTTP connection is missing or invalid")); + n(); + }); + }); + } + this.url = e, this.registering = !0; + try { + if (!this.disableProviderPing) { + const r = ho({ id: 1, jsonrpc: "2.0", method: "test", params: [] }); + await Z3(e, r_(t_({}, n_), { body: r })); + } + this.onOpen(); + } catch (r) { + const n = this.parseError(r); + throw this.events.emit("register_error", n), this.onClose(), n; + } + } + onOpen() { + this.isAvailable = !0, this.registering = !1, this.events.emit("open"); + } + onClose() { + this.isAvailable = !1, this.registering = !1, this.events.emit("close"); + } + onPayload(e) { + if (typeof e.data > "u") return; + const r = typeof e.data == "string" ? Na(e.data) : e.data; + this.events.emit("payload", r); + } + onError(e, r) { + const n = this.parseError(r), i = n.message || n.toString(), s = n0(e, i); + this.events.emit("payload", s); + } + parseError(e, r = this.url) { + return q8(e, r, "HTTP"); + } + resetMaxListeners() { + this.events.getMaxListeners() > i_ && this.events.setMaxListeners(i_); + } +}; +const s_ = "error", tW = "wss://relay.walletconnect.org", rW = "wc", nW = "universal_provider", o_ = `${rW}@2:${nW}:`, lE = "https://rpc.walletconnect.org/v1/", wc = "generic", iW = `${lE}bundler`, Ji = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; +var sW = Object.defineProperty, oW = Object.defineProperties, aW = Object.getOwnPropertyDescriptors, a_ = Object.getOwnPropertySymbols, cW = Object.prototype.hasOwnProperty, uW = Object.prototype.propertyIsEnumerable, c_ = (t, e, r) => e in t ? sW(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Sh = (t, e) => { + for (var r in e || (e = {})) cW.call(e, r) && c_(t, r, e[r]); + if (a_) for (var r of a_(e)) uW.call(e, r) && c_(t, r, e[r]); + return t; +}, fW = (t, e) => oW(t, aW(e)); +function Ai(t, e, r) { + var n; + const i = Nc(t); + return ((n = e.rpcMap) == null ? void 0 : n[i.reference]) || `${lE}?chainId=${i.namespace}:${i.reference}&projectId=${r}`; +} +function Ga(t) { + return t.includes(":") ? t.split(":")[1] : t; +} +function hE(t) { + return t.map((e) => `${e.split(":")[0]}:${e.split(":")[1]}`); +} +function lW(t, e) { + const r = Object.keys(e.namespaces).filter((i) => i.includes(t)); + if (!r.length) return []; + const n = []; + return r.forEach((i) => { + const s = e.namespaces[i].accounts; + n.push(...s); + }), n; +} +function em(t = {}, e = {}) { + const r = u_(t), n = u_(e); + return HH.merge(r, n); +} +function u_(t) { + var e, r, n, i; + const s = {}; + if (!kf(t)) return s; + for (const [o, a] of Object.entries(t)) { + const f = A1(o) ? [o] : a.chains, u = a.methods || [], h = a.events || [], g = a.rpcMap || {}, v = Gu(o); + s[v] = fW(Sh(Sh({}, s[v]), a), { chains: zh(f, (e = s[v]) == null ? void 0 : e.chains), methods: zh(u, (r = s[v]) == null ? void 0 : r.methods), events: zh(h, (n = s[v]) == null ? void 0 : n.events), rpcMap: Sh(Sh({}, g), (i = s[v]) == null ? void 0 : i.rpcMap) }); + } + return s; +} +function hW(t) { + return t.includes(":") ? t.split(":")[2] : t; +} +function f_(t) { + const e = {}; + for (const [r, n] of Object.entries(t)) { + const i = n.methods || [], s = n.events || [], o = n.accounts || [], a = A1(r) ? [r] : n.chains ? n.chains : hE(n.accounts); + e[r] = { chains: a, methods: i, events: s, accounts: o }; + } + return e; +} +function tm(t) { + return typeof t == "number" ? t : t.includes("0x") ? parseInt(t, 16) : (t = t.includes(":") ? t.split(":")[1] : t, isNaN(Number(t)) ? t : Number(t)); +} +const dE = {}, Pr = (t) => dE[t], rm = (t, e) => { + dE[t] = e; +}; +class dW { + constructor(e) { + this.name = "polkadot", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + } + updateNamespace(e) { + this.namespace = Object.assign(this.namespace, e); + } + requestAccounts() { + return this.getAccounts(); + } + getDefaultChain() { + if (this.chainId) return this.chainId; + if (this.namespace.defaultChain) return this.namespace.defaultChain; + const e = this.namespace.chains[0]; + if (!e) throw new Error("ChainId not found"); + return e.split(":")[1]; + } + request(e) { + return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); + } + setDefaultChain(e, r) { + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(Ji.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + } + getAccounts() { + const e = this.namespace.accounts; + return e ? e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]) || [] : []; + } + createHttpProviders() { + const e = {}; + return this.namespace.chains.forEach((r) => { + var n; + const i = Ga(r); + e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); + }), e; + } + getHttpProvider() { + const e = `${this.name}:${this.chainId}`, r = this.httpProviders[e]; + if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); + return r; + } + setHttpProvider(e, r) { + const n = this.createHttpProvider(e, r); + n && (this.httpProviders[e] = n); + } + createHttpProvider(e, r) { + const n = r || Ai(e, this.namespace, this.client.core.projectId); + if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); + return new Yi(new hs(n, Pr("disableProviderPing"))); + } +} +var pW = Object.defineProperty, gW = Object.defineProperties, mW = Object.getOwnPropertyDescriptors, l_ = Object.getOwnPropertySymbols, vW = Object.prototype.hasOwnProperty, bW = Object.prototype.propertyIsEnumerable, h_ = (t, e, r) => e in t ? pW(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, d_ = (t, e) => { + for (var r in e || (e = {})) vW.call(e, r) && h_(t, r, e[r]); + if (l_) for (var r of l_(e)) bW.call(e, r) && h_(t, r, e[r]); + return t; +}, p_ = (t, e) => gW(t, mW(e)); +class yW { + constructor(e) { + this.name = "eip155", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.httpProviders = this.createHttpProviders(), this.chainId = parseInt(this.getDefaultChain()); + } + async request(e) { + switch (e.request.method) { + case "eth_requestAccounts": + return this.getAccounts(); + case "eth_accounts": + return this.getAccounts(); + case "wallet_switchEthereumChain": + return await this.handleSwitchChain(e); + case "eth_chainId": + return parseInt(this.getDefaultChain()); + case "wallet_getCapabilities": + return await this.getCapabilities(e); + case "wallet_getCallsStatus": + return await this.getCallStatus(e); + } + return this.namespace.methods.includes(e.request.method) ? await this.client.request(e) : this.getHttpProvider().request(e.request); + } + updateNamespace(e) { + this.namespace = Object.assign(this.namespace, e); + } + setDefaultChain(e, r) { + this.httpProviders[e] || this.setHttpProvider(parseInt(e), r), this.chainId = parseInt(e), this.events.emit(Ji.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + } + requestAccounts() { + return this.getAccounts(); + } + getDefaultChain() { + if (this.chainId) return this.chainId.toString(); + if (this.namespace.defaultChain) return this.namespace.defaultChain; + const e = this.namespace.chains[0]; + if (!e) throw new Error("ChainId not found"); + return e.split(":")[1]; + } + createHttpProvider(e, r) { + const n = r || Ai(`${this.name}:${e}`, this.namespace, this.client.core.projectId); + if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); + return new Yi(new hs(n, Pr("disableProviderPing"))); + } + setHttpProvider(e, r) { + const n = this.createHttpProvider(e, r); + n && (this.httpProviders[e] = n); + } + createHttpProviders() { + const e = {}; + return this.namespace.chains.forEach((r) => { + var n; + const i = parseInt(Ga(r)); + e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); + }), e; + } + getAccounts() { + const e = this.namespace.accounts; + return e ? [...new Set(e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]))] : []; + } + getHttpProvider() { + const e = this.chainId, r = this.httpProviders[e]; + if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); + return r; + } + async handleSwitchChain(e) { + var r, n; + let i = e.request.params ? (r = e.request.params[0]) == null ? void 0 : r.chainId : "0x0"; + i = i.startsWith("0x") ? i : `0x${i}`; + const s = parseInt(i, 16); + if (this.isChainApproved(s)) this.setDefaultChain(`${s}`); + else if (this.namespace.methods.includes("wallet_switchEthereumChain")) await this.client.request({ topic: e.topic, request: { method: e.request.method, params: [{ chainId: i }] }, chainId: (n = this.namespace.chains) == null ? void 0 : n[0] }), this.setDefaultChain(`${s}`); + else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`); + return null; + } + isChainApproved(e) { + return this.namespace.chains.includes(`${this.name}:${e}`); + } + async getCapabilities(e) { + var r, n, i; + const s = (n = (r = e.request) == null ? void 0 : r.params) == null ? void 0 : n[0]; + if (!s) throw new Error("Missing address parameter in `wallet_getCapabilities` request"); + const o = this.client.session.get(e.topic), a = ((i = o?.sessionProperties) == null ? void 0 : i.capabilities) || {}; + if (a != null && a[s]) return a?.[s]; + const f = await this.client.request(e); + try { + await this.client.session.update(e.topic, { sessionProperties: p_(d_({}, o.sessionProperties || {}), { capabilities: p_(d_({}, a || {}), { [s]: f }) }) }); + } catch (u) { + console.warn("Failed to update session with capabilities", u); + } + return f; + } + async getCallStatus(e) { + var r, n; + const i = this.client.session.get(e.topic), s = (r = i.sessionProperties) == null ? void 0 : r.bundler_name; + if (s) { + const a = this.getBundlerUrl(e.chainId, s); + try { + return await this.getUserOperationReceipt(a, e); + } catch (f) { + console.warn("Failed to fetch call status from bundler", f, a); + } + } + const o = (n = i.sessionProperties) == null ? void 0 : n.bundler_url; + if (o) try { + return await this.getUserOperationReceipt(o, e); + } catch (a) { + console.warn("Failed to fetch call status from custom bundler", a, o); + } + if (this.namespace.methods.includes(e.request.method)) return await this.client.request(e); + throw new Error("Fetching call status not approved by the wallet."); + } + async getUserOperationReceipt(e, r) { + var n; + const i = new URL(e), s = await fetch(i, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify($o("eth_getUserOperationReceipt", [(n = r.request.params) == null ? void 0 : n[0]])) }); + if (!s.ok) throw new Error(`Failed to fetch user operation receipt - ${s.status}`); + return await s.json(); + } + getBundlerUrl(e, r) { + return `${iW}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`; + } +} +class wW { + constructor(e) { + this.name = "solana", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + } + updateNamespace(e) { + this.namespace = Object.assign(this.namespace, e); + } + requestAccounts() { + return this.getAccounts(); + } + request(e) { + return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); + } + setDefaultChain(e, r) { + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(Ji.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + } + getDefaultChain() { + if (this.chainId) return this.chainId; + if (this.namespace.defaultChain) return this.namespace.defaultChain; + const e = this.namespace.chains[0]; + if (!e) throw new Error("ChainId not found"); + return e.split(":")[1]; + } + getAccounts() { + const e = this.namespace.accounts; + return e ? [...new Set(e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]))] : []; + } + createHttpProviders() { + const e = {}; + return this.namespace.chains.forEach((r) => { + var n; + const i = Ga(r); + e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); + }), e; + } + getHttpProvider() { + const e = `${this.name}:${this.chainId}`, r = this.httpProviders[e]; + if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); + return r; + } + setHttpProvider(e, r) { + const n = this.createHttpProvider(e, r); + n && (this.httpProviders[e] = n); + } + createHttpProvider(e, r) { + const n = r || Ai(e, this.namespace, this.client.core.projectId); + if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); + return new Yi(new hs(n, Pr("disableProviderPing"))); + } +} +let xW = class { + constructor(e) { + this.name = "cosmos", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + } + updateNamespace(e) { + this.namespace = Object.assign(this.namespace, e); + } + requestAccounts() { + return this.getAccounts(); + } + getDefaultChain() { + if (this.chainId) return this.chainId; + if (this.namespace.defaultChain) return this.namespace.defaultChain; + const e = this.namespace.chains[0]; + if (!e) throw new Error("ChainId not found"); + return e.split(":")[1]; + } + request(e) { + return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); + } + setDefaultChain(e, r) { + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(Ji.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + } + getAccounts() { + const e = this.namespace.accounts; + return e ? [...new Set(e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]))] : []; + } + createHttpProviders() { + const e = {}; + return this.namespace.chains.forEach((r) => { + var n; + const i = Ga(r); + e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); + }), e; + } + getHttpProvider() { + const e = `${this.name}:${this.chainId}`, r = this.httpProviders[e]; + if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); + return r; + } + setHttpProvider(e, r) { + const n = this.createHttpProvider(e, r); + n && (this.httpProviders[e] = n); + } + createHttpProvider(e, r) { + const n = r || Ai(e, this.namespace, this.client.core.projectId); + if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); + return new Yi(new hs(n, Pr("disableProviderPing"))); + } +}, _W = class { + constructor(e) { + this.name = "algorand", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + } + updateNamespace(e) { + this.namespace = Object.assign(this.namespace, e); + } + requestAccounts() { + return this.getAccounts(); + } + request(e) { + return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); + } + setDefaultChain(e, r) { + if (!this.httpProviders[e]) { + const n = r || Ai(`${this.name}:${e}`, this.namespace, this.client.core.projectId); + if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); + this.setHttpProvider(e, n); + } + this.chainId = e, this.events.emit(Ji.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + } + getDefaultChain() { + if (this.chainId) return this.chainId; + if (this.namespace.defaultChain) return this.namespace.defaultChain; + const e = this.namespace.chains[0]; + if (!e) throw new Error("ChainId not found"); + return e.split(":")[1]; + } + getAccounts() { + const e = this.namespace.accounts; + return e ? [...new Set(e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]))] : []; + } + createHttpProviders() { + const e = {}; + return this.namespace.chains.forEach((r) => { + var n; + e[r] = this.createHttpProvider(r, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); + }), e; + } + getHttpProvider() { + const e = `${this.name}:${this.chainId}`, r = this.httpProviders[e]; + if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); + return r; + } + setHttpProvider(e, r) { + const n = this.createHttpProvider(e, r); + n && (this.httpProviders[e] = n); + } + createHttpProvider(e, r) { + const n = r || Ai(e, this.namespace, this.client.core.projectId); + return typeof n > "u" ? void 0 : new Yi(new hs(n, Pr("disableProviderPing"))); + } +}, EW = class { + constructor(e) { + this.name = "cip34", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + } + updateNamespace(e) { + this.namespace = Object.assign(this.namespace, e); + } + requestAccounts() { + return this.getAccounts(); + } + getDefaultChain() { + if (this.chainId) return this.chainId; + if (this.namespace.defaultChain) return this.namespace.defaultChain; + const e = this.namespace.chains[0]; + if (!e) throw new Error("ChainId not found"); + return e.split(":")[1]; + } + request(e) { + return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); + } + setDefaultChain(e, r) { + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(Ji.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + } + getAccounts() { + const e = this.namespace.accounts; + return e ? [...new Set(e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]))] : []; + } + createHttpProviders() { + const e = {}; + return this.namespace.chains.forEach((r) => { + const n = this.getCardanoRPCUrl(r), i = Ga(r); + e[i] = this.createHttpProvider(i, n); + }), e; + } + getHttpProvider() { + const e = `${this.name}:${this.chainId}`, r = this.httpProviders[e]; + if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); + return r; + } + getCardanoRPCUrl(e) { + const r = this.namespace.rpcMap; + if (r) return r[e]; + } + setHttpProvider(e, r) { + const n = this.createHttpProvider(e, r); + n && (this.httpProviders[e] = n); + } + createHttpProvider(e, r) { + const n = r || this.getCardanoRPCUrl(e); + if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); + return new Yi(new hs(n, Pr("disableProviderPing"))); + } +}, SW = class { + constructor(e) { + this.name = "elrond", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + } + updateNamespace(e) { + this.namespace = Object.assign(this.namespace, e); + } + requestAccounts() { + return this.getAccounts(); + } + request(e) { + return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); + } + setDefaultChain(e, r) { + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(Ji.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + } + getDefaultChain() { + if (this.chainId) return this.chainId; + if (this.namespace.defaultChain) return this.namespace.defaultChain; + const e = this.namespace.chains[0]; + if (!e) throw new Error("ChainId not found"); + return e.split(":")[1]; + } + getAccounts() { + const e = this.namespace.accounts; + return e ? [...new Set(e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]))] : []; + } + createHttpProviders() { + const e = {}; + return this.namespace.chains.forEach((r) => { + var n; + const i = Ga(r); + e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); + }), e; + } + getHttpProvider() { + const e = `${this.name}:${this.chainId}`, r = this.httpProviders[e]; + if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); + return r; + } + setHttpProvider(e, r) { + const n = this.createHttpProvider(e, r); + n && (this.httpProviders[e] = n); + } + createHttpProvider(e, r) { + const n = r || Ai(e, this.namespace, this.client.core.projectId); + if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); + return new Yi(new hs(n, Pr("disableProviderPing"))); + } +}; +class AW { + constructor(e) { + this.name = "multiversx", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + } + updateNamespace(e) { + this.namespace = Object.assign(this.namespace, e); + } + requestAccounts() { + return this.getAccounts(); + } + request(e) { + return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); + } + setDefaultChain(e, r) { + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(Ji.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + } + getDefaultChain() { + if (this.chainId) return this.chainId; + if (this.namespace.defaultChain) return this.namespace.defaultChain; + const e = this.namespace.chains[0]; + if (!e) throw new Error("ChainId not found"); + return e.split(":")[1]; + } + getAccounts() { + const e = this.namespace.accounts; + return e ? [...new Set(e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]))] : []; + } + createHttpProviders() { + const e = {}; + return this.namespace.chains.forEach((r) => { + var n; + const i = Ga(r); + e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); + }), e; + } + getHttpProvider() { + const e = `${this.name}:${this.chainId}`, r = this.httpProviders[e]; + if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); + return r; + } + setHttpProvider(e, r) { + const n = this.createHttpProvider(e, r); + n && (this.httpProviders[e] = n); + } + createHttpProvider(e, r) { + const n = r || Ai(e, this.namespace, this.client.core.projectId); + if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); + return new Yi(new hs(n, Pr("disableProviderPing"))); + } +} +let PW = class { + constructor(e) { + this.name = "near", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + } + updateNamespace(e) { + this.namespace = Object.assign(this.namespace, e); + } + requestAccounts() { + return this.getAccounts(); + } + getDefaultChain() { + if (this.chainId) return this.chainId; + if (this.namespace.defaultChain) return this.namespace.defaultChain; + const e = this.namespace.chains[0]; + if (!e) throw new Error("ChainId not found"); + return e.split(":")[1]; + } + request(e) { + return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); + } + setDefaultChain(e, r) { + if (this.chainId = e, !this.httpProviders[e]) { + const n = r || Ai(`${this.name}:${e}`, this.namespace); + if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); + this.setHttpProvider(e, n); + } + this.events.emit(Ji.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + } + getAccounts() { + const e = this.namespace.accounts; + return e ? e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]) || [] : []; + } + createHttpProviders() { + const e = {}; + return this.namespace.chains.forEach((r) => { + var n; + e[r] = this.createHttpProvider(r, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); + }), e; + } + getHttpProvider() { + const e = `${this.name}:${this.chainId}`, r = this.httpProviders[e]; + if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); + return r; + } + setHttpProvider(e, r) { + const n = this.createHttpProvider(e, r); + n && (this.httpProviders[e] = n); + } + createHttpProvider(e, r) { + const n = r || Ai(e, this.namespace); + return typeof n > "u" ? void 0 : new Yi(new hs(n, Pr("disableProviderPing"))); + } +}; +class MW { + constructor(e) { + this.name = "tezos", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + } + updateNamespace(e) { + this.namespace = Object.assign(this.namespace, e); + } + requestAccounts() { + return this.getAccounts(); + } + getDefaultChain() { + if (this.chainId) return this.chainId; + if (this.namespace.defaultChain) return this.namespace.defaultChain; + const e = this.namespace.chains[0]; + if (!e) throw new Error("ChainId not found"); + return e.split(":")[1]; + } + request(e) { + return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); + } + setDefaultChain(e, r) { + if (this.chainId = e, !this.httpProviders[e]) { + const n = r || Ai(`${this.name}:${e}`, this.namespace); + if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); + this.setHttpProvider(e, n); + } + this.events.emit(Ji.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); + } + getAccounts() { + const e = this.namespace.accounts; + return e ? e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]) || [] : []; + } + createHttpProviders() { + const e = {}; + return this.namespace.chains.forEach((r) => { + e[r] = this.createHttpProvider(r); + }), e; + } + getHttpProvider() { + const e = `${this.name}:${this.chainId}`, r = this.httpProviders[e]; + if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); + return r; + } + setHttpProvider(e, r) { + const n = this.createHttpProvider(e, r); + n && (this.httpProviders[e] = n); + } + createHttpProvider(e, r) { + const n = r || Ai(e, this.namespace); + return typeof n > "u" ? void 0 : new Yi(new hs(n)); + } +} +class IW { + constructor(e) { + this.name = wc, this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); + } + updateNamespace(e) { + this.namespace.chains = [...new Set((this.namespace.chains || []).concat(e.chains || []))], this.namespace.accounts = [...new Set((this.namespace.accounts || []).concat(e.accounts || []))], this.namespace.methods = [...new Set((this.namespace.methods || []).concat(e.methods || []))], this.namespace.events = [...new Set((this.namespace.events || []).concat(e.events || []))], this.httpProviders = this.createHttpProviders(); + } + requestAccounts() { + return this.getAccounts(); + } + request(e) { + return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider(e.chainId).request(e.request); + } + setDefaultChain(e, r) { + this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(Ji.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); + } + getDefaultChain() { + if (this.chainId) return this.chainId; + if (this.namespace.defaultChain) return this.namespace.defaultChain; + const e = this.namespace.chains[0]; + if (!e) throw new Error("ChainId not found"); + return e.split(":")[1]; + } + getAccounts() { + const e = this.namespace.accounts; + return e ? [...new Set(e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]))] : []; + } + createHttpProviders() { + var e, r; + const n = {}; + return (r = (e = this.namespace) == null ? void 0 : e.accounts) == null || r.forEach((i) => { + const s = Nc(i); + n[`${s.namespace}:${s.reference}`] = this.createHttpProvider(i); + }), n; + } + getHttpProvider(e) { + const r = this.httpProviders[e]; + if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); + return r; + } + setHttpProvider(e, r) { + const n = this.createHttpProvider(e, r); + n && (this.httpProviders[e] = n); + } + createHttpProvider(e, r) { + const n = r || Ai(e, this.namespace, this.client.core.projectId); + if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); + return new Yi(new hs(n, Pr("disableProviderPing"))); + } +} +var CW = Object.defineProperty, RW = Object.defineProperties, TW = Object.getOwnPropertyDescriptors, g_ = Object.getOwnPropertySymbols, DW = Object.prototype.hasOwnProperty, OW = Object.prototype.propertyIsEnumerable, m_ = (t, e, r) => e in t ? CW(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Ah = (t, e) => { + for (var r in e || (e = {})) DW.call(e, r) && m_(t, r, e[r]); + if (g_) for (var r of g_(e)) OW.call(e, r) && m_(t, r, e[r]); + return t; +}, nm = (t, e) => RW(t, TW(e)); +let fv = class pE { + constructor(e) { + this.events = new l1(), this.rpcProviders = {}, this.shouldAbortPairingAttempt = !1, this.maxPairingAttempts = 10, this.disableProviderPing = !1, this.providerOpts = e, this.logger = typeof e?.logger < "u" && typeof e?.logger != "string" ? e.logger : Xf(Vd({ level: e?.logger || s_ })), this.disableProviderPing = e?.disableProviderPing || !1; + } + static async init(e) { + const r = new pE(e); + return await r.initialize(), r; + } + async request(e, r, n) { + const [i, s] = this.validateChain(r); + if (!this.session) throw new Error("Please call connect() before request()"); + return await this.getProvider(i).request({ request: Ah({}, e), chainId: `${i}:${s}`, topic: this.session.topic, expiry: n }); + } + sendAsync(e, r, n, i) { + const s = (/* @__PURE__ */ new Date()).getTime(); + this.request(e, n, i).then((o) => r(null, r0(s, o))).catch((o) => r(o, void 0)); + } + async enable() { + if (!this.client) throw new Error("Sign Client not initialized"); + return this.session || await this.connect({ namespaces: this.namespaces, optionalNamespaces: this.optionalNamespaces, sessionProperties: this.sessionProperties }), await this.requestAccounts(); + } + async disconnect() { + var e; + if (!this.session) throw new Error("Please call connect() before enable()"); + await this.client.disconnect({ topic: (e = this.session) == null ? void 0 : e.topic, reason: Nr("USER_DISCONNECTED") }), await this.cleanup(); + } + async connect(e) { + if (!this.client) throw new Error("Sign Client not initialized"); + if (this.setNamespaces(e), await this.cleanupPendingPairings(), !e.skipPairing) return await this.pair(e.pairingTopic); + } + async authenticate(e, r) { + if (!this.client) throw new Error("Sign Client not initialized"); + this.setNamespaces(e), await this.cleanupPendingPairings(); + const { uri: n, response: i } = await this.client.authenticate(e, r); + n && (this.uri = n, this.events.emit("display_uri", n)); + const s = await i(); + if (this.session = s.session, this.session) { + const o = f_(this.session.namespaces); + this.namespaces = em(this.namespaces, o), this.persist("namespaces", this.namespaces), this.onConnect(); + } + return s; + } + on(e, r) { + this.events.on(e, r); + } + once(e, r) { + this.events.once(e, r); + } + removeListener(e, r) { + this.events.removeListener(e, r); + } + off(e, r) { + this.events.off(e, r); + } + get isWalletConnect() { + return !0; + } + async pair(e) { + this.shouldAbortPairingAttempt = !1; + let r = 0; + do { + if (this.shouldAbortPairingAttempt) throw new Error("Pairing aborted"); + if (r >= this.maxPairingAttempts) throw new Error("Max auto pairing attempts reached"); + const { uri: n, approval: i } = await this.client.connect({ pairingTopic: e, requiredNamespaces: this.namespaces, optionalNamespaces: this.optionalNamespaces, sessionProperties: this.sessionProperties }); + n && (this.uri = n, this.events.emit("display_uri", n)), await i().then((s) => { + this.session = s; + const o = f_(s.namespaces); + this.namespaces = em(this.namespaces, o), this.persist("namespaces", this.namespaces); + }).catch((s) => { + if (s.message !== fE) throw s; + r++; + }); + } while (!this.session); + return this.onConnect(), this.session; + } + setDefaultChain(e, r) { + try { + if (!this.session) return; + const [n, i] = this.validateChain(e), s = this.getProvider(n); + s.name === wc ? s.setDefaultChain(`${n}:${i}`, r) : s.setDefaultChain(i, r); + } catch (n) { + if (!/Please call connect/.test(n.message)) throw n; + } + } + async cleanupPendingPairings(e = {}) { + this.logger.info("Cleaning up inactive pairings..."); + const r = this.client.pairing.getAll(); + if (Ba(r)) { + for (const n of r) e.deletePairings ? this.client.core.expirer.set(n.topic, 0) : await this.client.core.relayer.subscriber.unsubscribe(n.topic); + this.logger.info(`Inactive pairings cleared: ${r.length}`); + } + } + abortPairingAttempt() { + this.shouldAbortPairingAttempt = !0; + } + async checkStorage() { + if (this.namespaces = await this.getFromStore("namespaces"), this.optionalNamespaces = await this.getFromStore("optionalNamespaces") || {}, this.client.session.length) { + const e = this.client.session.keys.length - 1; + this.session = this.client.session.get(this.client.session.keys[e]), this.createProviders(); + } + } + async initialize() { + this.logger.trace("Initialized"), await this.createClient(), await this.checkStorage(), this.registerEventListeners(); + } + async createClient() { + this.client = this.providerOpts.client || await T1.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || s_, relayUrl: this.providerOpts.relayUrl || tW, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); + } + createProviders() { + if (!this.client) throw new Error("Sign Client not initialized"); + if (!this.session) throw new Error("Session not initialized. Please call connect() before enable()"); + const e = [...new Set(Object.keys(this.session.namespaces).map((r) => Gu(r)))]; + rm("client", this.client), rm("events", this.events), rm("disableProviderPing", this.disableProviderPing), e.forEach((r) => { + if (!this.session) return; + const n = lW(r, this.session), i = hE(n), s = em(this.namespaces, this.optionalNamespaces), o = nm(Ah({}, s[r]), { accounts: n, chains: i }); + switch (r) { + case "eip155": + this.rpcProviders[r] = new yW({ namespace: o }); + break; + case "algorand": + this.rpcProviders[r] = new _W({ namespace: o }); + break; + case "solana": + this.rpcProviders[r] = new wW({ namespace: o }); + break; + case "cosmos": + this.rpcProviders[r] = new xW({ namespace: o }); + break; + case "polkadot": + this.rpcProviders[r] = new dW({ namespace: o }); + break; + case "cip34": + this.rpcProviders[r] = new EW({ namespace: o }); + break; + case "elrond": + this.rpcProviders[r] = new SW({ namespace: o }); + break; + case "multiversx": + this.rpcProviders[r] = new AW({ namespace: o }); + break; + case "near": + this.rpcProviders[r] = new PW({ namespace: o }); + break; + case "tezos": + this.rpcProviders[r] = new MW({ namespace: o }); + break; + default: + this.rpcProviders[wc] ? this.rpcProviders[wc].updateNamespace(o) : this.rpcProviders[wc] = new IW({ namespace: o }); + } + }); + } + registerEventListeners() { + if (typeof this.client > "u") throw new Error("Sign Client is not initialized"); + this.client.on("session_ping", (e) => { + this.events.emit("session_ping", e); + }), this.client.on("session_event", (e) => { + const { params: r } = e, { event: n } = r; + if (n.name === "accountsChanged") { + const i = n.data; + i && Ba(i) && this.events.emit("accountsChanged", i.map(hW)); + } else if (n.name === "chainChanged") { + const i = r.chainId, s = r.event.data, o = Gu(i), a = tm(i) !== tm(s) ? `${o}:${tm(s)}` : i; + this.onChainChanged(a); + } else this.events.emit(n.name, n.data); + this.events.emit("session_event", e); + }), this.client.on("session_update", ({ topic: e, params: r }) => { + var n; + const { namespaces: i } = r, s = (n = this.client) == null ? void 0 : n.session.get(e); + this.session = nm(Ah({}, s), { namespaces: i }), this.onSessionUpdate(), this.events.emit("session_update", { topic: e, params: r }); + }), this.client.on("session_delete", async (e) => { + await this.cleanup(), this.events.emit("session_delete", e), this.events.emit("disconnect", nm(Ah({}, Nr("USER_DISCONNECTED")), { data: e.topic })); + }), this.on(Ji.DEFAULT_CHAIN_CHANGED, (e) => { + this.onChainChanged(e, !0); + }); + } + getProvider(e) { + return this.rpcProviders[e] || this.rpcProviders[wc]; + } + onSessionUpdate() { + Object.keys(this.rpcProviders).forEach((e) => { + var r; + this.getProvider(e).updateNamespace((r = this.session) == null ? void 0 : r.namespaces[e]); + }); + } + setNamespaces(e) { + const { namespaces: r, optionalNamespaces: n, sessionProperties: i } = e; + r && Object.keys(r).length && (this.namespaces = r), n && Object.keys(n).length && (this.optionalNamespaces = n), this.sessionProperties = i, this.persist("namespaces", r), this.persist("optionalNamespaces", n); + } + validateChain(e) { + const [r, n] = e?.split(":") || ["", ""]; + if (!this.namespaces || !Object.keys(this.namespaces).length) return [r, n]; + if (r && !Object.keys(this.namespaces || {}).map((o) => Gu(o)).includes(r)) throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`); + if (r && n) return [r, n]; + const i = Gu(Object.keys(this.namespaces)[0]), s = this.rpcProviders[i].getDefaultChain(); + return [i, s]; + } + async requestAccounts() { + const [e] = this.validateChain(); + return await this.getProvider(e).requestAccounts(); + } + onChainChanged(e, r = !1) { + if (!this.namespaces) return; + const [n, i] = this.validateChain(e); + i && (r || this.getProvider(n).setDefaultChain(i), this.namespaces[n] ? this.namespaces[n].defaultChain = i : this.namespaces[`${n}:${i}`] ? this.namespaces[`${n}:${i}`].defaultChain = i : this.namespaces[`${n}:${i}`] = { defaultChain: i }, this.persist("namespaces", this.namespaces), this.events.emit("chainChanged", i)); + } + onConnect() { + this.createProviders(), this.events.emit("connect", { session: this.session }); + } + async cleanup() { + this.session = void 0, this.namespaces = void 0, this.optionalNamespaces = void 0, this.sessionProperties = void 0, this.persist("namespaces", void 0), this.persist("optionalNamespaces", void 0), this.persist("sessionProperties", void 0), await this.cleanupPendingPairings({ deletePairings: !0 }); + } + persist(e, r) { + this.client.core.storage.setItem(`${o_}/${e}`, r); + } + async getFromStore(e) { + return await this.client.core.storage.getItem(`${o_}/${e}`); + } +}; +const NW = fv; +function LW() { + return new Promise((t) => { + const e = []; + let r; + window.addEventListener("eip6963:announceProvider", (n) => { + const { detail: i } = n; + r && clearTimeout(r), e.push(i), r = setTimeout(() => t(e), 200); + }), r = setTimeout(() => t(e), 200), window.dispatchEvent(new Event("eip6963:requestProvider")); + }); +} +class Os { + constructor(e, r) { + this.scope = e, this.module = r; + } + storeObject(e, r) { + this.setItem(e, JSON.stringify(r)); + } + loadObject(e) { + const r = this.getItem(e); + return r ? JSON.parse(r) : void 0; + } + setItem(e, r) { + localStorage.setItem(this.scopedKey(e), r); + } + getItem(e) { + return localStorage.getItem(this.scopedKey(e)); + } + removeItem(e) { + localStorage.removeItem(this.scopedKey(e)); + } + clear() { + const e = this.scopedKey(""), r = []; + for (let n = 0; n < localStorage.length; n++) { + const i = localStorage.key(n); + typeof i == "string" && i.startsWith(e) && r.push(i); + } + r.forEach((n) => localStorage.removeItem(n)); + } + scopedKey(e) { + return `-${this.scope}${this.module ? `:${this.module}` : ""}:${e}`; + } + static clearAll() { + new Os("CBWSDK").clear(), new Os("walletlink").clear(); + } +} +const un = { + rpc: { + invalidInput: -32e3, + resourceNotFound: -32001, + resourceUnavailable: -32002, + transactionRejected: -32003, + methodNotSupported: -32004, + limitExceeded: -32005, + parse: -32700, + invalidRequest: -32600, + methodNotFound: -32601, + invalidParams: -32602, + internal: -32603 + }, + provider: { + userRejectedRequest: 4001, + unauthorized: 4100, + unsupportedMethod: 4200, + disconnected: 4900, + chainDisconnected: 4901, + unsupportedChain: 4902 + } +}, lv = { + "-32700": { + standard: "JSON RPC 2.0", + message: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text." + }, + "-32600": { + standard: "JSON RPC 2.0", + message: "The JSON sent is not a valid Request object." + }, + "-32601": { + standard: "JSON RPC 2.0", + message: "The method does not exist / is not available." + }, + "-32602": { + standard: "JSON RPC 2.0", + message: "Invalid method parameter(s)." + }, + "-32603": { + standard: "JSON RPC 2.0", + message: "Internal JSON-RPC error." + }, + "-32000": { + standard: "EIP-1474", + message: "Invalid input." + }, + "-32001": { + standard: "EIP-1474", + message: "Resource not found." + }, + "-32002": { + standard: "EIP-1474", + message: "Resource unavailable." + }, + "-32003": { + standard: "EIP-1474", + message: "Transaction rejected." + }, + "-32004": { + standard: "EIP-1474", + message: "Method not supported." + }, + "-32005": { + standard: "EIP-1474", + message: "Request limit exceeded." + }, + 4001: { + standard: "EIP-1193", + message: "User rejected the request." + }, + 4100: { + standard: "EIP-1193", + message: "The requested account and/or method has not been authorized by the user." + }, + 4200: { + standard: "EIP-1193", + message: "The requested method is not supported by this Ethereum provider." + }, + 4900: { + standard: "EIP-1193", + message: "The provider is disconnected from all chains." + }, + 4901: { + standard: "EIP-1193", + message: "The provider is disconnected from the specified chain." + }, + 4902: { + standard: "EIP-3085", + message: "Unrecognized chain ID." + } +}, gE = "Unspecified error message.", kW = "Unspecified server error."; +function D1(t, e = gE) { + if (t && Number.isInteger(t)) { + const r = t.toString(); + if (hv(lv, r)) + return lv[r].message; + if (mE(t)) + return kW; + } + return e; +} +function $W(t) { + if (!Number.isInteger(t)) + return !1; + const e = t.toString(); + return !!(lv[e] || mE(t)); +} +function BW(t, { shouldIncludeStack: e = !1 } = {}) { + const r = {}; + if (t && typeof t == "object" && !Array.isArray(t) && hv(t, "code") && $W(t.code)) { + const n = t; + r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, hv(n, "data") && (r.data = n.data)) : (r.message = D1(r.code), r.data = { originalError: v_(t) }); + } else + r.code = un.rpc.internal, r.message = b_(t, "message") ? t.message : gE, r.data = { originalError: v_(t) }; + return e && (r.stack = b_(t, "stack") ? t.stack : void 0), r; +} +function mE(t) { + return t >= -32099 && t <= -32e3; +} +function v_(t) { + return t && typeof t == "object" && !Array.isArray(t) ? Object.assign({}, t) : t; +} +function hv(t, e) { + return Object.prototype.hasOwnProperty.call(t, e); +} +function b_(t, e) { + return typeof t == "object" && t !== null && e in t && typeof t[e] == "string"; +} +const Ar = { + rpc: { + parse: (t) => Bi(un.rpc.parse, t), + invalidRequest: (t) => Bi(un.rpc.invalidRequest, t), + invalidParams: (t) => Bi(un.rpc.invalidParams, t), + methodNotFound: (t) => Bi(un.rpc.methodNotFound, t), + internal: (t) => Bi(un.rpc.internal, t), + server: (t) => { + if (!t || typeof t != "object" || Array.isArray(t)) + throw new Error("Ethereum RPC Server errors must provide single object argument."); + const { code: e } = t; + if (!Number.isInteger(e) || e > -32005 || e < -32099) + throw new Error('"code" must be an integer such that: -32099 <= code <= -32005'); + return Bi(e, t); + }, + invalidInput: (t) => Bi(un.rpc.invalidInput, t), + resourceNotFound: (t) => Bi(un.rpc.resourceNotFound, t), + resourceUnavailable: (t) => Bi(un.rpc.resourceUnavailable, t), + transactionRejected: (t) => Bi(un.rpc.transactionRejected, t), + methodNotSupported: (t) => Bi(un.rpc.methodNotSupported, t), + limitExceeded: (t) => Bi(un.rpc.limitExceeded, t) + }, + provider: { + userRejectedRequest: (t) => mc(un.provider.userRejectedRequest, t), + unauthorized: (t) => mc(un.provider.unauthorized, t), + unsupportedMethod: (t) => mc(un.provider.unsupportedMethod, t), + disconnected: (t) => mc(un.provider.disconnected, t), + chainDisconnected: (t) => mc(un.provider.chainDisconnected, t), + unsupportedChain: (t) => mc(un.provider.unsupportedChain, t), + custom: (t) => { + if (!t || typeof t != "object" || Array.isArray(t)) + throw new Error("Ethereum Provider custom errors must provide single object argument."); + const { code: e, message: r, data: n } = t; + if (!r || typeof r != "string") + throw new Error('"message" must be a nonempty string'); + return new yE(e, r, n); + } + } +}; +function Bi(t, e) { + const [r, n] = vE(e); + return new bE(t, r || D1(t), n); +} +function mc(t, e) { + const [r, n] = vE(e); + return new yE(t, r || D1(t), n); +} +function vE(t) { + if (t) { + if (typeof t == "string") + return [t]; + if (typeof t == "object" && !Array.isArray(t)) { + const { message: e, data: r } = t; + if (e && typeof e != "string") + throw new Error("Must specify string message."); + return [e || void 0, r]; + } + } + return []; +} +class bE extends Error { + constructor(e, r, n) { + if (!Number.isInteger(e)) + throw new Error('"code" must be an integer.'); + if (!r || typeof r != "string") + throw new Error('"message" must be a nonempty string.'); + super(r), this.code = e, n !== void 0 && (this.data = n); + } +} +class yE extends bE { + /** + * Create an Ethereum Provider JSON-RPC error. + * `code` must be an integer in the 1000 <= 4999 range. + */ + constructor(e, r, n) { + if (!FW(e)) + throw new Error('"code" must be an integer such that: 1000 <= code <= 4999'); + super(e, r, n); + } +} +function FW(t) { + return Number.isInteger(t) && t >= 1e3 && t <= 4999; +} +function O1() { + return (t) => t; +} +const $f = O1(), jW = O1(), UW = O1(); +function eo(t) { + return Math.floor(t); +} +const wE = /^[0-9]*$/, xE = /^[a-f0-9]*$/; +function Ea(t) { + return N1(crypto.getRandomValues(new Uint8Array(t))); +} +function N1(t) { + return [...t].map((e) => e.toString(16).padStart(2, "0")).join(""); +} +function Vh(t) { + return new Uint8Array(t.match(/.{1,2}/g).map((e) => Number.parseInt(e, 16))); +} +function nf(t, e = !1) { + const r = t.toString("hex"); + return $f(e ? `0x${r}` : r); +} +function im(t) { + return nf(dv(t), !0); +} +function Es(t) { + return UW(t.toString(10)); +} +function Bo(t) { + return $f(`0x${BigInt(t).toString(16)}`); +} +function _E(t) { + return t.startsWith("0x") || t.startsWith("0X"); +} +function L1(t) { + return _E(t) ? t.slice(2) : t; +} +function EE(t) { + return _E(t) ? `0x${t.slice(2)}` : `0x${t}`; +} +function a0(t) { + if (typeof t != "string") + return !1; + const e = L1(t).toLowerCase(); + return xE.test(e); +} +function qW(t, e = !1) { + if (typeof t == "string") { + const r = L1(t).toLowerCase(); + if (xE.test(r)) + return $f(e ? `0x${r}` : r); + } + throw Ar.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`); +} +function k1(t, e = !1) { + let r = qW(t, !1); + return r.length % 2 === 1 && (r = $f(`0${r}`)), e ? $f(`0x${r}`) : r; +} +function Mo(t) { + if (typeof t == "string") { + const e = L1(t).toLowerCase(); + if (a0(e) && e.length === 40) + return jW(EE(e)); + } + throw Ar.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`); +} +function dv(t) { + if (Buffer.isBuffer(t)) + return t; + if (typeof t == "string") { + if (a0(t)) { + const e = k1(t, !1); + return Buffer.from(e, "hex"); + } + return Buffer.from(t, "utf8"); + } + throw Ar.rpc.invalidParams(`Not binary data: ${String(t)}`); +} +function sf(t) { + if (typeof t == "number" && Number.isInteger(t)) + return eo(t); + if (typeof t == "string") { + if (wE.test(t)) + return eo(Number(t)); + if (a0(t)) + return eo(Number(BigInt(k1(t, !0)))); + } + throw Ar.rpc.invalidParams(`Not an integer: ${String(t)}`); +} +function Fu(t) { + if (t !== null && (typeof t == "bigint" || HW(t))) + return BigInt(t.toString(10)); + if (typeof t == "number") + return BigInt(sf(t)); + if (typeof t == "string") { + if (wE.test(t)) + return BigInt(t); + if (a0(t)) + return BigInt(k1(t, !0)); + } + throw Ar.rpc.invalidParams(`Not an integer: ${String(t)}`); +} +function zW(t) { + if (typeof t == "string") + return JSON.parse(t); + if (typeof t == "object") + return t; + throw Ar.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`); +} +function HW(t) { + if (t == null || typeof t.constructor != "function") + return !1; + const { constructor: e } = t; + return typeof e.config == "function" && typeof e.EUCLID == "number"; +} +async function WW() { + return crypto.subtle.generateKey({ + name: "ECDH", + namedCurve: "P-256" + }, !0, ["deriveKey"]); +} +async function KW(t, e) { + return crypto.subtle.deriveKey({ + name: "ECDH", + public: e + }, t, { + name: "AES-GCM", + length: 256 + }, !1, ["encrypt", "decrypt"]); +} +async function VW(t, e) { + const r = crypto.getRandomValues(new Uint8Array(12)), n = await crypto.subtle.encrypt({ + name: "AES-GCM", + iv: r + }, t, new TextEncoder().encode(e)); + return { iv: r, cipherText: n }; +} +async function GW(t, { iv: e, cipherText: r }) { + const n = await crypto.subtle.decrypt({ + name: "AES-GCM", + iv: e + }, t, r); + return new TextDecoder().decode(n); +} +function SE(t) { + switch (t) { + case "public": + return "spki"; + case "private": + return "pkcs8"; + } +} +async function AE(t, e) { + const r = SE(t), n = await crypto.subtle.exportKey(r, e); + return N1(new Uint8Array(n)); +} +async function PE(t, e) { + const r = SE(t), n = Vh(e).buffer; + return await crypto.subtle.importKey(r, new Uint8Array(n), { + name: "ECDH", + namedCurve: "P-256" + }, !0, t === "private" ? ["deriveKey"] : []); +} +async function YW(t, e) { + const r = JSON.stringify(t, (n, i) => { + if (!(i instanceof Error)) + return i; + const s = i; + return Object.assign(Object.assign({}, s.code ? { code: s.code } : {}), { message: s.message }); + }); + return VW(e, r); +} +async function JW(t, e) { + return JSON.parse(await GW(e, t)); +} +const sm = { + storageKey: "ownPrivateKey", + keyType: "private" +}, om = { + storageKey: "ownPublicKey", + keyType: "public" +}, am = { + storageKey: "peerPublicKey", + keyType: "public" +}; +class XW { + constructor() { + this.storage = new Os("CBWSDK", "SCWKeyManager"), this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null; + } + async getOwnPublicKey() { + return await this.loadKeysIfNeeded(), this.ownPublicKey; + } + // returns null if the shared secret is not yet derived + async getSharedSecret() { + return await this.loadKeysIfNeeded(), this.sharedSecret; + } + async setPeerPublicKey(e) { + this.sharedSecret = null, this.peerPublicKey = e, await this.storeKey(am, e), await this.loadKeysIfNeeded(); + } + async clear() { + this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null, this.storage.removeItem(om.storageKey), this.storage.removeItem(sm.storageKey), this.storage.removeItem(am.storageKey); + } + async generateKeyPair() { + const e = await WW(); + this.ownPrivateKey = e.privateKey, this.ownPublicKey = e.publicKey, await this.storeKey(sm, e.privateKey), await this.storeKey(om, e.publicKey); + } + async loadKeysIfNeeded() { + if (this.ownPrivateKey === null && (this.ownPrivateKey = await this.loadKey(sm)), this.ownPublicKey === null && (this.ownPublicKey = await this.loadKey(om)), (this.ownPrivateKey === null || this.ownPublicKey === null) && await this.generateKeyPair(), this.peerPublicKey === null && (this.peerPublicKey = await this.loadKey(am)), this.sharedSecret === null) { + if (this.ownPrivateKey === null || this.peerPublicKey === null) + return; + this.sharedSecret = await KW(this.ownPrivateKey, this.peerPublicKey); + } + } + // storage methods + async loadKey(e) { + const r = this.storage.getItem(e.storageKey); + return r ? PE(e.keyType, r) : null; + } + async storeKey(e, r) { + const n = await AE(e.keyType, r); + this.storage.setItem(e.storageKey, n); + } +} +const ul = "4.2.4", ME = "@coinbase/wallet-sdk"; +async function IE(t, e) { + const r = Object.assign(Object.assign({}, t), { jsonrpc: "2.0", id: crypto.randomUUID() }), n = await window.fetch(e, { + method: "POST", + body: JSON.stringify(r), + mode: "cors", + headers: { + "Content-Type": "application/json", + "X-Cbw-Sdk-Version": ul, + "X-Cbw-Sdk-Platform": ME + } + }), { result: i, error: s } = await n.json(); + if (s) + throw s; + return i; +} +function ZW() { + return globalThis.coinbaseWalletExtension; +} +function QW() { + var t, e; + try { + const r = globalThis; + return (t = r.ethereum) !== null && t !== void 0 ? t : (e = r.top) === null || e === void 0 ? void 0 : e.ethereum; + } catch { + return; + } +} +function eK({ metadata: t, preference: e }) { + var r, n; + const { appName: i, appLogoUrl: s, appChainIds: o } = t; + if (e.options !== "smartWalletOnly") { + const f = ZW(); + if (f) + return (r = f.setAppInfo) === null || r === void 0 || r.call(f, i, s, o, e), f; + } + const a = QW(); + if (a?.isCoinbaseBrowser) + return (n = a.setAppInfo) === null || n === void 0 || n.call(a, i, s, o, e), a; +} +function tK(t) { + if (!t || typeof t != "object" || Array.isArray(t)) + throw Ar.rpc.invalidParams({ + message: "Expected a single, non-array, object argument.", + data: t + }); + const { method: e, params: r } = t; + if (typeof e != "string" || e.length === 0) + throw Ar.rpc.invalidParams({ + message: "'args.method' must be a non-empty string.", + data: t + }); + if (r !== void 0 && !Array.isArray(r) && (typeof r != "object" || r === null)) + throw Ar.rpc.invalidParams({ + message: "'args.params' must be an object or array if provided.", + data: t + }); + switch (e) { + case "eth_sign": + case "eth_signTypedData_v2": + case "eth_subscribe": + case "eth_unsubscribe": + throw Ar.provider.unsupportedMethod(); + } +} +const y_ = "accounts", w_ = "activeChain", x_ = "availableChains", __ = "walletCapabilities"; +class rK { + constructor(e) { + var r, n, i; + this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new XW(), this.storage = new Os("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(y_)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(w_) || { + id: (i = (n = e.metadata.appChainIds) === null || n === void 0 ? void 0 : n[0]) !== null && i !== void 0 ? i : 1 + }, this.handshake = this.handshake.bind(this), this.request = this.request.bind(this), this.createRequestMessage = this.createRequestMessage.bind(this), this.decryptResponseMessage = this.decryptResponseMessage.bind(this); + } + async handshake(e) { + var r, n; + const i = await this.createRequestMessage({ + handshake: { + method: e.method, + params: Object.assign({}, this.metadata, (r = e.params) !== null && r !== void 0 ? r : {}) + } + }), s = await this.communicator.postRequestAndWaitForResponse(i); + if ("failure" in s.content) + throw s.content.failure; + const o = await PE("public", s.sender); + await this.keyManager.setPeerPublicKey(o); + const f = (await this.decryptResponseMessage(s)).result; + if ("error" in f) + throw f.error; + const u = f.value; + this.accounts = u, this.storage.storeObject(y_, u), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", u); + } + async request(e) { + var r; + if (this.accounts.length === 0) + throw Ar.provider.unauthorized(); + switch (e.method) { + case "eth_requestAccounts": + return (r = this.callback) === null || r === void 0 || r.call(this, "connect", { chainId: Bo(this.chain.id) }), this.accounts; + case "eth_accounts": + return this.accounts; + case "eth_coinbase": + return this.accounts[0]; + case "net_version": + return this.chain.id; + case "eth_chainId": + return Bo(this.chain.id); + case "wallet_getCapabilities": + return this.storage.loadObject(__); + case "wallet_switchEthereumChain": + return this.handleSwitchChainRequest(e); + case "eth_ecRecover": + case "personal_sign": + case "personal_ecRecover": + case "eth_signTransaction": + case "eth_sendTransaction": + case "eth_signTypedData_v1": + case "eth_signTypedData_v3": + case "eth_signTypedData_v4": + case "eth_signTypedData": + case "wallet_addEthereumChain": + case "wallet_watchAsset": + case "wallet_sendCalls": + case "wallet_showCallsStatus": + case "wallet_grantPermissions": + return this.sendRequestToPopup(e); + default: + if (!this.chain.rpcUrl) + throw Ar.rpc.internal("No RPC URL set for chain"); + return IE(e, this.chain.rpcUrl); + } + } + async sendRequestToPopup(e) { + var r, n; + await ((n = (r = this.communicator).waitForPopupLoaded) === null || n === void 0 ? void 0 : n.call(r)); + const i = await this.sendEncryptedRequest(e), o = (await this.decryptResponseMessage(i)).result; + if ("error" in o) + throw o.error; + return o.value; + } + async cleanup() { + var e, r; + this.storage.clear(), await this.keyManager.clear(), this.accounts = [], this.chain = { + id: (r = (e = this.metadata.appChainIds) === null || e === void 0 ? void 0 : e[0]) !== null && r !== void 0 ? r : 1 + }; + } + /** + * @returns `null` if the request was successful. + * https://eips.ethereum.org/EIPS/eip-3326#wallet_switchethereumchain + */ + async handleSwitchChainRequest(e) { + var r; + const n = e.params; + if (!n || !(!((r = n[0]) === null || r === void 0) && r.chainId)) + throw Ar.rpc.invalidParams(); + const i = sf(n[0].chainId); + if (this.updateChain(i)) + return null; + const o = await this.sendRequestToPopup(e); + return o === null && this.updateChain(i), o; + } + async sendEncryptedRequest(e) { + const r = await this.keyManager.getSharedSecret(); + if (!r) + throw Ar.provider.unauthorized("No valid session found, try requestAccounts before other methods"); + const n = await YW({ + action: e, + chainId: this.chain.id + }, r), i = await this.createRequestMessage({ encrypted: n }); + return this.communicator.postRequestAndWaitForResponse(i); + } + async createRequestMessage(e) { + const r = await AE("public", await this.keyManager.getOwnPublicKey()); + return { + id: crypto.randomUUID(), + sender: r, + content: e, + timestamp: /* @__PURE__ */ new Date() + }; + } + async decryptResponseMessage(e) { + var r, n; + const i = e.content; + if ("failure" in i) + throw i.failure; + const s = await this.keyManager.getSharedSecret(); + if (!s) + throw Ar.provider.unauthorized("Invalid session"); + const o = await JW(i.encrypted, s), a = (r = o.data) === null || r === void 0 ? void 0 : r.chains; + if (a) { + const u = Object.entries(a).map(([h, g]) => ({ + id: Number(h), + rpcUrl: g + })); + this.storage.storeObject(x_, u), this.updateChain(this.chain.id, u); + } + const f = (n = o.data) === null || n === void 0 ? void 0 : n.capabilities; + return f && this.storage.storeObject(__, f), o; + } + updateChain(e, r) { + var n; + const i = r ?? this.storage.loadObject(x_), s = i?.find((o) => o.id === e); + return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(w_, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", Bo(s.id))), !0) : !1; + } +} +var Hr = {}, er = {}, E_; +function nK() { + if (E_) return er; + E_ = 1, Object.defineProperty(er, "__esModule", { value: !0 }), er.toBig = er.shrSL = er.shrSH = er.rotrSL = er.rotrSH = er.rotrBL = er.rotrBH = er.rotr32L = er.rotr32H = er.rotlSL = er.rotlSH = er.rotlBL = er.rotlBH = er.add5L = er.add5H = er.add4L = er.add4H = er.add3L = er.add3H = void 0, er.add = $, er.fromBig = r, er.split = n; + const t = /* @__PURE__ */ BigInt(2 ** 32 - 1), e = /* @__PURE__ */ BigInt(32); + function r(J, ne = !1) { + return ne ? { h: Number(J & t), l: Number(J >> e & t) } : { h: Number(J >> e & t) | 0, l: Number(J & t) | 0 }; + } + function n(J, ne = !1) { + const K = J.length; + let E = new Uint32Array(K), b = new Uint32Array(K); + for (let l = 0; l < K; l++) { + const { h: p, l: m } = r(J[l], ne); + [E[l], b[l]] = [p, m]; + } + return [E, b]; + } + const i = (J, ne) => BigInt(J >>> 0) << e | BigInt(ne >>> 0); + er.toBig = i; + const s = (J, ne, K) => J >>> K; + er.shrSH = s; + const o = (J, ne, K) => J << 32 - K | ne >>> K; + er.shrSL = o; + const a = (J, ne, K) => J >>> K | ne << 32 - K; + er.rotrSH = a; + const f = (J, ne, K) => J << 32 - K | ne >>> K; + er.rotrSL = f; + const u = (J, ne, K) => J << 64 - K | ne >>> K - 32; + er.rotrBH = u; + const h = (J, ne, K) => J >>> K - 32 | ne << 64 - K; + er.rotrBL = h; + const g = (J, ne) => ne; + er.rotr32H = g; + const v = (J, ne) => J; + er.rotr32L = v; + const x = (J, ne, K) => J << K | ne >>> 32 - K; + er.rotlSH = x; + const S = (J, ne, K) => ne << K | J >>> 32 - K; + er.rotlSL = S; + const C = (J, ne, K) => ne << K - 32 | J >>> 64 - K; + er.rotlBH = C; + const D = (J, ne, K) => J << K - 32 | ne >>> 64 - K; + er.rotlBL = D; + function $(J, ne, K, E) { + const b = (ne >>> 0) + (E >>> 0); + return { h: J + K + (b / 2 ** 32 | 0) | 0, l: b | 0 }; + } + const N = (J, ne, K) => (J >>> 0) + (ne >>> 0) + (K >>> 0); + er.add3L = N; + const z = (J, ne, K, E) => ne + K + E + (J / 2 ** 32 | 0) | 0; + er.add3H = z; + const k = (J, ne, K, E) => (J >>> 0) + (ne >>> 0) + (K >>> 0) + (E >>> 0); + er.add4L = k; + const B = (J, ne, K, E, b) => ne + K + E + b + (J / 2 ** 32 | 0) | 0; + er.add4H = B; + const U = (J, ne, K, E, b) => (J >>> 0) + (ne >>> 0) + (K >>> 0) + (E >>> 0) + (b >>> 0); + er.add5L = U; + const R = (J, ne, K, E, b, l) => ne + K + E + b + l + (J / 2 ** 32 | 0) | 0; + er.add5H = R; + const W = { + fromBig: r, + split: n, + toBig: i, + shrSH: s, + shrSL: o, + rotrSH: a, + rotrSL: f, + rotrBH: u, + rotrBL: h, + rotr32H: g, + rotr32L: v, + rotlSH: x, + rotlSL: S, + rotlBH: C, + rotlBL: D, + add: $, + add3L: N, + add3H: z, + add4L: k, + add4H: B, + add5H: R, + add5L: U + }; + return er.default = W, er; +} +var cm = {}, ju = {}, S_; +function iK() { + return S_ || (S_ = 1, Object.defineProperty(ju, "__esModule", { value: !0 }), ju.crypto = void 0, ju.crypto = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0), ju; +} +var A_; +function sK() { + return A_ || (A_ = 1, (function(t) { + /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + Object.defineProperty(t, "__esModule", { value: !0 }), t.wrapXOFConstructorWithOpts = t.wrapConstructorWithOpts = t.wrapConstructor = t.Hash = t.nextTick = t.swap32IfBE = t.byteSwapIfBE = t.swap8IfBE = t.isLE = void 0, t.isBytes = r, t.anumber = n, t.abytes = i, t.ahash = s, t.aexists = o, t.aoutput = a, t.u8 = f, t.u32 = u, t.clean = h, t.createView = g, t.rotr = v, t.rotl = x, t.byteSwap = S, t.byteSwap32 = C, t.bytesToHex = N, t.hexToBytes = B, t.asyncLoop = R, t.utf8ToBytes = W, t.bytesToUtf8 = J, t.toBytes = ne, t.kdfInputToBytes = K, t.concatBytes = E, t.checkOpts = b, t.createHasher = p, t.createOptHasher = m, t.createXOFer = w, t.randomBytes = P; + const e = /* @__PURE__ */ iK(); + function r(_) { + return _ instanceof Uint8Array || ArrayBuffer.isView(_) && _.constructor.name === "Uint8Array"; + } + function n(_) { + if (!Number.isSafeInteger(_) || _ < 0) + throw new Error("positive integer expected, got " + _); + } + function i(_, ...y) { + if (!r(_)) + throw new Error("Uint8Array expected"); + if (y.length > 0 && !y.includes(_.length)) + throw new Error("Uint8Array expected of length " + y + ", got length=" + _.length); + } + function s(_) { + if (typeof _ != "function" || typeof _.create != "function") + throw new Error("Hash should be wrapped by utils.createHasher"); + n(_.outputLen), n(_.blockLen); + } + function o(_, y = !0) { + if (_.destroyed) + throw new Error("Hash instance has been destroyed"); + if (y && _.finished) + throw new Error("Hash#digest() has already been called"); + } + function a(_, y) { + i(_); + const M = y.outputLen; + if (_.length < M) + throw new Error("digestInto() expects output buffer of length at least " + M); + } + function f(_) { + return new Uint8Array(_.buffer, _.byteOffset, _.byteLength); + } + function u(_) { + return new Uint32Array(_.buffer, _.byteOffset, Math.floor(_.byteLength / 4)); + } + function h(..._) { + for (let y = 0; y < _.length; y++) + _[y].fill(0); + } + function g(_) { + return new DataView(_.buffer, _.byteOffset, _.byteLength); + } + function v(_, y) { + return _ << 32 - y | _ >>> y; + } + function x(_, y) { + return _ << y | _ >>> 32 - y >>> 0; + } + t.isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68; + function S(_) { + return _ << 24 & 4278190080 | _ << 8 & 16711680 | _ >>> 8 & 65280 | _ >>> 24 & 255; + } + t.swap8IfBE = t.isLE ? (_) => _ : (_) => S(_), t.byteSwapIfBE = t.swap8IfBE; + function C(_) { + for (let y = 0; y < _.length; y++) + _[y] = S(_[y]); + return _; + } + t.swap32IfBE = t.isLE ? (_) => _ : C; + const D = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", $ = /* @__PURE__ */ Array.from({ length: 256 }, (_, y) => y.toString(16).padStart(2, "0")); + function N(_) { + if (i(_), D) + return _.toHex(); + let y = ""; + for (let M = 0; M < _.length; M++) + y += $[_[M]]; + return y; + } + const z = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 }; + function k(_) { + if (_ >= z._0 && _ <= z._9) + return _ - z._0; + if (_ >= z.A && _ <= z.F) + return _ - (z.A - 10); + if (_ >= z.a && _ <= z.f) + return _ - (z.a - 10); + } + function B(_) { + if (typeof _ != "string") + throw new Error("hex string expected, got " + typeof _); + if (D) + return Uint8Array.fromHex(_); + const y = _.length, M = y / 2; + if (y % 2) + throw new Error("hex string expected, got unpadded hex of length " + y); + const I = new Uint8Array(M); + for (let q = 0, ce = 0; q < M; q++, ce += 2) { + const L = k(_.charCodeAt(ce)), oe = k(_.charCodeAt(ce + 1)); + if (L === void 0 || oe === void 0) { + const Q = _[ce] + _[ce + 1]; + throw new Error('hex string expected, got non-hex character "' + Q + '" at index ' + ce); + } + I[q] = L * 16 + oe; + } + return I; + } + const U = async () => { + }; + t.nextTick = U; + async function R(_, y, M) { + let I = Date.now(); + for (let q = 0; q < _; q++) { + M(q); + const ce = Date.now() - I; + ce >= 0 && ce < y || (await (0, t.nextTick)(), I += ce); + } + } + function W(_) { + if (typeof _ != "string") + throw new Error("string expected"); + return new Uint8Array(new TextEncoder().encode(_)); + } + function J(_) { + return new TextDecoder().decode(_); + } + function ne(_) { + return typeof _ == "string" && (_ = W(_)), i(_), _; + } + function K(_) { + return typeof _ == "string" && (_ = W(_)), i(_), _; + } + function E(..._) { + let y = 0; + for (let I = 0; I < _.length; I++) { + const q = _[I]; + i(q), y += q.length; + } + const M = new Uint8Array(y); + for (let I = 0, q = 0; I < _.length; I++) { + const ce = _[I]; + M.set(ce, q), q += ce.length; + } + return M; + } + function b(_, y) { + if (y !== void 0 && {}.toString.call(y) !== "[object Object]") + throw new Error("options should be object or undefined"); + return Object.assign(_, y); + } + class l { + } + t.Hash = l; + function p(_) { + const y = (I) => _().update(ne(I)).digest(), M = _(); + return y.outputLen = M.outputLen, y.blockLen = M.blockLen, y.create = () => _(), y; + } + function m(_) { + const y = (I, q) => _(q).update(ne(I)).digest(), M = _({}); + return y.outputLen = M.outputLen, y.blockLen = M.blockLen, y.create = (I) => _(I), y; + } + function w(_) { + const y = (I, q) => _(q).update(ne(I)).digest(), M = _({}); + return y.outputLen = M.outputLen, y.blockLen = M.blockLen, y.create = (I) => _(I), y; + } + t.wrapConstructor = p, t.wrapConstructorWithOpts = m, t.wrapXOFConstructorWithOpts = w; + function P(_ = 32) { + if (e.crypto && typeof e.crypto.getRandomValues == "function") + return e.crypto.getRandomValues(new Uint8Array(_)); + if (e.crypto && typeof e.crypto.randomBytes == "function") + return Uint8Array.from(e.crypto.randomBytes(_)); + throw new Error("crypto.getRandomValues must be defined"); + } + })(cm)), cm; +} +var P_; +function oK() { + if (P_) return Hr; + P_ = 1, Object.defineProperty(Hr, "__esModule", { value: !0 }), Hr.shake256 = Hr.shake128 = Hr.keccak_512 = Hr.keccak_384 = Hr.keccak_256 = Hr.keccak_224 = Hr.sha3_512 = Hr.sha3_384 = Hr.sha3_256 = Hr.sha3_224 = Hr.Keccak = void 0, Hr.keccakP = D; + const t = /* @__PURE__ */ nK(), e = /* @__PURE__ */ sK(), r = BigInt(0), n = BigInt(1), i = BigInt(2), s = BigInt(7), o = BigInt(256), a = BigInt(113), f = [], u = [], h = []; + for (let k = 0, B = n, U = 1, R = 0; k < 24; k++) { + [U, R] = [R, (2 * U + 3 * R) % 5], f.push(2 * (5 * R + U)), u.push((k + 1) * (k + 2) / 2 % 64); + let W = r; + for (let J = 0; J < 7; J++) + B = (B << n ^ (B >> s) * a) % o, B & i && (W ^= n << (n << /* @__PURE__ */ BigInt(J)) - n); + h.push(W); + } + const g = (0, t.split)(h, !0), v = g[0], x = g[1], S = (k, B, U) => U > 32 ? (0, t.rotlBH)(k, B, U) : (0, t.rotlSH)(k, B, U), C = (k, B, U) => U > 32 ? (0, t.rotlBL)(k, B, U) : (0, t.rotlSL)(k, B, U); + function D(k, B = 24) { + const U = new Uint32Array(10); + for (let R = 24 - B; R < 24; R++) { + for (let ne = 0; ne < 10; ne++) + U[ne] = k[ne] ^ k[ne + 10] ^ k[ne + 20] ^ k[ne + 30] ^ k[ne + 40]; + for (let ne = 0; ne < 10; ne += 2) { + const K = (ne + 8) % 10, E = (ne + 2) % 10, b = U[E], l = U[E + 1], p = S(b, l, 1) ^ U[K], m = C(b, l, 1) ^ U[K + 1]; + for (let w = 0; w < 50; w += 10) + k[ne + w] ^= p, k[ne + w + 1] ^= m; + } + let W = k[2], J = k[3]; + for (let ne = 0; ne < 24; ne++) { + const K = u[ne], E = S(W, J, K), b = C(W, J, K), l = f[ne]; + W = k[l], J = k[l + 1], k[l] = E, k[l + 1] = b; + } + for (let ne = 0; ne < 50; ne += 10) { + for (let K = 0; K < 10; K++) + U[K] = k[ne + K]; + for (let K = 0; K < 10; K++) + k[ne + K] ^= ~U[(K + 2) % 10] & U[(K + 4) % 10]; + } + k[0] ^= v[R], k[1] ^= x[R]; + } + (0, e.clean)(U); + } + class $ extends e.Hash { + // NOTE: we accept arguments in bytes instead of bits here. + constructor(B, U, R, W = !1, J = 24) { + if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = B, this.suffix = U, this.outputLen = R, this.enableXOF = W, this.rounds = J, (0, e.anumber)(R), !(0 < B && B < 200)) + throw new Error("only keccak-f1600 function is supported"); + this.state = new Uint8Array(200), this.state32 = (0, e.u32)(this.state); + } + clone() { + return this._cloneInto(); + } + keccak() { + (0, e.swap32IfBE)(this.state32), D(this.state32, this.rounds), (0, e.swap32IfBE)(this.state32), this.posOut = 0, this.pos = 0; + } + update(B) { + (0, e.aexists)(this), B = (0, e.toBytes)(B), (0, e.abytes)(B); + const { blockLen: U, state: R } = this, W = B.length; + for (let J = 0; J < W; ) { + const ne = Math.min(U - this.pos, W - J); + for (let K = 0; K < ne; K++) + R[this.pos++] ^= B[J++]; + this.pos === U && this.keccak(); + } + return this; + } + finish() { + if (this.finished) + return; + this.finished = !0; + const { state: B, suffix: U, pos: R, blockLen: W } = this; + B[R] ^= U, (U & 128) !== 0 && R === W - 1 && this.keccak(), B[W - 1] ^= 128, this.keccak(); + } + writeInto(B) { + (0, e.aexists)(this, !1), (0, e.abytes)(B), this.finish(); + const U = this.state, { blockLen: R } = this; + for (let W = 0, J = B.length; W < J; ) { + this.posOut >= R && this.keccak(); + const ne = Math.min(R - this.posOut, J - W); + B.set(U.subarray(this.posOut, this.posOut + ne), W), this.posOut += ne, W += ne; + } + return B; + } + xofInto(B) { + if (!this.enableXOF) + throw new Error("XOF is not possible for this instance"); + return this.writeInto(B); + } + xof(B) { + return (0, e.anumber)(B), this.xofInto(new Uint8Array(B)); + } + digestInto(B) { + if ((0, e.aoutput)(B, this), this.finished) + throw new Error("digest() was already called"); + return this.writeInto(B), this.destroy(), B; + } + digest() { + return this.digestInto(new Uint8Array(this.outputLen)); + } + destroy() { + this.destroyed = !0, (0, e.clean)(this.state); + } + _cloneInto(B) { + const { blockLen: U, suffix: R, outputLen: W, rounds: J, enableXOF: ne } = this; + return B || (B = new $(U, R, W, ne, J)), B.state32.set(this.state32), B.pos = this.pos, B.posOut = this.posOut, B.finished = this.finished, B.rounds = J, B.suffix = R, B.outputLen = W, B.enableXOF = ne, B.destroyed = this.destroyed, B; + } + } + Hr.Keccak = $; + const N = (k, B, U) => (0, e.createHasher)(() => new $(B, k, U)); + Hr.sha3_224 = N(6, 144, 224 / 8), Hr.sha3_256 = N(6, 136, 256 / 8), Hr.sha3_384 = N(6, 104, 384 / 8), Hr.sha3_512 = N(6, 72, 512 / 8), Hr.keccak_224 = N(1, 144, 224 / 8), Hr.keccak_256 = N(1, 136, 256 / 8), Hr.keccak_384 = N(1, 104, 384 / 8), Hr.keccak_512 = N(1, 72, 512 / 8); + const z = (k, B, U) => (0, e.createXOFer)((R = {}) => new $(B, k, R.dkLen === void 0 ? U : R.dkLen, !0)); + return Hr.shake128 = z(31, 168, 128 / 8), Hr.shake256 = z(31, 136, 256 / 8), Hr; +} +var um, M_; +function CE() { + if (M_) return um; + M_ = 1; + const { keccak_256: t } = /* @__PURE__ */ oK(); + function e(x) { + return Buffer.allocUnsafe(x).fill(0); + } + function r(x) { + return x.toString(2).length; + } + function n(x, S) { + let C = x.toString(16); + C.length % 2 !== 0 && (C = "0" + C); + const D = C.match(/.{1,2}/g).map(($) => parseInt($, 16)); + for (; D.length < S; ) + D.unshift(0); + return Buffer.from(D); + } + function i(x, S) { + const C = x < 0n; + let D; + if (C) { + const $ = (1n << BigInt(S)) - 1n; + D = (~x & $) + 1n; + } else + D = x; + return D &= (1n << BigInt(S)) - 1n, D; + } + function s(x, S, C) { + const D = e(S); + return x = a(x), C ? x.length < S ? (x.copy(D), D) : x.slice(0, S) : x.length < S ? (x.copy(D, S - x.length), D) : x.slice(-S); + } + function o(x, S) { + return s(x, S, !0); + } + function a(x) { + if (!Buffer.isBuffer(x)) + if (Array.isArray(x)) + x = Buffer.from(x); + else if (typeof x == "string") + g(x) ? x = Buffer.from(h(v(x)), "hex") : x = Buffer.from(x); + else if (typeof x == "number") + x = intToBuffer(x); + else if (x == null) + x = Buffer.allocUnsafe(0); + else if (typeof x == "bigint") + x = n(x); + else if (x.toArray) + x = Buffer.from(x.toArray()); + else + throw new Error("invalid type"); + return x; + } + function f(x) { + return x = a(x), "0x" + x.toString("hex"); + } + function u(x, S) { + if (x = a(x), S || (S = 256), S !== 256) + throw new Error("unsupported"); + return Buffer.from(t(new Uint8Array(x))); + } + function h(x) { + return x.length % 2 ? "0" + x : x; + } + function g(x) { + return typeof x == "string" && x.match(/^0x[0-9A-Fa-f]*$/); + } + function v(x) { + return typeof x == "string" && x.startsWith("0x") ? x.slice(2) : x; + } + return um = { + zeros: e, + setLength: s, + setLengthRight: o, + isHexString: g, + stripHexPrefix: v, + toBuffer: a, + bufferToHex: f, + keccak: u, + bitLengthFromBigInt: r, + bufferBEFromBigInt: n, + twosFromBigInt: i + }, um; +} +var fm, I_; +function aK() { + if (I_) return fm; + I_ = 1; + const t = /* @__PURE__ */ CE(); + function e(v) { + return v.startsWith("int[") ? "int256" + v.slice(3) : v === "int" ? "int256" : v.startsWith("uint[") ? "uint256" + v.slice(4) : v === "uint" ? "uint256" : v.startsWith("fixed[") ? "fixed128x128" + v.slice(5) : v === "fixed" ? "fixed128x128" : v.startsWith("ufixed[") ? "ufixed128x128" + v.slice(6) : v === "ufixed" ? "ufixed128x128" : v; + } + function r(v) { + return Number.parseInt(/^\D+(\d+)$/.exec(v)[1], 10); + } + function n(v) { + var x = /^\D+(\d+)x(\d+)$/.exec(v); + return [Number.parseInt(x[1], 10), Number.parseInt(x[2], 10)]; + } + function i(v) { + var x = v.match(/(.*)\[(.*?)\]$/); + return x ? x[2] === "" ? "dynamic" : Number.parseInt(x[2], 10) : null; + } + function s(v) { + var x = typeof v; + if (x === "string" || x === "number") + return BigInt(v); + if (x === "bigint") + return v; + throw new Error("Argument is not a number"); + } + function o(v, x) { + var S, C, D, $; + if (v === "address") + return o("uint160", s(x)); + if (v === "bool") + return o("uint8", x ? 1 : 0); + if (v === "string") + return o("bytes", new Buffer(x, "utf8")); + if (f(v)) { + if (typeof x.length > "u") + throw new Error("Not an array?"); + if (S = i(v), S !== "dynamic" && S !== 0 && x.length > S) + throw new Error("Elements exceed array size: " + S); + D = [], v = v.slice(0, v.lastIndexOf("[")), typeof x == "string" && (x = JSON.parse(x)); + for ($ in x) + D.push(o(v, x[$])); + if (S === "dynamic") { + var N = o("uint256", x.length); + D.unshift(N); + } + return Buffer.concat(D); + } else { + if (v === "bytes") + return x = new Buffer(x), D = Buffer.concat([o("uint256", x.length), x]), x.length % 32 !== 0 && (D = Buffer.concat([D, t.zeros(32 - x.length % 32)])), D; + if (v.startsWith("bytes")) { + if (S = r(v), S < 1 || S > 32) + throw new Error("Invalid bytes width: " + S); + return t.setLengthRight(x, 32); + } else if (v.startsWith("uint")) { + if (S = r(v), S % 8 || S < 8 || S > 256) + throw new Error("Invalid uint width: " + S); + C = s(x); + const z = t.bitLengthFromBigInt(C); + if (z > S) + throw new Error("Supplied uint exceeds width: " + S + " vs " + z); + if (C < 0) + throw new Error("Supplied uint is negative"); + return t.bufferBEFromBigInt(C, 32); + } else if (v.startsWith("int")) { + if (S = r(v), S % 8 || S < 8 || S > 256) + throw new Error("Invalid int width: " + S); + C = s(x); + const z = t.bitLengthFromBigInt(C); + if (z > S) + throw new Error("Supplied int exceeds width: " + S + " vs " + z); + const k = t.twosFromBigInt(C, 256); + return t.bufferBEFromBigInt(k, 32); + } else if (v.startsWith("ufixed")) { + if (S = n(v), C = s(x), C < 0) + throw new Error("Supplied ufixed is negative"); + return o("uint256", C * BigInt(2) ** BigInt(S[1])); + } else if (v.startsWith("fixed")) + return S = n(v), o("int256", s(x) * BigInt(2) ** BigInt(S[1])); + } + throw new Error("Unsupported or invalid type: " + v); + } + function a(v) { + return v === "string" || v === "bytes" || i(v) === "dynamic"; + } + function f(v) { + return v.lastIndexOf("]") === v.length - 1; + } + function u(v, x) { + var S = [], C = [], D = 32 * v.length; + for (var $ in v) { + var N = e(v[$]), z = x[$], k = o(N, z); + a(N) ? (S.push(o("uint256", D)), C.push(k), D += k.length) : S.push(k); + } + return Buffer.concat(S.concat(C)); + } + function h(v, x) { + if (v.length !== x.length) + throw new Error("Number of types are not matching the values"); + for (var S, C, D = [], $ = 0; $ < v.length; $++) { + var N = e(v[$]), z = x[$]; + if (N === "bytes") + D.push(z); + else if (N === "string") + D.push(new Buffer(z, "utf8")); + else if (N === "bool") + D.push(new Buffer(z ? "01" : "00", "hex")); + else if (N === "address") + D.push(t.setLength(z, 20)); + else if (N.startsWith("bytes")) { + if (S = r(N), S < 1 || S > 32) + throw new Error("Invalid bytes width: " + S); + D.push(t.setLengthRight(z, S)); + } else if (N.startsWith("uint")) { + if (S = r(N), S % 8 || S < 8 || S > 256) + throw new Error("Invalid uint width: " + S); + C = s(z); + const k = t.bitLengthFromBigInt(C); + if (k > S) + throw new Error("Supplied uint exceeds width: " + S + " vs " + k); + D.push(t.bufferBEFromBigInt(C, S / 8)); + } else if (N.startsWith("int")) { + if (S = r(N), S % 8 || S < 8 || S > 256) + throw new Error("Invalid int width: " + S); + C = s(z); + const k = t.bitLengthFromBigInt(C); + if (k > S) + throw new Error("Supplied int exceeds width: " + S + " vs " + k); + const B = t.twosFromBigInt(C, S); + D.push(t.bufferBEFromBigInt(B, S / 8)); + } else + throw new Error("Unsupported or invalid type: " + N); + } + return Buffer.concat(D); + } + function g(v, x) { + return t.keccak(h(v, x)); + } + return fm = { + rawEncode: u, + solidityPack: h, + soliditySHA3: g + }, fm; +} +var lm, C_; +function cK() { + if (C_) return lm; + C_ = 1; + const t = /* @__PURE__ */ CE(), e = /* @__PURE__ */ aK(), r = { + type: "object", + properties: { + types: { + type: "object", + additionalProperties: { + type: "array", + items: { + type: "object", + properties: { + name: { type: "string" }, + type: { type: "string" } + }, + required: ["name", "type"] + } + } + }, + primaryType: { type: "string" }, + domain: { type: "object" }, + message: { type: "object" } + }, + required: ["types", "primaryType", "domain", "message"] + }, n = { + /** + * Encodes an object by encoding and concatenating each of its members + * + * @param {string} primaryType - Root type + * @param {Object} data - Object to encode + * @param {Object} types - Type definitions + * @returns {string} - Encoded representation of an object + */ + encodeData(s, o, a, f = !0) { + const u = ["bytes32"], h = [this.hashType(s, a)]; + if (f) { + const g = (v, x, S) => { + if (a[x] !== void 0) + return ["bytes32", S == null ? "0x0000000000000000000000000000000000000000000000000000000000000000" : t.keccak(this.encodeData(x, S, a, f))]; + if (S === void 0) + throw new Error(`missing value for field ${v} of type ${x}`); + if (x === "bytes") + return ["bytes32", t.keccak(S)]; + if (x === "string") + return typeof S == "string" && (S = Buffer.from(S, "utf8")), ["bytes32", t.keccak(S)]; + if (x.lastIndexOf("]") === x.length - 1) { + const C = x.slice(0, x.lastIndexOf("[")), D = S.map(($) => g(v, C, $)); + return ["bytes32", t.keccak(e.rawEncode( + D.map(([$]) => $), + D.map(([, $]) => $) + ))]; + } + return [x, S]; + }; + for (const v of a[s]) { + const [x, S] = g(v.name, v.type, o[v.name]); + u.push(x), h.push(S); + } + } else + for (const g of a[s]) { + let v = o[g.name]; + if (v !== void 0) + if (g.type === "bytes") + u.push("bytes32"), v = t.keccak(v), h.push(v); + else if (g.type === "string") + u.push("bytes32"), typeof v == "string" && (v = Buffer.from(v, "utf8")), v = t.keccak(v), h.push(v); + else if (a[g.type] !== void 0) + u.push("bytes32"), v = t.keccak(this.encodeData(g.type, v, a, f)), h.push(v); + else { + if (g.type.lastIndexOf("]") === g.type.length - 1) + throw new Error("Arrays currently unimplemented in encodeData"); + u.push(g.type), h.push(v); + } + } + return e.rawEncode(u, h); + }, + /** + * Encodes the type of an object by encoding a comma delimited list of its members + * + * @param {string} primaryType - Root type to encode + * @param {Object} types - Type definitions + * @returns {string} - Encoded representation of the type of an object + */ + encodeType(s, o) { + let a = "", f = this.findTypeDependencies(s, o).filter((u) => u !== s); + f = [s].concat(f.sort()); + for (const u of f) { + if (!o[u]) + throw new Error("No type definition specified: " + u); + a += u + "(" + o[u].map(({ name: g, type: v }) => v + " " + g).join(",") + ")"; + } + return a; + }, + /** + * Finds all types within a type definition object + * + * @param {string} primaryType - Root type + * @param {Object} types - Type definitions + * @param {Array} results - current set of accumulated types + * @returns {Array} - Set of all types found in the type definition + */ + findTypeDependencies(s, o, a = []) { + if (s = s.match(/^\w*/)[0], a.includes(s) || o[s] === void 0) + return a; + a.push(s); + for (const f of o[s]) + for (const u of this.findTypeDependencies(f.type, o, a)) + !a.includes(u) && a.push(u); + return a; + }, + /** + * Hashes an object + * + * @param {string} primaryType - Root type + * @param {Object} data - Object to hash + * @param {Object} types - Type definitions + * @returns {Buffer} - Hash of an object + */ + hashStruct(s, o, a, f = !0) { + return t.keccak(this.encodeData(s, o, a, f)); + }, + /** + * Hashes the type of an object + * + * @param {string} primaryType - Root type to hash + * @param {Object} types - Type definitions + * @returns {string} - Hash of an object + */ + hashType(s, o) { + return t.keccak(this.encodeType(s, o)); + }, + /** + * Removes properties from a message object that are not defined per EIP-712 + * + * @param {Object} data - typed message object + * @returns {Object} - typed message object with only allowed fields + */ + sanitizeData(s) { + const o = {}; + for (const a in r.properties) + s[a] && (o[a] = s[a]); + return o.types && (o.types = Object.assign({ EIP712Domain: [] }, o.types)), o; + }, + /** + * Returns the hash of a typed message as per EIP-712 for signing + * + * @param {Object} typedData - Types message data to sign + * @returns {string} - sha3 hash for signing + */ + hash(s, o = !0) { + const a = this.sanitizeData(s), f = [Buffer.from("1901", "hex")]; + return f.push(this.hashStruct("EIP712Domain", a.domain, a.types, o)), a.primaryType !== "EIP712Domain" && f.push(this.hashStruct(a.primaryType, a.message, a.types, o)), t.keccak(Buffer.concat(f)); + } + }; + lm = { + TYPED_MESSAGE_SCHEMA: r, + TypedDataUtils: n, + hashForSignTypedDataLegacy: function(s) { + return i(s.data); + }, + hashForSignTypedData_v3: function(s) { + return n.hash(s.data, !1); + }, + hashForSignTypedData_v4: function(s) { + return n.hash(s.data); + } + }; + function i(s) { + const o = new Error("Expect argument to be non-empty array"); + if (typeof s != "object" || !s.length) throw o; + const a = s.map(function(h) { + return h.type === "bytes" ? t.toBuffer(h.value) : h.value; + }), f = s.map(function(h) { + return h.type; + }), u = s.map(function(h) { + if (!h.name) throw o; + return h.type + " " + h.name; + }); + return e.soliditySHA3( + ["bytes32", "bytes32"], + [ + e.soliditySHA3(new Array(s.length).fill("string"), u), + e.soliditySHA3(f, a) + ] + ); + } + return lm; +} +var uK = /* @__PURE__ */ cK(); +const Ph = /* @__PURE__ */ Hi(uK), fK = "walletUsername", pv = "Addresses", lK = "AppVersion"; +function Ln(t) { + return t.errorMessage !== void 0; +} +class hK { + // @param secret hex representation of 32-byte secret + constructor(e) { + this.secret = e; + } + /** + * + * @param plainText string to be encrypted + * returns hex string representation of bytes in the order: initialization vector (iv), + * auth tag, encrypted plaintext. IV is 12 bytes. Auth tag is 16 bytes. Remaining bytes are the + * encrypted plainText. + */ + async encrypt(e) { + const r = this.secret; + if (r.length !== 64) + throw Error("secret must be 256 bits"); + const n = crypto.getRandomValues(new Uint8Array(12)), i = await crypto.subtle.importKey("raw", Vh(r), { name: "aes-gcm" }, !1, ["encrypt", "decrypt"]), s = new TextEncoder(), o = await window.crypto.subtle.encrypt({ + name: "AES-GCM", + iv: n + }, i, s.encode(e)), a = 16, f = o.slice(o.byteLength - a), u = o.slice(0, o.byteLength - a), h = new Uint8Array(f), g = new Uint8Array(u), v = new Uint8Array([...n, ...h, ...g]); + return N1(v); + } + /** + * + * @param cipherText hex string representation of bytes in the order: initialization vector (iv), + * auth tag, encrypted plaintext. IV is 12 bytes. Auth tag is 16 bytes. + */ + async decrypt(e) { + const r = this.secret; + if (r.length !== 64) + throw Error("secret must be 256 bits"); + return new Promise((n, i) => { + (async function() { + const s = await crypto.subtle.importKey("raw", Vh(r), { name: "aes-gcm" }, !1, ["encrypt", "decrypt"]), o = Vh(e), a = o.slice(0, 12), f = o.slice(12, 28), u = o.slice(28), h = new Uint8Array([...u, ...f]), g = { + name: "AES-GCM", + iv: new Uint8Array(a) + }; + try { + const v = await window.crypto.subtle.decrypt(g, s, h), x = new TextDecoder(); + n(x.decode(v)); + } catch (v) { + i(v); + } + })(); + }); + } +} +class dK { + constructor(e, r, n) { + this.linkAPIUrl = e, this.sessionId = r; + const i = `${r}:${n}`; + this.auth = `Basic ${btoa(i)}`; + } + // mark unseen events as seen + async markUnseenEventsAsSeen(e) { + return Promise.all(e.map((r) => fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`, { + method: "POST", + headers: { + Authorization: this.auth + } + }))).catch((r) => console.error("Unabled to mark event as failed:", r)); + } + async fetchUnseenEvents() { + var e; + const r = await fetch(`${this.linkAPIUrl}/events?unseen=true`, { + headers: { + Authorization: this.auth + } + }); + if (r.ok) { + const { events: n, error: i } = await r.json(); + if (i) + throw new Error(`Check unseen events failed: ${i}`); + const s = (e = n?.filter((o) => o.event === "Web3Response").map((o) => ({ + type: "Event", + sessionId: this.sessionId, + eventId: o.id, + event: o.event, + data: o.data + }))) !== null && e !== void 0 ? e : []; + return this.markUnseenEventsAsSeen(s), s; + } + throw new Error(`Check unseen events failed: ${r.status}`); + } +} +var ro; +(function(t) { + t[t.DISCONNECTED = 0] = "DISCONNECTED", t[t.CONNECTING = 1] = "CONNECTING", t[t.CONNECTED = 2] = "CONNECTED"; +})(ro || (ro = {})); +class pK { + setConnectionStateListener(e) { + this.connectionStateListener = e; + } + setIncomingDataListener(e) { + this.incomingDataListener = e; + } + /** + * Constructor + * @param url WebSocket server URL + * @param [WebSocketClass] Custom WebSocket implementation + */ + constructor(e, r = WebSocket) { + this.WebSocketClass = r, this.webSocket = null, this.pendingData = [], this.url = e.replace(/^http/, "ws"); + } + /** + * Make a websocket connection + * @returns a Promise that resolves when connected + */ + async connect() { + if (this.webSocket) + throw new Error("webSocket object is not null"); + return new Promise((e, r) => { + var n; + let i; + try { + this.webSocket = i = new this.WebSocketClass(this.url); + } catch (s) { + r(s); + return; + } + (n = this.connectionStateListener) === null || n === void 0 || n.call(this, ro.CONNECTING), i.onclose = (s) => { + var o; + this.clearWebSocket(), r(new Error(`websocket error ${s.code}: ${s.reason}`)), (o = this.connectionStateListener) === null || o === void 0 || o.call(this, ro.DISCONNECTED); + }, i.onopen = (s) => { + var o; + e(), (o = this.connectionStateListener) === null || o === void 0 || o.call(this, ro.CONNECTED), this.pendingData.length > 0 && ([...this.pendingData].forEach((f) => this.sendData(f)), this.pendingData = []); + }, i.onmessage = (s) => { + var o, a; + if (s.data === "h") + (o = this.incomingDataListener) === null || o === void 0 || o.call(this, { + type: "Heartbeat" + }); + else + try { + const f = JSON.parse(s.data); + (a = this.incomingDataListener) === null || a === void 0 || a.call(this, f); + } catch { + } + }; + }); + } + /** + * Disconnect from server + */ + disconnect() { + var e; + const { webSocket: r } = this; + if (r) { + this.clearWebSocket(), (e = this.connectionStateListener) === null || e === void 0 || e.call(this, ro.DISCONNECTED), this.connectionStateListener = void 0, this.incomingDataListener = void 0; + try { + r.close(); + } catch { + } + } + } + /** + * Send data to server + * @param data text to send + */ + sendData(e) { + const { webSocket: r } = this; + if (!r) { + this.pendingData.push(e), this.connect(); + return; + } + r.send(e); + } + clearWebSocket() { + const { webSocket: e } = this; + e && (this.webSocket = null, e.onclose = null, e.onerror = null, e.onmessage = null, e.onopen = null); + } +} +const R_ = 1e4, gK = 6e4; +class mK { + /** + * Constructor + * @param session Session + * @param linkAPIUrl Coinbase Wallet link server URL + * @param listener WalletLinkConnectionUpdateListener + * @param [WebSocketClass] Custom WebSocket implementation + */ + constructor({ session: e, linkAPIUrl: r, listener: n }) { + this.destroyed = !1, this.lastHeartbeatResponse = 0, this.nextReqId = eo(1), this._connected = !1, this._linked = !1, this.shouldFetchUnseenEventsOnConnect = !1, this.requestResolutions = /* @__PURE__ */ new Map(), this.handleSessionMetadataUpdated = (s) => { + if (!s) + return; + (/* @__PURE__ */ new Map([ + ["__destroyed", this.handleDestroyed], + ["EthereumAddress", this.handleAccountUpdated], + ["WalletUsername", this.handleWalletUsernameUpdated], + ["AppVersion", this.handleAppVersionUpdated], + [ + "ChainId", + // ChainId and JsonRpcUrl are always updated together + (a) => s.JsonRpcUrl && this.handleChainUpdated(a, s.JsonRpcUrl) + ] + ])).forEach((a, f) => { + const u = s[f]; + u !== void 0 && a(u); + }); + }, this.handleDestroyed = (s) => { + var o; + s === "1" && ((o = this.listener) === null || o === void 0 || o.resetAndReload()); + }, this.handleAccountUpdated = async (s) => { + var o; + const a = await this.cipher.decrypt(s); + (o = this.listener) === null || o === void 0 || o.accountUpdated(a); + }, this.handleMetadataUpdated = async (s, o) => { + var a; + const f = await this.cipher.decrypt(o); + (a = this.listener) === null || a === void 0 || a.metadataUpdated(s, f); + }, this.handleWalletUsernameUpdated = async (s) => { + this.handleMetadataUpdated(fK, s); + }, this.handleAppVersionUpdated = async (s) => { + this.handleMetadataUpdated(lK, s); + }, this.handleChainUpdated = async (s, o) => { + var a; + const f = await this.cipher.decrypt(s), u = await this.cipher.decrypt(o); + (a = this.listener) === null || a === void 0 || a.chainUpdated(f, u); + }, this.session = e, this.cipher = new hK(e.secret), this.listener = n; + const i = new pK(`${r}/rpc`, WebSocket); + i.setConnectionStateListener(async (s) => { + let o = !1; + switch (s) { + case ro.DISCONNECTED: + if (!this.destroyed) { + const a = async () => { + await new Promise((f) => setTimeout(f, 5e3)), this.destroyed || i.connect().catch(() => { + a(); + }); + }; + a(); + } + break; + case ro.CONNECTED: + o = await this.handleConnected(), this.updateLastHeartbeat(), setInterval(() => { + this.heartbeat(); + }, R_), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); + break; + case ro.CONNECTING: + break; + } + this.connected !== o && (this.connected = o); + }), i.setIncomingDataListener((s) => { + var o; + switch (s.type) { + // handle server's heartbeat responses + case "Heartbeat": + this.updateLastHeartbeat(); + return; + // handle link status updates + case "IsLinkedOK": + case "Linked": { + const a = s.type === "IsLinkedOK" ? s.linked : void 0; + this.linked = a || s.onlineGuests > 0; + break; + } + // handle session config updates + case "GetSessionConfigOK": + case "SessionConfigUpdated": { + this.handleSessionMetadataUpdated(s.metadata); + break; + } + case "Event": { + this.handleIncomingEvent(s); + break; + } + } + s.id !== void 0 && ((o = this.requestResolutions.get(s.id)) === null || o === void 0 || o(s)); + }), this.ws = i, this.http = new dK(r, e.id, e.key); + } + /** + * Make a connection to the server + */ + connect() { + if (this.destroyed) + throw new Error("instance is destroyed"); + this.ws.connect(); + } + /** + * Terminate connection, and mark as destroyed. To reconnect, create a new + * instance of WalletSDKConnection + */ + async destroy() { + this.destroyed || (await this.makeRequest({ + type: "SetSessionConfig", + id: eo(this.nextReqId++), + sessionId: this.session.id, + metadata: { __destroyed: "1" } + }, { timeout: 1e3 }), this.destroyed = !0, this.ws.disconnect(), this.listener = void 0); + } + get connected() { + return this._connected; + } + set connected(e) { + this._connected = e; + } + get linked() { + return this._linked; + } + set linked(e) { + var r, n; + this._linked = e, e && ((r = this.onceLinked) === null || r === void 0 || r.call(this)), (n = this.listener) === null || n === void 0 || n.linkedUpdated(e); + } + setOnceLinked(e) { + return new Promise((r) => { + this.linked ? e().then(r) : this.onceLinked = () => { + e().then(r), this.onceLinked = void 0; + }; + }); + } + async handleIncomingEvent(e) { + var r; + if (e.type !== "Event" || e.event !== "Web3Response") + return; + const n = await this.cipher.decrypt(e.data), i = JSON.parse(n); + if (i.type !== "WEB3_RESPONSE") + return; + const { id: s, response: o } = i; + (r = this.listener) === null || r === void 0 || r.handleWeb3ResponseMessage(s, o); + } + async checkUnseenEvents() { + if (!this.connected) { + this.shouldFetchUnseenEventsOnConnect = !0; + return; + } + await new Promise((e) => setTimeout(e, 250)); + try { + await this.fetchUnseenEventsAPI(); + } catch (e) { + console.error("Unable to check for unseen events", e); + } + } + async fetchUnseenEventsAPI() { + this.shouldFetchUnseenEventsOnConnect = !1, (await this.http.fetchUnseenEvents()).forEach((r) => this.handleIncomingEvent(r)); + } + /** + * Publish an event and emit event ID when successful + * @param event event name + * @param unencryptedData unencrypted event data + * @param callWebhook whether the webhook should be invoked + * @returns a Promise that emits event ID when successful + */ + async publishEvent(e, r, n = !1) { + const i = await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({}, r), { origin: location.origin, location: location.href, relaySource: "coinbaseWalletExtension" in window && window.coinbaseWalletExtension ? "injected_sdk" : "sdk" }))), s = { + type: "PublishEvent", + id: eo(this.nextReqId++), + sessionId: this.session.id, + event: e, + data: i, + callWebhook: n + }; + return this.setOnceLinked(async () => { + const o = await this.makeRequest(s); + if (o.type === "Fail") + throw new Error(o.error || "failed to publish event"); + return o.eventId; + }); + } + sendData(e) { + this.ws.sendData(JSON.stringify(e)); + } + updateLastHeartbeat() { + this.lastHeartbeatResponse = Date.now(); + } + heartbeat() { + if (Date.now() - this.lastHeartbeatResponse > R_ * 2) { + this.ws.disconnect(); + return; + } + try { + this.ws.sendData("h"); + } catch { + } + } + async makeRequest(e, r = { timeout: gK }) { + const n = e.id; + this.sendData(e); + let i; + return Promise.race([ + new Promise((s, o) => { + i = window.setTimeout(() => { + o(new Error(`request ${n} timed out`)); + }, r.timeout); + }), + new Promise((s) => { + this.requestResolutions.set(n, (o) => { + clearTimeout(i), s(o), this.requestResolutions.delete(n); + }); + }) + ]); + } + async handleConnected() { + return (await this.makeRequest({ + type: "HostSession", + id: eo(this.nextReqId++), + sessionId: this.session.id, + sessionKey: this.session.key + })).type === "Fail" ? !1 : (this.sendData({ + type: "IsLinked", + id: eo(this.nextReqId++), + sessionId: this.session.id + }), this.sendData({ + type: "GetSessionConfig", + id: eo(this.nextReqId++), + sessionId: this.session.id + }), !0); + } +} +class vK { + constructor() { + this._nextRequestId = 0, this.callbacks = /* @__PURE__ */ new Map(); + } + makeRequestId() { + this._nextRequestId = (this._nextRequestId + 1) % 2147483647; + const e = this._nextRequestId, r = EE(e.toString(16)); + return this.callbacks.get(r) && this.callbacks.delete(r), e; + } +} +const T_ = "session:id", D_ = "session:secret", O_ = "session:linked"; +class kc { + constructor(e, r, n, i = !1) { + this.storage = e, this.id = r, this.secret = n, this.key = QT(O4(`${r}, ${n} WalletLink`)), this._linked = !!i; + } + static create(e) { + const r = Ea(16), n = Ea(32); + return new kc(e, r, n).save(); + } + static load(e) { + const r = e.getItem(T_), n = e.getItem(O_), i = e.getItem(D_); + return r && i ? new kc(e, r, i, n === "1") : null; + } + get linked() { + return this._linked; + } + set linked(e) { + this._linked = e, this.persistLinked(); + } + save() { + return this.storage.setItem(T_, this.id), this.storage.setItem(D_, this.secret), this.persistLinked(), this; + } + persistLinked() { + this.storage.setItem(O_, this._linked ? "1" : "0"); + } +} +function bK() { + try { + return window.frameElement !== null; + } catch { + return !1; + } +} +function yK() { + try { + return bK() && window.top ? window.top.location : window.location; + } catch { + return window.location; + } +} +function wK() { + var t; + return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t = window?.navigator) === null || t === void 0 ? void 0 : t.userAgent); +} +function RE() { + var t, e; + return (e = (t = window?.matchMedia) === null || t === void 0 ? void 0 : t.call(window, "(prefers-color-scheme: dark)").matches) !== null && e !== void 0 ? e : !1; +} +const xK = '@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}'; +function TE() { + const t = document.createElement("style"); + t.type = "text/css", t.appendChild(document.createTextNode(xK)), document.documentElement.appendChild(t); +} +function DE(t) { + var e, r, n = ""; + if (typeof t == "string" || typeof t == "number") n += t; + else if (typeof t == "object") if (Array.isArray(t)) for (e = 0; e < t.length; e++) t[e] && (r = DE(t[e])) && (n && (n += " "), n += r); + else for (e in t) t[e] && (n && (n += " "), n += e); + return n; +} +function of() { + for (var t, e, r = 0, n = ""; r < arguments.length; ) (t = arguments[r++]) && (e = DE(t)) && (n && (n += " "), n += e); + return n; +} +var c0, Jr, OE, Sa, N_, NE, gv, LE, $1, mv, vv, Bf = {}, kE = [], _K = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, B1 = Array.isArray; +function Fo(t, e) { + for (var r in e) t[r] = e[r]; + return t; +} +function F1(t) { + t && t.parentNode && t.parentNode.removeChild(t); +} +function Lr(t, e, r) { + var n, i, s, o = {}; + for (s in e) s == "key" ? n = e[s] : s == "ref" ? i = e[s] : o[s] = e[s]; + if (arguments.length > 2 && (o.children = arguments.length > 3 ? c0.call(arguments, 2) : r), typeof t == "function" && t.defaultProps != null) for (s in t.defaultProps) o[s] === void 0 && (o[s] = t.defaultProps[s]); + return Gh(t, o, n, i, null); +} +function Gh(t, e, r, n, i) { + var s = { type: t, props: e, key: r, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++OE, __i: -1, __u: 0 }; + return i == null && Jr.vnode != null && Jr.vnode(s), s; +} +function fl(t) { + return t.children; +} +function Yh(t, e) { + this.props = t, this.context = e; +} +function qc(t, e) { + if (e == null) return t.__ ? qc(t.__, t.__i + 1) : null; + for (var r; e < t.__k.length; e++) if ((r = t.__k[e]) != null && r.__e != null) return r.__e; + return typeof t.type == "function" ? qc(t) : null; +} +function $E(t) { + var e, r; + if ((t = t.__) != null && t.__c != null) { + for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) if ((r = t.__k[e]) != null && r.__e != null) { + t.__e = t.__c.base = r.__e; + break; + } + return $E(t); + } +} +function L_(t) { + (!t.__d && (t.__d = !0) && Sa.push(t) && !Sd.__r++ || N_ !== Jr.debounceRendering) && ((N_ = Jr.debounceRendering) || NE)(Sd); +} +function Sd() { + var t, e, r, n, i, s, o, a; + for (Sa.sort(gv); t = Sa.shift(); ) t.__d && (e = Sa.length, n = void 0, s = (i = (r = t).__v).__e, o = [], a = [], r.__P && ((n = Fo({}, i)).__v = i.__v + 1, Jr.vnode && Jr.vnode(n), j1(r.__P, n, i, r.__n, r.__P.namespaceURI, 32 & i.__u ? [s] : null, o, s ?? qc(i), !!(32 & i.__u), a), n.__v = i.__v, n.__.__k[n.__i] = n, jE(o, n, a), n.__e != s && $E(n)), Sa.length > e && Sa.sort(gv)); + Sd.__r = 0; +} +function BE(t, e, r, n, i, s, o, a, f, u, h) { + var g, v, x, S, C, D, $ = n && n.__k || kE, N = e.length; + for (f = EK(r, e, $, f), g = 0; g < N; g++) (x = r.__k[g]) != null && (v = x.__i === -1 ? Bf : $[x.__i] || Bf, x.__i = g, D = j1(t, x, v, i, s, o, a, f, u, h), S = x.__e, x.ref && v.ref != x.ref && (v.ref && U1(v.ref, null, x), h.push(x.ref, x.__c || S, x)), C == null && S != null && (C = S), 4 & x.__u || v.__k === x.__k ? f = FE(x, f, t) : typeof x.type == "function" && D !== void 0 ? f = D : S && (f = S.nextSibling), x.__u &= -7); + return r.__e = C, f; +} +function EK(t, e, r, n) { + var i, s, o, a, f, u = e.length, h = r.length, g = h, v = 0; + for (t.__k = [], i = 0; i < u; i++) (s = e[i]) != null && typeof s != "boolean" && typeof s != "function" ? (a = i + v, (s = t.__k[i] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Gh(null, s, null, null, null) : B1(s) ? Gh(fl, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? Gh(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, o = null, (f = s.__i = SK(s, r, a, g)) !== -1 && (g--, (o = r[f]) && (o.__u |= 2)), o == null || o.__v === null ? (f == -1 && v--, typeof s.type != "function" && (s.__u |= 4)) : f !== a && (f == a - 1 ? v-- : f == a + 1 ? v++ : (f > a ? v-- : v++, s.__u |= 4))) : s = t.__k[i] = null; + if (g) for (i = 0; i < h; i++) (o = r[i]) != null && (2 & o.__u) == 0 && (o.__e == n && (n = qc(o)), UE(o, o)); + return n; +} +function FE(t, e, r) { + var n, i; + if (typeof t.type == "function") { + for (n = t.__k, i = 0; n && i < n.length; i++) n[i] && (n[i].__ = t, e = FE(n[i], e, r)); + return e; + } + t.__e != e && (e && t.type && !r.contains(e) && (e = qc(t)), r.insertBefore(t.__e, e || null), e = t.__e); + do + e = e && e.nextSibling; + while (e != null && e.nodeType === 8); + return e; +} +function SK(t, e, r, n) { + var i = t.key, s = t.type, o = r - 1, a = r + 1, f = e[r]; + if (f === null || f && i == f.key && s === f.type && (2 & f.__u) == 0) return r; + if ((typeof s != "function" || s === fl || i) && n > (f != null && (2 & f.__u) == 0 ? 1 : 0)) for (; o >= 0 || a < e.length; ) { + if (o >= 0) { + if ((f = e[o]) && (2 & f.__u) == 0 && i == f.key && s === f.type) return o; + o--; + } + if (a < e.length) { + if ((f = e[a]) && (2 & f.__u) == 0 && i == f.key && s === f.type) return a; + a++; + } + } + return -1; +} +function k_(t, e, r) { + e[0] === "-" ? t.setProperty(e, r ?? "") : t[e] = r == null ? "" : typeof r != "number" || _K.test(e) ? r : r + "px"; +} +function Mh(t, e, r, n, i) { + var s; + e: if (e === "style") if (typeof r == "string") t.style.cssText = r; + else { + if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || k_(t.style, e, ""); + if (r) for (e in r) n && r[e] === n[e] || k_(t.style, e, r[e]); + } + else if (e[0] === "o" && e[1] === "n") s = e !== (e = e.replace(LE, "$1")), e = e.toLowerCase() in t || e === "onFocusOut" || e === "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = $1, t.addEventListener(e, s ? vv : mv, s)) : t.removeEventListener(e, s ? vv : mv, s); + else { + if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); + else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try { + t[e] = r ?? ""; + break e; + } catch { + } + typeof r == "function" || (r == null || r === !1 && e[4] !== "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && r == 1 ? "" : r)); + } +} +function $_(t) { + return function(e) { + if (this.l) { + var r = this.l[e.type + t]; + if (e.t == null) e.t = $1++; + else if (e.t < r.u) return; + return r(Jr.event ? Jr.event(e) : e); + } + }; +} +function j1(t, e, r, n, i, s, o, a, f, u) { + var h, g, v, x, S, C, D, $, N, z, k, B, U, R, W, J, ne, K = e.type; + if (e.constructor !== void 0) return null; + 128 & r.__u && (f = !!(32 & r.__u), s = [a = e.__e = r.__e]), (h = Jr.__b) && h(e); + e: if (typeof K == "function") try { + if ($ = e.props, N = "prototype" in K && K.prototype.render, z = (h = K.contextType) && n[h.__c], k = h ? z ? z.props.value : h.__ : n, r.__c ? D = (g = e.__c = r.__c).__ = g.__E : (N ? e.__c = g = new K($, k) : (e.__c = g = new Yh($, k), g.constructor = K, g.render = PK), z && z.sub(g), g.props = $, g.state || (g.state = {}), g.context = k, g.__n = n, v = g.__d = !0, g.__h = [], g._sb = []), N && g.__s == null && (g.__s = g.state), N && K.getDerivedStateFromProps != null && (g.__s == g.state && (g.__s = Fo({}, g.__s)), Fo(g.__s, K.getDerivedStateFromProps($, g.__s))), x = g.props, S = g.state, g.__v = e, v) N && K.getDerivedStateFromProps == null && g.componentWillMount != null && g.componentWillMount(), N && g.componentDidMount != null && g.__h.push(g.componentDidMount); + else { + if (N && K.getDerivedStateFromProps == null && $ !== x && g.componentWillReceiveProps != null && g.componentWillReceiveProps($, k), !g.__e && (g.shouldComponentUpdate != null && g.shouldComponentUpdate($, g.__s, k) === !1 || e.__v === r.__v)) { + for (e.__v !== r.__v && (g.props = $, g.state = g.__s, g.__d = !1), e.__e = r.__e, e.__k = r.__k, e.__k.some(function(E) { + E && (E.__ = e); + }), B = 0; B < g._sb.length; B++) g.__h.push(g._sb[B]); + g._sb = [], g.__h.length && o.push(g); + break e; + } + g.componentWillUpdate != null && g.componentWillUpdate($, g.__s, k), N && g.componentDidUpdate != null && g.__h.push(function() { + g.componentDidUpdate(x, S, C); + }); + } + if (g.context = k, g.props = $, g.__P = t, g.__e = !1, U = Jr.__r, R = 0, N) { + for (g.state = g.__s, g.__d = !1, U && U(e), h = g.render(g.props, g.state, g.context), W = 0; W < g._sb.length; W++) g.__h.push(g._sb[W]); + g._sb = []; + } else do + g.__d = !1, U && U(e), h = g.render(g.props, g.state, g.context), g.state = g.__s; + while (g.__d && ++R < 25); + g.state = g.__s, g.getChildContext != null && (n = Fo(Fo({}, n), g.getChildContext())), N && !v && g.getSnapshotBeforeUpdate != null && (C = g.getSnapshotBeforeUpdate(x, S)), a = BE(t, B1(J = h != null && h.type === fl && h.key == null ? h.props.children : h) ? J : [J], e, r, n, i, s, o, a, f, u), g.base = e.__e, e.__u &= -161, g.__h.length && o.push(g), D && (g.__E = g.__ = null); + } catch (E) { + if (e.__v = null, f || s != null) if (E.then) { + for (e.__u |= f ? 160 : 128; a && a.nodeType === 8 && a.nextSibling; ) a = a.nextSibling; + s[s.indexOf(a)] = null, e.__e = a; + } else for (ne = s.length; ne--; ) F1(s[ne]); + else e.__e = r.__e, e.__k = r.__k; + Jr.__e(E, e, r); + } + else s == null && e.__v === r.__v ? (e.__k = r.__k, e.__e = r.__e) : a = e.__e = AK(r.__e, e, r, n, i, s, o, f, u); + return (h = Jr.diffed) && h(e), 128 & e.__u ? void 0 : a; +} +function jE(t, e, r) { + for (var n = 0; n < r.length; n++) U1(r[n], r[++n], r[++n]); + Jr.__c && Jr.__c(e, t), t.some(function(i) { + try { + t = i.__h, i.__h = [], t.some(function(s) { + s.call(i); + }); + } catch (s) { + Jr.__e(s, i.__v); + } + }); +} +function AK(t, e, r, n, i, s, o, a, f) { + var u, h, g, v, x, S, C, D = r.props, $ = e.props, N = e.type; + if (N === "svg" ? i = "http://www.w3.org/2000/svg" : N === "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) { + for (u = 0; u < s.length; u++) if ((x = s[u]) && "setAttribute" in x == !!N && (N ? x.localName === N : x.nodeType === 3)) { + t = x, s[u] = null; + break; + } + } + if (t == null) { + if (N === null) return document.createTextNode($); + t = document.createElementNS(i, N, $.is && $), a && (Jr.__m && Jr.__m(e, s), a = !1), s = null; + } + if (N === null) D === $ || a && t.data === $ || (t.data = $); + else { + if (s = s && c0.call(t.childNodes), D = r.props || Bf, !a && s != null) for (D = {}, u = 0; u < t.attributes.length; u++) D[(x = t.attributes[u]).name] = x.value; + for (u in D) if (x = D[u], u != "children") { + if (u == "dangerouslySetInnerHTML") g = x; + else if (!(u in $)) { + if (u == "value" && "defaultValue" in $ || u == "checked" && "defaultChecked" in $) continue; + Mh(t, u, null, x, i); + } + } + for (u in $) x = $[u], u == "children" ? v = x : u == "dangerouslySetInnerHTML" ? h = x : u == "value" ? S = x : u == "checked" ? C = x : a && typeof x != "function" || D[u] === x || Mh(t, u, x, D[u], i); + if (h) a || g && (h.__html === g.__html || h.__html === t.innerHTML) || (t.innerHTML = h.__html), e.__k = []; + else if (g && (t.innerHTML = ""), BE(t, B1(v) ? v : [v], e, r, n, N === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && qc(r, 0), a, f), s != null) for (u = s.length; u--; ) F1(s[u]); + a || (u = "value", N === "progress" && S == null ? t.removeAttribute("value") : S !== void 0 && (S !== t[u] || N === "progress" && !S || N === "option" && S !== D[u]) && Mh(t, u, S, D[u], i), u = "checked", C !== void 0 && C !== t[u] && Mh(t, u, C, D[u], i)); + } + return t; +} +function U1(t, e, r) { + try { + if (typeof t == "function") { + var n = typeof t.__u == "function"; + n && t.__u(), n && e == null || (t.__u = t(e)); + } else t.current = e; + } catch (i) { + Jr.__e(i, r); + } +} +function UE(t, e, r) { + var n, i; + if (Jr.unmount && Jr.unmount(t), (n = t.ref) && (n.current && n.current !== t.__e || U1(n, null, e)), (n = t.__c) != null) { + if (n.componentWillUnmount) try { + n.componentWillUnmount(); + } catch (s) { + Jr.__e(s, e); + } + n.base = n.__P = null; + } + if (n = t.__k) for (i = 0; i < n.length; i++) n[i] && UE(n[i], e, r || typeof t.type != "function"); + r || F1(t.__e), t.__c = t.__ = t.__e = void 0; +} +function PK(t, e, r) { + return this.constructor(t, r); +} +function bv(t, e, r) { + var n, i, s, o; + e === document && (e = document.documentElement), Jr.__ && Jr.__(t, e), i = (n = !1) ? null : e.__k, s = [], o = [], j1(e, t = e.__k = Lr(fl, null, [t]), i || Bf, Bf, e.namespaceURI, i ? null : e.firstChild ? c0.call(e.childNodes) : null, s, i ? i.__e : e.firstChild, n, o), jE(s, t, o); +} +c0 = kE.slice, Jr = { __e: function(t, e, r, n) { + for (var i, s, o; e = e.__; ) if ((i = e.__c) && !i.__) try { + if ((s = i.constructor) && s.getDerivedStateFromError != null && (i.setState(s.getDerivedStateFromError(t)), o = i.__d), i.componentDidCatch != null && (i.componentDidCatch(t, n || {}), o = i.__d), o) return i.__E = i; + } catch (a) { + t = a; + } + throw t; +} }, OE = 0, Yh.prototype.setState = function(t, e) { + var r; + r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = Fo({}, this.state), typeof t == "function" && (t = t(Fo({}, r), this.props)), t && Fo(r, t), t != null && this.__v && (e && this._sb.push(e), L_(this)); +}, Yh.prototype.forceUpdate = function(t) { + this.__v && (this.__e = !0, t && this.__h.push(t), L_(this)); +}, Yh.prototype.render = fl, Sa = [], NE = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, gv = function(t, e) { + return t.__v.__b - e.__v.__b; +}, Sd.__r = 0, LE = /(PointerCapture)$|Capture$/i, $1 = 0, mv = $_(!1), vv = $_(!0); +var Ad, dn, hm, B_, yv = 0, qE = [], vn = Jr, F_ = vn.__b, j_ = vn.__r, U_ = vn.diffed, q_ = vn.__c, z_ = vn.unmount, H_ = vn.__; +function zE(t, e) { + vn.__h && vn.__h(dn, t, yv || e), yv = 0; + var r = dn.__H || (dn.__H = { __: [], __h: [] }); + return t >= r.__.length && r.__.push({}), r.__[t]; +} +function W_(t) { + return yv = 1, MK(HE, t); +} +function MK(t, e, r) { + var n = zE(Ad++, 2); + if (n.t = t, !n.__c && (n.__ = [HE(void 0, e), function(a) { + var f = n.__N ? n.__N[0] : n.__[0], u = n.t(f, a); + f !== u && (n.__N = [u, n.__[1]], n.__c.setState({})); + }], n.__c = dn, !dn.u)) { + var i = function(a, f, u) { + if (!n.__c.__H) return !0; + var h = n.__c.__H.__.filter(function(v) { + return !!v.__c; + }); + if (h.every(function(v) { + return !v.__N; + })) return !s || s.call(this, a, f, u); + var g = n.__c.props !== a; + return h.forEach(function(v) { + if (v.__N) { + var x = v.__[0]; + v.__ = v.__N, v.__N = void 0, x !== v.__[0] && (g = !0); + } + }), s && s.call(this, a, f, u) || g; + }; + dn.u = !0; + var s = dn.shouldComponentUpdate, o = dn.componentWillUpdate; + dn.componentWillUpdate = function(a, f, u) { + if (this.__e) { + var h = s; + s = void 0, i(a, f, u), s = h; + } + o && o.call(this, a, f, u); + }, dn.shouldComponentUpdate = i; + } + return n.__N || n.__; +} +function IK(t, e) { + var r = zE(Ad++, 3); + !vn.__s && TK(r.__H, e) && (r.__ = t, r.i = e, dn.__H.__h.push(r)); +} +function CK() { + for (var t; t = qE.shift(); ) if (t.__P && t.__H) try { + t.__H.__h.forEach(Jh), t.__H.__h.forEach(wv), t.__H.__h = []; + } catch (e) { + t.__H.__h = [], vn.__e(e, t.__v); + } +} +vn.__b = function(t) { + dn = null, F_ && F_(t); +}, vn.__ = function(t, e) { + t && e.__k && e.__k.__m && (t.__m = e.__k.__m), H_ && H_(t, e); +}, vn.__r = function(t) { + j_ && j_(t), Ad = 0; + var e = (dn = t.__c).__H; + e && (hm === dn ? (e.__h = [], dn.__h = [], e.__.forEach(function(r) { + r.__N && (r.__ = r.__N), r.i = r.__N = void 0; + })) : (e.__h.forEach(Jh), e.__h.forEach(wv), e.__h = [], Ad = 0)), hm = dn; +}, vn.diffed = function(t) { + U_ && U_(t); + var e = t.__c; + e && e.__H && (e.__H.__h.length && (qE.push(e) !== 1 && B_ === vn.requestAnimationFrame || ((B_ = vn.requestAnimationFrame) || RK)(CK)), e.__H.__.forEach(function(r) { + r.i && (r.__H = r.i), r.i = void 0; + })), hm = dn = null; +}, vn.__c = function(t, e) { + e.some(function(r) { + try { + r.__h.forEach(Jh), r.__h = r.__h.filter(function(n) { + return !n.__ || wv(n); + }); + } catch (n) { + e.some(function(i) { + i.__h && (i.__h = []); + }), e = [], vn.__e(n, r.__v); + } + }), q_ && q_(t, e); +}, vn.unmount = function(t) { + z_ && z_(t); + var e, r = t.__c; + r && r.__H && (r.__H.__.forEach(function(n) { + try { + Jh(n); + } catch (i) { + e = i; + } + }), r.__H = void 0, e && vn.__e(e, r.__v)); +}; +var K_ = typeof requestAnimationFrame == "function"; +function RK(t) { + var e, r = function() { + clearTimeout(n), K_ && cancelAnimationFrame(e), setTimeout(t); + }, n = setTimeout(r, 100); + K_ && (e = requestAnimationFrame(r)); +} +function Jh(t) { + var e = dn, r = t.__c; + typeof r == "function" && (t.__c = void 0, r()), dn = e; +} +function wv(t) { + var e = dn; + t.__c = t.__(), dn = e; +} +function TK(t, e) { + return !t || t.length !== e.length || e.some(function(r, n) { + return r !== t[n]; + }); +} +function HE(t, e) { + return typeof e == "function" ? e(t) : e; +} +const DK = ".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}", OK = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+", NK = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4="; +class LK { + constructor() { + this.items = /* @__PURE__ */ new Map(), this.nextItemKey = 0, this.root = null, this.darkMode = RE(); + } + attach(e) { + this.root = document.createElement("div"), this.root.className = "-cbwsdk-snackbar-root", e.appendChild(this.root), this.render(); + } + presentItem(e) { + const r = this.nextItemKey++; + return this.items.set(r, e), this.render(), () => { + this.items.delete(r), this.render(); + }; + } + clear() { + this.items.clear(), this.render(); + } + render() { + this.root && bv(Lr( + "div", + null, + Lr(WE, { darkMode: this.darkMode }, Array.from(this.items.entries()).map(([e, r]) => Lr(kK, Object.assign({}, r, { key: e })))) + ), this.root); + } +} +const WE = (t) => Lr( + "div", + { class: of("-cbwsdk-snackbar-container") }, + Lr("style", null, DK), + Lr("div", { class: "-cbwsdk-snackbar" }, t.children) +), kK = ({ autoExpand: t, message: e, menuItems: r }) => { + const [n, i] = W_(!0), [s, o] = W_(t ?? !1); + IK(() => { + const f = [ + window.setTimeout(() => { + i(!1); + }, 1), + window.setTimeout(() => { + o(!0); + }, 1e4) + ]; + return () => { + f.forEach(window.clearTimeout); + }; + }); + const a = () => { + o(!s); + }; + return Lr( + "div", + { class: of("-cbwsdk-snackbar-instance", n && "-cbwsdk-snackbar-instance-hidden", s && "-cbwsdk-snackbar-instance-expanded") }, + Lr( + "div", + { class: "-cbwsdk-snackbar-instance-header", onClick: a }, + Lr("img", { src: OK, class: "-cbwsdk-snackbar-instance-header-cblogo" }), + " ", + Lr("div", { class: "-cbwsdk-snackbar-instance-header-message" }, e), + Lr( + "div", + { class: "-gear-container" }, + !s && Lr( + "svg", + { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, + Lr("circle", { cx: "12", cy: "12", r: "12", fill: "#F5F7F8" }) + ), + Lr("img", { src: NK, class: "-gear-icon", title: "Expand" }) + ) + ), + r && r.length > 0 && Lr("div", { class: "-cbwsdk-snackbar-instance-menu" }, r.map((f, u) => Lr( + "div", + { class: of("-cbwsdk-snackbar-instance-menu-item", f.isRed && "-cbwsdk-snackbar-instance-menu-item-is-red"), onClick: f.onClick, key: u }, + Lr( + "svg", + { width: f.svgWidth, height: f.svgHeight, viewBox: "0 0 10 11", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, + Lr("path", { "fill-rule": f.defaultFillRule, "clip-rule": f.defaultClipRule, d: f.path, fill: "#AAAAAA" }) + ), + Lr("span", { class: of("-cbwsdk-snackbar-instance-menu-item-info", f.isRed && "-cbwsdk-snackbar-instance-menu-item-info-is-red") }, f.info) + ))) + ); +}; +class $K { + constructor() { + this.attached = !1, this.snackbar = new LK(); + } + attach() { + if (this.attached) + throw new Error("Coinbase Wallet SDK UI is already attached"); + const e = document.documentElement, r = document.createElement("div"); + r.className = "-cbwsdk-css-reset", e.appendChild(r), this.snackbar.attach(r), this.attached = !0, TE(); + } + showConnecting(e) { + let r; + return e.isUnlinkedErrorState ? r = { + autoExpand: !0, + message: "Connection lost", + menuItems: [ + { + isRed: !1, + info: "Reset connection", + svgWidth: "10", + svgHeight: "11", + path: "M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z", + defaultFillRule: "evenodd", + defaultClipRule: "evenodd", + onClick: e.onResetConnection + } + ] + } : r = { + message: "Confirm on phone", + menuItems: [ + { + isRed: !0, + info: "Cancel transaction", + svgWidth: "11", + svgHeight: "11", + path: "M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z", + defaultFillRule: "inherit", + defaultClipRule: "inherit", + onClick: e.onCancel + }, + { + isRed: !1, + info: "Reset connection", + svgWidth: "10", + svgHeight: "11", + path: "M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z", + defaultFillRule: "evenodd", + defaultClipRule: "evenodd", + onClick: e.onResetConnection + } + ] + }, this.snackbar.presentItem(r); + } +} +const BK = ".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}"; +class FK { + constructor() { + this.root = null, this.darkMode = RE(); + } + attach() { + const e = document.documentElement; + this.root = document.createElement("div"), this.root.className = "-cbwsdk-css-reset", e.appendChild(this.root), TE(); + } + present(e) { + this.render(e); + } + clear() { + this.render(null); + } + render(e) { + this.root && (bv(null, this.root), e && bv(Lr(jK, Object.assign({}, e, { onDismiss: () => { + this.clear(); + }, darkMode: this.darkMode })), this.root)); + } +} +const jK = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: i }) => { + const s = r ? "dark" : "light"; + return Lr( + WE, + { darkMode: r }, + Lr( + "div", + { class: "-cbwsdk-redirect-dialog" }, + Lr("style", null, BK), + Lr("div", { class: "-cbwsdk-redirect-dialog-backdrop", onClick: i }), + Lr( + "div", + { class: of("-cbwsdk-redirect-dialog-box", s) }, + Lr("p", null, t), + Lr("button", { onClick: n }, e) + ) + ) + ); +}, UK = "https://keys.coinbase.com/connect", V_ = "https://www.walletlink.org", qK = "https://go.cb-w.com/walletlink"; +class G_ { + constructor() { + this.attached = !1, this.redirectDialog = new FK(); + } + attach() { + if (this.attached) + throw new Error("Coinbase Wallet SDK UI is already attached"); + this.redirectDialog.attach(), this.attached = !0; + } + redirectToCoinbaseWallet(e) { + const r = new URL(qK); + r.searchParams.append("redirect_url", yK().href), e && r.searchParams.append("wl_url", e); + const n = document.createElement("a"); + n.target = "cbw-opener", n.href = r.href, n.rel = "noreferrer noopener", n.click(); + } + openCoinbaseWalletDeeplink(e) { + this.redirectDialog.present({ + title: "Redirecting to Coinbase Wallet...", + buttonText: "Open", + onButtonClick: () => { + this.redirectToCoinbaseWallet(e); + } + }), setTimeout(() => { + this.redirectToCoinbaseWallet(e); + }, 99); + } + showConnecting(e) { + return () => { + this.redirectDialog.clear(); + }; + } +} +class to { + constructor(e) { + this.chainCallbackParams = { chainId: "", jsonRpcUrl: "" }, this.isMobileWeb = wK(), this.linkedUpdated = (s) => { + this.isLinked = s; + const o = this.storage.getItem(pv); + if (s && (this._session.linked = s), this.isUnlinkedErrorState = !1, o) { + const a = o.split(" "), f = this.storage.getItem("IsStandaloneSigning") === "true"; + a[0] !== "" && !s && this._session.linked && !f && (this.isUnlinkedErrorState = !0); + } + }, this.metadataUpdated = (s, o) => { + this.storage.setItem(s, o); + }, this.chainUpdated = (s, o) => { + this.chainCallbackParams.chainId === s && this.chainCallbackParams.jsonRpcUrl === o || (this.chainCallbackParams = { + chainId: s, + jsonRpcUrl: o + }, this.chainCallback && this.chainCallback(o, Number.parseInt(s, 10))); + }, this.accountUpdated = (s) => { + this.accountsCallback && this.accountsCallback([s]), to.accountRequestCallbackIds.size > 0 && (Array.from(to.accountRequestCallbackIds.values()).forEach((o) => { + this.invokeCallback(o, { + method: "requestEthereumAccounts", + result: [s] + }); + }), to.accountRequestCallbackIds.clear()); + }, this.resetAndReload = this.resetAndReload.bind(this), this.linkAPIUrl = e.linkAPIUrl, this.storage = e.storage, this.metadata = e.metadata, this.accountsCallback = e.accountsCallback, this.chainCallback = e.chainCallback; + const { session: r, ui: n, connection: i } = this.subscribe(); + this._session = r, this.connection = i, this.relayEventManager = new vK(), this.ui = n, this.ui.attach(); + } + subscribe() { + const e = kc.load(this.storage) || kc.create(this.storage), { linkAPIUrl: r } = this, n = new mK({ + session: e, + linkAPIUrl: r, + listener: this + }), i = this.isMobileWeb ? new G_() : new $K(); + return n.connect(), { session: e, ui: i, connection: n }; + } + resetAndReload() { + this.connection.destroy().then(() => { + const e = kc.load(this.storage); + e?.id === this._session.id && Os.clearAll(), document.location.reload(); + }).catch((e) => { + }); + } + signEthereumTransaction(e) { + return this.sendRequest({ + method: "signEthereumTransaction", + params: { + fromAddress: e.fromAddress, + toAddress: e.toAddress, + weiValue: Es(e.weiValue), + data: nf(e.data, !0), + nonce: e.nonce, + gasPriceInWei: e.gasPriceInWei ? Es(e.gasPriceInWei) : null, + maxFeePerGas: e.gasPriceInWei ? Es(e.gasPriceInWei) : null, + maxPriorityFeePerGas: e.gasPriceInWei ? Es(e.gasPriceInWei) : null, + gasLimit: e.gasLimit ? Es(e.gasLimit) : null, + chainId: e.chainId, + shouldSubmit: !1 + } + }); + } + signAndSubmitEthereumTransaction(e) { + return this.sendRequest({ + method: "signEthereumTransaction", + params: { + fromAddress: e.fromAddress, + toAddress: e.toAddress, + weiValue: Es(e.weiValue), + data: nf(e.data, !0), + nonce: e.nonce, + gasPriceInWei: e.gasPriceInWei ? Es(e.gasPriceInWei) : null, + maxFeePerGas: e.maxFeePerGas ? Es(e.maxFeePerGas) : null, + maxPriorityFeePerGas: e.maxPriorityFeePerGas ? Es(e.maxPriorityFeePerGas) : null, + gasLimit: e.gasLimit ? Es(e.gasLimit) : null, + chainId: e.chainId, + shouldSubmit: !0 + } + }); + } + submitEthereumTransaction(e, r) { + return this.sendRequest({ + method: "submitEthereumTransaction", + params: { + signedTransaction: nf(e, !0), + chainId: r + } + }); + } + getWalletLinkSession() { + return this._session; + } + sendRequest(e) { + let r = null; + const n = Ea(8), i = (s) => { + this.publishWeb3RequestCanceledEvent(n), this.handleErrorResponse(n, e.method, s), r?.(); + }; + return new Promise((s, o) => { + r = this.ui.showConnecting({ + isUnlinkedErrorState: this.isUnlinkedErrorState, + onCancel: i, + onResetConnection: this.resetAndReload + // eslint-disable-line @typescript-eslint/unbound-method + }), this.relayEventManager.callbacks.set(n, (a) => { + if (r?.(), Ln(a)) + return o(new Error(a.errorMessage)); + s(a); + }), this.publishWeb3RequestEvent(n, e); + }); + } + publishWeb3RequestEvent(e, r) { + const n = { type: "WEB3_REQUEST", id: e, request: r }; + this.publishEvent("Web3Request", n, !0).then((i) => { + }).catch((i) => { + this.handleWeb3ResponseMessage(n.id, { + method: r.method, + errorMessage: i.message + }); + }), this.isMobileWeb && this.openCoinbaseWalletDeeplink(r.method); + } + // copied from MobileRelay + openCoinbaseWalletDeeplink(e) { + if (this.ui instanceof G_) + switch (e) { + case "requestEthereumAccounts": + // requestEthereumAccounts is handled via popup + case "switchEthereumChain": + return; + default: + window.addEventListener("blur", () => { + window.addEventListener("focus", () => { + this.connection.checkUnseenEvents(); + }, { once: !0 }); + }, { once: !0 }), this.ui.openCoinbaseWalletDeeplink(); + break; + } + } + publishWeb3RequestCanceledEvent(e) { + const r = { + type: "WEB3_REQUEST_CANCELED", + id: e + }; + this.publishEvent("Web3RequestCanceled", r, !1).then(); + } + publishEvent(e, r, n) { + return this.connection.publishEvent(e, r, n); + } + handleWeb3ResponseMessage(e, r) { + if (r.method === "requestEthereumAccounts") { + to.accountRequestCallbackIds.forEach((n) => this.invokeCallback(n, r)), to.accountRequestCallbackIds.clear(); + return; + } + this.invokeCallback(e, r); + } + handleErrorResponse(e, r, n) { + var i; + const s = (i = n?.message) !== null && i !== void 0 ? i : "Unspecified error message."; + this.handleWeb3ResponseMessage(e, { + method: r, + errorMessage: s + }); + } + invokeCallback(e, r) { + const n = this.relayEventManager.callbacks.get(e); + n && (n(r), this.relayEventManager.callbacks.delete(e)); + } + requestEthereumAccounts() { + const { appName: e, appLogoUrl: r } = this.metadata, n = { + method: "requestEthereumAccounts", + params: { + appName: e, + appLogoUrl: r + } + }, i = Ea(8); + return new Promise((s, o) => { + this.relayEventManager.callbacks.set(i, (a) => { + if (Ln(a)) + return o(new Error(a.errorMessage)); + s(a); + }), to.accountRequestCallbackIds.add(i), this.publishWeb3RequestEvent(i, n); + }); + } + watchAsset(e, r, n, i, s, o) { + const a = { + method: "watchAsset", + params: { + type: e, + options: { + address: r, + symbol: n, + decimals: i, + image: s + }, + chainId: o + } + }; + let f = null; + const u = Ea(8), h = (g) => { + this.publishWeb3RequestCanceledEvent(u), this.handleErrorResponse(u, a.method, g), f?.(); + }; + return f = this.ui.showConnecting({ + isUnlinkedErrorState: this.isUnlinkedErrorState, + onCancel: h, + onResetConnection: this.resetAndReload + // eslint-disable-line @typescript-eslint/unbound-method + }), new Promise((g, v) => { + this.relayEventManager.callbacks.set(u, (x) => { + if (f?.(), Ln(x)) + return v(new Error(x.errorMessage)); + g(x); + }), this.publishWeb3RequestEvent(u, a); + }); + } + addEthereumChain(e, r, n, i, s, o) { + const a = { + method: "addEthereumChain", + params: { + chainId: e, + rpcUrls: r, + blockExplorerUrls: i, + chainName: s, + iconUrls: n, + nativeCurrency: o + } + }; + let f = null; + const u = Ea(8), h = (g) => { + this.publishWeb3RequestCanceledEvent(u), this.handleErrorResponse(u, a.method, g), f?.(); + }; + return f = this.ui.showConnecting({ + isUnlinkedErrorState: this.isUnlinkedErrorState, + onCancel: h, + onResetConnection: this.resetAndReload + // eslint-disable-line @typescript-eslint/unbound-method + }), new Promise((g, v) => { + this.relayEventManager.callbacks.set(u, (x) => { + if (f?.(), Ln(x)) + return v(new Error(x.errorMessage)); + g(x); + }), this.publishWeb3RequestEvent(u, a); + }); + } + switchEthereumChain(e, r) { + const n = { + method: "switchEthereumChain", + params: Object.assign({ chainId: e }, { address: r }) + }; + let i = null; + const s = Ea(8), o = (a) => { + this.publishWeb3RequestCanceledEvent(s), this.handleErrorResponse(s, n.method, a), i?.(); + }; + return i = this.ui.showConnecting({ + isUnlinkedErrorState: this.isUnlinkedErrorState, + onCancel: o, + onResetConnection: this.resetAndReload + // eslint-disable-line @typescript-eslint/unbound-method + }), new Promise((a, f) => { + this.relayEventManager.callbacks.set(s, (u) => { + if (i?.(), Ln(u) && u.errorCode) + return f(Ar.provider.custom({ + code: u.errorCode, + message: "Unrecognized chain ID. Try adding the chain using addEthereumChain first." + })); + if (Ln(u)) + return f(new Error(u.errorMessage)); + a(u); + }), this.publishWeb3RequestEvent(s, n); + }); + } +} +to.accountRequestCallbackIds = /* @__PURE__ */ new Set(); +const Y_ = "DefaultChainId", J_ = "DefaultJsonRpcUrl"; +class KE { + constructor(e) { + this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new Os("walletlink", V_), this.callback = e.callback || null; + const r = this._storage.getItem(pv); + if (r) { + const n = r.split(" "); + n[0] !== "" && (this._addresses = n.map((i) => Mo(i))); + } + this.initializeRelay(); + } + getSession() { + const e = this.initializeRelay(), { id: r, secret: n } = e.getWalletLinkSession(); + return { id: r, secret: n }; + } + async handshake() { + await this._eth_requestAccounts(); + } + get selectedAddress() { + return this._addresses[0] || void 0; + } + get jsonRpcUrl() { + var e; + return (e = this._storage.getItem(J_)) !== null && e !== void 0 ? e : void 0; + } + set jsonRpcUrl(e) { + this._storage.setItem(J_, e); + } + updateProviderInfo(e, r) { + var n; + this.jsonRpcUrl = e; + const i = this.getChainId(); + this._storage.setItem(Y_, r.toString(10)), sf(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", Bo(r))); + } + async watchAsset(e) { + const r = Array.isArray(e) ? e[0] : e; + if (!r.type) + throw Ar.rpc.invalidParams("Type is required"); + if (r?.type !== "ERC20") + throw Ar.rpc.invalidParams(`Asset of type '${r.type}' is not supported`); + if (!r?.options) + throw Ar.rpc.invalidParams("Options are required"); + if (!r?.options.address) + throw Ar.rpc.invalidParams("Address is required"); + const n = this.getChainId(), { address: i, symbol: s, image: o, decimals: a } = r.options, u = await this.initializeRelay().watchAsset(r.type, i, s, a, o, n?.toString()); + return Ln(u) ? !1 : !!u.result; + } + async addEthereumChain(e) { + var r, n; + const i = e[0]; + if (((r = i.rpcUrls) === null || r === void 0 ? void 0 : r.length) === 0) + throw Ar.rpc.invalidParams("please pass in at least 1 rpcUrl"); + if (!i.chainName || i.chainName.trim() === "") + throw Ar.rpc.invalidParams("chainName is a required field"); + if (!i.nativeCurrency) + throw Ar.rpc.invalidParams("nativeCurrency is a required field"); + const s = Number.parseInt(i.chainId, 16); + if (s === this.getChainId()) + return !1; + const o = this.initializeRelay(), { rpcUrls: a = [], blockExplorerUrls: f = [], chainName: u, iconUrls: h = [], nativeCurrency: g } = i, v = await o.addEthereumChain(s.toString(), a, h, f, u, g); + if (Ln(v)) + return !1; + if (((n = v.result) === null || n === void 0 ? void 0 : n.isApproved) === !0) + return this.updateProviderInfo(a[0], s), null; + throw Ar.rpc.internal("unable to add ethereum chain"); + } + async switchEthereumChain(e) { + const r = e[0], n = Number.parseInt(r.chainId, 16), s = await this.initializeRelay().switchEthereumChain(n.toString(10), this.selectedAddress || void 0); + if (Ln(s)) + throw s; + const o = s.result; + return o.isApproved && o.rpcUrl.length > 0 && this.updateProviderInfo(o.rpcUrl, n), null; + } + async cleanup() { + this.callback = null, this._relay && this._relay.resetAndReload(), this._storage.clear(); + } + _setAddresses(e, r) { + var n; + if (!Array.isArray(e)) + throw new Error("addresses is not an array"); + const i = e.map((s) => Mo(s)); + JSON.stringify(i) !== JSON.stringify(this._addresses) && (this._addresses = i, (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", i), this._storage.setItem(pv, i.join(" "))); + } + async request(e) { + const r = e.params || []; + switch (e.method) { + case "eth_accounts": + return [...this._addresses]; + case "eth_coinbase": + return this.selectedAddress || null; + case "net_version": + return this.getChainId().toString(10); + case "eth_chainId": + return Bo(this.getChainId()); + case "eth_requestAccounts": + return this._eth_requestAccounts(); + case "eth_ecRecover": + case "personal_ecRecover": + return this.ecRecover(e); + case "personal_sign": + return this.personalSign(e); + case "eth_signTransaction": + return this._eth_signTransaction(r); + case "eth_sendRawTransaction": + return this._eth_sendRawTransaction(r); + case "eth_sendTransaction": + return this._eth_sendTransaction(r); + case "eth_signTypedData_v1": + case "eth_signTypedData_v3": + case "eth_signTypedData_v4": + case "eth_signTypedData": + return this.signTypedData(e); + case "wallet_addEthereumChain": + return this.addEthereumChain(r); + case "wallet_switchEthereumChain": + return this.switchEthereumChain(r); + case "wallet_watchAsset": + return this.watchAsset(r); + default: + if (!this.jsonRpcUrl) + throw Ar.rpc.internal("No RPC URL set for chain"); + return IE(e, this.jsonRpcUrl); + } + } + _ensureKnownAddress(e) { + const r = Mo(e); + if (!this._addresses.map((i) => Mo(i)).includes(r)) + throw new Error("Unknown Ethereum address"); + } + _prepareTransactionParams(e) { + const r = e.from ? Mo(e.from) : this.selectedAddress; + if (!r) + throw new Error("Ethereum address is unavailable"); + this._ensureKnownAddress(r); + const n = e.to ? Mo(e.to) : null, i = e.value != null ? Fu(e.value) : BigInt(0), s = e.data ? dv(e.data) : Buffer.alloc(0), o = e.nonce != null ? sf(e.nonce) : null, a = e.gasPrice != null ? Fu(e.gasPrice) : null, f = e.maxFeePerGas != null ? Fu(e.maxFeePerGas) : null, u = e.maxPriorityFeePerGas != null ? Fu(e.maxPriorityFeePerGas) : null, h = e.gas != null ? Fu(e.gas) : null, g = e.chainId ? sf(e.chainId) : this.getChainId(); + return { + fromAddress: r, + toAddress: n, + weiValue: i, + data: s, + nonce: o, + gasPriceInWei: a, + maxFeePerGas: f, + maxPriorityFeePerGas: u, + gasLimit: h, + chainId: g + }; + } + async ecRecover(e) { + const { method: r, params: n } = e; + if (!Array.isArray(n)) + throw Ar.rpc.invalidParams(); + const s = await this.initializeRelay().sendRequest({ + method: "ethereumAddressFromSignedMessage", + params: { + message: im(n[0]), + signature: im(n[1]), + addPrefix: r === "personal_ecRecover" + } + }); + if (Ln(s)) + throw s; + return s.result; + } + getChainId() { + var e; + return Number.parseInt((e = this._storage.getItem(Y_)) !== null && e !== void 0 ? e : "1", 10); + } + async _eth_requestAccounts() { + var e, r; + if (this._addresses.length > 0) + return (e = this.callback) === null || e === void 0 || e.call(this, "connect", { chainId: Bo(this.getChainId()) }), this._addresses; + const i = await this.initializeRelay().requestEthereumAccounts(); + if (Ln(i)) + throw i; + if (!i.result) + throw new Error("accounts received is empty"); + return this._setAddresses(i.result), (r = this.callback) === null || r === void 0 || r.call(this, "connect", { chainId: Bo(this.getChainId()) }), this._addresses; + } + async personalSign({ params: e }) { + if (!Array.isArray(e)) + throw Ar.rpc.invalidParams(); + const r = e[1], n = e[0]; + this._ensureKnownAddress(r); + const s = await this.initializeRelay().sendRequest({ + method: "signEthereumMessage", + params: { + address: Mo(r), + message: im(n), + addPrefix: !0, + typedDataJson: null + } + }); + if (Ln(s)) + throw s; + return s.result; + } + async _eth_signTransaction(e) { + const r = this._prepareTransactionParams(e[0] || {}), i = await this.initializeRelay().signEthereumTransaction(r); + if (Ln(i)) + throw i; + return i.result; + } + async _eth_sendRawTransaction(e) { + const r = dv(e[0]), i = await this.initializeRelay().submitEthereumTransaction(r, this.getChainId()); + if (Ln(i)) + throw i; + return i.result; + } + async _eth_sendTransaction(e) { + const r = this._prepareTransactionParams(e[0] || {}), i = await this.initializeRelay().signAndSubmitEthereumTransaction(r); + if (Ln(i)) + throw i; + return i.result; + } + async signTypedData(e) { + const { method: r, params: n } = e; + if (!Array.isArray(n)) + throw Ar.rpc.invalidParams(); + const i = (u) => { + const h = { + eth_signTypedData_v1: Ph.hashForSignTypedDataLegacy, + eth_signTypedData_v3: Ph.hashForSignTypedData_v3, + eth_signTypedData_v4: Ph.hashForSignTypedData_v4, + eth_signTypedData: Ph.hashForSignTypedData_v4 + }; + return nf(h[r]({ + data: zW(u) + }), !0); + }, s = n[r === "eth_signTypedData_v1" ? 1 : 0], o = n[r === "eth_signTypedData_v1" ? 0 : 1]; + this._ensureKnownAddress(s); + const f = await this.initializeRelay().sendRequest({ + method: "signEthereumMessage", + params: { + address: Mo(s), + message: i(o), + typedDataJson: JSON.stringify(o, null, 2), + addPrefix: !1 + } + }); + if (Ln(f)) + throw f; + return f.result; + } + initializeRelay() { + return this._relay || (this._relay = new to({ + linkAPIUrl: V_, + storage: this._storage, + metadata: this.metadata, + accountsCallback: this._setAddresses.bind(this), + chainCallback: this.updateProviderInfo.bind(this) + })), this._relay; + } +} +const VE = "SignerType", GE = new Os("CBWSDK", "SignerConfigurator"); +function zK() { + return GE.getItem(VE); +} +function HK(t) { + GE.setItem(VE, t); +} +async function WK(t) { + const { communicator: e, metadata: r, handshakeRequest: n, callback: i } = t; + VK(e, r, i).catch(() => { + }); + const s = { + id: crypto.randomUUID(), + event: "selectSignerType", + data: Object.assign(Object.assign({}, t.preference), { handshakeRequest: n }) + }, { data: o } = await e.postRequestAndWaitForResponse(s); + return o; +} +function KK(t) { + const { signerType: e, metadata: r, communicator: n, callback: i } = t; + switch (e) { + case "scw": + return new rK({ + metadata: r, + callback: i, + communicator: n + }); + case "walletlink": + return new KE({ + metadata: r, + callback: i + }); + } +} +async function VK(t, e, r) { + await t.onMessage(({ event: i }) => i === "WalletLinkSessionRequest"); + const n = new KE({ + metadata: e, + callback: r + }); + t.postMessage({ + event: "WalletLinkUpdate", + data: { session: n.getSession() } + }), await n.handshake(), t.postMessage({ + event: "WalletLinkUpdate", + data: { connected: !0 } + }); +} +const GK = `Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. + +Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`, YK = () => { + let t; + return { + getCrossOriginOpenerPolicy: () => t === void 0 ? "undefined" : t, + checkCrossOriginOpenerPolicy: async () => { + if (typeof window > "u") { + t = "non-browser-env"; + return; + } + try { + const e = `${window.location.origin}${window.location.pathname}`, r = await fetch(e, { + method: "HEAD" + }); + if (!r.ok) + throw new Error(`HTTP error! status: ${r.status}`); + const n = r.headers.get("Cross-Origin-Opener-Policy"); + t = n ?? "null", t === "same-origin" && console.error(GK); + } catch (e) { + console.error("Error checking Cross-Origin-Opener-Policy:", e.message), t = "error"; + } + } + }; +}, { checkCrossOriginOpenerPolicy: JK, getCrossOriginOpenerPolicy: XK } = YK(), X_ = 420, Z_ = 540; +function ZK(t) { + const e = (window.innerWidth - X_) / 2 + window.screenX, r = (window.innerHeight - Z_) / 2 + window.screenY; + eV(t); + const n = window.open(t, "Smart Wallet", `width=${X_}, height=${Z_}, left=${e}, top=${r}`); + if (n?.focus(), !n) + throw Ar.rpc.internal("Pop up window failed to open"); + return n; +} +function QK(t) { + t && !t.closed && t.close(); +} +function eV(t) { + const e = { + sdkName: ME, + sdkVersion: ul, + origin: window.location.origin, + coop: XK() + }; + for (const [r, n] of Object.entries(e)) + t.searchParams.append(r, n.toString()); +} +class tV { + constructor({ url: e = UK, metadata: r, preference: n }) { + this.popup = null, this.listeners = /* @__PURE__ */ new Map(), this.postMessage = async (i) => { + (await this.waitForPopupLoaded()).postMessage(i, this.url.origin); + }, this.postRequestAndWaitForResponse = async (i) => { + const s = this.onMessage(({ requestId: o }) => o === i.id); + return this.postMessage(i), await s; + }, this.onMessage = async (i) => new Promise((s, o) => { + const a = (f) => { + if (f.origin !== this.url.origin) + return; + const u = f.data; + i(u) && (s(u), window.removeEventListener("message", a), this.listeners.delete(a)); + }; + window.addEventListener("message", a), this.listeners.set(a, { reject: o }); + }), this.disconnect = () => { + QK(this.popup), this.popup = null, this.listeners.forEach(({ reject: i }, s) => { + i(Ar.provider.userRejectedRequest("Request rejected")), window.removeEventListener("message", s); + }), this.listeners.clear(); + }, this.waitForPopupLoaded = async () => this.popup && !this.popup.closed ? (this.popup.focus(), this.popup) : (this.popup = ZK(this.url), this.onMessage(({ event: i }) => i === "PopupUnload").then(this.disconnect).catch(() => { + }), this.onMessage(({ event: i }) => i === "PopupLoaded").then((i) => { + this.postMessage({ + requestId: i.id, + data: { + version: ul, + metadata: this.metadata, + preference: this.preference, + location: window.location.toString() + } + }); + }).then(() => { + if (!this.popup) + throw Ar.rpc.internal(); + return this.popup; + })), this.url = new URL(e), this.metadata = r, this.preference = n; + } +} +function rV(t) { + const e = BW(nV(t), { + shouldIncludeStack: !0 + }), r = new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors"); + return r.searchParams.set("version", ul), r.searchParams.set("code", e.code.toString()), r.searchParams.set("message", e.message), Object.assign(Object.assign({}, e), { docUrl: r.href }); +} +function nV(t) { + var e; + if (typeof t == "string") + return { + message: t, + code: un.rpc.internal + }; + if (Ln(t)) { + const r = t.errorMessage, n = (e = t.errorCode) !== null && e !== void 0 ? e : r.match(/(denied|rejected)/i) ? un.provider.userRejectedRequest : void 0; + return Object.assign(Object.assign({}, t), { + message: r, + code: n, + data: { method: t.method } + }); + } + return t; +} +var dm = { exports: {} }, Q_; +function iV() { + return Q_ || (Q_ = 1, (function(t) { + var e = Object.prototype.hasOwnProperty, r = "~"; + function n() { + } + Object.create && (n.prototype = /* @__PURE__ */ Object.create(null), new n().__proto__ || (r = !1)); + function i(f, u, h) { + this.fn = f, this.context = u, this.once = h || !1; + } + function s(f, u, h, g, v) { + if (typeof h != "function") + throw new TypeError("The listener must be a function"); + var x = new i(h, g || f, v), S = r ? r + u : u; + return f._events[S] ? f._events[S].fn ? f._events[S] = [f._events[S], x] : f._events[S].push(x) : (f._events[S] = x, f._eventsCount++), f; + } + function o(f, u) { + --f._eventsCount === 0 ? f._events = new n() : delete f._events[u]; + } + function a() { + this._events = new n(), this._eventsCount = 0; + } + a.prototype.eventNames = function() { + var u = [], h, g; + if (this._eventsCount === 0) return u; + for (g in h = this._events) + e.call(h, g) && u.push(r ? g.slice(1) : g); + return Object.getOwnPropertySymbols ? u.concat(Object.getOwnPropertySymbols(h)) : u; + }, a.prototype.listeners = function(u) { + var h = r ? r + u : u, g = this._events[h]; + if (!g) return []; + if (g.fn) return [g.fn]; + for (var v = 0, x = g.length, S = new Array(x); v < x; v++) + S[v] = g[v].fn; + return S; + }, a.prototype.listenerCount = function(u) { + var h = r ? r + u : u, g = this._events[h]; + return g ? g.fn ? 1 : g.length : 0; + }, a.prototype.emit = function(u, h, g, v, x, S) { + var C = r ? r + u : u; + if (!this._events[C]) return !1; + var D = this._events[C], $ = arguments.length, N, z; + if (D.fn) { + switch (D.once && this.removeListener(u, D.fn, void 0, !0), $) { + case 1: + return D.fn.call(D.context), !0; + case 2: + return D.fn.call(D.context, h), !0; + case 3: + return D.fn.call(D.context, h, g), !0; + case 4: + return D.fn.call(D.context, h, g, v), !0; + case 5: + return D.fn.call(D.context, h, g, v, x), !0; + case 6: + return D.fn.call(D.context, h, g, v, x, S), !0; + } + for (z = 1, N = new Array($ - 1); z < $; z++) + N[z - 1] = arguments[z]; + D.fn.apply(D.context, N); + } else { + var k = D.length, B; + for (z = 0; z < k; z++) + switch (D[z].once && this.removeListener(u, D[z].fn, void 0, !0), $) { + case 1: + D[z].fn.call(D[z].context); + break; + case 2: + D[z].fn.call(D[z].context, h); + break; + case 3: + D[z].fn.call(D[z].context, h, g); + break; + case 4: + D[z].fn.call(D[z].context, h, g, v); + break; + default: + if (!N) for (B = 1, N = new Array($ - 1); B < $; B++) + N[B - 1] = arguments[B]; + D[z].fn.apply(D[z].context, N); + } + } + return !0; + }, a.prototype.on = function(u, h, g) { + return s(this, u, h, g, !1); + }, a.prototype.once = function(u, h, g) { + return s(this, u, h, g, !0); + }, a.prototype.removeListener = function(u, h, g, v) { + var x = r ? r + u : u; + if (!this._events[x]) return this; + if (!h) + return o(this, x), this; + var S = this._events[x]; + if (S.fn) + S.fn === h && (!v || S.once) && (!g || S.context === g) && o(this, x); + else { + for (var C = 0, D = [], $ = S.length; C < $; C++) + (S[C].fn !== h || v && !S[C].once || g && S[C].context !== g) && D.push(S[C]); + D.length ? this._events[x] = D.length === 1 ? D[0] : D : o(this, x); + } + return this; + }, a.prototype.removeAllListeners = function(u) { + var h; + return u ? (h = r ? r + u : u, this._events[h] && o(this, h)) : (this._events = new n(), this._eventsCount = 0), this; + }, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = r, a.EventEmitter = a, t.exports = a; + })(dm)), dm.exports; +} +var sV = iV(); +const oV = /* @__PURE__ */ Hi(sV); +class aV extends oV { +} +var cV = function(t, e) { + var r = {}; + for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); + if (t != null && typeof Object.getOwnPropertySymbols == "function") + for (var i = 0, n = Object.getOwnPropertySymbols(t); i < n.length; i++) + e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]); + return r; +}; +class uV extends aV { + constructor(e) { + var { metadata: r } = e, n = e.preference, { keysUrl: i } = n, s = cV(n, ["keysUrl"]); + super(), this.signer = null, this.isCoinbaseWallet = !0, this.metadata = r, this.preference = s, this.communicator = new tV({ + url: i, + metadata: r, + preference: s + }); + const o = zK(); + o && (this.signer = this.initSigner(o)); + } + async request(e) { + try { + if (tK(e), !this.signer) + switch (e.method) { + case "eth_requestAccounts": { + const r = await this.requestSignerSelection(e), n = this.initSigner(r); + await n.handshake(e), this.signer = n, HK(r); + break; + } + case "net_version": + return 1; + // default value + case "eth_chainId": + return Bo(1); + // default value + default: + throw Ar.provider.unauthorized("Must call 'eth_requestAccounts' before other methods"); + } + return this.signer.request(e); + } catch (r) { + const { code: n } = r; + return n === un.provider.unauthorized && this.disconnect(), Promise.reject(rV(r)); + } + } + /** @deprecated Use `.request({ method: 'eth_requestAccounts' })` instead. */ + async enable() { + return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'), await this.request({ + method: "eth_requestAccounts" + }); + } + async disconnect() { + var e; + await ((e = this.signer) === null || e === void 0 ? void 0 : e.cleanup()), this.signer = null, Os.clearAll(), this.emit("disconnect", Ar.provider.disconnected("User initiated disconnection")); + } + requestSignerSelection(e) { + return WK({ + communicator: this.communicator, + preference: this.preference, + metadata: this.metadata, + handshakeRequest: e, + callback: this.emit.bind(this) + }); + } + initSigner(e) { + return KK({ + signerType: e, + metadata: this.metadata, + communicator: this.communicator, + callback: this.emit.bind(this) + }); + } +} +function fV(t) { + if (t) { + if (!["all", "smartWalletOnly", "eoaOnly"].includes(t.options)) + throw new Error(`Invalid options: ${t.options}`); + if (t.attribution && t.attribution.auto !== void 0 && t.attribution.dataSuffix !== void 0) + throw new Error("Attribution cannot contain both auto and dataSuffix properties"); + } +} +function lV(t) { + var e; + const r = { + metadata: t.metadata, + preference: t.preference + }; + return (e = eK(r)) !== null && e !== void 0 ? e : new uV(r); +} +const hV = { + options: "all" +}; +function dV(t) { + var e; + new Os("CBWSDK").setItem("VERSION", ul), JK(); + const n = { + metadata: { + appName: t.appName || "Dapp", + appLogoUrl: t.appLogoUrl || "", + appChainIds: t.appChainIds || [] + }, + preference: Object.assign(hV, (e = t.preference) !== null && e !== void 0 ? e : {}) + }; + fV(n.preference); + let i = null; + return { + getProvider: () => (i || (i = lV(n)), i) + }; +} +function YE(t, e) { + return function() { + return t.apply(e, arguments); + }; +} +const { toString: pV } = Object.prototype, { getPrototypeOf: q1 } = Object, u0 = /* @__PURE__ */ ((t) => (e) => { + const r = pV.call(e); + return t[r] || (t[r] = r.slice(8, -1).toLowerCase()); +})(/* @__PURE__ */ Object.create(null)), ds = (t) => (t = t.toLowerCase(), (e) => u0(e) === t), f0 = (t) => (e) => typeof e === t, { isArray: Xc } = Array, Ff = f0("undefined"); +function gV(t) { + return t !== null && !Ff(t) && t.constructor !== null && !Ff(t.constructor) && Si(t.constructor.isBuffer) && t.constructor.isBuffer(t); +} +const JE = ds("ArrayBuffer"); +function mV(t) { + let e; + return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && JE(t.buffer), e; +} +const vV = f0("string"), Si = f0("function"), XE = f0("number"), l0 = (t) => t !== null && typeof t == "object", bV = (t) => t === !0 || t === !1, Xh = (t) => { + if (u0(t) !== "object") + return !1; + const e = q1(t); + return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in t) && !(Symbol.iterator in t); +}, yV = ds("Date"), wV = ds("File"), xV = ds("Blob"), _V = ds("FileList"), EV = (t) => l0(t) && Si(t.pipe), SV = (t) => { + let e; + return t && (typeof FormData == "function" && t instanceof FormData || Si(t.append) && ((e = u0(t)) === "formdata" || // detect form-data instance + e === "object" && Si(t.toString) && t.toString() === "[object FormData]")); +}, AV = ds("URLSearchParams"), [PV, MV, IV, CV] = ["ReadableStream", "Request", "Response", "Headers"].map(ds), RV = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); +function ll(t, e, { allOwnKeys: r = !1 } = {}) { + if (t === null || typeof t > "u") + return; + let n, i; + if (typeof t != "object" && (t = [t]), Xc(t)) + for (n = 0, i = t.length; n < i; n++) + e.call(null, t[n], n, t); + else { + const s = r ? Object.getOwnPropertyNames(t) : Object.keys(t), o = s.length; + let a; + for (n = 0; n < o; n++) + a = s[n], e.call(null, t[a], a, t); + } +} +function ZE(t, e) { + e = e.toLowerCase(); + const r = Object.keys(t); + let n = r.length, i; + for (; n-- > 0; ) + if (i = r[n], e === i.toLowerCase()) + return i; + return null; +} +const Ia = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, QE = (t) => !Ff(t) && t !== Ia; +function xv() { + const { caseless: t } = QE(this) && this || {}, e = {}, r = (n, i) => { + const s = t && ZE(e, i) || i; + Xh(e[s]) && Xh(n) ? e[s] = xv(e[s], n) : Xh(n) ? e[s] = xv({}, n) : Xc(n) ? e[s] = n.slice() : e[s] = n; + }; + for (let n = 0, i = arguments.length; n < i; n++) + arguments[n] && ll(arguments[n], r); + return e; +} +const TV = (t, e, r, { allOwnKeys: n } = {}) => (ll(e, (i, s) => { + r && Si(i) ? t[s] = YE(i, r) : t[s] = i; +}, { allOwnKeys: n }), t), DV = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), OV = (t, e, r, n) => { + t.prototype = Object.create(e.prototype, n), t.prototype.constructor = t, Object.defineProperty(t, "super", { + value: e.prototype + }), r && Object.assign(t.prototype, r); +}, NV = (t, e, r, n) => { + let i, s, o; + const a = {}; + if (e = e || {}, t == null) return e; + do { + for (i = Object.getOwnPropertyNames(t), s = i.length; s-- > 0; ) + o = i[s], (!n || n(o, t, e)) && !a[o] && (e[o] = t[o], a[o] = !0); + t = r !== !1 && q1(t); + } while (t && (!r || r(t, e)) && t !== Object.prototype); + return e; +}, LV = (t, e, r) => { + t = String(t), (r === void 0 || r > t.length) && (r = t.length), r -= e.length; + const n = t.indexOf(e, r); + return n !== -1 && n === r; +}, kV = (t) => { + if (!t) return null; + if (Xc(t)) return t; + let e = t.length; + if (!XE(e)) return null; + const r = new Array(e); + for (; e-- > 0; ) + r[e] = t[e]; + return r; +}, $V = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && q1(Uint8Array)), BV = (t, e) => { + const n = (t && t[Symbol.iterator]).call(t); + let i; + for (; (i = n.next()) && !i.done; ) { + const s = i.value; + e.call(t, s[0], s[1]); + } +}, FV = (t, e) => { + let r; + const n = []; + for (; (r = t.exec(e)) !== null; ) + n.push(r); + return n; +}, jV = ds("HTMLFormElement"), UV = (t) => t.toLowerCase().replace( + /[-_\s]([a-z\d])(\w*)/g, + function(r, n, i) { + return n.toUpperCase() + i; + } +), e6 = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), qV = ds("RegExp"), eS = (t, e) => { + const r = Object.getOwnPropertyDescriptors(t), n = {}; + ll(r, (i, s) => { + let o; + (o = e(i, s, t)) !== !1 && (n[s] = o || i); + }), Object.defineProperties(t, n); +}, zV = (t) => { + eS(t, (e, r) => { + if (Si(t) && ["arguments", "caller", "callee"].indexOf(r) !== -1) + return !1; + const n = t[r]; + if (Si(n)) { + if (e.enumerable = !1, "writable" in e) { + e.writable = !1; + return; + } + e.set || (e.set = () => { + throw Error("Can not rewrite read-only method '" + r + "'"); + }); + } + }); +}, HV = (t, e) => { + const r = {}, n = (i) => { + i.forEach((s) => { + r[s] = !0; + }); + }; + return Xc(t) ? n(t) : n(String(t).split(e)), r; +}, WV = () => { +}, KV = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, pm = "abcdefghijklmnopqrstuvwxyz", t6 = "0123456789", tS = { + DIGIT: t6, + ALPHA: pm, + ALPHA_DIGIT: pm + pm.toUpperCase() + t6 +}, VV = (t = 16, e = tS.ALPHA_DIGIT) => { + let r = ""; + const { length: n } = e; + for (; t--; ) + r += e[Math.random() * n | 0]; + return r; +}; +function GV(t) { + return !!(t && Si(t.append) && t[Symbol.toStringTag] === "FormData" && t[Symbol.iterator]); +} +const YV = (t) => { + const e = new Array(10), r = (n, i) => { + if (l0(n)) { + if (e.indexOf(n) >= 0) + return; + if (!("toJSON" in n)) { + e[i] = n; + const s = Xc(n) ? [] : {}; + return ll(n, (o, a) => { + const f = r(o, i + 1); + !Ff(f) && (s[a] = f); + }), e[i] = void 0, s; + } + } + return n; + }; + return r(t, 0); +}, JV = ds("AsyncFunction"), XV = (t) => t && (l0(t) || Si(t)) && Si(t.then) && Si(t.catch), rS = ((t, e) => t ? setImmediate : e ? ((r, n) => (Ia.addEventListener("message", ({ source: i, data: s }) => { + i === Ia && s === r && n.length && n.shift()(); +}, !1), (i) => { + n.push(i), Ia.postMessage(r, "*"); +}))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))( + typeof setImmediate == "function", + Si(Ia.postMessage) +), ZV = typeof queueMicrotask < "u" ? queueMicrotask.bind(Ia) : typeof process < "u" && process.nextTick || rS, Ne = { + isArray: Xc, + isArrayBuffer: JE, + isBuffer: gV, + isFormData: SV, + isArrayBufferView: mV, + isString: vV, + isNumber: XE, + isBoolean: bV, + isObject: l0, + isPlainObject: Xh, + isReadableStream: PV, + isRequest: MV, + isResponse: IV, + isHeaders: CV, + isUndefined: Ff, + isDate: yV, + isFile: wV, + isBlob: xV, + isRegExp: qV, + isFunction: Si, + isStream: EV, + isURLSearchParams: AV, + isTypedArray: $V, + isFileList: _V, + forEach: ll, + merge: xv, + extend: TV, + trim: RV, + stripBOM: DV, + inherits: OV, + toFlatObject: NV, + kindOf: u0, + kindOfTest: ds, + endsWith: LV, + toArray: kV, + forEachEntry: BV, + matchAll: FV, + isHTMLForm: jV, + hasOwnProperty: e6, + hasOwnProp: e6, + // an alias to avoid ESLint no-prototype-builtins detection + reduceDescriptors: eS, + freezeMethods: zV, + toObjectSet: HV, + toCamelCase: UV, + noop: WV, + toFiniteNumber: KV, + findKey: ZE, + global: Ia, + isContextDefined: QE, + ALPHABET: tS, + generateString: VV, + isSpecCompliantForm: GV, + toJSONObject: YV, + isAsyncFn: JV, + isThenable: XV, + setImmediate: rS, + asap: ZV +}; +function ar(t, e, r, n, i) { + Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = t, this.name = "AxiosError", e && (this.code = e), r && (this.config = r), n && (this.request = n), i && (this.response = i, this.status = i.status ? i.status : null); +} +Ne.inherits(ar, Error, { + toJSON: function() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: Ne.toJSONObject(this.config), + code: this.code, + status: this.status + }; + } +}); +const nS = ar.prototype, iS = {}; +[ + "ERR_BAD_OPTION_VALUE", + "ERR_BAD_OPTION", + "ECONNABORTED", + "ETIMEDOUT", + "ERR_NETWORK", + "ERR_FR_TOO_MANY_REDIRECTS", + "ERR_DEPRECATED", + "ERR_BAD_RESPONSE", + "ERR_BAD_REQUEST", + "ERR_CANCELED", + "ERR_NOT_SUPPORT", + "ERR_INVALID_URL" + // eslint-disable-next-line func-names +].forEach((t) => { + iS[t] = { value: t }; +}); +Object.defineProperties(ar, iS); +Object.defineProperty(nS, "isAxiosError", { value: !0 }); +ar.from = (t, e, r, n, i, s) => { + const o = Object.create(nS); + return Ne.toFlatObject(t, o, function(f) { + return f !== Error.prototype; + }, (a) => a !== "isAxiosError"), ar.call(o, t.message, e, r, n, i), o.cause = t, o.name = t.name, s && Object.assign(o, s), o; +}; +const QV = null; +function _v(t) { + return Ne.isPlainObject(t) || Ne.isArray(t); +} +function sS(t) { + return Ne.endsWith(t, "[]") ? t.slice(0, -2) : t; +} +function r6(t, e, r) { + return t ? t.concat(e).map(function(i, s) { + return i = sS(i), !r && s ? "[" + i + "]" : i; + }).join(r ? "." : "") : e; +} +function eG(t) { + return Ne.isArray(t) && !t.some(_v); +} +const tG = Ne.toFlatObject(Ne, {}, null, function(e) { + return /^is[A-Z]/.test(e); +}); +function h0(t, e, r) { + if (!Ne.isObject(t)) + throw new TypeError("target must be an object"); + e = e || new FormData(), r = Ne.toFlatObject(r, { + metaTokens: !0, + dots: !1, + indexes: !1 + }, !1, function(C, D) { + return !Ne.isUndefined(D[C]); + }); + const n = r.metaTokens, i = r.visitor || h, s = r.dots, o = r.indexes, f = (r.Blob || typeof Blob < "u" && Blob) && Ne.isSpecCompliantForm(e); + if (!Ne.isFunction(i)) + throw new TypeError("visitor must be a function"); + function u(S) { + if (S === null) return ""; + if (Ne.isDate(S)) + return S.toISOString(); + if (!f && Ne.isBlob(S)) + throw new ar("Blob is not supported. Use a Buffer instead."); + return Ne.isArrayBuffer(S) || Ne.isTypedArray(S) ? f && typeof Blob == "function" ? new Blob([S]) : Buffer.from(S) : S; + } + function h(S, C, D) { + let $ = S; + if (S && !D && typeof S == "object") { + if (Ne.endsWith(C, "{}")) + C = n ? C : C.slice(0, -2), S = JSON.stringify(S); + else if (Ne.isArray(S) && eG(S) || (Ne.isFileList(S) || Ne.endsWith(C, "[]")) && ($ = Ne.toArray(S))) + return C = sS(C), $.forEach(function(z, k) { + !(Ne.isUndefined(z) || z === null) && e.append( + // eslint-disable-next-line no-nested-ternary + o === !0 ? r6([C], k, s) : o === null ? C : C + "[]", + u(z) + ); + }), !1; + } + return _v(S) ? !0 : (e.append(r6(D, C, s), u(S)), !1); + } + const g = [], v = Object.assign(tG, { + defaultVisitor: h, + convertValue: u, + isVisitable: _v + }); + function x(S, C) { + if (!Ne.isUndefined(S)) { + if (g.indexOf(S) !== -1) + throw Error("Circular reference detected in " + C.join(".")); + g.push(S), Ne.forEach(S, function($, N) { + (!(Ne.isUndefined($) || $ === null) && i.call( + e, + $, + Ne.isString(N) ? N.trim() : N, + C, + v + )) === !0 && x($, C ? C.concat(N) : [N]); + }), g.pop(); + } + } + if (!Ne.isObject(t)) + throw new TypeError("data must be an object"); + return x(t), e; +} +function n6(t) { + const e = { + "!": "%21", + "'": "%27", + "(": "%28", + ")": "%29", + "~": "%7E", + "%20": "+", + "%00": "\0" + }; + return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g, function(n) { + return e[n]; + }); +} +function z1(t, e) { + this._pairs = [], t && h0(t, this, e); +} +const oS = z1.prototype; +oS.append = function(e, r) { + this._pairs.push([e, r]); +}; +oS.toString = function(e) { + const r = e ? function(n) { + return e.call(this, n, n6); + } : n6; + return this._pairs.map(function(i) { + return r(i[0]) + "=" + r(i[1]); + }, "").join("&"); +}; +function rG(t) { + return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]"); +} +function aS(t, e, r) { + if (!e) + return t; + const n = r && r.encode || rG; + Ne.isFunction(r) && (r = { + serialize: r + }); + const i = r && r.serialize; + let s; + if (i ? s = i(e, r) : s = Ne.isURLSearchParams(e) ? e.toString() : new z1(e, r).toString(n), s) { + const o = t.indexOf("#"); + o !== -1 && (t = t.slice(0, o)), t += (t.indexOf("?") === -1 ? "?" : "&") + s; + } + return t; +} +class i6 { + constructor() { + this.handlers = []; + } + /** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ + use(e, r, n) { + return this.handlers.push({ + fulfilled: e, + rejected: r, + synchronous: n ? n.synchronous : !1, + runWhen: n ? n.runWhen : null + }), this.handlers.length - 1; + } + /** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + * + * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise + */ + eject(e) { + this.handlers[e] && (this.handlers[e] = null); + } + /** + * Clear all interceptors from the stack + * + * @returns {void} + */ + clear() { + this.handlers && (this.handlers = []); + } + /** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + * + * @returns {void} + */ + forEach(e) { + Ne.forEach(this.handlers, function(n) { + n !== null && e(n); + }); + } +} +const cS = { + silentJSONParsing: !0, + forcedJSONParsing: !0, + clarifyTimeoutError: !1 +}, nG = typeof URLSearchParams < "u" ? URLSearchParams : z1, iG = typeof FormData < "u" ? FormData : null, sG = typeof Blob < "u" ? Blob : null, oG = { + isBrowser: !0, + classes: { + URLSearchParams: nG, + FormData: iG, + Blob: sG + }, + protocols: ["http", "https", "file", "blob", "url", "data"] +}, H1 = typeof window < "u" && typeof document < "u", Ev = typeof navigator == "object" && navigator || void 0, aG = H1 && (!Ev || ["ReactNative", "NativeScript", "NS"].indexOf(Ev.product) < 0), cG = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef +self instanceof WorkerGlobalScope && typeof self.importScripts == "function", uG = H1 && window.location.href || "http://localhost", fG = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + hasBrowserEnv: H1, + hasStandardBrowserEnv: aG, + hasStandardBrowserWebWorkerEnv: cG, + navigator: Ev, + origin: uG +}, Symbol.toStringTag, { value: "Module" })), zn = { + ...fG, + ...oG +}; +function lG(t, e) { + return h0(t, new zn.classes.URLSearchParams(), Object.assign({ + visitor: function(r, n, i, s) { + return zn.isNode && Ne.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : s.defaultVisitor.apply(this, arguments); + } + }, e)); +} +function hG(t) { + return Ne.matchAll(/\w+|\[(\w*)]/g, t).map((e) => e[0] === "[]" ? "" : e[1] || e[0]); +} +function dG(t) { + const e = {}, r = Object.keys(t); + let n; + const i = r.length; + let s; + for (n = 0; n < i; n++) + s = r[n], e[s] = t[s]; + return e; +} +function uS(t) { + function e(r, n, i, s) { + let o = r[s++]; + if (o === "__proto__") return !0; + const a = Number.isFinite(+o), f = s >= r.length; + return o = !o && Ne.isArray(i) ? i.length : o, f ? (Ne.hasOwnProp(i, o) ? i[o] = [i[o], n] : i[o] = n, !a) : ((!i[o] || !Ne.isObject(i[o])) && (i[o] = []), e(r, n, i[o], s) && Ne.isArray(i[o]) && (i[o] = dG(i[o])), !a); + } + if (Ne.isFormData(t) && Ne.isFunction(t.entries)) { + const r = {}; + return Ne.forEachEntry(t, (n, i) => { + e(hG(n), i, r, 0); + }), r; + } + return null; +} +function pG(t, e, r) { + if (Ne.isString(t)) + try { + return (e || JSON.parse)(t), Ne.trim(t); + } catch (n) { + if (n.name !== "SyntaxError") + throw n; + } + return (r || JSON.stringify)(t); +} +const hl = { + transitional: cS, + adapter: ["xhr", "http", "fetch"], + transformRequest: [function(e, r) { + const n = r.getContentType() || "", i = n.indexOf("application/json") > -1, s = Ne.isObject(e); + if (s && Ne.isHTMLForm(e) && (e = new FormData(e)), Ne.isFormData(e)) + return i ? JSON.stringify(uS(e)) : e; + if (Ne.isArrayBuffer(e) || Ne.isBuffer(e) || Ne.isStream(e) || Ne.isFile(e) || Ne.isBlob(e) || Ne.isReadableStream(e)) + return e; + if (Ne.isArrayBufferView(e)) + return e.buffer; + if (Ne.isURLSearchParams(e)) + return r.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString(); + let a; + if (s) { + if (n.indexOf("application/x-www-form-urlencoded") > -1) + return lG(e, this.formSerializer).toString(); + if ((a = Ne.isFileList(e)) || n.indexOf("multipart/form-data") > -1) { + const f = this.env && this.env.FormData; + return h0( + a ? { "files[]": e } : e, + f && new f(), + this.formSerializer + ); + } + } + return s || i ? (r.setContentType("application/json", !1), pG(e)) : e; + }], + transformResponse: [function(e) { + const r = this.transitional || hl.transitional, n = r && r.forcedJSONParsing, i = this.responseType === "json"; + if (Ne.isResponse(e) || Ne.isReadableStream(e)) + return e; + if (e && Ne.isString(e) && (n && !this.responseType || i)) { + const o = !(r && r.silentJSONParsing) && i; + try { + return JSON.parse(e); + } catch (a) { + if (o) + throw a.name === "SyntaxError" ? ar.from(a, ar.ERR_BAD_RESPONSE, this, null, this.response) : a; + } + } + return e; + }], + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, + xsrfCookieName: "XSRF-TOKEN", + xsrfHeaderName: "X-XSRF-TOKEN", + maxContentLength: -1, + maxBodyLength: -1, + env: { + FormData: zn.classes.FormData, + Blob: zn.classes.Blob + }, + validateStatus: function(e) { + return e >= 200 && e < 300; + }, + headers: { + common: { + Accept: "application/json, text/plain, */*", + "Content-Type": void 0 + } + } +}; +Ne.forEach(["delete", "get", "head", "post", "put", "patch"], (t) => { + hl.headers[t] = {}; +}); +const gG = Ne.toObjectSet([ + "age", + "authorization", + "content-length", + "content-type", + "etag", + "expires", + "from", + "host", + "if-modified-since", + "if-unmodified-since", + "last-modified", + "location", + "max-forwards", + "proxy-authorization", + "referer", + "retry-after", + "user-agent" +]), mG = (t) => { + const e = {}; + let r, n, i; + return t && t.split(` +`).forEach(function(o) { + i = o.indexOf(":"), r = o.substring(0, i).trim().toLowerCase(), n = o.substring(i + 1).trim(), !(!r || e[r] && gG[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n); + }), e; +}, s6 = Symbol("internals"); +function Uu(t) { + return t && String(t).trim().toLowerCase(); +} +function Zh(t) { + return t === !1 || t == null ? t : Ne.isArray(t) ? t.map(Zh) : String(t); +} +function vG(t) { + const e = /* @__PURE__ */ Object.create(null), r = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; + let n; + for (; n = r.exec(t); ) + e[n[1]] = n[2]; + return e; +} +const bG = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()); +function gm(t, e, r, n, i) { + if (Ne.isFunction(n)) + return n.call(this, e, r); + if (i && (e = r), !!Ne.isString(e)) { + if (Ne.isString(n)) + return e.indexOf(n) !== -1; + if (Ne.isRegExp(n)) + return n.test(e); + } +} +function yG(t) { + return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, r, n) => r.toUpperCase() + n); +} +function wG(t, e) { + const r = Ne.toCamelCase(" " + e); + ["get", "set", "has"].forEach((n) => { + Object.defineProperty(t, n + r, { + value: function(i, s, o) { + return this[n].call(this, e, i, s, o); + }, + configurable: !0 + }); + }); +} +let li = class { + constructor(e) { + e && this.set(e); + } + set(e, r, n) { + const i = this; + function s(a, f, u) { + const h = Uu(f); + if (!h) + throw new Error("header name must be a non-empty string"); + const g = Ne.findKey(i, h); + (!g || i[g] === void 0 || u === !0 || u === void 0 && i[g] !== !1) && (i[g || f] = Zh(a)); + } + const o = (a, f) => Ne.forEach(a, (u, h) => s(u, h, f)); + if (Ne.isPlainObject(e) || e instanceof this.constructor) + o(e, r); + else if (Ne.isString(e) && (e = e.trim()) && !bG(e)) + o(mG(e), r); + else if (Ne.isHeaders(e)) + for (const [a, f] of e.entries()) + s(f, a, n); + else + e != null && s(r, e, n); + return this; + } + get(e, r) { + if (e = Uu(e), e) { + const n = Ne.findKey(this, e); + if (n) { + const i = this[n]; + if (!r) + return i; + if (r === !0) + return vG(i); + if (Ne.isFunction(r)) + return r.call(this, i, n); + if (Ne.isRegExp(r)) + return r.exec(i); + throw new TypeError("parser must be boolean|regexp|function"); + } + } + } + has(e, r) { + if (e = Uu(e), e) { + const n = Ne.findKey(this, e); + return !!(n && this[n] !== void 0 && (!r || gm(this, this[n], n, r))); + } + return !1; + } + delete(e, r) { + const n = this; + let i = !1; + function s(o) { + if (o = Uu(o), o) { + const a = Ne.findKey(n, o); + a && (!r || gm(n, n[a], a, r)) && (delete n[a], i = !0); + } + } + return Ne.isArray(e) ? e.forEach(s) : s(e), i; + } + clear(e) { + const r = Object.keys(this); + let n = r.length, i = !1; + for (; n--; ) { + const s = r[n]; + (!e || gm(this, this[s], s, e, !0)) && (delete this[s], i = !0); + } + return i; + } + normalize(e) { + const r = this, n = {}; + return Ne.forEach(this, (i, s) => { + const o = Ne.findKey(n, s); + if (o) { + r[o] = Zh(i), delete r[s]; + return; + } + const a = e ? yG(s) : String(s).trim(); + a !== s && delete r[s], r[a] = Zh(i), n[a] = !0; + }), this; + } + concat(...e) { + return this.constructor.concat(this, ...e); + } + toJSON(e) { + const r = /* @__PURE__ */ Object.create(null); + return Ne.forEach(this, (n, i) => { + n != null && n !== !1 && (r[i] = e && Ne.isArray(n) ? n.join(", ") : n); + }), r; + } + [Symbol.iterator]() { + return Object.entries(this.toJSON())[Symbol.iterator](); + } + toString() { + return Object.entries(this.toJSON()).map(([e, r]) => e + ": " + r).join(` +`); + } + get [Symbol.toStringTag]() { + return "AxiosHeaders"; + } + static from(e) { + return e instanceof this ? e : new this(e); + } + static concat(e, ...r) { + const n = new this(e); + return r.forEach((i) => n.set(i)), n; + } + static accessor(e) { + const n = (this[s6] = this[s6] = { + accessors: {} + }).accessors, i = this.prototype; + function s(o) { + const a = Uu(o); + n[a] || (wG(i, o), n[a] = !0); + } + return Ne.isArray(e) ? e.forEach(s) : s(e), this; + } +}; +li.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]); +Ne.reduceDescriptors(li.prototype, ({ value: t }, e) => { + let r = e[0].toUpperCase() + e.slice(1); + return { + get: () => t, + set(n) { + this[r] = n; + } + }; +}); +Ne.freezeMethods(li); +function mm(t, e) { + const r = this || hl, n = e || r, i = li.from(n.headers); + let s = n.data; + return Ne.forEach(t, function(a) { + s = a.call(r, s, i.normalize(), e ? e.status : void 0); + }), i.normalize(), s; +} +function fS(t) { + return !!(t && t.__CANCEL__); +} +function Zc(t, e, r) { + ar.call(this, t ?? "canceled", ar.ERR_CANCELED, e, r), this.name = "CanceledError"; +} +Ne.inherits(Zc, ar, { + __CANCEL__: !0 +}); +function lS(t, e, r) { + const n = r.config.validateStatus; + !r.status || !n || n(r.status) ? t(r) : e(new ar( + "Request failed with status code " + r.status, + [ar.ERR_BAD_REQUEST, ar.ERR_BAD_RESPONSE][Math.floor(r.status / 100) - 4], + r.config, + r.request, + r + )); +} +function xG(t) { + const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(t); + return e && e[1] || ""; +} +function _G(t, e) { + t = t || 10; + const r = new Array(t), n = new Array(t); + let i = 0, s = 0, o; + return e = e !== void 0 ? e : 1e3, function(f) { + const u = Date.now(), h = n[s]; + o || (o = u), r[i] = f, n[i] = u; + let g = s, v = 0; + for (; g !== i; ) + v += r[g++], g = g % t; + if (i = (i + 1) % t, i === s && (s = (s + 1) % t), u - o < e) + return; + const x = h && u - h; + return x ? Math.round(v * 1e3 / x) : void 0; + }; +} +function EG(t, e) { + let r = 0, n = 1e3 / e, i, s; + const o = (u, h = Date.now()) => { + r = h, i = null, s && (clearTimeout(s), s = null), t.apply(null, u); + }; + return [(...u) => { + const h = Date.now(), g = h - r; + g >= n ? o(u, h) : (i = u, s || (s = setTimeout(() => { + s = null, o(i); + }, n - g))); + }, () => i && o(i)]; +} +const Pd = (t, e, r = 3) => { + let n = 0; + const i = _G(50, 250); + return EG((s) => { + const o = s.loaded, a = s.lengthComputable ? s.total : void 0, f = o - n, u = i(f), h = o <= a; + n = o; + const g = { + loaded: o, + total: a, + progress: a ? o / a : void 0, + bytes: f, + rate: u || void 0, + estimated: u && a && h ? (a - o) / u : void 0, + event: s, + lengthComputable: a != null, + [e ? "download" : "upload"]: !0 + }; + t(g); + }, r); +}, o6 = (t, e) => { + const r = t != null; + return [(n) => e[0]({ + lengthComputable: r, + total: t, + loaded: n + }), e[1]]; +}, a6 = (t) => (...e) => Ne.asap(() => t(...e)), SG = zn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, zn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( + new URL(zn.origin), + zn.navigator && /(msie|trident)/i.test(zn.navigator.userAgent) +) : () => !0, AG = zn.hasStandardBrowserEnv ? ( + // Standard browser envs support document.cookie + { + write(t, e, r, n, i, s) { + const o = [t + "=" + encodeURIComponent(e)]; + Ne.isNumber(r) && o.push("expires=" + new Date(r).toGMTString()), Ne.isString(n) && o.push("path=" + n), Ne.isString(i) && o.push("domain=" + i), s === !0 && o.push("secure"), document.cookie = o.join("; "); + }, + read(t) { + const e = document.cookie.match(new RegExp("(^|;\\s*)(" + t + ")=([^;]*)")); + return e ? decodeURIComponent(e[3]) : null; + }, + remove(t) { + this.write(t, "", Date.now() - 864e5); + } + } +) : ( + // Non-standard browser env (web workers, react-native) lack needed support. + { + write() { + }, + read() { + return null; + }, + remove() { + } + } +); +function PG(t) { + return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t); +} +function MG(t, e) { + return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t; +} +function hS(t, e) { + return t && !PG(e) ? MG(t, e) : e; +} +const c6 = (t) => t instanceof li ? { ...t } : t; +function Fa(t, e) { + e = e || {}; + const r = {}; + function n(u, h, g, v) { + return Ne.isPlainObject(u) && Ne.isPlainObject(h) ? Ne.merge.call({ caseless: v }, u, h) : Ne.isPlainObject(h) ? Ne.merge({}, h) : Ne.isArray(h) ? h.slice() : h; + } + function i(u, h, g, v) { + if (Ne.isUndefined(h)) { + if (!Ne.isUndefined(u)) + return n(void 0, u, g, v); + } else return n(u, h, g, v); + } + function s(u, h) { + if (!Ne.isUndefined(h)) + return n(void 0, h); + } + function o(u, h) { + if (Ne.isUndefined(h)) { + if (!Ne.isUndefined(u)) + return n(void 0, u); + } else return n(void 0, h); + } + function a(u, h, g) { + if (g in e) + return n(u, h); + if (g in t) + return n(void 0, u); + } + const f = { + url: s, + method: s, + data: s, + baseURL: o, + transformRequest: o, + transformResponse: o, + paramsSerializer: o, + timeout: o, + timeoutMessage: o, + withCredentials: o, + withXSRFToken: o, + adapter: o, + responseType: o, + xsrfCookieName: o, + xsrfHeaderName: o, + onUploadProgress: o, + onDownloadProgress: o, + decompress: o, + maxContentLength: o, + maxBodyLength: o, + beforeRedirect: o, + transport: o, + httpAgent: o, + httpsAgent: o, + cancelToken: o, + socketPath: o, + responseEncoding: o, + validateStatus: a, + headers: (u, h, g) => i(c6(u), c6(h), g, !0) + }; + return Ne.forEach(Object.keys(Object.assign({}, t, e)), function(h) { + const g = f[h] || i, v = g(t[h], e[h], h); + Ne.isUndefined(v) && g !== a || (r[h] = v); + }), r; +} +const dS = (t) => { + const e = Fa({}, t); + let { data: r, withXSRFToken: n, xsrfHeaderName: i, xsrfCookieName: s, headers: o, auth: a } = e; + e.headers = o = li.from(o), e.url = aS(hS(e.baseURL, e.url), t.params, t.paramsSerializer), a && o.set( + "Authorization", + "Basic " + btoa((a.username || "") + ":" + (a.password ? unescape(encodeURIComponent(a.password)) : "")) + ); + let f; + if (Ne.isFormData(r)) { + if (zn.hasStandardBrowserEnv || zn.hasStandardBrowserWebWorkerEnv) + o.setContentType(void 0); + else if ((f = o.getContentType()) !== !1) { + const [u, ...h] = f ? f.split(";").map((g) => g.trim()).filter(Boolean) : []; + o.setContentType([u || "multipart/form-data", ...h].join("; ")); + } + } + if (zn.hasStandardBrowserEnv && (n && Ne.isFunction(n) && (n = n(e)), n || n !== !1 && SG(e.url))) { + const u = i && s && AG.read(s); + u && o.set(i, u); + } + return e; +}, IG = typeof XMLHttpRequest < "u", CG = IG && function(t) { + return new Promise(function(r, n) { + const i = dS(t); + let s = i.data; + const o = li.from(i.headers).normalize(); + let { responseType: a, onUploadProgress: f, onDownloadProgress: u } = i, h, g, v, x, S; + function C() { + x && x(), S && S(), i.cancelToken && i.cancelToken.unsubscribe(h), i.signal && i.signal.removeEventListener("abort", h); + } + let D = new XMLHttpRequest(); + D.open(i.method.toUpperCase(), i.url, !0), D.timeout = i.timeout; + function $() { + if (!D) + return; + const z = li.from( + "getAllResponseHeaders" in D && D.getAllResponseHeaders() + ), B = { + data: !a || a === "text" || a === "json" ? D.responseText : D.response, + status: D.status, + statusText: D.statusText, + headers: z, + config: t, + request: D + }; + lS(function(R) { + r(R), C(); + }, function(R) { + n(R), C(); + }, B), D = null; + } + "onloadend" in D ? D.onloadend = $ : D.onreadystatechange = function() { + !D || D.readyState !== 4 || D.status === 0 && !(D.responseURL && D.responseURL.indexOf("file:") === 0) || setTimeout($); + }, D.onabort = function() { + D && (n(new ar("Request aborted", ar.ECONNABORTED, t, D)), D = null); + }, D.onerror = function() { + n(new ar("Network Error", ar.ERR_NETWORK, t, D)), D = null; + }, D.ontimeout = function() { + let k = i.timeout ? "timeout of " + i.timeout + "ms exceeded" : "timeout exceeded"; + const B = i.transitional || cS; + i.timeoutErrorMessage && (k = i.timeoutErrorMessage), n(new ar( + k, + B.clarifyTimeoutError ? ar.ETIMEDOUT : ar.ECONNABORTED, + t, + D + )), D = null; + }, s === void 0 && o.setContentType(null), "setRequestHeader" in D && Ne.forEach(o.toJSON(), function(k, B) { + D.setRequestHeader(B, k); + }), Ne.isUndefined(i.withCredentials) || (D.withCredentials = !!i.withCredentials), a && a !== "json" && (D.responseType = i.responseType), u && ([v, S] = Pd(u, !0), D.addEventListener("progress", v)), f && D.upload && ([g, x] = Pd(f), D.upload.addEventListener("progress", g), D.upload.addEventListener("loadend", x)), (i.cancelToken || i.signal) && (h = (z) => { + D && (n(!z || z.type ? new Zc(null, t, D) : z), D.abort(), D = null); + }, i.cancelToken && i.cancelToken.subscribe(h), i.signal && (i.signal.aborted ? h() : i.signal.addEventListener("abort", h))); + const N = xG(i.url); + if (N && zn.protocols.indexOf(N) === -1) { + n(new ar("Unsupported protocol " + N + ":", ar.ERR_BAD_REQUEST, t)); + return; + } + D.send(s || null); + }); +}, RG = (t, e) => { + const { length: r } = t = t ? t.filter(Boolean) : []; + if (e || r) { + let n = new AbortController(), i; + const s = function(u) { + if (!i) { + i = !0, a(); + const h = u instanceof Error ? u : this.reason; + n.abort(h instanceof ar ? h : new Zc(h instanceof Error ? h.message : h)); + } + }; + let o = e && setTimeout(() => { + o = null, s(new ar(`timeout ${e} of ms exceeded`, ar.ETIMEDOUT)); + }, e); + const a = () => { + t && (o && clearTimeout(o), o = null, t.forEach((u) => { + u.unsubscribe ? u.unsubscribe(s) : u.removeEventListener("abort", s); + }), t = null); + }; + t.forEach((u) => u.addEventListener("abort", s)); + const { signal: f } = n; + return f.unsubscribe = () => Ne.asap(a), f; + } +}, TG = function* (t, e) { + let r = t.byteLength; + if (r < e) { + yield t; + return; + } + let n = 0, i; + for (; n < r; ) + i = n + e, yield t.slice(n, i), n = i; +}, DG = async function* (t, e) { + for await (const r of OG(t)) + yield* TG(r, e); +}, OG = async function* (t) { + if (t[Symbol.asyncIterator]) { + yield* t; + return; + } + const e = t.getReader(); + try { + for (; ; ) { + const { done: r, value: n } = await e.read(); + if (r) + break; + yield n; + } + } finally { + await e.cancel(); + } +}, u6 = (t, e, r, n) => { + const i = DG(t, e); + let s = 0, o, a = (f) => { + o || (o = !0, n && n(f)); + }; + return new ReadableStream({ + async pull(f) { + try { + const { done: u, value: h } = await i.next(); + if (u) { + a(), f.close(); + return; + } + let g = h.byteLength; + if (r) { + let v = s += g; + r(v); + } + f.enqueue(new Uint8Array(h)); + } catch (u) { + throw a(u), u; + } + }, + cancel(f) { + return a(f), i.return(); + } + }, { + highWaterMark: 2 + }); +}, d0 = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", pS = d0 && typeof ReadableStream == "function", NG = d0 && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), gS = (t, ...e) => { + try { + return !!t(...e); + } catch { + return !1; + } +}, LG = pS && gS(() => { + let t = !1; + const e = new Request(zn.origin, { + body: new ReadableStream(), + method: "POST", + get duplex() { + return t = !0, "half"; + } + }).headers.has("Content-Type"); + return t && !e; +}), f6 = 64 * 1024, Sv = pS && gS(() => Ne.isReadableStream(new Response("").body)), Md = { + stream: Sv && ((t) => t.body) +}; +d0 && ((t) => { + ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => { + !Md[e] && (Md[e] = Ne.isFunction(t[e]) ? (r) => r[e]() : (r, n) => { + throw new ar(`Response type '${e}' is not supported`, ar.ERR_NOT_SUPPORT, n); + }); + }); +})(new Response()); +const kG = async (t) => { + if (t == null) + return 0; + if (Ne.isBlob(t)) + return t.size; + if (Ne.isSpecCompliantForm(t)) + return (await new Request(zn.origin, { + method: "POST", + body: t + }).arrayBuffer()).byteLength; + if (Ne.isArrayBufferView(t) || Ne.isArrayBuffer(t)) + return t.byteLength; + if (Ne.isURLSearchParams(t) && (t = t + ""), Ne.isString(t)) + return (await NG(t)).byteLength; +}, $G = async (t, e) => { + const r = Ne.toFiniteNumber(t.getContentLength()); + return r ?? kG(e); +}, BG = d0 && (async (t) => { + let { + url: e, + method: r, + data: n, + signal: i, + cancelToken: s, + timeout: o, + onDownloadProgress: a, + onUploadProgress: f, + responseType: u, + headers: h, + withCredentials: g = "same-origin", + fetchOptions: v + } = dS(t); + u = u ? (u + "").toLowerCase() : "text"; + let x = RG([i, s && s.toAbortSignal()], o), S; + const C = x && x.unsubscribe && (() => { + x.unsubscribe(); + }); + let D; + try { + if (f && LG && r !== "get" && r !== "head" && (D = await $G(h, n)) !== 0) { + let B = new Request(e, { + method: "POST", + body: n, + duplex: "half" + }), U; + if (Ne.isFormData(n) && (U = B.headers.get("content-type")) && h.setContentType(U), B.body) { + const [R, W] = o6( + D, + Pd(a6(f)) + ); + n = u6(B.body, f6, R, W); + } + } + Ne.isString(g) || (g = g ? "include" : "omit"); + const $ = "credentials" in Request.prototype; + S = new Request(e, { + ...v, + signal: x, + method: r.toUpperCase(), + headers: h.normalize().toJSON(), + body: n, + duplex: "half", + credentials: $ ? g : void 0 + }); + let N = await fetch(S); + const z = Sv && (u === "stream" || u === "response"); + if (Sv && (a || z && C)) { + const B = {}; + ["status", "statusText", "headers"].forEach((J) => { + B[J] = N[J]; + }); + const U = Ne.toFiniteNumber(N.headers.get("content-length")), [R, W] = a && o6( + U, + Pd(a6(a), !0) + ) || []; + N = new Response( + u6(N.body, f6, R, () => { + W && W(), C && C(); + }), + B + ); + } + u = u || "text"; + let k = await Md[Ne.findKey(Md, u) || "text"](N, t); + return !z && C && C(), await new Promise((B, U) => { + lS(B, U, { + data: k, + headers: li.from(N.headers), + status: N.status, + statusText: N.statusText, + config: t, + request: S + }); + }); + } catch ($) { + throw C && C(), $ && $.name === "TypeError" && /fetch/i.test($.message) ? Object.assign( + new ar("Network Error", ar.ERR_NETWORK, t, S), + { + cause: $.cause || $ + } + ) : ar.from($, $ && $.code, t, S); + } +}), Av = { + http: QV, + xhr: CG, + fetch: BG +}; +Ne.forEach(Av, (t, e) => { + if (t) { + try { + Object.defineProperty(t, "name", { value: e }); + } catch { + } + Object.defineProperty(t, "adapterName", { value: e }); + } +}); +const l6 = (t) => `- ${t}`, FG = (t) => Ne.isFunction(t) || t === null || t === !1, mS = { + getAdapter: (t) => { + t = Ne.isArray(t) ? t : [t]; + const { length: e } = t; + let r, n; + const i = {}; + for (let s = 0; s < e; s++) { + r = t[s]; + let o; + if (n = r, !FG(r) && (n = Av[(o = String(r)).toLowerCase()], n === void 0)) + throw new ar(`Unknown adapter '${o}'`); + if (n) + break; + i[o || "#" + s] = n; + } + if (!n) { + const s = Object.entries(i).map( + ([a, f]) => `adapter ${a} ` + (f === !1 ? "is not supported by the environment" : "is not available in the build") + ); + let o = e ? s.length > 1 ? `since : +` + s.map(l6).join(` +`) : " " + l6(s[0]) : "as no adapter specified"; + throw new ar( + "There is no suitable adapter to dispatch the request " + o, + "ERR_NOT_SUPPORT" + ); + } + return n; + }, + adapters: Av +}; +function vm(t) { + if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted) + throw new Zc(null, t); +} +function h6(t) { + return vm(t), t.headers = li.from(t.headers), t.data = mm.call( + t, + t.transformRequest + ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), mS.getAdapter(t.adapter || hl.adapter)(t).then(function(n) { + return vm(t), n.data = mm.call( + t, + t.transformResponse, + n + ), n.headers = li.from(n.headers), n; + }, function(n) { + return fS(n) || (vm(t), n && n.response && (n.response.data = mm.call( + t, + t.transformResponse, + n.response + ), n.response.headers = li.from(n.response.headers))), Promise.reject(n); + }); +} +const vS = "1.7.8", p0 = {}; +["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => { + p0[t] = function(n) { + return typeof n === t || "a" + (e < 1 ? "n " : " ") + t; + }; +}); +const d6 = {}; +p0.transitional = function(e, r, n) { + function i(s, o) { + return "[Axios v" + vS + "] Transitional option '" + s + "'" + o + (n ? ". " + n : ""); + } + return (s, o, a) => { + if (e === !1) + throw new ar( + i(o, " has been removed" + (r ? " in " + r : "")), + ar.ERR_DEPRECATED + ); + return r && !d6[o] && (d6[o] = !0, console.warn( + i( + o, + " has been deprecated since v" + r + " and will be removed in the near future" + ) + )), e ? e(s, o, a) : !0; + }; +}; +p0.spelling = function(e) { + return (r, n) => (console.warn(`${n} is likely a misspelling of ${e}`), !0); +}; +function jG(t, e, r) { + if (typeof t != "object") + throw new ar("options must be an object", ar.ERR_BAD_OPTION_VALUE); + const n = Object.keys(t); + let i = n.length; + for (; i-- > 0; ) { + const s = n[i], o = e[s]; + if (o) { + const a = t[s], f = a === void 0 || o(a, s, t); + if (f !== !0) + throw new ar("option " + s + " must be " + f, ar.ERR_BAD_OPTION_VALUE); + continue; + } + if (r !== !0) + throw new ar("Unknown option " + s, ar.ERR_BAD_OPTION); + } +} +const Qh = { + assertOptions: jG, + validators: p0 +}, Ss = Qh.validators; +let Ra = class { + constructor(e) { + this.defaults = e, this.interceptors = { + request: new i6(), + response: new i6() + }; + } + /** + * Dispatch a request + * + * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) + * @param {?Object} config + * + * @returns {Promise} The Promise to be fulfilled + */ + async request(e, r) { + try { + return await this._request(e, r); + } catch (n) { + if (n instanceof Error) { + let i = {}; + Error.captureStackTrace ? Error.captureStackTrace(i) : i = new Error(); + const s = i.stack ? i.stack.replace(/^.+\n/, "") : ""; + try { + n.stack ? s && !String(n.stack).endsWith(s.replace(/^.+\n.+\n/, "")) && (n.stack += ` +` + s) : n.stack = s; + } catch { + } + } + throw n; + } + } + _request(e, r) { + typeof e == "string" ? (r = r || {}, r.url = e) : r = e || {}, r = Fa(this.defaults, r); + const { transitional: n, paramsSerializer: i, headers: s } = r; + n !== void 0 && Qh.assertOptions(n, { + silentJSONParsing: Ss.transitional(Ss.boolean), + forcedJSONParsing: Ss.transitional(Ss.boolean), + clarifyTimeoutError: Ss.transitional(Ss.boolean) + }, !1), i != null && (Ne.isFunction(i) ? r.paramsSerializer = { + serialize: i + } : Qh.assertOptions(i, { + encode: Ss.function, + serialize: Ss.function + }, !0)), Qh.assertOptions(r, { + baseUrl: Ss.spelling("baseURL"), + withXsrfToken: Ss.spelling("withXSRFToken") + }, !0), r.method = (r.method || this.defaults.method || "get").toLowerCase(); + let o = s && Ne.merge( + s.common, + s[r.method] + ); + s && Ne.forEach( + ["delete", "get", "head", "post", "put", "patch", "common"], + (S) => { + delete s[S]; + } + ), r.headers = li.concat(o, s); + const a = []; + let f = !0; + this.interceptors.request.forEach(function(C) { + typeof C.runWhen == "function" && C.runWhen(r) === !1 || (f = f && C.synchronous, a.unshift(C.fulfilled, C.rejected)); + }); + const u = []; + this.interceptors.response.forEach(function(C) { + u.push(C.fulfilled, C.rejected); + }); + let h, g = 0, v; + if (!f) { + const S = [h6.bind(this), void 0]; + for (S.unshift.apply(S, a), S.push.apply(S, u), v = S.length, h = Promise.resolve(r); g < v; ) + h = h.then(S[g++], S[g++]); + return h; + } + v = a.length; + let x = r; + for (g = 0; g < v; ) { + const S = a[g++], C = a[g++]; + try { + x = S(x); + } catch (D) { + C.call(this, D); + break; + } + } + try { + h = h6.call(this, x); + } catch (S) { + return Promise.reject(S); + } + for (g = 0, v = u.length; g < v; ) + h = h.then(u[g++], u[g++]); + return h; + } + getUri(e) { + e = Fa(this.defaults, e); + const r = hS(e.baseURL, e.url); + return aS(r, e.params, e.paramsSerializer); + } +}; +Ne.forEach(["delete", "get", "head", "options"], function(e) { + Ra.prototype[e] = function(r, n) { + return this.request(Fa(n || {}, { + method: e, + url: r, + data: (n || {}).data + })); + }; +}); +Ne.forEach(["post", "put", "patch"], function(e) { + function r(n) { + return function(s, o, a) { + return this.request(Fa(a || {}, { + method: e, + headers: n ? { + "Content-Type": "multipart/form-data" + } : {}, + url: s, + data: o + })); + }; + } + Ra.prototype[e] = r(), Ra.prototype[e + "Form"] = r(!0); +}); +let UG = class bS { + constructor(e) { + if (typeof e != "function") + throw new TypeError("executor must be a function."); + let r; + this.promise = new Promise(function(s) { + r = s; + }); + const n = this; + this.promise.then((i) => { + if (!n._listeners) return; + let s = n._listeners.length; + for (; s-- > 0; ) + n._listeners[s](i); + n._listeners = null; + }), this.promise.then = (i) => { + let s; + const o = new Promise((a) => { + n.subscribe(a), s = a; + }).then(i); + return o.cancel = function() { + n.unsubscribe(s); + }, o; + }, e(function(s, o, a) { + n.reason || (n.reason = new Zc(s, o, a), r(n.reason)); + }); + } + /** + * Throws a `CanceledError` if cancellation has been requested. + */ + throwIfRequested() { + if (this.reason) + throw this.reason; + } + /** + * Subscribe to the cancel signal + */ + subscribe(e) { + if (this.reason) { + e(this.reason); + return; + } + this._listeners ? this._listeners.push(e) : this._listeners = [e]; + } + /** + * Unsubscribe from the cancel signal + */ + unsubscribe(e) { + if (!this._listeners) + return; + const r = this._listeners.indexOf(e); + r !== -1 && this._listeners.splice(r, 1); + } + toAbortSignal() { + const e = new AbortController(), r = (n) => { + e.abort(n); + }; + return this.subscribe(r), e.signal.unsubscribe = () => this.unsubscribe(r), e.signal; + } + /** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ + static source() { + let e; + return { + token: new bS(function(i) { + e = i; + }), + cancel: e + }; + } +}; +function qG(t) { + return function(r) { + return t.apply(null, r); + }; +} +function zG(t) { + return Ne.isObject(t) && t.isAxiosError === !0; +} +const Pv = { + Continue: 100, + SwitchingProtocols: 101, + Processing: 102, + EarlyHints: 103, + Ok: 200, + Created: 201, + Accepted: 202, + NonAuthoritativeInformation: 203, + NoContent: 204, + ResetContent: 205, + PartialContent: 206, + MultiStatus: 207, + AlreadyReported: 208, + ImUsed: 226, + MultipleChoices: 300, + MovedPermanently: 301, + Found: 302, + SeeOther: 303, + NotModified: 304, + UseProxy: 305, + Unused: 306, + TemporaryRedirect: 307, + PermanentRedirect: 308, + BadRequest: 400, + Unauthorized: 401, + PaymentRequired: 402, + Forbidden: 403, + NotFound: 404, + MethodNotAllowed: 405, + NotAcceptable: 406, + ProxyAuthenticationRequired: 407, + RequestTimeout: 408, + Conflict: 409, + Gone: 410, + LengthRequired: 411, + PreconditionFailed: 412, + PayloadTooLarge: 413, + UriTooLong: 414, + UnsupportedMediaType: 415, + RangeNotSatisfiable: 416, + ExpectationFailed: 417, + ImATeapot: 418, + MisdirectedRequest: 421, + UnprocessableEntity: 422, + Locked: 423, + FailedDependency: 424, + TooEarly: 425, + UpgradeRequired: 426, + PreconditionRequired: 428, + TooManyRequests: 429, + RequestHeaderFieldsTooLarge: 431, + UnavailableForLegalReasons: 451, + InternalServerError: 500, + NotImplemented: 501, + BadGateway: 502, + ServiceUnavailable: 503, + GatewayTimeout: 504, + HttpVersionNotSupported: 505, + VariantAlsoNegotiates: 506, + InsufficientStorage: 507, + LoopDetected: 508, + NotExtended: 510, + NetworkAuthenticationRequired: 511 +}; +Object.entries(Pv).forEach(([t, e]) => { + Pv[e] = t; +}); +function yS(t) { + const e = new Ra(t), r = YE(Ra.prototype.request, e); + return Ne.extend(r, Ra.prototype, e, { allOwnKeys: !0 }), Ne.extend(r, e, null, { allOwnKeys: !0 }), r.create = function(i) { + return yS(Fa(t, i)); + }, r; +} +const pn = yS(hl); +pn.Axios = Ra; +pn.CanceledError = Zc; +pn.CancelToken = UG; +pn.isCancel = fS; +pn.VERSION = vS; +pn.toFormData = h0; +pn.AxiosError = ar; +pn.Cancel = pn.CanceledError; +pn.all = function(e) { + return Promise.all(e); +}; +pn.spread = qG; +pn.isAxiosError = zG; +pn.mergeConfig = Fa; +pn.AxiosHeaders = li; +pn.formToJSON = (t) => uS(Ne.isHTMLForm(t) ? new FormData(t) : t); +pn.getAdapter = mS.getAdapter; +pn.HttpStatusCode = Pv; +pn.default = pn; +const { + Axios: Jre, + AxiosError: wS, + CanceledError: Xre, + isCancel: Zre, + CancelToken: Qre, + VERSION: ene, + all: tne, + Cancel: rne, + isAxiosError: nne, + spread: ine, + toFormData: sne, + AxiosHeaders: one, + HttpStatusCode: ane, + formToJSON: cne, + getAdapter: une, + mergeConfig: fne +} = pn, xS = pn.create({ + timeout: 6e4, + headers: { + "Content-Type": "application/json", + token: localStorage.getItem("auth") + } +}); +function HG(t) { + if (t.data?.success !== !0) { + const e = new wS( + t.data?.errorMessage, + t.data?.errorCode, + t.config, + t.request, + t + ); + return Promise.reject(e); + } else + return t; +} +function WG(t) { + console.log(t); + const e = t.response?.data; + if (e) { + console.log(e, "responseData"); + const r = new wS( + e.errorMessage, + t.code, + t.config, + t.request, + t.response + ); + return Promise.reject(r); + } else + return Promise.reject(t); +} +xS.interceptors.response.use( + HG, + WG +); +class KG { + constructor(e) { + this.request = e; + } + _apiBase = ""; + setApiBase(e) { + this._apiBase = e || ""; + } + async getNonce(e) { + const { data: r } = await this.request.post(`${this._apiBase}/api/v2/user/nonce`, e); + return r.data; + } + async getEmailCode(e, r) { + const { data: n } = await this.request.post(`${this._apiBase}/api/v2/user/get_code`, e, { + headers: { "Captcha-Param": r } + }); + return n.data; + } + async emailLogin(e) { + return (await this.request.post(`${this._apiBase}/api/v2/user/login`, e)).data; + } + async walletLogin(e) { + return e.account_enum === "C" ? (await this.request.post(`${this._apiBase}/api/v2/user/login`, e)).data : (await this.request.post(`${this._apiBase}/api/v2/business/login`, e)).data; + } + async tonLogin(e) { + return (await this.request.post(`${this._apiBase}/api/v2/user/login`, e)).data; + } + async bindEmail(e) { + return (await this.request.post("/api/v2/user/account/bind", e)).data; + } + async bindTonWallet(e) { + return (await this.request.post("/api/v2/user/account/bind", e)).data; + } + async bindEvmWallet(e) { + return (await this.request.post("/api/v2/user/account/bind", e)).data; + } +} +const Qo = new KG(xS), VG = { + projectId: "7a4434fefbcc9af474fb5c995e47d286", + metadata: { + name: "codatta", + description: "codatta", + url: "https://codatta.io/", + icons: ["https://avatars.githubusercontent.com/u/171659315"] + } +}, GG = dV({ + appName: "codatta", + appLogoUrl: "https://avatars.githubusercontent.com/u/171659315" +}), _S = Xo({ + saveLastUsedWallet: () => { + }, + lastUsedWallet: null, + wallets: [], + initialized: !1, + featuredWallets: [], + chains: [] +}); +function g0() { + return In(_S); +} +function lne(t) { + const { apiBaseUrl: e } = t, [r, n] = Xt([]), [i, s] = Xt([]), [o, a] = Xt(null), [f, u] = Xt(!1), [h, g] = Xt([]), v = (C) => { + a(C); + const $ = { + provider: C.provider instanceof fv ? "UniversalProvider" : "EIP1193Provider", + key: C.key, + timestamp: Date.now() + }; + localStorage.setItem("xn-last-used-info", JSON.stringify($)); + }; + function x(C) { + const D = C.find(($) => $.config?.name === t.singleWalletName); + if (D) + s([D]); + else { + const $ = C.filter((k) => k.featured || k.installed), N = C.filter((k) => !k.featured && !k.installed), z = [...$, ...N]; + n(z), s($); + } + } + async function S() { + const C = [], D = /* @__PURE__ */ new Map(); + bT.forEach((N) => { + const z = new Tc(N); + N.name === "Coinbase Wallet" && z.EIP6963Detected({ + info: { name: "Coinbase Wallet", uuid: "coinbase", icon: N.image, rdns: "coinbase" }, + provider: GG.getProvider() + }), D.set(z.key, z), C.push(z); + }), (await LW()).forEach((N) => { + const z = D.get(N.info.name); + if (z) + z.EIP6963Detected(N); + else { + const k = new Tc(N); + D.set(k.key, k), C.push(k); + } + }); + try { + const N = JSON.parse(localStorage.getItem("xn-last-used-info") || "{}"), z = D.get(N.key); + if (z && N.provider === "EIP1193Provider" && z.installed) + a(z); + else if (N.provider === "UniversalProvider") { + const k = await fv.init(VG); + if (k.session) { + const B = new Tc(k); + a(B), console.log("Restored UniversalProvider for wallet:", B.key); + } + } + } catch (N) { + console.log(N); + } + t.chains && g(t.chains), x(C), u(!0); + } + return Rn(() => { + S(), Qo.setApiBase(e); + }, []), /* @__PURE__ */ pe.jsx( + _S.Provider, + { + value: { + saveLastUsedWallet: v, + wallets: r, + initialized: f, + lastUsedWallet: o, + featuredWallets: i, + chains: h + }, + children: t.children + } + ); +} +/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */ +const YG = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ES = (...t) => t.filter((e, r, n) => !!e && e.trim() !== "" && n.indexOf(e) === r).join(" ").trim(); +/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */ +var JG = { + xmlns: "http://www.w3.org/2000/svg", + width: 24, + height: 24, + viewBox: "0 0 24 24", + fill: "none", + stroke: "currentColor", + strokeWidth: 2, + strokeLinecap: "round", + strokeLinejoin: "round" +}; +/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */ +const XG = Kv( + ({ + color: t = "currentColor", + size: e = 24, + strokeWidth: r = 2, + absoluteStrokeWidth: n, + className: i = "", + children: s, + iconNode: o, + ...a + }, f) => sd( + "svg", + { + ref: f, + ...JG, + width: e, + height: e, + stroke: t, + strokeWidth: n ? Number(r) * 24 / Number(e) : r, + className: ES("lucide", i), + ...a + }, + [ + ...o.map(([u, h]) => sd(u, h)), + ...Array.isArray(s) ? s : [s] + ] + ) +); +/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */ +const Xi = (t, e) => { + const r = Kv( + ({ className: n, ...i }, s) => sd(XG, { + ref: s, + iconNode: e, + className: ES(`lucide-${YG(t)}`, n), + ...i + }) + ); + return r.displayName = `${t}`, r; +}; +/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */ +const ZG = Xi("ArrowLeft", [ + ["path", { d: "m12 19-7-7 7-7", key: "1l729n" }], + ["path", { d: "M19 12H5", key: "x3x0zl" }] +]); +/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */ +const SS = Xi("ArrowRight", [ + ["path", { d: "M5 12h14", key: "1ays0h" }], + ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }] +]); +/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */ +const QG = Xi("ChevronRight", [ + ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }] +]); +/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */ +const eY = Xi("CircleCheckBig", [ + ["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }], + ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }] +]); +/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */ +const tY = Xi("Download", [ + ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }], + ["polyline", { points: "7 10 12 15 17 10", key: "2ggqvy" }], + ["line", { x1: "12", x2: "12", y1: "15", y2: "3", key: "1vk2je" }] +]); +/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */ +const rY = Xi("Globe", [ + ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }], + ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }], + ["path", { d: "M2 12h20", key: "9i4pu4" }] +]); +/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */ +const AS = Xi("Laptop", [ + [ + "path", + { + d: "M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16", + key: "tarvll" + } + ] +]); +/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */ +const nY = Xi("Link2", [ + ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }], + ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }], + ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }] +]); +/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */ +const ja = Xi("LoaderCircle", [ + ["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }] +]); +/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */ +const iY = Xi("Mail", [ + ["rect", { width: "20", height: "16", x: "2", y: "4", rx: "2", key: "18n3k1" }], + ["path", { d: "m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7", key: "1ocrg3" }] +]); +/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */ +const PS = Xi("Search", [ + ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }], + ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }] +]); +/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */ +const sY = Xi("UserRoundCheck", [ + ["path", { d: "M2 21a8 8 0 0 1 13.292-6", key: "bjp14o" }], + ["circle", { cx: "10", cy: "8", r: "5", key: "o932ke" }], + ["path", { d: "m16 19 2 2 4-4", key: "1b14m6" }] +]), p6 = /* @__PURE__ */ new Set(); +function m0(t, e, r) { + t || p6.has(e) || (console.warn(e), p6.add(e)); +} +function oY(t) { + if (typeof Proxy > "u") + return t; + const e = /* @__PURE__ */ new Map(), r = (...n) => (process.env.NODE_ENV !== "production" && m0(!1, "motion() is deprecated. Use motion.create() instead."), t(...n)); + return new Proxy(r, { + /** + * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc. + * The prop name is passed through as `key` and we can use that to generate a `motion` + * DOM component with that name. + */ + get: (n, i) => i === "create" ? t : (e.has(i) || e.set(i, t(i)), e.get(i)) + }); +} +function v0(t) { + return t !== null && typeof t == "object" && typeof t.start == "function"; +} +const Mv = (t) => Array.isArray(t); +function MS(t, e) { + if (!Array.isArray(e)) + return !1; + const r = e.length; + if (r !== t.length) + return !1; + for (let n = 0; n < r; n++) + if (e[n] !== t[n]) + return !1; + return !0; +} +function jf(t) { + return typeof t == "string" || Array.isArray(t); +} +function g6(t) { + const e = [{}, {}]; + return t?.values.forEach((r, n) => { + e[0][n] = r.get(), e[1][n] = r.getVelocity(); + }), e; +} +function W1(t, e, r, n) { + if (typeof e == "function") { + const [i, s] = g6(n); + e = e(r !== void 0 ? r : t.custom, i, s); + } + if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") { + const [i, s] = g6(n); + e = e(r !== void 0 ? r : t.custom, i, s); + } + return e; +} +function b0(t, e, r) { + const n = t.getProps(); + return W1(n, e, r !== void 0 ? r : n.custom, t); +} +const K1 = [ + "animate", + "whileInView", + "whileFocus", + "whileHover", + "whileTap", + "whileDrag", + "exit" +], V1 = ["initial", ...K1], dl = [ + "transformPerspective", + "x", + "y", + "z", + "translateX", + "translateY", + "translateZ", + "scale", + "scaleX", + "scaleY", + "rotate", + "rotateX", + "rotateY", + "rotateZ", + "skew", + "skewX", + "skewY" +], Ya = new Set(dl), Cs = (t) => t * 1e3, oo = (t) => t / 1e3, aY = { + type: "spring", + stiffness: 500, + damping: 25, + restSpeed: 10 +}, cY = (t) => ({ + type: "spring", + stiffness: 550, + damping: t === 0 ? 2 * Math.sqrt(550) : 30, + restSpeed: 10 +}), uY = { + type: "keyframes", + duration: 0.8 +}, fY = { + type: "keyframes", + ease: [0.25, 0.1, 0.35, 1], + duration: 0.3 +}, lY = (t, { keyframes: e }) => e.length > 2 ? uY : Ya.has(t) ? t.startsWith("scale") ? cY(e[1]) : aY : fY; +function G1(t, e) { + return t ? t[e] || t.default || t : void 0; +} +const hY = { + useManualTiming: !1 +}, dY = (t) => t !== null; +function y0(t, { repeat: e, repeatType: r = "loop" }, n) { + const i = t.filter(dY), s = e && r !== "loop" && e % 2 === 1 ? 0 : i.length - 1; + return !s || n === void 0 ? i[s] : n; +} +const kn = (t) => t; +function pY(t) { + let e = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), n = !1, i = !1; + const s = /* @__PURE__ */ new WeakSet(); + let o = { + delta: 0, + timestamp: 0, + isProcessing: !1 + }; + function a(u) { + s.has(u) && (f.schedule(u), t()), u(o); + } + const f = { + /** + * Schedule a process to run on the next frame. + */ + schedule: (u, h = !1, g = !1) => { + const x = g && n ? e : r; + return h && s.add(u), x.has(u) || x.add(u), u; + }, + /** + * Cancel the provided callback from running on the next frame. + */ + cancel: (u) => { + r.delete(u), s.delete(u); + }, + /** + * Execute all schedule callbacks. + */ + process: (u) => { + if (o = u, n) { + i = !0; + return; + } + n = !0, [e, r] = [r, e], r.clear(), e.forEach(a), n = !1, i && (i = !1, f.process(u)); + } + }; + return f; +} +const Ih = [ + "read", + // Read + "resolveKeyframes", + // Write/Read/Write/Read + "update", + // Compute + "preRender", + // Compute + "render", + // Write + "postRender" + // Compute +], gY = 40; +function IS(t, e) { + let r = !1, n = !0; + const i = { + delta: 0, + timestamp: 0, + isProcessing: !1 + }, s = () => r = !0, o = Ih.reduce(($, N) => ($[N] = pY(s), $), {}), { read: a, resolveKeyframes: f, update: u, preRender: h, render: g, postRender: v } = o, x = () => { + const $ = performance.now(); + r = !1, i.delta = n ? 1e3 / 60 : Math.max(Math.min($ - i.timestamp, gY), 1), i.timestamp = $, i.isProcessing = !0, a.process(i), f.process(i), u.process(i), h.process(i), g.process(i), v.process(i), i.isProcessing = !1, r && e && (n = !1, t(x)); + }, S = () => { + r = !0, n = !0, i.isProcessing || t(x); + }; + return { schedule: Ih.reduce(($, N) => { + const z = o[N]; + return $[N] = (k, B = !1, U = !1) => (r || S(), z.schedule(k, B, U)), $; + }, {}), cancel: ($) => { + for (let N = 0; N < Ih.length; N++) + o[Ih[N]].cancel($); + }, state: i, steps: o }; +} +const { schedule: kr, cancel: Vo, state: Nn, steps: bm } = IS(typeof requestAnimationFrame < "u" ? requestAnimationFrame : kn, !0), CS = (t, e, r) => (((1 - 3 * r + 3 * e) * t + (3 * r - 6 * e)) * t + 3 * e) * t, mY = 1e-7, vY = 12; +function bY(t, e, r, n, i) { + let s, o, a = 0; + do + o = e + (r - e) / 2, s = CS(o, n, i) - t, s > 0 ? r = o : e = o; + while (Math.abs(s) > mY && ++a < vY); + return o; +} +function pl(t, e, r, n) { + if (t === e && r === n) + return kn; + const i = (s) => bY(s, 0, 1, t, r); + return (s) => s === 0 || s === 1 ? s : CS(i(s), e, n); +} +const RS = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, TS = (t) => (e) => 1 - t(1 - e), DS = /* @__PURE__ */ pl(0.33, 1.53, 0.69, 0.99), Y1 = /* @__PURE__ */ TS(DS), OS = /* @__PURE__ */ RS(Y1), NS = (t) => (t *= 2) < 1 ? 0.5 * Y1(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), J1 = (t) => 1 - Math.sin(Math.acos(t)), LS = TS(J1), kS = RS(J1), $S = (t) => /^0[^.\s]+$/u.test(t); +function yY(t) { + return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || $S(t) : !0; +} +let Qc = kn, po = kn; +process.env.NODE_ENV !== "production" && (Qc = (t, e) => { + !t && typeof console < "u" && console.warn(e); +}, po = (t, e) => { + if (!t) + throw new Error(e); +}); +const BS = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), FS = (t) => (e) => typeof e == "string" && e.startsWith(t), jS = /* @__PURE__ */ FS("--"), wY = /* @__PURE__ */ FS("var(--"), X1 = (t) => wY(t) ? xY.test(t.split("/*")[0].trim()) : !1, xY = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, _Y = ( + // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words + /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u +); +function EY(t) { + const e = _Y.exec(t); + if (!e) + return [,]; + const [, r, n, i] = e; + return [`--${r ?? n}`, i]; +} +const SY = 4; +function US(t, e, r = 1) { + po(r <= SY, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`); + const [n, i] = EY(t); + if (!n) + return; + const s = window.getComputedStyle(e).getPropertyValue(n); + if (s) { + const o = s.trim(); + return BS(o) ? parseFloat(o) : o; + } + return X1(i) ? US(i, e, r + 1) : i; +} +const Go = (t, e, r) => r > e ? e : r < t ? t : r, eu = { + test: (t) => typeof t == "number", + parse: parseFloat, + transform: (t) => t +}, Uf = { + ...eu, + transform: (t) => Go(0, 1, t) +}, Ch = { + ...eu, + default: 1 +}, gl = (t) => ({ + test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1, + parse: parseFloat, + transform: (e) => `${e}${t}` +}), To = /* @__PURE__ */ gl("deg"), Rs = /* @__PURE__ */ gl("%"), Vt = /* @__PURE__ */ gl("px"), AY = /* @__PURE__ */ gl("vh"), PY = /* @__PURE__ */ gl("vw"), m6 = { + ...Rs, + parse: (t) => Rs.parse(t) / 100, + transform: (t) => Rs.transform(t * 100) +}, MY = /* @__PURE__ */ new Set([ + "width", + "height", + "top", + "left", + "right", + "bottom", + "x", + "y", + "translateX", + "translateY" +]), v6 = (t) => t === eu || t === Vt, b6 = (t, e) => parseFloat(t.split(", ")[e]), y6 = (t, e) => (r, { transform: n }) => { + if (n === "none" || !n) + return 0; + const i = n.match(/^matrix3d\((.+)\)$/u); + if (i) + return b6(i[1], e); + { + const s = n.match(/^matrix\((.+)\)$/u); + return s ? b6(s[1], t) : 0; + } +}, IY = /* @__PURE__ */ new Set(["x", "y", "z"]), CY = dl.filter((t) => !IY.has(t)); +function RY(t) { + const e = []; + return CY.forEach((r) => { + const n = t.getValue(r); + n !== void 0 && (e.push([r, n.get()]), n.set(r.startsWith("scale") ? 1 : 0)); + }), e; +} +const zc = { + // Dimensions + width: ({ x: t }, { paddingLeft: e = "0", paddingRight: r = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(r), + height: ({ y: t }, { paddingTop: e = "0", paddingBottom: r = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(r), + top: (t, { top: e }) => parseFloat(e), + left: (t, { left: e }) => parseFloat(e), + bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min), + right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min), + // Transform + x: y6(4, 13), + y: y6(5, 14) +}; +zc.translateX = zc.x; +zc.translateY = zc.y; +const qS = (t) => (e) => e.test(t), TY = { + test: (t) => t === "auto", + parse: (t) => t +}, zS = [eu, Vt, Rs, To, PY, AY, TY], w6 = (t) => zS.find(qS(t)), Ta = /* @__PURE__ */ new Set(); +let Iv = !1, Cv = !1; +function HS() { + if (Cv) { + const t = Array.from(Ta).filter((n) => n.needsMeasurement), e = new Set(t.map((n) => n.element)), r = /* @__PURE__ */ new Map(); + e.forEach((n) => { + const i = RY(n); + i.length && (r.set(n, i), n.render()); + }), t.forEach((n) => n.measureInitialState()), e.forEach((n) => { + n.render(); + const i = r.get(n); + i && i.forEach(([s, o]) => { + var a; + (a = n.getValue(s)) === null || a === void 0 || a.set(o); + }); + }), t.forEach((n) => n.measureEndState()), t.forEach((n) => { + n.suspendedScrollY !== void 0 && window.scrollTo(0, n.suspendedScrollY); + }); + } + Cv = !1, Iv = !1, Ta.forEach((t) => t.complete()), Ta.clear(); +} +function WS() { + Ta.forEach((t) => { + t.readKeyframes(), t.needsMeasurement && (Cv = !0); + }); +} +function DY() { + WS(), HS(); +} +class Z1 { + constructor(e, r, n, i, s, o = !1) { + this.isComplete = !1, this.isAsync = !1, this.needsMeasurement = !1, this.isScheduled = !1, this.unresolvedKeyframes = [...e], this.onComplete = r, this.name = n, this.motionValue = i, this.element = s, this.isAsync = o; + } + scheduleResolve() { + this.isScheduled = !0, this.isAsync ? (Ta.add(this), Iv || (Iv = !0, kr.read(WS), kr.resolveKeyframes(HS))) : (this.readKeyframes(), this.complete()); + } + readKeyframes() { + const { unresolvedKeyframes: e, name: r, element: n, motionValue: i } = this; + for (let s = 0; s < e.length; s++) + if (e[s] === null) + if (s === 0) { + const o = i?.get(), a = e[e.length - 1]; + if (o !== void 0) + e[0] = o; + else if (n && r) { + const f = n.readValue(r, a); + f != null && (e[0] = f); + } + e[0] === void 0 && (e[0] = a), i && o === void 0 && i.set(e[0]); + } else + e[s] = e[s - 1]; + } + setFinalKeyframe() { + } + measureInitialState() { + } + renderEndStyles() { + } + measureEndState() { + } + complete() { + this.isComplete = !0, this.onComplete(this.unresolvedKeyframes, this.finalKeyframe), Ta.delete(this); + } + cancel() { + this.isComplete || (this.isScheduled = !1, Ta.delete(this)); + } + resume() { + this.isComplete || this.scheduleResolve(); + } +} +const af = (t) => Math.round(t * 1e5) / 1e5, Q1 = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; +function OY(t) { + return t == null; +} +const NY = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, eb = (t, e) => (r) => !!(typeof r == "string" && NY.test(r) && r.startsWith(t) || e && !OY(r) && Object.prototype.hasOwnProperty.call(r, e)), KS = (t, e, r) => (n) => { + if (typeof n != "string") + return n; + const [i, s, o, a] = n.match(Q1); + return { + [t]: parseFloat(i), + [e]: parseFloat(s), + [r]: parseFloat(o), + alpha: a !== void 0 ? parseFloat(a) : 1 + }; +}, LY = (t) => Go(0, 255, t), ym = { + ...eu, + transform: (t) => Math.round(LY(t)) +}, Ca = { + test: /* @__PURE__ */ eb("rgb", "red"), + parse: /* @__PURE__ */ KS("red", "green", "blue"), + transform: ({ red: t, green: e, blue: r, alpha: n = 1 }) => "rgba(" + ym.transform(t) + ", " + ym.transform(e) + ", " + ym.transform(r) + ", " + af(Uf.transform(n)) + ")" +}; +function kY(t) { + let e = "", r = "", n = "", i = ""; + return t.length > 5 ? (e = t.substring(1, 3), r = t.substring(3, 5), n = t.substring(5, 7), i = t.substring(7, 9)) : (e = t.substring(1, 2), r = t.substring(2, 3), n = t.substring(3, 4), i = t.substring(4, 5), e += e, r += r, n += n, i += i), { + red: parseInt(e, 16), + green: parseInt(r, 16), + blue: parseInt(n, 16), + alpha: i ? parseInt(i, 16) / 255 : 1 + }; +} +const Rv = { + test: /* @__PURE__ */ eb("#"), + parse: kY, + transform: Ca.transform +}, _c = { + test: /* @__PURE__ */ eb("hsl", "hue"), + parse: /* @__PURE__ */ KS("hue", "saturation", "lightness"), + transform: ({ hue: t, saturation: e, lightness: r, alpha: n = 1 }) => "hsla(" + Math.round(t) + ", " + Rs.transform(af(e)) + ", " + Rs.transform(af(r)) + ", " + af(Uf.transform(n)) + ")" +}, qn = { + test: (t) => Ca.test(t) || Rv.test(t) || _c.test(t), + parse: (t) => Ca.test(t) ? Ca.parse(t) : _c.test(t) ? _c.parse(t) : Rv.parse(t), + transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? Ca.transform(t) : _c.transform(t) +}, $Y = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu; +function BY(t) { + var e, r; + return isNaN(t) && typeof t == "string" && (((e = t.match(Q1)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match($Y)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; +} +const VS = "number", GS = "color", FY = "var", jY = "var(", x6 = "${}", UY = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; +function qf(t) { + const e = t.toString(), r = [], n = { + color: [], + number: [], + var: [] + }, i = []; + let s = 0; + const a = e.replace(UY, (f) => (qn.test(f) ? (n.color.push(s), i.push(GS), r.push(qn.parse(f))) : f.startsWith(jY) ? (n.var.push(s), i.push(FY), r.push(f)) : (n.number.push(s), i.push(VS), r.push(parseFloat(f))), ++s, x6)).split(x6); + return { values: r, split: a, indexes: n, types: i }; +} +function YS(t) { + return qf(t).values; +} +function JS(t) { + const { split: e, types: r } = qf(t), n = e.length; + return (i) => { + let s = ""; + for (let o = 0; o < n; o++) + if (s += e[o], i[o] !== void 0) { + const a = r[o]; + a === VS ? s += af(i[o]) : a === GS ? s += qn.transform(i[o]) : s += i[o]; + } + return s; + }; +} +const qY = (t) => typeof t == "number" ? 0 : t; +function zY(t) { + const e = YS(t); + return JS(t)(e.map(qY)); +} +const Yo = { + test: BY, + parse: YS, + createTransformer: JS, + getAnimatableNone: zY +}, HY = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]); +function WY(t) { + const [e, r] = t.slice(0, -1).split("("); + if (e === "drop-shadow") + return t; + const [n] = r.match(Q1) || []; + if (!n) + return t; + const i = r.replace(n, ""); + let s = HY.has(e) ? 1 : 0; + return n !== r && (s *= 100), e + "(" + s + i + ")"; +} +const KY = /\b([a-z-]*)\(.*?\)/gu, Tv = { + ...Yo, + getAnimatableNone: (t) => { + const e = t.match(KY); + return e ? e.map(WY).join(" ") : t; + } +}, VY = { + // Border props + borderWidth: Vt, + borderTopWidth: Vt, + borderRightWidth: Vt, + borderBottomWidth: Vt, + borderLeftWidth: Vt, + borderRadius: Vt, + radius: Vt, + borderTopLeftRadius: Vt, + borderTopRightRadius: Vt, + borderBottomRightRadius: Vt, + borderBottomLeftRadius: Vt, + // Positioning props + width: Vt, + maxWidth: Vt, + height: Vt, + maxHeight: Vt, + top: Vt, + right: Vt, + bottom: Vt, + left: Vt, + // Spacing props + padding: Vt, + paddingTop: Vt, + paddingRight: Vt, + paddingBottom: Vt, + paddingLeft: Vt, + margin: Vt, + marginTop: Vt, + marginRight: Vt, + marginBottom: Vt, + marginLeft: Vt, + // Misc + backgroundPositionX: Vt, + backgroundPositionY: Vt +}, GY = { + rotate: To, + rotateX: To, + rotateY: To, + rotateZ: To, + scale: Ch, + scaleX: Ch, + scaleY: Ch, + scaleZ: Ch, + skew: To, + skewX: To, + skewY: To, + distance: Vt, + translateX: Vt, + translateY: Vt, + translateZ: Vt, + x: Vt, + y: Vt, + z: Vt, + perspective: Vt, + transformPerspective: Vt, + opacity: Uf, + originX: m6, + originY: m6, + originZ: Vt +}, _6 = { + ...eu, + transform: Math.round +}, tb = { + ...VY, + ...GY, + zIndex: _6, + size: Vt, + // SVG + fillOpacity: Uf, + strokeOpacity: Uf, + numOctaves: _6 +}, YY = { + ...tb, + // Color props + color: qn, + backgroundColor: qn, + outlineColor: qn, + fill: qn, + stroke: qn, + // Border props + borderColor: qn, + borderTopColor: qn, + borderRightColor: qn, + borderBottomColor: qn, + borderLeftColor: qn, + filter: Tv, + WebkitFilter: Tv +}, rb = (t) => YY[t]; +function XS(t, e) { + let r = rb(t); + return r !== Tv && (r = Yo), r.getAnimatableNone ? r.getAnimatableNone(e) : void 0; +} +const JY = /* @__PURE__ */ new Set(["auto", "none", "0"]); +function XY(t, e, r) { + let n = 0, i; + for (; n < t.length && !i; ) { + const s = t[n]; + typeof s == "string" && !JY.has(s) && qf(s).values.length && (i = t[n]), n++; + } + if (i && r) + for (const s of e) + t[s] = XS(r, i); +} +class ZS extends Z1 { + constructor(e, r, n, i, s) { + super(e, r, n, i, s, !0); + } + readKeyframes() { + const { unresolvedKeyframes: e, element: r, name: n } = this; + if (!r || !r.current) + return; + super.readKeyframes(); + for (let f = 0; f < e.length; f++) { + let u = e[f]; + if (typeof u == "string" && (u = u.trim(), X1(u))) { + const h = US(u, r.current); + h !== void 0 && (e[f] = h), f === e.length - 1 && (this.finalKeyframe = u); + } + } + if (this.resolveNoneKeyframes(), !MY.has(n) || e.length !== 2) + return; + const [i, s] = e, o = w6(i), a = w6(s); + if (o !== a) + if (v6(o) && v6(a)) + for (let f = 0; f < e.length; f++) { + const u = e[f]; + typeof u == "string" && (e[f] = parseFloat(u)); + } + else + this.needsMeasurement = !0; + } + resolveNoneKeyframes() { + const { unresolvedKeyframes: e, name: r } = this, n = []; + for (let i = 0; i < e.length; i++) + yY(e[i]) && n.push(i); + n.length && XY(e, n, r); + } + measureInitialState() { + const { element: e, unresolvedKeyframes: r, name: n } = this; + if (!e || !e.current) + return; + n === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = zc[n](e.measureViewportBox(), window.getComputedStyle(e.current)), r[0] = this.measuredOrigin; + const i = r[r.length - 1]; + i !== void 0 && e.getValue(n, i).jump(i, !1); + } + measureEndState() { + var e; + const { element: r, name: n, unresolvedKeyframes: i } = this; + if (!r || !r.current) + return; + const s = r.getValue(n); + s && s.jump(this.measuredOrigin, !1); + const o = i.length - 1, a = i[o]; + i[o] = zc[n](r.measureViewportBox(), window.getComputedStyle(r.current)), a !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = a), !((e = this.removedTransforms) === null || e === void 0) && e.length && this.removedTransforms.forEach(([f, u]) => { + r.getValue(f).set(u); + }), this.resolveNoneKeyframes(); + } +} +function nb(t) { + return typeof t == "function"; +} +let ed; +function ZY() { + ed = void 0; +} +const Ts = { + now: () => (ed === void 0 && Ts.set(Nn.isProcessing || hY.useManualTiming ? Nn.timestamp : performance.now()), ed), + set: (t) => { + ed = t, queueMicrotask(ZY); + } +}, E6 = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string +(Yo.test(t) || t === "0") && // And it contains numbers and/or colors +!t.startsWith("url(")); +function QY(t) { + const e = t[0]; + if (t.length === 1) + return !0; + for (let r = 0; r < t.length; r++) + if (t[r] !== e) + return !0; +} +function eJ(t, e, r, n) { + const i = t[0]; + if (i === null) + return !1; + if (e === "display" || e === "visibility") + return !0; + const s = t[t.length - 1], o = E6(i, e), a = E6(s, e); + return Qc(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : QY(t) || (r === "spring" || nb(r)) && n; +} +const tJ = 40; +class QS { + constructor({ autoplay: e = !0, delay: r = 0, type: n = "keyframes", repeat: i = 0, repeatDelay: s = 0, repeatType: o = "loop", ...a }) { + this.isStopped = !1, this.hasAttemptedResolve = !1, this.createdAt = Ts.now(), this.options = { + autoplay: e, + delay: r, + type: n, + repeat: i, + repeatDelay: s, + repeatType: o, + ...a + }, this.updateFinishedPromise(); + } + /** + * This method uses the createdAt and resolvedAt to calculate the + * animation startTime. *Ideally*, we would use the createdAt time as t=0 + * as the following frame would then be the first frame of the animation in + * progress, which would feel snappier. + * + * However, if there's a delay (main thread work) between the creation of + * the animation and the first commited frame, we prefer to use resolvedAt + * to avoid a sudden jump into the animation. + */ + calcStartTime() { + return this.resolvedAt ? this.resolvedAt - this.createdAt > tJ ? this.resolvedAt : this.createdAt : this.createdAt; + } + /** + * A getter for resolved data. If keyframes are not yet resolved, accessing + * this.resolved will synchronously flush all pending keyframe resolvers. + * This is a deoptimisation, but at its worst still batches read/writes. + */ + get resolved() { + return !this._resolved && !this.hasAttemptedResolve && DY(), this._resolved; + } + /** + * A method to be called when the keyframes resolver completes. This method + * will check if its possible to run the animation and, if not, skip it. + * Otherwise, it will call initPlayback on the implementing class. + */ + onKeyframesResolved(e, r) { + this.resolvedAt = Ts.now(), this.hasAttemptedResolve = !0; + const { name: n, type: i, velocity: s, delay: o, onComplete: a, onUpdate: f, isGenerator: u } = this.options; + if (!u && !eJ(e, n, i, s)) + if (o) + this.options.duration = 0; + else { + f?.(y0(e, this.options, r)), a?.(), this.resolveFinishedPromise(); + return; + } + const h = this.initPlayback(e, r); + h !== !1 && (this._resolved = { + keyframes: e, + finalKeyframe: r, + ...h + }, this.onPostResolved()); + } + onPostResolved() { + } + /** + * Allows the returned animation to be awaited or promise-chained. Currently + * resolves when the animation finishes at all but in a future update could/should + * reject if its cancels. + */ + then(e, r) { + return this.currentFinishedPromise.then(e, r); + } + flatten() { + this.options.type = "keyframes", this.options.ease = "linear"; + } + updateFinishedPromise() { + this.currentFinishedPromise = new Promise((e) => { + this.resolveFinishedPromise = e; + }); + } +} +function e7(t, e) { + return e ? t * (1e3 / e) : 0; +} +const rJ = 5; +function t7(t, e, r) { + const n = Math.max(e - rJ, 0); + return e7(r - t(n), e - n); +} +const wm = 1e-3, nJ = 0.01, S6 = 10, iJ = 0.05, sJ = 1; +function oJ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }) { + let i, s; + Qc(t <= Cs(S6), "Spring duration must be 10 seconds or less"); + let o = 1 - e; + o = Go(iJ, sJ, o), t = Go(nJ, S6, oo(t)), o < 1 ? (i = (u) => { + const h = u * o, g = h * t, v = h - r, x = Dv(u, o), S = Math.exp(-g); + return wm - v / x * S; + }, s = (u) => { + const g = u * o * t, v = g * r + r, x = Math.pow(o, 2) * Math.pow(u, 2) * t, S = Math.exp(-g), C = Dv(Math.pow(u, 2), o); + return (-i(u) + wm > 0 ? -1 : 1) * ((v - x) * S) / C; + }) : (i = (u) => { + const h = Math.exp(-u * t), g = (u - r) * t + 1; + return -wm + h * g; + }, s = (u) => { + const h = Math.exp(-u * t), g = (r - u) * (t * t); + return h * g; + }); + const a = 5 / t, f = cJ(i, s, a); + if (t = Cs(t), isNaN(f)) + return { + stiffness: 100, + damping: 10, + duration: t + }; + { + const u = Math.pow(f, 2) * n; + return { + stiffness: u, + damping: o * 2 * Math.sqrt(n * u), + duration: t + }; + } +} +const aJ = 12; +function cJ(t, e, r) { + let n = r; + for (let i = 1; i < aJ; i++) + n = n - t(n) / e(n); + return n; +} +function Dv(t, e) { + return t * Math.sqrt(1 - e * e); +} +const uJ = ["duration", "bounce"], fJ = ["stiffness", "damping", "mass"]; +function A6(t, e) { + return e.some((r) => t[r] !== void 0); +} +function lJ(t) { + let e = { + velocity: 0, + stiffness: 100, + damping: 10, + mass: 1, + isResolvedFromDuration: !1, + ...t + }; + if (!A6(t, fJ) && A6(t, uJ)) { + const r = oJ(t); + e = { + ...e, + ...r, + mass: 1 + }, e.isResolvedFromDuration = !0; + } + return e; +} +function r7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { + const i = t[0], s = t[t.length - 1], o = { done: !1, value: i }, { stiffness: a, damping: f, mass: u, duration: h, velocity: g, isResolvedFromDuration: v } = lJ({ + ...n, + velocity: -oo(n.velocity || 0) + }), x = g || 0, S = f / (2 * Math.sqrt(a * u)), C = s - i, D = oo(Math.sqrt(a / u)), $ = Math.abs(C) < 5; + r || (r = $ ? 0.01 : 2), e || (e = $ ? 5e-3 : 0.5); + let N; + if (S < 1) { + const z = Dv(D, S); + N = (k) => { + const B = Math.exp(-S * D * k); + return s - B * ((x + S * D * C) / z * Math.sin(z * k) + C * Math.cos(z * k)); + }; + } else if (S === 1) + N = (z) => s - Math.exp(-D * z) * (C + (x + D * C) * z); + else { + const z = D * Math.sqrt(S * S - 1); + N = (k) => { + const B = Math.exp(-S * D * k), U = Math.min(z * k, 300); + return s - B * ((x + S * D * C) * Math.sinh(U) + z * C * Math.cosh(U)) / z; + }; + } + return { + calculatedDuration: v && h || null, + next: (z) => { + const k = N(z); + if (v) + o.done = z >= h; + else { + let B = 0; + S < 1 && (B = z === 0 ? Cs(x) : t7(N, z, k)); + const U = Math.abs(B) <= r, R = Math.abs(s - k) <= e; + o.done = U && R; + } + return o.value = o.done ? s : k, o; + } + }; +} +function P6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: f, restDelta: u = 0.5, restSpeed: h }) { + const g = t[0], v = { + done: !1, + value: g + }, x = (W) => a !== void 0 && W < a || f !== void 0 && W > f, S = (W) => a === void 0 ? f : f === void 0 || Math.abs(a - W) < Math.abs(f - W) ? a : f; + let C = r * e; + const D = g + C, $ = o === void 0 ? D : o(D); + $ !== D && (C = $ - g); + const N = (W) => -C * Math.exp(-W / n), z = (W) => $ + N(W), k = (W) => { + const J = N(W), ne = z(W); + v.done = Math.abs(J) <= u, v.value = v.done ? $ : ne; + }; + let B, U; + const R = (W) => { + x(v.value) && (B = W, U = r7({ + keyframes: [v.value, S(v.value)], + velocity: t7(z, W, v.value), + // TODO: This should be passing * 1000 + damping: i, + stiffness: s, + restDelta: u, + restSpeed: h + })); + }; + return R(0), { + calculatedDuration: null, + next: (W) => { + let J = !1; + return !U && B === void 0 && (J = !0, k(W), R(W)), B !== void 0 && W >= B ? U.next(W - B) : (!J && k(W), v); + } + }; +} +const hJ = /* @__PURE__ */ pl(0.42, 0, 1, 1), dJ = /* @__PURE__ */ pl(0, 0, 0.58, 1), n7 = /* @__PURE__ */ pl(0.42, 0, 0.58, 1), pJ = (t) => Array.isArray(t) && typeof t[0] != "number", ib = (t) => Array.isArray(t) && typeof t[0] == "number", M6 = { + linear: kn, + easeIn: hJ, + easeInOut: n7, + easeOut: dJ, + circIn: J1, + circInOut: kS, + circOut: LS, + backIn: Y1, + backInOut: OS, + backOut: DS, + anticipate: NS +}, I6 = (t) => { + if (ib(t)) { + po(t.length === 4, "Cubic bezier arrays must contain four numerical values."); + const [e, r, n, i] = t; + return pl(e, r, n, i); + } else if (typeof t == "string") + return po(M6[t] !== void 0, `Invalid easing type '${t}'`), M6[t]; + return t; +}, gJ = (t, e) => (r) => e(t(r)), ao = (...t) => t.reduce(gJ), Hc = (t, e, r) => { + const n = e - t; + return n === 0 ? 1 : (r - t) / n; +}, Qr = (t, e, r) => t + (e - t) * r; +function xm(t, e, r) { + return r < 0 && (r += 1), r > 1 && (r -= 1), r < 1 / 6 ? t + (e - t) * 6 * r : r < 1 / 2 ? e : r < 2 / 3 ? t + (e - t) * (2 / 3 - r) * 6 : t; +} +function mJ({ hue: t, saturation: e, lightness: r, alpha: n }) { + t /= 360, e /= 100, r /= 100; + let i = 0, s = 0, o = 0; + if (!e) + i = s = o = r; + else { + const a = r < 0.5 ? r * (1 + e) : r + e - r * e, f = 2 * r - a; + i = xm(f, a, t + 1 / 3), s = xm(f, a, t), o = xm(f, a, t - 1 / 3); + } + return { + red: Math.round(i * 255), + green: Math.round(s * 255), + blue: Math.round(o * 255), + alpha: n + }; +} +function Id(t, e) { + return (r) => r > 0 ? e : t; +} +const _m = (t, e, r) => { + const n = t * t, i = r * (e * e - n) + n; + return i < 0 ? 0 : Math.sqrt(i); +}, vJ = [Rv, Ca, _c], bJ = (t) => vJ.find((e) => e.test(t)); +function C6(t) { + const e = bJ(t); + if (Qc(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e) + return !1; + let r = e.parse(t); + return e === _c && (r = mJ(r)), r; +} +const R6 = (t, e) => { + const r = C6(t), n = C6(e); + if (!r || !n) + return Id(t, e); + const i = { ...r }; + return (s) => (i.red = _m(r.red, n.red, s), i.green = _m(r.green, n.green, s), i.blue = _m(r.blue, n.blue, s), i.alpha = Qr(r.alpha, n.alpha, s), Ca.transform(i)); +}, Ov = /* @__PURE__ */ new Set(["none", "hidden"]); +function yJ(t, e) { + return Ov.has(t) ? (r) => r <= 0 ? t : e : (r) => r >= 1 ? e : t; +} +function wJ(t, e) { + return (r) => Qr(t, e, r); +} +function sb(t) { + return typeof t == "number" ? wJ : typeof t == "string" ? X1(t) ? Id : qn.test(t) ? R6 : EJ : Array.isArray(t) ? i7 : typeof t == "object" ? qn.test(t) ? R6 : xJ : Id; +} +function i7(t, e) { + const r = [...t], n = r.length, i = t.map((s, o) => sb(s)(s, e[o])); + return (s) => { + for (let o = 0; o < n; o++) + r[o] = i[o](s); + return r; + }; +} +function xJ(t, e) { + const r = { ...t, ...e }, n = {}; + for (const i in r) + t[i] !== void 0 && e[i] !== void 0 && (n[i] = sb(t[i])(t[i], e[i])); + return (i) => { + for (const s in n) + r[s] = n[s](i); + return r; + }; +} +function _J(t, e) { + var r; + const n = [], i = { color: 0, var: 0, number: 0 }; + for (let s = 0; s < e.values.length; s++) { + const o = e.types[s], a = t.indexes[o][i[o]], f = (r = t.values[a]) !== null && r !== void 0 ? r : 0; + n[s] = f, i[o]++; + } + return n; +} +const EJ = (t, e) => { + const r = Yo.createTransformer(e), n = qf(t), i = qf(e); + return n.indexes.var.length === i.indexes.var.length && n.indexes.color.length === i.indexes.color.length && n.indexes.number.length >= i.indexes.number.length ? Ov.has(t) && !i.values.length || Ov.has(e) && !n.values.length ? yJ(t, e) : ao(i7(_J(n, i), i.values), r) : (Qc(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), Id(t, e)); +}; +function s7(t, e, r) { + return typeof t == "number" && typeof e == "number" && typeof r == "number" ? Qr(t, e, r) : sb(t)(t, e); +} +function SJ(t, e, r) { + const n = [], i = r || s7, s = t.length - 1; + for (let o = 0; o < s; o++) { + let a = i(t[o], t[o + 1]); + if (e) { + const f = Array.isArray(e) ? e[o] || kn : e; + a = ao(f, a); + } + n.push(a); + } + return n; +} +function AJ(t, e, { clamp: r = !0, ease: n, mixer: i } = {}) { + const s = t.length; + if (po(s === e.length, "Both input and output ranges must be the same length"), s === 1) + return () => e[0]; + if (s === 2 && t[0] === t[1]) + return () => e[1]; + t[0] > t[s - 1] && (t = [...t].reverse(), e = [...e].reverse()); + const o = SJ(e, n, i), a = o.length, f = (u) => { + let h = 0; + if (a > 1) + for (; h < t.length - 2 && !(u < t[h + 1]); h++) + ; + const g = Hc(t[h], t[h + 1], u); + return o[h](g); + }; + return r ? (u) => f(Go(t[0], t[s - 1], u)) : f; +} +function PJ(t, e) { + const r = t[t.length - 1]; + for (let n = 1; n <= e; n++) { + const i = Hc(0, e, n); + t.push(Qr(r, 1, i)); + } +} +function MJ(t) { + const e = [0]; + return PJ(e, t.length - 1), e; +} +function IJ(t, e) { + return t.map((r) => r * e); +} +function CJ(t, e) { + return t.map(() => e || n7).splice(0, t.length - 1); +} +function Cd({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" }) { + const i = pJ(n) ? n.map(I6) : I6(n), s = { + done: !1, + value: e[0] + }, o = IJ( + // Only use the provided offsets if they're the correct length + // TODO Maybe we should warn here if there's a length mismatch + r && r.length === e.length ? r : MJ(e), + t + ), a = AJ(o, e, { + ease: Array.isArray(i) ? i : CJ(e, i) + }); + return { + calculatedDuration: t, + next: (f) => (s.value = a(f), s.done = f >= t, s) + }; +} +const T6 = 2e4; +function RJ(t) { + let e = 0; + const r = 50; + let n = t.next(e); + for (; !n.done && e < T6; ) + e += r, n = t.next(e); + return e >= T6 ? 1 / 0 : e; +} +const TJ = (t) => { + const e = ({ timestamp: r }) => t(r); + return { + start: () => kr.update(e, !0), + stop: () => Vo(e), + /** + * If we're processing this frame we can use the + * framelocked timestamp to keep things in sync. + */ + now: () => Nn.isProcessing ? Nn.timestamp : Ts.now() + }; +}, DJ = { + decay: P6, + inertia: P6, + tween: Cd, + keyframes: Cd, + spring: r7 +}, OJ = (t) => t / 100; +class ob extends QS { + constructor(e) { + super(e), this.holdTime = null, this.cancelTime = null, this.currentTime = 0, this.playbackSpeed = 1, this.pendingPlayState = "running", this.startTime = null, this.state = "idle", this.stop = () => { + if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle") + return; + this.teardown(); + const { onStop: f } = this.options; + f && f(); + }; + const { name: r, motionValue: n, element: i, keyframes: s } = this.options, o = i?.KeyframeResolver || Z1, a = (f, u) => this.onKeyframesResolved(f, u); + this.resolver = new o(s, a, r, n, i), this.resolver.scheduleResolve(); + } + flatten() { + super.flatten(), this._resolved && Object.assign(this._resolved, this.initPlayback(this._resolved.keyframes)); + } + initPlayback(e) { + const { type: r = "keyframes", repeat: n = 0, repeatDelay: i = 0, repeatType: s, velocity: o = 0 } = this.options, a = nb(r) ? r : DJ[r] || Cd; + let f, u; + a !== Cd && typeof e[0] != "number" && (process.env.NODE_ENV !== "production" && po(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), f = ao(OJ, s7(e[0], e[1])), e = [0, 100]); + const h = a({ ...this.options, keyframes: e }); + s === "mirror" && (u = a({ + ...this.options, + keyframes: [...e].reverse(), + velocity: -o + })), h.calculatedDuration === null && (h.calculatedDuration = RJ(h)); + const { calculatedDuration: g } = h, v = g + i, x = v * (n + 1) - i; + return { + generator: h, + mirroredGenerator: u, + mapPercentToKeyframes: f, + calculatedDuration: g, + resolvedDuration: v, + totalDuration: x + }; + } + onPostResolved() { + const { autoplay: e = !0 } = this.options; + this.play(), this.pendingPlayState === "paused" || !e ? this.pause() : this.state = this.pendingPlayState; + } + tick(e, r = !1) { + const { resolved: n } = this; + if (!n) { + const { keyframes: W } = this.options; + return { done: !0, value: W[W.length - 1] }; + } + const { finalKeyframe: i, generator: s, mirroredGenerator: o, mapPercentToKeyframes: a, keyframes: f, calculatedDuration: u, totalDuration: h, resolvedDuration: g } = n; + if (this.startTime === null) + return s.next(0); + const { delay: v, repeat: x, repeatType: S, repeatDelay: C, onUpdate: D } = this.options; + this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - h / this.speed, this.startTime)), r ? this.currentTime = e : this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = Math.round(e - this.startTime) * this.speed; + const $ = this.currentTime - v * (this.speed >= 0 ? 1 : -1), N = this.speed >= 0 ? $ < 0 : $ > h; + this.currentTime = Math.max($, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = h); + let z = this.currentTime, k = s; + if (x) { + const W = Math.min(this.currentTime, h) / g; + let J = Math.floor(W), ne = W % 1; + !ne && W >= 1 && (ne = 1), ne === 1 && J--, J = Math.min(J, x + 1), !!(J % 2) && (S === "reverse" ? (ne = 1 - ne, C && (ne -= C / g)) : S === "mirror" && (k = o)), z = Go(0, 1, ne) * g; + } + const B = N ? { done: !1, value: f[0] } : k.next(z); + a && (B.value = a(B.value)); + let { done: U } = B; + !N && u !== null && (U = this.speed >= 0 ? this.currentTime >= h : this.currentTime <= 0); + const R = this.holdTime === null && (this.state === "finished" || this.state === "running" && U); + return R && i !== void 0 && (B.value = y0(f, this.options, i)), D && D(B.value), R && this.finish(), B; + } + get duration() { + const { resolved: e } = this; + return e ? oo(e.calculatedDuration) : 0; + } + get time() { + return oo(this.currentTime); + } + set time(e) { + e = Cs(e), this.currentTime = e, this.holdTime !== null || this.speed === 0 ? this.holdTime = e : this.driver && (this.startTime = this.driver.now() - e / this.speed); + } + get speed() { + return this.playbackSpeed; + } + set speed(e) { + const r = this.playbackSpeed !== e; + this.playbackSpeed = e, r && (this.time = oo(this.currentTime)); + } + play() { + if (this.resolver.isScheduled || this.resolver.resume(), !this._resolved) { + this.pendingPlayState = "running"; + return; + } + if (this.isStopped) + return; + const { driver: e = TJ, onPlay: r, startTime: n } = this.options; + this.driver || (this.driver = e((s) => this.tick(s))), r && r(); + const i = this.driver.now(); + this.holdTime !== null ? this.startTime = i - this.holdTime : this.startTime ? this.state === "finished" && (this.startTime = i) : this.startTime = n ?? this.calcStartTime(), this.state === "finished" && this.updateFinishedPromise(), this.cancelTime = this.startTime, this.holdTime = null, this.state = "running", this.driver.start(); + } + pause() { + var e; + if (!this._resolved) { + this.pendingPlayState = "paused"; + return; + } + this.state = "paused", this.holdTime = (e = this.currentTime) !== null && e !== void 0 ? e : 0; + } + complete() { + this.state !== "running" && this.play(), this.pendingPlayState = this.state = "finished", this.holdTime = null; + } + finish() { + this.teardown(), this.state = "finished"; + const { onComplete: e } = this.options; + e && e(); + } + cancel() { + this.cancelTime !== null && this.tick(this.cancelTime), this.teardown(), this.updateFinishedPromise(); + } + teardown() { + this.state = "idle", this.stopDriver(), this.resolveFinishedPromise(), this.updateFinishedPromise(), this.startTime = this.cancelTime = null, this.resolver.cancel(); + } + stopDriver() { + this.driver && (this.driver.stop(), this.driver = void 0); + } + sample(e) { + return this.startTime = 0, this.tick(e, !0); + } +} +const NJ = /* @__PURE__ */ new Set([ + "opacity", + "clipPath", + "filter", + "transform" + // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved + // or until we implement support for linear() easing. + // "background-color" +]), LJ = 10, kJ = (t, e) => { + let r = ""; + const n = Math.max(Math.round(e / LJ), 2); + for (let i = 0; i < n; i++) + r += t(Hc(0, n - 1, i)) + ", "; + return `linear(${r.substring(0, r.length - 2)})`; +}; +function ab(t) { + let e; + return () => (e === void 0 && (e = t()), e); +} +const $J = { + linearEasing: void 0 +}; +function BJ(t, e) { + const r = ab(t); + return () => { + var n; + return (n = $J[e]) !== null && n !== void 0 ? n : r(); + }; +} +const Rd = /* @__PURE__ */ BJ(() => { + try { + document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" }); + } catch { + return !1; + } + return !0; +}, "linearEasing"); +function o7(t) { + return !!(typeof t == "function" && Rd() || !t || typeof t == "string" && (t in Nv || Rd()) || ib(t) || Array.isArray(t) && t.every(o7)); +} +const Zu = ([t, e, r, n]) => `cubic-bezier(${t}, ${e}, ${r}, ${n})`, Nv = { + linear: "linear", + ease: "ease", + easeIn: "ease-in", + easeOut: "ease-out", + easeInOut: "ease-in-out", + circIn: /* @__PURE__ */ Zu([0, 0.65, 0.55, 1]), + circOut: /* @__PURE__ */ Zu([0.55, 0, 1, 0.45]), + backIn: /* @__PURE__ */ Zu([0.31, 0.01, 0.66, -0.59]), + backOut: /* @__PURE__ */ Zu([0.33, 1.53, 0.69, 0.99]) +}; +function a7(t, e) { + if (t) + return typeof t == "function" && Rd() ? kJ(t, e) : ib(t) ? Zu(t) : Array.isArray(t) ? t.map((r) => a7(r, e) || Nv.easeOut) : Nv[t]; +} +function FJ(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatType: o = "loop", ease: a = "easeInOut", times: f } = {}) { + const u = { [e]: r }; + f && (u.offset = f); + const h = a7(a, i); + return Array.isArray(h) && (u.easing = h), t.animate(u, { + delay: n, + duration: i, + easing: Array.isArray(h) ? "linear" : h, + fill: "both", + iterations: s + 1, + direction: o === "reverse" ? "alternate" : "normal" + }); +} +function D6(t, e) { + t.timeline = e, t.onfinish = null; +} +const jJ = /* @__PURE__ */ ab(() => Object.hasOwnProperty.call(Element.prototype, "animate")), Td = 10, UJ = 2e4; +function qJ(t) { + return nb(t.type) || t.type === "spring" || !o7(t.ease); +} +function zJ(t, e) { + const r = new ob({ + ...e, + keyframes: t, + repeat: 0, + delay: 0, + isGenerator: !0 + }); + let n = { done: !1, value: t[0] }; + const i = []; + let s = 0; + for (; !n.done && s < UJ; ) + n = r.sample(s), i.push(n.value), s += Td; + return { + times: void 0, + keyframes: i, + duration: s - Td, + ease: "linear" + }; +} +const c7 = { + anticipate: NS, + backInOut: OS, + circInOut: kS +}; +function HJ(t) { + return t in c7; +} +class O6 extends QS { + constructor(e) { + super(e); + const { name: r, motionValue: n, element: i, keyframes: s } = this.options; + this.resolver = new ZS(s, (o, a) => this.onKeyframesResolved(o, a), r, n, i), this.resolver.scheduleResolve(); + } + initPlayback(e, r) { + var n; + let { duration: i = 300, times: s, ease: o, type: a, motionValue: f, name: u, startTime: h } = this.options; + if (!(!((n = f.owner) === null || n === void 0) && n.current)) + return !1; + if (typeof o == "string" && Rd() && HJ(o) && (o = c7[o]), qJ(this.options)) { + const { onComplete: v, onUpdate: x, motionValue: S, element: C, ...D } = this.options, $ = zJ(e, D); + e = $.keyframes, e.length === 1 && (e[1] = e[0]), i = $.duration, s = $.times, o = $.ease, a = "keyframes"; + } + const g = FJ(f.owner.current, u, e, { ...this.options, duration: i, times: s, ease: o }); + return g.startTime = h ?? this.calcStartTime(), this.pendingTimeline ? (D6(g, this.pendingTimeline), this.pendingTimeline = void 0) : g.onfinish = () => { + const { onComplete: v } = this.options; + f.set(y0(e, this.options, r)), v && v(), this.cancel(), this.resolveFinishedPromise(); + }, { + animation: g, + duration: i, + times: s, + type: a, + ease: o, + keyframes: e + }; + } + get duration() { + const { resolved: e } = this; + if (!e) + return 0; + const { duration: r } = e; + return oo(r); + } + get time() { + const { resolved: e } = this; + if (!e) + return 0; + const { animation: r } = e; + return oo(r.currentTime || 0); + } + set time(e) { + const { resolved: r } = this; + if (!r) + return; + const { animation: n } = r; + n.currentTime = Cs(e); + } + get speed() { + const { resolved: e } = this; + if (!e) + return 1; + const { animation: r } = e; + return r.playbackRate; + } + set speed(e) { + const { resolved: r } = this; + if (!r) + return; + const { animation: n } = r; + n.playbackRate = e; + } + get state() { + const { resolved: e } = this; + if (!e) + return "idle"; + const { animation: r } = e; + return r.playState; + } + get startTime() { + const { resolved: e } = this; + if (!e) + return null; + const { animation: r } = e; + return r.startTime; + } + /** + * Replace the default DocumentTimeline with another AnimationTimeline. + * Currently used for scroll animations. + */ + attachTimeline(e) { + if (!this._resolved) + this.pendingTimeline = e; + else { + const { resolved: r } = this; + if (!r) + return kn; + const { animation: n } = r; + D6(n, e); + } + return kn; + } + play() { + if (this.isStopped) + return; + const { resolved: e } = this; + if (!e) + return; + const { animation: r } = e; + r.playState === "finished" && this.updateFinishedPromise(), r.play(); + } + pause() { + const { resolved: e } = this; + if (!e) + return; + const { animation: r } = e; + r.pause(); + } + stop() { + if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle") + return; + this.resolveFinishedPromise(), this.updateFinishedPromise(); + const { resolved: e } = this; + if (!e) + return; + const { animation: r, keyframes: n, duration: i, type: s, ease: o, times: a } = e; + if (r.playState === "idle" || r.playState === "finished") + return; + if (this.time) { + const { motionValue: u, onUpdate: h, onComplete: g, element: v, ...x } = this.options, S = new ob({ + ...x, + keyframes: n, + duration: i, + type: s, + ease: o, + times: a, + isGenerator: !0 + }), C = Cs(this.time); + u.setWithVelocity(S.sample(C - Td).value, S.sample(C).value, Td); + } + const { onStop: f } = this.options; + f && f(), this.cancel(); + } + complete() { + const { resolved: e } = this; + e && e.animation.finish(); + } + cancel() { + const { resolved: e } = this; + e && e.animation.cancel(); + } + static supports(e) { + const { motionValue: r, name: n, repeatDelay: i, repeatType: s, damping: o, type: a } = e; + return jJ() && n && NJ.has(n) && r && r.owner && r.owner.current instanceof HTMLElement && /** + * If we're outputting values to onUpdate then we can't use WAAPI as there's + * no way to read the value from WAAPI every frame. + */ + !r.owner.getProps().onUpdate && !i && s !== "mirror" && o !== 0 && a !== "inertia"; + } +} +const WJ = ab(() => window.ScrollTimeline !== void 0); +class KJ { + constructor(e) { + this.stop = () => this.runAll("stop"), this.animations = e.filter(Boolean); + } + then(e, r) { + return Promise.all(this.animations).then(e).catch(r); + } + /** + * TODO: Filter out cancelled or stopped animations before returning + */ + getAll(e) { + return this.animations[0][e]; + } + setAll(e, r) { + for (let n = 0; n < this.animations.length; n++) + this.animations[n][e] = r; + } + attachTimeline(e, r) { + const n = this.animations.map((i) => WJ() && i.attachTimeline ? i.attachTimeline(e) : r(i)); + return () => { + n.forEach((i, s) => { + i && i(), this.animations[s].stop(); + }); + }; + } + get time() { + return this.getAll("time"); + } + set time(e) { + this.setAll("time", e); + } + get speed() { + return this.getAll("speed"); + } + set speed(e) { + this.setAll("speed", e); + } + get startTime() { + return this.getAll("startTime"); + } + get duration() { + let e = 0; + for (let r = 0; r < this.animations.length; r++) + e = Math.max(e, this.animations[r].duration); + return e; + } + runAll(e) { + this.animations.forEach((r) => r[e]()); + } + flatten() { + this.runAll("flatten"); + } + play() { + this.runAll("play"); + } + pause() { + this.runAll("pause"); + } + cancel() { + this.runAll("cancel"); + } + complete() { + this.runAll("complete"); + } +} +function VJ({ when: t, delay: e, delayChildren: r, staggerChildren: n, staggerDirection: i, repeat: s, repeatType: o, repeatDelay: a, from: f, elapsed: u, ...h }) { + return !!Object.keys(h).length; +} +const cb = (t, e, r, n = {}, i, s) => (o) => { + const a = G1(n, t) || {}, f = a.delay || n.delay || 0; + let { elapsed: u = 0 } = n; + u = u - Cs(f); + let h = { + keyframes: Array.isArray(r) ? r : [null, r], + ease: "easeOut", + velocity: e.getVelocity(), + ...a, + delay: -u, + onUpdate: (v) => { + e.set(v), a.onUpdate && a.onUpdate(v); + }, + onComplete: () => { + o(), a.onComplete && a.onComplete(); + }, + name: t, + motionValue: e, + element: s ? void 0 : i + }; + VJ(a) || (h = { + ...h, + ...lY(t, h) + }), h.duration && (h.duration = Cs(h.duration)), h.repeatDelay && (h.repeatDelay = Cs(h.repeatDelay)), h.from !== void 0 && (h.keyframes[0] = h.from); + let g = !1; + if ((h.type === !1 || h.duration === 0 && !h.repeatDelay) && (h.duration = 0, h.delay === 0 && (g = !0)), g && !s && e.get() !== void 0) { + const v = y0(h.keyframes, a); + if (v !== void 0) + return kr.update(() => { + h.onUpdate(v), h.onComplete(); + }), new KJ([]); + } + return !s && O6.supports(h) ? new O6(h) : new ob(h); +}, GJ = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), YJ = (t) => Mv(t) ? t[t.length - 1] || 0 : t; +function ub(t, e) { + t.indexOf(e) === -1 && t.push(e); +} +function fb(t, e) { + const r = t.indexOf(e); + r > -1 && t.splice(r, 1); +} +class lb { + constructor() { + this.subscriptions = []; + } + add(e) { + return ub(this.subscriptions, e), () => fb(this.subscriptions, e); + } + notify(e, r, n) { + const i = this.subscriptions.length; + if (i) + if (i === 1) + this.subscriptions[0](e, r, n); + else + for (let s = 0; s < i; s++) { + const o = this.subscriptions[s]; + o && o(e, r, n); + } + } + getSize() { + return this.subscriptions.length; + } + clear() { + this.subscriptions.length = 0; + } +} +const N6 = 30, JJ = (t) => !isNaN(parseFloat(t)); +class XJ { + /** + * @param init - The initiating value + * @param config - Optional configuration options + * + * - `transformer`: A function to transform incoming values with. + * + * @internal + */ + constructor(e, r = {}) { + this.version = "11.11.17", this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (n, i = !0) => { + const s = Ts.now(); + this.updatedAt !== s && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(n), this.current !== this.prev && this.events.change && this.events.change.notify(this.current), i && this.events.renderRequest && this.events.renderRequest.notify(this.current); + }, this.hasAnimated = !1, this.setCurrent(e), this.owner = r.owner; + } + setCurrent(e) { + this.current = e, this.updatedAt = Ts.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = JJ(this.current)); + } + setPrevFrameValue(e = this.current) { + this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt; + } + /** + * Adds a function that will be notified when the `MotionValue` is updated. + * + * It returns a function that, when called, will cancel the subscription. + * + * When calling `onChange` inside a React component, it should be wrapped with the + * `useEffect` hook. As it returns an unsubscribe function, this should be returned + * from the `useEffect` function to ensure you don't add duplicate subscribers.. + * + * ```jsx + * export const MyComponent = () => { + * const x = useMotionValue(0) + * const y = useMotionValue(0) + * const opacity = useMotionValue(1) + * + * useEffect(() => { + * function updateOpacity() { + * const maxXY = Math.max(x.get(), y.get()) + * const newOpacity = transform(maxXY, [0, 100], [1, 0]) + * opacity.set(newOpacity) + * } + * + * const unsubscribeX = x.on("change", updateOpacity) + * const unsubscribeY = y.on("change", updateOpacity) + * + * return () => { + * unsubscribeX() + * unsubscribeY() + * } + * }, []) + * + * return + * } + * ``` + * + * @param subscriber - A function that receives the latest value. + * @returns A function that, when called, will cancel this subscription. + * + * @deprecated + */ + onChange(e) { + return process.env.NODE_ENV !== "production" && m0(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e); + } + on(e, r) { + this.events[e] || (this.events[e] = new lb()); + const n = this.events[e].add(r); + return e === "change" ? () => { + n(), kr.read(() => { + this.events.change.getSize() || this.stop(); + }); + } : n; + } + clearListeners() { + for (const e in this.events) + this.events[e].clear(); + } + /** + * Attaches a passive effect to the `MotionValue`. + * + * @internal + */ + attach(e, r) { + this.passiveEffect = e, this.stopPassiveEffect = r; + } + /** + * Sets the state of the `MotionValue`. + * + * @remarks + * + * ```jsx + * const x = useMotionValue(0) + * x.set(10) + * ``` + * + * @param latest - Latest value to set. + * @param render - Whether to notify render subscribers. Defaults to `true` + * + * @public + */ + set(e, r = !0) { + !r || !this.passiveEffect ? this.updateAndNotify(e, r) : this.passiveEffect(e, this.updateAndNotify); + } + setWithVelocity(e, r, n) { + this.set(r), this.prev = void 0, this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt - n; + } + /** + * Set the state of the `MotionValue`, stopping any active animations, + * effects, and resets velocity to `0`. + */ + jump(e, r = !0) { + this.updateAndNotify(e), this.prev = e, this.prevUpdatedAt = this.prevFrameValue = void 0, r && this.stop(), this.stopPassiveEffect && this.stopPassiveEffect(); + } + /** + * Returns the latest state of `MotionValue` + * + * @returns - The latest state of `MotionValue` + * + * @public + */ + get() { + return this.current; + } + /** + * @public + */ + getPrevious() { + return this.prev; + } + /** + * Returns the latest velocity of `MotionValue` + * + * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical. + * + * @public + */ + getVelocity() { + const e = Ts.now(); + if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > N6) + return 0; + const r = Math.min(this.updatedAt - this.prevUpdatedAt, N6); + return e7(parseFloat(this.current) - parseFloat(this.prevFrameValue), r); + } + /** + * Registers a new animation to control this `MotionValue`. Only one + * animation can drive a `MotionValue` at one time. + * + * ```jsx + * value.start() + * ``` + * + * @param animation - A function that starts the provided animation + * + * @internal + */ + start(e) { + return this.stop(), new Promise((r) => { + this.hasAnimated = !0, this.animation = e(r), this.events.animationStart && this.events.animationStart.notify(); + }).then(() => { + this.events.animationComplete && this.events.animationComplete.notify(), this.clearAnimation(); + }); + } + /** + * Stop the currently active animation. + * + * @public + */ + stop() { + this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation(); + } + /** + * Returns `true` if this value is currently animating. + * + * @public + */ + isAnimating() { + return !!this.animation; + } + clearAnimation() { + delete this.animation; + } + /** + * Destroy and clean up subscribers to this `MotionValue`. + * + * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically + * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually + * created a `MotionValue` via the `motionValue` function. + * + * @public + */ + destroy() { + this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect(); + } +} +function zf(t, e) { + return new XJ(t, e); +} +function ZJ(t, e, r) { + t.hasValue(e) ? t.getValue(e).set(r) : t.addValue(e, zf(r)); +} +function QJ(t, e) { + const r = b0(t, e); + let { transitionEnd: n = {}, transition: i = {}, ...s } = r || {}; + s = { ...s, ...n }; + for (const o in s) { + const a = YJ(s[o]); + ZJ(t, o, a); + } +} +const hb = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), eX = "framerAppearId", u7 = "data-" + hb(eX); +function f7(t) { + return t.props[u7]; +} +const Wn = (t) => !!(t && t.getVelocity); +function tX(t) { + return !!(Wn(t) && t.add); +} +function Lv(t, e) { + const r = t.getValue("willChange"); + if (tX(r)) + return r.add(e); +} +function rX({ protectedKeys: t, needsAnimating: e }, r) { + const n = t.hasOwnProperty(r) && e[r] !== !0; + return e[r] = !1, n; +} +function l7(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { + var s; + let { transition: o = t.getDefaultTransition(), transitionEnd: a, ...f } = e; + n && (o = n); + const u = [], h = i && t.animationState && t.animationState.getState()[i]; + for (const g in f) { + const v = t.getValue(g, (s = t.latestValues[g]) !== null && s !== void 0 ? s : null), x = f[g]; + if (x === void 0 || h && rX(h, g)) + continue; + const S = { + delay: r, + ...G1(o || {}, g) + }; + let C = !1; + if (window.MotionHandoffAnimation) { + const $ = f7(t); + if ($) { + const N = window.MotionHandoffAnimation($, g, kr); + N !== null && (S.startTime = N, C = !0); + } + } + Lv(t, g), v.start(cb(g, v, x, t.shouldReduceMotion && Ya.has(g) ? { type: !1 } : S, t, C)); + const D = v.animation; + D && u.push(D); + } + return a && Promise.all(u).then(() => { + kr.update(() => { + a && QJ(t, a); + }); + }), u; +} +function kv(t, e, r = {}) { + var n; + const i = b0(t, e, r.type === "exit" ? (n = t.presenceContext) === null || n === void 0 ? void 0 : n.custom : void 0); + let { transition: s = t.getDefaultTransition() || {} } = i || {}; + r.transitionOverride && (s = r.transitionOverride); + const o = i ? () => Promise.all(l7(t, i, r)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (u = 0) => { + const { delayChildren: h = 0, staggerChildren: g, staggerDirection: v } = s; + return nX(t, e, h + u, g, v, r); + } : () => Promise.resolve(), { when: f } = s; + if (f) { + const [u, h] = f === "beforeChildren" ? [o, a] : [a, o]; + return u().then(() => h()); + } else + return Promise.all([o(), a(r.delay)]); +} +function nX(t, e, r = 0, n = 0, i = 1, s) { + const o = [], a = (t.variantChildren.size - 1) * n, f = i === 1 ? (u = 0) => u * n : (u = 0) => a - u * n; + return Array.from(t.variantChildren).sort(iX).forEach((u, h) => { + u.notify("AnimationStart", e), o.push(kv(u, e, { + ...s, + delay: r + f(h) + }).then(() => u.notify("AnimationComplete", e))); + }), Promise.all(o); +} +function iX(t, e) { + return t.sortNodePosition(e); +} +function sX(t, e, r = {}) { + t.notify("AnimationStart", e); + let n; + if (Array.isArray(e)) { + const i = e.map((s) => kv(t, s, r)); + n = Promise.all(i); + } else if (typeof e == "string") + n = kv(t, e, r); + else { + const i = typeof e == "function" ? b0(t, e, r.custom) : e; + n = Promise.all(l7(t, i, r)); + } + return n.then(() => { + t.notify("AnimationComplete", e); + }); +} +const oX = V1.length; +function h7(t) { + if (!t) + return; + if (!t.isControllingVariants) { + const r = t.parent ? h7(t.parent) || {} : {}; + return t.props.initial !== void 0 && (r.initial = t.props.initial), r; + } + const e = {}; + for (let r = 0; r < oX; r++) { + const n = V1[r], i = t.props[n]; + (jf(i) || i === !1) && (e[n] = i); + } + return e; +} +const aX = [...K1].reverse(), cX = K1.length; +function uX(t) { + return (e) => Promise.all(e.map(({ animation: r, options: n }) => sX(t, r, n))); +} +function fX(t) { + let e = uX(t), r = L6(), n = !0; + const i = (f) => (u, h) => { + var g; + const v = b0(t, h, f === "exit" ? (g = t.presenceContext) === null || g === void 0 ? void 0 : g.custom : void 0); + if (v) { + const { transition: x, transitionEnd: S, ...C } = v; + u = { ...u, ...C, ...S }; + } + return u; + }; + function s(f) { + e = f(t); + } + function o(f) { + const { props: u } = t, h = h7(t.parent) || {}, g = [], v = /* @__PURE__ */ new Set(); + let x = {}, S = 1 / 0; + for (let D = 0; D < cX; D++) { + const $ = aX[D], N = r[$], z = u[$] !== void 0 ? u[$] : h[$], k = jf(z), B = $ === f ? N.isActive : null; + B === !1 && (S = D); + let U = z === h[$] && z !== u[$] && k; + if (U && n && t.manuallyAnimateOnMount && (U = !1), N.protectedKeys = { ...x }, // If it isn't active and hasn't *just* been set as inactive + !N.isActive && B === null || // If we didn't and don't have any defined prop for this animation type + !z && !N.prevProp || // Or if the prop doesn't define an animation + v0(z) || typeof z == "boolean") + continue; + const R = lX(N.prevProp, z); + let W = R || // If we're making this variant active, we want to always make it active + $ === f && N.isActive && !U && k || // If we removed a higher-priority variant (i is in reverse order) + D > S && k, J = !1; + const ne = Array.isArray(z) ? z : [z]; + let K = ne.reduce(i($), {}); + B === !1 && (K = {}); + const { prevResolvedValues: E = {} } = N, b = { + ...E, + ...K + }, l = (w) => { + W = !0, v.has(w) && (J = !0, v.delete(w)), N.needsAnimating[w] = !0; + const P = t.getValue(w); + P && (P.liveStyle = !1); + }; + for (const w in b) { + const P = K[w], _ = E[w]; + if (x.hasOwnProperty(w)) + continue; + let y = !1; + Mv(P) && Mv(_) ? y = !MS(P, _) : y = P !== _, y ? P != null ? l(w) : v.add(w) : P !== void 0 && v.has(w) ? l(w) : N.protectedKeys[w] = !0; + } + N.prevProp = z, N.prevResolvedValues = K, N.isActive && (x = { ...x, ...K }), n && t.blockInitialAnimation && (W = !1), W && (!(U && R) || J) && g.push(...ne.map((w) => ({ + animation: w, + options: { type: $ } + }))); + } + if (v.size) { + const D = {}; + v.forEach(($) => { + const N = t.getBaseTarget($), z = t.getValue($); + z && (z.liveStyle = !0), D[$] = N ?? null; + }), g.push({ animation: D }); + } + let C = !!g.length; + return n && (u.initial === !1 || u.initial === u.animate) && !t.manuallyAnimateOnMount && (C = !1), n = !1, C ? e(g) : Promise.resolve(); + } + function a(f, u) { + var h; + if (r[f].isActive === u) + return Promise.resolve(); + (h = t.variantChildren) === null || h === void 0 || h.forEach((v) => { + var x; + return (x = v.animationState) === null || x === void 0 ? void 0 : x.setActive(f, u); + }), r[f].isActive = u; + const g = o(f); + for (const v in r) + r[v].protectedKeys = {}; + return g; + } + return { + animateChanges: o, + setActive: a, + setAnimateFunction: s, + getState: () => r, + reset: () => { + r = L6(), n = !0; + } + }; +} +function lX(t, e) { + return typeof e == "string" ? e !== t : Array.isArray(e) ? !MS(e, t) : !1; +} +function va(t = !1) { + return { + isActive: t, + protectedKeys: {}, + needsAnimating: {}, + prevResolvedValues: {} + }; +} +function L6() { + return { + animate: va(!0), + whileInView: va(), + whileHover: va(), + whileTap: va(), + whileDrag: va(), + whileFocus: va(), + exit: va() + }; +} +class ea { + constructor(e) { + this.isMounted = !1, this.node = e; + } + update() { + } +} +class hX extends ea { + /** + * We dynamically generate the AnimationState manager as it contains a reference + * to the underlying animation library. We only want to load that if we load this, + * so people can optionally code split it out using the `m` component. + */ + constructor(e) { + super(e), e.animationState || (e.animationState = fX(e)); + } + updateAnimationControlsSubscription() { + const { animate: e } = this.node.getProps(); + v0(e) && (this.unmountControls = e.subscribe(this.node)); + } + /** + * Subscribe any provided AnimationControls to the component's VisualElement + */ + mount() { + this.updateAnimationControlsSubscription(); + } + update() { + const { animate: e } = this.node.getProps(), { animate: r } = this.node.prevProps || {}; + e !== r && this.updateAnimationControlsSubscription(); + } + unmount() { + var e; + this.node.animationState.reset(), (e = this.unmountControls) === null || e === void 0 || e.call(this); + } +} +let dX = 0; +class pX extends ea { + constructor() { + super(...arguments), this.id = dX++; + } + update() { + if (!this.node.presenceContext) + return; + const { isPresent: e, onExitComplete: r } = this.node.presenceContext, { isPresent: n } = this.node.prevPresenceContext || {}; + if (!this.node.animationState || e === n) + return; + const i = this.node.animationState.setActive("exit", !e); + r && !e && i.then(() => r(this.id)); + } + mount() { + const { register: e } = this.node.presenceContext || {}; + e && (this.unmount = e(this.id)); + } + unmount() { + } +} +const gX = { + animation: { + Feature: hX + }, + exit: { + Feature: pX + } +}, d7 = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1; +function w0(t, e = "page") { + return { + point: { + x: t[`${e}X`], + y: t[`${e}Y`] + } + }; +} +const mX = (t) => (e) => d7(e) && t(e, w0(e)); +function no(t, e, r, n = { passive: !0 }) { + return t.addEventListener(e, r, n), () => t.removeEventListener(e, r); +} +function co(t, e, r, n) { + return no(t, e, mX(r), n); +} +const k6 = (t, e) => Math.abs(t - e); +function vX(t, e) { + const r = k6(t.x, e.x), n = k6(t.y, e.y); + return Math.sqrt(r ** 2 + n ** 2); +} +class p7 { + constructor(e, r, { transformPagePoint: n, contextWindow: i, dragSnapToOrigin: s = !1 } = {}) { + if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.updatePoint = () => { + if (!(this.lastMoveEvent && this.lastMoveEventInfo)) + return; + const g = Sm(this.lastMoveEventInfo, this.history), v = this.startEvent !== null, x = vX(g.offset, { x: 0, y: 0 }) >= 3; + if (!v && !x) + return; + const { point: S } = g, { timestamp: C } = Nn; + this.history.push({ ...S, timestamp: C }); + const { onStart: D, onMove: $ } = this.handlers; + v || (D && D(this.lastMoveEvent, g), this.startEvent = this.lastMoveEvent), $ && $(this.lastMoveEvent, g); + }, this.handlePointerMove = (g, v) => { + this.lastMoveEvent = g, this.lastMoveEventInfo = Em(v, this.transformPagePoint), kr.update(this.updatePoint, !0); + }, this.handlePointerUp = (g, v) => { + this.end(); + const { onEnd: x, onSessionEnd: S, resumeAnimation: C } = this.handlers; + if (this.dragSnapToOrigin && C && C(), !(this.lastMoveEvent && this.lastMoveEventInfo)) + return; + const D = Sm(g.type === "pointercancel" ? this.lastMoveEventInfo : Em(v, this.transformPagePoint), this.history); + this.startEvent && x && x(g, D), S && S(g, D); + }, !d7(e)) + return; + this.dragSnapToOrigin = s, this.handlers = r, this.transformPagePoint = n, this.contextWindow = i || window; + const o = w0(e), a = Em(o, this.transformPagePoint), { point: f } = a, { timestamp: u } = Nn; + this.history = [{ ...f, timestamp: u }]; + const { onSessionStart: h } = r; + h && h(e, Sm(a, this.history)), this.removeListeners = ao(co(this.contextWindow, "pointermove", this.handlePointerMove), co(this.contextWindow, "pointerup", this.handlePointerUp), co(this.contextWindow, "pointercancel", this.handlePointerUp)); + } + updateHandlers(e) { + this.handlers = e; + } + end() { + this.removeListeners && this.removeListeners(), Vo(this.updatePoint); + } +} +function Em(t, e) { + return e ? { point: e(t.point) } : t; +} +function $6(t, e) { + return { x: t.x - e.x, y: t.y - e.y }; +} +function Sm({ point: t }, e) { + return { + point: t, + delta: $6(t, g7(e)), + offset: $6(t, bX(e)), + velocity: yX(e, 0.1) + }; +} +function bX(t) { + return t[0]; +} +function g7(t) { + return t[t.length - 1]; +} +function yX(t, e) { + if (t.length < 2) + return { x: 0, y: 0 }; + let r = t.length - 1, n = null; + const i = g7(t); + for (; r >= 0 && (n = t[r], !(i.timestamp - n.timestamp > Cs(e))); ) + r--; + if (!n) + return { x: 0, y: 0 }; + const s = oo(i.timestamp - n.timestamp); + if (s === 0) + return { x: 0, y: 0 }; + const o = { + x: (i.x - n.x) / s, + y: (i.y - n.y) / s + }; + return o.x === 1 / 0 && (o.x = 0), o.y === 1 / 0 && (o.y = 0), o; +} +function m7(t) { + let e = null; + return () => { + const r = () => { + e = null; + }; + return e === null ? (e = t, r) : !1; + }; +} +const B6 = m7("dragHorizontal"), F6 = m7("dragVertical"); +function v7(t) { + let e = !1; + if (t === "y") + e = F6(); + else if (t === "x") + e = B6(); + else { + const r = B6(), n = F6(); + r && n ? e = () => { + r(), n(); + } : (r && r(), n && n()); + } + return e; +} +function b7() { + const t = v7(!0); + return t ? (t(), !1) : !0; +} +function Ec(t) { + return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current"); +} +const y7 = 1e-4, wX = 1 - y7, xX = 1 + y7, w7 = 0.01, _X = 0 - w7, EX = 0 + w7; +function Pi(t) { + return t.max - t.min; +} +function SX(t, e, r) { + return Math.abs(t - e) <= r; +} +function j6(t, e, r, n = 0.5) { + t.origin = n, t.originPoint = Qr(e.min, e.max, t.origin), t.scale = Pi(r) / Pi(e), t.translate = Qr(r.min, r.max, t.origin) - t.originPoint, (t.scale >= wX && t.scale <= xX || isNaN(t.scale)) && (t.scale = 1), (t.translate >= _X && t.translate <= EX || isNaN(t.translate)) && (t.translate = 0); +} +function cf(t, e, r, n) { + j6(t.x, e.x, r.x, n ? n.originX : void 0), j6(t.y, e.y, r.y, n ? n.originY : void 0); +} +function U6(t, e, r) { + t.min = r.min + e.min, t.max = t.min + Pi(e); +} +function AX(t, e, r) { + U6(t.x, e.x, r.x), U6(t.y, e.y, r.y); +} +function q6(t, e, r) { + t.min = e.min - r.min, t.max = t.min + Pi(e); +} +function uf(t, e, r) { + q6(t.x, e.x, r.x), q6(t.y, e.y, r.y); +} +function PX(t, { min: e, max: r }, n) { + return e !== void 0 && t < e ? t = n ? Qr(e, t, n.min) : Math.max(t, e) : r !== void 0 && t > r && (t = n ? Qr(r, t, n.max) : Math.min(t, r)), t; +} +function z6(t, e, r) { + return { + min: e !== void 0 ? t.min + e : void 0, + max: r !== void 0 ? t.max + r - (t.max - t.min) : void 0 + }; +} +function MX(t, { top: e, left: r, bottom: n, right: i }) { + return { + x: z6(t.x, r, i), + y: z6(t.y, e, n) + }; +} +function H6(t, e) { + let r = e.min - t.min, n = e.max - t.max; + return e.max - e.min < t.max - t.min && ([r, n] = [n, r]), { min: r, max: n }; +} +function IX(t, e) { + return { + x: H6(t.x, e.x), + y: H6(t.y, e.y) + }; +} +function CX(t, e) { + let r = 0.5; + const n = Pi(t), i = Pi(e); + return i > n ? r = Hc(e.min, e.max - n, t.min) : n > i && (r = Hc(t.min, t.max - i, e.min)), Go(0, 1, r); +} +function RX(t, e) { + const r = {}; + return e.min !== void 0 && (r.min = e.min - t.min), e.max !== void 0 && (r.max = e.max - t.min), r; +} +const $v = 0.35; +function TX(t = $v) { + return t === !1 ? t = 0 : t === !0 && (t = $v), { + x: W6(t, "left", "right"), + y: W6(t, "top", "bottom") + }; +} +function W6(t, e, r) { + return { + min: K6(t, e), + max: K6(t, r) + }; +} +function K6(t, e) { + return typeof t == "number" ? t : t[e] || 0; +} +const V6 = () => ({ + translate: 0, + scale: 1, + origin: 0, + originPoint: 0 +}), Sc = () => ({ + x: V6(), + y: V6() +}), G6 = () => ({ min: 0, max: 0 }), fn = () => ({ + x: G6(), + y: G6() +}); +function Ui(t) { + return [t("x"), t("y")]; +} +function x7({ top: t, left: e, right: r, bottom: n }) { + return { + x: { min: e, max: r }, + y: { min: t, max: n } + }; +} +function DX({ x: t, y: e }) { + return { top: e.min, right: t.max, bottom: e.max, left: t.min }; +} +function OX(t, e) { + if (!e) + return t; + const r = e({ x: t.left, y: t.top }), n = e({ x: t.right, y: t.bottom }); + return { + top: r.y, + left: r.x, + bottom: n.y, + right: n.x + }; +} +function Am(t) { + return t === void 0 || t === 1; +} +function Bv({ scale: t, scaleX: e, scaleY: r }) { + return !Am(t) || !Am(e) || !Am(r); +} +function ya(t) { + return Bv(t) || _7(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY; +} +function _7(t) { + return Y6(t.x) || Y6(t.y); +} +function Y6(t) { + return t && t !== "0%"; +} +function Dd(t, e, r) { + const n = t - r, i = e * n; + return r + i; +} +function J6(t, e, r, n, i) { + return i !== void 0 && (t = Dd(t, i, n)), Dd(t, r, n) + e; +} +function Fv(t, e = 0, r = 1, n, i) { + t.min = J6(t.min, e, r, n, i), t.max = J6(t.max, e, r, n, i); +} +function E7(t, { x: e, y: r }) { + Fv(t.x, e.translate, e.scale, e.originPoint), Fv(t.y, r.translate, r.scale, r.originPoint); +} +const X6 = 0.999999999999, Z6 = 1.0000000000001; +function NX(t, e, r, n = !1) { + const i = r.length; + if (!i) + return; + e.x = e.y = 1; + let s, o; + for (let a = 0; a < i; a++) { + s = r[a], o = s.projectionDelta; + const { visualElement: f } = s.options; + f && f.props.style && f.props.style.display === "contents" || (n && s.options.layoutScroll && s.scroll && s !== s.root && Pc(t, { + x: -s.scroll.offset.x, + y: -s.scroll.offset.y + }), o && (e.x *= o.x.scale, e.y *= o.y.scale, E7(t, o)), n && ya(s.latestValues) && Pc(t, s.latestValues)); + } + e.x < Z6 && e.x > X6 && (e.x = 1), e.y < Z6 && e.y > X6 && (e.y = 1); +} +function Ac(t, e) { + t.min = t.min + e, t.max = t.max + e; +} +function Q6(t, e, r, n, i = 0.5) { + const s = Qr(t.min, t.max, i); + Fv(t, e, r, s, n); +} +function Pc(t, e) { + Q6(t.x, e.x, e.scaleX, e.scale, e.originX), Q6(t.y, e.y, e.scaleY, e.scale, e.originY); +} +function S7(t, e) { + return x7(OX(t.getBoundingClientRect(), e)); +} +function LX(t, e, r) { + const n = S7(t, r), { scroll: i } = e; + return i && (Ac(n.x, i.offset.x), Ac(n.y, i.offset.y)), n; +} +const A7 = ({ current: t }) => t ? t.ownerDocument.defaultView : null, kX = /* @__PURE__ */ new WeakMap(); +class $X { + constructor(e) { + this.openGlobalLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = fn(), this.visualElement = e; + } + start(e, { snapToCursor: r = !1 } = {}) { + const { presenceContext: n } = this.visualElement; + if (n && n.isPresent === !1) + return; + const i = (h) => { + const { dragSnapToOrigin: g } = this.getProps(); + g ? this.pauseAnimation() : this.stopAnimation(), r && this.snapToCursor(w0(h, "page").point); + }, s = (h, g) => { + const { drag: v, dragPropagation: x, onDragStart: S } = this.getProps(); + if (v && !x && (this.openGlobalLock && this.openGlobalLock(), this.openGlobalLock = v7(v), !this.openGlobalLock)) + return; + this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), Ui((D) => { + let $ = this.getAxisMotionValue(D).get() || 0; + if (Rs.test($)) { + const { projection: N } = this.visualElement; + if (N && N.layout) { + const z = N.layout.layoutBox[D]; + z && ($ = Pi(z) * (parseFloat($) / 100)); + } + } + this.originPoint[D] = $; + }), S && kr.postRender(() => S(h, g)), Lv(this.visualElement, "transform"); + const { animationState: C } = this.visualElement; + C && C.setActive("whileDrag", !0); + }, o = (h, g) => { + const { dragPropagation: v, dragDirectionLock: x, onDirectionLock: S, onDrag: C } = this.getProps(); + if (!v && !this.openGlobalLock) + return; + const { offset: D } = g; + if (x && this.currentDirection === null) { + this.currentDirection = BX(D), this.currentDirection !== null && S && S(this.currentDirection); + return; + } + this.updateAxis("x", g.point, D), this.updateAxis("y", g.point, D), this.visualElement.render(), C && C(h, g); + }, a = (h, g) => this.stop(h, g), f = () => Ui((h) => { + var g; + return this.getAnimationState(h) === "paused" && ((g = this.getAxisMotionValue(h).animation) === null || g === void 0 ? void 0 : g.play()); + }), { dragSnapToOrigin: u } = this.getProps(); + this.panSession = new p7(e, { + onSessionStart: i, + onStart: s, + onMove: o, + onSessionEnd: a, + resumeAnimation: f + }, { + transformPagePoint: this.visualElement.getTransformPagePoint(), + dragSnapToOrigin: u, + contextWindow: A7(this.visualElement) + }); + } + stop(e, r) { + const n = this.isDragging; + if (this.cancel(), !n) + return; + const { velocity: i } = r; + this.startAnimation(i); + const { onDragEnd: s } = this.getProps(); + s && kr.postRender(() => s(e, r)); + } + cancel() { + this.isDragging = !1; + const { projection: e, animationState: r } = this.visualElement; + e && (e.isAnimationBlocked = !1), this.panSession && this.panSession.end(), this.panSession = void 0; + const { dragPropagation: n } = this.getProps(); + !n && this.openGlobalLock && (this.openGlobalLock(), this.openGlobalLock = null), r && r.setActive("whileDrag", !1); + } + updateAxis(e, r, n) { + const { drag: i } = this.getProps(); + if (!n || !Rh(e, i, this.currentDirection)) + return; + const s = this.getAxisMotionValue(e); + let o = this.originPoint[e] + n[e]; + this.constraints && this.constraints[e] && (o = PX(o, this.constraints[e], this.elastic[e])), s.set(o); + } + resolveConstraints() { + var e; + const { dragConstraints: r, dragElastic: n } = this.getProps(), i = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : (e = this.visualElement.projection) === null || e === void 0 ? void 0 : e.layout, s = this.constraints; + r && Ec(r) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : r && i ? this.constraints = MX(i.layoutBox, r) : this.constraints = !1, this.elastic = TX(n), s !== this.constraints && i && this.constraints && !this.hasMutatedConstraints && Ui((o) => { + this.constraints !== !1 && this.getAxisMotionValue(o) && (this.constraints[o] = RX(i.layoutBox[o], this.constraints[o])); + }); + } + resolveRefConstraints() { + const { dragConstraints: e, onMeasureDragConstraints: r } = this.getProps(); + if (!e || !Ec(e)) + return !1; + const n = e.current; + po(n !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop."); + const { projection: i } = this.visualElement; + if (!i || !i.layout) + return !1; + const s = LX(n, i.root, this.visualElement.getTransformPagePoint()); + let o = IX(i.layout.layoutBox, s); + if (r) { + const a = r(DX(o)); + this.hasMutatedConstraints = !!a, a && (o = x7(a)); + } + return o; + } + startAnimation(e) { + const { drag: r, dragMomentum: n, dragElastic: i, dragTransition: s, dragSnapToOrigin: o, onDragTransitionEnd: a } = this.getProps(), f = this.constraints || {}, u = Ui((h) => { + if (!Rh(h, r, this.currentDirection)) + return; + let g = f && f[h] || {}; + o && (g = { min: 0, max: 0 }); + const v = i ? 200 : 1e6, x = i ? 40 : 1e7, S = { + type: "inertia", + velocity: n ? e[h] : 0, + bounceStiffness: v, + bounceDamping: x, + timeConstant: 750, + restDelta: 1, + restSpeed: 10, + ...s, + ...g + }; + return this.startAxisValueAnimation(h, S); + }); + return Promise.all(u).then(a); + } + startAxisValueAnimation(e, r) { + const n = this.getAxisMotionValue(e); + return Lv(this.visualElement, e), n.start(cb(e, n, 0, r, this.visualElement, !1)); + } + stopAnimation() { + Ui((e) => this.getAxisMotionValue(e).stop()); + } + pauseAnimation() { + Ui((e) => { + var r; + return (r = this.getAxisMotionValue(e).animation) === null || r === void 0 ? void 0 : r.pause(); + }); + } + getAnimationState(e) { + var r; + return (r = this.getAxisMotionValue(e).animation) === null || r === void 0 ? void 0 : r.state; + } + /** + * Drag works differently depending on which props are provided. + * + * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values. + * - Otherwise, we apply the delta to the x/y motion values. + */ + getAxisMotionValue(e) { + const r = `_drag${e.toUpperCase()}`, n = this.visualElement.getProps(), i = n[r]; + return i || this.visualElement.getValue(e, (n.initial ? n.initial[e] : void 0) || 0); + } + snapToCursor(e) { + Ui((r) => { + const { drag: n } = this.getProps(); + if (!Rh(r, n, this.currentDirection)) + return; + const { projection: i } = this.visualElement, s = this.getAxisMotionValue(r); + if (i && i.layout) { + const { min: o, max: a } = i.layout.layoutBox[r]; + s.set(e[r] - Qr(o, a, 0.5)); + } + }); + } + /** + * When the viewport resizes we want to check if the measured constraints + * have changed and, if so, reposition the element within those new constraints + * relative to where it was before the resize. + */ + scalePositionWithinConstraints() { + if (!this.visualElement.current) + return; + const { drag: e, dragConstraints: r } = this.getProps(), { projection: n } = this.visualElement; + if (!Ec(r) || !n || !this.constraints) + return; + this.stopAnimation(); + const i = { x: 0, y: 0 }; + Ui((o) => { + const a = this.getAxisMotionValue(o); + if (a && this.constraints !== !1) { + const f = a.get(); + i[o] = CX({ min: f, max: f }, this.constraints[o]); + } + }); + const { transformTemplate: s } = this.visualElement.getProps(); + this.visualElement.current.style.transform = s ? s({}, "") : "none", n.root && n.root.updateScroll(), n.updateLayout(), this.resolveConstraints(), Ui((o) => { + if (!Rh(o, e, null)) + return; + const a = this.getAxisMotionValue(o), { min: f, max: u } = this.constraints[o]; + a.set(Qr(f, u, i[o])); + }); + } + addListeners() { + if (!this.visualElement.current) + return; + kX.set(this.visualElement, this); + const e = this.visualElement.current, r = co(e, "pointerdown", (f) => { + const { drag: u, dragListener: h = !0 } = this.getProps(); + u && h && this.start(f); + }), n = () => { + const { dragConstraints: f } = this.getProps(); + Ec(f) && f.current && (this.constraints = this.resolveRefConstraints()); + }, { projection: i } = this.visualElement, s = i.addEventListener("measure", n); + i && !i.layout && (i.root && i.root.updateScroll(), i.updateLayout()), kr.read(n); + const o = no(window, "resize", () => this.scalePositionWithinConstraints()), a = i.addEventListener("didUpdate", (({ delta: f, hasLayoutChanged: u }) => { + this.isDragging && u && (Ui((h) => { + const g = this.getAxisMotionValue(h); + g && (this.originPoint[h] += f[h].translate, g.set(g.get() + f[h].translate)); + }), this.visualElement.render()); + })); + return () => { + o(), r(), s(), a && a(); + }; + } + getProps() { + const e = this.visualElement.getProps(), { drag: r = !1, dragDirectionLock: n = !1, dragPropagation: i = !1, dragConstraints: s = !1, dragElastic: o = $v, dragMomentum: a = !0 } = e; + return { + ...e, + drag: r, + dragDirectionLock: n, + dragPropagation: i, + dragConstraints: s, + dragElastic: o, + dragMomentum: a + }; + } +} +function Rh(t, e, r) { + return (e === !0 || e === t) && (r === null || r === t); +} +function BX(t, e = 10) { + let r = null; + return Math.abs(t.y) > e ? r = "y" : Math.abs(t.x) > e && (r = "x"), r; +} +class FX extends ea { + constructor(e) { + super(e), this.removeGroupControls = kn, this.removeListeners = kn, this.controls = new $X(e); + } + mount() { + const { dragControls: e } = this.node.getProps(); + e && (this.removeGroupControls = e.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || kn; + } + unmount() { + this.removeGroupControls(), this.removeListeners(); + } +} +const e5 = (t) => (e, r) => { + t && kr.postRender(() => t(e, r)); +}; +class jX extends ea { + constructor() { + super(...arguments), this.removePointerDownListener = kn; + } + onPointerDown(e) { + this.session = new p7(e, this.createPanHandlers(), { + transformPagePoint: this.node.getTransformPagePoint(), + contextWindow: A7(this.node) + }); + } + createPanHandlers() { + const { onPanSessionStart: e, onPanStart: r, onPan: n, onPanEnd: i } = this.node.getProps(); + return { + onSessionStart: e5(e), + onStart: e5(r), + onMove: n, + onEnd: (s, o) => { + delete this.session, i && kr.postRender(() => i(s, o)); + } + }; + } + mount() { + this.removePointerDownListener = co(this.node.current, "pointerdown", (e) => this.onPointerDown(e)); + } + update() { + this.session && this.session.updateHandlers(this.createPanHandlers()); + } + unmount() { + this.removePointerDownListener(), this.session && this.session.end(); + } +} +const x0 = Xo(null); +function UX() { + const t = In(x0); + if (t === null) + return [!0, null]; + const { isPresent: e, onExitComplete: r, register: n } = t, i = Vv(); + Rn(() => n(i), []); + const s = Gv(() => r && r(i), [i, r]); + return !e && r ? [!1, s] : [!0]; +} +const db = Xo({}), P7 = Xo({}), td = { + /** + * Global flag as to whether the tree has animated since the last time + * we resized the window + */ + hasAnimatedSinceResize: !0, + /** + * We set this to true once, on the first update. Any nodes added to the tree beyond that + * update will be given a `data-projection-id` attribute. + */ + hasEverUpdated: !1 +}; +function t5(t, e) { + return e.max === e.min ? 0 : t / (e.max - e.min) * 100; +} +const qu = { + correct: (t, e) => { + if (!e.target) + return t; + if (typeof t == "string") + if (Vt.test(t)) + t = parseFloat(t); + else + return t; + const r = t5(t, e.target.x), n = t5(t, e.target.y); + return `${r}% ${n}%`; + } +}, qX = { + correct: (t, { treeScale: e, projectionDelta: r }) => { + const n = t, i = Yo.parse(t); + if (i.length > 5) + return n; + const s = Yo.createTransformer(t), o = typeof i[0] != "number" ? 1 : 0, a = r.x.scale * e.x, f = r.y.scale * e.y; + i[0 + o] /= a, i[1 + o] /= f; + const u = Qr(a, f, 0.5); + return typeof i[2 + o] == "number" && (i[2 + o] /= u), typeof i[3 + o] == "number" && (i[3 + o] /= u), s(i); + } +}, Od = {}; +function zX(t) { + Object.assign(Od, t); +} +const { schedule: pb } = IS(queueMicrotask, !1); +class HX extends lT { + /** + * This only mounts projection nodes for components that + * need measuring, we might want to do it for all components + * in order to incorporate transforms + */ + componentDidMount() { + const { visualElement: e, layoutGroup: r, switchLayoutGroup: n, layoutId: i } = this.props, { projection: s } = e; + zX(WX), s && (r.group && r.group.add(s), n && n.register && i && n.register(s), s.root.didUpdate(), s.addEventListener("animationComplete", () => { + this.safeToRemove(); + }), s.setOptions({ + ...s.options, + onExitComplete: () => this.safeToRemove() + })), td.hasEverUpdated = !0; + } + getSnapshotBeforeUpdate(e) { + const { layoutDependency: r, visualElement: n, drag: i, isPresent: s } = this.props, o = n.projection; + return o && (o.isPresent = s, i || e.layoutDependency !== r || r === void 0 ? o.willUpdate() : this.safeToRemove(), e.isPresent !== s && (s ? o.promote() : o.relegate() || kr.postRender(() => { + const a = o.getStack(); + (!a || !a.members.length) && this.safeToRemove(); + }))), null; + } + componentDidUpdate() { + const { projection: e } = this.props.visualElement; + e && (e.root.didUpdate(), pb.postRender(() => { + !e.currentAnimation && e.isLead() && this.safeToRemove(); + })); + } + componentWillUnmount() { + const { visualElement: e, layoutGroup: r, switchLayoutGroup: n } = this.props, { projection: i } = e; + i && (i.scheduleCheckAfterUnmount(), r && r.group && r.group.remove(i), n && n.deregister && n.deregister(i)); + } + safeToRemove() { + const { safeToRemove: e } = this.props; + e && e(); + } + render() { + return null; + } +} +function M7(t) { + const [e, r] = UX(), n = In(db); + return pe.jsx(HX, { ...t, layoutGroup: n, switchLayoutGroup: In(P7), isPresent: e, safeToRemove: r }); +} +const WX = { + borderRadius: { + ...qu, + applyTo: [ + "borderTopLeftRadius", + "borderTopRightRadius", + "borderBottomLeftRadius", + "borderBottomRightRadius" + ] + }, + borderTopLeftRadius: qu, + borderTopRightRadius: qu, + borderBottomLeftRadius: qu, + borderBottomRightRadius: qu, + boxShadow: qX +}, I7 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], KX = I7.length, r5 = (t) => typeof t == "string" ? parseFloat(t) : t, n5 = (t) => typeof t == "number" || Vt.test(t); +function VX(t, e, r, n, i, s) { + i ? (t.opacity = Qr( + 0, + // TODO Reinstate this if only child + r.opacity !== void 0 ? r.opacity : 1, + GX(n) + ), t.opacityExit = Qr(e.opacity !== void 0 ? e.opacity : 1, 0, YX(n))) : s && (t.opacity = Qr(e.opacity !== void 0 ? e.opacity : 1, r.opacity !== void 0 ? r.opacity : 1, n)); + for (let o = 0; o < KX; o++) { + const a = `border${I7[o]}Radius`; + let f = i5(e, a), u = i5(r, a); + if (f === void 0 && u === void 0) + continue; + f || (f = 0), u || (u = 0), f === 0 || u === 0 || n5(f) === n5(u) ? (t[a] = Math.max(Qr(r5(f), r5(u), n), 0), (Rs.test(u) || Rs.test(f)) && (t[a] += "%")) : t[a] = u; + } + (e.rotate || r.rotate) && (t.rotate = Qr(e.rotate || 0, r.rotate || 0, n)); +} +function i5(t, e) { + return t[e] !== void 0 ? t[e] : t.borderRadius; +} +const GX = /* @__PURE__ */ C7(0, 0.5, LS), YX = /* @__PURE__ */ C7(0.5, 0.95, kn); +function C7(t, e, r) { + return (n) => n < t ? 0 : n > e ? 1 : r(Hc(t, e, n)); +} +function s5(t, e) { + t.min = e.min, t.max = e.max; +} +function Fi(t, e) { + s5(t.x, e.x), s5(t.y, e.y); +} +function o5(t, e) { + t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin; +} +function a5(t, e, r, n, i) { + return t -= e, t = Dd(t, 1 / r, n), i !== void 0 && (t = Dd(t, 1 / i, n)), t; +} +function JX(t, e = 0, r = 1, n = 0.5, i, s = t, o = t) { + if (Rs.test(e) && (e = parseFloat(e), e = Qr(o.min, o.max, e / 100) - o.min), typeof e != "number") + return; + let a = Qr(s.min, s.max, n); + t === s && (a -= e), t.min = a5(t.min, e, r, a, i), t.max = a5(t.max, e, r, a, i); +} +function c5(t, e, [r, n, i], s, o) { + JX(t, e[r], e[n], e[i], e.scale, s, o); +} +const XX = ["x", "scaleX", "originX"], ZX = ["y", "scaleY", "originY"]; +function u5(t, e, r, n) { + c5(t.x, e, XX, r ? r.x : void 0, n ? n.x : void 0), c5(t.y, e, ZX, r ? r.y : void 0, n ? n.y : void 0); +} +function f5(t) { + return t.translate === 0 && t.scale === 1; +} +function R7(t) { + return f5(t.x) && f5(t.y); +} +function l5(t, e) { + return t.min === e.min && t.max === e.max; +} +function QX(t, e) { + return l5(t.x, e.x) && l5(t.y, e.y); +} +function h5(t, e) { + return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max); +} +function T7(t, e) { + return h5(t.x, e.x) && h5(t.y, e.y); +} +function d5(t) { + return Pi(t.x) / Pi(t.y); +} +function p5(t, e) { + return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint; +} +class eZ { + constructor() { + this.members = []; + } + add(e) { + ub(this.members, e), e.scheduleRender(); + } + remove(e) { + if (fb(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) { + const r = this.members[this.members.length - 1]; + r && this.promote(r); + } + } + relegate(e) { + const r = this.members.findIndex((i) => e === i); + if (r === 0) + return !1; + let n; + for (let i = r; i >= 0; i--) { + const s = this.members[i]; + if (s.isPresent !== !1) { + n = s; + break; + } + } + return n ? (this.promote(n), !0) : !1; + } + promote(e, r) { + const n = this.lead; + if (e !== n && (this.prevLead = n, this.lead = e, e.show(), n)) { + n.instance && n.scheduleRender(), e.scheduleRender(), e.resumeFrom = n, r && (e.resumeFrom.preserveOpacity = !0), n.snapshot && (e.snapshot = n.snapshot, e.snapshot.latestValues = n.animationValues || n.latestValues), e.root && e.root.isUpdating && (e.isLayoutDirty = !0); + const { crossfade: i } = e.options; + i === !1 && n.hide(); + } + } + exitAnimationComplete() { + this.members.forEach((e) => { + const { options: r, resumingFrom: n } = e; + r.onExitComplete && r.onExitComplete(), n && n.options.onExitComplete && n.options.onExitComplete(); + }); + } + scheduleRender() { + this.members.forEach((e) => { + e.instance && e.scheduleRender(!1); + }); + } + /** + * Clear any leads that have been removed this render to prevent them from being + * used in future animations and to prevent memory leaks + */ + removeLeadSnapshot() { + this.lead && this.lead.snapshot && (this.lead.snapshot = void 0); + } +} +function tZ(t, e, r) { + let n = ""; + const i = t.x.translate / e.x, s = t.y.translate / e.y, o = r?.z || 0; + if ((i || s || o) && (n = `translate3d(${i}px, ${s}px, ${o}px) `), (e.x !== 1 || e.y !== 1) && (n += `scale(${1 / e.x}, ${1 / e.y}) `), r) { + const { transformPerspective: u, rotate: h, rotateX: g, rotateY: v, skewX: x, skewY: S } = r; + u && (n = `perspective(${u}px) ${n}`), h && (n += `rotate(${h}deg) `), g && (n += `rotateX(${g}deg) `), v && (n += `rotateY(${v}deg) `), x && (n += `skewX(${x}deg) `), S && (n += `skewY(${S}deg) `); + } + const a = t.x.scale * e.x, f = t.y.scale * e.y; + return (a !== 1 || f !== 1) && (n += `scale(${a}, ${f})`), n || "none"; +} +const rZ = (t, e) => t.depth - e.depth; +class nZ { + constructor() { + this.children = [], this.isDirty = !1; + } + add(e) { + ub(this.children, e), this.isDirty = !0; + } + remove(e) { + fb(this.children, e), this.isDirty = !0; + } + forEach(e) { + this.isDirty && this.children.sort(rZ), this.isDirty = !1, this.children.forEach(e); + } +} +function rd(t) { + const e = Wn(t) ? t.get() : t; + return GJ(e) ? e.toValue() : e; +} +function iZ(t, e) { + const r = Ts.now(), n = ({ timestamp: i }) => { + const s = i - r; + s >= e && (Vo(n), t(s - e)); + }; + return kr.read(n, !0), () => Vo(n); +} +function sZ(t) { + return t instanceof SVGElement && t.tagName !== "svg"; +} +function oZ(t, e, r) { + const n = Wn(t) ? t : zf(t); + return n.start(cb("", n, e, r)), n.animation; +} +const wa = { + type: "projectionFrame", + totalNodes: 0, + resolvedTargetDeltas: 0, + recalculatedProjection: 0 +}, Qu = typeof window < "u" && window.MotionDebug !== void 0, Pm = ["", "X", "Y", "Z"], aZ = { visibility: "hidden" }, g5 = 1e3; +let cZ = 0; +function Mm(t, e, r, n) { + const { latestValues: i } = e; + i[t] && (r[t] = i[t], e.setStaticValue(t, 0), n && (n[t] = 0)); +} +function D7(t) { + if (t.hasCheckedOptimisedAppear = !0, t.root === t) + return; + const { visualElement: e } = t.options; + if (!e) + return; + const r = f7(e); + if (window.MotionHasOptimisedAnimation(r, "transform")) { + const { layout: i, layoutId: s } = t.options; + window.MotionCancelOptimisedAnimation(r, "transform", kr, !(i || s)); + } + const { parent: n } = t; + n && !n.hasCheckedOptimisedAppear && D7(n); +} +function O7({ attachResizeListener: t, defaultParent: e, measureScroll: r, checkIsScrollRoot: n, resetTransform: i }) { + return class { + constructor(o = {}, a = e?.()) { + this.id = cZ++, this.animationId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => { + this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots()); + }, this.updateProjection = () => { + this.projectionUpdateScheduled = !1, Qu && (wa.totalNodes = wa.resolvedTargetDeltas = wa.recalculatedProjection = 0), this.nodes.forEach(lZ), this.nodes.forEach(mZ), this.nodes.forEach(vZ), this.nodes.forEach(hZ), Qu && window.MotionDebug.record(wa); + }, this.resolvedRelativeTargetAt = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = o, this.root = a ? a.root || a : this, this.path = a ? [...a.path, a] : [], this.parent = a, this.depth = a ? a.depth + 1 : 0; + for (let f = 0; f < this.path.length; f++) + this.path[f].shouldResetTransform = !0; + this.root === this && (this.nodes = new nZ()); + } + addEventListener(o, a) { + return this.eventHandlers.has(o) || this.eventHandlers.set(o, new lb()), this.eventHandlers.get(o).add(a); + } + notifyListeners(o, ...a) { + const f = this.eventHandlers.get(o); + f && f.notify(...a); + } + hasListeners(o) { + return this.eventHandlers.has(o); + } + /** + * Lifecycles + */ + mount(o, a = this.root.hasTreeAnimated) { + if (this.instance) + return; + this.isSVG = sZ(o), this.instance = o; + const { layoutId: f, layout: u, visualElement: h } = this.options; + if (h && !h.current && h.mount(o), this.root.nodes.add(this), this.parent && this.parent.children.add(this), a && (u || f) && (this.isLayoutDirty = !0), t) { + let g; + const v = () => this.root.updateBlockedByResize = !1; + t(o, () => { + this.root.updateBlockedByResize = !0, g && g(), g = iZ(v, 250), td.hasAnimatedSinceResize && (td.hasAnimatedSinceResize = !1, this.nodes.forEach(v5)); + }); + } + f && this.root.registerSharedNode(f, this), this.options.animate !== !1 && h && (f || u) && this.addEventListener("didUpdate", ({ delta: g, hasLayoutChanged: v, hasRelativeTargetChanged: x, layout: S }) => { + if (this.isTreeAnimationBlocked()) { + this.target = void 0, this.relativeTarget = void 0; + return; + } + const C = this.options.transition || h.getDefaultTransition() || _Z, { onLayoutAnimationStart: D, onLayoutAnimationComplete: $ } = h.getProps(), N = !this.targetLayout || !T7(this.targetLayout, S) || x, z = !v && x; + if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || z || v && (N || !this.currentAnimation)) { + this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0), this.setAnimationOrigin(g, z); + const k = { + ...G1(C, "layout"), + onPlay: D, + onComplete: $ + }; + (h.shouldReduceMotion || this.options.layoutRoot) && (k.delay = 0, k.type = !1), this.startAnimation(k); + } else + v || v5(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete(); + this.targetLayout = S; + }); + } + unmount() { + this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this); + const o = this.getStack(); + o && o.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, Vo(this.updateProjection); + } + // only on the root + blockUpdate() { + this.updateManuallyBlocked = !0; + } + unblockUpdate() { + this.updateManuallyBlocked = !1; + } + isUpdateBlocked() { + return this.updateManuallyBlocked || this.updateBlockedByResize; + } + isTreeAnimationBlocked() { + return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || !1; + } + // Note: currently only running on root node + startUpdate() { + this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(bZ), this.animationId++); + } + getTransformTemplate() { + const { visualElement: o } = this.options; + return o && o.getProps().transformTemplate; + } + willUpdate(o = !0) { + if (this.root.hasTreeAnimated = !0, this.root.isUpdateBlocked()) { + this.options.onExitComplete && this.options.onExitComplete(); + return; + } + if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && D7(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty) + return; + this.isLayoutDirty = !0; + for (let h = 0; h < this.path.length; h++) { + const g = this.path[h]; + g.shouldResetTransform = !0, g.updateScroll("snapshot"), g.options.layoutRoot && g.willUpdate(!1); + } + const { layoutId: a, layout: f } = this.options; + if (a === void 0 && !f) + return; + const u = this.getTransformTemplate(); + this.prevTransformTemplateValue = u ? u(this.latestValues, "") : void 0, this.updateSnapshot(), o && this.notifyListeners("willUpdate"); + } + update() { + if (this.updateScheduled = !1, this.isUpdateBlocked()) { + this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(m5); + return; + } + this.isUpdating || this.nodes.forEach(pZ), this.isUpdating = !1, this.nodes.forEach(gZ), this.nodes.forEach(uZ), this.nodes.forEach(fZ), this.clearAllSnapshots(); + const a = Ts.now(); + Nn.delta = Go(0, 1e3 / 60, a - Nn.timestamp), Nn.timestamp = a, Nn.isProcessing = !0, bm.update.process(Nn), bm.preRender.process(Nn), bm.render.process(Nn), Nn.isProcessing = !1; + } + didUpdate() { + this.updateScheduled || (this.updateScheduled = !0, pb.read(this.scheduleUpdate)); + } + clearAllSnapshots() { + this.nodes.forEach(dZ), this.sharedNodes.forEach(yZ); + } + scheduleUpdateProjection() { + this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, kr.preRender(this.updateProjection, !1, !0)); + } + scheduleCheckAfterUnmount() { + kr.postRender(() => { + this.isLayoutDirty ? this.root.didUpdate() : this.root.checkUpdateFailed(); + }); + } + /** + * Update measurements + */ + updateSnapshot() { + this.snapshot || !this.instance || (this.snapshot = this.measure()); + } + updateLayout() { + if (!this.instance || (this.updateScroll(), !(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty)) + return; + if (this.resumeFrom && !this.resumeFrom.instance) + for (let f = 0; f < this.path.length; f++) + this.path[f].updateScroll(); + const o = this.layout; + this.layout = this.measure(!1), this.layoutCorrected = fn(), this.isLayoutDirty = !1, this.projectionDelta = void 0, this.notifyListeners("measure", this.layout.layoutBox); + const { visualElement: a } = this.options; + a && a.notify("LayoutMeasure", this.layout.layoutBox, o ? o.layoutBox : void 0); + } + updateScroll(o = "measure") { + let a = !!(this.options.layoutScroll && this.instance); + if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === o && (a = !1), a) { + const f = n(this.instance); + this.scroll = { + animationId: this.root.animationId, + phase: o, + isRoot: f, + offset: r(this.instance), + wasRoot: this.scroll ? this.scroll.isRoot : f + }; + } + } + resetTransform() { + if (!i) + return; + const o = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, a = this.projectionDelta && !R7(this.projectionDelta), f = this.getTransformTemplate(), u = f ? f(this.latestValues, "") : void 0, h = u !== this.prevTransformTemplateValue; + o && (a || ya(this.latestValues) || h) && (i(this.instance, u), this.shouldResetTransform = !1, this.scheduleRender()); + } + measure(o = !0) { + const a = this.measurePageBox(); + let f = this.removeElementScroll(a); + return o && (f = this.removeTransform(f)), EZ(f), { + animationId: this.root.animationId, + measuredBox: a, + layoutBox: f, + latestValues: {}, + source: this.id + }; + } + measurePageBox() { + var o; + const { visualElement: a } = this.options; + if (!a) + return fn(); + const f = a.measureViewportBox(); + if (!(((o = this.scroll) === null || o === void 0 ? void 0 : o.wasRoot) || this.path.some(SZ))) { + const { scroll: h } = this.root; + h && (Ac(f.x, h.offset.x), Ac(f.y, h.offset.y)); + } + return f; + } + removeElementScroll(o) { + var a; + const f = fn(); + if (Fi(f, o), !((a = this.scroll) === null || a === void 0) && a.wasRoot) + return f; + for (let u = 0; u < this.path.length; u++) { + const h = this.path[u], { scroll: g, options: v } = h; + h !== this.root && g && v.layoutScroll && (g.wasRoot && Fi(f, o), Ac(f.x, g.offset.x), Ac(f.y, g.offset.y)); + } + return f; + } + applyTransform(o, a = !1) { + const f = fn(); + Fi(f, o); + for (let u = 0; u < this.path.length; u++) { + const h = this.path[u]; + !a && h.options.layoutScroll && h.scroll && h !== h.root && Pc(f, { + x: -h.scroll.offset.x, + y: -h.scroll.offset.y + }), ya(h.latestValues) && Pc(f, h.latestValues); + } + return ya(this.latestValues) && Pc(f, this.latestValues), f; + } + removeTransform(o) { + const a = fn(); + Fi(a, o); + for (let f = 0; f < this.path.length; f++) { + const u = this.path[f]; + if (!u.instance || !ya(u.latestValues)) + continue; + Bv(u.latestValues) && u.updateSnapshot(); + const h = fn(), g = u.measurePageBox(); + Fi(h, g), u5(a, u.latestValues, u.snapshot ? u.snapshot.layoutBox : void 0, h); + } + return ya(this.latestValues) && u5(a, this.latestValues), a; + } + setTargetDelta(o) { + this.targetDelta = o, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0; + } + setOptions(o) { + this.options = { + ...this.options, + ...o, + crossfade: o.crossfade !== void 0 ? o.crossfade : !0 + }; + } + clearMeasurements() { + this.scroll = void 0, this.layout = void 0, this.snapshot = void 0, this.prevTransformTemplateValue = void 0, this.targetDelta = void 0, this.target = void 0, this.isLayoutDirty = !1; + } + forceRelativeParentToResolveTarget() { + this.relativeParent && this.relativeParent.resolvedRelativeTargetAt !== Nn.timestamp && this.relativeParent.resolveTargetDelta(!0); + } + resolveTargetDelta(o = !1) { + var a; + const f = this.getLead(); + this.isProjectionDirty || (this.isProjectionDirty = f.isProjectionDirty), this.isTransformDirty || (this.isTransformDirty = f.isTransformDirty), this.isSharedProjectionDirty || (this.isSharedProjectionDirty = f.isSharedProjectionDirty); + const u = !!this.resumingFrom || this !== f; + if (!(o || u && this.isSharedProjectionDirty || this.isProjectionDirty || !((a = this.parent) === null || a === void 0) && a.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize)) + return; + const { layout: g, layoutId: v } = this.options; + if (!(!this.layout || !(g || v))) { + if (this.resolvedRelativeTargetAt = Nn.timestamp, !this.targetDelta && !this.relativeTarget) { + const x = this.getClosestProjectingParent(); + x && x.layout && this.animationProgress !== 1 ? (this.relativeParent = x, this.forceRelativeParentToResolveTarget(), this.relativeTarget = fn(), this.relativeTargetOrigin = fn(), uf(this.relativeTargetOrigin, this.layout.layoutBox, x.layout.layoutBox), Fi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; + } + if (!(!this.relativeTarget && !this.targetDelta)) { + if (this.target || (this.target = fn(), this.targetWithTransforms = fn()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), AX(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : Fi(this.target, this.layout.layoutBox), E7(this.target, this.targetDelta)) : Fi(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget) { + this.attemptToResolveRelativeTarget = !1; + const x = this.getClosestProjectingParent(); + x && !!x.resumingFrom == !!this.resumingFrom && !x.options.layoutScroll && x.target && this.animationProgress !== 1 ? (this.relativeParent = x, this.forceRelativeParentToResolveTarget(), this.relativeTarget = fn(), this.relativeTargetOrigin = fn(), uf(this.relativeTargetOrigin, this.target, x.target), Fi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; + } + Qu && wa.resolvedTargetDeltas++; + } + } + } + getClosestProjectingParent() { + if (!(!this.parent || Bv(this.parent.latestValues) || _7(this.parent.latestValues))) + return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent(); + } + isProjecting() { + return !!((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout); + } + calcProjection() { + var o; + const a = this.getLead(), f = !!this.resumingFrom || this !== a; + let u = !0; + if ((this.isProjectionDirty || !((o = this.parent) === null || o === void 0) && o.isProjectionDirty) && (u = !1), f && (this.isSharedProjectionDirty || this.isTransformDirty) && (u = !1), this.resolvedRelativeTargetAt === Nn.timestamp && (u = !1), u) + return; + const { layout: h, layoutId: g } = this.options; + if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(h || g)) + return; + Fi(this.layoutCorrected, this.layout.layoutBox); + const v = this.treeScale.x, x = this.treeScale.y; + NX(this.layoutCorrected, this.treeScale, this.path, f), a.layout && !a.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (a.target = a.layout.layoutBox, a.targetWithTransforms = fn()); + const { target: S } = a; + if (!S) { + this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender()); + return; + } + !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (o5(this.prevProjectionDelta.x, this.projectionDelta.x), o5(this.prevProjectionDelta.y, this.projectionDelta.y)), cf(this.projectionDelta, this.layoutCorrected, S, this.latestValues), (this.treeScale.x !== v || this.treeScale.y !== x || !p5(this.projectionDelta.x, this.prevProjectionDelta.x) || !p5(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", S)), Qu && wa.recalculatedProjection++; + } + hide() { + this.isVisible = !1; + } + show() { + this.isVisible = !0; + } + scheduleRender(o = !0) { + var a; + if ((a = this.options.visualElement) === null || a === void 0 || a.scheduleRender(), o) { + const f = this.getStack(); + f && f.scheduleRender(); + } + this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0); + } + createProjectionDeltas() { + this.prevProjectionDelta = Sc(), this.projectionDelta = Sc(), this.projectionDeltaWithTransform = Sc(); + } + setAnimationOrigin(o, a = !1) { + const f = this.snapshot, u = f ? f.latestValues : {}, h = { ...this.latestValues }, g = Sc(); + (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !a; + const v = fn(), x = f ? f.source : void 0, S = this.layout ? this.layout.source : void 0, C = x !== S, D = this.getStack(), $ = !D || D.members.length <= 1, N = !!(C && !$ && this.options.crossfade === !0 && !this.path.some(xZ)); + this.animationProgress = 0; + let z; + this.mixTargetDelta = (k) => { + const B = k / 1e3; + b5(g.x, o.x, B), b5(g.y, o.y, B), this.setTargetDelta(g), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (uf(v, this.layout.layoutBox, this.relativeParent.layout.layoutBox), wZ(this.relativeTarget, this.relativeTargetOrigin, v, B), z && QX(this.relativeTarget, z) && (this.isProjectionDirty = !1), z || (z = fn()), Fi(z, this.relativeTarget)), C && (this.animationValues = h, VX(h, u, this.latestValues, B, N, $)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = B; + }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0); + } + startAnimation(o) { + this.notifyListeners("animationStart"), this.currentAnimation && this.currentAnimation.stop(), this.resumingFrom && this.resumingFrom.currentAnimation && this.resumingFrom.currentAnimation.stop(), this.pendingAnimation && (Vo(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = kr.update(() => { + td.hasAnimatedSinceResize = !0, this.currentAnimation = oZ(0, g5, { + ...o, + onUpdate: (a) => { + this.mixTargetDelta(a), o.onUpdate && o.onUpdate(a); + }, + onComplete: () => { + o.onComplete && o.onComplete(), this.completeAnimation(); + } + }), this.resumingFrom && (this.resumingFrom.currentAnimation = this.currentAnimation), this.pendingAnimation = void 0; + }); + } + completeAnimation() { + this.resumingFrom && (this.resumingFrom.currentAnimation = void 0, this.resumingFrom.preserveOpacity = void 0); + const o = this.getStack(); + o && o.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete"); + } + finishAnimation() { + this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(g5), this.currentAnimation.stop()), this.completeAnimation(); + } + applyTransformsToTarget() { + const o = this.getLead(); + let { targetWithTransforms: a, target: f, layout: u, latestValues: h } = o; + if (!(!a || !f || !u)) { + if (this !== o && this.layout && u && N7(this.options.animationType, this.layout.layoutBox, u.layoutBox)) { + f = this.target || fn(); + const g = Pi(this.layout.layoutBox.x); + f.x.min = o.target.x.min, f.x.max = f.x.min + g; + const v = Pi(this.layout.layoutBox.y); + f.y.min = o.target.y.min, f.y.max = f.y.min + v; + } + Fi(a, f), Pc(a, h), cf(this.projectionDeltaWithTransform, this.layoutCorrected, a, h); + } + } + registerSharedNode(o, a) { + this.sharedNodes.has(o) || this.sharedNodes.set(o, new eZ()), this.sharedNodes.get(o).add(a); + const u = a.options.initialPromotionConfig; + a.promote({ + transition: u ? u.transition : void 0, + preserveFollowOpacity: u && u.shouldPreserveFollowOpacity ? u.shouldPreserveFollowOpacity(a) : void 0 + }); + } + isLead() { + const o = this.getStack(); + return o ? o.lead === this : !0; + } + getLead() { + var o; + const { layoutId: a } = this.options; + return a ? ((o = this.getStack()) === null || o === void 0 ? void 0 : o.lead) || this : this; + } + getPrevLead() { + var o; + const { layoutId: a } = this.options; + return a ? (o = this.getStack()) === null || o === void 0 ? void 0 : o.prevLead : void 0; + } + getStack() { + const { layoutId: o } = this.options; + if (o) + return this.root.sharedNodes.get(o); + } + promote({ needsReset: o, transition: a, preserveFollowOpacity: f } = {}) { + const u = this.getStack(); + u && u.promote(this, f), o && (this.projectionDelta = void 0, this.needsReset = !0), a && this.setOptions({ transition: a }); + } + relegate() { + const o = this.getStack(); + return o ? o.relegate(this) : !1; + } + resetSkewAndRotation() { + const { visualElement: o } = this.options; + if (!o) + return; + let a = !1; + const { latestValues: f } = o; + if ((f.z || f.rotate || f.rotateX || f.rotateY || f.rotateZ || f.skewX || f.skewY) && (a = !0), !a) + return; + const u = {}; + f.z && Mm("z", o, u, this.animationValues); + for (let h = 0; h < Pm.length; h++) + Mm(`rotate${Pm[h]}`, o, u, this.animationValues), Mm(`skew${Pm[h]}`, o, u, this.animationValues); + o.render(); + for (const h in u) + o.setStaticValue(h, u[h]), this.animationValues && (this.animationValues[h] = u[h]); + o.scheduleRender(); + } + getProjectionStyles(o) { + var a, f; + if (!this.instance || this.isSVG) + return; + if (!this.isVisible) + return aZ; + const u = { + visibility: "" + }, h = this.getTransformTemplate(); + if (this.needsReset) + return this.needsReset = !1, u.opacity = "", u.pointerEvents = rd(o?.pointerEvents) || "", u.transform = h ? h(this.latestValues, "") : "none", u; + const g = this.getLead(); + if (!this.projectionDelta || !this.layout || !g.target) { + const C = {}; + return this.options.layoutId && (C.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, C.pointerEvents = rd(o?.pointerEvents) || ""), this.hasProjected && !ya(this.latestValues) && (C.transform = h ? h({}, "") : "none", this.hasProjected = !1), C; + } + const v = g.animationValues || g.latestValues; + this.applyTransformsToTarget(), u.transform = tZ(this.projectionDeltaWithTransform, this.treeScale, v), h && (u.transform = h(v, u.transform)); + const { x, y: S } = this.projectionDelta; + u.transformOrigin = `${x.origin * 100}% ${S.origin * 100}% 0`, g.animationValues ? u.opacity = g === this ? (f = (a = v.opacity) !== null && a !== void 0 ? a : this.latestValues.opacity) !== null && f !== void 0 ? f : 1 : this.preserveOpacity ? this.latestValues.opacity : v.opacityExit : u.opacity = g === this ? v.opacity !== void 0 ? v.opacity : "" : v.opacityExit !== void 0 ? v.opacityExit : 0; + for (const C in Od) { + if (v[C] === void 0) + continue; + const { correct: D, applyTo: $ } = Od[C], N = u.transform === "none" ? v[C] : D(v[C], g); + if ($) { + const z = $.length; + for (let k = 0; k < z; k++) + u[$[k]] = N; + } else + u[C] = N; + } + return this.options.layoutId && (u.pointerEvents = g === this ? rd(o?.pointerEvents) || "" : "none"), u; + } + clearSnapshot() { + this.resumeFrom = this.snapshot = void 0; + } + // Only run on root + resetTree() { + this.root.nodes.forEach((o) => { + var a; + return (a = o.currentAnimation) === null || a === void 0 ? void 0 : a.stop(); + }), this.root.nodes.forEach(m5), this.root.sharedNodes.clear(); + } + }; +} +function uZ(t) { + t.updateLayout(); +} +function fZ(t) { + var e; + const r = ((e = t.resumeFrom) === null || e === void 0 ? void 0 : e.snapshot) || t.snapshot; + if (t.isLead() && t.layout && r && t.hasListeners("didUpdate")) { + const { layoutBox: n, measuredBox: i } = t.layout, { animationType: s } = t.options, o = r.source !== t.layout.source; + s === "size" ? Ui((g) => { + const v = o ? r.measuredBox[g] : r.layoutBox[g], x = Pi(v); + v.min = n[g].min, v.max = v.min + x; + }) : N7(s, r.layoutBox, n) && Ui((g) => { + const v = o ? r.measuredBox[g] : r.layoutBox[g], x = Pi(n[g]); + v.max = v.min + x, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[g].max = t.relativeTarget[g].min + x); + }); + const a = Sc(); + cf(a, n, r.layoutBox); + const f = Sc(); + o ? cf(f, t.applyTransform(i, !0), r.measuredBox) : cf(f, n, r.layoutBox); + const u = !R7(a); + let h = !1; + if (!t.resumeFrom) { + const g = t.getClosestProjectingParent(); + if (g && !g.resumeFrom) { + const { snapshot: v, layout: x } = g; + if (v && x) { + const S = fn(); + uf(S, r.layoutBox, v.layoutBox); + const C = fn(); + uf(C, n, x.layoutBox), T7(S, C) || (h = !0), g.options.layoutRoot && (t.relativeTarget = C, t.relativeTargetOrigin = S, t.relativeParent = g); + } + } + } + t.notifyListeners("didUpdate", { + layout: n, + snapshot: r, + delta: f, + layoutDelta: a, + hasLayoutChanged: u, + hasRelativeTargetChanged: h + }); + } else if (t.isLead()) { + const { onExitComplete: n } = t.options; + n && n(); + } + t.options.transition = void 0; +} +function lZ(t) { + Qu && wa.totalNodes++, t.parent && (t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty), t.isSharedProjectionDirty || (t.isSharedProjectionDirty = !!(t.isProjectionDirty || t.parent.isProjectionDirty || t.parent.isSharedProjectionDirty)), t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty)); +} +function hZ(t) { + t.isProjectionDirty = t.isSharedProjectionDirty = t.isTransformDirty = !1; +} +function dZ(t) { + t.clearSnapshot(); +} +function m5(t) { + t.clearMeasurements(); +} +function pZ(t) { + t.isLayoutDirty = !1; +} +function gZ(t) { + const { visualElement: e } = t.options; + e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform(); +} +function v5(t) { + t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0; +} +function mZ(t) { + t.resolveTargetDelta(); +} +function vZ(t) { + t.calcProjection(); +} +function bZ(t) { + t.resetSkewAndRotation(); +} +function yZ(t) { + t.removeLeadSnapshot(); +} +function b5(t, e, r) { + t.translate = Qr(e.translate, 0, r), t.scale = Qr(e.scale, 1, r), t.origin = e.origin, t.originPoint = e.originPoint; +} +function y5(t, e, r, n) { + t.min = Qr(e.min, r.min, n), t.max = Qr(e.max, r.max, n); +} +function wZ(t, e, r, n) { + y5(t.x, e.x, r.x, n), y5(t.y, e.y, r.y, n); +} +function xZ(t) { + return t.animationValues && t.animationValues.opacityExit !== void 0; +} +const _Z = { + duration: 0.45, + ease: [0.4, 0, 0.1, 1] +}, w5 = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), x5 = w5("applewebkit/") && !w5("chrome/") ? Math.round : kn; +function _5(t) { + t.min = x5(t.min), t.max = x5(t.max); +} +function EZ(t) { + _5(t.x), _5(t.y); +} +function N7(t, e, r) { + return t === "position" || t === "preserve-aspect" && !SX(d5(e), d5(r), 0.2); +} +function SZ(t) { + var e; + return t !== t.root && ((e = t.scroll) === null || e === void 0 ? void 0 : e.wasRoot); +} +const AZ = O7({ + attachResizeListener: (t, e) => no(t, "resize", e), + measureScroll: () => ({ + x: document.documentElement.scrollLeft || document.body.scrollLeft, + y: document.documentElement.scrollTop || document.body.scrollTop + }), + checkIsScrollRoot: () => !0 +}), Im = { + current: void 0 +}, L7 = O7({ + measureScroll: (t) => ({ + x: t.scrollLeft, + y: t.scrollTop + }), + defaultParent: () => { + if (!Im.current) { + const t = new AZ({}); + t.mount(window), t.setOptions({ layoutScroll: !0 }), Im.current = t; + } + return Im.current; + }, + resetTransform: (t, e) => { + t.style.transform = e !== void 0 ? e : "none"; + }, + checkIsScrollRoot: (t) => window.getComputedStyle(t).position === "fixed" +}), PZ = { + pan: { + Feature: jX + }, + drag: { + Feature: FX, + ProjectionNode: L7, + MeasureLayout: M7 + } +}; +function E5(t, e) { + const r = e ? "pointerenter" : "pointerleave", n = e ? "onHoverStart" : "onHoverEnd", i = (s, o) => { + if (s.pointerType === "touch" || b7()) + return; + const a = t.getProps(); + t.animationState && a.whileHover && t.animationState.setActive("whileHover", e); + const f = a[n]; + f && kr.postRender(() => f(s, o)); + }; + return co(t.current, r, i, { + passive: !t.getProps()[n] + }); +} +class MZ extends ea { + mount() { + this.unmount = ao(E5(this.node, !0), E5(this.node, !1)); + } + unmount() { + } +} +class IZ extends ea { + constructor() { + super(...arguments), this.isActive = !1; + } + onFocus() { + let e = !1; + try { + e = this.node.current.matches(":focus-visible"); + } catch { + e = !0; + } + !e || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0); + } + onBlur() { + !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1); + } + mount() { + this.unmount = ao(no(this.node.current, "focus", () => this.onFocus()), no(this.node.current, "blur", () => this.onBlur())); + } + unmount() { + } +} +const k7 = (t, e) => e ? t === e ? !0 : k7(t, e.parentElement) : !1; +function Cm(t, e) { + if (!e) + return; + const r = new PointerEvent("pointer" + t); + e(r, w0(r)); +} +class CZ extends ea { + constructor() { + super(...arguments), this.removeStartListeners = kn, this.removeEndListeners = kn, this.removeAccessibleListeners = kn, this.startPointerPress = (e, r) => { + if (this.isPressing) + return; + this.removeEndListeners(); + const n = this.node.getProps(), s = co(window, "pointerup", (a, f) => { + if (!this.checkPressEnd()) + return; + const { onTap: u, onTapCancel: h, globalTapTarget: g } = this.node.getProps(), v = !g && !k7(this.node.current, a.target) ? h : u; + v && kr.update(() => v(a, f)); + }, { + passive: !(n.onTap || n.onPointerUp) + }), o = co(window, "pointercancel", (a, f) => this.cancelPress(a, f), { + passive: !(n.onTapCancel || n.onPointerCancel) + }); + this.removeEndListeners = ao(s, o), this.startPress(e, r); + }, this.startAccessiblePress = () => { + const e = (s) => { + if (s.key !== "Enter" || this.isPressing) + return; + const o = (a) => { + a.key !== "Enter" || !this.checkPressEnd() || Cm("up", (f, u) => { + const { onTap: h } = this.node.getProps(); + h && kr.postRender(() => h(f, u)); + }); + }; + this.removeEndListeners(), this.removeEndListeners = no(this.node.current, "keyup", o), Cm("down", (a, f) => { + this.startPress(a, f); + }); + }, r = no(this.node.current, "keydown", e), n = () => { + this.isPressing && Cm("cancel", (s, o) => this.cancelPress(s, o)); + }, i = no(this.node.current, "blur", n); + this.removeAccessibleListeners = ao(r, i); + }; + } + startPress(e, r) { + this.isPressing = !0; + const { onTapStart: n, whileTap: i } = this.node.getProps(); + i && this.node.animationState && this.node.animationState.setActive("whileTap", !0), n && kr.postRender(() => n(e, r)); + } + checkPressEnd() { + return this.removeEndListeners(), this.isPressing = !1, this.node.getProps().whileTap && this.node.animationState && this.node.animationState.setActive("whileTap", !1), !b7(); + } + cancelPress(e, r) { + if (!this.checkPressEnd()) + return; + const { onTapCancel: n } = this.node.getProps(); + n && kr.postRender(() => n(e, r)); + } + mount() { + const e = this.node.getProps(), r = co(e.globalTapTarget ? window : this.node.current, "pointerdown", this.startPointerPress, { + passive: !(e.onTapStart || e.onPointerStart) + }), n = no(this.node.current, "focus", this.startAccessiblePress); + this.removeStartListeners = ao(r, n); + } + unmount() { + this.removeStartListeners(), this.removeEndListeners(), this.removeAccessibleListeners(); + } +} +const jv = /* @__PURE__ */ new WeakMap(), Rm = /* @__PURE__ */ new WeakMap(), RZ = (t) => { + const e = jv.get(t.target); + e && e(t); +}, TZ = (t) => { + t.forEach(RZ); +}; +function DZ({ root: t, ...e }) { + const r = t || document; + Rm.has(r) || Rm.set(r, {}); + const n = Rm.get(r), i = JSON.stringify(e); + return n[i] || (n[i] = new IntersectionObserver(TZ, { root: t, ...e })), n[i]; +} +function OZ(t, e, r) { + const n = DZ(e); + return jv.set(t, r), n.observe(t), () => { + jv.delete(t), n.unobserve(t); + }; +} +const NZ = { + some: 0, + all: 1 +}; +class LZ extends ea { + constructor() { + super(...arguments), this.hasEnteredView = !1, this.isInView = !1; + } + startObserver() { + this.unmount(); + const { viewport: e = {} } = this.node.getProps(), { root: r, margin: n, amount: i = "some", once: s } = e, o = { + root: r ? r.current : void 0, + rootMargin: n, + threshold: typeof i == "number" ? i : NZ[i] + }, a = (f) => { + const { isIntersecting: u } = f; + if (this.isInView === u || (this.isInView = u, s && !u && this.hasEnteredView)) + return; + u && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", u); + const { onViewportEnter: h, onViewportLeave: g } = this.node.getProps(), v = u ? h : g; + v && v(f); + }; + return OZ(this.node.current, o, a); + } + mount() { + this.startObserver(); + } + update() { + if (typeof IntersectionObserver > "u") + return; + const { props: e, prevProps: r } = this.node; + ["amount", "margin", "root"].some(kZ(e, r)) && this.startObserver(); + } + unmount() { + } +} +function kZ({ viewport: t = {} }, { viewport: e = {} } = {}) { + return (r) => t[r] !== e[r]; +} +const $Z = { + inView: { + Feature: LZ + }, + tap: { + Feature: CZ + }, + focus: { + Feature: IZ + }, + hover: { + Feature: MZ + } +}, BZ = { + layout: { + ProjectionNode: L7, + MeasureLayout: M7 + } +}, gb = Xo({ + transformPagePoint: (t) => t, + isStatic: !1, + reducedMotion: "never" +}), _0 = Xo({}), mb = typeof window < "u", $7 = mb ? hT : Rn, B7 = Xo({ strict: !1 }); +function FZ(t, e, r, n, i) { + var s, o; + const { visualElement: a } = In(_0), f = In(B7), u = In(x0), h = In(gb).reducedMotion, g = Kn(); + n = n || f.renderer, !g.current && n && (g.current = n(t, { + visualState: e, + parent: a, + props: r, + presenceContext: u, + blockInitialAnimation: u ? u.initial === !1 : !1, + reducedMotionConfig: h + })); + const v = g.current, x = In(P7); + v && !v.projection && i && (v.type === "html" || v.type === "svg") && jZ(g.current, r, i, x); + const S = Kn(!1); + H5(() => { + v && S.current && v.update(r, u); + }); + const C = r[u7], D = Kn(!!C && !(!((s = window.MotionHandoffIsComplete) === null || s === void 0) && s.call(window, C)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, C))); + return $7(() => { + v && (S.current = !0, window.MotionIsMounted = !0, v.updateFeatures(), pb.render(v.render), D.current && v.animationState && v.animationState.animateChanges()); + }), Rn(() => { + v && (!D.current && v.animationState && v.animationState.animateChanges(), D.current && (queueMicrotask(() => { + var $; + ($ = window.MotionHandoffMarkAsComplete) === null || $ === void 0 || $.call(window, C); + }), D.current = !1)); + }), v; +} +function jZ(t, e, r, n) { + const { layoutId: i, layout: s, drag: o, dragConstraints: a, layoutScroll: f, layoutRoot: u } = e; + t.projection = new r(t.latestValues, e["data-framer-portal-id"] ? void 0 : F7(t.parent)), t.projection.setOptions({ + layoutId: i, + layout: s, + alwaysMeasureLayout: !!o || a && Ec(a), + visualElement: t, + /** + * TODO: Update options in an effect. This could be tricky as it'll be too late + * to update by the time layout animations run. + * We also need to fix this safeToRemove by linking it up to the one returned by usePresence, + * ensuring it gets called if there's no potential layout animations. + * + */ + animationType: typeof s == "string" ? s : "both", + initialPromotionConfig: n, + layoutScroll: f, + layoutRoot: u + }); +} +function F7(t) { + if (t) + return t.options.allowProjection !== !1 ? t.projection : F7(t.parent); +} +function UZ(t, e, r) { + return Gv( + (n) => { + n && t.mount && t.mount(n), e && (n ? e.mount(n) : e.unmount()), r && (typeof r == "function" ? r(n) : Ec(r) && (r.current = n)); + }, + /** + * Only pass a new ref callback to React if we've received a visual element + * factory. Otherwise we'll be mounting/remounting every time externalRef + * or other dependencies change. + */ + [e] + ); +} +function E0(t) { + return v0(t.animate) || V1.some((e) => jf(t[e])); +} +function j7(t) { + return !!(E0(t) || t.variants); +} +function qZ(t, e) { + if (E0(t)) { + const { initial: r, animate: n } = t; + return { + initial: r === !1 || jf(r) ? r : void 0, + animate: jf(n) ? n : void 0 + }; + } + return t.inherit !== !1 ? e : {}; +} +function zZ(t) { + const { initial: e, animate: r } = qZ(t, In(_0)); + return hi(() => ({ initial: e, animate: r }), [S5(e), S5(r)]); +} +function S5(t) { + return Array.isArray(t) ? t.join(" ") : t; +} +const A5 = { + animation: [ + "animate", + "variants", + "whileHover", + "whileTap", + "exit", + "whileInView", + "whileFocus", + "whileDrag" + ], + exit: ["exit"], + drag: ["drag", "dragControls"], + focus: ["whileFocus"], + hover: ["whileHover", "onHoverStart", "onHoverEnd"], + tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"], + pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"], + inView: ["whileInView", "onViewportEnter", "onViewportLeave"], + layout: ["layout", "layoutId"] +}, Wc = {}; +for (const t in A5) + Wc[t] = { + isEnabled: (e) => A5[t].some((r) => !!e[r]) + }; +function HZ(t) { + for (const e in t) + Wc[e] = { + ...Wc[e], + ...t[e] + }; +} +const WZ = Symbol.for("motionComponentSymbol"); +function KZ({ preloadedFeatures: t, createVisualElement: e, useRender: r, useVisualState: n, Component: i }) { + t && HZ(t); + function s(a, f) { + let u; + const h = { + ...In(gb), + ...a, + layoutId: VZ(a) + }, { isStatic: g } = h, v = zZ(a), x = n(a, g); + if (!g && mb) { + GZ(h, t); + const S = YZ(h); + u = S.MeasureLayout, v.visualElement = FZ(i, x, h, e, S.ProjectionNode); + } + return pe.jsxs(_0.Provider, { value: v, children: [u && v.visualElement ? pe.jsx(u, { visualElement: v.visualElement, ...h }) : null, r(i, a, UZ(x, v.visualElement, f), x, g, v.visualElement)] }); + } + const o = Kv(s); + return o[WZ] = i, o; +} +function VZ({ layoutId: t }) { + const e = In(db).id; + return e && t !== void 0 ? e + "-" + t : t; +} +function GZ(t, e) { + const r = In(B7).strict; + if (process.env.NODE_ENV !== "production" && e && r) { + const n = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead."; + t.ignoreStrict ? Qc(!1, n) : po(!1, n); + } +} +function YZ(t) { + const { drag: e, layout: r } = Wc; + if (!e && !r) + return {}; + const n = { ...e, ...r }; + return { + MeasureLayout: e?.isEnabled(t) || r?.isEnabled(t) ? n.MeasureLayout : void 0, + ProjectionNode: n.ProjectionNode + }; +} +const JZ = [ + "animate", + "circle", + "defs", + "desc", + "ellipse", + "g", + "image", + "line", + "filter", + "marker", + "mask", + "metadata", + "path", + "pattern", + "polygon", + "polyline", + "rect", + "stop", + "switch", + "symbol", + "svg", + "text", + "tspan", + "use", + "view" +]; +function vb(t) { + return ( + /** + * If it's not a string, it's a custom React component. Currently we only support + * HTML custom React components. + */ + typeof t != "string" || /** + * If it contains a dash, the element is a custom HTML webcomponent. + */ + t.includes("-") ? !1 : ( + /** + * If it's in our list of lowercase SVG tags, it's an SVG component + */ + !!(JZ.indexOf(t) > -1 || /** + * If it contains a capital letter, it's an SVG component + */ + /[A-Z]/u.test(t)) + ) + ); +} +function U7(t, { style: e, vars: r }, n, i) { + Object.assign(t.style, e, i && i.getProjectionStyles(n)); + for (const s in r) + t.style.setProperty(s, r[s]); +} +const q7 = /* @__PURE__ */ new Set([ + "baseFrequency", + "diffuseConstant", + "kernelMatrix", + "kernelUnitLength", + "keySplines", + "keyTimes", + "limitingConeAngle", + "markerHeight", + "markerWidth", + "numOctaves", + "targetX", + "targetY", + "surfaceScale", + "specularConstant", + "specularExponent", + "stdDeviation", + "tableValues", + "viewBox", + "gradientTransform", + "pathLength", + "startOffset", + "textLength", + "lengthAdjust" +]); +function z7(t, e, r, n) { + U7(t, e, void 0, n); + for (const i in e.attrs) + t.setAttribute(q7.has(i) ? i : hb(i), e.attrs[i]); +} +function H7(t, { layout: e, layoutId: r }) { + return Ya.has(t) || t.startsWith("origin") || (e || r !== void 0) && (!!Od[t] || t === "opacity"); +} +function bb(t, e, r) { + var n; + const { style: i } = t, s = {}; + for (const o in i) + (Wn(i[o]) || e.style && Wn(e.style[o]) || H7(o, t) || ((n = r?.getValue(o)) === null || n === void 0 ? void 0 : n.liveStyle) !== void 0) && (s[o] = i[o]); + return s; +} +function W7(t, e, r) { + const n = bb(t, e, r); + for (const i in t) + if (Wn(t[i]) || Wn(e[i])) { + const s = dl.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i; + n[s] = t[i]; + } + return n; +} +function yb(t) { + const e = Kn(null); + return e.current === null && (e.current = t()), e.current; +} +function XZ({ scrapeMotionValuesFromProps: t, createRenderState: e, onMount: r }, n, i, s) { + const o = { + latestValues: ZZ(n, i, s, t), + renderState: e() + }; + return r && (o.mount = (a) => r(n, a, o)), o; +} +const K7 = (t) => (e, r) => { + const n = In(_0), i = In(x0), s = () => XZ(t, e, n, i); + return r ? s() : yb(s); +}; +function ZZ(t, e, r, n) { + const i = {}, s = n(t, {}); + for (const v in s) + i[v] = rd(s[v]); + let { initial: o, animate: a } = t; + const f = E0(t), u = j7(t); + e && u && !f && t.inherit !== !1 && (o === void 0 && (o = e.initial), a === void 0 && (a = e.animate)); + let h = r ? r.initial === !1 : !1; + h = h || o === !1; + const g = h ? a : o; + if (g && typeof g != "boolean" && !v0(g)) { + const v = Array.isArray(g) ? g : [g]; + for (let x = 0; x < v.length; x++) { + const S = W1(t, v[x]); + if (S) { + const { transitionEnd: C, transition: D, ...$ } = S; + for (const N in $) { + let z = $[N]; + if (Array.isArray(z)) { + const k = h ? z.length - 1 : 0; + z = z[k]; + } + z !== null && (i[N] = z); + } + for (const N in C) + i[N] = C[N]; + } + } + } + return i; +} +const wb = () => ({ + style: {}, + transform: {}, + transformOrigin: {}, + vars: {} +}), V7 = () => ({ + ...wb(), + attrs: {} +}), G7 = (t, e) => e && typeof t == "number" ? e.transform(t) : t, QZ = { + x: "translateX", + y: "translateY", + z: "translateZ", + transformPerspective: "perspective" +}, eQ = dl.length; +function tQ(t, e, r) { + let n = "", i = !0; + for (let s = 0; s < eQ; s++) { + const o = dl[s], a = t[o]; + if (a === void 0) + continue; + let f = !0; + if (typeof a == "number" ? f = a === (o.startsWith("scale") ? 1 : 0) : f = parseFloat(a) === 0, !f || r) { + const u = G7(a, tb[o]); + if (!f) { + i = !1; + const h = QZ[o] || o; + n += `${h}(${u}) `; + } + r && (e[o] = u); + } + } + return n = n.trim(), r ? n = r(e, i ? "" : n) : i && (n = "none"), n; +} +function xb(t, e, r) { + const { style: n, vars: i, transformOrigin: s } = t; + let o = !1, a = !1; + for (const f in e) { + const u = e[f]; + if (Ya.has(f)) { + o = !0; + continue; + } else if (jS(f)) { + i[f] = u; + continue; + } else { + const h = G7(u, tb[f]); + f.startsWith("origin") ? (a = !0, s[f] = h) : n[f] = h; + } + } + if (e.transform || (o || r ? n.transform = tQ(e, t.transform, r) : n.transform && (n.transform = "none")), a) { + const { originX: f = "50%", originY: u = "50%", originZ: h = 0 } = s; + n.transformOrigin = `${f} ${u} ${h}`; + } +} +function P5(t, e, r) { + return typeof t == "string" ? t : Vt.transform(e + r * t); +} +function rQ(t, e, r) { + const n = P5(e, t.x, t.width), i = P5(r, t.y, t.height); + return `${n} ${i}`; +} +const nQ = { + offset: "stroke-dashoffset", + array: "stroke-dasharray" +}, iQ = { + offset: "strokeDashoffset", + array: "strokeDasharray" +}; +function sQ(t, e, r = 1, n = 0, i = !0) { + t.pathLength = 1; + const s = i ? nQ : iQ; + t[s.offset] = Vt.transform(-n); + const o = Vt.transform(e), a = Vt.transform(r); + t[s.array] = `${o} ${a}`; +} +function _b(t, { + attrX: e, + attrY: r, + attrScale: n, + originX: i, + originY: s, + pathLength: o, + pathSpacing: a = 1, + pathOffset: f = 0, + // This is object creation, which we try to avoid per-frame. + ...u +}, h, g) { + if (xb(t, u, g), h) { + t.style.viewBox && (t.attrs.viewBox = t.style.viewBox); + return; + } + t.attrs = t.style, t.style = {}; + const { attrs: v, style: x, dimensions: S } = t; + v.transform && (S && (x.transform = v.transform), delete v.transform), S && (i !== void 0 || s !== void 0 || x.transform) && (x.transformOrigin = rQ(S, i !== void 0 ? i : 0.5, s !== void 0 ? s : 0.5)), e !== void 0 && (v.x = e), r !== void 0 && (v.y = r), n !== void 0 && (v.scale = n), o !== void 0 && sQ(v, o, a, f, !1); +} +const Eb = (t) => typeof t == "string" && t.toLowerCase() === "svg", oQ = { + useVisualState: K7({ + scrapeMotionValuesFromProps: W7, + createRenderState: V7, + onMount: (t, e, { renderState: r, latestValues: n }) => { + kr.read(() => { + try { + r.dimensions = typeof e.getBBox == "function" ? e.getBBox() : e.getBoundingClientRect(); + } catch { + r.dimensions = { + x: 0, + y: 0, + width: 0, + height: 0 + }; + } + }), kr.render(() => { + _b(r, n, Eb(e.tagName), t.transformTemplate), z7(e, r); + }); + } + }) +}, aQ = { + useVisualState: K7({ + scrapeMotionValuesFromProps: bb, + createRenderState: wb + }) +}; +function Y7(t, e, r) { + for (const n in e) + !Wn(e[n]) && !H7(n, r) && (t[n] = e[n]); +} +function cQ({ transformTemplate: t }, e) { + return hi(() => { + const r = wb(); + return xb(r, e, t), Object.assign({}, r.vars, r.style); + }, [e]); +} +function uQ(t, e) { + const r = t.style || {}, n = {}; + return Y7(n, r, t), Object.assign(n, cQ(t, e)), n; +} +function fQ(t, e) { + const r = {}, n = uQ(t, e); + return t.drag && t.dragListener !== !1 && (r.draggable = !1, n.userSelect = n.WebkitUserSelect = n.WebkitTouchCallout = "none", n.touchAction = t.drag === !0 ? "none" : `pan-${t.drag === "x" ? "y" : "x"}`), t.tabIndex === void 0 && (t.onTap || t.onTapStart || t.whileTap) && (r.tabIndex = 0), r.style = n, r; +} +const lQ = /* @__PURE__ */ new Set([ + "animate", + "exit", + "variants", + "initial", + "style", + "values", + "variants", + "transition", + "transformTemplate", + "custom", + "inherit", + "onBeforeLayoutMeasure", + "onAnimationStart", + "onAnimationComplete", + "onUpdate", + "onDragStart", + "onDrag", + "onDragEnd", + "onMeasureDragConstraints", + "onDirectionLock", + "onDragTransitionEnd", + "_dragX", + "_dragY", + "onHoverStart", + "onHoverEnd", + "onViewportEnter", + "onViewportLeave", + "globalTapTarget", + "ignoreStrict", + "viewport" +]); +function Nd(t) { + return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || lQ.has(t); +} +let J7 = (t) => !Nd(t); +function hQ(t) { + t && (J7 = (e) => e.startsWith("on") ? !Nd(e) : t(e)); +} +try { + hQ(require("@emotion/is-prop-valid").default); +} catch { +} +function dQ(t, e, r) { + const n = {}; + for (const i in t) + i === "values" && typeof t.values == "object" || (J7(i) || r === !0 && Nd(i) || !e && !Nd(i) || // If trying to use native HTML drag events, forward drag listeners + t.draggable && i.startsWith("onDrag")) && (n[i] = t[i]); + return n; +} +function pQ(t, e, r, n) { + const i = hi(() => { + const s = V7(); + return _b(s, e, Eb(n), t.transformTemplate), { + ...s.attrs, + style: { ...s.style } + }; + }, [e]); + if (t.style) { + const s = {}; + Y7(s, t.style, t), i.style = { ...s, ...i.style }; + } + return i; +} +function gQ(t = !1) { + return (r, n, i, { latestValues: s }, o) => { + const f = (vb(r) ? pQ : fQ)(n, s, o, r), u = dQ(n, typeof r == "string", t), h = r !== W5 ? { ...u, ...f, ref: i } : {}, { children: g } = n, v = hi(() => Wn(g) ? g.get() : g, [g]); + return sd(r, { + ...h, + children: v + }); + }; +} +function mQ(t, e) { + return function(n, { forwardMotionProps: i } = { forwardMotionProps: !1 }) { + const o = { + ...vb(n) ? oQ : aQ, + preloadedFeatures: t, + useRender: gQ(i), + createVisualElement: e, + Component: n + }; + return KZ(o); + }; +} +const Uv = { current: null }, X7 = { current: !1 }; +function vQ() { + if (X7.current = !0, !!mb) + if (window.matchMedia) { + const t = window.matchMedia("(prefers-reduced-motion)"), e = () => Uv.current = t.matches; + t.addListener(e), e(); + } else + Uv.current = !1; +} +function bQ(t, e, r) { + for (const n in e) { + const i = e[n], s = r[n]; + if (Wn(i)) + t.addValue(n, i), process.env.NODE_ENV === "development" && m0(i.version === "11.11.17", `Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`); + else if (Wn(s)) + t.addValue(n, zf(i, { owner: t })); + else if (s !== i) + if (t.hasValue(n)) { + const o = t.getValue(n); + o.liveStyle === !0 ? o.jump(i) : o.hasAnimated || o.set(i); + } else { + const o = t.getStaticValue(n); + t.addValue(n, zf(o !== void 0 ? o : i, { owner: t })); + } + } + for (const n in r) + e[n] === void 0 && t.removeValue(n); + return e; +} +const M5 = /* @__PURE__ */ new WeakMap(), yQ = [...zS, qn, Yo], wQ = (t) => yQ.find(qS(t)), I5 = [ + "AnimationStart", + "AnimationComplete", + "Update", + "BeforeLayoutMeasure", + "LayoutMeasure", + "LayoutAnimationStart", + "LayoutAnimationComplete" +]; +class xQ { + /** + * This method takes React props and returns found MotionValues. For example, HTML + * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays. + * + * This isn't an abstract method as it needs calling in the constructor, but it is + * intended to be one. + */ + scrapeMotionValuesFromProps(e, r, n) { + return {}; + } + constructor({ parent: e, props: r, presenceContext: n, reducedMotionConfig: i, blockInitialAnimation: s, visualState: o }, a = {}) { + this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = Z1, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => { + this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection)); + }, this.renderScheduledAt = 0, this.scheduleRender = () => { + const v = Ts.now(); + this.renderScheduledAt < v && (this.renderScheduledAt = v, kr.render(this.render, !1, !0)); + }; + const { latestValues: f, renderState: u } = o; + this.latestValues = f, this.baseTarget = { ...f }, this.initialValues = r.initial ? { ...f } : {}, this.renderState = u, this.parent = e, this.props = r, this.presenceContext = n, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!s, this.isControllingVariants = E0(r), this.isVariantNode = j7(r), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current); + const { willChange: h, ...g } = this.scrapeMotionValuesFromProps(r, {}, this); + for (const v in g) { + const x = g[v]; + f[v] !== void 0 && Wn(x) && x.set(f[v], !1); + } + } + mount(e) { + this.current = e, M5.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((r, n) => this.bindToMotionValue(n, r)), X7.current || vQ(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : Uv.current, process.env.NODE_ENV !== "production" && m0(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext); + } + unmount() { + M5.delete(this.current), this.projection && this.projection.unmount(), Vo(this.notifyUpdate), Vo(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this); + for (const e in this.events) + this.events[e].clear(); + for (const e in this.features) { + const r = this.features[e]; + r && (r.unmount(), r.isMounted = !1); + } + this.current = null; + } + bindToMotionValue(e, r) { + this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)(); + const n = Ya.has(e), i = r.on("change", (a) => { + this.latestValues[e] = a, this.props.onUpdate && kr.preRender(this.notifyUpdate), n && this.projection && (this.projection.isTransformDirty = !0); + }), s = r.on("renderRequest", this.scheduleRender); + let o; + window.MotionCheckAppearSync && (o = window.MotionCheckAppearSync(this, e, r)), this.valueSubscriptions.set(e, () => { + i(), s(), o && o(), r.owner && r.stop(); + }); + } + sortNodePosition(e) { + return !this.current || !this.sortInstanceNodePosition || this.type !== e.type ? 0 : this.sortInstanceNodePosition(this.current, e.current); + } + updateFeatures() { + let e = "animation"; + for (e in Wc) { + const r = Wc[e]; + if (!r) + continue; + const { isEnabled: n, Feature: i } = r; + if (!this.features[e] && i && n(this.props) && (this.features[e] = new i(this)), this.features[e]) { + const s = this.features[e]; + s.isMounted ? s.update() : (s.mount(), s.isMounted = !0); + } + } + } + triggerBuild() { + this.build(this.renderState, this.latestValues, this.props); + } + /** + * Measure the current viewport box with or without transforms. + * Only measures axis-aligned boxes, rotate and skew must be manually + * removed with a re-render to work. + */ + measureViewportBox() { + return this.current ? this.measureInstanceViewportBox(this.current, this.props) : fn(); + } + getStaticValue(e) { + return this.latestValues[e]; + } + setStaticValue(e, r) { + this.latestValues[e] = r; + } + /** + * Update the provided props. Ensure any newly-added motion values are + * added to our map, old ones removed, and listeners updated. + */ + update(e, r) { + (e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = r; + for (let n = 0; n < I5.length; n++) { + const i = I5[n]; + this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]); + const s = "on" + i, o = e[s]; + o && (this.propEventSubscriptions[i] = this.on(i, o)); + } + this.prevMotionValues = bQ(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue(); + } + getProps() { + return this.props; + } + /** + * Returns the variant definition with a given name. + */ + getVariant(e) { + return this.props.variants ? this.props.variants[e] : void 0; + } + /** + * Returns the defined default transition on this component. + */ + getDefaultTransition() { + return this.props.transition; + } + getTransformPagePoint() { + return this.props.transformPagePoint; + } + getClosestVariantNode() { + return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0; + } + /** + * Add a child visual element to our set of children. + */ + addVariantChild(e) { + const r = this.getClosestVariantNode(); + if (r) + return r.variantChildren && r.variantChildren.add(e), () => r.variantChildren.delete(e); + } + /** + * Add a motion value and bind it to this visual element. + */ + addValue(e, r) { + const n = this.values.get(e); + r !== n && (n && this.removeValue(e), this.bindToMotionValue(e, r), this.values.set(e, r), this.latestValues[e] = r.get()); + } + /** + * Remove a motion value and unbind any active subscriptions. + */ + removeValue(e) { + this.values.delete(e); + const r = this.valueSubscriptions.get(e); + r && (r(), this.valueSubscriptions.delete(e)), delete this.latestValues[e], this.removeValueFromRenderState(e, this.renderState); + } + /** + * Check whether we have a motion value for this key + */ + hasValue(e) { + return this.values.has(e); + } + getValue(e, r) { + if (this.props.values && this.props.values[e]) + return this.props.values[e]; + let n = this.values.get(e); + return n === void 0 && r !== void 0 && (n = zf(r === null ? void 0 : r, { owner: this }), this.addValue(e, n)), n; + } + /** + * If we're trying to animate to a previously unencountered value, + * we need to check for it in our state and as a last resort read it + * directly from the instance (which might have performance implications). + */ + readValue(e, r) { + var n; + let i = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : (n = this.getBaseTargetFromProps(this.props, e)) !== null && n !== void 0 ? n : this.readValueFromInstance(this.current, e, this.options); + return i != null && (typeof i == "string" && (BS(i) || $S(i)) ? i = parseFloat(i) : !wQ(i) && Yo.test(r) && (i = XS(e, r)), this.setBaseTarget(e, Wn(i) ? i.get() : i)), Wn(i) ? i.get() : i; + } + /** + * Set the base target to later animate back to. This is currently + * only hydrated on creation and when we first read a value. + */ + setBaseTarget(e, r) { + this.baseTarget[e] = r; + } + /** + * Find the base target for a value thats been removed from all animation + * props. + */ + getBaseTarget(e) { + var r; + const { initial: n } = this.props; + let i; + if (typeof n == "string" || typeof n == "object") { + const o = W1(this.props, n, (r = this.presenceContext) === null || r === void 0 ? void 0 : r.custom); + o && (i = o[e]); + } + if (n && i !== void 0) + return i; + const s = this.getBaseTargetFromProps(this.props, e); + return s !== void 0 && !Wn(s) ? s : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e]; + } + on(e, r) { + return this.events[e] || (this.events[e] = new lb()), this.events[e].add(r); + } + notify(e, ...r) { + this.events[e] && this.events[e].notify(...r); + } +} +class Z7 extends xQ { + constructor() { + super(...arguments), this.KeyframeResolver = ZS; + } + sortInstanceNodePosition(e, r) { + return e.compareDocumentPosition(r) & 2 ? 1 : -1; + } + getBaseTargetFromProps(e, r) { + return e.style ? e.style[r] : void 0; + } + removeValueFromRenderState(e, { vars: r, style: n }) { + delete r[e], delete n[e]; + } +} +function _Q(t) { + return window.getComputedStyle(t); +} +class EQ extends Z7 { + constructor() { + super(...arguments), this.type = "html", this.renderInstance = U7; + } + readValueFromInstance(e, r) { + if (Ya.has(r)) { + const n = rb(r); + return n && n.default || 0; + } else { + const n = _Q(e), i = (jS(r) ? n.getPropertyValue(r) : n[r]) || 0; + return typeof i == "string" ? i.trim() : i; + } + } + measureInstanceViewportBox(e, { transformPagePoint: r }) { + return S7(e, r); + } + build(e, r, n) { + xb(e, r, n.transformTemplate); + } + scrapeMotionValuesFromProps(e, r, n) { + return bb(e, r, n); + } + handleChildMotionValue() { + this.childSubscription && (this.childSubscription(), delete this.childSubscription); + const { children: e } = this.props; + Wn(e) && (this.childSubscription = e.on("change", (r) => { + this.current && (this.current.textContent = `${r}`); + })); + } +} +class SQ extends Z7 { + constructor() { + super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = fn; + } + getBaseTargetFromProps(e, r) { + return e[r]; + } + readValueFromInstance(e, r) { + if (Ya.has(r)) { + const n = rb(r); + return n && n.default || 0; + } + return r = q7.has(r) ? r : hb(r), e.getAttribute(r); + } + scrapeMotionValuesFromProps(e, r, n) { + return W7(e, r, n); + } + build(e, r, n) { + _b(e, r, this.isSVGTag, n.transformTemplate); + } + renderInstance(e, r, n, i) { + z7(e, r, n, i); + } + mount(e) { + this.isSVGTag = Eb(e.tagName), super.mount(e); + } +} +const AQ = (t, e) => vb(t) ? new SQ(e) : new EQ(e, { + allowProjection: t !== W5 +}), PQ = /* @__PURE__ */ mQ({ + ...gX, + ...$Z, + ...PZ, + ...BZ +}, AQ), MQ = /* @__PURE__ */ oY(PQ); +class IQ extends Jt.Component { + getSnapshotBeforeUpdate(e) { + const r = this.props.childRef.current; + if (r && e.isPresent && !this.props.isPresent) { + const n = this.props.sizeRef.current; + n.height = r.offsetHeight || 0, n.width = r.offsetWidth || 0, n.top = r.offsetTop, n.left = r.offsetLeft; + } + return null; + } + /** + * Required with getSnapshotBeforeUpdate to stop React complaining. + */ + componentDidUpdate() { + } + render() { + return this.props.children; + } +} +function CQ({ children: t, isPresent: e }) { + const r = Vv(), n = Kn(null), i = Kn({ + width: 0, + height: 0, + top: 0, + left: 0 + }), { nonce: s } = In(gb); + return H5(() => { + const { width: o, height: a, top: f, left: u } = i.current; + if (e || !n.current || !o || !a) + return; + n.current.dataset.motionPopId = r; + const h = document.createElement("style"); + return s && (h.nonce = s), document.head.appendChild(h), h.sheet && h.sheet.insertRule(` + [data-motion-pop-id="${r}"] { + position: absolute !important; + width: ${o}px !important; + height: ${a}px !important; + top: ${f}px !important; + left: ${u}px !important; + } + `), () => { + document.head.removeChild(h); + }; + }, [e]), pe.jsx(IQ, { isPresent: e, childRef: n, sizeRef: i, children: Jt.cloneElement(t, { ref: n }) }); +} +const RQ = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: i, presenceAffectsLayout: s, mode: o }) => { + const a = yb(TQ), f = Vv(), u = Gv((g) => { + a.set(g, !0); + for (const v of a.values()) + if (!v) + return; + n && n(); + }, [a, n]), h = hi( + () => ({ + id: f, + initial: e, + isPresent: r, + custom: i, + onExitComplete: u, + register: (g) => (a.set(g, !1), () => a.delete(g)) + }), + /** + * If the presence of a child affects the layout of the components around it, + * we want to make a new context value to ensure they get re-rendered + * so they can detect that layout change. + */ + s ? [Math.random(), u] : [r, u] + ); + return hi(() => { + a.forEach((g, v) => a.set(v, !1)); + }, [r]), Jt.useEffect(() => { + !r && !a.size && n && n(); + }, [r]), o === "popLayout" && (t = pe.jsx(CQ, { isPresent: r, children: t })), pe.jsx(x0.Provider, { value: h, children: t }); +}; +function TQ() { + return /* @__PURE__ */ new Map(); +} +const Th = (t) => t.key || ""; +function C5(t) { + const e = []; + return dT.forEach(t, (r) => { + pT(r) && e.push(r); + }), e; +} +const DQ = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExitComplete: i, presenceAffectsLayout: s = !0, mode: o = "sync" }) => { + po(!e, "Replace exitBeforeEnter with mode='wait'"); + const a = hi(() => C5(t), [t]), f = a.map(Th), u = Kn(!0), h = Kn(a), g = yb(() => /* @__PURE__ */ new Map()), [v, x] = Xt(a), [S, C] = Xt(a); + $7(() => { + u.current = !1, h.current = a; + for (let N = 0; N < S.length; N++) { + const z = Th(S[N]); + f.includes(z) ? g.delete(z) : g.get(z) !== !0 && g.set(z, !1); + } + }, [S, f.length, f.join("-")]); + const D = []; + if (a !== v) { + let N = [...a]; + for (let z = 0; z < S.length; z++) { + const k = S[z], B = Th(k); + f.includes(B) || (N.splice(z, 0, k), D.push(k)); + } + o === "wait" && D.length && (N = D), C(C5(N)), x(a); + return; + } + process.env.NODE_ENV !== "production" && o === "wait" && S.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`); + const { forceRender: $ } = In(db); + return pe.jsx(pe.Fragment, { children: S.map((N) => { + const z = Th(N), k = a === S || f.includes(z), B = () => { + if (g.has(z)) + g.set(z, !0); + else + return; + let U = !0; + g.forEach((R) => { + R || (U = !1); + }), U && ($?.(), C(h.current), i && i()); + }; + return pe.jsx(RQ, { isPresent: k, initial: !u.current || n ? void 0 : !1, custom: k ? void 0 : r, presenceAffectsLayout: s, mode: o, onExitComplete: k ? void 0 : B, children: N }, z); + }) }); +}, ps = (t) => /* @__PURE__ */ pe.jsx(DQ, { children: /* @__PURE__ */ pe.jsx( + MQ.div, + { + initial: { x: 0, opacity: 0 }, + animate: { x: 0, opacity: 1 }, + exit: { x: 30, opacity: 0 }, + transition: { duration: 0.3 }, + className: t.className, + children: t.children + } +) }); +function Sb(t) { + const { icon: e, title: r, extra: n, onClick: i } = t; + function s() { + i && i(); + } + return /* @__PURE__ */ pe.jsxs( + "div", + { + className: "xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg", + onClick: s, + children: [ + e, + r, + /* @__PURE__ */ pe.jsxs("div", { className: "xc-relative xc-ml-auto xc-h-6", children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0", children: n }), + /* @__PURE__ */ pe.jsx("div", { className: "xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100", children: /* @__PURE__ */ pe.jsx(QG, {}) }) + ] }) + ] + } + ); +} +function OQ(t) { + return t.lastUsed ? /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500", children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]" }), + "Last Used" + ] }) : t.installed ? /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500", children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]" }), + "Installed" + ] }) : null; +} +function Q7(t) { + const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: e.config?.image }), i = e.config?.name || "", s = hi(() => OQ(e), [e]); + return /* @__PURE__ */ pe.jsx(Sb, { icon: n, title: i, extra: s, onClick: () => r(e) }); +} +function e9(t) { + var e, r, n = ""; + if (typeof t == "string" || typeof t == "number") n += t; + else if (typeof t == "object") if (Array.isArray(t)) { + var i = t.length; + for (e = 0; e < i; e++) t[e] && (r = e9(t[e])) && (n && (n += " "), n += r); + } else for (r in t) t[r] && (n && (n += " "), n += r); + return n; +} +function NQ() { + for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++) (t = arguments[r]) && (e = e9(t)) && (n && (n += " "), n += e); + return n; +} +const LQ = NQ, Ab = "-", kQ = (t) => { + const e = BQ(t), { + conflictingClassGroups: r, + conflictingClassGroupModifiers: n + } = t; + return { + getClassGroupId: (o) => { + const a = o.split(Ab); + return a[0] === "" && a.length !== 1 && a.shift(), t9(a, e) || $Q(o); + }, + getConflictingClassGroupIds: (o, a) => { + const f = r[o] || []; + return a && n[o] ? [...f, ...n[o]] : f; + } + }; +}, t9 = (t, e) => { + if (t.length === 0) + return e.classGroupId; + const r = t[0], n = e.nextPart.get(r), i = n ? t9(t.slice(1), n) : void 0; + if (i) + return i; + if (e.validators.length === 0) + return; + const s = t.join(Ab); + return e.validators.find(({ + validator: o + }) => o(s))?.classGroupId; +}, R5 = /^\[(.+)\]$/, $Q = (t) => { + if (R5.test(t)) { + const e = R5.exec(t)[1], r = e?.substring(0, e.indexOf(":")); + if (r) + return "arbitrary.." + r; + } +}, BQ = (t) => { + const { + theme: e, + prefix: r + } = t, n = { + nextPart: /* @__PURE__ */ new Map(), + validators: [] + }; + return jQ(Object.entries(t.classGroups), r).forEach(([s, o]) => { + qv(o, n, s, e); + }), n; +}, qv = (t, e, r, n) => { + t.forEach((i) => { + if (typeof i == "string") { + const s = i === "" ? e : T5(e, i); + s.classGroupId = r; + return; + } + if (typeof i == "function") { + if (FQ(i)) { + qv(i(n), e, r, n); + return; + } + e.validators.push({ + validator: i, + classGroupId: r + }); + return; + } + Object.entries(i).forEach(([s, o]) => { + qv(o, T5(e, s), r, n); + }); + }); +}, T5 = (t, e) => { + let r = t; + return e.split(Ab).forEach((n) => { + r.nextPart.has(n) || r.nextPart.set(n, { + nextPart: /* @__PURE__ */ new Map(), + validators: [] + }), r = r.nextPart.get(n); + }), r; +}, FQ = (t) => t.isThemeGetter, jQ = (t, e) => e ? t.map(([r, n]) => { + const i = n.map((s) => typeof s == "string" ? e + s : typeof s == "object" ? Object.fromEntries(Object.entries(s).map(([o, a]) => [e + o, a])) : s); + return [r, i]; +}) : t, UQ = (t) => { + if (t < 1) + return { + get: () => { + }, + set: () => { + } + }; + let e = 0, r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(); + const i = (s, o) => { + r.set(s, o), e++, e > t && (e = 0, n = r, r = /* @__PURE__ */ new Map()); + }; + return { + get(s) { + let o = r.get(s); + if (o !== void 0) + return o; + if ((o = n.get(s)) !== void 0) + return i(s, o), o; + }, + set(s, o) { + r.has(s) ? r.set(s, o) : i(s, o); + } + }; +}, r9 = "!", qQ = (t) => { + const { + separator: e, + experimentalParseClassName: r + } = t, n = e.length === 1, i = e[0], s = e.length, o = (a) => { + const f = []; + let u = 0, h = 0, g; + for (let D = 0; D < a.length; D++) { + let $ = a[D]; + if (u === 0) { + if ($ === i && (n || a.slice(D, D + s) === e)) { + f.push(a.slice(h, D)), h = D + s; + continue; + } + if ($ === "/") { + g = D; + continue; + } + } + $ === "[" ? u++ : $ === "]" && u--; + } + const v = f.length === 0 ? a : a.substring(h), x = v.startsWith(r9), S = x ? v.substring(1) : v, C = g && g > h ? g - h : void 0; + return { + modifiers: f, + hasImportantModifier: x, + baseClassName: S, + maybePostfixModifierPosition: C + }; + }; + return r ? (a) => r({ + className: a, + parseClassName: o + }) : o; +}, zQ = (t) => { + if (t.length <= 1) + return t; + const e = []; + let r = []; + return t.forEach((n) => { + n[0] === "[" ? (e.push(...r.sort(), n), r = []) : r.push(n); + }), e.push(...r.sort()), e; +}, HQ = (t) => ({ + cache: UQ(t.cacheSize), + parseClassName: qQ(t), + ...kQ(t) +}), WQ = /\s+/, KQ = (t, e) => { + const { + parseClassName: r, + getClassGroupId: n, + getConflictingClassGroupIds: i + } = e, s = [], o = t.trim().split(WQ); + let a = ""; + for (let f = o.length - 1; f >= 0; f -= 1) { + const u = o[f], { + modifiers: h, + hasImportantModifier: g, + baseClassName: v, + maybePostfixModifierPosition: x + } = r(u); + let S = !!x, C = n(S ? v.substring(0, x) : v); + if (!C) { + if (!S) { + a = u + (a.length > 0 ? " " + a : a); + continue; + } + if (C = n(v), !C) { + a = u + (a.length > 0 ? " " + a : a); + continue; + } + S = !1; + } + const D = zQ(h).join(":"), $ = g ? D + r9 : D, N = $ + C; + if (s.includes(N)) + continue; + s.push(N); + const z = i(C, S); + for (let k = 0; k < z.length; ++k) { + const B = z[k]; + s.push($ + B); + } + a = u + (a.length > 0 ? " " + a : a); + } + return a; +}; +function VQ() { + let t = 0, e, r, n = ""; + for (; t < arguments.length; ) + (e = arguments[t++]) && (r = n9(e)) && (n && (n += " "), n += r); + return n; +} +const n9 = (t) => { + if (typeof t == "string") + return t; + let e, r = ""; + for (let n = 0; n < t.length; n++) + t[n] && (e = n9(t[n])) && (r && (r += " "), r += e); + return r; +}; +function GQ(t, ...e) { + let r, n, i, s = o; + function o(f) { + const u = e.reduce((h, g) => g(h), t()); + return r = HQ(u), n = r.cache.get, i = r.cache.set, s = a, a(f); + } + function a(f) { + const u = n(f); + if (u) + return u; + const h = KQ(f, r); + return i(f, h), h; + } + return function() { + return s(VQ.apply(null, arguments)); + }; +} +const Gr = (t) => { + const e = (r) => r[t] || []; + return e.isThemeGetter = !0, e; +}, i9 = /^\[(?:([a-z-]+):)?(.+)\]$/i, YQ = /^\d+\/\d+$/, JQ = /* @__PURE__ */ new Set(["px", "full", "screen"]), XQ = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, ZQ = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, QQ = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, eee = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, tee = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, Js = (t) => $c(t) || JQ.has(t) || YQ.test(t), Io = (t) => tu(t, "length", uee), $c = (t) => !!t && !Number.isNaN(Number(t)), Tm = (t) => tu(t, "number", $c), zu = (t) => !!t && Number.isInteger(Number(t)), ree = (t) => t.endsWith("%") && $c(t.slice(0, -1)), ur = (t) => i9.test(t), Co = (t) => XQ.test(t), nee = /* @__PURE__ */ new Set(["length", "size", "percentage"]), iee = (t) => tu(t, nee, s9), see = (t) => tu(t, "position", s9), oee = /* @__PURE__ */ new Set(["image", "url"]), aee = (t) => tu(t, oee, lee), cee = (t) => tu(t, "", fee), Hu = () => !0, tu = (t, e, r) => { + const n = i9.exec(t); + return n ? n[1] ? typeof e == "string" ? n[1] === e : e.has(n[1]) : r(n[2]) : !1; +}, uee = (t) => ( + // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths. + // For example, `hsl(0 0% 0%)` would be classified as a length without this check. + // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough. + ZQ.test(t) && !QQ.test(t) +), s9 = () => !1, fee = (t) => eee.test(t), lee = (t) => tee.test(t), hee = () => { + const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), f = Gr("contrast"), u = Gr("grayscale"), h = Gr("hueRotate"), g = Gr("invert"), v = Gr("gap"), x = Gr("gradientColorStops"), S = Gr("gradientColorStopPositions"), C = Gr("inset"), D = Gr("margin"), $ = Gr("opacity"), N = Gr("padding"), z = Gr("saturate"), k = Gr("scale"), B = Gr("sepia"), U = Gr("skew"), R = Gr("space"), W = Gr("translate"), J = () => ["auto", "contain", "none"], ne = () => ["auto", "hidden", "clip", "visible", "scroll"], K = () => ["auto", ur, e], E = () => [ur, e], b = () => ["", Js, Io], l = () => ["auto", $c, ur], p = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], m = () => ["solid", "dashed", "dotted", "double", "none"], w = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], P = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], _ = () => ["", "0", ur], y = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], M = () => [$c, ur]; + return { + cacheSize: 500, + separator: ":", + theme: { + colors: [Hu], + spacing: [Js, Io], + blur: ["none", "", Co, ur], + brightness: M(), + borderColor: [t], + borderRadius: ["none", "", "full", Co, ur], + borderSpacing: E(), + borderWidth: b(), + contrast: M(), + grayscale: _(), + hueRotate: M(), + invert: _(), + gap: E(), + gradientColorStops: [t], + gradientColorStopPositions: [ree, Io], + inset: K(), + margin: K(), + opacity: M(), + padding: E(), + saturate: M(), + scale: M(), + sepia: _(), + skew: M(), + space: E(), + translate: E() + }, + classGroups: { + // Layout + /** + * Aspect Ratio + * @see https://tailwindcss.com/docs/aspect-ratio + */ + aspect: [{ + aspect: ["auto", "square", "video", ur] + }], + /** + * Container + * @see https://tailwindcss.com/docs/container + */ + container: ["container"], + /** + * Columns + * @see https://tailwindcss.com/docs/columns + */ + columns: [{ + columns: [Co] + }], + /** + * Break After + * @see https://tailwindcss.com/docs/break-after + */ + "break-after": [{ + "break-after": y() + }], + /** + * Break Before + * @see https://tailwindcss.com/docs/break-before + */ + "break-before": [{ + "break-before": y() + }], + /** + * Break Inside + * @see https://tailwindcss.com/docs/break-inside + */ + "break-inside": [{ + "break-inside": ["auto", "avoid", "avoid-page", "avoid-column"] + }], + /** + * Box Decoration Break + * @see https://tailwindcss.com/docs/box-decoration-break + */ + "box-decoration": [{ + "box-decoration": ["slice", "clone"] + }], + /** + * Box Sizing + * @see https://tailwindcss.com/docs/box-sizing + */ + box: [{ + box: ["border", "content"] + }], + /** + * Display + * @see https://tailwindcss.com/docs/display + */ + display: ["block", "inline-block", "inline", "flex", "inline-flex", "table", "inline-table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row-group", "table-row", "flow-root", "grid", "inline-grid", "contents", "list-item", "hidden"], + /** + * Floats + * @see https://tailwindcss.com/docs/float + */ + float: [{ + float: ["right", "left", "none", "start", "end"] + }], + /** + * Clear + * @see https://tailwindcss.com/docs/clear + */ + clear: [{ + clear: ["left", "right", "both", "none", "start", "end"] + }], + /** + * Isolation + * @see https://tailwindcss.com/docs/isolation + */ + isolation: ["isolate", "isolation-auto"], + /** + * Object Fit + * @see https://tailwindcss.com/docs/object-fit + */ + "object-fit": [{ + object: ["contain", "cover", "fill", "none", "scale-down"] + }], + /** + * Object Position + * @see https://tailwindcss.com/docs/object-position + */ + "object-position": [{ + object: [...p(), ur] + }], + /** + * Overflow + * @see https://tailwindcss.com/docs/overflow + */ + overflow: [{ + overflow: ne() + }], + /** + * Overflow X + * @see https://tailwindcss.com/docs/overflow + */ + "overflow-x": [{ + "overflow-x": ne() + }], + /** + * Overflow Y + * @see https://tailwindcss.com/docs/overflow + */ + "overflow-y": [{ + "overflow-y": ne() + }], + /** + * Overscroll Behavior + * @see https://tailwindcss.com/docs/overscroll-behavior + */ + overscroll: [{ + overscroll: J() + }], + /** + * Overscroll Behavior X + * @see https://tailwindcss.com/docs/overscroll-behavior + */ + "overscroll-x": [{ + "overscroll-x": J() + }], + /** + * Overscroll Behavior Y + * @see https://tailwindcss.com/docs/overscroll-behavior + */ + "overscroll-y": [{ + "overscroll-y": J() + }], + /** + * Position + * @see https://tailwindcss.com/docs/position + */ + position: ["static", "fixed", "absolute", "relative", "sticky"], + /** + * Top / Right / Bottom / Left + * @see https://tailwindcss.com/docs/top-right-bottom-left + */ + inset: [{ + inset: [C] + }], + /** + * Right / Left + * @see https://tailwindcss.com/docs/top-right-bottom-left + */ + "inset-x": [{ + "inset-x": [C] + }], + /** + * Top / Bottom + * @see https://tailwindcss.com/docs/top-right-bottom-left + */ + "inset-y": [{ + "inset-y": [C] + }], + /** + * Start + * @see https://tailwindcss.com/docs/top-right-bottom-left + */ + start: [{ + start: [C] + }], + /** + * End + * @see https://tailwindcss.com/docs/top-right-bottom-left + */ + end: [{ + end: [C] + }], + /** + * Top + * @see https://tailwindcss.com/docs/top-right-bottom-left + */ + top: [{ + top: [C] + }], + /** + * Right + * @see https://tailwindcss.com/docs/top-right-bottom-left + */ + right: [{ + right: [C] + }], + /** + * Bottom + * @see https://tailwindcss.com/docs/top-right-bottom-left + */ + bottom: [{ + bottom: [C] + }], + /** + * Left + * @see https://tailwindcss.com/docs/top-right-bottom-left + */ + left: [{ + left: [C] + }], + /** + * Visibility + * @see https://tailwindcss.com/docs/visibility + */ + visibility: ["visible", "invisible", "collapse"], + /** + * Z-Index + * @see https://tailwindcss.com/docs/z-index + */ + z: [{ + z: ["auto", zu, ur] + }], + // Flexbox and Grid + /** + * Flex Basis + * @see https://tailwindcss.com/docs/flex-basis + */ + basis: [{ + basis: K() + }], + /** + * Flex Direction + * @see https://tailwindcss.com/docs/flex-direction + */ + "flex-direction": [{ + flex: ["row", "row-reverse", "col", "col-reverse"] + }], + /** + * Flex Wrap + * @see https://tailwindcss.com/docs/flex-wrap + */ + "flex-wrap": [{ + flex: ["wrap", "wrap-reverse", "nowrap"] + }], + /** + * Flex + * @see https://tailwindcss.com/docs/flex + */ + flex: [{ + flex: ["1", "auto", "initial", "none", ur] + }], + /** + * Flex Grow + * @see https://tailwindcss.com/docs/flex-grow + */ + grow: [{ + grow: _() + }], + /** + * Flex Shrink + * @see https://tailwindcss.com/docs/flex-shrink + */ + shrink: [{ + shrink: _() + }], + /** + * Order + * @see https://tailwindcss.com/docs/order + */ + order: [{ + order: ["first", "last", "none", zu, ur] + }], + /** + * Grid Template Columns + * @see https://tailwindcss.com/docs/grid-template-columns + */ + "grid-cols": [{ + "grid-cols": [Hu] + }], + /** + * Grid Column Start / End + * @see https://tailwindcss.com/docs/grid-column + */ + "col-start-end": [{ + col: ["auto", { + span: ["full", zu, ur] + }, ur] + }], + /** + * Grid Column Start + * @see https://tailwindcss.com/docs/grid-column + */ + "col-start": [{ + "col-start": l() + }], + /** + * Grid Column End + * @see https://tailwindcss.com/docs/grid-column + */ + "col-end": [{ + "col-end": l() + }], + /** + * Grid Template Rows + * @see https://tailwindcss.com/docs/grid-template-rows + */ + "grid-rows": [{ + "grid-rows": [Hu] + }], + /** + * Grid Row Start / End + * @see https://tailwindcss.com/docs/grid-row + */ + "row-start-end": [{ + row: ["auto", { + span: [zu, ur] + }, ur] + }], + /** + * Grid Row Start + * @see https://tailwindcss.com/docs/grid-row + */ + "row-start": [{ + "row-start": l() + }], + /** + * Grid Row End + * @see https://tailwindcss.com/docs/grid-row + */ + "row-end": [{ + "row-end": l() + }], + /** + * Grid Auto Flow + * @see https://tailwindcss.com/docs/grid-auto-flow + */ + "grid-flow": [{ + "grid-flow": ["row", "col", "dense", "row-dense", "col-dense"] + }], + /** + * Grid Auto Columns + * @see https://tailwindcss.com/docs/grid-auto-columns + */ + "auto-cols": [{ + "auto-cols": ["auto", "min", "max", "fr", ur] + }], + /** + * Grid Auto Rows + * @see https://tailwindcss.com/docs/grid-auto-rows + */ + "auto-rows": [{ + "auto-rows": ["auto", "min", "max", "fr", ur] + }], + /** + * Gap + * @see https://tailwindcss.com/docs/gap + */ + gap: [{ + gap: [v] + }], + /** + * Gap X + * @see https://tailwindcss.com/docs/gap + */ + "gap-x": [{ + "gap-x": [v] + }], + /** + * Gap Y + * @see https://tailwindcss.com/docs/gap + */ + "gap-y": [{ + "gap-y": [v] + }], + /** + * Justify Content + * @see https://tailwindcss.com/docs/justify-content + */ + "justify-content": [{ + justify: ["normal", ...P()] + }], + /** + * Justify Items + * @see https://tailwindcss.com/docs/justify-items + */ + "justify-items": [{ + "justify-items": ["start", "end", "center", "stretch"] + }], + /** + * Justify Self + * @see https://tailwindcss.com/docs/justify-self + */ + "justify-self": [{ + "justify-self": ["auto", "start", "end", "center", "stretch"] + }], + /** + * Align Content + * @see https://tailwindcss.com/docs/align-content + */ + "align-content": [{ + content: ["normal", ...P(), "baseline"] + }], + /** + * Align Items + * @see https://tailwindcss.com/docs/align-items + */ + "align-items": [{ + items: ["start", "end", "center", "baseline", "stretch"] + }], + /** + * Align Self + * @see https://tailwindcss.com/docs/align-self + */ + "align-self": [{ + self: ["auto", "start", "end", "center", "stretch", "baseline"] + }], + /** + * Place Content + * @see https://tailwindcss.com/docs/place-content + */ + "place-content": [{ + "place-content": [...P(), "baseline"] + }], + /** + * Place Items + * @see https://tailwindcss.com/docs/place-items + */ + "place-items": [{ + "place-items": ["start", "end", "center", "baseline", "stretch"] + }], + /** + * Place Self + * @see https://tailwindcss.com/docs/place-self + */ + "place-self": [{ + "place-self": ["auto", "start", "end", "center", "stretch"] + }], + // Spacing + /** + * Padding + * @see https://tailwindcss.com/docs/padding + */ + p: [{ + p: [N] + }], + /** + * Padding X + * @see https://tailwindcss.com/docs/padding + */ + px: [{ + px: [N] + }], + /** + * Padding Y + * @see https://tailwindcss.com/docs/padding + */ + py: [{ + py: [N] + }], + /** + * Padding Start + * @see https://tailwindcss.com/docs/padding + */ + ps: [{ + ps: [N] + }], + /** + * Padding End + * @see https://tailwindcss.com/docs/padding + */ + pe: [{ + pe: [N] + }], + /** + * Padding Top + * @see https://tailwindcss.com/docs/padding + */ + pt: [{ + pt: [N] + }], + /** + * Padding Right + * @see https://tailwindcss.com/docs/padding + */ + pr: [{ + pr: [N] + }], + /** + * Padding Bottom + * @see https://tailwindcss.com/docs/padding + */ + pb: [{ + pb: [N] + }], + /** + * Padding Left + * @see https://tailwindcss.com/docs/padding + */ + pl: [{ + pl: [N] + }], + /** + * Margin + * @see https://tailwindcss.com/docs/margin + */ + m: [{ + m: [D] + }], + /** + * Margin X + * @see https://tailwindcss.com/docs/margin + */ + mx: [{ + mx: [D] + }], + /** + * Margin Y + * @see https://tailwindcss.com/docs/margin + */ + my: [{ + my: [D] + }], + /** + * Margin Start + * @see https://tailwindcss.com/docs/margin + */ + ms: [{ + ms: [D] + }], + /** + * Margin End + * @see https://tailwindcss.com/docs/margin + */ + me: [{ + me: [D] + }], + /** + * Margin Top + * @see https://tailwindcss.com/docs/margin + */ + mt: [{ + mt: [D] + }], + /** + * Margin Right + * @see https://tailwindcss.com/docs/margin + */ + mr: [{ + mr: [D] + }], + /** + * Margin Bottom + * @see https://tailwindcss.com/docs/margin + */ + mb: [{ + mb: [D] + }], + /** + * Margin Left + * @see https://tailwindcss.com/docs/margin + */ + ml: [{ + ml: [D] + }], + /** + * Space Between X + * @see https://tailwindcss.com/docs/space + */ + "space-x": [{ + "space-x": [R] + }], + /** + * Space Between X Reverse + * @see https://tailwindcss.com/docs/space + */ + "space-x-reverse": ["space-x-reverse"], + /** + * Space Between Y + * @see https://tailwindcss.com/docs/space + */ + "space-y": [{ + "space-y": [R] + }], + /** + * Space Between Y Reverse + * @see https://tailwindcss.com/docs/space + */ + "space-y-reverse": ["space-y-reverse"], + // Sizing + /** + * Width + * @see https://tailwindcss.com/docs/width + */ + w: [{ + w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw", ur, e] + }], + /** + * Min-Width + * @see https://tailwindcss.com/docs/min-width + */ + "min-w": [{ + "min-w": [ur, e, "min", "max", "fit"] + }], + /** + * Max-Width + * @see https://tailwindcss.com/docs/max-width + */ + "max-w": [{ + "max-w": [ur, e, "none", "full", "min", "max", "fit", "prose", { + screen: [Co] + }, Co] + }], + /** + * Height + * @see https://tailwindcss.com/docs/height + */ + h: [{ + h: [ur, e, "auto", "min", "max", "fit", "svh", "lvh", "dvh"] + }], + /** + * Min-Height + * @see https://tailwindcss.com/docs/min-height + */ + "min-h": [{ + "min-h": [ur, e, "min", "max", "fit", "svh", "lvh", "dvh"] + }], + /** + * Max-Height + * @see https://tailwindcss.com/docs/max-height + */ + "max-h": [{ + "max-h": [ur, e, "min", "max", "fit", "svh", "lvh", "dvh"] + }], + /** + * Size + * @see https://tailwindcss.com/docs/size + */ + size: [{ + size: [ur, e, "auto", "min", "max", "fit"] + }], + // Typography + /** + * Font Size + * @see https://tailwindcss.com/docs/font-size + */ + "font-size": [{ + text: ["base", Co, Io] + }], + /** + * Font Smoothing + * @see https://tailwindcss.com/docs/font-smoothing + */ + "font-smoothing": ["antialiased", "subpixel-antialiased"], + /** + * Font Style + * @see https://tailwindcss.com/docs/font-style + */ + "font-style": ["italic", "not-italic"], + /** + * Font Weight + * @see https://tailwindcss.com/docs/font-weight + */ + "font-weight": [{ + font: ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black", Tm] + }], + /** + * Font Family + * @see https://tailwindcss.com/docs/font-family + */ + "font-family": [{ + font: [Hu] + }], + /** + * Font Variant Numeric + * @see https://tailwindcss.com/docs/font-variant-numeric + */ + "fvn-normal": ["normal-nums"], + /** + * Font Variant Numeric + * @see https://tailwindcss.com/docs/font-variant-numeric + */ + "fvn-ordinal": ["ordinal"], + /** + * Font Variant Numeric + * @see https://tailwindcss.com/docs/font-variant-numeric + */ + "fvn-slashed-zero": ["slashed-zero"], + /** + * Font Variant Numeric + * @see https://tailwindcss.com/docs/font-variant-numeric + */ + "fvn-figure": ["lining-nums", "oldstyle-nums"], + /** + * Font Variant Numeric + * @see https://tailwindcss.com/docs/font-variant-numeric + */ + "fvn-spacing": ["proportional-nums", "tabular-nums"], + /** + * Font Variant Numeric + * @see https://tailwindcss.com/docs/font-variant-numeric + */ + "fvn-fraction": ["diagonal-fractions", "stacked-fractions"], + /** + * Letter Spacing + * @see https://tailwindcss.com/docs/letter-spacing + */ + tracking: [{ + tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", ur] + }], + /** + * Line Clamp + * @see https://tailwindcss.com/docs/line-clamp + */ + "line-clamp": [{ + "line-clamp": ["none", $c, Tm] + }], + /** + * Line Height + * @see https://tailwindcss.com/docs/line-height + */ + leading: [{ + leading: ["none", "tight", "snug", "normal", "relaxed", "loose", Js, ur] + }], + /** + * List Style Image + * @see https://tailwindcss.com/docs/list-style-image + */ + "list-image": [{ + "list-image": ["none", ur] + }], + /** + * List Style Type + * @see https://tailwindcss.com/docs/list-style-type + */ + "list-style-type": [{ + list: ["none", "disc", "decimal", ur] + }], + /** + * List Style Position + * @see https://tailwindcss.com/docs/list-style-position + */ + "list-style-position": [{ + list: ["inside", "outside"] + }], + /** + * Placeholder Color + * @deprecated since Tailwind CSS v3.0.0 + * @see https://tailwindcss.com/docs/placeholder-color + */ + "placeholder-color": [{ + placeholder: [t] + }], + /** + * Placeholder Opacity + * @see https://tailwindcss.com/docs/placeholder-opacity + */ + "placeholder-opacity": [{ + "placeholder-opacity": [$] + }], + /** + * Text Alignment + * @see https://tailwindcss.com/docs/text-align + */ + "text-alignment": [{ + text: ["left", "center", "right", "justify", "start", "end"] + }], + /** + * Text Color + * @see https://tailwindcss.com/docs/text-color + */ + "text-color": [{ + text: [t] + }], + /** + * Text Opacity + * @see https://tailwindcss.com/docs/text-opacity + */ + "text-opacity": [{ + "text-opacity": [$] + }], + /** + * Text Decoration + * @see https://tailwindcss.com/docs/text-decoration + */ + "text-decoration": ["underline", "overline", "line-through", "no-underline"], + /** + * Text Decoration Style + * @see https://tailwindcss.com/docs/text-decoration-style + */ + "text-decoration-style": [{ + decoration: [...m(), "wavy"] + }], + /** + * Text Decoration Thickness + * @see https://tailwindcss.com/docs/text-decoration-thickness + */ + "text-decoration-thickness": [{ + decoration: ["auto", "from-font", Js, Io] + }], + /** + * Text Underline Offset + * @see https://tailwindcss.com/docs/text-underline-offset + */ + "underline-offset": [{ + "underline-offset": ["auto", Js, ur] + }], + /** + * Text Decoration Color + * @see https://tailwindcss.com/docs/text-decoration-color + */ + "text-decoration-color": [{ + decoration: [t] + }], + /** + * Text Transform + * @see https://tailwindcss.com/docs/text-transform + */ + "text-transform": ["uppercase", "lowercase", "capitalize", "normal-case"], + /** + * Text Overflow + * @see https://tailwindcss.com/docs/text-overflow + */ + "text-overflow": ["truncate", "text-ellipsis", "text-clip"], + /** + * Text Wrap + * @see https://tailwindcss.com/docs/text-wrap + */ + "text-wrap": [{ + text: ["wrap", "nowrap", "balance", "pretty"] + }], + /** + * Text Indent + * @see https://tailwindcss.com/docs/text-indent + */ + indent: [{ + indent: E() + }], + /** + * Vertical Alignment + * @see https://tailwindcss.com/docs/vertical-align + */ + "vertical-align": [{ + align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", ur] + }], + /** + * Whitespace + * @see https://tailwindcss.com/docs/whitespace + */ + whitespace: [{ + whitespace: ["normal", "nowrap", "pre", "pre-line", "pre-wrap", "break-spaces"] + }], + /** + * Word Break + * @see https://tailwindcss.com/docs/word-break + */ + break: [{ + break: ["normal", "words", "all", "keep"] + }], + /** + * Hyphens + * @see https://tailwindcss.com/docs/hyphens + */ + hyphens: [{ + hyphens: ["none", "manual", "auto"] + }], + /** + * Content + * @see https://tailwindcss.com/docs/content + */ + content: [{ + content: ["none", ur] + }], + // Backgrounds + /** + * Background Attachment + * @see https://tailwindcss.com/docs/background-attachment + */ + "bg-attachment": [{ + bg: ["fixed", "local", "scroll"] + }], + /** + * Background Clip + * @see https://tailwindcss.com/docs/background-clip + */ + "bg-clip": [{ + "bg-clip": ["border", "padding", "content", "text"] + }], + /** + * Background Opacity + * @deprecated since Tailwind CSS v3.0.0 + * @see https://tailwindcss.com/docs/background-opacity + */ + "bg-opacity": [{ + "bg-opacity": [$] + }], + /** + * Background Origin + * @see https://tailwindcss.com/docs/background-origin + */ + "bg-origin": [{ + "bg-origin": ["border", "padding", "content"] + }], + /** + * Background Position + * @see https://tailwindcss.com/docs/background-position + */ + "bg-position": [{ + bg: [...p(), see] + }], + /** + * Background Repeat + * @see https://tailwindcss.com/docs/background-repeat + */ + "bg-repeat": [{ + bg: ["no-repeat", { + repeat: ["", "x", "y", "round", "space"] + }] + }], + /** + * Background Size + * @see https://tailwindcss.com/docs/background-size + */ + "bg-size": [{ + bg: ["auto", "cover", "contain", iee] + }], + /** + * Background Image + * @see https://tailwindcss.com/docs/background-image + */ + "bg-image": [{ + bg: ["none", { + "gradient-to": ["t", "tr", "r", "br", "b", "bl", "l", "tl"] + }, aee] + }], + /** + * Background Color + * @see https://tailwindcss.com/docs/background-color + */ + "bg-color": [{ + bg: [t] + }], + /** + * Gradient Color Stops From Position + * @see https://tailwindcss.com/docs/gradient-color-stops + */ + "gradient-from-pos": [{ + from: [S] + }], + /** + * Gradient Color Stops Via Position + * @see https://tailwindcss.com/docs/gradient-color-stops + */ + "gradient-via-pos": [{ + via: [S] + }], + /** + * Gradient Color Stops To Position + * @see https://tailwindcss.com/docs/gradient-color-stops + */ + "gradient-to-pos": [{ + to: [S] + }], + /** + * Gradient Color Stops From + * @see https://tailwindcss.com/docs/gradient-color-stops + */ + "gradient-from": [{ + from: [x] + }], + /** + * Gradient Color Stops Via + * @see https://tailwindcss.com/docs/gradient-color-stops + */ + "gradient-via": [{ + via: [x] + }], + /** + * Gradient Color Stops To + * @see https://tailwindcss.com/docs/gradient-color-stops + */ + "gradient-to": [{ + to: [x] + }], + // Borders + /** + * Border Radius + * @see https://tailwindcss.com/docs/border-radius + */ + rounded: [{ + rounded: [s] + }], + /** + * Border Radius Start + * @see https://tailwindcss.com/docs/border-radius + */ + "rounded-s": [{ + "rounded-s": [s] + }], + /** + * Border Radius End + * @see https://tailwindcss.com/docs/border-radius + */ + "rounded-e": [{ + "rounded-e": [s] + }], + /** + * Border Radius Top + * @see https://tailwindcss.com/docs/border-radius + */ + "rounded-t": [{ + "rounded-t": [s] + }], + /** + * Border Radius Right + * @see https://tailwindcss.com/docs/border-radius + */ + "rounded-r": [{ + "rounded-r": [s] + }], + /** + * Border Radius Bottom + * @see https://tailwindcss.com/docs/border-radius + */ + "rounded-b": [{ + "rounded-b": [s] + }], + /** + * Border Radius Left + * @see https://tailwindcss.com/docs/border-radius + */ + "rounded-l": [{ + "rounded-l": [s] + }], + /** + * Border Radius Start Start + * @see https://tailwindcss.com/docs/border-radius + */ + "rounded-ss": [{ + "rounded-ss": [s] + }], + /** + * Border Radius Start End + * @see https://tailwindcss.com/docs/border-radius + */ + "rounded-se": [{ + "rounded-se": [s] + }], + /** + * Border Radius End End + * @see https://tailwindcss.com/docs/border-radius + */ + "rounded-ee": [{ + "rounded-ee": [s] + }], + /** + * Border Radius End Start + * @see https://tailwindcss.com/docs/border-radius + */ + "rounded-es": [{ + "rounded-es": [s] + }], + /** + * Border Radius Top Left + * @see https://tailwindcss.com/docs/border-radius + */ + "rounded-tl": [{ + "rounded-tl": [s] + }], + /** + * Border Radius Top Right + * @see https://tailwindcss.com/docs/border-radius + */ + "rounded-tr": [{ + "rounded-tr": [s] + }], + /** + * Border Radius Bottom Right + * @see https://tailwindcss.com/docs/border-radius + */ + "rounded-br": [{ + "rounded-br": [s] + }], + /** + * Border Radius Bottom Left + * @see https://tailwindcss.com/docs/border-radius + */ + "rounded-bl": [{ + "rounded-bl": [s] + }], + /** + * Border Width + * @see https://tailwindcss.com/docs/border-width + */ + "border-w": [{ + border: [a] + }], + /** + * Border Width X + * @see https://tailwindcss.com/docs/border-width + */ + "border-w-x": [{ + "border-x": [a] + }], + /** + * Border Width Y + * @see https://tailwindcss.com/docs/border-width + */ + "border-w-y": [{ + "border-y": [a] + }], + /** + * Border Width Start + * @see https://tailwindcss.com/docs/border-width + */ + "border-w-s": [{ + "border-s": [a] + }], + /** + * Border Width End + * @see https://tailwindcss.com/docs/border-width + */ + "border-w-e": [{ + "border-e": [a] + }], + /** + * Border Width Top + * @see https://tailwindcss.com/docs/border-width + */ + "border-w-t": [{ + "border-t": [a] + }], + /** + * Border Width Right + * @see https://tailwindcss.com/docs/border-width + */ + "border-w-r": [{ + "border-r": [a] + }], + /** + * Border Width Bottom + * @see https://tailwindcss.com/docs/border-width + */ + "border-w-b": [{ + "border-b": [a] + }], + /** + * Border Width Left + * @see https://tailwindcss.com/docs/border-width + */ + "border-w-l": [{ + "border-l": [a] + }], + /** + * Border Opacity + * @see https://tailwindcss.com/docs/border-opacity + */ + "border-opacity": [{ + "border-opacity": [$] + }], + /** + * Border Style + * @see https://tailwindcss.com/docs/border-style + */ + "border-style": [{ + border: [...m(), "hidden"] + }], + /** + * Divide Width X + * @see https://tailwindcss.com/docs/divide-width + */ + "divide-x": [{ + "divide-x": [a] + }], + /** + * Divide Width X Reverse + * @see https://tailwindcss.com/docs/divide-width + */ + "divide-x-reverse": ["divide-x-reverse"], + /** + * Divide Width Y + * @see https://tailwindcss.com/docs/divide-width + */ + "divide-y": [{ + "divide-y": [a] + }], + /** + * Divide Width Y Reverse + * @see https://tailwindcss.com/docs/divide-width + */ + "divide-y-reverse": ["divide-y-reverse"], + /** + * Divide Opacity + * @see https://tailwindcss.com/docs/divide-opacity + */ + "divide-opacity": [{ + "divide-opacity": [$] + }], + /** + * Divide Style + * @see https://tailwindcss.com/docs/divide-style + */ + "divide-style": [{ + divide: m() + }], + /** + * Border Color + * @see https://tailwindcss.com/docs/border-color + */ + "border-color": [{ + border: [i] + }], + /** + * Border Color X + * @see https://tailwindcss.com/docs/border-color + */ + "border-color-x": [{ + "border-x": [i] + }], + /** + * Border Color Y + * @see https://tailwindcss.com/docs/border-color + */ + "border-color-y": [{ + "border-y": [i] + }], + /** + * Border Color S + * @see https://tailwindcss.com/docs/border-color + */ + "border-color-s": [{ + "border-s": [i] + }], + /** + * Border Color E + * @see https://tailwindcss.com/docs/border-color + */ + "border-color-e": [{ + "border-e": [i] + }], + /** + * Border Color Top + * @see https://tailwindcss.com/docs/border-color + */ + "border-color-t": [{ + "border-t": [i] + }], + /** + * Border Color Right + * @see https://tailwindcss.com/docs/border-color + */ + "border-color-r": [{ + "border-r": [i] + }], + /** + * Border Color Bottom + * @see https://tailwindcss.com/docs/border-color + */ + "border-color-b": [{ + "border-b": [i] + }], + /** + * Border Color Left + * @see https://tailwindcss.com/docs/border-color + */ + "border-color-l": [{ + "border-l": [i] + }], + /** + * Divide Color + * @see https://tailwindcss.com/docs/divide-color + */ + "divide-color": [{ + divide: [i] + }], + /** + * Outline Style + * @see https://tailwindcss.com/docs/outline-style + */ + "outline-style": [{ + outline: ["", ...m()] + }], + /** + * Outline Offset + * @see https://tailwindcss.com/docs/outline-offset + */ + "outline-offset": [{ + "outline-offset": [Js, ur] + }], + /** + * Outline Width + * @see https://tailwindcss.com/docs/outline-width + */ + "outline-w": [{ + outline: [Js, Io] + }], + /** + * Outline Color + * @see https://tailwindcss.com/docs/outline-color + */ + "outline-color": [{ + outline: [t] + }], + /** + * Ring Width + * @see https://tailwindcss.com/docs/ring-width + */ + "ring-w": [{ + ring: b() + }], + /** + * Ring Width Inset + * @see https://tailwindcss.com/docs/ring-width + */ + "ring-w-inset": ["ring-inset"], + /** + * Ring Color + * @see https://tailwindcss.com/docs/ring-color + */ + "ring-color": [{ + ring: [t] + }], + /** + * Ring Opacity + * @see https://tailwindcss.com/docs/ring-opacity + */ + "ring-opacity": [{ + "ring-opacity": [$] + }], + /** + * Ring Offset Width + * @see https://tailwindcss.com/docs/ring-offset-width + */ + "ring-offset-w": [{ + "ring-offset": [Js, Io] + }], + /** + * Ring Offset Color + * @see https://tailwindcss.com/docs/ring-offset-color + */ + "ring-offset-color": [{ + "ring-offset": [t] + }], + // Effects + /** + * Box Shadow + * @see https://tailwindcss.com/docs/box-shadow + */ + shadow: [{ + shadow: ["", "inner", "none", Co, cee] + }], + /** + * Box Shadow Color + * @see https://tailwindcss.com/docs/box-shadow-color + */ + "shadow-color": [{ + shadow: [Hu] + }], + /** + * Opacity + * @see https://tailwindcss.com/docs/opacity + */ + opacity: [{ + opacity: [$] + }], + /** + * Mix Blend Mode + * @see https://tailwindcss.com/docs/mix-blend-mode + */ + "mix-blend": [{ + "mix-blend": [...w(), "plus-lighter", "plus-darker"] + }], + /** + * Background Blend Mode + * @see https://tailwindcss.com/docs/background-blend-mode + */ + "bg-blend": [{ + "bg-blend": w() + }], + // Filters + /** + * Filter + * @deprecated since Tailwind CSS v3.0.0 + * @see https://tailwindcss.com/docs/filter + */ + filter: [{ + filter: ["", "none"] + }], + /** + * Blur + * @see https://tailwindcss.com/docs/blur + */ + blur: [{ + blur: [r] + }], + /** + * Brightness + * @see https://tailwindcss.com/docs/brightness + */ + brightness: [{ + brightness: [n] + }], + /** + * Contrast + * @see https://tailwindcss.com/docs/contrast + */ + contrast: [{ + contrast: [f] + }], + /** + * Drop Shadow + * @see https://tailwindcss.com/docs/drop-shadow + */ + "drop-shadow": [{ + "drop-shadow": ["", "none", Co, ur] + }], + /** + * Grayscale + * @see https://tailwindcss.com/docs/grayscale + */ + grayscale: [{ + grayscale: [u] + }], + /** + * Hue Rotate + * @see https://tailwindcss.com/docs/hue-rotate + */ + "hue-rotate": [{ + "hue-rotate": [h] + }], + /** + * Invert + * @see https://tailwindcss.com/docs/invert + */ + invert: [{ + invert: [g] + }], + /** + * Saturate + * @see https://tailwindcss.com/docs/saturate + */ + saturate: [{ + saturate: [z] + }], + /** + * Sepia + * @see https://tailwindcss.com/docs/sepia + */ + sepia: [{ + sepia: [B] + }], + /** + * Backdrop Filter + * @deprecated since Tailwind CSS v3.0.0 + * @see https://tailwindcss.com/docs/backdrop-filter + */ + "backdrop-filter": [{ + "backdrop-filter": ["", "none"] + }], + /** + * Backdrop Blur + * @see https://tailwindcss.com/docs/backdrop-blur + */ + "backdrop-blur": [{ + "backdrop-blur": [r] + }], + /** + * Backdrop Brightness + * @see https://tailwindcss.com/docs/backdrop-brightness + */ + "backdrop-brightness": [{ + "backdrop-brightness": [n] + }], + /** + * Backdrop Contrast + * @see https://tailwindcss.com/docs/backdrop-contrast + */ + "backdrop-contrast": [{ + "backdrop-contrast": [f] + }], + /** + * Backdrop Grayscale + * @see https://tailwindcss.com/docs/backdrop-grayscale + */ + "backdrop-grayscale": [{ + "backdrop-grayscale": [u] + }], + /** + * Backdrop Hue Rotate + * @see https://tailwindcss.com/docs/backdrop-hue-rotate + */ + "backdrop-hue-rotate": [{ + "backdrop-hue-rotate": [h] + }], + /** + * Backdrop Invert + * @see https://tailwindcss.com/docs/backdrop-invert + */ + "backdrop-invert": [{ + "backdrop-invert": [g] + }], + /** + * Backdrop Opacity + * @see https://tailwindcss.com/docs/backdrop-opacity + */ + "backdrop-opacity": [{ + "backdrop-opacity": [$] + }], + /** + * Backdrop Saturate + * @see https://tailwindcss.com/docs/backdrop-saturate + */ + "backdrop-saturate": [{ + "backdrop-saturate": [z] + }], + /** + * Backdrop Sepia + * @see https://tailwindcss.com/docs/backdrop-sepia + */ + "backdrop-sepia": [{ + "backdrop-sepia": [B] + }], + // Tables + /** + * Border Collapse + * @see https://tailwindcss.com/docs/border-collapse + */ + "border-collapse": [{ + border: ["collapse", "separate"] + }], + /** + * Border Spacing + * @see https://tailwindcss.com/docs/border-spacing + */ + "border-spacing": [{ + "border-spacing": [o] + }], + /** + * Border Spacing X + * @see https://tailwindcss.com/docs/border-spacing + */ + "border-spacing-x": [{ + "border-spacing-x": [o] + }], + /** + * Border Spacing Y + * @see https://tailwindcss.com/docs/border-spacing + */ + "border-spacing-y": [{ + "border-spacing-y": [o] + }], + /** + * Table Layout + * @see https://tailwindcss.com/docs/table-layout + */ + "table-layout": [{ + table: ["auto", "fixed"] + }], + /** + * Caption Side + * @see https://tailwindcss.com/docs/caption-side + */ + caption: [{ + caption: ["top", "bottom"] + }], + // Transitions and Animation + /** + * Tranisition Property + * @see https://tailwindcss.com/docs/transition-property + */ + transition: [{ + transition: ["none", "all", "", "colors", "opacity", "shadow", "transform", ur] + }], + /** + * Transition Duration + * @see https://tailwindcss.com/docs/transition-duration + */ + duration: [{ + duration: M() + }], + /** + * Transition Timing Function + * @see https://tailwindcss.com/docs/transition-timing-function + */ + ease: [{ + ease: ["linear", "in", "out", "in-out", ur] + }], + /** + * Transition Delay + * @see https://tailwindcss.com/docs/transition-delay + */ + delay: [{ + delay: M() + }], + /** + * Animation + * @see https://tailwindcss.com/docs/animation + */ + animate: [{ + animate: ["none", "spin", "ping", "pulse", "bounce", ur] + }], + // Transforms + /** + * Transform + * @see https://tailwindcss.com/docs/transform + */ + transform: [{ + transform: ["", "gpu", "none"] + }], + /** + * Scale + * @see https://tailwindcss.com/docs/scale + */ + scale: [{ + scale: [k] + }], + /** + * Scale X + * @see https://tailwindcss.com/docs/scale + */ + "scale-x": [{ + "scale-x": [k] + }], + /** + * Scale Y + * @see https://tailwindcss.com/docs/scale + */ + "scale-y": [{ + "scale-y": [k] + }], + /** + * Rotate + * @see https://tailwindcss.com/docs/rotate + */ + rotate: [{ + rotate: [zu, ur] + }], + /** + * Translate X + * @see https://tailwindcss.com/docs/translate + */ + "translate-x": [{ + "translate-x": [W] + }], + /** + * Translate Y + * @see https://tailwindcss.com/docs/translate + */ + "translate-y": [{ + "translate-y": [W] + }], + /** + * Skew X + * @see https://tailwindcss.com/docs/skew + */ + "skew-x": [{ + "skew-x": [U] + }], + /** + * Skew Y + * @see https://tailwindcss.com/docs/skew + */ + "skew-y": [{ + "skew-y": [U] + }], + /** + * Transform Origin + * @see https://tailwindcss.com/docs/transform-origin + */ + "transform-origin": [{ + origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left", ur] + }], + // Interactivity + /** + * Accent Color + * @see https://tailwindcss.com/docs/accent-color + */ + accent: [{ + accent: ["auto", t] + }], + /** + * Appearance + * @see https://tailwindcss.com/docs/appearance + */ + appearance: [{ + appearance: ["none", "auto"] + }], + /** + * Cursor + * @see https://tailwindcss.com/docs/cursor + */ + cursor: [{ + cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out", ur] + }], + /** + * Caret Color + * @see https://tailwindcss.com/docs/just-in-time-mode#caret-color-utilities + */ + "caret-color": [{ + caret: [t] + }], + /** + * Pointer Events + * @see https://tailwindcss.com/docs/pointer-events + */ + "pointer-events": [{ + "pointer-events": ["none", "auto"] + }], + /** + * Resize + * @see https://tailwindcss.com/docs/resize + */ + resize: [{ + resize: ["none", "y", "x", ""] + }], + /** + * Scroll Behavior + * @see https://tailwindcss.com/docs/scroll-behavior + */ + "scroll-behavior": [{ + scroll: ["auto", "smooth"] + }], + /** + * Scroll Margin + * @see https://tailwindcss.com/docs/scroll-margin + */ + "scroll-m": [{ + "scroll-m": E() + }], + /** + * Scroll Margin X + * @see https://tailwindcss.com/docs/scroll-margin + */ + "scroll-mx": [{ + "scroll-mx": E() + }], + /** + * Scroll Margin Y + * @see https://tailwindcss.com/docs/scroll-margin + */ + "scroll-my": [{ + "scroll-my": E() + }], + /** + * Scroll Margin Start + * @see https://tailwindcss.com/docs/scroll-margin + */ + "scroll-ms": [{ + "scroll-ms": E() + }], + /** + * Scroll Margin End + * @see https://tailwindcss.com/docs/scroll-margin + */ + "scroll-me": [{ + "scroll-me": E() + }], + /** + * Scroll Margin Top + * @see https://tailwindcss.com/docs/scroll-margin + */ + "scroll-mt": [{ + "scroll-mt": E() + }], + /** + * Scroll Margin Right + * @see https://tailwindcss.com/docs/scroll-margin + */ + "scroll-mr": [{ + "scroll-mr": E() + }], + /** + * Scroll Margin Bottom + * @see https://tailwindcss.com/docs/scroll-margin + */ + "scroll-mb": [{ + "scroll-mb": E() + }], + /** + * Scroll Margin Left + * @see https://tailwindcss.com/docs/scroll-margin + */ + "scroll-ml": [{ + "scroll-ml": E() + }], + /** + * Scroll Padding + * @see https://tailwindcss.com/docs/scroll-padding + */ + "scroll-p": [{ + "scroll-p": E() + }], + /** + * Scroll Padding X + * @see https://tailwindcss.com/docs/scroll-padding + */ + "scroll-px": [{ + "scroll-px": E() + }], + /** + * Scroll Padding Y + * @see https://tailwindcss.com/docs/scroll-padding + */ + "scroll-py": [{ + "scroll-py": E() + }], + /** + * Scroll Padding Start + * @see https://tailwindcss.com/docs/scroll-padding + */ + "scroll-ps": [{ + "scroll-ps": E() + }], + /** + * Scroll Padding End + * @see https://tailwindcss.com/docs/scroll-padding + */ + "scroll-pe": [{ + "scroll-pe": E() + }], + /** + * Scroll Padding Top + * @see https://tailwindcss.com/docs/scroll-padding + */ + "scroll-pt": [{ + "scroll-pt": E() + }], + /** + * Scroll Padding Right + * @see https://tailwindcss.com/docs/scroll-padding + */ + "scroll-pr": [{ + "scroll-pr": E() + }], + /** + * Scroll Padding Bottom + * @see https://tailwindcss.com/docs/scroll-padding + */ + "scroll-pb": [{ + "scroll-pb": E() + }], + /** + * Scroll Padding Left + * @see https://tailwindcss.com/docs/scroll-padding + */ + "scroll-pl": [{ + "scroll-pl": E() + }], + /** + * Scroll Snap Align + * @see https://tailwindcss.com/docs/scroll-snap-align + */ + "snap-align": [{ + snap: ["start", "end", "center", "align-none"] + }], + /** + * Scroll Snap Stop + * @see https://tailwindcss.com/docs/scroll-snap-stop + */ + "snap-stop": [{ + snap: ["normal", "always"] + }], + /** + * Scroll Snap Type + * @see https://tailwindcss.com/docs/scroll-snap-type + */ + "snap-type": [{ + snap: ["none", "x", "y", "both"] + }], + /** + * Scroll Snap Type Strictness + * @see https://tailwindcss.com/docs/scroll-snap-type + */ + "snap-strictness": [{ + snap: ["mandatory", "proximity"] + }], + /** + * Touch Action + * @see https://tailwindcss.com/docs/touch-action + */ + touch: [{ + touch: ["auto", "none", "manipulation"] + }], + /** + * Touch Action X + * @see https://tailwindcss.com/docs/touch-action + */ + "touch-x": [{ + "touch-pan": ["x", "left", "right"] + }], + /** + * Touch Action Y + * @see https://tailwindcss.com/docs/touch-action + */ + "touch-y": [{ + "touch-pan": ["y", "up", "down"] + }], + /** + * Touch Action Pinch Zoom + * @see https://tailwindcss.com/docs/touch-action + */ + "touch-pz": ["touch-pinch-zoom"], + /** + * User Select + * @see https://tailwindcss.com/docs/user-select + */ + select: [{ + select: ["none", "text", "all", "auto"] + }], + /** + * Will Change + * @see https://tailwindcss.com/docs/will-change + */ + "will-change": [{ + "will-change": ["auto", "scroll", "contents", "transform", ur] + }], + // SVG + /** + * Fill + * @see https://tailwindcss.com/docs/fill + */ + fill: [{ + fill: [t, "none"] + }], + /** + * Stroke Width + * @see https://tailwindcss.com/docs/stroke-width + */ + "stroke-w": [{ + stroke: [Js, Io, Tm] + }], + /** + * Stroke + * @see https://tailwindcss.com/docs/stroke + */ + stroke: [{ + stroke: [t, "none"] + }], + // Accessibility + /** + * Screen Readers + * @see https://tailwindcss.com/docs/screen-readers + */ + sr: ["sr-only", "not-sr-only"], + /** + * Forced Color Adjust + * @see https://tailwindcss.com/docs/forced-color-adjust + */ + "forced-color-adjust": [{ + "forced-color-adjust": ["auto", "none"] + }] + }, + conflictingClassGroups: { + overflow: ["overflow-x", "overflow-y"], + overscroll: ["overscroll-x", "overscroll-y"], + inset: ["inset-x", "inset-y", "start", "end", "top", "right", "bottom", "left"], + "inset-x": ["right", "left"], + "inset-y": ["top", "bottom"], + flex: ["basis", "grow", "shrink"], + gap: ["gap-x", "gap-y"], + p: ["px", "py", "ps", "pe", "pt", "pr", "pb", "pl"], + px: ["pr", "pl"], + py: ["pt", "pb"], + m: ["mx", "my", "ms", "me", "mt", "mr", "mb", "ml"], + mx: ["mr", "ml"], + my: ["mt", "mb"], + size: ["w", "h"], + "font-size": ["leading"], + "fvn-normal": ["fvn-ordinal", "fvn-slashed-zero", "fvn-figure", "fvn-spacing", "fvn-fraction"], + "fvn-ordinal": ["fvn-normal"], + "fvn-slashed-zero": ["fvn-normal"], + "fvn-figure": ["fvn-normal"], + "fvn-spacing": ["fvn-normal"], + "fvn-fraction": ["fvn-normal"], + "line-clamp": ["display", "overflow"], + rounded: ["rounded-s", "rounded-e", "rounded-t", "rounded-r", "rounded-b", "rounded-l", "rounded-ss", "rounded-se", "rounded-ee", "rounded-es", "rounded-tl", "rounded-tr", "rounded-br", "rounded-bl"], + "rounded-s": ["rounded-ss", "rounded-es"], + "rounded-e": ["rounded-se", "rounded-ee"], + "rounded-t": ["rounded-tl", "rounded-tr"], + "rounded-r": ["rounded-tr", "rounded-br"], + "rounded-b": ["rounded-br", "rounded-bl"], + "rounded-l": ["rounded-tl", "rounded-bl"], + "border-spacing": ["border-spacing-x", "border-spacing-y"], + "border-w": ["border-w-s", "border-w-e", "border-w-t", "border-w-r", "border-w-b", "border-w-l"], + "border-w-x": ["border-w-r", "border-w-l"], + "border-w-y": ["border-w-t", "border-w-b"], + "border-color": ["border-color-s", "border-color-e", "border-color-t", "border-color-r", "border-color-b", "border-color-l"], + "border-color-x": ["border-color-r", "border-color-l"], + "border-color-y": ["border-color-t", "border-color-b"], + "scroll-m": ["scroll-mx", "scroll-my", "scroll-ms", "scroll-me", "scroll-mt", "scroll-mr", "scroll-mb", "scroll-ml"], + "scroll-mx": ["scroll-mr", "scroll-ml"], + "scroll-my": ["scroll-mt", "scroll-mb"], + "scroll-p": ["scroll-px", "scroll-py", "scroll-ps", "scroll-pe", "scroll-pt", "scroll-pr", "scroll-pb", "scroll-pl"], + "scroll-px": ["scroll-pr", "scroll-pl"], + "scroll-py": ["scroll-pt", "scroll-pb"], + touch: ["touch-x", "touch-y", "touch-pz"], + "touch-x": ["touch"], + "touch-y": ["touch"], + "touch-pz": ["touch"] + }, + conflictingClassGroupModifiers: { + "font-size": ["leading"] + } + }; +}, dee = /* @__PURE__ */ GQ(hee); +function uo(...t) { + return dee(LQ(t)); +} +function o9(t) { + const { className: e } = t; + return /* @__PURE__ */ pe.jsxs("div", { className: uo("xc-flex xc-items-center xc-gap-2"), children: [ + /* @__PURE__ */ pe.jsx("hr", { className: uo("xc-flex-1 xc-border-gray-200", e) }), + /* @__PURE__ */ pe.jsx("div", { className: "xc-shrink-0", children: t.children }), + /* @__PURE__ */ pe.jsx("hr", { className: uo("xc-flex-1 xc-border-gray-200", e) }) + ] }); +} +function pee(t) { + const { wallet: e, onClick: r } = t; + return /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4", children: [ + /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-md xc-h-16 xc-w-16", src: e.config?.image, alt: "" }), + /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ + /* @__PURE__ */ pe.jsxs("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: [ + "Connect to ", + e.config?.name + ] }), + /* @__PURE__ */ pe.jsx("div", { className: "xc-flex xc-gap-2", children: /* @__PURE__ */ pe.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: () => r(e), children: "Connect" }) }) + ] }) + ] }); +} +const gee = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton"; +function mee(t) { + const { onClick: e } = t; + function r() { + e && e(); + } + return /* @__PURE__ */ pe.jsx(o9, { className: "xc-opacity-20", children: /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-cursor-pointer", onClick: r, children: [ + /* @__PURE__ */ pe.jsx("span", { className: "xc-text-sm", children: "View more wallets" }), + /* @__PURE__ */ pe.jsx(SS, { size: 16 }) + ] }) }); +} +function a9(t) { + const [e, r] = Xt(""), { featuredWallets: n, initialized: i } = g0(), { onEmailConfirm: s, onSelectWallet: o, onSelectMoreWallets: a, onSelectTonConnect: f, config: u } = t, h = hi(() => { + const C = /[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu, D = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; + return !C.test(e) && D.test(e); + }, [e]); + function g(C) { + o(C); + } + function v(C) { + r(C.target.value); + } + async function x() { + s(e); + } + function S(C) { + C.key === "Enter" && h && x(); + } + return /* @__PURE__ */ pe.jsx(ps, { children: i && /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ + t.header || /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6 xc-text-xl xc-font-bold", children: "Log in or sign up" }), + n.length === 1 && /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: n.map((C) => /* @__PURE__ */ pe.jsx( + pee, + { + wallet: C, + onClick: g + }, + `feature-${C.key}` + )) }), + n.length > 1 && /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ + /* @__PURE__ */ pe.jsxs("div", { children: [ + /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: [ + u.showFeaturedWallets && n && n.map((C) => /* @__PURE__ */ pe.jsx( + Q7, + { + wallet: C, + onClick: g + }, + `feature-${C.key}` + )), + u.showTonConnect && /* @__PURE__ */ pe.jsx( + Sb, + { + icon: /* @__PURE__ */ pe.jsx("img", { className: "xc-h-5 xc-w-5", src: gee }), + title: "TON Connect", + onClick: f + } + ) + ] }), + u.showMoreWallets && /* @__PURE__ */ pe.jsx(mee, { onClick: a }) + ] }), + u.showEmailSignIn && (u.showFeaturedWallets || u.showTonConnect) && /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4 xc-mt-4", children: /* @__PURE__ */ pe.jsxs(o9, { className: "xc-opacity-20", children: [ + " ", + /* @__PURE__ */ pe.jsx("span", { className: "xc-text-sm xc-opacity-20", children: "OR" }) + ] }) }), + u.showEmailSignIn && /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-4", children: [ + /* @__PURE__ */ pe.jsx("input", { className: "xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3", placeholder: "Enter your email", type: "email", onChange: v, onKeyDown: S }), + /* @__PURE__ */ pe.jsx("button", { disabled: !h, className: "xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all", onClick: x, children: "Continue" }) + ] }) + ] }) + ] }) }); +} +function Ja(t) { + const { title: e } = t; + return /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2", children: [ + /* @__PURE__ */ pe.jsx(ZG, { onClick: t.onBack, size: 20, className: "xc-cursor-pointer" }), + /* @__PURE__ */ pe.jsx("span", { children: e }) + ] }); +} +const c9 = Xo({ + channel: "", + device: "WEB", + app: "", + inviterCode: "", + role: "C" +}); +function Pb() { + return In(c9); +} +function vee(t) { + const { config: e } = t, [r, n] = Xt(e.channel), [i, s] = Xt(e.device), [o, a] = Xt(e.app), [f, u] = Xt(e.role || "C"), [h, g] = Xt(e.inviterCode); + return Rn(() => { + n(e.channel), s(e.device), a(e.app), g(e.inviterCode), u(e.role || "C"); + }, [e]), /* @__PURE__ */ pe.jsx( + c9.Provider, + { + value: { + channel: r, + device: i, + app: o, + inviterCode: h, + role: f + }, + children: t.children + } + ); +} +var bee = Object.defineProperty, yee = Object.defineProperties, wee = Object.getOwnPropertyDescriptors, Ld = Object.getOwnPropertySymbols, u9 = Object.prototype.hasOwnProperty, f9 = Object.prototype.propertyIsEnumerable, D5 = (t, e, r) => e in t ? bee(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, xee = (t, e) => { + for (var r in e || (e = {})) u9.call(e, r) && D5(t, r, e[r]); + if (Ld) for (var r of Ld(e)) f9.call(e, r) && D5(t, r, e[r]); + return t; +}, _ee = (t, e) => yee(t, wee(e)), Eee = (t, e) => { + var r = {}; + for (var n in t) u9.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); + if (t != null && Ld) for (var n of Ld(t)) e.indexOf(n) < 0 && f9.call(t, n) && (r[n] = t[n]); + return r; +}; +function See(t) { + let e = setTimeout(t, 0), r = setTimeout(t, 10), n = setTimeout(t, 50); + return [e, r, n]; +} +function Aee(t) { + let e = Jt.useRef(); + return Jt.useEffect(() => { + e.current = t; + }), e.current; +} +var Pee = 18, l9 = 40, Mee = `${l9}px`, Iee = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(","); +function Cee({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isFocused: n }) { + let [i, s] = Jt.useState(!1), [o, a] = Jt.useState(!1), [f, u] = Jt.useState(!1), h = Jt.useMemo(() => r === "none" ? !1 : (r === "increase-width" || r === "experimental-no-flickering") && i && o, [i, o, r]), g = Jt.useCallback(() => { + let v = t.current, x = e.current; + if (!v || !x || f || r === "none") return; + let S = v, C = S.getBoundingClientRect().left + S.offsetWidth, D = S.getBoundingClientRect().top + S.offsetHeight / 2, $ = C - Pee, N = D; + document.querySelectorAll(Iee).length === 0 && document.elementFromPoint($, N) === v || (s(!0), u(!0)); + }, [t, e, f, r]); + return Jt.useEffect(() => { + let v = t.current; + if (!v || r === "none") return; + function x() { + let C = window.innerWidth - v.getBoundingClientRect().right; + a(C >= l9); + } + x(); + let S = setInterval(x, 1e3); + return () => { + clearInterval(S); + }; + }, [t, r]), Jt.useEffect(() => { + let v = n || document.activeElement === e.current; + if (r === "none" || !v) return; + let x = setTimeout(g, 0), S = setTimeout(g, 2e3), C = setTimeout(g, 5e3), D = setTimeout(() => { + u(!0); + }, 6e3); + return () => { + clearTimeout(x), clearTimeout(S), clearTimeout(C), clearTimeout(D); + }; + }, [e, n, r, g]), { hasPWMBadge: i, willPushPWMBadge: h, PWM_BADGE_SPACE_WIDTH: Mee }; +} +var h9 = Jt.createContext({}), d9 = Jt.forwardRef((t, e) => { + var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: f, inputMode: u = "numeric", onComplete: h, pushPasswordManagerStrategy: g = "increase-width", pasteTransformer: v, containerClassName: x, noScriptCSSFallback: S = Ree, render: C, children: D } = r, $ = Eee(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), N, z, k, B, U; + let [R, W] = Jt.useState(typeof $.defaultValue == "string" ? $.defaultValue : ""), J = n ?? R, ne = Aee(J), K = Jt.useCallback((ae) => { + i?.(ae), W(ae); + }, [i]), E = Jt.useMemo(() => a ? typeof a == "string" ? new RegExp(a) : a : null, [a]), b = Jt.useRef(null), l = Jt.useRef(null), p = Jt.useRef({ value: J, onChange: K, isIOS: typeof window < "u" && ((z = (N = window?.CSS) == null ? void 0 : N.supports) == null ? void 0 : z.call(N, "-webkit-touch-callout", "none")) }), m = Jt.useRef({ prev: [(k = b.current) == null ? void 0 : k.selectionStart, (B = b.current) == null ? void 0 : B.selectionEnd, (U = b.current) == null ? void 0 : U.selectionDirection] }); + Jt.useImperativeHandle(e, () => b.current, []), Jt.useEffect(() => { + let ae = b.current, fe = l.current; + if (!ae || !fe) return; + p.current.value !== ae.value && p.current.onChange(ae.value), m.current.prev = [ae.selectionStart, ae.selectionEnd, ae.selectionDirection]; + function be() { + if (document.activeElement !== ae) { + I(null), ce(null); + return; + } + let Re = ae.selectionStart, $e = ae.selectionEnd, Me = ae.selectionDirection, Oe = ae.maxLength, ze = ae.value, De = m.current.prev, je = -1, Ue = -1, _e; + if (ze.length !== 0 && Re !== null && $e !== null) { + let rt = Re === $e, nt = Re === ze.length && ze.length < Oe; + if (rt && !nt) { + let Ge = Re; + if (Ge === 0) je = 0, Ue = 1, _e = "forward"; + else if (Ge === Oe) je = Ge - 1, Ue = Ge, _e = "backward"; + else if (Oe > 1 && ze.length > 1) { + let ht = 0; + if (De[0] !== null && De[1] !== null) { + _e = Ge < De[1] ? "backward" : "forward"; + let lt = De[0] === De[1] && De[0] < Oe; + _e === "backward" && !lt && (ht = -1); + } + je = ht + Ge, Ue = ht + Ge + 1; + } + } + je !== -1 && Ue !== -1 && je !== Ue && b.current.setSelectionRange(je, Ue, _e); + } + let Ze = je !== -1 ? je : Re, ot = Ue !== -1 ? Ue : $e, ke = _e ?? Me; + I(Ze), ce(ot), m.current.prev = [Ze, ot, ke]; + } + if (document.addEventListener("selectionchange", be, { capture: !0 }), be(), document.activeElement === ae && y(!0), !document.getElementById("input-otp-style")) { + let Re = document.createElement("style"); + if (Re.id = "input-otp-style", document.head.appendChild(Re), Re.sheet) { + let $e = "background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;"; + Wu(Re.sheet, "[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"), Wu(Re.sheet, `[data-input-otp]:autofill { ${$e} }`), Wu(Re.sheet, `[data-input-otp]:-webkit-autofill { ${$e} }`), Wu(Re.sheet, "@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"), Wu(Re.sheet, "[data-input-otp] + * { pointer-events: all !important; }"); + } + } + let Ae = () => { + fe && fe.style.setProperty("--root-height", `${ae.clientHeight}px`); + }; + Ae(); + let Te = new ResizeObserver(Ae); + return Te.observe(ae), () => { + document.removeEventListener("selectionchange", be, { capture: !0 }), Te.disconnect(); + }; + }, []); + let [w, P] = Jt.useState(!1), [_, y] = Jt.useState(!1), [M, I] = Jt.useState(null), [q, ce] = Jt.useState(null); + Jt.useEffect(() => { + See(() => { + var ae, fe, be, Ae; + (ae = b.current) == null || ae.dispatchEvent(new Event("input")); + let Te = (fe = b.current) == null ? void 0 : fe.selectionStart, Re = (be = b.current) == null ? void 0 : be.selectionEnd, $e = (Ae = b.current) == null ? void 0 : Ae.selectionDirection; + Te !== null && Re !== null && (I(Te), ce(Re), m.current.prev = [Te, Re, $e]); + }); + }, [J, _]), Jt.useEffect(() => { + ne !== void 0 && J !== ne && ne.length < s && J.length === s && h?.(J); + }, [s, h, ne, J]); + let L = Cee({ containerRef: l, inputRef: b, pushPasswordManagerStrategy: g, isFocused: _ }), oe = Jt.useCallback((ae) => { + let fe = ae.currentTarget.value.slice(0, s); + if (fe.length > 0 && E && !E.test(fe)) { + ae.preventDefault(); + return; + } + typeof ne == "string" && fe.length < ne.length && document.dispatchEvent(new Event("selectionchange")), K(fe); + }, [s, K, ne, E]), Q = Jt.useCallback(() => { + var ae; + if (b.current) { + let fe = Math.min(b.current.value.length, s - 1), be = b.current.value.length; + (ae = b.current) == null || ae.setSelectionRange(fe, be), I(fe), ce(be); + } + y(!0); + }, [s]), X = Jt.useCallback((ae) => { + var fe, be; + let Ae = b.current; + if (!v && (!p.current.isIOS || !ae.clipboardData || !Ae)) return; + let Te = ae.clipboardData.getData("text/plain"), Re = v ? v(Te) : Te; + console.log({ _content: Te, content: Re }), ae.preventDefault(); + let $e = (fe = b.current) == null ? void 0 : fe.selectionStart, Me = (be = b.current) == null ? void 0 : be.selectionEnd, Oe = ($e !== Me ? J.slice(0, $e) + Re + J.slice(Me) : J.slice(0, $e) + Re + J.slice($e)).slice(0, s); + if (Oe.length > 0 && E && !E.test(Oe)) return; + Ae.value = Oe, K(Oe); + let ze = Math.min(Oe.length, s - 1), De = Oe.length; + Ae.setSelectionRange(ze, De), I(ze), ce(De); + }, [s, K, E, J]), ee = Jt.useMemo(() => ({ position: "relative", cursor: $.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [$.disabled]), O = Jt.useMemo(() => ({ position: "absolute", inset: 0, width: L.willPushPWMBadge ? `calc(100% + ${L.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: L.willPushPWMBadge ? `inset(0 ${L.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: o, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [L.PWM_BADGE_SPACE_WIDTH, L.willPushPWMBadge, o]), Z = Jt.useMemo(() => Jt.createElement("input", _ee(xee({ autoComplete: $.autoComplete || "one-time-code" }, $), { "data-input-otp": !0, "data-input-otp-placeholder-shown": J.length === 0 || void 0, "data-input-otp-mss": M, "data-input-otp-mse": q, inputMode: u, pattern: E?.source, "aria-placeholder": f, style: O, maxLength: s, value: J, ref: b, onPaste: (ae) => { + var fe; + X(ae), (fe = $.onPaste) == null || fe.call($, ae); + }, onChange: oe, onMouseOver: (ae) => { + var fe; + P(!0), (fe = $.onMouseOver) == null || fe.call($, ae); + }, onMouseLeave: (ae) => { + var fe; + P(!1), (fe = $.onMouseLeave) == null || fe.call($, ae); + }, onFocus: (ae) => { + var fe; + Q(), (fe = $.onFocus) == null || fe.call($, ae); + }, onBlur: (ae) => { + var fe; + y(!1), (fe = $.onBlur) == null || fe.call($, ae); + } })), [oe, Q, X, u, O, s, q, M, $, E?.source, J]), re = Jt.useMemo(() => ({ slots: Array.from({ length: s }).map((ae, fe) => { + var be; + let Ae = _ && M !== null && q !== null && (M === q && fe === M || fe >= M && fe < q), Te = J[fe] !== void 0 ? J[fe] : null, Re = J[0] !== void 0 ? null : (be = f?.[fe]) != null ? be : null; + return { char: Te, placeholderChar: Re, isActive: Ae, hasFakeCaret: Ae && Te === null }; + }), isFocused: _, isHovering: !$.disabled && w }), [_, w, s, q, M, $.disabled, J]), he = Jt.useMemo(() => C ? C(re) : Jt.createElement(h9.Provider, { value: re }, D), [D, re, C]); + return Jt.createElement(Jt.Fragment, null, S !== null && Jt.createElement("noscript", null, Jt.createElement("style", null, S)), Jt.createElement("div", { ref: l, "data-input-otp-container": !0, style: ee, className: x }, he, Jt.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, Z))); +}); +d9.displayName = "Input"; +function Wu(t, e) { + try { + t.insertRule(e); + } catch { + console.error("input-otp could not insert CSS rule:", e); + } +} +var Ree = ` +[data-input-otp] { + --nojs-bg: white !important; + --nojs-fg: black !important; + + background-color: var(--nojs-bg) !important; + color: var(--nojs-fg) !important; + caret-color: var(--nojs-fg) !important; + letter-spacing: .25em !important; + text-align: center !important; + border: 1px solid var(--nojs-fg) !important; + border-radius: 4px !important; + width: 100% !important; +} +@media (prefers-color-scheme: dark) { + [data-input-otp] { + --nojs-bg: black !important; + --nojs-fg: white !important; + } +}`; +const p9 = Jt.forwardRef(({ className: t, containerClassName: e, ...r }, n) => /* @__PURE__ */ pe.jsx( + d9, + { + ref: n, + containerClassName: uo( + "xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50", + e + ), + className: uo("disabled:xc-cursor-not-allowed", t), + ...r + } +)); +p9.displayName = "InputOTP"; +const g9 = Jt.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ pe.jsx("div", { ref: r, className: uo("xc-flex xc-items-center", t), ...e })); +g9.displayName = "InputOTPGroup"; +const xa = Jt.forwardRef(({ index: t, className: e, ...r }, n) => { + const i = Jt.useContext(h9), { char: s, hasFakeCaret: o, isActive: a } = i.slots[t]; + return /* @__PURE__ */ pe.jsxs( + "div", + { + ref: n, + className: uo( + "xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all", + a && "xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background", + e + ), + ...r, + children: [ + s, + o && /* @__PURE__ */ pe.jsx("div", { className: "xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center", children: /* @__PURE__ */ pe.jsx("div", { className: "xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000" }) }) + ] + } + ); +}); +xa.displayName = "InputOTPSlot"; +function Tee(t) { + const { spinning: e, children: r, className: n } = t; + return /* @__PURE__ */ pe.jsxs("div", { className: "xc-inline-block xc-relative", children: [ + r, + e && /* @__PURE__ */ pe.jsx("div", { className: uo("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center", n), children: /* @__PURE__ */ pe.jsx(ja, { className: "xc-animate-spin" }) }) + ] }); +} +function m9(t) { + const { email: e } = t, [r, n] = Xt(0), [i, s] = Xt(!1), [o, a] = Xt(""); + async function f() { + n(60); + const h = setInterval(() => { + n((g) => g === 0 ? (clearInterval(h), 0) : g - 1); + }, 1e3); + } + async function u(h) { + if (a(""), !(h.length < 6)) { + s(!0); + try { + await t.onInputCode(e, h); + } catch (g) { + a(g.message); + } + s(!1); + } + } + return Rn(() => { + f(); + }, []), /* @__PURE__ */ pe.jsxs(ps, { children: [ + /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ + /* @__PURE__ */ pe.jsx(iY, { className: "xc-mb-4", size: 60 }), + /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16", children: [ + /* @__PURE__ */ pe.jsx("p", { className: "xc-text-lg xc-mb-1", children: "We’ve sent a verification code to" }), + /* @__PURE__ */ pe.jsx("p", { className: "xc-font-bold xc-text-center", children: e }) + ] }), + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-2 xc-h-12", children: /* @__PURE__ */ pe.jsx(Tee, { spinning: i, className: "xc-rounded-xl", children: /* @__PURE__ */ pe.jsx(p9, { maxLength: 6, onChange: u, disabled: i, className: "disabled:xc-opacity-20", children: /* @__PURE__ */ pe.jsx(g9, { children: /* @__PURE__ */ pe.jsxs("div", { className: uo("xc-flex xc-gap-2", i ? "xc-opacity-20" : ""), children: [ + /* @__PURE__ */ pe.jsx(xa, { index: 0 }), + /* @__PURE__ */ pe.jsx(xa, { index: 1 }), + /* @__PURE__ */ pe.jsx(xa, { index: 2 }), + /* @__PURE__ */ pe.jsx(xa, { index: 3 }), + /* @__PURE__ */ pe.jsx(xa, { index: 4 }), + /* @__PURE__ */ pe.jsx(xa, { index: 5 }) + ] }) }) }) }) }), + o && /* @__PURE__ */ pe.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ pe.jsx("p", { children: o }) }) + ] }), + /* @__PURE__ */ pe.jsxs("div", { className: "xc-text-center xc-text-sm xc-text-gray-400", children: [ + "Not get it? ", + r ? `Resend in ${r}s` : /* @__PURE__ */ pe.jsx("button", { id: "sendCodeButton", onClick: t.onResendCode, children: "Send again" }) + ] }), + /* @__PURE__ */ pe.jsx("div", { id: "captcha-element" }) + ] }); +} +function v9(t) { + const { email: e } = t, [r, n] = Xt(!1), [i, s] = Xt(""), o = hi(() => `xn-btn-${(/* @__PURE__ */ new Date()).getTime()}`, [e]); + async function a(v, x) { + n(!0), s(""), await Qo.getEmailCode({ account_type: "email", email: v }, x), n(!1); + } + async function f(v) { + try { + return await a(e, JSON.stringify(v)), { captchaResult: !0, bizResult: !0 }; + } catch (x) { + return s(x.message), { captchaResult: !1, bizResult: !1 }; + } + } + async function u(v) { + v && t.onCodeSend(); + } + const h = Kn(); + function g(v) { + h.current = v; + } + return Rn(() => { + if (e) + return window.initAliyunCaptcha({ + SceneId: "tqyu8129d", + prefix: "1mfsn5f", + mode: "popup", + element: "#captcha-element", + button: `#${o}`, + captchaVerifyCallback: f, + onBizResultCallback: u, + getInstance: g, + slideStyle: { + width: 360, + height: 40 + }, + language: "en", + region: "cn" + }), () => { + document.getElementById("aliyunCaptcha-mask")?.remove(), document.getElementById("aliyunCaptcha-window-popup")?.remove(); + }; + }, [e]), /* @__PURE__ */ pe.jsxs(ps, { children: [ + /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ + /* @__PURE__ */ pe.jsx(sY, { className: "xc-mb-4", size: 60 }), + /* @__PURE__ */ pe.jsx("button", { className: "xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2", id: o, children: r ? /* @__PURE__ */ pe.jsx(ja, { className: "xc-animate-spin" }) : "I'm not a robot" }) + ] }), + i && /* @__PURE__ */ pe.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ pe.jsx("p", { children: i }) }) + ] }); +} +function Dee(t) { + const { email: e } = t, r = Pb(), [n, i] = Xt("captcha"); + async function s(o, a) { + const f = await Qo.emailLogin({ + account_type: "email", + connector: "codatta_email", + account_enum: "C", + email_code: a, + email: o, + inviter_code: r.inviterCode, + source: { + device: r.device, + channel: r.channel, + app: r.app + } + }); + t.onLogin(f.data); + } + return /* @__PURE__ */ pe.jsxs(ps, { children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ pe.jsx(Ja, { title: "Sign in with email", onBack: t.onBack }) }), + n === "captcha" && /* @__PURE__ */ pe.jsx(v9, { email: e, onCodeSend: () => i("verify-email") }), + n === "verify-email" && /* @__PURE__ */ pe.jsx(m9, { email: e, onInputCode: s, onResendCode: () => i("captcha") }) + ] }); +} +var nd = { exports: {} }, Oee = nd.exports, O5; +function Nee() { + return O5 || (O5 = 1, (function(t, e) { + (function(r, n) { + t.exports = n(); + })(Oee, (() => (() => { + var r = { 873: (o, a) => { + var f, u, h = (function() { + var g = function(l, p) { + var m = l, w = $[p], P = null, _ = 0, y = null, M = [], I = {}, q = function(re, he) { + P = (function(ae) { + for (var fe = new Array(ae), be = 0; be < ae; be += 1) { + fe[be] = new Array(ae); + for (var Ae = 0; Ae < ae; Ae += 1) fe[be][Ae] = null; + } + return fe; + })(_ = 4 * m + 17), ce(0, 0), ce(_ - 7, 0), ce(0, _ - 7), oe(), L(), X(re, he), m >= 7 && Q(re), y == null && (y = O(m, w, M)), ee(y, he); + }, ce = function(re, he) { + for (var ae = -1; ae <= 7; ae += 1) if (!(re + ae <= -1 || _ <= re + ae)) for (var fe = -1; fe <= 7; fe += 1) he + fe <= -1 || _ <= he + fe || (P[re + ae][he + fe] = 0 <= ae && ae <= 6 && (fe == 0 || fe == 6) || 0 <= fe && fe <= 6 && (ae == 0 || ae == 6) || 2 <= ae && ae <= 4 && 2 <= fe && fe <= 4); + }, L = function() { + for (var re = 8; re < _ - 8; re += 1) P[re][6] == null && (P[re][6] = re % 2 == 0); + for (var he = 8; he < _ - 8; he += 1) P[6][he] == null && (P[6][he] = he % 2 == 0); + }, oe = function() { + for (var re = N.getPatternPosition(m), he = 0; he < re.length; he += 1) for (var ae = 0; ae < re.length; ae += 1) { + var fe = re[he], be = re[ae]; + if (P[fe][be] == null) for (var Ae = -2; Ae <= 2; Ae += 1) for (var Te = -2; Te <= 2; Te += 1) P[fe + Ae][be + Te] = Ae == -2 || Ae == 2 || Te == -2 || Te == 2 || Ae == 0 && Te == 0; + } + }, Q = function(re) { + for (var he = N.getBCHTypeNumber(m), ae = 0; ae < 18; ae += 1) { + var fe = !re && (he >> ae & 1) == 1; + P[Math.floor(ae / 3)][ae % 3 + _ - 8 - 3] = fe; + } + for (ae = 0; ae < 18; ae += 1) fe = !re && (he >> ae & 1) == 1, P[ae % 3 + _ - 8 - 3][Math.floor(ae / 3)] = fe; + }, X = function(re, he) { + for (var ae = w << 3 | he, fe = N.getBCHTypeInfo(ae), be = 0; be < 15; be += 1) { + var Ae = !re && (fe >> be & 1) == 1; + be < 6 ? P[be][8] = Ae : be < 8 ? P[be + 1][8] = Ae : P[_ - 15 + be][8] = Ae; + } + for (be = 0; be < 15; be += 1) Ae = !re && (fe >> be & 1) == 1, be < 8 ? P[8][_ - be - 1] = Ae : be < 9 ? P[8][15 - be - 1 + 1] = Ae : P[8][15 - be - 1] = Ae; + P[_ - 8][8] = !re; + }, ee = function(re, he) { + for (var ae = -1, fe = _ - 1, be = 7, Ae = 0, Te = N.getMaskFunction(he), Re = _ - 1; Re > 0; Re -= 2) for (Re == 6 && (Re -= 1); ; ) { + for (var $e = 0; $e < 2; $e += 1) if (P[fe][Re - $e] == null) { + var Me = !1; + Ae < re.length && (Me = (re[Ae] >>> be & 1) == 1), Te(fe, Re - $e) && (Me = !Me), P[fe][Re - $e] = Me, (be -= 1) == -1 && (Ae += 1, be = 7); + } + if ((fe += ae) < 0 || _ <= fe) { + fe -= ae, ae = -ae; + break; + } + } + }, O = function(re, he, ae) { + for (var fe = B.getRSBlocks(re, he), be = U(), Ae = 0; Ae < ae.length; Ae += 1) { + var Te = ae[Ae]; + be.put(Te.getMode(), 4), be.put(Te.getLength(), N.getLengthInBits(Te.getMode(), re)), Te.write(be); + } + var Re = 0; + for (Ae = 0; Ae < fe.length; Ae += 1) Re += fe[Ae].dataCount; + if (be.getLengthInBits() > 8 * Re) throw "code length overflow. (" + be.getLengthInBits() + ">" + 8 * Re + ")"; + for (be.getLengthInBits() + 4 <= 8 * Re && be.put(0, 4); be.getLengthInBits() % 8 != 0; ) be.putBit(!1); + for (; !(be.getLengthInBits() >= 8 * Re || (be.put(236, 8), be.getLengthInBits() >= 8 * Re)); ) be.put(17, 8); + return (function($e, Me) { + for (var Oe = 0, ze = 0, De = 0, je = new Array(Me.length), Ue = new Array(Me.length), _e = 0; _e < Me.length; _e += 1) { + var Ze = Me[_e].dataCount, ot = Me[_e].totalCount - Ze; + ze = Math.max(ze, Ze), De = Math.max(De, ot), je[_e] = new Array(Ze); + for (var ke = 0; ke < je[_e].length; ke += 1) je[_e][ke] = 255 & $e.getBuffer()[ke + Oe]; + Oe += Ze; + var rt = N.getErrorCorrectPolynomial(ot), nt = k(je[_e], rt.getLength() - 1).mod(rt); + for (Ue[_e] = new Array(rt.getLength() - 1), ke = 0; ke < Ue[_e].length; ke += 1) { + var Ge = ke + nt.getLength() - Ue[_e].length; + Ue[_e][ke] = Ge >= 0 ? nt.getAt(Ge) : 0; + } + } + var ht = 0; + for (ke = 0; ke < Me.length; ke += 1) ht += Me[ke].totalCount; + var lt = new Array(ht), ct = 0; + for (ke = 0; ke < ze; ke += 1) for (_e = 0; _e < Me.length; _e += 1) ke < je[_e].length && (lt[ct] = je[_e][ke], ct += 1); + for (ke = 0; ke < De; ke += 1) for (_e = 0; _e < Me.length; _e += 1) ke < Ue[_e].length && (lt[ct] = Ue[_e][ke], ct += 1); + return lt; + })(be, fe); + }; + I.addData = function(re, he) { + var ae = null; + switch (he = he || "Byte") { + case "Numeric": + ae = R(re); + break; + case "Alphanumeric": + ae = W(re); + break; + case "Byte": + ae = J(re); + break; + case "Kanji": + ae = ne(re); + break; + default: + throw "mode:" + he; + } + M.push(ae), y = null; + }, I.isDark = function(re, he) { + if (re < 0 || _ <= re || he < 0 || _ <= he) throw re + "," + he; + return P[re][he]; + }, I.getModuleCount = function() { + return _; + }, I.make = function() { + if (m < 1) { + for (var re = 1; re < 40; re++) { + for (var he = B.getRSBlocks(re, w), ae = U(), fe = 0; fe < M.length; fe++) { + var be = M[fe]; + ae.put(be.getMode(), 4), ae.put(be.getLength(), N.getLengthInBits(be.getMode(), re)), be.write(ae); + } + var Ae = 0; + for (fe = 0; fe < he.length; fe++) Ae += he[fe].dataCount; + if (ae.getLengthInBits() <= 8 * Ae) break; + } + m = re; + } + q(!1, (function() { + for (var Te = 0, Re = 0, $e = 0; $e < 8; $e += 1) { + q(!0, $e); + var Me = N.getLostPoint(I); + ($e == 0 || Te > Me) && (Te = Me, Re = $e); + } + return Re; + })()); + }, I.createTableTag = function(re, he) { + re = re || 2; + var ae = ""; + ae += '"; + }, I.createSvgTag = function(re, he, ae, fe) { + var be = {}; + typeof arguments[0] == "object" && (re = (be = arguments[0]).cellSize, he = be.margin, ae = be.alt, fe = be.title), re = re || 2, he = he === void 0 ? 4 * re : he, (ae = typeof ae == "string" ? { text: ae } : ae || {}).text = ae.text || null, ae.id = ae.text ? ae.id || "qrcode-description" : null, (fe = typeof fe == "string" ? { text: fe } : fe || {}).text = fe.text || null, fe.id = fe.text ? fe.id || "qrcode-title" : null; + var Ae, Te, Re, $e, Me = I.getModuleCount() * re + 2 * he, Oe = ""; + for ($e = "l" + re + ",0 0," + re + " -" + re + ",0 0,-" + re + "z ", Oe += '' + Z(fe.text) + "" : "", Oe += ae.text ? '' + Z(ae.text) + "" : "", Oe += '', Oe += '"; + }, I.createDataURL = function(re, he) { + re = re || 2, he = he === void 0 ? 4 * re : he; + var ae = I.getModuleCount() * re + 2 * he, fe = he, be = ae - he; + return b(ae, ae, (function(Ae, Te) { + if (fe <= Ae && Ae < be && fe <= Te && Te < be) { + var Re = Math.floor((Ae - fe) / re), $e = Math.floor((Te - fe) / re); + return I.isDark($e, Re) ? 0 : 1; + } + return 1; + })); + }, I.createImgTag = function(re, he, ae) { + re = re || 2, he = he === void 0 ? 4 * re : he; + var fe = I.getModuleCount() * re + 2 * he, be = ""; + return be += ""; + }; + var Z = function(re) { + for (var he = "", ae = 0; ae < re.length; ae += 1) { + var fe = re.charAt(ae); + switch (fe) { + case "<": + he += "<"; + break; + case ">": + he += ">"; + break; + case "&": + he += "&"; + break; + case '"': + he += """; + break; + default: + he += fe; + } + } + return he; + }; + return I.createASCII = function(re, he) { + if ((re = re || 1) < 2) return (function(je) { + je = je === void 0 ? 2 : je; + var Ue, _e, Ze, ot, ke, rt = 1 * I.getModuleCount() + 2 * je, nt = je, Ge = rt - je, ht = { "██": "█", "█ ": "▀", " █": "▄", " ": " " }, lt = { "██": "▀", "█ ": "▀", " █": " ", " ": " " }, ct = ""; + for (Ue = 0; Ue < rt; Ue += 2) { + for (Ze = Math.floor((Ue - nt) / 1), ot = Math.floor((Ue + 1 - nt) / 1), _e = 0; _e < rt; _e += 1) ke = "█", nt <= _e && _e < Ge && nt <= Ue && Ue < Ge && I.isDark(Ze, Math.floor((_e - nt) / 1)) && (ke = " "), nt <= _e && _e < Ge && nt <= Ue + 1 && Ue + 1 < Ge && I.isDark(ot, Math.floor((_e - nt) / 1)) ? ke += " " : ke += "█", ct += je < 1 && Ue + 1 >= Ge ? lt[ke] : ht[ke]; + ct += ` +`; + } + return rt % 2 && je > 0 ? ct.substring(0, ct.length - rt - 1) + Array(rt + 1).join("▀") : ct.substring(0, ct.length - 1); + })(he); + re -= 1, he = he === void 0 ? 2 * re : he; + var ae, fe, be, Ae, Te = I.getModuleCount() * re + 2 * he, Re = he, $e = Te - he, Me = Array(re + 1).join("██"), Oe = Array(re + 1).join(" "), ze = "", De = ""; + for (ae = 0; ae < Te; ae += 1) { + for (be = Math.floor((ae - Re) / re), De = "", fe = 0; fe < Te; fe += 1) Ae = 1, Re <= fe && fe < $e && Re <= ae && ae < $e && I.isDark(be, Math.floor((fe - Re) / re)) && (Ae = 0), De += Ae ? Me : Oe; + for (be = 0; be < re; be += 1) ze += De + ` +`; + } + return ze.substring(0, ze.length - 1); + }, I.renderTo2dContext = function(re, he) { + he = he || 2; + for (var ae = I.getModuleCount(), fe = 0; fe < ae; fe++) for (var be = 0; be < ae; be++) re.fillStyle = I.isDark(fe, be) ? "black" : "white", re.fillRect(fe * he, be * he, he, he); + }, I; + }; + g.stringToBytes = (g.stringToBytesFuncs = { default: function(l) { + for (var p = [], m = 0; m < l.length; m += 1) { + var w = l.charCodeAt(m); + p.push(255 & w); + } + return p; + } }).default, g.createStringToBytes = function(l, p) { + var m = (function() { + for (var P = E(l), _ = function() { + var L = P.read(); + if (L == -1) throw "eof"; + return L; + }, y = 0, M = {}; ; ) { + var I = P.read(); + if (I == -1) break; + var q = _(), ce = _() << 8 | _(); + M[String.fromCharCode(I << 8 | q)] = ce, y += 1; + } + if (y != p) throw y + " != " + p; + return M; + })(), w = 63; + return function(P) { + for (var _ = [], y = 0; y < P.length; y += 1) { + var M = P.charCodeAt(y); + if (M < 128) _.push(M); + else { + var I = m[P.charAt(y)]; + typeof I == "number" ? (255 & I) == I ? _.push(I) : (_.push(I >>> 8), _.push(255 & I)) : _.push(w); + } + } + return _; + }; + }; + var v, x, S, C, D, $ = { L: 1, M: 0, Q: 3, H: 2 }, N = (v = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], x = 1335, S = 7973, D = function(l) { + for (var p = 0; l != 0; ) p += 1, l >>>= 1; + return p; + }, (C = {}).getBCHTypeInfo = function(l) { + for (var p = l << 10; D(p) - D(x) >= 0; ) p ^= x << D(p) - D(x); + return 21522 ^ (l << 10 | p); + }, C.getBCHTypeNumber = function(l) { + for (var p = l << 12; D(p) - D(S) >= 0; ) p ^= S << D(p) - D(S); + return l << 12 | p; + }, C.getPatternPosition = function(l) { + return v[l - 1]; + }, C.getMaskFunction = function(l) { + switch (l) { + case 0: + return function(p, m) { + return (p + m) % 2 == 0; + }; + case 1: + return function(p, m) { + return p % 2 == 0; + }; + case 2: + return function(p, m) { + return m % 3 == 0; + }; + case 3: + return function(p, m) { + return (p + m) % 3 == 0; + }; + case 4: + return function(p, m) { + return (Math.floor(p / 2) + Math.floor(m / 3)) % 2 == 0; + }; + case 5: + return function(p, m) { + return p * m % 2 + p * m % 3 == 0; + }; + case 6: + return function(p, m) { + return (p * m % 2 + p * m % 3) % 2 == 0; + }; + case 7: + return function(p, m) { + return (p * m % 3 + (p + m) % 2) % 2 == 0; + }; + default: + throw "bad maskPattern:" + l; + } + }, C.getErrorCorrectPolynomial = function(l) { + for (var p = k([1], 0), m = 0; m < l; m += 1) p = p.multiply(k([1, z.gexp(m)], 0)); + return p; + }, C.getLengthInBits = function(l, p) { + if (1 <= p && p < 10) switch (l) { + case 1: + return 10; + case 2: + return 9; + case 4: + case 8: + return 8; + default: + throw "mode:" + l; + } + else if (p < 27) switch (l) { + case 1: + return 12; + case 2: + return 11; + case 4: + return 16; + case 8: + return 10; + default: + throw "mode:" + l; + } + else { + if (!(p < 41)) throw "type:" + p; + switch (l) { + case 1: + return 14; + case 2: + return 13; + case 4: + return 16; + case 8: + return 12; + default: + throw "mode:" + l; + } + } + }, C.getLostPoint = function(l) { + for (var p = l.getModuleCount(), m = 0, w = 0; w < p; w += 1) for (var P = 0; P < p; P += 1) { + for (var _ = 0, y = l.isDark(w, P), M = -1; M <= 1; M += 1) if (!(w + M < 0 || p <= w + M)) for (var I = -1; I <= 1; I += 1) P + I < 0 || p <= P + I || M == 0 && I == 0 || y == l.isDark(w + M, P + I) && (_ += 1); + _ > 5 && (m += 3 + _ - 5); + } + for (w = 0; w < p - 1; w += 1) for (P = 0; P < p - 1; P += 1) { + var q = 0; + l.isDark(w, P) && (q += 1), l.isDark(w + 1, P) && (q += 1), l.isDark(w, P + 1) && (q += 1), l.isDark(w + 1, P + 1) && (q += 1), q != 0 && q != 4 || (m += 3); + } + for (w = 0; w < p; w += 1) for (P = 0; P < p - 6; P += 1) l.isDark(w, P) && !l.isDark(w, P + 1) && l.isDark(w, P + 2) && l.isDark(w, P + 3) && l.isDark(w, P + 4) && !l.isDark(w, P + 5) && l.isDark(w, P + 6) && (m += 40); + for (P = 0; P < p; P += 1) for (w = 0; w < p - 6; w += 1) l.isDark(w, P) && !l.isDark(w + 1, P) && l.isDark(w + 2, P) && l.isDark(w + 3, P) && l.isDark(w + 4, P) && !l.isDark(w + 5, P) && l.isDark(w + 6, P) && (m += 40); + var ce = 0; + for (P = 0; P < p; P += 1) for (w = 0; w < p; w += 1) l.isDark(w, P) && (ce += 1); + return m + Math.abs(100 * ce / p / p - 50) / 5 * 10; + }, C), z = (function() { + for (var l = new Array(256), p = new Array(256), m = 0; m < 8; m += 1) l[m] = 1 << m; + for (m = 8; m < 256; m += 1) l[m] = l[m - 4] ^ l[m - 5] ^ l[m - 6] ^ l[m - 8]; + for (m = 0; m < 255; m += 1) p[l[m]] = m; + return { glog: function(w) { + if (w < 1) throw "glog(" + w + ")"; + return p[w]; + }, gexp: function(w) { + for (; w < 0; ) w += 255; + for (; w >= 256; ) w -= 255; + return l[w]; + } }; + })(); + function k(l, p) { + if (l.length === void 0) throw l.length + "/" + p; + var m = (function() { + for (var P = 0; P < l.length && l[P] == 0; ) P += 1; + for (var _ = new Array(l.length - P + p), y = 0; y < l.length - P; y += 1) _[y] = l[y + P]; + return _; + })(), w = { getAt: function(P) { + return m[P]; + }, getLength: function() { + return m.length; + }, multiply: function(P) { + for (var _ = new Array(w.getLength() + P.getLength() - 1), y = 0; y < w.getLength(); y += 1) for (var M = 0; M < P.getLength(); M += 1) _[y + M] ^= z.gexp(z.glog(w.getAt(y)) + z.glog(P.getAt(M))); + return k(_, 0); + }, mod: function(P) { + if (w.getLength() - P.getLength() < 0) return w; + for (var _ = z.glog(w.getAt(0)) - z.glog(P.getAt(0)), y = new Array(w.getLength()), M = 0; M < w.getLength(); M += 1) y[M] = w.getAt(M); + for (M = 0; M < P.getLength(); M += 1) y[M] ^= z.gexp(z.glog(P.getAt(M)) + _); + return k(y, 0).mod(P); + } }; + return w; + } + var B = /* @__PURE__ */ (function() { + var l = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12, 7, 37, 13], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]], p = function(w, P) { + var _ = {}; + return _.totalCount = w, _.dataCount = P, _; + }, m = { getRSBlocks: function(w, P) { + var _ = (function(Q, X) { + switch (X) { + case $.L: + return l[4 * (Q - 1) + 0]; + case $.M: + return l[4 * (Q - 1) + 1]; + case $.Q: + return l[4 * (Q - 1) + 2]; + case $.H: + return l[4 * (Q - 1) + 3]; + default: + return; + } + })(w, P); + if (_ === void 0) throw "bad rs block @ typeNumber:" + w + "/errorCorrectionLevel:" + P; + for (var y = _.length / 3, M = [], I = 0; I < y; I += 1) for (var q = _[3 * I + 0], ce = _[3 * I + 1], L = _[3 * I + 2], oe = 0; oe < q; oe += 1) M.push(p(ce, L)); + return M; + } }; + return m; + })(), U = function() { + var l = [], p = 0, m = { getBuffer: function() { + return l; + }, getAt: function(w) { + var P = Math.floor(w / 8); + return (l[P] >>> 7 - w % 8 & 1) == 1; + }, put: function(w, P) { + for (var _ = 0; _ < P; _ += 1) m.putBit((w >>> P - _ - 1 & 1) == 1); + }, getLengthInBits: function() { + return p; + }, putBit: function(w) { + var P = Math.floor(p / 8); + l.length <= P && l.push(0), w && (l[P] |= 128 >>> p % 8), p += 1; + } }; + return m; + }, R = function(l) { + var p = l, m = { getMode: function() { + return 1; + }, getLength: function(_) { + return p.length; + }, write: function(_) { + for (var y = p, M = 0; M + 2 < y.length; ) _.put(w(y.substring(M, M + 3)), 10), M += 3; + M < y.length && (y.length - M == 1 ? _.put(w(y.substring(M, M + 1)), 4) : y.length - M == 2 && _.put(w(y.substring(M, M + 2)), 7)); + } }, w = function(_) { + for (var y = 0, M = 0; M < _.length; M += 1) y = 10 * y + P(_.charAt(M)); + return y; + }, P = function(_) { + if ("0" <= _ && _ <= "9") return _.charCodeAt(0) - 48; + throw "illegal char :" + _; + }; + return m; + }, W = function(l) { + var p = l, m = { getMode: function() { + return 2; + }, getLength: function(P) { + return p.length; + }, write: function(P) { + for (var _ = p, y = 0; y + 1 < _.length; ) P.put(45 * w(_.charAt(y)) + w(_.charAt(y + 1)), 11), y += 2; + y < _.length && P.put(w(_.charAt(y)), 6); + } }, w = function(P) { + if ("0" <= P && P <= "9") return P.charCodeAt(0) - 48; + if ("A" <= P && P <= "Z") return P.charCodeAt(0) - 65 + 10; + switch (P) { + case " ": + return 36; + case "$": + return 37; + case "%": + return 38; + case "*": + return 39; + case "+": + return 40; + case "-": + return 41; + case ".": + return 42; + case "/": + return 43; + case ":": + return 44; + default: + throw "illegal char :" + P; + } + }; + return m; + }, J = function(l) { + var p = g.stringToBytes(l); + return { getMode: function() { + return 4; + }, getLength: function(m) { + return p.length; + }, write: function(m) { + for (var w = 0; w < p.length; w += 1) m.put(p[w], 8); + } }; + }, ne = function(l) { + var p = g.stringToBytesFuncs.SJIS; + if (!p) throw "sjis not supported."; + (function() { + var P = p("友"); + if (P.length != 2 || (P[0] << 8 | P[1]) != 38726) throw "sjis not supported."; + })(); + var m = p(l), w = { getMode: function() { + return 8; + }, getLength: function(P) { + return ~~(m.length / 2); + }, write: function(P) { + for (var _ = m, y = 0; y + 1 < _.length; ) { + var M = (255 & _[y]) << 8 | 255 & _[y + 1]; + if (33088 <= M && M <= 40956) M -= 33088; + else { + if (!(57408 <= M && M <= 60351)) throw "illegal char at " + (y + 1) + "/" + M; + M -= 49472; + } + M = 192 * (M >>> 8 & 255) + (255 & M), P.put(M, 13), y += 2; + } + if (y < _.length) throw "illegal char at " + (y + 1); + } }; + return w; + }, K = function() { + var l = [], p = { writeByte: function(m) { + l.push(255 & m); + }, writeShort: function(m) { + p.writeByte(m), p.writeByte(m >>> 8); + }, writeBytes: function(m, w, P) { + w = w || 0, P = P || m.length; + for (var _ = 0; _ < P; _ += 1) p.writeByte(m[_ + w]); + }, writeString: function(m) { + for (var w = 0; w < m.length; w += 1) p.writeByte(m.charCodeAt(w)); + }, toByteArray: function() { + return l; + }, toString: function() { + var m = ""; + m += "["; + for (var w = 0; w < l.length; w += 1) w > 0 && (m += ","), m += l[w]; + return m + "]"; + } }; + return p; + }, E = function(l) { + var p = l, m = 0, w = 0, P = 0, _ = { read: function() { + for (; P < 8; ) { + if (m >= p.length) { + if (P == 0) return -1; + throw "unexpected end of file./" + P; + } + var M = p.charAt(m); + if (m += 1, M == "=") return P = 0, -1; + M.match(/^\s$/) || (w = w << 6 | y(M.charCodeAt(0)), P += 6); + } + var I = w >>> P - 8 & 255; + return P -= 8, I; + } }, y = function(M) { + if (65 <= M && M <= 90) return M - 65; + if (97 <= M && M <= 122) return M - 97 + 26; + if (48 <= M && M <= 57) return M - 48 + 52; + if (M == 43) return 62; + if (M == 47) return 63; + throw "c:" + M; + }; + return _; + }, b = function(l, p, m) { + for (var w = (function(ce, L) { + var oe = ce, Q = L, X = new Array(ce * L), ee = { setPixel: function(re, he, ae) { + X[he * oe + re] = ae; + }, write: function(re) { + re.writeString("GIF87a"), re.writeShort(oe), re.writeShort(Q), re.writeByte(128), re.writeByte(0), re.writeByte(0), re.writeByte(0), re.writeByte(0), re.writeByte(0), re.writeByte(255), re.writeByte(255), re.writeByte(255), re.writeString(","), re.writeShort(0), re.writeShort(0), re.writeShort(oe), re.writeShort(Q), re.writeByte(0); + var he = O(2); + re.writeByte(2); + for (var ae = 0; he.length - ae > 255; ) re.writeByte(255), re.writeBytes(he, ae, 255), ae += 255; + re.writeByte(he.length - ae), re.writeBytes(he, ae, he.length - ae), re.writeByte(0), re.writeString(";"); + } }, O = function(re) { + for (var he = 1 << re, ae = 1 + (1 << re), fe = re + 1, be = Z(), Ae = 0; Ae < he; Ae += 1) be.add(String.fromCharCode(Ae)); + be.add(String.fromCharCode(he)), be.add(String.fromCharCode(ae)); + var Te, Re, $e, Me = K(), Oe = (Te = Me, Re = 0, $e = 0, { write: function(Ue, _e) { + if (Ue >>> _e) throw "length over"; + for (; Re + _e >= 8; ) Te.writeByte(255 & (Ue << Re | $e)), _e -= 8 - Re, Ue >>>= 8 - Re, $e = 0, Re = 0; + $e |= Ue << Re, Re += _e; + }, flush: function() { + Re > 0 && Te.writeByte($e); + } }); + Oe.write(he, fe); + var ze = 0, De = String.fromCharCode(X[ze]); + for (ze += 1; ze < X.length; ) { + var je = String.fromCharCode(X[ze]); + ze += 1, be.contains(De + je) ? De += je : (Oe.write(be.indexOf(De), fe), be.size() < 4095 && (be.size() == 1 << fe && (fe += 1), be.add(De + je)), De = je); + } + return Oe.write(be.indexOf(De), fe), Oe.write(ae, fe), Oe.flush(), Me.toByteArray(); + }, Z = function() { + var re = {}, he = 0, ae = { add: function(fe) { + if (ae.contains(fe)) throw "dup key:" + fe; + re[fe] = he, he += 1; + }, size: function() { + return he; + }, indexOf: function(fe) { + return re[fe]; + }, contains: function(fe) { + return re[fe] !== void 0; + } }; + return ae; + }; + return ee; + })(l, p), P = 0; P < p; P += 1) for (var _ = 0; _ < l; _ += 1) w.setPixel(_, P, m(_, P)); + var y = K(); + w.write(y); + for (var M = (function() { + var ce = 0, L = 0, oe = 0, Q = "", X = {}, ee = function(Z) { + Q += String.fromCharCode(O(63 & Z)); + }, O = function(Z) { + if (!(Z < 0)) { + if (Z < 26) return 65 + Z; + if (Z < 52) return Z - 26 + 97; + if (Z < 62) return Z - 52 + 48; + if (Z == 62) return 43; + if (Z == 63) return 47; + } + throw "n:" + Z; + }; + return X.writeByte = function(Z) { + for (ce = ce << 8 | 255 & Z, L += 8, oe += 1; L >= 6; ) ee(ce >>> L - 6), L -= 6; + }, X.flush = function() { + if (L > 0 && (ee(ce << 6 - L), ce = 0, L = 0), oe % 3 != 0) for (var Z = 3 - oe % 3, re = 0; re < Z; re += 1) Q += "="; + }, X.toString = function() { + return Q; + }, X; + })(), I = y.toByteArray(), q = 0; q < I.length; q += 1) M.writeByte(I[q]); + return M.flush(), "data:image/gif;base64," + M; + }; + return g; + })(); + h.stringToBytesFuncs["UTF-8"] = function(g) { + return (function(v) { + for (var x = [], S = 0; S < v.length; S++) { + var C = v.charCodeAt(S); + C < 128 ? x.push(C) : C < 2048 ? x.push(192 | C >> 6, 128 | 63 & C) : C < 55296 || C >= 57344 ? x.push(224 | C >> 12, 128 | C >> 6 & 63, 128 | 63 & C) : (S++, C = 65536 + ((1023 & C) << 10 | 1023 & v.charCodeAt(S)), x.push(240 | C >> 18, 128 | C >> 12 & 63, 128 | C >> 6 & 63, 128 | 63 & C)); + } + return x; + })(g); + }, (u = typeof (f = function() { + return h; + }) == "function" ? f.apply(a, []) : f) === void 0 || (o.exports = u); + } }, n = {}; + function i(o) { + var a = n[o]; + if (a !== void 0) return a.exports; + var f = n[o] = { exports: {} }; + return r[o](f, f.exports, i), f.exports; + } + i.n = (o) => { + var a = o && o.__esModule ? () => o.default : () => o; + return i.d(a, { a }), a; + }, i.d = (o, a) => { + for (var f in a) i.o(a, f) && !i.o(o, f) && Object.defineProperty(o, f, { enumerable: !0, get: a[f] }); + }, i.o = (o, a) => Object.prototype.hasOwnProperty.call(o, a); + var s = {}; + return (() => { + i.d(s, { default: () => K }); + const o = (E) => !!E && typeof E == "object" && !Array.isArray(E); + function a(E, ...b) { + if (!b.length) return E; + const l = b.shift(); + return l !== void 0 && o(E) && o(l) ? (E = Object.assign({}, E), Object.keys(l).forEach(((p) => { + const m = E[p], w = l[p]; + Array.isArray(m) && Array.isArray(w) ? E[p] = w : o(m) && o(w) ? E[p] = a(Object.assign({}, m), w) : E[p] = w; + })), a(E, ...b)) : E; + } + function f(E, b) { + const l = document.createElement("a"); + l.download = b, l.href = E, document.body.appendChild(l), l.click(), document.body.removeChild(l); + } + const u = { L: 0.07, M: 0.15, Q: 0.25, H: 0.3 }; + class h { + constructor({ svg: b, type: l, window: p }) { + this._svg = b, this._type = l, this._window = p; + } + draw(b, l, p, m) { + let w; + switch (this._type) { + case "dots": + w = this._drawDot; + break; + case "classy": + w = this._drawClassy; + break; + case "classy-rounded": + w = this._drawClassyRounded; + break; + case "rounded": + w = this._drawRounded; + break; + case "extra-rounded": + w = this._drawExtraRounded; + break; + default: + w = this._drawSquare; + } + w.call(this, { x: b, y: l, size: p, getNeighbor: m }); + } + _rotateFigure({ x: b, y: l, size: p, rotation: m = 0, draw: w }) { + var P; + const _ = b + p / 2, y = l + p / 2; + w(), (P = this._element) === null || P === void 0 || P.setAttribute("transform", `rotate(${180 * m / Math.PI},${_},${y})`); + } + _basicDot(b) { + const { size: l, x: p, y: m } = b; + this._rotateFigure(Object.assign(Object.assign({}, b), { draw: () => { + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "circle"), this._element.setAttribute("cx", String(p + l / 2)), this._element.setAttribute("cy", String(m + l / 2)), this._element.setAttribute("r", String(l / 2)); + } })); + } + _basicSquare(b) { + const { size: l, x: p, y: m } = b; + this._rotateFigure(Object.assign(Object.assign({}, b), { draw: () => { + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"), this._element.setAttribute("x", String(p)), this._element.setAttribute("y", String(m)), this._element.setAttribute("width", String(l)), this._element.setAttribute("height", String(l)); + } })); + } + _basicSideRounded(b) { + const { size: l, x: p, y: m } = b; + this._rotateFigure(Object.assign(Object.assign({}, b), { draw: () => { + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${p} ${m}v ${l}h ` + l / 2 + `a ${l / 2} ${l / 2}, 0, 0, 0, 0 ${-l}`); + } })); + } + _basicCornerRounded(b) { + const { size: l, x: p, y: m } = b; + this._rotateFigure(Object.assign(Object.assign({}, b), { draw: () => { + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${p} ${m}v ${l}h ${l}v ` + -l / 2 + `a ${l / 2} ${l / 2}, 0, 0, 0, ${-l / 2} ${-l / 2}`); + } })); + } + _basicCornerExtraRounded(b) { + const { size: l, x: p, y: m } = b; + this._rotateFigure(Object.assign(Object.assign({}, b), { draw: () => { + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${p} ${m}v ${l}h ${l}a ${l} ${l}, 0, 0, 0, ${-l} ${-l}`); + } })); + } + _basicCornersRounded(b) { + const { size: l, x: p, y: m } = b; + this._rotateFigure(Object.assign(Object.assign({}, b), { draw: () => { + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${p} ${m}v ` + l / 2 + `a ${l / 2} ${l / 2}, 0, 0, 0, ${l / 2} ${l / 2}h ` + l / 2 + "v " + -l / 2 + `a ${l / 2} ${l / 2}, 0, 0, 0, ${-l / 2} ${-l / 2}`); + } })); + } + _drawDot({ x: b, y: l, size: p }) { + this._basicDot({ x: b, y: l, size: p, rotation: 0 }); + } + _drawSquare({ x: b, y: l, size: p }) { + this._basicSquare({ x: b, y: l, size: p, rotation: 0 }); + } + _drawRounded({ x: b, y: l, size: p, getNeighbor: m }) { + const w = m ? +m(-1, 0) : 0, P = m ? +m(1, 0) : 0, _ = m ? +m(0, -1) : 0, y = m ? +m(0, 1) : 0, M = w + P + _ + y; + if (M !== 0) if (M > 2 || w && P || _ && y) this._basicSquare({ x: b, y: l, size: p, rotation: 0 }); + else { + if (M === 2) { + let I = 0; + return w && _ ? I = Math.PI / 2 : _ && P ? I = Math.PI : P && y && (I = -Math.PI / 2), void this._basicCornerRounded({ x: b, y: l, size: p, rotation: I }); + } + if (M === 1) { + let I = 0; + return _ ? I = Math.PI / 2 : P ? I = Math.PI : y && (I = -Math.PI / 2), void this._basicSideRounded({ x: b, y: l, size: p, rotation: I }); + } + } + else this._basicDot({ x: b, y: l, size: p, rotation: 0 }); + } + _drawExtraRounded({ x: b, y: l, size: p, getNeighbor: m }) { + const w = m ? +m(-1, 0) : 0, P = m ? +m(1, 0) : 0, _ = m ? +m(0, -1) : 0, y = m ? +m(0, 1) : 0, M = w + P + _ + y; + if (M !== 0) if (M > 2 || w && P || _ && y) this._basicSquare({ x: b, y: l, size: p, rotation: 0 }); + else { + if (M === 2) { + let I = 0; + return w && _ ? I = Math.PI / 2 : _ && P ? I = Math.PI : P && y && (I = -Math.PI / 2), void this._basicCornerExtraRounded({ x: b, y: l, size: p, rotation: I }); + } + if (M === 1) { + let I = 0; + return _ ? I = Math.PI / 2 : P ? I = Math.PI : y && (I = -Math.PI / 2), void this._basicSideRounded({ x: b, y: l, size: p, rotation: I }); + } + } + else this._basicDot({ x: b, y: l, size: p, rotation: 0 }); + } + _drawClassy({ x: b, y: l, size: p, getNeighbor: m }) { + const w = m ? +m(-1, 0) : 0, P = m ? +m(1, 0) : 0, _ = m ? +m(0, -1) : 0, y = m ? +m(0, 1) : 0; + w + P + _ + y !== 0 ? w || _ ? P || y ? this._basicSquare({ x: b, y: l, size: p, rotation: 0 }) : this._basicCornerRounded({ x: b, y: l, size: p, rotation: Math.PI / 2 }) : this._basicCornerRounded({ x: b, y: l, size: p, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: b, y: l, size: p, rotation: Math.PI / 2 }); + } + _drawClassyRounded({ x: b, y: l, size: p, getNeighbor: m }) { + const w = m ? +m(-1, 0) : 0, P = m ? +m(1, 0) : 0, _ = m ? +m(0, -1) : 0, y = m ? +m(0, 1) : 0; + w + P + _ + y !== 0 ? w || _ ? P || y ? this._basicSquare({ x: b, y: l, size: p, rotation: 0 }) : this._basicCornerExtraRounded({ x: b, y: l, size: p, rotation: Math.PI / 2 }) : this._basicCornerExtraRounded({ x: b, y: l, size: p, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: b, y: l, size: p, rotation: Math.PI / 2 }); + } + } + class g { + constructor({ svg: b, type: l, window: p }) { + this._svg = b, this._type = l, this._window = p; + } + draw(b, l, p, m) { + let w; + switch (this._type) { + case "square": + w = this._drawSquare; + break; + case "extra-rounded": + w = this._drawExtraRounded; + break; + default: + w = this._drawDot; + } + w.call(this, { x: b, y: l, size: p, rotation: m }); + } + _rotateFigure({ x: b, y: l, size: p, rotation: m = 0, draw: w }) { + var P; + const _ = b + p / 2, y = l + p / 2; + w(), (P = this._element) === null || P === void 0 || P.setAttribute("transform", `rotate(${180 * m / Math.PI},${_},${y})`); + } + _basicDot(b) { + const { size: l, x: p, y: m } = b, w = l / 7; + this._rotateFigure(Object.assign(Object.assign({}, b), { draw: () => { + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${p + l / 2} ${m}a ${l / 2} ${l / 2} 0 1 0 0.1 0zm 0 ${w}a ${l / 2 - w} ${l / 2 - w} 0 1 1 -0.1 0Z`); + } })); + } + _basicSquare(b) { + const { size: l, x: p, y: m } = b, w = l / 7; + this._rotateFigure(Object.assign(Object.assign({}, b), { draw: () => { + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${p} ${m}v ${l}h ${l}v ` + -l + `zM ${p + w} ${m + w}h ` + (l - 2 * w) + "v " + (l - 2 * w) + "h " + (2 * w - l) + "z"); + } })); + } + _basicExtraRounded(b) { + const { size: l, x: p, y: m } = b, w = l / 7; + this._rotateFigure(Object.assign(Object.assign({}, b), { draw: () => { + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${p} ${m + 2.5 * w}v ` + 2 * w + `a ${2.5 * w} ${2.5 * w}, 0, 0, 0, ${2.5 * w} ${2.5 * w}h ` + 2 * w + `a ${2.5 * w} ${2.5 * w}, 0, 0, 0, ${2.5 * w} ${2.5 * -w}v ` + -2 * w + `a ${2.5 * w} ${2.5 * w}, 0, 0, 0, ${2.5 * -w} ${2.5 * -w}h ` + -2 * w + `a ${2.5 * w} ${2.5 * w}, 0, 0, 0, ${2.5 * -w} ${2.5 * w}M ${p + 2.5 * w} ${m + w}h ` + 2 * w + `a ${1.5 * w} ${1.5 * w}, 0, 0, 1, ${1.5 * w} ${1.5 * w}v ` + 2 * w + `a ${1.5 * w} ${1.5 * w}, 0, 0, 1, ${1.5 * -w} ${1.5 * w}h ` + -2 * w + `a ${1.5 * w} ${1.5 * w}, 0, 0, 1, ${1.5 * -w} ${1.5 * -w}v ` + -2 * w + `a ${1.5 * w} ${1.5 * w}, 0, 0, 1, ${1.5 * w} ${1.5 * -w}`); + } })); + } + _drawDot({ x: b, y: l, size: p, rotation: m }) { + this._basicDot({ x: b, y: l, size: p, rotation: m }); + } + _drawSquare({ x: b, y: l, size: p, rotation: m }) { + this._basicSquare({ x: b, y: l, size: p, rotation: m }); + } + _drawExtraRounded({ x: b, y: l, size: p, rotation: m }) { + this._basicExtraRounded({ x: b, y: l, size: p, rotation: m }); + } + } + class v { + constructor({ svg: b, type: l, window: p }) { + this._svg = b, this._type = l, this._window = p; + } + draw(b, l, p, m) { + let w; + w = this._type === "square" ? this._drawSquare : this._drawDot, w.call(this, { x: b, y: l, size: p, rotation: m }); + } + _rotateFigure({ x: b, y: l, size: p, rotation: m = 0, draw: w }) { + var P; + const _ = b + p / 2, y = l + p / 2; + w(), (P = this._element) === null || P === void 0 || P.setAttribute("transform", `rotate(${180 * m / Math.PI},${_},${y})`); + } + _basicDot(b) { + const { size: l, x: p, y: m } = b; + this._rotateFigure(Object.assign(Object.assign({}, b), { draw: () => { + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "circle"), this._element.setAttribute("cx", String(p + l / 2)), this._element.setAttribute("cy", String(m + l / 2)), this._element.setAttribute("r", String(l / 2)); + } })); + } + _basicSquare(b) { + const { size: l, x: p, y: m } = b; + this._rotateFigure(Object.assign(Object.assign({}, b), { draw: () => { + this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"), this._element.setAttribute("x", String(p)), this._element.setAttribute("y", String(m)), this._element.setAttribute("width", String(l)), this._element.setAttribute("height", String(l)); + } })); + } + _drawDot({ x: b, y: l, size: p, rotation: m }) { + this._basicDot({ x: b, y: l, size: p, rotation: m }); + } + _drawSquare({ x: b, y: l, size: p, rotation: m }) { + this._basicSquare({ x: b, y: l, size: p, rotation: m }); + } + } + const x = "circle", S = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]], C = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]; + class D { + constructor(b, l) { + this._roundSize = (p) => this._options.dotsOptions.roundSize ? Math.floor(p) : p, this._window = l, this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._element.setAttribute("width", String(b.width)), this._element.setAttribute("height", String(b.height)), this._element.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), b.dotsOptions.roundSize || this._element.setAttribute("shape-rendering", "crispEdges"), this._element.setAttribute("viewBox", `0 0 ${b.width} ${b.height}`), this._defs = this._window.document.createElementNS("http://www.w3.org/2000/svg", "defs"), this._element.appendChild(this._defs), this._imageUri = b.image, this._instanceId = D.instanceCount++, this._options = b; + } + get width() { + return this._options.width; + } + get height() { + return this._options.height; + } + getElement() { + return this._element; + } + async drawQR(b) { + const l = b.getModuleCount(), p = Math.min(this._options.width, this._options.height) - 2 * this._options.margin, m = this._options.shape === x ? p / Math.sqrt(2) : p, w = this._roundSize(m / l); + let P = { hideXDots: 0, hideYDots: 0, width: 0, height: 0 }; + if (this._qr = b, this._options.image) { + if (await this.loadImage(), !this._image) return; + const { imageOptions: _, qrOptions: y } = this._options, M = _.imageSize * u[y.errorCorrectionLevel], I = Math.floor(M * l * l); + P = (function({ originalHeight: q, originalWidth: ce, maxHiddenDots: L, maxHiddenAxisDots: oe, dotSize: Q }) { + const X = { x: 0, y: 0 }, ee = { x: 0, y: 0 }; + if (q <= 0 || ce <= 0 || L <= 0 || Q <= 0) return { height: 0, width: 0, hideYDots: 0, hideXDots: 0 }; + const O = q / ce; + return X.x = Math.floor(Math.sqrt(L / O)), X.x <= 0 && (X.x = 1), oe && oe < X.x && (X.x = oe), X.x % 2 == 0 && X.x--, ee.x = X.x * Q, X.y = 1 + 2 * Math.ceil((X.x * O - 1) / 2), ee.y = Math.round(ee.x * O), (X.y * X.x > L || oe && oe < X.y) && (oe && oe < X.y ? (X.y = oe, X.y % 2 == 0 && X.x--) : X.y -= 2, ee.y = X.y * Q, X.x = 1 + 2 * Math.ceil((X.y / O - 1) / 2), ee.x = Math.round(ee.y / O)), { height: ee.y, width: ee.x, hideYDots: X.y, hideXDots: X.x }; + })({ originalWidth: this._image.width, originalHeight: this._image.height, maxHiddenDots: I, maxHiddenAxisDots: l - 14, dotSize: w }); + } + this.drawBackground(), this.drawDots(((_, y) => { + var M, I, q, ce, L, oe; + return !(this._options.imageOptions.hideBackgroundDots && _ >= (l - P.hideYDots) / 2 && _ < (l + P.hideYDots) / 2 && y >= (l - P.hideXDots) / 2 && y < (l + P.hideXDots) / 2 || !((M = S[_]) === null || M === void 0) && M[y] || !((I = S[_ - l + 7]) === null || I === void 0) && I[y] || !((q = S[_]) === null || q === void 0) && q[y - l + 7] || !((ce = C[_]) === null || ce === void 0) && ce[y] || !((L = C[_ - l + 7]) === null || L === void 0) && L[y] || !((oe = C[_]) === null || oe === void 0) && oe[y - l + 7]); + })), this.drawCorners(), this._options.image && await this.drawImage({ width: P.width, height: P.height, count: l, dotSize: w }); + } + drawBackground() { + var b, l, p; + const m = this._element, w = this._options; + if (m) { + const P = (b = w.backgroundOptions) === null || b === void 0 ? void 0 : b.gradient, _ = (l = w.backgroundOptions) === null || l === void 0 ? void 0 : l.color; + let y = w.height, M = w.width; + if (P || _) { + const I = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"); + this._backgroundClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._backgroundClipPath.setAttribute("id", `clip-path-background-color-${this._instanceId}`), this._defs.appendChild(this._backgroundClipPath), !((p = w.backgroundOptions) === null || p === void 0) && p.round && (y = M = Math.min(w.width, w.height), I.setAttribute("rx", String(y / 2 * w.backgroundOptions.round))), I.setAttribute("x", String(this._roundSize((w.width - M) / 2))), I.setAttribute("y", String(this._roundSize((w.height - y) / 2))), I.setAttribute("width", String(M)), I.setAttribute("height", String(y)), this._backgroundClipPath.appendChild(I), this._createColor({ options: P, color: _, additionalRotation: 0, x: 0, y: 0, height: w.height, width: w.width, name: `background-color-${this._instanceId}` }); + } + } + } + drawDots(b) { + var l, p; + if (!this._qr) throw "QR code is not defined"; + const m = this._options, w = this._qr.getModuleCount(); + if (w > m.width || w > m.height) throw "The canvas is too small."; + const P = Math.min(m.width, m.height) - 2 * m.margin, _ = m.shape === x ? P / Math.sqrt(2) : P, y = this._roundSize(_ / w), M = this._roundSize((m.width - w * y) / 2), I = this._roundSize((m.height - w * y) / 2), q = new h({ svg: this._element, type: m.dotsOptions.type, window: this._window }); + this._dotsClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._dotsClipPath.setAttribute("id", `clip-path-dot-color-${this._instanceId}`), this._defs.appendChild(this._dotsClipPath), this._createColor({ options: (l = m.dotsOptions) === null || l === void 0 ? void 0 : l.gradient, color: m.dotsOptions.color, additionalRotation: 0, x: 0, y: 0, height: m.height, width: m.width, name: `dot-color-${this._instanceId}` }); + for (let ce = 0; ce < w; ce++) for (let L = 0; L < w; L++) b && !b(ce, L) || !((p = this._qr) === null || p === void 0) && p.isDark(ce, L) && (q.draw(M + L * y, I + ce * y, y, ((oe, Q) => !(L + oe < 0 || ce + Q < 0 || L + oe >= w || ce + Q >= w) && !(b && !b(ce + Q, L + oe)) && !!this._qr && this._qr.isDark(ce + Q, L + oe))), q._element && this._dotsClipPath && this._dotsClipPath.appendChild(q._element)); + if (m.shape === x) { + const ce = this._roundSize((P / y - w) / 2), L = w + 2 * ce, oe = M - ce * y, Q = I - ce * y, X = [], ee = this._roundSize(L / 2); + for (let O = 0; O < L; O++) { + X[O] = []; + for (let Z = 0; Z < L; Z++) O >= ce - 1 && O <= L - ce && Z >= ce - 1 && Z <= L - ce || Math.sqrt((O - ee) * (O - ee) + (Z - ee) * (Z - ee)) > ee ? X[O][Z] = 0 : X[O][Z] = this._qr.isDark(Z - 2 * ce < 0 ? Z : Z >= w ? Z - 2 * ce : Z - ce, O - 2 * ce < 0 ? O : O >= w ? O - 2 * ce : O - ce) ? 1 : 0; + } + for (let O = 0; O < L; O++) for (let Z = 0; Z < L; Z++) X[O][Z] && (q.draw(oe + Z * y, Q + O * y, y, ((re, he) => { + var ae; + return !!(!((ae = X[O + he]) === null || ae === void 0) && ae[Z + re]); + })), q._element && this._dotsClipPath && this._dotsClipPath.appendChild(q._element)); + } + } + drawCorners() { + if (!this._qr) throw "QR code is not defined"; + const b = this._element, l = this._options; + if (!b) throw "Element code is not defined"; + const p = this._qr.getModuleCount(), m = Math.min(l.width, l.height) - 2 * l.margin, w = l.shape === x ? m / Math.sqrt(2) : m, P = this._roundSize(w / p), _ = 7 * P, y = 3 * P, M = this._roundSize((l.width - p * P) / 2), I = this._roundSize((l.height - p * P) / 2); + [[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach((([q, ce, L]) => { + var oe, Q, X, ee, O, Z, re, he, ae, fe, be, Ae; + const Te = M + q * P * (p - 7), Re = I + ce * P * (p - 7); + let $e = this._dotsClipPath, Me = this._dotsClipPath; + if ((!((oe = l.cornersSquareOptions) === null || oe === void 0) && oe.gradient || !((Q = l.cornersSquareOptions) === null || Q === void 0) && Q.color) && ($e = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), $e.setAttribute("id", `clip-path-corners-square-color-${q}-${ce}-${this._instanceId}`), this._defs.appendChild($e), this._cornersSquareClipPath = this._cornersDotClipPath = Me = $e, this._createColor({ options: (X = l.cornersSquareOptions) === null || X === void 0 ? void 0 : X.gradient, color: (ee = l.cornersSquareOptions) === null || ee === void 0 ? void 0 : ee.color, additionalRotation: L, x: Te, y: Re, height: _, width: _, name: `corners-square-color-${q}-${ce}-${this._instanceId}` })), (O = l.cornersSquareOptions) === null || O === void 0 ? void 0 : O.type) { + const Oe = new g({ svg: this._element, type: l.cornersSquareOptions.type, window: this._window }); + Oe.draw(Te, Re, _, L), Oe._element && $e && $e.appendChild(Oe._element); + } else { + const Oe = new h({ svg: this._element, type: l.dotsOptions.type, window: this._window }); + for (let ze = 0; ze < S.length; ze++) for (let De = 0; De < S[ze].length; De++) !((Z = S[ze]) === null || Z === void 0) && Z[De] && (Oe.draw(Te + De * P, Re + ze * P, P, ((je, Ue) => { + var _e; + return !!(!((_e = S[ze + Ue]) === null || _e === void 0) && _e[De + je]); + })), Oe._element && $e && $e.appendChild(Oe._element)); + } + if ((!((re = l.cornersDotOptions) === null || re === void 0) && re.gradient || !((he = l.cornersDotOptions) === null || he === void 0) && he.color) && (Me = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), Me.setAttribute("id", `clip-path-corners-dot-color-${q}-${ce}-${this._instanceId}`), this._defs.appendChild(Me), this._cornersDotClipPath = Me, this._createColor({ options: (ae = l.cornersDotOptions) === null || ae === void 0 ? void 0 : ae.gradient, color: (fe = l.cornersDotOptions) === null || fe === void 0 ? void 0 : fe.color, additionalRotation: L, x: Te + 2 * P, y: Re + 2 * P, height: y, width: y, name: `corners-dot-color-${q}-${ce}-${this._instanceId}` })), (be = l.cornersDotOptions) === null || be === void 0 ? void 0 : be.type) { + const Oe = new v({ svg: this._element, type: l.cornersDotOptions.type, window: this._window }); + Oe.draw(Te + 2 * P, Re + 2 * P, y, L), Oe._element && Me && Me.appendChild(Oe._element); + } else { + const Oe = new h({ svg: this._element, type: l.dotsOptions.type, window: this._window }); + for (let ze = 0; ze < C.length; ze++) for (let De = 0; De < C[ze].length; De++) !((Ae = C[ze]) === null || Ae === void 0) && Ae[De] && (Oe.draw(Te + De * P, Re + ze * P, P, ((je, Ue) => { + var _e; + return !!(!((_e = C[ze + Ue]) === null || _e === void 0) && _e[De + je]); + })), Oe._element && Me && Me.appendChild(Oe._element)); + } + })); + } + loadImage() { + return new Promise(((b, l) => { + var p; + const m = this._options; + if (!m.image) return l("Image is not defined"); + if (!((p = m.nodeCanvas) === null || p === void 0) && p.loadImage) m.nodeCanvas.loadImage(m.image).then(((w) => { + var P, _; + if (this._image = w, this._options.imageOptions.saveAsBlob) { + const y = (P = m.nodeCanvas) === null || P === void 0 ? void 0 : P.createCanvas(this._image.width, this._image.height); + (_ = y?.getContext("2d")) === null || _ === void 0 || _.drawImage(w, 0, 0), this._imageUri = y?.toDataURL(); + } + b(); + })).catch(l); + else { + const w = new this._window.Image(); + typeof m.imageOptions.crossOrigin == "string" && (w.crossOrigin = m.imageOptions.crossOrigin), this._image = w, w.onload = async () => { + this._options.imageOptions.saveAsBlob && (this._imageUri = await (async function(P, _) { + return new Promise(((y) => { + const M = new _.XMLHttpRequest(); + M.onload = function() { + const I = new _.FileReader(); + I.onloadend = function() { + y(I.result); + }, I.readAsDataURL(M.response); + }, M.open("GET", P), M.responseType = "blob", M.send(); + })); + })(m.image || "", this._window)), b(); + }, w.src = m.image; + } + })); + } + async drawImage({ width: b, height: l, count: p, dotSize: m }) { + const w = this._options, P = this._roundSize((w.width - p * m) / 2), _ = this._roundSize((w.height - p * m) / 2), y = P + this._roundSize(w.imageOptions.margin + (p * m - b) / 2), M = _ + this._roundSize(w.imageOptions.margin + (p * m - l) / 2), I = b - 2 * w.imageOptions.margin, q = l - 2 * w.imageOptions.margin, ce = this._window.document.createElementNS("http://www.w3.org/2000/svg", "image"); + ce.setAttribute("href", this._imageUri || ""), ce.setAttribute("x", String(y)), ce.setAttribute("y", String(M)), ce.setAttribute("width", `${I}px`), ce.setAttribute("height", `${q}px`), this._element.appendChild(ce); + } + _createColor({ options: b, color: l, additionalRotation: p, x: m, y: w, height: P, width: _, name: y }) { + const M = _ > P ? _ : P, I = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"); + if (I.setAttribute("x", String(m)), I.setAttribute("y", String(w)), I.setAttribute("height", String(P)), I.setAttribute("width", String(_)), I.setAttribute("clip-path", `url('#clip-path-${y}')`), b) { + let q; + if (b.type === "radial") q = this._window.document.createElementNS("http://www.w3.org/2000/svg", "radialGradient"), q.setAttribute("id", y), q.setAttribute("gradientUnits", "userSpaceOnUse"), q.setAttribute("fx", String(m + _ / 2)), q.setAttribute("fy", String(w + P / 2)), q.setAttribute("cx", String(m + _ / 2)), q.setAttribute("cy", String(w + P / 2)), q.setAttribute("r", String(M / 2)); + else { + const ce = ((b.rotation || 0) + p) % (2 * Math.PI), L = (ce + 2 * Math.PI) % (2 * Math.PI); + let oe = m + _ / 2, Q = w + P / 2, X = m + _ / 2, ee = w + P / 2; + L >= 0 && L <= 0.25 * Math.PI || L > 1.75 * Math.PI && L <= 2 * Math.PI ? (oe -= _ / 2, Q -= P / 2 * Math.tan(ce), X += _ / 2, ee += P / 2 * Math.tan(ce)) : L > 0.25 * Math.PI && L <= 0.75 * Math.PI ? (Q -= P / 2, oe -= _ / 2 / Math.tan(ce), ee += P / 2, X += _ / 2 / Math.tan(ce)) : L > 0.75 * Math.PI && L <= 1.25 * Math.PI ? (oe += _ / 2, Q += P / 2 * Math.tan(ce), X -= _ / 2, ee -= P / 2 * Math.tan(ce)) : L > 1.25 * Math.PI && L <= 1.75 * Math.PI && (Q += P / 2, oe += _ / 2 / Math.tan(ce), ee -= P / 2, X -= _ / 2 / Math.tan(ce)), q = this._window.document.createElementNS("http://www.w3.org/2000/svg", "linearGradient"), q.setAttribute("id", y), q.setAttribute("gradientUnits", "userSpaceOnUse"), q.setAttribute("x1", String(Math.round(oe))), q.setAttribute("y1", String(Math.round(Q))), q.setAttribute("x2", String(Math.round(X))), q.setAttribute("y2", String(Math.round(ee))); + } + b.colorStops.forEach((({ offset: ce, color: L }) => { + const oe = this._window.document.createElementNS("http://www.w3.org/2000/svg", "stop"); + oe.setAttribute("offset", 100 * ce + "%"), oe.setAttribute("stop-color", L), q.appendChild(oe); + })), I.setAttribute("fill", `url('#${y}')`), this._defs.appendChild(q); + } else l && I.setAttribute("fill", l); + this._element.appendChild(I); + } + } + D.instanceCount = 0; + const $ = D, N = "canvas", z = {}; + for (let E = 0; E <= 40; E++) z[E] = E; + const k = { type: N, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: z[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: !0, hideBackgroundDots: !0, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: !0 }, backgroundOptions: { round: 0, color: "#fff" } }; + function B(E) { + const b = Object.assign({}, E); + if (!b.colorStops || !b.colorStops.length) throw "Field 'colorStops' is required in gradient"; + return b.rotation ? b.rotation = Number(b.rotation) : b.rotation = 0, b.colorStops = b.colorStops.map(((l) => Object.assign(Object.assign({}, l), { offset: Number(l.offset) }))), b; + } + function U(E) { + const b = Object.assign({}, E); + return b.width = Number(b.width), b.height = Number(b.height), b.margin = Number(b.margin), b.imageOptions = Object.assign(Object.assign({}, b.imageOptions), { hideBackgroundDots: !!b.imageOptions.hideBackgroundDots, imageSize: Number(b.imageOptions.imageSize), margin: Number(b.imageOptions.margin) }), b.margin > Math.min(b.width, b.height) && (b.margin = Math.min(b.width, b.height)), b.dotsOptions = Object.assign({}, b.dotsOptions), b.dotsOptions.gradient && (b.dotsOptions.gradient = B(b.dotsOptions.gradient)), b.cornersSquareOptions && (b.cornersSquareOptions = Object.assign({}, b.cornersSquareOptions), b.cornersSquareOptions.gradient && (b.cornersSquareOptions.gradient = B(b.cornersSquareOptions.gradient))), b.cornersDotOptions && (b.cornersDotOptions = Object.assign({}, b.cornersDotOptions), b.cornersDotOptions.gradient && (b.cornersDotOptions.gradient = B(b.cornersDotOptions.gradient))), b.backgroundOptions && (b.backgroundOptions = Object.assign({}, b.backgroundOptions), b.backgroundOptions.gradient && (b.backgroundOptions.gradient = B(b.backgroundOptions.gradient))), b; + } + var R = i(873), W = i.n(R); + function J(E) { + if (!E) throw new Error("Extension must be defined"); + E[0] === "." && (E = E.substring(1)); + const b = { bmp: "image/bmp", gif: "image/gif", ico: "image/vnd.microsoft.icon", jpeg: "image/jpeg", jpg: "image/jpeg", png: "image/png", svg: "image/svg+xml", tif: "image/tiff", tiff: "image/tiff", webp: "image/webp", pdf: "application/pdf" }[E.toLowerCase()]; + if (!b) throw new Error(`Extension "${E}" is not supported`); + return b; + } + class ne { + constructor(b) { + b?.jsdom ? this._window = new b.jsdom("", { resources: "usable" }).window : this._window = window, this._options = b ? U(a(k, b)) : k, this.update(); + } + static _clearContainer(b) { + b && (b.innerHTML = ""); + } + _setupSvg() { + if (!this._qr) return; + const b = new $(this._options, this._window); + this._svg = b.getElement(), this._svgDrawingPromise = b.drawQR(this._qr).then((() => { + var l; + this._svg && ((l = this._extension) === null || l === void 0 || l.call(this, b.getElement(), this._options)); + })); + } + _setupCanvas() { + var b, l; + this._qr && (!((b = this._options.nodeCanvas) === null || b === void 0) && b.createCanvas ? (this._nodeCanvas = this._options.nodeCanvas.createCanvas(this._options.width, this._options.height), this._nodeCanvas.width = this._options.width, this._nodeCanvas.height = this._options.height) : (this._domCanvas = document.createElement("canvas"), this._domCanvas.width = this._options.width, this._domCanvas.height = this._options.height), this._setupSvg(), this._canvasDrawingPromise = (l = this._svgDrawingPromise) === null || l === void 0 ? void 0 : l.then((() => { + var p; + if (!this._svg) return; + const m = this._svg, w = new this._window.XMLSerializer().serializeToString(m), P = btoa(w), _ = `data:${J("svg")};base64,${P}`; + if (!((p = this._options.nodeCanvas) === null || p === void 0) && p.loadImage) return this._options.nodeCanvas.loadImage(_).then(((y) => { + var M, I; + y.width = this._options.width, y.height = this._options.height, (I = (M = this._nodeCanvas) === null || M === void 0 ? void 0 : M.getContext("2d")) === null || I === void 0 || I.drawImage(y, 0, 0); + })); + { + const y = new this._window.Image(); + return new Promise(((M) => { + y.onload = () => { + var I, q; + (q = (I = this._domCanvas) === null || I === void 0 ? void 0 : I.getContext("2d")) === null || q === void 0 || q.drawImage(y, 0, 0), M(); + }, y.src = _; + })); + } + }))); + } + async _getElement(b = "png") { + if (!this._qr) throw "QR code is empty"; + return b.toLowerCase() === "svg" ? (this._svg && this._svgDrawingPromise || this._setupSvg(), await this._svgDrawingPromise, this._svg) : ((this._domCanvas || this._nodeCanvas) && this._canvasDrawingPromise || this._setupCanvas(), await this._canvasDrawingPromise, this._domCanvas || this._nodeCanvas); + } + update(b) { + ne._clearContainer(this._container), this._options = b ? U(a(this._options, b)) : this._options, this._options.data && (this._qr = W()(this._options.qrOptions.typeNumber, this._options.qrOptions.errorCorrectionLevel), this._qr.addData(this._options.data, this._options.qrOptions.mode || (function(l) { + switch (!0) { + case /^[0-9]*$/.test(l): + return "Numeric"; + case /^[0-9A-Z $%*+\-./:]*$/.test(l): + return "Alphanumeric"; + default: + return "Byte"; + } + })(this._options.data)), this._qr.make(), this._options.type === N ? this._setupCanvas() : this._setupSvg(), this.append(this._container)); + } + append(b) { + if (b) { + if (typeof b.appendChild != "function") throw "Container should be a single DOM node"; + this._options.type === N ? this._domCanvas && b.appendChild(this._domCanvas) : this._svg && b.appendChild(this._svg), this._container = b; + } + } + applyExtension(b) { + if (!b) throw "Extension function should be defined."; + this._extension = b, this.update(); + } + deleteExtension() { + this._extension = void 0, this.update(); + } + async getRawData(b = "png") { + if (!this._qr) throw "QR code is empty"; + const l = await this._getElement(b), p = J(b); + if (!l) return null; + if (b.toLowerCase() === "svg") { + const m = `\r +${new this._window.XMLSerializer().serializeToString(l)}`; + return typeof Blob > "u" || this._options.jsdom ? Buffer.from(m) : new Blob([m], { type: p }); + } + return new Promise(((m) => { + const w = l; + if ("toBuffer" in w) if (p === "image/png") m(w.toBuffer(p)); + else if (p === "image/jpeg") m(w.toBuffer(p)); + else { + if (p !== "application/pdf") throw Error("Unsupported extension"); + m(w.toBuffer(p)); + } + else "toBlob" in w && w.toBlob(m, p, 1); + })); + } + async download(b) { + if (!this._qr) throw "QR code is empty"; + if (typeof Blob > "u") throw "Cannot download in Node.js, call getRawData instead."; + let l = "png", p = "qr"; + typeof b == "string" ? (l = b, console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")) : typeof b == "object" && b !== null && (b.name && (p = b.name), b.extension && (l = b.extension)); + const m = await this._getElement(l); + if (m) if (l.toLowerCase() === "svg") { + let w = new XMLSerializer().serializeToString(m); + w = `\r +` + w, f(`data:${J(l)};charset=utf-8,${encodeURIComponent(w)}`, `${p}.svg`); + } else f(m.toDataURL(J(l)), `${p}.${l}`); + } + } + const K = ne; + })(), s.default; + })())); + })(nd)), nd.exports; +} +var Lee = Nee(); +const b9 = /* @__PURE__ */ Hi(Lee); +class Ro extends pt { + constructor(e) { + const { docsPath: r, field: n, metaMessages: i } = e; + super(`Invalid Sign-In with Ethereum message field "${n}".`, { + docsPath: r, + metaMessages: i, + name: "SiweInvalidMessageFieldError" + }); + } +} +function N5(t) { + if (/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t) || /%[^0-9a-f]/i.test(t) || /%[0-9a-f](:?[^0-9a-f]|$)/i.test(t)) + return !1; + const e = kee(t), r = e[1], n = e[2], i = e[3], s = e[4], o = e[5]; + if (!(r?.length && i.length >= 0)) + return !1; + if (n?.length) { + if (!(i.length === 0 || /^\//.test(i))) + return !1; + } else if (/^\/\//.test(i)) + return !1; + if (!/^[a-z][a-z0-9\+\-\.]*$/.test(r.toLowerCase())) + return !1; + let a = ""; + return a += `${r}:`, n?.length && (a += `//${n}`), a += i, s?.length && (a += `?${s}`), o?.length && (a += `#${o}`), a; +} +function kee(t) { + return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/); +} +function y9(t) { + const { chainId: e, domain: r, expirationTime: n, issuedAt: i = /* @__PURE__ */ new Date(), nonce: s, notBefore: o, requestId: a, resources: f, scheme: u, uri: h, version: g } = t; + { + if (e !== Math.floor(e)) + throw new Ro({ + field: "chainId", + metaMessages: [ + "- Chain ID must be a EIP-155 chain ID.", + "- See https://eips.ethereum.org/EIPS/eip-155", + "", + `Provided value: ${e}` + ] + }); + if (!($ee.test(r) || Bee.test(r) || Fee.test(r))) + throw new Ro({ + field: "domain", + metaMessages: [ + "- Domain must be an RFC 3986 authority.", + "- See https://www.rfc-editor.org/rfc/rfc3986", + "", + `Provided value: ${r}` + ] + }); + if (!jee.test(s)) + throw new Ro({ + field: "nonce", + metaMessages: [ + "- Nonce must be at least 8 characters.", + "- Nonce must be alphanumeric.", + "", + `Provided value: ${s}` + ] + }); + if (!N5(h)) + throw new Ro({ + field: "uri", + metaMessages: [ + "- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.", + "- See https://www.rfc-editor.org/rfc/rfc3986", + "", + `Provided value: ${h}` + ] + }); + if (g !== "1") + throw new Ro({ + field: "version", + metaMessages: [ + "- Version must be '1'.", + "", + `Provided value: ${g}` + ] + }); + if (u && !Uee.test(u)) + throw new Ro({ + field: "scheme", + metaMessages: [ + "- Scheme must be an RFC 3986 URI scheme.", + "- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1", + "", + `Provided value: ${u}` + ] + }); + const $ = t.statement; + if ($?.includes(` +`)) + throw new Ro({ + field: "statement", + metaMessages: [ + "- Statement must not include '\\n'.", + "", + `Provided value: ${$}` + ] + }); + } + const v = e1(t.address), x = u ? `${u}://${r}` : r, S = t.statement ? `${t.statement} +` : "", C = `${x} wants you to sign in with your Ethereum account: +${v} + +${S}`; + let D = `URI: ${h} +Version: ${g} +Chain ID: ${e} +Nonce: ${s} +Issued At: ${i.toISOString()}`; + if (n && (D += ` +Expiration Time: ${n.toISOString()}`), o && (D += ` +Not Before: ${o.toISOString()}`), a && (D += ` +Request ID: ${a}`), f) { + let $ = ` +Resources:`; + for (const N of f) { + if (!N5(N)) + throw new Ro({ + field: "resources", + metaMessages: [ + "- Every resource must be a RFC 3986 URI.", + "- See https://www.rfc-editor.org/rfc/rfc3986", + "", + `Provided value: ${N}` + ] + }); + $ += ` +- ${N}`; + } + D += $; + } + return `${C} +${D}`; +} +const $ee = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/, Bee = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/, Fee = /^localhost(:[0-9]{1,5})?$/, jee = /^[a-zA-Z0-9]{8,}$/, Uee = /^([a-zA-Z][a-zA-Z0-9+-.]*)$/, w9 = "7a4434fefbcc9af474fb5c995e47d286", qee = { + projectId: w9, + metadata: { + name: "codatta", + description: "codatta", + url: "https://codatta.io/", + icons: ["https://avatars.githubusercontent.com/u/171659315"] + } +}, zee = { + namespaces: { + eip155: { + methods: [ + "eth_sendTransaction", + "eth_signTransaction", + "eth_sign", + "personal_sign", + "eth_signTypedData" + ], + chains: ["eip155:56"], + events: ["chainChanged", "accountsChanged", "disconnect"], + rpcMap: { + 1: `https://rpc.walletconnect.com?chainId=eip155:56&projectId=${w9}` + } + } + }, + skipPairing: !1 +}; +function Hee(t, e) { + const r = window.location.host, n = window.location.href; + return y9({ + address: t, + chainId: 1, + domain: r, + nonce: e, + uri: n, + version: "1" + }); +} +function x9(t) { + const e = Kn(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Xt(""), [a, f] = Xt(!1), [u, h] = Xt(""), [g, v] = Xt("scan"), x = Kn(), [S, C] = Xt(r.config?.image), [D, $] = Xt(!1), { saveLastUsedWallet: N } = g0(); + async function z(J) { + f(!0); + const ne = await NW.init(qee); + ne.session && await ne.disconnect(); + try { + if (v("scan"), ne.on("display_uri", (w) => { + o(w), f(!1), v("scan"); + }), ne.on("error", (w) => { + console.log(w); + }), ne.on("session_update", (w) => { + console.log("session_update", w); + }), !await ne.connect(zee)) throw new Error("Walletconnect init failed"); + const E = new Tc(ne); + C(E.config?.image || J.config?.image); + const b = await E.getAddress(), l = await Qo.getNonce({ account_type: "block_chain" }); + console.log("get nonce", l); + const p = Hee(b, l); + v("sign"); + const m = await E.signMessage(p, b); + v("waiting"), await i(E, { + message: p, + nonce: l, + signature: m, + address: b, + wallet_name: E.config?.name || J.config?.name || "" + }), console.log("save wallet connect wallet!"), N(E); + } catch (K) { + console.log("err", K), h(K.details || K.message); + } + } + function k() { + x.current = new b9({ + width: 264, + height: 264, + margin: 0, + type: "svg", + // image: wallet.config?.image, + qrOptions: { + errorCorrectionLevel: "M" + }, + dotsOptions: { + color: "black", + type: "rounded" + }, + backgroundOptions: { + color: "transparent" + } + }), x.current.append(e.current); + } + function B(J) { + console.log(x.current), x.current?.update({ + data: J + }); + } + Rn(() => { + s && B(s); + }, [s]), Rn(() => { + z(r); + }, [r]), Rn(() => { + k(); + }, []); + function U() { + h(""), B(""), z(r); + } + function R() { + $(!0), navigator.clipboard.writeText(s), setTimeout(() => { + $(!1); + }, 2500); + } + function W() { + const J = r.config?.desktop_link; + if (!J) return; + const ne = `${J}?uri=${encodeURIComponent(s)}`; + window.open(ne, "_blank"); + } + return /* @__PURE__ */ pe.jsxs("div", { children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-text-center", children: /* @__PURE__ */ pe.jsxs("div", { className: "xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1", children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center", ref: e }), + /* @__PURE__ */ pe.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: a ? /* @__PURE__ */ pe.jsx(ja, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ pe.jsx("img", { className: "xc-h-10 xc-w-10", src: S }) }) + ] }) }), + /* @__PURE__ */ pe.jsxs("div", { className: "xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3", children: [ + /* @__PURE__ */ pe.jsx( + "button", + { + disabled: !s, + onClick: R, + className: "xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent", + children: D ? /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ + " ", + /* @__PURE__ */ pe.jsx(eY, {}), + " Copied!" + ] }) : /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ + /* @__PURE__ */ pe.jsx(nY, {}), + "Copy QR URL" + ] }) + } + ), + r.config?.getWallet && /* @__PURE__ */ pe.jsxs( + "button", + { + className: "xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black", + onClick: n, + children: [ + /* @__PURE__ */ pe.jsx(tY, {}), + "Get Extension" + ] + } + ), + r.config?.desktop_link && /* @__PURE__ */ pe.jsxs( + "button", + { + disabled: !s, + className: "xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black", + onClick: W, + children: [ + /* @__PURE__ */ pe.jsx(AS, {}), + "Desktop" + ] + } + ) + ] }), + /* @__PURE__ */ pe.jsx("div", { className: "xc-text-center", children: u ? /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ + /* @__PURE__ */ pe.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: u }), + /* @__PURE__ */ pe.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: U, children: "Retry" }) + ] }) : /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ + g === "scan" && /* @__PURE__ */ pe.jsx("p", { children: "Scan this QR code from your mobile wallet or phone's camera to connect." }), + g === "connect" && /* @__PURE__ */ pe.jsx("p", { children: "Click connect in your wallet app" }), + g === "sign" && /* @__PURE__ */ pe.jsx("p", { children: "Click sign-in in your wallet to confirm you own this wallet." }), + g === "waiting" && /* @__PURE__ */ pe.jsx("div", { className: "xc-text-center", children: /* @__PURE__ */ pe.jsx(ja, { className: "xc-inline-block xc-animate-spin" }) }) + ] }) }) + ] }); +} +const Wee = /* @__PURE__ */ hN({ + id: 1, + name: "Ethereum", + nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }, + rpcUrls: { + default: { + http: ["https://eth.merkle.io"] + } + }, + blockExplorers: { + default: { + name: "Etherscan", + url: "https://etherscan.io", + apiUrl: "https://api.etherscan.io/api" + } + }, + contracts: { + ensRegistry: { + address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + }, + ensUniversalResolver: { + address: "0xce01f8eee7E479C928F8919abD53E553a36CeF67", + blockCreated: 19258213 + }, + multicall3: { + address: "0xca11bde05977b3631167028862be2a173976ca11", + blockCreated: 14353601 + } + } +}), Kee = "Accept connection request in the wallet", Vee = "Accept sign-in request in your wallet"; +function Gee(t, e, r) { + const n = window.location.host, i = window.location.href; + return y9({ + address: t, + chainId: r, + domain: n, + nonce: e, + uri: i, + version: "1" + }); +} +function _9(t) { + const [e, r] = Xt(), { wallet: n, onSignFinish: i } = t, s = Kn(), [o, a] = Xt("connect"), { saveLastUsedWallet: f, chains: u } = g0(); + async function h(v) { + try { + a("connect"); + const x = await n.connect(); + if (!x || x.length === 0) + throw new Error("Wallet connect error"); + const S = await n.getChain(), C = u.find((k) => k.id === S), D = C || u[0] || Wee; + !C && u.length > 0 && (a("switch-chain"), await n.switchChain(D)); + const $ = e1(x[0]), N = Gee($, v, D.id); + a("sign"); + const z = await n.signMessage(N, $); + if (!z || z.length === 0) + throw new Error("user sign error"); + a("waiting"), await i(n, { address: $, signature: z, message: N, nonce: v, wallet_name: n.config?.name || "" }), f(n); + } catch (x) { + console.log("walletSignin error", x.stack), console.log(x.details || x.message), r(x.details || x.message); + } + } + async function g() { + try { + r(""); + const v = await Qo.getNonce({ account_type: "block_chain" }); + s.current = v, h(s.current); + } catch (v) { + console.log(v.details), r(v.message); + } + } + return Rn(() => { + g(); + }, []), /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4", children: [ + /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-md xc-h-16 xc-w-16", src: n.config?.image, alt: "" }), + e && /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ + /* @__PURE__ */ pe.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: e }), + /* @__PURE__ */ pe.jsx("div", { className: "xc-flex xc-gap-2", children: /* @__PURE__ */ pe.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: g, children: "Retry" }) }) + ] }), + !e && /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ + o === "connect" && /* @__PURE__ */ pe.jsx("span", { className: "xc-text-center", children: Kee }), + o === "sign" && /* @__PURE__ */ pe.jsx("span", { className: "xc-text-center", children: Vee }), + o === "waiting" && /* @__PURE__ */ pe.jsx("span", { className: "xc-text-center", children: /* @__PURE__ */ pe.jsx(ja, { className: "xc-animate-spin" }) }), + o === "switch-chain" && /* @__PURE__ */ pe.jsxs("span", { className: "xc-text-center", children: [ + "Switch to ", + u[0].name + ] }) + ] }) + ] }); +} +const vc = "https://static.codatta.io/codatta-connect/wallet-icons.svg", Yee = "https://itunes.apple.com/app/", Jee = "https://play.google.com/store/apps/details?id=", Xee = "https://chromewebstore.google.com/detail/", Zee = "https://chromewebstore.google.com/detail/", Qee = "https://addons.mozilla.org/en-US/firefox/addon/", ete = "https://microsoftedge.microsoft.com/addons/detail/"; +function bc(t) { + const { icon: e, title: r, link: n } = t; + return /* @__PURE__ */ pe.jsxs( + "a", + { + href: n, + target: "_blank", + className: "xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5", + children: [ + /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-1 xc-h-6 xc-w-6", src: e, alt: "" }), + r, + /* @__PURE__ */ pe.jsx(SS, { className: "xc-ml-auto xc-text-gray-400" }) + ] + } + ); +} +function tte(t) { + const e = { + appStoreLink: "", + playStoreLink: "", + chromeStoreLink: "", + braveStoreLink: "", + firefoxStoreLink: "", + edgeStoreLink: "" + }; + return t?.app_store_id && (e.appStoreLink = `${Yee}${t.app_store_id}`), t?.play_store_id && (e.playStoreLink = `${Jee}${t.play_store_id}`), t?.chrome_store_id && (e.chromeStoreLink = `${Xee}${t.chrome_store_id}`), t?.brave_store_id && (e.braveStoreLink = `${Zee}${t.brave_store_id}`), t?.firefox_addon_id && (e.firefoxStoreLink = `${Qee}${t.firefox_addon_id}`), t?.edge_addon_id && (e.edgeStoreLink = `${ete}${t.edge_addon_id}`), e; +} +function E9(t) { + const { wallet: e } = t, r = e.config?.getWallet, n = tte(r); + return /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ + /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-md xc-mb-2 xc-h-12 xc-w-12", src: e.config?.image, alt: "" }), + /* @__PURE__ */ pe.jsxs("p", { className: "xc-text-lg xc-font-bold", children: [ + "Install ", + e.config?.name, + " to connect" + ] }), + /* @__PURE__ */ pe.jsx("p", { className: "xc-mb-6 xc-text-sm xc-text-gray-500", children: "Select from your preferred options below:" }), + /* @__PURE__ */ pe.jsxs("div", { className: "xc-grid xc-w-full xc-grid-cols-1 xc-gap-3", children: [ + r?.chrome_store_id && /* @__PURE__ */ pe.jsx( + bc, + { + link: n.chromeStoreLink, + icon: `${vc}#chrome`, + title: "Chrome Web Store" + } + ), + r?.app_store_id && /* @__PURE__ */ pe.jsx( + bc, + { + link: n.appStoreLink, + icon: `${vc}#apple-dark`, + title: "Apple App Store" + } + ), + r?.play_store_id && /* @__PURE__ */ pe.jsx( + bc, + { + link: n.playStoreLink, + icon: `${vc}#android`, + title: "Google Play Store" + } + ), + r?.edge_addon_id && /* @__PURE__ */ pe.jsx( + bc, + { + link: n.edgeStoreLink, + icon: `${vc}#edge`, + title: "Microsoft Edge" + } + ), + r?.brave_store_id && /* @__PURE__ */ pe.jsx( + bc, + { + link: n.braveStoreLink, + icon: `${vc}#brave`, + title: "Brave extension" + } + ), + r?.firefox_addon_id && /* @__PURE__ */ pe.jsx( + bc, + { + link: n.firefoxStoreLink, + icon: `${vc}#firefox`, + title: "Mozilla Firefox" + } + ) + ] }) + ] }); +} +function rte(t) { + const { wallet: e } = t, [r, n] = Xt(e.installed ? "connect" : "qr"), i = Pb(); + async function s(o, a) { + const f = await Qo.walletLogin({ + account_type: "block_chain", + account_enum: i.role, + connector: "codatta_wallet", + inviter_code: i.inviterCode, + wallet_name: o.config?.name || o.key, + address: await o.getAddress(), + chain: (await o.getChain()).toString(), + nonce: a.nonce, + signature: a.signature, + message: a.message, + source: { + device: i.device, + channel: i.channel, + app: i.app + } + }); + await t.onLogin(f.data); + } + return /* @__PURE__ */ pe.jsxs(ps, { children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ pe.jsx(Ja, { title: "Connect wallet", onBack: t.onBack }) }), + r === "qr" && /* @__PURE__ */ pe.jsx( + x9, + { + wallet: e, + onGetExtension: () => n("get-extension"), + onSignFinish: s + } + ), + r === "connect" && /* @__PURE__ */ pe.jsx( + _9, + { + onShowQrCode: () => n("qr"), + wallet: e, + onSignFinish: s + } + ), + r === "get-extension" && /* @__PURE__ */ pe.jsx(E9, { wallet: e }) + ] }); +} +function nte(t) { + const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ pe.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: e.imageUrl }), i = e.name || ""; + return /* @__PURE__ */ pe.jsx(Sb, { icon: n, title: i, onClick: () => r(e) }); +} +function S9(t) { + const { connector: e } = t, [r, n] = Xt(), [i, s] = Xt([]), o = hi(() => r ? i.filter((h) => h.name.toLowerCase().includes(r.toLowerCase())) : i, [r, i]); + function a(h) { + n(h.target.value); + } + async function f() { + const h = await e.getWallets(); + s(h); + } + Rn(() => { + f(); + }, []); + function u(h) { + t.onSelect(h); + } + return /* @__PURE__ */ pe.jsxs(ps, { children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ pe.jsx(Ja, { title: "Select wallet", onBack: t.onBack }) }), + /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ + /* @__PURE__ */ pe.jsx(PS, { className: "xc-shrink-0 xc-opacity-50" }), + /* @__PURE__ */ pe.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: a }) + ] }), + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: o?.map((h) => /* @__PURE__ */ pe.jsx(nte, { wallet: h, onClick: u }, h.name)) }) + ] }); +} +var id = { exports: {} }, ite = id.exports, L5; +function ste() { + return L5 || (L5 = 1, (function(t) { + (function(e, r) { + t.exports ? t.exports = r() : (e.nacl || (e.nacl = {}), e.nacl.util = r()); + })(ite, function() { + var e = {}; + function r(n) { + if (!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n)) + throw new TypeError("invalid encoding"); + } + return e.decodeUTF8 = function(n) { + if (typeof n != "string") throw new TypeError("expected string"); + var i, s = unescape(encodeURIComponent(n)), o = new Uint8Array(s.length); + for (i = 0; i < s.length; i++) o[i] = s.charCodeAt(i); + return o; + }, e.encodeUTF8 = function(n) { + var i, s = []; + for (i = 0; i < n.length; i++) s.push(String.fromCharCode(n[i])); + return decodeURIComponent(escape(s.join(""))); + }, typeof atob > "u" ? typeof Buffer.from < "u" ? (e.encodeBase64 = function(n) { + return Buffer.from(n).toString("base64"); + }, e.decodeBase64 = function(n) { + return r(n), new Uint8Array(Array.prototype.slice.call(Buffer.from(n, "base64"), 0)); + }) : (e.encodeBase64 = function(n) { + return new Buffer(n).toString("base64"); + }, e.decodeBase64 = function(n) { + return r(n), new Uint8Array(Array.prototype.slice.call(new Buffer(n, "base64"), 0)); + }) : (e.encodeBase64 = function(n) { + var i, s = [], o = n.length; + for (i = 0; i < o; i++) s.push(String.fromCharCode(n[i])); + return btoa(s.join("")); + }, e.decodeBase64 = function(n) { + r(n); + var i, s = atob(n), o = new Uint8Array(s.length); + for (i = 0; i < s.length; i++) o[i] = s.charCodeAt(i); + return o; + }), e; + }); + })(id)), id.exports; +} +var ote = ste(); +const Hf = /* @__PURE__ */ Hi(ote); +var Dm = { exports: {} }, k5; +function ate() { + return k5 || (k5 = 1, (function(t) { + (function(e) { + var r = function(H) { + var V, Y = new Float64Array(16); + if (H) for (V = 0; V < H.length; V++) Y[V] = H[V]; + return Y; + }, n = function() { + throw new Error("no PRNG"); + }, i = new Uint8Array(16), s = new Uint8Array(32); + s[0] = 9; + var o = r(), a = r([1]), f = r([56129, 1]), u = r([30883, 4953, 19914, 30187, 55467, 16705, 2637, 112, 59544, 30585, 16505, 36039, 65139, 11119, 27886, 20995]), h = r([61785, 9906, 39828, 60374, 45398, 33411, 5274, 224, 53552, 61171, 33010, 6542, 64743, 22239, 55772, 9222]), g = r([54554, 36645, 11616, 51542, 42930, 38181, 51040, 26924, 56412, 64982, 57905, 49316, 21502, 52590, 14035, 8553]), v = r([26200, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214]), x = r([41136, 18958, 6951, 50414, 58488, 44335, 6150, 12099, 55207, 15867, 153, 11085, 57099, 20417, 9344, 11139]); + function S(H, V, Y, T) { + H[V] = Y >> 24 & 255, H[V + 1] = Y >> 16 & 255, H[V + 2] = Y >> 8 & 255, H[V + 3] = Y & 255, H[V + 4] = T >> 24 & 255, H[V + 5] = T >> 16 & 255, H[V + 6] = T >> 8 & 255, H[V + 7] = T & 255; + } + function C(H, V, Y, T, F) { + var ie, le = 0; + for (ie = 0; ie < F; ie++) le |= H[V + ie] ^ Y[T + ie]; + return (1 & le - 1 >>> 8) - 1; + } + function D(H, V, Y, T) { + return C(H, V, Y, T, 16); + } + function $(H, V, Y, T) { + return C(H, V, Y, T, 32); + } + function N(H, V, Y, T) { + for (var F = T[0] & 255 | (T[1] & 255) << 8 | (T[2] & 255) << 16 | (T[3] & 255) << 24, ie = Y[0] & 255 | (Y[1] & 255) << 8 | (Y[2] & 255) << 16 | (Y[3] & 255) << 24, le = Y[4] & 255 | (Y[5] & 255) << 8 | (Y[6] & 255) << 16 | (Y[7] & 255) << 24, me = Y[8] & 255 | (Y[9] & 255) << 8 | (Y[10] & 255) << 16 | (Y[11] & 255) << 24, Ee = Y[12] & 255 | (Y[13] & 255) << 8 | (Y[14] & 255) << 16 | (Y[15] & 255) << 24, Le = T[4] & 255 | (T[5] & 255) << 8 | (T[6] & 255) << 16 | (T[7] & 255) << 24, Ie = V[0] & 255 | (V[1] & 255) << 8 | (V[2] & 255) << 16 | (V[3] & 255) << 24, Qe = V[4] & 255 | (V[5] & 255) << 8 | (V[6] & 255) << 16 | (V[7] & 255) << 24, Xe = V[8] & 255 | (V[9] & 255) << 8 | (V[10] & 255) << 16 | (V[11] & 255) << 24, tt = V[12] & 255 | (V[13] & 255) << 8 | (V[14] & 255) << 16 | (V[15] & 255) << 24, st = T[8] & 255 | (T[9] & 255) << 8 | (T[10] & 255) << 16 | (T[11] & 255) << 24, vt = Y[16] & 255 | (Y[17] & 255) << 8 | (Y[18] & 255) << 16 | (Y[19] & 255) << 24, Ct = Y[20] & 255 | (Y[21] & 255) << 8 | (Y[22] & 255) << 16 | (Y[23] & 255) << 24, Mt = Y[24] & 255 | (Y[25] & 255) << 8 | (Y[26] & 255) << 16 | (Y[27] & 255) << 24, wt = Y[28] & 255 | (Y[29] & 255) << 8 | (Y[30] & 255) << 16 | (Y[31] & 255) << 24, Rt = T[12] & 255 | (T[13] & 255) << 8 | (T[14] & 255) << 16 | (T[15] & 255) << 24, gt = F, _t = ie, at = le, yt = me, ut = Ee, it = Le, Se = Ie, Pe = Qe, Ke = Xe, Fe = tt, qe = st, Ye = vt, Lt = Ct, zt = Mt, Zt = wt, Ht = Rt, ge, nr = 0; nr < 20; nr += 2) + ge = gt + Lt | 0, ut ^= ge << 7 | ge >>> 25, ge = ut + gt | 0, Ke ^= ge << 9 | ge >>> 23, ge = Ke + ut | 0, Lt ^= ge << 13 | ge >>> 19, ge = Lt + Ke | 0, gt ^= ge << 18 | ge >>> 14, ge = it + _t | 0, Fe ^= ge << 7 | ge >>> 25, ge = Fe + it | 0, zt ^= ge << 9 | ge >>> 23, ge = zt + Fe | 0, _t ^= ge << 13 | ge >>> 19, ge = _t + zt | 0, it ^= ge << 18 | ge >>> 14, ge = qe + Se | 0, Zt ^= ge << 7 | ge >>> 25, ge = Zt + qe | 0, at ^= ge << 9 | ge >>> 23, ge = at + Zt | 0, Se ^= ge << 13 | ge >>> 19, ge = Se + at | 0, qe ^= ge << 18 | ge >>> 14, ge = Ht + Ye | 0, yt ^= ge << 7 | ge >>> 25, ge = yt + Ht | 0, Pe ^= ge << 9 | ge >>> 23, ge = Pe + yt | 0, Ye ^= ge << 13 | ge >>> 19, ge = Ye + Pe | 0, Ht ^= ge << 18 | ge >>> 14, ge = gt + yt | 0, _t ^= ge << 7 | ge >>> 25, ge = _t + gt | 0, at ^= ge << 9 | ge >>> 23, ge = at + _t | 0, yt ^= ge << 13 | ge >>> 19, ge = yt + at | 0, gt ^= ge << 18 | ge >>> 14, ge = it + ut | 0, Se ^= ge << 7 | ge >>> 25, ge = Se + it | 0, Pe ^= ge << 9 | ge >>> 23, ge = Pe + Se | 0, ut ^= ge << 13 | ge >>> 19, ge = ut + Pe | 0, it ^= ge << 18 | ge >>> 14, ge = qe + Fe | 0, Ye ^= ge << 7 | ge >>> 25, ge = Ye + qe | 0, Ke ^= ge << 9 | ge >>> 23, ge = Ke + Ye | 0, Fe ^= ge << 13 | ge >>> 19, ge = Fe + Ke | 0, qe ^= ge << 18 | ge >>> 14, ge = Ht + Zt | 0, Lt ^= ge << 7 | ge >>> 25, ge = Lt + Ht | 0, zt ^= ge << 9 | ge >>> 23, ge = zt + Lt | 0, Zt ^= ge << 13 | ge >>> 19, ge = Zt + zt | 0, Ht ^= ge << 18 | ge >>> 14; + gt = gt + F | 0, _t = _t + ie | 0, at = at + le | 0, yt = yt + me | 0, ut = ut + Ee | 0, it = it + Le | 0, Se = Se + Ie | 0, Pe = Pe + Qe | 0, Ke = Ke + Xe | 0, Fe = Fe + tt | 0, qe = qe + st | 0, Ye = Ye + vt | 0, Lt = Lt + Ct | 0, zt = zt + Mt | 0, Zt = Zt + wt | 0, Ht = Ht + Rt | 0, H[0] = gt >>> 0 & 255, H[1] = gt >>> 8 & 255, H[2] = gt >>> 16 & 255, H[3] = gt >>> 24 & 255, H[4] = _t >>> 0 & 255, H[5] = _t >>> 8 & 255, H[6] = _t >>> 16 & 255, H[7] = _t >>> 24 & 255, H[8] = at >>> 0 & 255, H[9] = at >>> 8 & 255, H[10] = at >>> 16 & 255, H[11] = at >>> 24 & 255, H[12] = yt >>> 0 & 255, H[13] = yt >>> 8 & 255, H[14] = yt >>> 16 & 255, H[15] = yt >>> 24 & 255, H[16] = ut >>> 0 & 255, H[17] = ut >>> 8 & 255, H[18] = ut >>> 16 & 255, H[19] = ut >>> 24 & 255, H[20] = it >>> 0 & 255, H[21] = it >>> 8 & 255, H[22] = it >>> 16 & 255, H[23] = it >>> 24 & 255, H[24] = Se >>> 0 & 255, H[25] = Se >>> 8 & 255, H[26] = Se >>> 16 & 255, H[27] = Se >>> 24 & 255, H[28] = Pe >>> 0 & 255, H[29] = Pe >>> 8 & 255, H[30] = Pe >>> 16 & 255, H[31] = Pe >>> 24 & 255, H[32] = Ke >>> 0 & 255, H[33] = Ke >>> 8 & 255, H[34] = Ke >>> 16 & 255, H[35] = Ke >>> 24 & 255, H[36] = Fe >>> 0 & 255, H[37] = Fe >>> 8 & 255, H[38] = Fe >>> 16 & 255, H[39] = Fe >>> 24 & 255, H[40] = qe >>> 0 & 255, H[41] = qe >>> 8 & 255, H[42] = qe >>> 16 & 255, H[43] = qe >>> 24 & 255, H[44] = Ye >>> 0 & 255, H[45] = Ye >>> 8 & 255, H[46] = Ye >>> 16 & 255, H[47] = Ye >>> 24 & 255, H[48] = Lt >>> 0 & 255, H[49] = Lt >>> 8 & 255, H[50] = Lt >>> 16 & 255, H[51] = Lt >>> 24 & 255, H[52] = zt >>> 0 & 255, H[53] = zt >>> 8 & 255, H[54] = zt >>> 16 & 255, H[55] = zt >>> 24 & 255, H[56] = Zt >>> 0 & 255, H[57] = Zt >>> 8 & 255, H[58] = Zt >>> 16 & 255, H[59] = Zt >>> 24 & 255, H[60] = Ht >>> 0 & 255, H[61] = Ht >>> 8 & 255, H[62] = Ht >>> 16 & 255, H[63] = Ht >>> 24 & 255; + } + function z(H, V, Y, T) { + for (var F = T[0] & 255 | (T[1] & 255) << 8 | (T[2] & 255) << 16 | (T[3] & 255) << 24, ie = Y[0] & 255 | (Y[1] & 255) << 8 | (Y[2] & 255) << 16 | (Y[3] & 255) << 24, le = Y[4] & 255 | (Y[5] & 255) << 8 | (Y[6] & 255) << 16 | (Y[7] & 255) << 24, me = Y[8] & 255 | (Y[9] & 255) << 8 | (Y[10] & 255) << 16 | (Y[11] & 255) << 24, Ee = Y[12] & 255 | (Y[13] & 255) << 8 | (Y[14] & 255) << 16 | (Y[15] & 255) << 24, Le = T[4] & 255 | (T[5] & 255) << 8 | (T[6] & 255) << 16 | (T[7] & 255) << 24, Ie = V[0] & 255 | (V[1] & 255) << 8 | (V[2] & 255) << 16 | (V[3] & 255) << 24, Qe = V[4] & 255 | (V[5] & 255) << 8 | (V[6] & 255) << 16 | (V[7] & 255) << 24, Xe = V[8] & 255 | (V[9] & 255) << 8 | (V[10] & 255) << 16 | (V[11] & 255) << 24, tt = V[12] & 255 | (V[13] & 255) << 8 | (V[14] & 255) << 16 | (V[15] & 255) << 24, st = T[8] & 255 | (T[9] & 255) << 8 | (T[10] & 255) << 16 | (T[11] & 255) << 24, vt = Y[16] & 255 | (Y[17] & 255) << 8 | (Y[18] & 255) << 16 | (Y[19] & 255) << 24, Ct = Y[20] & 255 | (Y[21] & 255) << 8 | (Y[22] & 255) << 16 | (Y[23] & 255) << 24, Mt = Y[24] & 255 | (Y[25] & 255) << 8 | (Y[26] & 255) << 16 | (Y[27] & 255) << 24, wt = Y[28] & 255 | (Y[29] & 255) << 8 | (Y[30] & 255) << 16 | (Y[31] & 255) << 24, Rt = T[12] & 255 | (T[13] & 255) << 8 | (T[14] & 255) << 16 | (T[15] & 255) << 24, gt = F, _t = ie, at = le, yt = me, ut = Ee, it = Le, Se = Ie, Pe = Qe, Ke = Xe, Fe = tt, qe = st, Ye = vt, Lt = Ct, zt = Mt, Zt = wt, Ht = Rt, ge, nr = 0; nr < 20; nr += 2) + ge = gt + Lt | 0, ut ^= ge << 7 | ge >>> 25, ge = ut + gt | 0, Ke ^= ge << 9 | ge >>> 23, ge = Ke + ut | 0, Lt ^= ge << 13 | ge >>> 19, ge = Lt + Ke | 0, gt ^= ge << 18 | ge >>> 14, ge = it + _t | 0, Fe ^= ge << 7 | ge >>> 25, ge = Fe + it | 0, zt ^= ge << 9 | ge >>> 23, ge = zt + Fe | 0, _t ^= ge << 13 | ge >>> 19, ge = _t + zt | 0, it ^= ge << 18 | ge >>> 14, ge = qe + Se | 0, Zt ^= ge << 7 | ge >>> 25, ge = Zt + qe | 0, at ^= ge << 9 | ge >>> 23, ge = at + Zt | 0, Se ^= ge << 13 | ge >>> 19, ge = Se + at | 0, qe ^= ge << 18 | ge >>> 14, ge = Ht + Ye | 0, yt ^= ge << 7 | ge >>> 25, ge = yt + Ht | 0, Pe ^= ge << 9 | ge >>> 23, ge = Pe + yt | 0, Ye ^= ge << 13 | ge >>> 19, ge = Ye + Pe | 0, Ht ^= ge << 18 | ge >>> 14, ge = gt + yt | 0, _t ^= ge << 7 | ge >>> 25, ge = _t + gt | 0, at ^= ge << 9 | ge >>> 23, ge = at + _t | 0, yt ^= ge << 13 | ge >>> 19, ge = yt + at | 0, gt ^= ge << 18 | ge >>> 14, ge = it + ut | 0, Se ^= ge << 7 | ge >>> 25, ge = Se + it | 0, Pe ^= ge << 9 | ge >>> 23, ge = Pe + Se | 0, ut ^= ge << 13 | ge >>> 19, ge = ut + Pe | 0, it ^= ge << 18 | ge >>> 14, ge = qe + Fe | 0, Ye ^= ge << 7 | ge >>> 25, ge = Ye + qe | 0, Ke ^= ge << 9 | ge >>> 23, ge = Ke + Ye | 0, Fe ^= ge << 13 | ge >>> 19, ge = Fe + Ke | 0, qe ^= ge << 18 | ge >>> 14, ge = Ht + Zt | 0, Lt ^= ge << 7 | ge >>> 25, ge = Lt + Ht | 0, zt ^= ge << 9 | ge >>> 23, ge = zt + Lt | 0, Zt ^= ge << 13 | ge >>> 19, ge = Zt + zt | 0, Ht ^= ge << 18 | ge >>> 14; + H[0] = gt >>> 0 & 255, H[1] = gt >>> 8 & 255, H[2] = gt >>> 16 & 255, H[3] = gt >>> 24 & 255, H[4] = it >>> 0 & 255, H[5] = it >>> 8 & 255, H[6] = it >>> 16 & 255, H[7] = it >>> 24 & 255, H[8] = qe >>> 0 & 255, H[9] = qe >>> 8 & 255, H[10] = qe >>> 16 & 255, H[11] = qe >>> 24 & 255, H[12] = Ht >>> 0 & 255, H[13] = Ht >>> 8 & 255, H[14] = Ht >>> 16 & 255, H[15] = Ht >>> 24 & 255, H[16] = Se >>> 0 & 255, H[17] = Se >>> 8 & 255, H[18] = Se >>> 16 & 255, H[19] = Se >>> 24 & 255, H[20] = Pe >>> 0 & 255, H[21] = Pe >>> 8 & 255, H[22] = Pe >>> 16 & 255, H[23] = Pe >>> 24 & 255, H[24] = Ke >>> 0 & 255, H[25] = Ke >>> 8 & 255, H[26] = Ke >>> 16 & 255, H[27] = Ke >>> 24 & 255, H[28] = Fe >>> 0 & 255, H[29] = Fe >>> 8 & 255, H[30] = Fe >>> 16 & 255, H[31] = Fe >>> 24 & 255; + } + function k(H, V, Y, T) { + N(H, V, Y, T); + } + function B(H, V, Y, T) { + z(H, V, Y, T); + } + var U = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); + function R(H, V, Y, T, F, ie, le) { + var me = new Uint8Array(16), Ee = new Uint8Array(64), Le, Ie; + for (Ie = 0; Ie < 16; Ie++) me[Ie] = 0; + for (Ie = 0; Ie < 8; Ie++) me[Ie] = ie[Ie]; + for (; F >= 64; ) { + for (k(Ee, me, le, U), Ie = 0; Ie < 64; Ie++) H[V + Ie] = Y[T + Ie] ^ Ee[Ie]; + for (Le = 1, Ie = 8; Ie < 16; Ie++) + Le = Le + (me[Ie] & 255) | 0, me[Ie] = Le & 255, Le >>>= 8; + F -= 64, V += 64, T += 64; + } + if (F > 0) + for (k(Ee, me, le, U), Ie = 0; Ie < F; Ie++) H[V + Ie] = Y[T + Ie] ^ Ee[Ie]; + return 0; + } + function W(H, V, Y, T, F) { + var ie = new Uint8Array(16), le = new Uint8Array(64), me, Ee; + for (Ee = 0; Ee < 16; Ee++) ie[Ee] = 0; + for (Ee = 0; Ee < 8; Ee++) ie[Ee] = T[Ee]; + for (; Y >= 64; ) { + for (k(le, ie, F, U), Ee = 0; Ee < 64; Ee++) H[V + Ee] = le[Ee]; + for (me = 1, Ee = 8; Ee < 16; Ee++) + me = me + (ie[Ee] & 255) | 0, ie[Ee] = me & 255, me >>>= 8; + Y -= 64, V += 64; + } + if (Y > 0) + for (k(le, ie, F, U), Ee = 0; Ee < Y; Ee++) H[V + Ee] = le[Ee]; + return 0; + } + function J(H, V, Y, T, F) { + var ie = new Uint8Array(32); + B(ie, T, F, U); + for (var le = new Uint8Array(8), me = 0; me < 8; me++) le[me] = T[me + 16]; + return W(H, V, Y, le, ie); + } + function ne(H, V, Y, T, F, ie, le) { + var me = new Uint8Array(32); + B(me, ie, le, U); + for (var Ee = new Uint8Array(8), Le = 0; Le < 8; Le++) Ee[Le] = ie[Le + 16]; + return R(H, V, Y, T, F, Ee, me); + } + var K = function(H) { + this.buffer = new Uint8Array(16), this.r = new Uint16Array(10), this.h = new Uint16Array(10), this.pad = new Uint16Array(8), this.leftover = 0, this.fin = 0; + var V, Y, T, F, ie, le, me, Ee; + V = H[0] & 255 | (H[1] & 255) << 8, this.r[0] = V & 8191, Y = H[2] & 255 | (H[3] & 255) << 8, this.r[1] = (V >>> 13 | Y << 3) & 8191, T = H[4] & 255 | (H[5] & 255) << 8, this.r[2] = (Y >>> 10 | T << 6) & 7939, F = H[6] & 255 | (H[7] & 255) << 8, this.r[3] = (T >>> 7 | F << 9) & 8191, ie = H[8] & 255 | (H[9] & 255) << 8, this.r[4] = (F >>> 4 | ie << 12) & 255, this.r[5] = ie >>> 1 & 8190, le = H[10] & 255 | (H[11] & 255) << 8, this.r[6] = (ie >>> 14 | le << 2) & 8191, me = H[12] & 255 | (H[13] & 255) << 8, this.r[7] = (le >>> 11 | me << 5) & 8065, Ee = H[14] & 255 | (H[15] & 255) << 8, this.r[8] = (me >>> 8 | Ee << 8) & 8191, this.r[9] = Ee >>> 5 & 127, this.pad[0] = H[16] & 255 | (H[17] & 255) << 8, this.pad[1] = H[18] & 255 | (H[19] & 255) << 8, this.pad[2] = H[20] & 255 | (H[21] & 255) << 8, this.pad[3] = H[22] & 255 | (H[23] & 255) << 8, this.pad[4] = H[24] & 255 | (H[25] & 255) << 8, this.pad[5] = H[26] & 255 | (H[27] & 255) << 8, this.pad[6] = H[28] & 255 | (H[29] & 255) << 8, this.pad[7] = H[30] & 255 | (H[31] & 255) << 8; + }; + K.prototype.blocks = function(H, V, Y) { + for (var T = this.fin ? 0 : 2048, F, ie, le, me, Ee, Le, Ie, Qe, Xe, tt, st, vt, Ct, Mt, wt, Rt, gt, _t, at, yt = this.h[0], ut = this.h[1], it = this.h[2], Se = this.h[3], Pe = this.h[4], Ke = this.h[5], Fe = this.h[6], qe = this.h[7], Ye = this.h[8], Lt = this.h[9], zt = this.r[0], Zt = this.r[1], Ht = this.r[2], ge = this.r[3], nr = this.r[4], pr = this.r[5], gr = this.r[6], Qt = this.r[7], mr = this.r[8], lr = this.r[9]; Y >= 16; ) + F = H[V + 0] & 255 | (H[V + 1] & 255) << 8, yt += F & 8191, ie = H[V + 2] & 255 | (H[V + 3] & 255) << 8, ut += (F >>> 13 | ie << 3) & 8191, le = H[V + 4] & 255 | (H[V + 5] & 255) << 8, it += (ie >>> 10 | le << 6) & 8191, me = H[V + 6] & 255 | (H[V + 7] & 255) << 8, Se += (le >>> 7 | me << 9) & 8191, Ee = H[V + 8] & 255 | (H[V + 9] & 255) << 8, Pe += (me >>> 4 | Ee << 12) & 8191, Ke += Ee >>> 1 & 8191, Le = H[V + 10] & 255 | (H[V + 11] & 255) << 8, Fe += (Ee >>> 14 | Le << 2) & 8191, Ie = H[V + 12] & 255 | (H[V + 13] & 255) << 8, qe += (Le >>> 11 | Ie << 5) & 8191, Qe = H[V + 14] & 255 | (H[V + 15] & 255) << 8, Ye += (Ie >>> 8 | Qe << 8) & 8191, Lt += Qe >>> 5 | T, Xe = 0, tt = Xe, tt += yt * zt, tt += ut * (5 * lr), tt += it * (5 * mr), tt += Se * (5 * Qt), tt += Pe * (5 * gr), Xe = tt >>> 13, tt &= 8191, tt += Ke * (5 * pr), tt += Fe * (5 * nr), tt += qe * (5 * ge), tt += Ye * (5 * Ht), tt += Lt * (5 * Zt), Xe += tt >>> 13, tt &= 8191, st = Xe, st += yt * Zt, st += ut * zt, st += it * (5 * lr), st += Se * (5 * mr), st += Pe * (5 * Qt), Xe = st >>> 13, st &= 8191, st += Ke * (5 * gr), st += Fe * (5 * pr), st += qe * (5 * nr), st += Ye * (5 * ge), st += Lt * (5 * Ht), Xe += st >>> 13, st &= 8191, vt = Xe, vt += yt * Ht, vt += ut * Zt, vt += it * zt, vt += Se * (5 * lr), vt += Pe * (5 * mr), Xe = vt >>> 13, vt &= 8191, vt += Ke * (5 * Qt), vt += Fe * (5 * gr), vt += qe * (5 * pr), vt += Ye * (5 * nr), vt += Lt * (5 * ge), Xe += vt >>> 13, vt &= 8191, Ct = Xe, Ct += yt * ge, Ct += ut * Ht, Ct += it * Zt, Ct += Se * zt, Ct += Pe * (5 * lr), Xe = Ct >>> 13, Ct &= 8191, Ct += Ke * (5 * mr), Ct += Fe * (5 * Qt), Ct += qe * (5 * gr), Ct += Ye * (5 * pr), Ct += Lt * (5 * nr), Xe += Ct >>> 13, Ct &= 8191, Mt = Xe, Mt += yt * nr, Mt += ut * ge, Mt += it * Ht, Mt += Se * Zt, Mt += Pe * zt, Xe = Mt >>> 13, Mt &= 8191, Mt += Ke * (5 * lr), Mt += Fe * (5 * mr), Mt += qe * (5 * Qt), Mt += Ye * (5 * gr), Mt += Lt * (5 * pr), Xe += Mt >>> 13, Mt &= 8191, wt = Xe, wt += yt * pr, wt += ut * nr, wt += it * ge, wt += Se * Ht, wt += Pe * Zt, Xe = wt >>> 13, wt &= 8191, wt += Ke * zt, wt += Fe * (5 * lr), wt += qe * (5 * mr), wt += Ye * (5 * Qt), wt += Lt * (5 * gr), Xe += wt >>> 13, wt &= 8191, Rt = Xe, Rt += yt * gr, Rt += ut * pr, Rt += it * nr, Rt += Se * ge, Rt += Pe * Ht, Xe = Rt >>> 13, Rt &= 8191, Rt += Ke * Zt, Rt += Fe * zt, Rt += qe * (5 * lr), Rt += Ye * (5 * mr), Rt += Lt * (5 * Qt), Xe += Rt >>> 13, Rt &= 8191, gt = Xe, gt += yt * Qt, gt += ut * gr, gt += it * pr, gt += Se * nr, gt += Pe * ge, Xe = gt >>> 13, gt &= 8191, gt += Ke * Ht, gt += Fe * Zt, gt += qe * zt, gt += Ye * (5 * lr), gt += Lt * (5 * mr), Xe += gt >>> 13, gt &= 8191, _t = Xe, _t += yt * mr, _t += ut * Qt, _t += it * gr, _t += Se * pr, _t += Pe * nr, Xe = _t >>> 13, _t &= 8191, _t += Ke * ge, _t += Fe * Ht, _t += qe * Zt, _t += Ye * zt, _t += Lt * (5 * lr), Xe += _t >>> 13, _t &= 8191, at = Xe, at += yt * lr, at += ut * mr, at += it * Qt, at += Se * gr, at += Pe * pr, Xe = at >>> 13, at &= 8191, at += Ke * nr, at += Fe * ge, at += qe * Ht, at += Ye * Zt, at += Lt * zt, Xe += at >>> 13, at &= 8191, Xe = (Xe << 2) + Xe | 0, Xe = Xe + tt | 0, tt = Xe & 8191, Xe = Xe >>> 13, st += Xe, yt = tt, ut = st, it = vt, Se = Ct, Pe = Mt, Ke = wt, Fe = Rt, qe = gt, Ye = _t, Lt = at, V += 16, Y -= 16; + this.h[0] = yt, this.h[1] = ut, this.h[2] = it, this.h[3] = Se, this.h[4] = Pe, this.h[5] = Ke, this.h[6] = Fe, this.h[7] = qe, this.h[8] = Ye, this.h[9] = Lt; + }, K.prototype.finish = function(H, V) { + var Y = new Uint16Array(10), T, F, ie, le; + if (this.leftover) { + for (le = this.leftover, this.buffer[le++] = 1; le < 16; le++) this.buffer[le] = 0; + this.fin = 1, this.blocks(this.buffer, 0, 16); + } + for (T = this.h[1] >>> 13, this.h[1] &= 8191, le = 2; le < 10; le++) + this.h[le] += T, T = this.h[le] >>> 13, this.h[le] &= 8191; + for (this.h[0] += T * 5, T = this.h[0] >>> 13, this.h[0] &= 8191, this.h[1] += T, T = this.h[1] >>> 13, this.h[1] &= 8191, this.h[2] += T, Y[0] = this.h[0] + 5, T = Y[0] >>> 13, Y[0] &= 8191, le = 1; le < 10; le++) + Y[le] = this.h[le] + T, T = Y[le] >>> 13, Y[le] &= 8191; + for (Y[9] -= 8192, F = (T ^ 1) - 1, le = 0; le < 10; le++) Y[le] &= F; + for (F = ~F, le = 0; le < 10; le++) this.h[le] = this.h[le] & F | Y[le]; + for (this.h[0] = (this.h[0] | this.h[1] << 13) & 65535, this.h[1] = (this.h[1] >>> 3 | this.h[2] << 10) & 65535, this.h[2] = (this.h[2] >>> 6 | this.h[3] << 7) & 65535, this.h[3] = (this.h[3] >>> 9 | this.h[4] << 4) & 65535, this.h[4] = (this.h[4] >>> 12 | this.h[5] << 1 | this.h[6] << 14) & 65535, this.h[5] = (this.h[6] >>> 2 | this.h[7] << 11) & 65535, this.h[6] = (this.h[7] >>> 5 | this.h[8] << 8) & 65535, this.h[7] = (this.h[8] >>> 8 | this.h[9] << 5) & 65535, ie = this.h[0] + this.pad[0], this.h[0] = ie & 65535, le = 1; le < 8; le++) + ie = (this.h[le] + this.pad[le] | 0) + (ie >>> 16) | 0, this.h[le] = ie & 65535; + H[V + 0] = this.h[0] >>> 0 & 255, H[V + 1] = this.h[0] >>> 8 & 255, H[V + 2] = this.h[1] >>> 0 & 255, H[V + 3] = this.h[1] >>> 8 & 255, H[V + 4] = this.h[2] >>> 0 & 255, H[V + 5] = this.h[2] >>> 8 & 255, H[V + 6] = this.h[3] >>> 0 & 255, H[V + 7] = this.h[3] >>> 8 & 255, H[V + 8] = this.h[4] >>> 0 & 255, H[V + 9] = this.h[4] >>> 8 & 255, H[V + 10] = this.h[5] >>> 0 & 255, H[V + 11] = this.h[5] >>> 8 & 255, H[V + 12] = this.h[6] >>> 0 & 255, H[V + 13] = this.h[6] >>> 8 & 255, H[V + 14] = this.h[7] >>> 0 & 255, H[V + 15] = this.h[7] >>> 8 & 255; + }, K.prototype.update = function(H, V, Y) { + var T, F; + if (this.leftover) { + for (F = 16 - this.leftover, F > Y && (F = Y), T = 0; T < F; T++) + this.buffer[this.leftover + T] = H[V + T]; + if (Y -= F, V += F, this.leftover += F, this.leftover < 16) + return; + this.blocks(this.buffer, 0, 16), this.leftover = 0; + } + if (Y >= 16 && (F = Y - Y % 16, this.blocks(H, V, F), V += F, Y -= F), Y) { + for (T = 0; T < Y; T++) + this.buffer[this.leftover + T] = H[V + T]; + this.leftover += Y; + } + }; + function E(H, V, Y, T, F, ie) { + var le = new K(ie); + return le.update(Y, T, F), le.finish(H, V), 0; + } + function b(H, V, Y, T, F, ie) { + var le = new Uint8Array(16); + return E(le, 0, Y, T, F, ie), D(H, V, le, 0); + } + function l(H, V, Y, T, F) { + var ie; + if (Y < 32) return -1; + for (ne(H, 0, V, 0, Y, T, F), E(H, 16, H, 32, Y - 32, H), ie = 0; ie < 16; ie++) H[ie] = 0; + return 0; + } + function p(H, V, Y, T, F) { + var ie, le = new Uint8Array(32); + if (Y < 32 || (J(le, 0, 32, T, F), b(V, 16, V, 32, Y - 32, le) !== 0)) return -1; + for (ne(H, 0, V, 0, Y, T, F), ie = 0; ie < 32; ie++) H[ie] = 0; + return 0; + } + function m(H, V) { + var Y; + for (Y = 0; Y < 16; Y++) H[Y] = V[Y] | 0; + } + function w(H) { + var V, Y, T = 1; + for (V = 0; V < 16; V++) + Y = H[V] + T + 65535, T = Math.floor(Y / 65536), H[V] = Y - T * 65536; + H[0] += T - 1 + 37 * (T - 1); + } + function P(H, V, Y) { + for (var T, F = ~(Y - 1), ie = 0; ie < 16; ie++) + T = F & (H[ie] ^ V[ie]), H[ie] ^= T, V[ie] ^= T; + } + function _(H, V) { + var Y, T, F, ie = r(), le = r(); + for (Y = 0; Y < 16; Y++) le[Y] = V[Y]; + for (w(le), w(le), w(le), T = 0; T < 2; T++) { + for (ie[0] = le[0] - 65517, Y = 1; Y < 15; Y++) + ie[Y] = le[Y] - 65535 - (ie[Y - 1] >> 16 & 1), ie[Y - 1] &= 65535; + ie[15] = le[15] - 32767 - (ie[14] >> 16 & 1), F = ie[15] >> 16 & 1, ie[14] &= 65535, P(le, ie, 1 - F); + } + for (Y = 0; Y < 16; Y++) + H[2 * Y] = le[Y] & 255, H[2 * Y + 1] = le[Y] >> 8; + } + function y(H, V) { + var Y = new Uint8Array(32), T = new Uint8Array(32); + return _(Y, H), _(T, V), $(Y, 0, T, 0); + } + function M(H) { + var V = new Uint8Array(32); + return _(V, H), V[0] & 1; + } + function I(H, V) { + var Y; + for (Y = 0; Y < 16; Y++) H[Y] = V[2 * Y] + (V[2 * Y + 1] << 8); + H[15] &= 32767; + } + function q(H, V, Y) { + for (var T = 0; T < 16; T++) H[T] = V[T] + Y[T]; + } + function ce(H, V, Y) { + for (var T = 0; T < 16; T++) H[T] = V[T] - Y[T]; + } + function L(H, V, Y) { + var T, F, ie = 0, le = 0, me = 0, Ee = 0, Le = 0, Ie = 0, Qe = 0, Xe = 0, tt = 0, st = 0, vt = 0, Ct = 0, Mt = 0, wt = 0, Rt = 0, gt = 0, _t = 0, at = 0, yt = 0, ut = 0, it = 0, Se = 0, Pe = 0, Ke = 0, Fe = 0, qe = 0, Ye = 0, Lt = 0, zt = 0, Zt = 0, Ht = 0, ge = Y[0], nr = Y[1], pr = Y[2], gr = Y[3], Qt = Y[4], mr = Y[5], lr = Y[6], Tr = Y[7], vr = Y[8], xr = Y[9], $r = Y[10], Br = Y[11], Ir = Y[12], rn = Y[13], nn = Y[14], sn = Y[15]; + T = V[0], ie += T * ge, le += T * nr, me += T * pr, Ee += T * gr, Le += T * Qt, Ie += T * mr, Qe += T * lr, Xe += T * Tr, tt += T * vr, st += T * xr, vt += T * $r, Ct += T * Br, Mt += T * Ir, wt += T * rn, Rt += T * nn, gt += T * sn, T = V[1], le += T * ge, me += T * nr, Ee += T * pr, Le += T * gr, Ie += T * Qt, Qe += T * mr, Xe += T * lr, tt += T * Tr, st += T * vr, vt += T * xr, Ct += T * $r, Mt += T * Br, wt += T * Ir, Rt += T * rn, gt += T * nn, _t += T * sn, T = V[2], me += T * ge, Ee += T * nr, Le += T * pr, Ie += T * gr, Qe += T * Qt, Xe += T * mr, tt += T * lr, st += T * Tr, vt += T * vr, Ct += T * xr, Mt += T * $r, wt += T * Br, Rt += T * Ir, gt += T * rn, _t += T * nn, at += T * sn, T = V[3], Ee += T * ge, Le += T * nr, Ie += T * pr, Qe += T * gr, Xe += T * Qt, tt += T * mr, st += T * lr, vt += T * Tr, Ct += T * vr, Mt += T * xr, wt += T * $r, Rt += T * Br, gt += T * Ir, _t += T * rn, at += T * nn, yt += T * sn, T = V[4], Le += T * ge, Ie += T * nr, Qe += T * pr, Xe += T * gr, tt += T * Qt, st += T * mr, vt += T * lr, Ct += T * Tr, Mt += T * vr, wt += T * xr, Rt += T * $r, gt += T * Br, _t += T * Ir, at += T * rn, yt += T * nn, ut += T * sn, T = V[5], Ie += T * ge, Qe += T * nr, Xe += T * pr, tt += T * gr, st += T * Qt, vt += T * mr, Ct += T * lr, Mt += T * Tr, wt += T * vr, Rt += T * xr, gt += T * $r, _t += T * Br, at += T * Ir, yt += T * rn, ut += T * nn, it += T * sn, T = V[6], Qe += T * ge, Xe += T * nr, tt += T * pr, st += T * gr, vt += T * Qt, Ct += T * mr, Mt += T * lr, wt += T * Tr, Rt += T * vr, gt += T * xr, _t += T * $r, at += T * Br, yt += T * Ir, ut += T * rn, it += T * nn, Se += T * sn, T = V[7], Xe += T * ge, tt += T * nr, st += T * pr, vt += T * gr, Ct += T * Qt, Mt += T * mr, wt += T * lr, Rt += T * Tr, gt += T * vr, _t += T * xr, at += T * $r, yt += T * Br, ut += T * Ir, it += T * rn, Se += T * nn, Pe += T * sn, T = V[8], tt += T * ge, st += T * nr, vt += T * pr, Ct += T * gr, Mt += T * Qt, wt += T * mr, Rt += T * lr, gt += T * Tr, _t += T * vr, at += T * xr, yt += T * $r, ut += T * Br, it += T * Ir, Se += T * rn, Pe += T * nn, Ke += T * sn, T = V[9], st += T * ge, vt += T * nr, Ct += T * pr, Mt += T * gr, wt += T * Qt, Rt += T * mr, gt += T * lr, _t += T * Tr, at += T * vr, yt += T * xr, ut += T * $r, it += T * Br, Se += T * Ir, Pe += T * rn, Ke += T * nn, Fe += T * sn, T = V[10], vt += T * ge, Ct += T * nr, Mt += T * pr, wt += T * gr, Rt += T * Qt, gt += T * mr, _t += T * lr, at += T * Tr, yt += T * vr, ut += T * xr, it += T * $r, Se += T * Br, Pe += T * Ir, Ke += T * rn, Fe += T * nn, qe += T * sn, T = V[11], Ct += T * ge, Mt += T * nr, wt += T * pr, Rt += T * gr, gt += T * Qt, _t += T * mr, at += T * lr, yt += T * Tr, ut += T * vr, it += T * xr, Se += T * $r, Pe += T * Br, Ke += T * Ir, Fe += T * rn, qe += T * nn, Ye += T * sn, T = V[12], Mt += T * ge, wt += T * nr, Rt += T * pr, gt += T * gr, _t += T * Qt, at += T * mr, yt += T * lr, ut += T * Tr, it += T * vr, Se += T * xr, Pe += T * $r, Ke += T * Br, Fe += T * Ir, qe += T * rn, Ye += T * nn, Lt += T * sn, T = V[13], wt += T * ge, Rt += T * nr, gt += T * pr, _t += T * gr, at += T * Qt, yt += T * mr, ut += T * lr, it += T * Tr, Se += T * vr, Pe += T * xr, Ke += T * $r, Fe += T * Br, qe += T * Ir, Ye += T * rn, Lt += T * nn, zt += T * sn, T = V[14], Rt += T * ge, gt += T * nr, _t += T * pr, at += T * gr, yt += T * Qt, ut += T * mr, it += T * lr, Se += T * Tr, Pe += T * vr, Ke += T * xr, Fe += T * $r, qe += T * Br, Ye += T * Ir, Lt += T * rn, zt += T * nn, Zt += T * sn, T = V[15], gt += T * ge, _t += T * nr, at += T * pr, yt += T * gr, ut += T * Qt, it += T * mr, Se += T * lr, Pe += T * Tr, Ke += T * vr, Fe += T * xr, qe += T * $r, Ye += T * Br, Lt += T * Ir, zt += T * rn, Zt += T * nn, Ht += T * sn, ie += 38 * _t, le += 38 * at, me += 38 * yt, Ee += 38 * ut, Le += 38 * it, Ie += 38 * Se, Qe += 38 * Pe, Xe += 38 * Ke, tt += 38 * Fe, st += 38 * qe, vt += 38 * Ye, Ct += 38 * Lt, Mt += 38 * zt, wt += 38 * Zt, Rt += 38 * Ht, F = 1, T = ie + F + 65535, F = Math.floor(T / 65536), ie = T - F * 65536, T = le + F + 65535, F = Math.floor(T / 65536), le = T - F * 65536, T = me + F + 65535, F = Math.floor(T / 65536), me = T - F * 65536, T = Ee + F + 65535, F = Math.floor(T / 65536), Ee = T - F * 65536, T = Le + F + 65535, F = Math.floor(T / 65536), Le = T - F * 65536, T = Ie + F + 65535, F = Math.floor(T / 65536), Ie = T - F * 65536, T = Qe + F + 65535, F = Math.floor(T / 65536), Qe = T - F * 65536, T = Xe + F + 65535, F = Math.floor(T / 65536), Xe = T - F * 65536, T = tt + F + 65535, F = Math.floor(T / 65536), tt = T - F * 65536, T = st + F + 65535, F = Math.floor(T / 65536), st = T - F * 65536, T = vt + F + 65535, F = Math.floor(T / 65536), vt = T - F * 65536, T = Ct + F + 65535, F = Math.floor(T / 65536), Ct = T - F * 65536, T = Mt + F + 65535, F = Math.floor(T / 65536), Mt = T - F * 65536, T = wt + F + 65535, F = Math.floor(T / 65536), wt = T - F * 65536, T = Rt + F + 65535, F = Math.floor(T / 65536), Rt = T - F * 65536, T = gt + F + 65535, F = Math.floor(T / 65536), gt = T - F * 65536, ie += F - 1 + 37 * (F - 1), F = 1, T = ie + F + 65535, F = Math.floor(T / 65536), ie = T - F * 65536, T = le + F + 65535, F = Math.floor(T / 65536), le = T - F * 65536, T = me + F + 65535, F = Math.floor(T / 65536), me = T - F * 65536, T = Ee + F + 65535, F = Math.floor(T / 65536), Ee = T - F * 65536, T = Le + F + 65535, F = Math.floor(T / 65536), Le = T - F * 65536, T = Ie + F + 65535, F = Math.floor(T / 65536), Ie = T - F * 65536, T = Qe + F + 65535, F = Math.floor(T / 65536), Qe = T - F * 65536, T = Xe + F + 65535, F = Math.floor(T / 65536), Xe = T - F * 65536, T = tt + F + 65535, F = Math.floor(T / 65536), tt = T - F * 65536, T = st + F + 65535, F = Math.floor(T / 65536), st = T - F * 65536, T = vt + F + 65535, F = Math.floor(T / 65536), vt = T - F * 65536, T = Ct + F + 65535, F = Math.floor(T / 65536), Ct = T - F * 65536, T = Mt + F + 65535, F = Math.floor(T / 65536), Mt = T - F * 65536, T = wt + F + 65535, F = Math.floor(T / 65536), wt = T - F * 65536, T = Rt + F + 65535, F = Math.floor(T / 65536), Rt = T - F * 65536, T = gt + F + 65535, F = Math.floor(T / 65536), gt = T - F * 65536, ie += F - 1 + 37 * (F - 1), H[0] = ie, H[1] = le, H[2] = me, H[3] = Ee, H[4] = Le, H[5] = Ie, H[6] = Qe, H[7] = Xe, H[8] = tt, H[9] = st, H[10] = vt, H[11] = Ct, H[12] = Mt, H[13] = wt, H[14] = Rt, H[15] = gt; + } + function oe(H, V) { + L(H, V, V); + } + function Q(H, V) { + var Y = r(), T; + for (T = 0; T < 16; T++) Y[T] = V[T]; + for (T = 253; T >= 0; T--) + oe(Y, Y), T !== 2 && T !== 4 && L(Y, Y, V); + for (T = 0; T < 16; T++) H[T] = Y[T]; + } + function X(H, V) { + var Y = r(), T; + for (T = 0; T < 16; T++) Y[T] = V[T]; + for (T = 250; T >= 0; T--) + oe(Y, Y), T !== 1 && L(Y, Y, V); + for (T = 0; T < 16; T++) H[T] = Y[T]; + } + function ee(H, V, Y) { + var T = new Uint8Array(32), F = new Float64Array(80), ie, le, me = r(), Ee = r(), Le = r(), Ie = r(), Qe = r(), Xe = r(); + for (le = 0; le < 31; le++) T[le] = V[le]; + for (T[31] = V[31] & 127 | 64, T[0] &= 248, I(F, Y), le = 0; le < 16; le++) + Ee[le] = F[le], Ie[le] = me[le] = Le[le] = 0; + for (me[0] = Ie[0] = 1, le = 254; le >= 0; --le) + ie = T[le >>> 3] >>> (le & 7) & 1, P(me, Ee, ie), P(Le, Ie, ie), q(Qe, me, Le), ce(me, me, Le), q(Le, Ee, Ie), ce(Ee, Ee, Ie), oe(Ie, Qe), oe(Xe, me), L(me, Le, me), L(Le, Ee, Qe), q(Qe, me, Le), ce(me, me, Le), oe(Ee, me), ce(Le, Ie, Xe), L(me, Le, f), q(me, me, Ie), L(Le, Le, me), L(me, Ie, Xe), L(Ie, Ee, F), oe(Ee, Qe), P(me, Ee, ie), P(Le, Ie, ie); + for (le = 0; le < 16; le++) + F[le + 16] = me[le], F[le + 32] = Le[le], F[le + 48] = Ee[le], F[le + 64] = Ie[le]; + var tt = F.subarray(32), st = F.subarray(16); + return Q(tt, tt), L(st, st, tt), _(H, st), 0; + } + function O(H, V) { + return ee(H, V, s); + } + function Z(H, V) { + return n(V, 32), O(H, V); + } + function re(H, V, Y) { + var T = new Uint8Array(32); + return ee(T, Y, V), B(H, i, T, U); + } + var he = l, ae = p; + function fe(H, V, Y, T, F, ie) { + var le = new Uint8Array(32); + return re(le, F, ie), he(H, V, Y, T, le); + } + function be(H, V, Y, T, F, ie) { + var le = new Uint8Array(32); + return re(le, F, ie), ae(H, V, Y, T, le); + } + var Ae = [ + 1116352408, + 3609767458, + 1899447441, + 602891725, + 3049323471, + 3964484399, + 3921009573, + 2173295548, + 961987163, + 4081628472, + 1508970993, + 3053834265, + 2453635748, + 2937671579, + 2870763221, + 3664609560, + 3624381080, + 2734883394, + 310598401, + 1164996542, + 607225278, + 1323610764, + 1426881987, + 3590304994, + 1925078388, + 4068182383, + 2162078206, + 991336113, + 2614888103, + 633803317, + 3248222580, + 3479774868, + 3835390401, + 2666613458, + 4022224774, + 944711139, + 264347078, + 2341262773, + 604807628, + 2007800933, + 770255983, + 1495990901, + 1249150122, + 1856431235, + 1555081692, + 3175218132, + 1996064986, + 2198950837, + 2554220882, + 3999719339, + 2821834349, + 766784016, + 2952996808, + 2566594879, + 3210313671, + 3203337956, + 3336571891, + 1034457026, + 3584528711, + 2466948901, + 113926993, + 3758326383, + 338241895, + 168717936, + 666307205, + 1188179964, + 773529912, + 1546045734, + 1294757372, + 1522805485, + 1396182291, + 2643833823, + 1695183700, + 2343527390, + 1986661051, + 1014477480, + 2177026350, + 1206759142, + 2456956037, + 344077627, + 2730485921, + 1290863460, + 2820302411, + 3158454273, + 3259730800, + 3505952657, + 3345764771, + 106217008, + 3516065817, + 3606008344, + 3600352804, + 1432725776, + 4094571909, + 1467031594, + 275423344, + 851169720, + 430227734, + 3100823752, + 506948616, + 1363258195, + 659060556, + 3750685593, + 883997877, + 3785050280, + 958139571, + 3318307427, + 1322822218, + 3812723403, + 1537002063, + 2003034995, + 1747873779, + 3602036899, + 1955562222, + 1575990012, + 2024104815, + 1125592928, + 2227730452, + 2716904306, + 2361852424, + 442776044, + 2428436474, + 593698344, + 2756734187, + 3733110249, + 3204031479, + 2999351573, + 3329325298, + 3815920427, + 3391569614, + 3928383900, + 3515267271, + 566280711, + 3940187606, + 3454069534, + 4118630271, + 4000239992, + 116418474, + 1914138554, + 174292421, + 2731055270, + 289380356, + 3203993006, + 460393269, + 320620315, + 685471733, + 587496836, + 852142971, + 1086792851, + 1017036298, + 365543100, + 1126000580, + 2618297676, + 1288033470, + 3409855158, + 1501505948, + 4234509866, + 1607167915, + 987167468, + 1816402316, + 1246189591 + ]; + function Te(H, V, Y, T) { + for (var F = new Int32Array(16), ie = new Int32Array(16), le, me, Ee, Le, Ie, Qe, Xe, tt, st, vt, Ct, Mt, wt, Rt, gt, _t, at, yt, ut, it, Se, Pe, Ke, Fe, qe, Ye, Lt = H[0], zt = H[1], Zt = H[2], Ht = H[3], ge = H[4], nr = H[5], pr = H[6], gr = H[7], Qt = V[0], mr = V[1], lr = V[2], Tr = V[3], vr = V[4], xr = V[5], $r = V[6], Br = V[7], Ir = 0; T >= 128; ) { + for (ut = 0; ut < 16; ut++) + it = 8 * ut + Ir, F[ut] = Y[it + 0] << 24 | Y[it + 1] << 16 | Y[it + 2] << 8 | Y[it + 3], ie[ut] = Y[it + 4] << 24 | Y[it + 5] << 16 | Y[it + 6] << 8 | Y[it + 7]; + for (ut = 0; ut < 80; ut++) + if (le = Lt, me = zt, Ee = Zt, Le = Ht, Ie = ge, Qe = nr, Xe = pr, tt = gr, st = Qt, vt = mr, Ct = lr, Mt = Tr, wt = vr, Rt = xr, gt = $r, _t = Br, Se = gr, Pe = Br, Ke = Pe & 65535, Fe = Pe >>> 16, qe = Se & 65535, Ye = Se >>> 16, Se = (ge >>> 14 | vr << 18) ^ (ge >>> 18 | vr << 14) ^ (vr >>> 9 | ge << 23), Pe = (vr >>> 14 | ge << 18) ^ (vr >>> 18 | ge << 14) ^ (ge >>> 9 | vr << 23), Ke += Pe & 65535, Fe += Pe >>> 16, qe += Se & 65535, Ye += Se >>> 16, Se = ge & nr ^ ~ge & pr, Pe = vr & xr ^ ~vr & $r, Ke += Pe & 65535, Fe += Pe >>> 16, qe += Se & 65535, Ye += Se >>> 16, Se = Ae[ut * 2], Pe = Ae[ut * 2 + 1], Ke += Pe & 65535, Fe += Pe >>> 16, qe += Se & 65535, Ye += Se >>> 16, Se = F[ut % 16], Pe = ie[ut % 16], Ke += Pe & 65535, Fe += Pe >>> 16, qe += Se & 65535, Ye += Se >>> 16, Fe += Ke >>> 16, qe += Fe >>> 16, Ye += qe >>> 16, at = qe & 65535 | Ye << 16, yt = Ke & 65535 | Fe << 16, Se = at, Pe = yt, Ke = Pe & 65535, Fe = Pe >>> 16, qe = Se & 65535, Ye = Se >>> 16, Se = (Lt >>> 28 | Qt << 4) ^ (Qt >>> 2 | Lt << 30) ^ (Qt >>> 7 | Lt << 25), Pe = (Qt >>> 28 | Lt << 4) ^ (Lt >>> 2 | Qt << 30) ^ (Lt >>> 7 | Qt << 25), Ke += Pe & 65535, Fe += Pe >>> 16, qe += Se & 65535, Ye += Se >>> 16, Se = Lt & zt ^ Lt & Zt ^ zt & Zt, Pe = Qt & mr ^ Qt & lr ^ mr & lr, Ke += Pe & 65535, Fe += Pe >>> 16, qe += Se & 65535, Ye += Se >>> 16, Fe += Ke >>> 16, qe += Fe >>> 16, Ye += qe >>> 16, tt = qe & 65535 | Ye << 16, _t = Ke & 65535 | Fe << 16, Se = Le, Pe = Mt, Ke = Pe & 65535, Fe = Pe >>> 16, qe = Se & 65535, Ye = Se >>> 16, Se = at, Pe = yt, Ke += Pe & 65535, Fe += Pe >>> 16, qe += Se & 65535, Ye += Se >>> 16, Fe += Ke >>> 16, qe += Fe >>> 16, Ye += qe >>> 16, Le = qe & 65535 | Ye << 16, Mt = Ke & 65535 | Fe << 16, zt = le, Zt = me, Ht = Ee, ge = Le, nr = Ie, pr = Qe, gr = Xe, Lt = tt, mr = st, lr = vt, Tr = Ct, vr = Mt, xr = wt, $r = Rt, Br = gt, Qt = _t, ut % 16 === 15) + for (it = 0; it < 16; it++) + Se = F[it], Pe = ie[it], Ke = Pe & 65535, Fe = Pe >>> 16, qe = Se & 65535, Ye = Se >>> 16, Se = F[(it + 9) % 16], Pe = ie[(it + 9) % 16], Ke += Pe & 65535, Fe += Pe >>> 16, qe += Se & 65535, Ye += Se >>> 16, at = F[(it + 1) % 16], yt = ie[(it + 1) % 16], Se = (at >>> 1 | yt << 31) ^ (at >>> 8 | yt << 24) ^ at >>> 7, Pe = (yt >>> 1 | at << 31) ^ (yt >>> 8 | at << 24) ^ (yt >>> 7 | at << 25), Ke += Pe & 65535, Fe += Pe >>> 16, qe += Se & 65535, Ye += Se >>> 16, at = F[(it + 14) % 16], yt = ie[(it + 14) % 16], Se = (at >>> 19 | yt << 13) ^ (yt >>> 29 | at << 3) ^ at >>> 6, Pe = (yt >>> 19 | at << 13) ^ (at >>> 29 | yt << 3) ^ (yt >>> 6 | at << 26), Ke += Pe & 65535, Fe += Pe >>> 16, qe += Se & 65535, Ye += Se >>> 16, Fe += Ke >>> 16, qe += Fe >>> 16, Ye += qe >>> 16, F[it] = qe & 65535 | Ye << 16, ie[it] = Ke & 65535 | Fe << 16; + Se = Lt, Pe = Qt, Ke = Pe & 65535, Fe = Pe >>> 16, qe = Se & 65535, Ye = Se >>> 16, Se = H[0], Pe = V[0], Ke += Pe & 65535, Fe += Pe >>> 16, qe += Se & 65535, Ye += Se >>> 16, Fe += Ke >>> 16, qe += Fe >>> 16, Ye += qe >>> 16, H[0] = Lt = qe & 65535 | Ye << 16, V[0] = Qt = Ke & 65535 | Fe << 16, Se = zt, Pe = mr, Ke = Pe & 65535, Fe = Pe >>> 16, qe = Se & 65535, Ye = Se >>> 16, Se = H[1], Pe = V[1], Ke += Pe & 65535, Fe += Pe >>> 16, qe += Se & 65535, Ye += Se >>> 16, Fe += Ke >>> 16, qe += Fe >>> 16, Ye += qe >>> 16, H[1] = zt = qe & 65535 | Ye << 16, V[1] = mr = Ke & 65535 | Fe << 16, Se = Zt, Pe = lr, Ke = Pe & 65535, Fe = Pe >>> 16, qe = Se & 65535, Ye = Se >>> 16, Se = H[2], Pe = V[2], Ke += Pe & 65535, Fe += Pe >>> 16, qe += Se & 65535, Ye += Se >>> 16, Fe += Ke >>> 16, qe += Fe >>> 16, Ye += qe >>> 16, H[2] = Zt = qe & 65535 | Ye << 16, V[2] = lr = Ke & 65535 | Fe << 16, Se = Ht, Pe = Tr, Ke = Pe & 65535, Fe = Pe >>> 16, qe = Se & 65535, Ye = Se >>> 16, Se = H[3], Pe = V[3], Ke += Pe & 65535, Fe += Pe >>> 16, qe += Se & 65535, Ye += Se >>> 16, Fe += Ke >>> 16, qe += Fe >>> 16, Ye += qe >>> 16, H[3] = Ht = qe & 65535 | Ye << 16, V[3] = Tr = Ke & 65535 | Fe << 16, Se = ge, Pe = vr, Ke = Pe & 65535, Fe = Pe >>> 16, qe = Se & 65535, Ye = Se >>> 16, Se = H[4], Pe = V[4], Ke += Pe & 65535, Fe += Pe >>> 16, qe += Se & 65535, Ye += Se >>> 16, Fe += Ke >>> 16, qe += Fe >>> 16, Ye += qe >>> 16, H[4] = ge = qe & 65535 | Ye << 16, V[4] = vr = Ke & 65535 | Fe << 16, Se = nr, Pe = xr, Ke = Pe & 65535, Fe = Pe >>> 16, qe = Se & 65535, Ye = Se >>> 16, Se = H[5], Pe = V[5], Ke += Pe & 65535, Fe += Pe >>> 16, qe += Se & 65535, Ye += Se >>> 16, Fe += Ke >>> 16, qe += Fe >>> 16, Ye += qe >>> 16, H[5] = nr = qe & 65535 | Ye << 16, V[5] = xr = Ke & 65535 | Fe << 16, Se = pr, Pe = $r, Ke = Pe & 65535, Fe = Pe >>> 16, qe = Se & 65535, Ye = Se >>> 16, Se = H[6], Pe = V[6], Ke += Pe & 65535, Fe += Pe >>> 16, qe += Se & 65535, Ye += Se >>> 16, Fe += Ke >>> 16, qe += Fe >>> 16, Ye += qe >>> 16, H[6] = pr = qe & 65535 | Ye << 16, V[6] = $r = Ke & 65535 | Fe << 16, Se = gr, Pe = Br, Ke = Pe & 65535, Fe = Pe >>> 16, qe = Se & 65535, Ye = Se >>> 16, Se = H[7], Pe = V[7], Ke += Pe & 65535, Fe += Pe >>> 16, qe += Se & 65535, Ye += Se >>> 16, Fe += Ke >>> 16, qe += Fe >>> 16, Ye += qe >>> 16, H[7] = gr = qe & 65535 | Ye << 16, V[7] = Br = Ke & 65535 | Fe << 16, Ir += 128, T -= 128; + } + return T; + } + function Re(H, V, Y) { + var T = new Int32Array(8), F = new Int32Array(8), ie = new Uint8Array(256), le, me = Y; + for (T[0] = 1779033703, T[1] = 3144134277, T[2] = 1013904242, T[3] = 2773480762, T[4] = 1359893119, T[5] = 2600822924, T[6] = 528734635, T[7] = 1541459225, F[0] = 4089235720, F[1] = 2227873595, F[2] = 4271175723, F[3] = 1595750129, F[4] = 2917565137, F[5] = 725511199, F[6] = 4215389547, F[7] = 327033209, Te(T, F, V, Y), Y %= 128, le = 0; le < Y; le++) ie[le] = V[me - Y + le]; + for (ie[Y] = 128, Y = 256 - 128 * (Y < 112 ? 1 : 0), ie[Y - 9] = 0, S(ie, Y - 8, me / 536870912 | 0, me << 3), Te(T, F, ie, Y), le = 0; le < 8; le++) S(H, 8 * le, T[le], F[le]); + return 0; + } + function $e(H, V) { + var Y = r(), T = r(), F = r(), ie = r(), le = r(), me = r(), Ee = r(), Le = r(), Ie = r(); + ce(Y, H[1], H[0]), ce(Ie, V[1], V[0]), L(Y, Y, Ie), q(T, H[0], H[1]), q(Ie, V[0], V[1]), L(T, T, Ie), L(F, H[3], V[3]), L(F, F, h), L(ie, H[2], V[2]), q(ie, ie, ie), ce(le, T, Y), ce(me, ie, F), q(Ee, ie, F), q(Le, T, Y), L(H[0], le, me), L(H[1], Le, Ee), L(H[2], Ee, me), L(H[3], le, Le); + } + function Me(H, V, Y) { + var T; + for (T = 0; T < 4; T++) + P(H[T], V[T], Y); + } + function Oe(H, V) { + var Y = r(), T = r(), F = r(); + Q(F, V[2]), L(Y, V[0], F), L(T, V[1], F), _(H, T), H[31] ^= M(Y) << 7; + } + function ze(H, V, Y) { + var T, F; + for (m(H[0], o), m(H[1], a), m(H[2], a), m(H[3], o), F = 255; F >= 0; --F) + T = Y[F / 8 | 0] >> (F & 7) & 1, Me(H, V, T), $e(V, H), $e(H, H), Me(H, V, T); + } + function De(H, V) { + var Y = [r(), r(), r(), r()]; + m(Y[0], g), m(Y[1], v), m(Y[2], a), L(Y[3], g, v), ze(H, Y, V); + } + function je(H, V, Y) { + var T = new Uint8Array(64), F = [r(), r(), r(), r()], ie; + for (Y || n(V, 32), Re(T, V, 32), T[0] &= 248, T[31] &= 127, T[31] |= 64, De(F, T), Oe(H, F), ie = 0; ie < 32; ie++) V[ie + 32] = H[ie]; + return 0; + } + var Ue = new Float64Array([237, 211, 245, 92, 26, 99, 18, 88, 214, 156, 247, 162, 222, 249, 222, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16]); + function _e(H, V) { + var Y, T, F, ie; + for (T = 63; T >= 32; --T) { + for (Y = 0, F = T - 32, ie = T - 12; F < ie; ++F) + V[F] += Y - 16 * V[T] * Ue[F - (T - 32)], Y = Math.floor((V[F] + 128) / 256), V[F] -= Y * 256; + V[F] += Y, V[T] = 0; + } + for (Y = 0, F = 0; F < 32; F++) + V[F] += Y - (V[31] >> 4) * Ue[F], Y = V[F] >> 8, V[F] &= 255; + for (F = 0; F < 32; F++) V[F] -= Y * Ue[F]; + for (T = 0; T < 32; T++) + V[T + 1] += V[T] >> 8, H[T] = V[T] & 255; + } + function Ze(H) { + var V = new Float64Array(64), Y; + for (Y = 0; Y < 64; Y++) V[Y] = H[Y]; + for (Y = 0; Y < 64; Y++) H[Y] = 0; + _e(H, V); + } + function ot(H, V, Y, T) { + var F = new Uint8Array(64), ie = new Uint8Array(64), le = new Uint8Array(64), me, Ee, Le = new Float64Array(64), Ie = [r(), r(), r(), r()]; + Re(F, T, 32), F[0] &= 248, F[31] &= 127, F[31] |= 64; + var Qe = Y + 64; + for (me = 0; me < Y; me++) H[64 + me] = V[me]; + for (me = 0; me < 32; me++) H[32 + me] = F[32 + me]; + for (Re(le, H.subarray(32), Y + 32), Ze(le), De(Ie, le), Oe(H, Ie), me = 32; me < 64; me++) H[me] = T[me]; + for (Re(ie, H, Y + 64), Ze(ie), me = 0; me < 64; me++) Le[me] = 0; + for (me = 0; me < 32; me++) Le[me] = le[me]; + for (me = 0; me < 32; me++) + for (Ee = 0; Ee < 32; Ee++) + Le[me + Ee] += ie[me] * F[Ee]; + return _e(H.subarray(32), Le), Qe; + } + function ke(H, V) { + var Y = r(), T = r(), F = r(), ie = r(), le = r(), me = r(), Ee = r(); + return m(H[2], a), I(H[1], V), oe(F, H[1]), L(ie, F, u), ce(F, F, H[2]), q(ie, H[2], ie), oe(le, ie), oe(me, le), L(Ee, me, le), L(Y, Ee, F), L(Y, Y, ie), X(Y, Y), L(Y, Y, F), L(Y, Y, ie), L(Y, Y, ie), L(H[0], Y, ie), oe(T, H[0]), L(T, T, ie), y(T, F) && L(H[0], H[0], x), oe(T, H[0]), L(T, T, ie), y(T, F) ? -1 : (M(H[0]) === V[31] >> 7 && ce(H[0], o, H[0]), L(H[3], H[0], H[1]), 0); + } + function rt(H, V, Y, T) { + var F, ie = new Uint8Array(32), le = new Uint8Array(64), me = [r(), r(), r(), r()], Ee = [r(), r(), r(), r()]; + if (Y < 64 || ke(Ee, T)) return -1; + for (F = 0; F < Y; F++) H[F] = V[F]; + for (F = 0; F < 32; F++) H[F + 32] = T[F]; + if (Re(le, H, Y), Ze(le), ze(me, Ee, le), De(Ee, V.subarray(32)), $e(me, Ee), Oe(ie, me), Y -= 64, $(V, 0, ie, 0)) { + for (F = 0; F < Y; F++) H[F] = 0; + return -1; + } + for (F = 0; F < Y; F++) H[F] = V[F + 64]; + return Y; + } + var nt = 32, Ge = 24, ht = 32, lt = 16, ct = 32, qt = 32, Gt = 32, Et = 32, Yt = 32, tr = Ge, Tt = ht, kt = lt, It = 64, dt = 32, Dt = 64, Nt = 32, mt = 64; + e.lowlevel = { + crypto_core_hsalsa20: B, + crypto_stream_xor: ne, + crypto_stream: J, + crypto_stream_salsa20_xor: R, + crypto_stream_salsa20: W, + crypto_onetimeauth: E, + crypto_onetimeauth_verify: b, + crypto_verify_16: D, + crypto_verify_32: $, + crypto_secretbox: l, + crypto_secretbox_open: p, + crypto_scalarmult: ee, + crypto_scalarmult_base: O, + crypto_box_beforenm: re, + crypto_box_afternm: he, + crypto_box: fe, + crypto_box_open: be, + crypto_box_keypair: Z, + crypto_hash: Re, + crypto_sign: ot, + crypto_sign_keypair: je, + crypto_sign_open: rt, + crypto_secretbox_KEYBYTES: nt, + crypto_secretbox_NONCEBYTES: Ge, + crypto_secretbox_ZEROBYTES: ht, + crypto_secretbox_BOXZEROBYTES: lt, + crypto_scalarmult_BYTES: ct, + crypto_scalarmult_SCALARBYTES: qt, + crypto_box_PUBLICKEYBYTES: Gt, + crypto_box_SECRETKEYBYTES: Et, + crypto_box_BEFORENMBYTES: Yt, + crypto_box_NONCEBYTES: tr, + crypto_box_ZEROBYTES: Tt, + crypto_box_BOXZEROBYTES: kt, + crypto_sign_BYTES: It, + crypto_sign_PUBLICKEYBYTES: dt, + crypto_sign_SECRETKEYBYTES: Dt, + crypto_sign_SEEDBYTES: Nt, + crypto_hash_BYTES: mt, + gf: r, + D: u, + L: Ue, + pack25519: _, + unpack25519: I, + M: L, + A: q, + S: oe, + Z: ce, + pow2523: X, + add: $e, + set25519: m, + modL: _e, + scalarmult: ze, + scalarbase: De + }; + function Bt(H, V) { + if (H.length !== nt) throw new Error("bad key size"); + if (V.length !== Ge) throw new Error("bad nonce size"); + } + function Ft(H, V) { + if (H.length !== Gt) throw new Error("bad public key size"); + if (V.length !== Et) throw new Error("bad secret key size"); + } + function et() { + for (var H = 0; H < arguments.length; H++) + if (!(arguments[H] instanceof Uint8Array)) + throw new TypeError("unexpected type, use Uint8Array"); + } + function $t(H) { + for (var V = 0; V < H.length; V++) H[V] = 0; + } + e.randomBytes = function(H) { + var V = new Uint8Array(H); + return n(V, H), V; + }, e.secretbox = function(H, V, Y) { + et(H, V, Y), Bt(Y, V); + for (var T = new Uint8Array(ht + H.length), F = new Uint8Array(T.length), ie = 0; ie < H.length; ie++) T[ie + ht] = H[ie]; + return l(F, T, T.length, V, Y), F.subarray(lt); + }, e.secretbox.open = function(H, V, Y) { + et(H, V, Y), Bt(Y, V); + for (var T = new Uint8Array(lt + H.length), F = new Uint8Array(T.length), ie = 0; ie < H.length; ie++) T[ie + lt] = H[ie]; + return T.length < 32 || p(F, T, T.length, V, Y) !== 0 ? null : F.subarray(ht); + }, e.secretbox.keyLength = nt, e.secretbox.nonceLength = Ge, e.secretbox.overheadLength = lt, e.scalarMult = function(H, V) { + if (et(H, V), H.length !== qt) throw new Error("bad n size"); + if (V.length !== ct) throw new Error("bad p size"); + var Y = new Uint8Array(ct); + return ee(Y, H, V), Y; + }, e.scalarMult.base = function(H) { + if (et(H), H.length !== qt) throw new Error("bad n size"); + var V = new Uint8Array(ct); + return O(V, H), V; + }, e.scalarMult.scalarLength = qt, e.scalarMult.groupElementLength = ct, e.box = function(H, V, Y, T) { + var F = e.box.before(Y, T); + return e.secretbox(H, V, F); + }, e.box.before = function(H, V) { + et(H, V), Ft(H, V); + var Y = new Uint8Array(Yt); + return re(Y, H, V), Y; + }, e.box.after = e.secretbox, e.box.open = function(H, V, Y, T) { + var F = e.box.before(Y, T); + return e.secretbox.open(H, V, F); + }, e.box.open.after = e.secretbox.open, e.box.keyPair = function() { + var H = new Uint8Array(Gt), V = new Uint8Array(Et); + return Z(H, V), { publicKey: H, secretKey: V }; + }, e.box.keyPair.fromSecretKey = function(H) { + if (et(H), H.length !== Et) + throw new Error("bad secret key size"); + var V = new Uint8Array(Gt); + return O(V, H), { publicKey: V, secretKey: new Uint8Array(H) }; + }, e.box.publicKeyLength = Gt, e.box.secretKeyLength = Et, e.box.sharedKeyLength = Yt, e.box.nonceLength = tr, e.box.overheadLength = e.secretbox.overheadLength, e.sign = function(H, V) { + if (et(H, V), V.length !== Dt) + throw new Error("bad secret key size"); + var Y = new Uint8Array(It + H.length); + return ot(Y, H, H.length, V), Y; + }, e.sign.open = function(H, V) { + if (et(H, V), V.length !== dt) + throw new Error("bad public key size"); + var Y = new Uint8Array(H.length), T = rt(Y, H, H.length, V); + if (T < 0) return null; + for (var F = new Uint8Array(T), ie = 0; ie < F.length; ie++) F[ie] = Y[ie]; + return F; + }, e.sign.detached = function(H, V) { + for (var Y = e.sign(H, V), T = new Uint8Array(It), F = 0; F < T.length; F++) T[F] = Y[F]; + return T; + }, e.sign.detached.verify = function(H, V, Y) { + if (et(H, V, Y), V.length !== It) + throw new Error("bad signature size"); + if (Y.length !== dt) + throw new Error("bad public key size"); + var T = new Uint8Array(It + H.length), F = new Uint8Array(It + H.length), ie; + for (ie = 0; ie < It; ie++) T[ie] = V[ie]; + for (ie = 0; ie < H.length; ie++) T[ie + It] = H[ie]; + return rt(F, T, T.length, Y) >= 0; + }, e.sign.keyPair = function() { + var H = new Uint8Array(dt), V = new Uint8Array(Dt); + return je(H, V), { publicKey: H, secretKey: V }; + }, e.sign.keyPair.fromSecretKey = function(H) { + if (et(H), H.length !== Dt) + throw new Error("bad secret key size"); + for (var V = new Uint8Array(dt), Y = 0; Y < V.length; Y++) V[Y] = H[32 + Y]; + return { publicKey: V, secretKey: new Uint8Array(H) }; + }, e.sign.keyPair.fromSeed = function(H) { + if (et(H), H.length !== Nt) + throw new Error("bad seed size"); + for (var V = new Uint8Array(dt), Y = new Uint8Array(Dt), T = 0; T < 32; T++) Y[T] = H[T]; + return je(V, Y, !0), { publicKey: V, secretKey: Y }; + }, e.sign.publicKeyLength = dt, e.sign.secretKeyLength = Dt, e.sign.seedLength = Nt, e.sign.signatureLength = It, e.hash = function(H) { + et(H); + var V = new Uint8Array(mt); + return Re(V, H, H.length), V; + }, e.hash.hashLength = mt, e.verify = function(H, V) { + return et(H, V), H.length === 0 || V.length === 0 || H.length !== V.length ? !1 : C(H, 0, V, 0, H.length) === 0; + }, e.setPRNG = function(H) { + n = H; + }, (function() { + var H = typeof self < "u" ? self.crypto || self.msCrypto : null; + if (H && H.getRandomValues) { + var V = 65536; + e.setPRNG(function(Y, T) { + var F, ie = new Uint8Array(T); + for (F = 0; F < T; F += V) + H.getRandomValues(ie.subarray(F, F + Math.min(T - F, V))); + for (F = 0; F < T; F++) Y[F] = ie[F]; + $t(ie); + }); + } else typeof X4 < "u" && (H = Qf, H && H.randomBytes && e.setPRNG(function(Y, T) { + var F, ie = H.randomBytes(T); + for (F = 0; F < T; F++) Y[F] = ie[F]; + $t(ie); + })); + })(); + })(t.exports ? t.exports : self.nacl = self.nacl || {}); + })(Dm)), Dm.exports; +} +var cte = ate(); +const Dh = /* @__PURE__ */ Hi(cte); +var Lo; +(function(t) { + t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.MANIFEST_NOT_FOUND_ERROR = 2] = "MANIFEST_NOT_FOUND_ERROR", t[t.MANIFEST_CONTENT_ERROR = 3] = "MANIFEST_CONTENT_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; +})(Lo || (Lo = {})); +var $5; +(function(t) { + t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; +})($5 || ($5 = {})); +var Mc; +(function(t) { + t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; +})(Mc || (Mc = {})); +var B5; +(function(t) { + t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; +})(B5 || (B5 = {})); +var F5; +(function(t) { + t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; +})(F5 || (F5 = {})); +var j5; +(function(t) { + t.MAINNET = "-239", t.TESTNET = "-3"; +})(j5 || (j5 = {})); +function ute(t, e) { + const r = Hf.encodeBase64(t); + return e ? encodeURIComponent(r) : r; +} +function fte(t, e) { + return e && (t = decodeURIComponent(t)), Hf.decodeBase64(t); +} +function lte(t, e = !1) { + let r; + return t instanceof Uint8Array ? r = t : (typeof t != "string" && (t = JSON.stringify(t)), r = Hf.decodeUTF8(t)), ute(r, e); +} +function hte(t, e = !1) { + const r = fte(t, e); + return { + toString() { + return Hf.encodeUTF8(r); + }, + toObject() { + try { + return JSON.parse(Hf.encodeUTF8(r)); + } catch { + return null; + } + }, + toUint8Array() { + return r; + } + }; +} +const A9 = { + encode: lte, + decode: hte +}; +function dte(t, e) { + const r = new Uint8Array(t.length + e.length); + return r.set(t), r.set(e, t.length), r; +} +function pte(t, e) { + if (e >= t.length) + throw new Error("Index is out of buffer"); + const r = t.slice(0, e), n = t.slice(e); + return [r, n]; +} +function Om(t) { + let e = ""; + return t.forEach((r) => { + e += ("0" + (r & 255).toString(16)).slice(-2); + }), e; +} +function kd(t) { + if (t.length % 2 !== 0) + throw new Error(`Cannot convert ${t} to bytesArray`); + const e = new Uint8Array(t.length / 2); + for (let r = 0; r < t.length; r += 2) + e[r / 2] = parseInt(t.slice(r, r + 2), 16); + return e; +} +class zv { + constructor(e) { + this.nonceLength = 24, this.keyPair = e ? this.createKeypairFromString(e) : this.createKeypair(), this.sessionId = Om(this.keyPair.publicKey); + } + createKeypair() { + return Dh.box.keyPair(); + } + createKeypairFromString(e) { + return { + publicKey: kd(e.publicKey), + secretKey: kd(e.secretKey) + }; + } + createNonce() { + return Dh.randomBytes(this.nonceLength); + } + encrypt(e, r) { + const n = new TextEncoder().encode(e), i = this.createNonce(), s = Dh.box(n, i, r, this.keyPair.secretKey); + return dte(i, s); + } + decrypt(e, r) { + const [n, i] = pte(e, this.nonceLength), s = Dh.box.open(i, n, r, this.keyPair.secretKey); + if (!s) + throw new Error(`Decryption error: + message: ${e.toString()} + sender pubkey: ${r.toString()} + keypair pubkey: ${this.keyPair.publicKey.toString()} + keypair secretkey: ${this.keyPair.secretKey.toString()}`); + return new TextDecoder().decode(s); + } + stringifyKeypair() { + return { + publicKey: Om(this.keyPair.publicKey), + secretKey: Om(this.keyPair.secretKey) + }; + } +} +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +function gte(t, e) { + var r = {}; + for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); + if (t != null && typeof Object.getOwnPropertySymbols == "function") + for (var i = 0, n = Object.getOwnPropertySymbols(t); i < n.length; i++) + e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]); + return r; +} +function At(t, e, r, n) { + function i(s) { + return s instanceof r ? s : new r(function(o) { + o(s); + }); + } + return new (r || (r = Promise))(function(s, o) { + function a(h) { + try { + u(n.next(h)); + } catch (g) { + o(g); + } + } + function f(h) { + try { + u(n.throw(h)); + } catch (g) { + o(g); + } + } + function u(h) { + h.done ? s(h.value) : i(h.value).then(a, f); + } + u((n = n.apply(t, [])).next()); + }); +} +class jt extends Error { + constructor(e, r) { + super(e, r), this.message = `${jt.prefix} ${this.constructor.name}${this.info ? ": " + this.info : ""}${e ? ` +` + e : ""}`, Object.setPrototypeOf(this, jt.prototype); + } + get info() { + return ""; + } +} +jt.prefix = "[TON_CONNECT_SDK_ERROR]"; +class Mb extends jt { + get info() { + return "Passed DappMetadata is in incorrect format."; + } + constructor(...e) { + super(...e), Object.setPrototypeOf(this, Mb.prototype); + } +} +class S0 extends jt { + get info() { + return "Passed `tonconnect-manifest.json` contains errors. Check format of your manifest. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"; + } + constructor(...e) { + super(...e), Object.setPrototypeOf(this, S0.prototype); + } +} +class A0 extends jt { + get info() { + return "Manifest not found. Make sure you added `tonconnect-manifest.json` to the root of your app or passed correct manifestUrl. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"; + } + constructor(...e) { + super(...e), Object.setPrototypeOf(this, A0.prototype); + } +} +class Ib extends jt { + get info() { + return "Wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection."; + } + constructor(...e) { + super(...e), Object.setPrototypeOf(this, Ib.prototype); + } +} +class $d extends jt { + get info() { + return "Send transaction or other protocol methods called while wallet is not connected."; + } + constructor(...e) { + super(...e), Object.setPrototypeOf(this, $d.prototype); + } +} +function mte(t) { + return "jsBridgeKey" in t; +} +class P0 extends jt { + get info() { + return "User rejects the action in the wallet."; + } + constructor(...e) { + super(...e), Object.setPrototypeOf(this, P0.prototype); + } +} +class M0 extends jt { + get info() { + return "Request to the wallet contains errors."; + } + constructor(...e) { + super(...e), Object.setPrototypeOf(this, M0.prototype); + } +} +class I0 extends jt { + get info() { + return "App tries to send rpc request to the injected wallet while not connected."; + } + constructor(...e) { + super(...e), Object.setPrototypeOf(this, I0.prototype); + } +} +class Cb extends jt { + get info() { + return "There is an attempt to connect to the injected wallet while it is not exists in the webpage."; + } + constructor(...e) { + super(...e), Object.setPrototypeOf(this, Cb.prototype); + } +} +class Rb extends jt { + get info() { + return "An error occurred while fetching the wallets list."; + } + constructor(...e) { + super(...e), Object.setPrototypeOf(this, Rb.prototype); + } +} +class Jo extends jt { + constructor(...e) { + super(...e), Object.setPrototypeOf(this, Jo.prototype); + } +} +const U5 = { + [Lo.UNKNOWN_ERROR]: Jo, + [Lo.USER_REJECTS_ERROR]: P0, + [Lo.BAD_REQUEST_ERROR]: M0, + [Lo.UNKNOWN_APP_ERROR]: I0, + [Lo.MANIFEST_NOT_FOUND_ERROR]: A0, + [Lo.MANIFEST_CONTENT_ERROR]: S0 +}; +class vte { + parseError(e) { + let r = Jo; + return e.code in U5 && (r = U5[e.code] || Jo), new r(e.message); + } +} +const bte = new vte(); +class yte { + isError(e) { + return "error" in e; + } +} +const q5 = { + [Mc.UNKNOWN_ERROR]: Jo, + [Mc.USER_REJECTS_ERROR]: P0, + [Mc.BAD_REQUEST_ERROR]: M0, + [Mc.UNKNOWN_APP_ERROR]: I0 +}; +class wte extends yte { + convertToRpcRequest(e) { + return { + method: "sendTransaction", + params: [JSON.stringify(e)] + }; + } + parseAndThrowError(e) { + let r = Jo; + throw e.error.code in q5 && (r = q5[e.error.code] || Jo), new r(e.error.message); + } + convertFromRpcResponse(e) { + return { + boc: e.result + }; + } +} +const Oh = new wte(); +class xte { + constructor(e, r) { + this.storage = e, this.storeKey = "ton-connect-storage_http-bridge-gateway::" + r; + } + storeLastEventId(e) { + return At(this, void 0, void 0, function* () { + return this.storage.setItem(this.storeKey, e); + }); + } + removeLastEventId() { + return At(this, void 0, void 0, function* () { + return this.storage.removeItem(this.storeKey); + }); + } + getLastEventId() { + return At(this, void 0, void 0, function* () { + const e = yield this.storage.getItem(this.storeKey); + return e || null; + }); + } +} +function _te(t) { + return t.slice(-1) === "/" ? t.slice(0, -1) : t; +} +function P9(t, e) { + return _te(t) + "/" + e; +} +function Ete(t) { + if (!t) + return !1; + const e = new URL(t); + return e.protocol === "tg:" || e.hostname === "t.me"; +} +function Ste(t) { + return t.replaceAll(".", "%2E").replaceAll("-", "%2D").replaceAll("_", "%5F").replaceAll("&", "-").replaceAll("=", "__").replaceAll("%", "--"); +} +function M9(t, e) { + return At(this, void 0, void 0, function* () { + return new Promise((r, n) => { + var i, s; + if (!((i = void 0) === null || i === void 0) && i.aborted) { + n(new jt("Delay aborted")); + return; + } + const o = setTimeout(() => r(), t); + (s = void 0) === null || s === void 0 || s.addEventListener("abort", () => { + clearTimeout(o), n(new jt("Delay aborted")); + }); + }); + }); +} +function cs(t) { + const e = new AbortController(); + return t?.aborted ? e.abort() : t?.addEventListener("abort", () => e.abort(), { once: !0 }), e; +} +function ff(t, e) { + var r, n; + return At(this, void 0, void 0, function* () { + const i = (r = e?.attempts) !== null && r !== void 0 ? r : 10, s = (n = e?.delayMs) !== null && n !== void 0 ? n : 200, o = cs(e?.signal); + if (typeof t != "function") + throw new jt(`Expected a function, got ${typeof t}`); + let a = 0, f; + for (; a < i; ) { + if (o.signal.aborted) + throw new jt(`Aborted after attempts ${a}`); + try { + return yield t({ signal: o.signal }); + } catch (u) { + f = u, a++, a < i && (yield M9(s)); + } + } + throw f; + }); +} +function En(...t) { + try { + console.debug("[TON_CONNECT_SDK]", ...t); + } catch { + } +} +function fo(...t) { + try { + console.error("[TON_CONNECT_SDK]", ...t); + } catch { + } +} +function Ate(...t) { + try { + console.warn("[TON_CONNECT_SDK]", ...t); + } catch { + } +} +function Pte(t, e) { + let r = null, n = null, i = null, s = null, o = null; + const a = (g, ...v) => At(this, void 0, void 0, function* () { + if (s = g ?? null, o?.abort(), o = cs(g), o.signal.aborted) + throw new jt("Resource creation was aborted"); + n = v ?? null; + const x = t(o.signal, ...v); + i = x; + const S = yield x; + if (i !== x && S !== r) + throw yield e(S), new jt("Resource creation was aborted by a new resource creation"); + return r = S, r; + }); + return { + create: a, + current: () => r ?? null, + dispose: () => At(this, void 0, void 0, function* () { + try { + const g = r; + r = null; + const v = i; + i = null; + try { + o?.abort(); + } catch { + } + yield Promise.allSettled([ + g ? e(g) : Promise.resolve(), + v ? e(yield v) : Promise.resolve() + ]); + } catch { + } + }), + recreate: (g) => At(this, void 0, void 0, function* () { + const v = r, x = i, S = n, C = s; + if (yield M9(g), v === r && x === i && S === n && C === s) + return yield a(s, ...S ?? []); + throw new jt("Resource recreation was aborted by a new resource creation"); + }) + }; +} +function Mte(t, e) { + const r = e?.timeout, n = e?.signal, i = cs(n); + return new Promise((s, o) => At(this, void 0, void 0, function* () { + if (i.signal.aborted) { + o(new jt("Operation aborted")); + return; + } + let a; + typeof r < "u" && (a = setTimeout(() => { + i.abort(), o(new jt(`Timeout after ${r}ms`)); + }, r)), i.signal.addEventListener("abort", () => { + clearTimeout(a), o(new jt("Operation aborted")); + }, { once: !0 }); + const f = { timeout: r, abort: i.signal }; + yield t((...u) => { + clearTimeout(a), s(...u); + }, () => { + clearTimeout(a), o(); + }, f); + })); +} +class Nm { + constructor(e, r, n, i, s) { + this.bridgeUrl = r, this.sessionId = n, this.listener = i, this.errorsListener = s, this.ssePath = "events", this.postPath = "message", this.heartbeatMessage = "heartbeat", this.defaultTtl = 300, this.defaultReconnectDelay = 2e3, this.defaultResendDelay = 5e3, this.eventSource = Pte((o, a) => At(this, void 0, void 0, function* () { + const f = { + bridgeUrl: this.bridgeUrl, + ssePath: this.ssePath, + sessionId: this.sessionId, + bridgeGatewayStorage: this.bridgeGatewayStorage, + errorHandler: this.errorsHandler.bind(this), + messageHandler: this.messagesHandler.bind(this), + signal: o, + openingDeadlineMS: a + }; + return yield Ite(f); + }), (o) => At(this, void 0, void 0, function* () { + o.close(); + })), this.bridgeGatewayStorage = new xte(e, r); + } + get isReady() { + const e = this.eventSource.current(); + return e?.readyState === EventSource.OPEN; + } + get isClosed() { + const e = this.eventSource.current(); + return e?.readyState !== EventSource.OPEN; + } + get isConnecting() { + const e = this.eventSource.current(); + return e?.readyState === EventSource.CONNECTING; + } + registerSession(e) { + return At(this, void 0, void 0, function* () { + yield this.eventSource.create(e?.signal, e?.openingDeadlineMS); + }); + } + send(e, r, n, i) { + var s; + return At(this, void 0, void 0, function* () { + const o = {}; + typeof i == "number" ? o.ttl = i : (o.ttl = i?.ttl, o.signal = i?.signal, o.attempts = i?.attempts); + const a = new URL(P9(this.bridgeUrl, this.postPath)); + a.searchParams.append("client_id", this.sessionId), a.searchParams.append("to", r), a.searchParams.append("ttl", (o?.ttl || this.defaultTtl).toString()), a.searchParams.append("topic", n); + const f = A9.encode(e); + yield ff((u) => At(this, void 0, void 0, function* () { + const h = yield this.post(a, f, u.signal); + if (!h.ok) + throw new jt(`Bridge send failed, status ${h.status}`); + }), { + attempts: (s = o?.attempts) !== null && s !== void 0 ? s : Number.MAX_SAFE_INTEGER, + delayMs: this.defaultResendDelay, + signal: o?.signal + }); + }); + } + pause() { + this.eventSource.dispose().catch((e) => fo(`Bridge pause failed, ${e}`)); + } + unPause() { + return At(this, void 0, void 0, function* () { + yield this.eventSource.recreate(0); + }); + } + close() { + return At(this, void 0, void 0, function* () { + yield this.eventSource.dispose().catch((e) => fo(`Bridge close failed, ${e}`)); + }); + } + setListener(e) { + this.listener = e; + } + setErrorsListener(e) { + this.errorsListener = e; + } + post(e, r, n) { + return At(this, void 0, void 0, function* () { + const i = yield fetch(e, { + method: "post", + body: r, + signal: n + }); + if (!i.ok) + throw new jt(`Bridge send failed, status ${i.status}`); + return i; + }); + } + errorsHandler(e, r) { + return At(this, void 0, void 0, function* () { + if (this.isConnecting) + throw e.close(), new jt("Bridge error, failed to connect"); + if (this.isReady) { + try { + this.errorsListener(r); + } catch { + } + return; + } + if (this.isClosed) + return e.close(), En(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`), yield this.eventSource.recreate(this.defaultReconnectDelay); + throw new jt("Bridge error, unknown state"); + }); + } + messagesHandler(e) { + return At(this, void 0, void 0, function* () { + if (e.data === this.heartbeatMessage || (yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId), this.isClosed)) + return; + let r; + try { + r = JSON.parse(e.data); + } catch (n) { + throw new jt(`Bridge message parse failed, message ${n.data}`); + } + this.listener(r); + }); + } +} +function Ite(t) { + return At(this, void 0, void 0, function* () { + return yield Mte((e, r, n) => At(this, void 0, void 0, function* () { + var i; + const o = cs(n.signal).signal; + if (o.aborted) { + r(new jt("Bridge connection aborted")); + return; + } + const a = new URL(P9(t.bridgeUrl, t.ssePath)); + a.searchParams.append("client_id", t.sessionId); + const f = yield t.bridgeGatewayStorage.getLastEventId(); + if (f && a.searchParams.append("last_event_id", f), o.aborted) { + r(new jt("Bridge connection aborted")); + return; + } + const u = new EventSource(a.toString()); + u.onerror = (h) => At(this, void 0, void 0, function* () { + if (o.aborted) { + u.close(), r(new jt("Bridge connection aborted")); + return; + } + try { + const g = yield t.errorHandler(u, h); + g !== u && u.close(), g && g !== u && e(g); + } catch (g) { + u.close(), r(g); + } + }), u.onopen = () => { + if (o.aborted) { + u.close(), r(new jt("Bridge connection aborted")); + return; + } + e(u); + }, u.onmessage = (h) => { + if (o.aborted) { + u.close(), r(new jt("Bridge connection aborted")); + return; + } + t.messageHandler(h); + }, (i = t.signal) === null || i === void 0 || i.addEventListener("abort", () => { + u.close(), r(new jt("Bridge connection aborted")); + }); + }), { timeout: t.openingDeadlineMS, signal: t.signal }); + }); +} +function lf(t) { + return !("connectEvent" in t); +} +class Wf { + constructor(e) { + this.storage = e, this.storeKey = "ton-connect-storage_bridge-connection"; + } + storeConnection(e) { + return At(this, void 0, void 0, function* () { + if (e.type === "injected") + return this.storage.setItem(this.storeKey, JSON.stringify(e)); + if (!lf(e)) { + const n = { + sessionKeyPair: e.session.sessionCrypto.stringifyKeypair(), + walletPublicKey: e.session.walletPublicKey, + bridgeUrl: e.session.bridgeUrl + }, i = { + type: "http", + connectEvent: e.connectEvent, + session: n, + lastWalletEventId: e.lastWalletEventId, + nextRpcRequestId: e.nextRpcRequestId + }; + return this.storage.setItem(this.storeKey, JSON.stringify(i)); + } + const r = { + type: "http", + connectionSource: e.connectionSource, + sessionCrypto: e.sessionCrypto.stringifyKeypair() + }; + return this.storage.setItem(this.storeKey, JSON.stringify(r)); + }); + } + removeConnection() { + return At(this, void 0, void 0, function* () { + return this.storage.removeItem(this.storeKey); + }); + } + getConnection() { + return At(this, void 0, void 0, function* () { + const e = yield this.storage.getItem(this.storeKey); + if (!e) + return null; + const r = JSON.parse(e); + if (r.type === "injected") + return r; + if ("connectEvent" in r) { + const n = new zv(r.session.sessionKeyPair); + return { + type: "http", + connectEvent: r.connectEvent, + lastWalletEventId: r.lastWalletEventId, + nextRpcRequestId: r.nextRpcRequestId, + session: { + sessionCrypto: n, + bridgeUrl: r.session.bridgeUrl, + walletPublicKey: r.session.walletPublicKey + } + }; + } + return { + type: "http", + sessionCrypto: new zv(r.sessionCrypto), + connectionSource: r.connectionSource + }; + }); + } + getHttpConnection() { + return At(this, void 0, void 0, function* () { + const e = yield this.getConnection(); + if (!e) + throw new jt("Trying to read HTTP connection source while nothing is stored"); + if (e.type === "injected") + throw new jt("Trying to read HTTP connection source while injected connection is stored"); + return e; + }); + } + getHttpPendingConnection() { + return At(this, void 0, void 0, function* () { + const e = yield this.getConnection(); + if (!e) + throw new jt("Trying to read HTTP connection source while nothing is stored"); + if (e.type === "injected") + throw new jt("Trying to read HTTP connection source while injected connection is stored"); + if (!lf(e)) + throw new jt("Trying to read HTTP-pending connection while http connection is stored"); + return e; + }); + } + getInjectedConnection() { + return At(this, void 0, void 0, function* () { + const e = yield this.getConnection(); + if (!e) + throw new jt("Trying to read Injected bridge connection source while nothing is stored"); + if (e?.type === "http") + throw new jt("Trying to read Injected bridge connection source while HTTP connection is stored"); + return e; + }); + } + storedConnectionType() { + return At(this, void 0, void 0, function* () { + const e = yield this.storage.getItem(this.storeKey); + return e ? JSON.parse(e).type : null; + }); + } + storeLastWalletEventId(e) { + return At(this, void 0, void 0, function* () { + const r = yield this.getConnection(); + if (r && r.type === "http" && !lf(r)) + return r.lastWalletEventId = e, this.storeConnection(r); + }); + } + getLastWalletEventId() { + return At(this, void 0, void 0, function* () { + const e = yield this.getConnection(); + if (e && "lastWalletEventId" in e) + return e.lastWalletEventId; + }); + } + increaseNextRpcRequestId() { + return At(this, void 0, void 0, function* () { + const e = yield this.getConnection(); + if (e && "nextRpcRequestId" in e) { + const r = e.nextRpcRequestId || 0; + return e.nextRpcRequestId = r + 1, this.storeConnection(e); + } + }); + } + getNextRpcRequestId() { + return At(this, void 0, void 0, function* () { + const e = yield this.getConnection(); + return e && "nextRpcRequestId" in e && e.nextRpcRequestId || 0; + }); + } +} +const I9 = 2; +class Kf { + constructor(e, r) { + this.storage = e, this.walletConnectionSource = r, this.type = "http", this.standardUniversalLink = "tc://", this.pendingRequests = /* @__PURE__ */ new Map(), this.session = null, this.gateway = null, this.pendingGateways = [], this.listeners = [], this.defaultOpeningDeadlineMS = 12e3, this.defaultRetryTimeoutMS = 2e3, this.connectionStorage = new Wf(e); + } + static fromStorage(e) { + return At(this, void 0, void 0, function* () { + const n = yield new Wf(e).getHttpConnection(); + return lf(n) ? new Kf(e, n.connectionSource) : new Kf(e, { bridgeUrl: n.session.bridgeUrl }); + }); + } + connect(e, r) { + var n; + const i = cs(r?.signal); + (n = this.abortController) === null || n === void 0 || n.abort(), this.abortController = i, this.closeGateways(); + const s = new zv(); + this.session = { + sessionCrypto: s, + bridgeUrl: "bridgeUrl" in this.walletConnectionSource ? this.walletConnectionSource.bridgeUrl : "" + }, this.connectionStorage.storeConnection({ + type: "http", + connectionSource: this.walletConnectionSource, + sessionCrypto: s + }).then(() => At(this, void 0, void 0, function* () { + i.signal.aborted || (yield ff((a) => { + var f; + return this.openGateways(s, { + openingDeadlineMS: (f = r?.openingDeadlineMS) !== null && f !== void 0 ? f : this.defaultOpeningDeadlineMS, + signal: a?.signal + }); + }, { + attempts: Number.MAX_SAFE_INTEGER, + delayMs: this.defaultRetryTimeoutMS, + signal: i.signal + })); + })); + const o = "universalLink" in this.walletConnectionSource && this.walletConnectionSource.universalLink ? this.walletConnectionSource.universalLink : this.standardUniversalLink; + return this.generateUniversalLink(o, e); + } + restoreConnection(e) { + var r, n; + return At(this, void 0, void 0, function* () { + const i = cs(e?.signal); + if ((r = this.abortController) === null || r === void 0 || r.abort(), this.abortController = i, i.signal.aborted) + return; + this.closeGateways(); + const s = yield this.connectionStorage.getHttpConnection(); + if (!s || i.signal.aborted) + return; + const o = (n = e?.openingDeadlineMS) !== null && n !== void 0 ? n : this.defaultOpeningDeadlineMS; + if (lf(s)) + return this.session = { + sessionCrypto: s.sessionCrypto, + bridgeUrl: "bridgeUrl" in this.walletConnectionSource ? this.walletConnectionSource.bridgeUrl : "" + }, yield this.openGateways(s.sessionCrypto, { + openingDeadlineMS: o, + signal: i?.signal + }); + if (Array.isArray(this.walletConnectionSource)) + throw new jt("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected."); + if (this.session = s.session, this.gateway && (En("Gateway is already opened, closing previous gateway"), yield this.gateway.close()), this.gateway = new Nm(this.storage, this.walletConnectionSource.bridgeUrl, s.session.sessionCrypto.sessionId, this.gatewayListener.bind(this), this.gatewayErrorsListener.bind(this)), !i.signal.aborted) { + this.listeners.forEach((a) => a(s.connectEvent)); + try { + yield ff((a) => this.gateway.registerSession({ + openingDeadlineMS: o, + signal: a.signal + }), { + attempts: Number.MAX_SAFE_INTEGER, + delayMs: this.defaultRetryTimeoutMS, + signal: i.signal + }); + } catch { + yield this.disconnect({ signal: i.signal }); + return; + } + } + }); + } + sendRequest(e, r) { + const n = {}; + return typeof r == "function" ? n.onRequestSent = r : (n.onRequestSent = r?.onRequestSent, n.signal = r?.signal, n.attempts = r?.attempts), new Promise((i, s) => At(this, void 0, void 0, function* () { + var o; + if (!this.gateway || !this.session || !("walletPublicKey" in this.session)) + throw new jt("Trying to send bridge request without session"); + const a = (yield this.connectionStorage.getNextRpcRequestId()).toString(); + yield this.connectionStorage.increaseNextRpcRequestId(), En("Send http-bridge request:", Object.assign(Object.assign({}, e), { id: a })); + const f = this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({}, e), { id: a })), kd(this.session.walletPublicKey)); + try { + yield this.gateway.send(f, this.session.walletPublicKey, e.method, { attempts: n?.attempts, signal: n?.signal }), (o = n?.onRequestSent) === null || o === void 0 || o.call(n), this.pendingRequests.set(a.toString(), i); + } catch (u) { + s(u); + } + })); + } + closeConnection() { + this.closeGateways(), this.listeners = [], this.session = null, this.gateway = null; + } + disconnect(e) { + return At(this, void 0, void 0, function* () { + return new Promise((r) => At(this, void 0, void 0, function* () { + let n = !1, i = null; + const s = () => { + n || (n = !0, this.removeBridgeAndSession().then(r)); + }; + try { + this.closeGateways(); + const o = cs(e?.signal); + i = setTimeout(() => { + o.abort(); + }, this.defaultOpeningDeadlineMS), yield this.sendRequest({ method: "disconnect", params: [] }, { + onRequestSent: s, + signal: o.signal, + attempts: 1 + }); + } catch (o) { + En("Disconnect error:", o), n || this.removeBridgeAndSession().then(r); + } finally { + i && clearTimeout(i), s(); + } + })); + }); + } + listen(e) { + return this.listeners.push(e), () => this.listeners = this.listeners.filter((r) => r !== e); + } + pause() { + var e; + (e = this.gateway) === null || e === void 0 || e.pause(), this.pendingGateways.forEach((r) => r.pause()); + } + unPause() { + return At(this, void 0, void 0, function* () { + const e = this.pendingGateways.map((r) => r.unPause()); + this.gateway && e.push(this.gateway.unPause()), yield Promise.all(e); + }); + } + pendingGatewaysListener(e, r, n) { + return At(this, void 0, void 0, function* () { + if (!this.pendingGateways.includes(e)) { + yield e.close(); + return; + } + return this.closeGateways({ except: e }), this.gateway && (En("Gateway is already opened, closing previous gateway"), yield this.gateway.close()), this.session.bridgeUrl = r, this.gateway = e, this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)), this.gateway.setListener(this.gatewayListener.bind(this)), this.gatewayListener(n); + }); + } + gatewayListener(e) { + return At(this, void 0, void 0, function* () { + const r = JSON.parse(this.session.sessionCrypto.decrypt(A9.decode(e.message).toUint8Array(), kd(e.from))); + if (En("Wallet message received:", r), !("event" in r)) { + const i = r.id.toString(), s = this.pendingRequests.get(i); + if (!s) { + En(`Response id ${i} doesn't match any request's id`); + return; + } + s(r), this.pendingRequests.delete(i); + return; + } + if (r.id !== void 0) { + const i = yield this.connectionStorage.getLastWalletEventId(); + if (i !== void 0 && r.id <= i) { + fo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `); + return; + } + r.event !== "connect" && (yield this.connectionStorage.storeLastWalletEventId(r.id)); + } + const n = this.listeners; + r.event === "connect" && (yield this.updateSession(r, e.from)), r.event === "disconnect" && (En("Removing bridge and session: received disconnect event"), yield this.removeBridgeAndSession()), n.forEach((i) => i(r)); + }); + } + gatewayErrorsListener(e) { + return At(this, void 0, void 0, function* () { + throw new jt(`Bridge error ${JSON.stringify(e)}`); + }); + } + updateSession(e, r) { + return At(this, void 0, void 0, function* () { + this.session = Object.assign(Object.assign({}, this.session), { walletPublicKey: r }); + const n = e.payload.items.find((s) => s.name === "ton_addr"), i = Object.assign(Object.assign({}, e), { payload: Object.assign(Object.assign({}, e.payload), { items: [n] }) }); + yield this.connectionStorage.storeConnection({ + type: "http", + session: this.session, + lastWalletEventId: e.id, + connectEvent: i, + nextRpcRequestId: 0 + }); + }); + } + removeBridgeAndSession() { + return At(this, void 0, void 0, function* () { + this.closeConnection(), yield this.connectionStorage.removeConnection(); + }); + } + generateUniversalLink(e, r) { + return Ete(e) ? this.generateTGUniversalLink(e, r) : this.generateRegularUniversalLink(e, r); + } + generateRegularUniversalLink(e, r) { + const n = new URL(e); + return n.searchParams.append("v", I9.toString()), n.searchParams.append("id", this.session.sessionCrypto.sessionId), n.searchParams.append("r", JSON.stringify(r)), n.toString(); + } + generateTGUniversalLink(e, r) { + const i = this.generateRegularUniversalLink("about:blank", r).split("?")[1], s = "tonconnect-" + Ste(i), o = this.convertToDirectLink(e), a = new URL(o); + return a.searchParams.append("startapp", s), a.toString(); + } + // TODO: Remove this method after all dApps and the wallets-list.json have been updated + convertToDirectLink(e) { + const r = new URL(e); + return r.searchParams.has("attach") && (r.searchParams.delete("attach"), r.pathname += "/start"), r.toString(); + } + openGateways(e, r) { + return At(this, void 0, void 0, function* () { + if (Array.isArray(this.walletConnectionSource)) { + this.pendingGateways.map((n) => n.close().catch()), this.pendingGateways = this.walletConnectionSource.map((n) => { + const i = new Nm(this.storage, n.bridgeUrl, e.sessionId, () => { + }, () => { + }); + return i.setListener((s) => this.pendingGatewaysListener(i, n.bridgeUrl, s)), i; + }), yield Promise.allSettled(this.pendingGateways.map((n) => ff((i) => { + var s; + return this.pendingGateways.some((o) => o === n) ? n.registerSession({ + openingDeadlineMS: (s = r?.openingDeadlineMS) !== null && s !== void 0 ? s : this.defaultOpeningDeadlineMS, + signal: i.signal + }) : n.close(); + }, { + attempts: Number.MAX_SAFE_INTEGER, + delayMs: this.defaultRetryTimeoutMS, + signal: r?.signal + }))); + return; + } else + return this.gateway && (En("Gateway is already opened, closing previous gateway"), yield this.gateway.close()), this.gateway = new Nm(this.storage, this.walletConnectionSource.bridgeUrl, e.sessionId, this.gatewayListener.bind(this), this.gatewayErrorsListener.bind(this)), yield this.gateway.registerSession({ + openingDeadlineMS: r?.openingDeadlineMS, + signal: r?.signal + }); + }); + } + closeGateways(e) { + var r; + (r = this.gateway) === null || r === void 0 || r.close(), this.pendingGateways.filter((n) => n !== e?.except).forEach((n) => n.close()), this.pendingGateways = []; + } +} +function z5(t, e) { + return C9(t, [e]); +} +function C9(t, e) { + return !t || typeof t != "object" ? !1 : e.every((r) => r in t); +} +function Cte(t) { + try { + return !z5(t, "tonconnect") || !z5(t.tonconnect, "walletInfo") ? !1 : C9(t.tonconnect.walletInfo, [ + "name", + "app_name", + "image", + "about_url", + "platforms" + ]); + } catch { + return !1; + } +} +class Ic { + constructor() { + this.storage = {}; + } + static getInstance() { + return Ic.instance || (Ic.instance = new Ic()), Ic.instance; + } + get length() { + return Object.keys(this.storage).length; + } + clear() { + this.storage = {}; + } + getItem(e) { + var r; + return (r = this.storage[e]) !== null && r !== void 0 ? r : null; + } + key(e) { + var r; + const n = Object.keys(this.storage); + return e < 0 || e >= n.length ? null : (r = n[e]) !== null && r !== void 0 ? r : null; + } + removeItem(e) { + delete this.storage[e]; + } + setItem(e, r) { + this.storage[e] = r; + } +} +function C0() { + if (!(typeof window > "u")) + return window; +} +function Rte() { + const t = C0(); + if (!t) + return []; + try { + return Object.keys(t); + } catch { + return []; + } +} +function Tte() { + if (!(typeof document > "u")) + return document; +} +function Dte() { + var t; + const e = (t = C0()) === null || t === void 0 ? void 0 : t.location.origin; + return e ? e + "/tonconnect-manifest.json" : ""; +} +function Ote() { + if (Nte()) + return localStorage; + if (Lte()) + throw new jt("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector"); + return Ic.getInstance(); +} +function Nte() { + try { + return typeof localStorage < "u"; + } catch { + return !1; + } +} +function Lte() { + return typeof process < "u" && process.versions != null && process.versions.node != null; +} +class fi { + constructor(e, r) { + this.injectedWalletKey = r, this.type = "injected", this.unsubscribeCallback = null, this.listenSubscriptions = !1, this.listeners = []; + const n = fi.window; + if (!fi.isWindowContainsWallet(n, r)) + throw new Cb(); + this.connectionStorage = new Wf(e), this.injectedWallet = n[r].tonconnect; + } + static fromStorage(e) { + return At(this, void 0, void 0, function* () { + const n = yield new Wf(e).getInjectedConnection(); + return new fi(e, n.jsBridgeKey); + }); + } + static isWalletInjected(e) { + return fi.isWindowContainsWallet(this.window, e); + } + static isInsideWalletBrowser(e) { + return fi.isWindowContainsWallet(this.window, e) ? this.window[e].tonconnect.isWalletBrowser : !1; + } + static getCurrentlyInjectedWallets() { + return this.window ? Rte().filter(([n, i]) => Cte(i)).map(([n, i]) => ({ + name: i.tonconnect.walletInfo.name, + appName: i.tonconnect.walletInfo.app_name, + aboutUrl: i.tonconnect.walletInfo.about_url, + imageUrl: i.tonconnect.walletInfo.image, + tondns: i.tonconnect.walletInfo.tondns, + jsBridgeKey: n, + injected: !0, + embedded: i.tonconnect.isWalletBrowser, + platforms: i.tonconnect.walletInfo.platforms + })) : []; + } + static isWindowContainsWallet(e, r) { + return !!e && r in e && typeof e[r] == "object" && "tonconnect" in e[r]; + } + connect(e) { + this._connect(I9, e); + } + restoreConnection() { + return At(this, void 0, void 0, function* () { + try { + En("Injected Provider restoring connection..."); + const e = yield this.injectedWallet.restoreConnection(); + En("Injected Provider restoring connection response", e), e.event === "connect" ? (this.makeSubscriptions(), this.listeners.forEach((r) => r(e))) : yield this.connectionStorage.removeConnection(); + } catch (e) { + yield this.connectionStorage.removeConnection(), console.error(e); + } + }); + } + closeConnection() { + this.listenSubscriptions && this.injectedWallet.disconnect(), this.closeAllListeners(); + } + disconnect() { + return At(this, void 0, void 0, function* () { + return new Promise((e) => { + const r = () => { + this.closeAllListeners(), this.connectionStorage.removeConnection().then(e); + }; + try { + this.injectedWallet.disconnect(), r(); + } catch (n) { + En(n), this.sendRequest({ + method: "disconnect", + params: [] + }, r); + } + }); + }); + } + closeAllListeners() { + var e; + this.listenSubscriptions = !1, this.listeners = [], (e = this.unsubscribeCallback) === null || e === void 0 || e.call(this); + } + listen(e) { + return this.listeners.push(e), () => this.listeners = this.listeners.filter((r) => r !== e); + } + sendRequest(e, r) { + var n; + return At(this, void 0, void 0, function* () { + const i = {}; + typeof r == "function" ? i.onRequestSent = r : (i.onRequestSent = r?.onRequestSent, i.signal = r?.signal); + const s = (yield this.connectionStorage.getNextRpcRequestId()).toString(); + yield this.connectionStorage.increaseNextRpcRequestId(), En("Send injected-bridge request:", Object.assign(Object.assign({}, e), { id: s })); + const o = this.injectedWallet.send(Object.assign(Object.assign({}, e), { id: s })); + return o.then((a) => En("Wallet message received:", a)), (n = i?.onRequestSent) === null || n === void 0 || n.call(i), o; + }); + } + _connect(e, r) { + return At(this, void 0, void 0, function* () { + try { + En(`Injected Provider connect request: protocolVersion: ${e}, message:`, r); + const n = yield this.injectedWallet.connect(e, r); + En("Injected Provider connect response:", n), n.event === "connect" && (yield this.updateSession(), this.makeSubscriptions()), this.listeners.forEach((i) => i(n)); + } catch (n) { + En("Injected Provider connect error:", n); + const i = { + event: "connect_error", + payload: { + code: 0, + message: n?.toString() + } + }; + this.listeners.forEach((s) => s(i)); + } + }); + } + makeSubscriptions() { + this.listenSubscriptions = !0, this.unsubscribeCallback = this.injectedWallet.listen((e) => { + En("Wallet message received:", e), this.listenSubscriptions && this.listeners.forEach((r) => r(e)), e.event === "disconnect" && this.disconnect(); + }); + } + updateSession() { + return this.connectionStorage.storeConnection({ + type: "injected", + jsBridgeKey: this.injectedWalletKey, + nextRpcRequestId: 0 + }); + } +} +fi.window = C0(); +class kte { + constructor() { + this.localStorage = Ote(); + } + getItem(e) { + return At(this, void 0, void 0, function* () { + return this.localStorage.getItem(e); + }); + } + removeItem(e) { + return At(this, void 0, void 0, function* () { + this.localStorage.removeItem(e); + }); + } + setItem(e, r) { + return At(this, void 0, void 0, function* () { + this.localStorage.setItem(e, r); + }); + } +} +function R9(t) { + return Bte(t) && t.injected; +} +function $te(t) { + return R9(t) && t.embedded; +} +function Bte(t) { + return "jsBridgeKey" in t; +} +const Fte = [ + { + app_name: "telegram-wallet", + name: "Wallet", + image: "https://wallet.tg/images/logo-288.png", + about_url: "https://wallet.tg/", + universal_url: "https://t.me/wallet?attach=wallet", + bridge: [ + { + type: "sse", + url: "https://bridge.ton.space/bridge" + } + ], + platforms: ["ios", "android", "macos", "windows", "linux"] + }, + { + app_name: "tonkeeper", + name: "Tonkeeper", + image: "https://tonkeeper.com/assets/tonconnect-icon.png", + tondns: "tonkeeper.ton", + about_url: "https://tonkeeper.com", + universal_url: "https://app.tonkeeper.com/ton-connect", + deepLink: "tonkeeper-tc://", + bridge: [ + { + type: "sse", + url: "https://bridge.tonapi.io/bridge" + }, + { + type: "js", + key: "tonkeeper" + } + ], + platforms: ["ios", "android", "chrome", "firefox", "macos"] + }, + { + app_name: "mytonwallet", + name: "MyTonWallet", + image: "https://static.mytonwallet.io/icon-256.png", + about_url: "https://mytonwallet.io", + universal_url: "https://connect.mytonwallet.org", + bridge: [ + { + type: "js", + key: "mytonwallet" + }, + { + type: "sse", + url: "https://tonconnectbridge.mytonwallet.org/bridge/" + } + ], + platforms: ["chrome", "windows", "macos", "linux", "ios", "android", "firefox"] + }, + { + app_name: "openmask", + name: "OpenMask", + image: "https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png", + about_url: "https://www.openmask.app/", + bridge: [ + { + type: "js", + key: "openmask" + } + ], + platforms: ["chrome"] + }, + { + app_name: "tonhub", + name: "Tonhub", + image: "https://tonhub.com/tonconnect_logo.png", + about_url: "https://tonhub.com", + universal_url: "https://tonhub.com/ton-connect", + bridge: [ + { + type: "js", + key: "tonhub" + }, + { + type: "sse", + url: "https://connect.tonhubapi.com/tonconnect" + } + ], + platforms: ["ios", "android"] + }, + { + app_name: "dewallet", + name: "DeWallet", + image: "https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png", + about_url: "https://delabwallet.com", + universal_url: "https://t.me/dewallet?attach=wallet", + bridge: [ + { + type: "sse", + url: "https://sse-bridge.delab.team/bridge" + } + ], + platforms: ["ios", "android"] + }, + { + app_name: "xtonwallet", + name: "XTONWallet", + image: "https://xtonwallet.com/assets/img/icon-256-back.png", + about_url: "https://xtonwallet.com", + bridge: [ + { + type: "js", + key: "xtonwallet" + } + ], + platforms: ["chrome", "firefox"] + }, + { + app_name: "tonwallet", + name: "TON Wallet", + image: "https://wallet.ton.org/assets/ui/qr-logo.png", + about_url: "https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd", + bridge: [ + { + type: "js", + key: "tonwallet" + } + ], + platforms: ["chrome"] + }, + { + app_name: "bitgetTonWallet", + name: "Bitget Wallet", + image: "https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png", + about_url: "https://web3.bitget.com", + deepLink: "bitkeep://", + bridge: [ + { + type: "js", + key: "bitgetTonWallet" + }, + { + type: "sse", + url: "https://bridge.tonapi.io/bridge" + } + ], + platforms: ["ios", "android", "chrome"], + universal_url: "https://bkcode.vip/ton-connect" + }, + { + app_name: "safepalwallet", + name: "SafePal", + image: "https://s.pvcliping.com/web/public_image/SafePal_x288.png", + tondns: "", + about_url: "https://www.safepal.com", + universal_url: "https://link.safepal.io/ton-connect", + deepLink: "safepal-tc://", + bridge: [ + { + type: "sse", + url: "https://ton-bridge.safepal.com/tonbridge/v1/bridge" + }, + { + type: "js", + key: "safepalwallet" + } + ], + platforms: ["ios", "android", "chrome", "firefox"] + }, + { + app_name: "okxTonWallet", + name: "OKX Wallet", + image: "https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png", + about_url: "https://www.okx.com/web3", + universal_url: "https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect", + bridge: [ + { + type: "js", + key: "okxTonWallet" + }, + { + type: "sse", + url: "https://www.okx.com/tonbridge/discover/rpc/bridge" + } + ], + platforms: ["chrome", "safari", "firefox", "ios", "android"] + }, + { + app_name: "okxTonWalletTr", + name: "OKX TR Wallet", + image: "https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png", + about_url: "https://tr.okx.com/web3", + universal_url: "https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect", + bridge: [ + { + type: "js", + key: "okxTonWallet" + }, + { + type: "sse", + url: "https://www.okx.com/tonbridge/discover/rpc/bridge" + } + ], + platforms: ["chrome", "safari", "firefox", "ios", "android"] + } +]; +class Hv { + constructor(e) { + this.walletsListCache = null, this.walletsListCacheCreationTimestamp = null, this.walletsListSource = "https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json", e?.walletsListSource && (this.walletsListSource = e.walletsListSource), e?.cacheTTLMs && (this.cacheTTLMs = e.cacheTTLMs); + } + getWallets() { + return At(this, void 0, void 0, function* () { + return this.cacheTTLMs && this.walletsListCacheCreationTimestamp && Date.now() > this.walletsListCacheCreationTimestamp + this.cacheTTLMs && (this.walletsListCache = null), this.walletsListCache || (this.walletsListCache = this.fetchWalletsList(), this.walletsListCache.then(() => { + this.walletsListCacheCreationTimestamp = Date.now(); + }).catch(() => { + this.walletsListCache = null, this.walletsListCacheCreationTimestamp = null; + })), this.walletsListCache; + }); + } + getEmbeddedWallet() { + return At(this, void 0, void 0, function* () { + const r = (yield this.getWallets()).filter($te); + return r.length !== 1 ? null : r[0]; + }); + } + fetchWalletsList() { + return At(this, void 0, void 0, function* () { + let e = []; + try { + if (e = yield (yield fetch(this.walletsListSource)).json(), !Array.isArray(e)) + throw new Rb("Wrong wallets list format, wallets list must be an array."); + const i = e.filter((s) => !this.isCorrectWalletConfigDTO(s)); + i.length && (fo(`Wallet(s) ${i.map((s) => s.name).join(", ")} config format is wrong. They were removed from the wallets list.`), e = e.filter((s) => this.isCorrectWalletConfigDTO(s))); + } catch (n) { + fo(n), e = Fte; + } + let r = []; + try { + r = fi.getCurrentlyInjectedWallets(); + } catch (n) { + fo(n); + } + return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e), r); + }); + } + walletConfigDTOListToWalletConfigList(e) { + return e.map((r) => { + const i = { + name: r.name, + appName: r.app_name, + imageUrl: r.image, + aboutUrl: r.about_url, + tondns: r.tondns, + platforms: r.platforms + }; + return r.bridge.forEach((s) => { + if (s.type === "sse" && (i.bridgeUrl = s.url, i.universalLink = r.universal_url, i.deepLink = r.deepLink), s.type === "js") { + const o = s.key; + i.jsBridgeKey = o, i.injected = fi.isWalletInjected(o), i.embedded = fi.isInsideWalletBrowser(o); + } + }), i; + }); + } + mergeWalletsLists(e, r) { + return [...new Set(e.concat(r).map((i) => i.name)).values()].map((i) => { + const s = e.find((a) => a.name === i), o = r.find((a) => a.name === i); + return Object.assign(Object.assign({}, s && Object.assign({}, s)), o && Object.assign({}, o)); + }); + } + // eslint-disable-next-line complexity + isCorrectWalletConfigDTO(e) { + if (!e || typeof e != "object") + return !1; + const r = "name" in e, n = "app_name" in e, i = "image" in e, s = "about_url" in e, o = "platforms" in e; + if (!r || !i || !s || !o || !n || !e.platforms || !Array.isArray(e.platforms) || !e.platforms.length || !("bridge" in e) || !Array.isArray(e.bridge) || !e.bridge.length) + return !1; + const a = e.bridge; + if (a.some((h) => !h || typeof h != "object" || !("type" in h))) + return !1; + const f = a.find((h) => h.type === "sse"); + if (f && (!("url" in f) || !f.url || !e.universal_url)) + return !1; + const u = a.find((h) => h.type === "js"); + return !(u && (!("key" in u) || !u.key)); + } +} +class Bd extends jt { + get info() { + return "Wallet doesn't support requested feature method."; + } + constructor(...e) { + super(...e), Object.setPrototypeOf(this, Bd.prototype); + } +} +function jte(t, e) { + const r = t.includes("SendTransaction"), n = t.find((i) => i && typeof i == "object" && i.name === "SendTransaction"); + if (!r && !n) + throw new Bd("Wallet doesn't support SendTransaction feature."); + if (n && n.maxMessages !== void 0) { + if (n.maxMessages < e.requiredMessagesNumber) + throw new Bd(`Wallet is not able to handle such SendTransaction request. Max support messages number is ${n.maxMessages}, but ${e.requiredMessagesNumber} is required.`); + return; + } + Ate("Connected wallet didn't provide information about max allowed messages in the SendTransaction request. Request may be rejected by the wallet."); +} +function Ute() { + return { + type: "request-version" + }; +} +function qte(t) { + return { + type: "response-version", + version: t + }; +} +function ru(t) { + return { + ton_connect_sdk_lib: t.ton_connect_sdk_lib, + ton_connect_ui_lib: t.ton_connect_ui_lib + }; +} +function nu(t, e) { + var r, n, i, s, o, a, f, u; + const g = ((r = e?.connectItems) === null || r === void 0 ? void 0 : r.tonProof) && "proof" in e.connectItems.tonProof ? "ton_proof" : "ton_addr"; + return { + wallet_address: (i = (n = e?.account) === null || n === void 0 ? void 0 : n.address) !== null && i !== void 0 ? i : null, + wallet_type: (s = e?.device.appName) !== null && s !== void 0 ? s : null, + wallet_version: (o = e?.device.appVersion) !== null && o !== void 0 ? o : null, + auth_type: g, + custom_data: Object.assign({ chain_id: (f = (a = e?.account) === null || a === void 0 ? void 0 : a.chain) !== null && f !== void 0 ? f : null, provider: (u = e?.provider) !== null && u !== void 0 ? u : null }, ru(t)) + }; +} +function zte(t) { + return { + type: "connection-started", + custom_data: ru(t) + }; +} +function Hte(t, e) { + return Object.assign({ type: "connection-completed", is_success: !0 }, nu(t, e)); +} +function Wte(t, e, r) { + return { + type: "connection-error", + is_success: !1, + error_message: e, + error_code: r ?? null, + custom_data: ru(t) + }; +} +function Kte(t) { + return { + type: "connection-restoring-started", + custom_data: ru(t) + }; +} +function Vte(t, e) { + return Object.assign({ type: "connection-restoring-completed", is_success: !0 }, nu(t, e)); +} +function Gte(t, e) { + return { + type: "connection-restoring-error", + is_success: !1, + error_message: e, + custom_data: ru(t) + }; +} +function Tb(t, e) { + var r, n, i, s; + return { + valid_until: (r = String(e.validUntil)) !== null && r !== void 0 ? r : null, + from: (s = (n = e.from) !== null && n !== void 0 ? n : (i = t?.account) === null || i === void 0 ? void 0 : i.address) !== null && s !== void 0 ? s : null, + messages: e.messages.map((o) => { + var a, f; + return { + address: (a = o.address) !== null && a !== void 0 ? a : null, + amount: (f = o.amount) !== null && f !== void 0 ? f : null + }; + }) + }; +} +function Yte(t, e, r) { + return Object.assign(Object.assign({ type: "transaction-sent-for-signature" }, nu(t, e)), Tb(e, r)); +} +function Jte(t, e, r, n) { + return Object.assign(Object.assign({ type: "transaction-signed", is_success: !0, signed_transaction: n.boc }, nu(t, e)), Tb(e, r)); +} +function Xte(t, e, r, n, i) { + return Object.assign(Object.assign({ type: "transaction-signing-failed", is_success: !1, error_message: n, error_code: i ?? null }, nu(t, e)), Tb(e, r)); +} +function Zte(t, e, r) { + return Object.assign({ type: "disconnection", scope: r }, nu(t, e)); +} +class Qte { + constructor() { + this.window = C0(); + } + /** + * Dispatches an event with the given name and details to the browser window. + * @param eventName - The name of the event to dispatch. + * @param eventDetails - The details of the event to dispatch. + * @returns A promise that resolves when the event has been dispatched. + */ + dispatchEvent(e, r) { + var n; + return At(this, void 0, void 0, function* () { + const i = new CustomEvent(e, { detail: r }); + (n = this.window) === null || n === void 0 || n.dispatchEvent(i); + }); + } + /** + * Adds an event listener to the browser window. + * @param eventName - The name of the event to listen for. + * @param listener - The listener to add. + * @param options - The options for the listener. + * @returns A function that removes the listener. + */ + addEventListener(e, r, n) { + var i; + return At(this, void 0, void 0, function* () { + return (i = this.window) === null || i === void 0 || i.addEventListener(e, r, n), () => { + var s; + return (s = this.window) === null || s === void 0 ? void 0 : s.removeEventListener(e, r); + }; + }); + } +} +class ere { + constructor(e) { + var r; + this.eventPrefix = "ton-connect-", this.tonConnectUiVersion = null, this.eventDispatcher = (r = e?.eventDispatcher) !== null && r !== void 0 ? r : new Qte(), this.tonConnectSdkVersion = e.tonConnectSdkVersion, this.init().catch(); + } + /** + * Version of the library. + */ + get version() { + return ru({ + ton_connect_sdk_lib: this.tonConnectSdkVersion, + ton_connect_ui_lib: this.tonConnectUiVersion + }); + } + /** + * Called once when the tracker is created and request version other libraries. + */ + init() { + return At(this, void 0, void 0, function* () { + try { + yield this.setRequestVersionHandler(), this.tonConnectUiVersion = yield this.requestTonConnectUiVersion(); + } catch { + } + }); + } + /** + * Set request version handler. + * @private + */ + setRequestVersionHandler() { + return At(this, void 0, void 0, function* () { + yield this.eventDispatcher.addEventListener("ton-connect-request-version", () => At(this, void 0, void 0, function* () { + yield this.eventDispatcher.dispatchEvent("ton-connect-response-version", qte(this.tonConnectSdkVersion)); + })); + }); + } + /** + * Request TonConnect UI version. + * @private + */ + requestTonConnectUiVersion() { + return At(this, void 0, void 0, function* () { + return new Promise((e, r) => At(this, void 0, void 0, function* () { + try { + yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version", (n) => { + e(n.detail.version); + }, { once: !0 }), yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version", Ute()); + } catch (n) { + r(n); + } + })); + }); + } + /** + * Emit user action event to the window. + * @param eventDetails + * @private + */ + dispatchUserActionEvent(e) { + try { + this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`, e).catch(); + } catch { + } + } + /** + * Track connection init event. + * @param args + */ + trackConnectionStarted(...e) { + try { + const r = zte(this.version, ...e); + this.dispatchUserActionEvent(r); + } catch { + } + } + /** + * Track connection success event. + * @param args + */ + trackConnectionCompleted(...e) { + try { + const r = Hte(this.version, ...e); + this.dispatchUserActionEvent(r); + } catch { + } + } + /** + * Track connection error event. + * @param args + */ + trackConnectionError(...e) { + try { + const r = Wte(this.version, ...e); + this.dispatchUserActionEvent(r); + } catch { + } + } + /** + * Track connection restoring init event. + * @param args + */ + trackConnectionRestoringStarted(...e) { + try { + const r = Kte(this.version, ...e); + this.dispatchUserActionEvent(r); + } catch { + } + } + /** + * Track connection restoring success event. + * @param args + */ + trackConnectionRestoringCompleted(...e) { + try { + const r = Vte(this.version, ...e); + this.dispatchUserActionEvent(r); + } catch { + } + } + /** + * Track connection restoring error event. + * @param args + */ + trackConnectionRestoringError(...e) { + try { + const r = Gte(this.version, ...e); + this.dispatchUserActionEvent(r); + } catch { + } + } + /** + * Track disconnect event. + * @param args + */ + trackDisconnection(...e) { + try { + const r = Zte(this.version, ...e); + this.dispatchUserActionEvent(r); + } catch { + } + } + /** + * Track transaction init event. + * @param args + */ + trackTransactionSentForSignature(...e) { + try { + const r = Yte(this.version, ...e); + this.dispatchUserActionEvent(r); + } catch { + } + } + /** + * Track transaction signed event. + * @param args + */ + trackTransactionSigned(...e) { + try { + const r = Jte(this.version, ...e); + this.dispatchUserActionEvent(r); + } catch { + } + } + /** + * Track transaction error event. + * @param args + */ + trackTransactionSigningFailed(...e) { + try { + const r = Xte(this.version, ...e); + this.dispatchUserActionEvent(r); + } catch { + } + } +} +const tre = "3.0.5"; +class ml { + constructor(e) { + if (this.walletsList = new Hv(), this._wallet = null, this.provider = null, this.statusChangeSubscriptions = [], this.statusChangeErrorSubscriptions = [], this.dappSettings = { + manifestUrl: e?.manifestUrl || Dte(), + storage: e?.storage || new kte() + }, this.walletsList = new Hv({ + walletsListSource: e?.walletsListSource, + cacheTTLMs: e?.walletsListCacheTTLMs + }), this.tracker = new ere({ + eventDispatcher: e?.eventDispatcher, + tonConnectSdkVersion: tre + }), !this.dappSettings.manifestUrl) + throw new Mb("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"); + this.bridgeConnectionStorage = new Wf(this.dappSettings.storage), e?.disableAutoPauseConnection || this.addWindowFocusAndBlurSubscriptions(); + } + /** + * Returns available wallets list. + */ + static getWallets() { + return this.walletsList.getWallets(); + } + /** + * Shows if the wallet is connected right now. + */ + get connected() { + return this._wallet !== null; + } + /** + * Current connected account or null if no account is connected. + */ + get account() { + var e; + return ((e = this._wallet) === null || e === void 0 ? void 0 : e.account) || null; + } + /** + * Current connected wallet or null if no account is connected. + */ + get wallet() { + return this._wallet; + } + set wallet(e) { + this._wallet = e, this.statusChangeSubscriptions.forEach((r) => r(this._wallet)); + } + /** + * Returns available wallets list. + */ + getWallets() { + return this.walletsList.getWallets(); + } + /** + * Allows to subscribe to connection status changes and handle connection errors. + * @param callback will be called after connections status changes with actual wallet or null. + * @param errorsHandler (optional) will be called with some instance of TonConnectError when connect error is received. + * @returns unsubscribe callback. + */ + onStatusChange(e, r) { + return this.statusChangeSubscriptions.push(e), r && this.statusChangeErrorSubscriptions.push(r), () => { + this.statusChangeSubscriptions = this.statusChangeSubscriptions.filter((n) => n !== e), r && (this.statusChangeErrorSubscriptions = this.statusChangeErrorSubscriptions.filter((n) => n !== r)); + }; + } + connect(e, r) { + var n, i; + const s = {}; + if (typeof r == "object" && "tonProof" in r && (s.request = r), typeof r == "object" && ("openingDeadlineMS" in r || "signal" in r || "request" in r) && (s.request = r?.request, s.openingDeadlineMS = r?.openingDeadlineMS, s.signal = r?.signal), this.connected) + throw new Ib(); + const o = cs(s?.signal); + if ((n = this.abortController) === null || n === void 0 || n.abort(), this.abortController = o, o.signal.aborted) + throw new jt("Connection was aborted"); + return (i = this.provider) === null || i === void 0 || i.closeConnection(), this.provider = this.createProvider(e), o.signal.addEventListener("abort", () => { + var a; + (a = this.provider) === null || a === void 0 || a.closeConnection(), this.provider = null; + }), this.tracker.trackConnectionStarted(), this.provider.connect(this.createConnectRequest(s?.request), { + openingDeadlineMS: s?.openingDeadlineMS, + signal: o.signal + }); + } + /** + * Try to restore existing session and reconnect to the corresponding wallet. Call it immediately when your app is loaded. + */ + restoreConnection(e) { + var r, n; + return At(this, void 0, void 0, function* () { + this.tracker.trackConnectionRestoringStarted(); + const i = cs(e?.signal); + if ((r = this.abortController) === null || r === void 0 || r.abort(), this.abortController = i, i.signal.aborted) { + this.tracker.trackConnectionRestoringError("Connection restoring was aborted"); + return; + } + const [s, o] = yield Promise.all([ + this.bridgeConnectionStorage.storedConnectionType(), + this.walletsList.getEmbeddedWallet() + ]); + if (i.signal.aborted) { + this.tracker.trackConnectionRestoringError("Connection restoring was aborted"); + return; + } + let a = null; + try { + switch (s) { + case "http": + a = yield Kf.fromStorage(this.dappSettings.storage); + break; + case "injected": + a = yield fi.fromStorage(this.dappSettings.storage); + break; + default: + if (o) + a = this.createProvider(o); + else + return; + } + } catch { + this.tracker.trackConnectionRestoringError("Provider is not restored"), yield this.bridgeConnectionStorage.removeConnection(), a?.closeConnection(), a = null; + return; + } + if (i.signal.aborted) { + a?.closeConnection(), this.tracker.trackConnectionRestoringError("Connection restoring was aborted"); + return; + } + if (!a) { + fo("Provider is not restored"), this.tracker.trackConnectionRestoringError("Provider is not restored"); + return; + } + (n = this.provider) === null || n === void 0 || n.closeConnection(), this.provider = a, a.listen(this.walletEventsListener.bind(this)); + const f = () => { + this.tracker.trackConnectionRestoringError("Connection restoring was aborted"), a?.closeConnection(), a = null; + }; + i.signal.addEventListener("abort", f); + const u = ff((g) => At(this, void 0, void 0, function* () { + yield a?.restoreConnection({ + openingDeadlineMS: e?.openingDeadlineMS, + signal: g.signal + }), i.signal.removeEventListener("abort", f), this.connected ? this.tracker.trackConnectionRestoringCompleted(this.wallet) : this.tracker.trackConnectionRestoringError("Connection restoring failed"); + }), { + attempts: Number.MAX_SAFE_INTEGER, + delayMs: 2e3, + signal: e?.signal + }), h = new Promise( + (g) => setTimeout(() => g(), 12e3) + // connection deadline + ); + return Promise.race([u, h]); + }); + } + sendTransaction(e, r) { + return At(this, void 0, void 0, function* () { + const n = {}; + typeof r == "function" ? n.onRequestSent = r : (n.onRequestSent = r?.onRequestSent, n.signal = r?.signal); + const i = cs(n?.signal); + if (i.signal.aborted) + throw new jt("Transaction sending was aborted"); + this.checkConnection(), jte(this.wallet.device.features, { + requiredMessagesNumber: e.messages.length + }), this.tracker.trackTransactionSentForSignature(this.wallet, e); + const { validUntil: s } = e, o = gte(e, ["validUntil"]), a = e.from || this.account.address, f = e.network || this.account.chain, u = yield this.provider.sendRequest(Oh.convertToRpcRequest(Object.assign(Object.assign({}, o), { + valid_until: s, + from: a, + network: f + })), { onRequestSent: n.onRequestSent, signal: i.signal }); + if (Oh.isError(u)) + return this.tracker.trackTransactionSigningFailed(this.wallet, e, u.error.message, u.error.code), Oh.parseAndThrowError(u); + const h = Oh.convertFromRpcResponse(u); + return this.tracker.trackTransactionSigned(this.wallet, e, h), h; + }); + } + /** + * Disconnect form thw connected wallet and drop current session. + */ + disconnect(e) { + var r; + return At(this, void 0, void 0, function* () { + if (!this.connected) + throw new $d(); + const n = cs(e?.signal), i = this.abortController; + if (this.abortController = n, n.signal.aborted) + throw new jt("Disconnect was aborted"); + this.onWalletDisconnected("dapp"), yield (r = this.provider) === null || r === void 0 ? void 0 : r.disconnect({ + signal: n.signal + }), i?.abort(); + }); + } + /** + * Pause bridge HTTP connection. Might be helpful, if you want to pause connections while browser tab is unfocused, + * or if you use SDK with NodeJS and want to save server resources. + */ + pauseConnection() { + var e; + ((e = this.provider) === null || e === void 0 ? void 0 : e.type) === "http" && this.provider.pause(); + } + /** + * Unpause bridge HTTP connection if it is paused. + */ + unPauseConnection() { + var e; + return ((e = this.provider) === null || e === void 0 ? void 0 : e.type) !== "http" ? Promise.resolve() : this.provider.unPause(); + } + addWindowFocusAndBlurSubscriptions() { + const e = Tte(); + if (e) + try { + e.addEventListener("visibilitychange", () => { + e.hidden ? this.pauseConnection() : this.unPauseConnection().catch(); + }); + } catch (r) { + fo("Cannot subscribe to the document.visibilitychange: ", r); + } + } + createProvider(e) { + let r; + return !Array.isArray(e) && mte(e) ? r = new fi(this.dappSettings.storage, e.jsBridgeKey) : r = new Kf(this.dappSettings.storage, e), r.listen(this.walletEventsListener.bind(this)), r; + } + walletEventsListener(e) { + switch (e.event) { + case "connect": + this.onWalletConnected(e.payload); + break; + case "connect_error": + this.onWalletConnectError(e.payload); + break; + case "disconnect": + this.onWalletDisconnected("wallet"); + } + } + onWalletConnected(e) { + const r = e.items.find((s) => s.name === "ton_addr"), n = e.items.find((s) => s.name === "ton_proof"); + if (!r) + throw new jt("ton_addr connection item was not found"); + const i = { + device: e.device, + provider: this.provider.type, + account: { + address: r.address, + chain: r.network, + walletStateInit: r.walletStateInit, + publicKey: r.publicKey + } + }; + n && (i.connectItems = { + tonProof: n + }), this.wallet = i, this.tracker.trackConnectionCompleted(i); + } + onWalletConnectError(e) { + const r = bte.parseError(e); + if (this.statusChangeErrorSubscriptions.forEach((n) => n(r)), En(r), this.tracker.trackConnectionError(e.message, e.code), r instanceof A0 || r instanceof S0) + throw fo(r), r; + } + onWalletDisconnected(e) { + this.tracker.trackDisconnection(this.wallet, e), this.wallet = null; + } + checkConnection() { + if (!this.connected) + throw new $d(); + } + createConnectRequest(e) { + const r = [ + { + name: "ton_addr" + } + ]; + return e?.tonProof && r.push({ + name: "ton_proof", + payload: e.tonProof + }), { + manifestUrl: this.dappSettings.manifestUrl, + items: r + }; + } +} +ml.walletsList = new Hv(); +ml.isWalletInjected = (t) => fi.isWalletInjected(t); +ml.isInsideWalletBrowser = (t) => fi.isInsideWalletBrowser(t); +for (let t = 0; t <= 255; t++) { + let e = t.toString(16); + e.length < 2 && (e = "0" + e); +} +function Lm(t) { + const { children: e, onClick: r } = t; + return /* @__PURE__ */ pe.jsx("button", { onClick: r, className: "xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center", children: e }); +} +function T9(t) { + const { wallet: e, connector: r, loading: n } = t, i = Kn(null), s = Kn(), [o, a] = Xt(), [f, u] = Xt(), [h, g] = Xt("connect"), [v, x] = Xt(!1), [S, C] = Xt(); + function D(W) { + s.current?.update({ + data: W + }); + } + async function $() { + x(!0); + try { + a(""); + const W = await Qo.getNonce({ account_type: "block_chain" }); + if ("universalLink" in e && e.universalLink) { + const J = r.connect({ + universalLink: e.universalLink, + bridgeUrl: e.bridgeUrl + }, { + request: { tonProof: W } + }); + if (!J) return; + C(J), D(J), u(W); + } + } catch (W) { + a(W.message); + } + x(!1); + } + function N() { + s.current = new b9({ + width: 264, + height: 264, + margin: 0, + type: "svg", + qrOptions: { + errorCorrectionLevel: "M" + }, + dotsOptions: { + color: "black", + type: "rounded" + }, + backgroundOptions: { + color: "transparent" + } + }), s.current.append(i.current); + } + function z() { + r.connect(e, { + request: { tonProof: f } + }); + } + function k() { + if ("deepLink" in e) { + if (!e.deepLink || !S) return; + const W = new URL(S), J = `${e.deepLink}${W.search}`; + window.open(J); + } + } + function B() { + "universalLink" in e && e.universalLink && /t.me/.test(e.universalLink) && window.open(S); + } + const U = hi(() => !!("deepLink" in e && e.deepLink), [e]), R = hi(() => !!("universalLink" in e && e.universalLink && /t.me/.test(e.universalLink)), [e]); + return Rn(() => { + N(), $(); + }, []), /* @__PURE__ */ pe.jsxs(ps, { children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ pe.jsx(Ja, { title: "Connect wallet", onBack: t.onBack }) }), + /* @__PURE__ */ pe.jsxs("div", { className: "xc-text-center xc-mb-6", children: [ + /* @__PURE__ */ pe.jsxs("div", { className: "xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1", children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center", ref: i }), + /* @__PURE__ */ pe.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: v ? /* @__PURE__ */ pe.jsx(ja, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ pe.jsx("img", { className: "xc-h-10 xc-w-10 xc-rounded-md", src: e.imageUrl }) }) + ] }), + /* @__PURE__ */ pe.jsx("p", { className: "xc-text-center", children: "Scan the QR code below with your phone's camera. " }) + ] }), + /* @__PURE__ */ pe.jsxs("div", { className: "xc-flex xc-justify-center xc-gap-2", children: [ + n && /* @__PURE__ */ pe.jsx(ja, { className: "xc-animate-spin" }), + !v && !n && /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ + R9(e) && /* @__PURE__ */ pe.jsxs(Lm, { onClick: z, children: [ + /* @__PURE__ */ pe.jsx(rY, { className: "xc-opacity-80" }), + "Extension" + ] }), + U && /* @__PURE__ */ pe.jsxs(Lm, { onClick: k, children: [ + /* @__PURE__ */ pe.jsx(AS, { className: "xc-opacity-80" }), + "Desktop" + ] }), + R && /* @__PURE__ */ pe.jsx(Lm, { onClick: B, children: "Telegram Mini App" }) + ] }) + ] }) + ] }); +} +function rre(t) { + const [e, r] = Xt(""), [n, i] = Xt(), [s, o] = Xt(), a = Pb(), [f, u] = Xt(!1); + async function h(v) { + if (!v || !v.connectItems?.tonProof) return; + u(!0); + const x = await Qo.tonLogin({ + account_type: "block_chain", + connector: "codatta_ton", + account_enum: "C", + wallet_name: v?.device.appName, + inviter_code: a.inviterCode, + address: v.account.address, + chain: v.account.chain, + connect_info: [ + { name: "ton_addr", network: v.account.chain, ...v.account }, + v.connectItems?.tonProof + ], + source: { + device: a.device, + channel: a.channel, + app: a.app + } + }); + await t.onLogin(x.data), u(!1); + } + Rn(() => { + const v = new ml({ + manifestUrl: "https://static.codatta.io/static/tonconnect-manifest.json?v=2" + }), x = v.onStatusChange(h); + return o(v), r("select"), x; + }, []); + function g(v) { + r("connect"), i(v); + } + return /* @__PURE__ */ pe.jsxs(ps, { children: [ + e === "select" && /* @__PURE__ */ pe.jsx( + S9, + { + connector: s, + onSelect: g, + onBack: t.onBack + } + ), + e === "connect" && /* @__PURE__ */ pe.jsx( + T9, + { + connector: s, + wallet: n, + onBack: t.onBack, + loading: f + } + ) + ] }); +} +function D9(t) { + const { children: e, className: r } = t, n = Kn(null), [i, s] = Wv.useState(0); + function o() { + try { + const a = n.current?.children || []; + let f = 0; + for (let u = 0; u < a.length; u++) + f += a[u].offsetHeight; + s(f); + } catch (a) { + console.error(a); + } + } + return Rn(() => { + const a = new MutationObserver(o); + return a.observe(n.current, { childList: !0, subtree: !0 }), () => a.disconnect(); + }, []), Rn(() => { + console.log("maxHeight", i); + }, [i]), /* @__PURE__ */ pe.jsx( + "div", + { + ref: n, + className: r, + style: { + transition: "all 0.2s ease-in-out", + overflow: "hidden", + height: i + }, + children: e + } + ); +} +function nre() { + return /* @__PURE__ */ pe.jsxs("svg", { width: "121", height: "120", viewBox: "0 0 121 120", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [ + /* @__PURE__ */ pe.jsx("rect", { x: "0.5", width: "120", height: "120", rx: "60", fill: "#404049" }), + /* @__PURE__ */ pe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z", fill: "#252532" }), + /* @__PURE__ */ pe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z", fill: "#252532" }), + /* @__PURE__ */ pe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z", fill: "#404049" }), + /* @__PURE__ */ pe.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z", stroke: "#77777D", "stroke-width": "2" }), + /* @__PURE__ */ pe.jsx("path", { d: "M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829", stroke: "#77777D", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) + ] }); +} +function O9(t) { + const { wallets: e } = g0(), [r, n] = Xt(), i = hi(() => r ? e.filter((a) => a.key.toLowerCase().includes(r.toLowerCase())) : e, [r]); + function s(a) { + t.onSelectWallet(a); + } + function o(a) { + n(a.target.value); + } + return /* @__PURE__ */ pe.jsxs(ps, { children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ pe.jsx(Ja, { title: "Select wallet", onBack: t.onBack }) }), + /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ + /* @__PURE__ */ pe.jsx(PS, { className: "xc-shrink-0 xc-opacity-50" }), + /* @__PURE__ */ pe.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: o }) + ] }), + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: i.length ? i.map((a) => /* @__PURE__ */ pe.jsx( + Q7, + { + wallet: a, + onClick: s + }, + `feature-${a.key}` + )) : /* @__PURE__ */ pe.jsx(nre, {}) }) + ] }); +} +function dne(t) { + const { onLogin: e, header: r, showEmailSignIn: n = !0, showMoreWallets: i = !0, showTonConnect: s = !0, showFeaturedWallets: o = !0 } = t, [a, f] = Xt(""), [u, h] = Xt(null), [g, v] = Xt(""); + function x($) { + h($), f("evm-wallet"); + } + function S($) { + f("email"), v($); + } + async function C($) { + await e($); + } + function D() { + f("ton-wallet"); + } + return Rn(() => { + f("index"); + }, []), /* @__PURE__ */ pe.jsx(vee, { config: t.config, children: /* @__PURE__ */ pe.jsxs(D9, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ + a === "evm-wallet" && /* @__PURE__ */ pe.jsx( + rte, + { + onBack: () => f("index"), + onLogin: C, + wallet: u + } + ), + a === "ton-wallet" && /* @__PURE__ */ pe.jsx( + rre, + { + onBack: () => f("index"), + onLogin: C + } + ), + a === "email" && /* @__PURE__ */ pe.jsx(Dee, { email: g, onBack: () => f("index"), onLogin: C }), + a === "index" && /* @__PURE__ */ pe.jsx( + a9, + { + header: r, + onEmailConfirm: S, + onSelectWallet: x, + onSelectMoreWallets: () => { + f("all-wallet"); + }, + onSelectTonConnect: D, + config: { + showEmailSignIn: n, + showFeaturedWallets: o, + showMoreWallets: i, + showTonConnect: s + } + } + ), + a === "all-wallet" && /* @__PURE__ */ pe.jsx( + O9, + { + onBack: () => f("index"), + onSelectWallet: x + } + ) + ] }) }); +} +function ire(t) { + const { wallet: e, onConnect: r } = t, [n, i] = Xt(e.installed ? "connect" : "qr"); + async function s(o, a) { + await r(o, a); + } + return /* @__PURE__ */ pe.jsxs(ps, { children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ pe.jsx(Ja, { title: "Connect wallet", onBack: t.onBack }) }), + n === "qr" && /* @__PURE__ */ pe.jsx( + x9, + { + wallet: e, + onGetExtension: () => i("get-extension"), + onSignFinish: s + } + ), + n === "connect" && /* @__PURE__ */ pe.jsx( + _9, + { + onShowQrCode: () => i("qr"), + wallet: e, + onSignFinish: s + } + ), + n === "get-extension" && /* @__PURE__ */ pe.jsx(E9, { wallet: e }) + ] }); +} +function sre(t) { + const { email: e } = t, [r, n] = Xt("captcha"); + return /* @__PURE__ */ pe.jsxs(ps, { children: [ + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ pe.jsx(Ja, { title: "Sign in with email", onBack: t.onBack }) }), + r === "captcha" && /* @__PURE__ */ pe.jsx(v9, { email: e, onCodeSend: () => n("verify-email") }), + r === "verify-email" && /* @__PURE__ */ pe.jsx(m9, { email: e, onInputCode: t.onInputCode, onResendCode: () => n("captcha") }) + ] }); +} +function pne(t) { + const { onEvmWalletConnect: e, onTonWalletConnect: r, onEmailConnect: n, config: i = { + showEmailSignIn: !1, + showFeaturedWallets: !0, + showMoreWallets: !0, + showTonConnect: !0 + } } = t, [s, o] = Xt(""), [a, f] = Xt(), [u, h] = Xt(), g = Kn(), [v, x] = Xt(""); + function S(k) { + f(k), o("evm-wallet-connect"); + } + function C(k) { + x(k), o("email-connect"); + } + async function D(k, B) { + await e?.({ + chain_type: "eip155", + client: k.client, + connect_info: B, + wallet: k + }), o("index"); + } + async function $(k, B) { + await n?.(k, B); + } + function N(k) { + h(k), o("ton-wallet-connect"); + } + async function z(k) { + k && await r?.({ + chain_type: "ton", + client: g.current, + connect_info: k, + wallet: k + }); + } + return Rn(() => { + g.current = new ml({ + manifestUrl: "https://static.codatta.io/static/tonconnect-manifest.json?v=2" + }); + const k = g.current.onStatusChange(z); + return o("index"), k; + }, []), /* @__PURE__ */ pe.jsxs(D9, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ + s === "evm-wallet-select" && /* @__PURE__ */ pe.jsx( + O9, + { + onBack: () => o("index"), + onSelectWallet: S + } + ), + s === "evm-wallet-connect" && /* @__PURE__ */ pe.jsx( + ire, + { + onBack: () => o("index"), + onConnect: D, + wallet: a + } + ), + s === "ton-wallet-select" && /* @__PURE__ */ pe.jsx( + S9, + { + connector: g.current, + onSelect: N, + onBack: () => o("index") + } + ), + s === "ton-wallet-connect" && /* @__PURE__ */ pe.jsx( + T9, + { + connector: g.current, + wallet: u, + onBack: () => o("index") + } + ), + s === "email-connect" && /* @__PURE__ */ pe.jsx(sre, { email: v, onBack: () => o("index"), onInputCode: $ }), + s === "index" && /* @__PURE__ */ pe.jsx( + a9, + { + onEmailConfirm: C, + onSelectWallet: S, + onSelectMoreWallets: () => o("evm-wallet-select"), + onSelectTonConnect: () => o("ton-wallet-select"), + config: i + } + ) + ] }); +} +export { + lne as C, + n4 as H, + Tc as W, + Da as a, + QT as b, + fre as c, + cre as d, + hf as e, + cd as f, + ad as g, + ure as h, + VT as i, + GG as j, + dne as k, + pne as l, + lre as r, + kO as s, + Zv as t, + g0 as u +}; diff --git a/dist/main-L4HtPONr.js b/dist/main-L4HtPONr.js deleted file mode 100644 index bfa8376..0000000 --- a/dist/main-L4HtPONr.js +++ /dev/null @@ -1,44032 +0,0 @@ -var cD = Object.defineProperty; -var uD = (t, e, r) => e in t ? cD(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; -var vs = (t, e, r) => uD(t, typeof e != "symbol" ? e + "" : e, r); -import * as Gt from "react"; -import Rv, { createContext as Ta, useContext as Tn, useState as Yt, useEffect as Dn, forwardRef as Dv, createElement as e0, useId as Ov, useCallback as Nv, Component as fD, useLayoutEffect as lD, useRef as Qn, useInsertionEffect as L5, useMemo as wi, Fragment as k5, Children as hD, isValidElement as dD } from "react"; -import "https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js"; -var gn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; -function ns(t) { - return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; -} -function Lv(t) { - if (t.__esModule) return t; - var e = t.default; - if (typeof e == "function") { - var r = function n() { - return this instanceof n ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments); - }; - r.prototype = e.prototype; - } else r = {}; - return Object.defineProperty(r, "__esModule", { value: !0 }), Object.keys(t).forEach(function(n) { - var i = Object.getOwnPropertyDescriptor(t, n); - Object.defineProperty(r, n, i.get ? i : { - enumerable: !0, - get: function() { - return t[n]; - } - }); - }), r; -} -var u1 = { exports: {} }, Ef = {}; -/** - * @license React - * react-jsx-runtime.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -var I2; -function pD() { - if (I2) return Ef; - I2 = 1; - var t = Rv, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 }; - function o(a, u, l) { - var d, p = {}, w = null, _ = null; - l !== void 0 && (w = "" + l), u.key !== void 0 && (w = "" + u.key), u.ref !== void 0 && (_ = u.ref); - for (d in u) n.call(u, d) && !s.hasOwnProperty(d) && (p[d] = u[d]); - if (a && a.defaultProps) for (d in u = a.defaultProps, u) p[d] === void 0 && (p[d] = u[d]); - return { $$typeof: e, type: a, key: w, ref: _, props: p, _owner: i.current }; - } - return Ef.Fragment = r, Ef.jsx = o, Ef.jsxs = o, Ef; -} -var Sf = {}; -/** - * @license React - * react-jsx-runtime.development.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -var C2; -function gD() { - return C2 || (C2 = 1, process.env.NODE_ENV !== "production" && function() { - var t = Rv, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), a = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), _ = Symbol.for("react.offscreen"), P = Symbol.iterator, O = "@@iterator"; - function L(j) { - if (j === null || typeof j != "object") - return null; - var se = P && j[P] || j[O]; - return typeof se == "function" ? se : null; - } - var B = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - function k(j) { - { - for (var se = arguments.length, de = new Array(se > 1 ? se - 1 : 0), xe = 1; xe < se; xe++) - de[xe - 1] = arguments[xe]; - W("error", j, de); - } - } - function W(j, se, de) { - { - var xe = B.ReactDebugCurrentFrame, Te = xe.getStackAddendum(); - Te !== "" && (se += "%s", de = de.concat([Te])); - var Re = de.map(function(nt) { - return String(nt); - }); - Re.unshift("Warning: " + se), Function.prototype.apply.call(console[j], console, Re); - } - } - var U = !1, V = !1, Q = !1, R = !1, K = !1, ge; - ge = Symbol.for("react.module.reference"); - function Ee(j) { - return !!(typeof j == "string" || typeof j == "function" || j === n || j === s || K || j === i || j === l || j === d || R || j === _ || U || V || Q || typeof j == "object" && j !== null && (j.$$typeof === w || j.$$typeof === p || j.$$typeof === o || j.$$typeof === a || j.$$typeof === u || // This needs to include all possible module reference object - // types supported by any Flight configuration anywhere since - // we don't know which Flight build this will end up being used - // with. - j.$$typeof === ge || j.getModuleId !== void 0)); - } - function Y(j, se, de) { - var xe = j.displayName; - if (xe) - return xe; - var Te = se.displayName || se.name || ""; - return Te !== "" ? de + "(" + Te + ")" : de; - } - function A(j) { - return j.displayName || "Context"; - } - function m(j) { - if (j == null) - return null; - if (typeof j.tag == "number" && k("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof j == "function") - return j.displayName || j.name || null; - if (typeof j == "string") - return j; - switch (j) { - case n: - return "Fragment"; - case r: - return "Portal"; - case s: - return "Profiler"; - case i: - return "StrictMode"; - case l: - return "Suspense"; - case d: - return "SuspenseList"; - } - if (typeof j == "object") - switch (j.$$typeof) { - case a: - var se = j; - return A(se) + ".Consumer"; - case o: - var de = j; - return A(de._context) + ".Provider"; - case u: - return Y(j, j.render, "ForwardRef"); - case p: - var xe = j.displayName || null; - return xe !== null ? xe : m(j.type) || "Memo"; - case w: { - var Te = j, Re = Te._payload, nt = Te._init; - try { - return m(nt(Re)); - } catch { - return null; - } - } - } - return null; - } - var f = Object.assign, g = 0, b, x, E, S, v, M, I; - function F() { - } - F.__reactDisabledLog = !0; - function ce() { - { - if (g === 0) { - b = console.log, x = console.info, E = console.warn, S = console.error, v = console.group, M = console.groupCollapsed, I = console.groupEnd; - var j = { - configurable: !0, - enumerable: !0, - value: F, - writable: !0 - }; - Object.defineProperties(console, { - info: j, - log: j, - warn: j, - error: j, - group: j, - groupCollapsed: j, - groupEnd: j - }); - } - g++; - } - } - function D() { - { - if (g--, g === 0) { - var j = { - configurable: !0, - enumerable: !0, - writable: !0 - }; - Object.defineProperties(console, { - log: f({}, j, { - value: b - }), - info: f({}, j, { - value: x - }), - warn: f({}, j, { - value: E - }), - error: f({}, j, { - value: S - }), - group: f({}, j, { - value: v - }), - groupCollapsed: f({}, j, { - value: M - }), - groupEnd: f({}, j, { - value: I - }) - }); - } - g < 0 && k("disabledDepth fell below zero. This is a bug in React. Please file an issue."); - } - } - var oe = B.ReactCurrentDispatcher, Z; - function J(j, se, de) { - { - if (Z === void 0) - try { - throw Error(); - } catch (Te) { - var xe = Te.stack.trim().match(/\n( *(at )?)/); - Z = xe && xe[1] || ""; - } - return ` -` + Z + j; - } - } - var ee = !1, T; - { - var X = typeof WeakMap == "function" ? WeakMap : Map; - T = new X(); - } - function re(j, se) { - if (!j || ee) - return ""; - { - var de = T.get(j); - if (de !== void 0) - return de; - } - var xe; - ee = !0; - var Te = Error.prepareStackTrace; - Error.prepareStackTrace = void 0; - var Re; - Re = oe.current, oe.current = null, ce(); - try { - if (se) { - var nt = function() { - throw Error(); - }; - if (Object.defineProperty(nt.prototype, "props", { - set: function() { - throw Error(); - } - }), typeof Reflect == "object" && Reflect.construct) { - try { - Reflect.construct(nt, []); - } catch (_t) { - xe = _t; - } - Reflect.construct(j, [], nt); - } else { - try { - nt.call(); - } catch (_t) { - xe = _t; - } - j.call(nt.prototype); - } - } else { - try { - throw Error(); - } catch (_t) { - xe = _t; - } - j(); - } - } catch (_t) { - if (_t && xe && typeof _t.stack == "string") { - for (var je = _t.stack.split(` -`), pt = xe.stack.split(` -`), it = je.length - 1, et = pt.length - 1; it >= 1 && et >= 0 && je[it] !== pt[et]; ) - et--; - for (; it >= 1 && et >= 0; it--, et--) - if (je[it] !== pt[et]) { - if (it !== 1 || et !== 1) - do - if (it--, et--, et < 0 || je[it] !== pt[et]) { - var St = ` -` + je[it].replace(" at new ", " at "); - return j.displayName && St.includes("") && (St = St.replace("", j.displayName)), typeof j == "function" && T.set(j, St), St; - } - while (it >= 1 && et >= 0); - break; - } - } - } finally { - ee = !1, oe.current = Re, D(), Error.prepareStackTrace = Te; - } - var Tt = j ? j.displayName || j.name : "", At = Tt ? J(Tt) : ""; - return typeof j == "function" && T.set(j, At), At; - } - function pe(j, se, de) { - return re(j, !1); - } - function ie(j) { - var se = j.prototype; - return !!(se && se.isReactComponent); - } - function ue(j, se, de) { - if (j == null) - return ""; - if (typeof j == "function") - return re(j, ie(j)); - if (typeof j == "string") - return J(j); - switch (j) { - case l: - return J("Suspense"); - case d: - return J("SuspenseList"); - } - if (typeof j == "object") - switch (j.$$typeof) { - case u: - return pe(j.render); - case p: - return ue(j.type, se, de); - case w: { - var xe = j, Te = xe._payload, Re = xe._init; - try { - return ue(Re(Te), se, de); - } catch { - } - } - } - return ""; - } - var ve = Object.prototype.hasOwnProperty, Pe = {}, De = B.ReactDebugCurrentFrame; - function Ce(j) { - if (j) { - var se = j._owner, de = ue(j.type, j._source, se ? se.type : null); - De.setExtraStackFrame(de); - } else - De.setExtraStackFrame(null); - } - function $e(j, se, de, xe, Te) { - { - var Re = Function.call.bind(ve); - for (var nt in j) - if (Re(j, nt)) { - var je = void 0; - try { - if (typeof j[nt] != "function") { - var pt = Error((xe || "React class") + ": " + de + " type `" + nt + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof j[nt] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); - throw pt.name = "Invariant Violation", pt; - } - je = j[nt](se, nt, xe, de, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); - } catch (it) { - je = it; - } - je && !(je instanceof Error) && (Ce(Te), k("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", xe || "React class", de, nt, typeof je), Ce(null)), je instanceof Error && !(je.message in Pe) && (Pe[je.message] = !0, Ce(Te), k("Failed %s type: %s", de, je.message), Ce(null)); - } - } - } - var Me = Array.isArray; - function Ne(j) { - return Me(j); - } - function Ke(j) { - { - var se = typeof Symbol == "function" && Symbol.toStringTag, de = se && j[Symbol.toStringTag] || j.constructor.name || "Object"; - return de; - } - } - function Le(j) { - try { - return qe(j), !1; - } catch { - return !0; - } - } - function qe(j) { - return "" + j; - } - function ze(j) { - if (Le(j)) - return k("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(j)), qe(j); - } - var _e = B.ReactCurrentOwner, Ze = { - key: !0, - ref: !0, - __self: !0, - __source: !0 - }, at, ke, Qe; - Qe = {}; - function tt(j) { - if (ve.call(j, "ref")) { - var se = Object.getOwnPropertyDescriptor(j, "ref").get; - if (se && se.isReactWarning) - return !1; - } - return j.ref !== void 0; - } - function Ye(j) { - if (ve.call(j, "key")) { - var se = Object.getOwnPropertyDescriptor(j, "key").get; - if (se && se.isReactWarning) - return !1; - } - return j.key !== void 0; - } - function dt(j, se) { - if (typeof j.ref == "string" && _e.current && se && _e.current.stateNode !== se) { - var de = m(_e.current.type); - Qe[de] || (k('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', m(_e.current.type), j.ref), Qe[de] = !0); - } - } - function lt(j, se) { - { - var de = function() { - at || (at = !0, k("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); - }; - de.isReactWarning = !0, Object.defineProperty(j, "key", { - get: de, - configurable: !0 - }); - } - } - function ct(j, se) { - { - var de = function() { - ke || (ke = !0, k("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", se)); - }; - de.isReactWarning = !0, Object.defineProperty(j, "ref", { - get: de, - configurable: !0 - }); - } - } - var qt = function(j, se, de, xe, Te, Re, nt) { - var je = { - // This tag allows us to uniquely identify this as a React Element - $$typeof: e, - // Built-in properties that belong on the element - type: j, - key: se, - ref: de, - props: nt, - // Record the component responsible for creating this element. - _owner: Re - }; - return je._store = {}, Object.defineProperty(je._store, "validated", { - configurable: !1, - enumerable: !1, - writable: !0, - value: !1 - }), Object.defineProperty(je, "_self", { - configurable: !1, - enumerable: !1, - writable: !1, - value: xe - }), Object.defineProperty(je, "_source", { - configurable: !1, - enumerable: !1, - writable: !1, - value: Te - }), Object.freeze && (Object.freeze(je.props), Object.freeze(je)), je; - }; - function Jt(j, se, de, xe, Te) { - { - var Re, nt = {}, je = null, pt = null; - de !== void 0 && (ze(de), je = "" + de), Ye(se) && (ze(se.key), je = "" + se.key), tt(se) && (pt = se.ref, dt(se, Te)); - for (Re in se) - ve.call(se, Re) && !Ze.hasOwnProperty(Re) && (nt[Re] = se[Re]); - if (j && j.defaultProps) { - var it = j.defaultProps; - for (Re in it) - nt[Re] === void 0 && (nt[Re] = it[Re]); - } - if (je || pt) { - var et = typeof j == "function" ? j.displayName || j.name || "Unknown" : j; - je && lt(nt, et), pt && ct(nt, et); - } - return qt(j, je, pt, Te, xe, _e.current, nt); - } - } - var Et = B.ReactCurrentOwner, er = B.ReactDebugCurrentFrame; - function Xt(j) { - if (j) { - var se = j._owner, de = ue(j.type, j._source, se ? se.type : null); - er.setExtraStackFrame(de); - } else - er.setExtraStackFrame(null); - } - var Dt; - Dt = !1; - function kt(j) { - return typeof j == "object" && j !== null && j.$$typeof === e; - } - function Ct() { - { - if (Et.current) { - var j = m(Et.current.type); - if (j) - return ` - -Check the render method of \`` + j + "`."; - } - return ""; - } - } - function mt(j) { - return ""; - } - var Rt = {}; - function Nt(j) { - { - var se = Ct(); - if (!se) { - var de = typeof j == "string" ? j : j.displayName || j.name; - de && (se = ` - -Check the top-level render call using <` + de + ">."); - } - return se; - } - } - function bt(j, se) { - { - if (!j._store || j._store.validated || j.key != null) - return; - j._store.validated = !0; - var de = Nt(se); - if (Rt[de]) - return; - Rt[de] = !0; - var xe = ""; - j && j._owner && j._owner !== Et.current && (xe = " It was passed a child from " + m(j._owner.type) + "."), Xt(j), k('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', de, xe), Xt(null); - } - } - function $t(j, se) { - { - if (typeof j != "object") - return; - if (Ne(j)) - for (var de = 0; de < j.length; de++) { - var xe = j[de]; - kt(xe) && bt(xe, se); - } - else if (kt(j)) - j._store && (j._store.validated = !0); - else if (j) { - var Te = L(j); - if (typeof Te == "function" && Te !== j.entries) - for (var Re = Te.call(j), nt; !(nt = Re.next()).done; ) - kt(nt.value) && bt(nt.value, se); - } - } - } - function Ft(j) { - { - var se = j.type; - if (se == null || typeof se == "string") - return; - var de; - if (typeof se == "function") - de = se.propTypes; - else if (typeof se == "object" && (se.$$typeof === u || // Note: Memo only checks outer props here. - // Inner props are checked in the reconciler. - se.$$typeof === p)) - de = se.propTypes; - else - return; - if (de) { - var xe = m(se); - $e(de, j.props, "prop", xe, j); - } else if (se.PropTypes !== void 0 && !Dt) { - Dt = !0; - var Te = m(se); - k("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Te || "Unknown"); - } - typeof se.getDefaultProps == "function" && !se.getDefaultProps.isReactClassApproved && k("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); - } - } - function rt(j) { - { - for (var se = Object.keys(j.props), de = 0; de < se.length; de++) { - var xe = se[de]; - if (xe !== "children" && xe !== "key") { - Xt(j), k("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", xe), Xt(null); - break; - } - } - j.ref !== null && (Xt(j), k("Invalid attribute `ref` supplied to `React.Fragment`."), Xt(null)); - } - } - var Bt = {}; - function $(j, se, de, xe, Te, Re) { - { - var nt = Ee(j); - if (!nt) { - var je = ""; - (j === void 0 || typeof j == "object" && j !== null && Object.keys(j).length === 0) && (je += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); - var pt = mt(); - pt ? je += pt : je += Ct(); - var it; - j === null ? it = "null" : Ne(j) ? it = "array" : j !== void 0 && j.$$typeof === e ? (it = "<" + (m(j.type) || "Unknown") + " />", je = " Did you accidentally export a JSX literal instead of a component?") : it = typeof j, k("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", it, je); - } - var et = Jt(j, se, de, Te, Re); - if (et == null) - return et; - if (nt) { - var St = se.children; - if (St !== void 0) - if (xe) - if (Ne(St)) { - for (var Tt = 0; Tt < St.length; Tt++) - $t(St[Tt], j); - Object.freeze && Object.freeze(St); - } else - k("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); - else - $t(St, j); - } - if (ve.call(se, "key")) { - var At = m(j), _t = Object.keys(se).filter(function(st) { - return st !== "key"; - }), ht = _t.length > 0 ? "{key: someKey, " + _t.join(": ..., ") + ": ...}" : "{key: someKey}"; - if (!Bt[At + ht]) { - var xt = _t.length > 0 ? "{" + _t.join(": ..., ") + ": ...}" : "{}"; - k(`A props object containing a "key" prop is being spread into JSX: - let props = %s; - <%s {...props} /> -React keys must be passed directly to JSX without using spread: - let props = %s; - <%s key={someKey} {...props} />`, ht, At, xt, At), Bt[At + ht] = !0; - } - } - return j === n ? rt(et) : Ft(et), et; - } - } - function q(j, se, de) { - return $(j, se, de, !0); - } - function H(j, se, de) { - return $(j, se, de, !1); - } - var C = H, G = q; - Sf.Fragment = n, Sf.jsx = C, Sf.jsxs = G; - }()), Sf; -} -process.env.NODE_ENV === "production" ? u1.exports = pD() : u1.exports = gD(); -var le = u1.exports; -const ks = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2", mD = [ - { - featured: !0, - name: "MetaMask", - rdns: "io.metamask", - image: `${ks}#metamask`, - getWallet: { - chrome_store_id: "nkbihfbeogaeaoehlefnkodbefgpgknn", - brave_store_id: "nkbihfbeogaeaoehlefnkodbefgpgknn", - edge_addon_id: "ejbalbakoplchlghecdalmeeeajnimhm", - firefox_addon_id: "ether-metamask", - play_store_id: "io.metamask", - app_store_id: "id1438144202" - }, - deep_link: "metamask://wc", - universal_link: "https://metamask.app.link/wc" - }, - { - featured: !0, - name: "OKX Wallet", - rdns: "com.okex.wallet", - image: `${ks}#okx`, - getWallet: { - chrome_store_id: "mcohilncbfahbmgdjkbpemcciiolgcge", - brave_store_id: "mcohilncbfahbmgdjkbpemcciiolgcge", - edge_addon_id: "pbpjkcldjiffchgbbndmhojiacbgflha", - play_store_id: "com.okinc.okex.gp", - app_store_id: "id1327268470" - }, - deep_link: "okex://main/wc", - universal_link: "okex://main/wc" - }, - { - featured: !0, - name: "WalletConnect", - image: `${ks}#walletconnect` - }, - { - featured: !1, - name: "Coinbase Wallet", - image: `${ks}#coinbase` - }, - { - featured: !1, - name: "GateWallet", - rdns: "io.gate.wallet", - image: `${ks}#6e528abf-7a7d-47bd-d84d-481f169b1200`, - getWallet: { - chrome_store_id: "cpmkedoipcpimgecpmgpldfpohjplkpp", - brave_store_id: "cpmkedoipcpimgecpmgpldfpohjplkpp", - play_store_id: "com.gateio.gateio", - app_store_id: "id1294998195", - mac_app_store_id: "id1609559473" - }, - deep_link: "https://www.gate.io/mobileapp", - universal_link: "https://www.gate.io/mobileapp" - }, - { - featured: !1, - name: "Onekey", - rdns: "so.onekey.app.wallet", - image: `${ks}#onekey`, - getWallet: { - chrome_store_id: "jnmbobjmhlngoefaiojfljckilhhlhcj", - brave_store_id: "jnmbobjmhlngoefaiojfljckilhhlhcj", - play_store_id: "so.onekey.app.wallet", - app_store_id: "id1609559473" - }, - deep_link: "onekey-wallet://", - universal_link: "onekey://wc" - }, - { - featured: !1, - name: "Infinity Wallet", - image: `${ks}#9f259366-0bcd-4817-0af9-f78773e41900`, - desktop_link: "infinity://wc" - }, - { - name: "Rabby Wallet", - rdns: "io.rabby", - featured: !1, - image: `${ks}#rabby`, - getWallet: { - chrome_store_id: "acmacodkjbdgmoleebolmdjonilkdbch", - brave_store_id: "acmacodkjbdgmoleebolmdjonilkdbch", - play_store_id: "com.debank.rabbymobile", - app_store_id: "id6474381673" - } - }, - { - name: "Binance Web3 Wallet", - featured: !1, - image: `${ks}#ebac7b39-688c-41e3-7912-a4fefba74600`, - getWallet: { - play_store_id: "com.binance.dev", - app_store_id: "id1436799971" - } - }, - { - name: "Rainbow Wallet", - rdns: "me.rainbow", - featured: !1, - image: `${ks}#rainbow`, - getWallet: { - chrome_store_id: "opfgelmcmbiajamepnmloijbpoleiama", - edge_addon_id: "cpojfbodiccabbabgimdeohkkpjfpbnf", - firefox_addon_id: "rainbow-extension", - app_store_id: "id1457119021", - play_store_id: "me.rainbow" - } - } -]; -function vD(t, e) { - const r = t.exec(e); - return r == null ? void 0 : r.groups; -} -const T2 = /^tuple(?(\[(\d*)\])*)$/; -function f1(t) { - let e = t.type; - if (T2.test(t.type) && "components" in t) { - e = "("; - const r = t.components.length; - for (let i = 0; i < r; i++) { - const s = t.components[i]; - e += f1(s), i < r - 1 && (e += ", "); - } - const n = vD(T2, t.type); - return e += `)${(n == null ? void 0 : n.array) ?? ""}`, f1({ - ...t, - type: e - }); - } - return "indexed" in t && t.indexed && (e = `${e} indexed`), t.name ? `${e} ${t.name}` : e; -} -function Af(t) { - let e = ""; - const r = t.length; - for (let n = 0; n < r; n++) { - const i = t[n]; - e += f1(i), n !== r - 1 && (e += ", "); - } - return e; -} -function bD(t) { - var e; - return t.type === "function" ? `function ${t.name}(${Af(t.inputs)})${t.stateMutability && t.stateMutability !== "nonpayable" ? ` ${t.stateMutability}` : ""}${(e = t.outputs) != null && e.length ? ` returns (${Af(t.outputs)})` : ""}` : t.type === "event" ? `event ${t.name}(${Af(t.inputs)})` : t.type === "error" ? `error ${t.name}(${Af(t.inputs)})` : t.type === "constructor" ? `constructor(${Af(t.inputs)})${t.stateMutability === "payable" ? " payable" : ""}` : t.type === "fallback" ? `fallback() external${t.stateMutability === "payable" ? " payable" : ""}` : "receive() external payable"; -} -function Xn(t, e, r) { - const n = t[e.name]; - if (typeof n == "function") - return n; - const i = t[r]; - return typeof i == "function" ? i : (s) => e(t, s); -} -function Iu(t, { includeName: e = !1 } = {}) { - if (t.type !== "function" && t.type !== "event" && t.type !== "error") - throw new TD(t.type); - return `${t.name}(${kv(t.inputs, { includeName: e })})`; -} -function kv(t, { includeName: e = !1 } = {}) { - return t ? t.map((r) => yD(r, { includeName: e })).join(e ? ", " : ",") : ""; -} -function yD(t, { includeName: e }) { - return t.type.startsWith("tuple") ? `(${kv(t.components, { includeName: e })})${t.type.slice(5)}` : t.type + (e && t.name ? ` ${t.name}` : ""); -} -function ya(t, { strict: e = !0 } = {}) { - return !t || typeof t != "string" ? !1 : e ? /^0x[0-9a-fA-F]*$/.test(t) : t.startsWith("0x"); -} -function xn(t) { - return ya(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length; -} -const $5 = "2.31.3"; -let Pf = { - getDocsUrl: ({ docsBaseUrl: t, docsPath: e = "", docsSlug: r }) => e ? `${t ?? "https://viem.sh"}${e}${r ? `#${r}` : ""}` : void 0, - version: `viem@${$5}` -}; -class gt extends Error { - constructor(e, r = {}) { - var a; - const n = (() => { - var u; - return r.cause instanceof gt ? r.cause.details : (u = r.cause) != null && u.message ? r.cause.message : r.details; - })(), i = r.cause instanceof gt && r.cause.docsPath || r.docsPath, s = (a = Pf.getDocsUrl) == null ? void 0 : a.call(Pf, { ...r, docsPath: i }), o = [ - e || "An error occurred.", - "", - ...r.metaMessages ? [...r.metaMessages, ""] : [], - ...s ? [`Docs: ${s}`] : [], - ...n ? [`Details: ${n}`] : [], - ...Pf.version ? [`Version: ${Pf.version}`] : [] - ].join(` -`); - super(o, r.cause ? { cause: r.cause } : void 0), Object.defineProperty(this, "details", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "docsPath", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "metaMessages", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "shortMessage", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "version", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "name", { - enumerable: !0, - configurable: !0, - writable: !0, - value: "BaseError" - }), this.details = n, this.docsPath = i, this.metaMessages = r.metaMessages, this.name = r.name ?? this.name, this.shortMessage = e, this.version = $5; - } - walk(e) { - return B5(this, e); - } -} -function B5(t, e) { - return e != null && e(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ? B5(t.cause, e) : e ? null : t; -} -class wD extends gt { - constructor({ docsPath: e }) { - super([ - "A constructor was not found on the ABI.", - "Make sure you are using the correct ABI and that the constructor exists on it." - ].join(` -`), { - docsPath: e, - name: "AbiConstructorNotFoundError" - }); - } -} -class R2 extends gt { - constructor({ docsPath: e }) { - super([ - "Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.", - "Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists." - ].join(` -`), { - docsPath: e, - name: "AbiConstructorParamsNotFoundError" - }); - } -} -class xD extends gt { - constructor({ data: e, params: r, size: n }) { - super([`Data size of ${n} bytes is too small for given parameters.`].join(` -`), { - metaMessages: [ - `Params: (${kv(r, { includeName: !0 })})`, - `Data: ${e} (${n} bytes)` - ], - name: "AbiDecodingDataSizeTooSmallError" - }), Object.defineProperty(this, "data", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "params", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "size", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), this.data = e, this.params = r, this.size = n; - } -} -class $v extends gt { - constructor() { - super('Cannot decode zero data ("0x") with ABI parameters.', { - name: "AbiDecodingZeroDataError" - }); - } -} -class _D extends gt { - constructor({ expectedLength: e, givenLength: r, type: n }) { - super([ - `ABI encoding array length mismatch for type ${n}.`, - `Expected length: ${e}`, - `Given length: ${r}` - ].join(` -`), { name: "AbiEncodingArrayLengthMismatchError" }); - } -} -class ED extends gt { - constructor({ expectedSize: e, value: r }) { - super(`Size of bytes "${r}" (bytes${xn(r)}) does not match expected size (bytes${e}).`, { name: "AbiEncodingBytesSizeMismatchError" }); - } -} -class SD extends gt { - constructor({ expectedLength: e, givenLength: r }) { - super([ - "ABI encoding params/values length mismatch.", - `Expected length (params): ${e}`, - `Given length (values): ${r}` - ].join(` -`), { name: "AbiEncodingLengthMismatchError" }); - } -} -class F5 extends gt { - constructor(e, { docsPath: r }) { - super([ - `Encoded error signature "${e}" not found on ABI.`, - "Make sure you are using the correct ABI and that the error exists on it.", - `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.` - ].join(` -`), { - docsPath: r, - name: "AbiErrorSignatureNotFoundError" - }), Object.defineProperty(this, "signature", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), this.signature = e; - } -} -class D2 extends gt { - constructor(e, { docsPath: r } = {}) { - super([ - `Function ${e ? `"${e}" ` : ""}not found on ABI.`, - "Make sure you are using the correct ABI and that the function exists on it." - ].join(` -`), { - docsPath: r, - name: "AbiFunctionNotFoundError" - }); - } -} -class AD extends gt { - constructor(e, r) { - super("Found ambiguous types in overloaded ABI items.", { - metaMessages: [ - `\`${e.type}\` in \`${Iu(e.abiItem)}\`, and`, - `\`${r.type}\` in \`${Iu(r.abiItem)}\``, - "", - "These types encode differently and cannot be distinguished at runtime.", - "Remove one of the ambiguous items in the ABI." - ], - name: "AbiItemAmbiguityError" - }); - } -} -class PD extends gt { - constructor({ expectedSize: e, givenSize: r }) { - super(`Expected bytes${e}, got bytes${r}.`, { - name: "BytesSizeMismatchError" - }); - } -} -class MD extends gt { - constructor(e, { docsPath: r }) { - super([ - `Type "${e}" is not a valid encoding type.`, - "Please provide a valid ABI type." - ].join(` -`), { docsPath: r, name: "InvalidAbiEncodingType" }); - } -} -class ID extends gt { - constructor(e, { docsPath: r }) { - super([ - `Type "${e}" is not a valid decoding type.`, - "Please provide a valid ABI type." - ].join(` -`), { docsPath: r, name: "InvalidAbiDecodingType" }); - } -} -class CD extends gt { - constructor(e) { - super([`Value "${e}" is not a valid array.`].join(` -`), { - name: "InvalidArrayError" - }); - } -} -class TD extends gt { - constructor(e) { - super([ - `"${e}" is not a valid definition type.`, - 'Valid types: "function", "event", "error"' - ].join(` -`), { name: "InvalidDefinitionTypeError" }); - } -} -class j5 extends gt { - constructor({ offset: e, position: r, size: n }) { - super(`Slice ${r === "start" ? "starting" : "ending"} at offset "${e}" is out-of-bounds (size: ${n}).`, { name: "SliceOffsetOutOfBoundsError" }); - } -} -class U5 extends gt { - constructor({ size: e, targetSize: r, type: n }) { - super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`, { name: "SizeExceedsPaddingSizeError" }); - } -} -class O2 extends gt { - constructor({ size: e, targetSize: r, type: n }) { - super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${e} ${n} long.`, { name: "InvalidBytesLengthError" }); - } -} -function ju(t, { dir: e, size: r = 32 } = {}) { - return typeof t == "string" ? ba(t, { dir: e, size: r }) : RD(t, { dir: e, size: r }); -} -function ba(t, { dir: e, size: r = 32 } = {}) { - if (r === null) - return t; - const n = t.replace("0x", ""); - if (n.length > r * 2) - throw new U5({ - size: Math.ceil(n.length / 2), - targetSize: r, - type: "hex" - }); - return `0x${n[e === "right" ? "padEnd" : "padStart"](r * 2, "0")}`; -} -function RD(t, { dir: e, size: r = 32 } = {}) { - if (r === null) - return t; - if (t.length > r) - throw new U5({ - size: t.length, - targetSize: r, - type: "bytes" - }); - const n = new Uint8Array(r); - for (let i = 0; i < r; i++) { - const s = e === "right"; - n[s ? i : r - i - 1] = t[s ? i : t.length - i - 1]; - } - return n; -} -class q5 extends gt { - constructor({ max: e, min: r, signed: n, size: i, value: s }) { - super(`Number "${s}" is not in safe ${i ? `${i * 8}-bit ${n ? "signed" : "unsigned"} ` : ""}integer range ${e ? `(${r} to ${e})` : `(above ${r})`}`, { name: "IntegerOutOfRangeError" }); - } -} -class DD extends gt { - constructor(e) { - super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, { - name: "InvalidBytesBooleanError" - }); - } -} -class OD extends gt { - constructor({ givenSize: e, maxSize: r }) { - super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" }); - } -} -function j0(t, { dir: e = "left" } = {}) { - let r = typeof t == "string" ? t.replace("0x", "") : t, n = 0; - for (let i = 0; i < r.length - 1 && r[e === "left" ? i : r.length - i - 1].toString() === "0"; i++) - n++; - return r = e === "left" ? r.slice(n) : r.slice(0, r.length - n), typeof t == "string" ? (r.length === 1 && e === "right" && (r = `${r}0`), `0x${r.length % 2 === 1 ? `0${r}` : r}`) : r; -} -function io(t, { size: e }) { - if (xn(t) > e) - throw new OD({ - givenSize: xn(t), - maxSize: e - }); -} -function wa(t, e = {}) { - const { signed: r } = e; - e.size && io(t, { size: e.size }); - const n = BigInt(t); - if (!r) - return n; - const i = (t.length - 2) / 2, s = (1n << BigInt(i) * 8n - 1n) - 1n; - return n <= s ? n : n - BigInt(`0x${"f".padStart(i * 2, "f")}`) - 1n; -} -function xa(t, e = {}) { - return Number(wa(t, e)); -} -const ND = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); -function t0(t, e = {}) { - return typeof t == "number" || typeof t == "bigint" ? vr(t, e) : typeof t == "string" ? U0(t, e) : typeof t == "boolean" ? z5(t, e) : xi(t, e); -} -function z5(t, e = {}) { - const r = `0x${Number(t)}`; - return typeof e.size == "number" ? (io(r, { size: e.size }), ju(r, { size: e.size })) : r; -} -function xi(t, e = {}) { - let r = ""; - for (let i = 0; i < t.length; i++) - r += ND[t[i]]; - const n = `0x${r}`; - return typeof e.size == "number" ? (io(n, { size: e.size }), ju(n, { dir: "right", size: e.size })) : n; -} -function vr(t, e = {}) { - const { signed: r, size: n } = e, i = BigInt(t); - let s; - n ? r ? s = (1n << BigInt(n) * 8n - 1n) - 1n : s = 2n ** (BigInt(n) * 8n) - 1n : typeof t == "number" && (s = BigInt(Number.MAX_SAFE_INTEGER)); - const o = typeof s == "bigint" && r ? -s - 1n : 0; - if (s && i > s || i < o) { - const u = typeof t == "bigint" ? "n" : ""; - throw new q5({ - max: s ? `${s}${u}` : void 0, - min: `${o}${u}`, - signed: r, - size: n, - value: `${t}${u}` - }); - } - const a = `0x${(r && i < 0 ? (1n << BigInt(n * 8)) + BigInt(i) : i).toString(16)}`; - return n ? ju(a, { size: n }) : a; -} -const LD = /* @__PURE__ */ new TextEncoder(); -function U0(t, e = {}) { - const r = LD.encode(t); - return xi(r, e); -} -const kD = /* @__PURE__ */ new TextEncoder(); -function Bv(t, e = {}) { - return typeof t == "number" || typeof t == "bigint" ? BD(t, e) : typeof t == "boolean" ? $D(t, e) : ya(t) ? Fo(t, e) : W5(t, e); -} -function $D(t, e = {}) { - const r = new Uint8Array(1); - return r[0] = Number(t), typeof e.size == "number" ? (io(r, { size: e.size }), ju(r, { size: e.size })) : r; -} -const bo = { - zero: 48, - nine: 57, - A: 65, - F: 70, - a: 97, - f: 102 -}; -function N2(t) { - if (t >= bo.zero && t <= bo.nine) - return t - bo.zero; - if (t >= bo.A && t <= bo.F) - return t - (bo.A - 10); - if (t >= bo.a && t <= bo.f) - return t - (bo.a - 10); -} -function Fo(t, e = {}) { - let r = t; - e.size && (io(r, { size: e.size }), r = ju(r, { dir: "right", size: e.size })); - let n = r.slice(2); - n.length % 2 && (n = `0${n}`); - const i = n.length / 2, s = new Uint8Array(i); - for (let o = 0, a = 0; o < i; o++) { - const u = N2(n.charCodeAt(a++)), l = N2(n.charCodeAt(a++)); - if (u === void 0 || l === void 0) - throw new gt(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`); - s[o] = u * 16 + l; - } - return s; -} -function BD(t, e) { - const r = vr(t, e); - return Fo(r); -} -function W5(t, e = {}) { - const r = kD.encode(t); - return typeof e.size == "number" ? (io(r, { size: e.size }), ju(r, { dir: "right", size: e.size })) : r; -} -const ld = /* @__PURE__ */ BigInt(2 ** 32 - 1), L2 = /* @__PURE__ */ BigInt(32); -function FD(t, e = !1) { - return e ? { h: Number(t & ld), l: Number(t >> L2 & ld) } : { h: Number(t >> L2 & ld) | 0, l: Number(t & ld) | 0 }; -} -function jD(t, e = !1) { - const r = t.length; - let n = new Uint32Array(r), i = new Uint32Array(r); - for (let s = 0; s < r; s++) { - const { h: o, l: a } = FD(t[s], e); - [n[s], i[s]] = [o, a]; - } - return [n, i]; -} -const UD = (t, e, r) => t << r | e >>> 32 - r, qD = (t, e, r) => e << r | t >>> 32 - r, zD = (t, e, r) => e << r - 32 | t >>> 64 - r, WD = (t, e, r) => t << r - 32 | e >>> 64 - r, Zc = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0; -/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -function HD(t) { - return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array"; -} -function r0(t) { - if (!Number.isSafeInteger(t) || t < 0) - throw new Error("positive integer expected, got " + t); -} -function mc(t, ...e) { - if (!HD(t)) - throw new Error("Uint8Array expected"); - e.length > 0; -} -function Xse(t) { - if (typeof t != "function" || typeof t.create != "function") - throw new Error("Hash should be wrapped by utils.createHasher"); - r0(t.outputLen), r0(t.blockLen); -} -function n0(t, e = !0) { - if (t.destroyed) - throw new Error("Hash instance has been destroyed"); - if (e && t.finished) - throw new Error("Hash#digest() has already been called"); -} -function H5(t, e) { - mc(t); - const r = e.outputLen; - if (t.length < r) - throw new Error("digestInto() expects output buffer of length at least " + r); -} -function KD(t) { - return new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)); -} -function cl(...t) { - for (let e = 0; e < t.length; e++) - t[e].fill(0); -} -function Zg(t) { - return new DataView(t.buffer, t.byteOffset, t.byteLength); -} -function $s(t, e) { - return t << 32 - e | t >>> e; -} -const VD = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68; -function GD(t) { - return t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255; -} -function YD(t) { - for (let e = 0; e < t.length; e++) - t[e] = GD(t[e]); - return t; -} -const k2 = VD ? (t) => t : YD, K5 = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", JD = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0")); -function XD(t) { - if (mc(t), K5) - return t.toHex(); - let e = ""; - for (let r = 0; r < t.length; r++) - e += JD[t[r]]; - return e; -} -const yo = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 }; -function $2(t) { - if (t >= yo._0 && t <= yo._9) - return t - yo._0; - if (t >= yo.A && t <= yo.F) - return t - (yo.A - 10); - if (t >= yo.a && t <= yo.f) - return t - (yo.a - 10); -} -function Zse(t) { - if (typeof t != "string") - throw new Error("hex string expected, got " + typeof t); - if (K5) - return Uint8Array.fromHex(t); - const e = t.length, r = e / 2; - if (e % 2) - throw new Error("hex string expected, got unpadded hex of length " + e); - const n = new Uint8Array(r); - for (let i = 0, s = 0; i < r; i++, s += 2) { - const o = $2(t.charCodeAt(s)), a = $2(t.charCodeAt(s + 1)); - if (o === void 0 || a === void 0) { - const u = t[s] + t[s + 1]; - throw new Error('hex string expected, got non-hex character "' + u + '" at index ' + s); - } - n[i] = o * 16 + a; - } - return n; -} -function ZD(t) { - if (typeof t != "string") - throw new Error("string expected"); - return new Uint8Array(new TextEncoder().encode(t)); -} -function q0(t) { - return typeof t == "string" && (t = ZD(t)), mc(t), t; -} -function Qse(...t) { - let e = 0; - for (let n = 0; n < t.length; n++) { - const i = t[n]; - mc(i), e += i.length; - } - const r = new Uint8Array(e); - for (let n = 0, i = 0; n < t.length; n++) { - const s = t[n]; - r.set(s, i), i += s.length; - } - return r; -} -class V5 { -} -function G5(t) { - const e = (n) => t().update(q0(n)).digest(), r = t(); - return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = () => t(), e; -} -function QD(t) { - const e = (n, i) => t(i).update(q0(n)).digest(), r = t({}); - return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = (n) => t(n), e; -} -function eoe(t = 32) { - if (Zc && typeof Zc.getRandomValues == "function") - return Zc.getRandomValues(new Uint8Array(t)); - if (Zc && typeof Zc.randomBytes == "function") - return Uint8Array.from(Zc.randomBytes(t)); - throw new Error("crypto.getRandomValues must be defined"); -} -const eO = BigInt(0), Mf = BigInt(1), tO = BigInt(2), rO = BigInt(7), nO = BigInt(256), iO = BigInt(113), Y5 = [], J5 = [], X5 = []; -for (let t = 0, e = Mf, r = 1, n = 0; t < 24; t++) { - [r, n] = [n, (2 * r + 3 * n) % 5], Y5.push(2 * (5 * n + r)), J5.push((t + 1) * (t + 2) / 2 % 64); - let i = eO; - for (let s = 0; s < 7; s++) - e = (e << Mf ^ (e >> rO) * iO) % nO, e & tO && (i ^= Mf << (Mf << /* @__PURE__ */ BigInt(s)) - Mf); - X5.push(i); -} -const Z5 = jD(X5, !0), sO = Z5[0], oO = Z5[1], B2 = (t, e, r) => r > 32 ? zD(t, e, r) : UD(t, e, r), F2 = (t, e, r) => r > 32 ? WD(t, e, r) : qD(t, e, r); -function Q5(t, e = 24) { - const r = new Uint32Array(10); - for (let n = 24 - e; n < 24; n++) { - for (let o = 0; o < 10; o++) - r[o] = t[o] ^ t[o + 10] ^ t[o + 20] ^ t[o + 30] ^ t[o + 40]; - for (let o = 0; o < 10; o += 2) { - const a = (o + 8) % 10, u = (o + 2) % 10, l = r[u], d = r[u + 1], p = B2(l, d, 1) ^ r[a], w = F2(l, d, 1) ^ r[a + 1]; - for (let _ = 0; _ < 50; _ += 10) - t[o + _] ^= p, t[o + _ + 1] ^= w; - } - let i = t[2], s = t[3]; - for (let o = 0; o < 24; o++) { - const a = J5[o], u = B2(i, s, a), l = F2(i, s, a), d = Y5[o]; - i = t[d], s = t[d + 1], t[d] = u, t[d + 1] = l; - } - for (let o = 0; o < 50; o += 10) { - for (let a = 0; a < 10; a++) - r[a] = t[o + a]; - for (let a = 0; a < 10; a++) - t[o + a] ^= ~r[(a + 2) % 10] & r[(a + 4) % 10]; - } - t[0] ^= sO[n], t[1] ^= oO[n]; - } - cl(r); -} -class Kl extends V5 { - // NOTE: we accept arguments in bytes instead of bits here. - constructor(e, r, n, i = !1, s = 24) { - if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = r, this.outputLen = n, this.enableXOF = i, this.rounds = s, r0(n), !(0 < e && e < 200)) - throw new Error("only keccak-f1600 function is supported"); - this.state = new Uint8Array(200), this.state32 = KD(this.state); - } - clone() { - return this._cloneInto(); - } - keccak() { - k2(this.state32), Q5(this.state32, this.rounds), k2(this.state32), this.posOut = 0, this.pos = 0; - } - update(e) { - n0(this), e = q0(e), mc(e); - const { blockLen: r, state: n } = this, i = e.length; - for (let s = 0; s < i; ) { - const o = Math.min(r - this.pos, i - s); - for (let a = 0; a < o; a++) - n[this.pos++] ^= e[s++]; - this.pos === r && this.keccak(); - } - return this; - } - finish() { - if (this.finished) - return; - this.finished = !0; - const { state: e, suffix: r, pos: n, blockLen: i } = this; - e[n] ^= r, r & 128 && n === i - 1 && this.keccak(), e[i - 1] ^= 128, this.keccak(); - } - writeInto(e) { - n0(this, !1), mc(e), this.finish(); - const r = this.state, { blockLen: n } = this; - for (let i = 0, s = e.length; i < s; ) { - this.posOut >= n && this.keccak(); - const o = Math.min(n - this.posOut, s - i); - e.set(r.subarray(this.posOut, this.posOut + o), i), this.posOut += o, i += o; - } - return e; - } - xofInto(e) { - if (!this.enableXOF) - throw new Error("XOF is not possible for this instance"); - return this.writeInto(e); - } - xof(e) { - return r0(e), this.xofInto(new Uint8Array(e)); - } - digestInto(e) { - if (H5(e, this), this.finished) - throw new Error("digest() was already called"); - return this.writeInto(e), this.destroy(), e; - } - digest() { - return this.digestInto(new Uint8Array(this.outputLen)); - } - destroy() { - this.destroyed = !0, cl(this.state); - } - _cloneInto(e) { - const { blockLen: r, suffix: n, outputLen: i, rounds: s, enableXOF: o } = this; - return e || (e = new Kl(r, n, i, o, s)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = s, e.suffix = n, e.outputLen = i, e.enableXOF = o, e.destroyed = this.destroyed, e; - } -} -const Ra = (t, e, r) => G5(() => new Kl(e, t, r)), aO = Ra(6, 144, 224 / 8), cO = Ra(6, 136, 256 / 8), uO = Ra(6, 104, 384 / 8), fO = Ra(6, 72, 512 / 8), lO = Ra(1, 144, 224 / 8), e4 = Ra(1, 136, 256 / 8), hO = Ra(1, 104, 384 / 8), dO = Ra(1, 72, 512 / 8), t4 = (t, e, r) => QD((n = {}) => new Kl(e, t, n.dkLen === void 0 ? r : n.dkLen, !0)), pO = t4(31, 168, 128 / 8), gO = t4(31, 136, 256 / 8), mO = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - Keccak: Kl, - keccakP: Q5, - keccak_224: lO, - keccak_256: e4, - keccak_384: hO, - keccak_512: dO, - sha3_224: aO, - sha3_256: cO, - sha3_384: uO, - sha3_512: fO, - shake128: pO, - shake256: gO -}, Symbol.toStringTag, { value: "Module" })); -function z0(t, e) { - const r = e || "hex", n = e4(ya(t, { strict: !1 }) ? Bv(t) : t); - return r === "bytes" ? n : t0(n); -} -const vO = (t) => z0(Bv(t)); -function bO(t) { - return vO(t); -} -function yO(t) { - let e = !0, r = "", n = 0, i = "", s = !1; - for (let o = 0; o < t.length; o++) { - const a = t[o]; - if (["(", ")", ","].includes(a) && (e = !0), a === "(" && n++, a === ")" && n--, !!e) { - if (n === 0) { - if (a === " " && ["event", "function", ""].includes(i)) - i = ""; - else if (i += a, a === ")") { - s = !0; - break; - } - continue; - } - if (a === " ") { - t[o - 1] !== "," && r !== "," && r !== ",(" && (r = "", e = !1); - continue; - } - i += a, r += a; - } - } - if (!s) - throw new gt("Unable to normalize signature."); - return i; -} -const wO = (t) => { - const e = typeof t == "string" ? t : bD(t); - return yO(e); -}; -function r4(t) { - return bO(wO(t)); -} -const xO = r4; -class _a extends gt { - constructor({ address: e }) { - super(`Address "${e}" is invalid.`, { - metaMessages: [ - "- Address must be a hex value of 20 bytes (40 hex characters).", - "- Address must match its checksum counterpart." - ], - name: "InvalidAddressError" - }); - } -} -class W0 extends Map { - constructor(e) { - super(), Object.defineProperty(this, "maxSize", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), this.maxSize = e; - } - get(e) { - const r = super.get(e); - return super.has(e) && r !== void 0 && (this.delete(e), super.set(e, r)), r; - } - set(e, r) { - if (super.set(e, r), this.maxSize && this.size > this.maxSize) { - const n = this.keys().next().value; - n && this.delete(n); - } - return this; - } -} -const Qg = /* @__PURE__ */ new W0(8192); -function Vl(t, e) { - if (Qg.has(`${t}.${e}`)) - return Qg.get(`${t}.${e}`); - const r = t.substring(2).toLowerCase(), n = z0(W5(r), "bytes"), i = r.split(""); - for (let o = 0; o < 40; o += 2) - n[o >> 1] >> 4 >= 8 && i[o] && (i[o] = i[o].toUpperCase()), (n[o >> 1] & 15) >= 8 && i[o + 1] && (i[o + 1] = i[o + 1].toUpperCase()); - const s = `0x${i.join("")}`; - return Qg.set(`${t}.${e}`, s), s; -} -function Fv(t, e) { - if (!Ms(t, { strict: !1 })) - throw new _a({ address: t }); - return Vl(t, e); -} -const _O = /^0x[a-fA-F0-9]{40}$/, em = /* @__PURE__ */ new W0(8192); -function Ms(t, e) { - const { strict: r = !0 } = e ?? {}, n = `${t}.${r}`; - if (em.has(n)) - return em.get(n); - const i = _O.test(t) ? t.toLowerCase() === t ? !0 : r ? Vl(t) === t : !0 : !1; - return em.set(n, i), i; -} -function Ea(t) { - return typeof t[0] == "string" ? H0(t) : EO(t); -} -function EO(t) { - let e = 0; - for (const i of t) - e += i.length; - const r = new Uint8Array(e); - let n = 0; - for (const i of t) - r.set(i, n), n += i.length; - return r; -} -function H0(t) { - return `0x${t.reduce((e, r) => e + r.replace("0x", ""), "")}`; -} -function i0(t, e, r, { strict: n } = {}) { - return ya(t, { strict: !1 }) ? l1(t, e, r, { - strict: n - }) : s4(t, e, r, { - strict: n - }); -} -function n4(t, e) { - if (typeof e == "number" && e > 0 && e > xn(t) - 1) - throw new j5({ - offset: e, - position: "start", - size: xn(t) - }); -} -function i4(t, e, r) { - if (typeof e == "number" && typeof r == "number" && xn(t) !== r - e) - throw new j5({ - offset: r, - position: "end", - size: xn(t) - }); -} -function s4(t, e, r, { strict: n } = {}) { - n4(t, e); - const i = t.slice(e, r); - return n && i4(i, e, r), i; -} -function l1(t, e, r, { strict: n } = {}) { - n4(t, e); - const i = `0x${t.replace("0x", "").slice((e ?? 0) * 2, (r ?? t.length) * 2)}`; - return n && i4(i, e, r), i; -} -const SO = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, o4 = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/; -function a4(t, e) { - if (t.length !== e.length) - throw new SD({ - expectedLength: t.length, - givenLength: e.length - }); - const r = AO({ - params: t, - values: e - }), n = Uv(r); - return n.length === 0 ? "0x" : n; -} -function AO({ params: t, values: e }) { - const r = []; - for (let n = 0; n < t.length; n++) - r.push(jv({ param: t[n], value: e[n] })); - return r; -} -function jv({ param: t, value: e }) { - const r = qv(t.type); - if (r) { - const [n, i] = r; - return MO(e, { length: n, param: { ...t, type: i } }); - } - if (t.type === "tuple") - return DO(e, { - param: t - }); - if (t.type === "address") - return PO(e); - if (t.type === "bool") - return CO(e); - if (t.type.startsWith("uint") || t.type.startsWith("int")) { - const n = t.type.startsWith("int"), [, , i = "256"] = o4.exec(t.type) ?? []; - return TO(e, { - signed: n, - size: Number(i) - }); - } - if (t.type.startsWith("bytes")) - return IO(e, { param: t }); - if (t.type === "string") - return RO(e); - throw new MD(t.type, { - docsPath: "/docs/contract/encodeAbiParameters" - }); -} -function Uv(t) { - let e = 0; - for (let s = 0; s < t.length; s++) { - const { dynamic: o, encoded: a } = t[s]; - o ? e += 32 : e += xn(a); - } - const r = [], n = []; - let i = 0; - for (let s = 0; s < t.length; s++) { - const { dynamic: o, encoded: a } = t[s]; - o ? (r.push(vr(e + i, { size: 32 })), n.push(a), i += xn(a)) : r.push(a); - } - return Ea([...r, ...n]); -} -function PO(t) { - if (!Ms(t)) - throw new _a({ address: t }); - return { dynamic: !1, encoded: ba(t.toLowerCase()) }; -} -function MO(t, { length: e, param: r }) { - const n = e === null; - if (!Array.isArray(t)) - throw new CD(t); - if (!n && t.length !== e) - throw new _D({ - expectedLength: e, - givenLength: t.length, - type: `${r.type}[${e}]` - }); - let i = !1; - const s = []; - for (let o = 0; o < t.length; o++) { - const a = jv({ param: r, value: t[o] }); - a.dynamic && (i = !0), s.push(a); - } - if (n || i) { - const o = Uv(s); - if (n) { - const a = vr(s.length, { size: 32 }); - return { - dynamic: !0, - encoded: s.length > 0 ? Ea([a, o]) : a - }; - } - if (i) - return { dynamic: !0, encoded: o }; - } - return { - dynamic: !1, - encoded: Ea(s.map(({ encoded: o }) => o)) - }; -} -function IO(t, { param: e }) { - const [, r] = e.type.split("bytes"), n = xn(t); - if (!r) { - let i = t; - return n % 32 !== 0 && (i = ba(i, { - dir: "right", - size: Math.ceil((t.length - 2) / 2 / 32) * 32 - })), { - dynamic: !0, - encoded: Ea([ba(vr(n, { size: 32 })), i]) - }; - } - if (n !== Number.parseInt(r)) - throw new ED({ - expectedSize: Number.parseInt(r), - value: t - }); - return { dynamic: !1, encoded: ba(t, { dir: "right" }) }; -} -function CO(t) { - if (typeof t != "boolean") - throw new gt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`); - return { dynamic: !1, encoded: ba(z5(t)) }; -} -function TO(t, { signed: e, size: r = 256 }) { - if (typeof r == "number") { - const n = 2n ** (BigInt(r) - (e ? 1n : 0n)) - 1n, i = e ? -n - 1n : 0n; - if (t > n || t < i) - throw new q5({ - max: n.toString(), - min: i.toString(), - signed: e, - size: r / 8, - value: t.toString() - }); - } - return { - dynamic: !1, - encoded: vr(t, { - size: 32, - signed: e - }) - }; -} -function RO(t) { - const e = U0(t), r = Math.ceil(xn(e) / 32), n = []; - for (let i = 0; i < r; i++) - n.push(ba(i0(e, i * 32, (i + 1) * 32), { - dir: "right" - })); - return { - dynamic: !0, - encoded: Ea([ - ba(vr(xn(e), { size: 32 })), - ...n - ]) - }; -} -function DO(t, { param: e }) { - let r = !1; - const n = []; - for (let i = 0; i < e.components.length; i++) { - const s = e.components[i], o = Array.isArray(t) ? i : s.name, a = jv({ - param: s, - value: t[o] - }); - n.push(a), a.dynamic && (r = !0); - } - return { - dynamic: r, - encoded: r ? Uv(n) : Ea(n.map(({ encoded: i }) => i)) - }; -} -function qv(t) { - const e = t.match(/^(.*)\[(\d+)?\]$/); - return e ? ( - // Return `null` if the array is dynamic. - [e[2] ? Number(e[2]) : null, e[1]] - ) : void 0; -} -const zv = (t) => i0(r4(t), 0, 4); -function c4(t) { - const { abi: e, args: r = [], name: n } = t, i = ya(n, { strict: !1 }), s = e.filter((a) => i ? a.type === "function" ? zv(a) === n : a.type === "event" ? xO(a) === n : !1 : "name" in a && a.name === n); - if (s.length === 0) - return; - if (s.length === 1) - return s[0]; - let o; - for (const a of s) { - if (!("inputs" in a)) - continue; - if (!r || r.length === 0) { - if (!a.inputs || a.inputs.length === 0) - return a; - continue; - } - if (!a.inputs || a.inputs.length === 0 || a.inputs.length !== r.length) - continue; - if (r.every((l, d) => { - const p = "inputs" in a && a.inputs[d]; - return p ? h1(l, p) : !1; - })) { - if (o && "inputs" in o && o.inputs) { - const l = u4(a.inputs, o.inputs, r); - if (l) - throw new AD({ - abiItem: a, - type: l[0] - }, { - abiItem: o, - type: l[1] - }); - } - o = a; - } - } - return o || s[0]; -} -function h1(t, e) { - const r = typeof t, n = e.type; - switch (n) { - case "address": - return Ms(t, { strict: !1 }); - case "bool": - return r === "boolean"; - case "function": - return r === "string"; - case "string": - return r === "string"; - default: - return n === "tuple" && "components" in e ? Object.values(e.components).every((i, s) => h1(Object.values(t)[s], i)) : /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n) ? r === "number" || r === "bigint" : /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n) ? r === "string" || t instanceof Uint8Array : /[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n) ? Array.isArray(t) && t.every((i) => h1(i, { - ...e, - // Pop off `[]` or `[M]` from end of type - type: n.replace(/(\[[0-9]{0,}\])$/, "") - })) : !1; - } -} -function u4(t, e, r) { - for (const n in t) { - const i = t[n], s = e[n]; - if (i.type === "tuple" && s.type === "tuple" && "components" in i && "components" in s) - return u4(i.components, s.components, r[n]); - const o = [i.type, s.type]; - if (o.includes("address") && o.includes("bytes20") ? !0 : o.includes("address") && o.includes("string") ? Ms(r[n], { strict: !1 }) : o.includes("address") && o.includes("bytes") ? Ms(r[n], { strict: !1 }) : !1) - return o; - } -} -function _i(t) { - return typeof t == "string" ? { address: t, type: "json-rpc" } : t; -} -const j2 = "/docs/contract/encodeFunctionData"; -function OO(t) { - const { abi: e, args: r, functionName: n } = t; - let i = e[0]; - if (n) { - const s = c4({ - abi: e, - args: r, - name: n - }); - if (!s) - throw new D2(n, { docsPath: j2 }); - i = s; - } - if (i.type !== "function") - throw new D2(void 0, { docsPath: j2 }); - return { - abi: [i], - functionName: zv(Iu(i)) - }; -} -function f4(t) { - const { args: e } = t, { abi: r, functionName: n } = (() => { - var a; - return t.abi.length === 1 && ((a = t.functionName) != null && a.startsWith("0x")) ? t : OO(t); - })(), i = r[0], s = n, o = "inputs" in i && i.inputs ? a4(i.inputs, e ?? []) : void 0; - return H0([s, o ?? "0x"]); -} -const NO = { - 1: "An `assert` condition failed.", - 17: "Arithmetic operation resulted in underflow or overflow.", - 18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).", - 33: "Attempted to convert to an invalid type.", - 34: "Attempted to access a storage byte array that is incorrectly encoded.", - 49: "Performed `.pop()` on an empty array", - 50: "Array index is out of bounds.", - 65: "Allocated too much memory or created an array which is too large.", - 81: "Attempted to call a zero-initialized variable of internal function type." -}, LO = { - inputs: [ - { - name: "message", - type: "string" - } - ], - name: "Error", - type: "error" -}, kO = { - inputs: [ - { - name: "reason", - type: "uint256" - } - ], - name: "Panic", - type: "error" -}; -class U2 extends gt { - constructor({ offset: e }) { - super(`Offset \`${e}\` cannot be negative.`, { - name: "NegativeOffsetError" - }); - } -} -class $O extends gt { - constructor({ length: e, position: r }) { - super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`, { name: "PositionOutOfBoundsError" }); - } -} -class BO extends gt { - constructor({ count: e, limit: r }) { - super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`, { name: "RecursiveReadLimitExceededError" }); - } -} -const FO = { - bytes: new Uint8Array(), - dataView: new DataView(new ArrayBuffer(0)), - position: 0, - positionReadCount: /* @__PURE__ */ new Map(), - recursiveReadCount: 0, - recursiveReadLimit: Number.POSITIVE_INFINITY, - assertReadLimit() { - if (this.recursiveReadCount >= this.recursiveReadLimit) - throw new BO({ - count: this.recursiveReadCount + 1, - limit: this.recursiveReadLimit - }); - }, - assertPosition(t) { - if (t < 0 || t > this.bytes.length - 1) - throw new $O({ - length: this.bytes.length, - position: t - }); - }, - decrementPosition(t) { - if (t < 0) - throw new U2({ offset: t }); - const e = this.position - t; - this.assertPosition(e), this.position = e; - }, - getReadCount(t) { - return this.positionReadCount.get(t || this.position) || 0; - }, - incrementPosition(t) { - if (t < 0) - throw new U2({ offset: t }); - const e = this.position + t; - this.assertPosition(e), this.position = e; - }, - inspectByte(t) { - const e = t ?? this.position; - return this.assertPosition(e), this.bytes[e]; - }, - inspectBytes(t, e) { - const r = e ?? this.position; - return this.assertPosition(r + t - 1), this.bytes.subarray(r, r + t); - }, - inspectUint8(t) { - const e = t ?? this.position; - return this.assertPosition(e), this.bytes[e]; - }, - inspectUint16(t) { - const e = t ?? this.position; - return this.assertPosition(e + 1), this.dataView.getUint16(e); - }, - inspectUint24(t) { - const e = t ?? this.position; - return this.assertPosition(e + 2), (this.dataView.getUint16(e) << 8) + this.dataView.getUint8(e + 2); - }, - inspectUint32(t) { - const e = t ?? this.position; - return this.assertPosition(e + 3), this.dataView.getUint32(e); - }, - pushByte(t) { - this.assertPosition(this.position), this.bytes[this.position] = t, this.position++; - }, - pushBytes(t) { - this.assertPosition(this.position + t.length - 1), this.bytes.set(t, this.position), this.position += t.length; - }, - pushUint8(t) { - this.assertPosition(this.position), this.bytes[this.position] = t, this.position++; - }, - pushUint16(t) { - this.assertPosition(this.position + 1), this.dataView.setUint16(this.position, t), this.position += 2; - }, - pushUint24(t) { - this.assertPosition(this.position + 2), this.dataView.setUint16(this.position, t >> 8), this.dataView.setUint8(this.position + 2, t & 255), this.position += 3; - }, - pushUint32(t) { - this.assertPosition(this.position + 3), this.dataView.setUint32(this.position, t), this.position += 4; - }, - readByte() { - this.assertReadLimit(), this._touch(); - const t = this.inspectByte(); - return this.position++, t; - }, - readBytes(t, e) { - this.assertReadLimit(), this._touch(); - const r = this.inspectBytes(t); - return this.position += e ?? t, r; - }, - readUint8() { - this.assertReadLimit(), this._touch(); - const t = this.inspectUint8(); - return this.position += 1, t; - }, - readUint16() { - this.assertReadLimit(), this._touch(); - const t = this.inspectUint16(); - return this.position += 2, t; - }, - readUint24() { - this.assertReadLimit(), this._touch(); - const t = this.inspectUint24(); - return this.position += 3, t; - }, - readUint32() { - this.assertReadLimit(), this._touch(); - const t = this.inspectUint32(); - return this.position += 4, t; - }, - get remaining() { - return this.bytes.length - this.position; - }, - setPosition(t) { - const e = this.position; - return this.assertPosition(t), this.position = t, () => this.position = e; - }, - _touch() { - if (this.recursiveReadLimit === Number.POSITIVE_INFINITY) - return; - const t = this.getReadCount(); - this.positionReadCount.set(this.position, t + 1), t > 0 && this.recursiveReadCount++; - } -}; -function Wv(t, { recursiveReadLimit: e = 8192 } = {}) { - const r = Object.create(FO); - return r.bytes = t, r.dataView = new DataView(t.buffer, t.byteOffset, t.byteLength), r.positionReadCount = /* @__PURE__ */ new Map(), r.recursiveReadLimit = e, r; -} -function jO(t, e = {}) { - typeof e.size < "u" && io(t, { size: e.size }); - const r = xi(t, e); - return wa(r, e); -} -function UO(t, e = {}) { - let r = t; - if (typeof e.size < "u" && (io(r, { size: e.size }), r = j0(r)), r.length > 1 || r[0] > 1) - throw new DD(r); - return !!r[0]; -} -function Do(t, e = {}) { - typeof e.size < "u" && io(t, { size: e.size }); - const r = xi(t, e); - return xa(r, e); -} -function qO(t, e = {}) { - let r = t; - return typeof e.size < "u" && (io(r, { size: e.size }), r = j0(r, { dir: "right" })), new TextDecoder().decode(r); -} -function zO(t, e) { - const r = typeof e == "string" ? Fo(e) : e, n = Wv(r); - if (xn(r) === 0 && t.length > 0) - throw new $v(); - if (xn(e) && xn(e) < 32) - throw new xD({ - data: typeof e == "string" ? e : xi(e), - params: t, - size: xn(e) - }); - let i = 0; - const s = []; - for (let o = 0; o < t.length; ++o) { - const a = t[o]; - n.setPosition(i); - const [u, l] = vu(n, a, { - staticPosition: 0 - }); - i += l, s.push(u); - } - return s; -} -function vu(t, e, { staticPosition: r }) { - const n = qv(e.type); - if (n) { - const [i, s] = n; - return HO(t, { ...e, type: s }, { length: i, staticPosition: r }); - } - if (e.type === "tuple") - return YO(t, e, { staticPosition: r }); - if (e.type === "address") - return WO(t); - if (e.type === "bool") - return KO(t); - if (e.type.startsWith("bytes")) - return VO(t, e, { staticPosition: r }); - if (e.type.startsWith("uint") || e.type.startsWith("int")) - return GO(t, e); - if (e.type === "string") - return JO(t, { staticPosition: r }); - throw new ID(e.type, { - docsPath: "/docs/contract/decodeAbiParameters" - }); -} -const q2 = 32, d1 = 32; -function WO(t) { - const e = t.readBytes(32); - return [Vl(xi(s4(e, -20))), 32]; -} -function HO(t, e, { length: r, staticPosition: n }) { - if (!r) { - const o = Do(t.readBytes(d1)), a = n + o, u = a + q2; - t.setPosition(a); - const l = Do(t.readBytes(q2)), d = ul(e); - let p = 0; - const w = []; - for (let _ = 0; _ < l; ++_) { - t.setPosition(u + (d ? _ * 32 : p)); - const [P, O] = vu(t, e, { - staticPosition: u - }); - p += O, w.push(P); - } - return t.setPosition(n + 32), [w, 32]; - } - if (ul(e)) { - const o = Do(t.readBytes(d1)), a = n + o, u = []; - for (let l = 0; l < r; ++l) { - t.setPosition(a + l * 32); - const [d] = vu(t, e, { - staticPosition: a - }); - u.push(d); - } - return t.setPosition(n + 32), [u, 32]; - } - let i = 0; - const s = []; - for (let o = 0; o < r; ++o) { - const [a, u] = vu(t, e, { - staticPosition: n + i - }); - i += u, s.push(a); - } - return [s, i]; -} -function KO(t) { - return [UO(t.readBytes(32), { size: 32 }), 32]; -} -function VO(t, e, { staticPosition: r }) { - const [n, i] = e.type.split("bytes"); - if (!i) { - const o = Do(t.readBytes(32)); - t.setPosition(r + o); - const a = Do(t.readBytes(32)); - if (a === 0) - return t.setPosition(r + 32), ["0x", 32]; - const u = t.readBytes(a); - return t.setPosition(r + 32), [xi(u), 32]; - } - return [xi(t.readBytes(Number.parseInt(i), 32)), 32]; -} -function GO(t, e) { - const r = e.type.startsWith("int"), n = Number.parseInt(e.type.split("int")[1] || "256"), i = t.readBytes(32); - return [ - n > 48 ? jO(i, { signed: r }) : Do(i, { signed: r }), - 32 - ]; -} -function YO(t, e, { staticPosition: r }) { - const n = e.components.length === 0 || e.components.some(({ name: o }) => !o), i = n ? [] : {}; - let s = 0; - if (ul(e)) { - const o = Do(t.readBytes(d1)), a = r + o; - for (let u = 0; u < e.components.length; ++u) { - const l = e.components[u]; - t.setPosition(a + s); - const [d, p] = vu(t, l, { - staticPosition: a - }); - s += p, i[n ? u : l == null ? void 0 : l.name] = d; - } - return t.setPosition(r + 32), [i, 32]; - } - for (let o = 0; o < e.components.length; ++o) { - const a = e.components[o], [u, l] = vu(t, a, { - staticPosition: r - }); - i[n ? o : a == null ? void 0 : a.name] = u, s += l; - } - return [i, s]; -} -function JO(t, { staticPosition: e }) { - const r = Do(t.readBytes(32)), n = e + r; - t.setPosition(n); - const i = Do(t.readBytes(32)); - if (i === 0) - return t.setPosition(e + 32), ["", 32]; - const s = t.readBytes(i, 32), o = qO(j0(s)); - return t.setPosition(e + 32), [o, 32]; -} -function ul(t) { - var n; - const { type: e } = t; - if (e === "string" || e === "bytes" || e.endsWith("[]")) - return !0; - if (e === "tuple") - return (n = t.components) == null ? void 0 : n.some(ul); - const r = qv(t.type); - return !!(r && ul({ ...t, type: r[1] })); -} -function XO(t) { - const { abi: e, data: r } = t, n = i0(r, 0, 4); - if (n === "0x") - throw new $v(); - const s = [...e || [], LO, kO].find((o) => o.type === "error" && n === zv(Iu(o))); - if (!s) - throw new F5(n, { - docsPath: "/docs/contract/decodeErrorResult" - }); - return { - abiItem: s, - args: "inputs" in s && s.inputs && s.inputs.length > 0 ? zO(s.inputs, i0(r, 4)) : void 0, - errorName: s.name - }; -} -const Ac = (t, e, r) => JSON.stringify(t, (n, i) => typeof i == "bigint" ? i.toString() : i, r); -function l4({ abiItem: t, args: e, includeFunctionName: r = !0, includeName: n = !1 }) { - if ("name" in t && "inputs" in t && t.inputs) - return `${r ? t.name : ""}(${t.inputs.map((i, s) => `${n && i.name ? `${i.name}: ` : ""}${typeof e[s] == "object" ? Ac(e[s]) : e[s]}`).join(", ")})`; -} -const ZO = { - gwei: 9, - wei: 18 -}, QO = { - ether: -9, - wei: 9 -}; -function h4(t, e) { - let r = t.toString(); - const n = r.startsWith("-"); - n && (r = r.slice(1)), r = r.padStart(e, "0"); - let [i, s] = [ - r.slice(0, r.length - e), - r.slice(r.length - e) - ]; - return s = s.replace(/(0+)$/, ""), `${n ? "-" : ""}${i || "0"}${s ? `.${s}` : ""}`; -} -function d4(t, e = "wei") { - return h4(t, ZO[e]); -} -function Ps(t, e = "wei") { - return h4(t, QO[e]); -} -class eN extends gt { - constructor({ address: e }) { - super(`State for account "${e}" is set multiple times.`, { - name: "AccountStateConflictError" - }); - } -} -class tN extends gt { - constructor() { - super("state and stateDiff are set on the same account.", { - name: "StateAssignmentConflictError" - }); - } -} -function K0(t) { - const e = Object.entries(t).map(([n, i]) => i === void 0 || i === !1 ? null : [n, i]).filter(Boolean), r = e.reduce((n, [i]) => Math.max(n, i.length), 0); - return e.map(([n, i]) => ` ${`${n}:`.padEnd(r + 1)} ${i}`).join(` -`); -} -class rN extends gt { - constructor() { - super([ - "Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.", - "Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others." - ].join(` -`), { name: "FeeConflictError" }); - } -} -class nN extends gt { - constructor({ transaction: e }) { - super("Cannot infer a transaction type from provided transaction.", { - metaMessages: [ - "Provided Transaction:", - "{", - K0(e), - "}", - "", - "To infer the type, either provide:", - "- a `type` to the Transaction, or", - "- an EIP-1559 Transaction with `maxFeePerGas`, or", - "- an EIP-2930 Transaction with `gasPrice` & `accessList`, or", - "- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or", - "- an EIP-7702 Transaction with `authorizationList`, or", - "- a Legacy Transaction with `gasPrice`" - ], - name: "InvalidSerializableTransactionError" - }); - } -} -class iN extends gt { - constructor(e, { account: r, docsPath: n, chain: i, data: s, gas: o, gasPrice: a, maxFeePerGas: u, maxPriorityFeePerGas: l, nonce: d, to: p, value: w }) { - var P; - const _ = K0({ - chain: i && `${i == null ? void 0 : i.name} (id: ${i == null ? void 0 : i.id})`, - from: r == null ? void 0 : r.address, - to: p, - value: typeof w < "u" && `${d4(w)} ${((P = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : P.symbol) || "ETH"}`, - data: s, - gas: o, - gasPrice: typeof a < "u" && `${Ps(a)} gwei`, - maxFeePerGas: typeof u < "u" && `${Ps(u)} gwei`, - maxPriorityFeePerGas: typeof l < "u" && `${Ps(l)} gwei`, - nonce: d - }); - super(e.shortMessage, { - cause: e, - docsPath: n, - metaMessages: [ - ...e.metaMessages ? [...e.metaMessages, " "] : [], - "Request Arguments:", - _ - ].filter(Boolean), - name: "TransactionExecutionError" - }), Object.defineProperty(this, "cause", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), this.cause = e; - } -} -const sN = (t) => t, p4 = (t) => t; -class oN extends gt { - constructor(e, { abi: r, args: n, contractAddress: i, docsPath: s, functionName: o, sender: a }) { - const u = c4({ abi: r, args: n, name: o }), l = u ? l4({ - abiItem: u, - args: n, - includeFunctionName: !1, - includeName: !1 - }) : void 0, d = u ? Iu(u, { includeName: !0 }) : void 0, p = K0({ - address: i && sN(i), - function: d, - args: l && l !== "()" && `${[...Array((o == null ? void 0 : o.length) ?? 0).keys()].map(() => " ").join("")}${l}`, - sender: a - }); - super(e.shortMessage || `An unknown error occurred while executing the contract function "${o}".`, { - cause: e, - docsPath: s, - metaMessages: [ - ...e.metaMessages ? [...e.metaMessages, " "] : [], - p && "Contract Call:", - p - ].filter(Boolean), - name: "ContractFunctionExecutionError" - }), Object.defineProperty(this, "abi", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "args", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "cause", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "contractAddress", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "formattedArgs", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "functionName", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "sender", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), this.abi = r, this.args = n, this.cause = e, this.contractAddress = i, this.functionName = o, this.sender = a; - } -} -class aN extends gt { - constructor({ abi: e, data: r, functionName: n, message: i }) { - let s, o, a, u; - if (r && r !== "0x") - try { - o = XO({ abi: e, data: r }); - const { abiItem: d, errorName: p, args: w } = o; - if (p === "Error") - u = w[0]; - else if (p === "Panic") { - const [_] = w; - u = NO[_]; - } else { - const _ = d ? Iu(d, { includeName: !0 }) : void 0, P = d && w ? l4({ - abiItem: d, - args: w, - includeFunctionName: !1, - includeName: !1 - }) : void 0; - a = [ - _ ? `Error: ${_}` : "", - P && P !== "()" ? ` ${[...Array((p == null ? void 0 : p.length) ?? 0).keys()].map(() => " ").join("")}${P}` : "" - ]; - } - } catch (d) { - s = d; - } - else i && (u = i); - let l; - s instanceof F5 && (l = s.signature, a = [ - `Unable to decode signature "${l}" as it was not found on the provided ABI.`, - "Make sure you are using the correct ABI and that the error exists on it.", - `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.` - ]), super(u && u !== "execution reverted" || l ? [ - `The contract function "${n}" reverted with the following ${l ? "signature" : "reason"}:`, - u || l - ].join(` -`) : `The contract function "${n}" reverted.`, { - cause: s, - metaMessages: a, - name: "ContractFunctionRevertedError" - }), Object.defineProperty(this, "data", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "raw", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "reason", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "signature", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), this.data = o, this.raw = r, this.reason = u, this.signature = l; - } -} -class cN extends gt { - constructor({ functionName: e }) { - super(`The contract function "${e}" returned no data ("0x").`, { - metaMessages: [ - "This could be due to any of the following:", - ` - The contract does not have the function "${e}",`, - " - The parameters passed to the contract function may be invalid, or", - " - The address is not a contract." - ], - name: "ContractFunctionZeroDataError" - }); - } -} -class uN extends gt { - constructor({ data: e, message: r }) { - super(r || "", { name: "RawContractError" }), Object.defineProperty(this, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: 3 - }), Object.defineProperty(this, "data", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), this.data = e; - } -} -class g4 extends gt { - constructor({ body: e, cause: r, details: n, headers: i, status: s, url: o }) { - super("HTTP request failed.", { - cause: r, - details: n, - metaMessages: [ - s && `Status: ${s}`, - `URL: ${p4(o)}`, - e && `Request body: ${Ac(e)}` - ].filter(Boolean), - name: "HttpRequestError" - }), Object.defineProperty(this, "body", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "headers", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "status", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "url", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), this.body = e, this.headers = i, this.status = s, this.url = o; - } -} -class m4 extends gt { - constructor({ body: e, error: r, url: n }) { - super("RPC Request failed.", { - cause: r, - details: r.message, - metaMessages: [`URL: ${p4(n)}`, `Request body: ${Ac(e)}`], - name: "RpcRequestError" - }), Object.defineProperty(this, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), Object.defineProperty(this, "data", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), this.code = r.code, this.data = r.data; - } -} -const fN = -1; -class Ai extends gt { - constructor(e, { code: r, docsPath: n, metaMessages: i, name: s, shortMessage: o }) { - super(o, { - cause: e, - docsPath: n, - metaMessages: i || (e == null ? void 0 : e.metaMessages), - name: s || "RpcError" - }), Object.defineProperty(this, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), this.name = s || e.name, this.code = e instanceof m4 ? e.code : r ?? fN; - } -} -class $i extends Ai { - constructor(e, r) { - super(e, r), Object.defineProperty(this, "data", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), this.data = r.data; - } -} -class fl extends Ai { - constructor(e) { - super(e, { - code: fl.code, - name: "ParseRpcError", - shortMessage: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text." - }); - } -} -Object.defineProperty(fl, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: -32700 -}); -class ll extends Ai { - constructor(e) { - super(e, { - code: ll.code, - name: "InvalidRequestRpcError", - shortMessage: "JSON is not a valid request object." - }); - } -} -Object.defineProperty(ll, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: -32600 -}); -class hl extends Ai { - constructor(e, { method: r } = {}) { - super(e, { - code: hl.code, - name: "MethodNotFoundRpcError", - shortMessage: `The method${r ? ` "${r}"` : ""} does not exist / is not available.` - }); - } -} -Object.defineProperty(hl, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: -32601 -}); -class dl extends Ai { - constructor(e) { - super(e, { - code: dl.code, - name: "InvalidParamsRpcError", - shortMessage: [ - "Invalid parameters were provided to the RPC method.", - "Double check you have provided the correct parameters." - ].join(` -`) - }); - } -} -Object.defineProperty(dl, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: -32602 -}); -class vc extends Ai { - constructor(e) { - super(e, { - code: vc.code, - name: "InternalRpcError", - shortMessage: "An internal error was received." - }); - } -} -Object.defineProperty(vc, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: -32603 -}); -class pl extends Ai { - constructor(e) { - super(e, { - code: pl.code, - name: "InvalidInputRpcError", - shortMessage: [ - "Missing or invalid parameters.", - "Double check you have provided the correct parameters." - ].join(` -`) - }); - } -} -Object.defineProperty(pl, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: -32e3 -}); -class gl extends Ai { - constructor(e) { - super(e, { - code: gl.code, - name: "ResourceNotFoundRpcError", - shortMessage: "Requested resource not found." - }), Object.defineProperty(this, "name", { - enumerable: !0, - configurable: !0, - writable: !0, - value: "ResourceNotFoundRpcError" - }); - } -} -Object.defineProperty(gl, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: -32001 -}); -class ml extends Ai { - constructor(e) { - super(e, { - code: ml.code, - name: "ResourceUnavailableRpcError", - shortMessage: "Requested resource not available." - }); - } -} -Object.defineProperty(ml, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: -32002 -}); -class vl extends Ai { - constructor(e) { - super(e, { - code: vl.code, - name: "TransactionRejectedRpcError", - shortMessage: "Transaction creation failed." - }); - } -} -Object.defineProperty(vl, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: -32003 -}); -class cc extends Ai { - constructor(e, { method: r } = {}) { - super(e, { - code: cc.code, - name: "MethodNotSupportedRpcError", - shortMessage: `Method${r ? ` "${r}"` : ""} is not supported.` - }); - } -} -Object.defineProperty(cc, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: -32004 -}); -class Cu extends Ai { - constructor(e) { - super(e, { - code: Cu.code, - name: "LimitExceededRpcError", - shortMessage: "Request exceeds defined limit." - }); - } -} -Object.defineProperty(Cu, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: -32005 -}); -class bl extends Ai { - constructor(e) { - super(e, { - code: bl.code, - name: "JsonRpcVersionUnsupportedError", - shortMessage: "Version of JSON-RPC protocol is not supported." - }); - } -} -Object.defineProperty(bl, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: -32006 -}); -class bu extends $i { - constructor(e) { - super(e, { - code: bu.code, - name: "UserRejectedRequestError", - shortMessage: "User rejected the request." - }); - } -} -Object.defineProperty(bu, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: 4001 -}); -class yl extends $i { - constructor(e) { - super(e, { - code: yl.code, - name: "UnauthorizedProviderError", - shortMessage: "The requested method and/or account has not been authorized by the user." - }); - } -} -Object.defineProperty(yl, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: 4100 -}); -class wl extends $i { - constructor(e, { method: r } = {}) { - super(e, { - code: wl.code, - name: "UnsupportedProviderMethodError", - shortMessage: `The Provider does not support the requested method${r ? ` " ${r}"` : ""}.` - }); - } -} -Object.defineProperty(wl, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: 4200 -}); -class xl extends $i { - constructor(e) { - super(e, { - code: xl.code, - name: "ProviderDisconnectedError", - shortMessage: "The Provider is disconnected from all chains." - }); - } -} -Object.defineProperty(xl, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: 4900 -}); -class _l extends $i { - constructor(e) { - super(e, { - code: _l.code, - name: "ChainDisconnectedError", - shortMessage: "The Provider is not connected to the requested chain." - }); - } -} -Object.defineProperty(_l, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: 4901 -}); -class El extends $i { - constructor(e) { - super(e, { - code: El.code, - name: "SwitchChainError", - shortMessage: "An error occurred when attempting to switch chain." - }); - } -} -Object.defineProperty(El, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: 4902 -}); -class Tu extends $i { - constructor(e) { - super(e, { - code: Tu.code, - name: "UnsupportedNonOptionalCapabilityError", - shortMessage: "This Wallet does not support a capability that was not marked as optional." - }); - } -} -Object.defineProperty(Tu, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: 5700 -}); -class Sl extends $i { - constructor(e) { - super(e, { - code: Sl.code, - name: "UnsupportedChainIdError", - shortMessage: "This Wallet does not support the requested chain ID." - }); - } -} -Object.defineProperty(Sl, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: 5710 -}); -class Al extends $i { - constructor(e) { - super(e, { - code: Al.code, - name: "DuplicateIdError", - shortMessage: "There is already a bundle submitted with this ID." - }); - } -} -Object.defineProperty(Al, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: 5720 -}); -class Pl extends $i { - constructor(e) { - super(e, { - code: Pl.code, - name: "UnknownBundleIdError", - shortMessage: "This bundle id is unknown / has not been submitted" - }); - } -} -Object.defineProperty(Pl, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: 5730 -}); -class Ml extends $i { - constructor(e) { - super(e, { - code: Ml.code, - name: "BundleTooLargeError", - shortMessage: "The call bundle is too large for the Wallet to process." - }); - } -} -Object.defineProperty(Ml, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: 5740 -}); -class Il extends $i { - constructor(e) { - super(e, { - code: Il.code, - name: "AtomicReadyWalletRejectedUpgradeError", - shortMessage: "The Wallet can support atomicity after an upgrade, but the user rejected the upgrade." - }); - } -} -Object.defineProperty(Il, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: 5750 -}); -class Ru extends $i { - constructor(e) { - super(e, { - code: Ru.code, - name: "AtomicityNotSupportedError", - shortMessage: "The wallet does not support atomic execution but the request requires it." - }); - } -} -Object.defineProperty(Ru, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: 5760 -}); -class lN extends Ai { - constructor(e) { - super(e, { - name: "UnknownRpcError", - shortMessage: "An unknown RPC error occurred." - }); - } -} -const hN = 3; -function dN(t, { abi: e, address: r, args: n, docsPath: i, functionName: s, sender: o }) { - const a = t instanceof uN ? t : t instanceof gt ? t.walk((P) => "data" in P) || t.walk() : {}, { code: u, data: l, details: d, message: p, shortMessage: w } = a, _ = t instanceof $v ? new cN({ functionName: s }) : [hN, vc.code].includes(u) && (l || d || p || w) ? new aN({ - abi: e, - data: typeof l == "object" ? l.data : l, - functionName: s, - message: a instanceof m4 ? d : w ?? p - }) : t; - return new oN(_, { - abi: e, - args: n, - contractAddress: r, - docsPath: i, - functionName: s, - sender: o - }); -} -function pN(t) { - const e = z0(`0x${t.substring(4)}`).substring(26); - return Vl(`0x${e}`); -} -async function gN({ hash: t, signature: e }) { - const r = ya(t) ? t : t0(t), { secp256k1: n } = await import("./secp256k1-BScNrxtE.js"); - return `0x${(() => { - if (typeof e == "object" && "r" in e && "s" in e) { - const { r: l, s: d, v: p, yParity: w } = e, _ = Number(w ?? p), P = z2(_); - return new n.Signature(wa(l), wa(d)).addRecoveryBit(P); - } - const o = ya(e) ? e : t0(e); - if (xn(o) !== 65) - throw new Error("invalid signature length"); - const a = xa(`0x${o.slice(130)}`), u = z2(a); - return n.Signature.fromCompact(o.substring(2, 130)).addRecoveryBit(u); - })().recoverPublicKey(r.substring(2)).toHex(!1)}`; -} -function z2(t) { - if (t === 0 || t === 1) - return t; - if (t === 27) - return 0; - if (t === 28) - return 1; - throw new Error("Invalid yParityOrV value"); -} -async function mN({ hash: t, signature: e }) { - return pN(await gN({ hash: t, signature: e })); -} -function vN(t, e = "hex") { - const r = v4(t), n = Wv(new Uint8Array(r.length)); - return r.encode(n), e === "hex" ? xi(n.bytes) : n.bytes; -} -function v4(t) { - return Array.isArray(t) ? bN(t.map((e) => v4(e))) : yN(t); -} -function bN(t) { - const e = t.reduce((i, s) => i + s.length, 0), r = b4(e); - return { - length: e <= 55 ? 1 + e : 1 + r + e, - encode(i) { - e <= 55 ? i.pushByte(192 + e) : (i.pushByte(247 + r), r === 1 ? i.pushUint8(e) : r === 2 ? i.pushUint16(e) : r === 3 ? i.pushUint24(e) : i.pushUint32(e)); - for (const { encode: s } of t) - s(i); - } - }; -} -function yN(t) { - const e = typeof t == "string" ? Fo(t) : t, r = b4(e.length); - return { - length: e.length === 1 && e[0] < 128 ? 1 : e.length <= 55 ? 1 + e.length : 1 + r + e.length, - encode(i) { - e.length === 1 && e[0] < 128 ? i.pushBytes(e) : e.length <= 55 ? (i.pushByte(128 + e.length), i.pushBytes(e)) : (i.pushByte(183 + r), r === 1 ? i.pushUint8(e.length) : r === 2 ? i.pushUint16(e.length) : r === 3 ? i.pushUint24(e.length) : i.pushUint32(e.length), i.pushBytes(e)); - } - }; -} -function b4(t) { - if (t < 2 ** 8) - return 1; - if (t < 2 ** 16) - return 2; - if (t < 2 ** 24) - return 3; - if (t < 2 ** 32) - return 4; - throw new gt("Length is too large."); -} -function wN(t) { - const { chainId: e, nonce: r, to: n } = t, i = t.contractAddress ?? t.address, s = z0(H0([ - "0x05", - vN([ - e ? vr(e) : "0x", - i, - r ? vr(r) : "0x" - ]) - ])); - return n === "bytes" ? Fo(s) : s; -} -async function y4(t) { - const { authorization: e, signature: r } = t; - return mN({ - hash: wN(e), - signature: r ?? e - }); -} -class xN extends gt { - constructor(e, { account: r, docsPath: n, chain: i, data: s, gas: o, gasPrice: a, maxFeePerGas: u, maxPriorityFeePerGas: l, nonce: d, to: p, value: w }) { - var P; - const _ = K0({ - from: r == null ? void 0 : r.address, - to: p, - value: typeof w < "u" && `${d4(w)} ${((P = i == null ? void 0 : i.nativeCurrency) == null ? void 0 : P.symbol) || "ETH"}`, - data: s, - gas: o, - gasPrice: typeof a < "u" && `${Ps(a)} gwei`, - maxFeePerGas: typeof u < "u" && `${Ps(u)} gwei`, - maxPriorityFeePerGas: typeof l < "u" && `${Ps(l)} gwei`, - nonce: d - }); - super(e.shortMessage, { - cause: e, - docsPath: n, - metaMessages: [ - ...e.metaMessages ? [...e.metaMessages, " "] : [], - "Estimate Gas Arguments:", - _ - ].filter(Boolean), - name: "EstimateGasExecutionError" - }), Object.defineProperty(this, "cause", { - enumerable: !0, - configurable: !0, - writable: !0, - value: void 0 - }), this.cause = e; - } -} -class cu extends gt { - constructor({ cause: e, message: r } = {}) { - var i; - const n = (i = r == null ? void 0 : r.replace("execution reverted: ", "")) == null ? void 0 : i.replace("execution reverted", ""); - super(`Execution reverted ${n ? `with reason: ${n}` : "for an unknown reason"}.`, { - cause: e, - name: "ExecutionRevertedError" - }); - } -} -Object.defineProperty(cu, "code", { - enumerable: !0, - configurable: !0, - writable: !0, - value: 3 -}); -Object.defineProperty(cu, "nodeMessage", { - enumerable: !0, - configurable: !0, - writable: !0, - value: /execution reverted/ -}); -class s0 extends gt { - constructor({ cause: e, maxFeePerGas: r } = {}) { - super(`The fee cap (\`maxFeePerGas\`${r ? ` = ${Ps(r)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, { - cause: e, - name: "FeeCapTooHighError" - }); - } -} -Object.defineProperty(s0, "nodeMessage", { - enumerable: !0, - configurable: !0, - writable: !0, - value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/ -}); -class p1 extends gt { - constructor({ cause: e, maxFeePerGas: r } = {}) { - super(`The fee cap (\`maxFeePerGas\`${r ? ` = ${Ps(r)}` : ""} gwei) cannot be lower than the block base fee.`, { - cause: e, - name: "FeeCapTooLowError" - }); - } -} -Object.defineProperty(p1, "nodeMessage", { - enumerable: !0, - configurable: !0, - writable: !0, - value: /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/ -}); -class g1 extends gt { - constructor({ cause: e, nonce: r } = {}) { - super(`Nonce provided for the transaction ${r ? `(${r}) ` : ""}is higher than the next one expected.`, { cause: e, name: "NonceTooHighError" }); - } -} -Object.defineProperty(g1, "nodeMessage", { - enumerable: !0, - configurable: !0, - writable: !0, - value: /nonce too high/ -}); -class m1 extends gt { - constructor({ cause: e, nonce: r } = {}) { - super([ - `Nonce provided for the transaction ${r ? `(${r}) ` : ""}is lower than the current nonce of the account.`, - "Try increasing the nonce or find the latest nonce with `getTransactionCount`." - ].join(` -`), { cause: e, name: "NonceTooLowError" }); - } -} -Object.defineProperty(m1, "nodeMessage", { - enumerable: !0, - configurable: !0, - writable: !0, - value: /nonce too low|transaction already imported|already known/ -}); -class v1 extends gt { - constructor({ cause: e, nonce: r } = {}) { - super(`Nonce provided for the transaction ${r ? `(${r}) ` : ""}exceeds the maximum allowed nonce.`, { cause: e, name: "NonceMaxValueError" }); - } -} -Object.defineProperty(v1, "nodeMessage", { - enumerable: !0, - configurable: !0, - writable: !0, - value: /nonce has max value/ -}); -class b1 extends gt { - constructor({ cause: e } = {}) { - super([ - "The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account." - ].join(` -`), { - cause: e, - metaMessages: [ - "This error could arise when the account does not have enough funds to:", - " - pay for the total gas fee,", - " - pay for the value to send.", - " ", - "The cost of the transaction is calculated as `gas * gas fee + value`, where:", - " - `gas` is the amount of gas needed for transaction to execute,", - " - `gas fee` is the gas fee,", - " - `value` is the amount of ether to send to the recipient." - ], - name: "InsufficientFundsError" - }); - } -} -Object.defineProperty(b1, "nodeMessage", { - enumerable: !0, - configurable: !0, - writable: !0, - value: /insufficient funds|exceeds transaction sender account balance/ -}); -class y1 extends gt { - constructor({ cause: e, gas: r } = {}) { - super(`The amount of gas ${r ? `(${r}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`, { - cause: e, - name: "IntrinsicGasTooHighError" - }); - } -} -Object.defineProperty(y1, "nodeMessage", { - enumerable: !0, - configurable: !0, - writable: !0, - value: /intrinsic gas too high|gas limit reached/ -}); -class w1 extends gt { - constructor({ cause: e, gas: r } = {}) { - super(`The amount of gas ${r ? `(${r}) ` : ""}provided for the transaction is too low.`, { - cause: e, - name: "IntrinsicGasTooLowError" - }); - } -} -Object.defineProperty(w1, "nodeMessage", { - enumerable: !0, - configurable: !0, - writable: !0, - value: /intrinsic gas too low/ -}); -class x1 extends gt { - constructor({ cause: e }) { - super("The transaction type is not supported for this chain.", { - cause: e, - name: "TransactionTypeNotSupportedError" - }); - } -} -Object.defineProperty(x1, "nodeMessage", { - enumerable: !0, - configurable: !0, - writable: !0, - value: /transaction type not valid/ -}); -class o0 extends gt { - constructor({ cause: e, maxPriorityFeePerGas: r, maxFeePerGas: n } = {}) { - super([ - `The provided tip (\`maxPriorityFeePerGas\`${r ? ` = ${Ps(r)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n ? ` = ${Ps(n)} gwei` : ""}).` - ].join(` -`), { - cause: e, - name: "TipAboveFeeCapError" - }); - } -} -Object.defineProperty(o0, "nodeMessage", { - enumerable: !0, - configurable: !0, - writable: !0, - value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/ -}); -class Hv extends gt { - constructor({ cause: e }) { - super(`An error occurred while executing: ${e == null ? void 0 : e.shortMessage}`, { - cause: e, - name: "UnknownNodeError" - }); - } -} -function w4(t, e) { - const r = (t.details || "").toLowerCase(), n = t instanceof gt ? t.walk((i) => (i == null ? void 0 : i.code) === cu.code) : t; - return n instanceof gt ? new cu({ - cause: t, - message: n.details - }) : cu.nodeMessage.test(r) ? new cu({ - cause: t, - message: t.details - }) : s0.nodeMessage.test(r) ? new s0({ - cause: t, - maxFeePerGas: e == null ? void 0 : e.maxFeePerGas - }) : p1.nodeMessage.test(r) ? new p1({ - cause: t, - maxFeePerGas: e == null ? void 0 : e.maxFeePerGas - }) : g1.nodeMessage.test(r) ? new g1({ cause: t, nonce: e == null ? void 0 : e.nonce }) : m1.nodeMessage.test(r) ? new m1({ cause: t, nonce: e == null ? void 0 : e.nonce }) : v1.nodeMessage.test(r) ? new v1({ cause: t, nonce: e == null ? void 0 : e.nonce }) : b1.nodeMessage.test(r) ? new b1({ cause: t }) : y1.nodeMessage.test(r) ? new y1({ cause: t, gas: e == null ? void 0 : e.gas }) : w1.nodeMessage.test(r) ? new w1({ cause: t, gas: e == null ? void 0 : e.gas }) : x1.nodeMessage.test(r) ? new x1({ cause: t }) : o0.nodeMessage.test(r) ? new o0({ - cause: t, - maxFeePerGas: e == null ? void 0 : e.maxFeePerGas, - maxPriorityFeePerGas: e == null ? void 0 : e.maxPriorityFeePerGas - }) : new Hv({ - cause: t - }); -} -function _N(t, { docsPath: e, ...r }) { - const n = (() => { - const i = w4(t, r); - return i instanceof Hv ? t : i; - })(); - return new xN(n, { - docsPath: e, - ...r - }); -} -function x4(t, { format: e }) { - if (!e) - return {}; - const r = {}; - function n(s) { - const o = Object.keys(s); - for (const a of o) - a in t && (r[a] = t[a]), s[a] && typeof s[a] == "object" && !Array.isArray(s[a]) && n(s[a]); - } - const i = e(t || {}); - return n(i), r; -} -const EN = { - legacy: "0x0", - eip2930: "0x1", - eip1559: "0x2", - eip4844: "0x3", - eip7702: "0x4" -}; -function Kv(t) { - const e = {}; - return typeof t.authorizationList < "u" && (e.authorizationList = SN(t.authorizationList)), typeof t.accessList < "u" && (e.accessList = t.accessList), typeof t.blobVersionedHashes < "u" && (e.blobVersionedHashes = t.blobVersionedHashes), typeof t.blobs < "u" && (typeof t.blobs[0] != "string" ? e.blobs = t.blobs.map((r) => xi(r)) : e.blobs = t.blobs), typeof t.data < "u" && (e.data = t.data), typeof t.from < "u" && (e.from = t.from), typeof t.gas < "u" && (e.gas = vr(t.gas)), typeof t.gasPrice < "u" && (e.gasPrice = vr(t.gasPrice)), typeof t.maxFeePerBlobGas < "u" && (e.maxFeePerBlobGas = vr(t.maxFeePerBlobGas)), typeof t.maxFeePerGas < "u" && (e.maxFeePerGas = vr(t.maxFeePerGas)), typeof t.maxPriorityFeePerGas < "u" && (e.maxPriorityFeePerGas = vr(t.maxPriorityFeePerGas)), typeof t.nonce < "u" && (e.nonce = vr(t.nonce)), typeof t.to < "u" && (e.to = t.to), typeof t.type < "u" && (e.type = EN[t.type]), typeof t.value < "u" && (e.value = vr(t.value)), e; -} -function SN(t) { - return t.map((e) => ({ - address: e.address, - r: e.r ? vr(BigInt(e.r)) : e.r, - s: e.s ? vr(BigInt(e.s)) : e.s, - chainId: vr(e.chainId), - nonce: vr(e.nonce), - ...typeof e.yParity < "u" ? { yParity: vr(e.yParity) } : {}, - ...typeof e.v < "u" && typeof e.yParity > "u" ? { v: vr(e.v) } : {} - })); -} -function W2(t) { - if (!(!t || t.length === 0)) - return t.reduce((e, { slot: r, value: n }) => { - if (r.length !== 66) - throw new O2({ - size: r.length, - targetSize: 66, - type: "hex" - }); - if (n.length !== 66) - throw new O2({ - size: n.length, - targetSize: 66, - type: "hex" - }); - return e[r] = n, e; - }, {}); -} -function AN(t) { - const { balance: e, nonce: r, state: n, stateDiff: i, code: s } = t, o = {}; - if (s !== void 0 && (o.code = s), e !== void 0 && (o.balance = vr(e)), r !== void 0 && (o.nonce = vr(r)), n !== void 0 && (o.state = W2(n)), i !== void 0) { - if (o.state) - throw new tN(); - o.stateDiff = W2(i); - } - return o; -} -function PN(t) { - if (!t) - return; - const e = {}; - for (const { address: r, ...n } of t) { - if (!Ms(r, { strict: !1 })) - throw new _a({ address: r }); - if (e[r]) - throw new eN({ address: r }); - e[r] = AN(n); - } - return e; -} -const MN = 2n ** 256n - 1n; -function V0(t) { - const { account: e, gasPrice: r, maxFeePerGas: n, maxPriorityFeePerGas: i, to: s } = t, o = e ? _i(e) : void 0; - if (o && !Ms(o.address)) - throw new _a({ address: o.address }); - if (s && !Ms(s)) - throw new _a({ address: s }); - if (typeof r < "u" && (typeof n < "u" || typeof i < "u")) - throw new rN(); - if (n && n > MN) - throw new s0({ maxFeePerGas: n }); - if (i && n && i > n) - throw new o0({ maxFeePerGas: n, maxPriorityFeePerGas: i }); -} -class IN extends gt { - constructor() { - super("`baseFeeMultiplier` must be greater than 1.", { - name: "BaseFeeScalarError" - }); - } -} -class Vv extends gt { - constructor() { - super("Chain does not support EIP-1559 fees.", { - name: "Eip1559FeesNotSupportedError" - }); - } -} -class CN extends gt { - constructor({ maxPriorityFeePerGas: e }) { - super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Ps(e)} gwei).`, { name: "MaxFeePerGasTooLowError" }); - } -} -class TN extends gt { - constructor({ blockHash: e, blockNumber: r }) { - let n = "Block"; - e && (n = `Block at hash "${e}"`), r && (n = `Block at number "${r}"`), super(`${n} could not be found.`, { name: "BlockNotFoundError" }); - } -} -const RN = { - "0x0": "legacy", - "0x1": "eip2930", - "0x2": "eip1559", - "0x3": "eip4844", - "0x4": "eip7702" -}; -function DN(t) { - const e = { - ...t, - blockHash: t.blockHash ? t.blockHash : null, - blockNumber: t.blockNumber ? BigInt(t.blockNumber) : null, - chainId: t.chainId ? xa(t.chainId) : void 0, - gas: t.gas ? BigInt(t.gas) : void 0, - gasPrice: t.gasPrice ? BigInt(t.gasPrice) : void 0, - maxFeePerBlobGas: t.maxFeePerBlobGas ? BigInt(t.maxFeePerBlobGas) : void 0, - maxFeePerGas: t.maxFeePerGas ? BigInt(t.maxFeePerGas) : void 0, - maxPriorityFeePerGas: t.maxPriorityFeePerGas ? BigInt(t.maxPriorityFeePerGas) : void 0, - nonce: t.nonce ? xa(t.nonce) : void 0, - to: t.to ? t.to : null, - transactionIndex: t.transactionIndex ? Number(t.transactionIndex) : null, - type: t.type ? RN[t.type] : void 0, - typeHex: t.type ? t.type : void 0, - value: t.value ? BigInt(t.value) : void 0, - v: t.v ? BigInt(t.v) : void 0 - }; - return t.authorizationList && (e.authorizationList = ON(t.authorizationList)), e.yParity = (() => { - if (t.yParity) - return Number(t.yParity); - if (typeof e.v == "bigint") { - if (e.v === 0n || e.v === 27n) - return 0; - if (e.v === 1n || e.v === 28n) - return 1; - if (e.v >= 35n) - return e.v % 2n === 0n ? 1 : 0; - } - })(), e.type === "legacy" && (delete e.accessList, delete e.maxFeePerBlobGas, delete e.maxFeePerGas, delete e.maxPriorityFeePerGas, delete e.yParity), e.type === "eip2930" && (delete e.maxFeePerBlobGas, delete e.maxFeePerGas, delete e.maxPriorityFeePerGas), e.type === "eip1559" && delete e.maxFeePerBlobGas, e; -} -function ON(t) { - return t.map((e) => ({ - address: e.address, - chainId: Number(e.chainId), - nonce: Number(e.nonce), - r: e.r, - s: e.s, - yParity: Number(e.yParity) - })); -} -function NN(t) { - const e = (t.transactions ?? []).map((r) => typeof r == "string" ? r : DN(r)); - return { - ...t, - baseFeePerGas: t.baseFeePerGas ? BigInt(t.baseFeePerGas) : null, - blobGasUsed: t.blobGasUsed ? BigInt(t.blobGasUsed) : void 0, - difficulty: t.difficulty ? BigInt(t.difficulty) : void 0, - excessBlobGas: t.excessBlobGas ? BigInt(t.excessBlobGas) : void 0, - gasLimit: t.gasLimit ? BigInt(t.gasLimit) : void 0, - gasUsed: t.gasUsed ? BigInt(t.gasUsed) : void 0, - hash: t.hash ? t.hash : null, - logsBloom: t.logsBloom ? t.logsBloom : null, - nonce: t.nonce ? t.nonce : null, - number: t.number ? BigInt(t.number) : null, - size: t.size ? BigInt(t.size) : void 0, - timestamp: t.timestamp ? BigInt(t.timestamp) : void 0, - transactions: e, - totalDifficulty: t.totalDifficulty ? BigInt(t.totalDifficulty) : null - }; -} -async function a0(t, { blockHash: e, blockNumber: r, blockTag: n, includeTransactions: i } = {}) { - var d, p, w; - const s = n ?? "latest", o = i ?? !1, a = r !== void 0 ? vr(r) : void 0; - let u = null; - if (e ? u = await t.request({ - method: "eth_getBlockByHash", - params: [e, o] - }, { dedupe: !0 }) : u = await t.request({ - method: "eth_getBlockByNumber", - params: [a || s, o] - }, { dedupe: !!a }), !u) - throw new TN({ blockHash: e, blockNumber: r }); - return (((w = (p = (d = t.chain) == null ? void 0 : d.formatters) == null ? void 0 : p.block) == null ? void 0 : w.format) || NN)(u); -} -async function _4(t) { - const e = await t.request({ - method: "eth_gasPrice" - }); - return BigInt(e); -} -async function LN(t, e) { - var s, o; - const { block: r, chain: n = t.chain, request: i } = e || {}; - try { - const a = ((s = n == null ? void 0 : n.fees) == null ? void 0 : s.maxPriorityFeePerGas) ?? ((o = n == null ? void 0 : n.fees) == null ? void 0 : o.defaultPriorityFee); - if (typeof a == "function") { - const l = r || await Xn(t, a0, "getBlock")({}), d = await a({ - block: l, - client: t, - request: i - }); - if (d === null) - throw new Error(); - return d; - } - if (typeof a < "u") - return a; - const u = await t.request({ - method: "eth_maxPriorityFeePerGas" - }); - return wa(u); - } catch { - const [a, u] = await Promise.all([ - r ? Promise.resolve(r) : Xn(t, a0, "getBlock")({}), - Xn(t, _4, "getGasPrice")({}) - ]); - if (typeof a.baseFeePerGas != "bigint") - throw new Vv(); - const l = u - a.baseFeePerGas; - return l < 0n ? 0n : l; - } -} -async function H2(t, e) { - var w, _; - const { block: r, chain: n = t.chain, request: i, type: s = "eip1559" } = e || {}, o = await (async () => { - var P, O; - return typeof ((P = n == null ? void 0 : n.fees) == null ? void 0 : P.baseFeeMultiplier) == "function" ? n.fees.baseFeeMultiplier({ - block: r, - client: t, - request: i - }) : ((O = n == null ? void 0 : n.fees) == null ? void 0 : O.baseFeeMultiplier) ?? 1.2; - })(); - if (o < 1) - throw new IN(); - const u = 10 ** (((w = o.toString().split(".")[1]) == null ? void 0 : w.length) ?? 0), l = (P) => P * BigInt(Math.ceil(o * u)) / BigInt(u), d = r || await Xn(t, a0, "getBlock")({}); - if (typeof ((_ = n == null ? void 0 : n.fees) == null ? void 0 : _.estimateFeesPerGas) == "function") { - const P = await n.fees.estimateFeesPerGas({ - block: r, - client: t, - multiply: l, - request: i, - type: s - }); - if (P !== null) - return P; - } - if (s === "eip1559") { - if (typeof d.baseFeePerGas != "bigint") - throw new Vv(); - const P = typeof (i == null ? void 0 : i.maxPriorityFeePerGas) == "bigint" ? i.maxPriorityFeePerGas : await LN(t, { - block: d, - chain: n, - request: i - }), O = l(d.baseFeePerGas); - return { - maxFeePerGas: (i == null ? void 0 : i.maxFeePerGas) ?? O + P, - maxPriorityFeePerGas: P - }; - } - return { - gasPrice: (i == null ? void 0 : i.gasPrice) ?? l(await Xn(t, _4, "getGasPrice")({})) - }; -} -async function E4(t, { address: e, blockTag: r = "latest", blockNumber: n }) { - const i = await t.request({ - method: "eth_getTransactionCount", - params: [ - e, - typeof n == "bigint" ? vr(n) : r - ] - }, { - dedupe: !!n - }); - return xa(i); -} -function S4(t) { - const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((s) => Fo(s)) : t.blobs, i = []; - for (const s of n) - i.push(Uint8Array.from(e.blobToKzgCommitment(s))); - return r === "bytes" ? i : i.map((s) => xi(s)); -} -function A4(t) { - const { kzg: e } = t, r = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), n = typeof t.blobs[0] == "string" ? t.blobs.map((o) => Fo(o)) : t.blobs, i = typeof t.commitments[0] == "string" ? t.commitments.map((o) => Fo(o)) : t.commitments, s = []; - for (let o = 0; o < n.length; o++) { - const a = n[o], u = i[o]; - s.push(Uint8Array.from(e.computeBlobKzgProof(a, u))); - } - return r === "bytes" ? s : s.map((o) => xi(o)); -} -function kN(t, e, r, n) { - if (typeof t.setBigUint64 == "function") - return t.setBigUint64(e, r, n); - const i = BigInt(32), s = BigInt(4294967295), o = Number(r >> i & s), a = Number(r & s), u = n ? 4 : 0, l = n ? 0 : 4; - t.setUint32(e + u, o, n), t.setUint32(e + l, a, n); -} -function $N(t, e, r) { - return t & e ^ ~t & r; -} -function BN(t, e, r) { - return t & e ^ t & r ^ e & r; -} -class FN extends V5 { - constructor(e, r, n, i) { - super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = e, this.outputLen = r, this.padOffset = n, this.isLE = i, this.buffer = new Uint8Array(e), this.view = Zg(this.buffer); - } - update(e) { - n0(this), e = q0(e), mc(e); - const { view: r, buffer: n, blockLen: i } = this, s = e.length; - for (let o = 0; o < s; ) { - const a = Math.min(i - this.pos, s - o); - if (a === i) { - const u = Zg(e); - for (; i <= s - o; o += i) - this.process(u, o); - continue; - } - n.set(e.subarray(o, o + a), this.pos), this.pos += a, o += a, this.pos === i && (this.process(r, 0), this.pos = 0); - } - return this.length += e.length, this.roundClean(), this; - } - digestInto(e) { - n0(this), H5(e, this), this.finished = !0; - const { buffer: r, view: n, blockLen: i, isLE: s } = this; - let { pos: o } = this; - r[o++] = 128, cl(this.buffer.subarray(o)), this.padOffset > i - o && (this.process(n, 0), o = 0); - for (let p = o; p < i; p++) - r[p] = 0; - kN(n, i - 8, BigInt(this.length * 8), s), this.process(n, 0); - const a = Zg(e), u = this.outputLen; - if (u % 4) - throw new Error("_sha2: outputLen should be aligned to 32bit"); - const l = u / 4, d = this.get(); - if (l > d.length) - throw new Error("_sha2: outputLen bigger than state"); - for (let p = 0; p < l; p++) - a.setUint32(4 * p, d[p], s); - } - digest() { - const { buffer: e, outputLen: r } = this; - this.digestInto(e); - const n = e.slice(0, r); - return this.destroy(), n; - } - _cloneInto(e) { - e || (e = new this.constructor()), e.set(...this.get()); - const { blockLen: r, buffer: n, length: i, finished: s, destroyed: o, pos: a } = this; - return e.destroyed = o, e.finished = s, e.length = i, e.pos = a, i % r && e.buffer.set(n), e; - } - clone() { - return this._cloneInto(); - } -} -const ta = /* @__PURE__ */ Uint32Array.from([ - 1779033703, - 3144134277, - 1013904242, - 2773480762, - 1359893119, - 2600822924, - 528734635, - 1541459225 -]), jN = /* @__PURE__ */ Uint32Array.from([ - 1116352408, - 1899447441, - 3049323471, - 3921009573, - 961987163, - 1508970993, - 2453635748, - 2870763221, - 3624381080, - 310598401, - 607225278, - 1426881987, - 1925078388, - 2162078206, - 2614888103, - 3248222580, - 3835390401, - 4022224774, - 264347078, - 604807628, - 770255983, - 1249150122, - 1555081692, - 1996064986, - 2554220882, - 2821834349, - 2952996808, - 3210313671, - 3336571891, - 3584528711, - 113926993, - 338241895, - 666307205, - 773529912, - 1294757372, - 1396182291, - 1695183700, - 1986661051, - 2177026350, - 2456956037, - 2730485921, - 2820302411, - 3259730800, - 3345764771, - 3516065817, - 3600352804, - 4094571909, - 275423344, - 430227734, - 506948616, - 659060556, - 883997877, - 958139571, - 1322822218, - 1537002063, - 1747873779, - 1955562222, - 2024104815, - 2227730452, - 2361852424, - 2428436474, - 2756734187, - 3204031479, - 3329325298 -]), ra = /* @__PURE__ */ new Uint32Array(64); -let UN = class extends FN { - constructor(e = 32) { - super(64, e, 8, !1), this.A = ta[0] | 0, this.B = ta[1] | 0, this.C = ta[2] | 0, this.D = ta[3] | 0, this.E = ta[4] | 0, this.F = ta[5] | 0, this.G = ta[6] | 0, this.H = ta[7] | 0; - } - get() { - const { A: e, B: r, C: n, D: i, E: s, F: o, G: a, H: u } = this; - return [e, r, n, i, s, o, a, u]; - } - // prettier-ignore - set(e, r, n, i, s, o, a, u) { - this.A = e | 0, this.B = r | 0, this.C = n | 0, this.D = i | 0, this.E = s | 0, this.F = o | 0, this.G = a | 0, this.H = u | 0; - } - process(e, r) { - for (let p = 0; p < 16; p++, r += 4) - ra[p] = e.getUint32(r, !1); - for (let p = 16; p < 64; p++) { - const w = ra[p - 15], _ = ra[p - 2], P = $s(w, 7) ^ $s(w, 18) ^ w >>> 3, O = $s(_, 17) ^ $s(_, 19) ^ _ >>> 10; - ra[p] = O + ra[p - 7] + P + ra[p - 16] | 0; - } - let { A: n, B: i, C: s, D: o, E: a, F: u, G: l, H: d } = this; - for (let p = 0; p < 64; p++) { - const w = $s(a, 6) ^ $s(a, 11) ^ $s(a, 25), _ = d + w + $N(a, u, l) + jN[p] + ra[p] | 0, O = ($s(n, 2) ^ $s(n, 13) ^ $s(n, 22)) + BN(n, i, s) | 0; - d = l, l = u, u = a, a = o + _ | 0, o = s, s = i, i = n, n = _ + O | 0; - } - n = n + this.A | 0, i = i + this.B | 0, s = s + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, u = u + this.F | 0, l = l + this.G | 0, d = d + this.H | 0, this.set(n, i, s, o, a, u, l, d); - } - roundClean() { - cl(ra); - } - destroy() { - this.set(0, 0, 0, 0, 0, 0, 0, 0), cl(this.buffer); - } -}; -const qN = /* @__PURE__ */ G5(() => new UN()), P4 = qN; -function zN(t, e) { - return P4(ya(t, { strict: !1 }) ? Bv(t) : t); -} -function WN(t) { - const { commitment: e, version: r = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), i = zN(e); - return i.set([r], 0), n === "bytes" ? i : xi(i); -} -function HN(t) { - const { commitments: e, version: r } = t, n = t.to ?? (typeof e[0] == "string" ? "hex" : "bytes"), i = []; - for (const s of e) - i.push(WN({ - commitment: s, - to: n, - version: r - })); - return i; -} -const K2 = 6, M4 = 32, Gv = 4096, I4 = M4 * Gv, V2 = I4 * K2 - // terminator byte (0x80). -1 - // zero byte (0x00) appended to each field element. -1 * Gv * K2; -class KN extends gt { - constructor({ maxSize: e, size: r }) { - super("Blob size is too large.", { - metaMessages: [`Max: ${e} bytes`, `Given: ${r} bytes`], - name: "BlobSizeTooLargeError" - }); - } -} -class VN extends gt { - constructor() { - super("Blob data must not be empty.", { name: "EmptyBlobError" }); - } -} -function GN(t) { - const e = t.to ?? (typeof t.data == "string" ? "hex" : "bytes"), r = typeof t.data == "string" ? Fo(t.data) : t.data, n = xn(r); - if (!n) - throw new VN(); - if (n > V2) - throw new KN({ - maxSize: V2, - size: n - }); - const i = []; - let s = !0, o = 0; - for (; s; ) { - const a = Wv(new Uint8Array(I4)); - let u = 0; - for (; u < Gv; ) { - const l = r.slice(o, o + (M4 - 1)); - if (a.pushByte(0), a.pushBytes(l), l.length < 31) { - a.pushByte(128), s = !1; - break; - } - u++, o += 31; - } - i.push(a); - } - return e === "bytes" ? i.map((a) => a.bytes) : i.map((a) => xi(a.bytes)); -} -function YN(t) { - const { data: e, kzg: r, to: n } = t, i = t.blobs ?? GN({ data: e, to: n }), s = t.commitments ?? S4({ blobs: i, kzg: r, to: n }), o = t.proofs ?? A4({ blobs: i, commitments: s, kzg: r, to: n }), a = []; - for (let u = 0; u < i.length; u++) - a.push({ - blob: i[u], - commitment: s[u], - proof: o[u] - }); - return a; -} -function JN(t) { - if (t.type) - return t.type; - if (typeof t.authorizationList < "u") - return "eip7702"; - if (typeof t.blobs < "u" || typeof t.blobVersionedHashes < "u" || typeof t.maxFeePerBlobGas < "u" || typeof t.sidecars < "u") - return "eip4844"; - if (typeof t.maxFeePerGas < "u" || typeof t.maxPriorityFeePerGas < "u") - return "eip1559"; - if (typeof t.gasPrice < "u") - return typeof t.accessList < "u" ? "eip2930" : "legacy"; - throw new nN({ transaction: t }); -} -async function Gl(t) { - const e = await t.request({ - method: "eth_chainId" - }, { dedupe: !0 }); - return xa(e); -} -const C4 = [ - "blobVersionedHashes", - "chainId", - "fees", - "gas", - "nonce", - "type" -], G2 = /* @__PURE__ */ new Map(); -async function Yv(t, e) { - const { account: r = t.account, blobs: n, chain: i, gas: s, kzg: o, nonce: a, nonceManager: u, parameters: l = C4, type: d } = e, p = r && _i(r), w = { ...e, ...p ? { from: p == null ? void 0 : p.address } : {} }; - let _; - async function P() { - return _ || (_ = await Xn(t, a0, "getBlock")({ blockTag: "latest" }), _); - } - let O; - async function L() { - return O || (i ? i.id : typeof e.chainId < "u" ? e.chainId : (O = await Xn(t, Gl, "getChainId")({}), O)); - } - if (l.includes("nonce") && typeof a > "u" && p) - if (u) { - const B = await L(); - w.nonce = await u.consume({ - address: p.address, - chainId: B, - client: t - }); - } else - w.nonce = await Xn(t, E4, "getTransactionCount")({ - address: p.address, - blockTag: "pending" - }); - if ((l.includes("blobVersionedHashes") || l.includes("sidecars")) && n && o) { - const B = S4({ blobs: n, kzg: o }); - if (l.includes("blobVersionedHashes")) { - const k = HN({ - commitments: B, - to: "hex" - }); - w.blobVersionedHashes = k; - } - if (l.includes("sidecars")) { - const k = A4({ blobs: n, commitments: B, kzg: o }), W = YN({ - blobs: n, - commitments: B, - proofs: k, - to: "hex" - }); - w.sidecars = W; - } - } - if (l.includes("chainId") && (w.chainId = await L()), (l.includes("fees") || l.includes("type")) && typeof d > "u") - try { - w.type = JN(w); - } catch { - let B = G2.get(t.uid); - if (typeof B > "u") { - const k = await P(); - B = typeof (k == null ? void 0 : k.baseFeePerGas) == "bigint", G2.set(t.uid, B); - } - w.type = B ? "eip1559" : "legacy"; - } - if (l.includes("fees")) - if (w.type !== "legacy" && w.type !== "eip2930") { - if (typeof w.maxFeePerGas > "u" || typeof w.maxPriorityFeePerGas > "u") { - const B = await P(), { maxFeePerGas: k, maxPriorityFeePerGas: W } = await H2(t, { - block: B, - chain: i, - request: w - }); - if (typeof e.maxPriorityFeePerGas > "u" && e.maxFeePerGas && e.maxFeePerGas < W) - throw new CN({ - maxPriorityFeePerGas: W - }); - w.maxPriorityFeePerGas = W, w.maxFeePerGas = k; - } - } else { - if (typeof e.maxFeePerGas < "u" || typeof e.maxPriorityFeePerGas < "u") - throw new Vv(); - if (typeof e.gasPrice > "u") { - const B = await P(), { gasPrice: k } = await H2(t, { - block: B, - chain: i, - request: w, - type: "legacy" - }); - w.gasPrice = k; - } - } - return l.includes("gas") && typeof s > "u" && (w.gas = await Xn(t, ZN, "estimateGas")({ - ...w, - account: p && { address: p.address, type: "json-rpc" } - })), V0(w), delete w.parameters, w; -} -async function XN(t, { address: e, blockNumber: r, blockTag: n = "latest" }) { - const i = typeof r == "bigint" ? vr(r) : void 0, s = await t.request({ - method: "eth_getBalance", - params: [e, i || n] - }); - return BigInt(s); -} -async function ZN(t, e) { - var i, s, o; - const { account: r = t.account } = e, n = r ? _i(r) : void 0; - try { - let f = function(b) { - const { block: x, request: E, rpcStateOverride: S } = b; - return t.request({ - method: "eth_estimateGas", - params: S ? [E, x ?? "latest", S] : x ? [E, x] : [E] - }); - }; - const { accessList: a, authorizationList: u, blobs: l, blobVersionedHashes: d, blockNumber: p, blockTag: w, data: _, gas: P, gasPrice: O, maxFeePerBlobGas: L, maxFeePerGas: B, maxPriorityFeePerGas: k, nonce: W, value: U, stateOverride: V, ...Q } = await Yv(t, { - ...e, - parameters: ( - // Some RPC Providers do not compute versioned hashes from blobs. We will need - // to compute them. - (n == null ? void 0 : n.type) === "local" ? void 0 : ["blobVersionedHashes"] - ) - }), K = (typeof p == "bigint" ? vr(p) : void 0) || w, ge = PN(V), Ee = await (async () => { - if (Q.to) - return Q.to; - if (u && u.length > 0) - return await y4({ - authorization: u[0] - }).catch(() => { - throw new gt("`to` is required. Could not infer from `authorizationList`"); - }); - })(); - V0(e); - const Y = (o = (s = (i = t.chain) == null ? void 0 : i.formatters) == null ? void 0 : s.transactionRequest) == null ? void 0 : o.format, m = (Y || Kv)({ - // Pick out extra data that might exist on the chain's transaction request type. - ...x4(Q, { format: Y }), - from: n == null ? void 0 : n.address, - accessList: a, - authorizationList: u, - blobs: l, - blobVersionedHashes: d, - data: _, - gas: P, - gasPrice: O, - maxFeePerBlobGas: L, - maxFeePerGas: B, - maxPriorityFeePerGas: k, - nonce: W, - to: Ee, - value: U - }); - let g = BigInt(await f({ block: K, request: m, rpcStateOverride: ge })); - if (u) { - const b = await XN(t, { address: m.from }), x = await Promise.all(u.map(async (E) => { - const { address: S } = E, v = await f({ - block: K, - request: { - authorizationList: void 0, - data: _, - from: n == null ? void 0 : n.address, - to: S, - value: vr(b) - }, - rpcStateOverride: ge - }).catch(() => 100000n); - return 2n * BigInt(v); - })); - g += x.reduce((E, S) => E + S, 0n); - } - return g; - } catch (a) { - throw _N(a, { - ...e, - account: n, - chain: t.chain - }); - } -} -function QN(t, e) { - if (!Ms(t, { strict: !1 })) - throw new _a({ address: t }); - if (!Ms(e, { strict: !1 })) - throw new _a({ address: e }); - return t.toLowerCase() === e.toLowerCase(); -} -class eL extends gt { - constructor({ chain: e, currentChainId: r }) { - super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`, { - metaMessages: [ - `Current Chain ID: ${r}`, - `Expected Chain ID: ${e.id} – ${e.name}` - ], - name: "ChainMismatchError" - }); - } -} -class tL extends gt { - constructor() { - super([ - "No chain was provided to the request.", - "Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient." - ].join(` -`), { - name: "ChainNotFoundError" - }); - } -} -const tm = "/docs/contract/encodeDeployData"; -function rL(t) { - const { abi: e, args: r, bytecode: n } = t; - if (!r || r.length === 0) - return n; - const i = e.find((o) => "type" in o && o.type === "constructor"); - if (!i) - throw new wD({ docsPath: tm }); - if (!("inputs" in i)) - throw new R2({ docsPath: tm }); - if (!i.inputs || i.inputs.length === 0) - throw new R2({ docsPath: tm }); - const s = a4(i.inputs, r); - return H0([n, s]); -} -function nL() { - let t = () => { - }, e = () => { - }; - return { promise: new Promise((n, i) => { - t = n, e = i; - }), resolve: t, reject: e }; -} -const rm = /* @__PURE__ */ new Map(), Y2 = /* @__PURE__ */ new Map(); -let iL = 0; -function sL(t, e, r) { - const n = ++iL, i = () => rm.get(t) || [], s = () => { - const d = i(); - rm.set(t, d.filter((p) => p.id !== n)); - }, o = () => { - const d = i(); - if (!d.some((w) => w.id === n)) - return; - const p = Y2.get(t); - if (d.length === 1 && p) { - const w = p(); - w instanceof Promise && w.catch(() => { - }); - } - s(); - }, a = i(); - if (rm.set(t, [ - ...a, - { id: n, fns: e } - ]), a && a.length > 0) - return o; - const u = {}; - for (const d in e) - u[d] = (...p) => { - var _, P; - const w = i(); - if (w.length !== 0) - for (const O of w) - (P = (_ = O.fns)[d]) == null || P.call(_, ...p); - }; - const l = r(u); - return typeof l == "function" && Y2.set(t, l), o; -} -async function _1(t) { - return new Promise((e) => setTimeout(e, t)); -} -function oL(t, { emitOnBegin: e, initialWaitTime: r, interval: n }) { - let i = !0; - const s = () => i = !1; - return (async () => { - let a; - a = await t({ unpoll: s }); - const u = await (r == null ? void 0 : r(a)) ?? n; - await _1(u); - const l = async () => { - i && (await t({ unpoll: s }), await _1(n), l()); - }; - l(); - })(), s; -} -class Pc extends gt { - constructor({ docsPath: e } = {}) { - super([ - "Could not find an Account to execute with this Action.", - "Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client." - ].join(` -`), { - docsPath: e, - docsSlug: "account", - name: "AccountNotFoundError" - }); - } -} -class Dd extends gt { - constructor({ docsPath: e, metaMessages: r, type: n }) { - super(`Account type "${n}" is not supported.`, { - docsPath: e, - metaMessages: r, - name: "AccountTypeNotSupportedError" - }); - } -} -function T4({ chain: t, currentChainId: e }) { - if (!t) - throw new tL(); - if (e !== t.id) - throw new eL({ chain: t, currentChainId: e }); -} -function R4(t, { docsPath: e, ...r }) { - const n = (() => { - const i = w4(t, r); - return i instanceof Hv ? t : i; - })(); - return new iN(n, { - docsPath: e, - ...r - }); -} -async function D4(t, { serializedTransaction: e }) { - return t.request({ - method: "eth_sendRawTransaction", - params: [e] - }, { retryCount: 0 }); -} -const nm = new W0(128); -async function G0(t, e) { - var k, W, U, V; - const { account: r = t.account, chain: n = t.chain, accessList: i, authorizationList: s, blobs: o, data: a, gas: u, gasPrice: l, maxFeePerBlobGas: d, maxFeePerGas: p, maxPriorityFeePerGas: w, nonce: _, type: P, value: O, ...L } = e; - if (typeof r > "u") - throw new Pc({ - docsPath: "/docs/actions/wallet/sendTransaction" - }); - const B = r ? _i(r) : null; - try { - V0(e); - const Q = await (async () => { - if (e.to) - return e.to; - if (e.to !== null && s && s.length > 0) - return await y4({ - authorization: s[0] - }).catch(() => { - throw new gt("`to` is required. Could not infer from `authorizationList`."); - }); - })(); - if ((B == null ? void 0 : B.type) === "json-rpc" || B === null) { - let R; - n !== null && (R = await Xn(t, Gl, "getChainId")({}), T4({ - currentChainId: R, - chain: n - })); - const K = (U = (W = (k = t.chain) == null ? void 0 : k.formatters) == null ? void 0 : W.transactionRequest) == null ? void 0 : U.format, Ee = (K || Kv)({ - // Pick out extra data that might exist on the chain's transaction request type. - ...x4(L, { format: K }), - accessList: i, - authorizationList: s, - blobs: o, - chainId: R, - data: a, - from: B == null ? void 0 : B.address, - gas: u, - gasPrice: l, - maxFeePerBlobGas: d, - maxFeePerGas: p, - maxPriorityFeePerGas: w, - nonce: _, - to: Q, - type: P, - value: O - }), Y = nm.get(t.uid), A = Y ? "wallet_sendTransaction" : "eth_sendTransaction"; - try { - return await t.request({ - method: A, - params: [Ee] - }, { retryCount: 0 }); - } catch (m) { - if (Y === !1) - throw m; - const f = m; - if (f.name === "InvalidInputRpcError" || f.name === "InvalidParamsRpcError" || f.name === "MethodNotFoundRpcError" || f.name === "MethodNotSupportedRpcError") - return await t.request({ - method: "wallet_sendTransaction", - params: [Ee] - }, { retryCount: 0 }).then((g) => (nm.set(t.uid, !0), g)).catch((g) => { - const b = g; - throw b.name === "MethodNotFoundRpcError" || b.name === "MethodNotSupportedRpcError" ? (nm.set(t.uid, !1), f) : b; - }); - throw f; - } - } - if ((B == null ? void 0 : B.type) === "local") { - const R = await Xn(t, Yv, "prepareTransactionRequest")({ - account: B, - accessList: i, - authorizationList: s, - blobs: o, - chain: n, - data: a, - gas: u, - gasPrice: l, - maxFeePerBlobGas: d, - maxFeePerGas: p, - maxPriorityFeePerGas: w, - nonce: _, - nonceManager: B.nonceManager, - parameters: [...C4, "sidecars"], - type: P, - value: O, - ...L, - to: Q - }), K = (V = n == null ? void 0 : n.serializers) == null ? void 0 : V.transaction, ge = await B.signTransaction(R, { - serializer: K - }); - return await Xn(t, D4, "sendRawTransaction")({ - serializedTransaction: ge - }); - } - throw (B == null ? void 0 : B.type) === "smart" ? new Dd({ - metaMessages: [ - "Consider using the `sendUserOperation` Action instead." - ], - docsPath: "/docs/actions/bundler/sendUserOperation", - type: "smart" - }) : new Dd({ - docsPath: "/docs/actions/wallet/sendTransaction", - type: B == null ? void 0 : B.type - }); - } catch (Q) { - throw Q instanceof Dd ? Q : R4(Q, { - ...e, - account: B, - chain: e.chain || void 0 - }); - } -} -async function aL(t, e) { - const { abi: r, account: n = t.account, address: i, args: s, dataSuffix: o, functionName: a, ...u } = e; - if (typeof n > "u") - throw new Pc({ - docsPath: "/docs/contract/writeContract" - }); - const l = n ? _i(n) : null, d = f4({ - abi: r, - args: s, - functionName: a - }); - try { - return await Xn(t, G0, "sendTransaction")({ - data: `${d}${o ? o.replace("0x", "") : ""}`, - to: i, - account: l, - ...u - }); - } catch (p) { - throw dN(p, { - abi: r, - address: i, - args: s, - docsPath: "/docs/contract/writeContract", - functionName: a, - sender: l == null ? void 0 : l.address - }); - } -} -const cL = { - "0x0": "reverted", - "0x1": "success" -}, O4 = "0x5792579257925792579257925792579257925792579257925792579257925792", N4 = vr(0, { - size: 32 -}); -async function uL(t, e) { - const { account: r = t.account, capabilities: n, chain: i = t.chain, experimental_fallback: s, experimental_fallbackDelay: o = 32, forceAtomic: a = !1, id: u, version: l = "2.0.0" } = e, d = r ? _i(r) : null, p = e.calls.map((w) => { - const _ = w, P = _.abi ? f4({ - abi: _.abi, - functionName: _.functionName, - args: _.args - }) : _.data; - return { - data: _.dataSuffix && P ? Ea([P, _.dataSuffix]) : P, - to: _.to, - value: _.value ? vr(_.value) : void 0 - }; - }); - try { - const w = await t.request({ - method: "wallet_sendCalls", - params: [ - { - atomicRequired: a, - calls: p, - capabilities: n, - chainId: vr(i.id), - from: d == null ? void 0 : d.address, - id: u, - version: l - } - ] - }, { retryCount: 0 }); - return typeof w == "string" ? { id: w } : w; - } catch (w) { - const _ = w; - if (s && (_.name === "MethodNotFoundRpcError" || _.name === "MethodNotSupportedRpcError" || _.name === "UnknownRpcError" || _.details.toLowerCase().includes("does not exist / is not available") || _.details.toLowerCase().includes("missing or invalid. request()") || _.details.toLowerCase().includes("did not match any variant of untagged enum") || _.details.toLowerCase().includes("account upgraded to unsupported contract") || _.details.toLowerCase().includes("eip-7702 not supported") || _.details.toLowerCase().includes("unsupported wc_ method"))) { - if (n && Object.values(n).some((k) => !k.optional)) { - const k = "non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`."; - throw new Tu(new gt(k, { - details: k - })); - } - if (a && p.length > 1) { - const B = "`forceAtomic` is not supported on fallback to `eth_sendTransaction`."; - throw new Ru(new gt(B, { - details: B - })); - } - const P = []; - for (const B of p) { - const k = G0(t, { - account: d, - chain: i, - data: B.data, - to: B.to, - value: B.value ? wa(B.value) : void 0 - }); - P.push(k), o > 0 && await new Promise((W) => setTimeout(W, o)); - } - const O = await Promise.allSettled(P); - if (O.every((B) => B.status === "rejected")) - throw O[0].reason; - const L = O.map((B) => B.status === "fulfilled" ? B.value : N4); - return { - id: Ea([ - ...L, - vr(i.id, { size: 32 }), - O4 - ]) - }; - } - throw R4(w, { - ...e, - account: d, - chain: e.chain - }); - } -} -async function L4(t, e) { - async function r(d) { - if (d.endsWith(O4.slice(2))) { - const w = j0(l1(d, -64, -32)), _ = l1(d, 0, -64).slice(2).match(/.{1,64}/g), P = await Promise.all(_.map((L) => N4.slice(2) !== L ? t.request({ - method: "eth_getTransactionReceipt", - params: [`0x${L}`] - }, { dedupe: !0 }) : void 0)), O = P.some((L) => L === null) ? 100 : P.every((L) => (L == null ? void 0 : L.status) === "0x1") ? 200 : P.every((L) => (L == null ? void 0 : L.status) === "0x0") ? 500 : 600; - return { - atomic: !1, - chainId: xa(w), - receipts: P.filter(Boolean), - status: O, - version: "2.0.0" - }; - } - return t.request({ - method: "wallet_getCallsStatus", - params: [d] - }); - } - const { atomic: n = !1, chainId: i, receipts: s, version: o = "2.0.0", ...a } = await r(e.id), [u, l] = (() => { - const d = a.status; - return d >= 100 && d < 200 ? ["pending", d] : d >= 200 && d < 300 ? ["success", d] : d >= 300 && d < 700 ? ["failure", d] : d === "CONFIRMED" ? ["success", 200] : d === "PENDING" ? ["pending", 100] : [void 0, d]; - })(); - return { - ...a, - atomic: n, - // @ts-expect-error: for backwards compatibility - chainId: i ? xa(i) : void 0, - receipts: (s == null ? void 0 : s.map((d) => ({ - ...d, - blockNumber: wa(d.blockNumber), - gasUsed: wa(d.gasUsed), - status: cL[d.status] - }))) ?? [], - statusCode: l, - status: u, - version: o - }; -} -async function fL(t, e) { - const { id: r, pollingInterval: n = t.pollingInterval, status: i = ({ statusCode: w }) => w >= 200, timeout: s = 6e4 } = e, o = Ac(["waitForCallsStatus", t.uid, r]), { promise: a, resolve: u, reject: l } = nL(); - let d; - const p = sL(o, { resolve: u, reject: l }, (w) => { - const _ = oL(async () => { - const P = (O) => { - clearTimeout(d), _(), O(), p(); - }; - try { - const O = await L4(t, { id: r }); - if (!i(O)) - return; - P(() => w.resolve(O)); - } catch (O) { - P(() => w.reject(O)); - } - }, { - interval: n, - emitOnBegin: !0 - }); - return _; - }); - return d = s ? setTimeout(() => { - p(), clearTimeout(d), l(new lL({ id: r })); - }, s) : void 0, await a; -} -class lL extends gt { - constructor({ id: e }) { - super(`Timed out while waiting for call bundle with id "${e}" to be confirmed.`, { name: "WaitForCallsStatusTimeoutError" }); - } -} -const E1 = 256; -let hd = E1, dd; -function k4(t = 11) { - if (!dd || hd + t > E1 * 2) { - dd = "", hd = 0; - for (let e = 0; e < E1; e++) - dd += (256 + Math.random() * 256 | 0).toString(16).substring(1); - } - return dd.substring(hd, hd++ + t); -} -function hL(t) { - const { batch: e, chain: r, ccipRead: n, key: i = "base", name: s = "Base Client", type: o = "base" } = t, a = (r == null ? void 0 : r.blockTime) ?? 12e3, u = Math.min(Math.max(Math.floor(a / 2), 500), 4e3), l = t.pollingInterval ?? u, d = t.cacheTime ?? l, p = t.account ? _i(t.account) : void 0, { config: w, request: _, value: P } = t.transport({ - chain: r, - pollingInterval: l - }), O = { ...w, ...P }, L = { - account: p, - batch: e, - cacheTime: d, - ccipRead: n, - chain: r, - key: i, - name: s, - pollingInterval: l, - request: _, - transport: O, - type: o, - uid: k4() - }; - function B(k) { - return (W) => { - const U = W(k); - for (const Q in L) - delete U[Q]; - const V = { ...k, ...U }; - return Object.assign(V, { extend: B(V) }); - }; - } - return Object.assign(L, { extend: B(L) }); -} -const pd = /* @__PURE__ */ new W0(8192); -function dL(t, { enabled: e = !0, id: r }) { - if (!e || !r) - return t(); - if (pd.get(r)) - return pd.get(r); - const n = t().finally(() => pd.delete(r)); - return pd.set(r, n), n; -} -function pL(t, { delay: e = 100, retryCount: r = 2, shouldRetry: n = () => !0 } = {}) { - return new Promise((i, s) => { - const o = async ({ count: a = 0 } = {}) => { - const u = async ({ error: l }) => { - const d = typeof e == "function" ? e({ count: a, error: l }) : e; - d && await _1(d), o({ count: a + 1 }); - }; - try { - const l = await t(); - i(l); - } catch (l) { - if (a < r && await n({ count: a, error: l })) - return u({ error: l }); - s(l); - } - }; - o(); - }); -} -function gL(t, e = {}) { - return async (r, n = {}) => { - var p; - const { dedupe: i = !1, methods: s, retryDelay: o = 150, retryCount: a = 3, uid: u } = { - ...e, - ...n - }, { method: l } = r; - if ((p = s == null ? void 0 : s.exclude) != null && p.includes(l)) - throw new cc(new Error("method not supported"), { - method: l - }); - if (s != null && s.include && !s.include.includes(l)) - throw new cc(new Error("method not supported"), { - method: l - }); - const d = i ? U0(`${u}.${Ac(r)}`) : void 0; - return dL(() => pL(async () => { - try { - return await t(r); - } catch (w) { - const _ = w; - switch (_.code) { - case fl.code: - throw new fl(_); - case ll.code: - throw new ll(_); - case hl.code: - throw new hl(_, { method: r.method }); - case dl.code: - throw new dl(_); - case vc.code: - throw new vc(_); - case pl.code: - throw new pl(_); - case gl.code: - throw new gl(_); - case ml.code: - throw new ml(_); - case vl.code: - throw new vl(_); - case cc.code: - throw new cc(_, { - method: r.method - }); - case Cu.code: - throw new Cu(_); - case bl.code: - throw new bl(_); - case bu.code: - throw new bu(_); - case yl.code: - throw new yl(_); - case wl.code: - throw new wl(_); - case xl.code: - throw new xl(_); - case _l.code: - throw new _l(_); - case El.code: - throw new El(_); - case Tu.code: - throw new Tu(_); - case Sl.code: - throw new Sl(_); - case Al.code: - throw new Al(_); - case Pl.code: - throw new Pl(_); - case Ml.code: - throw new Ml(_); - case Il.code: - throw new Il(_); - case Ru.code: - throw new Ru(_); - case 5e3: - throw new bu(_); - default: - throw w instanceof gt ? w : new lN(_); - } - } - }, { - delay: ({ count: w, error: _ }) => { - var P; - if (_ && _ instanceof g4) { - const O = (P = _ == null ? void 0 : _.headers) == null ? void 0 : P.get("Retry-After"); - if (O != null && O.match(/\d/)) - return Number.parseInt(O) * 1e3; - } - return ~~(1 << w) * o; - }, - retryCount: a, - shouldRetry: ({ error: w }) => mL(w) - }), { enabled: i, id: d }); - }; -} -function mL(t) { - return "code" in t && typeof t.code == "number" ? t.code === -1 || t.code === Cu.code || t.code === vc.code : t instanceof g4 && t.status ? t.status === 403 || t.status === 408 || t.status === 413 || t.status === 429 || t.status === 500 || t.status === 502 || t.status === 503 || t.status === 504 : !0; -} -function vL({ key: t, methods: e, name: r, request: n, retryCount: i = 3, retryDelay: s = 150, timeout: o, type: a }, u) { - const l = k4(); - return { - config: { - key: t, - methods: e, - name: r, - request: n, - retryCount: i, - retryDelay: s, - timeout: o, - type: a - }, - request: gL(n, { methods: e, retryCount: i, retryDelay: s, uid: l }), - value: u - }; -} -function gd(t, e = {}) { - const { key: r = "custom", methods: n, name: i = "Custom Provider", retryDelay: s } = e; - return ({ retryCount: o }) => vL({ - key: r, - methods: n, - name: i, - request: t.request.bind(t), - retryCount: e.retryCount ?? o, - retryDelay: s, - type: "custom" - }); -} -function bL(t) { - return { - formatters: void 0, - fees: void 0, - serializers: void 0, - ...t - }; -} -class yL extends gt { - constructor({ domain: e }) { - super(`Invalid domain "${Ac(e)}".`, { - metaMessages: ["Must be a valid EIP-712 domain."] - }); - } -} -class wL extends gt { - constructor({ primaryType: e, types: r }) { - super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`, { - docsPath: "/api/glossary/Errors#typeddatainvalidprimarytypeerror", - metaMessages: ["Check that the primary type is a key in `types`."] - }); - } -} -class xL extends gt { - constructor({ type: e }) { - super(`Struct type "${e}" is invalid.`, { - metaMessages: ["Struct type must not be a Solidity type."], - name: "InvalidStructTypeError" - }); - } -} -function _L(t) { - const { domain: e, message: r, primaryType: n, types: i } = t, s = (u, l) => { - const d = { ...l }; - for (const p of u) { - const { name: w, type: _ } = p; - _ === "address" && (d[w] = d[w].toLowerCase()); - } - return d; - }, o = i.EIP712Domain ? e ? s(i.EIP712Domain, e) : {} : {}, a = (() => { - if (n !== "EIP712Domain") - return s(i[n], r); - })(); - return Ac({ domain: o, message: a, primaryType: n, types: i }); -} -function EL(t) { - const { domain: e, message: r, primaryType: n, types: i } = t, s = (o, a) => { - for (const u of o) { - const { name: l, type: d } = u, p = a[l], w = d.match(o4); - if (w && (typeof p == "number" || typeof p == "bigint")) { - const [O, L, B] = w; - vr(p, { - signed: L === "int", - size: Number.parseInt(B) / 8 - }); - } - if (d === "address" && typeof p == "string" && !Ms(p)) - throw new _a({ address: p }); - const _ = d.match(SO); - if (_) { - const [O, L] = _; - if (L && xn(p) !== Number.parseInt(L)) - throw new PD({ - expectedSize: Number.parseInt(L), - givenSize: xn(p) - }); - } - const P = i[d]; - P && (AL(d), s(P, p)); - } - }; - if (i.EIP712Domain && e) { - if (typeof e != "object") - throw new yL({ domain: e }); - s(i.EIP712Domain, e); - } - if (n !== "EIP712Domain") - if (i[n]) - s(i[n], r); - else - throw new wL({ primaryType: n, types: i }); -} -function SL({ domain: t }) { - return [ - typeof (t == null ? void 0 : t.name) == "string" && { name: "name", type: "string" }, - (t == null ? void 0 : t.version) && { name: "version", type: "string" }, - (typeof (t == null ? void 0 : t.chainId) == "number" || typeof (t == null ? void 0 : t.chainId) == "bigint") && { - name: "chainId", - type: "uint256" - }, - (t == null ? void 0 : t.verifyingContract) && { - name: "verifyingContract", - type: "address" - }, - (t == null ? void 0 : t.salt) && { name: "salt", type: "bytes32" } - ].filter(Boolean); -} -function AL(t) { - if (t === "address" || t === "bool" || t === "string" || t.startsWith("bytes") || t.startsWith("uint") || t.startsWith("int")) - throw new xL({ type: t }); -} -async function PL(t, { chain: e }) { - const { id: r, name: n, nativeCurrency: i, rpcUrls: s, blockExplorers: o } = e; - await t.request({ - method: "wallet_addEthereumChain", - params: [ - { - chainId: vr(r), - chainName: n, - nativeCurrency: i, - rpcUrls: s.default.http, - blockExplorerUrls: o ? Object.values(o).map(({ url: a }) => a) : void 0 - } - ] - }, { dedupe: !0, retryCount: 0 }); -} -function ML(t, e) { - const { abi: r, args: n, bytecode: i, ...s } = e, o = rL({ abi: r, args: n, bytecode: i }); - return G0(t, { - ...s, - ...s.authorizationList ? { to: null } : {}, - data: o - }); -} -async function IL(t) { - var r; - return ((r = t.account) == null ? void 0 : r.type) === "local" ? [t.account.address] : (await t.request({ method: "eth_accounts" }, { dedupe: !0 })).map((n) => Vl(n)); -} -async function CL(t, e = {}) { - const { account: r = t.account, chainId: n } = e, i = r ? _i(r) : void 0, s = n ? [i == null ? void 0 : i.address, [vr(n)]] : [i == null ? void 0 : i.address], o = await t.request({ - method: "wallet_getCapabilities", - params: s - }), a = {}; - for (const [u, l] of Object.entries(o)) { - a[Number(u)] = {}; - for (let [d, p] of Object.entries(l)) - d === "addSubAccount" && (d = "unstable_addSubAccount"), a[Number(u)][d] = p; - } - return typeof n == "number" ? a[n] : a; -} -async function TL(t) { - return await t.request({ method: "wallet_getPermissions" }, { dedupe: !0 }); -} -async function $4(t, e) { - var u; - const { account: r = t.account, chainId: n, nonce: i } = e; - if (!r) - throw new Pc({ - docsPath: "/docs/eip7702/prepareAuthorization" - }); - const s = _i(r), o = (() => { - if (e.executor) - return e.executor === "self" ? e.executor : _i(e.executor); - })(), a = { - address: e.contractAddress ?? e.address, - chainId: n, - nonce: i - }; - return typeof a.chainId > "u" && (a.chainId = ((u = t.chain) == null ? void 0 : u.id) ?? await Xn(t, Gl, "getChainId")({})), typeof a.nonce > "u" && (a.nonce = await Xn(t, E4, "getTransactionCount")({ - address: s.address, - blockTag: "pending" - }), (o === "self" || o != null && o.address && QN(o.address, s.address)) && (a.nonce += 1)), a; -} -async function RL(t) { - return (await t.request({ method: "eth_requestAccounts" }, { dedupe: !0, retryCount: 0 })).map((r) => Fv(r)); -} -async function DL(t, e) { - return t.request({ - method: "wallet_requestPermissions", - params: [e] - }, { retryCount: 0 }); -} -async function OL(t, e) { - const { id: r } = e; - await t.request({ - method: "wallet_showCallsStatus", - params: [r] - }); -} -async function NL(t, e) { - const { account: r = t.account } = e; - if (!r) - throw new Pc({ - docsPath: "/docs/eip7702/signAuthorization" - }); - const n = _i(r); - if (!n.signAuthorization) - throw new Dd({ - docsPath: "/docs/eip7702/signAuthorization", - metaMessages: [ - "The `signAuthorization` Action does not support JSON-RPC Accounts." - ], - type: n.type - }); - const i = await $4(t, e); - return n.signAuthorization(i); -} -async function LL(t, { account: e = t.account, message: r }) { - if (!e) - throw new Pc({ - docsPath: "/docs/actions/wallet/signMessage" - }); - const n = _i(e); - if (n.signMessage) - return n.signMessage({ message: r }); - const i = typeof r == "string" ? U0(r) : r.raw instanceof Uint8Array ? t0(r.raw) : r.raw; - return t.request({ - method: "personal_sign", - params: [i, n.address] - }, { retryCount: 0 }); -} -async function kL(t, e) { - var l, d, p, w; - const { account: r = t.account, chain: n = t.chain, ...i } = e; - if (!r) - throw new Pc({ - docsPath: "/docs/actions/wallet/signTransaction" - }); - const s = _i(r); - V0({ - account: s, - ...e - }); - const o = await Xn(t, Gl, "getChainId")({}); - n !== null && T4({ - currentChainId: o, - chain: n - }); - const a = (n == null ? void 0 : n.formatters) || ((l = t.chain) == null ? void 0 : l.formatters), u = ((d = a == null ? void 0 : a.transactionRequest) == null ? void 0 : d.format) || Kv; - return s.signTransaction ? s.signTransaction({ - ...i, - chainId: o - }, { serializer: (w = (p = t.chain) == null ? void 0 : p.serializers) == null ? void 0 : w.transaction }) : await t.request({ - method: "eth_signTransaction", - params: [ - { - ...u(i), - chainId: vr(o), - from: s.address - } - ] - }, { retryCount: 0 }); -} -async function $L(t, e) { - const { account: r = t.account, domain: n, message: i, primaryType: s } = e; - if (!r) - throw new Pc({ - docsPath: "/docs/actions/wallet/signTypedData" - }); - const o = _i(r), a = { - EIP712Domain: SL({ domain: n }), - ...e.types - }; - if (EL({ domain: n, message: i, primaryType: s, types: a }), o.signTypedData) - return o.signTypedData({ domain: n, message: i, primaryType: s, types: a }); - const u = _L({ domain: n, message: i, primaryType: s, types: a }); - return t.request({ - method: "eth_signTypedData_v4", - params: [o.address, u] - }, { retryCount: 0 }); -} -async function BL(t, { id: e }) { - await t.request({ - method: "wallet_switchEthereumChain", - params: [ - { - chainId: vr(e) - } - ] - }, { retryCount: 0 }); -} -async function FL(t, e) { - return await t.request({ - method: "wallet_watchAsset", - params: e - }, { retryCount: 0 }); -} -function jL(t) { - return { - addChain: (e) => PL(t, e), - deployContract: (e) => ML(t, e), - getAddresses: () => IL(t), - getCallsStatus: (e) => L4(t, e), - getCapabilities: (e) => CL(t, e), - getChainId: () => Gl(t), - getPermissions: () => TL(t), - prepareAuthorization: (e) => $4(t, e), - prepareTransactionRequest: (e) => Yv(t, e), - requestAddresses: () => RL(t), - requestPermissions: (e) => DL(t, e), - sendCalls: (e) => uL(t, e), - sendRawTransaction: (e) => D4(t, e), - sendTransaction: (e) => G0(t, e), - showCallsStatus: (e) => OL(t, e), - signAuthorization: (e) => NL(t, e), - signMessage: (e) => LL(t, e), - signTransaction: (e) => kL(t, e), - signTypedData: (e) => $L(t, e), - switchChain: (e) => BL(t, e), - waitForCallsStatus: (e) => fL(t, e), - watchAsset: (e) => FL(t, e), - writeContract: (e) => aL(t, e) - }; -} -function md(t) { - const { key: e = "wallet", name: r = "Wallet Client", transport: n } = t; - return hL({ - ...t, - key: e, - name: r, - transport: n, - type: "walletClient" - }).extend(jL); -} -class yu { - constructor(e) { - vs(this, "_key"); - vs(this, "_config", null); - vs(this, "_provider", null); - vs(this, "_connected", !1); - vs(this, "_address", null); - vs(this, "_fatured", !1); - vs(this, "_installed", !1); - vs(this, "lastUsed", !1); - vs(this, "_client", null); - var r; - if ("name" in e && "image" in e) - this._key = e.name, this._config = e, this._fatured = e.featured; - else if ("session" in e) { - if (!e.session) throw new Error("session is null"); - this._key = (r = e.session) == null ? void 0 : r.peer.metadata.name, this._provider = e, this._client = md({ transport: gd(this._provider) }), this._config = { - name: e.session.peer.metadata.name, - image: e.session.peer.metadata.icons[0], - featured: !1 - }, this.testConnect(); - } else if ("info" in e) - this._key = e.info.name, this._provider = e.provider, this._installed = !0, this._client = md({ transport: gd(this._provider) }), this._config = { - name: e.info.name, - image: e.info.icon, - featured: !1 - }, this.testConnect(); - else - throw new Error("unknown params"); - } - get address() { - return this._address; - } - get connected() { - return this._connected; - } - get featured() { - return this._fatured; - } - get key() { - return this._key; - } - get installed() { - return this._installed; - } - get provider() { - return this._provider; - } - get client() { - return this._client ? this._client : null; - } - get config() { - return this._config; - } - static fromWalletConfig(e) { - return new yu(e); - } - EIP6963Detected(e) { - this._provider = e.provider, this._client = md({ transport: gd(this._provider) }), this._installed = !0, this._provider.on("disconnect", this.disconnect), this._provider.on("accountsChanged", (r) => { - this._address = r[0], this._connected = !0; - }), this.testConnect(); - } - setUniversalProvider(e) { - this._provider = e, this._client = md({ transport: gd(this._provider) }), this.testConnect(); - } - async switchChain(e) { - var r, n, i, s; - try { - return await ((r = this.client) == null ? void 0 : r.getChainId()) === e.id || await ((n = this.client) == null ? void 0 : n.switchChain(e)), !0; - } catch (o) { - if (o.code === 4902) - return await ((i = this.client) == null ? void 0 : i.addChain({ chain: e })), await ((s = this.client) == null ? void 0 : s.switchChain(e)), !0; - throw o; - } - } - async testConnect() { - var r; - const e = await ((r = this.client) == null ? void 0 : r.getAddresses()); - e && e.length > 0 ? (this._address = e[0], this._connected = !0) : (this._address = null, this._connected = !1); - } - async connect() { - var r; - const e = await ((r = this.client) == null ? void 0 : r.requestAddresses()); - if (!e) throw new Error("connect failed"); - return e; - } - async getAddress() { - var r; - const e = await ((r = this.client) == null ? void 0 : r.getAddresses()); - if (!e) throw new Error("get address failed"); - return e[0]; - } - async getChain() { - var r; - const e = await ((r = this.client) == null ? void 0 : r.getChainId()); - if (!e) throw new Error("get chain failed"); - return e; - } - async signMessage(e, r) { - var i; - return await ((i = this.client) == null ? void 0 : i.signMessage({ message: e, account: r })); - } - async disconnect() { - this._provider && "session" in this._provider && await this._provider.disconnect(), this._connected = !1, this._address = null; - } -} -var Jv = { exports: {} }, wu = typeof Reflect == "object" ? Reflect : null, J2 = wu && typeof wu.apply == "function" ? wu.apply : function(e, r, n) { - return Function.prototype.apply.call(e, r, n); -}, Od; -wu && typeof wu.ownKeys == "function" ? Od = wu.ownKeys : Object.getOwnPropertySymbols ? Od = function(e) { - return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e)); -} : Od = function(e) { - return Object.getOwnPropertyNames(e); -}; -function UL(t) { - console && console.warn && console.warn(t); -} -var B4 = Number.isNaN || function(e) { - return e !== e; -}; -function kr() { - kr.init.call(this); -} -Jv.exports = kr; -Jv.exports.once = HL; -kr.EventEmitter = kr; -kr.prototype._events = void 0; -kr.prototype._eventsCount = 0; -kr.prototype._maxListeners = void 0; -var X2 = 10; -function Y0(t) { - if (typeof t != "function") - throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof t); -} -Object.defineProperty(kr, "defaultMaxListeners", { - enumerable: !0, - get: function() { - return X2; - }, - set: function(t) { - if (typeof t != "number" || t < 0 || B4(t)) - throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + t + "."); - X2 = t; - } -}); -kr.init = function() { - (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0; -}; -kr.prototype.setMaxListeners = function(e) { - if (typeof e != "number" || e < 0 || B4(e)) - throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + "."); - return this._maxListeners = e, this; -}; -function F4(t) { - return t._maxListeners === void 0 ? kr.defaultMaxListeners : t._maxListeners; -} -kr.prototype.getMaxListeners = function() { - return F4(this); -}; -kr.prototype.emit = function(e) { - for (var r = [], n = 1; n < arguments.length; n++) r.push(arguments[n]); - var i = e === "error", s = this._events; - if (s !== void 0) - i = i && s.error === void 0; - else if (!i) - return !1; - if (i) { - var o; - if (r.length > 0 && (o = r[0]), o instanceof Error) - throw o; - var a = new Error("Unhandled error." + (o ? " (" + o.message + ")" : "")); - throw a.context = o, a; - } - var u = s[e]; - if (u === void 0) - return !1; - if (typeof u == "function") - J2(u, this, r); - else - for (var l = u.length, d = W4(u, l), n = 0; n < l; ++n) - J2(d[n], this, r); - return !0; -}; -function j4(t, e, r, n) { - var i, s, o; - if (Y0(r), s = t._events, s === void 0 ? (s = t._events = /* @__PURE__ */ Object.create(null), t._eventsCount = 0) : (s.newListener !== void 0 && (t.emit( - "newListener", - e, - r.listener ? r.listener : r - ), s = t._events), o = s[e]), o === void 0) - o = s[e] = r, ++t._eventsCount; - else if (typeof o == "function" ? o = s[e] = n ? [r, o] : [o, r] : n ? o.unshift(r) : o.push(r), i = F4(t), i > 0 && o.length > i && !o.warned) { - o.warned = !0; - var a = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit"); - a.name = "MaxListenersExceededWarning", a.emitter = t, a.type = e, a.count = o.length, UL(a); - } - return t; -} -kr.prototype.addListener = function(e, r) { - return j4(this, e, r, !1); -}; -kr.prototype.on = kr.prototype.addListener; -kr.prototype.prependListener = function(e, r) { - return j4(this, e, r, !0); -}; -function qL() { - if (!this.fired) - return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments); -} -function U4(t, e, r) { - var n = { fired: !1, wrapFn: void 0, target: t, type: e, listener: r }, i = qL.bind(n); - return i.listener = r, n.wrapFn = i, i; -} -kr.prototype.once = function(e, r) { - return Y0(r), this.on(e, U4(this, e, r)), this; -}; -kr.prototype.prependOnceListener = function(e, r) { - return Y0(r), this.prependListener(e, U4(this, e, r)), this; -}; -kr.prototype.removeListener = function(e, r) { - var n, i, s, o, a; - if (Y0(r), i = this._events, i === void 0) - return this; - if (n = i[e], n === void 0) - return this; - if (n === r || n.listener === r) - --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete i[e], i.removeListener && this.emit("removeListener", e, n.listener || r)); - else if (typeof n != "function") { - for (s = -1, o = n.length - 1; o >= 0; o--) - if (n[o] === r || n[o].listener === r) { - a = n[o].listener, s = o; - break; - } - if (s < 0) - return this; - s === 0 ? n.shift() : zL(n, s), n.length === 1 && (i[e] = n[0]), i.removeListener !== void 0 && this.emit("removeListener", e, a || r); - } - return this; -}; -kr.prototype.off = kr.prototype.removeListener; -kr.prototype.removeAllListeners = function(e) { - var r, n, i; - if (n = this._events, n === void 0) - return this; - if (n.removeListener === void 0) - return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : n[e] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete n[e]), this; - if (arguments.length === 0) { - var s = Object.keys(n), o; - for (i = 0; i < s.length; ++i) - o = s[i], o !== "removeListener" && this.removeAllListeners(o); - return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this; - } - if (r = n[e], typeof r == "function") - this.removeListener(e, r); - else if (r !== void 0) - for (i = r.length - 1; i >= 0; i--) - this.removeListener(e, r[i]); - return this; -}; -function q4(t, e, r) { - var n = t._events; - if (n === void 0) - return []; - var i = n[e]; - return i === void 0 ? [] : typeof i == "function" ? r ? [i.listener || i] : [i] : r ? WL(i) : W4(i, i.length); -} -kr.prototype.listeners = function(e) { - return q4(this, e, !0); -}; -kr.prototype.rawListeners = function(e) { - return q4(this, e, !1); -}; -kr.listenerCount = function(t, e) { - return typeof t.listenerCount == "function" ? t.listenerCount(e) : z4.call(t, e); -}; -kr.prototype.listenerCount = z4; -function z4(t) { - var e = this._events; - if (e !== void 0) { - var r = e[t]; - if (typeof r == "function") - return 1; - if (r !== void 0) - return r.length; - } - return 0; -} -kr.prototype.eventNames = function() { - return this._eventsCount > 0 ? Od(this._events) : []; -}; -function W4(t, e) { - for (var r = new Array(e), n = 0; n < e; ++n) - r[n] = t[n]; - return r; -} -function zL(t, e) { - for (; e + 1 < t.length; e++) - t[e] = t[e + 1]; - t.pop(); -} -function WL(t) { - for (var e = new Array(t.length), r = 0; r < e.length; ++r) - e[r] = t[r].listener || t[r]; - return e; -} -function HL(t, e) { - return new Promise(function(r, n) { - function i(o) { - t.removeListener(e, s), n(o); - } - function s() { - typeof t.removeListener == "function" && t.removeListener("error", i), r([].slice.call(arguments)); - } - H4(t, e, s, { once: !0 }), e !== "error" && KL(t, i, { once: !0 }); - }); -} -function KL(t, e, r) { - typeof t.on == "function" && H4(t, "error", e, r); -} -function H4(t, e, r, n) { - if (typeof t.on == "function") - n.once ? t.once(e, r) : t.on(e, r); - else if (typeof t.addEventListener == "function") - t.addEventListener(e, function i(s) { - n.once && t.removeEventListener(e, i), r(s); - }); - else - throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof t); -} -var is = Jv.exports; -const Xv = /* @__PURE__ */ ns(is); -var vt = {}; -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -var S1 = function(t, e) { - return S1 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) { - r.__proto__ = n; - } || function(r, n) { - for (var i in n) n.hasOwnProperty(i) && (r[i] = n[i]); - }, S1(t, e); -}; -function VL(t, e) { - S1(t, e); - function r() { - this.constructor = t; - } - t.prototype = e === null ? Object.create(e) : (r.prototype = e.prototype, new r()); -} -var A1 = function() { - return A1 = Object.assign || function(e) { - for (var r, n = 1, i = arguments.length; n < i; n++) { - r = arguments[n]; - for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]); - } - return e; - }, A1.apply(this, arguments); -}; -function GL(t, e) { - var r = {}; - for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); - if (t != null && typeof Object.getOwnPropertySymbols == "function") - for (var i = 0, n = Object.getOwnPropertySymbols(t); i < n.length; i++) - e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]); - return r; -} -function YL(t, e, r, n) { - var i = arguments.length, s = i < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, r) : n, o; - if (typeof Reflect == "object" && typeof Reflect.decorate == "function") s = Reflect.decorate(t, e, r, n); - else for (var a = t.length - 1; a >= 0; a--) (o = t[a]) && (s = (i < 3 ? o(s) : i > 3 ? o(e, r, s) : o(e, r)) || s); - return i > 3 && s && Object.defineProperty(e, r, s), s; -} -function JL(t, e) { - return function(r, n) { - e(r, n, t); - }; -} -function XL(t, e) { - if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(t, e); -} -function ZL(t, e, r, n) { - function i(s) { - return s instanceof r ? s : new r(function(o) { - o(s); - }); - } - return new (r || (r = Promise))(function(s, o) { - function a(d) { - try { - l(n.next(d)); - } catch (p) { - o(p); - } - } - function u(d) { - try { - l(n.throw(d)); - } catch (p) { - o(p); - } - } - function l(d) { - d.done ? s(d.value) : i(d.value).then(a, u); - } - l((n = n.apply(t, e || [])).next()); - }); -} -function QL(t, e) { - var r = { label: 0, sent: function() { - if (s[0] & 1) throw s[1]; - return s[1]; - }, trys: [], ops: [] }, n, i, s, o; - return o = { next: a(0), throw: a(1), return: a(2) }, typeof Symbol == "function" && (o[Symbol.iterator] = function() { - return this; - }), o; - function a(l) { - return function(d) { - return u([l, d]); - }; - } - function u(l) { - if (n) throw new TypeError("Generator is already executing."); - for (; r; ) try { - if (n = 1, i && (s = l[0] & 2 ? i.return : l[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, l[1])).done) return s; - switch (i = 0, s && (l = [l[0] & 2, s.value]), l[0]) { - case 0: - case 1: - s = l; - break; - case 4: - return r.label++, { value: l[1], done: !1 }; - case 5: - r.label++, i = l[1], l = [0]; - continue; - case 7: - l = r.ops.pop(), r.trys.pop(); - continue; - default: - if (s = r.trys, !(s = s.length > 0 && s[s.length - 1]) && (l[0] === 6 || l[0] === 2)) { - r = 0; - continue; - } - if (l[0] === 3 && (!s || l[1] > s[0] && l[1] < s[3])) { - r.label = l[1]; - break; - } - if (l[0] === 6 && r.label < s[1]) { - r.label = s[1], s = l; - break; - } - if (s && r.label < s[2]) { - r.label = s[2], r.ops.push(l); - break; - } - s[2] && r.ops.pop(), r.trys.pop(); - continue; - } - l = e.call(t, r); - } catch (d) { - l = [6, d], i = 0; - } finally { - n = s = 0; - } - if (l[0] & 5) throw l[1]; - return { value: l[0] ? l[1] : void 0, done: !0 }; - } -} -function ek(t, e, r, n) { - n === void 0 && (n = r), t[n] = e[r]; -} -function tk(t, e) { - for (var r in t) r !== "default" && !e.hasOwnProperty(r) && (e[r] = t[r]); -} -function P1(t) { - var e = typeof Symbol == "function" && Symbol.iterator, r = e && t[e], n = 0; - if (r) return r.call(t); - if (t && typeof t.length == "number") return { - next: function() { - return t && n >= t.length && (t = void 0), { value: t && t[n++], done: !t }; - } - }; - throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined."); -} -function K4(t, e) { - var r = typeof Symbol == "function" && t[Symbol.iterator]; - if (!r) return t; - var n = r.call(t), i, s = [], o; - try { - for (; (e === void 0 || e-- > 0) && !(i = n.next()).done; ) s.push(i.value); - } catch (a) { - o = { error: a }; - } finally { - try { - i && !i.done && (r = n.return) && r.call(n); - } finally { - if (o) throw o.error; - } - } - return s; -} -function rk() { - for (var t = [], e = 0; e < arguments.length; e++) - t = t.concat(K4(arguments[e])); - return t; -} -function nk() { - for (var t = 0, e = 0, r = arguments.length; e < r; e++) t += arguments[e].length; - for (var n = Array(t), i = 0, e = 0; e < r; e++) - for (var s = arguments[e], o = 0, a = s.length; o < a; o++, i++) - n[i] = s[o]; - return n; -} -function Cl(t) { - return this instanceof Cl ? (this.v = t, this) : new Cl(t); -} -function ik(t, e, r) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var n = r.apply(t, e || []), i, s = []; - return i = {}, o("next"), o("throw"), o("return"), i[Symbol.asyncIterator] = function() { - return this; - }, i; - function o(w) { - n[w] && (i[w] = function(_) { - return new Promise(function(P, O) { - s.push([w, _, P, O]) > 1 || a(w, _); - }); - }); - } - function a(w, _) { - try { - u(n[w](_)); - } catch (P) { - p(s[0][3], P); - } - } - function u(w) { - w.value instanceof Cl ? Promise.resolve(w.value.v).then(l, d) : p(s[0][2], w); - } - function l(w) { - a("next", w); - } - function d(w) { - a("throw", w); - } - function p(w, _) { - w(_), s.shift(), s.length && a(s[0][0], s[0][1]); - } -} -function sk(t) { - var e, r; - return e = {}, n("next"), n("throw", function(i) { - throw i; - }), n("return"), e[Symbol.iterator] = function() { - return this; - }, e; - function n(i, s) { - e[i] = t[i] ? function(o) { - return (r = !r) ? { value: Cl(t[i](o)), done: i === "return" } : s ? s(o) : o; - } : s; - } -} -function ok(t) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var e = t[Symbol.asyncIterator], r; - return e ? e.call(t) : (t = typeof P1 == "function" ? P1(t) : t[Symbol.iterator](), r = {}, n("next"), n("throw"), n("return"), r[Symbol.asyncIterator] = function() { - return this; - }, r); - function n(s) { - r[s] = t[s] && function(o) { - return new Promise(function(a, u) { - o = t[s](o), i(a, u, o.done, o.value); - }); - }; - } - function i(s, o, a, u) { - Promise.resolve(u).then(function(l) { - s({ value: l, done: a }); - }, o); - } -} -function ak(t, e) { - return Object.defineProperty ? Object.defineProperty(t, "raw", { value: e }) : t.raw = e, t; -} -function ck(t) { - if (t && t.__esModule) return t; - var e = {}; - if (t != null) for (var r in t) Object.hasOwnProperty.call(t, r) && (e[r] = t[r]); - return e.default = t, e; -} -function uk(t) { - return t && t.__esModule ? t : { default: t }; -} -function fk(t, e) { - if (!e.has(t)) - throw new TypeError("attempted to get private field on non-instance"); - return e.get(t); -} -function lk(t, e, r) { - if (!e.has(t)) - throw new TypeError("attempted to set private field on non-instance"); - return e.set(t, r), r; -} -const hk = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - get __assign() { - return A1; - }, - __asyncDelegator: sk, - __asyncGenerator: ik, - __asyncValues: ok, - __await: Cl, - __awaiter: ZL, - __classPrivateFieldGet: fk, - __classPrivateFieldSet: lk, - __createBinding: ek, - __decorate: YL, - __exportStar: tk, - __extends: VL, - __generator: QL, - __importDefault: uk, - __importStar: ck, - __makeTemplateObject: ak, - __metadata: XL, - __param: JL, - __read: K4, - __rest: GL, - __spread: rk, - __spreadArrays: nk, - __values: P1 -}, Symbol.toStringTag, { value: "Module" })), Yl = /* @__PURE__ */ Lv(hk); -var im = {}, If = {}, Z2; -function dk() { - if (Z2) return If; - Z2 = 1, Object.defineProperty(If, "__esModule", { value: !0 }), If.delay = void 0; - function t(e) { - return new Promise((r) => { - setTimeout(() => { - r(!0); - }, e); - }); - } - return If.delay = t, If; -} -var Ga = {}, sm = {}, Ya = {}, Q2; -function pk() { - return Q2 || (Q2 = 1, Object.defineProperty(Ya, "__esModule", { value: !0 }), Ya.ONE_THOUSAND = Ya.ONE_HUNDRED = void 0, Ya.ONE_HUNDRED = 100, Ya.ONE_THOUSAND = 1e3), Ya; -} -var om = {}, ex; -function gk() { - return ex || (ex = 1, function(t) { - Object.defineProperty(t, "__esModule", { value: !0 }), t.ONE_YEAR = t.FOUR_WEEKS = t.THREE_WEEKS = t.TWO_WEEKS = t.ONE_WEEK = t.THIRTY_DAYS = t.SEVEN_DAYS = t.FIVE_DAYS = t.THREE_DAYS = t.ONE_DAY = t.TWENTY_FOUR_HOURS = t.TWELVE_HOURS = t.SIX_HOURS = t.THREE_HOURS = t.ONE_HOUR = t.SIXTY_MINUTES = t.THIRTY_MINUTES = t.TEN_MINUTES = t.FIVE_MINUTES = t.ONE_MINUTE = t.SIXTY_SECONDS = t.THIRTY_SECONDS = t.TEN_SECONDS = t.FIVE_SECONDS = t.ONE_SECOND = void 0, t.ONE_SECOND = 1, t.FIVE_SECONDS = 5, t.TEN_SECONDS = 10, t.THIRTY_SECONDS = 30, t.SIXTY_SECONDS = 60, t.ONE_MINUTE = t.SIXTY_SECONDS, t.FIVE_MINUTES = t.ONE_MINUTE * 5, t.TEN_MINUTES = t.ONE_MINUTE * 10, t.THIRTY_MINUTES = t.ONE_MINUTE * 30, t.SIXTY_MINUTES = t.ONE_MINUTE * 60, t.ONE_HOUR = t.SIXTY_MINUTES, t.THREE_HOURS = t.ONE_HOUR * 3, t.SIX_HOURS = t.ONE_HOUR * 6, t.TWELVE_HOURS = t.ONE_HOUR * 12, t.TWENTY_FOUR_HOURS = t.ONE_HOUR * 24, t.ONE_DAY = t.TWENTY_FOUR_HOURS, t.THREE_DAYS = t.ONE_DAY * 3, t.FIVE_DAYS = t.ONE_DAY * 5, t.SEVEN_DAYS = t.ONE_DAY * 7, t.THIRTY_DAYS = t.ONE_DAY * 30, t.ONE_WEEK = t.SEVEN_DAYS, t.TWO_WEEKS = t.ONE_WEEK * 2, t.THREE_WEEKS = t.ONE_WEEK * 3, t.FOUR_WEEKS = t.ONE_WEEK * 4, t.ONE_YEAR = t.ONE_DAY * 365; - }(om)), om; -} -var tx; -function V4() { - return tx || (tx = 1, function(t) { - Object.defineProperty(t, "__esModule", { value: !0 }); - const e = Yl; - e.__exportStar(pk(), t), e.__exportStar(gk(), t); - }(sm)), sm; -} -var rx; -function mk() { - if (rx) return Ga; - rx = 1, Object.defineProperty(Ga, "__esModule", { value: !0 }), Ga.fromMiliseconds = Ga.toMiliseconds = void 0; - const t = V4(); - function e(n) { - return n * t.ONE_THOUSAND; - } - Ga.toMiliseconds = e; - function r(n) { - return Math.floor(n / t.ONE_THOUSAND); - } - return Ga.fromMiliseconds = r, Ga; -} -var nx; -function vk() { - return nx || (nx = 1, function(t) { - Object.defineProperty(t, "__esModule", { value: !0 }); - const e = Yl; - e.__exportStar(dk(), t), e.__exportStar(mk(), t); - }(im)), im; -} -var Qc = {}, ix; -function bk() { - if (ix) return Qc; - ix = 1, Object.defineProperty(Qc, "__esModule", { value: !0 }), Qc.Watch = void 0; - class t { - constructor() { - this.timestamps = /* @__PURE__ */ new Map(); - } - start(r) { - if (this.timestamps.has(r)) - throw new Error(`Watch already started for label: ${r}`); - this.timestamps.set(r, { started: Date.now() }); - } - stop(r) { - const n = this.get(r); - if (typeof n.elapsed < "u") - throw new Error(`Watch already stopped for label: ${r}`); - const i = Date.now() - n.started; - this.timestamps.set(r, { started: n.started, elapsed: i }); - } - get(r) { - const n = this.timestamps.get(r); - if (typeof n > "u") - throw new Error(`No timestamp found for label: ${r}`); - return n; - } - elapsed(r) { - const n = this.get(r); - return n.elapsed || Date.now() - n.started; - } - } - return Qc.Watch = t, Qc.default = t, Qc; -} -var am = {}, Cf = {}, sx; -function yk() { - if (sx) return Cf; - sx = 1, Object.defineProperty(Cf, "__esModule", { value: !0 }), Cf.IWatch = void 0; - class t { - } - return Cf.IWatch = t, Cf; -} -var ox; -function wk() { - return ox || (ox = 1, function(t) { - Object.defineProperty(t, "__esModule", { value: !0 }), Yl.__exportStar(yk(), t); - }(am)), am; -} -(function(t) { - Object.defineProperty(t, "__esModule", { value: !0 }); - const e = Yl; - e.__exportStar(vk(), t), e.__exportStar(bk(), t), e.__exportStar(wk(), t), e.__exportStar(V4(), t); -})(vt); -class Mc { -} -let xk = class extends Mc { - constructor(e) { - super(); - } -}; -const ax = vt.FIVE_SECONDS, Uu = { pulse: "heartbeat_pulse" }; -let _k = class G4 extends xk { - constructor(e) { - super(e), this.events = new is.EventEmitter(), this.interval = ax, this.interval = (e == null ? void 0 : e.interval) || ax; - } - static async init(e) { - const r = new G4(e); - return await r.init(), r; - } - async init() { - await this.initialize(); - } - stop() { - clearInterval(this.intervalRef); - } - on(e, r) { - this.events.on(e, r); - } - once(e, r) { - this.events.once(e, r); - } - off(e, r) { - this.events.off(e, r); - } - removeListener(e, r) { - this.events.removeListener(e, r); - } - async initialize() { - this.intervalRef = setInterval(() => this.pulse(), vt.toMiliseconds(this.interval)); - } - pulse() { - this.events.emit(Uu.pulse); - } -}; -const Ek = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/, Sk = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/, Ak = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/; -function Pk(t, e) { - if (t === "__proto__" || t === "constructor" && e && typeof e == "object" && "prototype" in e) { - Mk(t); - return; - } - return e; -} -function Mk(t) { - console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`); -} -function vd(t, e = {}) { - if (typeof t != "string") - return t; - const r = t.trim(); - if ( - // eslint-disable-next-line unicorn/prefer-at - t[0] === '"' && t.endsWith('"') && !t.includes("\\") - ) - return r.slice(1, -1); - if (r.length <= 9) { - const n = r.toLowerCase(); - if (n === "true") - return !0; - if (n === "false") - return !1; - if (n === "undefined") - return; - if (n === "null") - return null; - if (n === "nan") - return Number.NaN; - if (n === "infinity") - return Number.POSITIVE_INFINITY; - if (n === "-infinity") - return Number.NEGATIVE_INFINITY; - } - if (!Ak.test(t)) { - if (e.strict) - throw new SyntaxError("[destr] Invalid JSON"); - return t; - } - try { - if (Ek.test(t) || Sk.test(t)) { - if (e.strict) - throw new Error("[destr] Possible prototype pollution"); - return JSON.parse(t, Pk); - } - return JSON.parse(t); - } catch (n) { - if (e.strict) - throw n; - return t; - } -} -function Ik(t) { - return !t || typeof t.then != "function" ? Promise.resolve(t) : t; -} -function Cn(t, ...e) { - try { - return Ik(t(...e)); - } catch (r) { - return Promise.reject(r); - } -} -function Ck(t) { - const e = typeof t; - return t === null || e !== "object" && e !== "function"; -} -function Tk(t) { - const e = Object.getPrototypeOf(t); - return !e || e.isPrototypeOf(Object); -} -function Nd(t) { - if (Ck(t)) - return String(t); - if (Tk(t) || Array.isArray(t)) - return JSON.stringify(t); - if (typeof t.toJSON == "function") - return Nd(t.toJSON()); - throw new Error("[unstorage] Cannot stringify value!"); -} -function Y4() { - if (typeof Buffer > "u") - throw new TypeError("[unstorage] Buffer is not supported!"); -} -const M1 = "base64:"; -function Rk(t) { - if (typeof t == "string") - return t; - Y4(); - const e = Buffer.from(t).toString("base64"); - return M1 + e; -} -function Dk(t) { - return typeof t != "string" || !t.startsWith(M1) ? t : (Y4(), Buffer.from(t.slice(M1.length), "base64")); -} -function gi(t) { - return t ? t.split("?")[0].replace(/[/\\]/g, ":").replace(/:+/g, ":").replace(/^:|:$/g, "") : ""; -} -function Ok(...t) { - return gi(t.join(":")); -} -function bd(t) { - return t = gi(t), t ? t + ":" : ""; -} -const Nk = "memory", Lk = () => { - const t = /* @__PURE__ */ new Map(); - return { - name: Nk, - getInstance: () => t, - hasItem(e) { - return t.has(e); - }, - getItem(e) { - return t.get(e) ?? null; - }, - getItemRaw(e) { - return t.get(e) ?? null; - }, - setItem(e, r) { - t.set(e, r); - }, - setItemRaw(e, r) { - t.set(e, r); - }, - removeItem(e) { - t.delete(e); - }, - getKeys() { - return [...t.keys()]; - }, - clear() { - t.clear(); - }, - dispose() { - t.clear(); - } - }; -}; -function kk(t = {}) { - const e = { - mounts: { "": t.driver || Lk() }, - mountpoints: [""], - watching: !1, - watchListeners: [], - unwatch: {} - }, r = (l) => { - for (const d of e.mountpoints) - if (l.startsWith(d)) - return { - base: d, - relativeKey: l.slice(d.length), - driver: e.mounts[d] - }; - return { - base: "", - relativeKey: l, - driver: e.mounts[""] - }; - }, n = (l, d) => e.mountpoints.filter( - (p) => p.startsWith(l) || d && l.startsWith(p) - ).map((p) => ({ - relativeBase: l.length > p.length ? l.slice(p.length) : void 0, - mountpoint: p, - driver: e.mounts[p] - })), i = (l, d) => { - if (e.watching) { - d = gi(d); - for (const p of e.watchListeners) - p(l, d); - } - }, s = async () => { - if (!e.watching) { - e.watching = !0; - for (const l in e.mounts) - e.unwatch[l] = await cx( - e.mounts[l], - i, - l - ); - } - }, o = async () => { - if (e.watching) { - for (const l in e.unwatch) - await e.unwatch[l](); - e.unwatch = {}, e.watching = !1; - } - }, a = (l, d, p) => { - const w = /* @__PURE__ */ new Map(), _ = (P) => { - let O = w.get(P.base); - return O || (O = { - driver: P.driver, - base: P.base, - items: [] - }, w.set(P.base, O)), O; - }; - for (const P of l) { - const O = typeof P == "string", L = gi(O ? P : P.key), B = O ? void 0 : P.value, k = O || !P.options ? d : { ...d, ...P.options }, W = r(L); - _(W).items.push({ - key: L, - value: B, - relativeKey: W.relativeKey, - options: k - }); - } - return Promise.all([...w.values()].map((P) => p(P))).then( - (P) => P.flat() - ); - }, u = { - // Item - hasItem(l, d = {}) { - l = gi(l); - const { relativeKey: p, driver: w } = r(l); - return Cn(w.hasItem, p, d); - }, - getItem(l, d = {}) { - l = gi(l); - const { relativeKey: p, driver: w } = r(l); - return Cn(w.getItem, p, d).then( - (_) => vd(_) - ); - }, - getItems(l, d) { - return a(l, d, (p) => p.driver.getItems ? Cn( - p.driver.getItems, - p.items.map((w) => ({ - key: w.relativeKey, - options: w.options - })), - d - ).then( - (w) => w.map((_) => ({ - key: Ok(p.base, _.key), - value: vd(_.value) - })) - ) : Promise.all( - p.items.map((w) => Cn( - p.driver.getItem, - w.relativeKey, - w.options - ).then((_) => ({ - key: w.key, - value: vd(_) - }))) - )); - }, - getItemRaw(l, d = {}) { - l = gi(l); - const { relativeKey: p, driver: w } = r(l); - return w.getItemRaw ? Cn(w.getItemRaw, p, d) : Cn(w.getItem, p, d).then( - (_) => Dk(_) - ); - }, - async setItem(l, d, p = {}) { - if (d === void 0) - return u.removeItem(l); - l = gi(l); - const { relativeKey: w, driver: _ } = r(l); - _.setItem && (await Cn(_.setItem, w, Nd(d), p), _.watch || i("update", l)); - }, - async setItems(l, d) { - await a(l, d, async (p) => { - if (p.driver.setItems) - return Cn( - p.driver.setItems, - p.items.map((w) => ({ - key: w.relativeKey, - value: Nd(w.value), - options: w.options - })), - d - ); - p.driver.setItem && await Promise.all( - p.items.map((w) => Cn( - p.driver.setItem, - w.relativeKey, - Nd(w.value), - w.options - )) - ); - }); - }, - async setItemRaw(l, d, p = {}) { - if (d === void 0) - return u.removeItem(l, p); - l = gi(l); - const { relativeKey: w, driver: _ } = r(l); - if (_.setItemRaw) - await Cn(_.setItemRaw, w, d, p); - else if (_.setItem) - await Cn(_.setItem, w, Rk(d), p); - else - return; - _.watch || i("update", l); - }, - async removeItem(l, d = {}) { - typeof d == "boolean" && (d = { removeMeta: d }), l = gi(l); - const { relativeKey: p, driver: w } = r(l); - w.removeItem && (await Cn(w.removeItem, p, d), (d.removeMeta || d.removeMata) && await Cn(w.removeItem, p + "$", d), w.watch || i("remove", l)); - }, - // Meta - async getMeta(l, d = {}) { - typeof d == "boolean" && (d = { nativeOnly: d }), l = gi(l); - const { relativeKey: p, driver: w } = r(l), _ = /* @__PURE__ */ Object.create(null); - if (w.getMeta && Object.assign(_, await Cn(w.getMeta, p, d)), !d.nativeOnly) { - const P = await Cn( - w.getItem, - p + "$", - d - ).then((O) => vd(O)); - P && typeof P == "object" && (typeof P.atime == "string" && (P.atime = new Date(P.atime)), typeof P.mtime == "string" && (P.mtime = new Date(P.mtime)), Object.assign(_, P)); - } - return _; - }, - setMeta(l, d, p = {}) { - return this.setItem(l + "$", d, p); - }, - removeMeta(l, d = {}) { - return this.removeItem(l + "$", d); - }, - // Keys - async getKeys(l, d = {}) { - l = bd(l); - const p = n(l, !0); - let w = []; - const _ = []; - for (const P of p) { - const O = await Cn( - P.driver.getKeys, - P.relativeBase, - d - ); - for (const L of O) { - const B = P.mountpoint + gi(L); - w.some((k) => B.startsWith(k)) || _.push(B); - } - w = [ - P.mountpoint, - ...w.filter((L) => !L.startsWith(P.mountpoint)) - ]; - } - return l ? _.filter( - (P) => P.startsWith(l) && P[P.length - 1] !== "$" - ) : _.filter((P) => P[P.length - 1] !== "$"); - }, - // Utils - async clear(l, d = {}) { - l = bd(l), await Promise.all( - n(l, !1).map(async (p) => { - if (p.driver.clear) - return Cn(p.driver.clear, p.relativeBase, d); - if (p.driver.removeItem) { - const w = await p.driver.getKeys(p.relativeBase || "", d); - return Promise.all( - w.map((_) => p.driver.removeItem(_, d)) - ); - } - }) - ); - }, - async dispose() { - await Promise.all( - Object.values(e.mounts).map((l) => ux(l)) - ); - }, - async watch(l) { - return await s(), e.watchListeners.push(l), async () => { - e.watchListeners = e.watchListeners.filter( - (d) => d !== l - ), e.watchListeners.length === 0 && await o(); - }; - }, - async unwatch() { - e.watchListeners = [], await o(); - }, - // Mount - mount(l, d) { - if (l = bd(l), l && e.mounts[l]) - throw new Error(`already mounted at ${l}`); - return l && (e.mountpoints.push(l), e.mountpoints.sort((p, w) => w.length - p.length)), e.mounts[l] = d, e.watching && Promise.resolve(cx(d, i, l)).then((p) => { - e.unwatch[l] = p; - }).catch(console.error), u; - }, - async unmount(l, d = !0) { - l = bd(l), !(!l || !e.mounts[l]) && (e.watching && l in e.unwatch && (e.unwatch[l](), delete e.unwatch[l]), d && await ux(e.mounts[l]), e.mountpoints = e.mountpoints.filter((p) => p !== l), delete e.mounts[l]); - }, - getMount(l = "") { - l = gi(l) + ":"; - const d = r(l); - return { - driver: d.driver, - base: d.base - }; - }, - getMounts(l = "", d = {}) { - return l = gi(l), n(l, d.parents).map((w) => ({ - driver: w.driver, - base: w.mountpoint - })); - }, - // Aliases - keys: (l, d = {}) => u.getKeys(l, d), - get: (l, d = {}) => u.getItem(l, d), - set: (l, d, p = {}) => u.setItem(l, d, p), - has: (l, d = {}) => u.hasItem(l, d), - del: (l, d = {}) => u.removeItem(l, d), - remove: (l, d = {}) => u.removeItem(l, d) - }; - return u; -} -function cx(t, e, r) { - return t.watch ? t.watch((n, i) => e(n, r + i)) : () => { - }; -} -async function ux(t) { - typeof t.dispose == "function" && await Cn(t.dispose); -} -function Ic(t) { - return new Promise((e, r) => { - t.oncomplete = t.onsuccess = () => e(t.result), t.onabort = t.onerror = () => r(t.error); - }); -} -function J4(t, e) { - const r = indexedDB.open(t); - r.onupgradeneeded = () => r.result.createObjectStore(e); - const n = Ic(r); - return (i, s) => n.then((o) => s(o.transaction(e, i).objectStore(e))); -} -let cm; -function Jl() { - return cm || (cm = J4("keyval-store", "keyval")), cm; -} -function fx(t, e = Jl()) { - return e("readonly", (r) => Ic(r.get(t))); -} -function $k(t, e, r = Jl()) { - return r("readwrite", (n) => (n.put(e, t), Ic(n.transaction))); -} -function Bk(t, e = Jl()) { - return e("readwrite", (r) => (r.delete(t), Ic(r.transaction))); -} -function Fk(t = Jl()) { - return t("readwrite", (e) => (e.clear(), Ic(e.transaction))); -} -function jk(t, e) { - return t.openCursor().onsuccess = function() { - this.result && (e(this.result), this.result.continue()); - }, Ic(t.transaction); -} -function Uk(t = Jl()) { - return t("readonly", (e) => { - if (e.getAllKeys) - return Ic(e.getAllKeys()); - const r = []; - return jk(e, (n) => r.push(n.key)).then(() => r); - }); -} -const qk = (t) => JSON.stringify(t, (e, r) => typeof r == "bigint" ? r.toString() + "n" : r), zk = (t) => { - const e = /([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g, r = t.replace(e, '$1"$2n"$3'); - return JSON.parse(r, (n, i) => typeof i == "string" && i.match(/^\d+n$/) ? BigInt(i.substring(0, i.length - 1)) : i); -}; -function bc(t) { - if (typeof t != "string") - throw new Error(`Cannot safe json parse value of type ${typeof t}`); - try { - return zk(t); - } catch { - return t; - } -} -function jo(t) { - return typeof t == "string" ? t : qk(t) || ""; -} -const Wk = "idb-keyval"; -var Hk = (t = {}) => { - const e = t.base && t.base.length > 0 ? `${t.base}:` : "", r = (i) => e + i; - let n; - return t.dbName && t.storeName && (n = J4(t.dbName, t.storeName)), { name: Wk, options: t, async hasItem(i) { - return !(typeof await fx(r(i), n) > "u"); - }, async getItem(i) { - return await fx(r(i), n) ?? null; - }, setItem(i, s) { - return $k(r(i), s, n); - }, removeItem(i) { - return Bk(r(i), n); - }, getKeys() { - return Uk(n); - }, clear() { - return Fk(n); - } }; -}; -const Kk = "WALLET_CONNECT_V2_INDEXED_DB", Vk = "keyvaluestorage"; -let Gk = class { - constructor() { - this.indexedDb = kk({ driver: Hk({ dbName: Kk, storeName: Vk }) }); - } - async getKeys() { - return this.indexedDb.getKeys(); - } - async getEntries() { - return (await this.indexedDb.getItems(await this.indexedDb.getKeys())).map((e) => [e.key, e.value]); - } - async getItem(e) { - const r = await this.indexedDb.getItem(e); - if (r !== null) return r; - } - async setItem(e, r) { - await this.indexedDb.setItem(e, jo(r)); - } - async removeItem(e) { - await this.indexedDb.removeItem(e); - } -}; -var um = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Ld = { exports: {} }; -(function() { - let t; - function e() { - } - t = e, t.prototype.getItem = function(r) { - return this.hasOwnProperty(r) ? String(this[r]) : null; - }, t.prototype.setItem = function(r, n) { - this[r] = String(n); - }, t.prototype.removeItem = function(r) { - delete this[r]; - }, t.prototype.clear = function() { - const r = this; - Object.keys(r).forEach(function(n) { - r[n] = void 0, delete r[n]; - }); - }, t.prototype.key = function(r) { - return r = r || 0, Object.keys(this)[r]; - }, t.prototype.__defineGetter__("length", function() { - return Object.keys(this).length; - }), typeof um < "u" && um.localStorage ? Ld.exports = um.localStorage : typeof window < "u" && window.localStorage ? Ld.exports = window.localStorage : Ld.exports = new e(); -})(); -function Yk(t) { - var e; - return [t[0], bc((e = t[1]) != null ? e : "")]; -} -let Jk = class { - constructor() { - this.localStorage = Ld.exports; - } - async getKeys() { - return Object.keys(this.localStorage); - } - async getEntries() { - return Object.entries(this.localStorage).map(Yk); - } - async getItem(e) { - const r = this.localStorage.getItem(e); - if (r !== null) return bc(r); - } - async setItem(e, r) { - this.localStorage.setItem(e, jo(r)); - } - async removeItem(e) { - this.localStorage.removeItem(e); - } -}; -const Xk = "wc_storage_version", lx = 1, Zk = async (t, e, r) => { - const n = Xk, i = await e.getItem(n); - if (i && i >= lx) { - r(e); - return; - } - const s = await t.getKeys(); - if (!s.length) { - r(e); - return; - } - const o = []; - for (; s.length; ) { - const a = s.shift(); - if (!a) continue; - const u = a.toLowerCase(); - if (u.includes("wc@") || u.includes("walletconnect") || u.includes("wc_") || u.includes("wallet_connect")) { - const l = await t.getItem(a); - await e.setItem(a, l), o.push(a); - } - } - await e.setItem(n, lx), r(e), Qk(t, o); -}, Qk = async (t, e) => { - e.length && e.forEach(async (r) => { - await t.removeItem(r); - }); -}; -let e$ = class { - constructor() { - this.initialized = !1, this.setInitialized = (r) => { - this.storage = r, this.initialized = !0; - }; - const e = new Jk(); - this.storage = e; - try { - const r = new Gk(); - Zk(e, r, this.setInitialized); - } catch { - this.initialized = !0; - } - } - async getKeys() { - return await this.initialize(), this.storage.getKeys(); - } - async getEntries() { - return await this.initialize(), this.storage.getEntries(); - } - async getItem(e) { - return await this.initialize(), this.storage.getItem(e); - } - async setItem(e, r) { - return await this.initialize(), this.storage.setItem(e, r); - } - async removeItem(e) { - return await this.initialize(), this.storage.removeItem(e); - } - async initialize() { - this.initialized || await new Promise((e) => { - const r = setInterval(() => { - this.initialized && (clearInterval(r), e()); - }, 20); - }); - } -}; -function t$(t) { - try { - return JSON.stringify(t); - } catch { - return '"[Circular]"'; - } -} -var r$ = n$; -function n$(t, e, r) { - var n = r && r.stringify || t$, i = 1; - if (typeof t == "object" && t !== null) { - var s = e.length + i; - if (s === 1) return t; - var o = new Array(s); - o[0] = n(t); - for (var a = 1; a < s; a++) - o[a] = n(e[a]); - return o.join(" "); - } - if (typeof t != "string") - return t; - var u = e.length; - if (u === 0) return t; - for (var l = "", d = 1 - i, p = -1, w = t && t.length || 0, _ = 0; _ < w; ) { - if (t.charCodeAt(_) === 37 && _ + 1 < w) { - switch (p = p > -1 ? p : 0, t.charCodeAt(_ + 1)) { - case 100: - case 102: - if (d >= u || e[d] == null) break; - p < _ && (l += t.slice(p, _)), l += Number(e[d]), p = _ + 2, _++; - break; - case 105: - if (d >= u || e[d] == null) break; - p < _ && (l += t.slice(p, _)), l += Math.floor(Number(e[d])), p = _ + 2, _++; - break; - case 79: - case 111: - case 106: - if (d >= u || e[d] === void 0) break; - p < _ && (l += t.slice(p, _)); - var P = typeof e[d]; - if (P === "string") { - l += "'" + e[d] + "'", p = _ + 2, _++; - break; - } - if (P === "function") { - l += e[d].name || "", p = _ + 2, _++; - break; - } - l += n(e[d]), p = _ + 2, _++; - break; - case 115: - if (d >= u) - break; - p < _ && (l += t.slice(p, _)), l += String(e[d]), p = _ + 2, _++; - break; - case 37: - p < _ && (l += t.slice(p, _)), l += "%", p = _ + 2, _++, d--; - break; - } - ++d; - } - ++_; - } - return p === -1 ? t : (p < w && (l += t.slice(p)), l); -} -const hx = r$; -var ou = Uo; -const Tl = d$().console || {}, i$ = { - mapHttpRequest: yd, - mapHttpResponse: yd, - wrapRequestSerializer: fm, - wrapResponseSerializer: fm, - wrapErrorSerializer: fm, - req: yd, - res: yd, - err: u$ -}; -function s$(t, e) { - return Array.isArray(t) ? t.filter(function(n) { - return n !== "!stdSerializers.err"; - }) : t === !0 ? Object.keys(e) : !1; -} -function Uo(t) { - t = t || {}, t.browser = t.browser || {}; - const e = t.browser.transmit; - if (e && typeof e.send != "function") - throw Error("pino: transmit option must have a send function"); - const r = t.browser.write || Tl; - t.browser.write && (t.browser.asObject = !0); - const n = t.serializers || {}, i = s$(t.browser.serialize, n); - let s = t.browser.serialize; - Array.isArray(t.browser.serialize) && t.browser.serialize.indexOf("!stdSerializers.err") > -1 && (s = !1); - const o = ["error", "fatal", "warn", "info", "debug", "trace"]; - typeof r == "function" && (r.error = r.fatal = r.warn = r.info = r.debug = r.trace = r), t.enabled === !1 && (t.level = "silent"); - const a = t.level || "info", u = Object.create(r); - u.log || (u.log = Rl), Object.defineProperty(u, "levelVal", { - get: d - }), Object.defineProperty(u, "level", { - get: p, - set: w - }); - const l = { - transmit: e, - serialize: i, - asObject: t.browser.asObject, - levels: o, - timestamp: f$(t) - }; - u.levels = Uo.levels, u.level = a, u.setMaxListeners = u.getMaxListeners = u.emit = u.addListener = u.on = u.prependListener = u.once = u.prependOnceListener = u.removeListener = u.removeAllListeners = u.listeners = u.listenerCount = u.eventNames = u.write = u.flush = Rl, u.serializers = n, u._serialize = i, u._stdErrSerialize = s, u.child = _, e && (u._logEvent = I1()); - function d() { - return this.level === "silent" ? 1 / 0 : this.levels.values[this.level]; - } - function p() { - return this._level; - } - function w(P) { - if (P !== "silent" && !this.levels.values[P]) - throw Error("unknown level " + P); - this._level = P, eu(l, u, "error", "log"), eu(l, u, "fatal", "error"), eu(l, u, "warn", "error"), eu(l, u, "info", "log"), eu(l, u, "debug", "log"), eu(l, u, "trace", "log"); - } - function _(P, O) { - if (!P) - throw new Error("missing bindings for child Pino"); - O = O || {}, i && P.serializers && (O.serializers = P.serializers); - const L = O.serializers; - if (i && L) { - var B = Object.assign({}, n, L), k = t.browser.serialize === !0 ? Object.keys(B) : i; - delete P.serializers, J0([P], k, B, this._stdErrSerialize); - } - function W(U) { - this._childLevel = (U._childLevel | 0) + 1, this.error = tu(U, P, "error"), this.fatal = tu(U, P, "fatal"), this.warn = tu(U, P, "warn"), this.info = tu(U, P, "info"), this.debug = tu(U, P, "debug"), this.trace = tu(U, P, "trace"), B && (this.serializers = B, this._serialize = k), e && (this._logEvent = I1( - [].concat(U._logEvent.bindings, P) - )); - } - return W.prototype = this, new W(this); - } - return u; -} -Uo.levels = { - values: { - fatal: 60, - error: 50, - warn: 40, - info: 30, - debug: 20, - trace: 10 - }, - labels: { - 10: "trace", - 20: "debug", - 30: "info", - 40: "warn", - 50: "error", - 60: "fatal" - } -}; -Uo.stdSerializers = i$; -Uo.stdTimeFunctions = Object.assign({}, { nullTime: X4, epochTime: Z4, unixTime: l$, isoTime: h$ }); -function eu(t, e, r, n) { - const i = Object.getPrototypeOf(e); - e[r] = e.levelVal > e.levels.values[r] ? Rl : i[r] ? i[r] : Tl[r] || Tl[n] || Rl, o$(t, e, r); -} -function o$(t, e, r) { - !t.transmit && e[r] === Rl || (e[r] = /* @__PURE__ */ function(n) { - return function() { - const s = t.timestamp(), o = new Array(arguments.length), a = Object.getPrototypeOf && Object.getPrototypeOf(this) === Tl ? Tl : this; - for (var u = 0; u < o.length; u++) o[u] = arguments[u]; - if (t.serialize && !t.asObject && J0(o, this._serialize, this.serializers, this._stdErrSerialize), t.asObject ? n.call(a, a$(this, r, o, s)) : n.apply(a, o), t.transmit) { - const l = t.transmit.level || e.level, d = Uo.levels.values[l], p = Uo.levels.values[r]; - if (p < d) return; - c$(this, { - ts: s, - methodLevel: r, - methodValue: p, - send: t.transmit.send, - val: e.levelVal - }, o); - } - }; - }(e[r])); -} -function a$(t, e, r, n) { - t._serialize && J0(r, t._serialize, t.serializers, t._stdErrSerialize); - const i = r.slice(); - let s = i[0]; - const o = {}; - n && (o.time = n), o.level = Uo.levels.values[e]; - let a = (t._childLevel | 0) + 1; - if (a < 1 && (a = 1), s !== null && typeof s == "object") { - for (; a-- && typeof i[0] == "object"; ) - Object.assign(o, i.shift()); - s = i.length ? hx(i.shift(), i) : void 0; - } else typeof s == "string" && (s = hx(i.shift(), i)); - return s !== void 0 && (o.msg = s), o; -} -function J0(t, e, r, n) { - for (const i in t) - if (n && t[i] instanceof Error) - t[i] = Uo.stdSerializers.err(t[i]); - else if (typeof t[i] == "object" && !Array.isArray(t[i])) - for (const s in t[i]) - e && e.indexOf(s) > -1 && s in r && (t[i][s] = r[s](t[i][s])); -} -function tu(t, e, r) { - return function() { - const n = new Array(1 + arguments.length); - n[0] = e; - for (var i = 1; i < n.length; i++) - n[i] = arguments[i - 1]; - return t[r].apply(this, n); - }; -} -function c$(t, e, r) { - const n = e.send, i = e.ts, s = e.methodLevel, o = e.methodValue, a = e.val, u = t._logEvent.bindings; - J0( - r, - t._serialize || Object.keys(t.serializers), - t.serializers, - t._stdErrSerialize === void 0 ? !0 : t._stdErrSerialize - ), t._logEvent.ts = i, t._logEvent.messages = r.filter(function(l) { - return u.indexOf(l) === -1; - }), t._logEvent.level.label = s, t._logEvent.level.value = o, n(s, t._logEvent, a), t._logEvent = I1(u); -} -function I1(t) { - return { - ts: 0, - messages: [], - bindings: t || [], - level: { label: "", value: 0 } - }; -} -function u$(t) { - const e = { - type: t.constructor.name, - msg: t.message, - stack: t.stack - }; - for (const r in t) - e[r] === void 0 && (e[r] = t[r]); - return e; -} -function f$(t) { - return typeof t.timestamp == "function" ? t.timestamp : t.timestamp === !1 ? X4 : Z4; -} -function yd() { - return {}; -} -function fm(t) { - return t; -} -function Rl() { -} -function X4() { - return !1; -} -function Z4() { - return Date.now(); -} -function l$() { - return Math.round(Date.now() / 1e3); -} -function h$() { - return new Date(Date.now()).toISOString(); -} -function d$() { - function t(e) { - return typeof e < "u" && e; - } - try { - return typeof globalThis < "u" || Object.defineProperty(Object.prototype, "globalThis", { - get: function() { - return delete Object.prototype.globalThis, this.globalThis = this; - }, - configurable: !0 - }), globalThis; - } catch { - return t(self) || t(window) || t(this) || {}; - } -} -const Xl = /* @__PURE__ */ ns(ou), p$ = { level: "info" }, Zl = "custom_context", Zv = 1e3 * 1024; -let g$ = class { - constructor(e) { - this.nodeValue = e, this.sizeInBytes = new TextEncoder().encode(this.nodeValue).length, this.next = null; - } - get value() { - return this.nodeValue; - } - get size() { - return this.sizeInBytes; - } -}, dx = class { - constructor(e) { - this.head = null, this.tail = null, this.lengthInNodes = 0, this.maxSizeInBytes = e, this.sizeInBytes = 0; - } - append(e) { - const r = new g$(e); - if (r.size > this.maxSizeInBytes) throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`); - for (; this.size + r.size > this.maxSizeInBytes; ) this.shift(); - this.head ? (this.tail && (this.tail.next = r), this.tail = r) : (this.head = r, this.tail = r), this.lengthInNodes++, this.sizeInBytes += r.size; - } - shift() { - if (!this.head) return; - const e = this.head; - this.head = this.head.next, this.head || (this.tail = null), this.lengthInNodes--, this.sizeInBytes -= e.size; - } - toArray() { - const e = []; - let r = this.head; - for (; r !== null; ) e.push(r.value), r = r.next; - return e; - } - get length() { - return this.lengthInNodes; - } - get size() { - return this.sizeInBytes; - } - toOrderedArray() { - return Array.from(this); - } - [Symbol.iterator]() { - let e = this.head; - return { next: () => { - if (!e) return { done: !0, value: null }; - const r = e.value; - return e = e.next, { done: !1, value: r }; - } }; - } -}, Q4 = class { - constructor(e, r = Zv) { - this.level = e ?? "error", this.levelValue = ou.levels.values[this.level], this.MAX_LOG_SIZE_IN_BYTES = r, this.logs = new dx(this.MAX_LOG_SIZE_IN_BYTES); - } - forwardToConsole(e, r) { - r === ou.levels.values.error ? console.error(e) : r === ou.levels.values.warn ? console.warn(e) : r === ou.levels.values.debug ? console.debug(e) : r === ou.levels.values.trace ? console.trace(e) : console.log(e); - } - appendToLogs(e) { - this.logs.append(jo({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), log: e })); - const r = typeof e == "string" ? JSON.parse(e).level : e.level; - r >= this.levelValue && this.forwardToConsole(e, r); - } - getLogs() { - return this.logs; - } - clearLogs() { - this.logs = new dx(this.MAX_LOG_SIZE_IN_BYTES); - } - getLogArray() { - return Array.from(this.logs); - } - logsToBlob(e) { - const r = this.getLogArray(); - return r.push(jo({ extraMetadata: e })), new Blob(r, { type: "application/json" }); - } -}, m$ = class { - constructor(e, r = Zv) { - this.baseChunkLogger = new Q4(e, r); - } - write(e) { - this.baseChunkLogger.appendToLogs(e); - } - getLogs() { - return this.baseChunkLogger.getLogs(); - } - clearLogs() { - this.baseChunkLogger.clearLogs(); - } - getLogArray() { - return this.baseChunkLogger.getLogArray(); - } - logsToBlob(e) { - return this.baseChunkLogger.logsToBlob(e); - } - downloadLogsBlobInBrowser(e) { - const r = URL.createObjectURL(this.logsToBlob(e)), n = document.createElement("a"); - n.href = r, n.download = `walletconnect-logs-${(/* @__PURE__ */ new Date()).toISOString()}.txt`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(r); - } -}, v$ = class { - constructor(e, r = Zv) { - this.baseChunkLogger = new Q4(e, r); - } - write(e) { - this.baseChunkLogger.appendToLogs(e); - } - getLogs() { - return this.baseChunkLogger.getLogs(); - } - clearLogs() { - this.baseChunkLogger.clearLogs(); - } - getLogArray() { - return this.baseChunkLogger.getLogArray(); - } - logsToBlob(e) { - return this.baseChunkLogger.logsToBlob(e); - } -}; -var b$ = Object.defineProperty, y$ = Object.defineProperties, w$ = Object.getOwnPropertyDescriptors, px = Object.getOwnPropertySymbols, x$ = Object.prototype.hasOwnProperty, _$ = Object.prototype.propertyIsEnumerable, gx = (t, e, r) => e in t ? b$(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, c0 = (t, e) => { - for (var r in e || (e = {})) x$.call(e, r) && gx(t, r, e[r]); - if (px) for (var r of px(e)) _$.call(e, r) && gx(t, r, e[r]); - return t; -}, u0 = (t, e) => y$(t, w$(e)); -function X0(t) { - return u0(c0({}, t), { level: (t == null ? void 0 : t.level) || p$.level }); -} -function E$(t, e = Zl) { - return t[e] || ""; -} -function S$(t, e, r = Zl) { - return t[r] = e, t; -} -function Pi(t, e = Zl) { - let r = ""; - return typeof t.bindings > "u" ? r = E$(t, e) : r = t.bindings().context || "", r; -} -function A$(t, e, r = Zl) { - const n = Pi(t, r); - return n.trim() ? `${n}/${e}` : e; -} -function ui(t, e, r = Zl) { - const n = A$(t, e, r), i = t.child({ context: n }); - return S$(i, n, r); -} -function P$(t) { - var e, r; - const n = new m$((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); - return { logger: Xl(u0(c0({}, t.opts), { level: "trace", browser: u0(c0({}, (r = t.opts) == null ? void 0 : r.browser), { write: (i) => n.write(i) }) })), chunkLoggerController: n }; -} -function M$(t) { - var e; - const r = new v$((e = t.opts) == null ? void 0 : e.level, t.maxSizeInBytes); - return { logger: Xl(u0(c0({}, t.opts), { level: "trace" }), r), chunkLoggerController: r }; -} -function I$(t) { - return typeof t.loggerOverride < "u" && typeof t.loggerOverride != "string" ? { logger: t.loggerOverride, chunkLoggerController: null } : typeof window < "u" ? P$(t) : M$(t); -} -let C$ = class extends Mc { - constructor(e) { - super(), this.opts = e, this.protocol = "wc", this.version = 2; - } -}, T$ = class extends Mc { - constructor(e, r) { - super(), this.core = e, this.logger = r, this.records = /* @__PURE__ */ new Map(); - } -}, R$ = class { - constructor(e, r) { - this.logger = e, this.core = r; - } -}, D$ = class extends Mc { - constructor(e, r) { - super(), this.relayer = e, this.logger = r; - } -}, O$ = class extends Mc { - constructor(e) { - super(); - } -}, N$ = class { - constructor(e, r, n, i) { - this.core = e, this.logger = r, this.name = n; - } -}, L$ = class extends Mc { - constructor(e, r) { - super(), this.relayer = e, this.logger = r; - } -}, k$ = class extends Mc { - constructor(e, r) { - super(), this.core = e, this.logger = r; - } -}, $$ = class { - constructor(e, r, n) { - this.core = e, this.logger = r, this.store = n; - } -}, B$ = class { - constructor(e, r) { - this.projectId = e, this.logger = r; - } -}, F$ = class { - constructor(e, r, n) { - this.core = e, this.logger = r, this.telemetryEnabled = n; - } -}, j$ = class { - constructor(e) { - this.opts = e, this.protocol = "wc", this.version = 2; - } -}, U$ = class { - constructor(e) { - this.client = e; - } -}; -var Qv = {}, Da = {}, Z0 = {}, Q0 = {}; -Object.defineProperty(Q0, "__esModule", { value: !0 }); -Q0.BrowserRandomSource = void 0; -const mx = 65536; -class q$ { - constructor() { - this.isAvailable = !1, this.isInstantiated = !1; - const e = typeof self < "u" ? self.crypto || self.msCrypto : null; - e && e.getRandomValues !== void 0 && (this._crypto = e, this.isAvailable = !0, this.isInstantiated = !0); - } - randomBytes(e) { - if (!this.isAvailable || !this._crypto) - throw new Error("Browser random byte generator is not available."); - const r = new Uint8Array(e); - for (let n = 0; n < r.length; n += mx) - this._crypto.getRandomValues(r.subarray(n, n + Math.min(r.length - n, mx))); - return r; - } -} -Q0.BrowserRandomSource = q$; -function e8(t) { - throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); -} -var ep = {}, Bi = {}; -Object.defineProperty(Bi, "__esModule", { value: !0 }); -function z$(t) { - for (var e = 0; e < t.length; e++) - t[e] = 0; - return t; -} -Bi.wipe = z$; -const W$ = {}, H$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - default: W$ -}, Symbol.toStringTag, { value: "Module" })), Ql = /* @__PURE__ */ Lv(H$); -Object.defineProperty(ep, "__esModule", { value: !0 }); -ep.NodeRandomSource = void 0; -const K$ = Bi; -class V$ { - constructor() { - if (this.isAvailable = !1, this.isInstantiated = !1, typeof e8 < "u") { - const e = Ql; - e && e.randomBytes && (this._crypto = e, this.isAvailable = !0, this.isInstantiated = !0); - } - } - randomBytes(e) { - if (!this.isAvailable || !this._crypto) - throw new Error("Node.js random byte generator is not available."); - let r = this._crypto.randomBytes(e); - if (r.length !== e) - throw new Error("NodeRandomSource: got fewer bytes than requested"); - const n = new Uint8Array(e); - for (let i = 0; i < n.length; i++) - n[i] = r[i]; - return (0, K$.wipe)(r), n; - } -} -ep.NodeRandomSource = V$; -Object.defineProperty(Z0, "__esModule", { value: !0 }); -Z0.SystemRandomSource = void 0; -const G$ = Q0, Y$ = ep; -class J$ { - constructor() { - if (this.isAvailable = !1, this.name = "", this._source = new G$.BrowserRandomSource(), this._source.isAvailable) { - this.isAvailable = !0, this.name = "Browser"; - return; - } - if (this._source = new Y$.NodeRandomSource(), this._source.isAvailable) { - this.isAvailable = !0, this.name = "Node"; - return; - } - } - randomBytes(e) { - if (!this.isAvailable) - throw new Error("System random byte generator is not available."); - return this._source.randomBytes(e); - } -} -Z0.SystemRandomSource = J$; -var ar = {}, t8 = {}; -(function(t) { - Object.defineProperty(t, "__esModule", { value: !0 }); - function e(a, u) { - var l = a >>> 16 & 65535, d = a & 65535, p = u >>> 16 & 65535, w = u & 65535; - return d * w + (l * w + d * p << 16 >>> 0) | 0; - } - t.mul = Math.imul || e; - function r(a, u) { - return a + u | 0; - } - t.add = r; - function n(a, u) { - return a - u | 0; - } - t.sub = n; - function i(a, u) { - return a << u | a >>> 32 - u; - } - t.rotl = i; - function s(a, u) { - return a << 32 - u | a >>> u; - } - t.rotr = s; - function o(a) { - return typeof a == "number" && isFinite(a) && Math.floor(a) === a; - } - t.isInteger = Number.isInteger || o, t.MAX_SAFE_INTEGER = 9007199254740991, t.isSafeInteger = function(a) { - return t.isInteger(a) && a >= -t.MAX_SAFE_INTEGER && a <= t.MAX_SAFE_INTEGER; - }; -})(t8); -Object.defineProperty(ar, "__esModule", { value: !0 }); -var r8 = t8; -function X$(t, e) { - return e === void 0 && (e = 0), (t[e + 0] << 8 | t[e + 1]) << 16 >> 16; -} -ar.readInt16BE = X$; -function Z$(t, e) { - return e === void 0 && (e = 0), (t[e + 0] << 8 | t[e + 1]) >>> 0; -} -ar.readUint16BE = Z$; -function Q$(t, e) { - return e === void 0 && (e = 0), (t[e + 1] << 8 | t[e]) << 16 >> 16; -} -ar.readInt16LE = Q$; -function eB(t, e) { - return e === void 0 && (e = 0), (t[e + 1] << 8 | t[e]) >>> 0; -} -ar.readUint16LE = eB; -function n8(t, e, r) { - return e === void 0 && (e = new Uint8Array(2)), r === void 0 && (r = 0), e[r + 0] = t >>> 8, e[r + 1] = t >>> 0, e; -} -ar.writeUint16BE = n8; -ar.writeInt16BE = n8; -function i8(t, e, r) { - return e === void 0 && (e = new Uint8Array(2)), r === void 0 && (r = 0), e[r + 0] = t >>> 0, e[r + 1] = t >>> 8, e; -} -ar.writeUint16LE = i8; -ar.writeInt16LE = i8; -function C1(t, e) { - return e === void 0 && (e = 0), t[e] << 24 | t[e + 1] << 16 | t[e + 2] << 8 | t[e + 3]; -} -ar.readInt32BE = C1; -function T1(t, e) { - return e === void 0 && (e = 0), (t[e] << 24 | t[e + 1] << 16 | t[e + 2] << 8 | t[e + 3]) >>> 0; -} -ar.readUint32BE = T1; -function R1(t, e) { - return e === void 0 && (e = 0), t[e + 3] << 24 | t[e + 2] << 16 | t[e + 1] << 8 | t[e]; -} -ar.readInt32LE = R1; -function D1(t, e) { - return e === void 0 && (e = 0), (t[e + 3] << 24 | t[e + 2] << 16 | t[e + 1] << 8 | t[e]) >>> 0; -} -ar.readUint32LE = D1; -function f0(t, e, r) { - return e === void 0 && (e = new Uint8Array(4)), r === void 0 && (r = 0), e[r + 0] = t >>> 24, e[r + 1] = t >>> 16, e[r + 2] = t >>> 8, e[r + 3] = t >>> 0, e; -} -ar.writeUint32BE = f0; -ar.writeInt32BE = f0; -function l0(t, e, r) { - return e === void 0 && (e = new Uint8Array(4)), r === void 0 && (r = 0), e[r + 0] = t >>> 0, e[r + 1] = t >>> 8, e[r + 2] = t >>> 16, e[r + 3] = t >>> 24, e; -} -ar.writeUint32LE = l0; -ar.writeInt32LE = l0; -function tB(t, e) { - e === void 0 && (e = 0); - var r = C1(t, e), n = C1(t, e + 4); - return r * 4294967296 + n - (n >> 31) * 4294967296; -} -ar.readInt64BE = tB; -function rB(t, e) { - e === void 0 && (e = 0); - var r = T1(t, e), n = T1(t, e + 4); - return r * 4294967296 + n; -} -ar.readUint64BE = rB; -function nB(t, e) { - e === void 0 && (e = 0); - var r = R1(t, e), n = R1(t, e + 4); - return n * 4294967296 + r - (r >> 31) * 4294967296; -} -ar.readInt64LE = nB; -function iB(t, e) { - e === void 0 && (e = 0); - var r = D1(t, e), n = D1(t, e + 4); - return n * 4294967296 + r; -} -ar.readUint64LE = iB; -function s8(t, e, r) { - return e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0), f0(t / 4294967296 >>> 0, e, r), f0(t >>> 0, e, r + 4), e; -} -ar.writeUint64BE = s8; -ar.writeInt64BE = s8; -function o8(t, e, r) { - return e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0), l0(t >>> 0, e, r), l0(t / 4294967296 >>> 0, e, r + 4), e; -} -ar.writeUint64LE = o8; -ar.writeInt64LE = o8; -function sB(t, e, r) { - if (r === void 0 && (r = 0), t % 8 !== 0) - throw new Error("readUintBE supports only bitLengths divisible by 8"); - if (t / 8 > e.length - r) - throw new Error("readUintBE: array is too short for the given bitLength"); - for (var n = 0, i = 1, s = t / 8 + r - 1; s >= r; s--) - n += e[s] * i, i *= 256; - return n; -} -ar.readUintBE = sB; -function oB(t, e, r) { - if (r === void 0 && (r = 0), t % 8 !== 0) - throw new Error("readUintLE supports only bitLengths divisible by 8"); - if (t / 8 > e.length - r) - throw new Error("readUintLE: array is too short for the given bitLength"); - for (var n = 0, i = 1, s = r; s < r + t / 8; s++) - n += e[s] * i, i *= 256; - return n; -} -ar.readUintLE = oB; -function aB(t, e, r, n) { - if (r === void 0 && (r = new Uint8Array(t / 8)), n === void 0 && (n = 0), t % 8 !== 0) - throw new Error("writeUintBE supports only bitLengths divisible by 8"); - if (!r8.isSafeInteger(e)) - throw new Error("writeUintBE value must be an integer"); - for (var i = 1, s = t / 8 + n - 1; s >= n; s--) - r[s] = e / i & 255, i *= 256; - return r; -} -ar.writeUintBE = aB; -function cB(t, e, r, n) { - if (r === void 0 && (r = new Uint8Array(t / 8)), n === void 0 && (n = 0), t % 8 !== 0) - throw new Error("writeUintLE supports only bitLengths divisible by 8"); - if (!r8.isSafeInteger(e)) - throw new Error("writeUintLE value must be an integer"); - for (var i = 1, s = n; s < n + t / 8; s++) - r[s] = e / i & 255, i *= 256; - return r; -} -ar.writeUintLE = cB; -function uB(t, e) { - e === void 0 && (e = 0); - var r = new DataView(t.buffer, t.byteOffset, t.byteLength); - return r.getFloat32(e); -} -ar.readFloat32BE = uB; -function fB(t, e) { - e === void 0 && (e = 0); - var r = new DataView(t.buffer, t.byteOffset, t.byteLength); - return r.getFloat32(e, !0); -} -ar.readFloat32LE = fB; -function lB(t, e) { - e === void 0 && (e = 0); - var r = new DataView(t.buffer, t.byteOffset, t.byteLength); - return r.getFloat64(e); -} -ar.readFloat64BE = lB; -function hB(t, e) { - e === void 0 && (e = 0); - var r = new DataView(t.buffer, t.byteOffset, t.byteLength); - return r.getFloat64(e, !0); -} -ar.readFloat64LE = hB; -function dB(t, e, r) { - e === void 0 && (e = new Uint8Array(4)), r === void 0 && (r = 0); - var n = new DataView(e.buffer, e.byteOffset, e.byteLength); - return n.setFloat32(r, t), e; -} -ar.writeFloat32BE = dB; -function pB(t, e, r) { - e === void 0 && (e = new Uint8Array(4)), r === void 0 && (r = 0); - var n = new DataView(e.buffer, e.byteOffset, e.byteLength); - return n.setFloat32(r, t, !0), e; -} -ar.writeFloat32LE = pB; -function gB(t, e, r) { - e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0); - var n = new DataView(e.buffer, e.byteOffset, e.byteLength); - return n.setFloat64(r, t), e; -} -ar.writeFloat64BE = gB; -function mB(t, e, r) { - e === void 0 && (e = new Uint8Array(8)), r === void 0 && (r = 0); - var n = new DataView(e.buffer, e.byteOffset, e.byteLength); - return n.setFloat64(r, t, !0), e; -} -ar.writeFloat64LE = mB; -(function(t) { - Object.defineProperty(t, "__esModule", { value: !0 }), t.randomStringForEntropy = t.randomString = t.randomUint32 = t.randomBytes = t.defaultRandomSource = void 0; - const e = Z0, r = ar, n = Bi; - t.defaultRandomSource = new e.SystemRandomSource(); - function i(l, d = t.defaultRandomSource) { - return d.randomBytes(l); - } - t.randomBytes = i; - function s(l = t.defaultRandomSource) { - const d = i(4, l), p = (0, r.readUint32LE)(d); - return (0, n.wipe)(d), p; - } - t.randomUint32 = s; - const o = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - function a(l, d = o, p = t.defaultRandomSource) { - if (d.length < 2) - throw new Error("randomString charset is too short"); - if (d.length > 256) - throw new Error("randomString charset is too long"); - let w = ""; - const _ = d.length, P = 256 - 256 % _; - for (; l > 0; ) { - const O = i(Math.ceil(l * 256 / P), p); - for (let L = 0; L < O.length && l > 0; L++) { - const B = O[L]; - B < P && (w += d.charAt(B % _), l--); - } - (0, n.wipe)(O); - } - return w; - } - t.randomString = a; - function u(l, d = o, p = t.defaultRandomSource) { - const w = Math.ceil(l / (Math.log(d.length) / Math.LN2)); - return a(w, d, p); - } - t.randomStringForEntropy = u; -})(Da); -var a8 = {}; -(function(t) { - Object.defineProperty(t, "__esModule", { value: !0 }); - var e = ar, r = Bi; - t.DIGEST_LENGTH = 64, t.BLOCK_SIZE = 128; - var n = ( - /** @class */ - function() { - function a() { - this.digestLength = t.DIGEST_LENGTH, this.blockSize = t.BLOCK_SIZE, this._stateHi = new Int32Array(8), this._stateLo = new Int32Array(8), this._tempHi = new Int32Array(16), this._tempLo = new Int32Array(16), this._buffer = new Uint8Array(256), this._bufferLength = 0, this._bytesHashed = 0, this._finished = !1, this.reset(); - } - return a.prototype._initState = function() { - this._stateHi[0] = 1779033703, this._stateHi[1] = 3144134277, this._stateHi[2] = 1013904242, this._stateHi[3] = 2773480762, this._stateHi[4] = 1359893119, this._stateHi[5] = 2600822924, this._stateHi[6] = 528734635, this._stateHi[7] = 1541459225, this._stateLo[0] = 4089235720, this._stateLo[1] = 2227873595, this._stateLo[2] = 4271175723, this._stateLo[3] = 1595750129, this._stateLo[4] = 2917565137, this._stateLo[5] = 725511199, this._stateLo[6] = 4215389547, this._stateLo[7] = 327033209; - }, a.prototype.reset = function() { - return this._initState(), this._bufferLength = 0, this._bytesHashed = 0, this._finished = !1, this; - }, a.prototype.clean = function() { - r.wipe(this._buffer), r.wipe(this._tempHi), r.wipe(this._tempLo), this.reset(); - }, a.prototype.update = function(u, l) { - if (l === void 0 && (l = u.length), this._finished) - throw new Error("SHA512: can't update because hash was finished."); - var d = 0; - if (this._bytesHashed += l, this._bufferLength > 0) { - for (; this._bufferLength < t.BLOCK_SIZE && l > 0; ) - this._buffer[this._bufferLength++] = u[d++], l--; - this._bufferLength === this.blockSize && (s(this._tempHi, this._tempLo, this._stateHi, this._stateLo, this._buffer, 0, this.blockSize), this._bufferLength = 0); - } - for (l >= this.blockSize && (d = s(this._tempHi, this._tempLo, this._stateHi, this._stateLo, u, d, l), l %= this.blockSize); l > 0; ) - this._buffer[this._bufferLength++] = u[d++], l--; - return this; - }, a.prototype.finish = function(u) { - if (!this._finished) { - var l = this._bytesHashed, d = this._bufferLength, p = l / 536870912 | 0, w = l << 3, _ = l % 128 < 112 ? 128 : 256; - this._buffer[d] = 128; - for (var P = d + 1; P < _ - 8; P++) - this._buffer[P] = 0; - e.writeUint32BE(p, this._buffer, _ - 8), e.writeUint32BE(w, this._buffer, _ - 4), s(this._tempHi, this._tempLo, this._stateHi, this._stateLo, this._buffer, 0, _), this._finished = !0; - } - for (var P = 0; P < this.digestLength / 8; P++) - e.writeUint32BE(this._stateHi[P], u, P * 8), e.writeUint32BE(this._stateLo[P], u, P * 8 + 4); - return this; - }, a.prototype.digest = function() { - var u = new Uint8Array(this.digestLength); - return this.finish(u), u; - }, a.prototype.saveState = function() { - if (this._finished) - throw new Error("SHA256: cannot save finished state"); - return { - stateHi: new Int32Array(this._stateHi), - stateLo: new Int32Array(this._stateLo), - buffer: this._bufferLength > 0 ? new Uint8Array(this._buffer) : void 0, - bufferLength: this._bufferLength, - bytesHashed: this._bytesHashed - }; - }, a.prototype.restoreState = function(u) { - return this._stateHi.set(u.stateHi), this._stateLo.set(u.stateLo), this._bufferLength = u.bufferLength, u.buffer && this._buffer.set(u.buffer), this._bytesHashed = u.bytesHashed, this._finished = !1, this; - }, a.prototype.cleanSavedState = function(u) { - r.wipe(u.stateHi), r.wipe(u.stateLo), u.buffer && r.wipe(u.buffer), u.bufferLength = 0, u.bytesHashed = 0; - }, a; - }() - ); - t.SHA512 = n; - var i = new Int32Array([ - 1116352408, - 3609767458, - 1899447441, - 602891725, - 3049323471, - 3964484399, - 3921009573, - 2173295548, - 961987163, - 4081628472, - 1508970993, - 3053834265, - 2453635748, - 2937671579, - 2870763221, - 3664609560, - 3624381080, - 2734883394, - 310598401, - 1164996542, - 607225278, - 1323610764, - 1426881987, - 3590304994, - 1925078388, - 4068182383, - 2162078206, - 991336113, - 2614888103, - 633803317, - 3248222580, - 3479774868, - 3835390401, - 2666613458, - 4022224774, - 944711139, - 264347078, - 2341262773, - 604807628, - 2007800933, - 770255983, - 1495990901, - 1249150122, - 1856431235, - 1555081692, - 3175218132, - 1996064986, - 2198950837, - 2554220882, - 3999719339, - 2821834349, - 766784016, - 2952996808, - 2566594879, - 3210313671, - 3203337956, - 3336571891, - 1034457026, - 3584528711, - 2466948901, - 113926993, - 3758326383, - 338241895, - 168717936, - 666307205, - 1188179964, - 773529912, - 1546045734, - 1294757372, - 1522805485, - 1396182291, - 2643833823, - 1695183700, - 2343527390, - 1986661051, - 1014477480, - 2177026350, - 1206759142, - 2456956037, - 344077627, - 2730485921, - 1290863460, - 2820302411, - 3158454273, - 3259730800, - 3505952657, - 3345764771, - 106217008, - 3516065817, - 3606008344, - 3600352804, - 1432725776, - 4094571909, - 1467031594, - 275423344, - 851169720, - 430227734, - 3100823752, - 506948616, - 1363258195, - 659060556, - 3750685593, - 883997877, - 3785050280, - 958139571, - 3318307427, - 1322822218, - 3812723403, - 1537002063, - 2003034995, - 1747873779, - 3602036899, - 1955562222, - 1575990012, - 2024104815, - 1125592928, - 2227730452, - 2716904306, - 2361852424, - 442776044, - 2428436474, - 593698344, - 2756734187, - 3733110249, - 3204031479, - 2999351573, - 3329325298, - 3815920427, - 3391569614, - 3928383900, - 3515267271, - 566280711, - 3940187606, - 3454069534, - 4118630271, - 4000239992, - 116418474, - 1914138554, - 174292421, - 2731055270, - 289380356, - 3203993006, - 460393269, - 320620315, - 685471733, - 587496836, - 852142971, - 1086792851, - 1017036298, - 365543100, - 1126000580, - 2618297676, - 1288033470, - 3409855158, - 1501505948, - 4234509866, - 1607167915, - 987167468, - 1816402316, - 1246189591 - ]); - function s(a, u, l, d, p, w, _) { - for (var P = l[0], O = l[1], L = l[2], B = l[3], k = l[4], W = l[5], U = l[6], V = l[7], Q = d[0], R = d[1], K = d[2], ge = d[3], Ee = d[4], Y = d[5], A = d[6], m = d[7], f, g, b, x, E, S, v, M; _ >= 128; ) { - for (var I = 0; I < 16; I++) { - var F = 8 * I + w; - a[I] = e.readUint32BE(p, F), u[I] = e.readUint32BE(p, F + 4); - } - for (var I = 0; I < 80; I++) { - var ce = P, D = O, oe = L, Z = B, J = k, ee = W, T = U, X = V, re = Q, pe = R, ie = K, ue = ge, ve = Ee, Pe = Y, De = A, Ce = m; - if (f = V, g = m, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = (k >>> 14 | Ee << 18) ^ (k >>> 18 | Ee << 14) ^ (Ee >>> 9 | k << 23), g = (Ee >>> 14 | k << 18) ^ (Ee >>> 18 | k << 14) ^ (k >>> 9 | Ee << 23), E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, f = k & W ^ ~k & U, g = Ee & Y ^ ~Ee & A, E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, f = i[I * 2], g = i[I * 2 + 1], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, f = a[I % 16], g = u[I % 16], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, b = v & 65535 | M << 16, x = E & 65535 | S << 16, f = b, g = x, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = (P >>> 28 | Q << 4) ^ (Q >>> 2 | P << 30) ^ (Q >>> 7 | P << 25), g = (Q >>> 28 | P << 4) ^ (P >>> 2 | Q << 30) ^ (P >>> 7 | Q << 25), E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, f = P & O ^ P & L ^ O & L, g = Q & R ^ Q & K ^ R & K, E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, X = v & 65535 | M << 16, Ce = E & 65535 | S << 16, f = Z, g = ue, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = b, g = x, E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, Z = v & 65535 | M << 16, ue = E & 65535 | S << 16, O = ce, L = D, B = oe, k = Z, W = J, U = ee, V = T, P = X, R = re, K = pe, ge = ie, Ee = ue, Y = ve, A = Pe, m = De, Q = Ce, I % 16 === 15) - for (var F = 0; F < 16; F++) - f = a[F], g = u[F], E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = a[(F + 9) % 16], g = u[(F + 9) % 16], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, b = a[(F + 1) % 16], x = u[(F + 1) % 16], f = (b >>> 1 | x << 31) ^ (b >>> 8 | x << 24) ^ b >>> 7, g = (x >>> 1 | b << 31) ^ (x >>> 8 | b << 24) ^ (x >>> 7 | b << 25), E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, b = a[(F + 14) % 16], x = u[(F + 14) % 16], f = (b >>> 19 | x << 13) ^ (x >>> 29 | b << 3) ^ b >>> 6, g = (x >>> 19 | b << 13) ^ (b >>> 29 | x << 3) ^ (x >>> 6 | b << 26), E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, a[F] = v & 65535 | M << 16, u[F] = E & 65535 | S << 16; - } - f = P, g = Q, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[0], g = d[0], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[0] = P = v & 65535 | M << 16, d[0] = Q = E & 65535 | S << 16, f = O, g = R, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[1], g = d[1], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[1] = O = v & 65535 | M << 16, d[1] = R = E & 65535 | S << 16, f = L, g = K, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[2], g = d[2], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[2] = L = v & 65535 | M << 16, d[2] = K = E & 65535 | S << 16, f = B, g = ge, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[3], g = d[3], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[3] = B = v & 65535 | M << 16, d[3] = ge = E & 65535 | S << 16, f = k, g = Ee, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[4], g = d[4], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[4] = k = v & 65535 | M << 16, d[4] = Ee = E & 65535 | S << 16, f = W, g = Y, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[5], g = d[5], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[5] = W = v & 65535 | M << 16, d[5] = Y = E & 65535 | S << 16, f = U, g = A, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[6], g = d[6], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[6] = U = v & 65535 | M << 16, d[6] = A = E & 65535 | S << 16, f = V, g = m, E = g & 65535, S = g >>> 16, v = f & 65535, M = f >>> 16, f = l[7], g = d[7], E += g & 65535, S += g >>> 16, v += f & 65535, M += f >>> 16, S += E >>> 16, v += S >>> 16, M += v >>> 16, l[7] = V = v & 65535 | M << 16, d[7] = m = E & 65535 | S << 16, w += 128, _ -= 128; - } - return w; - } - function o(a) { - var u = new n(); - u.update(a); - var l = u.digest(); - return u.clean(), l; - } - t.hash = o; -})(a8); -(function(t) { - Object.defineProperty(t, "__esModule", { value: !0 }), t.convertSecretKeyToX25519 = t.convertPublicKeyToX25519 = t.verify = t.sign = t.extractPublicKeyFromSecretKey = t.generateKeyPair = t.generateKeyPairFromSeed = t.SEED_LENGTH = t.SECRET_KEY_LENGTH = t.PUBLIC_KEY_LENGTH = t.SIGNATURE_LENGTH = void 0; - const e = Da, r = a8, n = Bi; - t.SIGNATURE_LENGTH = 64, t.PUBLIC_KEY_LENGTH = 32, t.SECRET_KEY_LENGTH = 64, t.SEED_LENGTH = 32; - function i(Z) { - const J = new Float64Array(16); - if (Z) - for (let ee = 0; ee < Z.length; ee++) - J[ee] = Z[ee]; - return J; - } - const s = new Uint8Array(32); - s[0] = 9; - const o = i(), a = i([1]), u = i([ - 30883, - 4953, - 19914, - 30187, - 55467, - 16705, - 2637, - 112, - 59544, - 30585, - 16505, - 36039, - 65139, - 11119, - 27886, - 20995 - ]), l = i([ - 61785, - 9906, - 39828, - 60374, - 45398, - 33411, - 5274, - 224, - 53552, - 61171, - 33010, - 6542, - 64743, - 22239, - 55772, - 9222 - ]), d = i([ - 54554, - 36645, - 11616, - 51542, - 42930, - 38181, - 51040, - 26924, - 56412, - 64982, - 57905, - 49316, - 21502, - 52590, - 14035, - 8553 - ]), p = i([ - 26200, - 26214, - 26214, - 26214, - 26214, - 26214, - 26214, - 26214, - 26214, - 26214, - 26214, - 26214, - 26214, - 26214, - 26214, - 26214 - ]), w = i([ - 41136, - 18958, - 6951, - 50414, - 58488, - 44335, - 6150, - 12099, - 55207, - 15867, - 153, - 11085, - 57099, - 20417, - 9344, - 11139 - ]); - function _(Z, J) { - for (let ee = 0; ee < 16; ee++) - Z[ee] = J[ee] | 0; - } - function P(Z) { - let J = 1; - for (let ee = 0; ee < 16; ee++) { - let T = Z[ee] + J + 65535; - J = Math.floor(T / 65536), Z[ee] = T - J * 65536; - } - Z[0] += J - 1 + 37 * (J - 1); - } - function O(Z, J, ee) { - const T = ~(ee - 1); - for (let X = 0; X < 16; X++) { - const re = T & (Z[X] ^ J[X]); - Z[X] ^= re, J[X] ^= re; - } - } - function L(Z, J) { - const ee = i(), T = i(); - for (let X = 0; X < 16; X++) - T[X] = J[X]; - P(T), P(T), P(T); - for (let X = 0; X < 2; X++) { - ee[0] = T[0] - 65517; - for (let pe = 1; pe < 15; pe++) - ee[pe] = T[pe] - 65535 - (ee[pe - 1] >> 16 & 1), ee[pe - 1] &= 65535; - ee[15] = T[15] - 32767 - (ee[14] >> 16 & 1); - const re = ee[15] >> 16 & 1; - ee[14] &= 65535, O(T, ee, 1 - re); - } - for (let X = 0; X < 16; X++) - Z[2 * X] = T[X] & 255, Z[2 * X + 1] = T[X] >> 8; - } - function B(Z, J) { - let ee = 0; - for (let T = 0; T < 32; T++) - ee |= Z[T] ^ J[T]; - return (1 & ee - 1 >>> 8) - 1; - } - function k(Z, J) { - const ee = new Uint8Array(32), T = new Uint8Array(32); - return L(ee, Z), L(T, J), B(ee, T); - } - function W(Z) { - const J = new Uint8Array(32); - return L(J, Z), J[0] & 1; - } - function U(Z, J) { - for (let ee = 0; ee < 16; ee++) - Z[ee] = J[2 * ee] + (J[2 * ee + 1] << 8); - Z[15] &= 32767; - } - function V(Z, J, ee) { - for (let T = 0; T < 16; T++) - Z[T] = J[T] + ee[T]; - } - function Q(Z, J, ee) { - for (let T = 0; T < 16; T++) - Z[T] = J[T] - ee[T]; - } - function R(Z, J, ee) { - let T, X, re = 0, pe = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = 0, Me = 0, Ne = 0, Ke = 0, Le = 0, qe = 0, ze = 0, _e = 0, Ze = 0, at = 0, ke = 0, Qe = 0, tt = 0, Ye = 0, dt = 0, lt = 0, ct = 0, qt = 0, Jt = 0, Et = 0, er = 0, Xt = 0, Dt = 0, kt = ee[0], Ct = ee[1], mt = ee[2], Rt = ee[3], Nt = ee[4], bt = ee[5], $t = ee[6], Ft = ee[7], rt = ee[8], Bt = ee[9], $ = ee[10], q = ee[11], H = ee[12], C = ee[13], G = ee[14], j = ee[15]; - T = J[0], re += T * kt, pe += T * Ct, ie += T * mt, ue += T * Rt, ve += T * Nt, Pe += T * bt, De += T * $t, Ce += T * Ft, $e += T * rt, Me += T * Bt, Ne += T * $, Ke += T * q, Le += T * H, qe += T * C, ze += T * G, _e += T * j, T = J[1], pe += T * kt, ie += T * Ct, ue += T * mt, ve += T * Rt, Pe += T * Nt, De += T * bt, Ce += T * $t, $e += T * Ft, Me += T * rt, Ne += T * Bt, Ke += T * $, Le += T * q, qe += T * H, ze += T * C, _e += T * G, Ze += T * j, T = J[2], ie += T * kt, ue += T * Ct, ve += T * mt, Pe += T * Rt, De += T * Nt, Ce += T * bt, $e += T * $t, Me += T * Ft, Ne += T * rt, Ke += T * Bt, Le += T * $, qe += T * q, ze += T * H, _e += T * C, Ze += T * G, at += T * j, T = J[3], ue += T * kt, ve += T * Ct, Pe += T * mt, De += T * Rt, Ce += T * Nt, $e += T * bt, Me += T * $t, Ne += T * Ft, Ke += T * rt, Le += T * Bt, qe += T * $, ze += T * q, _e += T * H, Ze += T * C, at += T * G, ke += T * j, T = J[4], ve += T * kt, Pe += T * Ct, De += T * mt, Ce += T * Rt, $e += T * Nt, Me += T * bt, Ne += T * $t, Ke += T * Ft, Le += T * rt, qe += T * Bt, ze += T * $, _e += T * q, Ze += T * H, at += T * C, ke += T * G, Qe += T * j, T = J[5], Pe += T * kt, De += T * Ct, Ce += T * mt, $e += T * Rt, Me += T * Nt, Ne += T * bt, Ke += T * $t, Le += T * Ft, qe += T * rt, ze += T * Bt, _e += T * $, Ze += T * q, at += T * H, ke += T * C, Qe += T * G, tt += T * j, T = J[6], De += T * kt, Ce += T * Ct, $e += T * mt, Me += T * Rt, Ne += T * Nt, Ke += T * bt, Le += T * $t, qe += T * Ft, ze += T * rt, _e += T * Bt, Ze += T * $, at += T * q, ke += T * H, Qe += T * C, tt += T * G, Ye += T * j, T = J[7], Ce += T * kt, $e += T * Ct, Me += T * mt, Ne += T * Rt, Ke += T * Nt, Le += T * bt, qe += T * $t, ze += T * Ft, _e += T * rt, Ze += T * Bt, at += T * $, ke += T * q, Qe += T * H, tt += T * C, Ye += T * G, dt += T * j, T = J[8], $e += T * kt, Me += T * Ct, Ne += T * mt, Ke += T * Rt, Le += T * Nt, qe += T * bt, ze += T * $t, _e += T * Ft, Ze += T * rt, at += T * Bt, ke += T * $, Qe += T * q, tt += T * H, Ye += T * C, dt += T * G, lt += T * j, T = J[9], Me += T * kt, Ne += T * Ct, Ke += T * mt, Le += T * Rt, qe += T * Nt, ze += T * bt, _e += T * $t, Ze += T * Ft, at += T * rt, ke += T * Bt, Qe += T * $, tt += T * q, Ye += T * H, dt += T * C, lt += T * G, ct += T * j, T = J[10], Ne += T * kt, Ke += T * Ct, Le += T * mt, qe += T * Rt, ze += T * Nt, _e += T * bt, Ze += T * $t, at += T * Ft, ke += T * rt, Qe += T * Bt, tt += T * $, Ye += T * q, dt += T * H, lt += T * C, ct += T * G, qt += T * j, T = J[11], Ke += T * kt, Le += T * Ct, qe += T * mt, ze += T * Rt, _e += T * Nt, Ze += T * bt, at += T * $t, ke += T * Ft, Qe += T * rt, tt += T * Bt, Ye += T * $, dt += T * q, lt += T * H, ct += T * C, qt += T * G, Jt += T * j, T = J[12], Le += T * kt, qe += T * Ct, ze += T * mt, _e += T * Rt, Ze += T * Nt, at += T * bt, ke += T * $t, Qe += T * Ft, tt += T * rt, Ye += T * Bt, dt += T * $, lt += T * q, ct += T * H, qt += T * C, Jt += T * G, Et += T * j, T = J[13], qe += T * kt, ze += T * Ct, _e += T * mt, Ze += T * Rt, at += T * Nt, ke += T * bt, Qe += T * $t, tt += T * Ft, Ye += T * rt, dt += T * Bt, lt += T * $, ct += T * q, qt += T * H, Jt += T * C, Et += T * G, er += T * j, T = J[14], ze += T * kt, _e += T * Ct, Ze += T * mt, at += T * Rt, ke += T * Nt, Qe += T * bt, tt += T * $t, Ye += T * Ft, dt += T * rt, lt += T * Bt, ct += T * $, qt += T * q, Jt += T * H, Et += T * C, er += T * G, Xt += T * j, T = J[15], _e += T * kt, Ze += T * Ct, at += T * mt, ke += T * Rt, Qe += T * Nt, tt += T * bt, Ye += T * $t, dt += T * Ft, lt += T * rt, ct += T * Bt, qt += T * $, Jt += T * q, Et += T * H, er += T * C, Xt += T * G, Dt += T * j, re += 38 * Ze, pe += 38 * at, ie += 38 * ke, ue += 38 * Qe, ve += 38 * tt, Pe += 38 * Ye, De += 38 * dt, Ce += 38 * lt, $e += 38 * ct, Me += 38 * qt, Ne += 38 * Jt, Ke += 38 * Et, Le += 38 * er, qe += 38 * Xt, ze += 38 * Dt, X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = pe + X + 65535, X = Math.floor(T / 65536), pe = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), X = 1, T = re + X + 65535, X = Math.floor(T / 65536), re = T - X * 65536, T = pe + X + 65535, X = Math.floor(T / 65536), pe = T - X * 65536, T = ie + X + 65535, X = Math.floor(T / 65536), ie = T - X * 65536, T = ue + X + 65535, X = Math.floor(T / 65536), ue = T - X * 65536, T = ve + X + 65535, X = Math.floor(T / 65536), ve = T - X * 65536, T = Pe + X + 65535, X = Math.floor(T / 65536), Pe = T - X * 65536, T = De + X + 65535, X = Math.floor(T / 65536), De = T - X * 65536, T = Ce + X + 65535, X = Math.floor(T / 65536), Ce = T - X * 65536, T = $e + X + 65535, X = Math.floor(T / 65536), $e = T - X * 65536, T = Me + X + 65535, X = Math.floor(T / 65536), Me = T - X * 65536, T = Ne + X + 65535, X = Math.floor(T / 65536), Ne = T - X * 65536, T = Ke + X + 65535, X = Math.floor(T / 65536), Ke = T - X * 65536, T = Le + X + 65535, X = Math.floor(T / 65536), Le = T - X * 65536, T = qe + X + 65535, X = Math.floor(T / 65536), qe = T - X * 65536, T = ze + X + 65535, X = Math.floor(T / 65536), ze = T - X * 65536, T = _e + X + 65535, X = Math.floor(T / 65536), _e = T - X * 65536, re += X - 1 + 37 * (X - 1), Z[0] = re, Z[1] = pe, Z[2] = ie, Z[3] = ue, Z[4] = ve, Z[5] = Pe, Z[6] = De, Z[7] = Ce, Z[8] = $e, Z[9] = Me, Z[10] = Ne, Z[11] = Ke, Z[12] = Le, Z[13] = qe, Z[14] = ze, Z[15] = _e; - } - function K(Z, J) { - R(Z, J, J); - } - function ge(Z, J) { - const ee = i(); - let T; - for (T = 0; T < 16; T++) - ee[T] = J[T]; - for (T = 253; T >= 0; T--) - K(ee, ee), T !== 2 && T !== 4 && R(ee, ee, J); - for (T = 0; T < 16; T++) - Z[T] = ee[T]; - } - function Ee(Z, J) { - const ee = i(); - let T; - for (T = 0; T < 16; T++) - ee[T] = J[T]; - for (T = 250; T >= 0; T--) - K(ee, ee), T !== 1 && R(ee, ee, J); - for (T = 0; T < 16; T++) - Z[T] = ee[T]; - } - function Y(Z, J) { - const ee = i(), T = i(), X = i(), re = i(), pe = i(), ie = i(), ue = i(), ve = i(), Pe = i(); - Q(ee, Z[1], Z[0]), Q(Pe, J[1], J[0]), R(ee, ee, Pe), V(T, Z[0], Z[1]), V(Pe, J[0], J[1]), R(T, T, Pe), R(X, Z[3], J[3]), R(X, X, l), R(re, Z[2], J[2]), V(re, re, re), Q(pe, T, ee), Q(ie, re, X), V(ue, re, X), V(ve, T, ee), R(Z[0], pe, ie), R(Z[1], ve, ue), R(Z[2], ue, ie), R(Z[3], pe, ve); - } - function A(Z, J, ee) { - for (let T = 0; T < 4; T++) - O(Z[T], J[T], ee); - } - function m(Z, J) { - const ee = i(), T = i(), X = i(); - ge(X, J[2]), R(ee, J[0], X), R(T, J[1], X), L(Z, T), Z[31] ^= W(ee) << 7; - } - function f(Z, J, ee) { - _(Z[0], o), _(Z[1], a), _(Z[2], a), _(Z[3], o); - for (let T = 255; T >= 0; --T) { - const X = ee[T / 8 | 0] >> (T & 7) & 1; - A(Z, J, X), Y(J, Z), Y(Z, Z), A(Z, J, X); - } - } - function g(Z, J) { - const ee = [i(), i(), i(), i()]; - _(ee[0], d), _(ee[1], p), _(ee[2], a), R(ee[3], d, p), f(Z, ee, J); - } - function b(Z) { - if (Z.length !== t.SEED_LENGTH) - throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`); - const J = (0, r.hash)(Z); - J[0] &= 248, J[31] &= 127, J[31] |= 64; - const ee = new Uint8Array(32), T = [i(), i(), i(), i()]; - g(T, J), m(ee, T); - const X = new Uint8Array(64); - return X.set(Z), X.set(ee, 32), { - publicKey: ee, - secretKey: X - }; - } - t.generateKeyPairFromSeed = b; - function x(Z) { - const J = (0, e.randomBytes)(32, Z), ee = b(J); - return (0, n.wipe)(J), ee; - } - t.generateKeyPair = x; - function E(Z) { - if (Z.length !== t.SECRET_KEY_LENGTH) - throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`); - return new Uint8Array(Z.subarray(32)); - } - t.extractPublicKeyFromSecretKey = E; - const S = new Float64Array([ - 237, - 211, - 245, - 92, - 26, - 99, - 18, - 88, - 214, - 156, - 247, - 162, - 222, - 249, - 222, - 20, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 16 - ]); - function v(Z, J) { - let ee, T, X, re; - for (T = 63; T >= 32; --T) { - for (ee = 0, X = T - 32, re = T - 12; X < re; ++X) - J[X] += ee - 16 * J[T] * S[X - (T - 32)], ee = Math.floor((J[X] + 128) / 256), J[X] -= ee * 256; - J[X] += ee, J[T] = 0; - } - for (ee = 0, X = 0; X < 32; X++) - J[X] += ee - (J[31] >> 4) * S[X], ee = J[X] >> 8, J[X] &= 255; - for (X = 0; X < 32; X++) - J[X] -= ee * S[X]; - for (T = 0; T < 32; T++) - J[T + 1] += J[T] >> 8, Z[T] = J[T] & 255; - } - function M(Z) { - const J = new Float64Array(64); - for (let ee = 0; ee < 64; ee++) - J[ee] = Z[ee]; - for (let ee = 0; ee < 64; ee++) - Z[ee] = 0; - v(Z, J); - } - function I(Z, J) { - const ee = new Float64Array(64), T = [i(), i(), i(), i()], X = (0, r.hash)(Z.subarray(0, 32)); - X[0] &= 248, X[31] &= 127, X[31] |= 64; - const re = new Uint8Array(64); - re.set(X.subarray(32), 32); - const pe = new r.SHA512(); - pe.update(re.subarray(32)), pe.update(J); - const ie = pe.digest(); - pe.clean(), M(ie), g(T, ie), m(re, T), pe.reset(), pe.update(re.subarray(0, 32)), pe.update(Z.subarray(32)), pe.update(J); - const ue = pe.digest(); - M(ue); - for (let ve = 0; ve < 32; ve++) - ee[ve] = ie[ve]; - for (let ve = 0; ve < 32; ve++) - for (let Pe = 0; Pe < 32; Pe++) - ee[ve + Pe] += ue[ve] * X[Pe]; - return v(re.subarray(32), ee), re; - } - t.sign = I; - function F(Z, J) { - const ee = i(), T = i(), X = i(), re = i(), pe = i(), ie = i(), ue = i(); - return _(Z[2], a), U(Z[1], J), K(X, Z[1]), R(re, X, u), Q(X, X, Z[2]), V(re, Z[2], re), K(pe, re), K(ie, pe), R(ue, ie, pe), R(ee, ue, X), R(ee, ee, re), Ee(ee, ee), R(ee, ee, X), R(ee, ee, re), R(ee, ee, re), R(Z[0], ee, re), K(T, Z[0]), R(T, T, re), k(T, X) && R(Z[0], Z[0], w), K(T, Z[0]), R(T, T, re), k(T, X) ? -1 : (W(Z[0]) === J[31] >> 7 && Q(Z[0], o, Z[0]), R(Z[3], Z[0], Z[1]), 0); - } - function ce(Z, J, ee) { - const T = new Uint8Array(32), X = [i(), i(), i(), i()], re = [i(), i(), i(), i()]; - if (ee.length !== t.SIGNATURE_LENGTH) - throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`); - if (F(re, Z)) - return !1; - const pe = new r.SHA512(); - pe.update(ee.subarray(0, 32)), pe.update(Z), pe.update(J); - const ie = pe.digest(); - return M(ie), f(X, re, ie), g(re, ee.subarray(32)), Y(X, re), m(T, X), !B(ee, T); - } - t.verify = ce; - function D(Z) { - let J = [i(), i(), i(), i()]; - if (F(J, Z)) - throw new Error("Ed25519: invalid public key"); - let ee = i(), T = i(), X = J[1]; - V(ee, a, X), Q(T, a, X), ge(T, T), R(ee, ee, T); - let re = new Uint8Array(32); - return L(re, ee), re; - } - t.convertPublicKeyToX25519 = D; - function oe(Z) { - const J = (0, r.hash)(Z.subarray(0, 32)); - J[0] &= 248, J[31] &= 127, J[31] |= 64; - const ee = new Uint8Array(J.subarray(0, 32)); - return (0, n.wipe)(J), ee; - } - t.convertSecretKeyToX25519 = oe; -})(Qv); -const vB = "EdDSA", bB = "JWT", h0 = ".", tp = "base64url", c8 = "utf8", u8 = "utf8", yB = ":", wB = "did", xB = "key", vx = "base58btc", _B = "z", EB = "K36", SB = 32; -function f8(t = 0) { - return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); -} -function kd(t, e) { - e || (e = t.reduce((i, s) => i + s.length, 0)); - const r = f8(e); - let n = 0; - for (const i of t) - r.set(i, n), n += i.length; - return r; -} -function AB(t, e) { - if (t.length >= 255) - throw new TypeError("Alphabet too long"); - for (var r = new Uint8Array(256), n = 0; n < r.length; n++) - r[n] = 255; - for (var i = 0; i < t.length; i++) { - var s = t.charAt(i), o = s.charCodeAt(0); - if (r[o] !== 255) - throw new TypeError(s + " is ambiguous"); - r[o] = i; - } - var a = t.length, u = t.charAt(0), l = Math.log(a) / Math.log(256), d = Math.log(256) / Math.log(a); - function p(P) { - if (P instanceof Uint8Array || (ArrayBuffer.isView(P) ? P = new Uint8Array(P.buffer, P.byteOffset, P.byteLength) : Array.isArray(P) && (P = Uint8Array.from(P))), !(P instanceof Uint8Array)) - throw new TypeError("Expected Uint8Array"); - if (P.length === 0) - return ""; - for (var O = 0, L = 0, B = 0, k = P.length; B !== k && P[B] === 0; ) - B++, O++; - for (var W = (k - B) * d + 1 >>> 0, U = new Uint8Array(W); B !== k; ) { - for (var V = P[B], Q = 0, R = W - 1; (V !== 0 || Q < L) && R !== -1; R--, Q++) - V += 256 * U[R] >>> 0, U[R] = V % a >>> 0, V = V / a >>> 0; - if (V !== 0) - throw new Error("Non-zero carry"); - L = Q, B++; - } - for (var K = W - L; K !== W && U[K] === 0; ) - K++; - for (var ge = u.repeat(O); K < W; ++K) - ge += t.charAt(U[K]); - return ge; - } - function w(P) { - if (typeof P != "string") - throw new TypeError("Expected String"); - if (P.length === 0) - return new Uint8Array(); - var O = 0; - if (P[O] !== " ") { - for (var L = 0, B = 0; P[O] === u; ) - L++, O++; - for (var k = (P.length - O) * l + 1 >>> 0, W = new Uint8Array(k); P[O]; ) { - var U = r[P.charCodeAt(O)]; - if (U === 255) - return; - for (var V = 0, Q = k - 1; (U !== 0 || V < B) && Q !== -1; Q--, V++) - U += a * W[Q] >>> 0, W[Q] = U % 256 >>> 0, U = U / 256 >>> 0; - if (U !== 0) - throw new Error("Non-zero carry"); - B = V, O++; - } - if (P[O] !== " ") { - for (var R = k - B; R !== k && W[R] === 0; ) - R++; - for (var K = new Uint8Array(L + (k - R)), ge = L; R !== k; ) - K[ge++] = W[R++]; - return K; - } - } - } - function _(P) { - var O = w(P); - if (O) - return O; - throw new Error(`Non-${e} character`); - } - return { - encode: p, - decodeUnsafe: w, - decode: _ - }; -} -var PB = AB, MB = PB; -const IB = (t) => { - if (t instanceof Uint8Array && t.constructor.name === "Uint8Array") - return t; - if (t instanceof ArrayBuffer) - return new Uint8Array(t); - if (ArrayBuffer.isView(t)) - return new Uint8Array(t.buffer, t.byteOffset, t.byteLength); - throw new Error("Unknown type, must be binary type"); -}, CB = (t) => new TextEncoder().encode(t), TB = (t) => new TextDecoder().decode(t); -class RB { - constructor(e, r, n) { - this.name = e, this.prefix = r, this.baseEncode = n; - } - encode(e) { - if (e instanceof Uint8Array) - return `${this.prefix}${this.baseEncode(e)}`; - throw Error("Unknown type, must be binary type"); - } -} -class DB { - constructor(e, r, n) { - if (this.name = e, this.prefix = r, r.codePointAt(0) === void 0) - throw new Error("Invalid prefix character"); - this.prefixCodePoint = r.codePointAt(0), this.baseDecode = n; - } - decode(e) { - if (typeof e == "string") { - if (e.codePointAt(0) !== this.prefixCodePoint) - throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`); - return this.baseDecode(e.slice(this.prefix.length)); - } else - throw Error("Can only multibase decode strings"); - } - or(e) { - return l8(this, e); - } -} -class OB { - constructor(e) { - this.decoders = e; - } - or(e) { - return l8(this, e); - } - decode(e) { - const r = e[0], n = this.decoders[r]; - if (n) - return n.decode(e); - throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`); - } -} -const l8 = (t, e) => new OB({ - ...t.decoders || { [t.prefix]: t }, - ...e.decoders || { [e.prefix]: e } -}); -class NB { - constructor(e, r, n, i) { - this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new RB(e, r, n), this.decoder = new DB(e, r, i); - } - encode(e) { - return this.encoder.encode(e); - } - decode(e) { - return this.decoder.decode(e); - } -} -const rp = ({ name: t, prefix: e, encode: r, decode: n }) => new NB(t, e, r, n), eh = ({ prefix: t, name: e, alphabet: r }) => { - const { encode: n, decode: i } = MB(r, e); - return rp({ - prefix: t, - name: e, - encode: n, - decode: (s) => IB(i(s)) - }); -}, LB = (t, e, r, n) => { - const i = {}; - for (let d = 0; d < e.length; ++d) - i[e[d]] = d; - let s = t.length; - for (; t[s - 1] === "="; ) - --s; - const o = new Uint8Array(s * r / 8 | 0); - let a = 0, u = 0, l = 0; - for (let d = 0; d < s; ++d) { - const p = i[t[d]]; - if (p === void 0) - throw new SyntaxError(`Non-${n} character`); - u = u << r | p, a += r, a >= 8 && (a -= 8, o[l++] = 255 & u >> a); - } - if (a >= r || 255 & u << 8 - a) - throw new SyntaxError("Unexpected end of data"); - return o; -}, kB = (t, e, r) => { - const n = e[e.length - 1] === "=", i = (1 << r) - 1; - let s = "", o = 0, a = 0; - for (let u = 0; u < t.length; ++u) - for (a = a << 8 | t[u], o += 8; o > r; ) - o -= r, s += e[i & a >> o]; - if (o && (s += e[i & a << r - o]), n) - for (; s.length * r & 7; ) - s += "="; - return s; -}, qn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => rp({ - prefix: e, - name: t, - encode(i) { - return kB(i, n, r); - }, - decode(i) { - return LB(i, n, r, t); - } -}), $B = rp({ - prefix: "\0", - name: "identity", - encode: (t) => TB(t), - decode: (t) => CB(t) -}), BB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - identity: $B -}, Symbol.toStringTag, { value: "Module" })), FB = qn({ - prefix: "0", - name: "base2", - alphabet: "01", - bitsPerChar: 1 -}), jB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - base2: FB -}, Symbol.toStringTag, { value: "Module" })), UB = qn({ - prefix: "7", - name: "base8", - alphabet: "01234567", - bitsPerChar: 3 -}), qB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - base8: UB -}, Symbol.toStringTag, { value: "Module" })), zB = eh({ - prefix: "9", - name: "base10", - alphabet: "0123456789" -}), WB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - base10: zB -}, Symbol.toStringTag, { value: "Module" })), HB = qn({ - prefix: "f", - name: "base16", - alphabet: "0123456789abcdef", - bitsPerChar: 4 -}), KB = qn({ - prefix: "F", - name: "base16upper", - alphabet: "0123456789ABCDEF", - bitsPerChar: 4 -}), VB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - base16: HB, - base16upper: KB -}, Symbol.toStringTag, { value: "Module" })), GB = qn({ - prefix: "b", - name: "base32", - alphabet: "abcdefghijklmnopqrstuvwxyz234567", - bitsPerChar: 5 -}), YB = qn({ - prefix: "B", - name: "base32upper", - alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", - bitsPerChar: 5 -}), JB = qn({ - prefix: "c", - name: "base32pad", - alphabet: "abcdefghijklmnopqrstuvwxyz234567=", - bitsPerChar: 5 -}), XB = qn({ - prefix: "C", - name: "base32padupper", - alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", - bitsPerChar: 5 -}), ZB = qn({ - prefix: "v", - name: "base32hex", - alphabet: "0123456789abcdefghijklmnopqrstuv", - bitsPerChar: 5 -}), QB = qn({ - prefix: "V", - name: "base32hexupper", - alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", - bitsPerChar: 5 -}), eF = qn({ - prefix: "t", - name: "base32hexpad", - alphabet: "0123456789abcdefghijklmnopqrstuv=", - bitsPerChar: 5 -}), tF = qn({ - prefix: "T", - name: "base32hexpadupper", - alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=", - bitsPerChar: 5 -}), rF = qn({ - prefix: "h", - name: "base32z", - alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769", - bitsPerChar: 5 -}), nF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - base32: GB, - base32hex: ZB, - base32hexpad: eF, - base32hexpadupper: tF, - base32hexupper: QB, - base32pad: JB, - base32padupper: XB, - base32upper: YB, - base32z: rF -}, Symbol.toStringTag, { value: "Module" })), iF = eh({ - prefix: "k", - name: "base36", - alphabet: "0123456789abcdefghijklmnopqrstuvwxyz" -}), sF = eh({ - prefix: "K", - name: "base36upper", - alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" -}), oF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - base36: iF, - base36upper: sF -}, Symbol.toStringTag, { value: "Module" })), aF = eh({ - name: "base58btc", - prefix: "z", - alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" -}), cF = eh({ - name: "base58flickr", - prefix: "Z", - alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" -}), uF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - base58btc: aF, - base58flickr: cF -}, Symbol.toStringTag, { value: "Module" })), fF = qn({ - prefix: "m", - name: "base64", - alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", - bitsPerChar: 6 -}), lF = qn({ - prefix: "M", - name: "base64pad", - alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", - bitsPerChar: 6 -}), hF = qn({ - prefix: "u", - name: "base64url", - alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", - bitsPerChar: 6 -}), dF = qn({ - prefix: "U", - name: "base64urlpad", - alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", - bitsPerChar: 6 -}), pF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - base64: fF, - base64pad: lF, - base64url: hF, - base64urlpad: dF -}, Symbol.toStringTag, { value: "Module" })), h8 = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), gF = h8.reduce((t, e, r) => (t[r] = e, t), []), mF = h8.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); -function vF(t) { - return t.reduce((e, r) => (e += gF[r], e), ""); -} -function bF(t) { - const e = []; - for (const r of t) { - const n = mF[r.codePointAt(0)]; - if (n === void 0) - throw new Error(`Non-base256emoji character: ${r}`); - e.push(n); - } - return new Uint8Array(e); -} -const yF = rp({ - prefix: "🚀", - name: "base256emoji", - encode: vF, - decode: bF -}), wF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - base256emoji: yF -}, Symbol.toStringTag, { value: "Module" })); -new TextEncoder(); -new TextDecoder(); -const bx = { - ...BB, - ...jB, - ...qB, - ...WB, - ...VB, - ...nF, - ...oF, - ...uF, - ...pF, - ...wF -}; -function d8(t, e, r, n) { - return { - name: t, - prefix: e, - encoder: { - name: t, - prefix: e, - encode: r - }, - decoder: { decode: n } - }; -} -const yx = d8("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), lm = d8("ascii", "a", (t) => { - let e = "a"; - for (let r = 0; r < t.length; r++) - e += String.fromCharCode(t[r]); - return e; -}, (t) => { - t = t.substring(1); - const e = f8(t.length); - for (let r = 0; r < t.length; r++) - e[r] = t.charCodeAt(r); - return e; -}), p8 = { - utf8: yx, - "utf-8": yx, - hex: bx.base16, - latin1: lm, - ascii: lm, - binary: lm, - ...bx -}; -function On(t, e = "utf8") { - const r = p8[e]; - if (!r) - throw new Error(`Unsupported encoding "${e}"`); - return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t.buffer, t.byteOffset, t.byteLength).toString("utf8") : r.encoder.encode(t).substring(1); -} -function Rn(t, e = "utf8") { - const r = p8[e]; - if (!r) - throw new Error(`Unsupported encoding "${e}"`); - return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t, "utf8") : r.decoder.decode(`${r.prefix}${t}`); -} -function wx(t) { - return bc(On(Rn(t, tp), c8)); -} -function d0(t) { - return On(Rn(jo(t), c8), tp); -} -function g8(t) { - const e = Rn(EB, vx), r = _B + On(kd([e, t]), vx); - return [wB, xB, r].join(yB); -} -function xF(t) { - return On(t, tp); -} -function _F(t) { - return Rn(t, tp); -} -function EF(t) { - return Rn([d0(t.header), d0(t.payload)].join(h0), u8); -} -function SF(t) { - return [ - d0(t.header), - d0(t.payload), - xF(t.signature) - ].join(h0); -} -function O1(t) { - const e = t.split(h0), r = wx(e[0]), n = wx(e[1]), i = _F(e[2]), s = Rn(e.slice(0, 2).join(h0), u8); - return { header: r, payload: n, signature: i, data: s }; -} -function xx(t = Da.randomBytes(SB)) { - return Qv.generateKeyPairFromSeed(t); -} -async function AF(t, e, r, n, i = vt.fromMiliseconds(Date.now())) { - const s = { alg: vB, typ: bB }, o = g8(n.publicKey), a = i + r, u = { iss: o, sub: t, aud: e, iat: i, exp: a }, l = EF({ header: s, payload: u }), d = Qv.sign(n.secretKey, l); - return SF({ header: s, payload: u, signature: d }); -} -var _x = function(t, e, r) { - if (r || arguments.length === 2) for (var n = 0, i = e.length, s; n < i; n++) - (s || !(n in e)) && (s || (s = Array.prototype.slice.call(e, 0, n)), s[n] = e[n]); - return t.concat(s || Array.prototype.slice.call(e)); -}, PF = ( - /** @class */ - /* @__PURE__ */ function() { - function t(e, r, n) { - this.name = e, this.version = r, this.os = n, this.type = "browser"; - } - return t; - }() -), MF = ( - /** @class */ - /* @__PURE__ */ function() { - function t(e) { - this.version = e, this.type = "node", this.name = "node", this.os = process.platform; - } - return t; - }() -), IF = ( - /** @class */ - /* @__PURE__ */ function() { - function t(e, r, n, i) { - this.name = e, this.version = r, this.os = n, this.bot = i, this.type = "bot-device"; - } - return t; - }() -), CF = ( - /** @class */ - /* @__PURE__ */ function() { - function t() { - this.type = "bot", this.bot = !0, this.name = "bot", this.version = null, this.os = null; - } - return t; - }() -), TF = ( - /** @class */ - /* @__PURE__ */ function() { - function t() { - this.type = "react-native", this.name = "react-native", this.version = null, this.os = null; - } - return t; - }() -), RF = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/, DF = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/, Ex = 3, OF = [ - ["aol", /AOLShield\/([0-9\._]+)/], - ["edge", /Edge\/([0-9\._]+)/], - ["edge-ios", /EdgiOS\/([0-9\._]+)/], - ["yandexbrowser", /YaBrowser\/([0-9\._]+)/], - ["kakaotalk", /KAKAOTALK\s([0-9\.]+)/], - ["samsung", /SamsungBrowser\/([0-9\.]+)/], - ["silk", /\bSilk\/([0-9._-]+)\b/], - ["miui", /MiuiBrowser\/([0-9\.]+)$/], - ["beaker", /BeakerBrowser\/([0-9\.]+)/], - ["edge-chromium", /EdgA?\/([0-9\.]+)/], - [ - "chromium-webview", - /(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/ - ], - ["chrome", /(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/], - ["phantomjs", /PhantomJS\/([0-9\.]+)(:?\s|$)/], - ["crios", /CriOS\/([0-9\.]+)(:?\s|$)/], - ["firefox", /Firefox\/([0-9\.]+)(?:\s|$)/], - ["fxios", /FxiOS\/([0-9\.]+)/], - ["opera-mini", /Opera Mini.*Version\/([0-9\.]+)/], - ["opera", /Opera\/([0-9\.]+)(?:\s|$)/], - ["opera", /OPR\/([0-9\.]+)(:?\s|$)/], - ["pie", /^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/], - ["pie", /^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/], - ["netfront", /^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/], - ["ie", /Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/], - ["ie", /MSIE\s([0-9\.]+);.*Trident\/[4-7].0/], - ["ie", /MSIE\s(7\.0)/], - ["bb10", /BB10;\sTouch.*Version\/([0-9\.]+)/], - ["android", /Android\s([0-9\.]+)/], - ["ios", /Version\/([0-9\._]+).*Mobile.*Safari.*/], - ["safari", /Version\/([0-9\._]+).*Safari/], - ["facebook", /FB[AS]V\/([0-9\.]+)/], - ["instagram", /Instagram\s([0-9\.]+)/], - ["ios-webview", /AppleWebKit\/([0-9\.]+).*Mobile/], - ["ios-webview", /AppleWebKit\/([0-9\.]+).*Gecko\)$/], - ["curl", /^curl\/([0-9\.]+)$/], - ["searchbot", RF] -], Sx = [ - ["iOS", /iP(hone|od|ad)/], - ["Android OS", /Android/], - ["BlackBerry OS", /BlackBerry|BB10/], - ["Windows Mobile", /IEMobile/], - ["Amazon OS", /Kindle/], - ["Windows 3.11", /Win16/], - ["Windows 95", /(Windows 95)|(Win95)|(Windows_95)/], - ["Windows 98", /(Windows 98)|(Win98)/], - ["Windows 2000", /(Windows NT 5.0)|(Windows 2000)/], - ["Windows XP", /(Windows NT 5.1)|(Windows XP)/], - ["Windows Server 2003", /(Windows NT 5.2)/], - ["Windows Vista", /(Windows NT 6.0)/], - ["Windows 7", /(Windows NT 6.1)/], - ["Windows 8", /(Windows NT 6.2)/], - ["Windows 8.1", /(Windows NT 6.3)/], - ["Windows 10", /(Windows NT 10.0)/], - ["Windows ME", /Windows ME/], - ["Windows CE", /Windows CE|WinCE|Microsoft Pocket Internet Explorer/], - ["Open BSD", /OpenBSD/], - ["Sun OS", /SunOS/], - ["Chrome OS", /CrOS/], - ["Linux", /(Linux)|(X11)/], - ["Mac OS", /(Mac_PowerPC)|(Macintosh)/], - ["QNX", /QNX/], - ["BeOS", /BeOS/], - ["OS/2", /OS\/2/] -]; -function NF(t) { - return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative" ? new TF() : typeof navigator < "u" ? kF(navigator.userAgent) : BF(); -} -function LF(t) { - return t !== "" && OF.reduce(function(e, r) { - var n = r[0], i = r[1]; - if (e) - return e; - var s = i.exec(t); - return !!s && [n, s]; - }, !1); -} -function kF(t) { - var e = LF(t); - if (!e) - return null; - var r = e[0], n = e[1]; - if (r === "searchbot") - return new CF(); - var i = n[1] && n[1].split(".").join("_").split("_").slice(0, 3); - i ? i.length < Ex && (i = _x(_x([], i, !0), FF(Ex - i.length), !0)) : i = []; - var s = i.join("."), o = $F(t), a = DF.exec(t); - return a && a[1] ? new IF(r, s, o, a[1]) : new PF(r, s, o); -} -function $F(t) { - for (var e = 0, r = Sx.length; e < r; e++) { - var n = Sx[e], i = n[0], s = n[1], o = s.exec(t); - if (o) - return i; - } - return null; -} -function BF() { - var t = typeof process < "u" && process.version; - return t ? new MF(process.version.slice(1)) : null; -} -function FF(t) { - for (var e = [], r = 0; r < t; r++) - e.push("0"); - return e; -} -var Wr = {}; -Object.defineProperty(Wr, "__esModule", { value: !0 }); -Wr.getLocalStorage = Wr.getLocalStorageOrThrow = Wr.getCrypto = Wr.getCryptoOrThrow = m8 = Wr.getLocation = Wr.getLocationOrThrow = eb = Wr.getNavigator = Wr.getNavigatorOrThrow = th = Wr.getDocument = Wr.getDocumentOrThrow = Wr.getFromWindowOrThrow = Wr.getFromWindow = void 0; -function Cc(t) { - let e; - return typeof window < "u" && typeof window[t] < "u" && (e = window[t]), e; -} -Wr.getFromWindow = Cc; -function qu(t) { - const e = Cc(t); - if (!e) - throw new Error(`${t} is not defined in Window`); - return e; -} -Wr.getFromWindowOrThrow = qu; -function jF() { - return qu("document"); -} -Wr.getDocumentOrThrow = jF; -function UF() { - return Cc("document"); -} -var th = Wr.getDocument = UF; -function qF() { - return qu("navigator"); -} -Wr.getNavigatorOrThrow = qF; -function zF() { - return Cc("navigator"); -} -var eb = Wr.getNavigator = zF; -function WF() { - return qu("location"); -} -Wr.getLocationOrThrow = WF; -function HF() { - return Cc("location"); -} -var m8 = Wr.getLocation = HF; -function KF() { - return qu("crypto"); -} -Wr.getCryptoOrThrow = KF; -function VF() { - return Cc("crypto"); -} -Wr.getCrypto = VF; -function GF() { - return qu("localStorage"); -} -Wr.getLocalStorageOrThrow = GF; -function YF() { - return Cc("localStorage"); -} -Wr.getLocalStorage = YF; -var tb = {}; -Object.defineProperty(tb, "__esModule", { value: !0 }); -var v8 = tb.getWindowMetadata = void 0; -const Ax = Wr; -function JF() { - let t, e; - try { - t = Ax.getDocumentOrThrow(), e = Ax.getLocationOrThrow(); - } catch { - return null; - } - function r() { - const p = t.getElementsByTagName("link"), w = []; - for (let _ = 0; _ < p.length; _++) { - const P = p[_], O = P.getAttribute("rel"); - if (O && O.toLowerCase().indexOf("icon") > -1) { - const L = P.getAttribute("href"); - if (L) - if (L.toLowerCase().indexOf("https:") === -1 && L.toLowerCase().indexOf("http:") === -1 && L.indexOf("//") !== 0) { - let B = e.protocol + "//" + e.host; - if (L.indexOf("/") === 0) - B += L; - else { - const k = e.pathname.split("/"); - k.pop(); - const W = k.join("/"); - B += W + "/" + L; - } - w.push(B); - } else if (L.indexOf("//") === 0) { - const B = e.protocol + L; - w.push(B); - } else - w.push(L); - } - } - return w; - } - function n(...p) { - const w = t.getElementsByTagName("meta"); - for (let _ = 0; _ < w.length; _++) { - const P = w[_], O = ["itemprop", "property", "name"].map((L) => P.getAttribute(L)).filter((L) => L ? p.includes(L) : !1); - if (O.length && O) { - const L = P.getAttribute("content"); - if (L) - return L; - } - } - return ""; - } - function i() { - let p = n("name", "og:site_name", "og:title", "twitter:title"); - return p || (p = t.title), p; - } - function s() { - return n("description", "og:description", "twitter:description", "keywords"); - } - const o = i(), a = s(), u = e.origin, l = r(); - return { - description: a, - url: u, - icons: l, - name: o - }; -} -v8 = tb.getWindowMetadata = JF; -var Dl = {}, XF = (t) => encodeURIComponent(t).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), b8 = "%[a-f0-9]{2}", Px = new RegExp("(" + b8 + ")|([^%]+?)", "gi"), Mx = new RegExp("(" + b8 + ")+", "gi"); -function N1(t, e) { - try { - return [decodeURIComponent(t.join(""))]; - } catch { - } - if (t.length === 1) - return t; - e = e || 1; - var r = t.slice(0, e), n = t.slice(e); - return Array.prototype.concat.call([], N1(r), N1(n)); -} -function ZF(t) { - try { - return decodeURIComponent(t); - } catch { - for (var e = t.match(Px) || [], r = 1; r < e.length; r++) - t = N1(e, r).join(""), e = t.match(Px) || []; - return t; - } -} -function QF(t) { - for (var e = { - "%FE%FF": "��", - "%FF%FE": "��" - }, r = Mx.exec(t); r; ) { - try { - e[r[0]] = decodeURIComponent(r[0]); - } catch { - var n = ZF(r[0]); - n !== r[0] && (e[r[0]] = n); - } - r = Mx.exec(t); - } - e["%C2"] = "�"; - for (var i = Object.keys(e), s = 0; s < i.length; s++) { - var o = i[s]; - t = t.replace(new RegExp(o, "g"), e[o]); - } - return t; -} -var ej = function(t) { - if (typeof t != "string") - throw new TypeError("Expected `encodedURI` to be of type `string`, got `" + typeof t + "`"); - try { - return t = t.replace(/\+/g, " "), decodeURIComponent(t); - } catch { - return QF(t); - } -}, tj = (t, e) => { - if (!(typeof t == "string" && typeof e == "string")) - throw new TypeError("Expected the arguments to be of type `string`"); - if (e === "") - return [t]; - const r = t.indexOf(e); - return r === -1 ? [t] : [ - t.slice(0, r), - t.slice(r + e.length) - ]; -}, rj = function(t, e) { - for (var r = {}, n = Object.keys(t), i = Array.isArray(e), s = 0; s < n.length; s++) { - var o = n[s], a = t[o]; - (i ? e.indexOf(o) !== -1 : e(o, a, t)) && (r[o] = a); - } - return r; -}; -(function(t) { - const e = XF, r = ej, n = tj, i = rj, s = (k) => k == null, o = Symbol("encodeFragmentIdentifier"); - function a(k) { - switch (k.arrayFormat) { - case "index": - return (W) => (U, V) => { - const Q = U.length; - return V === void 0 || k.skipNull && V === null || k.skipEmptyString && V === "" ? U : V === null ? [...U, [d(W, k), "[", Q, "]"].join("")] : [ - ...U, - [d(W, k), "[", d(Q, k), "]=", d(V, k)].join("") - ]; - }; - case "bracket": - return (W) => (U, V) => V === void 0 || k.skipNull && V === null || k.skipEmptyString && V === "" ? U : V === null ? [...U, [d(W, k), "[]"].join("")] : [...U, [d(W, k), "[]=", d(V, k)].join("")]; - case "colon-list-separator": - return (W) => (U, V) => V === void 0 || k.skipNull && V === null || k.skipEmptyString && V === "" ? U : V === null ? [...U, [d(W, k), ":list="].join("")] : [...U, [d(W, k), ":list=", d(V, k)].join("")]; - case "comma": - case "separator": - case "bracket-separator": { - const W = k.arrayFormat === "bracket-separator" ? "[]=" : "="; - return (U) => (V, Q) => Q === void 0 || k.skipNull && Q === null || k.skipEmptyString && Q === "" ? V : (Q = Q === null ? "" : Q, V.length === 0 ? [[d(U, k), W, d(Q, k)].join("")] : [[V, d(Q, k)].join(k.arrayFormatSeparator)]); - } - default: - return (W) => (U, V) => V === void 0 || k.skipNull && V === null || k.skipEmptyString && V === "" ? U : V === null ? [...U, d(W, k)] : [...U, [d(W, k), "=", d(V, k)].join("")]; - } - } - function u(k) { - let W; - switch (k.arrayFormat) { - case "index": - return (U, V, Q) => { - if (W = /\[(\d*)\]$/.exec(U), U = U.replace(/\[\d*\]$/, ""), !W) { - Q[U] = V; - return; - } - Q[U] === void 0 && (Q[U] = {}), Q[U][W[1]] = V; - }; - case "bracket": - return (U, V, Q) => { - if (W = /(\[\])$/.exec(U), U = U.replace(/\[\]$/, ""), !W) { - Q[U] = V; - return; - } - if (Q[U] === void 0) { - Q[U] = [V]; - return; - } - Q[U] = [].concat(Q[U], V); - }; - case "colon-list-separator": - return (U, V, Q) => { - if (W = /(:list)$/.exec(U), U = U.replace(/:list$/, ""), !W) { - Q[U] = V; - return; - } - if (Q[U] === void 0) { - Q[U] = [V]; - return; - } - Q[U] = [].concat(Q[U], V); - }; - case "comma": - case "separator": - return (U, V, Q) => { - const R = typeof V == "string" && V.includes(k.arrayFormatSeparator), K = typeof V == "string" && !R && p(V, k).includes(k.arrayFormatSeparator); - V = K ? p(V, k) : V; - const ge = R || K ? V.split(k.arrayFormatSeparator).map((Ee) => p(Ee, k)) : V === null ? V : p(V, k); - Q[U] = ge; - }; - case "bracket-separator": - return (U, V, Q) => { - const R = /(\[\])$/.test(U); - if (U = U.replace(/\[\]$/, ""), !R) { - Q[U] = V && p(V, k); - return; - } - const K = V === null ? [] : V.split(k.arrayFormatSeparator).map((ge) => p(ge, k)); - if (Q[U] === void 0) { - Q[U] = K; - return; - } - Q[U] = [].concat(Q[U], K); - }; - default: - return (U, V, Q) => { - if (Q[U] === void 0) { - Q[U] = V; - return; - } - Q[U] = [].concat(Q[U], V); - }; - } - } - function l(k) { - if (typeof k != "string" || k.length !== 1) - throw new TypeError("arrayFormatSeparator must be single character string"); - } - function d(k, W) { - return W.encode ? W.strict ? e(k) : encodeURIComponent(k) : k; - } - function p(k, W) { - return W.decode ? r(k) : k; - } - function w(k) { - return Array.isArray(k) ? k.sort() : typeof k == "object" ? w(Object.keys(k)).sort((W, U) => Number(W) - Number(U)).map((W) => k[W]) : k; - } - function _(k) { - const W = k.indexOf("#"); - return W !== -1 && (k = k.slice(0, W)), k; - } - function P(k) { - let W = ""; - const U = k.indexOf("#"); - return U !== -1 && (W = k.slice(U)), W; - } - function O(k) { - k = _(k); - const W = k.indexOf("?"); - return W === -1 ? "" : k.slice(W + 1); - } - function L(k, W) { - return W.parseNumbers && !Number.isNaN(Number(k)) && typeof k == "string" && k.trim() !== "" ? k = Number(k) : W.parseBooleans && k !== null && (k.toLowerCase() === "true" || k.toLowerCase() === "false") && (k = k.toLowerCase() === "true"), k; - } - function B(k, W) { - W = Object.assign({ - decode: !0, - sort: !0, - arrayFormat: "none", - arrayFormatSeparator: ",", - parseNumbers: !1, - parseBooleans: !1 - }, W), l(W.arrayFormatSeparator); - const U = u(W), V = /* @__PURE__ */ Object.create(null); - if (typeof k != "string" || (k = k.trim().replace(/^[?#&]/, ""), !k)) - return V; - for (const Q of k.split("&")) { - if (Q === "") - continue; - let [R, K] = n(W.decode ? Q.replace(/\+/g, " ") : Q, "="); - K = K === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(W.arrayFormat) ? K : p(K, W), U(p(R, W), K, V); - } - for (const Q of Object.keys(V)) { - const R = V[Q]; - if (typeof R == "object" && R !== null) - for (const K of Object.keys(R)) - R[K] = L(R[K], W); - else - V[Q] = L(R, W); - } - return W.sort === !1 ? V : (W.sort === !0 ? Object.keys(V).sort() : Object.keys(V).sort(W.sort)).reduce((Q, R) => { - const K = V[R]; - return K && typeof K == "object" && !Array.isArray(K) ? Q[R] = w(K) : Q[R] = K, Q; - }, /* @__PURE__ */ Object.create(null)); - } - t.extract = O, t.parse = B, t.stringify = (k, W) => { - if (!k) - return ""; - W = Object.assign({ - encode: !0, - strict: !0, - arrayFormat: "none", - arrayFormatSeparator: "," - }, W), l(W.arrayFormatSeparator); - const U = (K) => W.skipNull && s(k[K]) || W.skipEmptyString && k[K] === "", V = a(W), Q = {}; - for (const K of Object.keys(k)) - U(K) || (Q[K] = k[K]); - const R = Object.keys(Q); - return W.sort !== !1 && R.sort(W.sort), R.map((K) => { - const ge = k[K]; - return ge === void 0 ? "" : ge === null ? d(K, W) : Array.isArray(ge) ? ge.length === 0 && W.arrayFormat === "bracket-separator" ? d(K, W) + "[]" : ge.reduce(V(K), []).join("&") : d(K, W) + "=" + d(ge, W); - }).filter((K) => K.length > 0).join("&"); - }, t.parseUrl = (k, W) => { - W = Object.assign({ - decode: !0 - }, W); - const [U, V] = n(k, "#"); - return Object.assign( - { - url: U.split("?")[0] || "", - query: B(O(k), W) - }, - W && W.parseFragmentIdentifier && V ? { fragmentIdentifier: p(V, W) } : {} - ); - }, t.stringifyUrl = (k, W) => { - W = Object.assign({ - encode: !0, - strict: !0, - [o]: !0 - }, W); - const U = _(k.url).split("?")[0] || "", V = t.extract(k.url), Q = t.parse(V, { sort: !1 }), R = Object.assign(Q, k.query); - let K = t.stringify(R, W); - K && (K = `?${K}`); - let ge = P(k.url); - return k.fragmentIdentifier && (ge = `#${W[o] ? d(k.fragmentIdentifier, W) : k.fragmentIdentifier}`), `${U}${K}${ge}`; - }, t.pick = (k, W, U) => { - U = Object.assign({ - parseFragmentIdentifier: !0, - [o]: !1 - }, U); - const { url: V, query: Q, fragmentIdentifier: R } = t.parseUrl(k, U); - return t.stringifyUrl({ - url: V, - query: i(Q, W), - fragmentIdentifier: R - }, U); - }, t.exclude = (k, W, U) => { - const V = Array.isArray(W) ? (Q) => !W.includes(Q) : (Q, R) => !W(Q, R); - return t.pick(k, V, U); - }; -})(Dl); -var y8 = { exports: {} }; -/** - * [js-sha3]{@link https://github.com/emn178/js-sha3} - * - * @version 0.8.0 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2015-2018 - * @license MIT - */ -(function(t) { - (function() { - var e = "input is invalid type", r = "finalize already called", n = typeof window == "object", i = n ? window : {}; - i.JS_SHA3_NO_WINDOW && (n = !1); - var s = !n && typeof self == "object", o = !i.JS_SHA3_NO_NODE_JS && typeof process == "object" && process.versions && process.versions.node; - o ? i = gn : s && (i = self); - var a = !i.JS_SHA3_NO_COMMON_JS && !0 && t.exports, u = !i.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", l = "0123456789abcdef".split(""), d = [31, 7936, 2031616, 520093696], p = [4, 1024, 262144, 67108864], w = [1, 256, 65536, 16777216], _ = [6, 1536, 393216, 100663296], P = [0, 8, 16, 24], O = [ - 1, - 0, - 32898, - 0, - 32906, - 2147483648, - 2147516416, - 2147483648, - 32907, - 0, - 2147483649, - 0, - 2147516545, - 2147483648, - 32777, - 2147483648, - 138, - 0, - 136, - 0, - 2147516425, - 0, - 2147483658, - 0, - 2147516555, - 0, - 139, - 2147483648, - 32905, - 2147483648, - 32771, - 2147483648, - 32770, - 2147483648, - 128, - 2147483648, - 32778, - 0, - 2147483658, - 2147483648, - 2147516545, - 2147483648, - 32896, - 2147483648, - 2147483649, - 0, - 2147516424, - 2147483648 - ], L = [224, 256, 384, 512], B = [128, 256], k = ["hex", "buffer", "arrayBuffer", "array", "digest"], W = { - 128: 168, - 256: 136 - }; - (i.JS_SHA3_NO_NODE_JS || !Array.isArray) && (Array.isArray = function(D) { - return Object.prototype.toString.call(D) === "[object Array]"; - }), u && (i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView) && (ArrayBuffer.isView = function(D) { - return typeof D == "object" && D.buffer && D.buffer.constructor === ArrayBuffer; - }); - for (var U = function(D, oe, Z) { - return function(J) { - return new I(D, oe, D).update(J)[Z](); - }; - }, V = function(D, oe, Z) { - return function(J, ee) { - return new I(D, oe, ee).update(J)[Z](); - }; - }, Q = function(D, oe, Z) { - return function(J, ee, T, X) { - return f["cshake" + D].update(J, ee, T, X)[Z](); - }; - }, R = function(D, oe, Z) { - return function(J, ee, T, X) { - return f["kmac" + D].update(J, ee, T, X)[Z](); - }; - }, K = function(D, oe, Z, J) { - for (var ee = 0; ee < k.length; ++ee) { - var T = k[ee]; - D[T] = oe(Z, J, T); - } - return D; - }, ge = function(D, oe) { - var Z = U(D, oe, "hex"); - return Z.create = function() { - return new I(D, oe, D); - }, Z.update = function(J) { - return Z.create().update(J); - }, K(Z, U, D, oe); - }, Ee = function(D, oe) { - var Z = V(D, oe, "hex"); - return Z.create = function(J) { - return new I(D, oe, J); - }, Z.update = function(J, ee) { - return Z.create(ee).update(J); - }, K(Z, V, D, oe); - }, Y = function(D, oe) { - var Z = W[D], J = Q(D, oe, "hex"); - return J.create = function(ee, T, X) { - return !T && !X ? f["shake" + D].create(ee) : new I(D, oe, ee).bytepad([T, X], Z); - }, J.update = function(ee, T, X, re) { - return J.create(T, X, re).update(ee); - }, K(J, Q, D, oe); - }, A = function(D, oe) { - var Z = W[D], J = R(D, oe, "hex"); - return J.create = function(ee, T, X) { - return new F(D, oe, T).bytepad(["KMAC", X], Z).bytepad([ee], Z); - }, J.update = function(ee, T, X, re) { - return J.create(ee, X, re).update(T); - }, K(J, R, D, oe); - }, m = [ - { name: "keccak", padding: w, bits: L, createMethod: ge }, - { name: "sha3", padding: _, bits: L, createMethod: ge }, - { name: "shake", padding: d, bits: B, createMethod: Ee }, - { name: "cshake", padding: p, bits: B, createMethod: Y }, - { name: "kmac", padding: p, bits: B, createMethod: A } - ], f = {}, g = [], b = 0; b < m.length; ++b) - for (var x = m[b], E = x.bits, S = 0; S < E.length; ++S) { - var v = x.name + "_" + E[S]; - if (g.push(v), f[v] = x.createMethod(E[S], x.padding), x.name !== "sha3") { - var M = x.name + E[S]; - g.push(M), f[M] = f[v]; - } - } - function I(D, oe, Z) { - this.blocks = [], this.s = [], this.padding = oe, this.outputBits = Z, this.reset = !0, this.finalized = !1, this.block = 0, this.start = 0, this.blockCount = 1600 - (D << 1) >> 5, this.byteCount = this.blockCount << 2, this.outputBlocks = Z >> 5, this.extraBytes = (Z & 31) >> 3; - for (var J = 0; J < 50; ++J) - this.s[J] = 0; - } - I.prototype.update = function(D) { - if (this.finalized) - throw new Error(r); - var oe, Z = typeof D; - if (Z !== "string") { - if (Z === "object") { - if (D === null) - throw new Error(e); - if (u && D.constructor === ArrayBuffer) - D = new Uint8Array(D); - else if (!Array.isArray(D) && (!u || !ArrayBuffer.isView(D))) - throw new Error(e); - } else - throw new Error(e); - oe = !0; - } - for (var J = this.blocks, ee = this.byteCount, T = D.length, X = this.blockCount, re = 0, pe = this.s, ie, ue; re < T; ) { - if (this.reset) - for (this.reset = !1, J[0] = this.block, ie = 1; ie < X + 1; ++ie) - J[ie] = 0; - if (oe) - for (ie = this.start; re < T && ie < ee; ++re) - J[ie >> 2] |= D[re] << P[ie++ & 3]; - else - for (ie = this.start; re < T && ie < ee; ++re) - ue = D.charCodeAt(re), ue < 128 ? J[ie >> 2] |= ue << P[ie++ & 3] : ue < 2048 ? (J[ie >> 2] |= (192 | ue >> 6) << P[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << P[ie++ & 3]) : ue < 55296 || ue >= 57344 ? (J[ie >> 2] |= (224 | ue >> 12) << P[ie++ & 3], J[ie >> 2] |= (128 | ue >> 6 & 63) << P[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << P[ie++ & 3]) : (ue = 65536 + ((ue & 1023) << 10 | D.charCodeAt(++re) & 1023), J[ie >> 2] |= (240 | ue >> 18) << P[ie++ & 3], J[ie >> 2] |= (128 | ue >> 12 & 63) << P[ie++ & 3], J[ie >> 2] |= (128 | ue >> 6 & 63) << P[ie++ & 3], J[ie >> 2] |= (128 | ue & 63) << P[ie++ & 3]); - if (this.lastByteIndex = ie, ie >= ee) { - for (this.start = ie - ee, this.block = J[X], ie = 0; ie < X; ++ie) - pe[ie] ^= J[ie]; - ce(pe), this.reset = !0; - } else - this.start = ie; - } - return this; - }, I.prototype.encode = function(D, oe) { - var Z = D & 255, J = 1, ee = [Z]; - for (D = D >> 8, Z = D & 255; Z > 0; ) - ee.unshift(Z), D = D >> 8, Z = D & 255, ++J; - return oe ? ee.push(J) : ee.unshift(J), this.update(ee), ee.length; - }, I.prototype.encodeString = function(D) { - var oe, Z = typeof D; - if (Z !== "string") { - if (Z === "object") { - if (D === null) - throw new Error(e); - if (u && D.constructor === ArrayBuffer) - D = new Uint8Array(D); - else if (!Array.isArray(D) && (!u || !ArrayBuffer.isView(D))) - throw new Error(e); - } else - throw new Error(e); - oe = !0; - } - var J = 0, ee = D.length; - if (oe) - J = ee; - else - for (var T = 0; T < D.length; ++T) { - var X = D.charCodeAt(T); - X < 128 ? J += 1 : X < 2048 ? J += 2 : X < 55296 || X >= 57344 ? J += 3 : (X = 65536 + ((X & 1023) << 10 | D.charCodeAt(++T) & 1023), J += 4); - } - return J += this.encode(J * 8), this.update(D), J; - }, I.prototype.bytepad = function(D, oe) { - for (var Z = this.encode(oe), J = 0; J < D.length; ++J) - Z += this.encodeString(D[J]); - var ee = oe - Z % oe, T = []; - return T.length = ee, this.update(T), this; - }, I.prototype.finalize = function() { - if (!this.finalized) { - this.finalized = !0; - var D = this.blocks, oe = this.lastByteIndex, Z = this.blockCount, J = this.s; - if (D[oe >> 2] |= this.padding[oe & 3], this.lastByteIndex === this.byteCount) - for (D[0] = D[Z], oe = 1; oe < Z + 1; ++oe) - D[oe] = 0; - for (D[Z - 1] |= 2147483648, oe = 0; oe < Z; ++oe) - J[oe] ^= D[oe]; - ce(J); - } - }, I.prototype.toString = I.prototype.hex = function() { - this.finalize(); - for (var D = this.blockCount, oe = this.s, Z = this.outputBlocks, J = this.extraBytes, ee = 0, T = 0, X = "", re; T < Z; ) { - for (ee = 0; ee < D && T < Z; ++ee, ++T) - re = oe[ee], X += l[re >> 4 & 15] + l[re & 15] + l[re >> 12 & 15] + l[re >> 8 & 15] + l[re >> 20 & 15] + l[re >> 16 & 15] + l[re >> 28 & 15] + l[re >> 24 & 15]; - T % D === 0 && (ce(oe), ee = 0); - } - return J && (re = oe[ee], X += l[re >> 4 & 15] + l[re & 15], J > 1 && (X += l[re >> 12 & 15] + l[re >> 8 & 15]), J > 2 && (X += l[re >> 20 & 15] + l[re >> 16 & 15])), X; - }, I.prototype.arrayBuffer = function() { - this.finalize(); - var D = this.blockCount, oe = this.s, Z = this.outputBlocks, J = this.extraBytes, ee = 0, T = 0, X = this.outputBits >> 3, re; - J ? re = new ArrayBuffer(Z + 1 << 2) : re = new ArrayBuffer(X); - for (var pe = new Uint32Array(re); T < Z; ) { - for (ee = 0; ee < D && T < Z; ++ee, ++T) - pe[T] = oe[ee]; - T % D === 0 && ce(oe); - } - return J && (pe[ee] = oe[ee], re = re.slice(0, X)), re; - }, I.prototype.buffer = I.prototype.arrayBuffer, I.prototype.digest = I.prototype.array = function() { - this.finalize(); - for (var D = this.blockCount, oe = this.s, Z = this.outputBlocks, J = this.extraBytes, ee = 0, T = 0, X = [], re, pe; T < Z; ) { - for (ee = 0; ee < D && T < Z; ++ee, ++T) - re = T << 2, pe = oe[ee], X[re] = pe & 255, X[re + 1] = pe >> 8 & 255, X[re + 2] = pe >> 16 & 255, X[re + 3] = pe >> 24 & 255; - T % D === 0 && ce(oe); - } - return J && (re = T << 2, pe = oe[ee], X[re] = pe & 255, J > 1 && (X[re + 1] = pe >> 8 & 255), J > 2 && (X[re + 2] = pe >> 16 & 255)), X; - }; - function F(D, oe, Z) { - I.call(this, D, oe, Z); - } - F.prototype = new I(), F.prototype.finalize = function() { - return this.encode(this.outputBits, !0), I.prototype.finalize.call(this); - }; - var ce = function(D) { - var oe, Z, J, ee, T, X, re, pe, ie, ue, ve, Pe, De, Ce, $e, Me, Ne, Ke, Le, qe, ze, _e, Ze, at, ke, Qe, tt, Ye, dt, lt, ct, qt, Jt, Et, er, Xt, Dt, kt, Ct, mt, Rt, Nt, bt, $t, Ft, rt, Bt, $, q, H, C, G, j, se, de, xe, Te, Re, nt, je, pt, it, et; - for (J = 0; J < 48; J += 2) - ee = D[0] ^ D[10] ^ D[20] ^ D[30] ^ D[40], T = D[1] ^ D[11] ^ D[21] ^ D[31] ^ D[41], X = D[2] ^ D[12] ^ D[22] ^ D[32] ^ D[42], re = D[3] ^ D[13] ^ D[23] ^ D[33] ^ D[43], pe = D[4] ^ D[14] ^ D[24] ^ D[34] ^ D[44], ie = D[5] ^ D[15] ^ D[25] ^ D[35] ^ D[45], ue = D[6] ^ D[16] ^ D[26] ^ D[36] ^ D[46], ve = D[7] ^ D[17] ^ D[27] ^ D[37] ^ D[47], Pe = D[8] ^ D[18] ^ D[28] ^ D[38] ^ D[48], De = D[9] ^ D[19] ^ D[29] ^ D[39] ^ D[49], oe = Pe ^ (X << 1 | re >>> 31), Z = De ^ (re << 1 | X >>> 31), D[0] ^= oe, D[1] ^= Z, D[10] ^= oe, D[11] ^= Z, D[20] ^= oe, D[21] ^= Z, D[30] ^= oe, D[31] ^= Z, D[40] ^= oe, D[41] ^= Z, oe = ee ^ (pe << 1 | ie >>> 31), Z = T ^ (ie << 1 | pe >>> 31), D[2] ^= oe, D[3] ^= Z, D[12] ^= oe, D[13] ^= Z, D[22] ^= oe, D[23] ^= Z, D[32] ^= oe, D[33] ^= Z, D[42] ^= oe, D[43] ^= Z, oe = X ^ (ue << 1 | ve >>> 31), Z = re ^ (ve << 1 | ue >>> 31), D[4] ^= oe, D[5] ^= Z, D[14] ^= oe, D[15] ^= Z, D[24] ^= oe, D[25] ^= Z, D[34] ^= oe, D[35] ^= Z, D[44] ^= oe, D[45] ^= Z, oe = pe ^ (Pe << 1 | De >>> 31), Z = ie ^ (De << 1 | Pe >>> 31), D[6] ^= oe, D[7] ^= Z, D[16] ^= oe, D[17] ^= Z, D[26] ^= oe, D[27] ^= Z, D[36] ^= oe, D[37] ^= Z, D[46] ^= oe, D[47] ^= Z, oe = ue ^ (ee << 1 | T >>> 31), Z = ve ^ (T << 1 | ee >>> 31), D[8] ^= oe, D[9] ^= Z, D[18] ^= oe, D[19] ^= Z, D[28] ^= oe, D[29] ^= Z, D[38] ^= oe, D[39] ^= Z, D[48] ^= oe, D[49] ^= Z, Ce = D[0], $e = D[1], rt = D[11] << 4 | D[10] >>> 28, Bt = D[10] << 4 | D[11] >>> 28, Ye = D[20] << 3 | D[21] >>> 29, dt = D[21] << 3 | D[20] >>> 29, je = D[31] << 9 | D[30] >>> 23, pt = D[30] << 9 | D[31] >>> 23, Nt = D[40] << 18 | D[41] >>> 14, bt = D[41] << 18 | D[40] >>> 14, Et = D[2] << 1 | D[3] >>> 31, er = D[3] << 1 | D[2] >>> 31, Me = D[13] << 12 | D[12] >>> 20, Ne = D[12] << 12 | D[13] >>> 20, $ = D[22] << 10 | D[23] >>> 22, q = D[23] << 10 | D[22] >>> 22, lt = D[33] << 13 | D[32] >>> 19, ct = D[32] << 13 | D[33] >>> 19, it = D[42] << 2 | D[43] >>> 30, et = D[43] << 2 | D[42] >>> 30, se = D[5] << 30 | D[4] >>> 2, de = D[4] << 30 | D[5] >>> 2, Xt = D[14] << 6 | D[15] >>> 26, Dt = D[15] << 6 | D[14] >>> 26, Ke = D[25] << 11 | D[24] >>> 21, Le = D[24] << 11 | D[25] >>> 21, H = D[34] << 15 | D[35] >>> 17, C = D[35] << 15 | D[34] >>> 17, qt = D[45] << 29 | D[44] >>> 3, Jt = D[44] << 29 | D[45] >>> 3, at = D[6] << 28 | D[7] >>> 4, ke = D[7] << 28 | D[6] >>> 4, xe = D[17] << 23 | D[16] >>> 9, Te = D[16] << 23 | D[17] >>> 9, kt = D[26] << 25 | D[27] >>> 7, Ct = D[27] << 25 | D[26] >>> 7, qe = D[36] << 21 | D[37] >>> 11, ze = D[37] << 21 | D[36] >>> 11, G = D[47] << 24 | D[46] >>> 8, j = D[46] << 24 | D[47] >>> 8, $t = D[8] << 27 | D[9] >>> 5, Ft = D[9] << 27 | D[8] >>> 5, Qe = D[18] << 20 | D[19] >>> 12, tt = D[19] << 20 | D[18] >>> 12, Re = D[29] << 7 | D[28] >>> 25, nt = D[28] << 7 | D[29] >>> 25, mt = D[38] << 8 | D[39] >>> 24, Rt = D[39] << 8 | D[38] >>> 24, _e = D[48] << 14 | D[49] >>> 18, Ze = D[49] << 14 | D[48] >>> 18, D[0] = Ce ^ ~Me & Ke, D[1] = $e ^ ~Ne & Le, D[10] = at ^ ~Qe & Ye, D[11] = ke ^ ~tt & dt, D[20] = Et ^ ~Xt & kt, D[21] = er ^ ~Dt & Ct, D[30] = $t ^ ~rt & $, D[31] = Ft ^ ~Bt & q, D[40] = se ^ ~xe & Re, D[41] = de ^ ~Te & nt, D[2] = Me ^ ~Ke & qe, D[3] = Ne ^ ~Le & ze, D[12] = Qe ^ ~Ye & lt, D[13] = tt ^ ~dt & ct, D[22] = Xt ^ ~kt & mt, D[23] = Dt ^ ~Ct & Rt, D[32] = rt ^ ~$ & H, D[33] = Bt ^ ~q & C, D[42] = xe ^ ~Re & je, D[43] = Te ^ ~nt & pt, D[4] = Ke ^ ~qe & _e, D[5] = Le ^ ~ze & Ze, D[14] = Ye ^ ~lt & qt, D[15] = dt ^ ~ct & Jt, D[24] = kt ^ ~mt & Nt, D[25] = Ct ^ ~Rt & bt, D[34] = $ ^ ~H & G, D[35] = q ^ ~C & j, D[44] = Re ^ ~je & it, D[45] = nt ^ ~pt & et, D[6] = qe ^ ~_e & Ce, D[7] = ze ^ ~Ze & $e, D[16] = lt ^ ~qt & at, D[17] = ct ^ ~Jt & ke, D[26] = mt ^ ~Nt & Et, D[27] = Rt ^ ~bt & er, D[36] = H ^ ~G & $t, D[37] = C ^ ~j & Ft, D[46] = je ^ ~it & se, D[47] = pt ^ ~et & de, D[8] = _e ^ ~Ce & Me, D[9] = Ze ^ ~$e & Ne, D[18] = qt ^ ~at & Qe, D[19] = Jt ^ ~ke & tt, D[28] = Nt ^ ~Et & Xt, D[29] = bt ^ ~er & Dt, D[38] = G ^ ~$t & rt, D[39] = j ^ ~Ft & Bt, D[48] = it ^ ~se & xe, D[49] = et ^ ~de & Te, D[0] ^= O[J], D[1] ^= O[J + 1]; - }; - if (a) - t.exports = f; - else - for (b = 0; b < g.length; ++b) - i[g[b]] = f[g[b]]; - })(); -})(y8); -var nj = y8.exports; -const ij = /* @__PURE__ */ ns(nj), sj = "logger/5.7.0"; -let Ix = !1, Cx = !1; -const $d = { debug: 1, default: 2, info: 2, warning: 3, error: 4, off: 5 }; -let Tx = $d.default, hm = null; -function oj() { - try { - const t = []; - if (["NFD", "NFC", "NFKD", "NFKC"].forEach((e) => { - try { - if ("test".normalize(e) !== "test") - throw new Error("bad normalize"); - } catch { - t.push(e); - } - }), t.length) - throw new Error("missing " + t.join(", ")); - if ("é".normalize("NFD") !== "é") - throw new Error("broken implementation"); - } catch (t) { - return t.message; - } - return null; -} -const Rx = oj(); -var L1; -(function(t) { - t.DEBUG = "DEBUG", t.INFO = "INFO", t.WARNING = "WARNING", t.ERROR = "ERROR", t.OFF = "OFF"; -})(L1 || (L1 = {})); -var Es; -(function(t) { - t.UNKNOWN_ERROR = "UNKNOWN_ERROR", t.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", t.UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION", t.NETWORK_ERROR = "NETWORK_ERROR", t.SERVER_ERROR = "SERVER_ERROR", t.TIMEOUT = "TIMEOUT", t.BUFFER_OVERRUN = "BUFFER_OVERRUN", t.NUMERIC_FAULT = "NUMERIC_FAULT", t.MISSING_NEW = "MISSING_NEW", t.INVALID_ARGUMENT = "INVALID_ARGUMENT", t.MISSING_ARGUMENT = "MISSING_ARGUMENT", t.UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT", t.CALL_EXCEPTION = "CALL_EXCEPTION", t.INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS", t.NONCE_EXPIRED = "NONCE_EXPIRED", t.REPLACEMENT_UNDERPRICED = "REPLACEMENT_UNDERPRICED", t.UNPREDICTABLE_GAS_LIMIT = "UNPREDICTABLE_GAS_LIMIT", t.TRANSACTION_REPLACED = "TRANSACTION_REPLACED", t.ACTION_REJECTED = "ACTION_REJECTED"; -})(Es || (Es = {})); -const Dx = "0123456789abcdef"; -class Yr { - constructor(e) { - Object.defineProperty(this, "version", { - enumerable: !0, - value: e, - writable: !1 - }); - } - _log(e, r) { - const n = e.toLowerCase(); - $d[n] == null && this.throwArgumentError("invalid log level name", "logLevel", e), !(Tx > $d[n]) && console.log.apply(console, r); - } - debug(...e) { - this._log(Yr.levels.DEBUG, e); - } - info(...e) { - this._log(Yr.levels.INFO, e); - } - warn(...e) { - this._log(Yr.levels.WARNING, e); - } - makeError(e, r, n) { - if (Cx) - return this.makeError("censored error", r, {}); - r || (r = Yr.errors.UNKNOWN_ERROR), n || (n = {}); - const i = []; - Object.keys(n).forEach((u) => { - const l = n[u]; - try { - if (l instanceof Uint8Array) { - let d = ""; - for (let p = 0; p < l.length; p++) - d += Dx[l[p] >> 4], d += Dx[l[p] & 15]; - i.push(u + "=Uint8Array(0x" + d + ")"); - } else - i.push(u + "=" + JSON.stringify(l)); - } catch { - i.push(u + "=" + JSON.stringify(n[u].toString())); - } - }), i.push(`code=${r}`), i.push(`version=${this.version}`); - const s = e; - let o = ""; - switch (r) { - case Es.NUMERIC_FAULT: { - o = "NUMERIC_FAULT"; - const u = e; - switch (u) { - case "overflow": - case "underflow": - case "division-by-zero": - o += "-" + u; - break; - case "negative-power": - case "negative-width": - o += "-unsupported"; - break; - case "unbound-bitwise-result": - o += "-unbound-result"; - break; - } - break; - } - case Es.CALL_EXCEPTION: - case Es.INSUFFICIENT_FUNDS: - case Es.MISSING_NEW: - case Es.NONCE_EXPIRED: - case Es.REPLACEMENT_UNDERPRICED: - case Es.TRANSACTION_REPLACED: - case Es.UNPREDICTABLE_GAS_LIMIT: - o = r; - break; - } - o && (e += " [ See: https://links.ethers.org/v5-errors-" + o + " ]"), i.length && (e += " (" + i.join(", ") + ")"); - const a = new Error(e); - return a.reason = s, a.code = r, Object.keys(n).forEach(function(u) { - a[u] = n[u]; - }), a; - } - throwError(e, r, n) { - throw this.makeError(e, r, n); - } - throwArgumentError(e, r, n) { - return this.throwError(e, Yr.errors.INVALID_ARGUMENT, { - argument: r, - value: n - }); - } - assert(e, r, n, i) { - e || this.throwError(r, n, i); - } - assertArgument(e, r, n, i) { - e || this.throwArgumentError(r, n, i); - } - checkNormalize(e) { - Rx && this.throwError("platform missing String.prototype.normalize", Yr.errors.UNSUPPORTED_OPERATION, { - operation: "String.prototype.normalize", - form: Rx - }); - } - checkSafeUint53(e, r) { - typeof e == "number" && (r == null && (r = "value not safe"), (e < 0 || e >= 9007199254740991) && this.throwError(r, Yr.errors.NUMERIC_FAULT, { - operation: "checkSafeInteger", - fault: "out-of-safe-range", - value: e - }), e % 1 && this.throwError(r, Yr.errors.NUMERIC_FAULT, { - operation: "checkSafeInteger", - fault: "non-integer", - value: e - })); - } - checkArgumentCount(e, r, n) { - n ? n = ": " + n : n = "", e < r && this.throwError("missing argument" + n, Yr.errors.MISSING_ARGUMENT, { - count: e, - expectedCount: r - }), e > r && this.throwError("too many arguments" + n, Yr.errors.UNEXPECTED_ARGUMENT, { - count: e, - expectedCount: r - }); - } - checkNew(e, r) { - (e === Object || e == null) && this.throwError("missing new", Yr.errors.MISSING_NEW, { name: r.name }); - } - checkAbstract(e, r) { - e === r ? this.throwError("cannot instantiate abstract class " + JSON.stringify(r.name) + " directly; use a sub-class", Yr.errors.UNSUPPORTED_OPERATION, { name: e.name, operation: "new" }) : (e === Object || e == null) && this.throwError("missing new", Yr.errors.MISSING_NEW, { name: r.name }); - } - static globalLogger() { - return hm || (hm = new Yr(sj)), hm; - } - static setCensorship(e, r) { - if (!e && r && this.globalLogger().throwError("cannot permanently disable censorship", Yr.errors.UNSUPPORTED_OPERATION, { - operation: "setCensorship" - }), Ix) { - if (!e) - return; - this.globalLogger().throwError("error censorship permanent", Yr.errors.UNSUPPORTED_OPERATION, { - operation: "setCensorship" - }); - } - Cx = !!e, Ix = !!r; - } - static setLogLevel(e) { - const r = $d[e.toLowerCase()]; - if (r == null) { - Yr.globalLogger().warn("invalid log level - " + e); - return; - } - Tx = r; - } - static from(e) { - return new Yr(e); - } -} -Yr.errors = Es; -Yr.levels = L1; -const aj = "bytes/5.7.0", hn = new Yr(aj); -function w8(t) { - return !!t.toHexString; -} -function xu(t) { - return t.slice || (t.slice = function() { - const e = Array.prototype.slice.call(arguments); - return xu(new Uint8Array(Array.prototype.slice.apply(t, e))); - }), t; -} -function cj(t) { - return Ks(t) && !(t.length % 2) || rb(t); -} -function Ox(t) { - return typeof t == "number" && t == t && t % 1 === 0; -} -function rb(t) { - if (t == null) - return !1; - if (t.constructor === Uint8Array) - return !0; - if (typeof t == "string" || !Ox(t.length) || t.length < 0) - return !1; - for (let e = 0; e < t.length; e++) { - const r = t[e]; - if (!Ox(r) || r < 0 || r >= 256) - return !1; - } - return !0; -} -function wn(t, e) { - if (e || (e = {}), typeof t == "number") { - hn.checkSafeUint53(t, "invalid arrayify value"); - const r = []; - for (; t; ) - r.unshift(t & 255), t = parseInt(String(t / 256)); - return r.length === 0 && r.push(0), xu(new Uint8Array(r)); - } - if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), w8(t) && (t = t.toHexString()), Ks(t)) { - let r = t.substring(2); - r.length % 2 && (e.hexPad === "left" ? r = "0" + r : e.hexPad === "right" ? r += "0" : hn.throwArgumentError("hex data is odd-length", "value", t)); - const n = []; - for (let i = 0; i < r.length; i += 2) - n.push(parseInt(r.substring(i, i + 2), 16)); - return xu(new Uint8Array(n)); - } - return rb(t) ? xu(new Uint8Array(t)) : hn.throwArgumentError("invalid arrayify value", "value", t); -} -function uj(t) { - const e = t.map((i) => wn(i)), r = e.reduce((i, s) => i + s.length, 0), n = new Uint8Array(r); - return e.reduce((i, s) => (n.set(s, i), i + s.length), 0), xu(n); -} -function fj(t, e) { - t = wn(t), t.length > e && hn.throwArgumentError("value out of range", "value", arguments[0]); - const r = new Uint8Array(e); - return r.set(t, e - t.length), xu(r); -} -function Ks(t, e) { - return !(typeof t != "string" || !t.match(/^0x[0-9A-Fa-f]*$/) || e && t.length !== 2 + 2 * e); -} -const dm = "0123456789abcdef"; -function Di(t, e) { - if (e || (e = {}), typeof t == "number") { - hn.checkSafeUint53(t, "invalid hexlify value"); - let r = ""; - for (; t; ) - r = dm[t & 15] + r, t = Math.floor(t / 16); - return r.length ? (r.length % 2 && (r = "0" + r), "0x" + r) : "0x00"; - } - if (typeof t == "bigint") - return t = t.toString(16), t.length % 2 ? "0x0" + t : "0x" + t; - if (e.allowMissingPrefix && typeof t == "string" && t.substring(0, 2) !== "0x" && (t = "0x" + t), w8(t)) - return t.toHexString(); - if (Ks(t)) - return t.length % 2 && (e.hexPad === "left" ? t = "0x0" + t.substring(2) : e.hexPad === "right" ? t += "0" : hn.throwArgumentError("hex data is odd-length", "value", t)), t.toLowerCase(); - if (rb(t)) { - let r = "0x"; - for (let n = 0; n < t.length; n++) { - let i = t[n]; - r += dm[(i & 240) >> 4] + dm[i & 15]; - } - return r; - } - return hn.throwArgumentError("invalid hexlify value", "value", t); -} -function lj(t) { - if (typeof t != "string") - t = Di(t); - else if (!Ks(t) || t.length % 2) - return null; - return (t.length - 2) / 2; -} -function Nx(t, e, r) { - return typeof t != "string" ? t = Di(t) : (!Ks(t) || t.length % 2) && hn.throwArgumentError("invalid hexData", "value", t), e = 2 + 2 * e, "0x" + t.substring(e); -} -function _u(t, e) { - for (typeof t != "string" ? t = Di(t) : Ks(t) || hn.throwArgumentError("invalid hex string", "value", t), t.length > 2 * e + 2 && hn.throwArgumentError("value out of range", "value", arguments[1]); t.length < 2 * e + 2; ) - t = "0x0" + t.substring(2); - return t; -} -function x8(t) { - const e = { - r: "0x", - s: "0x", - _vs: "0x", - recoveryParam: 0, - v: 0, - yParityAndS: "0x", - compact: "0x" - }; - if (cj(t)) { - let r = wn(t); - r.length === 64 ? (e.v = 27 + (r[32] >> 7), r[32] &= 127, e.r = Di(r.slice(0, 32)), e.s = Di(r.slice(32, 64))) : r.length === 65 ? (e.r = Di(r.slice(0, 32)), e.s = Di(r.slice(32, 64)), e.v = r[64]) : hn.throwArgumentError("invalid signature string", "signature", t), e.v < 27 && (e.v === 0 || e.v === 1 ? e.v += 27 : hn.throwArgumentError("signature invalid v byte", "signature", t)), e.recoveryParam = 1 - e.v % 2, e.recoveryParam && (r[32] |= 128), e._vs = Di(r.slice(32, 64)); - } else { - if (e.r = t.r, e.s = t.s, e.v = t.v, e.recoveryParam = t.recoveryParam, e._vs = t._vs, e._vs != null) { - const i = fj(wn(e._vs), 32); - e._vs = Di(i); - const s = i[0] >= 128 ? 1 : 0; - e.recoveryParam == null ? e.recoveryParam = s : e.recoveryParam !== s && hn.throwArgumentError("signature recoveryParam mismatch _vs", "signature", t), i[0] &= 127; - const o = Di(i); - e.s == null ? e.s = o : e.s !== o && hn.throwArgumentError("signature v mismatch _vs", "signature", t); - } - if (e.recoveryParam == null) - e.v == null ? hn.throwArgumentError("signature missing v and recoveryParam", "signature", t) : e.v === 0 || e.v === 1 ? e.recoveryParam = e.v : e.recoveryParam = 1 - e.v % 2; - else if (e.v == null) - e.v = 27 + e.recoveryParam; - else { - const i = e.v === 0 || e.v === 1 ? e.v : 1 - e.v % 2; - e.recoveryParam !== i && hn.throwArgumentError("signature recoveryParam mismatch v", "signature", t); - } - e.r == null || !Ks(e.r) ? hn.throwArgumentError("signature missing or invalid r", "signature", t) : e.r = _u(e.r, 32), e.s == null || !Ks(e.s) ? hn.throwArgumentError("signature missing or invalid s", "signature", t) : e.s = _u(e.s, 32); - const r = wn(e.s); - r[0] >= 128 && hn.throwArgumentError("signature s out of range", "signature", t), e.recoveryParam && (r[0] |= 128); - const n = Di(r); - e._vs && (Ks(e._vs) || hn.throwArgumentError("signature invalid _vs", "signature", t), e._vs = _u(e._vs, 32)), e._vs == null ? e._vs = n : e._vs !== n && hn.throwArgumentError("signature _vs mismatch v and s", "signature", t); - } - return e.yParityAndS = e._vs, e.compact = e.r + e.yParityAndS.substring(2), e; -} -function nb(t) { - return "0x" + ij.keccak_256(wn(t)); -} -var ib = { exports: {} }; -ib.exports; -(function(t) { - (function(e, r) { - function n(m, f) { - if (!m) throw new Error(f || "Assertion failed"); - } - function i(m, f) { - m.super_ = f; - var g = function() { - }; - g.prototype = f.prototype, m.prototype = new g(), m.prototype.constructor = m; - } - function s(m, f, g) { - if (s.isBN(m)) - return m; - this.negative = 0, this.words = null, this.length = 0, this.red = null, m !== null && ((f === "le" || f === "be") && (g = f, f = 10), this._init(m || 0, f || 10, g || "be")); - } - typeof e == "object" ? e.exports = s : r.BN = s, s.BN = s, s.wordSize = 26; - var o; - try { - typeof window < "u" && typeof window.Buffer < "u" ? o = window.Buffer : o = Ql.Buffer; - } catch { - } - s.isBN = function(f) { - return f instanceof s ? !0 : f !== null && typeof f == "object" && f.constructor.wordSize === s.wordSize && Array.isArray(f.words); - }, s.max = function(f, g) { - return f.cmp(g) > 0 ? f : g; - }, s.min = function(f, g) { - return f.cmp(g) < 0 ? f : g; - }, s.prototype._init = function(f, g, b) { - if (typeof f == "number") - return this._initNumber(f, g, b); - if (typeof f == "object") - return this._initArray(f, g, b); - g === "hex" && (g = 16), n(g === (g | 0) && g >= 2 && g <= 36), f = f.toString().replace(/\s+/g, ""); - var x = 0; - f[0] === "-" && (x++, this.negative = 1), x < f.length && (g === 16 ? this._parseHex(f, x, b) : (this._parseBase(f, g, x), b === "le" && this._initArray(this.toArray(), g, b))); - }, s.prototype._initNumber = function(f, g, b) { - f < 0 && (this.negative = 1, f = -f), f < 67108864 ? (this.words = [f & 67108863], this.length = 1) : f < 4503599627370496 ? (this.words = [ - f & 67108863, - f / 67108864 & 67108863 - ], this.length = 2) : (n(f < 9007199254740992), this.words = [ - f & 67108863, - f / 67108864 & 67108863, - 1 - ], this.length = 3), b === "le" && this._initArray(this.toArray(), g, b); - }, s.prototype._initArray = function(f, g, b) { - if (n(typeof f.length == "number"), f.length <= 0) - return this.words = [0], this.length = 1, this; - this.length = Math.ceil(f.length / 3), this.words = new Array(this.length); - for (var x = 0; x < this.length; x++) - this.words[x] = 0; - var E, S, v = 0; - if (b === "be") - for (x = f.length - 1, E = 0; x >= 0; x -= 3) - S = f[x] | f[x - 1] << 8 | f[x - 2] << 16, this.words[E] |= S << v & 67108863, this.words[E + 1] = S >>> 26 - v & 67108863, v += 24, v >= 26 && (v -= 26, E++); - else if (b === "le") - for (x = 0, E = 0; x < f.length; x += 3) - S = f[x] | f[x + 1] << 8 | f[x + 2] << 16, this.words[E] |= S << v & 67108863, this.words[E + 1] = S >>> 26 - v & 67108863, v += 24, v >= 26 && (v -= 26, E++); - return this._strip(); - }; - function a(m, f) { - var g = m.charCodeAt(f); - if (g >= 48 && g <= 57) - return g - 48; - if (g >= 65 && g <= 70) - return g - 55; - if (g >= 97 && g <= 102) - return g - 87; - n(!1, "Invalid character in " + m); - } - function u(m, f, g) { - var b = a(m, g); - return g - 1 >= f && (b |= a(m, g - 1) << 4), b; - } - s.prototype._parseHex = function(f, g, b) { - this.length = Math.ceil((f.length - g) / 6), this.words = new Array(this.length); - for (var x = 0; x < this.length; x++) - this.words[x] = 0; - var E = 0, S = 0, v; - if (b === "be") - for (x = f.length - 1; x >= g; x -= 2) - v = u(f, g, x) << E, this.words[S] |= v & 67108863, E >= 18 ? (E -= 18, S += 1, this.words[S] |= v >>> 26) : E += 8; - else { - var M = f.length - g; - for (x = M % 2 === 0 ? g + 1 : g; x < f.length; x += 2) - v = u(f, g, x) << E, this.words[S] |= v & 67108863, E >= 18 ? (E -= 18, S += 1, this.words[S] |= v >>> 26) : E += 8; - } - this._strip(); - }; - function l(m, f, g, b) { - for (var x = 0, E = 0, S = Math.min(m.length, g), v = f; v < S; v++) { - var M = m.charCodeAt(v) - 48; - x *= b, M >= 49 ? E = M - 49 + 10 : M >= 17 ? E = M - 17 + 10 : E = M, n(M >= 0 && E < b, "Invalid character"), x += E; - } - return x; - } - s.prototype._parseBase = function(f, g, b) { - this.words = [0], this.length = 1; - for (var x = 0, E = 1; E <= 67108863; E *= g) - x++; - x--, E = E / g | 0; - for (var S = f.length - b, v = S % x, M = Math.min(S, S - v) + b, I = 0, F = b; F < M; F += x) - I = l(f, F, F + x, g), this.imuln(E), this.words[0] + I < 67108864 ? this.words[0] += I : this._iaddn(I); - if (v !== 0) { - var ce = 1; - for (I = l(f, F, f.length, g), F = 0; F < v; F++) - ce *= g; - this.imuln(ce), this.words[0] + I < 67108864 ? this.words[0] += I : this._iaddn(I); - } - this._strip(); - }, s.prototype.copy = function(f) { - f.words = new Array(this.length); - for (var g = 0; g < this.length; g++) - f.words[g] = this.words[g]; - f.length = this.length, f.negative = this.negative, f.red = this.red; - }; - function d(m, f) { - m.words = f.words, m.length = f.length, m.negative = f.negative, m.red = f.red; - } - if (s.prototype._move = function(f) { - d(f, this); - }, s.prototype.clone = function() { - var f = new s(null); - return this.copy(f), f; - }, s.prototype._expand = function(f) { - for (; this.length < f; ) - this.words[this.length++] = 0; - return this; - }, s.prototype._strip = function() { - for (; this.length > 1 && this.words[this.length - 1] === 0; ) - this.length--; - return this._normSign(); - }, s.prototype._normSign = function() { - return this.length === 1 && this.words[0] === 0 && (this.negative = 0), this; - }, typeof Symbol < "u" && typeof Symbol.for == "function") - try { - s.prototype[Symbol.for("nodejs.util.inspect.custom")] = p; - } catch { - s.prototype.inspect = p; - } - else - s.prototype.inspect = p; - function p() { - return (this.red ? ""; - } - var w = [ - "", - "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" - ], _ = [ - 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, - 33554432, - 43046721, - 16777216, - 48828125, - 60466176, - 40353607, - 16777216, - 43046721, - 1e7, - 19487171, - 35831808, - 62748517, - 7529536, - 11390625, - 16777216, - 24137569, - 34012224, - 47045881, - 64e6, - 4084101, - 5153632, - 6436343, - 7962624, - 9765625, - 11881376, - 14348907, - 17210368, - 20511149, - 243e5, - 28629151, - 33554432, - 39135393, - 45435424, - 52521875, - 60466176 - ]; - s.prototype.toString = function(f, g) { - f = f || 10, g = g | 0 || 1; - var b; - if (f === 16 || f === "hex") { - b = ""; - for (var x = 0, E = 0, S = 0; S < this.length; S++) { - var v = this.words[S], M = ((v << x | E) & 16777215).toString(16); - E = v >>> 24 - x & 16777215, x += 2, x >= 26 && (x -= 26, S--), E !== 0 || S !== this.length - 1 ? b = w[6 - M.length] + M + b : b = M + b; - } - for (E !== 0 && (b = E.toString(16) + b); b.length % g !== 0; ) - b = "0" + b; - return this.negative !== 0 && (b = "-" + b), b; - } - if (f === (f | 0) && f >= 2 && f <= 36) { - var I = _[f], F = P[f]; - b = ""; - var ce = this.clone(); - for (ce.negative = 0; !ce.isZero(); ) { - var D = ce.modrn(F).toString(f); - ce = ce.idivn(F), ce.isZero() ? b = D + b : b = w[I - D.length] + D + b; - } - for (this.isZero() && (b = "0" + b); b.length % g !== 0; ) - b = "0" + b; - return this.negative !== 0 && (b = "-" + b), b; - } - n(!1, "Base should be between 2 and 36"); - }, s.prototype.toNumber = function() { - var f = this.words[0]; - return this.length === 2 ? f += this.words[1] * 67108864 : this.length === 3 && this.words[2] === 1 ? f += 4503599627370496 + this.words[1] * 67108864 : this.length > 2 && n(!1, "Number can only safely store up to 53 bits"), this.negative !== 0 ? -f : f; - }, s.prototype.toJSON = function() { - return this.toString(16, 2); - }, o && (s.prototype.toBuffer = function(f, g) { - return this.toArrayLike(o, f, g); - }), s.prototype.toArray = function(f, g) { - return this.toArrayLike(Array, f, g); - }; - var O = function(f, g) { - return f.allocUnsafe ? f.allocUnsafe(g) : new f(g); - }; - s.prototype.toArrayLike = function(f, g, b) { - this._strip(); - var x = this.byteLength(), E = b || Math.max(1, x); - n(x <= E, "byte array longer than desired length"), n(E > 0, "Requested array length <= 0"); - var S = O(f, E), v = g === "le" ? "LE" : "BE"; - return this["_toArrayLike" + v](S, x), S; - }, s.prototype._toArrayLikeLE = function(f, g) { - for (var b = 0, x = 0, E = 0, S = 0; E < this.length; E++) { - var v = this.words[E] << S | x; - f[b++] = v & 255, b < f.length && (f[b++] = v >> 8 & 255), b < f.length && (f[b++] = v >> 16 & 255), S === 6 ? (b < f.length && (f[b++] = v >> 24 & 255), x = 0, S = 0) : (x = v >>> 24, S += 2); - } - if (b < f.length) - for (f[b++] = x; b < f.length; ) - f[b++] = 0; - }, s.prototype._toArrayLikeBE = function(f, g) { - for (var b = f.length - 1, x = 0, E = 0, S = 0; E < this.length; E++) { - var v = this.words[E] << S | x; - f[b--] = v & 255, b >= 0 && (f[b--] = v >> 8 & 255), b >= 0 && (f[b--] = v >> 16 & 255), S === 6 ? (b >= 0 && (f[b--] = v >> 24 & 255), x = 0, S = 0) : (x = v >>> 24, S += 2); - } - if (b >= 0) - for (f[b--] = x; b >= 0; ) - f[b--] = 0; - }, Math.clz32 ? s.prototype._countBits = function(f) { - return 32 - Math.clz32(f); - } : s.prototype._countBits = function(f) { - var g = f, b = 0; - return g >= 4096 && (b += 13, g >>>= 13), g >= 64 && (b += 7, g >>>= 7), g >= 8 && (b += 4, g >>>= 4), g >= 2 && (b += 2, g >>>= 2), b + g; - }, s.prototype._zeroBits = function(f) { - if (f === 0) return 26; - var g = f, b = 0; - return g & 8191 || (b += 13, g >>>= 13), g & 127 || (b += 7, g >>>= 7), g & 15 || (b += 4, g >>>= 4), g & 3 || (b += 2, g >>>= 2), g & 1 || b++, b; - }, s.prototype.bitLength = function() { - var f = this.words[this.length - 1], g = this._countBits(f); - return (this.length - 1) * 26 + g; - }; - function L(m) { - for (var f = new Array(m.bitLength()), g = 0; g < f.length; g++) { - var b = g / 26 | 0, x = g % 26; - f[g] = m.words[b] >>> x & 1; - } - return f; - } - s.prototype.zeroBits = function() { - if (this.isZero()) return 0; - for (var f = 0, g = 0; g < this.length; g++) { - var b = this._zeroBits(this.words[g]); - if (f += b, b !== 26) break; - } - return f; - }, s.prototype.byteLength = function() { - return Math.ceil(this.bitLength() / 8); - }, s.prototype.toTwos = function(f) { - return this.negative !== 0 ? this.abs().inotn(f).iaddn(1) : this.clone(); - }, s.prototype.fromTwos = function(f) { - return this.testn(f - 1) ? this.notn(f).iaddn(1).ineg() : this.clone(); - }, s.prototype.isNeg = function() { - return this.negative !== 0; - }, s.prototype.neg = function() { - return this.clone().ineg(); - }, s.prototype.ineg = function() { - return this.isZero() || (this.negative ^= 1), this; - }, s.prototype.iuor = function(f) { - for (; this.length < f.length; ) - this.words[this.length++] = 0; - for (var g = 0; g < f.length; g++) - this.words[g] = this.words[g] | f.words[g]; - return this._strip(); - }, s.prototype.ior = function(f) { - return n((this.negative | f.negative) === 0), this.iuor(f); - }, s.prototype.or = function(f) { - return this.length > f.length ? this.clone().ior(f) : f.clone().ior(this); - }, s.prototype.uor = function(f) { - return this.length > f.length ? this.clone().iuor(f) : f.clone().iuor(this); - }, s.prototype.iuand = function(f) { - var g; - this.length > f.length ? g = f : g = this; - for (var b = 0; b < g.length; b++) - this.words[b] = this.words[b] & f.words[b]; - return this.length = g.length, this._strip(); - }, s.prototype.iand = function(f) { - return n((this.negative | f.negative) === 0), this.iuand(f); - }, s.prototype.and = function(f) { - return this.length > f.length ? this.clone().iand(f) : f.clone().iand(this); - }, s.prototype.uand = function(f) { - return this.length > f.length ? this.clone().iuand(f) : f.clone().iuand(this); - }, s.prototype.iuxor = function(f) { - var g, b; - this.length > f.length ? (g = this, b = f) : (g = f, b = this); - for (var x = 0; x < b.length; x++) - this.words[x] = g.words[x] ^ b.words[x]; - if (this !== g) - for (; x < g.length; x++) - this.words[x] = g.words[x]; - return this.length = g.length, this._strip(); - }, s.prototype.ixor = function(f) { - return n((this.negative | f.negative) === 0), this.iuxor(f); - }, s.prototype.xor = function(f) { - return this.length > f.length ? this.clone().ixor(f) : f.clone().ixor(this); - }, s.prototype.uxor = function(f) { - return this.length > f.length ? this.clone().iuxor(f) : f.clone().iuxor(this); - }, s.prototype.inotn = function(f) { - n(typeof f == "number" && f >= 0); - var g = Math.ceil(f / 26) | 0, b = f % 26; - this._expand(g), b > 0 && g--; - for (var x = 0; x < g; x++) - this.words[x] = ~this.words[x] & 67108863; - return b > 0 && (this.words[x] = ~this.words[x] & 67108863 >> 26 - b), this._strip(); - }, s.prototype.notn = function(f) { - return this.clone().inotn(f); - }, s.prototype.setn = function(f, g) { - n(typeof f == "number" && f >= 0); - var b = f / 26 | 0, x = f % 26; - return this._expand(b + 1), g ? this.words[b] = this.words[b] | 1 << x : this.words[b] = this.words[b] & ~(1 << x), this._strip(); - }, s.prototype.iadd = function(f) { - var g; - if (this.negative !== 0 && f.negative === 0) - return this.negative = 0, g = this.isub(f), this.negative ^= 1, this._normSign(); - if (this.negative === 0 && f.negative !== 0) - return f.negative = 0, g = this.isub(f), f.negative = 1, g._normSign(); - var b, x; - this.length > f.length ? (b = this, x = f) : (b = f, x = this); - for (var E = 0, S = 0; S < x.length; S++) - g = (b.words[S] | 0) + (x.words[S] | 0) + E, this.words[S] = g & 67108863, E = g >>> 26; - for (; E !== 0 && S < b.length; S++) - g = (b.words[S] | 0) + E, this.words[S] = g & 67108863, E = g >>> 26; - if (this.length = b.length, E !== 0) - this.words[this.length] = E, this.length++; - else if (b !== this) - for (; S < b.length; S++) - this.words[S] = b.words[S]; - return this; - }, s.prototype.add = function(f) { - var g; - return f.negative !== 0 && this.negative === 0 ? (f.negative = 0, g = this.sub(f), f.negative ^= 1, g) : f.negative === 0 && this.negative !== 0 ? (this.negative = 0, g = f.sub(this), this.negative = 1, g) : this.length > f.length ? this.clone().iadd(f) : f.clone().iadd(this); - }, s.prototype.isub = function(f) { - if (f.negative !== 0) { - f.negative = 0; - var g = this.iadd(f); - return f.negative = 1, g._normSign(); - } else if (this.negative !== 0) - return this.negative = 0, this.iadd(f), this.negative = 1, this._normSign(); - var b = this.cmp(f); - if (b === 0) - return this.negative = 0, this.length = 1, this.words[0] = 0, this; - var x, E; - b > 0 ? (x = this, E = f) : (x = f, E = this); - for (var S = 0, v = 0; v < E.length; v++) - g = (x.words[v] | 0) - (E.words[v] | 0) + S, S = g >> 26, this.words[v] = g & 67108863; - for (; S !== 0 && v < x.length; v++) - g = (x.words[v] | 0) + S, S = g >> 26, this.words[v] = g & 67108863; - if (S === 0 && v < x.length && x !== this) - for (; v < x.length; v++) - this.words[v] = x.words[v]; - return this.length = Math.max(this.length, v), x !== this && (this.negative = 1), this._strip(); - }, s.prototype.sub = function(f) { - return this.clone().isub(f); - }; - function B(m, f, g) { - g.negative = f.negative ^ m.negative; - var b = m.length + f.length | 0; - g.length = b, b = b - 1 | 0; - var x = m.words[0] | 0, E = f.words[0] | 0, S = x * E, v = S & 67108863, M = S / 67108864 | 0; - g.words[0] = v; - for (var I = 1; I < b; I++) { - for (var F = M >>> 26, ce = M & 67108863, D = Math.min(I, f.length - 1), oe = Math.max(0, I - m.length + 1); oe <= D; oe++) { - var Z = I - oe | 0; - x = m.words[Z] | 0, E = f.words[oe] | 0, S = x * E + ce, F += S / 67108864 | 0, ce = S & 67108863; - } - g.words[I] = ce | 0, M = F | 0; - } - return M !== 0 ? g.words[I] = M | 0 : g.length--, g._strip(); - } - var k = function(f, g, b) { - var x = f.words, E = g.words, S = b.words, v = 0, M, I, F, ce = x[0] | 0, D = ce & 8191, oe = ce >>> 13, Z = x[1] | 0, J = Z & 8191, ee = Z >>> 13, T = x[2] | 0, X = T & 8191, re = T >>> 13, pe = x[3] | 0, ie = pe & 8191, ue = pe >>> 13, ve = x[4] | 0, Pe = ve & 8191, De = ve >>> 13, Ce = x[5] | 0, $e = Ce & 8191, Me = Ce >>> 13, Ne = x[6] | 0, Ke = Ne & 8191, Le = Ne >>> 13, qe = x[7] | 0, ze = qe & 8191, _e = qe >>> 13, Ze = x[8] | 0, at = Ze & 8191, ke = Ze >>> 13, Qe = x[9] | 0, tt = Qe & 8191, Ye = Qe >>> 13, dt = E[0] | 0, lt = dt & 8191, ct = dt >>> 13, qt = E[1] | 0, Jt = qt & 8191, Et = qt >>> 13, er = E[2] | 0, Xt = er & 8191, Dt = er >>> 13, kt = E[3] | 0, Ct = kt & 8191, mt = kt >>> 13, Rt = E[4] | 0, Nt = Rt & 8191, bt = Rt >>> 13, $t = E[5] | 0, Ft = $t & 8191, rt = $t >>> 13, Bt = E[6] | 0, $ = Bt & 8191, q = Bt >>> 13, H = E[7] | 0, C = H & 8191, G = H >>> 13, j = E[8] | 0, se = j & 8191, de = j >>> 13, xe = E[9] | 0, Te = xe & 8191, Re = xe >>> 13; - b.negative = f.negative ^ g.negative, b.length = 19, M = Math.imul(D, lt), I = Math.imul(D, ct), I = I + Math.imul(oe, lt) | 0, F = Math.imul(oe, ct); - var nt = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, M = Math.imul(J, lt), I = Math.imul(J, ct), I = I + Math.imul(ee, lt) | 0, F = Math.imul(ee, ct), M = M + Math.imul(D, Jt) | 0, I = I + Math.imul(D, Et) | 0, I = I + Math.imul(oe, Jt) | 0, F = F + Math.imul(oe, Et) | 0; - var je = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (je >>> 26) | 0, je &= 67108863, M = Math.imul(X, lt), I = Math.imul(X, ct), I = I + Math.imul(re, lt) | 0, F = Math.imul(re, ct), M = M + Math.imul(J, Jt) | 0, I = I + Math.imul(J, Et) | 0, I = I + Math.imul(ee, Jt) | 0, F = F + Math.imul(ee, Et) | 0, M = M + Math.imul(D, Xt) | 0, I = I + Math.imul(D, Dt) | 0, I = I + Math.imul(oe, Xt) | 0, F = F + Math.imul(oe, Dt) | 0; - var pt = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (pt >>> 26) | 0, pt &= 67108863, M = Math.imul(ie, lt), I = Math.imul(ie, ct), I = I + Math.imul(ue, lt) | 0, F = Math.imul(ue, ct), M = M + Math.imul(X, Jt) | 0, I = I + Math.imul(X, Et) | 0, I = I + Math.imul(re, Jt) | 0, F = F + Math.imul(re, Et) | 0, M = M + Math.imul(J, Xt) | 0, I = I + Math.imul(J, Dt) | 0, I = I + Math.imul(ee, Xt) | 0, F = F + Math.imul(ee, Dt) | 0, M = M + Math.imul(D, Ct) | 0, I = I + Math.imul(D, mt) | 0, I = I + Math.imul(oe, Ct) | 0, F = F + Math.imul(oe, mt) | 0; - var it = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, M = Math.imul(Pe, lt), I = Math.imul(Pe, ct), I = I + Math.imul(De, lt) | 0, F = Math.imul(De, ct), M = M + Math.imul(ie, Jt) | 0, I = I + Math.imul(ie, Et) | 0, I = I + Math.imul(ue, Jt) | 0, F = F + Math.imul(ue, Et) | 0, M = M + Math.imul(X, Xt) | 0, I = I + Math.imul(X, Dt) | 0, I = I + Math.imul(re, Xt) | 0, F = F + Math.imul(re, Dt) | 0, M = M + Math.imul(J, Ct) | 0, I = I + Math.imul(J, mt) | 0, I = I + Math.imul(ee, Ct) | 0, F = F + Math.imul(ee, mt) | 0, M = M + Math.imul(D, Nt) | 0, I = I + Math.imul(D, bt) | 0, I = I + Math.imul(oe, Nt) | 0, F = F + Math.imul(oe, bt) | 0; - var et = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, M = Math.imul($e, lt), I = Math.imul($e, ct), I = I + Math.imul(Me, lt) | 0, F = Math.imul(Me, ct), M = M + Math.imul(Pe, Jt) | 0, I = I + Math.imul(Pe, Et) | 0, I = I + Math.imul(De, Jt) | 0, F = F + Math.imul(De, Et) | 0, M = M + Math.imul(ie, Xt) | 0, I = I + Math.imul(ie, Dt) | 0, I = I + Math.imul(ue, Xt) | 0, F = F + Math.imul(ue, Dt) | 0, M = M + Math.imul(X, Ct) | 0, I = I + Math.imul(X, mt) | 0, I = I + Math.imul(re, Ct) | 0, F = F + Math.imul(re, mt) | 0, M = M + Math.imul(J, Nt) | 0, I = I + Math.imul(J, bt) | 0, I = I + Math.imul(ee, Nt) | 0, F = F + Math.imul(ee, bt) | 0, M = M + Math.imul(D, Ft) | 0, I = I + Math.imul(D, rt) | 0, I = I + Math.imul(oe, Ft) | 0, F = F + Math.imul(oe, rt) | 0; - var St = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, M = Math.imul(Ke, lt), I = Math.imul(Ke, ct), I = I + Math.imul(Le, lt) | 0, F = Math.imul(Le, ct), M = M + Math.imul($e, Jt) | 0, I = I + Math.imul($e, Et) | 0, I = I + Math.imul(Me, Jt) | 0, F = F + Math.imul(Me, Et) | 0, M = M + Math.imul(Pe, Xt) | 0, I = I + Math.imul(Pe, Dt) | 0, I = I + Math.imul(De, Xt) | 0, F = F + Math.imul(De, Dt) | 0, M = M + Math.imul(ie, Ct) | 0, I = I + Math.imul(ie, mt) | 0, I = I + Math.imul(ue, Ct) | 0, F = F + Math.imul(ue, mt) | 0, M = M + Math.imul(X, Nt) | 0, I = I + Math.imul(X, bt) | 0, I = I + Math.imul(re, Nt) | 0, F = F + Math.imul(re, bt) | 0, M = M + Math.imul(J, Ft) | 0, I = I + Math.imul(J, rt) | 0, I = I + Math.imul(ee, Ft) | 0, F = F + Math.imul(ee, rt) | 0, M = M + Math.imul(D, $) | 0, I = I + Math.imul(D, q) | 0, I = I + Math.imul(oe, $) | 0, F = F + Math.imul(oe, q) | 0; - var Tt = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, M = Math.imul(ze, lt), I = Math.imul(ze, ct), I = I + Math.imul(_e, lt) | 0, F = Math.imul(_e, ct), M = M + Math.imul(Ke, Jt) | 0, I = I + Math.imul(Ke, Et) | 0, I = I + Math.imul(Le, Jt) | 0, F = F + Math.imul(Le, Et) | 0, M = M + Math.imul($e, Xt) | 0, I = I + Math.imul($e, Dt) | 0, I = I + Math.imul(Me, Xt) | 0, F = F + Math.imul(Me, Dt) | 0, M = M + Math.imul(Pe, Ct) | 0, I = I + Math.imul(Pe, mt) | 0, I = I + Math.imul(De, Ct) | 0, F = F + Math.imul(De, mt) | 0, M = M + Math.imul(ie, Nt) | 0, I = I + Math.imul(ie, bt) | 0, I = I + Math.imul(ue, Nt) | 0, F = F + Math.imul(ue, bt) | 0, M = M + Math.imul(X, Ft) | 0, I = I + Math.imul(X, rt) | 0, I = I + Math.imul(re, Ft) | 0, F = F + Math.imul(re, rt) | 0, M = M + Math.imul(J, $) | 0, I = I + Math.imul(J, q) | 0, I = I + Math.imul(ee, $) | 0, F = F + Math.imul(ee, q) | 0, M = M + Math.imul(D, C) | 0, I = I + Math.imul(D, G) | 0, I = I + Math.imul(oe, C) | 0, F = F + Math.imul(oe, G) | 0; - var At = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, M = Math.imul(at, lt), I = Math.imul(at, ct), I = I + Math.imul(ke, lt) | 0, F = Math.imul(ke, ct), M = M + Math.imul(ze, Jt) | 0, I = I + Math.imul(ze, Et) | 0, I = I + Math.imul(_e, Jt) | 0, F = F + Math.imul(_e, Et) | 0, M = M + Math.imul(Ke, Xt) | 0, I = I + Math.imul(Ke, Dt) | 0, I = I + Math.imul(Le, Xt) | 0, F = F + Math.imul(Le, Dt) | 0, M = M + Math.imul($e, Ct) | 0, I = I + Math.imul($e, mt) | 0, I = I + Math.imul(Me, Ct) | 0, F = F + Math.imul(Me, mt) | 0, M = M + Math.imul(Pe, Nt) | 0, I = I + Math.imul(Pe, bt) | 0, I = I + Math.imul(De, Nt) | 0, F = F + Math.imul(De, bt) | 0, M = M + Math.imul(ie, Ft) | 0, I = I + Math.imul(ie, rt) | 0, I = I + Math.imul(ue, Ft) | 0, F = F + Math.imul(ue, rt) | 0, M = M + Math.imul(X, $) | 0, I = I + Math.imul(X, q) | 0, I = I + Math.imul(re, $) | 0, F = F + Math.imul(re, q) | 0, M = M + Math.imul(J, C) | 0, I = I + Math.imul(J, G) | 0, I = I + Math.imul(ee, C) | 0, F = F + Math.imul(ee, G) | 0, M = M + Math.imul(D, se) | 0, I = I + Math.imul(D, de) | 0, I = I + Math.imul(oe, se) | 0, F = F + Math.imul(oe, de) | 0; - var _t = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, M = Math.imul(tt, lt), I = Math.imul(tt, ct), I = I + Math.imul(Ye, lt) | 0, F = Math.imul(Ye, ct), M = M + Math.imul(at, Jt) | 0, I = I + Math.imul(at, Et) | 0, I = I + Math.imul(ke, Jt) | 0, F = F + Math.imul(ke, Et) | 0, M = M + Math.imul(ze, Xt) | 0, I = I + Math.imul(ze, Dt) | 0, I = I + Math.imul(_e, Xt) | 0, F = F + Math.imul(_e, Dt) | 0, M = M + Math.imul(Ke, Ct) | 0, I = I + Math.imul(Ke, mt) | 0, I = I + Math.imul(Le, Ct) | 0, F = F + Math.imul(Le, mt) | 0, M = M + Math.imul($e, Nt) | 0, I = I + Math.imul($e, bt) | 0, I = I + Math.imul(Me, Nt) | 0, F = F + Math.imul(Me, bt) | 0, M = M + Math.imul(Pe, Ft) | 0, I = I + Math.imul(Pe, rt) | 0, I = I + Math.imul(De, Ft) | 0, F = F + Math.imul(De, rt) | 0, M = M + Math.imul(ie, $) | 0, I = I + Math.imul(ie, q) | 0, I = I + Math.imul(ue, $) | 0, F = F + Math.imul(ue, q) | 0, M = M + Math.imul(X, C) | 0, I = I + Math.imul(X, G) | 0, I = I + Math.imul(re, C) | 0, F = F + Math.imul(re, G) | 0, M = M + Math.imul(J, se) | 0, I = I + Math.imul(J, de) | 0, I = I + Math.imul(ee, se) | 0, F = F + Math.imul(ee, de) | 0, M = M + Math.imul(D, Te) | 0, I = I + Math.imul(D, Re) | 0, I = I + Math.imul(oe, Te) | 0, F = F + Math.imul(oe, Re) | 0; - var ht = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, M = Math.imul(tt, Jt), I = Math.imul(tt, Et), I = I + Math.imul(Ye, Jt) | 0, F = Math.imul(Ye, Et), M = M + Math.imul(at, Xt) | 0, I = I + Math.imul(at, Dt) | 0, I = I + Math.imul(ke, Xt) | 0, F = F + Math.imul(ke, Dt) | 0, M = M + Math.imul(ze, Ct) | 0, I = I + Math.imul(ze, mt) | 0, I = I + Math.imul(_e, Ct) | 0, F = F + Math.imul(_e, mt) | 0, M = M + Math.imul(Ke, Nt) | 0, I = I + Math.imul(Ke, bt) | 0, I = I + Math.imul(Le, Nt) | 0, F = F + Math.imul(Le, bt) | 0, M = M + Math.imul($e, Ft) | 0, I = I + Math.imul($e, rt) | 0, I = I + Math.imul(Me, Ft) | 0, F = F + Math.imul(Me, rt) | 0, M = M + Math.imul(Pe, $) | 0, I = I + Math.imul(Pe, q) | 0, I = I + Math.imul(De, $) | 0, F = F + Math.imul(De, q) | 0, M = M + Math.imul(ie, C) | 0, I = I + Math.imul(ie, G) | 0, I = I + Math.imul(ue, C) | 0, F = F + Math.imul(ue, G) | 0, M = M + Math.imul(X, se) | 0, I = I + Math.imul(X, de) | 0, I = I + Math.imul(re, se) | 0, F = F + Math.imul(re, de) | 0, M = M + Math.imul(J, Te) | 0, I = I + Math.imul(J, Re) | 0, I = I + Math.imul(ee, Te) | 0, F = F + Math.imul(ee, Re) | 0; - var xt = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, M = Math.imul(tt, Xt), I = Math.imul(tt, Dt), I = I + Math.imul(Ye, Xt) | 0, F = Math.imul(Ye, Dt), M = M + Math.imul(at, Ct) | 0, I = I + Math.imul(at, mt) | 0, I = I + Math.imul(ke, Ct) | 0, F = F + Math.imul(ke, mt) | 0, M = M + Math.imul(ze, Nt) | 0, I = I + Math.imul(ze, bt) | 0, I = I + Math.imul(_e, Nt) | 0, F = F + Math.imul(_e, bt) | 0, M = M + Math.imul(Ke, Ft) | 0, I = I + Math.imul(Ke, rt) | 0, I = I + Math.imul(Le, Ft) | 0, F = F + Math.imul(Le, rt) | 0, M = M + Math.imul($e, $) | 0, I = I + Math.imul($e, q) | 0, I = I + Math.imul(Me, $) | 0, F = F + Math.imul(Me, q) | 0, M = M + Math.imul(Pe, C) | 0, I = I + Math.imul(Pe, G) | 0, I = I + Math.imul(De, C) | 0, F = F + Math.imul(De, G) | 0, M = M + Math.imul(ie, se) | 0, I = I + Math.imul(ie, de) | 0, I = I + Math.imul(ue, se) | 0, F = F + Math.imul(ue, de) | 0, M = M + Math.imul(X, Te) | 0, I = I + Math.imul(X, Re) | 0, I = I + Math.imul(re, Te) | 0, F = F + Math.imul(re, Re) | 0; - var st = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, M = Math.imul(tt, Ct), I = Math.imul(tt, mt), I = I + Math.imul(Ye, Ct) | 0, F = Math.imul(Ye, mt), M = M + Math.imul(at, Nt) | 0, I = I + Math.imul(at, bt) | 0, I = I + Math.imul(ke, Nt) | 0, F = F + Math.imul(ke, bt) | 0, M = M + Math.imul(ze, Ft) | 0, I = I + Math.imul(ze, rt) | 0, I = I + Math.imul(_e, Ft) | 0, F = F + Math.imul(_e, rt) | 0, M = M + Math.imul(Ke, $) | 0, I = I + Math.imul(Ke, q) | 0, I = I + Math.imul(Le, $) | 0, F = F + Math.imul(Le, q) | 0, M = M + Math.imul($e, C) | 0, I = I + Math.imul($e, G) | 0, I = I + Math.imul(Me, C) | 0, F = F + Math.imul(Me, G) | 0, M = M + Math.imul(Pe, se) | 0, I = I + Math.imul(Pe, de) | 0, I = I + Math.imul(De, se) | 0, F = F + Math.imul(De, de) | 0, M = M + Math.imul(ie, Te) | 0, I = I + Math.imul(ie, Re) | 0, I = I + Math.imul(ue, Te) | 0, F = F + Math.imul(ue, Re) | 0; - var yt = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (yt >>> 26) | 0, yt &= 67108863, M = Math.imul(tt, Nt), I = Math.imul(tt, bt), I = I + Math.imul(Ye, Nt) | 0, F = Math.imul(Ye, bt), M = M + Math.imul(at, Ft) | 0, I = I + Math.imul(at, rt) | 0, I = I + Math.imul(ke, Ft) | 0, F = F + Math.imul(ke, rt) | 0, M = M + Math.imul(ze, $) | 0, I = I + Math.imul(ze, q) | 0, I = I + Math.imul(_e, $) | 0, F = F + Math.imul(_e, q) | 0, M = M + Math.imul(Ke, C) | 0, I = I + Math.imul(Ke, G) | 0, I = I + Math.imul(Le, C) | 0, F = F + Math.imul(Le, G) | 0, M = M + Math.imul($e, se) | 0, I = I + Math.imul($e, de) | 0, I = I + Math.imul(Me, se) | 0, F = F + Math.imul(Me, de) | 0, M = M + Math.imul(Pe, Te) | 0, I = I + Math.imul(Pe, Re) | 0, I = I + Math.imul(De, Te) | 0, F = F + Math.imul(De, Re) | 0; - var ut = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, M = Math.imul(tt, Ft), I = Math.imul(tt, rt), I = I + Math.imul(Ye, Ft) | 0, F = Math.imul(Ye, rt), M = M + Math.imul(at, $) | 0, I = I + Math.imul(at, q) | 0, I = I + Math.imul(ke, $) | 0, F = F + Math.imul(ke, q) | 0, M = M + Math.imul(ze, C) | 0, I = I + Math.imul(ze, G) | 0, I = I + Math.imul(_e, C) | 0, F = F + Math.imul(_e, G) | 0, M = M + Math.imul(Ke, se) | 0, I = I + Math.imul(Ke, de) | 0, I = I + Math.imul(Le, se) | 0, F = F + Math.imul(Le, de) | 0, M = M + Math.imul($e, Te) | 0, I = I + Math.imul($e, Re) | 0, I = I + Math.imul(Me, Te) | 0, F = F + Math.imul(Me, Re) | 0; - var ot = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, M = Math.imul(tt, $), I = Math.imul(tt, q), I = I + Math.imul(Ye, $) | 0, F = Math.imul(Ye, q), M = M + Math.imul(at, C) | 0, I = I + Math.imul(at, G) | 0, I = I + Math.imul(ke, C) | 0, F = F + Math.imul(ke, G) | 0, M = M + Math.imul(ze, se) | 0, I = I + Math.imul(ze, de) | 0, I = I + Math.imul(_e, se) | 0, F = F + Math.imul(_e, de) | 0, M = M + Math.imul(Ke, Te) | 0, I = I + Math.imul(Ke, Re) | 0, I = I + Math.imul(Le, Te) | 0, F = F + Math.imul(Le, Re) | 0; - var Se = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, M = Math.imul(tt, C), I = Math.imul(tt, G), I = I + Math.imul(Ye, C) | 0, F = Math.imul(Ye, G), M = M + Math.imul(at, se) | 0, I = I + Math.imul(at, de) | 0, I = I + Math.imul(ke, se) | 0, F = F + Math.imul(ke, de) | 0, M = M + Math.imul(ze, Te) | 0, I = I + Math.imul(ze, Re) | 0, I = I + Math.imul(_e, Te) | 0, F = F + Math.imul(_e, Re) | 0; - var Ae = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, M = Math.imul(tt, se), I = Math.imul(tt, de), I = I + Math.imul(Ye, se) | 0, F = Math.imul(Ye, de), M = M + Math.imul(at, Te) | 0, I = I + Math.imul(at, Re) | 0, I = I + Math.imul(ke, Te) | 0, F = F + Math.imul(ke, Re) | 0; - var Ve = (v + M | 0) + ((I & 8191) << 13) | 0; - v = (F + (I >>> 13) | 0) + (Ve >>> 26) | 0, Ve &= 67108863, M = Math.imul(tt, Te), I = Math.imul(tt, Re), I = I + Math.imul(Ye, Te) | 0, F = Math.imul(Ye, Re); - var Fe = (v + M | 0) + ((I & 8191) << 13) | 0; - return v = (F + (I >>> 13) | 0) + (Fe >>> 26) | 0, Fe &= 67108863, S[0] = nt, S[1] = je, S[2] = pt, S[3] = it, S[4] = et, S[5] = St, S[6] = Tt, S[7] = At, S[8] = _t, S[9] = ht, S[10] = xt, S[11] = st, S[12] = yt, S[13] = ut, S[14] = ot, S[15] = Se, S[16] = Ae, S[17] = Ve, S[18] = Fe, v !== 0 && (S[19] = v, b.length++), b; - }; - Math.imul || (k = B); - function W(m, f, g) { - g.negative = f.negative ^ m.negative, g.length = m.length + f.length; - for (var b = 0, x = 0, E = 0; E < g.length - 1; E++) { - var S = x; - x = 0; - for (var v = b & 67108863, M = Math.min(E, f.length - 1), I = Math.max(0, E - m.length + 1); I <= M; I++) { - var F = E - I, ce = m.words[F] | 0, D = f.words[I] | 0, oe = ce * D, Z = oe & 67108863; - S = S + (oe / 67108864 | 0) | 0, Z = Z + v | 0, v = Z & 67108863, S = S + (Z >>> 26) | 0, x += S >>> 26, S &= 67108863; - } - g.words[E] = v, b = S, S = x; - } - return b !== 0 ? g.words[E] = b : g.length--, g._strip(); - } - function U(m, f, g) { - return W(m, f, g); - } - s.prototype.mulTo = function(f, g) { - var b, x = this.length + f.length; - return this.length === 10 && f.length === 10 ? b = k(this, f, g) : x < 63 ? b = B(this, f, g) : x < 1024 ? b = W(this, f, g) : b = U(this, f, g), b; - }, s.prototype.mul = function(f) { - var g = new s(null); - return g.words = new Array(this.length + f.length), this.mulTo(f, g); - }, s.prototype.mulf = function(f) { - var g = new s(null); - return g.words = new Array(this.length + f.length), U(this, f, g); - }, s.prototype.imul = function(f) { - return this.clone().mulTo(f, this); - }, s.prototype.imuln = function(f) { - var g = f < 0; - g && (f = -f), n(typeof f == "number"), n(f < 67108864); - for (var b = 0, x = 0; x < this.length; x++) { - var E = (this.words[x] | 0) * f, S = (E & 67108863) + (b & 67108863); - b >>= 26, b += E / 67108864 | 0, b += S >>> 26, this.words[x] = S & 67108863; - } - return b !== 0 && (this.words[x] = b, this.length++), g ? this.ineg() : this; - }, s.prototype.muln = function(f) { - return this.clone().imuln(f); - }, s.prototype.sqr = function() { - return this.mul(this); - }, s.prototype.isqr = function() { - return this.imul(this.clone()); - }, s.prototype.pow = function(f) { - var g = L(f); - if (g.length === 0) return new s(1); - for (var b = this, x = 0; x < g.length && g[x] === 0; x++, b = b.sqr()) - ; - if (++x < g.length) - for (var E = b.sqr(); x < g.length; x++, E = E.sqr()) - g[x] !== 0 && (b = b.mul(E)); - return b; - }, s.prototype.iushln = function(f) { - n(typeof f == "number" && f >= 0); - var g = f % 26, b = (f - g) / 26, x = 67108863 >>> 26 - g << 26 - g, E; - if (g !== 0) { - var S = 0; - for (E = 0; E < this.length; E++) { - var v = this.words[E] & x, M = (this.words[E] | 0) - v << g; - this.words[E] = M | S, S = v >>> 26 - g; - } - S && (this.words[E] = S, this.length++); - } - if (b !== 0) { - for (E = this.length - 1; E >= 0; E--) - this.words[E + b] = this.words[E]; - for (E = 0; E < b; E++) - this.words[E] = 0; - this.length += b; - } - return this._strip(); - }, s.prototype.ishln = function(f) { - return n(this.negative === 0), this.iushln(f); - }, s.prototype.iushrn = function(f, g, b) { - n(typeof f == "number" && f >= 0); - var x; - g ? x = (g - g % 26) / 26 : x = 0; - var E = f % 26, S = Math.min((f - E) / 26, this.length), v = 67108863 ^ 67108863 >>> E << E, M = b; - if (x -= S, x = Math.max(0, x), M) { - for (var I = 0; I < S; I++) - M.words[I] = this.words[I]; - M.length = S; - } - if (S !== 0) if (this.length > S) - for (this.length -= S, I = 0; I < this.length; I++) - this.words[I] = this.words[I + S]; - else - this.words[0] = 0, this.length = 1; - var F = 0; - for (I = this.length - 1; I >= 0 && (F !== 0 || I >= x); I--) { - var ce = this.words[I] | 0; - this.words[I] = F << 26 - E | ce >>> E, F = ce & v; - } - return M && F !== 0 && (M.words[M.length++] = F), this.length === 0 && (this.words[0] = 0, this.length = 1), this._strip(); - }, s.prototype.ishrn = function(f, g, b) { - return n(this.negative === 0), this.iushrn(f, g, b); - }, s.prototype.shln = function(f) { - return this.clone().ishln(f); - }, s.prototype.ushln = function(f) { - return this.clone().iushln(f); - }, s.prototype.shrn = function(f) { - return this.clone().ishrn(f); - }, s.prototype.ushrn = function(f) { - return this.clone().iushrn(f); - }, s.prototype.testn = function(f) { - n(typeof f == "number" && f >= 0); - var g = f % 26, b = (f - g) / 26, x = 1 << g; - if (this.length <= b) return !1; - var E = this.words[b]; - return !!(E & x); - }, s.prototype.imaskn = function(f) { - n(typeof f == "number" && f >= 0); - var g = f % 26, b = (f - g) / 26; - if (n(this.negative === 0, "imaskn works only with positive numbers"), this.length <= b) - return this; - if (g !== 0 && b++, this.length = Math.min(b, this.length), g !== 0) { - var x = 67108863 ^ 67108863 >>> g << g; - this.words[this.length - 1] &= x; - } - return this._strip(); - }, s.prototype.maskn = function(f) { - return this.clone().imaskn(f); - }, s.prototype.iaddn = function(f) { - return n(typeof f == "number"), n(f < 67108864), f < 0 ? this.isubn(-f) : this.negative !== 0 ? this.length === 1 && (this.words[0] | 0) <= f ? (this.words[0] = f - (this.words[0] | 0), this.negative = 0, this) : (this.negative = 0, this.isubn(f), this.negative = 1, this) : this._iaddn(f); - }, s.prototype._iaddn = function(f) { - this.words[0] += f; - for (var g = 0; g < this.length && this.words[g] >= 67108864; g++) - this.words[g] -= 67108864, g === this.length - 1 ? this.words[g + 1] = 1 : this.words[g + 1]++; - return this.length = Math.max(this.length, g + 1), this; - }, s.prototype.isubn = function(f) { - if (n(typeof f == "number"), n(f < 67108864), f < 0) return this.iaddn(-f); - if (this.negative !== 0) - return this.negative = 0, this.iaddn(f), this.negative = 1, this; - if (this.words[0] -= f, this.length === 1 && this.words[0] < 0) - this.words[0] = -this.words[0], this.negative = 1; - else - for (var g = 0; g < this.length && this.words[g] < 0; g++) - this.words[g] += 67108864, this.words[g + 1] -= 1; - return this._strip(); - }, s.prototype.addn = function(f) { - return this.clone().iaddn(f); - }, s.prototype.subn = function(f) { - return this.clone().isubn(f); - }, s.prototype.iabs = function() { - return this.negative = 0, this; - }, s.prototype.abs = function() { - return this.clone().iabs(); - }, s.prototype._ishlnsubmul = function(f, g, b) { - var x = f.length + b, E; - this._expand(x); - var S, v = 0; - for (E = 0; E < f.length; E++) { - S = (this.words[E + b] | 0) + v; - var M = (f.words[E] | 0) * g; - S -= M & 67108863, v = (S >> 26) - (M / 67108864 | 0), this.words[E + b] = S & 67108863; - } - for (; E < this.length - b; E++) - S = (this.words[E + b] | 0) + v, v = S >> 26, this.words[E + b] = S & 67108863; - if (v === 0) return this._strip(); - for (n(v === -1), v = 0, E = 0; E < this.length; E++) - S = -(this.words[E] | 0) + v, v = S >> 26, this.words[E] = S & 67108863; - return this.negative = 1, this._strip(); - }, s.prototype._wordDiv = function(f, g) { - var b = this.length - f.length, x = this.clone(), E = f, S = E.words[E.length - 1] | 0, v = this._countBits(S); - b = 26 - v, b !== 0 && (E = E.ushln(b), x.iushln(b), S = E.words[E.length - 1] | 0); - var M = x.length - E.length, I; - if (g !== "mod") { - I = new s(null), I.length = M + 1, I.words = new Array(I.length); - for (var F = 0; F < I.length; F++) - I.words[F] = 0; - } - var ce = x.clone()._ishlnsubmul(E, 1, M); - ce.negative === 0 && (x = ce, I && (I.words[M] = 1)); - for (var D = M - 1; D >= 0; D--) { - var oe = (x.words[E.length + D] | 0) * 67108864 + (x.words[E.length + D - 1] | 0); - for (oe = Math.min(oe / S | 0, 67108863), x._ishlnsubmul(E, oe, D); x.negative !== 0; ) - oe--, x.negative = 0, x._ishlnsubmul(E, 1, D), x.isZero() || (x.negative ^= 1); - I && (I.words[D] = oe); - } - return I && I._strip(), x._strip(), g !== "div" && b !== 0 && x.iushrn(b), { - div: I || null, - mod: x - }; - }, s.prototype.divmod = function(f, g, b) { - if (n(!f.isZero()), this.isZero()) - return { - div: new s(0), - mod: new s(0) - }; - var x, E, S; - return this.negative !== 0 && f.negative === 0 ? (S = this.neg().divmod(f, g), g !== "mod" && (x = S.div.neg()), g !== "div" && (E = S.mod.neg(), b && E.negative !== 0 && E.iadd(f)), { - div: x, - mod: E - }) : this.negative === 0 && f.negative !== 0 ? (S = this.divmod(f.neg(), g), g !== "mod" && (x = S.div.neg()), { - div: x, - mod: S.mod - }) : this.negative & f.negative ? (S = this.neg().divmod(f.neg(), g), g !== "div" && (E = S.mod.neg(), b && E.negative !== 0 && E.isub(f)), { - div: S.div, - mod: E - }) : f.length > this.length || this.cmp(f) < 0 ? { - div: new s(0), - mod: this - } : f.length === 1 ? g === "div" ? { - div: this.divn(f.words[0]), - mod: null - } : g === "mod" ? { - div: null, - mod: new s(this.modrn(f.words[0])) - } : { - div: this.divn(f.words[0]), - mod: new s(this.modrn(f.words[0])) - } : this._wordDiv(f, g); - }, s.prototype.div = function(f) { - return this.divmod(f, "div", !1).div; - }, s.prototype.mod = function(f) { - return this.divmod(f, "mod", !1).mod; - }, s.prototype.umod = function(f) { - return this.divmod(f, "mod", !0).mod; - }, s.prototype.divRound = function(f) { - var g = this.divmod(f); - if (g.mod.isZero()) return g.div; - var b = g.div.negative !== 0 ? g.mod.isub(f) : g.mod, x = f.ushrn(1), E = f.andln(1), S = b.cmp(x); - return S < 0 || E === 1 && S === 0 ? g.div : g.div.negative !== 0 ? g.div.isubn(1) : g.div.iaddn(1); - }, s.prototype.modrn = function(f) { - var g = f < 0; - g && (f = -f), n(f <= 67108863); - for (var b = (1 << 26) % f, x = 0, E = this.length - 1; E >= 0; E--) - x = (b * x + (this.words[E] | 0)) % f; - return g ? -x : x; - }, s.prototype.modn = function(f) { - return this.modrn(f); - }, s.prototype.idivn = function(f) { - var g = f < 0; - g && (f = -f), n(f <= 67108863); - for (var b = 0, x = this.length - 1; x >= 0; x--) { - var E = (this.words[x] | 0) + b * 67108864; - this.words[x] = E / f | 0, b = E % f; - } - return this._strip(), g ? this.ineg() : this; - }, s.prototype.divn = function(f) { - return this.clone().idivn(f); - }, s.prototype.egcd = function(f) { - n(f.negative === 0), n(!f.isZero()); - var g = this, b = f.clone(); - g.negative !== 0 ? g = g.umod(f) : g = g.clone(); - for (var x = new s(1), E = new s(0), S = new s(0), v = new s(1), M = 0; g.isEven() && b.isEven(); ) - g.iushrn(1), b.iushrn(1), ++M; - for (var I = b.clone(), F = g.clone(); !g.isZero(); ) { - for (var ce = 0, D = 1; !(g.words[0] & D) && ce < 26; ++ce, D <<= 1) ; - if (ce > 0) - for (g.iushrn(ce); ce-- > 0; ) - (x.isOdd() || E.isOdd()) && (x.iadd(I), E.isub(F)), x.iushrn(1), E.iushrn(1); - for (var oe = 0, Z = 1; !(b.words[0] & Z) && oe < 26; ++oe, Z <<= 1) ; - if (oe > 0) - for (b.iushrn(oe); oe-- > 0; ) - (S.isOdd() || v.isOdd()) && (S.iadd(I), v.isub(F)), S.iushrn(1), v.iushrn(1); - g.cmp(b) >= 0 ? (g.isub(b), x.isub(S), E.isub(v)) : (b.isub(g), S.isub(x), v.isub(E)); - } - return { - a: S, - b: v, - gcd: b.iushln(M) - }; - }, s.prototype._invmp = function(f) { - n(f.negative === 0), n(!f.isZero()); - var g = this, b = f.clone(); - g.negative !== 0 ? g = g.umod(f) : g = g.clone(); - for (var x = new s(1), E = new s(0), S = b.clone(); g.cmpn(1) > 0 && b.cmpn(1) > 0; ) { - for (var v = 0, M = 1; !(g.words[0] & M) && v < 26; ++v, M <<= 1) ; - if (v > 0) - for (g.iushrn(v); v-- > 0; ) - x.isOdd() && x.iadd(S), x.iushrn(1); - for (var I = 0, F = 1; !(b.words[0] & F) && I < 26; ++I, F <<= 1) ; - if (I > 0) - for (b.iushrn(I); I-- > 0; ) - E.isOdd() && E.iadd(S), E.iushrn(1); - g.cmp(b) >= 0 ? (g.isub(b), x.isub(E)) : (b.isub(g), E.isub(x)); - } - var ce; - return g.cmpn(1) === 0 ? ce = x : ce = E, ce.cmpn(0) < 0 && ce.iadd(f), ce; - }, s.prototype.gcd = function(f) { - if (this.isZero()) return f.abs(); - if (f.isZero()) return this.abs(); - var g = this.clone(), b = f.clone(); - g.negative = 0, b.negative = 0; - for (var x = 0; g.isEven() && b.isEven(); x++) - g.iushrn(1), b.iushrn(1); - do { - for (; g.isEven(); ) - g.iushrn(1); - for (; b.isEven(); ) - b.iushrn(1); - var E = g.cmp(b); - if (E < 0) { - var S = g; - g = b, b = S; - } else if (E === 0 || b.cmpn(1) === 0) - break; - g.isub(b); - } while (!0); - return b.iushln(x); - }, s.prototype.invm = function(f) { - return this.egcd(f).a.umod(f); - }, s.prototype.isEven = function() { - return (this.words[0] & 1) === 0; - }, s.prototype.isOdd = function() { - return (this.words[0] & 1) === 1; - }, s.prototype.andln = function(f) { - return this.words[0] & f; - }, s.prototype.bincn = function(f) { - n(typeof f == "number"); - var g = f % 26, b = (f - g) / 26, x = 1 << g; - if (this.length <= b) - return this._expand(b + 1), this.words[b] |= x, this; - for (var E = x, S = b; E !== 0 && S < this.length; S++) { - var v = this.words[S] | 0; - v += E, E = v >>> 26, v &= 67108863, this.words[S] = v; - } - return E !== 0 && (this.words[S] = E, this.length++), this; - }, s.prototype.isZero = function() { - return this.length === 1 && this.words[0] === 0; - }, s.prototype.cmpn = function(f) { - var g = f < 0; - if (this.negative !== 0 && !g) return -1; - if (this.negative === 0 && g) return 1; - this._strip(); - var b; - if (this.length > 1) - b = 1; - else { - g && (f = -f), n(f <= 67108863, "Number is too big"); - var x = this.words[0] | 0; - b = x === f ? 0 : x < f ? -1 : 1; - } - return this.negative !== 0 ? -b | 0 : b; - }, s.prototype.cmp = function(f) { - if (this.negative !== 0 && f.negative === 0) return -1; - if (this.negative === 0 && f.negative !== 0) return 1; - var g = this.ucmp(f); - return this.negative !== 0 ? -g | 0 : g; - }, s.prototype.ucmp = function(f) { - if (this.length > f.length) return 1; - if (this.length < f.length) return -1; - for (var g = 0, b = this.length - 1; b >= 0; b--) { - var x = this.words[b] | 0, E = f.words[b] | 0; - if (x !== E) { - x < E ? g = -1 : x > E && (g = 1); - break; - } - } - return g; - }, s.prototype.gtn = function(f) { - return this.cmpn(f) === 1; - }, s.prototype.gt = function(f) { - return this.cmp(f) === 1; - }, s.prototype.gten = function(f) { - return this.cmpn(f) >= 0; - }, s.prototype.gte = function(f) { - return this.cmp(f) >= 0; - }, s.prototype.ltn = function(f) { - return this.cmpn(f) === -1; - }, s.prototype.lt = function(f) { - return this.cmp(f) === -1; - }, s.prototype.lten = function(f) { - return this.cmpn(f) <= 0; - }, s.prototype.lte = function(f) { - return this.cmp(f) <= 0; - }, s.prototype.eqn = function(f) { - return this.cmpn(f) === 0; - }, s.prototype.eq = function(f) { - return this.cmp(f) === 0; - }, s.red = function(f) { - return new Y(f); - }, s.prototype.toRed = function(f) { - return n(!this.red, "Already a number in reduction context"), n(this.negative === 0, "red works only with positives"), f.convertTo(this)._forceRed(f); - }, s.prototype.fromRed = function() { - return n(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom(this); - }, s.prototype._forceRed = function(f) { - return this.red = f, this; - }, s.prototype.forceRed = function(f) { - return n(!this.red, "Already a number in reduction context"), this._forceRed(f); - }, s.prototype.redAdd = function(f) { - return n(this.red, "redAdd works only with red numbers"), this.red.add(this, f); - }, s.prototype.redIAdd = function(f) { - return n(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, f); - }, s.prototype.redSub = function(f) { - return n(this.red, "redSub works only with red numbers"), this.red.sub(this, f); - }, s.prototype.redISub = function(f) { - return n(this.red, "redISub works only with red numbers"), this.red.isub(this, f); - }, s.prototype.redShl = function(f) { - return n(this.red, "redShl works only with red numbers"), this.red.shl(this, f); - }, s.prototype.redMul = function(f) { - return n(this.red, "redMul works only with red numbers"), this.red._verify2(this, f), this.red.mul(this, f); - }, s.prototype.redIMul = function(f) { - return n(this.red, "redMul works only with red numbers"), this.red._verify2(this, f), this.red.imul(this, f); - }, s.prototype.redSqr = function() { - return n(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr(this); - }, s.prototype.redISqr = function() { - return n(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr(this); - }, s.prototype.redSqrt = function() { - return n(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt(this); - }, s.prototype.redInvm = function() { - return n(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm(this); - }, s.prototype.redNeg = function() { - return n(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg(this); - }, s.prototype.redPow = function(f) { - return n(this.red && !f.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, f); - }; - var V = { - k256: null, - p224: null, - p192: null, - p25519: null - }; - function Q(m, f) { - this.name = m, this.p = new s(f, 16), this.n = this.p.bitLength(), this.k = new s(1).iushln(this.n).isub(this.p), this.tmp = this._tmp(); - } - Q.prototype._tmp = function() { - var f = new s(null); - return f.words = new Array(Math.ceil(this.n / 13)), f; - }, Q.prototype.ireduce = function(f) { - var g = f, b; - do - this.split(g, this.tmp), g = this.imulK(g), g = g.iadd(this.tmp), b = g.bitLength(); - while (b > this.n); - var x = b < this.n ? -1 : g.ucmp(this.p); - return x === 0 ? (g.words[0] = 0, g.length = 1) : x > 0 ? g.isub(this.p) : g.strip !== void 0 ? g.strip() : g._strip(), g; - }, Q.prototype.split = function(f, g) { - f.iushrn(this.n, 0, g); - }, Q.prototype.imulK = function(f) { - return f.imul(this.k); - }; - function R() { - Q.call( - this, - "k256", - "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f" - ); - } - i(R, Q), R.prototype.split = function(f, g) { - for (var b = 4194303, x = Math.min(f.length, 9), E = 0; E < x; E++) - g.words[E] = f.words[E]; - if (g.length = x, f.length <= 9) { - f.words[0] = 0, f.length = 1; - return; - } - var S = f.words[9]; - for (g.words[g.length++] = S & b, E = 10; E < f.length; E++) { - var v = f.words[E] | 0; - f.words[E - 10] = (v & b) << 4 | S >>> 22, S = v; - } - S >>>= 22, f.words[E - 10] = S, S === 0 && f.length > 10 ? f.length -= 10 : f.length -= 9; - }, R.prototype.imulK = function(f) { - f.words[f.length] = 0, f.words[f.length + 1] = 0, f.length += 2; - for (var g = 0, b = 0; b < f.length; b++) { - var x = f.words[b] | 0; - g += x * 977, f.words[b] = g & 67108863, g = x * 64 + (g / 67108864 | 0); - } - return f.words[f.length - 1] === 0 && (f.length--, f.words[f.length - 1] === 0 && f.length--), f; - }; - function K() { - Q.call( - this, - "p224", - "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001" - ); - } - i(K, Q); - function ge() { - Q.call( - this, - "p192", - "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff" - ); - } - i(ge, Q); - function Ee() { - Q.call( - this, - "25519", - "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed" - ); - } - i(Ee, Q), Ee.prototype.imulK = function(f) { - for (var g = 0, b = 0; b < f.length; b++) { - var x = (f.words[b] | 0) * 19 + g, E = x & 67108863; - x >>>= 26, f.words[b] = E, g = x; - } - return g !== 0 && (f.words[f.length++] = g), f; - }, s._prime = function(f) { - if (V[f]) return V[f]; - var g; - if (f === "k256") - g = new R(); - else if (f === "p224") - g = new K(); - else if (f === "p192") - g = new ge(); - else if (f === "p25519") - g = new Ee(); - else - throw new Error("Unknown prime " + f); - return V[f] = g, g; - }; - function Y(m) { - if (typeof m == "string") { - var f = s._prime(m); - this.m = f.p, this.prime = f; - } else - n(m.gtn(1), "modulus must be greater than 1"), this.m = m, this.prime = null; - } - Y.prototype._verify1 = function(f) { - n(f.negative === 0, "red works only with positives"), n(f.red, "red works only with red numbers"); - }, Y.prototype._verify2 = function(f, g) { - n((f.negative | g.negative) === 0, "red works only with positives"), n( - f.red && f.red === g.red, - "red works only with red numbers" - ); - }, Y.prototype.imod = function(f) { - return this.prime ? this.prime.ireduce(f)._forceRed(this) : (d(f, f.umod(this.m)._forceRed(this)), f); - }, Y.prototype.neg = function(f) { - return f.isZero() ? f.clone() : this.m.sub(f)._forceRed(this); - }, Y.prototype.add = function(f, g) { - this._verify2(f, g); - var b = f.add(g); - return b.cmp(this.m) >= 0 && b.isub(this.m), b._forceRed(this); - }, Y.prototype.iadd = function(f, g) { - this._verify2(f, g); - var b = f.iadd(g); - return b.cmp(this.m) >= 0 && b.isub(this.m), b; - }, Y.prototype.sub = function(f, g) { - this._verify2(f, g); - var b = f.sub(g); - return b.cmpn(0) < 0 && b.iadd(this.m), b._forceRed(this); - }, Y.prototype.isub = function(f, g) { - this._verify2(f, g); - var b = f.isub(g); - return b.cmpn(0) < 0 && b.iadd(this.m), b; - }, Y.prototype.shl = function(f, g) { - return this._verify1(f), this.imod(f.ushln(g)); - }, Y.prototype.imul = function(f, g) { - return this._verify2(f, g), this.imod(f.imul(g)); - }, Y.prototype.mul = function(f, g) { - return this._verify2(f, g), this.imod(f.mul(g)); - }, Y.prototype.isqr = function(f) { - return this.imul(f, f.clone()); - }, Y.prototype.sqr = function(f) { - return this.mul(f, f); - }, Y.prototype.sqrt = function(f) { - if (f.isZero()) return f.clone(); - var g = this.m.andln(3); - if (n(g % 2 === 1), g === 3) { - var b = this.m.add(new s(1)).iushrn(2); - return this.pow(f, b); - } - for (var x = this.m.subn(1), E = 0; !x.isZero() && x.andln(1) === 0; ) - E++, x.iushrn(1); - n(!x.isZero()); - var S = new s(1).toRed(this), v = S.redNeg(), M = this.m.subn(1).iushrn(1), I = this.m.bitLength(); - for (I = new s(2 * I * I).toRed(this); this.pow(I, M).cmp(v) !== 0; ) - I.redIAdd(v); - for (var F = this.pow(I, x), ce = this.pow(f, x.addn(1).iushrn(1)), D = this.pow(f, x), oe = E; D.cmp(S) !== 0; ) { - for (var Z = D, J = 0; Z.cmp(S) !== 0; J++) - Z = Z.redSqr(); - n(J < oe); - var ee = this.pow(F, new s(1).iushln(oe - J - 1)); - ce = ce.redMul(ee), F = ee.redSqr(), D = D.redMul(F), oe = J; - } - return ce; - }, Y.prototype.invm = function(f) { - var g = f._invmp(this.m); - return g.negative !== 0 ? (g.negative = 0, this.imod(g).redNeg()) : this.imod(g); - }, Y.prototype.pow = function(f, g) { - if (g.isZero()) return new s(1).toRed(this); - if (g.cmpn(1) === 0) return f.clone(); - var b = 4, x = new Array(1 << b); - x[0] = new s(1).toRed(this), x[1] = f; - for (var E = 2; E < x.length; E++) - x[E] = this.mul(x[E - 1], f); - var S = x[0], v = 0, M = 0, I = g.bitLength() % 26; - for (I === 0 && (I = 26), E = g.length - 1; E >= 0; E--) { - for (var F = g.words[E], ce = I - 1; ce >= 0; ce--) { - var D = F >> ce & 1; - if (S !== x[0] && (S = this.sqr(S)), D === 0 && v === 0) { - M = 0; - continue; - } - v <<= 1, v |= D, M++, !(M !== b && (E !== 0 || ce !== 0)) && (S = this.mul(S, x[v]), M = 0, v = 0); - } - I = 26; - } - return S; - }, Y.prototype.convertTo = function(f) { - var g = f.umod(this.m); - return g === f ? g.clone() : g; - }, Y.prototype.convertFrom = function(f) { - var g = f.clone(); - return g.red = null, g; - }, s.mont = function(f) { - return new A(f); - }; - function A(m) { - Y.call(this, m), this.shift = this.m.bitLength(), this.shift % 26 !== 0 && (this.shift += 26 - this.shift % 26), this.r = new s(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this.rinv = this.r._invmp(this.m), this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv = this.minv.umod(this.r), this.minv = this.r.sub(this.minv); - } - i(A, Y), A.prototype.convertTo = function(f) { - return this.imod(f.ushln(this.shift)); - }, A.prototype.convertFrom = function(f) { - var g = this.imod(f.mul(this.rinv)); - return g.red = null, g; - }, A.prototype.imul = function(f, g) { - if (f.isZero() || g.isZero()) - return f.words[0] = 0, f.length = 1, f; - var b = f.imul(g), x = b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), E = b.isub(x).iushrn(this.shift), S = E; - return E.cmp(this.m) >= 0 ? S = E.isub(this.m) : E.cmpn(0) < 0 && (S = E.iadd(this.m)), S._forceRed(this); - }, A.prototype.mul = function(f, g) { - if (f.isZero() || g.isZero()) return new s(0)._forceRed(this); - var b = f.mul(g), x = b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), E = b.isub(x).iushrn(this.shift), S = E; - return E.cmp(this.m) >= 0 ? S = E.isub(this.m) : E.cmpn(0) < 0 && (S = E.iadd(this.m)), S._forceRed(this); - }, A.prototype.invm = function(f) { - var g = this.imod(f._invmp(this.m).mul(this.r2)); - return g._forceRed(this); - }; - })(t, gn); -})(ib); -var hj = ib.exports; -const sr = /* @__PURE__ */ ns(hj); -var dj = sr.BN; -function pj(t) { - return new dj(t, 36).toString(16); -} -const gj = "strings/5.7.0", mj = new Yr(gj); -var p0; -(function(t) { - t.current = "", t.NFC = "NFC", t.NFD = "NFD", t.NFKC = "NFKC", t.NFKD = "NFKD"; -})(p0 || (p0 = {})); -var Lx; -(function(t) { - t.UNEXPECTED_CONTINUE = "unexpected continuation byte", t.BAD_PREFIX = "bad codepoint prefix", t.OVERRUN = "string overrun", t.MISSING_CONTINUE = "missing continuation byte", t.OUT_OF_RANGE = "out of UTF-8 range", t.UTF16_SURROGATE = "UTF-16 surrogate", t.OVERLONG = "overlong representation"; -})(Lx || (Lx = {})); -function pm(t, e = p0.current) { - e != p0.current && (mj.checkNormalize(), t = t.normalize(e)); - let r = []; - for (let n = 0; n < t.length; n++) { - const i = t.charCodeAt(n); - if (i < 128) - r.push(i); - else if (i < 2048) - r.push(i >> 6 | 192), r.push(i & 63 | 128); - else if ((i & 64512) == 55296) { - n++; - const s = t.charCodeAt(n); - if (n >= t.length || (s & 64512) !== 56320) - throw new Error("invalid utf-8 string"); - const o = 65536 + ((i & 1023) << 10) + (s & 1023); - r.push(o >> 18 | 240), r.push(o >> 12 & 63 | 128), r.push(o >> 6 & 63 | 128), r.push(o & 63 | 128); - } else - r.push(i >> 12 | 224), r.push(i >> 6 & 63 | 128), r.push(i & 63 | 128); - } - return wn(r); -} -const vj = `Ethereum Signed Message: -`; -function _8(t) { - return typeof t == "string" && (t = pm(t)), nb(uj([ - pm(vj), - pm(String(t.length)), - t - ])); -} -const bj = "address/5.7.0", Hf = new Yr(bj); -function kx(t) { - Ks(t, 20) || Hf.throwArgumentError("invalid address", "address", t), t = t.toLowerCase(); - const e = t.substring(2).split(""), r = new Uint8Array(40); - for (let i = 0; i < 40; i++) - r[i] = e[i].charCodeAt(0); - const n = wn(nb(r)); - for (let i = 0; i < 40; i += 2) - n[i >> 1] >> 4 >= 8 && (e[i] = e[i].toUpperCase()), (n[i >> 1] & 15) >= 8 && (e[i + 1] = e[i + 1].toUpperCase()); - return "0x" + e.join(""); -} -const yj = 9007199254740991; -function wj(t) { - return Math.log10 ? Math.log10(t) : Math.log(t) / Math.LN10; -} -const sb = {}; -for (let t = 0; t < 10; t++) - sb[String(t)] = String(t); -for (let t = 0; t < 26; t++) - sb[String.fromCharCode(65 + t)] = String(10 + t); -const $x = Math.floor(wj(yj)); -function xj(t) { - t = t.toUpperCase(), t = t.substring(4) + t.substring(0, 2) + "00"; - let e = t.split("").map((n) => sb[n]).join(""); - for (; e.length >= $x; ) { - let n = e.substring(0, $x); - e = parseInt(n, 10) % 97 + e.substring(n.length); - } - let r = String(98 - parseInt(e, 10) % 97); - for (; r.length < 2; ) - r = "0" + r; - return r; -} -function _j(t) { - let e = null; - if (typeof t != "string" && Hf.throwArgumentError("invalid address", "address", t), t.match(/^(0x)?[0-9a-fA-F]{40}$/)) - t.substring(0, 2) !== "0x" && (t = "0x" + t), e = kx(t), t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && e !== t && Hf.throwArgumentError("bad address checksum", "address", t); - else if (t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { - for (t.substring(2, 4) !== xj(t) && Hf.throwArgumentError("bad icap checksum", "address", t), e = pj(t.substring(4)); e.length < 40; ) - e = "0" + e; - e = kx("0x" + e); - } else - Hf.throwArgumentError("invalid address", "address", t); - return e; -} -function Tf(t, e, r) { - Object.defineProperty(t, e, { - enumerable: !0, - value: r, - writable: !1 - }); -} -var rh = {}, _r = {}, Tc = E8; -function E8(t, e) { - if (!t) - throw new Error(e || "Assertion failed"); -} -E8.equal = function(e, r, n) { - if (e != r) - throw new Error(n || "Assertion failed: " + e + " != " + r); -}; -var k1 = { exports: {} }; -typeof Object.create == "function" ? k1.exports = function(e, r) { - r && (e.super_ = r, e.prototype = Object.create(r.prototype, { - constructor: { - value: e, - enumerable: !1, - writable: !0, - configurable: !0 - } - })); -} : k1.exports = function(e, r) { - if (r) { - e.super_ = r; - var n = function() { - }; - n.prototype = r.prototype, e.prototype = new n(), e.prototype.constructor = e; - } -}; -var np = k1.exports, Ej = Tc, Sj = np; -_r.inherits = Sj; -function Aj(t, e) { - return (t.charCodeAt(e) & 64512) !== 55296 || e < 0 || e + 1 >= t.length ? !1 : (t.charCodeAt(e + 1) & 64512) === 56320; -} -function Pj(t, e) { - if (Array.isArray(t)) - return t.slice(); - if (!t) - return []; - var r = []; - if (typeof t == "string") - if (e) { - if (e === "hex") - for (t = t.replace(/[^a-z0-9]+/ig, ""), t.length % 2 !== 0 && (t = "0" + t), i = 0; i < t.length; i += 2) - r.push(parseInt(t[i] + t[i + 1], 16)); - } else for (var n = 0, i = 0; i < t.length; i++) { - var s = t.charCodeAt(i); - s < 128 ? r[n++] = s : s < 2048 ? (r[n++] = s >> 6 | 192, r[n++] = s & 63 | 128) : Aj(t, i) ? (s = 65536 + ((s & 1023) << 10) + (t.charCodeAt(++i) & 1023), r[n++] = s >> 18 | 240, r[n++] = s >> 12 & 63 | 128, r[n++] = s >> 6 & 63 | 128, r[n++] = s & 63 | 128) : (r[n++] = s >> 12 | 224, r[n++] = s >> 6 & 63 | 128, r[n++] = s & 63 | 128); - } - else - for (i = 0; i < t.length; i++) - r[i] = t[i] | 0; - return r; -} -_r.toArray = Pj; -function Mj(t) { - for (var e = "", r = 0; r < t.length; r++) - e += A8(t[r].toString(16)); - return e; -} -_r.toHex = Mj; -function S8(t) { - var e = t >>> 24 | t >>> 8 & 65280 | t << 8 & 16711680 | (t & 255) << 24; - return e >>> 0; -} -_r.htonl = S8; -function Ij(t, e) { - for (var r = "", n = 0; n < t.length; n++) { - var i = t[n]; - e === "little" && (i = S8(i)), r += P8(i.toString(16)); - } - return r; -} -_r.toHex32 = Ij; -function A8(t) { - return t.length === 1 ? "0" + t : t; -} -_r.zero2 = A8; -function P8(t) { - return t.length === 7 ? "0" + t : t.length === 6 ? "00" + t : t.length === 5 ? "000" + t : t.length === 4 ? "0000" + t : t.length === 3 ? "00000" + t : t.length === 2 ? "000000" + t : t.length === 1 ? "0000000" + t : t; -} -_r.zero8 = P8; -function Cj(t, e, r, n) { - var i = r - e; - Ej(i % 4 === 0); - for (var s = new Array(i / 4), o = 0, a = e; o < s.length; o++, a += 4) { - var u; - n === "big" ? u = t[a] << 24 | t[a + 1] << 16 | t[a + 2] << 8 | t[a + 3] : u = t[a + 3] << 24 | t[a + 2] << 16 | t[a + 1] << 8 | t[a], s[o] = u >>> 0; - } - return s; -} -_r.join32 = Cj; -function Tj(t, e) { - for (var r = new Array(t.length * 4), n = 0, i = 0; n < t.length; n++, i += 4) { - var s = t[n]; - e === "big" ? (r[i] = s >>> 24, r[i + 1] = s >>> 16 & 255, r[i + 2] = s >>> 8 & 255, r[i + 3] = s & 255) : (r[i + 3] = s >>> 24, r[i + 2] = s >>> 16 & 255, r[i + 1] = s >>> 8 & 255, r[i] = s & 255); - } - return r; -} -_r.split32 = Tj; -function Rj(t, e) { - return t >>> e | t << 32 - e; -} -_r.rotr32 = Rj; -function Dj(t, e) { - return t << e | t >>> 32 - e; -} -_r.rotl32 = Dj; -function Oj(t, e) { - return t + e >>> 0; -} -_r.sum32 = Oj; -function Nj(t, e, r) { - return t + e + r >>> 0; -} -_r.sum32_3 = Nj; -function Lj(t, e, r, n) { - return t + e + r + n >>> 0; -} -_r.sum32_4 = Lj; -function kj(t, e, r, n, i) { - return t + e + r + n + i >>> 0; -} -_r.sum32_5 = kj; -function $j(t, e, r, n) { - var i = t[e], s = t[e + 1], o = n + s >>> 0, a = (o < n ? 1 : 0) + r + i; - t[e] = a >>> 0, t[e + 1] = o; -} -_r.sum64 = $j; -function Bj(t, e, r, n) { - var i = e + n >>> 0, s = (i < e ? 1 : 0) + t + r; - return s >>> 0; -} -_r.sum64_hi = Bj; -function Fj(t, e, r, n) { - var i = e + n; - return i >>> 0; -} -_r.sum64_lo = Fj; -function jj(t, e, r, n, i, s, o, a) { - var u = 0, l = e; - l = l + n >>> 0, u += l < e ? 1 : 0, l = l + s >>> 0, u += l < s ? 1 : 0, l = l + a >>> 0, u += l < a ? 1 : 0; - var d = t + r + i + o + u; - return d >>> 0; -} -_r.sum64_4_hi = jj; -function Uj(t, e, r, n, i, s, o, a) { - var u = e + n + s + a; - return u >>> 0; -} -_r.sum64_4_lo = Uj; -function qj(t, e, r, n, i, s, o, a, u, l) { - var d = 0, p = e; - p = p + n >>> 0, d += p < e ? 1 : 0, p = p + s >>> 0, d += p < s ? 1 : 0, p = p + a >>> 0, d += p < a ? 1 : 0, p = p + l >>> 0, d += p < l ? 1 : 0; - var w = t + r + i + o + u + d; - return w >>> 0; -} -_r.sum64_5_hi = qj; -function zj(t, e, r, n, i, s, o, a, u, l) { - var d = e + n + s + a + l; - return d >>> 0; -} -_r.sum64_5_lo = zj; -function Wj(t, e, r) { - var n = e << 32 - r | t >>> r; - return n >>> 0; -} -_r.rotr64_hi = Wj; -function Hj(t, e, r) { - var n = t << 32 - r | e >>> r; - return n >>> 0; -} -_r.rotr64_lo = Hj; -function Kj(t, e, r) { - return t >>> r; -} -_r.shr64_hi = Kj; -function Vj(t, e, r) { - var n = t << 32 - r | e >>> r; - return n >>> 0; -} -_r.shr64_lo = Vj; -var zu = {}, Bx = _r, Gj = Tc; -function ip() { - this.pending = null, this.pendingTotal = 0, this.blockSize = this.constructor.blockSize, this.outSize = this.constructor.outSize, this.hmacStrength = this.constructor.hmacStrength, this.padLength = this.constructor.padLength / 8, this.endian = "big", this._delta8 = this.blockSize / 8, this._delta32 = this.blockSize / 32; -} -zu.BlockHash = ip; -ip.prototype.update = function(e, r) { - if (e = Bx.toArray(e, r), this.pending ? this.pending = this.pending.concat(e) : this.pending = e, this.pendingTotal += e.length, this.pending.length >= this._delta8) { - e = this.pending; - var n = e.length % this._delta8; - this.pending = e.slice(e.length - n, e.length), this.pending.length === 0 && (this.pending = null), e = Bx.join32(e, 0, e.length - n, this.endian); - for (var i = 0; i < e.length; i += this._delta32) - this._update(e, i, i + this._delta32); - } - return this; -}; -ip.prototype.digest = function(e) { - return this.update(this._pad()), Gj(this.pending === null), this._digest(e); -}; -ip.prototype._pad = function() { - var e = this.pendingTotal, r = this._delta8, n = r - (e + this.padLength) % r, i = new Array(n + this.padLength); - i[0] = 128; - for (var s = 1; s < n; s++) - i[s] = 0; - if (e <<= 3, this.endian === "big") { - for (var o = 8; o < this.padLength; o++) - i[s++] = 0; - i[s++] = 0, i[s++] = 0, i[s++] = 0, i[s++] = 0, i[s++] = e >>> 24 & 255, i[s++] = e >>> 16 & 255, i[s++] = e >>> 8 & 255, i[s++] = e & 255; - } else - for (i[s++] = e & 255, i[s++] = e >>> 8 & 255, i[s++] = e >>> 16 & 255, i[s++] = e >>> 24 & 255, i[s++] = 0, i[s++] = 0, i[s++] = 0, i[s++] = 0, o = 8; o < this.padLength; o++) - i[s++] = 0; - return i; -}; -var Wu = {}, so = {}, Yj = _r, Vs = Yj.rotr32; -function Jj(t, e, r, n) { - if (t === 0) - return M8(e, r, n); - if (t === 1 || t === 3) - return C8(e, r, n); - if (t === 2) - return I8(e, r, n); -} -so.ft_1 = Jj; -function M8(t, e, r) { - return t & e ^ ~t & r; -} -so.ch32 = M8; -function I8(t, e, r) { - return t & e ^ t & r ^ e & r; -} -so.maj32 = I8; -function C8(t, e, r) { - return t ^ e ^ r; -} -so.p32 = C8; -function Xj(t) { - return Vs(t, 2) ^ Vs(t, 13) ^ Vs(t, 22); -} -so.s0_256 = Xj; -function Zj(t) { - return Vs(t, 6) ^ Vs(t, 11) ^ Vs(t, 25); -} -so.s1_256 = Zj; -function Qj(t) { - return Vs(t, 7) ^ Vs(t, 18) ^ t >>> 3; -} -so.g0_256 = Qj; -function eU(t) { - return Vs(t, 17) ^ Vs(t, 19) ^ t >>> 10; -} -so.g1_256 = eU; -var Du = _r, tU = zu, rU = so, gm = Du.rotl32, Rf = Du.sum32, nU = Du.sum32_5, iU = rU.ft_1, T8 = tU.BlockHash, sU = [ - 1518500249, - 1859775393, - 2400959708, - 3395469782 -]; -function Qs() { - if (!(this instanceof Qs)) - return new Qs(); - T8.call(this), this.h = [ - 1732584193, - 4023233417, - 2562383102, - 271733878, - 3285377520 - ], this.W = new Array(80); -} -Du.inherits(Qs, T8); -var oU = Qs; -Qs.blockSize = 512; -Qs.outSize = 160; -Qs.hmacStrength = 80; -Qs.padLength = 64; -Qs.prototype._update = function(e, r) { - for (var n = this.W, i = 0; i < 16; i++) - n[i] = e[r + i]; - for (; i < n.length; i++) - n[i] = gm(n[i - 3] ^ n[i - 8] ^ n[i - 14] ^ n[i - 16], 1); - var s = this.h[0], o = this.h[1], a = this.h[2], u = this.h[3], l = this.h[4]; - for (i = 0; i < n.length; i++) { - var d = ~~(i / 20), p = nU(gm(s, 5), iU(d, o, a, u), l, n[i], sU[d]); - l = u, u = a, a = gm(o, 30), o = s, s = p; - } - this.h[0] = Rf(this.h[0], s), this.h[1] = Rf(this.h[1], o), this.h[2] = Rf(this.h[2], a), this.h[3] = Rf(this.h[3], u), this.h[4] = Rf(this.h[4], l); -}; -Qs.prototype._digest = function(e) { - return e === "hex" ? Du.toHex32(this.h, "big") : Du.split32(this.h, "big"); -}; -var Ou = _r, aU = zu, Hu = so, cU = Tc, bs = Ou.sum32, uU = Ou.sum32_4, fU = Ou.sum32_5, lU = Hu.ch32, hU = Hu.maj32, dU = Hu.s0_256, pU = Hu.s1_256, gU = Hu.g0_256, mU = Hu.g1_256, R8 = aU.BlockHash, vU = [ - 1116352408, - 1899447441, - 3049323471, - 3921009573, - 961987163, - 1508970993, - 2453635748, - 2870763221, - 3624381080, - 310598401, - 607225278, - 1426881987, - 1925078388, - 2162078206, - 2614888103, - 3248222580, - 3835390401, - 4022224774, - 264347078, - 604807628, - 770255983, - 1249150122, - 1555081692, - 1996064986, - 2554220882, - 2821834349, - 2952996808, - 3210313671, - 3336571891, - 3584528711, - 113926993, - 338241895, - 666307205, - 773529912, - 1294757372, - 1396182291, - 1695183700, - 1986661051, - 2177026350, - 2456956037, - 2730485921, - 2820302411, - 3259730800, - 3345764771, - 3516065817, - 3600352804, - 4094571909, - 275423344, - 430227734, - 506948616, - 659060556, - 883997877, - 958139571, - 1322822218, - 1537002063, - 1747873779, - 1955562222, - 2024104815, - 2227730452, - 2361852424, - 2428436474, - 2756734187, - 3204031479, - 3329325298 -]; -function eo() { - if (!(this instanceof eo)) - return new eo(); - R8.call(this), this.h = [ - 1779033703, - 3144134277, - 1013904242, - 2773480762, - 1359893119, - 2600822924, - 528734635, - 1541459225 - ], this.k = vU, this.W = new Array(64); -} -Ou.inherits(eo, R8); -var D8 = eo; -eo.blockSize = 512; -eo.outSize = 256; -eo.hmacStrength = 192; -eo.padLength = 64; -eo.prototype._update = function(e, r) { - for (var n = this.W, i = 0; i < 16; i++) - n[i] = e[r + i]; - for (; i < n.length; i++) - n[i] = uU(mU(n[i - 2]), n[i - 7], gU(n[i - 15]), n[i - 16]); - var s = this.h[0], o = this.h[1], a = this.h[2], u = this.h[3], l = this.h[4], d = this.h[5], p = this.h[6], w = this.h[7]; - for (cU(this.k.length === n.length), i = 0; i < n.length; i++) { - var _ = fU(w, pU(l), lU(l, d, p), this.k[i], n[i]), P = bs(dU(s), hU(s, o, a)); - w = p, p = d, d = l, l = bs(u, _), u = a, a = o, o = s, s = bs(_, P); - } - this.h[0] = bs(this.h[0], s), this.h[1] = bs(this.h[1], o), this.h[2] = bs(this.h[2], a), this.h[3] = bs(this.h[3], u), this.h[4] = bs(this.h[4], l), this.h[5] = bs(this.h[5], d), this.h[6] = bs(this.h[6], p), this.h[7] = bs(this.h[7], w); -}; -eo.prototype._digest = function(e) { - return e === "hex" ? Ou.toHex32(this.h, "big") : Ou.split32(this.h, "big"); -}; -var $1 = _r, O8 = D8; -function qo() { - if (!(this instanceof qo)) - return new qo(); - O8.call(this), this.h = [ - 3238371032, - 914150663, - 812702999, - 4144912697, - 4290775857, - 1750603025, - 1694076839, - 3204075428 - ]; -} -$1.inherits(qo, O8); -var bU = qo; -qo.blockSize = 512; -qo.outSize = 224; -qo.hmacStrength = 192; -qo.padLength = 64; -qo.prototype._digest = function(e) { - return e === "hex" ? $1.toHex32(this.h.slice(0, 7), "big") : $1.split32(this.h.slice(0, 7), "big"); -}; -var Ei = _r, yU = zu, wU = Tc, Gs = Ei.rotr64_hi, Ys = Ei.rotr64_lo, N8 = Ei.shr64_hi, L8 = Ei.shr64_lo, na = Ei.sum64, mm = Ei.sum64_hi, vm = Ei.sum64_lo, xU = Ei.sum64_4_hi, _U = Ei.sum64_4_lo, EU = Ei.sum64_5_hi, SU = Ei.sum64_5_lo, k8 = yU.BlockHash, AU = [ - 1116352408, - 3609767458, - 1899447441, - 602891725, - 3049323471, - 3964484399, - 3921009573, - 2173295548, - 961987163, - 4081628472, - 1508970993, - 3053834265, - 2453635748, - 2937671579, - 2870763221, - 3664609560, - 3624381080, - 2734883394, - 310598401, - 1164996542, - 607225278, - 1323610764, - 1426881987, - 3590304994, - 1925078388, - 4068182383, - 2162078206, - 991336113, - 2614888103, - 633803317, - 3248222580, - 3479774868, - 3835390401, - 2666613458, - 4022224774, - 944711139, - 264347078, - 2341262773, - 604807628, - 2007800933, - 770255983, - 1495990901, - 1249150122, - 1856431235, - 1555081692, - 3175218132, - 1996064986, - 2198950837, - 2554220882, - 3999719339, - 2821834349, - 766784016, - 2952996808, - 2566594879, - 3210313671, - 3203337956, - 3336571891, - 1034457026, - 3584528711, - 2466948901, - 113926993, - 3758326383, - 338241895, - 168717936, - 666307205, - 1188179964, - 773529912, - 1546045734, - 1294757372, - 1522805485, - 1396182291, - 2643833823, - 1695183700, - 2343527390, - 1986661051, - 1014477480, - 2177026350, - 1206759142, - 2456956037, - 344077627, - 2730485921, - 1290863460, - 2820302411, - 3158454273, - 3259730800, - 3505952657, - 3345764771, - 106217008, - 3516065817, - 3606008344, - 3600352804, - 1432725776, - 4094571909, - 1467031594, - 275423344, - 851169720, - 430227734, - 3100823752, - 506948616, - 1363258195, - 659060556, - 3750685593, - 883997877, - 3785050280, - 958139571, - 3318307427, - 1322822218, - 3812723403, - 1537002063, - 2003034995, - 1747873779, - 3602036899, - 1955562222, - 1575990012, - 2024104815, - 1125592928, - 2227730452, - 2716904306, - 2361852424, - 442776044, - 2428436474, - 593698344, - 2756734187, - 3733110249, - 3204031479, - 2999351573, - 3329325298, - 3815920427, - 3391569614, - 3928383900, - 3515267271, - 566280711, - 3940187606, - 3454069534, - 4118630271, - 4000239992, - 116418474, - 1914138554, - 174292421, - 2731055270, - 289380356, - 3203993006, - 460393269, - 320620315, - 685471733, - 587496836, - 852142971, - 1086792851, - 1017036298, - 365543100, - 1126000580, - 2618297676, - 1288033470, - 3409855158, - 1501505948, - 4234509866, - 1607167915, - 987167468, - 1816402316, - 1246189591 -]; -function Is() { - if (!(this instanceof Is)) - return new Is(); - k8.call(this), this.h = [ - 1779033703, - 4089235720, - 3144134277, - 2227873595, - 1013904242, - 4271175723, - 2773480762, - 1595750129, - 1359893119, - 2917565137, - 2600822924, - 725511199, - 528734635, - 4215389547, - 1541459225, - 327033209 - ], this.k = AU, this.W = new Array(160); -} -Ei.inherits(Is, k8); -var $8 = Is; -Is.blockSize = 1024; -Is.outSize = 512; -Is.hmacStrength = 192; -Is.padLength = 128; -Is.prototype._prepareBlock = function(e, r) { - for (var n = this.W, i = 0; i < 32; i++) - n[i] = e[r + i]; - for (; i < n.length; i += 2) { - var s = kU(n[i - 4], n[i - 3]), o = $U(n[i - 4], n[i - 3]), a = n[i - 14], u = n[i - 13], l = NU(n[i - 30], n[i - 29]), d = LU(n[i - 30], n[i - 29]), p = n[i - 32], w = n[i - 31]; - n[i] = xU( - s, - o, - a, - u, - l, - d, - p, - w - ), n[i + 1] = _U( - s, - o, - a, - u, - l, - d, - p, - w - ); - } -}; -Is.prototype._update = function(e, r) { - this._prepareBlock(e, r); - var n = this.W, i = this.h[0], s = this.h[1], o = this.h[2], a = this.h[3], u = this.h[4], l = this.h[5], d = this.h[6], p = this.h[7], w = this.h[8], _ = this.h[9], P = this.h[10], O = this.h[11], L = this.h[12], B = this.h[13], k = this.h[14], W = this.h[15]; - wU(this.k.length === n.length); - for (var U = 0; U < n.length; U += 2) { - var V = k, Q = W, R = DU(w, _), K = OU(w, _), ge = PU(w, _, P, O, L), Ee = MU(w, _, P, O, L, B), Y = this.k[U], A = this.k[U + 1], m = n[U], f = n[U + 1], g = EU( - V, - Q, - R, - K, - ge, - Ee, - Y, - A, - m, - f - ), b = SU( - V, - Q, - R, - K, - ge, - Ee, - Y, - A, - m, - f - ); - V = TU(i, s), Q = RU(i, s), R = IU(i, s, o, a, u), K = CU(i, s, o, a, u, l); - var x = mm(V, Q, R, K), E = vm(V, Q, R, K); - k = L, W = B, L = P, B = O, P = w, O = _, w = mm(d, p, g, b), _ = vm(p, p, g, b), d = u, p = l, u = o, l = a, o = i, a = s, i = mm(g, b, x, E), s = vm(g, b, x, E); - } - na(this.h, 0, i, s), na(this.h, 2, o, a), na(this.h, 4, u, l), na(this.h, 6, d, p), na(this.h, 8, w, _), na(this.h, 10, P, O), na(this.h, 12, L, B), na(this.h, 14, k, W); -}; -Is.prototype._digest = function(e) { - return e === "hex" ? Ei.toHex32(this.h, "big") : Ei.split32(this.h, "big"); -}; -function PU(t, e, r, n, i) { - var s = t & r ^ ~t & i; - return s < 0 && (s += 4294967296), s; -} -function MU(t, e, r, n, i, s) { - var o = e & n ^ ~e & s; - return o < 0 && (o += 4294967296), o; -} -function IU(t, e, r, n, i) { - var s = t & r ^ t & i ^ r & i; - return s < 0 && (s += 4294967296), s; -} -function CU(t, e, r, n, i, s) { - var o = e & n ^ e & s ^ n & s; - return o < 0 && (o += 4294967296), o; -} -function TU(t, e) { - var r = Gs(t, e, 28), n = Gs(e, t, 2), i = Gs(e, t, 7), s = r ^ n ^ i; - return s < 0 && (s += 4294967296), s; -} -function RU(t, e) { - var r = Ys(t, e, 28), n = Ys(e, t, 2), i = Ys(e, t, 7), s = r ^ n ^ i; - return s < 0 && (s += 4294967296), s; -} -function DU(t, e) { - var r = Gs(t, e, 14), n = Gs(t, e, 18), i = Gs(e, t, 9), s = r ^ n ^ i; - return s < 0 && (s += 4294967296), s; -} -function OU(t, e) { - var r = Ys(t, e, 14), n = Ys(t, e, 18), i = Ys(e, t, 9), s = r ^ n ^ i; - return s < 0 && (s += 4294967296), s; -} -function NU(t, e) { - var r = Gs(t, e, 1), n = Gs(t, e, 8), i = N8(t, e, 7), s = r ^ n ^ i; - return s < 0 && (s += 4294967296), s; -} -function LU(t, e) { - var r = Ys(t, e, 1), n = Ys(t, e, 8), i = L8(t, e, 7), s = r ^ n ^ i; - return s < 0 && (s += 4294967296), s; -} -function kU(t, e) { - var r = Gs(t, e, 19), n = Gs(e, t, 29), i = N8(t, e, 6), s = r ^ n ^ i; - return s < 0 && (s += 4294967296), s; -} -function $U(t, e) { - var r = Ys(t, e, 19), n = Ys(e, t, 29), i = L8(t, e, 6), s = r ^ n ^ i; - return s < 0 && (s += 4294967296), s; -} -var B1 = _r, B8 = $8; -function zo() { - if (!(this instanceof zo)) - return new zo(); - B8.call(this), this.h = [ - 3418070365, - 3238371032, - 1654270250, - 914150663, - 2438529370, - 812702999, - 355462360, - 4144912697, - 1731405415, - 4290775857, - 2394180231, - 1750603025, - 3675008525, - 1694076839, - 1203062813, - 3204075428 - ]; -} -B1.inherits(zo, B8); -var BU = zo; -zo.blockSize = 1024; -zo.outSize = 384; -zo.hmacStrength = 192; -zo.padLength = 128; -zo.prototype._digest = function(e) { - return e === "hex" ? B1.toHex32(this.h.slice(0, 12), "big") : B1.split32(this.h.slice(0, 12), "big"); -}; -Wu.sha1 = oU; -Wu.sha224 = bU; -Wu.sha256 = D8; -Wu.sha384 = BU; -Wu.sha512 = $8; -var F8 = {}, yc = _r, FU = zu, wd = yc.rotl32, Fx = yc.sum32, Df = yc.sum32_3, jx = yc.sum32_4, j8 = FU.BlockHash; -function to() { - if (!(this instanceof to)) - return new to(); - j8.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = "little"; -} -yc.inherits(to, j8); -F8.ripemd160 = to; -to.blockSize = 512; -to.outSize = 160; -to.hmacStrength = 192; -to.padLength = 64; -to.prototype._update = function(e, r) { - for (var n = this.h[0], i = this.h[1], s = this.h[2], o = this.h[3], a = this.h[4], u = n, l = i, d = s, p = o, w = a, _ = 0; _ < 80; _++) { - var P = Fx( - wd( - jx(n, Ux(_, i, s, o), e[qU[_] + r], jU(_)), - WU[_] - ), - a - ); - n = a, a = o, o = wd(s, 10), s = i, i = P, P = Fx( - wd( - jx(u, Ux(79 - _, l, d, p), e[zU[_] + r], UU(_)), - HU[_] - ), - w - ), u = w, w = p, p = wd(d, 10), d = l, l = P; - } - P = Df(this.h[1], s, p), this.h[1] = Df(this.h[2], o, w), this.h[2] = Df(this.h[3], a, u), this.h[3] = Df(this.h[4], n, l), this.h[4] = Df(this.h[0], i, d), this.h[0] = P; -}; -to.prototype._digest = function(e) { - return e === "hex" ? yc.toHex32(this.h, "little") : yc.split32(this.h, "little"); -}; -function Ux(t, e, r, n) { - return t <= 15 ? e ^ r ^ n : t <= 31 ? e & r | ~e & n : t <= 47 ? (e | ~r) ^ n : t <= 63 ? e & n | r & ~n : e ^ (r | ~n); -} -function jU(t) { - return t <= 15 ? 0 : t <= 31 ? 1518500249 : t <= 47 ? 1859775393 : t <= 63 ? 2400959708 : 2840853838; -} -function UU(t) { - return t <= 15 ? 1352829926 : t <= 31 ? 1548603684 : t <= 47 ? 1836072691 : t <= 63 ? 2053994217 : 0; -} -var qU = [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 7, - 4, - 13, - 1, - 10, - 6, - 15, - 3, - 12, - 0, - 9, - 5, - 2, - 14, - 11, - 8, - 3, - 10, - 14, - 4, - 9, - 15, - 8, - 1, - 2, - 7, - 0, - 6, - 13, - 11, - 5, - 12, - 1, - 9, - 11, - 10, - 0, - 8, - 12, - 4, - 13, - 3, - 7, - 15, - 14, - 5, - 6, - 2, - 4, - 0, - 5, - 9, - 7, - 12, - 2, - 10, - 14, - 1, - 3, - 8, - 11, - 6, - 15, - 13 -], zU = [ - 5, - 14, - 7, - 0, - 9, - 2, - 11, - 4, - 13, - 6, - 15, - 8, - 1, - 10, - 3, - 12, - 6, - 11, - 3, - 7, - 0, - 13, - 5, - 10, - 14, - 15, - 8, - 12, - 4, - 9, - 1, - 2, - 15, - 5, - 1, - 3, - 7, - 14, - 6, - 9, - 11, - 8, - 12, - 2, - 10, - 0, - 4, - 13, - 8, - 6, - 4, - 1, - 3, - 11, - 15, - 0, - 5, - 12, - 2, - 13, - 9, - 7, - 10, - 14, - 12, - 15, - 10, - 4, - 1, - 5, - 8, - 7, - 6, - 2, - 13, - 14, - 0, - 3, - 9, - 11 -], WU = [ - 11, - 14, - 15, - 12, - 5, - 8, - 7, - 9, - 11, - 13, - 14, - 15, - 6, - 7, - 9, - 8, - 7, - 6, - 8, - 13, - 11, - 9, - 7, - 15, - 7, - 12, - 15, - 9, - 11, - 7, - 13, - 12, - 11, - 13, - 6, - 7, - 14, - 9, - 13, - 15, - 14, - 8, - 13, - 6, - 5, - 12, - 7, - 5, - 11, - 12, - 14, - 15, - 14, - 15, - 9, - 8, - 9, - 14, - 5, - 6, - 8, - 6, - 5, - 12, - 9, - 15, - 5, - 11, - 6, - 8, - 13, - 12, - 5, - 12, - 13, - 14, - 11, - 8, - 5, - 6 -], HU = [ - 8, - 9, - 9, - 11, - 13, - 15, - 15, - 5, - 7, - 7, - 8, - 11, - 14, - 14, - 12, - 6, - 9, - 13, - 15, - 7, - 12, - 8, - 9, - 11, - 7, - 7, - 12, - 7, - 6, - 15, - 13, - 11, - 9, - 7, - 15, - 11, - 8, - 6, - 6, - 14, - 12, - 13, - 5, - 14, - 13, - 13, - 7, - 5, - 15, - 5, - 8, - 11, - 14, - 14, - 6, - 14, - 6, - 9, - 12, - 9, - 12, - 5, - 15, - 8, - 8, - 5, - 12, - 9, - 12, - 5, - 14, - 6, - 8, - 13, - 6, - 5, - 15, - 13, - 11, - 11 -], KU = _r, VU = Tc; -function Nu(t, e, r) { - if (!(this instanceof Nu)) - return new Nu(t, e, r); - this.Hash = t, this.blockSize = t.blockSize / 8, this.outSize = t.outSize / 8, this.inner = null, this.outer = null, this._init(KU.toArray(e, r)); -} -var GU = Nu; -Nu.prototype._init = function(e) { - e.length > this.blockSize && (e = new this.Hash().update(e).digest()), VU(e.length <= this.blockSize); - for (var r = e.length; r < this.blockSize; r++) - e.push(0); - for (r = 0; r < e.length; r++) - e[r] ^= 54; - for (this.inner = new this.Hash().update(e), r = 0; r < e.length; r++) - e[r] ^= 106; - this.outer = new this.Hash().update(e); -}; -Nu.prototype.update = function(e, r) { - return this.inner.update(e, r), this; -}; -Nu.prototype.digest = function(e) { - return this.outer.update(this.inner.digest()), this.outer.digest(e); -}; -(function(t) { - var e = t; - e.utils = _r, e.common = zu, e.sha = Wu, e.ripemd = F8, e.hmac = GU, e.sha1 = e.sha.sha1, e.sha256 = e.sha.sha256, e.sha224 = e.sha.sha224, e.sha384 = e.sha.sha384, e.sha512 = e.sha.sha512, e.ripemd160 = e.ripemd.ripemd160; -})(rh); -const Eo = /* @__PURE__ */ ns(rh); -function Ku(t, e, r) { - return r = { - path: e, - exports: {}, - require: function(n, i) { - return YU(n, i ?? r.path); - } - }, t(r, r.exports), r.exports; -} -function YU() { - throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs"); -} -var ob = U8; -function U8(t, e) { - if (!t) - throw new Error(e || "Assertion failed"); -} -U8.equal = function(e, r, n) { - if (e != r) - throw new Error(n || "Assertion failed: " + e + " != " + r); -}; -var Ss = Ku(function(t, e) { - var r = e; - function n(o, a) { - if (Array.isArray(o)) - return o.slice(); - if (!o) - return []; - var u = []; - if (typeof o != "string") { - for (var l = 0; l < o.length; l++) - u[l] = o[l] | 0; - return u; - } - if (a === "hex") { - o = o.replace(/[^a-z0-9]+/ig, ""), o.length % 2 !== 0 && (o = "0" + o); - for (var l = 0; l < o.length; l += 2) - u.push(parseInt(o[l] + o[l + 1], 16)); - } else - for (var l = 0; l < o.length; l++) { - var d = o.charCodeAt(l), p = d >> 8, w = d & 255; - p ? u.push(p, w) : u.push(w); - } - return u; - } - r.toArray = n; - function i(o) { - return o.length === 1 ? "0" + o : o; - } - r.zero2 = i; - function s(o) { - for (var a = "", u = 0; u < o.length; u++) - a += i(o[u].toString(16)); - return a; - } - r.toHex = s, r.encode = function(a, u) { - return u === "hex" ? s(a) : a; - }; -}), Fi = Ku(function(t, e) { - var r = e; - r.assert = ob, r.toArray = Ss.toArray, r.zero2 = Ss.zero2, r.toHex = Ss.toHex, r.encode = Ss.encode; - function n(u, l, d) { - var p = new Array(Math.max(u.bitLength(), d) + 1); - p.fill(0); - for (var w = 1 << l + 1, _ = u.clone(), P = 0; P < p.length; P++) { - var O, L = _.andln(w - 1); - _.isOdd() ? (L > (w >> 1) - 1 ? O = (w >> 1) - L : O = L, _.isubn(O)) : O = 0, p[P] = O, _.iushrn(1); - } - return p; - } - r.getNAF = n; - function i(u, l) { - var d = [ - [], - [] - ]; - u = u.clone(), l = l.clone(); - for (var p = 0, w = 0, _; u.cmpn(-p) > 0 || l.cmpn(-w) > 0; ) { - var P = u.andln(3) + p & 3, O = l.andln(3) + w & 3; - P === 3 && (P = -1), O === 3 && (O = -1); - var L; - P & 1 ? (_ = u.andln(7) + p & 7, (_ === 3 || _ === 5) && O === 2 ? L = -P : L = P) : L = 0, d[0].push(L); - var B; - O & 1 ? (_ = l.andln(7) + w & 7, (_ === 3 || _ === 5) && P === 2 ? B = -O : B = O) : B = 0, d[1].push(B), 2 * p === L + 1 && (p = 1 - p), 2 * w === B + 1 && (w = 1 - w), u.iushrn(1), l.iushrn(1); - } - return d; - } - r.getJSF = i; - function s(u, l, d) { - var p = "_" + l; - u.prototype[l] = function() { - return this[p] !== void 0 ? this[p] : this[p] = d.call(this); - }; - } - r.cachedProperty = s; - function o(u) { - return typeof u == "string" ? r.toArray(u, "hex") : u; - } - r.parseBytes = o; - function a(u) { - return new sr(u, "hex", "le"); - } - r.intFromLE = a; -}), g0 = Fi.getNAF, JU = Fi.getJSF, m0 = Fi.assert; -function Oa(t, e) { - this.type = t, this.p = new sr(e.p, 16), this.red = e.prime ? sr.red(e.prime) : sr.mont(this.p), this.zero = new sr(0).toRed(this.red), this.one = new sr(1).toRed(this.red), this.two = new sr(2).toRed(this.red), this.n = e.n && new sr(e.n, 16), this.g = e.g && this.pointFromJSON(e.g, e.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; - var r = this.n && this.p.div(this.n); - !r || r.cmpn(100) > 0 ? this.redN = null : (this._maxwellTrick = !0, this.redN = this.n.toRed(this.red)); -} -var Rc = Oa; -Oa.prototype.point = function() { - throw new Error("Not implemented"); -}; -Oa.prototype.validate = function() { - throw new Error("Not implemented"); -}; -Oa.prototype._fixedNafMul = function(e, r) { - m0(e.precomputed); - var n = e._getDoubles(), i = g0(r, 1, this._bitLength), s = (1 << n.step + 1) - (n.step % 2 === 0 ? 2 : 1); - s /= 3; - var o = [], a, u; - for (a = 0; a < i.length; a += n.step) { - u = 0; - for (var l = a + n.step - 1; l >= a; l--) - u = (u << 1) + i[l]; - o.push(u); - } - for (var d = this.jpoint(null, null, null), p = this.jpoint(null, null, null), w = s; w > 0; w--) { - for (a = 0; a < o.length; a++) - u = o[a], u === w ? p = p.mixedAdd(n.points[a]) : u === -w && (p = p.mixedAdd(n.points[a].neg())); - d = d.add(p); - } - return d.toP(); -}; -Oa.prototype._wnafMul = function(e, r) { - var n = 4, i = e._getNAFPoints(n); - n = i.wnd; - for (var s = i.points, o = g0(r, n, this._bitLength), a = this.jpoint(null, null, null), u = o.length - 1; u >= 0; u--) { - for (var l = 0; u >= 0 && o[u] === 0; u--) - l++; - if (u >= 0 && l++, a = a.dblp(l), u < 0) - break; - var d = o[u]; - m0(d !== 0), e.type === "affine" ? d > 0 ? a = a.mixedAdd(s[d - 1 >> 1]) : a = a.mixedAdd(s[-d - 1 >> 1].neg()) : d > 0 ? a = a.add(s[d - 1 >> 1]) : a = a.add(s[-d - 1 >> 1].neg()); - } - return e.type === "affine" ? a.toP() : a; -}; -Oa.prototype._wnafMulAdd = function(e, r, n, i, s) { - var o = this._wnafT1, a = this._wnafT2, u = this._wnafT3, l = 0, d, p, w; - for (d = 0; d < i; d++) { - w = r[d]; - var _ = w._getNAFPoints(e); - o[d] = _.wnd, a[d] = _.points; - } - for (d = i - 1; d >= 1; d -= 2) { - var P = d - 1, O = d; - if (o[P] !== 1 || o[O] !== 1) { - u[P] = g0(n[P], o[P], this._bitLength), u[O] = g0(n[O], o[O], this._bitLength), l = Math.max(u[P].length, l), l = Math.max(u[O].length, l); - continue; - } - var L = [ - r[P], - /* 1 */ - null, - /* 3 */ - null, - /* 5 */ - r[O] - /* 7 */ - ]; - r[P].y.cmp(r[O].y) === 0 ? (L[1] = r[P].add(r[O]), L[2] = r[P].toJ().mixedAdd(r[O].neg())) : r[P].y.cmp(r[O].y.redNeg()) === 0 ? (L[1] = r[P].toJ().mixedAdd(r[O]), L[2] = r[P].add(r[O].neg())) : (L[1] = r[P].toJ().mixedAdd(r[O]), L[2] = r[P].toJ().mixedAdd(r[O].neg())); - var B = [ - -3, - /* -1 -1 */ - -1, - /* -1 0 */ - -5, - /* -1 1 */ - -7, - /* 0 -1 */ - 0, - /* 0 0 */ - 7, - /* 0 1 */ - 5, - /* 1 -1 */ - 1, - /* 1 0 */ - 3 - /* 1 1 */ - ], k = JU(n[P], n[O]); - for (l = Math.max(k[0].length, l), u[P] = new Array(l), u[O] = new Array(l), p = 0; p < l; p++) { - var W = k[0][p] | 0, U = k[1][p] | 0; - u[P][p] = B[(W + 1) * 3 + (U + 1)], u[O][p] = 0, a[P] = L; - } - } - var V = this.jpoint(null, null, null), Q = this._wnafT4; - for (d = l; d >= 0; d--) { - for (var R = 0; d >= 0; ) { - var K = !0; - for (p = 0; p < i; p++) - Q[p] = u[p][d] | 0, Q[p] !== 0 && (K = !1); - if (!K) - break; - R++, d--; - } - if (d >= 0 && R++, V = V.dblp(R), d < 0) - break; - for (p = 0; p < i; p++) { - var ge = Q[p]; - ge !== 0 && (ge > 0 ? w = a[p][ge - 1 >> 1] : ge < 0 && (w = a[p][-ge - 1 >> 1].neg()), w.type === "affine" ? V = V.mixedAdd(w) : V = V.add(w)); - } - } - for (d = 0; d < i; d++) - a[d] = null; - return s ? V : V.toP(); -}; -function ss(t, e) { - this.curve = t, this.type = e, this.precomputed = null; -} -Oa.BasePoint = ss; -ss.prototype.eq = function() { - throw new Error("Not implemented"); -}; -ss.prototype.validate = function() { - return this.curve.validate(this); -}; -Oa.prototype.decodePoint = function(e, r) { - e = Fi.toArray(e, r); - var n = this.p.byteLength(); - if ((e[0] === 4 || e[0] === 6 || e[0] === 7) && e.length - 1 === 2 * n) { - e[0] === 6 ? m0(e[e.length - 1] % 2 === 0) : e[0] === 7 && m0(e[e.length - 1] % 2 === 1); - var i = this.point( - e.slice(1, 1 + n), - e.slice(1 + n, 1 + 2 * n) - ); - return i; - } else if ((e[0] === 2 || e[0] === 3) && e.length - 1 === n) - return this.pointFromX(e.slice(1, 1 + n), e[0] === 3); - throw new Error("Unknown point format"); -}; -ss.prototype.encodeCompressed = function(e) { - return this.encode(e, !0); -}; -ss.prototype._encode = function(e) { - var r = this.curve.p.byteLength(), n = this.getX().toArray("be", r); - return e ? [this.getY().isEven() ? 2 : 3].concat(n) : [4].concat(n, this.getY().toArray("be", r)); -}; -ss.prototype.encode = function(e, r) { - return Fi.encode(this._encode(r), e); -}; -ss.prototype.precompute = function(e) { - if (this.precomputed) - return this; - var r = { - doubles: null, - naf: null, - beta: null - }; - return r.naf = this._getNAFPoints(8), r.doubles = this._getDoubles(4, e), r.beta = this._getBeta(), this.precomputed = r, this; -}; -ss.prototype._hasDoubles = function(e) { - if (!this.precomputed) - return !1; - var r = this.precomputed.doubles; - return r ? r.points.length >= Math.ceil((e.bitLength() + 1) / r.step) : !1; -}; -ss.prototype._getDoubles = function(e, r) { - if (this.precomputed && this.precomputed.doubles) - return this.precomputed.doubles; - for (var n = [this], i = this, s = 0; s < r; s += e) { - for (var o = 0; o < e; o++) - i = i.dbl(); - n.push(i); - } - return { - step: e, - points: n - }; -}; -ss.prototype._getNAFPoints = function(e) { - if (this.precomputed && this.precomputed.naf) - return this.precomputed.naf; - for (var r = [this], n = (1 << e) - 1, i = n === 1 ? null : this.dbl(), s = 1; s < n; s++) - r[s] = r[s - 1].add(i); - return { - wnd: e, - points: r - }; -}; -ss.prototype._getBeta = function() { - return null; -}; -ss.prototype.dblp = function(e) { - for (var r = this, n = 0; n < e; n++) - r = r.dbl(); - return r; -}; -var ab = Ku(function(t) { - typeof Object.create == "function" ? t.exports = function(r, n) { - n && (r.super_ = n, r.prototype = Object.create(n.prototype, { - constructor: { - value: r, - enumerable: !1, - writable: !0, - configurable: !0 - } - })); - } : t.exports = function(r, n) { - if (n) { - r.super_ = n; - var i = function() { - }; - i.prototype = n.prototype, r.prototype = new i(), r.prototype.constructor = r; - } - }; -}), XU = Fi.assert; -function os(t) { - Rc.call(this, "short", t), this.a = new sr(t.a, 16).toRed(this.red), this.b = new sr(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); -} -ab(os, Rc); -var ZU = os; -os.prototype._getEndomorphism = function(e) { - if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { - var r, n; - if (e.beta) - r = new sr(e.beta, 16).toRed(this.red); - else { - var i = this._getEndoRoots(this.p); - r = i[0].cmp(i[1]) < 0 ? i[0] : i[1], r = r.toRed(this.red); - } - if (e.lambda) - n = new sr(e.lambda, 16); - else { - var s = this._getEndoRoots(this.n); - this.g.mul(s[0]).x.cmp(this.g.x.redMul(r)) === 0 ? n = s[0] : (n = s[1], XU(this.g.mul(n).x.cmp(this.g.x.redMul(r)) === 0)); - } - var o; - return e.basis ? o = e.basis.map(function(a) { - return { - a: new sr(a.a, 16), - b: new sr(a.b, 16) - }; - }) : o = this._getEndoBasis(n), { - beta: r, - lambda: n, - basis: o - }; - } -}; -os.prototype._getEndoRoots = function(e) { - var r = e === this.p ? this.red : sr.mont(e), n = new sr(2).toRed(r).redInvm(), i = n.redNeg(), s = new sr(3).toRed(r).redNeg().redSqrt().redMul(n), o = i.redAdd(s).fromRed(), a = i.redSub(s).fromRed(); - return [o, a]; -}; -os.prototype._getEndoBasis = function(e) { - for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new sr(1), o = new sr(0), a = new sr(0), u = new sr(1), l, d, p, w, _, P, O, L = 0, B, k; n.cmpn(0) !== 0; ) { - var W = i.div(n); - B = i.sub(W.mul(n)), k = a.sub(W.mul(s)); - var U = u.sub(W.mul(o)); - if (!p && B.cmp(r) < 0) - l = O.neg(), d = s, p = B.neg(), w = k; - else if (p && ++L === 2) - break; - O = B, i = n, n = B, a = s, s = k, u = o, o = U; - } - _ = B.neg(), P = k; - var V = p.sqr().add(w.sqr()), Q = _.sqr().add(P.sqr()); - return Q.cmp(V) >= 0 && (_ = l, P = d), p.negative && (p = p.neg(), w = w.neg()), _.negative && (_ = _.neg(), P = P.neg()), [ - { a: p, b: w }, - { a: _, b: P } - ]; -}; -os.prototype._endoSplit = function(e) { - var r = this.endo.basis, n = r[0], i = r[1], s = i.b.mul(e).divRound(this.n), o = n.b.neg().mul(e).divRound(this.n), a = s.mul(n.a), u = o.mul(i.a), l = s.mul(n.b), d = o.mul(i.b), p = e.sub(a).sub(u), w = l.add(d).neg(); - return { k1: p, k2: w }; -}; -os.prototype.pointFromX = function(e, r) { - e = new sr(e, 16), e.red || (e = e.toRed(this.red)); - var n = e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b), i = n.redSqrt(); - if (i.redSqr().redSub(n).cmp(this.zero) !== 0) - throw new Error("invalid point"); - var s = i.fromRed().isOdd(); - return (r && !s || !r && s) && (i = i.redNeg()), this.point(e, i); -}; -os.prototype.validate = function(e) { - if (e.inf) - return !0; - var r = e.x, n = e.y, i = this.a.redMul(r), s = r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b); - return n.redSqr().redISub(s).cmpn(0) === 0; -}; -os.prototype._endoWnafMulAdd = function(e, r, n) { - for (var i = this._endoWnafT1, s = this._endoWnafT2, o = 0; o < e.length; o++) { - var a = this._endoSplit(r[o]), u = e[o], l = u._getBeta(); - a.k1.negative && (a.k1.ineg(), u = u.neg(!0)), a.k2.negative && (a.k2.ineg(), l = l.neg(!0)), i[o * 2] = u, i[o * 2 + 1] = l, s[o * 2] = a.k1, s[o * 2 + 1] = a.k2; - } - for (var d = this._wnafMulAdd(1, i, s, o * 2, n), p = 0; p < o * 2; p++) - i[p] = null, s[p] = null; - return d; -}; -function kn(t, e, r, n) { - Rc.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new sr(e, 16), this.y = new sr(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); -} -ab(kn, Rc.BasePoint); -os.prototype.point = function(e, r, n) { - return new kn(this, e, r, n); -}; -os.prototype.pointFromJSON = function(e, r) { - return kn.fromJSON(this, e, r); -}; -kn.prototype._getBeta = function() { - if (this.curve.endo) { - var e = this.precomputed; - if (e && e.beta) - return e.beta; - var r = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y); - if (e) { - var n = this.curve, i = function(s) { - return n.point(s.x.redMul(n.endo.beta), s.y); - }; - e.beta = r, r.precomputed = { - beta: null, - naf: e.naf && { - wnd: e.naf.wnd, - points: e.naf.points.map(i) - }, - doubles: e.doubles && { - step: e.doubles.step, - points: e.doubles.points.map(i) - } - }; - } - return r; - } -}; -kn.prototype.toJSON = function() { - return this.precomputed ? [this.x, this.y, this.precomputed && { - doubles: this.precomputed.doubles && { - step: this.precomputed.doubles.step, - points: this.precomputed.doubles.points.slice(1) - }, - naf: this.precomputed.naf && { - wnd: this.precomputed.naf.wnd, - points: this.precomputed.naf.points.slice(1) - } - }] : [this.x, this.y]; -}; -kn.fromJSON = function(e, r, n) { - typeof r == "string" && (r = JSON.parse(r)); - var i = e.point(r[0], r[1], n); - if (!r[2]) - return i; - function s(a) { - return e.point(a[0], a[1], n); - } - var o = r[2]; - return i.precomputed = { - beta: null, - doubles: o.doubles && { - step: o.doubles.step, - points: [i].concat(o.doubles.points.map(s)) - }, - naf: o.naf && { - wnd: o.naf.wnd, - points: [i].concat(o.naf.points.map(s)) - } - }, i; -}; -kn.prototype.inspect = function() { - return this.isInfinity() ? "" : ""; -}; -kn.prototype.isInfinity = function() { - return this.inf; -}; -kn.prototype.add = function(e) { - if (this.inf) - return e; - if (e.inf) - return this; - if (this.eq(e)) - return this.dbl(); - if (this.neg().eq(e)) - return this.curve.point(null, null); - if (this.x.cmp(e.x) === 0) - return this.curve.point(null, null); - var r = this.y.redSub(e.y); - r.cmpn(0) !== 0 && (r = r.redMul(this.x.redSub(e.x).redInvm())); - var n = r.redSqr().redISub(this.x).redISub(e.x), i = r.redMul(this.x.redSub(n)).redISub(this.y); - return this.curve.point(n, i); -}; -kn.prototype.dbl = function() { - if (this.inf) - return this; - var e = this.y.redAdd(this.y); - if (e.cmpn(0) === 0) - return this.curve.point(null, null); - var r = this.curve.a, n = this.x.redSqr(), i = e.redInvm(), s = n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i), o = s.redSqr().redISub(this.x.redAdd(this.x)), a = s.redMul(this.x.redSub(o)).redISub(this.y); - return this.curve.point(o, a); -}; -kn.prototype.getX = function() { - return this.x.fromRed(); -}; -kn.prototype.getY = function() { - return this.y.fromRed(); -}; -kn.prototype.mul = function(e) { - return e = new sr(e, 16), this.isInfinity() ? this : this._hasDoubles(e) ? this.curve._fixedNafMul(this, e) : this.curve.endo ? this.curve._endoWnafMulAdd([this], [e]) : this.curve._wnafMul(this, e); -}; -kn.prototype.mulAdd = function(e, r, n) { - var i = [this, r], s = [e, n]; - return this.curve.endo ? this.curve._endoWnafMulAdd(i, s) : this.curve._wnafMulAdd(1, i, s, 2); -}; -kn.prototype.jmulAdd = function(e, r, n) { - var i = [this, r], s = [e, n]; - return this.curve.endo ? this.curve._endoWnafMulAdd(i, s, !0) : this.curve._wnafMulAdd(1, i, s, 2, !0); -}; -kn.prototype.eq = function(e) { - return this === e || this.inf === e.inf && (this.inf || this.x.cmp(e.x) === 0 && this.y.cmp(e.y) === 0); -}; -kn.prototype.neg = function(e) { - if (this.inf) - return this; - var r = this.curve.point(this.x, this.y.redNeg()); - if (e && this.precomputed) { - var n = this.precomputed, i = function(s) { - return s.neg(); - }; - r.precomputed = { - naf: n.naf && { - wnd: n.naf.wnd, - points: n.naf.points.map(i) - }, - doubles: n.doubles && { - step: n.doubles.step, - points: n.doubles.points.map(i) - } - }; - } - return r; -}; -kn.prototype.toJ = function() { - if (this.inf) - return this.curve.jpoint(null, null, null); - var e = this.curve.jpoint(this.x, this.y, this.curve.one); - return e; -}; -function zn(t, e, r, n) { - Rc.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new sr(0)) : (this.x = new sr(e, 16), this.y = new sr(r, 16), this.z = new sr(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; -} -ab(zn, Rc.BasePoint); -os.prototype.jpoint = function(e, r, n) { - return new zn(this, e, r, n); -}; -zn.prototype.toP = function() { - if (this.isInfinity()) - return this.curve.point(null, null); - var e = this.z.redInvm(), r = e.redSqr(), n = this.x.redMul(r), i = this.y.redMul(r).redMul(e); - return this.curve.point(n, i); -}; -zn.prototype.neg = function() { - return this.curve.jpoint(this.x, this.y.redNeg(), this.z); -}; -zn.prototype.add = function(e) { - if (this.isInfinity()) - return e; - if (e.isInfinity()) - return this; - var r = e.z.redSqr(), n = this.z.redSqr(), i = this.x.redMul(r), s = e.x.redMul(n), o = this.y.redMul(r.redMul(e.z)), a = e.y.redMul(n.redMul(this.z)), u = i.redSub(s), l = o.redSub(a); - if (u.cmpn(0) === 0) - return l.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var d = u.redSqr(), p = d.redMul(u), w = i.redMul(d), _ = l.redSqr().redIAdd(p).redISub(w).redISub(w), P = l.redMul(w.redISub(_)).redISub(o.redMul(p)), O = this.z.redMul(e.z).redMul(u); - return this.curve.jpoint(_, P, O); -}; -zn.prototype.mixedAdd = function(e) { - if (this.isInfinity()) - return e.toJ(); - if (e.isInfinity()) - return this; - var r = this.z.redSqr(), n = this.x, i = e.x.redMul(r), s = this.y, o = e.y.redMul(r).redMul(this.z), a = n.redSub(i), u = s.redSub(o); - if (a.cmpn(0) === 0) - return u.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var l = a.redSqr(), d = l.redMul(a), p = n.redMul(l), w = u.redSqr().redIAdd(d).redISub(p).redISub(p), _ = u.redMul(p.redISub(w)).redISub(s.redMul(d)), P = this.z.redMul(a); - return this.curve.jpoint(w, _, P); -}; -zn.prototype.dblp = function(e) { - if (e === 0) - return this; - if (this.isInfinity()) - return this; - if (!e) - return this.dbl(); - var r; - if (this.curve.zeroA || this.curve.threeA) { - var n = this; - for (r = 0; r < e; r++) - n = n.dbl(); - return n; - } - var i = this.curve.a, s = this.curve.tinv, o = this.x, a = this.y, u = this.z, l = u.redSqr().redSqr(), d = a.redAdd(a); - for (r = 0; r < e; r++) { - var p = o.redSqr(), w = d.redSqr(), _ = w.redSqr(), P = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), O = o.redMul(w), L = P.redSqr().redISub(O.redAdd(O)), B = O.redISub(L), k = P.redMul(B); - k = k.redIAdd(k).redISub(_); - var W = d.redMul(u); - r + 1 < e && (l = l.redMul(_)), o = L, u = W, d = k; - } - return this.curve.jpoint(o, d.redMul(s), u); -}; -zn.prototype.dbl = function() { - return this.isInfinity() ? this : this.curve.zeroA ? this._zeroDbl() : this.curve.threeA ? this._threeDbl() : this._dbl(); -}; -zn.prototype._zeroDbl = function() { - var e, r, n; - if (this.zOne) { - var i = this.x.redSqr(), s = this.y.redSqr(), o = s.redSqr(), a = this.x.redAdd(s).redSqr().redISub(i).redISub(o); - a = a.redIAdd(a); - var u = i.redAdd(i).redIAdd(i), l = u.redSqr().redISub(a).redISub(a), d = o.redIAdd(o); - d = d.redIAdd(d), d = d.redIAdd(d), e = l, r = u.redMul(a.redISub(l)).redISub(d), n = this.y.redAdd(this.y); - } else { - var p = this.x.redSqr(), w = this.y.redSqr(), _ = w.redSqr(), P = this.x.redAdd(w).redSqr().redISub(p).redISub(_); - P = P.redIAdd(P); - var O = p.redAdd(p).redIAdd(p), L = O.redSqr(), B = _.redIAdd(_); - B = B.redIAdd(B), B = B.redIAdd(B), e = L.redISub(P).redISub(P), r = O.redMul(P.redISub(e)).redISub(B), n = this.y.redMul(this.z), n = n.redIAdd(n); - } - return this.curve.jpoint(e, r, n); -}; -zn.prototype._threeDbl = function() { - var e, r, n; - if (this.zOne) { - var i = this.x.redSqr(), s = this.y.redSqr(), o = s.redSqr(), a = this.x.redAdd(s).redSqr().redISub(i).redISub(o); - a = a.redIAdd(a); - var u = i.redAdd(i).redIAdd(i).redIAdd(this.curve.a), l = u.redSqr().redISub(a).redISub(a); - e = l; - var d = o.redIAdd(o); - d = d.redIAdd(d), d = d.redIAdd(d), r = u.redMul(a.redISub(l)).redISub(d), n = this.y.redAdd(this.y); - } else { - var p = this.z.redSqr(), w = this.y.redSqr(), _ = this.x.redMul(w), P = this.x.redSub(p).redMul(this.x.redAdd(p)); - P = P.redAdd(P).redIAdd(P); - var O = _.redIAdd(_); - O = O.redIAdd(O); - var L = O.redAdd(O); - e = P.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(p); - var B = w.redSqr(); - B = B.redIAdd(B), B = B.redIAdd(B), B = B.redIAdd(B), r = P.redMul(O.redISub(e)).redISub(B); - } - return this.curve.jpoint(e, r, n); -}; -zn.prototype._dbl = function() { - var e = this.curve.a, r = this.x, n = this.y, i = this.z, s = i.redSqr().redSqr(), o = r.redSqr(), a = n.redSqr(), u = o.redAdd(o).redIAdd(o).redIAdd(e.redMul(s)), l = r.redAdd(r); - l = l.redIAdd(l); - var d = l.redMul(a), p = u.redSqr().redISub(d.redAdd(d)), w = d.redISub(p), _ = a.redSqr(); - _ = _.redIAdd(_), _ = _.redIAdd(_), _ = _.redIAdd(_); - var P = u.redMul(w).redISub(_), O = n.redAdd(n).redMul(i); - return this.curve.jpoint(p, P, O); -}; -zn.prototype.trpl = function() { - if (!this.curve.zeroA) - return this.dbl().add(this); - var e = this.x.redSqr(), r = this.y.redSqr(), n = this.z.redSqr(), i = r.redSqr(), s = e.redAdd(e).redIAdd(e), o = s.redSqr(), a = this.x.redAdd(r).redSqr().redISub(e).redISub(i); - a = a.redIAdd(a), a = a.redAdd(a).redIAdd(a), a = a.redISub(o); - var u = a.redSqr(), l = i.redIAdd(i); - l = l.redIAdd(l), l = l.redIAdd(l), l = l.redIAdd(l); - var d = s.redIAdd(a).redSqr().redISub(o).redISub(u).redISub(l), p = r.redMul(d); - p = p.redIAdd(p), p = p.redIAdd(p); - var w = this.x.redMul(u).redISub(p); - w = w.redIAdd(w), w = w.redIAdd(w); - var _ = this.y.redMul(d.redMul(l.redISub(d)).redISub(a.redMul(u))); - _ = _.redIAdd(_), _ = _.redIAdd(_), _ = _.redIAdd(_); - var P = this.z.redAdd(a).redSqr().redISub(n).redISub(u); - return this.curve.jpoint(w, _, P); -}; -zn.prototype.mul = function(e, r) { - return e = new sr(e, r), this.curve._wnafMul(this, e); -}; -zn.prototype.eq = function(e) { - if (e.type === "affine") - return this.eq(e.toJ()); - if (this === e) - return !0; - var r = this.z.redSqr(), n = e.z.redSqr(); - if (this.x.redMul(n).redISub(e.x.redMul(r)).cmpn(0) !== 0) - return !1; - var i = r.redMul(this.z), s = n.redMul(e.z); - return this.y.redMul(s).redISub(e.y.redMul(i)).cmpn(0) === 0; -}; -zn.prototype.eqXToP = function(e) { - var r = this.z.redSqr(), n = e.toRed(this.curve.red).redMul(r); - if (this.x.cmp(n) === 0) - return !0; - for (var i = e.clone(), s = this.curve.redN.redMul(r); ; ) { - if (i.iadd(this.curve.n), i.cmp(this.curve.p) >= 0) - return !1; - if (n.redIAdd(s), this.x.cmp(n) === 0) - return !0; - } -}; -zn.prototype.inspect = function() { - return this.isInfinity() ? "" : ""; -}; -zn.prototype.isInfinity = function() { - return this.z.cmpn(0) === 0; -}; -var Bd = Ku(function(t, e) { - var r = e; - r.base = Rc, r.short = ZU, r.mont = /*RicMoo:ethers:require(./mont)*/ - null, r.edwards = /*RicMoo:ethers:require(./edwards)*/ - null; -}), Fd = Ku(function(t, e) { - var r = e, n = Fi.assert; - function i(a) { - a.type === "short" ? this.curve = new Bd.short(a) : a.type === "edwards" ? this.curve = new Bd.edwards(a) : this.curve = new Bd.mont(a), this.g = this.curve.g, this.n = this.curve.n, this.hash = a.hash, n(this.g.validate(), "Invalid curve"), n(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); - } - r.PresetCurve = i; - function s(a, u) { - Object.defineProperty(r, a, { - configurable: !0, - enumerable: !0, - get: function() { - var l = new i(u); - return Object.defineProperty(r, a, { - configurable: !0, - enumerable: !0, - value: l - }), l; - } - }); - } - s("p192", { - type: "short", - prime: "p192", - p: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff", - a: "ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc", - b: "64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1", - n: "ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831", - hash: Eo.sha256, - gRed: !1, - g: [ - "188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012", - "07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811" - ] - }), s("p224", { - type: "short", - prime: "p224", - p: "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001", - a: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe", - b: "b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4", - n: "ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d", - hash: Eo.sha256, - gRed: !1, - g: [ - "b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21", - "bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34" - ] - }), s("p256", { - type: "short", - prime: null, - p: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff", - a: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc", - b: "5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b", - n: "ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551", - hash: Eo.sha256, - gRed: !1, - g: [ - "6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296", - "4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5" - ] - }), s("p384", { - type: "short", - prime: null, - p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff", - a: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc", - b: "b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef", - n: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973", - hash: Eo.sha384, - gRed: !1, - g: [ - "aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7", - "3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f" - ] - }), s("p521", { - type: "short", - prime: null, - p: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff", - a: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc", - b: "00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00", - n: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409", - hash: Eo.sha512, - gRed: !1, - g: [ - "000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66", - "00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650" - ] - }), s("curve25519", { - type: "mont", - prime: "p25519", - p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed", - a: "76d06", - b: "1", - n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", - hash: Eo.sha256, - gRed: !1, - g: [ - "9" - ] - }), s("ed25519", { - type: "edwards", - prime: "p25519", - p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed", - a: "-1", - c: "1", - // -121665 * (121666^(-1)) (mod P) - d: "52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3", - n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", - hash: Eo.sha256, - gRed: !1, - g: [ - "216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a", - // 4/5 - "6666666666666666666666666666666666666666666666666666666666666658" - ] - }); - var o; - try { - o = /*RicMoo:ethers:require(./precomputed/secp256k1)*/ - null.crash(); - } catch { - o = void 0; - } - s("secp256k1", { - type: "short", - prime: "k256", - p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f", - a: "0", - b: "7", - n: "ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141", - h: "1", - hash: Eo.sha256, - // Precomputed endomorphism - beta: "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee", - lambda: "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72", - basis: [ - { - a: "3086d221a7d46bcde86c90e49284eb15", - b: "-e4437ed6010e88286f547fa90abfe4c3" - }, - { - a: "114ca50f7a8e2f3f657c1108d9d44cfd8", - b: "3086d221a7d46bcde86c90e49284eb15" - } - ], - gRed: !1, - g: [ - "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", - "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", - o - ] - }); -}); -function Sa(t) { - if (!(this instanceof Sa)) - return new Sa(t); - this.hash = t.hash, this.predResist = !!t.predResist, this.outLen = this.hash.outSize, this.minEntropy = t.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null; - var e = Ss.toArray(t.entropy, t.entropyEnc || "hex"), r = Ss.toArray(t.nonce, t.nonceEnc || "hex"), n = Ss.toArray(t.pers, t.persEnc || "hex"); - ob( - e.length >= this.minEntropy / 8, - "Not enough entropy. Minimum is: " + this.minEntropy + " bits" - ), this._init(e, r, n); -} -var q8 = Sa; -Sa.prototype._init = function(e, r, n) { - var i = e.concat(r).concat(n); - this.K = new Array(this.outLen / 8), this.V = new Array(this.outLen / 8); - for (var s = 0; s < this.V.length; s++) - this.K[s] = 0, this.V[s] = 1; - this._update(i), this._reseed = 1, this.reseedInterval = 281474976710656; -}; -Sa.prototype._hmac = function() { - return new Eo.hmac(this.hash, this.K); -}; -Sa.prototype._update = function(e) { - var r = this._hmac().update(this.V).update([0]); - e && (r = r.update(e)), this.K = r.digest(), this.V = this._hmac().update(this.V).digest(), e && (this.K = this._hmac().update(this.V).update([1]).update(e).digest(), this.V = this._hmac().update(this.V).digest()); -}; -Sa.prototype.reseed = function(e, r, n, i) { - typeof r != "string" && (i = n, n = r, r = null), e = Ss.toArray(e, r), n = Ss.toArray(n, i), ob( - e.length >= this.minEntropy / 8, - "Not enough entropy. Minimum is: " + this.minEntropy + " bits" - ), this._update(e.concat(n || [])), this._reseed = 1; -}; -Sa.prototype.generate = function(e, r, n, i) { - if (this._reseed > this.reseedInterval) - throw new Error("Reseed is required"); - typeof r != "string" && (i = n, n = r, r = null), n && (n = Ss.toArray(n, i || "hex"), this._update(n)); - for (var s = []; s.length < e; ) - this.V = this._hmac().update(this.V).digest(), s = s.concat(this.V); - var o = s.slice(0, e); - return this._update(n), this._reseed++, Ss.encode(o, r); -}; -var F1 = Fi.assert; -function ei(t, e) { - this.ec = t, this.priv = null, this.pub = null, e.priv && this._importPrivate(e.priv, e.privEnc), e.pub && this._importPublic(e.pub, e.pubEnc); -} -var cb = ei; -ei.fromPublic = function(e, r, n) { - return r instanceof ei ? r : new ei(e, { - pub: r, - pubEnc: n - }); -}; -ei.fromPrivate = function(e, r, n) { - return r instanceof ei ? r : new ei(e, { - priv: r, - privEnc: n - }); -}; -ei.prototype.validate = function() { - var e = this.getPublic(); - return e.isInfinity() ? { result: !1, reason: "Invalid public key" } : e.validate() ? e.mul(this.ec.curve.n).isInfinity() ? { result: !0, reason: null } : { result: !1, reason: "Public key * N != O" } : { result: !1, reason: "Public key is not a point" }; -}; -ei.prototype.getPublic = function(e, r) { - return typeof e == "string" && (r = e, e = null), this.pub || (this.pub = this.ec.g.mul(this.priv)), r ? this.pub.encode(r, e) : this.pub; -}; -ei.prototype.getPrivate = function(e) { - return e === "hex" ? this.priv.toString(16, 2) : this.priv; -}; -ei.prototype._importPrivate = function(e, r) { - this.priv = new sr(e, r || 16), this.priv = this.priv.umod(this.ec.curve.n); -}; -ei.prototype._importPublic = function(e, r) { - if (e.x || e.y) { - this.ec.curve.type === "mont" ? F1(e.x, "Need x coordinate") : (this.ec.curve.type === "short" || this.ec.curve.type === "edwards") && F1(e.x && e.y, "Need both x and y coordinate"), this.pub = this.ec.curve.point(e.x, e.y); - return; - } - this.pub = this.ec.curve.decodePoint(e, r); -}; -ei.prototype.derive = function(e) { - return e.validate() || F1(e.validate(), "public point not validated"), e.mul(this.priv).getX(); -}; -ei.prototype.sign = function(e, r, n) { - return this.ec.sign(e, this, r, n); -}; -ei.prototype.verify = function(e, r) { - return this.ec.verify(e, r, this); -}; -ei.prototype.inspect = function() { - return ""; -}; -var QU = Fi.assert; -function sp(t, e) { - if (t instanceof sp) - return t; - this._importDER(t, e) || (QU(t.r && t.s, "Signature without r or s"), this.r = new sr(t.r, 16), this.s = new sr(t.s, 16), t.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = t.recoveryParam); -} -var op = sp; -function eq() { - this.place = 0; -} -function bm(t, e) { - var r = t[e.place++]; - if (!(r & 128)) - return r; - var n = r & 15; - if (n === 0 || n > 4) - return !1; - for (var i = 0, s = 0, o = e.place; s < n; s++, o++) - i <<= 8, i |= t[o], i >>>= 0; - return i <= 127 ? !1 : (e.place = o, i); -} -function qx(t) { - for (var e = 0, r = t.length - 1; !t[e] && !(t[e + 1] & 128) && e < r; ) - e++; - return e === 0 ? t : t.slice(e); -} -sp.prototype._importDER = function(e, r) { - e = Fi.toArray(e, r); - var n = new eq(); - if (e[n.place++] !== 48) - return !1; - var i = bm(e, n); - if (i === !1 || i + n.place !== e.length || e[n.place++] !== 2) - return !1; - var s = bm(e, n); - if (s === !1) - return !1; - var o = e.slice(n.place, s + n.place); - if (n.place += s, e[n.place++] !== 2) - return !1; - var a = bm(e, n); - if (a === !1 || e.length !== a + n.place) - return !1; - var u = e.slice(n.place, a + n.place); - if (o[0] === 0) - if (o[1] & 128) - o = o.slice(1); - else - return !1; - if (u[0] === 0) - if (u[1] & 128) - u = u.slice(1); - else - return !1; - return this.r = new sr(o), this.s = new sr(u), this.recoveryParam = null, !0; -}; -function ym(t, e) { - if (e < 128) { - t.push(e); - return; - } - var r = 1 + (Math.log(e) / Math.LN2 >>> 3); - for (t.push(r | 128); --r; ) - t.push(e >>> (r << 3) & 255); - t.push(e); -} -sp.prototype.toDER = function(e) { - var r = this.r.toArray(), n = this.s.toArray(); - for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = qx(r), n = qx(n); !n[0] && !(n[1] & 128); ) - n = n.slice(1); - var i = [2]; - ym(i, r.length), i = i.concat(r), i.push(2), ym(i, n.length); - var s = i.concat(n), o = [48]; - return ym(o, s.length), o = o.concat(s), Fi.encode(o, e); -}; -var tq = ( - /*RicMoo:ethers:require(brorand)*/ - function() { - throw new Error("unsupported"); - } -), z8 = Fi.assert; -function ts(t) { - if (!(this instanceof ts)) - return new ts(t); - typeof t == "string" && (z8( - Object.prototype.hasOwnProperty.call(Fd, t), - "Unknown curve " + t - ), t = Fd[t]), t instanceof Fd.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; -} -var rq = ts; -ts.prototype.keyPair = function(e) { - return new cb(this, e); -}; -ts.prototype.keyFromPrivate = function(e, r) { - return cb.fromPrivate(this, e, r); -}; -ts.prototype.keyFromPublic = function(e, r) { - return cb.fromPublic(this, e, r); -}; -ts.prototype.genKeyPair = function(e) { - e || (e = {}); - for (var r = new q8({ - hash: this.hash, - pers: e.pers, - persEnc: e.persEnc || "utf8", - entropy: e.entropy || tq(this.hash.hmacStrength), - entropyEnc: e.entropy && e.entropyEnc || "utf8", - nonce: this.n.toArray() - }), n = this.n.byteLength(), i = this.n.sub(new sr(2)); ; ) { - var s = new sr(r.generate(n)); - if (!(s.cmp(i) > 0)) - return s.iaddn(1), this.keyFromPrivate(s); - } -}; -ts.prototype._truncateToN = function(e, r) { - var n = e.byteLength() * 8 - this.n.bitLength(); - return n > 0 && (e = e.ushrn(n)), !r && e.cmp(this.n) >= 0 ? e.sub(this.n) : e; -}; -ts.prototype.sign = function(e, r, n, i) { - typeof n == "object" && (i = n, n = null), i || (i = {}), r = this.keyFromPrivate(r, n), e = this._truncateToN(new sr(e, 16)); - for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new q8({ - hash: this.hash, - entropy: o, - nonce: a, - pers: i.pers, - persEnc: i.persEnc || "utf8" - }), l = this.n.sub(new sr(1)), d = 0; ; d++) { - var p = i.k ? i.k(d) : new sr(u.generate(this.n.byteLength())); - if (p = this._truncateToN(p, !0), !(p.cmpn(1) <= 0 || p.cmp(l) >= 0)) { - var w = this.g.mul(p); - if (!w.isInfinity()) { - var _ = w.getX(), P = _.umod(this.n); - if (P.cmpn(0) !== 0) { - var O = p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e)); - if (O = O.umod(this.n), O.cmpn(0) !== 0) { - var L = (w.getY().isOdd() ? 1 : 0) | (_.cmp(P) !== 0 ? 2 : 0); - return i.canonical && O.cmp(this.nh) > 0 && (O = this.n.sub(O), L ^= 1), new op({ r: P, s: O, recoveryParam: L }); - } - } - } - } - } -}; -ts.prototype.verify = function(e, r, n, i) { - e = this._truncateToN(new sr(e, 16)), n = this.keyFromPublic(n, i), r = new op(r, "hex"); - var s = r.r, o = r.s; - if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0 || o.cmpn(1) < 0 || o.cmp(this.n) >= 0) - return !1; - var a = o.invm(this.n), u = a.mul(e).umod(this.n), l = a.mul(s).umod(this.n), d; - return this.curve._maxwellTrick ? (d = this.g.jmulAdd(u, n.getPublic(), l), d.isInfinity() ? !1 : d.eqXToP(s)) : (d = this.g.mulAdd(u, n.getPublic(), l), d.isInfinity() ? !1 : d.getX().umod(this.n).cmp(s) === 0); -}; -ts.prototype.recoverPubKey = function(t, e, r, n) { - z8((3 & r) === r, "The recovery param is more than two bits"), e = new op(e, n); - var i = this.n, s = new sr(t), o = e.r, a = e.s, u = r & 1, l = r >> 1; - if (o.cmp(this.curve.p.umod(this.curve.n)) >= 0 && l) - throw new Error("Unable to find sencond key candinate"); - l ? o = this.curve.pointFromX(o.add(this.curve.n), u) : o = this.curve.pointFromX(o, u); - var d = e.r.invm(i), p = i.sub(s).mul(d).umod(i), w = a.mul(d).umod(i); - return this.g.mulAdd(p, o, w); -}; -ts.prototype.getKeyRecoveryParam = function(t, e, r, n) { - if (e = new op(e, n), e.recoveryParam !== null) - return e.recoveryParam; - for (var i = 0; i < 4; i++) { - var s; - try { - s = this.recoverPubKey(t, e, i); - } catch { - continue; - } - if (s.eq(r)) - return i; - } - throw new Error("Unable to find valid recovery factor"); -}; -var nq = Ku(function(t, e) { - var r = e; - r.version = "6.5.4", r.utils = Fi, r.rand = /*RicMoo:ethers:require(brorand)*/ - function() { - throw new Error("unsupported"); - }, r.curve = Bd, r.curves = Fd, r.ec = rq, r.eddsa = /*RicMoo:ethers:require(./elliptic/eddsa)*/ - null; -}), iq = nq.ec; -const sq = "signing-key/5.7.0", j1 = new Yr(sq); -let wm = null; -function ua() { - return wm || (wm = new iq("secp256k1")), wm; -} -class oq { - constructor(e) { - Tf(this, "curve", "secp256k1"), Tf(this, "privateKey", Di(e)), lj(this.privateKey) !== 32 && j1.throwArgumentError("invalid private key", "privateKey", "[[ REDACTED ]]"); - const r = ua().keyFromPrivate(wn(this.privateKey)); - Tf(this, "publicKey", "0x" + r.getPublic(!1, "hex")), Tf(this, "compressedPublicKey", "0x" + r.getPublic(!0, "hex")), Tf(this, "_isSigningKey", !0); - } - _addPoint(e) { - const r = ua().keyFromPublic(wn(this.publicKey)), n = ua().keyFromPublic(wn(e)); - return "0x" + r.pub.add(n.pub).encodeCompressed("hex"); - } - signDigest(e) { - const r = ua().keyFromPrivate(wn(this.privateKey)), n = wn(e); - n.length !== 32 && j1.throwArgumentError("bad digest length", "digest", e); - const i = r.sign(n, { canonical: !0 }); - return x8({ - recoveryParam: i.recoveryParam, - r: _u("0x" + i.r.toString(16), 32), - s: _u("0x" + i.s.toString(16), 32) - }); - } - computeSharedSecret(e) { - const r = ua().keyFromPrivate(wn(this.privateKey)), n = ua().keyFromPublic(wn(W8(e))); - return _u("0x" + r.derive(n.getPublic()).toString(16), 32); - } - static isSigningKey(e) { - return !!(e && e._isSigningKey); - } -} -function aq(t, e) { - const r = x8(e), n = { r: wn(r.r), s: wn(r.s) }; - return "0x" + ua().recoverPubKey(wn(t), n, r.recoveryParam).encode("hex", !1); -} -function W8(t, e) { - const r = wn(t); - return r.length === 32 ? new oq(r).publicKey : r.length === 33 ? "0x" + ua().keyFromPublic(r).getPublic(!1, "hex") : r.length === 65 ? Di(r) : j1.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); -} -var zx; -(function(t) { - t[t.legacy = 0] = "legacy", t[t.eip2930 = 1] = "eip2930", t[t.eip1559 = 2] = "eip1559"; -})(zx || (zx = {})); -function cq(t) { - const e = W8(t); - return _j(Nx(nb(Nx(e, 1)), 12)); -} -function uq(t, e) { - return cq(aq(wn(t), e)); -} -var ub = {}, ap = {}; -Object.defineProperty(ap, "__esModule", { value: !0 }); -var Gn = ar, U1 = Bi, fq = 20; -function lq(t, e, r) { - for (var n = 1634760805, i = 857760878, s = 2036477234, o = 1797285236, a = r[3] << 24 | r[2] << 16 | r[1] << 8 | r[0], u = r[7] << 24 | r[6] << 16 | r[5] << 8 | r[4], l = r[11] << 24 | r[10] << 16 | r[9] << 8 | r[8], d = r[15] << 24 | r[14] << 16 | r[13] << 8 | r[12], p = r[19] << 24 | r[18] << 16 | r[17] << 8 | r[16], w = r[23] << 24 | r[22] << 16 | r[21] << 8 | r[20], _ = r[27] << 24 | r[26] << 16 | r[25] << 8 | r[24], P = r[31] << 24 | r[30] << 16 | r[29] << 8 | r[28], O = e[3] << 24 | e[2] << 16 | e[1] << 8 | e[0], L = e[7] << 24 | e[6] << 16 | e[5] << 8 | e[4], B = e[11] << 24 | e[10] << 16 | e[9] << 8 | e[8], k = e[15] << 24 | e[14] << 16 | e[13] << 8 | e[12], W = n, U = i, V = s, Q = o, R = a, K = u, ge = l, Ee = d, Y = p, A = w, m = _, f = P, g = O, b = L, x = B, E = k, S = 0; S < fq; S += 2) - W = W + R | 0, g ^= W, g = g >>> 16 | g << 16, Y = Y + g | 0, R ^= Y, R = R >>> 20 | R << 12, U = U + K | 0, b ^= U, b = b >>> 16 | b << 16, A = A + b | 0, K ^= A, K = K >>> 20 | K << 12, V = V + ge | 0, x ^= V, x = x >>> 16 | x << 16, m = m + x | 0, ge ^= m, ge = ge >>> 20 | ge << 12, Q = Q + Ee | 0, E ^= Q, E = E >>> 16 | E << 16, f = f + E | 0, Ee ^= f, Ee = Ee >>> 20 | Ee << 12, V = V + ge | 0, x ^= V, x = x >>> 24 | x << 8, m = m + x | 0, ge ^= m, ge = ge >>> 25 | ge << 7, Q = Q + Ee | 0, E ^= Q, E = E >>> 24 | E << 8, f = f + E | 0, Ee ^= f, Ee = Ee >>> 25 | Ee << 7, U = U + K | 0, b ^= U, b = b >>> 24 | b << 8, A = A + b | 0, K ^= A, K = K >>> 25 | K << 7, W = W + R | 0, g ^= W, g = g >>> 24 | g << 8, Y = Y + g | 0, R ^= Y, R = R >>> 25 | R << 7, W = W + K | 0, E ^= W, E = E >>> 16 | E << 16, m = m + E | 0, K ^= m, K = K >>> 20 | K << 12, U = U + ge | 0, g ^= U, g = g >>> 16 | g << 16, f = f + g | 0, ge ^= f, ge = ge >>> 20 | ge << 12, V = V + Ee | 0, b ^= V, b = b >>> 16 | b << 16, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 20 | Ee << 12, Q = Q + R | 0, x ^= Q, x = x >>> 16 | x << 16, A = A + x | 0, R ^= A, R = R >>> 20 | R << 12, V = V + Ee | 0, b ^= V, b = b >>> 24 | b << 8, Y = Y + b | 0, Ee ^= Y, Ee = Ee >>> 25 | Ee << 7, Q = Q + R | 0, x ^= Q, x = x >>> 24 | x << 8, A = A + x | 0, R ^= A, R = R >>> 25 | R << 7, U = U + ge | 0, g ^= U, g = g >>> 24 | g << 8, f = f + g | 0, ge ^= f, ge = ge >>> 25 | ge << 7, W = W + K | 0, E ^= W, E = E >>> 24 | E << 8, m = m + E | 0, K ^= m, K = K >>> 25 | K << 7; - Gn.writeUint32LE(W + n | 0, t, 0), Gn.writeUint32LE(U + i | 0, t, 4), Gn.writeUint32LE(V + s | 0, t, 8), Gn.writeUint32LE(Q + o | 0, t, 12), Gn.writeUint32LE(R + a | 0, t, 16), Gn.writeUint32LE(K + u | 0, t, 20), Gn.writeUint32LE(ge + l | 0, t, 24), Gn.writeUint32LE(Ee + d | 0, t, 28), Gn.writeUint32LE(Y + p | 0, t, 32), Gn.writeUint32LE(A + w | 0, t, 36), Gn.writeUint32LE(m + _ | 0, t, 40), Gn.writeUint32LE(f + P | 0, t, 44), Gn.writeUint32LE(g + O | 0, t, 48), Gn.writeUint32LE(b + L | 0, t, 52), Gn.writeUint32LE(x + B | 0, t, 56), Gn.writeUint32LE(E + k | 0, t, 60); -} -function H8(t, e, r, n, i) { - if (i === void 0 && (i = 0), t.length !== 32) - throw new Error("ChaCha: key size must be 32 bytes"); - if (n.length < r.length) - throw new Error("ChaCha: destination is shorter than source"); - var s, o; - if (i === 0) { - if (e.length !== 8 && e.length !== 12) - throw new Error("ChaCha nonce must be 8 or 12 bytes"); - s = new Uint8Array(16), o = s.length - e.length, s.set(e, o); - } else { - if (e.length !== 16) - throw new Error("ChaCha nonce with counter must be 16 bytes"); - s = e, o = i; - } - for (var a = new Uint8Array(64), u = 0; u < r.length; u += 64) { - lq(a, s, t); - for (var l = u; l < u + 64 && l < r.length; l++) - n[l] = r[l] ^ a[l - u]; - dq(s, 0, o); - } - return U1.wipe(a), i === 0 && U1.wipe(s), n; -} -ap.streamXOR = H8; -function hq(t, e, r, n) { - return n === void 0 && (n = 0), U1.wipe(r), H8(t, e, r, r, n); -} -ap.stream = hq; -function dq(t, e, r) { - for (var n = 1; r--; ) - n = n + (t[e] & 255) | 0, t[e] = n & 255, n >>>= 8, e++; - if (n > 0) - throw new Error("ChaCha: counter overflow"); -} -var K8 = {}, Na = {}; -Object.defineProperty(Na, "__esModule", { value: !0 }); -function pq(t, e, r) { - return ~(t - 1) & e | t - 1 & r; -} -Na.select = pq; -function gq(t, e) { - return (t | 0) - (e | 0) - 1 >>> 31 & 1; -} -Na.lessOrEqual = gq; -function V8(t, e) { - if (t.length !== e.length) - return 0; - for (var r = 0, n = 0; n < t.length; n++) - r |= t[n] ^ e[n]; - return 1 & r - 1 >>> 8; -} -Na.compare = V8; -function mq(t, e) { - return t.length === 0 || e.length === 0 ? !1 : V8(t, e) !== 0; -} -Na.equal = mq; -(function(t) { - Object.defineProperty(t, "__esModule", { value: !0 }); - var e = Na, r = Bi; - t.DIGEST_LENGTH = 16; - var n = ( - /** @class */ - function() { - function o(a) { - this.digestLength = t.DIGEST_LENGTH, this._buffer = new Uint8Array(16), this._r = new Uint16Array(10), this._h = new Uint16Array(10), this._pad = new Uint16Array(8), this._leftover = 0, this._fin = 0, this._finished = !1; - var u = a[0] | a[1] << 8; - this._r[0] = u & 8191; - var l = a[2] | a[3] << 8; - this._r[1] = (u >>> 13 | l << 3) & 8191; - var d = a[4] | a[5] << 8; - this._r[2] = (l >>> 10 | d << 6) & 7939; - var p = a[6] | a[7] << 8; - this._r[3] = (d >>> 7 | p << 9) & 8191; - var w = a[8] | a[9] << 8; - this._r[4] = (p >>> 4 | w << 12) & 255, this._r[5] = w >>> 1 & 8190; - var _ = a[10] | a[11] << 8; - this._r[6] = (w >>> 14 | _ << 2) & 8191; - var P = a[12] | a[13] << 8; - this._r[7] = (_ >>> 11 | P << 5) & 8065; - var O = a[14] | a[15] << 8; - this._r[8] = (P >>> 8 | O << 8) & 8191, this._r[9] = O >>> 5 & 127, this._pad[0] = a[16] | a[17] << 8, this._pad[1] = a[18] | a[19] << 8, this._pad[2] = a[20] | a[21] << 8, this._pad[3] = a[22] | a[23] << 8, this._pad[4] = a[24] | a[25] << 8, this._pad[5] = a[26] | a[27] << 8, this._pad[6] = a[28] | a[29] << 8, this._pad[7] = a[30] | a[31] << 8; - } - return o.prototype._blocks = function(a, u, l) { - for (var d = this._fin ? 0 : 2048, p = this._h[0], w = this._h[1], _ = this._h[2], P = this._h[3], O = this._h[4], L = this._h[5], B = this._h[6], k = this._h[7], W = this._h[8], U = this._h[9], V = this._r[0], Q = this._r[1], R = this._r[2], K = this._r[3], ge = this._r[4], Ee = this._r[5], Y = this._r[6], A = this._r[7], m = this._r[8], f = this._r[9]; l >= 16; ) { - var g = a[u + 0] | a[u + 1] << 8; - p += g & 8191; - var b = a[u + 2] | a[u + 3] << 8; - w += (g >>> 13 | b << 3) & 8191; - var x = a[u + 4] | a[u + 5] << 8; - _ += (b >>> 10 | x << 6) & 8191; - var E = a[u + 6] | a[u + 7] << 8; - P += (x >>> 7 | E << 9) & 8191; - var S = a[u + 8] | a[u + 9] << 8; - O += (E >>> 4 | S << 12) & 8191, L += S >>> 1 & 8191; - var v = a[u + 10] | a[u + 11] << 8; - B += (S >>> 14 | v << 2) & 8191; - var M = a[u + 12] | a[u + 13] << 8; - k += (v >>> 11 | M << 5) & 8191; - var I = a[u + 14] | a[u + 15] << 8; - W += (M >>> 8 | I << 8) & 8191, U += I >>> 5 | d; - var F = 0, ce = F; - ce += p * V, ce += w * (5 * f), ce += _ * (5 * m), ce += P * (5 * A), ce += O * (5 * Y), F = ce >>> 13, ce &= 8191, ce += L * (5 * Ee), ce += B * (5 * ge), ce += k * (5 * K), ce += W * (5 * R), ce += U * (5 * Q), F += ce >>> 13, ce &= 8191; - var D = F; - D += p * Q, D += w * V, D += _ * (5 * f), D += P * (5 * m), D += O * (5 * A), F = D >>> 13, D &= 8191, D += L * (5 * Y), D += B * (5 * Ee), D += k * (5 * ge), D += W * (5 * K), D += U * (5 * R), F += D >>> 13, D &= 8191; - var oe = F; - oe += p * R, oe += w * Q, oe += _ * V, oe += P * (5 * f), oe += O * (5 * m), F = oe >>> 13, oe &= 8191, oe += L * (5 * A), oe += B * (5 * Y), oe += k * (5 * Ee), oe += W * (5 * ge), oe += U * (5 * K), F += oe >>> 13, oe &= 8191; - var Z = F; - Z += p * K, Z += w * R, Z += _ * Q, Z += P * V, Z += O * (5 * f), F = Z >>> 13, Z &= 8191, Z += L * (5 * m), Z += B * (5 * A), Z += k * (5 * Y), Z += W * (5 * Ee), Z += U * (5 * ge), F += Z >>> 13, Z &= 8191; - var J = F; - J += p * ge, J += w * K, J += _ * R, J += P * Q, J += O * V, F = J >>> 13, J &= 8191, J += L * (5 * f), J += B * (5 * m), J += k * (5 * A), J += W * (5 * Y), J += U * (5 * Ee), F += J >>> 13, J &= 8191; - var ee = F; - ee += p * Ee, ee += w * ge, ee += _ * K, ee += P * R, ee += O * Q, F = ee >>> 13, ee &= 8191, ee += L * V, ee += B * (5 * f), ee += k * (5 * m), ee += W * (5 * A), ee += U * (5 * Y), F += ee >>> 13, ee &= 8191; - var T = F; - T += p * Y, T += w * Ee, T += _ * ge, T += P * K, T += O * R, F = T >>> 13, T &= 8191, T += L * Q, T += B * V, T += k * (5 * f), T += W * (5 * m), T += U * (5 * A), F += T >>> 13, T &= 8191; - var X = F; - X += p * A, X += w * Y, X += _ * Ee, X += P * ge, X += O * K, F = X >>> 13, X &= 8191, X += L * R, X += B * Q, X += k * V, X += W * (5 * f), X += U * (5 * m), F += X >>> 13, X &= 8191; - var re = F; - re += p * m, re += w * A, re += _ * Y, re += P * Ee, re += O * ge, F = re >>> 13, re &= 8191, re += L * K, re += B * R, re += k * Q, re += W * V, re += U * (5 * f), F += re >>> 13, re &= 8191; - var pe = F; - pe += p * f, pe += w * m, pe += _ * A, pe += P * Y, pe += O * Ee, F = pe >>> 13, pe &= 8191, pe += L * ge, pe += B * K, pe += k * R, pe += W * Q, pe += U * V, F += pe >>> 13, pe &= 8191, F = (F << 2) + F | 0, F = F + ce | 0, ce = F & 8191, F = F >>> 13, D += F, p = ce, w = D, _ = oe, P = Z, O = J, L = ee, B = T, k = X, W = re, U = pe, u += 16, l -= 16; - } - this._h[0] = p, this._h[1] = w, this._h[2] = _, this._h[3] = P, this._h[4] = O, this._h[5] = L, this._h[6] = B, this._h[7] = k, this._h[8] = W, this._h[9] = U; - }, o.prototype.finish = function(a, u) { - u === void 0 && (u = 0); - var l = new Uint16Array(10), d, p, w, _; - if (this._leftover) { - for (_ = this._leftover, this._buffer[_++] = 1; _ < 16; _++) - this._buffer[_] = 0; - this._fin = 1, this._blocks(this._buffer, 0, 16); - } - for (d = this._h[1] >>> 13, this._h[1] &= 8191, _ = 2; _ < 10; _++) - this._h[_] += d, d = this._h[_] >>> 13, this._h[_] &= 8191; - for (this._h[0] += d * 5, d = this._h[0] >>> 13, this._h[0] &= 8191, this._h[1] += d, d = this._h[1] >>> 13, this._h[1] &= 8191, this._h[2] += d, l[0] = this._h[0] + 5, d = l[0] >>> 13, l[0] &= 8191, _ = 1; _ < 10; _++) - l[_] = this._h[_] + d, d = l[_] >>> 13, l[_] &= 8191; - for (l[9] -= 8192, p = (d ^ 1) - 1, _ = 0; _ < 10; _++) - l[_] &= p; - for (p = ~p, _ = 0; _ < 10; _++) - this._h[_] = this._h[_] & p | l[_]; - for (this._h[0] = (this._h[0] | this._h[1] << 13) & 65535, this._h[1] = (this._h[1] >>> 3 | this._h[2] << 10) & 65535, this._h[2] = (this._h[2] >>> 6 | this._h[3] << 7) & 65535, this._h[3] = (this._h[3] >>> 9 | this._h[4] << 4) & 65535, this._h[4] = (this._h[4] >>> 12 | this._h[5] << 1 | this._h[6] << 14) & 65535, this._h[5] = (this._h[6] >>> 2 | this._h[7] << 11) & 65535, this._h[6] = (this._h[7] >>> 5 | this._h[8] << 8) & 65535, this._h[7] = (this._h[8] >>> 8 | this._h[9] << 5) & 65535, w = this._h[0] + this._pad[0], this._h[0] = w & 65535, _ = 1; _ < 8; _++) - w = (this._h[_] + this._pad[_] | 0) + (w >>> 16) | 0, this._h[_] = w & 65535; - return a[u + 0] = this._h[0] >>> 0, a[u + 1] = this._h[0] >>> 8, a[u + 2] = this._h[1] >>> 0, a[u + 3] = this._h[1] >>> 8, a[u + 4] = this._h[2] >>> 0, a[u + 5] = this._h[2] >>> 8, a[u + 6] = this._h[3] >>> 0, a[u + 7] = this._h[3] >>> 8, a[u + 8] = this._h[4] >>> 0, a[u + 9] = this._h[4] >>> 8, a[u + 10] = this._h[5] >>> 0, a[u + 11] = this._h[5] >>> 8, a[u + 12] = this._h[6] >>> 0, a[u + 13] = this._h[6] >>> 8, a[u + 14] = this._h[7] >>> 0, a[u + 15] = this._h[7] >>> 8, this._finished = !0, this; - }, o.prototype.update = function(a) { - var u = 0, l = a.length, d; - if (this._leftover) { - d = 16 - this._leftover, d > l && (d = l); - for (var p = 0; p < d; p++) - this._buffer[this._leftover + p] = a[u + p]; - if (l -= d, u += d, this._leftover += d, this._leftover < 16) - return this; - this._blocks(this._buffer, 0, 16), this._leftover = 0; - } - if (l >= 16 && (d = l - l % 16, this._blocks(a, u, d), u += d, l -= d), l) { - for (var p = 0; p < l; p++) - this._buffer[this._leftover + p] = a[u + p]; - this._leftover += l; - } - return this; - }, o.prototype.digest = function() { - if (this._finished) - throw new Error("Poly1305 was finished"); - var a = new Uint8Array(16); - return this.finish(a), a; - }, o.prototype.clean = function() { - return r.wipe(this._buffer), r.wipe(this._r), r.wipe(this._h), r.wipe(this._pad), this._leftover = 0, this._fin = 0, this._finished = !0, this; - }, o; - }() - ); - t.Poly1305 = n; - function i(o, a) { - var u = new n(o); - u.update(a); - var l = u.digest(); - return u.clean(), l; - } - t.oneTimeAuth = i; - function s(o, a) { - return o.length !== t.DIGEST_LENGTH || a.length !== t.DIGEST_LENGTH ? !1 : e.equal(o, a); - } - t.equal = s; -})(K8); -(function(t) { - Object.defineProperty(t, "__esModule", { value: !0 }); - var e = ap, r = K8, n = Bi, i = ar, s = Na; - t.KEY_LENGTH = 32, t.NONCE_LENGTH = 12, t.TAG_LENGTH = 16; - var o = new Uint8Array(16), a = ( - /** @class */ - function() { - function u(l) { - if (this.nonceLength = t.NONCE_LENGTH, this.tagLength = t.TAG_LENGTH, l.length !== t.KEY_LENGTH) - throw new Error("ChaCha20Poly1305 needs 32-byte key"); - this._key = new Uint8Array(l); - } - return u.prototype.seal = function(l, d, p, w) { - if (l.length > 16) - throw new Error("ChaCha20Poly1305: incorrect nonce length"); - var _ = new Uint8Array(16); - _.set(l, _.length - l.length); - var P = new Uint8Array(32); - e.stream(this._key, _, P, 4); - var O = d.length + this.tagLength, L; - if (w) { - if (w.length !== O) - throw new Error("ChaCha20Poly1305: incorrect destination length"); - L = w; - } else - L = new Uint8Array(O); - return e.streamXOR(this._key, _, d, L, 4), this._authenticate(L.subarray(L.length - this.tagLength, L.length), P, L.subarray(0, L.length - this.tagLength), p), n.wipe(_), L; - }, u.prototype.open = function(l, d, p, w) { - if (l.length > 16) - throw new Error("ChaCha20Poly1305: incorrect nonce length"); - if (d.length < this.tagLength) - return null; - var _ = new Uint8Array(16); - _.set(l, _.length - l.length); - var P = new Uint8Array(32); - e.stream(this._key, _, P, 4); - var O = new Uint8Array(this.tagLength); - if (this._authenticate(O, P, d.subarray(0, d.length - this.tagLength), p), !s.equal(O, d.subarray(d.length - this.tagLength, d.length))) - return null; - var L = d.length - this.tagLength, B; - if (w) { - if (w.length !== L) - throw new Error("ChaCha20Poly1305: incorrect destination length"); - B = w; - } else - B = new Uint8Array(L); - return e.streamXOR(this._key, _, d.subarray(0, d.length - this.tagLength), B, 4), n.wipe(_), B; - }, u.prototype.clean = function() { - return n.wipe(this._key), this; - }, u.prototype._authenticate = function(l, d, p, w) { - var _ = new r.Poly1305(d); - w && (_.update(w), w.length % 16 > 0 && _.update(o.subarray(w.length % 16))), _.update(p), p.length % 16 > 0 && _.update(o.subarray(p.length % 16)); - var P = new Uint8Array(8); - w && i.writeUint64LE(w.length, P), _.update(P), i.writeUint64LE(p.length, P), _.update(P); - for (var O = _.digest(), L = 0; L < O.length; L++) - l[L] = O[L]; - _.clean(), n.wipe(O), n.wipe(P); - }, u; - }() - ); - t.ChaCha20Poly1305 = a; -})(ub); -var G8 = {}, nh = {}, fb = {}; -Object.defineProperty(fb, "__esModule", { value: !0 }); -function vq(t) { - return typeof t.saveState < "u" && typeof t.restoreState < "u" && typeof t.cleanSavedState < "u"; -} -fb.isSerializableHash = vq; -Object.defineProperty(nh, "__esModule", { value: !0 }); -var Bs = fb, bq = Na, yq = Bi, Y8 = ( - /** @class */ - function() { - function t(e, r) { - this._finished = !1, this._inner = new e(), this._outer = new e(), this.blockSize = this._outer.blockSize, this.digestLength = this._outer.digestLength; - var n = new Uint8Array(this.blockSize); - r.length > this.blockSize ? this._inner.update(r).finish(n).clean() : n.set(r); - for (var i = 0; i < n.length; i++) - n[i] ^= 54; - this._inner.update(n); - for (var i = 0; i < n.length; i++) - n[i] ^= 106; - this._outer.update(n), Bs.isSerializableHash(this._inner) && Bs.isSerializableHash(this._outer) && (this._innerKeyedState = this._inner.saveState(), this._outerKeyedState = this._outer.saveState()), yq.wipe(n); - } - return t.prototype.reset = function() { - if (!Bs.isSerializableHash(this._inner) || !Bs.isSerializableHash(this._outer)) - throw new Error("hmac: can't reset() because hash doesn't implement restoreState()"); - return this._inner.restoreState(this._innerKeyedState), this._outer.restoreState(this._outerKeyedState), this._finished = !1, this; - }, t.prototype.clean = function() { - Bs.isSerializableHash(this._inner) && this._inner.cleanSavedState(this._innerKeyedState), Bs.isSerializableHash(this._outer) && this._outer.cleanSavedState(this._outerKeyedState), this._inner.clean(), this._outer.clean(); - }, t.prototype.update = function(e) { - return this._inner.update(e), this; - }, t.prototype.finish = function(e) { - return this._finished ? (this._outer.finish(e), this) : (this._inner.finish(e), this._outer.update(e.subarray(0, this.digestLength)).finish(e), this._finished = !0, this); - }, t.prototype.digest = function() { - var e = new Uint8Array(this.digestLength); - return this.finish(e), e; - }, t.prototype.saveState = function() { - if (!Bs.isSerializableHash(this._inner)) - throw new Error("hmac: can't saveState() because hash doesn't implement it"); - return this._inner.saveState(); - }, t.prototype.restoreState = function(e) { - if (!Bs.isSerializableHash(this._inner) || !Bs.isSerializableHash(this._outer)) - throw new Error("hmac: can't restoreState() because hash doesn't implement it"); - return this._inner.restoreState(e), this._outer.restoreState(this._outerKeyedState), this._finished = !1, this; - }, t.prototype.cleanSavedState = function(e) { - if (!Bs.isSerializableHash(this._inner)) - throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it"); - this._inner.cleanSavedState(e); - }, t; - }() -); -nh.HMAC = Y8; -function wq(t, e, r) { - var n = new Y8(t, e); - n.update(r); - var i = n.digest(); - return n.clean(), i; -} -nh.hmac = wq; -nh.equal = bq.equal; -Object.defineProperty(G8, "__esModule", { value: !0 }); -var Wx = nh, Hx = Bi, xq = ( - /** @class */ - function() { - function t(e, r, n, i) { - n === void 0 && (n = new Uint8Array(0)), this._counter = new Uint8Array(1), this._hash = e, this._info = i; - var s = Wx.hmac(this._hash, n, r); - this._hmac = new Wx.HMAC(e, s), this._buffer = new Uint8Array(this._hmac.digestLength), this._bufpos = this._buffer.length; - } - return t.prototype._fillBuffer = function() { - this._counter[0]++; - var e = this._counter[0]; - if (e === 0) - throw new Error("hkdf: cannot expand more"); - this._hmac.reset(), e > 1 && this._hmac.update(this._buffer), this._info && this._hmac.update(this._info), this._hmac.update(this._counter), this._hmac.finish(this._buffer), this._bufpos = 0; - }, t.prototype.expand = function(e) { - for (var r = new Uint8Array(e), n = 0; n < r.length; n++) - this._bufpos === this._buffer.length && this._fillBuffer(), r[n] = this._buffer[this._bufpos++]; - return r; - }, t.prototype.clean = function() { - this._hmac.clean(), Hx.wipe(this._buffer), Hx.wipe(this._counter), this._bufpos = 0; - }, t; - }() -), _q = G8.HKDF = xq, ih = {}; -(function(t) { - Object.defineProperty(t, "__esModule", { value: !0 }); - var e = ar, r = Bi; - t.DIGEST_LENGTH = 32, t.BLOCK_SIZE = 64; - var n = ( - /** @class */ - function() { - function a() { - this.digestLength = t.DIGEST_LENGTH, this.blockSize = t.BLOCK_SIZE, this._state = new Int32Array(8), this._temp = new Int32Array(64), this._buffer = new Uint8Array(128), this._bufferLength = 0, this._bytesHashed = 0, this._finished = !1, this.reset(); - } - return a.prototype._initState = function() { - this._state[0] = 1779033703, this._state[1] = 3144134277, this._state[2] = 1013904242, this._state[3] = 2773480762, this._state[4] = 1359893119, this._state[5] = 2600822924, this._state[6] = 528734635, this._state[7] = 1541459225; - }, a.prototype.reset = function() { - return this._initState(), this._bufferLength = 0, this._bytesHashed = 0, this._finished = !1, this; - }, a.prototype.clean = function() { - r.wipe(this._buffer), r.wipe(this._temp), this.reset(); - }, a.prototype.update = function(u, l) { - if (l === void 0 && (l = u.length), this._finished) - throw new Error("SHA256: can't update because hash was finished."); - var d = 0; - if (this._bytesHashed += l, this._bufferLength > 0) { - for (; this._bufferLength < this.blockSize && l > 0; ) - this._buffer[this._bufferLength++] = u[d++], l--; - this._bufferLength === this.blockSize && (s(this._temp, this._state, this._buffer, 0, this.blockSize), this._bufferLength = 0); - } - for (l >= this.blockSize && (d = s(this._temp, this._state, u, d, l), l %= this.blockSize); l > 0; ) - this._buffer[this._bufferLength++] = u[d++], l--; - return this; - }, a.prototype.finish = function(u) { - if (!this._finished) { - var l = this._bytesHashed, d = this._bufferLength, p = l / 536870912 | 0, w = l << 3, _ = l % 64 < 56 ? 64 : 128; - this._buffer[d] = 128; - for (var P = d + 1; P < _ - 8; P++) - this._buffer[P] = 0; - e.writeUint32BE(p, this._buffer, _ - 8), e.writeUint32BE(w, this._buffer, _ - 4), s(this._temp, this._state, this._buffer, 0, _), this._finished = !0; - } - for (var P = 0; P < this.digestLength / 4; P++) - e.writeUint32BE(this._state[P], u, P * 4); - return this; - }, a.prototype.digest = function() { - var u = new Uint8Array(this.digestLength); - return this.finish(u), u; - }, a.prototype.saveState = function() { - if (this._finished) - throw new Error("SHA256: cannot save finished state"); - return { - state: new Int32Array(this._state), - buffer: this._bufferLength > 0 ? new Uint8Array(this._buffer) : void 0, - bufferLength: this._bufferLength, - bytesHashed: this._bytesHashed - }; - }, a.prototype.restoreState = function(u) { - return this._state.set(u.state), this._bufferLength = u.bufferLength, u.buffer && this._buffer.set(u.buffer), this._bytesHashed = u.bytesHashed, this._finished = !1, this; - }, a.prototype.cleanSavedState = function(u) { - r.wipe(u.state), u.buffer && r.wipe(u.buffer), u.bufferLength = 0, u.bytesHashed = 0; - }, a; - }() - ); - t.SHA256 = n; - var i = new Int32Array([ - 1116352408, - 1899447441, - 3049323471, - 3921009573, - 961987163, - 1508970993, - 2453635748, - 2870763221, - 3624381080, - 310598401, - 607225278, - 1426881987, - 1925078388, - 2162078206, - 2614888103, - 3248222580, - 3835390401, - 4022224774, - 264347078, - 604807628, - 770255983, - 1249150122, - 1555081692, - 1996064986, - 2554220882, - 2821834349, - 2952996808, - 3210313671, - 3336571891, - 3584528711, - 113926993, - 338241895, - 666307205, - 773529912, - 1294757372, - 1396182291, - 1695183700, - 1986661051, - 2177026350, - 2456956037, - 2730485921, - 2820302411, - 3259730800, - 3345764771, - 3516065817, - 3600352804, - 4094571909, - 275423344, - 430227734, - 506948616, - 659060556, - 883997877, - 958139571, - 1322822218, - 1537002063, - 1747873779, - 1955562222, - 2024104815, - 2227730452, - 2361852424, - 2428436474, - 2756734187, - 3204031479, - 3329325298 - ]); - function s(a, u, l, d, p) { - for (; p >= 64; ) { - for (var w = u[0], _ = u[1], P = u[2], O = u[3], L = u[4], B = u[5], k = u[6], W = u[7], U = 0; U < 16; U++) { - var V = d + U * 4; - a[U] = e.readUint32BE(l, V); - } - for (var U = 16; U < 64; U++) { - var Q = a[U - 2], R = (Q >>> 17 | Q << 15) ^ (Q >>> 19 | Q << 13) ^ Q >>> 10; - Q = a[U - 15]; - var K = (Q >>> 7 | Q << 25) ^ (Q >>> 18 | Q << 14) ^ Q >>> 3; - a[U] = (R + a[U - 7] | 0) + (K + a[U - 16] | 0); - } - for (var U = 0; U < 64; U++) { - var R = (((L >>> 6 | L << 26) ^ (L >>> 11 | L << 21) ^ (L >>> 25 | L << 7)) + (L & B ^ ~L & k) | 0) + (W + (i[U] + a[U] | 0) | 0) | 0, K = ((w >>> 2 | w << 30) ^ (w >>> 13 | w << 19) ^ (w >>> 22 | w << 10)) + (w & _ ^ w & P ^ _ & P) | 0; - W = k, k = B, B = L, L = O + R | 0, O = P, P = _, _ = w, w = R + K | 0; - } - u[0] += w, u[1] += _, u[2] += P, u[3] += O, u[4] += L, u[5] += B, u[6] += k, u[7] += W, d += 64, p -= 64; - } - return d; - } - function o(a) { - var u = new n(); - u.update(a); - var l = u.digest(); - return u.clean(), l; - } - t.hash = o; -})(ih); -var lb = {}; -(function(t) { - Object.defineProperty(t, "__esModule", { value: !0 }), t.sharedKey = t.generateKeyPair = t.generateKeyPairFromSeed = t.scalarMultBase = t.scalarMult = t.SHARED_KEY_LENGTH = t.SECRET_KEY_LENGTH = t.PUBLIC_KEY_LENGTH = void 0; - const e = Da, r = Bi; - t.PUBLIC_KEY_LENGTH = 32, t.SECRET_KEY_LENGTH = 32, t.SHARED_KEY_LENGTH = 32; - function n(U) { - const V = new Float64Array(16); - if (U) - for (let Q = 0; Q < U.length; Q++) - V[Q] = U[Q]; - return V; - } - const i = new Uint8Array(32); - i[0] = 9; - const s = n([56129, 1]); - function o(U) { - let V = 1; - for (let Q = 0; Q < 16; Q++) { - let R = U[Q] + V + 65535; - V = Math.floor(R / 65536), U[Q] = R - V * 65536; - } - U[0] += V - 1 + 37 * (V - 1); - } - function a(U, V, Q) { - const R = ~(Q - 1); - for (let K = 0; K < 16; K++) { - const ge = R & (U[K] ^ V[K]); - U[K] ^= ge, V[K] ^= ge; - } - } - function u(U, V) { - const Q = n(), R = n(); - for (let K = 0; K < 16; K++) - R[K] = V[K]; - o(R), o(R), o(R); - for (let K = 0; K < 2; K++) { - Q[0] = R[0] - 65517; - for (let Ee = 1; Ee < 15; Ee++) - Q[Ee] = R[Ee] - 65535 - (Q[Ee - 1] >> 16 & 1), Q[Ee - 1] &= 65535; - Q[15] = R[15] - 32767 - (Q[14] >> 16 & 1); - const ge = Q[15] >> 16 & 1; - Q[14] &= 65535, a(R, Q, 1 - ge); - } - for (let K = 0; K < 16; K++) - U[2 * K] = R[K] & 255, U[2 * K + 1] = R[K] >> 8; - } - function l(U, V) { - for (let Q = 0; Q < 16; Q++) - U[Q] = V[2 * Q] + (V[2 * Q + 1] << 8); - U[15] &= 32767; - } - function d(U, V, Q) { - for (let R = 0; R < 16; R++) - U[R] = V[R] + Q[R]; - } - function p(U, V, Q) { - for (let R = 0; R < 16; R++) - U[R] = V[R] - Q[R]; - } - function w(U, V, Q) { - let R, K, ge = 0, Ee = 0, Y = 0, A = 0, m = 0, f = 0, g = 0, b = 0, x = 0, E = 0, S = 0, v = 0, M = 0, I = 0, F = 0, ce = 0, D = 0, oe = 0, Z = 0, J = 0, ee = 0, T = 0, X = 0, re = 0, pe = 0, ie = 0, ue = 0, ve = 0, Pe = 0, De = 0, Ce = 0, $e = Q[0], Me = Q[1], Ne = Q[2], Ke = Q[3], Le = Q[4], qe = Q[5], ze = Q[6], _e = Q[7], Ze = Q[8], at = Q[9], ke = Q[10], Qe = Q[11], tt = Q[12], Ye = Q[13], dt = Q[14], lt = Q[15]; - R = V[0], ge += R * $e, Ee += R * Me, Y += R * Ne, A += R * Ke, m += R * Le, f += R * qe, g += R * ze, b += R * _e, x += R * Ze, E += R * at, S += R * ke, v += R * Qe, M += R * tt, I += R * Ye, F += R * dt, ce += R * lt, R = V[1], Ee += R * $e, Y += R * Me, A += R * Ne, m += R * Ke, f += R * Le, g += R * qe, b += R * ze, x += R * _e, E += R * Ze, S += R * at, v += R * ke, M += R * Qe, I += R * tt, F += R * Ye, ce += R * dt, D += R * lt, R = V[2], Y += R * $e, A += R * Me, m += R * Ne, f += R * Ke, g += R * Le, b += R * qe, x += R * ze, E += R * _e, S += R * Ze, v += R * at, M += R * ke, I += R * Qe, F += R * tt, ce += R * Ye, D += R * dt, oe += R * lt, R = V[3], A += R * $e, m += R * Me, f += R * Ne, g += R * Ke, b += R * Le, x += R * qe, E += R * ze, S += R * _e, v += R * Ze, M += R * at, I += R * ke, F += R * Qe, ce += R * tt, D += R * Ye, oe += R * dt, Z += R * lt, R = V[4], m += R * $e, f += R * Me, g += R * Ne, b += R * Ke, x += R * Le, E += R * qe, S += R * ze, v += R * _e, M += R * Ze, I += R * at, F += R * ke, ce += R * Qe, D += R * tt, oe += R * Ye, Z += R * dt, J += R * lt, R = V[5], f += R * $e, g += R * Me, b += R * Ne, x += R * Ke, E += R * Le, S += R * qe, v += R * ze, M += R * _e, I += R * Ze, F += R * at, ce += R * ke, D += R * Qe, oe += R * tt, Z += R * Ye, J += R * dt, ee += R * lt, R = V[6], g += R * $e, b += R * Me, x += R * Ne, E += R * Ke, S += R * Le, v += R * qe, M += R * ze, I += R * _e, F += R * Ze, ce += R * at, D += R * ke, oe += R * Qe, Z += R * tt, J += R * Ye, ee += R * dt, T += R * lt, R = V[7], b += R * $e, x += R * Me, E += R * Ne, S += R * Ke, v += R * Le, M += R * qe, I += R * ze, F += R * _e, ce += R * Ze, D += R * at, oe += R * ke, Z += R * Qe, J += R * tt, ee += R * Ye, T += R * dt, X += R * lt, R = V[8], x += R * $e, E += R * Me, S += R * Ne, v += R * Ke, M += R * Le, I += R * qe, F += R * ze, ce += R * _e, D += R * Ze, oe += R * at, Z += R * ke, J += R * Qe, ee += R * tt, T += R * Ye, X += R * dt, re += R * lt, R = V[9], E += R * $e, S += R * Me, v += R * Ne, M += R * Ke, I += R * Le, F += R * qe, ce += R * ze, D += R * _e, oe += R * Ze, Z += R * at, J += R * ke, ee += R * Qe, T += R * tt, X += R * Ye, re += R * dt, pe += R * lt, R = V[10], S += R * $e, v += R * Me, M += R * Ne, I += R * Ke, F += R * Le, ce += R * qe, D += R * ze, oe += R * _e, Z += R * Ze, J += R * at, ee += R * ke, T += R * Qe, X += R * tt, re += R * Ye, pe += R * dt, ie += R * lt, R = V[11], v += R * $e, M += R * Me, I += R * Ne, F += R * Ke, ce += R * Le, D += R * qe, oe += R * ze, Z += R * _e, J += R * Ze, ee += R * at, T += R * ke, X += R * Qe, re += R * tt, pe += R * Ye, ie += R * dt, ue += R * lt, R = V[12], M += R * $e, I += R * Me, F += R * Ne, ce += R * Ke, D += R * Le, oe += R * qe, Z += R * ze, J += R * _e, ee += R * Ze, T += R * at, X += R * ke, re += R * Qe, pe += R * tt, ie += R * Ye, ue += R * dt, ve += R * lt, R = V[13], I += R * $e, F += R * Me, ce += R * Ne, D += R * Ke, oe += R * Le, Z += R * qe, J += R * ze, ee += R * _e, T += R * Ze, X += R * at, re += R * ke, pe += R * Qe, ie += R * tt, ue += R * Ye, ve += R * dt, Pe += R * lt, R = V[14], F += R * $e, ce += R * Me, D += R * Ne, oe += R * Ke, Z += R * Le, J += R * qe, ee += R * ze, T += R * _e, X += R * Ze, re += R * at, pe += R * ke, ie += R * Qe, ue += R * tt, ve += R * Ye, Pe += R * dt, De += R * lt, R = V[15], ce += R * $e, D += R * Me, oe += R * Ne, Z += R * Ke, J += R * Le, ee += R * qe, T += R * ze, X += R * _e, re += R * Ze, pe += R * at, ie += R * ke, ue += R * Qe, ve += R * tt, Pe += R * Ye, De += R * dt, Ce += R * lt, ge += 38 * D, Ee += 38 * oe, Y += 38 * Z, A += 38 * J, m += 38 * ee, f += 38 * T, g += 38 * X, b += 38 * re, x += 38 * pe, E += 38 * ie, S += 38 * ue, v += 38 * ve, M += 38 * Pe, I += 38 * De, F += 38 * Ce, K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = A + K + 65535, K = Math.floor(R / 65536), A = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = M + K + 65535, K = Math.floor(R / 65536), M = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), K = 1, R = ge + K + 65535, K = Math.floor(R / 65536), ge = R - K * 65536, R = Ee + K + 65535, K = Math.floor(R / 65536), Ee = R - K * 65536, R = Y + K + 65535, K = Math.floor(R / 65536), Y = R - K * 65536, R = A + K + 65535, K = Math.floor(R / 65536), A = R - K * 65536, R = m + K + 65535, K = Math.floor(R / 65536), m = R - K * 65536, R = f + K + 65535, K = Math.floor(R / 65536), f = R - K * 65536, R = g + K + 65535, K = Math.floor(R / 65536), g = R - K * 65536, R = b + K + 65535, K = Math.floor(R / 65536), b = R - K * 65536, R = x + K + 65535, K = Math.floor(R / 65536), x = R - K * 65536, R = E + K + 65535, K = Math.floor(R / 65536), E = R - K * 65536, R = S + K + 65535, K = Math.floor(R / 65536), S = R - K * 65536, R = v + K + 65535, K = Math.floor(R / 65536), v = R - K * 65536, R = M + K + 65535, K = Math.floor(R / 65536), M = R - K * 65536, R = I + K + 65535, K = Math.floor(R / 65536), I = R - K * 65536, R = F + K + 65535, K = Math.floor(R / 65536), F = R - K * 65536, R = ce + K + 65535, K = Math.floor(R / 65536), ce = R - K * 65536, ge += K - 1 + 37 * (K - 1), U[0] = ge, U[1] = Ee, U[2] = Y, U[3] = A, U[4] = m, U[5] = f, U[6] = g, U[7] = b, U[8] = x, U[9] = E, U[10] = S, U[11] = v, U[12] = M, U[13] = I, U[14] = F, U[15] = ce; - } - function _(U, V) { - w(U, V, V); - } - function P(U, V) { - const Q = n(); - for (let R = 0; R < 16; R++) - Q[R] = V[R]; - for (let R = 253; R >= 0; R--) - _(Q, Q), R !== 2 && R !== 4 && w(Q, Q, V); - for (let R = 0; R < 16; R++) - U[R] = Q[R]; - } - function O(U, V) { - const Q = new Uint8Array(32), R = new Float64Array(80), K = n(), ge = n(), Ee = n(), Y = n(), A = n(), m = n(); - for (let x = 0; x < 31; x++) - Q[x] = U[x]; - Q[31] = U[31] & 127 | 64, Q[0] &= 248, l(R, V); - for (let x = 0; x < 16; x++) - ge[x] = R[x]; - K[0] = Y[0] = 1; - for (let x = 254; x >= 0; --x) { - const E = Q[x >>> 3] >>> (x & 7) & 1; - a(K, ge, E), a(Ee, Y, E), d(A, K, Ee), p(K, K, Ee), d(Ee, ge, Y), p(ge, ge, Y), _(Y, A), _(m, K), w(K, Ee, K), w(Ee, ge, A), d(A, K, Ee), p(K, K, Ee), _(ge, K), p(Ee, Y, m), w(K, Ee, s), d(K, K, Y), w(Ee, Ee, K), w(K, Y, m), w(Y, ge, R), _(ge, A), a(K, ge, E), a(Ee, Y, E); - } - for (let x = 0; x < 16; x++) - R[x + 16] = K[x], R[x + 32] = Ee[x], R[x + 48] = ge[x], R[x + 64] = Y[x]; - const f = R.subarray(32), g = R.subarray(16); - P(f, f), w(g, g, f); - const b = new Uint8Array(32); - return u(b, g), b; - } - t.scalarMult = O; - function L(U) { - return O(U, i); - } - t.scalarMultBase = L; - function B(U) { - if (U.length !== t.SECRET_KEY_LENGTH) - throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`); - const V = new Uint8Array(U); - return { - publicKey: L(V), - secretKey: V - }; - } - t.generateKeyPairFromSeed = B; - function k(U) { - const V = (0, e.randomBytes)(32, U), Q = B(V); - return (0, r.wipe)(V), Q; - } - t.generateKeyPair = k; - function W(U, V, Q = !1) { - if (U.length !== t.PUBLIC_KEY_LENGTH) - throw new Error("X25519: incorrect secret key length"); - if (V.length !== t.PUBLIC_KEY_LENGTH) - throw new Error("X25519: incorrect public key length"); - const R = O(U, V); - if (Q) { - let K = 0; - for (let ge = 0; ge < R.length; ge++) - K |= R[ge]; - if (K === 0) - throw new Error("X25519: invalid shared key"); - } - return R; - } - t.sharedKey = W; -})(lb); -var J8 = {}; -const Eq = "elliptic", Sq = "6.6.0", Aq = "EC cryptography", Pq = "lib/elliptic.js", Mq = [ - "lib" -], Iq = { - lint: "eslint lib test", - "lint:fix": "npm run lint -- --fix", - unit: "istanbul test _mocha --reporter=spec test/index.js", - test: "npm run lint && npm run unit", - version: "grunt dist && git add dist/" -}, Cq = { - type: "git", - url: "git@github.com:indutny/elliptic" -}, Tq = [ - "EC", - "Elliptic", - "curve", - "Cryptography" -], Rq = "Fedor Indutny ", Dq = "MIT", Oq = { - url: "https://github.com/indutny/elliptic/issues" -}, Nq = "https://github.com/indutny/elliptic", Lq = { - brfs: "^2.0.2", - coveralls: "^3.1.0", - eslint: "^7.6.0", - grunt: "^1.2.1", - "grunt-browserify": "^5.3.0", - "grunt-cli": "^1.3.2", - "grunt-contrib-connect": "^3.0.0", - "grunt-contrib-copy": "^1.0.0", - "grunt-contrib-uglify": "^5.0.0", - "grunt-mocha-istanbul": "^5.0.2", - "grunt-saucelabs": "^9.0.1", - istanbul: "^0.4.5", - mocha: "^8.0.1" -}, kq = { - "bn.js": "^4.11.9", - brorand: "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - inherits: "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" -}, $q = { - name: Eq, - version: Sq, - description: Aq, - main: Pq, - files: Mq, - scripts: Iq, - repository: Cq, - keywords: Tq, - author: Rq, - license: Dq, - bugs: Oq, - homepage: Nq, - devDependencies: Lq, - dependencies: kq -}; -var ji = {}, hb = { exports: {} }; -hb.exports; -(function(t) { - (function(e, r) { - function n(Y, A) { - if (!Y) throw new Error(A || "Assertion failed"); - } - function i(Y, A) { - Y.super_ = A; - var m = function() { - }; - m.prototype = A.prototype, Y.prototype = new m(), Y.prototype.constructor = Y; - } - function s(Y, A, m) { - if (s.isBN(Y)) - return Y; - this.negative = 0, this.words = null, this.length = 0, this.red = null, Y !== null && ((A === "le" || A === "be") && (m = A, A = 10), this._init(Y || 0, A || 10, m || "be")); - } - typeof e == "object" ? e.exports = s : r.BN = s, s.BN = s, s.wordSize = 26; - var o; - try { - typeof window < "u" && typeof window.Buffer < "u" ? o = window.Buffer : o = Ql.Buffer; - } catch { - } - s.isBN = function(A) { - return A instanceof s ? !0 : A !== null && typeof A == "object" && A.constructor.wordSize === s.wordSize && Array.isArray(A.words); - }, s.max = function(A, m) { - return A.cmp(m) > 0 ? A : m; - }, s.min = function(A, m) { - return A.cmp(m) < 0 ? A : m; - }, s.prototype._init = function(A, m, f) { - if (typeof A == "number") - return this._initNumber(A, m, f); - if (typeof A == "object") - return this._initArray(A, m, f); - m === "hex" && (m = 16), n(m === (m | 0) && m >= 2 && m <= 36), A = A.toString().replace(/\s+/g, ""); - var g = 0; - A[0] === "-" && (g++, this.negative = 1), g < A.length && (m === 16 ? this._parseHex(A, g, f) : (this._parseBase(A, m, g), f === "le" && this._initArray(this.toArray(), m, f))); - }, s.prototype._initNumber = function(A, m, f) { - A < 0 && (this.negative = 1, A = -A), A < 67108864 ? (this.words = [A & 67108863], this.length = 1) : A < 4503599627370496 ? (this.words = [ - A & 67108863, - A / 67108864 & 67108863 - ], this.length = 2) : (n(A < 9007199254740992), this.words = [ - A & 67108863, - A / 67108864 & 67108863, - 1 - ], this.length = 3), f === "le" && this._initArray(this.toArray(), m, f); - }, s.prototype._initArray = function(A, m, f) { - if (n(typeof A.length == "number"), A.length <= 0) - return this.words = [0], this.length = 1, this; - this.length = Math.ceil(A.length / 3), this.words = new Array(this.length); - for (var g = 0; g < this.length; g++) - this.words[g] = 0; - var b, x, E = 0; - if (f === "be") - for (g = A.length - 1, b = 0; g >= 0; g -= 3) - x = A[g] | A[g - 1] << 8 | A[g - 2] << 16, this.words[b] |= x << E & 67108863, this.words[b + 1] = x >>> 26 - E & 67108863, E += 24, E >= 26 && (E -= 26, b++); - else if (f === "le") - for (g = 0, b = 0; g < A.length; g += 3) - x = A[g] | A[g + 1] << 8 | A[g + 2] << 16, this.words[b] |= x << E & 67108863, this.words[b + 1] = x >>> 26 - E & 67108863, E += 24, E >= 26 && (E -= 26, b++); - return this.strip(); - }; - function a(Y, A) { - var m = Y.charCodeAt(A); - return m >= 65 && m <= 70 ? m - 55 : m >= 97 && m <= 102 ? m - 87 : m - 48 & 15; - } - function u(Y, A, m) { - var f = a(Y, m); - return m - 1 >= A && (f |= a(Y, m - 1) << 4), f; - } - s.prototype._parseHex = function(A, m, f) { - this.length = Math.ceil((A.length - m) / 6), this.words = new Array(this.length); - for (var g = 0; g < this.length; g++) - this.words[g] = 0; - var b = 0, x = 0, E; - if (f === "be") - for (g = A.length - 1; g >= m; g -= 2) - E = u(A, m, g) << b, this.words[x] |= E & 67108863, b >= 18 ? (b -= 18, x += 1, this.words[x] |= E >>> 26) : b += 8; - else { - var S = A.length - m; - for (g = S % 2 === 0 ? m + 1 : m; g < A.length; g += 2) - E = u(A, m, g) << b, this.words[x] |= E & 67108863, b >= 18 ? (b -= 18, x += 1, this.words[x] |= E >>> 26) : b += 8; - } - this.strip(); - }; - function l(Y, A, m, f) { - for (var g = 0, b = Math.min(Y.length, m), x = A; x < b; x++) { - var E = Y.charCodeAt(x) - 48; - g *= f, E >= 49 ? g += E - 49 + 10 : E >= 17 ? g += E - 17 + 10 : g += E; - } - return g; - } - s.prototype._parseBase = function(A, m, f) { - this.words = [0], this.length = 1; - for (var g = 0, b = 1; b <= 67108863; b *= m) - g++; - g--, b = b / m | 0; - for (var x = A.length - f, E = x % g, S = Math.min(x, x - E) + f, v = 0, M = f; M < S; M += g) - v = l(A, M, M + g, m), this.imuln(b), this.words[0] + v < 67108864 ? this.words[0] += v : this._iaddn(v); - if (E !== 0) { - var I = 1; - for (v = l(A, M, A.length, m), M = 0; M < E; M++) - I *= m; - this.imuln(I), this.words[0] + v < 67108864 ? this.words[0] += v : this._iaddn(v); - } - this.strip(); - }, s.prototype.copy = function(A) { - A.words = new Array(this.length); - for (var m = 0; m < this.length; m++) - A.words[m] = this.words[m]; - A.length = this.length, A.negative = this.negative, A.red = this.red; - }, s.prototype.clone = function() { - var A = new s(null); - return this.copy(A), A; - }, s.prototype._expand = function(A) { - for (; this.length < A; ) - this.words[this.length++] = 0; - return this; - }, s.prototype.strip = function() { - for (; this.length > 1 && this.words[this.length - 1] === 0; ) - this.length--; - return this._normSign(); - }, s.prototype._normSign = function() { - return this.length === 1 && this.words[0] === 0 && (this.negative = 0), this; - }, s.prototype.inspect = function() { - return (this.red ? ""; - }; - var d = [ - "", - "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" - ], p = [ - 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 - ], w = [ - 0, - 0, - 33554432, - 43046721, - 16777216, - 48828125, - 60466176, - 40353607, - 16777216, - 43046721, - 1e7, - 19487171, - 35831808, - 62748517, - 7529536, - 11390625, - 16777216, - 24137569, - 34012224, - 47045881, - 64e6, - 4084101, - 5153632, - 6436343, - 7962624, - 9765625, - 11881376, - 14348907, - 17210368, - 20511149, - 243e5, - 28629151, - 33554432, - 39135393, - 45435424, - 52521875, - 60466176 - ]; - s.prototype.toString = function(A, m) { - A = A || 10, m = m | 0 || 1; - var f; - if (A === 16 || A === "hex") { - f = ""; - for (var g = 0, b = 0, x = 0; x < this.length; x++) { - var E = this.words[x], S = ((E << g | b) & 16777215).toString(16); - b = E >>> 24 - g & 16777215, g += 2, g >= 26 && (g -= 26, x--), b !== 0 || x !== this.length - 1 ? f = d[6 - S.length] + S + f : f = S + f; - } - for (b !== 0 && (f = b.toString(16) + f); f.length % m !== 0; ) - f = "0" + f; - return this.negative !== 0 && (f = "-" + f), f; - } - if (A === (A | 0) && A >= 2 && A <= 36) { - var v = p[A], M = w[A]; - f = ""; - var I = this.clone(); - for (I.negative = 0; !I.isZero(); ) { - var F = I.modn(M).toString(A); - I = I.idivn(M), I.isZero() ? f = F + f : f = d[v - F.length] + F + f; - } - for (this.isZero() && (f = "0" + f); f.length % m !== 0; ) - f = "0" + f; - return this.negative !== 0 && (f = "-" + f), f; - } - n(!1, "Base should be between 2 and 36"); - }, s.prototype.toNumber = function() { - var A = this.words[0]; - return this.length === 2 ? A += this.words[1] * 67108864 : this.length === 3 && this.words[2] === 1 ? A += 4503599627370496 + this.words[1] * 67108864 : this.length > 2 && n(!1, "Number can only safely store up to 53 bits"), this.negative !== 0 ? -A : A; - }, s.prototype.toJSON = function() { - return this.toString(16); - }, s.prototype.toBuffer = function(A, m) { - return n(typeof o < "u"), this.toArrayLike(o, A, m); - }, s.prototype.toArray = function(A, m) { - return this.toArrayLike(Array, A, m); - }, s.prototype.toArrayLike = function(A, m, f) { - var g = this.byteLength(), b = f || Math.max(1, g); - n(g <= b, "byte array longer than desired length"), n(b > 0, "Requested array length <= 0"), this.strip(); - var x = m === "le", E = new A(b), S, v, M = this.clone(); - if (x) { - for (v = 0; !M.isZero(); v++) - S = M.andln(255), M.iushrn(8), E[v] = S; - for (; v < b; v++) - E[v] = 0; - } else { - for (v = 0; v < b - g; v++) - E[v] = 0; - for (v = 0; !M.isZero(); v++) - S = M.andln(255), M.iushrn(8), E[b - v - 1] = S; - } - return E; - }, Math.clz32 ? s.prototype._countBits = function(A) { - return 32 - Math.clz32(A); - } : s.prototype._countBits = function(A) { - var m = A, f = 0; - return m >= 4096 && (f += 13, m >>>= 13), m >= 64 && (f += 7, m >>>= 7), m >= 8 && (f += 4, m >>>= 4), m >= 2 && (f += 2, m >>>= 2), f + m; - }, s.prototype._zeroBits = function(A) { - if (A === 0) return 26; - var m = A, f = 0; - return m & 8191 || (f += 13, m >>>= 13), m & 127 || (f += 7, m >>>= 7), m & 15 || (f += 4, m >>>= 4), m & 3 || (f += 2, m >>>= 2), m & 1 || f++, f; - }, s.prototype.bitLength = function() { - var A = this.words[this.length - 1], m = this._countBits(A); - return (this.length - 1) * 26 + m; - }; - function _(Y) { - for (var A = new Array(Y.bitLength()), m = 0; m < A.length; m++) { - var f = m / 26 | 0, g = m % 26; - A[m] = (Y.words[f] & 1 << g) >>> g; - } - return A; - } - s.prototype.zeroBits = function() { - if (this.isZero()) return 0; - for (var A = 0, m = 0; m < this.length; m++) { - var f = this._zeroBits(this.words[m]); - if (A += f, f !== 26) break; - } - return A; - }, s.prototype.byteLength = function() { - return Math.ceil(this.bitLength() / 8); - }, s.prototype.toTwos = function(A) { - return this.negative !== 0 ? this.abs().inotn(A).iaddn(1) : this.clone(); - }, s.prototype.fromTwos = function(A) { - return this.testn(A - 1) ? this.notn(A).iaddn(1).ineg() : this.clone(); - }, s.prototype.isNeg = function() { - return this.negative !== 0; - }, s.prototype.neg = function() { - return this.clone().ineg(); - }, s.prototype.ineg = function() { - return this.isZero() || (this.negative ^= 1), this; - }, s.prototype.iuor = function(A) { - for (; this.length < A.length; ) - this.words[this.length++] = 0; - for (var m = 0; m < A.length; m++) - this.words[m] = this.words[m] | A.words[m]; - return this.strip(); - }, s.prototype.ior = function(A) { - return n((this.negative | A.negative) === 0), this.iuor(A); - }, s.prototype.or = function(A) { - return this.length > A.length ? this.clone().ior(A) : A.clone().ior(this); - }, s.prototype.uor = function(A) { - return this.length > A.length ? this.clone().iuor(A) : A.clone().iuor(this); - }, s.prototype.iuand = function(A) { - var m; - this.length > A.length ? m = A : m = this; - for (var f = 0; f < m.length; f++) - this.words[f] = this.words[f] & A.words[f]; - return this.length = m.length, this.strip(); - }, s.prototype.iand = function(A) { - return n((this.negative | A.negative) === 0), this.iuand(A); - }, s.prototype.and = function(A) { - return this.length > A.length ? this.clone().iand(A) : A.clone().iand(this); - }, s.prototype.uand = function(A) { - return this.length > A.length ? this.clone().iuand(A) : A.clone().iuand(this); - }, s.prototype.iuxor = function(A) { - var m, f; - this.length > A.length ? (m = this, f = A) : (m = A, f = this); - for (var g = 0; g < f.length; g++) - this.words[g] = m.words[g] ^ f.words[g]; - if (this !== m) - for (; g < m.length; g++) - this.words[g] = m.words[g]; - return this.length = m.length, this.strip(); - }, s.prototype.ixor = function(A) { - return n((this.negative | A.negative) === 0), this.iuxor(A); - }, s.prototype.xor = function(A) { - return this.length > A.length ? this.clone().ixor(A) : A.clone().ixor(this); - }, s.prototype.uxor = function(A) { - return this.length > A.length ? this.clone().iuxor(A) : A.clone().iuxor(this); - }, s.prototype.inotn = function(A) { - n(typeof A == "number" && A >= 0); - var m = Math.ceil(A / 26) | 0, f = A % 26; - this._expand(m), f > 0 && m--; - for (var g = 0; g < m; g++) - this.words[g] = ~this.words[g] & 67108863; - return f > 0 && (this.words[g] = ~this.words[g] & 67108863 >> 26 - f), this.strip(); - }, s.prototype.notn = function(A) { - return this.clone().inotn(A); - }, s.prototype.setn = function(A, m) { - n(typeof A == "number" && A >= 0); - var f = A / 26 | 0, g = A % 26; - return this._expand(f + 1), m ? this.words[f] = this.words[f] | 1 << g : this.words[f] = this.words[f] & ~(1 << g), this.strip(); - }, s.prototype.iadd = function(A) { - var m; - if (this.negative !== 0 && A.negative === 0) - return this.negative = 0, m = this.isub(A), this.negative ^= 1, this._normSign(); - if (this.negative === 0 && A.negative !== 0) - return A.negative = 0, m = this.isub(A), A.negative = 1, m._normSign(); - var f, g; - this.length > A.length ? (f = this, g = A) : (f = A, g = this); - for (var b = 0, x = 0; x < g.length; x++) - m = (f.words[x] | 0) + (g.words[x] | 0) + b, this.words[x] = m & 67108863, b = m >>> 26; - for (; b !== 0 && x < f.length; x++) - m = (f.words[x] | 0) + b, this.words[x] = m & 67108863, b = m >>> 26; - if (this.length = f.length, b !== 0) - this.words[this.length] = b, this.length++; - else if (f !== this) - for (; x < f.length; x++) - this.words[x] = f.words[x]; - return this; - }, s.prototype.add = function(A) { - var m; - return A.negative !== 0 && this.negative === 0 ? (A.negative = 0, m = this.sub(A), A.negative ^= 1, m) : A.negative === 0 && this.negative !== 0 ? (this.negative = 0, m = A.sub(this), this.negative = 1, m) : this.length > A.length ? this.clone().iadd(A) : A.clone().iadd(this); - }, s.prototype.isub = function(A) { - if (A.negative !== 0) { - A.negative = 0; - var m = this.iadd(A); - return A.negative = 1, m._normSign(); - } else if (this.negative !== 0) - return this.negative = 0, this.iadd(A), this.negative = 1, this._normSign(); - var f = this.cmp(A); - if (f === 0) - return this.negative = 0, this.length = 1, this.words[0] = 0, this; - var g, b; - f > 0 ? (g = this, b = A) : (g = A, b = this); - for (var x = 0, E = 0; E < b.length; E++) - m = (g.words[E] | 0) - (b.words[E] | 0) + x, x = m >> 26, this.words[E] = m & 67108863; - for (; x !== 0 && E < g.length; E++) - m = (g.words[E] | 0) + x, x = m >> 26, this.words[E] = m & 67108863; - if (x === 0 && E < g.length && g !== this) - for (; E < g.length; E++) - this.words[E] = g.words[E]; - return this.length = Math.max(this.length, E), g !== this && (this.negative = 1), this.strip(); - }, s.prototype.sub = function(A) { - return this.clone().isub(A); - }; - function P(Y, A, m) { - m.negative = A.negative ^ Y.negative; - var f = Y.length + A.length | 0; - m.length = f, f = f - 1 | 0; - var g = Y.words[0] | 0, b = A.words[0] | 0, x = g * b, E = x & 67108863, S = x / 67108864 | 0; - m.words[0] = E; - for (var v = 1; v < f; v++) { - for (var M = S >>> 26, I = S & 67108863, F = Math.min(v, A.length - 1), ce = Math.max(0, v - Y.length + 1); ce <= F; ce++) { - var D = v - ce | 0; - g = Y.words[D] | 0, b = A.words[ce] | 0, x = g * b + I, M += x / 67108864 | 0, I = x & 67108863; - } - m.words[v] = I | 0, S = M | 0; - } - return S !== 0 ? m.words[v] = S | 0 : m.length--, m.strip(); - } - var O = function(A, m, f) { - var g = A.words, b = m.words, x = f.words, E = 0, S, v, M, I = g[0] | 0, F = I & 8191, ce = I >>> 13, D = g[1] | 0, oe = D & 8191, Z = D >>> 13, J = g[2] | 0, ee = J & 8191, T = J >>> 13, X = g[3] | 0, re = X & 8191, pe = X >>> 13, ie = g[4] | 0, ue = ie & 8191, ve = ie >>> 13, Pe = g[5] | 0, De = Pe & 8191, Ce = Pe >>> 13, $e = g[6] | 0, Me = $e & 8191, Ne = $e >>> 13, Ke = g[7] | 0, Le = Ke & 8191, qe = Ke >>> 13, ze = g[8] | 0, _e = ze & 8191, Ze = ze >>> 13, at = g[9] | 0, ke = at & 8191, Qe = at >>> 13, tt = b[0] | 0, Ye = tt & 8191, dt = tt >>> 13, lt = b[1] | 0, ct = lt & 8191, qt = lt >>> 13, Jt = b[2] | 0, Et = Jt & 8191, er = Jt >>> 13, Xt = b[3] | 0, Dt = Xt & 8191, kt = Xt >>> 13, Ct = b[4] | 0, mt = Ct & 8191, Rt = Ct >>> 13, Nt = b[5] | 0, bt = Nt & 8191, $t = Nt >>> 13, Ft = b[6] | 0, rt = Ft & 8191, Bt = Ft >>> 13, $ = b[7] | 0, q = $ & 8191, H = $ >>> 13, C = b[8] | 0, G = C & 8191, j = C >>> 13, se = b[9] | 0, de = se & 8191, xe = se >>> 13; - f.negative = A.negative ^ m.negative, f.length = 19, S = Math.imul(F, Ye), v = Math.imul(F, dt), v = v + Math.imul(ce, Ye) | 0, M = Math.imul(ce, dt); - var Te = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (Te >>> 26) | 0, Te &= 67108863, S = Math.imul(oe, Ye), v = Math.imul(oe, dt), v = v + Math.imul(Z, Ye) | 0, M = Math.imul(Z, dt), S = S + Math.imul(F, ct) | 0, v = v + Math.imul(F, qt) | 0, v = v + Math.imul(ce, ct) | 0, M = M + Math.imul(ce, qt) | 0; - var Re = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (Re >>> 26) | 0, Re &= 67108863, S = Math.imul(ee, Ye), v = Math.imul(ee, dt), v = v + Math.imul(T, Ye) | 0, M = Math.imul(T, dt), S = S + Math.imul(oe, ct) | 0, v = v + Math.imul(oe, qt) | 0, v = v + Math.imul(Z, ct) | 0, M = M + Math.imul(Z, qt) | 0, S = S + Math.imul(F, Et) | 0, v = v + Math.imul(F, er) | 0, v = v + Math.imul(ce, Et) | 0, M = M + Math.imul(ce, er) | 0; - var nt = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (nt >>> 26) | 0, nt &= 67108863, S = Math.imul(re, Ye), v = Math.imul(re, dt), v = v + Math.imul(pe, Ye) | 0, M = Math.imul(pe, dt), S = S + Math.imul(ee, ct) | 0, v = v + Math.imul(ee, qt) | 0, v = v + Math.imul(T, ct) | 0, M = M + Math.imul(T, qt) | 0, S = S + Math.imul(oe, Et) | 0, v = v + Math.imul(oe, er) | 0, v = v + Math.imul(Z, Et) | 0, M = M + Math.imul(Z, er) | 0, S = S + Math.imul(F, Dt) | 0, v = v + Math.imul(F, kt) | 0, v = v + Math.imul(ce, Dt) | 0, M = M + Math.imul(ce, kt) | 0; - var je = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (je >>> 26) | 0, je &= 67108863, S = Math.imul(ue, Ye), v = Math.imul(ue, dt), v = v + Math.imul(ve, Ye) | 0, M = Math.imul(ve, dt), S = S + Math.imul(re, ct) | 0, v = v + Math.imul(re, qt) | 0, v = v + Math.imul(pe, ct) | 0, M = M + Math.imul(pe, qt) | 0, S = S + Math.imul(ee, Et) | 0, v = v + Math.imul(ee, er) | 0, v = v + Math.imul(T, Et) | 0, M = M + Math.imul(T, er) | 0, S = S + Math.imul(oe, Dt) | 0, v = v + Math.imul(oe, kt) | 0, v = v + Math.imul(Z, Dt) | 0, M = M + Math.imul(Z, kt) | 0, S = S + Math.imul(F, mt) | 0, v = v + Math.imul(F, Rt) | 0, v = v + Math.imul(ce, mt) | 0, M = M + Math.imul(ce, Rt) | 0; - var pt = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (pt >>> 26) | 0, pt &= 67108863, S = Math.imul(De, Ye), v = Math.imul(De, dt), v = v + Math.imul(Ce, Ye) | 0, M = Math.imul(Ce, dt), S = S + Math.imul(ue, ct) | 0, v = v + Math.imul(ue, qt) | 0, v = v + Math.imul(ve, ct) | 0, M = M + Math.imul(ve, qt) | 0, S = S + Math.imul(re, Et) | 0, v = v + Math.imul(re, er) | 0, v = v + Math.imul(pe, Et) | 0, M = M + Math.imul(pe, er) | 0, S = S + Math.imul(ee, Dt) | 0, v = v + Math.imul(ee, kt) | 0, v = v + Math.imul(T, Dt) | 0, M = M + Math.imul(T, kt) | 0, S = S + Math.imul(oe, mt) | 0, v = v + Math.imul(oe, Rt) | 0, v = v + Math.imul(Z, mt) | 0, M = M + Math.imul(Z, Rt) | 0, S = S + Math.imul(F, bt) | 0, v = v + Math.imul(F, $t) | 0, v = v + Math.imul(ce, bt) | 0, M = M + Math.imul(ce, $t) | 0; - var it = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (it >>> 26) | 0, it &= 67108863, S = Math.imul(Me, Ye), v = Math.imul(Me, dt), v = v + Math.imul(Ne, Ye) | 0, M = Math.imul(Ne, dt), S = S + Math.imul(De, ct) | 0, v = v + Math.imul(De, qt) | 0, v = v + Math.imul(Ce, ct) | 0, M = M + Math.imul(Ce, qt) | 0, S = S + Math.imul(ue, Et) | 0, v = v + Math.imul(ue, er) | 0, v = v + Math.imul(ve, Et) | 0, M = M + Math.imul(ve, er) | 0, S = S + Math.imul(re, Dt) | 0, v = v + Math.imul(re, kt) | 0, v = v + Math.imul(pe, Dt) | 0, M = M + Math.imul(pe, kt) | 0, S = S + Math.imul(ee, mt) | 0, v = v + Math.imul(ee, Rt) | 0, v = v + Math.imul(T, mt) | 0, M = M + Math.imul(T, Rt) | 0, S = S + Math.imul(oe, bt) | 0, v = v + Math.imul(oe, $t) | 0, v = v + Math.imul(Z, bt) | 0, M = M + Math.imul(Z, $t) | 0, S = S + Math.imul(F, rt) | 0, v = v + Math.imul(F, Bt) | 0, v = v + Math.imul(ce, rt) | 0, M = M + Math.imul(ce, Bt) | 0; - var et = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (et >>> 26) | 0, et &= 67108863, S = Math.imul(Le, Ye), v = Math.imul(Le, dt), v = v + Math.imul(qe, Ye) | 0, M = Math.imul(qe, dt), S = S + Math.imul(Me, ct) | 0, v = v + Math.imul(Me, qt) | 0, v = v + Math.imul(Ne, ct) | 0, M = M + Math.imul(Ne, qt) | 0, S = S + Math.imul(De, Et) | 0, v = v + Math.imul(De, er) | 0, v = v + Math.imul(Ce, Et) | 0, M = M + Math.imul(Ce, er) | 0, S = S + Math.imul(ue, Dt) | 0, v = v + Math.imul(ue, kt) | 0, v = v + Math.imul(ve, Dt) | 0, M = M + Math.imul(ve, kt) | 0, S = S + Math.imul(re, mt) | 0, v = v + Math.imul(re, Rt) | 0, v = v + Math.imul(pe, mt) | 0, M = M + Math.imul(pe, Rt) | 0, S = S + Math.imul(ee, bt) | 0, v = v + Math.imul(ee, $t) | 0, v = v + Math.imul(T, bt) | 0, M = M + Math.imul(T, $t) | 0, S = S + Math.imul(oe, rt) | 0, v = v + Math.imul(oe, Bt) | 0, v = v + Math.imul(Z, rt) | 0, M = M + Math.imul(Z, Bt) | 0, S = S + Math.imul(F, q) | 0, v = v + Math.imul(F, H) | 0, v = v + Math.imul(ce, q) | 0, M = M + Math.imul(ce, H) | 0; - var St = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, S = Math.imul(_e, Ye), v = Math.imul(_e, dt), v = v + Math.imul(Ze, Ye) | 0, M = Math.imul(Ze, dt), S = S + Math.imul(Le, ct) | 0, v = v + Math.imul(Le, qt) | 0, v = v + Math.imul(qe, ct) | 0, M = M + Math.imul(qe, qt) | 0, S = S + Math.imul(Me, Et) | 0, v = v + Math.imul(Me, er) | 0, v = v + Math.imul(Ne, Et) | 0, M = M + Math.imul(Ne, er) | 0, S = S + Math.imul(De, Dt) | 0, v = v + Math.imul(De, kt) | 0, v = v + Math.imul(Ce, Dt) | 0, M = M + Math.imul(Ce, kt) | 0, S = S + Math.imul(ue, mt) | 0, v = v + Math.imul(ue, Rt) | 0, v = v + Math.imul(ve, mt) | 0, M = M + Math.imul(ve, Rt) | 0, S = S + Math.imul(re, bt) | 0, v = v + Math.imul(re, $t) | 0, v = v + Math.imul(pe, bt) | 0, M = M + Math.imul(pe, $t) | 0, S = S + Math.imul(ee, rt) | 0, v = v + Math.imul(ee, Bt) | 0, v = v + Math.imul(T, rt) | 0, M = M + Math.imul(T, Bt) | 0, S = S + Math.imul(oe, q) | 0, v = v + Math.imul(oe, H) | 0, v = v + Math.imul(Z, q) | 0, M = M + Math.imul(Z, H) | 0, S = S + Math.imul(F, G) | 0, v = v + Math.imul(F, j) | 0, v = v + Math.imul(ce, G) | 0, M = M + Math.imul(ce, j) | 0; - var Tt = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (Tt >>> 26) | 0, Tt &= 67108863, S = Math.imul(ke, Ye), v = Math.imul(ke, dt), v = v + Math.imul(Qe, Ye) | 0, M = Math.imul(Qe, dt), S = S + Math.imul(_e, ct) | 0, v = v + Math.imul(_e, qt) | 0, v = v + Math.imul(Ze, ct) | 0, M = M + Math.imul(Ze, qt) | 0, S = S + Math.imul(Le, Et) | 0, v = v + Math.imul(Le, er) | 0, v = v + Math.imul(qe, Et) | 0, M = M + Math.imul(qe, er) | 0, S = S + Math.imul(Me, Dt) | 0, v = v + Math.imul(Me, kt) | 0, v = v + Math.imul(Ne, Dt) | 0, M = M + Math.imul(Ne, kt) | 0, S = S + Math.imul(De, mt) | 0, v = v + Math.imul(De, Rt) | 0, v = v + Math.imul(Ce, mt) | 0, M = M + Math.imul(Ce, Rt) | 0, S = S + Math.imul(ue, bt) | 0, v = v + Math.imul(ue, $t) | 0, v = v + Math.imul(ve, bt) | 0, M = M + Math.imul(ve, $t) | 0, S = S + Math.imul(re, rt) | 0, v = v + Math.imul(re, Bt) | 0, v = v + Math.imul(pe, rt) | 0, M = M + Math.imul(pe, Bt) | 0, S = S + Math.imul(ee, q) | 0, v = v + Math.imul(ee, H) | 0, v = v + Math.imul(T, q) | 0, M = M + Math.imul(T, H) | 0, S = S + Math.imul(oe, G) | 0, v = v + Math.imul(oe, j) | 0, v = v + Math.imul(Z, G) | 0, M = M + Math.imul(Z, j) | 0, S = S + Math.imul(F, de) | 0, v = v + Math.imul(F, xe) | 0, v = v + Math.imul(ce, de) | 0, M = M + Math.imul(ce, xe) | 0; - var At = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, S = Math.imul(ke, ct), v = Math.imul(ke, qt), v = v + Math.imul(Qe, ct) | 0, M = Math.imul(Qe, qt), S = S + Math.imul(_e, Et) | 0, v = v + Math.imul(_e, er) | 0, v = v + Math.imul(Ze, Et) | 0, M = M + Math.imul(Ze, er) | 0, S = S + Math.imul(Le, Dt) | 0, v = v + Math.imul(Le, kt) | 0, v = v + Math.imul(qe, Dt) | 0, M = M + Math.imul(qe, kt) | 0, S = S + Math.imul(Me, mt) | 0, v = v + Math.imul(Me, Rt) | 0, v = v + Math.imul(Ne, mt) | 0, M = M + Math.imul(Ne, Rt) | 0, S = S + Math.imul(De, bt) | 0, v = v + Math.imul(De, $t) | 0, v = v + Math.imul(Ce, bt) | 0, M = M + Math.imul(Ce, $t) | 0, S = S + Math.imul(ue, rt) | 0, v = v + Math.imul(ue, Bt) | 0, v = v + Math.imul(ve, rt) | 0, M = M + Math.imul(ve, Bt) | 0, S = S + Math.imul(re, q) | 0, v = v + Math.imul(re, H) | 0, v = v + Math.imul(pe, q) | 0, M = M + Math.imul(pe, H) | 0, S = S + Math.imul(ee, G) | 0, v = v + Math.imul(ee, j) | 0, v = v + Math.imul(T, G) | 0, M = M + Math.imul(T, j) | 0, S = S + Math.imul(oe, de) | 0, v = v + Math.imul(oe, xe) | 0, v = v + Math.imul(Z, de) | 0, M = M + Math.imul(Z, xe) | 0; - var _t = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, S = Math.imul(ke, Et), v = Math.imul(ke, er), v = v + Math.imul(Qe, Et) | 0, M = Math.imul(Qe, er), S = S + Math.imul(_e, Dt) | 0, v = v + Math.imul(_e, kt) | 0, v = v + Math.imul(Ze, Dt) | 0, M = M + Math.imul(Ze, kt) | 0, S = S + Math.imul(Le, mt) | 0, v = v + Math.imul(Le, Rt) | 0, v = v + Math.imul(qe, mt) | 0, M = M + Math.imul(qe, Rt) | 0, S = S + Math.imul(Me, bt) | 0, v = v + Math.imul(Me, $t) | 0, v = v + Math.imul(Ne, bt) | 0, M = M + Math.imul(Ne, $t) | 0, S = S + Math.imul(De, rt) | 0, v = v + Math.imul(De, Bt) | 0, v = v + Math.imul(Ce, rt) | 0, M = M + Math.imul(Ce, Bt) | 0, S = S + Math.imul(ue, q) | 0, v = v + Math.imul(ue, H) | 0, v = v + Math.imul(ve, q) | 0, M = M + Math.imul(ve, H) | 0, S = S + Math.imul(re, G) | 0, v = v + Math.imul(re, j) | 0, v = v + Math.imul(pe, G) | 0, M = M + Math.imul(pe, j) | 0, S = S + Math.imul(ee, de) | 0, v = v + Math.imul(ee, xe) | 0, v = v + Math.imul(T, de) | 0, M = M + Math.imul(T, xe) | 0; - var ht = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (ht >>> 26) | 0, ht &= 67108863, S = Math.imul(ke, Dt), v = Math.imul(ke, kt), v = v + Math.imul(Qe, Dt) | 0, M = Math.imul(Qe, kt), S = S + Math.imul(_e, mt) | 0, v = v + Math.imul(_e, Rt) | 0, v = v + Math.imul(Ze, mt) | 0, M = M + Math.imul(Ze, Rt) | 0, S = S + Math.imul(Le, bt) | 0, v = v + Math.imul(Le, $t) | 0, v = v + Math.imul(qe, bt) | 0, M = M + Math.imul(qe, $t) | 0, S = S + Math.imul(Me, rt) | 0, v = v + Math.imul(Me, Bt) | 0, v = v + Math.imul(Ne, rt) | 0, M = M + Math.imul(Ne, Bt) | 0, S = S + Math.imul(De, q) | 0, v = v + Math.imul(De, H) | 0, v = v + Math.imul(Ce, q) | 0, M = M + Math.imul(Ce, H) | 0, S = S + Math.imul(ue, G) | 0, v = v + Math.imul(ue, j) | 0, v = v + Math.imul(ve, G) | 0, M = M + Math.imul(ve, j) | 0, S = S + Math.imul(re, de) | 0, v = v + Math.imul(re, xe) | 0, v = v + Math.imul(pe, de) | 0, M = M + Math.imul(pe, xe) | 0; - var xt = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, S = Math.imul(ke, mt), v = Math.imul(ke, Rt), v = v + Math.imul(Qe, mt) | 0, M = Math.imul(Qe, Rt), S = S + Math.imul(_e, bt) | 0, v = v + Math.imul(_e, $t) | 0, v = v + Math.imul(Ze, bt) | 0, M = M + Math.imul(Ze, $t) | 0, S = S + Math.imul(Le, rt) | 0, v = v + Math.imul(Le, Bt) | 0, v = v + Math.imul(qe, rt) | 0, M = M + Math.imul(qe, Bt) | 0, S = S + Math.imul(Me, q) | 0, v = v + Math.imul(Me, H) | 0, v = v + Math.imul(Ne, q) | 0, M = M + Math.imul(Ne, H) | 0, S = S + Math.imul(De, G) | 0, v = v + Math.imul(De, j) | 0, v = v + Math.imul(Ce, G) | 0, M = M + Math.imul(Ce, j) | 0, S = S + Math.imul(ue, de) | 0, v = v + Math.imul(ue, xe) | 0, v = v + Math.imul(ve, de) | 0, M = M + Math.imul(ve, xe) | 0; - var st = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (st >>> 26) | 0, st &= 67108863, S = Math.imul(ke, bt), v = Math.imul(ke, $t), v = v + Math.imul(Qe, bt) | 0, M = Math.imul(Qe, $t), S = S + Math.imul(_e, rt) | 0, v = v + Math.imul(_e, Bt) | 0, v = v + Math.imul(Ze, rt) | 0, M = M + Math.imul(Ze, Bt) | 0, S = S + Math.imul(Le, q) | 0, v = v + Math.imul(Le, H) | 0, v = v + Math.imul(qe, q) | 0, M = M + Math.imul(qe, H) | 0, S = S + Math.imul(Me, G) | 0, v = v + Math.imul(Me, j) | 0, v = v + Math.imul(Ne, G) | 0, M = M + Math.imul(Ne, j) | 0, S = S + Math.imul(De, de) | 0, v = v + Math.imul(De, xe) | 0, v = v + Math.imul(Ce, de) | 0, M = M + Math.imul(Ce, xe) | 0; - var yt = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (yt >>> 26) | 0, yt &= 67108863, S = Math.imul(ke, rt), v = Math.imul(ke, Bt), v = v + Math.imul(Qe, rt) | 0, M = Math.imul(Qe, Bt), S = S + Math.imul(_e, q) | 0, v = v + Math.imul(_e, H) | 0, v = v + Math.imul(Ze, q) | 0, M = M + Math.imul(Ze, H) | 0, S = S + Math.imul(Le, G) | 0, v = v + Math.imul(Le, j) | 0, v = v + Math.imul(qe, G) | 0, M = M + Math.imul(qe, j) | 0, S = S + Math.imul(Me, de) | 0, v = v + Math.imul(Me, xe) | 0, v = v + Math.imul(Ne, de) | 0, M = M + Math.imul(Ne, xe) | 0; - var ut = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (ut >>> 26) | 0, ut &= 67108863, S = Math.imul(ke, q), v = Math.imul(ke, H), v = v + Math.imul(Qe, q) | 0, M = Math.imul(Qe, H), S = S + Math.imul(_e, G) | 0, v = v + Math.imul(_e, j) | 0, v = v + Math.imul(Ze, G) | 0, M = M + Math.imul(Ze, j) | 0, S = S + Math.imul(Le, de) | 0, v = v + Math.imul(Le, xe) | 0, v = v + Math.imul(qe, de) | 0, M = M + Math.imul(qe, xe) | 0; - var ot = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (ot >>> 26) | 0, ot &= 67108863, S = Math.imul(ke, G), v = Math.imul(ke, j), v = v + Math.imul(Qe, G) | 0, M = Math.imul(Qe, j), S = S + Math.imul(_e, de) | 0, v = v + Math.imul(_e, xe) | 0, v = v + Math.imul(Ze, de) | 0, M = M + Math.imul(Ze, xe) | 0; - var Se = (E + S | 0) + ((v & 8191) << 13) | 0; - E = (M + (v >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, S = Math.imul(ke, de), v = Math.imul(ke, xe), v = v + Math.imul(Qe, de) | 0, M = Math.imul(Qe, xe); - var Ae = (E + S | 0) + ((v & 8191) << 13) | 0; - return E = (M + (v >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, x[0] = Te, x[1] = Re, x[2] = nt, x[3] = je, x[4] = pt, x[5] = it, x[6] = et, x[7] = St, x[8] = Tt, x[9] = At, x[10] = _t, x[11] = ht, x[12] = xt, x[13] = st, x[14] = yt, x[15] = ut, x[16] = ot, x[17] = Se, x[18] = Ae, E !== 0 && (x[19] = E, f.length++), f; - }; - Math.imul || (O = P); - function L(Y, A, m) { - m.negative = A.negative ^ Y.negative, m.length = Y.length + A.length; - for (var f = 0, g = 0, b = 0; b < m.length - 1; b++) { - var x = g; - g = 0; - for (var E = f & 67108863, S = Math.min(b, A.length - 1), v = Math.max(0, b - Y.length + 1); v <= S; v++) { - var M = b - v, I = Y.words[M] | 0, F = A.words[v] | 0, ce = I * F, D = ce & 67108863; - x = x + (ce / 67108864 | 0) | 0, D = D + E | 0, E = D & 67108863, x = x + (D >>> 26) | 0, g += x >>> 26, x &= 67108863; - } - m.words[b] = E, f = x, x = g; - } - return f !== 0 ? m.words[b] = f : m.length--, m.strip(); - } - function B(Y, A, m) { - var f = new k(); - return f.mulp(Y, A, m); - } - s.prototype.mulTo = function(A, m) { - var f, g = this.length + A.length; - return this.length === 10 && A.length === 10 ? f = O(this, A, m) : g < 63 ? f = P(this, A, m) : g < 1024 ? f = L(this, A, m) : f = B(this, A, m), f; - }; - function k(Y, A) { - this.x = Y, this.y = A; - } - k.prototype.makeRBT = function(A) { - for (var m = new Array(A), f = s.prototype._countBits(A) - 1, g = 0; g < A; g++) - m[g] = this.revBin(g, f, A); - return m; - }, k.prototype.revBin = function(A, m, f) { - if (A === 0 || A === f - 1) return A; - for (var g = 0, b = 0; b < m; b++) - g |= (A & 1) << m - b - 1, A >>= 1; - return g; - }, k.prototype.permute = function(A, m, f, g, b, x) { - for (var E = 0; E < x; E++) - g[E] = m[A[E]], b[E] = f[A[E]]; - }, k.prototype.transform = function(A, m, f, g, b, x) { - this.permute(x, A, m, f, g, b); - for (var E = 1; E < b; E <<= 1) - for (var S = E << 1, v = Math.cos(2 * Math.PI / S), M = Math.sin(2 * Math.PI / S), I = 0; I < b; I += S) - for (var F = v, ce = M, D = 0; D < E; D++) { - var oe = f[I + D], Z = g[I + D], J = f[I + D + E], ee = g[I + D + E], T = F * J - ce * ee; - ee = F * ee + ce * J, J = T, f[I + D] = oe + J, g[I + D] = Z + ee, f[I + D + E] = oe - J, g[I + D + E] = Z - ee, D !== S && (T = v * F - M * ce, ce = v * ce + M * F, F = T); - } - }, k.prototype.guessLen13b = function(A, m) { - var f = Math.max(m, A) | 1, g = f & 1, b = 0; - for (f = f / 2 | 0; f; f = f >>> 1) - b++; - return 1 << b + 1 + g; - }, k.prototype.conjugate = function(A, m, f) { - if (!(f <= 1)) - for (var g = 0; g < f / 2; g++) { - var b = A[g]; - A[g] = A[f - g - 1], A[f - g - 1] = b, b = m[g], m[g] = -m[f - g - 1], m[f - g - 1] = -b; - } - }, k.prototype.normalize13b = function(A, m) { - for (var f = 0, g = 0; g < m / 2; g++) { - var b = Math.round(A[2 * g + 1] / m) * 8192 + Math.round(A[2 * g] / m) + f; - A[g] = b & 67108863, b < 67108864 ? f = 0 : f = b / 67108864 | 0; - } - return A; - }, k.prototype.convert13b = function(A, m, f, g) { - for (var b = 0, x = 0; x < m; x++) - b = b + (A[x] | 0), f[2 * x] = b & 8191, b = b >>> 13, f[2 * x + 1] = b & 8191, b = b >>> 13; - for (x = 2 * m; x < g; ++x) - f[x] = 0; - n(b === 0), n((b & -8192) === 0); - }, k.prototype.stub = function(A) { - for (var m = new Array(A), f = 0; f < A; f++) - m[f] = 0; - return m; - }, k.prototype.mulp = function(A, m, f) { - var g = 2 * this.guessLen13b(A.length, m.length), b = this.makeRBT(g), x = this.stub(g), E = new Array(g), S = new Array(g), v = new Array(g), M = new Array(g), I = new Array(g), F = new Array(g), ce = f.words; - ce.length = g, this.convert13b(A.words, A.length, E, g), this.convert13b(m.words, m.length, M, g), this.transform(E, x, S, v, g, b), this.transform(M, x, I, F, g, b); - for (var D = 0; D < g; D++) { - var oe = S[D] * I[D] - v[D] * F[D]; - v[D] = S[D] * F[D] + v[D] * I[D], S[D] = oe; - } - return this.conjugate(S, v, g), this.transform(S, v, ce, x, g, b), this.conjugate(ce, x, g), this.normalize13b(ce, g), f.negative = A.negative ^ m.negative, f.length = A.length + m.length, f.strip(); - }, s.prototype.mul = function(A) { - var m = new s(null); - return m.words = new Array(this.length + A.length), this.mulTo(A, m); - }, s.prototype.mulf = function(A) { - var m = new s(null); - return m.words = new Array(this.length + A.length), B(this, A, m); - }, s.prototype.imul = function(A) { - return this.clone().mulTo(A, this); - }, s.prototype.imuln = function(A) { - n(typeof A == "number"), n(A < 67108864); - for (var m = 0, f = 0; f < this.length; f++) { - var g = (this.words[f] | 0) * A, b = (g & 67108863) + (m & 67108863); - m >>= 26, m += g / 67108864 | 0, m += b >>> 26, this.words[f] = b & 67108863; - } - return m !== 0 && (this.words[f] = m, this.length++), this; - }, s.prototype.muln = function(A) { - return this.clone().imuln(A); - }, s.prototype.sqr = function() { - return this.mul(this); - }, s.prototype.isqr = function() { - return this.imul(this.clone()); - }, s.prototype.pow = function(A) { - var m = _(A); - if (m.length === 0) return new s(1); - for (var f = this, g = 0; g < m.length && m[g] === 0; g++, f = f.sqr()) - ; - if (++g < m.length) - for (var b = f.sqr(); g < m.length; g++, b = b.sqr()) - m[g] !== 0 && (f = f.mul(b)); - return f; - }, s.prototype.iushln = function(A) { - n(typeof A == "number" && A >= 0); - var m = A % 26, f = (A - m) / 26, g = 67108863 >>> 26 - m << 26 - m, b; - if (m !== 0) { - var x = 0; - for (b = 0; b < this.length; b++) { - var E = this.words[b] & g, S = (this.words[b] | 0) - E << m; - this.words[b] = S | x, x = E >>> 26 - m; - } - x && (this.words[b] = x, this.length++); - } - if (f !== 0) { - for (b = this.length - 1; b >= 0; b--) - this.words[b + f] = this.words[b]; - for (b = 0; b < f; b++) - this.words[b] = 0; - this.length += f; - } - return this.strip(); - }, s.prototype.ishln = function(A) { - return n(this.negative === 0), this.iushln(A); - }, s.prototype.iushrn = function(A, m, f) { - n(typeof A == "number" && A >= 0); - var g; - m ? g = (m - m % 26) / 26 : g = 0; - var b = A % 26, x = Math.min((A - b) / 26, this.length), E = 67108863 ^ 67108863 >>> b << b, S = f; - if (g -= x, g = Math.max(0, g), S) { - for (var v = 0; v < x; v++) - S.words[v] = this.words[v]; - S.length = x; - } - if (x !== 0) if (this.length > x) - for (this.length -= x, v = 0; v < this.length; v++) - this.words[v] = this.words[v + x]; - else - this.words[0] = 0, this.length = 1; - var M = 0; - for (v = this.length - 1; v >= 0 && (M !== 0 || v >= g); v--) { - var I = this.words[v] | 0; - this.words[v] = M << 26 - b | I >>> b, M = I & E; - } - return S && M !== 0 && (S.words[S.length++] = M), this.length === 0 && (this.words[0] = 0, this.length = 1), this.strip(); - }, s.prototype.ishrn = function(A, m, f) { - return n(this.negative === 0), this.iushrn(A, m, f); - }, s.prototype.shln = function(A) { - return this.clone().ishln(A); - }, s.prototype.ushln = function(A) { - return this.clone().iushln(A); - }, s.prototype.shrn = function(A) { - return this.clone().ishrn(A); - }, s.prototype.ushrn = function(A) { - return this.clone().iushrn(A); - }, s.prototype.testn = function(A) { - n(typeof A == "number" && A >= 0); - var m = A % 26, f = (A - m) / 26, g = 1 << m; - if (this.length <= f) return !1; - var b = this.words[f]; - return !!(b & g); - }, s.prototype.imaskn = function(A) { - n(typeof A == "number" && A >= 0); - var m = A % 26, f = (A - m) / 26; - if (n(this.negative === 0, "imaskn works only with positive numbers"), this.length <= f) - return this; - if (m !== 0 && f++, this.length = Math.min(f, this.length), m !== 0) { - var g = 67108863 ^ 67108863 >>> m << m; - this.words[this.length - 1] &= g; - } - return this.strip(); - }, s.prototype.maskn = function(A) { - return this.clone().imaskn(A); - }, s.prototype.iaddn = function(A) { - return n(typeof A == "number"), n(A < 67108864), A < 0 ? this.isubn(-A) : this.negative !== 0 ? this.length === 1 && (this.words[0] | 0) < A ? (this.words[0] = A - (this.words[0] | 0), this.negative = 0, this) : (this.negative = 0, this.isubn(A), this.negative = 1, this) : this._iaddn(A); - }, s.prototype._iaddn = function(A) { - this.words[0] += A; - for (var m = 0; m < this.length && this.words[m] >= 67108864; m++) - this.words[m] -= 67108864, m === this.length - 1 ? this.words[m + 1] = 1 : this.words[m + 1]++; - return this.length = Math.max(this.length, m + 1), this; - }, s.prototype.isubn = function(A) { - if (n(typeof A == "number"), n(A < 67108864), A < 0) return this.iaddn(-A); - if (this.negative !== 0) - return this.negative = 0, this.iaddn(A), this.negative = 1, this; - if (this.words[0] -= A, this.length === 1 && this.words[0] < 0) - this.words[0] = -this.words[0], this.negative = 1; - else - for (var m = 0; m < this.length && this.words[m] < 0; m++) - this.words[m] += 67108864, this.words[m + 1] -= 1; - return this.strip(); - }, s.prototype.addn = function(A) { - return this.clone().iaddn(A); - }, s.prototype.subn = function(A) { - return this.clone().isubn(A); - }, s.prototype.iabs = function() { - return this.negative = 0, this; - }, s.prototype.abs = function() { - return this.clone().iabs(); - }, s.prototype._ishlnsubmul = function(A, m, f) { - var g = A.length + f, b; - this._expand(g); - var x, E = 0; - for (b = 0; b < A.length; b++) { - x = (this.words[b + f] | 0) + E; - var S = (A.words[b] | 0) * m; - x -= S & 67108863, E = (x >> 26) - (S / 67108864 | 0), this.words[b + f] = x & 67108863; - } - for (; b < this.length - f; b++) - x = (this.words[b + f] | 0) + E, E = x >> 26, this.words[b + f] = x & 67108863; - if (E === 0) return this.strip(); - for (n(E === -1), E = 0, b = 0; b < this.length; b++) - x = -(this.words[b] | 0) + E, E = x >> 26, this.words[b] = x & 67108863; - return this.negative = 1, this.strip(); - }, s.prototype._wordDiv = function(A, m) { - var f = this.length - A.length, g = this.clone(), b = A, x = b.words[b.length - 1] | 0, E = this._countBits(x); - f = 26 - E, f !== 0 && (b = b.ushln(f), g.iushln(f), x = b.words[b.length - 1] | 0); - var S = g.length - b.length, v; - if (m !== "mod") { - v = new s(null), v.length = S + 1, v.words = new Array(v.length); - for (var M = 0; M < v.length; M++) - v.words[M] = 0; - } - var I = g.clone()._ishlnsubmul(b, 1, S); - I.negative === 0 && (g = I, v && (v.words[S] = 1)); - for (var F = S - 1; F >= 0; F--) { - var ce = (g.words[b.length + F] | 0) * 67108864 + (g.words[b.length + F - 1] | 0); - for (ce = Math.min(ce / x | 0, 67108863), g._ishlnsubmul(b, ce, F); g.negative !== 0; ) - ce--, g.negative = 0, g._ishlnsubmul(b, 1, F), g.isZero() || (g.negative ^= 1); - v && (v.words[F] = ce); - } - return v && v.strip(), g.strip(), m !== "div" && f !== 0 && g.iushrn(f), { - div: v || null, - mod: g - }; - }, s.prototype.divmod = function(A, m, f) { - if (n(!A.isZero()), this.isZero()) - return { - div: new s(0), - mod: new s(0) - }; - var g, b, x; - return this.negative !== 0 && A.negative === 0 ? (x = this.neg().divmod(A, m), m !== "mod" && (g = x.div.neg()), m !== "div" && (b = x.mod.neg(), f && b.negative !== 0 && b.iadd(A)), { - div: g, - mod: b - }) : this.negative === 0 && A.negative !== 0 ? (x = this.divmod(A.neg(), m), m !== "mod" && (g = x.div.neg()), { - div: g, - mod: x.mod - }) : this.negative & A.negative ? (x = this.neg().divmod(A.neg(), m), m !== "div" && (b = x.mod.neg(), f && b.negative !== 0 && b.isub(A)), { - div: x.div, - mod: b - }) : A.length > this.length || this.cmp(A) < 0 ? { - div: new s(0), - mod: this - } : A.length === 1 ? m === "div" ? { - div: this.divn(A.words[0]), - mod: null - } : m === "mod" ? { - div: null, - mod: new s(this.modn(A.words[0])) - } : { - div: this.divn(A.words[0]), - mod: new s(this.modn(A.words[0])) - } : this._wordDiv(A, m); - }, s.prototype.div = function(A) { - return this.divmod(A, "div", !1).div; - }, s.prototype.mod = function(A) { - return this.divmod(A, "mod", !1).mod; - }, s.prototype.umod = function(A) { - return this.divmod(A, "mod", !0).mod; - }, s.prototype.divRound = function(A) { - var m = this.divmod(A); - if (m.mod.isZero()) return m.div; - var f = m.div.negative !== 0 ? m.mod.isub(A) : m.mod, g = A.ushrn(1), b = A.andln(1), x = f.cmp(g); - return x < 0 || b === 1 && x === 0 ? m.div : m.div.negative !== 0 ? m.div.isubn(1) : m.div.iaddn(1); - }, s.prototype.modn = function(A) { - n(A <= 67108863); - for (var m = (1 << 26) % A, f = 0, g = this.length - 1; g >= 0; g--) - f = (m * f + (this.words[g] | 0)) % A; - return f; - }, s.prototype.idivn = function(A) { - n(A <= 67108863); - for (var m = 0, f = this.length - 1; f >= 0; f--) { - var g = (this.words[f] | 0) + m * 67108864; - this.words[f] = g / A | 0, m = g % A; - } - return this.strip(); - }, s.prototype.divn = function(A) { - return this.clone().idivn(A); - }, s.prototype.egcd = function(A) { - n(A.negative === 0), n(!A.isZero()); - var m = this, f = A.clone(); - m.negative !== 0 ? m = m.umod(A) : m = m.clone(); - for (var g = new s(1), b = new s(0), x = new s(0), E = new s(1), S = 0; m.isEven() && f.isEven(); ) - m.iushrn(1), f.iushrn(1), ++S; - for (var v = f.clone(), M = m.clone(); !m.isZero(); ) { - for (var I = 0, F = 1; !(m.words[0] & F) && I < 26; ++I, F <<= 1) ; - if (I > 0) - for (m.iushrn(I); I-- > 0; ) - (g.isOdd() || b.isOdd()) && (g.iadd(v), b.isub(M)), g.iushrn(1), b.iushrn(1); - for (var ce = 0, D = 1; !(f.words[0] & D) && ce < 26; ++ce, D <<= 1) ; - if (ce > 0) - for (f.iushrn(ce); ce-- > 0; ) - (x.isOdd() || E.isOdd()) && (x.iadd(v), E.isub(M)), x.iushrn(1), E.iushrn(1); - m.cmp(f) >= 0 ? (m.isub(f), g.isub(x), b.isub(E)) : (f.isub(m), x.isub(g), E.isub(b)); - } - return { - a: x, - b: E, - gcd: f.iushln(S) - }; - }, s.prototype._invmp = function(A) { - n(A.negative === 0), n(!A.isZero()); - var m = this, f = A.clone(); - m.negative !== 0 ? m = m.umod(A) : m = m.clone(); - for (var g = new s(1), b = new s(0), x = f.clone(); m.cmpn(1) > 0 && f.cmpn(1) > 0; ) { - for (var E = 0, S = 1; !(m.words[0] & S) && E < 26; ++E, S <<= 1) ; - if (E > 0) - for (m.iushrn(E); E-- > 0; ) - g.isOdd() && g.iadd(x), g.iushrn(1); - for (var v = 0, M = 1; !(f.words[0] & M) && v < 26; ++v, M <<= 1) ; - if (v > 0) - for (f.iushrn(v); v-- > 0; ) - b.isOdd() && b.iadd(x), b.iushrn(1); - m.cmp(f) >= 0 ? (m.isub(f), g.isub(b)) : (f.isub(m), b.isub(g)); - } - var I; - return m.cmpn(1) === 0 ? I = g : I = b, I.cmpn(0) < 0 && I.iadd(A), I; - }, s.prototype.gcd = function(A) { - if (this.isZero()) return A.abs(); - if (A.isZero()) return this.abs(); - var m = this.clone(), f = A.clone(); - m.negative = 0, f.negative = 0; - for (var g = 0; m.isEven() && f.isEven(); g++) - m.iushrn(1), f.iushrn(1); - do { - for (; m.isEven(); ) - m.iushrn(1); - for (; f.isEven(); ) - f.iushrn(1); - var b = m.cmp(f); - if (b < 0) { - var x = m; - m = f, f = x; - } else if (b === 0 || f.cmpn(1) === 0) - break; - m.isub(f); - } while (!0); - return f.iushln(g); - }, s.prototype.invm = function(A) { - return this.egcd(A).a.umod(A); - }, s.prototype.isEven = function() { - return (this.words[0] & 1) === 0; - }, s.prototype.isOdd = function() { - return (this.words[0] & 1) === 1; - }, s.prototype.andln = function(A) { - return this.words[0] & A; - }, s.prototype.bincn = function(A) { - n(typeof A == "number"); - var m = A % 26, f = (A - m) / 26, g = 1 << m; - if (this.length <= f) - return this._expand(f + 1), this.words[f] |= g, this; - for (var b = g, x = f; b !== 0 && x < this.length; x++) { - var E = this.words[x] | 0; - E += b, b = E >>> 26, E &= 67108863, this.words[x] = E; - } - return b !== 0 && (this.words[x] = b, this.length++), this; - }, s.prototype.isZero = function() { - return this.length === 1 && this.words[0] === 0; - }, s.prototype.cmpn = function(A) { - var m = A < 0; - if (this.negative !== 0 && !m) return -1; - if (this.negative === 0 && m) return 1; - this.strip(); - var f; - if (this.length > 1) - f = 1; - else { - m && (A = -A), n(A <= 67108863, "Number is too big"); - var g = this.words[0] | 0; - f = g === A ? 0 : g < A ? -1 : 1; - } - return this.negative !== 0 ? -f | 0 : f; - }, s.prototype.cmp = function(A) { - if (this.negative !== 0 && A.negative === 0) return -1; - if (this.negative === 0 && A.negative !== 0) return 1; - var m = this.ucmp(A); - return this.negative !== 0 ? -m | 0 : m; - }, s.prototype.ucmp = function(A) { - if (this.length > A.length) return 1; - if (this.length < A.length) return -1; - for (var m = 0, f = this.length - 1; f >= 0; f--) { - var g = this.words[f] | 0, b = A.words[f] | 0; - if (g !== b) { - g < b ? m = -1 : g > b && (m = 1); - break; - } - } - return m; - }, s.prototype.gtn = function(A) { - return this.cmpn(A) === 1; - }, s.prototype.gt = function(A) { - return this.cmp(A) === 1; - }, s.prototype.gten = function(A) { - return this.cmpn(A) >= 0; - }, s.prototype.gte = function(A) { - return this.cmp(A) >= 0; - }, s.prototype.ltn = function(A) { - return this.cmpn(A) === -1; - }, s.prototype.lt = function(A) { - return this.cmp(A) === -1; - }, s.prototype.lten = function(A) { - return this.cmpn(A) <= 0; - }, s.prototype.lte = function(A) { - return this.cmp(A) <= 0; - }, s.prototype.eqn = function(A) { - return this.cmpn(A) === 0; - }, s.prototype.eq = function(A) { - return this.cmp(A) === 0; - }, s.red = function(A) { - return new ge(A); - }, s.prototype.toRed = function(A) { - return n(!this.red, "Already a number in reduction context"), n(this.negative === 0, "red works only with positives"), A.convertTo(this)._forceRed(A); - }, s.prototype.fromRed = function() { - return n(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom(this); - }, s.prototype._forceRed = function(A) { - return this.red = A, this; - }, s.prototype.forceRed = function(A) { - return n(!this.red, "Already a number in reduction context"), this._forceRed(A); - }, s.prototype.redAdd = function(A) { - return n(this.red, "redAdd works only with red numbers"), this.red.add(this, A); - }, s.prototype.redIAdd = function(A) { - return n(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, A); - }, s.prototype.redSub = function(A) { - return n(this.red, "redSub works only with red numbers"), this.red.sub(this, A); - }, s.prototype.redISub = function(A) { - return n(this.red, "redISub works only with red numbers"), this.red.isub(this, A); - }, s.prototype.redShl = function(A) { - return n(this.red, "redShl works only with red numbers"), this.red.shl(this, A); - }, s.prototype.redMul = function(A) { - return n(this.red, "redMul works only with red numbers"), this.red._verify2(this, A), this.red.mul(this, A); - }, s.prototype.redIMul = function(A) { - return n(this.red, "redMul works only with red numbers"), this.red._verify2(this, A), this.red.imul(this, A); - }, s.prototype.redSqr = function() { - return n(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr(this); - }, s.prototype.redISqr = function() { - return n(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr(this); - }, s.prototype.redSqrt = function() { - return n(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt(this); - }, s.prototype.redInvm = function() { - return n(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm(this); - }, s.prototype.redNeg = function() { - return n(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg(this); - }, s.prototype.redPow = function(A) { - return n(this.red && !A.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, A); - }; - var W = { - k256: null, - p224: null, - p192: null, - p25519: null - }; - function U(Y, A) { - this.name = Y, this.p = new s(A, 16), this.n = this.p.bitLength(), this.k = new s(1).iushln(this.n).isub(this.p), this.tmp = this._tmp(); - } - U.prototype._tmp = function() { - var A = new s(null); - return A.words = new Array(Math.ceil(this.n / 13)), A; - }, U.prototype.ireduce = function(A) { - var m = A, f; - do - this.split(m, this.tmp), m = this.imulK(m), m = m.iadd(this.tmp), f = m.bitLength(); - while (f > this.n); - var g = f < this.n ? -1 : m.ucmp(this.p); - return g === 0 ? (m.words[0] = 0, m.length = 1) : g > 0 ? m.isub(this.p) : m.strip !== void 0 ? m.strip() : m._strip(), m; - }, U.prototype.split = function(A, m) { - A.iushrn(this.n, 0, m); - }, U.prototype.imulK = function(A) { - return A.imul(this.k); - }; - function V() { - U.call( - this, - "k256", - "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f" - ); - } - i(V, U), V.prototype.split = function(A, m) { - for (var f = 4194303, g = Math.min(A.length, 9), b = 0; b < g; b++) - m.words[b] = A.words[b]; - if (m.length = g, A.length <= 9) { - A.words[0] = 0, A.length = 1; - return; - } - var x = A.words[9]; - for (m.words[m.length++] = x & f, b = 10; b < A.length; b++) { - var E = A.words[b] | 0; - A.words[b - 10] = (E & f) << 4 | x >>> 22, x = E; - } - x >>>= 22, A.words[b - 10] = x, x === 0 && A.length > 10 ? A.length -= 10 : A.length -= 9; - }, V.prototype.imulK = function(A) { - A.words[A.length] = 0, A.words[A.length + 1] = 0, A.length += 2; - for (var m = 0, f = 0; f < A.length; f++) { - var g = A.words[f] | 0; - m += g * 977, A.words[f] = m & 67108863, m = g * 64 + (m / 67108864 | 0); - } - return A.words[A.length - 1] === 0 && (A.length--, A.words[A.length - 1] === 0 && A.length--), A; - }; - function Q() { - U.call( - this, - "p224", - "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001" - ); - } - i(Q, U); - function R() { - U.call( - this, - "p192", - "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff" - ); - } - i(R, U); - function K() { - U.call( - this, - "25519", - "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed" - ); - } - i(K, U), K.prototype.imulK = function(A) { - for (var m = 0, f = 0; f < A.length; f++) { - var g = (A.words[f] | 0) * 19 + m, b = g & 67108863; - g >>>= 26, A.words[f] = b, m = g; - } - return m !== 0 && (A.words[A.length++] = m), A; - }, s._prime = function(A) { - if (W[A]) return W[A]; - var m; - if (A === "k256") - m = new V(); - else if (A === "p224") - m = new Q(); - else if (A === "p192") - m = new R(); - else if (A === "p25519") - m = new K(); - else - throw new Error("Unknown prime " + A); - return W[A] = m, m; - }; - function ge(Y) { - if (typeof Y == "string") { - var A = s._prime(Y); - this.m = A.p, this.prime = A; - } else - n(Y.gtn(1), "modulus must be greater than 1"), this.m = Y, this.prime = null; - } - ge.prototype._verify1 = function(A) { - n(A.negative === 0, "red works only with positives"), n(A.red, "red works only with red numbers"); - }, ge.prototype._verify2 = function(A, m) { - n((A.negative | m.negative) === 0, "red works only with positives"), n( - A.red && A.red === m.red, - "red works only with red numbers" - ); - }, ge.prototype.imod = function(A) { - return this.prime ? this.prime.ireduce(A)._forceRed(this) : A.umod(this.m)._forceRed(this); - }, ge.prototype.neg = function(A) { - return A.isZero() ? A.clone() : this.m.sub(A)._forceRed(this); - }, ge.prototype.add = function(A, m) { - this._verify2(A, m); - var f = A.add(m); - return f.cmp(this.m) >= 0 && f.isub(this.m), f._forceRed(this); - }, ge.prototype.iadd = function(A, m) { - this._verify2(A, m); - var f = A.iadd(m); - return f.cmp(this.m) >= 0 && f.isub(this.m), f; - }, ge.prototype.sub = function(A, m) { - this._verify2(A, m); - var f = A.sub(m); - return f.cmpn(0) < 0 && f.iadd(this.m), f._forceRed(this); - }, ge.prototype.isub = function(A, m) { - this._verify2(A, m); - var f = A.isub(m); - return f.cmpn(0) < 0 && f.iadd(this.m), f; - }, ge.prototype.shl = function(A, m) { - return this._verify1(A), this.imod(A.ushln(m)); - }, ge.prototype.imul = function(A, m) { - return this._verify2(A, m), this.imod(A.imul(m)); - }, ge.prototype.mul = function(A, m) { - return this._verify2(A, m), this.imod(A.mul(m)); - }, ge.prototype.isqr = function(A) { - return this.imul(A, A.clone()); - }, ge.prototype.sqr = function(A) { - return this.mul(A, A); - }, ge.prototype.sqrt = function(A) { - if (A.isZero()) return A.clone(); - var m = this.m.andln(3); - if (n(m % 2 === 1), m === 3) { - var f = this.m.add(new s(1)).iushrn(2); - return this.pow(A, f); - } - for (var g = this.m.subn(1), b = 0; !g.isZero() && g.andln(1) === 0; ) - b++, g.iushrn(1); - n(!g.isZero()); - var x = new s(1).toRed(this), E = x.redNeg(), S = this.m.subn(1).iushrn(1), v = this.m.bitLength(); - for (v = new s(2 * v * v).toRed(this); this.pow(v, S).cmp(E) !== 0; ) - v.redIAdd(E); - for (var M = this.pow(v, g), I = this.pow(A, g.addn(1).iushrn(1)), F = this.pow(A, g), ce = b; F.cmp(x) !== 0; ) { - for (var D = F, oe = 0; D.cmp(x) !== 0; oe++) - D = D.redSqr(); - n(oe < ce); - var Z = this.pow(M, new s(1).iushln(ce - oe - 1)); - I = I.redMul(Z), M = Z.redSqr(), F = F.redMul(M), ce = oe; - } - return I; - }, ge.prototype.invm = function(A) { - var m = A._invmp(this.m); - return m.negative !== 0 ? (m.negative = 0, this.imod(m).redNeg()) : this.imod(m); - }, ge.prototype.pow = function(A, m) { - if (m.isZero()) return new s(1).toRed(this); - if (m.cmpn(1) === 0) return A.clone(); - var f = 4, g = new Array(1 << f); - g[0] = new s(1).toRed(this), g[1] = A; - for (var b = 2; b < g.length; b++) - g[b] = this.mul(g[b - 1], A); - var x = g[0], E = 0, S = 0, v = m.bitLength() % 26; - for (v === 0 && (v = 26), b = m.length - 1; b >= 0; b--) { - for (var M = m.words[b], I = v - 1; I >= 0; I--) { - var F = M >> I & 1; - if (x !== g[0] && (x = this.sqr(x)), F === 0 && E === 0) { - S = 0; - continue; - } - E <<= 1, E |= F, S++, !(S !== f && (b !== 0 || I !== 0)) && (x = this.mul(x, g[E]), S = 0, E = 0); - } - v = 26; - } - return x; - }, ge.prototype.convertTo = function(A) { - var m = A.umod(this.m); - return m === A ? m.clone() : m; - }, ge.prototype.convertFrom = function(A) { - var m = A.clone(); - return m.red = null, m; - }, s.mont = function(A) { - return new Ee(A); - }; - function Ee(Y) { - ge.call(this, Y), this.shift = this.m.bitLength(), this.shift % 26 !== 0 && (this.shift += 26 - this.shift % 26), this.r = new s(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this.rinv = this.r._invmp(this.m), this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv = this.minv.umod(this.r), this.minv = this.r.sub(this.minv); - } - i(Ee, ge), Ee.prototype.convertTo = function(A) { - return this.imod(A.ushln(this.shift)); - }, Ee.prototype.convertFrom = function(A) { - var m = this.imod(A.mul(this.rinv)); - return m.red = null, m; - }, Ee.prototype.imul = function(A, m) { - if (A.isZero() || m.isZero()) - return A.words[0] = 0, A.length = 1, A; - var f = A.imul(m), g = f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), b = f.isub(g).iushrn(this.shift), x = b; - return b.cmp(this.m) >= 0 ? x = b.isub(this.m) : b.cmpn(0) < 0 && (x = b.iadd(this.m)), x._forceRed(this); - }, Ee.prototype.mul = function(A, m) { - if (A.isZero() || m.isZero()) return new s(0)._forceRed(this); - var f = A.mul(m), g = f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), b = f.isub(g).iushrn(this.shift), x = b; - return b.cmp(this.m) >= 0 ? x = b.isub(this.m) : b.cmpn(0) < 0 && (x = b.iadd(this.m)), x._forceRed(this); - }, Ee.prototype.invm = function(A) { - var m = this.imod(A._invmp(this.m).mul(this.r2)); - return m._forceRed(this); - }; - })(t, gn); -})(hb); -var Ho = hb.exports, db = {}; -(function(t) { - var e = t; - function r(s, o) { - if (Array.isArray(s)) - return s.slice(); - if (!s) - return []; - var a = []; - if (typeof s != "string") { - for (var u = 0; u < s.length; u++) - a[u] = s[u] | 0; - return a; - } - if (o === "hex") { - s = s.replace(/[^a-z0-9]+/ig, ""), s.length % 2 !== 0 && (s = "0" + s); - for (var u = 0; u < s.length; u += 2) - a.push(parseInt(s[u] + s[u + 1], 16)); - } else - for (var u = 0; u < s.length; u++) { - var l = s.charCodeAt(u), d = l >> 8, p = l & 255; - d ? a.push(d, p) : a.push(p); - } - return a; - } - e.toArray = r; - function n(s) { - return s.length === 1 ? "0" + s : s; - } - e.zero2 = n; - function i(s) { - for (var o = "", a = 0; a < s.length; a++) - o += n(s[a].toString(16)); - return o; - } - e.toHex = i, e.encode = function(o, a) { - return a === "hex" ? i(o) : o; - }; -})(db); -(function(t) { - var e = t, r = Ho, n = Tc, i = db; - e.assert = n, e.toArray = i.toArray, e.zero2 = i.zero2, e.toHex = i.toHex, e.encode = i.encode; - function s(d, p, w) { - var _ = new Array(Math.max(d.bitLength(), w) + 1), P; - for (P = 0; P < _.length; P += 1) - _[P] = 0; - var O = 1 << p + 1, L = d.clone(); - for (P = 0; P < _.length; P++) { - var B, k = L.andln(O - 1); - L.isOdd() ? (k > (O >> 1) - 1 ? B = (O >> 1) - k : B = k, L.isubn(B)) : B = 0, _[P] = B, L.iushrn(1); - } - return _; - } - e.getNAF = s; - function o(d, p) { - var w = [ - [], - [] - ]; - d = d.clone(), p = p.clone(); - for (var _ = 0, P = 0, O; d.cmpn(-_) > 0 || p.cmpn(-P) > 0; ) { - var L = d.andln(3) + _ & 3, B = p.andln(3) + P & 3; - L === 3 && (L = -1), B === 3 && (B = -1); - var k; - L & 1 ? (O = d.andln(7) + _ & 7, (O === 3 || O === 5) && B === 2 ? k = -L : k = L) : k = 0, w[0].push(k); - var W; - B & 1 ? (O = p.andln(7) + P & 7, (O === 3 || O === 5) && L === 2 ? W = -B : W = B) : W = 0, w[1].push(W), 2 * _ === k + 1 && (_ = 1 - _), 2 * P === W + 1 && (P = 1 - P), d.iushrn(1), p.iushrn(1); - } - return w; - } - e.getJSF = o; - function a(d, p, w) { - var _ = "_" + p; - d.prototype[p] = function() { - return this[_] !== void 0 ? this[_] : this[_] = w.call(this); - }; - } - e.cachedProperty = a; - function u(d) { - return typeof d == "string" ? e.toArray(d, "hex") : d; - } - e.parseBytes = u; - function l(d) { - return new r(d, "hex", "le"); - } - e.intFromLE = l; -})(ji); -var pb = { exports: {} }, xm; -pb.exports = function(e) { - return xm || (xm = new da(null)), xm.generate(e); -}; -function da(t) { - this.rand = t; -} -pb.exports.Rand = da; -da.prototype.generate = function(e) { - return this._rand(e); -}; -da.prototype._rand = function(e) { - if (this.rand.getBytes) - return this.rand.getBytes(e); - for (var r = new Uint8Array(e), n = 0; n < r.length; n++) - r[n] = this.rand.getByte(); - return r; -}; -if (typeof self == "object") - self.crypto && self.crypto.getRandomValues ? da.prototype._rand = function(e) { - var r = new Uint8Array(e); - return self.crypto.getRandomValues(r), r; - } : self.msCrypto && self.msCrypto.getRandomValues ? da.prototype._rand = function(e) { - var r = new Uint8Array(e); - return self.msCrypto.getRandomValues(r), r; - } : typeof window == "object" && (da.prototype._rand = function() { - throw new Error("Not implemented yet"); - }); -else - try { - var Kx = Ql; - if (typeof Kx.randomBytes != "function") - throw new Error("Not supported"); - da.prototype._rand = function(e) { - return Kx.randomBytes(e); - }; - } catch { - } -var X8 = pb.exports, gb = {}, Ja = Ho, sh = ji, v0 = sh.getNAF, Bq = sh.getJSF, b0 = sh.assert; -function La(t, e) { - this.type = t, this.p = new Ja(e.p, 16), this.red = e.prime ? Ja.red(e.prime) : Ja.mont(this.p), this.zero = new Ja(0).toRed(this.red), this.one = new Ja(1).toRed(this.red), this.two = new Ja(2).toRed(this.red), this.n = e.n && new Ja(e.n, 16), this.g = e.g && this.pointFromJSON(e.g, e.gRed), this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this._bitLength = this.n ? this.n.bitLength() : 0; - var r = this.n && this.p.div(this.n); - !r || r.cmpn(100) > 0 ? this.redN = null : (this._maxwellTrick = !0, this.redN = this.n.toRed(this.red)); -} -var cp = La; -La.prototype.point = function() { - throw new Error("Not implemented"); -}; -La.prototype.validate = function() { - throw new Error("Not implemented"); -}; -La.prototype._fixedNafMul = function(e, r) { - b0(e.precomputed); - var n = e._getDoubles(), i = v0(r, 1, this._bitLength), s = (1 << n.step + 1) - (n.step % 2 === 0 ? 2 : 1); - s /= 3; - var o = [], a, u; - for (a = 0; a < i.length; a += n.step) { - u = 0; - for (var l = a + n.step - 1; l >= a; l--) - u = (u << 1) + i[l]; - o.push(u); - } - for (var d = this.jpoint(null, null, null), p = this.jpoint(null, null, null), w = s; w > 0; w--) { - for (a = 0; a < o.length; a++) - u = o[a], u === w ? p = p.mixedAdd(n.points[a]) : u === -w && (p = p.mixedAdd(n.points[a].neg())); - d = d.add(p); - } - return d.toP(); -}; -La.prototype._wnafMul = function(e, r) { - var n = 4, i = e._getNAFPoints(n); - n = i.wnd; - for (var s = i.points, o = v0(r, n, this._bitLength), a = this.jpoint(null, null, null), u = o.length - 1; u >= 0; u--) { - for (var l = 0; u >= 0 && o[u] === 0; u--) - l++; - if (u >= 0 && l++, a = a.dblp(l), u < 0) - break; - var d = o[u]; - b0(d !== 0), e.type === "affine" ? d > 0 ? a = a.mixedAdd(s[d - 1 >> 1]) : a = a.mixedAdd(s[-d - 1 >> 1].neg()) : d > 0 ? a = a.add(s[d - 1 >> 1]) : a = a.add(s[-d - 1 >> 1].neg()); - } - return e.type === "affine" ? a.toP() : a; -}; -La.prototype._wnafMulAdd = function(e, r, n, i, s) { - var o = this._wnafT1, a = this._wnafT2, u = this._wnafT3, l = 0, d, p, w; - for (d = 0; d < i; d++) { - w = r[d]; - var _ = w._getNAFPoints(e); - o[d] = _.wnd, a[d] = _.points; - } - for (d = i - 1; d >= 1; d -= 2) { - var P = d - 1, O = d; - if (o[P] !== 1 || o[O] !== 1) { - u[P] = v0(n[P], o[P], this._bitLength), u[O] = v0(n[O], o[O], this._bitLength), l = Math.max(u[P].length, l), l = Math.max(u[O].length, l); - continue; - } - var L = [ - r[P], - /* 1 */ - null, - /* 3 */ - null, - /* 5 */ - r[O] - /* 7 */ - ]; - r[P].y.cmp(r[O].y) === 0 ? (L[1] = r[P].add(r[O]), L[2] = r[P].toJ().mixedAdd(r[O].neg())) : r[P].y.cmp(r[O].y.redNeg()) === 0 ? (L[1] = r[P].toJ().mixedAdd(r[O]), L[2] = r[P].add(r[O].neg())) : (L[1] = r[P].toJ().mixedAdd(r[O]), L[2] = r[P].toJ().mixedAdd(r[O].neg())); - var B = [ - -3, - /* -1 -1 */ - -1, - /* -1 0 */ - -5, - /* -1 1 */ - -7, - /* 0 -1 */ - 0, - /* 0 0 */ - 7, - /* 0 1 */ - 5, - /* 1 -1 */ - 1, - /* 1 0 */ - 3 - /* 1 1 */ - ], k = Bq(n[P], n[O]); - for (l = Math.max(k[0].length, l), u[P] = new Array(l), u[O] = new Array(l), p = 0; p < l; p++) { - var W = k[0][p] | 0, U = k[1][p] | 0; - u[P][p] = B[(W + 1) * 3 + (U + 1)], u[O][p] = 0, a[P] = L; - } - } - var V = this.jpoint(null, null, null), Q = this._wnafT4; - for (d = l; d >= 0; d--) { - for (var R = 0; d >= 0; ) { - var K = !0; - for (p = 0; p < i; p++) - Q[p] = u[p][d] | 0, Q[p] !== 0 && (K = !1); - if (!K) - break; - R++, d--; - } - if (d >= 0 && R++, V = V.dblp(R), d < 0) - break; - for (p = 0; p < i; p++) { - var ge = Q[p]; - ge !== 0 && (ge > 0 ? w = a[p][ge - 1 >> 1] : ge < 0 && (w = a[p][-ge - 1 >> 1].neg()), w.type === "affine" ? V = V.mixedAdd(w) : V = V.add(w)); - } - } - for (d = 0; d < i; d++) - a[d] = null; - return s ? V : V.toP(); -}; -function as(t, e) { - this.curve = t, this.type = e, this.precomputed = null; -} -La.BasePoint = as; -as.prototype.eq = function() { - throw new Error("Not implemented"); -}; -as.prototype.validate = function() { - return this.curve.validate(this); -}; -La.prototype.decodePoint = function(e, r) { - e = sh.toArray(e, r); - var n = this.p.byteLength(); - if ((e[0] === 4 || e[0] === 6 || e[0] === 7) && e.length - 1 === 2 * n) { - e[0] === 6 ? b0(e[e.length - 1] % 2 === 0) : e[0] === 7 && b0(e[e.length - 1] % 2 === 1); - var i = this.point( - e.slice(1, 1 + n), - e.slice(1 + n, 1 + 2 * n) - ); - return i; - } else if ((e[0] === 2 || e[0] === 3) && e.length - 1 === n) - return this.pointFromX(e.slice(1, 1 + n), e[0] === 3); - throw new Error("Unknown point format"); -}; -as.prototype.encodeCompressed = function(e) { - return this.encode(e, !0); -}; -as.prototype._encode = function(e) { - var r = this.curve.p.byteLength(), n = this.getX().toArray("be", r); - return e ? [this.getY().isEven() ? 2 : 3].concat(n) : [4].concat(n, this.getY().toArray("be", r)); -}; -as.prototype.encode = function(e, r) { - return sh.encode(this._encode(r), e); -}; -as.prototype.precompute = function(e) { - if (this.precomputed) - return this; - var r = { - doubles: null, - naf: null, - beta: null - }; - return r.naf = this._getNAFPoints(8), r.doubles = this._getDoubles(4, e), r.beta = this._getBeta(), this.precomputed = r, this; -}; -as.prototype._hasDoubles = function(e) { - if (!this.precomputed) - return !1; - var r = this.precomputed.doubles; - return r ? r.points.length >= Math.ceil((e.bitLength() + 1) / r.step) : !1; -}; -as.prototype._getDoubles = function(e, r) { - if (this.precomputed && this.precomputed.doubles) - return this.precomputed.doubles; - for (var n = [this], i = this, s = 0; s < r; s += e) { - for (var o = 0; o < e; o++) - i = i.dbl(); - n.push(i); - } - return { - step: e, - points: n - }; -}; -as.prototype._getNAFPoints = function(e) { - if (this.precomputed && this.precomputed.naf) - return this.precomputed.naf; - for (var r = [this], n = (1 << e) - 1, i = n === 1 ? null : this.dbl(), s = 1; s < n; s++) - r[s] = r[s - 1].add(i); - return { - wnd: e, - points: r - }; -}; -as.prototype._getBeta = function() { - return null; -}; -as.prototype.dblp = function(e) { - for (var r = this, n = 0; n < e; n++) - r = r.dbl(); - return r; -}; -var Fq = ji, rn = Ho, mb = np, Vu = cp, jq = Fq.assert; -function cs(t) { - Vu.call(this, "short", t), this.a = new rn(t.a, 16).toRed(this.red), this.b = new rn(t.b, 16).toRed(this.red), this.tinv = this.two.redInvm(), this.zeroA = this.a.fromRed().cmpn(0) === 0, this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0, this.endo = this._getEndomorphism(t), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4); -} -mb(cs, Vu); -var Uq = cs; -cs.prototype._getEndomorphism = function(e) { - if (!(!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)) { - var r, n; - if (e.beta) - r = new rn(e.beta, 16).toRed(this.red); - else { - var i = this._getEndoRoots(this.p); - r = i[0].cmp(i[1]) < 0 ? i[0] : i[1], r = r.toRed(this.red); - } - if (e.lambda) - n = new rn(e.lambda, 16); - else { - var s = this._getEndoRoots(this.n); - this.g.mul(s[0]).x.cmp(this.g.x.redMul(r)) === 0 ? n = s[0] : (n = s[1], jq(this.g.mul(n).x.cmp(this.g.x.redMul(r)) === 0)); - } - var o; - return e.basis ? o = e.basis.map(function(a) { - return { - a: new rn(a.a, 16), - b: new rn(a.b, 16) - }; - }) : o = this._getEndoBasis(n), { - beta: r, - lambda: n, - basis: o - }; - } -}; -cs.prototype._getEndoRoots = function(e) { - var r = e === this.p ? this.red : rn.mont(e), n = new rn(2).toRed(r).redInvm(), i = n.redNeg(), s = new rn(3).toRed(r).redNeg().redSqrt().redMul(n), o = i.redAdd(s).fromRed(), a = i.redSub(s).fromRed(); - return [o, a]; -}; -cs.prototype._getEndoBasis = function(e) { - for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new rn(1), o = new rn(0), a = new rn(0), u = new rn(1), l, d, p, w, _, P, O, L = 0, B, k; n.cmpn(0) !== 0; ) { - var W = i.div(n); - B = i.sub(W.mul(n)), k = a.sub(W.mul(s)); - var U = u.sub(W.mul(o)); - if (!p && B.cmp(r) < 0) - l = O.neg(), d = s, p = B.neg(), w = k; - else if (p && ++L === 2) - break; - O = B, i = n, n = B, a = s, s = k, u = o, o = U; - } - _ = B.neg(), P = k; - var V = p.sqr().add(w.sqr()), Q = _.sqr().add(P.sqr()); - return Q.cmp(V) >= 0 && (_ = l, P = d), p.negative && (p = p.neg(), w = w.neg()), _.negative && (_ = _.neg(), P = P.neg()), [ - { a: p, b: w }, - { a: _, b: P } - ]; -}; -cs.prototype._endoSplit = function(e) { - var r = this.endo.basis, n = r[0], i = r[1], s = i.b.mul(e).divRound(this.n), o = n.b.neg().mul(e).divRound(this.n), a = s.mul(n.a), u = o.mul(i.a), l = s.mul(n.b), d = o.mul(i.b), p = e.sub(a).sub(u), w = l.add(d).neg(); - return { k1: p, k2: w }; -}; -cs.prototype.pointFromX = function(e, r) { - e = new rn(e, 16), e.red || (e = e.toRed(this.red)); - var n = e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b), i = n.redSqrt(); - if (i.redSqr().redSub(n).cmp(this.zero) !== 0) - throw new Error("invalid point"); - var s = i.fromRed().isOdd(); - return (r && !s || !r && s) && (i = i.redNeg()), this.point(e, i); -}; -cs.prototype.validate = function(e) { - if (e.inf) - return !0; - var r = e.x, n = e.y, i = this.a.redMul(r), s = r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b); - return n.redSqr().redISub(s).cmpn(0) === 0; -}; -cs.prototype._endoWnafMulAdd = function(e, r, n) { - for (var i = this._endoWnafT1, s = this._endoWnafT2, o = 0; o < e.length; o++) { - var a = this._endoSplit(r[o]), u = e[o], l = u._getBeta(); - a.k1.negative && (a.k1.ineg(), u = u.neg(!0)), a.k2.negative && (a.k2.ineg(), l = l.neg(!0)), i[o * 2] = u, i[o * 2 + 1] = l, s[o * 2] = a.k1, s[o * 2 + 1] = a.k2; - } - for (var d = this._wnafMulAdd(1, i, s, o * 2, n), p = 0; p < o * 2; p++) - i[p] = null, s[p] = null; - return d; -}; -function $n(t, e, r, n) { - Vu.BasePoint.call(this, t, "affine"), e === null && r === null ? (this.x = null, this.y = null, this.inf = !0) : (this.x = new rn(e, 16), this.y = new rn(r, 16), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1); -} -mb($n, Vu.BasePoint); -cs.prototype.point = function(e, r, n) { - return new $n(this, e, r, n); -}; -cs.prototype.pointFromJSON = function(e, r) { - return $n.fromJSON(this, e, r); -}; -$n.prototype._getBeta = function() { - if (this.curve.endo) { - var e = this.precomputed; - if (e && e.beta) - return e.beta; - var r = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y); - if (e) { - var n = this.curve, i = function(s) { - return n.point(s.x.redMul(n.endo.beta), s.y); - }; - e.beta = r, r.precomputed = { - beta: null, - naf: e.naf && { - wnd: e.naf.wnd, - points: e.naf.points.map(i) - }, - doubles: e.doubles && { - step: e.doubles.step, - points: e.doubles.points.map(i) - } - }; - } - return r; - } -}; -$n.prototype.toJSON = function() { - return this.precomputed ? [this.x, this.y, this.precomputed && { - doubles: this.precomputed.doubles && { - step: this.precomputed.doubles.step, - points: this.precomputed.doubles.points.slice(1) - }, - naf: this.precomputed.naf && { - wnd: this.precomputed.naf.wnd, - points: this.precomputed.naf.points.slice(1) - } - }] : [this.x, this.y]; -}; -$n.fromJSON = function(e, r, n) { - typeof r == "string" && (r = JSON.parse(r)); - var i = e.point(r[0], r[1], n); - if (!r[2]) - return i; - function s(a) { - return e.point(a[0], a[1], n); - } - var o = r[2]; - return i.precomputed = { - beta: null, - doubles: o.doubles && { - step: o.doubles.step, - points: [i].concat(o.doubles.points.map(s)) - }, - naf: o.naf && { - wnd: o.naf.wnd, - points: [i].concat(o.naf.points.map(s)) - } - }, i; -}; -$n.prototype.inspect = function() { - return this.isInfinity() ? "" : ""; -}; -$n.prototype.isInfinity = function() { - return this.inf; -}; -$n.prototype.add = function(e) { - if (this.inf) - return e; - if (e.inf) - return this; - if (this.eq(e)) - return this.dbl(); - if (this.neg().eq(e)) - return this.curve.point(null, null); - if (this.x.cmp(e.x) === 0) - return this.curve.point(null, null); - var r = this.y.redSub(e.y); - r.cmpn(0) !== 0 && (r = r.redMul(this.x.redSub(e.x).redInvm())); - var n = r.redSqr().redISub(this.x).redISub(e.x), i = r.redMul(this.x.redSub(n)).redISub(this.y); - return this.curve.point(n, i); -}; -$n.prototype.dbl = function() { - if (this.inf) - return this; - var e = this.y.redAdd(this.y); - if (e.cmpn(0) === 0) - return this.curve.point(null, null); - var r = this.curve.a, n = this.x.redSqr(), i = e.redInvm(), s = n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i), o = s.redSqr().redISub(this.x.redAdd(this.x)), a = s.redMul(this.x.redSub(o)).redISub(this.y); - return this.curve.point(o, a); -}; -$n.prototype.getX = function() { - return this.x.fromRed(); -}; -$n.prototype.getY = function() { - return this.y.fromRed(); -}; -$n.prototype.mul = function(e) { - return e = new rn(e, 16), this.isInfinity() ? this : this._hasDoubles(e) ? this.curve._fixedNafMul(this, e) : this.curve.endo ? this.curve._endoWnafMulAdd([this], [e]) : this.curve._wnafMul(this, e); -}; -$n.prototype.mulAdd = function(e, r, n) { - var i = [this, r], s = [e, n]; - return this.curve.endo ? this.curve._endoWnafMulAdd(i, s) : this.curve._wnafMulAdd(1, i, s, 2); -}; -$n.prototype.jmulAdd = function(e, r, n) { - var i = [this, r], s = [e, n]; - return this.curve.endo ? this.curve._endoWnafMulAdd(i, s, !0) : this.curve._wnafMulAdd(1, i, s, 2, !0); -}; -$n.prototype.eq = function(e) { - return this === e || this.inf === e.inf && (this.inf || this.x.cmp(e.x) === 0 && this.y.cmp(e.y) === 0); -}; -$n.prototype.neg = function(e) { - if (this.inf) - return this; - var r = this.curve.point(this.x, this.y.redNeg()); - if (e && this.precomputed) { - var n = this.precomputed, i = function(s) { - return s.neg(); - }; - r.precomputed = { - naf: n.naf && { - wnd: n.naf.wnd, - points: n.naf.points.map(i) - }, - doubles: n.doubles && { - step: n.doubles.step, - points: n.doubles.points.map(i) - } - }; - } - return r; -}; -$n.prototype.toJ = function() { - if (this.inf) - return this.curve.jpoint(null, null, null); - var e = this.curve.jpoint(this.x, this.y, this.curve.one); - return e; -}; -function Wn(t, e, r, n) { - Vu.BasePoint.call(this, t, "jacobian"), e === null && r === null && n === null ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new rn(0)) : (this.x = new rn(e, 16), this.y = new rn(r, 16), this.z = new rn(n, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one; -} -mb(Wn, Vu.BasePoint); -cs.prototype.jpoint = function(e, r, n) { - return new Wn(this, e, r, n); -}; -Wn.prototype.toP = function() { - if (this.isInfinity()) - return this.curve.point(null, null); - var e = this.z.redInvm(), r = e.redSqr(), n = this.x.redMul(r), i = this.y.redMul(r).redMul(e); - return this.curve.point(n, i); -}; -Wn.prototype.neg = function() { - return this.curve.jpoint(this.x, this.y.redNeg(), this.z); -}; -Wn.prototype.add = function(e) { - if (this.isInfinity()) - return e; - if (e.isInfinity()) - return this; - var r = e.z.redSqr(), n = this.z.redSqr(), i = this.x.redMul(r), s = e.x.redMul(n), o = this.y.redMul(r.redMul(e.z)), a = e.y.redMul(n.redMul(this.z)), u = i.redSub(s), l = o.redSub(a); - if (u.cmpn(0) === 0) - return l.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var d = u.redSqr(), p = d.redMul(u), w = i.redMul(d), _ = l.redSqr().redIAdd(p).redISub(w).redISub(w), P = l.redMul(w.redISub(_)).redISub(o.redMul(p)), O = this.z.redMul(e.z).redMul(u); - return this.curve.jpoint(_, P, O); -}; -Wn.prototype.mixedAdd = function(e) { - if (this.isInfinity()) - return e.toJ(); - if (e.isInfinity()) - return this; - var r = this.z.redSqr(), n = this.x, i = e.x.redMul(r), s = this.y, o = e.y.redMul(r).redMul(this.z), a = n.redSub(i), u = s.redSub(o); - if (a.cmpn(0) === 0) - return u.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var l = a.redSqr(), d = l.redMul(a), p = n.redMul(l), w = u.redSqr().redIAdd(d).redISub(p).redISub(p), _ = u.redMul(p.redISub(w)).redISub(s.redMul(d)), P = this.z.redMul(a); - return this.curve.jpoint(w, _, P); -}; -Wn.prototype.dblp = function(e) { - if (e === 0) - return this; - if (this.isInfinity()) - return this; - if (!e) - return this.dbl(); - var r; - if (this.curve.zeroA || this.curve.threeA) { - var n = this; - for (r = 0; r < e; r++) - n = n.dbl(); - return n; - } - var i = this.curve.a, s = this.curve.tinv, o = this.x, a = this.y, u = this.z, l = u.redSqr().redSqr(), d = a.redAdd(a); - for (r = 0; r < e; r++) { - var p = o.redSqr(), w = d.redSqr(), _ = w.redSqr(), P = p.redAdd(p).redIAdd(p).redIAdd(i.redMul(l)), O = o.redMul(w), L = P.redSqr().redISub(O.redAdd(O)), B = O.redISub(L), k = P.redMul(B); - k = k.redIAdd(k).redISub(_); - var W = d.redMul(u); - r + 1 < e && (l = l.redMul(_)), o = L, u = W, d = k; - } - return this.curve.jpoint(o, d.redMul(s), u); -}; -Wn.prototype.dbl = function() { - return this.isInfinity() ? this : this.curve.zeroA ? this._zeroDbl() : this.curve.threeA ? this._threeDbl() : this._dbl(); -}; -Wn.prototype._zeroDbl = function() { - var e, r, n; - if (this.zOne) { - var i = this.x.redSqr(), s = this.y.redSqr(), o = s.redSqr(), a = this.x.redAdd(s).redSqr().redISub(i).redISub(o); - a = a.redIAdd(a); - var u = i.redAdd(i).redIAdd(i), l = u.redSqr().redISub(a).redISub(a), d = o.redIAdd(o); - d = d.redIAdd(d), d = d.redIAdd(d), e = l, r = u.redMul(a.redISub(l)).redISub(d), n = this.y.redAdd(this.y); - } else { - var p = this.x.redSqr(), w = this.y.redSqr(), _ = w.redSqr(), P = this.x.redAdd(w).redSqr().redISub(p).redISub(_); - P = P.redIAdd(P); - var O = p.redAdd(p).redIAdd(p), L = O.redSqr(), B = _.redIAdd(_); - B = B.redIAdd(B), B = B.redIAdd(B), e = L.redISub(P).redISub(P), r = O.redMul(P.redISub(e)).redISub(B), n = this.y.redMul(this.z), n = n.redIAdd(n); - } - return this.curve.jpoint(e, r, n); -}; -Wn.prototype._threeDbl = function() { - var e, r, n; - if (this.zOne) { - var i = this.x.redSqr(), s = this.y.redSqr(), o = s.redSqr(), a = this.x.redAdd(s).redSqr().redISub(i).redISub(o); - a = a.redIAdd(a); - var u = i.redAdd(i).redIAdd(i).redIAdd(this.curve.a), l = u.redSqr().redISub(a).redISub(a); - e = l; - var d = o.redIAdd(o); - d = d.redIAdd(d), d = d.redIAdd(d), r = u.redMul(a.redISub(l)).redISub(d), n = this.y.redAdd(this.y); - } else { - var p = this.z.redSqr(), w = this.y.redSqr(), _ = this.x.redMul(w), P = this.x.redSub(p).redMul(this.x.redAdd(p)); - P = P.redAdd(P).redIAdd(P); - var O = _.redIAdd(_); - O = O.redIAdd(O); - var L = O.redAdd(O); - e = P.redSqr().redISub(L), n = this.y.redAdd(this.z).redSqr().redISub(w).redISub(p); - var B = w.redSqr(); - B = B.redIAdd(B), B = B.redIAdd(B), B = B.redIAdd(B), r = P.redMul(O.redISub(e)).redISub(B); - } - return this.curve.jpoint(e, r, n); -}; -Wn.prototype._dbl = function() { - var e = this.curve.a, r = this.x, n = this.y, i = this.z, s = i.redSqr().redSqr(), o = r.redSqr(), a = n.redSqr(), u = o.redAdd(o).redIAdd(o).redIAdd(e.redMul(s)), l = r.redAdd(r); - l = l.redIAdd(l); - var d = l.redMul(a), p = u.redSqr().redISub(d.redAdd(d)), w = d.redISub(p), _ = a.redSqr(); - _ = _.redIAdd(_), _ = _.redIAdd(_), _ = _.redIAdd(_); - var P = u.redMul(w).redISub(_), O = n.redAdd(n).redMul(i); - return this.curve.jpoint(p, P, O); -}; -Wn.prototype.trpl = function() { - if (!this.curve.zeroA) - return this.dbl().add(this); - var e = this.x.redSqr(), r = this.y.redSqr(), n = this.z.redSqr(), i = r.redSqr(), s = e.redAdd(e).redIAdd(e), o = s.redSqr(), a = this.x.redAdd(r).redSqr().redISub(e).redISub(i); - a = a.redIAdd(a), a = a.redAdd(a).redIAdd(a), a = a.redISub(o); - var u = a.redSqr(), l = i.redIAdd(i); - l = l.redIAdd(l), l = l.redIAdd(l), l = l.redIAdd(l); - var d = s.redIAdd(a).redSqr().redISub(o).redISub(u).redISub(l), p = r.redMul(d); - p = p.redIAdd(p), p = p.redIAdd(p); - var w = this.x.redMul(u).redISub(p); - w = w.redIAdd(w), w = w.redIAdd(w); - var _ = this.y.redMul(d.redMul(l.redISub(d)).redISub(a.redMul(u))); - _ = _.redIAdd(_), _ = _.redIAdd(_), _ = _.redIAdd(_); - var P = this.z.redAdd(a).redSqr().redISub(n).redISub(u); - return this.curve.jpoint(w, _, P); -}; -Wn.prototype.mul = function(e, r) { - return e = new rn(e, r), this.curve._wnafMul(this, e); -}; -Wn.prototype.eq = function(e) { - if (e.type === "affine") - return this.eq(e.toJ()); - if (this === e) - return !0; - var r = this.z.redSqr(), n = e.z.redSqr(); - if (this.x.redMul(n).redISub(e.x.redMul(r)).cmpn(0) !== 0) - return !1; - var i = r.redMul(this.z), s = n.redMul(e.z); - return this.y.redMul(s).redISub(e.y.redMul(i)).cmpn(0) === 0; -}; -Wn.prototype.eqXToP = function(e) { - var r = this.z.redSqr(), n = e.toRed(this.curve.red).redMul(r); - if (this.x.cmp(n) === 0) - return !0; - for (var i = e.clone(), s = this.curve.redN.redMul(r); ; ) { - if (i.iadd(this.curve.n), i.cmp(this.curve.p) >= 0) - return !1; - if (n.redIAdd(s), this.x.cmp(n) === 0) - return !0; - } -}; -Wn.prototype.inspect = function() { - return this.isInfinity() ? "" : ""; -}; -Wn.prototype.isInfinity = function() { - return this.z.cmpn(0) === 0; -}; -var uu = Ho, Z8 = np, up = cp, qq = ji; -function Gu(t) { - up.call(this, "mont", t), this.a = new uu(t.a, 16).toRed(this.red), this.b = new uu(t.b, 16).toRed(this.red), this.i4 = new uu(4).toRed(this.red).redInvm(), this.two = new uu(2).toRed(this.red), this.a24 = this.i4.redMul(this.a.redAdd(this.two)); -} -Z8(Gu, up); -var zq = Gu; -Gu.prototype.validate = function(e) { - var r = e.normalize().x, n = r.redSqr(), i = n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r), s = i.redSqrt(); - return s.redSqr().cmp(i) === 0; -}; -function Ln(t, e, r) { - up.BasePoint.call(this, t, "projective"), e === null && r === null ? (this.x = this.curve.one, this.z = this.curve.zero) : (this.x = new uu(e, 16), this.z = new uu(r, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red))); -} -Z8(Ln, up.BasePoint); -Gu.prototype.decodePoint = function(e, r) { - return this.point(qq.toArray(e, r), 1); -}; -Gu.prototype.point = function(e, r) { - return new Ln(this, e, r); -}; -Gu.prototype.pointFromJSON = function(e) { - return Ln.fromJSON(this, e); -}; -Ln.prototype.precompute = function() { -}; -Ln.prototype._encode = function() { - return this.getX().toArray("be", this.curve.p.byteLength()); -}; -Ln.fromJSON = function(e, r) { - return new Ln(e, r[0], r[1] || e.one); -}; -Ln.prototype.inspect = function() { - return this.isInfinity() ? "" : ""; -}; -Ln.prototype.isInfinity = function() { - return this.z.cmpn(0) === 0; -}; -Ln.prototype.dbl = function() { - var e = this.x.redAdd(this.z), r = e.redSqr(), n = this.x.redSub(this.z), i = n.redSqr(), s = r.redSub(i), o = r.redMul(i), a = s.redMul(i.redAdd(this.curve.a24.redMul(s))); - return this.curve.point(o, a); -}; -Ln.prototype.add = function() { - throw new Error("Not supported on Montgomery curve"); -}; -Ln.prototype.diffAdd = function(e, r) { - var n = this.x.redAdd(this.z), i = this.x.redSub(this.z), s = e.x.redAdd(e.z), o = e.x.redSub(e.z), a = o.redMul(n), u = s.redMul(i), l = r.z.redMul(a.redAdd(u).redSqr()), d = r.x.redMul(a.redISub(u).redSqr()); - return this.curve.point(l, d); -}; -Ln.prototype.mul = function(e) { - for (var r = e.clone(), n = this, i = this.curve.point(null, null), s = this, o = []; r.cmpn(0) !== 0; r.iushrn(1)) - o.push(r.andln(1)); - for (var a = o.length - 1; a >= 0; a--) - o[a] === 0 ? (n = n.diffAdd(i, s), i = i.dbl()) : (i = n.diffAdd(i, s), n = n.dbl()); - return i; -}; -Ln.prototype.mulAdd = function() { - throw new Error("Not supported on Montgomery curve"); -}; -Ln.prototype.jumlAdd = function() { - throw new Error("Not supported on Montgomery curve"); -}; -Ln.prototype.eq = function(e) { - return this.getX().cmp(e.getX()) === 0; -}; -Ln.prototype.normalize = function() { - return this.x = this.x.redMul(this.z.redInvm()), this.z = this.curve.one, this; -}; -Ln.prototype.getX = function() { - return this.normalize(), this.x.fromRed(); -}; -var Wq = ji, Io = Ho, Q8 = np, fp = cp, Hq = Wq.assert; -function oo(t) { - this.twisted = (t.a | 0) !== 1, this.mOneA = this.twisted && (t.a | 0) === -1, this.extended = this.mOneA, fp.call(this, "edwards", t), this.a = new Io(t.a, 16).umod(this.red.m), this.a = this.a.toRed(this.red), this.c = new Io(t.c, 16).toRed(this.red), this.c2 = this.c.redSqr(), this.d = new Io(t.d, 16).toRed(this.red), this.dd = this.d.redAdd(this.d), Hq(!this.twisted || this.c.fromRed().cmpn(1) === 0), this.oneC = (t.c | 0) === 1; -} -Q8(oo, fp); -var Kq = oo; -oo.prototype._mulA = function(e) { - return this.mOneA ? e.redNeg() : this.a.redMul(e); -}; -oo.prototype._mulC = function(e) { - return this.oneC ? e : this.c.redMul(e); -}; -oo.prototype.jpoint = function(e, r, n, i) { - return this.point(e, r, n, i); -}; -oo.prototype.pointFromX = function(e, r) { - e = new Io(e, 16), e.red || (e = e.toRed(this.red)); - var n = e.redSqr(), i = this.c2.redSub(this.a.redMul(n)), s = this.one.redSub(this.c2.redMul(this.d).redMul(n)), o = i.redMul(s.redInvm()), a = o.redSqrt(); - if (a.redSqr().redSub(o).cmp(this.zero) !== 0) - throw new Error("invalid point"); - var u = a.fromRed().isOdd(); - return (r && !u || !r && u) && (a = a.redNeg()), this.point(e, a); -}; -oo.prototype.pointFromY = function(e, r) { - e = new Io(e, 16), e.red || (e = e.toRed(this.red)); - var n = e.redSqr(), i = n.redSub(this.c2), s = n.redMul(this.d).redMul(this.c2).redSub(this.a), o = i.redMul(s.redInvm()); - if (o.cmp(this.zero) === 0) { - if (r) - throw new Error("invalid point"); - return this.point(this.zero, e); - } - var a = o.redSqrt(); - if (a.redSqr().redSub(o).cmp(this.zero) !== 0) - throw new Error("invalid point"); - return a.fromRed().isOdd() !== r && (a = a.redNeg()), this.point(a, e); -}; -oo.prototype.validate = function(e) { - if (e.isInfinity()) - return !0; - e.normalize(); - var r = e.x.redSqr(), n = e.y.redSqr(), i = r.redMul(this.a).redAdd(n), s = this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n))); - return i.cmp(s) === 0; -}; -function Hr(t, e, r, n, i) { - fp.BasePoint.call(this, t, "projective"), e === null && r === null && n === null ? (this.x = this.curve.zero, this.y = this.curve.one, this.z = this.curve.one, this.t = this.curve.zero, this.zOne = !0) : (this.x = new Io(e, 16), this.y = new Io(r, 16), this.z = n ? new Io(n, 16) : this.curve.one, this.t = i && new Io(i, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.t && !this.t.red && (this.t = this.t.toRed(this.curve.red)), this.zOne = this.z === this.curve.one, this.curve.extended && !this.t && (this.t = this.x.redMul(this.y), this.zOne || (this.t = this.t.redMul(this.z.redInvm())))); -} -Q8(Hr, fp.BasePoint); -oo.prototype.pointFromJSON = function(e) { - return Hr.fromJSON(this, e); -}; -oo.prototype.point = function(e, r, n, i) { - return new Hr(this, e, r, n, i); -}; -Hr.fromJSON = function(e, r) { - return new Hr(e, r[0], r[1], r[2]); -}; -Hr.prototype.inspect = function() { - return this.isInfinity() ? "" : ""; -}; -Hr.prototype.isInfinity = function() { - return this.x.cmpn(0) === 0 && (this.y.cmp(this.z) === 0 || this.zOne && this.y.cmp(this.curve.c) === 0); -}; -Hr.prototype._extDbl = function() { - var e = this.x.redSqr(), r = this.y.redSqr(), n = this.z.redSqr(); - n = n.redIAdd(n); - var i = this.curve._mulA(e), s = this.x.redAdd(this.y).redSqr().redISub(e).redISub(r), o = i.redAdd(r), a = o.redSub(n), u = i.redSub(r), l = s.redMul(a), d = o.redMul(u), p = s.redMul(u), w = a.redMul(o); - return this.curve.point(l, d, w, p); -}; -Hr.prototype._projDbl = function() { - var e = this.x.redAdd(this.y).redSqr(), r = this.x.redSqr(), n = this.y.redSqr(), i, s, o, a, u, l; - if (this.curve.twisted) { - a = this.curve._mulA(r); - var d = a.redAdd(n); - this.zOne ? (i = e.redSub(r).redSub(n).redMul(d.redSub(this.curve.two)), s = d.redMul(a.redSub(n)), o = d.redSqr().redSub(d).redSub(d)) : (u = this.z.redSqr(), l = d.redSub(u).redISub(u), i = e.redSub(r).redISub(n).redMul(l), s = d.redMul(a.redSub(n)), o = d.redMul(l)); - } else - a = r.redAdd(n), u = this.curve._mulC(this.z).redSqr(), l = a.redSub(u).redSub(u), i = this.curve._mulC(e.redISub(a)).redMul(l), s = this.curve._mulC(a).redMul(r.redISub(n)), o = a.redMul(l); - return this.curve.point(i, s, o); -}; -Hr.prototype.dbl = function() { - return this.isInfinity() ? this : this.curve.extended ? this._extDbl() : this._projDbl(); -}; -Hr.prototype._extAdd = function(e) { - var r = this.y.redSub(this.x).redMul(e.y.redSub(e.x)), n = this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)), i = this.t.redMul(this.curve.dd).redMul(e.t), s = this.z.redMul(e.z.redAdd(e.z)), o = n.redSub(r), a = s.redSub(i), u = s.redAdd(i), l = n.redAdd(r), d = o.redMul(a), p = u.redMul(l), w = o.redMul(l), _ = a.redMul(u); - return this.curve.point(d, p, _, w); -}; -Hr.prototype._projAdd = function(e) { - var r = this.z.redMul(e.z), n = r.redSqr(), i = this.x.redMul(e.x), s = this.y.redMul(e.y), o = this.curve.d.redMul(i).redMul(s), a = n.redSub(o), u = n.redAdd(o), l = this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s), d = r.redMul(a).redMul(l), p, w; - return this.curve.twisted ? (p = r.redMul(u).redMul(s.redSub(this.curve._mulA(i))), w = a.redMul(u)) : (p = r.redMul(u).redMul(s.redSub(i)), w = this.curve._mulC(a).redMul(u)), this.curve.point(d, p, w); -}; -Hr.prototype.add = function(e) { - return this.isInfinity() ? e : e.isInfinity() ? this : this.curve.extended ? this._extAdd(e) : this._projAdd(e); -}; -Hr.prototype.mul = function(e) { - return this._hasDoubles(e) ? this.curve._fixedNafMul(this, e) : this.curve._wnafMul(this, e); -}; -Hr.prototype.mulAdd = function(e, r, n) { - return this.curve._wnafMulAdd(1, [this, r], [e, n], 2, !1); -}; -Hr.prototype.jmulAdd = function(e, r, n) { - return this.curve._wnafMulAdd(1, [this, r], [e, n], 2, !0); -}; -Hr.prototype.normalize = function() { - if (this.zOne) - return this; - var e = this.z.redInvm(); - return this.x = this.x.redMul(e), this.y = this.y.redMul(e), this.t && (this.t = this.t.redMul(e)), this.z = this.curve.one, this.zOne = !0, this; -}; -Hr.prototype.neg = function() { - return this.curve.point( - this.x.redNeg(), - this.y, - this.z, - this.t && this.t.redNeg() - ); -}; -Hr.prototype.getX = function() { - return this.normalize(), this.x.fromRed(); -}; -Hr.prototype.getY = function() { - return this.normalize(), this.y.fromRed(); -}; -Hr.prototype.eq = function(e) { - return this === e || this.getX().cmp(e.getX()) === 0 && this.getY().cmp(e.getY()) === 0; -}; -Hr.prototype.eqXToP = function(e) { - var r = e.toRed(this.curve.red).redMul(this.z); - if (this.x.cmp(r) === 0) - return !0; - for (var n = e.clone(), i = this.curve.redN.redMul(this.z); ; ) { - if (n.iadd(this.curve.n), n.cmp(this.curve.p) >= 0) - return !1; - if (r.redIAdd(i), this.x.cmp(r) === 0) - return !0; - } -}; -Hr.prototype.toP = Hr.prototype.normalize; -Hr.prototype.mixedAdd = Hr.prototype.add; -(function(t) { - var e = t; - e.base = cp, e.short = Uq, e.mont = zq, e.edwards = Kq; -})(gb); -var lp = {}, _m, Vx; -function Vq() { - return Vx || (Vx = 1, _m = { - doubles: { - step: 4, - points: [ - [ - "e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a", - "f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821" - ], - [ - "8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508", - "11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf" - ], - [ - "175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739", - "d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695" - ], - [ - "363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640", - "4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9" - ], - [ - "8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c", - "4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36" - ], - [ - "723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda", - "96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f" - ], - [ - "eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa", - "5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999" - ], - [ - "100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0", - "cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09" - ], - [ - "e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d", - "9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d" - ], - [ - "feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d", - "e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088" - ], - [ - "da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1", - "9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d" - ], - [ - "53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0", - "5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8" - ], - [ - "8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047", - "10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a" - ], - [ - "385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862", - "283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453" - ], - [ - "6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7", - "7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160" - ], - [ - "3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd", - "56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0" - ], - [ - "85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83", - "7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6" - ], - [ - "948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a", - "53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589" - ], - [ - "6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8", - "bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17" - ], - [ - "e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d", - "4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda" - ], - [ - "e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725", - "7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd" - ], - [ - "213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754", - "4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2" - ], - [ - "4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c", - "17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6" - ], - [ - "fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6", - "6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f" - ], - [ - "76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39", - "c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01" - ], - [ - "c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891", - "893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3" - ], - [ - "d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b", - "febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f" - ], - [ - "b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03", - "2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7" - ], - [ - "e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d", - "eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78" - ], - [ - "a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070", - "7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1" - ], - [ - "90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4", - "e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150" - ], - [ - "8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da", - "662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82" - ], - [ - "e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11", - "1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc" - ], - [ - "8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e", - "efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b" - ], - [ - "e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41", - "2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51" - ], - [ - "b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef", - "67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45" - ], - [ - "d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8", - "db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120" - ], - [ - "324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d", - "648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84" - ], - [ - "4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96", - "35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d" - ], - [ - "9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd", - "ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d" - ], - [ - "6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5", - "9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8" - ], - [ - "a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266", - "40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8" - ], - [ - "7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71", - "34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac" - ], - [ - "928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac", - "c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f" - ], - [ - "85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751", - "1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962" - ], - [ - "ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e", - "493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907" - ], - [ - "827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241", - "c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec" - ], - [ - "eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3", - "be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d" - ], - [ - "e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f", - "4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414" - ], - [ - "1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19", - "aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd" - ], - [ - "146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be", - "b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0" - ], - [ - "fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9", - "6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811" - ], - [ - "da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2", - "8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1" - ], - [ - "a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13", - "7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c" - ], - [ - "174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c", - "ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73" - ], - [ - "959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba", - "2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd" - ], - [ - "d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151", - "e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405" - ], - [ - "64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073", - "d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589" - ], - [ - "8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458", - "38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e" - ], - [ - "13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b", - "69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27" - ], - [ - "bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366", - "d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1" - ], - [ - "8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa", - "40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482" - ], - [ - "8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0", - "620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945" - ], - [ - "dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787", - "7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573" - ], - [ - "f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e", - "ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82" - ] - ] - }, - naf: { - wnd: 7, - points: [ - [ - "f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9", - "388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672" - ], - [ - "2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4", - "d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6" - ], - [ - "5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc", - "6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da" - ], - [ - "acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe", - "cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37" - ], - [ - "774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb", - "d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b" - ], - [ - "f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8", - "ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81" - ], - [ - "d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e", - "581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58" - ], - [ - "defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34", - "4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77" - ], - [ - "2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c", - "85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a" - ], - [ - "352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5", - "321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c" - ], - [ - "2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f", - "2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67" - ], - [ - "9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714", - "73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402" - ], - [ - "daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729", - "a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55" - ], - [ - "c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db", - "2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482" - ], - [ - "6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4", - "e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82" - ], - [ - "1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5", - "b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396" - ], - [ - "605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479", - "2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49" - ], - [ - "62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d", - "80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf" - ], - [ - "80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f", - "1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a" - ], - [ - "7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb", - "d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7" - ], - [ - "d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9", - "eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933" - ], - [ - "49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963", - "758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a" - ], - [ - "77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74", - "958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6" - ], - [ - "f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530", - "e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37" - ], - [ - "463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b", - "5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e" - ], - [ - "f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247", - "cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6" - ], - [ - "caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1", - "cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476" - ], - [ - "2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120", - "4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40" - ], - [ - "7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435", - "91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61" - ], - [ - "754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18", - "673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683" - ], - [ - "e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8", - "59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5" - ], - [ - "186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb", - "3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b" - ], - [ - "df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f", - "55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417" - ], - [ - "5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143", - "efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868" - ], - [ - "290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba", - "e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a" - ], - [ - "af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45", - "f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6" - ], - [ - "766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a", - "744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996" - ], - [ - "59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e", - "c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e" - ], - [ - "f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8", - "e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d" - ], - [ - "7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c", - "30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2" - ], - [ - "948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519", - "e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e" - ], - [ - "7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab", - "100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437" - ], - [ - "3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca", - "ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311" - ], - [ - "d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf", - "8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4" - ], - [ - "1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610", - "68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575" - ], - [ - "733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4", - "f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d" - ], - [ - "15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c", - "d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d" - ], - [ - "a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940", - "edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629" - ], - [ - "e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980", - "a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06" - ], - [ - "311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3", - "66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374" - ], - [ - "34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf", - "9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee" - ], - [ - "f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63", - "4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1" - ], - [ - "d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448", - "fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b" - ], - [ - "32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf", - "5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661" - ], - [ - "7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5", - "8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6" - ], - [ - "ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6", - "8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e" - ], - [ - "16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5", - "5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d" - ], - [ - "eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99", - "f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc" - ], - [ - "78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51", - "f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4" - ], - [ - "494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5", - "42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c" - ], - [ - "a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5", - "204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b" - ], - [ - "c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997", - "4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913" - ], - [ - "841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881", - "73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154" - ], - [ - "5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5", - "39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865" - ], - [ - "36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66", - "d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc" - ], - [ - "336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726", - "ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224" - ], - [ - "8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede", - "6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e" - ], - [ - "1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94", - "60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6" - ], - [ - "85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31", - "3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511" - ], - [ - "29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51", - "b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b" - ], - [ - "a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252", - "ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2" - ], - [ - "4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5", - "cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c" - ], - [ - "d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b", - "6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3" - ], - [ - "ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4", - "322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d" - ], - [ - "af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f", - "6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700" - ], - [ - "e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889", - "2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4" - ], - [ - "591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246", - "b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196" - ], - [ - "11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984", - "998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4" - ], - [ - "3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a", - "b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257" - ], - [ - "cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030", - "bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13" - ], - [ - "c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197", - "6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096" - ], - [ - "c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593", - "c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38" - ], - [ - "a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef", - "21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f" - ], - [ - "347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38", - "60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448" - ], - [ - "da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a", - "49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a" - ], - [ - "c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111", - "5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4" - ], - [ - "4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502", - "7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437" - ], - [ - "3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea", - "be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7" - ], - [ - "cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26", - "8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d" - ], - [ - "b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986", - "39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a" - ], - [ - "d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e", - "62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54" - ], - [ - "48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4", - "25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77" - ], - [ - "dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda", - "ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517" - ], - [ - "6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859", - "cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10" - ], - [ - "e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f", - "f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125" - ], - [ - "eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c", - "6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e" - ], - [ - "13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942", - "fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1" - ], - [ - "ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a", - "1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2" - ], - [ - "b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80", - "5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423" - ], - [ - "ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d", - "438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8" - ], - [ - "8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1", - "cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758" - ], - [ - "52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63", - "c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375" - ], - [ - "e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352", - "6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d" - ], - [ - "7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193", - "ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec" - ], - [ - "5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00", - "9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0" - ], - [ - "32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58", - "ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c" - ], - [ - "e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7", - "d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4" - ], - [ - "8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8", - "c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f" - ], - [ - "4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e", - "67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649" - ], - [ - "3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d", - "cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826" - ], - [ - "674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b", - "299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5" - ], - [ - "d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f", - "f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87" - ], - [ - "30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6", - "462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b" - ], - [ - "be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297", - "62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc" - ], - [ - "93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a", - "7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c" - ], - [ - "b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c", - "ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f" - ], - [ - "d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52", - "4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a" - ], - [ - "d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb", - "bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46" - ], - [ - "463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065", - "bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f" - ], - [ - "7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917", - "603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03" - ], - [ - "74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9", - "cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08" - ], - [ - "30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3", - "553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8" - ], - [ - "9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57", - "712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373" - ], - [ - "176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66", - "ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3" - ], - [ - "75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8", - "9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8" - ], - [ - "809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721", - "9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1" - ], - [ - "1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180", - "4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9" - ] - ] - } - }), _m; -} -(function(t) { - var e = t, r = rh, n = gb, i = ji, s = i.assert; - function o(l) { - l.type === "short" ? this.curve = new n.short(l) : l.type === "edwards" ? this.curve = new n.edwards(l) : this.curve = new n.mont(l), this.g = this.curve.g, this.n = this.curve.n, this.hash = l.hash, s(this.g.validate(), "Invalid curve"), s(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); - } - e.PresetCurve = o; - function a(l, d) { - Object.defineProperty(e, l, { - configurable: !0, - enumerable: !0, - get: function() { - var p = new o(d); - return Object.defineProperty(e, l, { - configurable: !0, - enumerable: !0, - value: p - }), p; - } - }); - } - a("p192", { - type: "short", - prime: "p192", - p: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff", - a: "ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc", - b: "64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1", - n: "ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831", - hash: r.sha256, - gRed: !1, - g: [ - "188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012", - "07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811" - ] - }), a("p224", { - type: "short", - prime: "p224", - p: "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001", - a: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe", - b: "b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4", - n: "ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d", - hash: r.sha256, - gRed: !1, - g: [ - "b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21", - "bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34" - ] - }), a("p256", { - type: "short", - prime: null, - p: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff", - a: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc", - b: "5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b", - n: "ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551", - hash: r.sha256, - gRed: !1, - g: [ - "6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296", - "4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5" - ] - }), a("p384", { - type: "short", - prime: null, - p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff", - a: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc", - b: "b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef", - n: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973", - hash: r.sha384, - gRed: !1, - g: [ - "aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7", - "3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f" - ] - }), a("p521", { - type: "short", - prime: null, - p: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff", - a: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc", - b: "00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00", - n: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409", - hash: r.sha512, - gRed: !1, - g: [ - "000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66", - "00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650" - ] - }), a("curve25519", { - type: "mont", - prime: "p25519", - p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed", - a: "76d06", - b: "1", - n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", - hash: r.sha256, - gRed: !1, - g: [ - "9" - ] - }), a("ed25519", { - type: "edwards", - prime: "p25519", - p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed", - a: "-1", - c: "1", - // -121665 * (121666^(-1)) (mod P) - d: "52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3", - n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", - hash: r.sha256, - gRed: !1, - g: [ - "216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a", - // 4/5 - "6666666666666666666666666666666666666666666666666666666666666658" - ] - }); - var u; - try { - u = Vq(); - } catch { - u = void 0; - } - a("secp256k1", { - type: "short", - prime: "k256", - p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f", - a: "0", - b: "7", - n: "ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141", - h: "1", - hash: r.sha256, - // Precomputed endomorphism - beta: "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee", - lambda: "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72", - basis: [ - { - a: "3086d221a7d46bcde86c90e49284eb15", - b: "-e4437ed6010e88286f547fa90abfe4c3" - }, - { - a: "114ca50f7a8e2f3f657c1108d9d44cfd8", - b: "3086d221a7d46bcde86c90e49284eb15" - } - ], - gRed: !1, - g: [ - "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", - "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", - u - ] - }); -})(lp); -var Gq = rh, dc = db, eE = Tc; -function Aa(t) { - if (!(this instanceof Aa)) - return new Aa(t); - this.hash = t.hash, this.predResist = !!t.predResist, this.outLen = this.hash.outSize, this.minEntropy = t.minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null; - var e = dc.toArray(t.entropy, t.entropyEnc || "hex"), r = dc.toArray(t.nonce, t.nonceEnc || "hex"), n = dc.toArray(t.pers, t.persEnc || "hex"); - eE( - e.length >= this.minEntropy / 8, - "Not enough entropy. Minimum is: " + this.minEntropy + " bits" - ), this._init(e, r, n); -} -var Yq = Aa; -Aa.prototype._init = function(e, r, n) { - var i = e.concat(r).concat(n); - this.K = new Array(this.outLen / 8), this.V = new Array(this.outLen / 8); - for (var s = 0; s < this.V.length; s++) - this.K[s] = 0, this.V[s] = 1; - this._update(i), this._reseed = 1, this.reseedInterval = 281474976710656; -}; -Aa.prototype._hmac = function() { - return new Gq.hmac(this.hash, this.K); -}; -Aa.prototype._update = function(e) { - var r = this._hmac().update(this.V).update([0]); - e && (r = r.update(e)), this.K = r.digest(), this.V = this._hmac().update(this.V).digest(), e && (this.K = this._hmac().update(this.V).update([1]).update(e).digest(), this.V = this._hmac().update(this.V).digest()); -}; -Aa.prototype.reseed = function(e, r, n, i) { - typeof r != "string" && (i = n, n = r, r = null), e = dc.toArray(e, r), n = dc.toArray(n, i), eE( - e.length >= this.minEntropy / 8, - "Not enough entropy. Minimum is: " + this.minEntropy + " bits" - ), this._update(e.concat(n || [])), this._reseed = 1; -}; -Aa.prototype.generate = function(e, r, n, i) { - if (this._reseed > this.reseedInterval) - throw new Error("Reseed is required"); - typeof r != "string" && (i = n, n = r, r = null), n && (n = dc.toArray(n, i || "hex"), this._update(n)); - for (var s = []; s.length < e; ) - this.V = this._hmac().update(this.V).digest(), s = s.concat(this.V); - var o = s.slice(0, e); - return this._update(n), this._reseed++, dc.encode(o, r); -}; -var Jq = Ho, Xq = ji, q1 = Xq.assert; -function ti(t, e) { - this.ec = t, this.priv = null, this.pub = null, e.priv && this._importPrivate(e.priv, e.privEnc), e.pub && this._importPublic(e.pub, e.pubEnc); -} -var Zq = ti; -ti.fromPublic = function(e, r, n) { - return r instanceof ti ? r : new ti(e, { - pub: r, - pubEnc: n - }); -}; -ti.fromPrivate = function(e, r, n) { - return r instanceof ti ? r : new ti(e, { - priv: r, - privEnc: n - }); -}; -ti.prototype.validate = function() { - var e = this.getPublic(); - return e.isInfinity() ? { result: !1, reason: "Invalid public key" } : e.validate() ? e.mul(this.ec.curve.n).isInfinity() ? { result: !0, reason: null } : { result: !1, reason: "Public key * N != O" } : { result: !1, reason: "Public key is not a point" }; -}; -ti.prototype.getPublic = function(e, r) { - return typeof e == "string" && (r = e, e = null), this.pub || (this.pub = this.ec.g.mul(this.priv)), r ? this.pub.encode(r, e) : this.pub; -}; -ti.prototype.getPrivate = function(e) { - return e === "hex" ? this.priv.toString(16, 2) : this.priv; -}; -ti.prototype._importPrivate = function(e, r) { - this.priv = new Jq(e, r || 16), this.priv = this.priv.umod(this.ec.curve.n); -}; -ti.prototype._importPublic = function(e, r) { - if (e.x || e.y) { - this.ec.curve.type === "mont" ? q1(e.x, "Need x coordinate") : (this.ec.curve.type === "short" || this.ec.curve.type === "edwards") && q1(e.x && e.y, "Need both x and y coordinate"), this.pub = this.ec.curve.point(e.x, e.y); - return; - } - this.pub = this.ec.curve.decodePoint(e, r); -}; -ti.prototype.derive = function(e) { - return e.validate() || q1(e.validate(), "public point not validated"), e.mul(this.priv).getX(); -}; -ti.prototype.sign = function(e, r, n) { - return this.ec.sign(e, this, r, n); -}; -ti.prototype.verify = function(e, r, n) { - return this.ec.verify(e, r, this, void 0, n); -}; -ti.prototype.inspect = function() { - return ""; -}; -var y0 = Ho, vb = ji, Qq = vb.assert; -function hp(t, e) { - if (t instanceof hp) - return t; - this._importDER(t, e) || (Qq(t.r && t.s, "Signature without r or s"), this.r = new y0(t.r, 16), this.s = new y0(t.s, 16), t.recoveryParam === void 0 ? this.recoveryParam = null : this.recoveryParam = t.recoveryParam); -} -var ez = hp; -function tz() { - this.place = 0; -} -function Em(t, e) { - var r = t[e.place++]; - if (!(r & 128)) - return r; - var n = r & 15; - if (n === 0 || n > 4 || t[e.place] === 0) - return !1; - for (var i = 0, s = 0, o = e.place; s < n; s++, o++) - i <<= 8, i |= t[o], i >>>= 0; - return i <= 127 ? !1 : (e.place = o, i); -} -function Gx(t) { - for (var e = 0, r = t.length - 1; !t[e] && !(t[e + 1] & 128) && e < r; ) - e++; - return e === 0 ? t : t.slice(e); -} -hp.prototype._importDER = function(e, r) { - e = vb.toArray(e, r); - var n = new tz(); - if (e[n.place++] !== 48) - return !1; - var i = Em(e, n); - if (i === !1 || i + n.place !== e.length || e[n.place++] !== 2) - return !1; - var s = Em(e, n); - if (s === !1 || e[n.place] & 128) - return !1; - var o = e.slice(n.place, s + n.place); - if (n.place += s, e[n.place++] !== 2) - return !1; - var a = Em(e, n); - if (a === !1 || e.length !== a + n.place || e[n.place] & 128) - return !1; - var u = e.slice(n.place, a + n.place); - if (o[0] === 0) - if (o[1] & 128) - o = o.slice(1); - else - return !1; - if (u[0] === 0) - if (u[1] & 128) - u = u.slice(1); - else - return !1; - return this.r = new y0(o), this.s = new y0(u), this.recoveryParam = null, !0; -}; -function Sm(t, e) { - if (e < 128) { - t.push(e); - return; - } - var r = 1 + (Math.log(e) / Math.LN2 >>> 3); - for (t.push(r | 128); --r; ) - t.push(e >>> (r << 3) & 255); - t.push(e); -} -hp.prototype.toDER = function(e) { - var r = this.r.toArray(), n = this.s.toArray(); - for (r[0] & 128 && (r = [0].concat(r)), n[0] & 128 && (n = [0].concat(n)), r = Gx(r), n = Gx(n); !n[0] && !(n[1] & 128); ) - n = n.slice(1); - var i = [2]; - Sm(i, r.length), i = i.concat(r), i.push(2), Sm(i, n.length); - var s = i.concat(n), o = [48]; - return Sm(o, s.length), o = o.concat(s), vb.encode(o, e); -}; -var Co = Ho, tE = Yq, rz = ji, Am = lp, nz = X8, rE = rz.assert, bb = Zq, dp = ez; -function rs(t) { - if (!(this instanceof rs)) - return new rs(t); - typeof t == "string" && (rE( - Object.prototype.hasOwnProperty.call(Am, t), - "Unknown curve " + t - ), t = Am[t]), t instanceof Am.PresetCurve && (t = { curve: t }), this.curve = t.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = t.curve.g, this.g.precompute(t.curve.n.bitLength() + 1), this.hash = t.hash || t.curve.hash; -} -var iz = rs; -rs.prototype.keyPair = function(e) { - return new bb(this, e); -}; -rs.prototype.keyFromPrivate = function(e, r) { - return bb.fromPrivate(this, e, r); -}; -rs.prototype.keyFromPublic = function(e, r) { - return bb.fromPublic(this, e, r); -}; -rs.prototype.genKeyPair = function(e) { - e || (e = {}); - for (var r = new tE({ - hash: this.hash, - pers: e.pers, - persEnc: e.persEnc || "utf8", - entropy: e.entropy || nz(this.hash.hmacStrength), - entropyEnc: e.entropy && e.entropyEnc || "utf8", - nonce: this.n.toArray() - }), n = this.n.byteLength(), i = this.n.sub(new Co(2)); ; ) { - var s = new Co(r.generate(n)); - if (!(s.cmp(i) > 0)) - return s.iaddn(1), this.keyFromPrivate(s); - } -}; -rs.prototype._truncateToN = function(e, r, n) { - var i; - if (Co.isBN(e) || typeof e == "number") - e = new Co(e, 16), i = e.byteLength(); - else if (typeof e == "object") - i = e.length, e = new Co(e, 16); - else { - var s = e.toString(); - i = s.length + 1 >>> 1, e = new Co(s, 16); - } - typeof n != "number" && (n = i * 8); - var o = n - this.n.bitLength(); - return o > 0 && (e = e.ushrn(o)), !r && e.cmp(this.n) >= 0 ? e.sub(this.n) : e; -}; -rs.prototype.sign = function(e, r, n, i) { - typeof n == "object" && (i = n, n = null), i || (i = {}), r = this.keyFromPrivate(r, n), e = this._truncateToN(e, !1, i.msgBitLength); - for (var s = this.n.byteLength(), o = r.getPrivate().toArray("be", s), a = e.toArray("be", s), u = new tE({ - hash: this.hash, - entropy: o, - nonce: a, - pers: i.pers, - persEnc: i.persEnc || "utf8" - }), l = this.n.sub(new Co(1)), d = 0; ; d++) { - var p = i.k ? i.k(d) : new Co(u.generate(this.n.byteLength())); - if (p = this._truncateToN(p, !0), !(p.cmpn(1) <= 0 || p.cmp(l) >= 0)) { - var w = this.g.mul(p); - if (!w.isInfinity()) { - var _ = w.getX(), P = _.umod(this.n); - if (P.cmpn(0) !== 0) { - var O = p.invm(this.n).mul(P.mul(r.getPrivate()).iadd(e)); - if (O = O.umod(this.n), O.cmpn(0) !== 0) { - var L = (w.getY().isOdd() ? 1 : 0) | (_.cmp(P) !== 0 ? 2 : 0); - return i.canonical && O.cmp(this.nh) > 0 && (O = this.n.sub(O), L ^= 1), new dp({ r: P, s: O, recoveryParam: L }); - } - } - } - } - } -}; -rs.prototype.verify = function(e, r, n, i, s) { - s || (s = {}), e = this._truncateToN(e, !1, s.msgBitLength), n = this.keyFromPublic(n, i), r = new dp(r, "hex"); - var o = r.r, a = r.s; - if (o.cmpn(1) < 0 || o.cmp(this.n) >= 0 || a.cmpn(1) < 0 || a.cmp(this.n) >= 0) - return !1; - var u = a.invm(this.n), l = u.mul(e).umod(this.n), d = u.mul(o).umod(this.n), p; - return this.curve._maxwellTrick ? (p = this.g.jmulAdd(l, n.getPublic(), d), p.isInfinity() ? !1 : p.eqXToP(o)) : (p = this.g.mulAdd(l, n.getPublic(), d), p.isInfinity() ? !1 : p.getX().umod(this.n).cmp(o) === 0); -}; -rs.prototype.recoverPubKey = function(t, e, r, n) { - rE((3 & r) === r, "The recovery param is more than two bits"), e = new dp(e, n); - var i = this.n, s = new Co(t), o = e.r, a = e.s, u = r & 1, l = r >> 1; - if (o.cmp(this.curve.p.umod(this.curve.n)) >= 0 && l) - throw new Error("Unable to find sencond key candinate"); - l ? o = this.curve.pointFromX(o.add(this.curve.n), u) : o = this.curve.pointFromX(o, u); - var d = e.r.invm(i), p = i.sub(s).mul(d).umod(i), w = a.mul(d).umod(i); - return this.g.mulAdd(p, o, w); -}; -rs.prototype.getKeyRecoveryParam = function(t, e, r, n) { - if (e = new dp(e, n), e.recoveryParam !== null) - return e.recoveryParam; - for (var i = 0; i < 4; i++) { - var s; - try { - s = this.recoverPubKey(t, e, i); - } catch { - continue; - } - if (s.eq(r)) - return i; - } - throw new Error("Unable to find valid recovery factor"); -}; -var oh = ji, nE = oh.assert, Yx = oh.parseBytes, Yu = oh.cachedProperty; -function Nn(t, e) { - this.eddsa = t, this._secret = Yx(e.secret), t.isPoint(e.pub) ? this._pub = e.pub : this._pubBytes = Yx(e.pub); -} -Nn.fromPublic = function(e, r) { - return r instanceof Nn ? r : new Nn(e, { pub: r }); -}; -Nn.fromSecret = function(e, r) { - return r instanceof Nn ? r : new Nn(e, { secret: r }); -}; -Nn.prototype.secret = function() { - return this._secret; -}; -Yu(Nn, "pubBytes", function() { - return this.eddsa.encodePoint(this.pub()); -}); -Yu(Nn, "pub", function() { - return this._pubBytes ? this.eddsa.decodePoint(this._pubBytes) : this.eddsa.g.mul(this.priv()); -}); -Yu(Nn, "privBytes", function() { - var e = this.eddsa, r = this.hash(), n = e.encodingLength - 1, i = r.slice(0, e.encodingLength); - return i[0] &= 248, i[n] &= 127, i[n] |= 64, i; -}); -Yu(Nn, "priv", function() { - return this.eddsa.decodeInt(this.privBytes()); -}); -Yu(Nn, "hash", function() { - return this.eddsa.hash().update(this.secret()).digest(); -}); -Yu(Nn, "messagePrefix", function() { - return this.hash().slice(this.eddsa.encodingLength); -}); -Nn.prototype.sign = function(e) { - return nE(this._secret, "KeyPair can only verify"), this.eddsa.sign(e, this); -}; -Nn.prototype.verify = function(e, r) { - return this.eddsa.verify(e, r, this); -}; -Nn.prototype.getSecret = function(e) { - return nE(this._secret, "KeyPair is public only"), oh.encode(this.secret(), e); -}; -Nn.prototype.getPublic = function(e) { - return oh.encode(this.pubBytes(), e); -}; -var sz = Nn, oz = Ho, pp = ji, Jx = pp.assert, gp = pp.cachedProperty, az = pp.parseBytes; -function Dc(t, e) { - this.eddsa = t, typeof e != "object" && (e = az(e)), Array.isArray(e) && (Jx(e.length === t.encodingLength * 2, "Signature has invalid size"), e = { - R: e.slice(0, t.encodingLength), - S: e.slice(t.encodingLength) - }), Jx(e.R && e.S, "Signature without R or S"), t.isPoint(e.R) && (this._R = e.R), e.S instanceof oz && (this._S = e.S), this._Rencoded = Array.isArray(e.R) ? e.R : e.Rencoded, this._Sencoded = Array.isArray(e.S) ? e.S : e.Sencoded; -} -gp(Dc, "S", function() { - return this.eddsa.decodeInt(this.Sencoded()); -}); -gp(Dc, "R", function() { - return this.eddsa.decodePoint(this.Rencoded()); -}); -gp(Dc, "Rencoded", function() { - return this.eddsa.encodePoint(this.R()); -}); -gp(Dc, "Sencoded", function() { - return this.eddsa.encodeInt(this.S()); -}); -Dc.prototype.toBytes = function() { - return this.Rencoded().concat(this.Sencoded()); -}; -Dc.prototype.toHex = function() { - return pp.encode(this.toBytes(), "hex").toUpperCase(); -}; -var cz = Dc, uz = rh, fz = lp, Lu = ji, lz = Lu.assert, iE = Lu.parseBytes, sE = sz, Xx = cz; -function Si(t) { - if (lz(t === "ed25519", "only tested with ed25519 so far"), !(this instanceof Si)) - return new Si(t); - t = fz[t].curve, this.curve = t, this.g = t.g, this.g.precompute(t.n.bitLength() + 1), this.pointClass = t.point().constructor, this.encodingLength = Math.ceil(t.n.bitLength() / 8), this.hash = uz.sha512; -} -var hz = Si; -Si.prototype.sign = function(e, r) { - e = iE(e); - var n = this.keyFromSecret(r), i = this.hashInt(n.messagePrefix(), e), s = this.g.mul(i), o = this.encodePoint(s), a = this.hashInt(o, n.pubBytes(), e).mul(n.priv()), u = i.add(a).umod(this.curve.n); - return this.makeSignature({ R: s, S: u, Rencoded: o }); -}; -Si.prototype.verify = function(e, r, n) { - if (e = iE(e), r = this.makeSignature(r), r.S().gte(r.eddsa.curve.n) || r.S().isNeg()) - return !1; - var i = this.keyFromPublic(n), s = this.hashInt(r.Rencoded(), i.pubBytes(), e), o = this.g.mul(r.S()), a = r.R().add(i.pub().mul(s)); - return a.eq(o); -}; -Si.prototype.hashInt = function() { - for (var e = this.hash(), r = 0; r < arguments.length; r++) - e.update(arguments[r]); - return Lu.intFromLE(e.digest()).umod(this.curve.n); -}; -Si.prototype.keyFromPublic = function(e) { - return sE.fromPublic(this, e); -}; -Si.prototype.keyFromSecret = function(e) { - return sE.fromSecret(this, e); -}; -Si.prototype.makeSignature = function(e) { - return e instanceof Xx ? e : new Xx(this, e); -}; -Si.prototype.encodePoint = function(e) { - var r = e.getY().toArray("le", this.encodingLength); - return r[this.encodingLength - 1] |= e.getX().isOdd() ? 128 : 0, r; -}; -Si.prototype.decodePoint = function(e) { - e = Lu.parseBytes(e); - var r = e.length - 1, n = e.slice(0, r).concat(e[r] & -129), i = (e[r] & 128) !== 0, s = Lu.intFromLE(n); - return this.curve.pointFromY(s, i); -}; -Si.prototype.encodeInt = function(e) { - return e.toArray("le", this.encodingLength); -}; -Si.prototype.decodeInt = function(e) { - return Lu.intFromLE(e); -}; -Si.prototype.isPoint = function(e) { - return e instanceof this.pointClass; -}; -(function(t) { - var e = t; - e.version = $q.version, e.utils = ji, e.rand = X8, e.curve = gb, e.curves = lp, e.ec = iz, e.eddsa = hz; -})(J8); -const dz = { waku: { publish: "waku_publish", batchPublish: "waku_batchPublish", subscribe: "waku_subscribe", batchSubscribe: "waku_batchSubscribe", subscription: "waku_subscription", unsubscribe: "waku_unsubscribe", batchUnsubscribe: "waku_batchUnsubscribe", batchFetchMessages: "waku_batchFetchMessages" }, irn: { publish: "irn_publish", batchPublish: "irn_batchPublish", subscribe: "irn_subscribe", batchSubscribe: "irn_batchSubscribe", subscription: "irn_subscription", unsubscribe: "irn_unsubscribe", batchUnsubscribe: "irn_batchUnsubscribe", batchFetchMessages: "irn_batchFetchMessages" }, iridium: { publish: "iridium_publish", batchPublish: "iridium_batchPublish", subscribe: "iridium_subscribe", batchSubscribe: "iridium_batchSubscribe", subscription: "iridium_subscription", unsubscribe: "iridium_unsubscribe", batchUnsubscribe: "iridium_batchUnsubscribe", batchFetchMessages: "iridium_batchFetchMessages" } }, pz = ":"; -function Eu(t) { - const [e, r] = t.split(pz); - return { namespace: e, reference: r }; -} -function oE(t, e) { - return t.includes(":") ? [t] : e.chains || []; -} -var gz = Object.defineProperty, Zx = Object.getOwnPropertySymbols, mz = Object.prototype.hasOwnProperty, vz = Object.prototype.propertyIsEnumerable, Qx = (t, e, r) => e in t ? gz(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, e3 = (t, e) => { - for (var r in e || (e = {})) mz.call(e, r) && Qx(t, r, e[r]); - if (Zx) for (var r of Zx(e)) vz.call(e, r) && Qx(t, r, e[r]); - return t; -}; -const bz = "ReactNative", Oi = { reactNative: "react-native", node: "node", browser: "browser", unknown: "unknown" }, yz = "js"; -function w0() { - return typeof process < "u" && typeof process.versions < "u" && typeof process.versions.node < "u"; -} -function Ju() { - return !th() && !!eb() && navigator.product === bz; -} -function ah() { - return !w0() && !!eb() && !!th(); -} -function ch() { - return Ju() ? Oi.reactNative : w0() ? Oi.node : ah() ? Oi.browser : Oi.unknown; -} -function wz() { - var t; - try { - return Ju() && typeof global < "u" && typeof (global == null ? void 0 : global.Application) < "u" ? (t = global.Application) == null ? void 0 : t.applicationId : void 0; - } catch { - return; - } -} -function xz(t, e) { - let r = Dl.parse(t); - return r = e3(e3({}, r), e), t = Dl.stringify(r), t; -} -function aE() { - return v8() || { name: "", description: "", url: "", icons: [""] }; -} -function _z() { - if (ch() === Oi.reactNative && typeof global < "u" && typeof (global == null ? void 0 : global.Platform) < "u") { - const { OS: r, Version: n } = global.Platform; - return [r, n].join("-"); - } - const t = NF(); - if (t === null) return "unknown"; - const e = t.os ? t.os.replace(" ", "").toLowerCase() : "unknown"; - return t.type === "browser" ? [e, t.name, t.version].join("-") : [e, t.version].join("-"); -} -function Ez() { - var t; - const e = ch(); - return e === Oi.browser ? [e, ((t = m8()) == null ? void 0 : t.host) || "unknown"].join(":") : e; -} -function cE(t, e, r) { - const n = _z(), i = Ez(); - return [[t, e].join("-"), [yz, r].join("-"), n, i].join("/"); -} -function Sz({ protocol: t, version: e, relayUrl: r, sdkVersion: n, auth: i, projectId: s, useOnCloseEvent: o, bundleId: a }) { - const u = r.split("?"), l = cE(t, e, n), d = { auth: i, ua: l, projectId: s, useOnCloseEvent: o, origin: a || void 0 }, p = xz(u[1] || "", d); - return u[0] + "?" + p; -} -function uc(t, e) { - return t.filter((r) => e.includes(r)).length === t.length; -} -function uE(t) { - return Object.fromEntries(t.entries()); -} -function fE(t) { - return new Map(Object.entries(t)); -} -function ec(t = vt.FIVE_MINUTES, e) { - const r = vt.toMiliseconds(t || vt.FIVE_MINUTES); - let n, i, s; - return { resolve: (o) => { - s && n && (clearTimeout(s), n(o)); - }, reject: (o) => { - s && i && (clearTimeout(s), i(o)); - }, done: () => new Promise((o, a) => { - s = setTimeout(() => { - a(new Error(e)); - }, r), n = o, i = a; - }) }; -} -function Su(t, e, r) { - return new Promise(async (n, i) => { - const s = setTimeout(() => i(new Error(r)), e); - try { - const o = await t; - n(o); - } catch (o) { - i(o); - } - clearTimeout(s); - }); -} -function lE(t, e) { - if (typeof e == "string" && e.startsWith(`${t}:`)) return e; - if (t.toLowerCase() === "topic") { - if (typeof e != "string") throw new Error('Value must be "string" for expirer target type: topic'); - return `topic:${e}`; - } else if (t.toLowerCase() === "id") { - if (typeof e != "number") throw new Error('Value must be "number" for expirer target type: id'); - return `id:${e}`; - } - throw new Error(`Unknown expirer target type: ${t}`); -} -function Az(t) { - return lE("topic", t); -} -function Pz(t) { - return lE("id", t); -} -function hE(t) { - const [e, r] = t.split(":"), n = { id: void 0, topic: void 0 }; - if (e === "topic" && typeof r == "string") n.topic = r; - else if (e === "id" && Number.isInteger(Number(r))) n.id = Number(r); - else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`); - return n; -} -function Sn(t, e) { - return vt.fromMiliseconds(Date.now() + vt.toMiliseconds(t)); -} -function fa(t) { - return Date.now() >= vt.toMiliseconds(t); -} -function yr(t, e) { - return `${t}${e ? `:${e}` : ""}`; -} -function jd(t = [], e = []) { - return [.../* @__PURE__ */ new Set([...t, ...e])]; -} -async function Mz({ id: t, topic: e, wcDeepLink: r }) { - var n; - try { - if (!r) return; - const i = typeof r == "string" ? JSON.parse(r) : r, s = i == null ? void 0 : i.href; - if (typeof s != "string") return; - const o = Iz(s, t, e), a = ch(); - if (a === Oi.browser) { - if (!((n = th()) != null && n.hasFocus())) { - console.warn("Document does not have focus, skipping deeplink."); - return; - } - o.startsWith("https://") || o.startsWith("http://") ? window.open(o, "_blank", "noreferrer noopener") : window.open(o, Tz() ? "_blank" : "_self", "noreferrer noopener"); - } else a === Oi.reactNative && typeof (global == null ? void 0 : global.Linking) < "u" && await global.Linking.openURL(o); - } catch (i) { - console.error(i); - } -} -function Iz(t, e, r) { - const n = `requestId=${e}&sessionTopic=${r}`; - t.endsWith("/") && (t = t.slice(0, -1)); - let i = `${t}`; - if (t.startsWith("https://t.me")) { - const s = t.includes("?") ? "&startapp=" : "?startapp="; - i = `${i}${s}${Rz(n, !0)}`; - } else i = `${i}/wc?${n}`; - return i; -} -async function Cz(t, e) { - let r = ""; - try { - if (ah() && (r = localStorage.getItem(e), r)) return r; - r = await t.getItem(e); - } catch (n) { - console.error(n); - } - return r; -} -function t3(t, e) { - if (!t.includes(e)) return null; - const r = t.split(/([&,?,=])/), n = r.indexOf(e); - return r[n + 2]; -} -function r3() { - return typeof crypto < "u" && crypto != null && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu, (t) => { - const e = Math.random() * 16 | 0; - return (t === "x" ? e : e & 3 | 8).toString(16); - }); -} -function yb() { - return typeof process < "u" && process.env.IS_VITEST === "true"; -} -function Tz() { - return typeof window < "u" && (!!window.TelegramWebviewProxy || !!window.Telegram || !!window.TelegramWebviewProxyProto); -} -function Rz(t, e = !1) { - const r = Buffer.from(t).toString("base64"); - return e ? r.replace(/[=]/g, "") : r; -} -function dE(t) { - return Buffer.from(t, "base64").toString("utf-8"); -} -const Dz = "https://rpc.walletconnect.org/v1"; -async function Oz(t, e, r, n, i, s) { - switch (r.t) { - case "eip191": - return Nz(t, e, r.s); - case "eip1271": - return await Lz(t, e, r.s, n, i, s); - default: - throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`); - } -} -function Nz(t, e, r) { - return uq(_8(e), r).toLowerCase() === t.toLowerCase(); -} -async function Lz(t, e, r, n, i, s) { - const o = Eu(n); - if (!o.namespace || !o.reference) throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`); - try { - const a = "0x1626ba7e", u = "0000000000000000000000000000000000000000000000000000000000000040", l = "0000000000000000000000000000000000000000000000000000000000000041", d = r.substring(2), p = _8(e).substring(2), w = a + p + u + l + d, _ = await fetch(`${s || Dz}/?chainId=${n}&projectId=${i}`, { method: "POST", body: JSON.stringify({ id: kz(), jsonrpc: "2.0", method: "eth_call", params: [{ to: t, data: w }, "latest"] }) }), { result: P } = await _.json(); - return P ? P.slice(0, a.length).toLowerCase() === a.toLowerCase() : !1; - } catch (a) { - return console.error("isValidEip1271Signature: ", a), !1; - } -} -function kz() { - return Date.now() + Math.floor(Math.random() * 1e3); -} -var $z = Object.defineProperty, Bz = Object.defineProperties, Fz = Object.getOwnPropertyDescriptors, n3 = Object.getOwnPropertySymbols, jz = Object.prototype.hasOwnProperty, Uz = Object.prototype.propertyIsEnumerable, i3 = (t, e, r) => e in t ? $z(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, qz = (t, e) => { - for (var r in e || (e = {})) jz.call(e, r) && i3(t, r, e[r]); - if (n3) for (var r of n3(e)) Uz.call(e, r) && i3(t, r, e[r]); - return t; -}, zz = (t, e) => Bz(t, Fz(e)); -const Wz = "did:pkh:", wb = (t) => t == null ? void 0 : t.split(":"), Hz = (t) => { - const e = t && wb(t); - if (e) return t.includes(Wz) ? e[3] : e[1]; -}, z1 = (t) => { - const e = t && wb(t); - if (e) return e[2] + ":" + e[3]; -}, x0 = (t) => { - const e = t && wb(t); - if (e) return e.pop(); -}; -async function s3(t) { - const { cacao: e, projectId: r } = t, { s: n, p: i } = e, s = pE(i, i.iss), o = x0(i.iss); - return await Oz(o, s, n, z1(i.iss), r); -} -const pE = (t, e) => { - const r = `${t.domain} wants you to sign in with your Ethereum account:`, n = x0(e); - if (!t.aud && !t.uri) throw new Error("Either `aud` or `uri` is required to construct the message"); - let i = t.statement || void 0; - const s = `URI: ${t.aud || t.uri}`, o = `Version: ${t.version}`, a = `Chain ID: ${Hz(e)}`, u = `Nonce: ${t.nonce}`, l = `Issued At: ${t.iat}`, d = t.exp ? `Expiration Time: ${t.exp}` : void 0, p = t.nbf ? `Not Before: ${t.nbf}` : void 0, w = t.requestId ? `Request ID: ${t.requestId}` : void 0, _ = t.resources ? `Resources:${t.resources.map((O) => ` -- ${O}`).join("")}` : void 0, P = Ud(t.resources); - if (P) { - const O = Ol(P); - i = eW(i, O); - } - return [r, n, "", i, "", s, o, a, u, l, d, p, w, _].filter((O) => O != null).join(` -`); -}; -function Kz(t) { - return Buffer.from(JSON.stringify(t)).toString("base64"); -} -function Vz(t) { - return JSON.parse(Buffer.from(t, "base64").toString("utf-8")); -} -function wc(t) { - if (!t) throw new Error("No recap provided, value is undefined"); - if (!t.att) throw new Error("No `att` property found"); - const e = Object.keys(t.att); - if (!(e != null && e.length)) throw new Error("No resources found in `att` property"); - e.forEach((r) => { - const n = t.att[r]; - if (Array.isArray(n)) throw new Error(`Resource must be an object: ${r}`); - if (typeof n != "object") throw new Error(`Resource must be an object: ${r}`); - if (!Object.keys(n).length) throw new Error(`Resource object is empty: ${r}`); - Object.keys(n).forEach((i) => { - const s = n[i]; - if (!Array.isArray(s)) throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`); - if (!s.length) throw new Error(`Value of ${i} is empty array, must be an array with objects`); - s.forEach((o) => { - if (typeof o != "object") throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`); - }); - }); - }); -} -function Gz(t, e, r, n = {}) { - return r == null || r.sort((i, s) => i.localeCompare(s)), { att: { [t]: Yz(e, r, n) } }; -} -function Yz(t, e, r = {}) { - e = e == null ? void 0 : e.sort((i, s) => i.localeCompare(s)); - const n = e.map((i) => ({ [`${t}/${i}`]: [r] })); - return Object.assign({}, ...n); -} -function gE(t) { - return wc(t), `urn:recap:${Kz(t).replace(/=/g, "")}`; -} -function Ol(t) { - const e = Vz(t.replace("urn:recap:", "")); - return wc(e), e; -} -function Jz(t, e, r) { - const n = Gz(t, e, r); - return gE(n); -} -function Xz(t) { - return t && t.includes("urn:recap:"); -} -function Zz(t, e) { - const r = Ol(t), n = Ol(e), i = Qz(r, n); - return gE(i); -} -function Qz(t, e) { - wc(t), wc(e); - const r = Object.keys(t.att).concat(Object.keys(e.att)).sort((i, s) => i.localeCompare(s)), n = { att: {} }; - return r.forEach((i) => { - var s, o; - Object.keys(((s = t.att) == null ? void 0 : s[i]) || {}).concat(Object.keys(((o = e.att) == null ? void 0 : o[i]) || {})).sort((a, u) => a.localeCompare(u)).forEach((a) => { - var u, l; - n.att[i] = zz(qz({}, n.att[i]), { [a]: ((u = t.att[i]) == null ? void 0 : u[a]) || ((l = e.att[i]) == null ? void 0 : l[a]) }); - }); - }), n; -} -function eW(t = "", e) { - wc(e); - const r = "I further authorize the stated URI to perform the following actions on my behalf: "; - if (t.includes(r)) return t; - const n = []; - let i = 0; - Object.keys(e.att).forEach((a) => { - const u = Object.keys(e.att[a]).map((p) => ({ ability: p.split("/")[0], action: p.split("/")[1] })); - u.sort((p, w) => p.action.localeCompare(w.action)); - const l = {}; - u.forEach((p) => { - l[p.ability] || (l[p.ability] = []), l[p.ability].push(p.action); - }); - const d = Object.keys(l).map((p) => (i++, `(${i}) '${p}': '${l[p].join("', '")}' for '${a}'.`)); - n.push(d.join(", ").replace(".,", ".")); - }); - const s = n.join(" "), o = `${r}${s}`; - return `${t ? t + " " : ""}${o}`; -} -function o3(t) { - var e; - const r = Ol(t); - wc(r); - const n = (e = r.att) == null ? void 0 : e.eip155; - return n ? Object.keys(n).map((i) => i.split("/")[1]) : []; -} -function a3(t) { - const e = Ol(t); - wc(e); - const r = []; - return Object.values(e.att).forEach((n) => { - Object.values(n).forEach((i) => { - var s; - (s = i == null ? void 0 : i[0]) != null && s.chains && r.push(i[0].chains); - }); - }), [...new Set(r.flat())]; -} -function Ud(t) { - if (!t) return; - const e = t == null ? void 0 : t[t.length - 1]; - return Xz(e) ? e : void 0; -} -const mE = "base10", ci = "base16", pa = "base64pad", Of = "base64url", uh = "utf8", vE = 0, Oo = 1, fh = 2, tW = 0, c3 = 1, Jf = 12, xb = 32; -function rW() { - const t = lb.generateKeyPair(); - return { privateKey: On(t.secretKey, ci), publicKey: On(t.publicKey, ci) }; -} -function W1() { - const t = Da.randomBytes(xb); - return On(t, ci); -} -function nW(t, e) { - const r = lb.sharedKey(Rn(t, ci), Rn(e, ci), !0), n = new _q(ih.SHA256, r).expand(xb); - return On(n, ci); -} -function qd(t) { - const e = ih.hash(Rn(t, ci)); - return On(e, ci); -} -function Ao(t) { - const e = ih.hash(Rn(t, uh)); - return On(e, ci); -} -function bE(t) { - return Rn(`${t}`, mE); -} -function xc(t) { - return Number(On(t, mE)); -} -function iW(t) { - const e = bE(typeof t.type < "u" ? t.type : vE); - if (xc(e) === Oo && typeof t.senderPublicKey > "u") throw new Error("Missing sender public key for type 1 envelope"); - const r = typeof t.senderPublicKey < "u" ? Rn(t.senderPublicKey, ci) : void 0, n = typeof t.iv < "u" ? Rn(t.iv, ci) : Da.randomBytes(Jf), i = new ub.ChaCha20Poly1305(Rn(t.symKey, ci)).seal(n, Rn(t.message, uh)); - return yE({ type: e, sealed: i, iv: n, senderPublicKey: r, encoding: t.encoding }); -} -function sW(t, e) { - const r = bE(fh), n = Da.randomBytes(Jf), i = Rn(t, uh); - return yE({ type: r, sealed: i, iv: n, encoding: e }); -} -function oW(t) { - const e = new ub.ChaCha20Poly1305(Rn(t.symKey, ci)), { sealed: r, iv: n } = Nl({ encoded: t.encoded, encoding: t == null ? void 0 : t.encoding }), i = e.open(n, r); - if (i === null) throw new Error("Failed to decrypt"); - return On(i, uh); -} -function aW(t, e) { - const { sealed: r } = Nl({ encoded: t, encoding: e }); - return On(r, uh); -} -function yE(t) { - const { encoding: e = pa } = t; - if (xc(t.type) === fh) return On(kd([t.type, t.sealed]), e); - if (xc(t.type) === Oo) { - if (typeof t.senderPublicKey > "u") throw new Error("Missing sender public key for type 1 envelope"); - return On(kd([t.type, t.senderPublicKey, t.iv, t.sealed]), e); - } - return On(kd([t.type, t.iv, t.sealed]), e); -} -function Nl(t) { - const { encoded: e, encoding: r = pa } = t, n = Rn(e, r), i = n.slice(tW, c3), s = c3; - if (xc(i) === Oo) { - const l = s + xb, d = l + Jf, p = n.slice(s, l), w = n.slice(l, d), _ = n.slice(d); - return { type: i, sealed: _, iv: w, senderPublicKey: p }; - } - if (xc(i) === fh) { - const l = n.slice(s), d = Da.randomBytes(Jf); - return { type: i, sealed: l, iv: d }; - } - const o = s + Jf, a = n.slice(s, o), u = n.slice(o); - return { type: i, sealed: u, iv: a }; -} -function cW(t, e) { - const r = Nl({ encoded: t, encoding: e == null ? void 0 : e.encoding }); - return wE({ type: xc(r.type), senderPublicKey: typeof r.senderPublicKey < "u" ? On(r.senderPublicKey, ci) : void 0, receiverPublicKey: e == null ? void 0 : e.receiverPublicKey }); -} -function wE(t) { - const e = (t == null ? void 0 : t.type) || vE; - if (e === Oo) { - if (typeof (t == null ? void 0 : t.senderPublicKey) > "u") throw new Error("missing sender public key"); - if (typeof (t == null ? void 0 : t.receiverPublicKey) > "u") throw new Error("missing receiver public key"); - } - return { type: e, senderPublicKey: t == null ? void 0 : t.senderPublicKey, receiverPublicKey: t == null ? void 0 : t.receiverPublicKey }; -} -function u3(t) { - return t.type === Oo && typeof t.senderPublicKey == "string" && typeof t.receiverPublicKey == "string"; -} -function f3(t) { - return t.type === fh; -} -function uW(t) { - return new J8.ec("p256").keyFromPublic({ x: Buffer.from(t.x, "base64").toString("hex"), y: Buffer.from(t.y, "base64").toString("hex") }, "hex"); -} -function fW(t) { - let e = t.replace(/-/g, "+").replace(/_/g, "/"); - const r = e.length % 4; - return r > 0 && (e += "=".repeat(4 - r)), e; -} -function lW(t) { - return Buffer.from(fW(t), "base64"); -} -function hW(t, e) { - const [r, n, i] = t.split("."), s = lW(i); - if (s.length !== 64) throw new Error("Invalid signature length"); - const o = s.slice(0, 32).toString("hex"), a = s.slice(32, 64).toString("hex"), u = `${r}.${n}`, l = new ih.SHA256().update(Buffer.from(u)).digest(), d = uW(e), p = Buffer.from(l).toString("hex"); - if (!d.verify(p, { r: o, s: a })) throw new Error("Invalid signature"); - return O1(t).payload; -} -const dW = "irn"; -function H1(t) { - return (t == null ? void 0 : t.relay) || { protocol: dW }; -} -function Kf(t) { - const e = dz[t]; - if (typeof e > "u") throw new Error(`Relay Protocol not supported: ${t}`); - return e; -} -var pW = Object.defineProperty, gW = Object.defineProperties, mW = Object.getOwnPropertyDescriptors, l3 = Object.getOwnPropertySymbols, vW = Object.prototype.hasOwnProperty, bW = Object.prototype.propertyIsEnumerable, h3 = (t, e, r) => e in t ? pW(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, d3 = (t, e) => { - for (var r in e || (e = {})) vW.call(e, r) && h3(t, r, e[r]); - if (l3) for (var r of l3(e)) bW.call(e, r) && h3(t, r, e[r]); - return t; -}, yW = (t, e) => gW(t, mW(e)); -function wW(t, e = "-") { - const r = {}, n = "relay" + e; - return Object.keys(t).forEach((i) => { - if (i.startsWith(n)) { - const s = i.replace(n, ""), o = t[i]; - r[s] = o; - } - }), r; -} -function p3(t) { - if (!t.includes("wc:")) { - const u = dE(t); - u != null && u.includes("wc:") && (t = u); - } - t = t.includes("wc://") ? t.replace("wc://", "") : t, t = t.includes("wc:") ? t.replace("wc:", "") : t; - const e = t.indexOf(":"), r = t.indexOf("?") !== -1 ? t.indexOf("?") : void 0, n = t.substring(0, e), i = t.substring(e + 1, r).split("@"), s = typeof r < "u" ? t.substring(r) : "", o = Dl.parse(s), a = typeof o.methods == "string" ? o.methods.split(",") : void 0; - return { protocol: n, topic: xW(i[0]), version: parseInt(i[1], 10), symKey: o.symKey, relay: wW(o), methods: a, expiryTimestamp: o.expiryTimestamp ? parseInt(o.expiryTimestamp, 10) : void 0 }; -} -function xW(t) { - return t.startsWith("//") ? t.substring(2) : t; -} -function _W(t, e = "-") { - const r = "relay", n = {}; - return Object.keys(t).forEach((i) => { - const s = r + e + i; - t[i] && (n[s] = t[i]); - }), n; -} -function g3(t) { - return `${t.protocol}:${t.topic}@${t.version}?` + Dl.stringify(d3(yW(d3({ symKey: t.symKey }, _W(t.relay)), { expiryTimestamp: t.expiryTimestamp }), t.methods ? { methods: t.methods.join(",") } : {})); -} -function xd(t, e, r) { - return `${t}?wc_ev=${r}&topic=${e}`; -} -function Xu(t) { - const e = []; - return t.forEach((r) => { - const [n, i] = r.split(":"); - e.push(`${n}:${i}`); - }), e; -} -function EW(t) { - const e = []; - return Object.values(t).forEach((r) => { - e.push(...Xu(r.accounts)); - }), e; -} -function SW(t, e) { - const r = []; - return Object.values(t).forEach((n) => { - Xu(n.accounts).includes(e) && r.push(...n.methods); - }), r; -} -function AW(t, e) { - const r = []; - return Object.values(t).forEach((n) => { - Xu(n.accounts).includes(e) && r.push(...n.events); - }), r; -} -function _b(t) { - return t.includes(":"); -} -function Vf(t) { - return _b(t) ? t.split(":")[0] : t; -} -function PW(t) { - const e = {}; - return t == null || t.forEach((r) => { - const [n, i] = r.split(":"); - e[n] || (e[n] = { accounts: [], chains: [], events: [] }), e[n].accounts.push(r), e[n].chains.push(`${n}:${i}`); - }), e; -} -function m3(t, e) { - e = e.map((n) => n.replace("did:pkh:", "")); - const r = PW(e); - for (const [n, i] of Object.entries(r)) i.methods ? i.methods = jd(i.methods, t) : i.methods = t, i.events = ["chainChanged", "accountsChanged"]; - return r; -} -const MW = { INVALID_METHOD: { message: "Invalid method.", code: 1001 }, INVALID_EVENT: { message: "Invalid event.", code: 1002 }, INVALID_UPDATE_REQUEST: { message: "Invalid update request.", code: 1003 }, INVALID_EXTEND_REQUEST: { message: "Invalid extend request.", code: 1004 }, INVALID_SESSION_SETTLE_REQUEST: { message: "Invalid session settle request.", code: 1005 }, UNAUTHORIZED_METHOD: { message: "Unauthorized method.", code: 3001 }, UNAUTHORIZED_EVENT: { message: "Unauthorized event.", code: 3002 }, UNAUTHORIZED_UPDATE_REQUEST: { message: "Unauthorized update request.", code: 3003 }, UNAUTHORIZED_EXTEND_REQUEST: { message: "Unauthorized extend request.", code: 3004 }, USER_REJECTED: { message: "User rejected.", code: 5e3 }, USER_REJECTED_CHAINS: { message: "User rejected chains.", code: 5001 }, USER_REJECTED_METHODS: { message: "User rejected methods.", code: 5002 }, USER_REJECTED_EVENTS: { message: "User rejected events.", code: 5003 }, UNSUPPORTED_CHAINS: { message: "Unsupported chains.", code: 5100 }, UNSUPPORTED_METHODS: { message: "Unsupported methods.", code: 5101 }, UNSUPPORTED_EVENTS: { message: "Unsupported events.", code: 5102 }, UNSUPPORTED_ACCOUNTS: { message: "Unsupported accounts.", code: 5103 }, UNSUPPORTED_NAMESPACE_KEY: { message: "Unsupported namespace key.", code: 5104 }, USER_DISCONNECTED: { message: "User disconnected.", code: 6e3 }, SESSION_SETTLEMENT_FAILED: { message: "Session settlement failed.", code: 7e3 }, WC_METHOD_UNSUPPORTED: { message: "Unsupported wc_ method.", code: 10001 } }, IW = { NOT_INITIALIZED: { message: "Not initialized.", code: 1 }, NO_MATCHING_KEY: { message: "No matching key.", code: 2 }, RESTORE_WILL_OVERRIDE: { message: "Restore will override.", code: 3 }, RESUBSCRIBED: { message: "Resubscribed.", code: 4 }, MISSING_OR_INVALID: { message: "Missing or invalid.", code: 5 }, EXPIRED: { message: "Expired.", code: 6 }, UNKNOWN_TYPE: { message: "Unknown type.", code: 7 }, MISMATCHED_TOPIC: { message: "Mismatched topic.", code: 8 }, NON_CONFORMING_NAMESPACES: { message: "Non conforming namespaces.", code: 9 } }; -function ft(t, e) { - const { message: r, code: n } = IW[t]; - return { message: e ? `${r} ${e}` : r, code: n }; -} -function Or(t, e) { - const { message: r, code: n } = MW[t]; - return { message: e ? `${r} ${e}` : r, code: n }; -} -function _c(t, e) { - return !!Array.isArray(t); -} -function Ll(t) { - return Object.getPrototypeOf(t) === Object.prototype && Object.keys(t).length; -} -function vi(t) { - return typeof t > "u"; -} -function dn(t, e) { - return e && vi(t) ? !0 : typeof t == "string" && !!t.trim().length; -} -function Eb(t, e) { - return typeof t == "number" && !isNaN(t); -} -function CW(t, e) { - const { requiredNamespaces: r } = e, n = Object.keys(t.namespaces), i = Object.keys(r); - let s = !0; - return uc(i, n) ? (n.forEach((o) => { - const { accounts: a, methods: u, events: l } = t.namespaces[o], d = Xu(a), p = r[o]; - (!uc(oE(o, p), d) || !uc(p.methods, u) || !uc(p.events, l)) && (s = !1); - }), s) : !1; -} -function _0(t) { - return dn(t, !1) && t.includes(":") ? t.split(":").length === 2 : !1; -} -function TW(t) { - if (dn(t, !1) && t.includes(":")) { - const e = t.split(":"); - if (e.length === 3) { - const r = e[0] + ":" + e[1]; - return !!e[2] && _0(r); - } - } - return !1; -} -function RW(t) { - function e(r) { - try { - return typeof new URL(r) < "u"; - } catch { - return !1; - } - } - try { - if (dn(t, !1)) { - if (e(t)) return !0; - const r = dE(t); - return e(r); - } - } catch { - } - return !1; -} -function DW(t) { - var e; - return (e = t == null ? void 0 : t.proposer) == null ? void 0 : e.publicKey; -} -function OW(t) { - return t == null ? void 0 : t.topic; -} -function NW(t, e) { - let r = null; - return dn(t == null ? void 0 : t.publicKey, !1) || (r = ft("MISSING_OR_INVALID", `${e} controller public key should be a string`)), r; -} -function v3(t) { - let e = !0; - return _c(t) ? t.length && (e = t.every((r) => dn(r, !1))) : e = !1, e; -} -function LW(t, e, r) { - let n = null; - return _c(e) && e.length ? e.forEach((i) => { - n || _0(i) || (n = Or("UNSUPPORTED_CHAINS", `${r}, chain ${i} should be a string and conform to "namespace:chainId" format`)); - }) : _0(t) || (n = Or("UNSUPPORTED_CHAINS", `${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)), n; -} -function kW(t, e, r) { - let n = null; - return Object.entries(t).forEach(([i, s]) => { - if (n) return; - const o = LW(i, oE(i, s), `${e} ${r}`); - o && (n = o); - }), n; -} -function $W(t, e) { - let r = null; - return _c(t) ? t.forEach((n) => { - r || TW(n) || (r = Or("UNSUPPORTED_ACCOUNTS", `${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`)); - }) : r = Or("UNSUPPORTED_ACCOUNTS", `${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`), r; -} -function BW(t, e) { - let r = null; - return Object.values(t).forEach((n) => { - if (r) return; - const i = $W(n == null ? void 0 : n.accounts, `${e} namespace`); - i && (r = i); - }), r; -} -function FW(t, e) { - let r = null; - return v3(t == null ? void 0 : t.methods) ? v3(t == null ? void 0 : t.events) || (r = Or("UNSUPPORTED_EVENTS", `${e}, events should be an array of strings or empty array for no events`)) : r = Or("UNSUPPORTED_METHODS", `${e}, methods should be an array of strings or empty array for no methods`), r; -} -function xE(t, e) { - let r = null; - return Object.values(t).forEach((n) => { - if (r) return; - const i = FW(n, `${e}, namespace`); - i && (r = i); - }), r; -} -function jW(t, e, r) { - let n = null; - if (t && Ll(t)) { - const i = xE(t, e); - i && (n = i); - const s = kW(t, e, r); - s && (n = s); - } else n = ft("MISSING_OR_INVALID", `${e}, ${r} should be an object with data`); - return n; -} -function Pm(t, e) { - let r = null; - if (t && Ll(t)) { - const n = xE(t, e); - n && (r = n); - const i = BW(t, e); - i && (r = i); - } else r = ft("MISSING_OR_INVALID", `${e}, namespaces should be an object with data`); - return r; -} -function _E(t) { - return dn(t.protocol, !0); -} -function UW(t, e) { - let r = !1; - return t ? t && _c(t) && t.length && t.forEach((n) => { - r = _E(n); - }) : r = !0, r; -} -function qW(t) { - return typeof t == "number"; -} -function mi(t) { - return typeof t < "u" && typeof t !== null; -} -function zW(t) { - return !(!t || typeof t != "object" || !t.code || !Eb(t.code) || !t.message || !dn(t.message, !1)); -} -function WW(t) { - return !(vi(t) || !dn(t.method, !1)); -} -function HW(t) { - return !(vi(t) || vi(t.result) && vi(t.error) || !Eb(t.id) || !dn(t.jsonrpc, !1)); -} -function KW(t) { - return !(vi(t) || !dn(t.name, !1)); -} -function b3(t, e) { - return !(!_0(e) || !EW(t).includes(e)); -} -function VW(t, e, r) { - return dn(r, !1) ? SW(t, e).includes(r) : !1; -} -function GW(t, e, r) { - return dn(r, !1) ? AW(t, e).includes(r) : !1; -} -function y3(t, e, r) { - let n = null; - const i = YW(t), s = JW(e), o = Object.keys(i), a = Object.keys(s), u = w3(Object.keys(t)), l = w3(Object.keys(e)), d = u.filter((p) => !l.includes(p)); - return d.length && (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces keys don't satisfy requiredNamespaces. - Required: ${d.toString()} - Received: ${Object.keys(e).toString()}`)), uc(o, a) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces chains don't satisfy required namespaces. - Required: ${o.toString()} - Approved: ${a.toString()}`)), Object.keys(e).forEach((p) => { - if (!p.includes(":") || n) return; - const w = Xu(e[p].accounts); - w.includes(p) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces accounts don't satisfy namespace accounts for ${p} - Required: ${p} - Approved: ${w.toString()}`)); - }), o.forEach((p) => { - n || (uc(i[p].methods, s[p].methods) ? uc(i[p].events, s[p].events) || (n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces events don't satisfy namespace events for ${p}`)) : n = ft("NON_CONFORMING_NAMESPACES", `${r} namespaces methods don't satisfy namespace methods for ${p}`)); - }), n; -} -function YW(t) { - const e = {}; - return Object.keys(t).forEach((r) => { - var n; - r.includes(":") ? e[r] = t[r] : (n = t[r].chains) == null || n.forEach((i) => { - e[i] = { methods: t[r].methods, events: t[r].events }; - }); - }), e; -} -function w3(t) { - return [...new Set(t.map((e) => e.includes(":") ? e.split(":")[0] : e))]; -} -function JW(t) { - const e = {}; - return Object.keys(t).forEach((r) => { - if (r.includes(":")) e[r] = t[r]; - else { - const n = Xu(t[r].accounts); - n == null || n.forEach((i) => { - e[i] = { accounts: t[r].accounts.filter((s) => s.includes(`${i}:`)), methods: t[r].methods, events: t[r].events }; - }); - } - }), e; -} -function XW(t, e) { - return Eb(t) && t <= e.max && t >= e.min; -} -function x3() { - const t = ch(); - return new Promise((e) => { - switch (t) { - case Oi.browser: - e(ZW()); - break; - case Oi.reactNative: - e(QW()); - break; - case Oi.node: - e(eH()); - break; - default: - e(!0); - } - }); -} -function ZW() { - return ah() && (navigator == null ? void 0 : navigator.onLine); -} -async function QW() { - if (Ju() && typeof global < "u" && global != null && global.NetInfo) { - const t = await (global == null ? void 0 : global.NetInfo.fetch()); - return t == null ? void 0 : t.isConnected; - } - return !0; -} -function eH() { - return !0; -} -function tH(t) { - switch (ch()) { - case Oi.browser: - rH(t); - break; - case Oi.reactNative: - nH(t); - break; - } -} -function rH(t) { - !Ju() && ah() && (window.addEventListener("online", () => t(!0)), window.addEventListener("offline", () => t(!1))); -} -function nH(t) { - Ju() && typeof global < "u" && global != null && global.NetInfo && (global == null || global.NetInfo.addEventListener((e) => t(e == null ? void 0 : e.isConnected))); -} -const Mm = {}; -class Nf { - static get(e) { - return Mm[e]; - } - static set(e, r) { - Mm[e] = r; - } - static delete(e) { - delete Mm[e]; - } -} -const iH = "PARSE_ERROR", sH = "INVALID_REQUEST", oH = "METHOD_NOT_FOUND", aH = "INVALID_PARAMS", EE = "INTERNAL_ERROR", Sb = "SERVER_ERROR", cH = [-32700, -32600, -32601, -32602, -32603], Xf = { - [iH]: { code: -32700, message: "Parse error" }, - [sH]: { code: -32600, message: "Invalid Request" }, - [oH]: { code: -32601, message: "Method not found" }, - [aH]: { code: -32602, message: "Invalid params" }, - [EE]: { code: -32603, message: "Internal error" }, - [Sb]: { code: -32e3, message: "Server error" } -}, SE = Sb; -function uH(t) { - return cH.includes(t); -} -function _3(t) { - return Object.keys(Xf).includes(t) ? Xf[t] : Xf[SE]; -} -function fH(t) { - const e = Object.values(Xf).find((r) => r.code === t); - return e || Xf[SE]; -} -function AE(t, e, r) { - return t.message.includes("getaddrinfo ENOTFOUND") || t.message.includes("connect ECONNREFUSED") ? new Error(`Unavailable ${r} RPC url at ${e}`) : t; -} -var PE = {}, wo = {}, E3; -function lH() { - if (E3) return wo; - E3 = 1, Object.defineProperty(wo, "__esModule", { value: !0 }), wo.isBrowserCryptoAvailable = wo.getSubtleCrypto = wo.getBrowerCrypto = void 0; - function t() { - return (gn == null ? void 0 : gn.crypto) || (gn == null ? void 0 : gn.msCrypto) || {}; - } - wo.getBrowerCrypto = t; - function e() { - const n = t(); - return n.subtle || n.webkitSubtle; - } - wo.getSubtleCrypto = e; - function r() { - return !!t() && !!e(); - } - return wo.isBrowserCryptoAvailable = r, wo; -} -var xo = {}, S3; -function hH() { - if (S3) return xo; - S3 = 1, Object.defineProperty(xo, "__esModule", { value: !0 }), xo.isBrowser = xo.isNode = xo.isReactNative = void 0; - function t() { - return typeof document > "u" && typeof navigator < "u" && navigator.product === "ReactNative"; - } - xo.isReactNative = t; - function e() { - return typeof process < "u" && typeof process.versions < "u" && typeof process.versions.node < "u"; - } - xo.isNode = e; - function r() { - return !t() && !e(); - } - return xo.isBrowser = r, xo; -} -(function(t) { - Object.defineProperty(t, "__esModule", { value: !0 }); - const e = Yl; - e.__exportStar(lH(), t), e.__exportStar(hH(), t); -})(PE); -function la(t = 3) { - const e = Date.now() * Math.pow(10, t), r = Math.floor(Math.random() * Math.pow(10, t)); - return e + r; -} -function fc(t = 6) { - return BigInt(la(t)); -} -function ga(t, e, r) { - return { - id: r || la(), - jsonrpc: "2.0", - method: t, - params: e - }; -} -function mp(t, e) { - return { - id: t, - jsonrpc: "2.0", - result: e - }; -} -function vp(t, e, r) { - return { - id: t, - jsonrpc: "2.0", - error: dH(e) - }; -} -function dH(t, e) { - return typeof t > "u" ? _3(EE) : (typeof t == "string" && (t = Object.assign(Object.assign({}, _3(Sb)), { message: t })), uH(t.code) && (t = fH(t.code)), t); -} -let pH = class { -}, gH = class extends pH { - constructor() { - super(); - } -}, mH = class extends gH { - constructor(e) { - super(); - } -}; -const vH = "^https?:", bH = "^wss?:"; -function yH(t) { - const e = t.match(new RegExp(/^\w+:/, "gi")); - if (!(!e || !e.length)) - return e[0]; -} -function ME(t, e) { - const r = yH(t); - return typeof r > "u" ? !1 : new RegExp(e).test(r); -} -function A3(t) { - return ME(t, vH); -} -function P3(t) { - return ME(t, bH); -} -function wH(t) { - return new RegExp("wss?://localhost(:d{2,5})?").test(t); -} -function IE(t) { - return typeof t == "object" && "id" in t && "jsonrpc" in t && t.jsonrpc === "2.0"; -} -function Ab(t) { - return IE(t) && "method" in t; -} -function bp(t) { - return IE(t) && (zs(t) || es(t)); -} -function zs(t) { - return "result" in t; -} -function es(t) { - return "error" in t; -} -let us = class extends mH { - constructor(e) { - super(e), this.events = new is.EventEmitter(), this.hasRegisteredEventListeners = !1, this.connection = this.setConnection(e), this.connection.connected && this.registerEventListeners(); - } - async connect(e = this.connection) { - await this.open(e); - } - async disconnect() { - await this.close(); - } - on(e, r) { - this.events.on(e, r); - } - once(e, r) { - this.events.once(e, r); - } - off(e, r) { - this.events.off(e, r); - } - removeListener(e, r) { - this.events.removeListener(e, r); - } - async request(e, r) { - return this.requestStrict(ga(e.method, e.params || [], e.id || fc().toString()), r); - } - async requestStrict(e, r) { - return new Promise(async (n, i) => { - if (!this.connection.connected) try { - await this.open(); - } catch (s) { - i(s); - } - this.events.on(`${e.id}`, (s) => { - es(s) ? i(s.error) : n(s.result); - }); - try { - await this.connection.send(e, r); - } catch (s) { - i(s); - } - }); - } - setConnection(e = this.connection) { - return e; - } - onPayload(e) { - this.events.emit("payload", e), bp(e) ? this.events.emit(`${e.id}`, e) : this.events.emit("message", { type: e.method, data: e.params }); - } - onClose(e) { - e && e.code === 3e3 && this.events.emit("error", new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason ? `(${e.reason})` : ""}`)), this.events.emit("disconnect"); - } - async open(e = this.connection) { - this.connection === e && this.connection.connected || (this.connection.connected && this.close(), typeof e == "string" && (await this.connection.open(e), e = this.connection), this.connection = this.setConnection(e), await this.connection.open(), this.registerEventListeners(), this.events.emit("connect")); - } - async close() { - await this.connection.close(); - } - registerEventListeners() { - this.hasRegisteredEventListeners || (this.connection.on("payload", (e) => this.onPayload(e)), this.connection.on("close", (e) => this.onClose(e)), this.connection.on("error", (e) => this.events.emit("error", e)), this.connection.on("register_error", (e) => this.onClose()), this.hasRegisteredEventListeners = !0); - } -}; -const xH = () => typeof WebSocket < "u" ? WebSocket : typeof global < "u" && typeof global.WebSocket < "u" ? global.WebSocket : typeof window < "u" && typeof window.WebSocket < "u" ? window.WebSocket : typeof self < "u" && typeof self.WebSocket < "u" ? self.WebSocket : require("ws"), _H = () => typeof WebSocket < "u" || typeof global < "u" && typeof global.WebSocket < "u" || typeof window < "u" && typeof window.WebSocket < "u" || typeof self < "u" && typeof self.WebSocket < "u", M3 = (t) => t.split("?")[0], I3 = 10, EH = xH(); -let SH = class { - constructor(e) { - if (this.url = e, this.events = new is.EventEmitter(), this.registering = !1, !P3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); - this.url = e; - } - get connected() { - return typeof this.socket < "u"; - } - get connecting() { - return this.registering; - } - on(e, r) { - this.events.on(e, r); - } - once(e, r) { - this.events.once(e, r); - } - off(e, r) { - this.events.off(e, r); - } - removeListener(e, r) { - this.events.removeListener(e, r); - } - async open(e = this.url) { - await this.register(e); - } - async close() { - return new Promise((e, r) => { - if (typeof this.socket > "u") { - r(new Error("Connection already closed")); - return; - } - this.socket.onclose = (n) => { - this.onClose(n), e(); - }, this.socket.close(); - }); - } - async send(e) { - typeof this.socket > "u" && (this.socket = await this.register()); - try { - this.socket.send(jo(e)); - } catch (r) { - this.onError(e.id, r); - } - } - register(e = this.url) { - if (!P3(e)) throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`); - if (this.registering) { - const r = this.events.getMaxListeners(); - return (this.events.listenerCount("register_error") >= r || this.events.listenerCount("open") >= r) && this.events.setMaxListeners(r + 1), new Promise((n, i) => { - this.events.once("register_error", (s) => { - this.resetMaxListeners(), i(s); - }), this.events.once("open", () => { - if (this.resetMaxListeners(), typeof this.socket > "u") return i(new Error("WebSocket connection is missing or invalid")); - n(this.socket); - }); - }); - } - return this.url = e, this.registering = !0, new Promise((r, n) => { - const i = new URLSearchParams(e).get("origin"), s = PE.isReactNative() ? { headers: { origin: i } } : { rejectUnauthorized: !wH(e) }, o = new EH(e, [], s); - _H() ? o.onerror = (a) => { - const u = a; - n(this.emitError(u.error)); - } : o.on("error", (a) => { - n(this.emitError(a)); - }), o.onopen = () => { - this.onOpen(o), r(o); - }; - }); - } - onOpen(e) { - e.onmessage = (r) => this.onPayload(r), e.onclose = (r) => this.onClose(r), this.socket = e, this.registering = !1, this.events.emit("open"); - } - onClose(e) { - this.socket = void 0, this.registering = !1, this.events.emit("close", e); - } - onPayload(e) { - if (typeof e.data > "u") return; - const r = typeof e.data == "string" ? bc(e.data) : e.data; - this.events.emit("payload", r); - } - onError(e, r) { - const n = this.parseError(r), i = n.message || n.toString(), s = vp(e, i); - this.events.emit("payload", s); - } - parseError(e, r = this.url) { - return AE(e, M3(r), "WS"); - } - resetMaxListeners() { - this.events.getMaxListeners() > I3 && this.events.setMaxListeners(I3); - } - emitError(e) { - const r = this.parseError(new Error((e == null ? void 0 : e.message) || `WebSocket connection failed for host: ${M3(this.url)}`)); - return this.events.emit("register_error", r), r; - } -}; -var E0 = { exports: {} }; -E0.exports; -(function(t, e) { - var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", u = "[object Array]", l = "[object AsyncFunction]", d = "[object Boolean]", p = "[object Date]", w = "[object Error]", _ = "[object Function]", P = "[object GeneratorFunction]", O = "[object Map]", L = "[object Number]", B = "[object Null]", k = "[object Object]", W = "[object Promise]", U = "[object Proxy]", V = "[object RegExp]", Q = "[object Set]", R = "[object String]", K = "[object Symbol]", ge = "[object Undefined]", Ee = "[object WeakMap]", Y = "[object ArrayBuffer]", A = "[object DataView]", m = "[object Float32Array]", f = "[object Float64Array]", g = "[object Int8Array]", b = "[object Int16Array]", x = "[object Int32Array]", E = "[object Uint8Array]", S = "[object Uint8ClampedArray]", v = "[object Uint16Array]", M = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, F = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, D = {}; - D[m] = D[f] = D[g] = D[b] = D[x] = D[E] = D[S] = D[v] = D[M] = !0, D[a] = D[u] = D[Y] = D[d] = D[A] = D[p] = D[w] = D[_] = D[O] = D[L] = D[k] = D[V] = D[Q] = D[R] = D[Ee] = !1; - var oe = typeof gn == "object" && gn && gn.Object === Object && gn, Z = typeof self == "object" && self && self.Object === Object && self, J = oe || Z || Function("return this")(), ee = e && !e.nodeType && e, T = ee && !0 && t && !t.nodeType && t, X = T && T.exports === ee, re = X && oe.process, pe = function() { - try { - return re && re.binding && re.binding("util"); - } catch { - } - }(), ie = pe && pe.isTypedArray; - function ue(ae, ye) { - for (var Ge = -1, Pt = ae == null ? 0 : ae.length, jr = 0, nr = []; ++Ge < Pt; ) { - var Kr = ae[Ge]; - ye(Kr, Ge, ae) && (nr[jr++] = Kr); - } - return nr; - } - function ve(ae, ye) { - for (var Ge = -1, Pt = ye.length, jr = ae.length; ++Ge < Pt; ) - ae[jr + Ge] = ye[Ge]; - return ae; - } - function Pe(ae, ye) { - for (var Ge = -1, Pt = ae == null ? 0 : ae.length; ++Ge < Pt; ) - if (ye(ae[Ge], Ge, ae)) - return !0; - return !1; - } - function De(ae, ye) { - for (var Ge = -1, Pt = Array(ae); ++Ge < ae; ) - Pt[Ge] = ye(Ge); - return Pt; - } - function Ce(ae) { - return function(ye) { - return ae(ye); - }; - } - function $e(ae, ye) { - return ae.has(ye); - } - function Me(ae, ye) { - return ae == null ? void 0 : ae[ye]; - } - function Ne(ae) { - var ye = -1, Ge = Array(ae.size); - return ae.forEach(function(Pt, jr) { - Ge[++ye] = [jr, Pt]; - }), Ge; - } - function Ke(ae, ye) { - return function(Ge) { - return ae(ye(Ge)); - }; - } - function Le(ae) { - var ye = -1, Ge = Array(ae.size); - return ae.forEach(function(Pt) { - Ge[++ye] = Pt; - }), Ge; - } - var qe = Array.prototype, ze = Function.prototype, _e = Object.prototype, Ze = J["__core-js_shared__"], at = ze.toString, ke = _e.hasOwnProperty, Qe = function() { - var ae = /[^.]+$/.exec(Ze && Ze.keys && Ze.keys.IE_PROTO || ""); - return ae ? "Symbol(src)_1." + ae : ""; - }(), tt = _e.toString, Ye = RegExp( - "^" + at.call(ke).replace(I, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" - ), dt = X ? J.Buffer : void 0, lt = J.Symbol, ct = J.Uint8Array, qt = _e.propertyIsEnumerable, Jt = qe.splice, Et = lt ? lt.toStringTag : void 0, er = Object.getOwnPropertySymbols, Xt = dt ? dt.isBuffer : void 0, Dt = Ke(Object.keys, Object), kt = wr(J, "DataView"), Ct = wr(J, "Map"), mt = wr(J, "Promise"), Rt = wr(J, "Set"), Nt = wr(J, "WeakMap"), bt = wr(Object, "create"), $t = ao(kt), Ft = ao(Ct), rt = ao(mt), Bt = ao(Rt), $ = ao(Nt), q = lt ? lt.prototype : void 0, H = q ? q.valueOf : void 0; - function C(ae) { - var ye = -1, Ge = ae == null ? 0 : ae.length; - for (this.clear(); ++ye < Ge; ) { - var Pt = ae[ye]; - this.set(Pt[0], Pt[1]); - } - } - function G() { - this.__data__ = bt ? bt(null) : {}, this.size = 0; - } - function j(ae) { - var ye = this.has(ae) && delete this.__data__[ae]; - return this.size -= ye ? 1 : 0, ye; - } - function se(ae) { - var ye = this.__data__; - if (bt) { - var Ge = ye[ae]; - return Ge === n ? void 0 : Ge; - } - return ke.call(ye, ae) ? ye[ae] : void 0; - } - function de(ae) { - var ye = this.__data__; - return bt ? ye[ae] !== void 0 : ke.call(ye, ae); - } - function xe(ae, ye) { - var Ge = this.__data__; - return this.size += this.has(ae) ? 0 : 1, Ge[ae] = bt && ye === void 0 ? n : ye, this; - } - C.prototype.clear = G, C.prototype.delete = j, C.prototype.get = se, C.prototype.has = de, C.prototype.set = xe; - function Te(ae) { - var ye = -1, Ge = ae == null ? 0 : ae.length; - for (this.clear(); ++ye < Ge; ) { - var Pt = ae[ye]; - this.set(Pt[0], Pt[1]); - } - } - function Re() { - this.__data__ = [], this.size = 0; - } - function nt(ae) { - var ye = this.__data__, Ge = Je(ye, ae); - if (Ge < 0) - return !1; - var Pt = ye.length - 1; - return Ge == Pt ? ye.pop() : Jt.call(ye, Ge, 1), --this.size, !0; - } - function je(ae) { - var ye = this.__data__, Ge = Je(ye, ae); - return Ge < 0 ? void 0 : ye[Ge][1]; - } - function pt(ae) { - return Je(this.__data__, ae) > -1; - } - function it(ae, ye) { - var Ge = this.__data__, Pt = Je(Ge, ae); - return Pt < 0 ? (++this.size, Ge.push([ae, ye])) : Ge[Pt][1] = ye, this; - } - Te.prototype.clear = Re, Te.prototype.delete = nt, Te.prototype.get = je, Te.prototype.has = pt, Te.prototype.set = it; - function et(ae) { - var ye = -1, Ge = ae == null ? 0 : ae.length; - for (this.clear(); ++ye < Ge; ) { - var Pt = ae[ye]; - this.set(Pt[0], Pt[1]); - } - } - function St() { - this.size = 0, this.__data__ = { - hash: new C(), - map: new (Ct || Te)(), - string: new C() - }; - } - function Tt(ae) { - var ye = mr(this, ae).delete(ae); - return this.size -= ye ? 1 : 0, ye; - } - function At(ae) { - return mr(this, ae).get(ae); - } - function _t(ae) { - return mr(this, ae).has(ae); - } - function ht(ae, ye) { - var Ge = mr(this, ae), Pt = Ge.size; - return Ge.set(ae, ye), this.size += Ge.size == Pt ? 0 : 1, this; - } - et.prototype.clear = St, et.prototype.delete = Tt, et.prototype.get = At, et.prototype.has = _t, et.prototype.set = ht; - function xt(ae) { - var ye = -1, Ge = ae == null ? 0 : ae.length; - for (this.__data__ = new et(); ++ye < Ge; ) - this.add(ae[ye]); - } - function st(ae) { - return this.__data__.set(ae, n), this; - } - function yt(ae) { - return this.__data__.has(ae); - } - xt.prototype.add = xt.prototype.push = st, xt.prototype.has = yt; - function ut(ae) { - var ye = this.__data__ = new Te(ae); - this.size = ye.size; - } - function ot() { - this.__data__ = new Te(), this.size = 0; - } - function Se(ae) { - var ye = this.__data__, Ge = ye.delete(ae); - return this.size = ye.size, Ge; - } - function Ae(ae) { - return this.__data__.get(ae); - } - function Ve(ae) { - return this.__data__.has(ae); - } - function Fe(ae, ye) { - var Ge = this.__data__; - if (Ge instanceof Te) { - var Pt = Ge.__data__; - if (!Ct || Pt.length < r - 1) - return Pt.push([ae, ye]), this.size = ++Ge.size, this; - Ge = this.__data__ = new et(Pt); - } - return Ge.set(ae, ye), this.size = Ge.size, this; - } - ut.prototype.clear = ot, ut.prototype.delete = Se, ut.prototype.get = Ae, ut.prototype.has = Ve, ut.prototype.set = Fe; - function Ue(ae, ye) { - var Ge = $c(ae), Pt = !Ge && _h(ae), jr = !Ge && !Pt && of(ae), nr = !Ge && !Pt && !jr && Ah(ae), Kr = Ge || Pt || jr || nr, vn = Kr ? De(ae.length, String) : [], Er = vn.length; - for (var Ur in ae) - ke.call(ae, Ur) && !(Kr && // Safari 9 has enumerable `arguments.length` in strict mode. - (Ur == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. - jr && (Ur == "offset" || Ur == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. - nr && (Ur == "buffer" || Ur == "byteLength" || Ur == "byteOffset") || // Skip index properties. - nn(Ur, Er))) && vn.push(Ur); - return vn; - } - function Je(ae, ye) { - for (var Ge = ae.length; Ge--; ) - if (xh(ae[Ge][0], ye)) - return Ge; - return -1; - } - function Lt(ae, ye, Ge) { - var Pt = ye(ae); - return $c(ae) ? Pt : ve(Pt, Ge(ae)); - } - function zt(ae) { - return ae == null ? ae === void 0 ? ge : B : Et && Et in Object(ae) ? $r(ae) : Hp(ae); - } - function Zt(ae) { - return Ba(ae) && zt(ae) == a; - } - function Wt(ae, ye, Ge, Pt, jr) { - return ae === ye ? !0 : ae == null || ye == null || !Ba(ae) && !Ba(ye) ? ae !== ae && ye !== ye : he(ae, ye, Ge, Pt, Wt, jr); - } - function he(ae, ye, Ge, Pt, jr, nr) { - var Kr = $c(ae), vn = $c(ye), Er = Kr ? u : Ir(ae), Ur = vn ? u : Ir(ye); - Er = Er == a ? k : Er, Ur = Ur == a ? k : Ur; - var an = Er == k, fi = Ur == k, bn = Er == Ur; - if (bn && of(ae)) { - if (!of(ye)) - return !1; - Kr = !0, an = !1; - } - if (bn && !an) - return nr || (nr = new ut()), Kr || Ah(ae) ? Qt(ae, ye, Ge, Pt, jr, nr) : gr(ae, ye, Er, Ge, Pt, jr, nr); - if (!(Ge & i)) { - var Vr = an && ke.call(ae, "__wrapped__"), ri = fi && ke.call(ye, "__wrapped__"); - if (Vr || ri) { - var hs = Vr ? ae.value() : ae, Ui = ri ? ye.value() : ye; - return nr || (nr = new ut()), jr(hs, Ui, Ge, Pt, nr); - } - } - return bn ? (nr || (nr = new ut()), lr(ae, ye, Ge, Pt, jr, nr)) : !1; - } - function rr(ae) { - if (!Sh(ae) || on(ae)) - return !1; - var ye = Bc(ae) ? Ye : F; - return ye.test(ao(ae)); - } - function dr(ae) { - return Ba(ae) && Eh(ae.length) && !!D[zt(ae)]; - } - function pr(ae) { - if (!wh(ae)) - return Dt(ae); - var ye = []; - for (var Ge in Object(ae)) - ke.call(ae, Ge) && Ge != "constructor" && ye.push(Ge); - return ye; - } - function Qt(ae, ye, Ge, Pt, jr, nr) { - var Kr = Ge & i, vn = ae.length, Er = ye.length; - if (vn != Er && !(Kr && Er > vn)) - return !1; - var Ur = nr.get(ae); - if (Ur && nr.get(ye)) - return Ur == ye; - var an = -1, fi = !0, bn = Ge & s ? new xt() : void 0; - for (nr.set(ae, ye), nr.set(ye, ae); ++an < vn; ) { - var Vr = ae[an], ri = ye[an]; - if (Pt) - var hs = Kr ? Pt(ri, Vr, an, ye, ae, nr) : Pt(Vr, ri, an, ae, ye, nr); - if (hs !== void 0) { - if (hs) - continue; - fi = !1; - break; - } - if (bn) { - if (!Pe(ye, function(Ui, Ds) { - if (!$e(bn, Ds) && (Vr === Ui || jr(Vr, Ui, Ge, Pt, nr))) - return bn.push(Ds); - })) { - fi = !1; - break; - } - } else if (!(Vr === ri || jr(Vr, ri, Ge, Pt, nr))) { - fi = !1; - break; - } - } - return nr.delete(ae), nr.delete(ye), fi; - } - function gr(ae, ye, Ge, Pt, jr, nr, Kr) { - switch (Ge) { - case A: - if (ae.byteLength != ye.byteLength || ae.byteOffset != ye.byteOffset) - return !1; - ae = ae.buffer, ye = ye.buffer; - case Y: - return !(ae.byteLength != ye.byteLength || !nr(new ct(ae), new ct(ye))); - case d: - case p: - case L: - return xh(+ae, +ye); - case w: - return ae.name == ye.name && ae.message == ye.message; - case V: - case R: - return ae == ye + ""; - case O: - var vn = Ne; - case Q: - var Er = Pt & i; - if (vn || (vn = Le), ae.size != ye.size && !Er) - return !1; - var Ur = Kr.get(ae); - if (Ur) - return Ur == ye; - Pt |= s, Kr.set(ae, ye); - var an = Qt(vn(ae), vn(ye), Pt, jr, nr, Kr); - return Kr.delete(ae), an; - case K: - if (H) - return H.call(ae) == H.call(ye); - } - return !1; - } - function lr(ae, ye, Ge, Pt, jr, nr) { - var Kr = Ge & i, vn = Rr(ae), Er = vn.length, Ur = Rr(ye), an = Ur.length; - if (Er != an && !Kr) - return !1; - for (var fi = Er; fi--; ) { - var bn = vn[fi]; - if (!(Kr ? bn in ye : ke.call(ye, bn))) - return !1; - } - var Vr = nr.get(ae); - if (Vr && nr.get(ye)) - return Vr == ye; - var ri = !0; - nr.set(ae, ye), nr.set(ye, ae); - for (var hs = Kr; ++fi < Er; ) { - bn = vn[fi]; - var Ui = ae[bn], Ds = ye[bn]; - if (Pt) - var af = Kr ? Pt(Ds, Ui, bn, ye, ae, nr) : Pt(Ui, Ds, bn, ae, ye, nr); - if (!(af === void 0 ? Ui === Ds || jr(Ui, Ds, Ge, Pt, nr) : af)) { - ri = !1; - break; - } - hs || (hs = bn == "constructor"); - } - if (ri && !hs) { - var Fa = ae.constructor, Pn = ye.constructor; - Fa != Pn && "constructor" in ae && "constructor" in ye && !(typeof Fa == "function" && Fa instanceof Fa && typeof Pn == "function" && Pn instanceof Pn) && (ri = !1); - } - return nr.delete(ae), nr.delete(ye), ri; - } - function Rr(ae) { - return Lt(ae, Gp, Br); - } - function mr(ae, ye) { - var Ge = ae.__data__; - return sn(ye) ? Ge[typeof ye == "string" ? "string" : "hash"] : Ge.map; - } - function wr(ae, ye) { - var Ge = Me(ae, ye); - return rr(Ge) ? Ge : void 0; - } - function $r(ae) { - var ye = ke.call(ae, Et), Ge = ae[Et]; - try { - ae[Et] = void 0; - var Pt = !0; - } catch { - } - var jr = tt.call(ae); - return Pt && (ye ? ae[Et] = Ge : delete ae[Et]), jr; - } - var Br = er ? function(ae) { - return ae == null ? [] : (ae = Object(ae), ue(er(ae), function(ye) { - return qt.call(ae, ye); - })); - } : Fr, Ir = zt; - (kt && Ir(new kt(new ArrayBuffer(1))) != A || Ct && Ir(new Ct()) != O || mt && Ir(mt.resolve()) != W || Rt && Ir(new Rt()) != Q || Nt && Ir(new Nt()) != Ee) && (Ir = function(ae) { - var ye = zt(ae), Ge = ye == k ? ae.constructor : void 0, Pt = Ge ? ao(Ge) : ""; - if (Pt) - switch (Pt) { - case $t: - return A; - case Ft: - return O; - case rt: - return W; - case Bt: - return Q; - case $: - return Ee; - } - return ye; - }); - function nn(ae, ye) { - return ye = ye ?? o, !!ye && (typeof ae == "number" || ce.test(ae)) && ae > -1 && ae % 1 == 0 && ae < ye; - } - function sn(ae) { - var ye = typeof ae; - return ye == "string" || ye == "number" || ye == "symbol" || ye == "boolean" ? ae !== "__proto__" : ae === null; - } - function on(ae) { - return !!Qe && Qe in ae; - } - function wh(ae) { - var ye = ae && ae.constructor, Ge = typeof ye == "function" && ye.prototype || _e; - return ae === Ge; - } - function Hp(ae) { - return tt.call(ae); - } - function ao(ae) { - if (ae != null) { - try { - return at.call(ae); - } catch { - } - try { - return ae + ""; - } catch { - } - } - return ""; - } - function xh(ae, ye) { - return ae === ye || ae !== ae && ye !== ye; - } - var _h = Zt(/* @__PURE__ */ function() { - return arguments; - }()) ? Zt : function(ae) { - return Ba(ae) && ke.call(ae, "callee") && !qt.call(ae, "callee"); - }, $c = Array.isArray; - function Kp(ae) { - return ae != null && Eh(ae.length) && !Bc(ae); - } - var of = Xt || Dr; - function Vp(ae, ye) { - return Wt(ae, ye); - } - function Bc(ae) { - if (!Sh(ae)) - return !1; - var ye = zt(ae); - return ye == _ || ye == P || ye == l || ye == U; - } - function Eh(ae) { - return typeof ae == "number" && ae > -1 && ae % 1 == 0 && ae <= o; - } - function Sh(ae) { - var ye = typeof ae; - return ae != null && (ye == "object" || ye == "function"); - } - function Ba(ae) { - return ae != null && typeof ae == "object"; - } - var Ah = ie ? Ce(ie) : dr; - function Gp(ae) { - return Kp(ae) ? Ue(ae) : pr(ae); - } - function Fr() { - return []; - } - function Dr() { - return !1; - } - t.exports = Vp; -})(E0, E0.exports); -var AH = E0.exports; -const PH = /* @__PURE__ */ ns(AH), CE = "wc", TE = 2, RE = "core", ro = `${CE}@2:${RE}:`, MH = { logger: "error" }, IH = { database: ":memory:" }, CH = "crypto", C3 = "client_ed25519_seed", TH = vt.ONE_DAY, RH = "keychain", DH = "0.3", OH = "messages", NH = "0.3", LH = vt.SIX_HOURS, kH = "publisher", DE = "irn", $H = "error", OE = "wss://relay.walletconnect.org", BH = "relayer", ai = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", publish: "relayer_publish" }, FH = "_subscription", Yi = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, jH = 0.1, K1 = "2.17.2", zr = { link_mode: "link_mode", relay: "relay" }, UH = "0.3", qH = "WALLETCONNECT_CLIENT_ID", T3 = "WALLETCONNECT_LINK_MODE_APPS", Ws = { created: "subscription_created", deleted: "subscription_deleted", sync: "subscription_sync", resubscribed: "subscription_resubscribed" }, zH = "subscription", WH = "0.3", HH = vt.FIVE_SECONDS * 1e3, KH = "pairing", VH = "0.3", Lf = { wc_pairingDelete: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1e3 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1001 } }, wc_pairingPing: { req: { ttl: vt.THIRTY_SECONDS, prompt: !1, tag: 1002 }, res: { ttl: vt.THIRTY_SECONDS, prompt: !1, tag: 1003 } }, unregistered_method: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 0 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 0 } } }, ic = { create: "pairing_create", expire: "pairing_expire", delete: "pairing_delete", ping: "pairing_ping" }, ys = { created: "history_created", updated: "history_updated", deleted: "history_deleted", sync: "history_sync" }, GH = "history", YH = "0.3", JH = "expirer", Zi = { created: "expirer_created", deleted: "expirer_deleted", expired: "expirer_expired", sync: "expirer_sync" }, XH = "0.3", ZH = "verify-api", QH = "https://verify.walletconnect.com", NE = "https://verify.walletconnect.org", Zf = NE, eK = `${Zf}/v3`, tK = [QH, NE], rK = "echo", nK = "https://echo.walletconnect.com", qs = { pairing_started: "pairing_started", pairing_uri_validation_success: "pairing_uri_validation_success", pairing_uri_not_expired: "pairing_uri_not_expired", store_new_pairing: "store_new_pairing", subscribing_pairing_topic: "subscribing_pairing_topic", subscribe_pairing_topic_success: "subscribe_pairing_topic_success", existing_pairing: "existing_pairing", pairing_not_expired: "pairing_not_expired", emit_inactive_pairing: "emit_inactive_pairing", emit_session_proposal: "emit_session_proposal" }, So = { no_internet_connection: "no_internet_connection", malformed_pairing_uri: "malformed_pairing_uri", active_pairing_already_exists: "active_pairing_already_exists", subscribe_pairing_topic_failure: "subscribe_pairing_topic_failure", pairing_expired: "pairing_expired", proposal_listener_not_found: "proposal_listener_not_found" }, ws = { session_approve_started: "session_approve_started", session_namespaces_validation_success: "session_namespaces_validation_success", subscribing_session_topic: "subscribing_session_topic", subscribe_session_topic_success: "subscribe_session_topic_success", publishing_session_approve: "publishing_session_approve", session_approve_publish_success: "session_approve_publish_success", store_session: "store_session", publishing_session_settle: "publishing_session_settle", session_settle_publish_success: "session_settle_publish_success" }, Xa = { no_internet_connection: "no_internet_connection", proposal_expired: "proposal_expired", subscribe_session_topic_failure: "subscribe_session_topic_failure", session_approve_publish_failure: "session_approve_publish_failure", session_settle_publish_failure: "session_settle_publish_failure", session_approve_namespace_validation_failure: "session_approve_namespace_validation_failure", proposal_not_found: "proposal_not_found" }, Za = { authenticated_session_approve_started: "authenticated_session_approve_started", create_authenticated_session_topic: "create_authenticated_session_topic", cacaos_verified: "cacaos_verified", store_authenticated_session: "store_authenticated_session", subscribing_authenticated_session_topic: "subscribing_authenticated_session_topic", subscribe_authenticated_session_topic_success: "subscribe_authenticated_session_topic_success", publishing_authenticated_session_approve: "publishing_authenticated_session_approve" }, kf = { no_internet_connection: "no_internet_connection", invalid_cacao: "invalid_cacao", subscribe_authenticated_session_topic_failure: "subscribe_authenticated_session_topic_failure", authenticated_session_approve_publish_failure: "authenticated_session_approve_publish_failure", authenticated_session_pending_request_not_found: "authenticated_session_pending_request_not_found" }, iK = 0.1, sK = "event-client", oK = 86400, aK = "https://pulse.walletconnect.org/batch"; -function cK(t, e) { - if (t.length >= 255) throw new TypeError("Alphabet too long"); - for (var r = new Uint8Array(256), n = 0; n < r.length; n++) r[n] = 255; - for (var i = 0; i < t.length; i++) { - var s = t.charAt(i), o = s.charCodeAt(0); - if (r[o] !== 255) throw new TypeError(s + " is ambiguous"); - r[o] = i; - } - var a = t.length, u = t.charAt(0), l = Math.log(a) / Math.log(256), d = Math.log(256) / Math.log(a); - function p(P) { - if (P instanceof Uint8Array || (ArrayBuffer.isView(P) ? P = new Uint8Array(P.buffer, P.byteOffset, P.byteLength) : Array.isArray(P) && (P = Uint8Array.from(P))), !(P instanceof Uint8Array)) throw new TypeError("Expected Uint8Array"); - if (P.length === 0) return ""; - for (var O = 0, L = 0, B = 0, k = P.length; B !== k && P[B] === 0; ) B++, O++; - for (var W = (k - B) * d + 1 >>> 0, U = new Uint8Array(W); B !== k; ) { - for (var V = P[B], Q = 0, R = W - 1; (V !== 0 || Q < L) && R !== -1; R--, Q++) V += 256 * U[R] >>> 0, U[R] = V % a >>> 0, V = V / a >>> 0; - if (V !== 0) throw new Error("Non-zero carry"); - L = Q, B++; - } - for (var K = W - L; K !== W && U[K] === 0; ) K++; - for (var ge = u.repeat(O); K < W; ++K) ge += t.charAt(U[K]); - return ge; - } - function w(P) { - if (typeof P != "string") throw new TypeError("Expected String"); - if (P.length === 0) return new Uint8Array(); - var O = 0; - if (P[O] !== " ") { - for (var L = 0, B = 0; P[O] === u; ) L++, O++; - for (var k = (P.length - O) * l + 1 >>> 0, W = new Uint8Array(k); P[O]; ) { - var U = r[P.charCodeAt(O)]; - if (U === 255) return; - for (var V = 0, Q = k - 1; (U !== 0 || V < B) && Q !== -1; Q--, V++) U += a * W[Q] >>> 0, W[Q] = U % 256 >>> 0, U = U / 256 >>> 0; - if (U !== 0) throw new Error("Non-zero carry"); - B = V, O++; - } - if (P[O] !== " ") { - for (var R = k - B; R !== k && W[R] === 0; ) R++; - for (var K = new Uint8Array(L + (k - R)), ge = L; R !== k; ) K[ge++] = W[R++]; - return K; - } - } - } - function _(P) { - var O = w(P); - if (O) return O; - throw new Error(`Non-${e} character`); - } - return { encode: p, decodeUnsafe: w, decode: _ }; -} -var uK = cK, fK = uK; -const LE = (t) => { - if (t instanceof Uint8Array && t.constructor.name === "Uint8Array") return t; - if (t instanceof ArrayBuffer) return new Uint8Array(t); - if (ArrayBuffer.isView(t)) return new Uint8Array(t.buffer, t.byteOffset, t.byteLength); - throw new Error("Unknown type, must be binary type"); -}, lK = (t) => new TextEncoder().encode(t), hK = (t) => new TextDecoder().decode(t); -class dK { - constructor(e, r, n) { - this.name = e, this.prefix = r, this.baseEncode = n; - } - encode(e) { - if (e instanceof Uint8Array) return `${this.prefix}${this.baseEncode(e)}`; - throw Error("Unknown type, must be binary type"); - } -} -class pK { - constructor(e, r, n) { - if (this.name = e, this.prefix = r, r.codePointAt(0) === void 0) throw new Error("Invalid prefix character"); - this.prefixCodePoint = r.codePointAt(0), this.baseDecode = n; - } - decode(e) { - if (typeof e == "string") { - if (e.codePointAt(0) !== this.prefixCodePoint) throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`); - return this.baseDecode(e.slice(this.prefix.length)); - } else throw Error("Can only multibase decode strings"); - } - or(e) { - return kE(this, e); - } -} -class gK { - constructor(e) { - this.decoders = e; - } - or(e) { - return kE(this, e); - } - decode(e) { - const r = e[0], n = this.decoders[r]; - if (n) return n.decode(e); - throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`); - } -} -const kE = (t, e) => new gK({ ...t.decoders || { [t.prefix]: t }, ...e.decoders || { [e.prefix]: e } }); -class mK { - constructor(e, r, n, i) { - this.name = e, this.prefix = r, this.baseEncode = n, this.baseDecode = i, this.encoder = new dK(e, r, n), this.decoder = new pK(e, r, i); - } - encode(e) { - return this.encoder.encode(e); - } - decode(e) { - return this.decoder.decode(e); - } -} -const yp = ({ name: t, prefix: e, encode: r, decode: n }) => new mK(t, e, r, n), lh = ({ prefix: t, name: e, alphabet: r }) => { - const { encode: n, decode: i } = fK(r, e); - return yp({ prefix: t, name: e, encode: n, decode: (s) => LE(i(s)) }); -}, vK = (t, e, r, n) => { - const i = {}; - for (let d = 0; d < e.length; ++d) i[e[d]] = d; - let s = t.length; - for (; t[s - 1] === "="; ) --s; - const o = new Uint8Array(s * r / 8 | 0); - let a = 0, u = 0, l = 0; - for (let d = 0; d < s; ++d) { - const p = i[t[d]]; - if (p === void 0) throw new SyntaxError(`Non-${n} character`); - u = u << r | p, a += r, a >= 8 && (a -= 8, o[l++] = 255 & u >> a); - } - if (a >= r || 255 & u << 8 - a) throw new SyntaxError("Unexpected end of data"); - return o; -}, bK = (t, e, r) => { - const n = e[e.length - 1] === "=", i = (1 << r) - 1; - let s = "", o = 0, a = 0; - for (let u = 0; u < t.length; ++u) for (a = a << 8 | t[u], o += 8; o > r; ) o -= r, s += e[i & a >> o]; - if (o && (s += e[i & a << r - o]), n) for (; s.length * r & 7; ) s += "="; - return s; -}, Hn = ({ name: t, prefix: e, bitsPerChar: r, alphabet: n }) => yp({ prefix: e, name: t, encode(i) { - return bK(i, n, r); -}, decode(i) { - return vK(i, n, r, t); -} }), yK = yp({ prefix: "\0", name: "identity", encode: (t) => hK(t), decode: (t) => lK(t) }); -var wK = Object.freeze({ __proto__: null, identity: yK }); -const xK = Hn({ prefix: "0", name: "base2", alphabet: "01", bitsPerChar: 1 }); -var _K = Object.freeze({ __proto__: null, base2: xK }); -const EK = Hn({ prefix: "7", name: "base8", alphabet: "01234567", bitsPerChar: 3 }); -var SK = Object.freeze({ __proto__: null, base8: EK }); -const AK = lh({ prefix: "9", name: "base10", alphabet: "0123456789" }); -var PK = Object.freeze({ __proto__: null, base10: AK }); -const MK = Hn({ prefix: "f", name: "base16", alphabet: "0123456789abcdef", bitsPerChar: 4 }), IK = Hn({ prefix: "F", name: "base16upper", alphabet: "0123456789ABCDEF", bitsPerChar: 4 }); -var CK = Object.freeze({ __proto__: null, base16: MK, base16upper: IK }); -const TK = Hn({ prefix: "b", name: "base32", alphabet: "abcdefghijklmnopqrstuvwxyz234567", bitsPerChar: 5 }), RK = Hn({ prefix: "B", name: "base32upper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", bitsPerChar: 5 }), DK = Hn({ prefix: "c", name: "base32pad", alphabet: "abcdefghijklmnopqrstuvwxyz234567=", bitsPerChar: 5 }), OK = Hn({ prefix: "C", name: "base32padupper", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", bitsPerChar: 5 }), NK = Hn({ prefix: "v", name: "base32hex", alphabet: "0123456789abcdefghijklmnopqrstuv", bitsPerChar: 5 }), LK = Hn({ prefix: "V", name: "base32hexupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", bitsPerChar: 5 }), kK = Hn({ prefix: "t", name: "base32hexpad", alphabet: "0123456789abcdefghijklmnopqrstuv=", bitsPerChar: 5 }), $K = Hn({ prefix: "T", name: "base32hexpadupper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=", bitsPerChar: 5 }), BK = Hn({ prefix: "h", name: "base32z", alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769", bitsPerChar: 5 }); -var FK = Object.freeze({ __proto__: null, base32: TK, base32upper: RK, base32pad: DK, base32padupper: OK, base32hex: NK, base32hexupper: LK, base32hexpad: kK, base32hexpadupper: $K, base32z: BK }); -const jK = lh({ prefix: "k", name: "base36", alphabet: "0123456789abcdefghijklmnopqrstuvwxyz" }), UK = lh({ prefix: "K", name: "base36upper", alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" }); -var qK = Object.freeze({ __proto__: null, base36: jK, base36upper: UK }); -const zK = lh({ name: "base58btc", prefix: "z", alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" }), WK = lh({ name: "base58flickr", prefix: "Z", alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" }); -var HK = Object.freeze({ __proto__: null, base58btc: zK, base58flickr: WK }); -const KK = Hn({ prefix: "m", name: "base64", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", bitsPerChar: 6 }), VK = Hn({ prefix: "M", name: "base64pad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", bitsPerChar: 6 }), GK = Hn({ prefix: "u", name: "base64url", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bitsPerChar: 6 }), YK = Hn({ prefix: "U", name: "base64urlpad", alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=", bitsPerChar: 6 }); -var JK = Object.freeze({ __proto__: null, base64: KK, base64pad: VK, base64url: GK, base64urlpad: YK }); -const $E = Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"), XK = $E.reduce((t, e, r) => (t[r] = e, t), []), ZK = $E.reduce((t, e, r) => (t[e.codePointAt(0)] = r, t), []); -function QK(t) { - return t.reduce((e, r) => (e += XK[r], e), ""); -} -function eV(t) { - const e = []; - for (const r of t) { - const n = ZK[r.codePointAt(0)]; - if (n === void 0) throw new Error(`Non-base256emoji character: ${r}`); - e.push(n); - } - return new Uint8Array(e); -} -const tV = yp({ prefix: "🚀", name: "base256emoji", encode: QK, decode: eV }); -var rV = Object.freeze({ __proto__: null, base256emoji: tV }), nV = BE, R3 = 128, iV = 127, sV = ~iV, oV = Math.pow(2, 31); -function BE(t, e, r) { - e = e || [], r = r || 0; - for (var n = r; t >= oV; ) e[r++] = t & 255 | R3, t /= 128; - for (; t & sV; ) e[r++] = t & 255 | R3, t >>>= 7; - return e[r] = t | 0, BE.bytes = r - n + 1, e; -} -var aV = V1, cV = 128, D3 = 127; -function V1(t, n) { - var r = 0, n = n || 0, i = 0, s = n, o, a = t.length; - do { - if (s >= a) throw V1.bytes = 0, new RangeError("Could not decode varint"); - o = t[s++], r += i < 28 ? (o & D3) << i : (o & D3) * Math.pow(2, i), i += 7; - } while (o >= cV); - return V1.bytes = s - n, r; -} -var uV = Math.pow(2, 7), fV = Math.pow(2, 14), lV = Math.pow(2, 21), hV = Math.pow(2, 28), dV = Math.pow(2, 35), pV = Math.pow(2, 42), gV = Math.pow(2, 49), mV = Math.pow(2, 56), vV = Math.pow(2, 63), bV = function(t) { - return t < uV ? 1 : t < fV ? 2 : t < lV ? 3 : t < hV ? 4 : t < dV ? 5 : t < pV ? 6 : t < gV ? 7 : t < mV ? 8 : t < vV ? 9 : 10; -}, yV = { encode: nV, decode: aV, encodingLength: bV }, FE = yV; -const O3 = (t, e, r = 0) => (FE.encode(t, e, r), e), N3 = (t) => FE.encodingLength(t), G1 = (t, e) => { - const r = e.byteLength, n = N3(t), i = n + N3(r), s = new Uint8Array(i + r); - return O3(t, s, 0), O3(r, s, n), s.set(e, i), new wV(t, r, e, s); -}; -class wV { - constructor(e, r, n, i) { - this.code = e, this.size = r, this.digest = n, this.bytes = i; - } -} -const jE = ({ name: t, code: e, encode: r }) => new xV(t, e, r); -class xV { - constructor(e, r, n) { - this.name = e, this.code = r, this.encode = n; - } - digest(e) { - if (e instanceof Uint8Array) { - const r = this.encode(e); - return r instanceof Uint8Array ? G1(this.code, r) : r.then((n) => G1(this.code, n)); - } else throw Error("Unknown type, must be binary type"); - } -} -const UE = (t) => async (e) => new Uint8Array(await crypto.subtle.digest(t, e)), _V = jE({ name: "sha2-256", code: 18, encode: UE("SHA-256") }), EV = jE({ name: "sha2-512", code: 19, encode: UE("SHA-512") }); -var SV = Object.freeze({ __proto__: null, sha256: _V, sha512: EV }); -const qE = 0, AV = "identity", zE = LE, PV = (t) => G1(qE, zE(t)), MV = { code: qE, name: AV, encode: zE, digest: PV }; -var IV = Object.freeze({ __proto__: null, identity: MV }); -new TextEncoder(), new TextDecoder(); -const L3 = { ...wK, ..._K, ...SK, ...PK, ...CK, ...FK, ...qK, ...HK, ...JK, ...rV }; -({ ...SV, ...IV }); -function CV(t = 0) { - return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t); -} -function WE(t, e, r, n) { - return { name: t, prefix: e, encoder: { name: t, prefix: e, encode: r }, decoder: { decode: n } }; -} -const k3 = WE("utf8", "u", (t) => "u" + new TextDecoder("utf8").decode(t), (t) => new TextEncoder().encode(t.substring(1))), Im = WE("ascii", "a", (t) => { - let e = "a"; - for (let r = 0; r < t.length; r++) e += String.fromCharCode(t[r]); - return e; -}, (t) => { - t = t.substring(1); - const e = CV(t.length); - for (let r = 0; r < t.length; r++) e[r] = t.charCodeAt(r); - return e; -}), TV = { utf8: k3, "utf-8": k3, hex: L3.base16, latin1: Im, ascii: Im, binary: Im, ...L3 }; -function RV(t, e = "utf8") { - const r = TV[e]; - if (!r) throw new Error(`Unsupported encoding "${e}"`); - return (e === "utf8" || e === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null ? globalThis.Buffer.from(t, "utf8") : r.decoder.decode(`${r.prefix}${t}`); -} -let DV = class { - constructor(e, r) { - this.core = e, this.logger = r, this.keychain = /* @__PURE__ */ new Map(), this.name = RH, this.version = DH, this.initialized = !1, this.storagePrefix = ro, this.init = async () => { - if (!this.initialized) { - const n = await this.getKeyChain(); - typeof n < "u" && (this.keychain = n), this.initialized = !0; - } - }, this.has = (n) => (this.isInitialized(), this.keychain.has(n)), this.set = async (n, i) => { - this.isInitialized(), this.keychain.set(n, i), await this.persist(); - }, this.get = (n) => { - this.isInitialized(); - const i = this.keychain.get(n); - if (typeof i > "u") { - const { message: s } = ft("NO_MATCHING_KEY", `${this.name}: ${n}`); - throw new Error(s); - } - return i; - }, this.del = async (n) => { - this.isInitialized(), this.keychain.delete(n), await this.persist(); - }, this.core = e, this.logger = ui(r, this.name); - } - get context() { - return Pi(this.logger); - } - get storageKey() { - return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; - } - async setKeyChain(e) { - await this.core.storage.setItem(this.storageKey, uE(e)); - } - async getKeyChain() { - const e = await this.core.storage.getItem(this.storageKey); - return typeof e < "u" ? fE(e) : void 0; - } - async persist() { - await this.setKeyChain(this.keychain); - } - isInitialized() { - if (!this.initialized) { - const { message: e } = ft("NOT_INITIALIZED", this.name); - throw new Error(e); - } - } -}, OV = class { - constructor(e, r, n) { - this.core = e, this.logger = r, this.name = CH, this.randomSessionIdentifier = W1(), this.initialized = !1, this.init = async () => { - this.initialized || (await this.keychain.init(), this.initialized = !0); - }, this.hasKeys = (i) => (this.isInitialized(), this.keychain.has(i)), this.getClientId = async () => { - this.isInitialized(); - const i = await this.getClientSeed(), s = xx(i); - return g8(s.publicKey); - }, this.generateKeyPair = () => { - this.isInitialized(); - const i = rW(); - return this.setPrivateKey(i.publicKey, i.privateKey); - }, this.signJWT = async (i) => { - this.isInitialized(); - const s = await this.getClientSeed(), o = xx(s), a = this.randomSessionIdentifier; - return await AF(a, i, TH, o); - }, this.generateSharedKey = (i, s, o) => { - this.isInitialized(); - const a = this.getPrivateKey(i), u = nW(a, s); - return this.setSymKey(u, o); - }, this.setSymKey = async (i, s) => { - this.isInitialized(); - const o = s || qd(i); - return await this.keychain.set(o, i), o; - }, this.deleteKeyPair = async (i) => { - this.isInitialized(), await this.keychain.del(i); - }, this.deleteSymKey = async (i) => { - this.isInitialized(), await this.keychain.del(i); - }, this.encode = async (i, s, o) => { - this.isInitialized(); - const a = wE(o), u = jo(s); - if (f3(a)) return sW(u, o == null ? void 0 : o.encoding); - if (u3(a)) { - const w = a.senderPublicKey, _ = a.receiverPublicKey; - i = await this.generateSharedKey(w, _); - } - const l = this.getSymKey(i), { type: d, senderPublicKey: p } = a; - return iW({ type: d, symKey: l, message: u, senderPublicKey: p, encoding: o == null ? void 0 : o.encoding }); - }, this.decode = async (i, s, o) => { - this.isInitialized(); - const a = cW(s, o); - if (f3(a)) { - const u = aW(s, o == null ? void 0 : o.encoding); - return bc(u); - } - if (u3(a)) { - const u = a.receiverPublicKey, l = a.senderPublicKey; - i = await this.generateSharedKey(u, l); - } - try { - const u = this.getSymKey(i), l = oW({ symKey: u, encoded: s, encoding: o == null ? void 0 : o.encoding }); - return bc(l); - } catch (u) { - this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`), this.logger.error(u); - } - }, this.getPayloadType = (i, s = pa) => { - const o = Nl({ encoded: i, encoding: s }); - return xc(o.type); - }, this.getPayloadSenderPublicKey = (i, s = pa) => { - const o = Nl({ encoded: i, encoding: s }); - return o.senderPublicKey ? On(o.senderPublicKey, ci) : void 0; - }, this.core = e, this.logger = ui(r, this.name), this.keychain = n || new DV(this.core, this.logger); - } - get context() { - return Pi(this.logger); - } - async setPrivateKey(e, r) { - return await this.keychain.set(e, r), e; - } - getPrivateKey(e) { - return this.keychain.get(e); - } - async getClientSeed() { - let e = ""; - try { - e = this.keychain.get(C3); - } catch { - e = W1(), await this.keychain.set(C3, e); - } - return RV(e, "base16"); - } - getSymKey(e) { - return this.keychain.get(e); - } - isInitialized() { - if (!this.initialized) { - const { message: e } = ft("NOT_INITIALIZED", this.name); - throw new Error(e); - } - } -}; -class NV extends R$ { - constructor(e, r) { - super(e, r), this.logger = e, this.core = r, this.messages = /* @__PURE__ */ new Map(), this.name = OH, this.version = NH, this.initialized = !1, this.storagePrefix = ro, this.init = async () => { - if (!this.initialized) { - this.logger.trace("Initialized"); - try { - const n = await this.getRelayerMessages(); - typeof n < "u" && (this.messages = n), this.logger.debug(`Successfully Restored records for ${this.name}`), this.logger.trace({ type: "method", method: "restore", size: this.messages.size }); - } catch (n) { - this.logger.debug(`Failed to Restore records for ${this.name}`), this.logger.error(n); - } finally { - this.initialized = !0; - } - } - }, this.set = async (n, i) => { - this.isInitialized(); - const s = Ao(i); - let o = this.messages.get(n); - return typeof o > "u" && (o = {}), typeof o[s] < "u" || (o[s] = i, this.messages.set(n, o), await this.persist()), s; - }, this.get = (n) => { - this.isInitialized(); - let i = this.messages.get(n); - return typeof i > "u" && (i = {}), i; - }, this.has = (n, i) => { - this.isInitialized(); - const s = this.get(n), o = Ao(i); - return typeof s[o] < "u"; - }, this.del = async (n) => { - this.isInitialized(), this.messages.delete(n), await this.persist(); - }, this.logger = ui(e, this.name), this.core = r; - } - get context() { - return Pi(this.logger); - } - get storageKey() { - return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; - } - async setRelayerMessages(e) { - await this.core.storage.setItem(this.storageKey, uE(e)); - } - async getRelayerMessages() { - const e = await this.core.storage.getItem(this.storageKey); - return typeof e < "u" ? fE(e) : void 0; - } - async persist() { - await this.setRelayerMessages(this.messages); - } - isInitialized() { - if (!this.initialized) { - const { message: e } = ft("NOT_INITIALIZED", this.name); - throw new Error(e); - } - } -} -class LV extends D$ { - constructor(e, r) { - super(e, r), this.relayer = e, this.logger = r, this.events = new is.EventEmitter(), this.name = kH, this.queue = /* @__PURE__ */ new Map(), this.publishTimeout = vt.toMiliseconds(vt.ONE_MINUTE), this.failedPublishTimeout = vt.toMiliseconds(vt.ONE_SECOND), this.needsTransportRestart = !1, this.publish = async (n, i, s) => { - var o; - this.logger.debug("Publishing Payload"), this.logger.trace({ type: "method", method: "publish", params: { topic: n, message: i, opts: s } }); - const a = (s == null ? void 0 : s.ttl) || LH, u = H1(s), l = (s == null ? void 0 : s.prompt) || !1, d = (s == null ? void 0 : s.tag) || 0, p = (s == null ? void 0 : s.id) || fc().toString(), w = { topic: n, message: i, opts: { ttl: a, relay: u, prompt: l, tag: d, id: p, attestation: s == null ? void 0 : s.attestation } }, _ = `Failed to publish payload, please try again. id:${p} tag:${d}`, P = Date.now(); - let O, L = 1; - try { - for (; O === void 0; ) { - if (Date.now() - P > this.publishTimeout) throw new Error(_); - this.logger.trace({ id: p, attempts: L }, `publisher.publish - attempt ${L}`), O = await await Su(this.rpcPublish(n, i, a, u, l, d, p, s == null ? void 0 : s.attestation).catch((B) => this.logger.warn(B)), this.publishTimeout, _), L++, O || await new Promise((B) => setTimeout(B, this.failedPublishTimeout)); - } - this.relayer.events.emit(ai.publish, w), this.logger.debug("Successfully Published Payload"), this.logger.trace({ type: "method", method: "publish", params: { id: p, topic: n, message: i, opts: s } }); - } catch (B) { - if (this.logger.debug("Failed to Publish Payload"), this.logger.error(B), (o = s == null ? void 0 : s.internal) != null && o.throwOnFailedPublish) throw B; - this.queue.set(p, w); - } - }, this.on = (n, i) => { - this.events.on(n, i); - }, this.once = (n, i) => { - this.events.once(n, i); - }, this.off = (n, i) => { - this.events.off(n, i); - }, this.removeListener = (n, i) => { - this.events.removeListener(n, i); - }, this.relayer = e, this.logger = ui(r, this.name), this.registerEventListeners(); - } - get context() { - return Pi(this.logger); - } - rpcPublish(e, r, n, i, s, o, a, u) { - var l, d, p, w; - const _ = { method: Kf(i.protocol).publish, params: { topic: e, message: r, ttl: n, prompt: s, tag: o, attestation: u }, id: a }; - return vi((l = _.params) == null ? void 0 : l.prompt) && ((d = _.params) == null || delete d.prompt), vi((p = _.params) == null ? void 0 : p.tag) && ((w = _.params) == null || delete w.tag), this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "message", direction: "outgoing", request: _ }), this.relayer.request(_); - } - removeRequestFromQueue(e) { - this.queue.delete(e); - } - checkQueue() { - this.queue.forEach(async (e) => { - const { topic: r, message: n, opts: i } = e; - await this.publish(r, n, i); - }); - } - registerEventListeners() { - this.relayer.core.heartbeat.on(Uu.pulse, () => { - if (this.needsTransportRestart) { - this.needsTransportRestart = !1, this.relayer.events.emit(ai.connection_stalled); - return; - } - this.checkQueue(); - }), this.relayer.on(ai.message_ack, (e) => { - this.removeRequestFromQueue(e.id.toString()); - }); - } -} -class kV { - constructor() { - this.map = /* @__PURE__ */ new Map(), this.set = (e, r) => { - const n = this.get(e); - this.exists(e, r) || this.map.set(e, [...n, r]); - }, this.get = (e) => this.map.get(e) || [], this.exists = (e, r) => this.get(e).includes(r), this.delete = (e, r) => { - if (typeof r > "u") { - this.map.delete(e); - return; - } - if (!this.map.has(e)) return; - const n = this.get(e); - if (!this.exists(e, r)) return; - const i = n.filter((s) => s !== r); - if (!i.length) { - this.map.delete(e); - return; - } - this.map.set(e, i); - }, this.clear = () => { - this.map.clear(); - }; - } - get topics() { - return Array.from(this.map.keys()); - } -} -var $V = Object.defineProperty, BV = Object.defineProperties, FV = Object.getOwnPropertyDescriptors, $3 = Object.getOwnPropertySymbols, jV = Object.prototype.hasOwnProperty, UV = Object.prototype.propertyIsEnumerable, B3 = (t, e, r) => e in t ? $V(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, $f = (t, e) => { - for (var r in e || (e = {})) jV.call(e, r) && B3(t, r, e[r]); - if ($3) for (var r of $3(e)) UV.call(e, r) && B3(t, r, e[r]); - return t; -}, Cm = (t, e) => BV(t, FV(e)); -class qV extends L$ { - constructor(e, r) { - super(e, r), this.relayer = e, this.logger = r, this.subscriptions = /* @__PURE__ */ new Map(), this.topicMap = new kV(), this.events = new is.EventEmitter(), this.name = zH, this.version = WH, this.pending = /* @__PURE__ */ new Map(), this.cached = [], this.initialized = !1, this.pendingSubscriptionWatchLabel = "pending_sub_watch_label", this.pollingInterval = 20, this.storagePrefix = ro, this.subscribeTimeout = vt.toMiliseconds(vt.ONE_MINUTE), this.restartInProgress = !1, this.batchSubscribeTopicsLimit = 500, this.pendingBatchMessages = [], this.init = async () => { - this.initialized || (this.logger.trace("Initialized"), this.registerEventListeners(), this.clientId = await this.relayer.core.crypto.getClientId(), await this.restore()), this.initialized = !0; - }, this.subscribe = async (n, i) => { - this.isInitialized(), this.logger.debug("Subscribing Topic"), this.logger.trace({ type: "method", method: "subscribe", params: { topic: n, opts: i } }); - try { - const s = H1(i), o = { topic: n, relay: s, transportType: i == null ? void 0 : i.transportType }; - this.pending.set(n, o); - const a = await this.rpcSubscribe(n, s, i); - return typeof a == "string" && (this.onSubscribe(a, o), this.logger.debug("Successfully Subscribed Topic"), this.logger.trace({ type: "method", method: "subscribe", params: { topic: n, opts: i } })), a; - } catch (s) { - throw this.logger.debug("Failed to Subscribe Topic"), this.logger.error(s), s; - } - }, this.unsubscribe = async (n, i) => { - await this.restartToComplete(), this.isInitialized(), typeof (i == null ? void 0 : i.id) < "u" ? await this.unsubscribeById(n, i.id, i) : await this.unsubscribeByTopic(n, i); - }, this.isSubscribed = async (n) => { - if (this.topics.includes(n)) return !0; - const i = `${this.pendingSubscriptionWatchLabel}_${n}`; - return await new Promise((s, o) => { - const a = new vt.Watch(); - a.start(i); - const u = setInterval(() => { - !this.pending.has(n) && this.topics.includes(n) && (clearInterval(u), a.stop(i), s(!0)), a.elapsed(i) >= HH && (clearInterval(u), a.stop(i), o(new Error("Subscription resolution timeout"))); - }, this.pollingInterval); - }).catch(() => !1); - }, this.on = (n, i) => { - this.events.on(n, i); - }, this.once = (n, i) => { - this.events.once(n, i); - }, this.off = (n, i) => { - this.events.off(n, i); - }, this.removeListener = (n, i) => { - this.events.removeListener(n, i); - }, this.start = async () => { - await this.onConnect(); - }, this.stop = async () => { - await this.onDisconnect(); - }, this.restart = async () => { - this.restartInProgress = !0, await this.restore(), await this.reset(), this.restartInProgress = !1; - }, this.relayer = e, this.logger = ui(r, this.name), this.clientId = ""; - } - get context() { - return Pi(this.logger); - } - get storageKey() { - return this.storagePrefix + this.version + this.relayer.core.customStoragePrefix + "//" + this.name; - } - get length() { - return this.subscriptions.size; - } - get ids() { - return Array.from(this.subscriptions.keys()); - } - get values() { - return Array.from(this.subscriptions.values()); - } - get topics() { - return this.topicMap.topics; - } - hasSubscription(e, r) { - let n = !1; - try { - n = this.getSubscription(e).topic === r; - } catch { - } - return n; - } - onEnable() { - this.cached = [], this.initialized = !0; - } - onDisable() { - this.cached = this.values, this.subscriptions.clear(), this.topicMap.clear(); - } - async unsubscribeByTopic(e, r) { - const n = this.topicMap.get(e); - await Promise.all(n.map(async (i) => await this.unsubscribeById(e, i, r))); - } - async unsubscribeById(e, r, n) { - this.logger.debug("Unsubscribing Topic"), this.logger.trace({ type: "method", method: "unsubscribe", params: { topic: e, id: r, opts: n } }); - try { - const i = H1(n); - await this.rpcUnsubscribe(e, r, i); - const s = Or("USER_DISCONNECTED", `${this.name}, ${e}`); - await this.onUnsubscribe(e, r, s), this.logger.debug("Successfully Unsubscribed Topic"), this.logger.trace({ type: "method", method: "unsubscribe", params: { topic: e, id: r, opts: n } }); - } catch (i) { - throw this.logger.debug("Failed to Unsubscribe Topic"), this.logger.error(i), i; - } - } - async rpcSubscribe(e, r, n) { - var i; - (n == null ? void 0 : n.transportType) === zr.relay && await this.restartToComplete(); - const s = { method: Kf(r.protocol).subscribe, params: { topic: e } }; - this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: s }); - const o = (i = n == null ? void 0 : n.internal) == null ? void 0 : i.throwOnFailedPublish; - try { - const a = Ao(e + this.clientId); - if ((n == null ? void 0 : n.transportType) === zr.link_mode) return setTimeout(() => { - (this.relayer.connected || this.relayer.connecting) && this.relayer.request(s).catch((l) => this.logger.warn(l)); - }, vt.toMiliseconds(vt.ONE_SECOND)), a; - const u = await Su(this.relayer.request(s).catch((l) => this.logger.warn(l)), this.subscribeTimeout, `Subscribing to ${e} failed, please try again`); - if (!u && o) throw new Error(`Subscribing to ${e} failed, please try again`); - return u ? a : null; - } catch (a) { - if (this.logger.debug("Outgoing Relay Subscribe Payload stalled"), this.relayer.events.emit(ai.connection_stalled), o) throw a; - } - return null; - } - async rpcBatchSubscribe(e) { - if (!e.length) return; - const r = e[0].relay, n = { method: Kf(r.protocol).batchSubscribe, params: { topics: e.map((i) => i.topic) } }; - this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: n }); - try { - return await await Su(this.relayer.request(n).catch((i) => this.logger.warn(i)), this.subscribeTimeout); - } catch { - this.relayer.events.emit(ai.connection_stalled); - } - } - async rpcBatchFetchMessages(e) { - if (!e.length) return; - const r = e[0].relay, n = { method: Kf(r.protocol).batchFetchMessages, params: { topics: e.map((s) => s.topic) } }; - this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: n }); - let i; - try { - i = await await Su(this.relayer.request(n).catch((s) => this.logger.warn(s)), this.subscribeTimeout); - } catch { - this.relayer.events.emit(ai.connection_stalled); - } - return i; - } - rpcUnsubscribe(e, r, n) { - const i = { method: Kf(n.protocol).unsubscribe, params: { topic: e, id: r } }; - return this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "payload", direction: "outgoing", request: i }), this.relayer.request(i); - } - onSubscribe(e, r) { - this.setSubscription(e, Cm($f({}, r), { id: e })), this.pending.delete(r.topic); - } - onBatchSubscribe(e) { - e.length && e.forEach((r) => { - this.setSubscription(r.id, $f({}, r)), this.pending.delete(r.topic); - }); - } - async onUnsubscribe(e, r, n) { - this.events.removeAllListeners(r), this.hasSubscription(r, e) && this.deleteSubscription(r, n), await this.relayer.messages.del(e); - } - async setRelayerSubscriptions(e) { - await this.relayer.core.storage.setItem(this.storageKey, e); - } - async getRelayerSubscriptions() { - return await this.relayer.core.storage.getItem(this.storageKey); - } - setSubscription(e, r) { - this.logger.debug("Setting subscription"), this.logger.trace({ type: "method", method: "setSubscription", id: e, subscription: r }), this.addSubscription(e, r); - } - addSubscription(e, r) { - this.subscriptions.set(e, $f({}, r)), this.topicMap.set(r.topic, e), this.events.emit(Ws.created, r); - } - getSubscription(e) { - this.logger.debug("Getting subscription"), this.logger.trace({ type: "method", method: "getSubscription", id: e }); - const r = this.subscriptions.get(e); - if (!r) { - const { message: n } = ft("NO_MATCHING_KEY", `${this.name}: ${e}`); - throw new Error(n); - } - return r; - } - deleteSubscription(e, r) { - this.logger.debug("Deleting subscription"), this.logger.trace({ type: "method", method: "deleteSubscription", id: e, reason: r }); - const n = this.getSubscription(e); - this.subscriptions.delete(e), this.topicMap.delete(n.topic, e), this.events.emit(Ws.deleted, Cm($f({}, n), { reason: r })); - } - async persist() { - await this.setRelayerSubscriptions(this.values), this.events.emit(Ws.sync); - } - async reset() { - if (this.cached.length) { - const e = Math.ceil(this.cached.length / this.batchSubscribeTopicsLimit); - for (let r = 0; r < e; r++) { - const n = this.cached.splice(0, this.batchSubscribeTopicsLimit); - await this.batchFetchMessages(n), await this.batchSubscribe(n); - } - } - this.events.emit(Ws.resubscribed); - } - async restore() { - try { - const e = await this.getRelayerSubscriptions(); - if (typeof e > "u" || !e.length) return; - if (this.subscriptions.size) { - const { message: r } = ft("RESTORE_WILL_OVERRIDE", this.name); - throw this.logger.error(r), this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`), new Error(r); - } - this.cached = e, this.logger.debug(`Successfully Restored subscriptions for ${this.name}`), this.logger.trace({ type: "method", method: "restore", subscriptions: this.values }); - } catch (e) { - this.logger.debug(`Failed to Restore subscriptions for ${this.name}`), this.logger.error(e); - } - } - async batchSubscribe(e) { - if (!e.length) return; - const r = await this.rpcBatchSubscribe(e); - _c(r) && this.onBatchSubscribe(r.map((n, i) => Cm($f({}, e[i]), { id: n }))); - } - async batchFetchMessages(e) { - if (!e.length) return; - this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`); - const r = await this.rpcBatchFetchMessages(e); - r && r.messages && (this.pendingBatchMessages = this.pendingBatchMessages.concat(r.messages)); - } - async onConnect() { - await this.restart(), this.onEnable(); - } - onDisconnect() { - this.onDisable(); - } - async checkPending() { - if (!this.initialized || !this.relayer.connected) return; - const e = []; - this.pending.forEach((r) => { - e.push(r); - }), await this.batchSubscribe(e), this.pendingBatchMessages.length && (await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages), this.pendingBatchMessages = []); - } - registerEventListeners() { - this.relayer.core.heartbeat.on(Uu.pulse, async () => { - await this.checkPending(); - }), this.events.on(Ws.created, async (e) => { - const r = Ws.created; - this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), await this.persist(); - }), this.events.on(Ws.deleted, async (e) => { - const r = Ws.deleted; - this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), await this.persist(); - }); - } - isInitialized() { - if (!this.initialized) { - const { message: e } = ft("NOT_INITIALIZED", this.name); - throw new Error(e); - } - } - async restartToComplete() { - !this.relayer.connected && !this.relayer.connecting && await this.relayer.transportOpen(), this.restartInProgress && await new Promise((e) => { - const r = setInterval(() => { - this.restartInProgress || (clearInterval(r), e()); - }, this.pollingInterval); - }); - } -} -var zV = Object.defineProperty, F3 = Object.getOwnPropertySymbols, WV = Object.prototype.hasOwnProperty, HV = Object.prototype.propertyIsEnumerable, j3 = (t, e, r) => e in t ? zV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, U3 = (t, e) => { - for (var r in e || (e = {})) WV.call(e, r) && j3(t, r, e[r]); - if (F3) for (var r of F3(e)) HV.call(e, r) && j3(t, r, e[r]); - return t; -}; -class KV extends O$ { - constructor(e) { - super(e), this.protocol = "wc", this.version = 2, this.events = new is.EventEmitter(), this.name = BH, this.transportExplicitlyClosed = !1, this.initialized = !1, this.connectionAttemptInProgress = !1, this.connectionStatusPollingInterval = 20, this.staleConnectionErrors = ["socket hang up", "stalled", "interrupted"], this.hasExperiencedNetworkDisruption = !1, this.requestsInFlight = /* @__PURE__ */ new Map(), this.heartBeatTimeout = vt.toMiliseconds(vt.THIRTY_SECONDS + vt.ONE_SECOND), this.request = async (r) => { - var n, i; - this.logger.debug("Publishing Request Payload"); - const s = r.id || fc().toString(); - await this.toEstablishConnection(); - try { - const o = this.provider.request(r); - this.requestsInFlight.set(s, { promise: o, request: r }), this.logger.trace({ id: s, method: r.method, topic: (n = r.params) == null ? void 0 : n.topic }, "relayer.request - attempt to publish..."); - const a = await new Promise(async (u, l) => { - const d = () => { - l(new Error(`relayer.request - publish interrupted, id: ${s}`)); - }; - this.provider.on(Yi.disconnect, d); - const p = await o; - this.provider.off(Yi.disconnect, d), u(p); - }); - return this.logger.trace({ id: s, method: r.method, topic: (i = r.params) == null ? void 0 : i.topic }, "relayer.request - published"), a; - } catch (o) { - throw this.logger.debug(`Failed to Publish Request: ${s}`), o; - } finally { - this.requestsInFlight.delete(s); - } - }, this.resetPingTimeout = () => { - if (w0()) try { - clearTimeout(this.pingTimeout), this.pingTimeout = setTimeout(() => { - var r, n, i; - (i = (n = (r = this.provider) == null ? void 0 : r.connection) == null ? void 0 : n.socket) == null || i.terminate(); - }, this.heartBeatTimeout); - } catch (r) { - this.logger.warn(r); - } - }, this.onPayloadHandler = (r) => { - this.onProviderPayload(r), this.resetPingTimeout(); - }, this.onConnectHandler = () => { - this.logger.trace("relayer connected"), this.startPingTimeout(), this.events.emit(ai.connect); - }, this.onDisconnectHandler = () => { - this.logger.trace("relayer disconnected"), this.onProviderDisconnect(); - }, this.onProviderErrorHandler = (r) => { - this.logger.error(r), this.events.emit(ai.error, r), this.logger.info("Fatal socket error received, closing transport"), this.transportClose(); - }, this.registerProviderListeners = () => { - this.provider.on(Yi.payload, this.onPayloadHandler), this.provider.on(Yi.connect, this.onConnectHandler), this.provider.on(Yi.disconnect, this.onDisconnectHandler), this.provider.on(Yi.error, this.onProviderErrorHandler); - }, this.core = e.core, this.logger = typeof e.logger < "u" && typeof e.logger != "string" ? ui(e.logger, this.name) : Xl(X0({ level: e.logger || $H })), this.messages = new NV(this.logger, e.core), this.subscriber = new qV(this, this.logger), this.publisher = new LV(this, this.logger), this.relayUrl = (e == null ? void 0 : e.relayUrl) || OE, this.projectId = e.projectId, this.bundleId = wz(), this.provider = {}; - } - async init() { - if (this.logger.trace("Initialized"), this.registerEventListeners(), await Promise.all([this.messages.init(), this.subscriber.init()]), this.initialized = !0, this.subscriber.cached.length > 0) try { - await this.transportOpen(); - } catch (e) { - this.logger.warn(e); - } - } - get context() { - return Pi(this.logger); - } - get connected() { - var e, r, n; - return ((n = (r = (e = this.provider) == null ? void 0 : e.connection) == null ? void 0 : r.socket) == null ? void 0 : n.readyState) === 1; - } - get connecting() { - var e, r, n; - return ((n = (r = (e = this.provider) == null ? void 0 : e.connection) == null ? void 0 : r.socket) == null ? void 0 : n.readyState) === 0; - } - async publish(e, r, n) { - this.isInitialized(), await this.publisher.publish(e, r, n), await this.recordMessageEvent({ topic: e, message: r, publishedAt: Date.now(), transportType: zr.relay }); - } - async subscribe(e, r) { - var n, i, s; - this.isInitialized(), (r == null ? void 0 : r.transportType) === "relay" && await this.toEstablishConnection(); - const o = typeof ((n = r == null ? void 0 : r.internal) == null ? void 0 : n.throwOnFailedPublish) > "u" ? !0 : (i = r == null ? void 0 : r.internal) == null ? void 0 : i.throwOnFailedPublish; - let a = ((s = this.subscriber.topicMap.get(e)) == null ? void 0 : s[0]) || "", u; - const l = (d) => { - d.topic === e && (this.subscriber.off(Ws.created, l), u()); - }; - return await Promise.all([new Promise((d) => { - u = d, this.subscriber.on(Ws.created, l); - }), new Promise(async (d, p) => { - a = await this.subscriber.subscribe(e, U3({ internal: { throwOnFailedPublish: o } }, r)).catch((w) => { - o && p(w); - }) || a, d(); - })]), a; - } - async unsubscribe(e, r) { - this.isInitialized(), await this.subscriber.unsubscribe(e, r); - } - on(e, r) { - this.events.on(e, r); - } - once(e, r) { - this.events.once(e, r); - } - off(e, r) { - this.events.off(e, r); - } - removeListener(e, r) { - this.events.removeListener(e, r); - } - async transportDisconnect() { - if (!this.hasExperiencedNetworkDisruption && this.connected && this.requestsInFlight.size > 0) try { - await Promise.all(Array.from(this.requestsInFlight.values()).map((e) => e.promise)); - } catch (e) { - this.logger.warn(e); - } - this.provider.disconnect && (this.hasExperiencedNetworkDisruption || this.connected) ? await Su(this.provider.disconnect(), 2e3, "provider.disconnect()").catch(() => this.onProviderDisconnect()) : this.onProviderDisconnect(); - } - async transportClose() { - this.transportExplicitlyClosed = !0, await this.transportDisconnect(); - } - async transportOpen(e) { - await this.confirmOnlineStateOrThrow(), e && e !== this.relayUrl && (this.relayUrl = e, await this.transportDisconnect()), await this.createProvider(), this.connectionAttemptInProgress = !0, this.transportExplicitlyClosed = !1; - try { - await new Promise(async (r, n) => { - const i = () => { - this.provider.off(Yi.disconnect, i), n(new Error("Connection interrupted while trying to subscribe")); - }; - this.provider.on(Yi.disconnect, i), await Su(this.provider.connect(), vt.toMiliseconds(vt.ONE_MINUTE), `Socket stalled when trying to connect to ${this.relayUrl}`).catch((s) => { - n(s); - }).finally(() => { - clearTimeout(this.reconnectTimeout), this.reconnectTimeout = void 0; - }), this.subscriber.start().catch((s) => { - this.logger.error(s), this.onDisconnectHandler(); - }), this.hasExperiencedNetworkDisruption = !1, r(); - }); - } catch (r) { - this.logger.error(r); - const n = r; - if (this.hasExperiencedNetworkDisruption = !0, !this.isConnectionStalled(n.message)) throw r; - } finally { - this.connectionAttemptInProgress = !1; - } - } - async restartTransport(e) { - this.connectionAttemptInProgress || (this.relayUrl = e || this.relayUrl, await this.confirmOnlineStateOrThrow(), await this.transportClose(), await this.transportOpen()); - } - async confirmOnlineStateOrThrow() { - if (!await x3()) throw new Error("No internet connection detected. Please restart your network and try again."); - } - async handleBatchMessageEvents(e) { - if ((e == null ? void 0 : e.length) === 0) { - this.logger.trace("Batch message events is empty. Ignoring..."); - return; - } - const r = e.sort((n, i) => n.publishedAt - i.publishedAt); - this.logger.trace(`Batch of ${r.length} message events sorted`); - for (const n of r) try { - await this.onMessageEvent(n); - } catch (i) { - this.logger.warn(i); - } - this.logger.trace(`Batch of ${r.length} message events processed`); - } - async onLinkMessageEvent(e, r) { - const { topic: n } = e; - if (!r.sessionExists) { - const i = Sn(vt.FIVE_MINUTES), s = { topic: n, expiry: i, relay: { protocol: "irn" }, active: !1 }; - await this.core.pairing.pairings.set(n, s); - } - this.events.emit(ai.message, e), await this.recordMessageEvent(e); - } - startPingTimeout() { - var e, r, n, i, s; - if (w0()) try { - (r = (e = this.provider) == null ? void 0 : e.connection) != null && r.socket && ((s = (i = (n = this.provider) == null ? void 0 : n.connection) == null ? void 0 : i.socket) == null || s.once("ping", () => { - this.resetPingTimeout(); - })), this.resetPingTimeout(); - } catch (o) { - this.logger.warn(o); - } - } - isConnectionStalled(e) { - return this.staleConnectionErrors.some((r) => e.includes(r)); - } - async createProvider() { - this.provider.connection && this.unregisterProviderListeners(); - const e = await this.core.crypto.signJWT(this.relayUrl); - this.provider = new us(new SH(Sz({ sdkVersion: K1, protocol: this.protocol, version: this.version, relayUrl: this.relayUrl, projectId: this.projectId, auth: e, useOnCloseEvent: !0, bundleId: this.bundleId }))), this.registerProviderListeners(); - } - async recordMessageEvent(e) { - const { topic: r, message: n } = e; - await this.messages.set(r, n); - } - async shouldIgnoreMessageEvent(e) { - const { topic: r, message: n } = e; - if (!n || n.length === 0) return this.logger.debug(`Ignoring invalid/empty message: ${n}`), !0; - if (!await this.subscriber.isSubscribed(r)) return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`), !0; - const i = this.messages.has(r, n); - return i && this.logger.debug(`Ignoring duplicate message: ${n}`), i; - } - async onProviderPayload(e) { - if (this.logger.debug("Incoming Relay Payload"), this.logger.trace({ type: "payload", direction: "incoming", payload: e }), Ab(e)) { - if (!e.method.endsWith(FH)) return; - const r = e.params, { topic: n, message: i, publishedAt: s, attestation: o } = r.data, a = { topic: n, message: i, publishedAt: s, transportType: zr.relay, attestation: o }; - this.logger.debug("Emitting Relayer Payload"), this.logger.trace(U3({ type: "event", event: r.id }, a)), this.events.emit(r.id, a), await this.acknowledgePayload(e), await this.onMessageEvent(a); - } else bp(e) && this.events.emit(ai.message_ack, e); - } - async onMessageEvent(e) { - await this.shouldIgnoreMessageEvent(e) || (this.events.emit(ai.message, e), await this.recordMessageEvent(e)); - } - async acknowledgePayload(e) { - const r = mp(e.id, !0); - await this.provider.connection.send(r); - } - unregisterProviderListeners() { - this.provider.off(Yi.payload, this.onPayloadHandler), this.provider.off(Yi.connect, this.onConnectHandler), this.provider.off(Yi.disconnect, this.onDisconnectHandler), this.provider.off(Yi.error, this.onProviderErrorHandler), clearTimeout(this.pingTimeout); - } - async registerEventListeners() { - let e = await x3(); - tH(async (r) => { - e !== r && (e = r, r ? await this.restartTransport().catch((n) => this.logger.error(n)) : (this.hasExperiencedNetworkDisruption = !0, await this.transportDisconnect(), this.transportExplicitlyClosed = !1)); - }); - } - async onProviderDisconnect() { - await this.subscriber.stop(), this.requestsInFlight.clear(), clearTimeout(this.pingTimeout), this.events.emit(ai.disconnect), this.connectionAttemptInProgress = !1, !this.transportExplicitlyClosed && (this.reconnectTimeout || (this.reconnectTimeout = setTimeout(async () => { - await this.transportOpen().catch((e) => this.logger.error(e)); - }, vt.toMiliseconds(jH)))); - } - isInitialized() { - if (!this.initialized) { - const { message: e } = ft("NOT_INITIALIZED", this.name); - throw new Error(e); - } - } - async toEstablishConnection() { - await this.confirmOnlineStateOrThrow(), !this.connected && (this.connectionAttemptInProgress && await new Promise((e) => { - const r = setInterval(() => { - this.connected && (clearInterval(r), e()); - }, this.connectionStatusPollingInterval); - }), await this.transportOpen()); - } -} -var VV = Object.defineProperty, q3 = Object.getOwnPropertySymbols, GV = Object.prototype.hasOwnProperty, YV = Object.prototype.propertyIsEnumerable, z3 = (t, e, r) => e in t ? VV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, W3 = (t, e) => { - for (var r in e || (e = {})) GV.call(e, r) && z3(t, r, e[r]); - if (q3) for (var r of q3(e)) YV.call(e, r) && z3(t, r, e[r]); - return t; -}; -class Oc extends N$ { - constructor(e, r, n, i = ro, s = void 0) { - super(e, r, n, i), this.core = e, this.logger = r, this.name = n, this.map = /* @__PURE__ */ new Map(), this.version = UH, this.cached = [], this.initialized = !1, this.storagePrefix = ro, this.recentlyDeleted = [], this.recentlyDeletedLimit = 200, this.init = async () => { - this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((o) => { - this.getKey && o !== null && !vi(o) ? this.map.set(this.getKey(o), o) : DW(o) ? this.map.set(o.id, o) : OW(o) && this.map.set(o.topic, o); - }), this.cached = [], this.initialized = !0); - }, this.set = async (o, a) => { - this.isInitialized(), this.map.has(o) ? await this.update(o, a) : (this.logger.debug("Setting value"), this.logger.trace({ type: "method", method: "set", key: o, value: a }), this.map.set(o, a), await this.persist()); - }, this.get = (o) => (this.isInitialized(), this.logger.debug("Getting value"), this.logger.trace({ type: "method", method: "get", key: o }), this.getData(o)), this.getAll = (o) => (this.isInitialized(), o ? this.values.filter((a) => Object.keys(o).every((u) => PH(a[u], o[u]))) : this.values), this.update = async (o, a) => { - this.isInitialized(), this.logger.debug("Updating value"), this.logger.trace({ type: "method", method: "update", key: o, update: a }); - const u = W3(W3({}, this.getData(o)), a); - this.map.set(o, u), await this.persist(); - }, this.delete = async (o, a) => { - this.isInitialized(), this.map.has(o) && (this.logger.debug("Deleting value"), this.logger.trace({ type: "method", method: "delete", key: o, reason: a }), this.map.delete(o), this.addToRecentlyDeleted(o), await this.persist()); - }, this.logger = ui(r, this.name), this.storagePrefix = i, this.getKey = s; - } - get context() { - return Pi(this.logger); - } - get storageKey() { - return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; - } - get length() { - return this.map.size; - } - get keys() { - return Array.from(this.map.keys()); - } - get values() { - return Array.from(this.map.values()); - } - addToRecentlyDeleted(e) { - this.recentlyDeleted.push(e), this.recentlyDeleted.length >= this.recentlyDeletedLimit && this.recentlyDeleted.splice(0, this.recentlyDeletedLimit / 2); - } - async setDataStore(e) { - await this.core.storage.setItem(this.storageKey, e); - } - async getDataStore() { - return await this.core.storage.getItem(this.storageKey); - } - getData(e) { - const r = this.map.get(e); - if (!r) { - if (this.recentlyDeleted.includes(e)) { - const { message: i } = ft("MISSING_OR_INVALID", `Record was recently deleted - ${this.name}: ${e}`); - throw this.logger.error(i), new Error(i); - } - const { message: n } = ft("NO_MATCHING_KEY", `${this.name}: ${e}`); - throw this.logger.error(n), new Error(n); - } - return r; - } - async persist() { - await this.setDataStore(this.values); - } - async restore() { - try { - const e = await this.getDataStore(); - if (typeof e > "u" || !e.length) return; - if (this.map.size) { - const { message: r } = ft("RESTORE_WILL_OVERRIDE", this.name); - throw this.logger.error(r), new Error(r); - } - this.cached = e, this.logger.debug(`Successfully Restored value for ${this.name}`), this.logger.trace({ type: "method", method: "restore", value: this.values }); - } catch (e) { - this.logger.debug(`Failed to Restore value for ${this.name}`), this.logger.error(e); - } - } - isInitialized() { - if (!this.initialized) { - const { message: e } = ft("NOT_INITIALIZED", this.name); - throw new Error(e); - } - } -} -class JV { - constructor(e, r) { - this.core = e, this.logger = r, this.name = KH, this.version = VH, this.events = new Xv(), this.initialized = !1, this.storagePrefix = ro, this.ignoredPayloadTypes = [Oo], this.registeredMethods = [], this.init = async () => { - this.initialized || (await this.pairings.init(), await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.initialized = !0, this.logger.trace("Initialized")); - }, this.register = ({ methods: n }) => { - this.isInitialized(), this.registeredMethods = [.../* @__PURE__ */ new Set([...this.registeredMethods, ...n])]; - }, this.create = async (n) => { - this.isInitialized(); - const i = W1(), s = await this.core.crypto.setSymKey(i), o = Sn(vt.FIVE_MINUTES), a = { protocol: DE }, u = { topic: s, expiry: o, relay: a, active: !1, methods: n == null ? void 0 : n.methods }, l = g3({ protocol: this.core.protocol, version: this.core.version, topic: s, symKey: i, relay: a, expiryTimestamp: o, methods: n == null ? void 0 : n.methods }); - return this.events.emit(ic.create, u), this.core.expirer.set(s, o), await this.pairings.set(s, u), await this.core.relayer.subscribe(s, { transportType: n == null ? void 0 : n.transportType }), { topic: s, uri: l }; - }, this.pair = async (n) => { - this.isInitialized(); - const i = this.core.eventClient.createEvent({ properties: { topic: n == null ? void 0 : n.uri, trace: [qs.pairing_started] } }); - this.isValidPair(n, i); - const { topic: s, symKey: o, relay: a, expiryTimestamp: u, methods: l } = p3(n.uri); - i.props.properties.topic = s, i.addTrace(qs.pairing_uri_validation_success), i.addTrace(qs.pairing_uri_not_expired); - let d; - if (this.pairings.keys.includes(s)) { - if (d = this.pairings.get(s), i.addTrace(qs.existing_pairing), d.active) throw i.setError(So.active_pairing_already_exists), new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`); - i.addTrace(qs.pairing_not_expired); - } - const p = u || Sn(vt.FIVE_MINUTES), w = { topic: s, relay: a, expiry: p, active: !1, methods: l }; - this.core.expirer.set(s, p), await this.pairings.set(s, w), i.addTrace(qs.store_new_pairing), n.activatePairing && await this.activate({ topic: s }), this.events.emit(ic.create, w), i.addTrace(qs.emit_inactive_pairing), this.core.crypto.keychain.has(s) || await this.core.crypto.setSymKey(o, s), i.addTrace(qs.subscribing_pairing_topic); - try { - await this.core.relayer.confirmOnlineStateOrThrow(); - } catch { - i.setError(So.no_internet_connection); - } - try { - await this.core.relayer.subscribe(s, { relay: a }); - } catch (_) { - throw i.setError(So.subscribe_pairing_topic_failure), _; - } - return i.addTrace(qs.subscribe_pairing_topic_success), w; - }, this.activate = async ({ topic: n }) => { - this.isInitialized(); - const i = Sn(vt.THIRTY_DAYS); - this.core.expirer.set(n, i), await this.pairings.update(n, { active: !0, expiry: i }); - }, this.ping = async (n) => { - this.isInitialized(), await this.isValidPing(n); - const { topic: i } = n; - if (this.pairings.keys.includes(i)) { - const s = await this.sendRequest(i, "wc_pairingPing", {}), { done: o, resolve: a, reject: u } = ec(); - this.events.once(yr("pairing_ping", s), ({ error: l }) => { - l ? u(l) : a(); - }), await o(); - } - }, this.updateExpiry = async ({ topic: n, expiry: i }) => { - this.isInitialized(), await this.pairings.update(n, { expiry: i }); - }, this.updateMetadata = async ({ topic: n, metadata: i }) => { - this.isInitialized(), await this.pairings.update(n, { peerMetadata: i }); - }, this.getPairings = () => (this.isInitialized(), this.pairings.values), this.disconnect = async (n) => { - this.isInitialized(), await this.isValidDisconnect(n); - const { topic: i } = n; - this.pairings.keys.includes(i) && (await this.sendRequest(i, "wc_pairingDelete", Or("USER_DISCONNECTED")), await this.deletePairing(i)); - }, this.formatUriFromPairing = (n) => { - this.isInitialized(); - const { topic: i, relay: s, expiry: o, methods: a } = n, u = this.core.crypto.keychain.get(i); - return g3({ protocol: this.core.protocol, version: this.core.version, topic: i, symKey: u, relay: s, expiryTimestamp: o, methods: a }); - }, this.sendRequest = async (n, i, s) => { - const o = ga(i, s), a = await this.core.crypto.encode(n, o), u = Lf[i].req; - return this.core.history.set(n, o), this.core.relayer.publish(n, a, u), o.id; - }, this.sendResult = async (n, i, s) => { - const o = mp(n, s), a = await this.core.crypto.encode(i, o), u = await this.core.history.get(i, n), l = Lf[u.request.method].res; - await this.core.relayer.publish(i, a, l), await this.core.history.resolve(o); - }, this.sendError = async (n, i, s) => { - const o = vp(n, s), a = await this.core.crypto.encode(i, o), u = await this.core.history.get(i, n), l = Lf[u.request.method] ? Lf[u.request.method].res : Lf.unregistered_method.res; - await this.core.relayer.publish(i, a, l), await this.core.history.resolve(o); - }, this.deletePairing = async (n, i) => { - await this.core.relayer.unsubscribe(n), await Promise.all([this.pairings.delete(n, Or("USER_DISCONNECTED")), this.core.crypto.deleteSymKey(n), i ? Promise.resolve() : this.core.expirer.del(n)]); - }, this.cleanup = async () => { - const n = this.pairings.getAll().filter((i) => fa(i.expiry)); - await Promise.all(n.map((i) => this.deletePairing(i.topic))); - }, this.onRelayEventRequest = (n) => { - const { topic: i, payload: s } = n; - switch (s.method) { - case "wc_pairingPing": - return this.onPairingPingRequest(i, s); - case "wc_pairingDelete": - return this.onPairingDeleteRequest(i, s); - default: - return this.onUnknownRpcMethodRequest(i, s); - } - }, this.onRelayEventResponse = async (n) => { - const { topic: i, payload: s } = n, o = (await this.core.history.get(i, s.id)).request.method; - switch (o) { - case "wc_pairingPing": - return this.onPairingPingResponse(i, s); - default: - return this.onUnknownRpcMethodResponse(o); - } - }, this.onPairingPingRequest = async (n, i) => { - const { id: s } = i; - try { - this.isValidPing({ topic: n }), await this.sendResult(s, n, !0), this.events.emit(ic.ping, { id: s, topic: n }); - } catch (o) { - await this.sendError(s, n, o), this.logger.error(o); - } - }, this.onPairingPingResponse = (n, i) => { - const { id: s } = i; - setTimeout(() => { - zs(i) ? this.events.emit(yr("pairing_ping", s), {}) : es(i) && this.events.emit(yr("pairing_ping", s), { error: i.error }); - }, 500); - }, this.onPairingDeleteRequest = async (n, i) => { - const { id: s } = i; - try { - this.isValidDisconnect({ topic: n }), await this.deletePairing(n), this.events.emit(ic.delete, { id: s, topic: n }); - } catch (o) { - await this.sendError(s, n, o), this.logger.error(o); - } - }, this.onUnknownRpcMethodRequest = async (n, i) => { - const { id: s, method: o } = i; - try { - if (this.registeredMethods.includes(o)) return; - const a = Or("WC_METHOD_UNSUPPORTED", o); - await this.sendError(s, n, a), this.logger.error(a); - } catch (a) { - await this.sendError(s, n, a), this.logger.error(a); - } - }, this.onUnknownRpcMethodResponse = (n) => { - this.registeredMethods.includes(n) || this.logger.error(Or("WC_METHOD_UNSUPPORTED", n)); - }, this.isValidPair = (n, i) => { - var s; - if (!mi(n)) { - const { message: a } = ft("MISSING_OR_INVALID", `pair() params: ${n}`); - throw i.setError(So.malformed_pairing_uri), new Error(a); - } - if (!RW(n.uri)) { - const { message: a } = ft("MISSING_OR_INVALID", `pair() uri: ${n.uri}`); - throw i.setError(So.malformed_pairing_uri), new Error(a); - } - const o = p3(n == null ? void 0 : n.uri); - if (!((s = o == null ? void 0 : o.relay) != null && s.protocol)) { - const { message: a } = ft("MISSING_OR_INVALID", "pair() uri#relay-protocol"); - throw i.setError(So.malformed_pairing_uri), new Error(a); - } - if (!(o != null && o.symKey)) { - const { message: a } = ft("MISSING_OR_INVALID", "pair() uri#symKey"); - throw i.setError(So.malformed_pairing_uri), new Error(a); - } - if (o != null && o.expiryTimestamp && vt.toMiliseconds(o == null ? void 0 : o.expiryTimestamp) < Date.now()) { - i.setError(So.pairing_expired); - const { message: a } = ft("EXPIRED", "pair() URI has expired. Please try again with a new connection URI."); - throw new Error(a); - } - }, this.isValidPing = async (n) => { - if (!mi(n)) { - const { message: s } = ft("MISSING_OR_INVALID", `ping() params: ${n}`); - throw new Error(s); - } - const { topic: i } = n; - await this.isValidPairingTopic(i); - }, this.isValidDisconnect = async (n) => { - if (!mi(n)) { - const { message: s } = ft("MISSING_OR_INVALID", `disconnect() params: ${n}`); - throw new Error(s); - } - const { topic: i } = n; - await this.isValidPairingTopic(i); - }, this.isValidPairingTopic = async (n) => { - if (!dn(n, !1)) { - const { message: i } = ft("MISSING_OR_INVALID", `pairing topic should be a string: ${n}`); - throw new Error(i); - } - if (!this.pairings.keys.includes(n)) { - const { message: i } = ft("NO_MATCHING_KEY", `pairing topic doesn't exist: ${n}`); - throw new Error(i); - } - if (fa(this.pairings.get(n).expiry)) { - await this.deletePairing(n); - const { message: i } = ft("EXPIRED", `pairing topic: ${n}`); - throw new Error(i); - } - }, this.core = e, this.logger = ui(r, this.name), this.pairings = new Oc(this.core, this.logger, this.name, this.storagePrefix); - } - get context() { - return Pi(this.logger); - } - isInitialized() { - if (!this.initialized) { - const { message: e } = ft("NOT_INITIALIZED", this.name); - throw new Error(e); - } - } - registerRelayerEvents() { - this.core.relayer.on(ai.message, async (e) => { - const { topic: r, message: n, transportType: i } = e; - if (!this.pairings.keys.includes(r) || i === zr.link_mode || this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n))) return; - const s = await this.core.crypto.decode(r, n); - try { - Ab(s) ? (this.core.history.set(r, s), this.onRelayEventRequest({ topic: r, payload: s })) : bp(s) && (await this.core.history.resolve(s), await this.onRelayEventResponse({ topic: r, payload: s }), this.core.history.delete(r, s.id)); - } catch (o) { - this.logger.error(o); - } - }); - } - registerExpirerEvents() { - this.core.expirer.on(Zi.expired, async (e) => { - const { topic: r } = hE(e.target); - r && this.pairings.keys.includes(r) && (await this.deletePairing(r, !0), this.events.emit(ic.expire, { topic: r })); - }); - } -} -class XV extends T$ { - constructor(e, r) { - super(e, r), this.core = e, this.logger = r, this.records = /* @__PURE__ */ new Map(), this.events = new is.EventEmitter(), this.name = GH, this.version = YH, this.cached = [], this.initialized = !1, this.storagePrefix = ro, this.init = async () => { - this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((n) => this.records.set(n.id, n)), this.cached = [], this.registerEventListeners(), this.initialized = !0); - }, this.set = (n, i, s) => { - if (this.isInitialized(), this.logger.debug("Setting JSON-RPC request history record"), this.logger.trace({ type: "method", method: "set", topic: n, request: i, chainId: s }), this.records.has(i.id)) return; - const o = { id: i.id, topic: n, request: { method: i.method, params: i.params || null }, chainId: s, expiry: Sn(vt.THIRTY_DAYS) }; - this.records.set(o.id, o), this.persist(), this.events.emit(ys.created, o); - }, this.resolve = async (n) => { - if (this.isInitialized(), this.logger.debug("Updating JSON-RPC response history record"), this.logger.trace({ type: "method", method: "update", response: n }), !this.records.has(n.id)) return; - const i = await this.getRecord(n.id); - typeof i.response > "u" && (i.response = es(n) ? { error: n.error } : { result: n.result }, this.records.set(i.id, i), this.persist(), this.events.emit(ys.updated, i)); - }, this.get = async (n, i) => (this.isInitialized(), this.logger.debug("Getting record"), this.logger.trace({ type: "method", method: "get", topic: n, id: i }), await this.getRecord(i)), this.delete = (n, i) => { - this.isInitialized(), this.logger.debug("Deleting record"), this.logger.trace({ type: "method", method: "delete", id: i }), this.values.forEach((s) => { - if (s.topic === n) { - if (typeof i < "u" && s.id !== i) return; - this.records.delete(s.id), this.events.emit(ys.deleted, s); - } - }), this.persist(); - }, this.exists = async (n, i) => (this.isInitialized(), this.records.has(i) ? (await this.getRecord(i)).topic === n : !1), this.on = (n, i) => { - this.events.on(n, i); - }, this.once = (n, i) => { - this.events.once(n, i); - }, this.off = (n, i) => { - this.events.off(n, i); - }, this.removeListener = (n, i) => { - this.events.removeListener(n, i); - }, this.logger = ui(r, this.name); - } - get context() { - return Pi(this.logger); - } - get storageKey() { - return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; - } - get size() { - return this.records.size; - } - get keys() { - return Array.from(this.records.keys()); - } - get values() { - return Array.from(this.records.values()); - } - get pending() { - const e = []; - return this.values.forEach((r) => { - if (typeof r.response < "u") return; - const n = { topic: r.topic, request: ga(r.request.method, r.request.params, r.id), chainId: r.chainId }; - return e.push(n); - }), e; - } - async setJsonRpcRecords(e) { - await this.core.storage.setItem(this.storageKey, e); - } - async getJsonRpcRecords() { - return await this.core.storage.getItem(this.storageKey); - } - getRecord(e) { - this.isInitialized(); - const r = this.records.get(e); - if (!r) { - const { message: n } = ft("NO_MATCHING_KEY", `${this.name}: ${e}`); - throw new Error(n); - } - return r; - } - async persist() { - await this.setJsonRpcRecords(this.values), this.events.emit(ys.sync); - } - async restore() { - try { - const e = await this.getJsonRpcRecords(); - if (typeof e > "u" || !e.length) return; - if (this.records.size) { - const { message: r } = ft("RESTORE_WILL_OVERRIDE", this.name); - throw this.logger.error(r), new Error(r); - } - this.cached = e, this.logger.debug(`Successfully Restored records for ${this.name}`), this.logger.trace({ type: "method", method: "restore", records: this.values }); - } catch (e) { - this.logger.debug(`Failed to Restore records for ${this.name}`), this.logger.error(e); - } - } - registerEventListeners() { - this.events.on(ys.created, (e) => { - const r = ys.created; - this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, record: e }); - }), this.events.on(ys.updated, (e) => { - const r = ys.updated; - this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, record: e }); - }), this.events.on(ys.deleted, (e) => { - const r = ys.deleted; - this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, record: e }); - }), this.core.heartbeat.on(Uu.pulse, () => { - this.cleanup(); - }); - } - cleanup() { - try { - this.isInitialized(); - let e = !1; - this.records.forEach((r) => { - vt.toMiliseconds(r.expiry || 0) - Date.now() <= 0 && (this.logger.info(`Deleting expired history log: ${r.id}`), this.records.delete(r.id), this.events.emit(ys.deleted, r, !1), e = !0); - }), e && this.persist(); - } catch (e) { - this.logger.warn(e); - } - } - isInitialized() { - if (!this.initialized) { - const { message: e } = ft("NOT_INITIALIZED", this.name); - throw new Error(e); - } - } -} -class ZV extends k$ { - constructor(e, r) { - super(e, r), this.core = e, this.logger = r, this.expirations = /* @__PURE__ */ new Map(), this.events = new is.EventEmitter(), this.name = JH, this.version = XH, this.cached = [], this.initialized = !1, this.storagePrefix = ro, this.init = async () => { - this.initialized || (this.logger.trace("Initialized"), await this.restore(), this.cached.forEach((n) => this.expirations.set(n.target, n)), this.cached = [], this.registerEventListeners(), this.initialized = !0); - }, this.has = (n) => { - try { - const i = this.formatTarget(n); - return typeof this.getExpiration(i) < "u"; - } catch { - return !1; - } - }, this.set = (n, i) => { - this.isInitialized(); - const s = this.formatTarget(n), o = { target: s, expiry: i }; - this.expirations.set(s, o), this.checkExpiry(s, o), this.events.emit(Zi.created, { target: s, expiration: o }); - }, this.get = (n) => { - this.isInitialized(); - const i = this.formatTarget(n); - return this.getExpiration(i); - }, this.del = (n) => { - if (this.isInitialized(), this.has(n)) { - const i = this.formatTarget(n), s = this.getExpiration(i); - this.expirations.delete(i), this.events.emit(Zi.deleted, { target: i, expiration: s }); - } - }, this.on = (n, i) => { - this.events.on(n, i); - }, this.once = (n, i) => { - this.events.once(n, i); - }, this.off = (n, i) => { - this.events.off(n, i); - }, this.removeListener = (n, i) => { - this.events.removeListener(n, i); - }, this.logger = ui(r, this.name); - } - get context() { - return Pi(this.logger); - } - get storageKey() { - return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name; - } - get length() { - return this.expirations.size; - } - get keys() { - return Array.from(this.expirations.keys()); - } - get values() { - return Array.from(this.expirations.values()); - } - formatTarget(e) { - if (typeof e == "string") return Az(e); - if (typeof e == "number") return Pz(e); - const { message: r } = ft("UNKNOWN_TYPE", `Target type: ${typeof e}`); - throw new Error(r); - } - async setExpirations(e) { - await this.core.storage.setItem(this.storageKey, e); - } - async getExpirations() { - return await this.core.storage.getItem(this.storageKey); - } - async persist() { - await this.setExpirations(this.values), this.events.emit(Zi.sync); - } - async restore() { - try { - const e = await this.getExpirations(); - if (typeof e > "u" || !e.length) return; - if (this.expirations.size) { - const { message: r } = ft("RESTORE_WILL_OVERRIDE", this.name); - throw this.logger.error(r), new Error(r); - } - this.cached = e, this.logger.debug(`Successfully Restored expirations for ${this.name}`), this.logger.trace({ type: "method", method: "restore", expirations: this.values }); - } catch (e) { - this.logger.debug(`Failed to Restore expirations for ${this.name}`), this.logger.error(e); - } - } - getExpiration(e) { - const r = this.expirations.get(e); - if (!r) { - const { message: n } = ft("NO_MATCHING_KEY", `${this.name}: ${e}`); - throw this.logger.warn(n), new Error(n); - } - return r; - } - checkExpiry(e, r) { - const { expiry: n } = r; - vt.toMiliseconds(n) - Date.now() <= 0 && this.expire(e, r); - } - expire(e, r) { - this.expirations.delete(e), this.events.emit(Zi.expired, { target: e, expiration: r }); - } - checkExpirations() { - this.core.relayer.connected && this.expirations.forEach((e, r) => this.checkExpiry(r, e)); - } - registerEventListeners() { - this.core.heartbeat.on(Uu.pulse, () => this.checkExpirations()), this.events.on(Zi.created, (e) => { - const r = Zi.created; - this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), this.persist(); - }), this.events.on(Zi.expired, (e) => { - const r = Zi.expired; - this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), this.persist(); - }), this.events.on(Zi.deleted, (e) => { - const r = Zi.deleted; - this.logger.info(`Emitting ${r}`), this.logger.debug({ type: "event", event: r, data: e }), this.persist(); - }); - } - isInitialized() { - if (!this.initialized) { - const { message: e } = ft("NOT_INITIALIZED", this.name); - throw new Error(e); - } - } -} -class QV extends $$ { - constructor(e, r, n) { - super(e, r, n), this.core = e, this.logger = r, this.store = n, this.name = ZH, this.verifyUrlV3 = eK, this.storagePrefix = ro, this.version = TE, this.init = async () => { - var i; - this.isDevEnv || (this.publicKey = await this.store.getItem(this.storeKey), this.publicKey && vt.toMiliseconds((i = this.publicKey) == null ? void 0 : i.expiresAt) < Date.now() && (this.logger.debug("verify v2 public key expired"), await this.removePublicKey())); - }, this.register = async (i) => { - if (!ah() || this.isDevEnv) return; - const s = window.location.origin, { id: o, decryptedId: a } = i, u = `${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`; - try { - const l = th(), d = this.startAbortTimer(vt.ONE_SECOND * 5), p = await new Promise((w, _) => { - const P = () => { - window.removeEventListener("message", L), l.body.removeChild(O), _("attestation aborted"); - }; - this.abortController.signal.addEventListener("abort", P); - const O = l.createElement("iframe"); - O.src = u, O.style.display = "none", O.addEventListener("error", P, { signal: this.abortController.signal }); - const L = (B) => { - if (B.data && typeof B.data == "string") try { - const k = JSON.parse(B.data); - if (k.type === "verify_attestation") { - if (O1(k.attestation).payload.id !== o) return; - clearInterval(d), l.body.removeChild(O), this.abortController.signal.removeEventListener("abort", P), window.removeEventListener("message", L), w(k.attestation === null ? "" : k.attestation); - } - } catch (k) { - this.logger.warn(k); - } - }; - l.body.appendChild(O), window.addEventListener("message", L, { signal: this.abortController.signal }); - }); - return this.logger.debug("jwt attestation", p), p; - } catch (l) { - this.logger.warn(l); - } - return ""; - }, this.resolve = async (i) => { - if (this.isDevEnv) return ""; - const { attestationId: s, hash: o, encryptedId: a } = i; - if (s === "") { - this.logger.debug("resolve: attestationId is empty, skipping"); - return; - } - if (s) { - if (O1(s).payload.id !== a) return; - const l = await this.isValidJwtAttestation(s); - if (l) { - if (!l.isVerified) { - this.logger.warn("resolve: jwt attestation: origin url not verified"); - return; - } - return l; - } - } - if (!o) return; - const u = this.getVerifyUrl(i == null ? void 0 : i.verifyUrl); - return this.fetchAttestation(o, u); - }, this.fetchAttestation = async (i, s) => { - this.logger.debug(`resolving attestation: ${i} from url: ${s}`); - const o = this.startAbortTimer(vt.ONE_SECOND * 5), a = await fetch(`${s}/attestation/${i}?v2Supported=true`, { signal: this.abortController.signal }); - return clearTimeout(o), a.status === 200 ? await a.json() : void 0; - }, this.getVerifyUrl = (i) => { - let s = i || Zf; - return tK.includes(s) || (this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Zf}`), s = Zf), s; - }, this.fetchPublicKey = async () => { - try { - this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`); - const i = this.startAbortTimer(vt.FIVE_SECONDS), s = await fetch(`${this.verifyUrlV3}/public-key`, { signal: this.abortController.signal }); - return clearTimeout(i), await s.json(); - } catch (i) { - this.logger.warn(i); - } - }, this.persistPublicKey = async (i) => { - this.logger.debug("persisting public key to local storage", i), await this.store.setItem(this.storeKey, i), this.publicKey = i; - }, this.removePublicKey = async () => { - this.logger.debug("removing verify v2 public key from storage"), await this.store.removeItem(this.storeKey), this.publicKey = void 0; - }, this.isValidJwtAttestation = async (i) => { - const s = await this.getPublicKey(); - try { - if (s) return this.validateAttestation(i, s); - } catch (a) { - this.logger.error(a), this.logger.warn("error validating attestation"); - } - const o = await this.fetchAndPersistPublicKey(); - try { - if (o) return this.validateAttestation(i, o); - } catch (a) { - this.logger.error(a), this.logger.warn("error validating attestation"); - } - }, this.getPublicKey = async () => this.publicKey ? this.publicKey : await this.fetchAndPersistPublicKey(), this.fetchAndPersistPublicKey = async () => { - if (this.fetchPromise) return await this.fetchPromise, this.publicKey; - this.fetchPromise = new Promise(async (s) => { - const o = await this.fetchPublicKey(); - o && (await this.persistPublicKey(o), s(o)); - }); - const i = await this.fetchPromise; - return this.fetchPromise = void 0, i; - }, this.validateAttestation = (i, s) => { - const o = hW(i, s.publicKey), a = { hasExpired: vt.toMiliseconds(o.exp) < Date.now(), payload: o }; - if (a.hasExpired) throw this.logger.warn("resolve: jwt attestation expired"), new Error("JWT attestation expired"); - return { origin: a.payload.origin, isScam: a.payload.isScam, isVerified: a.payload.isVerified }; - }, this.logger = ui(r, this.name), this.abortController = new AbortController(), this.isDevEnv = yb(), this.init(); - } - get storeKey() { - return this.storagePrefix + this.version + this.core.customStoragePrefix + "//verify:public:key"; - } - get context() { - return Pi(this.logger); - } - startAbortTimer(e) { - return this.abortController = new AbortController(), setTimeout(() => this.abortController.abort(), vt.toMiliseconds(e)); - } -} -class eG extends B$ { - constructor(e, r) { - super(e, r), this.projectId = e, this.logger = r, this.context = rK, this.registerDeviceToken = async (n) => { - const { clientId: i, token: s, notificationType: o, enableEncrypted: a = !1 } = n, u = `${nK}/${this.projectId}/clients`; - await fetch(u, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ client_id: i, type: o, token: s, always_raw: a }) }); - }, this.logger = ui(r, this.context); - } -} -var tG = Object.defineProperty, H3 = Object.getOwnPropertySymbols, rG = Object.prototype.hasOwnProperty, nG = Object.prototype.propertyIsEnumerable, K3 = (t, e, r) => e in t ? tG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Bf = (t, e) => { - for (var r in e || (e = {})) rG.call(e, r) && K3(t, r, e[r]); - if (H3) for (var r of H3(e)) nG.call(e, r) && K3(t, r, e[r]); - return t; -}; -class iG extends F$ { - constructor(e, r, n = !0) { - super(e, r, n), this.core = e, this.logger = r, this.context = sK, this.storagePrefix = ro, this.storageVersion = iK, this.events = /* @__PURE__ */ new Map(), this.shouldPersist = !1, this.init = async () => { - if (!yb()) try { - const i = { eventId: r3(), timestamp: Date.now(), domain: this.getAppDomain(), props: { event: "INIT", type: "", properties: { client_id: await this.core.crypto.getClientId(), user_agent: cE(this.core.relayer.protocol, this.core.relayer.version, K1) } } }; - await this.sendEvent([i]); - } catch (i) { - this.logger.warn(i); - } - }, this.createEvent = (i) => { - const { event: s = "ERROR", type: o = "", properties: { topic: a, trace: u } } = i, l = r3(), d = this.core.projectId || "", p = Date.now(), w = Bf({ eventId: l, timestamp: p, props: { event: s, type: o, properties: { topic: a, trace: u } }, bundleId: d, domain: this.getAppDomain() }, this.setMethods(l)); - return this.telemetryEnabled && (this.events.set(l, w), this.shouldPersist = !0), w; - }, this.getEvent = (i) => { - const { eventId: s, topic: o } = i; - if (s) return this.events.get(s); - const a = Array.from(this.events.values()).find((u) => u.props.properties.topic === o); - if (a) return Bf(Bf({}, a), this.setMethods(a.eventId)); - }, this.deleteEvent = (i) => { - const { eventId: s } = i; - this.events.delete(s), this.shouldPersist = !0; - }, this.setEventListeners = () => { - this.core.heartbeat.on(Uu.pulse, async () => { - this.shouldPersist && await this.persist(), this.events.forEach((i) => { - vt.fromMiliseconds(Date.now()) - vt.fromMiliseconds(i.timestamp) > oK && (this.events.delete(i.eventId), this.shouldPersist = !0); - }); - }); - }, this.setMethods = (i) => ({ addTrace: (s) => this.addTrace(i, s), setError: (s) => this.setError(i, s) }), this.addTrace = (i, s) => { - const o = this.events.get(i); - o && (o.props.properties.trace.push(s), this.events.set(i, o), this.shouldPersist = !0); - }, this.setError = (i, s) => { - const o = this.events.get(i); - o && (o.props.type = s, o.timestamp = Date.now(), this.events.set(i, o), this.shouldPersist = !0); - }, this.persist = async () => { - await this.core.storage.setItem(this.storageKey, Array.from(this.events.values())), this.shouldPersist = !1; - }, this.restore = async () => { - try { - const i = await this.core.storage.getItem(this.storageKey) || []; - if (!i.length) return; - i.forEach((s) => { - this.events.set(s.eventId, Bf(Bf({}, s), this.setMethods(s.eventId))); - }); - } catch (i) { - this.logger.warn(i); - } - }, this.submit = async () => { - if (!this.telemetryEnabled || this.events.size === 0) return; - const i = []; - for (const [s, o] of this.events) o.props.type && i.push(o); - if (i.length !== 0) try { - if ((await this.sendEvent(i)).ok) for (const s of i) this.events.delete(s.eventId), this.shouldPersist = !0; - } catch (s) { - this.logger.warn(s); - } - }, this.sendEvent = async (i) => { - const s = this.getAppDomain() ? "" : "&sp=desktop"; - return await fetch(`${aK}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${K1}${s}`, { method: "POST", body: JSON.stringify(i) }); - }, this.getAppDomain = () => aE().url, this.logger = ui(r, this.context), this.telemetryEnabled = n, n ? this.restore().then(async () => { - await this.submit(), this.setEventListeners(); - }) : this.persist(); - } - get storageKey() { - return this.storagePrefix + this.storageVersion + this.core.customStoragePrefix + "//" + this.context; - } -} -var sG = Object.defineProperty, V3 = Object.getOwnPropertySymbols, oG = Object.prototype.hasOwnProperty, aG = Object.prototype.propertyIsEnumerable, G3 = (t, e, r) => e in t ? sG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Y3 = (t, e) => { - for (var r in e || (e = {})) oG.call(e, r) && G3(t, r, e[r]); - if (V3) for (var r of V3(e)) aG.call(e, r) && G3(t, r, e[r]); - return t; -}; -class Pb extends C$ { - constructor(e) { - var r; - super(e), this.protocol = CE, this.version = TE, this.name = RE, this.events = new is.EventEmitter(), this.initialized = !1, this.on = (o, a) => this.events.on(o, a), this.once = (o, a) => this.events.once(o, a), this.off = (o, a) => this.events.off(o, a), this.removeListener = (o, a) => this.events.removeListener(o, a), this.dispatchEnvelope = ({ topic: o, message: a, sessionExists: u }) => { - if (!o || !a) return; - const l = { topic: o, message: a, publishedAt: Date.now(), transportType: zr.link_mode }; - this.relayer.onLinkMessageEvent(l, { sessionExists: u }); - }, this.projectId = e == null ? void 0 : e.projectId, this.relayUrl = (e == null ? void 0 : e.relayUrl) || OE, this.customStoragePrefix = e != null && e.customStoragePrefix ? `:${e.customStoragePrefix}` : ""; - const n = X0({ level: typeof (e == null ? void 0 : e.logger) == "string" && e.logger ? e.logger : MH.logger }), { logger: i, chunkLoggerController: s } = I$({ opts: n, maxSizeInBytes: e == null ? void 0 : e.maxLogBlobSizeInBytes, loggerOverride: e == null ? void 0 : e.logger }); - this.logChunkController = s, (r = this.logChunkController) != null && r.downloadLogsBlobInBrowser && (window.downloadLogsBlobInBrowser = async () => { - var o, a; - (o = this.logChunkController) != null && o.downloadLogsBlobInBrowser && ((a = this.logChunkController) == null || a.downloadLogsBlobInBrowser({ clientId: await this.crypto.getClientId() })); - }), this.logger = ui(i, this.name), this.heartbeat = new _k(), this.crypto = new OV(this, this.logger, e == null ? void 0 : e.keychain), this.history = new XV(this, this.logger), this.expirer = new ZV(this, this.logger), this.storage = e != null && e.storage ? e.storage : new e$(Y3(Y3({}, IH), e == null ? void 0 : e.storageOptions)), this.relayer = new KV({ core: this, logger: this.logger, relayUrl: this.relayUrl, projectId: this.projectId }), this.pairing = new JV(this, this.logger), this.verify = new QV(this, this.logger, this.storage), this.echoClient = new eG(this.projectId || "", this.logger), this.linkModeSupportedApps = [], this.eventClient = new iG(this, this.logger, e == null ? void 0 : e.telemetryEnabled); - } - static async init(e) { - const r = new Pb(e); - await r.initialize(); - const n = await r.crypto.getClientId(); - return await r.storage.setItem(qH, n), r; - } - get context() { - return Pi(this.logger); - } - async start() { - this.initialized || await this.initialize(); - } - async getLogsBlob() { - var e; - return (e = this.logChunkController) == null ? void 0 : e.logsToBlob({ clientId: await this.crypto.getClientId() }); - } - async addLinkModeSupportedApp(e) { - this.linkModeSupportedApps.includes(e) || (this.linkModeSupportedApps.push(e), await this.storage.setItem(T3, this.linkModeSupportedApps)); - } - async initialize() { - this.logger.trace("Initialized"); - try { - await this.crypto.init(), await this.history.init(), await this.expirer.init(), await this.relayer.init(), await this.heartbeat.init(), await this.pairing.init(), this.eventClient.init(), this.linkModeSupportedApps = await this.storage.getItem(T3) || [], this.initialized = !0, this.logger.info("Core Initialization Success"); - } catch (e) { - throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`, e), this.logger.error(e.message), e; - } - } -} -const cG = Pb, HE = "wc", KE = 2, VE = "client", Mb = `${HE}@${KE}:${VE}:`, Tm = { name: VE, logger: "error" }, J3 = "WALLETCONNECT_DEEPLINK_CHOICE", uG = "proposal", GE = "Proposal expired", fG = "session", ru = vt.SEVEN_DAYS, lG = "engine", In = { wc_sessionPropose: { req: { ttl: vt.FIVE_MINUTES, prompt: !0, tag: 1100 }, res: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1101 }, reject: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1120 }, autoReject: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1121 } }, wc_sessionSettle: { req: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1102 }, res: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1103 } }, wc_sessionUpdate: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1104 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1105 } }, wc_sessionExtend: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1106 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1107 } }, wc_sessionRequest: { req: { ttl: vt.FIVE_MINUTES, prompt: !0, tag: 1108 }, res: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1109 } }, wc_sessionEvent: { req: { ttl: vt.FIVE_MINUTES, prompt: !0, tag: 1110 }, res: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1111 } }, wc_sessionDelete: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1112 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1113 } }, wc_sessionPing: { req: { ttl: vt.ONE_DAY, prompt: !1, tag: 1114 }, res: { ttl: vt.ONE_DAY, prompt: !1, tag: 1115 } }, wc_sessionAuthenticate: { req: { ttl: vt.ONE_HOUR, prompt: !0, tag: 1116 }, res: { ttl: vt.ONE_HOUR, prompt: !1, tag: 1117 }, reject: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1118 }, autoReject: { ttl: vt.FIVE_MINUTES, prompt: !1, tag: 1119 } } }, Rm = { min: vt.FIVE_MINUTES, max: vt.SEVEN_DAYS }, Fs = { idle: "IDLE", active: "ACTIVE" }, hG = "request", dG = ["wc_sessionPropose", "wc_sessionRequest", "wc_authRequest", "wc_sessionAuthenticate"], pG = "wc", gG = "auth", mG = "authKeys", vG = "pairingTopics", bG = "requests", wp = `${pG}@${1.5}:${gG}:`, zd = `${wp}:PUB_KEY`; -var yG = Object.defineProperty, wG = Object.defineProperties, xG = Object.getOwnPropertyDescriptors, X3 = Object.getOwnPropertySymbols, _G = Object.prototype.hasOwnProperty, EG = Object.prototype.propertyIsEnumerable, Z3 = (t, e, r) => e in t ? yG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, tn = (t, e) => { - for (var r in e || (e = {})) _G.call(e, r) && Z3(t, r, e[r]); - if (X3) for (var r of X3(e)) EG.call(e, r) && Z3(t, r, e[r]); - return t; -}, xs = (t, e) => wG(t, xG(e)); -class SG extends U$ { - constructor(e) { - super(e), this.name = lG, this.events = new Xv(), this.initialized = !1, this.requestQueue = { state: Fs.idle, queue: [] }, this.sessionRequestQueue = { state: Fs.idle, queue: [] }, this.requestQueueDelay = vt.ONE_SECOND, this.expectedPairingMethodMap = /* @__PURE__ */ new Map(), this.recentlyDeletedMap = /* @__PURE__ */ new Map(), this.recentlyDeletedLimit = 200, this.relayMessageCache = [], this.init = async () => { - this.initialized || (await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.registerPairingEvents(), await this.registerLinkModeListeners(), this.client.core.pairing.register({ methods: Object.keys(In) }), this.initialized = !0, setTimeout(() => { - this.sessionRequestQueue.queue = this.getPendingSessionRequests(), this.processSessionRequestQueue(); - }, vt.toMiliseconds(this.requestQueueDelay))); - }, this.connect = async (r) => { - this.isInitialized(), await this.confirmOnlineStateOrThrow(); - const n = xs(tn({}, r), { requiredNamespaces: r.requiredNamespaces || {}, optionalNamespaces: r.optionalNamespaces || {} }); - await this.isValidConnect(n); - const { pairingTopic: i, requiredNamespaces: s, optionalNamespaces: o, sessionProperties: a, relays: u } = n; - let l = i, d, p = !1; - try { - l && (p = this.client.core.pairing.pairings.get(l).active); - } catch (U) { - throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`), U; - } - if (!l || !p) { - const { topic: U, uri: V } = await this.client.core.pairing.create(); - l = U, d = V; - } - if (!l) { - const { message: U } = ft("NO_MATCHING_KEY", `connect() pairing topic: ${l}`); - throw new Error(U); - } - const w = await this.client.core.crypto.generateKeyPair(), _ = In.wc_sessionPropose.req.ttl || vt.FIVE_MINUTES, P = Sn(_), O = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: u ?? [{ protocol: DE }], proposer: { publicKey: w, metadata: this.client.metadata }, expiryTimestamp: P, pairingTopic: l }, a && { sessionProperties: a }), { reject: L, resolve: B, done: k } = ec(_, GE); - this.events.once(yr("session_connect"), async ({ error: U, session: V }) => { - if (U) L(U); - else if (V) { - V.self.publicKey = w; - const Q = xs(tn({}, V), { pairingTopic: O.pairingTopic, requiredNamespaces: O.requiredNamespaces, optionalNamespaces: O.optionalNamespaces, transportType: zr.relay }); - await this.client.session.set(V.topic, Q), await this.setExpiry(V.topic, V.expiry), l && await this.client.core.pairing.updateMetadata({ topic: l, metadata: V.peer.metadata }), this.cleanupDuplicatePairings(Q), B(Q); - } - }); - const W = await this.sendRequest({ topic: l, method: "wc_sessionPropose", params: O, throwOnFailedPublish: !0 }); - return await this.setProposal(W, tn({ id: W }, O)), { uri: d, approval: k }; - }, this.pair = async (r) => { - this.isInitialized(), await this.confirmOnlineStateOrThrow(); - try { - return await this.client.core.pairing.pair(r); - } catch (n) { - throw this.client.logger.error("pair() failed"), n; - } - }, this.approve = async (r) => { - var n, i, s; - const o = this.client.core.eventClient.createEvent({ properties: { topic: (n = r == null ? void 0 : r.id) == null ? void 0 : n.toString(), trace: [ws.session_approve_started] } }); - try { - this.isInitialized(), await this.confirmOnlineStateOrThrow(); - } catch (K) { - throw o.setError(Xa.no_internet_connection), K; - } - try { - await this.isValidProposalId(r == null ? void 0 : r.id); - } catch (K) { - throw this.client.logger.error(`approve() -> proposal.get(${r == null ? void 0 : r.id}) failed`), o.setError(Xa.proposal_not_found), K; - } - try { - await this.isValidApprove(r); - } catch (K) { - throw this.client.logger.error("approve() -> isValidApprove() failed"), o.setError(Xa.session_approve_namespace_validation_failure), K; - } - const { id: a, relayProtocol: u, namespaces: l, sessionProperties: d, sessionConfig: p } = r, w = this.client.proposal.get(a); - this.client.core.eventClient.deleteEvent({ eventId: o.eventId }); - const { pairingTopic: _, proposer: P, requiredNamespaces: O, optionalNamespaces: L } = w; - let B = (i = this.client.core.eventClient) == null ? void 0 : i.getEvent({ topic: _ }); - B || (B = (s = this.client.core.eventClient) == null ? void 0 : s.createEvent({ type: ws.session_approve_started, properties: { topic: _, trace: [ws.session_approve_started, ws.session_namespaces_validation_success] } })); - const k = await this.client.core.crypto.generateKeyPair(), W = P.publicKey, U = await this.client.core.crypto.generateSharedKey(k, W), V = tn(tn({ relay: { protocol: u ?? "irn" }, namespaces: l, controller: { publicKey: k, metadata: this.client.metadata }, expiry: Sn(ru) }, d && { sessionProperties: d }), p && { sessionConfig: p }), Q = zr.relay; - B.addTrace(ws.subscribing_session_topic); - try { - await this.client.core.relayer.subscribe(U, { transportType: Q }); - } catch (K) { - throw B.setError(Xa.subscribe_session_topic_failure), K; - } - B.addTrace(ws.subscribe_session_topic_success); - const R = xs(tn({}, V), { topic: U, requiredNamespaces: O, optionalNamespaces: L, pairingTopic: _, acknowledged: !1, self: V.controller, peer: { publicKey: P.publicKey, metadata: P.metadata }, controller: k, transportType: zr.relay }); - await this.client.session.set(U, R), B.addTrace(ws.store_session); - try { - B.addTrace(ws.publishing_session_settle), await this.sendRequest({ topic: U, method: "wc_sessionSettle", params: V, throwOnFailedPublish: !0 }).catch((K) => { - throw B == null || B.setError(Xa.session_settle_publish_failure), K; - }), B.addTrace(ws.session_settle_publish_success), B.addTrace(ws.publishing_session_approve), await this.sendResult({ id: a, topic: _, result: { relay: { protocol: u ?? "irn" }, responderPublicKey: k }, throwOnFailedPublish: !0 }).catch((K) => { - throw B == null || B.setError(Xa.session_approve_publish_failure), K; - }), B.addTrace(ws.session_approve_publish_success); - } catch (K) { - throw this.client.logger.error(K), this.client.session.delete(U, Or("USER_DISCONNECTED")), await this.client.core.relayer.unsubscribe(U), K; - } - return this.client.core.eventClient.deleteEvent({ eventId: B.eventId }), await this.client.core.pairing.updateMetadata({ topic: _, metadata: P.metadata }), await this.client.proposal.delete(a, Or("USER_DISCONNECTED")), await this.client.core.pairing.activate({ topic: _ }), await this.setExpiry(U, Sn(ru)), { topic: U, acknowledged: () => Promise.resolve(this.client.session.get(U)) }; - }, this.reject = async (r) => { - this.isInitialized(), await this.confirmOnlineStateOrThrow(); - try { - await this.isValidReject(r); - } catch (o) { - throw this.client.logger.error("reject() -> isValidReject() failed"), o; - } - const { id: n, reason: i } = r; - let s; - try { - s = this.client.proposal.get(n).pairingTopic; - } catch (o) { - throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`), o; - } - s && (await this.sendError({ id: n, topic: s, error: i, rpcOpts: In.wc_sessionPropose.reject }), await this.client.proposal.delete(n, Or("USER_DISCONNECTED"))); - }, this.update = async (r) => { - this.isInitialized(), await this.confirmOnlineStateOrThrow(); - try { - await this.isValidUpdate(r); - } catch (p) { - throw this.client.logger.error("update() -> isValidUpdate() failed"), p; - } - const { topic: n, namespaces: i } = r, { done: s, resolve: o, reject: a } = ec(), u = la(), l = fc().toString(), d = this.client.session.get(n).namespaces; - return this.events.once(yr("session_update", u), ({ error: p }) => { - p ? a(p) : o(); - }), await this.client.session.update(n, { namespaces: i }), await this.sendRequest({ topic: n, method: "wc_sessionUpdate", params: { namespaces: i }, throwOnFailedPublish: !0, clientRpcId: u, relayRpcId: l }).catch((p) => { - this.client.logger.error(p), this.client.session.update(n, { namespaces: d }), a(p); - }), { acknowledged: s }; - }, this.extend = async (r) => { - this.isInitialized(), await this.confirmOnlineStateOrThrow(); - try { - await this.isValidExtend(r); - } catch (u) { - throw this.client.logger.error("extend() -> isValidExtend() failed"), u; - } - const { topic: n } = r, i = la(), { done: s, resolve: o, reject: a } = ec(); - return this.events.once(yr("session_extend", i), ({ error: u }) => { - u ? a(u) : o(); - }), await this.setExpiry(n, Sn(ru)), this.sendRequest({ topic: n, method: "wc_sessionExtend", params: {}, clientRpcId: i, throwOnFailedPublish: !0 }).catch((u) => { - a(u); - }), { acknowledged: s }; - }, this.request = async (r) => { - this.isInitialized(); - try { - await this.isValidRequest(r); - } catch (P) { - throw this.client.logger.error("request() -> isValidRequest() failed"), P; - } - const { chainId: n, request: i, topic: s, expiry: o = In.wc_sessionRequest.req.ttl } = r, a = this.client.session.get(s); - (a == null ? void 0 : a.transportType) === zr.relay && await this.confirmOnlineStateOrThrow(); - const u = la(), l = fc().toString(), { done: d, resolve: p, reject: w } = ec(o, "Request expired. Please try again."); - this.events.once(yr("session_request", u), ({ error: P, result: O }) => { - P ? w(P) : p(O); - }); - const _ = this.getAppLinkIfEnabled(a.peer.metadata, a.transportType); - return _ ? (await this.sendRequest({ clientRpcId: u, relayRpcId: l, topic: s, method: "wc_sessionRequest", params: { request: xs(tn({}, i), { expiryTimestamp: Sn(o) }), chainId: n }, expiry: o, throwOnFailedPublish: !0, appLink: _ }).catch((P) => w(P)), this.client.events.emit("session_request_sent", { topic: s, request: i, chainId: n, id: u }), await d()) : await Promise.all([new Promise(async (P) => { - await this.sendRequest({ clientRpcId: u, relayRpcId: l, topic: s, method: "wc_sessionRequest", params: { request: xs(tn({}, i), { expiryTimestamp: Sn(o) }), chainId: n }, expiry: o, throwOnFailedPublish: !0 }).catch((O) => w(O)), this.client.events.emit("session_request_sent", { topic: s, request: i, chainId: n, id: u }), P(); - }), new Promise(async (P) => { - var O; - if (!((O = a.sessionConfig) != null && O.disableDeepLink)) { - const L = await Cz(this.client.core.storage, J3); - await Mz({ id: u, topic: s, wcDeepLink: L }); - } - P(); - }), d()]).then((P) => P[2]); - }, this.respond = async (r) => { - this.isInitialized(), await this.isValidRespond(r); - const { topic: n, response: i } = r, { id: s } = i, o = this.client.session.get(n); - o.transportType === zr.relay && await this.confirmOnlineStateOrThrow(); - const a = this.getAppLinkIfEnabled(o.peer.metadata, o.transportType); - zs(i) ? await this.sendResult({ id: s, topic: n, result: i.result, throwOnFailedPublish: !0, appLink: a }) : es(i) && await this.sendError({ id: s, topic: n, error: i.error, appLink: a }), this.cleanupAfterResponse(r); - }, this.ping = async (r) => { - this.isInitialized(), await this.confirmOnlineStateOrThrow(); - try { - await this.isValidPing(r); - } catch (i) { - throw this.client.logger.error("ping() -> isValidPing() failed"), i; - } - const { topic: n } = r; - if (this.client.session.keys.includes(n)) { - const i = la(), s = fc().toString(), { done: o, resolve: a, reject: u } = ec(); - this.events.once(yr("session_ping", i), ({ error: l }) => { - l ? u(l) : a(); - }), await Promise.all([this.sendRequest({ topic: n, method: "wc_sessionPing", params: {}, throwOnFailedPublish: !0, clientRpcId: i, relayRpcId: s }), o()]); - } else this.client.core.pairing.pairings.keys.includes(n) && await this.client.core.pairing.ping({ topic: n }); - }, this.emit = async (r) => { - this.isInitialized(), await this.confirmOnlineStateOrThrow(), await this.isValidEmit(r); - const { topic: n, event: i, chainId: s } = r, o = fc().toString(); - await this.sendRequest({ topic: n, method: "wc_sessionEvent", params: { event: i, chainId: s }, throwOnFailedPublish: !0, relayRpcId: o }); - }, this.disconnect = async (r) => { - this.isInitialized(), await this.confirmOnlineStateOrThrow(), await this.isValidDisconnect(r); - const { topic: n } = r; - if (this.client.session.keys.includes(n)) await this.sendRequest({ topic: n, method: "wc_sessionDelete", params: Or("USER_DISCONNECTED"), throwOnFailedPublish: !0 }), await this.deleteSession({ topic: n, emitEvent: !1 }); - else if (this.client.core.pairing.pairings.keys.includes(n)) await this.client.core.pairing.disconnect({ topic: n }); - else { - const { message: i } = ft("MISMATCHED_TOPIC", `Session or pairing topic not found: ${n}`); - throw new Error(i); - } - }, this.find = (r) => (this.isInitialized(), this.client.session.getAll().filter((n) => CW(n, r))), this.getPendingSessionRequests = () => this.client.pendingRequest.getAll(), this.authenticate = async (r, n) => { - var i; - this.isInitialized(), this.isValidAuthenticate(r); - const s = n && this.client.core.linkModeSupportedApps.includes(n) && ((i = this.client.metadata.redirect) == null ? void 0 : i.linkMode), o = s ? zr.link_mode : zr.relay; - o === zr.relay && await this.confirmOnlineStateOrThrow(); - const { chains: a, statement: u = "", uri: l, domain: d, nonce: p, type: w, exp: _, nbf: P, methods: O = [], expiry: L } = r, B = [...r.resources || []], { topic: k, uri: W } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); - this.client.logger.info({ message: "Generated new pairing", pairing: { topic: k, uri: W } }); - const U = await this.client.core.crypto.generateKeyPair(), V = qd(U); - if (await Promise.all([this.client.auth.authKeys.set(zd, { responseTopic: V, publicKey: U }), this.client.auth.pairingTopics.set(V, { topic: V, pairingTopic: k })]), await this.client.core.relayer.subscribe(V, { transportType: o }), this.client.logger.info(`sending request to new pairing topic: ${k}`), O.length > 0) { - const { namespace: E } = Eu(a[0]); - let S = Jz(E, "request", O); - Ud(B) && (S = Zz(S, B.pop())), B.push(S); - } - const Q = L && L > In.wc_sessionAuthenticate.req.ttl ? L : In.wc_sessionAuthenticate.req.ttl, R = { authPayload: { type: w ?? "caip122", chains: a, statement: u, aud: l, domain: d, version: "1", nonce: p, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: _, nbf: P, resources: B }, requester: { publicKey: U, metadata: this.client.metadata }, expiryTimestamp: Sn(Q) }, K = { eip155: { chains: a, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...O])], events: ["chainChanged", "accountsChanged"] } }, ge = { requiredNamespaces: {}, optionalNamespaces: K, relays: [{ protocol: "irn" }], pairingTopic: k, proposer: { publicKey: U, metadata: this.client.metadata }, expiryTimestamp: Sn(In.wc_sessionPropose.req.ttl) }, { done: Ee, resolve: Y, reject: A } = ec(Q, "Request expired"), m = async ({ error: E, session: S }) => { - if (this.events.off(yr("session_request", g), f), E) A(E); - else if (S) { - S.self.publicKey = U, await this.client.session.set(S.topic, S), await this.setExpiry(S.topic, S.expiry), k && await this.client.core.pairing.updateMetadata({ topic: k, metadata: S.peer.metadata }); - const v = this.client.session.get(S.topic); - await this.deleteProposal(b), Y({ session: v }); - } - }, f = async (E) => { - var S, v, M; - if (await this.deletePendingAuthRequest(g, { message: "fulfilled", code: 0 }), E.error) { - const J = Or("WC_METHOD_UNSUPPORTED", "wc_sessionAuthenticate"); - return E.error.code === J.code ? void 0 : (this.events.off(yr("session_connect"), m), A(E.error.message)); - } - await this.deleteProposal(b), this.events.off(yr("session_connect"), m); - const { cacaos: I, responder: F } = E.result, ce = [], D = []; - for (const J of I) { - await s3({ cacao: J, projectId: this.client.core.projectId }) || (this.client.logger.error(J, "Signature verification failed"), A(Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"))); - const { p: ee } = J, T = Ud(ee.resources), X = [z1(ee.iss)], re = x0(ee.iss); - if (T) { - const pe = o3(T), ie = a3(T); - ce.push(...pe), X.push(...ie); - } - for (const pe of X) D.push(`${pe}:${re}`); - } - const oe = await this.client.core.crypto.generateSharedKey(U, F.publicKey); - let Z; - ce.length > 0 && (Z = { topic: oe, acknowledged: !0, self: { publicKey: U, metadata: this.client.metadata }, peer: F, controller: F.publicKey, expiry: Sn(ru), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: k, namespaces: m3([...new Set(ce)], [...new Set(D)]), transportType: o }, await this.client.core.relayer.subscribe(oe, { transportType: o }), await this.client.session.set(oe, Z), k && await this.client.core.pairing.updateMetadata({ topic: k, metadata: F.metadata }), Z = this.client.session.get(oe)), (S = this.client.metadata.redirect) != null && S.linkMode && (v = F.metadata.redirect) != null && v.linkMode && (M = F.metadata.redirect) != null && M.universal && n && (this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal), this.client.session.update(oe, { transportType: zr.link_mode })), Y({ auths: I, session: Z }); - }, g = la(), b = la(); - this.events.once(yr("session_connect"), m), this.events.once(yr("session_request", g), f); - let x; - try { - if (s) { - const E = ga("wc_sessionAuthenticate", R, g); - this.client.core.history.set(k, E); - const S = await this.client.core.crypto.encode("", E, { type: fh, encoding: Of }); - x = xd(n, k, S); - } else await Promise.all([this.sendRequest({ topic: k, method: "wc_sessionAuthenticate", params: R, expiry: r.expiry, throwOnFailedPublish: !0, clientRpcId: g }), this.sendRequest({ topic: k, method: "wc_sessionPropose", params: ge, expiry: In.wc_sessionPropose.req.ttl, throwOnFailedPublish: !0, clientRpcId: b })]); - } catch (E) { - throw this.events.off(yr("session_connect"), m), this.events.off(yr("session_request", g), f), E; - } - return await this.setProposal(b, tn({ id: b }, ge)), await this.setAuthRequest(g, { request: xs(tn({}, R), { verifyContext: {} }), pairingTopic: k, transportType: o }), { uri: x ?? W, response: Ee }; - }, this.approveSessionAuthenticate = async (r) => { - const { id: n, auths: i } = r, s = this.client.core.eventClient.createEvent({ properties: { topic: n.toString(), trace: [Za.authenticated_session_approve_started] } }); - try { - this.isInitialized(); - } catch (L) { - throw s.setError(kf.no_internet_connection), L; - } - const o = this.getPendingAuthRequest(n); - if (!o) throw s.setError(kf.authenticated_session_pending_request_not_found), new Error(`Could not find pending auth request with id ${n}`); - const a = o.transportType || zr.relay; - a === zr.relay && await this.confirmOnlineStateOrThrow(); - const u = o.requester.publicKey, l = await this.client.core.crypto.generateKeyPair(), d = qd(u), p = { type: Oo, receiverPublicKey: u, senderPublicKey: l }, w = [], _ = []; - for (const L of i) { - if (!await s3({ cacao: L, projectId: this.client.core.projectId })) { - s.setError(kf.invalid_cacao); - const V = Or("SESSION_SETTLEMENT_FAILED", "Signature verification failed"); - throw await this.sendError({ id: n, topic: d, error: V, encodeOpts: p }), new Error(V.message); - } - s.addTrace(Za.cacaos_verified); - const { p: B } = L, k = Ud(B.resources), W = [z1(B.iss)], U = x0(B.iss); - if (k) { - const V = o3(k), Q = a3(k); - w.push(...V), W.push(...Q); - } - for (const V of W) _.push(`${V}:${U}`); - } - const P = await this.client.core.crypto.generateSharedKey(l, u); - s.addTrace(Za.create_authenticated_session_topic); - let O; - if ((w == null ? void 0 : w.length) > 0) { - O = { topic: P, acknowledged: !0, self: { publicKey: l, metadata: this.client.metadata }, peer: { publicKey: u, metadata: o.requester.metadata }, controller: u, expiry: Sn(ru), authentication: i, requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: o.pairingTopic, namespaces: m3([...new Set(w)], [...new Set(_)]), transportType: a }, s.addTrace(Za.subscribing_authenticated_session_topic); - try { - await this.client.core.relayer.subscribe(P, { transportType: a }); - } catch (L) { - throw s.setError(kf.subscribe_authenticated_session_topic_failure), L; - } - s.addTrace(Za.subscribe_authenticated_session_topic_success), await this.client.session.set(P, O), s.addTrace(Za.store_authenticated_session), await this.client.core.pairing.updateMetadata({ topic: o.pairingTopic, metadata: o.requester.metadata }); - } - s.addTrace(Za.publishing_authenticated_session_approve); - try { - await this.sendResult({ topic: d, id: n, result: { cacaos: i, responder: { publicKey: l, metadata: this.client.metadata } }, encodeOpts: p, throwOnFailedPublish: !0, appLink: this.getAppLinkIfEnabled(o.requester.metadata, a) }); - } catch (L) { - throw s.setError(kf.authenticated_session_approve_publish_failure), L; - } - return await this.client.auth.requests.delete(n, { message: "fulfilled", code: 0 }), await this.client.core.pairing.activate({ topic: o.pairingTopic }), this.client.core.eventClient.deleteEvent({ eventId: s.eventId }), { session: O }; - }, this.rejectSessionAuthenticate = async (r) => { - this.isInitialized(); - const { id: n, reason: i } = r, s = this.getPendingAuthRequest(n); - if (!s) throw new Error(`Could not find pending auth request with id ${n}`); - s.transportType === zr.relay && await this.confirmOnlineStateOrThrow(); - const o = s.requester.publicKey, a = await this.client.core.crypto.generateKeyPair(), u = qd(o), l = { type: Oo, receiverPublicKey: o, senderPublicKey: a }; - await this.sendError({ id: n, topic: u, error: i, encodeOpts: l, rpcOpts: In.wc_sessionAuthenticate.reject, appLink: this.getAppLinkIfEnabled(s.requester.metadata, s.transportType) }), await this.client.auth.requests.delete(n, { message: "rejected", code: 0 }), await this.client.proposal.delete(n, Or("USER_DISCONNECTED")); - }, this.formatAuthMessage = (r) => { - this.isInitialized(); - const { request: n, iss: i } = r; - return pE(n, i); - }, this.processRelayMessageCache = () => { - setTimeout(async () => { - if (this.relayMessageCache.length !== 0) for (; this.relayMessageCache.length > 0; ) try { - const r = this.relayMessageCache.shift(); - r && await this.onRelayMessage(r); - } catch (r) { - this.client.logger.error(r); - } - }, 50); - }, this.cleanupDuplicatePairings = async (r) => { - if (r.pairingTopic) try { - const n = this.client.core.pairing.pairings.get(r.pairingTopic), i = this.client.core.pairing.pairings.getAll().filter((s) => { - var o, a; - return ((o = s.peerMetadata) == null ? void 0 : o.url) && ((a = s.peerMetadata) == null ? void 0 : a.url) === r.peer.metadata.url && s.topic && s.topic !== n.topic; - }); - if (i.length === 0) return; - this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`), await Promise.all(i.map((s) => this.client.core.pairing.disconnect({ topic: s.topic }))), this.client.logger.info("Duplicate pairings clean up finished"); - } catch (n) { - this.client.logger.error(n); - } - }, this.deleteSession = async (r) => { - var n; - const { topic: i, expirerHasDeleted: s = !1, emitEvent: o = !0, id: a = 0 } = r, { self: u } = this.client.session.get(i); - await this.client.core.relayer.unsubscribe(i), await this.client.session.delete(i, Or("USER_DISCONNECTED")), this.addToRecentlyDeleted(i, "session"), this.client.core.crypto.keychain.has(u.publicKey) && await this.client.core.crypto.deleteKeyPair(u.publicKey), this.client.core.crypto.keychain.has(i) && await this.client.core.crypto.deleteSymKey(i), s || this.client.core.expirer.del(i), this.client.core.storage.removeItem(J3).catch((l) => this.client.logger.warn(l)), this.getPendingSessionRequests().forEach((l) => { - l.topic === i && this.deletePendingSessionRequest(l.id, Or("USER_DISCONNECTED")); - }), i === ((n = this.sessionRequestQueue.queue[0]) == null ? void 0 : n.topic) && (this.sessionRequestQueue.state = Fs.idle), o && this.client.events.emit("session_delete", { id: a, topic: i }); - }, this.deleteProposal = async (r, n) => { - if (n) try { - const i = this.client.proposal.get(r), s = this.client.core.eventClient.getEvent({ topic: i.pairingTopic }); - s == null || s.setError(Xa.proposal_expired); - } catch { - } - await Promise.all([this.client.proposal.delete(r, Or("USER_DISCONNECTED")), n ? Promise.resolve() : this.client.core.expirer.del(r)]), this.addToRecentlyDeleted(r, "proposal"); - }, this.deletePendingSessionRequest = async (r, n, i = !1) => { - await Promise.all([this.client.pendingRequest.delete(r, n), i ? Promise.resolve() : this.client.core.expirer.del(r)]), this.addToRecentlyDeleted(r, "request"), this.sessionRequestQueue.queue = this.sessionRequestQueue.queue.filter((s) => s.id !== r), i && (this.sessionRequestQueue.state = Fs.idle, this.client.events.emit("session_request_expire", { id: r })); - }, this.deletePendingAuthRequest = async (r, n, i = !1) => { - await Promise.all([this.client.auth.requests.delete(r, n), i ? Promise.resolve() : this.client.core.expirer.del(r)]); - }, this.setExpiry = async (r, n) => { - this.client.session.keys.includes(r) && (this.client.core.expirer.set(r, n), await this.client.session.update(r, { expiry: n })); - }, this.setProposal = async (r, n) => { - this.client.core.expirer.set(r, Sn(In.wc_sessionPropose.req.ttl)), await this.client.proposal.set(r, n); - }, this.setAuthRequest = async (r, n) => { - const { request: i, pairingTopic: s, transportType: o = zr.relay } = n; - this.client.core.expirer.set(r, i.expiryTimestamp), await this.client.auth.requests.set(r, { authPayload: i.authPayload, requester: i.requester, expiryTimestamp: i.expiryTimestamp, id: r, pairingTopic: s, verifyContext: i.verifyContext, transportType: o }); - }, this.setPendingSessionRequest = async (r) => { - const { id: n, topic: i, params: s, verifyContext: o } = r, a = s.request.expiryTimestamp || Sn(In.wc_sessionRequest.req.ttl); - this.client.core.expirer.set(n, a), await this.client.pendingRequest.set(n, { id: n, topic: i, params: s, verifyContext: o }); - }, this.sendRequest = async (r) => { - const { topic: n, method: i, params: s, expiry: o, relayRpcId: a, clientRpcId: u, throwOnFailedPublish: l, appLink: d } = r, p = ga(i, s, u); - let w; - const _ = !!d; - try { - const L = _ ? Of : pa; - w = await this.client.core.crypto.encode(n, p, { encoding: L }); - } catch (L) { - throw await this.cleanup(), this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`), L; - } - let P; - if (dG.includes(i)) { - const L = Ao(JSON.stringify(p)), B = Ao(w); - P = await this.client.core.verify.register({ id: B, decryptedId: L }); - } - const O = In[i].req; - if (O.attestation = P, o && (O.ttl = o), a && (O.id = a), this.client.core.history.set(n, p), _) { - const L = xd(d, n, w); - await global.Linking.openURL(L, this.client.name); - } else { - const L = In[i].req; - o && (L.ttl = o), a && (L.id = a), l ? (L.internal = xs(tn({}, L.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(n, w, L)) : this.client.core.relayer.publish(n, w, L).catch((B) => this.client.logger.error(B)); - } - return p.id; - }, this.sendResult = async (r) => { - const { id: n, topic: i, result: s, throwOnFailedPublish: o, encodeOpts: a, appLink: u } = r, l = mp(n, s); - let d; - const p = u && typeof (global == null ? void 0 : global.Linking) < "u"; - try { - const _ = p ? Of : pa; - d = await this.client.core.crypto.encode(i, l, xs(tn({}, a || {}), { encoding: _ })); - } catch (_) { - throw await this.cleanup(), this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`), _; - } - let w; - try { - w = await this.client.core.history.get(i, n); - } catch (_) { - throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`), _; - } - if (p) { - const _ = xd(u, i, d); - await global.Linking.openURL(_, this.client.name); - } else { - const _ = In[w.request.method].res; - o ? (_.internal = xs(tn({}, _.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(i, d, _)) : this.client.core.relayer.publish(i, d, _).catch((P) => this.client.logger.error(P)); - } - await this.client.core.history.resolve(l); - }, this.sendError = async (r) => { - const { id: n, topic: i, error: s, encodeOpts: o, rpcOpts: a, appLink: u } = r, l = vp(n, s); - let d; - const p = u && typeof (global == null ? void 0 : global.Linking) < "u"; - try { - const _ = p ? Of : pa; - d = await this.client.core.crypto.encode(i, l, xs(tn({}, o || {}), { encoding: _ })); - } catch (_) { - throw await this.cleanup(), this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`), _; - } - let w; - try { - w = await this.client.core.history.get(i, n); - } catch (_) { - throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`), _; - } - if (p) { - const _ = xd(u, i, d); - await global.Linking.openURL(_, this.client.name); - } else { - const _ = a || In[w.request.method].res; - this.client.core.relayer.publish(i, d, _); - } - await this.client.core.history.resolve(l); - }, this.cleanup = async () => { - const r = [], n = []; - this.client.session.getAll().forEach((i) => { - let s = !1; - fa(i.expiry) && (s = !0), this.client.core.crypto.keychain.has(i.topic) || (s = !0), s && r.push(i.topic); - }), this.client.proposal.getAll().forEach((i) => { - fa(i.expiryTimestamp) && n.push(i.id); - }), await Promise.all([...r.map((i) => this.deleteSession({ topic: i })), ...n.map((i) => this.deleteProposal(i))]); - }, this.onRelayEventRequest = async (r) => { - this.requestQueue.queue.push(r), await this.processRequestsQueue(); - }, this.processRequestsQueue = async () => { - if (this.requestQueue.state === Fs.active) { - this.client.logger.info("Request queue already active, skipping..."); - return; - } - for (this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`); this.requestQueue.queue.length > 0; ) { - this.requestQueue.state = Fs.active; - const r = this.requestQueue.queue.shift(); - if (r) try { - await this.processRequest(r); - } catch (n) { - this.client.logger.warn(n); - } - } - this.requestQueue.state = Fs.idle; - }, this.processRequest = async (r) => { - const { topic: n, payload: i, attestation: s, transportType: o, encryptedId: a } = r, u = i.method; - if (!this.shouldIgnorePairingRequest({ topic: n, requestMethod: u })) switch (u) { - case "wc_sessionPropose": - return await this.onSessionProposeRequest({ topic: n, payload: i, attestation: s, encryptedId: a }); - case "wc_sessionSettle": - return await this.onSessionSettleRequest(n, i); - case "wc_sessionUpdate": - return await this.onSessionUpdateRequest(n, i); - case "wc_sessionExtend": - return await this.onSessionExtendRequest(n, i); - case "wc_sessionPing": - return await this.onSessionPingRequest(n, i); - case "wc_sessionDelete": - return await this.onSessionDeleteRequest(n, i); - case "wc_sessionRequest": - return await this.onSessionRequest({ topic: n, payload: i, attestation: s, encryptedId: a, transportType: o }); - case "wc_sessionEvent": - return await this.onSessionEventRequest(n, i); - case "wc_sessionAuthenticate": - return await this.onSessionAuthenticateRequest({ topic: n, payload: i, attestation: s, encryptedId: a, transportType: o }); - default: - return this.client.logger.info(`Unsupported request method ${u}`); - } - }, this.onRelayEventResponse = async (r) => { - const { topic: n, payload: i, transportType: s } = r, o = (await this.client.core.history.get(n, i.id)).request.method; - switch (o) { - case "wc_sessionPropose": - return this.onSessionProposeResponse(n, i, s); - case "wc_sessionSettle": - return this.onSessionSettleResponse(n, i); - case "wc_sessionUpdate": - return this.onSessionUpdateResponse(n, i); - case "wc_sessionExtend": - return this.onSessionExtendResponse(n, i); - case "wc_sessionPing": - return this.onSessionPingResponse(n, i); - case "wc_sessionRequest": - return this.onSessionRequestResponse(n, i); - case "wc_sessionAuthenticate": - return this.onSessionAuthenticateResponse(n, i); - default: - return this.client.logger.info(`Unsupported response method ${o}`); - } - }, this.onRelayEventUnknownPayload = (r) => { - const { topic: n } = r, { message: i } = ft("MISSING_OR_INVALID", `Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`); - throw new Error(i); - }, this.shouldIgnorePairingRequest = (r) => { - const { topic: n, requestMethod: i } = r, s = this.expectedPairingMethodMap.get(n); - return !s || s.includes(i) ? !1 : !!(s.includes("wc_sessionAuthenticate") && this.client.events.listenerCount("session_authenticate") > 0); - }, this.onSessionProposeRequest = async (r) => { - const { topic: n, payload: i, attestation: s, encryptedId: o } = r, { params: a, id: u } = i; - try { - const l = this.client.core.eventClient.getEvent({ topic: n }); - this.isValidConnect(tn({}, i.params)); - const d = a.expiryTimestamp || Sn(In.wc_sessionPropose.req.ttl), p = tn({ id: u, pairingTopic: n, expiryTimestamp: d }, a); - await this.setProposal(u, p); - const w = await this.getVerifyContext({ attestationId: s, hash: Ao(JSON.stringify(i)), encryptedId: o, metadata: p.proposer.metadata }); - this.client.events.listenerCount("session_proposal") === 0 && (console.warn("No listener for session_proposal event"), l == null || l.setError(So.proposal_listener_not_found)), l == null || l.addTrace(qs.emit_session_proposal), this.client.events.emit("session_proposal", { id: u, params: p, verifyContext: w }); - } catch (l) { - await this.sendError({ id: u, topic: n, error: l, rpcOpts: In.wc_sessionPropose.autoReject }), this.client.logger.error(l); - } - }, this.onSessionProposeResponse = async (r, n, i) => { - const { id: s } = n; - if (zs(n)) { - const { result: o } = n; - this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", result: o }); - const a = this.client.proposal.get(s); - this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", proposal: a }); - const u = a.proposer.publicKey; - this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", selfPublicKey: u }); - const l = o.responderPublicKey; - this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", peerPublicKey: l }); - const d = await this.client.core.crypto.generateSharedKey(u, l); - this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", sessionTopic: d }); - const p = await this.client.core.relayer.subscribe(d, { transportType: i }); - this.client.logger.trace({ type: "method", method: "onSessionProposeResponse", subscriptionId: p }), await this.client.core.pairing.activate({ topic: r }); - } else if (es(n)) { - await this.client.proposal.delete(s, Or("USER_DISCONNECTED")); - const o = yr("session_connect"); - if (this.events.listenerCount(o) === 0) throw new Error(`emitting ${o} without any listeners, 954`); - this.events.emit(yr("session_connect"), { error: n.error }); - } - }, this.onSessionSettleRequest = async (r, n) => { - const { id: i, params: s } = n; - try { - this.isValidSessionSettleRequest(s); - const { relay: o, controller: a, expiry: u, namespaces: l, sessionProperties: d, sessionConfig: p } = n.params, w = xs(tn(tn({ topic: r, relay: o, expiry: u, namespaces: l, acknowledged: !0, pairingTopic: "", requiredNamespaces: {}, optionalNamespaces: {}, controller: a.publicKey, self: { publicKey: "", metadata: this.client.metadata }, peer: { publicKey: a.publicKey, metadata: a.metadata } }, d && { sessionProperties: d }), p && { sessionConfig: p }), { transportType: zr.relay }), _ = yr("session_connect"); - if (this.events.listenerCount(_) === 0) throw new Error(`emitting ${_} without any listeners 997`); - this.events.emit(yr("session_connect"), { session: w }), await this.sendResult({ id: n.id, topic: r, result: !0, throwOnFailedPublish: !0 }); - } catch (o) { - await this.sendError({ id: i, topic: r, error: o }), this.client.logger.error(o); - } - }, this.onSessionSettleResponse = async (r, n) => { - const { id: i } = n; - zs(n) ? (await this.client.session.update(r, { acknowledged: !0 }), this.events.emit(yr("session_approve", i), {})) : es(n) && (await this.client.session.delete(r, Or("USER_DISCONNECTED")), this.events.emit(yr("session_approve", i), { error: n.error })); - }, this.onSessionUpdateRequest = async (r, n) => { - const { params: i, id: s } = n; - try { - const o = `${r}_session_update`, a = Nf.get(o); - if (a && this.isRequestOutOfSync(a, s)) { - this.client.logger.info(`Discarding out of sync request - ${s}`), this.sendError({ id: s, topic: r, error: Or("INVALID_UPDATE_REQUEST") }); - return; - } - this.isValidUpdate(tn({ topic: r }, i)); - try { - Nf.set(o, s), await this.client.session.update(r, { namespaces: i.namespaces }), await this.sendResult({ id: s, topic: r, result: !0, throwOnFailedPublish: !0 }); - } catch (u) { - throw Nf.delete(o), u; - } - this.client.events.emit("session_update", { id: s, topic: r, params: i }); - } catch (o) { - await this.sendError({ id: s, topic: r, error: o }), this.client.logger.error(o); - } - }, this.isRequestOutOfSync = (r, n) => parseInt(n.toString().slice(0, -3)) <= parseInt(r.toString().slice(0, -3)), this.onSessionUpdateResponse = (r, n) => { - const { id: i } = n, s = yr("session_update", i); - if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); - zs(n) ? this.events.emit(yr("session_update", i), {}) : es(n) && this.events.emit(yr("session_update", i), { error: n.error }); - }, this.onSessionExtendRequest = async (r, n) => { - const { id: i } = n; - try { - this.isValidExtend({ topic: r }), await this.setExpiry(r, Sn(ru)), await this.sendResult({ id: i, topic: r, result: !0, throwOnFailedPublish: !0 }), this.client.events.emit("session_extend", { id: i, topic: r }); - } catch (s) { - await this.sendError({ id: i, topic: r, error: s }), this.client.logger.error(s); - } - }, this.onSessionExtendResponse = (r, n) => { - const { id: i } = n, s = yr("session_extend", i); - if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); - zs(n) ? this.events.emit(yr("session_extend", i), {}) : es(n) && this.events.emit(yr("session_extend", i), { error: n.error }); - }, this.onSessionPingRequest = async (r, n) => { - const { id: i } = n; - try { - this.isValidPing({ topic: r }), await this.sendResult({ id: i, topic: r, result: !0, throwOnFailedPublish: !0 }), this.client.events.emit("session_ping", { id: i, topic: r }); - } catch (s) { - await this.sendError({ id: i, topic: r, error: s }), this.client.logger.error(s); - } - }, this.onSessionPingResponse = (r, n) => { - const { id: i } = n, s = yr("session_ping", i); - if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); - setTimeout(() => { - zs(n) ? this.events.emit(yr("session_ping", i), {}) : es(n) && this.events.emit(yr("session_ping", i), { error: n.error }); - }, 500); - }, this.onSessionDeleteRequest = async (r, n) => { - const { id: i } = n; - try { - this.isValidDisconnect({ topic: r, reason: n.params }), Promise.all([new Promise((s) => { - this.client.core.relayer.once(ai.publish, async () => { - s(await this.deleteSession({ topic: r, id: i })); - }); - }), this.sendResult({ id: i, topic: r, result: !0, throwOnFailedPublish: !0 }), this.cleanupPendingSentRequestsForTopic({ topic: r, error: Or("USER_DISCONNECTED") })]).catch((s) => this.client.logger.error(s)); - } catch (s) { - this.client.logger.error(s); - } - }, this.onSessionRequest = async (r) => { - var n, i, s; - const { topic: o, payload: a, attestation: u, encryptedId: l, transportType: d } = r, { id: p, params: w } = a; - try { - await this.isValidRequest(tn({ topic: o }, w)); - const _ = this.client.session.get(o), P = await this.getVerifyContext({ attestationId: u, hash: Ao(JSON.stringify(ga("wc_sessionRequest", w, p))), encryptedId: l, metadata: _.peer.metadata, transportType: d }), O = { id: p, topic: o, params: w, verifyContext: P }; - await this.setPendingSessionRequest(O), d === zr.link_mode && (n = _.peer.metadata.redirect) != null && n.universal && this.client.core.addLinkModeSupportedApp((i = _.peer.metadata.redirect) == null ? void 0 : i.universal), (s = this.client.signConfig) != null && s.disableRequestQueue ? this.emitSessionRequest(O) : (this.addSessionRequestToSessionRequestQueue(O), this.processSessionRequestQueue()); - } catch (_) { - await this.sendError({ id: p, topic: o, error: _ }), this.client.logger.error(_); - } - }, this.onSessionRequestResponse = (r, n) => { - const { id: i } = n, s = yr("session_request", i); - if (this.events.listenerCount(s) === 0) throw new Error(`emitting ${s} without any listeners`); - zs(n) ? this.events.emit(yr("session_request", i), { result: n.result }) : es(n) && this.events.emit(yr("session_request", i), { error: n.error }); - }, this.onSessionEventRequest = async (r, n) => { - const { id: i, params: s } = n; - try { - const o = `${r}_session_event_${s.event.name}`, a = Nf.get(o); - if (a && this.isRequestOutOfSync(a, i)) { - this.client.logger.info(`Discarding out of sync request - ${i}`); - return; - } - this.isValidEmit(tn({ topic: r }, s)), this.client.events.emit("session_event", { id: i, topic: r, params: s }), Nf.set(o, i); - } catch (o) { - await this.sendError({ id: i, topic: r, error: o }), this.client.logger.error(o); - } - }, this.onSessionAuthenticateResponse = (r, n) => { - const { id: i } = n; - this.client.logger.trace({ type: "method", method: "onSessionAuthenticateResponse", topic: r, payload: n }), zs(n) ? this.events.emit(yr("session_request", i), { result: n.result }) : es(n) && this.events.emit(yr("session_request", i), { error: n.error }); - }, this.onSessionAuthenticateRequest = async (r) => { - var n; - const { topic: i, payload: s, attestation: o, encryptedId: a, transportType: u } = r; - try { - const { requester: l, authPayload: d, expiryTimestamp: p } = s.params, w = await this.getVerifyContext({ attestationId: o, hash: Ao(JSON.stringify(s)), encryptedId: a, metadata: l.metadata, transportType: u }), _ = { requester: l, pairingTopic: i, id: s.id, authPayload: d, verifyContext: w, expiryTimestamp: p }; - await this.setAuthRequest(s.id, { request: _, pairingTopic: i, transportType: u }), u === zr.link_mode && (n = l.metadata.redirect) != null && n.universal && this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal), this.client.events.emit("session_authenticate", { topic: i, params: s.params, id: s.id, verifyContext: w }); - } catch (l) { - this.client.logger.error(l); - const d = s.params.requester.publicKey, p = await this.client.core.crypto.generateKeyPair(), w = this.getAppLinkIfEnabled(s.params.requester.metadata, u), _ = { type: Oo, receiverPublicKey: d, senderPublicKey: p }; - await this.sendError({ id: s.id, topic: i, error: l, encodeOpts: _, rpcOpts: In.wc_sessionAuthenticate.autoReject, appLink: w }); - } - }, this.addSessionRequestToSessionRequestQueue = (r) => { - this.sessionRequestQueue.queue.push(r); - }, this.cleanupAfterResponse = (r) => { - this.deletePendingSessionRequest(r.response.id, { message: "fulfilled", code: 0 }), setTimeout(() => { - this.sessionRequestQueue.state = Fs.idle, this.processSessionRequestQueue(); - }, vt.toMiliseconds(this.requestQueueDelay)); - }, this.cleanupPendingSentRequestsForTopic = ({ topic: r, error: n }) => { - const i = this.client.core.history.pending; - i.length > 0 && i.filter((s) => s.topic === r && s.request.method === "wc_sessionRequest").forEach((s) => { - const o = s.request.id, a = yr("session_request", o); - if (this.events.listenerCount(a) === 0) throw new Error(`emitting ${a} without any listeners`); - this.events.emit(yr("session_request", s.request.id), { error: n }); - }); - }, this.processSessionRequestQueue = () => { - if (this.sessionRequestQueue.state === Fs.active) { - this.client.logger.info("session request queue is already active."); - return; - } - const r = this.sessionRequestQueue.queue[0]; - if (!r) { - this.client.logger.info("session request queue is empty."); - return; - } - try { - this.sessionRequestQueue.state = Fs.active, this.emitSessionRequest(r); - } catch (n) { - this.client.logger.error(n); - } - }, this.emitSessionRequest = (r) => { - this.client.events.emit("session_request", r); - }, this.onPairingCreated = (r) => { - if (r.methods && this.expectedPairingMethodMap.set(r.topic, r.methods), r.active) return; - const n = this.client.proposal.getAll().find((i) => i.pairingTopic === r.topic); - n && this.onSessionProposeRequest({ topic: r.topic, payload: ga("wc_sessionPropose", { requiredNamespaces: n.requiredNamespaces, optionalNamespaces: n.optionalNamespaces, relays: n.relays, proposer: n.proposer, sessionProperties: n.sessionProperties }, n.id) }); - }, this.isValidConnect = async (r) => { - if (!mi(r)) { - const { message: u } = ft("MISSING_OR_INVALID", `connect() params: ${JSON.stringify(r)}`); - throw new Error(u); - } - const { pairingTopic: n, requiredNamespaces: i, optionalNamespaces: s, sessionProperties: o, relays: a } = r; - if (vi(n) || await this.isValidPairingTopic(n), !UW(a)) { - const { message: u } = ft("MISSING_OR_INVALID", `connect() relays: ${a}`); - throw new Error(u); - } - !vi(i) && Ll(i) !== 0 && this.validateNamespaces(i, "requiredNamespaces"), !vi(s) && Ll(s) !== 0 && this.validateNamespaces(s, "optionalNamespaces"), vi(o) || this.validateSessionProps(o, "sessionProperties"); - }, this.validateNamespaces = (r, n) => { - const i = jW(r, "connect()", n); - if (i) throw new Error(i.message); - }, this.isValidApprove = async (r) => { - if (!mi(r)) throw new Error(ft("MISSING_OR_INVALID", `approve() params: ${r}`).message); - const { id: n, namespaces: i, relayProtocol: s, sessionProperties: o } = r; - this.checkRecentlyDeleted(n), await this.isValidProposalId(n); - const a = this.client.proposal.get(n), u = Pm(i, "approve()"); - if (u) throw new Error(u.message); - const l = y3(a.requiredNamespaces, i, "approve()"); - if (l) throw new Error(l.message); - if (!dn(s, !0)) { - const { message: d } = ft("MISSING_OR_INVALID", `approve() relayProtocol: ${s}`); - throw new Error(d); - } - vi(o) || this.validateSessionProps(o, "sessionProperties"); - }, this.isValidReject = async (r) => { - if (!mi(r)) { - const { message: s } = ft("MISSING_OR_INVALID", `reject() params: ${r}`); - throw new Error(s); - } - const { id: n, reason: i } = r; - if (this.checkRecentlyDeleted(n), await this.isValidProposalId(n), !zW(i)) { - const { message: s } = ft("MISSING_OR_INVALID", `reject() reason: ${JSON.stringify(i)}`); - throw new Error(s); - } - }, this.isValidSessionSettleRequest = (r) => { - if (!mi(r)) { - const { message: l } = ft("MISSING_OR_INVALID", `onSessionSettleRequest() params: ${r}`); - throw new Error(l); - } - const { relay: n, controller: i, namespaces: s, expiry: o } = r; - if (!_E(n)) { - const { message: l } = ft("MISSING_OR_INVALID", "onSessionSettleRequest() relay protocol should be a string"); - throw new Error(l); - } - const a = NW(i, "onSessionSettleRequest()"); - if (a) throw new Error(a.message); - const u = Pm(s, "onSessionSettleRequest()"); - if (u) throw new Error(u.message); - if (fa(o)) { - const { message: l } = ft("EXPIRED", "onSessionSettleRequest()"); - throw new Error(l); - } - }, this.isValidUpdate = async (r) => { - if (!mi(r)) { - const { message: u } = ft("MISSING_OR_INVALID", `update() params: ${r}`); - throw new Error(u); - } - const { topic: n, namespaces: i } = r; - this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); - const s = this.client.session.get(n), o = Pm(i, "update()"); - if (o) throw new Error(o.message); - const a = y3(s.requiredNamespaces, i, "update()"); - if (a) throw new Error(a.message); - }, this.isValidExtend = async (r) => { - if (!mi(r)) { - const { message: i } = ft("MISSING_OR_INVALID", `extend() params: ${r}`); - throw new Error(i); - } - const { topic: n } = r; - this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); - }, this.isValidRequest = async (r) => { - if (!mi(r)) { - const { message: u } = ft("MISSING_OR_INVALID", `request() params: ${r}`); - throw new Error(u); - } - const { topic: n, request: i, chainId: s, expiry: o } = r; - this.checkRecentlyDeleted(n), await this.isValidSessionTopic(n); - const { namespaces: a } = this.client.session.get(n); - if (!b3(a, s)) { - const { message: u } = ft("MISSING_OR_INVALID", `request() chainId: ${s}`); - throw new Error(u); - } - if (!WW(i)) { - const { message: u } = ft("MISSING_OR_INVALID", `request() ${JSON.stringify(i)}`); - throw new Error(u); - } - if (!VW(a, s, i.method)) { - const { message: u } = ft("MISSING_OR_INVALID", `request() method: ${i.method}`); - throw new Error(u); - } - if (o && !XW(o, Rm)) { - const { message: u } = ft("MISSING_OR_INVALID", `request() expiry: ${o}. Expiry must be a number (in seconds) between ${Rm.min} and ${Rm.max}`); - throw new Error(u); - } - }, this.isValidRespond = async (r) => { - var n; - if (!mi(r)) { - const { message: o } = ft("MISSING_OR_INVALID", `respond() params: ${r}`); - throw new Error(o); - } - const { topic: i, response: s } = r; - try { - await this.isValidSessionTopic(i); - } catch (o) { - throw (n = r == null ? void 0 : r.response) != null && n.id && this.cleanupAfterResponse(r), o; - } - if (!HW(s)) { - const { message: o } = ft("MISSING_OR_INVALID", `respond() response: ${JSON.stringify(s)}`); - throw new Error(o); - } - }, this.isValidPing = async (r) => { - if (!mi(r)) { - const { message: i } = ft("MISSING_OR_INVALID", `ping() params: ${r}`); - throw new Error(i); - } - const { topic: n } = r; - await this.isValidSessionOrPairingTopic(n); - }, this.isValidEmit = async (r) => { - if (!mi(r)) { - const { message: a } = ft("MISSING_OR_INVALID", `emit() params: ${r}`); - throw new Error(a); - } - const { topic: n, event: i, chainId: s } = r; - await this.isValidSessionTopic(n); - const { namespaces: o } = this.client.session.get(n); - if (!b3(o, s)) { - const { message: a } = ft("MISSING_OR_INVALID", `emit() chainId: ${s}`); - throw new Error(a); - } - if (!KW(i)) { - const { message: a } = ft("MISSING_OR_INVALID", `emit() event: ${JSON.stringify(i)}`); - throw new Error(a); - } - if (!GW(o, s, i.name)) { - const { message: a } = ft("MISSING_OR_INVALID", `emit() event: ${JSON.stringify(i)}`); - throw new Error(a); - } - }, this.isValidDisconnect = async (r) => { - if (!mi(r)) { - const { message: i } = ft("MISSING_OR_INVALID", `disconnect() params: ${r}`); - throw new Error(i); - } - const { topic: n } = r; - await this.isValidSessionOrPairingTopic(n); - }, this.isValidAuthenticate = (r) => { - const { chains: n, uri: i, domain: s, nonce: o } = r; - if (!Array.isArray(n) || n.length === 0) throw new Error("chains is required and must be a non-empty array"); - if (!dn(i, !1)) throw new Error("uri is required parameter"); - if (!dn(s, !1)) throw new Error("domain is required parameter"); - if (!dn(o, !1)) throw new Error("nonce is required parameter"); - if ([...new Set(n.map((u) => Eu(u).namespace))].length > 1) throw new Error("Multi-namespace requests are not supported. Please request single namespace only."); - const { namespace: a } = Eu(n[0]); - if (a !== "eip155") throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains."); - }, this.getVerifyContext = async (r) => { - const { attestationId: n, hash: i, encryptedId: s, metadata: o, transportType: a } = r, u = { verified: { verifyUrl: o.verifyUrl || Zf, validation: "UNKNOWN", origin: o.url || "" } }; - try { - if (a === zr.link_mode) { - const d = this.getAppLinkIfEnabled(o, a); - return u.verified.validation = d && new URL(d).origin === new URL(o.url).origin ? "VALID" : "INVALID", u; - } - const l = await this.client.core.verify.resolve({ attestationId: n, hash: i, encryptedId: s, verifyUrl: o.verifyUrl }); - l && (u.verified.origin = l.origin, u.verified.isScam = l.isScam, u.verified.validation = l.origin === new URL(o.url).origin ? "VALID" : "INVALID"); - } catch (l) { - this.client.logger.warn(l); - } - return this.client.logger.debug(`Verify context: ${JSON.stringify(u)}`), u; - }, this.validateSessionProps = (r, n) => { - Object.values(r).forEach((i) => { - if (!dn(i, !1)) { - const { message: s } = ft("MISSING_OR_INVALID", `${n} must be in Record format. Received: ${JSON.stringify(i)}`); - throw new Error(s); - } - }); - }, this.getPendingAuthRequest = (r) => { - const n = this.client.auth.requests.get(r); - return typeof n == "object" ? n : void 0; - }, this.addToRecentlyDeleted = (r, n) => { - if (this.recentlyDeletedMap.set(r, n), this.recentlyDeletedMap.size >= this.recentlyDeletedLimit) { - let i = 0; - const s = this.recentlyDeletedLimit / 2; - for (const o of this.recentlyDeletedMap.keys()) { - if (i++ >= s) break; - this.recentlyDeletedMap.delete(o); - } - } - }, this.checkRecentlyDeleted = (r) => { - const n = this.recentlyDeletedMap.get(r); - if (n) { - const { message: i } = ft("MISSING_OR_INVALID", `Record was recently deleted - ${n}: ${r}`); - throw new Error(i); - } - }, this.isLinkModeEnabled = (r, n) => { - var i, s, o, a, u, l, d, p, w; - return !r || n !== zr.link_mode ? !1 : ((s = (i = this.client.metadata) == null ? void 0 : i.redirect) == null ? void 0 : s.linkMode) === !0 && ((a = (o = this.client.metadata) == null ? void 0 : o.redirect) == null ? void 0 : a.universal) !== void 0 && ((l = (u = this.client.metadata) == null ? void 0 : u.redirect) == null ? void 0 : l.universal) !== "" && ((d = r == null ? void 0 : r.redirect) == null ? void 0 : d.universal) !== void 0 && ((p = r == null ? void 0 : r.redirect) == null ? void 0 : p.universal) !== "" && ((w = r == null ? void 0 : r.redirect) == null ? void 0 : w.linkMode) === !0 && this.client.core.linkModeSupportedApps.includes(r.redirect.universal) && typeof (global == null ? void 0 : global.Linking) < "u"; - }, this.getAppLinkIfEnabled = (r, n) => { - var i; - return this.isLinkModeEnabled(r, n) ? (i = r == null ? void 0 : r.redirect) == null ? void 0 : i.universal : void 0; - }, this.handleLinkModeMessage = ({ url: r }) => { - if (!r || !r.includes("wc_ev") || !r.includes("topic")) return; - const n = t3(r, "topic") || "", i = decodeURIComponent(t3(r, "wc_ev") || ""), s = this.client.session.keys.includes(n); - s && this.client.session.update(n, { transportType: zr.link_mode }), this.client.core.dispatchEnvelope({ topic: n, message: i, sessionExists: s }); - }, this.registerLinkModeListeners = async () => { - var r; - if (yb() || Ju() && (r = this.client.metadata.redirect) != null && r.linkMode) { - const n = global == null ? void 0 : global.Linking; - if (typeof n < "u") { - n.addEventListener("url", this.handleLinkModeMessage, this.client.name); - const i = await n.getInitialURL(); - i && setTimeout(() => { - this.handleLinkModeMessage({ url: i }); - }, 50); - } - } - }; - } - isInitialized() { - if (!this.initialized) { - const { message: e } = ft("NOT_INITIALIZED", this.name); - throw new Error(e); - } - } - async confirmOnlineStateOrThrow() { - await this.client.core.relayer.confirmOnlineStateOrThrow(); - } - registerRelayerEvents() { - this.client.core.relayer.on(ai.message, (e) => { - !this.initialized || this.relayMessageCache.length > 0 ? this.relayMessageCache.push(e) : this.onRelayMessage(e); - }); - } - async onRelayMessage(e) { - const { topic: r, message: n, attestation: i, transportType: s } = e, { publicKey: o } = this.client.auth.authKeys.keys.includes(zd) ? this.client.auth.authKeys.get(zd) : { publicKey: void 0 }, a = await this.client.core.crypto.decode(r, n, { receiverPublicKey: o, encoding: s === zr.link_mode ? Of : pa }); - try { - Ab(a) ? (this.client.core.history.set(r, a), this.onRelayEventRequest({ topic: r, payload: a, attestation: i, transportType: s, encryptedId: Ao(n) })) : bp(a) ? (await this.client.core.history.resolve(a), await this.onRelayEventResponse({ topic: r, payload: a, transportType: s }), this.client.core.history.delete(r, a.id)) : this.onRelayEventUnknownPayload({ topic: r, payload: a, transportType: s }); - } catch (u) { - this.client.logger.error(u); - } - } - registerExpirerEvents() { - this.client.core.expirer.on(Zi.expired, async (e) => { - const { topic: r, id: n } = hE(e.target); - if (n && this.client.pendingRequest.keys.includes(n)) return await this.deletePendingSessionRequest(n, ft("EXPIRED"), !0); - if (n && this.client.auth.requests.keys.includes(n)) return await this.deletePendingAuthRequest(n, ft("EXPIRED"), !0); - r ? this.client.session.keys.includes(r) && (await this.deleteSession({ topic: r, expirerHasDeleted: !0 }), this.client.events.emit("session_expire", { topic: r })) : n && (await this.deleteProposal(n, !0), this.client.events.emit("proposal_expire", { id: n })); - }); - } - registerPairingEvents() { - this.client.core.pairing.events.on(ic.create, (e) => this.onPairingCreated(e)), this.client.core.pairing.events.on(ic.delete, (e) => { - this.addToRecentlyDeleted(e.topic, "pairing"); - }); - } - isValidPairingTopic(e) { - if (!dn(e, !1)) { - const { message: r } = ft("MISSING_OR_INVALID", `pairing topic should be a string: ${e}`); - throw new Error(r); - } - if (!this.client.core.pairing.pairings.keys.includes(e)) { - const { message: r } = ft("NO_MATCHING_KEY", `pairing topic doesn't exist: ${e}`); - throw new Error(r); - } - if (fa(this.client.core.pairing.pairings.get(e).expiry)) { - const { message: r } = ft("EXPIRED", `pairing topic: ${e}`); - throw new Error(r); - } - } - async isValidSessionTopic(e) { - if (!dn(e, !1)) { - const { message: r } = ft("MISSING_OR_INVALID", `session topic should be a string: ${e}`); - throw new Error(r); - } - if (this.checkRecentlyDeleted(e), !this.client.session.keys.includes(e)) { - const { message: r } = ft("NO_MATCHING_KEY", `session topic doesn't exist: ${e}`); - throw new Error(r); - } - if (fa(this.client.session.get(e).expiry)) { - await this.deleteSession({ topic: e }); - const { message: r } = ft("EXPIRED", `session topic: ${e}`); - throw new Error(r); - } - if (!this.client.core.crypto.keychain.has(e)) { - const { message: r } = ft("MISSING_OR_INVALID", `session topic does not exist in keychain: ${e}`); - throw await this.deleteSession({ topic: e }), new Error(r); - } - } - async isValidSessionOrPairingTopic(e) { - if (this.checkRecentlyDeleted(e), this.client.session.keys.includes(e)) await this.isValidSessionTopic(e); - else if (this.client.core.pairing.pairings.keys.includes(e)) this.isValidPairingTopic(e); - else if (dn(e, !1)) { - const { message: r } = ft("NO_MATCHING_KEY", `session or pairing topic doesn't exist: ${e}`); - throw new Error(r); - } else { - const { message: r } = ft("MISSING_OR_INVALID", `session or pairing topic should be a string: ${e}`); - throw new Error(r); - } - } - async isValidProposalId(e) { - if (!qW(e)) { - const { message: r } = ft("MISSING_OR_INVALID", `proposal id should be a number: ${e}`); - throw new Error(r); - } - if (!this.client.proposal.keys.includes(e)) { - const { message: r } = ft("NO_MATCHING_KEY", `proposal id doesn't exist: ${e}`); - throw new Error(r); - } - if (fa(this.client.proposal.get(e).expiryTimestamp)) { - await this.deleteProposal(e); - const { message: r } = ft("EXPIRED", `proposal id: ${e}`); - throw new Error(r); - } - } -} -class AG extends Oc { - constructor(e, r) { - super(e, r, uG, Mb), this.core = e, this.logger = r; - } -} -let PG = class extends Oc { - constructor(e, r) { - super(e, r, fG, Mb), this.core = e, this.logger = r; - } -}; -class MG extends Oc { - constructor(e, r) { - super(e, r, hG, Mb, (n) => n.id), this.core = e, this.logger = r; - } -} -class IG extends Oc { - constructor(e, r) { - super(e, r, mG, wp, () => zd), this.core = e, this.logger = r; - } -} -class CG extends Oc { - constructor(e, r) { - super(e, r, vG, wp), this.core = e, this.logger = r; - } -} -class TG extends Oc { - constructor(e, r) { - super(e, r, bG, wp, (n) => n.id), this.core = e, this.logger = r; - } -} -class RG { - constructor(e, r) { - this.core = e, this.logger = r, this.authKeys = new IG(this.core, this.logger), this.pairingTopics = new CG(this.core, this.logger), this.requests = new TG(this.core, this.logger); - } - async init() { - await this.authKeys.init(), await this.pairingTopics.init(), await this.requests.init(); - } -} -class Ib extends j$ { - constructor(e) { - super(e), this.protocol = HE, this.version = KE, this.name = Tm.name, this.events = new is.EventEmitter(), this.on = (n, i) => this.events.on(n, i), this.once = (n, i) => this.events.once(n, i), this.off = (n, i) => this.events.off(n, i), this.removeListener = (n, i) => this.events.removeListener(n, i), this.removeAllListeners = (n) => this.events.removeAllListeners(n), this.connect = async (n) => { - try { - return await this.engine.connect(n); - } catch (i) { - throw this.logger.error(i.message), i; - } - }, this.pair = async (n) => { - try { - return await this.engine.pair(n); - } catch (i) { - throw this.logger.error(i.message), i; - } - }, this.approve = async (n) => { - try { - return await this.engine.approve(n); - } catch (i) { - throw this.logger.error(i.message), i; - } - }, this.reject = async (n) => { - try { - return await this.engine.reject(n); - } catch (i) { - throw this.logger.error(i.message), i; - } - }, this.update = async (n) => { - try { - return await this.engine.update(n); - } catch (i) { - throw this.logger.error(i.message), i; - } - }, this.extend = async (n) => { - try { - return await this.engine.extend(n); - } catch (i) { - throw this.logger.error(i.message), i; - } - }, this.request = async (n) => { - try { - return await this.engine.request(n); - } catch (i) { - throw this.logger.error(i.message), i; - } - }, this.respond = async (n) => { - try { - return await this.engine.respond(n); - } catch (i) { - throw this.logger.error(i.message), i; - } - }, this.ping = async (n) => { - try { - return await this.engine.ping(n); - } catch (i) { - throw this.logger.error(i.message), i; - } - }, this.emit = async (n) => { - try { - return await this.engine.emit(n); - } catch (i) { - throw this.logger.error(i.message), i; - } - }, this.disconnect = async (n) => { - try { - return await this.engine.disconnect(n); - } catch (i) { - throw this.logger.error(i.message), i; - } - }, this.find = (n) => { - try { - return this.engine.find(n); - } catch (i) { - throw this.logger.error(i.message), i; - } - }, this.getPendingSessionRequests = () => { - try { - return this.engine.getPendingSessionRequests(); - } catch (n) { - throw this.logger.error(n.message), n; - } - }, this.authenticate = async (n, i) => { - try { - return await this.engine.authenticate(n, i); - } catch (s) { - throw this.logger.error(s.message), s; - } - }, this.formatAuthMessage = (n) => { - try { - return this.engine.formatAuthMessage(n); - } catch (i) { - throw this.logger.error(i.message), i; - } - }, this.approveSessionAuthenticate = async (n) => { - try { - return await this.engine.approveSessionAuthenticate(n); - } catch (i) { - throw this.logger.error(i.message), i; - } - }, this.rejectSessionAuthenticate = async (n) => { - try { - return await this.engine.rejectSessionAuthenticate(n); - } catch (i) { - throw this.logger.error(i.message), i; - } - }, this.name = (e == null ? void 0 : e.name) || Tm.name, this.metadata = (e == null ? void 0 : e.metadata) || aE(), this.signConfig = e == null ? void 0 : e.signConfig; - const r = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : Xl(X0({ level: (e == null ? void 0 : e.logger) || Tm.logger })); - this.core = (e == null ? void 0 : e.core) || new cG(e), this.logger = ui(r, this.name), this.session = new PG(this.core, this.logger), this.proposal = new AG(this.core, this.logger), this.pendingRequest = new MG(this.core, this.logger), this.engine = new SG(this), this.auth = new RG(this.core, this.logger); - } - static async init(e) { - const r = new Ib(e); - return await r.initialize(), r; - } - get context() { - return Pi(this.logger); - } - get pairing() { - return this.core.pairing.pairings; - } - async initialize() { - this.logger.trace("Initialized"); - try { - await this.core.start(), await this.session.init(), await this.proposal.init(), await this.pendingRequest.init(), await this.auth.init(), await this.engine.init(), this.logger.info("SignClient Initialization Success"), this.engine.processRelayMessageCache(); - } catch (e) { - throw this.logger.info("SignClient Initialization Failure"), this.logger.error(e.message), e; - } - } -} -var S0 = { exports: {} }; -/** - * @license - * Lodash - * Copyright OpenJS Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ -S0.exports; -(function(t, e) { - (function() { - var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", u = "__lodash_hash_undefined__", l = 500, d = "__lodash_placeholder__", p = 1, w = 2, _ = 4, P = 1, O = 2, L = 1, B = 2, k = 4, W = 8, U = 16, V = 32, Q = 64, R = 128, K = 256, ge = 512, Ee = 30, Y = "...", A = 800, m = 16, f = 1, g = 2, b = 3, x = 1 / 0, E = 9007199254740991, S = 17976931348623157e292, v = NaN, M = 4294967295, I = M - 1, F = M >>> 1, ce = [ - ["ary", R], - ["bind", L], - ["bindKey", B], - ["curry", W], - ["curryRight", U], - ["flip", ge], - ["partial", V], - ["partialRight", Q], - ["rearg", K] - ], D = "[object Arguments]", oe = "[object Array]", Z = "[object AsyncFunction]", J = "[object Boolean]", ee = "[object Date]", T = "[object DOMException]", X = "[object Error]", re = "[object Function]", pe = "[object GeneratorFunction]", ie = "[object Map]", ue = "[object Number]", ve = "[object Null]", Pe = "[object Object]", De = "[object Promise]", Ce = "[object Proxy]", $e = "[object RegExp]", Me = "[object Set]", Ne = "[object String]", Ke = "[object Symbol]", Le = "[object Undefined]", qe = "[object WeakMap]", ze = "[object WeakSet]", _e = "[object ArrayBuffer]", Ze = "[object DataView]", at = "[object Float32Array]", ke = "[object Float64Array]", Qe = "[object Int8Array]", tt = "[object Int16Array]", Ye = "[object Int32Array]", dt = "[object Uint8Array]", lt = "[object Uint8ClampedArray]", ct = "[object Uint16Array]", qt = "[object Uint32Array]", Jt = /\b__p \+= '';/g, Et = /\b(__p \+=) '' \+/g, er = /(__e\(.*?\)|\b__t\)) \+\n'';/g, Xt = /&(?:amp|lt|gt|quot|#39);/g, Dt = /[&<>"']/g, kt = RegExp(Xt.source), Ct = RegExp(Dt.source), mt = /<%-([\s\S]+?)%>/g, Rt = /<%([\s\S]+?)%>/g, Nt = /<%=([\s\S]+?)%>/g, bt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $t = /^\w*$/, Ft = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, rt = /[\\^$.*+?()[\]{}|]/g, Bt = RegExp(rt.source), $ = /^\s+/, q = /\s/, H = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, C = /\{\n\/\* \[wrapped with (.+)\] \*/, G = /,? & /, j = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, se = /[()=,{}\[\]\/\s]/, de = /\\(\\)?/g, xe = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Te = /\w*$/, Re = /^[-+]0x[0-9a-f]+$/i, nt = /^0b[01]+$/i, je = /^\[object .+?Constructor\]$/, pt = /^0o[0-7]+$/i, it = /^(?:0|[1-9]\d*)$/, et = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, St = /($^)/, Tt = /['\n\r\u2028\u2029\\]/g, At = "\\ud800-\\udfff", _t = "\\u0300-\\u036f", ht = "\\ufe20-\\ufe2f", xt = "\\u20d0-\\u20ff", st = _t + ht + xt, yt = "\\u2700-\\u27bf", ut = "a-z\\xdf-\\xf6\\xf8-\\xff", ot = "\\xac\\xb1\\xd7\\xf7", Se = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Ae = "\\u2000-\\u206f", Ve = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Fe = "A-Z\\xc0-\\xd6\\xd8-\\xde", Ue = "\\ufe0e\\ufe0f", Je = ot + Se + Ae + Ve, Lt = "['’]", zt = "[" + At + "]", Zt = "[" + Je + "]", Wt = "[" + st + "]", he = "\\d+", rr = "[" + yt + "]", dr = "[" + ut + "]", pr = "[^" + At + Je + he + yt + ut + Fe + "]", Qt = "\\ud83c[\\udffb-\\udfff]", gr = "(?:" + Wt + "|" + Qt + ")", lr = "[^" + At + "]", Rr = "(?:\\ud83c[\\udde6-\\uddff]){2}", mr = "[\\ud800-\\udbff][\\udc00-\\udfff]", wr = "[" + Fe + "]", $r = "\\u200d", Br = "(?:" + dr + "|" + pr + ")", Ir = "(?:" + wr + "|" + pr + ")", nn = "(?:" + Lt + "(?:d|ll|m|re|s|t|ve))?", sn = "(?:" + Lt + "(?:D|LL|M|RE|S|T|VE))?", on = gr + "?", wh = "[" + Ue + "]?", Hp = "(?:" + $r + "(?:" + [lr, Rr, mr].join("|") + ")" + wh + on + ")*", ao = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", xh = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", _h = wh + on + Hp, $c = "(?:" + [rr, Rr, mr].join("|") + ")" + _h, Kp = "(?:" + [lr + Wt + "?", Wt, Rr, mr, zt].join("|") + ")", of = RegExp(Lt, "g"), Vp = RegExp(Wt, "g"), Bc = RegExp(Qt + "(?=" + Qt + ")|" + Kp + _h, "g"), Eh = RegExp([ - wr + "?" + dr + "+" + nn + "(?=" + [Zt, wr, "$"].join("|") + ")", - Ir + "+" + sn + "(?=" + [Zt, wr + Br, "$"].join("|") + ")", - wr + "?" + Br + "+" + nn, - wr + "+" + sn, - xh, - ao, - he, - $c - ].join("|"), "g"), Sh = RegExp("[" + $r + At + st + Ue + "]"), Ba = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, Ah = [ - "Array", - "Buffer", - "DataView", - "Date", - "Error", - "Float32Array", - "Float64Array", - "Function", - "Int8Array", - "Int16Array", - "Int32Array", - "Map", - "Math", - "Object", - "Promise", - "RegExp", - "Set", - "String", - "Symbol", - "TypeError", - "Uint8Array", - "Uint8ClampedArray", - "Uint16Array", - "Uint32Array", - "WeakMap", - "_", - "clearTimeout", - "isFinite", - "parseInt", - "setTimeout" - ], Gp = -1, Fr = {}; - Fr[at] = Fr[ke] = Fr[Qe] = Fr[tt] = Fr[Ye] = Fr[dt] = Fr[lt] = Fr[ct] = Fr[qt] = !0, Fr[D] = Fr[oe] = Fr[_e] = Fr[J] = Fr[Ze] = Fr[ee] = Fr[X] = Fr[re] = Fr[ie] = Fr[ue] = Fr[Pe] = Fr[$e] = Fr[Me] = Fr[Ne] = Fr[qe] = !1; - var Dr = {}; - Dr[D] = Dr[oe] = Dr[_e] = Dr[Ze] = Dr[J] = Dr[ee] = Dr[at] = Dr[ke] = Dr[Qe] = Dr[tt] = Dr[Ye] = Dr[ie] = Dr[ue] = Dr[Pe] = Dr[$e] = Dr[Me] = Dr[Ne] = Dr[Ke] = Dr[dt] = Dr[lt] = Dr[ct] = Dr[qt] = !0, Dr[X] = Dr[re] = Dr[qe] = !1; - var ae = { - // Latin-1 Supplement block. - À: "A", - Á: "A", - Â: "A", - Ã: "A", - Ä: "A", - Å: "A", - à: "a", - á: "a", - â: "a", - ã: "a", - ä: "a", - å: "a", - Ç: "C", - ç: "c", - Ð: "D", - ð: "d", - È: "E", - É: "E", - Ê: "E", - Ë: "E", - è: "e", - é: "e", - ê: "e", - ë: "e", - Ì: "I", - Í: "I", - Î: "I", - Ï: "I", - ì: "i", - í: "i", - î: "i", - ï: "i", - Ñ: "N", - ñ: "n", - Ò: "O", - Ó: "O", - Ô: "O", - Õ: "O", - Ö: "O", - Ø: "O", - ò: "o", - ó: "o", - ô: "o", - õ: "o", - ö: "o", - ø: "o", - Ù: "U", - Ú: "U", - Û: "U", - Ü: "U", - ù: "u", - ú: "u", - û: "u", - ü: "u", - Ý: "Y", - ý: "y", - ÿ: "y", - Æ: "Ae", - æ: "ae", - Þ: "Th", - þ: "th", - ß: "ss", - // Latin Extended-A block. - Ā: "A", - Ă: "A", - Ą: "A", - ā: "a", - ă: "a", - ą: "a", - Ć: "C", - Ĉ: "C", - Ċ: "C", - Č: "C", - ć: "c", - ĉ: "c", - ċ: "c", - č: "c", - Ď: "D", - Đ: "D", - ď: "d", - đ: "d", - Ē: "E", - Ĕ: "E", - Ė: "E", - Ę: "E", - Ě: "E", - ē: "e", - ĕ: "e", - ė: "e", - ę: "e", - ě: "e", - Ĝ: "G", - Ğ: "G", - Ġ: "G", - Ģ: "G", - ĝ: "g", - ğ: "g", - ġ: "g", - ģ: "g", - Ĥ: "H", - Ħ: "H", - ĥ: "h", - ħ: "h", - Ĩ: "I", - Ī: "I", - Ĭ: "I", - Į: "I", - İ: "I", - ĩ: "i", - ī: "i", - ĭ: "i", - į: "i", - ı: "i", - Ĵ: "J", - ĵ: "j", - Ķ: "K", - ķ: "k", - ĸ: "k", - Ĺ: "L", - Ļ: "L", - Ľ: "L", - Ŀ: "L", - Ł: "L", - ĺ: "l", - ļ: "l", - ľ: "l", - ŀ: "l", - ł: "l", - Ń: "N", - Ņ: "N", - Ň: "N", - Ŋ: "N", - ń: "n", - ņ: "n", - ň: "n", - ŋ: "n", - Ō: "O", - Ŏ: "O", - Ő: "O", - ō: "o", - ŏ: "o", - ő: "o", - Ŕ: "R", - Ŗ: "R", - Ř: "R", - ŕ: "r", - ŗ: "r", - ř: "r", - Ś: "S", - Ŝ: "S", - Ş: "S", - Š: "S", - ś: "s", - ŝ: "s", - ş: "s", - š: "s", - Ţ: "T", - Ť: "T", - Ŧ: "T", - ţ: "t", - ť: "t", - ŧ: "t", - Ũ: "U", - Ū: "U", - Ŭ: "U", - Ů: "U", - Ű: "U", - Ų: "U", - ũ: "u", - ū: "u", - ŭ: "u", - ů: "u", - ű: "u", - ų: "u", - Ŵ: "W", - ŵ: "w", - Ŷ: "Y", - ŷ: "y", - Ÿ: "Y", - Ź: "Z", - Ż: "Z", - Ž: "Z", - ź: "z", - ż: "z", - ž: "z", - IJ: "IJ", - ij: "ij", - Œ: "Oe", - œ: "oe", - ʼn: "'n", - ſ: "s" - }, ye = { - "&": "&", - "<": "<", - ">": ">", - '"': """, - "'": "'" - }, Ge = { - "&": "&", - "<": "<", - ">": ">", - """: '"', - "'": "'" - }, Pt = { - "\\": "\\", - "'": "'", - "\n": "n", - "\r": "r", - "\u2028": "u2028", - "\u2029": "u2029" - }, jr = parseFloat, nr = parseInt, Kr = typeof gn == "object" && gn && gn.Object === Object && gn, vn = typeof self == "object" && self && self.Object === Object && self, Er = Kr || vn || Function("return this")(), Ur = e && !e.nodeType && e, an = Ur && !0 && t && !t.nodeType && t, fi = an && an.exports === Ur, bn = fi && Kr.process, Vr = function() { - try { - var be = an && an.require && an.require("util").types; - return be || bn && bn.binding && bn.binding("util"); - } catch { - } - }(), ri = Vr && Vr.isArrayBuffer, hs = Vr && Vr.isDate, Ui = Vr && Vr.isMap, Ds = Vr && Vr.isRegExp, af = Vr && Vr.isSet, Fa = Vr && Vr.isTypedArray; - function Pn(be, Be, Ie) { - switch (Ie.length) { - case 0: - return be.call(Be); - case 1: - return be.call(Be, Ie[0]); - case 2: - return be.call(Be, Ie[0], Ie[1]); - case 3: - return be.call(Be, Ie[0], Ie[1], Ie[2]); - } - return be.apply(Be, Ie); - } - function RA(be, Be, Ie, It) { - for (var tr = -1, Mr = be == null ? 0 : be.length; ++tr < Mr; ) { - var _n = be[tr]; - Be(It, _n, Ie(_n), be); - } - return It; - } - function qi(be, Be) { - for (var Ie = -1, It = be == null ? 0 : be.length; ++Ie < It && Be(be[Ie], Ie, be) !== !1; ) - ; - return be; - } - function DA(be, Be) { - for (var Ie = be == null ? 0 : be.length; Ie-- && Be(be[Ie], Ie, be) !== !1; ) - ; - return be; - } - function Cy(be, Be) { - for (var Ie = -1, It = be == null ? 0 : be.length; ++Ie < It; ) - if (!Be(be[Ie], Ie, be)) - return !1; - return !0; - } - function Ko(be, Be) { - for (var Ie = -1, It = be == null ? 0 : be.length, tr = 0, Mr = []; ++Ie < It; ) { - var _n = be[Ie]; - Be(_n, Ie, be) && (Mr[tr++] = _n); - } - return Mr; - } - function Ph(be, Be) { - var Ie = be == null ? 0 : be.length; - return !!Ie && Fc(be, Be, 0) > -1; - } - function Yp(be, Be, Ie) { - for (var It = -1, tr = be == null ? 0 : be.length; ++It < tr; ) - if (Ie(Be, be[It])) - return !0; - return !1; - } - function Xr(be, Be) { - for (var Ie = -1, It = be == null ? 0 : be.length, tr = Array(It); ++Ie < It; ) - tr[Ie] = Be(be[Ie], Ie, be); - return tr; - } - function Vo(be, Be) { - for (var Ie = -1, It = Be.length, tr = be.length; ++Ie < It; ) - be[tr + Ie] = Be[Ie]; - return be; - } - function Jp(be, Be, Ie, It) { - var tr = -1, Mr = be == null ? 0 : be.length; - for (It && Mr && (Ie = be[++tr]); ++tr < Mr; ) - Ie = Be(Ie, be[tr], tr, be); - return Ie; - } - function OA(be, Be, Ie, It) { - var tr = be == null ? 0 : be.length; - for (It && tr && (Ie = be[--tr]); tr--; ) - Ie = Be(Ie, be[tr], tr, be); - return Ie; - } - function Xp(be, Be) { - for (var Ie = -1, It = be == null ? 0 : be.length; ++Ie < It; ) - if (Be(be[Ie], Ie, be)) - return !0; - return !1; - } - var NA = Zp("length"); - function LA(be) { - return be.split(""); - } - function kA(be) { - return be.match(j) || []; - } - function Ty(be, Be, Ie) { - var It; - return Ie(be, function(tr, Mr, _n) { - if (Be(tr, Mr, _n)) - return It = Mr, !1; - }), It; - } - function Mh(be, Be, Ie, It) { - for (var tr = be.length, Mr = Ie + (It ? 1 : -1); It ? Mr-- : ++Mr < tr; ) - if (Be(be[Mr], Mr, be)) - return Mr; - return -1; - } - function Fc(be, Be, Ie) { - return Be === Be ? GA(be, Be, Ie) : Mh(be, Ry, Ie); - } - function $A(be, Be, Ie, It) { - for (var tr = Ie - 1, Mr = be.length; ++tr < Mr; ) - if (It(be[tr], Be)) - return tr; - return -1; - } - function Ry(be) { - return be !== be; - } - function Dy(be, Be) { - var Ie = be == null ? 0 : be.length; - return Ie ? eg(be, Be) / Ie : v; - } - function Zp(be) { - return function(Be) { - return Be == null ? r : Be[be]; - }; - } - function Qp(be) { - return function(Be) { - return be == null ? r : be[Be]; - }; - } - function Oy(be, Be, Ie, It, tr) { - return tr(be, function(Mr, _n, qr) { - Ie = It ? (It = !1, Mr) : Be(Ie, Mr, _n, qr); - }), Ie; - } - function BA(be, Be) { - var Ie = be.length; - for (be.sort(Be); Ie--; ) - be[Ie] = be[Ie].value; - return be; - } - function eg(be, Be) { - for (var Ie, It = -1, tr = be.length; ++It < tr; ) { - var Mr = Be(be[It]); - Mr !== r && (Ie = Ie === r ? Mr : Ie + Mr); - } - return Ie; - } - function tg(be, Be) { - for (var Ie = -1, It = Array(be); ++Ie < be; ) - It[Ie] = Be(Ie); - return It; - } - function FA(be, Be) { - return Xr(Be, function(Ie) { - return [Ie, be[Ie]]; - }); - } - function Ny(be) { - return be && be.slice(0, By(be) + 1).replace($, ""); - } - function Mi(be) { - return function(Be) { - return be(Be); - }; - } - function rg(be, Be) { - return Xr(Be, function(Ie) { - return be[Ie]; - }); - } - function cf(be, Be) { - return be.has(Be); - } - function Ly(be, Be) { - for (var Ie = -1, It = be.length; ++Ie < It && Fc(Be, be[Ie], 0) > -1; ) - ; - return Ie; - } - function ky(be, Be) { - for (var Ie = be.length; Ie-- && Fc(Be, be[Ie], 0) > -1; ) - ; - return Ie; - } - function jA(be, Be) { - for (var Ie = be.length, It = 0; Ie--; ) - be[Ie] === Be && ++It; - return It; - } - var UA = Qp(ae), qA = Qp(ye); - function zA(be) { - return "\\" + Pt[be]; - } - function WA(be, Be) { - return be == null ? r : be[Be]; - } - function jc(be) { - return Sh.test(be); - } - function HA(be) { - return Ba.test(be); - } - function KA(be) { - for (var Be, Ie = []; !(Be = be.next()).done; ) - Ie.push(Be.value); - return Ie; - } - function ng(be) { - var Be = -1, Ie = Array(be.size); - return be.forEach(function(It, tr) { - Ie[++Be] = [tr, It]; - }), Ie; - } - function $y(be, Be) { - return function(Ie) { - return be(Be(Ie)); - }; - } - function Go(be, Be) { - for (var Ie = -1, It = be.length, tr = 0, Mr = []; ++Ie < It; ) { - var _n = be[Ie]; - (_n === Be || _n === d) && (be[Ie] = d, Mr[tr++] = Ie); - } - return Mr; - } - function Ih(be) { - var Be = -1, Ie = Array(be.size); - return be.forEach(function(It) { - Ie[++Be] = It; - }), Ie; - } - function VA(be) { - var Be = -1, Ie = Array(be.size); - return be.forEach(function(It) { - Ie[++Be] = [It, It]; - }), Ie; - } - function GA(be, Be, Ie) { - for (var It = Ie - 1, tr = be.length; ++It < tr; ) - if (be[It] === Be) - return It; - return -1; - } - function YA(be, Be, Ie) { - for (var It = Ie + 1; It--; ) - if (be[It] === Be) - return It; - return It; - } - function Uc(be) { - return jc(be) ? XA(be) : NA(be); - } - function ds(be) { - return jc(be) ? ZA(be) : LA(be); - } - function By(be) { - for (var Be = be.length; Be-- && q.test(be.charAt(Be)); ) - ; - return Be; - } - var JA = Qp(Ge); - function XA(be) { - for (var Be = Bc.lastIndex = 0; Bc.test(be); ) - ++Be; - return Be; - } - function ZA(be) { - return be.match(Bc) || []; - } - function QA(be) { - return be.match(Eh) || []; - } - var eP = function be(Be) { - Be = Be == null ? Er : qc.defaults(Er.Object(), Be, qc.pick(Er, Ah)); - var Ie = Be.Array, It = Be.Date, tr = Be.Error, Mr = Be.Function, _n = Be.Math, qr = Be.Object, ig = Be.RegExp, tP = Be.String, zi = Be.TypeError, Ch = Ie.prototype, rP = Mr.prototype, zc = qr.prototype, Th = Be["__core-js_shared__"], Rh = rP.toString, Tr = zc.hasOwnProperty, nP = 0, Fy = function() { - var c = /[^.]+$/.exec(Th && Th.keys && Th.keys.IE_PROTO || ""); - return c ? "Symbol(src)_1." + c : ""; - }(), Dh = zc.toString, iP = Rh.call(qr), sP = Er._, oP = ig( - "^" + Rh.call(Tr).replace(rt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" - ), Oh = fi ? Be.Buffer : r, Yo = Be.Symbol, Nh = Be.Uint8Array, jy = Oh ? Oh.allocUnsafe : r, Lh = $y(qr.getPrototypeOf, qr), Uy = qr.create, qy = zc.propertyIsEnumerable, kh = Ch.splice, zy = Yo ? Yo.isConcatSpreadable : r, uf = Yo ? Yo.iterator : r, ja = Yo ? Yo.toStringTag : r, $h = function() { - try { - var c = Ha(qr, "defineProperty"); - return c({}, "", {}), c; - } catch { - } - }(), aP = Be.clearTimeout !== Er.clearTimeout && Be.clearTimeout, cP = It && It.now !== Er.Date.now && It.now, uP = Be.setTimeout !== Er.setTimeout && Be.setTimeout, Bh = _n.ceil, Fh = _n.floor, sg = qr.getOwnPropertySymbols, fP = Oh ? Oh.isBuffer : r, Wy = Be.isFinite, lP = Ch.join, hP = $y(qr.keys, qr), En = _n.max, Kn = _n.min, dP = It.now, pP = Be.parseInt, Hy = _n.random, gP = Ch.reverse, og = Ha(Be, "DataView"), ff = Ha(Be, "Map"), ag = Ha(Be, "Promise"), Wc = Ha(Be, "Set"), lf = Ha(Be, "WeakMap"), hf = Ha(qr, "create"), jh = lf && new lf(), Hc = {}, mP = Ka(og), vP = Ka(ff), bP = Ka(ag), yP = Ka(Wc), wP = Ka(lf), Uh = Yo ? Yo.prototype : r, df = Uh ? Uh.valueOf : r, Ky = Uh ? Uh.toString : r; - function te(c) { - if (en(c) && !ir(c) && !(c instanceof xr)) { - if (c instanceof Wi) - return c; - if (Tr.call(c, "__wrapped__")) - return Vw(c); - } - return new Wi(c); - } - var Kc = /* @__PURE__ */ function() { - function c() { - } - return function(h) { - if (!Zr(h)) - return {}; - if (Uy) - return Uy(h); - c.prototype = h; - var y = new c(); - return c.prototype = r, y; - }; - }(); - function qh() { - } - function Wi(c, h) { - this.__wrapped__ = c, this.__actions__ = [], this.__chain__ = !!h, this.__index__ = 0, this.__values__ = r; - } - te.templateSettings = { - /** - * Used to detect `data` property values to be HTML-escaped. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - escape: mt, - /** - * Used to detect code to be evaluated. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - evaluate: Rt, - /** - * Used to detect `data` property values to inject. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - interpolate: Nt, - /** - * Used to reference the data object in the template text. - * - * @memberOf _.templateSettings - * @type {string} - */ - variable: "", - /** - * Used to import variables into the compiled template. - * - * @memberOf _.templateSettings - * @type {Object} - */ - imports: { - /** - * A reference to the `lodash` function. - * - * @memberOf _.templateSettings.imports - * @type {Function} - */ - _: te - } - }, te.prototype = qh.prototype, te.prototype.constructor = te, Wi.prototype = Kc(qh.prototype), Wi.prototype.constructor = Wi; - function xr(c) { - this.__wrapped__ = c, this.__actions__ = [], this.__dir__ = 1, this.__filtered__ = !1, this.__iteratees__ = [], this.__takeCount__ = M, this.__views__ = []; - } - function xP() { - var c = new xr(this.__wrapped__); - return c.__actions__ = li(this.__actions__), c.__dir__ = this.__dir__, c.__filtered__ = this.__filtered__, c.__iteratees__ = li(this.__iteratees__), c.__takeCount__ = this.__takeCount__, c.__views__ = li(this.__views__), c; - } - function _P() { - if (this.__filtered__) { - var c = new xr(this); - c.__dir__ = -1, c.__filtered__ = !0; - } else - c = this.clone(), c.__dir__ *= -1; - return c; - } - function EP() { - var c = this.__wrapped__.value(), h = this.__dir__, y = ir(c), N = h < 0, z = y ? c.length : 0, ne = LM(0, z, this.__views__), fe = ne.start, me = ne.end, we = me - fe, We = N ? me : fe - 1, He = this.__iteratees__, Xe = He.length, wt = 0, Ot = Kn(we, this.__takeCount__); - if (!y || !N && z == we && Ot == we) - return mw(c, this.__actions__); - var Ht = []; - e: - for (; we-- && wt < Ot; ) { - We += h; - for (var fr = -1, Kt = c[We]; ++fr < Xe; ) { - var br = He[fr], Sr = br.iteratee, Ti = br.type, si = Sr(Kt); - if (Ti == g) - Kt = si; - else if (!si) { - if (Ti == f) - continue e; - break e; - } - } - Ht[wt++] = Kt; - } - return Ht; - } - xr.prototype = Kc(qh.prototype), xr.prototype.constructor = xr; - function Ua(c) { - var h = -1, y = c == null ? 0 : c.length; - for (this.clear(); ++h < y; ) { - var N = c[h]; - this.set(N[0], N[1]); - } - } - function SP() { - this.__data__ = hf ? hf(null) : {}, this.size = 0; - } - function AP(c) { - var h = this.has(c) && delete this.__data__[c]; - return this.size -= h ? 1 : 0, h; - } - function PP(c) { - var h = this.__data__; - if (hf) { - var y = h[c]; - return y === u ? r : y; - } - return Tr.call(h, c) ? h[c] : r; - } - function MP(c) { - var h = this.__data__; - return hf ? h[c] !== r : Tr.call(h, c); - } - function IP(c, h) { - var y = this.__data__; - return this.size += this.has(c) ? 0 : 1, y[c] = hf && h === r ? u : h, this; - } - Ua.prototype.clear = SP, Ua.prototype.delete = AP, Ua.prototype.get = PP, Ua.prototype.has = MP, Ua.prototype.set = IP; - function co(c) { - var h = -1, y = c == null ? 0 : c.length; - for (this.clear(); ++h < y; ) { - var N = c[h]; - this.set(N[0], N[1]); - } - } - function CP() { - this.__data__ = [], this.size = 0; - } - function TP(c) { - var h = this.__data__, y = zh(h, c); - if (y < 0) - return !1; - var N = h.length - 1; - return y == N ? h.pop() : kh.call(h, y, 1), --this.size, !0; - } - function RP(c) { - var h = this.__data__, y = zh(h, c); - return y < 0 ? r : h[y][1]; - } - function DP(c) { - return zh(this.__data__, c) > -1; - } - function OP(c, h) { - var y = this.__data__, N = zh(y, c); - return N < 0 ? (++this.size, y.push([c, h])) : y[N][1] = h, this; - } - co.prototype.clear = CP, co.prototype.delete = TP, co.prototype.get = RP, co.prototype.has = DP, co.prototype.set = OP; - function uo(c) { - var h = -1, y = c == null ? 0 : c.length; - for (this.clear(); ++h < y; ) { - var N = c[h]; - this.set(N[0], N[1]); - } - } - function NP() { - this.size = 0, this.__data__ = { - hash: new Ua(), - map: new (ff || co)(), - string: new Ua() - }; - } - function LP(c) { - var h = td(this, c).delete(c); - return this.size -= h ? 1 : 0, h; - } - function kP(c) { - return td(this, c).get(c); - } - function $P(c) { - return td(this, c).has(c); - } - function BP(c, h) { - var y = td(this, c), N = y.size; - return y.set(c, h), this.size += y.size == N ? 0 : 1, this; - } - uo.prototype.clear = NP, uo.prototype.delete = LP, uo.prototype.get = kP, uo.prototype.has = $P, uo.prototype.set = BP; - function qa(c) { - var h = -1, y = c == null ? 0 : c.length; - for (this.__data__ = new uo(); ++h < y; ) - this.add(c[h]); - } - function FP(c) { - return this.__data__.set(c, u), this; - } - function jP(c) { - return this.__data__.has(c); - } - qa.prototype.add = qa.prototype.push = FP, qa.prototype.has = jP; - function ps(c) { - var h = this.__data__ = new co(c); - this.size = h.size; - } - function UP() { - this.__data__ = new co(), this.size = 0; - } - function qP(c) { - var h = this.__data__, y = h.delete(c); - return this.size = h.size, y; - } - function zP(c) { - return this.__data__.get(c); - } - function WP(c) { - return this.__data__.has(c); - } - function HP(c, h) { - var y = this.__data__; - if (y instanceof co) { - var N = y.__data__; - if (!ff || N.length < i - 1) - return N.push([c, h]), this.size = ++y.size, this; - y = this.__data__ = new uo(N); - } - return y.set(c, h), this.size = y.size, this; - } - ps.prototype.clear = UP, ps.prototype.delete = qP, ps.prototype.get = zP, ps.prototype.has = WP, ps.prototype.set = HP; - function Vy(c, h) { - var y = ir(c), N = !y && Va(c), z = !y && !N && ea(c), ne = !y && !N && !z && Jc(c), fe = y || N || z || ne, me = fe ? tg(c.length, tP) : [], we = me.length; - for (var We in c) - (h || Tr.call(c, We)) && !(fe && // Safari 9 has enumerable `arguments.length` in strict mode. - (We == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. - z && (We == "offset" || We == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. - ne && (We == "buffer" || We == "byteLength" || We == "byteOffset") || // Skip index properties. - po(We, we))) && me.push(We); - return me; - } - function Gy(c) { - var h = c.length; - return h ? c[bg(0, h - 1)] : r; - } - function KP(c, h) { - return rd(li(c), za(h, 0, c.length)); - } - function VP(c) { - return rd(li(c)); - } - function cg(c, h, y) { - (y !== r && !gs(c[h], y) || y === r && !(h in c)) && fo(c, h, y); - } - function pf(c, h, y) { - var N = c[h]; - (!(Tr.call(c, h) && gs(N, y)) || y === r && !(h in c)) && fo(c, h, y); - } - function zh(c, h) { - for (var y = c.length; y--; ) - if (gs(c[y][0], h)) - return y; - return -1; - } - function GP(c, h, y, N) { - return Jo(c, function(z, ne, fe) { - h(N, z, y(z), fe); - }), N; - } - function Yy(c, h) { - return c && Ns(h, Mn(h), c); - } - function YP(c, h) { - return c && Ns(h, di(h), c); - } - function fo(c, h, y) { - h == "__proto__" && $h ? $h(c, h, { - configurable: !0, - enumerable: !0, - value: y, - writable: !0 - }) : c[h] = y; - } - function ug(c, h) { - for (var y = -1, N = h.length, z = Ie(N), ne = c == null; ++y < N; ) - z[y] = ne ? r : zg(c, h[y]); - return z; - } - function za(c, h, y) { - return c === c && (y !== r && (c = c <= y ? c : y), h !== r && (c = c >= h ? c : h)), c; - } - function Hi(c, h, y, N, z, ne) { - var fe, me = h & p, we = h & w, We = h & _; - if (y && (fe = z ? y(c, N, z, ne) : y(c)), fe !== r) - return fe; - if (!Zr(c)) - return c; - var He = ir(c); - if (He) { - if (fe = $M(c), !me) - return li(c, fe); - } else { - var Xe = Vn(c), wt = Xe == re || Xe == pe; - if (ea(c)) - return yw(c, me); - if (Xe == Pe || Xe == D || wt && !z) { - if (fe = we || wt ? {} : Bw(c), !me) - return we ? PM(c, YP(fe, c)) : AM(c, Yy(fe, c)); - } else { - if (!Dr[Xe]) - return z ? c : {}; - fe = BM(c, Xe, me); - } - } - ne || (ne = new ps()); - var Ot = ne.get(c); - if (Ot) - return Ot; - ne.set(c, fe), d2(c) ? c.forEach(function(Kt) { - fe.add(Hi(Kt, h, y, Kt, c, ne)); - }) : l2(c) && c.forEach(function(Kt, br) { - fe.set(br, Hi(Kt, h, y, br, c, ne)); - }); - var Ht = We ? we ? Cg : Ig : we ? di : Mn, fr = He ? r : Ht(c); - return qi(fr || c, function(Kt, br) { - fr && (br = Kt, Kt = c[br]), pf(fe, br, Hi(Kt, h, y, br, c, ne)); - }), fe; - } - function JP(c) { - var h = Mn(c); - return function(y) { - return Jy(y, c, h); - }; - } - function Jy(c, h, y) { - var N = y.length; - if (c == null) - return !N; - for (c = qr(c); N--; ) { - var z = y[N], ne = h[z], fe = c[z]; - if (fe === r && !(z in c) || !ne(fe)) - return !1; - } - return !0; - } - function Xy(c, h, y) { - if (typeof c != "function") - throw new zi(o); - return xf(function() { - c.apply(r, y); - }, h); - } - function gf(c, h, y, N) { - var z = -1, ne = Ph, fe = !0, me = c.length, we = [], We = h.length; - if (!me) - return we; - y && (h = Xr(h, Mi(y))), N ? (ne = Yp, fe = !1) : h.length >= i && (ne = cf, fe = !1, h = new qa(h)); - e: - for (; ++z < me; ) { - var He = c[z], Xe = y == null ? He : y(He); - if (He = N || He !== 0 ? He : 0, fe && Xe === Xe) { - for (var wt = We; wt--; ) - if (h[wt] === Xe) - continue e; - we.push(He); - } else ne(h, Xe, N) || we.push(He); - } - return we; - } - var Jo = Sw(Os), Zy = Sw(lg, !0); - function XP(c, h) { - var y = !0; - return Jo(c, function(N, z, ne) { - return y = !!h(N, z, ne), y; - }), y; - } - function Wh(c, h, y) { - for (var N = -1, z = c.length; ++N < z; ) { - var ne = c[N], fe = h(ne); - if (fe != null && (me === r ? fe === fe && !Ci(fe) : y(fe, me))) - var me = fe, we = ne; - } - return we; - } - function ZP(c, h, y, N) { - var z = c.length; - for (y = cr(y), y < 0 && (y = -y > z ? 0 : z + y), N = N === r || N > z ? z : cr(N), N < 0 && (N += z), N = y > N ? 0 : g2(N); y < N; ) - c[y++] = h; - return c; - } - function Qy(c, h) { - var y = []; - return Jo(c, function(N, z, ne) { - h(N, z, ne) && y.push(N); - }), y; - } - function Bn(c, h, y, N, z) { - var ne = -1, fe = c.length; - for (y || (y = jM), z || (z = []); ++ne < fe; ) { - var me = c[ne]; - h > 0 && y(me) ? h > 1 ? Bn(me, h - 1, y, N, z) : Vo(z, me) : N || (z[z.length] = me); - } - return z; - } - var fg = Aw(), ew = Aw(!0); - function Os(c, h) { - return c && fg(c, h, Mn); - } - function lg(c, h) { - return c && ew(c, h, Mn); - } - function Hh(c, h) { - return Ko(h, function(y) { - return go(c[y]); - }); - } - function Wa(c, h) { - h = Zo(h, c); - for (var y = 0, N = h.length; c != null && y < N; ) - c = c[Ls(h[y++])]; - return y && y == N ? c : r; - } - function tw(c, h, y) { - var N = h(c); - return ir(c) ? N : Vo(N, y(c)); - } - function ni(c) { - return c == null ? c === r ? Le : ve : ja && ja in qr(c) ? NM(c) : VM(c); - } - function hg(c, h) { - return c > h; - } - function QP(c, h) { - return c != null && Tr.call(c, h); - } - function eM(c, h) { - return c != null && h in qr(c); - } - function tM(c, h, y) { - return c >= Kn(h, y) && c < En(h, y); - } - function dg(c, h, y) { - for (var N = y ? Yp : Ph, z = c[0].length, ne = c.length, fe = ne, me = Ie(ne), we = 1 / 0, We = []; fe--; ) { - var He = c[fe]; - fe && h && (He = Xr(He, Mi(h))), we = Kn(He.length, we), me[fe] = !y && (h || z >= 120 && He.length >= 120) ? new qa(fe && He) : r; - } - He = c[0]; - var Xe = -1, wt = me[0]; - e: - for (; ++Xe < z && We.length < we; ) { - var Ot = He[Xe], Ht = h ? h(Ot) : Ot; - if (Ot = y || Ot !== 0 ? Ot : 0, !(wt ? cf(wt, Ht) : N(We, Ht, y))) { - for (fe = ne; --fe; ) { - var fr = me[fe]; - if (!(fr ? cf(fr, Ht) : N(c[fe], Ht, y))) - continue e; - } - wt && wt.push(Ht), We.push(Ot); - } - } - return We; - } - function rM(c, h, y, N) { - return Os(c, function(z, ne, fe) { - h(N, y(z), ne, fe); - }), N; - } - function mf(c, h, y) { - h = Zo(h, c), c = qw(c, h); - var N = c == null ? c : c[Ls(Vi(h))]; - return N == null ? r : Pn(N, c, y); - } - function rw(c) { - return en(c) && ni(c) == D; - } - function nM(c) { - return en(c) && ni(c) == _e; - } - function iM(c) { - return en(c) && ni(c) == ee; - } - function vf(c, h, y, N, z) { - return c === h ? !0 : c == null || h == null || !en(c) && !en(h) ? c !== c && h !== h : sM(c, h, y, N, vf, z); - } - function sM(c, h, y, N, z, ne) { - var fe = ir(c), me = ir(h), we = fe ? oe : Vn(c), We = me ? oe : Vn(h); - we = we == D ? Pe : we, We = We == D ? Pe : We; - var He = we == Pe, Xe = We == Pe, wt = we == We; - if (wt && ea(c)) { - if (!ea(h)) - return !1; - fe = !0, He = !1; - } - if (wt && !He) - return ne || (ne = new ps()), fe || Jc(c) ? Lw(c, h, y, N, z, ne) : DM(c, h, we, y, N, z, ne); - if (!(y & P)) { - var Ot = He && Tr.call(c, "__wrapped__"), Ht = Xe && Tr.call(h, "__wrapped__"); - if (Ot || Ht) { - var fr = Ot ? c.value() : c, Kt = Ht ? h.value() : h; - return ne || (ne = new ps()), z(fr, Kt, y, N, ne); - } - } - return wt ? (ne || (ne = new ps()), OM(c, h, y, N, z, ne)) : !1; - } - function oM(c) { - return en(c) && Vn(c) == ie; - } - function pg(c, h, y, N) { - var z = y.length, ne = z, fe = !N; - if (c == null) - return !ne; - for (c = qr(c); z--; ) { - var me = y[z]; - if (fe && me[2] ? me[1] !== c[me[0]] : !(me[0] in c)) - return !1; - } - for (; ++z < ne; ) { - me = y[z]; - var we = me[0], We = c[we], He = me[1]; - if (fe && me[2]) { - if (We === r && !(we in c)) - return !1; - } else { - var Xe = new ps(); - if (N) - var wt = N(We, He, we, c, h, Xe); - if (!(wt === r ? vf(He, We, P | O, N, Xe) : wt)) - return !1; - } - } - return !0; - } - function nw(c) { - if (!Zr(c) || qM(c)) - return !1; - var h = go(c) ? oP : je; - return h.test(Ka(c)); - } - function aM(c) { - return en(c) && ni(c) == $e; - } - function cM(c) { - return en(c) && Vn(c) == Me; - } - function uM(c) { - return en(c) && cd(c.length) && !!Fr[ni(c)]; - } - function iw(c) { - return typeof c == "function" ? c : c == null ? pi : typeof c == "object" ? ir(c) ? aw(c[0], c[1]) : ow(c) : P2(c); - } - function gg(c) { - if (!wf(c)) - return hP(c); - var h = []; - for (var y in qr(c)) - Tr.call(c, y) && y != "constructor" && h.push(y); - return h; - } - function fM(c) { - if (!Zr(c)) - return KM(c); - var h = wf(c), y = []; - for (var N in c) - N == "constructor" && (h || !Tr.call(c, N)) || y.push(N); - return y; - } - function mg(c, h) { - return c < h; - } - function sw(c, h) { - var y = -1, N = hi(c) ? Ie(c.length) : []; - return Jo(c, function(z, ne, fe) { - N[++y] = h(z, ne, fe); - }), N; - } - function ow(c) { - var h = Rg(c); - return h.length == 1 && h[0][2] ? jw(h[0][0], h[0][1]) : function(y) { - return y === c || pg(y, c, h); - }; - } - function aw(c, h) { - return Og(c) && Fw(h) ? jw(Ls(c), h) : function(y) { - var N = zg(y, c); - return N === r && N === h ? Wg(y, c) : vf(h, N, P | O); - }; - } - function Kh(c, h, y, N, z) { - c !== h && fg(h, function(ne, fe) { - if (z || (z = new ps()), Zr(ne)) - lM(c, h, fe, y, Kh, N, z); - else { - var me = N ? N(Lg(c, fe), ne, fe + "", c, h, z) : r; - me === r && (me = ne), cg(c, fe, me); - } - }, di); - } - function lM(c, h, y, N, z, ne, fe) { - var me = Lg(c, y), we = Lg(h, y), We = fe.get(we); - if (We) { - cg(c, y, We); - return; - } - var He = ne ? ne(me, we, y + "", c, h, fe) : r, Xe = He === r; - if (Xe) { - var wt = ir(we), Ot = !wt && ea(we), Ht = !wt && !Ot && Jc(we); - He = we, wt || Ot || Ht ? ir(me) ? He = me : cn(me) ? He = li(me) : Ot ? (Xe = !1, He = yw(we, !0)) : Ht ? (Xe = !1, He = ww(we, !0)) : He = [] : _f(we) || Va(we) ? (He = me, Va(me) ? He = m2(me) : (!Zr(me) || go(me)) && (He = Bw(we))) : Xe = !1; - } - Xe && (fe.set(we, He), z(He, we, N, ne, fe), fe.delete(we)), cg(c, y, He); - } - function cw(c, h) { - var y = c.length; - if (y) - return h += h < 0 ? y : 0, po(h, y) ? c[h] : r; - } - function uw(c, h, y) { - h.length ? h = Xr(h, function(ne) { - return ir(ne) ? function(fe) { - return Wa(fe, ne.length === 1 ? ne[0] : ne); - } : ne; - }) : h = [pi]; - var N = -1; - h = Xr(h, Mi(Ut())); - var z = sw(c, function(ne, fe, me) { - var we = Xr(h, function(We) { - return We(ne); - }); - return { criteria: we, index: ++N, value: ne }; - }); - return BA(z, function(ne, fe) { - return SM(ne, fe, y); - }); - } - function hM(c, h) { - return fw(c, h, function(y, N) { - return Wg(c, N); - }); - } - function fw(c, h, y) { - for (var N = -1, z = h.length, ne = {}; ++N < z; ) { - var fe = h[N], me = Wa(c, fe); - y(me, fe) && bf(ne, Zo(fe, c), me); - } - return ne; - } - function dM(c) { - return function(h) { - return Wa(h, c); - }; - } - function vg(c, h, y, N) { - var z = N ? $A : Fc, ne = -1, fe = h.length, me = c; - for (c === h && (h = li(h)), y && (me = Xr(c, Mi(y))); ++ne < fe; ) - for (var we = 0, We = h[ne], He = y ? y(We) : We; (we = z(me, He, we, N)) > -1; ) - me !== c && kh.call(me, we, 1), kh.call(c, we, 1); - return c; - } - function lw(c, h) { - for (var y = c ? h.length : 0, N = y - 1; y--; ) { - var z = h[y]; - if (y == N || z !== ne) { - var ne = z; - po(z) ? kh.call(c, z, 1) : xg(c, z); - } - } - return c; - } - function bg(c, h) { - return c + Fh(Hy() * (h - c + 1)); - } - function pM(c, h, y, N) { - for (var z = -1, ne = En(Bh((h - c) / (y || 1)), 0), fe = Ie(ne); ne--; ) - fe[N ? ne : ++z] = c, c += y; - return fe; - } - function yg(c, h) { - var y = ""; - if (!c || h < 1 || h > E) - return y; - do - h % 2 && (y += c), h = Fh(h / 2), h && (c += c); - while (h); - return y; - } - function hr(c, h) { - return kg(Uw(c, h, pi), c + ""); - } - function gM(c) { - return Gy(Xc(c)); - } - function mM(c, h) { - var y = Xc(c); - return rd(y, za(h, 0, y.length)); - } - function bf(c, h, y, N) { - if (!Zr(c)) - return c; - h = Zo(h, c); - for (var z = -1, ne = h.length, fe = ne - 1, me = c; me != null && ++z < ne; ) { - var we = Ls(h[z]), We = y; - if (we === "__proto__" || we === "constructor" || we === "prototype") - return c; - if (z != fe) { - var He = me[we]; - We = N ? N(He, we, me) : r, We === r && (We = Zr(He) ? He : po(h[z + 1]) ? [] : {}); - } - pf(me, we, We), me = me[we]; - } - return c; - } - var hw = jh ? function(c, h) { - return jh.set(c, h), c; - } : pi, vM = $h ? function(c, h) { - return $h(c, "toString", { - configurable: !0, - enumerable: !1, - value: Kg(h), - writable: !0 - }); - } : pi; - function bM(c) { - return rd(Xc(c)); - } - function Ki(c, h, y) { - var N = -1, z = c.length; - h < 0 && (h = -h > z ? 0 : z + h), y = y > z ? z : y, y < 0 && (y += z), z = h > y ? 0 : y - h >>> 0, h >>>= 0; - for (var ne = Ie(z); ++N < z; ) - ne[N] = c[N + h]; - return ne; - } - function yM(c, h) { - var y; - return Jo(c, function(N, z, ne) { - return y = h(N, z, ne), !y; - }), !!y; - } - function Vh(c, h, y) { - var N = 0, z = c == null ? N : c.length; - if (typeof h == "number" && h === h && z <= F) { - for (; N < z; ) { - var ne = N + z >>> 1, fe = c[ne]; - fe !== null && !Ci(fe) && (y ? fe <= h : fe < h) ? N = ne + 1 : z = ne; - } - return z; - } - return wg(c, h, pi, y); - } - function wg(c, h, y, N) { - var z = 0, ne = c == null ? 0 : c.length; - if (ne === 0) - return 0; - h = y(h); - for (var fe = h !== h, me = h === null, we = Ci(h), We = h === r; z < ne; ) { - var He = Fh((z + ne) / 2), Xe = y(c[He]), wt = Xe !== r, Ot = Xe === null, Ht = Xe === Xe, fr = Ci(Xe); - if (fe) - var Kt = N || Ht; - else We ? Kt = Ht && (N || wt) : me ? Kt = Ht && wt && (N || !Ot) : we ? Kt = Ht && wt && !Ot && (N || !fr) : Ot || fr ? Kt = !1 : Kt = N ? Xe <= h : Xe < h; - Kt ? z = He + 1 : ne = He; - } - return Kn(ne, I); - } - function dw(c, h) { - for (var y = -1, N = c.length, z = 0, ne = []; ++y < N; ) { - var fe = c[y], me = h ? h(fe) : fe; - if (!y || !gs(me, we)) { - var we = me; - ne[z++] = fe === 0 ? 0 : fe; - } - } - return ne; - } - function pw(c) { - return typeof c == "number" ? c : Ci(c) ? v : +c; - } - function Ii(c) { - if (typeof c == "string") - return c; - if (ir(c)) - return Xr(c, Ii) + ""; - if (Ci(c)) - return Ky ? Ky.call(c) : ""; - var h = c + ""; - return h == "0" && 1 / c == -x ? "-0" : h; - } - function Xo(c, h, y) { - var N = -1, z = Ph, ne = c.length, fe = !0, me = [], we = me; - if (y) - fe = !1, z = Yp; - else if (ne >= i) { - var We = h ? null : TM(c); - if (We) - return Ih(We); - fe = !1, z = cf, we = new qa(); - } else - we = h ? [] : me; - e: - for (; ++N < ne; ) { - var He = c[N], Xe = h ? h(He) : He; - if (He = y || He !== 0 ? He : 0, fe && Xe === Xe) { - for (var wt = we.length; wt--; ) - if (we[wt] === Xe) - continue e; - h && we.push(Xe), me.push(He); - } else z(we, Xe, y) || (we !== me && we.push(Xe), me.push(He)); - } - return me; - } - function xg(c, h) { - return h = Zo(h, c), c = qw(c, h), c == null || delete c[Ls(Vi(h))]; - } - function gw(c, h, y, N) { - return bf(c, h, y(Wa(c, h)), N); - } - function Gh(c, h, y, N) { - for (var z = c.length, ne = N ? z : -1; (N ? ne-- : ++ne < z) && h(c[ne], ne, c); ) - ; - return y ? Ki(c, N ? 0 : ne, N ? ne + 1 : z) : Ki(c, N ? ne + 1 : 0, N ? z : ne); - } - function mw(c, h) { - var y = c; - return y instanceof xr && (y = y.value()), Jp(h, function(N, z) { - return z.func.apply(z.thisArg, Vo([N], z.args)); - }, y); - } - function _g(c, h, y) { - var N = c.length; - if (N < 2) - return N ? Xo(c[0]) : []; - for (var z = -1, ne = Ie(N); ++z < N; ) - for (var fe = c[z], me = -1; ++me < N; ) - me != z && (ne[z] = gf(ne[z] || fe, c[me], h, y)); - return Xo(Bn(ne, 1), h, y); - } - function vw(c, h, y) { - for (var N = -1, z = c.length, ne = h.length, fe = {}; ++N < z; ) { - var me = N < ne ? h[N] : r; - y(fe, c[N], me); - } - return fe; - } - function Eg(c) { - return cn(c) ? c : []; - } - function Sg(c) { - return typeof c == "function" ? c : pi; - } - function Zo(c, h) { - return ir(c) ? c : Og(c, h) ? [c] : Kw(Cr(c)); - } - var wM = hr; - function Qo(c, h, y) { - var N = c.length; - return y = y === r ? N : y, !h && y >= N ? c : Ki(c, h, y); - } - var bw = aP || function(c) { - return Er.clearTimeout(c); - }; - function yw(c, h) { - if (h) - return c.slice(); - var y = c.length, N = jy ? jy(y) : new c.constructor(y); - return c.copy(N), N; - } - function Ag(c) { - var h = new c.constructor(c.byteLength); - return new Nh(h).set(new Nh(c)), h; - } - function xM(c, h) { - var y = h ? Ag(c.buffer) : c.buffer; - return new c.constructor(y, c.byteOffset, c.byteLength); - } - function _M(c) { - var h = new c.constructor(c.source, Te.exec(c)); - return h.lastIndex = c.lastIndex, h; - } - function EM(c) { - return df ? qr(df.call(c)) : {}; - } - function ww(c, h) { - var y = h ? Ag(c.buffer) : c.buffer; - return new c.constructor(y, c.byteOffset, c.length); - } - function xw(c, h) { - if (c !== h) { - var y = c !== r, N = c === null, z = c === c, ne = Ci(c), fe = h !== r, me = h === null, we = h === h, We = Ci(h); - if (!me && !We && !ne && c > h || ne && fe && we && !me && !We || N && fe && we || !y && we || !z) - return 1; - if (!N && !ne && !We && c < h || We && y && z && !N && !ne || me && y && z || !fe && z || !we) - return -1; - } - return 0; - } - function SM(c, h, y) { - for (var N = -1, z = c.criteria, ne = h.criteria, fe = z.length, me = y.length; ++N < fe; ) { - var we = xw(z[N], ne[N]); - if (we) { - if (N >= me) - return we; - var We = y[N]; - return we * (We == "desc" ? -1 : 1); - } - } - return c.index - h.index; - } - function _w(c, h, y, N) { - for (var z = -1, ne = c.length, fe = y.length, me = -1, we = h.length, We = En(ne - fe, 0), He = Ie(we + We), Xe = !N; ++me < we; ) - He[me] = h[me]; - for (; ++z < fe; ) - (Xe || z < ne) && (He[y[z]] = c[z]); - for (; We--; ) - He[me++] = c[z++]; - return He; - } - function Ew(c, h, y, N) { - for (var z = -1, ne = c.length, fe = -1, me = y.length, we = -1, We = h.length, He = En(ne - me, 0), Xe = Ie(He + We), wt = !N; ++z < He; ) - Xe[z] = c[z]; - for (var Ot = z; ++we < We; ) - Xe[Ot + we] = h[we]; - for (; ++fe < me; ) - (wt || z < ne) && (Xe[Ot + y[fe]] = c[z++]); - return Xe; - } - function li(c, h) { - var y = -1, N = c.length; - for (h || (h = Ie(N)); ++y < N; ) - h[y] = c[y]; - return h; - } - function Ns(c, h, y, N) { - var z = !y; - y || (y = {}); - for (var ne = -1, fe = h.length; ++ne < fe; ) { - var me = h[ne], we = N ? N(y[me], c[me], me, y, c) : r; - we === r && (we = c[me]), z ? fo(y, me, we) : pf(y, me, we); - } - return y; - } - function AM(c, h) { - return Ns(c, Dg(c), h); - } - function PM(c, h) { - return Ns(c, kw(c), h); - } - function Yh(c, h) { - return function(y, N) { - var z = ir(y) ? RA : GP, ne = h ? h() : {}; - return z(y, c, Ut(N, 2), ne); - }; - } - function Vc(c) { - return hr(function(h, y) { - var N = -1, z = y.length, ne = z > 1 ? y[z - 1] : r, fe = z > 2 ? y[2] : r; - for (ne = c.length > 3 && typeof ne == "function" ? (z--, ne) : r, fe && ii(y[0], y[1], fe) && (ne = z < 3 ? r : ne, z = 1), h = qr(h); ++N < z; ) { - var me = y[N]; - me && c(h, me, N, ne); - } - return h; - }); - } - function Sw(c, h) { - return function(y, N) { - if (y == null) - return y; - if (!hi(y)) - return c(y, N); - for (var z = y.length, ne = h ? z : -1, fe = qr(y); (h ? ne-- : ++ne < z) && N(fe[ne], ne, fe) !== !1; ) - ; - return y; - }; - } - function Aw(c) { - return function(h, y, N) { - for (var z = -1, ne = qr(h), fe = N(h), me = fe.length; me--; ) { - var we = fe[c ? me : ++z]; - if (y(ne[we], we, ne) === !1) - break; - } - return h; - }; - } - function MM(c, h, y) { - var N = h & L, z = yf(c); - function ne() { - var fe = this && this !== Er && this instanceof ne ? z : c; - return fe.apply(N ? y : this, arguments); - } - return ne; - } - function Pw(c) { - return function(h) { - h = Cr(h); - var y = jc(h) ? ds(h) : r, N = y ? y[0] : h.charAt(0), z = y ? Qo(y, 1).join("") : h.slice(1); - return N[c]() + z; - }; - } - function Gc(c) { - return function(h) { - return Jp(S2(E2(h).replace(of, "")), c, ""); - }; - } - function yf(c) { - return function() { - var h = arguments; - switch (h.length) { - case 0: - return new c(); - case 1: - return new c(h[0]); - case 2: - return new c(h[0], h[1]); - case 3: - return new c(h[0], h[1], h[2]); - case 4: - return new c(h[0], h[1], h[2], h[3]); - case 5: - return new c(h[0], h[1], h[2], h[3], h[4]); - case 6: - return new c(h[0], h[1], h[2], h[3], h[4], h[5]); - case 7: - return new c(h[0], h[1], h[2], h[3], h[4], h[5], h[6]); - } - var y = Kc(c.prototype), N = c.apply(y, h); - return Zr(N) ? N : y; - }; - } - function IM(c, h, y) { - var N = yf(c); - function z() { - for (var ne = arguments.length, fe = Ie(ne), me = ne, we = Yc(z); me--; ) - fe[me] = arguments[me]; - var We = ne < 3 && fe[0] !== we && fe[ne - 1] !== we ? [] : Go(fe, we); - if (ne -= We.length, ne < y) - return Rw( - c, - h, - Jh, - z.placeholder, - r, - fe, - We, - r, - r, - y - ne - ); - var He = this && this !== Er && this instanceof z ? N : c; - return Pn(He, this, fe); - } - return z; - } - function Mw(c) { - return function(h, y, N) { - var z = qr(h); - if (!hi(h)) { - var ne = Ut(y, 3); - h = Mn(h), y = function(me) { - return ne(z[me], me, z); - }; - } - var fe = c(h, y, N); - return fe > -1 ? z[ne ? h[fe] : fe] : r; - }; - } - function Iw(c) { - return ho(function(h) { - var y = h.length, N = y, z = Wi.prototype.thru; - for (c && h.reverse(); N--; ) { - var ne = h[N]; - if (typeof ne != "function") - throw new zi(o); - if (z && !fe && ed(ne) == "wrapper") - var fe = new Wi([], !0); - } - for (N = fe ? N : y; ++N < y; ) { - ne = h[N]; - var me = ed(ne), we = me == "wrapper" ? Tg(ne) : r; - we && Ng(we[0]) && we[1] == (R | W | V | K) && !we[4].length && we[9] == 1 ? fe = fe[ed(we[0])].apply(fe, we[3]) : fe = ne.length == 1 && Ng(ne) ? fe[me]() : fe.thru(ne); - } - return function() { - var We = arguments, He = We[0]; - if (fe && We.length == 1 && ir(He)) - return fe.plant(He).value(); - for (var Xe = 0, wt = y ? h[Xe].apply(this, We) : He; ++Xe < y; ) - wt = h[Xe].call(this, wt); - return wt; - }; - }); - } - function Jh(c, h, y, N, z, ne, fe, me, we, We) { - var He = h & R, Xe = h & L, wt = h & B, Ot = h & (W | U), Ht = h & ge, fr = wt ? r : yf(c); - function Kt() { - for (var br = arguments.length, Sr = Ie(br), Ti = br; Ti--; ) - Sr[Ti] = arguments[Ti]; - if (Ot) - var si = Yc(Kt), Ri = jA(Sr, si); - if (N && (Sr = _w(Sr, N, z, Ot)), ne && (Sr = Ew(Sr, ne, fe, Ot)), br -= Ri, Ot && br < We) { - var un = Go(Sr, si); - return Rw( - c, - h, - Jh, - Kt.placeholder, - y, - Sr, - un, - me, - we, - We - br - ); - } - var ms = Xe ? y : this, vo = wt ? ms[c] : c; - return br = Sr.length, me ? Sr = GM(Sr, me) : Ht && br > 1 && Sr.reverse(), He && we < br && (Sr.length = we), this && this !== Er && this instanceof Kt && (vo = fr || yf(vo)), vo.apply(ms, Sr); - } - return Kt; - } - function Cw(c, h) { - return function(y, N) { - return rM(y, c, h(N), {}); - }; - } - function Xh(c, h) { - return function(y, N) { - var z; - if (y === r && N === r) - return h; - if (y !== r && (z = y), N !== r) { - if (z === r) - return N; - typeof y == "string" || typeof N == "string" ? (y = Ii(y), N = Ii(N)) : (y = pw(y), N = pw(N)), z = c(y, N); - } - return z; - }; - } - function Pg(c) { - return ho(function(h) { - return h = Xr(h, Mi(Ut())), hr(function(y) { - var N = this; - return c(h, function(z) { - return Pn(z, N, y); - }); - }); - }); - } - function Zh(c, h) { - h = h === r ? " " : Ii(h); - var y = h.length; - if (y < 2) - return y ? yg(h, c) : h; - var N = yg(h, Bh(c / Uc(h))); - return jc(h) ? Qo(ds(N), 0, c).join("") : N.slice(0, c); - } - function CM(c, h, y, N) { - var z = h & L, ne = yf(c); - function fe() { - for (var me = -1, we = arguments.length, We = -1, He = N.length, Xe = Ie(He + we), wt = this && this !== Er && this instanceof fe ? ne : c; ++We < He; ) - Xe[We] = N[We]; - for (; we--; ) - Xe[We++] = arguments[++me]; - return Pn(wt, z ? y : this, Xe); - } - return fe; - } - function Tw(c) { - return function(h, y, N) { - return N && typeof N != "number" && ii(h, y, N) && (y = N = r), h = mo(h), y === r ? (y = h, h = 0) : y = mo(y), N = N === r ? h < y ? 1 : -1 : mo(N), pM(h, y, N, c); - }; - } - function Qh(c) { - return function(h, y) { - return typeof h == "string" && typeof y == "string" || (h = Gi(h), y = Gi(y)), c(h, y); - }; - } - function Rw(c, h, y, N, z, ne, fe, me, we, We) { - var He = h & W, Xe = He ? fe : r, wt = He ? r : fe, Ot = He ? ne : r, Ht = He ? r : ne; - h |= He ? V : Q, h &= ~(He ? Q : V), h & k || (h &= ~(L | B)); - var fr = [ - c, - h, - z, - Ot, - Xe, - Ht, - wt, - me, - we, - We - ], Kt = y.apply(r, fr); - return Ng(c) && zw(Kt, fr), Kt.placeholder = N, Ww(Kt, c, h); - } - function Mg(c) { - var h = _n[c]; - return function(y, N) { - if (y = Gi(y), N = N == null ? 0 : Kn(cr(N), 292), N && Wy(y)) { - var z = (Cr(y) + "e").split("e"), ne = h(z[0] + "e" + (+z[1] + N)); - return z = (Cr(ne) + "e").split("e"), +(z[0] + "e" + (+z[1] - N)); - } - return h(y); - }; - } - var TM = Wc && 1 / Ih(new Wc([, -0]))[1] == x ? function(c) { - return new Wc(c); - } : Yg; - function Dw(c) { - return function(h) { - var y = Vn(h); - return y == ie ? ng(h) : y == Me ? VA(h) : FA(h, c(h)); - }; - } - function lo(c, h, y, N, z, ne, fe, me) { - var we = h & B; - if (!we && typeof c != "function") - throw new zi(o); - var We = N ? N.length : 0; - if (We || (h &= ~(V | Q), N = z = r), fe = fe === r ? fe : En(cr(fe), 0), me = me === r ? me : cr(me), We -= z ? z.length : 0, h & Q) { - var He = N, Xe = z; - N = z = r; - } - var wt = we ? r : Tg(c), Ot = [ - c, - h, - y, - N, - z, - He, - Xe, - ne, - fe, - me - ]; - if (wt && HM(Ot, wt), c = Ot[0], h = Ot[1], y = Ot[2], N = Ot[3], z = Ot[4], me = Ot[9] = Ot[9] === r ? we ? 0 : c.length : En(Ot[9] - We, 0), !me && h & (W | U) && (h &= ~(W | U)), !h || h == L) - var Ht = MM(c, h, y); - else h == W || h == U ? Ht = IM(c, h, me) : (h == V || h == (L | V)) && !z.length ? Ht = CM(c, h, y, N) : Ht = Jh.apply(r, Ot); - var fr = wt ? hw : zw; - return Ww(fr(Ht, Ot), c, h); - } - function Ow(c, h, y, N) { - return c === r || gs(c, zc[y]) && !Tr.call(N, y) ? h : c; - } - function Nw(c, h, y, N, z, ne) { - return Zr(c) && Zr(h) && (ne.set(h, c), Kh(c, h, r, Nw, ne), ne.delete(h)), c; - } - function RM(c) { - return _f(c) ? r : c; - } - function Lw(c, h, y, N, z, ne) { - var fe = y & P, me = c.length, we = h.length; - if (me != we && !(fe && we > me)) - return !1; - var We = ne.get(c), He = ne.get(h); - if (We && He) - return We == h && He == c; - var Xe = -1, wt = !0, Ot = y & O ? new qa() : r; - for (ne.set(c, h), ne.set(h, c); ++Xe < me; ) { - var Ht = c[Xe], fr = h[Xe]; - if (N) - var Kt = fe ? N(fr, Ht, Xe, h, c, ne) : N(Ht, fr, Xe, c, h, ne); - if (Kt !== r) { - if (Kt) - continue; - wt = !1; - break; - } - if (Ot) { - if (!Xp(h, function(br, Sr) { - if (!cf(Ot, Sr) && (Ht === br || z(Ht, br, y, N, ne))) - return Ot.push(Sr); - })) { - wt = !1; - break; - } - } else if (!(Ht === fr || z(Ht, fr, y, N, ne))) { - wt = !1; - break; - } - } - return ne.delete(c), ne.delete(h), wt; - } - function DM(c, h, y, N, z, ne, fe) { - switch (y) { - case Ze: - if (c.byteLength != h.byteLength || c.byteOffset != h.byteOffset) - return !1; - c = c.buffer, h = h.buffer; - case _e: - return !(c.byteLength != h.byteLength || !ne(new Nh(c), new Nh(h))); - case J: - case ee: - case ue: - return gs(+c, +h); - case X: - return c.name == h.name && c.message == h.message; - case $e: - case Ne: - return c == h + ""; - case ie: - var me = ng; - case Me: - var we = N & P; - if (me || (me = Ih), c.size != h.size && !we) - return !1; - var We = fe.get(c); - if (We) - return We == h; - N |= O, fe.set(c, h); - var He = Lw(me(c), me(h), N, z, ne, fe); - return fe.delete(c), He; - case Ke: - if (df) - return df.call(c) == df.call(h); - } - return !1; - } - function OM(c, h, y, N, z, ne) { - var fe = y & P, me = Ig(c), we = me.length, We = Ig(h), He = We.length; - if (we != He && !fe) - return !1; - for (var Xe = we; Xe--; ) { - var wt = me[Xe]; - if (!(fe ? wt in h : Tr.call(h, wt))) - return !1; - } - var Ot = ne.get(c), Ht = ne.get(h); - if (Ot && Ht) - return Ot == h && Ht == c; - var fr = !0; - ne.set(c, h), ne.set(h, c); - for (var Kt = fe; ++Xe < we; ) { - wt = me[Xe]; - var br = c[wt], Sr = h[wt]; - if (N) - var Ti = fe ? N(Sr, br, wt, h, c, ne) : N(br, Sr, wt, c, h, ne); - if (!(Ti === r ? br === Sr || z(br, Sr, y, N, ne) : Ti)) { - fr = !1; - break; - } - Kt || (Kt = wt == "constructor"); - } - if (fr && !Kt) { - var si = c.constructor, Ri = h.constructor; - si != Ri && "constructor" in c && "constructor" in h && !(typeof si == "function" && si instanceof si && typeof Ri == "function" && Ri instanceof Ri) && (fr = !1); - } - return ne.delete(c), ne.delete(h), fr; - } - function ho(c) { - return kg(Uw(c, r, Jw), c + ""); - } - function Ig(c) { - return tw(c, Mn, Dg); - } - function Cg(c) { - return tw(c, di, kw); - } - var Tg = jh ? function(c) { - return jh.get(c); - } : Yg; - function ed(c) { - for (var h = c.name + "", y = Hc[h], N = Tr.call(Hc, h) ? y.length : 0; N--; ) { - var z = y[N], ne = z.func; - if (ne == null || ne == c) - return z.name; - } - return h; - } - function Yc(c) { - var h = Tr.call(te, "placeholder") ? te : c; - return h.placeholder; - } - function Ut() { - var c = te.iteratee || Vg; - return c = c === Vg ? iw : c, arguments.length ? c(arguments[0], arguments[1]) : c; - } - function td(c, h) { - var y = c.__data__; - return UM(h) ? y[typeof h == "string" ? "string" : "hash"] : y.map; - } - function Rg(c) { - for (var h = Mn(c), y = h.length; y--; ) { - var N = h[y], z = c[N]; - h[y] = [N, z, Fw(z)]; - } - return h; - } - function Ha(c, h) { - var y = WA(c, h); - return nw(y) ? y : r; - } - function NM(c) { - var h = Tr.call(c, ja), y = c[ja]; - try { - c[ja] = r; - var N = !0; - } catch { - } - var z = Dh.call(c); - return N && (h ? c[ja] = y : delete c[ja]), z; - } - var Dg = sg ? function(c) { - return c == null ? [] : (c = qr(c), Ko(sg(c), function(h) { - return qy.call(c, h); - })); - } : Jg, kw = sg ? function(c) { - for (var h = []; c; ) - Vo(h, Dg(c)), c = Lh(c); - return h; - } : Jg, Vn = ni; - (og && Vn(new og(new ArrayBuffer(1))) != Ze || ff && Vn(new ff()) != ie || ag && Vn(ag.resolve()) != De || Wc && Vn(new Wc()) != Me || lf && Vn(new lf()) != qe) && (Vn = function(c) { - var h = ni(c), y = h == Pe ? c.constructor : r, N = y ? Ka(y) : ""; - if (N) - switch (N) { - case mP: - return Ze; - case vP: - return ie; - case bP: - return De; - case yP: - return Me; - case wP: - return qe; - } - return h; - }); - function LM(c, h, y) { - for (var N = -1, z = y.length; ++N < z; ) { - var ne = y[N], fe = ne.size; - switch (ne.type) { - case "drop": - c += fe; - break; - case "dropRight": - h -= fe; - break; - case "take": - h = Kn(h, c + fe); - break; - case "takeRight": - c = En(c, h - fe); - break; - } - } - return { start: c, end: h }; - } - function kM(c) { - var h = c.match(C); - return h ? h[1].split(G) : []; - } - function $w(c, h, y) { - h = Zo(h, c); - for (var N = -1, z = h.length, ne = !1; ++N < z; ) { - var fe = Ls(h[N]); - if (!(ne = c != null && y(c, fe))) - break; - c = c[fe]; - } - return ne || ++N != z ? ne : (z = c == null ? 0 : c.length, !!z && cd(z) && po(fe, z) && (ir(c) || Va(c))); - } - function $M(c) { - var h = c.length, y = new c.constructor(h); - return h && typeof c[0] == "string" && Tr.call(c, "index") && (y.index = c.index, y.input = c.input), y; - } - function Bw(c) { - return typeof c.constructor == "function" && !wf(c) ? Kc(Lh(c)) : {}; - } - function BM(c, h, y) { - var N = c.constructor; - switch (h) { - case _e: - return Ag(c); - case J: - case ee: - return new N(+c); - case Ze: - return xM(c, y); - case at: - case ke: - case Qe: - case tt: - case Ye: - case dt: - case lt: - case ct: - case qt: - return ww(c, y); - case ie: - return new N(); - case ue: - case Ne: - return new N(c); - case $e: - return _M(c); - case Me: - return new N(); - case Ke: - return EM(c); - } - } - function FM(c, h) { - var y = h.length; - if (!y) - return c; - var N = y - 1; - return h[N] = (y > 1 ? "& " : "") + h[N], h = h.join(y > 2 ? ", " : " "), c.replace(H, `{ -/* [wrapped with ` + h + `] */ -`); - } - function jM(c) { - return ir(c) || Va(c) || !!(zy && c && c[zy]); - } - function po(c, h) { - var y = typeof c; - return h = h ?? E, !!h && (y == "number" || y != "symbol" && it.test(c)) && c > -1 && c % 1 == 0 && c < h; - } - function ii(c, h, y) { - if (!Zr(y)) - return !1; - var N = typeof h; - return (N == "number" ? hi(y) && po(h, y.length) : N == "string" && h in y) ? gs(y[h], c) : !1; - } - function Og(c, h) { - if (ir(c)) - return !1; - var y = typeof c; - return y == "number" || y == "symbol" || y == "boolean" || c == null || Ci(c) ? !0 : $t.test(c) || !bt.test(c) || h != null && c in qr(h); - } - function UM(c) { - var h = typeof c; - return h == "string" || h == "number" || h == "symbol" || h == "boolean" ? c !== "__proto__" : c === null; - } - function Ng(c) { - var h = ed(c), y = te[h]; - if (typeof y != "function" || !(h in xr.prototype)) - return !1; - if (c === y) - return !0; - var N = Tg(y); - return !!N && c === N[0]; - } - function qM(c) { - return !!Fy && Fy in c; - } - var zM = Th ? go : Xg; - function wf(c) { - var h = c && c.constructor, y = typeof h == "function" && h.prototype || zc; - return c === y; - } - function Fw(c) { - return c === c && !Zr(c); - } - function jw(c, h) { - return function(y) { - return y == null ? !1 : y[c] === h && (h !== r || c in qr(y)); - }; - } - function WM(c) { - var h = od(c, function(N) { - return y.size === l && y.clear(), N; - }), y = h.cache; - return h; - } - function HM(c, h) { - var y = c[1], N = h[1], z = y | N, ne = z < (L | B | R), fe = N == R && y == W || N == R && y == K && c[7].length <= h[8] || N == (R | K) && h[7].length <= h[8] && y == W; - if (!(ne || fe)) - return c; - N & L && (c[2] = h[2], z |= y & L ? 0 : k); - var me = h[3]; - if (me) { - var we = c[3]; - c[3] = we ? _w(we, me, h[4]) : me, c[4] = we ? Go(c[3], d) : h[4]; - } - return me = h[5], me && (we = c[5], c[5] = we ? Ew(we, me, h[6]) : me, c[6] = we ? Go(c[5], d) : h[6]), me = h[7], me && (c[7] = me), N & R && (c[8] = c[8] == null ? h[8] : Kn(c[8], h[8])), c[9] == null && (c[9] = h[9]), c[0] = h[0], c[1] = z, c; - } - function KM(c) { - var h = []; - if (c != null) - for (var y in qr(c)) - h.push(y); - return h; - } - function VM(c) { - return Dh.call(c); - } - function Uw(c, h, y) { - return h = En(h === r ? c.length - 1 : h, 0), function() { - for (var N = arguments, z = -1, ne = En(N.length - h, 0), fe = Ie(ne); ++z < ne; ) - fe[z] = N[h + z]; - z = -1; - for (var me = Ie(h + 1); ++z < h; ) - me[z] = N[z]; - return me[h] = y(fe), Pn(c, this, me); - }; - } - function qw(c, h) { - return h.length < 2 ? c : Wa(c, Ki(h, 0, -1)); - } - function GM(c, h) { - for (var y = c.length, N = Kn(h.length, y), z = li(c); N--; ) { - var ne = h[N]; - c[N] = po(ne, y) ? z[ne] : r; - } - return c; - } - function Lg(c, h) { - if (!(h === "constructor" && typeof c[h] == "function") && h != "__proto__") - return c[h]; - } - var zw = Hw(hw), xf = uP || function(c, h) { - return Er.setTimeout(c, h); - }, kg = Hw(vM); - function Ww(c, h, y) { - var N = h + ""; - return kg(c, FM(N, YM(kM(N), y))); - } - function Hw(c) { - var h = 0, y = 0; - return function() { - var N = dP(), z = m - (N - y); - if (y = N, z > 0) { - if (++h >= A) - return arguments[0]; - } else - h = 0; - return c.apply(r, arguments); - }; - } - function rd(c, h) { - var y = -1, N = c.length, z = N - 1; - for (h = h === r ? N : h; ++y < h; ) { - var ne = bg(y, z), fe = c[ne]; - c[ne] = c[y], c[y] = fe; - } - return c.length = h, c; - } - var Kw = WM(function(c) { - var h = []; - return c.charCodeAt(0) === 46 && h.push(""), c.replace(Ft, function(y, N, z, ne) { - h.push(z ? ne.replace(de, "$1") : N || y); - }), h; - }); - function Ls(c) { - if (typeof c == "string" || Ci(c)) - return c; - var h = c + ""; - return h == "0" && 1 / c == -x ? "-0" : h; - } - function Ka(c) { - if (c != null) { - try { - return Rh.call(c); - } catch { - } - try { - return c + ""; - } catch { - } - } - return ""; - } - function YM(c, h) { - return qi(ce, function(y) { - var N = "_." + y[0]; - h & y[1] && !Ph(c, N) && c.push(N); - }), c.sort(); - } - function Vw(c) { - if (c instanceof xr) - return c.clone(); - var h = new Wi(c.__wrapped__, c.__chain__); - return h.__actions__ = li(c.__actions__), h.__index__ = c.__index__, h.__values__ = c.__values__, h; - } - function JM(c, h, y) { - (y ? ii(c, h, y) : h === r) ? h = 1 : h = En(cr(h), 0); - var N = c == null ? 0 : c.length; - if (!N || h < 1) - return []; - for (var z = 0, ne = 0, fe = Ie(Bh(N / h)); z < N; ) - fe[ne++] = Ki(c, z, z += h); - return fe; - } - function XM(c) { - for (var h = -1, y = c == null ? 0 : c.length, N = 0, z = []; ++h < y; ) { - var ne = c[h]; - ne && (z[N++] = ne); - } - return z; - } - function ZM() { - var c = arguments.length; - if (!c) - return []; - for (var h = Ie(c - 1), y = arguments[0], N = c; N--; ) - h[N - 1] = arguments[N]; - return Vo(ir(y) ? li(y) : [y], Bn(h, 1)); - } - var QM = hr(function(c, h) { - return cn(c) ? gf(c, Bn(h, 1, cn, !0)) : []; - }), eI = hr(function(c, h) { - var y = Vi(h); - return cn(y) && (y = r), cn(c) ? gf(c, Bn(h, 1, cn, !0), Ut(y, 2)) : []; - }), tI = hr(function(c, h) { - var y = Vi(h); - return cn(y) && (y = r), cn(c) ? gf(c, Bn(h, 1, cn, !0), r, y) : []; - }); - function rI(c, h, y) { - var N = c == null ? 0 : c.length; - return N ? (h = y || h === r ? 1 : cr(h), Ki(c, h < 0 ? 0 : h, N)) : []; - } - function nI(c, h, y) { - var N = c == null ? 0 : c.length; - return N ? (h = y || h === r ? 1 : cr(h), h = N - h, Ki(c, 0, h < 0 ? 0 : h)) : []; - } - function iI(c, h) { - return c && c.length ? Gh(c, Ut(h, 3), !0, !0) : []; - } - function sI(c, h) { - return c && c.length ? Gh(c, Ut(h, 3), !0) : []; - } - function oI(c, h, y, N) { - var z = c == null ? 0 : c.length; - return z ? (y && typeof y != "number" && ii(c, h, y) && (y = 0, N = z), ZP(c, h, y, N)) : []; - } - function Gw(c, h, y) { - var N = c == null ? 0 : c.length; - if (!N) - return -1; - var z = y == null ? 0 : cr(y); - return z < 0 && (z = En(N + z, 0)), Mh(c, Ut(h, 3), z); - } - function Yw(c, h, y) { - var N = c == null ? 0 : c.length; - if (!N) - return -1; - var z = N - 1; - return y !== r && (z = cr(y), z = y < 0 ? En(N + z, 0) : Kn(z, N - 1)), Mh(c, Ut(h, 3), z, !0); - } - function Jw(c) { - var h = c == null ? 0 : c.length; - return h ? Bn(c, 1) : []; - } - function aI(c) { - var h = c == null ? 0 : c.length; - return h ? Bn(c, x) : []; - } - function cI(c, h) { - var y = c == null ? 0 : c.length; - return y ? (h = h === r ? 1 : cr(h), Bn(c, h)) : []; - } - function uI(c) { - for (var h = -1, y = c == null ? 0 : c.length, N = {}; ++h < y; ) { - var z = c[h]; - N[z[0]] = z[1]; - } - return N; - } - function Xw(c) { - return c && c.length ? c[0] : r; - } - function fI(c, h, y) { - var N = c == null ? 0 : c.length; - if (!N) - return -1; - var z = y == null ? 0 : cr(y); - return z < 0 && (z = En(N + z, 0)), Fc(c, h, z); - } - function lI(c) { - var h = c == null ? 0 : c.length; - return h ? Ki(c, 0, -1) : []; - } - var hI = hr(function(c) { - var h = Xr(c, Eg); - return h.length && h[0] === c[0] ? dg(h) : []; - }), dI = hr(function(c) { - var h = Vi(c), y = Xr(c, Eg); - return h === Vi(y) ? h = r : y.pop(), y.length && y[0] === c[0] ? dg(y, Ut(h, 2)) : []; - }), pI = hr(function(c) { - var h = Vi(c), y = Xr(c, Eg); - return h = typeof h == "function" ? h : r, h && y.pop(), y.length && y[0] === c[0] ? dg(y, r, h) : []; - }); - function gI(c, h) { - return c == null ? "" : lP.call(c, h); - } - function Vi(c) { - var h = c == null ? 0 : c.length; - return h ? c[h - 1] : r; - } - function mI(c, h, y) { - var N = c == null ? 0 : c.length; - if (!N) - return -1; - var z = N; - return y !== r && (z = cr(y), z = z < 0 ? En(N + z, 0) : Kn(z, N - 1)), h === h ? YA(c, h, z) : Mh(c, Ry, z, !0); - } - function vI(c, h) { - return c && c.length ? cw(c, cr(h)) : r; - } - var bI = hr(Zw); - function Zw(c, h) { - return c && c.length && h && h.length ? vg(c, h) : c; - } - function yI(c, h, y) { - return c && c.length && h && h.length ? vg(c, h, Ut(y, 2)) : c; - } - function wI(c, h, y) { - return c && c.length && h && h.length ? vg(c, h, r, y) : c; - } - var xI = ho(function(c, h) { - var y = c == null ? 0 : c.length, N = ug(c, h); - return lw(c, Xr(h, function(z) { - return po(z, y) ? +z : z; - }).sort(xw)), N; - }); - function _I(c, h) { - var y = []; - if (!(c && c.length)) - return y; - var N = -1, z = [], ne = c.length; - for (h = Ut(h, 3); ++N < ne; ) { - var fe = c[N]; - h(fe, N, c) && (y.push(fe), z.push(N)); - } - return lw(c, z), y; - } - function $g(c) { - return c == null ? c : gP.call(c); - } - function EI(c, h, y) { - var N = c == null ? 0 : c.length; - return N ? (y && typeof y != "number" && ii(c, h, y) ? (h = 0, y = N) : (h = h == null ? 0 : cr(h), y = y === r ? N : cr(y)), Ki(c, h, y)) : []; - } - function SI(c, h) { - return Vh(c, h); - } - function AI(c, h, y) { - return wg(c, h, Ut(y, 2)); - } - function PI(c, h) { - var y = c == null ? 0 : c.length; - if (y) { - var N = Vh(c, h); - if (N < y && gs(c[N], h)) - return N; - } - return -1; - } - function MI(c, h) { - return Vh(c, h, !0); - } - function II(c, h, y) { - return wg(c, h, Ut(y, 2), !0); - } - function CI(c, h) { - var y = c == null ? 0 : c.length; - if (y) { - var N = Vh(c, h, !0) - 1; - if (gs(c[N], h)) - return N; - } - return -1; - } - function TI(c) { - return c && c.length ? dw(c) : []; - } - function RI(c, h) { - return c && c.length ? dw(c, Ut(h, 2)) : []; - } - function DI(c) { - var h = c == null ? 0 : c.length; - return h ? Ki(c, 1, h) : []; - } - function OI(c, h, y) { - return c && c.length ? (h = y || h === r ? 1 : cr(h), Ki(c, 0, h < 0 ? 0 : h)) : []; - } - function NI(c, h, y) { - var N = c == null ? 0 : c.length; - return N ? (h = y || h === r ? 1 : cr(h), h = N - h, Ki(c, h < 0 ? 0 : h, N)) : []; - } - function LI(c, h) { - return c && c.length ? Gh(c, Ut(h, 3), !1, !0) : []; - } - function kI(c, h) { - return c && c.length ? Gh(c, Ut(h, 3)) : []; - } - var $I = hr(function(c) { - return Xo(Bn(c, 1, cn, !0)); - }), BI = hr(function(c) { - var h = Vi(c); - return cn(h) && (h = r), Xo(Bn(c, 1, cn, !0), Ut(h, 2)); - }), FI = hr(function(c) { - var h = Vi(c); - return h = typeof h == "function" ? h : r, Xo(Bn(c, 1, cn, !0), r, h); - }); - function jI(c) { - return c && c.length ? Xo(c) : []; - } - function UI(c, h) { - return c && c.length ? Xo(c, Ut(h, 2)) : []; - } - function qI(c, h) { - return h = typeof h == "function" ? h : r, c && c.length ? Xo(c, r, h) : []; - } - function Bg(c) { - if (!(c && c.length)) - return []; - var h = 0; - return c = Ko(c, function(y) { - if (cn(y)) - return h = En(y.length, h), !0; - }), tg(h, function(y) { - return Xr(c, Zp(y)); - }); - } - function Qw(c, h) { - if (!(c && c.length)) - return []; - var y = Bg(c); - return h == null ? y : Xr(y, function(N) { - return Pn(h, r, N); - }); - } - var zI = hr(function(c, h) { - return cn(c) ? gf(c, h) : []; - }), WI = hr(function(c) { - return _g(Ko(c, cn)); - }), HI = hr(function(c) { - var h = Vi(c); - return cn(h) && (h = r), _g(Ko(c, cn), Ut(h, 2)); - }), KI = hr(function(c) { - var h = Vi(c); - return h = typeof h == "function" ? h : r, _g(Ko(c, cn), r, h); - }), VI = hr(Bg); - function GI(c, h) { - return vw(c || [], h || [], pf); - } - function YI(c, h) { - return vw(c || [], h || [], bf); - } - var JI = hr(function(c) { - var h = c.length, y = h > 1 ? c[h - 1] : r; - return y = typeof y == "function" ? (c.pop(), y) : r, Qw(c, y); - }); - function e2(c) { - var h = te(c); - return h.__chain__ = !0, h; - } - function XI(c, h) { - return h(c), c; - } - function nd(c, h) { - return h(c); - } - var ZI = ho(function(c) { - var h = c.length, y = h ? c[0] : 0, N = this.__wrapped__, z = function(ne) { - return ug(ne, c); - }; - return h > 1 || this.__actions__.length || !(N instanceof xr) || !po(y) ? this.thru(z) : (N = N.slice(y, +y + (h ? 1 : 0)), N.__actions__.push({ - func: nd, - args: [z], - thisArg: r - }), new Wi(N, this.__chain__).thru(function(ne) { - return h && !ne.length && ne.push(r), ne; - })); - }); - function QI() { - return e2(this); - } - function eC() { - return new Wi(this.value(), this.__chain__); - } - function tC() { - this.__values__ === r && (this.__values__ = p2(this.value())); - var c = this.__index__ >= this.__values__.length, h = c ? r : this.__values__[this.__index__++]; - return { done: c, value: h }; - } - function rC() { - return this; - } - function nC(c) { - for (var h, y = this; y instanceof qh; ) { - var N = Vw(y); - N.__index__ = 0, N.__values__ = r, h ? z.__wrapped__ = N : h = N; - var z = N; - y = y.__wrapped__; - } - return z.__wrapped__ = c, h; - } - function iC() { - var c = this.__wrapped__; - if (c instanceof xr) { - var h = c; - return this.__actions__.length && (h = new xr(this)), h = h.reverse(), h.__actions__.push({ - func: nd, - args: [$g], - thisArg: r - }), new Wi(h, this.__chain__); - } - return this.thru($g); - } - function sC() { - return mw(this.__wrapped__, this.__actions__); - } - var oC = Yh(function(c, h, y) { - Tr.call(c, y) ? ++c[y] : fo(c, y, 1); - }); - function aC(c, h, y) { - var N = ir(c) ? Cy : XP; - return y && ii(c, h, y) && (h = r), N(c, Ut(h, 3)); - } - function cC(c, h) { - var y = ir(c) ? Ko : Qy; - return y(c, Ut(h, 3)); - } - var uC = Mw(Gw), fC = Mw(Yw); - function lC(c, h) { - return Bn(id(c, h), 1); - } - function hC(c, h) { - return Bn(id(c, h), x); - } - function dC(c, h, y) { - return y = y === r ? 1 : cr(y), Bn(id(c, h), y); - } - function t2(c, h) { - var y = ir(c) ? qi : Jo; - return y(c, Ut(h, 3)); - } - function r2(c, h) { - var y = ir(c) ? DA : Zy; - return y(c, Ut(h, 3)); - } - var pC = Yh(function(c, h, y) { - Tr.call(c, y) ? c[y].push(h) : fo(c, y, [h]); - }); - function gC(c, h, y, N) { - c = hi(c) ? c : Xc(c), y = y && !N ? cr(y) : 0; - var z = c.length; - return y < 0 && (y = En(z + y, 0)), ud(c) ? y <= z && c.indexOf(h, y) > -1 : !!z && Fc(c, h, y) > -1; - } - var mC = hr(function(c, h, y) { - var N = -1, z = typeof h == "function", ne = hi(c) ? Ie(c.length) : []; - return Jo(c, function(fe) { - ne[++N] = z ? Pn(h, fe, y) : mf(fe, h, y); - }), ne; - }), vC = Yh(function(c, h, y) { - fo(c, y, h); - }); - function id(c, h) { - var y = ir(c) ? Xr : sw; - return y(c, Ut(h, 3)); - } - function bC(c, h, y, N) { - return c == null ? [] : (ir(h) || (h = h == null ? [] : [h]), y = N ? r : y, ir(y) || (y = y == null ? [] : [y]), uw(c, h, y)); - } - var yC = Yh(function(c, h, y) { - c[y ? 0 : 1].push(h); - }, function() { - return [[], []]; - }); - function wC(c, h, y) { - var N = ir(c) ? Jp : Oy, z = arguments.length < 3; - return N(c, Ut(h, 4), y, z, Jo); - } - function xC(c, h, y) { - var N = ir(c) ? OA : Oy, z = arguments.length < 3; - return N(c, Ut(h, 4), y, z, Zy); - } - function _C(c, h) { - var y = ir(c) ? Ko : Qy; - return y(c, ad(Ut(h, 3))); - } - function EC(c) { - var h = ir(c) ? Gy : gM; - return h(c); - } - function SC(c, h, y) { - (y ? ii(c, h, y) : h === r) ? h = 1 : h = cr(h); - var N = ir(c) ? KP : mM; - return N(c, h); - } - function AC(c) { - var h = ir(c) ? VP : bM; - return h(c); - } - function PC(c) { - if (c == null) - return 0; - if (hi(c)) - return ud(c) ? Uc(c) : c.length; - var h = Vn(c); - return h == ie || h == Me ? c.size : gg(c).length; - } - function MC(c, h, y) { - var N = ir(c) ? Xp : yM; - return y && ii(c, h, y) && (h = r), N(c, Ut(h, 3)); - } - var IC = hr(function(c, h) { - if (c == null) - return []; - var y = h.length; - return y > 1 && ii(c, h[0], h[1]) ? h = [] : y > 2 && ii(h[0], h[1], h[2]) && (h = [h[0]]), uw(c, Bn(h, 1), []); - }), sd = cP || function() { - return Er.Date.now(); - }; - function CC(c, h) { - if (typeof h != "function") - throw new zi(o); - return c = cr(c), function() { - if (--c < 1) - return h.apply(this, arguments); - }; - } - function n2(c, h, y) { - return h = y ? r : h, h = c && h == null ? c.length : h, lo(c, R, r, r, r, r, h); - } - function i2(c, h) { - var y; - if (typeof h != "function") - throw new zi(o); - return c = cr(c), function() { - return --c > 0 && (y = h.apply(this, arguments)), c <= 1 && (h = r), y; - }; - } - var Fg = hr(function(c, h, y) { - var N = L; - if (y.length) { - var z = Go(y, Yc(Fg)); - N |= V; - } - return lo(c, N, h, y, z); - }), s2 = hr(function(c, h, y) { - var N = L | B; - if (y.length) { - var z = Go(y, Yc(s2)); - N |= V; - } - return lo(h, N, c, y, z); - }); - function o2(c, h, y) { - h = y ? r : h; - var N = lo(c, W, r, r, r, r, r, h); - return N.placeholder = o2.placeholder, N; - } - function a2(c, h, y) { - h = y ? r : h; - var N = lo(c, U, r, r, r, r, r, h); - return N.placeholder = a2.placeholder, N; - } - function c2(c, h, y) { - var N, z, ne, fe, me, we, We = 0, He = !1, Xe = !1, wt = !0; - if (typeof c != "function") - throw new zi(o); - h = Gi(h) || 0, Zr(y) && (He = !!y.leading, Xe = "maxWait" in y, ne = Xe ? En(Gi(y.maxWait) || 0, h) : ne, wt = "trailing" in y ? !!y.trailing : wt); - function Ot(un) { - var ms = N, vo = z; - return N = z = r, We = un, fe = c.apply(vo, ms), fe; - } - function Ht(un) { - return We = un, me = xf(br, h), He ? Ot(un) : fe; - } - function fr(un) { - var ms = un - we, vo = un - We, M2 = h - ms; - return Xe ? Kn(M2, ne - vo) : M2; - } - function Kt(un) { - var ms = un - we, vo = un - We; - return we === r || ms >= h || ms < 0 || Xe && vo >= ne; - } - function br() { - var un = sd(); - if (Kt(un)) - return Sr(un); - me = xf(br, fr(un)); - } - function Sr(un) { - return me = r, wt && N ? Ot(un) : (N = z = r, fe); - } - function Ti() { - me !== r && bw(me), We = 0, N = we = z = me = r; - } - function si() { - return me === r ? fe : Sr(sd()); - } - function Ri() { - var un = sd(), ms = Kt(un); - if (N = arguments, z = this, we = un, ms) { - if (me === r) - return Ht(we); - if (Xe) - return bw(me), me = xf(br, h), Ot(we); - } - return me === r && (me = xf(br, h)), fe; - } - return Ri.cancel = Ti, Ri.flush = si, Ri; - } - var TC = hr(function(c, h) { - return Xy(c, 1, h); - }), RC = hr(function(c, h, y) { - return Xy(c, Gi(h) || 0, y); - }); - function DC(c) { - return lo(c, ge); - } - function od(c, h) { - if (typeof c != "function" || h != null && typeof h != "function") - throw new zi(o); - var y = function() { - var N = arguments, z = h ? h.apply(this, N) : N[0], ne = y.cache; - if (ne.has(z)) - return ne.get(z); - var fe = c.apply(this, N); - return y.cache = ne.set(z, fe) || ne, fe; - }; - return y.cache = new (od.Cache || uo)(), y; - } - od.Cache = uo; - function ad(c) { - if (typeof c != "function") - throw new zi(o); - return function() { - var h = arguments; - switch (h.length) { - case 0: - return !c.call(this); - case 1: - return !c.call(this, h[0]); - case 2: - return !c.call(this, h[0], h[1]); - case 3: - return !c.call(this, h[0], h[1], h[2]); - } - return !c.apply(this, h); - }; - } - function OC(c) { - return i2(2, c); - } - var NC = wM(function(c, h) { - h = h.length == 1 && ir(h[0]) ? Xr(h[0], Mi(Ut())) : Xr(Bn(h, 1), Mi(Ut())); - var y = h.length; - return hr(function(N) { - for (var z = -1, ne = Kn(N.length, y); ++z < ne; ) - N[z] = h[z].call(this, N[z]); - return Pn(c, this, N); - }); - }), jg = hr(function(c, h) { - var y = Go(h, Yc(jg)); - return lo(c, V, r, h, y); - }), u2 = hr(function(c, h) { - var y = Go(h, Yc(u2)); - return lo(c, Q, r, h, y); - }), LC = ho(function(c, h) { - return lo(c, K, r, r, r, h); - }); - function kC(c, h) { - if (typeof c != "function") - throw new zi(o); - return h = h === r ? h : cr(h), hr(c, h); - } - function $C(c, h) { - if (typeof c != "function") - throw new zi(o); - return h = h == null ? 0 : En(cr(h), 0), hr(function(y) { - var N = y[h], z = Qo(y, 0, h); - return N && Vo(z, N), Pn(c, this, z); - }); - } - function BC(c, h, y) { - var N = !0, z = !0; - if (typeof c != "function") - throw new zi(o); - return Zr(y) && (N = "leading" in y ? !!y.leading : N, z = "trailing" in y ? !!y.trailing : z), c2(c, h, { - leading: N, - maxWait: h, - trailing: z - }); - } - function FC(c) { - return n2(c, 1); - } - function jC(c, h) { - return jg(Sg(h), c); - } - function UC() { - if (!arguments.length) - return []; - var c = arguments[0]; - return ir(c) ? c : [c]; - } - function qC(c) { - return Hi(c, _); - } - function zC(c, h) { - return h = typeof h == "function" ? h : r, Hi(c, _, h); - } - function WC(c) { - return Hi(c, p | _); - } - function HC(c, h) { - return h = typeof h == "function" ? h : r, Hi(c, p | _, h); - } - function KC(c, h) { - return h == null || Jy(c, h, Mn(h)); - } - function gs(c, h) { - return c === h || c !== c && h !== h; - } - var VC = Qh(hg), GC = Qh(function(c, h) { - return c >= h; - }), Va = rw(/* @__PURE__ */ function() { - return arguments; - }()) ? rw : function(c) { - return en(c) && Tr.call(c, "callee") && !qy.call(c, "callee"); - }, ir = Ie.isArray, YC = ri ? Mi(ri) : nM; - function hi(c) { - return c != null && cd(c.length) && !go(c); - } - function cn(c) { - return en(c) && hi(c); - } - function JC(c) { - return c === !0 || c === !1 || en(c) && ni(c) == J; - } - var ea = fP || Xg, XC = hs ? Mi(hs) : iM; - function ZC(c) { - return en(c) && c.nodeType === 1 && !_f(c); - } - function QC(c) { - if (c == null) - return !0; - if (hi(c) && (ir(c) || typeof c == "string" || typeof c.splice == "function" || ea(c) || Jc(c) || Va(c))) - return !c.length; - var h = Vn(c); - if (h == ie || h == Me) - return !c.size; - if (wf(c)) - return !gg(c).length; - for (var y in c) - if (Tr.call(c, y)) - return !1; - return !0; - } - function eT(c, h) { - return vf(c, h); - } - function tT(c, h, y) { - y = typeof y == "function" ? y : r; - var N = y ? y(c, h) : r; - return N === r ? vf(c, h, r, y) : !!N; - } - function Ug(c) { - if (!en(c)) - return !1; - var h = ni(c); - return h == X || h == T || typeof c.message == "string" && typeof c.name == "string" && !_f(c); - } - function rT(c) { - return typeof c == "number" && Wy(c); - } - function go(c) { - if (!Zr(c)) - return !1; - var h = ni(c); - return h == re || h == pe || h == Z || h == Ce; - } - function f2(c) { - return typeof c == "number" && c == cr(c); - } - function cd(c) { - return typeof c == "number" && c > -1 && c % 1 == 0 && c <= E; - } - function Zr(c) { - var h = typeof c; - return c != null && (h == "object" || h == "function"); - } - function en(c) { - return c != null && typeof c == "object"; - } - var l2 = Ui ? Mi(Ui) : oM; - function nT(c, h) { - return c === h || pg(c, h, Rg(h)); - } - function iT(c, h, y) { - return y = typeof y == "function" ? y : r, pg(c, h, Rg(h), y); - } - function sT(c) { - return h2(c) && c != +c; - } - function oT(c) { - if (zM(c)) - throw new tr(s); - return nw(c); - } - function aT(c) { - return c === null; - } - function cT(c) { - return c == null; - } - function h2(c) { - return typeof c == "number" || en(c) && ni(c) == ue; - } - function _f(c) { - if (!en(c) || ni(c) != Pe) - return !1; - var h = Lh(c); - if (h === null) - return !0; - var y = Tr.call(h, "constructor") && h.constructor; - return typeof y == "function" && y instanceof y && Rh.call(y) == iP; - } - var qg = Ds ? Mi(Ds) : aM; - function uT(c) { - return f2(c) && c >= -E && c <= E; - } - var d2 = af ? Mi(af) : cM; - function ud(c) { - return typeof c == "string" || !ir(c) && en(c) && ni(c) == Ne; - } - function Ci(c) { - return typeof c == "symbol" || en(c) && ni(c) == Ke; - } - var Jc = Fa ? Mi(Fa) : uM; - function fT(c) { - return c === r; - } - function lT(c) { - return en(c) && Vn(c) == qe; - } - function hT(c) { - return en(c) && ni(c) == ze; - } - var dT = Qh(mg), pT = Qh(function(c, h) { - return c <= h; - }); - function p2(c) { - if (!c) - return []; - if (hi(c)) - return ud(c) ? ds(c) : li(c); - if (uf && c[uf]) - return KA(c[uf]()); - var h = Vn(c), y = h == ie ? ng : h == Me ? Ih : Xc; - return y(c); - } - function mo(c) { - if (!c) - return c === 0 ? c : 0; - if (c = Gi(c), c === x || c === -x) { - var h = c < 0 ? -1 : 1; - return h * S; - } - return c === c ? c : 0; - } - function cr(c) { - var h = mo(c), y = h % 1; - return h === h ? y ? h - y : h : 0; - } - function g2(c) { - return c ? za(cr(c), 0, M) : 0; - } - function Gi(c) { - if (typeof c == "number") - return c; - if (Ci(c)) - return v; - if (Zr(c)) { - var h = typeof c.valueOf == "function" ? c.valueOf() : c; - c = Zr(h) ? h + "" : h; - } - if (typeof c != "string") - return c === 0 ? c : +c; - c = Ny(c); - var y = nt.test(c); - return y || pt.test(c) ? nr(c.slice(2), y ? 2 : 8) : Re.test(c) ? v : +c; - } - function m2(c) { - return Ns(c, di(c)); - } - function gT(c) { - return c ? za(cr(c), -E, E) : c === 0 ? c : 0; - } - function Cr(c) { - return c == null ? "" : Ii(c); - } - var mT = Vc(function(c, h) { - if (wf(h) || hi(h)) { - Ns(h, Mn(h), c); - return; - } - for (var y in h) - Tr.call(h, y) && pf(c, y, h[y]); - }), v2 = Vc(function(c, h) { - Ns(h, di(h), c); - }), fd = Vc(function(c, h, y, N) { - Ns(h, di(h), c, N); - }), vT = Vc(function(c, h, y, N) { - Ns(h, Mn(h), c, N); - }), bT = ho(ug); - function yT(c, h) { - var y = Kc(c); - return h == null ? y : Yy(y, h); - } - var wT = hr(function(c, h) { - c = qr(c); - var y = -1, N = h.length, z = N > 2 ? h[2] : r; - for (z && ii(h[0], h[1], z) && (N = 1); ++y < N; ) - for (var ne = h[y], fe = di(ne), me = -1, we = fe.length; ++me < we; ) { - var We = fe[me], He = c[We]; - (He === r || gs(He, zc[We]) && !Tr.call(c, We)) && (c[We] = ne[We]); - } - return c; - }), xT = hr(function(c) { - return c.push(r, Nw), Pn(b2, r, c); - }); - function _T(c, h) { - return Ty(c, Ut(h, 3), Os); - } - function ET(c, h) { - return Ty(c, Ut(h, 3), lg); - } - function ST(c, h) { - return c == null ? c : fg(c, Ut(h, 3), di); - } - function AT(c, h) { - return c == null ? c : ew(c, Ut(h, 3), di); - } - function PT(c, h) { - return c && Os(c, Ut(h, 3)); - } - function MT(c, h) { - return c && lg(c, Ut(h, 3)); - } - function IT(c) { - return c == null ? [] : Hh(c, Mn(c)); - } - function CT(c) { - return c == null ? [] : Hh(c, di(c)); - } - function zg(c, h, y) { - var N = c == null ? r : Wa(c, h); - return N === r ? y : N; - } - function TT(c, h) { - return c != null && $w(c, h, QP); - } - function Wg(c, h) { - return c != null && $w(c, h, eM); - } - var RT = Cw(function(c, h, y) { - h != null && typeof h.toString != "function" && (h = Dh.call(h)), c[h] = y; - }, Kg(pi)), DT = Cw(function(c, h, y) { - h != null && typeof h.toString != "function" && (h = Dh.call(h)), Tr.call(c, h) ? c[h].push(y) : c[h] = [y]; - }, Ut), OT = hr(mf); - function Mn(c) { - return hi(c) ? Vy(c) : gg(c); - } - function di(c) { - return hi(c) ? Vy(c, !0) : fM(c); - } - function NT(c, h) { - var y = {}; - return h = Ut(h, 3), Os(c, function(N, z, ne) { - fo(y, h(N, z, ne), N); - }), y; - } - function LT(c, h) { - var y = {}; - return h = Ut(h, 3), Os(c, function(N, z, ne) { - fo(y, z, h(N, z, ne)); - }), y; - } - var kT = Vc(function(c, h, y) { - Kh(c, h, y); - }), b2 = Vc(function(c, h, y, N) { - Kh(c, h, y, N); - }), $T = ho(function(c, h) { - var y = {}; - if (c == null) - return y; - var N = !1; - h = Xr(h, function(ne) { - return ne = Zo(ne, c), N || (N = ne.length > 1), ne; - }), Ns(c, Cg(c), y), N && (y = Hi(y, p | w | _, RM)); - for (var z = h.length; z--; ) - xg(y, h[z]); - return y; - }); - function BT(c, h) { - return y2(c, ad(Ut(h))); - } - var FT = ho(function(c, h) { - return c == null ? {} : hM(c, h); - }); - function y2(c, h) { - if (c == null) - return {}; - var y = Xr(Cg(c), function(N) { - return [N]; - }); - return h = Ut(h), fw(c, y, function(N, z) { - return h(N, z[0]); - }); - } - function jT(c, h, y) { - h = Zo(h, c); - var N = -1, z = h.length; - for (z || (z = 1, c = r); ++N < z; ) { - var ne = c == null ? r : c[Ls(h[N])]; - ne === r && (N = z, ne = y), c = go(ne) ? ne.call(c) : ne; - } - return c; - } - function UT(c, h, y) { - return c == null ? c : bf(c, h, y); - } - function qT(c, h, y, N) { - return N = typeof N == "function" ? N : r, c == null ? c : bf(c, h, y, N); - } - var w2 = Dw(Mn), x2 = Dw(di); - function zT(c, h, y) { - var N = ir(c), z = N || ea(c) || Jc(c); - if (h = Ut(h, 4), y == null) { - var ne = c && c.constructor; - z ? y = N ? new ne() : [] : Zr(c) ? y = go(ne) ? Kc(Lh(c)) : {} : y = {}; - } - return (z ? qi : Os)(c, function(fe, me, we) { - return h(y, fe, me, we); - }), y; - } - function WT(c, h) { - return c == null ? !0 : xg(c, h); - } - function HT(c, h, y) { - return c == null ? c : gw(c, h, Sg(y)); - } - function KT(c, h, y, N) { - return N = typeof N == "function" ? N : r, c == null ? c : gw(c, h, Sg(y), N); - } - function Xc(c) { - return c == null ? [] : rg(c, Mn(c)); - } - function VT(c) { - return c == null ? [] : rg(c, di(c)); - } - function GT(c, h, y) { - return y === r && (y = h, h = r), y !== r && (y = Gi(y), y = y === y ? y : 0), h !== r && (h = Gi(h), h = h === h ? h : 0), za(Gi(c), h, y); - } - function YT(c, h, y) { - return h = mo(h), y === r ? (y = h, h = 0) : y = mo(y), c = Gi(c), tM(c, h, y); - } - function JT(c, h, y) { - if (y && typeof y != "boolean" && ii(c, h, y) && (h = y = r), y === r && (typeof h == "boolean" ? (y = h, h = r) : typeof c == "boolean" && (y = c, c = r)), c === r && h === r ? (c = 0, h = 1) : (c = mo(c), h === r ? (h = c, c = 0) : h = mo(h)), c > h) { - var N = c; - c = h, h = N; - } - if (y || c % 1 || h % 1) { - var z = Hy(); - return Kn(c + z * (h - c + jr("1e-" + ((z + "").length - 1))), h); - } - return bg(c, h); - } - var XT = Gc(function(c, h, y) { - return h = h.toLowerCase(), c + (y ? _2(h) : h); - }); - function _2(c) { - return Hg(Cr(c).toLowerCase()); - } - function E2(c) { - return c = Cr(c), c && c.replace(et, UA).replace(Vp, ""); - } - function ZT(c, h, y) { - c = Cr(c), h = Ii(h); - var N = c.length; - y = y === r ? N : za(cr(y), 0, N); - var z = y; - return y -= h.length, y >= 0 && c.slice(y, z) == h; - } - function QT(c) { - return c = Cr(c), c && Ct.test(c) ? c.replace(Dt, qA) : c; - } - function eR(c) { - return c = Cr(c), c && Bt.test(c) ? c.replace(rt, "\\$&") : c; - } - var tR = Gc(function(c, h, y) { - return c + (y ? "-" : "") + h.toLowerCase(); - }), rR = Gc(function(c, h, y) { - return c + (y ? " " : "") + h.toLowerCase(); - }), nR = Pw("toLowerCase"); - function iR(c, h, y) { - c = Cr(c), h = cr(h); - var N = h ? Uc(c) : 0; - if (!h || N >= h) - return c; - var z = (h - N) / 2; - return Zh(Fh(z), y) + c + Zh(Bh(z), y); - } - function sR(c, h, y) { - c = Cr(c), h = cr(h); - var N = h ? Uc(c) : 0; - return h && N < h ? c + Zh(h - N, y) : c; - } - function oR(c, h, y) { - c = Cr(c), h = cr(h); - var N = h ? Uc(c) : 0; - return h && N < h ? Zh(h - N, y) + c : c; - } - function aR(c, h, y) { - return y || h == null ? h = 0 : h && (h = +h), pP(Cr(c).replace($, ""), h || 0); - } - function cR(c, h, y) { - return (y ? ii(c, h, y) : h === r) ? h = 1 : h = cr(h), yg(Cr(c), h); - } - function uR() { - var c = arguments, h = Cr(c[0]); - return c.length < 3 ? h : h.replace(c[1], c[2]); - } - var fR = Gc(function(c, h, y) { - return c + (y ? "_" : "") + h.toLowerCase(); - }); - function lR(c, h, y) { - return y && typeof y != "number" && ii(c, h, y) && (h = y = r), y = y === r ? M : y >>> 0, y ? (c = Cr(c), c && (typeof h == "string" || h != null && !qg(h)) && (h = Ii(h), !h && jc(c)) ? Qo(ds(c), 0, y) : c.split(h, y)) : []; - } - var hR = Gc(function(c, h, y) { - return c + (y ? " " : "") + Hg(h); - }); - function dR(c, h, y) { - return c = Cr(c), y = y == null ? 0 : za(cr(y), 0, c.length), h = Ii(h), c.slice(y, y + h.length) == h; - } - function pR(c, h, y) { - var N = te.templateSettings; - y && ii(c, h, y) && (h = r), c = Cr(c), h = fd({}, h, N, Ow); - var z = fd({}, h.imports, N.imports, Ow), ne = Mn(z), fe = rg(z, ne), me, we, We = 0, He = h.interpolate || St, Xe = "__p += '", wt = ig( - (h.escape || St).source + "|" + He.source + "|" + (He === Nt ? xe : St).source + "|" + (h.evaluate || St).source + "|$", - "g" - ), Ot = "//# sourceURL=" + (Tr.call(h, "sourceURL") ? (h.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++Gp + "]") + ` -`; - c.replace(wt, function(Kt, br, Sr, Ti, si, Ri) { - return Sr || (Sr = Ti), Xe += c.slice(We, Ri).replace(Tt, zA), br && (me = !0, Xe += `' + -__e(` + br + `) + -'`), si && (we = !0, Xe += `'; -` + si + `; -__p += '`), Sr && (Xe += `' + -((__t = (` + Sr + `)) == null ? '' : __t) + -'`), We = Ri + Kt.length, Kt; - }), Xe += `'; -`; - var Ht = Tr.call(h, "variable") && h.variable; - if (!Ht) - Xe = `with (obj) { -` + Xe + ` -} -`; - else if (se.test(Ht)) - throw new tr(a); - Xe = (we ? Xe.replace(Jt, "") : Xe).replace(Et, "$1").replace(er, "$1;"), Xe = "function(" + (Ht || "obj") + `) { -` + (Ht ? "" : `obj || (obj = {}); -`) + "var __t, __p = ''" + (me ? ", __e = _.escape" : "") + (we ? `, __j = Array.prototype.join; -function print() { __p += __j.call(arguments, '') } -` : `; -`) + Xe + `return __p -}`; - var fr = A2(function() { - return Mr(ne, Ot + "return " + Xe).apply(r, fe); - }); - if (fr.source = Xe, Ug(fr)) - throw fr; - return fr; - } - function gR(c) { - return Cr(c).toLowerCase(); - } - function mR(c) { - return Cr(c).toUpperCase(); - } - function vR(c, h, y) { - if (c = Cr(c), c && (y || h === r)) - return Ny(c); - if (!c || !(h = Ii(h))) - return c; - var N = ds(c), z = ds(h), ne = Ly(N, z), fe = ky(N, z) + 1; - return Qo(N, ne, fe).join(""); - } - function bR(c, h, y) { - if (c = Cr(c), c && (y || h === r)) - return c.slice(0, By(c) + 1); - if (!c || !(h = Ii(h))) - return c; - var N = ds(c), z = ky(N, ds(h)) + 1; - return Qo(N, 0, z).join(""); - } - function yR(c, h, y) { - if (c = Cr(c), c && (y || h === r)) - return c.replace($, ""); - if (!c || !(h = Ii(h))) - return c; - var N = ds(c), z = Ly(N, ds(h)); - return Qo(N, z).join(""); - } - function wR(c, h) { - var y = Ee, N = Y; - if (Zr(h)) { - var z = "separator" in h ? h.separator : z; - y = "length" in h ? cr(h.length) : y, N = "omission" in h ? Ii(h.omission) : N; - } - c = Cr(c); - var ne = c.length; - if (jc(c)) { - var fe = ds(c); - ne = fe.length; - } - if (y >= ne) - return c; - var me = y - Uc(N); - if (me < 1) - return N; - var we = fe ? Qo(fe, 0, me).join("") : c.slice(0, me); - if (z === r) - return we + N; - if (fe && (me += we.length - me), qg(z)) { - if (c.slice(me).search(z)) { - var We, He = we; - for (z.global || (z = ig(z.source, Cr(Te.exec(z)) + "g")), z.lastIndex = 0; We = z.exec(He); ) - var Xe = We.index; - we = we.slice(0, Xe === r ? me : Xe); - } - } else if (c.indexOf(Ii(z), me) != me) { - var wt = we.lastIndexOf(z); - wt > -1 && (we = we.slice(0, wt)); - } - return we + N; - } - function xR(c) { - return c = Cr(c), c && kt.test(c) ? c.replace(Xt, JA) : c; - } - var _R = Gc(function(c, h, y) { - return c + (y ? " " : "") + h.toUpperCase(); - }), Hg = Pw("toUpperCase"); - function S2(c, h, y) { - return c = Cr(c), h = y ? r : h, h === r ? HA(c) ? QA(c) : kA(c) : c.match(h) || []; - } - var A2 = hr(function(c, h) { - try { - return Pn(c, r, h); - } catch (y) { - return Ug(y) ? y : new tr(y); - } - }), ER = ho(function(c, h) { - return qi(h, function(y) { - y = Ls(y), fo(c, y, Fg(c[y], c)); - }), c; - }); - function SR(c) { - var h = c == null ? 0 : c.length, y = Ut(); - return c = h ? Xr(c, function(N) { - if (typeof N[1] != "function") - throw new zi(o); - return [y(N[0]), N[1]]; - }) : [], hr(function(N) { - for (var z = -1; ++z < h; ) { - var ne = c[z]; - if (Pn(ne[0], this, N)) - return Pn(ne[1], this, N); - } - }); - } - function AR(c) { - return JP(Hi(c, p)); - } - function Kg(c) { - return function() { - return c; - }; - } - function PR(c, h) { - return c == null || c !== c ? h : c; - } - var MR = Iw(), IR = Iw(!0); - function pi(c) { - return c; - } - function Vg(c) { - return iw(typeof c == "function" ? c : Hi(c, p)); - } - function CR(c) { - return ow(Hi(c, p)); - } - function TR(c, h) { - return aw(c, Hi(h, p)); - } - var RR = hr(function(c, h) { - return function(y) { - return mf(y, c, h); - }; - }), DR = hr(function(c, h) { - return function(y) { - return mf(c, y, h); - }; - }); - function Gg(c, h, y) { - var N = Mn(h), z = Hh(h, N); - y == null && !(Zr(h) && (z.length || !N.length)) && (y = h, h = c, c = this, z = Hh(h, Mn(h))); - var ne = !(Zr(y) && "chain" in y) || !!y.chain, fe = go(c); - return qi(z, function(me) { - var we = h[me]; - c[me] = we, fe && (c.prototype[me] = function() { - var We = this.__chain__; - if (ne || We) { - var He = c(this.__wrapped__), Xe = He.__actions__ = li(this.__actions__); - return Xe.push({ func: we, args: arguments, thisArg: c }), He.__chain__ = We, He; - } - return we.apply(c, Vo([this.value()], arguments)); - }); - }), c; - } - function OR() { - return Er._ === this && (Er._ = sP), this; - } - function Yg() { - } - function NR(c) { - return c = cr(c), hr(function(h) { - return cw(h, c); - }); - } - var LR = Pg(Xr), kR = Pg(Cy), $R = Pg(Xp); - function P2(c) { - return Og(c) ? Zp(Ls(c)) : dM(c); - } - function BR(c) { - return function(h) { - return c == null ? r : Wa(c, h); - }; - } - var FR = Tw(), jR = Tw(!0); - function Jg() { - return []; - } - function Xg() { - return !1; - } - function UR() { - return {}; - } - function qR() { - return ""; - } - function zR() { - return !0; - } - function WR(c, h) { - if (c = cr(c), c < 1 || c > E) - return []; - var y = M, N = Kn(c, M); - h = Ut(h), c -= M; - for (var z = tg(N, h); ++y < c; ) - h(y); - return z; - } - function HR(c) { - return ir(c) ? Xr(c, Ls) : Ci(c) ? [c] : li(Kw(Cr(c))); - } - function KR(c) { - var h = ++nP; - return Cr(c) + h; - } - var VR = Xh(function(c, h) { - return c + h; - }, 0), GR = Mg("ceil"), YR = Xh(function(c, h) { - return c / h; - }, 1), JR = Mg("floor"); - function XR(c) { - return c && c.length ? Wh(c, pi, hg) : r; - } - function ZR(c, h) { - return c && c.length ? Wh(c, Ut(h, 2), hg) : r; - } - function QR(c) { - return Dy(c, pi); - } - function eD(c, h) { - return Dy(c, Ut(h, 2)); - } - function tD(c) { - return c && c.length ? Wh(c, pi, mg) : r; - } - function rD(c, h) { - return c && c.length ? Wh(c, Ut(h, 2), mg) : r; - } - var nD = Xh(function(c, h) { - return c * h; - }, 1), iD = Mg("round"), sD = Xh(function(c, h) { - return c - h; - }, 0); - function oD(c) { - return c && c.length ? eg(c, pi) : 0; - } - function aD(c, h) { - return c && c.length ? eg(c, Ut(h, 2)) : 0; - } - return te.after = CC, te.ary = n2, te.assign = mT, te.assignIn = v2, te.assignInWith = fd, te.assignWith = vT, te.at = bT, te.before = i2, te.bind = Fg, te.bindAll = ER, te.bindKey = s2, te.castArray = UC, te.chain = e2, te.chunk = JM, te.compact = XM, te.concat = ZM, te.cond = SR, te.conforms = AR, te.constant = Kg, te.countBy = oC, te.create = yT, te.curry = o2, te.curryRight = a2, te.debounce = c2, te.defaults = wT, te.defaultsDeep = xT, te.defer = TC, te.delay = RC, te.difference = QM, te.differenceBy = eI, te.differenceWith = tI, te.drop = rI, te.dropRight = nI, te.dropRightWhile = iI, te.dropWhile = sI, te.fill = oI, te.filter = cC, te.flatMap = lC, te.flatMapDeep = hC, te.flatMapDepth = dC, te.flatten = Jw, te.flattenDeep = aI, te.flattenDepth = cI, te.flip = DC, te.flow = MR, te.flowRight = IR, te.fromPairs = uI, te.functions = IT, te.functionsIn = CT, te.groupBy = pC, te.initial = lI, te.intersection = hI, te.intersectionBy = dI, te.intersectionWith = pI, te.invert = RT, te.invertBy = DT, te.invokeMap = mC, te.iteratee = Vg, te.keyBy = vC, te.keys = Mn, te.keysIn = di, te.map = id, te.mapKeys = NT, te.mapValues = LT, te.matches = CR, te.matchesProperty = TR, te.memoize = od, te.merge = kT, te.mergeWith = b2, te.method = RR, te.methodOf = DR, te.mixin = Gg, te.negate = ad, te.nthArg = NR, te.omit = $T, te.omitBy = BT, te.once = OC, te.orderBy = bC, te.over = LR, te.overArgs = NC, te.overEvery = kR, te.overSome = $R, te.partial = jg, te.partialRight = u2, te.partition = yC, te.pick = FT, te.pickBy = y2, te.property = P2, te.propertyOf = BR, te.pull = bI, te.pullAll = Zw, te.pullAllBy = yI, te.pullAllWith = wI, te.pullAt = xI, te.range = FR, te.rangeRight = jR, te.rearg = LC, te.reject = _C, te.remove = _I, te.rest = kC, te.reverse = $g, te.sampleSize = SC, te.set = UT, te.setWith = qT, te.shuffle = AC, te.slice = EI, te.sortBy = IC, te.sortedUniq = TI, te.sortedUniqBy = RI, te.split = lR, te.spread = $C, te.tail = DI, te.take = OI, te.takeRight = NI, te.takeRightWhile = LI, te.takeWhile = kI, te.tap = XI, te.throttle = BC, te.thru = nd, te.toArray = p2, te.toPairs = w2, te.toPairsIn = x2, te.toPath = HR, te.toPlainObject = m2, te.transform = zT, te.unary = FC, te.union = $I, te.unionBy = BI, te.unionWith = FI, te.uniq = jI, te.uniqBy = UI, te.uniqWith = qI, te.unset = WT, te.unzip = Bg, te.unzipWith = Qw, te.update = HT, te.updateWith = KT, te.values = Xc, te.valuesIn = VT, te.without = zI, te.words = S2, te.wrap = jC, te.xor = WI, te.xorBy = HI, te.xorWith = KI, te.zip = VI, te.zipObject = GI, te.zipObjectDeep = YI, te.zipWith = JI, te.entries = w2, te.entriesIn = x2, te.extend = v2, te.extendWith = fd, Gg(te, te), te.add = VR, te.attempt = A2, te.camelCase = XT, te.capitalize = _2, te.ceil = GR, te.clamp = GT, te.clone = qC, te.cloneDeep = WC, te.cloneDeepWith = HC, te.cloneWith = zC, te.conformsTo = KC, te.deburr = E2, te.defaultTo = PR, te.divide = YR, te.endsWith = ZT, te.eq = gs, te.escape = QT, te.escapeRegExp = eR, te.every = aC, te.find = uC, te.findIndex = Gw, te.findKey = _T, te.findLast = fC, te.findLastIndex = Yw, te.findLastKey = ET, te.floor = JR, te.forEach = t2, te.forEachRight = r2, te.forIn = ST, te.forInRight = AT, te.forOwn = PT, te.forOwnRight = MT, te.get = zg, te.gt = VC, te.gte = GC, te.has = TT, te.hasIn = Wg, te.head = Xw, te.identity = pi, te.includes = gC, te.indexOf = fI, te.inRange = YT, te.invoke = OT, te.isArguments = Va, te.isArray = ir, te.isArrayBuffer = YC, te.isArrayLike = hi, te.isArrayLikeObject = cn, te.isBoolean = JC, te.isBuffer = ea, te.isDate = XC, te.isElement = ZC, te.isEmpty = QC, te.isEqual = eT, te.isEqualWith = tT, te.isError = Ug, te.isFinite = rT, te.isFunction = go, te.isInteger = f2, te.isLength = cd, te.isMap = l2, te.isMatch = nT, te.isMatchWith = iT, te.isNaN = sT, te.isNative = oT, te.isNil = cT, te.isNull = aT, te.isNumber = h2, te.isObject = Zr, te.isObjectLike = en, te.isPlainObject = _f, te.isRegExp = qg, te.isSafeInteger = uT, te.isSet = d2, te.isString = ud, te.isSymbol = Ci, te.isTypedArray = Jc, te.isUndefined = fT, te.isWeakMap = lT, te.isWeakSet = hT, te.join = gI, te.kebabCase = tR, te.last = Vi, te.lastIndexOf = mI, te.lowerCase = rR, te.lowerFirst = nR, te.lt = dT, te.lte = pT, te.max = XR, te.maxBy = ZR, te.mean = QR, te.meanBy = eD, te.min = tD, te.minBy = rD, te.stubArray = Jg, te.stubFalse = Xg, te.stubObject = UR, te.stubString = qR, te.stubTrue = zR, te.multiply = nD, te.nth = vI, te.noConflict = OR, te.noop = Yg, te.now = sd, te.pad = iR, te.padEnd = sR, te.padStart = oR, te.parseInt = aR, te.random = JT, te.reduce = wC, te.reduceRight = xC, te.repeat = cR, te.replace = uR, te.result = jT, te.round = iD, te.runInContext = be, te.sample = EC, te.size = PC, te.snakeCase = fR, te.some = MC, te.sortedIndex = SI, te.sortedIndexBy = AI, te.sortedIndexOf = PI, te.sortedLastIndex = MI, te.sortedLastIndexBy = II, te.sortedLastIndexOf = CI, te.startCase = hR, te.startsWith = dR, te.subtract = sD, te.sum = oD, te.sumBy = aD, te.template = pR, te.times = WR, te.toFinite = mo, te.toInteger = cr, te.toLength = g2, te.toLower = gR, te.toNumber = Gi, te.toSafeInteger = gT, te.toString = Cr, te.toUpper = mR, te.trim = vR, te.trimEnd = bR, te.trimStart = yR, te.truncate = wR, te.unescape = xR, te.uniqueId = KR, te.upperCase = _R, te.upperFirst = Hg, te.each = t2, te.eachRight = r2, te.first = Xw, Gg(te, function() { - var c = {}; - return Os(te, function(h, y) { - Tr.call(te.prototype, y) || (c[y] = h); - }), c; - }(), { chain: !1 }), te.VERSION = n, qi(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(c) { - te[c].placeholder = te; - }), qi(["drop", "take"], function(c, h) { - xr.prototype[c] = function(y) { - y = y === r ? 1 : En(cr(y), 0); - var N = this.__filtered__ && !h ? new xr(this) : this.clone(); - return N.__filtered__ ? N.__takeCount__ = Kn(y, N.__takeCount__) : N.__views__.push({ - size: Kn(y, M), - type: c + (N.__dir__ < 0 ? "Right" : "") - }), N; - }, xr.prototype[c + "Right"] = function(y) { - return this.reverse()[c](y).reverse(); - }; - }), qi(["filter", "map", "takeWhile"], function(c, h) { - var y = h + 1, N = y == f || y == b; - xr.prototype[c] = function(z) { - var ne = this.clone(); - return ne.__iteratees__.push({ - iteratee: Ut(z, 3), - type: y - }), ne.__filtered__ = ne.__filtered__ || N, ne; - }; - }), qi(["head", "last"], function(c, h) { - var y = "take" + (h ? "Right" : ""); - xr.prototype[c] = function() { - return this[y](1).value()[0]; - }; - }), qi(["initial", "tail"], function(c, h) { - var y = "drop" + (h ? "" : "Right"); - xr.prototype[c] = function() { - return this.__filtered__ ? new xr(this) : this[y](1); - }; - }), xr.prototype.compact = function() { - return this.filter(pi); - }, xr.prototype.find = function(c) { - return this.filter(c).head(); - }, xr.prototype.findLast = function(c) { - return this.reverse().find(c); - }, xr.prototype.invokeMap = hr(function(c, h) { - return typeof c == "function" ? new xr(this) : this.map(function(y) { - return mf(y, c, h); - }); - }), xr.prototype.reject = function(c) { - return this.filter(ad(Ut(c))); - }, xr.prototype.slice = function(c, h) { - c = cr(c); - var y = this; - return y.__filtered__ && (c > 0 || h < 0) ? new xr(y) : (c < 0 ? y = y.takeRight(-c) : c && (y = y.drop(c)), h !== r && (h = cr(h), y = h < 0 ? y.dropRight(-h) : y.take(h - c)), y); - }, xr.prototype.takeRightWhile = function(c) { - return this.reverse().takeWhile(c).reverse(); - }, xr.prototype.toArray = function() { - return this.take(M); - }, Os(xr.prototype, function(c, h) { - var y = /^(?:filter|find|map|reject)|While$/.test(h), N = /^(?:head|last)$/.test(h), z = te[N ? "take" + (h == "last" ? "Right" : "") : h], ne = N || /^find/.test(h); - z && (te.prototype[h] = function() { - var fe = this.__wrapped__, me = N ? [1] : arguments, we = fe instanceof xr, We = me[0], He = we || ir(fe), Xe = function(br) { - var Sr = z.apply(te, Vo([br], me)); - return N && wt ? Sr[0] : Sr; - }; - He && y && typeof We == "function" && We.length != 1 && (we = He = !1); - var wt = this.__chain__, Ot = !!this.__actions__.length, Ht = ne && !wt, fr = we && !Ot; - if (!ne && He) { - fe = fr ? fe : new xr(this); - var Kt = c.apply(fe, me); - return Kt.__actions__.push({ func: nd, args: [Xe], thisArg: r }), new Wi(Kt, wt); - } - return Ht && fr ? c.apply(this, me) : (Kt = this.thru(Xe), Ht ? N ? Kt.value()[0] : Kt.value() : Kt); - }); - }), qi(["pop", "push", "shift", "sort", "splice", "unshift"], function(c) { - var h = Ch[c], y = /^(?:push|sort|unshift)$/.test(c) ? "tap" : "thru", N = /^(?:pop|shift)$/.test(c); - te.prototype[c] = function() { - var z = arguments; - if (N && !this.__chain__) { - var ne = this.value(); - return h.apply(ir(ne) ? ne : [], z); - } - return this[y](function(fe) { - return h.apply(ir(fe) ? fe : [], z); - }); - }; - }), Os(xr.prototype, function(c, h) { - var y = te[h]; - if (y) { - var N = y.name + ""; - Tr.call(Hc, N) || (Hc[N] = []), Hc[N].push({ name: h, func: y }); - } - }), Hc[Jh(r, B).name] = [{ - name: "wrapper", - func: r - }], xr.prototype.clone = xP, xr.prototype.reverse = _P, xr.prototype.value = EP, te.prototype.at = ZI, te.prototype.chain = QI, te.prototype.commit = eC, te.prototype.next = tC, te.prototype.plant = nC, te.prototype.reverse = iC, te.prototype.toJSON = te.prototype.valueOf = te.prototype.value = sC, te.prototype.first = te.prototype.head, uf && (te.prototype[uf] = rC), te; - }, qc = eP(); - an ? ((an.exports = qc)._ = qc, Ur._ = qc) : Er._ = qc; - }).call(gn); -})(S0, S0.exports); -var DG = S0.exports, Y1 = { exports: {} }; -(function(t, e) { - var r = typeof self < "u" ? self : gn, n = function() { - function s() { - this.fetch = !1, this.DOMException = r.DOMException; - } - return s.prototype = r, new s(); - }(); - (function(s) { - (function(o) { - var a = { - searchParams: "URLSearchParams" in s, - iterable: "Symbol" in s && "iterator" in Symbol, - blob: "FileReader" in s && "Blob" in s && function() { - try { - return new Blob(), !0; - } catch { - return !1; - } - }(), - formData: "FormData" in s, - arrayBuffer: "ArrayBuffer" in s - }; - function u(f) { - return f && DataView.prototype.isPrototypeOf(f); - } - if (a.arrayBuffer) - var l = [ - "[object Int8Array]", - "[object Uint8Array]", - "[object Uint8ClampedArray]", - "[object Int16Array]", - "[object Uint16Array]", - "[object Int32Array]", - "[object Uint32Array]", - "[object Float32Array]", - "[object Float64Array]" - ], d = ArrayBuffer.isView || function(f) { - return f && l.indexOf(Object.prototype.toString.call(f)) > -1; - }; - function p(f) { - if (typeof f != "string" && (f = String(f)), /[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f)) - throw new TypeError("Invalid character in header field name"); - return f.toLowerCase(); - } - function w(f) { - return typeof f != "string" && (f = String(f)), f; - } - function _(f) { - var g = { - next: function() { - var b = f.shift(); - return { done: b === void 0, value: b }; - } - }; - return a.iterable && (g[Symbol.iterator] = function() { - return g; - }), g; - } - function P(f) { - this.map = {}, f instanceof P ? f.forEach(function(g, b) { - this.append(b, g); - }, this) : Array.isArray(f) ? f.forEach(function(g) { - this.append(g[0], g[1]); - }, this) : f && Object.getOwnPropertyNames(f).forEach(function(g) { - this.append(g, f[g]); - }, this); - } - P.prototype.append = function(f, g) { - f = p(f), g = w(g); - var b = this.map[f]; - this.map[f] = b ? b + ", " + g : g; - }, P.prototype.delete = function(f) { - delete this.map[p(f)]; - }, P.prototype.get = function(f) { - return f = p(f), this.has(f) ? this.map[f] : null; - }, P.prototype.has = function(f) { - return this.map.hasOwnProperty(p(f)); - }, P.prototype.set = function(f, g) { - this.map[p(f)] = w(g); - }, P.prototype.forEach = function(f, g) { - for (var b in this.map) - this.map.hasOwnProperty(b) && f.call(g, this.map[b], b, this); - }, P.prototype.keys = function() { - var f = []; - return this.forEach(function(g, b) { - f.push(b); - }), _(f); - }, P.prototype.values = function() { - var f = []; - return this.forEach(function(g) { - f.push(g); - }), _(f); - }, P.prototype.entries = function() { - var f = []; - return this.forEach(function(g, b) { - f.push([b, g]); - }), _(f); - }, a.iterable && (P.prototype[Symbol.iterator] = P.prototype.entries); - function O(f) { - if (f.bodyUsed) - return Promise.reject(new TypeError("Already read")); - f.bodyUsed = !0; - } - function L(f) { - return new Promise(function(g, b) { - f.onload = function() { - g(f.result); - }, f.onerror = function() { - b(f.error); - }; - }); - } - function B(f) { - var g = new FileReader(), b = L(g); - return g.readAsArrayBuffer(f), b; - } - function k(f) { - var g = new FileReader(), b = L(g); - return g.readAsText(f), b; - } - function W(f) { - for (var g = new Uint8Array(f), b = new Array(g.length), x = 0; x < g.length; x++) - b[x] = String.fromCharCode(g[x]); - return b.join(""); - } - function U(f) { - if (f.slice) - return f.slice(0); - var g = new Uint8Array(f.byteLength); - return g.set(new Uint8Array(f)), g.buffer; - } - function V() { - return this.bodyUsed = !1, this._initBody = function(f) { - this._bodyInit = f, f ? typeof f == "string" ? this._bodyText = f : a.blob && Blob.prototype.isPrototypeOf(f) ? this._bodyBlob = f : a.formData && FormData.prototype.isPrototypeOf(f) ? this._bodyFormData = f : a.searchParams && URLSearchParams.prototype.isPrototypeOf(f) ? this._bodyText = f.toString() : a.arrayBuffer && a.blob && u(f) ? (this._bodyArrayBuffer = U(f.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(f) || d(f)) ? this._bodyArrayBuffer = U(f) : this._bodyText = f = Object.prototype.toString.call(f) : this._bodyText = "", this.headers.get("content-type") || (typeof f == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : a.searchParams && URLSearchParams.prototype.isPrototypeOf(f) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8")); - }, a.blob && (this.blob = function() { - var f = O(this); - if (f) - return f; - if (this._bodyBlob) - return Promise.resolve(this._bodyBlob); - if (this._bodyArrayBuffer) - return Promise.resolve(new Blob([this._bodyArrayBuffer])); - if (this._bodyFormData) - throw new Error("could not read FormData body as blob"); - return Promise.resolve(new Blob([this._bodyText])); - }, this.arrayBuffer = function() { - return this._bodyArrayBuffer ? O(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(B); - }), this.text = function() { - var f = O(this); - if (f) - return f; - if (this._bodyBlob) - return k(this._bodyBlob); - if (this._bodyArrayBuffer) - return Promise.resolve(W(this._bodyArrayBuffer)); - if (this._bodyFormData) - throw new Error("could not read FormData body as text"); - return Promise.resolve(this._bodyText); - }, a.formData && (this.formData = function() { - return this.text().then(ge); - }), this.json = function() { - return this.text().then(JSON.parse); - }, this; - } - var Q = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"]; - function R(f) { - var g = f.toUpperCase(); - return Q.indexOf(g) > -1 ? g : f; - } - function K(f, g) { - g = g || {}; - var b = g.body; - if (f instanceof K) { - if (f.bodyUsed) - throw new TypeError("Already read"); - this.url = f.url, this.credentials = f.credentials, g.headers || (this.headers = new P(f.headers)), this.method = f.method, this.mode = f.mode, this.signal = f.signal, !b && f._bodyInit != null && (b = f._bodyInit, f.bodyUsed = !0); - } else - this.url = String(f); - if (this.credentials = g.credentials || this.credentials || "same-origin", (g.headers || !this.headers) && (this.headers = new P(g.headers)), this.method = R(g.method || this.method || "GET"), this.mode = g.mode || this.mode || null, this.signal = g.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && b) - throw new TypeError("Body not allowed for GET or HEAD requests"); - this._initBody(b); - } - K.prototype.clone = function() { - return new K(this, { body: this._bodyInit }); - }; - function ge(f) { - var g = new FormData(); - return f.trim().split("&").forEach(function(b) { - if (b) { - var x = b.split("="), E = x.shift().replace(/\+/g, " "), S = x.join("=").replace(/\+/g, " "); - g.append(decodeURIComponent(E), decodeURIComponent(S)); - } - }), g; - } - function Ee(f) { - var g = new P(), b = f.replace(/\r?\n[\t ]+/g, " "); - return b.split(/\r?\n/).forEach(function(x) { - var E = x.split(":"), S = E.shift().trim(); - if (S) { - var v = E.join(":").trim(); - g.append(S, v); - } - }), g; - } - V.call(K.prototype); - function Y(f, g) { - g || (g = {}), this.type = "default", this.status = g.status === void 0 ? 200 : g.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in g ? g.statusText : "OK", this.headers = new P(g.headers), this.url = g.url || "", this._initBody(f); - } - V.call(Y.prototype), Y.prototype.clone = function() { - return new Y(this._bodyInit, { - status: this.status, - statusText: this.statusText, - headers: new P(this.headers), - url: this.url - }); - }, Y.error = function() { - var f = new Y(null, { status: 0, statusText: "" }); - return f.type = "error", f; - }; - var A = [301, 302, 303, 307, 308]; - Y.redirect = function(f, g) { - if (A.indexOf(g) === -1) - throw new RangeError("Invalid status code"); - return new Y(null, { status: g, headers: { location: f } }); - }, o.DOMException = s.DOMException; - try { - new o.DOMException(); - } catch { - o.DOMException = function(g, b) { - this.message = g, this.name = b; - var x = Error(g); - this.stack = x.stack; - }, o.DOMException.prototype = Object.create(Error.prototype), o.DOMException.prototype.constructor = o.DOMException; - } - function m(f, g) { - return new Promise(function(b, x) { - var E = new K(f, g); - if (E.signal && E.signal.aborted) - return x(new o.DOMException("Aborted", "AbortError")); - var S = new XMLHttpRequest(); - function v() { - S.abort(); - } - S.onload = function() { - var M = { - status: S.status, - statusText: S.statusText, - headers: Ee(S.getAllResponseHeaders() || "") - }; - M.url = "responseURL" in S ? S.responseURL : M.headers.get("X-Request-URL"); - var I = "response" in S ? S.response : S.responseText; - b(new Y(I, M)); - }, S.onerror = function() { - x(new TypeError("Network request failed")); - }, S.ontimeout = function() { - x(new TypeError("Network request failed")); - }, S.onabort = function() { - x(new o.DOMException("Aborted", "AbortError")); - }, S.open(E.method, E.url, !0), E.credentials === "include" ? S.withCredentials = !0 : E.credentials === "omit" && (S.withCredentials = !1), "responseType" in S && a.blob && (S.responseType = "blob"), E.headers.forEach(function(M, I) { - S.setRequestHeader(I, M); - }), E.signal && (E.signal.addEventListener("abort", v), S.onreadystatechange = function() { - S.readyState === 4 && E.signal.removeEventListener("abort", v); - }), S.send(typeof E._bodyInit > "u" ? null : E._bodyInit); - }); - } - return m.polyfill = !0, s.fetch || (s.fetch = m, s.Headers = P, s.Request = K, s.Response = Y), o.Headers = P, o.Request = K, o.Response = Y, o.fetch = m, Object.defineProperty(o, "__esModule", { value: !0 }), o; - })({}); - })(n), n.fetch.ponyfill = !0, delete n.fetch.polyfill; - var i = n; - e = i.fetch, e.default = i.fetch, e.fetch = i.fetch, e.Headers = i.Headers, e.Request = i.Request, e.Response = i.Response, t.exports = e; -})(Y1, Y1.exports); -var OG = Y1.exports; -const Q3 = /* @__PURE__ */ ns(OG); -var NG = Object.defineProperty, LG = Object.defineProperties, kG = Object.getOwnPropertyDescriptors, e6 = Object.getOwnPropertySymbols, $G = Object.prototype.hasOwnProperty, BG = Object.prototype.propertyIsEnumerable, t6 = (t, e, r) => e in t ? NG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, r6 = (t, e) => { - for (var r in e || (e = {})) $G.call(e, r) && t6(t, r, e[r]); - if (e6) for (var r of e6(e)) BG.call(e, r) && t6(t, r, e[r]); - return t; -}, n6 = (t, e) => LG(t, kG(e)); -const FG = { Accept: "application/json", "Content-Type": "application/json" }, jG = "POST", i6 = { headers: FG, method: jG }, s6 = 10; -let Cs = class { - constructor(e, r = !1) { - if (this.url = e, this.disableProviderPing = r, this.events = new is.EventEmitter(), this.isAvailable = !1, this.registering = !1, !A3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); - this.url = e, this.disableProviderPing = r; - } - get connected() { - return this.isAvailable; - } - get connecting() { - return this.registering; - } - on(e, r) { - this.events.on(e, r); - } - once(e, r) { - this.events.once(e, r); - } - off(e, r) { - this.events.off(e, r); - } - removeListener(e, r) { - this.events.removeListener(e, r); - } - async open(e = this.url) { - await this.register(e); - } - async close() { - if (!this.isAvailable) throw new Error("Connection already closed"); - this.onClose(); - } - async send(e) { - this.isAvailable || await this.register(); - try { - const r = jo(e), n = await (await Q3(this.url, n6(r6({}, i6), { body: r }))).json(); - this.onPayload({ data: n }); - } catch (r) { - this.onError(e.id, r); - } - } - async register(e = this.url) { - if (!A3(e)) throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`); - if (this.registering) { - const r = this.events.getMaxListeners(); - return (this.events.listenerCount("register_error") >= r || this.events.listenerCount("open") >= r) && this.events.setMaxListeners(r + 1), new Promise((n, i) => { - this.events.once("register_error", (s) => { - this.resetMaxListeners(), i(s); - }), this.events.once("open", () => { - if (this.resetMaxListeners(), typeof this.isAvailable > "u") return i(new Error("HTTP connection is missing or invalid")); - n(); - }); - }); - } - this.url = e, this.registering = !0; - try { - if (!this.disableProviderPing) { - const r = jo({ id: 1, jsonrpc: "2.0", method: "test", params: [] }); - await Q3(e, n6(r6({}, i6), { body: r })); - } - this.onOpen(); - } catch (r) { - const n = this.parseError(r); - throw this.events.emit("register_error", n), this.onClose(), n; - } - } - onOpen() { - this.isAvailable = !0, this.registering = !1, this.events.emit("open"); - } - onClose() { - this.isAvailable = !1, this.registering = !1, this.events.emit("close"); - } - onPayload(e) { - if (typeof e.data > "u") return; - const r = typeof e.data == "string" ? bc(e.data) : e.data; - this.events.emit("payload", r); - } - onError(e, r) { - const n = this.parseError(r), i = n.message || n.toString(), s = vp(e, i); - this.events.emit("payload", s); - } - parseError(e, r = this.url) { - return AE(e, r, "HTTP"); - } - resetMaxListeners() { - this.events.getMaxListeners() > s6 && this.events.setMaxListeners(s6); - } -}; -const o6 = "error", UG = "wss://relay.walletconnect.org", qG = "wc", zG = "universal_provider", a6 = `${qG}@2:${zG}:`, YE = "https://rpc.walletconnect.org/v1/", au = "generic", WG = `${YE}bundler`, fs = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" }; -var HG = Object.defineProperty, KG = Object.defineProperties, VG = Object.getOwnPropertyDescriptors, c6 = Object.getOwnPropertySymbols, GG = Object.prototype.hasOwnProperty, YG = Object.prototype.propertyIsEnumerable, u6 = (t, e, r) => e in t ? HG(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, _d = (t, e) => { - for (var r in e || (e = {})) GG.call(e, r) && u6(t, r, e[r]); - if (c6) for (var r of c6(e)) YG.call(e, r) && u6(t, r, e[r]); - return t; -}, JG = (t, e) => KG(t, VG(e)); -function Li(t, e, r) { - var n; - const i = Eu(t); - return ((n = e.rpcMap) == null ? void 0 : n[i.reference]) || `${YE}?chainId=${i.namespace}:${i.reference}&projectId=${r}`; -} -function Nc(t) { - return t.includes(":") ? t.split(":")[1] : t; -} -function JE(t) { - return t.map((e) => `${e.split(":")[0]}:${e.split(":")[1]}`); -} -function XG(t, e) { - const r = Object.keys(e.namespaces).filter((i) => i.includes(t)); - if (!r.length) return []; - const n = []; - return r.forEach((i) => { - const s = e.namespaces[i].accounts; - n.push(...s); - }), n; -} -function Dm(t = {}, e = {}) { - const r = f6(t), n = f6(e); - return DG.merge(r, n); -} -function f6(t) { - var e, r, n, i; - const s = {}; - if (!Ll(t)) return s; - for (const [o, a] of Object.entries(t)) { - const u = _b(o) ? [o] : a.chains, l = a.methods || [], d = a.events || [], p = a.rpcMap || {}, w = Vf(o); - s[w] = JG(_d(_d({}, s[w]), a), { chains: jd(u, (e = s[w]) == null ? void 0 : e.chains), methods: jd(l, (r = s[w]) == null ? void 0 : r.methods), events: jd(d, (n = s[w]) == null ? void 0 : n.events), rpcMap: _d(_d({}, p), (i = s[w]) == null ? void 0 : i.rpcMap) }); - } - return s; -} -function ZG(t) { - return t.includes(":") ? t.split(":")[2] : t; -} -function l6(t) { - const e = {}; - for (const [r, n] of Object.entries(t)) { - const i = n.methods || [], s = n.events || [], o = n.accounts || [], a = _b(r) ? [r] : n.chains ? n.chains : JE(n.accounts); - e[r] = { chains: a, methods: i, events: s, accounts: o }; - } - return e; -} -function Om(t) { - return typeof t == "number" ? t : t.includes("0x") ? parseInt(t, 16) : (t = t.includes(":") ? t.split(":")[1] : t, isNaN(Number(t)) ? t : Number(t)); -} -const XE = {}, Pr = (t) => XE[t], Nm = (t, e) => { - XE[t] = e; -}; -class QG { - constructor(e) { - this.name = "polkadot", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); - } - updateNamespace(e) { - this.namespace = Object.assign(this.namespace, e); - } - requestAccounts() { - return this.getAccounts(); - } - getDefaultChain() { - if (this.chainId) return this.chainId; - if (this.namespace.defaultChain) return this.namespace.defaultChain; - const e = this.namespace.chains[0]; - if (!e) throw new Error("ChainId not found"); - return e.split(":")[1]; - } - request(e) { - return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); - } - setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); - } - getAccounts() { - const e = this.namespace.accounts; - return e ? e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]) || [] : []; - } - createHttpProviders() { - const e = {}; - return this.namespace.chains.forEach((r) => { - var n; - const i = Nc(r); - e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); - }), e; - } - getHttpProvider() { - const e = `${this.name}:${this.chainId}`, r = this.httpProviders[e]; - if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); - return r; - } - setHttpProvider(e, r) { - const n = this.createHttpProvider(e, r); - n && (this.httpProviders[e] = n); - } - createHttpProvider(e, r) { - const n = r || Li(e, this.namespace, this.client.core.projectId); - if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new us(new Cs(n, Pr("disableProviderPing"))); - } -} -var eY = Object.defineProperty, tY = Object.defineProperties, rY = Object.getOwnPropertyDescriptors, h6 = Object.getOwnPropertySymbols, nY = Object.prototype.hasOwnProperty, iY = Object.prototype.propertyIsEnumerable, d6 = (t, e, r) => e in t ? eY(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, p6 = (t, e) => { - for (var r in e || (e = {})) nY.call(e, r) && d6(t, r, e[r]); - if (h6) for (var r of h6(e)) iY.call(e, r) && d6(t, r, e[r]); - return t; -}, g6 = (t, e) => tY(t, rY(e)); -class sY { - constructor(e) { - this.name = "eip155", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.httpProviders = this.createHttpProviders(), this.chainId = parseInt(this.getDefaultChain()); - } - async request(e) { - switch (e.request.method) { - case "eth_requestAccounts": - return this.getAccounts(); - case "eth_accounts": - return this.getAccounts(); - case "wallet_switchEthereumChain": - return await this.handleSwitchChain(e); - case "eth_chainId": - return parseInt(this.getDefaultChain()); - case "wallet_getCapabilities": - return await this.getCapabilities(e); - case "wallet_getCallsStatus": - return await this.getCallStatus(e); - } - return this.namespace.methods.includes(e.request.method) ? await this.client.request(e) : this.getHttpProvider().request(e.request); - } - updateNamespace(e) { - this.namespace = Object.assign(this.namespace, e); - } - setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(parseInt(e), r), this.chainId = parseInt(e), this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); - } - requestAccounts() { - return this.getAccounts(); - } - getDefaultChain() { - if (this.chainId) return this.chainId.toString(); - if (this.namespace.defaultChain) return this.namespace.defaultChain; - const e = this.namespace.chains[0]; - if (!e) throw new Error("ChainId not found"); - return e.split(":")[1]; - } - createHttpProvider(e, r) { - const n = r || Li(`${this.name}:${e}`, this.namespace, this.client.core.projectId); - if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new us(new Cs(n, Pr("disableProviderPing"))); - } - setHttpProvider(e, r) { - const n = this.createHttpProvider(e, r); - n && (this.httpProviders[e] = n); - } - createHttpProviders() { - const e = {}; - return this.namespace.chains.forEach((r) => { - var n; - const i = parseInt(Nc(r)); - e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); - }), e; - } - getAccounts() { - const e = this.namespace.accounts; - return e ? [...new Set(e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]))] : []; - } - getHttpProvider() { - const e = this.chainId, r = this.httpProviders[e]; - if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); - return r; - } - async handleSwitchChain(e) { - var r, n; - let i = e.request.params ? (r = e.request.params[0]) == null ? void 0 : r.chainId : "0x0"; - i = i.startsWith("0x") ? i : `0x${i}`; - const s = parseInt(i, 16); - if (this.isChainApproved(s)) this.setDefaultChain(`${s}`); - else if (this.namespace.methods.includes("wallet_switchEthereumChain")) await this.client.request({ topic: e.topic, request: { method: e.request.method, params: [{ chainId: i }] }, chainId: (n = this.namespace.chains) == null ? void 0 : n[0] }), this.setDefaultChain(`${s}`); - else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`); - return null; - } - isChainApproved(e) { - return this.namespace.chains.includes(`${this.name}:${e}`); - } - async getCapabilities(e) { - var r, n, i; - const s = (n = (r = e.request) == null ? void 0 : r.params) == null ? void 0 : n[0]; - if (!s) throw new Error("Missing address parameter in `wallet_getCapabilities` request"); - const o = this.client.session.get(e.topic), a = ((i = o == null ? void 0 : o.sessionProperties) == null ? void 0 : i.capabilities) || {}; - if (a != null && a[s]) return a == null ? void 0 : a[s]; - const u = await this.client.request(e); - try { - await this.client.session.update(e.topic, { sessionProperties: g6(p6({}, o.sessionProperties || {}), { capabilities: g6(p6({}, a || {}), { [s]: u }) }) }); - } catch (l) { - console.warn("Failed to update session with capabilities", l); - } - return u; - } - async getCallStatus(e) { - var r, n; - const i = this.client.session.get(e.topic), s = (r = i.sessionProperties) == null ? void 0 : r.bundler_name; - if (s) { - const a = this.getBundlerUrl(e.chainId, s); - try { - return await this.getUserOperationReceipt(a, e); - } catch (u) { - console.warn("Failed to fetch call status from bundler", u, a); - } - } - const o = (n = i.sessionProperties) == null ? void 0 : n.bundler_url; - if (o) try { - return await this.getUserOperationReceipt(o, e); - } catch (a) { - console.warn("Failed to fetch call status from custom bundler", a, o); - } - if (this.namespace.methods.includes(e.request.method)) return await this.client.request(e); - throw new Error("Fetching call status not approved by the wallet."); - } - async getUserOperationReceipt(e, r) { - var n; - const i = new URL(e), s = await fetch(i, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(ga("eth_getUserOperationReceipt", [(n = r.request.params) == null ? void 0 : n[0]])) }); - if (!s.ok) throw new Error(`Failed to fetch user operation receipt - ${s.status}`); - return await s.json(); - } - getBundlerUrl(e, r) { - return `${WG}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`; - } -} -class oY { - constructor(e) { - this.name = "solana", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); - } - updateNamespace(e) { - this.namespace = Object.assign(this.namespace, e); - } - requestAccounts() { - return this.getAccounts(); - } - request(e) { - return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); - } - setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); - } - getDefaultChain() { - if (this.chainId) return this.chainId; - if (this.namespace.defaultChain) return this.namespace.defaultChain; - const e = this.namespace.chains[0]; - if (!e) throw new Error("ChainId not found"); - return e.split(":")[1]; - } - getAccounts() { - const e = this.namespace.accounts; - return e ? [...new Set(e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]))] : []; - } - createHttpProviders() { - const e = {}; - return this.namespace.chains.forEach((r) => { - var n; - const i = Nc(r); - e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); - }), e; - } - getHttpProvider() { - const e = `${this.name}:${this.chainId}`, r = this.httpProviders[e]; - if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); - return r; - } - setHttpProvider(e, r) { - const n = this.createHttpProvider(e, r); - n && (this.httpProviders[e] = n); - } - createHttpProvider(e, r) { - const n = r || Li(e, this.namespace, this.client.core.projectId); - if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new us(new Cs(n, Pr("disableProviderPing"))); - } -} -let aY = class { - constructor(e) { - this.name = "cosmos", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); - } - updateNamespace(e) { - this.namespace = Object.assign(this.namespace, e); - } - requestAccounts() { - return this.getAccounts(); - } - getDefaultChain() { - if (this.chainId) return this.chainId; - if (this.namespace.defaultChain) return this.namespace.defaultChain; - const e = this.namespace.chains[0]; - if (!e) throw new Error("ChainId not found"); - return e.split(":")[1]; - } - request(e) { - return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); - } - setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); - } - getAccounts() { - const e = this.namespace.accounts; - return e ? [...new Set(e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]))] : []; - } - createHttpProviders() { - const e = {}; - return this.namespace.chains.forEach((r) => { - var n; - const i = Nc(r); - e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); - }), e; - } - getHttpProvider() { - const e = `${this.name}:${this.chainId}`, r = this.httpProviders[e]; - if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); - return r; - } - setHttpProvider(e, r) { - const n = this.createHttpProvider(e, r); - n && (this.httpProviders[e] = n); - } - createHttpProvider(e, r) { - const n = r || Li(e, this.namespace, this.client.core.projectId); - if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new us(new Cs(n, Pr("disableProviderPing"))); - } -}, cY = class { - constructor(e) { - this.name = "algorand", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); - } - updateNamespace(e) { - this.namespace = Object.assign(this.namespace, e); - } - requestAccounts() { - return this.getAccounts(); - } - request(e) { - return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); - } - setDefaultChain(e, r) { - if (!this.httpProviders[e]) { - const n = r || Li(`${this.name}:${e}`, this.namespace, this.client.core.projectId); - if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - this.setHttpProvider(e, n); - } - this.chainId = e, this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); - } - getDefaultChain() { - if (this.chainId) return this.chainId; - if (this.namespace.defaultChain) return this.namespace.defaultChain; - const e = this.namespace.chains[0]; - if (!e) throw new Error("ChainId not found"); - return e.split(":")[1]; - } - getAccounts() { - const e = this.namespace.accounts; - return e ? [...new Set(e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]))] : []; - } - createHttpProviders() { - const e = {}; - return this.namespace.chains.forEach((r) => { - var n; - e[r] = this.createHttpProvider(r, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); - }), e; - } - getHttpProvider() { - const e = `${this.name}:${this.chainId}`, r = this.httpProviders[e]; - if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); - return r; - } - setHttpProvider(e, r) { - const n = this.createHttpProvider(e, r); - n && (this.httpProviders[e] = n); - } - createHttpProvider(e, r) { - const n = r || Li(e, this.namespace, this.client.core.projectId); - return typeof n > "u" ? void 0 : new us(new Cs(n, Pr("disableProviderPing"))); - } -}, uY = class { - constructor(e) { - this.name = "cip34", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); - } - updateNamespace(e) { - this.namespace = Object.assign(this.namespace, e); - } - requestAccounts() { - return this.getAccounts(); - } - getDefaultChain() { - if (this.chainId) return this.chainId; - if (this.namespace.defaultChain) return this.namespace.defaultChain; - const e = this.namespace.chains[0]; - if (!e) throw new Error("ChainId not found"); - return e.split(":")[1]; - } - request(e) { - return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); - } - setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); - } - getAccounts() { - const e = this.namespace.accounts; - return e ? [...new Set(e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]))] : []; - } - createHttpProviders() { - const e = {}; - return this.namespace.chains.forEach((r) => { - const n = this.getCardanoRPCUrl(r), i = Nc(r); - e[i] = this.createHttpProvider(i, n); - }), e; - } - getHttpProvider() { - const e = `${this.name}:${this.chainId}`, r = this.httpProviders[e]; - if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); - return r; - } - getCardanoRPCUrl(e) { - const r = this.namespace.rpcMap; - if (r) return r[e]; - } - setHttpProvider(e, r) { - const n = this.createHttpProvider(e, r); - n && (this.httpProviders[e] = n); - } - createHttpProvider(e, r) { - const n = r || this.getCardanoRPCUrl(e); - if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new us(new Cs(n, Pr("disableProviderPing"))); - } -}, fY = class { - constructor(e) { - this.name = "elrond", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); - } - updateNamespace(e) { - this.namespace = Object.assign(this.namespace, e); - } - requestAccounts() { - return this.getAccounts(); - } - request(e) { - return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); - } - setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); - } - getDefaultChain() { - if (this.chainId) return this.chainId; - if (this.namespace.defaultChain) return this.namespace.defaultChain; - const e = this.namespace.chains[0]; - if (!e) throw new Error("ChainId not found"); - return e.split(":")[1]; - } - getAccounts() { - const e = this.namespace.accounts; - return e ? [...new Set(e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]))] : []; - } - createHttpProviders() { - const e = {}; - return this.namespace.chains.forEach((r) => { - var n; - const i = Nc(r); - e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); - }), e; - } - getHttpProvider() { - const e = `${this.name}:${this.chainId}`, r = this.httpProviders[e]; - if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); - return r; - } - setHttpProvider(e, r) { - const n = this.createHttpProvider(e, r); - n && (this.httpProviders[e] = n); - } - createHttpProvider(e, r) { - const n = r || Li(e, this.namespace, this.client.core.projectId); - if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new us(new Cs(n, Pr("disableProviderPing"))); - } -}; -class lY { - constructor(e) { - this.name = "multiversx", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); - } - updateNamespace(e) { - this.namespace = Object.assign(this.namespace, e); - } - requestAccounts() { - return this.getAccounts(); - } - request(e) { - return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); - } - setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); - } - getDefaultChain() { - if (this.chainId) return this.chainId; - if (this.namespace.defaultChain) return this.namespace.defaultChain; - const e = this.namespace.chains[0]; - if (!e) throw new Error("ChainId not found"); - return e.split(":")[1]; - } - getAccounts() { - const e = this.namespace.accounts; - return e ? [...new Set(e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]))] : []; - } - createHttpProviders() { - const e = {}; - return this.namespace.chains.forEach((r) => { - var n; - const i = Nc(r); - e[i] = this.createHttpProvider(i, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); - }), e; - } - getHttpProvider() { - const e = `${this.name}:${this.chainId}`, r = this.httpProviders[e]; - if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); - return r; - } - setHttpProvider(e, r) { - const n = this.createHttpProvider(e, r); - n && (this.httpProviders[e] = n); - } - createHttpProvider(e, r) { - const n = r || Li(e, this.namespace, this.client.core.projectId); - if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new us(new Cs(n, Pr("disableProviderPing"))); - } -} -let hY = class { - constructor(e) { - this.name = "near", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); - } - updateNamespace(e) { - this.namespace = Object.assign(this.namespace, e); - } - requestAccounts() { - return this.getAccounts(); - } - getDefaultChain() { - if (this.chainId) return this.chainId; - if (this.namespace.defaultChain) return this.namespace.defaultChain; - const e = this.namespace.chains[0]; - if (!e) throw new Error("ChainId not found"); - return e.split(":")[1]; - } - request(e) { - return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); - } - setDefaultChain(e, r) { - if (this.chainId = e, !this.httpProviders[e]) { - const n = r || Li(`${this.name}:${e}`, this.namespace); - if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - this.setHttpProvider(e, n); - } - this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); - } - getAccounts() { - const e = this.namespace.accounts; - return e ? e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]) || [] : []; - } - createHttpProviders() { - const e = {}; - return this.namespace.chains.forEach((r) => { - var n; - e[r] = this.createHttpProvider(r, (n = this.namespace.rpcMap) == null ? void 0 : n[r]); - }), e; - } - getHttpProvider() { - const e = `${this.name}:${this.chainId}`, r = this.httpProviders[e]; - if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); - return r; - } - setHttpProvider(e, r) { - const n = this.createHttpProvider(e, r); - n && (this.httpProviders[e] = n); - } - createHttpProvider(e, r) { - const n = r || Li(e, this.namespace); - return typeof n > "u" ? void 0 : new us(new Cs(n, Pr("disableProviderPing"))); - } -}; -class dY { - constructor(e) { - this.name = "tezos", this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); - } - updateNamespace(e) { - this.namespace = Object.assign(this.namespace, e); - } - requestAccounts() { - return this.getAccounts(); - } - getDefaultChain() { - if (this.chainId) return this.chainId; - if (this.namespace.defaultChain) return this.namespace.defaultChain; - const e = this.namespace.chains[0]; - if (!e) throw new Error("ChainId not found"); - return e.split(":")[1]; - } - request(e) { - return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider().request(e.request); - } - setDefaultChain(e, r) { - if (this.chainId = e, !this.httpProviders[e]) { - const n = r || Li(`${this.name}:${e}`, this.namespace); - if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - this.setHttpProvider(e, n); - } - this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${this.chainId}`); - } - getAccounts() { - const e = this.namespace.accounts; - return e ? e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]) || [] : []; - } - createHttpProviders() { - const e = {}; - return this.namespace.chains.forEach((r) => { - e[r] = this.createHttpProvider(r); - }), e; - } - getHttpProvider() { - const e = `${this.name}:${this.chainId}`, r = this.httpProviders[e]; - if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); - return r; - } - setHttpProvider(e, r) { - const n = this.createHttpProvider(e, r); - n && (this.httpProviders[e] = n); - } - createHttpProvider(e, r) { - const n = r || Li(e, this.namespace); - return typeof n > "u" ? void 0 : new us(new Cs(n)); - } -} -class pY { - constructor(e) { - this.name = au, this.namespace = e.namespace, this.events = Pr("events"), this.client = Pr("client"), this.chainId = this.getDefaultChain(), this.httpProviders = this.createHttpProviders(); - } - updateNamespace(e) { - this.namespace.chains = [...new Set((this.namespace.chains || []).concat(e.chains || []))], this.namespace.accounts = [...new Set((this.namespace.accounts || []).concat(e.accounts || []))], this.namespace.methods = [...new Set((this.namespace.methods || []).concat(e.methods || []))], this.namespace.events = [...new Set((this.namespace.events || []).concat(e.events || []))], this.httpProviders = this.createHttpProviders(); - } - requestAccounts() { - return this.getAccounts(); - } - request(e) { - return this.namespace.methods.includes(e.request.method) ? this.client.request(e) : this.getHttpProvider(e.chainId).request(e.request); - } - setDefaultChain(e, r) { - this.httpProviders[e] || this.setHttpProvider(e, r), this.chainId = e, this.events.emit(fs.DEFAULT_CHAIN_CHANGED, `${this.name}:${e}`); - } - getDefaultChain() { - if (this.chainId) return this.chainId; - if (this.namespace.defaultChain) return this.namespace.defaultChain; - const e = this.namespace.chains[0]; - if (!e) throw new Error("ChainId not found"); - return e.split(":")[1]; - } - getAccounts() { - const e = this.namespace.accounts; - return e ? [...new Set(e.filter((r) => r.split(":")[1] === this.chainId.toString()).map((r) => r.split(":")[2]))] : []; - } - createHttpProviders() { - var e, r; - const n = {}; - return (r = (e = this.namespace) == null ? void 0 : e.accounts) == null || r.forEach((i) => { - const s = Eu(i); - n[`${s.namespace}:${s.reference}`] = this.createHttpProvider(i); - }), n; - } - getHttpProvider(e) { - const r = this.httpProviders[e]; - if (typeof r > "u") throw new Error(`JSON-RPC provider for ${e} not found`); - return r; - } - setHttpProvider(e, r) { - const n = this.createHttpProvider(e, r); - n && (this.httpProviders[e] = n); - } - createHttpProvider(e, r) { - const n = r || Li(e, this.namespace, this.client.core.projectId); - if (!n) throw new Error(`No RPC url provided for chainId: ${e}`); - return new us(new Cs(n, Pr("disableProviderPing"))); - } -} -var gY = Object.defineProperty, mY = Object.defineProperties, vY = Object.getOwnPropertyDescriptors, m6 = Object.getOwnPropertySymbols, bY = Object.prototype.hasOwnProperty, yY = Object.prototype.propertyIsEnumerable, v6 = (t, e, r) => e in t ? gY(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Ed = (t, e) => { - for (var r in e || (e = {})) bY.call(e, r) && v6(t, r, e[r]); - if (m6) for (var r of m6(e)) yY.call(e, r) && v6(t, r, e[r]); - return t; -}, Lm = (t, e) => mY(t, vY(e)); -let J1 = class ZE { - constructor(e) { - this.events = new Xv(), this.rpcProviders = {}, this.shouldAbortPairingAttempt = !1, this.maxPairingAttempts = 10, this.disableProviderPing = !1, this.providerOpts = e, this.logger = typeof (e == null ? void 0 : e.logger) < "u" && typeof (e == null ? void 0 : e.logger) != "string" ? e.logger : Xl(X0({ level: (e == null ? void 0 : e.logger) || o6 })), this.disableProviderPing = (e == null ? void 0 : e.disableProviderPing) || !1; - } - static async init(e) { - const r = new ZE(e); - return await r.initialize(), r; - } - async request(e, r, n) { - const [i, s] = this.validateChain(r); - if (!this.session) throw new Error("Please call connect() before request()"); - return await this.getProvider(i).request({ request: Ed({}, e), chainId: `${i}:${s}`, topic: this.session.topic, expiry: n }); - } - sendAsync(e, r, n, i) { - const s = (/* @__PURE__ */ new Date()).getTime(); - this.request(e, n, i).then((o) => r(null, mp(s, o))).catch((o) => r(o, void 0)); - } - async enable() { - if (!this.client) throw new Error("Sign Client not initialized"); - return this.session || await this.connect({ namespaces: this.namespaces, optionalNamespaces: this.optionalNamespaces, sessionProperties: this.sessionProperties }), await this.requestAccounts(); - } - async disconnect() { - var e; - if (!this.session) throw new Error("Please call connect() before enable()"); - await this.client.disconnect({ topic: (e = this.session) == null ? void 0 : e.topic, reason: Or("USER_DISCONNECTED") }), await this.cleanup(); - } - async connect(e) { - if (!this.client) throw new Error("Sign Client not initialized"); - if (this.setNamespaces(e), await this.cleanupPendingPairings(), !e.skipPairing) return await this.pair(e.pairingTopic); - } - async authenticate(e, r) { - if (!this.client) throw new Error("Sign Client not initialized"); - this.setNamespaces(e), await this.cleanupPendingPairings(); - const { uri: n, response: i } = await this.client.authenticate(e, r); - n && (this.uri = n, this.events.emit("display_uri", n)); - const s = await i(); - if (this.session = s.session, this.session) { - const o = l6(this.session.namespaces); - this.namespaces = Dm(this.namespaces, o), this.persist("namespaces", this.namespaces), this.onConnect(); - } - return s; - } - on(e, r) { - this.events.on(e, r); - } - once(e, r) { - this.events.once(e, r); - } - removeListener(e, r) { - this.events.removeListener(e, r); - } - off(e, r) { - this.events.off(e, r); - } - get isWalletConnect() { - return !0; - } - async pair(e) { - this.shouldAbortPairingAttempt = !1; - let r = 0; - do { - if (this.shouldAbortPairingAttempt) throw new Error("Pairing aborted"); - if (r >= this.maxPairingAttempts) throw new Error("Max auto pairing attempts reached"); - const { uri: n, approval: i } = await this.client.connect({ pairingTopic: e, requiredNamespaces: this.namespaces, optionalNamespaces: this.optionalNamespaces, sessionProperties: this.sessionProperties }); - n && (this.uri = n, this.events.emit("display_uri", n)), await i().then((s) => { - this.session = s; - const o = l6(s.namespaces); - this.namespaces = Dm(this.namespaces, o), this.persist("namespaces", this.namespaces); - }).catch((s) => { - if (s.message !== GE) throw s; - r++; - }); - } while (!this.session); - return this.onConnect(), this.session; - } - setDefaultChain(e, r) { - try { - if (!this.session) return; - const [n, i] = this.validateChain(e), s = this.getProvider(n); - s.name === au ? s.setDefaultChain(`${n}:${i}`, r) : s.setDefaultChain(i, r); - } catch (n) { - if (!/Please call connect/.test(n.message)) throw n; - } - } - async cleanupPendingPairings(e = {}) { - this.logger.info("Cleaning up inactive pairings..."); - const r = this.client.pairing.getAll(); - if (_c(r)) { - for (const n of r) e.deletePairings ? this.client.core.expirer.set(n.topic, 0) : await this.client.core.relayer.subscriber.unsubscribe(n.topic); - this.logger.info(`Inactive pairings cleared: ${r.length}`); - } - } - abortPairingAttempt() { - this.shouldAbortPairingAttempt = !0; - } - async checkStorage() { - if (this.namespaces = await this.getFromStore("namespaces"), this.optionalNamespaces = await this.getFromStore("optionalNamespaces") || {}, this.client.session.length) { - const e = this.client.session.keys.length - 1; - this.session = this.client.session.get(this.client.session.keys[e]), this.createProviders(); - } - } - async initialize() { - this.logger.trace("Initialized"), await this.createClient(), await this.checkStorage(), this.registerEventListeners(); - } - async createClient() { - this.client = this.providerOpts.client || await Ib.init({ core: this.providerOpts.core, logger: this.providerOpts.logger || o6, relayUrl: this.providerOpts.relayUrl || UG, projectId: this.providerOpts.projectId, metadata: this.providerOpts.metadata, storageOptions: this.providerOpts.storageOptions, storage: this.providerOpts.storage, name: this.providerOpts.name, customStoragePrefix: this.providerOpts.customStoragePrefix, telemetryEnabled: this.providerOpts.telemetryEnabled }), this.logger.trace("SignClient Initialized"); - } - createProviders() { - if (!this.client) throw new Error("Sign Client not initialized"); - if (!this.session) throw new Error("Session not initialized. Please call connect() before enable()"); - const e = [...new Set(Object.keys(this.session.namespaces).map((r) => Vf(r)))]; - Nm("client", this.client), Nm("events", this.events), Nm("disableProviderPing", this.disableProviderPing), e.forEach((r) => { - if (!this.session) return; - const n = XG(r, this.session), i = JE(n), s = Dm(this.namespaces, this.optionalNamespaces), o = Lm(Ed({}, s[r]), { accounts: n, chains: i }); - switch (r) { - case "eip155": - this.rpcProviders[r] = new sY({ namespace: o }); - break; - case "algorand": - this.rpcProviders[r] = new cY({ namespace: o }); - break; - case "solana": - this.rpcProviders[r] = new oY({ namespace: o }); - break; - case "cosmos": - this.rpcProviders[r] = new aY({ namespace: o }); - break; - case "polkadot": - this.rpcProviders[r] = new QG({ namespace: o }); - break; - case "cip34": - this.rpcProviders[r] = new uY({ namespace: o }); - break; - case "elrond": - this.rpcProviders[r] = new fY({ namespace: o }); - break; - case "multiversx": - this.rpcProviders[r] = new lY({ namespace: o }); - break; - case "near": - this.rpcProviders[r] = new hY({ namespace: o }); - break; - case "tezos": - this.rpcProviders[r] = new dY({ namespace: o }); - break; - default: - this.rpcProviders[au] ? this.rpcProviders[au].updateNamespace(o) : this.rpcProviders[au] = new pY({ namespace: o }); - } - }); - } - registerEventListeners() { - if (typeof this.client > "u") throw new Error("Sign Client is not initialized"); - this.client.on("session_ping", (e) => { - this.events.emit("session_ping", e); - }), this.client.on("session_event", (e) => { - const { params: r } = e, { event: n } = r; - if (n.name === "accountsChanged") { - const i = n.data; - i && _c(i) && this.events.emit("accountsChanged", i.map(ZG)); - } else if (n.name === "chainChanged") { - const i = r.chainId, s = r.event.data, o = Vf(i), a = Om(i) !== Om(s) ? `${o}:${Om(s)}` : i; - this.onChainChanged(a); - } else this.events.emit(n.name, n.data); - this.events.emit("session_event", e); - }), this.client.on("session_update", ({ topic: e, params: r }) => { - var n; - const { namespaces: i } = r, s = (n = this.client) == null ? void 0 : n.session.get(e); - this.session = Lm(Ed({}, s), { namespaces: i }), this.onSessionUpdate(), this.events.emit("session_update", { topic: e, params: r }); - }), this.client.on("session_delete", async (e) => { - await this.cleanup(), this.events.emit("session_delete", e), this.events.emit("disconnect", Lm(Ed({}, Or("USER_DISCONNECTED")), { data: e.topic })); - }), this.on(fs.DEFAULT_CHAIN_CHANGED, (e) => { - this.onChainChanged(e, !0); - }); - } - getProvider(e) { - return this.rpcProviders[e] || this.rpcProviders[au]; - } - onSessionUpdate() { - Object.keys(this.rpcProviders).forEach((e) => { - var r; - this.getProvider(e).updateNamespace((r = this.session) == null ? void 0 : r.namespaces[e]); - }); - } - setNamespaces(e) { - const { namespaces: r, optionalNamespaces: n, sessionProperties: i } = e; - r && Object.keys(r).length && (this.namespaces = r), n && Object.keys(n).length && (this.optionalNamespaces = n), this.sessionProperties = i, this.persist("namespaces", r), this.persist("optionalNamespaces", n); - } - validateChain(e) { - const [r, n] = (e == null ? void 0 : e.split(":")) || ["", ""]; - if (!this.namespaces || !Object.keys(this.namespaces).length) return [r, n]; - if (r && !Object.keys(this.namespaces || {}).map((o) => Vf(o)).includes(r)) throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`); - if (r && n) return [r, n]; - const i = Vf(Object.keys(this.namespaces)[0]), s = this.rpcProviders[i].getDefaultChain(); - return [i, s]; - } - async requestAccounts() { - const [e] = this.validateChain(); - return await this.getProvider(e).requestAccounts(); - } - onChainChanged(e, r = !1) { - if (!this.namespaces) return; - const [n, i] = this.validateChain(e); - i && (r || this.getProvider(n).setDefaultChain(i), this.namespaces[n] ? this.namespaces[n].defaultChain = i : this.namespaces[`${n}:${i}`] ? this.namespaces[`${n}:${i}`].defaultChain = i : this.namespaces[`${n}:${i}`] = { defaultChain: i }, this.persist("namespaces", this.namespaces), this.events.emit("chainChanged", i)); - } - onConnect() { - this.createProviders(), this.events.emit("connect", { session: this.session }); - } - async cleanup() { - this.session = void 0, this.namespaces = void 0, this.optionalNamespaces = void 0, this.sessionProperties = void 0, this.persist("namespaces", void 0), this.persist("optionalNamespaces", void 0), this.persist("sessionProperties", void 0), await this.cleanupPendingPairings({ deletePairings: !0 }); - } - persist(e, r) { - this.client.core.storage.setItem(`${a6}/${e}`, r); - } - async getFromStore(e) { - return await this.client.core.storage.getItem(`${a6}/${e}`); - } -}; -const wY = J1; -function xY() { - return new Promise((t) => { - const e = []; - let r; - window.addEventListener("eip6963:announceProvider", (n) => { - const { detail: i } = n; - r && clearTimeout(r), e.push(i), r = setTimeout(() => t(e), 200); - }), r = setTimeout(() => t(e), 200), window.dispatchEvent(new Event("eip6963:requestProvider")); - }); -} -class no { - constructor(e, r) { - this.scope = e, this.module = r; - } - storeObject(e, r) { - this.setItem(e, JSON.stringify(r)); - } - loadObject(e) { - const r = this.getItem(e); - return r ? JSON.parse(r) : void 0; - } - setItem(e, r) { - localStorage.setItem(this.scopedKey(e), r); - } - getItem(e) { - return localStorage.getItem(this.scopedKey(e)); - } - removeItem(e) { - localStorage.removeItem(this.scopedKey(e)); - } - clear() { - const e = this.scopedKey(""), r = []; - for (let n = 0; n < localStorage.length; n++) { - const i = localStorage.key(n); - typeof i == "string" && i.startsWith(e) && r.push(i); - } - r.forEach((n) => localStorage.removeItem(n)); - } - scopedKey(e) { - return `-${this.scope}${this.module ? `:${this.module}` : ""}:${e}`; - } - static clearAll() { - new no("CBWSDK").clear(), new no("walletlink").clear(); - } -} -const fn = { - rpc: { - invalidInput: -32e3, - resourceNotFound: -32001, - resourceUnavailable: -32002, - transactionRejected: -32003, - methodNotSupported: -32004, - limitExceeded: -32005, - parse: -32700, - invalidRequest: -32600, - methodNotFound: -32601, - invalidParams: -32602, - internal: -32603 - }, - provider: { - userRejectedRequest: 4001, - unauthorized: 4100, - unsupportedMethod: 4200, - disconnected: 4900, - chainDisconnected: 4901, - unsupportedChain: 4902 - } -}, X1 = { - "-32700": { - standard: "JSON RPC 2.0", - message: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text." - }, - "-32600": { - standard: "JSON RPC 2.0", - message: "The JSON sent is not a valid Request object." - }, - "-32601": { - standard: "JSON RPC 2.0", - message: "The method does not exist / is not available." - }, - "-32602": { - standard: "JSON RPC 2.0", - message: "Invalid method parameter(s)." - }, - "-32603": { - standard: "JSON RPC 2.0", - message: "Internal JSON-RPC error." - }, - "-32000": { - standard: "EIP-1474", - message: "Invalid input." - }, - "-32001": { - standard: "EIP-1474", - message: "Resource not found." - }, - "-32002": { - standard: "EIP-1474", - message: "Resource unavailable." - }, - "-32003": { - standard: "EIP-1474", - message: "Transaction rejected." - }, - "-32004": { - standard: "EIP-1474", - message: "Method not supported." - }, - "-32005": { - standard: "EIP-1474", - message: "Request limit exceeded." - }, - 4001: { - standard: "EIP-1193", - message: "User rejected the request." - }, - 4100: { - standard: "EIP-1193", - message: "The requested account and/or method has not been authorized by the user." - }, - 4200: { - standard: "EIP-1193", - message: "The requested method is not supported by this Ethereum provider." - }, - 4900: { - standard: "EIP-1193", - message: "The provider is disconnected from all chains." - }, - 4901: { - standard: "EIP-1193", - message: "The provider is disconnected from the specified chain." - }, - 4902: { - standard: "EIP-3085", - message: "Unrecognized chain ID." - } -}, QE = "Unspecified error message.", _Y = "Unspecified server error."; -function Cb(t, e = QE) { - if (t && Number.isInteger(t)) { - const r = t.toString(); - if (Z1(X1, r)) - return X1[r].message; - if (eS(t)) - return _Y; - } - return e; -} -function EY(t) { - if (!Number.isInteger(t)) - return !1; - const e = t.toString(); - return !!(X1[e] || eS(t)); -} -function SY(t, { shouldIncludeStack: e = !1 } = {}) { - const r = {}; - if (t && typeof t == "object" && !Array.isArray(t) && Z1(t, "code") && EY(t.code)) { - const n = t; - r.code = n.code, n.message && typeof n.message == "string" ? (r.message = n.message, Z1(n, "data") && (r.data = n.data)) : (r.message = Cb(r.code), r.data = { originalError: b6(t) }); - } else - r.code = fn.rpc.internal, r.message = y6(t, "message") ? t.message : QE, r.data = { originalError: b6(t) }; - return e && (r.stack = y6(t, "stack") ? t.stack : void 0), r; -} -function eS(t) { - return t >= -32099 && t <= -32e3; -} -function b6(t) { - return t && typeof t == "object" && !Array.isArray(t) ? Object.assign({}, t) : t; -} -function Z1(t, e) { - return Object.prototype.hasOwnProperty.call(t, e); -} -function y6(t, e) { - return typeof t == "object" && t !== null && e in t && typeof t[e] == "string"; -} -const Ar = { - rpc: { - parse: (t) => Ji(fn.rpc.parse, t), - invalidRequest: (t) => Ji(fn.rpc.invalidRequest, t), - invalidParams: (t) => Ji(fn.rpc.invalidParams, t), - methodNotFound: (t) => Ji(fn.rpc.methodNotFound, t), - internal: (t) => Ji(fn.rpc.internal, t), - server: (t) => { - if (!t || typeof t != "object" || Array.isArray(t)) - throw new Error("Ethereum RPC Server errors must provide single object argument."); - const { code: e } = t; - if (!Number.isInteger(e) || e > -32005 || e < -32099) - throw new Error('"code" must be an integer such that: -32099 <= code <= -32005'); - return Ji(e, t); - }, - invalidInput: (t) => Ji(fn.rpc.invalidInput, t), - resourceNotFound: (t) => Ji(fn.rpc.resourceNotFound, t), - resourceUnavailable: (t) => Ji(fn.rpc.resourceUnavailable, t), - transactionRejected: (t) => Ji(fn.rpc.transactionRejected, t), - methodNotSupported: (t) => Ji(fn.rpc.methodNotSupported, t), - limitExceeded: (t) => Ji(fn.rpc.limitExceeded, t) - }, - provider: { - userRejectedRequest: (t) => nu(fn.provider.userRejectedRequest, t), - unauthorized: (t) => nu(fn.provider.unauthorized, t), - unsupportedMethod: (t) => nu(fn.provider.unsupportedMethod, t), - disconnected: (t) => nu(fn.provider.disconnected, t), - chainDisconnected: (t) => nu(fn.provider.chainDisconnected, t), - unsupportedChain: (t) => nu(fn.provider.unsupportedChain, t), - custom: (t) => { - if (!t || typeof t != "object" || Array.isArray(t)) - throw new Error("Ethereum Provider custom errors must provide single object argument."); - const { code: e, message: r, data: n } = t; - if (!r || typeof r != "string") - throw new Error('"message" must be a nonempty string'); - return new nS(e, r, n); - } - } -}; -function Ji(t, e) { - const [r, n] = tS(e); - return new rS(t, r || Cb(t), n); -} -function nu(t, e) { - const [r, n] = tS(e); - return new nS(t, r || Cb(t), n); -} -function tS(t) { - if (t) { - if (typeof t == "string") - return [t]; - if (typeof t == "object" && !Array.isArray(t)) { - const { message: e, data: r } = t; - if (e && typeof e != "string") - throw new Error("Must specify string message."); - return [e || void 0, r]; - } - } - return []; -} -class rS extends Error { - constructor(e, r, n) { - if (!Number.isInteger(e)) - throw new Error('"code" must be an integer.'); - if (!r || typeof r != "string") - throw new Error('"message" must be a nonempty string.'); - super(r), this.code = e, n !== void 0 && (this.data = n); - } -} -class nS extends rS { - /** - * Create an Ethereum Provider JSON-RPC error. - * `code` must be an integer in the 1000 <= 4999 range. - */ - constructor(e, r, n) { - if (!AY(e)) - throw new Error('"code" must be an integer such that: 1000 <= code <= 4999'); - super(e, r, n); - } -} -function AY(t) { - return Number.isInteger(t) && t >= 1e3 && t <= 4999; -} -function Tb() { - return (t) => t; -} -const kl = Tb(), PY = Tb(), MY = Tb(); -function Po(t) { - return Math.floor(t); -} -const iS = /^[0-9]*$/, sS = /^[a-f0-9]*$/; -function sc(t) { - return Rb(crypto.getRandomValues(new Uint8Array(t))); -} -function Rb(t) { - return [...t].map((e) => e.toString(16).padStart(2, "0")).join(""); -} -function Wd(t) { - return new Uint8Array(t.match(/.{1,2}/g).map((e) => Number.parseInt(e, 16))); -} -function Qf(t, e = !1) { - const r = t.toString("hex"); - return kl(e ? `0x${r}` : r); -} -function km(t) { - return Qf(Q1(t), !0); -} -function js(t) { - return MY(t.toString(10)); -} -function ma(t) { - return kl(`0x${BigInt(t).toString(16)}`); -} -function oS(t) { - return t.startsWith("0x") || t.startsWith("0X"); -} -function Db(t) { - return oS(t) ? t.slice(2) : t; -} -function aS(t) { - return oS(t) ? `0x${t.slice(2)}` : `0x${t}`; -} -function xp(t) { - if (typeof t != "string") - return !1; - const e = Db(t).toLowerCase(); - return sS.test(e); -} -function IY(t, e = !1) { - if (typeof t == "string") { - const r = Db(t).toLowerCase(); - if (sS.test(r)) - return kl(e ? `0x${r}` : r); - } - throw Ar.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`); -} -function Ob(t, e = !1) { - let r = IY(t, !1); - return r.length % 2 === 1 && (r = kl(`0${r}`)), e ? kl(`0x${r}`) : r; -} -function ia(t) { - if (typeof t == "string") { - const e = Db(t).toLowerCase(); - if (xp(e) && e.length === 40) - return PY(aS(e)); - } - throw Ar.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`); -} -function Q1(t) { - if (Buffer.isBuffer(t)) - return t; - if (typeof t == "string") { - if (xp(t)) { - const e = Ob(t, !1); - return Buffer.from(e, "hex"); - } - return Buffer.from(t, "utf8"); - } - throw Ar.rpc.invalidParams(`Not binary data: ${String(t)}`); -} -function el(t) { - if (typeof t == "number" && Number.isInteger(t)) - return Po(t); - if (typeof t == "string") { - if (iS.test(t)) - return Po(Number(t)); - if (xp(t)) - return Po(Number(BigInt(Ob(t, !0)))); - } - throw Ar.rpc.invalidParams(`Not an integer: ${String(t)}`); -} -function Ff(t) { - if (t !== null && (typeof t == "bigint" || TY(t))) - return BigInt(t.toString(10)); - if (typeof t == "number") - return BigInt(el(t)); - if (typeof t == "string") { - if (iS.test(t)) - return BigInt(t); - if (xp(t)) - return BigInt(Ob(t, !0)); - } - throw Ar.rpc.invalidParams(`Not an integer: ${String(t)}`); -} -function CY(t) { - if (typeof t == "string") - return JSON.parse(t); - if (typeof t == "object") - return t; - throw Ar.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`); -} -function TY(t) { - if (t == null || typeof t.constructor != "function") - return !1; - const { constructor: e } = t; - return typeof e.config == "function" && typeof e.EUCLID == "number"; -} -async function RY() { - return crypto.subtle.generateKey({ - name: "ECDH", - namedCurve: "P-256" - }, !0, ["deriveKey"]); -} -async function DY(t, e) { - return crypto.subtle.deriveKey({ - name: "ECDH", - public: e - }, t, { - name: "AES-GCM", - length: 256 - }, !1, ["encrypt", "decrypt"]); -} -async function OY(t, e) { - const r = crypto.getRandomValues(new Uint8Array(12)), n = await crypto.subtle.encrypt({ - name: "AES-GCM", - iv: r - }, t, new TextEncoder().encode(e)); - return { iv: r, cipherText: n }; -} -async function NY(t, { iv: e, cipherText: r }) { - const n = await crypto.subtle.decrypt({ - name: "AES-GCM", - iv: e - }, t, r); - return new TextDecoder().decode(n); -} -function cS(t) { - switch (t) { - case "public": - return "spki"; - case "private": - return "pkcs8"; - } -} -async function uS(t, e) { - const r = cS(t), n = await crypto.subtle.exportKey(r, e); - return Rb(new Uint8Array(n)); -} -async function fS(t, e) { - const r = cS(t), n = Wd(e).buffer; - return await crypto.subtle.importKey(r, new Uint8Array(n), { - name: "ECDH", - namedCurve: "P-256" - }, !0, t === "private" ? ["deriveKey"] : []); -} -async function LY(t, e) { - const r = JSON.stringify(t, (n, i) => { - if (!(i instanceof Error)) - return i; - const s = i; - return Object.assign(Object.assign({}, s.code ? { code: s.code } : {}), { message: s.message }); - }); - return OY(e, r); -} -async function kY(t, e) { - return JSON.parse(await NY(e, t)); -} -const $m = { - storageKey: "ownPrivateKey", - keyType: "private" -}, Bm = { - storageKey: "ownPublicKey", - keyType: "public" -}, Fm = { - storageKey: "peerPublicKey", - keyType: "public" -}; -class $Y { - constructor() { - this.storage = new no("CBWSDK", "SCWKeyManager"), this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null; - } - async getOwnPublicKey() { - return await this.loadKeysIfNeeded(), this.ownPublicKey; - } - // returns null if the shared secret is not yet derived - async getSharedSecret() { - return await this.loadKeysIfNeeded(), this.sharedSecret; - } - async setPeerPublicKey(e) { - this.sharedSecret = null, this.peerPublicKey = e, await this.storeKey(Fm, e), await this.loadKeysIfNeeded(); - } - async clear() { - this.ownPrivateKey = null, this.ownPublicKey = null, this.peerPublicKey = null, this.sharedSecret = null, this.storage.removeItem(Bm.storageKey), this.storage.removeItem($m.storageKey), this.storage.removeItem(Fm.storageKey); - } - async generateKeyPair() { - const e = await RY(); - this.ownPrivateKey = e.privateKey, this.ownPublicKey = e.publicKey, await this.storeKey($m, e.privateKey), await this.storeKey(Bm, e.publicKey); - } - async loadKeysIfNeeded() { - if (this.ownPrivateKey === null && (this.ownPrivateKey = await this.loadKey($m)), this.ownPublicKey === null && (this.ownPublicKey = await this.loadKey(Bm)), (this.ownPrivateKey === null || this.ownPublicKey === null) && await this.generateKeyPair(), this.peerPublicKey === null && (this.peerPublicKey = await this.loadKey(Fm)), this.sharedSecret === null) { - if (this.ownPrivateKey === null || this.peerPublicKey === null) - return; - this.sharedSecret = await DY(this.ownPrivateKey, this.peerPublicKey); - } - } - // storage methods - async loadKey(e) { - const r = this.storage.getItem(e.storageKey); - return r ? fS(e.keyType, r) : null; - } - async storeKey(e, r) { - const n = await uS(e.keyType, r); - this.storage.setItem(e.storageKey, n); - } -} -const hh = "4.2.4", lS = "@coinbase/wallet-sdk"; -async function hS(t, e) { - const r = Object.assign(Object.assign({}, t), { jsonrpc: "2.0", id: crypto.randomUUID() }), n = await window.fetch(e, { - method: "POST", - body: JSON.stringify(r), - mode: "cors", - headers: { - "Content-Type": "application/json", - "X-Cbw-Sdk-Version": hh, - "X-Cbw-Sdk-Platform": lS - } - }), { result: i, error: s } = await n.json(); - if (s) - throw s; - return i; -} -function BY() { - return globalThis.coinbaseWalletExtension; -} -function FY() { - var t, e; - try { - const r = globalThis; - return (t = r.ethereum) !== null && t !== void 0 ? t : (e = r.top) === null || e === void 0 ? void 0 : e.ethereum; - } catch { - return; - } -} -function jY({ metadata: t, preference: e }) { - var r, n; - const { appName: i, appLogoUrl: s, appChainIds: o } = t; - if (e.options !== "smartWalletOnly") { - const u = BY(); - if (u) - return (r = u.setAppInfo) === null || r === void 0 || r.call(u, i, s, o, e), u; - } - const a = FY(); - if (a != null && a.isCoinbaseBrowser) - return (n = a.setAppInfo) === null || n === void 0 || n.call(a, i, s, o, e), a; -} -function UY(t) { - if (!t || typeof t != "object" || Array.isArray(t)) - throw Ar.rpc.invalidParams({ - message: "Expected a single, non-array, object argument.", - data: t - }); - const { method: e, params: r } = t; - if (typeof e != "string" || e.length === 0) - throw Ar.rpc.invalidParams({ - message: "'args.method' must be a non-empty string.", - data: t - }); - if (r !== void 0 && !Array.isArray(r) && (typeof r != "object" || r === null)) - throw Ar.rpc.invalidParams({ - message: "'args.params' must be an object or array if provided.", - data: t - }); - switch (e) { - case "eth_sign": - case "eth_signTypedData_v2": - case "eth_subscribe": - case "eth_unsubscribe": - throw Ar.provider.unsupportedMethod(); - } -} -const w6 = "accounts", x6 = "activeChain", _6 = "availableChains", E6 = "walletCapabilities"; -class qY { - constructor(e) { - var r, n, i; - this.metadata = e.metadata, this.communicator = e.communicator, this.callback = e.callback, this.keyManager = new $Y(), this.storage = new no("CBWSDK", "SCWStateManager"), this.accounts = (r = this.storage.loadObject(w6)) !== null && r !== void 0 ? r : [], this.chain = this.storage.loadObject(x6) || { - id: (i = (n = e.metadata.appChainIds) === null || n === void 0 ? void 0 : n[0]) !== null && i !== void 0 ? i : 1 - }, this.handshake = this.handshake.bind(this), this.request = this.request.bind(this), this.createRequestMessage = this.createRequestMessage.bind(this), this.decryptResponseMessage = this.decryptResponseMessage.bind(this); - } - async handshake(e) { - var r, n; - const i = await this.createRequestMessage({ - handshake: { - method: e.method, - params: Object.assign({}, this.metadata, (r = e.params) !== null && r !== void 0 ? r : {}) - } - }), s = await this.communicator.postRequestAndWaitForResponse(i); - if ("failure" in s.content) - throw s.content.failure; - const o = await fS("public", s.sender); - await this.keyManager.setPeerPublicKey(o); - const u = (await this.decryptResponseMessage(s)).result; - if ("error" in u) - throw u.error; - const l = u.value; - this.accounts = l, this.storage.storeObject(w6, l), (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", l); - } - async request(e) { - var r; - if (this.accounts.length === 0) - throw Ar.provider.unauthorized(); - switch (e.method) { - case "eth_requestAccounts": - return (r = this.callback) === null || r === void 0 || r.call(this, "connect", { chainId: ma(this.chain.id) }), this.accounts; - case "eth_accounts": - return this.accounts; - case "eth_coinbase": - return this.accounts[0]; - case "net_version": - return this.chain.id; - case "eth_chainId": - return ma(this.chain.id); - case "wallet_getCapabilities": - return this.storage.loadObject(E6); - case "wallet_switchEthereumChain": - return this.handleSwitchChainRequest(e); - case "eth_ecRecover": - case "personal_sign": - case "personal_ecRecover": - case "eth_signTransaction": - case "eth_sendTransaction": - case "eth_signTypedData_v1": - case "eth_signTypedData_v3": - case "eth_signTypedData_v4": - case "eth_signTypedData": - case "wallet_addEthereumChain": - case "wallet_watchAsset": - case "wallet_sendCalls": - case "wallet_showCallsStatus": - case "wallet_grantPermissions": - return this.sendRequestToPopup(e); - default: - if (!this.chain.rpcUrl) - throw Ar.rpc.internal("No RPC URL set for chain"); - return hS(e, this.chain.rpcUrl); - } - } - async sendRequestToPopup(e) { - var r, n; - await ((n = (r = this.communicator).waitForPopupLoaded) === null || n === void 0 ? void 0 : n.call(r)); - const i = await this.sendEncryptedRequest(e), o = (await this.decryptResponseMessage(i)).result; - if ("error" in o) - throw o.error; - return o.value; - } - async cleanup() { - var e, r; - this.storage.clear(), await this.keyManager.clear(), this.accounts = [], this.chain = { - id: (r = (e = this.metadata.appChainIds) === null || e === void 0 ? void 0 : e[0]) !== null && r !== void 0 ? r : 1 - }; - } - /** - * @returns `null` if the request was successful. - * https://eips.ethereum.org/EIPS/eip-3326#wallet_switchethereumchain - */ - async handleSwitchChainRequest(e) { - var r; - const n = e.params; - if (!n || !(!((r = n[0]) === null || r === void 0) && r.chainId)) - throw Ar.rpc.invalidParams(); - const i = el(n[0].chainId); - if (this.updateChain(i)) - return null; - const o = await this.sendRequestToPopup(e); - return o === null && this.updateChain(i), o; - } - async sendEncryptedRequest(e) { - const r = await this.keyManager.getSharedSecret(); - if (!r) - throw Ar.provider.unauthorized("No valid session found, try requestAccounts before other methods"); - const n = await LY({ - action: e, - chainId: this.chain.id - }, r), i = await this.createRequestMessage({ encrypted: n }); - return this.communicator.postRequestAndWaitForResponse(i); - } - async createRequestMessage(e) { - const r = await uS("public", await this.keyManager.getOwnPublicKey()); - return { - id: crypto.randomUUID(), - sender: r, - content: e, - timestamp: /* @__PURE__ */ new Date() - }; - } - async decryptResponseMessage(e) { - var r, n; - const i = e.content; - if ("failure" in i) - throw i.failure; - const s = await this.keyManager.getSharedSecret(); - if (!s) - throw Ar.provider.unauthorized("Invalid session"); - const o = await kY(i.encrypted, s), a = (r = o.data) === null || r === void 0 ? void 0 : r.chains; - if (a) { - const l = Object.entries(a).map(([d, p]) => ({ - id: Number(d), - rpcUrl: p - })); - this.storage.storeObject(_6, l), this.updateChain(this.chain.id, l); - } - const u = (n = o.data) === null || n === void 0 ? void 0 : n.capabilities; - return u && this.storage.storeObject(E6, u), o; - } - updateChain(e, r) { - var n; - const i = r ?? this.storage.loadObject(_6), s = i == null ? void 0 : i.find((o) => o.id === e); - return s ? (s !== this.chain && (this.chain = s, this.storage.storeObject(x6, s), (n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", ma(s.id))), !0) : !1; - } -} -const zY = /* @__PURE__ */ Lv(mO), { keccak_256: WY } = zY; -function dS(t) { - return Buffer.allocUnsafe(t).fill(0); -} -function HY(t) { - return t.toString(2).length; -} -function pS(t, e) { - let r = t.toString(16); - r.length % 2 !== 0 && (r = "0" + r); - const n = r.match(/.{1,2}/g).map((i) => parseInt(i, 16)); - for (; n.length < e; ) - n.unshift(0); - return Buffer.from(n); -} -function KY(t, e) { - const r = t < 0n; - let n; - if (r) { - const i = (1n << BigInt(e)) - 1n; - n = (~t & i) + 1n; - } else - n = t; - return n &= (1n << BigInt(e)) - 1n, n; -} -function gS(t, e, r) { - const n = dS(e); - return t = _p(t), r ? t.length < e ? (t.copy(n), n) : t.slice(0, e) : t.length < e ? (t.copy(n, e - t.length), n) : t.slice(-e); -} -function VY(t, e) { - return gS(t, e, !0); -} -function _p(t) { - if (!Buffer.isBuffer(t)) - if (Array.isArray(t)) - t = Buffer.from(t); - else if (typeof t == "string") - mS(t) ? t = Buffer.from(JY(vS(t)), "hex") : t = Buffer.from(t); - else if (typeof t == "number") - t = intToBuffer(t); - else if (t == null) - t = Buffer.allocUnsafe(0); - else if (typeof t == "bigint") - t = pS(t); - else if (t.toArray) - t = Buffer.from(t.toArray()); - else - throw new Error("invalid type"); - return t; -} -function GY(t) { - return t = _p(t), "0x" + t.toString("hex"); -} -function YY(t, e) { - if (t = _p(t), e || (e = 256), e !== 256) - throw new Error("unsupported"); - return Buffer.from(WY(new Uint8Array(t))); -} -function JY(t) { - return t.length % 2 ? "0" + t : t; -} -function mS(t) { - return typeof t == "string" && t.match(/^0x[0-9A-Fa-f]*$/); -} -function vS(t) { - return typeof t == "string" && t.startsWith("0x") ? t.slice(2) : t; -} -var bS = { - zeros: dS, - setLength: gS, - setLengthRight: VY, - isHexString: mS, - stripHexPrefix: vS, - toBuffer: _p, - bufferToHex: GY, - keccak: YY, - bitLengthFromBigInt: HY, - bufferBEFromBigInt: pS, - twosFromBigInt: KY -}; -const oi = bS; -function yS(t) { - return t.startsWith("int[") ? "int256" + t.slice(3) : t === "int" ? "int256" : t.startsWith("uint[") ? "uint256" + t.slice(4) : t === "uint" ? "uint256" : t.startsWith("fixed[") ? "fixed128x128" + t.slice(5) : t === "fixed" ? "fixed128x128" : t.startsWith("ufixed[") ? "ufixed128x128" + t.slice(6) : t === "ufixed" ? "ufixed128x128" : t; -} -function Au(t) { - return Number.parseInt(/^\D+(\d+)$/.exec(t)[1], 10); -} -function S6(t) { - var e = /^\D+(\d+)x(\d+)$/.exec(t); - return [Number.parseInt(e[1], 10), Number.parseInt(e[2], 10)]; -} -function wS(t) { - var e = t.match(/(.*)\[(.*?)\]$/); - return e ? e[2] === "" ? "dynamic" : Number.parseInt(e[2], 10) : null; -} -function oc(t) { - var e = typeof t; - if (e === "string" || e === "number") - return BigInt(t); - if (e === "bigint") - return t; - throw new Error("Argument is not a number"); -} -function Hs(t, e) { - var r, n, i, s; - if (t === "address") - return Hs("uint160", oc(e)); - if (t === "bool") - return Hs("uint8", e ? 1 : 0); - if (t === "string") - return Hs("bytes", new Buffer(e, "utf8")); - if (ZY(t)) { - if (typeof e.length > "u") - throw new Error("Not an array?"); - if (r = wS(t), r !== "dynamic" && r !== 0 && e.length > r) - throw new Error("Elements exceed array size: " + r); - i = [], t = t.slice(0, t.lastIndexOf("[")), typeof e == "string" && (e = JSON.parse(e)); - for (s in e) - i.push(Hs(t, e[s])); - if (r === "dynamic") { - var o = Hs("uint256", e.length); - i.unshift(o); - } - return Buffer.concat(i); - } else { - if (t === "bytes") - return e = new Buffer(e), i = Buffer.concat([Hs("uint256", e.length), e]), e.length % 32 !== 0 && (i = Buffer.concat([i, oi.zeros(32 - e.length % 32)])), i; - if (t.startsWith("bytes")) { - if (r = Au(t), r < 1 || r > 32) - throw new Error("Invalid bytes width: " + r); - return oi.setLengthRight(e, 32); - } else if (t.startsWith("uint")) { - if (r = Au(t), r % 8 || r < 8 || r > 256) - throw new Error("Invalid uint width: " + r); - n = oc(e); - const a = oi.bitLengthFromBigInt(n); - if (a > r) - throw new Error("Supplied uint exceeds width: " + r + " vs " + a); - if (n < 0) - throw new Error("Supplied uint is negative"); - return oi.bufferBEFromBigInt(n, 32); - } else if (t.startsWith("int")) { - if (r = Au(t), r % 8 || r < 8 || r > 256) - throw new Error("Invalid int width: " + r); - n = oc(e); - const a = oi.bitLengthFromBigInt(n); - if (a > r) - throw new Error("Supplied int exceeds width: " + r + " vs " + a); - const u = oi.twosFromBigInt(n, 256); - return oi.bufferBEFromBigInt(u, 32); - } else if (t.startsWith("ufixed")) { - if (r = S6(t), n = oc(e), n < 0) - throw new Error("Supplied ufixed is negative"); - return Hs("uint256", n * BigInt(2) ** BigInt(r[1])); - } else if (t.startsWith("fixed")) - return r = S6(t), Hs("int256", oc(e) * BigInt(2) ** BigInt(r[1])); - } - throw new Error("Unsupported or invalid type: " + t); -} -function XY(t) { - return t === "string" || t === "bytes" || wS(t) === "dynamic"; -} -function ZY(t) { - return t.lastIndexOf("]") === t.length - 1; -} -function QY(t, e) { - var r = [], n = [], i = 32 * t.length; - for (var s in t) { - var o = yS(t[s]), a = e[s], u = Hs(o, a); - XY(o) ? (r.push(Hs("uint256", i)), n.push(u), i += u.length) : r.push(u); - } - return Buffer.concat(r.concat(n)); -} -function xS(t, e) { - if (t.length !== e.length) - throw new Error("Number of types are not matching the values"); - for (var r, n, i = [], s = 0; s < t.length; s++) { - var o = yS(t[s]), a = e[s]; - if (o === "bytes") - i.push(a); - else if (o === "string") - i.push(new Buffer(a, "utf8")); - else if (o === "bool") - i.push(new Buffer(a ? "01" : "00", "hex")); - else if (o === "address") - i.push(oi.setLength(a, 20)); - else if (o.startsWith("bytes")) { - if (r = Au(o), r < 1 || r > 32) - throw new Error("Invalid bytes width: " + r); - i.push(oi.setLengthRight(a, r)); - } else if (o.startsWith("uint")) { - if (r = Au(o), r % 8 || r < 8 || r > 256) - throw new Error("Invalid uint width: " + r); - n = oc(a); - const u = oi.bitLengthFromBigInt(n); - if (u > r) - throw new Error("Supplied uint exceeds width: " + r + " vs " + u); - i.push(oi.bufferBEFromBigInt(n, r / 8)); - } else if (o.startsWith("int")) { - if (r = Au(o), r % 8 || r < 8 || r > 256) - throw new Error("Invalid int width: " + r); - n = oc(a); - const u = oi.bitLengthFromBigInt(n); - if (u > r) - throw new Error("Supplied int exceeds width: " + r + " vs " + u); - const l = oi.twosFromBigInt(n, r); - i.push(oi.bufferBEFromBigInt(l, r / 8)); - } else - throw new Error("Unsupported or invalid type: " + o); - } - return Buffer.concat(i); -} -function eJ(t, e) { - return oi.keccak(xS(t, e)); -} -var tJ = { - rawEncode: QY, - solidityPack: xS, - soliditySHA3: eJ -}; -const _s = bS, tl = tJ, _S = { - type: "object", - properties: { - types: { - type: "object", - additionalProperties: { - type: "array", - items: { - type: "object", - properties: { - name: { type: "string" }, - type: { type: "string" } - }, - required: ["name", "type"] - } - } - }, - primaryType: { type: "string" }, - domain: { type: "object" }, - message: { type: "object" } - }, - required: ["types", "primaryType", "domain", "message"] -}, jm = { - /** - * Encodes an object by encoding and concatenating each of its members - * - * @param {string} primaryType - Root type - * @param {Object} data - Object to encode - * @param {Object} types - Type definitions - * @returns {string} - Encoded representation of an object - */ - encodeData(t, e, r, n = !0) { - const i = ["bytes32"], s = [this.hashType(t, r)]; - if (n) { - const o = (a, u, l) => { - if (r[u] !== void 0) - return ["bytes32", l == null ? "0x0000000000000000000000000000000000000000000000000000000000000000" : _s.keccak(this.encodeData(u, l, r, n))]; - if (l === void 0) - throw new Error(`missing value for field ${a} of type ${u}`); - if (u === "bytes") - return ["bytes32", _s.keccak(l)]; - if (u === "string") - return typeof l == "string" && (l = Buffer.from(l, "utf8")), ["bytes32", _s.keccak(l)]; - if (u.lastIndexOf("]") === u.length - 1) { - const d = u.slice(0, u.lastIndexOf("[")), p = l.map((w) => o(a, d, w)); - return ["bytes32", _s.keccak(tl.rawEncode( - p.map(([w]) => w), - p.map(([, w]) => w) - ))]; - } - return [u, l]; - }; - for (const a of r[t]) { - const [u, l] = o(a.name, a.type, e[a.name]); - i.push(u), s.push(l); - } - } else - for (const o of r[t]) { - let a = e[o.name]; - if (a !== void 0) - if (o.type === "bytes") - i.push("bytes32"), a = _s.keccak(a), s.push(a); - else if (o.type === "string") - i.push("bytes32"), typeof a == "string" && (a = Buffer.from(a, "utf8")), a = _s.keccak(a), s.push(a); - else if (r[o.type] !== void 0) - i.push("bytes32"), a = _s.keccak(this.encodeData(o.type, a, r, n)), s.push(a); - else { - if (o.type.lastIndexOf("]") === o.type.length - 1) - throw new Error("Arrays currently unimplemented in encodeData"); - i.push(o.type), s.push(a); - } - } - return tl.rawEncode(i, s); - }, - /** - * Encodes the type of an object by encoding a comma delimited list of its members - * - * @param {string} primaryType - Root type to encode - * @param {Object} types - Type definitions - * @returns {string} - Encoded representation of the type of an object - */ - encodeType(t, e) { - let r = "", n = this.findTypeDependencies(t, e).filter((i) => i !== t); - n = [t].concat(n.sort()); - for (const i of n) { - if (!e[i]) - throw new Error("No type definition specified: " + i); - r += i + "(" + e[i].map(({ name: o, type: a }) => a + " " + o).join(",") + ")"; - } - return r; - }, - /** - * Finds all types within a type definition object - * - * @param {string} primaryType - Root type - * @param {Object} types - Type definitions - * @param {Array} results - current set of accumulated types - * @returns {Array} - Set of all types found in the type definition - */ - findTypeDependencies(t, e, r = []) { - if (t = t.match(/^\w*/)[0], r.includes(t) || e[t] === void 0) - return r; - r.push(t); - for (const n of e[t]) - for (const i of this.findTypeDependencies(n.type, e, r)) - !r.includes(i) && r.push(i); - return r; - }, - /** - * Hashes an object - * - * @param {string} primaryType - Root type - * @param {Object} data - Object to hash - * @param {Object} types - Type definitions - * @returns {Buffer} - Hash of an object - */ - hashStruct(t, e, r, n = !0) { - return _s.keccak(this.encodeData(t, e, r, n)); - }, - /** - * Hashes the type of an object - * - * @param {string} primaryType - Root type to hash - * @param {Object} types - Type definitions - * @returns {string} - Hash of an object - */ - hashType(t, e) { - return _s.keccak(this.encodeType(t, e)); - }, - /** - * Removes properties from a message object that are not defined per EIP-712 - * - * @param {Object} data - typed message object - * @returns {Object} - typed message object with only allowed fields - */ - sanitizeData(t) { - const e = {}; - for (const r in _S.properties) - t[r] && (e[r] = t[r]); - return e.types && (e.types = Object.assign({ EIP712Domain: [] }, e.types)), e; - }, - /** - * Returns the hash of a typed message as per EIP-712 for signing - * - * @param {Object} typedData - Types message data to sign - * @returns {string} - sha3 hash for signing - */ - hash(t, e = !0) { - const r = this.sanitizeData(t), n = [Buffer.from("1901", "hex")]; - return n.push(this.hashStruct("EIP712Domain", r.domain, r.types, e)), r.primaryType !== "EIP712Domain" && n.push(this.hashStruct(r.primaryType, r.message, r.types, e)), _s.keccak(Buffer.concat(n)); - } -}; -var rJ = { - TYPED_MESSAGE_SCHEMA: _S, - TypedDataUtils: jm, - hashForSignTypedDataLegacy: function(t) { - return nJ(t.data); - }, - hashForSignTypedData_v3: function(t) { - return jm.hash(t.data, !1); - }, - hashForSignTypedData_v4: function(t) { - return jm.hash(t.data); - } -}; -function nJ(t) { - const e = new Error("Expect argument to be non-empty array"); - if (typeof t != "object" || !t.length) throw e; - const r = t.map(function(s) { - return s.type === "bytes" ? _s.toBuffer(s.value) : s.value; - }), n = t.map(function(s) { - return s.type; - }), i = t.map(function(s) { - if (!s.name) throw e; - return s.type + " " + s.name; - }); - return tl.soliditySHA3( - ["bytes32", "bytes32"], - [ - tl.soliditySHA3(new Array(t.length).fill("string"), i), - tl.soliditySHA3(n, r) - ] - ); -} -const Sd = /* @__PURE__ */ ns(rJ), iJ = "walletUsername", ev = "Addresses", sJ = "AppVersion"; -function jn(t) { - return t.errorMessage !== void 0; -} -class oJ { - // @param secret hex representation of 32-byte secret - constructor(e) { - this.secret = e; - } - /** - * - * @param plainText string to be encrypted - * returns hex string representation of bytes in the order: initialization vector (iv), - * auth tag, encrypted plaintext. IV is 12 bytes. Auth tag is 16 bytes. Remaining bytes are the - * encrypted plainText. - */ - async encrypt(e) { - const r = this.secret; - if (r.length !== 64) - throw Error("secret must be 256 bits"); - const n = crypto.getRandomValues(new Uint8Array(12)), i = await crypto.subtle.importKey("raw", Wd(r), { name: "aes-gcm" }, !1, ["encrypt", "decrypt"]), s = new TextEncoder(), o = await window.crypto.subtle.encrypt({ - name: "AES-GCM", - iv: n - }, i, s.encode(e)), a = 16, u = o.slice(o.byteLength - a), l = o.slice(0, o.byteLength - a), d = new Uint8Array(u), p = new Uint8Array(l), w = new Uint8Array([...n, ...d, ...p]); - return Rb(w); - } - /** - * - * @param cipherText hex string representation of bytes in the order: initialization vector (iv), - * auth tag, encrypted plaintext. IV is 12 bytes. Auth tag is 16 bytes. - */ - async decrypt(e) { - const r = this.secret; - if (r.length !== 64) - throw Error("secret must be 256 bits"); - return new Promise((n, i) => { - (async function() { - const s = await crypto.subtle.importKey("raw", Wd(r), { name: "aes-gcm" }, !1, ["encrypt", "decrypt"]), o = Wd(e), a = o.slice(0, 12), u = o.slice(12, 28), l = o.slice(28), d = new Uint8Array([...l, ...u]), p = { - name: "AES-GCM", - iv: new Uint8Array(a) - }; - try { - const w = await window.crypto.subtle.decrypt(p, s, d), _ = new TextDecoder(); - n(_.decode(w)); - } catch (w) { - i(w); - } - })(); - }); - } -} -class aJ { - constructor(e, r, n) { - this.linkAPIUrl = e, this.sessionId = r; - const i = `${r}:${n}`; - this.auth = `Basic ${btoa(i)}`; - } - // mark unseen events as seen - async markUnseenEventsAsSeen(e) { - return Promise.all(e.map((r) => fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`, { - method: "POST", - headers: { - Authorization: this.auth - } - }))).catch((r) => console.error("Unabled to mark event as failed:", r)); - } - async fetchUnseenEvents() { - var e; - const r = await fetch(`${this.linkAPIUrl}/events?unseen=true`, { - headers: { - Authorization: this.auth - } - }); - if (r.ok) { - const { events: n, error: i } = await r.json(); - if (i) - throw new Error(`Check unseen events failed: ${i}`); - const s = (e = n == null ? void 0 : n.filter((o) => o.event === "Web3Response").map((o) => ({ - type: "Event", - sessionId: this.sessionId, - eventId: o.id, - event: o.event, - data: o.data - }))) !== null && e !== void 0 ? e : []; - return this.markUnseenEventsAsSeen(s), s; - } - throw new Error(`Check unseen events failed: ${r.status}`); - } -} -var To; -(function(t) { - t[t.DISCONNECTED = 0] = "DISCONNECTED", t[t.CONNECTING = 1] = "CONNECTING", t[t.CONNECTED = 2] = "CONNECTED"; -})(To || (To = {})); -class cJ { - setConnectionStateListener(e) { - this.connectionStateListener = e; - } - setIncomingDataListener(e) { - this.incomingDataListener = e; - } - /** - * Constructor - * @param url WebSocket server URL - * @param [WebSocketClass] Custom WebSocket implementation - */ - constructor(e, r = WebSocket) { - this.WebSocketClass = r, this.webSocket = null, this.pendingData = [], this.url = e.replace(/^http/, "ws"); - } - /** - * Make a websocket connection - * @returns a Promise that resolves when connected - */ - async connect() { - if (this.webSocket) - throw new Error("webSocket object is not null"); - return new Promise((e, r) => { - var n; - let i; - try { - this.webSocket = i = new this.WebSocketClass(this.url); - } catch (s) { - r(s); - return; - } - (n = this.connectionStateListener) === null || n === void 0 || n.call(this, To.CONNECTING), i.onclose = (s) => { - var o; - this.clearWebSocket(), r(new Error(`websocket error ${s.code}: ${s.reason}`)), (o = this.connectionStateListener) === null || o === void 0 || o.call(this, To.DISCONNECTED); - }, i.onopen = (s) => { - var o; - e(), (o = this.connectionStateListener) === null || o === void 0 || o.call(this, To.CONNECTED), this.pendingData.length > 0 && ([...this.pendingData].forEach((u) => this.sendData(u)), this.pendingData = []); - }, i.onmessage = (s) => { - var o, a; - if (s.data === "h") - (o = this.incomingDataListener) === null || o === void 0 || o.call(this, { - type: "Heartbeat" - }); - else - try { - const u = JSON.parse(s.data); - (a = this.incomingDataListener) === null || a === void 0 || a.call(this, u); - } catch { - } - }; - }); - } - /** - * Disconnect from server - */ - disconnect() { - var e; - const { webSocket: r } = this; - if (r) { - this.clearWebSocket(), (e = this.connectionStateListener) === null || e === void 0 || e.call(this, To.DISCONNECTED), this.connectionStateListener = void 0, this.incomingDataListener = void 0; - try { - r.close(); - } catch { - } - } - } - /** - * Send data to server - * @param data text to send - */ - sendData(e) { - const { webSocket: r } = this; - if (!r) { - this.pendingData.push(e), this.connect(); - return; - } - r.send(e); - } - clearWebSocket() { - const { webSocket: e } = this; - e && (this.webSocket = null, e.onclose = null, e.onerror = null, e.onmessage = null, e.onopen = null); - } -} -const A6 = 1e4, uJ = 6e4; -class fJ { - /** - * Constructor - * @param session Session - * @param linkAPIUrl Coinbase Wallet link server URL - * @param listener WalletLinkConnectionUpdateListener - * @param [WebSocketClass] Custom WebSocket implementation - */ - constructor({ session: e, linkAPIUrl: r, listener: n }) { - this.destroyed = !1, this.lastHeartbeatResponse = 0, this.nextReqId = Po(1), this._connected = !1, this._linked = !1, this.shouldFetchUnseenEventsOnConnect = !1, this.requestResolutions = /* @__PURE__ */ new Map(), this.handleSessionMetadataUpdated = (s) => { - if (!s) - return; - (/* @__PURE__ */ new Map([ - ["__destroyed", this.handleDestroyed], - ["EthereumAddress", this.handleAccountUpdated], - ["WalletUsername", this.handleWalletUsernameUpdated], - ["AppVersion", this.handleAppVersionUpdated], - [ - "ChainId", - // ChainId and JsonRpcUrl are always updated together - (a) => s.JsonRpcUrl && this.handleChainUpdated(a, s.JsonRpcUrl) - ] - ])).forEach((a, u) => { - const l = s[u]; - l !== void 0 && a(l); - }); - }, this.handleDestroyed = (s) => { - var o; - s === "1" && ((o = this.listener) === null || o === void 0 || o.resetAndReload()); - }, this.handleAccountUpdated = async (s) => { - var o; - const a = await this.cipher.decrypt(s); - (o = this.listener) === null || o === void 0 || o.accountUpdated(a); - }, this.handleMetadataUpdated = async (s, o) => { - var a; - const u = await this.cipher.decrypt(o); - (a = this.listener) === null || a === void 0 || a.metadataUpdated(s, u); - }, this.handleWalletUsernameUpdated = async (s) => { - this.handleMetadataUpdated(iJ, s); - }, this.handleAppVersionUpdated = async (s) => { - this.handleMetadataUpdated(sJ, s); - }, this.handleChainUpdated = async (s, o) => { - var a; - const u = await this.cipher.decrypt(s), l = await this.cipher.decrypt(o); - (a = this.listener) === null || a === void 0 || a.chainUpdated(u, l); - }, this.session = e, this.cipher = new oJ(e.secret), this.listener = n; - const i = new cJ(`${r}/rpc`, WebSocket); - i.setConnectionStateListener(async (s) => { - let o = !1; - switch (s) { - case To.DISCONNECTED: - if (!this.destroyed) { - const a = async () => { - await new Promise((u) => setTimeout(u, 5e3)), this.destroyed || i.connect().catch(() => { - a(); - }); - }; - a(); - } - break; - case To.CONNECTED: - o = await this.handleConnected(), this.updateLastHeartbeat(), setInterval(() => { - this.heartbeat(); - }, A6), this.shouldFetchUnseenEventsOnConnect && this.fetchUnseenEventsAPI(); - break; - case To.CONNECTING: - break; - } - this.connected !== o && (this.connected = o); - }), i.setIncomingDataListener((s) => { - var o; - switch (s.type) { - case "Heartbeat": - this.updateLastHeartbeat(); - return; - case "IsLinkedOK": - case "Linked": { - const a = s.type === "IsLinkedOK" ? s.linked : void 0; - this.linked = a || s.onlineGuests > 0; - break; - } - case "GetSessionConfigOK": - case "SessionConfigUpdated": { - this.handleSessionMetadataUpdated(s.metadata); - break; - } - case "Event": { - this.handleIncomingEvent(s); - break; - } - } - s.id !== void 0 && ((o = this.requestResolutions.get(s.id)) === null || o === void 0 || o(s)); - }), this.ws = i, this.http = new aJ(r, e.id, e.key); - } - /** - * Make a connection to the server - */ - connect() { - if (this.destroyed) - throw new Error("instance is destroyed"); - this.ws.connect(); - } - /** - * Terminate connection, and mark as destroyed. To reconnect, create a new - * instance of WalletSDKConnection - */ - async destroy() { - this.destroyed || (await this.makeRequest({ - type: "SetSessionConfig", - id: Po(this.nextReqId++), - sessionId: this.session.id, - metadata: { __destroyed: "1" } - }, { timeout: 1e3 }), this.destroyed = !0, this.ws.disconnect(), this.listener = void 0); - } - get connected() { - return this._connected; - } - set connected(e) { - this._connected = e; - } - get linked() { - return this._linked; - } - set linked(e) { - var r, n; - this._linked = e, e && ((r = this.onceLinked) === null || r === void 0 || r.call(this)), (n = this.listener) === null || n === void 0 || n.linkedUpdated(e); - } - setOnceLinked(e) { - return new Promise((r) => { - this.linked ? e().then(r) : this.onceLinked = () => { - e().then(r), this.onceLinked = void 0; - }; - }); - } - async handleIncomingEvent(e) { - var r; - if (e.type !== "Event" || e.event !== "Web3Response") - return; - const n = await this.cipher.decrypt(e.data), i = JSON.parse(n); - if (i.type !== "WEB3_RESPONSE") - return; - const { id: s, response: o } = i; - (r = this.listener) === null || r === void 0 || r.handleWeb3ResponseMessage(s, o); - } - async checkUnseenEvents() { - if (!this.connected) { - this.shouldFetchUnseenEventsOnConnect = !0; - return; - } - await new Promise((e) => setTimeout(e, 250)); - try { - await this.fetchUnseenEventsAPI(); - } catch (e) { - console.error("Unable to check for unseen events", e); - } - } - async fetchUnseenEventsAPI() { - this.shouldFetchUnseenEventsOnConnect = !1, (await this.http.fetchUnseenEvents()).forEach((r) => this.handleIncomingEvent(r)); - } - /** - * Publish an event and emit event ID when successful - * @param event event name - * @param unencryptedData unencrypted event data - * @param callWebhook whether the webhook should be invoked - * @returns a Promise that emits event ID when successful - */ - async publishEvent(e, r, n = !1) { - const i = await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({}, r), { origin: location.origin, location: location.href, relaySource: "coinbaseWalletExtension" in window && window.coinbaseWalletExtension ? "injected_sdk" : "sdk" }))), s = { - type: "PublishEvent", - id: Po(this.nextReqId++), - sessionId: this.session.id, - event: e, - data: i, - callWebhook: n - }; - return this.setOnceLinked(async () => { - const o = await this.makeRequest(s); - if (o.type === "Fail") - throw new Error(o.error || "failed to publish event"); - return o.eventId; - }); - } - sendData(e) { - this.ws.sendData(JSON.stringify(e)); - } - updateLastHeartbeat() { - this.lastHeartbeatResponse = Date.now(); - } - heartbeat() { - if (Date.now() - this.lastHeartbeatResponse > A6 * 2) { - this.ws.disconnect(); - return; - } - try { - this.ws.sendData("h"); - } catch { - } - } - async makeRequest(e, r = { timeout: uJ }) { - const n = e.id; - this.sendData(e); - let i; - return Promise.race([ - new Promise((s, o) => { - i = window.setTimeout(() => { - o(new Error(`request ${n} timed out`)); - }, r.timeout); - }), - new Promise((s) => { - this.requestResolutions.set(n, (o) => { - clearTimeout(i), s(o), this.requestResolutions.delete(n); - }); - }) - ]); - } - async handleConnected() { - return (await this.makeRequest({ - type: "HostSession", - id: Po(this.nextReqId++), - sessionId: this.session.id, - sessionKey: this.session.key - })).type === "Fail" ? !1 : (this.sendData({ - type: "IsLinked", - id: Po(this.nextReqId++), - sessionId: this.session.id - }), this.sendData({ - type: "GetSessionConfig", - id: Po(this.nextReqId++), - sessionId: this.session.id - }), !0); - } -} -class lJ { - constructor() { - this._nextRequestId = 0, this.callbacks = /* @__PURE__ */ new Map(); - } - makeRequestId() { - this._nextRequestId = (this._nextRequestId + 1) % 2147483647; - const e = this._nextRequestId, r = aS(e.toString(16)); - return this.callbacks.get(r) && this.callbacks.delete(r), e; - } -} -const P6 = "session:id", M6 = "session:secret", I6 = "session:linked"; -class Pu { - constructor(e, r, n, i = !1) { - this.storage = e, this.id = r, this.secret = n, this.key = XD(P4(`${r}, ${n} WalletLink`)), this._linked = !!i; - } - static create(e) { - const r = sc(16), n = sc(32); - return new Pu(e, r, n).save(); - } - static load(e) { - const r = e.getItem(P6), n = e.getItem(I6), i = e.getItem(M6); - return r && i ? new Pu(e, r, i, n === "1") : null; - } - get linked() { - return this._linked; - } - set linked(e) { - this._linked = e, this.persistLinked(); - } - save() { - return this.storage.setItem(P6, this.id), this.storage.setItem(M6, this.secret), this.persistLinked(), this; - } - persistLinked() { - this.storage.setItem(I6, this._linked ? "1" : "0"); - } -} -function hJ() { - try { - return window.frameElement !== null; - } catch { - return !1; - } -} -function dJ() { - try { - return hJ() && window.top ? window.top.location : window.location; - } catch { - return window.location; - } -} -function pJ() { - var t; - return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t = window == null ? void 0 : window.navigator) === null || t === void 0 ? void 0 : t.userAgent); -} -function ES() { - var t, e; - return (e = (t = window == null ? void 0 : window.matchMedia) === null || t === void 0 ? void 0 : t.call(window, "(prefers-color-scheme: dark)").matches) !== null && e !== void 0 ? e : !1; -} -const gJ = '@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}'; -function SS() { - const t = document.createElement("style"); - t.type = "text/css", t.appendChild(document.createTextNode(gJ)), document.documentElement.appendChild(t); -} -function AS(t) { - var e, r, n = ""; - if (typeof t == "string" || typeof t == "number") n += t; - else if (typeof t == "object") if (Array.isArray(t)) for (e = 0; e < t.length; e++) t[e] && (r = AS(t[e])) && (n && (n += " "), n += r); - else for (e in t) t[e] && (n && (n += " "), n += e); - return n; -} -function rl() { - for (var t, e, r = 0, n = ""; r < arguments.length; ) (t = arguments[r++]) && (e = AS(t)) && (n && (n += " "), n += e); - return n; -} -var Ep, Jr, PS, ac, C6, MS, tv, IS, Nb, rv, nv, $l = {}, CS = [], mJ = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Lb = Array.isArray; -function va(t, e) { - for (var r in e) t[r] = e[r]; - return t; -} -function kb(t) { - t && t.parentNode && t.parentNode.removeChild(t); -} -function Nr(t, e, r) { - var n, i, s, o = {}; - for (s in e) s == "key" ? n = e[s] : s == "ref" ? i = e[s] : o[s] = e[s]; - if (arguments.length > 2 && (o.children = arguments.length > 3 ? Ep.call(arguments, 2) : r), typeof t == "function" && t.defaultProps != null) for (s in t.defaultProps) o[s] === void 0 && (o[s] = t.defaultProps[s]); - return Hd(t, o, n, i, null); -} -function Hd(t, e, r, n, i) { - var s = { type: t, props: e, key: r, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++PS, __i: -1, __u: 0 }; - return i == null && Jr.vnode != null && Jr.vnode(s), s; -} -function dh(t) { - return t.children; -} -function Kd(t, e) { - this.props = t, this.context = e; -} -function ku(t, e) { - if (e == null) return t.__ ? ku(t.__, t.__i + 1) : null; - for (var r; e < t.__k.length; e++) if ((r = t.__k[e]) != null && r.__e != null) return r.__e; - return typeof t.type == "function" ? ku(t) : null; -} -function TS(t) { - var e, r; - if ((t = t.__) != null && t.__c != null) { - for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) if ((r = t.__k[e]) != null && r.__e != null) { - t.__e = t.__c.base = r.__e; - break; - } - return TS(t); - } -} -function T6(t) { - (!t.__d && (t.__d = !0) && ac.push(t) && !A0.__r++ || C6 !== Jr.debounceRendering) && ((C6 = Jr.debounceRendering) || MS)(A0); -} -function A0() { - var t, e, r, n, i, s, o, a; - for (ac.sort(tv); t = ac.shift(); ) t.__d && (e = ac.length, n = void 0, s = (i = (r = t).__v).__e, o = [], a = [], r.__P && ((n = va({}, i)).__v = i.__v + 1, Jr.vnode && Jr.vnode(n), $b(r.__P, n, i, r.__n, r.__P.namespaceURI, 32 & i.__u ? [s] : null, o, s ?? ku(i), !!(32 & i.__u), a), n.__v = i.__v, n.__.__k[n.__i] = n, OS(o, n, a), n.__e != s && TS(n)), ac.length > e && ac.sort(tv)); - A0.__r = 0; -} -function RS(t, e, r, n, i, s, o, a, u, l, d) { - var p, w, _, P, O, L, B = n && n.__k || CS, k = e.length; - for (u = vJ(r, e, B, u), p = 0; p < k; p++) (_ = r.__k[p]) != null && (w = _.__i === -1 ? $l : B[_.__i] || $l, _.__i = p, L = $b(t, _, w, i, s, o, a, u, l, d), P = _.__e, _.ref && w.ref != _.ref && (w.ref && Bb(w.ref, null, _), d.push(_.ref, _.__c || P, _)), O == null && P != null && (O = P), 4 & _.__u || w.__k === _.__k ? u = DS(_, u, t) : typeof _.type == "function" && L !== void 0 ? u = L : P && (u = P.nextSibling), _.__u &= -7); - return r.__e = O, u; -} -function vJ(t, e, r, n) { - var i, s, o, a, u, l = e.length, d = r.length, p = d, w = 0; - for (t.__k = [], i = 0; i < l; i++) (s = e[i]) != null && typeof s != "boolean" && typeof s != "function" ? (a = i + w, (s = t.__k[i] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Hd(null, s, null, null, null) : Lb(s) ? Hd(dh, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? Hd(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, o = null, (u = s.__i = bJ(s, r, a, p)) !== -1 && (p--, (o = r[u]) && (o.__u |= 2)), o == null || o.__v === null ? (u == -1 && w--, typeof s.type != "function" && (s.__u |= 4)) : u !== a && (u == a - 1 ? w-- : u == a + 1 ? w++ : (u > a ? w-- : w++, s.__u |= 4))) : s = t.__k[i] = null; - if (p) for (i = 0; i < d; i++) (o = r[i]) != null && !(2 & o.__u) && (o.__e == n && (n = ku(o)), NS(o, o)); - return n; -} -function DS(t, e, r) { - var n, i; - if (typeof t.type == "function") { - for (n = t.__k, i = 0; n && i < n.length; i++) n[i] && (n[i].__ = t, e = DS(n[i], e, r)); - return e; - } - t.__e != e && (e && t.type && !r.contains(e) && (e = ku(t)), r.insertBefore(t.__e, e || null), e = t.__e); - do - e = e && e.nextSibling; - while (e != null && e.nodeType === 8); - return e; -} -function bJ(t, e, r, n) { - var i = t.key, s = t.type, o = r - 1, a = r + 1, u = e[r]; - if (u === null || u && i == u.key && s === u.type && !(2 & u.__u)) return r; - if ((typeof s != "function" || s === dh || i) && n > (u != null && !(2 & u.__u) ? 1 : 0)) for (; o >= 0 || a < e.length; ) { - if (o >= 0) { - if ((u = e[o]) && !(2 & u.__u) && i == u.key && s === u.type) return o; - o--; - } - if (a < e.length) { - if ((u = e[a]) && !(2 & u.__u) && i == u.key && s === u.type) return a; - a++; - } - } - return -1; -} -function R6(t, e, r) { - e[0] === "-" ? t.setProperty(e, r ?? "") : t[e] = r == null ? "" : typeof r != "number" || mJ.test(e) ? r : r + "px"; -} -function Ad(t, e, r, n, i) { - var s; - e: if (e === "style") if (typeof r == "string") t.style.cssText = r; - else { - if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) r && e in r || R6(t.style, e, ""); - if (r) for (e in r) n && r[e] === n[e] || R6(t.style, e, r[e]); - } - else if (e[0] === "o" && e[1] === "n") s = e !== (e = e.replace(IS, "$1")), e = e.toLowerCase() in t || e === "onFocusOut" || e === "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = r, r ? n ? r.u = n.u : (r.u = Nb, t.addEventListener(e, s ? nv : rv, s)) : t.removeEventListener(e, s ? nv : rv, s); - else { - if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); - else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try { - t[e] = r ?? ""; - break e; - } catch { - } - typeof r == "function" || (r == null || r === !1 && e[4] !== "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && r == 1 ? "" : r)); - } -} -function D6(t) { - return function(e) { - if (this.l) { - var r = this.l[e.type + t]; - if (e.t == null) e.t = Nb++; - else if (e.t < r.u) return; - return r(Jr.event ? Jr.event(e) : e); - } - }; -} -function $b(t, e, r, n, i, s, o, a, u, l) { - var d, p, w, _, P, O, L, B, k, W, U, V, Q, R, K, ge, Ee, Y = e.type; - if (e.constructor !== void 0) return null; - 128 & r.__u && (u = !!(32 & r.__u), s = [a = e.__e = r.__e]), (d = Jr.__b) && d(e); - e: if (typeof Y == "function") try { - if (B = e.props, k = "prototype" in Y && Y.prototype.render, W = (d = Y.contextType) && n[d.__c], U = d ? W ? W.props.value : d.__ : n, r.__c ? L = (p = e.__c = r.__c).__ = p.__E : (k ? e.__c = p = new Y(B, U) : (e.__c = p = new Kd(B, U), p.constructor = Y, p.render = wJ), W && W.sub(p), p.props = B, p.state || (p.state = {}), p.context = U, p.__n = n, w = p.__d = !0, p.__h = [], p._sb = []), k && p.__s == null && (p.__s = p.state), k && Y.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = va({}, p.__s)), va(p.__s, Y.getDerivedStateFromProps(B, p.__s))), _ = p.props, P = p.state, p.__v = e, w) k && Y.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), k && p.componentDidMount != null && p.__h.push(p.componentDidMount); - else { - if (k && Y.getDerivedStateFromProps == null && B !== _ && p.componentWillReceiveProps != null && p.componentWillReceiveProps(B, U), !p.__e && (p.shouldComponentUpdate != null && p.shouldComponentUpdate(B, p.__s, U) === !1 || e.__v === r.__v)) { - for (e.__v !== r.__v && (p.props = B, p.state = p.__s, p.__d = !1), e.__e = r.__e, e.__k = r.__k, e.__k.some(function(A) { - A && (A.__ = e); - }), V = 0; V < p._sb.length; V++) p.__h.push(p._sb[V]); - p._sb = [], p.__h.length && o.push(p); - break e; - } - p.componentWillUpdate != null && p.componentWillUpdate(B, p.__s, U), k && p.componentDidUpdate != null && p.__h.push(function() { - p.componentDidUpdate(_, P, O); - }); - } - if (p.context = U, p.props = B, p.__P = t, p.__e = !1, Q = Jr.__r, R = 0, k) { - for (p.state = p.__s, p.__d = !1, Q && Q(e), d = p.render(p.props, p.state, p.context), K = 0; K < p._sb.length; K++) p.__h.push(p._sb[K]); - p._sb = []; - } else do - p.__d = !1, Q && Q(e), d = p.render(p.props, p.state, p.context), p.state = p.__s; - while (p.__d && ++R < 25); - p.state = p.__s, p.getChildContext != null && (n = va(va({}, n), p.getChildContext())), k && !w && p.getSnapshotBeforeUpdate != null && (O = p.getSnapshotBeforeUpdate(_, P)), a = RS(t, Lb(ge = d != null && d.type === dh && d.key == null ? d.props.children : d) ? ge : [ge], e, r, n, i, s, o, a, u, l), p.base = e.__e, e.__u &= -161, p.__h.length && o.push(p), L && (p.__E = p.__ = null); - } catch (A) { - if (e.__v = null, u || s != null) if (A.then) { - for (e.__u |= u ? 160 : 128; a && a.nodeType === 8 && a.nextSibling; ) a = a.nextSibling; - s[s.indexOf(a)] = null, e.__e = a; - } else for (Ee = s.length; Ee--; ) kb(s[Ee]); - else e.__e = r.__e, e.__k = r.__k; - Jr.__e(A, e, r); - } - else s == null && e.__v === r.__v ? (e.__k = r.__k, e.__e = r.__e) : a = e.__e = yJ(r.__e, e, r, n, i, s, o, u, l); - return (d = Jr.diffed) && d(e), 128 & e.__u ? void 0 : a; -} -function OS(t, e, r) { - for (var n = 0; n < r.length; n++) Bb(r[n], r[++n], r[++n]); - Jr.__c && Jr.__c(e, t), t.some(function(i) { - try { - t = i.__h, i.__h = [], t.some(function(s) { - s.call(i); - }); - } catch (s) { - Jr.__e(s, i.__v); - } - }); -} -function yJ(t, e, r, n, i, s, o, a, u) { - var l, d, p, w, _, P, O, L = r.props, B = e.props, k = e.type; - if (k === "svg" ? i = "http://www.w3.org/2000/svg" : k === "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) { - for (l = 0; l < s.length; l++) if ((_ = s[l]) && "setAttribute" in _ == !!k && (k ? _.localName === k : _.nodeType === 3)) { - t = _, s[l] = null; - break; - } - } - if (t == null) { - if (k === null) return document.createTextNode(B); - t = document.createElementNS(i, k, B.is && B), a && (Jr.__m && Jr.__m(e, s), a = !1), s = null; - } - if (k === null) L === B || a && t.data === B || (t.data = B); - else { - if (s = s && Ep.call(t.childNodes), L = r.props || $l, !a && s != null) for (L = {}, l = 0; l < t.attributes.length; l++) L[(_ = t.attributes[l]).name] = _.value; - for (l in L) if (_ = L[l], l != "children") { - if (l == "dangerouslySetInnerHTML") p = _; - else if (!(l in B)) { - if (l == "value" && "defaultValue" in B || l == "checked" && "defaultChecked" in B) continue; - Ad(t, l, null, _, i); - } - } - for (l in B) _ = B[l], l == "children" ? w = _ : l == "dangerouslySetInnerHTML" ? d = _ : l == "value" ? P = _ : l == "checked" ? O = _ : a && typeof _ != "function" || L[l] === _ || Ad(t, l, _, L[l], i); - if (d) a || p && (d.__html === p.__html || d.__html === t.innerHTML) || (t.innerHTML = d.__html), e.__k = []; - else if (p && (t.innerHTML = ""), RS(t, Lb(w) ? w : [w], e, r, n, k === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && ku(r, 0), a, u), s != null) for (l = s.length; l--; ) kb(s[l]); - a || (l = "value", k === "progress" && P == null ? t.removeAttribute("value") : P !== void 0 && (P !== t[l] || k === "progress" && !P || k === "option" && P !== L[l]) && Ad(t, l, P, L[l], i), l = "checked", O !== void 0 && O !== t[l] && Ad(t, l, O, L[l], i)); - } - return t; -} -function Bb(t, e, r) { - try { - if (typeof t == "function") { - var n = typeof t.__u == "function"; - n && t.__u(), n && e == null || (t.__u = t(e)); - } else t.current = e; - } catch (i) { - Jr.__e(i, r); - } -} -function NS(t, e, r) { - var n, i; - if (Jr.unmount && Jr.unmount(t), (n = t.ref) && (n.current && n.current !== t.__e || Bb(n, null, e)), (n = t.__c) != null) { - if (n.componentWillUnmount) try { - n.componentWillUnmount(); - } catch (s) { - Jr.__e(s, e); - } - n.base = n.__P = null; - } - if (n = t.__k) for (i = 0; i < n.length; i++) n[i] && NS(n[i], e, r || typeof t.type != "function"); - r || kb(t.__e), t.__c = t.__ = t.__e = void 0; -} -function wJ(t, e, r) { - return this.constructor(t, r); -} -function iv(t, e, r) { - var n, i, s, o; - e === document && (e = document.documentElement), Jr.__ && Jr.__(t, e), i = (n = typeof r == "function") ? null : e.__k, s = [], o = [], $b(e, t = (!n && r || e).__k = Nr(dh, null, [t]), i || $l, $l, e.namespaceURI, !n && r ? [r] : i ? null : e.firstChild ? Ep.call(e.childNodes) : null, s, !n && r ? r : i ? i.__e : e.firstChild, n, o), OS(s, t, o); -} -Ep = CS.slice, Jr = { __e: function(t, e, r, n) { - for (var i, s, o; e = e.__; ) if ((i = e.__c) && !i.__) try { - if ((s = i.constructor) && s.getDerivedStateFromError != null && (i.setState(s.getDerivedStateFromError(t)), o = i.__d), i.componentDidCatch != null && (i.componentDidCatch(t, n || {}), o = i.__d), o) return i.__E = i; - } catch (a) { - t = a; - } - throw t; -} }, PS = 0, Kd.prototype.setState = function(t, e) { - var r; - r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = va({}, this.state), typeof t == "function" && (t = t(va({}, r), this.props)), t && va(r, t), t != null && this.__v && (e && this._sb.push(e), T6(this)); -}, Kd.prototype.forceUpdate = function(t) { - this.__v && (this.__e = !0, t && this.__h.push(t), T6(this)); -}, Kd.prototype.render = dh, ac = [], MS = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, tv = function(t, e) { - return t.__v.__b - e.__v.__b; -}, A0.__r = 0, IS = /(PointerCapture)$|Capture$/i, Nb = 0, rv = D6(!1), nv = D6(!0); -var P0, pn, Um, O6, sv = 0, LS = [], yn = Jr, N6 = yn.__b, L6 = yn.__r, k6 = yn.diffed, $6 = yn.__c, B6 = yn.unmount, F6 = yn.__; -function kS(t, e) { - yn.__h && yn.__h(pn, t, sv || e), sv = 0; - var r = pn.__H || (pn.__H = { __: [], __h: [] }); - return t >= r.__.length && r.__.push({}), r.__[t]; -} -function j6(t) { - return sv = 1, xJ($S, t); -} -function xJ(t, e, r) { - var n = kS(P0++, 2); - if (n.t = t, !n.__c && (n.__ = [$S(void 0, e), function(a) { - var u = n.__N ? n.__N[0] : n.__[0], l = n.t(u, a); - u !== l && (n.__N = [l, n.__[1]], n.__c.setState({})); - }], n.__c = pn, !pn.u)) { - var i = function(a, u, l) { - if (!n.__c.__H) return !0; - var d = n.__c.__H.__.filter(function(w) { - return !!w.__c; - }); - if (d.every(function(w) { - return !w.__N; - })) return !s || s.call(this, a, u, l); - var p = n.__c.props !== a; - return d.forEach(function(w) { - if (w.__N) { - var _ = w.__[0]; - w.__ = w.__N, w.__N = void 0, _ !== w.__[0] && (p = !0); - } - }), s && s.call(this, a, u, l) || p; - }; - pn.u = !0; - var s = pn.shouldComponentUpdate, o = pn.componentWillUpdate; - pn.componentWillUpdate = function(a, u, l) { - if (this.__e) { - var d = s; - s = void 0, i(a, u, l), s = d; - } - o && o.call(this, a, u, l); - }, pn.shouldComponentUpdate = i; - } - return n.__N || n.__; -} -function _J(t, e) { - var r = kS(P0++, 3); - !yn.__s && AJ(r.__H, e) && (r.__ = t, r.i = e, pn.__H.__h.push(r)); -} -function EJ() { - for (var t; t = LS.shift(); ) if (t.__P && t.__H) try { - t.__H.__h.forEach(Vd), t.__H.__h.forEach(ov), t.__H.__h = []; - } catch (e) { - t.__H.__h = [], yn.__e(e, t.__v); - } -} -yn.__b = function(t) { - pn = null, N6 && N6(t); -}, yn.__ = function(t, e) { - t && e.__k && e.__k.__m && (t.__m = e.__k.__m), F6 && F6(t, e); -}, yn.__r = function(t) { - L6 && L6(t), P0 = 0; - var e = (pn = t.__c).__H; - e && (Um === pn ? (e.__h = [], pn.__h = [], e.__.forEach(function(r) { - r.__N && (r.__ = r.__N), r.i = r.__N = void 0; - })) : (e.__h.forEach(Vd), e.__h.forEach(ov), e.__h = [], P0 = 0)), Um = pn; -}, yn.diffed = function(t) { - k6 && k6(t); - var e = t.__c; - e && e.__H && (e.__H.__h.length && (LS.push(e) !== 1 && O6 === yn.requestAnimationFrame || ((O6 = yn.requestAnimationFrame) || SJ)(EJ)), e.__H.__.forEach(function(r) { - r.i && (r.__H = r.i), r.i = void 0; - })), Um = pn = null; -}, yn.__c = function(t, e) { - e.some(function(r) { - try { - r.__h.forEach(Vd), r.__h = r.__h.filter(function(n) { - return !n.__ || ov(n); - }); - } catch (n) { - e.some(function(i) { - i.__h && (i.__h = []); - }), e = [], yn.__e(n, r.__v); - } - }), $6 && $6(t, e); -}, yn.unmount = function(t) { - B6 && B6(t); - var e, r = t.__c; - r && r.__H && (r.__H.__.forEach(function(n) { - try { - Vd(n); - } catch (i) { - e = i; - } - }), r.__H = void 0, e && yn.__e(e, r.__v)); -}; -var U6 = typeof requestAnimationFrame == "function"; -function SJ(t) { - var e, r = function() { - clearTimeout(n), U6 && cancelAnimationFrame(e), setTimeout(t); - }, n = setTimeout(r, 100); - U6 && (e = requestAnimationFrame(r)); -} -function Vd(t) { - var e = pn, r = t.__c; - typeof r == "function" && (t.__c = void 0, r()), pn = e; -} -function ov(t) { - var e = pn; - t.__c = t.__(), pn = e; -} -function AJ(t, e) { - return !t || t.length !== e.length || e.some(function(r, n) { - return r !== t[n]; - }); -} -function $S(t, e) { - return typeof e == "function" ? e(t) : e; -} -const PJ = ".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}", MJ = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+", IJ = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4="; -class CJ { - constructor() { - this.items = /* @__PURE__ */ new Map(), this.nextItemKey = 0, this.root = null, this.darkMode = ES(); - } - attach(e) { - this.root = document.createElement("div"), this.root.className = "-cbwsdk-snackbar-root", e.appendChild(this.root), this.render(); - } - presentItem(e) { - const r = this.nextItemKey++; - return this.items.set(r, e), this.render(), () => { - this.items.delete(r), this.render(); - }; - } - clear() { - this.items.clear(), this.render(); - } - render() { - this.root && iv(Nr( - "div", - null, - Nr(BS, { darkMode: this.darkMode }, Array.from(this.items.entries()).map(([e, r]) => Nr(TJ, Object.assign({}, r, { key: e })))) - ), this.root); - } -} -const BS = (t) => Nr( - "div", - { class: rl("-cbwsdk-snackbar-container") }, - Nr("style", null, PJ), - Nr("div", { class: "-cbwsdk-snackbar" }, t.children) -), TJ = ({ autoExpand: t, message: e, menuItems: r }) => { - const [n, i] = j6(!0), [s, o] = j6(t ?? !1); - _J(() => { - const u = [ - window.setTimeout(() => { - i(!1); - }, 1), - window.setTimeout(() => { - o(!0); - }, 1e4) - ]; - return () => { - u.forEach(window.clearTimeout); - }; - }); - const a = () => { - o(!s); - }; - return Nr( - "div", - { class: rl("-cbwsdk-snackbar-instance", n && "-cbwsdk-snackbar-instance-hidden", s && "-cbwsdk-snackbar-instance-expanded") }, - Nr( - "div", - { class: "-cbwsdk-snackbar-instance-header", onClick: a }, - Nr("img", { src: MJ, class: "-cbwsdk-snackbar-instance-header-cblogo" }), - " ", - Nr("div", { class: "-cbwsdk-snackbar-instance-header-message" }, e), - Nr( - "div", - { class: "-gear-container" }, - !s && Nr( - "svg", - { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, - Nr("circle", { cx: "12", cy: "12", r: "12", fill: "#F5F7F8" }) - ), - Nr("img", { src: IJ, class: "-gear-icon", title: "Expand" }) - ) - ), - r && r.length > 0 && Nr("div", { class: "-cbwsdk-snackbar-instance-menu" }, r.map((u, l) => Nr( - "div", - { class: rl("-cbwsdk-snackbar-instance-menu-item", u.isRed && "-cbwsdk-snackbar-instance-menu-item-is-red"), onClick: u.onClick, key: l }, - Nr( - "svg", - { width: u.svgWidth, height: u.svgHeight, viewBox: "0 0 10 11", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, - Nr("path", { "fill-rule": u.defaultFillRule, "clip-rule": u.defaultClipRule, d: u.path, fill: "#AAAAAA" }) - ), - Nr("span", { class: rl("-cbwsdk-snackbar-instance-menu-item-info", u.isRed && "-cbwsdk-snackbar-instance-menu-item-info-is-red") }, u.info) - ))) - ); -}; -class RJ { - constructor() { - this.attached = !1, this.snackbar = new CJ(); - } - attach() { - if (this.attached) - throw new Error("Coinbase Wallet SDK UI is already attached"); - const e = document.documentElement, r = document.createElement("div"); - r.className = "-cbwsdk-css-reset", e.appendChild(r), this.snackbar.attach(r), this.attached = !0, SS(); - } - showConnecting(e) { - let r; - return e.isUnlinkedErrorState ? r = { - autoExpand: !0, - message: "Connection lost", - menuItems: [ - { - isRed: !1, - info: "Reset connection", - svgWidth: "10", - svgHeight: "11", - path: "M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z", - defaultFillRule: "evenodd", - defaultClipRule: "evenodd", - onClick: e.onResetConnection - } - ] - } : r = { - message: "Confirm on phone", - menuItems: [ - { - isRed: !0, - info: "Cancel transaction", - svgWidth: "11", - svgHeight: "11", - path: "M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z", - defaultFillRule: "inherit", - defaultClipRule: "inherit", - onClick: e.onCancel - }, - { - isRed: !1, - info: "Reset connection", - svgWidth: "10", - svgHeight: "11", - path: "M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z", - defaultFillRule: "evenodd", - defaultClipRule: "evenodd", - onClick: e.onResetConnection - } - ] - }, this.snackbar.presentItem(r); - } -} -const DJ = ".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}"; -class OJ { - constructor() { - this.root = null, this.darkMode = ES(); - } - attach() { - const e = document.documentElement; - this.root = document.createElement("div"), this.root.className = "-cbwsdk-css-reset", e.appendChild(this.root), SS(); - } - present(e) { - this.render(e); - } - clear() { - this.render(null); - } - render(e) { - this.root && (iv(null, this.root), e && iv(Nr(NJ, Object.assign({}, e, { onDismiss: () => { - this.clear(); - }, darkMode: this.darkMode })), this.root)); - } -} -const NJ = ({ title: t, buttonText: e, darkMode: r, onButtonClick: n, onDismiss: i }) => { - const s = r ? "dark" : "light"; - return Nr( - BS, - { darkMode: r }, - Nr( - "div", - { class: "-cbwsdk-redirect-dialog" }, - Nr("style", null, DJ), - Nr("div", { class: "-cbwsdk-redirect-dialog-backdrop", onClick: i }), - Nr( - "div", - { class: rl("-cbwsdk-redirect-dialog-box", s) }, - Nr("p", null, t), - Nr("button", { onClick: n }, e) - ) - ) - ); -}, LJ = "https://keys.coinbase.com/connect", q6 = "https://www.walletlink.org", kJ = "https://go.cb-w.com/walletlink"; -class z6 { - constructor() { - this.attached = !1, this.redirectDialog = new OJ(); - } - attach() { - if (this.attached) - throw new Error("Coinbase Wallet SDK UI is already attached"); - this.redirectDialog.attach(), this.attached = !0; - } - redirectToCoinbaseWallet(e) { - const r = new URL(kJ); - r.searchParams.append("redirect_url", dJ().href), e && r.searchParams.append("wl_url", e); - const n = document.createElement("a"); - n.target = "cbw-opener", n.href = r.href, n.rel = "noreferrer noopener", n.click(); - } - openCoinbaseWalletDeeplink(e) { - this.redirectDialog.present({ - title: "Redirecting to Coinbase Wallet...", - buttonText: "Open", - onButtonClick: () => { - this.redirectToCoinbaseWallet(e); - } - }), setTimeout(() => { - this.redirectToCoinbaseWallet(e); - }, 99); - } - showConnecting(e) { - return () => { - this.redirectDialog.clear(); - }; - } -} -class Mo { - constructor(e) { - this.chainCallbackParams = { chainId: "", jsonRpcUrl: "" }, this.isMobileWeb = pJ(), this.linkedUpdated = (s) => { - this.isLinked = s; - const o = this.storage.getItem(ev); - if (s && (this._session.linked = s), this.isUnlinkedErrorState = !1, o) { - const a = o.split(" "), u = this.storage.getItem("IsStandaloneSigning") === "true"; - a[0] !== "" && !s && this._session.linked && !u && (this.isUnlinkedErrorState = !0); - } - }, this.metadataUpdated = (s, o) => { - this.storage.setItem(s, o); - }, this.chainUpdated = (s, o) => { - this.chainCallbackParams.chainId === s && this.chainCallbackParams.jsonRpcUrl === o || (this.chainCallbackParams = { - chainId: s, - jsonRpcUrl: o - }, this.chainCallback && this.chainCallback(o, Number.parseInt(s, 10))); - }, this.accountUpdated = (s) => { - this.accountsCallback && this.accountsCallback([s]), Mo.accountRequestCallbackIds.size > 0 && (Array.from(Mo.accountRequestCallbackIds.values()).forEach((o) => { - this.invokeCallback(o, { - method: "requestEthereumAccounts", - result: [s] - }); - }), Mo.accountRequestCallbackIds.clear()); - }, this.resetAndReload = this.resetAndReload.bind(this), this.linkAPIUrl = e.linkAPIUrl, this.storage = e.storage, this.metadata = e.metadata, this.accountsCallback = e.accountsCallback, this.chainCallback = e.chainCallback; - const { session: r, ui: n, connection: i } = this.subscribe(); - this._session = r, this.connection = i, this.relayEventManager = new lJ(), this.ui = n, this.ui.attach(); - } - subscribe() { - const e = Pu.load(this.storage) || Pu.create(this.storage), { linkAPIUrl: r } = this, n = new fJ({ - session: e, - linkAPIUrl: r, - listener: this - }), i = this.isMobileWeb ? new z6() : new RJ(); - return n.connect(), { session: e, ui: i, connection: n }; - } - resetAndReload() { - this.connection.destroy().then(() => { - const e = Pu.load(this.storage); - (e == null ? void 0 : e.id) === this._session.id && no.clearAll(), document.location.reload(); - }).catch((e) => { - }); - } - signEthereumTransaction(e) { - return this.sendRequest({ - method: "signEthereumTransaction", - params: { - fromAddress: e.fromAddress, - toAddress: e.toAddress, - weiValue: js(e.weiValue), - data: Qf(e.data, !0), - nonce: e.nonce, - gasPriceInWei: e.gasPriceInWei ? js(e.gasPriceInWei) : null, - maxFeePerGas: e.gasPriceInWei ? js(e.gasPriceInWei) : null, - maxPriorityFeePerGas: e.gasPriceInWei ? js(e.gasPriceInWei) : null, - gasLimit: e.gasLimit ? js(e.gasLimit) : null, - chainId: e.chainId, - shouldSubmit: !1 - } - }); - } - signAndSubmitEthereumTransaction(e) { - return this.sendRequest({ - method: "signEthereumTransaction", - params: { - fromAddress: e.fromAddress, - toAddress: e.toAddress, - weiValue: js(e.weiValue), - data: Qf(e.data, !0), - nonce: e.nonce, - gasPriceInWei: e.gasPriceInWei ? js(e.gasPriceInWei) : null, - maxFeePerGas: e.maxFeePerGas ? js(e.maxFeePerGas) : null, - maxPriorityFeePerGas: e.maxPriorityFeePerGas ? js(e.maxPriorityFeePerGas) : null, - gasLimit: e.gasLimit ? js(e.gasLimit) : null, - chainId: e.chainId, - shouldSubmit: !0 - } - }); - } - submitEthereumTransaction(e, r) { - return this.sendRequest({ - method: "submitEthereumTransaction", - params: { - signedTransaction: Qf(e, !0), - chainId: r - } - }); - } - getWalletLinkSession() { - return this._session; - } - sendRequest(e) { - let r = null; - const n = sc(8), i = (s) => { - this.publishWeb3RequestCanceledEvent(n), this.handleErrorResponse(n, e.method, s), r == null || r(); - }; - return new Promise((s, o) => { - r = this.ui.showConnecting({ - isUnlinkedErrorState: this.isUnlinkedErrorState, - onCancel: i, - onResetConnection: this.resetAndReload - // eslint-disable-line @typescript-eslint/unbound-method - }), this.relayEventManager.callbacks.set(n, (a) => { - if (r == null || r(), jn(a)) - return o(new Error(a.errorMessage)); - s(a); - }), this.publishWeb3RequestEvent(n, e); - }); - } - publishWeb3RequestEvent(e, r) { - const n = { type: "WEB3_REQUEST", id: e, request: r }; - this.publishEvent("Web3Request", n, !0).then((i) => { - }).catch((i) => { - this.handleWeb3ResponseMessage(n.id, { - method: r.method, - errorMessage: i.message - }); - }), this.isMobileWeb && this.openCoinbaseWalletDeeplink(r.method); - } - // copied from MobileRelay - openCoinbaseWalletDeeplink(e) { - if (this.ui instanceof z6) - switch (e) { - case "requestEthereumAccounts": - case "switchEthereumChain": - return; - default: - window.addEventListener("blur", () => { - window.addEventListener("focus", () => { - this.connection.checkUnseenEvents(); - }, { once: !0 }); - }, { once: !0 }), this.ui.openCoinbaseWalletDeeplink(); - break; - } - } - publishWeb3RequestCanceledEvent(e) { - const r = { - type: "WEB3_REQUEST_CANCELED", - id: e - }; - this.publishEvent("Web3RequestCanceled", r, !1).then(); - } - publishEvent(e, r, n) { - return this.connection.publishEvent(e, r, n); - } - handleWeb3ResponseMessage(e, r) { - if (r.method === "requestEthereumAccounts") { - Mo.accountRequestCallbackIds.forEach((n) => this.invokeCallback(n, r)), Mo.accountRequestCallbackIds.clear(); - return; - } - this.invokeCallback(e, r); - } - handleErrorResponse(e, r, n) { - var i; - const s = (i = n == null ? void 0 : n.message) !== null && i !== void 0 ? i : "Unspecified error message."; - this.handleWeb3ResponseMessage(e, { - method: r, - errorMessage: s - }); - } - invokeCallback(e, r) { - const n = this.relayEventManager.callbacks.get(e); - n && (n(r), this.relayEventManager.callbacks.delete(e)); - } - requestEthereumAccounts() { - const { appName: e, appLogoUrl: r } = this.metadata, n = { - method: "requestEthereumAccounts", - params: { - appName: e, - appLogoUrl: r - } - }, i = sc(8); - return new Promise((s, o) => { - this.relayEventManager.callbacks.set(i, (a) => { - if (jn(a)) - return o(new Error(a.errorMessage)); - s(a); - }), Mo.accountRequestCallbackIds.add(i), this.publishWeb3RequestEvent(i, n); - }); - } - watchAsset(e, r, n, i, s, o) { - const a = { - method: "watchAsset", - params: { - type: e, - options: { - address: r, - symbol: n, - decimals: i, - image: s - }, - chainId: o - } - }; - let u = null; - const l = sc(8), d = (p) => { - this.publishWeb3RequestCanceledEvent(l), this.handleErrorResponse(l, a.method, p), u == null || u(); - }; - return u = this.ui.showConnecting({ - isUnlinkedErrorState: this.isUnlinkedErrorState, - onCancel: d, - onResetConnection: this.resetAndReload - // eslint-disable-line @typescript-eslint/unbound-method - }), new Promise((p, w) => { - this.relayEventManager.callbacks.set(l, (_) => { - if (u == null || u(), jn(_)) - return w(new Error(_.errorMessage)); - p(_); - }), this.publishWeb3RequestEvent(l, a); - }); - } - addEthereumChain(e, r, n, i, s, o) { - const a = { - method: "addEthereumChain", - params: { - chainId: e, - rpcUrls: r, - blockExplorerUrls: i, - chainName: s, - iconUrls: n, - nativeCurrency: o - } - }; - let u = null; - const l = sc(8), d = (p) => { - this.publishWeb3RequestCanceledEvent(l), this.handleErrorResponse(l, a.method, p), u == null || u(); - }; - return u = this.ui.showConnecting({ - isUnlinkedErrorState: this.isUnlinkedErrorState, - onCancel: d, - onResetConnection: this.resetAndReload - // eslint-disable-line @typescript-eslint/unbound-method - }), new Promise((p, w) => { - this.relayEventManager.callbacks.set(l, (_) => { - if (u == null || u(), jn(_)) - return w(new Error(_.errorMessage)); - p(_); - }), this.publishWeb3RequestEvent(l, a); - }); - } - switchEthereumChain(e, r) { - const n = { - method: "switchEthereumChain", - params: Object.assign({ chainId: e }, { address: r }) - }; - let i = null; - const s = sc(8), o = (a) => { - this.publishWeb3RequestCanceledEvent(s), this.handleErrorResponse(s, n.method, a), i == null || i(); - }; - return i = this.ui.showConnecting({ - isUnlinkedErrorState: this.isUnlinkedErrorState, - onCancel: o, - onResetConnection: this.resetAndReload - // eslint-disable-line @typescript-eslint/unbound-method - }), new Promise((a, u) => { - this.relayEventManager.callbacks.set(s, (l) => { - if (i == null || i(), jn(l) && l.errorCode) - return u(Ar.provider.custom({ - code: l.errorCode, - message: "Unrecognized chain ID. Try adding the chain using addEthereumChain first." - })); - if (jn(l)) - return u(new Error(l.errorMessage)); - a(l); - }), this.publishWeb3RequestEvent(s, n); - }); - } -} -Mo.accountRequestCallbackIds = /* @__PURE__ */ new Set(); -const W6 = "DefaultChainId", H6 = "DefaultJsonRpcUrl"; -class FS { - constructor(e) { - this._relay = null, this._addresses = [], this.metadata = e.metadata, this._storage = new no("walletlink", q6), this.callback = e.callback || null; - const r = this._storage.getItem(ev); - if (r) { - const n = r.split(" "); - n[0] !== "" && (this._addresses = n.map((i) => ia(i))); - } - this.initializeRelay(); - } - getSession() { - const e = this.initializeRelay(), { id: r, secret: n } = e.getWalletLinkSession(); - return { id: r, secret: n }; - } - async handshake() { - await this._eth_requestAccounts(); - } - get selectedAddress() { - return this._addresses[0] || void 0; - } - get jsonRpcUrl() { - var e; - return (e = this._storage.getItem(H6)) !== null && e !== void 0 ? e : void 0; - } - set jsonRpcUrl(e) { - this._storage.setItem(H6, e); - } - updateProviderInfo(e, r) { - var n; - this.jsonRpcUrl = e; - const i = this.getChainId(); - this._storage.setItem(W6, r.toString(10)), el(r) !== i && ((n = this.callback) === null || n === void 0 || n.call(this, "chainChanged", ma(r))); - } - async watchAsset(e) { - const r = Array.isArray(e) ? e[0] : e; - if (!r.type) - throw Ar.rpc.invalidParams("Type is required"); - if ((r == null ? void 0 : r.type) !== "ERC20") - throw Ar.rpc.invalidParams(`Asset of type '${r.type}' is not supported`); - if (!(r != null && r.options)) - throw Ar.rpc.invalidParams("Options are required"); - if (!(r != null && r.options.address)) - throw Ar.rpc.invalidParams("Address is required"); - const n = this.getChainId(), { address: i, symbol: s, image: o, decimals: a } = r.options, l = await this.initializeRelay().watchAsset(r.type, i, s, a, o, n == null ? void 0 : n.toString()); - return jn(l) ? !1 : !!l.result; - } - async addEthereumChain(e) { - var r, n; - const i = e[0]; - if (((r = i.rpcUrls) === null || r === void 0 ? void 0 : r.length) === 0) - throw Ar.rpc.invalidParams("please pass in at least 1 rpcUrl"); - if (!i.chainName || i.chainName.trim() === "") - throw Ar.rpc.invalidParams("chainName is a required field"); - if (!i.nativeCurrency) - throw Ar.rpc.invalidParams("nativeCurrency is a required field"); - const s = Number.parseInt(i.chainId, 16); - if (s === this.getChainId()) - return !1; - const o = this.initializeRelay(), { rpcUrls: a = [], blockExplorerUrls: u = [], chainName: l, iconUrls: d = [], nativeCurrency: p } = i, w = await o.addEthereumChain(s.toString(), a, d, u, l, p); - if (jn(w)) - return !1; - if (((n = w.result) === null || n === void 0 ? void 0 : n.isApproved) === !0) - return this.updateProviderInfo(a[0], s), null; - throw Ar.rpc.internal("unable to add ethereum chain"); - } - async switchEthereumChain(e) { - const r = e[0], n = Number.parseInt(r.chainId, 16), s = await this.initializeRelay().switchEthereumChain(n.toString(10), this.selectedAddress || void 0); - if (jn(s)) - throw s; - const o = s.result; - return o.isApproved && o.rpcUrl.length > 0 && this.updateProviderInfo(o.rpcUrl, n), null; - } - async cleanup() { - this.callback = null, this._relay && this._relay.resetAndReload(), this._storage.clear(); - } - _setAddresses(e, r) { - var n; - if (!Array.isArray(e)) - throw new Error("addresses is not an array"); - const i = e.map((s) => ia(s)); - JSON.stringify(i) !== JSON.stringify(this._addresses) && (this._addresses = i, (n = this.callback) === null || n === void 0 || n.call(this, "accountsChanged", i), this._storage.setItem(ev, i.join(" "))); - } - async request(e) { - const r = e.params || []; - switch (e.method) { - case "eth_accounts": - return [...this._addresses]; - case "eth_coinbase": - return this.selectedAddress || null; - case "net_version": - return this.getChainId().toString(10); - case "eth_chainId": - return ma(this.getChainId()); - case "eth_requestAccounts": - return this._eth_requestAccounts(); - case "eth_ecRecover": - case "personal_ecRecover": - return this.ecRecover(e); - case "personal_sign": - return this.personalSign(e); - case "eth_signTransaction": - return this._eth_signTransaction(r); - case "eth_sendRawTransaction": - return this._eth_sendRawTransaction(r); - case "eth_sendTransaction": - return this._eth_sendTransaction(r); - case "eth_signTypedData_v1": - case "eth_signTypedData_v3": - case "eth_signTypedData_v4": - case "eth_signTypedData": - return this.signTypedData(e); - case "wallet_addEthereumChain": - return this.addEthereumChain(r); - case "wallet_switchEthereumChain": - return this.switchEthereumChain(r); - case "wallet_watchAsset": - return this.watchAsset(r); - default: - if (!this.jsonRpcUrl) - throw Ar.rpc.internal("No RPC URL set for chain"); - return hS(e, this.jsonRpcUrl); - } - } - _ensureKnownAddress(e) { - const r = ia(e); - if (!this._addresses.map((i) => ia(i)).includes(r)) - throw new Error("Unknown Ethereum address"); - } - _prepareTransactionParams(e) { - const r = e.from ? ia(e.from) : this.selectedAddress; - if (!r) - throw new Error("Ethereum address is unavailable"); - this._ensureKnownAddress(r); - const n = e.to ? ia(e.to) : null, i = e.value != null ? Ff(e.value) : BigInt(0), s = e.data ? Q1(e.data) : Buffer.alloc(0), o = e.nonce != null ? el(e.nonce) : null, a = e.gasPrice != null ? Ff(e.gasPrice) : null, u = e.maxFeePerGas != null ? Ff(e.maxFeePerGas) : null, l = e.maxPriorityFeePerGas != null ? Ff(e.maxPriorityFeePerGas) : null, d = e.gas != null ? Ff(e.gas) : null, p = e.chainId ? el(e.chainId) : this.getChainId(); - return { - fromAddress: r, - toAddress: n, - weiValue: i, - data: s, - nonce: o, - gasPriceInWei: a, - maxFeePerGas: u, - maxPriorityFeePerGas: l, - gasLimit: d, - chainId: p - }; - } - async ecRecover(e) { - const { method: r, params: n } = e; - if (!Array.isArray(n)) - throw Ar.rpc.invalidParams(); - const s = await this.initializeRelay().sendRequest({ - method: "ethereumAddressFromSignedMessage", - params: { - message: km(n[0]), - signature: km(n[1]), - addPrefix: r === "personal_ecRecover" - } - }); - if (jn(s)) - throw s; - return s.result; - } - getChainId() { - var e; - return Number.parseInt((e = this._storage.getItem(W6)) !== null && e !== void 0 ? e : "1", 10); - } - async _eth_requestAccounts() { - var e, r; - if (this._addresses.length > 0) - return (e = this.callback) === null || e === void 0 || e.call(this, "connect", { chainId: ma(this.getChainId()) }), this._addresses; - const i = await this.initializeRelay().requestEthereumAccounts(); - if (jn(i)) - throw i; - if (!i.result) - throw new Error("accounts received is empty"); - return this._setAddresses(i.result), (r = this.callback) === null || r === void 0 || r.call(this, "connect", { chainId: ma(this.getChainId()) }), this._addresses; - } - async personalSign({ params: e }) { - if (!Array.isArray(e)) - throw Ar.rpc.invalidParams(); - const r = e[1], n = e[0]; - this._ensureKnownAddress(r); - const s = await this.initializeRelay().sendRequest({ - method: "signEthereumMessage", - params: { - address: ia(r), - message: km(n), - addPrefix: !0, - typedDataJson: null - } - }); - if (jn(s)) - throw s; - return s.result; - } - async _eth_signTransaction(e) { - const r = this._prepareTransactionParams(e[0] || {}), i = await this.initializeRelay().signEthereumTransaction(r); - if (jn(i)) - throw i; - return i.result; - } - async _eth_sendRawTransaction(e) { - const r = Q1(e[0]), i = await this.initializeRelay().submitEthereumTransaction(r, this.getChainId()); - if (jn(i)) - throw i; - return i.result; - } - async _eth_sendTransaction(e) { - const r = this._prepareTransactionParams(e[0] || {}), i = await this.initializeRelay().signAndSubmitEthereumTransaction(r); - if (jn(i)) - throw i; - return i.result; - } - async signTypedData(e) { - const { method: r, params: n } = e; - if (!Array.isArray(n)) - throw Ar.rpc.invalidParams(); - const i = (l) => { - const d = { - eth_signTypedData_v1: Sd.hashForSignTypedDataLegacy, - eth_signTypedData_v3: Sd.hashForSignTypedData_v3, - eth_signTypedData_v4: Sd.hashForSignTypedData_v4, - eth_signTypedData: Sd.hashForSignTypedData_v4 - }; - return Qf(d[r]({ - data: CY(l) - }), !0); - }, s = n[r === "eth_signTypedData_v1" ? 1 : 0], o = n[r === "eth_signTypedData_v1" ? 0 : 1]; - this._ensureKnownAddress(s); - const u = await this.initializeRelay().sendRequest({ - method: "signEthereumMessage", - params: { - address: ia(s), - message: i(o), - typedDataJson: JSON.stringify(o, null, 2), - addPrefix: !1 - } - }); - if (jn(u)) - throw u; - return u.result; - } - initializeRelay() { - return this._relay || (this._relay = new Mo({ - linkAPIUrl: q6, - storage: this._storage, - metadata: this.metadata, - accountsCallback: this._setAddresses.bind(this), - chainCallback: this.updateProviderInfo.bind(this) - })), this._relay; - } -} -const jS = "SignerType", US = new no("CBWSDK", "SignerConfigurator"); -function $J() { - return US.getItem(jS); -} -function BJ(t) { - US.setItem(jS, t); -} -async function FJ(t) { - const { communicator: e, metadata: r, handshakeRequest: n, callback: i } = t; - UJ(e, r, i).catch(() => { - }); - const s = { - id: crypto.randomUUID(), - event: "selectSignerType", - data: Object.assign(Object.assign({}, t.preference), { handshakeRequest: n }) - }, { data: o } = await e.postRequestAndWaitForResponse(s); - return o; -} -function jJ(t) { - const { signerType: e, metadata: r, communicator: n, callback: i } = t; - switch (e) { - case "scw": - return new qY({ - metadata: r, - callback: i, - communicator: n - }); - case "walletlink": - return new FS({ - metadata: r, - callback: i - }); - } -} -async function UJ(t, e, r) { - await t.onMessage(({ event: i }) => i === "WalletLinkSessionRequest"); - const n = new FS({ - metadata: e, - callback: r - }); - t.postMessage({ - event: "WalletLinkUpdate", - data: { session: n.getSession() } - }), await n.handshake(), t.postMessage({ - event: "WalletLinkUpdate", - data: { connected: !0 } - }); -} -const qJ = `Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. - -Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`, zJ = () => { - let t; - return { - getCrossOriginOpenerPolicy: () => t === void 0 ? "undefined" : t, - checkCrossOriginOpenerPolicy: async () => { - if (typeof window > "u") { - t = "non-browser-env"; - return; - } - try { - const e = `${window.location.origin}${window.location.pathname}`, r = await fetch(e, { - method: "HEAD" - }); - if (!r.ok) - throw new Error(`HTTP error! status: ${r.status}`); - const n = r.headers.get("Cross-Origin-Opener-Policy"); - t = n ?? "null", t === "same-origin" && console.error(qJ); - } catch (e) { - console.error("Error checking Cross-Origin-Opener-Policy:", e.message), t = "error"; - } - } - }; -}, { checkCrossOriginOpenerPolicy: WJ, getCrossOriginOpenerPolicy: HJ } = zJ(), K6 = 420, V6 = 540; -function KJ(t) { - const e = (window.innerWidth - K6) / 2 + window.screenX, r = (window.innerHeight - V6) / 2 + window.screenY; - GJ(t); - const n = window.open(t, "Smart Wallet", `width=${K6}, height=${V6}, left=${e}, top=${r}`); - if (n == null || n.focus(), !n) - throw Ar.rpc.internal("Pop up window failed to open"); - return n; -} -function VJ(t) { - t && !t.closed && t.close(); -} -function GJ(t) { - const e = { - sdkName: lS, - sdkVersion: hh, - origin: window.location.origin, - coop: HJ() - }; - for (const [r, n] of Object.entries(e)) - t.searchParams.append(r, n.toString()); -} -class YJ { - constructor({ url: e = LJ, metadata: r, preference: n }) { - this.popup = null, this.listeners = /* @__PURE__ */ new Map(), this.postMessage = async (i) => { - (await this.waitForPopupLoaded()).postMessage(i, this.url.origin); - }, this.postRequestAndWaitForResponse = async (i) => { - const s = this.onMessage(({ requestId: o }) => o === i.id); - return this.postMessage(i), await s; - }, this.onMessage = async (i) => new Promise((s, o) => { - const a = (u) => { - if (u.origin !== this.url.origin) - return; - const l = u.data; - i(l) && (s(l), window.removeEventListener("message", a), this.listeners.delete(a)); - }; - window.addEventListener("message", a), this.listeners.set(a, { reject: o }); - }), this.disconnect = () => { - VJ(this.popup), this.popup = null, this.listeners.forEach(({ reject: i }, s) => { - i(Ar.provider.userRejectedRequest("Request rejected")), window.removeEventListener("message", s); - }), this.listeners.clear(); - }, this.waitForPopupLoaded = async () => this.popup && !this.popup.closed ? (this.popup.focus(), this.popup) : (this.popup = KJ(this.url), this.onMessage(({ event: i }) => i === "PopupUnload").then(this.disconnect).catch(() => { - }), this.onMessage(({ event: i }) => i === "PopupLoaded").then((i) => { - this.postMessage({ - requestId: i.id, - data: { - version: hh, - metadata: this.metadata, - preference: this.preference, - location: window.location.toString() - } - }); - }).then(() => { - if (!this.popup) - throw Ar.rpc.internal(); - return this.popup; - })), this.url = new URL(e), this.metadata = r, this.preference = n; - } -} -function JJ(t) { - const e = SY(XJ(t), { - shouldIncludeStack: !0 - }), r = new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors"); - return r.searchParams.set("version", hh), r.searchParams.set("code", e.code.toString()), r.searchParams.set("message", e.message), Object.assign(Object.assign({}, e), { docUrl: r.href }); -} -function XJ(t) { - var e; - if (typeof t == "string") - return { - message: t, - code: fn.rpc.internal - }; - if (jn(t)) { - const r = t.errorMessage, n = (e = t.errorCode) !== null && e !== void 0 ? e : r.match(/(denied|rejected)/i) ? fn.provider.userRejectedRequest : void 0; - return Object.assign(Object.assign({}, t), { - message: r, - code: n, - data: { method: t.method } - }); - } - return t; -} -var qS = { exports: {} }; -(function(t) { - var e = Object.prototype.hasOwnProperty, r = "~"; - function n() { - } - Object.create && (n.prototype = /* @__PURE__ */ Object.create(null), new n().__proto__ || (r = !1)); - function i(u, l, d) { - this.fn = u, this.context = l, this.once = d || !1; - } - function s(u, l, d, p, w) { - if (typeof d != "function") - throw new TypeError("The listener must be a function"); - var _ = new i(d, p || u, w), P = r ? r + l : l; - return u._events[P] ? u._events[P].fn ? u._events[P] = [u._events[P], _] : u._events[P].push(_) : (u._events[P] = _, u._eventsCount++), u; - } - function o(u, l) { - --u._eventsCount === 0 ? u._events = new n() : delete u._events[l]; - } - function a() { - this._events = new n(), this._eventsCount = 0; - } - a.prototype.eventNames = function() { - var l = [], d, p; - if (this._eventsCount === 0) return l; - for (p in d = this._events) - e.call(d, p) && l.push(r ? p.slice(1) : p); - return Object.getOwnPropertySymbols ? l.concat(Object.getOwnPropertySymbols(d)) : l; - }, a.prototype.listeners = function(l) { - var d = r ? r + l : l, p = this._events[d]; - if (!p) return []; - if (p.fn) return [p.fn]; - for (var w = 0, _ = p.length, P = new Array(_); w < _; w++) - P[w] = p[w].fn; - return P; - }, a.prototype.listenerCount = function(l) { - var d = r ? r + l : l, p = this._events[d]; - return p ? p.fn ? 1 : p.length : 0; - }, a.prototype.emit = function(l, d, p, w, _, P) { - var O = r ? r + l : l; - if (!this._events[O]) return !1; - var L = this._events[O], B = arguments.length, k, W; - if (L.fn) { - switch (L.once && this.removeListener(l, L.fn, void 0, !0), B) { - case 1: - return L.fn.call(L.context), !0; - case 2: - return L.fn.call(L.context, d), !0; - case 3: - return L.fn.call(L.context, d, p), !0; - case 4: - return L.fn.call(L.context, d, p, w), !0; - case 5: - return L.fn.call(L.context, d, p, w, _), !0; - case 6: - return L.fn.call(L.context, d, p, w, _, P), !0; - } - for (W = 1, k = new Array(B - 1); W < B; W++) - k[W - 1] = arguments[W]; - L.fn.apply(L.context, k); - } else { - var U = L.length, V; - for (W = 0; W < U; W++) - switch (L[W].once && this.removeListener(l, L[W].fn, void 0, !0), B) { - case 1: - L[W].fn.call(L[W].context); - break; - case 2: - L[W].fn.call(L[W].context, d); - break; - case 3: - L[W].fn.call(L[W].context, d, p); - break; - case 4: - L[W].fn.call(L[W].context, d, p, w); - break; - default: - if (!k) for (V = 1, k = new Array(B - 1); V < B; V++) - k[V - 1] = arguments[V]; - L[W].fn.apply(L[W].context, k); - } - } - return !0; - }, a.prototype.on = function(l, d, p) { - return s(this, l, d, p, !1); - }, a.prototype.once = function(l, d, p) { - return s(this, l, d, p, !0); - }, a.prototype.removeListener = function(l, d, p, w) { - var _ = r ? r + l : l; - if (!this._events[_]) return this; - if (!d) - return o(this, _), this; - var P = this._events[_]; - if (P.fn) - P.fn === d && (!w || P.once) && (!p || P.context === p) && o(this, _); - else { - for (var O = 0, L = [], B = P.length; O < B; O++) - (P[O].fn !== d || w && !P[O].once || p && P[O].context !== p) && L.push(P[O]); - L.length ? this._events[_] = L.length === 1 ? L[0] : L : o(this, _); - } - return this; - }, a.prototype.removeAllListeners = function(l) { - var d; - return l ? (d = r ? r + l : l, this._events[d] && o(this, d)) : (this._events = new n(), this._eventsCount = 0), this; - }, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = r, a.EventEmitter = a, t.exports = a; -})(qS); -var ZJ = qS.exports; -const QJ = /* @__PURE__ */ ns(ZJ); -class eX extends QJ { -} -var tX = function(t, e) { - var r = {}; - for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); - if (t != null && typeof Object.getOwnPropertySymbols == "function") - for (var i = 0, n = Object.getOwnPropertySymbols(t); i < n.length; i++) - e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]); - return r; -}; -class rX extends eX { - constructor(e) { - var { metadata: r } = e, n = e.preference, { keysUrl: i } = n, s = tX(n, ["keysUrl"]); - super(), this.signer = null, this.isCoinbaseWallet = !0, this.metadata = r, this.preference = s, this.communicator = new YJ({ - url: i, - metadata: r, - preference: s - }); - const o = $J(); - o && (this.signer = this.initSigner(o)); - } - async request(e) { - try { - if (UY(e), !this.signer) - switch (e.method) { - case "eth_requestAccounts": { - const r = await this.requestSignerSelection(e), n = this.initSigner(r); - await n.handshake(e), this.signer = n, BJ(r); - break; - } - case "net_version": - return 1; - case "eth_chainId": - return ma(1); - default: - throw Ar.provider.unauthorized("Must call 'eth_requestAccounts' before other methods"); - } - return this.signer.request(e); - } catch (r) { - const { code: n } = r; - return n === fn.provider.unauthorized && this.disconnect(), Promise.reject(JJ(r)); - } - } - /** @deprecated Use `.request({ method: 'eth_requestAccounts' })` instead. */ - async enable() { - return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'), await this.request({ - method: "eth_requestAccounts" - }); - } - async disconnect() { - var e; - await ((e = this.signer) === null || e === void 0 ? void 0 : e.cleanup()), this.signer = null, no.clearAll(), this.emit("disconnect", Ar.provider.disconnected("User initiated disconnection")); - } - requestSignerSelection(e) { - return FJ({ - communicator: this.communicator, - preference: this.preference, - metadata: this.metadata, - handshakeRequest: e, - callback: this.emit.bind(this) - }); - } - initSigner(e) { - return jJ({ - signerType: e, - metadata: this.metadata, - communicator: this.communicator, - callback: this.emit.bind(this) - }); - } -} -function nX(t) { - if (t) { - if (!["all", "smartWalletOnly", "eoaOnly"].includes(t.options)) - throw new Error(`Invalid options: ${t.options}`); - if (t.attribution && t.attribution.auto !== void 0 && t.attribution.dataSuffix !== void 0) - throw new Error("Attribution cannot contain both auto and dataSuffix properties"); - } -} -function iX(t) { - var e; - const r = { - metadata: t.metadata, - preference: t.preference - }; - return (e = jY(r)) !== null && e !== void 0 ? e : new rX(r); -} -const sX = { - options: "all" -}; -function oX(t) { - var e; - new no("CBWSDK").setItem("VERSION", hh), WJ(); - const n = { - metadata: { - appName: t.appName || "Dapp", - appLogoUrl: t.appLogoUrl || "", - appChainIds: t.appChainIds || [] - }, - preference: Object.assign(sX, (e = t.preference) !== null && e !== void 0 ? e : {}) - }; - nX(n.preference); - let i = null; - return { - getProvider: () => (i || (i = iX(n)), i) - }; -} -function zS(t, e) { - return function() { - return t.apply(e, arguments); - }; -} -const { toString: aX } = Object.prototype, { getPrototypeOf: Fb } = Object, Sp = /* @__PURE__ */ ((t) => (e) => { - const r = aX.call(e); - return t[r] || (t[r] = r.slice(8, -1).toLowerCase()); -})(/* @__PURE__ */ Object.create(null)), Ts = (t) => (t = t.toLowerCase(), (e) => Sp(e) === t), Ap = (t) => (e) => typeof e === t, { isArray: Zu } = Array, Bl = Ap("undefined"); -function cX(t) { - return t !== null && !Bl(t) && t.constructor !== null && !Bl(t.constructor) && Ni(t.constructor.isBuffer) && t.constructor.isBuffer(t); -} -const WS = Ts("ArrayBuffer"); -function uX(t) { - let e; - return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && WS(t.buffer), e; -} -const fX = Ap("string"), Ni = Ap("function"), HS = Ap("number"), Pp = (t) => t !== null && typeof t == "object", lX = (t) => t === !0 || t === !1, Gd = (t) => { - if (Sp(t) !== "object") - return !1; - const e = Fb(t); - return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in t) && !(Symbol.iterator in t); -}, hX = Ts("Date"), dX = Ts("File"), pX = Ts("Blob"), gX = Ts("FileList"), mX = (t) => Pp(t) && Ni(t.pipe), vX = (t) => { - let e; - return t && (typeof FormData == "function" && t instanceof FormData || Ni(t.append) && ((e = Sp(t)) === "formdata" || // detect form-data instance - e === "object" && Ni(t.toString) && t.toString() === "[object FormData]")); -}, bX = Ts("URLSearchParams"), [yX, wX, xX, _X] = ["ReadableStream", "Request", "Response", "Headers"].map(Ts), EX = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); -function ph(t, e, { allOwnKeys: r = !1 } = {}) { - if (t === null || typeof t > "u") - return; - let n, i; - if (typeof t != "object" && (t = [t]), Zu(t)) - for (n = 0, i = t.length; n < i; n++) - e.call(null, t[n], n, t); - else { - const s = r ? Object.getOwnPropertyNames(t) : Object.keys(t), o = s.length; - let a; - for (n = 0; n < o; n++) - a = s[n], e.call(null, t[a], a, t); - } -} -function KS(t, e) { - e = e.toLowerCase(); - const r = Object.keys(t); - let n = r.length, i; - for (; n-- > 0; ) - if (i = r[n], e === i.toLowerCase()) - return i; - return null; -} -const lc = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, VS = (t) => !Bl(t) && t !== lc; -function av() { - const { caseless: t } = VS(this) && this || {}, e = {}, r = (n, i) => { - const s = t && KS(e, i) || i; - Gd(e[s]) && Gd(n) ? e[s] = av(e[s], n) : Gd(n) ? e[s] = av({}, n) : Zu(n) ? e[s] = n.slice() : e[s] = n; - }; - for (let n = 0, i = arguments.length; n < i; n++) - arguments[n] && ph(arguments[n], r); - return e; -} -const SX = (t, e, r, { allOwnKeys: n } = {}) => (ph(e, (i, s) => { - r && Ni(i) ? t[s] = zS(i, r) : t[s] = i; -}, { allOwnKeys: n }), t), AX = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), PX = (t, e, r, n) => { - t.prototype = Object.create(e.prototype, n), t.prototype.constructor = t, Object.defineProperty(t, "super", { - value: e.prototype - }), r && Object.assign(t.prototype, r); -}, MX = (t, e, r, n) => { - let i, s, o; - const a = {}; - if (e = e || {}, t == null) return e; - do { - for (i = Object.getOwnPropertyNames(t), s = i.length; s-- > 0; ) - o = i[s], (!n || n(o, t, e)) && !a[o] && (e[o] = t[o], a[o] = !0); - t = r !== !1 && Fb(t); - } while (t && (!r || r(t, e)) && t !== Object.prototype); - return e; -}, IX = (t, e, r) => { - t = String(t), (r === void 0 || r > t.length) && (r = t.length), r -= e.length; - const n = t.indexOf(e, r); - return n !== -1 && n === r; -}, CX = (t) => { - if (!t) return null; - if (Zu(t)) return t; - let e = t.length; - if (!HS(e)) return null; - const r = new Array(e); - for (; e-- > 0; ) - r[e] = t[e]; - return r; -}, TX = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Fb(Uint8Array)), RX = (t, e) => { - const n = (t && t[Symbol.iterator]).call(t); - let i; - for (; (i = n.next()) && !i.done; ) { - const s = i.value; - e.call(t, s[0], s[1]); - } -}, DX = (t, e) => { - let r; - const n = []; - for (; (r = t.exec(e)) !== null; ) - n.push(r); - return n; -}, OX = Ts("HTMLFormElement"), NX = (t) => t.toLowerCase().replace( - /[-_\s]([a-z\d])(\w*)/g, - function(r, n, i) { - return n.toUpperCase() + i; - } -), G6 = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), LX = Ts("RegExp"), GS = (t, e) => { - const r = Object.getOwnPropertyDescriptors(t), n = {}; - ph(r, (i, s) => { - let o; - (o = e(i, s, t)) !== !1 && (n[s] = o || i); - }), Object.defineProperties(t, n); -}, kX = (t) => { - GS(t, (e, r) => { - if (Ni(t) && ["arguments", "caller", "callee"].indexOf(r) !== -1) - return !1; - const n = t[r]; - if (Ni(n)) { - if (e.enumerable = !1, "writable" in e) { - e.writable = !1; - return; - } - e.set || (e.set = () => { - throw Error("Can not rewrite read-only method '" + r + "'"); - }); - } - }); -}, $X = (t, e) => { - const r = {}, n = (i) => { - i.forEach((s) => { - r[s] = !0; - }); - }; - return Zu(t) ? n(t) : n(String(t).split(e)), r; -}, BX = () => { -}, FX = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, qm = "abcdefghijklmnopqrstuvwxyz", Y6 = "0123456789", YS = { - DIGIT: Y6, - ALPHA: qm, - ALPHA_DIGIT: qm + qm.toUpperCase() + Y6 -}, jX = (t = 16, e = YS.ALPHA_DIGIT) => { - let r = ""; - const { length: n } = e; - for (; t--; ) - r += e[Math.random() * n | 0]; - return r; -}; -function UX(t) { - return !!(t && Ni(t.append) && t[Symbol.toStringTag] === "FormData" && t[Symbol.iterator]); -} -const qX = (t) => { - const e = new Array(10), r = (n, i) => { - if (Pp(n)) { - if (e.indexOf(n) >= 0) - return; - if (!("toJSON" in n)) { - e[i] = n; - const s = Zu(n) ? [] : {}; - return ph(n, (o, a) => { - const u = r(o, i + 1); - !Bl(u) && (s[a] = u); - }), e[i] = void 0, s; - } - } - return n; - }; - return r(t, 0); -}, zX = Ts("AsyncFunction"), WX = (t) => t && (Pp(t) || Ni(t)) && Ni(t.then) && Ni(t.catch), JS = ((t, e) => t ? setImmediate : e ? ((r, n) => (lc.addEventListener("message", ({ source: i, data: s }) => { - i === lc && s === r && n.length && n.shift()(); -}, !1), (i) => { - n.push(i), lc.postMessage(r, "*"); -}))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))( - typeof setImmediate == "function", - Ni(lc.postMessage) -), HX = typeof queueMicrotask < "u" ? queueMicrotask.bind(lc) : typeof process < "u" && process.nextTick || JS, Oe = { - isArray: Zu, - isArrayBuffer: WS, - isBuffer: cX, - isFormData: vX, - isArrayBufferView: uX, - isString: fX, - isNumber: HS, - isBoolean: lX, - isObject: Pp, - isPlainObject: Gd, - isReadableStream: yX, - isRequest: wX, - isResponse: xX, - isHeaders: _X, - isUndefined: Bl, - isDate: hX, - isFile: dX, - isBlob: pX, - isRegExp: LX, - isFunction: Ni, - isStream: mX, - isURLSearchParams: bX, - isTypedArray: TX, - isFileList: gX, - forEach: ph, - merge: av, - extend: SX, - trim: EX, - stripBOM: AX, - inherits: PX, - toFlatObject: MX, - kindOf: Sp, - kindOfTest: Ts, - endsWith: IX, - toArray: CX, - forEachEntry: RX, - matchAll: DX, - isHTMLForm: OX, - hasOwnProperty: G6, - hasOwnProp: G6, - // an alias to avoid ESLint no-prototype-builtins detection - reduceDescriptors: GS, - freezeMethods: kX, - toObjectSet: $X, - toCamelCase: NX, - noop: BX, - toFiniteNumber: FX, - findKey: KS, - global: lc, - isContextDefined: VS, - ALPHABET: YS, - generateString: jX, - isSpecCompliantForm: UX, - toJSONObject: qX, - isAsyncFn: zX, - isThenable: WX, - setImmediate: JS, - asap: HX -}; -function or(t, e, r, n, i) { - Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = t, this.name = "AxiosError", e && (this.code = e), r && (this.config = r), n && (this.request = n), i && (this.response = i, this.status = i.status ? i.status : null); -} -Oe.inherits(or, Error, { - toJSON: function() { - return { - // Standard - message: this.message, - name: this.name, - // Microsoft - description: this.description, - number: this.number, - // Mozilla - fileName: this.fileName, - lineNumber: this.lineNumber, - columnNumber: this.columnNumber, - stack: this.stack, - // Axios - config: Oe.toJSONObject(this.config), - code: this.code, - status: this.status - }; - } -}); -const XS = or.prototype, ZS = {}; -[ - "ERR_BAD_OPTION_VALUE", - "ERR_BAD_OPTION", - "ECONNABORTED", - "ETIMEDOUT", - "ERR_NETWORK", - "ERR_FR_TOO_MANY_REDIRECTS", - "ERR_DEPRECATED", - "ERR_BAD_RESPONSE", - "ERR_BAD_REQUEST", - "ERR_CANCELED", - "ERR_NOT_SUPPORT", - "ERR_INVALID_URL" - // eslint-disable-next-line func-names -].forEach((t) => { - ZS[t] = { value: t }; -}); -Object.defineProperties(or, ZS); -Object.defineProperty(XS, "isAxiosError", { value: !0 }); -or.from = (t, e, r, n, i, s) => { - const o = Object.create(XS); - return Oe.toFlatObject(t, o, function(u) { - return u !== Error.prototype; - }, (a) => a !== "isAxiosError"), or.call(o, t.message, e, r, n, i), o.cause = t, o.name = t.name, s && Object.assign(o, s), o; -}; -const KX = null; -function cv(t) { - return Oe.isPlainObject(t) || Oe.isArray(t); -} -function QS(t) { - return Oe.endsWith(t, "[]") ? t.slice(0, -2) : t; -} -function J6(t, e, r) { - return t ? t.concat(e).map(function(i, s) { - return i = QS(i), !r && s ? "[" + i + "]" : i; - }).join(r ? "." : "") : e; -} -function VX(t) { - return Oe.isArray(t) && !t.some(cv); -} -const GX = Oe.toFlatObject(Oe, {}, null, function(e) { - return /^is[A-Z]/.test(e); -}); -function Mp(t, e, r) { - if (!Oe.isObject(t)) - throw new TypeError("target must be an object"); - e = e || new FormData(), r = Oe.toFlatObject(r, { - metaTokens: !0, - dots: !1, - indexes: !1 - }, !1, function(O, L) { - return !Oe.isUndefined(L[O]); - }); - const n = r.metaTokens, i = r.visitor || d, s = r.dots, o = r.indexes, u = (r.Blob || typeof Blob < "u" && Blob) && Oe.isSpecCompliantForm(e); - if (!Oe.isFunction(i)) - throw new TypeError("visitor must be a function"); - function l(P) { - if (P === null) return ""; - if (Oe.isDate(P)) - return P.toISOString(); - if (!u && Oe.isBlob(P)) - throw new or("Blob is not supported. Use a Buffer instead."); - return Oe.isArrayBuffer(P) || Oe.isTypedArray(P) ? u && typeof Blob == "function" ? new Blob([P]) : Buffer.from(P) : P; - } - function d(P, O, L) { - let B = P; - if (P && !L && typeof P == "object") { - if (Oe.endsWith(O, "{}")) - O = n ? O : O.slice(0, -2), P = JSON.stringify(P); - else if (Oe.isArray(P) && VX(P) || (Oe.isFileList(P) || Oe.endsWith(O, "[]")) && (B = Oe.toArray(P))) - return O = QS(O), B.forEach(function(W, U) { - !(Oe.isUndefined(W) || W === null) && e.append( - // eslint-disable-next-line no-nested-ternary - o === !0 ? J6([O], U, s) : o === null ? O : O + "[]", - l(W) - ); - }), !1; - } - return cv(P) ? !0 : (e.append(J6(L, O, s), l(P)), !1); - } - const p = [], w = Object.assign(GX, { - defaultVisitor: d, - convertValue: l, - isVisitable: cv - }); - function _(P, O) { - if (!Oe.isUndefined(P)) { - if (p.indexOf(P) !== -1) - throw Error("Circular reference detected in " + O.join(".")); - p.push(P), Oe.forEach(P, function(B, k) { - (!(Oe.isUndefined(B) || B === null) && i.call( - e, - B, - Oe.isString(k) ? k.trim() : k, - O, - w - )) === !0 && _(B, O ? O.concat(k) : [k]); - }), p.pop(); - } - } - if (!Oe.isObject(t)) - throw new TypeError("data must be an object"); - return _(t), e; -} -function X6(t) { - const e = { - "!": "%21", - "'": "%27", - "(": "%28", - ")": "%29", - "~": "%7E", - "%20": "+", - "%00": "\0" - }; - return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g, function(n) { - return e[n]; - }); -} -function jb(t, e) { - this._pairs = [], t && Mp(t, this, e); -} -const e7 = jb.prototype; -e7.append = function(e, r) { - this._pairs.push([e, r]); -}; -e7.toString = function(e) { - const r = e ? function(n) { - return e.call(this, n, X6); - } : X6; - return this._pairs.map(function(i) { - return r(i[0]) + "=" + r(i[1]); - }, "").join("&"); -}; -function YX(t) { - return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]"); -} -function t7(t, e, r) { - if (!e) - return t; - const n = r && r.encode || YX; - Oe.isFunction(r) && (r = { - serialize: r - }); - const i = r && r.serialize; - let s; - if (i ? s = i(e, r) : s = Oe.isURLSearchParams(e) ? e.toString() : new jb(e, r).toString(n), s) { - const o = t.indexOf("#"); - o !== -1 && (t = t.slice(0, o)), t += (t.indexOf("?") === -1 ? "?" : "&") + s; - } - return t; -} -class Z6 { - constructor() { - this.handlers = []; - } - /** - * Add a new interceptor to the stack - * - * @param {Function} fulfilled The function to handle `then` for a `Promise` - * @param {Function} rejected The function to handle `reject` for a `Promise` - * - * @return {Number} An ID used to remove interceptor later - */ - use(e, r, n) { - return this.handlers.push({ - fulfilled: e, - rejected: r, - synchronous: n ? n.synchronous : !1, - runWhen: n ? n.runWhen : null - }), this.handlers.length - 1; - } - /** - * Remove an interceptor from the stack - * - * @param {Number} id The ID that was returned by `use` - * - * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise - */ - eject(e) { - this.handlers[e] && (this.handlers[e] = null); - } - /** - * Clear all interceptors from the stack - * - * @returns {void} - */ - clear() { - this.handlers && (this.handlers = []); - } - /** - * Iterate over all the registered interceptors - * - * This method is particularly useful for skipping over any - * interceptors that may have become `null` calling `eject`. - * - * @param {Function} fn The function to call for each interceptor - * - * @returns {void} - */ - forEach(e) { - Oe.forEach(this.handlers, function(n) { - n !== null && e(n); - }); - } -} -const r7 = { - silentJSONParsing: !0, - forcedJSONParsing: !0, - clarifyTimeoutError: !1 -}, JX = typeof URLSearchParams < "u" ? URLSearchParams : jb, XX = typeof FormData < "u" ? FormData : null, ZX = typeof Blob < "u" ? Blob : null, QX = { - isBrowser: !0, - classes: { - URLSearchParams: JX, - FormData: XX, - Blob: ZX - }, - protocols: ["http", "https", "file", "blob", "url", "data"] -}, Ub = typeof window < "u" && typeof document < "u", uv = typeof navigator == "object" && navigator || void 0, eZ = Ub && (!uv || ["ReactNative", "NativeScript", "NS"].indexOf(uv.product) < 0), tZ = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef -self instanceof WorkerGlobalScope && typeof self.importScripts == "function", rZ = Ub && window.location.href || "http://localhost", nZ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - hasBrowserEnv: Ub, - hasStandardBrowserEnv: eZ, - hasStandardBrowserWebWorkerEnv: tZ, - navigator: uv, - origin: rZ -}, Symbol.toStringTag, { value: "Module" })), Jn = { - ...nZ, - ...QX -}; -function iZ(t, e) { - return Mp(t, new Jn.classes.URLSearchParams(), Object.assign({ - visitor: function(r, n, i, s) { - return Jn.isNode && Oe.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : s.defaultVisitor.apply(this, arguments); - } - }, e)); -} -function sZ(t) { - return Oe.matchAll(/\w+|\[(\w*)]/g, t).map((e) => e[0] === "[]" ? "" : e[1] || e[0]); -} -function oZ(t) { - const e = {}, r = Object.keys(t); - let n; - const i = r.length; - let s; - for (n = 0; n < i; n++) - s = r[n], e[s] = t[s]; - return e; -} -function n7(t) { - function e(r, n, i, s) { - let o = r[s++]; - if (o === "__proto__") return !0; - const a = Number.isFinite(+o), u = s >= r.length; - return o = !o && Oe.isArray(i) ? i.length : o, u ? (Oe.hasOwnProp(i, o) ? i[o] = [i[o], n] : i[o] = n, !a) : ((!i[o] || !Oe.isObject(i[o])) && (i[o] = []), e(r, n, i[o], s) && Oe.isArray(i[o]) && (i[o] = oZ(i[o])), !a); - } - if (Oe.isFormData(t) && Oe.isFunction(t.entries)) { - const r = {}; - return Oe.forEachEntry(t, (n, i) => { - e(sZ(n), i, r, 0); - }), r; - } - return null; -} -function aZ(t, e, r) { - if (Oe.isString(t)) - try { - return (e || JSON.parse)(t), Oe.trim(t); - } catch (n) { - if (n.name !== "SyntaxError") - throw n; - } - return (r || JSON.stringify)(t); -} -const gh = { - transitional: r7, - adapter: ["xhr", "http", "fetch"], - transformRequest: [function(e, r) { - const n = r.getContentType() || "", i = n.indexOf("application/json") > -1, s = Oe.isObject(e); - if (s && Oe.isHTMLForm(e) && (e = new FormData(e)), Oe.isFormData(e)) - return i ? JSON.stringify(n7(e)) : e; - if (Oe.isArrayBuffer(e) || Oe.isBuffer(e) || Oe.isStream(e) || Oe.isFile(e) || Oe.isBlob(e) || Oe.isReadableStream(e)) - return e; - if (Oe.isArrayBufferView(e)) - return e.buffer; - if (Oe.isURLSearchParams(e)) - return r.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString(); - let a; - if (s) { - if (n.indexOf("application/x-www-form-urlencoded") > -1) - return iZ(e, this.formSerializer).toString(); - if ((a = Oe.isFileList(e)) || n.indexOf("multipart/form-data") > -1) { - const u = this.env && this.env.FormData; - return Mp( - a ? { "files[]": e } : e, - u && new u(), - this.formSerializer - ); - } - } - return s || i ? (r.setContentType("application/json", !1), aZ(e)) : e; - }], - transformResponse: [function(e) { - const r = this.transitional || gh.transitional, n = r && r.forcedJSONParsing, i = this.responseType === "json"; - if (Oe.isResponse(e) || Oe.isReadableStream(e)) - return e; - if (e && Oe.isString(e) && (n && !this.responseType || i)) { - const o = !(r && r.silentJSONParsing) && i; - try { - return JSON.parse(e); - } catch (a) { - if (o) - throw a.name === "SyntaxError" ? or.from(a, or.ERR_BAD_RESPONSE, this, null, this.response) : a; - } - } - return e; - }], - /** - * A timeout in milliseconds to abort a request. If set to 0 (default) a - * timeout is not created. - */ - timeout: 0, - xsrfCookieName: "XSRF-TOKEN", - xsrfHeaderName: "X-XSRF-TOKEN", - maxContentLength: -1, - maxBodyLength: -1, - env: { - FormData: Jn.classes.FormData, - Blob: Jn.classes.Blob - }, - validateStatus: function(e) { - return e >= 200 && e < 300; - }, - headers: { - common: { - Accept: "application/json, text/plain, */*", - "Content-Type": void 0 - } - } -}; -Oe.forEach(["delete", "get", "head", "post", "put", "patch"], (t) => { - gh.headers[t] = {}; -}); -const cZ = Oe.toObjectSet([ - "age", - "authorization", - "content-length", - "content-type", - "etag", - "expires", - "from", - "host", - "if-modified-since", - "if-unmodified-since", - "last-modified", - "location", - "max-forwards", - "proxy-authorization", - "referer", - "retry-after", - "user-agent" -]), uZ = (t) => { - const e = {}; - let r, n, i; - return t && t.split(` -`).forEach(function(o) { - i = o.indexOf(":"), r = o.substring(0, i).trim().toLowerCase(), n = o.substring(i + 1).trim(), !(!r || e[r] && cZ[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n); - }), e; -}, Q6 = Symbol("internals"); -function jf(t) { - return t && String(t).trim().toLowerCase(); -} -function Yd(t) { - return t === !1 || t == null ? t : Oe.isArray(t) ? t.map(Yd) : String(t); -} -function fZ(t) { - const e = /* @__PURE__ */ Object.create(null), r = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; - let n; - for (; n = r.exec(t); ) - e[n[1]] = n[2]; - return e; -} -const lZ = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()); -function zm(t, e, r, n, i) { - if (Oe.isFunction(n)) - return n.call(this, e, r); - if (i && (e = r), !!Oe.isString(e)) { - if (Oe.isString(n)) - return e.indexOf(n) !== -1; - if (Oe.isRegExp(n)) - return n.test(e); - } -} -function hZ(t) { - return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, r, n) => r.toUpperCase() + n); -} -function dZ(t, e) { - const r = Oe.toCamelCase(" " + e); - ["get", "set", "has"].forEach((n) => { - Object.defineProperty(t, n + r, { - value: function(i, s, o) { - return this[n].call(this, e, i, s, o); - }, - configurable: !0 - }); - }); -} -let yi = class { - constructor(e) { - e && this.set(e); - } - set(e, r, n) { - const i = this; - function s(a, u, l) { - const d = jf(u); - if (!d) - throw new Error("header name must be a non-empty string"); - const p = Oe.findKey(i, d); - (!p || i[p] === void 0 || l === !0 || l === void 0 && i[p] !== !1) && (i[p || u] = Yd(a)); - } - const o = (a, u) => Oe.forEach(a, (l, d) => s(l, d, u)); - if (Oe.isPlainObject(e) || e instanceof this.constructor) - o(e, r); - else if (Oe.isString(e) && (e = e.trim()) && !lZ(e)) - o(uZ(e), r); - else if (Oe.isHeaders(e)) - for (const [a, u] of e.entries()) - s(u, a, n); - else - e != null && s(r, e, n); - return this; - } - get(e, r) { - if (e = jf(e), e) { - const n = Oe.findKey(this, e); - if (n) { - const i = this[n]; - if (!r) - return i; - if (r === !0) - return fZ(i); - if (Oe.isFunction(r)) - return r.call(this, i, n); - if (Oe.isRegExp(r)) - return r.exec(i); - throw new TypeError("parser must be boolean|regexp|function"); - } - } - } - has(e, r) { - if (e = jf(e), e) { - const n = Oe.findKey(this, e); - return !!(n && this[n] !== void 0 && (!r || zm(this, this[n], n, r))); - } - return !1; - } - delete(e, r) { - const n = this; - let i = !1; - function s(o) { - if (o = jf(o), o) { - const a = Oe.findKey(n, o); - a && (!r || zm(n, n[a], a, r)) && (delete n[a], i = !0); - } - } - return Oe.isArray(e) ? e.forEach(s) : s(e), i; - } - clear(e) { - const r = Object.keys(this); - let n = r.length, i = !1; - for (; n--; ) { - const s = r[n]; - (!e || zm(this, this[s], s, e, !0)) && (delete this[s], i = !0); - } - return i; - } - normalize(e) { - const r = this, n = {}; - return Oe.forEach(this, (i, s) => { - const o = Oe.findKey(n, s); - if (o) { - r[o] = Yd(i), delete r[s]; - return; - } - const a = e ? hZ(s) : String(s).trim(); - a !== s && delete r[s], r[a] = Yd(i), n[a] = !0; - }), this; - } - concat(...e) { - return this.constructor.concat(this, ...e); - } - toJSON(e) { - const r = /* @__PURE__ */ Object.create(null); - return Oe.forEach(this, (n, i) => { - n != null && n !== !1 && (r[i] = e && Oe.isArray(n) ? n.join(", ") : n); - }), r; - } - [Symbol.iterator]() { - return Object.entries(this.toJSON())[Symbol.iterator](); - } - toString() { - return Object.entries(this.toJSON()).map(([e, r]) => e + ": " + r).join(` -`); - } - get [Symbol.toStringTag]() { - return "AxiosHeaders"; - } - static from(e) { - return e instanceof this ? e : new this(e); - } - static concat(e, ...r) { - const n = new this(e); - return r.forEach((i) => n.set(i)), n; - } - static accessor(e) { - const n = (this[Q6] = this[Q6] = { - accessors: {} - }).accessors, i = this.prototype; - function s(o) { - const a = jf(o); - n[a] || (dZ(i, o), n[a] = !0); - } - return Oe.isArray(e) ? e.forEach(s) : s(e), this; - } -}; -yi.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]); -Oe.reduceDescriptors(yi.prototype, ({ value: t }, e) => { - let r = e[0].toUpperCase() + e.slice(1); - return { - get: () => t, - set(n) { - this[r] = n; - } - }; -}); -Oe.freezeMethods(yi); -function Wm(t, e) { - const r = this || gh, n = e || r, i = yi.from(n.headers); - let s = n.data; - return Oe.forEach(t, function(a) { - s = a.call(r, s, i.normalize(), e ? e.status : void 0); - }), i.normalize(), s; -} -function i7(t) { - return !!(t && t.__CANCEL__); -} -function Qu(t, e, r) { - or.call(this, t ?? "canceled", or.ERR_CANCELED, e, r), this.name = "CanceledError"; -} -Oe.inherits(Qu, or, { - __CANCEL__: !0 -}); -function s7(t, e, r) { - const n = r.config.validateStatus; - !r.status || !n || n(r.status) ? t(r) : e(new or( - "Request failed with status code " + r.status, - [or.ERR_BAD_REQUEST, or.ERR_BAD_RESPONSE][Math.floor(r.status / 100) - 4], - r.config, - r.request, - r - )); -} -function pZ(t) { - const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(t); - return e && e[1] || ""; -} -function gZ(t, e) { - t = t || 10; - const r = new Array(t), n = new Array(t); - let i = 0, s = 0, o; - return e = e !== void 0 ? e : 1e3, function(u) { - const l = Date.now(), d = n[s]; - o || (o = l), r[i] = u, n[i] = l; - let p = s, w = 0; - for (; p !== i; ) - w += r[p++], p = p % t; - if (i = (i + 1) % t, i === s && (s = (s + 1) % t), l - o < e) - return; - const _ = d && l - d; - return _ ? Math.round(w * 1e3 / _) : void 0; - }; -} -function mZ(t, e) { - let r = 0, n = 1e3 / e, i, s; - const o = (l, d = Date.now()) => { - r = d, i = null, s && (clearTimeout(s), s = null), t.apply(null, l); - }; - return [(...l) => { - const d = Date.now(), p = d - r; - p >= n ? o(l, d) : (i = l, s || (s = setTimeout(() => { - s = null, o(i); - }, n - p))); - }, () => i && o(i)]; -} -const M0 = (t, e, r = 3) => { - let n = 0; - const i = gZ(50, 250); - return mZ((s) => { - const o = s.loaded, a = s.lengthComputable ? s.total : void 0, u = o - n, l = i(u), d = o <= a; - n = o; - const p = { - loaded: o, - total: a, - progress: a ? o / a : void 0, - bytes: u, - rate: l || void 0, - estimated: l && a && d ? (a - o) / l : void 0, - event: s, - lengthComputable: a != null, - [e ? "download" : "upload"]: !0 - }; - t(p); - }, r); -}, e_ = (t, e) => { - const r = t != null; - return [(n) => e[0]({ - lengthComputable: r, - total: t, - loaded: n - }), e[1]]; -}, t_ = (t) => (...e) => Oe.asap(() => t(...e)), vZ = Jn.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, Jn.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))( - new URL(Jn.origin), - Jn.navigator && /(msie|trident)/i.test(Jn.navigator.userAgent) -) : () => !0, bZ = Jn.hasStandardBrowserEnv ? ( - // Standard browser envs support document.cookie - { - write(t, e, r, n, i, s) { - const o = [t + "=" + encodeURIComponent(e)]; - Oe.isNumber(r) && o.push("expires=" + new Date(r).toGMTString()), Oe.isString(n) && o.push("path=" + n), Oe.isString(i) && o.push("domain=" + i), s === !0 && o.push("secure"), document.cookie = o.join("; "); - }, - read(t) { - const e = document.cookie.match(new RegExp("(^|;\\s*)(" + t + ")=([^;]*)")); - return e ? decodeURIComponent(e[3]) : null; - }, - remove(t) { - this.write(t, "", Date.now() - 864e5); - } - } -) : ( - // Non-standard browser env (web workers, react-native) lack needed support. - { - write() { - }, - read() { - return null; - }, - remove() { - } - } -); -function yZ(t) { - return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t); -} -function wZ(t, e) { - return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t; -} -function o7(t, e) { - return t && !yZ(e) ? wZ(t, e) : e; -} -const r_ = (t) => t instanceof yi ? { ...t } : t; -function Ec(t, e) { - e = e || {}; - const r = {}; - function n(l, d, p, w) { - return Oe.isPlainObject(l) && Oe.isPlainObject(d) ? Oe.merge.call({ caseless: w }, l, d) : Oe.isPlainObject(d) ? Oe.merge({}, d) : Oe.isArray(d) ? d.slice() : d; - } - function i(l, d, p, w) { - if (Oe.isUndefined(d)) { - if (!Oe.isUndefined(l)) - return n(void 0, l, p, w); - } else return n(l, d, p, w); - } - function s(l, d) { - if (!Oe.isUndefined(d)) - return n(void 0, d); - } - function o(l, d) { - if (Oe.isUndefined(d)) { - if (!Oe.isUndefined(l)) - return n(void 0, l); - } else return n(void 0, d); - } - function a(l, d, p) { - if (p in e) - return n(l, d); - if (p in t) - return n(void 0, l); - } - const u = { - url: s, - method: s, - data: s, - baseURL: o, - transformRequest: o, - transformResponse: o, - paramsSerializer: o, - timeout: o, - timeoutMessage: o, - withCredentials: o, - withXSRFToken: o, - adapter: o, - responseType: o, - xsrfCookieName: o, - xsrfHeaderName: o, - onUploadProgress: o, - onDownloadProgress: o, - decompress: o, - maxContentLength: o, - maxBodyLength: o, - beforeRedirect: o, - transport: o, - httpAgent: o, - httpsAgent: o, - cancelToken: o, - socketPath: o, - responseEncoding: o, - validateStatus: a, - headers: (l, d, p) => i(r_(l), r_(d), p, !0) - }; - return Oe.forEach(Object.keys(Object.assign({}, t, e)), function(d) { - const p = u[d] || i, w = p(t[d], e[d], d); - Oe.isUndefined(w) && p !== a || (r[d] = w); - }), r; -} -const a7 = (t) => { - const e = Ec({}, t); - let { data: r, withXSRFToken: n, xsrfHeaderName: i, xsrfCookieName: s, headers: o, auth: a } = e; - e.headers = o = yi.from(o), e.url = t7(o7(e.baseURL, e.url), t.params, t.paramsSerializer), a && o.set( - "Authorization", - "Basic " + btoa((a.username || "") + ":" + (a.password ? unescape(encodeURIComponent(a.password)) : "")) - ); - let u; - if (Oe.isFormData(r)) { - if (Jn.hasStandardBrowserEnv || Jn.hasStandardBrowserWebWorkerEnv) - o.setContentType(void 0); - else if ((u = o.getContentType()) !== !1) { - const [l, ...d] = u ? u.split(";").map((p) => p.trim()).filter(Boolean) : []; - o.setContentType([l || "multipart/form-data", ...d].join("; ")); - } - } - if (Jn.hasStandardBrowserEnv && (n && Oe.isFunction(n) && (n = n(e)), n || n !== !1 && vZ(e.url))) { - const l = i && s && bZ.read(s); - l && o.set(i, l); - } - return e; -}, xZ = typeof XMLHttpRequest < "u", _Z = xZ && function(t) { - return new Promise(function(r, n) { - const i = a7(t); - let s = i.data; - const o = yi.from(i.headers).normalize(); - let { responseType: a, onUploadProgress: u, onDownloadProgress: l } = i, d, p, w, _, P; - function O() { - _ && _(), P && P(), i.cancelToken && i.cancelToken.unsubscribe(d), i.signal && i.signal.removeEventListener("abort", d); - } - let L = new XMLHttpRequest(); - L.open(i.method.toUpperCase(), i.url, !0), L.timeout = i.timeout; - function B() { - if (!L) - return; - const W = yi.from( - "getAllResponseHeaders" in L && L.getAllResponseHeaders() - ), V = { - data: !a || a === "text" || a === "json" ? L.responseText : L.response, - status: L.status, - statusText: L.statusText, - headers: W, - config: t, - request: L - }; - s7(function(R) { - r(R), O(); - }, function(R) { - n(R), O(); - }, V), L = null; - } - "onloadend" in L ? L.onloadend = B : L.onreadystatechange = function() { - !L || L.readyState !== 4 || L.status === 0 && !(L.responseURL && L.responseURL.indexOf("file:") === 0) || setTimeout(B); - }, L.onabort = function() { - L && (n(new or("Request aborted", or.ECONNABORTED, t, L)), L = null); - }, L.onerror = function() { - n(new or("Network Error", or.ERR_NETWORK, t, L)), L = null; - }, L.ontimeout = function() { - let U = i.timeout ? "timeout of " + i.timeout + "ms exceeded" : "timeout exceeded"; - const V = i.transitional || r7; - i.timeoutErrorMessage && (U = i.timeoutErrorMessage), n(new or( - U, - V.clarifyTimeoutError ? or.ETIMEDOUT : or.ECONNABORTED, - t, - L - )), L = null; - }, s === void 0 && o.setContentType(null), "setRequestHeader" in L && Oe.forEach(o.toJSON(), function(U, V) { - L.setRequestHeader(V, U); - }), Oe.isUndefined(i.withCredentials) || (L.withCredentials = !!i.withCredentials), a && a !== "json" && (L.responseType = i.responseType), l && ([w, P] = M0(l, !0), L.addEventListener("progress", w)), u && L.upload && ([p, _] = M0(u), L.upload.addEventListener("progress", p), L.upload.addEventListener("loadend", _)), (i.cancelToken || i.signal) && (d = (W) => { - L && (n(!W || W.type ? new Qu(null, t, L) : W), L.abort(), L = null); - }, i.cancelToken && i.cancelToken.subscribe(d), i.signal && (i.signal.aborted ? d() : i.signal.addEventListener("abort", d))); - const k = pZ(i.url); - if (k && Jn.protocols.indexOf(k) === -1) { - n(new or("Unsupported protocol " + k + ":", or.ERR_BAD_REQUEST, t)); - return; - } - L.send(s || null); - }); -}, EZ = (t, e) => { - const { length: r } = t = t ? t.filter(Boolean) : []; - if (e || r) { - let n = new AbortController(), i; - const s = function(l) { - if (!i) { - i = !0, a(); - const d = l instanceof Error ? l : this.reason; - n.abort(d instanceof or ? d : new Qu(d instanceof Error ? d.message : d)); - } - }; - let o = e && setTimeout(() => { - o = null, s(new or(`timeout ${e} of ms exceeded`, or.ETIMEDOUT)); - }, e); - const a = () => { - t && (o && clearTimeout(o), o = null, t.forEach((l) => { - l.unsubscribe ? l.unsubscribe(s) : l.removeEventListener("abort", s); - }), t = null); - }; - t.forEach((l) => l.addEventListener("abort", s)); - const { signal: u } = n; - return u.unsubscribe = () => Oe.asap(a), u; - } -}, SZ = function* (t, e) { - let r = t.byteLength; - if (r < e) { - yield t; - return; - } - let n = 0, i; - for (; n < r; ) - i = n + e, yield t.slice(n, i), n = i; -}, AZ = async function* (t, e) { - for await (const r of PZ(t)) - yield* SZ(r, e); -}, PZ = async function* (t) { - if (t[Symbol.asyncIterator]) { - yield* t; - return; - } - const e = t.getReader(); - try { - for (; ; ) { - const { done: r, value: n } = await e.read(); - if (r) - break; - yield n; - } - } finally { - await e.cancel(); - } -}, n_ = (t, e, r, n) => { - const i = AZ(t, e); - let s = 0, o, a = (u) => { - o || (o = !0, n && n(u)); - }; - return new ReadableStream({ - async pull(u) { - try { - const { done: l, value: d } = await i.next(); - if (l) { - a(), u.close(); - return; - } - let p = d.byteLength; - if (r) { - let w = s += p; - r(w); - } - u.enqueue(new Uint8Array(d)); - } catch (l) { - throw a(l), l; - } - }, - cancel(u) { - return a(u), i.return(); - } - }, { - highWaterMark: 2 - }); -}, Ip = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", c7 = Ip && typeof ReadableStream == "function", MZ = Ip && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), u7 = (t, ...e) => { - try { - return !!t(...e); - } catch { - return !1; - } -}, IZ = c7 && u7(() => { - let t = !1; - const e = new Request(Jn.origin, { - body: new ReadableStream(), - method: "POST", - get duplex() { - return t = !0, "half"; - } - }).headers.has("Content-Type"); - return t && !e; -}), i_ = 64 * 1024, fv = c7 && u7(() => Oe.isReadableStream(new Response("").body)), I0 = { - stream: fv && ((t) => t.body) -}; -Ip && ((t) => { - ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => { - !I0[e] && (I0[e] = Oe.isFunction(t[e]) ? (r) => r[e]() : (r, n) => { - throw new or(`Response type '${e}' is not supported`, or.ERR_NOT_SUPPORT, n); - }); - }); -})(new Response()); -const CZ = async (t) => { - if (t == null) - return 0; - if (Oe.isBlob(t)) - return t.size; - if (Oe.isSpecCompliantForm(t)) - return (await new Request(Jn.origin, { - method: "POST", - body: t - }).arrayBuffer()).byteLength; - if (Oe.isArrayBufferView(t) || Oe.isArrayBuffer(t)) - return t.byteLength; - if (Oe.isURLSearchParams(t) && (t = t + ""), Oe.isString(t)) - return (await MZ(t)).byteLength; -}, TZ = async (t, e) => { - const r = Oe.toFiniteNumber(t.getContentLength()); - return r ?? CZ(e); -}, RZ = Ip && (async (t) => { - let { - url: e, - method: r, - data: n, - signal: i, - cancelToken: s, - timeout: o, - onDownloadProgress: a, - onUploadProgress: u, - responseType: l, - headers: d, - withCredentials: p = "same-origin", - fetchOptions: w - } = a7(t); - l = l ? (l + "").toLowerCase() : "text"; - let _ = EZ([i, s && s.toAbortSignal()], o), P; - const O = _ && _.unsubscribe && (() => { - _.unsubscribe(); - }); - let L; - try { - if (u && IZ && r !== "get" && r !== "head" && (L = await TZ(d, n)) !== 0) { - let V = new Request(e, { - method: "POST", - body: n, - duplex: "half" - }), Q; - if (Oe.isFormData(n) && (Q = V.headers.get("content-type")) && d.setContentType(Q), V.body) { - const [R, K] = e_( - L, - M0(t_(u)) - ); - n = n_(V.body, i_, R, K); - } - } - Oe.isString(p) || (p = p ? "include" : "omit"); - const B = "credentials" in Request.prototype; - P = new Request(e, { - ...w, - signal: _, - method: r.toUpperCase(), - headers: d.normalize().toJSON(), - body: n, - duplex: "half", - credentials: B ? p : void 0 - }); - let k = await fetch(P); - const W = fv && (l === "stream" || l === "response"); - if (fv && (a || W && O)) { - const V = {}; - ["status", "statusText", "headers"].forEach((ge) => { - V[ge] = k[ge]; - }); - const Q = Oe.toFiniteNumber(k.headers.get("content-length")), [R, K] = a && e_( - Q, - M0(t_(a), !0) - ) || []; - k = new Response( - n_(k.body, i_, R, () => { - K && K(), O && O(); - }), - V - ); - } - l = l || "text"; - let U = await I0[Oe.findKey(I0, l) || "text"](k, t); - return !W && O && O(), await new Promise((V, Q) => { - s7(V, Q, { - data: U, - headers: yi.from(k.headers), - status: k.status, - statusText: k.statusText, - config: t, - request: P - }); - }); - } catch (B) { - throw O && O(), B && B.name === "TypeError" && /fetch/i.test(B.message) ? Object.assign( - new or("Network Error", or.ERR_NETWORK, t, P), - { - cause: B.cause || B - } - ) : or.from(B, B && B.code, t, P); - } -}), lv = { - http: KX, - xhr: _Z, - fetch: RZ -}; -Oe.forEach(lv, (t, e) => { - if (t) { - try { - Object.defineProperty(t, "name", { value: e }); - } catch { - } - Object.defineProperty(t, "adapterName", { value: e }); - } -}); -const s_ = (t) => `- ${t}`, DZ = (t) => Oe.isFunction(t) || t === null || t === !1, f7 = { - getAdapter: (t) => { - t = Oe.isArray(t) ? t : [t]; - const { length: e } = t; - let r, n; - const i = {}; - for (let s = 0; s < e; s++) { - r = t[s]; - let o; - if (n = r, !DZ(r) && (n = lv[(o = String(r)).toLowerCase()], n === void 0)) - throw new or(`Unknown adapter '${o}'`); - if (n) - break; - i[o || "#" + s] = n; - } - if (!n) { - const s = Object.entries(i).map( - ([a, u]) => `adapter ${a} ` + (u === !1 ? "is not supported by the environment" : "is not available in the build") - ); - let o = e ? s.length > 1 ? `since : -` + s.map(s_).join(` -`) : " " + s_(s[0]) : "as no adapter specified"; - throw new or( - "There is no suitable adapter to dispatch the request " + o, - "ERR_NOT_SUPPORT" - ); - } - return n; - }, - adapters: lv -}; -function Hm(t) { - if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted) - throw new Qu(null, t); -} -function o_(t) { - return Hm(t), t.headers = yi.from(t.headers), t.data = Wm.call( - t, - t.transformRequest - ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), f7.getAdapter(t.adapter || gh.adapter)(t).then(function(n) { - return Hm(t), n.data = Wm.call( - t, - t.transformResponse, - n - ), n.headers = yi.from(n.headers), n; - }, function(n) { - return i7(n) || (Hm(t), n && n.response && (n.response.data = Wm.call( - t, - t.transformResponse, - n.response - ), n.response.headers = yi.from(n.response.headers))), Promise.reject(n); - }); -} -const l7 = "1.7.8", Cp = {}; -["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => { - Cp[t] = function(n) { - return typeof n === t || "a" + (e < 1 ? "n " : " ") + t; - }; -}); -const a_ = {}; -Cp.transitional = function(e, r, n) { - function i(s, o) { - return "[Axios v" + l7 + "] Transitional option '" + s + "'" + o + (n ? ". " + n : ""); - } - return (s, o, a) => { - if (e === !1) - throw new or( - i(o, " has been removed" + (r ? " in " + r : "")), - or.ERR_DEPRECATED - ); - return r && !a_[o] && (a_[o] = !0, console.warn( - i( - o, - " has been deprecated since v" + r + " and will be removed in the near future" - ) - )), e ? e(s, o, a) : !0; - }; -}; -Cp.spelling = function(e) { - return (r, n) => (console.warn(`${n} is likely a misspelling of ${e}`), !0); -}; -function OZ(t, e, r) { - if (typeof t != "object") - throw new or("options must be an object", or.ERR_BAD_OPTION_VALUE); - const n = Object.keys(t); - let i = n.length; - for (; i-- > 0; ) { - const s = n[i], o = e[s]; - if (o) { - const a = t[s], u = a === void 0 || o(a, s, t); - if (u !== !0) - throw new or("option " + s + " must be " + u, or.ERR_BAD_OPTION_VALUE); - continue; - } - if (r !== !0) - throw new or("Unknown option " + s, or.ERR_BAD_OPTION); - } -} -const Jd = { - assertOptions: OZ, - validators: Cp -}, Us = Jd.validators; -let pc = class { - constructor(e) { - this.defaults = e, this.interceptors = { - request: new Z6(), - response: new Z6() - }; - } - /** - * Dispatch a request - * - * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) - * @param {?Object} config - * - * @returns {Promise} The Promise to be fulfilled - */ - async request(e, r) { - try { - return await this._request(e, r); - } catch (n) { - if (n instanceof Error) { - let i = {}; - Error.captureStackTrace ? Error.captureStackTrace(i) : i = new Error(); - const s = i.stack ? i.stack.replace(/^.+\n/, "") : ""; - try { - n.stack ? s && !String(n.stack).endsWith(s.replace(/^.+\n.+\n/, "")) && (n.stack += ` -` + s) : n.stack = s; - } catch { - } - } - throw n; - } - } - _request(e, r) { - typeof e == "string" ? (r = r || {}, r.url = e) : r = e || {}, r = Ec(this.defaults, r); - const { transitional: n, paramsSerializer: i, headers: s } = r; - n !== void 0 && Jd.assertOptions(n, { - silentJSONParsing: Us.transitional(Us.boolean), - forcedJSONParsing: Us.transitional(Us.boolean), - clarifyTimeoutError: Us.transitional(Us.boolean) - }, !1), i != null && (Oe.isFunction(i) ? r.paramsSerializer = { - serialize: i - } : Jd.assertOptions(i, { - encode: Us.function, - serialize: Us.function - }, !0)), Jd.assertOptions(r, { - baseUrl: Us.spelling("baseURL"), - withXsrfToken: Us.spelling("withXSRFToken") - }, !0), r.method = (r.method || this.defaults.method || "get").toLowerCase(); - let o = s && Oe.merge( - s.common, - s[r.method] - ); - s && Oe.forEach( - ["delete", "get", "head", "post", "put", "patch", "common"], - (P) => { - delete s[P]; - } - ), r.headers = yi.concat(o, s); - const a = []; - let u = !0; - this.interceptors.request.forEach(function(O) { - typeof O.runWhen == "function" && O.runWhen(r) === !1 || (u = u && O.synchronous, a.unshift(O.fulfilled, O.rejected)); - }); - const l = []; - this.interceptors.response.forEach(function(O) { - l.push(O.fulfilled, O.rejected); - }); - let d, p = 0, w; - if (!u) { - const P = [o_.bind(this), void 0]; - for (P.unshift.apply(P, a), P.push.apply(P, l), w = P.length, d = Promise.resolve(r); p < w; ) - d = d.then(P[p++], P[p++]); - return d; - } - w = a.length; - let _ = r; - for (p = 0; p < w; ) { - const P = a[p++], O = a[p++]; - try { - _ = P(_); - } catch (L) { - O.call(this, L); - break; - } - } - try { - d = o_.call(this, _); - } catch (P) { - return Promise.reject(P); - } - for (p = 0, w = l.length; p < w; ) - d = d.then(l[p++], l[p++]); - return d; - } - getUri(e) { - e = Ec(this.defaults, e); - const r = o7(e.baseURL, e.url); - return t7(r, e.params, e.paramsSerializer); - } -}; -Oe.forEach(["delete", "get", "head", "options"], function(e) { - pc.prototype[e] = function(r, n) { - return this.request(Ec(n || {}, { - method: e, - url: r, - data: (n || {}).data - })); - }; -}); -Oe.forEach(["post", "put", "patch"], function(e) { - function r(n) { - return function(s, o, a) { - return this.request(Ec(a || {}, { - method: e, - headers: n ? { - "Content-Type": "multipart/form-data" - } : {}, - url: s, - data: o - })); - }; - } - pc.prototype[e] = r(), pc.prototype[e + "Form"] = r(!0); -}); -let NZ = class h7 { - constructor(e) { - if (typeof e != "function") - throw new TypeError("executor must be a function."); - let r; - this.promise = new Promise(function(s) { - r = s; - }); - const n = this; - this.promise.then((i) => { - if (!n._listeners) return; - let s = n._listeners.length; - for (; s-- > 0; ) - n._listeners[s](i); - n._listeners = null; - }), this.promise.then = (i) => { - let s; - const o = new Promise((a) => { - n.subscribe(a), s = a; - }).then(i); - return o.cancel = function() { - n.unsubscribe(s); - }, o; - }, e(function(s, o, a) { - n.reason || (n.reason = new Qu(s, o, a), r(n.reason)); - }); - } - /** - * Throws a `CanceledError` if cancellation has been requested. - */ - throwIfRequested() { - if (this.reason) - throw this.reason; - } - /** - * Subscribe to the cancel signal - */ - subscribe(e) { - if (this.reason) { - e(this.reason); - return; - } - this._listeners ? this._listeners.push(e) : this._listeners = [e]; - } - /** - * Unsubscribe from the cancel signal - */ - unsubscribe(e) { - if (!this._listeners) - return; - const r = this._listeners.indexOf(e); - r !== -1 && this._listeners.splice(r, 1); - } - toAbortSignal() { - const e = new AbortController(), r = (n) => { - e.abort(n); - }; - return this.subscribe(r), e.signal.unsubscribe = () => this.unsubscribe(r), e.signal; - } - /** - * Returns an object that contains a new `CancelToken` and a function that, when called, - * cancels the `CancelToken`. - */ - static source() { - let e; - return { - token: new h7(function(i) { - e = i; - }), - cancel: e - }; - } -}; -function LZ(t) { - return function(r) { - return t.apply(null, r); - }; -} -function kZ(t) { - return Oe.isObject(t) && t.isAxiosError === !0; -} -const hv = { - Continue: 100, - SwitchingProtocols: 101, - Processing: 102, - EarlyHints: 103, - Ok: 200, - Created: 201, - Accepted: 202, - NonAuthoritativeInformation: 203, - NoContent: 204, - ResetContent: 205, - PartialContent: 206, - MultiStatus: 207, - AlreadyReported: 208, - ImUsed: 226, - MultipleChoices: 300, - MovedPermanently: 301, - Found: 302, - SeeOther: 303, - NotModified: 304, - UseProxy: 305, - Unused: 306, - TemporaryRedirect: 307, - PermanentRedirect: 308, - BadRequest: 400, - Unauthorized: 401, - PaymentRequired: 402, - Forbidden: 403, - NotFound: 404, - MethodNotAllowed: 405, - NotAcceptable: 406, - ProxyAuthenticationRequired: 407, - RequestTimeout: 408, - Conflict: 409, - Gone: 410, - LengthRequired: 411, - PreconditionFailed: 412, - PayloadTooLarge: 413, - UriTooLong: 414, - UnsupportedMediaType: 415, - RangeNotSatisfiable: 416, - ExpectationFailed: 417, - ImATeapot: 418, - MisdirectedRequest: 421, - UnprocessableEntity: 422, - Locked: 423, - FailedDependency: 424, - TooEarly: 425, - UpgradeRequired: 426, - PreconditionRequired: 428, - TooManyRequests: 429, - RequestHeaderFieldsTooLarge: 431, - UnavailableForLegalReasons: 451, - InternalServerError: 500, - NotImplemented: 501, - BadGateway: 502, - ServiceUnavailable: 503, - GatewayTimeout: 504, - HttpVersionNotSupported: 505, - VariantAlsoNegotiates: 506, - InsufficientStorage: 507, - LoopDetected: 508, - NotExtended: 510, - NetworkAuthenticationRequired: 511 -}; -Object.entries(hv).forEach(([t, e]) => { - hv[e] = t; -}); -function d7(t) { - const e = new pc(t), r = zS(pc.prototype.request, e); - return Oe.extend(r, pc.prototype, e, { allOwnKeys: !0 }), Oe.extend(r, e, null, { allOwnKeys: !0 }), r.create = function(i) { - return d7(Ec(t, i)); - }, r; -} -const mn = d7(gh); -mn.Axios = pc; -mn.CanceledError = Qu; -mn.CancelToken = NZ; -mn.isCancel = i7; -mn.VERSION = l7; -mn.toFormData = Mp; -mn.AxiosError = or; -mn.Cancel = mn.CanceledError; -mn.all = function(e) { - return Promise.all(e); -}; -mn.spread = LZ; -mn.isAxiosError = kZ; -mn.mergeConfig = Ec; -mn.AxiosHeaders = yi; -mn.formToJSON = (t) => n7(Oe.isHTMLForm(t) ? new FormData(t) : t); -mn.getAdapter = f7.getAdapter; -mn.HttpStatusCode = hv; -mn.default = mn; -const { - Axios: joe, - AxiosError: p7, - CanceledError: Uoe, - isCancel: qoe, - CancelToken: zoe, - VERSION: Woe, - all: Hoe, - Cancel: Koe, - isAxiosError: Voe, - spread: Goe, - toFormData: Yoe, - AxiosHeaders: Joe, - HttpStatusCode: Xoe, - formToJSON: Zoe, - getAdapter: Qoe, - mergeConfig: eae -} = mn, g7 = mn.create({ - timeout: 6e4, - headers: { - "Content-Type": "application/json", - token: localStorage.getItem("auth") - } -}); -function $Z(t) { - var e, r, n; - if (((e = t.data) == null ? void 0 : e.success) !== !0) { - const i = new p7( - (r = t.data) == null ? void 0 : r.errorMessage, - (n = t.data) == null ? void 0 : n.errorCode, - t.config, - t.request, - t - ); - return Promise.reject(i); - } else - return t; -} -function BZ(t) { - var r; - console.log(t); - const e = (r = t.response) == null ? void 0 : r.data; - if (e) { - console.log(e, "responseData"); - const n = new p7( - e.errorMessage, - t.code, - t.config, - t.request, - t.response - ); - return Promise.reject(n); - } else - return Promise.reject(t); -} -g7.interceptors.response.use( - $Z, - BZ -); -class FZ { - constructor(e) { - vs(this, "_apiBase", ""); - this.request = e; - } - setApiBase(e) { - this._apiBase = e || ""; - } - async getNonce(e) { - const { data: r } = await this.request.post(`${this._apiBase}/api/v2/user/nonce`, e); - return r.data; - } - async getEmailCode(e, r) { - const { data: n } = await this.request.post(`${this._apiBase}/api/v2/user/get_code`, e, { - headers: { "Captcha-Param": r } - }); - return n.data; - } - async emailLogin(e) { - return (await this.request.post(`${this._apiBase}/api/v2/user/login`, e)).data; - } - async walletLogin(e) { - return e.account_enum === "C" ? (await this.request.post(`${this._apiBase}/api/v2/user/login`, e)).data : (await this.request.post(`${this._apiBase}/api/v2/business/login`, e)).data; - } - async tonLogin(e) { - return (await this.request.post(`${this._apiBase}/api/v2/user/login`, e)).data; - } - async bindEmail(e) { - return (await this.request.post("/api/v2/user/account/bind", e)).data; - } - async bindTonWallet(e) { - return (await this.request.post("/api/v2/user/account/bind", e)).data; - } - async bindEvmWallet(e) { - return (await this.request.post("/api/v2/user/account/bind", e)).data; - } -} -const ka = new FZ(g7), jZ = { - projectId: "7a4434fefbcc9af474fb5c995e47d286", - metadata: { - name: "codatta", - description: "codatta", - url: "https://codatta.io/", - icons: ["https://avatars.githubusercontent.com/u/171659315"] - } -}, UZ = oX({ - appName: "codatta", - appLogoUrl: "https://avatars.githubusercontent.com/u/171659315" -}), m7 = Ta({ - saveLastUsedWallet: () => { - }, - lastUsedWallet: null, - wallets: [], - initialized: !1, - featuredWallets: [], - chains: [] -}); -function Tp() { - return Tn(m7); -} -function tae(t) { - const { apiBaseUrl: e } = t, [r, n] = Yt([]), [i, s] = Yt([]), [o, a] = Yt(null), [u, l] = Yt(!1), [d, p] = Yt([]), w = (O) => { - a(O); - const B = { - provider: O.provider instanceof J1 ? "UniversalProvider" : "EIP1193Provider", - key: O.key, - timestamp: Date.now() - }; - localStorage.setItem("xn-last-used-info", JSON.stringify(B)); - }; - function _(O) { - const L = O.find((B) => { - var k; - return ((k = B.config) == null ? void 0 : k.name) === t.singleWalletName; - }); - if (L) - s([L]); - else { - const B = O.filter((U) => U.featured || U.installed), k = O.filter((U) => !U.featured && !U.installed), W = [...B, ...k]; - n(W), s(B); - } - } - async function P() { - const O = [], L = /* @__PURE__ */ new Map(); - mD.forEach((k) => { - const W = new yu(k); - k.name === "Coinbase Wallet" && W.EIP6963Detected({ - info: { name: "Coinbase Wallet", uuid: "coinbase", icon: k.image, rdns: "coinbase" }, - provider: UZ.getProvider() - }), L.set(W.key, W), O.push(W); - }), (await xY()).forEach((k) => { - const W = L.get(k.info.name); - if (W) - W.EIP6963Detected(k); - else { - const U = new yu(k); - L.set(U.key, U), O.push(U); - } - }); - try { - const k = JSON.parse(localStorage.getItem("xn-last-used-info") || "{}"), W = L.get(k.key); - if (W && k.provider === "EIP1193Provider" && W.installed) - a(W); - else if (k.provider === "UniversalProvider") { - const U = await J1.init(jZ); - if (U.session) { - const V = new yu(U); - a(V), console.log("Restored UniversalProvider for wallet:", V.key); - } - } - } catch (k) { - console.log(k); - } - t.chains && p(t.chains), _(O), l(!0); - } - return Dn(() => { - P(), ka.setApiBase(e); - }, []), /* @__PURE__ */ le.jsx( - m7.Provider, - { - value: { - saveLastUsedWallet: w, - wallets: r, - initialized: u, - lastUsedWallet: o, - featuredWallets: i, - chains: d - }, - children: t.children - } - ); -} -/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */ -const qZ = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), v7 = (...t) => t.filter((e, r, n) => !!e && e.trim() !== "" && n.indexOf(e) === r).join(" ").trim(); -/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */ -var zZ = { - xmlns: "http://www.w3.org/2000/svg", - width: 24, - height: 24, - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - strokeWidth: 2, - strokeLinecap: "round", - strokeLinejoin: "round" -}; -/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */ -const WZ = Dv( - ({ - color: t = "currentColor", - size: e = 24, - strokeWidth: r = 2, - absoluteStrokeWidth: n, - className: i = "", - children: s, - iconNode: o, - ...a - }, u) => e0( - "svg", - { - ref: u, - ...zZ, - width: e, - height: e, - stroke: t, - strokeWidth: n ? Number(r) * 24 / Number(e) : r, - className: v7("lucide", i), - ...a - }, - [ - ...o.map(([l, d]) => e0(l, d)), - ...Array.isArray(s) ? s : [s] - ] - ) -); -/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */ -const ls = (t, e) => { - const r = Dv( - ({ className: n, ...i }, s) => e0(WZ, { - ref: s, - iconNode: e, - className: v7(`lucide-${qZ(t)}`, n), - ...i - }) - ); - return r.displayName = `${t}`, r; -}; -/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */ -const HZ = ls("ArrowLeft", [ - ["path", { d: "m12 19-7-7 7-7", key: "1l729n" }], - ["path", { d: "M19 12H5", key: "x3x0zl" }] -]); -/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */ -const b7 = ls("ArrowRight", [ - ["path", { d: "M5 12h14", key: "1ays0h" }], - ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }] -]); -/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */ -const KZ = ls("ChevronRight", [ - ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }] -]); -/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */ -const VZ = ls("CircleCheckBig", [ - ["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }], - ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }] -]); -/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */ -const GZ = ls("Download", [ - ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }], - ["polyline", { points: "7 10 12 15 17 10", key: "2ggqvy" }], - ["line", { x1: "12", x2: "12", y1: "15", y2: "3", key: "1vk2je" }] -]); -/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */ -const YZ = ls("Globe", [ - ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }], - ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }], - ["path", { d: "M2 12h20", key: "9i4pu4" }] -]); -/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */ -const y7 = ls("Laptop", [ - [ - "path", - { - d: "M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16", - key: "tarvll" - } - ] -]); -/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */ -const JZ = ls("Link2", [ - ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }], - ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }], - ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }] -]); -/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */ -const Sc = ls("LoaderCircle", [ - ["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }] -]); -/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */ -const XZ = ls("Mail", [ - ["rect", { width: "20", height: "16", x: "2", y: "4", rx: "2", key: "18n3k1" }], - ["path", { d: "m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7", key: "1ocrg3" }] -]); -/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */ -const w7 = ls("Search", [ - ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }], - ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }] -]); -/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */ -const ZZ = ls("UserRoundCheck", [ - ["path", { d: "M2 21a8 8 0 0 1 13.292-6", key: "bjp14o" }], - ["circle", { cx: "10", cy: "8", r: "5", key: "o932ke" }], - ["path", { d: "m16 19 2 2 4-4", key: "1b14m6" }] -]), c_ = /* @__PURE__ */ new Set(); -function Rp(t, e, r) { - t || c_.has(e) || (console.warn(e), c_.add(e)); -} -function QZ(t) { - if (typeof Proxy > "u") - return t; - const e = /* @__PURE__ */ new Map(), r = (...n) => (process.env.NODE_ENV !== "production" && Rp(!1, "motion() is deprecated. Use motion.create() instead."), t(...n)); - return new Proxy(r, { - /** - * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc. - * The prop name is passed through as `key` and we can use that to generate a `motion` - * DOM component with that name. - */ - get: (n, i) => i === "create" ? t : (e.has(i) || e.set(i, t(i)), e.get(i)) - }); -} -function Dp(t) { - return t !== null && typeof t == "object" && typeof t.start == "function"; -} -const dv = (t) => Array.isArray(t); -function x7(t, e) { - if (!Array.isArray(e)) - return !1; - const r = e.length; - if (r !== t.length) - return !1; - for (let n = 0; n < r; n++) - if (e[n] !== t[n]) - return !1; - return !0; -} -function Fl(t) { - return typeof t == "string" || Array.isArray(t); -} -function u_(t) { - const e = [{}, {}]; - return t == null || t.values.forEach((r, n) => { - e[0][n] = r.get(), e[1][n] = r.getVelocity(); - }), e; -} -function qb(t, e, r, n) { - if (typeof e == "function") { - const [i, s] = u_(n); - e = e(r !== void 0 ? r : t.custom, i, s); - } - if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") { - const [i, s] = u_(n); - e = e(r !== void 0 ? r : t.custom, i, s); - } - return e; -} -function Op(t, e, r) { - const n = t.getProps(); - return qb(n, e, r !== void 0 ? r : n.custom, t); -} -const zb = [ - "animate", - "whileInView", - "whileFocus", - "whileHover", - "whileTap", - "whileDrag", - "exit" -], Wb = ["initial", ...zb], mh = [ - "transformPerspective", - "x", - "y", - "z", - "translateX", - "translateY", - "translateZ", - "scale", - "scaleX", - "scaleY", - "rotate", - "rotateX", - "rotateY", - "rotateZ", - "skew", - "skewX", - "skewY" -], Lc = new Set(mh), Js = (t) => t * 1e3, No = (t) => t / 1e3, eQ = { - type: "spring", - stiffness: 500, - damping: 25, - restSpeed: 10 -}, tQ = (t) => ({ - type: "spring", - stiffness: 550, - damping: t === 0 ? 2 * Math.sqrt(550) : 30, - restSpeed: 10 -}), rQ = { - type: "keyframes", - duration: 0.8 -}, nQ = { - type: "keyframes", - ease: [0.25, 0.1, 0.35, 1], - duration: 0.3 -}, iQ = (t, { keyframes: e }) => e.length > 2 ? rQ : Lc.has(t) ? t.startsWith("scale") ? tQ(e[1]) : eQ : nQ; -function Hb(t, e) { - return t ? t[e] || t.default || t : void 0; -} -const sQ = { - useManualTiming: !1 -}, oQ = (t) => t !== null; -function Np(t, { repeat: e, repeatType: r = "loop" }, n) { - const i = t.filter(oQ), s = e && r !== "loop" && e % 2 === 1 ? 0 : i.length - 1; - return !s || n === void 0 ? i[s] : n; -} -const Un = (t) => t; -function aQ(t) { - let e = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), n = !1, i = !1; - const s = /* @__PURE__ */ new WeakSet(); - let o = { - delta: 0, - timestamp: 0, - isProcessing: !1 - }; - function a(l) { - s.has(l) && (u.schedule(l), t()), l(o); - } - const u = { - /** - * Schedule a process to run on the next frame. - */ - schedule: (l, d = !1, p = !1) => { - const _ = p && n ? e : r; - return d && s.add(l), _.has(l) || _.add(l), l; - }, - /** - * Cancel the provided callback from running on the next frame. - */ - cancel: (l) => { - r.delete(l), s.delete(l); - }, - /** - * Execute all schedule callbacks. - */ - process: (l) => { - if (o = l, n) { - i = !0; - return; - } - n = !0, [e, r] = [r, e], r.clear(), e.forEach(a), n = !1, i && (i = !1, u.process(l)); - } - }; - return u; -} -const Pd = [ - "read", - // Read - "resolveKeyframes", - // Write/Read/Write/Read - "update", - // Compute - "preRender", - // Compute - "render", - // Write - "postRender" - // Compute -], cQ = 40; -function _7(t, e) { - let r = !1, n = !0; - const i = { - delta: 0, - timestamp: 0, - isProcessing: !1 - }, s = () => r = !0, o = Pd.reduce((B, k) => (B[k] = aQ(s), B), {}), { read: a, resolveKeyframes: u, update: l, preRender: d, render: p, postRender: w } = o, _ = () => { - const B = performance.now(); - r = !1, i.delta = n ? 1e3 / 60 : Math.max(Math.min(B - i.timestamp, cQ), 1), i.timestamp = B, i.isProcessing = !0, a.process(i), u.process(i), l.process(i), d.process(i), p.process(i), w.process(i), i.isProcessing = !1, r && e && (n = !1, t(_)); - }, P = () => { - r = !0, n = !0, i.isProcessing || t(_); - }; - return { schedule: Pd.reduce((B, k) => { - const W = o[k]; - return B[k] = (U, V = !1, Q = !1) => (r || P(), W.schedule(U, V, Q)), B; - }, {}), cancel: (B) => { - for (let k = 0; k < Pd.length; k++) - o[Pd[k]].cancel(B); - }, state: i, steps: o }; -} -const { schedule: Lr, cancel: Pa, state: Fn, steps: Km } = _7(typeof requestAnimationFrame < "u" ? requestAnimationFrame : Un, !0), E7 = (t, e, r) => (((1 - 3 * r + 3 * e) * t + (3 * r - 6 * e)) * t + 3 * e) * t, uQ = 1e-7, fQ = 12; -function lQ(t, e, r, n, i) { - let s, o, a = 0; - do - o = e + (r - e) / 2, s = E7(o, n, i) - t, s > 0 ? r = o : e = o; - while (Math.abs(s) > uQ && ++a < fQ); - return o; -} -function vh(t, e, r, n) { - if (t === e && r === n) - return Un; - const i = (s) => lQ(s, 0, 1, t, r); - return (s) => s === 0 || s === 1 ? s : E7(i(s), e, n); -} -const S7 = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, A7 = (t) => (e) => 1 - t(1 - e), P7 = /* @__PURE__ */ vh(0.33, 1.53, 0.69, 0.99), Kb = /* @__PURE__ */ A7(P7), M7 = /* @__PURE__ */ S7(Kb), I7 = (t) => (t *= 2) < 1 ? 0.5 * Kb(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Vb = (t) => 1 - Math.sin(Math.acos(t)), C7 = A7(Vb), T7 = S7(Vb), R7 = (t) => /^0[^.\s]+$/u.test(t); -function hQ(t) { - return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || R7(t) : !0; -} -let ef = Un, Wo = Un; -process.env.NODE_ENV !== "production" && (ef = (t, e) => { - !t && typeof console < "u" && console.warn(e); -}, Wo = (t, e) => { - if (!t) - throw new Error(e); -}); -const D7 = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), O7 = (t) => (e) => typeof e == "string" && e.startsWith(t), N7 = /* @__PURE__ */ O7("--"), dQ = /* @__PURE__ */ O7("var(--"), Gb = (t) => dQ(t) ? pQ.test(t.split("/*")[0].trim()) : !1, pQ = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, gQ = ( - // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words - /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u -); -function mQ(t) { - const e = gQ.exec(t); - if (!e) - return [,]; - const [, r, n, i] = e; - return [`--${r ?? n}`, i]; -} -const vQ = 4; -function L7(t, e, r = 1) { - Wo(r <= vQ, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`); - const [n, i] = mQ(t); - if (!n) - return; - const s = window.getComputedStyle(e).getPropertyValue(n); - if (s) { - const o = s.trim(); - return D7(o) ? parseFloat(o) : o; - } - return Gb(i) ? L7(i, e, r + 1) : i; -} -const Ma = (t, e, r) => r > e ? e : r < t ? t : r, tf = { - test: (t) => typeof t == "number", - parse: parseFloat, - transform: (t) => t -}, jl = { - ...tf, - transform: (t) => Ma(0, 1, t) -}, Md = { - ...tf, - default: 1 -}, bh = (t) => ({ - test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1, - parse: parseFloat, - transform: (e) => `${e}${t}` -}), ca = /* @__PURE__ */ bh("deg"), Xs = /* @__PURE__ */ bh("%"), Vt = /* @__PURE__ */ bh("px"), bQ = /* @__PURE__ */ bh("vh"), yQ = /* @__PURE__ */ bh("vw"), f_ = { - ...Xs, - parse: (t) => Xs.parse(t) / 100, - transform: (t) => Xs.transform(t * 100) -}, wQ = /* @__PURE__ */ new Set([ - "width", - "height", - "top", - "left", - "right", - "bottom", - "x", - "y", - "translateX", - "translateY" -]), l_ = (t) => t === tf || t === Vt, h_ = (t, e) => parseFloat(t.split(", ")[e]), d_ = (t, e) => (r, { transform: n }) => { - if (n === "none" || !n) - return 0; - const i = n.match(/^matrix3d\((.+)\)$/u); - if (i) - return h_(i[1], e); - { - const s = n.match(/^matrix\((.+)\)$/u); - return s ? h_(s[1], t) : 0; - } -}, xQ = /* @__PURE__ */ new Set(["x", "y", "z"]), _Q = mh.filter((t) => !xQ.has(t)); -function EQ(t) { - const e = []; - return _Q.forEach((r) => { - const n = t.getValue(r); - n !== void 0 && (e.push([r, n.get()]), n.set(r.startsWith("scale") ? 1 : 0)); - }), e; -} -const $u = { - // Dimensions - width: ({ x: t }, { paddingLeft: e = "0", paddingRight: r = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(r), - height: ({ y: t }, { paddingTop: e = "0", paddingBottom: r = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(r), - top: (t, { top: e }) => parseFloat(e), - left: (t, { left: e }) => parseFloat(e), - bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min), - right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min), - // Transform - x: d_(4, 13), - y: d_(5, 14) -}; -$u.translateX = $u.x; -$u.translateY = $u.y; -const k7 = (t) => (e) => e.test(t), SQ = { - test: (t) => t === "auto", - parse: (t) => t -}, $7 = [tf, Vt, Xs, ca, yQ, bQ, SQ], p_ = (t) => $7.find(k7(t)), gc = /* @__PURE__ */ new Set(); -let pv = !1, gv = !1; -function B7() { - if (gv) { - const t = Array.from(gc).filter((n) => n.needsMeasurement), e = new Set(t.map((n) => n.element)), r = /* @__PURE__ */ new Map(); - e.forEach((n) => { - const i = EQ(n); - i.length && (r.set(n, i), n.render()); - }), t.forEach((n) => n.measureInitialState()), e.forEach((n) => { - n.render(); - const i = r.get(n); - i && i.forEach(([s, o]) => { - var a; - (a = n.getValue(s)) === null || a === void 0 || a.set(o); - }); - }), t.forEach((n) => n.measureEndState()), t.forEach((n) => { - n.suspendedScrollY !== void 0 && window.scrollTo(0, n.suspendedScrollY); - }); - } - gv = !1, pv = !1, gc.forEach((t) => t.complete()), gc.clear(); -} -function F7() { - gc.forEach((t) => { - t.readKeyframes(), t.needsMeasurement && (gv = !0); - }); -} -function AQ() { - F7(), B7(); -} -class Yb { - constructor(e, r, n, i, s, o = !1) { - this.isComplete = !1, this.isAsync = !1, this.needsMeasurement = !1, this.isScheduled = !1, this.unresolvedKeyframes = [...e], this.onComplete = r, this.name = n, this.motionValue = i, this.element = s, this.isAsync = o; - } - scheduleResolve() { - this.isScheduled = !0, this.isAsync ? (gc.add(this), pv || (pv = !0, Lr.read(F7), Lr.resolveKeyframes(B7))) : (this.readKeyframes(), this.complete()); - } - readKeyframes() { - const { unresolvedKeyframes: e, name: r, element: n, motionValue: i } = this; - for (let s = 0; s < e.length; s++) - if (e[s] === null) - if (s === 0) { - const o = i == null ? void 0 : i.get(), a = e[e.length - 1]; - if (o !== void 0) - e[0] = o; - else if (n && r) { - const u = n.readValue(r, a); - u != null && (e[0] = u); - } - e[0] === void 0 && (e[0] = a), i && o === void 0 && i.set(e[0]); - } else - e[s] = e[s - 1]; - } - setFinalKeyframe() { - } - measureInitialState() { - } - renderEndStyles() { - } - measureEndState() { - } - complete() { - this.isComplete = !0, this.onComplete(this.unresolvedKeyframes, this.finalKeyframe), gc.delete(this); - } - cancel() { - this.isComplete || (this.isScheduled = !1, gc.delete(this)); - } - resume() { - this.isComplete || this.scheduleResolve(); - } -} -const nl = (t) => Math.round(t * 1e5) / 1e5, Jb = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; -function PQ(t) { - return t == null; -} -const MQ = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, Xb = (t, e) => (r) => !!(typeof r == "string" && MQ.test(r) && r.startsWith(t) || e && !PQ(r) && Object.prototype.hasOwnProperty.call(r, e)), j7 = (t, e, r) => (n) => { - if (typeof n != "string") - return n; - const [i, s, o, a] = n.match(Jb); - return { - [t]: parseFloat(i), - [e]: parseFloat(s), - [r]: parseFloat(o), - alpha: a !== void 0 ? parseFloat(a) : 1 - }; -}, IQ = (t) => Ma(0, 255, t), Vm = { - ...tf, - transform: (t) => Math.round(IQ(t)) -}, hc = { - test: /* @__PURE__ */ Xb("rgb", "red"), - parse: /* @__PURE__ */ j7("red", "green", "blue"), - transform: ({ red: t, green: e, blue: r, alpha: n = 1 }) => "rgba(" + Vm.transform(t) + ", " + Vm.transform(e) + ", " + Vm.transform(r) + ", " + nl(jl.transform(n)) + ")" -}; -function CQ(t) { - let e = "", r = "", n = "", i = ""; - return t.length > 5 ? (e = t.substring(1, 3), r = t.substring(3, 5), n = t.substring(5, 7), i = t.substring(7, 9)) : (e = t.substring(1, 2), r = t.substring(2, 3), n = t.substring(3, 4), i = t.substring(4, 5), e += e, r += r, n += n, i += i), { - red: parseInt(e, 16), - green: parseInt(r, 16), - blue: parseInt(n, 16), - alpha: i ? parseInt(i, 16) / 255 : 1 - }; -} -const mv = { - test: /* @__PURE__ */ Xb("#"), - parse: CQ, - transform: hc.transform -}, fu = { - test: /* @__PURE__ */ Xb("hsl", "hue"), - parse: /* @__PURE__ */ j7("hue", "saturation", "lightness"), - transform: ({ hue: t, saturation: e, lightness: r, alpha: n = 1 }) => "hsla(" + Math.round(t) + ", " + Xs.transform(nl(e)) + ", " + Xs.transform(nl(r)) + ", " + nl(jl.transform(n)) + ")" -}, Yn = { - test: (t) => hc.test(t) || mv.test(t) || fu.test(t), - parse: (t) => hc.test(t) ? hc.parse(t) : fu.test(t) ? fu.parse(t) : mv.parse(t), - transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? hc.transform(t) : fu.transform(t) -}, TQ = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu; -function RQ(t) { - var e, r; - return isNaN(t) && typeof t == "string" && (((e = t.match(Jb)) === null || e === void 0 ? void 0 : e.length) || 0) + (((r = t.match(TQ)) === null || r === void 0 ? void 0 : r.length) || 0) > 0; -} -const U7 = "number", q7 = "color", DQ = "var", OQ = "var(", g_ = "${}", NQ = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; -function Ul(t) { - const e = t.toString(), r = [], n = { - color: [], - number: [], - var: [] - }, i = []; - let s = 0; - const a = e.replace(NQ, (u) => (Yn.test(u) ? (n.color.push(s), i.push(q7), r.push(Yn.parse(u))) : u.startsWith(OQ) ? (n.var.push(s), i.push(DQ), r.push(u)) : (n.number.push(s), i.push(U7), r.push(parseFloat(u))), ++s, g_)).split(g_); - return { values: r, split: a, indexes: n, types: i }; -} -function z7(t) { - return Ul(t).values; -} -function W7(t) { - const { split: e, types: r } = Ul(t), n = e.length; - return (i) => { - let s = ""; - for (let o = 0; o < n; o++) - if (s += e[o], i[o] !== void 0) { - const a = r[o]; - a === U7 ? s += nl(i[o]) : a === q7 ? s += Yn.transform(i[o]) : s += i[o]; - } - return s; - }; -} -const LQ = (t) => typeof t == "number" ? 0 : t; -function kQ(t) { - const e = z7(t); - return W7(t)(e.map(LQ)); -} -const Ia = { - test: RQ, - parse: z7, - createTransformer: W7, - getAnimatableNone: kQ -}, $Q = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]); -function BQ(t) { - const [e, r] = t.slice(0, -1).split("("); - if (e === "drop-shadow") - return t; - const [n] = r.match(Jb) || []; - if (!n) - return t; - const i = r.replace(n, ""); - let s = $Q.has(e) ? 1 : 0; - return n !== r && (s *= 100), e + "(" + s + i + ")"; -} -const FQ = /\b([a-z-]*)\(.*?\)/gu, vv = { - ...Ia, - getAnimatableNone: (t) => { - const e = t.match(FQ); - return e ? e.map(BQ).join(" ") : t; - } -}, jQ = { - // Border props - borderWidth: Vt, - borderTopWidth: Vt, - borderRightWidth: Vt, - borderBottomWidth: Vt, - borderLeftWidth: Vt, - borderRadius: Vt, - radius: Vt, - borderTopLeftRadius: Vt, - borderTopRightRadius: Vt, - borderBottomRightRadius: Vt, - borderBottomLeftRadius: Vt, - // Positioning props - width: Vt, - maxWidth: Vt, - height: Vt, - maxHeight: Vt, - top: Vt, - right: Vt, - bottom: Vt, - left: Vt, - // Spacing props - padding: Vt, - paddingTop: Vt, - paddingRight: Vt, - paddingBottom: Vt, - paddingLeft: Vt, - margin: Vt, - marginTop: Vt, - marginRight: Vt, - marginBottom: Vt, - marginLeft: Vt, - // Misc - backgroundPositionX: Vt, - backgroundPositionY: Vt -}, UQ = { - rotate: ca, - rotateX: ca, - rotateY: ca, - rotateZ: ca, - scale: Md, - scaleX: Md, - scaleY: Md, - scaleZ: Md, - skew: ca, - skewX: ca, - skewY: ca, - distance: Vt, - translateX: Vt, - translateY: Vt, - translateZ: Vt, - x: Vt, - y: Vt, - z: Vt, - perspective: Vt, - transformPerspective: Vt, - opacity: jl, - originX: f_, - originY: f_, - originZ: Vt -}, m_ = { - ...tf, - transform: Math.round -}, Zb = { - ...jQ, - ...UQ, - zIndex: m_, - size: Vt, - // SVG - fillOpacity: jl, - strokeOpacity: jl, - numOctaves: m_ -}, qQ = { - ...Zb, - // Color props - color: Yn, - backgroundColor: Yn, - outlineColor: Yn, - fill: Yn, - stroke: Yn, - // Border props - borderColor: Yn, - borderTopColor: Yn, - borderRightColor: Yn, - borderBottomColor: Yn, - borderLeftColor: Yn, - filter: vv, - WebkitFilter: vv -}, Qb = (t) => qQ[t]; -function H7(t, e) { - let r = Qb(t); - return r !== vv && (r = Ia), r.getAnimatableNone ? r.getAnimatableNone(e) : void 0; -} -const zQ = /* @__PURE__ */ new Set(["auto", "none", "0"]); -function WQ(t, e, r) { - let n = 0, i; - for (; n < t.length && !i; ) { - const s = t[n]; - typeof s == "string" && !zQ.has(s) && Ul(s).values.length && (i = t[n]), n++; - } - if (i && r) - for (const s of e) - t[s] = H7(r, i); -} -class K7 extends Yb { - constructor(e, r, n, i, s) { - super(e, r, n, i, s, !0); - } - readKeyframes() { - const { unresolvedKeyframes: e, element: r, name: n } = this; - if (!r || !r.current) - return; - super.readKeyframes(); - for (let u = 0; u < e.length; u++) { - let l = e[u]; - if (typeof l == "string" && (l = l.trim(), Gb(l))) { - const d = L7(l, r.current); - d !== void 0 && (e[u] = d), u === e.length - 1 && (this.finalKeyframe = l); - } - } - if (this.resolveNoneKeyframes(), !wQ.has(n) || e.length !== 2) - return; - const [i, s] = e, o = p_(i), a = p_(s); - if (o !== a) - if (l_(o) && l_(a)) - for (let u = 0; u < e.length; u++) { - const l = e[u]; - typeof l == "string" && (e[u] = parseFloat(l)); - } - else - this.needsMeasurement = !0; - } - resolveNoneKeyframes() { - const { unresolvedKeyframes: e, name: r } = this, n = []; - for (let i = 0; i < e.length; i++) - hQ(e[i]) && n.push(i); - n.length && WQ(e, n, r); - } - measureInitialState() { - const { element: e, unresolvedKeyframes: r, name: n } = this; - if (!e || !e.current) - return; - n === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = $u[n](e.measureViewportBox(), window.getComputedStyle(e.current)), r[0] = this.measuredOrigin; - const i = r[r.length - 1]; - i !== void 0 && e.getValue(n, i).jump(i, !1); - } - measureEndState() { - var e; - const { element: r, name: n, unresolvedKeyframes: i } = this; - if (!r || !r.current) - return; - const s = r.getValue(n); - s && s.jump(this.measuredOrigin, !1); - const o = i.length - 1, a = i[o]; - i[o] = $u[n](r.measureViewportBox(), window.getComputedStyle(r.current)), a !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = a), !((e = this.removedTransforms) === null || e === void 0) && e.length && this.removedTransforms.forEach(([u, l]) => { - r.getValue(u).set(l); - }), this.resolveNoneKeyframes(); - } -} -function ey(t) { - return typeof t == "function"; -} -let Xd; -function HQ() { - Xd = void 0; -} -const Zs = { - now: () => (Xd === void 0 && Zs.set(Fn.isProcessing || sQ.useManualTiming ? Fn.timestamp : performance.now()), Xd), - set: (t) => { - Xd = t, queueMicrotask(HQ); - } -}, v_ = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string -(Ia.test(t) || t === "0") && // And it contains numbers and/or colors -!t.startsWith("url(")); -function KQ(t) { - const e = t[0]; - if (t.length === 1) - return !0; - for (let r = 0; r < t.length; r++) - if (t[r] !== e) - return !0; -} -function VQ(t, e, r, n) { - const i = t[0]; - if (i === null) - return !1; - if (e === "display" || e === "visibility") - return !0; - const s = t[t.length - 1], o = v_(i, e), a = v_(s, e); - return ef(o === a, `You are trying to animate ${e} from "${i}" to "${s}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${s} via the \`style\` property.`), !o || !a ? !1 : KQ(t) || (r === "spring" || ey(r)) && n; -} -const GQ = 40; -class V7 { - constructor({ autoplay: e = !0, delay: r = 0, type: n = "keyframes", repeat: i = 0, repeatDelay: s = 0, repeatType: o = "loop", ...a }) { - this.isStopped = !1, this.hasAttemptedResolve = !1, this.createdAt = Zs.now(), this.options = { - autoplay: e, - delay: r, - type: n, - repeat: i, - repeatDelay: s, - repeatType: o, - ...a - }, this.updateFinishedPromise(); - } - /** - * This method uses the createdAt and resolvedAt to calculate the - * animation startTime. *Ideally*, we would use the createdAt time as t=0 - * as the following frame would then be the first frame of the animation in - * progress, which would feel snappier. - * - * However, if there's a delay (main thread work) between the creation of - * the animation and the first commited frame, we prefer to use resolvedAt - * to avoid a sudden jump into the animation. - */ - calcStartTime() { - return this.resolvedAt ? this.resolvedAt - this.createdAt > GQ ? this.resolvedAt : this.createdAt : this.createdAt; - } - /** - * A getter for resolved data. If keyframes are not yet resolved, accessing - * this.resolved will synchronously flush all pending keyframe resolvers. - * This is a deoptimisation, but at its worst still batches read/writes. - */ - get resolved() { - return !this._resolved && !this.hasAttemptedResolve && AQ(), this._resolved; - } - /** - * A method to be called when the keyframes resolver completes. This method - * will check if its possible to run the animation and, if not, skip it. - * Otherwise, it will call initPlayback on the implementing class. - */ - onKeyframesResolved(e, r) { - this.resolvedAt = Zs.now(), this.hasAttemptedResolve = !0; - const { name: n, type: i, velocity: s, delay: o, onComplete: a, onUpdate: u, isGenerator: l } = this.options; - if (!l && !VQ(e, n, i, s)) - if (o) - this.options.duration = 0; - else { - u == null || u(Np(e, this.options, r)), a == null || a(), this.resolveFinishedPromise(); - return; - } - const d = this.initPlayback(e, r); - d !== !1 && (this._resolved = { - keyframes: e, - finalKeyframe: r, - ...d - }, this.onPostResolved()); - } - onPostResolved() { - } - /** - * Allows the returned animation to be awaited or promise-chained. Currently - * resolves when the animation finishes at all but in a future update could/should - * reject if its cancels. - */ - then(e, r) { - return this.currentFinishedPromise.then(e, r); - } - flatten() { - this.options.type = "keyframes", this.options.ease = "linear"; - } - updateFinishedPromise() { - this.currentFinishedPromise = new Promise((e) => { - this.resolveFinishedPromise = e; - }); - } -} -function G7(t, e) { - return e ? t * (1e3 / e) : 0; -} -const YQ = 5; -function Y7(t, e, r) { - const n = Math.max(e - YQ, 0); - return G7(r - t(n), e - n); -} -const Gm = 1e-3, JQ = 0.01, b_ = 10, XQ = 0.05, ZQ = 1; -function QQ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 }) { - let i, s; - ef(t <= Js(b_), "Spring duration must be 10 seconds or less"); - let o = 1 - e; - o = Ma(XQ, ZQ, o), t = Ma(JQ, b_, No(t)), o < 1 ? (i = (l) => { - const d = l * o, p = d * t, w = d - r, _ = bv(l, o), P = Math.exp(-p); - return Gm - w / _ * P; - }, s = (l) => { - const p = l * o * t, w = p * r + r, _ = Math.pow(o, 2) * Math.pow(l, 2) * t, P = Math.exp(-p), O = bv(Math.pow(l, 2), o); - return (-i(l) + Gm > 0 ? -1 : 1) * ((w - _) * P) / O; - }) : (i = (l) => { - const d = Math.exp(-l * t), p = (l - r) * t + 1; - return -Gm + d * p; - }, s = (l) => { - const d = Math.exp(-l * t), p = (r - l) * (t * t); - return d * p; - }); - const a = 5 / t, u = tee(i, s, a); - if (t = Js(t), isNaN(u)) - return { - stiffness: 100, - damping: 10, - duration: t - }; - { - const l = Math.pow(u, 2) * n; - return { - stiffness: l, - damping: o * 2 * Math.sqrt(n * l), - duration: t - }; - } -} -const eee = 12; -function tee(t, e, r) { - let n = r; - for (let i = 1; i < eee; i++) - n = n - t(n) / e(n); - return n; -} -function bv(t, e) { - return t * Math.sqrt(1 - e * e); -} -const ree = ["duration", "bounce"], nee = ["stiffness", "damping", "mass"]; -function y_(t, e) { - return e.some((r) => t[r] !== void 0); -} -function iee(t) { - let e = { - velocity: 0, - stiffness: 100, - damping: 10, - mass: 1, - isResolvedFromDuration: !1, - ...t - }; - if (!y_(t, nee) && y_(t, ree)) { - const r = QQ(t); - e = { - ...e, - ...r, - mass: 1 - }, e.isResolvedFromDuration = !0; - } - return e; -} -function J7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { - const i = t[0], s = t[t.length - 1], o = { done: !1, value: i }, { stiffness: a, damping: u, mass: l, duration: d, velocity: p, isResolvedFromDuration: w } = iee({ - ...n, - velocity: -No(n.velocity || 0) - }), _ = p || 0, P = u / (2 * Math.sqrt(a * l)), O = s - i, L = No(Math.sqrt(a / l)), B = Math.abs(O) < 5; - r || (r = B ? 0.01 : 2), e || (e = B ? 5e-3 : 0.5); - let k; - if (P < 1) { - const W = bv(L, P); - k = (U) => { - const V = Math.exp(-P * L * U); - return s - V * ((_ + P * L * O) / W * Math.sin(W * U) + O * Math.cos(W * U)); - }; - } else if (P === 1) - k = (W) => s - Math.exp(-L * W) * (O + (_ + L * O) * W); - else { - const W = L * Math.sqrt(P * P - 1); - k = (U) => { - const V = Math.exp(-P * L * U), Q = Math.min(W * U, 300); - return s - V * ((_ + P * L * O) * Math.sinh(Q) + W * O * Math.cosh(Q)) / W; - }; - } - return { - calculatedDuration: w && d || null, - next: (W) => { - const U = k(W); - if (w) - o.done = W >= d; - else { - let V = 0; - P < 1 && (V = W === 0 ? Js(_) : Y7(k, W, U)); - const Q = Math.abs(V) <= r, R = Math.abs(s - U) <= e; - o.done = Q && R; - } - return o.value = o.done ? s : U, o; - } - }; -} -function w_({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: u, restDelta: l = 0.5, restSpeed: d }) { - const p = t[0], w = { - done: !1, - value: p - }, _ = (K) => a !== void 0 && K < a || u !== void 0 && K > u, P = (K) => a === void 0 ? u : u === void 0 || Math.abs(a - K) < Math.abs(u - K) ? a : u; - let O = r * e; - const L = p + O, B = o === void 0 ? L : o(L); - B !== L && (O = B - p); - const k = (K) => -O * Math.exp(-K / n), W = (K) => B + k(K), U = (K) => { - const ge = k(K), Ee = W(K); - w.done = Math.abs(ge) <= l, w.value = w.done ? B : Ee; - }; - let V, Q; - const R = (K) => { - _(w.value) && (V = K, Q = J7({ - keyframes: [w.value, P(w.value)], - velocity: Y7(W, K, w.value), - // TODO: This should be passing * 1000 - damping: i, - stiffness: s, - restDelta: l, - restSpeed: d - })); - }; - return R(0), { - calculatedDuration: null, - next: (K) => { - let ge = !1; - return !Q && V === void 0 && (ge = !0, U(K), R(K)), V !== void 0 && K >= V ? Q.next(K - V) : (!ge && U(K), w); - } - }; -} -const see = /* @__PURE__ */ vh(0.42, 0, 1, 1), oee = /* @__PURE__ */ vh(0, 0, 0.58, 1), X7 = /* @__PURE__ */ vh(0.42, 0, 0.58, 1), aee = (t) => Array.isArray(t) && typeof t[0] != "number", ty = (t) => Array.isArray(t) && typeof t[0] == "number", x_ = { - linear: Un, - easeIn: see, - easeInOut: X7, - easeOut: oee, - circIn: Vb, - circInOut: T7, - circOut: C7, - backIn: Kb, - backInOut: M7, - backOut: P7, - anticipate: I7 -}, __ = (t) => { - if (ty(t)) { - Wo(t.length === 4, "Cubic bezier arrays must contain four numerical values."); - const [e, r, n, i] = t; - return vh(e, r, n, i); - } else if (typeof t == "string") - return Wo(x_[t] !== void 0, `Invalid easing type '${t}'`), x_[t]; - return t; -}, cee = (t, e) => (r) => e(t(r)), Lo = (...t) => t.reduce(cee), Bu = (t, e, r) => { - const n = e - t; - return n === 0 ? 1 : (r - t) / n; -}, Qr = (t, e, r) => t + (e - t) * r; -function Ym(t, e, r) { - return r < 0 && (r += 1), r > 1 && (r -= 1), r < 1 / 6 ? t + (e - t) * 6 * r : r < 1 / 2 ? e : r < 2 / 3 ? t + (e - t) * (2 / 3 - r) * 6 : t; -} -function uee({ hue: t, saturation: e, lightness: r, alpha: n }) { - t /= 360, e /= 100, r /= 100; - let i = 0, s = 0, o = 0; - if (!e) - i = s = o = r; - else { - const a = r < 0.5 ? r * (1 + e) : r + e - r * e, u = 2 * r - a; - i = Ym(u, a, t + 1 / 3), s = Ym(u, a, t), o = Ym(u, a, t - 1 / 3); - } - return { - red: Math.round(i * 255), - green: Math.round(s * 255), - blue: Math.round(o * 255), - alpha: n - }; -} -function C0(t, e) { - return (r) => r > 0 ? e : t; -} -const Jm = (t, e, r) => { - const n = t * t, i = r * (e * e - n) + n; - return i < 0 ? 0 : Math.sqrt(i); -}, fee = [mv, hc, fu], lee = (t) => fee.find((e) => e.test(t)); -function E_(t) { - const e = lee(t); - if (ef(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e) - return !1; - let r = e.parse(t); - return e === fu && (r = uee(r)), r; -} -const S_ = (t, e) => { - const r = E_(t), n = E_(e); - if (!r || !n) - return C0(t, e); - const i = { ...r }; - return (s) => (i.red = Jm(r.red, n.red, s), i.green = Jm(r.green, n.green, s), i.blue = Jm(r.blue, n.blue, s), i.alpha = Qr(r.alpha, n.alpha, s), hc.transform(i)); -}, yv = /* @__PURE__ */ new Set(["none", "hidden"]); -function hee(t, e) { - return yv.has(t) ? (r) => r <= 0 ? t : e : (r) => r >= 1 ? e : t; -} -function dee(t, e) { - return (r) => Qr(t, e, r); -} -function ry(t) { - return typeof t == "number" ? dee : typeof t == "string" ? Gb(t) ? C0 : Yn.test(t) ? S_ : mee : Array.isArray(t) ? Z7 : typeof t == "object" ? Yn.test(t) ? S_ : pee : C0; -} -function Z7(t, e) { - const r = [...t], n = r.length, i = t.map((s, o) => ry(s)(s, e[o])); - return (s) => { - for (let o = 0; o < n; o++) - r[o] = i[o](s); - return r; - }; -} -function pee(t, e) { - const r = { ...t, ...e }, n = {}; - for (const i in r) - t[i] !== void 0 && e[i] !== void 0 && (n[i] = ry(t[i])(t[i], e[i])); - return (i) => { - for (const s in n) - r[s] = n[s](i); - return r; - }; -} -function gee(t, e) { - var r; - const n = [], i = { color: 0, var: 0, number: 0 }; - for (let s = 0; s < e.values.length; s++) { - const o = e.types[s], a = t.indexes[o][i[o]], u = (r = t.values[a]) !== null && r !== void 0 ? r : 0; - n[s] = u, i[o]++; - } - return n; -} -const mee = (t, e) => { - const r = Ia.createTransformer(e), n = Ul(t), i = Ul(e); - return n.indexes.var.length === i.indexes.var.length && n.indexes.color.length === i.indexes.color.length && n.indexes.number.length >= i.indexes.number.length ? yv.has(t) && !i.values.length || yv.has(e) && !n.values.length ? hee(t, e) : Lo(Z7(gee(n, i), i.values), r) : (ef(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), C0(t, e)); -}; -function Q7(t, e, r) { - return typeof t == "number" && typeof e == "number" && typeof r == "number" ? Qr(t, e, r) : ry(t)(t, e); -} -function vee(t, e, r) { - const n = [], i = r || Q7, s = t.length - 1; - for (let o = 0; o < s; o++) { - let a = i(t[o], t[o + 1]); - if (e) { - const u = Array.isArray(e) ? e[o] || Un : e; - a = Lo(u, a); - } - n.push(a); - } - return n; -} -function bee(t, e, { clamp: r = !0, ease: n, mixer: i } = {}) { - const s = t.length; - if (Wo(s === e.length, "Both input and output ranges must be the same length"), s === 1) - return () => e[0]; - if (s === 2 && t[0] === t[1]) - return () => e[1]; - t[0] > t[s - 1] && (t = [...t].reverse(), e = [...e].reverse()); - const o = vee(e, n, i), a = o.length, u = (l) => { - let d = 0; - if (a > 1) - for (; d < t.length - 2 && !(l < t[d + 1]); d++) - ; - const p = Bu(t[d], t[d + 1], l); - return o[d](p); - }; - return r ? (l) => u(Ma(t[0], t[s - 1], l)) : u; -} -function yee(t, e) { - const r = t[t.length - 1]; - for (let n = 1; n <= e; n++) { - const i = Bu(0, e, n); - t.push(Qr(r, 1, i)); - } -} -function wee(t) { - const e = [0]; - return yee(e, t.length - 1), e; -} -function xee(t, e) { - return t.map((r) => r * e); -} -function _ee(t, e) { - return t.map(() => e || X7).splice(0, t.length - 1); -} -function T0({ duration: t = 300, keyframes: e, times: r, ease: n = "easeInOut" }) { - const i = aee(n) ? n.map(__) : __(n), s = { - done: !1, - value: e[0] - }, o = xee( - // Only use the provided offsets if they're the correct length - // TODO Maybe we should warn here if there's a length mismatch - r && r.length === e.length ? r : wee(e), - t - ), a = bee(o, e, { - ease: Array.isArray(i) ? i : _ee(e, i) - }); - return { - calculatedDuration: t, - next: (u) => (s.value = a(u), s.done = u >= t, s) - }; -} -const A_ = 2e4; -function Eee(t) { - let e = 0; - const r = 50; - let n = t.next(e); - for (; !n.done && e < A_; ) - e += r, n = t.next(e); - return e >= A_ ? 1 / 0 : e; -} -const See = (t) => { - const e = ({ timestamp: r }) => t(r); - return { - start: () => Lr.update(e, !0), - stop: () => Pa(e), - /** - * If we're processing this frame we can use the - * framelocked timestamp to keep things in sync. - */ - now: () => Fn.isProcessing ? Fn.timestamp : Zs.now() - }; -}, Aee = { - decay: w_, - inertia: w_, - tween: T0, - keyframes: T0, - spring: J7 -}, Pee = (t) => t / 100; -class ny extends V7 { - constructor(e) { - super(e), this.holdTime = null, this.cancelTime = null, this.currentTime = 0, this.playbackSpeed = 1, this.pendingPlayState = "running", this.startTime = null, this.state = "idle", this.stop = () => { - if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle") - return; - this.teardown(); - const { onStop: u } = this.options; - u && u(); - }; - const { name: r, motionValue: n, element: i, keyframes: s } = this.options, o = (i == null ? void 0 : i.KeyframeResolver) || Yb, a = (u, l) => this.onKeyframesResolved(u, l); - this.resolver = new o(s, a, r, n, i), this.resolver.scheduleResolve(); - } - flatten() { - super.flatten(), this._resolved && Object.assign(this._resolved, this.initPlayback(this._resolved.keyframes)); - } - initPlayback(e) { - const { type: r = "keyframes", repeat: n = 0, repeatDelay: i = 0, repeatType: s, velocity: o = 0 } = this.options, a = ey(r) ? r : Aee[r] || T0; - let u, l; - a !== T0 && typeof e[0] != "number" && (process.env.NODE_ENV !== "production" && Wo(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), u = Lo(Pee, Q7(e[0], e[1])), e = [0, 100]); - const d = a({ ...this.options, keyframes: e }); - s === "mirror" && (l = a({ - ...this.options, - keyframes: [...e].reverse(), - velocity: -o - })), d.calculatedDuration === null && (d.calculatedDuration = Eee(d)); - const { calculatedDuration: p } = d, w = p + i, _ = w * (n + 1) - i; - return { - generator: d, - mirroredGenerator: l, - mapPercentToKeyframes: u, - calculatedDuration: p, - resolvedDuration: w, - totalDuration: _ - }; - } - onPostResolved() { - const { autoplay: e = !0 } = this.options; - this.play(), this.pendingPlayState === "paused" || !e ? this.pause() : this.state = this.pendingPlayState; - } - tick(e, r = !1) { - const { resolved: n } = this; - if (!n) { - const { keyframes: K } = this.options; - return { done: !0, value: K[K.length - 1] }; - } - const { finalKeyframe: i, generator: s, mirroredGenerator: o, mapPercentToKeyframes: a, keyframes: u, calculatedDuration: l, totalDuration: d, resolvedDuration: p } = n; - if (this.startTime === null) - return s.next(0); - const { delay: w, repeat: _, repeatType: P, repeatDelay: O, onUpdate: L } = this.options; - this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - d / this.speed, this.startTime)), r ? this.currentTime = e : this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = Math.round(e - this.startTime) * this.speed; - const B = this.currentTime - w * (this.speed >= 0 ? 1 : -1), k = this.speed >= 0 ? B < 0 : B > d; - this.currentTime = Math.max(B, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = d); - let W = this.currentTime, U = s; - if (_) { - const K = Math.min(this.currentTime, d) / p; - let ge = Math.floor(K), Ee = K % 1; - !Ee && K >= 1 && (Ee = 1), Ee === 1 && ge--, ge = Math.min(ge, _ + 1), !!(ge % 2) && (P === "reverse" ? (Ee = 1 - Ee, O && (Ee -= O / p)) : P === "mirror" && (U = o)), W = Ma(0, 1, Ee) * p; - } - const V = k ? { done: !1, value: u[0] } : U.next(W); - a && (V.value = a(V.value)); - let { done: Q } = V; - !k && l !== null && (Q = this.speed >= 0 ? this.currentTime >= d : this.currentTime <= 0); - const R = this.holdTime === null && (this.state === "finished" || this.state === "running" && Q); - return R && i !== void 0 && (V.value = Np(u, this.options, i)), L && L(V.value), R && this.finish(), V; - } - get duration() { - const { resolved: e } = this; - return e ? No(e.calculatedDuration) : 0; - } - get time() { - return No(this.currentTime); - } - set time(e) { - e = Js(e), this.currentTime = e, this.holdTime !== null || this.speed === 0 ? this.holdTime = e : this.driver && (this.startTime = this.driver.now() - e / this.speed); - } - get speed() { - return this.playbackSpeed; - } - set speed(e) { - const r = this.playbackSpeed !== e; - this.playbackSpeed = e, r && (this.time = No(this.currentTime)); - } - play() { - if (this.resolver.isScheduled || this.resolver.resume(), !this._resolved) { - this.pendingPlayState = "running"; - return; - } - if (this.isStopped) - return; - const { driver: e = See, onPlay: r, startTime: n } = this.options; - this.driver || (this.driver = e((s) => this.tick(s))), r && r(); - const i = this.driver.now(); - this.holdTime !== null ? this.startTime = i - this.holdTime : this.startTime ? this.state === "finished" && (this.startTime = i) : this.startTime = n ?? this.calcStartTime(), this.state === "finished" && this.updateFinishedPromise(), this.cancelTime = this.startTime, this.holdTime = null, this.state = "running", this.driver.start(); - } - pause() { - var e; - if (!this._resolved) { - this.pendingPlayState = "paused"; - return; - } - this.state = "paused", this.holdTime = (e = this.currentTime) !== null && e !== void 0 ? e : 0; - } - complete() { - this.state !== "running" && this.play(), this.pendingPlayState = this.state = "finished", this.holdTime = null; - } - finish() { - this.teardown(), this.state = "finished"; - const { onComplete: e } = this.options; - e && e(); - } - cancel() { - this.cancelTime !== null && this.tick(this.cancelTime), this.teardown(), this.updateFinishedPromise(); - } - teardown() { - this.state = "idle", this.stopDriver(), this.resolveFinishedPromise(), this.updateFinishedPromise(), this.startTime = this.cancelTime = null, this.resolver.cancel(); - } - stopDriver() { - this.driver && (this.driver.stop(), this.driver = void 0); - } - sample(e) { - return this.startTime = 0, this.tick(e, !0); - } -} -const Mee = /* @__PURE__ */ new Set([ - "opacity", - "clipPath", - "filter", - "transform" - // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved - // or until we implement support for linear() easing. - // "background-color" -]), Iee = 10, Cee = (t, e) => { - let r = ""; - const n = Math.max(Math.round(e / Iee), 2); - for (let i = 0; i < n; i++) - r += t(Bu(0, n - 1, i)) + ", "; - return `linear(${r.substring(0, r.length - 2)})`; -}; -function iy(t) { - let e; - return () => (e === void 0 && (e = t()), e); -} -const Tee = { - linearEasing: void 0 -}; -function Ree(t, e) { - const r = iy(t); - return () => { - var n; - return (n = Tee[e]) !== null && n !== void 0 ? n : r(); - }; -} -const R0 = /* @__PURE__ */ Ree(() => { - try { - document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" }); - } catch { - return !1; - } - return !0; -}, "linearEasing"); -function e9(t) { - return !!(typeof t == "function" && R0() || !t || typeof t == "string" && (t in wv || R0()) || ty(t) || Array.isArray(t) && t.every(e9)); -} -const Gf = ([t, e, r, n]) => `cubic-bezier(${t}, ${e}, ${r}, ${n})`, wv = { - linear: "linear", - ease: "ease", - easeIn: "ease-in", - easeOut: "ease-out", - easeInOut: "ease-in-out", - circIn: /* @__PURE__ */ Gf([0, 0.65, 0.55, 1]), - circOut: /* @__PURE__ */ Gf([0.55, 0, 1, 0.45]), - backIn: /* @__PURE__ */ Gf([0.31, 0.01, 0.66, -0.59]), - backOut: /* @__PURE__ */ Gf([0.33, 1.53, 0.69, 0.99]) -}; -function t9(t, e) { - if (t) - return typeof t == "function" && R0() ? Cee(t, e) : ty(t) ? Gf(t) : Array.isArray(t) ? t.map((r) => t9(r, e) || wv.easeOut) : wv[t]; -} -function Dee(t, e, r, { delay: n = 0, duration: i = 300, repeat: s = 0, repeatType: o = "loop", ease: a = "easeInOut", times: u } = {}) { - const l = { [e]: r }; - u && (l.offset = u); - const d = t9(a, i); - return Array.isArray(d) && (l.easing = d), t.animate(l, { - delay: n, - duration: i, - easing: Array.isArray(d) ? "linear" : d, - fill: "both", - iterations: s + 1, - direction: o === "reverse" ? "alternate" : "normal" - }); -} -function P_(t, e) { - t.timeline = e, t.onfinish = null; -} -const Oee = /* @__PURE__ */ iy(() => Object.hasOwnProperty.call(Element.prototype, "animate")), D0 = 10, Nee = 2e4; -function Lee(t) { - return ey(t.type) || t.type === "spring" || !e9(t.ease); -} -function kee(t, e) { - const r = new ny({ - ...e, - keyframes: t, - repeat: 0, - delay: 0, - isGenerator: !0 - }); - let n = { done: !1, value: t[0] }; - const i = []; - let s = 0; - for (; !n.done && s < Nee; ) - n = r.sample(s), i.push(n.value), s += D0; - return { - times: void 0, - keyframes: i, - duration: s - D0, - ease: "linear" - }; -} -const r9 = { - anticipate: I7, - backInOut: M7, - circInOut: T7 -}; -function $ee(t) { - return t in r9; -} -class M_ extends V7 { - constructor(e) { - super(e); - const { name: r, motionValue: n, element: i, keyframes: s } = this.options; - this.resolver = new K7(s, (o, a) => this.onKeyframesResolved(o, a), r, n, i), this.resolver.scheduleResolve(); - } - initPlayback(e, r) { - var n; - let { duration: i = 300, times: s, ease: o, type: a, motionValue: u, name: l, startTime: d } = this.options; - if (!(!((n = u.owner) === null || n === void 0) && n.current)) - return !1; - if (typeof o == "string" && R0() && $ee(o) && (o = r9[o]), Lee(this.options)) { - const { onComplete: w, onUpdate: _, motionValue: P, element: O, ...L } = this.options, B = kee(e, L); - e = B.keyframes, e.length === 1 && (e[1] = e[0]), i = B.duration, s = B.times, o = B.ease, a = "keyframes"; - } - const p = Dee(u.owner.current, l, e, { ...this.options, duration: i, times: s, ease: o }); - return p.startTime = d ?? this.calcStartTime(), this.pendingTimeline ? (P_(p, this.pendingTimeline), this.pendingTimeline = void 0) : p.onfinish = () => { - const { onComplete: w } = this.options; - u.set(Np(e, this.options, r)), w && w(), this.cancel(), this.resolveFinishedPromise(); - }, { - animation: p, - duration: i, - times: s, - type: a, - ease: o, - keyframes: e - }; - } - get duration() { - const { resolved: e } = this; - if (!e) - return 0; - const { duration: r } = e; - return No(r); - } - get time() { - const { resolved: e } = this; - if (!e) - return 0; - const { animation: r } = e; - return No(r.currentTime || 0); - } - set time(e) { - const { resolved: r } = this; - if (!r) - return; - const { animation: n } = r; - n.currentTime = Js(e); - } - get speed() { - const { resolved: e } = this; - if (!e) - return 1; - const { animation: r } = e; - return r.playbackRate; - } - set speed(e) { - const { resolved: r } = this; - if (!r) - return; - const { animation: n } = r; - n.playbackRate = e; - } - get state() { - const { resolved: e } = this; - if (!e) - return "idle"; - const { animation: r } = e; - return r.playState; - } - get startTime() { - const { resolved: e } = this; - if (!e) - return null; - const { animation: r } = e; - return r.startTime; - } - /** - * Replace the default DocumentTimeline with another AnimationTimeline. - * Currently used for scroll animations. - */ - attachTimeline(e) { - if (!this._resolved) - this.pendingTimeline = e; - else { - const { resolved: r } = this; - if (!r) - return Un; - const { animation: n } = r; - P_(n, e); - } - return Un; - } - play() { - if (this.isStopped) - return; - const { resolved: e } = this; - if (!e) - return; - const { animation: r } = e; - r.playState === "finished" && this.updateFinishedPromise(), r.play(); - } - pause() { - const { resolved: e } = this; - if (!e) - return; - const { animation: r } = e; - r.pause(); - } - stop() { - if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle") - return; - this.resolveFinishedPromise(), this.updateFinishedPromise(); - const { resolved: e } = this; - if (!e) - return; - const { animation: r, keyframes: n, duration: i, type: s, ease: o, times: a } = e; - if (r.playState === "idle" || r.playState === "finished") - return; - if (this.time) { - const { motionValue: l, onUpdate: d, onComplete: p, element: w, ..._ } = this.options, P = new ny({ - ..._, - keyframes: n, - duration: i, - type: s, - ease: o, - times: a, - isGenerator: !0 - }), O = Js(this.time); - l.setWithVelocity(P.sample(O - D0).value, P.sample(O).value, D0); - } - const { onStop: u } = this.options; - u && u(), this.cancel(); - } - complete() { - const { resolved: e } = this; - e && e.animation.finish(); - } - cancel() { - const { resolved: e } = this; - e && e.animation.cancel(); - } - static supports(e) { - const { motionValue: r, name: n, repeatDelay: i, repeatType: s, damping: o, type: a } = e; - return Oee() && n && Mee.has(n) && r && r.owner && r.owner.current instanceof HTMLElement && /** - * If we're outputting values to onUpdate then we can't use WAAPI as there's - * no way to read the value from WAAPI every frame. - */ - !r.owner.getProps().onUpdate && !i && s !== "mirror" && o !== 0 && a !== "inertia"; - } -} -const Bee = iy(() => window.ScrollTimeline !== void 0); -class Fee { - constructor(e) { - this.stop = () => this.runAll("stop"), this.animations = e.filter(Boolean); - } - then(e, r) { - return Promise.all(this.animations).then(e).catch(r); - } - /** - * TODO: Filter out cancelled or stopped animations before returning - */ - getAll(e) { - return this.animations[0][e]; - } - setAll(e, r) { - for (let n = 0; n < this.animations.length; n++) - this.animations[n][e] = r; - } - attachTimeline(e, r) { - const n = this.animations.map((i) => Bee() && i.attachTimeline ? i.attachTimeline(e) : r(i)); - return () => { - n.forEach((i, s) => { - i && i(), this.animations[s].stop(); - }); - }; - } - get time() { - return this.getAll("time"); - } - set time(e) { - this.setAll("time", e); - } - get speed() { - return this.getAll("speed"); - } - set speed(e) { - this.setAll("speed", e); - } - get startTime() { - return this.getAll("startTime"); - } - get duration() { - let e = 0; - for (let r = 0; r < this.animations.length; r++) - e = Math.max(e, this.animations[r].duration); - return e; - } - runAll(e) { - this.animations.forEach((r) => r[e]()); - } - flatten() { - this.runAll("flatten"); - } - play() { - this.runAll("play"); - } - pause() { - this.runAll("pause"); - } - cancel() { - this.runAll("cancel"); - } - complete() { - this.runAll("complete"); - } -} -function jee({ when: t, delay: e, delayChildren: r, staggerChildren: n, staggerDirection: i, repeat: s, repeatType: o, repeatDelay: a, from: u, elapsed: l, ...d }) { - return !!Object.keys(d).length; -} -const sy = (t, e, r, n = {}, i, s) => (o) => { - const a = Hb(n, t) || {}, u = a.delay || n.delay || 0; - let { elapsed: l = 0 } = n; - l = l - Js(u); - let d = { - keyframes: Array.isArray(r) ? r : [null, r], - ease: "easeOut", - velocity: e.getVelocity(), - ...a, - delay: -l, - onUpdate: (w) => { - e.set(w), a.onUpdate && a.onUpdate(w); - }, - onComplete: () => { - o(), a.onComplete && a.onComplete(); - }, - name: t, - motionValue: e, - element: s ? void 0 : i - }; - jee(a) || (d = { - ...d, - ...iQ(t, d) - }), d.duration && (d.duration = Js(d.duration)), d.repeatDelay && (d.repeatDelay = Js(d.repeatDelay)), d.from !== void 0 && (d.keyframes[0] = d.from); - let p = !1; - if ((d.type === !1 || d.duration === 0 && !d.repeatDelay) && (d.duration = 0, d.delay === 0 && (p = !0)), p && !s && e.get() !== void 0) { - const w = Np(d.keyframes, a); - if (w !== void 0) - return Lr.update(() => { - d.onUpdate(w), d.onComplete(); - }), new Fee([]); - } - return !s && M_.supports(d) ? new M_(d) : new ny(d); -}, Uee = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), qee = (t) => dv(t) ? t[t.length - 1] || 0 : t; -function oy(t, e) { - t.indexOf(e) === -1 && t.push(e); -} -function ay(t, e) { - const r = t.indexOf(e); - r > -1 && t.splice(r, 1); -} -class cy { - constructor() { - this.subscriptions = []; - } - add(e) { - return oy(this.subscriptions, e), () => ay(this.subscriptions, e); - } - notify(e, r, n) { - const i = this.subscriptions.length; - if (i) - if (i === 1) - this.subscriptions[0](e, r, n); - else - for (let s = 0; s < i; s++) { - const o = this.subscriptions[s]; - o && o(e, r, n); - } - } - getSize() { - return this.subscriptions.length; - } - clear() { - this.subscriptions.length = 0; - } -} -const I_ = 30, zee = (t) => !isNaN(parseFloat(t)); -class Wee { - /** - * @param init - The initiating value - * @param config - Optional configuration options - * - * - `transformer`: A function to transform incoming values with. - * - * @internal - */ - constructor(e, r = {}) { - this.version = "11.11.17", this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (n, i = !0) => { - const s = Zs.now(); - this.updatedAt !== s && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(n), this.current !== this.prev && this.events.change && this.events.change.notify(this.current), i && this.events.renderRequest && this.events.renderRequest.notify(this.current); - }, this.hasAnimated = !1, this.setCurrent(e), this.owner = r.owner; - } - setCurrent(e) { - this.current = e, this.updatedAt = Zs.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = zee(this.current)); - } - setPrevFrameValue(e = this.current) { - this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt; - } - /** - * Adds a function that will be notified when the `MotionValue` is updated. - * - * It returns a function that, when called, will cancel the subscription. - * - * When calling `onChange` inside a React component, it should be wrapped with the - * `useEffect` hook. As it returns an unsubscribe function, this should be returned - * from the `useEffect` function to ensure you don't add duplicate subscribers.. - * - * ```jsx - * export const MyComponent = () => { - * const x = useMotionValue(0) - * const y = useMotionValue(0) - * const opacity = useMotionValue(1) - * - * useEffect(() => { - * function updateOpacity() { - * const maxXY = Math.max(x.get(), y.get()) - * const newOpacity = transform(maxXY, [0, 100], [1, 0]) - * opacity.set(newOpacity) - * } - * - * const unsubscribeX = x.on("change", updateOpacity) - * const unsubscribeY = y.on("change", updateOpacity) - * - * return () => { - * unsubscribeX() - * unsubscribeY() - * } - * }, []) - * - * return - * } - * ``` - * - * @param subscriber - A function that receives the latest value. - * @returns A function that, when called, will cancel this subscription. - * - * @deprecated - */ - onChange(e) { - return process.env.NODE_ENV !== "production" && Rp(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e); - } - on(e, r) { - this.events[e] || (this.events[e] = new cy()); - const n = this.events[e].add(r); - return e === "change" ? () => { - n(), Lr.read(() => { - this.events.change.getSize() || this.stop(); - }); - } : n; - } - clearListeners() { - for (const e in this.events) - this.events[e].clear(); - } - /** - * Attaches a passive effect to the `MotionValue`. - * - * @internal - */ - attach(e, r) { - this.passiveEffect = e, this.stopPassiveEffect = r; - } - /** - * Sets the state of the `MotionValue`. - * - * @remarks - * - * ```jsx - * const x = useMotionValue(0) - * x.set(10) - * ``` - * - * @param latest - Latest value to set. - * @param render - Whether to notify render subscribers. Defaults to `true` - * - * @public - */ - set(e, r = !0) { - !r || !this.passiveEffect ? this.updateAndNotify(e, r) : this.passiveEffect(e, this.updateAndNotify); - } - setWithVelocity(e, r, n) { - this.set(r), this.prev = void 0, this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt - n; - } - /** - * Set the state of the `MotionValue`, stopping any active animations, - * effects, and resets velocity to `0`. - */ - jump(e, r = !0) { - this.updateAndNotify(e), this.prev = e, this.prevUpdatedAt = this.prevFrameValue = void 0, r && this.stop(), this.stopPassiveEffect && this.stopPassiveEffect(); - } - /** - * Returns the latest state of `MotionValue` - * - * @returns - The latest state of `MotionValue` - * - * @public - */ - get() { - return this.current; - } - /** - * @public - */ - getPrevious() { - return this.prev; - } - /** - * Returns the latest velocity of `MotionValue` - * - * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical. - * - * @public - */ - getVelocity() { - const e = Zs.now(); - if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > I_) - return 0; - const r = Math.min(this.updatedAt - this.prevUpdatedAt, I_); - return G7(parseFloat(this.current) - parseFloat(this.prevFrameValue), r); - } - /** - * Registers a new animation to control this `MotionValue`. Only one - * animation can drive a `MotionValue` at one time. - * - * ```jsx - * value.start() - * ``` - * - * @param animation - A function that starts the provided animation - * - * @internal - */ - start(e) { - return this.stop(), new Promise((r) => { - this.hasAnimated = !0, this.animation = e(r), this.events.animationStart && this.events.animationStart.notify(); - }).then(() => { - this.events.animationComplete && this.events.animationComplete.notify(), this.clearAnimation(); - }); - } - /** - * Stop the currently active animation. - * - * @public - */ - stop() { - this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation(); - } - /** - * Returns `true` if this value is currently animating. - * - * @public - */ - isAnimating() { - return !!this.animation; - } - clearAnimation() { - delete this.animation; - } - /** - * Destroy and clean up subscribers to this `MotionValue`. - * - * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically - * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually - * created a `MotionValue` via the `motionValue` function. - * - * @public - */ - destroy() { - this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect(); - } -} -function ql(t, e) { - return new Wee(t, e); -} -function Hee(t, e, r) { - t.hasValue(e) ? t.getValue(e).set(r) : t.addValue(e, ql(r)); -} -function Kee(t, e) { - const r = Op(t, e); - let { transitionEnd: n = {}, transition: i = {}, ...s } = r || {}; - s = { ...s, ...n }; - for (const o in s) { - const a = qee(s[o]); - Hee(t, o, a); - } -} -const uy = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), Vee = "framerAppearId", n9 = "data-" + uy(Vee); -function i9(t) { - return t.props[n9]; -} -const Zn = (t) => !!(t && t.getVelocity); -function Gee(t) { - return !!(Zn(t) && t.add); -} -function xv(t, e) { - const r = t.getValue("willChange"); - if (Gee(r)) - return r.add(e); -} -function Yee({ protectedKeys: t, needsAnimating: e }, r) { - const n = t.hasOwnProperty(r) && e[r] !== !0; - return e[r] = !1, n; -} -function s9(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { - var s; - let { transition: o = t.getDefaultTransition(), transitionEnd: a, ...u } = e; - n && (o = n); - const l = [], d = i && t.animationState && t.animationState.getState()[i]; - for (const p in u) { - const w = t.getValue(p, (s = t.latestValues[p]) !== null && s !== void 0 ? s : null), _ = u[p]; - if (_ === void 0 || d && Yee(d, p)) - continue; - const P = { - delay: r, - ...Hb(o || {}, p) - }; - let O = !1; - if (window.MotionHandoffAnimation) { - const B = i9(t); - if (B) { - const k = window.MotionHandoffAnimation(B, p, Lr); - k !== null && (P.startTime = k, O = !0); - } - } - xv(t, p), w.start(sy(p, w, _, t.shouldReduceMotion && Lc.has(p) ? { type: !1 } : P, t, O)); - const L = w.animation; - L && l.push(L); - } - return a && Promise.all(l).then(() => { - Lr.update(() => { - a && Kee(t, a); - }); - }), l; -} -function _v(t, e, r = {}) { - var n; - const i = Op(t, e, r.type === "exit" ? (n = t.presenceContext) === null || n === void 0 ? void 0 : n.custom : void 0); - let { transition: s = t.getDefaultTransition() || {} } = i || {}; - r.transitionOverride && (s = r.transitionOverride); - const o = i ? () => Promise.all(s9(t, i, r)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (l = 0) => { - const { delayChildren: d = 0, staggerChildren: p, staggerDirection: w } = s; - return Jee(t, e, d + l, p, w, r); - } : () => Promise.resolve(), { when: u } = s; - if (u) { - const [l, d] = u === "beforeChildren" ? [o, a] : [a, o]; - return l().then(() => d()); - } else - return Promise.all([o(), a(r.delay)]); -} -function Jee(t, e, r = 0, n = 0, i = 1, s) { - const o = [], a = (t.variantChildren.size - 1) * n, u = i === 1 ? (l = 0) => l * n : (l = 0) => a - l * n; - return Array.from(t.variantChildren).sort(Xee).forEach((l, d) => { - l.notify("AnimationStart", e), o.push(_v(l, e, { - ...s, - delay: r + u(d) - }).then(() => l.notify("AnimationComplete", e))); - }), Promise.all(o); -} -function Xee(t, e) { - return t.sortNodePosition(e); -} -function Zee(t, e, r = {}) { - t.notify("AnimationStart", e); - let n; - if (Array.isArray(e)) { - const i = e.map((s) => _v(t, s, r)); - n = Promise.all(i); - } else if (typeof e == "string") - n = _v(t, e, r); - else { - const i = typeof e == "function" ? Op(t, e, r.custom) : e; - n = Promise.all(s9(t, i, r)); - } - return n.then(() => { - t.notify("AnimationComplete", e); - }); -} -const Qee = Wb.length; -function o9(t) { - if (!t) - return; - if (!t.isControllingVariants) { - const r = t.parent ? o9(t.parent) || {} : {}; - return t.props.initial !== void 0 && (r.initial = t.props.initial), r; - } - const e = {}; - for (let r = 0; r < Qee; r++) { - const n = Wb[r], i = t.props[n]; - (Fl(i) || i === !1) && (e[n] = i); - } - return e; -} -const ete = [...zb].reverse(), tte = zb.length; -function rte(t) { - return (e) => Promise.all(e.map(({ animation: r, options: n }) => Zee(t, r, n))); -} -function nte(t) { - let e = rte(t), r = C_(), n = !0; - const i = (u) => (l, d) => { - var p; - const w = Op(t, d, u === "exit" ? (p = t.presenceContext) === null || p === void 0 ? void 0 : p.custom : void 0); - if (w) { - const { transition: _, transitionEnd: P, ...O } = w; - l = { ...l, ...O, ...P }; - } - return l; - }; - function s(u) { - e = u(t); - } - function o(u) { - const { props: l } = t, d = o9(t.parent) || {}, p = [], w = /* @__PURE__ */ new Set(); - let _ = {}, P = 1 / 0; - for (let L = 0; L < tte; L++) { - const B = ete[L], k = r[B], W = l[B] !== void 0 ? l[B] : d[B], U = Fl(W), V = B === u ? k.isActive : null; - V === !1 && (P = L); - let Q = W === d[B] && W !== l[B] && U; - if (Q && n && t.manuallyAnimateOnMount && (Q = !1), k.protectedKeys = { ..._ }, // If it isn't active and hasn't *just* been set as inactive - !k.isActive && V === null || // If we didn't and don't have any defined prop for this animation type - !W && !k.prevProp || // Or if the prop doesn't define an animation - Dp(W) || typeof W == "boolean") - continue; - const R = ite(k.prevProp, W); - let K = R || // If we're making this variant active, we want to always make it active - B === u && k.isActive && !Q && U || // If we removed a higher-priority variant (i is in reverse order) - L > P && U, ge = !1; - const Ee = Array.isArray(W) ? W : [W]; - let Y = Ee.reduce(i(B), {}); - V === !1 && (Y = {}); - const { prevResolvedValues: A = {} } = k, m = { - ...A, - ...Y - }, f = (x) => { - K = !0, w.has(x) && (ge = !0, w.delete(x)), k.needsAnimating[x] = !0; - const E = t.getValue(x); - E && (E.liveStyle = !1); - }; - for (const x in m) { - const E = Y[x], S = A[x]; - if (_.hasOwnProperty(x)) - continue; - let v = !1; - dv(E) && dv(S) ? v = !x7(E, S) : v = E !== S, v ? E != null ? f(x) : w.add(x) : E !== void 0 && w.has(x) ? f(x) : k.protectedKeys[x] = !0; - } - k.prevProp = W, k.prevResolvedValues = Y, k.isActive && (_ = { ..._, ...Y }), n && t.blockInitialAnimation && (K = !1), K && (!(Q && R) || ge) && p.push(...Ee.map((x) => ({ - animation: x, - options: { type: B } - }))); - } - if (w.size) { - const L = {}; - w.forEach((B) => { - const k = t.getBaseTarget(B), W = t.getValue(B); - W && (W.liveStyle = !0), L[B] = k ?? null; - }), p.push({ animation: L }); - } - let O = !!p.length; - return n && (l.initial === !1 || l.initial === l.animate) && !t.manuallyAnimateOnMount && (O = !1), n = !1, O ? e(p) : Promise.resolve(); - } - function a(u, l) { - var d; - if (r[u].isActive === l) - return Promise.resolve(); - (d = t.variantChildren) === null || d === void 0 || d.forEach((w) => { - var _; - return (_ = w.animationState) === null || _ === void 0 ? void 0 : _.setActive(u, l); - }), r[u].isActive = l; - const p = o(u); - for (const w in r) - r[w].protectedKeys = {}; - return p; - } - return { - animateChanges: o, - setActive: a, - setAnimateFunction: s, - getState: () => r, - reset: () => { - r = C_(), n = !0; - } - }; -} -function ite(t, e) { - return typeof e == "string" ? e !== t : Array.isArray(e) ? !x7(e, t) : !1; -} -function Qa(t = !1) { - return { - isActive: t, - protectedKeys: {}, - needsAnimating: {}, - prevResolvedValues: {} - }; -} -function C_() { - return { - animate: Qa(!0), - whileInView: Qa(), - whileHover: Qa(), - whileTap: Qa(), - whileDrag: Qa(), - whileFocus: Qa(), - exit: Qa() - }; -} -class $a { - constructor(e) { - this.isMounted = !1, this.node = e; - } - update() { - } -} -class ste extends $a { - /** - * We dynamically generate the AnimationState manager as it contains a reference - * to the underlying animation library. We only want to load that if we load this, - * so people can optionally code split it out using the `m` component. - */ - constructor(e) { - super(e), e.animationState || (e.animationState = nte(e)); - } - updateAnimationControlsSubscription() { - const { animate: e } = this.node.getProps(); - Dp(e) && (this.unmountControls = e.subscribe(this.node)); - } - /** - * Subscribe any provided AnimationControls to the component's VisualElement - */ - mount() { - this.updateAnimationControlsSubscription(); - } - update() { - const { animate: e } = this.node.getProps(), { animate: r } = this.node.prevProps || {}; - e !== r && this.updateAnimationControlsSubscription(); - } - unmount() { - var e; - this.node.animationState.reset(), (e = this.unmountControls) === null || e === void 0 || e.call(this); - } -} -let ote = 0; -class ate extends $a { - constructor() { - super(...arguments), this.id = ote++; - } - update() { - if (!this.node.presenceContext) - return; - const { isPresent: e, onExitComplete: r } = this.node.presenceContext, { isPresent: n } = this.node.prevPresenceContext || {}; - if (!this.node.animationState || e === n) - return; - const i = this.node.animationState.setActive("exit", !e); - r && !e && i.then(() => r(this.id)); - } - mount() { - const { register: e } = this.node.presenceContext || {}; - e && (this.unmount = e(this.id)); - } - unmount() { - } -} -const cte = { - animation: { - Feature: ste - }, - exit: { - Feature: ate - } -}, a9 = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1; -function Lp(t, e = "page") { - return { - point: { - x: t[`${e}X`], - y: t[`${e}Y`] - } - }; -} -const ute = (t) => (e) => a9(e) && t(e, Lp(e)); -function Ro(t, e, r, n = { passive: !0 }) { - return t.addEventListener(e, r, n), () => t.removeEventListener(e, r); -} -function ko(t, e, r, n) { - return Ro(t, e, ute(r), n); -} -const T_ = (t, e) => Math.abs(t - e); -function fte(t, e) { - const r = T_(t.x, e.x), n = T_(t.y, e.y); - return Math.sqrt(r ** 2 + n ** 2); -} -class c9 { - constructor(e, r, { transformPagePoint: n, contextWindow: i, dragSnapToOrigin: s = !1 } = {}) { - if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.updatePoint = () => { - if (!(this.lastMoveEvent && this.lastMoveEventInfo)) - return; - const p = Zm(this.lastMoveEventInfo, this.history), w = this.startEvent !== null, _ = fte(p.offset, { x: 0, y: 0 }) >= 3; - if (!w && !_) - return; - const { point: P } = p, { timestamp: O } = Fn; - this.history.push({ ...P, timestamp: O }); - const { onStart: L, onMove: B } = this.handlers; - w || (L && L(this.lastMoveEvent, p), this.startEvent = this.lastMoveEvent), B && B(this.lastMoveEvent, p); - }, this.handlePointerMove = (p, w) => { - this.lastMoveEvent = p, this.lastMoveEventInfo = Xm(w, this.transformPagePoint), Lr.update(this.updatePoint, !0); - }, this.handlePointerUp = (p, w) => { - this.end(); - const { onEnd: _, onSessionEnd: P, resumeAnimation: O } = this.handlers; - if (this.dragSnapToOrigin && O && O(), !(this.lastMoveEvent && this.lastMoveEventInfo)) - return; - const L = Zm(p.type === "pointercancel" ? this.lastMoveEventInfo : Xm(w, this.transformPagePoint), this.history); - this.startEvent && _ && _(p, L), P && P(p, L); - }, !a9(e)) - return; - this.dragSnapToOrigin = s, this.handlers = r, this.transformPagePoint = n, this.contextWindow = i || window; - const o = Lp(e), a = Xm(o, this.transformPagePoint), { point: u } = a, { timestamp: l } = Fn; - this.history = [{ ...u, timestamp: l }]; - const { onSessionStart: d } = r; - d && d(e, Zm(a, this.history)), this.removeListeners = Lo(ko(this.contextWindow, "pointermove", this.handlePointerMove), ko(this.contextWindow, "pointerup", this.handlePointerUp), ko(this.contextWindow, "pointercancel", this.handlePointerUp)); - } - updateHandlers(e) { - this.handlers = e; - } - end() { - this.removeListeners && this.removeListeners(), Pa(this.updatePoint); - } -} -function Xm(t, e) { - return e ? { point: e(t.point) } : t; -} -function R_(t, e) { - return { x: t.x - e.x, y: t.y - e.y }; -} -function Zm({ point: t }, e) { - return { - point: t, - delta: R_(t, u9(e)), - offset: R_(t, lte(e)), - velocity: hte(e, 0.1) - }; -} -function lte(t) { - return t[0]; -} -function u9(t) { - return t[t.length - 1]; -} -function hte(t, e) { - if (t.length < 2) - return { x: 0, y: 0 }; - let r = t.length - 1, n = null; - const i = u9(t); - for (; r >= 0 && (n = t[r], !(i.timestamp - n.timestamp > Js(e))); ) - r--; - if (!n) - return { x: 0, y: 0 }; - const s = No(i.timestamp - n.timestamp); - if (s === 0) - return { x: 0, y: 0 }; - const o = { - x: (i.x - n.x) / s, - y: (i.y - n.y) / s - }; - return o.x === 1 / 0 && (o.x = 0), o.y === 1 / 0 && (o.y = 0), o; -} -function f9(t) { - let e = null; - return () => { - const r = () => { - e = null; - }; - return e === null ? (e = t, r) : !1; - }; -} -const D_ = f9("dragHorizontal"), O_ = f9("dragVertical"); -function l9(t) { - let e = !1; - if (t === "y") - e = O_(); - else if (t === "x") - e = D_(); - else { - const r = D_(), n = O_(); - r && n ? e = () => { - r(), n(); - } : (r && r(), n && n()); - } - return e; -} -function h9() { - const t = l9(!0); - return t ? (t(), !1) : !0; -} -function lu(t) { - return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current"); -} -const d9 = 1e-4, dte = 1 - d9, pte = 1 + d9, p9 = 0.01, gte = 0 - p9, mte = 0 + p9; -function ki(t) { - return t.max - t.min; -} -function vte(t, e, r) { - return Math.abs(t - e) <= r; -} -function N_(t, e, r, n = 0.5) { - t.origin = n, t.originPoint = Qr(e.min, e.max, t.origin), t.scale = ki(r) / ki(e), t.translate = Qr(r.min, r.max, t.origin) - t.originPoint, (t.scale >= dte && t.scale <= pte || isNaN(t.scale)) && (t.scale = 1), (t.translate >= gte && t.translate <= mte || isNaN(t.translate)) && (t.translate = 0); -} -function il(t, e, r, n) { - N_(t.x, e.x, r.x, n ? n.originX : void 0), N_(t.y, e.y, r.y, n ? n.originY : void 0); -} -function L_(t, e, r) { - t.min = r.min + e.min, t.max = t.min + ki(e); -} -function bte(t, e, r) { - L_(t.x, e.x, r.x), L_(t.y, e.y, r.y); -} -function k_(t, e, r) { - t.min = e.min - r.min, t.max = t.min + ki(e); -} -function sl(t, e, r) { - k_(t.x, e.x, r.x), k_(t.y, e.y, r.y); -} -function yte(t, { min: e, max: r }, n) { - return e !== void 0 && t < e ? t = n ? Qr(e, t, n.min) : Math.max(t, e) : r !== void 0 && t > r && (t = n ? Qr(r, t, n.max) : Math.min(t, r)), t; -} -function $_(t, e, r) { - return { - min: e !== void 0 ? t.min + e : void 0, - max: r !== void 0 ? t.max + r - (t.max - t.min) : void 0 - }; -} -function wte(t, { top: e, left: r, bottom: n, right: i }) { - return { - x: $_(t.x, r, i), - y: $_(t.y, e, n) - }; -} -function B_(t, e) { - let r = e.min - t.min, n = e.max - t.max; - return e.max - e.min < t.max - t.min && ([r, n] = [n, r]), { min: r, max: n }; -} -function xte(t, e) { - return { - x: B_(t.x, e.x), - y: B_(t.y, e.y) - }; -} -function _te(t, e) { - let r = 0.5; - const n = ki(t), i = ki(e); - return i > n ? r = Bu(e.min, e.max - n, t.min) : n > i && (r = Bu(t.min, t.max - i, e.min)), Ma(0, 1, r); -} -function Ete(t, e) { - const r = {}; - return e.min !== void 0 && (r.min = e.min - t.min), e.max !== void 0 && (r.max = e.max - t.min), r; -} -const Ev = 0.35; -function Ste(t = Ev) { - return t === !1 ? t = 0 : t === !0 && (t = Ev), { - x: F_(t, "left", "right"), - y: F_(t, "top", "bottom") - }; -} -function F_(t, e, r) { - return { - min: j_(t, e), - max: j_(t, r) - }; -} -function j_(t, e) { - return typeof t == "number" ? t : t[e] || 0; -} -const U_ = () => ({ - translate: 0, - scale: 1, - origin: 0, - originPoint: 0 -}), hu = () => ({ - x: U_(), - y: U_() -}), q_ = () => ({ min: 0, max: 0 }), ln = () => ({ - x: q_(), - y: q_() -}); -function Qi(t) { - return [t("x"), t("y")]; -} -function g9({ top: t, left: e, right: r, bottom: n }) { - return { - x: { min: e, max: r }, - y: { min: t, max: n } - }; -} -function Ate({ x: t, y: e }) { - return { top: e.min, right: t.max, bottom: e.max, left: t.min }; -} -function Pte(t, e) { - if (!e) - return t; - const r = e({ x: t.left, y: t.top }), n = e({ x: t.right, y: t.bottom }); - return { - top: r.y, - left: r.x, - bottom: n.y, - right: n.x - }; -} -function Qm(t) { - return t === void 0 || t === 1; -} -function Sv({ scale: t, scaleX: e, scaleY: r }) { - return !Qm(t) || !Qm(e) || !Qm(r); -} -function tc(t) { - return Sv(t) || m9(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY; -} -function m9(t) { - return z_(t.x) || z_(t.y); -} -function z_(t) { - return t && t !== "0%"; -} -function O0(t, e, r) { - const n = t - r, i = e * n; - return r + i; -} -function W_(t, e, r, n, i) { - return i !== void 0 && (t = O0(t, i, n)), O0(t, r, n) + e; -} -function Av(t, e = 0, r = 1, n, i) { - t.min = W_(t.min, e, r, n, i), t.max = W_(t.max, e, r, n, i); -} -function v9(t, { x: e, y: r }) { - Av(t.x, e.translate, e.scale, e.originPoint), Av(t.y, r.translate, r.scale, r.originPoint); -} -const H_ = 0.999999999999, K_ = 1.0000000000001; -function Mte(t, e, r, n = !1) { - const i = r.length; - if (!i) - return; - e.x = e.y = 1; - let s, o; - for (let a = 0; a < i; a++) { - s = r[a], o = s.projectionDelta; - const { visualElement: u } = s.options; - u && u.props.style && u.props.style.display === "contents" || (n && s.options.layoutScroll && s.scroll && s !== s.root && pu(t, { - x: -s.scroll.offset.x, - y: -s.scroll.offset.y - }), o && (e.x *= o.x.scale, e.y *= o.y.scale, v9(t, o)), n && tc(s.latestValues) && pu(t, s.latestValues)); - } - e.x < K_ && e.x > H_ && (e.x = 1), e.y < K_ && e.y > H_ && (e.y = 1); -} -function du(t, e) { - t.min = t.min + e, t.max = t.max + e; -} -function V_(t, e, r, n, i = 0.5) { - const s = Qr(t.min, t.max, i); - Av(t, e, r, s, n); -} -function pu(t, e) { - V_(t.x, e.x, e.scaleX, e.scale, e.originX), V_(t.y, e.y, e.scaleY, e.scale, e.originY); -} -function b9(t, e) { - return g9(Pte(t.getBoundingClientRect(), e)); -} -function Ite(t, e, r) { - const n = b9(t, r), { scroll: i } = e; - return i && (du(n.x, i.offset.x), du(n.y, i.offset.y)), n; -} -const y9 = ({ current: t }) => t ? t.ownerDocument.defaultView : null, Cte = /* @__PURE__ */ new WeakMap(); -class Tte { - constructor(e) { - this.openGlobalLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = ln(), this.visualElement = e; - } - start(e, { snapToCursor: r = !1 } = {}) { - const { presenceContext: n } = this.visualElement; - if (n && n.isPresent === !1) - return; - const i = (d) => { - const { dragSnapToOrigin: p } = this.getProps(); - p ? this.pauseAnimation() : this.stopAnimation(), r && this.snapToCursor(Lp(d, "page").point); - }, s = (d, p) => { - const { drag: w, dragPropagation: _, onDragStart: P } = this.getProps(); - if (w && !_ && (this.openGlobalLock && this.openGlobalLock(), this.openGlobalLock = l9(w), !this.openGlobalLock)) - return; - this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), Qi((L) => { - let B = this.getAxisMotionValue(L).get() || 0; - if (Xs.test(B)) { - const { projection: k } = this.visualElement; - if (k && k.layout) { - const W = k.layout.layoutBox[L]; - W && (B = ki(W) * (parseFloat(B) / 100)); - } - } - this.originPoint[L] = B; - }), P && Lr.postRender(() => P(d, p)), xv(this.visualElement, "transform"); - const { animationState: O } = this.visualElement; - O && O.setActive("whileDrag", !0); - }, o = (d, p) => { - const { dragPropagation: w, dragDirectionLock: _, onDirectionLock: P, onDrag: O } = this.getProps(); - if (!w && !this.openGlobalLock) - return; - const { offset: L } = p; - if (_ && this.currentDirection === null) { - this.currentDirection = Rte(L), this.currentDirection !== null && P && P(this.currentDirection); - return; - } - this.updateAxis("x", p.point, L), this.updateAxis("y", p.point, L), this.visualElement.render(), O && O(d, p); - }, a = (d, p) => this.stop(d, p), u = () => Qi((d) => { - var p; - return this.getAnimationState(d) === "paused" && ((p = this.getAxisMotionValue(d).animation) === null || p === void 0 ? void 0 : p.play()); - }), { dragSnapToOrigin: l } = this.getProps(); - this.panSession = new c9(e, { - onSessionStart: i, - onStart: s, - onMove: o, - onSessionEnd: a, - resumeAnimation: u - }, { - transformPagePoint: this.visualElement.getTransformPagePoint(), - dragSnapToOrigin: l, - contextWindow: y9(this.visualElement) - }); - } - stop(e, r) { - const n = this.isDragging; - if (this.cancel(), !n) - return; - const { velocity: i } = r; - this.startAnimation(i); - const { onDragEnd: s } = this.getProps(); - s && Lr.postRender(() => s(e, r)); - } - cancel() { - this.isDragging = !1; - const { projection: e, animationState: r } = this.visualElement; - e && (e.isAnimationBlocked = !1), this.panSession && this.panSession.end(), this.panSession = void 0; - const { dragPropagation: n } = this.getProps(); - !n && this.openGlobalLock && (this.openGlobalLock(), this.openGlobalLock = null), r && r.setActive("whileDrag", !1); - } - updateAxis(e, r, n) { - const { drag: i } = this.getProps(); - if (!n || !Id(e, i, this.currentDirection)) - return; - const s = this.getAxisMotionValue(e); - let o = this.originPoint[e] + n[e]; - this.constraints && this.constraints[e] && (o = yte(o, this.constraints[e], this.elastic[e])), s.set(o); - } - resolveConstraints() { - var e; - const { dragConstraints: r, dragElastic: n } = this.getProps(), i = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : (e = this.visualElement.projection) === null || e === void 0 ? void 0 : e.layout, s = this.constraints; - r && lu(r) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : r && i ? this.constraints = wte(i.layoutBox, r) : this.constraints = !1, this.elastic = Ste(n), s !== this.constraints && i && this.constraints && !this.hasMutatedConstraints && Qi((o) => { - this.constraints !== !1 && this.getAxisMotionValue(o) && (this.constraints[o] = Ete(i.layoutBox[o], this.constraints[o])); - }); - } - resolveRefConstraints() { - const { dragConstraints: e, onMeasureDragConstraints: r } = this.getProps(); - if (!e || !lu(e)) - return !1; - const n = e.current; - Wo(n !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop."); - const { projection: i } = this.visualElement; - if (!i || !i.layout) - return !1; - const s = Ite(n, i.root, this.visualElement.getTransformPagePoint()); - let o = xte(i.layout.layoutBox, s); - if (r) { - const a = r(Ate(o)); - this.hasMutatedConstraints = !!a, a && (o = g9(a)); - } - return o; - } - startAnimation(e) { - const { drag: r, dragMomentum: n, dragElastic: i, dragTransition: s, dragSnapToOrigin: o, onDragTransitionEnd: a } = this.getProps(), u = this.constraints || {}, l = Qi((d) => { - if (!Id(d, r, this.currentDirection)) - return; - let p = u && u[d] || {}; - o && (p = { min: 0, max: 0 }); - const w = i ? 200 : 1e6, _ = i ? 40 : 1e7, P = { - type: "inertia", - velocity: n ? e[d] : 0, - bounceStiffness: w, - bounceDamping: _, - timeConstant: 750, - restDelta: 1, - restSpeed: 10, - ...s, - ...p - }; - return this.startAxisValueAnimation(d, P); - }); - return Promise.all(l).then(a); - } - startAxisValueAnimation(e, r) { - const n = this.getAxisMotionValue(e); - return xv(this.visualElement, e), n.start(sy(e, n, 0, r, this.visualElement, !1)); - } - stopAnimation() { - Qi((e) => this.getAxisMotionValue(e).stop()); - } - pauseAnimation() { - Qi((e) => { - var r; - return (r = this.getAxisMotionValue(e).animation) === null || r === void 0 ? void 0 : r.pause(); - }); - } - getAnimationState(e) { - var r; - return (r = this.getAxisMotionValue(e).animation) === null || r === void 0 ? void 0 : r.state; - } - /** - * Drag works differently depending on which props are provided. - * - * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values. - * - Otherwise, we apply the delta to the x/y motion values. - */ - getAxisMotionValue(e) { - const r = `_drag${e.toUpperCase()}`, n = this.visualElement.getProps(), i = n[r]; - return i || this.visualElement.getValue(e, (n.initial ? n.initial[e] : void 0) || 0); - } - snapToCursor(e) { - Qi((r) => { - const { drag: n } = this.getProps(); - if (!Id(r, n, this.currentDirection)) - return; - const { projection: i } = this.visualElement, s = this.getAxisMotionValue(r); - if (i && i.layout) { - const { min: o, max: a } = i.layout.layoutBox[r]; - s.set(e[r] - Qr(o, a, 0.5)); - } - }); - } - /** - * When the viewport resizes we want to check if the measured constraints - * have changed and, if so, reposition the element within those new constraints - * relative to where it was before the resize. - */ - scalePositionWithinConstraints() { - if (!this.visualElement.current) - return; - const { drag: e, dragConstraints: r } = this.getProps(), { projection: n } = this.visualElement; - if (!lu(r) || !n || !this.constraints) - return; - this.stopAnimation(); - const i = { x: 0, y: 0 }; - Qi((o) => { - const a = this.getAxisMotionValue(o); - if (a && this.constraints !== !1) { - const u = a.get(); - i[o] = _te({ min: u, max: u }, this.constraints[o]); - } - }); - const { transformTemplate: s } = this.visualElement.getProps(); - this.visualElement.current.style.transform = s ? s({}, "") : "none", n.root && n.root.updateScroll(), n.updateLayout(), this.resolveConstraints(), Qi((o) => { - if (!Id(o, e, null)) - return; - const a = this.getAxisMotionValue(o), { min: u, max: l } = this.constraints[o]; - a.set(Qr(u, l, i[o])); - }); - } - addListeners() { - if (!this.visualElement.current) - return; - Cte.set(this.visualElement, this); - const e = this.visualElement.current, r = ko(e, "pointerdown", (u) => { - const { drag: l, dragListener: d = !0 } = this.getProps(); - l && d && this.start(u); - }), n = () => { - const { dragConstraints: u } = this.getProps(); - lu(u) && u.current && (this.constraints = this.resolveRefConstraints()); - }, { projection: i } = this.visualElement, s = i.addEventListener("measure", n); - i && !i.layout && (i.root && i.root.updateScroll(), i.updateLayout()), Lr.read(n); - const o = Ro(window, "resize", () => this.scalePositionWithinConstraints()), a = i.addEventListener("didUpdate", ({ delta: u, hasLayoutChanged: l }) => { - this.isDragging && l && (Qi((d) => { - const p = this.getAxisMotionValue(d); - p && (this.originPoint[d] += u[d].translate, p.set(p.get() + u[d].translate)); - }), this.visualElement.render()); - }); - return () => { - o(), r(), s(), a && a(); - }; - } - getProps() { - const e = this.visualElement.getProps(), { drag: r = !1, dragDirectionLock: n = !1, dragPropagation: i = !1, dragConstraints: s = !1, dragElastic: o = Ev, dragMomentum: a = !0 } = e; - return { - ...e, - drag: r, - dragDirectionLock: n, - dragPropagation: i, - dragConstraints: s, - dragElastic: o, - dragMomentum: a - }; - } -} -function Id(t, e, r) { - return (e === !0 || e === t) && (r === null || r === t); -} -function Rte(t, e = 10) { - let r = null; - return Math.abs(t.y) > e ? r = "y" : Math.abs(t.x) > e && (r = "x"), r; -} -class Dte extends $a { - constructor(e) { - super(e), this.removeGroupControls = Un, this.removeListeners = Un, this.controls = new Tte(e); - } - mount() { - const { dragControls: e } = this.node.getProps(); - e && (this.removeGroupControls = e.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || Un; - } - unmount() { - this.removeGroupControls(), this.removeListeners(); - } -} -const G_ = (t) => (e, r) => { - t && Lr.postRender(() => t(e, r)); -}; -class Ote extends $a { - constructor() { - super(...arguments), this.removePointerDownListener = Un; - } - onPointerDown(e) { - this.session = new c9(e, this.createPanHandlers(), { - transformPagePoint: this.node.getTransformPagePoint(), - contextWindow: y9(this.node) - }); - } - createPanHandlers() { - const { onPanSessionStart: e, onPanStart: r, onPan: n, onPanEnd: i } = this.node.getProps(); - return { - onSessionStart: G_(e), - onStart: G_(r), - onMove: n, - onEnd: (s, o) => { - delete this.session, i && Lr.postRender(() => i(s, o)); - } - }; - } - mount() { - this.removePointerDownListener = ko(this.node.current, "pointerdown", (e) => this.onPointerDown(e)); - } - update() { - this.session && this.session.updateHandlers(this.createPanHandlers()); - } - unmount() { - this.removePointerDownListener(), this.session && this.session.end(); - } -} -const kp = Ta(null); -function Nte() { - const t = Tn(kp); - if (t === null) - return [!0, null]; - const { isPresent: e, onExitComplete: r, register: n } = t, i = Ov(); - Dn(() => n(i), []); - const s = Nv(() => r && r(i), [i, r]); - return !e && r ? [!1, s] : [!0]; -} -const fy = Ta({}), w9 = Ta({}), Zd = { - /** - * Global flag as to whether the tree has animated since the last time - * we resized the window - */ - hasAnimatedSinceResize: !0, - /** - * We set this to true once, on the first update. Any nodes added to the tree beyond that - * update will be given a `data-projection-id` attribute. - */ - hasEverUpdated: !1 -}; -function Y_(t, e) { - return e.max === e.min ? 0 : t / (e.max - e.min) * 100; -} -const Uf = { - correct: (t, e) => { - if (!e.target) - return t; - if (typeof t == "string") - if (Vt.test(t)) - t = parseFloat(t); - else - return t; - const r = Y_(t, e.target.x), n = Y_(t, e.target.y); - return `${r}% ${n}%`; - } -}, Lte = { - correct: (t, { treeScale: e, projectionDelta: r }) => { - const n = t, i = Ia.parse(t); - if (i.length > 5) - return n; - const s = Ia.createTransformer(t), o = typeof i[0] != "number" ? 1 : 0, a = r.x.scale * e.x, u = r.y.scale * e.y; - i[0 + o] /= a, i[1 + o] /= u; - const l = Qr(a, u, 0.5); - return typeof i[2 + o] == "number" && (i[2 + o] /= l), typeof i[3 + o] == "number" && (i[3 + o] /= l), s(i); - } -}, N0 = {}; -function kte(t) { - Object.assign(N0, t); -} -const { schedule: ly } = _7(queueMicrotask, !1); -class $te extends fD { - /** - * This only mounts projection nodes for components that - * need measuring, we might want to do it for all components - * in order to incorporate transforms - */ - componentDidMount() { - const { visualElement: e, layoutGroup: r, switchLayoutGroup: n, layoutId: i } = this.props, { projection: s } = e; - kte(Bte), s && (r.group && r.group.add(s), n && n.register && i && n.register(s), s.root.didUpdate(), s.addEventListener("animationComplete", () => { - this.safeToRemove(); - }), s.setOptions({ - ...s.options, - onExitComplete: () => this.safeToRemove() - })), Zd.hasEverUpdated = !0; - } - getSnapshotBeforeUpdate(e) { - const { layoutDependency: r, visualElement: n, drag: i, isPresent: s } = this.props, o = n.projection; - return o && (o.isPresent = s, i || e.layoutDependency !== r || r === void 0 ? o.willUpdate() : this.safeToRemove(), e.isPresent !== s && (s ? o.promote() : o.relegate() || Lr.postRender(() => { - const a = o.getStack(); - (!a || !a.members.length) && this.safeToRemove(); - }))), null; - } - componentDidUpdate() { - const { projection: e } = this.props.visualElement; - e && (e.root.didUpdate(), ly.postRender(() => { - !e.currentAnimation && e.isLead() && this.safeToRemove(); - })); - } - componentWillUnmount() { - const { visualElement: e, layoutGroup: r, switchLayoutGroup: n } = this.props, { projection: i } = e; - i && (i.scheduleCheckAfterUnmount(), r && r.group && r.group.remove(i), n && n.deregister && n.deregister(i)); - } - safeToRemove() { - const { safeToRemove: e } = this.props; - e && e(); - } - render() { - return null; - } -} -function x9(t) { - const [e, r] = Nte(), n = Tn(fy); - return le.jsx($te, { ...t, layoutGroup: n, switchLayoutGroup: Tn(w9), isPresent: e, safeToRemove: r }); -} -const Bte = { - borderRadius: { - ...Uf, - applyTo: [ - "borderTopLeftRadius", - "borderTopRightRadius", - "borderBottomLeftRadius", - "borderBottomRightRadius" - ] - }, - borderTopLeftRadius: Uf, - borderTopRightRadius: Uf, - borderBottomLeftRadius: Uf, - borderBottomRightRadius: Uf, - boxShadow: Lte -}, _9 = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], Fte = _9.length, J_ = (t) => typeof t == "string" ? parseFloat(t) : t, X_ = (t) => typeof t == "number" || Vt.test(t); -function jte(t, e, r, n, i, s) { - i ? (t.opacity = Qr( - 0, - // TODO Reinstate this if only child - r.opacity !== void 0 ? r.opacity : 1, - Ute(n) - ), t.opacityExit = Qr(e.opacity !== void 0 ? e.opacity : 1, 0, qte(n))) : s && (t.opacity = Qr(e.opacity !== void 0 ? e.opacity : 1, r.opacity !== void 0 ? r.opacity : 1, n)); - for (let o = 0; o < Fte; o++) { - const a = `border${_9[o]}Radius`; - let u = Z_(e, a), l = Z_(r, a); - if (u === void 0 && l === void 0) - continue; - u || (u = 0), l || (l = 0), u === 0 || l === 0 || X_(u) === X_(l) ? (t[a] = Math.max(Qr(J_(u), J_(l), n), 0), (Xs.test(l) || Xs.test(u)) && (t[a] += "%")) : t[a] = l; - } - (e.rotate || r.rotate) && (t.rotate = Qr(e.rotate || 0, r.rotate || 0, n)); -} -function Z_(t, e) { - return t[e] !== void 0 ? t[e] : t.borderRadius; -} -const Ute = /* @__PURE__ */ E9(0, 0.5, C7), qte = /* @__PURE__ */ E9(0.5, 0.95, Un); -function E9(t, e, r) { - return (n) => n < t ? 0 : n > e ? 1 : r(Bu(t, e, n)); -} -function Q_(t, e) { - t.min = e.min, t.max = e.max; -} -function Xi(t, e) { - Q_(t.x, e.x), Q_(t.y, e.y); -} -function e5(t, e) { - t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin; -} -function t5(t, e, r, n, i) { - return t -= e, t = O0(t, 1 / r, n), i !== void 0 && (t = O0(t, 1 / i, n)), t; -} -function zte(t, e = 0, r = 1, n = 0.5, i, s = t, o = t) { - if (Xs.test(e) && (e = parseFloat(e), e = Qr(o.min, o.max, e / 100) - o.min), typeof e != "number") - return; - let a = Qr(s.min, s.max, n); - t === s && (a -= e), t.min = t5(t.min, e, r, a, i), t.max = t5(t.max, e, r, a, i); -} -function r5(t, e, [r, n, i], s, o) { - zte(t, e[r], e[n], e[i], e.scale, s, o); -} -const Wte = ["x", "scaleX", "originX"], Hte = ["y", "scaleY", "originY"]; -function n5(t, e, r, n) { - r5(t.x, e, Wte, r ? r.x : void 0, n ? n.x : void 0), r5(t.y, e, Hte, r ? r.y : void 0, n ? n.y : void 0); -} -function i5(t) { - return t.translate === 0 && t.scale === 1; -} -function S9(t) { - return i5(t.x) && i5(t.y); -} -function s5(t, e) { - return t.min === e.min && t.max === e.max; -} -function Kte(t, e) { - return s5(t.x, e.x) && s5(t.y, e.y); -} -function o5(t, e) { - return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max); -} -function A9(t, e) { - return o5(t.x, e.x) && o5(t.y, e.y); -} -function a5(t) { - return ki(t.x) / ki(t.y); -} -function c5(t, e) { - return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint; -} -class Vte { - constructor() { - this.members = []; - } - add(e) { - oy(this.members, e), e.scheduleRender(); - } - remove(e) { - if (ay(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) { - const r = this.members[this.members.length - 1]; - r && this.promote(r); - } - } - relegate(e) { - const r = this.members.findIndex((i) => e === i); - if (r === 0) - return !1; - let n; - for (let i = r; i >= 0; i--) { - const s = this.members[i]; - if (s.isPresent !== !1) { - n = s; - break; - } - } - return n ? (this.promote(n), !0) : !1; - } - promote(e, r) { - const n = this.lead; - if (e !== n && (this.prevLead = n, this.lead = e, e.show(), n)) { - n.instance && n.scheduleRender(), e.scheduleRender(), e.resumeFrom = n, r && (e.resumeFrom.preserveOpacity = !0), n.snapshot && (e.snapshot = n.snapshot, e.snapshot.latestValues = n.animationValues || n.latestValues), e.root && e.root.isUpdating && (e.isLayoutDirty = !0); - const { crossfade: i } = e.options; - i === !1 && n.hide(); - } - } - exitAnimationComplete() { - this.members.forEach((e) => { - const { options: r, resumingFrom: n } = e; - r.onExitComplete && r.onExitComplete(), n && n.options.onExitComplete && n.options.onExitComplete(); - }); - } - scheduleRender() { - this.members.forEach((e) => { - e.instance && e.scheduleRender(!1); - }); - } - /** - * Clear any leads that have been removed this render to prevent them from being - * used in future animations and to prevent memory leaks - */ - removeLeadSnapshot() { - this.lead && this.lead.snapshot && (this.lead.snapshot = void 0); - } -} -function Gte(t, e, r) { - let n = ""; - const i = t.x.translate / e.x, s = t.y.translate / e.y, o = (r == null ? void 0 : r.z) || 0; - if ((i || s || o) && (n = `translate3d(${i}px, ${s}px, ${o}px) `), (e.x !== 1 || e.y !== 1) && (n += `scale(${1 / e.x}, ${1 / e.y}) `), r) { - const { transformPerspective: l, rotate: d, rotateX: p, rotateY: w, skewX: _, skewY: P } = r; - l && (n = `perspective(${l}px) ${n}`), d && (n += `rotate(${d}deg) `), p && (n += `rotateX(${p}deg) `), w && (n += `rotateY(${w}deg) `), _ && (n += `skewX(${_}deg) `), P && (n += `skewY(${P}deg) `); - } - const a = t.x.scale * e.x, u = t.y.scale * e.y; - return (a !== 1 || u !== 1) && (n += `scale(${a}, ${u})`), n || "none"; -} -const Yte = (t, e) => t.depth - e.depth; -class Jte { - constructor() { - this.children = [], this.isDirty = !1; - } - add(e) { - oy(this.children, e), this.isDirty = !0; - } - remove(e) { - ay(this.children, e), this.isDirty = !0; - } - forEach(e) { - this.isDirty && this.children.sort(Yte), this.isDirty = !1, this.children.forEach(e); - } -} -function Qd(t) { - const e = Zn(t) ? t.get() : t; - return Uee(e) ? e.toValue() : e; -} -function Xte(t, e) { - const r = Zs.now(), n = ({ timestamp: i }) => { - const s = i - r; - s >= e && (Pa(n), t(s - e)); - }; - return Lr.read(n, !0), () => Pa(n); -} -function Zte(t) { - return t instanceof SVGElement && t.tagName !== "svg"; -} -function Qte(t, e, r) { - const n = Zn(t) ? t : ql(t); - return n.start(sy("", n, e, r)), n.animation; -} -const rc = { - type: "projectionFrame", - totalNodes: 0, - resolvedTargetDeltas: 0, - recalculatedProjection: 0 -}, Yf = typeof window < "u" && window.MotionDebug !== void 0, e1 = ["", "X", "Y", "Z"], ere = { visibility: "hidden" }, u5 = 1e3; -let tre = 0; -function t1(t, e, r, n) { - const { latestValues: i } = e; - i[t] && (r[t] = i[t], e.setStaticValue(t, 0), n && (n[t] = 0)); -} -function P9(t) { - if (t.hasCheckedOptimisedAppear = !0, t.root === t) - return; - const { visualElement: e } = t.options; - if (!e) - return; - const r = i9(e); - if (window.MotionHasOptimisedAnimation(r, "transform")) { - const { layout: i, layoutId: s } = t.options; - window.MotionCancelOptimisedAnimation(r, "transform", Lr, !(i || s)); - } - const { parent: n } = t; - n && !n.hasCheckedOptimisedAppear && P9(n); -} -function M9({ attachResizeListener: t, defaultParent: e, measureScroll: r, checkIsScrollRoot: n, resetTransform: i }) { - return class { - constructor(o = {}, a = e == null ? void 0 : e()) { - this.id = tre++, this.animationId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => { - this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots()); - }, this.updateProjection = () => { - this.projectionUpdateScheduled = !1, Yf && (rc.totalNodes = rc.resolvedTargetDeltas = rc.recalculatedProjection = 0), this.nodes.forEach(ire), this.nodes.forEach(ure), this.nodes.forEach(fre), this.nodes.forEach(sre), Yf && window.MotionDebug.record(rc); - }, this.resolvedRelativeTargetAt = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = o, this.root = a ? a.root || a : this, this.path = a ? [...a.path, a] : [], this.parent = a, this.depth = a ? a.depth + 1 : 0; - for (let u = 0; u < this.path.length; u++) - this.path[u].shouldResetTransform = !0; - this.root === this && (this.nodes = new Jte()); - } - addEventListener(o, a) { - return this.eventHandlers.has(o) || this.eventHandlers.set(o, new cy()), this.eventHandlers.get(o).add(a); - } - notifyListeners(o, ...a) { - const u = this.eventHandlers.get(o); - u && u.notify(...a); - } - hasListeners(o) { - return this.eventHandlers.has(o); - } - /** - * Lifecycles - */ - mount(o, a = this.root.hasTreeAnimated) { - if (this.instance) - return; - this.isSVG = Zte(o), this.instance = o; - const { layoutId: u, layout: l, visualElement: d } = this.options; - if (d && !d.current && d.mount(o), this.root.nodes.add(this), this.parent && this.parent.children.add(this), a && (l || u) && (this.isLayoutDirty = !0), t) { - let p; - const w = () => this.root.updateBlockedByResize = !1; - t(o, () => { - this.root.updateBlockedByResize = !0, p && p(), p = Xte(w, 250), Zd.hasAnimatedSinceResize && (Zd.hasAnimatedSinceResize = !1, this.nodes.forEach(l5)); - }); - } - u && this.root.registerSharedNode(u, this), this.options.animate !== !1 && d && (u || l) && this.addEventListener("didUpdate", ({ delta: p, hasLayoutChanged: w, hasRelativeTargetChanged: _, layout: P }) => { - if (this.isTreeAnimationBlocked()) { - this.target = void 0, this.relativeTarget = void 0; - return; - } - const O = this.options.transition || d.getDefaultTransition() || gre, { onLayoutAnimationStart: L, onLayoutAnimationComplete: B } = d.getProps(), k = !this.targetLayout || !A9(this.targetLayout, P) || _, W = !w && _; - if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || W || w && (k || !this.currentAnimation)) { - this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0), this.setAnimationOrigin(p, W); - const U = { - ...Hb(O, "layout"), - onPlay: L, - onComplete: B - }; - (d.shouldReduceMotion || this.options.layoutRoot) && (U.delay = 0, U.type = !1), this.startAnimation(U); - } else - w || l5(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete(); - this.targetLayout = P; - }); - } - unmount() { - this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this); - const o = this.getStack(); - o && o.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, Pa(this.updateProjection); - } - // only on the root - blockUpdate() { - this.updateManuallyBlocked = !0; - } - unblockUpdate() { - this.updateManuallyBlocked = !1; - } - isUpdateBlocked() { - return this.updateManuallyBlocked || this.updateBlockedByResize; - } - isTreeAnimationBlocked() { - return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || !1; - } - // Note: currently only running on root node - startUpdate() { - this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(lre), this.animationId++); - } - getTransformTemplate() { - const { visualElement: o } = this.options; - return o && o.getProps().transformTemplate; - } - willUpdate(o = !0) { - if (this.root.hasTreeAnimated = !0, this.root.isUpdateBlocked()) { - this.options.onExitComplete && this.options.onExitComplete(); - return; - } - if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && P9(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty) - return; - this.isLayoutDirty = !0; - for (let d = 0; d < this.path.length; d++) { - const p = this.path[d]; - p.shouldResetTransform = !0, p.updateScroll("snapshot"), p.options.layoutRoot && p.willUpdate(!1); - } - const { layoutId: a, layout: u } = this.options; - if (a === void 0 && !u) - return; - const l = this.getTransformTemplate(); - this.prevTransformTemplateValue = l ? l(this.latestValues, "") : void 0, this.updateSnapshot(), o && this.notifyListeners("willUpdate"); - } - update() { - if (this.updateScheduled = !1, this.isUpdateBlocked()) { - this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(f5); - return; - } - this.isUpdating || this.nodes.forEach(are), this.isUpdating = !1, this.nodes.forEach(cre), this.nodes.forEach(rre), this.nodes.forEach(nre), this.clearAllSnapshots(); - const a = Zs.now(); - Fn.delta = Ma(0, 1e3 / 60, a - Fn.timestamp), Fn.timestamp = a, Fn.isProcessing = !0, Km.update.process(Fn), Km.preRender.process(Fn), Km.render.process(Fn), Fn.isProcessing = !1; - } - didUpdate() { - this.updateScheduled || (this.updateScheduled = !0, ly.read(this.scheduleUpdate)); - } - clearAllSnapshots() { - this.nodes.forEach(ore), this.sharedNodes.forEach(hre); - } - scheduleUpdateProjection() { - this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, Lr.preRender(this.updateProjection, !1, !0)); - } - scheduleCheckAfterUnmount() { - Lr.postRender(() => { - this.isLayoutDirty ? this.root.didUpdate() : this.root.checkUpdateFailed(); - }); - } - /** - * Update measurements - */ - updateSnapshot() { - this.snapshot || !this.instance || (this.snapshot = this.measure()); - } - updateLayout() { - if (!this.instance || (this.updateScroll(), !(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty)) - return; - if (this.resumeFrom && !this.resumeFrom.instance) - for (let u = 0; u < this.path.length; u++) - this.path[u].updateScroll(); - const o = this.layout; - this.layout = this.measure(!1), this.layoutCorrected = ln(), this.isLayoutDirty = !1, this.projectionDelta = void 0, this.notifyListeners("measure", this.layout.layoutBox); - const { visualElement: a } = this.options; - a && a.notify("LayoutMeasure", this.layout.layoutBox, o ? o.layoutBox : void 0); - } - updateScroll(o = "measure") { - let a = !!(this.options.layoutScroll && this.instance); - if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === o && (a = !1), a) { - const u = n(this.instance); - this.scroll = { - animationId: this.root.animationId, - phase: o, - isRoot: u, - offset: r(this.instance), - wasRoot: this.scroll ? this.scroll.isRoot : u - }; - } - } - resetTransform() { - if (!i) - return; - const o = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, a = this.projectionDelta && !S9(this.projectionDelta), u = this.getTransformTemplate(), l = u ? u(this.latestValues, "") : void 0, d = l !== this.prevTransformTemplateValue; - o && (a || tc(this.latestValues) || d) && (i(this.instance, l), this.shouldResetTransform = !1, this.scheduleRender()); - } - measure(o = !0) { - const a = this.measurePageBox(); - let u = this.removeElementScroll(a); - return o && (u = this.removeTransform(u)), mre(u), { - animationId: this.root.animationId, - measuredBox: a, - layoutBox: u, - latestValues: {}, - source: this.id - }; - } - measurePageBox() { - var o; - const { visualElement: a } = this.options; - if (!a) - return ln(); - const u = a.measureViewportBox(); - if (!(((o = this.scroll) === null || o === void 0 ? void 0 : o.wasRoot) || this.path.some(vre))) { - const { scroll: d } = this.root; - d && (du(u.x, d.offset.x), du(u.y, d.offset.y)); - } - return u; - } - removeElementScroll(o) { - var a; - const u = ln(); - if (Xi(u, o), !((a = this.scroll) === null || a === void 0) && a.wasRoot) - return u; - for (let l = 0; l < this.path.length; l++) { - const d = this.path[l], { scroll: p, options: w } = d; - d !== this.root && p && w.layoutScroll && (p.wasRoot && Xi(u, o), du(u.x, p.offset.x), du(u.y, p.offset.y)); - } - return u; - } - applyTransform(o, a = !1) { - const u = ln(); - Xi(u, o); - for (let l = 0; l < this.path.length; l++) { - const d = this.path[l]; - !a && d.options.layoutScroll && d.scroll && d !== d.root && pu(u, { - x: -d.scroll.offset.x, - y: -d.scroll.offset.y - }), tc(d.latestValues) && pu(u, d.latestValues); - } - return tc(this.latestValues) && pu(u, this.latestValues), u; - } - removeTransform(o) { - const a = ln(); - Xi(a, o); - for (let u = 0; u < this.path.length; u++) { - const l = this.path[u]; - if (!l.instance || !tc(l.latestValues)) - continue; - Sv(l.latestValues) && l.updateSnapshot(); - const d = ln(), p = l.measurePageBox(); - Xi(d, p), n5(a, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, d); - } - return tc(this.latestValues) && n5(a, this.latestValues), a; - } - setTargetDelta(o) { - this.targetDelta = o, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0; - } - setOptions(o) { - this.options = { - ...this.options, - ...o, - crossfade: o.crossfade !== void 0 ? o.crossfade : !0 - }; - } - clearMeasurements() { - this.scroll = void 0, this.layout = void 0, this.snapshot = void 0, this.prevTransformTemplateValue = void 0, this.targetDelta = void 0, this.target = void 0, this.isLayoutDirty = !1; - } - forceRelativeParentToResolveTarget() { - this.relativeParent && this.relativeParent.resolvedRelativeTargetAt !== Fn.timestamp && this.relativeParent.resolveTargetDelta(!0); - } - resolveTargetDelta(o = !1) { - var a; - const u = this.getLead(); - this.isProjectionDirty || (this.isProjectionDirty = u.isProjectionDirty), this.isTransformDirty || (this.isTransformDirty = u.isTransformDirty), this.isSharedProjectionDirty || (this.isSharedProjectionDirty = u.isSharedProjectionDirty); - const l = !!this.resumingFrom || this !== u; - if (!(o || l && this.isSharedProjectionDirty || this.isProjectionDirty || !((a = this.parent) === null || a === void 0) && a.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize)) - return; - const { layout: p, layoutId: w } = this.options; - if (!(!this.layout || !(p || w))) { - if (this.resolvedRelativeTargetAt = Fn.timestamp, !this.targetDelta && !this.relativeTarget) { - const _ = this.getClosestProjectingParent(); - _ && _.layout && this.animationProgress !== 1 ? (this.relativeParent = _, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), sl(this.relativeTargetOrigin, this.layout.layoutBox, _.layout.layoutBox), Xi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; - } - if (!(!this.relativeTarget && !this.targetDelta)) { - if (this.target || (this.target = ln(), this.targetWithTransforms = ln()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), bte(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : Xi(this.target, this.layout.layoutBox), v9(this.target, this.targetDelta)) : Xi(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget) { - this.attemptToResolveRelativeTarget = !1; - const _ = this.getClosestProjectingParent(); - _ && !!_.resumingFrom == !!this.resumingFrom && !_.options.layoutScroll && _.target && this.animationProgress !== 1 ? (this.relativeParent = _, this.forceRelativeParentToResolveTarget(), this.relativeTarget = ln(), this.relativeTargetOrigin = ln(), sl(this.relativeTargetOrigin, this.target, _.target), Xi(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0; - } - Yf && rc.resolvedTargetDeltas++; - } - } - } - getClosestProjectingParent() { - if (!(!this.parent || Sv(this.parent.latestValues) || m9(this.parent.latestValues))) - return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent(); - } - isProjecting() { - return !!((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout); - } - calcProjection() { - var o; - const a = this.getLead(), u = !!this.resumingFrom || this !== a; - let l = !0; - if ((this.isProjectionDirty || !((o = this.parent) === null || o === void 0) && o.isProjectionDirty) && (l = !1), u && (this.isSharedProjectionDirty || this.isTransformDirty) && (l = !1), this.resolvedRelativeTargetAt === Fn.timestamp && (l = !1), l) - return; - const { layout: d, layoutId: p } = this.options; - if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(d || p)) - return; - Xi(this.layoutCorrected, this.layout.layoutBox); - const w = this.treeScale.x, _ = this.treeScale.y; - Mte(this.layoutCorrected, this.treeScale, this.path, u), a.layout && !a.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (a.target = a.layout.layoutBox, a.targetWithTransforms = ln()); - const { target: P } = a; - if (!P) { - this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender()); - return; - } - !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (e5(this.prevProjectionDelta.x, this.projectionDelta.x), e5(this.prevProjectionDelta.y, this.projectionDelta.y)), il(this.projectionDelta, this.layoutCorrected, P, this.latestValues), (this.treeScale.x !== w || this.treeScale.y !== _ || !c5(this.projectionDelta.x, this.prevProjectionDelta.x) || !c5(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", P)), Yf && rc.recalculatedProjection++; - } - hide() { - this.isVisible = !1; - } - show() { - this.isVisible = !0; - } - scheduleRender(o = !0) { - var a; - if ((a = this.options.visualElement) === null || a === void 0 || a.scheduleRender(), o) { - const u = this.getStack(); - u && u.scheduleRender(); - } - this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0); - } - createProjectionDeltas() { - this.prevProjectionDelta = hu(), this.projectionDelta = hu(), this.projectionDeltaWithTransform = hu(); - } - setAnimationOrigin(o, a = !1) { - const u = this.snapshot, l = u ? u.latestValues : {}, d = { ...this.latestValues }, p = hu(); - (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !a; - const w = ln(), _ = u ? u.source : void 0, P = this.layout ? this.layout.source : void 0, O = _ !== P, L = this.getStack(), B = !L || L.members.length <= 1, k = !!(O && !B && this.options.crossfade === !0 && !this.path.some(pre)); - this.animationProgress = 0; - let W; - this.mixTargetDelta = (U) => { - const V = U / 1e3; - h5(p.x, o.x, V), h5(p.y, o.y, V), this.setTargetDelta(p), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (sl(w, this.layout.layoutBox, this.relativeParent.layout.layoutBox), dre(this.relativeTarget, this.relativeTargetOrigin, w, V), W && Kte(this.relativeTarget, W) && (this.isProjectionDirty = !1), W || (W = ln()), Xi(W, this.relativeTarget)), O && (this.animationValues = d, jte(d, l, this.latestValues, V, k, B)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V; - }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0); - } - startAnimation(o) { - this.notifyListeners("animationStart"), this.currentAnimation && this.currentAnimation.stop(), this.resumingFrom && this.resumingFrom.currentAnimation && this.resumingFrom.currentAnimation.stop(), this.pendingAnimation && (Pa(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = Lr.update(() => { - Zd.hasAnimatedSinceResize = !0, this.currentAnimation = Qte(0, u5, { - ...o, - onUpdate: (a) => { - this.mixTargetDelta(a), o.onUpdate && o.onUpdate(a); - }, - onComplete: () => { - o.onComplete && o.onComplete(), this.completeAnimation(); - } - }), this.resumingFrom && (this.resumingFrom.currentAnimation = this.currentAnimation), this.pendingAnimation = void 0; - }); - } - completeAnimation() { - this.resumingFrom && (this.resumingFrom.currentAnimation = void 0, this.resumingFrom.preserveOpacity = void 0); - const o = this.getStack(); - o && o.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete"); - } - finishAnimation() { - this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(u5), this.currentAnimation.stop()), this.completeAnimation(); - } - applyTransformsToTarget() { - const o = this.getLead(); - let { targetWithTransforms: a, target: u, layout: l, latestValues: d } = o; - if (!(!a || !u || !l)) { - if (this !== o && this.layout && l && I9(this.options.animationType, this.layout.layoutBox, l.layoutBox)) { - u = this.target || ln(); - const p = ki(this.layout.layoutBox.x); - u.x.min = o.target.x.min, u.x.max = u.x.min + p; - const w = ki(this.layout.layoutBox.y); - u.y.min = o.target.y.min, u.y.max = u.y.min + w; - } - Xi(a, u), pu(a, d), il(this.projectionDeltaWithTransform, this.layoutCorrected, a, d); - } - } - registerSharedNode(o, a) { - this.sharedNodes.has(o) || this.sharedNodes.set(o, new Vte()), this.sharedNodes.get(o).add(a); - const l = a.options.initialPromotionConfig; - a.promote({ - transition: l ? l.transition : void 0, - preserveFollowOpacity: l && l.shouldPreserveFollowOpacity ? l.shouldPreserveFollowOpacity(a) : void 0 - }); - } - isLead() { - const o = this.getStack(); - return o ? o.lead === this : !0; - } - getLead() { - var o; - const { layoutId: a } = this.options; - return a ? ((o = this.getStack()) === null || o === void 0 ? void 0 : o.lead) || this : this; - } - getPrevLead() { - var o; - const { layoutId: a } = this.options; - return a ? (o = this.getStack()) === null || o === void 0 ? void 0 : o.prevLead : void 0; - } - getStack() { - const { layoutId: o } = this.options; - if (o) - return this.root.sharedNodes.get(o); - } - promote({ needsReset: o, transition: a, preserveFollowOpacity: u } = {}) { - const l = this.getStack(); - l && l.promote(this, u), o && (this.projectionDelta = void 0, this.needsReset = !0), a && this.setOptions({ transition: a }); - } - relegate() { - const o = this.getStack(); - return o ? o.relegate(this) : !1; - } - resetSkewAndRotation() { - const { visualElement: o } = this.options; - if (!o) - return; - let a = !1; - const { latestValues: u } = o; - if ((u.z || u.rotate || u.rotateX || u.rotateY || u.rotateZ || u.skewX || u.skewY) && (a = !0), !a) - return; - const l = {}; - u.z && t1("z", o, l, this.animationValues); - for (let d = 0; d < e1.length; d++) - t1(`rotate${e1[d]}`, o, l, this.animationValues), t1(`skew${e1[d]}`, o, l, this.animationValues); - o.render(); - for (const d in l) - o.setStaticValue(d, l[d]), this.animationValues && (this.animationValues[d] = l[d]); - o.scheduleRender(); - } - getProjectionStyles(o) { - var a, u; - if (!this.instance || this.isSVG) - return; - if (!this.isVisible) - return ere; - const l = { - visibility: "" - }, d = this.getTransformTemplate(); - if (this.needsReset) - return this.needsReset = !1, l.opacity = "", l.pointerEvents = Qd(o == null ? void 0 : o.pointerEvents) || "", l.transform = d ? d(this.latestValues, "") : "none", l; - const p = this.getLead(); - if (!this.projectionDelta || !this.layout || !p.target) { - const O = {}; - return this.options.layoutId && (O.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, O.pointerEvents = Qd(o == null ? void 0 : o.pointerEvents) || ""), this.hasProjected && !tc(this.latestValues) && (O.transform = d ? d({}, "") : "none", this.hasProjected = !1), O; - } - const w = p.animationValues || p.latestValues; - this.applyTransformsToTarget(), l.transform = Gte(this.projectionDeltaWithTransform, this.treeScale, w), d && (l.transform = d(w, l.transform)); - const { x: _, y: P } = this.projectionDelta; - l.transformOrigin = `${_.origin * 100}% ${P.origin * 100}% 0`, p.animationValues ? l.opacity = p === this ? (u = (a = w.opacity) !== null && a !== void 0 ? a : this.latestValues.opacity) !== null && u !== void 0 ? u : 1 : this.preserveOpacity ? this.latestValues.opacity : w.opacityExit : l.opacity = p === this ? w.opacity !== void 0 ? w.opacity : "" : w.opacityExit !== void 0 ? w.opacityExit : 0; - for (const O in N0) { - if (w[O] === void 0) - continue; - const { correct: L, applyTo: B } = N0[O], k = l.transform === "none" ? w[O] : L(w[O], p); - if (B) { - const W = B.length; - for (let U = 0; U < W; U++) - l[B[U]] = k; - } else - l[O] = k; - } - return this.options.layoutId && (l.pointerEvents = p === this ? Qd(o == null ? void 0 : o.pointerEvents) || "" : "none"), l; - } - clearSnapshot() { - this.resumeFrom = this.snapshot = void 0; - } - // Only run on root - resetTree() { - this.root.nodes.forEach((o) => { - var a; - return (a = o.currentAnimation) === null || a === void 0 ? void 0 : a.stop(); - }), this.root.nodes.forEach(f5), this.root.sharedNodes.clear(); - } - }; -} -function rre(t) { - t.updateLayout(); -} -function nre(t) { - var e; - const r = ((e = t.resumeFrom) === null || e === void 0 ? void 0 : e.snapshot) || t.snapshot; - if (t.isLead() && t.layout && r && t.hasListeners("didUpdate")) { - const { layoutBox: n, measuredBox: i } = t.layout, { animationType: s } = t.options, o = r.source !== t.layout.source; - s === "size" ? Qi((p) => { - const w = o ? r.measuredBox[p] : r.layoutBox[p], _ = ki(w); - w.min = n[p].min, w.max = w.min + _; - }) : I9(s, r.layoutBox, n) && Qi((p) => { - const w = o ? r.measuredBox[p] : r.layoutBox[p], _ = ki(n[p]); - w.max = w.min + _, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[p].max = t.relativeTarget[p].min + _); - }); - const a = hu(); - il(a, n, r.layoutBox); - const u = hu(); - o ? il(u, t.applyTransform(i, !0), r.measuredBox) : il(u, n, r.layoutBox); - const l = !S9(a); - let d = !1; - if (!t.resumeFrom) { - const p = t.getClosestProjectingParent(); - if (p && !p.resumeFrom) { - const { snapshot: w, layout: _ } = p; - if (w && _) { - const P = ln(); - sl(P, r.layoutBox, w.layoutBox); - const O = ln(); - sl(O, n, _.layoutBox), A9(P, O) || (d = !0), p.options.layoutRoot && (t.relativeTarget = O, t.relativeTargetOrigin = P, t.relativeParent = p); - } - } - } - t.notifyListeners("didUpdate", { - layout: n, - snapshot: r, - delta: u, - layoutDelta: a, - hasLayoutChanged: l, - hasRelativeTargetChanged: d - }); - } else if (t.isLead()) { - const { onExitComplete: n } = t.options; - n && n(); - } - t.options.transition = void 0; -} -function ire(t) { - Yf && rc.totalNodes++, t.parent && (t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty), t.isSharedProjectionDirty || (t.isSharedProjectionDirty = !!(t.isProjectionDirty || t.parent.isProjectionDirty || t.parent.isSharedProjectionDirty)), t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty)); -} -function sre(t) { - t.isProjectionDirty = t.isSharedProjectionDirty = t.isTransformDirty = !1; -} -function ore(t) { - t.clearSnapshot(); -} -function f5(t) { - t.clearMeasurements(); -} -function are(t) { - t.isLayoutDirty = !1; -} -function cre(t) { - const { visualElement: e } = t.options; - e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform(); -} -function l5(t) { - t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0; -} -function ure(t) { - t.resolveTargetDelta(); -} -function fre(t) { - t.calcProjection(); -} -function lre(t) { - t.resetSkewAndRotation(); -} -function hre(t) { - t.removeLeadSnapshot(); -} -function h5(t, e, r) { - t.translate = Qr(e.translate, 0, r), t.scale = Qr(e.scale, 1, r), t.origin = e.origin, t.originPoint = e.originPoint; -} -function d5(t, e, r, n) { - t.min = Qr(e.min, r.min, n), t.max = Qr(e.max, r.max, n); -} -function dre(t, e, r, n) { - d5(t.x, e.x, r.x, n), d5(t.y, e.y, r.y, n); -} -function pre(t) { - return t.animationValues && t.animationValues.opacityExit !== void 0; -} -const gre = { - duration: 0.45, - ease: [0.4, 0, 0.1, 1] -}, p5 = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), g5 = p5("applewebkit/") && !p5("chrome/") ? Math.round : Un; -function m5(t) { - t.min = g5(t.min), t.max = g5(t.max); -} -function mre(t) { - m5(t.x), m5(t.y); -} -function I9(t, e, r) { - return t === "position" || t === "preserve-aspect" && !vte(a5(e), a5(r), 0.2); -} -function vre(t) { - var e; - return t !== t.root && ((e = t.scroll) === null || e === void 0 ? void 0 : e.wasRoot); -} -const bre = M9({ - attachResizeListener: (t, e) => Ro(t, "resize", e), - measureScroll: () => ({ - x: document.documentElement.scrollLeft || document.body.scrollLeft, - y: document.documentElement.scrollTop || document.body.scrollTop - }), - checkIsScrollRoot: () => !0 -}), r1 = { - current: void 0 -}, C9 = M9({ - measureScroll: (t) => ({ - x: t.scrollLeft, - y: t.scrollTop - }), - defaultParent: () => { - if (!r1.current) { - const t = new bre({}); - t.mount(window), t.setOptions({ layoutScroll: !0 }), r1.current = t; - } - return r1.current; - }, - resetTransform: (t, e) => { - t.style.transform = e !== void 0 ? e : "none"; - }, - checkIsScrollRoot: (t) => window.getComputedStyle(t).position === "fixed" -}), yre = { - pan: { - Feature: Ote - }, - drag: { - Feature: Dte, - ProjectionNode: C9, - MeasureLayout: x9 - } -}; -function v5(t, e) { - const r = e ? "pointerenter" : "pointerleave", n = e ? "onHoverStart" : "onHoverEnd", i = (s, o) => { - if (s.pointerType === "touch" || h9()) - return; - const a = t.getProps(); - t.animationState && a.whileHover && t.animationState.setActive("whileHover", e); - const u = a[n]; - u && Lr.postRender(() => u(s, o)); - }; - return ko(t.current, r, i, { - passive: !t.getProps()[n] - }); -} -class wre extends $a { - mount() { - this.unmount = Lo(v5(this.node, !0), v5(this.node, !1)); - } - unmount() { - } -} -class xre extends $a { - constructor() { - super(...arguments), this.isActive = !1; - } - onFocus() { - let e = !1; - try { - e = this.node.current.matches(":focus-visible"); - } catch { - e = !0; - } - !e || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0); - } - onBlur() { - !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1); - } - mount() { - this.unmount = Lo(Ro(this.node.current, "focus", () => this.onFocus()), Ro(this.node.current, "blur", () => this.onBlur())); - } - unmount() { - } -} -const T9 = (t, e) => e ? t === e ? !0 : T9(t, e.parentElement) : !1; -function n1(t, e) { - if (!e) - return; - const r = new PointerEvent("pointer" + t); - e(r, Lp(r)); -} -class _re extends $a { - constructor() { - super(...arguments), this.removeStartListeners = Un, this.removeEndListeners = Un, this.removeAccessibleListeners = Un, this.startPointerPress = (e, r) => { - if (this.isPressing) - return; - this.removeEndListeners(); - const n = this.node.getProps(), s = ko(window, "pointerup", (a, u) => { - if (!this.checkPressEnd()) - return; - const { onTap: l, onTapCancel: d, globalTapTarget: p } = this.node.getProps(), w = !p && !T9(this.node.current, a.target) ? d : l; - w && Lr.update(() => w(a, u)); - }, { - passive: !(n.onTap || n.onPointerUp) - }), o = ko(window, "pointercancel", (a, u) => this.cancelPress(a, u), { - passive: !(n.onTapCancel || n.onPointerCancel) - }); - this.removeEndListeners = Lo(s, o), this.startPress(e, r); - }, this.startAccessiblePress = () => { - const e = (s) => { - if (s.key !== "Enter" || this.isPressing) - return; - const o = (a) => { - a.key !== "Enter" || !this.checkPressEnd() || n1("up", (u, l) => { - const { onTap: d } = this.node.getProps(); - d && Lr.postRender(() => d(u, l)); - }); - }; - this.removeEndListeners(), this.removeEndListeners = Ro(this.node.current, "keyup", o), n1("down", (a, u) => { - this.startPress(a, u); - }); - }, r = Ro(this.node.current, "keydown", e), n = () => { - this.isPressing && n1("cancel", (s, o) => this.cancelPress(s, o)); - }, i = Ro(this.node.current, "blur", n); - this.removeAccessibleListeners = Lo(r, i); - }; - } - startPress(e, r) { - this.isPressing = !0; - const { onTapStart: n, whileTap: i } = this.node.getProps(); - i && this.node.animationState && this.node.animationState.setActive("whileTap", !0), n && Lr.postRender(() => n(e, r)); - } - checkPressEnd() { - return this.removeEndListeners(), this.isPressing = !1, this.node.getProps().whileTap && this.node.animationState && this.node.animationState.setActive("whileTap", !1), !h9(); - } - cancelPress(e, r) { - if (!this.checkPressEnd()) - return; - const { onTapCancel: n } = this.node.getProps(); - n && Lr.postRender(() => n(e, r)); - } - mount() { - const e = this.node.getProps(), r = ko(e.globalTapTarget ? window : this.node.current, "pointerdown", this.startPointerPress, { - passive: !(e.onTapStart || e.onPointerStart) - }), n = Ro(this.node.current, "focus", this.startAccessiblePress); - this.removeStartListeners = Lo(r, n); - } - unmount() { - this.removeStartListeners(), this.removeEndListeners(), this.removeAccessibleListeners(); - } -} -const Pv = /* @__PURE__ */ new WeakMap(), i1 = /* @__PURE__ */ new WeakMap(), Ere = (t) => { - const e = Pv.get(t.target); - e && e(t); -}, Sre = (t) => { - t.forEach(Ere); -}; -function Are({ root: t, ...e }) { - const r = t || document; - i1.has(r) || i1.set(r, {}); - const n = i1.get(r), i = JSON.stringify(e); - return n[i] || (n[i] = new IntersectionObserver(Sre, { root: t, ...e })), n[i]; -} -function Pre(t, e, r) { - const n = Are(e); - return Pv.set(t, r), n.observe(t), () => { - Pv.delete(t), n.unobserve(t); - }; -} -const Mre = { - some: 0, - all: 1 -}; -class Ire extends $a { - constructor() { - super(...arguments), this.hasEnteredView = !1, this.isInView = !1; - } - startObserver() { - this.unmount(); - const { viewport: e = {} } = this.node.getProps(), { root: r, margin: n, amount: i = "some", once: s } = e, o = { - root: r ? r.current : void 0, - rootMargin: n, - threshold: typeof i == "number" ? i : Mre[i] - }, a = (u) => { - const { isIntersecting: l } = u; - if (this.isInView === l || (this.isInView = l, s && !l && this.hasEnteredView)) - return; - l && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", l); - const { onViewportEnter: d, onViewportLeave: p } = this.node.getProps(), w = l ? d : p; - w && w(u); - }; - return Pre(this.node.current, o, a); - } - mount() { - this.startObserver(); - } - update() { - if (typeof IntersectionObserver > "u") - return; - const { props: e, prevProps: r } = this.node; - ["amount", "margin", "root"].some(Cre(e, r)) && this.startObserver(); - } - unmount() { - } -} -function Cre({ viewport: t = {} }, { viewport: e = {} } = {}) { - return (r) => t[r] !== e[r]; -} -const Tre = { - inView: { - Feature: Ire - }, - tap: { - Feature: _re - }, - focus: { - Feature: xre - }, - hover: { - Feature: wre - } -}, Rre = { - layout: { - ProjectionNode: C9, - MeasureLayout: x9 - } -}, hy = Ta({ - transformPagePoint: (t) => t, - isStatic: !1, - reducedMotion: "never" -}), $p = Ta({}), dy = typeof window < "u", R9 = dy ? lD : Dn, D9 = Ta({ strict: !1 }); -function Dre(t, e, r, n, i) { - var s, o; - const { visualElement: a } = Tn($p), u = Tn(D9), l = Tn(kp), d = Tn(hy).reducedMotion, p = Qn(); - n = n || u.renderer, !p.current && n && (p.current = n(t, { - visualState: e, - parent: a, - props: r, - presenceContext: l, - blockInitialAnimation: l ? l.initial === !1 : !1, - reducedMotionConfig: d - })); - const w = p.current, _ = Tn(w9); - w && !w.projection && i && (w.type === "html" || w.type === "svg") && Ore(p.current, r, i, _); - const P = Qn(!1); - L5(() => { - w && P.current && w.update(r, l); - }); - const O = r[n9], L = Qn(!!O && !(!((s = window.MotionHandoffIsComplete) === null || s === void 0) && s.call(window, O)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, O))); - return R9(() => { - w && (P.current = !0, window.MotionIsMounted = !0, w.updateFeatures(), ly.render(w.render), L.current && w.animationState && w.animationState.animateChanges()); - }), Dn(() => { - w && (!L.current && w.animationState && w.animationState.animateChanges(), L.current && (queueMicrotask(() => { - var B; - (B = window.MotionHandoffMarkAsComplete) === null || B === void 0 || B.call(window, O); - }), L.current = !1)); - }), w; -} -function Ore(t, e, r, n) { - const { layoutId: i, layout: s, drag: o, dragConstraints: a, layoutScroll: u, layoutRoot: l } = e; - t.projection = new r(t.latestValues, e["data-framer-portal-id"] ? void 0 : O9(t.parent)), t.projection.setOptions({ - layoutId: i, - layout: s, - alwaysMeasureLayout: !!o || a && lu(a), - visualElement: t, - /** - * TODO: Update options in an effect. This could be tricky as it'll be too late - * to update by the time layout animations run. - * We also need to fix this safeToRemove by linking it up to the one returned by usePresence, - * ensuring it gets called if there's no potential layout animations. - * - */ - animationType: typeof s == "string" ? s : "both", - initialPromotionConfig: n, - layoutScroll: u, - layoutRoot: l - }); -} -function O9(t) { - if (t) - return t.options.allowProjection !== !1 ? t.projection : O9(t.parent); -} -function Nre(t, e, r) { - return Nv( - (n) => { - n && t.mount && t.mount(n), e && (n ? e.mount(n) : e.unmount()), r && (typeof r == "function" ? r(n) : lu(r) && (r.current = n)); - }, - /** - * Only pass a new ref callback to React if we've received a visual element - * factory. Otherwise we'll be mounting/remounting every time externalRef - * or other dependencies change. - */ - [e] - ); -} -function Bp(t) { - return Dp(t.animate) || Wb.some((e) => Fl(t[e])); -} -function N9(t) { - return !!(Bp(t) || t.variants); -} -function Lre(t, e) { - if (Bp(t)) { - const { initial: r, animate: n } = t; - return { - initial: r === !1 || Fl(r) ? r : void 0, - animate: Fl(n) ? n : void 0 - }; - } - return t.inherit !== !1 ? e : {}; -} -function kre(t) { - const { initial: e, animate: r } = Lre(t, Tn($p)); - return wi(() => ({ initial: e, animate: r }), [b5(e), b5(r)]); -} -function b5(t) { - return Array.isArray(t) ? t.join(" ") : t; -} -const y5 = { - animation: [ - "animate", - "variants", - "whileHover", - "whileTap", - "exit", - "whileInView", - "whileFocus", - "whileDrag" - ], - exit: ["exit"], - drag: ["drag", "dragControls"], - focus: ["whileFocus"], - hover: ["whileHover", "onHoverStart", "onHoverEnd"], - tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"], - pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"], - inView: ["whileInView", "onViewportEnter", "onViewportLeave"], - layout: ["layout", "layoutId"] -}, Fu = {}; -for (const t in y5) - Fu[t] = { - isEnabled: (e) => y5[t].some((r) => !!e[r]) - }; -function $re(t) { - for (const e in t) - Fu[e] = { - ...Fu[e], - ...t[e] - }; -} -const Bre = Symbol.for("motionComponentSymbol"); -function Fre({ preloadedFeatures: t, createVisualElement: e, useRender: r, useVisualState: n, Component: i }) { - t && $re(t); - function s(a, u) { - let l; - const d = { - ...Tn(hy), - ...a, - layoutId: jre(a) - }, { isStatic: p } = d, w = kre(a), _ = n(a, p); - if (!p && dy) { - Ure(d, t); - const P = qre(d); - l = P.MeasureLayout, w.visualElement = Dre(i, _, d, e, P.ProjectionNode); - } - return le.jsxs($p.Provider, { value: w, children: [l && w.visualElement ? le.jsx(l, { visualElement: w.visualElement, ...d }) : null, r(i, a, Nre(_, w.visualElement, u), _, p, w.visualElement)] }); - } - const o = Dv(s); - return o[Bre] = i, o; -} -function jre({ layoutId: t }) { - const e = Tn(fy).id; - return e && t !== void 0 ? e + "-" + t : t; -} -function Ure(t, e) { - const r = Tn(D9).strict; - if (process.env.NODE_ENV !== "production" && e && r) { - const n = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead."; - t.ignoreStrict ? ef(!1, n) : Wo(!1, n); - } -} -function qre(t) { - const { drag: e, layout: r } = Fu; - if (!e && !r) - return {}; - const n = { ...e, ...r }; - return { - MeasureLayout: e != null && e.isEnabled(t) || r != null && r.isEnabled(t) ? n.MeasureLayout : void 0, - ProjectionNode: n.ProjectionNode - }; -} -const zre = [ - "animate", - "circle", - "defs", - "desc", - "ellipse", - "g", - "image", - "line", - "filter", - "marker", - "mask", - "metadata", - "path", - "pattern", - "polygon", - "polyline", - "rect", - "stop", - "switch", - "symbol", - "svg", - "text", - "tspan", - "use", - "view" -]; -function py(t) { - return ( - /** - * If it's not a string, it's a custom React component. Currently we only support - * HTML custom React components. - */ - typeof t != "string" || /** - * If it contains a dash, the element is a custom HTML webcomponent. - */ - t.includes("-") ? !1 : ( - /** - * If it's in our list of lowercase SVG tags, it's an SVG component - */ - !!(zre.indexOf(t) > -1 || /** - * If it contains a capital letter, it's an SVG component - */ - /[A-Z]/u.test(t)) - ) - ); -} -function L9(t, { style: e, vars: r }, n, i) { - Object.assign(t.style, e, i && i.getProjectionStyles(n)); - for (const s in r) - t.style.setProperty(s, r[s]); -} -const k9 = /* @__PURE__ */ new Set([ - "baseFrequency", - "diffuseConstant", - "kernelMatrix", - "kernelUnitLength", - "keySplines", - "keyTimes", - "limitingConeAngle", - "markerHeight", - "markerWidth", - "numOctaves", - "targetX", - "targetY", - "surfaceScale", - "specularConstant", - "specularExponent", - "stdDeviation", - "tableValues", - "viewBox", - "gradientTransform", - "pathLength", - "startOffset", - "textLength", - "lengthAdjust" -]); -function $9(t, e, r, n) { - L9(t, e, void 0, n); - for (const i in e.attrs) - t.setAttribute(k9.has(i) ? i : uy(i), e.attrs[i]); -} -function B9(t, { layout: e, layoutId: r }) { - return Lc.has(t) || t.startsWith("origin") || (e || r !== void 0) && (!!N0[t] || t === "opacity"); -} -function gy(t, e, r) { - var n; - const { style: i } = t, s = {}; - for (const o in i) - (Zn(i[o]) || e.style && Zn(e.style[o]) || B9(o, t) || ((n = r == null ? void 0 : r.getValue(o)) === null || n === void 0 ? void 0 : n.liveStyle) !== void 0) && (s[o] = i[o]); - return s; -} -function F9(t, e, r) { - const n = gy(t, e, r); - for (const i in t) - if (Zn(t[i]) || Zn(e[i])) { - const s = mh.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i; - n[s] = t[i]; - } - return n; -} -function my(t) { - const e = Qn(null); - return e.current === null && (e.current = t()), e.current; -} -function Wre({ scrapeMotionValuesFromProps: t, createRenderState: e, onMount: r }, n, i, s) { - const o = { - latestValues: Hre(n, i, s, t), - renderState: e() - }; - return r && (o.mount = (a) => r(n, a, o)), o; -} -const j9 = (t) => (e, r) => { - const n = Tn($p), i = Tn(kp), s = () => Wre(t, e, n, i); - return r ? s() : my(s); -}; -function Hre(t, e, r, n) { - const i = {}, s = n(t, {}); - for (const w in s) - i[w] = Qd(s[w]); - let { initial: o, animate: a } = t; - const u = Bp(t), l = N9(t); - e && l && !u && t.inherit !== !1 && (o === void 0 && (o = e.initial), a === void 0 && (a = e.animate)); - let d = r ? r.initial === !1 : !1; - d = d || o === !1; - const p = d ? a : o; - if (p && typeof p != "boolean" && !Dp(p)) { - const w = Array.isArray(p) ? p : [p]; - for (let _ = 0; _ < w.length; _++) { - const P = qb(t, w[_]); - if (P) { - const { transitionEnd: O, transition: L, ...B } = P; - for (const k in B) { - let W = B[k]; - if (Array.isArray(W)) { - const U = d ? W.length - 1 : 0; - W = W[U]; - } - W !== null && (i[k] = W); - } - for (const k in O) - i[k] = O[k]; - } - } - } - return i; -} -const vy = () => ({ - style: {}, - transform: {}, - transformOrigin: {}, - vars: {} -}), U9 = () => ({ - ...vy(), - attrs: {} -}), q9 = (t, e) => e && typeof t == "number" ? e.transform(t) : t, Kre = { - x: "translateX", - y: "translateY", - z: "translateZ", - transformPerspective: "perspective" -}, Vre = mh.length; -function Gre(t, e, r) { - let n = "", i = !0; - for (let s = 0; s < Vre; s++) { - const o = mh[s], a = t[o]; - if (a === void 0) - continue; - let u = !0; - if (typeof a == "number" ? u = a === (o.startsWith("scale") ? 1 : 0) : u = parseFloat(a) === 0, !u || r) { - const l = q9(a, Zb[o]); - if (!u) { - i = !1; - const d = Kre[o] || o; - n += `${d}(${l}) `; - } - r && (e[o] = l); - } - } - return n = n.trim(), r ? n = r(e, i ? "" : n) : i && (n = "none"), n; -} -function by(t, e, r) { - const { style: n, vars: i, transformOrigin: s } = t; - let o = !1, a = !1; - for (const u in e) { - const l = e[u]; - if (Lc.has(u)) { - o = !0; - continue; - } else if (N7(u)) { - i[u] = l; - continue; - } else { - const d = q9(l, Zb[u]); - u.startsWith("origin") ? (a = !0, s[u] = d) : n[u] = d; - } - } - if (e.transform || (o || r ? n.transform = Gre(e, t.transform, r) : n.transform && (n.transform = "none")), a) { - const { originX: u = "50%", originY: l = "50%", originZ: d = 0 } = s; - n.transformOrigin = `${u} ${l} ${d}`; - } -} -function w5(t, e, r) { - return typeof t == "string" ? t : Vt.transform(e + r * t); -} -function Yre(t, e, r) { - const n = w5(e, t.x, t.width), i = w5(r, t.y, t.height); - return `${n} ${i}`; -} -const Jre = { - offset: "stroke-dashoffset", - array: "stroke-dasharray" -}, Xre = { - offset: "strokeDashoffset", - array: "strokeDasharray" -}; -function Zre(t, e, r = 1, n = 0, i = !0) { - t.pathLength = 1; - const s = i ? Jre : Xre; - t[s.offset] = Vt.transform(-n); - const o = Vt.transform(e), a = Vt.transform(r); - t[s.array] = `${o} ${a}`; -} -function yy(t, { - attrX: e, - attrY: r, - attrScale: n, - originX: i, - originY: s, - pathLength: o, - pathSpacing: a = 1, - pathOffset: u = 0, - // This is object creation, which we try to avoid per-frame. - ...l -}, d, p) { - if (by(t, l, p), d) { - t.style.viewBox && (t.attrs.viewBox = t.style.viewBox); - return; - } - t.attrs = t.style, t.style = {}; - const { attrs: w, style: _, dimensions: P } = t; - w.transform && (P && (_.transform = w.transform), delete w.transform), P && (i !== void 0 || s !== void 0 || _.transform) && (_.transformOrigin = Yre(P, i !== void 0 ? i : 0.5, s !== void 0 ? s : 0.5)), e !== void 0 && (w.x = e), r !== void 0 && (w.y = r), n !== void 0 && (w.scale = n), o !== void 0 && Zre(w, o, a, u, !1); -} -const wy = (t) => typeof t == "string" && t.toLowerCase() === "svg", Qre = { - useVisualState: j9({ - scrapeMotionValuesFromProps: F9, - createRenderState: U9, - onMount: (t, e, { renderState: r, latestValues: n }) => { - Lr.read(() => { - try { - r.dimensions = typeof e.getBBox == "function" ? e.getBBox() : e.getBoundingClientRect(); - } catch { - r.dimensions = { - x: 0, - y: 0, - width: 0, - height: 0 - }; - } - }), Lr.render(() => { - yy(r, n, wy(e.tagName), t.transformTemplate), $9(e, r); - }); - } - }) -}, ene = { - useVisualState: j9({ - scrapeMotionValuesFromProps: gy, - createRenderState: vy - }) -}; -function z9(t, e, r) { - for (const n in e) - !Zn(e[n]) && !B9(n, r) && (t[n] = e[n]); -} -function tne({ transformTemplate: t }, e) { - return wi(() => { - const r = vy(); - return by(r, e, t), Object.assign({}, r.vars, r.style); - }, [e]); -} -function rne(t, e) { - const r = t.style || {}, n = {}; - return z9(n, r, t), Object.assign(n, tne(t, e)), n; -} -function nne(t, e) { - const r = {}, n = rne(t, e); - return t.drag && t.dragListener !== !1 && (r.draggable = !1, n.userSelect = n.WebkitUserSelect = n.WebkitTouchCallout = "none", n.touchAction = t.drag === !0 ? "none" : `pan-${t.drag === "x" ? "y" : "x"}`), t.tabIndex === void 0 && (t.onTap || t.onTapStart || t.whileTap) && (r.tabIndex = 0), r.style = n, r; -} -const ine = /* @__PURE__ */ new Set([ - "animate", - "exit", - "variants", - "initial", - "style", - "values", - "variants", - "transition", - "transformTemplate", - "custom", - "inherit", - "onBeforeLayoutMeasure", - "onAnimationStart", - "onAnimationComplete", - "onUpdate", - "onDragStart", - "onDrag", - "onDragEnd", - "onMeasureDragConstraints", - "onDirectionLock", - "onDragTransitionEnd", - "_dragX", - "_dragY", - "onHoverStart", - "onHoverEnd", - "onViewportEnter", - "onViewportLeave", - "globalTapTarget", - "ignoreStrict", - "viewport" -]); -function L0(t) { - return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || ine.has(t); -} -let W9 = (t) => !L0(t); -function sne(t) { - t && (W9 = (e) => e.startsWith("on") ? !L0(e) : t(e)); -} -try { - sne(require("@emotion/is-prop-valid").default); -} catch { -} -function one(t, e, r) { - const n = {}; - for (const i in t) - i === "values" && typeof t.values == "object" || (W9(i) || r === !0 && L0(i) || !e && !L0(i) || // If trying to use native HTML drag events, forward drag listeners - t.draggable && i.startsWith("onDrag")) && (n[i] = t[i]); - return n; -} -function ane(t, e, r, n) { - const i = wi(() => { - const s = U9(); - return yy(s, e, wy(n), t.transformTemplate), { - ...s.attrs, - style: { ...s.style } - }; - }, [e]); - if (t.style) { - const s = {}; - z9(s, t.style, t), i.style = { ...s, ...i.style }; - } - return i; -} -function cne(t = !1) { - return (r, n, i, { latestValues: s }, o) => { - const u = (py(r) ? ane : nne)(n, s, o, r), l = one(n, typeof r == "string", t), d = r !== k5 ? { ...l, ...u, ref: i } : {}, { children: p } = n, w = wi(() => Zn(p) ? p.get() : p, [p]); - return e0(r, { - ...d, - children: w - }); - }; -} -function une(t, e) { - return function(n, { forwardMotionProps: i } = { forwardMotionProps: !1 }) { - const o = { - ...py(n) ? Qre : ene, - preloadedFeatures: t, - useRender: cne(i), - createVisualElement: e, - Component: n - }; - return Fre(o); - }; -} -const Mv = { current: null }, H9 = { current: !1 }; -function fne() { - if (H9.current = !0, !!dy) - if (window.matchMedia) { - const t = window.matchMedia("(prefers-reduced-motion)"), e = () => Mv.current = t.matches; - t.addListener(e), e(); - } else - Mv.current = !1; -} -function lne(t, e, r) { - for (const n in e) { - const i = e[n], s = r[n]; - if (Zn(i)) - t.addValue(n, i), process.env.NODE_ENV === "development" && Rp(i.version === "11.11.17", `Attempting to mix Motion versions ${i.version} with 11.11.17 may not work as expected.`); - else if (Zn(s)) - t.addValue(n, ql(i, { owner: t })); - else if (s !== i) - if (t.hasValue(n)) { - const o = t.getValue(n); - o.liveStyle === !0 ? o.jump(i) : o.hasAnimated || o.set(i); - } else { - const o = t.getStaticValue(n); - t.addValue(n, ql(o !== void 0 ? o : i, { owner: t })); - } - } - for (const n in r) - e[n] === void 0 && t.removeValue(n); - return e; -} -const x5 = /* @__PURE__ */ new WeakMap(), hne = [...$7, Yn, Ia], dne = (t) => hne.find(k7(t)), _5 = [ - "AnimationStart", - "AnimationComplete", - "Update", - "BeforeLayoutMeasure", - "LayoutMeasure", - "LayoutAnimationStart", - "LayoutAnimationComplete" -]; -class pne { - /** - * This method takes React props and returns found MotionValues. For example, HTML - * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays. - * - * This isn't an abstract method as it needs calling in the constructor, but it is - * intended to be one. - */ - scrapeMotionValuesFromProps(e, r, n) { - return {}; - } - constructor({ parent: e, props: r, presenceContext: n, reducedMotionConfig: i, blockInitialAnimation: s, visualState: o }, a = {}) { - this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = Yb, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => { - this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection)); - }, this.renderScheduledAt = 0, this.scheduleRender = () => { - const w = Zs.now(); - this.renderScheduledAt < w && (this.renderScheduledAt = w, Lr.render(this.render, !1, !0)); - }; - const { latestValues: u, renderState: l } = o; - this.latestValues = u, this.baseTarget = { ...u }, this.initialValues = r.initial ? { ...u } : {}, this.renderState = l, this.parent = e, this.props = r, this.presenceContext = n, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!s, this.isControllingVariants = Bp(r), this.isVariantNode = N9(r), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current); - const { willChange: d, ...p } = this.scrapeMotionValuesFromProps(r, {}, this); - for (const w in p) { - const _ = p[w]; - u[w] !== void 0 && Zn(_) && _.set(u[w], !1); - } - } - mount(e) { - this.current = e, x5.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((r, n) => this.bindToMotionValue(n, r)), H9.current || fne(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : Mv.current, process.env.NODE_ENV !== "production" && Rp(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext); - } - unmount() { - x5.delete(this.current), this.projection && this.projection.unmount(), Pa(this.notifyUpdate), Pa(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this); - for (const e in this.events) - this.events[e].clear(); - for (const e in this.features) { - const r = this.features[e]; - r && (r.unmount(), r.isMounted = !1); - } - this.current = null; - } - bindToMotionValue(e, r) { - this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)(); - const n = Lc.has(e), i = r.on("change", (a) => { - this.latestValues[e] = a, this.props.onUpdate && Lr.preRender(this.notifyUpdate), n && this.projection && (this.projection.isTransformDirty = !0); - }), s = r.on("renderRequest", this.scheduleRender); - let o; - window.MotionCheckAppearSync && (o = window.MotionCheckAppearSync(this, e, r)), this.valueSubscriptions.set(e, () => { - i(), s(), o && o(), r.owner && r.stop(); - }); - } - sortNodePosition(e) { - return !this.current || !this.sortInstanceNodePosition || this.type !== e.type ? 0 : this.sortInstanceNodePosition(this.current, e.current); - } - updateFeatures() { - let e = "animation"; - for (e in Fu) { - const r = Fu[e]; - if (!r) - continue; - const { isEnabled: n, Feature: i } = r; - if (!this.features[e] && i && n(this.props) && (this.features[e] = new i(this)), this.features[e]) { - const s = this.features[e]; - s.isMounted ? s.update() : (s.mount(), s.isMounted = !0); - } - } - } - triggerBuild() { - this.build(this.renderState, this.latestValues, this.props); - } - /** - * Measure the current viewport box with or without transforms. - * Only measures axis-aligned boxes, rotate and skew must be manually - * removed with a re-render to work. - */ - measureViewportBox() { - return this.current ? this.measureInstanceViewportBox(this.current, this.props) : ln(); - } - getStaticValue(e) { - return this.latestValues[e]; - } - setStaticValue(e, r) { - this.latestValues[e] = r; - } - /** - * Update the provided props. Ensure any newly-added motion values are - * added to our map, old ones removed, and listeners updated. - */ - update(e, r) { - (e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = r; - for (let n = 0; n < _5.length; n++) { - const i = _5[n]; - this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]); - const s = "on" + i, o = e[s]; - o && (this.propEventSubscriptions[i] = this.on(i, o)); - } - this.prevMotionValues = lne(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue(); - } - getProps() { - return this.props; - } - /** - * Returns the variant definition with a given name. - */ - getVariant(e) { - return this.props.variants ? this.props.variants[e] : void 0; - } - /** - * Returns the defined default transition on this component. - */ - getDefaultTransition() { - return this.props.transition; - } - getTransformPagePoint() { - return this.props.transformPagePoint; - } - getClosestVariantNode() { - return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0; - } - /** - * Add a child visual element to our set of children. - */ - addVariantChild(e) { - const r = this.getClosestVariantNode(); - if (r) - return r.variantChildren && r.variantChildren.add(e), () => r.variantChildren.delete(e); - } - /** - * Add a motion value and bind it to this visual element. - */ - addValue(e, r) { - const n = this.values.get(e); - r !== n && (n && this.removeValue(e), this.bindToMotionValue(e, r), this.values.set(e, r), this.latestValues[e] = r.get()); - } - /** - * Remove a motion value and unbind any active subscriptions. - */ - removeValue(e) { - this.values.delete(e); - const r = this.valueSubscriptions.get(e); - r && (r(), this.valueSubscriptions.delete(e)), delete this.latestValues[e], this.removeValueFromRenderState(e, this.renderState); - } - /** - * Check whether we have a motion value for this key - */ - hasValue(e) { - return this.values.has(e); - } - getValue(e, r) { - if (this.props.values && this.props.values[e]) - return this.props.values[e]; - let n = this.values.get(e); - return n === void 0 && r !== void 0 && (n = ql(r === null ? void 0 : r, { owner: this }), this.addValue(e, n)), n; - } - /** - * If we're trying to animate to a previously unencountered value, - * we need to check for it in our state and as a last resort read it - * directly from the instance (which might have performance implications). - */ - readValue(e, r) { - var n; - let i = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : (n = this.getBaseTargetFromProps(this.props, e)) !== null && n !== void 0 ? n : this.readValueFromInstance(this.current, e, this.options); - return i != null && (typeof i == "string" && (D7(i) || R7(i)) ? i = parseFloat(i) : !dne(i) && Ia.test(r) && (i = H7(e, r)), this.setBaseTarget(e, Zn(i) ? i.get() : i)), Zn(i) ? i.get() : i; - } - /** - * Set the base target to later animate back to. This is currently - * only hydrated on creation and when we first read a value. - */ - setBaseTarget(e, r) { - this.baseTarget[e] = r; - } - /** - * Find the base target for a value thats been removed from all animation - * props. - */ - getBaseTarget(e) { - var r; - const { initial: n } = this.props; - let i; - if (typeof n == "string" || typeof n == "object") { - const o = qb(this.props, n, (r = this.presenceContext) === null || r === void 0 ? void 0 : r.custom); - o && (i = o[e]); - } - if (n && i !== void 0) - return i; - const s = this.getBaseTargetFromProps(this.props, e); - return s !== void 0 && !Zn(s) ? s : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e]; - } - on(e, r) { - return this.events[e] || (this.events[e] = new cy()), this.events[e].add(r); - } - notify(e, ...r) { - this.events[e] && this.events[e].notify(...r); - } -} -class K9 extends pne { - constructor() { - super(...arguments), this.KeyframeResolver = K7; - } - sortInstanceNodePosition(e, r) { - return e.compareDocumentPosition(r) & 2 ? 1 : -1; - } - getBaseTargetFromProps(e, r) { - return e.style ? e.style[r] : void 0; - } - removeValueFromRenderState(e, { vars: r, style: n }) { - delete r[e], delete n[e]; - } -} -function gne(t) { - return window.getComputedStyle(t); -} -class mne extends K9 { - constructor() { - super(...arguments), this.type = "html", this.renderInstance = L9; - } - readValueFromInstance(e, r) { - if (Lc.has(r)) { - const n = Qb(r); - return n && n.default || 0; - } else { - const n = gne(e), i = (N7(r) ? n.getPropertyValue(r) : n[r]) || 0; - return typeof i == "string" ? i.trim() : i; - } - } - measureInstanceViewportBox(e, { transformPagePoint: r }) { - return b9(e, r); - } - build(e, r, n) { - by(e, r, n.transformTemplate); - } - scrapeMotionValuesFromProps(e, r, n) { - return gy(e, r, n); - } - handleChildMotionValue() { - this.childSubscription && (this.childSubscription(), delete this.childSubscription); - const { children: e } = this.props; - Zn(e) && (this.childSubscription = e.on("change", (r) => { - this.current && (this.current.textContent = `${r}`); - })); - } -} -class vne extends K9 { - constructor() { - super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = ln; - } - getBaseTargetFromProps(e, r) { - return e[r]; - } - readValueFromInstance(e, r) { - if (Lc.has(r)) { - const n = Qb(r); - return n && n.default || 0; - } - return r = k9.has(r) ? r : uy(r), e.getAttribute(r); - } - scrapeMotionValuesFromProps(e, r, n) { - return F9(e, r, n); - } - build(e, r, n) { - yy(e, r, this.isSVGTag, n.transformTemplate); - } - renderInstance(e, r, n, i) { - $9(e, r, n, i); - } - mount(e) { - this.isSVGTag = wy(e.tagName), super.mount(e); - } -} -const bne = (t, e) => py(t) ? new vne(e) : new mne(e, { - allowProjection: t !== k5 -}), yne = /* @__PURE__ */ une({ - ...cte, - ...Tre, - ...yre, - ...Rre -}, bne), wne = /* @__PURE__ */ QZ(yne); -class xne extends Gt.Component { - getSnapshotBeforeUpdate(e) { - const r = this.props.childRef.current; - if (r && e.isPresent && !this.props.isPresent) { - const n = this.props.sizeRef.current; - n.height = r.offsetHeight || 0, n.width = r.offsetWidth || 0, n.top = r.offsetTop, n.left = r.offsetLeft; - } - return null; - } - /** - * Required with getSnapshotBeforeUpdate to stop React complaining. - */ - componentDidUpdate() { - } - render() { - return this.props.children; - } -} -function _ne({ children: t, isPresent: e }) { - const r = Ov(), n = Qn(null), i = Qn({ - width: 0, - height: 0, - top: 0, - left: 0 - }), { nonce: s } = Tn(hy); - return L5(() => { - const { width: o, height: a, top: u, left: l } = i.current; - if (e || !n.current || !o || !a) - return; - n.current.dataset.motionPopId = r; - const d = document.createElement("style"); - return s && (d.nonce = s), document.head.appendChild(d), d.sheet && d.sheet.insertRule(` - [data-motion-pop-id="${r}"] { - position: absolute !important; - width: ${o}px !important; - height: ${a}px !important; - top: ${u}px !important; - left: ${l}px !important; - } - `), () => { - document.head.removeChild(d); - }; - }, [e]), le.jsx(xne, { isPresent: e, childRef: n, sizeRef: i, children: Gt.cloneElement(t, { ref: n }) }); -} -const Ene = ({ children: t, initial: e, isPresent: r, onExitComplete: n, custom: i, presenceAffectsLayout: s, mode: o }) => { - const a = my(Sne), u = Ov(), l = Nv((p) => { - a.set(p, !0); - for (const w of a.values()) - if (!w) - return; - n && n(); - }, [a, n]), d = wi( - () => ({ - id: u, - initial: e, - isPresent: r, - custom: i, - onExitComplete: l, - register: (p) => (a.set(p, !1), () => a.delete(p)) - }), - /** - * If the presence of a child affects the layout of the components around it, - * we want to make a new context value to ensure they get re-rendered - * so they can detect that layout change. - */ - s ? [Math.random(), l] : [r, l] - ); - return wi(() => { - a.forEach((p, w) => a.set(w, !1)); - }, [r]), Gt.useEffect(() => { - !r && !a.size && n && n(); - }, [r]), o === "popLayout" && (t = le.jsx(_ne, { isPresent: r, children: t })), le.jsx(kp.Provider, { value: d, children: t }); -}; -function Sne() { - return /* @__PURE__ */ new Map(); -} -const Cd = (t) => t.key || ""; -function E5(t) { - const e = []; - return hD.forEach(t, (r) => { - dD(r) && e.push(r); - }), e; -} -const Ane = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExitComplete: i, presenceAffectsLayout: s = !0, mode: o = "sync" }) => { - Wo(!e, "Replace exitBeforeEnter with mode='wait'"); - const a = wi(() => E5(t), [t]), u = a.map(Cd), l = Qn(!0), d = Qn(a), p = my(() => /* @__PURE__ */ new Map()), [w, _] = Yt(a), [P, O] = Yt(a); - R9(() => { - l.current = !1, d.current = a; - for (let k = 0; k < P.length; k++) { - const W = Cd(P[k]); - u.includes(W) ? p.delete(W) : p.get(W) !== !0 && p.set(W, !1); - } - }, [P, u.length, u.join("-")]); - const L = []; - if (a !== w) { - let k = [...a]; - for (let W = 0; W < P.length; W++) { - const U = P[W], V = Cd(U); - u.includes(V) || (k.splice(W, 0, U), L.push(U)); - } - o === "wait" && L.length && (k = L), O(E5(k)), _(a); - return; - } - process.env.NODE_ENV !== "production" && o === "wait" && P.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`); - const { forceRender: B } = Tn(fy); - return le.jsx(le.Fragment, { children: P.map((k) => { - const W = Cd(k), U = a === P || u.includes(W), V = () => { - if (p.has(W)) - p.set(W, !0); - else - return; - let Q = !0; - p.forEach((R) => { - R || (Q = !1); - }), Q && (B == null || B(), O(d.current), i && i()); - }; - return le.jsx(Ene, { isPresent: U, initial: !l.current || n ? void 0 : !1, custom: U ? void 0 : r, presenceAffectsLayout: s, mode: o, onExitComplete: U ? void 0 : V, children: k }, W); - }) }); -}, Rs = (t) => /* @__PURE__ */ le.jsx(Ane, { children: /* @__PURE__ */ le.jsx( - wne.div, - { - initial: { x: 0, opacity: 0 }, - animate: { x: 0, opacity: 1 }, - exit: { x: 30, opacity: 0 }, - transition: { duration: 0.3 }, - className: t.className, - children: t.children - } -) }); -function xy(t) { - const { icon: e, title: r, extra: n, onClick: i } = t; - function s() { - i && i(); - } - return /* @__PURE__ */ le.jsxs( - "div", - { - className: "xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg", - onClick: s, - children: [ - e, - r, - /* @__PURE__ */ le.jsxs("div", { className: "xc-relative xc-ml-auto xc-h-6", children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0", children: n }), - /* @__PURE__ */ le.jsx("div", { className: "xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100", children: /* @__PURE__ */ le.jsx(KZ, {}) }) - ] }) - ] - } - ); -} -function Pne(t) { - return t.lastUsed ? /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500", children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]" }), - "Last Used" - ] }) : t.installed ? /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500", children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]" }), - "Installed" - ] }) : null; -} -function V9(t) { - var o, a; - const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: (o = e.config) == null ? void 0 : o.image }), i = ((a = e.config) == null ? void 0 : a.name) || "", s = wi(() => Pne(e), [e]); - return /* @__PURE__ */ le.jsx(xy, { icon: n, title: i, extra: s, onClick: () => r(e) }); -} -function G9(t) { - var e, r, n = ""; - if (typeof t == "string" || typeof t == "number") n += t; - else if (typeof t == "object") if (Array.isArray(t)) { - var i = t.length; - for (e = 0; e < i; e++) t[e] && (r = G9(t[e])) && (n && (n += " "), n += r); - } else for (r in t) t[r] && (n && (n += " "), n += r); - return n; -} -function Mne() { - for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++) (t = arguments[r]) && (e = G9(t)) && (n && (n += " "), n += e); - return n; -} -const Ine = Mne, _y = "-", Cne = (t) => { - const e = Rne(t), { - conflictingClassGroups: r, - conflictingClassGroupModifiers: n - } = t; - return { - getClassGroupId: (o) => { - const a = o.split(_y); - return a[0] === "" && a.length !== 1 && a.shift(), Y9(a, e) || Tne(o); - }, - getConflictingClassGroupIds: (o, a) => { - const u = r[o] || []; - return a && n[o] ? [...u, ...n[o]] : u; - } - }; -}, Y9 = (t, e) => { - var o; - if (t.length === 0) - return e.classGroupId; - const r = t[0], n = e.nextPart.get(r), i = n ? Y9(t.slice(1), n) : void 0; - if (i) - return i; - if (e.validators.length === 0) - return; - const s = t.join(_y); - return (o = e.validators.find(({ - validator: a - }) => a(s))) == null ? void 0 : o.classGroupId; -}, S5 = /^\[(.+)\]$/, Tne = (t) => { - if (S5.test(t)) { - const e = S5.exec(t)[1], r = e == null ? void 0 : e.substring(0, e.indexOf(":")); - if (r) - return "arbitrary.." + r; - } -}, Rne = (t) => { - const { - theme: e, - prefix: r - } = t, n = { - nextPart: /* @__PURE__ */ new Map(), - validators: [] - }; - return One(Object.entries(t.classGroups), r).forEach(([s, o]) => { - Iv(o, n, s, e); - }), n; -}, Iv = (t, e, r, n) => { - t.forEach((i) => { - if (typeof i == "string") { - const s = i === "" ? e : A5(e, i); - s.classGroupId = r; - return; - } - if (typeof i == "function") { - if (Dne(i)) { - Iv(i(n), e, r, n); - return; - } - e.validators.push({ - validator: i, - classGroupId: r - }); - return; - } - Object.entries(i).forEach(([s, o]) => { - Iv(o, A5(e, s), r, n); - }); - }); -}, A5 = (t, e) => { - let r = t; - return e.split(_y).forEach((n) => { - r.nextPart.has(n) || r.nextPart.set(n, { - nextPart: /* @__PURE__ */ new Map(), - validators: [] - }), r = r.nextPart.get(n); - }), r; -}, Dne = (t) => t.isThemeGetter, One = (t, e) => e ? t.map(([r, n]) => { - const i = n.map((s) => typeof s == "string" ? e + s : typeof s == "object" ? Object.fromEntries(Object.entries(s).map(([o, a]) => [e + o, a])) : s); - return [r, i]; -}) : t, Nne = (t) => { - if (t < 1) - return { - get: () => { - }, - set: () => { - } - }; - let e = 0, r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(); - const i = (s, o) => { - r.set(s, o), e++, e > t && (e = 0, n = r, r = /* @__PURE__ */ new Map()); - }; - return { - get(s) { - let o = r.get(s); - if (o !== void 0) - return o; - if ((o = n.get(s)) !== void 0) - return i(s, o), o; - }, - set(s, o) { - r.has(s) ? r.set(s, o) : i(s, o); - } - }; -}, J9 = "!", Lne = (t) => { - const { - separator: e, - experimentalParseClassName: r - } = t, n = e.length === 1, i = e[0], s = e.length, o = (a) => { - const u = []; - let l = 0, d = 0, p; - for (let L = 0; L < a.length; L++) { - let B = a[L]; - if (l === 0) { - if (B === i && (n || a.slice(L, L + s) === e)) { - u.push(a.slice(d, L)), d = L + s; - continue; - } - if (B === "/") { - p = L; - continue; - } - } - B === "[" ? l++ : B === "]" && l--; - } - const w = u.length === 0 ? a : a.substring(d), _ = w.startsWith(J9), P = _ ? w.substring(1) : w, O = p && p > d ? p - d : void 0; - return { - modifiers: u, - hasImportantModifier: _, - baseClassName: P, - maybePostfixModifierPosition: O - }; - }; - return r ? (a) => r({ - className: a, - parseClassName: o - }) : o; -}, kne = (t) => { - if (t.length <= 1) - return t; - const e = []; - let r = []; - return t.forEach((n) => { - n[0] === "[" ? (e.push(...r.sort(), n), r = []) : r.push(n); - }), e.push(...r.sort()), e; -}, $ne = (t) => ({ - cache: Nne(t.cacheSize), - parseClassName: Lne(t), - ...Cne(t) -}), Bne = /\s+/, Fne = (t, e) => { - const { - parseClassName: r, - getClassGroupId: n, - getConflictingClassGroupIds: i - } = e, s = [], o = t.trim().split(Bne); - let a = ""; - for (let u = o.length - 1; u >= 0; u -= 1) { - const l = o[u], { - modifiers: d, - hasImportantModifier: p, - baseClassName: w, - maybePostfixModifierPosition: _ - } = r(l); - let P = !!_, O = n(P ? w.substring(0, _) : w); - if (!O) { - if (!P) { - a = l + (a.length > 0 ? " " + a : a); - continue; - } - if (O = n(w), !O) { - a = l + (a.length > 0 ? " " + a : a); - continue; - } - P = !1; - } - const L = kne(d).join(":"), B = p ? L + J9 : L, k = B + O; - if (s.includes(k)) - continue; - s.push(k); - const W = i(O, P); - for (let U = 0; U < W.length; ++U) { - const V = W[U]; - s.push(B + V); - } - a = l + (a.length > 0 ? " " + a : a); - } - return a; -}; -function jne() { - let t = 0, e, r, n = ""; - for (; t < arguments.length; ) - (e = arguments[t++]) && (r = X9(e)) && (n && (n += " "), n += r); - return n; -} -const X9 = (t) => { - if (typeof t == "string") - return t; - let e, r = ""; - for (let n = 0; n < t.length; n++) - t[n] && (e = X9(t[n])) && (r && (r += " "), r += e); - return r; -}; -function Une(t, ...e) { - let r, n, i, s = o; - function o(u) { - const l = e.reduce((d, p) => p(d), t()); - return r = $ne(l), n = r.cache.get, i = r.cache.set, s = a, a(u); - } - function a(u) { - const l = n(u); - if (l) - return l; - const d = Fne(u, r); - return i(u, d), d; - } - return function() { - return s(jne.apply(null, arguments)); - }; -} -const Gr = (t) => { - const e = (r) => r[t] || []; - return e.isThemeGetter = !0, e; -}, Z9 = /^\[(?:([a-z-]+):)?(.+)\]$/i, qne = /^\d+\/\d+$/, zne = /* @__PURE__ */ new Set(["px", "full", "screen"]), Wne = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, Hne = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, Kne = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, Vne = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, Gne = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, _o = (t) => Mu(t) || zne.has(t) || qne.test(t), sa = (t) => rf(t, "length", rie), Mu = (t) => !!t && !Number.isNaN(Number(t)), s1 = (t) => rf(t, "number", Mu), qf = (t) => !!t && Number.isInteger(Number(t)), Yne = (t) => t.endsWith("%") && Mu(t.slice(0, -1)), ur = (t) => Z9.test(t), oa = (t) => Wne.test(t), Jne = /* @__PURE__ */ new Set(["length", "size", "percentage"]), Xne = (t) => rf(t, Jne, Q9), Zne = (t) => rf(t, "position", Q9), Qne = /* @__PURE__ */ new Set(["image", "url"]), eie = (t) => rf(t, Qne, iie), tie = (t) => rf(t, "", nie), zf = () => !0, rf = (t, e, r) => { - const n = Z9.exec(t); - return n ? n[1] ? typeof e == "string" ? n[1] === e : e.has(n[1]) : r(n[2]) : !1; -}, rie = (t) => ( - // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths. - // For example, `hsl(0 0% 0%)` would be classified as a length without this check. - // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough. - Hne.test(t) && !Kne.test(t) -), Q9 = () => !1, nie = (t) => Vne.test(t), iie = (t) => Gne.test(t), sie = () => { - const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), u = Gr("contrast"), l = Gr("grayscale"), d = Gr("hueRotate"), p = Gr("invert"), w = Gr("gap"), _ = Gr("gradientColorStops"), P = Gr("gradientColorStopPositions"), O = Gr("inset"), L = Gr("margin"), B = Gr("opacity"), k = Gr("padding"), W = Gr("saturate"), U = Gr("scale"), V = Gr("sepia"), Q = Gr("skew"), R = Gr("space"), K = Gr("translate"), ge = () => ["auto", "contain", "none"], Ee = () => ["auto", "hidden", "clip", "visible", "scroll"], Y = () => ["auto", ur, e], A = () => [ur, e], m = () => ["", _o, sa], f = () => ["auto", Mu, ur], g = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], b = () => ["solid", "dashed", "dotted", "double", "none"], x = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], E = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], S = () => ["", "0", ur], v = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], M = () => [Mu, ur]; - return { - cacheSize: 500, - separator: ":", - theme: { - colors: [zf], - spacing: [_o, sa], - blur: ["none", "", oa, ur], - brightness: M(), - borderColor: [t], - borderRadius: ["none", "", "full", oa, ur], - borderSpacing: A(), - borderWidth: m(), - contrast: M(), - grayscale: S(), - hueRotate: M(), - invert: S(), - gap: A(), - gradientColorStops: [t], - gradientColorStopPositions: [Yne, sa], - inset: Y(), - margin: Y(), - opacity: M(), - padding: A(), - saturate: M(), - scale: M(), - sepia: S(), - skew: M(), - space: A(), - translate: A() - }, - classGroups: { - // Layout - /** - * Aspect Ratio - * @see https://tailwindcss.com/docs/aspect-ratio - */ - aspect: [{ - aspect: ["auto", "square", "video", ur] - }], - /** - * Container - * @see https://tailwindcss.com/docs/container - */ - container: ["container"], - /** - * Columns - * @see https://tailwindcss.com/docs/columns - */ - columns: [{ - columns: [oa] - }], - /** - * Break After - * @see https://tailwindcss.com/docs/break-after - */ - "break-after": [{ - "break-after": v() - }], - /** - * Break Before - * @see https://tailwindcss.com/docs/break-before - */ - "break-before": [{ - "break-before": v() - }], - /** - * Break Inside - * @see https://tailwindcss.com/docs/break-inside - */ - "break-inside": [{ - "break-inside": ["auto", "avoid", "avoid-page", "avoid-column"] - }], - /** - * Box Decoration Break - * @see https://tailwindcss.com/docs/box-decoration-break - */ - "box-decoration": [{ - "box-decoration": ["slice", "clone"] - }], - /** - * Box Sizing - * @see https://tailwindcss.com/docs/box-sizing - */ - box: [{ - box: ["border", "content"] - }], - /** - * Display - * @see https://tailwindcss.com/docs/display - */ - display: ["block", "inline-block", "inline", "flex", "inline-flex", "table", "inline-table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row-group", "table-row", "flow-root", "grid", "inline-grid", "contents", "list-item", "hidden"], - /** - * Floats - * @see https://tailwindcss.com/docs/float - */ - float: [{ - float: ["right", "left", "none", "start", "end"] - }], - /** - * Clear - * @see https://tailwindcss.com/docs/clear - */ - clear: [{ - clear: ["left", "right", "both", "none", "start", "end"] - }], - /** - * Isolation - * @see https://tailwindcss.com/docs/isolation - */ - isolation: ["isolate", "isolation-auto"], - /** - * Object Fit - * @see https://tailwindcss.com/docs/object-fit - */ - "object-fit": [{ - object: ["contain", "cover", "fill", "none", "scale-down"] - }], - /** - * Object Position - * @see https://tailwindcss.com/docs/object-position - */ - "object-position": [{ - object: [...g(), ur] - }], - /** - * Overflow - * @see https://tailwindcss.com/docs/overflow - */ - overflow: [{ - overflow: Ee() - }], - /** - * Overflow X - * @see https://tailwindcss.com/docs/overflow - */ - "overflow-x": [{ - "overflow-x": Ee() - }], - /** - * Overflow Y - * @see https://tailwindcss.com/docs/overflow - */ - "overflow-y": [{ - "overflow-y": Ee() - }], - /** - * Overscroll Behavior - * @see https://tailwindcss.com/docs/overscroll-behavior - */ - overscroll: [{ - overscroll: ge() - }], - /** - * Overscroll Behavior X - * @see https://tailwindcss.com/docs/overscroll-behavior - */ - "overscroll-x": [{ - "overscroll-x": ge() - }], - /** - * Overscroll Behavior Y - * @see https://tailwindcss.com/docs/overscroll-behavior - */ - "overscroll-y": [{ - "overscroll-y": ge() - }], - /** - * Position - * @see https://tailwindcss.com/docs/position - */ - position: ["static", "fixed", "absolute", "relative", "sticky"], - /** - * Top / Right / Bottom / Left - * @see https://tailwindcss.com/docs/top-right-bottom-left - */ - inset: [{ - inset: [O] - }], - /** - * Right / Left - * @see https://tailwindcss.com/docs/top-right-bottom-left - */ - "inset-x": [{ - "inset-x": [O] - }], - /** - * Top / Bottom - * @see https://tailwindcss.com/docs/top-right-bottom-left - */ - "inset-y": [{ - "inset-y": [O] - }], - /** - * Start - * @see https://tailwindcss.com/docs/top-right-bottom-left - */ - start: [{ - start: [O] - }], - /** - * End - * @see https://tailwindcss.com/docs/top-right-bottom-left - */ - end: [{ - end: [O] - }], - /** - * Top - * @see https://tailwindcss.com/docs/top-right-bottom-left - */ - top: [{ - top: [O] - }], - /** - * Right - * @see https://tailwindcss.com/docs/top-right-bottom-left - */ - right: [{ - right: [O] - }], - /** - * Bottom - * @see https://tailwindcss.com/docs/top-right-bottom-left - */ - bottom: [{ - bottom: [O] - }], - /** - * Left - * @see https://tailwindcss.com/docs/top-right-bottom-left - */ - left: [{ - left: [O] - }], - /** - * Visibility - * @see https://tailwindcss.com/docs/visibility - */ - visibility: ["visible", "invisible", "collapse"], - /** - * Z-Index - * @see https://tailwindcss.com/docs/z-index - */ - z: [{ - z: ["auto", qf, ur] - }], - // Flexbox and Grid - /** - * Flex Basis - * @see https://tailwindcss.com/docs/flex-basis - */ - basis: [{ - basis: Y() - }], - /** - * Flex Direction - * @see https://tailwindcss.com/docs/flex-direction - */ - "flex-direction": [{ - flex: ["row", "row-reverse", "col", "col-reverse"] - }], - /** - * Flex Wrap - * @see https://tailwindcss.com/docs/flex-wrap - */ - "flex-wrap": [{ - flex: ["wrap", "wrap-reverse", "nowrap"] - }], - /** - * Flex - * @see https://tailwindcss.com/docs/flex - */ - flex: [{ - flex: ["1", "auto", "initial", "none", ur] - }], - /** - * Flex Grow - * @see https://tailwindcss.com/docs/flex-grow - */ - grow: [{ - grow: S() - }], - /** - * Flex Shrink - * @see https://tailwindcss.com/docs/flex-shrink - */ - shrink: [{ - shrink: S() - }], - /** - * Order - * @see https://tailwindcss.com/docs/order - */ - order: [{ - order: ["first", "last", "none", qf, ur] - }], - /** - * Grid Template Columns - * @see https://tailwindcss.com/docs/grid-template-columns - */ - "grid-cols": [{ - "grid-cols": [zf] - }], - /** - * Grid Column Start / End - * @see https://tailwindcss.com/docs/grid-column - */ - "col-start-end": [{ - col: ["auto", { - span: ["full", qf, ur] - }, ur] - }], - /** - * Grid Column Start - * @see https://tailwindcss.com/docs/grid-column - */ - "col-start": [{ - "col-start": f() - }], - /** - * Grid Column End - * @see https://tailwindcss.com/docs/grid-column - */ - "col-end": [{ - "col-end": f() - }], - /** - * Grid Template Rows - * @see https://tailwindcss.com/docs/grid-template-rows - */ - "grid-rows": [{ - "grid-rows": [zf] - }], - /** - * Grid Row Start / End - * @see https://tailwindcss.com/docs/grid-row - */ - "row-start-end": [{ - row: ["auto", { - span: [qf, ur] - }, ur] - }], - /** - * Grid Row Start - * @see https://tailwindcss.com/docs/grid-row - */ - "row-start": [{ - "row-start": f() - }], - /** - * Grid Row End - * @see https://tailwindcss.com/docs/grid-row - */ - "row-end": [{ - "row-end": f() - }], - /** - * Grid Auto Flow - * @see https://tailwindcss.com/docs/grid-auto-flow - */ - "grid-flow": [{ - "grid-flow": ["row", "col", "dense", "row-dense", "col-dense"] - }], - /** - * Grid Auto Columns - * @see https://tailwindcss.com/docs/grid-auto-columns - */ - "auto-cols": [{ - "auto-cols": ["auto", "min", "max", "fr", ur] - }], - /** - * Grid Auto Rows - * @see https://tailwindcss.com/docs/grid-auto-rows - */ - "auto-rows": [{ - "auto-rows": ["auto", "min", "max", "fr", ur] - }], - /** - * Gap - * @see https://tailwindcss.com/docs/gap - */ - gap: [{ - gap: [w] - }], - /** - * Gap X - * @see https://tailwindcss.com/docs/gap - */ - "gap-x": [{ - "gap-x": [w] - }], - /** - * Gap Y - * @see https://tailwindcss.com/docs/gap - */ - "gap-y": [{ - "gap-y": [w] - }], - /** - * Justify Content - * @see https://tailwindcss.com/docs/justify-content - */ - "justify-content": [{ - justify: ["normal", ...E()] - }], - /** - * Justify Items - * @see https://tailwindcss.com/docs/justify-items - */ - "justify-items": [{ - "justify-items": ["start", "end", "center", "stretch"] - }], - /** - * Justify Self - * @see https://tailwindcss.com/docs/justify-self - */ - "justify-self": [{ - "justify-self": ["auto", "start", "end", "center", "stretch"] - }], - /** - * Align Content - * @see https://tailwindcss.com/docs/align-content - */ - "align-content": [{ - content: ["normal", ...E(), "baseline"] - }], - /** - * Align Items - * @see https://tailwindcss.com/docs/align-items - */ - "align-items": [{ - items: ["start", "end", "center", "baseline", "stretch"] - }], - /** - * Align Self - * @see https://tailwindcss.com/docs/align-self - */ - "align-self": [{ - self: ["auto", "start", "end", "center", "stretch", "baseline"] - }], - /** - * Place Content - * @see https://tailwindcss.com/docs/place-content - */ - "place-content": [{ - "place-content": [...E(), "baseline"] - }], - /** - * Place Items - * @see https://tailwindcss.com/docs/place-items - */ - "place-items": [{ - "place-items": ["start", "end", "center", "baseline", "stretch"] - }], - /** - * Place Self - * @see https://tailwindcss.com/docs/place-self - */ - "place-self": [{ - "place-self": ["auto", "start", "end", "center", "stretch"] - }], - // Spacing - /** - * Padding - * @see https://tailwindcss.com/docs/padding - */ - p: [{ - p: [k] - }], - /** - * Padding X - * @see https://tailwindcss.com/docs/padding - */ - px: [{ - px: [k] - }], - /** - * Padding Y - * @see https://tailwindcss.com/docs/padding - */ - py: [{ - py: [k] - }], - /** - * Padding Start - * @see https://tailwindcss.com/docs/padding - */ - ps: [{ - ps: [k] - }], - /** - * Padding End - * @see https://tailwindcss.com/docs/padding - */ - pe: [{ - pe: [k] - }], - /** - * Padding Top - * @see https://tailwindcss.com/docs/padding - */ - pt: [{ - pt: [k] - }], - /** - * Padding Right - * @see https://tailwindcss.com/docs/padding - */ - pr: [{ - pr: [k] - }], - /** - * Padding Bottom - * @see https://tailwindcss.com/docs/padding - */ - pb: [{ - pb: [k] - }], - /** - * Padding Left - * @see https://tailwindcss.com/docs/padding - */ - pl: [{ - pl: [k] - }], - /** - * Margin - * @see https://tailwindcss.com/docs/margin - */ - m: [{ - m: [L] - }], - /** - * Margin X - * @see https://tailwindcss.com/docs/margin - */ - mx: [{ - mx: [L] - }], - /** - * Margin Y - * @see https://tailwindcss.com/docs/margin - */ - my: [{ - my: [L] - }], - /** - * Margin Start - * @see https://tailwindcss.com/docs/margin - */ - ms: [{ - ms: [L] - }], - /** - * Margin End - * @see https://tailwindcss.com/docs/margin - */ - me: [{ - me: [L] - }], - /** - * Margin Top - * @see https://tailwindcss.com/docs/margin - */ - mt: [{ - mt: [L] - }], - /** - * Margin Right - * @see https://tailwindcss.com/docs/margin - */ - mr: [{ - mr: [L] - }], - /** - * Margin Bottom - * @see https://tailwindcss.com/docs/margin - */ - mb: [{ - mb: [L] - }], - /** - * Margin Left - * @see https://tailwindcss.com/docs/margin - */ - ml: [{ - ml: [L] - }], - /** - * Space Between X - * @see https://tailwindcss.com/docs/space - */ - "space-x": [{ - "space-x": [R] - }], - /** - * Space Between X Reverse - * @see https://tailwindcss.com/docs/space - */ - "space-x-reverse": ["space-x-reverse"], - /** - * Space Between Y - * @see https://tailwindcss.com/docs/space - */ - "space-y": [{ - "space-y": [R] - }], - /** - * Space Between Y Reverse - * @see https://tailwindcss.com/docs/space - */ - "space-y-reverse": ["space-y-reverse"], - // Sizing - /** - * Width - * @see https://tailwindcss.com/docs/width - */ - w: [{ - w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw", ur, e] - }], - /** - * Min-Width - * @see https://tailwindcss.com/docs/min-width - */ - "min-w": [{ - "min-w": [ur, e, "min", "max", "fit"] - }], - /** - * Max-Width - * @see https://tailwindcss.com/docs/max-width - */ - "max-w": [{ - "max-w": [ur, e, "none", "full", "min", "max", "fit", "prose", { - screen: [oa] - }, oa] - }], - /** - * Height - * @see https://tailwindcss.com/docs/height - */ - h: [{ - h: [ur, e, "auto", "min", "max", "fit", "svh", "lvh", "dvh"] - }], - /** - * Min-Height - * @see https://tailwindcss.com/docs/min-height - */ - "min-h": [{ - "min-h": [ur, e, "min", "max", "fit", "svh", "lvh", "dvh"] - }], - /** - * Max-Height - * @see https://tailwindcss.com/docs/max-height - */ - "max-h": [{ - "max-h": [ur, e, "min", "max", "fit", "svh", "lvh", "dvh"] - }], - /** - * Size - * @see https://tailwindcss.com/docs/size - */ - size: [{ - size: [ur, e, "auto", "min", "max", "fit"] - }], - // Typography - /** - * Font Size - * @see https://tailwindcss.com/docs/font-size - */ - "font-size": [{ - text: ["base", oa, sa] - }], - /** - * Font Smoothing - * @see https://tailwindcss.com/docs/font-smoothing - */ - "font-smoothing": ["antialiased", "subpixel-antialiased"], - /** - * Font Style - * @see https://tailwindcss.com/docs/font-style - */ - "font-style": ["italic", "not-italic"], - /** - * Font Weight - * @see https://tailwindcss.com/docs/font-weight - */ - "font-weight": [{ - font: ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black", s1] - }], - /** - * Font Family - * @see https://tailwindcss.com/docs/font-family - */ - "font-family": [{ - font: [zf] - }], - /** - * Font Variant Numeric - * @see https://tailwindcss.com/docs/font-variant-numeric - */ - "fvn-normal": ["normal-nums"], - /** - * Font Variant Numeric - * @see https://tailwindcss.com/docs/font-variant-numeric - */ - "fvn-ordinal": ["ordinal"], - /** - * Font Variant Numeric - * @see https://tailwindcss.com/docs/font-variant-numeric - */ - "fvn-slashed-zero": ["slashed-zero"], - /** - * Font Variant Numeric - * @see https://tailwindcss.com/docs/font-variant-numeric - */ - "fvn-figure": ["lining-nums", "oldstyle-nums"], - /** - * Font Variant Numeric - * @see https://tailwindcss.com/docs/font-variant-numeric - */ - "fvn-spacing": ["proportional-nums", "tabular-nums"], - /** - * Font Variant Numeric - * @see https://tailwindcss.com/docs/font-variant-numeric - */ - "fvn-fraction": ["diagonal-fractions", "stacked-fractions"], - /** - * Letter Spacing - * @see https://tailwindcss.com/docs/letter-spacing - */ - tracking: [{ - tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", ur] - }], - /** - * Line Clamp - * @see https://tailwindcss.com/docs/line-clamp - */ - "line-clamp": [{ - "line-clamp": ["none", Mu, s1] - }], - /** - * Line Height - * @see https://tailwindcss.com/docs/line-height - */ - leading: [{ - leading: ["none", "tight", "snug", "normal", "relaxed", "loose", _o, ur] - }], - /** - * List Style Image - * @see https://tailwindcss.com/docs/list-style-image - */ - "list-image": [{ - "list-image": ["none", ur] - }], - /** - * List Style Type - * @see https://tailwindcss.com/docs/list-style-type - */ - "list-style-type": [{ - list: ["none", "disc", "decimal", ur] - }], - /** - * List Style Position - * @see https://tailwindcss.com/docs/list-style-position - */ - "list-style-position": [{ - list: ["inside", "outside"] - }], - /** - * Placeholder Color - * @deprecated since Tailwind CSS v3.0.0 - * @see https://tailwindcss.com/docs/placeholder-color - */ - "placeholder-color": [{ - placeholder: [t] - }], - /** - * Placeholder Opacity - * @see https://tailwindcss.com/docs/placeholder-opacity - */ - "placeholder-opacity": [{ - "placeholder-opacity": [B] - }], - /** - * Text Alignment - * @see https://tailwindcss.com/docs/text-align - */ - "text-alignment": [{ - text: ["left", "center", "right", "justify", "start", "end"] - }], - /** - * Text Color - * @see https://tailwindcss.com/docs/text-color - */ - "text-color": [{ - text: [t] - }], - /** - * Text Opacity - * @see https://tailwindcss.com/docs/text-opacity - */ - "text-opacity": [{ - "text-opacity": [B] - }], - /** - * Text Decoration - * @see https://tailwindcss.com/docs/text-decoration - */ - "text-decoration": ["underline", "overline", "line-through", "no-underline"], - /** - * Text Decoration Style - * @see https://tailwindcss.com/docs/text-decoration-style - */ - "text-decoration-style": [{ - decoration: [...b(), "wavy"] - }], - /** - * Text Decoration Thickness - * @see https://tailwindcss.com/docs/text-decoration-thickness - */ - "text-decoration-thickness": [{ - decoration: ["auto", "from-font", _o, sa] - }], - /** - * Text Underline Offset - * @see https://tailwindcss.com/docs/text-underline-offset - */ - "underline-offset": [{ - "underline-offset": ["auto", _o, ur] - }], - /** - * Text Decoration Color - * @see https://tailwindcss.com/docs/text-decoration-color - */ - "text-decoration-color": [{ - decoration: [t] - }], - /** - * Text Transform - * @see https://tailwindcss.com/docs/text-transform - */ - "text-transform": ["uppercase", "lowercase", "capitalize", "normal-case"], - /** - * Text Overflow - * @see https://tailwindcss.com/docs/text-overflow - */ - "text-overflow": ["truncate", "text-ellipsis", "text-clip"], - /** - * Text Wrap - * @see https://tailwindcss.com/docs/text-wrap - */ - "text-wrap": [{ - text: ["wrap", "nowrap", "balance", "pretty"] - }], - /** - * Text Indent - * @see https://tailwindcss.com/docs/text-indent - */ - indent: [{ - indent: A() - }], - /** - * Vertical Alignment - * @see https://tailwindcss.com/docs/vertical-align - */ - "vertical-align": [{ - align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", ur] - }], - /** - * Whitespace - * @see https://tailwindcss.com/docs/whitespace - */ - whitespace: [{ - whitespace: ["normal", "nowrap", "pre", "pre-line", "pre-wrap", "break-spaces"] - }], - /** - * Word Break - * @see https://tailwindcss.com/docs/word-break - */ - break: [{ - break: ["normal", "words", "all", "keep"] - }], - /** - * Hyphens - * @see https://tailwindcss.com/docs/hyphens - */ - hyphens: [{ - hyphens: ["none", "manual", "auto"] - }], - /** - * Content - * @see https://tailwindcss.com/docs/content - */ - content: [{ - content: ["none", ur] - }], - // Backgrounds - /** - * Background Attachment - * @see https://tailwindcss.com/docs/background-attachment - */ - "bg-attachment": [{ - bg: ["fixed", "local", "scroll"] - }], - /** - * Background Clip - * @see https://tailwindcss.com/docs/background-clip - */ - "bg-clip": [{ - "bg-clip": ["border", "padding", "content", "text"] - }], - /** - * Background Opacity - * @deprecated since Tailwind CSS v3.0.0 - * @see https://tailwindcss.com/docs/background-opacity - */ - "bg-opacity": [{ - "bg-opacity": [B] - }], - /** - * Background Origin - * @see https://tailwindcss.com/docs/background-origin - */ - "bg-origin": [{ - "bg-origin": ["border", "padding", "content"] - }], - /** - * Background Position - * @see https://tailwindcss.com/docs/background-position - */ - "bg-position": [{ - bg: [...g(), Zne] - }], - /** - * Background Repeat - * @see https://tailwindcss.com/docs/background-repeat - */ - "bg-repeat": [{ - bg: ["no-repeat", { - repeat: ["", "x", "y", "round", "space"] - }] - }], - /** - * Background Size - * @see https://tailwindcss.com/docs/background-size - */ - "bg-size": [{ - bg: ["auto", "cover", "contain", Xne] - }], - /** - * Background Image - * @see https://tailwindcss.com/docs/background-image - */ - "bg-image": [{ - bg: ["none", { - "gradient-to": ["t", "tr", "r", "br", "b", "bl", "l", "tl"] - }, eie] - }], - /** - * Background Color - * @see https://tailwindcss.com/docs/background-color - */ - "bg-color": [{ - bg: [t] - }], - /** - * Gradient Color Stops From Position - * @see https://tailwindcss.com/docs/gradient-color-stops - */ - "gradient-from-pos": [{ - from: [P] - }], - /** - * Gradient Color Stops Via Position - * @see https://tailwindcss.com/docs/gradient-color-stops - */ - "gradient-via-pos": [{ - via: [P] - }], - /** - * Gradient Color Stops To Position - * @see https://tailwindcss.com/docs/gradient-color-stops - */ - "gradient-to-pos": [{ - to: [P] - }], - /** - * Gradient Color Stops From - * @see https://tailwindcss.com/docs/gradient-color-stops - */ - "gradient-from": [{ - from: [_] - }], - /** - * Gradient Color Stops Via - * @see https://tailwindcss.com/docs/gradient-color-stops - */ - "gradient-via": [{ - via: [_] - }], - /** - * Gradient Color Stops To - * @see https://tailwindcss.com/docs/gradient-color-stops - */ - "gradient-to": [{ - to: [_] - }], - // Borders - /** - * Border Radius - * @see https://tailwindcss.com/docs/border-radius - */ - rounded: [{ - rounded: [s] - }], - /** - * Border Radius Start - * @see https://tailwindcss.com/docs/border-radius - */ - "rounded-s": [{ - "rounded-s": [s] - }], - /** - * Border Radius End - * @see https://tailwindcss.com/docs/border-radius - */ - "rounded-e": [{ - "rounded-e": [s] - }], - /** - * Border Radius Top - * @see https://tailwindcss.com/docs/border-radius - */ - "rounded-t": [{ - "rounded-t": [s] - }], - /** - * Border Radius Right - * @see https://tailwindcss.com/docs/border-radius - */ - "rounded-r": [{ - "rounded-r": [s] - }], - /** - * Border Radius Bottom - * @see https://tailwindcss.com/docs/border-radius - */ - "rounded-b": [{ - "rounded-b": [s] - }], - /** - * Border Radius Left - * @see https://tailwindcss.com/docs/border-radius - */ - "rounded-l": [{ - "rounded-l": [s] - }], - /** - * Border Radius Start Start - * @see https://tailwindcss.com/docs/border-radius - */ - "rounded-ss": [{ - "rounded-ss": [s] - }], - /** - * Border Radius Start End - * @see https://tailwindcss.com/docs/border-radius - */ - "rounded-se": [{ - "rounded-se": [s] - }], - /** - * Border Radius End End - * @see https://tailwindcss.com/docs/border-radius - */ - "rounded-ee": [{ - "rounded-ee": [s] - }], - /** - * Border Radius End Start - * @see https://tailwindcss.com/docs/border-radius - */ - "rounded-es": [{ - "rounded-es": [s] - }], - /** - * Border Radius Top Left - * @see https://tailwindcss.com/docs/border-radius - */ - "rounded-tl": [{ - "rounded-tl": [s] - }], - /** - * Border Radius Top Right - * @see https://tailwindcss.com/docs/border-radius - */ - "rounded-tr": [{ - "rounded-tr": [s] - }], - /** - * Border Radius Bottom Right - * @see https://tailwindcss.com/docs/border-radius - */ - "rounded-br": [{ - "rounded-br": [s] - }], - /** - * Border Radius Bottom Left - * @see https://tailwindcss.com/docs/border-radius - */ - "rounded-bl": [{ - "rounded-bl": [s] - }], - /** - * Border Width - * @see https://tailwindcss.com/docs/border-width - */ - "border-w": [{ - border: [a] - }], - /** - * Border Width X - * @see https://tailwindcss.com/docs/border-width - */ - "border-w-x": [{ - "border-x": [a] - }], - /** - * Border Width Y - * @see https://tailwindcss.com/docs/border-width - */ - "border-w-y": [{ - "border-y": [a] - }], - /** - * Border Width Start - * @see https://tailwindcss.com/docs/border-width - */ - "border-w-s": [{ - "border-s": [a] - }], - /** - * Border Width End - * @see https://tailwindcss.com/docs/border-width - */ - "border-w-e": [{ - "border-e": [a] - }], - /** - * Border Width Top - * @see https://tailwindcss.com/docs/border-width - */ - "border-w-t": [{ - "border-t": [a] - }], - /** - * Border Width Right - * @see https://tailwindcss.com/docs/border-width - */ - "border-w-r": [{ - "border-r": [a] - }], - /** - * Border Width Bottom - * @see https://tailwindcss.com/docs/border-width - */ - "border-w-b": [{ - "border-b": [a] - }], - /** - * Border Width Left - * @see https://tailwindcss.com/docs/border-width - */ - "border-w-l": [{ - "border-l": [a] - }], - /** - * Border Opacity - * @see https://tailwindcss.com/docs/border-opacity - */ - "border-opacity": [{ - "border-opacity": [B] - }], - /** - * Border Style - * @see https://tailwindcss.com/docs/border-style - */ - "border-style": [{ - border: [...b(), "hidden"] - }], - /** - * Divide Width X - * @see https://tailwindcss.com/docs/divide-width - */ - "divide-x": [{ - "divide-x": [a] - }], - /** - * Divide Width X Reverse - * @see https://tailwindcss.com/docs/divide-width - */ - "divide-x-reverse": ["divide-x-reverse"], - /** - * Divide Width Y - * @see https://tailwindcss.com/docs/divide-width - */ - "divide-y": [{ - "divide-y": [a] - }], - /** - * Divide Width Y Reverse - * @see https://tailwindcss.com/docs/divide-width - */ - "divide-y-reverse": ["divide-y-reverse"], - /** - * Divide Opacity - * @see https://tailwindcss.com/docs/divide-opacity - */ - "divide-opacity": [{ - "divide-opacity": [B] - }], - /** - * Divide Style - * @see https://tailwindcss.com/docs/divide-style - */ - "divide-style": [{ - divide: b() - }], - /** - * Border Color - * @see https://tailwindcss.com/docs/border-color - */ - "border-color": [{ - border: [i] - }], - /** - * Border Color X - * @see https://tailwindcss.com/docs/border-color - */ - "border-color-x": [{ - "border-x": [i] - }], - /** - * Border Color Y - * @see https://tailwindcss.com/docs/border-color - */ - "border-color-y": [{ - "border-y": [i] - }], - /** - * Border Color S - * @see https://tailwindcss.com/docs/border-color - */ - "border-color-s": [{ - "border-s": [i] - }], - /** - * Border Color E - * @see https://tailwindcss.com/docs/border-color - */ - "border-color-e": [{ - "border-e": [i] - }], - /** - * Border Color Top - * @see https://tailwindcss.com/docs/border-color - */ - "border-color-t": [{ - "border-t": [i] - }], - /** - * Border Color Right - * @see https://tailwindcss.com/docs/border-color - */ - "border-color-r": [{ - "border-r": [i] - }], - /** - * Border Color Bottom - * @see https://tailwindcss.com/docs/border-color - */ - "border-color-b": [{ - "border-b": [i] - }], - /** - * Border Color Left - * @see https://tailwindcss.com/docs/border-color - */ - "border-color-l": [{ - "border-l": [i] - }], - /** - * Divide Color - * @see https://tailwindcss.com/docs/divide-color - */ - "divide-color": [{ - divide: [i] - }], - /** - * Outline Style - * @see https://tailwindcss.com/docs/outline-style - */ - "outline-style": [{ - outline: ["", ...b()] - }], - /** - * Outline Offset - * @see https://tailwindcss.com/docs/outline-offset - */ - "outline-offset": [{ - "outline-offset": [_o, ur] - }], - /** - * Outline Width - * @see https://tailwindcss.com/docs/outline-width - */ - "outline-w": [{ - outline: [_o, sa] - }], - /** - * Outline Color - * @see https://tailwindcss.com/docs/outline-color - */ - "outline-color": [{ - outline: [t] - }], - /** - * Ring Width - * @see https://tailwindcss.com/docs/ring-width - */ - "ring-w": [{ - ring: m() - }], - /** - * Ring Width Inset - * @see https://tailwindcss.com/docs/ring-width - */ - "ring-w-inset": ["ring-inset"], - /** - * Ring Color - * @see https://tailwindcss.com/docs/ring-color - */ - "ring-color": [{ - ring: [t] - }], - /** - * Ring Opacity - * @see https://tailwindcss.com/docs/ring-opacity - */ - "ring-opacity": [{ - "ring-opacity": [B] - }], - /** - * Ring Offset Width - * @see https://tailwindcss.com/docs/ring-offset-width - */ - "ring-offset-w": [{ - "ring-offset": [_o, sa] - }], - /** - * Ring Offset Color - * @see https://tailwindcss.com/docs/ring-offset-color - */ - "ring-offset-color": [{ - "ring-offset": [t] - }], - // Effects - /** - * Box Shadow - * @see https://tailwindcss.com/docs/box-shadow - */ - shadow: [{ - shadow: ["", "inner", "none", oa, tie] - }], - /** - * Box Shadow Color - * @see https://tailwindcss.com/docs/box-shadow-color - */ - "shadow-color": [{ - shadow: [zf] - }], - /** - * Opacity - * @see https://tailwindcss.com/docs/opacity - */ - opacity: [{ - opacity: [B] - }], - /** - * Mix Blend Mode - * @see https://tailwindcss.com/docs/mix-blend-mode - */ - "mix-blend": [{ - "mix-blend": [...x(), "plus-lighter", "plus-darker"] - }], - /** - * Background Blend Mode - * @see https://tailwindcss.com/docs/background-blend-mode - */ - "bg-blend": [{ - "bg-blend": x() - }], - // Filters - /** - * Filter - * @deprecated since Tailwind CSS v3.0.0 - * @see https://tailwindcss.com/docs/filter - */ - filter: [{ - filter: ["", "none"] - }], - /** - * Blur - * @see https://tailwindcss.com/docs/blur - */ - blur: [{ - blur: [r] - }], - /** - * Brightness - * @see https://tailwindcss.com/docs/brightness - */ - brightness: [{ - brightness: [n] - }], - /** - * Contrast - * @see https://tailwindcss.com/docs/contrast - */ - contrast: [{ - contrast: [u] - }], - /** - * Drop Shadow - * @see https://tailwindcss.com/docs/drop-shadow - */ - "drop-shadow": [{ - "drop-shadow": ["", "none", oa, ur] - }], - /** - * Grayscale - * @see https://tailwindcss.com/docs/grayscale - */ - grayscale: [{ - grayscale: [l] - }], - /** - * Hue Rotate - * @see https://tailwindcss.com/docs/hue-rotate - */ - "hue-rotate": [{ - "hue-rotate": [d] - }], - /** - * Invert - * @see https://tailwindcss.com/docs/invert - */ - invert: [{ - invert: [p] - }], - /** - * Saturate - * @see https://tailwindcss.com/docs/saturate - */ - saturate: [{ - saturate: [W] - }], - /** - * Sepia - * @see https://tailwindcss.com/docs/sepia - */ - sepia: [{ - sepia: [V] - }], - /** - * Backdrop Filter - * @deprecated since Tailwind CSS v3.0.0 - * @see https://tailwindcss.com/docs/backdrop-filter - */ - "backdrop-filter": [{ - "backdrop-filter": ["", "none"] - }], - /** - * Backdrop Blur - * @see https://tailwindcss.com/docs/backdrop-blur - */ - "backdrop-blur": [{ - "backdrop-blur": [r] - }], - /** - * Backdrop Brightness - * @see https://tailwindcss.com/docs/backdrop-brightness - */ - "backdrop-brightness": [{ - "backdrop-brightness": [n] - }], - /** - * Backdrop Contrast - * @see https://tailwindcss.com/docs/backdrop-contrast - */ - "backdrop-contrast": [{ - "backdrop-contrast": [u] - }], - /** - * Backdrop Grayscale - * @see https://tailwindcss.com/docs/backdrop-grayscale - */ - "backdrop-grayscale": [{ - "backdrop-grayscale": [l] - }], - /** - * Backdrop Hue Rotate - * @see https://tailwindcss.com/docs/backdrop-hue-rotate - */ - "backdrop-hue-rotate": [{ - "backdrop-hue-rotate": [d] - }], - /** - * Backdrop Invert - * @see https://tailwindcss.com/docs/backdrop-invert - */ - "backdrop-invert": [{ - "backdrop-invert": [p] - }], - /** - * Backdrop Opacity - * @see https://tailwindcss.com/docs/backdrop-opacity - */ - "backdrop-opacity": [{ - "backdrop-opacity": [B] - }], - /** - * Backdrop Saturate - * @see https://tailwindcss.com/docs/backdrop-saturate - */ - "backdrop-saturate": [{ - "backdrop-saturate": [W] - }], - /** - * Backdrop Sepia - * @see https://tailwindcss.com/docs/backdrop-sepia - */ - "backdrop-sepia": [{ - "backdrop-sepia": [V] - }], - // Tables - /** - * Border Collapse - * @see https://tailwindcss.com/docs/border-collapse - */ - "border-collapse": [{ - border: ["collapse", "separate"] - }], - /** - * Border Spacing - * @see https://tailwindcss.com/docs/border-spacing - */ - "border-spacing": [{ - "border-spacing": [o] - }], - /** - * Border Spacing X - * @see https://tailwindcss.com/docs/border-spacing - */ - "border-spacing-x": [{ - "border-spacing-x": [o] - }], - /** - * Border Spacing Y - * @see https://tailwindcss.com/docs/border-spacing - */ - "border-spacing-y": [{ - "border-spacing-y": [o] - }], - /** - * Table Layout - * @see https://tailwindcss.com/docs/table-layout - */ - "table-layout": [{ - table: ["auto", "fixed"] - }], - /** - * Caption Side - * @see https://tailwindcss.com/docs/caption-side - */ - caption: [{ - caption: ["top", "bottom"] - }], - // Transitions and Animation - /** - * Tranisition Property - * @see https://tailwindcss.com/docs/transition-property - */ - transition: [{ - transition: ["none", "all", "", "colors", "opacity", "shadow", "transform", ur] - }], - /** - * Transition Duration - * @see https://tailwindcss.com/docs/transition-duration - */ - duration: [{ - duration: M() - }], - /** - * Transition Timing Function - * @see https://tailwindcss.com/docs/transition-timing-function - */ - ease: [{ - ease: ["linear", "in", "out", "in-out", ur] - }], - /** - * Transition Delay - * @see https://tailwindcss.com/docs/transition-delay - */ - delay: [{ - delay: M() - }], - /** - * Animation - * @see https://tailwindcss.com/docs/animation - */ - animate: [{ - animate: ["none", "spin", "ping", "pulse", "bounce", ur] - }], - // Transforms - /** - * Transform - * @see https://tailwindcss.com/docs/transform - */ - transform: [{ - transform: ["", "gpu", "none"] - }], - /** - * Scale - * @see https://tailwindcss.com/docs/scale - */ - scale: [{ - scale: [U] - }], - /** - * Scale X - * @see https://tailwindcss.com/docs/scale - */ - "scale-x": [{ - "scale-x": [U] - }], - /** - * Scale Y - * @see https://tailwindcss.com/docs/scale - */ - "scale-y": [{ - "scale-y": [U] - }], - /** - * Rotate - * @see https://tailwindcss.com/docs/rotate - */ - rotate: [{ - rotate: [qf, ur] - }], - /** - * Translate X - * @see https://tailwindcss.com/docs/translate - */ - "translate-x": [{ - "translate-x": [K] - }], - /** - * Translate Y - * @see https://tailwindcss.com/docs/translate - */ - "translate-y": [{ - "translate-y": [K] - }], - /** - * Skew X - * @see https://tailwindcss.com/docs/skew - */ - "skew-x": [{ - "skew-x": [Q] - }], - /** - * Skew Y - * @see https://tailwindcss.com/docs/skew - */ - "skew-y": [{ - "skew-y": [Q] - }], - /** - * Transform Origin - * @see https://tailwindcss.com/docs/transform-origin - */ - "transform-origin": [{ - origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left", ur] - }], - // Interactivity - /** - * Accent Color - * @see https://tailwindcss.com/docs/accent-color - */ - accent: [{ - accent: ["auto", t] - }], - /** - * Appearance - * @see https://tailwindcss.com/docs/appearance - */ - appearance: [{ - appearance: ["none", "auto"] - }], - /** - * Cursor - * @see https://tailwindcss.com/docs/cursor - */ - cursor: [{ - cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out", ur] - }], - /** - * Caret Color - * @see https://tailwindcss.com/docs/just-in-time-mode#caret-color-utilities - */ - "caret-color": [{ - caret: [t] - }], - /** - * Pointer Events - * @see https://tailwindcss.com/docs/pointer-events - */ - "pointer-events": [{ - "pointer-events": ["none", "auto"] - }], - /** - * Resize - * @see https://tailwindcss.com/docs/resize - */ - resize: [{ - resize: ["none", "y", "x", ""] - }], - /** - * Scroll Behavior - * @see https://tailwindcss.com/docs/scroll-behavior - */ - "scroll-behavior": [{ - scroll: ["auto", "smooth"] - }], - /** - * Scroll Margin - * @see https://tailwindcss.com/docs/scroll-margin - */ - "scroll-m": [{ - "scroll-m": A() - }], - /** - * Scroll Margin X - * @see https://tailwindcss.com/docs/scroll-margin - */ - "scroll-mx": [{ - "scroll-mx": A() - }], - /** - * Scroll Margin Y - * @see https://tailwindcss.com/docs/scroll-margin - */ - "scroll-my": [{ - "scroll-my": A() - }], - /** - * Scroll Margin Start - * @see https://tailwindcss.com/docs/scroll-margin - */ - "scroll-ms": [{ - "scroll-ms": A() - }], - /** - * Scroll Margin End - * @see https://tailwindcss.com/docs/scroll-margin - */ - "scroll-me": [{ - "scroll-me": A() - }], - /** - * Scroll Margin Top - * @see https://tailwindcss.com/docs/scroll-margin - */ - "scroll-mt": [{ - "scroll-mt": A() - }], - /** - * Scroll Margin Right - * @see https://tailwindcss.com/docs/scroll-margin - */ - "scroll-mr": [{ - "scroll-mr": A() - }], - /** - * Scroll Margin Bottom - * @see https://tailwindcss.com/docs/scroll-margin - */ - "scroll-mb": [{ - "scroll-mb": A() - }], - /** - * Scroll Margin Left - * @see https://tailwindcss.com/docs/scroll-margin - */ - "scroll-ml": [{ - "scroll-ml": A() - }], - /** - * Scroll Padding - * @see https://tailwindcss.com/docs/scroll-padding - */ - "scroll-p": [{ - "scroll-p": A() - }], - /** - * Scroll Padding X - * @see https://tailwindcss.com/docs/scroll-padding - */ - "scroll-px": [{ - "scroll-px": A() - }], - /** - * Scroll Padding Y - * @see https://tailwindcss.com/docs/scroll-padding - */ - "scroll-py": [{ - "scroll-py": A() - }], - /** - * Scroll Padding Start - * @see https://tailwindcss.com/docs/scroll-padding - */ - "scroll-ps": [{ - "scroll-ps": A() - }], - /** - * Scroll Padding End - * @see https://tailwindcss.com/docs/scroll-padding - */ - "scroll-pe": [{ - "scroll-pe": A() - }], - /** - * Scroll Padding Top - * @see https://tailwindcss.com/docs/scroll-padding - */ - "scroll-pt": [{ - "scroll-pt": A() - }], - /** - * Scroll Padding Right - * @see https://tailwindcss.com/docs/scroll-padding - */ - "scroll-pr": [{ - "scroll-pr": A() - }], - /** - * Scroll Padding Bottom - * @see https://tailwindcss.com/docs/scroll-padding - */ - "scroll-pb": [{ - "scroll-pb": A() - }], - /** - * Scroll Padding Left - * @see https://tailwindcss.com/docs/scroll-padding - */ - "scroll-pl": [{ - "scroll-pl": A() - }], - /** - * Scroll Snap Align - * @see https://tailwindcss.com/docs/scroll-snap-align - */ - "snap-align": [{ - snap: ["start", "end", "center", "align-none"] - }], - /** - * Scroll Snap Stop - * @see https://tailwindcss.com/docs/scroll-snap-stop - */ - "snap-stop": [{ - snap: ["normal", "always"] - }], - /** - * Scroll Snap Type - * @see https://tailwindcss.com/docs/scroll-snap-type - */ - "snap-type": [{ - snap: ["none", "x", "y", "both"] - }], - /** - * Scroll Snap Type Strictness - * @see https://tailwindcss.com/docs/scroll-snap-type - */ - "snap-strictness": [{ - snap: ["mandatory", "proximity"] - }], - /** - * Touch Action - * @see https://tailwindcss.com/docs/touch-action - */ - touch: [{ - touch: ["auto", "none", "manipulation"] - }], - /** - * Touch Action X - * @see https://tailwindcss.com/docs/touch-action - */ - "touch-x": [{ - "touch-pan": ["x", "left", "right"] - }], - /** - * Touch Action Y - * @see https://tailwindcss.com/docs/touch-action - */ - "touch-y": [{ - "touch-pan": ["y", "up", "down"] - }], - /** - * Touch Action Pinch Zoom - * @see https://tailwindcss.com/docs/touch-action - */ - "touch-pz": ["touch-pinch-zoom"], - /** - * User Select - * @see https://tailwindcss.com/docs/user-select - */ - select: [{ - select: ["none", "text", "all", "auto"] - }], - /** - * Will Change - * @see https://tailwindcss.com/docs/will-change - */ - "will-change": [{ - "will-change": ["auto", "scroll", "contents", "transform", ur] - }], - // SVG - /** - * Fill - * @see https://tailwindcss.com/docs/fill - */ - fill: [{ - fill: [t, "none"] - }], - /** - * Stroke Width - * @see https://tailwindcss.com/docs/stroke-width - */ - "stroke-w": [{ - stroke: [_o, sa, s1] - }], - /** - * Stroke - * @see https://tailwindcss.com/docs/stroke - */ - stroke: [{ - stroke: [t, "none"] - }], - // Accessibility - /** - * Screen Readers - * @see https://tailwindcss.com/docs/screen-readers - */ - sr: ["sr-only", "not-sr-only"], - /** - * Forced Color Adjust - * @see https://tailwindcss.com/docs/forced-color-adjust - */ - "forced-color-adjust": [{ - "forced-color-adjust": ["auto", "none"] - }] - }, - conflictingClassGroups: { - overflow: ["overflow-x", "overflow-y"], - overscroll: ["overscroll-x", "overscroll-y"], - inset: ["inset-x", "inset-y", "start", "end", "top", "right", "bottom", "left"], - "inset-x": ["right", "left"], - "inset-y": ["top", "bottom"], - flex: ["basis", "grow", "shrink"], - gap: ["gap-x", "gap-y"], - p: ["px", "py", "ps", "pe", "pt", "pr", "pb", "pl"], - px: ["pr", "pl"], - py: ["pt", "pb"], - m: ["mx", "my", "ms", "me", "mt", "mr", "mb", "ml"], - mx: ["mr", "ml"], - my: ["mt", "mb"], - size: ["w", "h"], - "font-size": ["leading"], - "fvn-normal": ["fvn-ordinal", "fvn-slashed-zero", "fvn-figure", "fvn-spacing", "fvn-fraction"], - "fvn-ordinal": ["fvn-normal"], - "fvn-slashed-zero": ["fvn-normal"], - "fvn-figure": ["fvn-normal"], - "fvn-spacing": ["fvn-normal"], - "fvn-fraction": ["fvn-normal"], - "line-clamp": ["display", "overflow"], - rounded: ["rounded-s", "rounded-e", "rounded-t", "rounded-r", "rounded-b", "rounded-l", "rounded-ss", "rounded-se", "rounded-ee", "rounded-es", "rounded-tl", "rounded-tr", "rounded-br", "rounded-bl"], - "rounded-s": ["rounded-ss", "rounded-es"], - "rounded-e": ["rounded-se", "rounded-ee"], - "rounded-t": ["rounded-tl", "rounded-tr"], - "rounded-r": ["rounded-tr", "rounded-br"], - "rounded-b": ["rounded-br", "rounded-bl"], - "rounded-l": ["rounded-tl", "rounded-bl"], - "border-spacing": ["border-spacing-x", "border-spacing-y"], - "border-w": ["border-w-s", "border-w-e", "border-w-t", "border-w-r", "border-w-b", "border-w-l"], - "border-w-x": ["border-w-r", "border-w-l"], - "border-w-y": ["border-w-t", "border-w-b"], - "border-color": ["border-color-s", "border-color-e", "border-color-t", "border-color-r", "border-color-b", "border-color-l"], - "border-color-x": ["border-color-r", "border-color-l"], - "border-color-y": ["border-color-t", "border-color-b"], - "scroll-m": ["scroll-mx", "scroll-my", "scroll-ms", "scroll-me", "scroll-mt", "scroll-mr", "scroll-mb", "scroll-ml"], - "scroll-mx": ["scroll-mr", "scroll-ml"], - "scroll-my": ["scroll-mt", "scroll-mb"], - "scroll-p": ["scroll-px", "scroll-py", "scroll-ps", "scroll-pe", "scroll-pt", "scroll-pr", "scroll-pb", "scroll-pl"], - "scroll-px": ["scroll-pr", "scroll-pl"], - "scroll-py": ["scroll-pt", "scroll-pb"], - touch: ["touch-x", "touch-y", "touch-pz"], - "touch-x": ["touch"], - "touch-y": ["touch"], - "touch-pz": ["touch"] - }, - conflictingClassGroupModifiers: { - "font-size": ["leading"] - } - }; -}, oie = /* @__PURE__ */ Une(sie); -function $o(...t) { - return oie(Ine(t)); -} -function eA(t) { - const { className: e } = t; - return /* @__PURE__ */ le.jsxs("div", { className: $o("xc-flex xc-items-center xc-gap-2"), children: [ - /* @__PURE__ */ le.jsx("hr", { className: $o("xc-flex-1 xc-border-gray-200", e) }), - /* @__PURE__ */ le.jsx("div", { className: "xc-shrink-0", children: t.children }), - /* @__PURE__ */ le.jsx("hr", { className: $o("xc-flex-1 xc-border-gray-200", e) }) - ] }); -} -function aie(t) { - var n, i; - const { wallet: e, onClick: r } = t; - return /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4", children: [ - /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-h-16 xc-w-16", src: (n = e.config) == null ? void 0 : n.image, alt: "" }), - /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ - /* @__PURE__ */ le.jsxs("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: [ - "Connect to ", - (i = e.config) == null ? void 0 : i.name - ] }), - /* @__PURE__ */ le.jsx("div", { className: "xc-flex xc-gap-2", children: /* @__PURE__ */ le.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: () => r(e), children: "Connect" }) }) - ] }) - ] }); -} -const cie = "https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton"; -function uie(t) { - const { onClick: e } = t; - function r() { - e && e(); - } - return /* @__PURE__ */ le.jsx(eA, { className: "xc-opacity-20", children: /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2 xc-cursor-pointer", onClick: r, children: [ - /* @__PURE__ */ le.jsx("span", { className: "xc-text-sm", children: "View more wallets" }), - /* @__PURE__ */ le.jsx(b7, { size: 16 }) - ] }) }); -} -function tA(t) { - const [e, r] = Yt(""), { featuredWallets: n, initialized: i } = Tp(), { onEmailConfirm: s, onSelectWallet: o, onSelectMoreWallets: a, onSelectTonConnect: u, config: l } = t, d = wi(() => { - const O = /[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu, L = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; - return !O.test(e) && L.test(e); - }, [e]); - function p(O) { - o(O); - } - function w(O) { - r(O.target.value); - } - async function _() { - s(e); - } - function P(O) { - O.key === "Enter" && d && _(); - } - return /* @__PURE__ */ le.jsx(Rs, { children: i && /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ - t.header || /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6 xc-text-xl xc-font-bold", children: "Log in or sign up" }), - n.length === 1 && /* @__PURE__ */ le.jsx("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: n.map((O) => /* @__PURE__ */ le.jsx( - aie, - { - wallet: O, - onClick: p - }, - `feature-${O.key}` - )) }), - n.length > 1 && /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ - /* @__PURE__ */ le.jsxs("div", { children: [ - /* @__PURE__ */ le.jsxs("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: [ - l.showFeaturedWallets && n && n.map((O) => /* @__PURE__ */ le.jsx( - V9, - { - wallet: O, - onClick: p - }, - `feature-${O.key}` - )), - l.showTonConnect && /* @__PURE__ */ le.jsx( - xy, - { - icon: /* @__PURE__ */ le.jsx("img", { className: "xc-h-5 xc-w-5", src: cie }), - title: "TON Connect", - onClick: u - } - ) - ] }), - l.showMoreWallets && /* @__PURE__ */ le.jsx(uie, { onClick: a }) - ] }), - l.showEmailSignIn && (l.showFeaturedWallets || l.showTonConnect) && /* @__PURE__ */ le.jsx("div", { className: "xc-mb-4 xc-mt-4", children: /* @__PURE__ */ le.jsxs(eA, { className: "xc-opacity-20", children: [ - " ", - /* @__PURE__ */ le.jsx("span", { className: "xc-text-sm xc-opacity-20", children: "OR" }) - ] }) }), - l.showEmailSignIn && /* @__PURE__ */ le.jsxs("div", { className: "xc-mb-4", children: [ - /* @__PURE__ */ le.jsx("input", { className: "xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3", placeholder: "Enter your email", type: "email", onChange: w, onKeyDown: P }), - /* @__PURE__ */ le.jsx("button", { disabled: !d, className: "xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all", onClick: _, children: "Continue" }) - ] }) - ] }) - ] }) }); -} -function kc(t) { - const { title: e } = t; - return /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-items-center xc-gap-2", children: [ - /* @__PURE__ */ le.jsx(HZ, { onClick: t.onBack, size: 20, className: "xc-cursor-pointer" }), - /* @__PURE__ */ le.jsx("span", { children: e }) - ] }); -} -const rA = Ta({ - channel: "", - device: "WEB", - app: "", - inviterCode: "", - role: "C" -}); -function Ey() { - return Tn(rA); -} -function fie(t) { - const { config: e } = t, [r, n] = Yt(e.channel), [i, s] = Yt(e.device), [o, a] = Yt(e.app), [u, l] = Yt(e.role || "C"), [d, p] = Yt(e.inviterCode); - return Dn(() => { - n(e.channel), s(e.device), a(e.app), p(e.inviterCode), l(e.role || "C"); - }, [e]), /* @__PURE__ */ le.jsx( - rA.Provider, - { - value: { - channel: r, - device: i, - app: o, - inviterCode: d, - role: u - }, - children: t.children - } - ); -} -var lie = Object.defineProperty, hie = Object.defineProperties, die = Object.getOwnPropertyDescriptors, k0 = Object.getOwnPropertySymbols, nA = Object.prototype.hasOwnProperty, iA = Object.prototype.propertyIsEnumerable, P5 = (t, e, r) => e in t ? lie(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, pie = (t, e) => { - for (var r in e || (e = {})) nA.call(e, r) && P5(t, r, e[r]); - if (k0) for (var r of k0(e)) iA.call(e, r) && P5(t, r, e[r]); - return t; -}, gie = (t, e) => hie(t, die(e)), mie = (t, e) => { - var r = {}; - for (var n in t) nA.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); - if (t != null && k0) for (var n of k0(t)) e.indexOf(n) < 0 && iA.call(t, n) && (r[n] = t[n]); - return r; -}; -function vie(t) { - let e = setTimeout(t, 0), r = setTimeout(t, 10), n = setTimeout(t, 50); - return [e, r, n]; -} -function bie(t) { - let e = Gt.useRef(); - return Gt.useEffect(() => { - e.current = t; - }), e.current; -} -var yie = 18, sA = 40, wie = `${sA}px`, xie = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(","); -function _ie({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isFocused: n }) { - let [i, s] = Gt.useState(!1), [o, a] = Gt.useState(!1), [u, l] = Gt.useState(!1), d = Gt.useMemo(() => r === "none" ? !1 : (r === "increase-width" || r === "experimental-no-flickering") && i && o, [i, o, r]), p = Gt.useCallback(() => { - let w = t.current, _ = e.current; - if (!w || !_ || u || r === "none") return; - let P = w, O = P.getBoundingClientRect().left + P.offsetWidth, L = P.getBoundingClientRect().top + P.offsetHeight / 2, B = O - yie, k = L; - document.querySelectorAll(xie).length === 0 && document.elementFromPoint(B, k) === w || (s(!0), l(!0)); - }, [t, e, u, r]); - return Gt.useEffect(() => { - let w = t.current; - if (!w || r === "none") return; - function _() { - let O = window.innerWidth - w.getBoundingClientRect().right; - a(O >= sA); - } - _(); - let P = setInterval(_, 1e3); - return () => { - clearInterval(P); - }; - }, [t, r]), Gt.useEffect(() => { - let w = n || document.activeElement === e.current; - if (r === "none" || !w) return; - let _ = setTimeout(p, 0), P = setTimeout(p, 2e3), O = setTimeout(p, 5e3), L = setTimeout(() => { - l(!0); - }, 6e3); - return () => { - clearTimeout(_), clearTimeout(P), clearTimeout(O), clearTimeout(L); - }; - }, [e, n, r, p]), { hasPWMBadge: i, willPushPWMBadge: d, PWM_BADGE_SPACE_WIDTH: wie }; -} -var oA = Gt.createContext({}), aA = Gt.forwardRef((t, e) => { - var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: u, inputMode: l = "numeric", onComplete: d, pushPasswordManagerStrategy: p = "increase-width", pasteTransformer: w, containerClassName: _, noScriptCSSFallback: P = Eie, render: O, children: L } = r, B = mie(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), k, W, U, V, Q; - let [R, K] = Gt.useState(typeof B.defaultValue == "string" ? B.defaultValue : ""), ge = n ?? R, Ee = bie(ge), Y = Gt.useCallback((ie) => { - i == null || i(ie), K(ie); - }, [i]), A = Gt.useMemo(() => a ? typeof a == "string" ? new RegExp(a) : a : null, [a]), m = Gt.useRef(null), f = Gt.useRef(null), g = Gt.useRef({ value: ge, onChange: Y, isIOS: typeof window < "u" && ((W = (k = window == null ? void 0 : window.CSS) == null ? void 0 : k.supports) == null ? void 0 : W.call(k, "-webkit-touch-callout", "none")) }), b = Gt.useRef({ prev: [(U = m.current) == null ? void 0 : U.selectionStart, (V = m.current) == null ? void 0 : V.selectionEnd, (Q = m.current) == null ? void 0 : Q.selectionDirection] }); - Gt.useImperativeHandle(e, () => m.current, []), Gt.useEffect(() => { - let ie = m.current, ue = f.current; - if (!ie || !ue) return; - g.current.value !== ie.value && g.current.onChange(ie.value), b.current.prev = [ie.selectionStart, ie.selectionEnd, ie.selectionDirection]; - function ve() { - if (document.activeElement !== ie) { - I(null), ce(null); - return; - } - let Ce = ie.selectionStart, $e = ie.selectionEnd, Me = ie.selectionDirection, Ne = ie.maxLength, Ke = ie.value, Le = b.current.prev, qe = -1, ze = -1, _e; - if (Ke.length !== 0 && Ce !== null && $e !== null) { - let Qe = Ce === $e, tt = Ce === Ke.length && Ke.length < Ne; - if (Qe && !tt) { - let Ye = Ce; - if (Ye === 0) qe = 0, ze = 1, _e = "forward"; - else if (Ye === Ne) qe = Ye - 1, ze = Ye, _e = "backward"; - else if (Ne > 1 && Ke.length > 1) { - let dt = 0; - if (Le[0] !== null && Le[1] !== null) { - _e = Ye < Le[1] ? "backward" : "forward"; - let lt = Le[0] === Le[1] && Le[0] < Ne; - _e === "backward" && !lt && (dt = -1); - } - qe = dt + Ye, ze = dt + Ye + 1; - } - } - qe !== -1 && ze !== -1 && qe !== ze && m.current.setSelectionRange(qe, ze, _e); - } - let Ze = qe !== -1 ? qe : Ce, at = ze !== -1 ? ze : $e, ke = _e ?? Me; - I(Ze), ce(at), b.current.prev = [Ze, at, ke]; - } - if (document.addEventListener("selectionchange", ve, { capture: !0 }), ve(), document.activeElement === ie && v(!0), !document.getElementById("input-otp-style")) { - let Ce = document.createElement("style"); - if (Ce.id = "input-otp-style", document.head.appendChild(Ce), Ce.sheet) { - let $e = "background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;"; - Wf(Ce.sheet, "[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"), Wf(Ce.sheet, `[data-input-otp]:autofill { ${$e} }`), Wf(Ce.sheet, `[data-input-otp]:-webkit-autofill { ${$e} }`), Wf(Ce.sheet, "@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"), Wf(Ce.sheet, "[data-input-otp] + * { pointer-events: all !important; }"); - } - } - let Pe = () => { - ue && ue.style.setProperty("--root-height", `${ie.clientHeight}px`); - }; - Pe(); - let De = new ResizeObserver(Pe); - return De.observe(ie), () => { - document.removeEventListener("selectionchange", ve, { capture: !0 }), De.disconnect(); - }; - }, []); - let [x, E] = Gt.useState(!1), [S, v] = Gt.useState(!1), [M, I] = Gt.useState(null), [F, ce] = Gt.useState(null); - Gt.useEffect(() => { - vie(() => { - var ie, ue, ve, Pe; - (ie = m.current) == null || ie.dispatchEvent(new Event("input")); - let De = (ue = m.current) == null ? void 0 : ue.selectionStart, Ce = (ve = m.current) == null ? void 0 : ve.selectionEnd, $e = (Pe = m.current) == null ? void 0 : Pe.selectionDirection; - De !== null && Ce !== null && (I(De), ce(Ce), b.current.prev = [De, Ce, $e]); - }); - }, [ge, S]), Gt.useEffect(() => { - Ee !== void 0 && ge !== Ee && Ee.length < s && ge.length === s && (d == null || d(ge)); - }, [s, d, Ee, ge]); - let D = _ie({ containerRef: f, inputRef: m, pushPasswordManagerStrategy: p, isFocused: S }), oe = Gt.useCallback((ie) => { - let ue = ie.currentTarget.value.slice(0, s); - if (ue.length > 0 && A && !A.test(ue)) { - ie.preventDefault(); - return; - } - typeof Ee == "string" && ue.length < Ee.length && document.dispatchEvent(new Event("selectionchange")), Y(ue); - }, [s, Y, Ee, A]), Z = Gt.useCallback(() => { - var ie; - if (m.current) { - let ue = Math.min(m.current.value.length, s - 1), ve = m.current.value.length; - (ie = m.current) == null || ie.setSelectionRange(ue, ve), I(ue), ce(ve); - } - v(!0); - }, [s]), J = Gt.useCallback((ie) => { - var ue, ve; - let Pe = m.current; - if (!w && (!g.current.isIOS || !ie.clipboardData || !Pe)) return; - let De = ie.clipboardData.getData("text/plain"), Ce = w ? w(De) : De; - console.log({ _content: De, content: Ce }), ie.preventDefault(); - let $e = (ue = m.current) == null ? void 0 : ue.selectionStart, Me = (ve = m.current) == null ? void 0 : ve.selectionEnd, Ne = ($e !== Me ? ge.slice(0, $e) + Ce + ge.slice(Me) : ge.slice(0, $e) + Ce + ge.slice($e)).slice(0, s); - if (Ne.length > 0 && A && !A.test(Ne)) return; - Pe.value = Ne, Y(Ne); - let Ke = Math.min(Ne.length, s - 1), Le = Ne.length; - Pe.setSelectionRange(Ke, Le), I(Ke), ce(Le); - }, [s, Y, A, ge]), ee = Gt.useMemo(() => ({ position: "relative", cursor: B.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [B.disabled]), T = Gt.useMemo(() => ({ position: "absolute", inset: 0, width: D.willPushPWMBadge ? `calc(100% + ${D.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: D.willPushPWMBadge ? `inset(0 ${D.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: o, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [D.PWM_BADGE_SPACE_WIDTH, D.willPushPWMBadge, o]), X = Gt.useMemo(() => Gt.createElement("input", gie(pie({ autoComplete: B.autoComplete || "one-time-code" }, B), { "data-input-otp": !0, "data-input-otp-placeholder-shown": ge.length === 0 || void 0, "data-input-otp-mss": M, "data-input-otp-mse": F, inputMode: l, pattern: A == null ? void 0 : A.source, "aria-placeholder": u, style: T, maxLength: s, value: ge, ref: m, onPaste: (ie) => { - var ue; - J(ie), (ue = B.onPaste) == null || ue.call(B, ie); - }, onChange: oe, onMouseOver: (ie) => { - var ue; - E(!0), (ue = B.onMouseOver) == null || ue.call(B, ie); - }, onMouseLeave: (ie) => { - var ue; - E(!1), (ue = B.onMouseLeave) == null || ue.call(B, ie); - }, onFocus: (ie) => { - var ue; - Z(), (ue = B.onFocus) == null || ue.call(B, ie); - }, onBlur: (ie) => { - var ue; - v(!1), (ue = B.onBlur) == null || ue.call(B, ie); - } })), [oe, Z, J, l, T, s, F, M, B, A == null ? void 0 : A.source, ge]), re = Gt.useMemo(() => ({ slots: Array.from({ length: s }).map((ie, ue) => { - var ve; - let Pe = S && M !== null && F !== null && (M === F && ue === M || ue >= M && ue < F), De = ge[ue] !== void 0 ? ge[ue] : null, Ce = ge[0] !== void 0 ? null : (ve = u == null ? void 0 : u[ue]) != null ? ve : null; - return { char: De, placeholderChar: Ce, isActive: Pe, hasFakeCaret: Pe && De === null }; - }), isFocused: S, isHovering: !B.disabled && x }), [S, x, s, F, M, B.disabled, ge]), pe = Gt.useMemo(() => O ? O(re) : Gt.createElement(oA.Provider, { value: re }, L), [L, re, O]); - return Gt.createElement(Gt.Fragment, null, P !== null && Gt.createElement("noscript", null, Gt.createElement("style", null, P)), Gt.createElement("div", { ref: f, "data-input-otp-container": !0, style: ee, className: _ }, pe, Gt.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, X))); -}); -aA.displayName = "Input"; -function Wf(t, e) { - try { - t.insertRule(e); - } catch { - console.error("input-otp could not insert CSS rule:", e); - } -} -var Eie = ` -[data-input-otp] { - --nojs-bg: white !important; - --nojs-fg: black !important; - - background-color: var(--nojs-bg) !important; - color: var(--nojs-fg) !important; - caret-color: var(--nojs-fg) !important; - letter-spacing: .25em !important; - text-align: center !important; - border: 1px solid var(--nojs-fg) !important; - border-radius: 4px !important; - width: 100% !important; -} -@media (prefers-color-scheme: dark) { - [data-input-otp] { - --nojs-bg: black !important; - --nojs-fg: white !important; - } -}`; -const cA = Gt.forwardRef(({ className: t, containerClassName: e, ...r }, n) => /* @__PURE__ */ le.jsx( - aA, - { - ref: n, - containerClassName: $o( - "xc-flex xc-items-center xc-gap-2 xc-has-[:disabled]:opacity-50", - e - ), - className: $o("disabled:xc-cursor-not-allowed", t), - ...r - } -)); -cA.displayName = "InputOTP"; -const uA = Gt.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ le.jsx("div", { ref: r, className: $o("xc-flex xc-items-center", t), ...e })); -uA.displayName = "InputOTPGroup"; -const nc = Gt.forwardRef(({ index: t, className: e, ...r }, n) => { - const i = Gt.useContext(oA), { char: s, hasFakeCaret: o, isActive: a } = i.slots[t]; - return /* @__PURE__ */ le.jsxs( - "div", - { - ref: n, - className: $o( - "xc-relative xc-rounded-xl xc-text-2xl xc-flex xc-h-12 xc-w-12 xc-items-center xc-justify-center xc-border xc-border-white xc-border-opacity-20 xc-transition-all", - a && "xc-z-10 xc-ring-2 xc-ring-ring xc-ring-[rgb(135,93,255)] xc-ring-offset-background", - e - ), - ...r, - children: [ - s, - o && /* @__PURE__ */ le.jsx("div", { className: "xc-pointer-events-none xc-absolute xc-inset-0 xc-flex xc-items-center xc-justify-center", children: /* @__PURE__ */ le.jsx("div", { className: "xc-h-4 xc-w-px xc-animate-caret-blink xc-bg-foreground xc-duration-1000" }) }) - ] - } - ); -}); -nc.displayName = "InputOTPSlot"; -function Sie(t) { - const { spinning: e, children: r, className: n } = t; - return /* @__PURE__ */ le.jsxs("div", { className: "xc-inline-block xc-relative", children: [ - r, - e && /* @__PURE__ */ le.jsx("div", { className: $o("xc-absolute xc-top-0 xc-left-0 xc-w-full xc-h-full xc-bg-black xc-bg-opacity-10 xc-flex xc-items-center xc-justify-center", n), children: /* @__PURE__ */ le.jsx(Sc, { className: "xc-animate-spin" }) }) - ] }); -} -function fA(t) { - const { email: e } = t, [r, n] = Yt(0), [i, s] = Yt(!1), [o, a] = Yt(""); - async function u() { - n(60); - const d = setInterval(() => { - n((p) => p === 0 ? (clearInterval(d), 0) : p - 1); - }, 1e3); - } - async function l(d) { - if (a(""), !(d.length < 6)) { - s(!0); - try { - await t.onInputCode(e, d); - } catch (p) { - a(p.message); - } - s(!1); - } - } - return Dn(() => { - u(); - }, []), /* @__PURE__ */ le.jsxs(Rs, { children: [ - /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ - /* @__PURE__ */ le.jsx(XZ, { className: "xc-mb-4", size: 60 }), - /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-8 xc-h-16", children: [ - /* @__PURE__ */ le.jsx("p", { className: "xc-text-lg xc-mb-1", children: "We’ve sent a verification code to" }), - /* @__PURE__ */ le.jsx("p", { className: "xc-font-bold xc-text-center", children: e }) - ] }), - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-2 xc-h-12", children: /* @__PURE__ */ le.jsx(Sie, { spinning: i, className: "xc-rounded-xl", children: /* @__PURE__ */ le.jsx(cA, { maxLength: 6, onChange: l, disabled: i, className: "disabled:xc-opacity-20", children: /* @__PURE__ */ le.jsx(uA, { children: /* @__PURE__ */ le.jsxs("div", { className: $o("xc-flex xc-gap-2", i ? "xc-opacity-20" : ""), children: [ - /* @__PURE__ */ le.jsx(nc, { index: 0 }), - /* @__PURE__ */ le.jsx(nc, { index: 1 }), - /* @__PURE__ */ le.jsx(nc, { index: 2 }), - /* @__PURE__ */ le.jsx(nc, { index: 3 }), - /* @__PURE__ */ le.jsx(nc, { index: 4 }), - /* @__PURE__ */ le.jsx(nc, { index: 5 }) - ] }) }) }) }) }), - o && /* @__PURE__ */ le.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ le.jsx("p", { children: o }) }) - ] }), - /* @__PURE__ */ le.jsxs("div", { className: "xc-text-center xc-text-sm xc-text-gray-400", children: [ - "Not get it? ", - r ? `Resend in ${r}s` : /* @__PURE__ */ le.jsx("button", { id: "sendCodeButton", onClick: t.onResendCode, children: "Send again" }) - ] }), - /* @__PURE__ */ le.jsx("div", { id: "captcha-element" }) - ] }); -} -function lA(t) { - const { email: e } = t, [r, n] = Yt(!1), [i, s] = Yt(""), o = wi(() => `xn-btn-${(/* @__PURE__ */ new Date()).getTime()}`, [e]); - async function a(w, _) { - n(!0), s(""), await ka.getEmailCode({ account_type: "email", email: w }, _), n(!1); - } - async function u(w) { - try { - return await a(e, JSON.stringify(w)), { captchaResult: !0, bizResult: !0 }; - } catch (_) { - return s(_.message), { captchaResult: !1, bizResult: !1 }; - } - } - async function l(w) { - w && t.onCodeSend(); - } - const d = Qn(); - function p(w) { - d.current = w; - } - return Dn(() => { - if (e) - return window.initAliyunCaptcha({ - SceneId: "tqyu8129d", - prefix: "1mfsn5f", - mode: "popup", - element: "#captcha-element", - button: `#${o}`, - captchaVerifyCallback: u, - onBizResultCallback: l, - getInstance: p, - slideStyle: { - width: 360, - height: 40 - }, - language: "en", - region: "cn" - }), () => { - var w, _; - (w = document.getElementById("aliyunCaptcha-mask")) == null || w.remove(), (_ = document.getElementById("aliyunCaptcha-window-popup")) == null || _.remove(); - }; - }, [e]), /* @__PURE__ */ le.jsxs(Rs, { children: [ - /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-mb-12", children: [ - /* @__PURE__ */ le.jsx(ZZ, { className: "xc-mb-4", size: 60 }), - /* @__PURE__ */ le.jsx("button", { className: "xc-border xc-rounded-full xc-bg-white xc-text-black xc-px-8 xc-py-2", id: o, children: r ? /* @__PURE__ */ le.jsx(Sc, { className: "xc-animate-spin" }) : "I'm not a robot" }) - ] }), - i && /* @__PURE__ */ le.jsx("div", { className: "xc-text-[#ff0000] xc-text-center", children: /* @__PURE__ */ le.jsx("p", { children: i }) }) - ] }); -} -function Aie(t) { - const { email: e } = t, r = Ey(), [n, i] = Yt("captcha"); - async function s(o, a) { - const u = await ka.emailLogin({ - account_type: "email", - connector: "codatta_email", - account_enum: "C", - email_code: a, - email: o, - inviter_code: r.inviterCode, - source: { - device: r.device, - channel: r.channel, - app: r.app - } - }); - t.onLogin(u.data); - } - return /* @__PURE__ */ le.jsxs(Rs, { children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ le.jsx(kc, { title: "Sign in with email", onBack: t.onBack }) }), - n === "captcha" && /* @__PURE__ */ le.jsx(lA, { email: e, onCodeSend: () => i("verify-email") }), - n === "verify-email" && /* @__PURE__ */ le.jsx(fA, { email: e, onInputCode: s, onResendCode: () => i("captcha") }) - ] }); -} -var hA = { exports: {} }; -(function(t, e) { - (function(r, n) { - t.exports = n(); - })(gn, () => (() => { - var r = { 873: (o, a) => { - var u, l, d = function() { - var p = function(f, g) { - var b = f, x = B[g], E = null, S = 0, v = null, M = [], I = {}, F = function(re, pe) { - E = function(ie) { - for (var ue = new Array(ie), ve = 0; ve < ie; ve += 1) { - ue[ve] = new Array(ie); - for (var Pe = 0; Pe < ie; Pe += 1) ue[ve][Pe] = null; - } - return ue; - }(S = 4 * b + 17), ce(0, 0), ce(S - 7, 0), ce(0, S - 7), oe(), D(), J(re, pe), b >= 7 && Z(re), v == null && (v = T(b, x, M)), ee(v, pe); - }, ce = function(re, pe) { - for (var ie = -1; ie <= 7; ie += 1) if (!(re + ie <= -1 || S <= re + ie)) for (var ue = -1; ue <= 7; ue += 1) pe + ue <= -1 || S <= pe + ue || (E[re + ie][pe + ue] = 0 <= ie && ie <= 6 && (ue == 0 || ue == 6) || 0 <= ue && ue <= 6 && (ie == 0 || ie == 6) || 2 <= ie && ie <= 4 && 2 <= ue && ue <= 4); - }, D = function() { - for (var re = 8; re < S - 8; re += 1) E[re][6] == null && (E[re][6] = re % 2 == 0); - for (var pe = 8; pe < S - 8; pe += 1) E[6][pe] == null && (E[6][pe] = pe % 2 == 0); - }, oe = function() { - for (var re = k.getPatternPosition(b), pe = 0; pe < re.length; pe += 1) for (var ie = 0; ie < re.length; ie += 1) { - var ue = re[pe], ve = re[ie]; - if (E[ue][ve] == null) for (var Pe = -2; Pe <= 2; Pe += 1) for (var De = -2; De <= 2; De += 1) E[ue + Pe][ve + De] = Pe == -2 || Pe == 2 || De == -2 || De == 2 || Pe == 0 && De == 0; - } - }, Z = function(re) { - for (var pe = k.getBCHTypeNumber(b), ie = 0; ie < 18; ie += 1) { - var ue = !re && (pe >> ie & 1) == 1; - E[Math.floor(ie / 3)][ie % 3 + S - 8 - 3] = ue; - } - for (ie = 0; ie < 18; ie += 1) ue = !re && (pe >> ie & 1) == 1, E[ie % 3 + S - 8 - 3][Math.floor(ie / 3)] = ue; - }, J = function(re, pe) { - for (var ie = x << 3 | pe, ue = k.getBCHTypeInfo(ie), ve = 0; ve < 15; ve += 1) { - var Pe = !re && (ue >> ve & 1) == 1; - ve < 6 ? E[ve][8] = Pe : ve < 8 ? E[ve + 1][8] = Pe : E[S - 15 + ve][8] = Pe; - } - for (ve = 0; ve < 15; ve += 1) Pe = !re && (ue >> ve & 1) == 1, ve < 8 ? E[8][S - ve - 1] = Pe : ve < 9 ? E[8][15 - ve - 1 + 1] = Pe : E[8][15 - ve - 1] = Pe; - E[S - 8][8] = !re; - }, ee = function(re, pe) { - for (var ie = -1, ue = S - 1, ve = 7, Pe = 0, De = k.getMaskFunction(pe), Ce = S - 1; Ce > 0; Ce -= 2) for (Ce == 6 && (Ce -= 1); ; ) { - for (var $e = 0; $e < 2; $e += 1) if (E[ue][Ce - $e] == null) { - var Me = !1; - Pe < re.length && (Me = (re[Pe] >>> ve & 1) == 1), De(ue, Ce - $e) && (Me = !Me), E[ue][Ce - $e] = Me, (ve -= 1) == -1 && (Pe += 1, ve = 7); - } - if ((ue += ie) < 0 || S <= ue) { - ue -= ie, ie = -ie; - break; - } - } - }, T = function(re, pe, ie) { - for (var ue = V.getRSBlocks(re, pe), ve = Q(), Pe = 0; Pe < ie.length; Pe += 1) { - var De = ie[Pe]; - ve.put(De.getMode(), 4), ve.put(De.getLength(), k.getLengthInBits(De.getMode(), re)), De.write(ve); - } - var Ce = 0; - for (Pe = 0; Pe < ue.length; Pe += 1) Ce += ue[Pe].dataCount; - if (ve.getLengthInBits() > 8 * Ce) throw "code length overflow. (" + ve.getLengthInBits() + ">" + 8 * Ce + ")"; - for (ve.getLengthInBits() + 4 <= 8 * Ce && ve.put(0, 4); ve.getLengthInBits() % 8 != 0; ) ve.putBit(!1); - for (; !(ve.getLengthInBits() >= 8 * Ce || (ve.put(236, 8), ve.getLengthInBits() >= 8 * Ce)); ) ve.put(17, 8); - return function($e, Me) { - for (var Ne = 0, Ke = 0, Le = 0, qe = new Array(Me.length), ze = new Array(Me.length), _e = 0; _e < Me.length; _e += 1) { - var Ze = Me[_e].dataCount, at = Me[_e].totalCount - Ze; - Ke = Math.max(Ke, Ze), Le = Math.max(Le, at), qe[_e] = new Array(Ze); - for (var ke = 0; ke < qe[_e].length; ke += 1) qe[_e][ke] = 255 & $e.getBuffer()[ke + Ne]; - Ne += Ze; - var Qe = k.getErrorCorrectPolynomial(at), tt = U(qe[_e], Qe.getLength() - 1).mod(Qe); - for (ze[_e] = new Array(Qe.getLength() - 1), ke = 0; ke < ze[_e].length; ke += 1) { - var Ye = ke + tt.getLength() - ze[_e].length; - ze[_e][ke] = Ye >= 0 ? tt.getAt(Ye) : 0; - } - } - var dt = 0; - for (ke = 0; ke < Me.length; ke += 1) dt += Me[ke].totalCount; - var lt = new Array(dt), ct = 0; - for (ke = 0; ke < Ke; ke += 1) for (_e = 0; _e < Me.length; _e += 1) ke < qe[_e].length && (lt[ct] = qe[_e][ke], ct += 1); - for (ke = 0; ke < Le; ke += 1) for (_e = 0; _e < Me.length; _e += 1) ke < ze[_e].length && (lt[ct] = ze[_e][ke], ct += 1); - return lt; - }(ve, ue); - }; - I.addData = function(re, pe) { - var ie = null; - switch (pe = pe || "Byte") { - case "Numeric": - ie = R(re); - break; - case "Alphanumeric": - ie = K(re); - break; - case "Byte": - ie = ge(re); - break; - case "Kanji": - ie = Ee(re); - break; - default: - throw "mode:" + pe; - } - M.push(ie), v = null; - }, I.isDark = function(re, pe) { - if (re < 0 || S <= re || pe < 0 || S <= pe) throw re + "," + pe; - return E[re][pe]; - }, I.getModuleCount = function() { - return S; - }, I.make = function() { - if (b < 1) { - for (var re = 1; re < 40; re++) { - for (var pe = V.getRSBlocks(re, x), ie = Q(), ue = 0; ue < M.length; ue++) { - var ve = M[ue]; - ie.put(ve.getMode(), 4), ie.put(ve.getLength(), k.getLengthInBits(ve.getMode(), re)), ve.write(ie); - } - var Pe = 0; - for (ue = 0; ue < pe.length; ue++) Pe += pe[ue].dataCount; - if (ie.getLengthInBits() <= 8 * Pe) break; - } - b = re; - } - F(!1, function() { - for (var De = 0, Ce = 0, $e = 0; $e < 8; $e += 1) { - F(!0, $e); - var Me = k.getLostPoint(I); - ($e == 0 || De > Me) && (De = Me, Ce = $e); - } - return Ce; - }()); - }, I.createTableTag = function(re, pe) { - re = re || 2; - var ie = ""; - ie += '
"; - }, I.createSvgTag = function(re, pe, ie, ue) { - var ve = {}; - typeof arguments[0] == "object" && (re = (ve = arguments[0]).cellSize, pe = ve.margin, ie = ve.alt, ue = ve.title), re = re || 2, pe = pe === void 0 ? 4 * re : pe, (ie = typeof ie == "string" ? { text: ie } : ie || {}).text = ie.text || null, ie.id = ie.text ? ie.id || "qrcode-description" : null, (ue = typeof ue == "string" ? { text: ue } : ue || {}).text = ue.text || null, ue.id = ue.text ? ue.id || "qrcode-title" : null; - var Pe, De, Ce, $e, Me = I.getModuleCount() * re + 2 * pe, Ne = ""; - for ($e = "l" + re + ",0 0," + re + " -" + re + ",0 0,-" + re + "z ", Ne += '' + X(ue.text) + "" : "", Ne += ie.text ? '' + X(ie.text) + "" : "", Ne += '', Ne += '"; - }, I.createDataURL = function(re, pe) { - re = re || 2, pe = pe === void 0 ? 4 * re : pe; - var ie = I.getModuleCount() * re + 2 * pe, ue = pe, ve = ie - pe; - return m(ie, ie, function(Pe, De) { - if (ue <= Pe && Pe < ve && ue <= De && De < ve) { - var Ce = Math.floor((Pe - ue) / re), $e = Math.floor((De - ue) / re); - return I.isDark($e, Ce) ? 0 : 1; - } - return 1; - }); - }, I.createImgTag = function(re, pe, ie) { - re = re || 2, pe = pe === void 0 ? 4 * re : pe; - var ue = I.getModuleCount() * re + 2 * pe, ve = ""; - return ve += ""; - }; - var X = function(re) { - for (var pe = "", ie = 0; ie < re.length; ie += 1) { - var ue = re.charAt(ie); - switch (ue) { - case "<": - pe += "<"; - break; - case ">": - pe += ">"; - break; - case "&": - pe += "&"; - break; - case '"': - pe += """; - break; - default: - pe += ue; - } - } - return pe; - }; - return I.createASCII = function(re, pe) { - if ((re = re || 1) < 2) return function(qe) { - qe = qe === void 0 ? 2 : qe; - var ze, _e, Ze, at, ke, Qe = 1 * I.getModuleCount() + 2 * qe, tt = qe, Ye = Qe - qe, dt = { "██": "█", "█ ": "▀", " █": "▄", " ": " " }, lt = { "██": "▀", "█ ": "▀", " █": " ", " ": " " }, ct = ""; - for (ze = 0; ze < Qe; ze += 2) { - for (Ze = Math.floor((ze - tt) / 1), at = Math.floor((ze + 1 - tt) / 1), _e = 0; _e < Qe; _e += 1) ke = "█", tt <= _e && _e < Ye && tt <= ze && ze < Ye && I.isDark(Ze, Math.floor((_e - tt) / 1)) && (ke = " "), tt <= _e && _e < Ye && tt <= ze + 1 && ze + 1 < Ye && I.isDark(at, Math.floor((_e - tt) / 1)) ? ke += " " : ke += "█", ct += qe < 1 && ze + 1 >= Ye ? lt[ke] : dt[ke]; - ct += ` -`; - } - return Qe % 2 && qe > 0 ? ct.substring(0, ct.length - Qe - 1) + Array(Qe + 1).join("▀") : ct.substring(0, ct.length - 1); - }(pe); - re -= 1, pe = pe === void 0 ? 2 * re : pe; - var ie, ue, ve, Pe, De = I.getModuleCount() * re + 2 * pe, Ce = pe, $e = De - pe, Me = Array(re + 1).join("██"), Ne = Array(re + 1).join(" "), Ke = "", Le = ""; - for (ie = 0; ie < De; ie += 1) { - for (ve = Math.floor((ie - Ce) / re), Le = "", ue = 0; ue < De; ue += 1) Pe = 1, Ce <= ue && ue < $e && Ce <= ie && ie < $e && I.isDark(ve, Math.floor((ue - Ce) / re)) && (Pe = 0), Le += Pe ? Me : Ne; - for (ve = 0; ve < re; ve += 1) Ke += Le + ` -`; - } - return Ke.substring(0, Ke.length - 1); - }, I.renderTo2dContext = function(re, pe) { - pe = pe || 2; - for (var ie = I.getModuleCount(), ue = 0; ue < ie; ue++) for (var ve = 0; ve < ie; ve++) re.fillStyle = I.isDark(ue, ve) ? "black" : "white", re.fillRect(ue * pe, ve * pe, pe, pe); - }, I; - }; - p.stringToBytes = (p.stringToBytesFuncs = { default: function(f) { - for (var g = [], b = 0; b < f.length; b += 1) { - var x = f.charCodeAt(b); - g.push(255 & x); - } - return g; - } }).default, p.createStringToBytes = function(f, g) { - var b = function() { - for (var E = A(f), S = function() { - var D = E.read(); - if (D == -1) throw "eof"; - return D; - }, v = 0, M = {}; ; ) { - var I = E.read(); - if (I == -1) break; - var F = S(), ce = S() << 8 | S(); - M[String.fromCharCode(I << 8 | F)] = ce, v += 1; - } - if (v != g) throw v + " != " + g; - return M; - }(), x = 63; - return function(E) { - for (var S = [], v = 0; v < E.length; v += 1) { - var M = E.charCodeAt(v); - if (M < 128) S.push(M); - else { - var I = b[E.charAt(v)]; - typeof I == "number" ? (255 & I) == I ? S.push(I) : (S.push(I >>> 8), S.push(255 & I)) : S.push(x); - } - } - return S; - }; - }; - var w, _, P, O, L, B = { L: 1, M: 0, Q: 3, H: 2 }, k = (w = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], _ = 1335, P = 7973, L = function(f) { - for (var g = 0; f != 0; ) g += 1, f >>>= 1; - return g; - }, (O = {}).getBCHTypeInfo = function(f) { - for (var g = f << 10; L(g) - L(_) >= 0; ) g ^= _ << L(g) - L(_); - return 21522 ^ (f << 10 | g); - }, O.getBCHTypeNumber = function(f) { - for (var g = f << 12; L(g) - L(P) >= 0; ) g ^= P << L(g) - L(P); - return f << 12 | g; - }, O.getPatternPosition = function(f) { - return w[f - 1]; - }, O.getMaskFunction = function(f) { - switch (f) { - case 0: - return function(g, b) { - return (g + b) % 2 == 0; - }; - case 1: - return function(g, b) { - return g % 2 == 0; - }; - case 2: - return function(g, b) { - return b % 3 == 0; - }; - case 3: - return function(g, b) { - return (g + b) % 3 == 0; - }; - case 4: - return function(g, b) { - return (Math.floor(g / 2) + Math.floor(b / 3)) % 2 == 0; - }; - case 5: - return function(g, b) { - return g * b % 2 + g * b % 3 == 0; - }; - case 6: - return function(g, b) { - return (g * b % 2 + g * b % 3) % 2 == 0; - }; - case 7: - return function(g, b) { - return (g * b % 3 + (g + b) % 2) % 2 == 0; - }; - default: - throw "bad maskPattern:" + f; - } - }, O.getErrorCorrectPolynomial = function(f) { - for (var g = U([1], 0), b = 0; b < f; b += 1) g = g.multiply(U([1, W.gexp(b)], 0)); - return g; - }, O.getLengthInBits = function(f, g) { - if (1 <= g && g < 10) switch (f) { - case 1: - return 10; - case 2: - return 9; - case 4: - case 8: - return 8; - default: - throw "mode:" + f; - } - else if (g < 27) switch (f) { - case 1: - return 12; - case 2: - return 11; - case 4: - return 16; - case 8: - return 10; - default: - throw "mode:" + f; - } - else { - if (!(g < 41)) throw "type:" + g; - switch (f) { - case 1: - return 14; - case 2: - return 13; - case 4: - return 16; - case 8: - return 12; - default: - throw "mode:" + f; - } - } - }, O.getLostPoint = function(f) { - for (var g = f.getModuleCount(), b = 0, x = 0; x < g; x += 1) for (var E = 0; E < g; E += 1) { - for (var S = 0, v = f.isDark(x, E), M = -1; M <= 1; M += 1) if (!(x + M < 0 || g <= x + M)) for (var I = -1; I <= 1; I += 1) E + I < 0 || g <= E + I || M == 0 && I == 0 || v == f.isDark(x + M, E + I) && (S += 1); - S > 5 && (b += 3 + S - 5); - } - for (x = 0; x < g - 1; x += 1) for (E = 0; E < g - 1; E += 1) { - var F = 0; - f.isDark(x, E) && (F += 1), f.isDark(x + 1, E) && (F += 1), f.isDark(x, E + 1) && (F += 1), f.isDark(x + 1, E + 1) && (F += 1), F != 0 && F != 4 || (b += 3); - } - for (x = 0; x < g; x += 1) for (E = 0; E < g - 6; E += 1) f.isDark(x, E) && !f.isDark(x, E + 1) && f.isDark(x, E + 2) && f.isDark(x, E + 3) && f.isDark(x, E + 4) && !f.isDark(x, E + 5) && f.isDark(x, E + 6) && (b += 40); - for (E = 0; E < g; E += 1) for (x = 0; x < g - 6; x += 1) f.isDark(x, E) && !f.isDark(x + 1, E) && f.isDark(x + 2, E) && f.isDark(x + 3, E) && f.isDark(x + 4, E) && !f.isDark(x + 5, E) && f.isDark(x + 6, E) && (b += 40); - var ce = 0; - for (E = 0; E < g; E += 1) for (x = 0; x < g; x += 1) f.isDark(x, E) && (ce += 1); - return b + Math.abs(100 * ce / g / g - 50) / 5 * 10; - }, O), W = function() { - for (var f = new Array(256), g = new Array(256), b = 0; b < 8; b += 1) f[b] = 1 << b; - for (b = 8; b < 256; b += 1) f[b] = f[b - 4] ^ f[b - 5] ^ f[b - 6] ^ f[b - 8]; - for (b = 0; b < 255; b += 1) g[f[b]] = b; - return { glog: function(x) { - if (x < 1) throw "glog(" + x + ")"; - return g[x]; - }, gexp: function(x) { - for (; x < 0; ) x += 255; - for (; x >= 256; ) x -= 255; - return f[x]; - } }; - }(); - function U(f, g) { - if (f.length === void 0) throw f.length + "/" + g; - var b = function() { - for (var E = 0; E < f.length && f[E] == 0; ) E += 1; - for (var S = new Array(f.length - E + g), v = 0; v < f.length - E; v += 1) S[v] = f[v + E]; - return S; - }(), x = { getAt: function(E) { - return b[E]; - }, getLength: function() { - return b.length; - }, multiply: function(E) { - for (var S = new Array(x.getLength() + E.getLength() - 1), v = 0; v < x.getLength(); v += 1) for (var M = 0; M < E.getLength(); M += 1) S[v + M] ^= W.gexp(W.glog(x.getAt(v)) + W.glog(E.getAt(M))); - return U(S, 0); - }, mod: function(E) { - if (x.getLength() - E.getLength() < 0) return x; - for (var S = W.glog(x.getAt(0)) - W.glog(E.getAt(0)), v = new Array(x.getLength()), M = 0; M < x.getLength(); M += 1) v[M] = x.getAt(M); - for (M = 0; M < E.getLength(); M += 1) v[M] ^= W.gexp(W.glog(E.getAt(M)) + S); - return U(v, 0).mod(E); - } }; - return x; - } - var V = /* @__PURE__ */ function() { - var f = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12, 7, 37, 13], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]], g = function(x, E) { - var S = {}; - return S.totalCount = x, S.dataCount = E, S; - }, b = { getRSBlocks: function(x, E) { - var S = function(Z, J) { - switch (J) { - case B.L: - return f[4 * (Z - 1) + 0]; - case B.M: - return f[4 * (Z - 1) + 1]; - case B.Q: - return f[4 * (Z - 1) + 2]; - case B.H: - return f[4 * (Z - 1) + 3]; - default: - return; - } - }(x, E); - if (S === void 0) throw "bad rs block @ typeNumber:" + x + "/errorCorrectionLevel:" + E; - for (var v = S.length / 3, M = [], I = 0; I < v; I += 1) for (var F = S[3 * I + 0], ce = S[3 * I + 1], D = S[3 * I + 2], oe = 0; oe < F; oe += 1) M.push(g(ce, D)); - return M; - } }; - return b; - }(), Q = function() { - var f = [], g = 0, b = { getBuffer: function() { - return f; - }, getAt: function(x) { - var E = Math.floor(x / 8); - return (f[E] >>> 7 - x % 8 & 1) == 1; - }, put: function(x, E) { - for (var S = 0; S < E; S += 1) b.putBit((x >>> E - S - 1 & 1) == 1); - }, getLengthInBits: function() { - return g; - }, putBit: function(x) { - var E = Math.floor(g / 8); - f.length <= E && f.push(0), x && (f[E] |= 128 >>> g % 8), g += 1; - } }; - return b; - }, R = function(f) { - var g = f, b = { getMode: function() { - return 1; - }, getLength: function(S) { - return g.length; - }, write: function(S) { - for (var v = g, M = 0; M + 2 < v.length; ) S.put(x(v.substring(M, M + 3)), 10), M += 3; - M < v.length && (v.length - M == 1 ? S.put(x(v.substring(M, M + 1)), 4) : v.length - M == 2 && S.put(x(v.substring(M, M + 2)), 7)); - } }, x = function(S) { - for (var v = 0, M = 0; M < S.length; M += 1) v = 10 * v + E(S.charAt(M)); - return v; - }, E = function(S) { - if ("0" <= S && S <= "9") return S.charCodeAt(0) - 48; - throw "illegal char :" + S; - }; - return b; - }, K = function(f) { - var g = f, b = { getMode: function() { - return 2; - }, getLength: function(E) { - return g.length; - }, write: function(E) { - for (var S = g, v = 0; v + 1 < S.length; ) E.put(45 * x(S.charAt(v)) + x(S.charAt(v + 1)), 11), v += 2; - v < S.length && E.put(x(S.charAt(v)), 6); - } }, x = function(E) { - if ("0" <= E && E <= "9") return E.charCodeAt(0) - 48; - if ("A" <= E && E <= "Z") return E.charCodeAt(0) - 65 + 10; - switch (E) { - case " ": - return 36; - case "$": - return 37; - case "%": - return 38; - case "*": - return 39; - case "+": - return 40; - case "-": - return 41; - case ".": - return 42; - case "/": - return 43; - case ":": - return 44; - default: - throw "illegal char :" + E; - } - }; - return b; - }, ge = function(f) { - var g = p.stringToBytes(f); - return { getMode: function() { - return 4; - }, getLength: function(b) { - return g.length; - }, write: function(b) { - for (var x = 0; x < g.length; x += 1) b.put(g[x], 8); - } }; - }, Ee = function(f) { - var g = p.stringToBytesFuncs.SJIS; - if (!g) throw "sjis not supported."; - (function() { - var E = g("友"); - if (E.length != 2 || (E[0] << 8 | E[1]) != 38726) throw "sjis not supported."; - })(); - var b = g(f), x = { getMode: function() { - return 8; - }, getLength: function(E) { - return ~~(b.length / 2); - }, write: function(E) { - for (var S = b, v = 0; v + 1 < S.length; ) { - var M = (255 & S[v]) << 8 | 255 & S[v + 1]; - if (33088 <= M && M <= 40956) M -= 33088; - else { - if (!(57408 <= M && M <= 60351)) throw "illegal char at " + (v + 1) + "/" + M; - M -= 49472; - } - M = 192 * (M >>> 8 & 255) + (255 & M), E.put(M, 13), v += 2; - } - if (v < S.length) throw "illegal char at " + (v + 1); - } }; - return x; - }, Y = function() { - var f = [], g = { writeByte: function(b) { - f.push(255 & b); - }, writeShort: function(b) { - g.writeByte(b), g.writeByte(b >>> 8); - }, writeBytes: function(b, x, E) { - x = x || 0, E = E || b.length; - for (var S = 0; S < E; S += 1) g.writeByte(b[S + x]); - }, writeString: function(b) { - for (var x = 0; x < b.length; x += 1) g.writeByte(b.charCodeAt(x)); - }, toByteArray: function() { - return f; - }, toString: function() { - var b = ""; - b += "["; - for (var x = 0; x < f.length; x += 1) x > 0 && (b += ","), b += f[x]; - return b + "]"; - } }; - return g; - }, A = function(f) { - var g = f, b = 0, x = 0, E = 0, S = { read: function() { - for (; E < 8; ) { - if (b >= g.length) { - if (E == 0) return -1; - throw "unexpected end of file./" + E; - } - var M = g.charAt(b); - if (b += 1, M == "=") return E = 0, -1; - M.match(/^\s$/) || (x = x << 6 | v(M.charCodeAt(0)), E += 6); - } - var I = x >>> E - 8 & 255; - return E -= 8, I; - } }, v = function(M) { - if (65 <= M && M <= 90) return M - 65; - if (97 <= M && M <= 122) return M - 97 + 26; - if (48 <= M && M <= 57) return M - 48 + 52; - if (M == 43) return 62; - if (M == 47) return 63; - throw "c:" + M; - }; - return S; - }, m = function(f, g, b) { - for (var x = function(ce, D) { - var oe = ce, Z = D, J = new Array(ce * D), ee = { setPixel: function(re, pe, ie) { - J[pe * oe + re] = ie; - }, write: function(re) { - re.writeString("GIF87a"), re.writeShort(oe), re.writeShort(Z), re.writeByte(128), re.writeByte(0), re.writeByte(0), re.writeByte(0), re.writeByte(0), re.writeByte(0), re.writeByte(255), re.writeByte(255), re.writeByte(255), re.writeString(","), re.writeShort(0), re.writeShort(0), re.writeShort(oe), re.writeShort(Z), re.writeByte(0); - var pe = T(2); - re.writeByte(2); - for (var ie = 0; pe.length - ie > 255; ) re.writeByte(255), re.writeBytes(pe, ie, 255), ie += 255; - re.writeByte(pe.length - ie), re.writeBytes(pe, ie, pe.length - ie), re.writeByte(0), re.writeString(";"); - } }, T = function(re) { - for (var pe = 1 << re, ie = 1 + (1 << re), ue = re + 1, ve = X(), Pe = 0; Pe < pe; Pe += 1) ve.add(String.fromCharCode(Pe)); - ve.add(String.fromCharCode(pe)), ve.add(String.fromCharCode(ie)); - var De, Ce, $e, Me = Y(), Ne = (De = Me, Ce = 0, $e = 0, { write: function(ze, _e) { - if (ze >>> _e) throw "length over"; - for (; Ce + _e >= 8; ) De.writeByte(255 & (ze << Ce | $e)), _e -= 8 - Ce, ze >>>= 8 - Ce, $e = 0, Ce = 0; - $e |= ze << Ce, Ce += _e; - }, flush: function() { - Ce > 0 && De.writeByte($e); - } }); - Ne.write(pe, ue); - var Ke = 0, Le = String.fromCharCode(J[Ke]); - for (Ke += 1; Ke < J.length; ) { - var qe = String.fromCharCode(J[Ke]); - Ke += 1, ve.contains(Le + qe) ? Le += qe : (Ne.write(ve.indexOf(Le), ue), ve.size() < 4095 && (ve.size() == 1 << ue && (ue += 1), ve.add(Le + qe)), Le = qe); - } - return Ne.write(ve.indexOf(Le), ue), Ne.write(ie, ue), Ne.flush(), Me.toByteArray(); - }, X = function() { - var re = {}, pe = 0, ie = { add: function(ue) { - if (ie.contains(ue)) throw "dup key:" + ue; - re[ue] = pe, pe += 1; - }, size: function() { - return pe; - }, indexOf: function(ue) { - return re[ue]; - }, contains: function(ue) { - return re[ue] !== void 0; - } }; - return ie; - }; - return ee; - }(f, g), E = 0; E < g; E += 1) for (var S = 0; S < f; S += 1) x.setPixel(S, E, b(S, E)); - var v = Y(); - x.write(v); - for (var M = function() { - var ce = 0, D = 0, oe = 0, Z = "", J = {}, ee = function(X) { - Z += String.fromCharCode(T(63 & X)); - }, T = function(X) { - if (!(X < 0)) { - if (X < 26) return 65 + X; - if (X < 52) return X - 26 + 97; - if (X < 62) return X - 52 + 48; - if (X == 62) return 43; - if (X == 63) return 47; - } - throw "n:" + X; - }; - return J.writeByte = function(X) { - for (ce = ce << 8 | 255 & X, D += 8, oe += 1; D >= 6; ) ee(ce >>> D - 6), D -= 6; - }, J.flush = function() { - if (D > 0 && (ee(ce << 6 - D), ce = 0, D = 0), oe % 3 != 0) for (var X = 3 - oe % 3, re = 0; re < X; re += 1) Z += "="; - }, J.toString = function() { - return Z; - }, J; - }(), I = v.toByteArray(), F = 0; F < I.length; F += 1) M.writeByte(I[F]); - return M.flush(), "data:image/gif;base64," + M; - }; - return p; - }(); - d.stringToBytesFuncs["UTF-8"] = function(p) { - return function(w) { - for (var _ = [], P = 0; P < w.length; P++) { - var O = w.charCodeAt(P); - O < 128 ? _.push(O) : O < 2048 ? _.push(192 | O >> 6, 128 | 63 & O) : O < 55296 || O >= 57344 ? _.push(224 | O >> 12, 128 | O >> 6 & 63, 128 | 63 & O) : (P++, O = 65536 + ((1023 & O) << 10 | 1023 & w.charCodeAt(P)), _.push(240 | O >> 18, 128 | O >> 12 & 63, 128 | O >> 6 & 63, 128 | 63 & O)); - } - return _; - }(p); - }, (l = typeof (u = function() { - return d; - }) == "function" ? u.apply(a, []) : u) === void 0 || (o.exports = l); - } }, n = {}; - function i(o) { - var a = n[o]; - if (a !== void 0) return a.exports; - var u = n[o] = { exports: {} }; - return r[o](u, u.exports, i), u.exports; - } - i.n = (o) => { - var a = o && o.__esModule ? () => o.default : () => o; - return i.d(a, { a }), a; - }, i.d = (o, a) => { - for (var u in a) i.o(a, u) && !i.o(o, u) && Object.defineProperty(o, u, { enumerable: !0, get: a[u] }); - }, i.o = (o, a) => Object.prototype.hasOwnProperty.call(o, a); - var s = {}; - return (() => { - i.d(s, { default: () => Y }); - const o = (A) => !!A && typeof A == "object" && !Array.isArray(A); - function a(A, ...m) { - if (!m.length) return A; - const f = m.shift(); - return f !== void 0 && o(A) && o(f) ? (A = Object.assign({}, A), Object.keys(f).forEach((g) => { - const b = A[g], x = f[g]; - Array.isArray(b) && Array.isArray(x) ? A[g] = x : o(b) && o(x) ? A[g] = a(Object.assign({}, b), x) : A[g] = x; - }), a(A, ...m)) : A; - } - function u(A, m) { - const f = document.createElement("a"); - f.download = m, f.href = A, document.body.appendChild(f), f.click(), document.body.removeChild(f); - } - const l = { L: 0.07, M: 0.15, Q: 0.25, H: 0.3 }; - class d { - constructor({ svg: m, type: f, window: g }) { - this._svg = m, this._type = f, this._window = g; - } - draw(m, f, g, b) { - let x; - switch (this._type) { - case "dots": - x = this._drawDot; - break; - case "classy": - x = this._drawClassy; - break; - case "classy-rounded": - x = this._drawClassyRounded; - break; - case "rounded": - x = this._drawRounded; - break; - case "extra-rounded": - x = this._drawExtraRounded; - break; - default: - x = this._drawSquare; - } - x.call(this, { x: m, y: f, size: g, getNeighbor: b }); - } - _rotateFigure({ x: m, y: f, size: g, rotation: b = 0, draw: x }) { - var E; - const S = m + g / 2, v = f + g / 2; - x(), (E = this._element) === null || E === void 0 || E.setAttribute("transform", `rotate(${180 * b / Math.PI},${S},${v})`); - } - _basicDot(m) { - const { size: f, x: g, y: b } = m; - this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "circle"), this._element.setAttribute("cx", String(g + f / 2)), this._element.setAttribute("cy", String(b + f / 2)), this._element.setAttribute("r", String(f / 2)); - } })); - } - _basicSquare(m) { - const { size: f, x: g, y: b } = m; - this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"), this._element.setAttribute("x", String(g)), this._element.setAttribute("y", String(b)), this._element.setAttribute("width", String(f)), this._element.setAttribute("height", String(f)); - } })); - } - _basicSideRounded(m) { - const { size: f, x: g, y: b } = m; - this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${g} ${b}v ${f}h ` + f / 2 + `a ${f / 2} ${f / 2}, 0, 0, 0, 0 ${-f}`); - } })); - } - _basicCornerRounded(m) { - const { size: f, x: g, y: b } = m; - this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${g} ${b}v ${f}h ${f}v ` + -f / 2 + `a ${f / 2} ${f / 2}, 0, 0, 0, ${-f / 2} ${-f / 2}`); - } })); - } - _basicCornerExtraRounded(m) { - const { size: f, x: g, y: b } = m; - this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${g} ${b}v ${f}h ${f}a ${f} ${f}, 0, 0, 0, ${-f} ${-f}`); - } })); - } - _basicCornersRounded(m) { - const { size: f, x: g, y: b } = m; - this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${g} ${b}v ` + f / 2 + `a ${f / 2} ${f / 2}, 0, 0, 0, ${f / 2} ${f / 2}h ` + f / 2 + "v " + -f / 2 + `a ${f / 2} ${f / 2}, 0, 0, 0, ${-f / 2} ${-f / 2}`); - } })); - } - _drawDot({ x: m, y: f, size: g }) { - this._basicDot({ x: m, y: f, size: g, rotation: 0 }); - } - _drawSquare({ x: m, y: f, size: g }) { - this._basicSquare({ x: m, y: f, size: g, rotation: 0 }); - } - _drawRounded({ x: m, y: f, size: g, getNeighbor: b }) { - const x = b ? +b(-1, 0) : 0, E = b ? +b(1, 0) : 0, S = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0, M = x + E + S + v; - if (M !== 0) if (M > 2 || x && E || S && v) this._basicSquare({ x: m, y: f, size: g, rotation: 0 }); - else { - if (M === 2) { - let I = 0; - return x && S ? I = Math.PI / 2 : S && E ? I = Math.PI : E && v && (I = -Math.PI / 2), void this._basicCornerRounded({ x: m, y: f, size: g, rotation: I }); - } - if (M === 1) { - let I = 0; - return S ? I = Math.PI / 2 : E ? I = Math.PI : v && (I = -Math.PI / 2), void this._basicSideRounded({ x: m, y: f, size: g, rotation: I }); - } - } - else this._basicDot({ x: m, y: f, size: g, rotation: 0 }); - } - _drawExtraRounded({ x: m, y: f, size: g, getNeighbor: b }) { - const x = b ? +b(-1, 0) : 0, E = b ? +b(1, 0) : 0, S = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0, M = x + E + S + v; - if (M !== 0) if (M > 2 || x && E || S && v) this._basicSquare({ x: m, y: f, size: g, rotation: 0 }); - else { - if (M === 2) { - let I = 0; - return x && S ? I = Math.PI / 2 : S && E ? I = Math.PI : E && v && (I = -Math.PI / 2), void this._basicCornerExtraRounded({ x: m, y: f, size: g, rotation: I }); - } - if (M === 1) { - let I = 0; - return S ? I = Math.PI / 2 : E ? I = Math.PI : v && (I = -Math.PI / 2), void this._basicSideRounded({ x: m, y: f, size: g, rotation: I }); - } - } - else this._basicDot({ x: m, y: f, size: g, rotation: 0 }); - } - _drawClassy({ x: m, y: f, size: g, getNeighbor: b }) { - const x = b ? +b(-1, 0) : 0, E = b ? +b(1, 0) : 0, S = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0; - x + E + S + v !== 0 ? x || S ? E || v ? this._basicSquare({ x: m, y: f, size: g, rotation: 0 }) : this._basicCornerRounded({ x: m, y: f, size: g, rotation: Math.PI / 2 }) : this._basicCornerRounded({ x: m, y: f, size: g, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: m, y: f, size: g, rotation: Math.PI / 2 }); - } - _drawClassyRounded({ x: m, y: f, size: g, getNeighbor: b }) { - const x = b ? +b(-1, 0) : 0, E = b ? +b(1, 0) : 0, S = b ? +b(0, -1) : 0, v = b ? +b(0, 1) : 0; - x + E + S + v !== 0 ? x || S ? E || v ? this._basicSquare({ x: m, y: f, size: g, rotation: 0 }) : this._basicCornerExtraRounded({ x: m, y: f, size: g, rotation: Math.PI / 2 }) : this._basicCornerExtraRounded({ x: m, y: f, size: g, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: m, y: f, size: g, rotation: Math.PI / 2 }); - } - } - class p { - constructor({ svg: m, type: f, window: g }) { - this._svg = m, this._type = f, this._window = g; - } - draw(m, f, g, b) { - let x; - switch (this._type) { - case "square": - x = this._drawSquare; - break; - case "extra-rounded": - x = this._drawExtraRounded; - break; - default: - x = this._drawDot; - } - x.call(this, { x: m, y: f, size: g, rotation: b }); - } - _rotateFigure({ x: m, y: f, size: g, rotation: b = 0, draw: x }) { - var E; - const S = m + g / 2, v = f + g / 2; - x(), (E = this._element) === null || E === void 0 || E.setAttribute("transform", `rotate(${180 * b / Math.PI},${S},${v})`); - } - _basicDot(m) { - const { size: f, x: g, y: b } = m, x = f / 7; - this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${g + f / 2} ${b}a ${f / 2} ${f / 2} 0 1 0 0.1 0zm 0 ${x}a ${f / 2 - x} ${f / 2 - x} 0 1 1 -0.1 0Z`); - } })); - } - _basicSquare(m) { - const { size: f, x: g, y: b } = m, x = f / 7; - this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${g} ${b}v ${f}h ${f}v ` + -f + `zM ${g + x} ${b + x}h ` + (f - 2 * x) + "v " + (f - 2 * x) + "h " + (2 * x - f) + "z"); - } })); - } - _basicExtraRounded(m) { - const { size: f, x: g, y: b } = m, x = f / 7; - this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${g} ${b + 2.5 * x}v ` + 2 * x + `a ${2.5 * x} ${2.5 * x}, 0, 0, 0, ${2.5 * x} ${2.5 * x}h ` + 2 * x + `a ${2.5 * x} ${2.5 * x}, 0, 0, 0, ${2.5 * x} ${2.5 * -x}v ` + -2 * x + `a ${2.5 * x} ${2.5 * x}, 0, 0, 0, ${2.5 * -x} ${2.5 * -x}h ` + -2 * x + `a ${2.5 * x} ${2.5 * x}, 0, 0, 0, ${2.5 * -x} ${2.5 * x}M ${g + 2.5 * x} ${b + x}h ` + 2 * x + `a ${1.5 * x} ${1.5 * x}, 0, 0, 1, ${1.5 * x} ${1.5 * x}v ` + 2 * x + `a ${1.5 * x} ${1.5 * x}, 0, 0, 1, ${1.5 * -x} ${1.5 * x}h ` + -2 * x + `a ${1.5 * x} ${1.5 * x}, 0, 0, 1, ${1.5 * -x} ${1.5 * -x}v ` + -2 * x + `a ${1.5 * x} ${1.5 * x}, 0, 0, 1, ${1.5 * x} ${1.5 * -x}`); - } })); - } - _drawDot({ x: m, y: f, size: g, rotation: b }) { - this._basicDot({ x: m, y: f, size: g, rotation: b }); - } - _drawSquare({ x: m, y: f, size: g, rotation: b }) { - this._basicSquare({ x: m, y: f, size: g, rotation: b }); - } - _drawExtraRounded({ x: m, y: f, size: g, rotation: b }) { - this._basicExtraRounded({ x: m, y: f, size: g, rotation: b }); - } - } - class w { - constructor({ svg: m, type: f, window: g }) { - this._svg = m, this._type = f, this._window = g; - } - draw(m, f, g, b) { - let x; - x = this._type === "square" ? this._drawSquare : this._drawDot, x.call(this, { x: m, y: f, size: g, rotation: b }); - } - _rotateFigure({ x: m, y: f, size: g, rotation: b = 0, draw: x }) { - var E; - const S = m + g / 2, v = f + g / 2; - x(), (E = this._element) === null || E === void 0 || E.setAttribute("transform", `rotate(${180 * b / Math.PI},${S},${v})`); - } - _basicDot(m) { - const { size: f, x: g, y: b } = m; - this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "circle"), this._element.setAttribute("cx", String(g + f / 2)), this._element.setAttribute("cy", String(b + f / 2)), this._element.setAttribute("r", String(f / 2)); - } })); - } - _basicSquare(m) { - const { size: f, x: g, y: b } = m; - this._rotateFigure(Object.assign(Object.assign({}, m), { draw: () => { - this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"), this._element.setAttribute("x", String(g)), this._element.setAttribute("y", String(b)), this._element.setAttribute("width", String(f)), this._element.setAttribute("height", String(f)); - } })); - } - _drawDot({ x: m, y: f, size: g, rotation: b }) { - this._basicDot({ x: m, y: f, size: g, rotation: b }); - } - _drawSquare({ x: m, y: f, size: g, rotation: b }) { - this._basicSquare({ x: m, y: f, size: g, rotation: b }); - } - } - const _ = "circle", P = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]], O = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]; - class L { - constructor(m, f) { - this._roundSize = (g) => this._options.dotsOptions.roundSize ? Math.floor(g) : g, this._window = f, this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._element.setAttribute("width", String(m.width)), this._element.setAttribute("height", String(m.height)), this._element.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), m.dotsOptions.roundSize || this._element.setAttribute("shape-rendering", "crispEdges"), this._element.setAttribute("viewBox", `0 0 ${m.width} ${m.height}`), this._defs = this._window.document.createElementNS("http://www.w3.org/2000/svg", "defs"), this._element.appendChild(this._defs), this._imageUri = m.image, this._instanceId = L.instanceCount++, this._options = m; - } - get width() { - return this._options.width; - } - get height() { - return this._options.height; - } - getElement() { - return this._element; - } - async drawQR(m) { - const f = m.getModuleCount(), g = Math.min(this._options.width, this._options.height) - 2 * this._options.margin, b = this._options.shape === _ ? g / Math.sqrt(2) : g, x = this._roundSize(b / f); - let E = { hideXDots: 0, hideYDots: 0, width: 0, height: 0 }; - if (this._qr = m, this._options.image) { - if (await this.loadImage(), !this._image) return; - const { imageOptions: S, qrOptions: v } = this._options, M = S.imageSize * l[v.errorCorrectionLevel], I = Math.floor(M * f * f); - E = function({ originalHeight: F, originalWidth: ce, maxHiddenDots: D, maxHiddenAxisDots: oe, dotSize: Z }) { - const J = { x: 0, y: 0 }, ee = { x: 0, y: 0 }; - if (F <= 0 || ce <= 0 || D <= 0 || Z <= 0) return { height: 0, width: 0, hideYDots: 0, hideXDots: 0 }; - const T = F / ce; - return J.x = Math.floor(Math.sqrt(D / T)), J.x <= 0 && (J.x = 1), oe && oe < J.x && (J.x = oe), J.x % 2 == 0 && J.x--, ee.x = J.x * Z, J.y = 1 + 2 * Math.ceil((J.x * T - 1) / 2), ee.y = Math.round(ee.x * T), (J.y * J.x > D || oe && oe < J.y) && (oe && oe < J.y ? (J.y = oe, J.y % 2 == 0 && J.x--) : J.y -= 2, ee.y = J.y * Z, J.x = 1 + 2 * Math.ceil((J.y / T - 1) / 2), ee.x = Math.round(ee.y / T)), { height: ee.y, width: ee.x, hideYDots: J.y, hideXDots: J.x }; - }({ originalWidth: this._image.width, originalHeight: this._image.height, maxHiddenDots: I, maxHiddenAxisDots: f - 14, dotSize: x }); - } - this.drawBackground(), this.drawDots((S, v) => { - var M, I, F, ce, D, oe; - return !(this._options.imageOptions.hideBackgroundDots && S >= (f - E.hideYDots) / 2 && S < (f + E.hideYDots) / 2 && v >= (f - E.hideXDots) / 2 && v < (f + E.hideXDots) / 2 || !((M = P[S]) === null || M === void 0) && M[v] || !((I = P[S - f + 7]) === null || I === void 0) && I[v] || !((F = P[S]) === null || F === void 0) && F[v - f + 7] || !((ce = O[S]) === null || ce === void 0) && ce[v] || !((D = O[S - f + 7]) === null || D === void 0) && D[v] || !((oe = O[S]) === null || oe === void 0) && oe[v - f + 7]); - }), this.drawCorners(), this._options.image && await this.drawImage({ width: E.width, height: E.height, count: f, dotSize: x }); - } - drawBackground() { - var m, f, g; - const b = this._element, x = this._options; - if (b) { - const E = (m = x.backgroundOptions) === null || m === void 0 ? void 0 : m.gradient, S = (f = x.backgroundOptions) === null || f === void 0 ? void 0 : f.color; - let v = x.height, M = x.width; - if (E || S) { - const I = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"); - this._backgroundClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._backgroundClipPath.setAttribute("id", `clip-path-background-color-${this._instanceId}`), this._defs.appendChild(this._backgroundClipPath), !((g = x.backgroundOptions) === null || g === void 0) && g.round && (v = M = Math.min(x.width, x.height), I.setAttribute("rx", String(v / 2 * x.backgroundOptions.round))), I.setAttribute("x", String(this._roundSize((x.width - M) / 2))), I.setAttribute("y", String(this._roundSize((x.height - v) / 2))), I.setAttribute("width", String(M)), I.setAttribute("height", String(v)), this._backgroundClipPath.appendChild(I), this._createColor({ options: E, color: S, additionalRotation: 0, x: 0, y: 0, height: x.height, width: x.width, name: `background-color-${this._instanceId}` }); - } - } - } - drawDots(m) { - var f, g; - if (!this._qr) throw "QR code is not defined"; - const b = this._options, x = this._qr.getModuleCount(); - if (x > b.width || x > b.height) throw "The canvas is too small."; - const E = Math.min(b.width, b.height) - 2 * b.margin, S = b.shape === _ ? E / Math.sqrt(2) : E, v = this._roundSize(S / x), M = this._roundSize((b.width - x * v) / 2), I = this._roundSize((b.height - x * v) / 2), F = new d({ svg: this._element, type: b.dotsOptions.type, window: this._window }); - this._dotsClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._dotsClipPath.setAttribute("id", `clip-path-dot-color-${this._instanceId}`), this._defs.appendChild(this._dotsClipPath), this._createColor({ options: (f = b.dotsOptions) === null || f === void 0 ? void 0 : f.gradient, color: b.dotsOptions.color, additionalRotation: 0, x: 0, y: 0, height: b.height, width: b.width, name: `dot-color-${this._instanceId}` }); - for (let ce = 0; ce < x; ce++) for (let D = 0; D < x; D++) m && !m(ce, D) || !((g = this._qr) === null || g === void 0) && g.isDark(ce, D) && (F.draw(M + D * v, I + ce * v, v, (oe, Z) => !(D + oe < 0 || ce + Z < 0 || D + oe >= x || ce + Z >= x) && !(m && !m(ce + Z, D + oe)) && !!this._qr && this._qr.isDark(ce + Z, D + oe)), F._element && this._dotsClipPath && this._dotsClipPath.appendChild(F._element)); - if (b.shape === _) { - const ce = this._roundSize((E / v - x) / 2), D = x + 2 * ce, oe = M - ce * v, Z = I - ce * v, J = [], ee = this._roundSize(D / 2); - for (let T = 0; T < D; T++) { - J[T] = []; - for (let X = 0; X < D; X++) T >= ce - 1 && T <= D - ce && X >= ce - 1 && X <= D - ce || Math.sqrt((T - ee) * (T - ee) + (X - ee) * (X - ee)) > ee ? J[T][X] = 0 : J[T][X] = this._qr.isDark(X - 2 * ce < 0 ? X : X >= x ? X - 2 * ce : X - ce, T - 2 * ce < 0 ? T : T >= x ? T - 2 * ce : T - ce) ? 1 : 0; - } - for (let T = 0; T < D; T++) for (let X = 0; X < D; X++) J[T][X] && (F.draw(oe + X * v, Z + T * v, v, (re, pe) => { - var ie; - return !!(!((ie = J[T + pe]) === null || ie === void 0) && ie[X + re]); - }), F._element && this._dotsClipPath && this._dotsClipPath.appendChild(F._element)); - } - } - drawCorners() { - if (!this._qr) throw "QR code is not defined"; - const m = this._element, f = this._options; - if (!m) throw "Element code is not defined"; - const g = this._qr.getModuleCount(), b = Math.min(f.width, f.height) - 2 * f.margin, x = f.shape === _ ? b / Math.sqrt(2) : b, E = this._roundSize(x / g), S = 7 * E, v = 3 * E, M = this._roundSize((f.width - g * E) / 2), I = this._roundSize((f.height - g * E) / 2); - [[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach(([F, ce, D]) => { - var oe, Z, J, ee, T, X, re, pe, ie, ue, ve, Pe; - const De = M + F * E * (g - 7), Ce = I + ce * E * (g - 7); - let $e = this._dotsClipPath, Me = this._dotsClipPath; - if ((!((oe = f.cornersSquareOptions) === null || oe === void 0) && oe.gradient || !((Z = f.cornersSquareOptions) === null || Z === void 0) && Z.color) && ($e = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), $e.setAttribute("id", `clip-path-corners-square-color-${F}-${ce}-${this._instanceId}`), this._defs.appendChild($e), this._cornersSquareClipPath = this._cornersDotClipPath = Me = $e, this._createColor({ options: (J = f.cornersSquareOptions) === null || J === void 0 ? void 0 : J.gradient, color: (ee = f.cornersSquareOptions) === null || ee === void 0 ? void 0 : ee.color, additionalRotation: D, x: De, y: Ce, height: S, width: S, name: `corners-square-color-${F}-${ce}-${this._instanceId}` })), (T = f.cornersSquareOptions) === null || T === void 0 ? void 0 : T.type) { - const Ne = new p({ svg: this._element, type: f.cornersSquareOptions.type, window: this._window }); - Ne.draw(De, Ce, S, D), Ne._element && $e && $e.appendChild(Ne._element); - } else { - const Ne = new d({ svg: this._element, type: f.dotsOptions.type, window: this._window }); - for (let Ke = 0; Ke < P.length; Ke++) for (let Le = 0; Le < P[Ke].length; Le++) !((X = P[Ke]) === null || X === void 0) && X[Le] && (Ne.draw(De + Le * E, Ce + Ke * E, E, (qe, ze) => { - var _e; - return !!(!((_e = P[Ke + ze]) === null || _e === void 0) && _e[Le + qe]); - }), Ne._element && $e && $e.appendChild(Ne._element)); - } - if ((!((re = f.cornersDotOptions) === null || re === void 0) && re.gradient || !((pe = f.cornersDotOptions) === null || pe === void 0) && pe.color) && (Me = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), Me.setAttribute("id", `clip-path-corners-dot-color-${F}-${ce}-${this._instanceId}`), this._defs.appendChild(Me), this._cornersDotClipPath = Me, this._createColor({ options: (ie = f.cornersDotOptions) === null || ie === void 0 ? void 0 : ie.gradient, color: (ue = f.cornersDotOptions) === null || ue === void 0 ? void 0 : ue.color, additionalRotation: D, x: De + 2 * E, y: Ce + 2 * E, height: v, width: v, name: `corners-dot-color-${F}-${ce}-${this._instanceId}` })), (ve = f.cornersDotOptions) === null || ve === void 0 ? void 0 : ve.type) { - const Ne = new w({ svg: this._element, type: f.cornersDotOptions.type, window: this._window }); - Ne.draw(De + 2 * E, Ce + 2 * E, v, D), Ne._element && Me && Me.appendChild(Ne._element); - } else { - const Ne = new d({ svg: this._element, type: f.dotsOptions.type, window: this._window }); - for (let Ke = 0; Ke < O.length; Ke++) for (let Le = 0; Le < O[Ke].length; Le++) !((Pe = O[Ke]) === null || Pe === void 0) && Pe[Le] && (Ne.draw(De + Le * E, Ce + Ke * E, E, (qe, ze) => { - var _e; - return !!(!((_e = O[Ke + ze]) === null || _e === void 0) && _e[Le + qe]); - }), Ne._element && Me && Me.appendChild(Ne._element)); - } - }); - } - loadImage() { - return new Promise((m, f) => { - var g; - const b = this._options; - if (!b.image) return f("Image is not defined"); - if (!((g = b.nodeCanvas) === null || g === void 0) && g.loadImage) b.nodeCanvas.loadImage(b.image).then((x) => { - var E, S; - if (this._image = x, this._options.imageOptions.saveAsBlob) { - const v = (E = b.nodeCanvas) === null || E === void 0 ? void 0 : E.createCanvas(this._image.width, this._image.height); - (S = v == null ? void 0 : v.getContext("2d")) === null || S === void 0 || S.drawImage(x, 0, 0), this._imageUri = v == null ? void 0 : v.toDataURL(); - } - m(); - }).catch(f); - else { - const x = new this._window.Image(); - typeof b.imageOptions.crossOrigin == "string" && (x.crossOrigin = b.imageOptions.crossOrigin), this._image = x, x.onload = async () => { - this._options.imageOptions.saveAsBlob && (this._imageUri = await async function(E, S) { - return new Promise((v) => { - const M = new S.XMLHttpRequest(); - M.onload = function() { - const I = new S.FileReader(); - I.onloadend = function() { - v(I.result); - }, I.readAsDataURL(M.response); - }, M.open("GET", E), M.responseType = "blob", M.send(); - }); - }(b.image || "", this._window)), m(); - }, x.src = b.image; - } - }); - } - async drawImage({ width: m, height: f, count: g, dotSize: b }) { - const x = this._options, E = this._roundSize((x.width - g * b) / 2), S = this._roundSize((x.height - g * b) / 2), v = E + this._roundSize(x.imageOptions.margin + (g * b - m) / 2), M = S + this._roundSize(x.imageOptions.margin + (g * b - f) / 2), I = m - 2 * x.imageOptions.margin, F = f - 2 * x.imageOptions.margin, ce = this._window.document.createElementNS("http://www.w3.org/2000/svg", "image"); - ce.setAttribute("href", this._imageUri || ""), ce.setAttribute("x", String(v)), ce.setAttribute("y", String(M)), ce.setAttribute("width", `${I}px`), ce.setAttribute("height", `${F}px`), this._element.appendChild(ce); - } - _createColor({ options: m, color: f, additionalRotation: g, x: b, y: x, height: E, width: S, name: v }) { - const M = S > E ? S : E, I = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"); - if (I.setAttribute("x", String(b)), I.setAttribute("y", String(x)), I.setAttribute("height", String(E)), I.setAttribute("width", String(S)), I.setAttribute("clip-path", `url('#clip-path-${v}')`), m) { - let F; - if (m.type === "radial") F = this._window.document.createElementNS("http://www.w3.org/2000/svg", "radialGradient"), F.setAttribute("id", v), F.setAttribute("gradientUnits", "userSpaceOnUse"), F.setAttribute("fx", String(b + S / 2)), F.setAttribute("fy", String(x + E / 2)), F.setAttribute("cx", String(b + S / 2)), F.setAttribute("cy", String(x + E / 2)), F.setAttribute("r", String(M / 2)); - else { - const ce = ((m.rotation || 0) + g) % (2 * Math.PI), D = (ce + 2 * Math.PI) % (2 * Math.PI); - let oe = b + S / 2, Z = x + E / 2, J = b + S / 2, ee = x + E / 2; - D >= 0 && D <= 0.25 * Math.PI || D > 1.75 * Math.PI && D <= 2 * Math.PI ? (oe -= S / 2, Z -= E / 2 * Math.tan(ce), J += S / 2, ee += E / 2 * Math.tan(ce)) : D > 0.25 * Math.PI && D <= 0.75 * Math.PI ? (Z -= E / 2, oe -= S / 2 / Math.tan(ce), ee += E / 2, J += S / 2 / Math.tan(ce)) : D > 0.75 * Math.PI && D <= 1.25 * Math.PI ? (oe += S / 2, Z += E / 2 * Math.tan(ce), J -= S / 2, ee -= E / 2 * Math.tan(ce)) : D > 1.25 * Math.PI && D <= 1.75 * Math.PI && (Z += E / 2, oe += S / 2 / Math.tan(ce), ee -= E / 2, J -= S / 2 / Math.tan(ce)), F = this._window.document.createElementNS("http://www.w3.org/2000/svg", "linearGradient"), F.setAttribute("id", v), F.setAttribute("gradientUnits", "userSpaceOnUse"), F.setAttribute("x1", String(Math.round(oe))), F.setAttribute("y1", String(Math.round(Z))), F.setAttribute("x2", String(Math.round(J))), F.setAttribute("y2", String(Math.round(ee))); - } - m.colorStops.forEach(({ offset: ce, color: D }) => { - const oe = this._window.document.createElementNS("http://www.w3.org/2000/svg", "stop"); - oe.setAttribute("offset", 100 * ce + "%"), oe.setAttribute("stop-color", D), F.appendChild(oe); - }), I.setAttribute("fill", `url('#${v}')`), this._defs.appendChild(F); - } else f && I.setAttribute("fill", f); - this._element.appendChild(I); - } - } - L.instanceCount = 0; - const B = L, k = "canvas", W = {}; - for (let A = 0; A <= 40; A++) W[A] = A; - const U = { type: k, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: W[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: !0, hideBackgroundDots: !0, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: !0 }, backgroundOptions: { round: 0, color: "#fff" } }; - function V(A) { - const m = Object.assign({}, A); - if (!m.colorStops || !m.colorStops.length) throw "Field 'colorStops' is required in gradient"; - return m.rotation ? m.rotation = Number(m.rotation) : m.rotation = 0, m.colorStops = m.colorStops.map((f) => Object.assign(Object.assign({}, f), { offset: Number(f.offset) })), m; - } - function Q(A) { - const m = Object.assign({}, A); - return m.width = Number(m.width), m.height = Number(m.height), m.margin = Number(m.margin), m.imageOptions = Object.assign(Object.assign({}, m.imageOptions), { hideBackgroundDots: !!m.imageOptions.hideBackgroundDots, imageSize: Number(m.imageOptions.imageSize), margin: Number(m.imageOptions.margin) }), m.margin > Math.min(m.width, m.height) && (m.margin = Math.min(m.width, m.height)), m.dotsOptions = Object.assign({}, m.dotsOptions), m.dotsOptions.gradient && (m.dotsOptions.gradient = V(m.dotsOptions.gradient)), m.cornersSquareOptions && (m.cornersSquareOptions = Object.assign({}, m.cornersSquareOptions), m.cornersSquareOptions.gradient && (m.cornersSquareOptions.gradient = V(m.cornersSquareOptions.gradient))), m.cornersDotOptions && (m.cornersDotOptions = Object.assign({}, m.cornersDotOptions), m.cornersDotOptions.gradient && (m.cornersDotOptions.gradient = V(m.cornersDotOptions.gradient))), m.backgroundOptions && (m.backgroundOptions = Object.assign({}, m.backgroundOptions), m.backgroundOptions.gradient && (m.backgroundOptions.gradient = V(m.backgroundOptions.gradient))), m; - } - var R = i(873), K = i.n(R); - function ge(A) { - if (!A) throw new Error("Extension must be defined"); - A[0] === "." && (A = A.substring(1)); - const m = { bmp: "image/bmp", gif: "image/gif", ico: "image/vnd.microsoft.icon", jpeg: "image/jpeg", jpg: "image/jpeg", png: "image/png", svg: "image/svg+xml", tif: "image/tiff", tiff: "image/tiff", webp: "image/webp", pdf: "application/pdf" }[A.toLowerCase()]; - if (!m) throw new Error(`Extension "${A}" is not supported`); - return m; - } - class Ee { - constructor(m) { - m != null && m.jsdom ? this._window = new m.jsdom("", { resources: "usable" }).window : this._window = window, this._options = m ? Q(a(U, m)) : U, this.update(); - } - static _clearContainer(m) { - m && (m.innerHTML = ""); - } - _setupSvg() { - if (!this._qr) return; - const m = new B(this._options, this._window); - this._svg = m.getElement(), this._svgDrawingPromise = m.drawQR(this._qr).then(() => { - var f; - this._svg && ((f = this._extension) === null || f === void 0 || f.call(this, m.getElement(), this._options)); - }); - } - _setupCanvas() { - var m, f; - this._qr && (!((m = this._options.nodeCanvas) === null || m === void 0) && m.createCanvas ? (this._nodeCanvas = this._options.nodeCanvas.createCanvas(this._options.width, this._options.height), this._nodeCanvas.width = this._options.width, this._nodeCanvas.height = this._options.height) : (this._domCanvas = document.createElement("canvas"), this._domCanvas.width = this._options.width, this._domCanvas.height = this._options.height), this._setupSvg(), this._canvasDrawingPromise = (f = this._svgDrawingPromise) === null || f === void 0 ? void 0 : f.then(() => { - var g; - if (!this._svg) return; - const b = this._svg, x = new this._window.XMLSerializer().serializeToString(b), E = btoa(x), S = `data:${ge("svg")};base64,${E}`; - if (!((g = this._options.nodeCanvas) === null || g === void 0) && g.loadImage) return this._options.nodeCanvas.loadImage(S).then((v) => { - var M, I; - v.width = this._options.width, v.height = this._options.height, (I = (M = this._nodeCanvas) === null || M === void 0 ? void 0 : M.getContext("2d")) === null || I === void 0 || I.drawImage(v, 0, 0); - }); - { - const v = new this._window.Image(); - return new Promise((M) => { - v.onload = () => { - var I, F; - (F = (I = this._domCanvas) === null || I === void 0 ? void 0 : I.getContext("2d")) === null || F === void 0 || F.drawImage(v, 0, 0), M(); - }, v.src = S; - }); - } - })); - } - async _getElement(m = "png") { - if (!this._qr) throw "QR code is empty"; - return m.toLowerCase() === "svg" ? (this._svg && this._svgDrawingPromise || this._setupSvg(), await this._svgDrawingPromise, this._svg) : ((this._domCanvas || this._nodeCanvas) && this._canvasDrawingPromise || this._setupCanvas(), await this._canvasDrawingPromise, this._domCanvas || this._nodeCanvas); - } - update(m) { - Ee._clearContainer(this._container), this._options = m ? Q(a(this._options, m)) : this._options, this._options.data && (this._qr = K()(this._options.qrOptions.typeNumber, this._options.qrOptions.errorCorrectionLevel), this._qr.addData(this._options.data, this._options.qrOptions.mode || function(f) { - switch (!0) { - case /^[0-9]*$/.test(f): - return "Numeric"; - case /^[0-9A-Z $%*+\-./:]*$/.test(f): - return "Alphanumeric"; - default: - return "Byte"; - } - }(this._options.data)), this._qr.make(), this._options.type === k ? this._setupCanvas() : this._setupSvg(), this.append(this._container)); - } - append(m) { - if (m) { - if (typeof m.appendChild != "function") throw "Container should be a single DOM node"; - this._options.type === k ? this._domCanvas && m.appendChild(this._domCanvas) : this._svg && m.appendChild(this._svg), this._container = m; - } - } - applyExtension(m) { - if (!m) throw "Extension function should be defined."; - this._extension = m, this.update(); - } - deleteExtension() { - this._extension = void 0, this.update(); - } - async getRawData(m = "png") { - if (!this._qr) throw "QR code is empty"; - const f = await this._getElement(m), g = ge(m); - if (!f) return null; - if (m.toLowerCase() === "svg") { - const b = `\r -${new this._window.XMLSerializer().serializeToString(f)}`; - return typeof Blob > "u" || this._options.jsdom ? Buffer.from(b) : new Blob([b], { type: g }); - } - return new Promise((b) => { - const x = f; - if ("toBuffer" in x) if (g === "image/png") b(x.toBuffer(g)); - else if (g === "image/jpeg") b(x.toBuffer(g)); - else { - if (g !== "application/pdf") throw Error("Unsupported extension"); - b(x.toBuffer(g)); - } - else "toBlob" in x && x.toBlob(b, g, 1); - }); - } - async download(m) { - if (!this._qr) throw "QR code is empty"; - if (typeof Blob > "u") throw "Cannot download in Node.js, call getRawData instead."; - let f = "png", g = "qr"; - typeof m == "string" ? (f = m, console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")) : typeof m == "object" && m !== null && (m.name && (g = m.name), m.extension && (f = m.extension)); - const b = await this._getElement(f); - if (b) if (f.toLowerCase() === "svg") { - let x = new XMLSerializer().serializeToString(b); - x = `\r -` + x, u(`data:${ge(f)};charset=utf-8,${encodeURIComponent(x)}`, `${g}.svg`); - } else u(b.toDataURL(ge(f)), `${g}.${f}`); - } - } - const Y = Ee; - })(), s.default; - })()); -})(hA); -var Pie = hA.exports; -const dA = /* @__PURE__ */ ns(Pie); -class aa extends gt { - constructor(e) { - const { docsPath: r, field: n, metaMessages: i } = e; - super(`Invalid Sign-In with Ethereum message field "${n}".`, { - docsPath: r, - metaMessages: i, - name: "SiweInvalidMessageFieldError" - }); - } -} -function M5(t) { - if (/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(t) || /%[^0-9a-f]/i.test(t) || /%[0-9a-f](:?[^0-9a-f]|$)/i.test(t)) - return !1; - const e = Mie(t), r = e[1], n = e[2], i = e[3], s = e[4], o = e[5]; - if (!(r != null && r.length && i.length >= 0)) - return !1; - if (n != null && n.length) { - if (!(i.length === 0 || /^\//.test(i))) - return !1; - } else if (/^\/\//.test(i)) - return !1; - if (!/^[a-z][a-z0-9\+\-\.]*$/.test(r.toLowerCase())) - return !1; - let a = ""; - return a += `${r}:`, n != null && n.length && (a += `//${n}`), a += i, s != null && s.length && (a += `?${s}`), o != null && o.length && (a += `#${o}`), a; -} -function Mie(t) { - return t.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/); -} -function pA(t) { - const { chainId: e, domain: r, expirationTime: n, issuedAt: i = /* @__PURE__ */ new Date(), nonce: s, notBefore: o, requestId: a, resources: u, scheme: l, uri: d, version: p } = t; - { - if (e !== Math.floor(e)) - throw new aa({ - field: "chainId", - metaMessages: [ - "- Chain ID must be a EIP-155 chain ID.", - "- See https://eips.ethereum.org/EIPS/eip-155", - "", - `Provided value: ${e}` - ] - }); - if (!(Iie.test(r) || Cie.test(r) || Tie.test(r))) - throw new aa({ - field: "domain", - metaMessages: [ - "- Domain must be an RFC 3986 authority.", - "- See https://www.rfc-editor.org/rfc/rfc3986", - "", - `Provided value: ${r}` - ] - }); - if (!Rie.test(s)) - throw new aa({ - field: "nonce", - metaMessages: [ - "- Nonce must be at least 8 characters.", - "- Nonce must be alphanumeric.", - "", - `Provided value: ${s}` - ] - }); - if (!M5(d)) - throw new aa({ - field: "uri", - metaMessages: [ - "- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.", - "- See https://www.rfc-editor.org/rfc/rfc3986", - "", - `Provided value: ${d}` - ] - }); - if (p !== "1") - throw new aa({ - field: "version", - metaMessages: [ - "- Version must be '1'.", - "", - `Provided value: ${p}` - ] - }); - if (l && !Die.test(l)) - throw new aa({ - field: "scheme", - metaMessages: [ - "- Scheme must be an RFC 3986 URI scheme.", - "- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1", - "", - `Provided value: ${l}` - ] - }); - const B = t.statement; - if (B != null && B.includes(` -`)) - throw new aa({ - field: "statement", - metaMessages: [ - "- Statement must not include '\\n'.", - "", - `Provided value: ${B}` - ] - }); - } - const w = Fv(t.address), _ = l ? `${l}://${r}` : r, P = t.statement ? `${t.statement} -` : "", O = `${_} wants you to sign in with your Ethereum account: -${w} - -${P}`; - let L = `URI: ${d} -Version: ${p} -Chain ID: ${e} -Nonce: ${s} -Issued At: ${i.toISOString()}`; - if (n && (L += ` -Expiration Time: ${n.toISOString()}`), o && (L += ` -Not Before: ${o.toISOString()}`), a && (L += ` -Request ID: ${a}`), u) { - let B = ` -Resources:`; - for (const k of u) { - if (!M5(k)) - throw new aa({ - field: "resources", - metaMessages: [ - "- Every resource must be a RFC 3986 URI.", - "- See https://www.rfc-editor.org/rfc/rfc3986", - "", - `Provided value: ${k}` - ] - }); - B += ` -- ${k}`; - } - L += B; - } - return `${O} -${L}`; -} -const Iie = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/, Cie = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/, Tie = /^localhost(:[0-9]{1,5})?$/, Rie = /^[a-zA-Z0-9]{8,}$/, Die = /^([a-zA-Z][a-zA-Z0-9+-.]*)$/, gA = "7a4434fefbcc9af474fb5c995e47d286", Oie = { - projectId: gA, - metadata: { - name: "codatta", - description: "codatta", - url: "https://codatta.io/", - icons: ["https://avatars.githubusercontent.com/u/171659315"] - } -}, Nie = { - namespaces: { - eip155: { - methods: [ - "eth_sendTransaction", - "eth_signTransaction", - "eth_sign", - "personal_sign", - "eth_signTypedData" - ], - chains: ["eip155:56"], - events: ["chainChanged", "accountsChanged", "disconnect"], - rpcMap: { - 1: `https://rpc.walletconnect.com?chainId=eip155:56&projectId=${gA}` - } - } - }, - skipPairing: !1 -}; -function Lie(t, e) { - const r = window.location.host, n = window.location.href; - return pA({ - address: t, - chainId: 1, - domain: r, - nonce: e, - uri: n, - version: "1" - }); -} -function mA(t) { - var ge, Ee, Y; - const e = Qn(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Yt(""), [a, u] = Yt(!1), [l, d] = Yt(""), [p, w] = Yt("scan"), _ = Qn(), [P, O] = Yt((ge = r.config) == null ? void 0 : ge.image), [L, B] = Yt(!1), { saveLastUsedWallet: k } = Tp(); - async function W(A) { - var f, g, b, x; - u(!0); - const m = await wY.init(Oie); - m.session && await m.disconnect(); - try { - if (w("scan"), m.on("display_uri", (ce) => { - o(ce), u(!1), w("scan"); - }), m.on("error", (ce) => { - console.log(ce); - }), m.on("session_update", (ce) => { - console.log("session_update", ce); - }), !await m.connect(Nie)) throw new Error("Walletconnect init failed"); - const S = new yu(m); - O(((f = S.config) == null ? void 0 : f.image) || ((g = A.config) == null ? void 0 : g.image)); - const v = await S.getAddress(), M = await ka.getNonce({ account_type: "block_chain" }); - console.log("get nonce", M); - const I = Lie(v, M); - w("sign"); - const F = await S.signMessage(I, v); - w("waiting"), await i(S, { - message: I, - nonce: M, - signature: F, - address: v, - wallet_name: ((b = S.config) == null ? void 0 : b.name) || ((x = A.config) == null ? void 0 : x.name) || "" - }), console.log("save wallet connect wallet!"), k(S); - } catch (E) { - console.log("err", E), d(E.details || E.message); - } - } - function U() { - _.current = new dA({ - width: 264, - height: 264, - margin: 0, - type: "svg", - // image: wallet.config?.image, - qrOptions: { - errorCorrectionLevel: "M" - }, - dotsOptions: { - color: "black", - type: "rounded" - }, - backgroundOptions: { - color: "transparent" - } - }), _.current.append(e.current); - } - function V(A) { - var m; - console.log(_.current), (m = _.current) == null || m.update({ - data: A - }); - } - Dn(() => { - s && V(s); - }, [s]), Dn(() => { - W(r); - }, [r]), Dn(() => { - U(); - }, []); - function Q() { - d(""), V(""), W(r); - } - function R() { - B(!0), navigator.clipboard.writeText(s), setTimeout(() => { - B(!1); - }, 2500); - } - function K() { - var f; - const A = (f = r.config) == null ? void 0 : f.desktop_link; - if (!A) return; - const m = `${A}?uri=${encodeURIComponent(s)}`; - window.open(m, "_blank"); - } - return /* @__PURE__ */ le.jsxs("div", { children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-text-center", children: /* @__PURE__ */ le.jsxs("div", { className: "xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1", children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center", ref: e }), - /* @__PURE__ */ le.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: a ? /* @__PURE__ */ le.jsx(Sc, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ le.jsx("img", { className: "xc-h-10 xc-w-10", src: P }) }) - ] }) }), - /* @__PURE__ */ le.jsxs("div", { className: "xc-m-auto xc-mb-6 xc-flex xc-max-w-[400px] xc-flex-wrap xc-items-center xc-justify-between xc-gap-3", children: [ - /* @__PURE__ */ le.jsx( - "button", - { - disabled: !s, - onClick: R, - className: "xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent", - children: L ? /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ - " ", - /* @__PURE__ */ le.jsx(VZ, {}), - " Copied!" - ] }) : /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ - /* @__PURE__ */ le.jsx(JZ, {}), - "Copy QR URL" - ] }) - } - ), - ((Ee = r.config) == null ? void 0 : Ee.getWallet) && /* @__PURE__ */ le.jsxs( - "button", - { - className: "xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black", - onClick: n, - children: [ - /* @__PURE__ */ le.jsx(GZ, {}), - "Get Extension" - ] - } - ), - ((Y = r.config) == null ? void 0 : Y.desktop_link) && /* @__PURE__ */ le.jsxs( - "button", - { - disabled: !s, - className: "xc-rounded-2 xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black", - onClick: K, - children: [ - /* @__PURE__ */ le.jsx(y7, {}), - "Desktop" - ] - } - ) - ] }), - /* @__PURE__ */ le.jsx("div", { className: "xc-text-center", children: l ? /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ - /* @__PURE__ */ le.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: l }), - /* @__PURE__ */ le.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: Q, children: "Retry" }) - ] }) : /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ - p === "scan" && /* @__PURE__ */ le.jsx("p", { children: "Scan this QR code from your mobile wallet or phone's camera to connect." }), - p === "connect" && /* @__PURE__ */ le.jsx("p", { children: "Click connect in your wallet app" }), - p === "sign" && /* @__PURE__ */ le.jsx("p", { children: "Click sign-in in your wallet to confirm you own this wallet." }), - p === "waiting" && /* @__PURE__ */ le.jsx("div", { className: "xc-text-center", children: /* @__PURE__ */ le.jsx(Sc, { className: "xc-inline-block xc-animate-spin" }) }) - ] }) }) - ] }); -} -const kie = /* @__PURE__ */ bL({ - id: 1, - name: "Ethereum", - nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }, - rpcUrls: { - default: { - http: ["https://eth.merkle.io"] - } - }, - blockExplorers: { - default: { - name: "Etherscan", - url: "https://etherscan.io", - apiUrl: "https://api.etherscan.io/api" - } - }, - contracts: { - ensRegistry: { - address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" - }, - ensUniversalResolver: { - address: "0xce01f8eee7E479C928F8919abD53E553a36CeF67", - blockCreated: 19258213 - }, - multicall3: { - address: "0xca11bde05977b3631167028862be2a173976ca11", - blockCreated: 14353601 - } - } -}), $ie = "Accept connection request in the wallet", Bie = "Accept sign-in request in your wallet"; -function Fie(t, e, r) { - const n = window.location.host, i = window.location.href; - return pA({ - address: t, - chainId: r, - domain: n, - nonce: e, - uri: i, - version: "1" - }); -} -function vA(t) { - var w; - const [e, r] = Yt(), { wallet: n, onSignFinish: i } = t, s = Qn(), [o, a] = Yt("connect"), { saveLastUsedWallet: u, chains: l } = Tp(); - async function d(_) { - var P; - try { - a("connect"); - const O = await n.connect(); - if (!O || O.length === 0) - throw new Error("Wallet connect error"); - const L = await n.getChain(), B = l.find((Q) => Q.id === L), k = B || l[0] || kie; - !B && l.length > 0 && (a("switch-chain"), await n.switchChain(k)); - const W = Fv(O[0]), U = Fie(W, _, k.id); - a("sign"); - const V = await n.signMessage(U, W); - if (!V || V.length === 0) - throw new Error("user sign error"); - a("waiting"), await i(n, { address: W, signature: V, message: U, nonce: _, wallet_name: ((P = n.config) == null ? void 0 : P.name) || "" }), u(n); - } catch (O) { - console.log("walletSignin error", O.stack), console.log(O.details || O.message), r(O.details || O.message); - } - } - async function p() { - try { - r(""); - const _ = await ka.getNonce({ account_type: "block_chain" }); - s.current = _, d(s.current); - } catch (_) { - console.log(_.details), r(_.message); - } - } - return Dn(() => { - p(); - }, []), /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4", children: [ - /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-h-16 xc-w-16", src: (w = n.config) == null ? void 0 : w.image, alt: "" }), - e && /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ - /* @__PURE__ */ le.jsx("p", { className: "xc-text-danger xc-mb-2 xc-text-center", children: e }), - /* @__PURE__ */ le.jsx("div", { className: "xc-flex xc-gap-2", children: /* @__PURE__ */ le.jsx("button", { className: "xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1", onClick: p, children: "Retry" }) }) - ] }), - !e && /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ - o === "connect" && /* @__PURE__ */ le.jsx("span", { className: "xc-text-center", children: $ie }), - o === "sign" && /* @__PURE__ */ le.jsx("span", { className: "xc-text-center", children: Bie }), - o === "waiting" && /* @__PURE__ */ le.jsx("span", { className: "xc-text-center", children: /* @__PURE__ */ le.jsx(Sc, { className: "xc-animate-spin" }) }), - o === "switch-chain" && /* @__PURE__ */ le.jsxs("span", { className: "xc-text-center", children: [ - "Switch to ", - l[0].name - ] }) - ] }) - ] }); -} -const iu = "https://static.codatta.io/codatta-connect/wallet-icons.svg", jie = "https://itunes.apple.com/app/", Uie = "https://play.google.com/store/apps/details?id=", qie = "https://chromewebstore.google.com/detail/", zie = "https://chromewebstore.google.com/detail/", Wie = "https://addons.mozilla.org/en-US/firefox/addon/", Hie = "https://microsoftedge.microsoft.com/addons/detail/"; -function su(t) { - const { icon: e, title: r, link: n } = t; - return /* @__PURE__ */ le.jsxs( - "a", - { - href: n, - target: "_blank", - className: "xc-flex xc-w-full xc-cursor-pointer xc-items-center xc-gap-2 xc-rounded-full xc-border xc-border-white xc-border-opacity-15 xc-px-6 xc-py-3 xc-transition-all xc-hover:bg-white xc-hover:bg-opacity-5", - children: [ - /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-1 xc-h-6 xc-w-6", src: e, alt: "" }), - r, - /* @__PURE__ */ le.jsx(b7, { className: "xc-ml-auto xc-text-gray-400" }) - ] - } - ); -} -function Kie(t) { - const e = { - appStoreLink: "", - playStoreLink: "", - chromeStoreLink: "", - braveStoreLink: "", - firefoxStoreLink: "", - edgeStoreLink: "" - }; - return t != null && t.app_store_id && (e.appStoreLink = `${jie}${t.app_store_id}`), t != null && t.play_store_id && (e.playStoreLink = `${Uie}${t.play_store_id}`), t != null && t.chrome_store_id && (e.chromeStoreLink = `${qie}${t.chrome_store_id}`), t != null && t.brave_store_id && (e.braveStoreLink = `${zie}${t.brave_store_id}`), t != null && t.firefox_addon_id && (e.firefoxStoreLink = `${Wie}${t.firefox_addon_id}`), t != null && t.edge_addon_id && (e.edgeStoreLink = `${Hie}${t.edge_addon_id}`), e; -} -function bA(t) { - var i, s, o; - const { wallet: e } = t, r = (i = e.config) == null ? void 0 : i.getWallet, n = Kie(r); - return /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-flex-col xc-items-center", children: [ - /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-mb-2 xc-h-12 xc-w-12", src: (s = e.config) == null ? void 0 : s.image, alt: "" }), - /* @__PURE__ */ le.jsxs("p", { className: "xc-text-lg xc-font-bold", children: [ - "Install ", - (o = e.config) == null ? void 0 : o.name, - " to connect" - ] }), - /* @__PURE__ */ le.jsx("p", { className: "xc-mb-6 xc-text-sm xc-text-gray-500", children: "Select from your preferred options below:" }), - /* @__PURE__ */ le.jsxs("div", { className: "xc-grid xc-w-full xc-grid-cols-1 xc-gap-3", children: [ - (r == null ? void 0 : r.chrome_store_id) && /* @__PURE__ */ le.jsx( - su, - { - link: n.chromeStoreLink, - icon: `${iu}#chrome`, - title: "Google Play Store" - } - ), - (r == null ? void 0 : r.app_store_id) && /* @__PURE__ */ le.jsx( - su, - { - link: n.appStoreLink, - icon: `${iu}#apple-dark`, - title: "Apple App Store" - } - ), - (r == null ? void 0 : r.play_store_id) && /* @__PURE__ */ le.jsx( - su, - { - link: n.playStoreLink, - icon: `${iu}#android`, - title: "Google Play Store" - } - ), - (r == null ? void 0 : r.edge_addon_id) && /* @__PURE__ */ le.jsx( - su, - { - link: n.edgeStoreLink, - icon: `${iu}#edge`, - title: "Microsoft Edge" - } - ), - (r == null ? void 0 : r.brave_store_id) && /* @__PURE__ */ le.jsx( - su, - { - link: n.braveStoreLink, - icon: `${iu}#brave`, - title: "Brave extension" - } - ), - (r == null ? void 0 : r.firefox_addon_id) && /* @__PURE__ */ le.jsx( - su, - { - link: n.firefoxStoreLink, - icon: `${iu}#firefox`, - title: "Mozilla Firefox" - } - ) - ] }) - ] }); -} -function Vie(t) { - const { wallet: e } = t, [r, n] = Yt(e.installed ? "connect" : "qr"), i = Ey(); - async function s(o, a) { - var l; - const u = await ka.walletLogin({ - account_type: "block_chain", - account_enum: i.role, - connector: "codatta_wallet", - inviter_code: i.inviterCode, - wallet_name: ((l = o.config) == null ? void 0 : l.name) || o.key, - address: await o.getAddress(), - chain: (await o.getChain()).toString(), - nonce: a.nonce, - signature: a.signature, - message: a.message, - source: { - device: i.device, - channel: i.channel, - app: i.app - } - }); - await t.onLogin(u.data); - } - return /* @__PURE__ */ le.jsxs(Rs, { children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(kc, { title: "Connect wallet", onBack: t.onBack }) }), - r === "qr" && /* @__PURE__ */ le.jsx( - mA, - { - wallet: e, - onGetExtension: () => n("get-extension"), - onSignFinish: s - } - ), - r === "connect" && /* @__PURE__ */ le.jsx( - vA, - { - onShowQrCode: () => n("qr"), - wallet: e, - onSignFinish: s - } - ), - r === "get-extension" && /* @__PURE__ */ le.jsx(bA, { wallet: e }) - ] }); -} -function Gie(t) { - const { wallet: e, onClick: r } = t, n = /* @__PURE__ */ le.jsx("img", { className: "xc-rounded-md xc-h-5 xc-w-5", src: e.imageUrl }), i = e.name || ""; - return /* @__PURE__ */ le.jsx(xy, { icon: n, title: i, onClick: () => r(e) }); -} -function yA(t) { - const { connector: e } = t, [r, n] = Yt(), [i, s] = Yt([]), o = wi(() => r ? i.filter((d) => d.name.toLowerCase().includes(r.toLowerCase())) : i, [r, i]); - function a(d) { - n(d.target.value); - } - async function u() { - const d = await e.getWallets(); - s(d); - } - Dn(() => { - u(); - }, []); - function l(d) { - t.onSelect(d); - } - return /* @__PURE__ */ le.jsxs(Rs, { children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(kc, { title: "Select wallet", onBack: t.onBack }) }), - /* @__PURE__ */ le.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ - /* @__PURE__ */ le.jsx(w7, { className: "xc-shrink-0 xc-opacity-50" }), - /* @__PURE__ */ le.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: a }) - ] }), - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: o == null ? void 0 : o.map((d) => /* @__PURE__ */ le.jsx(Gie, { wallet: d, onClick: l }, d.name)) }) - ] }); -} -var wA = { exports: {} }; -(function(t) { - (function(e, r) { - t.exports ? t.exports = r() : (e.nacl || (e.nacl = {}), e.nacl.util = r()); - })(gn, function() { - var e = {}; - function r(n) { - if (!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n)) - throw new TypeError("invalid encoding"); - } - return e.decodeUTF8 = function(n) { - if (typeof n != "string") throw new TypeError("expected string"); - var i, s = unescape(encodeURIComponent(n)), o = new Uint8Array(s.length); - for (i = 0; i < s.length; i++) o[i] = s.charCodeAt(i); - return o; - }, e.encodeUTF8 = function(n) { - var i, s = []; - for (i = 0; i < n.length; i++) s.push(String.fromCharCode(n[i])); - return decodeURIComponent(escape(s.join(""))); - }, typeof atob > "u" ? typeof Buffer.from < "u" ? (e.encodeBase64 = function(n) { - return Buffer.from(n).toString("base64"); - }, e.decodeBase64 = function(n) { - return r(n), new Uint8Array(Array.prototype.slice.call(Buffer.from(n, "base64"), 0)); - }) : (e.encodeBase64 = function(n) { - return new Buffer(n).toString("base64"); - }, e.decodeBase64 = function(n) { - return r(n), new Uint8Array(Array.prototype.slice.call(new Buffer(n, "base64"), 0)); - }) : (e.encodeBase64 = function(n) { - var i, s = [], o = n.length; - for (i = 0; i < o; i++) s.push(String.fromCharCode(n[i])); - return btoa(s.join("")); - }, e.decodeBase64 = function(n) { - r(n); - var i, s = atob(n), o = new Uint8Array(s.length); - for (i = 0; i < s.length; i++) o[i] = s.charCodeAt(i); - return o; - }), e; - }); -})(wA); -var Yie = wA.exports; -const zl = /* @__PURE__ */ ns(Yie); -var xA = { exports: {} }; -(function(t) { - (function(e) { - var r = function($) { - var q, H = new Float64Array(16); - if ($) for (q = 0; q < $.length; q++) H[q] = $[q]; - return H; - }, n = function() { - throw new Error("no PRNG"); - }, i = new Uint8Array(16), s = new Uint8Array(32); - s[0] = 9; - var o = r(), a = r([1]), u = r([56129, 1]), l = r([30883, 4953, 19914, 30187, 55467, 16705, 2637, 112, 59544, 30585, 16505, 36039, 65139, 11119, 27886, 20995]), d = r([61785, 9906, 39828, 60374, 45398, 33411, 5274, 224, 53552, 61171, 33010, 6542, 64743, 22239, 55772, 9222]), p = r([54554, 36645, 11616, 51542, 42930, 38181, 51040, 26924, 56412, 64982, 57905, 49316, 21502, 52590, 14035, 8553]), w = r([26200, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214]), _ = r([41136, 18958, 6951, 50414, 58488, 44335, 6150, 12099, 55207, 15867, 153, 11085, 57099, 20417, 9344, 11139]); - function P($, q, H, C) { - $[q] = H >> 24 & 255, $[q + 1] = H >> 16 & 255, $[q + 2] = H >> 8 & 255, $[q + 3] = H & 255, $[q + 4] = C >> 24 & 255, $[q + 5] = C >> 16 & 255, $[q + 6] = C >> 8 & 255, $[q + 7] = C & 255; - } - function O($, q, H, C, G) { - var j, se = 0; - for (j = 0; j < G; j++) se |= $[q + j] ^ H[C + j]; - return (1 & se - 1 >>> 8) - 1; - } - function L($, q, H, C) { - return O($, q, H, C, 16); - } - function B($, q, H, C) { - return O($, q, H, C, 32); - } - function k($, q, H, C) { - for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = H[0] & 255 | (H[1] & 255) << 8 | (H[2] & 255) << 16 | (H[3] & 255) << 24, se = H[4] & 255 | (H[5] & 255) << 8 | (H[6] & 255) << 16 | (H[7] & 255) << 24, de = H[8] & 255 | (H[9] & 255) << 8 | (H[10] & 255) << 16 | (H[11] & 255) << 24, xe = H[12] & 255 | (H[13] & 255) << 8 | (H[14] & 255) << 16 | (H[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = q[0] & 255 | (q[1] & 255) << 8 | (q[2] & 255) << 16 | (q[3] & 255) << 24, nt = q[4] & 255 | (q[5] & 255) << 8 | (q[6] & 255) << 16 | (q[7] & 255) << 24, je = q[8] & 255 | (q[9] & 255) << 8 | (q[10] & 255) << 16 | (q[11] & 255) << 24, pt = q[12] & 255 | (q[13] & 255) << 8 | (q[14] & 255) << 16 | (q[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = H[16] & 255 | (H[17] & 255) << 8 | (H[18] & 255) << 16 | (H[19] & 255) << 24, St = H[20] & 255 | (H[21] & 255) << 8 | (H[22] & 255) << 16 | (H[23] & 255) << 24, Tt = H[24] & 255 | (H[25] & 255) << 8 | (H[26] & 255) << 16 | (H[27] & 255) << 24, At = H[28] & 255 | (H[29] & 255) << 8 | (H[30] & 255) << 16 | (H[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, yt = de, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, he, rr = 0; rr < 20; rr += 2) - he = ht + Lt | 0, ut ^= he << 7 | he >>> 25, he = ut + ht | 0, Ve ^= he << 9 | he >>> 23, he = Ve + ut | 0, Lt ^= he << 13 | he >>> 19, he = Lt + Ve | 0, ht ^= he << 18 | he >>> 14, he = ot + xt | 0, Fe ^= he << 7 | he >>> 25, he = Fe + ot | 0, zt ^= he << 9 | he >>> 23, he = zt + Fe | 0, xt ^= he << 13 | he >>> 19, he = xt + zt | 0, ot ^= he << 18 | he >>> 14, he = Ue + Se | 0, Zt ^= he << 7 | he >>> 25, he = Zt + Ue | 0, st ^= he << 9 | he >>> 23, he = st + Zt | 0, Se ^= he << 13 | he >>> 19, he = Se + st | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Je | 0, yt ^= he << 7 | he >>> 25, he = yt + Wt | 0, Ae ^= he << 9 | he >>> 23, he = Ae + yt | 0, Je ^= he << 13 | he >>> 19, he = Je + Ae | 0, Wt ^= he << 18 | he >>> 14, he = ht + yt | 0, xt ^= he << 7 | he >>> 25, he = xt + ht | 0, st ^= he << 9 | he >>> 23, he = st + xt | 0, yt ^= he << 13 | he >>> 19, he = yt + st | 0, ht ^= he << 18 | he >>> 14, he = ot + ut | 0, Se ^= he << 7 | he >>> 25, he = Se + ot | 0, Ae ^= he << 9 | he >>> 23, he = Ae + Se | 0, ut ^= he << 13 | he >>> 19, he = ut + Ae | 0, ot ^= he << 18 | he >>> 14, he = Ue + Fe | 0, Je ^= he << 7 | he >>> 25, he = Je + Ue | 0, Ve ^= he << 9 | he >>> 23, he = Ve + Je | 0, Fe ^= he << 13 | he >>> 19, he = Fe + Ve | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Zt | 0, Lt ^= he << 7 | he >>> 25, he = Lt + Wt | 0, zt ^= he << 9 | he >>> 23, he = zt + Lt | 0, Zt ^= he << 13 | he >>> 19, he = Zt + zt | 0, Wt ^= he << 18 | he >>> 14; - ht = ht + G | 0, xt = xt + j | 0, st = st + se | 0, yt = yt + de | 0, ut = ut + xe | 0, ot = ot + Te | 0, Se = Se + Re | 0, Ae = Ae + nt | 0, Ve = Ve + je | 0, Fe = Fe + pt | 0, Ue = Ue + it | 0, Je = Je + et | 0, Lt = Lt + St | 0, zt = zt + Tt | 0, Zt = Zt + At | 0, Wt = Wt + _t | 0, $[0] = ht >>> 0 & 255, $[1] = ht >>> 8 & 255, $[2] = ht >>> 16 & 255, $[3] = ht >>> 24 & 255, $[4] = xt >>> 0 & 255, $[5] = xt >>> 8 & 255, $[6] = xt >>> 16 & 255, $[7] = xt >>> 24 & 255, $[8] = st >>> 0 & 255, $[9] = st >>> 8 & 255, $[10] = st >>> 16 & 255, $[11] = st >>> 24 & 255, $[12] = yt >>> 0 & 255, $[13] = yt >>> 8 & 255, $[14] = yt >>> 16 & 255, $[15] = yt >>> 24 & 255, $[16] = ut >>> 0 & 255, $[17] = ut >>> 8 & 255, $[18] = ut >>> 16 & 255, $[19] = ut >>> 24 & 255, $[20] = ot >>> 0 & 255, $[21] = ot >>> 8 & 255, $[22] = ot >>> 16 & 255, $[23] = ot >>> 24 & 255, $[24] = Se >>> 0 & 255, $[25] = Se >>> 8 & 255, $[26] = Se >>> 16 & 255, $[27] = Se >>> 24 & 255, $[28] = Ae >>> 0 & 255, $[29] = Ae >>> 8 & 255, $[30] = Ae >>> 16 & 255, $[31] = Ae >>> 24 & 255, $[32] = Ve >>> 0 & 255, $[33] = Ve >>> 8 & 255, $[34] = Ve >>> 16 & 255, $[35] = Ve >>> 24 & 255, $[36] = Fe >>> 0 & 255, $[37] = Fe >>> 8 & 255, $[38] = Fe >>> 16 & 255, $[39] = Fe >>> 24 & 255, $[40] = Ue >>> 0 & 255, $[41] = Ue >>> 8 & 255, $[42] = Ue >>> 16 & 255, $[43] = Ue >>> 24 & 255, $[44] = Je >>> 0 & 255, $[45] = Je >>> 8 & 255, $[46] = Je >>> 16 & 255, $[47] = Je >>> 24 & 255, $[48] = Lt >>> 0 & 255, $[49] = Lt >>> 8 & 255, $[50] = Lt >>> 16 & 255, $[51] = Lt >>> 24 & 255, $[52] = zt >>> 0 & 255, $[53] = zt >>> 8 & 255, $[54] = zt >>> 16 & 255, $[55] = zt >>> 24 & 255, $[56] = Zt >>> 0 & 255, $[57] = Zt >>> 8 & 255, $[58] = Zt >>> 16 & 255, $[59] = Zt >>> 24 & 255, $[60] = Wt >>> 0 & 255, $[61] = Wt >>> 8 & 255, $[62] = Wt >>> 16 & 255, $[63] = Wt >>> 24 & 255; - } - function W($, q, H, C) { - for (var G = C[0] & 255 | (C[1] & 255) << 8 | (C[2] & 255) << 16 | (C[3] & 255) << 24, j = H[0] & 255 | (H[1] & 255) << 8 | (H[2] & 255) << 16 | (H[3] & 255) << 24, se = H[4] & 255 | (H[5] & 255) << 8 | (H[6] & 255) << 16 | (H[7] & 255) << 24, de = H[8] & 255 | (H[9] & 255) << 8 | (H[10] & 255) << 16 | (H[11] & 255) << 24, xe = H[12] & 255 | (H[13] & 255) << 8 | (H[14] & 255) << 16 | (H[15] & 255) << 24, Te = C[4] & 255 | (C[5] & 255) << 8 | (C[6] & 255) << 16 | (C[7] & 255) << 24, Re = q[0] & 255 | (q[1] & 255) << 8 | (q[2] & 255) << 16 | (q[3] & 255) << 24, nt = q[4] & 255 | (q[5] & 255) << 8 | (q[6] & 255) << 16 | (q[7] & 255) << 24, je = q[8] & 255 | (q[9] & 255) << 8 | (q[10] & 255) << 16 | (q[11] & 255) << 24, pt = q[12] & 255 | (q[13] & 255) << 8 | (q[14] & 255) << 16 | (q[15] & 255) << 24, it = C[8] & 255 | (C[9] & 255) << 8 | (C[10] & 255) << 16 | (C[11] & 255) << 24, et = H[16] & 255 | (H[17] & 255) << 8 | (H[18] & 255) << 16 | (H[19] & 255) << 24, St = H[20] & 255 | (H[21] & 255) << 8 | (H[22] & 255) << 16 | (H[23] & 255) << 24, Tt = H[24] & 255 | (H[25] & 255) << 8 | (H[26] & 255) << 16 | (H[27] & 255) << 24, At = H[28] & 255 | (H[29] & 255) << 8 | (H[30] & 255) << 16 | (H[31] & 255) << 24, _t = C[12] & 255 | (C[13] & 255) << 8 | (C[14] & 255) << 16 | (C[15] & 255) << 24, ht = G, xt = j, st = se, yt = de, ut = xe, ot = Te, Se = Re, Ae = nt, Ve = je, Fe = pt, Ue = it, Je = et, Lt = St, zt = Tt, Zt = At, Wt = _t, he, rr = 0; rr < 20; rr += 2) - he = ht + Lt | 0, ut ^= he << 7 | he >>> 25, he = ut + ht | 0, Ve ^= he << 9 | he >>> 23, he = Ve + ut | 0, Lt ^= he << 13 | he >>> 19, he = Lt + Ve | 0, ht ^= he << 18 | he >>> 14, he = ot + xt | 0, Fe ^= he << 7 | he >>> 25, he = Fe + ot | 0, zt ^= he << 9 | he >>> 23, he = zt + Fe | 0, xt ^= he << 13 | he >>> 19, he = xt + zt | 0, ot ^= he << 18 | he >>> 14, he = Ue + Se | 0, Zt ^= he << 7 | he >>> 25, he = Zt + Ue | 0, st ^= he << 9 | he >>> 23, he = st + Zt | 0, Se ^= he << 13 | he >>> 19, he = Se + st | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Je | 0, yt ^= he << 7 | he >>> 25, he = yt + Wt | 0, Ae ^= he << 9 | he >>> 23, he = Ae + yt | 0, Je ^= he << 13 | he >>> 19, he = Je + Ae | 0, Wt ^= he << 18 | he >>> 14, he = ht + yt | 0, xt ^= he << 7 | he >>> 25, he = xt + ht | 0, st ^= he << 9 | he >>> 23, he = st + xt | 0, yt ^= he << 13 | he >>> 19, he = yt + st | 0, ht ^= he << 18 | he >>> 14, he = ot + ut | 0, Se ^= he << 7 | he >>> 25, he = Se + ot | 0, Ae ^= he << 9 | he >>> 23, he = Ae + Se | 0, ut ^= he << 13 | he >>> 19, he = ut + Ae | 0, ot ^= he << 18 | he >>> 14, he = Ue + Fe | 0, Je ^= he << 7 | he >>> 25, he = Je + Ue | 0, Ve ^= he << 9 | he >>> 23, he = Ve + Je | 0, Fe ^= he << 13 | he >>> 19, he = Fe + Ve | 0, Ue ^= he << 18 | he >>> 14, he = Wt + Zt | 0, Lt ^= he << 7 | he >>> 25, he = Lt + Wt | 0, zt ^= he << 9 | he >>> 23, he = zt + Lt | 0, Zt ^= he << 13 | he >>> 19, he = Zt + zt | 0, Wt ^= he << 18 | he >>> 14; - $[0] = ht >>> 0 & 255, $[1] = ht >>> 8 & 255, $[2] = ht >>> 16 & 255, $[3] = ht >>> 24 & 255, $[4] = ot >>> 0 & 255, $[5] = ot >>> 8 & 255, $[6] = ot >>> 16 & 255, $[7] = ot >>> 24 & 255, $[8] = Ue >>> 0 & 255, $[9] = Ue >>> 8 & 255, $[10] = Ue >>> 16 & 255, $[11] = Ue >>> 24 & 255, $[12] = Wt >>> 0 & 255, $[13] = Wt >>> 8 & 255, $[14] = Wt >>> 16 & 255, $[15] = Wt >>> 24 & 255, $[16] = Se >>> 0 & 255, $[17] = Se >>> 8 & 255, $[18] = Se >>> 16 & 255, $[19] = Se >>> 24 & 255, $[20] = Ae >>> 0 & 255, $[21] = Ae >>> 8 & 255, $[22] = Ae >>> 16 & 255, $[23] = Ae >>> 24 & 255, $[24] = Ve >>> 0 & 255, $[25] = Ve >>> 8 & 255, $[26] = Ve >>> 16 & 255, $[27] = Ve >>> 24 & 255, $[28] = Fe >>> 0 & 255, $[29] = Fe >>> 8 & 255, $[30] = Fe >>> 16 & 255, $[31] = Fe >>> 24 & 255; - } - function U($, q, H, C) { - k($, q, H, C); - } - function V($, q, H, C) { - W($, q, H, C); - } - var Q = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); - function R($, q, H, C, G, j, se) { - var de = new Uint8Array(16), xe = new Uint8Array(64), Te, Re; - for (Re = 0; Re < 16; Re++) de[Re] = 0; - for (Re = 0; Re < 8; Re++) de[Re] = j[Re]; - for (; G >= 64; ) { - for (U(xe, de, se, Q), Re = 0; Re < 64; Re++) $[q + Re] = H[C + Re] ^ xe[Re]; - for (Te = 1, Re = 8; Re < 16; Re++) - Te = Te + (de[Re] & 255) | 0, de[Re] = Te & 255, Te >>>= 8; - G -= 64, q += 64, C += 64; - } - if (G > 0) - for (U(xe, de, se, Q), Re = 0; Re < G; Re++) $[q + Re] = H[C + Re] ^ xe[Re]; - return 0; - } - function K($, q, H, C, G) { - var j = new Uint8Array(16), se = new Uint8Array(64), de, xe; - for (xe = 0; xe < 16; xe++) j[xe] = 0; - for (xe = 0; xe < 8; xe++) j[xe] = C[xe]; - for (; H >= 64; ) { - for (U(se, j, G, Q), xe = 0; xe < 64; xe++) $[q + xe] = se[xe]; - for (de = 1, xe = 8; xe < 16; xe++) - de = de + (j[xe] & 255) | 0, j[xe] = de & 255, de >>>= 8; - H -= 64, q += 64; - } - if (H > 0) - for (U(se, j, G, Q), xe = 0; xe < H; xe++) $[q + xe] = se[xe]; - return 0; - } - function ge($, q, H, C, G) { - var j = new Uint8Array(32); - V(j, C, G, Q); - for (var se = new Uint8Array(8), de = 0; de < 8; de++) se[de] = C[de + 16]; - return K($, q, H, se, j); - } - function Ee($, q, H, C, G, j, se) { - var de = new Uint8Array(32); - V(de, j, se, Q); - for (var xe = new Uint8Array(8), Te = 0; Te < 8; Te++) xe[Te] = j[Te + 16]; - return R($, q, H, C, G, xe, de); - } - var Y = function($) { - this.buffer = new Uint8Array(16), this.r = new Uint16Array(10), this.h = new Uint16Array(10), this.pad = new Uint16Array(8), this.leftover = 0, this.fin = 0; - var q, H, C, G, j, se, de, xe; - q = $[0] & 255 | ($[1] & 255) << 8, this.r[0] = q & 8191, H = $[2] & 255 | ($[3] & 255) << 8, this.r[1] = (q >>> 13 | H << 3) & 8191, C = $[4] & 255 | ($[5] & 255) << 8, this.r[2] = (H >>> 10 | C << 6) & 7939, G = $[6] & 255 | ($[7] & 255) << 8, this.r[3] = (C >>> 7 | G << 9) & 8191, j = $[8] & 255 | ($[9] & 255) << 8, this.r[4] = (G >>> 4 | j << 12) & 255, this.r[5] = j >>> 1 & 8190, se = $[10] & 255 | ($[11] & 255) << 8, this.r[6] = (j >>> 14 | se << 2) & 8191, de = $[12] & 255 | ($[13] & 255) << 8, this.r[7] = (se >>> 11 | de << 5) & 8065, xe = $[14] & 255 | ($[15] & 255) << 8, this.r[8] = (de >>> 8 | xe << 8) & 8191, this.r[9] = xe >>> 5 & 127, this.pad[0] = $[16] & 255 | ($[17] & 255) << 8, this.pad[1] = $[18] & 255 | ($[19] & 255) << 8, this.pad[2] = $[20] & 255 | ($[21] & 255) << 8, this.pad[3] = $[22] & 255 | ($[23] & 255) << 8, this.pad[4] = $[24] & 255 | ($[25] & 255) << 8, this.pad[5] = $[26] & 255 | ($[27] & 255) << 8, this.pad[6] = $[28] & 255 | ($[29] & 255) << 8, this.pad[7] = $[30] & 255 | ($[31] & 255) << 8; - }; - Y.prototype.blocks = function($, q, H) { - for (var C = this.fin ? 0 : 2048, G, j, se, de, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, yt = this.h[0], ut = this.h[1], ot = this.h[2], Se = this.h[3], Ae = this.h[4], Ve = this.h[5], Fe = this.h[6], Ue = this.h[7], Je = this.h[8], Lt = this.h[9], zt = this.r[0], Zt = this.r[1], Wt = this.r[2], he = this.r[3], rr = this.r[4], dr = this.r[5], pr = this.r[6], Qt = this.r[7], gr = this.r[8], lr = this.r[9]; H >= 16; ) - G = $[q + 0] & 255 | ($[q + 1] & 255) << 8, yt += G & 8191, j = $[q + 2] & 255 | ($[q + 3] & 255) << 8, ut += (G >>> 13 | j << 3) & 8191, se = $[q + 4] & 255 | ($[q + 5] & 255) << 8, ot += (j >>> 10 | se << 6) & 8191, de = $[q + 6] & 255 | ($[q + 7] & 255) << 8, Se += (se >>> 7 | de << 9) & 8191, xe = $[q + 8] & 255 | ($[q + 9] & 255) << 8, Ae += (de >>> 4 | xe << 12) & 8191, Ve += xe >>> 1 & 8191, Te = $[q + 10] & 255 | ($[q + 11] & 255) << 8, Fe += (xe >>> 14 | Te << 2) & 8191, Re = $[q + 12] & 255 | ($[q + 13] & 255) << 8, Ue += (Te >>> 11 | Re << 5) & 8191, nt = $[q + 14] & 255 | ($[q + 15] & 255) << 8, Je += (Re >>> 8 | nt << 8) & 8191, Lt += nt >>> 5 | C, je = 0, pt = je, pt += yt * zt, pt += ut * (5 * lr), pt += ot * (5 * gr), pt += Se * (5 * Qt), pt += Ae * (5 * pr), je = pt >>> 13, pt &= 8191, pt += Ve * (5 * dr), pt += Fe * (5 * rr), pt += Ue * (5 * he), pt += Je * (5 * Wt), pt += Lt * (5 * Zt), je += pt >>> 13, pt &= 8191, it = je, it += yt * Zt, it += ut * zt, it += ot * (5 * lr), it += Se * (5 * gr), it += Ae * (5 * Qt), je = it >>> 13, it &= 8191, it += Ve * (5 * pr), it += Fe * (5 * dr), it += Ue * (5 * rr), it += Je * (5 * he), it += Lt * (5 * Wt), je += it >>> 13, it &= 8191, et = je, et += yt * Wt, et += ut * Zt, et += ot * zt, et += Se * (5 * lr), et += Ae * (5 * gr), je = et >>> 13, et &= 8191, et += Ve * (5 * Qt), et += Fe * (5 * pr), et += Ue * (5 * dr), et += Je * (5 * rr), et += Lt * (5 * he), je += et >>> 13, et &= 8191, St = je, St += yt * he, St += ut * Wt, St += ot * Zt, St += Se * zt, St += Ae * (5 * lr), je = St >>> 13, St &= 8191, St += Ve * (5 * gr), St += Fe * (5 * Qt), St += Ue * (5 * pr), St += Je * (5 * dr), St += Lt * (5 * rr), je += St >>> 13, St &= 8191, Tt = je, Tt += yt * rr, Tt += ut * he, Tt += ot * Wt, Tt += Se * Zt, Tt += Ae * zt, je = Tt >>> 13, Tt &= 8191, Tt += Ve * (5 * lr), Tt += Fe * (5 * gr), Tt += Ue * (5 * Qt), Tt += Je * (5 * pr), Tt += Lt * (5 * dr), je += Tt >>> 13, Tt &= 8191, At = je, At += yt * dr, At += ut * rr, At += ot * he, At += Se * Wt, At += Ae * Zt, je = At >>> 13, At &= 8191, At += Ve * zt, At += Fe * (5 * lr), At += Ue * (5 * gr), At += Je * (5 * Qt), At += Lt * (5 * pr), je += At >>> 13, At &= 8191, _t = je, _t += yt * pr, _t += ut * dr, _t += ot * rr, _t += Se * he, _t += Ae * Wt, je = _t >>> 13, _t &= 8191, _t += Ve * Zt, _t += Fe * zt, _t += Ue * (5 * lr), _t += Je * (5 * gr), _t += Lt * (5 * Qt), je += _t >>> 13, _t &= 8191, ht = je, ht += yt * Qt, ht += ut * pr, ht += ot * dr, ht += Se * rr, ht += Ae * he, je = ht >>> 13, ht &= 8191, ht += Ve * Wt, ht += Fe * Zt, ht += Ue * zt, ht += Je * (5 * lr), ht += Lt * (5 * gr), je += ht >>> 13, ht &= 8191, xt = je, xt += yt * gr, xt += ut * Qt, xt += ot * pr, xt += Se * dr, xt += Ae * rr, je = xt >>> 13, xt &= 8191, xt += Ve * he, xt += Fe * Wt, xt += Ue * Zt, xt += Je * zt, xt += Lt * (5 * lr), je += xt >>> 13, xt &= 8191, st = je, st += yt * lr, st += ut * gr, st += ot * Qt, st += Se * pr, st += Ae * dr, je = st >>> 13, st &= 8191, st += Ve * rr, st += Fe * he, st += Ue * Wt, st += Je * Zt, st += Lt * zt, je += st >>> 13, st &= 8191, je = (je << 2) + je | 0, je = je + pt | 0, pt = je & 8191, je = je >>> 13, it += je, yt = pt, ut = it, ot = et, Se = St, Ae = Tt, Ve = At, Fe = _t, Ue = ht, Je = xt, Lt = st, q += 16, H -= 16; - this.h[0] = yt, this.h[1] = ut, this.h[2] = ot, this.h[3] = Se, this.h[4] = Ae, this.h[5] = Ve, this.h[6] = Fe, this.h[7] = Ue, this.h[8] = Je, this.h[9] = Lt; - }, Y.prototype.finish = function($, q) { - var H = new Uint16Array(10), C, G, j, se; - if (this.leftover) { - for (se = this.leftover, this.buffer[se++] = 1; se < 16; se++) this.buffer[se] = 0; - this.fin = 1, this.blocks(this.buffer, 0, 16); - } - for (C = this.h[1] >>> 13, this.h[1] &= 8191, se = 2; se < 10; se++) - this.h[se] += C, C = this.h[se] >>> 13, this.h[se] &= 8191; - for (this.h[0] += C * 5, C = this.h[0] >>> 13, this.h[0] &= 8191, this.h[1] += C, C = this.h[1] >>> 13, this.h[1] &= 8191, this.h[2] += C, H[0] = this.h[0] + 5, C = H[0] >>> 13, H[0] &= 8191, se = 1; se < 10; se++) - H[se] = this.h[se] + C, C = H[se] >>> 13, H[se] &= 8191; - for (H[9] -= 8192, G = (C ^ 1) - 1, se = 0; se < 10; se++) H[se] &= G; - for (G = ~G, se = 0; se < 10; se++) this.h[se] = this.h[se] & G | H[se]; - for (this.h[0] = (this.h[0] | this.h[1] << 13) & 65535, this.h[1] = (this.h[1] >>> 3 | this.h[2] << 10) & 65535, this.h[2] = (this.h[2] >>> 6 | this.h[3] << 7) & 65535, this.h[3] = (this.h[3] >>> 9 | this.h[4] << 4) & 65535, this.h[4] = (this.h[4] >>> 12 | this.h[5] << 1 | this.h[6] << 14) & 65535, this.h[5] = (this.h[6] >>> 2 | this.h[7] << 11) & 65535, this.h[6] = (this.h[7] >>> 5 | this.h[8] << 8) & 65535, this.h[7] = (this.h[8] >>> 8 | this.h[9] << 5) & 65535, j = this.h[0] + this.pad[0], this.h[0] = j & 65535, se = 1; se < 8; se++) - j = (this.h[se] + this.pad[se] | 0) + (j >>> 16) | 0, this.h[se] = j & 65535; - $[q + 0] = this.h[0] >>> 0 & 255, $[q + 1] = this.h[0] >>> 8 & 255, $[q + 2] = this.h[1] >>> 0 & 255, $[q + 3] = this.h[1] >>> 8 & 255, $[q + 4] = this.h[2] >>> 0 & 255, $[q + 5] = this.h[2] >>> 8 & 255, $[q + 6] = this.h[3] >>> 0 & 255, $[q + 7] = this.h[3] >>> 8 & 255, $[q + 8] = this.h[4] >>> 0 & 255, $[q + 9] = this.h[4] >>> 8 & 255, $[q + 10] = this.h[5] >>> 0 & 255, $[q + 11] = this.h[5] >>> 8 & 255, $[q + 12] = this.h[6] >>> 0 & 255, $[q + 13] = this.h[6] >>> 8 & 255, $[q + 14] = this.h[7] >>> 0 & 255, $[q + 15] = this.h[7] >>> 8 & 255; - }, Y.prototype.update = function($, q, H) { - var C, G; - if (this.leftover) { - for (G = 16 - this.leftover, G > H && (G = H), C = 0; C < G; C++) - this.buffer[this.leftover + C] = $[q + C]; - if (H -= G, q += G, this.leftover += G, this.leftover < 16) - return; - this.blocks(this.buffer, 0, 16), this.leftover = 0; - } - if (H >= 16 && (G = H - H % 16, this.blocks($, q, G), q += G, H -= G), H) { - for (C = 0; C < H; C++) - this.buffer[this.leftover + C] = $[q + C]; - this.leftover += H; - } - }; - function A($, q, H, C, G, j) { - var se = new Y(j); - return se.update(H, C, G), se.finish($, q), 0; - } - function m($, q, H, C, G, j) { - var se = new Uint8Array(16); - return A(se, 0, H, C, G, j), L($, q, se, 0); - } - function f($, q, H, C, G) { - var j; - if (H < 32) return -1; - for (Ee($, 0, q, 0, H, C, G), A($, 16, $, 32, H - 32, $), j = 0; j < 16; j++) $[j] = 0; - return 0; - } - function g($, q, H, C, G) { - var j, se = new Uint8Array(32); - if (H < 32 || (ge(se, 0, 32, C, G), m(q, 16, q, 32, H - 32, se) !== 0)) return -1; - for (Ee($, 0, q, 0, H, C, G), j = 0; j < 32; j++) $[j] = 0; - return 0; - } - function b($, q) { - var H; - for (H = 0; H < 16; H++) $[H] = q[H] | 0; - } - function x($) { - var q, H, C = 1; - for (q = 0; q < 16; q++) - H = $[q] + C + 65535, C = Math.floor(H / 65536), $[q] = H - C * 65536; - $[0] += C - 1 + 37 * (C - 1); - } - function E($, q, H) { - for (var C, G = ~(H - 1), j = 0; j < 16; j++) - C = G & ($[j] ^ q[j]), $[j] ^= C, q[j] ^= C; - } - function S($, q) { - var H, C, G, j = r(), se = r(); - for (H = 0; H < 16; H++) se[H] = q[H]; - for (x(se), x(se), x(se), C = 0; C < 2; C++) { - for (j[0] = se[0] - 65517, H = 1; H < 15; H++) - j[H] = se[H] - 65535 - (j[H - 1] >> 16 & 1), j[H - 1] &= 65535; - j[15] = se[15] - 32767 - (j[14] >> 16 & 1), G = j[15] >> 16 & 1, j[14] &= 65535, E(se, j, 1 - G); - } - for (H = 0; H < 16; H++) - $[2 * H] = se[H] & 255, $[2 * H + 1] = se[H] >> 8; - } - function v($, q) { - var H = new Uint8Array(32), C = new Uint8Array(32); - return S(H, $), S(C, q), B(H, 0, C, 0); - } - function M($) { - var q = new Uint8Array(32); - return S(q, $), q[0] & 1; - } - function I($, q) { - var H; - for (H = 0; H < 16; H++) $[H] = q[2 * H] + (q[2 * H + 1] << 8); - $[15] &= 32767; - } - function F($, q, H) { - for (var C = 0; C < 16; C++) $[C] = q[C] + H[C]; - } - function ce($, q, H) { - for (var C = 0; C < 16; C++) $[C] = q[C] - H[C]; - } - function D($, q, H) { - var C, G, j = 0, se = 0, de = 0, xe = 0, Te = 0, Re = 0, nt = 0, je = 0, pt = 0, it = 0, et = 0, St = 0, Tt = 0, At = 0, _t = 0, ht = 0, xt = 0, st = 0, yt = 0, ut = 0, ot = 0, Se = 0, Ae = 0, Ve = 0, Fe = 0, Ue = 0, Je = 0, Lt = 0, zt = 0, Zt = 0, Wt = 0, he = H[0], rr = H[1], dr = H[2], pr = H[3], Qt = H[4], gr = H[5], lr = H[6], Rr = H[7], mr = H[8], wr = H[9], $r = H[10], Br = H[11], Ir = H[12], nn = H[13], sn = H[14], on = H[15]; - C = q[0], j += C * he, se += C * rr, de += C * dr, xe += C * pr, Te += C * Qt, Re += C * gr, nt += C * lr, je += C * Rr, pt += C * mr, it += C * wr, et += C * $r, St += C * Br, Tt += C * Ir, At += C * nn, _t += C * sn, ht += C * on, C = q[1], se += C * he, de += C * rr, xe += C * dr, Te += C * pr, Re += C * Qt, nt += C * gr, je += C * lr, pt += C * Rr, it += C * mr, et += C * wr, St += C * $r, Tt += C * Br, At += C * Ir, _t += C * nn, ht += C * sn, xt += C * on, C = q[2], de += C * he, xe += C * rr, Te += C * dr, Re += C * pr, nt += C * Qt, je += C * gr, pt += C * lr, it += C * Rr, et += C * mr, St += C * wr, Tt += C * $r, At += C * Br, _t += C * Ir, ht += C * nn, xt += C * sn, st += C * on, C = q[3], xe += C * he, Te += C * rr, Re += C * dr, nt += C * pr, je += C * Qt, pt += C * gr, it += C * lr, et += C * Rr, St += C * mr, Tt += C * wr, At += C * $r, _t += C * Br, ht += C * Ir, xt += C * nn, st += C * sn, yt += C * on, C = q[4], Te += C * he, Re += C * rr, nt += C * dr, je += C * pr, pt += C * Qt, it += C * gr, et += C * lr, St += C * Rr, Tt += C * mr, At += C * wr, _t += C * $r, ht += C * Br, xt += C * Ir, st += C * nn, yt += C * sn, ut += C * on, C = q[5], Re += C * he, nt += C * rr, je += C * dr, pt += C * pr, it += C * Qt, et += C * gr, St += C * lr, Tt += C * Rr, At += C * mr, _t += C * wr, ht += C * $r, xt += C * Br, st += C * Ir, yt += C * nn, ut += C * sn, ot += C * on, C = q[6], nt += C * he, je += C * rr, pt += C * dr, it += C * pr, et += C * Qt, St += C * gr, Tt += C * lr, At += C * Rr, _t += C * mr, ht += C * wr, xt += C * $r, st += C * Br, yt += C * Ir, ut += C * nn, ot += C * sn, Se += C * on, C = q[7], je += C * he, pt += C * rr, it += C * dr, et += C * pr, St += C * Qt, Tt += C * gr, At += C * lr, _t += C * Rr, ht += C * mr, xt += C * wr, st += C * $r, yt += C * Br, ut += C * Ir, ot += C * nn, Se += C * sn, Ae += C * on, C = q[8], pt += C * he, it += C * rr, et += C * dr, St += C * pr, Tt += C * Qt, At += C * gr, _t += C * lr, ht += C * Rr, xt += C * mr, st += C * wr, yt += C * $r, ut += C * Br, ot += C * Ir, Se += C * nn, Ae += C * sn, Ve += C * on, C = q[9], it += C * he, et += C * rr, St += C * dr, Tt += C * pr, At += C * Qt, _t += C * gr, ht += C * lr, xt += C * Rr, st += C * mr, yt += C * wr, ut += C * $r, ot += C * Br, Se += C * Ir, Ae += C * nn, Ve += C * sn, Fe += C * on, C = q[10], et += C * he, St += C * rr, Tt += C * dr, At += C * pr, _t += C * Qt, ht += C * gr, xt += C * lr, st += C * Rr, yt += C * mr, ut += C * wr, ot += C * $r, Se += C * Br, Ae += C * Ir, Ve += C * nn, Fe += C * sn, Ue += C * on, C = q[11], St += C * he, Tt += C * rr, At += C * dr, _t += C * pr, ht += C * Qt, xt += C * gr, st += C * lr, yt += C * Rr, ut += C * mr, ot += C * wr, Se += C * $r, Ae += C * Br, Ve += C * Ir, Fe += C * nn, Ue += C * sn, Je += C * on, C = q[12], Tt += C * he, At += C * rr, _t += C * dr, ht += C * pr, xt += C * Qt, st += C * gr, yt += C * lr, ut += C * Rr, ot += C * mr, Se += C * wr, Ae += C * $r, Ve += C * Br, Fe += C * Ir, Ue += C * nn, Je += C * sn, Lt += C * on, C = q[13], At += C * he, _t += C * rr, ht += C * dr, xt += C * pr, st += C * Qt, yt += C * gr, ut += C * lr, ot += C * Rr, Se += C * mr, Ae += C * wr, Ve += C * $r, Fe += C * Br, Ue += C * Ir, Je += C * nn, Lt += C * sn, zt += C * on, C = q[14], _t += C * he, ht += C * rr, xt += C * dr, st += C * pr, yt += C * Qt, ut += C * gr, ot += C * lr, Se += C * Rr, Ae += C * mr, Ve += C * wr, Fe += C * $r, Ue += C * Br, Je += C * Ir, Lt += C * nn, zt += C * sn, Zt += C * on, C = q[15], ht += C * he, xt += C * rr, st += C * dr, yt += C * pr, ut += C * Qt, ot += C * gr, Se += C * lr, Ae += C * Rr, Ve += C * mr, Fe += C * wr, Ue += C * $r, Je += C * Br, Lt += C * Ir, zt += C * nn, Zt += C * sn, Wt += C * on, j += 38 * xt, se += 38 * st, de += 38 * yt, xe += 38 * ut, Te += 38 * ot, Re += 38 * Se, nt += 38 * Ae, je += 38 * Ve, pt += 38 * Fe, it += 38 * Ue, et += 38 * Je, St += 38 * Lt, Tt += 38 * zt, At += 38 * Zt, _t += 38 * Wt, G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = de + G + 65535, G = Math.floor(C / 65536), de = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), G = 1, C = j + G + 65535, G = Math.floor(C / 65536), j = C - G * 65536, C = se + G + 65535, G = Math.floor(C / 65536), se = C - G * 65536, C = de + G + 65535, G = Math.floor(C / 65536), de = C - G * 65536, C = xe + G + 65535, G = Math.floor(C / 65536), xe = C - G * 65536, C = Te + G + 65535, G = Math.floor(C / 65536), Te = C - G * 65536, C = Re + G + 65535, G = Math.floor(C / 65536), Re = C - G * 65536, C = nt + G + 65535, G = Math.floor(C / 65536), nt = C - G * 65536, C = je + G + 65535, G = Math.floor(C / 65536), je = C - G * 65536, C = pt + G + 65535, G = Math.floor(C / 65536), pt = C - G * 65536, C = it + G + 65535, G = Math.floor(C / 65536), it = C - G * 65536, C = et + G + 65535, G = Math.floor(C / 65536), et = C - G * 65536, C = St + G + 65535, G = Math.floor(C / 65536), St = C - G * 65536, C = Tt + G + 65535, G = Math.floor(C / 65536), Tt = C - G * 65536, C = At + G + 65535, G = Math.floor(C / 65536), At = C - G * 65536, C = _t + G + 65535, G = Math.floor(C / 65536), _t = C - G * 65536, C = ht + G + 65535, G = Math.floor(C / 65536), ht = C - G * 65536, j += G - 1 + 37 * (G - 1), $[0] = j, $[1] = se, $[2] = de, $[3] = xe, $[4] = Te, $[5] = Re, $[6] = nt, $[7] = je, $[8] = pt, $[9] = it, $[10] = et, $[11] = St, $[12] = Tt, $[13] = At, $[14] = _t, $[15] = ht; - } - function oe($, q) { - D($, q, q); - } - function Z($, q) { - var H = r(), C; - for (C = 0; C < 16; C++) H[C] = q[C]; - for (C = 253; C >= 0; C--) - oe(H, H), C !== 2 && C !== 4 && D(H, H, q); - for (C = 0; C < 16; C++) $[C] = H[C]; - } - function J($, q) { - var H = r(), C; - for (C = 0; C < 16; C++) H[C] = q[C]; - for (C = 250; C >= 0; C--) - oe(H, H), C !== 1 && D(H, H, q); - for (C = 0; C < 16; C++) $[C] = H[C]; - } - function ee($, q, H) { - var C = new Uint8Array(32), G = new Float64Array(80), j, se, de = r(), xe = r(), Te = r(), Re = r(), nt = r(), je = r(); - for (se = 0; se < 31; se++) C[se] = q[se]; - for (C[31] = q[31] & 127 | 64, C[0] &= 248, I(G, H), se = 0; se < 16; se++) - xe[se] = G[se], Re[se] = de[se] = Te[se] = 0; - for (de[0] = Re[0] = 1, se = 254; se >= 0; --se) - j = C[se >>> 3] >>> (se & 7) & 1, E(de, xe, j), E(Te, Re, j), F(nt, de, Te), ce(de, de, Te), F(Te, xe, Re), ce(xe, xe, Re), oe(Re, nt), oe(je, de), D(de, Te, de), D(Te, xe, nt), F(nt, de, Te), ce(de, de, Te), oe(xe, de), ce(Te, Re, je), D(de, Te, u), F(de, de, Re), D(Te, Te, de), D(de, Re, je), D(Re, xe, G), oe(xe, nt), E(de, xe, j), E(Te, Re, j); - for (se = 0; se < 16; se++) - G[se + 16] = de[se], G[se + 32] = Te[se], G[se + 48] = xe[se], G[se + 64] = Re[se]; - var pt = G.subarray(32), it = G.subarray(16); - return Z(pt, pt), D(it, it, pt), S($, it), 0; - } - function T($, q) { - return ee($, q, s); - } - function X($, q) { - return n(q, 32), T($, q); - } - function re($, q, H) { - var C = new Uint8Array(32); - return ee(C, H, q), V($, i, C, Q); - } - var pe = f, ie = g; - function ue($, q, H, C, G, j) { - var se = new Uint8Array(32); - return re(se, G, j), pe($, q, H, C, se); - } - function ve($, q, H, C, G, j) { - var se = new Uint8Array(32); - return re(se, G, j), ie($, q, H, C, se); - } - var Pe = [ - 1116352408, - 3609767458, - 1899447441, - 602891725, - 3049323471, - 3964484399, - 3921009573, - 2173295548, - 961987163, - 4081628472, - 1508970993, - 3053834265, - 2453635748, - 2937671579, - 2870763221, - 3664609560, - 3624381080, - 2734883394, - 310598401, - 1164996542, - 607225278, - 1323610764, - 1426881987, - 3590304994, - 1925078388, - 4068182383, - 2162078206, - 991336113, - 2614888103, - 633803317, - 3248222580, - 3479774868, - 3835390401, - 2666613458, - 4022224774, - 944711139, - 264347078, - 2341262773, - 604807628, - 2007800933, - 770255983, - 1495990901, - 1249150122, - 1856431235, - 1555081692, - 3175218132, - 1996064986, - 2198950837, - 2554220882, - 3999719339, - 2821834349, - 766784016, - 2952996808, - 2566594879, - 3210313671, - 3203337956, - 3336571891, - 1034457026, - 3584528711, - 2466948901, - 113926993, - 3758326383, - 338241895, - 168717936, - 666307205, - 1188179964, - 773529912, - 1546045734, - 1294757372, - 1522805485, - 1396182291, - 2643833823, - 1695183700, - 2343527390, - 1986661051, - 1014477480, - 2177026350, - 1206759142, - 2456956037, - 344077627, - 2730485921, - 1290863460, - 2820302411, - 3158454273, - 3259730800, - 3505952657, - 3345764771, - 106217008, - 3516065817, - 3606008344, - 3600352804, - 1432725776, - 4094571909, - 1467031594, - 275423344, - 851169720, - 430227734, - 3100823752, - 506948616, - 1363258195, - 659060556, - 3750685593, - 883997877, - 3785050280, - 958139571, - 3318307427, - 1322822218, - 3812723403, - 1537002063, - 2003034995, - 1747873779, - 3602036899, - 1955562222, - 1575990012, - 2024104815, - 1125592928, - 2227730452, - 2716904306, - 2361852424, - 442776044, - 2428436474, - 593698344, - 2756734187, - 3733110249, - 3204031479, - 2999351573, - 3329325298, - 3815920427, - 3391569614, - 3928383900, - 3515267271, - 566280711, - 3940187606, - 3454069534, - 4118630271, - 4000239992, - 116418474, - 1914138554, - 174292421, - 2731055270, - 289380356, - 3203993006, - 460393269, - 320620315, - 685471733, - 587496836, - 852142971, - 1086792851, - 1017036298, - 365543100, - 1126000580, - 2618297676, - 1288033470, - 3409855158, - 1501505948, - 4234509866, - 1607167915, - 987167468, - 1816402316, - 1246189591 - ]; - function De($, q, H, C) { - for (var G = new Int32Array(16), j = new Int32Array(16), se, de, xe, Te, Re, nt, je, pt, it, et, St, Tt, At, _t, ht, xt, st, yt, ut, ot, Se, Ae, Ve, Fe, Ue, Je, Lt = $[0], zt = $[1], Zt = $[2], Wt = $[3], he = $[4], rr = $[5], dr = $[6], pr = $[7], Qt = q[0], gr = q[1], lr = q[2], Rr = q[3], mr = q[4], wr = q[5], $r = q[6], Br = q[7], Ir = 0; C >= 128; ) { - for (ut = 0; ut < 16; ut++) - ot = 8 * ut + Ir, G[ut] = H[ot + 0] << 24 | H[ot + 1] << 16 | H[ot + 2] << 8 | H[ot + 3], j[ut] = H[ot + 4] << 24 | H[ot + 5] << 16 | H[ot + 6] << 8 | H[ot + 7]; - for (ut = 0; ut < 80; ut++) - if (se = Lt, de = zt, xe = Zt, Te = Wt, Re = he, nt = rr, je = dr, pt = pr, it = Qt, et = gr, St = lr, Tt = Rr, At = mr, _t = wr, ht = $r, xt = Br, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (he >>> 14 | mr << 18) ^ (he >>> 18 | mr << 14) ^ (mr >>> 9 | he << 23), Ae = (mr >>> 14 | he << 18) ^ (mr >>> 18 | he << 14) ^ (he >>> 9 | mr << 23), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = he & rr ^ ~he & dr, Ae = mr & wr ^ ~mr & $r, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Pe[ut * 2], Ae = Pe[ut * 2 + 1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = G[ut % 16], Ae = j[ut % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, st = Ue & 65535 | Je << 16, yt = Ve & 65535 | Fe << 16, Se = st, Ae = yt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = (Lt >>> 28 | Qt << 4) ^ (Qt >>> 2 | Lt << 30) ^ (Qt >>> 7 | Lt << 25), Ae = (Qt >>> 28 | Lt << 4) ^ (Lt >>> 2 | Qt << 30) ^ (Lt >>> 7 | Qt << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Se = Lt & zt ^ Lt & Zt ^ zt & Zt, Ae = Qt & gr ^ Qt & lr ^ gr & lr, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, pt = Ue & 65535 | Je << 16, xt = Ve & 65535 | Fe << 16, Se = Te, Ae = Tt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = st, Ae = yt, Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, Te = Ue & 65535 | Je << 16, Tt = Ve & 65535 | Fe << 16, zt = se, Zt = de, Wt = xe, he = Te, rr = Re, dr = nt, pr = je, Lt = pt, gr = it, lr = et, Rr = St, mr = Tt, wr = At, $r = _t, Br = ht, Qt = xt, ut % 16 === 15) - for (ot = 0; ot < 16; ot++) - Se = G[ot], Ae = j[ot], Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = G[(ot + 9) % 16], Ae = j[(ot + 9) % 16], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, st = G[(ot + 1) % 16], yt = j[(ot + 1) % 16], Se = (st >>> 1 | yt << 31) ^ (st >>> 8 | yt << 24) ^ st >>> 7, Ae = (yt >>> 1 | st << 31) ^ (yt >>> 8 | st << 24) ^ (yt >>> 7 | st << 25), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, st = G[(ot + 14) % 16], yt = j[(ot + 14) % 16], Se = (st >>> 19 | yt << 13) ^ (yt >>> 29 | st << 3) ^ st >>> 6, Ae = (yt >>> 19 | st << 13) ^ (st >>> 29 | yt << 3) ^ (yt >>> 6 | st << 26), Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, G[ot] = Ue & 65535 | Je << 16, j[ot] = Ve & 65535 | Fe << 16; - Se = Lt, Ae = Qt, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[0], Ae = q[0], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[0] = Lt = Ue & 65535 | Je << 16, q[0] = Qt = Ve & 65535 | Fe << 16, Se = zt, Ae = gr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[1], Ae = q[1], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[1] = zt = Ue & 65535 | Je << 16, q[1] = gr = Ve & 65535 | Fe << 16, Se = Zt, Ae = lr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[2], Ae = q[2], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[2] = Zt = Ue & 65535 | Je << 16, q[2] = lr = Ve & 65535 | Fe << 16, Se = Wt, Ae = Rr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[3], Ae = q[3], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[3] = Wt = Ue & 65535 | Je << 16, q[3] = Rr = Ve & 65535 | Fe << 16, Se = he, Ae = mr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[4], Ae = q[4], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[4] = he = Ue & 65535 | Je << 16, q[4] = mr = Ve & 65535 | Fe << 16, Se = rr, Ae = wr, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[5], Ae = q[5], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[5] = rr = Ue & 65535 | Je << 16, q[5] = wr = Ve & 65535 | Fe << 16, Se = dr, Ae = $r, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[6], Ae = q[6], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[6] = dr = Ue & 65535 | Je << 16, q[6] = $r = Ve & 65535 | Fe << 16, Se = pr, Ae = Br, Ve = Ae & 65535, Fe = Ae >>> 16, Ue = Se & 65535, Je = Se >>> 16, Se = $[7], Ae = q[7], Ve += Ae & 65535, Fe += Ae >>> 16, Ue += Se & 65535, Je += Se >>> 16, Fe += Ve >>> 16, Ue += Fe >>> 16, Je += Ue >>> 16, $[7] = pr = Ue & 65535 | Je << 16, q[7] = Br = Ve & 65535 | Fe << 16, Ir += 128, C -= 128; - } - return C; - } - function Ce($, q, H) { - var C = new Int32Array(8), G = new Int32Array(8), j = new Uint8Array(256), se, de = H; - for (C[0] = 1779033703, C[1] = 3144134277, C[2] = 1013904242, C[3] = 2773480762, C[4] = 1359893119, C[5] = 2600822924, C[6] = 528734635, C[7] = 1541459225, G[0] = 4089235720, G[1] = 2227873595, G[2] = 4271175723, G[3] = 1595750129, G[4] = 2917565137, G[5] = 725511199, G[6] = 4215389547, G[7] = 327033209, De(C, G, q, H), H %= 128, se = 0; se < H; se++) j[se] = q[de - H + se]; - for (j[H] = 128, H = 256 - 128 * (H < 112 ? 1 : 0), j[H - 9] = 0, P(j, H - 8, de / 536870912 | 0, de << 3), De(C, G, j, H), se = 0; se < 8; se++) P($, 8 * se, C[se], G[se]); - return 0; - } - function $e($, q) { - var H = r(), C = r(), G = r(), j = r(), se = r(), de = r(), xe = r(), Te = r(), Re = r(); - ce(H, $[1], $[0]), ce(Re, q[1], q[0]), D(H, H, Re), F(C, $[0], $[1]), F(Re, q[0], q[1]), D(C, C, Re), D(G, $[3], q[3]), D(G, G, d), D(j, $[2], q[2]), F(j, j, j), ce(se, C, H), ce(de, j, G), F(xe, j, G), F(Te, C, H), D($[0], se, de), D($[1], Te, xe), D($[2], xe, de), D($[3], se, Te); - } - function Me($, q, H) { - var C; - for (C = 0; C < 4; C++) - E($[C], q[C], H); - } - function Ne($, q) { - var H = r(), C = r(), G = r(); - Z(G, q[2]), D(H, q[0], G), D(C, q[1], G), S($, C), $[31] ^= M(H) << 7; - } - function Ke($, q, H) { - var C, G; - for (b($[0], o), b($[1], a), b($[2], a), b($[3], o), G = 255; G >= 0; --G) - C = H[G / 8 | 0] >> (G & 7) & 1, Me($, q, C), $e(q, $), $e($, $), Me($, q, C); - } - function Le($, q) { - var H = [r(), r(), r(), r()]; - b(H[0], p), b(H[1], w), b(H[2], a), D(H[3], p, w), Ke($, H, q); - } - function qe($, q, H) { - var C = new Uint8Array(64), G = [r(), r(), r(), r()], j; - for (H || n(q, 32), Ce(C, q, 32), C[0] &= 248, C[31] &= 127, C[31] |= 64, Le(G, C), Ne($, G), j = 0; j < 32; j++) q[j + 32] = $[j]; - return 0; - } - var ze = new Float64Array([237, 211, 245, 92, 26, 99, 18, 88, 214, 156, 247, 162, 222, 249, 222, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16]); - function _e($, q) { - var H, C, G, j; - for (C = 63; C >= 32; --C) { - for (H = 0, G = C - 32, j = C - 12; G < j; ++G) - q[G] += H - 16 * q[C] * ze[G - (C - 32)], H = Math.floor((q[G] + 128) / 256), q[G] -= H * 256; - q[G] += H, q[C] = 0; - } - for (H = 0, G = 0; G < 32; G++) - q[G] += H - (q[31] >> 4) * ze[G], H = q[G] >> 8, q[G] &= 255; - for (G = 0; G < 32; G++) q[G] -= H * ze[G]; - for (C = 0; C < 32; C++) - q[C + 1] += q[C] >> 8, $[C] = q[C] & 255; - } - function Ze($) { - var q = new Float64Array(64), H; - for (H = 0; H < 64; H++) q[H] = $[H]; - for (H = 0; H < 64; H++) $[H] = 0; - _e($, q); - } - function at($, q, H, C) { - var G = new Uint8Array(64), j = new Uint8Array(64), se = new Uint8Array(64), de, xe, Te = new Float64Array(64), Re = [r(), r(), r(), r()]; - Ce(G, C, 32), G[0] &= 248, G[31] &= 127, G[31] |= 64; - var nt = H + 64; - for (de = 0; de < H; de++) $[64 + de] = q[de]; - for (de = 0; de < 32; de++) $[32 + de] = G[32 + de]; - for (Ce(se, $.subarray(32), H + 32), Ze(se), Le(Re, se), Ne($, Re), de = 32; de < 64; de++) $[de] = C[de]; - for (Ce(j, $, H + 64), Ze(j), de = 0; de < 64; de++) Te[de] = 0; - for (de = 0; de < 32; de++) Te[de] = se[de]; - for (de = 0; de < 32; de++) - for (xe = 0; xe < 32; xe++) - Te[de + xe] += j[de] * G[xe]; - return _e($.subarray(32), Te), nt; - } - function ke($, q) { - var H = r(), C = r(), G = r(), j = r(), se = r(), de = r(), xe = r(); - return b($[2], a), I($[1], q), oe(G, $[1]), D(j, G, l), ce(G, G, $[2]), F(j, $[2], j), oe(se, j), oe(de, se), D(xe, de, se), D(H, xe, G), D(H, H, j), J(H, H), D(H, H, G), D(H, H, j), D(H, H, j), D($[0], H, j), oe(C, $[0]), D(C, C, j), v(C, G) && D($[0], $[0], _), oe(C, $[0]), D(C, C, j), v(C, G) ? -1 : (M($[0]) === q[31] >> 7 && ce($[0], o, $[0]), D($[3], $[0], $[1]), 0); - } - function Qe($, q, H, C) { - var G, j = new Uint8Array(32), se = new Uint8Array(64), de = [r(), r(), r(), r()], xe = [r(), r(), r(), r()]; - if (H < 64 || ke(xe, C)) return -1; - for (G = 0; G < H; G++) $[G] = q[G]; - for (G = 0; G < 32; G++) $[G + 32] = C[G]; - if (Ce(se, $, H), Ze(se), Ke(de, xe, se), Le(xe, q.subarray(32)), $e(de, xe), Ne(j, de), H -= 64, B(q, 0, j, 0)) { - for (G = 0; G < H; G++) $[G] = 0; - return -1; - } - for (G = 0; G < H; G++) $[G] = q[G + 64]; - return H; - } - var tt = 32, Ye = 24, dt = 32, lt = 16, ct = 32, qt = 32, Jt = 32, Et = 32, er = 32, Xt = Ye, Dt = dt, kt = lt, Ct = 64, mt = 32, Rt = 64, Nt = 32, bt = 64; - e.lowlevel = { - crypto_core_hsalsa20: V, - crypto_stream_xor: Ee, - crypto_stream: ge, - crypto_stream_salsa20_xor: R, - crypto_stream_salsa20: K, - crypto_onetimeauth: A, - crypto_onetimeauth_verify: m, - crypto_verify_16: L, - crypto_verify_32: B, - crypto_secretbox: f, - crypto_secretbox_open: g, - crypto_scalarmult: ee, - crypto_scalarmult_base: T, - crypto_box_beforenm: re, - crypto_box_afternm: pe, - crypto_box: ue, - crypto_box_open: ve, - crypto_box_keypair: X, - crypto_hash: Ce, - crypto_sign: at, - crypto_sign_keypair: qe, - crypto_sign_open: Qe, - crypto_secretbox_KEYBYTES: tt, - crypto_secretbox_NONCEBYTES: Ye, - crypto_secretbox_ZEROBYTES: dt, - crypto_secretbox_BOXZEROBYTES: lt, - crypto_scalarmult_BYTES: ct, - crypto_scalarmult_SCALARBYTES: qt, - crypto_box_PUBLICKEYBYTES: Jt, - crypto_box_SECRETKEYBYTES: Et, - crypto_box_BEFORENMBYTES: er, - crypto_box_NONCEBYTES: Xt, - crypto_box_ZEROBYTES: Dt, - crypto_box_BOXZEROBYTES: kt, - crypto_sign_BYTES: Ct, - crypto_sign_PUBLICKEYBYTES: mt, - crypto_sign_SECRETKEYBYTES: Rt, - crypto_sign_SEEDBYTES: Nt, - crypto_hash_BYTES: bt, - gf: r, - D: l, - L: ze, - pack25519: S, - unpack25519: I, - M: D, - A: F, - S: oe, - Z: ce, - pow2523: J, - add: $e, - set25519: b, - modL: _e, - scalarmult: Ke, - scalarbase: Le - }; - function $t($, q) { - if ($.length !== tt) throw new Error("bad key size"); - if (q.length !== Ye) throw new Error("bad nonce size"); - } - function Ft($, q) { - if ($.length !== Jt) throw new Error("bad public key size"); - if (q.length !== Et) throw new Error("bad secret key size"); - } - function rt() { - for (var $ = 0; $ < arguments.length; $++) - if (!(arguments[$] instanceof Uint8Array)) - throw new TypeError("unexpected type, use Uint8Array"); - } - function Bt($) { - for (var q = 0; q < $.length; q++) $[q] = 0; - } - e.randomBytes = function($) { - var q = new Uint8Array($); - return n(q, $), q; - }, e.secretbox = function($, q, H) { - rt($, q, H), $t(H, q); - for (var C = new Uint8Array(dt + $.length), G = new Uint8Array(C.length), j = 0; j < $.length; j++) C[j + dt] = $[j]; - return f(G, C, C.length, q, H), G.subarray(lt); - }, e.secretbox.open = function($, q, H) { - rt($, q, H), $t(H, q); - for (var C = new Uint8Array(lt + $.length), G = new Uint8Array(C.length), j = 0; j < $.length; j++) C[j + lt] = $[j]; - return C.length < 32 || g(G, C, C.length, q, H) !== 0 ? null : G.subarray(dt); - }, e.secretbox.keyLength = tt, e.secretbox.nonceLength = Ye, e.secretbox.overheadLength = lt, e.scalarMult = function($, q) { - if (rt($, q), $.length !== qt) throw new Error("bad n size"); - if (q.length !== ct) throw new Error("bad p size"); - var H = new Uint8Array(ct); - return ee(H, $, q), H; - }, e.scalarMult.base = function($) { - if (rt($), $.length !== qt) throw new Error("bad n size"); - var q = new Uint8Array(ct); - return T(q, $), q; - }, e.scalarMult.scalarLength = qt, e.scalarMult.groupElementLength = ct, e.box = function($, q, H, C) { - var G = e.box.before(H, C); - return e.secretbox($, q, G); - }, e.box.before = function($, q) { - rt($, q), Ft($, q); - var H = new Uint8Array(er); - return re(H, $, q), H; - }, e.box.after = e.secretbox, e.box.open = function($, q, H, C) { - var G = e.box.before(H, C); - return e.secretbox.open($, q, G); - }, e.box.open.after = e.secretbox.open, e.box.keyPair = function() { - var $ = new Uint8Array(Jt), q = new Uint8Array(Et); - return X($, q), { publicKey: $, secretKey: q }; - }, e.box.keyPair.fromSecretKey = function($) { - if (rt($), $.length !== Et) - throw new Error("bad secret key size"); - var q = new Uint8Array(Jt); - return T(q, $), { publicKey: q, secretKey: new Uint8Array($) }; - }, e.box.publicKeyLength = Jt, e.box.secretKeyLength = Et, e.box.sharedKeyLength = er, e.box.nonceLength = Xt, e.box.overheadLength = e.secretbox.overheadLength, e.sign = function($, q) { - if (rt($, q), q.length !== Rt) - throw new Error("bad secret key size"); - var H = new Uint8Array(Ct + $.length); - return at(H, $, $.length, q), H; - }, e.sign.open = function($, q) { - if (rt($, q), q.length !== mt) - throw new Error("bad public key size"); - var H = new Uint8Array($.length), C = Qe(H, $, $.length, q); - if (C < 0) return null; - for (var G = new Uint8Array(C), j = 0; j < G.length; j++) G[j] = H[j]; - return G; - }, e.sign.detached = function($, q) { - for (var H = e.sign($, q), C = new Uint8Array(Ct), G = 0; G < C.length; G++) C[G] = H[G]; - return C; - }, e.sign.detached.verify = function($, q, H) { - if (rt($, q, H), q.length !== Ct) - throw new Error("bad signature size"); - if (H.length !== mt) - throw new Error("bad public key size"); - var C = new Uint8Array(Ct + $.length), G = new Uint8Array(Ct + $.length), j; - for (j = 0; j < Ct; j++) C[j] = q[j]; - for (j = 0; j < $.length; j++) C[j + Ct] = $[j]; - return Qe(G, C, C.length, H) >= 0; - }, e.sign.keyPair = function() { - var $ = new Uint8Array(mt), q = new Uint8Array(Rt); - return qe($, q), { publicKey: $, secretKey: q }; - }, e.sign.keyPair.fromSecretKey = function($) { - if (rt($), $.length !== Rt) - throw new Error("bad secret key size"); - for (var q = new Uint8Array(mt), H = 0; H < q.length; H++) q[H] = $[32 + H]; - return { publicKey: q, secretKey: new Uint8Array($) }; - }, e.sign.keyPair.fromSeed = function($) { - if (rt($), $.length !== Nt) - throw new Error("bad seed size"); - for (var q = new Uint8Array(mt), H = new Uint8Array(Rt), C = 0; C < 32; C++) H[C] = $[C]; - return qe(q, H, !0), { publicKey: q, secretKey: H }; - }, e.sign.publicKeyLength = mt, e.sign.secretKeyLength = Rt, e.sign.seedLength = Nt, e.sign.signatureLength = Ct, e.hash = function($) { - rt($); - var q = new Uint8Array(bt); - return Ce(q, $, $.length), q; - }, e.hash.hashLength = bt, e.verify = function($, q) { - return rt($, q), $.length === 0 || q.length === 0 || $.length !== q.length ? !1 : O($, 0, q, 0, $.length) === 0; - }, e.setPRNG = function($) { - n = $; - }, function() { - var $ = typeof self < "u" ? self.crypto || self.msCrypto : null; - if ($ && $.getRandomValues) { - var q = 65536; - e.setPRNG(function(H, C) { - var G, j = new Uint8Array(C); - for (G = 0; G < C; G += q) - $.getRandomValues(j.subarray(G, G + Math.min(C - G, q))); - for (G = 0; G < C; G++) H[G] = j[G]; - Bt(j); - }); - } else typeof e8 < "u" && ($ = Ql, $ && $.randomBytes && e.setPRNG(function(H, C) { - var G, j = $.randomBytes(C); - for (G = 0; G < C; G++) H[G] = j[G]; - Bt(j); - })); - }(); - })(t.exports ? t.exports : self.nacl = self.nacl || {}); -})(xA); -var Jie = xA.exports; -const Td = /* @__PURE__ */ ns(Jie); -var ha; -(function(t) { - t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.MANIFEST_NOT_FOUND_ERROR = 2] = "MANIFEST_NOT_FOUND_ERROR", t[t.MANIFEST_CONTENT_ERROR = 3] = "MANIFEST_CONTENT_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(ha || (ha = {})); -var I5; -(function(t) { - t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(I5 || (I5 = {})); -var gu; -(function(t) { - t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(gu || (gu = {})); -var C5; -(function(t) { - t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.USER_REJECTS_ERROR = 300] = "USER_REJECTS_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(C5 || (C5 = {})); -var T5; -(function(t) { - t[t.UNKNOWN_ERROR = 0] = "UNKNOWN_ERROR", t[t.BAD_REQUEST_ERROR = 1] = "BAD_REQUEST_ERROR", t[t.UNKNOWN_APP_ERROR = 100] = "UNKNOWN_APP_ERROR", t[t.METHOD_NOT_SUPPORTED = 400] = "METHOD_NOT_SUPPORTED"; -})(T5 || (T5 = {})); -var R5; -(function(t) { - t.MAINNET = "-239", t.TESTNET = "-3"; -})(R5 || (R5 = {})); -function Xie(t, e) { - const r = zl.encodeBase64(t); - return e ? encodeURIComponent(r) : r; -} -function Zie(t, e) { - return e && (t = decodeURIComponent(t)), zl.decodeBase64(t); -} -function Qie(t, e = !1) { - let r; - return t instanceof Uint8Array ? r = t : (typeof t != "string" && (t = JSON.stringify(t)), r = zl.decodeUTF8(t)), Xie(r, e); -} -function ese(t, e = !1) { - const r = Zie(t, e); - return { - toString() { - return zl.encodeUTF8(r); - }, - toObject() { - try { - return JSON.parse(zl.encodeUTF8(r)); - } catch { - return null; - } - }, - toUint8Array() { - return r; - } - }; -} -const _A = { - encode: Qie, - decode: ese -}; -function tse(t, e) { - const r = new Uint8Array(t.length + e.length); - return r.set(t), r.set(e, t.length), r; -} -function rse(t, e) { - if (e >= t.length) - throw new Error("Index is out of buffer"); - const r = t.slice(0, e), n = t.slice(e); - return [r, n]; -} -function o1(t) { - let e = ""; - return t.forEach((r) => { - e += ("0" + (r & 255).toString(16)).slice(-2); - }), e; -} -function $0(t) { - if (t.length % 2 !== 0) - throw new Error(`Cannot convert ${t} to bytesArray`); - const e = new Uint8Array(t.length / 2); - for (let r = 0; r < t.length; r += 2) - e[r / 2] = parseInt(t.slice(r, r + 2), 16); - return e; -} -class Cv { - constructor(e) { - this.nonceLength = 24, this.keyPair = e ? this.createKeypairFromString(e) : this.createKeypair(), this.sessionId = o1(this.keyPair.publicKey); - } - createKeypair() { - return Td.box.keyPair(); - } - createKeypairFromString(e) { - return { - publicKey: $0(e.publicKey), - secretKey: $0(e.secretKey) - }; - } - createNonce() { - return Td.randomBytes(this.nonceLength); - } - encrypt(e, r) { - const n = new TextEncoder().encode(e), i = this.createNonce(), s = Td.box(n, i, r, this.keyPair.secretKey); - return tse(i, s); - } - decrypt(e, r) { - const [n, i] = rse(e, this.nonceLength), s = Td.box.open(i, n, r, this.keyPair.secretKey); - if (!s) - throw new Error(`Decryption error: - message: ${e.toString()} - sender pubkey: ${r.toString()} - keypair pubkey: ${this.keyPair.publicKey.toString()} - keypair secretkey: ${this.keyPair.secretKey.toString()}`); - return new TextDecoder().decode(s); - } - stringifyKeypair() { - return { - publicKey: o1(this.keyPair.publicKey), - secretKey: o1(this.keyPair.secretKey) - }; - } -} -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -function nse(t, e) { - var r = {}; - for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); - if (t != null && typeof Object.getOwnPropertySymbols == "function") - for (var i = 0, n = Object.getOwnPropertySymbols(t); i < n.length; i++) - e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]); - return r; -} -function Mt(t, e, r, n) { - function i(s) { - return s instanceof r ? s : new r(function(o) { - o(s); - }); - } - return new (r || (r = Promise))(function(s, o) { - function a(d) { - try { - l(n.next(d)); - } catch (p) { - o(p); - } - } - function u(d) { - try { - l(n.throw(d)); - } catch (p) { - o(p); - } - } - function l(d) { - d.done ? s(d.value) : i(d.value).then(a, u); - } - l((n = n.apply(t, [])).next()); - }); -} -class jt extends Error { - constructor(e, r) { - super(e, r), this.message = `${jt.prefix} ${this.constructor.name}${this.info ? ": " + this.info : ""}${e ? ` -` + e : ""}`, Object.setPrototypeOf(this, jt.prototype); - } - get info() { - return ""; - } -} -jt.prefix = "[TON_CONNECT_SDK_ERROR]"; -class Sy extends jt { - get info() { - return "Passed DappMetadata is in incorrect format."; - } - constructor(...e) { - super(...e), Object.setPrototypeOf(this, Sy.prototype); - } -} -class Fp extends jt { - get info() { - return "Passed `tonconnect-manifest.json` contains errors. Check format of your manifest. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"; - } - constructor(...e) { - super(...e), Object.setPrototypeOf(this, Fp.prototype); - } -} -class jp extends jt { - get info() { - return "Manifest not found. Make sure you added `tonconnect-manifest.json` to the root of your app or passed correct manifestUrl. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"; - } - constructor(...e) { - super(...e), Object.setPrototypeOf(this, jp.prototype); - } -} -class Ay extends jt { - get info() { - return "Wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection."; - } - constructor(...e) { - super(...e), Object.setPrototypeOf(this, Ay.prototype); - } -} -class B0 extends jt { - get info() { - return "Send transaction or other protocol methods called while wallet is not connected."; - } - constructor(...e) { - super(...e), Object.setPrototypeOf(this, B0.prototype); - } -} -function ise(t) { - return "jsBridgeKey" in t; -} -class Up extends jt { - get info() { - return "User rejects the action in the wallet."; - } - constructor(...e) { - super(...e), Object.setPrototypeOf(this, Up.prototype); - } -} -class qp extends jt { - get info() { - return "Request to the wallet contains errors."; - } - constructor(...e) { - super(...e), Object.setPrototypeOf(this, qp.prototype); - } -} -class zp extends jt { - get info() { - return "App tries to send rpc request to the injected wallet while not connected."; - } - constructor(...e) { - super(...e), Object.setPrototypeOf(this, zp.prototype); - } -} -class Py extends jt { - get info() { - return "There is an attempt to connect to the injected wallet while it is not exists in the webpage."; - } - constructor(...e) { - super(...e), Object.setPrototypeOf(this, Py.prototype); - } -} -class My extends jt { - get info() { - return "An error occurred while fetching the wallets list."; - } - constructor(...e) { - super(...e), Object.setPrototypeOf(this, My.prototype); - } -} -class Ca extends jt { - constructor(...e) { - super(...e), Object.setPrototypeOf(this, Ca.prototype); - } -} -const D5 = { - [ha.UNKNOWN_ERROR]: Ca, - [ha.USER_REJECTS_ERROR]: Up, - [ha.BAD_REQUEST_ERROR]: qp, - [ha.UNKNOWN_APP_ERROR]: zp, - [ha.MANIFEST_NOT_FOUND_ERROR]: jp, - [ha.MANIFEST_CONTENT_ERROR]: Fp -}; -class sse { - parseError(e) { - let r = Ca; - return e.code in D5 && (r = D5[e.code] || Ca), new r(e.message); - } -} -const ose = new sse(); -class ase { - isError(e) { - return "error" in e; - } -} -const O5 = { - [gu.UNKNOWN_ERROR]: Ca, - [gu.USER_REJECTS_ERROR]: Up, - [gu.BAD_REQUEST_ERROR]: qp, - [gu.UNKNOWN_APP_ERROR]: zp -}; -class cse extends ase { - convertToRpcRequest(e) { - return { - method: "sendTransaction", - params: [JSON.stringify(e)] - }; - } - parseAndThrowError(e) { - let r = Ca; - throw e.error.code in O5 && (r = O5[e.error.code] || Ca), new r(e.error.message); - } - convertFromRpcResponse(e) { - return { - boc: e.result - }; - } -} -const Rd = new cse(); -class use { - constructor(e, r) { - this.storage = e, this.storeKey = "ton-connect-storage_http-bridge-gateway::" + r; - } - storeLastEventId(e) { - return Mt(this, void 0, void 0, function* () { - return this.storage.setItem(this.storeKey, e); - }); - } - removeLastEventId() { - return Mt(this, void 0, void 0, function* () { - return this.storage.removeItem(this.storeKey); - }); - } - getLastEventId() { - return Mt(this, void 0, void 0, function* () { - const e = yield this.storage.getItem(this.storeKey); - return e || null; - }); - } -} -function fse(t) { - return t.slice(-1) === "/" ? t.slice(0, -1) : t; -} -function EA(t, e) { - return fse(t) + "/" + e; -} -function lse(t) { - if (!t) - return !1; - const e = new URL(t); - return e.protocol === "tg:" || e.hostname === "t.me"; -} -function hse(t) { - return t.replaceAll(".", "%2E").replaceAll("-", "%2D").replaceAll("_", "%5F").replaceAll("&", "-").replaceAll("=", "__").replaceAll("%", "--"); -} -function SA(t, e) { - return Mt(this, void 0, void 0, function* () { - return new Promise((r, n) => { - var i, s; - if (!((i = void 0) === null || i === void 0) && i.aborted) { - n(new jt("Delay aborted")); - return; - } - const o = setTimeout(() => r(), t); - (s = void 0) === null || s === void 0 || s.addEventListener("abort", () => { - clearTimeout(o), n(new jt("Delay aborted")); - }); - }); - }); -} -function As(t) { - const e = new AbortController(); - return t != null && t.aborted ? e.abort() : t == null || t.addEventListener("abort", () => e.abort(), { once: !0 }), e; -} -function ol(t, e) { - var r, n; - return Mt(this, void 0, void 0, function* () { - const i = (r = e == null ? void 0 : e.attempts) !== null && r !== void 0 ? r : 10, s = (n = e == null ? void 0 : e.delayMs) !== null && n !== void 0 ? n : 200, o = As(e == null ? void 0 : e.signal); - if (typeof t != "function") - throw new jt(`Expected a function, got ${typeof t}`); - let a = 0, u; - for (; a < i; ) { - if (o.signal.aborted) - throw new jt(`Aborted after attempts ${a}`); - try { - return yield t({ signal: o.signal }); - } catch (l) { - u = l, a++, a < i && (yield SA(s)); - } - } - throw u; - }); -} -function An(...t) { - try { - console.debug("[TON_CONNECT_SDK]", ...t); - } catch { - } -} -function Bo(...t) { - try { - console.error("[TON_CONNECT_SDK]", ...t); - } catch { - } -} -function dse(...t) { - try { - console.warn("[TON_CONNECT_SDK]", ...t); - } catch { - } -} -function pse(t, e) { - let r = null, n = null, i = null, s = null, o = null; - const a = (p, ...w) => Mt(this, void 0, void 0, function* () { - if (s = p ?? null, o == null || o.abort(), o = As(p), o.signal.aborted) - throw new jt("Resource creation was aborted"); - n = w ?? null; - const _ = t(o.signal, ...w); - i = _; - const P = yield _; - if (i !== _ && P !== r) - throw yield e(P), new jt("Resource creation was aborted by a new resource creation"); - return r = P, r; - }); - return { - create: a, - current: () => r ?? null, - dispose: () => Mt(this, void 0, void 0, function* () { - try { - const p = r; - r = null; - const w = i; - i = null; - try { - o == null || o.abort(); - } catch { - } - yield Promise.allSettled([ - p ? e(p) : Promise.resolve(), - w ? e(yield w) : Promise.resolve() - ]); - } catch { - } - }), - recreate: (p) => Mt(this, void 0, void 0, function* () { - const w = r, _ = i, P = n, O = s; - if (yield SA(p), w === r && _ === i && P === n && O === s) - return yield a(s, ...P ?? []); - throw new jt("Resource recreation was aborted by a new resource creation"); - }) - }; -} -function gse(t, e) { - const r = e == null ? void 0 : e.timeout, n = e == null ? void 0 : e.signal, i = As(n); - return new Promise((s, o) => Mt(this, void 0, void 0, function* () { - if (i.signal.aborted) { - o(new jt("Operation aborted")); - return; - } - let a; - typeof r < "u" && (a = setTimeout(() => { - i.abort(), o(new jt(`Timeout after ${r}ms`)); - }, r)), i.signal.addEventListener("abort", () => { - clearTimeout(a), o(new jt("Operation aborted")); - }, { once: !0 }); - const u = { timeout: r, abort: i.signal }; - yield t((...l) => { - clearTimeout(a), s(...l); - }, () => { - clearTimeout(a), o(); - }, u); - })); -} -class a1 { - constructor(e, r, n, i, s) { - this.bridgeUrl = r, this.sessionId = n, this.listener = i, this.errorsListener = s, this.ssePath = "events", this.postPath = "message", this.heartbeatMessage = "heartbeat", this.defaultTtl = 300, this.defaultReconnectDelay = 2e3, this.defaultResendDelay = 5e3, this.eventSource = pse((o, a) => Mt(this, void 0, void 0, function* () { - const u = { - bridgeUrl: this.bridgeUrl, - ssePath: this.ssePath, - sessionId: this.sessionId, - bridgeGatewayStorage: this.bridgeGatewayStorage, - errorHandler: this.errorsHandler.bind(this), - messageHandler: this.messagesHandler.bind(this), - signal: o, - openingDeadlineMS: a - }; - return yield mse(u); - }), (o) => Mt(this, void 0, void 0, function* () { - o.close(); - })), this.bridgeGatewayStorage = new use(e, r); - } - get isReady() { - const e = this.eventSource.current(); - return (e == null ? void 0 : e.readyState) === EventSource.OPEN; - } - get isClosed() { - const e = this.eventSource.current(); - return (e == null ? void 0 : e.readyState) !== EventSource.OPEN; - } - get isConnecting() { - const e = this.eventSource.current(); - return (e == null ? void 0 : e.readyState) === EventSource.CONNECTING; - } - registerSession(e) { - return Mt(this, void 0, void 0, function* () { - yield this.eventSource.create(e == null ? void 0 : e.signal, e == null ? void 0 : e.openingDeadlineMS); - }); - } - send(e, r, n, i) { - var s; - return Mt(this, void 0, void 0, function* () { - const o = {}; - typeof i == "number" ? o.ttl = i : (o.ttl = i == null ? void 0 : i.ttl, o.signal = i == null ? void 0 : i.signal, o.attempts = i == null ? void 0 : i.attempts); - const a = new URL(EA(this.bridgeUrl, this.postPath)); - a.searchParams.append("client_id", this.sessionId), a.searchParams.append("to", r), a.searchParams.append("ttl", ((o == null ? void 0 : o.ttl) || this.defaultTtl).toString()), a.searchParams.append("topic", n); - const u = _A.encode(e); - yield ol((l) => Mt(this, void 0, void 0, function* () { - const d = yield this.post(a, u, l.signal); - if (!d.ok) - throw new jt(`Bridge send failed, status ${d.status}`); - }), { - attempts: (s = o == null ? void 0 : o.attempts) !== null && s !== void 0 ? s : Number.MAX_SAFE_INTEGER, - delayMs: this.defaultResendDelay, - signal: o == null ? void 0 : o.signal - }); - }); - } - pause() { - this.eventSource.dispose().catch((e) => Bo(`Bridge pause failed, ${e}`)); - } - unPause() { - return Mt(this, void 0, void 0, function* () { - yield this.eventSource.recreate(0); - }); - } - close() { - return Mt(this, void 0, void 0, function* () { - yield this.eventSource.dispose().catch((e) => Bo(`Bridge close failed, ${e}`)); - }); - } - setListener(e) { - this.listener = e; - } - setErrorsListener(e) { - this.errorsListener = e; - } - post(e, r, n) { - return Mt(this, void 0, void 0, function* () { - const i = yield fetch(e, { - method: "post", - body: r, - signal: n - }); - if (!i.ok) - throw new jt(`Bridge send failed, status ${i.status}`); - return i; - }); - } - errorsHandler(e, r) { - return Mt(this, void 0, void 0, function* () { - if (this.isConnecting) - throw e.close(), new jt("Bridge error, failed to connect"); - if (this.isReady) { - try { - this.errorsListener(r); - } catch { - } - return; - } - if (this.isClosed) - return e.close(), An(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`), yield this.eventSource.recreate(this.defaultReconnectDelay); - throw new jt("Bridge error, unknown state"); - }); - } - messagesHandler(e) { - return Mt(this, void 0, void 0, function* () { - if (e.data === this.heartbeatMessage || (yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId), this.isClosed)) - return; - let r; - try { - r = JSON.parse(e.data); - } catch (n) { - throw new jt(`Bridge message parse failed, message ${n.data}`); - } - this.listener(r); - }); - } -} -function mse(t) { - return Mt(this, void 0, void 0, function* () { - return yield gse((e, r, n) => Mt(this, void 0, void 0, function* () { - var i; - const o = As(n.signal).signal; - if (o.aborted) { - r(new jt("Bridge connection aborted")); - return; - } - const a = new URL(EA(t.bridgeUrl, t.ssePath)); - a.searchParams.append("client_id", t.sessionId); - const u = yield t.bridgeGatewayStorage.getLastEventId(); - if (u && a.searchParams.append("last_event_id", u), o.aborted) { - r(new jt("Bridge connection aborted")); - return; - } - const l = new EventSource(a.toString()); - l.onerror = (d) => Mt(this, void 0, void 0, function* () { - if (o.aborted) { - l.close(), r(new jt("Bridge connection aborted")); - return; - } - try { - const p = yield t.errorHandler(l, d); - p !== l && l.close(), p && p !== l && e(p); - } catch (p) { - l.close(), r(p); - } - }), l.onopen = () => { - if (o.aborted) { - l.close(), r(new jt("Bridge connection aborted")); - return; - } - e(l); - }, l.onmessage = (d) => { - if (o.aborted) { - l.close(), r(new jt("Bridge connection aborted")); - return; - } - t.messageHandler(d); - }, (i = t.signal) === null || i === void 0 || i.addEventListener("abort", () => { - l.close(), r(new jt("Bridge connection aborted")); - }); - }), { timeout: t.openingDeadlineMS, signal: t.signal }); - }); -} -function al(t) { - return !("connectEvent" in t); -} -class Wl { - constructor(e) { - this.storage = e, this.storeKey = "ton-connect-storage_bridge-connection"; - } - storeConnection(e) { - return Mt(this, void 0, void 0, function* () { - if (e.type === "injected") - return this.storage.setItem(this.storeKey, JSON.stringify(e)); - if (!al(e)) { - const n = { - sessionKeyPair: e.session.sessionCrypto.stringifyKeypair(), - walletPublicKey: e.session.walletPublicKey, - bridgeUrl: e.session.bridgeUrl - }, i = { - type: "http", - connectEvent: e.connectEvent, - session: n, - lastWalletEventId: e.lastWalletEventId, - nextRpcRequestId: e.nextRpcRequestId - }; - return this.storage.setItem(this.storeKey, JSON.stringify(i)); - } - const r = { - type: "http", - connectionSource: e.connectionSource, - sessionCrypto: e.sessionCrypto.stringifyKeypair() - }; - return this.storage.setItem(this.storeKey, JSON.stringify(r)); - }); - } - removeConnection() { - return Mt(this, void 0, void 0, function* () { - return this.storage.removeItem(this.storeKey); - }); - } - getConnection() { - return Mt(this, void 0, void 0, function* () { - const e = yield this.storage.getItem(this.storeKey); - if (!e) - return null; - const r = JSON.parse(e); - if (r.type === "injected") - return r; - if ("connectEvent" in r) { - const n = new Cv(r.session.sessionKeyPair); - return { - type: "http", - connectEvent: r.connectEvent, - lastWalletEventId: r.lastWalletEventId, - nextRpcRequestId: r.nextRpcRequestId, - session: { - sessionCrypto: n, - bridgeUrl: r.session.bridgeUrl, - walletPublicKey: r.session.walletPublicKey - } - }; - } - return { - type: "http", - sessionCrypto: new Cv(r.sessionCrypto), - connectionSource: r.connectionSource - }; - }); - } - getHttpConnection() { - return Mt(this, void 0, void 0, function* () { - const e = yield this.getConnection(); - if (!e) - throw new jt("Trying to read HTTP connection source while nothing is stored"); - if (e.type === "injected") - throw new jt("Trying to read HTTP connection source while injected connection is stored"); - return e; - }); - } - getHttpPendingConnection() { - return Mt(this, void 0, void 0, function* () { - const e = yield this.getConnection(); - if (!e) - throw new jt("Trying to read HTTP connection source while nothing is stored"); - if (e.type === "injected") - throw new jt("Trying to read HTTP connection source while injected connection is stored"); - if (!al(e)) - throw new jt("Trying to read HTTP-pending connection while http connection is stored"); - return e; - }); - } - getInjectedConnection() { - return Mt(this, void 0, void 0, function* () { - const e = yield this.getConnection(); - if (!e) - throw new jt("Trying to read Injected bridge connection source while nothing is stored"); - if ((e == null ? void 0 : e.type) === "http") - throw new jt("Trying to read Injected bridge connection source while HTTP connection is stored"); - return e; - }); - } - storedConnectionType() { - return Mt(this, void 0, void 0, function* () { - const e = yield this.storage.getItem(this.storeKey); - return e ? JSON.parse(e).type : null; - }); - } - storeLastWalletEventId(e) { - return Mt(this, void 0, void 0, function* () { - const r = yield this.getConnection(); - if (r && r.type === "http" && !al(r)) - return r.lastWalletEventId = e, this.storeConnection(r); - }); - } - getLastWalletEventId() { - return Mt(this, void 0, void 0, function* () { - const e = yield this.getConnection(); - if (e && "lastWalletEventId" in e) - return e.lastWalletEventId; - }); - } - increaseNextRpcRequestId() { - return Mt(this, void 0, void 0, function* () { - const e = yield this.getConnection(); - if (e && "nextRpcRequestId" in e) { - const r = e.nextRpcRequestId || 0; - return e.nextRpcRequestId = r + 1, this.storeConnection(e); - } - }); - } - getNextRpcRequestId() { - return Mt(this, void 0, void 0, function* () { - const e = yield this.getConnection(); - return e && "nextRpcRequestId" in e && e.nextRpcRequestId || 0; - }); - } -} -const AA = 2; -class Hl { - constructor(e, r) { - this.storage = e, this.walletConnectionSource = r, this.type = "http", this.standardUniversalLink = "tc://", this.pendingRequests = /* @__PURE__ */ new Map(), this.session = null, this.gateway = null, this.pendingGateways = [], this.listeners = [], this.defaultOpeningDeadlineMS = 12e3, this.defaultRetryTimeoutMS = 2e3, this.connectionStorage = new Wl(e); - } - static fromStorage(e) { - return Mt(this, void 0, void 0, function* () { - const n = yield new Wl(e).getHttpConnection(); - return al(n) ? new Hl(e, n.connectionSource) : new Hl(e, { bridgeUrl: n.session.bridgeUrl }); - }); - } - connect(e, r) { - var n; - const i = As(r == null ? void 0 : r.signal); - (n = this.abortController) === null || n === void 0 || n.abort(), this.abortController = i, this.closeGateways(); - const s = new Cv(); - this.session = { - sessionCrypto: s, - bridgeUrl: "bridgeUrl" in this.walletConnectionSource ? this.walletConnectionSource.bridgeUrl : "" - }, this.connectionStorage.storeConnection({ - type: "http", - connectionSource: this.walletConnectionSource, - sessionCrypto: s - }).then(() => Mt(this, void 0, void 0, function* () { - i.signal.aborted || (yield ol((a) => { - var u; - return this.openGateways(s, { - openingDeadlineMS: (u = r == null ? void 0 : r.openingDeadlineMS) !== null && u !== void 0 ? u : this.defaultOpeningDeadlineMS, - signal: a == null ? void 0 : a.signal - }); - }, { - attempts: Number.MAX_SAFE_INTEGER, - delayMs: this.defaultRetryTimeoutMS, - signal: i.signal - })); - })); - const o = "universalLink" in this.walletConnectionSource && this.walletConnectionSource.universalLink ? this.walletConnectionSource.universalLink : this.standardUniversalLink; - return this.generateUniversalLink(o, e); - } - restoreConnection(e) { - var r, n; - return Mt(this, void 0, void 0, function* () { - const i = As(e == null ? void 0 : e.signal); - if ((r = this.abortController) === null || r === void 0 || r.abort(), this.abortController = i, i.signal.aborted) - return; - this.closeGateways(); - const s = yield this.connectionStorage.getHttpConnection(); - if (!s || i.signal.aborted) - return; - const o = (n = e == null ? void 0 : e.openingDeadlineMS) !== null && n !== void 0 ? n : this.defaultOpeningDeadlineMS; - if (al(s)) - return this.session = { - sessionCrypto: s.sessionCrypto, - bridgeUrl: "bridgeUrl" in this.walletConnectionSource ? this.walletConnectionSource.bridgeUrl : "" - }, yield this.openGateways(s.sessionCrypto, { - openingDeadlineMS: o, - signal: i == null ? void 0 : i.signal - }); - if (Array.isArray(this.walletConnectionSource)) - throw new jt("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected."); - if (this.session = s.session, this.gateway && (An("Gateway is already opened, closing previous gateway"), yield this.gateway.close()), this.gateway = new a1(this.storage, this.walletConnectionSource.bridgeUrl, s.session.sessionCrypto.sessionId, this.gatewayListener.bind(this), this.gatewayErrorsListener.bind(this)), !i.signal.aborted) { - this.listeners.forEach((a) => a(s.connectEvent)); - try { - yield ol((a) => this.gateway.registerSession({ - openingDeadlineMS: o, - signal: a.signal - }), { - attempts: Number.MAX_SAFE_INTEGER, - delayMs: this.defaultRetryTimeoutMS, - signal: i.signal - }); - } catch { - yield this.disconnect({ signal: i.signal }); - return; - } - } - }); - } - sendRequest(e, r) { - const n = {}; - return typeof r == "function" ? n.onRequestSent = r : (n.onRequestSent = r == null ? void 0 : r.onRequestSent, n.signal = r == null ? void 0 : r.signal, n.attempts = r == null ? void 0 : r.attempts), new Promise((i, s) => Mt(this, void 0, void 0, function* () { - var o; - if (!this.gateway || !this.session || !("walletPublicKey" in this.session)) - throw new jt("Trying to send bridge request without session"); - const a = (yield this.connectionStorage.getNextRpcRequestId()).toString(); - yield this.connectionStorage.increaseNextRpcRequestId(), An("Send http-bridge request:", Object.assign(Object.assign({}, e), { id: a })); - const u = this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({}, e), { id: a })), $0(this.session.walletPublicKey)); - try { - yield this.gateway.send(u, this.session.walletPublicKey, e.method, { attempts: n == null ? void 0 : n.attempts, signal: n == null ? void 0 : n.signal }), (o = n == null ? void 0 : n.onRequestSent) === null || o === void 0 || o.call(n), this.pendingRequests.set(a.toString(), i); - } catch (l) { - s(l); - } - })); - } - closeConnection() { - this.closeGateways(), this.listeners = [], this.session = null, this.gateway = null; - } - disconnect(e) { - return Mt(this, void 0, void 0, function* () { - return new Promise((r) => Mt(this, void 0, void 0, function* () { - let n = !1, i = null; - const s = () => { - n || (n = !0, this.removeBridgeAndSession().then(r)); - }; - try { - this.closeGateways(); - const o = As(e == null ? void 0 : e.signal); - i = setTimeout(() => { - o.abort(); - }, this.defaultOpeningDeadlineMS), yield this.sendRequest({ method: "disconnect", params: [] }, { - onRequestSent: s, - signal: o.signal, - attempts: 1 - }); - } catch (o) { - An("Disconnect error:", o), n || this.removeBridgeAndSession().then(r); - } finally { - i && clearTimeout(i), s(); - } - })); - }); - } - listen(e) { - return this.listeners.push(e), () => this.listeners = this.listeners.filter((r) => r !== e); - } - pause() { - var e; - (e = this.gateway) === null || e === void 0 || e.pause(), this.pendingGateways.forEach((r) => r.pause()); - } - unPause() { - return Mt(this, void 0, void 0, function* () { - const e = this.pendingGateways.map((r) => r.unPause()); - this.gateway && e.push(this.gateway.unPause()), yield Promise.all(e); - }); - } - pendingGatewaysListener(e, r, n) { - return Mt(this, void 0, void 0, function* () { - if (!this.pendingGateways.includes(e)) { - yield e.close(); - return; - } - return this.closeGateways({ except: e }), this.gateway && (An("Gateway is already opened, closing previous gateway"), yield this.gateway.close()), this.session.bridgeUrl = r, this.gateway = e, this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)), this.gateway.setListener(this.gatewayListener.bind(this)), this.gatewayListener(n); - }); - } - gatewayListener(e) { - return Mt(this, void 0, void 0, function* () { - const r = JSON.parse(this.session.sessionCrypto.decrypt(_A.decode(e.message).toUint8Array(), $0(e.from))); - if (An("Wallet message received:", r), !("event" in r)) { - const i = r.id.toString(), s = this.pendingRequests.get(i); - if (!s) { - An(`Response id ${i} doesn't match any request's id`); - return; - } - s(r), this.pendingRequests.delete(i); - return; - } - if (r.id !== void 0) { - const i = yield this.connectionStorage.getLastWalletEventId(); - if (i !== void 0 && r.id <= i) { - Bo(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `); - return; - } - r.event !== "connect" && (yield this.connectionStorage.storeLastWalletEventId(r.id)); - } - const n = this.listeners; - r.event === "connect" && (yield this.updateSession(r, e.from)), r.event === "disconnect" && (An("Removing bridge and session: received disconnect event"), yield this.removeBridgeAndSession()), n.forEach((i) => i(r)); - }); - } - gatewayErrorsListener(e) { - return Mt(this, void 0, void 0, function* () { - throw new jt(`Bridge error ${JSON.stringify(e)}`); - }); - } - updateSession(e, r) { - return Mt(this, void 0, void 0, function* () { - this.session = Object.assign(Object.assign({}, this.session), { walletPublicKey: r }); - const n = e.payload.items.find((s) => s.name === "ton_addr"), i = Object.assign(Object.assign({}, e), { payload: Object.assign(Object.assign({}, e.payload), { items: [n] }) }); - yield this.connectionStorage.storeConnection({ - type: "http", - session: this.session, - lastWalletEventId: e.id, - connectEvent: i, - nextRpcRequestId: 0 - }); - }); - } - removeBridgeAndSession() { - return Mt(this, void 0, void 0, function* () { - this.closeConnection(), yield this.connectionStorage.removeConnection(); - }); - } - generateUniversalLink(e, r) { - return lse(e) ? this.generateTGUniversalLink(e, r) : this.generateRegularUniversalLink(e, r); - } - generateRegularUniversalLink(e, r) { - const n = new URL(e); - return n.searchParams.append("v", AA.toString()), n.searchParams.append("id", this.session.sessionCrypto.sessionId), n.searchParams.append("r", JSON.stringify(r)), n.toString(); - } - generateTGUniversalLink(e, r) { - const i = this.generateRegularUniversalLink("about:blank", r).split("?")[1], s = "tonconnect-" + hse(i), o = this.convertToDirectLink(e), a = new URL(o); - return a.searchParams.append("startapp", s), a.toString(); - } - // TODO: Remove this method after all dApps and the wallets-list.json have been updated - convertToDirectLink(e) { - const r = new URL(e); - return r.searchParams.has("attach") && (r.searchParams.delete("attach"), r.pathname += "/start"), r.toString(); - } - openGateways(e, r) { - return Mt(this, void 0, void 0, function* () { - if (Array.isArray(this.walletConnectionSource)) { - this.pendingGateways.map((n) => n.close().catch()), this.pendingGateways = this.walletConnectionSource.map((n) => { - const i = new a1(this.storage, n.bridgeUrl, e.sessionId, () => { - }, () => { - }); - return i.setListener((s) => this.pendingGatewaysListener(i, n.bridgeUrl, s)), i; - }), yield Promise.allSettled(this.pendingGateways.map((n) => ol((i) => { - var s; - return this.pendingGateways.some((o) => o === n) ? n.registerSession({ - openingDeadlineMS: (s = r == null ? void 0 : r.openingDeadlineMS) !== null && s !== void 0 ? s : this.defaultOpeningDeadlineMS, - signal: i.signal - }) : n.close(); - }, { - attempts: Number.MAX_SAFE_INTEGER, - delayMs: this.defaultRetryTimeoutMS, - signal: r == null ? void 0 : r.signal - }))); - return; - } else - return this.gateway && (An("Gateway is already opened, closing previous gateway"), yield this.gateway.close()), this.gateway = new a1(this.storage, this.walletConnectionSource.bridgeUrl, e.sessionId, this.gatewayListener.bind(this), this.gatewayErrorsListener.bind(this)), yield this.gateway.registerSession({ - openingDeadlineMS: r == null ? void 0 : r.openingDeadlineMS, - signal: r == null ? void 0 : r.signal - }); - }); - } - closeGateways(e) { - var r; - (r = this.gateway) === null || r === void 0 || r.close(), this.pendingGateways.filter((n) => n !== (e == null ? void 0 : e.except)).forEach((n) => n.close()), this.pendingGateways = []; - } -} -function N5(t, e) { - return PA(t, [e]); -} -function PA(t, e) { - return !t || typeof t != "object" ? !1 : e.every((r) => r in t); -} -function vse(t) { - try { - return !N5(t, "tonconnect") || !N5(t.tonconnect, "walletInfo") ? !1 : PA(t.tonconnect.walletInfo, [ - "name", - "app_name", - "image", - "about_url", - "platforms" - ]); - } catch { - return !1; - } -} -class mu { - constructor() { - this.storage = {}; - } - static getInstance() { - return mu.instance || (mu.instance = new mu()), mu.instance; - } - get length() { - return Object.keys(this.storage).length; - } - clear() { - this.storage = {}; - } - getItem(e) { - var r; - return (r = this.storage[e]) !== null && r !== void 0 ? r : null; - } - key(e) { - var r; - const n = Object.keys(this.storage); - return e < 0 || e >= n.length ? null : (r = n[e]) !== null && r !== void 0 ? r : null; - } - removeItem(e) { - delete this.storage[e]; - } - setItem(e, r) { - this.storage[e] = r; - } -} -function Wp() { - if (!(typeof window > "u")) - return window; -} -function bse() { - const t = Wp(); - if (!t) - return []; - try { - return Object.keys(t); - } catch { - return []; - } -} -function yse() { - if (!(typeof document > "u")) - return document; -} -function wse() { - var t; - const e = (t = Wp()) === null || t === void 0 ? void 0 : t.location.origin; - return e ? e + "/tonconnect-manifest.json" : ""; -} -function xse() { - if (_se()) - return localStorage; - if (Ese()) - throw new jt("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector"); - return mu.getInstance(); -} -function _se() { - try { - return typeof localStorage < "u"; - } catch { - return !1; - } -} -function Ese() { - return typeof process < "u" && process.versions != null && process.versions.node != null; -} -class bi { - constructor(e, r) { - this.injectedWalletKey = r, this.type = "injected", this.unsubscribeCallback = null, this.listenSubscriptions = !1, this.listeners = []; - const n = bi.window; - if (!bi.isWindowContainsWallet(n, r)) - throw new Py(); - this.connectionStorage = new Wl(e), this.injectedWallet = n[r].tonconnect; - } - static fromStorage(e) { - return Mt(this, void 0, void 0, function* () { - const n = yield new Wl(e).getInjectedConnection(); - return new bi(e, n.jsBridgeKey); - }); - } - static isWalletInjected(e) { - return bi.isWindowContainsWallet(this.window, e); - } - static isInsideWalletBrowser(e) { - return bi.isWindowContainsWallet(this.window, e) ? this.window[e].tonconnect.isWalletBrowser : !1; - } - static getCurrentlyInjectedWallets() { - return this.window ? bse().filter(([n, i]) => vse(i)).map(([n, i]) => ({ - name: i.tonconnect.walletInfo.name, - appName: i.tonconnect.walletInfo.app_name, - aboutUrl: i.tonconnect.walletInfo.about_url, - imageUrl: i.tonconnect.walletInfo.image, - tondns: i.tonconnect.walletInfo.tondns, - jsBridgeKey: n, - injected: !0, - embedded: i.tonconnect.isWalletBrowser, - platforms: i.tonconnect.walletInfo.platforms - })) : []; - } - static isWindowContainsWallet(e, r) { - return !!e && r in e && typeof e[r] == "object" && "tonconnect" in e[r]; - } - connect(e) { - this._connect(AA, e); - } - restoreConnection() { - return Mt(this, void 0, void 0, function* () { - try { - An("Injected Provider restoring connection..."); - const e = yield this.injectedWallet.restoreConnection(); - An("Injected Provider restoring connection response", e), e.event === "connect" ? (this.makeSubscriptions(), this.listeners.forEach((r) => r(e))) : yield this.connectionStorage.removeConnection(); - } catch (e) { - yield this.connectionStorage.removeConnection(), console.error(e); - } - }); - } - closeConnection() { - this.listenSubscriptions && this.injectedWallet.disconnect(), this.closeAllListeners(); - } - disconnect() { - return Mt(this, void 0, void 0, function* () { - return new Promise((e) => { - const r = () => { - this.closeAllListeners(), this.connectionStorage.removeConnection().then(e); - }; - try { - this.injectedWallet.disconnect(), r(); - } catch (n) { - An(n), this.sendRequest({ - method: "disconnect", - params: [] - }, r); - } - }); - }); - } - closeAllListeners() { - var e; - this.listenSubscriptions = !1, this.listeners = [], (e = this.unsubscribeCallback) === null || e === void 0 || e.call(this); - } - listen(e) { - return this.listeners.push(e), () => this.listeners = this.listeners.filter((r) => r !== e); - } - sendRequest(e, r) { - var n; - return Mt(this, void 0, void 0, function* () { - const i = {}; - typeof r == "function" ? i.onRequestSent = r : (i.onRequestSent = r == null ? void 0 : r.onRequestSent, i.signal = r == null ? void 0 : r.signal); - const s = (yield this.connectionStorage.getNextRpcRequestId()).toString(); - yield this.connectionStorage.increaseNextRpcRequestId(), An("Send injected-bridge request:", Object.assign(Object.assign({}, e), { id: s })); - const o = this.injectedWallet.send(Object.assign(Object.assign({}, e), { id: s })); - return o.then((a) => An("Wallet message received:", a)), (n = i == null ? void 0 : i.onRequestSent) === null || n === void 0 || n.call(i), o; - }); - } - _connect(e, r) { - return Mt(this, void 0, void 0, function* () { - try { - An(`Injected Provider connect request: protocolVersion: ${e}, message:`, r); - const n = yield this.injectedWallet.connect(e, r); - An("Injected Provider connect response:", n), n.event === "connect" && (yield this.updateSession(), this.makeSubscriptions()), this.listeners.forEach((i) => i(n)); - } catch (n) { - An("Injected Provider connect error:", n); - const i = { - event: "connect_error", - payload: { - code: 0, - message: n == null ? void 0 : n.toString() - } - }; - this.listeners.forEach((s) => s(i)); - } - }); - } - makeSubscriptions() { - this.listenSubscriptions = !0, this.unsubscribeCallback = this.injectedWallet.listen((e) => { - An("Wallet message received:", e), this.listenSubscriptions && this.listeners.forEach((r) => r(e)), e.event === "disconnect" && this.disconnect(); - }); - } - updateSession() { - return this.connectionStorage.storeConnection({ - type: "injected", - jsBridgeKey: this.injectedWalletKey, - nextRpcRequestId: 0 - }); - } -} -bi.window = Wp(); -class Sse { - constructor() { - this.localStorage = xse(); - } - getItem(e) { - return Mt(this, void 0, void 0, function* () { - return this.localStorage.getItem(e); - }); - } - removeItem(e) { - return Mt(this, void 0, void 0, function* () { - this.localStorage.removeItem(e); - }); - } - setItem(e, r) { - return Mt(this, void 0, void 0, function* () { - this.localStorage.setItem(e, r); - }); - } -} -function MA(t) { - return Pse(t) && t.injected; -} -function Ase(t) { - return MA(t) && t.embedded; -} -function Pse(t) { - return "jsBridgeKey" in t; -} -const Mse = [ - { - app_name: "telegram-wallet", - name: "Wallet", - image: "https://wallet.tg/images/logo-288.png", - about_url: "https://wallet.tg/", - universal_url: "https://t.me/wallet?attach=wallet", - bridge: [ - { - type: "sse", - url: "https://bridge.ton.space/bridge" - } - ], - platforms: ["ios", "android", "macos", "windows", "linux"] - }, - { - app_name: "tonkeeper", - name: "Tonkeeper", - image: "https://tonkeeper.com/assets/tonconnect-icon.png", - tondns: "tonkeeper.ton", - about_url: "https://tonkeeper.com", - universal_url: "https://app.tonkeeper.com/ton-connect", - deepLink: "tonkeeper-tc://", - bridge: [ - { - type: "sse", - url: "https://bridge.tonapi.io/bridge" - }, - { - type: "js", - key: "tonkeeper" - } - ], - platforms: ["ios", "android", "chrome", "firefox", "macos"] - }, - { - app_name: "mytonwallet", - name: "MyTonWallet", - image: "https://static.mytonwallet.io/icon-256.png", - about_url: "https://mytonwallet.io", - universal_url: "https://connect.mytonwallet.org", - bridge: [ - { - type: "js", - key: "mytonwallet" - }, - { - type: "sse", - url: "https://tonconnectbridge.mytonwallet.org/bridge/" - } - ], - platforms: ["chrome", "windows", "macos", "linux", "ios", "android", "firefox"] - }, - { - app_name: "openmask", - name: "OpenMask", - image: "https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png", - about_url: "https://www.openmask.app/", - bridge: [ - { - type: "js", - key: "openmask" - } - ], - platforms: ["chrome"] - }, - { - app_name: "tonhub", - name: "Tonhub", - image: "https://tonhub.com/tonconnect_logo.png", - about_url: "https://tonhub.com", - universal_url: "https://tonhub.com/ton-connect", - bridge: [ - { - type: "js", - key: "tonhub" - }, - { - type: "sse", - url: "https://connect.tonhubapi.com/tonconnect" - } - ], - platforms: ["ios", "android"] - }, - { - app_name: "dewallet", - name: "DeWallet", - image: "https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png", - about_url: "https://delabwallet.com", - universal_url: "https://t.me/dewallet?attach=wallet", - bridge: [ - { - type: "sse", - url: "https://sse-bridge.delab.team/bridge" - } - ], - platforms: ["ios", "android"] - }, - { - app_name: "xtonwallet", - name: "XTONWallet", - image: "https://xtonwallet.com/assets/img/icon-256-back.png", - about_url: "https://xtonwallet.com", - bridge: [ - { - type: "js", - key: "xtonwallet" - } - ], - platforms: ["chrome", "firefox"] - }, - { - app_name: "tonwallet", - name: "TON Wallet", - image: "https://wallet.ton.org/assets/ui/qr-logo.png", - about_url: "https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd", - bridge: [ - { - type: "js", - key: "tonwallet" - } - ], - platforms: ["chrome"] - }, - { - app_name: "bitgetTonWallet", - name: "Bitget Wallet", - image: "https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png", - about_url: "https://web3.bitget.com", - deepLink: "bitkeep://", - bridge: [ - { - type: "js", - key: "bitgetTonWallet" - }, - { - type: "sse", - url: "https://bridge.tonapi.io/bridge" - } - ], - platforms: ["ios", "android", "chrome"], - universal_url: "https://bkcode.vip/ton-connect" - }, - { - app_name: "safepalwallet", - name: "SafePal", - image: "https://s.pvcliping.com/web/public_image/SafePal_x288.png", - tondns: "", - about_url: "https://www.safepal.com", - universal_url: "https://link.safepal.io/ton-connect", - deepLink: "safepal-tc://", - bridge: [ - { - type: "sse", - url: "https://ton-bridge.safepal.com/tonbridge/v1/bridge" - }, - { - type: "js", - key: "safepalwallet" - } - ], - platforms: ["ios", "android", "chrome", "firefox"] - }, - { - app_name: "okxTonWallet", - name: "OKX Wallet", - image: "https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png", - about_url: "https://www.okx.com/web3", - universal_url: "https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect", - bridge: [ - { - type: "js", - key: "okxTonWallet" - }, - { - type: "sse", - url: "https://www.okx.com/tonbridge/discover/rpc/bridge" - } - ], - platforms: ["chrome", "safari", "firefox", "ios", "android"] - }, - { - app_name: "okxTonWalletTr", - name: "OKX TR Wallet", - image: "https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png", - about_url: "https://tr.okx.com/web3", - universal_url: "https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect", - bridge: [ - { - type: "js", - key: "okxTonWallet" - }, - { - type: "sse", - url: "https://www.okx.com/tonbridge/discover/rpc/bridge" - } - ], - platforms: ["chrome", "safari", "firefox", "ios", "android"] - } -]; -class Tv { - constructor(e) { - this.walletsListCache = null, this.walletsListCacheCreationTimestamp = null, this.walletsListSource = "https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json", e != null && e.walletsListSource && (this.walletsListSource = e.walletsListSource), e != null && e.cacheTTLMs && (this.cacheTTLMs = e.cacheTTLMs); - } - getWallets() { - return Mt(this, void 0, void 0, function* () { - return this.cacheTTLMs && this.walletsListCacheCreationTimestamp && Date.now() > this.walletsListCacheCreationTimestamp + this.cacheTTLMs && (this.walletsListCache = null), this.walletsListCache || (this.walletsListCache = this.fetchWalletsList(), this.walletsListCache.then(() => { - this.walletsListCacheCreationTimestamp = Date.now(); - }).catch(() => { - this.walletsListCache = null, this.walletsListCacheCreationTimestamp = null; - })), this.walletsListCache; - }); - } - getEmbeddedWallet() { - return Mt(this, void 0, void 0, function* () { - const r = (yield this.getWallets()).filter(Ase); - return r.length !== 1 ? null : r[0]; - }); - } - fetchWalletsList() { - return Mt(this, void 0, void 0, function* () { - let e = []; - try { - if (e = yield (yield fetch(this.walletsListSource)).json(), !Array.isArray(e)) - throw new My("Wrong wallets list format, wallets list must be an array."); - const i = e.filter((s) => !this.isCorrectWalletConfigDTO(s)); - i.length && (Bo(`Wallet(s) ${i.map((s) => s.name).join(", ")} config format is wrong. They were removed from the wallets list.`), e = e.filter((s) => this.isCorrectWalletConfigDTO(s))); - } catch (n) { - Bo(n), e = Mse; - } - let r = []; - try { - r = bi.getCurrentlyInjectedWallets(); - } catch (n) { - Bo(n); - } - return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e), r); - }); - } - walletConfigDTOListToWalletConfigList(e) { - return e.map((r) => { - const i = { - name: r.name, - appName: r.app_name, - imageUrl: r.image, - aboutUrl: r.about_url, - tondns: r.tondns, - platforms: r.platforms - }; - return r.bridge.forEach((s) => { - if (s.type === "sse" && (i.bridgeUrl = s.url, i.universalLink = r.universal_url, i.deepLink = r.deepLink), s.type === "js") { - const o = s.key; - i.jsBridgeKey = o, i.injected = bi.isWalletInjected(o), i.embedded = bi.isInsideWalletBrowser(o); - } - }), i; - }); - } - mergeWalletsLists(e, r) { - return [...new Set(e.concat(r).map((i) => i.name)).values()].map((i) => { - const s = e.find((a) => a.name === i), o = r.find((a) => a.name === i); - return Object.assign(Object.assign({}, s && Object.assign({}, s)), o && Object.assign({}, o)); - }); - } - // eslint-disable-next-line complexity - isCorrectWalletConfigDTO(e) { - if (!e || typeof e != "object") - return !1; - const r = "name" in e, n = "app_name" in e, i = "image" in e, s = "about_url" in e, o = "platforms" in e; - if (!r || !i || !s || !o || !n || !e.platforms || !Array.isArray(e.platforms) || !e.platforms.length || !("bridge" in e) || !Array.isArray(e.bridge) || !e.bridge.length) - return !1; - const a = e.bridge; - if (a.some((d) => !d || typeof d != "object" || !("type" in d))) - return !1; - const u = a.find((d) => d.type === "sse"); - if (u && (!("url" in u) || !u.url || !e.universal_url)) - return !1; - const l = a.find((d) => d.type === "js"); - return !(l && (!("key" in l) || !l.key)); - } -} -class F0 extends jt { - get info() { - return "Wallet doesn't support requested feature method."; - } - constructor(...e) { - super(...e), Object.setPrototypeOf(this, F0.prototype); - } -} -function Ise(t, e) { - const r = t.includes("SendTransaction"), n = t.find((i) => i && typeof i == "object" && i.name === "SendTransaction"); - if (!r && !n) - throw new F0("Wallet doesn't support SendTransaction feature."); - if (n && n.maxMessages !== void 0) { - if (n.maxMessages < e.requiredMessagesNumber) - throw new F0(`Wallet is not able to handle such SendTransaction request. Max support messages number is ${n.maxMessages}, but ${e.requiredMessagesNumber} is required.`); - return; - } - dse("Connected wallet didn't provide information about max allowed messages in the SendTransaction request. Request may be rejected by the wallet."); -} -function Cse() { - return { - type: "request-version" - }; -} -function Tse(t) { - return { - type: "response-version", - version: t - }; -} -function nf(t) { - return { - ton_connect_sdk_lib: t.ton_connect_sdk_lib, - ton_connect_ui_lib: t.ton_connect_ui_lib - }; -} -function sf(t, e) { - var r, n, i, s, o, a, u, l; - const p = ((r = e == null ? void 0 : e.connectItems) === null || r === void 0 ? void 0 : r.tonProof) && "proof" in e.connectItems.tonProof ? "ton_proof" : "ton_addr"; - return { - wallet_address: (i = (n = e == null ? void 0 : e.account) === null || n === void 0 ? void 0 : n.address) !== null && i !== void 0 ? i : null, - wallet_type: (s = e == null ? void 0 : e.device.appName) !== null && s !== void 0 ? s : null, - wallet_version: (o = e == null ? void 0 : e.device.appVersion) !== null && o !== void 0 ? o : null, - auth_type: p, - custom_data: Object.assign({ chain_id: (u = (a = e == null ? void 0 : e.account) === null || a === void 0 ? void 0 : a.chain) !== null && u !== void 0 ? u : null, provider: (l = e == null ? void 0 : e.provider) !== null && l !== void 0 ? l : null }, nf(t)) - }; -} -function Rse(t) { - return { - type: "connection-started", - custom_data: nf(t) - }; -} -function Dse(t, e) { - return Object.assign({ type: "connection-completed", is_success: !0 }, sf(t, e)); -} -function Ose(t, e, r) { - return { - type: "connection-error", - is_success: !1, - error_message: e, - error_code: r ?? null, - custom_data: nf(t) - }; -} -function Nse(t) { - return { - type: "connection-restoring-started", - custom_data: nf(t) - }; -} -function Lse(t, e) { - return Object.assign({ type: "connection-restoring-completed", is_success: !0 }, sf(t, e)); -} -function kse(t, e) { - return { - type: "connection-restoring-error", - is_success: !1, - error_message: e, - custom_data: nf(t) - }; -} -function Iy(t, e) { - var r, n, i, s; - return { - valid_until: (r = String(e.validUntil)) !== null && r !== void 0 ? r : null, - from: (s = (n = e.from) !== null && n !== void 0 ? n : (i = t == null ? void 0 : t.account) === null || i === void 0 ? void 0 : i.address) !== null && s !== void 0 ? s : null, - messages: e.messages.map((o) => { - var a, u; - return { - address: (a = o.address) !== null && a !== void 0 ? a : null, - amount: (u = o.amount) !== null && u !== void 0 ? u : null - }; - }) - }; -} -function $se(t, e, r) { - return Object.assign(Object.assign({ type: "transaction-sent-for-signature" }, sf(t, e)), Iy(e, r)); -} -function Bse(t, e, r, n) { - return Object.assign(Object.assign({ type: "transaction-signed", is_success: !0, signed_transaction: n.boc }, sf(t, e)), Iy(e, r)); -} -function Fse(t, e, r, n, i) { - return Object.assign(Object.assign({ type: "transaction-signing-failed", is_success: !1, error_message: n, error_code: i ?? null }, sf(t, e)), Iy(e, r)); -} -function jse(t, e, r) { - return Object.assign({ type: "disconnection", scope: r }, sf(t, e)); -} -class Use { - constructor() { - this.window = Wp(); - } - /** - * Dispatches an event with the given name and details to the browser window. - * @param eventName - The name of the event to dispatch. - * @param eventDetails - The details of the event to dispatch. - * @returns A promise that resolves when the event has been dispatched. - */ - dispatchEvent(e, r) { - var n; - return Mt(this, void 0, void 0, function* () { - const i = new CustomEvent(e, { detail: r }); - (n = this.window) === null || n === void 0 || n.dispatchEvent(i); - }); - } - /** - * Adds an event listener to the browser window. - * @param eventName - The name of the event to listen for. - * @param listener - The listener to add. - * @param options - The options for the listener. - * @returns A function that removes the listener. - */ - addEventListener(e, r, n) { - var i; - return Mt(this, void 0, void 0, function* () { - return (i = this.window) === null || i === void 0 || i.addEventListener(e, r, n), () => { - var s; - return (s = this.window) === null || s === void 0 ? void 0 : s.removeEventListener(e, r); - }; - }); - } -} -class qse { - constructor(e) { - var r; - this.eventPrefix = "ton-connect-", this.tonConnectUiVersion = null, this.eventDispatcher = (r = e == null ? void 0 : e.eventDispatcher) !== null && r !== void 0 ? r : new Use(), this.tonConnectSdkVersion = e.tonConnectSdkVersion, this.init().catch(); - } - /** - * Version of the library. - */ - get version() { - return nf({ - ton_connect_sdk_lib: this.tonConnectSdkVersion, - ton_connect_ui_lib: this.tonConnectUiVersion - }); - } - /** - * Called once when the tracker is created and request version other libraries. - */ - init() { - return Mt(this, void 0, void 0, function* () { - try { - yield this.setRequestVersionHandler(), this.tonConnectUiVersion = yield this.requestTonConnectUiVersion(); - } catch { - } - }); - } - /** - * Set request version handler. - * @private - */ - setRequestVersionHandler() { - return Mt(this, void 0, void 0, function* () { - yield this.eventDispatcher.addEventListener("ton-connect-request-version", () => Mt(this, void 0, void 0, function* () { - yield this.eventDispatcher.dispatchEvent("ton-connect-response-version", Tse(this.tonConnectSdkVersion)); - })); - }); - } - /** - * Request TonConnect UI version. - * @private - */ - requestTonConnectUiVersion() { - return Mt(this, void 0, void 0, function* () { - return new Promise((e, r) => Mt(this, void 0, void 0, function* () { - try { - yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version", (n) => { - e(n.detail.version); - }, { once: !0 }), yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version", Cse()); - } catch (n) { - r(n); - } - })); - }); - } - /** - * Emit user action event to the window. - * @param eventDetails - * @private - */ - dispatchUserActionEvent(e) { - try { - this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`, e).catch(); - } catch { - } - } - /** - * Track connection init event. - * @param args - */ - trackConnectionStarted(...e) { - try { - const r = Rse(this.version, ...e); - this.dispatchUserActionEvent(r); - } catch { - } - } - /** - * Track connection success event. - * @param args - */ - trackConnectionCompleted(...e) { - try { - const r = Dse(this.version, ...e); - this.dispatchUserActionEvent(r); - } catch { - } - } - /** - * Track connection error event. - * @param args - */ - trackConnectionError(...e) { - try { - const r = Ose(this.version, ...e); - this.dispatchUserActionEvent(r); - } catch { - } - } - /** - * Track connection restoring init event. - * @param args - */ - trackConnectionRestoringStarted(...e) { - try { - const r = Nse(this.version, ...e); - this.dispatchUserActionEvent(r); - } catch { - } - } - /** - * Track connection restoring success event. - * @param args - */ - trackConnectionRestoringCompleted(...e) { - try { - const r = Lse(this.version, ...e); - this.dispatchUserActionEvent(r); - } catch { - } - } - /** - * Track connection restoring error event. - * @param args - */ - trackConnectionRestoringError(...e) { - try { - const r = kse(this.version, ...e); - this.dispatchUserActionEvent(r); - } catch { - } - } - /** - * Track disconnect event. - * @param args - */ - trackDisconnection(...e) { - try { - const r = jse(this.version, ...e); - this.dispatchUserActionEvent(r); - } catch { - } - } - /** - * Track transaction init event. - * @param args - */ - trackTransactionSentForSignature(...e) { - try { - const r = $se(this.version, ...e); - this.dispatchUserActionEvent(r); - } catch { - } - } - /** - * Track transaction signed event. - * @param args - */ - trackTransactionSigned(...e) { - try { - const r = Bse(this.version, ...e); - this.dispatchUserActionEvent(r); - } catch { - } - } - /** - * Track transaction error event. - * @param args - */ - trackTransactionSigningFailed(...e) { - try { - const r = Fse(this.version, ...e); - this.dispatchUserActionEvent(r); - } catch { - } - } -} -const zse = "3.0.5"; -class yh { - constructor(e) { - if (this.walletsList = new Tv(), this._wallet = null, this.provider = null, this.statusChangeSubscriptions = [], this.statusChangeErrorSubscriptions = [], this.dappSettings = { - manifestUrl: (e == null ? void 0 : e.manifestUrl) || wse(), - storage: (e == null ? void 0 : e.storage) || new Sse() - }, this.walletsList = new Tv({ - walletsListSource: e == null ? void 0 : e.walletsListSource, - cacheTTLMs: e == null ? void 0 : e.walletsListCacheTTLMs - }), this.tracker = new qse({ - eventDispatcher: e == null ? void 0 : e.eventDispatcher, - tonConnectSdkVersion: zse - }), !this.dappSettings.manifestUrl) - throw new Sy("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"); - this.bridgeConnectionStorage = new Wl(this.dappSettings.storage), e != null && e.disableAutoPauseConnection || this.addWindowFocusAndBlurSubscriptions(); - } - /** - * Returns available wallets list. - */ - static getWallets() { - return this.walletsList.getWallets(); - } - /** - * Shows if the wallet is connected right now. - */ - get connected() { - return this._wallet !== null; - } - /** - * Current connected account or null if no account is connected. - */ - get account() { - var e; - return ((e = this._wallet) === null || e === void 0 ? void 0 : e.account) || null; - } - /** - * Current connected wallet or null if no account is connected. - */ - get wallet() { - return this._wallet; - } - set wallet(e) { - this._wallet = e, this.statusChangeSubscriptions.forEach((r) => r(this._wallet)); - } - /** - * Returns available wallets list. - */ - getWallets() { - return this.walletsList.getWallets(); - } - /** - * Allows to subscribe to connection status changes and handle connection errors. - * @param callback will be called after connections status changes with actual wallet or null. - * @param errorsHandler (optional) will be called with some instance of TonConnectError when connect error is received. - * @returns unsubscribe callback. - */ - onStatusChange(e, r) { - return this.statusChangeSubscriptions.push(e), r && this.statusChangeErrorSubscriptions.push(r), () => { - this.statusChangeSubscriptions = this.statusChangeSubscriptions.filter((n) => n !== e), r && (this.statusChangeErrorSubscriptions = this.statusChangeErrorSubscriptions.filter((n) => n !== r)); - }; - } - connect(e, r) { - var n, i; - const s = {}; - if (typeof r == "object" && "tonProof" in r && (s.request = r), typeof r == "object" && ("openingDeadlineMS" in r || "signal" in r || "request" in r) && (s.request = r == null ? void 0 : r.request, s.openingDeadlineMS = r == null ? void 0 : r.openingDeadlineMS, s.signal = r == null ? void 0 : r.signal), this.connected) - throw new Ay(); - const o = As(s == null ? void 0 : s.signal); - if ((n = this.abortController) === null || n === void 0 || n.abort(), this.abortController = o, o.signal.aborted) - throw new jt("Connection was aborted"); - return (i = this.provider) === null || i === void 0 || i.closeConnection(), this.provider = this.createProvider(e), o.signal.addEventListener("abort", () => { - var a; - (a = this.provider) === null || a === void 0 || a.closeConnection(), this.provider = null; - }), this.tracker.trackConnectionStarted(), this.provider.connect(this.createConnectRequest(s == null ? void 0 : s.request), { - openingDeadlineMS: s == null ? void 0 : s.openingDeadlineMS, - signal: o.signal - }); - } - /** - * Try to restore existing session and reconnect to the corresponding wallet. Call it immediately when your app is loaded. - */ - restoreConnection(e) { - var r, n; - return Mt(this, void 0, void 0, function* () { - this.tracker.trackConnectionRestoringStarted(); - const i = As(e == null ? void 0 : e.signal); - if ((r = this.abortController) === null || r === void 0 || r.abort(), this.abortController = i, i.signal.aborted) { - this.tracker.trackConnectionRestoringError("Connection restoring was aborted"); - return; - } - const [s, o] = yield Promise.all([ - this.bridgeConnectionStorage.storedConnectionType(), - this.walletsList.getEmbeddedWallet() - ]); - if (i.signal.aborted) { - this.tracker.trackConnectionRestoringError("Connection restoring was aborted"); - return; - } - let a = null; - try { - switch (s) { - case "http": - a = yield Hl.fromStorage(this.dappSettings.storage); - break; - case "injected": - a = yield bi.fromStorage(this.dappSettings.storage); - break; - default: - if (o) - a = this.createProvider(o); - else - return; - } - } catch { - this.tracker.trackConnectionRestoringError("Provider is not restored"), yield this.bridgeConnectionStorage.removeConnection(), a == null || a.closeConnection(), a = null; - return; - } - if (i.signal.aborted) { - a == null || a.closeConnection(), this.tracker.trackConnectionRestoringError("Connection restoring was aborted"); - return; - } - if (!a) { - Bo("Provider is not restored"), this.tracker.trackConnectionRestoringError("Provider is not restored"); - return; - } - (n = this.provider) === null || n === void 0 || n.closeConnection(), this.provider = a, a.listen(this.walletEventsListener.bind(this)); - const u = () => { - this.tracker.trackConnectionRestoringError("Connection restoring was aborted"), a == null || a.closeConnection(), a = null; - }; - i.signal.addEventListener("abort", u); - const l = ol((p) => Mt(this, void 0, void 0, function* () { - yield a == null ? void 0 : a.restoreConnection({ - openingDeadlineMS: e == null ? void 0 : e.openingDeadlineMS, - signal: p.signal - }), i.signal.removeEventListener("abort", u), this.connected ? this.tracker.trackConnectionRestoringCompleted(this.wallet) : this.tracker.trackConnectionRestoringError("Connection restoring failed"); - }), { - attempts: Number.MAX_SAFE_INTEGER, - delayMs: 2e3, - signal: e == null ? void 0 : e.signal - }), d = new Promise( - (p) => setTimeout(() => p(), 12e3) - // connection deadline - ); - return Promise.race([l, d]); - }); - } - sendTransaction(e, r) { - return Mt(this, void 0, void 0, function* () { - const n = {}; - typeof r == "function" ? n.onRequestSent = r : (n.onRequestSent = r == null ? void 0 : r.onRequestSent, n.signal = r == null ? void 0 : r.signal); - const i = As(n == null ? void 0 : n.signal); - if (i.signal.aborted) - throw new jt("Transaction sending was aborted"); - this.checkConnection(), Ise(this.wallet.device.features, { - requiredMessagesNumber: e.messages.length - }), this.tracker.trackTransactionSentForSignature(this.wallet, e); - const { validUntil: s } = e, o = nse(e, ["validUntil"]), a = e.from || this.account.address, u = e.network || this.account.chain, l = yield this.provider.sendRequest(Rd.convertToRpcRequest(Object.assign(Object.assign({}, o), { - valid_until: s, - from: a, - network: u - })), { onRequestSent: n.onRequestSent, signal: i.signal }); - if (Rd.isError(l)) - return this.tracker.trackTransactionSigningFailed(this.wallet, e, l.error.message, l.error.code), Rd.parseAndThrowError(l); - const d = Rd.convertFromRpcResponse(l); - return this.tracker.trackTransactionSigned(this.wallet, e, d), d; - }); - } - /** - * Disconnect form thw connected wallet and drop current session. - */ - disconnect(e) { - var r; - return Mt(this, void 0, void 0, function* () { - if (!this.connected) - throw new B0(); - const n = As(e == null ? void 0 : e.signal), i = this.abortController; - if (this.abortController = n, n.signal.aborted) - throw new jt("Disconnect was aborted"); - this.onWalletDisconnected("dapp"), yield (r = this.provider) === null || r === void 0 ? void 0 : r.disconnect({ - signal: n.signal - }), i == null || i.abort(); - }); - } - /** - * Pause bridge HTTP connection. Might be helpful, if you want to pause connections while browser tab is unfocused, - * or if you use SDK with NodeJS and want to save server resources. - */ - pauseConnection() { - var e; - ((e = this.provider) === null || e === void 0 ? void 0 : e.type) === "http" && this.provider.pause(); - } - /** - * Unpause bridge HTTP connection if it is paused. - */ - unPauseConnection() { - var e; - return ((e = this.provider) === null || e === void 0 ? void 0 : e.type) !== "http" ? Promise.resolve() : this.provider.unPause(); - } - addWindowFocusAndBlurSubscriptions() { - const e = yse(); - if (e) - try { - e.addEventListener("visibilitychange", () => { - e.hidden ? this.pauseConnection() : this.unPauseConnection().catch(); - }); - } catch (r) { - Bo("Cannot subscribe to the document.visibilitychange: ", r); - } - } - createProvider(e) { - let r; - return !Array.isArray(e) && ise(e) ? r = new bi(this.dappSettings.storage, e.jsBridgeKey) : r = new Hl(this.dappSettings.storage, e), r.listen(this.walletEventsListener.bind(this)), r; - } - walletEventsListener(e) { - switch (e.event) { - case "connect": - this.onWalletConnected(e.payload); - break; - case "connect_error": - this.onWalletConnectError(e.payload); - break; - case "disconnect": - this.onWalletDisconnected("wallet"); - } - } - onWalletConnected(e) { - const r = e.items.find((s) => s.name === "ton_addr"), n = e.items.find((s) => s.name === "ton_proof"); - if (!r) - throw new jt("ton_addr connection item was not found"); - const i = { - device: e.device, - provider: this.provider.type, - account: { - address: r.address, - chain: r.network, - walletStateInit: r.walletStateInit, - publicKey: r.publicKey - } - }; - n && (i.connectItems = { - tonProof: n - }), this.wallet = i, this.tracker.trackConnectionCompleted(i); - } - onWalletConnectError(e) { - const r = ose.parseError(e); - if (this.statusChangeErrorSubscriptions.forEach((n) => n(r)), An(r), this.tracker.trackConnectionError(e.message, e.code), r instanceof jp || r instanceof Fp) - throw Bo(r), r; - } - onWalletDisconnected(e) { - this.tracker.trackDisconnection(this.wallet, e), this.wallet = null; - } - checkConnection() { - if (!this.connected) - throw new B0(); - } - createConnectRequest(e) { - const r = [ - { - name: "ton_addr" - } - ]; - return e != null && e.tonProof && r.push({ - name: "ton_proof", - payload: e.tonProof - }), { - manifestUrl: this.dappSettings.manifestUrl, - items: r - }; - } -} -yh.walletsList = new Tv(); -yh.isWalletInjected = (t) => bi.isWalletInjected(t); -yh.isInsideWalletBrowser = (t) => bi.isInsideWalletBrowser(t); -for (let t = 0; t <= 255; t++) { - let e = t.toString(16); - e.length < 2 && (e = "0" + e); -} -function c1(t) { - const { children: e, onClick: r } = t; - return /* @__PURE__ */ le.jsx("button", { onClick: r, className: "xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center", children: e }); -} -function IA(t) { - const { wallet: e, connector: r, loading: n } = t, i = Qn(null), s = Qn(), [o, a] = Yt(), [u, l] = Yt(), [d, p] = Yt("connect"), [w, _] = Yt(!1), [P, O] = Yt(); - function L(K) { - var ge; - (ge = s.current) == null || ge.update({ - data: K - }); - } - async function B() { - _(!0); - try { - a(""); - const K = await ka.getNonce({ account_type: "block_chain" }); - if ("universalLink" in e && e.universalLink) { - const ge = r.connect({ - universalLink: e.universalLink, - bridgeUrl: e.bridgeUrl - }, { - request: { tonProof: K } - }); - if (!ge) return; - O(ge), L(ge), l(K); - } - } catch (K) { - a(K.message); - } - _(!1); - } - function k() { - s.current = new dA({ - width: 264, - height: 264, - margin: 0, - type: "svg", - qrOptions: { - errorCorrectionLevel: "M" - }, - dotsOptions: { - color: "black", - type: "rounded" - }, - backgroundOptions: { - color: "transparent" - } - }), s.current.append(i.current); - } - function W() { - r.connect(e, { - request: { tonProof: u } - }); - } - function U() { - if ("deepLink" in e) { - if (!e.deepLink || !P) return; - const K = new URL(P), ge = `${e.deepLink}${K.search}`; - window.open(ge); - } - } - function V() { - "universalLink" in e && e.universalLink && /t.me/.test(e.universalLink) && window.open(P); - } - const Q = wi(() => !!("deepLink" in e && e.deepLink), [e]), R = wi(() => !!("universalLink" in e && e.universalLink && /t.me/.test(e.universalLink)), [e]); - return Dn(() => { - k(), B(); - }, []), /* @__PURE__ */ le.jsxs(Rs, { children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(kc, { title: "Connect wallet", onBack: t.onBack }) }), - /* @__PURE__ */ le.jsxs("div", { className: "xc-text-center xc-mb-6", children: [ - /* @__PURE__ */ le.jsxs("div", { className: "xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1", children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center", ref: i }), - /* @__PURE__ */ le.jsx("div", { className: "xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center", children: w ? /* @__PURE__ */ le.jsx(Sc, { className: "xc-h-6 xc-w-6 xc-animate-spin xc-text-black", size: 20 }) : /* @__PURE__ */ le.jsx("img", { className: "xc-h-10 xc-w-10 xc-rounded-md", src: e.imageUrl }) }) - ] }), - /* @__PURE__ */ le.jsx("p", { className: "xc-text-center", children: "Scan the QR code below with your phone's camera. " }) - ] }), - /* @__PURE__ */ le.jsxs("div", { className: "xc-flex xc-justify-center xc-gap-2", children: [ - n && /* @__PURE__ */ le.jsx(Sc, { className: "xc-animate-spin" }), - !w && !n && /* @__PURE__ */ le.jsxs(le.Fragment, { children: [ - MA(e) && /* @__PURE__ */ le.jsxs(c1, { onClick: W, children: [ - /* @__PURE__ */ le.jsx(YZ, { className: "xc-opacity-80" }), - "Extension" - ] }), - Q && /* @__PURE__ */ le.jsxs(c1, { onClick: U, children: [ - /* @__PURE__ */ le.jsx(y7, { className: "xc-opacity-80" }), - "Desktop" - ] }), - R && /* @__PURE__ */ le.jsx(c1, { onClick: V, children: "Telegram Mini App" }) - ] }) - ] }) - ] }); -} -function Wse(t) { - const [e, r] = Yt(""), [n, i] = Yt(), [s, o] = Yt(), a = Ey(), [u, l] = Yt(!1); - async function d(w) { - var P, O; - if (!w || !((P = w.connectItems) != null && P.tonProof)) return; - l(!0); - const _ = await ka.tonLogin({ - account_type: "block_chain", - connector: "codatta_ton", - account_enum: "C", - wallet_name: w == null ? void 0 : w.device.appName, - inviter_code: a.inviterCode, - address: w.account.address, - chain: w.account.chain, - connect_info: [ - { name: "ton_addr", network: w.account.chain, ...w.account }, - (O = w.connectItems) == null ? void 0 : O.tonProof - ], - source: { - device: a.device, - channel: a.channel, - app: a.app - } - }); - await t.onLogin(_.data), l(!1); - } - Dn(() => { - const w = new yh({ - manifestUrl: "https://static.codatta.io/static/tonconnect-manifest.json?v=2" - }), _ = w.onStatusChange(d); - return o(w), r("select"), _; - }, []); - function p(w) { - r("connect"), i(w); - } - return /* @__PURE__ */ le.jsxs(Rs, { children: [ - e === "select" && /* @__PURE__ */ le.jsx( - yA, - { - connector: s, - onSelect: p, - onBack: t.onBack - } - ), - e === "connect" && /* @__PURE__ */ le.jsx( - IA, - { - connector: s, - wallet: n, - onBack: t.onBack, - loading: u - } - ) - ] }); -} -function CA(t) { - const { children: e, className: r } = t, n = Qn(null), [i, s] = Rv.useState(0); - function o() { - var a; - try { - const u = ((a = n.current) == null ? void 0 : a.children) || []; - let l = 0; - for (let d = 0; d < u.length; d++) - l += u[d].offsetHeight; - s(l); - } catch (u) { - console.error(u); - } - } - return Dn(() => { - const a = new MutationObserver(o); - return a.observe(n.current, { childList: !0, subtree: !0 }), () => a.disconnect(); - }, []), Dn(() => { - console.log("maxHeight", i); - }, [i]), /* @__PURE__ */ le.jsx( - "div", - { - ref: n, - className: r, - style: { - transition: "all 0.2s ease-in-out", - overflow: "hidden", - height: i - }, - children: e - } - ); -} -function Hse() { - return /* @__PURE__ */ le.jsxs("svg", { width: "121", height: "120", viewBox: "0 0 121 120", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [ - /* @__PURE__ */ le.jsx("rect", { x: "0.5", width: "120", height: "120", rx: "60", fill: "#404049" }), - /* @__PURE__ */ le.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z", fill: "#252532" }), - /* @__PURE__ */ le.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z", fill: "#252532" }), - /* @__PURE__ */ le.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z", fill: "#404049" }), - /* @__PURE__ */ le.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z", stroke: "#77777D", "stroke-width": "2" }), - /* @__PURE__ */ le.jsx("path", { d: "M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829", stroke: "#77777D", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) - ] }); -} -function TA(t) { - const { wallets: e } = Tp(), [r, n] = Yt(), i = wi(() => r ? e.filter((a) => a.key.toLowerCase().includes(r.toLowerCase())) : e, [r]); - function s(a) { - t.onSelectWallet(a); - } - function o(a) { - n(a.target.value); - } - return /* @__PURE__ */ le.jsxs(Rs, { children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(kc, { title: "Select wallet", onBack: t.onBack }) }), - /* @__PURE__ */ le.jsxs("div", { className: "xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40", children: [ - /* @__PURE__ */ le.jsx(w7, { className: "xc-shrink-0 xc-opacity-50" }), - /* @__PURE__ */ le.jsx("input", { type: "text", className: "xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none", placeholder: "Search wallet", onInput: o }) - ] }), - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: i.length ? i.map((a) => /* @__PURE__ */ le.jsx( - V9, - { - wallet: a, - onClick: s - }, - `feature-${a.key}` - )) : /* @__PURE__ */ le.jsx(Hse, {}) }) - ] }); -} -function nae(t) { - const { onLogin: e, header: r, showEmailSignIn: n = !0, showMoreWallets: i = !0, showTonConnect: s = !0, showFeaturedWallets: o = !0 } = t, [a, u] = Yt(""), [l, d] = Yt(null), [p, w] = Yt(""); - function _(B) { - d(B), u("evm-wallet"); - } - function P(B) { - u("email"), w(B); - } - async function O(B) { - await e(B); - } - function L() { - u("ton-wallet"); - } - return Dn(() => { - u("index"); - }, []), /* @__PURE__ */ le.jsx(fie, { config: t.config, children: /* @__PURE__ */ le.jsxs(CA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ - a === "evm-wallet" && /* @__PURE__ */ le.jsx( - Vie, - { - onBack: () => u("index"), - onLogin: O, - wallet: l - } - ), - a === "ton-wallet" && /* @__PURE__ */ le.jsx( - Wse, - { - onBack: () => u("index"), - onLogin: O - } - ), - a === "email" && /* @__PURE__ */ le.jsx(Aie, { email: p, onBack: () => u("index"), onLogin: O }), - a === "index" && /* @__PURE__ */ le.jsx( - tA, - { - header: r, - onEmailConfirm: P, - onSelectWallet: _, - onSelectMoreWallets: () => { - u("all-wallet"); - }, - onSelectTonConnect: L, - config: { - showEmailSignIn: n, - showFeaturedWallets: o, - showMoreWallets: i, - showTonConnect: s - } - } - ), - a === "all-wallet" && /* @__PURE__ */ le.jsx( - TA, - { - onBack: () => u("index"), - onSelectWallet: _ - } - ) - ] }) }); -} -function Kse(t) { - const { wallet: e, onConnect: r } = t, [n, i] = Yt(e.installed ? "connect" : "qr"); - async function s(o, a) { - await r(o, a); - } - return /* @__PURE__ */ le.jsxs(Rs, { children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ le.jsx(kc, { title: "Connect wallet", onBack: t.onBack }) }), - n === "qr" && /* @__PURE__ */ le.jsx( - mA, - { - wallet: e, - onGetExtension: () => i("get-extension"), - onSignFinish: s - } - ), - n === "connect" && /* @__PURE__ */ le.jsx( - vA, - { - onShowQrCode: () => i("qr"), - wallet: e, - onSignFinish: s - } - ), - n === "get-extension" && /* @__PURE__ */ le.jsx(bA, { wallet: e }) - ] }); -} -function Vse(t) { - const { email: e } = t, [r, n] = Yt("captcha"); - return /* @__PURE__ */ le.jsxs(Rs, { children: [ - /* @__PURE__ */ le.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ le.jsx(kc, { title: "Sign in with email", onBack: t.onBack }) }), - r === "captcha" && /* @__PURE__ */ le.jsx(lA, { email: e, onCodeSend: () => n("verify-email") }), - r === "verify-email" && /* @__PURE__ */ le.jsx(fA, { email: e, onInputCode: t.onInputCode, onResendCode: () => n("captcha") }) - ] }); -} -function iae(t) { - const { onEvmWalletConnect: e, onTonWalletConnect: r, onEmailConnect: n, config: i = { - showEmailSignIn: !1, - showFeaturedWallets: !0, - showMoreWallets: !0, - showTonConnect: !0 - } } = t, [s, o] = Yt(""), [a, u] = Yt(), [l, d] = Yt(), p = Qn(), [w, _] = Yt(""); - function P(U) { - u(U), o("evm-wallet-connect"); - } - function O(U) { - _(U), o("email-connect"); - } - async function L(U, V) { - await (e == null ? void 0 : e({ - chain_type: "eip155", - client: U.client, - connect_info: V, - wallet: U - })), o("index"); - } - async function B(U, V) { - await (n == null ? void 0 : n(U, V)); - } - function k(U) { - d(U), o("ton-wallet-connect"); - } - async function W(U) { - U && await (r == null ? void 0 : r({ - chain_type: "ton", - client: p.current, - connect_info: U, - wallet: U - })); - } - return Dn(() => { - p.current = new yh({ - manifestUrl: "https://static.codatta.io/static/tonconnect-manifest.json?v=2" - }); - const U = p.current.onStatusChange(W); - return o("index"), U; - }, []), /* @__PURE__ */ le.jsxs(CA, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ - s === "evm-wallet-select" && /* @__PURE__ */ le.jsx( - TA, - { - onBack: () => o("index"), - onSelectWallet: P - } - ), - s === "evm-wallet-connect" && /* @__PURE__ */ le.jsx( - Kse, - { - onBack: () => o("index"), - onConnect: L, - wallet: a - } - ), - s === "ton-wallet-select" && /* @__PURE__ */ le.jsx( - yA, - { - connector: p.current, - onSelect: k, - onBack: () => o("index") - } - ), - s === "ton-wallet-connect" && /* @__PURE__ */ le.jsx( - IA, - { - connector: p.current, - wallet: l, - onBack: () => o("index") - } - ), - s === "email-connect" && /* @__PURE__ */ le.jsx(Vse, { email: w, onBack: () => o("index"), onInputCode: B }), - s === "index" && /* @__PURE__ */ le.jsx( - tA, - { - onEmailConfirm: O, - onSelectWallet: P, - onSelectMoreWallets: () => o("evm-wallet-select"), - onSelectTonConnect: () => o("ton-wallet-select"), - config: i - } - ) - ] }); -} -export { - tae as C, - V5 as H, - yu as W, - mc as a, - XD as b, - Qse as c, - Xse as d, - cl as e, - n0 as f, - r0 as g, - Zse as h, - HD as i, - UZ as j, - nae as k, - iae as l, - eoe as r, - qN as s, - q0 as t, - Tp as u -}; diff --git a/dist/secp256k1-BScNrxtE.js b/dist/secp256k1-DbKZjSuc.js similarity index 99% rename from dist/secp256k1-BScNrxtE.js rename to dist/secp256k1-DbKZjSuc.js index 310528c..746d1a9 100644 --- a/dist/secp256k1-BScNrxtE.js +++ b/dist/secp256k1-DbKZjSuc.js @@ -1,4 +1,4 @@ -import { a as at, b as st, h as xt, i as Tt, c as F, H as Jt, d as te, t as ee, e as ne, f as qt, g as re, r as oe, s as ie } from "./main-L4HtPONr.js"; +import { h as xt, i as Tt, a as at, b as st, c as F, H as Jt, d as te, t as ee, e as ne, f as qt, g as re, r as oe, s as ie } from "./main-D60MaR66.js"; /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const St = /* @__PURE__ */ BigInt(0), Et = /* @__PURE__ */ BigInt(1); function lt(e, n) { diff --git a/dist/style.css b/dist/style.css deleted file mode 100644 index 1c4b1ca..0000000 --- a/dist/style.css +++ /dev/null @@ -1 +0,0 @@ -*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.xc-pointer-events-none{pointer-events:none}.xc-absolute{position:absolute}.xc-relative{position:relative}.xc-inset-0{top:0;right:0;bottom:0;left:0}.xc-left-0{left:0}.xc-right-2{right:.5rem}.xc-top-0{top:0}.xc-z-10{z-index:10}.xc-m-auto{margin:auto}.xc-mx-auto{margin-left:auto;margin-right:auto}.xc-mb-1{margin-bottom:.25rem}.xc-mb-12{margin-bottom:3rem}.xc-mb-2{margin-bottom:.5rem}.xc-mb-3{margin-bottom:.75rem}.xc-mb-4{margin-bottom:1rem}.xc-mb-6{margin-bottom:1.5rem}.xc-mb-8{margin-bottom:2rem}.xc-ml-auto{margin-left:auto}.xc-mt-4{margin-top:1rem}.xc-box-content{box-sizing:content-box}.xc-block{display:block}.xc-inline-block{display:inline-block}.xc-flex{display:flex}.xc-grid{display:grid}.xc-aspect-\[1\/1\]{aspect-ratio:1/1}.xc-h-1{height:.25rem}.xc-h-10{height:2.5rem}.xc-h-12{height:3rem}.xc-h-16{height:4rem}.xc-h-4{height:1rem}.xc-h-5{height:1.25rem}.xc-h-6{height:1.5rem}.xc-h-\[309px\]{height:309px}.xc-h-full{height:100%}.xc-h-screen{height:100vh}.xc-max-h-\[272px\]{max-height:272px}.xc-max-h-\[309px\]{max-height:309px}.xc-w-1{width:.25rem}.xc-w-10{width:2.5rem}.xc-w-12{width:3rem}.xc-w-16{width:4rem}.xc-w-5{width:1.25rem}.xc-w-6{width:1.5rem}.xc-w-full{width:100%}.xc-w-px{width:1px}.xc-min-w-\[160px\]{min-width:160px}.xc-min-w-\[277px\]{min-width:277px}.xc-max-w-\[272px\]{max-width:272px}.xc-max-w-\[400px\]{max-width:400px}.xc-max-w-\[420px\]{max-width:420px}.xc-flex-1{flex:1 1 0%}.xc-shrink-0{flex-shrink:0}@keyframes xc-caret-blink{0%,70%,to{opacity:1}20%,50%{opacity:0}}.xc-animate-caret-blink{animation:xc-caret-blink 1.25s ease-out infinite}@keyframes xc-spin{to{transform:rotate(360deg)}}.xc-animate-spin{animation:xc-spin 1s linear infinite}.xc-cursor-pointer{cursor:pointer}.xc-appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.xc-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.xc-flex-col{flex-direction:column}.xc-flex-wrap{flex-wrap:wrap}.xc-items-center{align-items:center}.xc-justify-center{justify-content:center}.xc-justify-between{justify-content:space-between}.xc-gap-2{gap:.5rem}.xc-gap-3{gap:.75rem}.xc-gap-4{gap:1rem}.xc-overflow-hidden{overflow:hidden}.xc-overflow-scroll{overflow:scroll}.xc-rounded-2xl{border-radius:1rem}.xc-rounded-full{border-radius:9999px}.xc-rounded-lg{border-radius:.5rem}.xc-rounded-md{border-radius:.375rem}.xc-rounded-xl{border-radius:.75rem}.xc-border{border-width:1px}.xc-border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.xc-border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.xc-border-opacity-15{--tw-border-opacity: .15}.xc-border-opacity-20{--tw-border-opacity: .2}.xc-bg-\[\#009E8C\]{--tw-bg-opacity: 1;background-color:rgb(0 158 140 / var(--tw-bg-opacity, 1))}.xc-bg-\[\#2596FF\]{--tw-bg-opacity: 1;background-color:rgb(37 150 255 / var(--tw-bg-opacity, 1))}.xc-bg-\[rgb\(135\,93\,255\)\]{--tw-bg-opacity: 1;background-color:rgb(135 93 255 / var(--tw-bg-opacity, 1))}.xc-bg-\[rgb\(28\,28\,38\)\]{--tw-bg-opacity: 1;background-color:rgb(28 28 38 / var(--tw-bg-opacity, 1))}.xc-bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.xc-bg-transparent{background-color:transparent}.xc-bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.xc-bg-opacity-10{--tw-bg-opacity: .1}.xc-p-1{padding:.25rem}.xc-p-6{padding:1.5rem}.xc-px-3{padding-left:.75rem;padding-right:.75rem}.xc-px-4{padding-left:1rem;padding-right:1rem}.xc-px-6{padding-left:1.5rem;padding-right:1.5rem}.xc-px-8{padding-left:2rem;padding-right:2rem}.xc-py-1{padding-top:.25rem;padding-bottom:.25rem}.xc-py-2{padding-top:.5rem;padding-bottom:.5rem}.xc-py-3{padding-top:.75rem;padding-bottom:.75rem}.xc-text-center{text-align:center}.xc-text-2xl{font-size:1.5rem;line-height:2rem}.xc-text-lg{font-size:1.125rem;line-height:1.75rem}.xc-text-sm{font-size:.875rem;line-height:1.25rem}.xc-text-xl{font-size:1.25rem;line-height:1.75rem}.xc-text-xs{font-size:.75rem;line-height:1rem}.xc-font-bold{font-weight:700}.xc-text-\[\#ff0000\]{--tw-text-opacity: 1;color:rgb(255 0 0 / var(--tw-text-opacity, 1))}.xc-text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.xc-text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.xc-text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.xc-text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.xc-opacity-0{opacity:0}.xc-opacity-100{opacity:1}.xc-opacity-20{opacity:.2}.xc-opacity-50{opacity:.5}.xc-opacity-80{opacity:.8}.xc-outline-none{outline:2px solid transparent;outline-offset:2px}.xc-ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.xc-ring-\[rgb\(135\,93\,255\)\]{--tw-ring-opacity: 1;--tw-ring-color: rgb(135 93 255 / var(--tw-ring-opacity, 1))}.xc-transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.xc-duration-1000{transition-duration:1s}.no-scrollbar::-webkit-scrollbar{display:none}.\[key\:string\]{key:string}.focus-within\:xc-border-opacity-40:focus-within{--tw-border-opacity: .4}.hover\:xc-shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.disabled\:xc-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:xc-bg-white:disabled{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.disabled\:xc-bg-opacity-10:disabled{--tw-bg-opacity: .1}.disabled\:xc-text-opacity-50:disabled{--tw-text-opacity: .5}.disabled\:xc-opacity-20:disabled{opacity:.2}.xc-group:hover .group-hover\:xc-left-2{left:.5rem}.xc-group:hover .group-hover\:xc-right-0{right:0}.xc-group:hover .group-hover\:xc-opacity-0{opacity:0}.xc-group:hover .group-hover\:xc-opacity-100{opacity:1} diff --git a/lib/components/get-wallet.tsx b/lib/components/get-wallet.tsx index dc75e54..2074f53 100644 --- a/lib/components/get-wallet.tsx +++ b/lib/components/get-wallet.tsx @@ -78,7 +78,7 @@ export default function GetWallet(props: { wallet: WalletItem }) { )} {config?.app_store_id && ( diff --git a/lib/constant/wallet-book.ts b/lib/constant/wallet-book.ts index 3f31812..61ac185 100644 --- a/lib/constant/wallet-book.ts +++ b/lib/constant/wallet-book.ts @@ -58,6 +58,7 @@ export const WalletBook: WalletConfig[] = [ featured: true, image: `${walletIconsImage}#ebac7b39-688c-41e3-7912-a4fefba74600`, getWallet: { + chrome_store_id: 'cadiboklkpojfamcoggejbbdjcoiljjk', play_store_id: 'com.binance.dev', app_store_id: 'id1436799971', } diff --git a/package-lock.json b/package-lock.json index dd55529..368d7d5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "codatta-connect", - "version": "2.5.2", + "version": "2.5.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "codatta-connect", - "version": "2.5.2", + "version": "2.5.9", "dependencies": { "@binance/w3w-utils": "^1.1.6", "@coinbase/wallet-sdk": "^4.2.4", @@ -29,7 +29,7 @@ "tailwindcss": "^3.4.15", "valtio": "^2.1.2", "viem": "^2.31.3", - "vite": "^5.4.11", + "vite": "^7.1.6", "vite-plugin-dts": "^4.3.0" } }, @@ -339,348 +339,419 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", - "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.10.tgz", + "integrity": "sha512-0NFWnA+7l41irNuaSVlLfgNT12caWJVLzp5eAVhZ0z1qpxbockccEt3s+149rE64VUI3Ml2zt8Nv5JVc4QXTsw==", "cpu": [ "ppc64" ], + "license": "MIT", "optional": true, "os": [ "aix" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/android-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/android-arm/-/android-arm-0.21.5.tgz", - "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.10.tgz", + "integrity": "sha512-dQAxF1dW1C3zpeCDc5KqIYuZ1tgAdRXNoZP7vkBIRtKZPYe2xVr/d3SkirklCHudW1B45tGiUlz2pUWDfbDD4w==", "cpu": [ "arm" ], + "license": "MIT", "optional": true, "os": [ "android" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/android-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", - "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.10.tgz", + "integrity": "sha512-LSQa7eDahypv/VO6WKohZGPSJDq5OVOo3UoFR1E4t4Gj1W7zEQMUhI+lo81H+DtB+kP+tDgBp+M4oNCwp6kffg==", "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "android" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/android-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/android-x64/-/android-x64-0.21.5.tgz", - "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.10.tgz", + "integrity": "sha512-MiC9CWdPrfhibcXwr39p9ha1x0lZJ9KaVfvzA0Wxwz9ETX4v5CHfF09bx935nHlhi+MxhA63dKRRQLiVgSUtEg==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "android" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", - "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.10.tgz", + "integrity": "sha512-JC74bdXcQEpW9KkV326WpZZjLguSZ3DfS8wrrvPMHgQOIEIG/sPXEN/V8IssoJhbefLRcRqw6RQH2NnpdprtMA==", "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "darwin" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", - "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.10.tgz", + "integrity": "sha512-tguWg1olF6DGqzws97pKZ8G2L7Ig1vjDmGTwcTuYHbuU6TTjJe5FXbgs5C1BBzHbJ2bo1m3WkQDbWO2PvamRcg==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "darwin" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", - "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.10.tgz", + "integrity": "sha512-3ZioSQSg1HT2N05YxeJWYR+Libe3bREVSdWhEEgExWaDtyFbbXWb49QgPvFH8u03vUPX10JhJPcz7s9t9+boWg==", "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "freebsd" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", - "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.10.tgz", + "integrity": "sha512-LLgJfHJk014Aa4anGDbh8bmI5Lk+QidDmGzuC2D+vP7mv/GeSN+H39zOf7pN5N8p059FcOfs2bVlrRr4SK9WxA==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "freebsd" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", - "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.10.tgz", + "integrity": "sha512-oR31GtBTFYCqEBALI9r6WxoU/ZofZl962pouZRTEYECvNF/dtXKku8YXcJkhgK/beU+zedXfIzHijSRapJY3vg==", "cpu": [ "arm" ], + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", - "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.10.tgz", + "integrity": "sha512-5luJWN6YKBsawd5f9i4+c+geYiVEw20FVW5x0v1kEMWNq8UctFjDiMATBxLvmmHA4bf7F6hTRaJgtghFr9iziQ==", "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", - "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.10.tgz", + "integrity": "sha512-NrSCx2Kim3EnnWgS4Txn0QGt0Xipoumb6z6sUtl5bOEZIVKhzfyp/Lyw4C1DIYvzeW/5mWYPBFJU3a/8Yr75DQ==", "cpu": [ "ia32" ], + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", - "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.10.tgz", + "integrity": "sha512-xoSphrd4AZda8+rUDDfD9J6FUMjrkTz8itpTITM4/xgerAZZcFW7Dv+sun7333IfKxGG8gAq+3NbfEMJfiY+Eg==", "cpu": [ "loong64" ], + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", - "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.10.tgz", + "integrity": "sha512-ab6eiuCwoMmYDyTnyptoKkVS3k8fy/1Uvq7Dj5czXI6DF2GqD2ToInBI0SHOp5/X1BdZ26RKc5+qjQNGRBelRA==", "cpu": [ "mips64el" ], + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", - "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.10.tgz", + "integrity": "sha512-NLinzzOgZQsGpsTkEbdJTCanwA5/wozN9dSgEl12haXJBzMTpssebuXR42bthOF3z7zXFWH1AmvWunUCkBE4EA==", "cpu": [ "ppc64" ], + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", - "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.10.tgz", + "integrity": "sha512-FE557XdZDrtX8NMIeA8LBJX3dC2M8VGXwfrQWU7LB5SLOajfJIxmSdyL/gU1m64Zs9CBKvm4UAuBp5aJ8OgnrA==", "cpu": [ "riscv64" ], + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", - "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.10.tgz", + "integrity": "sha512-3BBSbgzuB9ajLoVZk0mGu+EHlBwkusRmeNYdqmznmMc9zGASFjSsxgkNsqmXugpPk00gJ0JNKh/97nxmjctdew==", "cpu": [ "s390x" ], + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", - "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.10.tgz", + "integrity": "sha512-QSX81KhFoZGwenVyPoberggdW1nrQZSvfVDAIUXr3WqLRZGZqWk/P4T8p2SP+de2Sr5HPcvjhcJzEiulKgnxtA==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.10.tgz", + "integrity": "sha512-AKQM3gfYfSW8XRk8DdMCzaLUFB15dTrZfnX8WXQoOUpUBQ+NaAFCP1kPS/ykbbGYz7rxn0WS48/81l9hFl3u4A==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", - "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.10.tgz", + "integrity": "sha512-7RTytDPGU6fek/hWuN9qQpeGPBZFfB4zZgcz2VK2Z5VpdUxEI8JKYsg3JfO0n/Z1E/6l05n0unDCNc4HnhQGig==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "netbsd" ], "engines": { - "node": ">=12" + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.10.tgz", + "integrity": "sha512-5Se0VM9Wtq797YFn+dLimf2Zx6McttsH2olUBsDml+lm0GOCRVebRWUvDtkY4BWYv/3NgzS8b/UM3jQNh5hYyw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", - "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.10.tgz", + "integrity": "sha512-XkA4frq1TLj4bEMB+2HnI0+4RnjbuGZfet2gs/LNs5Hc7D89ZQBHQ0gL2ND6Lzu1+QVkjp3x1gIcPKzRNP8bXw==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "openbsd" ], "engines": { - "node": ">=12" + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.10.tgz", + "integrity": "sha512-AVTSBhTX8Y/Fz6OmIVBip9tJzZEUcY8WLh7I59+upa5/GPhh2/aM6bvOMQySspnCCHvFi79kMtdJS1w0DXAeag==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", - "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.10.tgz", + "integrity": "sha512-fswk3XT0Uf2pGJmOpDB7yknqhVkJQkAQOcW/ccVOtfx05LkbWOaRAtn5SaqXypeKQra1QaEa841PgrSL9ubSPQ==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "sunos" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", - "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.10.tgz", + "integrity": "sha512-ah+9b59KDTSfpaCg6VdJoOQvKjI33nTaQr4UluQwW7aEwZQsbMCfTmfEO4VyewOxx4RaDT/xCy9ra2GPWmO7Kw==", "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "win32" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", - "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.10.tgz", + "integrity": "sha512-QHPDbKkrGO8/cz9LKVnJU22HOi4pxZnZhhA2HYHez5Pz4JeffhDjf85E57Oyco163GnzNCVkZK0b/n4Y0UHcSw==", "cpu": [ "ia32" ], + "license": "MIT", "optional": true, "os": [ "win32" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/win32-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", - "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.10.tgz", + "integrity": "sha512-9KpxSVFCu0iK1owoez6aC/s/EdUQLDN3adTxGCqxMVhrPDj6bt5dbrHDXUuq+Bs2vATFBBrQS5vdQ/Ed2P+nbw==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "win32" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@ethersproject/abstract-provider": { @@ -1670,216 +1741,273 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.27.2", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.27.2.tgz", - "integrity": "sha512-Tj+j7Pyzd15wAdSJswvs5CJzJNV+qqSUcr/aCD+jpQSBtXvGnV0pnrjoc8zFTe9fcKCatkpFpOO7yAzpO998HA==", + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.50.2.tgz", + "integrity": "sha512-uLN8NAiFVIRKX9ZQha8wy6UUs06UNSZ32xj6giK/rmMXAgKahwExvK6SsmgU5/brh4w/nSgj8e0k3c1HBQpa0A==", "cpu": [ "arm" ], + "license": "MIT", "optional": true, "os": [ "android" ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.27.2", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.27.2.tgz", - "integrity": "sha512-xsPeJgh2ThBpUqlLgRfiVYBEf/P1nWlWvReG+aBWfNv3XEBpa6ZCmxSVnxJgLgkNz4IbxpLy64h2gCmAAQLneQ==", + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.50.2.tgz", + "integrity": "sha512-oEouqQk2/zxxj22PNcGSskya+3kV0ZKH+nQxuCCOGJ4oTXBdNTbv+f/E3c74cNLeMO1S5wVWacSws10TTSB77g==", "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "android" ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.27.2", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.27.2.tgz", - "integrity": "sha512-KnXU4m9MywuZFedL35Z3PuwiTSn/yqRIhrEA9j+7OSkji39NzVkgxuxTYg5F8ryGysq4iFADaU5osSizMXhU2A==", + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.50.2.tgz", + "integrity": "sha512-OZuTVTpj3CDSIxmPgGH8en/XtirV5nfljHZ3wrNwvgkT5DQLhIKAeuFSiwtbMto6oVexV0k1F1zqURPKf5rI1Q==", "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "darwin" ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.27.2", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.27.2.tgz", - "integrity": "sha512-Hj77A3yTvUeCIx/Vi+4d4IbYhyTwtHj07lVzUgpUq9YpJSEiGJj4vXMKwzJ3w5zp5v3PFvpJNgc/J31smZey6g==", + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.50.2.tgz", + "integrity": "sha512-Wa/Wn8RFkIkr1vy1k1PB//VYhLnlnn5eaJkfTQKivirOvzu5uVd2It01ukeQstMursuz7S1bU+8WW+1UPXpa8A==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "darwin" ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.27.2", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.27.2.tgz", - "integrity": "sha512-RjgKf5C3xbn8gxvCm5VgKZ4nn0pRAIe90J0/fdHUsgztd3+Zesb2lm2+r6uX4prV2eUByuxJNdt647/1KPRq5g==", + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.50.2.tgz", + "integrity": "sha512-QkzxvH3kYN9J1w7D1A+yIMdI1pPekD+pWx7G5rXgnIlQ1TVYVC6hLl7SOV9pi5q9uIDF9AuIGkuzcbF7+fAhow==", "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "freebsd" ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.27.2", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.27.2.tgz", - "integrity": "sha512-duq21FoXwQtuws+V9H6UZ+eCBc7fxSpMK1GQINKn3fAyd9DFYKPJNcUhdIKOrMFjLEJgQskoMoiuizMt+dl20g==", + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.50.2.tgz", + "integrity": "sha512-dkYXB0c2XAS3a3jmyDkX4Jk0m7gWLFzq1C3qUnJJ38AyxIF5G/dyS4N9B30nvFseCfgtCEdbYFhk0ChoCGxPog==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "freebsd" ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.27.2", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.27.2.tgz", - "integrity": "sha512-6npqOKEPRZkLrMcvyC/32OzJ2srdPzCylJjiTJT2c0bwwSGm7nz2F9mNQ1WrAqCBZROcQn91Fno+khFhVijmFA==", + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.50.2.tgz", + "integrity": "sha512-9VlPY/BN3AgbukfVHAB8zNFWB/lKEuvzRo1NKev0Po8sYFKx0i+AQlCYftgEjcL43F2h9Ui1ZSdVBc4En/sP2w==", "cpu": [ "arm" ], + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.27.2", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.27.2.tgz", - "integrity": "sha512-V9Xg6eXtgBtHq2jnuQwM/jr2mwe2EycnopO8cbOvpzFuySCGtKlPCI3Hj9xup/pJK5Q0388qfZZy2DqV2J8ftw==", + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.50.2.tgz", + "integrity": "sha512-+GdKWOvsifaYNlIVf07QYan1J5F141+vGm5/Y8b9uCZnG/nxoGqgCmR24mv0koIWWuqvFYnbURRqw1lv7IBINw==", "cpu": [ "arm" ], + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.27.2", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.27.2.tgz", - "integrity": "sha512-uCFX9gtZJoQl2xDTpRdseYuNqyKkuMDtH6zSrBTA28yTfKyjN9hQ2B04N5ynR8ILCoSDOrG/Eg+J2TtJ1e/CSA==", + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.50.2.tgz", + "integrity": "sha512-df0Eou14ojtUdLQdPFnymEQteENwSJAdLf5KCDrmZNsy1c3YaCNaJvYsEUHnrg+/DLBH612/R0xd3dD03uz2dg==", "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.27.2", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.27.2.tgz", - "integrity": "sha512-/PU9P+7Rkz8JFYDHIi+xzHabOu9qEWR07L5nWLIUsvserrxegZExKCi2jhMZRd0ATdboKylu/K5yAXbp7fYFvA==", + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.50.2.tgz", + "integrity": "sha512-iPeouV0UIDtz8j1YFR4OJ/zf7evjauqv7jQ/EFs0ClIyL+by++hiaDAfFipjOgyz6y6xbDvJuiU4HwpVMpRFDQ==", "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "linux" ] }, - "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.27.2", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.27.2.tgz", - "integrity": "sha512-eCHmol/dT5odMYi/N0R0HC8V8QE40rEpkyje/ZAXJYNNoSfrObOvG/Mn+s1F/FJyB7co7UQZZf6FuWnN6a7f4g==", + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.50.2.tgz", + "integrity": "sha512-OL6KaNvBopLlj5fTa5D5bau4W82f+1TyTZRr2BdnfsrnQnmdxh4okMxR2DcDkJuh4KeoQZVuvHvzuD/lyLn2Kw==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.50.2.tgz", + "integrity": "sha512-I21VJl1w6z/K5OTRl6aS9DDsqezEZ/yKpbqlvfHbW0CEF5IL8ATBMuUx6/mp683rKTK8thjs/0BaNrZLXetLag==", "cpu": [ "ppc64" ], + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.27.2", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.27.2.tgz", - "integrity": "sha512-DEP3Njr9/ADDln3kNi76PXonLMSSMiCir0VHXxmGSHxCxDfQ70oWjHcJGfiBugzaqmYdTC7Y+8Int6qbnxPBIQ==", + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.50.2.tgz", + "integrity": "sha512-Hq6aQJT/qFFHrYMjS20nV+9SKrXL2lvFBENZoKfoTH2kKDOJqff5OSJr4x72ZaG/uUn+XmBnGhfr4lwMRrmqCQ==", "cpu": [ "riscv64" ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.50.2.tgz", + "integrity": "sha512-82rBSEXRv5qtKyr0xZ/YMF531oj2AIpLZkeNYxmKNN6I2sVE9PGegN99tYDLK2fYHJITL1P2Lgb4ZXnv0PjQvw==", + "cpu": [ + "riscv64" + ], + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.27.2", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.27.2.tgz", - "integrity": "sha512-NHGo5i6IE/PtEPh5m0yw5OmPMpesFnzMIS/lzvN5vknnC1sXM5Z/id5VgcNPgpD+wHmIcuYYgW+Q53v+9s96lQ==", + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.50.2.tgz", + "integrity": "sha512-4Q3S3Hy7pC6uaRo9gtXUTJ+EKo9AKs3BXKc2jYypEcMQ49gDPFU2P1ariX9SEtBzE5egIX6fSUmbmGazwBVF9w==", "cpu": [ "s390x" ], + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.27.2", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.27.2.tgz", - "integrity": "sha512-PaW2DY5Tan+IFvNJGHDmUrORadbe/Ceh8tQxi8cmdQVCCYsLoQo2cuaSj+AU+YRX8M4ivS2vJ9UGaxfuNN7gmg==", + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.50.2.tgz", + "integrity": "sha512-9Jie/At6qk70dNIcopcL4p+1UirusEtznpNtcq/u/C5cC4HBX7qSGsYIcG6bdxj15EYWhHiu02YvmdPzylIZlA==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.27.2", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.27.2.tgz", - "integrity": "sha512-dOlWEMg2gI91Qx5I/HYqOD6iqlJspxLcS4Zlg3vjk1srE67z5T2Uz91yg/qA8sY0XcwQrFzWWiZhMNERylLrpQ==", + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.50.2.tgz", + "integrity": "sha512-HPNJwxPL3EmhzeAnsWQCM3DcoqOz3/IC6de9rWfGR8ZCuEHETi9km66bH/wG3YH0V3nyzyFEGUZeL5PKyy4xvw==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "linux" ] }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.50.2.tgz", + "integrity": "sha512-nMKvq6FRHSzYfKLHZ+cChowlEkR2lj/V0jYj9JnGUVPL2/mIeFGmVM2mLaFeNa5Jev7W7TovXqXIG2d39y1KYA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.27.2", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.27.2.tgz", - "integrity": "sha512-euMIv/4x5Y2/ImlbGl88mwKNXDsvzbWUlT7DFky76z2keajCtcbAsN9LUdmk31hAoVmJJYSThgdA0EsPeTr1+w==", + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.50.2.tgz", + "integrity": "sha512-eFUvvnTYEKeTyHEijQKz81bLrUQOXKZqECeiWH6tb8eXXbZk+CXSG2aFrig2BQ/pjiVRj36zysjgILkqarS2YA==", "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.27.2", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.27.2.tgz", - "integrity": "sha512-RsnE6LQkUHlkC10RKngtHNLxb7scFykEbEwOFDjr3CeCMG+Rr+cKqlkKc2/wJ1u4u990urRHCbjz31x84PBrSQ==", + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.50.2.tgz", + "integrity": "sha512-cBaWmXqyfRhH8zmUxK3d3sAhEWLrtMjWBRwdMMHJIXSjvjLKvv49adxiEz+FJ8AP90apSDDBx2Tyd/WylV6ikA==", "cpu": [ "ia32" ], + "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.27.2", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.27.2.tgz", - "integrity": "sha512-foJM5vv+z2KQmn7emYdDLyTbkoO5bkHZE1oth2tWbQNGW7mX32d46Hz6T0MqXdWS2vBZhaEtHqdy9WYwGfiliA==", + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.50.2.tgz", + "integrity": "sha512-APwKy6YUhvZaEoHyM+9xqmTpviEI+9eL7LoCH+aLcvWYHJ663qG5zx7WzWZY+a9qkg5JtzcMyJ9z0WtQBMDmgA==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "win32" @@ -2250,16 +2378,18 @@ } }, "node_modules/@types/estree": { - "version": "1.0.6", - "resolved": "https://registry.npmmirror.com/@types/estree/-/estree-1.0.6.tgz", - "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==" + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "license": "MIT" }, "node_modules/@types/node": { - "version": "22.9.0", - "resolved": "https://registry.npmmirror.com/@types/node/-/node-22.9.0.tgz", - "integrity": "sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==", + "version": "22.18.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.18.6.tgz", + "integrity": "sha512-r8uszLPpeIWbNKtvWRt/DbVi5zbqZyj1PTmhRMqBMvDnaz1QpmSKujUtJLrqGZeoM8v72MfYggDceY4K1itzWQ==", + "license": "MIT", "dependencies": { - "undici-types": "~6.19.8" + "undici-types": "~6.21.0" } }, "node_modules/@types/prop-types": { @@ -3338,40 +3468,44 @@ } }, "node_modules/esbuild": { - "version": "0.21.5", - "resolved": "https://registry.npmmirror.com/esbuild/-/esbuild-0.21.5.tgz", - "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "version": "0.25.10", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.10.tgz", + "integrity": "sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ==", "hasInstallScript": true, + "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, "engines": { - "node": ">=12" + "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.21.5", - "@esbuild/android-arm": "0.21.5", - "@esbuild/android-arm64": "0.21.5", - "@esbuild/android-x64": "0.21.5", - "@esbuild/darwin-arm64": "0.21.5", - "@esbuild/darwin-x64": "0.21.5", - "@esbuild/freebsd-arm64": "0.21.5", - "@esbuild/freebsd-x64": "0.21.5", - "@esbuild/linux-arm": "0.21.5", - "@esbuild/linux-arm64": "0.21.5", - "@esbuild/linux-ia32": "0.21.5", - "@esbuild/linux-loong64": "0.21.5", - "@esbuild/linux-mips64el": "0.21.5", - "@esbuild/linux-ppc64": "0.21.5", - "@esbuild/linux-riscv64": "0.21.5", - "@esbuild/linux-s390x": "0.21.5", - "@esbuild/linux-x64": "0.21.5", - "@esbuild/netbsd-x64": "0.21.5", - "@esbuild/openbsd-x64": "0.21.5", - "@esbuild/sunos-x64": "0.21.5", - "@esbuild/win32-arm64": "0.21.5", - "@esbuild/win32-ia32": "0.21.5", - "@esbuild/win32-x64": "0.21.5" + "@esbuild/aix-ppc64": "0.25.10", + "@esbuild/android-arm": "0.25.10", + "@esbuild/android-arm64": "0.25.10", + "@esbuild/android-x64": "0.25.10", + "@esbuild/darwin-arm64": "0.25.10", + "@esbuild/darwin-x64": "0.25.10", + "@esbuild/freebsd-arm64": "0.25.10", + "@esbuild/freebsd-x64": "0.25.10", + "@esbuild/linux-arm": "0.25.10", + "@esbuild/linux-arm64": "0.25.10", + "@esbuild/linux-ia32": "0.25.10", + "@esbuild/linux-loong64": "0.25.10", + "@esbuild/linux-mips64el": "0.25.10", + "@esbuild/linux-ppc64": "0.25.10", + "@esbuild/linux-riscv64": "0.25.10", + "@esbuild/linux-s390x": "0.25.10", + "@esbuild/linux-x64": "0.25.10", + "@esbuild/netbsd-arm64": "0.25.10", + "@esbuild/netbsd-x64": "0.25.10", + "@esbuild/openbsd-arm64": "0.25.10", + "@esbuild/openbsd-x64": "0.25.10", + "@esbuild/openharmony-arm64": "0.25.10", + "@esbuild/sunos-x64": "0.25.10", + "@esbuild/win32-arm64": "0.25.10", + "@esbuild/win32-ia32": "0.25.10", + "@esbuild/win32-x64": "0.25.10" } }, "node_modules/escalade": { @@ -4280,15 +4414,16 @@ } }, "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -4588,9 +4723,9 @@ } }, "node_modules/postcss": { - "version": "8.4.49", - "resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.4.49.tgz", - "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==", + "version": "8.5.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", "funding": [ { "type": "opencollective", @@ -4605,8 +4740,9 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { - "nanoid": "^3.3.7", + "nanoid": "^3.3.11", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, @@ -4933,11 +5069,12 @@ } }, "node_modules/rollup": { - "version": "4.27.2", - "resolved": "https://registry.npmmirror.com/rollup/-/rollup-4.27.2.tgz", - "integrity": "sha512-KreA+PzWmk2yaFmZVwe6GB2uBD86nXl86OsDkt1bJS9p3vqWuEQ6HnJJ+j/mZi/q0920P99/MVRlB4L3crpF5w==", + "version": "4.50.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.50.2.tgz", + "integrity": "sha512-BgLRGy7tNS9H66aIMASq1qSYbAAJV6Z6WR4QYTvj5FgF15rZ/ympT1uixHXwzbZUBDbkvqUI1KR0fH1FhMaQ9w==", + "license": "MIT", "dependencies": { - "@types/estree": "1.0.6" + "@types/estree": "1.0.8" }, "bin": { "rollup": "dist/bin/rollup" @@ -4947,24 +5084,27 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.27.2", - "@rollup/rollup-android-arm64": "4.27.2", - "@rollup/rollup-darwin-arm64": "4.27.2", - "@rollup/rollup-darwin-x64": "4.27.2", - "@rollup/rollup-freebsd-arm64": "4.27.2", - "@rollup/rollup-freebsd-x64": "4.27.2", - "@rollup/rollup-linux-arm-gnueabihf": "4.27.2", - "@rollup/rollup-linux-arm-musleabihf": "4.27.2", - "@rollup/rollup-linux-arm64-gnu": "4.27.2", - "@rollup/rollup-linux-arm64-musl": "4.27.2", - "@rollup/rollup-linux-powerpc64le-gnu": "4.27.2", - "@rollup/rollup-linux-riscv64-gnu": "4.27.2", - "@rollup/rollup-linux-s390x-gnu": "4.27.2", - "@rollup/rollup-linux-x64-gnu": "4.27.2", - "@rollup/rollup-linux-x64-musl": "4.27.2", - "@rollup/rollup-win32-arm64-msvc": "4.27.2", - "@rollup/rollup-win32-ia32-msvc": "4.27.2", - "@rollup/rollup-win32-x64-msvc": "4.27.2", + "@rollup/rollup-android-arm-eabi": "4.50.2", + "@rollup/rollup-android-arm64": "4.50.2", + "@rollup/rollup-darwin-arm64": "4.50.2", + "@rollup/rollup-darwin-x64": "4.50.2", + "@rollup/rollup-freebsd-arm64": "4.50.2", + "@rollup/rollup-freebsd-x64": "4.50.2", + "@rollup/rollup-linux-arm-gnueabihf": "4.50.2", + "@rollup/rollup-linux-arm-musleabihf": "4.50.2", + "@rollup/rollup-linux-arm64-gnu": "4.50.2", + "@rollup/rollup-linux-arm64-musl": "4.50.2", + "@rollup/rollup-linux-loong64-gnu": "4.50.2", + "@rollup/rollup-linux-ppc64-gnu": "4.50.2", + "@rollup/rollup-linux-riscv64-gnu": "4.50.2", + "@rollup/rollup-linux-riscv64-musl": "4.50.2", + "@rollup/rollup-linux-s390x-gnu": "4.50.2", + "@rollup/rollup-linux-x64-gnu": "4.50.2", + "@rollup/rollup-linux-x64-musl": "4.50.2", + "@rollup/rollup-openharmony-arm64": "4.50.2", + "@rollup/rollup-win32-arm64-msvc": "4.50.2", + "@rollup/rollup-win32-ia32-msvc": "4.50.2", + "@rollup/rollup-win32-x64-msvc": "4.50.2", "fsevents": "~2.3.2" } }, @@ -5382,6 +5522,51 @@ "real-require": "^0.1.0" } }, + "node_modules/tinyglobby": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmmirror.com/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -5450,9 +5635,10 @@ "integrity": "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==" }, "node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "license": "MIT" }, "node_modules/unenv": { "version": "1.10.0", @@ -5661,19 +5847,23 @@ } }, "node_modules/vite": { - "version": "5.4.11", - "resolved": "https://registry.npmmirror.com/vite/-/vite-5.4.11.tgz", - "integrity": "sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==", + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.1.6.tgz", + "integrity": "sha512-SRYIB8t/isTwNn8vMB3MR6E+EQZM/WG1aKmmIUCfDXfVvKfc20ZpamngWHKzAmmu9ppsgxsg4b2I7c90JZudIQ==", + "license": "MIT", "dependencies": { - "esbuild": "^0.21.3", - "postcss": "^8.4.43", - "rollup": "^4.20.0" + "esbuild": "^0.25.0", + "fdir": "^6.5.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.43.0", + "tinyglobby": "^0.2.15" }, "bin": { "vite": "bin/vite.js" }, "engines": { - "node": "^18.0.0 || >=20.0.0" + "node": "^20.19.0 || >=22.12.0" }, "funding": { "url": "https://github.com/vitejs/vite?sponsor=1" @@ -5682,19 +5872,25 @@ "fsevents": "~2.3.3" }, "peerDependencies": { - "@types/node": "^18.0.0 || >=20.0.0", - "less": "*", + "@types/node": "^20.19.0 || >=22.12.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", "lightningcss": "^1.21.0", - "sass": "*", - "sass-embedded": "*", - "stylus": "*", - "sugarss": "*", - "terser": "^5.4.0" + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" }, "peerDependenciesMeta": { "@types/node": { "optional": true }, + "jiti": { + "optional": true + }, "less": { "optional": true }, @@ -5715,6 +5911,12 @@ }, "terser": { "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true } } }, @@ -5746,6 +5948,35 @@ } } }, + "node_modules/vite/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/vite/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/vscode-uri": { "version": "3.0.8", "resolved": "https://registry.npmmirror.com/vscode-uri/-/vscode-uri-3.0.8.tgz", diff --git a/package.json b/package.json index 5c8be74..0141ee7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codatta-connect", - "version": "2.5.8", + "version": "2.6.9", "type": "module", "main": "./dist/index.umd.js", "module": "./dist/index.es.js", @@ -35,7 +35,7 @@ "tailwindcss": "^3.4.15", "valtio": "^2.1.2", "viem": "^2.31.3", - "vite": "^5.4.11", + "vite": "^7.1.6", "vite-plugin-dts": "^4.3.0" } } diff --git a/src/views/login-view.tsx b/src/views/login-view.tsx index fc2be62..fd84f4e 100644 --- a/src/views/login-view.tsx +++ b/src/views/login-view.tsx @@ -11,6 +11,7 @@ import React, { useEffect } from "react"; export default function LoginView() { const { lastUsedWallet } = useCodattaConnectContext(); + const userAgent = navigator.userAgent; useEffect(() => { console.log(lastUsedWallet, 'lastUsedWallet change') @@ -66,7 +67,7 @@ export default function LoginView() { } return ( - <> +
{/* - +
); } diff --git a/vite.config.build.ts.timestamp-1750323952300-797e593ea1f06.mjs b/vite.config.build.ts.timestamp-1750323952300-797e593ea1f06.mjs deleted file mode 100644 index abb8273..0000000 --- a/vite.config.build.ts.timestamp-1750323952300-797e593ea1f06.mjs +++ /dev/null @@ -1,41 +0,0 @@ -// vite.config.build.ts -import { defineConfig } from "file:///Users/zhanglei/work/codatta-connect/node_modules/vite/dist/node/index.js"; -import react from "file:///Users/zhanglei/work/codatta-connect/node_modules/@vitejs/plugin-react/dist/index.mjs"; -import dts from "file:///Users/zhanglei/work/codatta-connect/node_modules/vite-plugin-dts/dist/index.mjs"; -import path from "path"; -import tailwindcss from "file:///Users/zhanglei/work/codatta-connect/node_modules/tailwindcss/lib/index.js"; -var __vite_injected_original_dirname = "/Users/zhanglei/work/codatta-connect"; -var vite_config_build_default = defineConfig({ - resolve: { - alias: { - "@": path.resolve(__vite_injected_original_dirname, "./lib") - } - }, - build: { - lib: { - entry: path.resolve("./", "./lib/main.ts"), - name: "xny-connect", - fileName: (format) => `index.${format}.js` - }, - rollupOptions: { - external: ["react", "react-dom"], - output: { - globals: { - react: "React", - "react-dom": "ReactDOM" - } - } - }, - emptyOutDir: true - }, - plugins: [react(), dts()], - css: { - postcss: { - plugins: [tailwindcss] - } - } -}); -export { - vite_config_build_default as default -}; -//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcuYnVpbGQudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCIvVXNlcnMvemhhbmdsZWkvd29yay9jb2RhdHRhLWNvbm5lY3RcIjtjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZmlsZW5hbWUgPSBcIi9Vc2Vycy96aGFuZ2xlaS93b3JrL2NvZGF0dGEtY29ubmVjdC92aXRlLmNvbmZpZy5idWlsZC50c1wiO2NvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9pbXBvcnRfbWV0YV91cmwgPSBcImZpbGU6Ly8vVXNlcnMvemhhbmdsZWkvd29yay9jb2RhdHRhLWNvbm5lY3Qvdml0ZS5jb25maWcuYnVpbGQudHNcIjtpbXBvcnQgeyBkZWZpbmVDb25maWcgfSBmcm9tICd2aXRlJ1xuaW1wb3J0IHJlYWN0IGZyb20gJ0B2aXRlanMvcGx1Z2luLXJlYWN0J1xuaW1wb3J0IGR0cyBmcm9tICd2aXRlLXBsdWdpbi1kdHMnXG5pbXBvcnQgcGF0aCBmcm9tICdwYXRoJ1xuaW1wb3J0IHRhaWx3aW5kY3NzIGZyb20gXCJ0YWlsd2luZGNzc1wiXG5cbmV4cG9ydCBkZWZhdWx0IGRlZmluZUNvbmZpZyh7XG4gIHJlc29sdmU6IHtcbiAgICBhbGlhczoge1xuICAgICAgXCJAXCI6IHBhdGgucmVzb2x2ZShfX2Rpcm5hbWUsIFwiLi9saWJcIiksXG4gICAgfSxcbiAgfSxcbiAgYnVpbGQ6IHtcblxuICAgIGxpYjoge1xuICAgICAgZW50cnk6IHBhdGgucmVzb2x2ZSgnLi8nLCAnLi9saWIvbWFpbi50cycpLFxuICAgICAgbmFtZTogJ3hueS1jb25uZWN0JyxcbiAgICAgIGZpbGVOYW1lOiAoZm9ybWF0KSA9PiBgaW5kZXguJHtmb3JtYXR9LmpzYCxcbiAgICB9LFxuXG4gICAgcm9sbHVwT3B0aW9uczoge1xuICAgICAgZXh0ZXJuYWw6IFsncmVhY3QnLCAncmVhY3QtZG9tJ10sXG4gICAgICBvdXRwdXQ6IHtcbiAgICAgICAgZ2xvYmFsczoge1xuICAgICAgICAgIHJlYWN0OiBcIlJlYWN0XCIsXG4gICAgICAgICAgXCJyZWFjdC1kb21cIjogXCJSZWFjdERPTVwiLFxuICAgICAgICB9LFxuICAgICAgfSxcbiAgICB9LFxuICAgIGVtcHR5T3V0RGlyOiB0cnVlLFxuICB9LFxuXG4gIHBsdWdpbnM6IFtyZWFjdCgpLCBkdHMoKV0sXG4gIGNzczoge1xuICAgIHBvc3Rjc3M6IHtcbiAgICAgIHBsdWdpbnM6IFt0YWlsd2luZGNzc10sXG4gICAgfSxcbiAgfVxufSlcbiJdLAogICJtYXBwaW5ncyI6ICI7QUFBMFMsU0FBUyxvQkFBb0I7QUFDdlUsT0FBTyxXQUFXO0FBQ2xCLE9BQU8sU0FBUztBQUNoQixPQUFPLFVBQVU7QUFDakIsT0FBTyxpQkFBaUI7QUFKeEIsSUFBTSxtQ0FBbUM7QUFNekMsSUFBTyw0QkFBUSxhQUFhO0FBQUEsRUFDMUIsU0FBUztBQUFBLElBQ1AsT0FBTztBQUFBLE1BQ0wsS0FBSyxLQUFLLFFBQVEsa0NBQVcsT0FBTztBQUFBLElBQ3RDO0FBQUEsRUFDRjtBQUFBLEVBQ0EsT0FBTztBQUFBLElBRUwsS0FBSztBQUFBLE1BQ0gsT0FBTyxLQUFLLFFBQVEsTUFBTSxlQUFlO0FBQUEsTUFDekMsTUFBTTtBQUFBLE1BQ04sVUFBVSxDQUFDLFdBQVcsU0FBUyxNQUFNO0FBQUEsSUFDdkM7QUFBQSxJQUVBLGVBQWU7QUFBQSxNQUNiLFVBQVUsQ0FBQyxTQUFTLFdBQVc7QUFBQSxNQUMvQixRQUFRO0FBQUEsUUFDTixTQUFTO0FBQUEsVUFDUCxPQUFPO0FBQUEsVUFDUCxhQUFhO0FBQUEsUUFDZjtBQUFBLE1BQ0Y7QUFBQSxJQUNGO0FBQUEsSUFDQSxhQUFhO0FBQUEsRUFDZjtBQUFBLEVBRUEsU0FBUyxDQUFDLE1BQU0sR0FBRyxJQUFJLENBQUM7QUFBQSxFQUN4QixLQUFLO0FBQUEsSUFDSCxTQUFTO0FBQUEsTUFDUCxTQUFTLENBQUMsV0FBVztBQUFBLElBQ3ZCO0FBQUEsRUFDRjtBQUNGLENBQUM7IiwKICAibmFtZXMiOiBbXQp9Cg== diff --git a/vite.config.dev.ts b/vite.config.dev.ts index e5bb5f2..2f55d4e 100644 --- a/vite.config.dev.ts +++ b/vite.config.dev.ts @@ -35,8 +35,9 @@ export default defineConfig({ build: { emptyOutDir: true, }, - server: { + host: "0.0.0.0", + allowedHosts:["1064wf31dw492.vicp.fun"], proxy: { '/api': { target: 'https://app-test.b18a.io', From 34bc1332ef7039be36d5c1dc9e44b48ceb286f3b Mon Sep 17 00:00:00 2001 From: Meow Lord Date: Fri, 19 Sep 2025 12:42:26 +0800 Subject: [PATCH 23/25] release: 2.7.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0141ee7..05e2620 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codatta-connect", - "version": "2.6.9", + "version": "2.7.6", "type": "module", "main": "./dist/index.umd.js", "module": "./dist/index.es.js", From 3291485c6fed46a50e44a44558ab5cb8b78d2ed9 Mon Sep 17 00:00:00 2001 From: Meow Lord Date: Fri, 19 Sep 2025 17:53:30 +0800 Subject: [PATCH 24/25] add header to codatta-connect --- dist/codatta-connect.d.ts | 1 + dist/index.es.js | 2 +- dist/index.umd.js | 2 +- dist/{main-D60MaR66.js => main-DmP-7EWG.js} | 2057 +++++++++-------- ...56k1-DbKZjSuc.js => secp256k1-K3HVP1eD.js} | 2 +- lib/codatta-connect.tsx | 4 +- package.json | 2 +- 7 files changed, 1037 insertions(+), 1033 deletions(-) rename dist/{main-D60MaR66.js => main-DmP-7EWG.js} (96%) rename dist/{secp256k1-DbKZjSuc.js => secp256k1-K3HVP1eD.js} (99%) diff --git a/dist/codatta-connect.d.ts b/dist/codatta-connect.d.ts index e5ba54c..ce33f8c 100644 --- a/dist/codatta-connect.d.ts +++ b/dist/codatta-connect.d.ts @@ -18,6 +18,7 @@ export declare function CodattaConnect(props: { onEvmWalletConnect?: (connectInfo: EmvWalletConnectInfo) => Promise; onTonWalletConnect?: (connectInfo: TonWalletConnectInfo) => Promise; onEmailConnect?: (email: string, code: string) => Promise; + header?: React.ReactNode; config?: { showEmailSignIn?: boolean; showFeaturedWallets?: boolean; diff --git a/dist/index.es.js b/dist/index.es.js index d8ac4cd..2e45526 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -1,4 +1,4 @@ -import { l as o, C as e, k as n, W as C, j as s, u as d } from "./main-D60MaR66.js"; +import { l as o, C as e, k as n, W as C, j as s, u as d } from "./main-DmP-7EWG.js"; export { o as CodattaConnect, e as CodattaConnectContextProvider, diff --git a/dist/index.umd.js b/dist/index.umd.js index b0da385..088a452 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -255,4 +255,4 @@ ${D}`}const mY=/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(: OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */function GY(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new $t("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new $t("Delay aborted"))})})})}function hs(t){const e=new AbortController;return t?.aborted?e.abort():t?.addEventListener("abort",()=>e.abort(),{once:!0}),e}function cl(t,e){var r,n;return At(this,void 0,void 0,function*(){const i=(r=e?.attempts)!==null&&r!==void 0?r:10,s=(n=e?.delayMs)!==null&&n!==void 0?n:200,o=hs(e?.signal);if(typeof t!="function")throw new $t(`Expected a function, got ${typeof t}`);let a=0,f;for(;aAt(this,void 0,void 0,function*(){if(s=g??null,o?.abort(),o=hs(g),o.signal.aborted)throw new $t("Resource creation was aborted");n=b??null;const x=t(o.signal,...b);i=x;const S=yield x;if(i!==x&&S!==r)throw yield e(S),new $t("Resource creation was aborted by a new resource creation");return r=S,r});return{create:a,current:()=>r??null,dispose:()=>At(this,void 0,void 0,function*(){try{const g=r;r=null;const b=i;i=null;try{o?.abort()}catch{}yield Promise.allSettled([g?e(g):Promise.resolve(),b?e(yield b):Promise.resolve()])}catch{}}),recreate:g=>At(this,void 0,void 0,function*(){const b=r,x=i,S=n,C=s;if(yield b7(g),b===r&&x===i&&S===n&&C===s)return yield a(s,...S??[]);throw new $t("Resource recreation was aborted by a new resource creation")})}}function oJ(t,e){const r=e?.timeout,n=e?.signal,i=hs(n);return new Promise((s,o)=>At(this,void 0,void 0,function*(){if(i.signal.aborted){o(new $t("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new $t(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new $t("Operation aborted"))},{once:!0});const f={timeout:r,abort:i.signal};yield t((...u)=>{clearTimeout(a),s(...u)},()=>{clearTimeout(a),o()},f)}))}class K1{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=sJ((o,a)=>At(this,void 0,void 0,function*(){const f={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield aJ(f)}),o=>At(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new eJ(e,r)}get isReady(){const e=this.eventSource.current();return e?.readyState===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return e?.readyState!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return e?.readyState===EventSource.CONNECTING}registerSession(e){return At(this,void 0,void 0,function*(){yield this.eventSource.create(e?.signal,e?.openingDeadlineMS)})}send(e,r,n,i){var s;return At(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i?.ttl,o.signal=i?.signal,o.attempts=i?.attempts);const a=new URL(v7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",(o?.ttl||this.defaultTtl).toString()),a.searchParams.append("topic",n);const f=p7.encode(e);yield cl(u=>At(this,void 0,void 0,function*(){const h=yield this.post(a,f,u.signal);if(!h.ok)throw new $t(`Bridge send failed, status ${h.status}`)}),{attempts:(s=o?.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o?.signal})})}pause(){this.eventSource.dispose().catch(e=>co(`Bridge pause failed, ${e}`))}unPause(){return At(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return At(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>co(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return At(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new $t(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return At(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new $t("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),xn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new $t("Bridge error, unknown state")})}messagesHandler(e){return At(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new $t(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function aJ(t){return At(this,void 0,void 0,function*(){return yield oJ((e,r,n)=>At(this,void 0,void 0,function*(){var i;const o=hs(n.signal).signal;if(o.aborted){r(new $t("Bridge connection aborted"));return}const a=new URL(v7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const f=yield t.bridgeGatewayStorage.getLastEventId();if(f&&a.searchParams.append("last_event_id",f),o.aborted){r(new $t("Bridge connection aborted"));return}const u=new EventSource(a.toString());u.onerror=h=>At(this,void 0,void 0,function*(){if(o.aborted){u.close(),r(new $t("Bridge connection aborted"));return}try{const g=yield t.errorHandler(u,h);g!==u&&u.close(),g&&g!==u&&e(g)}catch(g){u.close(),r(g)}}),u.onopen=()=>{if(o.aborted){u.close(),r(new $t("Bridge connection aborted"));return}e(u)},u.onmessage=h=>{if(o.aborted){u.close(),r(new $t("Bridge connection aborted"));return}t.messageHandler(h)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{u.close(),r(new $t("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function ul(t){return!("connectEvent"in t)}class fl{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return At(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!ul(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return At(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return At(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new $1(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new $1(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new $t("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new $t("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new $t("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new $t("Trying to read HTTP connection source while injected connection is stored");if(!ul(e))throw new $t("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new $t("Trying to read Injected bridge connection source while nothing is stored");if(e?.type==="http")throw new $t("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return At(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return At(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!ul(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const y7=2;class ll{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new fl(e)}static fromStorage(e){return At(this,void 0,void 0,function*(){const n=yield new fl(e).getHttpConnection();return ul(n)?new ll(e,n.connectionSource):new ll(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=hs(r?.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new $1;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>At(this,void 0,void 0,function*(){i.signal.aborted||(yield cl(a=>{var f;return this.openGateways(s,{openingDeadlineMS:(f=r?.openingDeadlineMS)!==null&&f!==void 0?f:this.defaultOpeningDeadlineMS,signal:a?.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return At(this,void 0,void 0,function*(){const i=hs(e?.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e?.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(ul(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i?.signal});if(Array.isArray(this.walletConnectionSource))throw new $t("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(xn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new K1(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield cl(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r?.onRequestSent,n.signal=r?.signal,n.attempts=r?.attempts),new Promise((i,s)=>At(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new $t("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),xn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const f=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),Kd(this.session.walletPublicKey));try{yield this.gateway.send(f,this.session.walletPublicKey,e.method,{attempts:n?.attempts,signal:n?.signal}),(o=n?.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(u){s(u)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return At(this,void 0,void 0,function*(){return new Promise(r=>At(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=hs(e?.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){xn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return At(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return At(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(xn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return At(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(p7.decode(e.message).toUint8Array(),Kd(e.from)));if(xn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){xn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){co(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(xn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return At(this,void 0,void 0,function*(){throw new $t(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return At(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return At(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return rJ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",y7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+nJ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return At(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new K1(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>cl(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r?.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r?.signal})));return}else return this.gateway&&(xn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new K1(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r?.openingDeadlineMS,signal:r?.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==e?.except).forEach(n=>n.close()),this.pendingGateways=[]}}function w7(t,e){return x7(t,[e])}function x7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function cJ(t){try{return!w7(t,"tonconnect")||!w7(t.tonconnect,"walletInfo")?!1:x7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Yc{constructor(){this.storage={}}static getInstance(){return Yc.instance||(Yc.instance=new Yc),Yc.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function e0(){if(!(typeof window>"u"))return window}function uJ(){const t=e0();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function fJ(){if(!(typeof document>"u"))return document}function lJ(){var t;const e=(t=e0())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function hJ(){if(dJ())return localStorage;if(pJ())throw new $t("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Yc.getInstance()}function dJ(){try{return typeof localStorage<"u"}catch{return!1}}function pJ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class ui{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=ui.window;if(!ui.isWindowContainsWallet(n,r))throw new H1;this.connectionStorage=new fl(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return At(this,void 0,void 0,function*(){const n=yield new fl(e).getInjectedConnection();return new ui(e,n.jsBridgeKey)})}static isWalletInjected(e){return ui.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return ui.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?uJ().filter(([n,i])=>cJ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(y7,e)}restoreConnection(){return At(this,void 0,void 0,function*(){try{xn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();xn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return At(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){xn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return At(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r?.onRequestSent,i.signal=r?.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),xn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>xn("Wallet message received:",a)),(n=i?.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return At(this,void 0,void 0,function*(){try{xn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);xn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){xn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n?.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{xn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}ui.window=e0();class gJ{constructor(){this.localStorage=hJ()}getItem(e){return At(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return At(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return At(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function _7(t){return vJ(t)&&t.injected}function mJ(t){return _7(t)&&t.embedded}function vJ(t){return"jsBridgeKey"in t}const bJ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class V1{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e?.walletsListSource&&(this.walletsListSource=e.walletsListSource),e?.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return At(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return At(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(mJ);return r.length!==1?null:r[0]})}fetchWalletsList(){return At(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new W1("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(co(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){co(n),e=bJ}let r=[];try{r=ui.getCurrentlyInjectedWallets()}catch(n){co(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=ui.isWalletInjected(o),i.embedded=ui.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(h=>!h||typeof h!="object"||!("type"in h)))return!1;const f=a.find(h=>h.type==="sse");if(f&&(!("url"in f)||!f.url||!e.universal_url))return!1;const u=a.find(h=>h.type==="js");return!(u&&(!("key"in u)||!u.key))}}class t0 extends $t{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,t0.prototype)}}function yJ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new t0("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,f;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(f=o.amount)!==null&&f!==void 0?f:null}})}}function MJ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Xc(t,e)),G1(e,r))}function CJ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Xc(t,e)),G1(e,r))}function RJ(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Xc(t,e)),G1(e,r))}function TJ(t,e,r){return Object.assign({type:"disconnection",scope:r},Xc(t,e))}class DJ{constructor(){this.window=e0()}dispatchEvent(e,r){var n;return At(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return At(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class OJ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e?.eventDispatcher)!==null&&r!==void 0?r:new DJ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Jc({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return At(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return At(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>At(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",xJ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return At(this,void 0,void 0,function*(){return new Promise((e,r)=>At(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",wJ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=_J(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=EJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=SJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=AJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=PJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=IJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=TJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=MJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=CJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=RJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const NJ="3.0.5";class hl{constructor(e){if(this.walletsList=new V1,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:e?.manifestUrl||lJ(),storage:e?.storage||new gJ},this.walletsList=new V1({walletsListSource:e?.walletsListSource,cacheTTLMs:e?.walletsListCacheTTLMs}),this.tracker=new OJ({eventDispatcher:e?.eventDispatcher,tonConnectSdkVersion:NJ}),!this.dappSettings.manifestUrl)throw new q1("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new fl(this.dappSettings.storage),e?.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r?.request,s.openingDeadlineMS=r?.openingDeadlineMS,s.signal=r?.signal),this.connected)throw new z1;const o=hs(s?.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new $t("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s?.request),{openingDeadlineMS:s?.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return At(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=hs(e?.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield ll.fromStorage(this.dappSettings.storage);break;case"injected":a=yield ui.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a?.closeConnection(),a=null;return}if(i.signal.aborted){a?.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){co("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const f=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a?.closeConnection(),a=null};i.signal.addEventListener("abort",f);const u=cl(g=>At(this,void 0,void 0,function*(){yield a?.restoreConnection({openingDeadlineMS:e?.openingDeadlineMS,signal:g.signal}),i.signal.removeEventListener("abort",f),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e?.signal}),h=new Promise(g=>setTimeout(()=>g(),12e3));return Promise.race([u,h])})}sendTransaction(e,r){return At(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r?.onRequestSent,n.signal=r?.signal);const i=hs(n?.signal);if(i.signal.aborted)throw new $t("Transaction sending was aborted");this.checkConnection(),yJ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=GY(e,["validUntil"]),a=e.from||this.account.address,f=e.network||this.account.chain,u=yield this.provider.sendRequest(Qd.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:f})),{onRequestSent:n.onRequestSent,signal:i.signal});if(Qd.isError(u))return this.tracker.trackTransactionSigningFailed(this.wallet,e,u.error.message,u.error.code),Qd.parseAndThrowError(u);const h=Qd.convertFromRpcResponse(u);return this.tracker.trackTransactionSigned(this.wallet,e,h),h})}disconnect(e){var r;return At(this,void 0,void 0,function*(){if(!this.connected)throw new Yd;const n=hs(e?.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new $t("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i?.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=fJ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){co("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&YY(e)?r=new ui(this.dappSettings.storage,e.jsBridgeKey):r=new ll(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new $t("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=XY.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),xn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof Gd||r instanceof Vd)throw co(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new Yd}createConnectRequest(e){const r=[{name:"ton_addr"}];return e?.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}hl.walletsList=new V1,hl.isWalletInjected=t=>ui.isWalletInjected(t),hl.isInsideWalletBrowser=t=>ui.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function Y1(t){const{children:e,onClick:r}=t;return he.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function E7(t){const{wallet:e,connector:r,loading:n}=t,i=Se.useRef(null),s=Se.useRef(),[o,a]=Se.useState(),[f,u]=Se.useState(),[h,g]=Se.useState("connect"),[b,x]=Se.useState(!1),[S,C]=Se.useState();function D(W){s.current?.update({data:W})}async function B(){x(!0);try{a("");const W=await Fo.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const V=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:W}});if(!V)return;C(V),D(V),u(W)}}catch(W){a(W.message)}x(!1)}function L(){s.current=new e7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function H(){r.connect(e,{request:{tonProof:f}})}function F(){if("deepLink"in e){if(!e.deepLink||!S)return;const W=new URL(S),V=`${e.deepLink}${W.search}`;window.open(V)}}function k(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(S)}const $=Se.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),R=Se.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Se.useEffect(()=>{L(),B()},[]),he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-6",children:he.jsx(Wa,{title:"Connect wallet",onBack:t.onBack})}),he.jsxs("div",{className:"xc-text-center xc-mb-6",children:[he.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[he.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),he.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:b?he.jsx(Fa,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):he.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),he.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),he.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&he.jsx(Fa,{className:"xc-animate-spin"}),!b&&!n&&he.jsxs(he.Fragment,{children:[_7(e)&&he.jsxs(Y1,{onClick:H,children:[he.jsx(Fz,{className:"xc-opacity-80"}),"Extension"]}),$&&he.jsxs(Y1,{onClick:F,children:[he.jsx($4,{className:"xc-opacity-80"}),"Desktop"]}),R&&he.jsx(Y1,{onClick:k,children:"Telegram Mini App"})]})]})]})}function LJ(t){const[e,r]=Se.useState(""),[n,i]=Se.useState(),[s,o]=Se.useState(),a=F1(),[f,u]=Se.useState(!1);async function h(b){if(!b||!b.connectItems?.tonProof)return;u(!0);const x=await Fo.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:b?.device.appName,inviter_code:a.inviterCode,address:b.account.address,chain:b.account.chain,connect_info:[{name:"ton_addr",network:b.account.chain,...b.account},b.connectItems?.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(x.data),u(!1)}Se.useEffect(()=>{const b=new hl({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),x=b.onStatusChange(h);return o(b),r("select"),x},[]);function g(b){r("connect"),i(b)}return he.jsxs(ls,{children:[e==="select"&&he.jsx(a7,{connector:s,onSelect:g,onBack:t.onBack}),e==="connect"&&he.jsx(E7,{connector:s,wallet:n,onBack:t.onBack,loading:f})]})}function S7(t){const{children:e,className:r}=t,n=Se.useRef(null),[i,s]=Se.useState(0);function o(){try{const a=n.current?.children||[];let f=0;for(let u=0;u{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Se.useEffect(()=>{console.log("maxHeight",i)},[i]),he.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function kJ(){return he.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[he.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),he.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function A7(t){const{wallets:e}=Hf(),[r,n]=Se.useState(),i=Se.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-6",children:he.jsx(Wa,{title:"Select wallet",onBack:t.onBack})}),he.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[he.jsx(q4,{className:"xc-shrink-0 xc-opacity-50"}),he.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),he.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>he.jsx(TS,{wallet:a,onClick:s},`feature-${a.key}`)):he.jsx(kJ,{})})]})}function BJ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,f]=Se.useState(""),[u,h]=Se.useState(null),[g,b]=Se.useState("");function x(B){h(B),f("evm-wallet")}function S(B){f("email"),b(B)}async function C(B){await e(B)}function D(){f("ton-wallet")}return Se.useEffect(()=>{f("index")},[]),he.jsx(JG,{config:t.config,children:he.jsxs(S7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&he.jsx(LY,{onBack:()=>f("index"),onLogin:C,wallet:u}),a==="ton-wallet"&&he.jsx(LJ,{onBack:()=>f("index"),onLogin:C}),a==="email"&&he.jsx(lY,{email:g,onBack:()=>f("index"),onLogin:C}),a==="index"&&he.jsx($S,{header:r,onEmailConfirm:S,onSelectWallet:x,onSelectMoreWallets:()=>{f("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&he.jsx(A7,{onBack:()=>f("index"),onSelectWallet:x})]})})}function FJ(t){const{wallet:e,onConnect:r}=t,[n,i]=Se.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-6",children:he.jsx(Wa,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&he.jsx(i7,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&he.jsx(s7,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&he.jsx(o7,{wallet:e})]})}function jJ(t){const{email:e}=t,[r,n]=Se.useState("captcha");return he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-12",children:he.jsx(Wa,{title:"Sign in with email",onBack:t.onBack})}),r==="captcha"&&he.jsx(ZS,{email:e,onCodeSend:()=>n("verify-email")}),r==="verify-email"&&he.jsx(XS,{email:e,onInputCode:t.onInputCode,onResendCode:()=>n("captcha")})]})}function UJ(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,config:i={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[s,o]=Se.useState(""),[a,f]=Se.useState(),[u,h]=Se.useState(),g=Se.useRef(),[b,x]=Se.useState("");function S(F){f(F),o("evm-wallet-connect")}function C(F){x(F),o("email-connect")}async function D(F,k){await e?.({chain_type:"eip155",client:F.client,connect_info:k,wallet:F}),o("index")}async function B(F,k){await n?.(F,k)}function L(F){h(F),o("ton-wallet-connect")}async function H(F){F&&await r?.({chain_type:"ton",client:g.current,connect_info:F,wallet:F})}return Se.useEffect(()=>{g.current=new hl({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const F=g.current.onStatusChange(H);return o("index"),F},[]),he.jsxs(S7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[s==="evm-wallet-select"&&he.jsx(A7,{onBack:()=>o("index"),onSelectWallet:S}),s==="evm-wallet-connect"&&he.jsx(FJ,{onBack:()=>o("index"),onConnect:D,wallet:a}),s==="ton-wallet-select"&&he.jsx(a7,{connector:g.current,onSelect:L,onBack:()=>o("index")}),s==="ton-wallet-connect"&&he.jsx(E7,{connector:g.current,wallet:u,onBack:()=>o("index")}),s==="email-connect"&&he.jsx(jJ,{email:b,onBack:()=>o("index"),onInputCode:B}),s==="index"&&he.jsx($S,{onEmailConfirm:C,onSelectWallet:S,onSelectMoreWallets:()=>o("evm-wallet-select"),onSelectTonConnect:()=>o("ton-wallet-select"),config:i})]})}Ii.CodattaConnect=UJ,Ii.CodattaConnectContextProvider=Rz,Ii.CodattaSignin=BJ,Ii.WalletItem=la,Ii.coinbaseWallet=B4,Ii.useCodattaConnectContext=Hf,Object.defineProperty(Ii,Symbol.toStringTag,{value:"Module"})})); +`+e:""}`,Object.setPrototypeOf(this,$t.prototype)}get info(){return""}}$t.prefix="[TON_CONNECT_SDK_ERROR]";class q1 extends $t{get info(){return"Passed DappMetadata is in incorrect format."}constructor(...e){super(...e),Object.setPrototypeOf(this,q1.prototype)}}class Vd extends $t{get info(){return"Passed `tonconnect-manifest.json` contains errors. Check format of your manifest. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,Vd.prototype)}}class Gd extends $t{get info(){return"Manifest not found. Make sure you added `tonconnect-manifest.json` to the root of your app or passed correct manifestUrl. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,Gd.prototype)}}class z1 extends $t{get info(){return"Wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection."}constructor(...e){super(...e),Object.setPrototypeOf(this,z1.prototype)}}class Yd extends $t{get info(){return"Send transaction or other protocol methods called while wallet is not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,Yd.prototype)}}function YY(t){return"jsBridgeKey"in t}class Jd extends $t{get info(){return"User rejects the action in the wallet."}constructor(...e){super(...e),Object.setPrototypeOf(this,Jd.prototype)}}class Xd extends $t{get info(){return"Request to the wallet contains errors."}constructor(...e){super(...e),Object.setPrototypeOf(this,Xd.prototype)}}class Zd extends $t{get info(){return"App tries to send rpc request to the injected wallet while not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,Zd.prototype)}}class H1 extends $t{get info(){return"There is an attempt to connect to the injected wallet while it is not exists in the webpage."}constructor(...e){super(...e),Object.setPrototypeOf(this,H1.prototype)}}class W1 extends $t{get info(){return"An error occurred while fetching the wallets list."}constructor(...e){super(...e),Object.setPrototypeOf(this,W1.prototype)}}class Go extends $t{constructor(...e){super(...e),Object.setPrototypeOf(this,Go.prototype)}}const g7={[Vo.UNKNOWN_ERROR]:Go,[Vo.USER_REJECTS_ERROR]:Jd,[Vo.BAD_REQUEST_ERROR]:Xd,[Vo.UNKNOWN_APP_ERROR]:Zd,[Vo.MANIFEST_NOT_FOUND_ERROR]:Gd,[Vo.MANIFEST_CONTENT_ERROR]:Vd};class JY{parseError(e){let r=Go;return e.code in g7&&(r=g7[e.code]||Go),new r(e.message)}}const XY=new JY;class ZY{isError(e){return"error"in e}}const m7={[Gc.UNKNOWN_ERROR]:Go,[Gc.USER_REJECTS_ERROR]:Jd,[Gc.BAD_REQUEST_ERROR]:Xd,[Gc.UNKNOWN_APP_ERROR]:Zd};class QY extends ZY{convertToRpcRequest(e){return{method:"sendTransaction",params:[JSON.stringify(e)]}}parseAndThrowError(e){let r=Go;throw e.error.code in m7&&(r=m7[e.error.code]||Go),new r(e.error.message)}convertFromRpcResponse(e){return{boc:e.result}}}const Qd=new QY;class eJ{constructor(e,r){this.storage=e,this.storeKey="ton-connect-storage_http-bridge-gateway::"+r}storeLastEventId(e){return At(this,void 0,void 0,function*(){return this.storage.setItem(this.storeKey,e)})}removeLastEventId(){return At(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getLastEventId(){return At(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e||null})}}function tJ(t){return t.slice(-1)==="/"?t.slice(0,-1):t}function v7(t,e){return tJ(t)+"/"+e}function rJ(t){if(!t)return!1;const e=new URL(t);return e.protocol==="tg:"||e.hostname==="t.me"}function nJ(t){return t.replaceAll(".","%2E").replaceAll("-","%2D").replaceAll("_","%5F").replaceAll("&","-").replaceAll("=","__").replaceAll("%","--")}function b7(t,e){return At(this,void 0,void 0,function*(){return new Promise((r,n)=>{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new $t("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new $t("Delay aborted"))})})})}function hs(t){const e=new AbortController;return t?.aborted?e.abort():t?.addEventListener("abort",()=>e.abort(),{once:!0}),e}function cl(t,e){var r,n;return At(this,void 0,void 0,function*(){const i=(r=e?.attempts)!==null&&r!==void 0?r:10,s=(n=e?.delayMs)!==null&&n!==void 0?n:200,o=hs(e?.signal);if(typeof t!="function")throw new $t(`Expected a function, got ${typeof t}`);let a=0,f;for(;aAt(this,void 0,void 0,function*(){if(s=g??null,o?.abort(),o=hs(g),o.signal.aborted)throw new $t("Resource creation was aborted");n=b??null;const x=t(o.signal,...b);i=x;const S=yield x;if(i!==x&&S!==r)throw yield e(S),new $t("Resource creation was aborted by a new resource creation");return r=S,r});return{create:a,current:()=>r??null,dispose:()=>At(this,void 0,void 0,function*(){try{const g=r;r=null;const b=i;i=null;try{o?.abort()}catch{}yield Promise.allSettled([g?e(g):Promise.resolve(),b?e(yield b):Promise.resolve()])}catch{}}),recreate:g=>At(this,void 0,void 0,function*(){const b=r,x=i,S=n,C=s;if(yield b7(g),b===r&&x===i&&S===n&&C===s)return yield a(s,...S??[]);throw new $t("Resource recreation was aborted by a new resource creation")})}}function oJ(t,e){const r=e?.timeout,n=e?.signal,i=hs(n);return new Promise((s,o)=>At(this,void 0,void 0,function*(){if(i.signal.aborted){o(new $t("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new $t(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new $t("Operation aborted"))},{once:!0});const f={timeout:r,abort:i.signal};yield t((...u)=>{clearTimeout(a),s(...u)},()=>{clearTimeout(a),o()},f)}))}class K1{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=sJ((o,a)=>At(this,void 0,void 0,function*(){const f={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield aJ(f)}),o=>At(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new eJ(e,r)}get isReady(){const e=this.eventSource.current();return e?.readyState===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return e?.readyState!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return e?.readyState===EventSource.CONNECTING}registerSession(e){return At(this,void 0,void 0,function*(){yield this.eventSource.create(e?.signal,e?.openingDeadlineMS)})}send(e,r,n,i){var s;return At(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i?.ttl,o.signal=i?.signal,o.attempts=i?.attempts);const a=new URL(v7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",(o?.ttl||this.defaultTtl).toString()),a.searchParams.append("topic",n);const f=p7.encode(e);yield cl(u=>At(this,void 0,void 0,function*(){const h=yield this.post(a,f,u.signal);if(!h.ok)throw new $t(`Bridge send failed, status ${h.status}`)}),{attempts:(s=o?.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o?.signal})})}pause(){this.eventSource.dispose().catch(e=>co(`Bridge pause failed, ${e}`))}unPause(){return At(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return At(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>co(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return At(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new $t(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return At(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new $t("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),xn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new $t("Bridge error, unknown state")})}messagesHandler(e){return At(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new $t(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function aJ(t){return At(this,void 0,void 0,function*(){return yield oJ((e,r,n)=>At(this,void 0,void 0,function*(){var i;const o=hs(n.signal).signal;if(o.aborted){r(new $t("Bridge connection aborted"));return}const a=new URL(v7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const f=yield t.bridgeGatewayStorage.getLastEventId();if(f&&a.searchParams.append("last_event_id",f),o.aborted){r(new $t("Bridge connection aborted"));return}const u=new EventSource(a.toString());u.onerror=h=>At(this,void 0,void 0,function*(){if(o.aborted){u.close(),r(new $t("Bridge connection aborted"));return}try{const g=yield t.errorHandler(u,h);g!==u&&u.close(),g&&g!==u&&e(g)}catch(g){u.close(),r(g)}}),u.onopen=()=>{if(o.aborted){u.close(),r(new $t("Bridge connection aborted"));return}e(u)},u.onmessage=h=>{if(o.aborted){u.close(),r(new $t("Bridge connection aborted"));return}t.messageHandler(h)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{u.close(),r(new $t("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function ul(t){return!("connectEvent"in t)}class fl{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return At(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!ul(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return At(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return At(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new $1(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new $1(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new $t("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new $t("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new $t("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new $t("Trying to read HTTP connection source while injected connection is stored");if(!ul(e))throw new $t("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new $t("Trying to read Injected bridge connection source while nothing is stored");if(e?.type==="http")throw new $t("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return At(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return At(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!ul(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const y7=2;class ll{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new fl(e)}static fromStorage(e){return At(this,void 0,void 0,function*(){const n=yield new fl(e).getHttpConnection();return ul(n)?new ll(e,n.connectionSource):new ll(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=hs(r?.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new $1;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>At(this,void 0,void 0,function*(){i.signal.aborted||(yield cl(a=>{var f;return this.openGateways(s,{openingDeadlineMS:(f=r?.openingDeadlineMS)!==null&&f!==void 0?f:this.defaultOpeningDeadlineMS,signal:a?.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return At(this,void 0,void 0,function*(){const i=hs(e?.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e?.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(ul(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i?.signal});if(Array.isArray(this.walletConnectionSource))throw new $t("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(xn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new K1(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield cl(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r?.onRequestSent,n.signal=r?.signal,n.attempts=r?.attempts),new Promise((i,s)=>At(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new $t("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),xn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const f=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),Kd(this.session.walletPublicKey));try{yield this.gateway.send(f,this.session.walletPublicKey,e.method,{attempts:n?.attempts,signal:n?.signal}),(o=n?.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(u){s(u)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return At(this,void 0,void 0,function*(){return new Promise(r=>At(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=hs(e?.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){xn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return At(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return At(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(xn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return At(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(p7.decode(e.message).toUint8Array(),Kd(e.from)));if(xn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){xn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){co(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(xn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return At(this,void 0,void 0,function*(){throw new $t(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return At(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return At(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return rJ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",y7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+nJ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return At(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new K1(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>cl(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r?.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r?.signal})));return}else return this.gateway&&(xn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new K1(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r?.openingDeadlineMS,signal:r?.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==e?.except).forEach(n=>n.close()),this.pendingGateways=[]}}function w7(t,e){return x7(t,[e])}function x7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function cJ(t){try{return!w7(t,"tonconnect")||!w7(t.tonconnect,"walletInfo")?!1:x7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Yc{constructor(){this.storage={}}static getInstance(){return Yc.instance||(Yc.instance=new Yc),Yc.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function e0(){if(!(typeof window>"u"))return window}function uJ(){const t=e0();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function fJ(){if(!(typeof document>"u"))return document}function lJ(){var t;const e=(t=e0())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function hJ(){if(dJ())return localStorage;if(pJ())throw new $t("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Yc.getInstance()}function dJ(){try{return typeof localStorage<"u"}catch{return!1}}function pJ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class ui{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=ui.window;if(!ui.isWindowContainsWallet(n,r))throw new H1;this.connectionStorage=new fl(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return At(this,void 0,void 0,function*(){const n=yield new fl(e).getInjectedConnection();return new ui(e,n.jsBridgeKey)})}static isWalletInjected(e){return ui.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return ui.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?uJ().filter(([n,i])=>cJ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(y7,e)}restoreConnection(){return At(this,void 0,void 0,function*(){try{xn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();xn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return At(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){xn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return At(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r?.onRequestSent,i.signal=r?.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),xn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>xn("Wallet message received:",a)),(n=i?.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return At(this,void 0,void 0,function*(){try{xn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);xn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){xn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n?.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{xn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}ui.window=e0();class gJ{constructor(){this.localStorage=hJ()}getItem(e){return At(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return At(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return At(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function _7(t){return vJ(t)&&t.injected}function mJ(t){return _7(t)&&t.embedded}function vJ(t){return"jsBridgeKey"in t}const bJ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class V1{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e?.walletsListSource&&(this.walletsListSource=e.walletsListSource),e?.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return At(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return At(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(mJ);return r.length!==1?null:r[0]})}fetchWalletsList(){return At(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new W1("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(co(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){co(n),e=bJ}let r=[];try{r=ui.getCurrentlyInjectedWallets()}catch(n){co(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=ui.isWalletInjected(o),i.embedded=ui.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(h=>!h||typeof h!="object"||!("type"in h)))return!1;const f=a.find(h=>h.type==="sse");if(f&&(!("url"in f)||!f.url||!e.universal_url))return!1;const u=a.find(h=>h.type==="js");return!(u&&(!("key"in u)||!u.key))}}class t0 extends $t{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,t0.prototype)}}function yJ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new t0("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,f;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(f=o.amount)!==null&&f!==void 0?f:null}})}}function MJ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Xc(t,e)),G1(e,r))}function CJ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Xc(t,e)),G1(e,r))}function RJ(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Xc(t,e)),G1(e,r))}function TJ(t,e,r){return Object.assign({type:"disconnection",scope:r},Xc(t,e))}class DJ{constructor(){this.window=e0()}dispatchEvent(e,r){var n;return At(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return At(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class OJ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e?.eventDispatcher)!==null&&r!==void 0?r:new DJ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Jc({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return At(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return At(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>At(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",xJ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return At(this,void 0,void 0,function*(){return new Promise((e,r)=>At(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",wJ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=_J(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=EJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=SJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=AJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=PJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=IJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=TJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=MJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=CJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=RJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const NJ="3.0.5";class hl{constructor(e){if(this.walletsList=new V1,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:e?.manifestUrl||lJ(),storage:e?.storage||new gJ},this.walletsList=new V1({walletsListSource:e?.walletsListSource,cacheTTLMs:e?.walletsListCacheTTLMs}),this.tracker=new OJ({eventDispatcher:e?.eventDispatcher,tonConnectSdkVersion:NJ}),!this.dappSettings.manifestUrl)throw new q1("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new fl(this.dappSettings.storage),e?.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r?.request,s.openingDeadlineMS=r?.openingDeadlineMS,s.signal=r?.signal),this.connected)throw new z1;const o=hs(s?.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new $t("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s?.request),{openingDeadlineMS:s?.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return At(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=hs(e?.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield ll.fromStorage(this.dappSettings.storage);break;case"injected":a=yield ui.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a?.closeConnection(),a=null;return}if(i.signal.aborted){a?.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){co("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const f=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a?.closeConnection(),a=null};i.signal.addEventListener("abort",f);const u=cl(g=>At(this,void 0,void 0,function*(){yield a?.restoreConnection({openingDeadlineMS:e?.openingDeadlineMS,signal:g.signal}),i.signal.removeEventListener("abort",f),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e?.signal}),h=new Promise(g=>setTimeout(()=>g(),12e3));return Promise.race([u,h])})}sendTransaction(e,r){return At(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r?.onRequestSent,n.signal=r?.signal);const i=hs(n?.signal);if(i.signal.aborted)throw new $t("Transaction sending was aborted");this.checkConnection(),yJ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=GY(e,["validUntil"]),a=e.from||this.account.address,f=e.network||this.account.chain,u=yield this.provider.sendRequest(Qd.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:f})),{onRequestSent:n.onRequestSent,signal:i.signal});if(Qd.isError(u))return this.tracker.trackTransactionSigningFailed(this.wallet,e,u.error.message,u.error.code),Qd.parseAndThrowError(u);const h=Qd.convertFromRpcResponse(u);return this.tracker.trackTransactionSigned(this.wallet,e,h),h})}disconnect(e){var r;return At(this,void 0,void 0,function*(){if(!this.connected)throw new Yd;const n=hs(e?.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new $t("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i?.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=fJ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){co("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&YY(e)?r=new ui(this.dappSettings.storage,e.jsBridgeKey):r=new ll(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new $t("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=XY.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),xn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof Gd||r instanceof Vd)throw co(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new Yd}createConnectRequest(e){const r=[{name:"ton_addr"}];return e?.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}hl.walletsList=new V1,hl.isWalletInjected=t=>ui.isWalletInjected(t),hl.isInsideWalletBrowser=t=>ui.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function Y1(t){const{children:e,onClick:r}=t;return he.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function E7(t){const{wallet:e,connector:r,loading:n}=t,i=Se.useRef(null),s=Se.useRef(),[o,a]=Se.useState(),[f,u]=Se.useState(),[h,g]=Se.useState("connect"),[b,x]=Se.useState(!1),[S,C]=Se.useState();function D(W){s.current?.update({data:W})}async function B(){x(!0);try{a("");const W=await Fo.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const V=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:W}});if(!V)return;C(V),D(V),u(W)}}catch(W){a(W.message)}x(!1)}function L(){s.current=new e7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function H(){r.connect(e,{request:{tonProof:f}})}function F(){if("deepLink"in e){if(!e.deepLink||!S)return;const W=new URL(S),V=`${e.deepLink}${W.search}`;window.open(V)}}function k(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(S)}const $=Se.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),R=Se.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Se.useEffect(()=>{L(),B()},[]),he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-6",children:he.jsx(Wa,{title:"Connect wallet",onBack:t.onBack})}),he.jsxs("div",{className:"xc-text-center xc-mb-6",children:[he.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[he.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),he.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:b?he.jsx(Fa,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):he.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),he.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),he.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&he.jsx(Fa,{className:"xc-animate-spin"}),!b&&!n&&he.jsxs(he.Fragment,{children:[_7(e)&&he.jsxs(Y1,{onClick:H,children:[he.jsx(Fz,{className:"xc-opacity-80"}),"Extension"]}),$&&he.jsxs(Y1,{onClick:F,children:[he.jsx($4,{className:"xc-opacity-80"}),"Desktop"]}),R&&he.jsx(Y1,{onClick:k,children:"Telegram Mini App"})]})]})]})}function LJ(t){const[e,r]=Se.useState(""),[n,i]=Se.useState(),[s,o]=Se.useState(),a=F1(),[f,u]=Se.useState(!1);async function h(b){if(!b||!b.connectItems?.tonProof)return;u(!0);const x=await Fo.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:b?.device.appName,inviter_code:a.inviterCode,address:b.account.address,chain:b.account.chain,connect_info:[{name:"ton_addr",network:b.account.chain,...b.account},b.connectItems?.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(x.data),u(!1)}Se.useEffect(()=>{const b=new hl({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),x=b.onStatusChange(h);return o(b),r("select"),x},[]);function g(b){r("connect"),i(b)}return he.jsxs(ls,{children:[e==="select"&&he.jsx(a7,{connector:s,onSelect:g,onBack:t.onBack}),e==="connect"&&he.jsx(E7,{connector:s,wallet:n,onBack:t.onBack,loading:f})]})}function S7(t){const{children:e,className:r}=t,n=Se.useRef(null),[i,s]=Se.useState(0);function o(){try{const a=n.current?.children||[];let f=0;for(let u=0;u{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Se.useEffect(()=>{console.log("maxHeight",i)},[i]),he.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function kJ(){return he.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[he.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),he.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function A7(t){const{wallets:e}=Hf(),[r,n]=Se.useState(),i=Se.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-6",children:he.jsx(Wa,{title:"Select wallet",onBack:t.onBack})}),he.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[he.jsx(q4,{className:"xc-shrink-0 xc-opacity-50"}),he.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),he.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>he.jsx(TS,{wallet:a,onClick:s},`feature-${a.key}`)):he.jsx(kJ,{})})]})}function BJ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,f]=Se.useState(""),[u,h]=Se.useState(null),[g,b]=Se.useState("");function x(B){h(B),f("evm-wallet")}function S(B){f("email"),b(B)}async function C(B){await e(B)}function D(){f("ton-wallet")}return Se.useEffect(()=>{f("index")},[]),he.jsx(JG,{config:t.config,children:he.jsxs(S7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&he.jsx(LY,{onBack:()=>f("index"),onLogin:C,wallet:u}),a==="ton-wallet"&&he.jsx(LJ,{onBack:()=>f("index"),onLogin:C}),a==="email"&&he.jsx(lY,{email:g,onBack:()=>f("index"),onLogin:C}),a==="index"&&he.jsx($S,{header:r,onEmailConfirm:S,onSelectWallet:x,onSelectMoreWallets:()=>{f("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&he.jsx(A7,{onBack:()=>f("index"),onSelectWallet:x})]})})}function FJ(t){const{wallet:e,onConnect:r}=t,[n,i]=Se.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-6",children:he.jsx(Wa,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&he.jsx(i7,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&he.jsx(s7,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&he.jsx(o7,{wallet:e})]})}function jJ(t){const{email:e}=t,[r,n]=Se.useState("captcha");return he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-12",children:he.jsx(Wa,{title:"Sign in with email",onBack:t.onBack})}),r==="captcha"&&he.jsx(ZS,{email:e,onCodeSend:()=>n("verify-email")}),r==="verify-email"&&he.jsx(XS,{email:e,onInputCode:t.onInputCode,onResendCode:()=>n("captcha")})]})}function UJ(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,header:i,config:s={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[o,a]=Se.useState(""),[f,u]=Se.useState(),[h,g]=Se.useState(),b=Se.useRef(),[x,S]=Se.useState("");function C(k){u(k),a("evm-wallet-connect")}function D(k){S(k),a("email-connect")}async function B(k,$){await e?.({chain_type:"eip155",client:k.client,connect_info:$,wallet:k}),a("index")}async function L(k,$){await n?.(k,$)}function H(k){g(k),a("ton-wallet-connect")}async function F(k){k&&await r?.({chain_type:"ton",client:b.current,connect_info:k,wallet:k})}return Se.useEffect(()=>{b.current=new hl({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const k=b.current.onStatusChange(F);return a("index"),k},[]),he.jsxs(S7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[o==="evm-wallet-select"&&he.jsx(A7,{onBack:()=>a("index"),onSelectWallet:C}),o==="evm-wallet-connect"&&he.jsx(FJ,{onBack:()=>a("index"),onConnect:B,wallet:f}),o==="ton-wallet-select"&&he.jsx(a7,{connector:b.current,onSelect:H,onBack:()=>a("index")}),o==="ton-wallet-connect"&&he.jsx(E7,{connector:b.current,wallet:h,onBack:()=>a("index")}),o==="email-connect"&&he.jsx(jJ,{email:x,onBack:()=>a("index"),onInputCode:L}),o==="index"&&he.jsx($S,{header:i,onEmailConfirm:D,onSelectWallet:C,onSelectMoreWallets:()=>a("evm-wallet-select"),onSelectTonConnect:()=>a("ton-wallet-select"),config:s})]})}Ii.CodattaConnect=UJ,Ii.CodattaConnectContextProvider=Rz,Ii.CodattaSignin=BJ,Ii.WalletItem=la,Ii.coinbaseWallet=B4,Ii.useCodattaConnectContext=Hf,Object.defineProperty(Ii,Symbol.toStringTag,{value:"Module"})})); diff --git a/dist/main-D60MaR66.js b/dist/main-DmP-7EWG.js similarity index 96% rename from dist/main-D60MaR66.js rename to dist/main-DmP-7EWG.js index 9e1c534..14ae93e 100644 --- a/dist/main-D60MaR66.js +++ b/dist/main-DmP-7EWG.js @@ -73,7 +73,7 @@ function mT() { var ie = S && F[S] || F[C]; return typeof ie == "function" ? ie : null; } - var $ = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + var k = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function N(F) { { for (var ie = arguments.length, le = new Array(ie > 1 ? ie - 1 : 0), me = 1; me < ie; me++) @@ -83,7 +83,7 @@ function mT() { } function z(F, ie, le) { { - var me = $.ReactDebugCurrentFrame, Ee = me.getStackAddendum(); + var me = k.ReactDebugCurrentFrame, Ee = me.getStackAddendum(); Ee !== "" && (ie += "%s", le = le.concat([Ee])); var Le = le.map(function(Ie) { return String(Ie); @@ -91,10 +91,10 @@ function mT() { Le.unshift("Warning: " + ie), Function.prototype.apply.call(console[F], console, Le); } } - var k = !1, B = !1, U = !1, R = !1, W = !1, J; + var B = !1, $ = !1, U = !1, R = !1, W = !1, J; J = Symbol.for("react.module.reference"); function ne(F) { - return !!(typeof F == "string" || typeof F == "function" || F === n || F === s || W || F === i || F === u || F === h || R || F === x || k || B || U || typeof F == "object" && F !== null && (F.$$typeof === v || F.$$typeof === g || F.$$typeof === o || F.$$typeof === a || F.$$typeof === f || // This needs to include all possible module reference object + return !!(typeof F == "string" || typeof F == "function" || F === n || F === s || W || F === i || F === u || F === h || R || F === x || B || $ || U || typeof F == "object" && F !== null && (F.$$typeof === v || F.$$typeof === g || F.$$typeof === o || F.$$typeof === a || F.$$typeof === f || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. @@ -217,7 +217,7 @@ function mT() { p < 0 && N("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } - var oe = $.ReactCurrentDispatcher, Q; + var oe = k.ReactCurrentDispatcher, Q; function X(F, ie, le) { { if (Q === void 0) @@ -343,7 +343,7 @@ function mT() { } return ""; } - var be = Object.prototype.hasOwnProperty, Ae = {}, Te = $.ReactDebugCurrentFrame; + var be = Object.prototype.hasOwnProperty, Ae = {}, Te = k.ReactDebugCurrentFrame; function Re(F) { if (F) { var ie = F._owner, le = fe(F.type, F._source, ie ? ie.type : null); @@ -394,7 +394,7 @@ function mT() { if (De(F)) return N("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ze(F)), je(F); } - var _e = $.ReactCurrentOwner, Ze = { + var _e = k.ReactCurrentOwner, Ze = { key: !0, ref: !0, __self: !0, @@ -488,7 +488,7 @@ function mT() { return ct(F, Qe, Xe, Ee, me, _e.current, Ie); } } - var Gt = $.ReactCurrentOwner, Et = $.ReactDebugCurrentFrame; + var Gt = k.ReactCurrentOwner, Et = k.ReactDebugCurrentFrame; function Yt(F) { if (F) { var ie = F._owner, le = fe(F.type, F._source, ie ? ie.type : null); @@ -2998,7 +2998,7 @@ function cO(t) { return Vf(`0x${e}`); } async function uO({ hash: t, signature: e }) { - const r = Uo(t) ? t : od(t), { secp256k1: n } = await import("./secp256k1-DbKZjSuc.js"); + const r = Uo(t) ? t : od(t), { secp256k1: n } = await import("./secp256k1-K3HVP1eD.js"); return `0x${(() => { if (typeof e == "object" && "r" in e && "s" in e) { const { r: u, s: h, v: g, yParity: v } = e, x = Number(v ?? g), S = Vw(x); @@ -3896,10 +3896,10 @@ async function f1(t, e) { } if (u.includes("nonce") && typeof a > "u" && g) if (f) { - const $ = await D(); + const k = await D(); v.nonce = await f.consume({ address: g.address, - chainId: $, + chainId: k, client: t }); } else @@ -3908,18 +3908,18 @@ async function f1(t, e) { blockTag: "pending" }); if ((u.includes("blobVersionedHashes") || u.includes("sidecars")) && n && o) { - const $ = T4({ blobs: n, kzg: o }); + const k = T4({ blobs: n, kzg: o }); if (u.includes("blobVersionedHashes")) { const N = FO({ - commitments: $, + commitments: k, to: "hex" }); v.blobVersionedHashes = N; } if (u.includes("sidecars")) { - const N = D4({ blobs: n, commitments: $, kzg: o }), z = zO({ + const N = D4({ blobs: n, commitments: k, kzg: o }), z = zO({ blobs: n, - commitments: $, + commitments: k, proofs: N, to: "hex" }); @@ -3930,14 +3930,14 @@ async function f1(t, e) { try { v.type = HO(v); } catch { - let $ = Zw.get(t.uid); - typeof $ > "u" && ($ = typeof (await S())?.baseFeePerGas == "bigint", Zw.set(t.uid, $)), v.type = $ ? "eip1559" : "legacy"; + let k = Zw.get(t.uid); + typeof k > "u" && (k = typeof (await S())?.baseFeePerGas == "bigint", Zw.set(t.uid, k)), v.type = k ? "eip1559" : "legacy"; } if (u.includes("fees")) if (v.type !== "legacy" && v.type !== "eip2930") { if (typeof v.maxFeePerGas > "u" || typeof v.maxPriorityFeePerGas > "u") { - const $ = await S(), { maxFeePerGas: N, maxPriorityFeePerGas: z } = await Yw(t, { - block: $, + const k = await S(), { maxFeePerGas: N, maxPriorityFeePerGas: z } = await Yw(t, { + block: k, chain: i, request: v }); @@ -3951,8 +3951,8 @@ async function f1(t, e) { if (typeof e.maxFeePerGas < "u" || typeof e.maxPriorityFeePerGas < "u") throw new c1(); if (typeof e.gasPrice > "u") { - const $ = await S(), { gasPrice: N } = await Yw(t, { - block: $, + const k = await S(), { gasPrice: N } = await Yw(t, { + block: k, chain: i, request: v, type: "legacy" @@ -3982,14 +3982,14 @@ async function KO(t, e) { params: m ? [p, l ?? "latest", m] : l ? [p, l] : [p] }); }; - const { accessList: i, authorizationList: s, blobs: o, blobVersionedHashes: a, blockNumber: f, blockTag: u, data: h, gas: g, gasPrice: v, maxFeePerBlobGas: x, maxFeePerGas: S, maxPriorityFeePerGas: C, nonce: D, value: $, stateOverride: N, ...z } = await f1(t, { + const { accessList: i, authorizationList: s, blobs: o, blobVersionedHashes: a, blockNumber: f, blockTag: u, data: h, gas: g, gasPrice: v, maxFeePerBlobGas: x, maxFeePerGas: S, maxPriorityFeePerGas: C, nonce: D, value: k, stateOverride: N, ...z } = await f1(t, { ...e, parameters: ( // Some RPC Providers do not compute versioned hashes from blobs. We will need // to compute them. n?.type === "local" ? void 0 : ["blobVersionedHashes"] ) - }), B = (typeof f == "bigint" ? br(f) : void 0) || u, U = wO(N), R = await (async () => { + }), $ = (typeof f == "bigint" ? br(f) : void 0) || u, U = wO(N), R = await (async () => { if (z.to) return z.to; if (s && s.length > 0) @@ -4016,13 +4016,13 @@ async function KO(t, e) { maxPriorityFeePerGas: C, nonce: D, to: R, - value: $ + value: k }); - let E = BigInt(await K({ block: B, request: ne, rpcStateOverride: U })); + let E = BigInt(await K({ block: $, request: ne, rpcStateOverride: U })); if (s) { const b = await WO(t, { address: ne.from }), l = await Promise.all(s.map(async (p) => { const { address: m } = p, w = await K({ - block: B, + block: $, request: { authorizationList: void 0, data: h, @@ -4199,7 +4199,7 @@ async function Kd(t, e) { throw new qa({ docsPath: "/docs/actions/wallet/sendTransaction" }); - const $ = r ? pi(r) : null; + const k = r ? pi(r) : null; try { Wd(e); const N = await (async () => { @@ -4212,21 +4212,21 @@ async function Kd(t, e) { throw new pt("`to` is required. Could not infer from `authorizationList`."); }); })(); - if ($?.type === "json-rpc" || $ === null) { + if (k?.type === "json-rpc" || k === null) { let z; n !== null && (z = await Hn(t, Gf, "getChainId")({}), $4({ currentChainId: z, chain: n })); - const k = t.chain?.formatters?.transactionRequest?.format, U = (k || a1)({ + const B = t.chain?.formatters?.transactionRequest?.format, U = (B || a1)({ // Pick out extra data that might exist on the chain's transaction request type. - ...I4(D, { format: k }), + ...I4(D, { format: B }), accessList: i, authorizationList: s, blobs: o, chainId: z, data: a, - from: $?.address, + from: k?.address, gas: f, gasPrice: u, maxFeePerBlobGas: h, @@ -4257,9 +4257,9 @@ async function Kd(t, e) { throw ne; } } - if ($?.type === "local") { + if (k?.type === "local") { const z = await Hn(t, f1, "prepareTransactionRequest")({ - account: $, + account: k, accessList: i, authorizationList: s, blobs: o, @@ -4271,20 +4271,20 @@ async function Kd(t, e) { maxFeePerGas: g, maxPriorityFeePerGas: v, nonce: x, - nonceManager: $.nonceManager, + nonceManager: k.nonceManager, parameters: [...k4, "sidecars"], type: S, value: C, ...D, to: N - }), k = n?.serializers?.transaction, B = await $.signTransaction(z, { - serializer: k + }), B = n?.serializers?.transaction, $ = await k.signTransaction(z, { + serializer: B }); return await Hn(t, F4, "sendRawTransaction")({ - serializedTransaction: B + serializedTransaction: $ }); } - throw $?.type === "smart" ? new Nh({ + throw k?.type === "smart" ? new Nh({ metaMessages: [ "Consider using the `sendUserOperation` Action instead." ], @@ -4292,12 +4292,12 @@ async function Kd(t, e) { type: "smart" }) : new Nh({ docsPath: "/docs/actions/wallet/sendTransaction", - type: $?.type + type: k?.type }); } catch (N) { throw N instanceof Nh ? N : B4(N, { ...e, - account: $, + account: k, chain: e.chain || void 0 }); } @@ -4376,26 +4376,26 @@ async function nN(t, e) { })); } if (a && g.length > 1) { - const $ = "`forceAtomic` is not supported on fallback to `eth_sendTransaction`."; - throw new Uc(new pt($, { - details: $ + const k = "`forceAtomic` is not supported on fallback to `eth_sendTransaction`."; + throw new Uc(new pt(k, { + details: k })); } const S = []; - for (const $ of g) { + for (const k of g) { const N = Kd(t, { account: h, chain: i, - data: $.data, - to: $.to, - value: $.value ? qo($.value) : void 0 + data: k.data, + to: k.to, + value: k.value ? qo(k.value) : void 0 }); S.push(N), o > 0 && await new Promise((z) => setTimeout(z, o)); } const C = await Promise.allSettled(S); - if (C.every(($) => $.status === "rejected")) + if (C.every((k) => k.status === "rejected")) throw C[0].reason; - const D = C.map(($) => $.status === "fulfilled" ? $.value : U4); + const D = C.map((k) => k.status === "fulfilled" ? k.value : U4); return { id: Wo([ ...D, @@ -4510,16 +4510,16 @@ function oN(t) { type: o, uid: z4() }; - function $(N) { + function k(N) { return (z) => { - const k = z(N); + const B = z(N); for (const U in D) - delete k[U]; - const B = { ...N, ...k }; - return Object.assign(B, { extend: $(B) }); + delete B[U]; + const $ = { ...N, ...B }; + return Object.assign($, { extend: k($) }); }; } - return Object.assign(D, { extend: $(D) }); + return Object.assign(D, { extend: k(D) }); } const hh = /* @__PURE__ */ new qd(8192); function aN(t, { enabled: e = !0, id: r }) { @@ -4751,10 +4751,10 @@ function vN(t) { for (const f of o) { const { name: u, type: h } = f, g = a[u], v = h.match(d4); if (v && (typeof g == "number" || typeof g == "bigint")) { - const [C, D, $] = v; + const [C, D, k] = v; br(g, { signed: D === "int", - size: Number.parseInt($) / 8 + size: Number.parseInt(k) / 8 }); } if (h === "address" && typeof g == "string" && !fs(g)) @@ -5115,54 +5115,54 @@ var gh = { exports: {} }, e2; function LN() { if (e2) return gh.exports; e2 = 1; - var t = typeof Reflect == "object" ? Reflect : null, e = t && typeof t.apply == "function" ? t.apply : function(B, U, R) { - return Function.prototype.apply.call(B, U, R); + var t = typeof Reflect == "object" ? Reflect : null, e = t && typeof t.apply == "function" ? t.apply : function($, U, R) { + return Function.prototype.apply.call($, U, R); }, r; - t && typeof t.ownKeys == "function" ? r = t.ownKeys : Object.getOwnPropertySymbols ? r = function(B) { - return Object.getOwnPropertyNames(B).concat(Object.getOwnPropertySymbols(B)); - } : r = function(B) { - return Object.getOwnPropertyNames(B); + t && typeof t.ownKeys == "function" ? r = t.ownKeys : Object.getOwnPropertySymbols ? r = function($) { + return Object.getOwnPropertyNames($).concat(Object.getOwnPropertySymbols($)); + } : r = function($) { + return Object.getOwnPropertyNames($); }; - function n(k) { - console && console.warn && console.warn(k); + function n(B) { + console && console.warn && console.warn(B); } - var i = Number.isNaN || function(B) { - return B !== B; + var i = Number.isNaN || function($) { + return $ !== $; }; function s() { s.init.call(this); } - gh.exports = s, gh.exports.once = $, s.EventEmitter = s, s.prototype._events = void 0, s.prototype._eventsCount = 0, s.prototype._maxListeners = void 0; + gh.exports = s, gh.exports.once = k, s.EventEmitter = s, s.prototype._events = void 0, s.prototype._eventsCount = 0, s.prototype._maxListeners = void 0; var o = 10; - function a(k) { - if (typeof k != "function") - throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof k); + function a(B) { + if (typeof B != "function") + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof B); } Object.defineProperty(s, "defaultMaxListeners", { enumerable: !0, get: function() { return o; }, - set: function(k) { - if (typeof k != "number" || k < 0 || i(k)) - throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + k + "."); - o = k; + set: function(B) { + if (typeof B != "number" || B < 0 || i(B)) + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + B + "."); + o = B; } }), s.init = function() { (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0; - }, s.prototype.setMaxListeners = function(B) { - if (typeof B != "number" || B < 0 || i(B)) - throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + B + "."); - return this._maxListeners = B, this; + }, s.prototype.setMaxListeners = function($) { + if (typeof $ != "number" || $ < 0 || i($)) + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + $ + "."); + return this._maxListeners = $, this; }; - function f(k) { - return k._maxListeners === void 0 ? s.defaultMaxListeners : k._maxListeners; + function f(B) { + return B._maxListeners === void 0 ? s.defaultMaxListeners : B._maxListeners; } s.prototype.getMaxListeners = function() { return f(this); - }, s.prototype.emit = function(B) { + }, s.prototype.emit = function($) { for (var U = [], R = 1; R < arguments.length; R++) U.push(arguments[R]); - var W = B === "error", J = this._events; + var W = $ === "error", J = this._events; if (J !== void 0) W = W && J.error === void 0; else if (!W) @@ -5174,7 +5174,7 @@ function LN() { var K = new Error("Unhandled error." + (ne ? " (" + ne.message + ")" : "")); throw K.context = ne, K; } - var E = J[B]; + var E = J[$]; if (E === void 0) return !1; if (typeof E == "function") @@ -5184,46 +5184,46 @@ function LN() { e(l[R], this, U); return !0; }; - function u(k, B, U, R) { + function u(B, $, U, R) { var W, J, ne; - if (a(U), J = k._events, J === void 0 ? (J = k._events = /* @__PURE__ */ Object.create(null), k._eventsCount = 0) : (J.newListener !== void 0 && (k.emit( + if (a(U), J = B._events, J === void 0 ? (J = B._events = /* @__PURE__ */ Object.create(null), B._eventsCount = 0) : (J.newListener !== void 0 && (B.emit( "newListener", - B, + $, U.listener ? U.listener : U - ), J = k._events), ne = J[B]), ne === void 0) - ne = J[B] = U, ++k._eventsCount; - else if (typeof ne == "function" ? ne = J[B] = R ? [U, ne] : [ne, U] : R ? ne.unshift(U) : ne.push(U), W = f(k), W > 0 && ne.length > W && !ne.warned) { + ), J = B._events), ne = J[$]), ne === void 0) + ne = J[$] = U, ++B._eventsCount; + else if (typeof ne == "function" ? ne = J[$] = R ? [U, ne] : [ne, U] : R ? ne.unshift(U) : ne.push(U), W = f(B), W > 0 && ne.length > W && !ne.warned) { ne.warned = !0; - var K = new Error("Possible EventEmitter memory leak detected. " + ne.length + " " + String(B) + " listeners added. Use emitter.setMaxListeners() to increase limit"); - K.name = "MaxListenersExceededWarning", K.emitter = k, K.type = B, K.count = ne.length, n(K); + var K = new Error("Possible EventEmitter memory leak detected. " + ne.length + " " + String($) + " listeners added. Use emitter.setMaxListeners() to increase limit"); + K.name = "MaxListenersExceededWarning", K.emitter = B, K.type = $, K.count = ne.length, n(K); } - return k; + return B; } - s.prototype.addListener = function(B, U) { - return u(this, B, U, !1); - }, s.prototype.on = s.prototype.addListener, s.prototype.prependListener = function(B, U) { - return u(this, B, U, !0); + s.prototype.addListener = function($, U) { + return u(this, $, U, !1); + }, s.prototype.on = s.prototype.addListener, s.prototype.prependListener = function($, U) { + return u(this, $, U, !0); }; function h() { if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments); } - function g(k, B, U) { - var R = { fired: !1, wrapFn: void 0, target: k, type: B, listener: U }, W = h.bind(R); + function g(B, $, U) { + var R = { fired: !1, wrapFn: void 0, target: B, type: $, listener: U }, W = h.bind(R); return W.listener = U, R.wrapFn = W, W; } - s.prototype.once = function(B, U) { - return a(U), this.on(B, g(this, B, U)), this; - }, s.prototype.prependOnceListener = function(B, U) { - return a(U), this.prependListener(B, g(this, B, U)), this; - }, s.prototype.removeListener = function(B, U) { + s.prototype.once = function($, U) { + return a(U), this.on($, g(this, $, U)), this; + }, s.prototype.prependOnceListener = function($, U) { + return a(U), this.prependListener($, g(this, $, U)), this; + }, s.prototype.removeListener = function($, U) { var R, W, J, ne, K; if (a(U), W = this._events, W === void 0) return this; - if (R = W[B], R === void 0) + if (R = W[$], R === void 0) return this; if (R === U || R.listener === U) - --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete W[B], W.removeListener && this.emit("removeListener", B, R.listener || U)); + --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete W[$], W.removeListener && this.emit("removeListener", $, R.listener || U)); else if (typeof R != "function") { for (J = -1, ne = R.length - 1; ne >= 0; ne--) if (R[ne] === U || R[ne].listener === U) { @@ -5232,46 +5232,46 @@ function LN() { } if (J < 0) return this; - J === 0 ? R.shift() : C(R, J), R.length === 1 && (W[B] = R[0]), W.removeListener !== void 0 && this.emit("removeListener", B, K || U); + J === 0 ? R.shift() : C(R, J), R.length === 1 && (W[$] = R[0]), W.removeListener !== void 0 && this.emit("removeListener", $, K || U); } return this; - }, s.prototype.off = s.prototype.removeListener, s.prototype.removeAllListeners = function(B) { + }, s.prototype.off = s.prototype.removeListener, s.prototype.removeAllListeners = function($) { var U, R, W; if (R = this._events, R === void 0) return this; if (R.removeListener === void 0) - return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : R[B] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete R[B]), this; + return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : R[$] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete R[$]), this; if (arguments.length === 0) { var J = Object.keys(R), ne; for (W = 0; W < J.length; ++W) ne = J[W], ne !== "removeListener" && this.removeAllListeners(ne); return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this; } - if (U = R[B], typeof U == "function") - this.removeListener(B, U); + if (U = R[$], typeof U == "function") + this.removeListener($, U); else if (U !== void 0) for (W = U.length - 1; W >= 0; W--) - this.removeListener(B, U[W]); + this.removeListener($, U[W]); return this; }; - function v(k, B, U) { - var R = k._events; + function v(B, $, U) { + var R = B._events; if (R === void 0) return []; - var W = R[B]; + var W = R[$]; return W === void 0 ? [] : typeof W == "function" ? U ? [W.listener || W] : [W] : U ? D(W) : S(W, W.length); } - s.prototype.listeners = function(B) { - return v(this, B, !0); - }, s.prototype.rawListeners = function(B) { - return v(this, B, !1); - }, s.listenerCount = function(k, B) { - return typeof k.listenerCount == "function" ? k.listenerCount(B) : x.call(k, B); + s.prototype.listeners = function($) { + return v(this, $, !0); + }, s.prototype.rawListeners = function($) { + return v(this, $, !1); + }, s.listenerCount = function(B, $) { + return typeof B.listenerCount == "function" ? B.listenerCount($) : x.call(B, $); }, s.prototype.listenerCount = x; - function x(k) { - var B = this._events; - if (B !== void 0) { - var U = B[k]; + function x(B) { + var $ = this._events; + if ($ !== void 0) { + var U = $[B]; if (typeof U == "function") return 1; if (U !== void 0) @@ -5282,44 +5282,44 @@ function LN() { s.prototype.eventNames = function() { return this._eventsCount > 0 ? r(this._events) : []; }; - function S(k, B) { - for (var U = new Array(B), R = 0; R < B; ++R) - U[R] = k[R]; + function S(B, $) { + for (var U = new Array($), R = 0; R < $; ++R) + U[R] = B[R]; return U; } - function C(k, B) { - for (; B + 1 < k.length; B++) - k[B] = k[B + 1]; - k.pop(); + function C(B, $) { + for (; $ + 1 < B.length; $++) + B[$] = B[$ + 1]; + B.pop(); } - function D(k) { - for (var B = new Array(k.length), U = 0; U < B.length; ++U) - B[U] = k[U].listener || k[U]; - return B; + function D(B) { + for (var $ = new Array(B.length), U = 0; U < $.length; ++U) + $[U] = B[U].listener || B[U]; + return $; } - function $(k, B) { + function k(B, $) { return new Promise(function(U, R) { function W(ne) { - k.removeListener(B, J), R(ne); + B.removeListener($, J), R(ne); } function J() { - typeof k.removeListener == "function" && k.removeListener("error", W), U([].slice.call(arguments)); + typeof B.removeListener == "function" && B.removeListener("error", W), U([].slice.call(arguments)); } - z(k, B, J, { once: !0 }), B !== "error" && N(k, W, { once: !0 }); + z(B, $, J, { once: !0 }), $ !== "error" && N(B, W, { once: !0 }); }); } - function N(k, B, U) { - typeof k.on == "function" && z(k, "error", B, U); + function N(B, $, U) { + typeof B.on == "function" && z(B, "error", $, U); } - function z(k, B, U, R) { - if (typeof k.on == "function") - R.once ? k.once(B, U) : k.on(B, U); - else if (typeof k.addEventListener == "function") - k.addEventListener(B, function W(J) { - R.once && k.removeEventListener(B, W), U(J); + function z(B, $, U, R) { + if (typeof B.on == "function") + R.once ? B.once($, U) : B.on($, U); + else if (typeof B.addEventListener == "function") + B.addEventListener($, function W(J) { + R.once && B.removeEventListener($, W), U(J); }); else - throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof k); + throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof B); } return gh.exports; } @@ -5983,10 +5983,10 @@ function PL(t = {}) { }, v.set(S.base, C)), C; }; for (const S of u) { - const C = typeof S == "string", D = ci(C ? S : S.key), $ = C ? void 0 : S.value, N = C || !S.options ? h : { ...h, ...S.options }, z = r(D); + const C = typeof S == "string", D = ci(C ? S : S.key), k = C ? void 0 : S.value, N = C || !S.options ? h : { ...h, ...S.options }, z = r(D); x(z).items.push({ key: D, - value: $, + value: k, relativeKey: z.relativeKey, options: N }); @@ -6119,8 +6119,8 @@ function PL(t = {}) { h ); for (const D of C) { - const $ = S.mountpoint + ci(D); - v.some((N) => $.startsWith(N)) || x.push($); + const k = S.mountpoint + ci(D); + v.some((N) => k.startsWith(N)) || x.push(k); } v = [ S.mountpoint, @@ -6491,7 +6491,7 @@ function KL() { v2 = 1; const t = WL(); Zp = i; - const e = B().console || {}, r = { + const e = $().console || {}, r = { mapHttpRequest: S, mapHttpResponse: S, wrapRequestSerializer: C, @@ -6579,7 +6579,7 @@ function KL() { 50: "error", 60: "fatal" } - }, i.stdSerializers = r, i.stdTimeFunctions = Object.assign({}, { nullTime: $, epochTime: N, unixTime: z, isoTime: k }); + }, i.stdSerializers = r, i.stdTimeFunctions = Object.assign({}, { nullTime: k, epochTime: N, unixTime: z, isoTime: B }); function s(U, R, W, J) { const ne = Object.getPrototypeOf(R); R[W] = R.levelVal > R.levels.values[W] ? D : ne[W] ? ne[W] : e[W] || e[J] || D, o(U, R, W); @@ -6665,7 +6665,7 @@ function KL() { return R; } function x(U) { - return typeof U.timestamp == "function" ? U.timestamp : U.timestamp === !1 ? $ : N; + return typeof U.timestamp == "function" ? U.timestamp : U.timestamp === !1 ? k : N; } function S() { return {}; @@ -6675,7 +6675,7 @@ function KL() { } function D() { } - function $() { + function k() { return !1; } function N() { @@ -6684,10 +6684,10 @@ function KL() { function z() { return Math.round(Date.now() / 1e3); } - function k() { + function B() { return new Date(Date.now()).toISOString(); } - function B() { + function $() { function U(R) { return typeof R < "u" && R; } @@ -7114,10 +7114,10 @@ function el() { return P * 4294967296 + w; } dr.readUint64LE = D; - function $(p, m, w) { + function k(p, m, w) { return m === void 0 && (m = new Uint8Array(8)), w === void 0 && (w = 0), g(p / 4294967296 >>> 0, m, w), g(p >>> 0, m, w + 4), m; } - dr.writeUint64BE = $, dr.writeInt64BE = $; + dr.writeUint64BE = k, dr.writeInt64BE = k; function N(p, m, w) { return m === void 0 && (m = new Uint8Array(8)), w === void 0 && (w = 0), v(p >>> 0, m, w), v(p / 4294967296 >>> 0, m, w + 4), m; } @@ -7132,7 +7132,7 @@ function el() { return P; } dr.readUintBE = z; - function k(p, m, w) { + function B(p, m, w) { if (w === void 0 && (w = 0), p % 8 !== 0) throw new Error("readUintLE supports only bitLengths divisible by 8"); if (p / 8 > m.length - w) @@ -7141,8 +7141,8 @@ function el() { P += m[y] * _, _ *= 256; return P; } - dr.readUintLE = k; - function B(p, m, w, P) { + dr.readUintLE = B; + function $(p, m, w, P) { if (w === void 0 && (w = new Uint8Array(p / 8)), P === void 0 && (P = 0), p % 8 !== 0) throw new Error("writeUintBE supports only bitLengths divisible by 8"); if (!t.isSafeInteger(m)) @@ -7151,7 +7151,7 @@ function el() { w[y] = m / _ & 255, _ *= 256; return w; } - dr.writeUintBE = B; + dr.writeUintBE = $; function U(p, m, w, P) { if (w === void 0 && (w = new Uint8Array(p / 8)), P === void 0 && (P = 0), p % 8 !== 0) throw new Error("writeUintLE supports only bitLengths divisible by 8"); @@ -7237,8 +7237,8 @@ function d1() { for (; u > 0; ) { const C = i(Math.ceil(u * 256 / S), g); for (let D = 0; D < C.length && u > 0; D++) { - const $ = C[D]; - $ < S && (v += h.charAt($ % x), u--); + const k = C[D]; + k < S && (v += h.charAt(k % x), u--); } (0, n.wipe)(C); } @@ -7477,18 +7477,18 @@ function Mk() { 1246189591 ]); function s(a, f, u, h, g, v, x) { - for (var S = u[0], C = u[1], D = u[2], $ = u[3], N = u[4], z = u[5], k = u[6], B = u[7], U = h[0], R = h[1], W = h[2], J = h[3], ne = h[4], K = h[5], E = h[6], b = h[7], l, p, m, w, P, _, y, M; x >= 128; ) { + for (var S = u[0], C = u[1], D = u[2], k = u[3], N = u[4], z = u[5], B = u[6], $ = u[7], U = h[0], R = h[1], W = h[2], J = h[3], ne = h[4], K = h[5], E = h[6], b = h[7], l, p, m, w, P, _, y, M; x >= 128; ) { for (var I = 0; I < 16; I++) { var q = 8 * I + v; a[I] = e.readUint32BE(g, q), f[I] = e.readUint32BE(g, q + 4); } for (var I = 0; I < 80; I++) { - var ce = S, L = C, oe = D, Q = $, X = N, ee = z, O = k, Z = B, re = U, he = R, ae = W, fe = J, be = ne, Ae = K, Te = E, Re = b; - if (l = B, p = b, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = (N >>> 14 | ne << 18) ^ (N >>> 18 | ne << 14) ^ (ne >>> 9 | N << 23), p = (ne >>> 14 | N << 18) ^ (ne >>> 18 | N << 14) ^ (N >>> 9 | ne << 23), P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = N & z ^ ~N & k, p = ne & K ^ ~ne & E, P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = i[I * 2], p = i[I * 2 + 1], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = a[I % 16], p = f[I % 16], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, m = y & 65535 | M << 16, w = P & 65535 | _ << 16, l = m, p = w, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = (S >>> 28 | U << 4) ^ (U >>> 2 | S << 30) ^ (U >>> 7 | S << 25), p = (U >>> 28 | S << 4) ^ (S >>> 2 | U << 30) ^ (S >>> 7 | U << 25), P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = S & C ^ S & D ^ C & D, p = U & R ^ U & W ^ R & W, P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, Z = y & 65535 | M << 16, Re = P & 65535 | _ << 16, l = Q, p = fe, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = m, p = w, P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, Q = y & 65535 | M << 16, fe = P & 65535 | _ << 16, C = ce, D = L, $ = oe, N = Q, z = X, k = ee, B = O, S = Z, R = re, W = he, J = ae, ne = fe, K = be, E = Ae, b = Te, U = Re, I % 16 === 15) + var ce = S, L = C, oe = D, Q = k, X = N, ee = z, O = B, Z = $, re = U, he = R, ae = W, fe = J, be = ne, Ae = K, Te = E, Re = b; + if (l = $, p = b, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = (N >>> 14 | ne << 18) ^ (N >>> 18 | ne << 14) ^ (ne >>> 9 | N << 23), p = (ne >>> 14 | N << 18) ^ (ne >>> 18 | N << 14) ^ (N >>> 9 | ne << 23), P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = N & z ^ ~N & B, p = ne & K ^ ~ne & E, P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = i[I * 2], p = i[I * 2 + 1], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = a[I % 16], p = f[I % 16], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, m = y & 65535 | M << 16, w = P & 65535 | _ << 16, l = m, p = w, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = (S >>> 28 | U << 4) ^ (U >>> 2 | S << 30) ^ (U >>> 7 | S << 25), p = (U >>> 28 | S << 4) ^ (S >>> 2 | U << 30) ^ (S >>> 7 | U << 25), P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = S & C ^ S & D ^ C & D, p = U & R ^ U & W ^ R & W, P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, Z = y & 65535 | M << 16, Re = P & 65535 | _ << 16, l = Q, p = fe, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = m, p = w, P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, Q = y & 65535 | M << 16, fe = P & 65535 | _ << 16, C = ce, D = L, k = oe, N = Q, z = X, B = ee, $ = O, S = Z, R = re, W = he, J = ae, ne = fe, K = be, E = Ae, b = Te, U = Re, I % 16 === 15) for (var q = 0; q < 16; q++) l = a[q], p = f[q], P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = a[(q + 9) % 16], p = f[(q + 9) % 16], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, m = a[(q + 1) % 16], w = f[(q + 1) % 16], l = (m >>> 1 | w << 31) ^ (m >>> 8 | w << 24) ^ m >>> 7, p = (w >>> 1 | m << 31) ^ (w >>> 8 | m << 24) ^ (w >>> 7 | m << 25), P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, m = a[(q + 14) % 16], w = f[(q + 14) % 16], l = (m >>> 19 | w << 13) ^ (w >>> 29 | m << 3) ^ m >>> 6, p = (w >>> 19 | m << 13) ^ (m >>> 29 | w << 3) ^ (w >>> 6 | m << 26), P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, a[q] = y & 65535 | M << 16, f[q] = P & 65535 | _ << 16; } - l = S, p = U, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[0], p = h[0], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[0] = S = y & 65535 | M << 16, h[0] = U = P & 65535 | _ << 16, l = C, p = R, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[1], p = h[1], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[1] = C = y & 65535 | M << 16, h[1] = R = P & 65535 | _ << 16, l = D, p = W, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[2], p = h[2], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[2] = D = y & 65535 | M << 16, h[2] = W = P & 65535 | _ << 16, l = $, p = J, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[3], p = h[3], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[3] = $ = y & 65535 | M << 16, h[3] = J = P & 65535 | _ << 16, l = N, p = ne, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[4], p = h[4], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[4] = N = y & 65535 | M << 16, h[4] = ne = P & 65535 | _ << 16, l = z, p = K, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[5], p = h[5], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[5] = z = y & 65535 | M << 16, h[5] = K = P & 65535 | _ << 16, l = k, p = E, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[6], p = h[6], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[6] = k = y & 65535 | M << 16, h[6] = E = P & 65535 | _ << 16, l = B, p = b, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[7], p = h[7], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[7] = B = y & 65535 | M << 16, h[7] = b = P & 65535 | _ << 16, v += 128, x -= 128; + l = S, p = U, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[0], p = h[0], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[0] = S = y & 65535 | M << 16, h[0] = U = P & 65535 | _ << 16, l = C, p = R, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[1], p = h[1], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[1] = C = y & 65535 | M << 16, h[1] = R = P & 65535 | _ << 16, l = D, p = W, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[2], p = h[2], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[2] = D = y & 65535 | M << 16, h[2] = W = P & 65535 | _ << 16, l = k, p = J, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[3], p = h[3], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[3] = k = y & 65535 | M << 16, h[3] = J = P & 65535 | _ << 16, l = N, p = ne, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[4], p = h[4], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[4] = N = y & 65535 | M << 16, h[4] = ne = P & 65535 | _ << 16, l = z, p = K, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[5], p = h[5], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[5] = z = y & 65535 | M << 16, h[5] = K = P & 65535 | _ << 16, l = B, p = E, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[6], p = h[6], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[6] = B = y & 65535 | M << 16, h[6] = E = P & 65535 | _ << 16, l = $, p = b, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[7], p = h[7], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[7] = $ = y & 65535 | M << 16, h[7] = b = P & 65535 | _ << 16, v += 128, x -= 128; } return v; } @@ -7637,7 +7637,7 @@ function Ik() { for (let Z = 0; Z < 16; Z++) Q[2 * Z] = O[Z] & 255, Q[2 * Z + 1] = O[Z] >> 8; } - function $(Q, X) { + function k(Q, X) { let ee = 0; for (let O = 0; O < 32; O++) ee |= Q[O] ^ X[O]; @@ -7645,18 +7645,18 @@ function Ik() { } function N(Q, X) { const ee = new Uint8Array(32), O = new Uint8Array(32); - return D(ee, Q), D(O, X), $(ee, O); + return D(ee, Q), D(O, X), k(ee, O); } function z(Q) { const X = new Uint8Array(32); return D(X, Q), X[0] & 1; } - function k(Q, X) { + function B(Q, X) { for (let ee = 0; ee < 16; ee++) Q[ee] = X[2 * ee] + (X[2 * ee + 1] << 8); Q[15] &= 32767; } - function B(Q, X, ee) { + function $(Q, X, ee) { for (let O = 0; O < 16; O++) Q[O] = X[O] + ee[O]; } @@ -7693,7 +7693,7 @@ function Ik() { } function K(Q, X) { const ee = i(), O = i(), Z = i(), re = i(), he = i(), ae = i(), fe = i(), be = i(), Ae = i(); - U(ee, Q[1], Q[0]), U(Ae, X[1], X[0]), R(ee, ee, Ae), B(O, Q[0], Q[1]), B(Ae, X[0], X[1]), R(O, O, Ae), R(Z, Q[3], X[3]), R(Z, Z, u), R(re, Q[2], X[2]), B(re, re, re), U(he, O, ee), U(ae, re, Z), B(fe, re, Z), B(be, O, ee), R(Q[0], he, ae), R(Q[1], be, fe), R(Q[2], fe, ae), R(Q[3], he, be); + U(ee, Q[1], Q[0]), U(Ae, X[1], X[0]), R(ee, ee, Ae), $(O, Q[0], Q[1]), $(Ae, X[0], X[1]), R(O, O, Ae), R(Z, Q[3], X[3]), R(Z, Z, u), R(re, Q[2], X[2]), $(re, re, re), U(he, O, ee), U(ae, re, Z), $(fe, re, Z), $(be, O, ee), R(Q[0], he, ae), R(Q[1], be, fe), R(Q[2], fe, ae), R(Q[3], he, be); } function E(Q, X, ee) { for (let O = 0; O < 4; O++) @@ -7816,7 +7816,7 @@ function Ik() { t.sign = I; function q(Q, X) { const ee = i(), O = i(), Z = i(), re = i(), he = i(), ae = i(), fe = i(); - return x(Q[2], a), k(Q[1], X), W(Z, Q[1]), R(re, Z, f), U(Z, Z, Q[2]), B(re, Q[2], re), W(he, re), W(ae, he), R(fe, ae, he), R(ee, fe, Z), R(ee, ee, re), ne(ee, ee), R(ee, ee, Z), R(ee, ee, re), R(ee, ee, re), R(Q[0], ee, re), W(O, Q[0]), R(O, O, re), N(O, Z) && R(Q[0], Q[0], v), W(O, Q[0]), R(O, O, re), N(O, Z) ? -1 : (z(Q[0]) === X[31] >> 7 && U(Q[0], o, Q[0]), R(Q[3], Q[0], Q[1]), 0); + return x(Q[2], a), B(Q[1], X), W(Z, Q[1]), R(re, Z, f), U(Z, Z, Q[2]), $(re, Q[2], re), W(he, re), W(ae, he), R(fe, ae, he), R(ee, fe, Z), R(ee, ee, re), ne(ee, ee), R(ee, ee, Z), R(ee, ee, re), R(ee, ee, re), R(Q[0], ee, re), W(O, Q[0]), R(O, O, re), N(O, Z) && R(Q[0], Q[0], v), W(O, Q[0]), R(O, O, re), N(O, Z) ? -1 : (z(Q[0]) === X[31] >> 7 && U(Q[0], o, Q[0]), R(Q[3], Q[0], Q[1]), 0); } function ce(Q, X, ee) { const O = new Uint8Array(32), Z = [i(), i(), i(), i()], re = [i(), i(), i(), i()]; @@ -7827,7 +7827,7 @@ function Ik() { const he = new r.SHA512(); he.update(ee.subarray(0, 32)), he.update(Q), he.update(X); const ae = he.digest(); - return M(ae), l(Z, re, ae), p(re, ee.subarray(32)), K(Z, re), b(O, Z), !$(ee, O); + return M(ae), l(Z, re, ae), p(re, ee.subarray(32)), K(Z, re), b(O, Z), !k(ee, O); } t.verify = ce; function L(Q) { @@ -7835,7 +7835,7 @@ function Ik() { if (q(X, Q)) throw new Error("Ed25519: invalid public key"); let ee = i(), O = i(), Z = X[1]; - B(ee, a, Z), U(O, a, Z), J(O, O), R(ee, ee, O); + $(ee, a, Z), U(O, a, Z), J(O, O), R(ee, ee, O); let re = new Uint8Array(32); return D(re, ee), re; } @@ -7879,19 +7879,19 @@ function $k(t, e) { throw new TypeError("Expected Uint8Array"); if (S.length === 0) return ""; - for (var C = 0, D = 0, $ = 0, N = S.length; $ !== N && S[$] === 0; ) - $++, C++; - for (var z = (N - $) * h + 1 >>> 0, k = new Uint8Array(z); $ !== N; ) { - for (var B = S[$], U = 0, R = z - 1; (B !== 0 || U < D) && R !== -1; R--, U++) - B += 256 * k[R] >>> 0, k[R] = B % a >>> 0, B = B / a >>> 0; - if (B !== 0) + for (var C = 0, D = 0, k = 0, N = S.length; k !== N && S[k] === 0; ) + k++, C++; + for (var z = (N - k) * h + 1 >>> 0, B = new Uint8Array(z); k !== N; ) { + for (var $ = S[k], U = 0, R = z - 1; ($ !== 0 || U < D) && R !== -1; R--, U++) + $ += 256 * B[R] >>> 0, B[R] = $ % a >>> 0, $ = $ / a >>> 0; + if ($ !== 0) throw new Error("Non-zero carry"); - D = U, $++; + D = U, k++; } - for (var W = z - D; W !== z && k[W] === 0; ) + for (var W = z - D; W !== z && B[W] === 0; ) W++; for (var J = f.repeat(C); W < z; ++W) - J += t.charAt(k[W]); + J += t.charAt(B[W]); return J; } function v(S) { @@ -7901,20 +7901,20 @@ function $k(t, e) { return new Uint8Array(); var C = 0; if (S[C] !== " ") { - for (var D = 0, $ = 0; S[C] === f; ) + for (var D = 0, k = 0; S[C] === f; ) D++, C++; for (var N = (S.length - C) * u + 1 >>> 0, z = new Uint8Array(N); S[C]; ) { - var k = r[S.charCodeAt(C)]; - if (k === 255) + var B = r[S.charCodeAt(C)]; + if (B === 255) return; - for (var B = 0, U = N - 1; (k !== 0 || B < $) && U !== -1; U--, B++) - k += a * z[U] >>> 0, z[U] = k % 256 >>> 0, k = k / 256 >>> 0; - if (k !== 0) + for (var $ = 0, U = N - 1; (B !== 0 || $ < k) && U !== -1; U--, $++) + B += a * z[U] >>> 0, z[U] = B % 256 >>> 0, B = B / 256 >>> 0; + if (B !== 0) throw new Error("Non-zero carry"); - $ = B, C++; + k = $, C++; } if (S[C] !== " ") { - for (var R = N - $; R !== N && z[R] === 0; ) + for (var R = N - k; R !== N && z[R] === 0; ) R++; for (var W = new Uint8Array(D + (N - R)), J = D; R !== N; ) W[J++] = z[R++]; @@ -8539,8 +8539,8 @@ function Z$() { function i() { const x = r.getElementsByTagName("link"), S = []; for (let C = 0; C < x.length; C++) { - const D = x[C], $ = D.getAttribute("rel"); - if ($ && $.toLowerCase().indexOf("icon") > -1) { + const D = x[C], k = D.getAttribute("rel"); + if (k && k.toLowerCase().indexOf("icon") > -1) { const N = D.getAttribute("href"); if (N) if (N.toLowerCase().indexOf("https:") === -1 && N.toLowerCase().indexOf("http:") === -1 && N.indexOf("//") !== 0) { @@ -8548,10 +8548,10 @@ function Z$() { if (N.indexOf("/") === 0) z += N; else { - const k = n.pathname.split("/"); - k.pop(); - const B = k.join("/"); - z += B + "/" + N; + const B = n.pathname.split("/"); + B.pop(); + const $ = B.join("/"); + z += $ + "/" + N; } S.push(z); } else if (N.indexOf("//") === 0) { @@ -8566,8 +8566,8 @@ function Z$() { function s(...x) { const S = r.getElementsByTagName("meta"); for (let C = 0; C < S.length; C++) { - const D = S[C], $ = ["itemprop", "property", "name"].map((N) => D.getAttribute(N)).filter((N) => N ? x.includes(N) : !1); - if ($.length && $) { + const D = S[C], k = ["itemprop", "property", "name"].map((N) => D.getAttribute(N)).filter((N) => N ? x.includes(N) : !1); + if (k.length && k) { const N = D.getAttribute("content"); if (N) return N; @@ -8682,91 +8682,91 @@ function iB() { function a(N) { switch (N.arrayFormat) { case "index": - return (z) => (k, B) => { - const U = k.length; - return B === void 0 || N.skipNull && B === null || N.skipEmptyString && B === "" ? k : B === null ? [...k, [h(z, N), "[", U, "]"].join("")] : [ - ...k, - [h(z, N), "[", h(U, N), "]=", h(B, N)].join("") + return (z) => (B, $) => { + const U = B.length; + return $ === void 0 || N.skipNull && $ === null || N.skipEmptyString && $ === "" ? B : $ === null ? [...B, [h(z, N), "[", U, "]"].join("")] : [ + ...B, + [h(z, N), "[", h(U, N), "]=", h($, N)].join("") ]; }; case "bracket": - return (z) => (k, B) => B === void 0 || N.skipNull && B === null || N.skipEmptyString && B === "" ? k : B === null ? [...k, [h(z, N), "[]"].join("")] : [...k, [h(z, N), "[]=", h(B, N)].join("")]; + return (z) => (B, $) => $ === void 0 || N.skipNull && $ === null || N.skipEmptyString && $ === "" ? B : $ === null ? [...B, [h(z, N), "[]"].join("")] : [...B, [h(z, N), "[]=", h($, N)].join("")]; case "colon-list-separator": - return (z) => (k, B) => B === void 0 || N.skipNull && B === null || N.skipEmptyString && B === "" ? k : B === null ? [...k, [h(z, N), ":list="].join("")] : [...k, [h(z, N), ":list=", h(B, N)].join("")]; + return (z) => (B, $) => $ === void 0 || N.skipNull && $ === null || N.skipEmptyString && $ === "" ? B : $ === null ? [...B, [h(z, N), ":list="].join("")] : [...B, [h(z, N), ":list=", h($, N)].join("")]; case "comma": case "separator": case "bracket-separator": { const z = N.arrayFormat === "bracket-separator" ? "[]=" : "="; - return (k) => (B, U) => U === void 0 || N.skipNull && U === null || N.skipEmptyString && U === "" ? B : (U = U === null ? "" : U, B.length === 0 ? [[h(k, N), z, h(U, N)].join("")] : [[B, h(U, N)].join(N.arrayFormatSeparator)]); + return (B) => ($, U) => U === void 0 || N.skipNull && U === null || N.skipEmptyString && U === "" ? $ : (U = U === null ? "" : U, $.length === 0 ? [[h(B, N), z, h(U, N)].join("")] : [[$, h(U, N)].join(N.arrayFormatSeparator)]); } default: - return (z) => (k, B) => B === void 0 || N.skipNull && B === null || N.skipEmptyString && B === "" ? k : B === null ? [...k, h(z, N)] : [...k, [h(z, N), "=", h(B, N)].join("")]; + return (z) => (B, $) => $ === void 0 || N.skipNull && $ === null || N.skipEmptyString && $ === "" ? B : $ === null ? [...B, h(z, N)] : [...B, [h(z, N), "=", h($, N)].join("")]; } } function f(N) { let z; switch (N.arrayFormat) { case "index": - return (k, B, U) => { - if (z = /\[(\d*)\]$/.exec(k), k = k.replace(/\[\d*\]$/, ""), !z) { - U[k] = B; + return (B, $, U) => { + if (z = /\[(\d*)\]$/.exec(B), B = B.replace(/\[\d*\]$/, ""), !z) { + U[B] = $; return; } - U[k] === void 0 && (U[k] = {}), U[k][z[1]] = B; + U[B] === void 0 && (U[B] = {}), U[B][z[1]] = $; }; case "bracket": - return (k, B, U) => { - if (z = /(\[\])$/.exec(k), k = k.replace(/\[\]$/, ""), !z) { - U[k] = B; + return (B, $, U) => { + if (z = /(\[\])$/.exec(B), B = B.replace(/\[\]$/, ""), !z) { + U[B] = $; return; } - if (U[k] === void 0) { - U[k] = [B]; + if (U[B] === void 0) { + U[B] = [$]; return; } - U[k] = [].concat(U[k], B); + U[B] = [].concat(U[B], $); }; case "colon-list-separator": - return (k, B, U) => { - if (z = /(:list)$/.exec(k), k = k.replace(/:list$/, ""), !z) { - U[k] = B; + return (B, $, U) => { + if (z = /(:list)$/.exec(B), B = B.replace(/:list$/, ""), !z) { + U[B] = $; return; } - if (U[k] === void 0) { - U[k] = [B]; + if (U[B] === void 0) { + U[B] = [$]; return; } - U[k] = [].concat(U[k], B); + U[B] = [].concat(U[B], $); }; case "comma": case "separator": - return (k, B, U) => { - const R = typeof B == "string" && B.includes(N.arrayFormatSeparator), W = typeof B == "string" && !R && g(B, N).includes(N.arrayFormatSeparator); - B = W ? g(B, N) : B; - const J = R || W ? B.split(N.arrayFormatSeparator).map((ne) => g(ne, N)) : B === null ? B : g(B, N); - U[k] = J; + return (B, $, U) => { + const R = typeof $ == "string" && $.includes(N.arrayFormatSeparator), W = typeof $ == "string" && !R && g($, N).includes(N.arrayFormatSeparator); + $ = W ? g($, N) : $; + const J = R || W ? $.split(N.arrayFormatSeparator).map((ne) => g(ne, N)) : $ === null ? $ : g($, N); + U[B] = J; }; case "bracket-separator": - return (k, B, U) => { - const R = /(\[\])$/.test(k); - if (k = k.replace(/\[\]$/, ""), !R) { - U[k] = B && g(B, N); + return (B, $, U) => { + const R = /(\[\])$/.test(B); + if (B = B.replace(/\[\]$/, ""), !R) { + U[B] = $ && g($, N); return; } - const W = B === null ? [] : B.split(N.arrayFormatSeparator).map((J) => g(J, N)); - if (U[k] === void 0) { - U[k] = W; + const W = $ === null ? [] : $.split(N.arrayFormatSeparator).map((J) => g(J, N)); + if (U[B] === void 0) { + U[B] = W; return; } - U[k] = [].concat(U[k], W); + U[B] = [].concat(U[B], W); }; default: - return (k, B, U) => { - if (U[k] === void 0) { - U[k] = B; + return (B, $, U) => { + if (U[B] === void 0) { + U[B] = $; return; } - U[k] = [].concat(U[k], B); + U[B] = [].concat(U[B], $); }; } } @@ -8781,7 +8781,7 @@ function iB() { return z.decode ? r(N) : N; } function v(N) { - return Array.isArray(N) ? N.sort() : typeof N == "object" ? v(Object.keys(N)).sort((z, k) => Number(z) - Number(k)).map((z) => N[z]) : N; + return Array.isArray(N) ? N.sort() : typeof N == "object" ? v(Object.keys(N)).sort((z, B) => Number(z) - Number(B)).map((z) => N[z]) : N; } function x(N) { const z = N.indexOf("#"); @@ -8789,8 +8789,8 @@ function iB() { } function S(N) { let z = ""; - const k = N.indexOf("#"); - return k !== -1 && (z = N.slice(k)), z; + const B = N.indexOf("#"); + return B !== -1 && (z = N.slice(B)), z; } function C(N) { N = x(N); @@ -8800,7 +8800,7 @@ function iB() { function D(N, z) { return z.parseNumbers && !Number.isNaN(Number(N)) && typeof N == "string" && N.trim() !== "" ? N = Number(N) : z.parseBooleans && N !== null && (N.toLowerCase() === "true" || N.toLowerCase() === "false") && (N = N.toLowerCase() === "true"), N; } - function $(N, z) { + function k(N, z) { z = Object.assign({ decode: !0, sort: !0, @@ -8809,29 +8809,29 @@ function iB() { parseNumbers: !1, parseBooleans: !1 }, z), u(z.arrayFormatSeparator); - const k = f(z), B = /* @__PURE__ */ Object.create(null); + const B = f(z), $ = /* @__PURE__ */ Object.create(null); if (typeof N != "string" || (N = N.trim().replace(/^[?#&]/, ""), !N)) - return B; + return $; for (const U of N.split("&")) { if (U === "") continue; let [R, W] = n(z.decode ? U.replace(/\+/g, " ") : U, "="); - W = W === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(z.arrayFormat) ? W : g(W, z), k(g(R, z), W, B); + W = W === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(z.arrayFormat) ? W : g(W, z), B(g(R, z), W, $); } - for (const U of Object.keys(B)) { - const R = B[U]; + for (const U of Object.keys($)) { + const R = $[U]; if (typeof R == "object" && R !== null) for (const W of Object.keys(R)) R[W] = D(R[W], z); else - B[U] = D(R, z); + $[U] = D(R, z); } - return z.sort === !1 ? B : (z.sort === !0 ? Object.keys(B).sort() : Object.keys(B).sort(z.sort)).reduce((U, R) => { - const W = B[R]; + return z.sort === !1 ? $ : (z.sort === !0 ? Object.keys($).sort() : Object.keys($).sort(z.sort)).reduce((U, R) => { + const W = $[R]; return W && typeof W == "object" && !Array.isArray(W) ? U[R] = v(W) : U[R] = W, U; }, /* @__PURE__ */ Object.create(null)); } - t.extract = C, t.parse = $, t.stringify = (N, z) => { + t.extract = C, t.parse = k, t.stringify = (N, z) => { if (!N) return ""; z = Object.assign({ @@ -8840,25 +8840,25 @@ function iB() { arrayFormat: "none", arrayFormatSeparator: "," }, z), u(z.arrayFormatSeparator); - const k = (W) => z.skipNull && s(N[W]) || z.skipEmptyString && N[W] === "", B = a(z), U = {}; + const B = (W) => z.skipNull && s(N[W]) || z.skipEmptyString && N[W] === "", $ = a(z), U = {}; for (const W of Object.keys(N)) - k(W) || (U[W] = N[W]); + B(W) || (U[W] = N[W]); const R = Object.keys(U); return z.sort !== !1 && R.sort(z.sort), R.map((W) => { const J = N[W]; - return J === void 0 ? "" : J === null ? h(W, z) : Array.isArray(J) ? J.length === 0 && z.arrayFormat === "bracket-separator" ? h(W, z) + "[]" : J.reduce(B(W), []).join("&") : h(W, z) + "=" + h(J, z); + return J === void 0 ? "" : J === null ? h(W, z) : Array.isArray(J) ? J.length === 0 && z.arrayFormat === "bracket-separator" ? h(W, z) + "[]" : J.reduce($(W), []).join("&") : h(W, z) + "=" + h(J, z); }).filter((W) => W.length > 0).join("&"); }, t.parseUrl = (N, z) => { z = Object.assign({ decode: !0 }, z); - const [k, B] = n(N, "#"); + const [B, $] = n(N, "#"); return Object.assign( { - url: k.split("?")[0] || "", - query: $(C(N), z) + url: B.split("?")[0] || "", + query: k(C(N), z) }, - z && z.parseFragmentIdentifier && B ? { fragmentIdentifier: g(B, z) } : {} + z && z.parseFragmentIdentifier && $ ? { fragmentIdentifier: g($, z) } : {} ); }, t.stringifyUrl = (N, z) => { z = Object.assign({ @@ -8866,25 +8866,25 @@ function iB() { strict: !0, [o]: !0 }, z); - const k = x(N.url).split("?")[0] || "", B = t.extract(N.url), U = t.parse(B, { sort: !1 }), R = Object.assign(U, N.query); + const B = x(N.url).split("?")[0] || "", $ = t.extract(N.url), U = t.parse($, { sort: !1 }), R = Object.assign(U, N.query); let W = t.stringify(R, z); W && (W = `?${W}`); let J = S(N.url); - return N.fragmentIdentifier && (J = `#${z[o] ? h(N.fragmentIdentifier, z) : N.fragmentIdentifier}`), `${k}${W}${J}`; - }, t.pick = (N, z, k) => { - k = Object.assign({ + return N.fragmentIdentifier && (J = `#${z[o] ? h(N.fragmentIdentifier, z) : N.fragmentIdentifier}`), `${B}${W}${J}`; + }, t.pick = (N, z, B) => { + B = Object.assign({ parseFragmentIdentifier: !0, [o]: !1 - }, k); - const { url: B, query: U, fragmentIdentifier: R } = t.parseUrl(N, k); + }, B); + const { url: $, query: U, fragmentIdentifier: R } = t.parseUrl(N, B); return t.stringifyUrl({ - url: B, + url: $, query: i(U, z), fragmentIdentifier: R - }, k); - }, t.exclude = (N, z, k) => { - const B = Array.isArray(z) ? (U) => !z.includes(U) : (U, R) => !z(U, R); - return t.pick(N, B, k); + }, B); + }, t.exclude = (N, z, B) => { + const $ = Array.isArray(z) ? (U) => !z.includes(U) : (U, R) => !z(U, R); + return t.pick(N, $, B); }; })(ig)), ig; } @@ -8954,7 +8954,7 @@ function sB() { 0, 2147516424, 2147483648 - ], D = [224, 256, 384, 512], $ = [128, 256], N = ["hex", "buffer", "arrayBuffer", "array", "digest"], z = { + ], D = [224, 256, 384, 512], k = [128, 256], N = ["hex", "buffer", "arrayBuffer", "array", "digest"], z = { 128: 168, 256: 136 }; @@ -8963,11 +8963,11 @@ function sB() { }), f && (i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView) && (ArrayBuffer.isView = function(L) { return typeof L == "object" && L.buffer && L.buffer.constructor === ArrayBuffer; }); - for (var k = function(L, oe, Q) { + for (var B = function(L, oe, Q) { return function(X) { return new I(L, oe, L).update(X)[Q](); }; - }, B = function(L, oe, Q) { + }, $ = function(L, oe, Q) { return function(X, ee) { return new I(L, oe, ee).update(X)[Q](); }; @@ -8986,19 +8986,19 @@ function sB() { } return L; }, J = function(L, oe) { - var Q = k(L, oe, "hex"); + var Q = B(L, oe, "hex"); return Q.create = function() { return new I(L, oe, L); }, Q.update = function(X) { return Q.create().update(X); - }, W(Q, k, L, oe); + }, W(Q, B, L, oe); }, ne = function(L, oe) { - var Q = B(L, oe, "hex"); + var Q = $(L, oe, "hex"); return Q.create = function(X) { return new I(L, oe, X); }, Q.update = function(X, ee) { return Q.create(ee).update(X); - }, W(Q, B, L, oe); + }, W(Q, $, L, oe); }, K = function(L, oe) { var Q = z[L], X = U(L, oe, "hex"); return X.create = function(ee, O, Z) { @@ -9016,9 +9016,9 @@ function sB() { }, b = [ { name: "keccak", padding: v, bits: D, createMethod: J }, { name: "sha3", padding: x, bits: D, createMethod: J }, - { name: "shake", padding: h, bits: $, createMethod: ne }, - { name: "cshake", padding: g, bits: $, createMethod: K }, - { name: "kmac", padding: g, bits: $, createMethod: E } + { name: "shake", padding: h, bits: k, createMethod: ne }, + { name: "cshake", padding: g, bits: k, createMethod: K }, + { name: "kmac", padding: g, bits: k, createMethod: E } ], l = {}, p = [], m = 0; m < b.length; ++m) for (var w = b[m], P = w.bits, _ = 0; _ < P.length; ++_) { var y = w.name + "_" + P[_]; @@ -9932,7 +9932,7 @@ function mB() { }, s.prototype.sub = function(l) { return this.clone().isub(l); }; - function $(b, l, p) { + function k(b, l, p) { p.negative = l.negative ^ b.negative; var m = b.length + l.length | 0; p.length = m, m = m - 1 | 0; @@ -9989,7 +9989,7 @@ function mB() { var Fe = (y + M | 0) + ((I & 8191) << 13) | 0; return y = (q + (I >>> 13) | 0) + (Fe >>> 26) | 0, Fe &= 67108863, _[0] = Qe, _[1] = Xe, _[2] = tt, _[3] = st, _[4] = vt, _[5] = Ct, _[6] = Mt, _[7] = wt, _[8] = Rt, _[9] = gt, _[10] = _t, _[11] = at, _[12] = yt, _[13] = ut, _[14] = it, _[15] = Se, _[16] = Pe, _[17] = Ke, _[18] = Fe, y !== 0 && (_[19] = y, m.length++), m; }; - Math.imul || (N = $); + Math.imul || (N = k); function z(b, l, p) { p.negative = l.negative ^ b.negative, p.length = b.length + l.length; for (var m = 0, w = 0, P = 0; P < p.length - 1; P++) { @@ -10003,18 +10003,18 @@ function mB() { } return m !== 0 ? p.words[P] = m : p.length--, p._strip(); } - function k(b, l, p) { + function B(b, l, p) { return z(b, l, p); } s.prototype.mulTo = function(l, p) { var m, w = this.length + l.length; - return this.length === 10 && l.length === 10 ? m = N(this, l, p) : w < 63 ? m = $(this, l, p) : w < 1024 ? m = z(this, l, p) : m = k(this, l, p), m; + return this.length === 10 && l.length === 10 ? m = N(this, l, p) : w < 63 ? m = k(this, l, p) : w < 1024 ? m = z(this, l, p) : m = B(this, l, p), m; }, s.prototype.mul = function(l) { var p = new s(null); return p.words = new Array(this.length + l.length), this.mulTo(l, p); }, s.prototype.mulf = function(l) { var p = new s(null); - return p.words = new Array(this.length + l.length), k(this, l, p); + return p.words = new Array(this.length + l.length), B(this, l, p); }, s.prototype.imul = function(l) { return this.clone().mulTo(l, this); }, s.prototype.imuln = function(l) { @@ -10396,7 +10396,7 @@ function mB() { }, s.prototype.redPow = function(l) { return n(this.red && !l.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, l); }; - var B = { + var $ = { k256: null, p224: null, p192: null, @@ -10478,7 +10478,7 @@ function mB() { } return p !== 0 && (l.words[l.length++] = p), l; }, s._prime = function(l) { - if (B[l]) return B[l]; + if ($[l]) return $[l]; var p; if (l === "k256") p = new R(); @@ -10490,7 +10490,7 @@ function mB() { p = new ne(); else throw new Error("Unknown prime " + l); - return B[l] = p, p; + return $[l] = p, p; }; function K(b) { if (typeof b == "string") { @@ -10842,11 +10842,11 @@ function Ls() { return E + b + l + p + m >>> 0; } Or.sum32_5 = D; - function $(E, b, l, p) { + function k(E, b, l, p) { var m = E[b], w = E[b + 1], P = p + w >>> 0, _ = (P < p ? 1 : 0) + l + m; E[b] = _ >>> 0, E[b + 1] = P; } - Or.sum64 = $; + Or.sum64 = k; function N(E, b, l, p) { var m = b + p >>> 0, w = (m < b ? 1 : 0) + E + l; return w >>> 0; @@ -10857,18 +10857,18 @@ function Ls() { return m >>> 0; } Or.sum64_lo = z; - function k(E, b, l, p, m, w, P, _) { + function B(E, b, l, p, m, w, P, _) { var y = 0, M = b; M = M + p >>> 0, y += M < b ? 1 : 0, M = M + w >>> 0, y += M < w ? 1 : 0, M = M + _ >>> 0, y += M < _ ? 1 : 0; var I = E + l + m + P + y; return I >>> 0; } - Or.sum64_4_hi = k; - function B(E, b, l, p, m, w, P, _) { + Or.sum64_4_hi = B; + function $(E, b, l, p, m, w, P, _) { var y = b + p + w + _; return y >>> 0; } - Or.sum64_4_lo = B; + Or.sum64_4_lo = $; function U(E, b, l, p, m, w, P, _, y, M) { var I = 0, q = b; q = q + p >>> 0, I += q < b ? 1 : 0, q = q + w >>> 0, I += q < w ? 1 : 0, q = q + _ >>> 0, I += q < _ ? 1 : 0, q = q + M >>> 0, I += q < M ? 1 : 0; @@ -11004,12 +11004,12 @@ function IB() { x[S] = g[v + S]; for (; S < x.length; S++) x[S] = n(x[S - 3] ^ x[S - 8] ^ x[S - 14] ^ x[S - 16], 1); - var C = this.h[0], D = this.h[1], $ = this.h[2], N = this.h[3], z = this.h[4]; + var C = this.h[0], D = this.h[1], k = this.h[2], N = this.h[3], z = this.h[4]; for (S = 0; S < x.length; S++) { - var k = ~~(S / 20), B = s(n(C, 5), o(k, D, $, N), z, x[S], f[k]); - z = N, N = $, $ = n(D, 30), D = C, C = B; + var B = ~~(S / 20), $ = s(n(C, 5), o(B, D, k, N), z, x[S], f[B]); + z = N, N = k, k = n(D, 30), D = C, C = $; } - this.h[0] = i(this.h[0], C), this.h[1] = i(this.h[1], D), this.h[2] = i(this.h[2], $), this.h[3] = i(this.h[3], N), this.h[4] = i(this.h[4], z); + this.h[0] = i(this.h[0], C), this.h[1] = i(this.h[1], D), this.h[2] = i(this.h[2], k), this.h[3] = i(this.h[3], N), this.h[4] = i(this.h[4], z); }, u.prototype._digest = function(g) { return g === "hex" ? t.toHex32(this.h, "big") : t.split32(this.h, "big"); }, mg; @@ -11098,19 +11098,19 @@ function h8() { 1541459225 ], this.k = S, this.W = new Array(64); } - return t.inherits(C, x), vg = C, C.blockSize = 512, C.outSize = 256, C.hmacStrength = 192, C.padLength = 64, C.prototype._update = function($, N) { - for (var z = this.W, k = 0; k < 16; k++) - z[k] = $[N + k]; - for (; k < z.length; k++) - z[k] = s(v(z[k - 2]), z[k - 7], g(z[k - 15]), z[k - 16]); - var B = this.h[0], U = this.h[1], R = this.h[2], W = this.h[3], J = this.h[4], ne = this.h[5], K = this.h[6], E = this.h[7]; - for (n(this.k.length === z.length), k = 0; k < z.length; k++) { - var b = o(E, h(J), a(J, ne, K), this.k[k], z[k]), l = i(u(B), f(B, U, R)); - E = K, K = ne, ne = J, J = i(W, b), W = R, R = U, U = B, B = i(b, l); - } - this.h[0] = i(this.h[0], B), this.h[1] = i(this.h[1], U), this.h[2] = i(this.h[2], R), this.h[3] = i(this.h[3], W), this.h[4] = i(this.h[4], J), this.h[5] = i(this.h[5], ne), this.h[6] = i(this.h[6], K), this.h[7] = i(this.h[7], E); - }, C.prototype._digest = function($) { - return $ === "hex" ? t.toHex32(this.h, "big") : t.split32(this.h, "big"); + return t.inherits(C, x), vg = C, C.blockSize = 512, C.outSize = 256, C.hmacStrength = 192, C.padLength = 64, C.prototype._update = function(k, N) { + for (var z = this.W, B = 0; B < 16; B++) + z[B] = k[N + B]; + for (; B < z.length; B++) + z[B] = s(v(z[B - 2]), z[B - 7], g(z[B - 15]), z[B - 16]); + var $ = this.h[0], U = this.h[1], R = this.h[2], W = this.h[3], J = this.h[4], ne = this.h[5], K = this.h[6], E = this.h[7]; + for (n(this.k.length === z.length), B = 0; B < z.length; B++) { + var b = o(E, h(J), a(J, ne, K), this.k[B], z[B]), l = i(u($), f($, U, R)); + E = K, K = ne, ne = J, J = i(W, b), W = R, R = U, U = $, $ = i(b, l); + } + this.h[0] = i(this.h[0], $), this.h[1] = i(this.h[1], U), this.h[2] = i(this.h[2], R), this.h[3] = i(this.h[3], W), this.h[4] = i(this.h[4], J), this.h[5] = i(this.h[5], ne), this.h[6] = i(this.h[6], K), this.h[7] = i(this.h[7], E); + }, C.prototype._digest = function(k) { + return k === "hex" ? t.toHex32(this.h, "big") : t.split32(this.h, "big"); }, vg; } var bg, fx; @@ -11354,7 +11354,7 @@ function d8() { var m = this.W, w = this.h[0], P = this.h[1], _ = this.h[2], y = this.h[3], M = this.h[4], I = this.h[5], q = this.h[6], ce = this.h[7], L = this.h[8], oe = this.h[9], Q = this.h[10], X = this.h[11], ee = this.h[12], O = this.h[13], Z = this.h[14], re = this.h[15]; r(this.k.length === m.length); for (var he = 0; he < m.length; he += 2) { - var ae = Z, fe = re, be = R(L, oe), Ae = W(L, oe), Te = $(L, oe, Q, X, ee), Re = N(L, oe, Q, X, ee, O), $e = this.k[he], Me = this.k[he + 1], Oe = m[he], ze = m[he + 1], De = v( + var ae = Z, fe = re, be = R(L, oe), Ae = W(L, oe), Te = k(L, oe, Q, X, ee), Re = N(L, oe, Q, X, ee, O), $e = this.k[he], Me = this.k[he + 1], Oe = m[he], ze = m[he + 1], De = v( ae, fe, be, @@ -11377,7 +11377,7 @@ function d8() { Oe, ze ); - ae = B(w, P), fe = U(w, P), be = z(w, P, _, y, M), Ae = k(w, P, _, y, M, I); + ae = $(w, P), fe = U(w, P), be = z(w, P, _, y, M), Ae = B(w, P, _, y, M, I); var Ue = f(ae, fe, be, Ae), _e = u(ae, fe, be, Ae); Z = ee, re = O, ee = Q, O = X, Q = L, X = oe, L = f(q, ce, De, je), oe = u(ce, ce, De, je), q = M, ce = I, M = _, I = y, _ = w, y = P, w = f(De, je, Ue, _e), P = u(De, je, Ue, _e); } @@ -11385,7 +11385,7 @@ function d8() { }, D.prototype._digest = function(l) { return l === "hex" ? t.toHex32(this.h, "big") : t.split32(this.h, "big"); }; - function $(b, l, p, m, w) { + function k(b, l, p, m, w) { var P = b & p ^ ~b & w; return P < 0 && (P += 4294967296), P; } @@ -11397,11 +11397,11 @@ function d8() { var P = b & p ^ b & w ^ p & w; return P < 0 && (P += 4294967296), P; } - function k(b, l, p, m, w, P) { + function B(b, l, p, m, w, P) { var _ = l & m ^ l & P ^ m & P; return _ < 0 && (_ += 4294967296), _; } - function B(b, l) { + function $(b, l) { var p = n(b, l, 28), m = n(l, b, 2), w = n(l, b, 7), P = p ^ m ^ w; return P < 0 && (P += 4294967296), P; } @@ -11480,29 +11480,29 @@ function DB() { return new a(); o.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = "little"; } - t.inherits(a, o), xg.ripemd160 = a, a.blockSize = 512, a.outSize = 160, a.hmacStrength = 192, a.padLength = 64, a.prototype._update = function(D, $) { - for (var N = this.h[0], z = this.h[1], k = this.h[2], B = this.h[3], U = this.h[4], R = N, W = z, J = k, ne = B, K = U, E = 0; E < 80; E++) { + t.inherits(a, o), xg.ripemd160 = a, a.blockSize = 512, a.outSize = 160, a.hmacStrength = 192, a.padLength = 64, a.prototype._update = function(D, k) { + for (var N = this.h[0], z = this.h[1], B = this.h[2], $ = this.h[3], U = this.h[4], R = N, W = z, J = B, ne = $, K = U, E = 0; E < 80; E++) { var b = n( r( - s(N, f(E, z, k, B), D[g[E] + $], u(E)), + s(N, f(E, z, B, $), D[g[E] + k], u(E)), x[E] ), U ); - N = U, U = B, B = r(k, 10), k = z, z = b, b = n( + N = U, U = $, $ = r(B, 10), B = z, z = b, b = n( r( - s(R, f(79 - E, W, J, ne), D[v[E] + $], h(E)), + s(R, f(79 - E, W, J, ne), D[v[E] + k], h(E)), S[E] ), K ), R = K, K = ne, ne = r(J, 10), J = W, W = b; } - b = i(this.h[1], k, ne), this.h[1] = i(this.h[2], B, K), this.h[2] = i(this.h[3], U, R), this.h[3] = i(this.h[4], N, W), this.h[4] = i(this.h[0], z, J), this.h[0] = b; + b = i(this.h[1], B, ne), this.h[1] = i(this.h[2], $, K), this.h[2] = i(this.h[3], U, R), this.h[3] = i(this.h[4], N, W), this.h[4] = i(this.h[0], z, J), this.h[0] = b; }, a.prototype._digest = function(D) { return D === "hex" ? t.toHex32(this.h, "little") : t.split32(this.h, "little"); }; - function f(C, D, $, N) { - return C <= 15 ? D ^ $ ^ N : C <= 31 ? D & $ | ~D & N : C <= 47 ? (D | ~$) ^ N : C <= 63 ? D & N | $ & ~N : D ^ ($ | ~N); + function f(C, D, k, N) { + return C <= 15 ? D ^ k ^ N : C <= 31 ? D & k | ~D & N : C <= 47 ? (D | ~k) ^ N : C <= 63 ? D & N | k & ~N : D ^ (k | ~N); } function u(C) { return C <= 15 ? 0 : C <= 31 ? 1518500249 : C <= 47 ? 1859775393 : C <= 63 ? 2400959708 : 2840853838; @@ -11953,8 +11953,8 @@ var as = Gc(function(t, e) { S === 3 && (S = -1), C === 3 && (C = -1); var D; (S & 1) === 0 ? D = 0 : (x = f.andln(7) + g & 7, (x === 3 || x === 5) && C === 2 ? D = -S : D = S), h[0].push(D); - var $; - (C & 1) === 0 ? $ = 0 : (x = u.andln(7) + v & 7, (x === 3 || x === 5) && S === 2 ? $ = -C : $ = C), h[1].push($), 2 * g === D + 1 && (g = 1 - g), 2 * v === $ + 1 && (v = 1 - v), f.iushrn(1), u.iushrn(1); + var k; + (C & 1) === 0 ? k = 0 : (x = u.andln(7) + v & 7, (x === 3 || x === 5) && S === 2 ? k = -C : k = C), h[1].push(k), 2 * g === D + 1 && (g = 1 - g), 2 * v === k + 1 && (v = 1 - v), f.iushrn(1), u.iushrn(1); } return h; } @@ -12042,7 +12042,7 @@ Zo.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 7 */ ]; r[S].y.cmp(r[C].y) === 0 ? (D[1] = r[S].add(r[C]), D[2] = r[S].toJ().mixedAdd(r[C].neg())) : r[S].y.cmp(r[C].y.redNeg()) === 0 ? (D[1] = r[S].toJ().mixedAdd(r[C]), D[2] = r[S].add(r[C].neg())) : (D[1] = r[S].toJ().mixedAdd(r[C]), D[2] = r[S].toJ().mixedAdd(r[C].neg())); - var $ = [ + var k = [ -3, /* -1 -1 */ -1, @@ -12063,11 +12063,11 @@ Zo.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 1 1 */ ], N = kB(n[S], n[C]); for (u = Math.max(N[0].length, u), f[S] = new Array(u), f[C] = new Array(u), g = 0; g < u; g++) { - var z = N[0][g] | 0, k = N[1][g] | 0; - f[S][g] = $[(z + 1) * 3 + (k + 1)], f[C][g] = 0, a[S] = D; + var z = N[0][g] | 0, B = N[1][g] | 0; + f[S][g] = k[(z + 1) * 3 + (B + 1)], f[C][g] = 0, a[S] = D; } } - var B = this.jpoint(null, null, null), U = this._wnafT4; + var $ = this.jpoint(null, null, null), U = this._wnafT4; for (h = u; h >= 0; h--) { for (var R = 0; h >= 0; ) { var W = !0; @@ -12077,16 +12077,16 @@ Zo.prototype._wnafMulAdd = function(e, r, n, i, s) { break; R++, h--; } - if (h >= 0 && R++, B = B.dblp(R), h < 0) + if (h >= 0 && R++, $ = $.dblp(R), h < 0) break; for (g = 0; g < i; g++) { var J = U[g]; - J !== 0 && (J > 0 ? v = a[g][J - 1 >> 1] : J < 0 && (v = a[g][-J - 1 >> 1].neg()), v.type === "affine" ? B = B.mixedAdd(v) : B = B.add(v)); + J !== 0 && (J > 0 ? v = a[g][J - 1 >> 1] : J < 0 && (v = a[g][-J - 1 >> 1].neg()), v.type === "affine" ? $ = $.mixedAdd(v) : $ = $.add(v)); } } for (h = 0; h < i; h++) a[h] = null; - return s ? B : B.toP(); + return s ? $ : $.toP(); }; function Ki(t, e) { this.curve = t, this.type = e, this.precomputed = null; @@ -12226,19 +12226,19 @@ Vi.prototype._getEndoRoots = function(e) { return [o, a]; }; Vi.prototype._getEndoBasis = function(e) { - for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new or(1), o = new or(0), a = new or(0), f = new or(1), u, h, g, v, x, S, C, D = 0, $, N; n.cmpn(0) !== 0; ) { + for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new or(1), o = new or(0), a = new or(0), f = new or(1), u, h, g, v, x, S, C, D = 0, k, N; n.cmpn(0) !== 0; ) { var z = i.div(n); - $ = i.sub(z.mul(n)), N = a.sub(z.mul(s)); - var k = f.sub(z.mul(o)); - if (!g && $.cmp(r) < 0) - u = C.neg(), h = s, g = $.neg(), v = N; + k = i.sub(z.mul(n)), N = a.sub(z.mul(s)); + var B = f.sub(z.mul(o)); + if (!g && k.cmp(r) < 0) + u = C.neg(), h = s, g = k.neg(), v = N; else if (g && ++D === 2) break; - C = $, i = n, n = $, a = s, s = N, f = o, o = k; + C = k, i = n, n = k, a = s, s = N, f = o, o = B; } - x = $.neg(), S = N; - var B = g.sqr().add(v.sqr()), U = x.sqr().add(S.sqr()); - return U.cmp(B) >= 0 && (x = u, S = h), g.negative && (g = g.neg(), v = v.neg()), x.negative && (x = x.neg(), S = S.neg()), [ + x = k.neg(), S = N; + var $ = g.sqr().add(v.sqr()), U = x.sqr().add(S.sqr()); + return U.cmp($) >= 0 && (x = u, S = h), g.negative && (g = g.neg(), v = v.neg()), x.negative && (x = x.neg(), S = S.neg()), [ { a: g, b: v }, { a: x, b: S } ]; @@ -12470,7 +12470,7 @@ Bn.prototype.dblp = function(e) { } var i = this.curve.a, s = this.curve.tinv, o = this.x, a = this.y, f = this.z, u = f.redSqr().redSqr(), h = a.redAdd(a); for (r = 0; r < e; r++) { - var g = o.redSqr(), v = h.redSqr(), x = v.redSqr(), S = g.redAdd(g).redIAdd(g).redIAdd(i.redMul(u)), C = o.redMul(v), D = S.redSqr().redISub(C.redAdd(C)), $ = C.redISub(D), N = S.redMul($); + var g = o.redSqr(), v = h.redSqr(), x = v.redSqr(), S = g.redAdd(g).redIAdd(g).redIAdd(i.redMul(u)), C = o.redMul(v), D = S.redSqr().redISub(C.redAdd(C)), k = C.redISub(D), N = S.redMul(k); N = N.redIAdd(N).redISub(x); var z = h.redMul(f); r + 1 < e && (u = u.redMul(x)), o = D, f = z, h = N; @@ -12490,8 +12490,8 @@ Bn.prototype._zeroDbl = function() { } else { var g = this.x.redSqr(), v = this.y.redSqr(), x = v.redSqr(), S = this.x.redAdd(v).redSqr().redISub(g).redISub(x); S = S.redIAdd(S); - var C = g.redAdd(g).redIAdd(g), D = C.redSqr(), $ = x.redIAdd(x); - $ = $.redIAdd($), $ = $.redIAdd($), e = D.redISub(S).redISub(S), r = C.redMul(S.redISub(e)).redISub($), n = this.y.redMul(this.z), n = n.redIAdd(n); + var C = g.redAdd(g).redIAdd(g), D = C.redSqr(), k = x.redIAdd(x); + k = k.redIAdd(k), k = k.redIAdd(k), e = D.redISub(S).redISub(S), r = C.redMul(S.redISub(e)).redISub(k), n = this.y.redMul(this.z), n = n.redIAdd(n); } return this.curve.jpoint(e, r, n); }; @@ -12511,8 +12511,8 @@ Bn.prototype._threeDbl = function() { C = C.redIAdd(C); var D = C.redAdd(C); e = S.redSqr().redISub(D), n = this.y.redAdd(this.z).redSqr().redISub(v).redISub(g); - var $ = v.redSqr(); - $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($), r = S.redMul(C.redISub(e)).redISub($); + var k = v.redSqr(); + k = k.redIAdd(k), k = k.redIAdd(k), k = k.redIAdd(k), r = S.redMul(C.redISub(e)).redISub(k); } return this.curve.jpoint(e, r, n); }; @@ -13057,9 +13057,9 @@ function JB() { yx = 1, Object.defineProperty(Du, "__esModule", { value: !0 }); var t = el(), e = ls(), r = 20; function n(a, f, u) { - for (var h = 1634760805, g = 857760878, v = 2036477234, x = 1797285236, S = u[3] << 24 | u[2] << 16 | u[1] << 8 | u[0], C = u[7] << 24 | u[6] << 16 | u[5] << 8 | u[4], D = u[11] << 24 | u[10] << 16 | u[9] << 8 | u[8], $ = u[15] << 24 | u[14] << 16 | u[13] << 8 | u[12], N = u[19] << 24 | u[18] << 16 | u[17] << 8 | u[16], z = u[23] << 24 | u[22] << 16 | u[21] << 8 | u[20], k = u[27] << 24 | u[26] << 16 | u[25] << 8 | u[24], B = u[31] << 24 | u[30] << 16 | u[29] << 8 | u[28], U = f[3] << 24 | f[2] << 16 | f[1] << 8 | f[0], R = f[7] << 24 | f[6] << 16 | f[5] << 8 | f[4], W = f[11] << 24 | f[10] << 16 | f[9] << 8 | f[8], J = f[15] << 24 | f[14] << 16 | f[13] << 8 | f[12], ne = h, K = g, E = v, b = x, l = S, p = C, m = D, w = $, P = N, _ = z, y = k, M = B, I = U, q = R, ce = W, L = J, oe = 0; oe < r; oe += 2) + for (var h = 1634760805, g = 857760878, v = 2036477234, x = 1797285236, S = u[3] << 24 | u[2] << 16 | u[1] << 8 | u[0], C = u[7] << 24 | u[6] << 16 | u[5] << 8 | u[4], D = u[11] << 24 | u[10] << 16 | u[9] << 8 | u[8], k = u[15] << 24 | u[14] << 16 | u[13] << 8 | u[12], N = u[19] << 24 | u[18] << 16 | u[17] << 8 | u[16], z = u[23] << 24 | u[22] << 16 | u[21] << 8 | u[20], B = u[27] << 24 | u[26] << 16 | u[25] << 8 | u[24], $ = u[31] << 24 | u[30] << 16 | u[29] << 8 | u[28], U = f[3] << 24 | f[2] << 16 | f[1] << 8 | f[0], R = f[7] << 24 | f[6] << 16 | f[5] << 8 | f[4], W = f[11] << 24 | f[10] << 16 | f[9] << 8 | f[8], J = f[15] << 24 | f[14] << 16 | f[13] << 8 | f[12], ne = h, K = g, E = v, b = x, l = S, p = C, m = D, w = k, P = N, _ = z, y = B, M = $, I = U, q = R, ce = W, L = J, oe = 0; oe < r; oe += 2) ne = ne + l | 0, I ^= ne, I = I >>> 16 | I << 16, P = P + I | 0, l ^= P, l = l >>> 20 | l << 12, K = K + p | 0, q ^= K, q = q >>> 16 | q << 16, _ = _ + q | 0, p ^= _, p = p >>> 20 | p << 12, E = E + m | 0, ce ^= E, ce = ce >>> 16 | ce << 16, y = y + ce | 0, m ^= y, m = m >>> 20 | m << 12, b = b + w | 0, L ^= b, L = L >>> 16 | L << 16, M = M + L | 0, w ^= M, w = w >>> 20 | w << 12, E = E + m | 0, ce ^= E, ce = ce >>> 24 | ce << 8, y = y + ce | 0, m ^= y, m = m >>> 25 | m << 7, b = b + w | 0, L ^= b, L = L >>> 24 | L << 8, M = M + L | 0, w ^= M, w = w >>> 25 | w << 7, K = K + p | 0, q ^= K, q = q >>> 24 | q << 8, _ = _ + q | 0, p ^= _, p = p >>> 25 | p << 7, ne = ne + l | 0, I ^= ne, I = I >>> 24 | I << 8, P = P + I | 0, l ^= P, l = l >>> 25 | l << 7, ne = ne + p | 0, L ^= ne, L = L >>> 16 | L << 16, y = y + L | 0, p ^= y, p = p >>> 20 | p << 12, K = K + m | 0, I ^= K, I = I >>> 16 | I << 16, M = M + I | 0, m ^= M, m = m >>> 20 | m << 12, E = E + w | 0, q ^= E, q = q >>> 16 | q << 16, P = P + q | 0, w ^= P, w = w >>> 20 | w << 12, b = b + l | 0, ce ^= b, ce = ce >>> 16 | ce << 16, _ = _ + ce | 0, l ^= _, l = l >>> 20 | l << 12, E = E + w | 0, q ^= E, q = q >>> 24 | q << 8, P = P + q | 0, w ^= P, w = w >>> 25 | w << 7, b = b + l | 0, ce ^= b, ce = ce >>> 24 | ce << 8, _ = _ + ce | 0, l ^= _, l = l >>> 25 | l << 7, K = K + m | 0, I ^= K, I = I >>> 24 | I << 8, M = M + I | 0, m ^= M, m = m >>> 25 | m << 7, ne = ne + p | 0, L ^= ne, L = L >>> 24 | L << 8, y = y + L | 0, p ^= y, p = p >>> 25 | p << 7; - t.writeUint32LE(ne + h | 0, a, 0), t.writeUint32LE(K + g | 0, a, 4), t.writeUint32LE(E + v | 0, a, 8), t.writeUint32LE(b + x | 0, a, 12), t.writeUint32LE(l + S | 0, a, 16), t.writeUint32LE(p + C | 0, a, 20), t.writeUint32LE(m + D | 0, a, 24), t.writeUint32LE(w + $ | 0, a, 28), t.writeUint32LE(P + N | 0, a, 32), t.writeUint32LE(_ + z | 0, a, 36), t.writeUint32LE(y + k | 0, a, 40), t.writeUint32LE(M + B | 0, a, 44), t.writeUint32LE(I + U | 0, a, 48), t.writeUint32LE(q + R | 0, a, 52), t.writeUint32LE(ce + W | 0, a, 56), t.writeUint32LE(L + J | 0, a, 60); + t.writeUint32LE(ne + h | 0, a, 0), t.writeUint32LE(K + g | 0, a, 4), t.writeUint32LE(E + v | 0, a, 8), t.writeUint32LE(b + x | 0, a, 12), t.writeUint32LE(l + S | 0, a, 16), t.writeUint32LE(p + C | 0, a, 20), t.writeUint32LE(m + D | 0, a, 24), t.writeUint32LE(w + k | 0, a, 28), t.writeUint32LE(P + N | 0, a, 32), t.writeUint32LE(_ + z | 0, a, 36), t.writeUint32LE(y + B | 0, a, 40), t.writeUint32LE(M + $ | 0, a, 44), t.writeUint32LE(I + U | 0, a, 48), t.writeUint32LE(q + R | 0, a, 52), t.writeUint32LE(ce + W | 0, a, 56), t.writeUint32LE(L + J | 0, a, 60); } function i(a, f, u, h, g) { if (g === void 0 && (g = 0), a.length !== 32) @@ -13151,7 +13151,7 @@ function XB() { this._r[8] = (S >>> 8 | C << 8) & 8191, this._r[9] = C >>> 5 & 127, this._pad[0] = a[16] | a[17] << 8, this._pad[1] = a[18] | a[19] << 8, this._pad[2] = a[20] | a[21] << 8, this._pad[3] = a[22] | a[23] << 8, this._pad[4] = a[24] | a[25] << 8, this._pad[5] = a[26] | a[27] << 8, this._pad[6] = a[28] | a[29] << 8, this._pad[7] = a[30] | a[31] << 8; } return o.prototype._blocks = function(a, f, u) { - for (var h = this._fin ? 0 : 2048, g = this._h[0], v = this._h[1], x = this._h[2], S = this._h[3], C = this._h[4], D = this._h[5], $ = this._h[6], N = this._h[7], z = this._h[8], k = this._h[9], B = this._r[0], U = this._r[1], R = this._r[2], W = this._r[3], J = this._r[4], ne = this._r[5], K = this._r[6], E = this._r[7], b = this._r[8], l = this._r[9]; u >= 16; ) { + for (var h = this._fin ? 0 : 2048, g = this._h[0], v = this._h[1], x = this._h[2], S = this._h[3], C = this._h[4], D = this._h[5], k = this._h[6], N = this._h[7], z = this._h[8], B = this._h[9], $ = this._r[0], U = this._r[1], R = this._r[2], W = this._r[3], J = this._r[4], ne = this._r[5], K = this._r[6], E = this._r[7], b = this._r[8], l = this._r[9]; u >= 16; ) { var p = a[f + 0] | a[f + 1] << 8; g += p & 8191; var m = a[f + 2] | a[f + 3] << 8; @@ -13163,33 +13163,33 @@ function XB() { var _ = a[f + 8] | a[f + 9] << 8; C += (P >>> 4 | _ << 12) & 8191, D += _ >>> 1 & 8191; var y = a[f + 10] | a[f + 11] << 8; - $ += (_ >>> 14 | y << 2) & 8191; + k += (_ >>> 14 | y << 2) & 8191; var M = a[f + 12] | a[f + 13] << 8; N += (y >>> 11 | M << 5) & 8191; var I = a[f + 14] | a[f + 15] << 8; - z += (M >>> 8 | I << 8) & 8191, k += I >>> 5 | h; + z += (M >>> 8 | I << 8) & 8191, B += I >>> 5 | h; var q = 0, ce = q; - ce += g * B, ce += v * (5 * l), ce += x * (5 * b), ce += S * (5 * E), ce += C * (5 * K), q = ce >>> 13, ce &= 8191, ce += D * (5 * ne), ce += $ * (5 * J), ce += N * (5 * W), ce += z * (5 * R), ce += k * (5 * U), q += ce >>> 13, ce &= 8191; + ce += g * $, ce += v * (5 * l), ce += x * (5 * b), ce += S * (5 * E), ce += C * (5 * K), q = ce >>> 13, ce &= 8191, ce += D * (5 * ne), ce += k * (5 * J), ce += N * (5 * W), ce += z * (5 * R), ce += B * (5 * U), q += ce >>> 13, ce &= 8191; var L = q; - L += g * U, L += v * B, L += x * (5 * l), L += S * (5 * b), L += C * (5 * E), q = L >>> 13, L &= 8191, L += D * (5 * K), L += $ * (5 * ne), L += N * (5 * J), L += z * (5 * W), L += k * (5 * R), q += L >>> 13, L &= 8191; + L += g * U, L += v * $, L += x * (5 * l), L += S * (5 * b), L += C * (5 * E), q = L >>> 13, L &= 8191, L += D * (5 * K), L += k * (5 * ne), L += N * (5 * J), L += z * (5 * W), L += B * (5 * R), q += L >>> 13, L &= 8191; var oe = q; - oe += g * R, oe += v * U, oe += x * B, oe += S * (5 * l), oe += C * (5 * b), q = oe >>> 13, oe &= 8191, oe += D * (5 * E), oe += $ * (5 * K), oe += N * (5 * ne), oe += z * (5 * J), oe += k * (5 * W), q += oe >>> 13, oe &= 8191; + oe += g * R, oe += v * U, oe += x * $, oe += S * (5 * l), oe += C * (5 * b), q = oe >>> 13, oe &= 8191, oe += D * (5 * E), oe += k * (5 * K), oe += N * (5 * ne), oe += z * (5 * J), oe += B * (5 * W), q += oe >>> 13, oe &= 8191; var Q = q; - Q += g * W, Q += v * R, Q += x * U, Q += S * B, Q += C * (5 * l), q = Q >>> 13, Q &= 8191, Q += D * (5 * b), Q += $ * (5 * E), Q += N * (5 * K), Q += z * (5 * ne), Q += k * (5 * J), q += Q >>> 13, Q &= 8191; + Q += g * W, Q += v * R, Q += x * U, Q += S * $, Q += C * (5 * l), q = Q >>> 13, Q &= 8191, Q += D * (5 * b), Q += k * (5 * E), Q += N * (5 * K), Q += z * (5 * ne), Q += B * (5 * J), q += Q >>> 13, Q &= 8191; var X = q; - X += g * J, X += v * W, X += x * R, X += S * U, X += C * B, q = X >>> 13, X &= 8191, X += D * (5 * l), X += $ * (5 * b), X += N * (5 * E), X += z * (5 * K), X += k * (5 * ne), q += X >>> 13, X &= 8191; + X += g * J, X += v * W, X += x * R, X += S * U, X += C * $, q = X >>> 13, X &= 8191, X += D * (5 * l), X += k * (5 * b), X += N * (5 * E), X += z * (5 * K), X += B * (5 * ne), q += X >>> 13, X &= 8191; var ee = q; - ee += g * ne, ee += v * J, ee += x * W, ee += S * R, ee += C * U, q = ee >>> 13, ee &= 8191, ee += D * B, ee += $ * (5 * l), ee += N * (5 * b), ee += z * (5 * E), ee += k * (5 * K), q += ee >>> 13, ee &= 8191; + ee += g * ne, ee += v * J, ee += x * W, ee += S * R, ee += C * U, q = ee >>> 13, ee &= 8191, ee += D * $, ee += k * (5 * l), ee += N * (5 * b), ee += z * (5 * E), ee += B * (5 * K), q += ee >>> 13, ee &= 8191; var O = q; - O += g * K, O += v * ne, O += x * J, O += S * W, O += C * R, q = O >>> 13, O &= 8191, O += D * U, O += $ * B, O += N * (5 * l), O += z * (5 * b), O += k * (5 * E), q += O >>> 13, O &= 8191; + O += g * K, O += v * ne, O += x * J, O += S * W, O += C * R, q = O >>> 13, O &= 8191, O += D * U, O += k * $, O += N * (5 * l), O += z * (5 * b), O += B * (5 * E), q += O >>> 13, O &= 8191; var Z = q; - Z += g * E, Z += v * K, Z += x * ne, Z += S * J, Z += C * W, q = Z >>> 13, Z &= 8191, Z += D * R, Z += $ * U, Z += N * B, Z += z * (5 * l), Z += k * (5 * b), q += Z >>> 13, Z &= 8191; + Z += g * E, Z += v * K, Z += x * ne, Z += S * J, Z += C * W, q = Z >>> 13, Z &= 8191, Z += D * R, Z += k * U, Z += N * $, Z += z * (5 * l), Z += B * (5 * b), q += Z >>> 13, Z &= 8191; var re = q; - re += g * b, re += v * E, re += x * K, re += S * ne, re += C * J, q = re >>> 13, re &= 8191, re += D * W, re += $ * R, re += N * U, re += z * B, re += k * (5 * l), q += re >>> 13, re &= 8191; + re += g * b, re += v * E, re += x * K, re += S * ne, re += C * J, q = re >>> 13, re &= 8191, re += D * W, re += k * R, re += N * U, re += z * $, re += B * (5 * l), q += re >>> 13, re &= 8191; var he = q; - he += g * l, he += v * b, he += x * E, he += S * K, he += C * ne, q = he >>> 13, he &= 8191, he += D * J, he += $ * W, he += N * R, he += z * U, he += k * B, q += he >>> 13, he &= 8191, q = (q << 2) + q | 0, q = q + ce | 0, ce = q & 8191, q = q >>> 13, L += q, g = ce, v = L, x = oe, S = Q, C = X, D = ee, $ = O, N = Z, z = re, k = he, f += 16, u -= 16; + he += g * l, he += v * b, he += x * E, he += S * K, he += C * ne, q = he >>> 13, he &= 8191, he += D * J, he += k * W, he += N * R, he += z * U, he += B * $, q += he >>> 13, he &= 8191, q = (q << 2) + q | 0, q = q + ce | 0, ce = q & 8191, q = q >>> 13, L += q, g = ce, v = L, x = oe, S = Q, C = X, D = ee, k = O, N = Z, z = re, B = he, f += 16, u -= 16; } - this._h[0] = g, this._h[1] = v, this._h[2] = x, this._h[3] = S, this._h[4] = C, this._h[5] = D, this._h[6] = $, this._h[7] = N, this._h[8] = z, this._h[9] = k; + this._h[0] = g, this._h[1] = v, this._h[2] = x, this._h[3] = S, this._h[4] = C, this._h[5] = D, this._h[6] = k, this._h[7] = N, this._h[8] = z, this._h[9] = B; }, o.prototype.finish = function(a, f) { f === void 0 && (f = 0); var u = new Uint16Array(10), h, g, v, x; @@ -13290,14 +13290,14 @@ function ZB() { var C = new Uint8Array(this.tagLength); if (this._authenticate(C, S, h.subarray(0, h.length - this.tagLength), g), !s.equal(C, h.subarray(h.length - this.tagLength, h.length))) return null; - var D = h.length - this.tagLength, $; + var D = h.length - this.tagLength, k; if (v) { if (v.length !== D) throw new Error("ChaCha20Poly1305: incorrect destination length"); - $ = v; + k = v; } else - $ = new Uint8Array(D); - return e.streamXOR(this._key, x, h.subarray(0, h.length - this.tagLength), $, 4), n.wipe(x), $; + k = new Uint8Array(D); + return e.streamXOR(this._key, x, h.subarray(0, h.length - this.tagLength), k, 4), n.wipe(x), k; }, f.prototype.clean = function() { return n.wipe(this._key), this; }, f.prototype._authenticate = function(u, h, g, v) { @@ -13536,21 +13536,21 @@ function nF() { ]); function s(a, f, u, h, g) { for (; g >= 64; ) { - for (var v = f[0], x = f[1], S = f[2], C = f[3], D = f[4], $ = f[5], N = f[6], z = f[7], k = 0; k < 16; k++) { - var B = h + k * 4; - a[k] = e.readUint32BE(u, B); + for (var v = f[0], x = f[1], S = f[2], C = f[3], D = f[4], k = f[5], N = f[6], z = f[7], B = 0; B < 16; B++) { + var $ = h + B * 4; + a[B] = e.readUint32BE(u, $); } - for (var k = 16; k < 64; k++) { - var U = a[k - 2], R = (U >>> 17 | U << 15) ^ (U >>> 19 | U << 13) ^ U >>> 10; - U = a[k - 15]; + for (var B = 16; B < 64; B++) { + var U = a[B - 2], R = (U >>> 17 | U << 15) ^ (U >>> 19 | U << 13) ^ U >>> 10; + U = a[B - 15]; var W = (U >>> 7 | U << 25) ^ (U >>> 18 | U << 14) ^ U >>> 3; - a[k] = (R + a[k - 7] | 0) + (W + a[k - 16] | 0); + a[B] = (R + a[B - 7] | 0) + (W + a[B - 16] | 0); } - for (var k = 0; k < 64; k++) { - var R = (((D >>> 6 | D << 26) ^ (D >>> 11 | D << 21) ^ (D >>> 25 | D << 7)) + (D & $ ^ ~D & N) | 0) + (z + (i[k] + a[k] | 0) | 0) | 0, W = ((v >>> 2 | v << 30) ^ (v >>> 13 | v << 19) ^ (v >>> 22 | v << 10)) + (v & x ^ v & S ^ x & S) | 0; - z = N, N = $, $ = D, D = C + R | 0, C = S, S = x, x = v, v = R + W | 0; + for (var B = 0; B < 64; B++) { + var R = (((D >>> 6 | D << 26) ^ (D >>> 11 | D << 21) ^ (D >>> 25 | D << 7)) + (D & k ^ ~D & N) | 0) + (z + (i[B] + a[B] | 0) | 0) | 0, W = ((v >>> 2 | v << 30) ^ (v >>> 13 | v << 19) ^ (v >>> 22 | v << 10)) + (v & x ^ v & S ^ x & S) | 0; + z = N, N = k, k = D, D = C + R | 0, C = S, S = x, x = v, v = R + W | 0; } - f[0] += v, f[1] += x, f[2] += S, f[3] += C, f[4] += D, f[5] += $, f[6] += N, f[7] += z, h += 64, g -= 64; + f[0] += v, f[1] += x, f[2] += S, f[3] += C, f[4] += D, f[5] += k, f[6] += N, f[7] += z, h += 64, g -= 64; } return h; } @@ -13569,35 +13569,35 @@ function iF() { Object.defineProperty(t, "__esModule", { value: !0 }), t.sharedKey = t.generateKeyPair = t.generateKeyPairFromSeed = t.scalarMultBase = t.scalarMult = t.SHARED_KEY_LENGTH = t.SECRET_KEY_LENGTH = t.PUBLIC_KEY_LENGTH = void 0; const e = d1(), r = ls(); t.PUBLIC_KEY_LENGTH = 32, t.SECRET_KEY_LENGTH = 32, t.SHARED_KEY_LENGTH = 32; - function n(k) { - const B = new Float64Array(16); - if (k) - for (let U = 0; U < k.length; U++) - B[U] = k[U]; - return B; + function n(B) { + const $ = new Float64Array(16); + if (B) + for (let U = 0; U < B.length; U++) + $[U] = B[U]; + return $; } const i = new Uint8Array(32); i[0] = 9; const s = n([56129, 1]); - function o(k) { - let B = 1; + function o(B) { + let $ = 1; for (let U = 0; U < 16; U++) { - let R = k[U] + B + 65535; - B = Math.floor(R / 65536), k[U] = R - B * 65536; + let R = B[U] + $ + 65535; + $ = Math.floor(R / 65536), B[U] = R - $ * 65536; } - k[0] += B - 1 + 37 * (B - 1); + B[0] += $ - 1 + 37 * ($ - 1); } - function a(k, B, U) { + function a(B, $, U) { const R = ~(U - 1); for (let W = 0; W < 16; W++) { - const J = R & (k[W] ^ B[W]); - k[W] ^= J, B[W] ^= J; + const J = R & (B[W] ^ $[W]); + B[W] ^= J, $[W] ^= J; } } - function f(k, B) { + function f(B, $) { const U = n(), R = n(); for (let W = 0; W < 16; W++) - R[W] = B[W]; + R[W] = $[W]; o(R), o(R), o(R); for (let W = 0; W < 2; W++) { U[0] = R[0] - 65517; @@ -13608,42 +13608,42 @@ function iF() { U[14] &= 65535, a(R, U, 1 - J); } for (let W = 0; W < 16; W++) - k[2 * W] = R[W] & 255, k[2 * W + 1] = R[W] >> 8; + B[2 * W] = R[W] & 255, B[2 * W + 1] = R[W] >> 8; } - function u(k, B) { + function u(B, $) { for (let U = 0; U < 16; U++) - k[U] = B[2 * U] + (B[2 * U + 1] << 8); - k[15] &= 32767; + B[U] = $[2 * U] + ($[2 * U + 1] << 8); + B[15] &= 32767; } - function h(k, B, U) { + function h(B, $, U) { for (let R = 0; R < 16; R++) - k[R] = B[R] + U[R]; + B[R] = $[R] + U[R]; } - function g(k, B, U) { + function g(B, $, U) { for (let R = 0; R < 16; R++) - k[R] = B[R] - U[R]; + B[R] = $[R] - U[R]; } - function v(k, B, U) { + function v(B, $, U) { let R, W, J = 0, ne = 0, K = 0, E = 0, b = 0, l = 0, p = 0, m = 0, w = 0, P = 0, _ = 0, y = 0, M = 0, I = 0, q = 0, ce = 0, L = 0, oe = 0, Q = 0, X = 0, ee = 0, O = 0, Z = 0, re = 0, he = 0, ae = 0, fe = 0, be = 0, Ae = 0, Te = 0, Re = 0, $e = U[0], Me = U[1], Oe = U[2], ze = U[3], De = U[4], je = U[5], Ue = U[6], _e = U[7], Ze = U[8], ot = U[9], ke = U[10], rt = U[11], nt = U[12], Ge = U[13], ht = U[14], lt = U[15]; - R = B[0], J += R * $e, ne += R * Me, K += R * Oe, E += R * ze, b += R * De, l += R * je, p += R * Ue, m += R * _e, w += R * Ze, P += R * ot, _ += R * ke, y += R * rt, M += R * nt, I += R * Ge, q += R * ht, ce += R * lt, R = B[1], ne += R * $e, K += R * Me, E += R * Oe, b += R * ze, l += R * De, p += R * je, m += R * Ue, w += R * _e, P += R * Ze, _ += R * ot, y += R * ke, M += R * rt, I += R * nt, q += R * Ge, ce += R * ht, L += R * lt, R = B[2], K += R * $e, E += R * Me, b += R * Oe, l += R * ze, p += R * De, m += R * je, w += R * Ue, P += R * _e, _ += R * Ze, y += R * ot, M += R * ke, I += R * rt, q += R * nt, ce += R * Ge, L += R * ht, oe += R * lt, R = B[3], E += R * $e, b += R * Me, l += R * Oe, p += R * ze, m += R * De, w += R * je, P += R * Ue, _ += R * _e, y += R * Ze, M += R * ot, I += R * ke, q += R * rt, ce += R * nt, L += R * Ge, oe += R * ht, Q += R * lt, R = B[4], b += R * $e, l += R * Me, p += R * Oe, m += R * ze, w += R * De, P += R * je, _ += R * Ue, y += R * _e, M += R * Ze, I += R * ot, q += R * ke, ce += R * rt, L += R * nt, oe += R * Ge, Q += R * ht, X += R * lt, R = B[5], l += R * $e, p += R * Me, m += R * Oe, w += R * ze, P += R * De, _ += R * je, y += R * Ue, M += R * _e, I += R * Ze, q += R * ot, ce += R * ke, L += R * rt, oe += R * nt, Q += R * Ge, X += R * ht, ee += R * lt, R = B[6], p += R * $e, m += R * Me, w += R * Oe, P += R * ze, _ += R * De, y += R * je, M += R * Ue, I += R * _e, q += R * Ze, ce += R * ot, L += R * ke, oe += R * rt, Q += R * nt, X += R * Ge, ee += R * ht, O += R * lt, R = B[7], m += R * $e, w += R * Me, P += R * Oe, _ += R * ze, y += R * De, M += R * je, I += R * Ue, q += R * _e, ce += R * Ze, L += R * ot, oe += R * ke, Q += R * rt, X += R * nt, ee += R * Ge, O += R * ht, Z += R * lt, R = B[8], w += R * $e, P += R * Me, _ += R * Oe, y += R * ze, M += R * De, I += R * je, q += R * Ue, ce += R * _e, L += R * Ze, oe += R * ot, Q += R * ke, X += R * rt, ee += R * nt, O += R * Ge, Z += R * ht, re += R * lt, R = B[9], P += R * $e, _ += R * Me, y += R * Oe, M += R * ze, I += R * De, q += R * je, ce += R * Ue, L += R * _e, oe += R * Ze, Q += R * ot, X += R * ke, ee += R * rt, O += R * nt, Z += R * Ge, re += R * ht, he += R * lt, R = B[10], _ += R * $e, y += R * Me, M += R * Oe, I += R * ze, q += R * De, ce += R * je, L += R * Ue, oe += R * _e, Q += R * Ze, X += R * ot, ee += R * ke, O += R * rt, Z += R * nt, re += R * Ge, he += R * ht, ae += R * lt, R = B[11], y += R * $e, M += R * Me, I += R * Oe, q += R * ze, ce += R * De, L += R * je, oe += R * Ue, Q += R * _e, X += R * Ze, ee += R * ot, O += R * ke, Z += R * rt, re += R * nt, he += R * Ge, ae += R * ht, fe += R * lt, R = B[12], M += R * $e, I += R * Me, q += R * Oe, ce += R * ze, L += R * De, oe += R * je, Q += R * Ue, X += R * _e, ee += R * Ze, O += R * ot, Z += R * ke, re += R * rt, he += R * nt, ae += R * Ge, fe += R * ht, be += R * lt, R = B[13], I += R * $e, q += R * Me, ce += R * Oe, L += R * ze, oe += R * De, Q += R * je, X += R * Ue, ee += R * _e, O += R * Ze, Z += R * ot, re += R * ke, he += R * rt, ae += R * nt, fe += R * Ge, be += R * ht, Ae += R * lt, R = B[14], q += R * $e, ce += R * Me, L += R * Oe, oe += R * ze, Q += R * De, X += R * je, ee += R * Ue, O += R * _e, Z += R * Ze, re += R * ot, he += R * ke, ae += R * rt, fe += R * nt, be += R * Ge, Ae += R * ht, Te += R * lt, R = B[15], ce += R * $e, L += R * Me, oe += R * Oe, Q += R * ze, X += R * De, ee += R * je, O += R * Ue, Z += R * _e, re += R * Ze, he += R * ot, ae += R * ke, fe += R * rt, be += R * nt, Ae += R * Ge, Te += R * ht, Re += R * lt, J += 38 * L, ne += 38 * oe, K += 38 * Q, E += 38 * X, b += 38 * ee, l += 38 * O, p += 38 * Z, m += 38 * re, w += 38 * he, P += 38 * ae, _ += 38 * fe, y += 38 * be, M += 38 * Ae, I += 38 * Te, q += 38 * Re, W = 1, R = J + W + 65535, W = Math.floor(R / 65536), J = R - W * 65536, R = ne + W + 65535, W = Math.floor(R / 65536), ne = R - W * 65536, R = K + W + 65535, W = Math.floor(R / 65536), K = R - W * 65536, R = E + W + 65535, W = Math.floor(R / 65536), E = R - W * 65536, R = b + W + 65535, W = Math.floor(R / 65536), b = R - W * 65536, R = l + W + 65535, W = Math.floor(R / 65536), l = R - W * 65536, R = p + W + 65535, W = Math.floor(R / 65536), p = R - W * 65536, R = m + W + 65535, W = Math.floor(R / 65536), m = R - W * 65536, R = w + W + 65535, W = Math.floor(R / 65536), w = R - W * 65536, R = P + W + 65535, W = Math.floor(R / 65536), P = R - W * 65536, R = _ + W + 65535, W = Math.floor(R / 65536), _ = R - W * 65536, R = y + W + 65535, W = Math.floor(R / 65536), y = R - W * 65536, R = M + W + 65535, W = Math.floor(R / 65536), M = R - W * 65536, R = I + W + 65535, W = Math.floor(R / 65536), I = R - W * 65536, R = q + W + 65535, W = Math.floor(R / 65536), q = R - W * 65536, R = ce + W + 65535, W = Math.floor(R / 65536), ce = R - W * 65536, J += W - 1 + 37 * (W - 1), W = 1, R = J + W + 65535, W = Math.floor(R / 65536), J = R - W * 65536, R = ne + W + 65535, W = Math.floor(R / 65536), ne = R - W * 65536, R = K + W + 65535, W = Math.floor(R / 65536), K = R - W * 65536, R = E + W + 65535, W = Math.floor(R / 65536), E = R - W * 65536, R = b + W + 65535, W = Math.floor(R / 65536), b = R - W * 65536, R = l + W + 65535, W = Math.floor(R / 65536), l = R - W * 65536, R = p + W + 65535, W = Math.floor(R / 65536), p = R - W * 65536, R = m + W + 65535, W = Math.floor(R / 65536), m = R - W * 65536, R = w + W + 65535, W = Math.floor(R / 65536), w = R - W * 65536, R = P + W + 65535, W = Math.floor(R / 65536), P = R - W * 65536, R = _ + W + 65535, W = Math.floor(R / 65536), _ = R - W * 65536, R = y + W + 65535, W = Math.floor(R / 65536), y = R - W * 65536, R = M + W + 65535, W = Math.floor(R / 65536), M = R - W * 65536, R = I + W + 65535, W = Math.floor(R / 65536), I = R - W * 65536, R = q + W + 65535, W = Math.floor(R / 65536), q = R - W * 65536, R = ce + W + 65535, W = Math.floor(R / 65536), ce = R - W * 65536, J += W - 1 + 37 * (W - 1), k[0] = J, k[1] = ne, k[2] = K, k[3] = E, k[4] = b, k[5] = l, k[6] = p, k[7] = m, k[8] = w, k[9] = P, k[10] = _, k[11] = y, k[12] = M, k[13] = I, k[14] = q, k[15] = ce; + R = $[0], J += R * $e, ne += R * Me, K += R * Oe, E += R * ze, b += R * De, l += R * je, p += R * Ue, m += R * _e, w += R * Ze, P += R * ot, _ += R * ke, y += R * rt, M += R * nt, I += R * Ge, q += R * ht, ce += R * lt, R = $[1], ne += R * $e, K += R * Me, E += R * Oe, b += R * ze, l += R * De, p += R * je, m += R * Ue, w += R * _e, P += R * Ze, _ += R * ot, y += R * ke, M += R * rt, I += R * nt, q += R * Ge, ce += R * ht, L += R * lt, R = $[2], K += R * $e, E += R * Me, b += R * Oe, l += R * ze, p += R * De, m += R * je, w += R * Ue, P += R * _e, _ += R * Ze, y += R * ot, M += R * ke, I += R * rt, q += R * nt, ce += R * Ge, L += R * ht, oe += R * lt, R = $[3], E += R * $e, b += R * Me, l += R * Oe, p += R * ze, m += R * De, w += R * je, P += R * Ue, _ += R * _e, y += R * Ze, M += R * ot, I += R * ke, q += R * rt, ce += R * nt, L += R * Ge, oe += R * ht, Q += R * lt, R = $[4], b += R * $e, l += R * Me, p += R * Oe, m += R * ze, w += R * De, P += R * je, _ += R * Ue, y += R * _e, M += R * Ze, I += R * ot, q += R * ke, ce += R * rt, L += R * nt, oe += R * Ge, Q += R * ht, X += R * lt, R = $[5], l += R * $e, p += R * Me, m += R * Oe, w += R * ze, P += R * De, _ += R * je, y += R * Ue, M += R * _e, I += R * Ze, q += R * ot, ce += R * ke, L += R * rt, oe += R * nt, Q += R * Ge, X += R * ht, ee += R * lt, R = $[6], p += R * $e, m += R * Me, w += R * Oe, P += R * ze, _ += R * De, y += R * je, M += R * Ue, I += R * _e, q += R * Ze, ce += R * ot, L += R * ke, oe += R * rt, Q += R * nt, X += R * Ge, ee += R * ht, O += R * lt, R = $[7], m += R * $e, w += R * Me, P += R * Oe, _ += R * ze, y += R * De, M += R * je, I += R * Ue, q += R * _e, ce += R * Ze, L += R * ot, oe += R * ke, Q += R * rt, X += R * nt, ee += R * Ge, O += R * ht, Z += R * lt, R = $[8], w += R * $e, P += R * Me, _ += R * Oe, y += R * ze, M += R * De, I += R * je, q += R * Ue, ce += R * _e, L += R * Ze, oe += R * ot, Q += R * ke, X += R * rt, ee += R * nt, O += R * Ge, Z += R * ht, re += R * lt, R = $[9], P += R * $e, _ += R * Me, y += R * Oe, M += R * ze, I += R * De, q += R * je, ce += R * Ue, L += R * _e, oe += R * Ze, Q += R * ot, X += R * ke, ee += R * rt, O += R * nt, Z += R * Ge, re += R * ht, he += R * lt, R = $[10], _ += R * $e, y += R * Me, M += R * Oe, I += R * ze, q += R * De, ce += R * je, L += R * Ue, oe += R * _e, Q += R * Ze, X += R * ot, ee += R * ke, O += R * rt, Z += R * nt, re += R * Ge, he += R * ht, ae += R * lt, R = $[11], y += R * $e, M += R * Me, I += R * Oe, q += R * ze, ce += R * De, L += R * je, oe += R * Ue, Q += R * _e, X += R * Ze, ee += R * ot, O += R * ke, Z += R * rt, re += R * nt, he += R * Ge, ae += R * ht, fe += R * lt, R = $[12], M += R * $e, I += R * Me, q += R * Oe, ce += R * ze, L += R * De, oe += R * je, Q += R * Ue, X += R * _e, ee += R * Ze, O += R * ot, Z += R * ke, re += R * rt, he += R * nt, ae += R * Ge, fe += R * ht, be += R * lt, R = $[13], I += R * $e, q += R * Me, ce += R * Oe, L += R * ze, oe += R * De, Q += R * je, X += R * Ue, ee += R * _e, O += R * Ze, Z += R * ot, re += R * ke, he += R * rt, ae += R * nt, fe += R * Ge, be += R * ht, Ae += R * lt, R = $[14], q += R * $e, ce += R * Me, L += R * Oe, oe += R * ze, Q += R * De, X += R * je, ee += R * Ue, O += R * _e, Z += R * Ze, re += R * ot, he += R * ke, ae += R * rt, fe += R * nt, be += R * Ge, Ae += R * ht, Te += R * lt, R = $[15], ce += R * $e, L += R * Me, oe += R * Oe, Q += R * ze, X += R * De, ee += R * je, O += R * Ue, Z += R * _e, re += R * Ze, he += R * ot, ae += R * ke, fe += R * rt, be += R * nt, Ae += R * Ge, Te += R * ht, Re += R * lt, J += 38 * L, ne += 38 * oe, K += 38 * Q, E += 38 * X, b += 38 * ee, l += 38 * O, p += 38 * Z, m += 38 * re, w += 38 * he, P += 38 * ae, _ += 38 * fe, y += 38 * be, M += 38 * Ae, I += 38 * Te, q += 38 * Re, W = 1, R = J + W + 65535, W = Math.floor(R / 65536), J = R - W * 65536, R = ne + W + 65535, W = Math.floor(R / 65536), ne = R - W * 65536, R = K + W + 65535, W = Math.floor(R / 65536), K = R - W * 65536, R = E + W + 65535, W = Math.floor(R / 65536), E = R - W * 65536, R = b + W + 65535, W = Math.floor(R / 65536), b = R - W * 65536, R = l + W + 65535, W = Math.floor(R / 65536), l = R - W * 65536, R = p + W + 65535, W = Math.floor(R / 65536), p = R - W * 65536, R = m + W + 65535, W = Math.floor(R / 65536), m = R - W * 65536, R = w + W + 65535, W = Math.floor(R / 65536), w = R - W * 65536, R = P + W + 65535, W = Math.floor(R / 65536), P = R - W * 65536, R = _ + W + 65535, W = Math.floor(R / 65536), _ = R - W * 65536, R = y + W + 65535, W = Math.floor(R / 65536), y = R - W * 65536, R = M + W + 65535, W = Math.floor(R / 65536), M = R - W * 65536, R = I + W + 65535, W = Math.floor(R / 65536), I = R - W * 65536, R = q + W + 65535, W = Math.floor(R / 65536), q = R - W * 65536, R = ce + W + 65535, W = Math.floor(R / 65536), ce = R - W * 65536, J += W - 1 + 37 * (W - 1), W = 1, R = J + W + 65535, W = Math.floor(R / 65536), J = R - W * 65536, R = ne + W + 65535, W = Math.floor(R / 65536), ne = R - W * 65536, R = K + W + 65535, W = Math.floor(R / 65536), K = R - W * 65536, R = E + W + 65535, W = Math.floor(R / 65536), E = R - W * 65536, R = b + W + 65535, W = Math.floor(R / 65536), b = R - W * 65536, R = l + W + 65535, W = Math.floor(R / 65536), l = R - W * 65536, R = p + W + 65535, W = Math.floor(R / 65536), p = R - W * 65536, R = m + W + 65535, W = Math.floor(R / 65536), m = R - W * 65536, R = w + W + 65535, W = Math.floor(R / 65536), w = R - W * 65536, R = P + W + 65535, W = Math.floor(R / 65536), P = R - W * 65536, R = _ + W + 65535, W = Math.floor(R / 65536), _ = R - W * 65536, R = y + W + 65535, W = Math.floor(R / 65536), y = R - W * 65536, R = M + W + 65535, W = Math.floor(R / 65536), M = R - W * 65536, R = I + W + 65535, W = Math.floor(R / 65536), I = R - W * 65536, R = q + W + 65535, W = Math.floor(R / 65536), q = R - W * 65536, R = ce + W + 65535, W = Math.floor(R / 65536), ce = R - W * 65536, J += W - 1 + 37 * (W - 1), B[0] = J, B[1] = ne, B[2] = K, B[3] = E, B[4] = b, B[5] = l, B[6] = p, B[7] = m, B[8] = w, B[9] = P, B[10] = _, B[11] = y, B[12] = M, B[13] = I, B[14] = q, B[15] = ce; } - function x(k, B) { - v(k, B, B); + function x(B, $) { + v(B, $, $); } - function S(k, B) { + function S(B, $) { const U = n(); for (let R = 0; R < 16; R++) - U[R] = B[R]; + U[R] = $[R]; for (let R = 253; R >= 0; R--) - x(U, U), R !== 2 && R !== 4 && v(U, U, B); + x(U, U), R !== 2 && R !== 4 && v(U, U, $); for (let R = 0; R < 16; R++) - k[R] = U[R]; + B[R] = U[R]; } - function C(k, B) { + function C(B, $) { const U = new Uint8Array(32), R = new Float64Array(80), W = n(), J = n(), ne = n(), K = n(), E = n(), b = n(); for (let w = 0; w < 31; w++) - U[w] = k[w]; - U[31] = k[31] & 127 | 64, U[0] &= 248, u(R, B); + U[w] = B[w]; + U[31] = B[31] & 127 | 64, U[0] &= 248, u(R, $); for (let w = 0; w < 16; w++) J[w] = R[w]; W[0] = K[0] = 1; @@ -13659,31 +13659,31 @@ function iF() { return f(m, p), m; } t.scalarMult = C; - function D(k) { - return C(k, i); + function D(B) { + return C(B, i); } t.scalarMultBase = D; - function $(k) { - if (k.length !== t.SECRET_KEY_LENGTH) + function k(B) { + if (B.length !== t.SECRET_KEY_LENGTH) throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`); - const B = new Uint8Array(k); + const $ = new Uint8Array(B); return { - publicKey: D(B), - secretKey: B + publicKey: D($), + secretKey: $ }; } - t.generateKeyPairFromSeed = $; - function N(k) { - const B = (0, e.randomBytes)(32, k), U = $(B); - return (0, r.wipe)(B), U; + t.generateKeyPairFromSeed = k; + function N(B) { + const $ = (0, e.randomBytes)(32, B), U = k($); + return (0, r.wipe)($), U; } t.generateKeyPair = N; - function z(k, B, U = !1) { - if (k.length !== t.PUBLIC_KEY_LENGTH) - throw new Error("X25519: incorrect secret key length"); + function z(B, $, U = !1) { if (B.length !== t.PUBLIC_KEY_LENGTH) + throw new Error("X25519: incorrect secret key length"); + if ($.length !== t.PUBLIC_KEY_LENGTH) throw new Error("X25519: incorrect public key length"); - const R = C(k, B); + const R = C(B, $); if (U) { let W = 0; for (let J = 0; J < R.length; J++) @@ -14188,13 +14188,13 @@ function go() { } return l !== 0 ? b.words[m] = l : b.length--, b.strip(); } - function $(K, E, b) { + function k(K, E, b) { var l = new N(); return l.mulp(K, E, b); } s.prototype.mulTo = function(E, b) { var l, p = this.length + E.length; - return this.length === 10 && E.length === 10 ? l = C(this, E, b) : p < 63 ? l = S(this, E, b) : p < 1024 ? l = D(this, E, b) : l = $(this, E, b), l; + return this.length === 10 && E.length === 10 ? l = C(this, E, b) : p < 63 ? l = S(this, E, b) : p < 1024 ? l = D(this, E, b) : l = k(this, E, b), l; }; function N(K, E) { this.x = K, this.y = E; @@ -14259,7 +14259,7 @@ function go() { return b.words = new Array(this.length + E.length), this.mulTo(E, b); }, s.prototype.mulf = function(E) { var b = new s(null); - return b.words = new Array(this.length + E.length), $(this, E, b); + return b.words = new Array(this.length + E.length), k(this, E, b); }, s.prototype.imul = function(E) { return this.clone().mulTo(E, this); }, s.prototype.imuln = function(E) { @@ -14642,32 +14642,32 @@ function go() { p192: null, p25519: null }; - function k(K, E) { + function B(K, E) { this.name = K, this.p = new s(E, 16), this.n = this.p.bitLength(), this.k = new s(1).iushln(this.n).isub(this.p), this.tmp = this._tmp(); } - k.prototype._tmp = function() { + B.prototype._tmp = function() { var E = new s(null); return E.words = new Array(Math.ceil(this.n / 13)), E; - }, k.prototype.ireduce = function(E) { + }, B.prototype.ireduce = function(E) { var b = E, l; do this.split(b, this.tmp), b = this.imulK(b), b = b.iadd(this.tmp), l = b.bitLength(); while (l > this.n); var p = l < this.n ? -1 : b.ucmp(this.p); return p === 0 ? (b.words[0] = 0, b.length = 1) : p > 0 ? b.isub(this.p) : b.strip !== void 0 ? b.strip() : b._strip(), b; - }, k.prototype.split = function(E, b) { + }, B.prototype.split = function(E, b) { E.iushrn(this.n, 0, b); - }, k.prototype.imulK = function(E) { + }, B.prototype.imulK = function(E) { return E.imul(this.k); }; - function B() { - k.call( + function $() { + B.call( this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f" ); } - i(B, k), B.prototype.split = function(E, b) { + i($, B), $.prototype.split = function(E, b) { for (var l = 4194303, p = Math.min(E.length, 9), m = 0; m < p; m++) b.words[m] = E.words[m]; if (b.length = p, E.length <= 9) { @@ -14680,7 +14680,7 @@ function go() { E.words[m - 10] = (P & l) << 4 | w >>> 22, w = P; } w >>>= 22, E.words[m - 10] = w, w === 0 && E.length > 10 ? E.length -= 10 : E.length -= 9; - }, B.prototype.imulK = function(E) { + }, $.prototype.imulK = function(E) { E.words[E.length] = 0, E.words[E.length + 1] = 0, E.length += 2; for (var b = 0, l = 0; l < E.length; l++) { var p = E.words[l] | 0; @@ -14689,29 +14689,29 @@ function go() { return E.words[E.length - 1] === 0 && (E.length--, E.words[E.length - 1] === 0 && E.length--), E; }; function U() { - k.call( + B.call( this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001" ); } - i(U, k); + i(U, B); function R() { - k.call( + B.call( this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff" ); } - i(R, k); + i(R, B); function W() { - k.call( + B.call( this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed" ); } - i(W, k), W.prototype.imulK = function(E) { + i(W, B), W.prototype.imulK = function(E) { for (var b = 0, l = 0; l < E.length; l++) { var p = (E.words[l] | 0) * 19 + b, m = p & 67108863; p >>>= 26, E.words[l] = m, b = p; @@ -14721,7 +14721,7 @@ function go() { if (z[E]) return z[E]; var b; if (E === "k256") - b = new B(); + b = new $(); else if (E === "p224") b = new U(); else if (E === "p192") @@ -14905,8 +14905,8 @@ function Gi() { x[S] = 0; var C = 1 << g + 1, D = h.clone(); for (S = 0; S < x.length; S++) { - var $, N = D.andln(C - 1); - D.isOdd() ? (N > (C >> 1) - 1 ? $ = (C >> 1) - N : $ = N, D.isubn($)) : $ = 0, x[S] = $, D.iushrn(1); + var k, N = D.andln(C - 1); + D.isOdd() ? (N > (C >> 1) - 1 ? k = (C >> 1) - N : k = N, D.isubn(k)) : k = 0, x[S] = k, D.iushrn(1); } return x; } @@ -14918,12 +14918,12 @@ function Gi() { ]; h = h.clone(), g = g.clone(); for (var x = 0, S = 0, C; h.cmpn(-x) > 0 || g.cmpn(-S) > 0; ) { - var D = h.andln(3) + x & 3, $ = g.andln(3) + S & 3; - D === 3 && (D = -1), $ === 3 && ($ = -1); + var D = h.andln(3) + x & 3, k = g.andln(3) + S & 3; + D === 3 && (D = -1), k === 3 && (k = -1); var N; - (D & 1) === 0 ? N = 0 : (C = h.andln(7) + x & 7, (C === 3 || C === 5) && $ === 2 ? N = -D : N = D), v[0].push(N); + (D & 1) === 0 ? N = 0 : (C = h.andln(7) + x & 7, (C === 3 || C === 5) && k === 2 ? N = -D : N = D), v[0].push(N); var z; - ($ & 1) === 0 ? z = 0 : (C = g.andln(7) + S & 7, (C === 3 || C === 5) && D === 2 ? z = -$ : z = $), v[1].push(z), 2 * x === N + 1 && (x = 1 - x), 2 * S === z + 1 && (S = 1 - S), h.iushrn(1), g.iushrn(1); + (k & 1) === 0 ? z = 0 : (C = g.andln(7) + S & 7, (C === 3 || C === 5) && D === 2 ? z = -k : z = k), v[1].push(z), 2 * x === N + 1 && (x = 1 - x), 2 * S === z + 1 && (S = 1 - S), h.iushrn(1), g.iushrn(1); } return v; } @@ -15011,12 +15011,12 @@ function t0() { C = (C << 1) + g[D]; x.push(C); } - for (var $ = this.jpoint(null, null, null), N = this.jpoint(null, null, null), z = v; z > 0; z--) { + for (var k = this.jpoint(null, null, null), N = this.jpoint(null, null, null), z = v; z > 0; z--) { for (S = 0; S < x.length; S++) C = x[S], C === z ? N = N.mixedAdd(h.points[S]) : C === -z && (N = N.mixedAdd(h.points[S].neg())); - $ = $.add(N); + k = k.add(N); } - return $.toP(); + return k.toP(); }, s.prototype._wnafMul = function(f, u) { var h = 4, g = f._getNAFPoints(h); h = g.wnd; @@ -15025,25 +15025,25 @@ function t0() { D++; if (C >= 0 && D++, S = S.dblp(D), C < 0) break; - var $ = x[C]; - i($ !== 0), f.type === "affine" ? $ > 0 ? S = S.mixedAdd(v[$ - 1 >> 1]) : S = S.mixedAdd(v[-$ - 1 >> 1].neg()) : $ > 0 ? S = S.add(v[$ - 1 >> 1]) : S = S.add(v[-$ - 1 >> 1].neg()); + var k = x[C]; + i(k !== 0), f.type === "affine" ? k > 0 ? S = S.mixedAdd(v[k - 1 >> 1]) : S = S.mixedAdd(v[-k - 1 >> 1].neg()) : k > 0 ? S = S.add(v[k - 1 >> 1]) : S = S.add(v[-k - 1 >> 1].neg()); } return f.type === "affine" ? S.toP() : S; }, s.prototype._wnafMulAdd = function(f, u, h, g, v) { - var x = this._wnafT1, S = this._wnafT2, C = this._wnafT3, D = 0, $, N, z; - for ($ = 0; $ < g; $++) { - z = u[$]; - var k = z._getNAFPoints(f); - x[$] = k.wnd, S[$] = k.points; - } - for ($ = g - 1; $ >= 1; $ -= 2) { - var B = $ - 1, U = $; - if (x[B] !== 1 || x[U] !== 1) { - C[B] = r(h[B], x[B], this._bitLength), C[U] = r(h[U], x[U], this._bitLength), D = Math.max(C[B].length, D), D = Math.max(C[U].length, D); + var x = this._wnafT1, S = this._wnafT2, C = this._wnafT3, D = 0, k, N, z; + for (k = 0; k < g; k++) { + z = u[k]; + var B = z._getNAFPoints(f); + x[k] = B.wnd, S[k] = B.points; + } + for (k = g - 1; k >= 1; k -= 2) { + var $ = k - 1, U = k; + if (x[$] !== 1 || x[U] !== 1) { + C[$] = r(h[$], x[$], this._bitLength), C[U] = r(h[U], x[U], this._bitLength), D = Math.max(C[$].length, D), D = Math.max(C[U].length, D); continue; } var R = [ - u[B], + u[$], /* 1 */ null, /* 3 */ @@ -15052,7 +15052,7 @@ function t0() { u[U] /* 7 */ ]; - u[B].y.cmp(u[U].y) === 0 ? (R[1] = u[B].add(u[U]), R[2] = u[B].toJ().mixedAdd(u[U].neg())) : u[B].y.cmp(u[U].y.redNeg()) === 0 ? (R[1] = u[B].toJ().mixedAdd(u[U]), R[2] = u[B].add(u[U].neg())) : (R[1] = u[B].toJ().mixedAdd(u[U]), R[2] = u[B].toJ().mixedAdd(u[U].neg())); + u[$].y.cmp(u[U].y) === 0 ? (R[1] = u[$].add(u[U]), R[2] = u[$].toJ().mixedAdd(u[U].neg())) : u[$].y.cmp(u[U].y.redNeg()) === 0 ? (R[1] = u[$].toJ().mixedAdd(u[U]), R[2] = u[$].add(u[U].neg())) : (R[1] = u[$].toJ().mixedAdd(u[U]), R[2] = u[$].toJ().mixedAdd(u[U].neg())); var W = [ -3, /* -1 -1 */ @@ -15072,31 +15072,31 @@ function t0() { /* 1 0 */ 3 /* 1 1 */ - ], J = n(h[B], h[U]); - for (D = Math.max(J[0].length, D), C[B] = new Array(D), C[U] = new Array(D), N = 0; N < D; N++) { + ], J = n(h[$], h[U]); + for (D = Math.max(J[0].length, D), C[$] = new Array(D), C[U] = new Array(D), N = 0; N < D; N++) { var ne = J[0][N] | 0, K = J[1][N] | 0; - C[B][N] = W[(ne + 1) * 3 + (K + 1)], C[U][N] = 0, S[B] = R; + C[$][N] = W[(ne + 1) * 3 + (K + 1)], C[U][N] = 0, S[$] = R; } } var E = this.jpoint(null, null, null), b = this._wnafT4; - for ($ = D; $ >= 0; $--) { - for (var l = 0; $ >= 0; ) { + for (k = D; k >= 0; k--) { + for (var l = 0; k >= 0; ) { var p = !0; for (N = 0; N < g; N++) - b[N] = C[N][$] | 0, b[N] !== 0 && (p = !1); + b[N] = C[N][k] | 0, b[N] !== 0 && (p = !1); if (!p) break; - l++, $--; + l++, k--; } - if ($ >= 0 && l++, E = E.dblp(l), $ < 0) + if (k >= 0 && l++, E = E.dblp(l), k < 0) break; for (N = 0; N < g; N++) { var m = b[N]; m !== 0 && (m > 0 ? z = S[N][m - 1 >> 1] : m < 0 && (z = S[N][-m - 1 >> 1].neg()), z.type === "affine" ? E = E.mixedAdd(z) : E = E.add(z)); } } - for ($ = 0; $ < g; $++) - S[$] = null; + for (k = 0; k < g; k++) + S[k] = null; return v ? E : E.toP(); }; function o(a, f) { @@ -15208,25 +15208,25 @@ function cF() { var h = u === this.p ? this.red : e.mont(u), g = new e(2).toRed(h).redInvm(), v = g.redNeg(), x = new e(3).toRed(h).redNeg().redSqrt().redMul(g), S = v.redAdd(x).fromRed(), C = v.redSub(x).fromRed(); return [S, C]; }, s.prototype._getEndoBasis = function(u) { - for (var h = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), g = u, v = this.n.clone(), x = new e(1), S = new e(0), C = new e(0), D = new e(1), $, N, z, k, B, U, R, W = 0, J, ne; g.cmpn(0) !== 0; ) { + for (var h = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), g = u, v = this.n.clone(), x = new e(1), S = new e(0), C = new e(0), D = new e(1), k, N, z, B, $, U, R, W = 0, J, ne; g.cmpn(0) !== 0; ) { var K = v.div(g); J = v.sub(K.mul(g)), ne = C.sub(K.mul(x)); var E = D.sub(K.mul(S)); if (!z && J.cmp(h) < 0) - $ = R.neg(), N = x, z = J.neg(), k = ne; + k = R.neg(), N = x, z = J.neg(), B = ne; else if (z && ++W === 2) break; R = J, v = g, g = J, C = x, x = ne, D = S, S = E; } - B = J.neg(), U = ne; - var b = z.sqr().add(k.sqr()), l = B.sqr().add(U.sqr()); - return l.cmp(b) >= 0 && (B = $, U = N), z.negative && (z = z.neg(), k = k.neg()), B.negative && (B = B.neg(), U = U.neg()), [ - { a: z, b: k }, - { a: B, b: U } + $ = J.neg(), U = ne; + var b = z.sqr().add(B.sqr()), l = $.sqr().add(U.sqr()); + return l.cmp(b) >= 0 && ($ = k, U = N), z.negative && (z = z.neg(), B = B.neg()), $.negative && ($ = $.neg(), U = U.neg()), [ + { a: z, b: B }, + { a: $, b: U } ]; }, s.prototype._endoSplit = function(u) { - var h = this.endo.basis, g = h[0], v = h[1], x = v.b.mul(u).divRound(this.n), S = g.b.neg().mul(u).divRound(this.n), C = x.mul(g.a), D = S.mul(v.a), $ = x.mul(g.b), N = S.mul(v.b), z = u.sub(C).sub(D), k = $.add(N).neg(); - return { k1: z, k2: k }; + var h = this.endo.basis, g = h[0], v = h[1], x = v.b.mul(u).divRound(this.n), S = g.b.neg().mul(u).divRound(this.n), C = x.mul(g.a), D = S.mul(v.a), k = x.mul(g.b), N = S.mul(v.b), z = u.sub(C).sub(D), B = k.add(N).neg(); + return { k1: z, k2: B }; }, s.prototype.pointFromX = function(u, h) { u = new e(u, 16), u.red || (u = u.toRed(this.red)); var g = u.redSqr().redMul(u).redIAdd(u.redMul(this.a)).redIAdd(this.b), v = g.redSqrt(); @@ -15241,8 +15241,8 @@ function cF() { return g.redSqr().redISub(x).cmpn(0) === 0; }, s.prototype._endoWnafMulAdd = function(u, h, g) { for (var v = this._endoWnafT1, x = this._endoWnafT2, S = 0; S < u.length; S++) { - var C = this._endoSplit(h[S]), D = u[S], $ = D._getBeta(); - C.k1.negative && (C.k1.ineg(), D = D.neg(!0)), C.k2.negative && (C.k2.ineg(), $ = $.neg(!0)), v[S * 2] = D, v[S * 2 + 1] = $, x[S * 2] = C.k1, x[S * 2 + 1] = C.k2; + var C = this._endoSplit(h[S]), D = u[S], k = D._getBeta(); + C.k1.negative && (C.k1.ineg(), D = D.neg(!0)), C.k2.negative && (C.k2.ineg(), k = k.neg(!0)), v[S * 2] = D, v[S * 2 + 1] = k, x[S * 2] = C.k1, x[S * 2 + 1] = C.k2; } for (var N = this._wnafMulAdd(1, v, x, S * 2, g), z = 0; z < S * 2; z++) v[z] = null, x[z] = null; @@ -15394,11 +15394,11 @@ function cF() { return u; if (u.isInfinity()) return this; - var h = u.z.redSqr(), g = this.z.redSqr(), v = this.x.redMul(h), x = u.x.redMul(g), S = this.y.redMul(h.redMul(u.z)), C = u.y.redMul(g.redMul(this.z)), D = v.redSub(x), $ = S.redSub(C); + var h = u.z.redSqr(), g = this.z.redSqr(), v = this.x.redMul(h), x = u.x.redMul(g), S = this.y.redMul(h.redMul(u.z)), C = u.y.redMul(g.redMul(this.z)), D = v.redSub(x), k = S.redSub(C); if (D.cmpn(0) === 0) - return $.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var N = D.redSqr(), z = N.redMul(D), k = v.redMul(N), B = $.redSqr().redIAdd(z).redISub(k).redISub(k), U = $.redMul(k.redISub(B)).redISub(S.redMul(z)), R = this.z.redMul(u.z).redMul(D); - return this.curve.jpoint(B, U, R); + return k.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); + var N = D.redSqr(), z = N.redMul(D), B = v.redMul(N), $ = k.redSqr().redIAdd(z).redISub(B).redISub(B), U = k.redMul(B.redISub($)).redISub(S.redMul(z)), R = this.z.redMul(u.z).redMul(D); + return this.curve.jpoint($, U, R); }, a.prototype.mixedAdd = function(u) { if (this.isInfinity()) return u.toJ(); @@ -15407,8 +15407,8 @@ function cF() { var h = this.z.redSqr(), g = this.x, v = u.x.redMul(h), x = this.y, S = u.y.redMul(h).redMul(this.z), C = g.redSub(v), D = x.redSub(S); if (C.cmpn(0) === 0) return D.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var $ = C.redSqr(), N = $.redMul(C), z = g.redMul($), k = D.redSqr().redIAdd(N).redISub(z).redISub(z), B = D.redMul(z.redISub(k)).redISub(x.redMul(N)), U = this.z.redMul(C); - return this.curve.jpoint(k, B, U); + var k = C.redSqr(), N = k.redMul(C), z = g.redMul(k), B = D.redSqr().redIAdd(N).redISub(z).redISub(z), $ = D.redMul(z.redISub(B)).redISub(x.redMul(N)), U = this.z.redMul(C); + return this.curve.jpoint(B, $, U); }, a.prototype.dblp = function(u) { if (u === 0) return this; @@ -15423,12 +15423,12 @@ function cF() { g = g.dbl(); return g; } - var v = this.curve.a, x = this.curve.tinv, S = this.x, C = this.y, D = this.z, $ = D.redSqr().redSqr(), N = C.redAdd(C); + var v = this.curve.a, x = this.curve.tinv, S = this.x, C = this.y, D = this.z, k = D.redSqr().redSqr(), N = C.redAdd(C); for (h = 0; h < u; h++) { - var z = S.redSqr(), k = N.redSqr(), B = k.redSqr(), U = z.redAdd(z).redIAdd(z).redIAdd(v.redMul($)), R = S.redMul(k), W = U.redSqr().redISub(R.redAdd(R)), J = R.redISub(W), ne = U.redMul(J); - ne = ne.redIAdd(ne).redISub(B); + var z = S.redSqr(), B = N.redSqr(), $ = B.redSqr(), U = z.redAdd(z).redIAdd(z).redIAdd(v.redMul(k)), R = S.redMul(B), W = U.redSqr().redISub(R.redAdd(R)), J = R.redISub(W), ne = U.redMul(J); + ne = ne.redIAdd(ne).redISub($); var K = N.redMul(D); - h + 1 < u && ($ = $.redMul(B)), S = W, D = K, N = ne; + h + 1 < u && (k = k.redMul($)), S = W, D = K, N = ne; } return this.curve.jpoint(S, N.redMul(x), D); }, a.prototype.dbl = function() { @@ -15438,12 +15438,12 @@ function cF() { if (this.zOne) { var v = this.x.redSqr(), x = this.y.redSqr(), S = x.redSqr(), C = this.x.redAdd(x).redSqr().redISub(v).redISub(S); C = C.redIAdd(C); - var D = v.redAdd(v).redIAdd(v), $ = D.redSqr().redISub(C).redISub(C), N = S.redIAdd(S); - N = N.redIAdd(N), N = N.redIAdd(N), u = $, h = D.redMul(C.redISub($)).redISub(N), g = this.y.redAdd(this.y); + var D = v.redAdd(v).redIAdd(v), k = D.redSqr().redISub(C).redISub(C), N = S.redIAdd(S); + N = N.redIAdd(N), N = N.redIAdd(N), u = k, h = D.redMul(C.redISub(k)).redISub(N), g = this.y.redAdd(this.y); } else { - var z = this.x.redSqr(), k = this.y.redSqr(), B = k.redSqr(), U = this.x.redAdd(k).redSqr().redISub(z).redISub(B); + var z = this.x.redSqr(), B = this.y.redSqr(), $ = B.redSqr(), U = this.x.redAdd(B).redSqr().redISub(z).redISub($); U = U.redIAdd(U); - var R = z.redAdd(z).redIAdd(z), W = R.redSqr(), J = B.redIAdd(B); + var R = z.redAdd(z).redIAdd(z), W = R.redSqr(), J = $.redIAdd($); J = J.redIAdd(J), J = J.redIAdd(J), u = W.redISub(U).redISub(U), h = R.redMul(U.redISub(u)).redISub(J), g = this.y.redMul(this.z), g = g.redIAdd(g); } return this.curve.jpoint(u, h, g); @@ -15452,43 +15452,43 @@ function cF() { if (this.zOne) { var v = this.x.redSqr(), x = this.y.redSqr(), S = x.redSqr(), C = this.x.redAdd(x).redSqr().redISub(v).redISub(S); C = C.redIAdd(C); - var D = v.redAdd(v).redIAdd(v).redIAdd(this.curve.a), $ = D.redSqr().redISub(C).redISub(C); - u = $; + var D = v.redAdd(v).redIAdd(v).redIAdd(this.curve.a), k = D.redSqr().redISub(C).redISub(C); + u = k; var N = S.redIAdd(S); - N = N.redIAdd(N), N = N.redIAdd(N), h = D.redMul(C.redISub($)).redISub(N), g = this.y.redAdd(this.y); + N = N.redIAdd(N), N = N.redIAdd(N), h = D.redMul(C.redISub(k)).redISub(N), g = this.y.redAdd(this.y); } else { - var z = this.z.redSqr(), k = this.y.redSqr(), B = this.x.redMul(k), U = this.x.redSub(z).redMul(this.x.redAdd(z)); + var z = this.z.redSqr(), B = this.y.redSqr(), $ = this.x.redMul(B), U = this.x.redSub(z).redMul(this.x.redAdd(z)); U = U.redAdd(U).redIAdd(U); - var R = B.redIAdd(B); + var R = $.redIAdd($); R = R.redIAdd(R); var W = R.redAdd(R); - u = U.redSqr().redISub(W), g = this.y.redAdd(this.z).redSqr().redISub(k).redISub(z); - var J = k.redSqr(); + u = U.redSqr().redISub(W), g = this.y.redAdd(this.z).redSqr().redISub(B).redISub(z); + var J = B.redSqr(); J = J.redIAdd(J), J = J.redIAdd(J), J = J.redIAdd(J), h = U.redMul(R.redISub(u)).redISub(J); } return this.curve.jpoint(u, h, g); }, a.prototype._dbl = function() { - var u = this.curve.a, h = this.x, g = this.y, v = this.z, x = v.redSqr().redSqr(), S = h.redSqr(), C = g.redSqr(), D = S.redAdd(S).redIAdd(S).redIAdd(u.redMul(x)), $ = h.redAdd(h); - $ = $.redIAdd($); - var N = $.redMul(C), z = D.redSqr().redISub(N.redAdd(N)), k = N.redISub(z), B = C.redSqr(); - B = B.redIAdd(B), B = B.redIAdd(B), B = B.redIAdd(B); - var U = D.redMul(k).redISub(B), R = g.redAdd(g).redMul(v); + var u = this.curve.a, h = this.x, g = this.y, v = this.z, x = v.redSqr().redSqr(), S = h.redSqr(), C = g.redSqr(), D = S.redAdd(S).redIAdd(S).redIAdd(u.redMul(x)), k = h.redAdd(h); + k = k.redIAdd(k); + var N = k.redMul(C), z = D.redSqr().redISub(N.redAdd(N)), B = N.redISub(z), $ = C.redSqr(); + $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($); + var U = D.redMul(B).redISub($), R = g.redAdd(g).redMul(v); return this.curve.jpoint(z, U, R); }, a.prototype.trpl = function() { if (!this.curve.zeroA) return this.dbl().add(this); var u = this.x.redSqr(), h = this.y.redSqr(), g = this.z.redSqr(), v = h.redSqr(), x = u.redAdd(u).redIAdd(u), S = x.redSqr(), C = this.x.redAdd(h).redSqr().redISub(u).redISub(v); C = C.redIAdd(C), C = C.redAdd(C).redIAdd(C), C = C.redISub(S); - var D = C.redSqr(), $ = v.redIAdd(v); - $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($); - var N = x.redIAdd(C).redSqr().redISub(S).redISub(D).redISub($), z = h.redMul(N); + var D = C.redSqr(), k = v.redIAdd(v); + k = k.redIAdd(k), k = k.redIAdd(k), k = k.redIAdd(k); + var N = x.redIAdd(C).redSqr().redISub(S).redISub(D).redISub(k), z = h.redMul(N); z = z.redIAdd(z), z = z.redIAdd(z); - var k = this.x.redMul(D).redISub(z); - k = k.redIAdd(k), k = k.redIAdd(k); - var B = this.y.redMul(N.redMul($.redISub(N)).redISub(C.redMul(D))); - B = B.redIAdd(B), B = B.redIAdd(B), B = B.redIAdd(B); + var B = this.x.redMul(D).redISub(z); + B = B.redIAdd(B), B = B.redIAdd(B); + var $ = this.y.redMul(N.redMul(k.redISub(N)).redISub(C.redMul(D))); + $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($); var U = this.z.redAdd(C).redSqr().redISub(g).redISub(D); - return this.curve.jpoint(k, B, U); + return this.curve.jpoint(B, $, U); }, a.prototype.mul = function(u, h) { return u = new e(u, h), this.curve._wnafMul(this, u); }, a.prototype.eq = function(u) { @@ -15629,25 +15629,25 @@ function fF() { }, o.prototype._extDbl = function() { var f = this.x.redSqr(), u = this.y.redSqr(), h = this.z.redSqr(); h = h.redIAdd(h); - var g = this.curve._mulA(f), v = this.x.redAdd(this.y).redSqr().redISub(f).redISub(u), x = g.redAdd(u), S = x.redSub(h), C = g.redSub(u), D = v.redMul(S), $ = x.redMul(C), N = v.redMul(C), z = S.redMul(x); - return this.curve.point(D, $, z, N); + var g = this.curve._mulA(f), v = this.x.redAdd(this.y).redSqr().redISub(f).redISub(u), x = g.redAdd(u), S = x.redSub(h), C = g.redSub(u), D = v.redMul(S), k = x.redMul(C), N = v.redMul(C), z = S.redMul(x); + return this.curve.point(D, k, z, N); }, o.prototype._projDbl = function() { var f = this.x.redAdd(this.y).redSqr(), u = this.x.redSqr(), h = this.y.redSqr(), g, v, x, S, C, D; if (this.curve.twisted) { S = this.curve._mulA(u); - var $ = S.redAdd(h); - this.zOne ? (g = f.redSub(u).redSub(h).redMul($.redSub(this.curve.two)), v = $.redMul(S.redSub(h)), x = $.redSqr().redSub($).redSub($)) : (C = this.z.redSqr(), D = $.redSub(C).redISub(C), g = f.redSub(u).redISub(h).redMul(D), v = $.redMul(S.redSub(h)), x = $.redMul(D)); + var k = S.redAdd(h); + this.zOne ? (g = f.redSub(u).redSub(h).redMul(k.redSub(this.curve.two)), v = k.redMul(S.redSub(h)), x = k.redSqr().redSub(k).redSub(k)) : (C = this.z.redSqr(), D = k.redSub(C).redISub(C), g = f.redSub(u).redISub(h).redMul(D), v = k.redMul(S.redSub(h)), x = k.redMul(D)); } else S = u.redAdd(h), C = this.curve._mulC(this.z).redSqr(), D = S.redSub(C).redSub(C), g = this.curve._mulC(f.redISub(S)).redMul(D), v = this.curve._mulC(S).redMul(u.redISub(h)), x = S.redMul(D); return this.curve.point(g, v, x); }, o.prototype.dbl = function() { return this.isInfinity() ? this : this.curve.extended ? this._extDbl() : this._projDbl(); }, o.prototype._extAdd = function(f) { - var u = this.y.redSub(this.x).redMul(f.y.redSub(f.x)), h = this.y.redAdd(this.x).redMul(f.y.redAdd(f.x)), g = this.t.redMul(this.curve.dd).redMul(f.t), v = this.z.redMul(f.z.redAdd(f.z)), x = h.redSub(u), S = v.redSub(g), C = v.redAdd(g), D = h.redAdd(u), $ = x.redMul(S), N = C.redMul(D), z = x.redMul(D), k = S.redMul(C); - return this.curve.point($, N, k, z); + var u = this.y.redSub(this.x).redMul(f.y.redSub(f.x)), h = this.y.redAdd(this.x).redMul(f.y.redAdd(f.x)), g = this.t.redMul(this.curve.dd).redMul(f.t), v = this.z.redMul(f.z.redAdd(f.z)), x = h.redSub(u), S = v.redSub(g), C = v.redAdd(g), D = h.redAdd(u), k = x.redMul(S), N = C.redMul(D), z = x.redMul(D), B = S.redMul(C); + return this.curve.point(k, N, B, z); }, o.prototype._projAdd = function(f) { - var u = this.z.redMul(f.z), h = u.redSqr(), g = this.x.redMul(f.x), v = this.y.redMul(f.y), x = this.curve.d.redMul(g).redMul(v), S = h.redSub(x), C = h.redAdd(x), D = this.x.redAdd(this.y).redMul(f.x.redAdd(f.y)).redISub(g).redISub(v), $ = u.redMul(S).redMul(D), N, z; - return this.curve.twisted ? (N = u.redMul(C).redMul(v.redSub(this.curve._mulA(g))), z = S.redMul(C)) : (N = u.redMul(C).redMul(v.redSub(g)), z = this.curve._mulC(S).redMul(C)), this.curve.point($, N, z); + var u = this.z.redMul(f.z), h = u.redSqr(), g = this.x.redMul(f.x), v = this.y.redMul(f.y), x = this.curve.d.redMul(g).redMul(v), S = h.redSub(x), C = h.redAdd(x), D = this.x.redAdd(this.y).redMul(f.x.redAdd(f.y)).redISub(g).redISub(v), k = u.redMul(S).redMul(D), N, z; + return this.curve.twisted ? (N = u.redMul(C).redMul(v.redSub(this.curve._mulA(g))), z = S.redMul(C)) : (N = u.redMul(C).redMul(v.redSub(g)), z = this.curve._mulC(S).redMul(C)), this.curve.point(k, N, z); }, o.prototype.add = function(f) { return this.isInfinity() ? f : f.isInfinity() ? this : this.curve.extended ? this._extAdd(f) : this._projAdd(f); }, o.prototype.mul = function(f) { @@ -16841,22 +16841,22 @@ function gF() { return C > 0 && (h = h.ushrn(C)), !g && h.cmp(this.n) >= 0 ? h.sub(this.n) : h; }, f.prototype.sign = function(h, g, v, x) { typeof v == "object" && (x = v, v = null), x || (x = {}), g = this.keyFromPrivate(g, v), h = this._truncateToN(h, !1, x.msgBitLength); - for (var S = this.n.byteLength(), C = g.getPrivate().toArray("be", S), D = h.toArray("be", S), $ = new e({ + for (var S = this.n.byteLength(), C = g.getPrivate().toArray("be", S), D = h.toArray("be", S), k = new e({ hash: this.hash, entropy: C, nonce: D, pers: x.pers, persEnc: x.persEnc || "utf8" }), N = this.n.sub(new t(1)), z = 0; ; z++) { - var k = x.k ? x.k(z) : new t($.generate(this.n.byteLength())); - if (k = this._truncateToN(k, !0), !(k.cmpn(1) <= 0 || k.cmp(N) >= 0)) { - var B = this.g.mul(k); - if (!B.isInfinity()) { - var U = B.getX(), R = U.umod(this.n); + var B = x.k ? x.k(z) : new t(k.generate(this.n.byteLength())); + if (B = this._truncateToN(B, !0), !(B.cmpn(1) <= 0 || B.cmp(N) >= 0)) { + var $ = this.g.mul(B); + if (!$.isInfinity()) { + var U = $.getX(), R = U.umod(this.n); if (R.cmpn(0) !== 0) { - var W = k.invm(this.n).mul(R.mul(g.getPrivate()).iadd(h)); + var W = B.invm(this.n).mul(R.mul(g.getPrivate()).iadd(h)); if (W = W.umod(this.n), W.cmpn(0) !== 0) { - var J = (B.getY().isOdd() ? 1 : 0) | (U.cmp(R) !== 0 ? 2 : 0); + var J = ($.getY().isOdd() ? 1 : 0) | (U.cmp(R) !== 0 ? 2 : 0); return x.canonical && W.cmp(this.nh) > 0 && (W = this.n.sub(W), J ^= 1), new a({ r: R, s: W, recoveryParam: J }); } } @@ -16868,16 +16868,16 @@ function gF() { var C = g.r, D = g.s; if (C.cmpn(1) < 0 || C.cmp(this.n) >= 0 || D.cmpn(1) < 0 || D.cmp(this.n) >= 0) return !1; - var $ = D.invm(this.n), N = $.mul(h).umod(this.n), z = $.mul(C).umod(this.n), k; - return this.curve._maxwellTrick ? (k = this.g.jmulAdd(N, v.getPublic(), z), k.isInfinity() ? !1 : k.eqXToP(C)) : (k = this.g.mulAdd(N, v.getPublic(), z), k.isInfinity() ? !1 : k.getX().umod(this.n).cmp(C) === 0); + var k = D.invm(this.n), N = k.mul(h).umod(this.n), z = k.mul(C).umod(this.n), B; + return this.curve._maxwellTrick ? (B = this.g.jmulAdd(N, v.getPublic(), z), B.isInfinity() ? !1 : B.eqXToP(C)) : (B = this.g.mulAdd(N, v.getPublic(), z), B.isInfinity() ? !1 : B.getX().umod(this.n).cmp(C) === 0); }, f.prototype.recoverPubKey = function(u, h, g, v) { s((3 & g) === g, "The recovery param is more than two bits"), h = new a(h, v); - var x = this.n, S = new t(u), C = h.r, D = h.s, $ = g & 1, N = g >> 1; + var x = this.n, S = new t(u), C = h.r, D = h.s, k = g & 1, N = g >> 1; if (C.cmp(this.curve.p.umod(this.curve.n)) >= 0 && N) throw new Error("Unable to find sencond key candinate"); - N ? C = this.curve.pointFromX(C.add(this.curve.n), $) : C = this.curve.pointFromX(C, $); - var z = h.r.invm(x), k = x.sub(S).mul(z).umod(x), B = D.mul(z).umod(x); - return this.g.mulAdd(k, C, B); + N ? C = this.curve.pointFromX(C.add(this.curve.n), k) : C = this.curve.pointFromX(C, k); + var z = h.r.invm(x), B = x.sub(S).mul(z).umod(x), $ = D.mul(z).umod(x); + return this.g.mulAdd(B, C, $); }, f.prototype.getKeyRecoveryParam = function(u, h, g, v) { if (h = new a(h, v), h.recoveryParam !== null) return h.recoveryParam; @@ -18137,8 +18137,8 @@ Yu.exports; var A3; function LU() { return A3 || (A3 = 1, (function(t, e) { - var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", f = "[object Array]", u = "[object AsyncFunction]", h = "[object Boolean]", g = "[object Date]", v = "[object Error]", x = "[object Function]", S = "[object GeneratorFunction]", C = "[object Map]", D = "[object Number]", $ = "[object Null]", N = "[object Object]", z = "[object Promise]", k = "[object Proxy]", B = "[object RegExp]", U = "[object Set]", R = "[object String]", W = "[object Symbol]", J = "[object Undefined]", ne = "[object WeakMap]", K = "[object ArrayBuffer]", E = "[object DataView]", b = "[object Float32Array]", l = "[object Float64Array]", p = "[object Int8Array]", m = "[object Int16Array]", w = "[object Int32Array]", P = "[object Uint8Array]", _ = "[object Uint8ClampedArray]", y = "[object Uint16Array]", M = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, q = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, L = {}; - L[b] = L[l] = L[p] = L[m] = L[w] = L[P] = L[_] = L[y] = L[M] = !0, L[a] = L[f] = L[K] = L[h] = L[E] = L[g] = L[v] = L[x] = L[C] = L[D] = L[N] = L[B] = L[U] = L[R] = L[ne] = !1; + var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", f = "[object Array]", u = "[object AsyncFunction]", h = "[object Boolean]", g = "[object Date]", v = "[object Error]", x = "[object Function]", S = "[object GeneratorFunction]", C = "[object Map]", D = "[object Number]", k = "[object Null]", N = "[object Object]", z = "[object Promise]", B = "[object Proxy]", $ = "[object RegExp]", U = "[object Set]", R = "[object String]", W = "[object Symbol]", J = "[object Undefined]", ne = "[object WeakMap]", K = "[object ArrayBuffer]", E = "[object DataView]", b = "[object Float32Array]", l = "[object Float64Array]", p = "[object Int8Array]", m = "[object Int16Array]", w = "[object Int32Array]", P = "[object Uint8Array]", _ = "[object Uint8ClampedArray]", y = "[object Uint16Array]", M = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, q = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, L = {}; + L[b] = L[l] = L[p] = L[m] = L[w] = L[P] = L[_] = L[y] = L[M] = !0, L[a] = L[f] = L[K] = L[h] = L[E] = L[g] = L[v] = L[x] = L[C] = L[D] = L[N] = L[$] = L[U] = L[R] = L[ne] = !1; var oe = typeof Zn == "object" && Zn && Zn.Object === Object && Zn, Q = typeof self == "object" && self && self.Object === Object && self, X = oe || Q || Function("return this")(), ee = e && !e.nodeType && e, O = ee && !0 && t && !t.nodeType && t, Z = O && O.exports === ee, re = Z && oe.process, he = (function() { try { return re && re.binding && re.binding("util"); @@ -18352,7 +18352,7 @@ function LU() { return Xa(ue) ? St : be(St, Ve(ue)); } function zt(ue) { - return ue == null ? ue === void 0 ? J : $ : Et && Et in Object(ue) ? $r(ue) : R0(ue); + return ue == null ? ue === void 0 ? J : k : Et && Et in Object(ue) ? $r(ue) : R0(ue); } function Zt(ue) { return ta(ue) && zt(ue) == a; @@ -18444,7 +18444,7 @@ function LU() { return bl(+ue, +we); case v: return ue.name == we.name && ue.message == we.message; - case B: + case $: case R: return ue == we + ""; case C: @@ -18588,7 +18588,7 @@ function LU() { if (!xl(ue)) return !1; var we = zt(ue); - return we == x || we == S || we == u || we == k; + return we == x || we == S || we == u || we == B; } function wl(ue) { return typeof ue == "number" && ue > -1 && ue % 1 == 0 && ue <= o; @@ -18627,14 +18627,14 @@ function yq(t, e) { function g(S) { if (S instanceof Uint8Array || (ArrayBuffer.isView(S) ? S = new Uint8Array(S.buffer, S.byteOffset, S.byteLength) : Array.isArray(S) && (S = Uint8Array.from(S))), !(S instanceof Uint8Array)) throw new TypeError("Expected Uint8Array"); if (S.length === 0) return ""; - for (var C = 0, D = 0, $ = 0, N = S.length; $ !== N && S[$] === 0; ) $++, C++; - for (var z = (N - $) * h + 1 >>> 0, k = new Uint8Array(z); $ !== N; ) { - for (var B = S[$], U = 0, R = z - 1; (B !== 0 || U < D) && R !== -1; R--, U++) B += 256 * k[R] >>> 0, k[R] = B % a >>> 0, B = B / a >>> 0; - if (B !== 0) throw new Error("Non-zero carry"); - D = U, $++; - } - for (var W = z - D; W !== z && k[W] === 0; ) W++; - for (var J = f.repeat(C); W < z; ++W) J += t.charAt(k[W]); + for (var C = 0, D = 0, k = 0, N = S.length; k !== N && S[k] === 0; ) k++, C++; + for (var z = (N - k) * h + 1 >>> 0, B = new Uint8Array(z); k !== N; ) { + for (var $ = S[k], U = 0, R = z - 1; ($ !== 0 || U < D) && R !== -1; R--, U++) $ += 256 * B[R] >>> 0, B[R] = $ % a >>> 0, $ = $ / a >>> 0; + if ($ !== 0) throw new Error("Non-zero carry"); + D = U, k++; + } + for (var W = z - D; W !== z && B[W] === 0; ) W++; + for (var J = f.repeat(C); W < z; ++W) J += t.charAt(B[W]); return J; } function v(S) { @@ -18642,16 +18642,16 @@ function yq(t, e) { if (S.length === 0) return new Uint8Array(); var C = 0; if (S[C] !== " ") { - for (var D = 0, $ = 0; S[C] === f; ) D++, C++; + for (var D = 0, k = 0; S[C] === f; ) D++, C++; for (var N = (S.length - C) * u + 1 >>> 0, z = new Uint8Array(N); S[C]; ) { - var k = r[S.charCodeAt(C)]; - if (k === 255) return; - for (var B = 0, U = N - 1; (k !== 0 || B < $) && U !== -1; U--, B++) k += a * z[U] >>> 0, z[U] = k % 256 >>> 0, k = k / 256 >>> 0; - if (k !== 0) throw new Error("Non-zero carry"); - $ = B, C++; + var B = r[S.charCodeAt(C)]; + if (B === 255) return; + for (var $ = 0, U = N - 1; (B !== 0 || $ < k) && U !== -1; U--, $++) B += a * z[U] >>> 0, z[U] = B % 256 >>> 0, B = B / 256 >>> 0; + if (B !== 0) throw new Error("Non-zero carry"); + k = $, C++; } if (S[C] !== " ") { - for (var R = N - $; R !== N && z[R] === 0; ) R++; + for (var R = N - k; R !== N && z[R] === 0; ) R++; for (var W = new Uint8Array(D + (N - R)), J = D; R !== N; ) W[J++] = z[R++]; return W; } @@ -19045,11 +19045,11 @@ class Wz extends lk { try { for (; C === void 0; ) { if (Date.now() - S > this.publishTimeout) throw new Error(x); - this.logger.trace({ id: g, attempts: D }, `publisher.publish - attempt ${D}`), C = await await Lc(this.rpcPublish(n, i, a, f, u, h, g, s?.attestation).catch(($) => this.logger.warn($)), this.publishTimeout, x), D++, C || await new Promise(($) => setTimeout($, this.failedPublishTimeout)); + this.logger.trace({ id: g, attempts: D }, `publisher.publish - attempt ${D}`), C = await await Lc(this.rpcPublish(n, i, a, f, u, h, g, s?.attestation).catch((k) => this.logger.warn(k)), this.publishTimeout, x), D++, C || await new Promise((k) => setTimeout(k, this.failedPublishTimeout)); } this.relayer.events.emit(Qn.publish, v), this.logger.debug("Successfully Published Payload"), this.logger.trace({ type: "method", method: "publish", params: { id: g, topic: n, message: i, opts: s } }); - } catch ($) { - if (this.logger.debug("Failed to Publish Payload"), this.logger.error($), (o = s?.internal) != null && o.throwOnFailedPublish) throw $; + } catch (k) { + if (this.logger.debug("Failed to Publish Payload"), this.logger.error(k), (o = s?.internal) != null && o.throwOnFailedPublish) throw k; this.queue.set(g, v); } }, this.on = (n, i) => { @@ -20132,9 +20132,9 @@ class uH extends mk { this.abortController.signal.addEventListener("abort", S); const C = u.createElement("iframe"); C.src = f, C.style.display = "none", C.addEventListener("error", S, { signal: this.abortController.signal }); - const D = ($) => { - if ($.data && typeof $.data == "string") try { - const N = JSON.parse($.data); + const D = (k) => { + if (k.data && typeof k.data == "string") try { + const N = JSON.parse(k.data); if (N.type === "verify_attestation") { if (ev(N.attestation).payload.id !== o) return; clearInterval(h), u.body.removeChild(C), this.abortController.signal.removeEventListener("abort", S), window.removeEventListener("message", D), v(N.attestation === null ? "" : N.attestation); @@ -20371,24 +20371,24 @@ class NH extends wk { let u = i, h, g = !1; try { u && (g = this.client.core.pairing.pairings.get(u).active); - } catch (k) { - throw this.client.logger.error(`connect() -> pairing.get(${u}) failed`), k; + } catch (B) { + throw this.client.logger.error(`connect() -> pairing.get(${u}) failed`), B; } if (!u || !g) { - const { topic: k, uri: B } = await this.client.core.pairing.create(); - u = k, h = B; + const { topic: B, uri: $ } = await this.client.core.pairing.create(); + u = B, h = $; } if (!u) { - const { message: k } = ft("NO_MATCHING_KEY", `connect() pairing topic: ${u}`); - throw new Error(k); + const { message: B } = ft("NO_MATCHING_KEY", `connect() pairing topic: ${u}`); + throw new Error(B); } - const v = await this.client.core.crypto.generateKeyPair(), x = Pn.wc_sessionPropose.req.ttl || bt.FIVE_MINUTES, S = _n(x), C = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: f ?? [{ protocol: G8 }], proposer: { publicKey: v, metadata: this.client.metadata }, expiryTimestamp: S, pairingTopic: u }, a && { sessionProperties: a }), { reject: D, resolve: $, done: N } = ba(x, fE); - this.events.once(wr("session_connect"), async ({ error: k, session: B }) => { - if (k) D(k); - else if (B) { - B.self.publicKey = v; - const U = ss(tn({}, B), { pairingTopic: C.pairingTopic, requiredNamespaces: C.requiredNamespaces, optionalNamespaces: C.optionalNamespaces, transportType: Wr.relay }); - await this.client.session.set(B.topic, U), await this.setExpiry(B.topic, B.expiry), u && await this.client.core.pairing.updateMetadata({ topic: u, metadata: B.peer.metadata }), this.cleanupDuplicatePairings(U), $(U); + const v = await this.client.core.crypto.generateKeyPair(), x = Pn.wc_sessionPropose.req.ttl || bt.FIVE_MINUTES, S = _n(x), C = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: f ?? [{ protocol: G8 }], proposer: { publicKey: v, metadata: this.client.metadata }, expiryTimestamp: S, pairingTopic: u }, a && { sessionProperties: a }), { reject: D, resolve: k, done: N } = ba(x, fE); + this.events.once(wr("session_connect"), async ({ error: B, session: $ }) => { + if (B) D(B); + else if ($) { + $.self.publicKey = v; + const U = ss(tn({}, $), { pairingTopic: C.pairingTopic, requiredNamespaces: C.requiredNamespaces, optionalNamespaces: C.optionalNamespaces, transportType: Wr.relay }); + await this.client.session.set($.topic, U), await this.setExpiry($.topic, $.expiry), u && await this.client.core.pairing.updateMetadata({ topic: u, metadata: $.peer.metadata }), this.cleanupDuplicatePairings(U), k(U); } }); const z = await this.sendRequest({ topic: u, method: "wc_sessionPropose", params: C, throwOnFailedPublish: !0 }); @@ -20421,28 +20421,28 @@ class NH extends wk { const { id: a, relayProtocol: f, namespaces: u, sessionProperties: h, sessionConfig: g } = r, v = this.client.proposal.get(a); this.client.core.eventClient.deleteEvent({ eventId: o.eventId }); const { pairingTopic: x, proposer: S, requiredNamespaces: C, optionalNamespaces: D } = v; - let $ = (i = this.client.core.eventClient) == null ? void 0 : i.getEvent({ topic: x }); - $ || ($ = (s = this.client.core.eventClient) == null ? void 0 : s.createEvent({ type: is.session_approve_started, properties: { topic: x, trace: [is.session_approve_started, is.session_namespaces_validation_success] } })); - const N = await this.client.core.crypto.generateKeyPair(), z = S.publicKey, k = await this.client.core.crypto.generateSharedKey(N, z), B = tn(tn({ relay: { protocol: f ?? "irn" }, namespaces: u, controller: { publicKey: N, metadata: this.client.metadata }, expiry: _n(gc) }, h && { sessionProperties: h }), g && { sessionConfig: g }), U = Wr.relay; - $.addTrace(is.subscribing_session_topic); + let k = (i = this.client.core.eventClient) == null ? void 0 : i.getEvent({ topic: x }); + k || (k = (s = this.client.core.eventClient) == null ? void 0 : s.createEvent({ type: is.session_approve_started, properties: { topic: x, trace: [is.session_approve_started, is.session_namespaces_validation_success] } })); + const N = await this.client.core.crypto.generateKeyPair(), z = S.publicKey, B = await this.client.core.crypto.generateSharedKey(N, z), $ = tn(tn({ relay: { protocol: f ?? "irn" }, namespaces: u, controller: { publicKey: N, metadata: this.client.metadata }, expiry: _n(gc) }, h && { sessionProperties: h }), g && { sessionConfig: g }), U = Wr.relay; + k.addTrace(is.subscribing_session_topic); try { - await this.client.core.relayer.subscribe(k, { transportType: U }); + await this.client.core.relayer.subscribe(B, { transportType: U }); } catch (W) { - throw $.setError(ga.subscribe_session_topic_failure), W; + throw k.setError(ga.subscribe_session_topic_failure), W; } - $.addTrace(is.subscribe_session_topic_success); - const R = ss(tn({}, B), { topic: k, requiredNamespaces: C, optionalNamespaces: D, pairingTopic: x, acknowledged: !1, self: B.controller, peer: { publicKey: S.publicKey, metadata: S.metadata }, controller: N, transportType: Wr.relay }); - await this.client.session.set(k, R), $.addTrace(is.store_session); + k.addTrace(is.subscribe_session_topic_success); + const R = ss(tn({}, $), { topic: B, requiredNamespaces: C, optionalNamespaces: D, pairingTopic: x, acknowledged: !1, self: $.controller, peer: { publicKey: S.publicKey, metadata: S.metadata }, controller: N, transportType: Wr.relay }); + await this.client.session.set(B, R), k.addTrace(is.store_session); try { - $.addTrace(is.publishing_session_settle), await this.sendRequest({ topic: k, method: "wc_sessionSettle", params: B, throwOnFailedPublish: !0 }).catch((W) => { - throw $?.setError(ga.session_settle_publish_failure), W; - }), $.addTrace(is.session_settle_publish_success), $.addTrace(is.publishing_session_approve), await this.sendResult({ id: a, topic: x, result: { relay: { protocol: f ?? "irn" }, responderPublicKey: N }, throwOnFailedPublish: !0 }).catch((W) => { - throw $?.setError(ga.session_approve_publish_failure), W; - }), $.addTrace(is.session_approve_publish_success); + k.addTrace(is.publishing_session_settle), await this.sendRequest({ topic: B, method: "wc_sessionSettle", params: $, throwOnFailedPublish: !0 }).catch((W) => { + throw k?.setError(ga.session_settle_publish_failure), W; + }), k.addTrace(is.session_settle_publish_success), k.addTrace(is.publishing_session_approve), await this.sendResult({ id: a, topic: x, result: { relay: { protocol: f ?? "irn" }, responderPublicKey: N }, throwOnFailedPublish: !0 }).catch((W) => { + throw k?.setError(ga.session_approve_publish_failure), W; + }), k.addTrace(is.session_approve_publish_success); } catch (W) { - throw this.client.logger.error(W), this.client.session.delete(k, Nr("USER_DISCONNECTED")), await this.client.core.relayer.unsubscribe(k), W; + throw this.client.logger.error(W), this.client.session.delete(B, Nr("USER_DISCONNECTED")), await this.client.core.relayer.unsubscribe(B), W; } - return this.client.core.eventClient.deleteEvent({ eventId: $.eventId }), await this.client.core.pairing.updateMetadata({ topic: x, metadata: S.metadata }), await this.client.proposal.delete(a, Nr("USER_DISCONNECTED")), await this.client.core.pairing.activate({ topic: x }), await this.setExpiry(k, _n(gc)), { topic: k, acknowledged: () => Promise.resolve(this.client.session.get(k)) }; + return this.client.core.eventClient.deleteEvent({ eventId: k.eventId }), await this.client.core.pairing.updateMetadata({ topic: x, metadata: S.metadata }), await this.client.proposal.delete(a, Nr("USER_DISCONNECTED")), await this.client.core.pairing.activate({ topic: x }), await this.setExpiry(B, _n(gc)), { topic: B, acknowledged: () => Promise.resolve(this.client.session.get(B)) }; }, this.reject = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); try { @@ -20546,18 +20546,18 @@ class NH extends wk { this.isInitialized(), this.isValidAuthenticate(r); const s = n && this.client.core.linkModeSupportedApps.includes(n) && ((i = this.client.metadata.redirect) == null ? void 0 : i.linkMode), o = s ? Wr.link_mode : Wr.relay; o === Wr.relay && await this.confirmOnlineStateOrThrow(); - const { chains: a, statement: f = "", uri: u, domain: h, nonce: g, type: v, exp: x, nbf: S, methods: C = [], expiry: D } = r, $ = [...r.resources || []], { topic: N, uri: z } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); + const { chains: a, statement: f = "", uri: u, domain: h, nonce: g, type: v, exp: x, nbf: S, methods: C = [], expiry: D } = r, k = [...r.resources || []], { topic: N, uri: z } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); this.client.logger.info({ message: "Generated new pairing", pairing: { topic: N, uri: z } }); - const k = await this.client.core.crypto.generateKeyPair(), B = Wh(k); - if (await Promise.all([this.client.auth.authKeys.set(Kh, { responseTopic: B, publicKey: k }), this.client.auth.pairingTopics.set(B, { topic: B, pairingTopic: N })]), await this.client.core.relayer.subscribe(B, { transportType: o }), this.client.logger.info(`sending request to new pairing topic: ${N}`), C.length > 0) { + const B = await this.client.core.crypto.generateKeyPair(), $ = Wh(B); + if (await Promise.all([this.client.auth.authKeys.set(Kh, { responseTopic: $, publicKey: B }), this.client.auth.pairingTopics.set($, { topic: $, pairingTopic: N })]), await this.client.core.relayer.subscribe($, { transportType: o }), this.client.logger.info(`sending request to new pairing topic: ${N}`), C.length > 0) { const { namespace: P } = Nc(a[0]); let _ = ij(P, "request", C); - Hh($) && (_ = oj(_, $.pop())), $.push(_); + Hh(k) && (_ = oj(_, k.pop())), k.push(_); } - const U = D && D > Pn.wc_sessionAuthenticate.req.ttl ? D : Pn.wc_sessionAuthenticate.req.ttl, R = { authPayload: { type: v ?? "caip122", chains: a, statement: f, aud: u, domain: h, version: "1", nonce: g, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: x, nbf: S, resources: $ }, requester: { publicKey: k, metadata: this.client.metadata }, expiryTimestamp: _n(U) }, W = { eip155: { chains: a, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...C])], events: ["chainChanged", "accountsChanged"] } }, J = { requiredNamespaces: {}, optionalNamespaces: W, relays: [{ protocol: "irn" }], pairingTopic: N, proposer: { publicKey: k, metadata: this.client.metadata }, expiryTimestamp: _n(Pn.wc_sessionPropose.req.ttl) }, { done: ne, resolve: K, reject: E } = ba(U, "Request expired"), b = async ({ error: P, session: _ }) => { + const U = D && D > Pn.wc_sessionAuthenticate.req.ttl ? D : Pn.wc_sessionAuthenticate.req.ttl, R = { authPayload: { type: v ?? "caip122", chains: a, statement: f, aud: u, domain: h, version: "1", nonce: g, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: x, nbf: S, resources: k }, requester: { publicKey: B, metadata: this.client.metadata }, expiryTimestamp: _n(U) }, W = { eip155: { chains: a, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...C])], events: ["chainChanged", "accountsChanged"] } }, J = { requiredNamespaces: {}, optionalNamespaces: W, relays: [{ protocol: "irn" }], pairingTopic: N, proposer: { publicKey: B, metadata: this.client.metadata }, expiryTimestamp: _n(Pn.wc_sessionPropose.req.ttl) }, { done: ne, resolve: K, reject: E } = ba(U, "Request expired"), b = async ({ error: P, session: _ }) => { if (this.events.off(wr("session_request", p), l), P) E(P); else if (_) { - _.self.publicKey = k, await this.client.session.set(_.topic, _), await this.setExpiry(_.topic, _.expiry), N && await this.client.core.pairing.updateMetadata({ topic: N, metadata: _.peer.metadata }); + _.self.publicKey = B, await this.client.session.set(_.topic, _), await this.setExpiry(_.topic, _.expiry), N && await this.client.core.pairing.updateMetadata({ topic: N, metadata: _.peer.metadata }); const y = this.client.session.get(_.topic); await this.deleteProposal(m), K({ session: y }); } @@ -20578,9 +20578,9 @@ class NH extends wk { } for (const he of Z) L.push(`${he}:${re}`); } - const oe = await this.client.core.crypto.generateSharedKey(k, q.publicKey); + const oe = await this.client.core.crypto.generateSharedKey(B, q.publicKey); let Q; - ce.length > 0 && (Q = { topic: oe, acknowledged: !0, self: { publicKey: k, metadata: this.client.metadata }, peer: q, controller: q.publicKey, expiry: _n(gc), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: N, namespaces: l3([...new Set(ce)], [...new Set(L)]), transportType: o }, await this.client.core.relayer.subscribe(oe, { transportType: o }), await this.client.session.set(oe, Q), N && await this.client.core.pairing.updateMetadata({ topic: N, metadata: q.metadata }), Q = this.client.session.get(oe)), (_ = this.client.metadata.redirect) != null && _.linkMode && (y = q.metadata.redirect) != null && y.linkMode && (M = q.metadata.redirect) != null && M.universal && n && (this.client.core.addLinkModeSupportedApp(q.metadata.redirect.universal), this.client.session.update(oe, { transportType: Wr.link_mode })), K({ auths: I, session: Q }); + ce.length > 0 && (Q = { topic: oe, acknowledged: !0, self: { publicKey: B, metadata: this.client.metadata }, peer: q, controller: q.publicKey, expiry: _n(gc), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: N, namespaces: l3([...new Set(ce)], [...new Set(L)]), transportType: o }, await this.client.core.relayer.subscribe(oe, { transportType: o }), await this.client.session.set(oe, Q), N && await this.client.core.pairing.updateMetadata({ topic: N, metadata: q.metadata }), Q = this.client.session.get(oe)), (_ = this.client.metadata.redirect) != null && _.linkMode && (y = q.metadata.redirect) != null && y.linkMode && (M = q.metadata.redirect) != null && M.universal && n && (this.client.core.addLinkModeSupportedApp(q.metadata.redirect.universal), this.client.session.update(oe, { transportType: Wr.link_mode })), K({ auths: I, session: Q }); }, p = No(), m = No(); this.events.once(wr("session_connect"), b), this.events.once(wr("session_request", p), l); let w; @@ -20610,16 +20610,16 @@ class NH extends wk { for (const D of i) { if (!await e3({ cacao: D, projectId: this.client.core.projectId })) { s.setError(ku.invalid_cacao); - const B = Nr("SESSION_SETTLEMENT_FAILED", "Signature verification failed"); - throw await this.sendError({ id: n, topic: h, error: B, encodeOpts: g }), new Error(B.message); + const $ = Nr("SESSION_SETTLEMENT_FAILED", "Signature verification failed"); + throw await this.sendError({ id: n, topic: h, error: $, encodeOpts: g }), new Error($.message); } s.addTrace(ma.cacaos_verified); - const { p: $ } = D, N = Hh($.resources), z = [iv($.iss)], k = _d($.iss); + const { p: k } = D, N = Hh(k.resources), z = [iv(k.iss)], B = _d(k.iss); if (N) { - const B = t3(N), U = r3(N); - v.push(...B), z.push(...U); + const $ = t3(N), U = r3(N); + v.push(...$), z.push(...U); } - for (const B of z) x.push(`${B}:${k}`); + for (const $ of z) x.push(`${$}:${B}`); } const S = await this.client.core.crypto.generateSharedKey(u, f); s.addTrace(ma.create_authenticated_session_topic); @@ -20710,8 +20710,8 @@ class NH extends wk { } let S; if (EH.includes(i)) { - const D = Qs(JSON.stringify(g)), $ = Qs(v); - S = await this.client.core.verify.register({ id: $, decryptedId: D }); + const D = Qs(JSON.stringify(g)), k = Qs(v); + S = await this.client.core.verify.register({ id: k, decryptedId: D }); } const C = Pn[i].req; if (C.attestation = S, o && (C.ttl = o), a && (C.id = a), this.client.core.history.set(n, g), x) { @@ -20719,7 +20719,7 @@ class NH extends wk { await global.Linking.openURL(D, this.client.name); } else { const D = Pn[i].req; - o && (D.ttl = o), a && (D.id = a), u ? (D.internal = ss(tn({}, D.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(n, v, D)) : this.client.core.relayer.publish(n, v, D).catch(($) => this.client.logger.error($)); + o && (D.ttl = o), a && (D.id = a), u ? (D.internal = ss(tn({}, D.internal), { throwOnFailedPublish: !0 }), await this.client.core.relayer.publish(n, v, D)) : this.client.core.relayer.publish(n, v, D).catch((k) => this.client.logger.error(k)); } return g.id; }, this.sendResult = async (r) => { @@ -21513,14 +21513,14 @@ var qH = Ju.exports, J3; function zH() { return J3 || (J3 = 1, (function(t, e) { (function() { - var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", f = "__lodash_hash_undefined__", u = 500, h = "__lodash_placeholder__", g = 1, v = 2, x = 4, S = 1, C = 2, D = 1, $ = 2, N = 4, z = 8, k = 16, B = 32, U = 64, R = 128, W = 256, J = 512, ne = 30, K = "...", E = 800, b = 16, l = 1, p = 2, m = 3, w = 1 / 0, P = 9007199254740991, _ = 17976931348623157e292, y = NaN, M = 4294967295, I = M - 1, q = M >>> 1, ce = [ + var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", f = "__lodash_hash_undefined__", u = 500, h = "__lodash_placeholder__", g = 1, v = 2, x = 4, S = 1, C = 2, D = 1, k = 2, N = 4, z = 8, B = 16, $ = 32, U = 64, R = 128, W = 256, J = 512, ne = 30, K = "...", E = 800, b = 16, l = 1, p = 2, m = 3, w = 1 / 0, P = 9007199254740991, _ = 17976931348623157e292, y = NaN, M = 4294967295, I = M - 1, q = M >>> 1, ce = [ ["ary", R], ["bind", D], - ["bindKey", $], + ["bindKey", k], ["curry", z], - ["curryRight", k], + ["curryRight", B], ["flip", J], - ["partial", B], + ["partial", $], ["partialRight", U], ["rearg", W] ], L = "[object Arguments]", oe = "[object Array]", Q = "[object AsyncFunction]", X = "[object Boolean]", ee = "[object Date]", O = "[object DOMException]", Z = "[object Error]", re = "[object Function]", he = "[object GeneratorFunction]", ae = "[object Map]", fe = "[object Number]", be = "[object Null]", Ae = "[object Object]", Te = "[object Promise]", Re = "[object Proxy]", $e = "[object RegExp]", Me = "[object Set]", Oe = "[object String]", ze = "[object Symbol]", De = "[object Undefined]", je = "[object WeakMap]", Ue = "[object WeakSet]", _e = "[object ArrayBuffer]", Ze = "[object DataView]", ot = "[object Float32Array]", ke = "[object Float64Array]", rt = "[object Int8Array]", nt = "[object Int16Array]", Ge = "[object Int32Array]", ht = "[object Uint8Array]", lt = "[object Uint8ClampedArray]", ct = "[object Uint16Array]", qt = "[object Uint32Array]", Gt = /\b__p \+= '';/g, Et = /\b(__p \+=) '' \+/g, Yt = /(__e\(.*?\)|\b__t\)) \+\n'';/g, tr = /&(?:amp|lt|gt|quot|#39);/g, Tt = /[&<>"']/g, kt = RegExp(tr.source), It = RegExp(Tt.source), dt = /<%-([\s\S]+?)%>/g, Dt = /<%([\s\S]+?)%>/g, Nt = /<%=([\s\S]+?)%>/g, mt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Bt = /^\w*$/, Ft = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, et = /[\\^$.*+?()[\]{}|]/g, $t = RegExp(et.source), H = /^\s+/, V = /\s/, Y = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, T = /\{\n\/\* \[wrapped with (.+)\] \*/, F = /,? & /, ie = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, le = /[()=,{}\[\]\/\s]/, me = /\\(\\)?/g, Ee = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Le = /\w*$/, Ie = /^[-+]0x[0-9a-f]+$/i, Qe = /^0b[01]+$/i, Xe = /^\[object .+?Constructor\]$/, tt = /^0o[0-7]+$/i, st = /^(?:0|[1-9]\d*)$/, vt = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, Ct = /($^)/, Mt = /['\n\r\u2028\u2029\\]/g, wt = "\\ud800-\\udfff", Rt = "\\u0300-\\u036f", gt = "\\ufe20-\\ufe2f", _t = "\\u20d0-\\u20ff", at = Rt + gt + _t, yt = "\\u2700-\\u27bf", ut = "a-z\\xdf-\\xf6\\xf8-\\xff", it = "\\xac\\xb1\\xd7\\xf7", Se = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Pe = "\\u2000-\\u206f", Ke = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Fe = "A-Z\\xc0-\\xd6\\xd8-\\xde", qe = "\\ufe0e\\ufe0f", Ye = it + Se + Pe + Ke, Lt = "['’]", zt = "[" + wt + "]", Zt = "[" + Ye + "]", Ht = "[" + at + "]", ge = "\\d+", nr = "[" + yt + "]", pr = "[" + ut + "]", gr = "[^" + wt + Ye + ge + yt + ut + Fe + "]", Qt = "\\ud83c[\\udffb-\\udfff]", mr = "(?:" + Ht + "|" + Qt + ")", lr = "[^" + wt + "]", Tr = "(?:\\ud83c[\\udde6-\\uddff]){2}", vr = "[\\ud800-\\udbff][\\udc00-\\udfff]", xr = "[" + Fe + "]", $r = "\\u200d", Br = "(?:" + pr + "|" + gr + ")", Ir = "(?:" + xr + "|" + gr + ")", rn = "(?:" + Lt + "(?:d|ll|m|re|s|t|ve))?", nn = "(?:" + Lt + "(?:D|LL|M|RE|S|T|VE))?", sn = mr + "?", vl = "[" + qe + "]?", R0 = "(?:" + $r + "(?:" + [lr, Tr, vr].join("|") + ")" + vl + sn + ")*", ks = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", bl = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", yl = vl + sn + R0, Xa = "(?:" + [nr, Tr, vr].join("|") + ")" + yl, T0 = "(?:" + [lr + Ht + "?", Ht, Tr, vr, zt].join("|") + ")", iu = RegExp(Lt, "g"), D0 = RegExp(Ht, "g"), Za = RegExp(Qt + "(?=" + Qt + ")|" + T0 + yl, "g"), wl = RegExp([ @@ -23152,7 +23152,7 @@ function zH() { for (j = de ? j : A; ++j < A; ) { se = d[j]; var ve = Xl(se), xe = ve == "wrapper" ? gp(se) : r; - xe && yp(xe[0]) && xe[1] == (R | z | B | W) && !xe[4].length && xe[9] == 1 ? de = de[Xl(xe[0])].apply(de, xe[3]) : de = se.length == 1 && yp(se) ? de[ve]() : de.thru(se); + xe && yp(xe[0]) && xe[1] == (R | z | $ | W) && !xe[4].length && xe[9] == 1 ? de = de[Xl(xe[0])].apply(de, xe[3]) : de = se.length == 1 && yp(se) ? de[ve]() : de.thru(se); } return function() { var He = arguments, We = He[0]; @@ -23165,7 +23165,7 @@ function zH() { }); } function Vl(c, d, A, j, G, se, de, ve, xe, He) { - var We = d & R, Je = d & D, xt = d & $, Ot = d & (z | k), Wt = d & J, fr = xt ? r : vu(c); + var We = d & R, Je = d & D, xt = d & k, Ot = d & (z | B), Wt = d & J, fr = xt ? r : vu(c); function Kt() { for (var yr = arguments.length, Sr = Ce(yr), wi = yr; wi--; ) Sr[wi] = arguments[wi]; @@ -23250,7 +23250,7 @@ function zH() { } function Ny(c, d, A, j, G, se, de, ve, xe, He) { var We = d & z, Je = We ? de : r, xt = We ? r : de, Ot = We ? se : r, Wt = We ? r : se; - d |= We ? B : U, d &= ~(We ? U : B), d & N || (d &= -4); + d |= We ? $ : U, d &= ~(We ? U : $), d & N || (d &= -4); var fr = [ c, d, @@ -23285,7 +23285,7 @@ function zH() { }; } function js(c, d, A, j, G, se, de, ve) { - var xe = d & $; + var xe = d & k; if (!xe && typeof c != "function") throw new Ti(o); var He = j ? j.length : 0; @@ -23305,9 +23305,9 @@ function zH() { de, ve ]; - if (xt && GP(Ot, xt), c = Ot[0], d = Ot[1], A = Ot[2], j = Ot[3], G = Ot[4], ve = Ot[9] = Ot[9] === r ? xe ? 0 : c.length : xn(Ot[9] - He, 0), !ve && d & (z | k) && (d &= -25), !d || d == D) + if (xt && GP(Ot, xt), c = Ot[0], d = Ot[1], A = Ot[2], j = Ot[3], G = Ot[4], ve = Ot[9] = Ot[9] === r ? xe ? 0 : c.length : xn(Ot[9] - He, 0), !ve && d & (z | B) && (d &= -25), !d || d == D) var Wt = RP(c, d, A); - else d == z || d == k ? Wt = TP(c, d, ve) : (d == B || d == (D | B)) && !G.length ? Wt = DP(c, d, A, j) : Wt = Vl.apply(r, Ot); + else d == z || d == B ? Wt = TP(c, d, ve) : (d == $ || d == (D | $)) && !G.length ? Wt = DP(c, d, A, j) : Wt = Vl.apply(r, Ot); var fr = xt ? gy : Ky; return Vy(fr(Wt, Ot), c, d); } @@ -23636,7 +23636,7 @@ function zH() { return d; } function GP(c, d) { - var A = c[1], j = d[1], G = A | j, se = G < (D | $ | R), de = j == R && A == z || j == R && A == W && c[7].length <= d[8] || j == (R | W) && d[7].length <= d[8] && A == z; + var A = c[1], j = d[1], G = A | j, se = G < (D | k | R), de = j == R && A == z || j == R && A == W && c[7].length <= d[8] || j == (R | W) && d[7].length <= d[8] && A == z; if (!(se || de)) return c; j & D && (c[2] = d[2], G |= A & D ? 0 : N); @@ -24200,14 +24200,14 @@ function zH() { var j = D; if (A.length) { var G = bo(A, uc(Sp)); - j |= B; + j |= $; } return js(c, j, d, A, G); }), cw = hr(function(c, d, A) { - var j = D | $; + var j = D | k; if (A.length) { var G = bo(A, uc(cw)); - j |= B; + j |= $; } return js(d, j, c, A, G); }); @@ -24218,7 +24218,7 @@ function zH() { } function fw(c, d, A) { d = A ? r : d; - var j = js(c, k, r, r, r, r, r, d); + var j = js(c, B, r, r, r, r, r, d); return j.placeholder = fw.placeholder, j; } function lw(c, d, A) { @@ -24320,7 +24320,7 @@ function zH() { }); }), Ap = hr(function(c, d) { var A = bo(d, uc(Ap)); - return js(c, B, r, d, A); + return js(c, $, r, d, A); }), hw = hr(function(c, d) { var A = bo(d, uc(hw)); return js(c, U, r, d, A); @@ -25164,7 +25164,7 @@ function print() { __p += __j.call(arguments, '') } var j = A.name + ""; Rr.call(sc, j) || (sc[j] = []), sc[j].push({ name: d, func: A }); } - }), sc[Vl(r, $).name] = [{ + }), sc[Vl(r, k).name] = [{ name: "wrapper", func: r }], _r.prototype.clone = SA, _r.prototype.reverse = AA, _r.prototype.value = PA, te.prototype.at = tI, te.prototype.chain = rI, te.prototype.commit = nI, te.prototype.next = iI, te.prototype.plant = oI, te.prototype.reverse = aI, te.prototype.toJSON = te.prototype.valueOf = te.prototype.value = cI, te.prototype.first = te.prototype.head, au && (te.prototype[au] = sI), te; @@ -25287,7 +25287,7 @@ function KH() { }; }); } - function $(l) { + function k(l) { var p = new FileReader(), m = D(p); return p.readAsArrayBuffer(l), m; } @@ -25300,15 +25300,15 @@ function KH() { m[w] = String.fromCharCode(p[w]); return m.join(""); } - function k(l) { + function B(l) { if (l.slice) return l.slice(0); var p = new Uint8Array(l.byteLength); return p.set(new Uint8Array(l)), p.buffer; } - function B() { + function $() { return this.bodyUsed = !1, this._initBody = function(l) { - this._bodyInit = l, l ? typeof l == "string" ? this._bodyText = l : a.blob && Blob.prototype.isPrototypeOf(l) ? this._bodyBlob = l : a.formData && FormData.prototype.isPrototypeOf(l) ? this._bodyFormData = l : a.searchParams && URLSearchParams.prototype.isPrototypeOf(l) ? this._bodyText = l.toString() : a.arrayBuffer && a.blob && f(l) ? (this._bodyArrayBuffer = k(l.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(l) || h(l)) ? this._bodyArrayBuffer = k(l) : this._bodyText = l = Object.prototype.toString.call(l) : this._bodyText = "", this.headers.get("content-type") || (typeof l == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : a.searchParams && URLSearchParams.prototype.isPrototypeOf(l) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8")); + this._bodyInit = l, l ? typeof l == "string" ? this._bodyText = l : a.blob && Blob.prototype.isPrototypeOf(l) ? this._bodyBlob = l : a.formData && FormData.prototype.isPrototypeOf(l) ? this._bodyFormData = l : a.searchParams && URLSearchParams.prototype.isPrototypeOf(l) ? this._bodyText = l.toString() : a.arrayBuffer && a.blob && f(l) ? (this._bodyArrayBuffer = B(l.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(l) || h(l)) ? this._bodyArrayBuffer = B(l) : this._bodyText = l = Object.prototype.toString.call(l) : this._bodyText = "", this.headers.get("content-type") || (typeof l == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : a.searchParams && URLSearchParams.prototype.isPrototypeOf(l) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8")); }, a.blob && (this.blob = function() { var l = C(this); if (l) @@ -25321,7 +25321,7 @@ function KH() { throw new Error("could not read FormData body as blob"); return Promise.resolve(new Blob([this._bodyText])); }, this.arrayBuffer = function() { - return this._bodyArrayBuffer ? C(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then($); + return this._bodyArrayBuffer ? C(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(k); }), this.text = function() { var l = C(this); if (l) @@ -25379,11 +25379,11 @@ function KH() { } }), p; } - B.call(W.prototype); + $.call(W.prototype); function K(l, p) { p || (p = {}), this.type = "default", this.status = p.status === void 0 ? 200 : p.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in p ? p.statusText : "OK", this.headers = new S(p.headers), this.url = p.url || "", this._initBody(l); } - B.call(K.prototype), K.prototype.clone = function() { + $.call(K.prototype), K.prototype.clone = function() { return new K(this._bodyInit, { status: this.status, statusText: this.statusText, @@ -27140,7 +27140,7 @@ class rK { var Hr = {}, er = {}, E_; function nK() { if (E_) return er; - E_ = 1, Object.defineProperty(er, "__esModule", { value: !0 }), er.toBig = er.shrSL = er.shrSH = er.rotrSL = er.rotrSH = er.rotrBL = er.rotrBH = er.rotr32L = er.rotr32H = er.rotlSL = er.rotlSH = er.rotlBL = er.rotlBH = er.add5L = er.add5H = er.add4L = er.add4H = er.add3L = er.add3H = void 0, er.add = $, er.fromBig = r, er.split = n; + E_ = 1, Object.defineProperty(er, "__esModule", { value: !0 }), er.toBig = er.shrSL = er.shrSH = er.rotrSL = er.rotrSH = er.rotrBL = er.rotrBH = er.rotr32L = er.rotr32H = er.rotlSL = er.rotlSH = er.rotlBL = er.rotlBH = er.add5L = er.add5H = er.add4L = er.add4H = er.add3L = er.add3H = void 0, er.add = k, er.fromBig = r, er.split = n; const t = /* @__PURE__ */ BigInt(2 ** 32 - 1), e = /* @__PURE__ */ BigInt(32); function r(J, ne = !1) { return ne ? { h: Number(J & t), l: Number(J >> e & t) } : { h: Number(J >> e & t) | 0, l: Number(J & t) | 0 }; @@ -27180,7 +27180,7 @@ function nK() { er.rotlBH = C; const D = (J, ne, K) => J << K - 32 | ne >>> 64 - K; er.rotlBL = D; - function $(J, ne, K, E) { + function k(J, ne, K, E) { const b = (ne >>> 0) + (E >>> 0); return { h: J + K + (b / 2 ** 32 | 0) | 0, l: b | 0 }; } @@ -27188,10 +27188,10 @@ function nK() { er.add3L = N; const z = (J, ne, K, E) => ne + K + E + (J / 2 ** 32 | 0) | 0; er.add3H = z; - const k = (J, ne, K, E) => (J >>> 0) + (ne >>> 0) + (K >>> 0) + (E >>> 0); - er.add4L = k; - const B = (J, ne, K, E, b) => ne + K + E + b + (J / 2 ** 32 | 0) | 0; - er.add4H = B; + const B = (J, ne, K, E) => (J >>> 0) + (ne >>> 0) + (K >>> 0) + (E >>> 0); + er.add4L = B; + const $ = (J, ne, K, E, b) => ne + K + E + b + (J / 2 ** 32 | 0) | 0; + er.add4H = $; const U = (J, ne, K, E, b) => (J >>> 0) + (ne >>> 0) + (K >>> 0) + (E >>> 0) + (b >>> 0); er.add5L = U; const R = (J, ne, K, E, b, l) => ne + K + E + b + l + (J / 2 ** 32 | 0) | 0; @@ -27212,11 +27212,11 @@ function nK() { rotlSL: S, rotlBH: C, rotlBL: D, - add: $, + add: k, add3L: N, add3H: z, - add4L: k, - add4H: B, + add4L: B, + add4H: $, add5H: R, add5L: U }; @@ -27230,7 +27230,7 @@ var A_; function sK() { return A_ || (A_ = 1, (function(t) { /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ - Object.defineProperty(t, "__esModule", { value: !0 }), t.wrapXOFConstructorWithOpts = t.wrapConstructorWithOpts = t.wrapConstructor = t.Hash = t.nextTick = t.swap32IfBE = t.byteSwapIfBE = t.swap8IfBE = t.isLE = void 0, t.isBytes = r, t.anumber = n, t.abytes = i, t.ahash = s, t.aexists = o, t.aoutput = a, t.u8 = f, t.u32 = u, t.clean = h, t.createView = g, t.rotr = v, t.rotl = x, t.byteSwap = S, t.byteSwap32 = C, t.bytesToHex = N, t.hexToBytes = B, t.asyncLoop = R, t.utf8ToBytes = W, t.bytesToUtf8 = J, t.toBytes = ne, t.kdfInputToBytes = K, t.concatBytes = E, t.checkOpts = b, t.createHasher = p, t.createOptHasher = m, t.createXOFer = w, t.randomBytes = P; + Object.defineProperty(t, "__esModule", { value: !0 }), t.wrapXOFConstructorWithOpts = t.wrapConstructorWithOpts = t.wrapConstructor = t.Hash = t.nextTick = t.swap32IfBE = t.byteSwapIfBE = t.swap8IfBE = t.isLE = void 0, t.isBytes = r, t.anumber = n, t.abytes = i, t.ahash = s, t.aexists = o, t.aoutput = a, t.u8 = f, t.u32 = u, t.clean = h, t.createView = g, t.rotr = v, t.rotl = x, t.byteSwap = S, t.byteSwap32 = C, t.bytesToHex = N, t.hexToBytes = $, t.asyncLoop = R, t.utf8ToBytes = W, t.bytesToUtf8 = J, t.toBytes = ne, t.kdfInputToBytes = K, t.concatBytes = E, t.checkOpts = b, t.createHasher = p, t.createOptHasher = m, t.createXOFer = w, t.randomBytes = P; const e = /* @__PURE__ */ iK(); function r(_) { return _ instanceof Uint8Array || ArrayBuffer.isView(_) && _.constructor.name === "Uint8Array"; @@ -27292,17 +27292,17 @@ function sK() { return _; } t.swap32IfBE = t.isLE ? (_) => _ : C; - const D = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", $ = /* @__PURE__ */ Array.from({ length: 256 }, (_, y) => y.toString(16).padStart(2, "0")); + const D = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", k = /* @__PURE__ */ Array.from({ length: 256 }, (_, y) => y.toString(16).padStart(2, "0")); function N(_) { if (i(_), D) return _.toHex(); let y = ""; for (let M = 0; M < _.length; M++) - y += $[_[M]]; + y += k[_[M]]; return y; } const z = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 }; - function k(_) { + function B(_) { if (_ >= z._0 && _ <= z._9) return _ - z._0; if (_ >= z.A && _ <= z.F) @@ -27310,7 +27310,7 @@ function sK() { if (_ >= z.a && _ <= z.f) return _ - (z.a - 10); } - function B(_) { + function $(_) { if (typeof _ != "string") throw new Error("hex string expected, got " + typeof _); if (D) @@ -27320,7 +27320,7 @@ function sK() { throw new Error("hex string expected, got unpadded hex of length " + y); const I = new Uint8Array(M); for (let q = 0, ce = 0; q < M; q++, ce += 2) { - const L = k(_.charCodeAt(ce)), oe = k(_.charCodeAt(ce + 1)); + const L = B(_.charCodeAt(ce)), oe = B(_.charCodeAt(ce + 1)); if (L === void 0 || oe === void 0) { const Q = _[ce] + _[ce + 1]; throw new Error('hex string expected, got non-hex character "' + Q + '" at index ' + ce); @@ -27402,43 +27402,43 @@ function oK() { if (P_) return Hr; P_ = 1, Object.defineProperty(Hr, "__esModule", { value: !0 }), Hr.shake256 = Hr.shake128 = Hr.keccak_512 = Hr.keccak_384 = Hr.keccak_256 = Hr.keccak_224 = Hr.sha3_512 = Hr.sha3_384 = Hr.sha3_256 = Hr.sha3_224 = Hr.Keccak = void 0, Hr.keccakP = D; const t = /* @__PURE__ */ nK(), e = /* @__PURE__ */ sK(), r = BigInt(0), n = BigInt(1), i = BigInt(2), s = BigInt(7), o = BigInt(256), a = BigInt(113), f = [], u = [], h = []; - for (let k = 0, B = n, U = 1, R = 0; k < 24; k++) { - [U, R] = [R, (2 * U + 3 * R) % 5], f.push(2 * (5 * R + U)), u.push((k + 1) * (k + 2) / 2 % 64); + for (let B = 0, $ = n, U = 1, R = 0; B < 24; B++) { + [U, R] = [R, (2 * U + 3 * R) % 5], f.push(2 * (5 * R + U)), u.push((B + 1) * (B + 2) / 2 % 64); let W = r; for (let J = 0; J < 7; J++) - B = (B << n ^ (B >> s) * a) % o, B & i && (W ^= n << (n << /* @__PURE__ */ BigInt(J)) - n); + $ = ($ << n ^ ($ >> s) * a) % o, $ & i && (W ^= n << (n << /* @__PURE__ */ BigInt(J)) - n); h.push(W); } - const g = (0, t.split)(h, !0), v = g[0], x = g[1], S = (k, B, U) => U > 32 ? (0, t.rotlBH)(k, B, U) : (0, t.rotlSH)(k, B, U), C = (k, B, U) => U > 32 ? (0, t.rotlBL)(k, B, U) : (0, t.rotlSL)(k, B, U); - function D(k, B = 24) { + const g = (0, t.split)(h, !0), v = g[0], x = g[1], S = (B, $, U) => U > 32 ? (0, t.rotlBH)(B, $, U) : (0, t.rotlSH)(B, $, U), C = (B, $, U) => U > 32 ? (0, t.rotlBL)(B, $, U) : (0, t.rotlSL)(B, $, U); + function D(B, $ = 24) { const U = new Uint32Array(10); - for (let R = 24 - B; R < 24; R++) { + for (let R = 24 - $; R < 24; R++) { for (let ne = 0; ne < 10; ne++) - U[ne] = k[ne] ^ k[ne + 10] ^ k[ne + 20] ^ k[ne + 30] ^ k[ne + 40]; + U[ne] = B[ne] ^ B[ne + 10] ^ B[ne + 20] ^ B[ne + 30] ^ B[ne + 40]; for (let ne = 0; ne < 10; ne += 2) { const K = (ne + 8) % 10, E = (ne + 2) % 10, b = U[E], l = U[E + 1], p = S(b, l, 1) ^ U[K], m = C(b, l, 1) ^ U[K + 1]; for (let w = 0; w < 50; w += 10) - k[ne + w] ^= p, k[ne + w + 1] ^= m; + B[ne + w] ^= p, B[ne + w + 1] ^= m; } - let W = k[2], J = k[3]; + let W = B[2], J = B[3]; for (let ne = 0; ne < 24; ne++) { const K = u[ne], E = S(W, J, K), b = C(W, J, K), l = f[ne]; - W = k[l], J = k[l + 1], k[l] = E, k[l + 1] = b; + W = B[l], J = B[l + 1], B[l] = E, B[l + 1] = b; } for (let ne = 0; ne < 50; ne += 10) { for (let K = 0; K < 10; K++) - U[K] = k[ne + K]; + U[K] = B[ne + K]; for (let K = 0; K < 10; K++) - k[ne + K] ^= ~U[(K + 2) % 10] & U[(K + 4) % 10]; + B[ne + K] ^= ~U[(K + 2) % 10] & U[(K + 4) % 10]; } - k[0] ^= v[R], k[1] ^= x[R]; + B[0] ^= v[R], B[1] ^= x[R]; } (0, e.clean)(U); } - class $ extends e.Hash { + class k extends e.Hash { // NOTE: we accept arguments in bytes instead of bits here. - constructor(B, U, R, W = !1, J = 24) { - if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = B, this.suffix = U, this.outputLen = R, this.enableXOF = W, this.rounds = J, (0, e.anumber)(R), !(0 < B && B < 200)) + constructor($, U, R, W = !1, J = 24) { + if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = $, this.suffix = U, this.outputLen = R, this.enableXOF = W, this.rounds = J, (0, e.anumber)(R), !(0 < $ && $ < 200)) throw new Error("only keccak-f1600 function is supported"); this.state = new Uint8Array(200), this.state32 = (0, e.u32)(this.state); } @@ -27448,13 +27448,13 @@ function oK() { keccak() { (0, e.swap32IfBE)(this.state32), D(this.state32, this.rounds), (0, e.swap32IfBE)(this.state32), this.posOut = 0, this.pos = 0; } - update(B) { - (0, e.aexists)(this), B = (0, e.toBytes)(B), (0, e.abytes)(B); - const { blockLen: U, state: R } = this, W = B.length; + update($) { + (0, e.aexists)(this), $ = (0, e.toBytes)($), (0, e.abytes)($); + const { blockLen: U, state: R } = this, W = $.length; for (let J = 0; J < W; ) { const ne = Math.min(U - this.pos, W - J); for (let K = 0; K < ne; K++) - R[this.pos++] ^= B[J++]; + R[this.pos++] ^= $[J++]; this.pos === U && this.keccak(); } return this; @@ -27463,31 +27463,31 @@ function oK() { if (this.finished) return; this.finished = !0; - const { state: B, suffix: U, pos: R, blockLen: W } = this; - B[R] ^= U, (U & 128) !== 0 && R === W - 1 && this.keccak(), B[W - 1] ^= 128, this.keccak(); + const { state: $, suffix: U, pos: R, blockLen: W } = this; + $[R] ^= U, (U & 128) !== 0 && R === W - 1 && this.keccak(), $[W - 1] ^= 128, this.keccak(); } - writeInto(B) { - (0, e.aexists)(this, !1), (0, e.abytes)(B), this.finish(); + writeInto($) { + (0, e.aexists)(this, !1), (0, e.abytes)($), this.finish(); const U = this.state, { blockLen: R } = this; - for (let W = 0, J = B.length; W < J; ) { + for (let W = 0, J = $.length; W < J; ) { this.posOut >= R && this.keccak(); const ne = Math.min(R - this.posOut, J - W); - B.set(U.subarray(this.posOut, this.posOut + ne), W), this.posOut += ne, W += ne; + $.set(U.subarray(this.posOut, this.posOut + ne), W), this.posOut += ne, W += ne; } - return B; + return $; } - xofInto(B) { + xofInto($) { if (!this.enableXOF) throw new Error("XOF is not possible for this instance"); - return this.writeInto(B); + return this.writeInto($); } - xof(B) { - return (0, e.anumber)(B), this.xofInto(new Uint8Array(B)); + xof($) { + return (0, e.anumber)($), this.xofInto(new Uint8Array($)); } - digestInto(B) { - if ((0, e.aoutput)(B, this), this.finished) + digestInto($) { + if ((0, e.aoutput)($, this), this.finished) throw new Error("digest() was already called"); - return this.writeInto(B), this.destroy(), B; + return this.writeInto($), this.destroy(), $; } digest() { return this.digestInto(new Uint8Array(this.outputLen)); @@ -27495,15 +27495,15 @@ function oK() { destroy() { this.destroyed = !0, (0, e.clean)(this.state); } - _cloneInto(B) { + _cloneInto($) { const { blockLen: U, suffix: R, outputLen: W, rounds: J, enableXOF: ne } = this; - return B || (B = new $(U, R, W, ne, J)), B.state32.set(this.state32), B.pos = this.pos, B.posOut = this.posOut, B.finished = this.finished, B.rounds = J, B.suffix = R, B.outputLen = W, B.enableXOF = ne, B.destroyed = this.destroyed, B; + return $ || ($ = new k(U, R, W, ne, J)), $.state32.set(this.state32), $.pos = this.pos, $.posOut = this.posOut, $.finished = this.finished, $.rounds = J, $.suffix = R, $.outputLen = W, $.enableXOF = ne, $.destroyed = this.destroyed, $; } } - Hr.Keccak = $; - const N = (k, B, U) => (0, e.createHasher)(() => new $(B, k, U)); + Hr.Keccak = k; + const N = (B, $, U) => (0, e.createHasher)(() => new k($, B, U)); Hr.sha3_224 = N(6, 144, 224 / 8), Hr.sha3_256 = N(6, 136, 256 / 8), Hr.sha3_384 = N(6, 104, 384 / 8), Hr.sha3_512 = N(6, 72, 512 / 8), Hr.keccak_224 = N(1, 144, 224 / 8), Hr.keccak_256 = N(1, 136, 256 / 8), Hr.keccak_384 = N(1, 104, 384 / 8), Hr.keccak_512 = N(1, 72, 512 / 8); - const z = (k, B, U) => (0, e.createXOFer)((R = {}) => new $(B, k, R.dkLen === void 0 ? U : R.dkLen, !0)); + const z = (B, $, U) => (0, e.createXOFer)((R = {}) => new k($, B, R.dkLen === void 0 ? U : R.dkLen, !0)); return Hr.shake128 = z(31, 168, 128 / 8), Hr.shake256 = z(31, 136, 256 / 8), Hr; } var um, M_; @@ -27520,7 +27520,7 @@ function CE() { function n(x, S) { let C = x.toString(16); C.length % 2 !== 0 && (C = "0" + C); - const D = C.match(/.{1,2}/g).map(($) => parseInt($, 16)); + const D = C.match(/.{1,2}/g).map((k) => parseInt(k, 16)); for (; D.length < S; ) D.unshift(0); return Buffer.from(D); @@ -27529,8 +27529,8 @@ function CE() { const C = x < 0n; let D; if (C) { - const $ = (1n << BigInt(S)) - 1n; - D = (~x & $) + 1n; + const k = (1n << BigInt(S)) - 1n; + D = (~x & k) + 1n; } else D = x; return D &= (1n << BigInt(S)) - 1n, D; @@ -27619,7 +27619,7 @@ function aK() { throw new Error("Argument is not a number"); } function o(v, x) { - var S, C, D, $; + var S, C, D, k; if (v === "address") return o("uint160", s(x)); if (v === "bool") @@ -27632,8 +27632,8 @@ function aK() { if (S = i(v), S !== "dynamic" && S !== 0 && x.length > S) throw new Error("Elements exceed array size: " + S); D = [], v = v.slice(0, v.lastIndexOf("[")), typeof x == "string" && (x = JSON.parse(x)); - for ($ in x) - D.push(o(v, x[$])); + for (k in x) + D.push(o(v, x[k])); if (S === "dynamic") { var N = o("uint256", x.length); D.unshift(N); @@ -27663,8 +27663,8 @@ function aK() { const z = t.bitLengthFromBigInt(C); if (z > S) throw new Error("Supplied int exceeds width: " + S + " vs " + z); - const k = t.twosFromBigInt(C, 256); - return t.bufferBEFromBigInt(k, 32); + const B = t.twosFromBigInt(C, 256); + return t.bufferBEFromBigInt(B, 32); } else if (v.startsWith("ufixed")) { if (S = n(v), C = s(x), C < 0) throw new Error("Supplied ufixed is negative"); @@ -27682,17 +27682,17 @@ function aK() { } function u(v, x) { var S = [], C = [], D = 32 * v.length; - for (var $ in v) { - var N = e(v[$]), z = x[$], k = o(N, z); - a(N) ? (S.push(o("uint256", D)), C.push(k), D += k.length) : S.push(k); + for (var k in v) { + var N = e(v[k]), z = x[k], B = o(N, z); + a(N) ? (S.push(o("uint256", D)), C.push(B), D += B.length) : S.push(B); } return Buffer.concat(S.concat(C)); } function h(v, x) { if (v.length !== x.length) throw new Error("Number of types are not matching the values"); - for (var S, C, D = [], $ = 0; $ < v.length; $++) { - var N = e(v[$]), z = x[$]; + for (var S, C, D = [], k = 0; k < v.length; k++) { + var N = e(v[k]), z = x[k]; if (N === "bytes") D.push(z); else if (N === "string") @@ -27709,19 +27709,19 @@ function aK() { if (S = r(N), S % 8 || S < 8 || S > 256) throw new Error("Invalid uint width: " + S); C = s(z); - const k = t.bitLengthFromBigInt(C); - if (k > S) - throw new Error("Supplied uint exceeds width: " + S + " vs " + k); + const B = t.bitLengthFromBigInt(C); + if (B > S) + throw new Error("Supplied uint exceeds width: " + S + " vs " + B); D.push(t.bufferBEFromBigInt(C, S / 8)); } else if (N.startsWith("int")) { if (S = r(N), S % 8 || S < 8 || S > 256) throw new Error("Invalid int width: " + S); C = s(z); - const k = t.bitLengthFromBigInt(C); - if (k > S) - throw new Error("Supplied int exceeds width: " + S + " vs " + k); - const B = t.twosFromBigInt(C, S); - D.push(t.bufferBEFromBigInt(B, S / 8)); + const B = t.bitLengthFromBigInt(C); + if (B > S) + throw new Error("Supplied int exceeds width: " + S + " vs " + B); + const $ = t.twosFromBigInt(C, S); + D.push(t.bufferBEFromBigInt($, S / 8)); } else throw new Error("Unsupported or invalid type: " + N); } @@ -27784,10 +27784,10 @@ function cK() { if (x === "string") return typeof S == "string" && (S = Buffer.from(S, "utf8")), ["bytes32", t.keccak(S)]; if (x.lastIndexOf("]") === x.length - 1) { - const C = x.slice(0, x.lastIndexOf("[")), D = S.map(($) => g(v, C, $)); + const C = x.slice(0, x.lastIndexOf("[")), D = S.map((k) => g(v, C, k)); return ["bytes32", t.keccak(e.rawEncode( - D.map(([$]) => $), - D.map(([, $]) => $) + D.map(([k]) => k), + D.map(([, k]) => k) ))]; } return [x, S]; @@ -28461,8 +28461,8 @@ function Sd() { Sd.__r = 0; } function BE(t, e, r, n, i, s, o, a, f, u, h) { - var g, v, x, S, C, D, $ = n && n.__k || kE, N = e.length; - for (f = EK(r, e, $, f), g = 0; g < N; g++) (x = r.__k[g]) != null && (v = x.__i === -1 ? Bf : $[x.__i] || Bf, x.__i = g, D = j1(t, x, v, i, s, o, a, f, u, h), S = x.__e, x.ref && v.ref != x.ref && (v.ref && U1(v.ref, null, x), h.push(x.ref, x.__c || S, x)), C == null && S != null && (C = S), 4 & x.__u || v.__k === x.__k ? f = FE(x, f, t) : typeof x.type == "function" && D !== void 0 ? f = D : S && (f = S.nextSibling), x.__u &= -7); + var g, v, x, S, C, D, k = n && n.__k || kE, N = e.length; + for (f = EK(r, e, k, f), g = 0; g < N; g++) (x = r.__k[g]) != null && (v = x.__i === -1 ? Bf : k[x.__i] || Bf, x.__i = g, D = j1(t, x, v, i, s, o, a, f, u, h), S = x.__e, x.ref && v.ref != x.ref && (v.ref && U1(v.ref, null, x), h.push(x.ref, x.__c || S, x)), C == null && S != null && (C = S), 4 & x.__u || v.__k === x.__k ? f = FE(x, f, t) : typeof x.type == "function" && D !== void 0 ? f = D : S && (f = S.nextSibling), x.__u &= -7); return r.__e = C, f; } function EK(t, e, r, n) { @@ -28530,24 +28530,24 @@ function $_(t) { }; } function j1(t, e, r, n, i, s, o, a, f, u) { - var h, g, v, x, S, C, D, $, N, z, k, B, U, R, W, J, ne, K = e.type; + var h, g, v, x, S, C, D, k, N, z, B, $, U, R, W, J, ne, K = e.type; if (e.constructor !== void 0) return null; 128 & r.__u && (f = !!(32 & r.__u), s = [a = e.__e = r.__e]), (h = Jr.__b) && h(e); e: if (typeof K == "function") try { - if ($ = e.props, N = "prototype" in K && K.prototype.render, z = (h = K.contextType) && n[h.__c], k = h ? z ? z.props.value : h.__ : n, r.__c ? D = (g = e.__c = r.__c).__ = g.__E : (N ? e.__c = g = new K($, k) : (e.__c = g = new Yh($, k), g.constructor = K, g.render = PK), z && z.sub(g), g.props = $, g.state || (g.state = {}), g.context = k, g.__n = n, v = g.__d = !0, g.__h = [], g._sb = []), N && g.__s == null && (g.__s = g.state), N && K.getDerivedStateFromProps != null && (g.__s == g.state && (g.__s = Fo({}, g.__s)), Fo(g.__s, K.getDerivedStateFromProps($, g.__s))), x = g.props, S = g.state, g.__v = e, v) N && K.getDerivedStateFromProps == null && g.componentWillMount != null && g.componentWillMount(), N && g.componentDidMount != null && g.__h.push(g.componentDidMount); + if (k = e.props, N = "prototype" in K && K.prototype.render, z = (h = K.contextType) && n[h.__c], B = h ? z ? z.props.value : h.__ : n, r.__c ? D = (g = e.__c = r.__c).__ = g.__E : (N ? e.__c = g = new K(k, B) : (e.__c = g = new Yh(k, B), g.constructor = K, g.render = PK), z && z.sub(g), g.props = k, g.state || (g.state = {}), g.context = B, g.__n = n, v = g.__d = !0, g.__h = [], g._sb = []), N && g.__s == null && (g.__s = g.state), N && K.getDerivedStateFromProps != null && (g.__s == g.state && (g.__s = Fo({}, g.__s)), Fo(g.__s, K.getDerivedStateFromProps(k, g.__s))), x = g.props, S = g.state, g.__v = e, v) N && K.getDerivedStateFromProps == null && g.componentWillMount != null && g.componentWillMount(), N && g.componentDidMount != null && g.__h.push(g.componentDidMount); else { - if (N && K.getDerivedStateFromProps == null && $ !== x && g.componentWillReceiveProps != null && g.componentWillReceiveProps($, k), !g.__e && (g.shouldComponentUpdate != null && g.shouldComponentUpdate($, g.__s, k) === !1 || e.__v === r.__v)) { - for (e.__v !== r.__v && (g.props = $, g.state = g.__s, g.__d = !1), e.__e = r.__e, e.__k = r.__k, e.__k.some(function(E) { + if (N && K.getDerivedStateFromProps == null && k !== x && g.componentWillReceiveProps != null && g.componentWillReceiveProps(k, B), !g.__e && (g.shouldComponentUpdate != null && g.shouldComponentUpdate(k, g.__s, B) === !1 || e.__v === r.__v)) { + for (e.__v !== r.__v && (g.props = k, g.state = g.__s, g.__d = !1), e.__e = r.__e, e.__k = r.__k, e.__k.some(function(E) { E && (E.__ = e); - }), B = 0; B < g._sb.length; B++) g.__h.push(g._sb[B]); + }), $ = 0; $ < g._sb.length; $++) g.__h.push(g._sb[$]); g._sb = [], g.__h.length && o.push(g); break e; } - g.componentWillUpdate != null && g.componentWillUpdate($, g.__s, k), N && g.componentDidUpdate != null && g.__h.push(function() { + g.componentWillUpdate != null && g.componentWillUpdate(k, g.__s, B), N && g.componentDidUpdate != null && g.__h.push(function() { g.componentDidUpdate(x, S, C); }); } - if (g.context = k, g.props = $, g.__P = t, g.__e = !1, U = Jr.__r, R = 0, N) { + if (g.context = B, g.props = k, g.__P = t, g.__e = !1, U = Jr.__r, R = 0, N) { for (g.state = g.__s, g.__d = !1, U && U(e), h = g.render(g.props, g.state, g.context), W = 0; W < g._sb.length; W++) g.__h.push(g._sb[W]); g._sb = []; } else do @@ -28578,7 +28578,7 @@ function jE(t, e, r) { }); } function AK(t, e, r, n, i, s, o, a, f) { - var u, h, g, v, x, S, C, D = r.props, $ = e.props, N = e.type; + var u, h, g, v, x, S, C, D = r.props, k = e.props, N = e.type; if (N === "svg" ? i = "http://www.w3.org/2000/svg" : N === "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) { for (u = 0; u < s.length; u++) if ((x = s[u]) && "setAttribute" in x == !!N && (N ? x.localName === N : x.nodeType === 3)) { t = x, s[u] = null; @@ -28586,20 +28586,20 @@ function AK(t, e, r, n, i, s, o, a, f) { } } if (t == null) { - if (N === null) return document.createTextNode($); - t = document.createElementNS(i, N, $.is && $), a && (Jr.__m && Jr.__m(e, s), a = !1), s = null; + if (N === null) return document.createTextNode(k); + t = document.createElementNS(i, N, k.is && k), a && (Jr.__m && Jr.__m(e, s), a = !1), s = null; } - if (N === null) D === $ || a && t.data === $ || (t.data = $); + if (N === null) D === k || a && t.data === k || (t.data = k); else { if (s = s && c0.call(t.childNodes), D = r.props || Bf, !a && s != null) for (D = {}, u = 0; u < t.attributes.length; u++) D[(x = t.attributes[u]).name] = x.value; for (u in D) if (x = D[u], u != "children") { if (u == "dangerouslySetInnerHTML") g = x; - else if (!(u in $)) { - if (u == "value" && "defaultValue" in $ || u == "checked" && "defaultChecked" in $) continue; + else if (!(u in k)) { + if (u == "value" && "defaultValue" in k || u == "checked" && "defaultChecked" in k) continue; Mh(t, u, null, x, i); } } - for (u in $) x = $[u], u == "children" ? v = x : u == "dangerouslySetInnerHTML" ? h = x : u == "value" ? S = x : u == "checked" ? C = x : a && typeof x != "function" || D[u] === x || Mh(t, u, x, D[u], i); + for (u in k) x = k[u], u == "children" ? v = x : u == "dangerouslySetInnerHTML" ? h = x : u == "value" ? S = x : u == "checked" ? C = x : a && typeof x != "function" || D[u] === x || Mh(t, u, x, D[u], i); if (h) a || g && (h.__html === g.__html || h.__html === t.innerHTML) || (t.innerHTML = h.__html), e.__k = []; else if (g && (t.innerHTML = ""), BE(t, B1(v) ? v : [v], e, r, n, N === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && qc(r, 0), a, f), s != null) for (u = s.length; u--; ) F1(s[u]); a || (u = "value", N === "progress" && S == null ? t.removeAttribute("value") : S !== void 0 && (S !== t[u] || N === "progress" && !S || N === "option" && S !== D[u]) && Mh(t, u, S, D[u], i), u = "checked", C !== void 0 && C !== t[u] && Mh(t, u, C, D[u], i)); @@ -29691,9 +29691,9 @@ function iV() { }, a.prototype.emit = function(u, h, g, v, x, S) { var C = r ? r + u : u; if (!this._events[C]) return !1; - var D = this._events[C], $ = arguments.length, N, z; + var D = this._events[C], k = arguments.length, N, z; if (D.fn) { - switch (D.once && this.removeListener(u, D.fn, void 0, !0), $) { + switch (D.once && this.removeListener(u, D.fn, void 0, !0), k) { case 1: return D.fn.call(D.context), !0; case 2: @@ -29707,13 +29707,13 @@ function iV() { case 6: return D.fn.call(D.context, h, g, v, x, S), !0; } - for (z = 1, N = new Array($ - 1); z < $; z++) + for (z = 1, N = new Array(k - 1); z < k; z++) N[z - 1] = arguments[z]; D.fn.apply(D.context, N); } else { - var k = D.length, B; - for (z = 0; z < k; z++) - switch (D[z].once && this.removeListener(u, D[z].fn, void 0, !0), $) { + var B = D.length, $; + for (z = 0; z < B; z++) + switch (D[z].once && this.removeListener(u, D[z].fn, void 0, !0), k) { case 1: D[z].fn.call(D[z].context); break; @@ -29727,8 +29727,8 @@ function iV() { D[z].fn.call(D[z].context, h, g, v); break; default: - if (!N) for (B = 1, N = new Array($ - 1); B < $; B++) - N[B - 1] = arguments[B]; + if (!N) for ($ = 1, N = new Array(k - 1); $ < k; $++) + N[$ - 1] = arguments[$]; D[z].fn.apply(D[z].context, N); } } @@ -29746,7 +29746,7 @@ function iV() { if (S.fn) S.fn === h && (!v || S.once) && (!g || S.context === g) && o(this, x); else { - for (var C = 0, D = [], $ = S.length; C < $; C++) + for (var C = 0, D = [], k = S.length; C < k; C++) (S[C].fn !== h || v && !S[C].once || g && S[C].context !== g) && D.push(S[C]); D.length ? this._events[x] = D.length === 1 ? D[0] : D : o(this, x); } @@ -30192,15 +30192,15 @@ function h0(t, e, r) { return Ne.isArrayBuffer(S) || Ne.isTypedArray(S) ? f && typeof Blob == "function" ? new Blob([S]) : Buffer.from(S) : S; } function h(S, C, D) { - let $ = S; + let k = S; if (S && !D && typeof S == "object") { if (Ne.endsWith(C, "{}")) C = n ? C : C.slice(0, -2), S = JSON.stringify(S); - else if (Ne.isArray(S) && eG(S) || (Ne.isFileList(S) || Ne.endsWith(C, "[]")) && ($ = Ne.toArray(S))) - return C = sS(C), $.forEach(function(z, k) { + else if (Ne.isArray(S) && eG(S) || (Ne.isFileList(S) || Ne.endsWith(C, "[]")) && (k = Ne.toArray(S))) + return C = sS(C), k.forEach(function(z, B) { !(Ne.isUndefined(z) || z === null) && e.append( // eslint-disable-next-line no-nested-ternary - o === !0 ? r6([C], k, s) : o === null ? C : C + "[]", + o === !0 ? r6([C], B, s) : o === null ? C : C + "[]", u(z) ); }), !1; @@ -30216,14 +30216,14 @@ function h0(t, e, r) { if (!Ne.isUndefined(S)) { if (g.indexOf(S) !== -1) throw Error("Circular reference detected in " + C.join(".")); - g.push(S), Ne.forEach(S, function($, N) { - (!(Ne.isUndefined($) || $ === null) && i.call( + g.push(S), Ne.forEach(S, function(k, N) { + (!(Ne.isUndefined(k) || k === null) && i.call( e, - $, + k, Ne.isString(N) ? N.trim() : N, C, v - )) === !0 && x($, C ? C.concat(N) : [N]); + )) === !0 && x(k, C ? C.concat(N) : [N]); }), g.pop(); } } @@ -30882,12 +30882,12 @@ const dS = (t) => { } let D = new XMLHttpRequest(); D.open(i.method.toUpperCase(), i.url, !0), D.timeout = i.timeout; - function $() { + function k() { if (!D) return; const z = li.from( "getAllResponseHeaders" in D && D.getAllResponseHeaders() - ), B = { + ), $ = { data: !a || a === "text" || a === "json" ? D.responseText : D.response, status: D.status, statusText: D.statusText, @@ -30899,25 +30899,25 @@ const dS = (t) => { r(R), C(); }, function(R) { n(R), C(); - }, B), D = null; + }, $), D = null; } - "onloadend" in D ? D.onloadend = $ : D.onreadystatechange = function() { - !D || D.readyState !== 4 || D.status === 0 && !(D.responseURL && D.responseURL.indexOf("file:") === 0) || setTimeout($); + "onloadend" in D ? D.onloadend = k : D.onreadystatechange = function() { + !D || D.readyState !== 4 || D.status === 0 && !(D.responseURL && D.responseURL.indexOf("file:") === 0) || setTimeout(k); }, D.onabort = function() { D && (n(new ar("Request aborted", ar.ECONNABORTED, t, D)), D = null); }, D.onerror = function() { n(new ar("Network Error", ar.ERR_NETWORK, t, D)), D = null; }, D.ontimeout = function() { - let k = i.timeout ? "timeout of " + i.timeout + "ms exceeded" : "timeout exceeded"; - const B = i.transitional || cS; - i.timeoutErrorMessage && (k = i.timeoutErrorMessage), n(new ar( - k, - B.clarifyTimeoutError ? ar.ETIMEDOUT : ar.ECONNABORTED, + let B = i.timeout ? "timeout of " + i.timeout + "ms exceeded" : "timeout exceeded"; + const $ = i.transitional || cS; + i.timeoutErrorMessage && (B = i.timeoutErrorMessage), n(new ar( + B, + $.clarifyTimeoutError ? ar.ETIMEDOUT : ar.ECONNABORTED, t, D )), D = null; - }, s === void 0 && o.setContentType(null), "setRequestHeader" in D && Ne.forEach(o.toJSON(), function(k, B) { - D.setRequestHeader(B, k); + }, s === void 0 && o.setContentType(null), "setRequestHeader" in D && Ne.forEach(o.toJSON(), function(B, $) { + D.setRequestHeader($, B); }), Ne.isUndefined(i.withCredentials) || (D.withCredentials = !!i.withCredentials), a && a !== "json" && (D.responseType = i.responseType), u && ([v, S] = Pd(u, !0), D.addEventListener("progress", v)), f && D.upload && ([g, x] = Pd(f), D.upload.addEventListener("progress", g), D.upload.addEventListener("loadend", x)), (i.cancelToken || i.signal) && (h = (z) => { D && (n(!z || z.type ? new Zc(null, t, D) : z), D.abort(), D = null); }, i.cancelToken && i.cancelToken.subscribe(h), i.signal && (i.signal.aborted ? h() : i.signal.addEventListener("abort", h))); @@ -31074,21 +31074,21 @@ const kG = async (t) => { let D; try { if (f && LG && r !== "get" && r !== "head" && (D = await $G(h, n)) !== 0) { - let B = new Request(e, { + let $ = new Request(e, { method: "POST", body: n, duplex: "half" }), U; - if (Ne.isFormData(n) && (U = B.headers.get("content-type")) && h.setContentType(U), B.body) { + if (Ne.isFormData(n) && (U = $.headers.get("content-type")) && h.setContentType(U), $.body) { const [R, W] = o6( D, Pd(a6(f)) ); - n = u6(B.body, f6, R, W); + n = u6($.body, f6, R, W); } } Ne.isString(g) || (g = g ? "include" : "omit"); - const $ = "credentials" in Request.prototype; + const k = "credentials" in Request.prototype; S = new Request(e, { ...v, signal: x, @@ -31096,14 +31096,14 @@ const kG = async (t) => { headers: h.normalize().toJSON(), body: n, duplex: "half", - credentials: $ ? g : void 0 + credentials: k ? g : void 0 }); let N = await fetch(S); const z = Sv && (u === "stream" || u === "response"); if (Sv && (a || z && C)) { - const B = {}; + const $ = {}; ["status", "statusText", "headers"].forEach((J) => { - B[J] = N[J]; + $[J] = N[J]; }); const U = Ne.toFiniteNumber(N.headers.get("content-length")), [R, W] = a && o6( U, @@ -31113,14 +31113,14 @@ const kG = async (t) => { u6(N.body, f6, R, () => { W && W(), C && C(); }), - B + $ ); } u = u || "text"; - let k = await Md[Ne.findKey(Md, u) || "text"](N, t); - return !z && C && C(), await new Promise((B, U) => { - lS(B, U, { - data: k, + let B = await Md[Ne.findKey(Md, u) || "text"](N, t); + return !z && C && C(), await new Promise(($, U) => { + lS($, U, { + data: B, headers: li.from(N.headers), status: N.status, statusText: N.statusText, @@ -31128,13 +31128,13 @@ const kG = async (t) => { request: S }); }); - } catch ($) { - throw C && C(), $ && $.name === "TypeError" && /fetch/i.test($.message) ? Object.assign( + } catch (k) { + throw C && C(), k && k.name === "TypeError" && /fetch/i.test(k.message) ? Object.assign( new ar("Network Error", ar.ERR_NETWORK, t, S), { - cause: $.cause || $ + cause: k.cause || k } - ) : ar.from($, $ && $.code, t, S); + ) : ar.from(k, k && k.code, t, S); } }), Av = { http: QV, @@ -31671,20 +31671,20 @@ function g0() { function lne(t) { const { apiBaseUrl: e } = t, [r, n] = Xt([]), [i, s] = Xt([]), [o, a] = Xt(null), [f, u] = Xt(!1), [h, g] = Xt([]), v = (C) => { a(C); - const $ = { + const k = { provider: C.provider instanceof fv ? "UniversalProvider" : "EIP1193Provider", key: C.key, timestamp: Date.now() }; - localStorage.setItem("xn-last-used-info", JSON.stringify($)); + localStorage.setItem("xn-last-used-info", JSON.stringify(k)); }; function x(C) { - const D = C.find(($) => $.config?.name === t.singleWalletName); + const D = C.find((k) => k.config?.name === t.singleWalletName); if (D) s([D]); else { - const $ = C.filter((k) => k.featured || k.installed), N = C.filter((k) => !k.featured && !k.installed), z = [...$, ...N]; - n(z), s($); + const k = C.filter((B) => B.featured || B.installed), N = C.filter((B) => !B.featured && !B.installed), z = [...k, ...N]; + n(z), s(k); } } async function S() { @@ -31700,8 +31700,8 @@ function lne(t) { if (z) z.EIP6963Detected(N); else { - const k = new Tc(N); - D.set(k.key, k), C.push(k); + const B = new Tc(N); + D.set(B.key, B), C.push(B); } }); try { @@ -31709,10 +31709,10 @@ function lne(t) { if (z && N.provider === "EIP1193Provider" && z.installed) a(z); else if (N.provider === "UniversalProvider") { - const k = await fv.init(VG); - if (k.session) { - const B = new Tc(k); - a(B), console.log("Restored UniversalProvider for wallet:", B.key); + const B = await fv.init(VG); + if (B.session) { + const $ = new Tc(B); + a($), console.log("Restored UniversalProvider for wallet:", $.key); } } } catch (N) { @@ -32107,18 +32107,18 @@ function IS(t, e) { delta: 0, timestamp: 0, isProcessing: !1 - }, s = () => r = !0, o = Ih.reduce(($, N) => ($[N] = pY(s), $), {}), { read: a, resolveKeyframes: f, update: u, preRender: h, render: g, postRender: v } = o, x = () => { - const $ = performance.now(); - r = !1, i.delta = n ? 1e3 / 60 : Math.max(Math.min($ - i.timestamp, gY), 1), i.timestamp = $, i.isProcessing = !0, a.process(i), f.process(i), u.process(i), h.process(i), g.process(i), v.process(i), i.isProcessing = !1, r && e && (n = !1, t(x)); + }, s = () => r = !0, o = Ih.reduce((k, N) => (k[N] = pY(s), k), {}), { read: a, resolveKeyframes: f, update: u, preRender: h, render: g, postRender: v } = o, x = () => { + const k = performance.now(); + r = !1, i.delta = n ? 1e3 / 60 : Math.max(Math.min(k - i.timestamp, gY), 1), i.timestamp = k, i.isProcessing = !0, a.process(i), f.process(i), u.process(i), h.process(i), g.process(i), v.process(i), i.isProcessing = !1, r && e && (n = !1, t(x)); }, S = () => { r = !0, n = !0, i.isProcessing || t(x); }; - return { schedule: Ih.reduce(($, N) => { + return { schedule: Ih.reduce((k, N) => { const z = o[N]; - return $[N] = (k, B = !1, U = !1) => (r || S(), z.schedule(k, B, U)), $; - }, {}), cancel: ($) => { + return k[N] = (B, $ = !1, U = !1) => (r || S(), z.schedule(B, $, U)), k; + }, {}), cancel: (k) => { for (let N = 0; N < Ih.length; N++) - o[Ih[N]].cancel($); + o[Ih[N]].cancel(k); }, state: i, steps: o }; } const { schedule: kr, cancel: Vo, state: Nn, steps: bm } = IS(typeof requestAnimationFrame < "u" ? requestAnimationFrame : kn, !0), CS = (t, e, r) => (((1 - 3 * r + 3 * e) * t + (3 * r - 6 * e)) * t + 3 * e) * t, mY = 1e-7, vY = 12; @@ -32752,37 +32752,37 @@ function r7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { const i = t[0], s = t[t.length - 1], o = { done: !1, value: i }, { stiffness: a, damping: f, mass: u, duration: h, velocity: g, isResolvedFromDuration: v } = lJ({ ...n, velocity: -oo(n.velocity || 0) - }), x = g || 0, S = f / (2 * Math.sqrt(a * u)), C = s - i, D = oo(Math.sqrt(a / u)), $ = Math.abs(C) < 5; - r || (r = $ ? 0.01 : 2), e || (e = $ ? 5e-3 : 0.5); + }), x = g || 0, S = f / (2 * Math.sqrt(a * u)), C = s - i, D = oo(Math.sqrt(a / u)), k = Math.abs(C) < 5; + r || (r = k ? 0.01 : 2), e || (e = k ? 5e-3 : 0.5); let N; if (S < 1) { const z = Dv(D, S); - N = (k) => { - const B = Math.exp(-S * D * k); - return s - B * ((x + S * D * C) / z * Math.sin(z * k) + C * Math.cos(z * k)); + N = (B) => { + const $ = Math.exp(-S * D * B); + return s - $ * ((x + S * D * C) / z * Math.sin(z * B) + C * Math.cos(z * B)); }; } else if (S === 1) N = (z) => s - Math.exp(-D * z) * (C + (x + D * C) * z); else { const z = D * Math.sqrt(S * S - 1); - N = (k) => { - const B = Math.exp(-S * D * k), U = Math.min(z * k, 300); - return s - B * ((x + S * D * C) * Math.sinh(U) + z * C * Math.cosh(U)) / z; + N = (B) => { + const $ = Math.exp(-S * D * B), U = Math.min(z * B, 300); + return s - $ * ((x + S * D * C) * Math.sinh(U) + z * C * Math.cosh(U)) / z; }; } return { calculatedDuration: v && h || null, next: (z) => { - const k = N(z); + const B = N(z); if (v) o.done = z >= h; else { - let B = 0; - S < 1 && (B = z === 0 ? Cs(x) : t7(N, z, k)); - const U = Math.abs(B) <= r, R = Math.abs(s - k) <= e; + let $ = 0; + S < 1 && ($ = z === 0 ? Cs(x) : t7(N, z, B)); + const U = Math.abs($) <= r, R = Math.abs(s - B) <= e; o.done = U && R; } - return o.value = o.done ? s : k, o; + return o.value = o.done ? s : B, o; } }; } @@ -32792,15 +32792,15 @@ function P6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 3 value: g }, x = (W) => a !== void 0 && W < a || f !== void 0 && W > f, S = (W) => a === void 0 ? f : f === void 0 || Math.abs(a - W) < Math.abs(f - W) ? a : f; let C = r * e; - const D = g + C, $ = o === void 0 ? D : o(D); - $ !== D && (C = $ - g); - const N = (W) => -C * Math.exp(-W / n), z = (W) => $ + N(W), k = (W) => { + const D = g + C, k = o === void 0 ? D : o(D); + k !== D && (C = k - g); + const N = (W) => -C * Math.exp(-W / n), z = (W) => k + N(W), B = (W) => { const J = N(W), ne = z(W); - v.done = Math.abs(J) <= u, v.value = v.done ? $ : ne; + v.done = Math.abs(J) <= u, v.value = v.done ? k : ne; }; - let B, U; + let $, U; const R = (W) => { - x(v.value) && (B = W, U = r7({ + x(v.value) && ($ = W, U = r7({ keyframes: [v.value, S(v.value)], velocity: t7(z, W, v.value), // TODO: This should be passing * 1000 @@ -32814,7 +32814,7 @@ function P6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 3 calculatedDuration: null, next: (W) => { let J = !1; - return !U && B === void 0 && (J = !0, k(W), R(W)), B !== void 0 && W >= B ? U.next(W - B) : (!J && k(W), v); + return !U && $ === void 0 && (J = !0, B(W), R(W)), $ !== void 0 && W >= $ ? U.next(W - $) : (!J && B(W), v); } }; } @@ -33065,20 +33065,20 @@ class ob extends QS { return s.next(0); const { delay: v, repeat: x, repeatType: S, repeatDelay: C, onUpdate: D } = this.options; this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - h / this.speed, this.startTime)), r ? this.currentTime = e : this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = Math.round(e - this.startTime) * this.speed; - const $ = this.currentTime - v * (this.speed >= 0 ? 1 : -1), N = this.speed >= 0 ? $ < 0 : $ > h; - this.currentTime = Math.max($, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = h); - let z = this.currentTime, k = s; + const k = this.currentTime - v * (this.speed >= 0 ? 1 : -1), N = this.speed >= 0 ? k < 0 : k > h; + this.currentTime = Math.max(k, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = h); + let z = this.currentTime, B = s; if (x) { const W = Math.min(this.currentTime, h) / g; let J = Math.floor(W), ne = W % 1; - !ne && W >= 1 && (ne = 1), ne === 1 && J--, J = Math.min(J, x + 1), !!(J % 2) && (S === "reverse" ? (ne = 1 - ne, C && (ne -= C / g)) : S === "mirror" && (k = o)), z = Go(0, 1, ne) * g; + !ne && W >= 1 && (ne = 1), ne === 1 && J--, J = Math.min(J, x + 1), !!(J % 2) && (S === "reverse" ? (ne = 1 - ne, C && (ne -= C / g)) : S === "mirror" && (B = o)), z = Go(0, 1, ne) * g; } - const B = N ? { done: !1, value: f[0] } : k.next(z); - a && (B.value = a(B.value)); - let { done: U } = B; + const $ = N ? { done: !1, value: f[0] } : B.next(z); + a && ($.value = a($.value)); + let { done: U } = $; !N && u !== null && (U = this.speed >= 0 ? this.currentTime >= h : this.currentTime <= 0); const R = this.holdTime === null && (this.state === "finished" || this.state === "running" && U); - return R && i !== void 0 && (B.value = y0(f, this.options, i)), D && D(B.value), R && this.finish(), B; + return R && i !== void 0 && ($.value = y0(f, this.options, i)), D && D($.value), R && this.finish(), $; } get duration() { const { resolved: e } = this; @@ -33253,8 +33253,8 @@ class O6 extends QS { if (!(!((n = f.owner) === null || n === void 0) && n.current)) return !1; if (typeof o == "string" && Rd() && HJ(o) && (o = c7[o]), qJ(this.options)) { - const { onComplete: v, onUpdate: x, motionValue: S, element: C, ...D } = this.options, $ = zJ(e, D); - e = $.keyframes, e.length === 1 && (e[1] = e[0]), i = $.duration, s = $.times, o = $.ease, a = "keyframes"; + const { onComplete: v, onUpdate: x, motionValue: S, element: C, ...D } = this.options, k = zJ(e, D); + e = k.keyframes, e.length === 1 && (e[1] = e[0]), i = k.duration, s = k.times, o = k.ease, a = "keyframes"; } const g = FJ(f.owner.current, u, e, { ...this.options, duration: i, times: s, ease: o }); return g.startTime = h ?? this.calcStartTime(), this.pendingTimeline ? (D6(g, this.pendingTimeline), this.pendingTimeline = void 0) : g.onfinish = () => { @@ -33769,9 +33769,9 @@ function l7(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { }; let C = !1; if (window.MotionHandoffAnimation) { - const $ = f7(t); - if ($) { - const N = window.MotionHandoffAnimation($, g, kr); + const k = f7(t); + if (k) { + const N = window.MotionHandoffAnimation(k, g, kr); N !== null && (S.startTime = N, C = !0); } } @@ -33865,21 +33865,21 @@ function fX(t) { const { props: u } = t, h = h7(t.parent) || {}, g = [], v = /* @__PURE__ */ new Set(); let x = {}, S = 1 / 0; for (let D = 0; D < cX; D++) { - const $ = aX[D], N = r[$], z = u[$] !== void 0 ? u[$] : h[$], k = jf(z), B = $ === f ? N.isActive : null; - B === !1 && (S = D); - let U = z === h[$] && z !== u[$] && k; + const k = aX[D], N = r[k], z = u[k] !== void 0 ? u[k] : h[k], B = jf(z), $ = k === f ? N.isActive : null; + $ === !1 && (S = D); + let U = z === h[k] && z !== u[k] && B; if (U && n && t.manuallyAnimateOnMount && (U = !1), N.protectedKeys = { ...x }, // If it isn't active and hasn't *just* been set as inactive - !N.isActive && B === null || // If we didn't and don't have any defined prop for this animation type + !N.isActive && $ === null || // If we didn't and don't have any defined prop for this animation type !z && !N.prevProp || // Or if the prop doesn't define an animation v0(z) || typeof z == "boolean") continue; const R = lX(N.prevProp, z); let W = R || // If we're making this variant active, we want to always make it active - $ === f && N.isActive && !U && k || // If we removed a higher-priority variant (i is in reverse order) - D > S && k, J = !1; + k === f && N.isActive && !U && B || // If we removed a higher-priority variant (i is in reverse order) + D > S && B, J = !1; const ne = Array.isArray(z) ? z : [z]; - let K = ne.reduce(i($), {}); - B === !1 && (K = {}); + let K = ne.reduce(i(k), {}); + $ === !1 && (K = {}); const { prevResolvedValues: E = {} } = N, b = { ...E, ...K @@ -33897,14 +33897,14 @@ function fX(t) { } N.prevProp = z, N.prevResolvedValues = K, N.isActive && (x = { ...x, ...K }), n && t.blockInitialAnimation && (W = !1), W && (!(U && R) || J) && g.push(...ne.map((w) => ({ animation: w, - options: { type: $ } + options: { type: k } }))); } if (v.size) { const D = {}; - v.forEach(($) => { - const N = t.getBaseTarget($), z = t.getValue($); - z && (z.liveStyle = !0), D[$] = N ?? null; + v.forEach((k) => { + const N = t.getBaseTarget(k), z = t.getValue(k); + z && (z.liveStyle = !0), D[k] = N ?? null; }), g.push({ animation: D }); } let C = !!g.length; @@ -34049,8 +34049,8 @@ class p7 { return; const { point: S } = g, { timestamp: C } = Nn; this.history.push({ ...S, timestamp: C }); - const { onStart: D, onMove: $ } = this.handlers; - v || (D && D(this.lastMoveEvent, g), this.startEvent = this.lastMoveEvent), $ && $(this.lastMoveEvent, g); + const { onStart: D, onMove: k } = this.handlers; + v || (D && D(this.lastMoveEvent, g), this.startEvent = this.lastMoveEvent), k && k(this.lastMoveEvent, g); }, this.handlePointerMove = (g, v) => { this.lastMoveEvent = g, this.lastMoveEventInfo = Em(v, this.transformPagePoint), kr.update(this.updatePoint, !0); }, this.handlePointerUp = (g, v) => { @@ -34333,15 +34333,15 @@ class $X { if (v && !x && (this.openGlobalLock && this.openGlobalLock(), this.openGlobalLock = v7(v), !this.openGlobalLock)) return; this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), Ui((D) => { - let $ = this.getAxisMotionValue(D).get() || 0; - if (Rs.test($)) { + let k = this.getAxisMotionValue(D).get() || 0; + if (Rs.test(k)) { const { projection: N } = this.visualElement; if (N && N.layout) { const z = N.layout.layoutBox[D]; - z && ($ = Pi(z) * (parseFloat($) / 100)); + z && (k = Pi(z) * (parseFloat(k) / 100)); } } - this.originPoint[D] = $; + this.originPoint[D] = k; }), S && kr.postRender(() => S(h, g)), Lv(this.visualElement, "transform"); const { animationState: C } = this.visualElement; C && C.setActive("whileDrag", !0); @@ -34943,15 +34943,15 @@ function O7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.target = void 0, this.relativeTarget = void 0; return; } - const C = this.options.transition || h.getDefaultTransition() || _Z, { onLayoutAnimationStart: D, onLayoutAnimationComplete: $ } = h.getProps(), N = !this.targetLayout || !T7(this.targetLayout, S) || x, z = !v && x; + const C = this.options.transition || h.getDefaultTransition() || _Z, { onLayoutAnimationStart: D, onLayoutAnimationComplete: k } = h.getProps(), N = !this.targetLayout || !T7(this.targetLayout, S) || x, z = !v && x; if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || z || v && (N || !this.currentAnimation)) { this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0), this.setAnimationOrigin(g, z); - const k = { + const B = { ...G1(C, "layout"), onPlay: D, - onComplete: $ + onComplete: k }; - (h.shouldReduceMotion || this.options.layoutRoot) && (k.delay = 0, k.type = !1), this.startAnimation(k); + (h.shouldReduceMotion || this.options.layoutRoot) && (B.delay = 0, B.type = !1), this.startAnimation(B); } else v || v5(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete(); this.targetLayout = S; @@ -35204,12 +35204,12 @@ function O7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check setAnimationOrigin(o, a = !1) { const f = this.snapshot, u = f ? f.latestValues : {}, h = { ...this.latestValues }, g = Sc(); (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !a; - const v = fn(), x = f ? f.source : void 0, S = this.layout ? this.layout.source : void 0, C = x !== S, D = this.getStack(), $ = !D || D.members.length <= 1, N = !!(C && !$ && this.options.crossfade === !0 && !this.path.some(xZ)); + const v = fn(), x = f ? f.source : void 0, S = this.layout ? this.layout.source : void 0, C = x !== S, D = this.getStack(), k = !D || D.members.length <= 1, N = !!(C && !k && this.options.crossfade === !0 && !this.path.some(xZ)); this.animationProgress = 0; let z; - this.mixTargetDelta = (k) => { - const B = k / 1e3; - b5(g.x, o.x, B), b5(g.y, o.y, B), this.setTargetDelta(g), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (uf(v, this.layout.layoutBox, this.relativeParent.layout.layoutBox), wZ(this.relativeTarget, this.relativeTargetOrigin, v, B), z && QX(this.relativeTarget, z) && (this.isProjectionDirty = !1), z || (z = fn()), Fi(z, this.relativeTarget)), C && (this.animationValues = h, VX(h, u, this.latestValues, B, N, $)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = B; + this.mixTargetDelta = (B) => { + const $ = B / 1e3; + b5(g.x, o.x, $), b5(g.y, o.y, $), this.setTargetDelta(g), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (uf(v, this.layout.layoutBox, this.relativeParent.layout.layoutBox), wZ(this.relativeTarget, this.relativeTargetOrigin, v, $), z && QX(this.relativeTarget, z) && (this.isProjectionDirty = !1), z || (z = fn()), Fi(z, this.relativeTarget)), C && (this.animationValues = h, VX(h, u, this.latestValues, $, N, k)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = $; }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0); } startAnimation(o) { @@ -35322,11 +35322,11 @@ function O7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check for (const C in Od) { if (v[C] === void 0) continue; - const { correct: D, applyTo: $ } = Od[C], N = u.transform === "none" ? v[C] : D(v[C], g); - if ($) { - const z = $.length; - for (let k = 0; k < z; k++) - u[$[k]] = N; + const { correct: D, applyTo: k } = Od[C], N = u.transform === "none" ? v[C] : D(v[C], g); + if (k) { + const z = k.length; + for (let B = 0; B < z; B++) + u[k[B]] = N; } else u[C] = N; } @@ -35700,8 +35700,8 @@ function FZ(t, e, r, n, i) { v && (S.current = !0, window.MotionIsMounted = !0, v.updateFeatures(), pb.render(v.render), D.current && v.animationState && v.animationState.animateChanges()); }), Rn(() => { v && (!D.current && v.animationState && v.animationState.animateChanges(), D.current && (queueMicrotask(() => { - var $; - ($ = window.MotionHandoffMarkAsComplete) === null || $ === void 0 || $.call(window, C); + var k; + (k = window.MotionHandoffMarkAsComplete) === null || k === void 0 || k.call(window, C); }), D.current = !1)); }), v; } @@ -35968,12 +35968,12 @@ function ZZ(t, e, r, n) { for (let x = 0; x < v.length; x++) { const S = W1(t, v[x]); if (S) { - const { transitionEnd: C, transition: D, ...$ } = S; - for (const N in $) { - let z = $[N]; + const { transitionEnd: C, transition: D, ...k } = S; + for (const N in k) { + let z = k[N]; if (Array.isArray(z)) { - const k = h ? z.length - 1 : 0; - z = z[k]; + const B = h ? z.length - 1 : 0; + z = z[B]; } z !== null && (i[N] = z); } @@ -36619,16 +36619,16 @@ const DQ = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExi if (a !== v) { let N = [...a]; for (let z = 0; z < S.length; z++) { - const k = S[z], B = Th(k); - f.includes(B) || (N.splice(z, 0, k), D.push(k)); + const B = S[z], $ = Th(B); + f.includes($) || (N.splice(z, 0, B), D.push(B)); } o === "wait" && D.length && (N = D), C(C5(N)), x(a); return; } process.env.NODE_ENV !== "production" && o === "wait" && S.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`); - const { forceRender: $ } = In(db); + const { forceRender: k } = In(db); return pe.jsx(pe.Fragment, { children: S.map((N) => { - const z = Th(N), k = a === S || f.includes(z), B = () => { + const z = Th(N), B = a === S || f.includes(z), $ = () => { if (g.has(z)) g.set(z, !0); else @@ -36636,9 +36636,9 @@ const DQ = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExi let U = !0; g.forEach((R) => { R || (U = !1); - }), U && ($?.(), C(h.current), i && i()); + }), U && (k?.(), C(h.current), i && i()); }; - return pe.jsx(RQ, { isPresent: k, initial: !u.current || n ? void 0 : !1, custom: k ? void 0 : r, presenceAffectsLayout: s, mode: o, onExitComplete: k ? void 0 : B, children: N }, z); + return pe.jsx(RQ, { isPresent: B, initial: !u.current || n ? void 0 : !1, custom: B ? void 0 : r, presenceAffectsLayout: s, mode: o, onExitComplete: B ? void 0 : $, children: N }, z); }) }); }, ps = (t) => /* @__PURE__ */ pe.jsx(DQ, { children: /* @__PURE__ */ pe.jsx( MQ.div, @@ -36807,18 +36807,18 @@ const LQ = NQ, Ab = "-", kQ = (t) => { const f = []; let u = 0, h = 0, g; for (let D = 0; D < a.length; D++) { - let $ = a[D]; + let k = a[D]; if (u === 0) { - if ($ === i && (n || a.slice(D, D + s) === e)) { + if (k === i && (n || a.slice(D, D + s) === e)) { f.push(a.slice(h, D)), h = D + s; continue; } - if ($ === "/") { + if (k === "/") { g = D; continue; } } - $ === "[" ? u++ : $ === "]" && u--; + k === "[" ? u++ : k === "]" && u--; } const v = f.length === 0 ? a : a.substring(h), x = v.startsWith(r9), S = x ? v.substring(1) : v, C = g && g > h ? g - h : void 0; return { @@ -36870,14 +36870,14 @@ const LQ = NQ, Ab = "-", kQ = (t) => { } S = !1; } - const D = zQ(h).join(":"), $ = g ? D + r9 : D, N = $ + C; + const D = zQ(h).join(":"), k = g ? D + r9 : D, N = k + C; if (s.includes(N)) continue; s.push(N); const z = i(C, S); - for (let k = 0; k < z.length; ++k) { - const B = z[k]; - s.push($ + B); + for (let B = 0; B < z.length; ++B) { + const $ = z[B]; + s.push(k + $); } a = u + (a.length > 0 ? " " + a : a); } @@ -36926,7 +36926,7 @@ const Gr = (t) => { // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough. ZQ.test(t) && !QQ.test(t) ), s9 = () => !1, fee = (t) => eee.test(t), lee = (t) => tee.test(t), hee = () => { - const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), f = Gr("contrast"), u = Gr("grayscale"), h = Gr("hueRotate"), g = Gr("invert"), v = Gr("gap"), x = Gr("gradientColorStops"), S = Gr("gradientColorStopPositions"), C = Gr("inset"), D = Gr("margin"), $ = Gr("opacity"), N = Gr("padding"), z = Gr("saturate"), k = Gr("scale"), B = Gr("sepia"), U = Gr("skew"), R = Gr("space"), W = Gr("translate"), J = () => ["auto", "contain", "none"], ne = () => ["auto", "hidden", "clip", "visible", "scroll"], K = () => ["auto", ur, e], E = () => [ur, e], b = () => ["", Js, Io], l = () => ["auto", $c, ur], p = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], m = () => ["solid", "dashed", "dotted", "double", "none"], w = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], P = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], _ = () => ["", "0", ur], y = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], M = () => [$c, ur]; + const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), f = Gr("contrast"), u = Gr("grayscale"), h = Gr("hueRotate"), g = Gr("invert"), v = Gr("gap"), x = Gr("gradientColorStops"), S = Gr("gradientColorStopPositions"), C = Gr("inset"), D = Gr("margin"), k = Gr("opacity"), N = Gr("padding"), z = Gr("saturate"), B = Gr("scale"), $ = Gr("sepia"), U = Gr("skew"), R = Gr("space"), W = Gr("translate"), J = () => ["auto", "contain", "none"], ne = () => ["auto", "hidden", "clip", "visible", "scroll"], K = () => ["auto", ur, e], E = () => [ur, e], b = () => ["", Js, Io], l = () => ["auto", $c, ur], p = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], m = () => ["solid", "dashed", "dotted", "double", "none"], w = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], P = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], _ = () => ["", "0", ur], y = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], M = () => [$c, ur]; return { cacheSize: 500, separator: ":", @@ -37708,7 +37708,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/placeholder-opacity */ "placeholder-opacity": [{ - "placeholder-opacity": [$] + "placeholder-opacity": [k] }], /** * Text Alignment @@ -37729,7 +37729,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/text-opacity */ "text-opacity": [{ - "text-opacity": [$] + "text-opacity": [k] }], /** * Text Decoration @@ -37844,7 +37844,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/background-opacity */ "bg-opacity": [{ - "bg-opacity": [$] + "bg-opacity": [k] }], /** * Background Origin @@ -38108,7 +38108,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/border-opacity */ "border-opacity": [{ - "border-opacity": [$] + "border-opacity": [k] }], /** * Border Style @@ -38146,7 +38146,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/divide-opacity */ "divide-opacity": [{ - "divide-opacity": [$] + "divide-opacity": [k] }], /** * Divide Style @@ -38277,7 +38277,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/ring-opacity */ "ring-opacity": [{ - "ring-opacity": [$] + "ring-opacity": [k] }], /** * Ring Offset Width @@ -38313,7 +38313,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/opacity */ opacity: [{ - opacity: [$] + opacity: [k] }], /** * Mix Blend Mode @@ -38399,7 +38399,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/sepia */ sepia: [{ - sepia: [B] + sepia: [$] }], /** * Backdrop Filter @@ -38456,7 +38456,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/backdrop-opacity */ "backdrop-opacity": [{ - "backdrop-opacity": [$] + "backdrop-opacity": [k] }], /** * Backdrop Saturate @@ -38470,7 +38470,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/backdrop-sepia */ "backdrop-sepia": [{ - "backdrop-sepia": [B] + "backdrop-sepia": [$] }], // Tables /** @@ -38564,21 +38564,21 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/scale */ scale: [{ - scale: [k] + scale: [B] }], /** * Scale X * @see https://tailwindcss.com/docs/scale */ "scale-x": [{ - "scale-x": [k] + "scale-x": [B] }], /** * Scale Y * @see https://tailwindcss.com/docs/scale */ "scale-y": [{ - "scale-y": [k] + "scale-y": [B] }], /** * Rotate @@ -39110,8 +39110,8 @@ function Cee({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isF let [i, s] = Jt.useState(!1), [o, a] = Jt.useState(!1), [f, u] = Jt.useState(!1), h = Jt.useMemo(() => r === "none" ? !1 : (r === "increase-width" || r === "experimental-no-flickering") && i && o, [i, o, r]), g = Jt.useCallback(() => { let v = t.current, x = e.current; if (!v || !x || f || r === "none") return; - let S = v, C = S.getBoundingClientRect().left + S.offsetWidth, D = S.getBoundingClientRect().top + S.offsetHeight / 2, $ = C - Pee, N = D; - document.querySelectorAll(Iee).length === 0 && document.elementFromPoint($, N) === v || (s(!0), u(!0)); + let S = v, C = S.getBoundingClientRect().left + S.offsetWidth, D = S.getBoundingClientRect().top + S.offsetHeight / 2, k = C - Pee, N = D; + document.querySelectorAll(Iee).length === 0 && document.elementFromPoint(k, N) === v || (s(!0), u(!0)); }, [t, e, f, r]); return Jt.useEffect(() => { let v = t.current; @@ -39137,10 +39137,10 @@ function Cee({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isF }, [e, n, r, g]), { hasPWMBadge: i, willPushPWMBadge: h, PWM_BADGE_SPACE_WIDTH: Mee }; } var h9 = Jt.createContext({}), d9 = Jt.forwardRef((t, e) => { - var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: f, inputMode: u = "numeric", onComplete: h, pushPasswordManagerStrategy: g = "increase-width", pasteTransformer: v, containerClassName: x, noScriptCSSFallback: S = Ree, render: C, children: D } = r, $ = Eee(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), N, z, k, B, U; - let [R, W] = Jt.useState(typeof $.defaultValue == "string" ? $.defaultValue : ""), J = n ?? R, ne = Aee(J), K = Jt.useCallback((ae) => { + var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: f, inputMode: u = "numeric", onComplete: h, pushPasswordManagerStrategy: g = "increase-width", pasteTransformer: v, containerClassName: x, noScriptCSSFallback: S = Ree, render: C, children: D } = r, k = Eee(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), N, z, B, $, U; + let [R, W] = Jt.useState(typeof k.defaultValue == "string" ? k.defaultValue : ""), J = n ?? R, ne = Aee(J), K = Jt.useCallback((ae) => { i?.(ae), W(ae); - }, [i]), E = Jt.useMemo(() => a ? typeof a == "string" ? new RegExp(a) : a : null, [a]), b = Jt.useRef(null), l = Jt.useRef(null), p = Jt.useRef({ value: J, onChange: K, isIOS: typeof window < "u" && ((z = (N = window?.CSS) == null ? void 0 : N.supports) == null ? void 0 : z.call(N, "-webkit-touch-callout", "none")) }), m = Jt.useRef({ prev: [(k = b.current) == null ? void 0 : k.selectionStart, (B = b.current) == null ? void 0 : B.selectionEnd, (U = b.current) == null ? void 0 : U.selectionDirection] }); + }, [i]), E = Jt.useMemo(() => a ? typeof a == "string" ? new RegExp(a) : a : null, [a]), b = Jt.useRef(null), l = Jt.useRef(null), p = Jt.useRef({ value: J, onChange: K, isIOS: typeof window < "u" && ((z = (N = window?.CSS) == null ? void 0 : N.supports) == null ? void 0 : z.call(N, "-webkit-touch-callout", "none")) }), m = Jt.useRef({ prev: [(B = b.current) == null ? void 0 : B.selectionStart, ($ = b.current) == null ? void 0 : $.selectionEnd, (U = b.current) == null ? void 0 : U.selectionDirection] }); Jt.useImperativeHandle(e, () => b.current, []), Jt.useEffect(() => { let ae = b.current, fe = l.current; if (!ae || !fe) return; @@ -39224,26 +39224,26 @@ var h9 = Jt.createContext({}), d9 = Jt.forwardRef((t, e) => { Ae.value = Oe, K(Oe); let ze = Math.min(Oe.length, s - 1), De = Oe.length; Ae.setSelectionRange(ze, De), I(ze), ce(De); - }, [s, K, E, J]), ee = Jt.useMemo(() => ({ position: "relative", cursor: $.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [$.disabled]), O = Jt.useMemo(() => ({ position: "absolute", inset: 0, width: L.willPushPWMBadge ? `calc(100% + ${L.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: L.willPushPWMBadge ? `inset(0 ${L.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: o, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [L.PWM_BADGE_SPACE_WIDTH, L.willPushPWMBadge, o]), Z = Jt.useMemo(() => Jt.createElement("input", _ee(xee({ autoComplete: $.autoComplete || "one-time-code" }, $), { "data-input-otp": !0, "data-input-otp-placeholder-shown": J.length === 0 || void 0, "data-input-otp-mss": M, "data-input-otp-mse": q, inputMode: u, pattern: E?.source, "aria-placeholder": f, style: O, maxLength: s, value: J, ref: b, onPaste: (ae) => { + }, [s, K, E, J]), ee = Jt.useMemo(() => ({ position: "relative", cursor: k.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [k.disabled]), O = Jt.useMemo(() => ({ position: "absolute", inset: 0, width: L.willPushPWMBadge ? `calc(100% + ${L.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: L.willPushPWMBadge ? `inset(0 ${L.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: o, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [L.PWM_BADGE_SPACE_WIDTH, L.willPushPWMBadge, o]), Z = Jt.useMemo(() => Jt.createElement("input", _ee(xee({ autoComplete: k.autoComplete || "one-time-code" }, k), { "data-input-otp": !0, "data-input-otp-placeholder-shown": J.length === 0 || void 0, "data-input-otp-mss": M, "data-input-otp-mse": q, inputMode: u, pattern: E?.source, "aria-placeholder": f, style: O, maxLength: s, value: J, ref: b, onPaste: (ae) => { var fe; - X(ae), (fe = $.onPaste) == null || fe.call($, ae); + X(ae), (fe = k.onPaste) == null || fe.call(k, ae); }, onChange: oe, onMouseOver: (ae) => { var fe; - P(!0), (fe = $.onMouseOver) == null || fe.call($, ae); + P(!0), (fe = k.onMouseOver) == null || fe.call(k, ae); }, onMouseLeave: (ae) => { var fe; - P(!1), (fe = $.onMouseLeave) == null || fe.call($, ae); + P(!1), (fe = k.onMouseLeave) == null || fe.call(k, ae); }, onFocus: (ae) => { var fe; - Q(), (fe = $.onFocus) == null || fe.call($, ae); + Q(), (fe = k.onFocus) == null || fe.call(k, ae); }, onBlur: (ae) => { var fe; - y(!1), (fe = $.onBlur) == null || fe.call($, ae); - } })), [oe, Q, X, u, O, s, q, M, $, E?.source, J]), re = Jt.useMemo(() => ({ slots: Array.from({ length: s }).map((ae, fe) => { + y(!1), (fe = k.onBlur) == null || fe.call(k, ae); + } })), [oe, Q, X, u, O, s, q, M, k, E?.source, J]), re = Jt.useMemo(() => ({ slots: Array.from({ length: s }).map((ae, fe) => { var be; let Ae = _ && M !== null && q !== null && (M === q && fe === M || fe >= M && fe < q), Te = J[fe] !== void 0 ? J[fe] : null, Re = J[0] !== void 0 ? null : (be = f?.[fe]) != null ? be : null; return { char: Te, placeholderChar: Re, isActive: Ae, hasFakeCaret: Ae && Te === null }; - }), isFocused: _, isHovering: !$.disabled && w }), [_, w, s, q, M, $.disabled, J]), he = Jt.useMemo(() => C ? C(re) : Jt.createElement(h9.Provider, { value: re }, D), [D, re, C]); + }), isFocused: _, isHovering: !k.disabled && w }), [_, w, s, q, M, k.disabled, J]), he = Jt.useMemo(() => C ? C(re) : Jt.createElement(h9.Provider, { value: re }, D), [D, re, C]); return Jt.createElement(Jt.Fragment, null, S !== null && Jt.createElement("noscript", null, Jt.createElement("style", null, S)), Jt.createElement("div", { ref: l, "data-input-otp-container": !0, style: ee, className: x }, he, Jt.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, Z))); }); d9.displayName = "Input"; @@ -39441,7 +39441,7 @@ function Nee() { var r = { 873: (o, a) => { var f, u, h = (function() { var g = function(l, p) { - var m = l, w = $[p], P = null, _ = 0, y = null, M = [], I = {}, q = function(re, he) { + var m = l, w = k[p], P = null, _ = 0, y = null, M = [], I = {}, q = function(re, he) { P = (function(ae) { for (var fe = new Array(ae), be = 0; be < ae; be += 1) { fe[be] = new Array(ae); @@ -39484,7 +39484,7 @@ function Nee() { } } }, O = function(re, he, ae) { - for (var fe = B.getRSBlocks(re, he), be = U(), Ae = 0; Ae < ae.length; Ae += 1) { + for (var fe = $.getRSBlocks(re, he), be = U(), Ae = 0; Ae < ae.length; Ae += 1) { var Te = ae[Ae]; be.put(Te.getMode(), 4), be.put(Te.getLength(), N.getLengthInBits(Te.getMode(), re)), Te.write(be); } @@ -39499,7 +39499,7 @@ function Nee() { ze = Math.max(ze, Ze), De = Math.max(De, ot), je[_e] = new Array(Ze); for (var ke = 0; ke < je[_e].length; ke += 1) je[_e][ke] = 255 & $e.getBuffer()[ke + Oe]; Oe += Ze; - var rt = N.getErrorCorrectPolynomial(ot), nt = k(je[_e], rt.getLength() - 1).mod(rt); + var rt = N.getErrorCorrectPolynomial(ot), nt = B(je[_e], rt.getLength() - 1).mod(rt); for (Ue[_e] = new Array(rt.getLength() - 1), ke = 0; ke < Ue[_e].length; ke += 1) { var Ge = ke + nt.getLength() - Ue[_e].length; Ue[_e][ke] = Ge >= 0 ? nt.getAt(Ge) : 0; @@ -39540,7 +39540,7 @@ function Nee() { }, I.make = function() { if (m < 1) { for (var re = 1; re < 40; re++) { - for (var he = B.getRSBlocks(re, w), ae = U(), fe = 0; fe < M.length; fe++) { + for (var he = $.getRSBlocks(re, w), ae = U(), fe = 0; fe < M.length; fe++) { var be = M[fe]; ae.put(be.getMode(), 4), ae.put(be.getLength(), N.getLengthInBits(be.getMode(), re)), be.write(ae); } @@ -39668,7 +39668,7 @@ function Nee() { return _; }; }; - var v, x, S, C, D, $ = { L: 1, M: 0, Q: 3, H: 2 }, N = (v = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], x = 1335, S = 7973, D = function(l) { + var v, x, S, C, D, k = { L: 1, M: 0, Q: 3, H: 2 }, N = (v = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], x = 1335, S = 7973, D = function(l) { for (var p = 0; l != 0; ) p += 1, l >>>= 1; return p; }, (C = {}).getBCHTypeInfo = function(l) { @@ -39717,7 +39717,7 @@ function Nee() { throw "bad maskPattern:" + l; } }, C.getErrorCorrectPolynomial = function(l) { - for (var p = k([1], 0), m = 0; m < l; m += 1) p = p.multiply(k([1, z.gexp(m)], 0)); + for (var p = B([1], 0), m = 0; m < l; m += 1) p = p.multiply(B([1, z.gexp(m)], 0)); return p; }, C.getLengthInBits = function(l, p) { if (1 <= p && p < 10) switch (l) { @@ -39785,7 +39785,7 @@ function Nee() { return l[w]; } }; })(); - function k(l, p) { + function B(l, p) { if (l.length === void 0) throw l.length + "/" + p; var m = (function() { for (var P = 0; P < l.length && l[P] == 0; ) P += 1; @@ -39797,29 +39797,29 @@ function Nee() { return m.length; }, multiply: function(P) { for (var _ = new Array(w.getLength() + P.getLength() - 1), y = 0; y < w.getLength(); y += 1) for (var M = 0; M < P.getLength(); M += 1) _[y + M] ^= z.gexp(z.glog(w.getAt(y)) + z.glog(P.getAt(M))); - return k(_, 0); + return B(_, 0); }, mod: function(P) { if (w.getLength() - P.getLength() < 0) return w; for (var _ = z.glog(w.getAt(0)) - z.glog(P.getAt(0)), y = new Array(w.getLength()), M = 0; M < w.getLength(); M += 1) y[M] = w.getAt(M); for (M = 0; M < P.getLength(); M += 1) y[M] ^= z.gexp(z.glog(P.getAt(M)) + _); - return k(y, 0).mod(P); + return B(y, 0).mod(P); } }; return w; } - var B = /* @__PURE__ */ (function() { + var $ = /* @__PURE__ */ (function() { var l = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12, 7, 37, 13], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]], p = function(w, P) { var _ = {}; return _.totalCount = w, _.dataCount = P, _; }, m = { getRSBlocks: function(w, P) { var _ = (function(Q, X) { switch (X) { - case $.L: + case k.L: return l[4 * (Q - 1) + 0]; - case $.M: + case k.M: return l[4 * (Q - 1) + 1]; - case $.Q: + case k.Q: return l[4 * (Q - 1) + 2]; - case $.H: + case k.H: return l[4 * (Q - 1) + 3]; default: return; @@ -40425,17 +40425,17 @@ function Nee() { } } D.instanceCount = 0; - const $ = D, N = "canvas", z = {}; + const k = D, N = "canvas", z = {}; for (let E = 0; E <= 40; E++) z[E] = E; - const k = { type: N, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: z[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: !0, hideBackgroundDots: !0, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: !0 }, backgroundOptions: { round: 0, color: "#fff" } }; - function B(E) { + const B = { type: N, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: z[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: !0, hideBackgroundDots: !0, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: !0 }, backgroundOptions: { round: 0, color: "#fff" } }; + function $(E) { const b = Object.assign({}, E); if (!b.colorStops || !b.colorStops.length) throw "Field 'colorStops' is required in gradient"; return b.rotation ? b.rotation = Number(b.rotation) : b.rotation = 0, b.colorStops = b.colorStops.map(((l) => Object.assign(Object.assign({}, l), { offset: Number(l.offset) }))), b; } function U(E) { const b = Object.assign({}, E); - return b.width = Number(b.width), b.height = Number(b.height), b.margin = Number(b.margin), b.imageOptions = Object.assign(Object.assign({}, b.imageOptions), { hideBackgroundDots: !!b.imageOptions.hideBackgroundDots, imageSize: Number(b.imageOptions.imageSize), margin: Number(b.imageOptions.margin) }), b.margin > Math.min(b.width, b.height) && (b.margin = Math.min(b.width, b.height)), b.dotsOptions = Object.assign({}, b.dotsOptions), b.dotsOptions.gradient && (b.dotsOptions.gradient = B(b.dotsOptions.gradient)), b.cornersSquareOptions && (b.cornersSquareOptions = Object.assign({}, b.cornersSquareOptions), b.cornersSquareOptions.gradient && (b.cornersSquareOptions.gradient = B(b.cornersSquareOptions.gradient))), b.cornersDotOptions && (b.cornersDotOptions = Object.assign({}, b.cornersDotOptions), b.cornersDotOptions.gradient && (b.cornersDotOptions.gradient = B(b.cornersDotOptions.gradient))), b.backgroundOptions && (b.backgroundOptions = Object.assign({}, b.backgroundOptions), b.backgroundOptions.gradient && (b.backgroundOptions.gradient = B(b.backgroundOptions.gradient))), b; + return b.width = Number(b.width), b.height = Number(b.height), b.margin = Number(b.margin), b.imageOptions = Object.assign(Object.assign({}, b.imageOptions), { hideBackgroundDots: !!b.imageOptions.hideBackgroundDots, imageSize: Number(b.imageOptions.imageSize), margin: Number(b.imageOptions.margin) }), b.margin > Math.min(b.width, b.height) && (b.margin = Math.min(b.width, b.height)), b.dotsOptions = Object.assign({}, b.dotsOptions), b.dotsOptions.gradient && (b.dotsOptions.gradient = $(b.dotsOptions.gradient)), b.cornersSquareOptions && (b.cornersSquareOptions = Object.assign({}, b.cornersSquareOptions), b.cornersSquareOptions.gradient && (b.cornersSquareOptions.gradient = $(b.cornersSquareOptions.gradient))), b.cornersDotOptions && (b.cornersDotOptions = Object.assign({}, b.cornersDotOptions), b.cornersDotOptions.gradient && (b.cornersDotOptions.gradient = $(b.cornersDotOptions.gradient))), b.backgroundOptions && (b.backgroundOptions = Object.assign({}, b.backgroundOptions), b.backgroundOptions.gradient && (b.backgroundOptions.gradient = $(b.backgroundOptions.gradient))), b; } var R = i(873), W = i.n(R); function J(E) { @@ -40447,14 +40447,14 @@ function Nee() { } class ne { constructor(b) { - b?.jsdom ? this._window = new b.jsdom("", { resources: "usable" }).window : this._window = window, this._options = b ? U(a(k, b)) : k, this.update(); + b?.jsdom ? this._window = new b.jsdom("", { resources: "usable" }).window : this._window = window, this._options = b ? U(a(B, b)) : B, this.update(); } static _clearContainer(b) { b && (b.innerHTML = ""); } _setupSvg() { if (!this._qr) return; - const b = new $(this._options, this._window); + const b = new k(this._options, this._window); this._svg = b.getElement(), this._svgDrawingPromise = b.drawQR(this._qr).then((() => { var l; this._svg && ((l = this._extension) === null || l === void 0 || l.call(this, b.getElement(), this._options)); @@ -40641,15 +40641,15 @@ function y9(t) { `Provided value: ${u}` ] }); - const $ = t.statement; - if ($?.includes(` + const k = t.statement; + if (k?.includes(` `)) throw new Ro({ field: "statement", metaMessages: [ "- Statement must not include '\\n'.", "", - `Provided value: ${$}` + `Provided value: ${k}` ] }); } @@ -40667,7 +40667,7 @@ Issued At: ${i.toISOString()}`; Expiration Time: ${n.toISOString()}`), o && (D += ` Not Before: ${o.toISOString()}`), a && (D += ` Request ID: ${a}`), f) { - let $ = ` + let k = ` Resources:`; for (const N of f) { if (!N5(N)) @@ -40680,10 +40680,10 @@ Resources:`; `Provided value: ${N}` ] }); - $ += ` + k += ` - ${N}`; } - D += $; + D += k; } return `${C} ${D}`; @@ -40727,7 +40727,7 @@ function Hee(t, e) { }); } function x9(t) { - const e = Kn(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Xt(""), [a, f] = Xt(!1), [u, h] = Xt(""), [g, v] = Xt("scan"), x = Kn(), [S, C] = Xt(r.config?.image), [D, $] = Xt(!1), { saveLastUsedWallet: N } = g0(); + const e = Kn(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Xt(""), [a, f] = Xt(!1), [u, h] = Xt(""), [g, v] = Xt("scan"), x = Kn(), [S, C] = Xt(r.config?.image), [D, k] = Xt(!1), { saveLastUsedWallet: N } = g0(); async function z(J) { f(!0); const ne = await NW.init(qee); @@ -40758,7 +40758,7 @@ function x9(t) { console.log("err", K), h(K.details || K.message); } } - function k() { + function B() { x.current = new b9({ width: 264, height: 264, @@ -40777,24 +40777,24 @@ function x9(t) { } }), x.current.append(e.current); } - function B(J) { + function $(J) { console.log(x.current), x.current?.update({ data: J }); } Rn(() => { - s && B(s); + s && $(s); }, [s]), Rn(() => { z(r); }, [r]), Rn(() => { - k(); + B(); }, []); function U() { - h(""), B(""), z(r); + h(""), $(""), z(r); } function R() { - $(!0), navigator.clipboard.writeText(s), setTimeout(() => { - $(!1); + k(!0), navigator.clipboard.writeText(s), setTimeout(() => { + k(!1); }, 2500); } function W() { @@ -40909,14 +40909,14 @@ function _9(t) { const x = await n.connect(); if (!x || x.length === 0) throw new Error("Wallet connect error"); - const S = await n.getChain(), C = u.find((k) => k.id === S), D = C || u[0] || Wee; + const S = await n.getChain(), C = u.find((B) => B.id === S), D = C || u[0] || Wee; !C && u.length > 0 && (a("switch-chain"), await n.switchChain(D)); - const $ = e1(x[0]), N = Gee($, v, D.id); + const k = e1(x[0]), N = Gee(k, v, D.id); a("sign"); - const z = await n.signMessage(N, $); + const z = await n.signMessage(N, k); if (!z || z.length === 0) throw new Error("user sign error"); - a("waiting"), await i(n, { address: $, signature: z, message: N, nonce: v, wallet_name: n.config?.name || "" }), f(n); + a("waiting"), await i(n, { address: k, signature: z, message: N, nonce: v, wallet_name: n.config?.name || "" }), f(n); } catch (x) { console.log("walletSignin error", x.stack), console.log(x.details || x.message), r(x.details || x.message); } @@ -41177,7 +41177,7 @@ function ate() { function D(H, V, Y, T) { return C(H, V, Y, T, 16); } - function $(H, V, Y, T) { + function k(H, V, Y, T) { return C(H, V, Y, T, 32); } function N(H, V, Y, T) { @@ -41190,10 +41190,10 @@ function ate() { ge = gt + Lt | 0, ut ^= ge << 7 | ge >>> 25, ge = ut + gt | 0, Ke ^= ge << 9 | ge >>> 23, ge = Ke + ut | 0, Lt ^= ge << 13 | ge >>> 19, ge = Lt + Ke | 0, gt ^= ge << 18 | ge >>> 14, ge = it + _t | 0, Fe ^= ge << 7 | ge >>> 25, ge = Fe + it | 0, zt ^= ge << 9 | ge >>> 23, ge = zt + Fe | 0, _t ^= ge << 13 | ge >>> 19, ge = _t + zt | 0, it ^= ge << 18 | ge >>> 14, ge = qe + Se | 0, Zt ^= ge << 7 | ge >>> 25, ge = Zt + qe | 0, at ^= ge << 9 | ge >>> 23, ge = at + Zt | 0, Se ^= ge << 13 | ge >>> 19, ge = Se + at | 0, qe ^= ge << 18 | ge >>> 14, ge = Ht + Ye | 0, yt ^= ge << 7 | ge >>> 25, ge = yt + Ht | 0, Pe ^= ge << 9 | ge >>> 23, ge = Pe + yt | 0, Ye ^= ge << 13 | ge >>> 19, ge = Ye + Pe | 0, Ht ^= ge << 18 | ge >>> 14, ge = gt + yt | 0, _t ^= ge << 7 | ge >>> 25, ge = _t + gt | 0, at ^= ge << 9 | ge >>> 23, ge = at + _t | 0, yt ^= ge << 13 | ge >>> 19, ge = yt + at | 0, gt ^= ge << 18 | ge >>> 14, ge = it + ut | 0, Se ^= ge << 7 | ge >>> 25, ge = Se + it | 0, Pe ^= ge << 9 | ge >>> 23, ge = Pe + Se | 0, ut ^= ge << 13 | ge >>> 19, ge = ut + Pe | 0, it ^= ge << 18 | ge >>> 14, ge = qe + Fe | 0, Ye ^= ge << 7 | ge >>> 25, ge = Ye + qe | 0, Ke ^= ge << 9 | ge >>> 23, ge = Ke + Ye | 0, Fe ^= ge << 13 | ge >>> 19, ge = Fe + Ke | 0, qe ^= ge << 18 | ge >>> 14, ge = Ht + Zt | 0, Lt ^= ge << 7 | ge >>> 25, ge = Lt + Ht | 0, zt ^= ge << 9 | ge >>> 23, ge = zt + Lt | 0, Zt ^= ge << 13 | ge >>> 19, ge = Zt + zt | 0, Ht ^= ge << 18 | ge >>> 14; H[0] = gt >>> 0 & 255, H[1] = gt >>> 8 & 255, H[2] = gt >>> 16 & 255, H[3] = gt >>> 24 & 255, H[4] = it >>> 0 & 255, H[5] = it >>> 8 & 255, H[6] = it >>> 16 & 255, H[7] = it >>> 24 & 255, H[8] = qe >>> 0 & 255, H[9] = qe >>> 8 & 255, H[10] = qe >>> 16 & 255, H[11] = qe >>> 24 & 255, H[12] = Ht >>> 0 & 255, H[13] = Ht >>> 8 & 255, H[14] = Ht >>> 16 & 255, H[15] = Ht >>> 24 & 255, H[16] = Se >>> 0 & 255, H[17] = Se >>> 8 & 255, H[18] = Se >>> 16 & 255, H[19] = Se >>> 24 & 255, H[20] = Pe >>> 0 & 255, H[21] = Pe >>> 8 & 255, H[22] = Pe >>> 16 & 255, H[23] = Pe >>> 24 & 255, H[24] = Ke >>> 0 & 255, H[25] = Ke >>> 8 & 255, H[26] = Ke >>> 16 & 255, H[27] = Ke >>> 24 & 255, H[28] = Fe >>> 0 & 255, H[29] = Fe >>> 8 & 255, H[30] = Fe >>> 16 & 255, H[31] = Fe >>> 24 & 255; } - function k(H, V, Y, T) { + function B(H, V, Y, T) { N(H, V, Y, T); } - function B(H, V, Y, T) { + function $(H, V, Y, T) { z(H, V, Y, T); } var U = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); @@ -41202,13 +41202,13 @@ function ate() { for (Ie = 0; Ie < 16; Ie++) me[Ie] = 0; for (Ie = 0; Ie < 8; Ie++) me[Ie] = ie[Ie]; for (; F >= 64; ) { - for (k(Ee, me, le, U), Ie = 0; Ie < 64; Ie++) H[V + Ie] = Y[T + Ie] ^ Ee[Ie]; + for (B(Ee, me, le, U), Ie = 0; Ie < 64; Ie++) H[V + Ie] = Y[T + Ie] ^ Ee[Ie]; for (Le = 1, Ie = 8; Ie < 16; Ie++) Le = Le + (me[Ie] & 255) | 0, me[Ie] = Le & 255, Le >>>= 8; F -= 64, V += 64, T += 64; } if (F > 0) - for (k(Ee, me, le, U), Ie = 0; Ie < F; Ie++) H[V + Ie] = Y[T + Ie] ^ Ee[Ie]; + for (B(Ee, me, le, U), Ie = 0; Ie < F; Ie++) H[V + Ie] = Y[T + Ie] ^ Ee[Ie]; return 0; } function W(H, V, Y, T, F) { @@ -41216,24 +41216,24 @@ function ate() { for (Ee = 0; Ee < 16; Ee++) ie[Ee] = 0; for (Ee = 0; Ee < 8; Ee++) ie[Ee] = T[Ee]; for (; Y >= 64; ) { - for (k(le, ie, F, U), Ee = 0; Ee < 64; Ee++) H[V + Ee] = le[Ee]; + for (B(le, ie, F, U), Ee = 0; Ee < 64; Ee++) H[V + Ee] = le[Ee]; for (me = 1, Ee = 8; Ee < 16; Ee++) me = me + (ie[Ee] & 255) | 0, ie[Ee] = me & 255, me >>>= 8; Y -= 64, V += 64; } if (Y > 0) - for (k(le, ie, F, U), Ee = 0; Ee < Y; Ee++) H[V + Ee] = le[Ee]; + for (B(le, ie, F, U), Ee = 0; Ee < Y; Ee++) H[V + Ee] = le[Ee]; return 0; } function J(H, V, Y, T, F) { var ie = new Uint8Array(32); - B(ie, T, F, U); + $(ie, T, F, U); for (var le = new Uint8Array(8), me = 0; me < 8; me++) le[me] = T[me + 16]; return W(H, V, Y, le, ie); } function ne(H, V, Y, T, F, ie, le) { var me = new Uint8Array(32); - B(me, ie, le, U); + $(me, ie, le, U); for (var Ee = new Uint8Array(8), Le = 0; Le < 8; Le++) Ee[Le] = ie[Le + 16]; return R(H, V, Y, T, F, Ee, me); } @@ -41323,7 +41323,7 @@ function ate() { } function y(H, V) { var Y = new Uint8Array(32), T = new Uint8Array(32); - return _(Y, H), _(T, V), $(Y, 0, T, 0); + return _(Y, H), _(T, V), k(Y, 0, T, 0); } function M(H) { var V = new Uint8Array(32); @@ -41381,7 +41381,7 @@ function ate() { } function re(H, V, Y) { var T = new Uint8Array(32); - return ee(T, Y, V), B(H, i, T, U); + return ee(T, Y, V), $(H, i, T, U); } var he = l, ae = p; function fe(H, V, Y, T, F, ie) { @@ -41642,7 +41642,7 @@ function ate() { if (Y < 64 || ke(Ee, T)) return -1; for (F = 0; F < Y; F++) H[F] = V[F]; for (F = 0; F < 32; F++) H[F + 32] = T[F]; - if (Re(le, H, Y), Ze(le), ze(me, Ee, le), De(Ee, V.subarray(32)), $e(me, Ee), Oe(ie, me), Y -= 64, $(V, 0, ie, 0)) { + if (Re(le, H, Y), Ze(le), ze(me, Ee, le), De(Ee, V.subarray(32)), $e(me, Ee), Oe(ie, me), Y -= 64, k(V, 0, ie, 0)) { for (F = 0; F < Y; F++) H[F] = 0; return -1; } @@ -41651,7 +41651,7 @@ function ate() { } var nt = 32, Ge = 24, ht = 32, lt = 16, ct = 32, qt = 32, Gt = 32, Et = 32, Yt = 32, tr = Ge, Tt = ht, kt = lt, It = 64, dt = 32, Dt = 64, Nt = 32, mt = 64; e.lowlevel = { - crypto_core_hsalsa20: B, + crypto_core_hsalsa20: $, crypto_stream_xor: ne, crypto_stream: J, crypto_stream_salsa20_xor: R, @@ -41659,7 +41659,7 @@ function ate() { crypto_onetimeauth: E, crypto_onetimeauth_verify: b, crypto_verify_16: D, - crypto_verify_32: $, + crypto_verify_32: k, crypto_secretbox: l, crypto_secretbox_open: p, crypto_scalarmult: ee, @@ -43947,7 +43947,7 @@ function T9(t) { data: W }); } - async function $() { + async function k() { x(!0); try { a(""); @@ -43990,19 +43990,19 @@ function T9(t) { request: { tonProof: f } }); } - function k() { + function B() { if ("deepLink" in e) { if (!e.deepLink || !S) return; const W = new URL(S), J = `${e.deepLink}${W.search}`; window.open(J); } } - function B() { + function $() { "universalLink" in e && e.universalLink && /t.me/.test(e.universalLink) && window.open(S); } const U = hi(() => !!("deepLink" in e && e.deepLink), [e]), R = hi(() => !!("universalLink" in e && e.universalLink && /t.me/.test(e.universalLink)), [e]); return Rn(() => { - N(), $(); + N(), k(); }, []), /* @__PURE__ */ pe.jsxs(ps, { children: [ /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6", children: /* @__PURE__ */ pe.jsx(Ja, { title: "Connect wallet", onBack: t.onBack }) }), /* @__PURE__ */ pe.jsxs("div", { className: "xc-text-center xc-mb-6", children: [ @@ -44019,11 +44019,11 @@ function T9(t) { /* @__PURE__ */ pe.jsx(rY, { className: "xc-opacity-80" }), "Extension" ] }), - U && /* @__PURE__ */ pe.jsxs(Lm, { onClick: k, children: [ + U && /* @__PURE__ */ pe.jsxs(Lm, { onClick: B, children: [ /* @__PURE__ */ pe.jsx(AS, { className: "xc-opacity-80" }), "Desktop" ] }), - R && /* @__PURE__ */ pe.jsx(Lm, { onClick: B, children: "Telegram Mini App" }) + R && /* @__PURE__ */ pe.jsx(Lm, { onClick: $, children: "Telegram Mini App" }) ] }) ] }) ] }); @@ -44150,14 +44150,14 @@ function O9(t) { } function dne(t) { const { onLogin: e, header: r, showEmailSignIn: n = !0, showMoreWallets: i = !0, showTonConnect: s = !0, showFeaturedWallets: o = !0 } = t, [a, f] = Xt(""), [u, h] = Xt(null), [g, v] = Xt(""); - function x($) { - h($), f("evm-wallet"); + function x(k) { + h(k), f("evm-wallet"); } - function S($) { - f("email"), v($); + function S(k) { + f("email"), v(k); } - async function C($) { - await e($); + async function C(k) { + await e(k); } function D() { f("ton-wallet"); @@ -44243,87 +44243,88 @@ function sre(t) { ] }); } function pne(t) { - const { onEvmWalletConnect: e, onTonWalletConnect: r, onEmailConnect: n, config: i = { + const { onEvmWalletConnect: e, onTonWalletConnect: r, onEmailConnect: n, header: i, config: s = { showEmailSignIn: !1, showFeaturedWallets: !0, showMoreWallets: !0, showTonConnect: !0 - } } = t, [s, o] = Xt(""), [a, f] = Xt(), [u, h] = Xt(), g = Kn(), [v, x] = Xt(""); - function S(k) { - f(k), o("evm-wallet-connect"); + } } = t, [o, a] = Xt(""), [f, u] = Xt(), [h, g] = Xt(), v = Kn(), [x, S] = Xt(""); + function C($) { + u($), a("evm-wallet-connect"); } - function C(k) { - x(k), o("email-connect"); + function D($) { + S($), a("email-connect"); } - async function D(k, B) { + async function k($, U) { await e?.({ chain_type: "eip155", - client: k.client, - connect_info: B, - wallet: k - }), o("index"); + client: $.client, + connect_info: U, + wallet: $ + }), a("index"); } - async function $(k, B) { - await n?.(k, B); + async function N($, U) { + await n?.($, U); } - function N(k) { - h(k), o("ton-wallet-connect"); + function z($) { + g($), a("ton-wallet-connect"); } - async function z(k) { - k && await r?.({ + async function B($) { + $ && await r?.({ chain_type: "ton", - client: g.current, - connect_info: k, - wallet: k + client: v.current, + connect_info: $, + wallet: $ }); } return Rn(() => { - g.current = new ml({ + v.current = new ml({ manifestUrl: "https://static.codatta.io/static/tonconnect-manifest.json?v=2" }); - const k = g.current.onStatusChange(z); - return o("index"), k; + const $ = v.current.onStatusChange(B); + return a("index"), $; }, []), /* @__PURE__ */ pe.jsxs(D9, { className: "xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white", children: [ - s === "evm-wallet-select" && /* @__PURE__ */ pe.jsx( + o === "evm-wallet-select" && /* @__PURE__ */ pe.jsx( O9, { - onBack: () => o("index"), - onSelectWallet: S + onBack: () => a("index"), + onSelectWallet: C } ), - s === "evm-wallet-connect" && /* @__PURE__ */ pe.jsx( + o === "evm-wallet-connect" && /* @__PURE__ */ pe.jsx( ire, { - onBack: () => o("index"), - onConnect: D, - wallet: a + onBack: () => a("index"), + onConnect: k, + wallet: f } ), - s === "ton-wallet-select" && /* @__PURE__ */ pe.jsx( + o === "ton-wallet-select" && /* @__PURE__ */ pe.jsx( S9, { - connector: g.current, - onSelect: N, - onBack: () => o("index") + connector: v.current, + onSelect: z, + onBack: () => a("index") } ), - s === "ton-wallet-connect" && /* @__PURE__ */ pe.jsx( + o === "ton-wallet-connect" && /* @__PURE__ */ pe.jsx( T9, { - connector: g.current, - wallet: u, - onBack: () => o("index") + connector: v.current, + wallet: h, + onBack: () => a("index") } ), - s === "email-connect" && /* @__PURE__ */ pe.jsx(sre, { email: v, onBack: () => o("index"), onInputCode: $ }), - s === "index" && /* @__PURE__ */ pe.jsx( + o === "email-connect" && /* @__PURE__ */ pe.jsx(sre, { email: x, onBack: () => a("index"), onInputCode: N }), + o === "index" && /* @__PURE__ */ pe.jsx( a9, { - onEmailConfirm: C, - onSelectWallet: S, - onSelectMoreWallets: () => o("evm-wallet-select"), - onSelectTonConnect: () => o("ton-wallet-select"), - config: i + header: i, + onEmailConfirm: D, + onSelectWallet: C, + onSelectMoreWallets: () => a("evm-wallet-select"), + onSelectTonConnect: () => a("ton-wallet-select"), + config: s } ) ] }); diff --git a/dist/secp256k1-DbKZjSuc.js b/dist/secp256k1-K3HVP1eD.js similarity index 99% rename from dist/secp256k1-DbKZjSuc.js rename to dist/secp256k1-K3HVP1eD.js index 746d1a9..c506b01 100644 --- a/dist/secp256k1-DbKZjSuc.js +++ b/dist/secp256k1-K3HVP1eD.js @@ -1,4 +1,4 @@ -import { h as xt, i as Tt, a as at, b as st, c as F, H as Jt, d as te, t as ee, e as ne, f as qt, g as re, r as oe, s as ie } from "./main-D60MaR66.js"; +import { h as xt, i as Tt, a as at, b as st, c as F, H as Jt, d as te, t as ee, e as ne, f as qt, g as re, r as oe, s as ie } from "./main-DmP-7EWG.js"; /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const St = /* @__PURE__ */ BigInt(0), Et = /* @__PURE__ */ BigInt(1); function lt(e, n) { diff --git a/lib/codatta-connect.tsx b/lib/codatta-connect.tsx index 63df861..5cce031 100644 --- a/lib/codatta-connect.tsx +++ b/lib/codatta-connect.tsx @@ -29,6 +29,7 @@ export function CodattaConnect(props: { onEvmWalletConnect?: (connectInfo:EmvWalletConnectInfo) => Promise onTonWalletConnect?: (connectInfo:TonWalletConnectInfo) => Promise onEmailConnect?: (email:string, code:string) => Promise + header?: React.ReactNode config?: { showEmailSignIn?: boolean showFeaturedWallets?: boolean @@ -36,7 +37,7 @@ export function CodattaConnect(props: { showTonConnect?: boolean } }) { - const { onEvmWalletConnect, onTonWalletConnect, onEmailConnect, config = { + const { onEvmWalletConnect, onTonWalletConnect, onEmailConnect, header, config = { showEmailSignIn: false, showFeaturedWallets: true, showMoreWallets: true, @@ -132,6 +133,7 @@ export function CodattaConnect(props: { )} {step === 'index' && ( setStep('evm-wallet-select')} diff --git a/package.json b/package.json index 05e2620..33859bb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codatta-connect", - "version": "2.7.6", + "version": "2.7.9", "type": "module", "main": "./dist/index.umd.js", "module": "./dist/index.es.js", From f46e8cc9d3c06a911849c349047bc81695d704cc Mon Sep 17 00:00:00 2001 From: Meow Lord Date: Mon, 22 Sep 2025 17:56:36 +0800 Subject: [PATCH 25/25] feat: fix single wallet --- dist/components/signin-index.d.ts | 1 + dist/index.es.js | 2 +- dist/index.umd.js | 4 +- dist/{main-DmP-7EWG.js => main-CtRNJ0s5.js} | 1621 +++++++++-------- ...56k1-K3HVP1eD.js => secp256k1-C66jOJWb.js} | 2 +- lib/codatta-connect.tsx | 1 + lib/codatta-signin.tsx | 1 + lib/components/email-connect-widget.tsx | 2 +- lib/components/signin-index.tsx | 85 +- package.json | 2 +- src/layout/app-layout.tsx | 2 +- src/views/login-view.tsx | 3 +- 12 files changed, 865 insertions(+), 861 deletions(-) rename dist/{main-DmP-7EWG.js => main-CtRNJ0s5.js} (97%) rename dist/{secp256k1-K3HVP1eD.js => secp256k1-C66jOJWb.js} (99%) diff --git a/dist/components/signin-index.d.ts b/dist/components/signin-index.d.ts index 94b3761..399bb94 100644 --- a/dist/components/signin-index.d.ts +++ b/dist/components/signin-index.d.ts @@ -5,6 +5,7 @@ export default function SingInIndex(props: { onSelectWallet: (walletOption: WalletItem) => void; onSelectMoreWallets: () => void; onSelectTonConnect: () => void; + useSingleWallet: boolean; config: { showEmailSignIn?: boolean; showTonConnect?: boolean; diff --git a/dist/index.es.js b/dist/index.es.js index 2e45526..5c32103 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -1,4 +1,4 @@ -import { l as o, C as e, k as n, W as C, j as s, u as d } from "./main-DmP-7EWG.js"; +import { l as o, C as e, k as n, W as C, j as s, u as d } from "./main-CtRNJ0s5.js"; export { o as CodattaConnect, e as CodattaConnectContextProvider, diff --git a/dist/index.umd.js b/dist/index.umd.js index 088a452..8e81c5a 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -199,7 +199,7 @@ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opene top: ${f}px !important; left: ${u}px !important; } - `),()=>{document.head.removeChild(h)}},[e]),he.jsx(cG,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const fG=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=M1(lG),f=Se.useId(),u=Se.useCallback(g=>{a.set(g,!0);for(const b of a.values())if(!b)return;n&&n()},[a,n]),h=Se.useMemo(()=>({id:f,initial:e,isPresent:r,custom:i,onExitComplete:u,register:g=>(a.set(g,!1),()=>a.delete(g))}),s?[Math.random(),u]:[r,u]);return Se.useMemo(()=>{a.forEach((g,b)=>a.set(b,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=he.jsx(uG,{isPresent:r,children:t})),he.jsx(Nd.Provider,{value:h,children:t})};function lG(){return new Map}const $d=t=>t.key||"";function RS(t){const e=[];return Se.Children.forEach(t,r=>{Se.isValidElement(r)&&e.push(r)}),e}const hG=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{ro(!e,"Replace exitBeforeEnter with mode='wait'");const a=Se.useMemo(()=>RS(t),[t]),f=a.map($d),u=Se.useRef(!0),h=Se.useRef(a),g=M1(()=>new Map),[b,x]=Se.useState(a),[S,C]=Se.useState(a);uS(()=>{u.current=!1,h.current=a;for(let L=0;L1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:B}=Se.useContext(m1);return he.jsx(he.Fragment,{children:S.map(L=>{const H=$d(L),F=a===S||f.includes(H),k=()=>{if(g.has(H))g.set(H,!0);else return;let $=!0;g.forEach(R=>{R||($=!1)}),$&&(B?.(),C(h.current),i&&i())};return he.jsx(fG,{isPresent:F,initial:!u.current||n?void 0:!1,custom:F?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:F?void 0:k,children:L},H)})})},ls=t=>he.jsx(hG,{children:he.jsx(aG.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function N1(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return he.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,he.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[he.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),he.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:he.jsx(Lz,{})})]})]})}function dG(t){return t.lastUsed?he.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[he.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?he.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[he.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function TS(t){const{wallet:e,onClick:r}=t,n=he.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.config?.image}),i=e.config?.name||"",s=Se.useMemo(()=>dG(e),[e]);return he.jsx(N1,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function DS(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=bG(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(L1);return a[0]===""&&a.length!==1&&a.shift(),OS(a,e)||vG(o)},getConflictingClassGroupIds:(o,a)=>{const f=r[o]||[];return a&&n[o]?[...f,...n[o]]:f}}},OS=(t,e)=>{if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?OS(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(L1);return e.validators.find(({validator:o})=>o(s))?.classGroupId},NS=/^\[(.+)\]$/,vG=t=>{if(NS.test(t)){const e=NS.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},bG=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return wG(Object.entries(t.classGroups),r).forEach(([s,o])=>{k1(o,n,s,e)}),n},k1=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:LS(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(yG(i)){k1(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{k1(o,LS(e,s),r,n)})})},LS=(t,e)=>{let r=t;return e.split(L1).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},yG=t=>t.isThemeGetter,wG=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,xG=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},kS="!",_G=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const f=[];let u=0,h=0,g;for(let D=0;Dh?g-h:void 0;return{modifiers:f,hasImportantModifier:x,baseClassName:S,maybePostfixModifierPosition:C}};return r?a=>r({className:a,parseClassName:o}):o},EG=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},SG=t=>({cache:xG(t.cacheSize),parseClassName:_G(t),...mG(t)}),AG=/\s+/,PG=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(AG);let a="";for(let f=o.length-1;f>=0;f-=1){const u=o[f],{modifiers:h,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:x}=r(u);let S=!!x,C=n(S?b.substring(0,x):b);if(!C){if(!S){a=u+(a.length>0?" "+a:a);continue}if(C=n(b),!C){a=u+(a.length>0?" "+a:a);continue}S=!1}const D=EG(h).join(":"),B=g?D+kS:D,L=B+C;if(s.includes(L))continue;s.push(L);const H=i(C,S);for(let F=0;F0?" "+a:a)}return a};function IG(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;ng(h),t());return r=SG(u),n=r.cache.get,i=r.cache.set,s=a,a(f)}function a(f){const u=n(f);if(u)return u;const h=PG(f,r);return i(f,h),h}return function(){return s(IG.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},FS=/^\[(?:([a-z-]+):)?(.+)\]$/i,CG=/^\d+\/\d+$/,RG=new Set(["px","full","screen"]),TG=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,DG=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,OG=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,NG=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,LG=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,oo=t=>Hc(t)||RG.has(t)||CG.test(t),Ho=t=>Wc(t,"length",zG),Hc=t=>!!t&&!Number.isNaN(Number(t)),B1=t=>Wc(t,"number",Hc),il=t=>!!t&&Number.isInteger(Number(t)),kG=t=>t.endsWith("%")&&Hc(t.slice(0,-1)),cr=t=>FS.test(t),Wo=t=>TG.test(t),BG=new Set(["length","size","percentage"]),FG=t=>Wc(t,BG,jS),jG=t=>Wc(t,"position",jS),UG=new Set(["image","url"]),$G=t=>Wc(t,UG,WG),qG=t=>Wc(t,"",HG),sl=()=>!0,Wc=(t,e,r)=>{const n=FS.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},zG=t=>DG.test(t)&&!OG.test(t),jS=()=>!1,HG=t=>NG.test(t),WG=t=>LG.test(t),KG=MG(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),f=Gr("contrast"),u=Gr("grayscale"),h=Gr("hueRotate"),g=Gr("invert"),b=Gr("gap"),x=Gr("gradientColorStops"),S=Gr("gradientColorStopPositions"),C=Gr("inset"),D=Gr("margin"),B=Gr("opacity"),L=Gr("padding"),H=Gr("saturate"),F=Gr("scale"),k=Gr("sepia"),$=Gr("skew"),R=Gr("space"),W=Gr("translate"),V=()=>["auto","contain","none"],X=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto",cr,e],_=()=>[cr,e],v=()=>["",oo,Ho],l=()=>["auto",Hc,cr],p=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],m=()=>["solid","dashed","dotted","double","none"],y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],A=()=>["start","end","center","between","around","evenly","stretch"],E=()=>["","0",cr],w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>[Hc,cr];return{cacheSize:500,separator:":",theme:{colors:[sl],spacing:[oo,Ho],blur:["none","",Wo,cr],brightness:I(),borderColor:[t],borderRadius:["none","","full",Wo,cr],borderSpacing:_(),borderWidth:v(),contrast:I(),grayscale:E(),hueRotate:I(),invert:E(),gap:_(),gradientColorStops:[t],gradientColorStopPositions:[kG,Ho],inset:q(),margin:q(),opacity:I(),padding:_(),saturate:I(),scale:I(),sepia:E(),skew:I(),space:_(),translate:_()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Wo]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...p(),cr]}],overflow:[{overflow:X()}],"overflow-x":[{"overflow-x":X()}],"overflow-y":[{"overflow-y":X()}],overscroll:[{overscroll:V()}],"overscroll-x":[{"overscroll-x":V()}],"overscroll-y":[{"overscroll-y":V()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[C]}],"inset-x":[{"inset-x":[C]}],"inset-y":[{"inset-y":[C]}],start:[{start:[C]}],end:[{end:[C]}],top:[{top:[C]}],right:[{right:[C]}],bottom:[{bottom:[C]}],left:[{left:[C]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",il,cr]}],basis:[{basis:q()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:E()}],shrink:[{shrink:E()}],order:[{order:["first","last","none",il,cr]}],"grid-cols":[{"grid-cols":[sl]}],"col-start-end":[{col:["auto",{span:["full",il,cr]},cr]}],"col-start":[{"col-start":l()}],"col-end":[{"col-end":l()}],"grid-rows":[{"grid-rows":[sl]}],"row-start-end":[{row:["auto",{span:[il,cr]},cr]}],"row-start":[{"row-start":l()}],"row-end":[{"row-end":l()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[b]}],"gap-x":[{"gap-x":[b]}],"gap-y":[{"gap-y":[b]}],"justify-content":[{justify:["normal",...A()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...A(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...A(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[L]}],px:[{px:[L]}],py:[{py:[L]}],ps:[{ps:[L]}],pe:[{pe:[L]}],pt:[{pt:[L]}],pr:[{pr:[L]}],pb:[{pb:[L]}],pl:[{pl:[L]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Wo]},Wo]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Wo,Ho]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",B1]}],"font-family":[{font:[sl]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Hc,B1]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",oo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[B]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[B]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...m(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",oo,Ho]}],"underline-offset":[{"underline-offset":["auto",oo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[B]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...p(),jG]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",FG]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},$G]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[S]}],"gradient-via-pos":[{via:[S]}],"gradient-to-pos":[{to:[S]}],"gradient-from":[{from:[x]}],"gradient-via":[{via:[x]}],"gradient-to":[{to:[x]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[B]}],"border-style":[{border:[...m(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[B]}],"divide-style":[{divide:m()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...m()]}],"outline-offset":[{"outline-offset":[oo,cr]}],"outline-w":[{outline:[oo,Ho]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:v()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[B]}],"ring-offset-w":[{"ring-offset":[oo,Ho]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Wo,qG]}],"shadow-color":[{shadow:[sl]}],opacity:[{opacity:[B]}],"mix-blend":[{"mix-blend":[...y(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":y()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[f]}],"drop-shadow":[{"drop-shadow":["","none",Wo,cr]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[g]}],saturate:[{saturate:[H]}],sepia:[{sepia:[k]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[f]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[B]}],"backdrop-saturate":[{"backdrop-saturate":[H]}],"backdrop-sepia":[{"backdrop-sepia":[k]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:I()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:I()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[F]}],"scale-x":[{"scale-x":[F]}],"scale-y":[{"scale-y":[F]}],rotate:[{rotate:[il,cr]}],"translate-x":[{"translate-x":[W]}],"translate-y":[{"translate-y":[W]}],"skew-x":[{"skew-x":[$]}],"skew-y":[{"skew-y":[$]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[oo,Ho,B1]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function ao(...t){return KG(gG(t))}function US(t){const{className:e}=t;return he.jsxs("div",{className:ao("xc-flex xc-items-center xc-gap-2"),children:[he.jsx("hr",{className:ao("xc-flex-1 xc-border-gray-200",e)}),he.jsx("div",{className:"xc-shrink-0",children:t.children}),he.jsx("hr",{className:ao("xc-flex-1 xc-border-gray-200",e)})]})}function VG(t){const{wallet:e,onClick:r}=t;return he.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[he.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:e.config?.image,alt:""}),he.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[he.jsxs("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:["Connect to ",e.config?.name]}),he.jsx("div",{className:"xc-flex xc-gap-2",children:he.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:()=>r(e),children:"Connect"})})]})]})}const GG="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function YG(t){const{onClick:e}=t;function r(){e&&e()}return he.jsx(US,{className:"xc-opacity-20",children:he.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[he.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),he.jsx(U4,{size:16})]})})}function $S(t){const[e,r]=Se.useState(""),{featuredWallets:n,initialized:i}=Hf(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:f,config:u}=t,h=Se.useMemo(()=>{const C=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!C.test(e)&&D.test(e)},[e]);function g(C){o(C)}function b(C){r(C.target.value)}async function x(){s(e)}function S(C){C.key==="Enter"&&h&&x()}return he.jsx(ls,{children:i&&he.jsxs(he.Fragment,{children:[t.header||he.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),n.length===1&&he.jsx("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:n.map(C=>he.jsx(VG,{wallet:C,onClick:g},`feature-${C.key}`))}),n.length>1&&he.jsxs(he.Fragment,{children:[he.jsxs("div",{children:[he.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[u.showFeaturedWallets&&n&&n.map(C=>he.jsx(TS,{wallet:C,onClick:g},`feature-${C.key}`)),u.showTonConnect&&he.jsx(N1,{icon:he.jsx("img",{className:"xc-h-5 xc-w-5",src:GG}),title:"TON Connect",onClick:f})]}),u.showMoreWallets&&he.jsx(YG,{onClick:a})]}),u.showEmailSignIn&&(u.showFeaturedWallets||u.showTonConnect)&&he.jsx("div",{className:"xc-mb-4 xc-mt-4",children:he.jsxs(US,{className:"xc-opacity-20",children:[" ",he.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),u.showEmailSignIn&&he.jsxs("div",{className:"xc-mb-4",children:[he.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:b,onKeyDown:S}),he.jsx("button",{disabled:!h,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:x,children:"Continue"})]})]})]})})}function Wa(t){const{title:e}=t;return he.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[he.jsx(Nz,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),he.jsx("span",{children:e})]})}const qS=Se.createContext({channel:"",device:"WEB",app:"",inviterCode:"",role:"C"});function F1(){return Se.useContext(qS)}function JG(t){const{config:e}=t,[r,n]=Se.useState(e.channel),[i,s]=Se.useState(e.device),[o,a]=Se.useState(e.app),[f,u]=Se.useState(e.role||"C"),[h,g]=Se.useState(e.inviterCode);return Se.useEffect(()=>{n(e.channel),s(e.device),a(e.app),g(e.inviterCode),u(e.role||"C")},[e]),he.jsx(qS.Provider,{value:{channel:r,device:i,app:o,inviterCode:h,role:f},children:t.children})}var XG=Object.defineProperty,ZG=Object.defineProperties,QG=Object.getOwnPropertyDescriptors,qd=Object.getOwnPropertySymbols,zS=Object.prototype.hasOwnProperty,HS=Object.prototype.propertyIsEnumerable,WS=(t,e,r)=>e in t?XG(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,eY=(t,e)=>{for(var r in e||(e={}))zS.call(e,r)&&WS(t,r,e[r]);if(qd)for(var r of qd(e))HS.call(e,r)&&WS(t,r,e[r]);return t},tY=(t,e)=>ZG(t,QG(e)),rY=(t,e)=>{var r={};for(var n in t)zS.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&qd)for(var n of qd(t))e.indexOf(n)<0&&HS.call(t,n)&&(r[n]=t[n]);return r};function nY(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function iY(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var sY=18,KS=40,oY=`${KS}px`,aY=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function cY({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[f,u]=Yt.useState(!1),h=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),g=Yt.useCallback(()=>{let b=t.current,x=e.current;if(!b||!x||f||r==="none")return;let S=b,C=S.getBoundingClientRect().left+S.offsetWidth,D=S.getBoundingClientRect().top+S.offsetHeight/2,B=C-sY,L=D;document.querySelectorAll(aY).length===0&&document.elementFromPoint(B,L)===b||(s(!0),u(!0))},[t,e,f,r]);return Yt.useEffect(()=>{let b=t.current;if(!b||r==="none")return;function x(){let C=window.innerWidth-b.getBoundingClientRect().right;a(C>=KS)}x();let S=setInterval(x,1e3);return()=>{clearInterval(S)}},[t,r]),Yt.useEffect(()=>{let b=n||document.activeElement===e.current;if(r==="none"||!b)return;let x=setTimeout(g,0),S=setTimeout(g,2e3),C=setTimeout(g,5e3),D=setTimeout(()=>{u(!0)},6e3);return()=>{clearTimeout(x),clearTimeout(S),clearTimeout(C),clearTimeout(D)}},[e,n,r,g]),{hasPWMBadge:i,willPushPWMBadge:h,PWM_BADGE_SPACE_WIDTH:oY}}var VS=Yt.createContext({}),GS=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:f,inputMode:u="numeric",onComplete:h,pushPasswordManagerStrategy:g="increase-width",pasteTransformer:b,containerClassName:x,noScriptCSSFallback:S=uY,render:C,children:D}=r,B=rY(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),L,H,F,k,$;let[R,W]=Yt.useState(typeof B.defaultValue=="string"?B.defaultValue:""),V=n??R,X=iY(V),q=Yt.useCallback(ce=>{i?.(ce),W(ce)},[i]),_=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),v=Yt.useRef(null),l=Yt.useRef(null),p=Yt.useRef({value:V,onChange:q,isIOS:typeof window<"u"&&((H=(L=window?.CSS)==null?void 0:L.supports)==null?void 0:H.call(L,"-webkit-touch-callout","none"))}),m=Yt.useRef({prev:[(F=v.current)==null?void 0:F.selectionStart,(k=v.current)==null?void 0:k.selectionEnd,($=v.current)==null?void 0:$.selectionDirection]});Yt.useImperativeHandle(e,()=>v.current,[]),Yt.useEffect(()=>{let ce=v.current,fe=l.current;if(!ce||!fe)return;p.current.value!==ce.value&&p.current.onChange(ce.value),m.current.prev=[ce.selectionStart,ce.selectionEnd,ce.selectionDirection];function be(){if(document.activeElement!==ce){M(null),se(null);return}let Te=ce.selectionStart,Fe=ce.selectionEnd,Me=ce.selectionDirection,Ne=ce.maxLength,He=ce.value,Oe=m.current.prev,$e=-1,qe=-1,_e;if(He.length!==0&&Te!==null&&Fe!==null){let nt=Te===Fe,it=Te===He.length&&He.length1&&He.length>1){let pt=0;if(Oe[0]!==null&&Oe[1]!==null){_e=Ye{fe&&fe.style.setProperty("--root-height",`${ce.clientHeight}px`)};Pe();let De=new ResizeObserver(Pe);return De.observe(ce),()=>{document.removeEventListener("selectionchange",be,{capture:!0}),De.disconnect()}},[]);let[y,A]=Yt.useState(!1),[E,w]=Yt.useState(!1),[I,M]=Yt.useState(null),[z,se]=Yt.useState(null);Yt.useEffect(()=>{nY(()=>{var ce,fe,be,Pe;(ce=v.current)==null||ce.dispatchEvent(new Event("input"));let De=(fe=v.current)==null?void 0:fe.selectionStart,Te=(be=v.current)==null?void 0:be.selectionEnd,Fe=(Pe=v.current)==null?void 0:Pe.selectionDirection;De!==null&&Te!==null&&(M(De),se(Te),m.current.prev=[De,Te,Fe])})},[V,E]),Yt.useEffect(()=>{X!==void 0&&V!==X&&X.length{let fe=ce.currentTarget.value.slice(0,s);if(fe.length>0&&_&&!_.test(fe)){ce.preventDefault();return}typeof X=="string"&&fe.length{var ce;if(v.current){let fe=Math.min(v.current.value.length,s-1),be=v.current.value.length;(ce=v.current)==null||ce.setSelectionRange(fe,be),M(fe),se(be)}w(!0)},[s]),Z=Yt.useCallback(ce=>{var fe,be;let Pe=v.current;if(!b&&(!p.current.isIOS||!ce.clipboardData||!Pe))return;let De=ce.clipboardData.getData("text/plain"),Te=b?b(De):De;console.log({_content:De,content:Te}),ce.preventDefault();let Fe=(fe=v.current)==null?void 0:fe.selectionStart,Me=(be=v.current)==null?void 0:be.selectionEnd,Ne=(Fe!==Me?V.slice(0,Fe)+Te+V.slice(Me):V.slice(0,Fe)+Te+V.slice(Fe)).slice(0,s);if(Ne.length>0&&_&&!_.test(Ne))return;Pe.value=Ne,q(Ne);let He=Math.min(Ne.length,s-1),Oe=Ne.length;Pe.setSelectionRange(He,Oe),M(He),se(Oe)},[s,q,_,V]),te=Yt.useMemo(()=>({position:"relative",cursor:B.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[B.disabled]),N=Yt.useMemo(()=>({position:"absolute",inset:0,width:O.willPushPWMBadge?`calc(100% + ${O.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:O.willPushPWMBadge?`inset(0 ${O.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[O.PWM_BADGE_SPACE_WIDTH,O.willPushPWMBadge,o]),Q=Yt.useMemo(()=>Yt.createElement("input",tY(eY({autoComplete:B.autoComplete||"one-time-code"},B),{"data-input-otp":!0,"data-input-otp-placeholder-shown":V.length===0||void 0,"data-input-otp-mss":I,"data-input-otp-mse":z,inputMode:u,pattern:_?.source,"aria-placeholder":f,style:N,maxLength:s,value:V,ref:v,onPaste:ce=>{var fe;Z(ce),(fe=B.onPaste)==null||fe.call(B,ce)},onChange:ie,onMouseOver:ce=>{var fe;A(!0),(fe=B.onMouseOver)==null||fe.call(B,ce)},onMouseLeave:ce=>{var fe;A(!1),(fe=B.onMouseLeave)==null||fe.call(B,ce)},onFocus:ce=>{var fe;ee(),(fe=B.onFocus)==null||fe.call(B,ce)},onBlur:ce=>{var fe;w(!1),(fe=B.onBlur)==null||fe.call(B,ce)}})),[ie,ee,Z,u,N,s,z,I,B,_?.source,V]),ne=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ce,fe)=>{var be;let Pe=E&&I!==null&&z!==null&&(I===z&&fe===I||fe>=I&&feC?C(ne):Yt.createElement(VS.Provider,{value:ne},D),[D,ne,C]);return Yt.createElement(Yt.Fragment,null,S!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,S)),Yt.createElement("div",{ref:l,"data-input-otp-container":!0,style:te,className:x},de,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Q)))});GS.displayName="Input";function ol(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var uY=` + `),()=>{document.head.removeChild(h)}},[e]),he.jsx(cG,{isPresent:e,childRef:n,sizeRef:i,children:Yt.cloneElement(t,{ref:n})})}const fG=({children:t,initial:e,isPresent:r,onExitComplete:n,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=M1(lG),f=Se.useId(),u=Se.useCallback(g=>{a.set(g,!0);for(const b of a.values())if(!b)return;n&&n()},[a,n]),h=Se.useMemo(()=>({id:f,initial:e,isPresent:r,custom:i,onExitComplete:u,register:g=>(a.set(g,!1),()=>a.delete(g))}),s?[Math.random(),u]:[r,u]);return Se.useMemo(()=>{a.forEach((g,b)=>a.set(b,!1))},[r]),Yt.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(t=he.jsx(uG,{isPresent:r,children:t})),he.jsx(Nd.Provider,{value:h,children:t})};function lG(){return new Map}const $d=t=>t.key||"";function RS(t){const e=[];return Se.Children.forEach(t,r=>{Se.isValidElement(r)&&e.push(r)}),e}const hG=({children:t,exitBeforeEnter:e,custom:r,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{ro(!e,"Replace exitBeforeEnter with mode='wait'");const a=Se.useMemo(()=>RS(t),[t]),f=a.map($d),u=Se.useRef(!0),h=Se.useRef(a),g=M1(()=>new Map),[b,x]=Se.useState(a),[S,C]=Se.useState(a);uS(()=>{u.current=!1,h.current=a;for(let L=0;L1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:B}=Se.useContext(m1);return he.jsx(he.Fragment,{children:S.map(L=>{const H=$d(L),F=a===S||f.includes(H),k=()=>{if(g.has(H))g.set(H,!0);else return;let $=!0;g.forEach(R=>{R||($=!1)}),$&&(B?.(),C(h.current),i&&i())};return he.jsx(fG,{isPresent:F,initial:!u.current||n?void 0:!1,custom:F?void 0:r,presenceAffectsLayout:s,mode:o,onExitComplete:F?void 0:k,children:L},H)})})},ls=t=>he.jsx(hG,{children:he.jsx(aG.div,{initial:{x:0,opacity:0},animate:{x:0,opacity:1},exit:{x:30,opacity:0},transition:{duration:.3},className:t.className,children:t.children})});function N1(t){const{icon:e,title:r,extra:n,onClick:i}=t;function s(){i&&i()}return he.jsxs("div",{className:"xc-rounded-lg xc-group xc-flex xc-cursor-pointer xc-items-center xc-gap-2 xc-border xc-border-white xc-border-opacity-15 xc-px-4 xc-py-2 xc-transition-all hover:xc-shadow-lg",onClick:s,children:[e,r,he.jsxs("div",{className:"xc-relative xc-ml-auto xc-h-6",children:[he.jsx("div",{className:"xc-relative xc-left-0 xc-opacity-100 xc-transition-all group-hover:xc-left-2 group-hover:xc-opacity-0",children:n}),he.jsx("div",{className:"xc-absolute xc-right-2 xc-top-0 xc-text-gray-400 xc-opacity-0 xc-transition-all group-hover:xc-right-0 group-hover:xc-opacity-100",children:he.jsx(Lz,{})})]})]})}function dG(t){return t.lastUsed?he.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[he.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#009E8C]"}),"Last Used"]}):t.installed?he.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-rounded-full xc-py-1 xc-text-xs xc-text-gray-500",children:[he.jsx("div",{className:"xc-h-1 xc-w-1 xc-rounded-full xc-bg-[#2596FF]"}),"Installed"]}):null}function TS(t){const{wallet:e,onClick:r}=t,n=he.jsx("img",{className:"xc-rounded-md xc-h-5 xc-w-5",src:e.config?.image}),i=e.config?.name||"",s=Se.useMemo(()=>dG(e),[e]);return he.jsx(N1,{icon:n,title:i,extra:s,onClick:()=>r(e)})}function DS(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=bG(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const a=o.split(L1);return a[0]===""&&a.length!==1&&a.shift(),OS(a,e)||vG(o)},getConflictingClassGroupIds:(o,a)=>{const f=r[o]||[];return a&&n[o]?[...f,...n[o]]:f}}},OS=(t,e)=>{if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?OS(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(L1);return e.validators.find(({validator:o})=>o(s))?.classGroupId},NS=/^\[(.+)\]$/,vG=t=>{if(NS.test(t)){const e=NS.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},bG=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return wG(Object.entries(t.classGroups),r).forEach(([s,o])=>{k1(o,n,s,e)}),n},k1=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:LS(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(yG(i)){k1(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,o])=>{k1(o,LS(e,s),r,n)})})},LS=(t,e)=>{let r=t;return e.split(L1).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},yG=t=>t.isThemeGetter,wG=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[r,i]}):t,xG=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,o)=>{r.set(s,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){r.has(s)?r.set(s,o):i(s,o)}}},kS="!",_G=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,o=a=>{const f=[];let u=0,h=0,g;for(let D=0;Dh?g-h:void 0;return{modifiers:f,hasImportantModifier:x,baseClassName:S,maybePostfixModifierPosition:C}};return r?a=>r({className:a,parseClassName:o}):o},EG=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},SG=t=>({cache:xG(t.cacheSize),parseClassName:_G(t),...mG(t)}),AG=/\s+/,PG=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(AG);let a="";for(let f=o.length-1;f>=0;f-=1){const u=o[f],{modifiers:h,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:x}=r(u);let S=!!x,C=n(S?b.substring(0,x):b);if(!C){if(!S){a=u+(a.length>0?" "+a:a);continue}if(C=n(b),!C){a=u+(a.length>0?" "+a:a);continue}S=!1}const D=EG(h).join(":"),B=g?D+kS:D,L=B+C;if(s.includes(L))continue;s.push(L);const H=i(C,S);for(let F=0;F0?" "+a:a)}return a};function IG(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;ng(h),t());return r=SG(u),n=r.cache.get,i=r.cache.set,s=a,a(f)}function a(f){const u=n(f);if(u)return u;const h=PG(f,r);return i(f,h),h}return function(){return s(IG.apply(null,arguments))}}const Gr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},FS=/^\[(?:([a-z-]+):)?(.+)\]$/i,CG=/^\d+\/\d+$/,RG=new Set(["px","full","screen"]),TG=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,DG=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,OG=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,NG=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,LG=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,oo=t=>Hc(t)||RG.has(t)||CG.test(t),Ho=t=>Wc(t,"length",zG),Hc=t=>!!t&&!Number.isNaN(Number(t)),B1=t=>Wc(t,"number",Hc),il=t=>!!t&&Number.isInteger(Number(t)),kG=t=>t.endsWith("%")&&Hc(t.slice(0,-1)),cr=t=>FS.test(t),Wo=t=>TG.test(t),BG=new Set(["length","size","percentage"]),FG=t=>Wc(t,BG,jS),jG=t=>Wc(t,"position",jS),UG=new Set(["image","url"]),$G=t=>Wc(t,UG,WG),qG=t=>Wc(t,"",HG),sl=()=>!0,Wc=(t,e,r)=>{const n=FS.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},zG=t=>DG.test(t)&&!OG.test(t),jS=()=>!1,HG=t=>NG.test(t),WG=t=>LG.test(t),KG=MG(()=>{const t=Gr("colors"),e=Gr("spacing"),r=Gr("blur"),n=Gr("brightness"),i=Gr("borderColor"),s=Gr("borderRadius"),o=Gr("borderSpacing"),a=Gr("borderWidth"),f=Gr("contrast"),u=Gr("grayscale"),h=Gr("hueRotate"),g=Gr("invert"),b=Gr("gap"),x=Gr("gradientColorStops"),S=Gr("gradientColorStopPositions"),C=Gr("inset"),D=Gr("margin"),B=Gr("opacity"),L=Gr("padding"),H=Gr("saturate"),F=Gr("scale"),k=Gr("sepia"),$=Gr("skew"),R=Gr("space"),W=Gr("translate"),V=()=>["auto","contain","none"],X=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto",cr,e],_=()=>[cr,e],v=()=>["",oo,Ho],l=()=>["auto",Hc,cr],p=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],m=()=>["solid","dashed","dotted","double","none"],y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],A=()=>["start","end","center","between","around","evenly","stretch"],E=()=>["","0",cr],w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>[Hc,cr];return{cacheSize:500,separator:":",theme:{colors:[sl],spacing:[oo,Ho],blur:["none","",Wo,cr],brightness:I(),borderColor:[t],borderRadius:["none","","full",Wo,cr],borderSpacing:_(),borderWidth:v(),contrast:I(),grayscale:E(),hueRotate:I(),invert:E(),gap:_(),gradientColorStops:[t],gradientColorStopPositions:[kG,Ho],inset:q(),margin:q(),opacity:I(),padding:_(),saturate:I(),scale:I(),sepia:E(),skew:I(),space:_(),translate:_()},classGroups:{aspect:[{aspect:["auto","square","video",cr]}],container:["container"],columns:[{columns:[Wo]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...p(),cr]}],overflow:[{overflow:X()}],"overflow-x":[{"overflow-x":X()}],"overflow-y":[{"overflow-y":X()}],overscroll:[{overscroll:V()}],"overscroll-x":[{"overscroll-x":V()}],"overscroll-y":[{"overscroll-y":V()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[C]}],"inset-x":[{"inset-x":[C]}],"inset-y":[{"inset-y":[C]}],start:[{start:[C]}],end:[{end:[C]}],top:[{top:[C]}],right:[{right:[C]}],bottom:[{bottom:[C]}],left:[{left:[C]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",il,cr]}],basis:[{basis:q()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",cr]}],grow:[{grow:E()}],shrink:[{shrink:E()}],order:[{order:["first","last","none",il,cr]}],"grid-cols":[{"grid-cols":[sl]}],"col-start-end":[{col:["auto",{span:["full",il,cr]},cr]}],"col-start":[{"col-start":l()}],"col-end":[{"col-end":l()}],"grid-rows":[{"grid-rows":[sl]}],"row-start-end":[{row:["auto",{span:[il,cr]},cr]}],"row-start":[{"row-start":l()}],"row-end":[{"row-end":l()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",cr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",cr]}],gap:[{gap:[b]}],"gap-x":[{"gap-x":[b]}],"gap-y":[{"gap-y":[b]}],"justify-content":[{justify:["normal",...A()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...A(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...A(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[L]}],px:[{px:[L]}],py:[{py:[L]}],ps:[{ps:[L]}],pe:[{pe:[L]}],pt:[{pt:[L]}],pr:[{pr:[L]}],pb:[{pb:[L]}],pl:[{pl:[L]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",cr,e]}],"min-w":[{"min-w":[cr,e,"min","max","fit"]}],"max-w":[{"max-w":[cr,e,"none","full","min","max","fit","prose",{screen:[Wo]},Wo]}],h:[{h:[cr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[cr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[cr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Wo,Ho]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",B1]}],"font-family":[{font:[sl]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",cr]}],"line-clamp":[{"line-clamp":["none",Hc,B1]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",oo,cr]}],"list-image":[{"list-image":["none",cr]}],"list-style-type":[{list:["none","disc","decimal",cr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[B]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[B]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...m(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",oo,Ho]}],"underline-offset":[{"underline-offset":["auto",oo,cr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",cr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",cr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[B]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...p(),jG]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",FG]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},$G]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[S]}],"gradient-via-pos":[{via:[S]}],"gradient-to-pos":[{to:[S]}],"gradient-from":[{from:[x]}],"gradient-via":[{via:[x]}],"gradient-to":[{to:[x]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[B]}],"border-style":[{border:[...m(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[B]}],"divide-style":[{divide:m()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...m()]}],"outline-offset":[{"outline-offset":[oo,cr]}],"outline-w":[{outline:[oo,Ho]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:v()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[B]}],"ring-offset-w":[{"ring-offset":[oo,Ho]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Wo,qG]}],"shadow-color":[{shadow:[sl]}],opacity:[{opacity:[B]}],"mix-blend":[{"mix-blend":[...y(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":y()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[f]}],"drop-shadow":[{"drop-shadow":["","none",Wo,cr]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[g]}],saturate:[{saturate:[H]}],sepia:[{sepia:[k]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[f]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[B]}],"backdrop-saturate":[{"backdrop-saturate":[H]}],"backdrop-sepia":[{"backdrop-sepia":[k]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",cr]}],duration:[{duration:I()}],ease:[{ease:["linear","in","out","in-out",cr]}],delay:[{delay:I()}],animate:[{animate:["none","spin","ping","pulse","bounce",cr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[F]}],"scale-x":[{"scale-x":[F]}],"scale-y":[{"scale-y":[F]}],rotate:[{rotate:[il,cr]}],"translate-x":[{"translate-x":[W]}],"translate-y":[{"translate-y":[W]}],"skew-x":[{"skew-x":[$]}],"skew-y":[{"skew-y":[$]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",cr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",cr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",cr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[oo,Ho,B1]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function ao(...t){return KG(gG(t))}function US(t){const{className:e}=t;return he.jsxs("div",{className:ao("xc-flex xc-items-center xc-gap-2"),children:[he.jsx("hr",{className:ao("xc-flex-1 xc-border-gray-200",e)}),he.jsx("div",{className:"xc-shrink-0",children:t.children}),he.jsx("hr",{className:ao("xc-flex-1 xc-border-gray-200",e)})]})}function VG(t){const{wallet:e,onClick:r}=t;return he.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center xc-justify-center xc-gap-4",children:[he.jsx("img",{className:"xc-rounded-md xc-h-16 xc-w-16",src:e.config?.image,alt:""}),he.jsxs("div",{className:"xc-flex xc-flex-col xc-items-center",children:[he.jsxs("p",{className:"xc-text-danger xc-mb-2 xc-text-center",children:["Connect to ",e.config?.name]}),he.jsx("div",{className:"xc-flex xc-gap-2",children:he.jsx("button",{className:"xc-rounded-full xc-bg-white xc-bg-opacity-10 xc-px-6 xc-py-1",onClick:()=>r(e),children:"Connect"})})]})]})}const GG="https://static.codatta.io/codatta-connect/wallet-icons.svg?v=2#ton";function YG(t){const{onClick:e}=t;function r(){e&&e()}return he.jsx(US,{className:"xc-opacity-20",children:he.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2 xc-cursor-pointer",onClick:r,children:[he.jsx("span",{className:"xc-text-sm",children:"View more wallets"}),he.jsx(U4,{size:16})]})})}function $S(t){const[e,r]=Se.useState(""),{featuredWallets:n,initialized:i}=Hf(),{onEmailConfirm:s,onSelectWallet:o,onSelectMoreWallets:a,onSelectTonConnect:f,config:u,useSingleWallet:h}=t,g=Se.useMemo(()=>{const D=/[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu,B=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!D.test(e)&&B.test(e)},[e]);function b(D){o(D)}function x(D){r(D.target.value)}async function S(){s(e)}function C(D){D.key==="Enter"&&g&&S()}return he.jsx(ls,{children:i&&he.jsxs(he.Fragment,{children:[t.header||he.jsx("div",{className:"xc-mb-6 xc-text-xl xc-font-bold",children:"Log in or sign up"}),n.length===1&&h?he.jsx("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:n.map(D=>he.jsx(VG,{wallet:D,onClick:b},`feature-${D.key}`))}):he.jsxs(he.Fragment,{children:[he.jsxs("div",{children:[he.jsxs("div",{className:"xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:[u.showFeaturedWallets&&n&&n.map(D=>he.jsx(TS,{wallet:D,onClick:b},`feature-${D.key}`)),u.showTonConnect&&he.jsx(N1,{icon:he.jsx("img",{className:"xc-h-5 xc-w-5",src:GG}),title:"TON Connect",onClick:f})]}),u.showMoreWallets&&he.jsx(YG,{onClick:a})]}),u.showEmailSignIn&&(u.showFeaturedWallets||u.showTonConnect)&&he.jsx("div",{className:"xc-mb-4 xc-mt-4",children:he.jsxs(US,{className:"xc-opacity-20",children:[" ",he.jsx("span",{className:"xc-text-sm xc-opacity-20",children:"OR"})]})}),u.showEmailSignIn&&he.jsxs("div",{className:"xc-mb-4",children:[he.jsx("input",{className:"xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3",placeholder:"Enter your email",type:"email",onChange:x,onKeyDown:C}),he.jsx("button",{disabled:!g,className:"xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all",onClick:S,children:"Continue"})]})]})]})})}function Wa(t){const{title:e}=t;return he.jsxs("div",{className:"xc-flex xc-items-center xc-gap-2",children:[he.jsx(Nz,{onClick:t.onBack,size:20,className:"xc-cursor-pointer"}),he.jsx("span",{children:e})]})}const qS=Se.createContext({channel:"",device:"WEB",app:"",inviterCode:"",role:"C"});function F1(){return Se.useContext(qS)}function JG(t){const{config:e}=t,[r,n]=Se.useState(e.channel),[i,s]=Se.useState(e.device),[o,a]=Se.useState(e.app),[f,u]=Se.useState(e.role||"C"),[h,g]=Se.useState(e.inviterCode);return Se.useEffect(()=>{n(e.channel),s(e.device),a(e.app),g(e.inviterCode),u(e.role||"C")},[e]),he.jsx(qS.Provider,{value:{channel:r,device:i,app:o,inviterCode:h,role:f},children:t.children})}var XG=Object.defineProperty,ZG=Object.defineProperties,QG=Object.getOwnPropertyDescriptors,qd=Object.getOwnPropertySymbols,zS=Object.prototype.hasOwnProperty,HS=Object.prototype.propertyIsEnumerable,WS=(t,e,r)=>e in t?XG(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,eY=(t,e)=>{for(var r in e||(e={}))zS.call(e,r)&&WS(t,r,e[r]);if(qd)for(var r of qd(e))HS.call(e,r)&&WS(t,r,e[r]);return t},tY=(t,e)=>ZG(t,QG(e)),rY=(t,e)=>{var r={};for(var n in t)zS.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&qd)for(var n of qd(t))e.indexOf(n)<0&&HS.call(t,n)&&(r[n]=t[n]);return r};function nY(t){let e=setTimeout(t,0),r=setTimeout(t,10),n=setTimeout(t,50);return[e,r,n]}function iY(t){let e=Yt.useRef();return Yt.useEffect(()=>{e.current=t}),e.current}var sY=18,KS=40,oY=`${KS}px`,aY=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function cY({containerRef:t,inputRef:e,pushPasswordManagerStrategy:r,isFocused:n}){let[i,s]=Yt.useState(!1),[o,a]=Yt.useState(!1),[f,u]=Yt.useState(!1),h=Yt.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&i&&o,[i,o,r]),g=Yt.useCallback(()=>{let b=t.current,x=e.current;if(!b||!x||f||r==="none")return;let S=b,C=S.getBoundingClientRect().left+S.offsetWidth,D=S.getBoundingClientRect().top+S.offsetHeight/2,B=C-sY,L=D;document.querySelectorAll(aY).length===0&&document.elementFromPoint(B,L)===b||(s(!0),u(!0))},[t,e,f,r]);return Yt.useEffect(()=>{let b=t.current;if(!b||r==="none")return;function x(){let C=window.innerWidth-b.getBoundingClientRect().right;a(C>=KS)}x();let S=setInterval(x,1e3);return()=>{clearInterval(S)}},[t,r]),Yt.useEffect(()=>{let b=n||document.activeElement===e.current;if(r==="none"||!b)return;let x=setTimeout(g,0),S=setTimeout(g,2e3),C=setTimeout(g,5e3),D=setTimeout(()=>{u(!0)},6e3);return()=>{clearTimeout(x),clearTimeout(S),clearTimeout(C),clearTimeout(D)}},[e,n,r,g]),{hasPWMBadge:i,willPushPWMBadge:h,PWM_BADGE_SPACE_WIDTH:oY}}var VS=Yt.createContext({}),GS=Yt.forwardRef((t,e)=>{var r=t,{value:n,onChange:i,maxLength:s,textAlign:o="left",pattern:a,placeholder:f,inputMode:u="numeric",onComplete:h,pushPasswordManagerStrategy:g="increase-width",pasteTransformer:b,containerClassName:x,noScriptCSSFallback:S=uY,render:C,children:D}=r,B=rY(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),L,H,F,k,$;let[R,W]=Yt.useState(typeof B.defaultValue=="string"?B.defaultValue:""),V=n??R,X=iY(V),q=Yt.useCallback(ce=>{i?.(ce),W(ce)},[i]),_=Yt.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),v=Yt.useRef(null),l=Yt.useRef(null),p=Yt.useRef({value:V,onChange:q,isIOS:typeof window<"u"&&((H=(L=window?.CSS)==null?void 0:L.supports)==null?void 0:H.call(L,"-webkit-touch-callout","none"))}),m=Yt.useRef({prev:[(F=v.current)==null?void 0:F.selectionStart,(k=v.current)==null?void 0:k.selectionEnd,($=v.current)==null?void 0:$.selectionDirection]});Yt.useImperativeHandle(e,()=>v.current,[]),Yt.useEffect(()=>{let ce=v.current,fe=l.current;if(!ce||!fe)return;p.current.value!==ce.value&&p.current.onChange(ce.value),m.current.prev=[ce.selectionStart,ce.selectionEnd,ce.selectionDirection];function be(){if(document.activeElement!==ce){M(null),se(null);return}let Te=ce.selectionStart,Fe=ce.selectionEnd,Me=ce.selectionDirection,Ne=ce.maxLength,He=ce.value,Oe=m.current.prev,$e=-1,qe=-1,_e;if(He.length!==0&&Te!==null&&Fe!==null){let nt=Te===Fe,it=Te===He.length&&He.length1&&He.length>1){let pt=0;if(Oe[0]!==null&&Oe[1]!==null){_e=Ye{fe&&fe.style.setProperty("--root-height",`${ce.clientHeight}px`)};Pe();let De=new ResizeObserver(Pe);return De.observe(ce),()=>{document.removeEventListener("selectionchange",be,{capture:!0}),De.disconnect()}},[]);let[y,A]=Yt.useState(!1),[E,w]=Yt.useState(!1),[I,M]=Yt.useState(null),[z,se]=Yt.useState(null);Yt.useEffect(()=>{nY(()=>{var ce,fe,be,Pe;(ce=v.current)==null||ce.dispatchEvent(new Event("input"));let De=(fe=v.current)==null?void 0:fe.selectionStart,Te=(be=v.current)==null?void 0:be.selectionEnd,Fe=(Pe=v.current)==null?void 0:Pe.selectionDirection;De!==null&&Te!==null&&(M(De),se(Te),m.current.prev=[De,Te,Fe])})},[V,E]),Yt.useEffect(()=>{X!==void 0&&V!==X&&X.length{let fe=ce.currentTarget.value.slice(0,s);if(fe.length>0&&_&&!_.test(fe)){ce.preventDefault();return}typeof X=="string"&&fe.length{var ce;if(v.current){let fe=Math.min(v.current.value.length,s-1),be=v.current.value.length;(ce=v.current)==null||ce.setSelectionRange(fe,be),M(fe),se(be)}w(!0)},[s]),Z=Yt.useCallback(ce=>{var fe,be;let Pe=v.current;if(!b&&(!p.current.isIOS||!ce.clipboardData||!Pe))return;let De=ce.clipboardData.getData("text/plain"),Te=b?b(De):De;console.log({_content:De,content:Te}),ce.preventDefault();let Fe=(fe=v.current)==null?void 0:fe.selectionStart,Me=(be=v.current)==null?void 0:be.selectionEnd,Ne=(Fe!==Me?V.slice(0,Fe)+Te+V.slice(Me):V.slice(0,Fe)+Te+V.slice(Fe)).slice(0,s);if(Ne.length>0&&_&&!_.test(Ne))return;Pe.value=Ne,q(Ne);let He=Math.min(Ne.length,s-1),Oe=Ne.length;Pe.setSelectionRange(He,Oe),M(He),se(Oe)},[s,q,_,V]),te=Yt.useMemo(()=>({position:"relative",cursor:B.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[B.disabled]),N=Yt.useMemo(()=>({position:"absolute",inset:0,width:O.willPushPWMBadge?`calc(100% + ${O.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:O.willPushPWMBadge?`inset(0 ${O.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[O.PWM_BADGE_SPACE_WIDTH,O.willPushPWMBadge,o]),Q=Yt.useMemo(()=>Yt.createElement("input",tY(eY({autoComplete:B.autoComplete||"one-time-code"},B),{"data-input-otp":!0,"data-input-otp-placeholder-shown":V.length===0||void 0,"data-input-otp-mss":I,"data-input-otp-mse":z,inputMode:u,pattern:_?.source,"aria-placeholder":f,style:N,maxLength:s,value:V,ref:v,onPaste:ce=>{var fe;Z(ce),(fe=B.onPaste)==null||fe.call(B,ce)},onChange:ie,onMouseOver:ce=>{var fe;A(!0),(fe=B.onMouseOver)==null||fe.call(B,ce)},onMouseLeave:ce=>{var fe;A(!1),(fe=B.onMouseLeave)==null||fe.call(B,ce)},onFocus:ce=>{var fe;ee(),(fe=B.onFocus)==null||fe.call(B,ce)},onBlur:ce=>{var fe;w(!1),(fe=B.onBlur)==null||fe.call(B,ce)}})),[ie,ee,Z,u,N,s,z,I,B,_?.source,V]),ne=Yt.useMemo(()=>({slots:Array.from({length:s}).map((ce,fe)=>{var be;let Pe=E&&I!==null&&z!==null&&(I===z&&fe===I||fe>=I&&feC?C(ne):Yt.createElement(VS.Provider,{value:ne},D),[D,ne,C]);return Yt.createElement(Yt.Fragment,null,S!==null&&Yt.createElement("noscript",null,Yt.createElement("style",null,S)),Yt.createElement("div",{ref:l,"data-input-otp-container":!0,style:te,className:x},de,Yt.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Q)))});GS.displayName="Input";function ol(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var uY=` [data-input-otp] { --nojs-bg: white !important; --nojs-fg: black !important; @@ -255,4 +255,4 @@ ${D}`}const mY=/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(: OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */function GY(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new $t("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new $t("Delay aborted"))})})})}function hs(t){const e=new AbortController;return t?.aborted?e.abort():t?.addEventListener("abort",()=>e.abort(),{once:!0}),e}function cl(t,e){var r,n;return At(this,void 0,void 0,function*(){const i=(r=e?.attempts)!==null&&r!==void 0?r:10,s=(n=e?.delayMs)!==null&&n!==void 0?n:200,o=hs(e?.signal);if(typeof t!="function")throw new $t(`Expected a function, got ${typeof t}`);let a=0,f;for(;aAt(this,void 0,void 0,function*(){if(s=g??null,o?.abort(),o=hs(g),o.signal.aborted)throw new $t("Resource creation was aborted");n=b??null;const x=t(o.signal,...b);i=x;const S=yield x;if(i!==x&&S!==r)throw yield e(S),new $t("Resource creation was aborted by a new resource creation");return r=S,r});return{create:a,current:()=>r??null,dispose:()=>At(this,void 0,void 0,function*(){try{const g=r;r=null;const b=i;i=null;try{o?.abort()}catch{}yield Promise.allSettled([g?e(g):Promise.resolve(),b?e(yield b):Promise.resolve()])}catch{}}),recreate:g=>At(this,void 0,void 0,function*(){const b=r,x=i,S=n,C=s;if(yield b7(g),b===r&&x===i&&S===n&&C===s)return yield a(s,...S??[]);throw new $t("Resource recreation was aborted by a new resource creation")})}}function oJ(t,e){const r=e?.timeout,n=e?.signal,i=hs(n);return new Promise((s,o)=>At(this,void 0,void 0,function*(){if(i.signal.aborted){o(new $t("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new $t(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new $t("Operation aborted"))},{once:!0});const f={timeout:r,abort:i.signal};yield t((...u)=>{clearTimeout(a),s(...u)},()=>{clearTimeout(a),o()},f)}))}class K1{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=sJ((o,a)=>At(this,void 0,void 0,function*(){const f={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield aJ(f)}),o=>At(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new eJ(e,r)}get isReady(){const e=this.eventSource.current();return e?.readyState===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return e?.readyState!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return e?.readyState===EventSource.CONNECTING}registerSession(e){return At(this,void 0,void 0,function*(){yield this.eventSource.create(e?.signal,e?.openingDeadlineMS)})}send(e,r,n,i){var s;return At(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i?.ttl,o.signal=i?.signal,o.attempts=i?.attempts);const a=new URL(v7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",(o?.ttl||this.defaultTtl).toString()),a.searchParams.append("topic",n);const f=p7.encode(e);yield cl(u=>At(this,void 0,void 0,function*(){const h=yield this.post(a,f,u.signal);if(!h.ok)throw new $t(`Bridge send failed, status ${h.status}`)}),{attempts:(s=o?.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o?.signal})})}pause(){this.eventSource.dispose().catch(e=>co(`Bridge pause failed, ${e}`))}unPause(){return At(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return At(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>co(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return At(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new $t(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return At(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new $t("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),xn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new $t("Bridge error, unknown state")})}messagesHandler(e){return At(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new $t(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function aJ(t){return At(this,void 0,void 0,function*(){return yield oJ((e,r,n)=>At(this,void 0,void 0,function*(){var i;const o=hs(n.signal).signal;if(o.aborted){r(new $t("Bridge connection aborted"));return}const a=new URL(v7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const f=yield t.bridgeGatewayStorage.getLastEventId();if(f&&a.searchParams.append("last_event_id",f),o.aborted){r(new $t("Bridge connection aborted"));return}const u=new EventSource(a.toString());u.onerror=h=>At(this,void 0,void 0,function*(){if(o.aborted){u.close(),r(new $t("Bridge connection aborted"));return}try{const g=yield t.errorHandler(u,h);g!==u&&u.close(),g&&g!==u&&e(g)}catch(g){u.close(),r(g)}}),u.onopen=()=>{if(o.aborted){u.close(),r(new $t("Bridge connection aborted"));return}e(u)},u.onmessage=h=>{if(o.aborted){u.close(),r(new $t("Bridge connection aborted"));return}t.messageHandler(h)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{u.close(),r(new $t("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function ul(t){return!("connectEvent"in t)}class fl{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return At(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!ul(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return At(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return At(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new $1(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new $1(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new $t("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new $t("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new $t("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new $t("Trying to read HTTP connection source while injected connection is stored");if(!ul(e))throw new $t("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new $t("Trying to read Injected bridge connection source while nothing is stored");if(e?.type==="http")throw new $t("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return At(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return At(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!ul(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const y7=2;class ll{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new fl(e)}static fromStorage(e){return At(this,void 0,void 0,function*(){const n=yield new fl(e).getHttpConnection();return ul(n)?new ll(e,n.connectionSource):new ll(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=hs(r?.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new $1;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>At(this,void 0,void 0,function*(){i.signal.aborted||(yield cl(a=>{var f;return this.openGateways(s,{openingDeadlineMS:(f=r?.openingDeadlineMS)!==null&&f!==void 0?f:this.defaultOpeningDeadlineMS,signal:a?.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return At(this,void 0,void 0,function*(){const i=hs(e?.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e?.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(ul(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i?.signal});if(Array.isArray(this.walletConnectionSource))throw new $t("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(xn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new K1(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield cl(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r?.onRequestSent,n.signal=r?.signal,n.attempts=r?.attempts),new Promise((i,s)=>At(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new $t("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),xn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const f=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),Kd(this.session.walletPublicKey));try{yield this.gateway.send(f,this.session.walletPublicKey,e.method,{attempts:n?.attempts,signal:n?.signal}),(o=n?.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(u){s(u)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return At(this,void 0,void 0,function*(){return new Promise(r=>At(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=hs(e?.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){xn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return At(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return At(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(xn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return At(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(p7.decode(e.message).toUint8Array(),Kd(e.from)));if(xn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){xn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){co(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(xn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return At(this,void 0,void 0,function*(){throw new $t(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return At(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return At(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return rJ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",y7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+nJ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return At(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new K1(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>cl(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r?.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r?.signal})));return}else return this.gateway&&(xn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new K1(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r?.openingDeadlineMS,signal:r?.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==e?.except).forEach(n=>n.close()),this.pendingGateways=[]}}function w7(t,e){return x7(t,[e])}function x7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function cJ(t){try{return!w7(t,"tonconnect")||!w7(t.tonconnect,"walletInfo")?!1:x7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Yc{constructor(){this.storage={}}static getInstance(){return Yc.instance||(Yc.instance=new Yc),Yc.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function e0(){if(!(typeof window>"u"))return window}function uJ(){const t=e0();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function fJ(){if(!(typeof document>"u"))return document}function lJ(){var t;const e=(t=e0())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function hJ(){if(dJ())return localStorage;if(pJ())throw new $t("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Yc.getInstance()}function dJ(){try{return typeof localStorage<"u"}catch{return!1}}function pJ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class ui{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=ui.window;if(!ui.isWindowContainsWallet(n,r))throw new H1;this.connectionStorage=new fl(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return At(this,void 0,void 0,function*(){const n=yield new fl(e).getInjectedConnection();return new ui(e,n.jsBridgeKey)})}static isWalletInjected(e){return ui.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return ui.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?uJ().filter(([n,i])=>cJ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(y7,e)}restoreConnection(){return At(this,void 0,void 0,function*(){try{xn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();xn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return At(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){xn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return At(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r?.onRequestSent,i.signal=r?.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),xn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>xn("Wallet message received:",a)),(n=i?.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return At(this,void 0,void 0,function*(){try{xn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);xn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){xn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n?.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{xn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}ui.window=e0();class gJ{constructor(){this.localStorage=hJ()}getItem(e){return At(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return At(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return At(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function _7(t){return vJ(t)&&t.injected}function mJ(t){return _7(t)&&t.embedded}function vJ(t){return"jsBridgeKey"in t}const bJ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class V1{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e?.walletsListSource&&(this.walletsListSource=e.walletsListSource),e?.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return At(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return At(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(mJ);return r.length!==1?null:r[0]})}fetchWalletsList(){return At(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new W1("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(co(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){co(n),e=bJ}let r=[];try{r=ui.getCurrentlyInjectedWallets()}catch(n){co(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=ui.isWalletInjected(o),i.embedded=ui.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(h=>!h||typeof h!="object"||!("type"in h)))return!1;const f=a.find(h=>h.type==="sse");if(f&&(!("url"in f)||!f.url||!e.universal_url))return!1;const u=a.find(h=>h.type==="js");return!(u&&(!("key"in u)||!u.key))}}class t0 extends $t{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,t0.prototype)}}function yJ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new t0("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,f;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(f=o.amount)!==null&&f!==void 0?f:null}})}}function MJ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Xc(t,e)),G1(e,r))}function CJ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Xc(t,e)),G1(e,r))}function RJ(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Xc(t,e)),G1(e,r))}function TJ(t,e,r){return Object.assign({type:"disconnection",scope:r},Xc(t,e))}class DJ{constructor(){this.window=e0()}dispatchEvent(e,r){var n;return At(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return At(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class OJ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e?.eventDispatcher)!==null&&r!==void 0?r:new DJ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Jc({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return At(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return At(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>At(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",xJ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return At(this,void 0,void 0,function*(){return new Promise((e,r)=>At(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",wJ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=_J(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=EJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=SJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=AJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=PJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=IJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=TJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=MJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=CJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=RJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const NJ="3.0.5";class hl{constructor(e){if(this.walletsList=new V1,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:e?.manifestUrl||lJ(),storage:e?.storage||new gJ},this.walletsList=new V1({walletsListSource:e?.walletsListSource,cacheTTLMs:e?.walletsListCacheTTLMs}),this.tracker=new OJ({eventDispatcher:e?.eventDispatcher,tonConnectSdkVersion:NJ}),!this.dappSettings.manifestUrl)throw new q1("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new fl(this.dappSettings.storage),e?.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r?.request,s.openingDeadlineMS=r?.openingDeadlineMS,s.signal=r?.signal),this.connected)throw new z1;const o=hs(s?.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new $t("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s?.request),{openingDeadlineMS:s?.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return At(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=hs(e?.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield ll.fromStorage(this.dappSettings.storage);break;case"injected":a=yield ui.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a?.closeConnection(),a=null;return}if(i.signal.aborted){a?.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){co("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const f=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a?.closeConnection(),a=null};i.signal.addEventListener("abort",f);const u=cl(g=>At(this,void 0,void 0,function*(){yield a?.restoreConnection({openingDeadlineMS:e?.openingDeadlineMS,signal:g.signal}),i.signal.removeEventListener("abort",f),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e?.signal}),h=new Promise(g=>setTimeout(()=>g(),12e3));return Promise.race([u,h])})}sendTransaction(e,r){return At(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r?.onRequestSent,n.signal=r?.signal);const i=hs(n?.signal);if(i.signal.aborted)throw new $t("Transaction sending was aborted");this.checkConnection(),yJ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=GY(e,["validUntil"]),a=e.from||this.account.address,f=e.network||this.account.chain,u=yield this.provider.sendRequest(Qd.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:f})),{onRequestSent:n.onRequestSent,signal:i.signal});if(Qd.isError(u))return this.tracker.trackTransactionSigningFailed(this.wallet,e,u.error.message,u.error.code),Qd.parseAndThrowError(u);const h=Qd.convertFromRpcResponse(u);return this.tracker.trackTransactionSigned(this.wallet,e,h),h})}disconnect(e){var r;return At(this,void 0,void 0,function*(){if(!this.connected)throw new Yd;const n=hs(e?.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new $t("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i?.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=fJ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){co("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&YY(e)?r=new ui(this.dappSettings.storage,e.jsBridgeKey):r=new ll(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new $t("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=XY.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),xn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof Gd||r instanceof Vd)throw co(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new Yd}createConnectRequest(e){const r=[{name:"ton_addr"}];return e?.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}hl.walletsList=new V1,hl.isWalletInjected=t=>ui.isWalletInjected(t),hl.isInsideWalletBrowser=t=>ui.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function Y1(t){const{children:e,onClick:r}=t;return he.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function E7(t){const{wallet:e,connector:r,loading:n}=t,i=Se.useRef(null),s=Se.useRef(),[o,a]=Se.useState(),[f,u]=Se.useState(),[h,g]=Se.useState("connect"),[b,x]=Se.useState(!1),[S,C]=Se.useState();function D(W){s.current?.update({data:W})}async function B(){x(!0);try{a("");const W=await Fo.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const V=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:W}});if(!V)return;C(V),D(V),u(W)}}catch(W){a(W.message)}x(!1)}function L(){s.current=new e7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function H(){r.connect(e,{request:{tonProof:f}})}function F(){if("deepLink"in e){if(!e.deepLink||!S)return;const W=new URL(S),V=`${e.deepLink}${W.search}`;window.open(V)}}function k(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(S)}const $=Se.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),R=Se.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Se.useEffect(()=>{L(),B()},[]),he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-6",children:he.jsx(Wa,{title:"Connect wallet",onBack:t.onBack})}),he.jsxs("div",{className:"xc-text-center xc-mb-6",children:[he.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[he.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),he.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:b?he.jsx(Fa,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):he.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),he.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),he.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&he.jsx(Fa,{className:"xc-animate-spin"}),!b&&!n&&he.jsxs(he.Fragment,{children:[_7(e)&&he.jsxs(Y1,{onClick:H,children:[he.jsx(Fz,{className:"xc-opacity-80"}),"Extension"]}),$&&he.jsxs(Y1,{onClick:F,children:[he.jsx($4,{className:"xc-opacity-80"}),"Desktop"]}),R&&he.jsx(Y1,{onClick:k,children:"Telegram Mini App"})]})]})]})}function LJ(t){const[e,r]=Se.useState(""),[n,i]=Se.useState(),[s,o]=Se.useState(),a=F1(),[f,u]=Se.useState(!1);async function h(b){if(!b||!b.connectItems?.tonProof)return;u(!0);const x=await Fo.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:b?.device.appName,inviter_code:a.inviterCode,address:b.account.address,chain:b.account.chain,connect_info:[{name:"ton_addr",network:b.account.chain,...b.account},b.connectItems?.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(x.data),u(!1)}Se.useEffect(()=>{const b=new hl({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),x=b.onStatusChange(h);return o(b),r("select"),x},[]);function g(b){r("connect"),i(b)}return he.jsxs(ls,{children:[e==="select"&&he.jsx(a7,{connector:s,onSelect:g,onBack:t.onBack}),e==="connect"&&he.jsx(E7,{connector:s,wallet:n,onBack:t.onBack,loading:f})]})}function S7(t){const{children:e,className:r}=t,n=Se.useRef(null),[i,s]=Se.useState(0);function o(){try{const a=n.current?.children||[];let f=0;for(let u=0;u{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Se.useEffect(()=>{console.log("maxHeight",i)},[i]),he.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function kJ(){return he.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[he.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),he.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function A7(t){const{wallets:e}=Hf(),[r,n]=Se.useState(),i=Se.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-6",children:he.jsx(Wa,{title:"Select wallet",onBack:t.onBack})}),he.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[he.jsx(q4,{className:"xc-shrink-0 xc-opacity-50"}),he.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),he.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>he.jsx(TS,{wallet:a,onClick:s},`feature-${a.key}`)):he.jsx(kJ,{})})]})}function BJ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,f]=Se.useState(""),[u,h]=Se.useState(null),[g,b]=Se.useState("");function x(B){h(B),f("evm-wallet")}function S(B){f("email"),b(B)}async function C(B){await e(B)}function D(){f("ton-wallet")}return Se.useEffect(()=>{f("index")},[]),he.jsx(JG,{config:t.config,children:he.jsxs(S7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&he.jsx(LY,{onBack:()=>f("index"),onLogin:C,wallet:u}),a==="ton-wallet"&&he.jsx(LJ,{onBack:()=>f("index"),onLogin:C}),a==="email"&&he.jsx(lY,{email:g,onBack:()=>f("index"),onLogin:C}),a==="index"&&he.jsx($S,{header:r,onEmailConfirm:S,onSelectWallet:x,onSelectMoreWallets:()=>{f("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&he.jsx(A7,{onBack:()=>f("index"),onSelectWallet:x})]})})}function FJ(t){const{wallet:e,onConnect:r}=t,[n,i]=Se.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-6",children:he.jsx(Wa,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&he.jsx(i7,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&he.jsx(s7,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&he.jsx(o7,{wallet:e})]})}function jJ(t){const{email:e}=t,[r,n]=Se.useState("captcha");return he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-12",children:he.jsx(Wa,{title:"Sign in with email",onBack:t.onBack})}),r==="captcha"&&he.jsx(ZS,{email:e,onCodeSend:()=>n("verify-email")}),r==="verify-email"&&he.jsx(XS,{email:e,onInputCode:t.onInputCode,onResendCode:()=>n("captcha")})]})}function UJ(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,header:i,config:s={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[o,a]=Se.useState(""),[f,u]=Se.useState(),[h,g]=Se.useState(),b=Se.useRef(),[x,S]=Se.useState("");function C(k){u(k),a("evm-wallet-connect")}function D(k){S(k),a("email-connect")}async function B(k,$){await e?.({chain_type:"eip155",client:k.client,connect_info:$,wallet:k}),a("index")}async function L(k,$){await n?.(k,$)}function H(k){g(k),a("ton-wallet-connect")}async function F(k){k&&await r?.({chain_type:"ton",client:b.current,connect_info:k,wallet:k})}return Se.useEffect(()=>{b.current=new hl({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const k=b.current.onStatusChange(F);return a("index"),k},[]),he.jsxs(S7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[o==="evm-wallet-select"&&he.jsx(A7,{onBack:()=>a("index"),onSelectWallet:C}),o==="evm-wallet-connect"&&he.jsx(FJ,{onBack:()=>a("index"),onConnect:B,wallet:f}),o==="ton-wallet-select"&&he.jsx(a7,{connector:b.current,onSelect:H,onBack:()=>a("index")}),o==="ton-wallet-connect"&&he.jsx(E7,{connector:b.current,wallet:h,onBack:()=>a("index")}),o==="email-connect"&&he.jsx(jJ,{email:x,onBack:()=>a("index"),onInputCode:L}),o==="index"&&he.jsx($S,{header:i,onEmailConfirm:D,onSelectWallet:C,onSelectMoreWallets:()=>a("evm-wallet-select"),onSelectTonConnect:()=>a("ton-wallet-select"),config:s})]})}Ii.CodattaConnect=UJ,Ii.CodattaConnectContextProvider=Rz,Ii.CodattaSignin=BJ,Ii.WalletItem=la,Ii.coinbaseWallet=B4,Ii.useCodattaConnectContext=Hf,Object.defineProperty(Ii,Symbol.toStringTag,{value:"Module"})})); +`+e:""}`,Object.setPrototypeOf(this,$t.prototype)}get info(){return""}}$t.prefix="[TON_CONNECT_SDK_ERROR]";class q1 extends $t{get info(){return"Passed DappMetadata is in incorrect format."}constructor(...e){super(...e),Object.setPrototypeOf(this,q1.prototype)}}class Vd extends $t{get info(){return"Passed `tonconnect-manifest.json` contains errors. Check format of your manifest. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,Vd.prototype)}}class Gd extends $t{get info(){return"Manifest not found. Make sure you added `tonconnect-manifest.json` to the root of your app or passed correct manifestUrl. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,Gd.prototype)}}class z1 extends $t{get info(){return"Wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection."}constructor(...e){super(...e),Object.setPrototypeOf(this,z1.prototype)}}class Yd extends $t{get info(){return"Send transaction or other protocol methods called while wallet is not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,Yd.prototype)}}function YY(t){return"jsBridgeKey"in t}class Jd extends $t{get info(){return"User rejects the action in the wallet."}constructor(...e){super(...e),Object.setPrototypeOf(this,Jd.prototype)}}class Xd extends $t{get info(){return"Request to the wallet contains errors."}constructor(...e){super(...e),Object.setPrototypeOf(this,Xd.prototype)}}class Zd extends $t{get info(){return"App tries to send rpc request to the injected wallet while not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,Zd.prototype)}}class H1 extends $t{get info(){return"There is an attempt to connect to the injected wallet while it is not exists in the webpage."}constructor(...e){super(...e),Object.setPrototypeOf(this,H1.prototype)}}class W1 extends $t{get info(){return"An error occurred while fetching the wallets list."}constructor(...e){super(...e),Object.setPrototypeOf(this,W1.prototype)}}class Go extends $t{constructor(...e){super(...e),Object.setPrototypeOf(this,Go.prototype)}}const g7={[Vo.UNKNOWN_ERROR]:Go,[Vo.USER_REJECTS_ERROR]:Jd,[Vo.BAD_REQUEST_ERROR]:Xd,[Vo.UNKNOWN_APP_ERROR]:Zd,[Vo.MANIFEST_NOT_FOUND_ERROR]:Gd,[Vo.MANIFEST_CONTENT_ERROR]:Vd};class JY{parseError(e){let r=Go;return e.code in g7&&(r=g7[e.code]||Go),new r(e.message)}}const XY=new JY;class ZY{isError(e){return"error"in e}}const m7={[Gc.UNKNOWN_ERROR]:Go,[Gc.USER_REJECTS_ERROR]:Jd,[Gc.BAD_REQUEST_ERROR]:Xd,[Gc.UNKNOWN_APP_ERROR]:Zd};class QY extends ZY{convertToRpcRequest(e){return{method:"sendTransaction",params:[JSON.stringify(e)]}}parseAndThrowError(e){let r=Go;throw e.error.code in m7&&(r=m7[e.error.code]||Go),new r(e.error.message)}convertFromRpcResponse(e){return{boc:e.result}}}const Qd=new QY;class eJ{constructor(e,r){this.storage=e,this.storeKey="ton-connect-storage_http-bridge-gateway::"+r}storeLastEventId(e){return At(this,void 0,void 0,function*(){return this.storage.setItem(this.storeKey,e)})}removeLastEventId(){return At(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getLastEventId(){return At(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e||null})}}function tJ(t){return t.slice(-1)==="/"?t.slice(0,-1):t}function v7(t,e){return tJ(t)+"/"+e}function rJ(t){if(!t)return!1;const e=new URL(t);return e.protocol==="tg:"||e.hostname==="t.me"}function nJ(t){return t.replaceAll(".","%2E").replaceAll("-","%2D").replaceAll("_","%5F").replaceAll("&","-").replaceAll("=","__").replaceAll("%","--")}function b7(t,e){return At(this,void 0,void 0,function*(){return new Promise((r,n)=>{var i,s;if(!((i=void 0)===null||i===void 0)&&i.aborted){n(new $t("Delay aborted"));return}const o=setTimeout(()=>r(),t);(s=void 0)===null||s===void 0||s.addEventListener("abort",()=>{clearTimeout(o),n(new $t("Delay aborted"))})})})}function hs(t){const e=new AbortController;return t?.aborted?e.abort():t?.addEventListener("abort",()=>e.abort(),{once:!0}),e}function cl(t,e){var r,n;return At(this,void 0,void 0,function*(){const i=(r=e?.attempts)!==null&&r!==void 0?r:10,s=(n=e?.delayMs)!==null&&n!==void 0?n:200,o=hs(e?.signal);if(typeof t!="function")throw new $t(`Expected a function, got ${typeof t}`);let a=0,f;for(;aAt(this,void 0,void 0,function*(){if(s=g??null,o?.abort(),o=hs(g),o.signal.aborted)throw new $t("Resource creation was aborted");n=b??null;const x=t(o.signal,...b);i=x;const S=yield x;if(i!==x&&S!==r)throw yield e(S),new $t("Resource creation was aborted by a new resource creation");return r=S,r});return{create:a,current:()=>r??null,dispose:()=>At(this,void 0,void 0,function*(){try{const g=r;r=null;const b=i;i=null;try{o?.abort()}catch{}yield Promise.allSettled([g?e(g):Promise.resolve(),b?e(yield b):Promise.resolve()])}catch{}}),recreate:g=>At(this,void 0,void 0,function*(){const b=r,x=i,S=n,C=s;if(yield b7(g),b===r&&x===i&&S===n&&C===s)return yield a(s,...S??[]);throw new $t("Resource recreation was aborted by a new resource creation")})}}function oJ(t,e){const r=e?.timeout,n=e?.signal,i=hs(n);return new Promise((s,o)=>At(this,void 0,void 0,function*(){if(i.signal.aborted){o(new $t("Operation aborted"));return}let a;typeof r<"u"&&(a=setTimeout(()=>{i.abort(),o(new $t(`Timeout after ${r}ms`))},r)),i.signal.addEventListener("abort",()=>{clearTimeout(a),o(new $t("Operation aborted"))},{once:!0});const f={timeout:r,abort:i.signal};yield t((...u)=>{clearTimeout(a),s(...u)},()=>{clearTimeout(a),o()},f)}))}class K1{constructor(e,r,n,i,s){this.bridgeUrl=r,this.sessionId=n,this.listener=i,this.errorsListener=s,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.defaultReconnectDelay=2e3,this.defaultResendDelay=5e3,this.eventSource=sJ((o,a)=>At(this,void 0,void 0,function*(){const f={bridgeUrl:this.bridgeUrl,ssePath:this.ssePath,sessionId:this.sessionId,bridgeGatewayStorage:this.bridgeGatewayStorage,errorHandler:this.errorsHandler.bind(this),messageHandler:this.messagesHandler.bind(this),signal:o,openingDeadlineMS:a};return yield aJ(f)}),o=>At(this,void 0,void 0,function*(){o.close()})),this.bridgeGatewayStorage=new eJ(e,r)}get isReady(){const e=this.eventSource.current();return e?.readyState===EventSource.OPEN}get isClosed(){const e=this.eventSource.current();return e?.readyState!==EventSource.OPEN}get isConnecting(){const e=this.eventSource.current();return e?.readyState===EventSource.CONNECTING}registerSession(e){return At(this,void 0,void 0,function*(){yield this.eventSource.create(e?.signal,e?.openingDeadlineMS)})}send(e,r,n,i){var s;return At(this,void 0,void 0,function*(){const o={};typeof i=="number"?o.ttl=i:(o.ttl=i?.ttl,o.signal=i?.signal,o.attempts=i?.attempts);const a=new URL(v7(this.bridgeUrl,this.postPath));a.searchParams.append("client_id",this.sessionId),a.searchParams.append("to",r),a.searchParams.append("ttl",(o?.ttl||this.defaultTtl).toString()),a.searchParams.append("topic",n);const f=p7.encode(e);yield cl(u=>At(this,void 0,void 0,function*(){const h=yield this.post(a,f,u.signal);if(!h.ok)throw new $t(`Bridge send failed, status ${h.status}`)}),{attempts:(s=o?.attempts)!==null&&s!==void 0?s:Number.MAX_SAFE_INTEGER,delayMs:this.defaultResendDelay,signal:o?.signal})})}pause(){this.eventSource.dispose().catch(e=>co(`Bridge pause failed, ${e}`))}unPause(){return At(this,void 0,void 0,function*(){yield this.eventSource.recreate(0)})}close(){return At(this,void 0,void 0,function*(){yield this.eventSource.dispose().catch(e=>co(`Bridge close failed, ${e}`))})}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}post(e,r,n){return At(this,void 0,void 0,function*(){const i=yield fetch(e,{method:"post",body:r,signal:n});if(!i.ok)throw new $t(`Bridge send failed, status ${i.status}`);return i})}errorsHandler(e,r){return At(this,void 0,void 0,function*(){if(this.isConnecting)throw e.close(),new $t("Bridge error, failed to connect");if(this.isReady){try{this.errorsListener(r)}catch{}return}if(this.isClosed)return e.close(),xn(`Bridge reconnecting, ${this.defaultReconnectDelay}ms delay`),yield this.eventSource.recreate(this.defaultReconnectDelay);throw new $t("Bridge error, unknown state")})}messagesHandler(e){return At(this,void 0,void 0,function*(){if(e.data===this.heartbeatMessage||(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),this.isClosed))return;let r;try{r=JSON.parse(e.data)}catch(n){throw new $t(`Bridge message parse failed, message ${n.data}`)}this.listener(r)})}}function aJ(t){return At(this,void 0,void 0,function*(){return yield oJ((e,r,n)=>At(this,void 0,void 0,function*(){var i;const o=hs(n.signal).signal;if(o.aborted){r(new $t("Bridge connection aborted"));return}const a=new URL(v7(t.bridgeUrl,t.ssePath));a.searchParams.append("client_id",t.sessionId);const f=yield t.bridgeGatewayStorage.getLastEventId();if(f&&a.searchParams.append("last_event_id",f),o.aborted){r(new $t("Bridge connection aborted"));return}const u=new EventSource(a.toString());u.onerror=h=>At(this,void 0,void 0,function*(){if(o.aborted){u.close(),r(new $t("Bridge connection aborted"));return}try{const g=yield t.errorHandler(u,h);g!==u&&u.close(),g&&g!==u&&e(g)}catch(g){u.close(),r(g)}}),u.onopen=()=>{if(o.aborted){u.close(),r(new $t("Bridge connection aborted"));return}e(u)},u.onmessage=h=>{if(o.aborted){u.close(),r(new $t("Bridge connection aborted"));return}t.messageHandler(h)},(i=t.signal)===null||i===void 0||i.addEventListener("abort",()=>{u.close(),r(new $t("Bridge connection aborted"))})}),{timeout:t.openingDeadlineMS,signal:t.signal})})}function ul(t){return!("connectEvent"in t)}class fl{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return At(this,void 0,void 0,function*(){if(e.type==="injected")return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!ul(e)){const n={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},i={type:"http",connectEvent:e.connectEvent,session:n,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(i))}const r={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(r))})}removeConnection(){return At(this,void 0,void 0,function*(){return this.storage.removeItem(this.storeKey)})}getConnection(){return At(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const r=JSON.parse(e);if(r.type==="injected")return r;if("connectEvent"in r){const n=new $1(r.session.sessionKeyPair);return{type:"http",connectEvent:r.connectEvent,lastWalletEventId:r.lastWalletEventId,nextRpcRequestId:r.nextRpcRequestId,session:{sessionCrypto:n,bridgeUrl:r.session.bridgeUrl,walletPublicKey:r.session.walletPublicKey}}}return{type:"http",sessionCrypto:new $1(r.sessionCrypto),connectionSource:r.connectionSource}})}getHttpConnection(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new $t("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new $t("Trying to read HTTP connection source while injected connection is stored");return e})}getHttpPendingConnection(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new $t("Trying to read HTTP connection source while nothing is stored");if(e.type==="injected")throw new $t("Trying to read HTTP connection source while injected connection is stored");if(!ul(e))throw new $t("Trying to read HTTP-pending connection while http connection is stored");return e})}getInjectedConnection(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(!e)throw new $t("Trying to read Injected bridge connection source while nothing is stored");if(e?.type==="http")throw new $t("Trying to read Injected bridge connection source while HTTP connection is stored");return e})}storedConnectionType(){return At(this,void 0,void 0,function*(){const e=yield this.storage.getItem(this.storeKey);return e?JSON.parse(e).type:null})}storeLastWalletEventId(e){return At(this,void 0,void 0,function*(){const r=yield this.getConnection();if(r&&r.type==="http"&&!ul(r))return r.lastWalletEventId=e,this.storeConnection(r)})}getLastWalletEventId(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId})}increaseNextRpcRequestId(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const r=e.nextRpcRequestId||0;return e.nextRpcRequestId=r+1,this.storeConnection(e)}})}getNextRpcRequestId(){return At(this,void 0,void 0,function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0})}}const y7=2;class ll{constructor(e,r){this.storage=e,this.walletConnectionSource=r,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.defaultOpeningDeadlineMS=12e3,this.defaultRetryTimeoutMS=2e3,this.connectionStorage=new fl(e)}static fromStorage(e){return At(this,void 0,void 0,function*(){const n=yield new fl(e).getHttpConnection();return ul(n)?new ll(e,n.connectionSource):new ll(e,{bridgeUrl:n.session.bridgeUrl})})}connect(e,r){var n;const i=hs(r?.signal);(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=i,this.closeGateways();const s=new $1;this.session={sessionCrypto:s,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:s}).then(()=>At(this,void 0,void 0,function*(){i.signal.aborted||(yield cl(a=>{var f;return this.openGateways(s,{openingDeadlineMS:(f=r?.openingDeadlineMS)!==null&&f!==void 0?f:this.defaultOpeningDeadlineMS,signal:a?.signal})},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal}))}));const o="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(o,e)}restoreConnection(e){var r,n;return At(this,void 0,void 0,function*(){const i=hs(e?.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted)return;this.closeGateways();const s=yield this.connectionStorage.getHttpConnection();if(!s||i.signal.aborted)return;const o=(n=e?.openingDeadlineMS)!==null&&n!==void 0?n:this.defaultOpeningDeadlineMS;if(ul(s))return this.session={sessionCrypto:s.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},yield this.openGateways(s.sessionCrypto,{openingDeadlineMS:o,signal:i?.signal});if(Array.isArray(this.walletConnectionSource))throw new $t("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");if(this.session=s.session,this.gateway&&(xn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new K1(this.storage,this.walletConnectionSource.bridgeUrl,s.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),!i.signal.aborted){this.listeners.forEach(a=>a(s.connectEvent));try{yield cl(a=>this.gateway.registerSession({openingDeadlineMS:o,signal:a.signal}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:i.signal})}catch{yield this.disconnect({signal:i.signal});return}}})}sendRequest(e,r){const n={};return typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r?.onRequestSent,n.signal=r?.signal,n.attempts=r?.attempts),new Promise((i,s)=>At(this,void 0,void 0,function*(){var o;if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new $t("Trying to send bridge request without session");const a=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),xn("Send http-bridge request:",Object.assign(Object.assign({},e),{id:a}));const f=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:a})),Kd(this.session.walletPublicKey));try{yield this.gateway.send(f,this.session.walletPublicKey,e.method,{attempts:n?.attempts,signal:n?.signal}),(o=n?.onRequestSent)===null||o===void 0||o.call(n),this.pendingRequests.set(a.toString(),i)}catch(u){s(u)}}))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(e){return At(this,void 0,void 0,function*(){return new Promise(r=>At(this,void 0,void 0,function*(){let n=!1,i=null;const s=()=>{n||(n=!0,this.removeBridgeAndSession().then(r))};try{this.closeGateways();const o=hs(e?.signal);i=setTimeout(()=>{o.abort()},this.defaultOpeningDeadlineMS),yield this.sendRequest({method:"disconnect",params:[]},{onRequestSent:s,signal:o.signal,attempts:1})}catch(o){xn("Disconnect error:",o),n||this.removeBridgeAndSession().then(r)}finally{i&&clearTimeout(i),s()}}))})}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}pause(){var e;(e=this.gateway)===null||e===void 0||e.pause(),this.pendingGateways.forEach(r=>r.pause())}unPause(){return At(this,void 0,void 0,function*(){const e=this.pendingGateways.map(r=>r.unPause());this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)})}pendingGatewaysListener(e,r,n){return At(this,void 0,void 0,function*(){if(!this.pendingGateways.includes(e)){yield e.close();return}return this.closeGateways({except:e}),this.gateway&&(xn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.session.bridgeUrl=r,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n)})}gatewayListener(e){return At(this,void 0,void 0,function*(){const r=JSON.parse(this.session.sessionCrypto.decrypt(p7.decode(e.message).toUint8Array(),Kd(e.from)));if(xn("Wallet message received:",r),!("event"in r)){const i=r.id.toString(),s=this.pendingRequests.get(i);if(!s){xn(`Response id ${i} doesn't match any request's id`);return}s(r),this.pendingRequests.delete(i);return}if(r.id!==void 0){const i=yield this.connectionStorage.getLastWalletEventId();if(i!==void 0&&r.id<=i){co(`Received event id (=${r.id}) must be greater than stored last wallet event id (=${i}) `);return}r.event!=="connect"&&(yield this.connectionStorage.storeLastWalletEventId(r.id))}const n=this.listeners;r.event==="connect"&&(yield this.updateSession(r,e.from)),r.event==="disconnect"&&(xn("Removing bridge and session: received disconnect event"),yield this.removeBridgeAndSession()),n.forEach(i=>i(r))})}gatewayErrorsListener(e){return At(this,void 0,void 0,function*(){throw new $t(`Bridge error ${JSON.stringify(e)}`)})}updateSession(e,r){return At(this,void 0,void 0,function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:r});const n=e.payload.items.find(s=>s.name==="ton_addr"),i=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:i,nextRpcRequestId:0})})}removeBridgeAndSession(){return At(this,void 0,void 0,function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()})}generateUniversalLink(e,r){return rJ(e)?this.generateTGUniversalLink(e,r):this.generateRegularUniversalLink(e,r)}generateRegularUniversalLink(e,r){const n=new URL(e);return n.searchParams.append("v",y7.toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(r)),n.toString()}generateTGUniversalLink(e,r){const i=this.generateRegularUniversalLink("about:blank",r).split("?")[1],s="tonconnect-"+nJ(i),o=this.convertToDirectLink(e),a=new URL(o);return a.searchParams.append("startapp",s),a.toString()}convertToDirectLink(e){const r=new URL(e);return r.searchParams.has("attach")&&(r.searchParams.delete("attach"),r.pathname+="/start"),r.toString()}openGateways(e,r){return At(this,void 0,void 0,function*(){if(Array.isArray(this.walletConnectionSource)){this.pendingGateways.map(n=>n.close().catch()),this.pendingGateways=this.walletConnectionSource.map(n=>{const i=new K1(this.storage,n.bridgeUrl,e.sessionId,()=>{},()=>{});return i.setListener(s=>this.pendingGatewaysListener(i,n.bridgeUrl,s)),i}),yield Promise.allSettled(this.pendingGateways.map(n=>cl(i=>{var s;return this.pendingGateways.some(o=>o===n)?n.registerSession({openingDeadlineMS:(s=r?.openingDeadlineMS)!==null&&s!==void 0?s:this.defaultOpeningDeadlineMS,signal:i.signal}):n.close()},{attempts:Number.MAX_SAFE_INTEGER,delayMs:this.defaultRetryTimeoutMS,signal:r?.signal})));return}else return this.gateway&&(xn("Gateway is already opened, closing previous gateway"),yield this.gateway.close()),this.gateway=new K1(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession({openingDeadlineMS:r?.openingDeadlineMS,signal:r?.signal})})}closeGateways(e){var r;(r=this.gateway)===null||r===void 0||r.close(),this.pendingGateways.filter(n=>n!==e?.except).forEach(n=>n.close()),this.pendingGateways=[]}}function w7(t,e){return x7(t,[e])}function x7(t,e){return!t||typeof t!="object"?!1:e.every(r=>r in t)}function cJ(t){try{return!w7(t,"tonconnect")||!w7(t.tonconnect,"walletInfo")?!1:x7(t.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch{return!1}}class Yc{constructor(){this.storage={}}static getInstance(){return Yc.instance||(Yc.instance=new Yc),Yc.instance}get length(){return Object.keys(this.storage).length}clear(){this.storage={}}getItem(e){var r;return(r=this.storage[e])!==null&&r!==void 0?r:null}key(e){var r;const n=Object.keys(this.storage);return e<0||e>=n.length?null:(r=n[e])!==null&&r!==void 0?r:null}removeItem(e){delete this.storage[e]}setItem(e,r){this.storage[e]=r}}function e0(){if(!(typeof window>"u"))return window}function uJ(){const t=e0();if(!t)return[];try{return Object.keys(t)}catch{return[]}}function fJ(){if(!(typeof document>"u"))return document}function lJ(){var t;const e=(t=e0())===null||t===void 0?void 0:t.location.origin;return e?e+"/tonconnect-manifest.json":""}function hJ(){if(dJ())return localStorage;if(pJ())throw new $t("`localStorage` is unavailable, but it is required for TonConnect. For more details, see https://github.com/ton-connect/sdk/tree/main/packages/sdk#init-connector");return Yc.getInstance()}function dJ(){try{return typeof localStorage<"u"}catch{return!1}}function pJ(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null}class ui{constructor(e,r){this.injectedWalletKey=r,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=ui.window;if(!ui.isWindowContainsWallet(n,r))throw new H1;this.connectionStorage=new fl(e),this.injectedWallet=n[r].tonconnect}static fromStorage(e){return At(this,void 0,void 0,function*(){const n=yield new fl(e).getInjectedConnection();return new ui(e,n.jsBridgeKey)})}static isWalletInjected(e){return ui.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return ui.isWindowContainsWallet(this.window,e)?this.window[e].tonconnect.isWalletBrowser:!1}static getCurrentlyInjectedWallets(){return this.window?uJ().filter(([n,i])=>cJ(i)).map(([n,i])=>({name:i.tonconnect.walletInfo.name,appName:i.tonconnect.walletInfo.app_name,aboutUrl:i.tonconnect.walletInfo.about_url,imageUrl:i.tonconnect.walletInfo.image,tondns:i.tonconnect.walletInfo.tondns,jsBridgeKey:n,injected:!0,embedded:i.tonconnect.isWalletBrowser,platforms:i.tonconnect.walletInfo.platforms})):[]}static isWindowContainsWallet(e,r){return!!e&&r in e&&typeof e[r]=="object"&&"tonconnect"in e[r]}connect(e){this._connect(y7,e)}restoreConnection(){return At(this,void 0,void 0,function*(){try{xn("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();xn("Injected Provider restoring connection response",e),e.event==="connect"?(this.makeSubscriptions(),this.listeners.forEach(r=>r(e))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}})}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return At(this,void 0,void 0,function*(){return new Promise(e=>{const r=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),r()}catch(n){xn(n),this.sendRequest({method:"disconnect",params:[]},r)}})})}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],(e=this.unsubscribeCallback)===null||e===void 0||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter(r=>r!==e)}sendRequest(e,r){var n;return At(this,void 0,void 0,function*(){const i={};typeof r=="function"?i.onRequestSent=r:(i.onRequestSent=r?.onRequestSent,i.signal=r?.signal);const s=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),xn("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:s}));const o=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:s}));return o.then(a=>xn("Wallet message received:",a)),(n=i?.onRequestSent)===null||n===void 0||n.call(i),o})}_connect(e,r){return At(this,void 0,void 0,function*(){try{xn(`Injected Provider connect request: protocolVersion: ${e}, message:`,r);const n=yield this.injectedWallet.connect(e,r);xn("Injected Provider connect response:",n),n.event==="connect"&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach(i=>i(n))}catch(n){xn("Injected Provider connect error:",n);const i={event:"connect_error",payload:{code:0,message:n?.toString()}};this.listeners.forEach(s=>s(i))}})}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen(e=>{xn("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach(r=>r(e)),e.event==="disconnect"&&this.disconnect()})}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}ui.window=e0();class gJ{constructor(){this.localStorage=hJ()}getItem(e){return At(this,void 0,void 0,function*(){return this.localStorage.getItem(e)})}removeItem(e){return At(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}setItem(e,r){return At(this,void 0,void 0,function*(){this.localStorage.setItem(e,r)})}}function _7(t){return vJ(t)&&t.injected}function mJ(t){return _7(t)&&t.embedded}function vJ(t){return"jsBridgeKey"in t}const bJ=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.ton.space/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",deepLink:"tonkeeper-tc://",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox","macos"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://static.mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux","ios","android","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"dewallet",name:"DeWallet",image:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",about_url:"https://delabwallet.com",universal_url:"https://t.me/dewallet?attach=wallet",bridge:[{type:"sse",url:"https://sse-bridge.delab.team/bridge"}],platforms:["ios","android"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]},{app_name:"bitgetTonWallet",name:"Bitget Wallet",image:"https://raw.githubusercontent.com/bitkeepwallet/download/main/logo/png/bitget_wallet_logo_0_gas_fee.png",about_url:"https://web3.bitget.com",deepLink:"bitkeep://",bridge:[{type:"js",key:"bitgetTonWallet"},{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","chrome"],universal_url:"https://bkcode.vip/ton-connect"},{app_name:"safepalwallet",name:"SafePal",image:"https://s.pvcliping.com/web/public_image/SafePal_x288.png",tondns:"",about_url:"https://www.safepal.com",universal_url:"https://link.safepal.io/ton-connect",deepLink:"safepal-tc://",bridge:[{type:"sse",url:"https://ton-bridge.safepal.com/tonbridge/v1/bridge"},{type:"js",key:"safepalwallet"}],platforms:["ios","android","chrome","firefox"]},{app_name:"okxTonWallet",name:"OKX Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/58E63FEA47A2B7D7.png",about_url:"https://www.okx.com/web3",universal_url:"https://www.okx.com/download?appendQuery=true&deeplink=okx://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]},{app_name:"okxTonWalletTr",name:"OKX TR Wallet",image:"https://static.okx.com/cdn/assets/imgs/247/587A8296F0BB640F.png",about_url:"https://tr.okx.com/web3",universal_url:"https://tr.okx.com/download?appendQuery=true&deeplink=okxtr://web3/wallet/tonconnect",bridge:[{type:"js",key:"okxTonWallet"},{type:"sse",url:"https://www.okx.com/tonbridge/discover/rpc/bridge"}],platforms:["chrome","safari","firefox","ios","android"]}];class V1{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",e?.walletsListSource&&(this.walletsListSource=e.walletsListSource),e?.cacheTTLMs&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return At(this,void 0,void 0,function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then(()=>{this.walletsListCacheCreationTimestamp=Date.now()}).catch(()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null})),this.walletsListCache})}getEmbeddedWallet(){return At(this,void 0,void 0,function*(){const r=(yield this.getWallets()).filter(mJ);return r.length!==1?null:r[0]})}fetchWalletsList(){return At(this,void 0,void 0,function*(){let e=[];try{if(e=yield(yield fetch(this.walletsListSource)).json(),!Array.isArray(e))throw new W1("Wrong wallets list format, wallets list must be an array.");const i=e.filter(s=>!this.isCorrectWalletConfigDTO(s));i.length&&(co(`Wallet(s) ${i.map(s=>s.name).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter(s=>this.isCorrectWalletConfigDTO(s)))}catch(n){co(n),e=bJ}let r=[];try{r=ui.getCurrentlyInjectedWallets()}catch(n){co(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),r)})}walletConfigDTOListToWalletConfigList(e){return e.map(r=>{const i={name:r.name,appName:r.app_name,imageUrl:r.image,aboutUrl:r.about_url,tondns:r.tondns,platforms:r.platforms};return r.bridge.forEach(s=>{if(s.type==="sse"&&(i.bridgeUrl=s.url,i.universalLink=r.universal_url,i.deepLink=r.deepLink),s.type==="js"){const o=s.key;i.jsBridgeKey=o,i.injected=ui.isWalletInjected(o),i.embedded=ui.isInsideWalletBrowser(o)}}),i})}mergeWalletsLists(e,r){return[...new Set(e.concat(r).map(i=>i.name)).values()].map(i=>{const s=e.find(a=>a.name===i),o=r.find(a=>a.name===i);return Object.assign(Object.assign({},s&&Object.assign({},s)),o&&Object.assign({},o))})}isCorrectWalletConfigDTO(e){if(!e||typeof e!="object")return!1;const r="name"in e,n="app_name"in e,i="image"in e,s="about_url"in e,o="platforms"in e;if(!r||!i||!s||!o||!n||!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length||!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const a=e.bridge;if(a.some(h=>!h||typeof h!="object"||!("type"in h)))return!1;const f=a.find(h=>h.type==="sse");if(f&&(!("url"in f)||!f.url||!e.universal_url))return!1;const u=a.find(h=>h.type==="js");return!(u&&(!("key"in u)||!u.key))}}class t0 extends $t{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,t0.prototype)}}function yJ(t,e){const r=t.includes("SendTransaction"),n=t.find(i=>i&&typeof i=="object"&&i.name==="SendTransaction");if(!r&&!n)throw new t0("Wallet doesn't support SendTransaction feature.");if(n&&n.maxMessages!==void 0){if(n.maxMessages{var a,f;return{address:(a=o.address)!==null&&a!==void 0?a:null,amount:(f=o.amount)!==null&&f!==void 0?f:null}})}}function MJ(t,e,r){return Object.assign(Object.assign({type:"transaction-sent-for-signature"},Xc(t,e)),G1(e,r))}function CJ(t,e,r,n){return Object.assign(Object.assign({type:"transaction-signed",is_success:!0,signed_transaction:n.boc},Xc(t,e)),G1(e,r))}function RJ(t,e,r,n,i){return Object.assign(Object.assign({type:"transaction-signing-failed",is_success:!1,error_message:n,error_code:i??null},Xc(t,e)),G1(e,r))}function TJ(t,e,r){return Object.assign({type:"disconnection",scope:r},Xc(t,e))}class DJ{constructor(){this.window=e0()}dispatchEvent(e,r){var n;return At(this,void 0,void 0,function*(){const i=new CustomEvent(e,{detail:r});(n=this.window)===null||n===void 0||n.dispatchEvent(i)})}addEventListener(e,r,n){var i;return At(this,void 0,void 0,function*(){return(i=this.window)===null||i===void 0||i.addEventListener(e,r,n),()=>{var s;return(s=this.window)===null||s===void 0?void 0:s.removeEventListener(e,r)}})}}class OJ{constructor(e){var r;this.eventPrefix="ton-connect-",this.tonConnectUiVersion=null,this.eventDispatcher=(r=e?.eventDispatcher)!==null&&r!==void 0?r:new DJ,this.tonConnectSdkVersion=e.tonConnectSdkVersion,this.init().catch()}get version(){return Jc({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return At(this,void 0,void 0,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectUiVersion=yield this.requestTonConnectUiVersion()}catch{}})}setRequestVersionHandler(){return At(this,void 0,void 0,function*(){yield this.eventDispatcher.addEventListener("ton-connect-request-version",()=>At(this,void 0,void 0,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-response-version",xJ(this.tonConnectSdkVersion))}))})}requestTonConnectUiVersion(){return At(this,void 0,void 0,function*(){return new Promise((e,r)=>At(this,void 0,void 0,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-ui-response-version",n=>{e(n.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-ui-request-version",wJ())}catch(n){r(n)}}))})}dispatchUserActionEvent(e){try{this.eventDispatcher.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch{}}trackConnectionStarted(...e){try{const r=_J(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionCompleted(...e){try{const r=EJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionError(...e){try{const r=SJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringStarted(...e){try{const r=AJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringCompleted(...e){try{const r=PJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackConnectionRestoringError(...e){try{const r=IJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackDisconnection(...e){try{const r=TJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSentForSignature(...e){try{const r=MJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigned(...e){try{const r=CJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}trackTransactionSigningFailed(...e){try{const r=RJ(this.version,...e);this.dispatchUserActionEvent(r)}catch{}}}const NJ="3.0.5";class hl{constructor(e){if(this.walletsList=new V1,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:e?.manifestUrl||lJ(),storage:e?.storage||new gJ},this.walletsList=new V1({walletsListSource:e?.walletsListSource,cacheTTLMs:e?.walletsListCacheTTLMs}),this.tracker=new OJ({eventDispatcher:e?.eventDispatcher,tonConnectSdkVersion:NJ}),!this.dappSettings.manifestUrl)throw new q1("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new fl(this.dappSettings.storage),e?.disableAutoPauseConnection||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return this._wallet!==null}get account(){var e;return((e=this._wallet)===null||e===void 0?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach(r=>r(this._wallet))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,r){return this.statusChangeSubscriptions.push(e),r&&this.statusChangeErrorSubscriptions.push(r),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter(n=>n!==e),r&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter(n=>n!==r))}}connect(e,r){var n,i;const s={};if(typeof r=="object"&&"tonProof"in r&&(s.request=r),typeof r=="object"&&("openingDeadlineMS"in r||"signal"in r||"request"in r)&&(s.request=r?.request,s.openingDeadlineMS=r?.openingDeadlineMS,s.signal=r?.signal),this.connected)throw new z1;const o=hs(s?.signal);if((n=this.abortController)===null||n===void 0||n.abort(),this.abortController=o,o.signal.aborted)throw new $t("Connection was aborted");return(i=this.provider)===null||i===void 0||i.closeConnection(),this.provider=this.createProvider(e),o.signal.addEventListener("abort",()=>{var a;(a=this.provider)===null||a===void 0||a.closeConnection(),this.provider=null}),this.tracker.trackConnectionStarted(),this.provider.connect(this.createConnectRequest(s?.request),{openingDeadlineMS:s?.openingDeadlineMS,signal:o.signal})}restoreConnection(e){var r,n;return At(this,void 0,void 0,function*(){this.tracker.trackConnectionRestoringStarted();const i=hs(e?.signal);if((r=this.abortController)===null||r===void 0||r.abort(),this.abortController=i,i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}const[s,o]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);if(i.signal.aborted){this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}let a=null;try{switch(s){case"http":a=yield ll.fromStorage(this.dappSettings.storage);break;case"injected":a=yield ui.fromStorage(this.dappSettings.storage);break;default:if(o)a=this.createProvider(o);else return}}catch{this.tracker.trackConnectionRestoringError("Provider is not restored"),yield this.bridgeConnectionStorage.removeConnection(),a?.closeConnection(),a=null;return}if(i.signal.aborted){a?.closeConnection(),this.tracker.trackConnectionRestoringError("Connection restoring was aborted");return}if(!a){co("Provider is not restored"),this.tracker.trackConnectionRestoringError("Provider is not restored");return}(n=this.provider)===null||n===void 0||n.closeConnection(),this.provider=a,a.listen(this.walletEventsListener.bind(this));const f=()=>{this.tracker.trackConnectionRestoringError("Connection restoring was aborted"),a?.closeConnection(),a=null};i.signal.addEventListener("abort",f);const u=cl(g=>At(this,void 0,void 0,function*(){yield a?.restoreConnection({openingDeadlineMS:e?.openingDeadlineMS,signal:g.signal}),i.signal.removeEventListener("abort",f),this.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):this.tracker.trackConnectionRestoringError("Connection restoring failed")}),{attempts:Number.MAX_SAFE_INTEGER,delayMs:2e3,signal:e?.signal}),h=new Promise(g=>setTimeout(()=>g(),12e3));return Promise.race([u,h])})}sendTransaction(e,r){return At(this,void 0,void 0,function*(){const n={};typeof r=="function"?n.onRequestSent=r:(n.onRequestSent=r?.onRequestSent,n.signal=r?.signal);const i=hs(n?.signal);if(i.signal.aborted)throw new $t("Transaction sending was aborted");this.checkConnection(),yJ(this.wallet.device.features,{requiredMessagesNumber:e.messages.length}),this.tracker.trackTransactionSentForSignature(this.wallet,e);const{validUntil:s}=e,o=GY(e,["validUntil"]),a=e.from||this.account.address,f=e.network||this.account.chain,u=yield this.provider.sendRequest(Qd.convertToRpcRequest(Object.assign(Object.assign({},o),{valid_until:s,from:a,network:f})),{onRequestSent:n.onRequestSent,signal:i.signal});if(Qd.isError(u))return this.tracker.trackTransactionSigningFailed(this.wallet,e,u.error.message,u.error.code),Qd.parseAndThrowError(u);const h=Qd.convertFromRpcResponse(u);return this.tracker.trackTransactionSigned(this.wallet,e,h),h})}disconnect(e){var r;return At(this,void 0,void 0,function*(){if(!this.connected)throw new Yd;const n=hs(e?.signal),i=this.abortController;if(this.abortController=n,n.signal.aborted)throw new $t("Disconnect was aborted");this.onWalletDisconnected("dapp"),yield(r=this.provider)===null||r===void 0?void 0:r.disconnect({signal:n.signal}),i?.abort()})}pauseConnection(){var e;((e=this.provider)===null||e===void 0?void 0:e.type)==="http"&&this.provider.pause()}unPauseConnection(){var e;return((e=this.provider)===null||e===void 0?void 0:e.type)!=="http"?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=fJ();if(e)try{e.addEventListener("visibilitychange",()=>{e.hidden?this.pauseConnection():this.unPauseConnection().catch()})}catch(r){co("Cannot subscribe to the document.visibilitychange: ",r)}}createProvider(e){let r;return!Array.isArray(e)&&YY(e)?r=new ui(this.dappSettings.storage,e.jsBridgeKey):r=new ll(this.dappSettings.storage,e),r.listen(this.walletEventsListener.bind(this)),r}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected("wallet")}}onWalletConnected(e){const r=e.items.find(s=>s.name==="ton_addr"),n=e.items.find(s=>s.name==="ton_proof");if(!r)throw new $t("ton_addr connection item was not found");const i={device:e.device,provider:this.provider.type,account:{address:r.address,chain:r.network,walletStateInit:r.walletStateInit,publicKey:r.publicKey}};n&&(i.connectItems={tonProof:n}),this.wallet=i,this.tracker.trackConnectionCompleted(i)}onWalletConnectError(e){const r=XY.parseError(e);if(this.statusChangeErrorSubscriptions.forEach(n=>n(r)),xn(r),this.tracker.trackConnectionError(e.message,e.code),r instanceof Gd||r instanceof Vd)throw co(r),r}onWalletDisconnected(e){this.tracker.trackDisconnection(this.wallet,e),this.wallet=null}checkConnection(){if(!this.connected)throw new Yd}createConnectRequest(e){const r=[{name:"ton_addr"}];return e?.tonProof&&r.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:r}}}hl.walletsList=new V1,hl.isWalletInjected=t=>ui.isWalletInjected(t),hl.isInsideWalletBrowser=t=>ui.isInsideWalletBrowser(t);for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e)}function Y1(t){const{children:e,onClick:r}=t;return he.jsx("button",{onClick:r,className:"xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center",children:e})}function E7(t){const{wallet:e,connector:r,loading:n}=t,i=Se.useRef(null),s=Se.useRef(),[o,a]=Se.useState(),[f,u]=Se.useState(),[h,g]=Se.useState("connect"),[b,x]=Se.useState(!1),[S,C]=Se.useState();function D(W){s.current?.update({data:W})}async function B(){x(!0);try{a("");const W=await Fo.getNonce({account_type:"block_chain"});if("universalLink"in e&&e.universalLink){const V=r.connect({universalLink:e.universalLink,bridgeUrl:e.bridgeUrl},{request:{tonProof:W}});if(!V)return;C(V),D(V),u(W)}}catch(W){a(W.message)}x(!1)}function L(){s.current=new e7({width:264,height:264,margin:0,type:"svg",qrOptions:{errorCorrectionLevel:"M"},dotsOptions:{color:"black",type:"rounded"},backgroundOptions:{color:"transparent"}}),s.current.append(i.current)}function H(){r.connect(e,{request:{tonProof:f}})}function F(){if("deepLink"in e){if(!e.deepLink||!S)return;const W=new URL(S),V=`${e.deepLink}${W.search}`;window.open(V)}}function k(){"universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)&&window.open(S)}const $=Se.useMemo(()=>!!("deepLink"in e&&e.deepLink),[e]),R=Se.useMemo(()=>!!("universalLink"in e&&e.universalLink&&/t.me/.test(e.universalLink)),[e]);return Se.useEffect(()=>{L(),B()},[]),he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-6",children:he.jsx(Wa,{title:"Connect wallet",onBack:t.onBack})}),he.jsxs("div",{className:"xc-text-center xc-mb-6",children:[he.jsxs("div",{className:"xc-relative xc-mx-auto xc-mb-6 xc-block xc-max-h-[272px] xc-max-w-[272px] xc-rounded-xl xc-bg-white xc-p-1",children:[he.jsx("div",{className:"xc-aspect-[1/1] xc-flex xc-h-full xc-w-full xc-justify-center",ref:i}),he.jsx("div",{className:"xc-absolute xc-left-0 xc-top-0 xc-flex xc-h-full xc-w-full xc-items-center xc-justify-center",children:b?he.jsx(Fa,{className:"xc-h-6 xc-w-6 xc-animate-spin xc-text-black",size:20}):he.jsx("img",{className:"xc-h-10 xc-w-10 xc-rounded-md",src:e.imageUrl})})]}),he.jsx("p",{className:"xc-text-center",children:"Scan the QR code below with your phone's camera. "})]}),he.jsxs("div",{className:"xc-flex xc-justify-center xc-gap-2",children:[n&&he.jsx(Fa,{className:"xc-animate-spin"}),!b&&!n&&he.jsxs(he.Fragment,{children:[_7(e)&&he.jsxs(Y1,{onClick:H,children:[he.jsx(Fz,{className:"xc-opacity-80"}),"Extension"]}),$&&he.jsxs(Y1,{onClick:F,children:[he.jsx($4,{className:"xc-opacity-80"}),"Desktop"]}),R&&he.jsx(Y1,{onClick:k,children:"Telegram Mini App"})]})]})]})}function LJ(t){const[e,r]=Se.useState(""),[n,i]=Se.useState(),[s,o]=Se.useState(),a=F1(),[f,u]=Se.useState(!1);async function h(b){if(!b||!b.connectItems?.tonProof)return;u(!0);const x=await Fo.tonLogin({account_type:"block_chain",connector:"codatta_ton",account_enum:"C",wallet_name:b?.device.appName,inviter_code:a.inviterCode,address:b.account.address,chain:b.account.chain,connect_info:[{name:"ton_addr",network:b.account.chain,...b.account},b.connectItems?.tonProof],source:{device:a.device,channel:a.channel,app:a.app}});await t.onLogin(x.data),u(!1)}Se.useEffect(()=>{const b=new hl({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"}),x=b.onStatusChange(h);return o(b),r("select"),x},[]);function g(b){r("connect"),i(b)}return he.jsxs(ls,{children:[e==="select"&&he.jsx(a7,{connector:s,onSelect:g,onBack:t.onBack}),e==="connect"&&he.jsx(E7,{connector:s,wallet:n,onBack:t.onBack,loading:f})]})}function S7(t){const{children:e,className:r}=t,n=Se.useRef(null),[i,s]=Se.useState(0);function o(){try{const a=n.current?.children||[];let f=0;for(let u=0;u{const a=new MutationObserver(o);return a.observe(n.current,{childList:!0,subtree:!0}),()=>a.disconnect()},[]),Se.useEffect(()=>{console.log("maxHeight",i)},[i]),he.jsx("div",{ref:n,className:r,style:{transition:"all 0.2s ease-in-out",overflow:"hidden",height:i},children:e})}function kJ(){return he.jsxs("svg",{width:"121",height:"120",viewBox:"0 0 121 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[he.jsx("rect",{x:"0.5",width:"120",height:"120",rx:"60",fill:"#404049"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M52.8709 61.106C52.8208 61.4482 52.7948 61.7979 52.7948 62.1535C52.7948 66.2529 56.2445 69.5761 60.5 69.5761C64.7554 69.5761 68.2052 66.2529 68.2052 62.1535C68.2052 61.7979 68.1792 61.4482 68.129 61.106H86.826V77.6174C86.826 78.6422 85.9636 79.473 84.8997 79.473H36.1002C35.0364 79.473 34.174 78.6422 34.174 77.6174V61.106H52.8709Z",fill:"#252532"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M69.061 60.9416C69.061 65.6697 65.2281 69.5026 60.5 69.5026C55.7719 69.5026 51.939 65.6697 51.939 60.9416C51.939 60.7884 51.943 60.6362 51.951 60.485H33.5L39.7959 41.8696C40.0673 41.0671 40.8202 40.527 41.6674 40.527H79.3326C80.1798 40.527 80.9327 41.0671 81.2041 41.8696L87.5 60.485H69.049C69.057 60.6362 69.061 60.7884 69.061 60.9416Z",fill:"#252532"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M67.8081 61.5708C67.8081 65.2243 64.5361 68.8446 60.4999 68.8446C56.4637 68.8446 53.1918 65.2243 53.1918 61.5708C53.1918 61.4524 53.1952 60.6762 53.202 60.5594H39.4268L44.8013 47.4919C45.033 46.8717 45.6757 46.4543 46.3989 46.4543H74.601C75.3242 46.4543 75.9669 46.8717 76.1986 47.4919L81.5731 60.5594H67.7979C67.8046 60.6762 67.8081 61.4524 67.8081 61.5708Z",fill:"#404049"}),he.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.3232 60.6199V78.063C34.3232 78.6995 34.8392 79.2155 35.4757 79.2155H85.5245C86.1609 79.2155 86.6769 78.6995 86.6769 78.063V60.6199L80.4244 42.1328C80.2661 41.6647 79.8269 41.3496 79.3327 41.3496H41.6674C41.1733 41.3496 40.7341 41.6647 40.5758 42.1328L34.3232 60.6199Z",stroke:"#77777D","stroke-width":"2"}),he.jsx("path",{d:"M34.817 60.2823C37.4094 60.2823 48.1095 60.2823 51.1124 60.2823C52.348 60.2823 52.348 61.1507 52.348 61.5994C52.348 65.9638 55.9675 69.5019 60.4323 69.5019C64.8971 69.5019 68.5165 65.9638 68.5165 61.5994C68.5165 61.1507 68.5165 60.2823 69.7521 60.2823H86.1829",stroke:"#77777D","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}function A7(t){const{wallets:e}=Hf(),[r,n]=Se.useState(),i=Se.useMemo(()=>r?e.filter(a=>a.key.toLowerCase().includes(r.toLowerCase())):e,[r]);function s(a){t.onSelectWallet(a)}function o(a){n(a.target.value)}return he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-6",children:he.jsx(Wa,{title:"Select wallet",onBack:t.onBack})}),he.jsxs("div",{className:"xc-mb-6 xc-flex xc-gap-3 xc-px-4 xc-py-2 xc-border xc-rounded-xl xc-w-full xc-overflow-hidden xc-items-center xc-border-opacity-15 xc-border-white focus-within:xc-border-opacity-40",children:[he.jsx(q4,{className:"xc-shrink-0 xc-opacity-50"}),he.jsx("input",{type:"text",className:"xc-flex-1 xc-bg-transparent xc-appearance-none xc-outline-none",placeholder:"Search wallet",onInput:o})]}),he.jsx("div",{className:"xc-mb-4 xc-flex xc-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar",children:i.length?i.map(a=>he.jsx(TS,{wallet:a,onClick:s},`feature-${a.key}`)):he.jsx(kJ,{})})]})}function BJ(t){const{onLogin:e,header:r,showEmailSignIn:n=!0,showMoreWallets:i=!0,showTonConnect:s=!0,showFeaturedWallets:o=!0}=t,[a,f]=Se.useState(""),[u,h]=Se.useState(null),[g,b]=Se.useState("");function x(B){h(B),f("evm-wallet")}function S(B){f("email"),b(B)}async function C(B){await e(B)}function D(){f("ton-wallet")}return Se.useEffect(()=>{f("index")},[]),he.jsx(JG,{config:t.config,children:he.jsxs(S7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[a==="evm-wallet"&&he.jsx(LY,{onBack:()=>f("index"),onLogin:C,wallet:u}),a==="ton-wallet"&&he.jsx(LJ,{onBack:()=>f("index"),onLogin:C}),a==="email"&&he.jsx(lY,{email:g,onBack:()=>f("index"),onLogin:C}),a==="index"&&he.jsx($S,{header:r,useSingleWallet:!0,onEmailConfirm:S,onSelectWallet:x,onSelectMoreWallets:()=>{f("all-wallet")},onSelectTonConnect:D,config:{showEmailSignIn:n,showFeaturedWallets:o,showMoreWallets:i,showTonConnect:s}}),a==="all-wallet"&&he.jsx(A7,{onBack:()=>f("index"),onSelectWallet:x})]})})}function FJ(t){const{wallet:e,onConnect:r}=t,[n,i]=Se.useState(e.installed?"connect":"qr");async function s(o,a){await r(o,a)}return he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-6",children:he.jsx(Wa,{title:"Connect wallet",onBack:t.onBack})}),n==="qr"&&he.jsx(i7,{wallet:e,onGetExtension:()=>i("get-extension"),onSignFinish:s}),n==="connect"&&he.jsx(s7,{onShowQrCode:()=>i("qr"),wallet:e,onSignFinish:s}),n==="get-extension"&&he.jsx(o7,{wallet:e})]})}function jJ(t){const{email:e}=t,[r,n]=Se.useState("captcha");return he.jsxs(ls,{children:[he.jsx("div",{className:"xc-mb-12",children:he.jsx(Wa,{title:"Connect with email",onBack:t.onBack})}),r==="captcha"&&he.jsx(ZS,{email:e,onCodeSend:()=>n("verify-email")}),r==="verify-email"&&he.jsx(XS,{email:e,onInputCode:t.onInputCode,onResendCode:()=>n("captcha")})]})}function UJ(t){const{onEvmWalletConnect:e,onTonWalletConnect:r,onEmailConnect:n,header:i,config:s={showEmailSignIn:!1,showFeaturedWallets:!0,showMoreWallets:!0,showTonConnect:!0}}=t,[o,a]=Se.useState(""),[f,u]=Se.useState(),[h,g]=Se.useState(),b=Se.useRef(),[x,S]=Se.useState("");function C(k){u(k),a("evm-wallet-connect")}function D(k){S(k),a("email-connect")}async function B(k,$){await e?.({chain_type:"eip155",client:k.client,connect_info:$,wallet:k}),a("index")}async function L(k,$){await n?.(k,$)}function H(k){g(k),a("ton-wallet-connect")}async function F(k){k&&await r?.({chain_type:"ton",client:b.current,connect_info:k,wallet:k})}return Se.useEffect(()=>{b.current=new hl({manifestUrl:"https://static.codatta.io/static/tonconnect-manifest.json?v=2"});const k=b.current.onStatusChange(F);return a("index"),k},[]),he.jsxs(S7,{className:"xc-rounded-2xl xc-transition-height xc-box-content xc-w-full xc-min-w-[277px] xc-max-w-[420px] xc-p-6 xc-bg-[rgb(28,28,38)] xc-text-white",children:[o==="evm-wallet-select"&&he.jsx(A7,{onBack:()=>a("index"),onSelectWallet:C}),o==="evm-wallet-connect"&&he.jsx(FJ,{onBack:()=>a("index"),onConnect:B,wallet:f}),o==="ton-wallet-select"&&he.jsx(a7,{connector:b.current,onSelect:H,onBack:()=>a("index")}),o==="ton-wallet-connect"&&he.jsx(E7,{connector:b.current,wallet:h,onBack:()=>a("index")}),o==="email-connect"&&he.jsx(jJ,{email:x,onBack:()=>a("index"),onInputCode:L}),o==="index"&&he.jsx($S,{header:i,useSingleWallet:!1,onEmailConfirm:D,onSelectWallet:C,onSelectMoreWallets:()=>a("evm-wallet-select"),onSelectTonConnect:()=>a("ton-wallet-select"),config:s})]})}Ii.CodattaConnect=UJ,Ii.CodattaConnectContextProvider=Rz,Ii.CodattaSignin=BJ,Ii.WalletItem=la,Ii.coinbaseWallet=B4,Ii.useCodattaConnectContext=Hf,Object.defineProperty(Ii,Symbol.toStringTag,{value:"Module"})})); diff --git a/dist/main-DmP-7EWG.js b/dist/main-CtRNJ0s5.js similarity index 97% rename from dist/main-DmP-7EWG.js rename to dist/main-CtRNJ0s5.js index 14ae93e..dc86cf4 100644 --- a/dist/main-DmP-7EWG.js +++ b/dist/main-CtRNJ0s5.js @@ -66,11 +66,11 @@ var _u = {}; var Dw; function mT() { return Dw || (Dw = 1, process.env.NODE_ENV !== "production" && (function() { - var t = Wv, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), a = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), u = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), g = Symbol.for("react.memo"), v = Symbol.for("react.lazy"), x = Symbol.for("react.offscreen"), S = Symbol.iterator, C = "@@iterator"; + var t = Wv, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), a = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), u = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), g = Symbol.for("react.memo"), v = Symbol.for("react.lazy"), x = Symbol.for("react.offscreen"), S = Symbol.iterator, R = "@@iterator"; function D(F) { if (F === null || typeof F != "object") return null; - var ie = S && F[S] || F[C]; + var ie = S && F[S] || F[R]; return typeof ie == "function" ? ie : null; } var k = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; @@ -91,10 +91,10 @@ function mT() { Le.unshift("Warning: " + ie), Function.prototype.apply.call(console[F], console, Le); } } - var B = !1, $ = !1, U = !1, R = !1, W = !1, J; + var B = !1, $ = !1, U = !1, C = !1, W = !1, J; J = Symbol.for("react.module.reference"); function ne(F) { - return !!(typeof F == "string" || typeof F == "function" || F === n || F === s || W || F === i || F === u || F === h || R || F === x || B || $ || U || typeof F == "object" && F !== null && (F.$$typeof === v || F.$$typeof === g || F.$$typeof === o || F.$$typeof === a || F.$$typeof === f || // This needs to include all possible module reference object + return !!(typeof F == "string" || typeof F == "function" || F === n || F === s || W || F === i || F === u || F === h || C || F === x || B || $ || U || typeof F == "object" && F !== null && (F.$$typeof === v || F.$$typeof === g || F.$$typeof === o || F.$$typeof === a || F.$$typeof === f || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. @@ -2132,10 +2132,10 @@ function FD(t, e, { length: r, staticPosition: n }) { const v = []; for (let x = 0; x < u; ++x) { t.setPosition(f + (h ? x * 32 : g)); - const [S, C] = Cc(t, e, { + const [S, R] = Cc(t, e, { staticPosition: f }); - g += C, v.push(S); + g += R, v.push(S); } return t.setPosition(n + 32), [v, 32]; } @@ -2998,7 +2998,7 @@ function cO(t) { return Vf(`0x${e}`); } async function uO({ hash: t, signature: e }) { - const r = Uo(t) ? t : od(t), { secp256k1: n } = await import("./secp256k1-K3HVP1eD.js"); + const r = Uo(t) ? t : od(t), { secp256k1: n } = await import("./secp256k1-C66jOJWb.js"); return `0x${(() => { if (typeof e == "object" && "r" in e && "s" in e) { const { r: u, s: h, v: g, yParity: v } = e, x = Number(v ?? g), S = Vw(x); @@ -3770,13 +3770,13 @@ class LO extends OO { for (let g = 0; g < 16; g++, r += 4) Po[g] = e.getUint32(r, !1); for (let g = 16; g < 64; g++) { - const v = Po[g - 15], x = Po[g - 2], S = ws(v, 7) ^ ws(v, 18) ^ v >>> 3, C = ws(x, 17) ^ ws(x, 19) ^ x >>> 10; - Po[g] = C + Po[g - 7] + S + Po[g - 16] | 0; + const v = Po[g - 15], x = Po[g - 2], S = ws(v, 7) ^ ws(v, 18) ^ v >>> 3, R = ws(x, 17) ^ ws(x, 19) ^ x >>> 10; + Po[g] = R + Po[g - 7] + S + Po[g - 16] | 0; } let { A: n, B: i, C: s, D: o, E: a, F: f, G: u, H: h } = this; for (let g = 0; g < 64; g++) { - const v = ws(a, 6) ^ ws(a, 11) ^ ws(a, 25), x = h + v + TO(a, f, u) + NO[g] + Po[g] | 0, C = (ws(n, 2) ^ ws(n, 13) ^ ws(n, 22)) + DO(n, i, s) | 0; - h = u, u = f, f = a, a = o + x | 0, o = s, s = i, i = n, n = x + C | 0; + const v = ws(a, 6) ^ ws(a, 11) ^ ws(a, 25), x = h + v + TO(a, f, u) + NO[g] + Po[g] | 0, R = (ws(n, 2) ^ ws(n, 13) ^ ws(n, 22)) + DO(n, i, s) | 0; + h = u, u = f, f = a, a = o + x | 0, o = s, s = i, i = n, n = x + R | 0; } n = n + this.A | 0, i = i + this.B | 0, s = s + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, f = f + this.F | 0, u = u + this.G | 0, h = h + this.H | 0, this.set(n, i, s, o, a, f, u, h); } @@ -3890,9 +3890,9 @@ async function f1(t, e) { async function S() { return x || (x = await Hn(t, hd, "getBlock")({ blockTag: "latest" }), x); } - let C; + let R; async function D() { - return C || (i ? i.id : typeof e.chainId < "u" ? e.chainId : (C = await Hn(t, Gf, "getChainId")({}), C)); + return R || (i ? i.id : typeof e.chainId < "u" ? e.chainId : (R = await Hn(t, Gf, "getChainId")({}), R)); } if (u.includes("nonce") && typeof a > "u" && g) if (f) { @@ -3982,14 +3982,14 @@ async function KO(t, e) { params: m ? [p, l ?? "latest", m] : l ? [p, l] : [p] }); }; - const { accessList: i, authorizationList: s, blobs: o, blobVersionedHashes: a, blockNumber: f, blockTag: u, data: h, gas: g, gasPrice: v, maxFeePerBlobGas: x, maxFeePerGas: S, maxPriorityFeePerGas: C, nonce: D, value: k, stateOverride: N, ...z } = await f1(t, { + const { accessList: i, authorizationList: s, blobs: o, blobVersionedHashes: a, blockNumber: f, blockTag: u, data: h, gas: g, gasPrice: v, maxFeePerBlobGas: x, maxFeePerGas: S, maxPriorityFeePerGas: R, nonce: D, value: k, stateOverride: N, ...z } = await f1(t, { ...e, parameters: ( // Some RPC Providers do not compute versioned hashes from blobs. We will need // to compute them. n?.type === "local" ? void 0 : ["blobVersionedHashes"] ) - }), $ = (typeof f == "bigint" ? br(f) : void 0) || u, U = wO(N), R = await (async () => { + }), $ = (typeof f == "bigint" ? br(f) : void 0) || u, U = wO(N), C = await (async () => { if (z.to) return z.to; if (s && s.length > 0) @@ -4013,9 +4013,9 @@ async function KO(t, e) { gasPrice: v, maxFeePerBlobGas: x, maxFeePerGas: S, - maxPriorityFeePerGas: C, + maxPriorityFeePerGas: R, nonce: D, - to: R, + to: C, value: k }); let E = BigInt(await K({ block: $, request: ne, rpcStateOverride: U })); @@ -4194,7 +4194,7 @@ async function F4(t, { serializedTransaction: e }) { } const zp = new qd(128); async function Kd(t, e) { - const { account: r = t.account, chain: n = t.chain, accessList: i, authorizationList: s, blobs: o, data: a, gas: f, gasPrice: u, maxFeePerBlobGas: h, maxFeePerGas: g, maxPriorityFeePerGas: v, nonce: x, type: S, value: C, ...D } = e; + const { account: r = t.account, chain: n = t.chain, accessList: i, authorizationList: s, blobs: o, data: a, gas: f, gasPrice: u, maxFeePerBlobGas: h, maxFeePerGas: g, maxPriorityFeePerGas: v, nonce: x, type: S, value: R, ...D } = e; if (typeof r > "u") throw new qa({ docsPath: "/docs/actions/wallet/sendTransaction" @@ -4235,15 +4235,15 @@ async function Kd(t, e) { nonce: x, to: N, type: S, - value: C - }), R = zp.get(t.uid), W = R ? "wallet_sendTransaction" : "eth_sendTransaction"; + value: R + }), C = zp.get(t.uid), W = C ? "wallet_sendTransaction" : "eth_sendTransaction"; try { return await t.request({ method: W, params: [U] }, { retryCount: 0 }); } catch (J) { - if (R === !1) + if (C === !1) throw J; const ne = J; if (ne.name === "InvalidInputRpcError" || ne.name === "InvalidParamsRpcError" || ne.name === "MethodNotFoundRpcError" || ne.name === "MethodNotSupportedRpcError") @@ -4274,7 +4274,7 @@ async function Kd(t, e) { nonceManager: k.nonceManager, parameters: [...k4, "sidecars"], type: S, - value: C, + value: R, ...D, to: N }), B = n?.serializers?.transaction, $ = await k.signTransaction(z, { @@ -4392,10 +4392,10 @@ async function nN(t, e) { }); S.push(N), o > 0 && await new Promise((z) => setTimeout(z, o)); } - const C = await Promise.allSettled(S); - if (C.every((k) => k.status === "rejected")) - throw C[0].reason; - const D = C.map((k) => k.status === "fulfilled" ? k.value : U4); + const R = await Promise.allSettled(S); + if (R.every((k) => k.status === "rejected")) + throw R[0].reason; + const D = R.map((k) => k.status === "fulfilled" ? k.value : U4); return { id: Wo([ ...D, @@ -4417,12 +4417,12 @@ async function q4(t, e) { const v = Fd($m(h, -64, -32)), x = $m(h, 0, -64).slice(2).match(/.{1,64}/g), S = await Promise.all(x.map((D) => U4.slice(2) !== D ? t.request({ method: "eth_getTransactionReceipt", params: [`0x${D}`] - }, { dedupe: !0 }) : void 0)), C = S.some((D) => D === null) ? 100 : S.every((D) => D?.status === "0x1") ? 200 : S.every((D) => D?.status === "0x0") ? 500 : 600; + }, { dedupe: !0 }) : void 0)), R = S.some((D) => D === null) ? 100 : S.every((D) => D?.status === "0x1") ? 200 : S.every((D) => D?.status === "0x0") ? 500 : 600; return { atomic: !1, chainId: zo(v), receipts: S.filter(Boolean), - status: C, + status: R, version: "2.0.0" }; } @@ -4456,16 +4456,16 @@ async function iN(t, e) { let h; const g = QO(o, { resolve: f, reject: u }, (v) => { const x = eN(async () => { - const S = (C) => { - clearTimeout(h), x(), C(), g(); + const S = (R) => { + clearTimeout(h), x(), R(), g(); }; try { - const C = await q4(t, { id: r }); - if (!i(C)) + const R = await q4(t, { id: r }); + if (!i(R)) return; - S(() => v.resolve(C)); - } catch (C) { - S(() => v.reject(C)); + S(() => v.resolve(R)); + } catch (R) { + S(() => v.reject(R)); } }, { interval: n, @@ -4496,7 +4496,7 @@ function oN(t) { const { batch: e, chain: r, ccipRead: n, key: i = "base", name: s = "Base Client", type: o = "base" } = t, a = r?.blockTime ?? 12e3, f = Math.min(Math.max(Math.floor(a / 2), 500), 4e3), u = t.pollingInterval ?? f, h = t.cacheTime ?? u, g = t.account ? pi(t.account) : void 0, { config: v, request: x, value: S } = t.transport({ chain: r, pollingInterval: u - }), C = { ...v, ...S }, D = { + }), R = { ...v, ...S }, D = { account: g, batch: e, cacheTime: h, @@ -4506,7 +4506,7 @@ function oN(t) { name: s, pollingInterval: u, request: x, - transport: C, + transport: R, type: o, uid: z4() }; @@ -4751,7 +4751,7 @@ function vN(t) { for (const f of o) { const { name: u, type: h } = f, g = a[u], v = h.match(d4); if (v && (typeof g == "number" || typeof g == "bigint")) { - const [C, D, k] = v; + const [R, D, k] = v; br(g, { signed: D === "int", size: Number.parseInt(k) / 8 @@ -4761,7 +4761,7 @@ function vN(t) { throw new Ho({ address: g }); const x = h.match(bD); if (x) { - const [C, D] = x; + const [R, D] = x; if (D && yn(g) !== Number.parseInt(D)) throw new IT({ expectedSize: Number.parseInt(D), @@ -5115,8 +5115,8 @@ var gh = { exports: {} }, e2; function LN() { if (e2) return gh.exports; e2 = 1; - var t = typeof Reflect == "object" ? Reflect : null, e = t && typeof t.apply == "function" ? t.apply : function($, U, R) { - return Function.prototype.apply.call($, U, R); + var t = typeof Reflect == "object" ? Reflect : null, e = t && typeof t.apply == "function" ? t.apply : function($, U, C) { + return Function.prototype.apply.call($, U, C); }, r; t && typeof t.ownKeys == "function" ? r = t.ownKeys : Object.getOwnPropertySymbols ? r = function($) { return Object.getOwnPropertyNames($).concat(Object.getOwnPropertySymbols($)); @@ -5161,7 +5161,7 @@ function LN() { s.prototype.getMaxListeners = function() { return f(this); }, s.prototype.emit = function($) { - for (var U = [], R = 1; R < arguments.length; R++) U.push(arguments[R]); + for (var U = [], C = 1; C < arguments.length; C++) U.push(arguments[C]); var W = $ === "error", J = this._events; if (J !== void 0) W = W && J.error === void 0; @@ -5180,11 +5180,11 @@ function LN() { if (typeof E == "function") e(E, this, U); else - for (var b = E.length, l = S(E, b), R = 0; R < b; ++R) - e(l[R], this, U); + for (var b = E.length, l = S(E, b), C = 0; C < b; ++C) + e(l[C], this, U); return !0; }; - function u(B, $, U, R) { + function u(B, $, U, C) { var W, J, ne; if (a(U), J = B._events, J === void 0 ? (J = B._events = /* @__PURE__ */ Object.create(null), B._eventsCount = 0) : (J.newListener !== void 0 && (B.emit( "newListener", @@ -5192,7 +5192,7 @@ function LN() { U.listener ? U.listener : U ), J = B._events), ne = J[$]), ne === void 0) ne = J[$] = U, ++B._eventsCount; - else if (typeof ne == "function" ? ne = J[$] = R ? [U, ne] : [ne, U] : R ? ne.unshift(U) : ne.push(U), W = f(B), W > 0 && ne.length > W && !ne.warned) { + else if (typeof ne == "function" ? ne = J[$] = C ? [U, ne] : [ne, U] : C ? ne.unshift(U) : ne.push(U), W = f(B), W > 0 && ne.length > W && !ne.warned) { ne.warned = !0; var K = new Error("Possible EventEmitter memory leak detected. " + ne.length + " " + String($) + " listeners added. Use emitter.setMaxListeners() to increase limit"); K.name = "MaxListenersExceededWarning", K.emitter = B, K.type = $, K.count = ne.length, n(K); @@ -5209,45 +5209,45 @@ function LN() { return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments); } function g(B, $, U) { - var R = { fired: !1, wrapFn: void 0, target: B, type: $, listener: U }, W = h.bind(R); - return W.listener = U, R.wrapFn = W, W; + var C = { fired: !1, wrapFn: void 0, target: B, type: $, listener: U }, W = h.bind(C); + return W.listener = U, C.wrapFn = W, W; } s.prototype.once = function($, U) { return a(U), this.on($, g(this, $, U)), this; }, s.prototype.prependOnceListener = function($, U) { return a(U), this.prependListener($, g(this, $, U)), this; }, s.prototype.removeListener = function($, U) { - var R, W, J, ne, K; + var C, W, J, ne, K; if (a(U), W = this._events, W === void 0) return this; - if (R = W[$], R === void 0) + if (C = W[$], C === void 0) return this; - if (R === U || R.listener === U) - --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete W[$], W.removeListener && this.emit("removeListener", $, R.listener || U)); - else if (typeof R != "function") { - for (J = -1, ne = R.length - 1; ne >= 0; ne--) - if (R[ne] === U || R[ne].listener === U) { - K = R[ne].listener, J = ne; + if (C === U || C.listener === U) + --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete W[$], W.removeListener && this.emit("removeListener", $, C.listener || U)); + else if (typeof C != "function") { + for (J = -1, ne = C.length - 1; ne >= 0; ne--) + if (C[ne] === U || C[ne].listener === U) { + K = C[ne].listener, J = ne; break; } if (J < 0) return this; - J === 0 ? R.shift() : C(R, J), R.length === 1 && (W[$] = R[0]), W.removeListener !== void 0 && this.emit("removeListener", $, K || U); + J === 0 ? C.shift() : R(C, J), C.length === 1 && (W[$] = C[0]), W.removeListener !== void 0 && this.emit("removeListener", $, K || U); } return this; }, s.prototype.off = s.prototype.removeListener, s.prototype.removeAllListeners = function($) { - var U, R, W; - if (R = this._events, R === void 0) + var U, C, W; + if (C = this._events, C === void 0) return this; - if (R.removeListener === void 0) - return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : R[$] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete R[$]), this; + if (C.removeListener === void 0) + return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : C[$] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete C[$]), this; if (arguments.length === 0) { - var J = Object.keys(R), ne; + var J = Object.keys(C), ne; for (W = 0; W < J.length; ++W) ne = J[W], ne !== "removeListener" && this.removeAllListeners(ne); return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this; } - if (U = R[$], typeof U == "function") + if (U = C[$], typeof U == "function") this.removeListener($, U); else if (U !== void 0) for (W = U.length - 1; W >= 0; W--) @@ -5255,10 +5255,10 @@ function LN() { return this; }; function v(B, $, U) { - var R = B._events; - if (R === void 0) + var C = B._events; + if (C === void 0) return []; - var W = R[$]; + var W = C[$]; return W === void 0 ? [] : typeof W == "function" ? U ? [W.listener || W] : [W] : U ? D(W) : S(W, W.length); } s.prototype.listeners = function($) { @@ -5283,11 +5283,11 @@ function LN() { return this._eventsCount > 0 ? r(this._events) : []; }; function S(B, $) { - for (var U = new Array($), R = 0; R < $; ++R) - U[R] = B[R]; + for (var U = new Array($), C = 0; C < $; ++C) + U[C] = B[C]; return U; } - function C(B, $) { + function R(B, $) { for (; $ + 1 < B.length; $++) B[$] = B[$ + 1]; B.pop(); @@ -5298,9 +5298,9 @@ function LN() { return $; } function k(B, $) { - return new Promise(function(U, R) { + return new Promise(function(U, C) { function W(ne) { - B.removeListener($, J), R(ne); + B.removeListener($, J), C(ne); } function J() { typeof B.removeListener == "function" && B.removeListener("error", W), U([].slice.call(arguments)); @@ -5311,12 +5311,12 @@ function LN() { function N(B, $, U) { typeof B.on == "function" && z(B, "error", $, U); } - function z(B, $, U, R) { + function z(B, $, U, C) { if (typeof B.on == "function") - R.once ? B.once($, U) : B.on($, U); + C.once ? B.once($, U) : B.on($, U); else if (typeof B.addEventListener == "function") B.addEventListener($, function W(J) { - R.once && B.removeEventListener($, W), U(J); + C.once && B.removeEventListener($, W), U(J); }); else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof B); @@ -5528,8 +5528,8 @@ function VN(t, e, r) { }, i; function o(v) { n[v] && (i[v] = function(x) { - return new Promise(function(S, C) { - s.push([v, x, S, C]) > 1 || a(v, x); + return new Promise(function(S, R) { + s.push([v, x, S, R]) > 1 || a(v, x); }); }); } @@ -5975,15 +5975,15 @@ function PL(t = {}) { } }, a = (u, h, g) => { const v = /* @__PURE__ */ new Map(), x = (S) => { - let C = v.get(S.base); - return C || (C = { + let R = v.get(S.base); + return R || (R = { driver: S.driver, base: S.base, items: [] - }, v.set(S.base, C)), C; + }, v.set(S.base, R)), R; }; for (const S of u) { - const C = typeof S == "string", D = ci(C ? S : S.key), k = C ? void 0 : S.value, N = C || !S.options ? h : { ...h, ...S.options }, z = r(D); + const R = typeof S == "string", D = ci(R ? S : S.key), k = R ? void 0 : S.value, N = R || !S.options ? h : { ...h, ...S.options }, z = r(D); x(z).items.push({ key: D, value: k, @@ -6095,7 +6095,7 @@ function PL(t = {}) { v.getItem, g + "$", h - ).then((C) => mh(C)); + ).then((R) => mh(R)); S && typeof S == "object" && (typeof S.atime == "string" && (S.atime = new Date(S.atime)), typeof S.mtime == "string" && (S.mtime = new Date(S.mtime)), Object.assign(x, S)); } return x; @@ -6113,12 +6113,12 @@ function PL(t = {}) { let v = []; const x = []; for (const S of g) { - const C = await Mn( + const R = await Mn( S.driver.getKeys, S.relativeBase, h ); - for (const D of C) { + for (const D of R) { const k = S.mountpoint + ci(D); v.some((N) => k.startsWith(N)) || x.push(k); } @@ -6437,18 +6437,18 @@ function WL() { return r; var h = n.length; if (h === 0) return r; - for (var g = "", v = 1 - o, x = -1, S = r && r.length || 0, C = 0; C < S; ) { - if (r.charCodeAt(C) === 37 && C + 1 < S) { - switch (x = x > -1 ? x : 0, r.charCodeAt(C + 1)) { + for (var g = "", v = 1 - o, x = -1, S = r && r.length || 0, R = 0; R < S; ) { + if (r.charCodeAt(R) === 37 && R + 1 < S) { + switch (x = x > -1 ? x : 0, r.charCodeAt(R + 1)) { case 100: // 'd' case 102: if (v >= h || n[v] == null) break; - x < C && (g += r.slice(x, C)), g += Number(n[v]), x = C + 2, C++; + x < R && (g += r.slice(x, R)), g += Number(n[v]), x = R + 2, R++; break; case 105: if (v >= h || n[v] == null) break; - x < C && (g += r.slice(x, C)), g += Math.floor(Number(n[v])), x = C + 2, C++; + x < R && (g += r.slice(x, R)), g += Math.floor(Number(n[v])), x = R + 2, R++; break; case 79: // 'O' @@ -6456,30 +6456,30 @@ function WL() { // 'o' case 106: if (v >= h || n[v] === void 0) break; - x < C && (g += r.slice(x, C)); + x < R && (g += r.slice(x, R)); var D = typeof n[v]; if (D === "string") { - g += "'" + n[v] + "'", x = C + 2, C++; + g += "'" + n[v] + "'", x = R + 2, R++; break; } if (D === "function") { - g += n[v].name || "", x = C + 2, C++; + g += n[v].name || "", x = R + 2, R++; break; } - g += s(n[v]), x = C + 2, C++; + g += s(n[v]), x = R + 2, R++; break; case 115: if (v >= h) break; - x < C && (g += r.slice(x, C)), g += String(n[v]), x = C + 2, C++; + x < R && (g += r.slice(x, R)), g += String(n[v]), x = R + 2, R++; break; case 37: - x < C && (g += r.slice(x, C)), g += "%", x = C + 2, C++, v--; + x < R && (g += r.slice(x, R)), g += "%", x = R + 2, R++, v--; break; } ++v; } - ++C; + ++R; } return x === -1 ? r : (x < S && (g += r.slice(x)), g); } @@ -6494,22 +6494,22 @@ function KL() { const e = $().console || {}, r = { mapHttpRequest: S, mapHttpResponse: S, - wrapRequestSerializer: C, - wrapResponseSerializer: C, - wrapErrorSerializer: C, + wrapRequestSerializer: R, + wrapResponseSerializer: R, + wrapErrorSerializer: R, req: S, res: S, err: v }; - function n(U, R) { + function n(U, C) { return Array.isArray(U) ? U.filter(function(J) { return J !== "!stdSerializers.err"; - }) : U === !0 ? Object.keys(R) : !1; + }) : U === !0 ? Object.keys(C) : !1; } function i(U) { U = U || {}, U.browser = U.browser || {}; - const R = U.browser.transmit; - if (R && typeof R.send != "function") + const C = U.browser.transmit; + if (C && typeof C.send != "function") throw Error("pino: transmit option must have a send function"); const W = U.browser.write || e; U.browser.write && (U.browser.asObject = !0); @@ -6526,13 +6526,13 @@ function KL() { set: P }); const p = { - transmit: R, + transmit: C, serialize: ne, asObject: U.browser.asObject, levels: E, timestamp: x(U) }; - l.levels = i.levels, l.level = b, l.setMaxListeners = l.getMaxListeners = l.emit = l.addListener = l.on = l.prependListener = l.once = l.prependOnceListener = l.removeListener = l.removeAllListeners = l.listeners = l.listenerCount = l.eventNames = l.write = l.flush = D, l.serializers = J, l._serialize = ne, l._stdErrSerialize = K, l.child = _, R && (l._logEvent = g()); + l.levels = i.levels, l.level = b, l.setMaxListeners = l.getMaxListeners = l.emit = l.addListener = l.on = l.prependListener = l.once = l.prependOnceListener = l.removeListener = l.removeAllListeners = l.listeners = l.listenerCount = l.eventNames = l.write = l.flush = D, l.serializers = J, l._serialize = ne, l._stdErrSerialize = K, l.child = _, C && (l._logEvent = g()); function m() { return this.level === "silent" ? 1 / 0 : this.levels.values[this.level]; } @@ -6554,7 +6554,7 @@ function KL() { delete y.serializers, f([y], ce, q, this._stdErrSerialize); } function L(oe) { - this._childLevel = (oe._childLevel | 0) + 1, this.error = u(oe, y, "error"), this.fatal = u(oe, y, "fatal"), this.warn = u(oe, y, "warn"), this.info = u(oe, y, "info"), this.debug = u(oe, y, "debug"), this.trace = u(oe, y, "trace"), q && (this.serializers = q, this._serialize = ce), R && (this._logEvent = g( + this._childLevel = (oe._childLevel | 0) + 1, this.error = u(oe, y, "error"), this.fatal = u(oe, y, "fatal"), this.warn = u(oe, y, "warn"), this.info = u(oe, y, "info"), this.debug = u(oe, y, "debug"), this.trace = u(oe, y, "trace"), q && (this.serializers = q, this._serialize = ce), C && (this._logEvent = g( [].concat(oe._logEvent.bindings, y) )); } @@ -6580,36 +6580,36 @@ function KL() { 60: "fatal" } }, i.stdSerializers = r, i.stdTimeFunctions = Object.assign({}, { nullTime: k, epochTime: N, unixTime: z, isoTime: B }); - function s(U, R, W, J) { - const ne = Object.getPrototypeOf(R); - R[W] = R.levelVal > R.levels.values[W] ? D : ne[W] ? ne[W] : e[W] || e[J] || D, o(U, R, W); + function s(U, C, W, J) { + const ne = Object.getPrototypeOf(C); + C[W] = C.levelVal > C.levels.values[W] ? D : ne[W] ? ne[W] : e[W] || e[J] || D, o(U, C, W); } - function o(U, R, W) { - !U.transmit && R[W] === D || (R[W] = /* @__PURE__ */ (function(J) { + function o(U, C, W) { + !U.transmit && C[W] === D || (C[W] = /* @__PURE__ */ (function(J) { return function() { const K = U.timestamp(), E = new Array(arguments.length), b = Object.getPrototypeOf && Object.getPrototypeOf(this) === e ? e : this; for (var l = 0; l < E.length; l++) E[l] = arguments[l]; if (U.serialize && !U.asObject && f(E, this._serialize, this.serializers, this._stdErrSerialize), U.asObject ? J.call(b, a(this, W, E, K)) : J.apply(b, E), U.transmit) { - const p = U.transmit.level || R.level, m = i.levels.values[p], w = i.levels.values[W]; + const p = U.transmit.level || C.level, m = i.levels.values[p], w = i.levels.values[W]; if (w < m) return; h(this, { ts: K, methodLevel: W, methodValue: w, - transmitValue: i.levels.values[U.transmit.level || R.level], + transmitValue: i.levels.values[U.transmit.level || C.level], send: U.transmit.send, - val: R.levelVal + val: C.levelVal }, E); } }; - })(R[W])); + })(C[W])); } - function a(U, R, W, J) { + function a(U, C, W, J) { U._serialize && f(W, U._serialize, U.serializers, U._stdErrSerialize); const ne = W.slice(); let K = ne[0]; const E = {}; - J && (E.time = J), E.level = i.levels.values[R]; + J && (E.time = J), E.level = i.levels.values[C]; let b = (U._childLevel | 0) + 1; if (b < 1 && (b = 1), K !== null && typeof K == "object") { for (; b-- && typeof ne[0] == "object"; ) @@ -6618,25 +6618,25 @@ function KL() { } else typeof K == "string" && (K = t(ne.shift(), ne)); return K !== void 0 && (E.msg = K), E; } - function f(U, R, W, J) { + function f(U, C, W, J) { for (const ne in U) if (J && U[ne] instanceof Error) U[ne] = i.stdSerializers.err(U[ne]); else if (typeof U[ne] == "object" && !Array.isArray(U[ne])) for (const K in U[ne]) - R && R.indexOf(K) > -1 && K in W && (U[ne][K] = W[K](U[ne][K])); + C && C.indexOf(K) > -1 && K in W && (U[ne][K] = W[K](U[ne][K])); } - function u(U, R, W) { + function u(U, C, W) { return function() { const J = new Array(1 + arguments.length); - J[0] = R; + J[0] = C; for (var ne = 1; ne < J.length; ne++) J[ne] = arguments[ne - 1]; return U[W].apply(this, J); }; } - function h(U, R, W) { - const J = R.send, ne = R.ts, K = R.methodLevel, E = R.methodValue, b = R.val, l = U._logEvent.bindings; + function h(U, C, W) { + const J = C.send, ne = C.ts, K = C.methodLevel, E = C.methodValue, b = C.val, l = U._logEvent.bindings; f( W, U._serialize || Object.keys(U.serializers), @@ -6655,14 +6655,14 @@ function KL() { }; } function v(U) { - const R = { + const C = { type: U.constructor.name, msg: U.message, stack: U.stack }; for (const W in U) - R[W] === void 0 && (R[W] = U[W]); - return R; + C[W] === void 0 && (C[W] = U[W]); + return C; } function x(U) { return typeof U.timestamp == "function" ? U.timestamp : U.timestamp === !1 ? k : N; @@ -6670,7 +6670,7 @@ function KL() { function S() { return {}; } - function C(U) { + function R(U) { return U; } function D() { @@ -6688,8 +6688,8 @@ function KL() { return new Date(Date.now()).toISOString(); } function $() { - function U(R) { - return typeof R < "u" && R; + function U(C) { + return typeof C < "u" && C; } try { return typeof globalThis < "u" || Object.defineProperty(Object.prototype, "globalThis", { @@ -7102,12 +7102,12 @@ function el() { return w * 4294967296 + P; } dr.readUint64BE = S; - function C(p, m) { + function R(p, m) { m === void 0 && (m = 0); var w = u(p, m), P = u(p, m + 4); return P * 4294967296 + w - (w >> 31) * 4294967296; } - dr.readInt64LE = C; + dr.readInt64LE = R; function D(p, m) { m === void 0 && (m = 0); var w = h(p, m), P = h(p, m + 4); @@ -7162,12 +7162,12 @@ function el() { return w; } dr.writeUintLE = U; - function R(p, m) { + function C(p, m) { m === void 0 && (m = 0); var w = new DataView(p.buffer, p.byteOffset, p.byteLength); return w.getFloat32(m); } - dr.readFloat32BE = R; + dr.readFloat32BE = C; function W(p, m) { m === void 0 && (m = 0); var w = new DataView(p.buffer, p.byteOffset, p.byteLength); @@ -7235,12 +7235,12 @@ function d1() { let v = ""; const x = h.length, S = 256 - 256 % x; for (; u > 0; ) { - const C = i(Math.ceil(u * 256 / S), g); - for (let D = 0; D < C.length && u > 0; D++) { - const k = C[D]; + const R = i(Math.ceil(u * 256 / S), g); + for (let D = 0; D < R.length && u > 0; D++) { + const k = R[D]; k < S && (v += h.charAt(k % x), u--); } - (0, n.wipe)(C); + (0, n.wipe)(R); } return v; } @@ -7477,18 +7477,18 @@ function Mk() { 1246189591 ]); function s(a, f, u, h, g, v, x) { - for (var S = u[0], C = u[1], D = u[2], k = u[3], N = u[4], z = u[5], B = u[6], $ = u[7], U = h[0], R = h[1], W = h[2], J = h[3], ne = h[4], K = h[5], E = h[6], b = h[7], l, p, m, w, P, _, y, M; x >= 128; ) { + for (var S = u[0], R = u[1], D = u[2], k = u[3], N = u[4], z = u[5], B = u[6], $ = u[7], U = h[0], C = h[1], W = h[2], J = h[3], ne = h[4], K = h[5], E = h[6], b = h[7], l, p, m, w, P, _, y, M; x >= 128; ) { for (var I = 0; I < 16; I++) { var q = 8 * I + v; a[I] = e.readUint32BE(g, q), f[I] = e.readUint32BE(g, q + 4); } for (var I = 0; I < 80; I++) { - var ce = S, L = C, oe = D, Q = k, X = N, ee = z, O = B, Z = $, re = U, he = R, ae = W, fe = J, be = ne, Ae = K, Te = E, Re = b; - if (l = $, p = b, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = (N >>> 14 | ne << 18) ^ (N >>> 18 | ne << 14) ^ (ne >>> 9 | N << 23), p = (ne >>> 14 | N << 18) ^ (ne >>> 18 | N << 14) ^ (N >>> 9 | ne << 23), P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = N & z ^ ~N & B, p = ne & K ^ ~ne & E, P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = i[I * 2], p = i[I * 2 + 1], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = a[I % 16], p = f[I % 16], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, m = y & 65535 | M << 16, w = P & 65535 | _ << 16, l = m, p = w, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = (S >>> 28 | U << 4) ^ (U >>> 2 | S << 30) ^ (U >>> 7 | S << 25), p = (U >>> 28 | S << 4) ^ (S >>> 2 | U << 30) ^ (S >>> 7 | U << 25), P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = S & C ^ S & D ^ C & D, p = U & R ^ U & W ^ R & W, P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, Z = y & 65535 | M << 16, Re = P & 65535 | _ << 16, l = Q, p = fe, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = m, p = w, P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, Q = y & 65535 | M << 16, fe = P & 65535 | _ << 16, C = ce, D = L, k = oe, N = Q, z = X, B = ee, $ = O, S = Z, R = re, W = he, J = ae, ne = fe, K = be, E = Ae, b = Te, U = Re, I % 16 === 15) + var ce = S, L = R, oe = D, Q = k, X = N, ee = z, O = B, Z = $, re = U, he = C, ae = W, fe = J, be = ne, Ae = K, Te = E, Re = b; + if (l = $, p = b, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = (N >>> 14 | ne << 18) ^ (N >>> 18 | ne << 14) ^ (ne >>> 9 | N << 23), p = (ne >>> 14 | N << 18) ^ (ne >>> 18 | N << 14) ^ (N >>> 9 | ne << 23), P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = N & z ^ ~N & B, p = ne & K ^ ~ne & E, P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = i[I * 2], p = i[I * 2 + 1], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = a[I % 16], p = f[I % 16], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, m = y & 65535 | M << 16, w = P & 65535 | _ << 16, l = m, p = w, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = (S >>> 28 | U << 4) ^ (U >>> 2 | S << 30) ^ (U >>> 7 | S << 25), p = (U >>> 28 | S << 4) ^ (S >>> 2 | U << 30) ^ (S >>> 7 | U << 25), P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, l = S & R ^ S & D ^ R & D, p = U & C ^ U & W ^ C & W, P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, Z = y & 65535 | M << 16, Re = P & 65535 | _ << 16, l = Q, p = fe, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = m, p = w, P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, Q = y & 65535 | M << 16, fe = P & 65535 | _ << 16, R = ce, D = L, k = oe, N = Q, z = X, B = ee, $ = O, S = Z, C = re, W = he, J = ae, ne = fe, K = be, E = Ae, b = Te, U = Re, I % 16 === 15) for (var q = 0; q < 16; q++) l = a[q], p = f[q], P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = a[(q + 9) % 16], p = f[(q + 9) % 16], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, m = a[(q + 1) % 16], w = f[(q + 1) % 16], l = (m >>> 1 | w << 31) ^ (m >>> 8 | w << 24) ^ m >>> 7, p = (w >>> 1 | m << 31) ^ (w >>> 8 | m << 24) ^ (w >>> 7 | m << 25), P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, m = a[(q + 14) % 16], w = f[(q + 14) % 16], l = (m >>> 19 | w << 13) ^ (w >>> 29 | m << 3) ^ m >>> 6, p = (w >>> 19 | m << 13) ^ (m >>> 29 | w << 3) ^ (w >>> 6 | m << 26), P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, a[q] = y & 65535 | M << 16, f[q] = P & 65535 | _ << 16; } - l = S, p = U, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[0], p = h[0], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[0] = S = y & 65535 | M << 16, h[0] = U = P & 65535 | _ << 16, l = C, p = R, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[1], p = h[1], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[1] = C = y & 65535 | M << 16, h[1] = R = P & 65535 | _ << 16, l = D, p = W, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[2], p = h[2], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[2] = D = y & 65535 | M << 16, h[2] = W = P & 65535 | _ << 16, l = k, p = J, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[3], p = h[3], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[3] = k = y & 65535 | M << 16, h[3] = J = P & 65535 | _ << 16, l = N, p = ne, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[4], p = h[4], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[4] = N = y & 65535 | M << 16, h[4] = ne = P & 65535 | _ << 16, l = z, p = K, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[5], p = h[5], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[5] = z = y & 65535 | M << 16, h[5] = K = P & 65535 | _ << 16, l = B, p = E, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[6], p = h[6], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[6] = B = y & 65535 | M << 16, h[6] = E = P & 65535 | _ << 16, l = $, p = b, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[7], p = h[7], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[7] = $ = y & 65535 | M << 16, h[7] = b = P & 65535 | _ << 16, v += 128, x -= 128; + l = S, p = U, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[0], p = h[0], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[0] = S = y & 65535 | M << 16, h[0] = U = P & 65535 | _ << 16, l = R, p = C, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[1], p = h[1], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[1] = R = y & 65535 | M << 16, h[1] = C = P & 65535 | _ << 16, l = D, p = W, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[2], p = h[2], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[2] = D = y & 65535 | M << 16, h[2] = W = P & 65535 | _ << 16, l = k, p = J, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[3], p = h[3], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[3] = k = y & 65535 | M << 16, h[3] = J = P & 65535 | _ << 16, l = N, p = ne, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[4], p = h[4], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[4] = N = y & 65535 | M << 16, h[4] = ne = P & 65535 | _ << 16, l = z, p = K, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[5], p = h[5], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[5] = z = y & 65535 | M << 16, h[5] = K = P & 65535 | _ << 16, l = B, p = E, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[6], p = h[6], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[6] = B = y & 65535 | M << 16, h[6] = E = P & 65535 | _ << 16, l = $, p = b, P = p & 65535, _ = p >>> 16, y = l & 65535, M = l >>> 16, l = u[7], p = h[7], P += p & 65535, _ += p >>> 16, y += l & 65535, M += l >>> 16, _ += P >>> 16, y += _ >>> 16, M += y >>> 16, u[7] = $ = y & 65535 | M << 16, h[7] = b = P & 65535 | _ << 16, v += 128, x -= 128; } return v; } @@ -7614,7 +7614,7 @@ function Ik() { } Q[0] += X - 1 + 37 * (X - 1); } - function C(Q, X, ee) { + function R(Q, X, ee) { const O = ~(ee - 1); for (let Z = 0; Z < 16; Z++) { const re = O & (Q[Z] ^ X[Z]); @@ -7632,7 +7632,7 @@ function Ik() { ee[he] = O[he] - 65535 - (ee[he - 1] >> 16 & 1), ee[he - 1] &= 65535; ee[15] = O[15] - 32767 - (ee[14] >> 16 & 1); const re = ee[15] >> 16 & 1; - ee[14] &= 65535, C(O, ee, 1 - re); + ee[14] &= 65535, R(O, ee, 1 - re); } for (let Z = 0; Z < 16; Z++) Q[2 * Z] = O[Z] & 255, Q[2 * Z + 1] = O[Z] >> 8; @@ -7664,12 +7664,12 @@ function Ik() { for (let O = 0; O < 16; O++) Q[O] = X[O] - ee[O]; } - function R(Q, X, ee) { + function C(Q, X, ee) { let O, Z, re = 0, he = 0, ae = 0, fe = 0, be = 0, Ae = 0, Te = 0, Re = 0, $e = 0, Me = 0, Oe = 0, ze = 0, De = 0, je = 0, Ue = 0, _e = 0, Ze = 0, ot = 0, ke = 0, rt = 0, nt = 0, Ge = 0, ht = 0, lt = 0, ct = 0, qt = 0, Gt = 0, Et = 0, Yt = 0, tr = 0, Tt = 0, kt = ee[0], It = ee[1], dt = ee[2], Dt = ee[3], Nt = ee[4], mt = ee[5], Bt = ee[6], Ft = ee[7], et = ee[8], $t = ee[9], H = ee[10], V = ee[11], Y = ee[12], T = ee[13], F = ee[14], ie = ee[15]; O = X[0], re += O * kt, he += O * It, ae += O * dt, fe += O * Dt, be += O * Nt, Ae += O * mt, Te += O * Bt, Re += O * Ft, $e += O * et, Me += O * $t, Oe += O * H, ze += O * V, De += O * Y, je += O * T, Ue += O * F, _e += O * ie, O = X[1], he += O * kt, ae += O * It, fe += O * dt, be += O * Dt, Ae += O * Nt, Te += O * mt, Re += O * Bt, $e += O * Ft, Me += O * et, Oe += O * $t, ze += O * H, De += O * V, je += O * Y, Ue += O * T, _e += O * F, Ze += O * ie, O = X[2], ae += O * kt, fe += O * It, be += O * dt, Ae += O * Dt, Te += O * Nt, Re += O * mt, $e += O * Bt, Me += O * Ft, Oe += O * et, ze += O * $t, De += O * H, je += O * V, Ue += O * Y, _e += O * T, Ze += O * F, ot += O * ie, O = X[3], fe += O * kt, be += O * It, Ae += O * dt, Te += O * Dt, Re += O * Nt, $e += O * mt, Me += O * Bt, Oe += O * Ft, ze += O * et, De += O * $t, je += O * H, Ue += O * V, _e += O * Y, Ze += O * T, ot += O * F, ke += O * ie, O = X[4], be += O * kt, Ae += O * It, Te += O * dt, Re += O * Dt, $e += O * Nt, Me += O * mt, Oe += O * Bt, ze += O * Ft, De += O * et, je += O * $t, Ue += O * H, _e += O * V, Ze += O * Y, ot += O * T, ke += O * F, rt += O * ie, O = X[5], Ae += O * kt, Te += O * It, Re += O * dt, $e += O * Dt, Me += O * Nt, Oe += O * mt, ze += O * Bt, De += O * Ft, je += O * et, Ue += O * $t, _e += O * H, Ze += O * V, ot += O * Y, ke += O * T, rt += O * F, nt += O * ie, O = X[6], Te += O * kt, Re += O * It, $e += O * dt, Me += O * Dt, Oe += O * Nt, ze += O * mt, De += O * Bt, je += O * Ft, Ue += O * et, _e += O * $t, Ze += O * H, ot += O * V, ke += O * Y, rt += O * T, nt += O * F, Ge += O * ie, O = X[7], Re += O * kt, $e += O * It, Me += O * dt, Oe += O * Dt, ze += O * Nt, De += O * mt, je += O * Bt, Ue += O * Ft, _e += O * et, Ze += O * $t, ot += O * H, ke += O * V, rt += O * Y, nt += O * T, Ge += O * F, ht += O * ie, O = X[8], $e += O * kt, Me += O * It, Oe += O * dt, ze += O * Dt, De += O * Nt, je += O * mt, Ue += O * Bt, _e += O * Ft, Ze += O * et, ot += O * $t, ke += O * H, rt += O * V, nt += O * Y, Ge += O * T, ht += O * F, lt += O * ie, O = X[9], Me += O * kt, Oe += O * It, ze += O * dt, De += O * Dt, je += O * Nt, Ue += O * mt, _e += O * Bt, Ze += O * Ft, ot += O * et, ke += O * $t, rt += O * H, nt += O * V, Ge += O * Y, ht += O * T, lt += O * F, ct += O * ie, O = X[10], Oe += O * kt, ze += O * It, De += O * dt, je += O * Dt, Ue += O * Nt, _e += O * mt, Ze += O * Bt, ot += O * Ft, ke += O * et, rt += O * $t, nt += O * H, Ge += O * V, ht += O * Y, lt += O * T, ct += O * F, qt += O * ie, O = X[11], ze += O * kt, De += O * It, je += O * dt, Ue += O * Dt, _e += O * Nt, Ze += O * mt, ot += O * Bt, ke += O * Ft, rt += O * et, nt += O * $t, Ge += O * H, ht += O * V, lt += O * Y, ct += O * T, qt += O * F, Gt += O * ie, O = X[12], De += O * kt, je += O * It, Ue += O * dt, _e += O * Dt, Ze += O * Nt, ot += O * mt, ke += O * Bt, rt += O * Ft, nt += O * et, Ge += O * $t, ht += O * H, lt += O * V, ct += O * Y, qt += O * T, Gt += O * F, Et += O * ie, O = X[13], je += O * kt, Ue += O * It, _e += O * dt, Ze += O * Dt, ot += O * Nt, ke += O * mt, rt += O * Bt, nt += O * Ft, Ge += O * et, ht += O * $t, lt += O * H, ct += O * V, qt += O * Y, Gt += O * T, Et += O * F, Yt += O * ie, O = X[14], Ue += O * kt, _e += O * It, Ze += O * dt, ot += O * Dt, ke += O * Nt, rt += O * mt, nt += O * Bt, Ge += O * Ft, ht += O * et, lt += O * $t, ct += O * H, qt += O * V, Gt += O * Y, Et += O * T, Yt += O * F, tr += O * ie, O = X[15], _e += O * kt, Ze += O * It, ot += O * dt, ke += O * Dt, rt += O * Nt, nt += O * mt, Ge += O * Bt, ht += O * Ft, lt += O * et, ct += O * $t, qt += O * H, Gt += O * V, Et += O * Y, Yt += O * T, tr += O * F, Tt += O * ie, re += 38 * Ze, he += 38 * ot, ae += 38 * ke, fe += 38 * rt, be += 38 * nt, Ae += 38 * Ge, Te += 38 * ht, Re += 38 * lt, $e += 38 * ct, Me += 38 * qt, Oe += 38 * Gt, ze += 38 * Et, De += 38 * Yt, je += 38 * tr, Ue += 38 * Tt, Z = 1, O = re + Z + 65535, Z = Math.floor(O / 65536), re = O - Z * 65536, O = he + Z + 65535, Z = Math.floor(O / 65536), he = O - Z * 65536, O = ae + Z + 65535, Z = Math.floor(O / 65536), ae = O - Z * 65536, O = fe + Z + 65535, Z = Math.floor(O / 65536), fe = O - Z * 65536, O = be + Z + 65535, Z = Math.floor(O / 65536), be = O - Z * 65536, O = Ae + Z + 65535, Z = Math.floor(O / 65536), Ae = O - Z * 65536, O = Te + Z + 65535, Z = Math.floor(O / 65536), Te = O - Z * 65536, O = Re + Z + 65535, Z = Math.floor(O / 65536), Re = O - Z * 65536, O = $e + Z + 65535, Z = Math.floor(O / 65536), $e = O - Z * 65536, O = Me + Z + 65535, Z = Math.floor(O / 65536), Me = O - Z * 65536, O = Oe + Z + 65535, Z = Math.floor(O / 65536), Oe = O - Z * 65536, O = ze + Z + 65535, Z = Math.floor(O / 65536), ze = O - Z * 65536, O = De + Z + 65535, Z = Math.floor(O / 65536), De = O - Z * 65536, O = je + Z + 65535, Z = Math.floor(O / 65536), je = O - Z * 65536, O = Ue + Z + 65535, Z = Math.floor(O / 65536), Ue = O - Z * 65536, O = _e + Z + 65535, Z = Math.floor(O / 65536), _e = O - Z * 65536, re += Z - 1 + 37 * (Z - 1), Z = 1, O = re + Z + 65535, Z = Math.floor(O / 65536), re = O - Z * 65536, O = he + Z + 65535, Z = Math.floor(O / 65536), he = O - Z * 65536, O = ae + Z + 65535, Z = Math.floor(O / 65536), ae = O - Z * 65536, O = fe + Z + 65535, Z = Math.floor(O / 65536), fe = O - Z * 65536, O = be + Z + 65535, Z = Math.floor(O / 65536), be = O - Z * 65536, O = Ae + Z + 65535, Z = Math.floor(O / 65536), Ae = O - Z * 65536, O = Te + Z + 65535, Z = Math.floor(O / 65536), Te = O - Z * 65536, O = Re + Z + 65535, Z = Math.floor(O / 65536), Re = O - Z * 65536, O = $e + Z + 65535, Z = Math.floor(O / 65536), $e = O - Z * 65536, O = Me + Z + 65535, Z = Math.floor(O / 65536), Me = O - Z * 65536, O = Oe + Z + 65535, Z = Math.floor(O / 65536), Oe = O - Z * 65536, O = ze + Z + 65535, Z = Math.floor(O / 65536), ze = O - Z * 65536, O = De + Z + 65535, Z = Math.floor(O / 65536), De = O - Z * 65536, O = je + Z + 65535, Z = Math.floor(O / 65536), je = O - Z * 65536, O = Ue + Z + 65535, Z = Math.floor(O / 65536), Ue = O - Z * 65536, O = _e + Z + 65535, Z = Math.floor(O / 65536), _e = O - Z * 65536, re += Z - 1 + 37 * (Z - 1), Q[0] = re, Q[1] = he, Q[2] = ae, Q[3] = fe, Q[4] = be, Q[5] = Ae, Q[6] = Te, Q[7] = Re, Q[8] = $e, Q[9] = Me, Q[10] = Oe, Q[11] = ze, Q[12] = De, Q[13] = je, Q[14] = Ue, Q[15] = _e; } function W(Q, X) { - R(Q, X, X); + C(Q, X, X); } function J(Q, X) { const ee = i(); @@ -7677,7 +7677,7 @@ function Ik() { for (O = 0; O < 16; O++) ee[O] = X[O]; for (O = 253; O >= 0; O--) - W(ee, ee), O !== 2 && O !== 4 && R(ee, ee, X); + W(ee, ee), O !== 2 && O !== 4 && C(ee, ee, X); for (O = 0; O < 16; O++) Q[O] = ee[O]; } @@ -7687,21 +7687,21 @@ function Ik() { for (O = 0; O < 16; O++) ee[O] = X[O]; for (O = 250; O >= 0; O--) - W(ee, ee), O !== 1 && R(ee, ee, X); + W(ee, ee), O !== 1 && C(ee, ee, X); for (O = 0; O < 16; O++) Q[O] = ee[O]; } function K(Q, X) { const ee = i(), O = i(), Z = i(), re = i(), he = i(), ae = i(), fe = i(), be = i(), Ae = i(); - U(ee, Q[1], Q[0]), U(Ae, X[1], X[0]), R(ee, ee, Ae), $(O, Q[0], Q[1]), $(Ae, X[0], X[1]), R(O, O, Ae), R(Z, Q[3], X[3]), R(Z, Z, u), R(re, Q[2], X[2]), $(re, re, re), U(he, O, ee), U(ae, re, Z), $(fe, re, Z), $(be, O, ee), R(Q[0], he, ae), R(Q[1], be, fe), R(Q[2], fe, ae), R(Q[3], he, be); + U(ee, Q[1], Q[0]), U(Ae, X[1], X[0]), C(ee, ee, Ae), $(O, Q[0], Q[1]), $(Ae, X[0], X[1]), C(O, O, Ae), C(Z, Q[3], X[3]), C(Z, Z, u), C(re, Q[2], X[2]), $(re, re, re), U(he, O, ee), U(ae, re, Z), $(fe, re, Z), $(be, O, ee), C(Q[0], he, ae), C(Q[1], be, fe), C(Q[2], fe, ae), C(Q[3], he, be); } function E(Q, X, ee) { for (let O = 0; O < 4; O++) - C(Q[O], X[O], ee); + R(Q[O], X[O], ee); } function b(Q, X) { const ee = i(), O = i(), Z = i(); - J(Z, X[2]), R(ee, X[0], Z), R(O, X[1], Z), D(Q, O), Q[31] ^= z(ee) << 7; + J(Z, X[2]), C(ee, X[0], Z), C(O, X[1], Z), D(Q, O), Q[31] ^= z(ee) << 7; } function l(Q, X, ee) { x(Q[0], o), x(Q[1], a), x(Q[2], a), x(Q[3], o); @@ -7712,7 +7712,7 @@ function Ik() { } function p(Q, X) { const ee = [i(), i(), i(), i()]; - x(ee[0], h), x(ee[1], g), x(ee[2], a), R(ee[3], h, g), l(Q, ee, X); + x(ee[0], h), x(ee[1], g), x(ee[2], a), C(ee[3], h, g), l(Q, ee, X); } function m(Q) { if (Q.length !== t.SEED_LENGTH) @@ -7816,7 +7816,7 @@ function Ik() { t.sign = I; function q(Q, X) { const ee = i(), O = i(), Z = i(), re = i(), he = i(), ae = i(), fe = i(); - return x(Q[2], a), B(Q[1], X), W(Z, Q[1]), R(re, Z, f), U(Z, Z, Q[2]), $(re, Q[2], re), W(he, re), W(ae, he), R(fe, ae, he), R(ee, fe, Z), R(ee, ee, re), ne(ee, ee), R(ee, ee, Z), R(ee, ee, re), R(ee, ee, re), R(Q[0], ee, re), W(O, Q[0]), R(O, O, re), N(O, Z) && R(Q[0], Q[0], v), W(O, Q[0]), R(O, O, re), N(O, Z) ? -1 : (z(Q[0]) === X[31] >> 7 && U(Q[0], o, Q[0]), R(Q[3], Q[0], Q[1]), 0); + return x(Q[2], a), B(Q[1], X), W(Z, Q[1]), C(re, Z, f), U(Z, Z, Q[2]), $(re, Q[2], re), W(he, re), W(ae, he), C(fe, ae, he), C(ee, fe, Z), C(ee, ee, re), ne(ee, ee), C(ee, ee, Z), C(ee, ee, re), C(ee, ee, re), C(Q[0], ee, re), W(O, Q[0]), C(O, O, re), N(O, Z) && C(Q[0], Q[0], v), W(O, Q[0]), C(O, O, re), N(O, Z) ? -1 : (z(Q[0]) === X[31] >> 7 && U(Q[0], o, Q[0]), C(Q[3], Q[0], Q[1]), 0); } function ce(Q, X, ee) { const O = new Uint8Array(32), Z = [i(), i(), i(), i()], re = [i(), i(), i(), i()]; @@ -7835,7 +7835,7 @@ function Ik() { if (q(X, Q)) throw new Error("Ed25519: invalid public key"); let ee = i(), O = i(), Z = X[1]; - $(ee, a, Z), U(O, a, Z), J(O, O), R(ee, ee, O); + $(ee, a, Z), U(O, a, Z), J(O, O), C(ee, ee, O); let re = new Uint8Array(32); return D(re, ee), re; } @@ -7879,18 +7879,18 @@ function $k(t, e) { throw new TypeError("Expected Uint8Array"); if (S.length === 0) return ""; - for (var C = 0, D = 0, k = 0, N = S.length; k !== N && S[k] === 0; ) - k++, C++; + for (var R = 0, D = 0, k = 0, N = S.length; k !== N && S[k] === 0; ) + k++, R++; for (var z = (N - k) * h + 1 >>> 0, B = new Uint8Array(z); k !== N; ) { - for (var $ = S[k], U = 0, R = z - 1; ($ !== 0 || U < D) && R !== -1; R--, U++) - $ += 256 * B[R] >>> 0, B[R] = $ % a >>> 0, $ = $ / a >>> 0; + for (var $ = S[k], U = 0, C = z - 1; ($ !== 0 || U < D) && C !== -1; C--, U++) + $ += 256 * B[C] >>> 0, B[C] = $ % a >>> 0, $ = $ / a >>> 0; if ($ !== 0) throw new Error("Non-zero carry"); D = U, k++; } for (var W = z - D; W !== z && B[W] === 0; ) W++; - for (var J = f.repeat(C); W < z; ++W) + for (var J = f.repeat(R); W < z; ++W) J += t.charAt(B[W]); return J; } @@ -7899,33 +7899,33 @@ function $k(t, e) { throw new TypeError("Expected String"); if (S.length === 0) return new Uint8Array(); - var C = 0; - if (S[C] !== " ") { - for (var D = 0, k = 0; S[C] === f; ) - D++, C++; - for (var N = (S.length - C) * u + 1 >>> 0, z = new Uint8Array(N); S[C]; ) { - var B = r[S.charCodeAt(C)]; + var R = 0; + if (S[R] !== " ") { + for (var D = 0, k = 0; S[R] === f; ) + D++, R++; + for (var N = (S.length - R) * u + 1 >>> 0, z = new Uint8Array(N); S[R]; ) { + var B = r[S.charCodeAt(R)]; if (B === 255) return; for (var $ = 0, U = N - 1; (B !== 0 || $ < k) && U !== -1; U--, $++) B += a * z[U] >>> 0, z[U] = B % 256 >>> 0, B = B / 256 >>> 0; if (B !== 0) throw new Error("Non-zero carry"); - k = $, C++; + k = $, R++; } - if (S[C] !== " ") { - for (var R = N - k; R !== N && z[R] === 0; ) - R++; - for (var W = new Uint8Array(D + (N - R)), J = D; R !== N; ) - W[J++] = z[R++]; + if (S[R] !== " ") { + for (var C = N - k; C !== N && z[C] === 0; ) + C++; + for (var W = new Uint8Array(D + (N - C)), J = D; C !== N; ) + W[J++] = z[C++]; return W; } } } function x(S) { - var C = v(S); - if (C) - return C; + var R = v(S); + if (R) + return R; throw new Error(`Non-${e} character`); } return { @@ -8538,8 +8538,8 @@ function Z$() { } function i() { const x = r.getElementsByTagName("link"), S = []; - for (let C = 0; C < x.length; C++) { - const D = x[C], k = D.getAttribute("rel"); + for (let R = 0; R < x.length; R++) { + const D = x[R], k = D.getAttribute("rel"); if (k && k.toLowerCase().indexOf("icon") > -1) { const N = D.getAttribute("href"); if (N) @@ -8565,8 +8565,8 @@ function Z$() { } function s(...x) { const S = r.getElementsByTagName("meta"); - for (let C = 0; C < S.length; C++) { - const D = S[C], k = ["itemprop", "property", "name"].map((N) => D.getAttribute(N)).filter((N) => N ? x.includes(N) : !1); + for (let R = 0; R < S.length; R++) { + const D = S[R], k = ["itemprop", "property", "name"].map((N) => D.getAttribute(N)).filter((N) => N ? x.includes(N) : !1); if (k.length && k) { const N = D.getAttribute("content"); if (N) @@ -8741,15 +8741,15 @@ function iB() { case "comma": case "separator": return (B, $, U) => { - const R = typeof $ == "string" && $.includes(N.arrayFormatSeparator), W = typeof $ == "string" && !R && g($, N).includes(N.arrayFormatSeparator); + const C = typeof $ == "string" && $.includes(N.arrayFormatSeparator), W = typeof $ == "string" && !C && g($, N).includes(N.arrayFormatSeparator); $ = W ? g($, N) : $; - const J = R || W ? $.split(N.arrayFormatSeparator).map((ne) => g(ne, N)) : $ === null ? $ : g($, N); + const J = C || W ? $.split(N.arrayFormatSeparator).map((ne) => g(ne, N)) : $ === null ? $ : g($, N); U[B] = J; }; case "bracket-separator": return (B, $, U) => { - const R = /(\[\])$/.test(B); - if (B = B.replace(/\[\]$/, ""), !R) { + const C = /(\[\])$/.test(B); + if (B = B.replace(/\[\]$/, ""), !C) { U[B] = $ && g($, N); return; } @@ -8792,7 +8792,7 @@ function iB() { const B = N.indexOf("#"); return B !== -1 && (z = N.slice(B)), z; } - function C(N) { + function R(N) { N = x(N); const z = N.indexOf("?"); return z === -1 ? "" : N.slice(z + 1); @@ -8815,23 +8815,23 @@ function iB() { for (const U of N.split("&")) { if (U === "") continue; - let [R, W] = n(z.decode ? U.replace(/\+/g, " ") : U, "="); - W = W === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(z.arrayFormat) ? W : g(W, z), B(g(R, z), W, $); + let [C, W] = n(z.decode ? U.replace(/\+/g, " ") : U, "="); + W = W === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(z.arrayFormat) ? W : g(W, z), B(g(C, z), W, $); } for (const U of Object.keys($)) { - const R = $[U]; - if (typeof R == "object" && R !== null) - for (const W of Object.keys(R)) - R[W] = D(R[W], z); + const C = $[U]; + if (typeof C == "object" && C !== null) + for (const W of Object.keys(C)) + C[W] = D(C[W], z); else - $[U] = D(R, z); + $[U] = D(C, z); } - return z.sort === !1 ? $ : (z.sort === !0 ? Object.keys($).sort() : Object.keys($).sort(z.sort)).reduce((U, R) => { - const W = $[R]; - return W && typeof W == "object" && !Array.isArray(W) ? U[R] = v(W) : U[R] = W, U; + return z.sort === !1 ? $ : (z.sort === !0 ? Object.keys($).sort() : Object.keys($).sort(z.sort)).reduce((U, C) => { + const W = $[C]; + return W && typeof W == "object" && !Array.isArray(W) ? U[C] = v(W) : U[C] = W, U; }, /* @__PURE__ */ Object.create(null)); } - t.extract = C, t.parse = k, t.stringify = (N, z) => { + t.extract = R, t.parse = k, t.stringify = (N, z) => { if (!N) return ""; z = Object.assign({ @@ -8843,8 +8843,8 @@ function iB() { const B = (W) => z.skipNull && s(N[W]) || z.skipEmptyString && N[W] === "", $ = a(z), U = {}; for (const W of Object.keys(N)) B(W) || (U[W] = N[W]); - const R = Object.keys(U); - return z.sort !== !1 && R.sort(z.sort), R.map((W) => { + const C = Object.keys(U); + return z.sort !== !1 && C.sort(z.sort), C.map((W) => { const J = N[W]; return J === void 0 ? "" : J === null ? h(W, z) : Array.isArray(J) ? J.length === 0 && z.arrayFormat === "bracket-separator" ? h(W, z) + "[]" : J.reduce($(W), []).join("&") : h(W, z) + "=" + h(J, z); }).filter((W) => W.length > 0).join("&"); @@ -8856,7 +8856,7 @@ function iB() { return Object.assign( { url: B.split("?")[0] || "", - query: k(C(N), z) + query: k(R(N), z) }, z && z.parseFragmentIdentifier && $ ? { fragmentIdentifier: g($, z) } : {} ); @@ -8866,8 +8866,8 @@ function iB() { strict: !0, [o]: !0 }, z); - const B = x(N.url).split("?")[0] || "", $ = t.extract(N.url), U = t.parse($, { sort: !1 }), R = Object.assign(U, N.query); - let W = t.stringify(R, z); + const B = x(N.url).split("?")[0] || "", $ = t.extract(N.url), U = t.parse($, { sort: !1 }), C = Object.assign(U, N.query); + let W = t.stringify(C, z); W && (W = `?${W}`); let J = S(N.url); return N.fragmentIdentifier && (J = `#${z[o] ? h(N.fragmentIdentifier, z) : N.fragmentIdentifier}`), `${B}${W}${J}`; @@ -8876,14 +8876,14 @@ function iB() { parseFragmentIdentifier: !0, [o]: !1 }, B); - const { url: $, query: U, fragmentIdentifier: R } = t.parseUrl(N, B); + const { url: $, query: U, fragmentIdentifier: C } = t.parseUrl(N, B); return t.stringifyUrl({ url: $, query: i(U, z), - fragmentIdentifier: R + fragmentIdentifier: C }, B); }, t.exclude = (N, z, B) => { - const $ = Array.isArray(z) ? (U) => !z.includes(U) : (U, R) => !z(U, R); + const $ = Array.isArray(z) ? (U) => !z.includes(U) : (U, C) => !z(U, C); return t.pick(N, $, B); }; })(ig)), ig; @@ -8905,7 +8905,7 @@ function sB() { i.JS_SHA3_NO_WINDOW && (n = !1); var s = !n && typeof self == "object", o = !i.JS_SHA3_NO_NODE_JS && typeof process == "object" && process.versions && process.versions.node; o ? i = Zn : s && (i = self); - var a = !i.JS_SHA3_NO_COMMON_JS && !0 && t.exports, f = !i.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", u = "0123456789abcdef".split(""), h = [31, 7936, 2031616, 520093696], g = [4, 1024, 262144, 67108864], v = [1, 256, 65536, 16777216], x = [6, 1536, 393216, 100663296], S = [0, 8, 16, 24], C = [ + var a = !i.JS_SHA3_NO_COMMON_JS && !0 && t.exports, f = !i.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", u = "0123456789abcdef".split(""), h = [31, 7936, 2031616, 520093696], g = [4, 1024, 262144, 67108864], v = [1, 256, 65536, 16777216], x = [6, 1536, 393216, 100663296], S = [0, 8, 16, 24], R = [ 1, 0, 32898, @@ -8975,7 +8975,7 @@ function sB() { return function(X, ee, O, Z) { return l["cshake" + L].update(X, ee, O, Z)[Q](); }; - }, R = function(L, oe, Q) { + }, C = function(L, oe, Q) { return function(X, ee, O, Z) { return l["kmac" + L].update(X, ee, O, Z)[Q](); }; @@ -9007,12 +9007,12 @@ function sB() { return X.create(O, Z, re).update(ee); }, W(X, U, L, oe); }, E = function(L, oe) { - var Q = z[L], X = R(L, oe, "hex"); + var Q = z[L], X = C(L, oe, "hex"); return X.create = function(ee, O, Z) { return new q(L, oe, O).bytepad(["KMAC", Z], Q).bytepad([ee], Q); }, X.update = function(ee, O, Z, re) { return X.create(ee, Z, re).update(O); - }, W(X, R, L, oe); + }, W(X, C, L, oe); }, b = [ { name: "keccak", padding: v, bits: D, createMethod: J }, { name: "sha3", padding: x, bits: D, createMethod: J }, @@ -9146,7 +9146,7 @@ function sB() { var ce = function(L) { var oe, Q, X, ee, O, Z, re, he, ae, fe, be, Ae, Te, Re, $e, Me, Oe, ze, De, je, Ue, _e, Ze, ot, ke, rt, nt, Ge, ht, lt, ct, qt, Gt, Et, Yt, tr, Tt, kt, It, dt, Dt, Nt, mt, Bt, Ft, et, $t, H, V, Y, T, F, ie, le, me, Ee, Le, Ie, Qe, Xe, tt, st, vt; for (X = 0; X < 48; X += 2) - ee = L[0] ^ L[10] ^ L[20] ^ L[30] ^ L[40], O = L[1] ^ L[11] ^ L[21] ^ L[31] ^ L[41], Z = L[2] ^ L[12] ^ L[22] ^ L[32] ^ L[42], re = L[3] ^ L[13] ^ L[23] ^ L[33] ^ L[43], he = L[4] ^ L[14] ^ L[24] ^ L[34] ^ L[44], ae = L[5] ^ L[15] ^ L[25] ^ L[35] ^ L[45], fe = L[6] ^ L[16] ^ L[26] ^ L[36] ^ L[46], be = L[7] ^ L[17] ^ L[27] ^ L[37] ^ L[47], Ae = L[8] ^ L[18] ^ L[28] ^ L[38] ^ L[48], Te = L[9] ^ L[19] ^ L[29] ^ L[39] ^ L[49], oe = Ae ^ (Z << 1 | re >>> 31), Q = Te ^ (re << 1 | Z >>> 31), L[0] ^= oe, L[1] ^= Q, L[10] ^= oe, L[11] ^= Q, L[20] ^= oe, L[21] ^= Q, L[30] ^= oe, L[31] ^= Q, L[40] ^= oe, L[41] ^= Q, oe = ee ^ (he << 1 | ae >>> 31), Q = O ^ (ae << 1 | he >>> 31), L[2] ^= oe, L[3] ^= Q, L[12] ^= oe, L[13] ^= Q, L[22] ^= oe, L[23] ^= Q, L[32] ^= oe, L[33] ^= Q, L[42] ^= oe, L[43] ^= Q, oe = Z ^ (fe << 1 | be >>> 31), Q = re ^ (be << 1 | fe >>> 31), L[4] ^= oe, L[5] ^= Q, L[14] ^= oe, L[15] ^= Q, L[24] ^= oe, L[25] ^= Q, L[34] ^= oe, L[35] ^= Q, L[44] ^= oe, L[45] ^= Q, oe = he ^ (Ae << 1 | Te >>> 31), Q = ae ^ (Te << 1 | Ae >>> 31), L[6] ^= oe, L[7] ^= Q, L[16] ^= oe, L[17] ^= Q, L[26] ^= oe, L[27] ^= Q, L[36] ^= oe, L[37] ^= Q, L[46] ^= oe, L[47] ^= Q, oe = fe ^ (ee << 1 | O >>> 31), Q = be ^ (O << 1 | ee >>> 31), L[8] ^= oe, L[9] ^= Q, L[18] ^= oe, L[19] ^= Q, L[28] ^= oe, L[29] ^= Q, L[38] ^= oe, L[39] ^= Q, L[48] ^= oe, L[49] ^= Q, Re = L[0], $e = L[1], et = L[11] << 4 | L[10] >>> 28, $t = L[10] << 4 | L[11] >>> 28, Ge = L[20] << 3 | L[21] >>> 29, ht = L[21] << 3 | L[20] >>> 29, Xe = L[31] << 9 | L[30] >>> 23, tt = L[30] << 9 | L[31] >>> 23, Nt = L[40] << 18 | L[41] >>> 14, mt = L[41] << 18 | L[40] >>> 14, Et = L[2] << 1 | L[3] >>> 31, Yt = L[3] << 1 | L[2] >>> 31, Me = L[13] << 12 | L[12] >>> 20, Oe = L[12] << 12 | L[13] >>> 20, H = L[22] << 10 | L[23] >>> 22, V = L[23] << 10 | L[22] >>> 22, lt = L[33] << 13 | L[32] >>> 19, ct = L[32] << 13 | L[33] >>> 19, st = L[42] << 2 | L[43] >>> 30, vt = L[43] << 2 | L[42] >>> 30, le = L[5] << 30 | L[4] >>> 2, me = L[4] << 30 | L[5] >>> 2, tr = L[14] << 6 | L[15] >>> 26, Tt = L[15] << 6 | L[14] >>> 26, ze = L[25] << 11 | L[24] >>> 21, De = L[24] << 11 | L[25] >>> 21, Y = L[34] << 15 | L[35] >>> 17, T = L[35] << 15 | L[34] >>> 17, qt = L[45] << 29 | L[44] >>> 3, Gt = L[44] << 29 | L[45] >>> 3, ot = L[6] << 28 | L[7] >>> 4, ke = L[7] << 28 | L[6] >>> 4, Ee = L[17] << 23 | L[16] >>> 9, Le = L[16] << 23 | L[17] >>> 9, kt = L[26] << 25 | L[27] >>> 7, It = L[27] << 25 | L[26] >>> 7, je = L[36] << 21 | L[37] >>> 11, Ue = L[37] << 21 | L[36] >>> 11, F = L[47] << 24 | L[46] >>> 8, ie = L[46] << 24 | L[47] >>> 8, Bt = L[8] << 27 | L[9] >>> 5, Ft = L[9] << 27 | L[8] >>> 5, rt = L[18] << 20 | L[19] >>> 12, nt = L[19] << 20 | L[18] >>> 12, Ie = L[29] << 7 | L[28] >>> 25, Qe = L[28] << 7 | L[29] >>> 25, dt = L[38] << 8 | L[39] >>> 24, Dt = L[39] << 8 | L[38] >>> 24, _e = L[48] << 14 | L[49] >>> 18, Ze = L[49] << 14 | L[48] >>> 18, L[0] = Re ^ ~Me & ze, L[1] = $e ^ ~Oe & De, L[10] = ot ^ ~rt & Ge, L[11] = ke ^ ~nt & ht, L[20] = Et ^ ~tr & kt, L[21] = Yt ^ ~Tt & It, L[30] = Bt ^ ~et & H, L[31] = Ft ^ ~$t & V, L[40] = le ^ ~Ee & Ie, L[41] = me ^ ~Le & Qe, L[2] = Me ^ ~ze & je, L[3] = Oe ^ ~De & Ue, L[12] = rt ^ ~Ge & lt, L[13] = nt ^ ~ht & ct, L[22] = tr ^ ~kt & dt, L[23] = Tt ^ ~It & Dt, L[32] = et ^ ~H & Y, L[33] = $t ^ ~V & T, L[42] = Ee ^ ~Ie & Xe, L[43] = Le ^ ~Qe & tt, L[4] = ze ^ ~je & _e, L[5] = De ^ ~Ue & Ze, L[14] = Ge ^ ~lt & qt, L[15] = ht ^ ~ct & Gt, L[24] = kt ^ ~dt & Nt, L[25] = It ^ ~Dt & mt, L[34] = H ^ ~Y & F, L[35] = V ^ ~T & ie, L[44] = Ie ^ ~Xe & st, L[45] = Qe ^ ~tt & vt, L[6] = je ^ ~_e & Re, L[7] = Ue ^ ~Ze & $e, L[16] = lt ^ ~qt & ot, L[17] = ct ^ ~Gt & ke, L[26] = dt ^ ~Nt & Et, L[27] = Dt ^ ~mt & Yt, L[36] = Y ^ ~F & Bt, L[37] = T ^ ~ie & Ft, L[46] = Xe ^ ~st & le, L[47] = tt ^ ~vt & me, L[8] = _e ^ ~Re & Me, L[9] = Ze ^ ~$e & Oe, L[18] = qt ^ ~ot & rt, L[19] = Gt ^ ~ke & nt, L[28] = Nt ^ ~Et & tr, L[29] = mt ^ ~Yt & Tt, L[38] = F ^ ~Bt & et, L[39] = ie ^ ~Ft & $t, L[48] = st ^ ~le & Ee, L[49] = vt ^ ~me & Le, L[0] ^= C[X], L[1] ^= C[X + 1]; + ee = L[0] ^ L[10] ^ L[20] ^ L[30] ^ L[40], O = L[1] ^ L[11] ^ L[21] ^ L[31] ^ L[41], Z = L[2] ^ L[12] ^ L[22] ^ L[32] ^ L[42], re = L[3] ^ L[13] ^ L[23] ^ L[33] ^ L[43], he = L[4] ^ L[14] ^ L[24] ^ L[34] ^ L[44], ae = L[5] ^ L[15] ^ L[25] ^ L[35] ^ L[45], fe = L[6] ^ L[16] ^ L[26] ^ L[36] ^ L[46], be = L[7] ^ L[17] ^ L[27] ^ L[37] ^ L[47], Ae = L[8] ^ L[18] ^ L[28] ^ L[38] ^ L[48], Te = L[9] ^ L[19] ^ L[29] ^ L[39] ^ L[49], oe = Ae ^ (Z << 1 | re >>> 31), Q = Te ^ (re << 1 | Z >>> 31), L[0] ^= oe, L[1] ^= Q, L[10] ^= oe, L[11] ^= Q, L[20] ^= oe, L[21] ^= Q, L[30] ^= oe, L[31] ^= Q, L[40] ^= oe, L[41] ^= Q, oe = ee ^ (he << 1 | ae >>> 31), Q = O ^ (ae << 1 | he >>> 31), L[2] ^= oe, L[3] ^= Q, L[12] ^= oe, L[13] ^= Q, L[22] ^= oe, L[23] ^= Q, L[32] ^= oe, L[33] ^= Q, L[42] ^= oe, L[43] ^= Q, oe = Z ^ (fe << 1 | be >>> 31), Q = re ^ (be << 1 | fe >>> 31), L[4] ^= oe, L[5] ^= Q, L[14] ^= oe, L[15] ^= Q, L[24] ^= oe, L[25] ^= Q, L[34] ^= oe, L[35] ^= Q, L[44] ^= oe, L[45] ^= Q, oe = he ^ (Ae << 1 | Te >>> 31), Q = ae ^ (Te << 1 | Ae >>> 31), L[6] ^= oe, L[7] ^= Q, L[16] ^= oe, L[17] ^= Q, L[26] ^= oe, L[27] ^= Q, L[36] ^= oe, L[37] ^= Q, L[46] ^= oe, L[47] ^= Q, oe = fe ^ (ee << 1 | O >>> 31), Q = be ^ (O << 1 | ee >>> 31), L[8] ^= oe, L[9] ^= Q, L[18] ^= oe, L[19] ^= Q, L[28] ^= oe, L[29] ^= Q, L[38] ^= oe, L[39] ^= Q, L[48] ^= oe, L[49] ^= Q, Re = L[0], $e = L[1], et = L[11] << 4 | L[10] >>> 28, $t = L[10] << 4 | L[11] >>> 28, Ge = L[20] << 3 | L[21] >>> 29, ht = L[21] << 3 | L[20] >>> 29, Xe = L[31] << 9 | L[30] >>> 23, tt = L[30] << 9 | L[31] >>> 23, Nt = L[40] << 18 | L[41] >>> 14, mt = L[41] << 18 | L[40] >>> 14, Et = L[2] << 1 | L[3] >>> 31, Yt = L[3] << 1 | L[2] >>> 31, Me = L[13] << 12 | L[12] >>> 20, Oe = L[12] << 12 | L[13] >>> 20, H = L[22] << 10 | L[23] >>> 22, V = L[23] << 10 | L[22] >>> 22, lt = L[33] << 13 | L[32] >>> 19, ct = L[32] << 13 | L[33] >>> 19, st = L[42] << 2 | L[43] >>> 30, vt = L[43] << 2 | L[42] >>> 30, le = L[5] << 30 | L[4] >>> 2, me = L[4] << 30 | L[5] >>> 2, tr = L[14] << 6 | L[15] >>> 26, Tt = L[15] << 6 | L[14] >>> 26, ze = L[25] << 11 | L[24] >>> 21, De = L[24] << 11 | L[25] >>> 21, Y = L[34] << 15 | L[35] >>> 17, T = L[35] << 15 | L[34] >>> 17, qt = L[45] << 29 | L[44] >>> 3, Gt = L[44] << 29 | L[45] >>> 3, ot = L[6] << 28 | L[7] >>> 4, ke = L[7] << 28 | L[6] >>> 4, Ee = L[17] << 23 | L[16] >>> 9, Le = L[16] << 23 | L[17] >>> 9, kt = L[26] << 25 | L[27] >>> 7, It = L[27] << 25 | L[26] >>> 7, je = L[36] << 21 | L[37] >>> 11, Ue = L[37] << 21 | L[36] >>> 11, F = L[47] << 24 | L[46] >>> 8, ie = L[46] << 24 | L[47] >>> 8, Bt = L[8] << 27 | L[9] >>> 5, Ft = L[9] << 27 | L[8] >>> 5, rt = L[18] << 20 | L[19] >>> 12, nt = L[19] << 20 | L[18] >>> 12, Ie = L[29] << 7 | L[28] >>> 25, Qe = L[28] << 7 | L[29] >>> 25, dt = L[38] << 8 | L[39] >>> 24, Dt = L[39] << 8 | L[38] >>> 24, _e = L[48] << 14 | L[49] >>> 18, Ze = L[49] << 14 | L[48] >>> 18, L[0] = Re ^ ~Me & ze, L[1] = $e ^ ~Oe & De, L[10] = ot ^ ~rt & Ge, L[11] = ke ^ ~nt & ht, L[20] = Et ^ ~tr & kt, L[21] = Yt ^ ~Tt & It, L[30] = Bt ^ ~et & H, L[31] = Ft ^ ~$t & V, L[40] = le ^ ~Ee & Ie, L[41] = me ^ ~Le & Qe, L[2] = Me ^ ~ze & je, L[3] = Oe ^ ~De & Ue, L[12] = rt ^ ~Ge & lt, L[13] = nt ^ ~ht & ct, L[22] = tr ^ ~kt & dt, L[23] = Tt ^ ~It & Dt, L[32] = et ^ ~H & Y, L[33] = $t ^ ~V & T, L[42] = Ee ^ ~Ie & Xe, L[43] = Le ^ ~Qe & tt, L[4] = ze ^ ~je & _e, L[5] = De ^ ~Ue & Ze, L[14] = Ge ^ ~lt & qt, L[15] = ht ^ ~ct & Gt, L[24] = kt ^ ~dt & Nt, L[25] = It ^ ~Dt & mt, L[34] = H ^ ~Y & F, L[35] = V ^ ~T & ie, L[44] = Ie ^ ~Xe & st, L[45] = Qe ^ ~tt & vt, L[6] = je ^ ~_e & Re, L[7] = Ue ^ ~Ze & $e, L[16] = lt ^ ~qt & ot, L[17] = ct ^ ~Gt & ke, L[26] = dt ^ ~Nt & Et, L[27] = Dt ^ ~mt & Yt, L[36] = Y ^ ~F & Bt, L[37] = T ^ ~ie & Ft, L[46] = Xe ^ ~st & le, L[47] = tt ^ ~vt & me, L[8] = _e ^ ~Re & Me, L[9] = Ze ^ ~$e & Oe, L[18] = qt ^ ~ot & rt, L[19] = Gt ^ ~ke & nt, L[28] = Nt ^ ~Et & tr, L[29] = mt ^ ~Yt & Tt, L[38] = F ^ ~Bt & et, L[39] = ie ^ ~Ft & $t, L[48] = st ^ ~le & Ee, L[49] = vt ^ ~me & Le, L[0] ^= R[X], L[1] ^= R[X + 1]; }; if (a) t.exports = l; @@ -9772,14 +9772,14 @@ function mB() { }), s.prototype.toArray = function(l, p) { return this.toArrayLike(Array, l, p); }; - var C = function(l, p) { + var R = function(l, p) { return l.allocUnsafe ? l.allocUnsafe(p) : new l(p); }; s.prototype.toArrayLike = function(l, p, m) { this._strip(); var w = this.byteLength(), P = m || Math.max(1, w); n(w <= P, "byte array longer than desired length"), n(P > 0, "Requested array length <= 0"); - var _ = C(l, P), y = p === "le" ? "LE" : "BE"; + var _ = R(l, P), y = p === "le" ? "LE" : "BE"; return this["_toArrayLike" + y](_, w), _; }, s.prototype._toArrayLikeLE = function(l, p) { for (var m = 0, w = 0, P = 0, _ = 0; P < this.length; P++) { @@ -10420,14 +10420,14 @@ function mB() { }, U.prototype.imulK = function(l) { return l.imul(this.k); }; - function R() { + function C() { U.call( this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f" ); } - i(R, U), R.prototype.split = function(l, p) { + i(C, U), C.prototype.split = function(l, p) { for (var m = 4194303, w = Math.min(l.length, 9), P = 0; P < w; P++) p.words[P] = l.words[P]; if (p.length = w, l.length <= 9) { @@ -10440,7 +10440,7 @@ function mB() { l.words[P - 10] = (y & m) << 4 | _ >>> 22, _ = y; } _ >>>= 22, l.words[P - 10] = _, _ === 0 && l.length > 10 ? l.length -= 10 : l.length -= 9; - }, R.prototype.imulK = function(l) { + }, C.prototype.imulK = function(l) { l.words[l.length] = 0, l.words[l.length + 1] = 0, l.length += 2; for (var p = 0, m = 0; m < l.length; m++) { var w = l.words[m] | 0; @@ -10481,7 +10481,7 @@ function mB() { if ($[l]) return $[l]; var p; if (l === "k256") - p = new R(); + p = new C(); else if (l === "p224") p = new W(); else if (l === "p192") @@ -10834,10 +10834,10 @@ function Ls() { return E + b + l >>> 0; } Or.sum32_3 = S; - function C(E, b, l, p) { + function R(E, b, l, p) { return E + b + l + p >>> 0; } - Or.sum32_4 = C; + Or.sum32_4 = R; function D(E, b, l, p, m) { return E + b + l + p + m >>> 0; } @@ -10876,11 +10876,11 @@ function Ls() { return ce >>> 0; } Or.sum64_5_hi = U; - function R(E, b, l, p, m, w, P, _, y, M) { + function C(E, b, l, p, m, w, P, _, y, M) { var I = b + p + w + _ + M; return I >>> 0; } - Or.sum64_5_lo = R; + Or.sum64_5_lo = C; function W(E, b, l) { var p = b << 32 - l | E >>> l; return p >>> 0; @@ -11004,12 +11004,12 @@ function IB() { x[S] = g[v + S]; for (; S < x.length; S++) x[S] = n(x[S - 3] ^ x[S - 8] ^ x[S - 14] ^ x[S - 16], 1); - var C = this.h[0], D = this.h[1], k = this.h[2], N = this.h[3], z = this.h[4]; + var R = this.h[0], D = this.h[1], k = this.h[2], N = this.h[3], z = this.h[4]; for (S = 0; S < x.length; S++) { - var B = ~~(S / 20), $ = s(n(C, 5), o(B, D, k, N), z, x[S], f[B]); - z = N, N = k, k = n(D, 30), D = C, C = $; + var B = ~~(S / 20), $ = s(n(R, 5), o(B, D, k, N), z, x[S], f[B]); + z = N, N = k, k = n(D, 30), D = R, R = $; } - this.h[0] = i(this.h[0], C), this.h[1] = i(this.h[1], D), this.h[2] = i(this.h[2], k), this.h[3] = i(this.h[3], N), this.h[4] = i(this.h[4], z); + this.h[0] = i(this.h[0], R), this.h[1] = i(this.h[1], D), this.h[2] = i(this.h[2], k), this.h[3] = i(this.h[3], N), this.h[4] = i(this.h[4], z); }, u.prototype._digest = function(g) { return g === "hex" ? t.toHex32(this.h, "big") : t.split32(this.h, "big"); }, mg; @@ -11084,9 +11084,9 @@ function h8() { 3204031479, 3329325298 ]; - function C() { - if (!(this instanceof C)) - return new C(); + function R() { + if (!(this instanceof R)) + return new R(); x.call(this), this.h = [ 1779033703, 3144134277, @@ -11098,18 +11098,18 @@ function h8() { 1541459225 ], this.k = S, this.W = new Array(64); } - return t.inherits(C, x), vg = C, C.blockSize = 512, C.outSize = 256, C.hmacStrength = 192, C.padLength = 64, C.prototype._update = function(k, N) { + return t.inherits(R, x), vg = R, R.blockSize = 512, R.outSize = 256, R.hmacStrength = 192, R.padLength = 64, R.prototype._update = function(k, N) { for (var z = this.W, B = 0; B < 16; B++) z[B] = k[N + B]; for (; B < z.length; B++) z[B] = s(v(z[B - 2]), z[B - 7], g(z[B - 15]), z[B - 16]); - var $ = this.h[0], U = this.h[1], R = this.h[2], W = this.h[3], J = this.h[4], ne = this.h[5], K = this.h[6], E = this.h[7]; + var $ = this.h[0], U = this.h[1], C = this.h[2], W = this.h[3], J = this.h[4], ne = this.h[5], K = this.h[6], E = this.h[7]; for (n(this.k.length === z.length), B = 0; B < z.length; B++) { - var b = o(E, h(J), a(J, ne, K), this.k[B], z[B]), l = i(u($), f($, U, R)); - E = K, K = ne, ne = J, J = i(W, b), W = R, R = U, U = $, $ = i(b, l); + var b = o(E, h(J), a(J, ne, K), this.k[B], z[B]), l = i(u($), f($, U, C)); + E = K, K = ne, ne = J, J = i(W, b), W = C, C = U, U = $, $ = i(b, l); } - this.h[0] = i(this.h[0], $), this.h[1] = i(this.h[1], U), this.h[2] = i(this.h[2], R), this.h[3] = i(this.h[3], W), this.h[4] = i(this.h[4], J), this.h[5] = i(this.h[5], ne), this.h[6] = i(this.h[6], K), this.h[7] = i(this.h[7], E); - }, C.prototype._digest = function(k) { + this.h[0] = i(this.h[0], $), this.h[1] = i(this.h[1], U), this.h[2] = i(this.h[2], C), this.h[3] = i(this.h[3], W), this.h[4] = i(this.h[4], J), this.h[5] = i(this.h[5], ne), this.h[6] = i(this.h[6], K), this.h[7] = i(this.h[7], E); + }, R.prototype._digest = function(k) { return k === "hex" ? t.toHex32(this.h, "big") : t.split32(this.h, "big"); }, vg; } @@ -11140,7 +11140,7 @@ var yg, lx; function d8() { if (lx) return yg; lx = 1; - var t = Ls(), e = nl(), r = Wa(), n = t.rotr64_hi, i = t.rotr64_lo, s = t.shr64_hi, o = t.shr64_lo, a = t.sum64, f = t.sum64_hi, u = t.sum64_lo, h = t.sum64_4_hi, g = t.sum64_4_lo, v = t.sum64_5_hi, x = t.sum64_5_lo, S = e.BlockHash, C = [ + var t = Ls(), e = nl(), r = Wa(), n = t.rotr64_hi, i = t.rotr64_lo, s = t.shr64_hi, o = t.shr64_lo, a = t.sum64, f = t.sum64_hi, u = t.sum64_lo, h = t.sum64_4_hi, g = t.sum64_4_lo, v = t.sum64_5_hi, x = t.sum64_5_lo, S = e.BlockHash, R = [ 1116352408, 3609767458, 1899447441, @@ -11322,7 +11322,7 @@ function d8() { 4215389547, 1541459225, 327033209 - ], this.k = C, this.W = new Array(160); + ], this.k = R, this.W = new Array(160); } t.inherits(D, S), yg = D, D.blockSize = 1024, D.outSize = 512, D.hmacStrength = 192, D.padLength = 128, D.prototype._prepareBlock = function(l, p) { for (var m = this.W, w = 0; w < 32; w++) @@ -11354,7 +11354,7 @@ function d8() { var m = this.W, w = this.h[0], P = this.h[1], _ = this.h[2], y = this.h[3], M = this.h[4], I = this.h[5], q = this.h[6], ce = this.h[7], L = this.h[8], oe = this.h[9], Q = this.h[10], X = this.h[11], ee = this.h[12], O = this.h[13], Z = this.h[14], re = this.h[15]; r(this.k.length === m.length); for (var he = 0; he < m.length; he += 2) { - var ae = Z, fe = re, be = R(L, oe), Ae = W(L, oe), Te = k(L, oe, Q, X, ee), Re = N(L, oe, Q, X, ee, O), $e = this.k[he], Me = this.k[he + 1], Oe = m[he], ze = m[he + 1], De = v( + var ae = Z, fe = re, be = C(L, oe), Ae = W(L, oe), Te = k(L, oe, Q, X, ee), Re = N(L, oe, Q, X, ee, O), $e = this.k[he], Me = this.k[he + 1], Oe = m[he], ze = m[he + 1], De = v( ae, fe, be, @@ -11409,7 +11409,7 @@ function d8() { var p = i(b, l, 28), m = i(l, b, 2), w = i(l, b, 7), P = p ^ m ^ w; return P < 0 && (P += 4294967296), P; } - function R(b, l) { + function C(b, l) { var p = n(b, l, 14), m = n(b, l, 18), w = n(l, b, 9), P = p ^ m ^ w; return P < 0 && (P += 4294967296), P; } @@ -11481,7 +11481,7 @@ function DB() { o.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = "little"; } t.inherits(a, o), xg.ripemd160 = a, a.blockSize = 512, a.outSize = 160, a.hmacStrength = 192, a.padLength = 64, a.prototype._update = function(D, k) { - for (var N = this.h[0], z = this.h[1], B = this.h[2], $ = this.h[3], U = this.h[4], R = N, W = z, J = B, ne = $, K = U, E = 0; E < 80; E++) { + for (var N = this.h[0], z = this.h[1], B = this.h[2], $ = this.h[3], U = this.h[4], C = N, W = z, J = B, ne = $, K = U, E = 0; E < 80; E++) { var b = n( r( s(N, f(E, z, B, $), D[g[E] + k], u(E)), @@ -11491,24 +11491,24 @@ function DB() { ); N = U, U = $, $ = r(B, 10), B = z, z = b, b = n( r( - s(R, f(79 - E, W, J, ne), D[v[E] + k], h(E)), + s(C, f(79 - E, W, J, ne), D[v[E] + k], h(E)), S[E] ), K - ), R = K, K = ne, ne = r(J, 10), J = W, W = b; + ), C = K, K = ne, ne = r(J, 10), J = W, W = b; } - b = i(this.h[1], B, ne), this.h[1] = i(this.h[2], $, K), this.h[2] = i(this.h[3], U, R), this.h[3] = i(this.h[4], N, W), this.h[4] = i(this.h[0], z, J), this.h[0] = b; + b = i(this.h[1], B, ne), this.h[1] = i(this.h[2], $, K), this.h[2] = i(this.h[3], U, C), this.h[3] = i(this.h[4], N, W), this.h[4] = i(this.h[0], z, J), this.h[0] = b; }, a.prototype._digest = function(D) { return D === "hex" ? t.toHex32(this.h, "little") : t.split32(this.h, "little"); }; - function f(C, D, k, N) { - return C <= 15 ? D ^ k ^ N : C <= 31 ? D & k | ~D & N : C <= 47 ? (D | ~k) ^ N : C <= 63 ? D & N | k & ~N : D ^ (k | ~N); + function f(R, D, k, N) { + return R <= 15 ? D ^ k ^ N : R <= 31 ? D & k | ~D & N : R <= 47 ? (D | ~k) ^ N : R <= 63 ? D & N | k & ~N : D ^ (k | ~N); } - function u(C) { - return C <= 15 ? 0 : C <= 31 ? 1518500249 : C <= 47 ? 1859775393 : C <= 63 ? 2400959708 : 2840853838; + function u(R) { + return R <= 15 ? 0 : R <= 31 ? 1518500249 : R <= 47 ? 1859775393 : R <= 63 ? 2400959708 : 2840853838; } - function h(C) { - return C <= 15 ? 1352829926 : C <= 31 ? 1548603684 : C <= 47 ? 1836072691 : C <= 63 ? 2053994217 : 0; + function h(R) { + return R <= 15 ? 1352829926 : R <= 31 ? 1548603684 : R <= 47 ? 1836072691 : R <= 63 ? 2053994217 : 0; } var g = [ 0, @@ -11936,8 +11936,8 @@ var as = Gc(function(t, e) { var g = new Array(Math.max(f.bitLength(), h) + 1); g.fill(0); for (var v = 1 << u + 1, x = f.clone(), S = 0; S < g.length; S++) { - var C, D = x.andln(v - 1); - x.isOdd() ? (D > (v >> 1) - 1 ? C = (v >> 1) - D : C = D, x.isubn(C)) : C = 0, g[S] = C, x.iushrn(1); + var R, D = x.andln(v - 1); + x.isOdd() ? (D > (v >> 1) - 1 ? R = (v >> 1) - D : R = D, x.isubn(R)) : R = 0, g[S] = R, x.iushrn(1); } return g; } @@ -11949,12 +11949,12 @@ var as = Gc(function(t, e) { ]; f = f.clone(), u = u.clone(); for (var g = 0, v = 0, x; f.cmpn(-g) > 0 || u.cmpn(-v) > 0; ) { - var S = f.andln(3) + g & 3, C = u.andln(3) + v & 3; - S === 3 && (S = -1), C === 3 && (C = -1); + var S = f.andln(3) + g & 3, R = u.andln(3) + v & 3; + S === 3 && (S = -1), R === 3 && (R = -1); var D; - (S & 1) === 0 ? D = 0 : (x = f.andln(7) + g & 7, (x === 3 || x === 5) && C === 2 ? D = -S : D = S), h[0].push(D); + (S & 1) === 0 ? D = 0 : (x = f.andln(7) + g & 7, (x === 3 || x === 5) && R === 2 ? D = -S : D = S), h[0].push(D); var k; - (C & 1) === 0 ? k = 0 : (x = u.andln(7) + v & 7, (x === 3 || x === 5) && S === 2 ? k = -C : k = C), h[1].push(k), 2 * g === D + 1 && (g = 1 - g), 2 * v === k + 1 && (v = 1 - v), f.iushrn(1), u.iushrn(1); + (R & 1) === 0 ? k = 0 : (x = u.andln(7) + v & 7, (x === 3 || x === 5) && S === 2 ? k = -R : k = R), h[1].push(k), 2 * g === D + 1 && (g = 1 - g), 2 * v === k + 1 && (v = 1 - v), f.iushrn(1), u.iushrn(1); } return h; } @@ -12026,9 +12026,9 @@ Zo.prototype._wnafMulAdd = function(e, r, n, i, s) { o[h] = x.wnd, a[h] = x.points; } for (h = i - 1; h >= 1; h -= 2) { - var S = h - 1, C = h; - if (o[S] !== 1 || o[C] !== 1) { - f[S] = yd(n[S], o[S], this._bitLength), f[C] = yd(n[C], o[C], this._bitLength), u = Math.max(f[S].length, u), u = Math.max(f[C].length, u); + var S = h - 1, R = h; + if (o[S] !== 1 || o[R] !== 1) { + f[S] = yd(n[S], o[S], this._bitLength), f[R] = yd(n[R], o[R], this._bitLength), u = Math.max(f[S].length, u), u = Math.max(f[R].length, u); continue; } var D = [ @@ -12038,10 +12038,10 @@ Zo.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 3 */ null, /* 5 */ - r[C] + r[R] /* 7 */ ]; - r[S].y.cmp(r[C].y) === 0 ? (D[1] = r[S].add(r[C]), D[2] = r[S].toJ().mixedAdd(r[C].neg())) : r[S].y.cmp(r[C].y.redNeg()) === 0 ? (D[1] = r[S].toJ().mixedAdd(r[C]), D[2] = r[S].add(r[C].neg())) : (D[1] = r[S].toJ().mixedAdd(r[C]), D[2] = r[S].toJ().mixedAdd(r[C].neg())); + r[S].y.cmp(r[R].y) === 0 ? (D[1] = r[S].add(r[R]), D[2] = r[S].toJ().mixedAdd(r[R].neg())) : r[S].y.cmp(r[R].y.redNeg()) === 0 ? (D[1] = r[S].toJ().mixedAdd(r[R]), D[2] = r[S].add(r[R].neg())) : (D[1] = r[S].toJ().mixedAdd(r[R]), D[2] = r[S].toJ().mixedAdd(r[R].neg())); var k = [ -3, /* -1 -1 */ @@ -12061,23 +12061,23 @@ Zo.prototype._wnafMulAdd = function(e, r, n, i, s) { /* 1 0 */ 3 /* 1 1 */ - ], N = kB(n[S], n[C]); - for (u = Math.max(N[0].length, u), f[S] = new Array(u), f[C] = new Array(u), g = 0; g < u; g++) { + ], N = kB(n[S], n[R]); + for (u = Math.max(N[0].length, u), f[S] = new Array(u), f[R] = new Array(u), g = 0; g < u; g++) { var z = N[0][g] | 0, B = N[1][g] | 0; - f[S][g] = k[(z + 1) * 3 + (B + 1)], f[C][g] = 0, a[S] = D; + f[S][g] = k[(z + 1) * 3 + (B + 1)], f[R][g] = 0, a[S] = D; } } var $ = this.jpoint(null, null, null), U = this._wnafT4; for (h = u; h >= 0; h--) { - for (var R = 0; h >= 0; ) { + for (var C = 0; h >= 0; ) { var W = !0; for (g = 0; g < i; g++) U[g] = f[g][h] | 0, U[g] !== 0 && (W = !1); if (!W) break; - R++, h--; + C++, h--; } - if (h >= 0 && R++, $ = $.dblp(R), h < 0) + if (h >= 0 && C++, $ = $.dblp(C), h < 0) break; for (g = 0; g < i; g++) { var J = U[g]; @@ -12226,15 +12226,15 @@ Vi.prototype._getEndoRoots = function(e) { return [o, a]; }; Vi.prototype._getEndoBasis = function(e) { - for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new or(1), o = new or(0), a = new or(0), f = new or(1), u, h, g, v, x, S, C, D = 0, k, N; n.cmpn(0) !== 0; ) { + for (var r = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), n = e, i = this.n.clone(), s = new or(1), o = new or(0), a = new or(0), f = new or(1), u, h, g, v, x, S, R, D = 0, k, N; n.cmpn(0) !== 0; ) { var z = i.div(n); k = i.sub(z.mul(n)), N = a.sub(z.mul(s)); var B = f.sub(z.mul(o)); if (!g && k.cmp(r) < 0) - u = C.neg(), h = s, g = k.neg(), v = N; + u = R.neg(), h = s, g = k.neg(), v = N; else if (g && ++D === 2) break; - C = k, i = n, n = k, a = s, s = N, f = o, o = B; + R = k, i = n, n = k, a = s, s = N, f = o, o = B; } x = k.neg(), S = N; var $ = g.sqr().add(v.sqr()), U = x.sqr().add(S.sqr()); @@ -12440,8 +12440,8 @@ Bn.prototype.add = function(e) { var r = e.z.redSqr(), n = this.z.redSqr(), i = this.x.redMul(r), s = e.x.redMul(n), o = this.y.redMul(r.redMul(e.z)), a = e.y.redMul(n.redMul(this.z)), f = i.redSub(s), u = o.redSub(a); if (f.cmpn(0) === 0) return u.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var h = f.redSqr(), g = h.redMul(f), v = i.redMul(h), x = u.redSqr().redIAdd(g).redISub(v).redISub(v), S = u.redMul(v.redISub(x)).redISub(o.redMul(g)), C = this.z.redMul(e.z).redMul(f); - return this.curve.jpoint(x, S, C); + var h = f.redSqr(), g = h.redMul(f), v = i.redMul(h), x = u.redSqr().redIAdd(g).redISub(v).redISub(v), S = u.redMul(v.redISub(x)).redISub(o.redMul(g)), R = this.z.redMul(e.z).redMul(f); + return this.curve.jpoint(x, S, R); }; Bn.prototype.mixedAdd = function(e) { if (this.isInfinity()) @@ -12470,7 +12470,7 @@ Bn.prototype.dblp = function(e) { } var i = this.curve.a, s = this.curve.tinv, o = this.x, a = this.y, f = this.z, u = f.redSqr().redSqr(), h = a.redAdd(a); for (r = 0; r < e; r++) { - var g = o.redSqr(), v = h.redSqr(), x = v.redSqr(), S = g.redAdd(g).redIAdd(g).redIAdd(i.redMul(u)), C = o.redMul(v), D = S.redSqr().redISub(C.redAdd(C)), k = C.redISub(D), N = S.redMul(k); + var g = o.redSqr(), v = h.redSqr(), x = v.redSqr(), S = g.redAdd(g).redIAdd(g).redIAdd(i.redMul(u)), R = o.redMul(v), D = S.redSqr().redISub(R.redAdd(R)), k = R.redISub(D), N = S.redMul(k); N = N.redIAdd(N).redISub(x); var z = h.redMul(f); r + 1 < e && (u = u.redMul(x)), o = D, f = z, h = N; @@ -12490,8 +12490,8 @@ Bn.prototype._zeroDbl = function() { } else { var g = this.x.redSqr(), v = this.y.redSqr(), x = v.redSqr(), S = this.x.redAdd(v).redSqr().redISub(g).redISub(x); S = S.redIAdd(S); - var C = g.redAdd(g).redIAdd(g), D = C.redSqr(), k = x.redIAdd(x); - k = k.redIAdd(k), k = k.redIAdd(k), e = D.redISub(S).redISub(S), r = C.redMul(S.redISub(e)).redISub(k), n = this.y.redMul(this.z), n = n.redIAdd(n); + var R = g.redAdd(g).redIAdd(g), D = R.redSqr(), k = x.redIAdd(x); + k = k.redIAdd(k), k = k.redIAdd(k), e = D.redISub(S).redISub(S), r = R.redMul(S.redISub(e)).redISub(k), n = this.y.redMul(this.z), n = n.redIAdd(n); } return this.curve.jpoint(e, r, n); }; @@ -12507,12 +12507,12 @@ Bn.prototype._threeDbl = function() { } else { var g = this.z.redSqr(), v = this.y.redSqr(), x = this.x.redMul(v), S = this.x.redSub(g).redMul(this.x.redAdd(g)); S = S.redAdd(S).redIAdd(S); - var C = x.redIAdd(x); - C = C.redIAdd(C); - var D = C.redAdd(C); + var R = x.redIAdd(x); + R = R.redIAdd(R); + var D = R.redAdd(R); e = S.redSqr().redISub(D), n = this.y.redAdd(this.z).redSqr().redISub(v).redISub(g); var k = v.redSqr(); - k = k.redIAdd(k), k = k.redIAdd(k), k = k.redIAdd(k), r = S.redMul(C.redISub(e)).redISub(k); + k = k.redIAdd(k), k = k.redIAdd(k), k = k.redIAdd(k), r = S.redMul(R.redISub(e)).redISub(k); } return this.curve.jpoint(e, r, n); }; @@ -12521,8 +12521,8 @@ Bn.prototype._dbl = function() { u = u.redIAdd(u); var h = u.redMul(a), g = f.redSqr().redISub(h.redAdd(h)), v = h.redISub(g), x = a.redSqr(); x = x.redIAdd(x), x = x.redIAdd(x), x = x.redIAdd(x); - var S = f.redMul(v).redISub(x), C = n.redAdd(n).redMul(i); - return this.curve.jpoint(g, S, C); + var S = f.redMul(v).redISub(x), R = n.redAdd(n).redMul(i); + return this.curve.jpoint(g, S, R); }; Bn.prototype.trpl = function() { if (!this.curve.zeroA) @@ -12949,10 +12949,10 @@ zi.prototype.sign = function(e, r, n, i) { if (!v.isInfinity()) { var x = v.getX(), S = x.umod(this.n); if (S.cmpn(0) !== 0) { - var C = g.invm(this.n).mul(S.mul(r.getPrivate()).iadd(e)); - if (C = C.umod(this.n), C.cmpn(0) !== 0) { + var R = g.invm(this.n).mul(S.mul(r.getPrivate()).iadd(e)); + if (R = R.umod(this.n), R.cmpn(0) !== 0) { var D = (v.getY().isOdd() ? 1 : 0) | (x.cmp(S) !== 0 ? 2 : 0); - return i.canonical && C.cmp(this.nh) > 0 && (C = this.n.sub(C), D ^= 1), new Qd({ r: S, s: C, recoveryParam: D }); + return i.canonical && R.cmp(this.nh) > 0 && (R = this.n.sub(R), D ^= 1), new Qd({ r: S, s: R, recoveryParam: D }); } } } @@ -13057,9 +13057,9 @@ function JB() { yx = 1, Object.defineProperty(Du, "__esModule", { value: !0 }); var t = el(), e = ls(), r = 20; function n(a, f, u) { - for (var h = 1634760805, g = 857760878, v = 2036477234, x = 1797285236, S = u[3] << 24 | u[2] << 16 | u[1] << 8 | u[0], C = u[7] << 24 | u[6] << 16 | u[5] << 8 | u[4], D = u[11] << 24 | u[10] << 16 | u[9] << 8 | u[8], k = u[15] << 24 | u[14] << 16 | u[13] << 8 | u[12], N = u[19] << 24 | u[18] << 16 | u[17] << 8 | u[16], z = u[23] << 24 | u[22] << 16 | u[21] << 8 | u[20], B = u[27] << 24 | u[26] << 16 | u[25] << 8 | u[24], $ = u[31] << 24 | u[30] << 16 | u[29] << 8 | u[28], U = f[3] << 24 | f[2] << 16 | f[1] << 8 | f[0], R = f[7] << 24 | f[6] << 16 | f[5] << 8 | f[4], W = f[11] << 24 | f[10] << 16 | f[9] << 8 | f[8], J = f[15] << 24 | f[14] << 16 | f[13] << 8 | f[12], ne = h, K = g, E = v, b = x, l = S, p = C, m = D, w = k, P = N, _ = z, y = B, M = $, I = U, q = R, ce = W, L = J, oe = 0; oe < r; oe += 2) + for (var h = 1634760805, g = 857760878, v = 2036477234, x = 1797285236, S = u[3] << 24 | u[2] << 16 | u[1] << 8 | u[0], R = u[7] << 24 | u[6] << 16 | u[5] << 8 | u[4], D = u[11] << 24 | u[10] << 16 | u[9] << 8 | u[8], k = u[15] << 24 | u[14] << 16 | u[13] << 8 | u[12], N = u[19] << 24 | u[18] << 16 | u[17] << 8 | u[16], z = u[23] << 24 | u[22] << 16 | u[21] << 8 | u[20], B = u[27] << 24 | u[26] << 16 | u[25] << 8 | u[24], $ = u[31] << 24 | u[30] << 16 | u[29] << 8 | u[28], U = f[3] << 24 | f[2] << 16 | f[1] << 8 | f[0], C = f[7] << 24 | f[6] << 16 | f[5] << 8 | f[4], W = f[11] << 24 | f[10] << 16 | f[9] << 8 | f[8], J = f[15] << 24 | f[14] << 16 | f[13] << 8 | f[12], ne = h, K = g, E = v, b = x, l = S, p = R, m = D, w = k, P = N, _ = z, y = B, M = $, I = U, q = C, ce = W, L = J, oe = 0; oe < r; oe += 2) ne = ne + l | 0, I ^= ne, I = I >>> 16 | I << 16, P = P + I | 0, l ^= P, l = l >>> 20 | l << 12, K = K + p | 0, q ^= K, q = q >>> 16 | q << 16, _ = _ + q | 0, p ^= _, p = p >>> 20 | p << 12, E = E + m | 0, ce ^= E, ce = ce >>> 16 | ce << 16, y = y + ce | 0, m ^= y, m = m >>> 20 | m << 12, b = b + w | 0, L ^= b, L = L >>> 16 | L << 16, M = M + L | 0, w ^= M, w = w >>> 20 | w << 12, E = E + m | 0, ce ^= E, ce = ce >>> 24 | ce << 8, y = y + ce | 0, m ^= y, m = m >>> 25 | m << 7, b = b + w | 0, L ^= b, L = L >>> 24 | L << 8, M = M + L | 0, w ^= M, w = w >>> 25 | w << 7, K = K + p | 0, q ^= K, q = q >>> 24 | q << 8, _ = _ + q | 0, p ^= _, p = p >>> 25 | p << 7, ne = ne + l | 0, I ^= ne, I = I >>> 24 | I << 8, P = P + I | 0, l ^= P, l = l >>> 25 | l << 7, ne = ne + p | 0, L ^= ne, L = L >>> 16 | L << 16, y = y + L | 0, p ^= y, p = p >>> 20 | p << 12, K = K + m | 0, I ^= K, I = I >>> 16 | I << 16, M = M + I | 0, m ^= M, m = m >>> 20 | m << 12, E = E + w | 0, q ^= E, q = q >>> 16 | q << 16, P = P + q | 0, w ^= P, w = w >>> 20 | w << 12, b = b + l | 0, ce ^= b, ce = ce >>> 16 | ce << 16, _ = _ + ce | 0, l ^= _, l = l >>> 20 | l << 12, E = E + w | 0, q ^= E, q = q >>> 24 | q << 8, P = P + q | 0, w ^= P, w = w >>> 25 | w << 7, b = b + l | 0, ce ^= b, ce = ce >>> 24 | ce << 8, _ = _ + ce | 0, l ^= _, l = l >>> 25 | l << 7, K = K + m | 0, I ^= K, I = I >>> 24 | I << 8, M = M + I | 0, m ^= M, m = m >>> 25 | m << 7, ne = ne + p | 0, L ^= ne, L = L >>> 24 | L << 8, y = y + L | 0, p ^= y, p = p >>> 25 | p << 7; - t.writeUint32LE(ne + h | 0, a, 0), t.writeUint32LE(K + g | 0, a, 4), t.writeUint32LE(E + v | 0, a, 8), t.writeUint32LE(b + x | 0, a, 12), t.writeUint32LE(l + S | 0, a, 16), t.writeUint32LE(p + C | 0, a, 20), t.writeUint32LE(m + D | 0, a, 24), t.writeUint32LE(w + k | 0, a, 28), t.writeUint32LE(P + N | 0, a, 32), t.writeUint32LE(_ + z | 0, a, 36), t.writeUint32LE(y + B | 0, a, 40), t.writeUint32LE(M + $ | 0, a, 44), t.writeUint32LE(I + U | 0, a, 48), t.writeUint32LE(q + R | 0, a, 52), t.writeUint32LE(ce + W | 0, a, 56), t.writeUint32LE(L + J | 0, a, 60); + t.writeUint32LE(ne + h | 0, a, 0), t.writeUint32LE(K + g | 0, a, 4), t.writeUint32LE(E + v | 0, a, 8), t.writeUint32LE(b + x | 0, a, 12), t.writeUint32LE(l + S | 0, a, 16), t.writeUint32LE(p + R | 0, a, 20), t.writeUint32LE(m + D | 0, a, 24), t.writeUint32LE(w + k | 0, a, 28), t.writeUint32LE(P + N | 0, a, 32), t.writeUint32LE(_ + z | 0, a, 36), t.writeUint32LE(y + B | 0, a, 40), t.writeUint32LE(M + $ | 0, a, 44), t.writeUint32LE(I + U | 0, a, 48), t.writeUint32LE(q + C | 0, a, 52), t.writeUint32LE(ce + W | 0, a, 56), t.writeUint32LE(L + J | 0, a, 60); } function i(a, f, u, h, g) { if (g === void 0 && (g = 0), a.length !== 32) @@ -13076,10 +13076,10 @@ function JB() { throw new Error("ChaCha nonce with counter must be 16 bytes"); v = f, x = g; } - for (var S = new Uint8Array(64), C = 0; C < u.length; C += 64) { + for (var S = new Uint8Array(64), R = 0; R < u.length; R += 64) { n(S, v, a); - for (var D = C; D < C + 64 && D < u.length; D++) - h[D] = u[D] ^ S[D - C]; + for (var D = R; D < R + 64 && D < u.length; D++) + h[D] = u[D] ^ S[D - R]; o(v, 0, x); } return e.wipe(S), g === 0 && e.wipe(v), h; @@ -13147,11 +13147,11 @@ function XB() { this._r[6] = (v >>> 14 | x << 2) & 8191; var S = a[12] | a[13] << 8; this._r[7] = (x >>> 11 | S << 5) & 8065; - var C = a[14] | a[15] << 8; - this._r[8] = (S >>> 8 | C << 8) & 8191, this._r[9] = C >>> 5 & 127, this._pad[0] = a[16] | a[17] << 8, this._pad[1] = a[18] | a[19] << 8, this._pad[2] = a[20] | a[21] << 8, this._pad[3] = a[22] | a[23] << 8, this._pad[4] = a[24] | a[25] << 8, this._pad[5] = a[26] | a[27] << 8, this._pad[6] = a[28] | a[29] << 8, this._pad[7] = a[30] | a[31] << 8; + var R = a[14] | a[15] << 8; + this._r[8] = (S >>> 8 | R << 8) & 8191, this._r[9] = R >>> 5 & 127, this._pad[0] = a[16] | a[17] << 8, this._pad[1] = a[18] | a[19] << 8, this._pad[2] = a[20] | a[21] << 8, this._pad[3] = a[22] | a[23] << 8, this._pad[4] = a[24] | a[25] << 8, this._pad[5] = a[26] | a[27] << 8, this._pad[6] = a[28] | a[29] << 8, this._pad[7] = a[30] | a[31] << 8; } return o.prototype._blocks = function(a, f, u) { - for (var h = this._fin ? 0 : 2048, g = this._h[0], v = this._h[1], x = this._h[2], S = this._h[3], C = this._h[4], D = this._h[5], k = this._h[6], N = this._h[7], z = this._h[8], B = this._h[9], $ = this._r[0], U = this._r[1], R = this._r[2], W = this._r[3], J = this._r[4], ne = this._r[5], K = this._r[6], E = this._r[7], b = this._r[8], l = this._r[9]; u >= 16; ) { + for (var h = this._fin ? 0 : 2048, g = this._h[0], v = this._h[1], x = this._h[2], S = this._h[3], R = this._h[4], D = this._h[5], k = this._h[6], N = this._h[7], z = this._h[8], B = this._h[9], $ = this._r[0], U = this._r[1], C = this._r[2], W = this._r[3], J = this._r[4], ne = this._r[5], K = this._r[6], E = this._r[7], b = this._r[8], l = this._r[9]; u >= 16; ) { var p = a[f + 0] | a[f + 1] << 8; g += p & 8191; var m = a[f + 2] | a[f + 3] << 8; @@ -13161,7 +13161,7 @@ function XB() { var P = a[f + 6] | a[f + 7] << 8; S += (w >>> 7 | P << 9) & 8191; var _ = a[f + 8] | a[f + 9] << 8; - C += (P >>> 4 | _ << 12) & 8191, D += _ >>> 1 & 8191; + R += (P >>> 4 | _ << 12) & 8191, D += _ >>> 1 & 8191; var y = a[f + 10] | a[f + 11] << 8; k += (_ >>> 14 | y << 2) & 8191; var M = a[f + 12] | a[f + 13] << 8; @@ -13169,27 +13169,27 @@ function XB() { var I = a[f + 14] | a[f + 15] << 8; z += (M >>> 8 | I << 8) & 8191, B += I >>> 5 | h; var q = 0, ce = q; - ce += g * $, ce += v * (5 * l), ce += x * (5 * b), ce += S * (5 * E), ce += C * (5 * K), q = ce >>> 13, ce &= 8191, ce += D * (5 * ne), ce += k * (5 * J), ce += N * (5 * W), ce += z * (5 * R), ce += B * (5 * U), q += ce >>> 13, ce &= 8191; + ce += g * $, ce += v * (5 * l), ce += x * (5 * b), ce += S * (5 * E), ce += R * (5 * K), q = ce >>> 13, ce &= 8191, ce += D * (5 * ne), ce += k * (5 * J), ce += N * (5 * W), ce += z * (5 * C), ce += B * (5 * U), q += ce >>> 13, ce &= 8191; var L = q; - L += g * U, L += v * $, L += x * (5 * l), L += S * (5 * b), L += C * (5 * E), q = L >>> 13, L &= 8191, L += D * (5 * K), L += k * (5 * ne), L += N * (5 * J), L += z * (5 * W), L += B * (5 * R), q += L >>> 13, L &= 8191; + L += g * U, L += v * $, L += x * (5 * l), L += S * (5 * b), L += R * (5 * E), q = L >>> 13, L &= 8191, L += D * (5 * K), L += k * (5 * ne), L += N * (5 * J), L += z * (5 * W), L += B * (5 * C), q += L >>> 13, L &= 8191; var oe = q; - oe += g * R, oe += v * U, oe += x * $, oe += S * (5 * l), oe += C * (5 * b), q = oe >>> 13, oe &= 8191, oe += D * (5 * E), oe += k * (5 * K), oe += N * (5 * ne), oe += z * (5 * J), oe += B * (5 * W), q += oe >>> 13, oe &= 8191; + oe += g * C, oe += v * U, oe += x * $, oe += S * (5 * l), oe += R * (5 * b), q = oe >>> 13, oe &= 8191, oe += D * (5 * E), oe += k * (5 * K), oe += N * (5 * ne), oe += z * (5 * J), oe += B * (5 * W), q += oe >>> 13, oe &= 8191; var Q = q; - Q += g * W, Q += v * R, Q += x * U, Q += S * $, Q += C * (5 * l), q = Q >>> 13, Q &= 8191, Q += D * (5 * b), Q += k * (5 * E), Q += N * (5 * K), Q += z * (5 * ne), Q += B * (5 * J), q += Q >>> 13, Q &= 8191; + Q += g * W, Q += v * C, Q += x * U, Q += S * $, Q += R * (5 * l), q = Q >>> 13, Q &= 8191, Q += D * (5 * b), Q += k * (5 * E), Q += N * (5 * K), Q += z * (5 * ne), Q += B * (5 * J), q += Q >>> 13, Q &= 8191; var X = q; - X += g * J, X += v * W, X += x * R, X += S * U, X += C * $, q = X >>> 13, X &= 8191, X += D * (5 * l), X += k * (5 * b), X += N * (5 * E), X += z * (5 * K), X += B * (5 * ne), q += X >>> 13, X &= 8191; + X += g * J, X += v * W, X += x * C, X += S * U, X += R * $, q = X >>> 13, X &= 8191, X += D * (5 * l), X += k * (5 * b), X += N * (5 * E), X += z * (5 * K), X += B * (5 * ne), q += X >>> 13, X &= 8191; var ee = q; - ee += g * ne, ee += v * J, ee += x * W, ee += S * R, ee += C * U, q = ee >>> 13, ee &= 8191, ee += D * $, ee += k * (5 * l), ee += N * (5 * b), ee += z * (5 * E), ee += B * (5 * K), q += ee >>> 13, ee &= 8191; + ee += g * ne, ee += v * J, ee += x * W, ee += S * C, ee += R * U, q = ee >>> 13, ee &= 8191, ee += D * $, ee += k * (5 * l), ee += N * (5 * b), ee += z * (5 * E), ee += B * (5 * K), q += ee >>> 13, ee &= 8191; var O = q; - O += g * K, O += v * ne, O += x * J, O += S * W, O += C * R, q = O >>> 13, O &= 8191, O += D * U, O += k * $, O += N * (5 * l), O += z * (5 * b), O += B * (5 * E), q += O >>> 13, O &= 8191; + O += g * K, O += v * ne, O += x * J, O += S * W, O += R * C, q = O >>> 13, O &= 8191, O += D * U, O += k * $, O += N * (5 * l), O += z * (5 * b), O += B * (5 * E), q += O >>> 13, O &= 8191; var Z = q; - Z += g * E, Z += v * K, Z += x * ne, Z += S * J, Z += C * W, q = Z >>> 13, Z &= 8191, Z += D * R, Z += k * U, Z += N * $, Z += z * (5 * l), Z += B * (5 * b), q += Z >>> 13, Z &= 8191; + Z += g * E, Z += v * K, Z += x * ne, Z += S * J, Z += R * W, q = Z >>> 13, Z &= 8191, Z += D * C, Z += k * U, Z += N * $, Z += z * (5 * l), Z += B * (5 * b), q += Z >>> 13, Z &= 8191; var re = q; - re += g * b, re += v * E, re += x * K, re += S * ne, re += C * J, q = re >>> 13, re &= 8191, re += D * W, re += k * R, re += N * U, re += z * $, re += B * (5 * l), q += re >>> 13, re &= 8191; + re += g * b, re += v * E, re += x * K, re += S * ne, re += R * J, q = re >>> 13, re &= 8191, re += D * W, re += k * C, re += N * U, re += z * $, re += B * (5 * l), q += re >>> 13, re &= 8191; var he = q; - he += g * l, he += v * b, he += x * E, he += S * K, he += C * ne, q = he >>> 13, he &= 8191, he += D * J, he += k * W, he += N * R, he += z * U, he += B * $, q += he >>> 13, he &= 8191, q = (q << 2) + q | 0, q = q + ce | 0, ce = q & 8191, q = q >>> 13, L += q, g = ce, v = L, x = oe, S = Q, C = X, D = ee, k = O, N = Z, z = re, B = he, f += 16, u -= 16; + he += g * l, he += v * b, he += x * E, he += S * K, he += R * ne, q = he >>> 13, he &= 8191, he += D * J, he += k * W, he += N * C, he += z * U, he += B * $, q += he >>> 13, he &= 8191, q = (q << 2) + q | 0, q = q + ce | 0, ce = q & 8191, q = q >>> 13, L += q, g = ce, v = L, x = oe, S = Q, R = X, D = ee, k = O, N = Z, z = re, B = he, f += 16, u -= 16; } - this._h[0] = g, this._h[1] = v, this._h[2] = x, this._h[3] = S, this._h[4] = C, this._h[5] = D, this._h[6] = k, this._h[7] = N, this._h[8] = z, this._h[9] = B; + this._h[0] = g, this._h[1] = v, this._h[2] = x, this._h[3] = S, this._h[4] = R, this._h[5] = D, this._h[6] = k, this._h[7] = N, this._h[8] = z, this._h[9] = B; }, o.prototype.finish = function(a, f) { f === void 0 && (f = 0); var u = new Uint16Array(10), h, g, v, x; @@ -13270,13 +13270,13 @@ function ZB() { x.set(u, x.length - u.length); var S = new Uint8Array(32); e.stream(this._key, x, S, 4); - var C = h.length + this.tagLength, D; + var R = h.length + this.tagLength, D; if (v) { - if (v.length !== C) + if (v.length !== R) throw new Error("ChaCha20Poly1305: incorrect destination length"); D = v; } else - D = new Uint8Array(C); + D = new Uint8Array(R); return e.streamXOR(this._key, x, h, D, 4), this._authenticate(D.subarray(D.length - this.tagLength, D.length), S, D.subarray(0, D.length - this.tagLength), g), n.wipe(x), D; }, f.prototype.open = function(u, h, g, v) { if (u.length > 16) @@ -13287,8 +13287,8 @@ function ZB() { x.set(u, x.length - u.length); var S = new Uint8Array(32); e.stream(this._key, x, S, 4); - var C = new Uint8Array(this.tagLength); - if (this._authenticate(C, S, h.subarray(0, h.length - this.tagLength), g), !s.equal(C, h.subarray(h.length - this.tagLength, h.length))) + var R = new Uint8Array(this.tagLength); + if (this._authenticate(R, S, h.subarray(0, h.length - this.tagLength), g), !s.equal(R, h.subarray(h.length - this.tagLength, h.length))) return null; var D = h.length - this.tagLength, k; if (v) { @@ -13305,9 +13305,9 @@ function ZB() { v && (x.update(v), v.length % 16 > 0 && x.update(o.subarray(v.length % 16))), x.update(g), g.length % 16 > 0 && x.update(o.subarray(g.length % 16)); var S = new Uint8Array(8); v && i.writeUint64LE(v.length, S), x.update(S), i.writeUint64LE(g.length, S), x.update(S); - for (var C = x.digest(), D = 0; D < C.length; D++) - u[D] = C[D]; - x.clean(), n.wipe(C), n.wipe(S); + for (var R = x.digest(), D = 0; D < R.length; D++) + u[D] = R[D]; + x.clean(), n.wipe(R), n.wipe(S); }, f; })() ); @@ -13536,21 +13536,21 @@ function nF() { ]); function s(a, f, u, h, g) { for (; g >= 64; ) { - for (var v = f[0], x = f[1], S = f[2], C = f[3], D = f[4], k = f[5], N = f[6], z = f[7], B = 0; B < 16; B++) { + for (var v = f[0], x = f[1], S = f[2], R = f[3], D = f[4], k = f[5], N = f[6], z = f[7], B = 0; B < 16; B++) { var $ = h + B * 4; a[B] = e.readUint32BE(u, $); } for (var B = 16; B < 64; B++) { - var U = a[B - 2], R = (U >>> 17 | U << 15) ^ (U >>> 19 | U << 13) ^ U >>> 10; + var U = a[B - 2], C = (U >>> 17 | U << 15) ^ (U >>> 19 | U << 13) ^ U >>> 10; U = a[B - 15]; var W = (U >>> 7 | U << 25) ^ (U >>> 18 | U << 14) ^ U >>> 3; - a[B] = (R + a[B - 7] | 0) + (W + a[B - 16] | 0); + a[B] = (C + a[B - 7] | 0) + (W + a[B - 16] | 0); } for (var B = 0; B < 64; B++) { - var R = (((D >>> 6 | D << 26) ^ (D >>> 11 | D << 21) ^ (D >>> 25 | D << 7)) + (D & k ^ ~D & N) | 0) + (z + (i[B] + a[B] | 0) | 0) | 0, W = ((v >>> 2 | v << 30) ^ (v >>> 13 | v << 19) ^ (v >>> 22 | v << 10)) + (v & x ^ v & S ^ x & S) | 0; - z = N, N = k, k = D, D = C + R | 0, C = S, S = x, x = v, v = R + W | 0; + var C = (((D >>> 6 | D << 26) ^ (D >>> 11 | D << 21) ^ (D >>> 25 | D << 7)) + (D & k ^ ~D & N) | 0) + (z + (i[B] + a[B] | 0) | 0) | 0, W = ((v >>> 2 | v << 30) ^ (v >>> 13 | v << 19) ^ (v >>> 22 | v << 10)) + (v & x ^ v & S ^ x & S) | 0; + z = N, N = k, k = D, D = R + C | 0, R = S, S = x, x = v, v = C + W | 0; } - f[0] += v, f[1] += x, f[2] += S, f[3] += C, f[4] += D, f[5] += k, f[6] += N, f[7] += z, h += 64, g -= 64; + f[0] += v, f[1] += x, f[2] += S, f[3] += R, f[4] += D, f[5] += k, f[6] += N, f[7] += z, h += 64, g -= 64; } return h; } @@ -13582,33 +13582,33 @@ function iF() { function o(B) { let $ = 1; for (let U = 0; U < 16; U++) { - let R = B[U] + $ + 65535; - $ = Math.floor(R / 65536), B[U] = R - $ * 65536; + let C = B[U] + $ + 65535; + $ = Math.floor(C / 65536), B[U] = C - $ * 65536; } B[0] += $ - 1 + 37 * ($ - 1); } function a(B, $, U) { - const R = ~(U - 1); + const C = ~(U - 1); for (let W = 0; W < 16; W++) { - const J = R & (B[W] ^ $[W]); + const J = C & (B[W] ^ $[W]); B[W] ^= J, $[W] ^= J; } } function f(B, $) { - const U = n(), R = n(); + const U = n(), C = n(); for (let W = 0; W < 16; W++) - R[W] = $[W]; - o(R), o(R), o(R); + C[W] = $[W]; + o(C), o(C), o(C); for (let W = 0; W < 2; W++) { - U[0] = R[0] - 65517; + U[0] = C[0] - 65517; for (let ne = 1; ne < 15; ne++) - U[ne] = R[ne] - 65535 - (U[ne - 1] >> 16 & 1), U[ne - 1] &= 65535; - U[15] = R[15] - 32767 - (U[14] >> 16 & 1); + U[ne] = C[ne] - 65535 - (U[ne - 1] >> 16 & 1), U[ne - 1] &= 65535; + U[15] = C[15] - 32767 - (U[14] >> 16 & 1); const J = U[15] >> 16 & 1; - U[14] &= 65535, a(R, U, 1 - J); + U[14] &= 65535, a(C, U, 1 - J); } for (let W = 0; W < 16; W++) - B[2 * W] = R[W] & 255, B[2 * W + 1] = R[W] >> 8; + B[2 * W] = C[W] & 255, B[2 * W + 1] = C[W] >> 8; } function u(B, $) { for (let U = 0; U < 16; U++) @@ -13616,51 +13616,51 @@ function iF() { B[15] &= 32767; } function h(B, $, U) { - for (let R = 0; R < 16; R++) - B[R] = $[R] + U[R]; + for (let C = 0; C < 16; C++) + B[C] = $[C] + U[C]; } function g(B, $, U) { - for (let R = 0; R < 16; R++) - B[R] = $[R] - U[R]; + for (let C = 0; C < 16; C++) + B[C] = $[C] - U[C]; } function v(B, $, U) { - let R, W, J = 0, ne = 0, K = 0, E = 0, b = 0, l = 0, p = 0, m = 0, w = 0, P = 0, _ = 0, y = 0, M = 0, I = 0, q = 0, ce = 0, L = 0, oe = 0, Q = 0, X = 0, ee = 0, O = 0, Z = 0, re = 0, he = 0, ae = 0, fe = 0, be = 0, Ae = 0, Te = 0, Re = 0, $e = U[0], Me = U[1], Oe = U[2], ze = U[3], De = U[4], je = U[5], Ue = U[6], _e = U[7], Ze = U[8], ot = U[9], ke = U[10], rt = U[11], nt = U[12], Ge = U[13], ht = U[14], lt = U[15]; - R = $[0], J += R * $e, ne += R * Me, K += R * Oe, E += R * ze, b += R * De, l += R * je, p += R * Ue, m += R * _e, w += R * Ze, P += R * ot, _ += R * ke, y += R * rt, M += R * nt, I += R * Ge, q += R * ht, ce += R * lt, R = $[1], ne += R * $e, K += R * Me, E += R * Oe, b += R * ze, l += R * De, p += R * je, m += R * Ue, w += R * _e, P += R * Ze, _ += R * ot, y += R * ke, M += R * rt, I += R * nt, q += R * Ge, ce += R * ht, L += R * lt, R = $[2], K += R * $e, E += R * Me, b += R * Oe, l += R * ze, p += R * De, m += R * je, w += R * Ue, P += R * _e, _ += R * Ze, y += R * ot, M += R * ke, I += R * rt, q += R * nt, ce += R * Ge, L += R * ht, oe += R * lt, R = $[3], E += R * $e, b += R * Me, l += R * Oe, p += R * ze, m += R * De, w += R * je, P += R * Ue, _ += R * _e, y += R * Ze, M += R * ot, I += R * ke, q += R * rt, ce += R * nt, L += R * Ge, oe += R * ht, Q += R * lt, R = $[4], b += R * $e, l += R * Me, p += R * Oe, m += R * ze, w += R * De, P += R * je, _ += R * Ue, y += R * _e, M += R * Ze, I += R * ot, q += R * ke, ce += R * rt, L += R * nt, oe += R * Ge, Q += R * ht, X += R * lt, R = $[5], l += R * $e, p += R * Me, m += R * Oe, w += R * ze, P += R * De, _ += R * je, y += R * Ue, M += R * _e, I += R * Ze, q += R * ot, ce += R * ke, L += R * rt, oe += R * nt, Q += R * Ge, X += R * ht, ee += R * lt, R = $[6], p += R * $e, m += R * Me, w += R * Oe, P += R * ze, _ += R * De, y += R * je, M += R * Ue, I += R * _e, q += R * Ze, ce += R * ot, L += R * ke, oe += R * rt, Q += R * nt, X += R * Ge, ee += R * ht, O += R * lt, R = $[7], m += R * $e, w += R * Me, P += R * Oe, _ += R * ze, y += R * De, M += R * je, I += R * Ue, q += R * _e, ce += R * Ze, L += R * ot, oe += R * ke, Q += R * rt, X += R * nt, ee += R * Ge, O += R * ht, Z += R * lt, R = $[8], w += R * $e, P += R * Me, _ += R * Oe, y += R * ze, M += R * De, I += R * je, q += R * Ue, ce += R * _e, L += R * Ze, oe += R * ot, Q += R * ke, X += R * rt, ee += R * nt, O += R * Ge, Z += R * ht, re += R * lt, R = $[9], P += R * $e, _ += R * Me, y += R * Oe, M += R * ze, I += R * De, q += R * je, ce += R * Ue, L += R * _e, oe += R * Ze, Q += R * ot, X += R * ke, ee += R * rt, O += R * nt, Z += R * Ge, re += R * ht, he += R * lt, R = $[10], _ += R * $e, y += R * Me, M += R * Oe, I += R * ze, q += R * De, ce += R * je, L += R * Ue, oe += R * _e, Q += R * Ze, X += R * ot, ee += R * ke, O += R * rt, Z += R * nt, re += R * Ge, he += R * ht, ae += R * lt, R = $[11], y += R * $e, M += R * Me, I += R * Oe, q += R * ze, ce += R * De, L += R * je, oe += R * Ue, Q += R * _e, X += R * Ze, ee += R * ot, O += R * ke, Z += R * rt, re += R * nt, he += R * Ge, ae += R * ht, fe += R * lt, R = $[12], M += R * $e, I += R * Me, q += R * Oe, ce += R * ze, L += R * De, oe += R * je, Q += R * Ue, X += R * _e, ee += R * Ze, O += R * ot, Z += R * ke, re += R * rt, he += R * nt, ae += R * Ge, fe += R * ht, be += R * lt, R = $[13], I += R * $e, q += R * Me, ce += R * Oe, L += R * ze, oe += R * De, Q += R * je, X += R * Ue, ee += R * _e, O += R * Ze, Z += R * ot, re += R * ke, he += R * rt, ae += R * nt, fe += R * Ge, be += R * ht, Ae += R * lt, R = $[14], q += R * $e, ce += R * Me, L += R * Oe, oe += R * ze, Q += R * De, X += R * je, ee += R * Ue, O += R * _e, Z += R * Ze, re += R * ot, he += R * ke, ae += R * rt, fe += R * nt, be += R * Ge, Ae += R * ht, Te += R * lt, R = $[15], ce += R * $e, L += R * Me, oe += R * Oe, Q += R * ze, X += R * De, ee += R * je, O += R * Ue, Z += R * _e, re += R * Ze, he += R * ot, ae += R * ke, fe += R * rt, be += R * nt, Ae += R * Ge, Te += R * ht, Re += R * lt, J += 38 * L, ne += 38 * oe, K += 38 * Q, E += 38 * X, b += 38 * ee, l += 38 * O, p += 38 * Z, m += 38 * re, w += 38 * he, P += 38 * ae, _ += 38 * fe, y += 38 * be, M += 38 * Ae, I += 38 * Te, q += 38 * Re, W = 1, R = J + W + 65535, W = Math.floor(R / 65536), J = R - W * 65536, R = ne + W + 65535, W = Math.floor(R / 65536), ne = R - W * 65536, R = K + W + 65535, W = Math.floor(R / 65536), K = R - W * 65536, R = E + W + 65535, W = Math.floor(R / 65536), E = R - W * 65536, R = b + W + 65535, W = Math.floor(R / 65536), b = R - W * 65536, R = l + W + 65535, W = Math.floor(R / 65536), l = R - W * 65536, R = p + W + 65535, W = Math.floor(R / 65536), p = R - W * 65536, R = m + W + 65535, W = Math.floor(R / 65536), m = R - W * 65536, R = w + W + 65535, W = Math.floor(R / 65536), w = R - W * 65536, R = P + W + 65535, W = Math.floor(R / 65536), P = R - W * 65536, R = _ + W + 65535, W = Math.floor(R / 65536), _ = R - W * 65536, R = y + W + 65535, W = Math.floor(R / 65536), y = R - W * 65536, R = M + W + 65535, W = Math.floor(R / 65536), M = R - W * 65536, R = I + W + 65535, W = Math.floor(R / 65536), I = R - W * 65536, R = q + W + 65535, W = Math.floor(R / 65536), q = R - W * 65536, R = ce + W + 65535, W = Math.floor(R / 65536), ce = R - W * 65536, J += W - 1 + 37 * (W - 1), W = 1, R = J + W + 65535, W = Math.floor(R / 65536), J = R - W * 65536, R = ne + W + 65535, W = Math.floor(R / 65536), ne = R - W * 65536, R = K + W + 65535, W = Math.floor(R / 65536), K = R - W * 65536, R = E + W + 65535, W = Math.floor(R / 65536), E = R - W * 65536, R = b + W + 65535, W = Math.floor(R / 65536), b = R - W * 65536, R = l + W + 65535, W = Math.floor(R / 65536), l = R - W * 65536, R = p + W + 65535, W = Math.floor(R / 65536), p = R - W * 65536, R = m + W + 65535, W = Math.floor(R / 65536), m = R - W * 65536, R = w + W + 65535, W = Math.floor(R / 65536), w = R - W * 65536, R = P + W + 65535, W = Math.floor(R / 65536), P = R - W * 65536, R = _ + W + 65535, W = Math.floor(R / 65536), _ = R - W * 65536, R = y + W + 65535, W = Math.floor(R / 65536), y = R - W * 65536, R = M + W + 65535, W = Math.floor(R / 65536), M = R - W * 65536, R = I + W + 65535, W = Math.floor(R / 65536), I = R - W * 65536, R = q + W + 65535, W = Math.floor(R / 65536), q = R - W * 65536, R = ce + W + 65535, W = Math.floor(R / 65536), ce = R - W * 65536, J += W - 1 + 37 * (W - 1), B[0] = J, B[1] = ne, B[2] = K, B[3] = E, B[4] = b, B[5] = l, B[6] = p, B[7] = m, B[8] = w, B[9] = P, B[10] = _, B[11] = y, B[12] = M, B[13] = I, B[14] = q, B[15] = ce; + let C, W, J = 0, ne = 0, K = 0, E = 0, b = 0, l = 0, p = 0, m = 0, w = 0, P = 0, _ = 0, y = 0, M = 0, I = 0, q = 0, ce = 0, L = 0, oe = 0, Q = 0, X = 0, ee = 0, O = 0, Z = 0, re = 0, he = 0, ae = 0, fe = 0, be = 0, Ae = 0, Te = 0, Re = 0, $e = U[0], Me = U[1], Oe = U[2], ze = U[3], De = U[4], je = U[5], Ue = U[6], _e = U[7], Ze = U[8], ot = U[9], ke = U[10], rt = U[11], nt = U[12], Ge = U[13], ht = U[14], lt = U[15]; + C = $[0], J += C * $e, ne += C * Me, K += C * Oe, E += C * ze, b += C * De, l += C * je, p += C * Ue, m += C * _e, w += C * Ze, P += C * ot, _ += C * ke, y += C * rt, M += C * nt, I += C * Ge, q += C * ht, ce += C * lt, C = $[1], ne += C * $e, K += C * Me, E += C * Oe, b += C * ze, l += C * De, p += C * je, m += C * Ue, w += C * _e, P += C * Ze, _ += C * ot, y += C * ke, M += C * rt, I += C * nt, q += C * Ge, ce += C * ht, L += C * lt, C = $[2], K += C * $e, E += C * Me, b += C * Oe, l += C * ze, p += C * De, m += C * je, w += C * Ue, P += C * _e, _ += C * Ze, y += C * ot, M += C * ke, I += C * rt, q += C * nt, ce += C * Ge, L += C * ht, oe += C * lt, C = $[3], E += C * $e, b += C * Me, l += C * Oe, p += C * ze, m += C * De, w += C * je, P += C * Ue, _ += C * _e, y += C * Ze, M += C * ot, I += C * ke, q += C * rt, ce += C * nt, L += C * Ge, oe += C * ht, Q += C * lt, C = $[4], b += C * $e, l += C * Me, p += C * Oe, m += C * ze, w += C * De, P += C * je, _ += C * Ue, y += C * _e, M += C * Ze, I += C * ot, q += C * ke, ce += C * rt, L += C * nt, oe += C * Ge, Q += C * ht, X += C * lt, C = $[5], l += C * $e, p += C * Me, m += C * Oe, w += C * ze, P += C * De, _ += C * je, y += C * Ue, M += C * _e, I += C * Ze, q += C * ot, ce += C * ke, L += C * rt, oe += C * nt, Q += C * Ge, X += C * ht, ee += C * lt, C = $[6], p += C * $e, m += C * Me, w += C * Oe, P += C * ze, _ += C * De, y += C * je, M += C * Ue, I += C * _e, q += C * Ze, ce += C * ot, L += C * ke, oe += C * rt, Q += C * nt, X += C * Ge, ee += C * ht, O += C * lt, C = $[7], m += C * $e, w += C * Me, P += C * Oe, _ += C * ze, y += C * De, M += C * je, I += C * Ue, q += C * _e, ce += C * Ze, L += C * ot, oe += C * ke, Q += C * rt, X += C * nt, ee += C * Ge, O += C * ht, Z += C * lt, C = $[8], w += C * $e, P += C * Me, _ += C * Oe, y += C * ze, M += C * De, I += C * je, q += C * Ue, ce += C * _e, L += C * Ze, oe += C * ot, Q += C * ke, X += C * rt, ee += C * nt, O += C * Ge, Z += C * ht, re += C * lt, C = $[9], P += C * $e, _ += C * Me, y += C * Oe, M += C * ze, I += C * De, q += C * je, ce += C * Ue, L += C * _e, oe += C * Ze, Q += C * ot, X += C * ke, ee += C * rt, O += C * nt, Z += C * Ge, re += C * ht, he += C * lt, C = $[10], _ += C * $e, y += C * Me, M += C * Oe, I += C * ze, q += C * De, ce += C * je, L += C * Ue, oe += C * _e, Q += C * Ze, X += C * ot, ee += C * ke, O += C * rt, Z += C * nt, re += C * Ge, he += C * ht, ae += C * lt, C = $[11], y += C * $e, M += C * Me, I += C * Oe, q += C * ze, ce += C * De, L += C * je, oe += C * Ue, Q += C * _e, X += C * Ze, ee += C * ot, O += C * ke, Z += C * rt, re += C * nt, he += C * Ge, ae += C * ht, fe += C * lt, C = $[12], M += C * $e, I += C * Me, q += C * Oe, ce += C * ze, L += C * De, oe += C * je, Q += C * Ue, X += C * _e, ee += C * Ze, O += C * ot, Z += C * ke, re += C * rt, he += C * nt, ae += C * Ge, fe += C * ht, be += C * lt, C = $[13], I += C * $e, q += C * Me, ce += C * Oe, L += C * ze, oe += C * De, Q += C * je, X += C * Ue, ee += C * _e, O += C * Ze, Z += C * ot, re += C * ke, he += C * rt, ae += C * nt, fe += C * Ge, be += C * ht, Ae += C * lt, C = $[14], q += C * $e, ce += C * Me, L += C * Oe, oe += C * ze, Q += C * De, X += C * je, ee += C * Ue, O += C * _e, Z += C * Ze, re += C * ot, he += C * ke, ae += C * rt, fe += C * nt, be += C * Ge, Ae += C * ht, Te += C * lt, C = $[15], ce += C * $e, L += C * Me, oe += C * Oe, Q += C * ze, X += C * De, ee += C * je, O += C * Ue, Z += C * _e, re += C * Ze, he += C * ot, ae += C * ke, fe += C * rt, be += C * nt, Ae += C * Ge, Te += C * ht, Re += C * lt, J += 38 * L, ne += 38 * oe, K += 38 * Q, E += 38 * X, b += 38 * ee, l += 38 * O, p += 38 * Z, m += 38 * re, w += 38 * he, P += 38 * ae, _ += 38 * fe, y += 38 * be, M += 38 * Ae, I += 38 * Te, q += 38 * Re, W = 1, C = J + W + 65535, W = Math.floor(C / 65536), J = C - W * 65536, C = ne + W + 65535, W = Math.floor(C / 65536), ne = C - W * 65536, C = K + W + 65535, W = Math.floor(C / 65536), K = C - W * 65536, C = E + W + 65535, W = Math.floor(C / 65536), E = C - W * 65536, C = b + W + 65535, W = Math.floor(C / 65536), b = C - W * 65536, C = l + W + 65535, W = Math.floor(C / 65536), l = C - W * 65536, C = p + W + 65535, W = Math.floor(C / 65536), p = C - W * 65536, C = m + W + 65535, W = Math.floor(C / 65536), m = C - W * 65536, C = w + W + 65535, W = Math.floor(C / 65536), w = C - W * 65536, C = P + W + 65535, W = Math.floor(C / 65536), P = C - W * 65536, C = _ + W + 65535, W = Math.floor(C / 65536), _ = C - W * 65536, C = y + W + 65535, W = Math.floor(C / 65536), y = C - W * 65536, C = M + W + 65535, W = Math.floor(C / 65536), M = C - W * 65536, C = I + W + 65535, W = Math.floor(C / 65536), I = C - W * 65536, C = q + W + 65535, W = Math.floor(C / 65536), q = C - W * 65536, C = ce + W + 65535, W = Math.floor(C / 65536), ce = C - W * 65536, J += W - 1 + 37 * (W - 1), W = 1, C = J + W + 65535, W = Math.floor(C / 65536), J = C - W * 65536, C = ne + W + 65535, W = Math.floor(C / 65536), ne = C - W * 65536, C = K + W + 65535, W = Math.floor(C / 65536), K = C - W * 65536, C = E + W + 65535, W = Math.floor(C / 65536), E = C - W * 65536, C = b + W + 65535, W = Math.floor(C / 65536), b = C - W * 65536, C = l + W + 65535, W = Math.floor(C / 65536), l = C - W * 65536, C = p + W + 65535, W = Math.floor(C / 65536), p = C - W * 65536, C = m + W + 65535, W = Math.floor(C / 65536), m = C - W * 65536, C = w + W + 65535, W = Math.floor(C / 65536), w = C - W * 65536, C = P + W + 65535, W = Math.floor(C / 65536), P = C - W * 65536, C = _ + W + 65535, W = Math.floor(C / 65536), _ = C - W * 65536, C = y + W + 65535, W = Math.floor(C / 65536), y = C - W * 65536, C = M + W + 65535, W = Math.floor(C / 65536), M = C - W * 65536, C = I + W + 65535, W = Math.floor(C / 65536), I = C - W * 65536, C = q + W + 65535, W = Math.floor(C / 65536), q = C - W * 65536, C = ce + W + 65535, W = Math.floor(C / 65536), ce = C - W * 65536, J += W - 1 + 37 * (W - 1), B[0] = J, B[1] = ne, B[2] = K, B[3] = E, B[4] = b, B[5] = l, B[6] = p, B[7] = m, B[8] = w, B[9] = P, B[10] = _, B[11] = y, B[12] = M, B[13] = I, B[14] = q, B[15] = ce; } function x(B, $) { v(B, $, $); } function S(B, $) { const U = n(); - for (let R = 0; R < 16; R++) - U[R] = $[R]; - for (let R = 253; R >= 0; R--) - x(U, U), R !== 2 && R !== 4 && v(U, U, $); - for (let R = 0; R < 16; R++) - B[R] = U[R]; - } - function C(B, $) { - const U = new Uint8Array(32), R = new Float64Array(80), W = n(), J = n(), ne = n(), K = n(), E = n(), b = n(); + for (let C = 0; C < 16; C++) + U[C] = $[C]; + for (let C = 253; C >= 0; C--) + x(U, U), C !== 2 && C !== 4 && v(U, U, $); + for (let C = 0; C < 16; C++) + B[C] = U[C]; + } + function R(B, $) { + const U = new Uint8Array(32), C = new Float64Array(80), W = n(), J = n(), ne = n(), K = n(), E = n(), b = n(); for (let w = 0; w < 31; w++) U[w] = B[w]; - U[31] = B[31] & 127 | 64, U[0] &= 248, u(R, $); + U[31] = B[31] & 127 | 64, U[0] &= 248, u(C, $); for (let w = 0; w < 16; w++) - J[w] = R[w]; + J[w] = C[w]; W[0] = K[0] = 1; for (let w = 254; w >= 0; --w) { const P = U[w >>> 3] >>> (w & 7) & 1; - a(W, J, P), a(ne, K, P), h(E, W, ne), g(W, W, ne), h(ne, J, K), g(J, J, K), x(K, E), x(b, W), v(W, ne, W), v(ne, J, E), h(E, W, ne), g(W, W, ne), x(J, W), g(ne, K, b), v(W, ne, s), h(W, W, K), v(ne, ne, W), v(W, K, b), v(K, J, R), x(J, E), a(W, J, P), a(ne, K, P); + a(W, J, P), a(ne, K, P), h(E, W, ne), g(W, W, ne), h(ne, J, K), g(J, J, K), x(K, E), x(b, W), v(W, ne, W), v(ne, J, E), h(E, W, ne), g(W, W, ne), x(J, W), g(ne, K, b), v(W, ne, s), h(W, W, K), v(ne, ne, W), v(W, K, b), v(K, J, C), x(J, E), a(W, J, P), a(ne, K, P); } for (let w = 0; w < 16; w++) - R[w + 16] = W[w], R[w + 32] = ne[w], R[w + 48] = J[w], R[w + 64] = K[w]; - const l = R.subarray(32), p = R.subarray(16); + C[w + 16] = W[w], C[w + 32] = ne[w], C[w + 48] = J[w], C[w + 64] = K[w]; + const l = C.subarray(32), p = C.subarray(16); S(l, l), v(p, p, l); const m = new Uint8Array(32); return f(m, p), m; } - t.scalarMult = C; + t.scalarMult = R; function D(B) { - return C(B, i); + return R(B, i); } t.scalarMultBase = D; function k(B) { @@ -13683,15 +13683,15 @@ function iF() { throw new Error("X25519: incorrect secret key length"); if ($.length !== t.PUBLIC_KEY_LENGTH) throw new Error("X25519: incorrect public key length"); - const R = C(B, $); + const C = R(B, $); if (U) { let W = 0; - for (let J = 0; J < R.length; J++) - W |= R[J]; + for (let J = 0; J < C.length; J++) + W |= C[J]; if (W === 0) throw new Error("X25519: invalid shared key"); } - return R; + return C; } t.sharedKey = z; })(Cg)), Cg; @@ -14132,7 +14132,7 @@ function go() { } return _ !== 0 ? b.words[y] = _ | 0 : b.length--, b.strip(); } - var C = function(E, b, l) { + var R = function(E, b, l) { var p = E.words, m = b.words, w = l.words, P = 0, _, y, M, I = p[0] | 0, q = I & 8191, ce = I >>> 13, L = p[1] | 0, oe = L & 8191, Q = L >>> 13, X = p[2] | 0, ee = X & 8191, O = X >>> 13, Z = p[3] | 0, re = Z & 8191, he = Z >>> 13, ae = p[4] | 0, fe = ae & 8191, be = ae >>> 13, Ae = p[5] | 0, Te = Ae & 8191, Re = Ae >>> 13, $e = p[6] | 0, Me = $e & 8191, Oe = $e >>> 13, ze = p[7] | 0, De = ze & 8191, je = ze >>> 13, Ue = p[8] | 0, _e = Ue & 8191, Ze = Ue >>> 13, ot = p[9] | 0, ke = ot & 8191, rt = ot >>> 13, nt = m[0] | 0, Ge = nt & 8191, ht = nt >>> 13, lt = m[1] | 0, ct = lt & 8191, qt = lt >>> 13, Gt = m[2] | 0, Et = Gt & 8191, Yt = Gt >>> 13, tr = m[3] | 0, Tt = tr & 8191, kt = tr >>> 13, It = m[4] | 0, dt = It & 8191, Dt = It >>> 13, Nt = m[5] | 0, mt = Nt & 8191, Bt = Nt >>> 13, Ft = m[6] | 0, et = Ft & 8191, $t = Ft >>> 13, H = m[7] | 0, V = H & 8191, Y = H >>> 13, T = m[8] | 0, F = T & 8191, ie = T >>> 13, le = m[9] | 0, me = le & 8191, Ee = le >>> 13; l.negative = E.negative ^ b.negative, l.length = 19, _ = Math.imul(q, Ge), y = Math.imul(q, ht), y = y + Math.imul(ce, Ge) | 0, M = Math.imul(ce, ht); var Le = (P + _ | 0) + ((y & 8191) << 13) | 0; @@ -14174,7 +14174,7 @@ function go() { var Pe = (P + _ | 0) + ((y & 8191) << 13) | 0; return P = (M + (y >>> 13) | 0) + (Pe >>> 26) | 0, Pe &= 67108863, w[0] = Le, w[1] = Ie, w[2] = Qe, w[3] = Xe, w[4] = tt, w[5] = st, w[6] = vt, w[7] = Ct, w[8] = Mt, w[9] = wt, w[10] = Rt, w[11] = gt, w[12] = _t, w[13] = at, w[14] = yt, w[15] = ut, w[16] = it, w[17] = Se, w[18] = Pe, P !== 0 && (w[19] = P, l.length++), l; }; - Math.imul || (C = S); + Math.imul || (R = S); function D(K, E, b) { b.negative = E.negative ^ K.negative, b.length = K.length + E.length; for (var l = 0, p = 0, m = 0; m < b.length - 1; m++) { @@ -14194,7 +14194,7 @@ function go() { } s.prototype.mulTo = function(E, b) { var l, p = this.length + E.length; - return this.length === 10 && E.length === 10 ? l = C(this, E, b) : p < 63 ? l = S(this, E, b) : p < 1024 ? l = D(this, E, b) : l = k(this, E, b), l; + return this.length === 10 && E.length === 10 ? l = R(this, E, b) : p < 63 ? l = S(this, E, b) : p < 1024 ? l = D(this, E, b) : l = k(this, E, b), l; }; function N(K, E) { this.x = K, this.y = E; @@ -14696,14 +14696,14 @@ function go() { ); } i(U, B); - function R() { + function C() { B.call( this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff" ); } - i(R, B); + i(C, B); function W() { B.call( this, @@ -14725,7 +14725,7 @@ function go() { else if (E === "p224") b = new U(); else if (E === "p192") - b = new R(); + b = new C(); else if (E === "p25519") b = new W(); else @@ -14903,10 +14903,10 @@ function Gi() { var x = new Array(Math.max(h.bitLength(), v) + 1), S; for (S = 0; S < x.length; S += 1) x[S] = 0; - var C = 1 << g + 1, D = h.clone(); + var R = 1 << g + 1, D = h.clone(); for (S = 0; S < x.length; S++) { - var k, N = D.andln(C - 1); - D.isOdd() ? (N > (C >> 1) - 1 ? k = (C >> 1) - N : k = N, D.isubn(k)) : k = 0, x[S] = k, D.iushrn(1); + var k, N = D.andln(R - 1); + D.isOdd() ? (N > (R >> 1) - 1 ? k = (R >> 1) - N : k = N, D.isubn(k)) : k = 0, x[S] = k, D.iushrn(1); } return x; } @@ -14917,13 +14917,13 @@ function Gi() { [] ]; h = h.clone(), g = g.clone(); - for (var x = 0, S = 0, C; h.cmpn(-x) > 0 || g.cmpn(-S) > 0; ) { + for (var x = 0, S = 0, R; h.cmpn(-x) > 0 || g.cmpn(-S) > 0; ) { var D = h.andln(3) + x & 3, k = g.andln(3) + S & 3; D === 3 && (D = -1), k === 3 && (k = -1); var N; - (D & 1) === 0 ? N = 0 : (C = h.andln(7) + x & 7, (C === 3 || C === 5) && k === 2 ? N = -D : N = D), v[0].push(N); + (D & 1) === 0 ? N = 0 : (R = h.andln(7) + x & 7, (R === 3 || R === 5) && k === 2 ? N = -D : N = D), v[0].push(N); var z; - (k & 1) === 0 ? z = 0 : (C = g.andln(7) + S & 7, (C === 3 || C === 5) && D === 2 ? z = -k : z = k), v[1].push(z), 2 * x === N + 1 && (x = 1 - x), 2 * S === z + 1 && (S = 1 - S), h.iushrn(1), g.iushrn(1); + (k & 1) === 0 ? z = 0 : (R = g.andln(7) + S & 7, (R === 3 || R === 5) && D === 2 ? z = -k : z = k), v[1].push(z), 2 * x === N + 1 && (x = 1 - x), 2 * S === z + 1 && (S = 1 - S), h.iushrn(1), g.iushrn(1); } return v; } @@ -15004,33 +15004,33 @@ function t0() { i(f.precomputed); var h = f._getDoubles(), g = r(u, 1, this._bitLength), v = (1 << h.step + 1) - (h.step % 2 === 0 ? 2 : 1); v /= 3; - var x = [], S, C; + var x = [], S, R; for (S = 0; S < g.length; S += h.step) { - C = 0; + R = 0; for (var D = S + h.step - 1; D >= S; D--) - C = (C << 1) + g[D]; - x.push(C); + R = (R << 1) + g[D]; + x.push(R); } for (var k = this.jpoint(null, null, null), N = this.jpoint(null, null, null), z = v; z > 0; z--) { for (S = 0; S < x.length; S++) - C = x[S], C === z ? N = N.mixedAdd(h.points[S]) : C === -z && (N = N.mixedAdd(h.points[S].neg())); + R = x[S], R === z ? N = N.mixedAdd(h.points[S]) : R === -z && (N = N.mixedAdd(h.points[S].neg())); k = k.add(N); } return k.toP(); }, s.prototype._wnafMul = function(f, u) { var h = 4, g = f._getNAFPoints(h); h = g.wnd; - for (var v = g.points, x = r(u, h, this._bitLength), S = this.jpoint(null, null, null), C = x.length - 1; C >= 0; C--) { - for (var D = 0; C >= 0 && x[C] === 0; C--) + for (var v = g.points, x = r(u, h, this._bitLength), S = this.jpoint(null, null, null), R = x.length - 1; R >= 0; R--) { + for (var D = 0; R >= 0 && x[R] === 0; R--) D++; - if (C >= 0 && D++, S = S.dblp(D), C < 0) + if (R >= 0 && D++, S = S.dblp(D), R < 0) break; - var k = x[C]; + var k = x[R]; i(k !== 0), f.type === "affine" ? k > 0 ? S = S.mixedAdd(v[k - 1 >> 1]) : S = S.mixedAdd(v[-k - 1 >> 1].neg()) : k > 0 ? S = S.add(v[k - 1 >> 1]) : S = S.add(v[-k - 1 >> 1].neg()); } return f.type === "affine" ? S.toP() : S; }, s.prototype._wnafMulAdd = function(f, u, h, g, v) { - var x = this._wnafT1, S = this._wnafT2, C = this._wnafT3, D = 0, k, N, z; + var x = this._wnafT1, S = this._wnafT2, R = this._wnafT3, D = 0, k, N, z; for (k = 0; k < g; k++) { z = u[k]; var B = z._getNAFPoints(f); @@ -15039,10 +15039,10 @@ function t0() { for (k = g - 1; k >= 1; k -= 2) { var $ = k - 1, U = k; if (x[$] !== 1 || x[U] !== 1) { - C[$] = r(h[$], x[$], this._bitLength), C[U] = r(h[U], x[U], this._bitLength), D = Math.max(C[$].length, D), D = Math.max(C[U].length, D); + R[$] = r(h[$], x[$], this._bitLength), R[U] = r(h[U], x[U], this._bitLength), D = Math.max(R[$].length, D), D = Math.max(R[U].length, D); continue; } - var R = [ + var C = [ u[$], /* 1 */ null, @@ -15052,7 +15052,7 @@ function t0() { u[U] /* 7 */ ]; - u[$].y.cmp(u[U].y) === 0 ? (R[1] = u[$].add(u[U]), R[2] = u[$].toJ().mixedAdd(u[U].neg())) : u[$].y.cmp(u[U].y.redNeg()) === 0 ? (R[1] = u[$].toJ().mixedAdd(u[U]), R[2] = u[$].add(u[U].neg())) : (R[1] = u[$].toJ().mixedAdd(u[U]), R[2] = u[$].toJ().mixedAdd(u[U].neg())); + u[$].y.cmp(u[U].y) === 0 ? (C[1] = u[$].add(u[U]), C[2] = u[$].toJ().mixedAdd(u[U].neg())) : u[$].y.cmp(u[U].y.redNeg()) === 0 ? (C[1] = u[$].toJ().mixedAdd(u[U]), C[2] = u[$].add(u[U].neg())) : (C[1] = u[$].toJ().mixedAdd(u[U]), C[2] = u[$].toJ().mixedAdd(u[U].neg())); var W = [ -3, /* -1 -1 */ @@ -15073,9 +15073,9 @@ function t0() { 3 /* 1 1 */ ], J = n(h[$], h[U]); - for (D = Math.max(J[0].length, D), C[$] = new Array(D), C[U] = new Array(D), N = 0; N < D; N++) { + for (D = Math.max(J[0].length, D), R[$] = new Array(D), R[U] = new Array(D), N = 0; N < D; N++) { var ne = J[0][N] | 0, K = J[1][N] | 0; - C[$][N] = W[(ne + 1) * 3 + (K + 1)], C[U][N] = 0, S[$] = R; + R[$][N] = W[(ne + 1) * 3 + (K + 1)], R[U][N] = 0, S[$] = C; } } var E = this.jpoint(null, null, null), b = this._wnafT4; @@ -15083,7 +15083,7 @@ function t0() { for (var l = 0; k >= 0; ) { var p = !0; for (N = 0; N < g; N++) - b[N] = C[N][k] | 0, b[N] !== 0 && (p = !1); + b[N] = R[N][k] | 0, b[N] !== 0 && (p = !1); if (!p) break; l++, k--; @@ -15193,10 +15193,10 @@ function cF() { this.g.mul(x[0]).x.cmp(this.g.x.redMul(h)) === 0 ? g = x[0] : (g = x[1], i(this.g.mul(g).x.cmp(this.g.x.redMul(h)) === 0)); } var S; - return u.basis ? S = u.basis.map(function(C) { + return u.basis ? S = u.basis.map(function(R) { return { - a: new e(C.a, 16), - b: new e(C.b, 16) + a: new e(R.a, 16), + b: new e(R.b, 16) }; }) : S = this._getEndoBasis(g), { beta: h, @@ -15205,18 +15205,18 @@ function cF() { }; } }, s.prototype._getEndoRoots = function(u) { - var h = u === this.p ? this.red : e.mont(u), g = new e(2).toRed(h).redInvm(), v = g.redNeg(), x = new e(3).toRed(h).redNeg().redSqrt().redMul(g), S = v.redAdd(x).fromRed(), C = v.redSub(x).fromRed(); - return [S, C]; + var h = u === this.p ? this.red : e.mont(u), g = new e(2).toRed(h).redInvm(), v = g.redNeg(), x = new e(3).toRed(h).redNeg().redSqrt().redMul(g), S = v.redAdd(x).fromRed(), R = v.redSub(x).fromRed(); + return [S, R]; }, s.prototype._getEndoBasis = function(u) { - for (var h = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), g = u, v = this.n.clone(), x = new e(1), S = new e(0), C = new e(0), D = new e(1), k, N, z, B, $, U, R, W = 0, J, ne; g.cmpn(0) !== 0; ) { + for (var h = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), g = u, v = this.n.clone(), x = new e(1), S = new e(0), R = new e(0), D = new e(1), k, N, z, B, $, U, C, W = 0, J, ne; g.cmpn(0) !== 0; ) { var K = v.div(g); - J = v.sub(K.mul(g)), ne = C.sub(K.mul(x)); + J = v.sub(K.mul(g)), ne = R.sub(K.mul(x)); var E = D.sub(K.mul(S)); if (!z && J.cmp(h) < 0) - k = R.neg(), N = x, z = J.neg(), B = ne; + k = C.neg(), N = x, z = J.neg(), B = ne; else if (z && ++W === 2) break; - R = J, v = g, g = J, C = x, x = ne, D = S, S = E; + C = J, v = g, g = J, R = x, x = ne, D = S, S = E; } $ = J.neg(), U = ne; var b = z.sqr().add(B.sqr()), l = $.sqr().add(U.sqr()); @@ -15225,7 +15225,7 @@ function cF() { { a: $, b: U } ]; }, s.prototype._endoSplit = function(u) { - var h = this.endo.basis, g = h[0], v = h[1], x = v.b.mul(u).divRound(this.n), S = g.b.neg().mul(u).divRound(this.n), C = x.mul(g.a), D = S.mul(v.a), k = x.mul(g.b), N = S.mul(v.b), z = u.sub(C).sub(D), B = k.add(N).neg(); + var h = this.endo.basis, g = h[0], v = h[1], x = v.b.mul(u).divRound(this.n), S = g.b.neg().mul(u).divRound(this.n), R = x.mul(g.a), D = S.mul(v.a), k = x.mul(g.b), N = S.mul(v.b), z = u.sub(R).sub(D), B = k.add(N).neg(); return { k1: z, k2: B }; }, s.prototype.pointFromX = function(u, h) { u = new e(u, 16), u.red || (u = u.toRed(this.red)); @@ -15241,8 +15241,8 @@ function cF() { return g.redSqr().redISub(x).cmpn(0) === 0; }, s.prototype._endoWnafMulAdd = function(u, h, g) { for (var v = this._endoWnafT1, x = this._endoWnafT2, S = 0; S < u.length; S++) { - var C = this._endoSplit(h[S]), D = u[S], k = D._getBeta(); - C.k1.negative && (C.k1.ineg(), D = D.neg(!0)), C.k2.negative && (C.k2.ineg(), k = k.neg(!0)), v[S * 2] = D, v[S * 2 + 1] = k, x[S * 2] = C.k1, x[S * 2 + 1] = C.k2; + var R = this._endoSplit(h[S]), D = u[S], k = D._getBeta(); + R.k1.negative && (R.k1.ineg(), D = D.neg(!0)), R.k2.negative && (R.k2.ineg(), k = k.neg(!0)), v[S * 2] = D, v[S * 2 + 1] = k, x[S * 2] = R.k1, x[S * 2 + 1] = R.k2; } for (var N = this._wnafMulAdd(1, v, x, S * 2, g), z = 0; z < S * 2; z++) v[z] = null, x[z] = null; @@ -15295,8 +15295,8 @@ function cF() { var v = u.point(h[0], h[1], g); if (!h[2]) return v; - function x(C) { - return u.point(C[0], C[1], g); + function x(R) { + return u.point(R[0], R[1], g); } var S = h[2]; return v.precomputed = { @@ -15335,8 +15335,8 @@ function cF() { var u = this.y.redAdd(this.y); if (u.cmpn(0) === 0) return this.curve.point(null, null); - var h = this.curve.a, g = this.x.redSqr(), v = u.redInvm(), x = g.redAdd(g).redIAdd(g).redIAdd(h).redMul(v), S = x.redSqr().redISub(this.x.redAdd(this.x)), C = x.redMul(this.x.redSub(S)).redISub(this.y); - return this.curve.point(S, C); + var h = this.curve.a, g = this.x.redSqr(), v = u.redInvm(), x = g.redAdd(g).redIAdd(g).redIAdd(h).redMul(v), S = x.redSqr().redISub(this.x.redAdd(this.x)), R = x.redMul(this.x.redSub(S)).redISub(this.y); + return this.curve.point(S, R); }, o.prototype.getX = function() { return this.x.fromRed(); }, o.prototype.getY = function() { @@ -15394,20 +15394,20 @@ function cF() { return u; if (u.isInfinity()) return this; - var h = u.z.redSqr(), g = this.z.redSqr(), v = this.x.redMul(h), x = u.x.redMul(g), S = this.y.redMul(h.redMul(u.z)), C = u.y.redMul(g.redMul(this.z)), D = v.redSub(x), k = S.redSub(C); + var h = u.z.redSqr(), g = this.z.redSqr(), v = this.x.redMul(h), x = u.x.redMul(g), S = this.y.redMul(h.redMul(u.z)), R = u.y.redMul(g.redMul(this.z)), D = v.redSub(x), k = S.redSub(R); if (D.cmpn(0) === 0) return k.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var N = D.redSqr(), z = N.redMul(D), B = v.redMul(N), $ = k.redSqr().redIAdd(z).redISub(B).redISub(B), U = k.redMul(B.redISub($)).redISub(S.redMul(z)), R = this.z.redMul(u.z).redMul(D); - return this.curve.jpoint($, U, R); + var N = D.redSqr(), z = N.redMul(D), B = v.redMul(N), $ = k.redSqr().redIAdd(z).redISub(B).redISub(B), U = k.redMul(B.redISub($)).redISub(S.redMul(z)), C = this.z.redMul(u.z).redMul(D); + return this.curve.jpoint($, U, C); }, a.prototype.mixedAdd = function(u) { if (this.isInfinity()) return u.toJ(); if (u.isInfinity()) return this; - var h = this.z.redSqr(), g = this.x, v = u.x.redMul(h), x = this.y, S = u.y.redMul(h).redMul(this.z), C = g.redSub(v), D = x.redSub(S); - if (C.cmpn(0) === 0) + var h = this.z.redSqr(), g = this.x, v = u.x.redMul(h), x = this.y, S = u.y.redMul(h).redMul(this.z), R = g.redSub(v), D = x.redSub(S); + if (R.cmpn(0) === 0) return D.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl(); - var k = C.redSqr(), N = k.redMul(C), z = g.redMul(k), B = D.redSqr().redIAdd(N).redISub(z).redISub(z), $ = D.redMul(z.redISub(B)).redISub(x.redMul(N)), U = this.z.redMul(C); + var k = R.redSqr(), N = k.redMul(R), z = g.redMul(k), B = D.redSqr().redIAdd(N).redISub(z).redISub(z), $ = D.redMul(z.redISub(B)).redISub(x.redMul(N)), U = this.z.redMul(R); return this.curve.jpoint(B, $, U); }, a.prototype.dblp = function(u) { if (u === 0) @@ -15423,9 +15423,9 @@ function cF() { g = g.dbl(); return g; } - var v = this.curve.a, x = this.curve.tinv, S = this.x, C = this.y, D = this.z, k = D.redSqr().redSqr(), N = C.redAdd(C); + var v = this.curve.a, x = this.curve.tinv, S = this.x, R = this.y, D = this.z, k = D.redSqr().redSqr(), N = R.redAdd(R); for (h = 0; h < u; h++) { - var z = S.redSqr(), B = N.redSqr(), $ = B.redSqr(), U = z.redAdd(z).redIAdd(z).redIAdd(v.redMul(k)), R = S.redMul(B), W = U.redSqr().redISub(R.redAdd(R)), J = R.redISub(W), ne = U.redMul(J); + var z = S.redSqr(), B = N.redSqr(), $ = B.redSqr(), U = z.redAdd(z).redIAdd(z).redIAdd(v.redMul(k)), C = S.redMul(B), W = U.redSqr().redISub(C.redAdd(C)), J = C.redISub(W), ne = U.redMul(J); ne = ne.redIAdd(ne).redISub($); var K = N.redMul(D); h + 1 < u && (k = k.redMul($)), S = W, D = K, N = ne; @@ -15436,58 +15436,58 @@ function cF() { }, a.prototype._zeroDbl = function() { var u, h, g; if (this.zOne) { - var v = this.x.redSqr(), x = this.y.redSqr(), S = x.redSqr(), C = this.x.redAdd(x).redSqr().redISub(v).redISub(S); - C = C.redIAdd(C); - var D = v.redAdd(v).redIAdd(v), k = D.redSqr().redISub(C).redISub(C), N = S.redIAdd(S); - N = N.redIAdd(N), N = N.redIAdd(N), u = k, h = D.redMul(C.redISub(k)).redISub(N), g = this.y.redAdd(this.y); + var v = this.x.redSqr(), x = this.y.redSqr(), S = x.redSqr(), R = this.x.redAdd(x).redSqr().redISub(v).redISub(S); + R = R.redIAdd(R); + var D = v.redAdd(v).redIAdd(v), k = D.redSqr().redISub(R).redISub(R), N = S.redIAdd(S); + N = N.redIAdd(N), N = N.redIAdd(N), u = k, h = D.redMul(R.redISub(k)).redISub(N), g = this.y.redAdd(this.y); } else { var z = this.x.redSqr(), B = this.y.redSqr(), $ = B.redSqr(), U = this.x.redAdd(B).redSqr().redISub(z).redISub($); U = U.redIAdd(U); - var R = z.redAdd(z).redIAdd(z), W = R.redSqr(), J = $.redIAdd($); - J = J.redIAdd(J), J = J.redIAdd(J), u = W.redISub(U).redISub(U), h = R.redMul(U.redISub(u)).redISub(J), g = this.y.redMul(this.z), g = g.redIAdd(g); + var C = z.redAdd(z).redIAdd(z), W = C.redSqr(), J = $.redIAdd($); + J = J.redIAdd(J), J = J.redIAdd(J), u = W.redISub(U).redISub(U), h = C.redMul(U.redISub(u)).redISub(J), g = this.y.redMul(this.z), g = g.redIAdd(g); } return this.curve.jpoint(u, h, g); }, a.prototype._threeDbl = function() { var u, h, g; if (this.zOne) { - var v = this.x.redSqr(), x = this.y.redSqr(), S = x.redSqr(), C = this.x.redAdd(x).redSqr().redISub(v).redISub(S); - C = C.redIAdd(C); - var D = v.redAdd(v).redIAdd(v).redIAdd(this.curve.a), k = D.redSqr().redISub(C).redISub(C); + var v = this.x.redSqr(), x = this.y.redSqr(), S = x.redSqr(), R = this.x.redAdd(x).redSqr().redISub(v).redISub(S); + R = R.redIAdd(R); + var D = v.redAdd(v).redIAdd(v).redIAdd(this.curve.a), k = D.redSqr().redISub(R).redISub(R); u = k; var N = S.redIAdd(S); - N = N.redIAdd(N), N = N.redIAdd(N), h = D.redMul(C.redISub(k)).redISub(N), g = this.y.redAdd(this.y); + N = N.redIAdd(N), N = N.redIAdd(N), h = D.redMul(R.redISub(k)).redISub(N), g = this.y.redAdd(this.y); } else { var z = this.z.redSqr(), B = this.y.redSqr(), $ = this.x.redMul(B), U = this.x.redSub(z).redMul(this.x.redAdd(z)); U = U.redAdd(U).redIAdd(U); - var R = $.redIAdd($); - R = R.redIAdd(R); - var W = R.redAdd(R); + var C = $.redIAdd($); + C = C.redIAdd(C); + var W = C.redAdd(C); u = U.redSqr().redISub(W), g = this.y.redAdd(this.z).redSqr().redISub(B).redISub(z); var J = B.redSqr(); - J = J.redIAdd(J), J = J.redIAdd(J), J = J.redIAdd(J), h = U.redMul(R.redISub(u)).redISub(J); + J = J.redIAdd(J), J = J.redIAdd(J), J = J.redIAdd(J), h = U.redMul(C.redISub(u)).redISub(J); } return this.curve.jpoint(u, h, g); }, a.prototype._dbl = function() { - var u = this.curve.a, h = this.x, g = this.y, v = this.z, x = v.redSqr().redSqr(), S = h.redSqr(), C = g.redSqr(), D = S.redAdd(S).redIAdd(S).redIAdd(u.redMul(x)), k = h.redAdd(h); + var u = this.curve.a, h = this.x, g = this.y, v = this.z, x = v.redSqr().redSqr(), S = h.redSqr(), R = g.redSqr(), D = S.redAdd(S).redIAdd(S).redIAdd(u.redMul(x)), k = h.redAdd(h); k = k.redIAdd(k); - var N = k.redMul(C), z = D.redSqr().redISub(N.redAdd(N)), B = N.redISub(z), $ = C.redSqr(); + var N = k.redMul(R), z = D.redSqr().redISub(N.redAdd(N)), B = N.redISub(z), $ = R.redSqr(); $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($); - var U = D.redMul(B).redISub($), R = g.redAdd(g).redMul(v); - return this.curve.jpoint(z, U, R); + var U = D.redMul(B).redISub($), C = g.redAdd(g).redMul(v); + return this.curve.jpoint(z, U, C); }, a.prototype.trpl = function() { if (!this.curve.zeroA) return this.dbl().add(this); - var u = this.x.redSqr(), h = this.y.redSqr(), g = this.z.redSqr(), v = h.redSqr(), x = u.redAdd(u).redIAdd(u), S = x.redSqr(), C = this.x.redAdd(h).redSqr().redISub(u).redISub(v); - C = C.redIAdd(C), C = C.redAdd(C).redIAdd(C), C = C.redISub(S); - var D = C.redSqr(), k = v.redIAdd(v); + var u = this.x.redSqr(), h = this.y.redSqr(), g = this.z.redSqr(), v = h.redSqr(), x = u.redAdd(u).redIAdd(u), S = x.redSqr(), R = this.x.redAdd(h).redSqr().redISub(u).redISub(v); + R = R.redIAdd(R), R = R.redAdd(R).redIAdd(R), R = R.redISub(S); + var D = R.redSqr(), k = v.redIAdd(v); k = k.redIAdd(k), k = k.redIAdd(k), k = k.redIAdd(k); - var N = x.redIAdd(C).redSqr().redISub(S).redISub(D).redISub(k), z = h.redMul(N); + var N = x.redIAdd(R).redSqr().redISub(S).redISub(D).redISub(k), z = h.redMul(N); z = z.redIAdd(z), z = z.redIAdd(z); var B = this.x.redMul(D).redISub(z); B = B.redIAdd(B), B = B.redIAdd(B); - var $ = this.y.redMul(N.redMul(k.redISub(N)).redISub(C.redMul(D))); + var $ = this.y.redMul(N.redMul(k.redISub(N)).redISub(R.redMul(D))); $ = $.redIAdd($), $ = $.redIAdd($), $ = $.redIAdd($); - var U = this.z.redAdd(C).redSqr().redISub(g).redISub(D); + var U = this.z.redAdd(R).redSqr().redISub(g).redISub(D); return this.curve.jpoint(B, $, U); }, a.prototype.mul = function(u, h) { return u = new e(u, h), this.curve._wnafMul(this, u); @@ -15553,8 +15553,8 @@ function uF() { }, s.prototype.add = function() { throw new Error("Not supported on Montgomery curve"); }, s.prototype.diffAdd = function(a, f) { - var u = this.x.redAdd(this.z), h = this.x.redSub(this.z), g = a.x.redAdd(a.z), v = a.x.redSub(a.z), x = v.redMul(u), S = g.redMul(h), C = f.z.redMul(x.redAdd(S).redSqr()), D = f.x.redMul(x.redISub(S).redSqr()); - return this.curve.point(C, D); + var u = this.x.redAdd(this.z), h = this.x.redSub(this.z), g = a.x.redAdd(a.z), v = a.x.redSub(a.z), x = v.redMul(u), S = g.redMul(h), R = f.z.redMul(x.redAdd(S).redSqr()), D = f.x.redMul(x.redISub(S).redSqr()); + return this.curve.point(R, D); }, s.prototype.mul = function(a) { for (var f = a.clone(), u = this, h = this.curve.point(null, null), g = this, v = []; f.cmpn(0) !== 0; f.iushrn(1)) v.push(f.andln(1)); @@ -15592,8 +15592,8 @@ function fF() { var h = f.redSqr(), g = this.c2.redSub(this.a.redMul(h)), v = this.one.redSub(this.c2.redMul(this.d).redMul(h)), x = g.redMul(v.redInvm()), S = x.redSqrt(); if (S.redSqr().redSub(x).cmp(this.zero) !== 0) throw new Error("invalid point"); - var C = S.fromRed().isOdd(); - return (u && !C || !u && C) && (S = S.redNeg()), this.point(f, S); + var R = S.fromRed().isOdd(); + return (u && !R || !u && R) && (S = S.redNeg()), this.point(f, S); }, s.prototype.pointFromY = function(f, u) { f = new e(f, 16), f.red || (f = f.toRed(this.red)); var h = f.redSqr(), g = h.redSub(this.c2), v = h.redMul(this.d).redMul(this.c2).redSub(this.a), x = g.redMul(v.redInvm()); @@ -15629,25 +15629,25 @@ function fF() { }, o.prototype._extDbl = function() { var f = this.x.redSqr(), u = this.y.redSqr(), h = this.z.redSqr(); h = h.redIAdd(h); - var g = this.curve._mulA(f), v = this.x.redAdd(this.y).redSqr().redISub(f).redISub(u), x = g.redAdd(u), S = x.redSub(h), C = g.redSub(u), D = v.redMul(S), k = x.redMul(C), N = v.redMul(C), z = S.redMul(x); + var g = this.curve._mulA(f), v = this.x.redAdd(this.y).redSqr().redISub(f).redISub(u), x = g.redAdd(u), S = x.redSub(h), R = g.redSub(u), D = v.redMul(S), k = x.redMul(R), N = v.redMul(R), z = S.redMul(x); return this.curve.point(D, k, z, N); }, o.prototype._projDbl = function() { - var f = this.x.redAdd(this.y).redSqr(), u = this.x.redSqr(), h = this.y.redSqr(), g, v, x, S, C, D; + var f = this.x.redAdd(this.y).redSqr(), u = this.x.redSqr(), h = this.y.redSqr(), g, v, x, S, R, D; if (this.curve.twisted) { S = this.curve._mulA(u); var k = S.redAdd(h); - this.zOne ? (g = f.redSub(u).redSub(h).redMul(k.redSub(this.curve.two)), v = k.redMul(S.redSub(h)), x = k.redSqr().redSub(k).redSub(k)) : (C = this.z.redSqr(), D = k.redSub(C).redISub(C), g = f.redSub(u).redISub(h).redMul(D), v = k.redMul(S.redSub(h)), x = k.redMul(D)); + this.zOne ? (g = f.redSub(u).redSub(h).redMul(k.redSub(this.curve.two)), v = k.redMul(S.redSub(h)), x = k.redSqr().redSub(k).redSub(k)) : (R = this.z.redSqr(), D = k.redSub(R).redISub(R), g = f.redSub(u).redISub(h).redMul(D), v = k.redMul(S.redSub(h)), x = k.redMul(D)); } else - S = u.redAdd(h), C = this.curve._mulC(this.z).redSqr(), D = S.redSub(C).redSub(C), g = this.curve._mulC(f.redISub(S)).redMul(D), v = this.curve._mulC(S).redMul(u.redISub(h)), x = S.redMul(D); + S = u.redAdd(h), R = this.curve._mulC(this.z).redSqr(), D = S.redSub(R).redSub(R), g = this.curve._mulC(f.redISub(S)).redMul(D), v = this.curve._mulC(S).redMul(u.redISub(h)), x = S.redMul(D); return this.curve.point(g, v, x); }, o.prototype.dbl = function() { return this.isInfinity() ? this : this.curve.extended ? this._extDbl() : this._projDbl(); }, o.prototype._extAdd = function(f) { - var u = this.y.redSub(this.x).redMul(f.y.redSub(f.x)), h = this.y.redAdd(this.x).redMul(f.y.redAdd(f.x)), g = this.t.redMul(this.curve.dd).redMul(f.t), v = this.z.redMul(f.z.redAdd(f.z)), x = h.redSub(u), S = v.redSub(g), C = v.redAdd(g), D = h.redAdd(u), k = x.redMul(S), N = C.redMul(D), z = x.redMul(D), B = S.redMul(C); + var u = this.y.redSub(this.x).redMul(f.y.redSub(f.x)), h = this.y.redAdd(this.x).redMul(f.y.redAdd(f.x)), g = this.t.redMul(this.curve.dd).redMul(f.t), v = this.z.redMul(f.z.redAdd(f.z)), x = h.redSub(u), S = v.redSub(g), R = v.redAdd(g), D = h.redAdd(u), k = x.redMul(S), N = R.redMul(D), z = x.redMul(D), B = S.redMul(R); return this.curve.point(k, N, B, z); }, o.prototype._projAdd = function(f) { - var u = this.z.redMul(f.z), h = u.redSqr(), g = this.x.redMul(f.x), v = this.y.redMul(f.y), x = this.curve.d.redMul(g).redMul(v), S = h.redSub(x), C = h.redAdd(x), D = this.x.redAdd(this.y).redMul(f.x.redAdd(f.y)).redISub(g).redISub(v), k = u.redMul(S).redMul(D), N, z; - return this.curve.twisted ? (N = u.redMul(C).redMul(v.redSub(this.curve._mulA(g))), z = S.redMul(C)) : (N = u.redMul(C).redMul(v.redSub(g)), z = this.curve._mulC(S).redMul(C)), this.curve.point(k, N, z); + var u = this.z.redMul(f.z), h = u.redSqr(), g = this.x.redMul(f.x), v = this.y.redMul(f.y), x = this.curve.d.redMul(g).redMul(v), S = h.redSub(x), R = h.redAdd(x), D = this.x.redAdd(this.y).redMul(f.x.redAdd(f.y)).redISub(g).redISub(v), k = u.redMul(S).redMul(D), N, z; + return this.curve.twisted ? (N = u.redMul(R).redMul(v.redSub(this.curve._mulA(g))), z = S.redMul(R)) : (N = u.redMul(R).redMul(v.redSub(g)), z = this.curve._mulC(S).redMul(R)), this.curve.point(k, N, z); }, o.prototype.add = function(f) { return this.isInfinity() ? f : f.isInfinity() ? this : this.curve.extended ? this._extAdd(f) : this._projAdd(f); }, o.prototype.mul = function(f) { @@ -16757,10 +16757,10 @@ function pF() { var S = u.slice(g.place, x + g.place); if (g.place += x, u[g.place++] !== 2) return !1; - var C = s(u, g); - if (C === !1 || u.length !== C + g.place || (u[g.place] & 128) !== 0) + var R = s(u, g); + if (R === !1 || u.length !== R + g.place || (u[g.place] & 128) !== 0) return !1; - var D = u.slice(g.place, C + g.place); + var D = u.slice(g.place, R + g.place); if (S[0] === 0) if (S[1] & 128) S = S.slice(1); @@ -16837,13 +16837,13 @@ function gF() { x = S.length + 1 >>> 1, h = new t(S, 16); } typeof v != "number" && (v = x * 8); - var C = v - this.n.bitLength(); - return C > 0 && (h = h.ushrn(C)), !g && h.cmp(this.n) >= 0 ? h.sub(this.n) : h; + var R = v - this.n.bitLength(); + return R > 0 && (h = h.ushrn(R)), !g && h.cmp(this.n) >= 0 ? h.sub(this.n) : h; }, f.prototype.sign = function(h, g, v, x) { typeof v == "object" && (x = v, v = null), x || (x = {}), g = this.keyFromPrivate(g, v), h = this._truncateToN(h, !1, x.msgBitLength); - for (var S = this.n.byteLength(), C = g.getPrivate().toArray("be", S), D = h.toArray("be", S), k = new e({ + for (var S = this.n.byteLength(), R = g.getPrivate().toArray("be", S), D = h.toArray("be", S), k = new e({ hash: this.hash, - entropy: C, + entropy: R, nonce: D, pers: x.pers, persEnc: x.persEnc || "utf8" @@ -16852,12 +16852,12 @@ function gF() { if (B = this._truncateToN(B, !0), !(B.cmpn(1) <= 0 || B.cmp(N) >= 0)) { var $ = this.g.mul(B); if (!$.isInfinity()) { - var U = $.getX(), R = U.umod(this.n); - if (R.cmpn(0) !== 0) { - var W = B.invm(this.n).mul(R.mul(g.getPrivate()).iadd(h)); + var U = $.getX(), C = U.umod(this.n); + if (C.cmpn(0) !== 0) { + var W = B.invm(this.n).mul(C.mul(g.getPrivate()).iadd(h)); if (W = W.umod(this.n), W.cmpn(0) !== 0) { - var J = ($.getY().isOdd() ? 1 : 0) | (U.cmp(R) !== 0 ? 2 : 0); - return x.canonical && W.cmp(this.nh) > 0 && (W = this.n.sub(W), J ^= 1), new a({ r: R, s: W, recoveryParam: J }); + var J = ($.getY().isOdd() ? 1 : 0) | (U.cmp(C) !== 0 ? 2 : 0); + return x.canonical && W.cmp(this.nh) > 0 && (W = this.n.sub(W), J ^= 1), new a({ r: C, s: W, recoveryParam: J }); } } } @@ -16865,19 +16865,19 @@ function gF() { } }, f.prototype.verify = function(h, g, v, x, S) { S || (S = {}), h = this._truncateToN(h, !1, S.msgBitLength), v = this.keyFromPublic(v, x), g = new a(g, "hex"); - var C = g.r, D = g.s; - if (C.cmpn(1) < 0 || C.cmp(this.n) >= 0 || D.cmpn(1) < 0 || D.cmp(this.n) >= 0) + var R = g.r, D = g.s; + if (R.cmpn(1) < 0 || R.cmp(this.n) >= 0 || D.cmpn(1) < 0 || D.cmp(this.n) >= 0) return !1; - var k = D.invm(this.n), N = k.mul(h).umod(this.n), z = k.mul(C).umod(this.n), B; - return this.curve._maxwellTrick ? (B = this.g.jmulAdd(N, v.getPublic(), z), B.isInfinity() ? !1 : B.eqXToP(C)) : (B = this.g.mulAdd(N, v.getPublic(), z), B.isInfinity() ? !1 : B.getX().umod(this.n).cmp(C) === 0); + var k = D.invm(this.n), N = k.mul(h).umod(this.n), z = k.mul(R).umod(this.n), B; + return this.curve._maxwellTrick ? (B = this.g.jmulAdd(N, v.getPublic(), z), B.isInfinity() ? !1 : B.eqXToP(R)) : (B = this.g.mulAdd(N, v.getPublic(), z), B.isInfinity() ? !1 : B.getX().umod(this.n).cmp(R) === 0); }, f.prototype.recoverPubKey = function(u, h, g, v) { s((3 & g) === g, "The recovery param is more than two bits"), h = new a(h, v); - var x = this.n, S = new t(u), C = h.r, D = h.s, k = g & 1, N = g >> 1; - if (C.cmp(this.curve.p.umod(this.curve.n)) >= 0 && N) + var x = this.n, S = new t(u), R = h.r, D = h.s, k = g & 1, N = g >> 1; + if (R.cmp(this.curve.p.umod(this.curve.n)) >= 0 && N) throw new Error("Unable to find sencond key candinate"); - N ? C = this.curve.pointFromX(C.add(this.curve.n), k) : C = this.curve.pointFromX(C, k); + N ? R = this.curve.pointFromX(R.add(this.curve.n), k) : R = this.curve.pointFromX(R, k); var z = h.r.invm(x), B = x.sub(S).mul(z).umod(x), $ = D.mul(z).umod(x); - return this.g.mulAdd(B, C, $); + return this.g.mulAdd(B, R, $); }, f.prototype.getKeyRecoveryParam = function(u, h, g, v) { if (h = new a(h, v), h.recoveryParam !== null) return h.recoveryParam; @@ -16968,13 +16968,13 @@ function bF() { } return Kg = a, a.prototype.sign = function(u, h) { u = i(u); - var g = this.keyFromSecret(h), v = this.hashInt(g.messagePrefix(), u), x = this.g.mul(v), S = this.encodePoint(x), C = this.hashInt(S, g.pubBytes(), u).mul(g.priv()), D = v.add(C).umod(this.curve.n); + var g = this.keyFromSecret(h), v = this.hashInt(g.messagePrefix(), u), x = this.g.mul(v), S = this.encodePoint(x), R = this.hashInt(S, g.pubBytes(), u).mul(g.priv()), D = v.add(R).umod(this.curve.n); return this.makeSignature({ R: x, S: D, Rencoded: S }); }, a.prototype.verify = function(u, h, g) { if (u = i(u), h = this.makeSignature(h), h.S().gte(h.eddsa.curve.n) || h.S().isNeg()) return !1; - var v = this.keyFromPublic(g), x = this.hashInt(h.Rencoded(), v.pubBytes(), u), S = this.g.mul(h.S()), C = h.R().add(v.pub().mul(x)); - return C.eq(S); + var v = this.keyFromPublic(g), x = this.hashInt(h.Rencoded(), v.pubBytes(), u), S = this.g.mul(h.S()), R = h.R().add(v.pub().mul(x)); + return R.eq(S); }, a.prototype.hashInt = function() { for (var u = this.hash(), h = 0; h < arguments.length; h++) u.update(arguments[h]); @@ -17254,13 +17254,13 @@ const T8 = (t, e) => { const r = `${t.domain} wants you to sign in with your Ethereum account:`, n = _d(e); if (!t.aud && !t.uri) throw new Error("Either `aud` or `uri` is required to construct the message"); let i = t.statement || void 0; - const s = `URI: ${t.aud || t.uri}`, o = `Version: ${t.version}`, a = `Chain ID: ${QF(e)}`, f = `Nonce: ${t.nonce}`, u = `Issued At: ${t.iat}`, h = t.exp ? `Expiration Time: ${t.exp}` : void 0, g = t.nbf ? `Not Before: ${t.nbf}` : void 0, v = t.requestId ? `Request ID: ${t.requestId}` : void 0, x = t.resources ? `Resources:${t.resources.map((C) => ` -- ${C}`).join("")}` : void 0, S = Hh(t.resources); + const s = `URI: ${t.aud || t.uri}`, o = `Version: ${t.version}`, a = `Chain ID: ${QF(e)}`, f = `Nonce: ${t.nonce}`, u = `Issued At: ${t.iat}`, h = t.exp ? `Expiration Time: ${t.exp}` : void 0, g = t.nbf ? `Not Before: ${t.nbf}` : void 0, v = t.requestId ? `Request ID: ${t.requestId}` : void 0, x = t.resources ? `Resources:${t.resources.map((R) => ` +- ${R}`).join("")}` : void 0, S = Hh(t.resources); if (S) { - const C = Nf(S); - i = cj(i, C); + const R = Nf(S); + i = cj(i, R); } - return [r, n, "", i, "", s, o, a, f, u, h, g, v, x].filter((C) => C != null).join(` + return [r, n, "", i, "", s, o, a, f, u, h, g, v, x].filter((R) => R != null).join(` `); }; function ej(t) { @@ -18137,8 +18137,8 @@ Yu.exports; var A3; function LU() { return A3 || (A3 = 1, (function(t, e) { - var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", f = "[object Array]", u = "[object AsyncFunction]", h = "[object Boolean]", g = "[object Date]", v = "[object Error]", x = "[object Function]", S = "[object GeneratorFunction]", C = "[object Map]", D = "[object Number]", k = "[object Null]", N = "[object Object]", z = "[object Promise]", B = "[object Proxy]", $ = "[object RegExp]", U = "[object Set]", R = "[object String]", W = "[object Symbol]", J = "[object Undefined]", ne = "[object WeakMap]", K = "[object ArrayBuffer]", E = "[object DataView]", b = "[object Float32Array]", l = "[object Float64Array]", p = "[object Int8Array]", m = "[object Int16Array]", w = "[object Int32Array]", P = "[object Uint8Array]", _ = "[object Uint8ClampedArray]", y = "[object Uint16Array]", M = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, q = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, L = {}; - L[b] = L[l] = L[p] = L[m] = L[w] = L[P] = L[_] = L[y] = L[M] = !0, L[a] = L[f] = L[K] = L[h] = L[E] = L[g] = L[v] = L[x] = L[C] = L[D] = L[N] = L[$] = L[U] = L[R] = L[ne] = !1; + var r = 200, n = "__lodash_hash_undefined__", i = 1, s = 2, o = 9007199254740991, a = "[object Arguments]", f = "[object Array]", u = "[object AsyncFunction]", h = "[object Boolean]", g = "[object Date]", v = "[object Error]", x = "[object Function]", S = "[object GeneratorFunction]", R = "[object Map]", D = "[object Number]", k = "[object Null]", N = "[object Object]", z = "[object Promise]", B = "[object Proxy]", $ = "[object RegExp]", U = "[object Set]", C = "[object String]", W = "[object Symbol]", J = "[object Undefined]", ne = "[object WeakMap]", K = "[object ArrayBuffer]", E = "[object DataView]", b = "[object Float32Array]", l = "[object Float64Array]", p = "[object Int8Array]", m = "[object Int16Array]", w = "[object Int32Array]", P = "[object Uint8Array]", _ = "[object Uint8ClampedArray]", y = "[object Uint16Array]", M = "[object Uint32Array]", I = /[\\^$.*+?()[\]{}|]/g, q = /^\[object .+?Constructor\]$/, ce = /^(?:0|[1-9]\d*)$/, L = {}; + L[b] = L[l] = L[p] = L[m] = L[w] = L[P] = L[_] = L[y] = L[M] = !0, L[a] = L[f] = L[K] = L[h] = L[E] = L[g] = L[v] = L[x] = L[R] = L[D] = L[N] = L[$] = L[U] = L[C] = L[ne] = !1; var oe = typeof Zn == "object" && Zn && Zn.Object === Object && Zn, Q = typeof self == "object" && self && self.Object === Object && self, X = oe || Q || Function("return this")(), ee = e && !e.nodeType && e, O = ee && !0 && t && !t.nodeType && t, Z = O && O.exports === ee, re = Z && oe.process, he = (function() { try { return re && re.binding && re.binding("util"); @@ -18445,9 +18445,9 @@ function LU() { case v: return ue.name == we.name && ue.message == we.message; case $: - case R: - return ue == we + ""; case C: + return ue == we + ""; + case R: var gn = Oe; case U: var Er = St & i; @@ -18522,14 +18522,14 @@ function LU() { return qt.call(ue, we); })); } : Fr, Ir = zt; - (kt && Ir(new kt(new ArrayBuffer(1))) != E || It && Ir(new It()) != C || dt && Ir(dt.resolve()) != z || Dt && Ir(new Dt()) != U || Nt && Ir(new Nt()) != ne) && (Ir = function(ue) { + (kt && Ir(new kt(new ArrayBuffer(1))) != E || It && Ir(new It()) != R || dt && Ir(dt.resolve()) != z || Dt && Ir(new Dt()) != U || Nt && Ir(new Nt()) != ne) && (Ir = function(ue) { var we = zt(ue), Ve = we == N ? ue.constructor : void 0, St = Ve ? ks(Ve) : ""; if (St) switch (St) { case Bt: return E; case Ft: - return C; + return R; case et: return z; case $t: @@ -18627,39 +18627,39 @@ function yq(t, e) { function g(S) { if (S instanceof Uint8Array || (ArrayBuffer.isView(S) ? S = new Uint8Array(S.buffer, S.byteOffset, S.byteLength) : Array.isArray(S) && (S = Uint8Array.from(S))), !(S instanceof Uint8Array)) throw new TypeError("Expected Uint8Array"); if (S.length === 0) return ""; - for (var C = 0, D = 0, k = 0, N = S.length; k !== N && S[k] === 0; ) k++, C++; + for (var R = 0, D = 0, k = 0, N = S.length; k !== N && S[k] === 0; ) k++, R++; for (var z = (N - k) * h + 1 >>> 0, B = new Uint8Array(z); k !== N; ) { - for (var $ = S[k], U = 0, R = z - 1; ($ !== 0 || U < D) && R !== -1; R--, U++) $ += 256 * B[R] >>> 0, B[R] = $ % a >>> 0, $ = $ / a >>> 0; + for (var $ = S[k], U = 0, C = z - 1; ($ !== 0 || U < D) && C !== -1; C--, U++) $ += 256 * B[C] >>> 0, B[C] = $ % a >>> 0, $ = $ / a >>> 0; if ($ !== 0) throw new Error("Non-zero carry"); D = U, k++; } for (var W = z - D; W !== z && B[W] === 0; ) W++; - for (var J = f.repeat(C); W < z; ++W) J += t.charAt(B[W]); + for (var J = f.repeat(R); W < z; ++W) J += t.charAt(B[W]); return J; } function v(S) { if (typeof S != "string") throw new TypeError("Expected String"); if (S.length === 0) return new Uint8Array(); - var C = 0; - if (S[C] !== " ") { - for (var D = 0, k = 0; S[C] === f; ) D++, C++; - for (var N = (S.length - C) * u + 1 >>> 0, z = new Uint8Array(N); S[C]; ) { - var B = r[S.charCodeAt(C)]; + var R = 0; + if (S[R] !== " ") { + for (var D = 0, k = 0; S[R] === f; ) D++, R++; + for (var N = (S.length - R) * u + 1 >>> 0, z = new Uint8Array(N); S[R]; ) { + var B = r[S.charCodeAt(R)]; if (B === 255) return; for (var $ = 0, U = N - 1; (B !== 0 || $ < k) && U !== -1; U--, $++) B += a * z[U] >>> 0, z[U] = B % 256 >>> 0, B = B / 256 >>> 0; if (B !== 0) throw new Error("Non-zero carry"); - k = $, C++; + k = $, R++; } - if (S[C] !== " ") { - for (var R = N - k; R !== N && z[R] === 0; ) R++; - for (var W = new Uint8Array(D + (N - R)), J = D; R !== N; ) W[J++] = z[R++]; + if (S[R] !== " ") { + for (var C = N - k; C !== N && z[C] === 0; ) C++; + for (var W = new Uint8Array(D + (N - C)), J = D; C !== N; ) W[J++] = z[C++]; return W; } } } function x(S) { - var C = v(S); - if (C) return C; + var R = v(S); + if (R) return R; throw new Error(`Non-${e} character`); } return { encode: g, decodeUnsafe: v, decode: x }; @@ -19041,11 +19041,11 @@ class Wz extends lk { var o; this.logger.debug("Publishing Payload"), this.logger.trace({ type: "method", method: "publish", params: { topic: n, message: i, opts: s } }); const a = s?.ttl || KU, f = ov(s), u = s?.prompt || !1, h = s?.tag || 0, g = s?.id || Ma().toString(), v = { topic: n, message: i, opts: { ttl: a, relay: f, prompt: u, tag: h, id: g, attestation: s?.attestation } }, x = `Failed to publish payload, please try again. id:${g} tag:${h}`, S = Date.now(); - let C, D = 1; + let R, D = 1; try { - for (; C === void 0; ) { + for (; R === void 0; ) { if (Date.now() - S > this.publishTimeout) throw new Error(x); - this.logger.trace({ id: g, attempts: D }, `publisher.publish - attempt ${D}`), C = await await Lc(this.rpcPublish(n, i, a, f, u, h, g, s?.attestation).catch((k) => this.logger.warn(k)), this.publishTimeout, x), D++, C || await new Promise((k) => setTimeout(k, this.failedPublishTimeout)); + this.logger.trace({ id: g, attempts: D }, `publisher.publish - attempt ${D}`), R = await await Lc(this.rpcPublish(n, i, a, f, u, h, g, s?.attestation).catch((k) => this.logger.warn(k)), this.publishTimeout, x), D++, R || await new Promise((k) => setTimeout(k, this.failedPublishTimeout)); } this.relayer.events.emit(Qn.publish, v), this.logger.debug("Successfully Published Payload"), this.logger.trace({ type: "method", method: "publish", params: { id: g, topic: n, message: i, opts: s } }); } catch (k) { @@ -20127,23 +20127,23 @@ class uH extends mk { try { const u = La.getDocument(), h = this.startAbortTimer(bt.ONE_SECOND * 5), g = await new Promise((v, x) => { const S = () => { - window.removeEventListener("message", D), u.body.removeChild(C), x("attestation aborted"); + window.removeEventListener("message", D), u.body.removeChild(R), x("attestation aborted"); }; this.abortController.signal.addEventListener("abort", S); - const C = u.createElement("iframe"); - C.src = f, C.style.display = "none", C.addEventListener("error", S, { signal: this.abortController.signal }); + const R = u.createElement("iframe"); + R.src = f, R.style.display = "none", R.addEventListener("error", S, { signal: this.abortController.signal }); const D = (k) => { if (k.data && typeof k.data == "string") try { const N = JSON.parse(k.data); if (N.type === "verify_attestation") { if (ev(N.attestation).payload.id !== o) return; - clearInterval(h), u.body.removeChild(C), this.abortController.signal.removeEventListener("abort", S), window.removeEventListener("message", D), v(N.attestation === null ? "" : N.attestation); + clearInterval(h), u.body.removeChild(R), this.abortController.signal.removeEventListener("abort", S), window.removeEventListener("message", D), v(N.attestation === null ? "" : N.attestation); } } catch (N) { this.logger.warn(N); } }; - u.body.appendChild(C), window.addEventListener("message", D, { signal: this.abortController.signal }); + u.body.appendChild(R), window.addEventListener("message", D, { signal: this.abortController.signal }); }); return this.logger.debug("jwt attestation", g), g; } catch (u) { @@ -20382,17 +20382,17 @@ class NH extends wk { const { message: B } = ft("NO_MATCHING_KEY", `connect() pairing topic: ${u}`); throw new Error(B); } - const v = await this.client.core.crypto.generateKeyPair(), x = Pn.wc_sessionPropose.req.ttl || bt.FIVE_MINUTES, S = _n(x), C = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: f ?? [{ protocol: G8 }], proposer: { publicKey: v, metadata: this.client.metadata }, expiryTimestamp: S, pairingTopic: u }, a && { sessionProperties: a }), { reject: D, resolve: k, done: N } = ba(x, fE); + const v = await this.client.core.crypto.generateKeyPair(), x = Pn.wc_sessionPropose.req.ttl || bt.FIVE_MINUTES, S = _n(x), R = tn({ requiredNamespaces: s, optionalNamespaces: o, relays: f ?? [{ protocol: G8 }], proposer: { publicKey: v, metadata: this.client.metadata }, expiryTimestamp: S, pairingTopic: u }, a && { sessionProperties: a }), { reject: D, resolve: k, done: N } = ba(x, fE); this.events.once(wr("session_connect"), async ({ error: B, session: $ }) => { if (B) D(B); else if ($) { $.self.publicKey = v; - const U = ss(tn({}, $), { pairingTopic: C.pairingTopic, requiredNamespaces: C.requiredNamespaces, optionalNamespaces: C.optionalNamespaces, transportType: Wr.relay }); + const U = ss(tn({}, $), { pairingTopic: R.pairingTopic, requiredNamespaces: R.requiredNamespaces, optionalNamespaces: R.optionalNamespaces, transportType: Wr.relay }); await this.client.session.set($.topic, U), await this.setExpiry($.topic, $.expiry), u && await this.client.core.pairing.updateMetadata({ topic: u, metadata: $.peer.metadata }), this.cleanupDuplicatePairings(U), k(U); } }); - const z = await this.sendRequest({ topic: u, method: "wc_sessionPropose", params: C, throwOnFailedPublish: !0 }); - return await this.setProposal(z, tn({ id: z }, C)), { uri: h, approval: N }; + const z = await this.sendRequest({ topic: u, method: "wc_sessionPropose", params: R, throwOnFailedPublish: !0 }); + return await this.setProposal(z, tn({ id: z }, R)), { uri: h, approval: N }; }, this.pair = async (r) => { this.isInitialized(), await this.confirmOnlineStateOrThrow(); try { @@ -20420,7 +20420,7 @@ class NH extends wk { } const { id: a, relayProtocol: f, namespaces: u, sessionProperties: h, sessionConfig: g } = r, v = this.client.proposal.get(a); this.client.core.eventClient.deleteEvent({ eventId: o.eventId }); - const { pairingTopic: x, proposer: S, requiredNamespaces: C, optionalNamespaces: D } = v; + const { pairingTopic: x, proposer: S, requiredNamespaces: R, optionalNamespaces: D } = v; let k = (i = this.client.core.eventClient) == null ? void 0 : i.getEvent({ topic: x }); k || (k = (s = this.client.core.eventClient) == null ? void 0 : s.createEvent({ type: is.session_approve_started, properties: { topic: x, trace: [is.session_approve_started, is.session_namespaces_validation_success] } })); const N = await this.client.core.crypto.generateKeyPair(), z = S.publicKey, B = await this.client.core.crypto.generateSharedKey(N, z), $ = tn(tn({ relay: { protocol: f ?? "irn" }, namespaces: u, controller: { publicKey: N, metadata: this.client.metadata }, expiry: _n(gc) }, h && { sessionProperties: h }), g && { sessionConfig: g }), U = Wr.relay; @@ -20431,8 +20431,8 @@ class NH extends wk { throw k.setError(ga.subscribe_session_topic_failure), W; } k.addTrace(is.subscribe_session_topic_success); - const R = ss(tn({}, $), { topic: B, requiredNamespaces: C, optionalNamespaces: D, pairingTopic: x, acknowledged: !1, self: $.controller, peer: { publicKey: S.publicKey, metadata: S.metadata }, controller: N, transportType: Wr.relay }); - await this.client.session.set(B, R), k.addTrace(is.store_session); + const C = ss(tn({}, $), { topic: B, requiredNamespaces: R, optionalNamespaces: D, pairingTopic: x, acknowledged: !1, self: $.controller, peer: { publicKey: S.publicKey, metadata: S.metadata }, controller: N, transportType: Wr.relay }); + await this.client.session.set(B, C), k.addTrace(is.store_session); try { k.addTrace(is.publishing_session_settle), await this.sendRequest({ topic: B, method: "wc_sessionSettle", params: $, throwOnFailedPublish: !0 }).catch((W) => { throw k?.setError(ga.session_settle_publish_failure), W; @@ -20494,15 +20494,15 @@ class NH extends wk { const { chainId: n, request: i, topic: s, expiry: o = Pn.wc_sessionRequest.req.ttl } = r, a = this.client.session.get(s); a?.transportType === Wr.relay && await this.confirmOnlineStateOrThrow(); const f = No(), u = Ma().toString(), { done: h, resolve: g, reject: v } = ba(o, "Request expired. Please try again."); - this.events.once(wr("session_request", f), ({ error: S, result: C }) => { - S ? v(S) : g(C); + this.events.once(wr("session_request", f), ({ error: S, result: R }) => { + S ? v(S) : g(R); }); const x = this.getAppLinkIfEnabled(a.peer.metadata, a.transportType); return x ? (await this.sendRequest({ clientRpcId: f, relayRpcId: u, topic: s, method: "wc_sessionRequest", params: { request: ss(tn({}, i), { expiryTimestamp: _n(o) }), chainId: n }, expiry: o, throwOnFailedPublish: !0, appLink: x }).catch((S) => v(S)), this.client.events.emit("session_request_sent", { topic: s, request: i, chainId: n, id: f }), await h()) : await Promise.all([new Promise(async (S) => { - await this.sendRequest({ clientRpcId: f, relayRpcId: u, topic: s, method: "wc_sessionRequest", params: { request: ss(tn({}, i), { expiryTimestamp: _n(o) }), chainId: n }, expiry: o, throwOnFailedPublish: !0 }).catch((C) => v(C)), this.client.events.emit("session_request_sent", { topic: s, request: i, chainId: n, id: f }), S(); + await this.sendRequest({ clientRpcId: f, relayRpcId: u, topic: s, method: "wc_sessionRequest", params: { request: ss(tn({}, i), { expiryTimestamp: _n(o) }), chainId: n }, expiry: o, throwOnFailedPublish: !0 }).catch((R) => v(R)), this.client.events.emit("session_request_sent", { topic: s, request: i, chainId: n, id: f }), S(); }), new Promise(async (S) => { - var C; - if (!((C = a.sessionConfig) != null && C.disableDeepLink)) { + var R; + if (!((R = a.sessionConfig) != null && R.disableDeepLink)) { const D = await $F(this.client.core.storage, V3); await LF({ id: f, topic: s, wcDeepLink: D }); } @@ -20546,15 +20546,15 @@ class NH extends wk { this.isInitialized(), this.isValidAuthenticate(r); const s = n && this.client.core.linkModeSupportedApps.includes(n) && ((i = this.client.metadata.redirect) == null ? void 0 : i.linkMode), o = s ? Wr.link_mode : Wr.relay; o === Wr.relay && await this.confirmOnlineStateOrThrow(); - const { chains: a, statement: f = "", uri: u, domain: h, nonce: g, type: v, exp: x, nbf: S, methods: C = [], expiry: D } = r, k = [...r.resources || []], { topic: N, uri: z } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); + const { chains: a, statement: f = "", uri: u, domain: h, nonce: g, type: v, exp: x, nbf: S, methods: R = [], expiry: D } = r, k = [...r.resources || []], { topic: N, uri: z } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: o }); this.client.logger.info({ message: "Generated new pairing", pairing: { topic: N, uri: z } }); const B = await this.client.core.crypto.generateKeyPair(), $ = Wh(B); - if (await Promise.all([this.client.auth.authKeys.set(Kh, { responseTopic: $, publicKey: B }), this.client.auth.pairingTopics.set($, { topic: $, pairingTopic: N })]), await this.client.core.relayer.subscribe($, { transportType: o }), this.client.logger.info(`sending request to new pairing topic: ${N}`), C.length > 0) { + if (await Promise.all([this.client.auth.authKeys.set(Kh, { responseTopic: $, publicKey: B }), this.client.auth.pairingTopics.set($, { topic: $, pairingTopic: N })]), await this.client.core.relayer.subscribe($, { transportType: o }), this.client.logger.info(`sending request to new pairing topic: ${N}`), R.length > 0) { const { namespace: P } = Nc(a[0]); - let _ = ij(P, "request", C); + let _ = ij(P, "request", R); Hh(k) && (_ = oj(_, k.pop())), k.push(_); } - const U = D && D > Pn.wc_sessionAuthenticate.req.ttl ? D : Pn.wc_sessionAuthenticate.req.ttl, R = { authPayload: { type: v ?? "caip122", chains: a, statement: f, aud: u, domain: h, version: "1", nonce: g, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: x, nbf: S, resources: k }, requester: { publicKey: B, metadata: this.client.metadata }, expiryTimestamp: _n(U) }, W = { eip155: { chains: a, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...C])], events: ["chainChanged", "accountsChanged"] } }, J = { requiredNamespaces: {}, optionalNamespaces: W, relays: [{ protocol: "irn" }], pairingTopic: N, proposer: { publicKey: B, metadata: this.client.metadata }, expiryTimestamp: _n(Pn.wc_sessionPropose.req.ttl) }, { done: ne, resolve: K, reject: E } = ba(U, "Request expired"), b = async ({ error: P, session: _ }) => { + const U = D && D > Pn.wc_sessionAuthenticate.req.ttl ? D : Pn.wc_sessionAuthenticate.req.ttl, C = { authPayload: { type: v ?? "caip122", chains: a, statement: f, aud: u, domain: h, version: "1", nonce: g, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: x, nbf: S, resources: k }, requester: { publicKey: B, metadata: this.client.metadata }, expiryTimestamp: _n(U) }, W = { eip155: { chains: a, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...R])], events: ["chainChanged", "accountsChanged"] } }, J = { requiredNamespaces: {}, optionalNamespaces: W, relays: [{ protocol: "irn" }], pairingTopic: N, proposer: { publicKey: B, metadata: this.client.metadata }, expiryTimestamp: _n(Pn.wc_sessionPropose.req.ttl) }, { done: ne, resolve: K, reject: E } = ba(U, "Request expired"), b = async ({ error: P, session: _ }) => { if (this.events.off(wr("session_request", p), l), P) E(P); else if (_) { _.self.publicKey = B, await this.client.session.set(_.topic, _), await this.setExpiry(_.topic, _.expiry), N && await this.client.core.pairing.updateMetadata({ topic: N, metadata: _.peer.metadata }); @@ -20586,15 +20586,15 @@ class NH extends wk { let w; try { if (s) { - const P = $o("wc_sessionAuthenticate", R, p); + const P = $o("wc_sessionAuthenticate", C, p); this.client.core.history.set(N, P); const _ = await this.client.core.crypto.encode("", P, { type: al, encoding: Ou }); w = Eh(n, N, _); - } else await Promise.all([this.sendRequest({ topic: N, method: "wc_sessionAuthenticate", params: R, expiry: r.expiry, throwOnFailedPublish: !0, clientRpcId: p }), this.sendRequest({ topic: N, method: "wc_sessionPropose", params: J, expiry: Pn.wc_sessionPropose.req.ttl, throwOnFailedPublish: !0, clientRpcId: m })]); + } else await Promise.all([this.sendRequest({ topic: N, method: "wc_sessionAuthenticate", params: C, expiry: r.expiry, throwOnFailedPublish: !0, clientRpcId: p }), this.sendRequest({ topic: N, method: "wc_sessionPropose", params: J, expiry: Pn.wc_sessionPropose.req.ttl, throwOnFailedPublish: !0, clientRpcId: m })]); } catch (P) { throw this.events.off(wr("session_connect"), b), this.events.off(wr("session_request", p), l), P; } - return await this.setProposal(m, tn({ id: m }, J)), await this.setAuthRequest(p, { request: ss(tn({}, R), { verifyContext: {} }), pairingTopic: N, transportType: o }), { uri: w ?? z, response: ne }; + return await this.setProposal(m, tn({ id: m }, J)), await this.setAuthRequest(p, { request: ss(tn({}, C), { verifyContext: {} }), pairingTopic: N, transportType: o }), { uri: w ?? z, response: ne }; }, this.approveSessionAuthenticate = async (r) => { const { id: n, auths: i } = r, s = this.client.core.eventClient.createEvent({ properties: { topic: n.toString(), trace: [ma.authenticated_session_approve_started] } }); try { @@ -20623,15 +20623,15 @@ class NH extends wk { } const S = await this.client.core.crypto.generateSharedKey(u, f); s.addTrace(ma.create_authenticated_session_topic); - let C; + let R; if (v?.length > 0) { - C = { topic: S, acknowledged: !0, self: { publicKey: u, metadata: this.client.metadata }, peer: { publicKey: f, metadata: o.requester.metadata }, controller: f, expiry: _n(gc), authentication: i, requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: o.pairingTopic, namespaces: l3([...new Set(v)], [...new Set(x)]), transportType: a }, s.addTrace(ma.subscribing_authenticated_session_topic); + R = { topic: S, acknowledged: !0, self: { publicKey: u, metadata: this.client.metadata }, peer: { publicKey: f, metadata: o.requester.metadata }, controller: f, expiry: _n(gc), authentication: i, requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: o.pairingTopic, namespaces: l3([...new Set(v)], [...new Set(x)]), transportType: a }, s.addTrace(ma.subscribing_authenticated_session_topic); try { await this.client.core.relayer.subscribe(S, { transportType: a }); } catch (D) { throw s.setError(ku.subscribe_authenticated_session_topic_failure), D; } - s.addTrace(ma.subscribe_authenticated_session_topic_success), await this.client.session.set(S, C), s.addTrace(ma.store_authenticated_session), await this.client.core.pairing.updateMetadata({ topic: o.pairingTopic, metadata: o.requester.metadata }); + s.addTrace(ma.subscribe_authenticated_session_topic_success), await this.client.session.set(S, R), s.addTrace(ma.store_authenticated_session), await this.client.core.pairing.updateMetadata({ topic: o.pairingTopic, metadata: o.requester.metadata }); } s.addTrace(ma.publishing_authenticated_session_approve); try { @@ -20639,7 +20639,7 @@ class NH extends wk { } catch (D) { throw s.setError(ku.authenticated_session_approve_publish_failure), D; } - return await this.client.auth.requests.delete(n, { message: "fulfilled", code: 0 }), await this.client.core.pairing.activate({ topic: o.pairingTopic }), this.client.core.eventClient.deleteEvent({ eventId: s.eventId }), { session: C }; + return await this.client.auth.requests.delete(n, { message: "fulfilled", code: 0 }), await this.client.core.pairing.activate({ topic: o.pairingTopic }), this.client.core.eventClient.deleteEvent({ eventId: s.eventId }), { session: R }; }, this.rejectSessionAuthenticate = async (r) => { this.isInitialized(); const { id: n, reason: i } = r, s = this.getPendingAuthRequest(n); @@ -20713,8 +20713,8 @@ class NH extends wk { const D = Qs(JSON.stringify(g)), k = Qs(v); S = await this.client.core.verify.register({ id: k, decryptedId: D }); } - const C = Pn[i].req; - if (C.attestation = S, o && (C.ttl = o), a && (C.id = a), this.client.core.history.set(n, g), x) { + const R = Pn[i].req; + if (R.attestation = S, o && (R.ttl = o), a && (R.id = a), this.client.core.history.set(n, g), x) { const D = Eh(h, n, v); await global.Linking.openURL(D, this.client.name); } else { @@ -20953,8 +20953,8 @@ class NH extends wk { const { topic: o, payload: a, attestation: f, encryptedId: u, transportType: h } = r, { id: g, params: v } = a; try { await this.isValidRequest(tn({ topic: o }, v)); - const x = this.client.session.get(o), S = await this.getVerifyContext({ attestationId: f, hash: Qs(JSON.stringify($o("wc_sessionRequest", v, g))), encryptedId: u, metadata: x.peer.metadata, transportType: h }), C = { id: g, topic: o, params: v, verifyContext: S }; - await this.setPendingSessionRequest(C), h === Wr.link_mode && (n = x.peer.metadata.redirect) != null && n.universal && this.client.core.addLinkModeSupportedApp((i = x.peer.metadata.redirect) == null ? void 0 : i.universal), (s = this.client.signConfig) != null && s.disableRequestQueue ? this.emitSessionRequest(C) : (this.addSessionRequestToSessionRequestQueue(C), this.processSessionRequestQueue()); + const x = this.client.session.get(o), S = await this.getVerifyContext({ attestationId: f, hash: Qs(JSON.stringify($o("wc_sessionRequest", v, g))), encryptedId: u, metadata: x.peer.metadata, transportType: h }), R = { id: g, topic: o, params: v, verifyContext: S }; + await this.setPendingSessionRequest(R), h === Wr.link_mode && (n = x.peer.metadata.redirect) != null && n.universal && this.client.core.addLinkModeSupportedApp((i = x.peer.metadata.redirect) == null ? void 0 : i.universal), (s = this.client.signConfig) != null && s.disableRequestQueue ? this.emitSessionRequest(R) : (this.addSessionRequestToSessionRequestQueue(R), this.processSessionRequestQueue()); } catch (x) { await this.sendError({ id: g, topic: o, error: x }), this.client.logger.error(x); } @@ -21513,8 +21513,8 @@ var qH = Ju.exports, J3; function zH() { return J3 || (J3 = 1, (function(t, e) { (function() { - var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", f = "__lodash_hash_undefined__", u = 500, h = "__lodash_placeholder__", g = 1, v = 2, x = 4, S = 1, C = 2, D = 1, k = 2, N = 4, z = 8, B = 16, $ = 32, U = 64, R = 128, W = 256, J = 512, ne = 30, K = "...", E = 800, b = 16, l = 1, p = 2, m = 3, w = 1 / 0, P = 9007199254740991, _ = 17976931348623157e292, y = NaN, M = 4294967295, I = M - 1, q = M >>> 1, ce = [ - ["ary", R], + var r, n = "4.17.21", i = 200, s = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", o = "Expected a function", a = "Invalid `variable` option passed into `_.template`", f = "__lodash_hash_undefined__", u = 500, h = "__lodash_placeholder__", g = 1, v = 2, x = 4, S = 1, R = 2, D = 1, k = 2, N = 4, z = 8, B = 16, $ = 32, U = 64, C = 128, W = 256, J = 512, ne = 30, K = "...", E = 800, b = 16, l = 1, p = 2, m = 3, w = 1 / 0, P = 9007199254740991, _ = 17976931348623157e292, y = NaN, M = 4294967295, I = M - 1, q = M >>> 1, ce = [ + ["ary", C], ["bind", D], ["bindKey", k], ["curry", z], @@ -22603,7 +22603,7 @@ function zH() { var Je = new es(); if (j) var xt = j(He, We, xe, c, d, Je); - if (!(xt === r ? gu(We, He, S | C, j, Je) : xt)) + if (!(xt === r ? gu(We, He, S | R, j, Je) : xt)) return !1; } } @@ -22661,7 +22661,7 @@ function zH() { function fy(c, d) { return bp(c) && qy(d) ? zy(bs(c), d) : function(A) { var j = Ip(A, c); - return j === r && j === d ? Cp(A, c) : gu(d, j, S | C); + return j === r && j === d ? Cp(A, c) : gu(d, j, S | R); }; } function zl(c, d, A, j, G) { @@ -23152,7 +23152,7 @@ function zH() { for (j = de ? j : A; ++j < A; ) { se = d[j]; var ve = Xl(se), xe = ve == "wrapper" ? gp(se) : r; - xe && yp(xe[0]) && xe[1] == (R | z | $ | W) && !xe[4].length && xe[9] == 1 ? de = de[Xl(xe[0])].apply(de, xe[3]) : de = se.length == 1 && yp(se) ? de[ve]() : de.thru(se); + xe && yp(xe[0]) && xe[1] == (C | z | $ | W) && !xe[4].length && xe[9] == 1 ? de = de[Xl(xe[0])].apply(de, xe[3]) : de = se.length == 1 && yp(se) ? de[ve]() : de.thru(se); } return function() { var He = arguments, We = He[0]; @@ -23165,7 +23165,7 @@ function zH() { }); } function Vl(c, d, A, j, G, se, de, ve, xe, He) { - var We = d & R, Je = d & D, xt = d & k, Ot = d & (z | B), Wt = d & J, fr = xt ? r : vu(c); + var We = d & C, Je = d & D, xt = d & k, Ot = d & (z | B), Wt = d & J, fr = xt ? r : vu(c); function Kt() { for (var yr = arguments.length, Sr = Ce(yr), wi = yr; wi--; ) Sr[wi] = arguments[wi]; @@ -23327,7 +23327,7 @@ function zH() { var He = se.get(c), We = se.get(d); if (He && We) return He == d && We == c; - var Je = -1, xt = !0, Ot = A & C ? new sa() : r; + var Je = -1, xt = !0, Ot = A & R ? new sa() : r; for (se.set(c, d), se.set(d, c); ++Je < ve; ) { var Wt = c[Je], fr = d[Je]; if (j) @@ -23379,7 +23379,7 @@ function zH() { var He = de.get(c); if (He) return He == d; - j |= C, de.set(c, d); + j |= R, de.set(c, d); var We = By(ve(c), ve(d), j, G, se, de); return de.delete(c), We; case ze: @@ -23636,7 +23636,7 @@ function zH() { return d; } function GP(c, d) { - var A = c[1], j = d[1], G = A | j, se = G < (D | k | R), de = j == R && A == z || j == R && A == W && c[7].length <= d[8] || j == (R | W) && d[7].length <= d[8] && A == z; + var A = c[1], j = d[1], G = A | j, se = G < (D | k | C), de = j == C && A == z || j == C && A == W && c[7].length <= d[8] || j == (C | W) && d[7].length <= d[8] && A == z; if (!(se || de)) return c; j & D && (c[2] = d[2], G |= A & D ? 0 : N); @@ -23645,7 +23645,7 @@ function zH() { var xe = c[3]; c[3] = xe ? Ay(xe, ve, d[4]) : ve, c[4] = xe ? bo(c[3], h) : d[4]; } - return ve = d[5], ve && (xe = c[5], c[5] = xe ? Py(xe, ve, d[6]) : ve, c[6] = xe ? bo(c[5], h) : d[6]), ve = d[7], ve && (c[7] = ve), j & R && (c[8] = c[8] == null ? d[8] : jn(c[8], d[8])), c[9] == null && (c[9] = d[9]), c[0] = d[0], c[1] = G, c; + return ve = d[5], ve && (xe = c[5], c[5] = xe ? Py(xe, ve, d[6]) : ve, c[6] = xe ? bo(c[5], h) : d[6]), ve = d[7], ve && (c[7] = ve), j & C && (c[8] = c[8] == null ? d[8] : jn(c[8], d[8])), c[9] == null && (c[9] = d[9]), c[0] = d[0], c[1] = G, c; } function YP(c) { var d = []; @@ -24186,7 +24186,7 @@ function zH() { }; } function ow(c, d, A) { - return d = A ? r : d, d = c && d == null ? c.length : d, js(c, R, r, r, r, r, d); + return d = A ? r : d, d = c && d == null ? c.length : d, js(c, C, r, r, r, r, d); } function aw(c, d) { var A; @@ -25273,7 +25273,7 @@ function KH() { l.push([m, p]); }), x(l); }, a.iterable && (S.prototype[Symbol.iterator] = S.prototype.entries); - function C(l) { + function R(l) { if (l.bodyUsed) return Promise.reject(new TypeError("Already read")); l.bodyUsed = !0; @@ -25310,7 +25310,7 @@ function KH() { return this.bodyUsed = !1, this._initBody = function(l) { this._bodyInit = l, l ? typeof l == "string" ? this._bodyText = l : a.blob && Blob.prototype.isPrototypeOf(l) ? this._bodyBlob = l : a.formData && FormData.prototype.isPrototypeOf(l) ? this._bodyFormData = l : a.searchParams && URLSearchParams.prototype.isPrototypeOf(l) ? this._bodyText = l.toString() : a.arrayBuffer && a.blob && f(l) ? (this._bodyArrayBuffer = B(l.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(l) || h(l)) ? this._bodyArrayBuffer = B(l) : this._bodyText = l = Object.prototype.toString.call(l) : this._bodyText = "", this.headers.get("content-type") || (typeof l == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : a.searchParams && URLSearchParams.prototype.isPrototypeOf(l) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8")); }, a.blob && (this.blob = function() { - var l = C(this); + var l = R(this); if (l) return l; if (this._bodyBlob) @@ -25321,9 +25321,9 @@ function KH() { throw new Error("could not read FormData body as blob"); return Promise.resolve(new Blob([this._bodyText])); }, this.arrayBuffer = function() { - return this._bodyArrayBuffer ? C(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(k); + return this._bodyArrayBuffer ? R(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(k); }), this.text = function() { - var l = C(this); + var l = R(this); if (l) return l; if (this._bodyBlob) @@ -25340,7 +25340,7 @@ function KH() { }, this; } var U = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"]; - function R(l) { + function C(l) { var p = l.toUpperCase(); return U.indexOf(p) > -1 ? p : l; } @@ -25353,7 +25353,7 @@ function KH() { this.url = l.url, this.credentials = l.credentials, p.headers || (this.headers = new S(l.headers)), this.method = l.method, this.mode = l.mode, this.signal = l.signal, !m && l._bodyInit != null && (m = l._bodyInit, l.bodyUsed = !0); } else this.url = String(l); - if (this.credentials = p.credentials || this.credentials || "same-origin", (p.headers || !this.headers) && (this.headers = new S(p.headers)), this.method = R(p.method || this.method || "GET"), this.mode = p.mode || this.mode || null, this.signal = p.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && m) + if (this.credentials = p.credentials || this.credentials || "same-origin", (p.headers || !this.headers) && (this.headers = new S(p.headers)), this.method = C(p.method || this.method || "GET"), this.mode = p.mode || this.mode || null, this.signal = p.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && m) throw new TypeError("Body not allowed for GET or HEAD requests"); this._initBody(m); } @@ -27176,8 +27176,8 @@ function nK() { er.rotlSH = x; const S = (J, ne, K) => ne << K | J >>> 32 - K; er.rotlSL = S; - const C = (J, ne, K) => ne << K - 32 | J >>> 64 - K; - er.rotlBH = C; + const R = (J, ne, K) => ne << K - 32 | J >>> 64 - K; + er.rotlBH = R; const D = (J, ne, K) => J << K - 32 | ne >>> 64 - K; er.rotlBL = D; function k(J, ne, K, E) { @@ -27194,8 +27194,8 @@ function nK() { er.add4H = $; const U = (J, ne, K, E, b) => (J >>> 0) + (ne >>> 0) + (K >>> 0) + (E >>> 0) + (b >>> 0); er.add5L = U; - const R = (J, ne, K, E, b, l) => ne + K + E + b + l + (J / 2 ** 32 | 0) | 0; - er.add5H = R; + const C = (J, ne, K, E, b, l) => ne + K + E + b + l + (J / 2 ** 32 | 0) | 0; + er.add5H = C; const W = { fromBig: r, split: n, @@ -27210,14 +27210,14 @@ function nK() { rotr32L: v, rotlSH: x, rotlSL: S, - rotlBH: C, + rotlBH: R, rotlBL: D, add: k, add3L: N, add3H: z, add4L: B, add4H: $, - add5H: R, + add5H: C, add5L: U }; return er.default = W, er; @@ -27230,7 +27230,7 @@ var A_; function sK() { return A_ || (A_ = 1, (function(t) { /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ - Object.defineProperty(t, "__esModule", { value: !0 }), t.wrapXOFConstructorWithOpts = t.wrapConstructorWithOpts = t.wrapConstructor = t.Hash = t.nextTick = t.swap32IfBE = t.byteSwapIfBE = t.swap8IfBE = t.isLE = void 0, t.isBytes = r, t.anumber = n, t.abytes = i, t.ahash = s, t.aexists = o, t.aoutput = a, t.u8 = f, t.u32 = u, t.clean = h, t.createView = g, t.rotr = v, t.rotl = x, t.byteSwap = S, t.byteSwap32 = C, t.bytesToHex = N, t.hexToBytes = $, t.asyncLoop = R, t.utf8ToBytes = W, t.bytesToUtf8 = J, t.toBytes = ne, t.kdfInputToBytes = K, t.concatBytes = E, t.checkOpts = b, t.createHasher = p, t.createOptHasher = m, t.createXOFer = w, t.randomBytes = P; + Object.defineProperty(t, "__esModule", { value: !0 }), t.wrapXOFConstructorWithOpts = t.wrapConstructorWithOpts = t.wrapConstructor = t.Hash = t.nextTick = t.swap32IfBE = t.byteSwapIfBE = t.swap8IfBE = t.isLE = void 0, t.isBytes = r, t.anumber = n, t.abytes = i, t.ahash = s, t.aexists = o, t.aoutput = a, t.u8 = f, t.u32 = u, t.clean = h, t.createView = g, t.rotr = v, t.rotl = x, t.byteSwap = S, t.byteSwap32 = R, t.bytesToHex = N, t.hexToBytes = $, t.asyncLoop = C, t.utf8ToBytes = W, t.bytesToUtf8 = J, t.toBytes = ne, t.kdfInputToBytes = K, t.concatBytes = E, t.checkOpts = b, t.createHasher = p, t.createOptHasher = m, t.createXOFer = w, t.randomBytes = P; const e = /* @__PURE__ */ iK(); function r(_) { return _ instanceof Uint8Array || ArrayBuffer.isView(_) && _.constructor.name === "Uint8Array"; @@ -27286,12 +27286,12 @@ function sK() { return _ << 24 & 4278190080 | _ << 8 & 16711680 | _ >>> 8 & 65280 | _ >>> 24 & 255; } t.swap8IfBE = t.isLE ? (_) => _ : (_) => S(_), t.byteSwapIfBE = t.swap8IfBE; - function C(_) { + function R(_) { for (let y = 0; y < _.length; y++) _[y] = S(_[y]); return _; } - t.swap32IfBE = t.isLE ? (_) => _ : C; + t.swap32IfBE = t.isLE ? (_) => _ : R; const D = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", k = /* @__PURE__ */ Array.from({ length: 256 }, (_, y) => y.toString(16).padStart(2, "0")); function N(_) { if (i(_), D) @@ -27332,7 +27332,7 @@ function sK() { const U = async () => { }; t.nextTick = U; - async function R(_, y, M) { + async function C(_, y, M) { let I = Date.now(); for (let q = 0; q < _; q++) { M(q); @@ -27402,27 +27402,27 @@ function oK() { if (P_) return Hr; P_ = 1, Object.defineProperty(Hr, "__esModule", { value: !0 }), Hr.shake256 = Hr.shake128 = Hr.keccak_512 = Hr.keccak_384 = Hr.keccak_256 = Hr.keccak_224 = Hr.sha3_512 = Hr.sha3_384 = Hr.sha3_256 = Hr.sha3_224 = Hr.Keccak = void 0, Hr.keccakP = D; const t = /* @__PURE__ */ nK(), e = /* @__PURE__ */ sK(), r = BigInt(0), n = BigInt(1), i = BigInt(2), s = BigInt(7), o = BigInt(256), a = BigInt(113), f = [], u = [], h = []; - for (let B = 0, $ = n, U = 1, R = 0; B < 24; B++) { - [U, R] = [R, (2 * U + 3 * R) % 5], f.push(2 * (5 * R + U)), u.push((B + 1) * (B + 2) / 2 % 64); + for (let B = 0, $ = n, U = 1, C = 0; B < 24; B++) { + [U, C] = [C, (2 * U + 3 * C) % 5], f.push(2 * (5 * C + U)), u.push((B + 1) * (B + 2) / 2 % 64); let W = r; for (let J = 0; J < 7; J++) $ = ($ << n ^ ($ >> s) * a) % o, $ & i && (W ^= n << (n << /* @__PURE__ */ BigInt(J)) - n); h.push(W); } - const g = (0, t.split)(h, !0), v = g[0], x = g[1], S = (B, $, U) => U > 32 ? (0, t.rotlBH)(B, $, U) : (0, t.rotlSH)(B, $, U), C = (B, $, U) => U > 32 ? (0, t.rotlBL)(B, $, U) : (0, t.rotlSL)(B, $, U); + const g = (0, t.split)(h, !0), v = g[0], x = g[1], S = (B, $, U) => U > 32 ? (0, t.rotlBH)(B, $, U) : (0, t.rotlSH)(B, $, U), R = (B, $, U) => U > 32 ? (0, t.rotlBL)(B, $, U) : (0, t.rotlSL)(B, $, U); function D(B, $ = 24) { const U = new Uint32Array(10); - for (let R = 24 - $; R < 24; R++) { + for (let C = 24 - $; C < 24; C++) { for (let ne = 0; ne < 10; ne++) U[ne] = B[ne] ^ B[ne + 10] ^ B[ne + 20] ^ B[ne + 30] ^ B[ne + 40]; for (let ne = 0; ne < 10; ne += 2) { - const K = (ne + 8) % 10, E = (ne + 2) % 10, b = U[E], l = U[E + 1], p = S(b, l, 1) ^ U[K], m = C(b, l, 1) ^ U[K + 1]; + const K = (ne + 8) % 10, E = (ne + 2) % 10, b = U[E], l = U[E + 1], p = S(b, l, 1) ^ U[K], m = R(b, l, 1) ^ U[K + 1]; for (let w = 0; w < 50; w += 10) B[ne + w] ^= p, B[ne + w + 1] ^= m; } let W = B[2], J = B[3]; for (let ne = 0; ne < 24; ne++) { - const K = u[ne], E = S(W, J, K), b = C(W, J, K), l = f[ne]; + const K = u[ne], E = S(W, J, K), b = R(W, J, K), l = f[ne]; W = B[l], J = B[l + 1], B[l] = E, B[l + 1] = b; } for (let ne = 0; ne < 50; ne += 10) { @@ -27431,14 +27431,14 @@ function oK() { for (let K = 0; K < 10; K++) B[ne + K] ^= ~U[(K + 2) % 10] & U[(K + 4) % 10]; } - B[0] ^= v[R], B[1] ^= x[R]; + B[0] ^= v[C], B[1] ^= x[C]; } (0, e.clean)(U); } class k extends e.Hash { // NOTE: we accept arguments in bytes instead of bits here. - constructor($, U, R, W = !1, J = 24) { - if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = $, this.suffix = U, this.outputLen = R, this.enableXOF = W, this.rounds = J, (0, e.anumber)(R), !(0 < $ && $ < 200)) + constructor($, U, C, W = !1, J = 24) { + if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = $, this.suffix = U, this.outputLen = C, this.enableXOF = W, this.rounds = J, (0, e.anumber)(C), !(0 < $ && $ < 200)) throw new Error("only keccak-f1600 function is supported"); this.state = new Uint8Array(200), this.state32 = (0, e.u32)(this.state); } @@ -27450,11 +27450,11 @@ function oK() { } update($) { (0, e.aexists)(this), $ = (0, e.toBytes)($), (0, e.abytes)($); - const { blockLen: U, state: R } = this, W = $.length; + const { blockLen: U, state: C } = this, W = $.length; for (let J = 0; J < W; ) { const ne = Math.min(U - this.pos, W - J); for (let K = 0; K < ne; K++) - R[this.pos++] ^= $[J++]; + C[this.pos++] ^= $[J++]; this.pos === U && this.keccak(); } return this; @@ -27463,15 +27463,15 @@ function oK() { if (this.finished) return; this.finished = !0; - const { state: $, suffix: U, pos: R, blockLen: W } = this; - $[R] ^= U, (U & 128) !== 0 && R === W - 1 && this.keccak(), $[W - 1] ^= 128, this.keccak(); + const { state: $, suffix: U, pos: C, blockLen: W } = this; + $[C] ^= U, (U & 128) !== 0 && C === W - 1 && this.keccak(), $[W - 1] ^= 128, this.keccak(); } writeInto($) { (0, e.aexists)(this, !1), (0, e.abytes)($), this.finish(); - const U = this.state, { blockLen: R } = this; + const U = this.state, { blockLen: C } = this; for (let W = 0, J = $.length; W < J; ) { - this.posOut >= R && this.keccak(); - const ne = Math.min(R - this.posOut, J - W); + this.posOut >= C && this.keccak(); + const ne = Math.min(C - this.posOut, J - W); $.set(U.subarray(this.posOut, this.posOut + ne), W), this.posOut += ne, W += ne; } return $; @@ -27496,14 +27496,14 @@ function oK() { this.destroyed = !0, (0, e.clean)(this.state); } _cloneInto($) { - const { blockLen: U, suffix: R, outputLen: W, rounds: J, enableXOF: ne } = this; - return $ || ($ = new k(U, R, W, ne, J)), $.state32.set(this.state32), $.pos = this.pos, $.posOut = this.posOut, $.finished = this.finished, $.rounds = J, $.suffix = R, $.outputLen = W, $.enableXOF = ne, $.destroyed = this.destroyed, $; + const { blockLen: U, suffix: C, outputLen: W, rounds: J, enableXOF: ne } = this; + return $ || ($ = new k(U, C, W, ne, J)), $.state32.set(this.state32), $.pos = this.pos, $.posOut = this.posOut, $.finished = this.finished, $.rounds = J, $.suffix = C, $.outputLen = W, $.enableXOF = ne, $.destroyed = this.destroyed, $; } } Hr.Keccak = k; const N = (B, $, U) => (0, e.createHasher)(() => new k($, B, U)); Hr.sha3_224 = N(6, 144, 224 / 8), Hr.sha3_256 = N(6, 136, 256 / 8), Hr.sha3_384 = N(6, 104, 384 / 8), Hr.sha3_512 = N(6, 72, 512 / 8), Hr.keccak_224 = N(1, 144, 224 / 8), Hr.keccak_256 = N(1, 136, 256 / 8), Hr.keccak_384 = N(1, 104, 384 / 8), Hr.keccak_512 = N(1, 72, 512 / 8); - const z = (B, $, U) => (0, e.createXOFer)((R = {}) => new k($, B, R.dkLen === void 0 ? U : R.dkLen, !0)); + const z = (B, $, U) => (0, e.createXOFer)((C = {}) => new k($, B, C.dkLen === void 0 ? U : C.dkLen, !0)); return Hr.shake128 = z(31, 168, 128 / 8), Hr.shake256 = z(31, 136, 256 / 8), Hr; } var um, M_; @@ -27518,26 +27518,26 @@ function CE() { return x.toString(2).length; } function n(x, S) { - let C = x.toString(16); - C.length % 2 !== 0 && (C = "0" + C); - const D = C.match(/.{1,2}/g).map((k) => parseInt(k, 16)); + let R = x.toString(16); + R.length % 2 !== 0 && (R = "0" + R); + const D = R.match(/.{1,2}/g).map((k) => parseInt(k, 16)); for (; D.length < S; ) D.unshift(0); return Buffer.from(D); } function i(x, S) { - const C = x < 0n; + const R = x < 0n; let D; - if (C) { + if (R) { const k = (1n << BigInt(S)) - 1n; D = (~x & k) + 1n; } else D = x; return D &= (1n << BigInt(S)) - 1n, D; } - function s(x, S, C) { + function s(x, S, R) { const D = e(S); - return x = a(x), C ? x.length < S ? (x.copy(D), D) : x.slice(0, S) : x.length < S ? (x.copy(D, S - x.length), D) : x.slice(-S); + return x = a(x), R ? x.length < S ? (x.copy(D), D) : x.slice(0, S) : x.length < S ? (x.copy(D, S - x.length), D) : x.slice(-S); } function o(x, S) { return s(x, S, !0); @@ -27619,7 +27619,7 @@ function aK() { throw new Error("Argument is not a number"); } function o(v, x) { - var S, C, D, k; + var S, R, D, k; if (v === "address") return o("uint160", s(x)); if (v === "bool") @@ -27649,26 +27649,26 @@ function aK() { } else if (v.startsWith("uint")) { if (S = r(v), S % 8 || S < 8 || S > 256) throw new Error("Invalid uint width: " + S); - C = s(x); - const z = t.bitLengthFromBigInt(C); + R = s(x); + const z = t.bitLengthFromBigInt(R); if (z > S) throw new Error("Supplied uint exceeds width: " + S + " vs " + z); - if (C < 0) + if (R < 0) throw new Error("Supplied uint is negative"); - return t.bufferBEFromBigInt(C, 32); + return t.bufferBEFromBigInt(R, 32); } else if (v.startsWith("int")) { if (S = r(v), S % 8 || S < 8 || S > 256) throw new Error("Invalid int width: " + S); - C = s(x); - const z = t.bitLengthFromBigInt(C); + R = s(x); + const z = t.bitLengthFromBigInt(R); if (z > S) throw new Error("Supplied int exceeds width: " + S + " vs " + z); - const B = t.twosFromBigInt(C, 256); + const B = t.twosFromBigInt(R, 256); return t.bufferBEFromBigInt(B, 32); } else if (v.startsWith("ufixed")) { - if (S = n(v), C = s(x), C < 0) + if (S = n(v), R = s(x), R < 0) throw new Error("Supplied ufixed is negative"); - return o("uint256", C * BigInt(2) ** BigInt(S[1])); + return o("uint256", R * BigInt(2) ** BigInt(S[1])); } else if (v.startsWith("fixed")) return S = n(v), o("int256", s(x) * BigInt(2) ** BigInt(S[1])); } @@ -27681,17 +27681,17 @@ function aK() { return v.lastIndexOf("]") === v.length - 1; } function u(v, x) { - var S = [], C = [], D = 32 * v.length; + var S = [], R = [], D = 32 * v.length; for (var k in v) { var N = e(v[k]), z = x[k], B = o(N, z); - a(N) ? (S.push(o("uint256", D)), C.push(B), D += B.length) : S.push(B); + a(N) ? (S.push(o("uint256", D)), R.push(B), D += B.length) : S.push(B); } - return Buffer.concat(S.concat(C)); + return Buffer.concat(S.concat(R)); } function h(v, x) { if (v.length !== x.length) throw new Error("Number of types are not matching the values"); - for (var S, C, D = [], k = 0; k < v.length; k++) { + for (var S, R, D = [], k = 0; k < v.length; k++) { var N = e(v[k]), z = x[k]; if (N === "bytes") D.push(z); @@ -27708,19 +27708,19 @@ function aK() { } else if (N.startsWith("uint")) { if (S = r(N), S % 8 || S < 8 || S > 256) throw new Error("Invalid uint width: " + S); - C = s(z); - const B = t.bitLengthFromBigInt(C); + R = s(z); + const B = t.bitLengthFromBigInt(R); if (B > S) throw new Error("Supplied uint exceeds width: " + S + " vs " + B); - D.push(t.bufferBEFromBigInt(C, S / 8)); + D.push(t.bufferBEFromBigInt(R, S / 8)); } else if (N.startsWith("int")) { if (S = r(N), S % 8 || S < 8 || S > 256) throw new Error("Invalid int width: " + S); - C = s(z); - const B = t.bitLengthFromBigInt(C); + R = s(z); + const B = t.bitLengthFromBigInt(R); if (B > S) throw new Error("Supplied int exceeds width: " + S + " vs " + B); - const $ = t.twosFromBigInt(C, S); + const $ = t.twosFromBigInt(R, S); D.push(t.bufferBEFromBigInt($, S / 8)); } else throw new Error("Unsupported or invalid type: " + N); @@ -27784,7 +27784,7 @@ function cK() { if (x === "string") return typeof S == "string" && (S = Buffer.from(S, "utf8")), ["bytes32", t.keccak(S)]; if (x.lastIndexOf("]") === x.length - 1) { - const C = x.slice(0, x.lastIndexOf("[")), D = S.map((k) => g(v, C, k)); + const R = x.slice(0, x.lastIndexOf("[")), D = S.map((k) => g(v, R, k)); return ["bytes32", t.keccak(e.rawEncode( D.map(([k]) => k), D.map(([, k]) => k) @@ -28461,9 +28461,9 @@ function Sd() { Sd.__r = 0; } function BE(t, e, r, n, i, s, o, a, f, u, h) { - var g, v, x, S, C, D, k = n && n.__k || kE, N = e.length; - for (f = EK(r, e, k, f), g = 0; g < N; g++) (x = r.__k[g]) != null && (v = x.__i === -1 ? Bf : k[x.__i] || Bf, x.__i = g, D = j1(t, x, v, i, s, o, a, f, u, h), S = x.__e, x.ref && v.ref != x.ref && (v.ref && U1(v.ref, null, x), h.push(x.ref, x.__c || S, x)), C == null && S != null && (C = S), 4 & x.__u || v.__k === x.__k ? f = FE(x, f, t) : typeof x.type == "function" && D !== void 0 ? f = D : S && (f = S.nextSibling), x.__u &= -7); - return r.__e = C, f; + var g, v, x, S, R, D, k = n && n.__k || kE, N = e.length; + for (f = EK(r, e, k, f), g = 0; g < N; g++) (x = r.__k[g]) != null && (v = x.__i === -1 ? Bf : k[x.__i] || Bf, x.__i = g, D = j1(t, x, v, i, s, o, a, f, u, h), S = x.__e, x.ref && v.ref != x.ref && (v.ref && U1(v.ref, null, x), h.push(x.ref, x.__c || S, x)), R == null && S != null && (R = S), 4 & x.__u || v.__k === x.__k ? f = FE(x, f, t) : typeof x.type == "function" && D !== void 0 ? f = D : S && (f = S.nextSibling), x.__u &= -7); + return r.__e = R, f; } function EK(t, e, r, n) { var i, s, o, a, f, u = e.length, h = r.length, g = h, v = 0; @@ -28530,7 +28530,7 @@ function $_(t) { }; } function j1(t, e, r, n, i, s, o, a, f, u) { - var h, g, v, x, S, C, D, k, N, z, B, $, U, R, W, J, ne, K = e.type; + var h, g, v, x, S, R, D, k, N, z, B, $, U, C, W, J, ne, K = e.type; if (e.constructor !== void 0) return null; 128 & r.__u && (f = !!(32 & r.__u), s = [a = e.__e = r.__e]), (h = Jr.__b) && h(e); e: if (typeof K == "function") try { @@ -28544,16 +28544,16 @@ function j1(t, e, r, n, i, s, o, a, f, u) { break e; } g.componentWillUpdate != null && g.componentWillUpdate(k, g.__s, B), N && g.componentDidUpdate != null && g.__h.push(function() { - g.componentDidUpdate(x, S, C); + g.componentDidUpdate(x, S, R); }); } - if (g.context = B, g.props = k, g.__P = t, g.__e = !1, U = Jr.__r, R = 0, N) { + if (g.context = B, g.props = k, g.__P = t, g.__e = !1, U = Jr.__r, C = 0, N) { for (g.state = g.__s, g.__d = !1, U && U(e), h = g.render(g.props, g.state, g.context), W = 0; W < g._sb.length; W++) g.__h.push(g._sb[W]); g._sb = []; } else do g.__d = !1, U && U(e), h = g.render(g.props, g.state, g.context), g.state = g.__s; - while (g.__d && ++R < 25); - g.state = g.__s, g.getChildContext != null && (n = Fo(Fo({}, n), g.getChildContext())), N && !v && g.getSnapshotBeforeUpdate != null && (C = g.getSnapshotBeforeUpdate(x, S)), a = BE(t, B1(J = h != null && h.type === fl && h.key == null ? h.props.children : h) ? J : [J], e, r, n, i, s, o, a, f, u), g.base = e.__e, e.__u &= -161, g.__h.length && o.push(g), D && (g.__E = g.__ = null); + while (g.__d && ++C < 25); + g.state = g.__s, g.getChildContext != null && (n = Fo(Fo({}, n), g.getChildContext())), N && !v && g.getSnapshotBeforeUpdate != null && (R = g.getSnapshotBeforeUpdate(x, S)), a = BE(t, B1(J = h != null && h.type === fl && h.key == null ? h.props.children : h) ? J : [J], e, r, n, i, s, o, a, f, u), g.base = e.__e, e.__u &= -161, g.__h.length && o.push(g), D && (g.__E = g.__ = null); } catch (E) { if (e.__v = null, f || s != null) if (E.then) { for (e.__u |= f ? 160 : 128; a && a.nodeType === 8 && a.nextSibling; ) a = a.nextSibling; @@ -28578,7 +28578,7 @@ function jE(t, e, r) { }); } function AK(t, e, r, n, i, s, o, a, f) { - var u, h, g, v, x, S, C, D = r.props, k = e.props, N = e.type; + var u, h, g, v, x, S, R, D = r.props, k = e.props, N = e.type; if (N === "svg" ? i = "http://www.w3.org/2000/svg" : N === "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) { for (u = 0; u < s.length; u++) if ((x = s[u]) && "setAttribute" in x == !!N && (N ? x.localName === N : x.nodeType === 3)) { t = x, s[u] = null; @@ -28599,10 +28599,10 @@ function AK(t, e, r, n, i, s, o, a, f) { Mh(t, u, null, x, i); } } - for (u in k) x = k[u], u == "children" ? v = x : u == "dangerouslySetInnerHTML" ? h = x : u == "value" ? S = x : u == "checked" ? C = x : a && typeof x != "function" || D[u] === x || Mh(t, u, x, D[u], i); + for (u in k) x = k[u], u == "children" ? v = x : u == "dangerouslySetInnerHTML" ? h = x : u == "value" ? S = x : u == "checked" ? R = x : a && typeof x != "function" || D[u] === x || Mh(t, u, x, D[u], i); if (h) a || g && (h.__html === g.__html || h.__html === t.innerHTML) || (t.innerHTML = h.__html), e.__k = []; else if (g && (t.innerHTML = ""), BE(t, B1(v) ? v : [v], e, r, n, N === "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, o, s ? s[0] : r.__k && qc(r, 0), a, f), s != null) for (u = s.length; u--; ) F1(s[u]); - a || (u = "value", N === "progress" && S == null ? t.removeAttribute("value") : S !== void 0 && (S !== t[u] || N === "progress" && !S || N === "option" && S !== D[u]) && Mh(t, u, S, D[u], i), u = "checked", C !== void 0 && C !== t[u] && Mh(t, u, C, D[u], i)); + a || (u = "value", N === "progress" && S == null ? t.removeAttribute("value") : S !== void 0 && (S !== t[u] || N === "progress" && !S || N === "option" && S !== D[u]) && Mh(t, u, S, D[u], i), u = "checked", R !== void 0 && R !== t[u] && Mh(t, u, R, D[u], i)); } return t; } @@ -29689,9 +29689,9 @@ function iV() { var h = r ? r + u : u, g = this._events[h]; return g ? g.fn ? 1 : g.length : 0; }, a.prototype.emit = function(u, h, g, v, x, S) { - var C = r ? r + u : u; - if (!this._events[C]) return !1; - var D = this._events[C], k = arguments.length, N, z; + var R = r ? r + u : u; + if (!this._events[R]) return !1; + var D = this._events[R], k = arguments.length, N, z; if (D.fn) { switch (D.once && this.removeListener(u, D.fn, void 0, !0), k) { case 1: @@ -29746,8 +29746,8 @@ function iV() { if (S.fn) S.fn === h && (!v || S.once) && (!g || S.context === g) && o(this, x); else { - for (var C = 0, D = [], k = S.length; C < k; C++) - (S[C].fn !== h || v && !S[C].once || g && S[C].context !== g) && D.push(S[C]); + for (var R = 0, D = [], k = S.length; R < k; R++) + (S[R].fn !== h || v && !S[R].once || g && S[R].context !== g) && D.push(S[R]); D.length ? this._events[x] = D.length === 1 ? D[0] : D : o(this, x); } return this; @@ -30177,8 +30177,8 @@ function h0(t, e, r) { metaTokens: !0, dots: !1, indexes: !1 - }, !1, function(C, D) { - return !Ne.isUndefined(D[C]); + }, !1, function(R, D) { + return !Ne.isUndefined(D[R]); }); const n = r.metaTokens, i = r.visitor || h, s = r.dots, o = r.indexes, f = (r.Blob || typeof Blob < "u" && Blob) && Ne.isSpecCompliantForm(e); if (!Ne.isFunction(i)) @@ -30191,39 +30191,39 @@ function h0(t, e, r) { throw new ar("Blob is not supported. Use a Buffer instead."); return Ne.isArrayBuffer(S) || Ne.isTypedArray(S) ? f && typeof Blob == "function" ? new Blob([S]) : Buffer.from(S) : S; } - function h(S, C, D) { + function h(S, R, D) { let k = S; if (S && !D && typeof S == "object") { - if (Ne.endsWith(C, "{}")) - C = n ? C : C.slice(0, -2), S = JSON.stringify(S); - else if (Ne.isArray(S) && eG(S) || (Ne.isFileList(S) || Ne.endsWith(C, "[]")) && (k = Ne.toArray(S))) - return C = sS(C), k.forEach(function(z, B) { + if (Ne.endsWith(R, "{}")) + R = n ? R : R.slice(0, -2), S = JSON.stringify(S); + else if (Ne.isArray(S) && eG(S) || (Ne.isFileList(S) || Ne.endsWith(R, "[]")) && (k = Ne.toArray(S))) + return R = sS(R), k.forEach(function(z, B) { !(Ne.isUndefined(z) || z === null) && e.append( // eslint-disable-next-line no-nested-ternary - o === !0 ? r6([C], B, s) : o === null ? C : C + "[]", + o === !0 ? r6([R], B, s) : o === null ? R : R + "[]", u(z) ); }), !1; } - return _v(S) ? !0 : (e.append(r6(D, C, s), u(S)), !1); + return _v(S) ? !0 : (e.append(r6(D, R, s), u(S)), !1); } const g = [], v = Object.assign(tG, { defaultVisitor: h, convertValue: u, isVisitable: _v }); - function x(S, C) { + function x(S, R) { if (!Ne.isUndefined(S)) { if (g.indexOf(S) !== -1) - throw Error("Circular reference detected in " + C.join(".")); + throw Error("Circular reference detected in " + R.join(".")); g.push(S), Ne.forEach(S, function(k, N) { (!(Ne.isUndefined(k) || k === null) && i.call( e, k, Ne.isString(N) ? N.trim() : N, - C, + R, v - )) === !0 && x(k, C ? C.concat(N) : [N]); + )) === !0 && x(k, R ? R.concat(N) : [N]); }), g.pop(); } } @@ -30877,7 +30877,7 @@ const dS = (t) => { let s = i.data; const o = li.from(i.headers).normalize(); let { responseType: a, onUploadProgress: f, onDownloadProgress: u } = i, h, g, v, x, S; - function C() { + function R() { x && x(), S && S(), i.cancelToken && i.cancelToken.unsubscribe(h), i.signal && i.signal.removeEventListener("abort", h); } let D = new XMLHttpRequest(); @@ -30895,10 +30895,10 @@ const dS = (t) => { config: t, request: D }; - lS(function(R) { - r(R), C(); - }, function(R) { - n(R), C(); + lS(function(C) { + r(C), R(); + }, function(C) { + n(C), R(); }, $), D = null; } "onloadend" in D ? D.onloadend = k : D.onreadystatechange = function() { @@ -31068,7 +31068,7 @@ const kG = async (t) => { } = dS(t); u = u ? (u + "").toLowerCase() : "text"; let x = RG([i, s && s.toAbortSignal()], o), S; - const C = x && x.unsubscribe && (() => { + const R = x && x.unsubscribe && (() => { x.unsubscribe(); }); let D; @@ -31080,11 +31080,11 @@ const kG = async (t) => { duplex: "half" }), U; if (Ne.isFormData(n) && (U = $.headers.get("content-type")) && h.setContentType(U), $.body) { - const [R, W] = o6( + const [C, W] = o6( D, Pd(a6(f)) ); - n = u6($.body, f6, R, W); + n = u6($.body, f6, C, W); } } Ne.isString(g) || (g = g ? "include" : "omit"); @@ -31100,25 +31100,25 @@ const kG = async (t) => { }); let N = await fetch(S); const z = Sv && (u === "stream" || u === "response"); - if (Sv && (a || z && C)) { + if (Sv && (a || z && R)) { const $ = {}; ["status", "statusText", "headers"].forEach((J) => { $[J] = N[J]; }); - const U = Ne.toFiniteNumber(N.headers.get("content-length")), [R, W] = a && o6( + const U = Ne.toFiniteNumber(N.headers.get("content-length")), [C, W] = a && o6( U, Pd(a6(a), !0) ) || []; N = new Response( - u6(N.body, f6, R, () => { - W && W(), C && C(); + u6(N.body, f6, C, () => { + W && W(), R && R(); }), $ ); } u = u || "text"; let B = await Md[Ne.findKey(Md, u) || "text"](N, t); - return !z && C && C(), await new Promise(($, U) => { + return !z && R && R(), await new Promise(($, U) => { lS($, U, { data: B, headers: li.from(N.headers), @@ -31129,7 +31129,7 @@ const kG = async (t) => { }); }); } catch (k) { - throw C && C(), k && k.name === "TypeError" && /fetch/i.test(k.message) ? Object.assign( + throw R && R(), k && k.name === "TypeError" && /fetch/i.test(k.message) ? Object.assign( new ar("Network Error", ar.ERR_NETWORK, t, S), { cause: k.cause || k @@ -31312,12 +31312,12 @@ let Ra = class { ), r.headers = li.concat(o, s); const a = []; let f = !0; - this.interceptors.request.forEach(function(C) { - typeof C.runWhen == "function" && C.runWhen(r) === !1 || (f = f && C.synchronous, a.unshift(C.fulfilled, C.rejected)); + this.interceptors.request.forEach(function(R) { + typeof R.runWhen == "function" && R.runWhen(r) === !1 || (f = f && R.synchronous, a.unshift(R.fulfilled, R.rejected)); }); const u = []; - this.interceptors.response.forEach(function(C) { - u.push(C.fulfilled, C.rejected); + this.interceptors.response.forEach(function(R) { + u.push(R.fulfilled, R.rejected); }); let h, g = 0, v; if (!f) { @@ -31329,11 +31329,11 @@ let Ra = class { v = a.length; let x = r; for (g = 0; g < v; ) { - const S = a[g++], C = a[g++]; + const S = a[g++], R = a[g++]; try { x = S(x); } catch (D) { - C.call(this, D); + R.call(this, D); break; } } @@ -31669,39 +31669,39 @@ function g0() { return In(_S); } function lne(t) { - const { apiBaseUrl: e } = t, [r, n] = Xt([]), [i, s] = Xt([]), [o, a] = Xt(null), [f, u] = Xt(!1), [h, g] = Xt([]), v = (C) => { - a(C); + const { apiBaseUrl: e } = t, [r, n] = Xt([]), [i, s] = Xt([]), [o, a] = Xt(null), [f, u] = Xt(!1), [h, g] = Xt([]), v = (R) => { + a(R); const k = { - provider: C.provider instanceof fv ? "UniversalProvider" : "EIP1193Provider", - key: C.key, + provider: R.provider instanceof fv ? "UniversalProvider" : "EIP1193Provider", + key: R.key, timestamp: Date.now() }; localStorage.setItem("xn-last-used-info", JSON.stringify(k)); }; - function x(C) { - const D = C.find((k) => k.config?.name === t.singleWalletName); + function x(R) { + const D = R.find((k) => k.config?.name === t.singleWalletName); if (D) s([D]); else { - const k = C.filter((B) => B.featured || B.installed), N = C.filter((B) => !B.featured && !B.installed), z = [...k, ...N]; + const k = R.filter((B) => B.featured || B.installed), N = R.filter((B) => !B.featured && !B.installed), z = [...k, ...N]; n(z), s(k); } } async function S() { - const C = [], D = /* @__PURE__ */ new Map(); + const R = [], D = /* @__PURE__ */ new Map(); bT.forEach((N) => { const z = new Tc(N); N.name === "Coinbase Wallet" && z.EIP6963Detected({ info: { name: "Coinbase Wallet", uuid: "coinbase", icon: N.image, rdns: "coinbase" }, provider: GG.getProvider() - }), D.set(z.key, z), C.push(z); + }), D.set(z.key, z), R.push(z); }), (await LW()).forEach((N) => { const z = D.get(N.info.name); if (z) z.EIP6963Detected(N); else { const B = new Tc(N); - D.set(B.key, B), C.push(B); + D.set(B.key, B), R.push(B); } }); try { @@ -31718,7 +31718,7 @@ function lne(t) { } catch (N) { console.log(N); } - t.chains && g(t.chains), x(C), u(!0); + t.chains && g(t.chains), x(R), u(!0); } return Rn(() => { S(), Qo.setApiBase(e); @@ -32690,8 +32690,8 @@ function oJ({ duration: t = 800, bounce: e = 0.25, velocity: r = 0, mass: n = 1 const h = u * o, g = h * t, v = h - r, x = Dv(u, o), S = Math.exp(-g); return wm - v / x * S; }, s = (u) => { - const g = u * o * t, v = g * r + r, x = Math.pow(o, 2) * Math.pow(u, 2) * t, S = Math.exp(-g), C = Dv(Math.pow(u, 2), o); - return (-i(u) + wm > 0 ? -1 : 1) * ((v - x) * S) / C; + const g = u * o * t, v = g * r + r, x = Math.pow(o, 2) * Math.pow(u, 2) * t, S = Math.exp(-g), R = Dv(Math.pow(u, 2), o); + return (-i(u) + wm > 0 ? -1 : 1) * ((v - x) * S) / R; }) : (i = (u) => { const h = Math.exp(-u * t), g = (u - r) * t + 1; return -wm + h * g; @@ -32752,22 +32752,22 @@ function r7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { const i = t[0], s = t[t.length - 1], o = { done: !1, value: i }, { stiffness: a, damping: f, mass: u, duration: h, velocity: g, isResolvedFromDuration: v } = lJ({ ...n, velocity: -oo(n.velocity || 0) - }), x = g || 0, S = f / (2 * Math.sqrt(a * u)), C = s - i, D = oo(Math.sqrt(a / u)), k = Math.abs(C) < 5; + }), x = g || 0, S = f / (2 * Math.sqrt(a * u)), R = s - i, D = oo(Math.sqrt(a / u)), k = Math.abs(R) < 5; r || (r = k ? 0.01 : 2), e || (e = k ? 5e-3 : 0.5); let N; if (S < 1) { const z = Dv(D, S); N = (B) => { const $ = Math.exp(-S * D * B); - return s - $ * ((x + S * D * C) / z * Math.sin(z * B) + C * Math.cos(z * B)); + return s - $ * ((x + S * D * R) / z * Math.sin(z * B) + R * Math.cos(z * B)); }; } else if (S === 1) - N = (z) => s - Math.exp(-D * z) * (C + (x + D * C) * z); + N = (z) => s - Math.exp(-D * z) * (R + (x + D * R) * z); else { const z = D * Math.sqrt(S * S - 1); N = (B) => { const $ = Math.exp(-S * D * B), U = Math.min(z * B, 300); - return s - $ * ((x + S * D * C) * Math.sinh(U) + z * C * Math.cosh(U)) / z; + return s - $ * ((x + S * D * R) * Math.sinh(U) + z * R * Math.cosh(U)) / z; }; } return { @@ -32779,8 +32779,8 @@ function r7({ keyframes: t, restDelta: e, restSpeed: r, ...n }) { else { let $ = 0; S < 1 && ($ = z === 0 ? Cs(x) : t7(N, z, B)); - const U = Math.abs($) <= r, R = Math.abs(s - B) <= e; - o.done = U && R; + const U = Math.abs($) <= r, C = Math.abs(s - B) <= e; + o.done = U && C; } return o.value = o.done ? s : B, o; } @@ -32791,15 +32791,15 @@ function P6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 3 done: !1, value: g }, x = (W) => a !== void 0 && W < a || f !== void 0 && W > f, S = (W) => a === void 0 ? f : f === void 0 || Math.abs(a - W) < Math.abs(f - W) ? a : f; - let C = r * e; - const D = g + C, k = o === void 0 ? D : o(D); - k !== D && (C = k - g); - const N = (W) => -C * Math.exp(-W / n), z = (W) => k + N(W), B = (W) => { + let R = r * e; + const D = g + R, k = o === void 0 ? D : o(D); + k !== D && (R = k - g); + const N = (W) => -R * Math.exp(-W / n), z = (W) => k + N(W), B = (W) => { const J = N(W), ne = z(W); v.done = Math.abs(J) <= u, v.value = v.done ? k : ne; }; let $, U; - const R = (W) => { + const C = (W) => { x(v.value) && ($ = W, U = r7({ keyframes: [v.value, S(v.value)], velocity: t7(z, W, v.value), @@ -32810,11 +32810,11 @@ function P6({ keyframes: t, velocity: e = 0, power: r = 0.8, timeConstant: n = 3 restSpeed: h })); }; - return R(0), { + return C(0), { calculatedDuration: null, next: (W) => { let J = !1; - return !U && $ === void 0 && (J = !0, B(W), R(W)), $ !== void 0 && W >= $ ? U.next(W - $) : (!J && B(W), v); + return !U && $ === void 0 && (J = !0, B(W), C(W)), $ !== void 0 && W >= $ ? U.next(W - $) : (!J && B(W), v); } }; } @@ -33063,7 +33063,7 @@ class ob extends QS { const { finalKeyframe: i, generator: s, mirroredGenerator: o, mapPercentToKeyframes: a, keyframes: f, calculatedDuration: u, totalDuration: h, resolvedDuration: g } = n; if (this.startTime === null) return s.next(0); - const { delay: v, repeat: x, repeatType: S, repeatDelay: C, onUpdate: D } = this.options; + const { delay: v, repeat: x, repeatType: S, repeatDelay: R, onUpdate: D } = this.options; this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - h / this.speed, this.startTime)), r ? this.currentTime = e : this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = Math.round(e - this.startTime) * this.speed; const k = this.currentTime - v * (this.speed >= 0 ? 1 : -1), N = this.speed >= 0 ? k < 0 : k > h; this.currentTime = Math.max(k, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = h); @@ -33071,14 +33071,14 @@ class ob extends QS { if (x) { const W = Math.min(this.currentTime, h) / g; let J = Math.floor(W), ne = W % 1; - !ne && W >= 1 && (ne = 1), ne === 1 && J--, J = Math.min(J, x + 1), !!(J % 2) && (S === "reverse" ? (ne = 1 - ne, C && (ne -= C / g)) : S === "mirror" && (B = o)), z = Go(0, 1, ne) * g; + !ne && W >= 1 && (ne = 1), ne === 1 && J--, J = Math.min(J, x + 1), !!(J % 2) && (S === "reverse" ? (ne = 1 - ne, R && (ne -= R / g)) : S === "mirror" && (B = o)), z = Go(0, 1, ne) * g; } const $ = N ? { done: !1, value: f[0] } : B.next(z); a && ($.value = a($.value)); let { done: U } = $; !N && u !== null && (U = this.speed >= 0 ? this.currentTime >= h : this.currentTime <= 0); - const R = this.holdTime === null && (this.state === "finished" || this.state === "running" && U); - return R && i !== void 0 && ($.value = y0(f, this.options, i)), D && D($.value), R && this.finish(), $; + const C = this.holdTime === null && (this.state === "finished" || this.state === "running" && U); + return C && i !== void 0 && ($.value = y0(f, this.options, i)), D && D($.value), C && this.finish(), $; } get duration() { const { resolved: e } = this; @@ -33253,7 +33253,7 @@ class O6 extends QS { if (!(!((n = f.owner) === null || n === void 0) && n.current)) return !1; if (typeof o == "string" && Rd() && HJ(o) && (o = c7[o]), qJ(this.options)) { - const { onComplete: v, onUpdate: x, motionValue: S, element: C, ...D } = this.options, k = zJ(e, D); + const { onComplete: v, onUpdate: x, motionValue: S, element: R, ...D } = this.options, k = zJ(e, D); e = k.keyframes, e.length === 1 && (e[1] = e[0]), i = k.duration, s = k.times, o = k.ease, a = "keyframes"; } const g = FJ(f.owner.current, u, e, { ...this.options, duration: i, times: s, ease: o }); @@ -33369,8 +33369,8 @@ class O6 extends QS { ease: o, times: a, isGenerator: !0 - }), C = Cs(this.time); - u.setWithVelocity(S.sample(C - Td).value, S.sample(C).value, Td); + }), R = Cs(this.time); + u.setWithVelocity(S.sample(R - Td).value, S.sample(R).value, Td); } const { onStop: f } = this.options; f && f(), this.cancel(); @@ -33767,15 +33767,15 @@ function l7(t, e, { delay: r = 0, transitionOverride: n, type: i } = {}) { delay: r, ...G1(o || {}, g) }; - let C = !1; + let R = !1; if (window.MotionHandoffAnimation) { const k = f7(t); if (k) { const N = window.MotionHandoffAnimation(k, g, kr); - N !== null && (S.startTime = N, C = !0); + N !== null && (S.startTime = N, R = !0); } } - Lv(t, g), v.start(cb(g, v, x, t.shouldReduceMotion && Ya.has(g) ? { type: !1 } : S, t, C)); + Lv(t, g), v.start(cb(g, v, x, t.shouldReduceMotion && Ya.has(g) ? { type: !1 } : S, t, R)); const D = v.animation; D && u.push(D); } @@ -33853,8 +33853,8 @@ function fX(t) { var g; const v = b0(t, h, f === "exit" ? (g = t.presenceContext) === null || g === void 0 ? void 0 : g.custom : void 0); if (v) { - const { transition: x, transitionEnd: S, ...C } = v; - u = { ...u, ...C, ...S }; + const { transition: x, transitionEnd: S, ...R } = v; + u = { ...u, ...R, ...S }; } return u; }; @@ -33873,8 +33873,8 @@ function fX(t) { !z && !N.prevProp || // Or if the prop doesn't define an animation v0(z) || typeof z == "boolean") continue; - const R = lX(N.prevProp, z); - let W = R || // If we're making this variant active, we want to always make it active + const C = lX(N.prevProp, z); + let W = C || // If we're making this variant active, we want to always make it active k === f && N.isActive && !U && B || // If we removed a higher-priority variant (i is in reverse order) D > S && B, J = !1; const ne = Array.isArray(z) ? z : [z]; @@ -33895,7 +33895,7 @@ function fX(t) { let y = !1; Mv(P) && Mv(_) ? y = !MS(P, _) : y = P !== _, y ? P != null ? l(w) : v.add(w) : P !== void 0 && v.has(w) ? l(w) : N.protectedKeys[w] = !0; } - N.prevProp = z, N.prevResolvedValues = K, N.isActive && (x = { ...x, ...K }), n && t.blockInitialAnimation && (W = !1), W && (!(U && R) || J) && g.push(...ne.map((w) => ({ + N.prevProp = z, N.prevResolvedValues = K, N.isActive && (x = { ...x, ...K }), n && t.blockInitialAnimation && (W = !1), W && (!(U && C) || J) && g.push(...ne.map((w) => ({ animation: w, options: { type: k } }))); @@ -33907,8 +33907,8 @@ function fX(t) { z && (z.liveStyle = !0), D[k] = N ?? null; }), g.push({ animation: D }); } - let C = !!g.length; - return n && (u.initial === !1 || u.initial === u.animate) && !t.manuallyAnimateOnMount && (C = !1), n = !1, C ? e(g) : Promise.resolve(); + let R = !!g.length; + return n && (u.initial === !1 || u.initial === u.animate) && !t.manuallyAnimateOnMount && (R = !1), n = !1, R ? e(g) : Promise.resolve(); } function a(f, u) { var h; @@ -34047,16 +34047,16 @@ class p7 { const g = Sm(this.lastMoveEventInfo, this.history), v = this.startEvent !== null, x = vX(g.offset, { x: 0, y: 0 }) >= 3; if (!v && !x) return; - const { point: S } = g, { timestamp: C } = Nn; - this.history.push({ ...S, timestamp: C }); + const { point: S } = g, { timestamp: R } = Nn; + this.history.push({ ...S, timestamp: R }); const { onStart: D, onMove: k } = this.handlers; v || (D && D(this.lastMoveEvent, g), this.startEvent = this.lastMoveEvent), k && k(this.lastMoveEvent, g); }, this.handlePointerMove = (g, v) => { this.lastMoveEvent = g, this.lastMoveEventInfo = Em(v, this.transformPagePoint), kr.update(this.updatePoint, !0); }, this.handlePointerUp = (g, v) => { this.end(); - const { onEnd: x, onSessionEnd: S, resumeAnimation: C } = this.handlers; - if (this.dragSnapToOrigin && C && C(), !(this.lastMoveEvent && this.lastMoveEventInfo)) + const { onEnd: x, onSessionEnd: S, resumeAnimation: R } = this.handlers; + if (this.dragSnapToOrigin && R && R(), !(this.lastMoveEvent && this.lastMoveEventInfo)) return; const D = Sm(g.type === "pointercancel" ? this.lastMoveEventInfo : Em(v, this.transformPagePoint), this.history); this.startEvent && x && x(g, D), S && S(g, D); @@ -34343,10 +34343,10 @@ class $X { } this.originPoint[D] = k; }), S && kr.postRender(() => S(h, g)), Lv(this.visualElement, "transform"); - const { animationState: C } = this.visualElement; - C && C.setActive("whileDrag", !0); + const { animationState: R } = this.visualElement; + R && R.setActive("whileDrag", !0); }, o = (h, g) => { - const { dragPropagation: v, dragDirectionLock: x, onDirectionLock: S, onDrag: C } = this.getProps(); + const { dragPropagation: v, dragDirectionLock: x, onDirectionLock: S, onDrag: R } = this.getProps(); if (!v && !this.openGlobalLock) return; const { offset: D } = g; @@ -34354,7 +34354,7 @@ class $X { this.currentDirection = BX(D), this.currentDirection !== null && S && S(this.currentDirection); return; } - this.updateAxis("x", g.point, D), this.updateAxis("y", g.point, D), this.visualElement.render(), C && C(h, g); + this.updateAxis("x", g.point, D), this.updateAxis("y", g.point, D), this.visualElement.render(), R && R(h, g); }, a = (h, g) => this.stop(h, g), f = () => Ui((h) => { var g; return this.getAnimationState(h) === "paused" && ((g = this.getAxisMotionValue(h).animation) === null || g === void 0 ? void 0 : g.play()); @@ -34943,11 +34943,11 @@ function O7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check this.target = void 0, this.relativeTarget = void 0; return; } - const C = this.options.transition || h.getDefaultTransition() || _Z, { onLayoutAnimationStart: D, onLayoutAnimationComplete: k } = h.getProps(), N = !this.targetLayout || !T7(this.targetLayout, S) || x, z = !v && x; + const R = this.options.transition || h.getDefaultTransition() || _Z, { onLayoutAnimationStart: D, onLayoutAnimationComplete: k } = h.getProps(), N = !this.targetLayout || !T7(this.targetLayout, S) || x, z = !v && x; if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || z || v && (N || !this.currentAnimation)) { this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0), this.setAnimationOrigin(g, z); const B = { - ...G1(C, "layout"), + ...G1(R, "layout"), onPlay: D, onComplete: k }; @@ -35204,12 +35204,12 @@ function O7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check setAnimationOrigin(o, a = !1) { const f = this.snapshot, u = f ? f.latestValues : {}, h = { ...this.latestValues }, g = Sc(); (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !a; - const v = fn(), x = f ? f.source : void 0, S = this.layout ? this.layout.source : void 0, C = x !== S, D = this.getStack(), k = !D || D.members.length <= 1, N = !!(C && !k && this.options.crossfade === !0 && !this.path.some(xZ)); + const v = fn(), x = f ? f.source : void 0, S = this.layout ? this.layout.source : void 0, R = x !== S, D = this.getStack(), k = !D || D.members.length <= 1, N = !!(R && !k && this.options.crossfade === !0 && !this.path.some(xZ)); this.animationProgress = 0; let z; this.mixTargetDelta = (B) => { const $ = B / 1e3; - b5(g.x, o.x, $), b5(g.y, o.y, $), this.setTargetDelta(g), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (uf(v, this.layout.layoutBox, this.relativeParent.layout.layoutBox), wZ(this.relativeTarget, this.relativeTargetOrigin, v, $), z && QX(this.relativeTarget, z) && (this.isProjectionDirty = !1), z || (z = fn()), Fi(z, this.relativeTarget)), C && (this.animationValues = h, VX(h, u, this.latestValues, $, N, k)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = $; + b5(g.x, o.x, $), b5(g.y, o.y, $), this.setTargetDelta(g), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (uf(v, this.layout.layoutBox, this.relativeParent.layout.layoutBox), wZ(this.relativeTarget, this.relativeTargetOrigin, v, $), z && QX(this.relativeTarget, z) && (this.isProjectionDirty = !1), z || (z = fn()), Fi(z, this.relativeTarget)), R && (this.animationValues = h, VX(h, u, this.latestValues, $, N, k)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = $; }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0); } startAnimation(o) { @@ -35312,23 +35312,23 @@ function O7({ attachResizeListener: t, defaultParent: e, measureScroll: r, check return this.needsReset = !1, u.opacity = "", u.pointerEvents = rd(o?.pointerEvents) || "", u.transform = h ? h(this.latestValues, "") : "none", u; const g = this.getLead(); if (!this.projectionDelta || !this.layout || !g.target) { - const C = {}; - return this.options.layoutId && (C.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, C.pointerEvents = rd(o?.pointerEvents) || ""), this.hasProjected && !ya(this.latestValues) && (C.transform = h ? h({}, "") : "none", this.hasProjected = !1), C; + const R = {}; + return this.options.layoutId && (R.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, R.pointerEvents = rd(o?.pointerEvents) || ""), this.hasProjected && !ya(this.latestValues) && (R.transform = h ? h({}, "") : "none", this.hasProjected = !1), R; } const v = g.animationValues || g.latestValues; this.applyTransformsToTarget(), u.transform = tZ(this.projectionDeltaWithTransform, this.treeScale, v), h && (u.transform = h(v, u.transform)); const { x, y: S } = this.projectionDelta; u.transformOrigin = `${x.origin * 100}% ${S.origin * 100}% 0`, g.animationValues ? u.opacity = g === this ? (f = (a = v.opacity) !== null && a !== void 0 ? a : this.latestValues.opacity) !== null && f !== void 0 ? f : 1 : this.preserveOpacity ? this.latestValues.opacity : v.opacityExit : u.opacity = g === this ? v.opacity !== void 0 ? v.opacity : "" : v.opacityExit !== void 0 ? v.opacityExit : 0; - for (const C in Od) { - if (v[C] === void 0) + for (const R in Od) { + if (v[R] === void 0) continue; - const { correct: D, applyTo: k } = Od[C], N = u.transform === "none" ? v[C] : D(v[C], g); + const { correct: D, applyTo: k } = Od[R], N = u.transform === "none" ? v[R] : D(v[R], g); if (k) { const z = k.length; for (let B = 0; B < z; B++) u[k[B]] = N; } else - u[C] = N; + u[R] = N; } return this.options.layoutId && (u.pointerEvents = g === this ? rd(o?.pointerEvents) || "" : "none"), u; } @@ -35372,8 +35372,8 @@ function fZ(t) { if (v && x) { const S = fn(); uf(S, r.layoutBox, v.layoutBox); - const C = fn(); - uf(C, n, x.layoutBox), T7(S, C) || (h = !0), g.options.layoutRoot && (t.relativeTarget = C, t.relativeTargetOrigin = S, t.relativeParent = g); + const R = fn(); + uf(R, n, x.layoutBox), T7(S, R) || (h = !0), g.options.layoutRoot && (t.relativeTarget = R, t.relativeTargetOrigin = S, t.relativeParent = g); } } } @@ -35695,13 +35695,13 @@ function FZ(t, e, r, n, i) { H5(() => { v && S.current && v.update(r, u); }); - const C = r[u7], D = Kn(!!C && !(!((s = window.MotionHandoffIsComplete) === null || s === void 0) && s.call(window, C)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, C))); + const R = r[u7], D = Kn(!!R && !(!((s = window.MotionHandoffIsComplete) === null || s === void 0) && s.call(window, R)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, R))); return $7(() => { v && (S.current = !0, window.MotionIsMounted = !0, v.updateFeatures(), pb.render(v.render), D.current && v.animationState && v.animationState.animateChanges()); }), Rn(() => { v && (!D.current && v.animationState && v.animationState.animateChanges(), D.current && (queueMicrotask(() => { var k; - (k = window.MotionHandoffMarkAsComplete) === null || k === void 0 || k.call(window, C); + (k = window.MotionHandoffMarkAsComplete) === null || k === void 0 || k.call(window, R); }), D.current = !1)); }), v; } @@ -35968,7 +35968,7 @@ function ZZ(t, e, r, n) { for (let x = 0; x < v.length; x++) { const S = W1(t, v[x]); if (S) { - const { transitionEnd: C, transition: D, ...k } = S; + const { transitionEnd: R, transition: D, ...k } = S; for (const N in k) { let z = k[N]; if (Array.isArray(z)) { @@ -35977,8 +35977,8 @@ function ZZ(t, e, r, n) { } z !== null && (i[N] = z); } - for (const N in C) - i[N] = C[N]; + for (const N in R) + i[N] = R[N]; } } } @@ -36607,7 +36607,7 @@ function C5(t) { } const DQ = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExitComplete: i, presenceAffectsLayout: s = !0, mode: o = "sync" }) => { po(!e, "Replace exitBeforeEnter with mode='wait'"); - const a = hi(() => C5(t), [t]), f = a.map(Th), u = Kn(!0), h = Kn(a), g = yb(() => /* @__PURE__ */ new Map()), [v, x] = Xt(a), [S, C] = Xt(a); + const a = hi(() => C5(t), [t]), f = a.map(Th), u = Kn(!0), h = Kn(a), g = yb(() => /* @__PURE__ */ new Map()), [v, x] = Xt(a), [S, R] = Xt(a); $7(() => { u.current = !1, h.current = a; for (let N = 0; N < S.length; N++) { @@ -36622,7 +36622,7 @@ const DQ = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExi const B = S[z], $ = Th(B); f.includes($) || (N.splice(z, 0, B), D.push(B)); } - o === "wait" && D.length && (N = D), C(C5(N)), x(a); + o === "wait" && D.length && (N = D), R(C5(N)), x(a); return; } process.env.NODE_ENV !== "production" && o === "wait" && S.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`); @@ -36634,9 +36634,9 @@ const DQ = ({ children: t, exitBeforeEnter: e, custom: r, initial: n = !0, onExi else return; let U = !0; - g.forEach((R) => { - R || (U = !1); - }), U && (k?.(), C(h.current), i && i()); + g.forEach((C) => { + C || (U = !1); + }), U && (k?.(), R(h.current), i && i()); }; return pe.jsx(RQ, { isPresent: B, initial: !u.current || n ? void 0 : !1, custom: B ? void 0 : r, presenceAffectsLayout: s, mode: o, onExitComplete: B ? void 0 : $, children: N }, z); }) }); @@ -36820,12 +36820,12 @@ const LQ = NQ, Ab = "-", kQ = (t) => { } k === "[" ? u++ : k === "]" && u--; } - const v = f.length === 0 ? a : a.substring(h), x = v.startsWith(r9), S = x ? v.substring(1) : v, C = g && g > h ? g - h : void 0; + const v = f.length === 0 ? a : a.substring(h), x = v.startsWith(r9), S = x ? v.substring(1) : v, R = g && g > h ? g - h : void 0; return { modifiers: f, hasImportantModifier: x, baseClassName: S, - maybePostfixModifierPosition: C + maybePostfixModifierPosition: R }; }; return r ? (a) => r({ @@ -36858,23 +36858,23 @@ const LQ = NQ, Ab = "-", kQ = (t) => { baseClassName: v, maybePostfixModifierPosition: x } = r(u); - let S = !!x, C = n(S ? v.substring(0, x) : v); - if (!C) { + let S = !!x, R = n(S ? v.substring(0, x) : v); + if (!R) { if (!S) { a = u + (a.length > 0 ? " " + a : a); continue; } - if (C = n(v), !C) { + if (R = n(v), !R) { a = u + (a.length > 0 ? " " + a : a); continue; } S = !1; } - const D = zQ(h).join(":"), k = g ? D + r9 : D, N = k + C; + const D = zQ(h).join(":"), k = g ? D + r9 : D, N = k + R; if (s.includes(N)) continue; s.push(N); - const z = i(C, S); + const z = i(R, S); for (let B = 0; B < z.length; ++B) { const $ = z[B]; s.push(k + $); @@ -36926,7 +36926,7 @@ const Gr = (t) => { // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough. ZQ.test(t) && !QQ.test(t) ), s9 = () => !1, fee = (t) => eee.test(t), lee = (t) => tee.test(t), hee = () => { - const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), f = Gr("contrast"), u = Gr("grayscale"), h = Gr("hueRotate"), g = Gr("invert"), v = Gr("gap"), x = Gr("gradientColorStops"), S = Gr("gradientColorStopPositions"), C = Gr("inset"), D = Gr("margin"), k = Gr("opacity"), N = Gr("padding"), z = Gr("saturate"), B = Gr("scale"), $ = Gr("sepia"), U = Gr("skew"), R = Gr("space"), W = Gr("translate"), J = () => ["auto", "contain", "none"], ne = () => ["auto", "hidden", "clip", "visible", "scroll"], K = () => ["auto", ur, e], E = () => [ur, e], b = () => ["", Js, Io], l = () => ["auto", $c, ur], p = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], m = () => ["solid", "dashed", "dotted", "double", "none"], w = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], P = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], _ = () => ["", "0", ur], y = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], M = () => [$c, ur]; + const t = Gr("colors"), e = Gr("spacing"), r = Gr("blur"), n = Gr("brightness"), i = Gr("borderColor"), s = Gr("borderRadius"), o = Gr("borderSpacing"), a = Gr("borderWidth"), f = Gr("contrast"), u = Gr("grayscale"), h = Gr("hueRotate"), g = Gr("invert"), v = Gr("gap"), x = Gr("gradientColorStops"), S = Gr("gradientColorStopPositions"), R = Gr("inset"), D = Gr("margin"), k = Gr("opacity"), N = Gr("padding"), z = Gr("saturate"), B = Gr("scale"), $ = Gr("sepia"), U = Gr("skew"), C = Gr("space"), W = Gr("translate"), J = () => ["auto", "contain", "none"], ne = () => ["auto", "hidden", "clip", "visible", "scroll"], K = () => ["auto", ur, e], E = () => [ur, e], b = () => ["", Js, Io], l = () => ["auto", $c, ur], p = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], m = () => ["solid", "dashed", "dotted", "double", "none"], w = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], P = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], _ = () => ["", "0", ur], y = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], M = () => [$c, ur]; return { cacheSize: 500, separator: ":", @@ -37103,63 +37103,63 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/top-right-bottom-left */ inset: [{ - inset: [C] + inset: [R] }], /** * Right / Left * @see https://tailwindcss.com/docs/top-right-bottom-left */ "inset-x": [{ - "inset-x": [C] + "inset-x": [R] }], /** * Top / Bottom * @see https://tailwindcss.com/docs/top-right-bottom-left */ "inset-y": [{ - "inset-y": [C] + "inset-y": [R] }], /** * Start * @see https://tailwindcss.com/docs/top-right-bottom-left */ start: [{ - start: [C] + start: [R] }], /** * End * @see https://tailwindcss.com/docs/top-right-bottom-left */ end: [{ - end: [C] + end: [R] }], /** * Top * @see https://tailwindcss.com/docs/top-right-bottom-left */ top: [{ - top: [C] + top: [R] }], /** * Right * @see https://tailwindcss.com/docs/top-right-bottom-left */ right: [{ - right: [C] + right: [R] }], /** * Bottom * @see https://tailwindcss.com/docs/top-right-bottom-left */ bottom: [{ - bottom: [C] + bottom: [R] }], /** * Left * @see https://tailwindcss.com/docs/top-right-bottom-left */ left: [{ - left: [C] + left: [R] }], /** * Visibility @@ -37520,7 +37520,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/space */ "space-x": [{ - "space-x": [R] + "space-x": [C] }], /** * Space Between X Reverse @@ -37532,7 +37532,7 @@ const Gr = (t) => { * @see https://tailwindcss.com/docs/space */ "space-y": [{ - "space-y": [R] + "space-y": [C] }], /** * Space Between Y Reverse @@ -38991,42 +38991,41 @@ function mee(t) { ] }) }); } function a9(t) { - const [e, r] = Xt(""), { featuredWallets: n, initialized: i } = g0(), { onEmailConfirm: s, onSelectWallet: o, onSelectMoreWallets: a, onSelectTonConnect: f, config: u } = t, h = hi(() => { - const C = /[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu, D = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; - return !C.test(e) && D.test(e); + const [e, r] = Xt(""), { featuredWallets: n, initialized: i } = g0(), { onEmailConfirm: s, onSelectWallet: o, onSelectMoreWallets: a, onSelectTonConnect: f, config: u, useSingleWallet: h } = t, g = hi(() => { + const D = /[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u{2a700}-\u{2b73f}]|[\u{2b740}-\u{2b81f}]|[\u{2b820}-\u{2ceaf}]|[\uf900-\ufaff]|[\u3300-\u33ff]|[\ufe30-\ufe4f]/gu, k = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; + return !D.test(e) && k.test(e); }, [e]); - function g(C) { - o(C); + function v(D) { + o(D); } - function v(C) { - r(C.target.value); + function x(D) { + r(D.target.value); } - async function x() { + async function S() { s(e); } - function S(C) { - C.key === "Enter" && h && x(); + function R(D) { + D.key === "Enter" && g && S(); } return /* @__PURE__ */ pe.jsx(ps, { children: i && /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ t.header || /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-6 xc-text-xl xc-font-bold", children: "Log in or sign up" }), - n.length === 1 && /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: n.map((C) => /* @__PURE__ */ pe.jsx( + n.length === 1 && h ? /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: n.map((D) => /* @__PURE__ */ pe.jsx( pee, { - wallet: C, - onClick: g + wallet: D, + onClick: v }, - `feature-${C.key}` - )) }), - n.length > 1 && /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ + `feature-${D.key}` + )) }) : /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ /* @__PURE__ */ pe.jsxs("div", { children: [ /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-4 xc-flex xc-max-h-[309px] xc-flex-col xc-gap-4 xc-overflow-scroll no-scrollbar", children: [ - u.showFeaturedWallets && n && n.map((C) => /* @__PURE__ */ pe.jsx( + u.showFeaturedWallets && n && n.map((D) => /* @__PURE__ */ pe.jsx( Q7, { - wallet: C, - onClick: g + wallet: D, + onClick: v }, - `feature-${C.key}` + `feature-${D.key}` )), u.showTonConnect && /* @__PURE__ */ pe.jsx( Sb, @@ -39044,8 +39043,8 @@ function a9(t) { /* @__PURE__ */ pe.jsx("span", { className: "xc-text-sm xc-opacity-20", children: "OR" }) ] }) }), u.showEmailSignIn && /* @__PURE__ */ pe.jsxs("div", { className: "xc-mb-4", children: [ - /* @__PURE__ */ pe.jsx("input", { className: "xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3", placeholder: "Enter your email", type: "email", onChange: v, onKeyDown: S }), - /* @__PURE__ */ pe.jsx("button", { disabled: !h, className: "xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all", onClick: x, children: "Continue" }) + /* @__PURE__ */ pe.jsx("input", { className: "xc-w-full xc-bg-transparent xc-border-white xc-border xc-border-opacity-15 xc-h-10 xc-rounded-lg xc-px-3 xc-mb-3", placeholder: "Enter your email", type: "email", onChange: x, onKeyDown: R }), + /* @__PURE__ */ pe.jsx("button", { disabled: !g, className: "xc-bg-[rgb(135,93,255)] xc-text-white xc-w-full xc-rounded-lg xc-py-2 disabled:xc-bg-opacity-10 disabled:xc-text-opacity-50 disabled:xc-bg-white xc-transition-all", onClick: S, children: "Continue" }) ] }) ] }) ] }) }); @@ -39110,15 +39109,15 @@ function Cee({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isF let [i, s] = Jt.useState(!1), [o, a] = Jt.useState(!1), [f, u] = Jt.useState(!1), h = Jt.useMemo(() => r === "none" ? !1 : (r === "increase-width" || r === "experimental-no-flickering") && i && o, [i, o, r]), g = Jt.useCallback(() => { let v = t.current, x = e.current; if (!v || !x || f || r === "none") return; - let S = v, C = S.getBoundingClientRect().left + S.offsetWidth, D = S.getBoundingClientRect().top + S.offsetHeight / 2, k = C - Pee, N = D; + let S = v, R = S.getBoundingClientRect().left + S.offsetWidth, D = S.getBoundingClientRect().top + S.offsetHeight / 2, k = R - Pee, N = D; document.querySelectorAll(Iee).length === 0 && document.elementFromPoint(k, N) === v || (s(!0), u(!0)); }, [t, e, f, r]); return Jt.useEffect(() => { let v = t.current; if (!v || r === "none") return; function x() { - let C = window.innerWidth - v.getBoundingClientRect().right; - a(C >= l9); + let R = window.innerWidth - v.getBoundingClientRect().right; + a(R >= l9); } x(); let S = setInterval(x, 1e3); @@ -39128,17 +39127,17 @@ function Cee({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: r, isF }, [t, r]), Jt.useEffect(() => { let v = n || document.activeElement === e.current; if (r === "none" || !v) return; - let x = setTimeout(g, 0), S = setTimeout(g, 2e3), C = setTimeout(g, 5e3), D = setTimeout(() => { + let x = setTimeout(g, 0), S = setTimeout(g, 2e3), R = setTimeout(g, 5e3), D = setTimeout(() => { u(!0); }, 6e3); return () => { - clearTimeout(x), clearTimeout(S), clearTimeout(C), clearTimeout(D); + clearTimeout(x), clearTimeout(S), clearTimeout(R), clearTimeout(D); }; }, [e, n, r, g]), { hasPWMBadge: i, willPushPWMBadge: h, PWM_BADGE_SPACE_WIDTH: Mee }; } var h9 = Jt.createContext({}), d9 = Jt.forwardRef((t, e) => { - var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: f, inputMode: u = "numeric", onComplete: h, pushPasswordManagerStrategy: g = "increase-width", pasteTransformer: v, containerClassName: x, noScriptCSSFallback: S = Ree, render: C, children: D } = r, k = Eee(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), N, z, B, $, U; - let [R, W] = Jt.useState(typeof k.defaultValue == "string" ? k.defaultValue : ""), J = n ?? R, ne = Aee(J), K = Jt.useCallback((ae) => { + var r = t, { value: n, onChange: i, maxLength: s, textAlign: o = "left", pattern: a, placeholder: f, inputMode: u = "numeric", onComplete: h, pushPasswordManagerStrategy: g = "increase-width", pasteTransformer: v, containerClassName: x, noScriptCSSFallback: S = Ree, render: R, children: D } = r, k = Eee(r, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), N, z, B, $, U; + let [C, W] = Jt.useState(typeof k.defaultValue == "string" ? k.defaultValue : ""), J = n ?? C, ne = Aee(J), K = Jt.useCallback((ae) => { i?.(ae), W(ae); }, [i]), E = Jt.useMemo(() => a ? typeof a == "string" ? new RegExp(a) : a : null, [a]), b = Jt.useRef(null), l = Jt.useRef(null), p = Jt.useRef({ value: J, onChange: K, isIOS: typeof window < "u" && ((z = (N = window?.CSS) == null ? void 0 : N.supports) == null ? void 0 : z.call(N, "-webkit-touch-callout", "none")) }), m = Jt.useRef({ prev: [(B = b.current) == null ? void 0 : B.selectionStart, ($ = b.current) == null ? void 0 : $.selectionEnd, (U = b.current) == null ? void 0 : U.selectionDirection] }); Jt.useImperativeHandle(e, () => b.current, []), Jt.useEffect(() => { @@ -39243,7 +39242,7 @@ var h9 = Jt.createContext({}), d9 = Jt.forwardRef((t, e) => { var be; let Ae = _ && M !== null && q !== null && (M === q && fe === M || fe >= M && fe < q), Te = J[fe] !== void 0 ? J[fe] : null, Re = J[0] !== void 0 ? null : (be = f?.[fe]) != null ? be : null; return { char: Te, placeholderChar: Re, isActive: Ae, hasFakeCaret: Ae && Te === null }; - }), isFocused: _, isHovering: !k.disabled && w }), [_, w, s, q, M, k.disabled, J]), he = Jt.useMemo(() => C ? C(re) : Jt.createElement(h9.Provider, { value: re }, D), [D, re, C]); + }), isFocused: _, isHovering: !k.disabled && w }), [_, w, s, q, M, k.disabled, J]), he = Jt.useMemo(() => R ? R(re) : Jt.createElement(h9.Provider, { value: re }, D), [D, re, R]); return Jt.createElement(Jt.Fragment, null, S !== null && Jt.createElement("noscript", null, Jt.createElement("style", null, S)), Jt.createElement("div", { ref: l, "data-input-otp-container": !0, style: ee, className: x }, he, Jt.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, Z))); }); d9.displayName = "Input"; @@ -39517,7 +39516,7 @@ function Nee() { var ae = null; switch (he = he || "Byte") { case "Numeric": - ae = R(re); + ae = C(re); break; case "Alphanumeric": ae = W(re); @@ -39668,18 +39667,18 @@ function Nee() { return _; }; }; - var v, x, S, C, D, k = { L: 1, M: 0, Q: 3, H: 2 }, N = (v = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], x = 1335, S = 7973, D = function(l) { + var v, x, S, R, D, k = { L: 1, M: 0, Q: 3, H: 2 }, N = (v = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], x = 1335, S = 7973, D = function(l) { for (var p = 0; l != 0; ) p += 1, l >>>= 1; return p; - }, (C = {}).getBCHTypeInfo = function(l) { + }, (R = {}).getBCHTypeInfo = function(l) { for (var p = l << 10; D(p) - D(x) >= 0; ) p ^= x << D(p) - D(x); return 21522 ^ (l << 10 | p); - }, C.getBCHTypeNumber = function(l) { + }, R.getBCHTypeNumber = function(l) { for (var p = l << 12; D(p) - D(S) >= 0; ) p ^= S << D(p) - D(S); return l << 12 | p; - }, C.getPatternPosition = function(l) { + }, R.getPatternPosition = function(l) { return v[l - 1]; - }, C.getMaskFunction = function(l) { + }, R.getMaskFunction = function(l) { switch (l) { case 0: return function(p, m) { @@ -39716,10 +39715,10 @@ function Nee() { default: throw "bad maskPattern:" + l; } - }, C.getErrorCorrectPolynomial = function(l) { + }, R.getErrorCorrectPolynomial = function(l) { for (var p = B([1], 0), m = 0; m < l; m += 1) p = p.multiply(B([1, z.gexp(m)], 0)); return p; - }, C.getLengthInBits = function(l, p) { + }, R.getLengthInBits = function(l, p) { if (1 <= p && p < 10) switch (l) { case 1: return 10; @@ -39758,7 +39757,7 @@ function Nee() { throw "mode:" + l; } } - }, C.getLostPoint = function(l) { + }, R.getLostPoint = function(l) { for (var p = l.getModuleCount(), m = 0, w = 0; w < p; w += 1) for (var P = 0; P < p; P += 1) { for (var _ = 0, y = l.isDark(w, P), M = -1; M <= 1; M += 1) if (!(w + M < 0 || p <= w + M)) for (var I = -1; I <= 1; I += 1) P + I < 0 || p <= P + I || M == 0 && I == 0 || y == l.isDark(w + M, P + I) && (_ += 1); _ > 5 && (m += 3 + _ - 5); @@ -39772,7 +39771,7 @@ function Nee() { var ce = 0; for (P = 0; P < p; P += 1) for (w = 0; w < p; w += 1) l.isDark(w, P) && (ce += 1); return m + Math.abs(100 * ce / p / p - 50) / 5 * 10; - }, C), z = (function() { + }, R), z = (function() { for (var l = new Array(256), p = new Array(256), m = 0; m < 8; m += 1) l[m] = 1 << m; for (m = 8; m < 256; m += 1) l[m] = l[m - 4] ^ l[m - 5] ^ l[m - 6] ^ l[m - 8]; for (m = 0; m < 255; m += 1) p[l[m]] = m; @@ -39845,7 +39844,7 @@ function Nee() { l.length <= P && l.push(0), w && (l[P] |= 128 >>> p % 8), p += 1; } }; return m; - }, R = function(l) { + }, C = function(l) { var p = l, m = { getMode: function() { return 1; }, getLength: function(_) { @@ -40042,8 +40041,8 @@ function Nee() { h.stringToBytesFuncs["UTF-8"] = function(g) { return (function(v) { for (var x = [], S = 0; S < v.length; S++) { - var C = v.charCodeAt(S); - C < 128 ? x.push(C) : C < 2048 ? x.push(192 | C >> 6, 128 | 63 & C) : C < 55296 || C >= 57344 ? x.push(224 | C >> 12, 128 | C >> 6 & 63, 128 | 63 & C) : (S++, C = 65536 + ((1023 & C) << 10 | 1023 & v.charCodeAt(S)), x.push(240 | C >> 18, 128 | C >> 12 & 63, 128 | C >> 6 & 63, 128 | 63 & C)); + var R = v.charCodeAt(S); + R < 128 ? x.push(R) : R < 2048 ? x.push(192 | R >> 6, 128 | 63 & R) : R < 55296 || R >= 57344 ? x.push(224 | R >> 12, 128 | R >> 6 & 63, 128 | 63 & R) : (S++, R = 65536 + ((1023 & R) << 10 | 1023 & v.charCodeAt(S)), x.push(240 | R >> 18, 128 | R >> 12 & 63, 128 | R >> 6 & 63, 128 | 63 & R)); } return x; })(g); @@ -40276,7 +40275,7 @@ function Nee() { this._basicSquare({ x: b, y: l, size: p, rotation: m }); } } - const x = "circle", S = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]], C = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]; + const x = "circle", S = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]], R = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]; class D { constructor(b, l) { this._roundSize = (p) => this._options.dotsOptions.roundSize ? Math.floor(p) : p, this._window = l, this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._element.setAttribute("width", String(b.width)), this._element.setAttribute("height", String(b.height)), this._element.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), b.dotsOptions.roundSize || this._element.setAttribute("shape-rendering", "crispEdges"), this._element.setAttribute("viewBox", `0 0 ${b.width} ${b.height}`), this._defs = this._window.document.createElementNS("http://www.w3.org/2000/svg", "defs"), this._element.appendChild(this._defs), this._imageUri = b.image, this._instanceId = D.instanceCount++, this._options = b; @@ -40305,7 +40304,7 @@ function Nee() { } this.drawBackground(), this.drawDots(((_, y) => { var M, I, q, ce, L, oe; - return !(this._options.imageOptions.hideBackgroundDots && _ >= (l - P.hideYDots) / 2 && _ < (l + P.hideYDots) / 2 && y >= (l - P.hideXDots) / 2 && y < (l + P.hideXDots) / 2 || !((M = S[_]) === null || M === void 0) && M[y] || !((I = S[_ - l + 7]) === null || I === void 0) && I[y] || !((q = S[_]) === null || q === void 0) && q[y - l + 7] || !((ce = C[_]) === null || ce === void 0) && ce[y] || !((L = C[_ - l + 7]) === null || L === void 0) && L[y] || !((oe = C[_]) === null || oe === void 0) && oe[y - l + 7]); + return !(this._options.imageOptions.hideBackgroundDots && _ >= (l - P.hideYDots) / 2 && _ < (l + P.hideYDots) / 2 && y >= (l - P.hideXDots) / 2 && y < (l + P.hideXDots) / 2 || !((M = S[_]) === null || M === void 0) && M[y] || !((I = S[_ - l + 7]) === null || I === void 0) && I[y] || !((q = S[_]) === null || q === void 0) && q[y - l + 7] || !((ce = R[_]) === null || ce === void 0) && ce[y] || !((L = R[_ - l + 7]) === null || L === void 0) && L[y] || !((oe = R[_]) === null || oe === void 0) && oe[y - l + 7]); })), this.drawCorners(), this._options.image && await this.drawImage({ width: P.width, height: P.height, count: l, dotSize: w }); } drawBackground() { @@ -40364,9 +40363,9 @@ function Nee() { Oe.draw(Te + 2 * P, Re + 2 * P, y, L), Oe._element && Me && Me.appendChild(Oe._element); } else { const Oe = new h({ svg: this._element, type: l.dotsOptions.type, window: this._window }); - for (let ze = 0; ze < C.length; ze++) for (let De = 0; De < C[ze].length; De++) !((Ae = C[ze]) === null || Ae === void 0) && Ae[De] && (Oe.draw(Te + De * P, Re + ze * P, P, ((je, Ue) => { + for (let ze = 0; ze < R.length; ze++) for (let De = 0; De < R[ze].length; De++) !((Ae = R[ze]) === null || Ae === void 0) && Ae[De] && (Oe.draw(Te + De * P, Re + ze * P, P, ((je, Ue) => { var _e; - return !!(!((_e = C[ze + Ue]) === null || _e === void 0) && _e[De + je]); + return !!(!((_e = R[ze + Ue]) === null || _e === void 0) && _e[De + je]); })), Oe._element && Me && Me.appendChild(Oe._element)); } })); @@ -40437,7 +40436,7 @@ function Nee() { const b = Object.assign({}, E); return b.width = Number(b.width), b.height = Number(b.height), b.margin = Number(b.margin), b.imageOptions = Object.assign(Object.assign({}, b.imageOptions), { hideBackgroundDots: !!b.imageOptions.hideBackgroundDots, imageSize: Number(b.imageOptions.imageSize), margin: Number(b.imageOptions.margin) }), b.margin > Math.min(b.width, b.height) && (b.margin = Math.min(b.width, b.height)), b.dotsOptions = Object.assign({}, b.dotsOptions), b.dotsOptions.gradient && (b.dotsOptions.gradient = $(b.dotsOptions.gradient)), b.cornersSquareOptions && (b.cornersSquareOptions = Object.assign({}, b.cornersSquareOptions), b.cornersSquareOptions.gradient && (b.cornersSquareOptions.gradient = $(b.cornersSquareOptions.gradient))), b.cornersDotOptions && (b.cornersDotOptions = Object.assign({}, b.cornersDotOptions), b.cornersDotOptions.gradient && (b.cornersDotOptions.gradient = $(b.cornersDotOptions.gradient))), b.backgroundOptions && (b.backgroundOptions = Object.assign({}, b.backgroundOptions), b.backgroundOptions.gradient && (b.backgroundOptions.gradient = $(b.backgroundOptions.gradient))), b; } - var R = i(873), W = i.n(R); + var C = i(873), W = i.n(C); function J(E) { if (!E) throw new Error("Extension must be defined"); E[0] === "." && (E = E.substring(1)); @@ -40654,7 +40653,7 @@ function y9(t) { }); } const v = e1(t.address), x = u ? `${u}://${r}` : r, S = t.statement ? `${t.statement} -` : "", C = `${x} wants you to sign in with your Ethereum account: +` : "", R = `${x} wants you to sign in with your Ethereum account: ${v} ${S}`; @@ -40685,7 +40684,7 @@ Resources:`; } D += k; } - return `${C} + return `${R} ${D}`; } const $ee = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/, Bee = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/, Fee = /^localhost(:[0-9]{1,5})?$/, jee = /^[a-zA-Z0-9]{8,}$/, Uee = /^([a-zA-Z][a-zA-Z0-9+-.]*)$/, w9 = "7a4434fefbcc9af474fb5c995e47d286", qee = { @@ -40727,7 +40726,7 @@ function Hee(t, e) { }); } function x9(t) { - const e = Kn(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Xt(""), [a, f] = Xt(!1), [u, h] = Xt(""), [g, v] = Xt("scan"), x = Kn(), [S, C] = Xt(r.config?.image), [D, k] = Xt(!1), { saveLastUsedWallet: N } = g0(); + const e = Kn(null), { wallet: r, onGetExtension: n, onSignFinish: i } = t, [s, o] = Xt(""), [a, f] = Xt(!1), [u, h] = Xt(""), [g, v] = Xt("scan"), x = Kn(), [S, R] = Xt(r.config?.image), [D, k] = Xt(!1), { saveLastUsedWallet: N } = g0(); async function z(J) { f(!0); const ne = await NW.init(qee); @@ -40741,7 +40740,7 @@ function x9(t) { console.log("session_update", w); }), !await ne.connect(zee)) throw new Error("Walletconnect init failed"); const E = new Tc(ne); - C(E.config?.image || J.config?.image); + R(E.config?.image || J.config?.image); const b = await E.getAddress(), l = await Qo.getNonce({ account_type: "block_chain" }); console.log("get nonce", l); const p = Hee(b, l); @@ -40792,7 +40791,7 @@ function x9(t) { function U() { h(""), $(""), z(r); } - function R() { + function C() { k(!0), navigator.clipboard.writeText(s), setTimeout(() => { k(!1); }, 2500); @@ -40813,7 +40812,7 @@ function x9(t) { "button", { disabled: !s, - onClick: R, + onClick: C, className: "xc-disabled:hover-text-white xc-flex xc-min-w-[160px] xc-flex-1 xc-shrink-0 xc-items-center xc-justify-center xc-gap-2 xc-rounded-full xc-border xc-py-2 xc-text-sm xc-transition-all xc-hover:bg-white xc-hover:text-black xc-disabled:cursor-not-allowed xc-disabled:opacity-40 xc-disabled:hover:bg-transparent", children: D ? /* @__PURE__ */ pe.jsxs(pe.Fragment, { children: [ " ", @@ -40909,8 +40908,8 @@ function _9(t) { const x = await n.connect(); if (!x || x.length === 0) throw new Error("Wallet connect error"); - const S = await n.getChain(), C = u.find((B) => B.id === S), D = C || u[0] || Wee; - !C && u.length > 0 && (a("switch-chain"), await n.switchChain(D)); + const S = await n.getChain(), R = u.find((B) => B.id === S), D = R || u[0] || Wee; + !R && u.length > 0 && (a("switch-chain"), await n.switchChain(D)); const k = e1(x[0]), N = Gee(k, v, D.id); a("sign"); const z = await n.signMessage(N, k); @@ -41169,16 +41168,16 @@ function ate() { function S(H, V, Y, T) { H[V] = Y >> 24 & 255, H[V + 1] = Y >> 16 & 255, H[V + 2] = Y >> 8 & 255, H[V + 3] = Y & 255, H[V + 4] = T >> 24 & 255, H[V + 5] = T >> 16 & 255, H[V + 6] = T >> 8 & 255, H[V + 7] = T & 255; } - function C(H, V, Y, T, F) { + function R(H, V, Y, T, F) { var ie, le = 0; for (ie = 0; ie < F; ie++) le |= H[V + ie] ^ Y[T + ie]; return (1 & le - 1 >>> 8) - 1; } function D(H, V, Y, T) { - return C(H, V, Y, T, 16); + return R(H, V, Y, T, 16); } function k(H, V, Y, T) { - return C(H, V, Y, T, 32); + return R(H, V, Y, T, 32); } function N(H, V, Y, T) { for (var F = T[0] & 255 | (T[1] & 255) << 8 | (T[2] & 255) << 16 | (T[3] & 255) << 24, ie = Y[0] & 255 | (Y[1] & 255) << 8 | (Y[2] & 255) << 16 | (Y[3] & 255) << 24, le = Y[4] & 255 | (Y[5] & 255) << 8 | (Y[6] & 255) << 16 | (Y[7] & 255) << 24, me = Y[8] & 255 | (Y[9] & 255) << 8 | (Y[10] & 255) << 16 | (Y[11] & 255) << 24, Ee = Y[12] & 255 | (Y[13] & 255) << 8 | (Y[14] & 255) << 16 | (Y[15] & 255) << 24, Le = T[4] & 255 | (T[5] & 255) << 8 | (T[6] & 255) << 16 | (T[7] & 255) << 24, Ie = V[0] & 255 | (V[1] & 255) << 8 | (V[2] & 255) << 16 | (V[3] & 255) << 24, Qe = V[4] & 255 | (V[5] & 255) << 8 | (V[6] & 255) << 16 | (V[7] & 255) << 24, Xe = V[8] & 255 | (V[9] & 255) << 8 | (V[10] & 255) << 16 | (V[11] & 255) << 24, tt = V[12] & 255 | (V[13] & 255) << 8 | (V[14] & 255) << 16 | (V[15] & 255) << 24, st = T[8] & 255 | (T[9] & 255) << 8 | (T[10] & 255) << 16 | (T[11] & 255) << 24, vt = Y[16] & 255 | (Y[17] & 255) << 8 | (Y[18] & 255) << 16 | (Y[19] & 255) << 24, Ct = Y[20] & 255 | (Y[21] & 255) << 8 | (Y[22] & 255) << 16 | (Y[23] & 255) << 24, Mt = Y[24] & 255 | (Y[25] & 255) << 8 | (Y[26] & 255) << 16 | (Y[27] & 255) << 24, wt = Y[28] & 255 | (Y[29] & 255) << 8 | (Y[30] & 255) << 16 | (Y[31] & 255) << 24, Rt = T[12] & 255 | (T[13] & 255) << 8 | (T[14] & 255) << 16 | (T[15] & 255) << 24, gt = F, _t = ie, at = le, yt = me, ut = Ee, it = Le, Se = Ie, Pe = Qe, Ke = Xe, Fe = tt, qe = st, Ye = vt, Lt = Ct, zt = Mt, Zt = wt, Ht = Rt, ge, nr = 0; nr < 20; nr += 2) @@ -41197,7 +41196,7 @@ function ate() { z(H, V, Y, T); } var U = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); - function R(H, V, Y, T, F, ie, le) { + function C(H, V, Y, T, F, ie, le) { var me = new Uint8Array(16), Ee = new Uint8Array(64), Le, Ie; for (Ie = 0; Ie < 16; Ie++) me[Ie] = 0; for (Ie = 0; Ie < 8; Ie++) me[Ie] = ie[Ie]; @@ -41235,7 +41234,7 @@ function ate() { var me = new Uint8Array(32); $(me, ie, le, U); for (var Ee = new Uint8Array(8), Le = 0; Le < 8; Le++) Ee[Le] = ie[Le + 16]; - return R(H, V, Y, T, F, Ee, me); + return C(H, V, Y, T, F, Ee, me); } var K = function(H) { this.buffer = new Uint8Array(16), this.r = new Uint16Array(10), this.h = new Uint16Array(10), this.pad = new Uint16Array(8), this.leftover = 0, this.fin = 0; @@ -41654,7 +41653,7 @@ function ate() { crypto_core_hsalsa20: $, crypto_stream_xor: ne, crypto_stream: J, - crypto_stream_salsa20_xor: R, + crypto_stream_salsa20_xor: C, crypto_stream_salsa20: W, crypto_onetimeauth: E, crypto_onetimeauth_verify: b, @@ -41802,7 +41801,7 @@ function ate() { var V = new Uint8Array(mt); return Re(V, H, H.length), V; }, e.hash.hashLength = mt, e.verify = function(H, V) { - return et(H, V), H.length === 0 || V.length === 0 || H.length !== V.length ? !1 : C(H, 0, V, 0, H.length) === 0; + return et(H, V), H.length === 0 || V.length === 0 || H.length !== V.length ? !1 : R(H, 0, V, 0, H.length) === 0; }, e.setPRNG = function(H) { n = H; }, (function() { @@ -42262,8 +42261,8 @@ function Pte(t, e) { } }), recreate: (g) => At(this, void 0, void 0, function* () { - const v = r, x = i, S = n, C = s; - if (yield M9(g), v === r && x === i && S === n && C === s) + const v = r, x = i, S = n, R = s; + if (yield M9(g), v === r && x === i && S === n && R === s) return yield a(s, ...S ?? []); throw new jt("Resource recreation was aborted by a new resource creation"); }) @@ -43941,7 +43940,7 @@ function Lm(t) { return /* @__PURE__ */ pe.jsx("button", { onClick: r, className: "xc-border xc-px-4 xc-py-2 xc-rounded-full xc-text-sm xc-flex xc-gap-2 xc-items-center", children: e }); } function T9(t) { - const { wallet: e, connector: r, loading: n } = t, i = Kn(null), s = Kn(), [o, a] = Xt(), [f, u] = Xt(), [h, g] = Xt("connect"), [v, x] = Xt(!1), [S, C] = Xt(); + const { wallet: e, connector: r, loading: n } = t, i = Kn(null), s = Kn(), [o, a] = Xt(), [f, u] = Xt(), [h, g] = Xt("connect"), [v, x] = Xt(!1), [S, R] = Xt(); function D(W) { s.current?.update({ data: W @@ -43960,7 +43959,7 @@ function T9(t) { request: { tonProof: W } }); if (!J) return; - C(J), D(J), u(W); + R(J), D(J), u(W); } } catch (W) { a(W.message); @@ -44000,7 +43999,7 @@ function T9(t) { function $() { "universalLink" in e && e.universalLink && /t.me/.test(e.universalLink) && window.open(S); } - const U = hi(() => !!("deepLink" in e && e.deepLink), [e]), R = hi(() => !!("universalLink" in e && e.universalLink && /t.me/.test(e.universalLink)), [e]); + const U = hi(() => !!("deepLink" in e && e.deepLink), [e]), C = hi(() => !!("universalLink" in e && e.universalLink && /t.me/.test(e.universalLink)), [e]); return Rn(() => { N(), k(); }, []), /* @__PURE__ */ pe.jsxs(ps, { children: [ @@ -44023,7 +44022,7 @@ function T9(t) { /* @__PURE__ */ pe.jsx(AS, { className: "xc-opacity-80" }), "Desktop" ] }), - R && /* @__PURE__ */ pe.jsx(Lm, { onClick: $, children: "Telegram Mini App" }) + C && /* @__PURE__ */ pe.jsx(Lm, { onClick: $, children: "Telegram Mini App" }) ] }) ] }) ] }); @@ -44156,7 +44155,7 @@ function dne(t) { function S(k) { f("email"), v(k); } - async function C(k) { + async function R(k) { await e(k); } function D() { @@ -44169,7 +44168,7 @@ function dne(t) { rte, { onBack: () => f("index"), - onLogin: C, + onLogin: R, wallet: u } ), @@ -44177,14 +44176,15 @@ function dne(t) { rre, { onBack: () => f("index"), - onLogin: C + onLogin: R } ), - a === "email" && /* @__PURE__ */ pe.jsx(Dee, { email: g, onBack: () => f("index"), onLogin: C }), + a === "email" && /* @__PURE__ */ pe.jsx(Dee, { email: g, onBack: () => f("index"), onLogin: R }), a === "index" && /* @__PURE__ */ pe.jsx( a9, { header: r, + useSingleWallet: !0, onEmailConfirm: S, onSelectWallet: x, onSelectMoreWallets: () => { @@ -44237,7 +44237,7 @@ function ire(t) { function sre(t) { const { email: e } = t, [r, n] = Xt("captcha"); return /* @__PURE__ */ pe.jsxs(ps, { children: [ - /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ pe.jsx(Ja, { title: "Sign in with email", onBack: t.onBack }) }), + /* @__PURE__ */ pe.jsx("div", { className: "xc-mb-12", children: /* @__PURE__ */ pe.jsx(Ja, { title: "Connect with email", onBack: t.onBack }) }), r === "captcha" && /* @__PURE__ */ pe.jsx(v9, { email: e, onCodeSend: () => n("verify-email") }), r === "verify-email" && /* @__PURE__ */ pe.jsx(m9, { email: e, onInputCode: t.onInputCode, onResendCode: () => n("captcha") }) ] }); @@ -44249,7 +44249,7 @@ function pne(t) { showMoreWallets: !0, showTonConnect: !0 } } = t, [o, a] = Xt(""), [f, u] = Xt(), [h, g] = Xt(), v = Kn(), [x, S] = Xt(""); - function C($) { + function R($) { u($), a("evm-wallet-connect"); } function D($) { @@ -44288,7 +44288,7 @@ function pne(t) { O9, { onBack: () => a("index"), - onSelectWallet: C + onSelectWallet: R } ), o === "evm-wallet-connect" && /* @__PURE__ */ pe.jsx( @@ -44320,8 +44320,9 @@ function pne(t) { a9, { header: i, + useSingleWallet: !1, onEmailConfirm: D, - onSelectWallet: C, + onSelectWallet: R, onSelectMoreWallets: () => a("evm-wallet-select"), onSelectTonConnect: () => a("ton-wallet-select"), config: s diff --git a/dist/secp256k1-K3HVP1eD.js b/dist/secp256k1-C66jOJWb.js similarity index 99% rename from dist/secp256k1-K3HVP1eD.js rename to dist/secp256k1-C66jOJWb.js index c506b01..351456c 100644 --- a/dist/secp256k1-K3HVP1eD.js +++ b/dist/secp256k1-C66jOJWb.js @@ -1,4 +1,4 @@ -import { h as xt, i as Tt, a as at, b as st, c as F, H as Jt, d as te, t as ee, e as ne, f as qt, g as re, r as oe, s as ie } from "./main-DmP-7EWG.js"; +import { h as xt, i as Tt, a as at, b as st, c as F, H as Jt, d as te, t as ee, e as ne, f as qt, g as re, r as oe, s as ie } from "./main-CtRNJ0s5.js"; /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const St = /* @__PURE__ */ BigInt(0), Et = /* @__PURE__ */ BigInt(1); function lt(e, n) { diff --git a/lib/codatta-connect.tsx b/lib/codatta-connect.tsx index 5cce031..ee61046 100644 --- a/lib/codatta-connect.tsx +++ b/lib/codatta-connect.tsx @@ -134,6 +134,7 @@ export function CodattaConnect(props: { {step === 'index' && ( setStep('evm-wallet-select')} diff --git a/lib/codatta-signin.tsx b/lib/codatta-signin.tsx index 165714e..0200605 100644 --- a/lib/codatta-signin.tsx +++ b/lib/codatta-signin.tsx @@ -69,6 +69,7 @@ export function CodattaSignin(props: { {step === 'index' && ( { setStep('all-wallet') }} diff --git a/lib/components/email-connect-widget.tsx b/lib/components/email-connect-widget.tsx index 51debcb..7f799b0 100644 --- a/lib/components/email-connect-widget.tsx +++ b/lib/components/email-connect-widget.tsx @@ -17,7 +17,7 @@ export default function EmailConnectWidget(props: { return (
- +
{step === 'captcha' && setStep('verify-email')} />} {step === 'verify-email' && setStep('captcha')}>} diff --git a/lib/components/signin-index.tsx b/lib/components/signin-index.tsx index f7089bd..57e529b 100644 --- a/lib/components/signin-index.tsx +++ b/lib/components/signin-index.tsx @@ -32,6 +32,7 @@ export default function SingInIndex(props: { onSelectWallet: (walletOption: WalletItem) => void onSelectMoreWallets: () => void onSelectTonConnect: () => void + useSingleWallet: boolean config: { showEmailSignIn?: boolean showTonConnect?: boolean @@ -41,7 +42,7 @@ export default function SingInIndex(props: { }) { const [email, setEmail] = useState('') const { featuredWallets, initialized } = useCodattaConnectContext() - const { onEmailConfirm, onSelectWallet, onSelectMoreWallets, onSelectTonConnect, config } = props + const { onEmailConfirm, onSelectWallet, onSelectMoreWallets, onSelectTonConnect, config, useSingleWallet } = props const isEmail = useMemo(() => { const hasChinese = @@ -74,51 +75,49 @@ export default function SingInIndex(props: { {props.header ||
Log in or sign up
} - {featuredWallets.length === 1 && ( -
- {featuredWallets.map((wallet) => )} -
- ) - } - - {featuredWallets.length > 1 && <> -
-
- {config.showFeaturedWallets && featuredWallets && - featuredWallets.map((wallet) => ( - - ))} - {config.showTonConnect && ( - } - title="TON Connect" - onClick={onSelectTonConnect} - > - )} -
- {config.showMoreWallets && } + {(featuredWallets.length === 1 && useSingleWallet) ? ( +
+ {featuredWallets.map((wallet) => )}
+ ) + : <> +
+
+ {config.showFeaturedWallets && featuredWallets && + featuredWallets.map((wallet) => ( + + ))} + {config.showTonConnect && ( + } + title="TON Connect" + onClick={onSelectTonConnect} + > + )} +
+ {config.showMoreWallets && } +
- {config.showEmailSignIn && (config.showFeaturedWallets || config.showTonConnect) &&
- OR -
- } - - {config.showEmailSignIn && ( -
- - + {config.showEmailSignIn && (config.showFeaturedWallets || config.showTonConnect) &&
+ OR
- )} - } + } + + {config.showEmailSignIn && ( +
+ + +
+ )} + } } ) diff --git a/package.json b/package.json index 33859bb..a45e0ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codatta-connect", - "version": "2.7.9", + "version": "2.8.1", "type": "module", "main": "./dist/index.umd.js", "module": "./dist/index.es.js", diff --git a/src/layout/app-layout.tsx b/src/layout/app-layout.tsx index cca16b8..c38f8a1 100644 --- a/src/layout/app-layout.tsx +++ b/src/layout/app-layout.tsx @@ -25,7 +25,7 @@ const BSC_CHAIN = defineChain({ }) export default function AppLayout(props: { children: React.ReactNode }) { - return + return
{props.children}
diff --git a/src/views/login-view.tsx b/src/views/login-view.tsx index fd84f4e..dd33696 100644 --- a/src/views/login-view.tsx +++ b/src/views/login-view.tsx @@ -78,7 +78,8 @@ export default function LoginView() { showTonConnect: true, showMoreWallets: true, }} - >*/} + header={
heiheiha
} + > */}